@rexeus/typeweaver 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/acorn-ZFAHQIG7.js +3131 -0
- package/dist/angular-WMVKTHFF.js +3031 -0
- package/dist/babel-5QZSVJOE.js +7297 -0
- package/dist/chunk-K3NQKI34.js +10 -0
- package/dist/cli-GOSMI5D3.js +34642 -0
- package/dist/cli.js +1 -1
- package/dist/entry.js +4 -3
- package/dist/estree-Y36AM62I.js +4613 -0
- package/dist/flow-7LH7X5GA.js +27547 -0
- package/dist/glimmer-CBYXJR5M.js +2895 -0
- package/dist/graphql-KKVSZXX7.js +1267 -0
- package/dist/html-M3WOAMIJ.js +2927 -0
- package/dist/index.js +1 -1
- package/dist/markdown-X6DQGEVV.js +3552 -0
- package/dist/meriyah-GWPOVAHY.js +2685 -0
- package/dist/postcss-N2W7KQ6Q.js +5081 -0
- package/dist/{tsx-loader-H3LYLQCE.js → tsx-loader-3QUDYASH.js} +2 -0
- package/dist/typescript-IYJMK2NE.js +13204 -0
- package/dist/yaml-5FEMTYXO.js +4225 -0
- package/package.json +7 -7
- package/dist/entry.cjs +0 -116942
- package/dist/entry.d.cts +0 -2
- package/dist/entry.d.ts +0 -2
- /package/dist/{chunk-Q6MQC6UP.js → chunk-4ST7XK4F.js} +0 -0
|
@@ -0,0 +1,4613 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "./chunk-K3NQKI34.js";
|
|
3
|
+
|
|
4
|
+
// ../../node_modules/.pnpm/prettier@3.7.4/node_modules/prettier/plugins/estree.mjs
|
|
5
|
+
var Ba = Object.defineProperty;
|
|
6
|
+
var jn = (e, t) => {
|
|
7
|
+
for (var r in t) Ba(e, r, { get: t[r], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var Ta = {};
|
|
10
|
+
jn(Ta, { languages: () => CD, options: () => Aa, printers: () => dD });
|
|
11
|
+
var Qs = [{ name: "JavaScript", type: "programming", aceMode: "javascript", extensions: [".js", "._js", ".bones", ".cjs", ".es", ".es6", ".gs", ".jake", ".javascript", ".jsb", ".jscad", ".jsfl", ".jslib", ".jsm", ".jspre", ".jss", ".mjs", ".njs", ".pac", ".sjs", ".ssjs", ".xsjs", ".xsjslib", ".start.frag", ".end.frag", ".wxs"], filenames: ["Jakefile", "start.frag", "end.frag"], tmScope: "source.js", aliases: ["js", "node"], codemirrorMode: "javascript", codemirrorMimeType: "text/javascript", interpreters: ["chakra", "d8", "gjs", "js", "node", "nodejs", "qjs", "rhino", "v8", "v8-shell", "zx"], parsers: ["babel", "acorn", "espree", "meriyah", "babel-flow", "babel-ts", "flow", "typescript"], vscodeLanguageIds: ["javascript", "mongo"], linguistLanguageId: 183 }, { name: "Flow", type: "programming", aceMode: "javascript", extensions: [".js.flow"], filenames: [], tmScope: "source.js", aliases: [], codemirrorMode: "javascript", codemirrorMimeType: "text/javascript", interpreters: ["chakra", "d8", "gjs", "js", "node", "nodejs", "qjs", "rhino", "v8", "v8-shell"], parsers: ["flow", "babel-flow"], vscodeLanguageIds: ["javascript"], linguistLanguageId: 183 }, { name: "JSX", type: "programming", aceMode: "javascript", extensions: [".jsx"], filenames: void 0, tmScope: "source.js.jsx", aliases: void 0, codemirrorMode: "jsx", codemirrorMimeType: "text/jsx", interpreters: void 0, parsers: ["babel", "babel-flow", "babel-ts", "flow", "typescript", "espree", "meriyah"], vscodeLanguageIds: ["javascriptreact"], group: "JavaScript", linguistLanguageId: 183 }, { name: "TypeScript", type: "programming", aceMode: "typescript", extensions: [".ts", ".cts", ".mts"], tmScope: "source.ts", aliases: ["ts"], codemirrorMode: "javascript", codemirrorMimeType: "application/typescript", interpreters: ["bun", "deno", "ts-node", "tsx"], parsers: ["typescript", "babel-ts"], vscodeLanguageIds: ["typescript"], linguistLanguageId: 378 }, { name: "TSX", type: "programming", aceMode: "tsx", extensions: [".tsx"], tmScope: "source.tsx", codemirrorMode: "jsx", codemirrorMimeType: "text/typescript-jsx", group: "TypeScript", parsers: ["typescript", "babel-ts"], vscodeLanguageIds: ["typescriptreact"], linguistLanguageId: 94901924 }];
|
|
12
|
+
var Hs = {};
|
|
13
|
+
jn(Hs, { canAttachComment: () => Pi, embed: () => Co, features: () => DD, getVisitorKeys: () => Mr, handleComments: () => Ji, hasPrettierIgnore: () => nr, insertPragma: () => Lo, isBlockComment: () => ce, isGap: () => Gi, massageAstNode: () => Bi, print: () => Ys, printComment: () => wo, printPrettierIgnored: () => Ys, willPrintOwnComments: () => Wi });
|
|
14
|
+
var Wt = (e, t) => (r, n, ...s) => r | 1 && n == null ? void 0 : (t.call(n) ?? n[e]).apply(n, s);
|
|
15
|
+
var ba = String.prototype.replaceAll ?? function(e, t) {
|
|
16
|
+
return e.global ? this.replace(e, t) : this.split(e).join(t);
|
|
17
|
+
};
|
|
18
|
+
var Pa = Wt("replaceAll", function() {
|
|
19
|
+
if (typeof this == "string") return ba;
|
|
20
|
+
});
|
|
21
|
+
var W = Pa;
|
|
22
|
+
function ka(e) {
|
|
23
|
+
return this[e < 0 ? this.length + e : e];
|
|
24
|
+
}
|
|
25
|
+
var Ia = Wt("at", function() {
|
|
26
|
+
if (Array.isArray(this) || typeof this == "string") return ka;
|
|
27
|
+
});
|
|
28
|
+
var N = Ia;
|
|
29
|
+
function La(e) {
|
|
30
|
+
return e !== null && typeof e == "object";
|
|
31
|
+
}
|
|
32
|
+
var Lr = La;
|
|
33
|
+
function* Oa(e, t) {
|
|
34
|
+
let { getVisitorKeys: r, filter: n = () => true } = t, s = (i) => Lr(i) && n(i);
|
|
35
|
+
for (let i of r(e)) {
|
|
36
|
+
let o = e[i];
|
|
37
|
+
if (Array.isArray(o)) for (let u of o) s(u) && (yield u);
|
|
38
|
+
else s(o) && (yield o);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function* wa(e, t) {
|
|
42
|
+
let r = [e];
|
|
43
|
+
for (let n = 0; n < r.length; n++) {
|
|
44
|
+
let s = r[n];
|
|
45
|
+
for (let i of Oa(s, t)) yield i, r.push(i);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function zs(e, { getVisitorKeys: t, predicate: r }) {
|
|
49
|
+
for (let n of wa(e, { getVisitorKeys: t })) if (r(n)) return true;
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
var Zs = () => /[#*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;
|
|
53
|
+
function vn(e) {
|
|
54
|
+
return e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
|
|
55
|
+
}
|
|
56
|
+
function Rn(e) {
|
|
57
|
+
return e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9776 && e <= 9783 || e >= 9800 && e <= 9811 || e === 9855 || e >= 9866 && e <= 9871 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12773 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e >= 94192 && e <= 94198 || e >= 94208 && e <= 101589 || e >= 101631 && e <= 101662 || e >= 101760 && e <= 101874 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e >= 119552 && e <= 119638 || e >= 119648 && e <= 119670 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128728 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129674 || e >= 129678 && e <= 129734 || e === 129736 || e >= 129741 && e <= 129756 || e >= 129759 && e <= 129770 || e >= 129775 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
|
|
58
|
+
}
|
|
59
|
+
var ei = "\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07";
|
|
60
|
+
var _a = /[^\x20-\x7F]/u;
|
|
61
|
+
var Ma = new Set(ei);
|
|
62
|
+
function Na(e) {
|
|
63
|
+
if (!e) return 0;
|
|
64
|
+
if (!_a.test(e)) return e.length;
|
|
65
|
+
e = e.replace(Zs(), (r) => Ma.has(r) ? " " : " ");
|
|
66
|
+
let t = 0;
|
|
67
|
+
for (let r of e) {
|
|
68
|
+
let n = r.codePointAt(0);
|
|
69
|
+
n <= 31 || n >= 127 && n <= 159 || n >= 768 && n <= 879 || n >= 65024 && n <= 65039 || (t += vn(n) || Rn(n) ? 2 : 1);
|
|
70
|
+
}
|
|
71
|
+
return t;
|
|
72
|
+
}
|
|
73
|
+
var ot = Na;
|
|
74
|
+
function Or(e) {
|
|
75
|
+
return (t, r, n) => {
|
|
76
|
+
let s = !!n?.backwards;
|
|
77
|
+
if (r === false) return false;
|
|
78
|
+
let { length: i } = t, o = r;
|
|
79
|
+
for (; o >= 0 && o < i; ) {
|
|
80
|
+
let u = t.charAt(o);
|
|
81
|
+
if (e instanceof RegExp) {
|
|
82
|
+
if (!e.test(u)) return o;
|
|
83
|
+
} else if (!e.includes(u)) return o;
|
|
84
|
+
s ? o-- : o++;
|
|
85
|
+
}
|
|
86
|
+
return o === -1 || o === i ? o : false;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
var JD = Or(/\s/u);
|
|
90
|
+
var ze = Or(" ");
|
|
91
|
+
var ti = Or(",; ");
|
|
92
|
+
var ri = Or(/[^\n\r]/u);
|
|
93
|
+
var ni = (e) => e === `
|
|
94
|
+
` || e === "\r" || e === "\u2028" || e === "\u2029";
|
|
95
|
+
function ja(e, t, r) {
|
|
96
|
+
let n = !!r?.backwards;
|
|
97
|
+
if (t === false) return false;
|
|
98
|
+
let s = e.charAt(t);
|
|
99
|
+
if (n) {
|
|
100
|
+
if (e.charAt(t - 1) === "\r" && s === `
|
|
101
|
+
`) return t - 2;
|
|
102
|
+
if (ni(s)) return t - 1;
|
|
103
|
+
} else {
|
|
104
|
+
if (s === "\r" && e.charAt(t + 1) === `
|
|
105
|
+
`) return t + 2;
|
|
106
|
+
if (ni(s)) return t + 1;
|
|
107
|
+
}
|
|
108
|
+
return t;
|
|
109
|
+
}
|
|
110
|
+
var Ze = ja;
|
|
111
|
+
function va(e, t, r = {}) {
|
|
112
|
+
let n = ze(e, r.backwards ? t - 1 : t, r), s = Ze(e, n, r);
|
|
113
|
+
return n !== s;
|
|
114
|
+
}
|
|
115
|
+
var Z = va;
|
|
116
|
+
function Ra(e, t) {
|
|
117
|
+
if (t === false) return false;
|
|
118
|
+
if (e.charAt(t) === "/" && e.charAt(t + 1) === "*") {
|
|
119
|
+
for (let r = t + 2; r < e.length; ++r) if (e.charAt(r) === "*" && e.charAt(r + 1) === "/") return r + 2;
|
|
120
|
+
}
|
|
121
|
+
return t;
|
|
122
|
+
}
|
|
123
|
+
var qt = Ra;
|
|
124
|
+
function Ja(e, t) {
|
|
125
|
+
return t === false ? false : e.charAt(t) === "/" && e.charAt(t + 1) === "/" ? ri(e, t) : t;
|
|
126
|
+
}
|
|
127
|
+
var Ut = Ja;
|
|
128
|
+
function Ga(e, t) {
|
|
129
|
+
let r = null, n = t;
|
|
130
|
+
for (; n !== r; ) r = n, n = ti(e, n), n = qt(e, n), n = ze(e, n);
|
|
131
|
+
return n = Ut(e, n), n = Ze(e, n), n !== false && Z(e, n);
|
|
132
|
+
}
|
|
133
|
+
var Yt = Ga;
|
|
134
|
+
function Wa(e) {
|
|
135
|
+
return Array.isArray(e) && e.length > 0;
|
|
136
|
+
}
|
|
137
|
+
var R = Wa;
|
|
138
|
+
var qa = () => {
|
|
139
|
+
};
|
|
140
|
+
var Le = qa;
|
|
141
|
+
var si = Object.freeze({ character: "'", codePoint: 39 });
|
|
142
|
+
var ii = Object.freeze({ character: '"', codePoint: 34 });
|
|
143
|
+
var Ua = Object.freeze({ preferred: si, alternate: ii });
|
|
144
|
+
var Ya = Object.freeze({ preferred: ii, alternate: si });
|
|
145
|
+
function Ha(e, t) {
|
|
146
|
+
let { preferred: r, alternate: n } = t === true || t === "'" ? Ua : Ya, { length: s } = e, i = 0, o = 0;
|
|
147
|
+
for (let u = 0; u < s; u++) {
|
|
148
|
+
let p = e.charCodeAt(u);
|
|
149
|
+
p === r.codePoint ? i++ : p === n.codePoint && o++;
|
|
150
|
+
}
|
|
151
|
+
return (i > o ? n : r).character;
|
|
152
|
+
}
|
|
153
|
+
var wr = Ha;
|
|
154
|
+
var Xa = /\\(["'\\])|(["'])/gu;
|
|
155
|
+
function Va(e, t) {
|
|
156
|
+
let r = t === '"' ? "'" : '"', n = W(0, e, Xa, (s, i, o) => i ? i === r ? r : s : o === t ? "\\" + o : o);
|
|
157
|
+
return t + n + t;
|
|
158
|
+
}
|
|
159
|
+
var oi = Va;
|
|
160
|
+
function $a(e, t) {
|
|
161
|
+
Le(/^(?<quote>["']).*\k<quote>$/su.test(e));
|
|
162
|
+
let r = e.slice(1, -1), n = t.parser === "json" || t.parser === "jsonc" || t.parser === "json5" && t.quoteProps === "preserve" && !t.singleQuote ? '"' : t.__isInHtmlAttribute ? "'" : wr(r, t.singleQuote);
|
|
163
|
+
return e.charAt(0) === n ? e : oi(r, n);
|
|
164
|
+
}
|
|
165
|
+
var ut = $a;
|
|
166
|
+
var ui = (e) => Number.isInteger(e) && e >= 0;
|
|
167
|
+
function w(e) {
|
|
168
|
+
let t = e.range?.[0] ?? e.start, r = (e.declaration?.decorators ?? e.decorators)?.[0];
|
|
169
|
+
return r ? Math.min(w(r), t) : t;
|
|
170
|
+
}
|
|
171
|
+
function I(e) {
|
|
172
|
+
return e.range?.[1] ?? e.end;
|
|
173
|
+
}
|
|
174
|
+
function bt(e, t) {
|
|
175
|
+
let r = w(e);
|
|
176
|
+
return ui(r) && r === w(t);
|
|
177
|
+
}
|
|
178
|
+
function Ka(e, t) {
|
|
179
|
+
let r = I(e);
|
|
180
|
+
return ui(r) && r === I(t);
|
|
181
|
+
}
|
|
182
|
+
function ai(e, t) {
|
|
183
|
+
return bt(e, t) && Ka(e, t);
|
|
184
|
+
}
|
|
185
|
+
var Dr = null;
|
|
186
|
+
function fr(e) {
|
|
187
|
+
if (Dr !== null && typeof Dr.property) {
|
|
188
|
+
let t = Dr;
|
|
189
|
+
return Dr = fr.prototype = null, t;
|
|
190
|
+
}
|
|
191
|
+
return Dr = fr.prototype = e ?? /* @__PURE__ */ Object.create(null), new fr();
|
|
192
|
+
}
|
|
193
|
+
var Qa = 10;
|
|
194
|
+
for (let e = 0; e <= Qa; e++) fr();
|
|
195
|
+
function Gn(e) {
|
|
196
|
+
return fr(e);
|
|
197
|
+
}
|
|
198
|
+
function za(e, t = "type") {
|
|
199
|
+
Gn(e);
|
|
200
|
+
function r(n) {
|
|
201
|
+
let s = n[t], i = e[s];
|
|
202
|
+
if (!Array.isArray(i)) throw Object.assign(new Error(`Missing visitor keys for '${s}'.`), { node: n });
|
|
203
|
+
return i;
|
|
204
|
+
}
|
|
205
|
+
return r;
|
|
206
|
+
}
|
|
207
|
+
var _r = za;
|
|
208
|
+
var a = [["decorators", "key", "typeAnnotation", "value"], [], ["elementType"], ["expression"], ["expression", "typeAnnotation"], ["left", "right"], ["argument"], ["directives", "body"], ["label"], ["callee", "typeArguments", "arguments"], ["body"], ["decorators", "id", "typeParameters", "superClass", "superTypeArguments", "mixins", "implements", "body", "superTypeParameters"], ["id", "typeParameters"], ["decorators", "key", "typeParameters", "params", "returnType", "body"], ["decorators", "variance", "key", "typeAnnotation", "value"], ["name", "typeAnnotation"], ["test", "consequent", "alternate"], ["checkType", "extendsType", "trueType", "falseType"], ["value"], ["id", "body"], ["declaration", "specifiers", "source", "attributes"], ["id"], ["id", "typeParameters", "extends", "body"], ["typeAnnotation"], ["id", "typeParameters", "right"], ["body", "test"], ["members"], ["id", "init"], ["exported"], ["left", "right", "body"], ["id", "typeParameters", "params", "predicate", "returnType", "body"], ["id", "params", "body", "typeParameters", "returnType"], ["key", "value"], ["local"], ["objectType", "indexType"], ["typeParameter"], ["types"], ["node"], ["object", "property"], ["argument", "cases"], ["pattern", "body", "guard"], ["literal"], ["decorators", "key", "value"], ["expressions"], ["qualification", "id"], ["decorators", "key", "typeAnnotation"], ["typeParameters", "params", "returnType"], ["expression", "typeArguments"], ["params"], ["parameterName", "typeAnnotation"]];
|
|
209
|
+
var pi = { AccessorProperty: a[0], AnyTypeAnnotation: a[1], ArgumentPlaceholder: a[1], ArrayExpression: ["elements"], ArrayPattern: ["elements", "typeAnnotation", "decorators"], ArrayTypeAnnotation: a[2], ArrowFunctionExpression: ["typeParameters", "params", "predicate", "returnType", "body"], AsConstExpression: a[3], AsExpression: a[4], AssignmentExpression: a[5], AssignmentPattern: ["left", "right", "decorators", "typeAnnotation"], AwaitExpression: a[6], BigIntLiteral: a[1], BigIntLiteralTypeAnnotation: a[1], BigIntTypeAnnotation: a[1], BinaryExpression: a[5], BindExpression: ["object", "callee"], BlockStatement: a[7], BooleanLiteral: a[1], BooleanLiteralTypeAnnotation: a[1], BooleanTypeAnnotation: a[1], BreakStatement: a[8], CallExpression: a[9], CatchClause: ["param", "body"], ChainExpression: a[3], ClassAccessorProperty: a[0], ClassBody: a[10], ClassDeclaration: a[11], ClassExpression: a[11], ClassImplements: a[12], ClassMethod: a[13], ClassPrivateMethod: a[13], ClassPrivateProperty: a[14], ClassProperty: a[14], ComponentDeclaration: ["id", "params", "body", "typeParameters", "rendersType"], ComponentParameter: ["name", "local"], ComponentTypeAnnotation: ["params", "rest", "typeParameters", "rendersType"], ComponentTypeParameter: a[15], ConditionalExpression: a[16], ConditionalTypeAnnotation: a[17], ContinueStatement: a[8], DebuggerStatement: a[1], DeclareClass: ["id", "typeParameters", "extends", "mixins", "implements", "body"], DeclareComponent: ["id", "params", "rest", "typeParameters", "rendersType"], DeclaredPredicate: a[18], DeclareEnum: a[19], DeclareExportAllDeclaration: ["source", "attributes"], DeclareExportDeclaration: a[20], DeclareFunction: ["id", "predicate"], DeclareHook: a[21], DeclareInterface: a[22], DeclareModule: a[19], DeclareModuleExports: a[23], DeclareNamespace: a[19], DeclareOpaqueType: ["id", "typeParameters", "supertype", "lowerBound", "upperBound"], DeclareTypeAlias: a[24], DeclareVariable: a[21], Decorator: a[3], Directive: a[18], DirectiveLiteral: a[1], DoExpression: a[10], DoWhileStatement: a[25], EmptyStatement: a[1], EmptyTypeAnnotation: a[1], EnumBigIntBody: a[26], EnumBigIntMember: a[27], EnumBooleanBody: a[26], EnumBooleanMember: a[27], EnumDeclaration: a[19], EnumDefaultedMember: a[21], EnumNumberBody: a[26], EnumNumberMember: a[27], EnumStringBody: a[26], EnumStringMember: a[27], EnumSymbolBody: a[26], ExistsTypeAnnotation: a[1], ExperimentalRestProperty: a[6], ExperimentalSpreadProperty: a[6], ExportAllDeclaration: ["source", "attributes", "exported"], ExportDefaultDeclaration: ["declaration"], ExportDefaultSpecifier: a[28], ExportNamedDeclaration: a[20], ExportNamespaceSpecifier: a[28], ExportSpecifier: ["local", "exported"], ExpressionStatement: a[3], File: ["program"], ForInStatement: a[29], ForOfStatement: a[29], ForStatement: ["init", "test", "update", "body"], FunctionDeclaration: a[30], FunctionExpression: a[30], FunctionTypeAnnotation: ["typeParameters", "this", "params", "rest", "returnType"], FunctionTypeParam: a[15], GenericTypeAnnotation: a[12], HookDeclaration: a[31], HookTypeAnnotation: ["params", "returnType", "rest", "typeParameters"], Identifier: ["typeAnnotation", "decorators"], IfStatement: a[16], ImportAttribute: a[32], ImportDeclaration: ["specifiers", "source", "attributes"], ImportDefaultSpecifier: a[33], ImportExpression: ["source", "options"], ImportNamespaceSpecifier: a[33], ImportSpecifier: ["imported", "local"], IndexedAccessType: a[34], InferredPredicate: a[1], InferTypeAnnotation: a[35], InterfaceDeclaration: a[22], InterfaceExtends: a[12], InterfaceTypeAnnotation: ["extends", "body"], InterpreterDirective: a[1], IntersectionTypeAnnotation: a[36], JsExpressionRoot: a[37], JsonRoot: a[37], JSXAttribute: ["name", "value"], JSXClosingElement: ["name"], JSXClosingFragment: a[1], JSXElement: ["openingElement", "children", "closingElement"], JSXEmptyExpression: a[1], JSXExpressionContainer: a[3], JSXFragment: ["openingFragment", "children", "closingFragment"], JSXIdentifier: a[1], JSXMemberExpression: a[38], JSXNamespacedName: ["namespace", "name"], JSXOpeningElement: ["name", "typeArguments", "attributes"], JSXOpeningFragment: a[1], JSXSpreadAttribute: a[6], JSXSpreadChild: a[3], JSXText: a[1], KeyofTypeAnnotation: a[6], LabeledStatement: ["label", "body"], Literal: a[1], LogicalExpression: a[5], MatchArrayPattern: ["elements", "rest"], MatchAsPattern: ["pattern", "target"], MatchBindingPattern: a[21], MatchExpression: a[39], MatchExpressionCase: a[40], MatchIdentifierPattern: a[21], MatchLiteralPattern: a[41], MatchMemberPattern: ["base", "property"], MatchObjectPattern: ["properties", "rest"], MatchObjectPatternProperty: ["key", "pattern"], MatchOrPattern: ["patterns"], MatchRestPattern: a[6], MatchStatement: a[39], MatchStatementCase: a[40], MatchUnaryPattern: a[6], MatchWildcardPattern: a[1], MemberExpression: a[38], MetaProperty: ["meta", "property"], MethodDefinition: a[42], MixedTypeAnnotation: a[1], ModuleExpression: a[10], NeverTypeAnnotation: a[1], NewExpression: a[9], NGChainedExpression: a[43], NGEmptyExpression: a[1], NGMicrosyntax: a[10], NGMicrosyntaxAs: ["key", "alias"], NGMicrosyntaxExpression: ["expression", "alias"], NGMicrosyntaxKey: a[1], NGMicrosyntaxKeyedExpression: ["key", "expression"], NGMicrosyntaxLet: a[32], NGPipeExpression: ["left", "right", "arguments"], NGRoot: a[37], NullableTypeAnnotation: a[23], NullLiteral: a[1], NullLiteralTypeAnnotation: a[1], NumberLiteralTypeAnnotation: a[1], NumberTypeAnnotation: a[1], NumericLiteral: a[1], ObjectExpression: ["properties"], ObjectMethod: a[13], ObjectPattern: ["decorators", "properties", "typeAnnotation"], ObjectProperty: a[42], ObjectTypeAnnotation: ["properties", "indexers", "callProperties", "internalSlots"], ObjectTypeCallProperty: a[18], ObjectTypeIndexer: ["variance", "id", "key", "value"], ObjectTypeInternalSlot: ["id", "value"], ObjectTypeMappedTypeProperty: ["keyTparam", "propType", "sourceType", "variance"], ObjectTypeProperty: ["key", "value", "variance"], ObjectTypeSpreadProperty: a[6], OpaqueType: ["id", "typeParameters", "supertype", "impltype", "lowerBound", "upperBound"], OptionalCallExpression: a[9], OptionalIndexedAccessType: a[34], OptionalMemberExpression: a[38], ParenthesizedExpression: a[3], PipelineBareFunction: ["callee"], PipelinePrimaryTopicReference: a[1], PipelineTopicExpression: a[3], Placeholder: a[1], PrivateIdentifier: a[1], PrivateName: a[21], Program: a[7], Property: a[32], PropertyDefinition: a[14], QualifiedTypeIdentifier: a[44], QualifiedTypeofIdentifier: a[44], RegExpLiteral: a[1], RestElement: ["argument", "typeAnnotation", "decorators"], ReturnStatement: a[6], SatisfiesExpression: a[4], SequenceExpression: a[43], SpreadElement: a[6], StaticBlock: a[10], StringLiteral: a[1], StringLiteralTypeAnnotation: a[1], StringTypeAnnotation: a[1], Super: a[1], SwitchCase: ["test", "consequent"], SwitchStatement: ["discriminant", "cases"], SymbolTypeAnnotation: a[1], TaggedTemplateExpression: ["tag", "typeArguments", "quasi"], TemplateElement: a[1], TemplateLiteral: ["quasis", "expressions"], ThisExpression: a[1], ThisTypeAnnotation: a[1], ThrowStatement: a[6], TopicReference: a[1], TryStatement: ["block", "handler", "finalizer"], TSAbstractAccessorProperty: a[45], TSAbstractKeyword: a[1], TSAbstractMethodDefinition: a[32], TSAbstractPropertyDefinition: a[45], TSAnyKeyword: a[1], TSArrayType: a[2], TSAsExpression: a[4], TSAsyncKeyword: a[1], TSBigIntKeyword: a[1], TSBooleanKeyword: a[1], TSCallSignatureDeclaration: a[46], TSClassImplements: a[47], TSConditionalType: a[17], TSConstructorType: a[46], TSConstructSignatureDeclaration: a[46], TSDeclareFunction: a[31], TSDeclareKeyword: a[1], TSDeclareMethod: ["decorators", "key", "typeParameters", "params", "returnType"], TSEmptyBodyFunctionExpression: ["id", "typeParameters", "params", "returnType"], TSEnumBody: a[26], TSEnumDeclaration: a[19], TSEnumMember: ["id", "initializer"], TSExportAssignment: a[3], TSExportKeyword: a[1], TSExternalModuleReference: a[3], TSFunctionType: a[46], TSImportEqualsDeclaration: ["id", "moduleReference"], TSImportType: ["options", "qualifier", "typeArguments", "source"], TSIndexedAccessType: a[34], TSIndexSignature: ["parameters", "typeAnnotation"], TSInferType: a[35], TSInstantiationExpression: a[47], TSInterfaceBody: a[10], TSInterfaceDeclaration: a[22], TSInterfaceHeritage: a[47], TSIntersectionType: a[36], TSIntrinsicKeyword: a[1], TSJSDocAllType: a[1], TSJSDocNonNullableType: a[23], TSJSDocNullableType: a[23], TSJSDocUnknownType: a[1], TSLiteralType: a[41], TSMappedType: ["key", "constraint", "nameType", "typeAnnotation"], TSMethodSignature: ["key", "typeParameters", "params", "returnType"], TSModuleBlock: a[10], TSModuleDeclaration: a[19], TSNamedTupleMember: ["label", "elementType"], TSNamespaceExportDeclaration: a[21], TSNeverKeyword: a[1], TSNonNullExpression: a[3], TSNullKeyword: a[1], TSNumberKeyword: a[1], TSObjectKeyword: a[1], TSOptionalType: a[23], TSParameterProperty: ["parameter", "decorators"], TSParenthesizedType: a[23], TSPrivateKeyword: a[1], TSPropertySignature: ["key", "typeAnnotation"], TSProtectedKeyword: a[1], TSPublicKeyword: a[1], TSQualifiedName: a[5], TSReadonlyKeyword: a[1], TSRestType: a[23], TSSatisfiesExpression: a[4], TSStaticKeyword: a[1], TSStringKeyword: a[1], TSSymbolKeyword: a[1], TSTemplateLiteralType: ["quasis", "types"], TSThisType: a[1], TSTupleType: ["elementTypes"], TSTypeAliasDeclaration: ["id", "typeParameters", "typeAnnotation"], TSTypeAnnotation: a[23], TSTypeAssertion: a[4], TSTypeLiteral: a[26], TSTypeOperator: a[23], TSTypeParameter: ["name", "constraint", "default"], TSTypeParameterDeclaration: a[48], TSTypeParameterInstantiation: a[48], TSTypePredicate: a[49], TSTypeQuery: ["exprName", "typeArguments"], TSTypeReference: ["typeName", "typeArguments"], TSUndefinedKeyword: a[1], TSUnionType: a[36], TSUnknownKeyword: a[1], TSVoidKeyword: a[1], TupleTypeAnnotation: ["types", "elementTypes"], TupleTypeLabeledElement: ["label", "elementType", "variance"], TupleTypeSpreadElement: ["label", "typeAnnotation"], TypeAlias: a[24], TypeAnnotation: a[23], TypeCastExpression: a[4], TypeofTypeAnnotation: ["argument", "typeArguments"], TypeOperator: a[23], TypeParameter: ["bound", "default", "variance"], TypeParameterDeclaration: a[48], TypeParameterInstantiation: a[48], TypePredicate: a[49], UnaryExpression: a[6], UndefinedTypeAnnotation: a[1], UnionTypeAnnotation: a[36], UnknownTypeAnnotation: a[1], UpdateExpression: a[6], V8IntrinsicIdentifier: a[1], VariableDeclaration: ["declarations"], VariableDeclarator: a[27], Variance: a[1], VoidPattern: a[1], VoidTypeAnnotation: a[1], WhileStatement: a[25], WithStatement: ["object", "body"], YieldExpression: a[6] };
|
|
210
|
+
var Za = _r(pi);
|
|
211
|
+
var Mr = Za;
|
|
212
|
+
function ep(e) {
|
|
213
|
+
let t = new Set(e);
|
|
214
|
+
return (r) => t.has(r?.type);
|
|
215
|
+
}
|
|
216
|
+
var k = ep;
|
|
217
|
+
function tp(e) {
|
|
218
|
+
return e.extra?.raw ?? e.raw;
|
|
219
|
+
}
|
|
220
|
+
var pe = tp;
|
|
221
|
+
var rp = k(["Block", "CommentBlock", "MultiLine"]);
|
|
222
|
+
var ce = rp;
|
|
223
|
+
var np = k(["AnyTypeAnnotation", "ThisTypeAnnotation", "NumberTypeAnnotation", "VoidTypeAnnotation", "BooleanTypeAnnotation", "BigIntTypeAnnotation", "SymbolTypeAnnotation", "StringTypeAnnotation", "NeverTypeAnnotation", "UndefinedTypeAnnotation", "UnknownTypeAnnotation", "EmptyTypeAnnotation", "MixedTypeAnnotation"]);
|
|
224
|
+
var Nr = np;
|
|
225
|
+
var sp = k(["Line", "CommentLine", "SingleLine", "HashbangComment", "HTMLOpen", "HTMLClose", "Hashbang", "InterpreterDirective"]);
|
|
226
|
+
var At = sp;
|
|
227
|
+
function ip(e, t) {
|
|
228
|
+
let r = t.split(".");
|
|
229
|
+
for (let n = r.length - 1; n >= 0; n--) {
|
|
230
|
+
let s = r[n];
|
|
231
|
+
if (n === 0) return e.type === "Identifier" && e.name === s;
|
|
232
|
+
if (n === 1 && e.type === "MetaProperty" && e.property.type === "Identifier" && e.property.name === s) {
|
|
233
|
+
e = e.meta;
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
if (e.type === "MemberExpression" && !e.optional && !e.computed && e.property.type === "Identifier" && e.property.name === s) {
|
|
237
|
+
e = e.object;
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function op(e, t) {
|
|
244
|
+
return t.some((r) => ip(e, r));
|
|
245
|
+
}
|
|
246
|
+
var Pt = op;
|
|
247
|
+
function up({ type: e }) {
|
|
248
|
+
return e.startsWith("TS") && e.endsWith("Keyword");
|
|
249
|
+
}
|
|
250
|
+
var jr = up;
|
|
251
|
+
function ap({ node: e, parent: t }) {
|
|
252
|
+
return e?.type !== "EmptyStatement" ? false : t.type === "IfStatement" ? t.consequent === e || t.alternate === e : t.type === "DoWhileStatement" || t.type === "ForInStatement" || t.type === "ForOfStatement" || t.type === "ForStatement" || t.type === "LabeledStatement" || t.type === "WithStatement" || t.type === "WhileStatement" ? t.body === e : false;
|
|
253
|
+
}
|
|
254
|
+
var kt = ap;
|
|
255
|
+
function Er(e, t) {
|
|
256
|
+
return t(e) || zs(e, { getVisitorKeys: Mr, predicate: t });
|
|
257
|
+
}
|
|
258
|
+
function Xt(e) {
|
|
259
|
+
return e.type === "AssignmentExpression" || e.type === "BinaryExpression" || e.type === "LogicalExpression" || e.type === "NGPipeExpression" || e.type === "ConditionalExpression" || M(e) || J(e) || e.type === "SequenceExpression" || e.type === "TaggedTemplateExpression" || e.type === "BindExpression" || e.type === "UpdateExpression" && !e.prefix || Ae(e) || e.type === "TSNonNullExpression" || e.type === "ChainExpression";
|
|
260
|
+
}
|
|
261
|
+
function mi(e) {
|
|
262
|
+
return e.expressions ? e.expressions[0] : e.left ?? e.test ?? e.callee ?? e.object ?? e.tag ?? e.argument ?? e.expression;
|
|
263
|
+
}
|
|
264
|
+
function Rr(e) {
|
|
265
|
+
if (e.expressions) return ["expressions", 0];
|
|
266
|
+
if (e.left) return ["left"];
|
|
267
|
+
if (e.test) return ["test"];
|
|
268
|
+
if (e.object) return ["object"];
|
|
269
|
+
if (e.callee) return ["callee"];
|
|
270
|
+
if (e.tag) return ["tag"];
|
|
271
|
+
if (e.argument) return ["argument"];
|
|
272
|
+
if (e.expression) return ["expression"];
|
|
273
|
+
throw new Error("Unexpected node has no left side.");
|
|
274
|
+
}
|
|
275
|
+
var Di = k(["ExportDefaultDeclaration", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "DeclareExportAllDeclaration"]);
|
|
276
|
+
var q = k(["ArrayExpression"]);
|
|
277
|
+
var se = k(["ObjectExpression"]);
|
|
278
|
+
function fi(e) {
|
|
279
|
+
return e.type === "LogicalExpression" && e.operator === "??";
|
|
280
|
+
}
|
|
281
|
+
function Ce(e) {
|
|
282
|
+
return e.type === "NumericLiteral" || e.type === "Literal" && typeof e.value == "number";
|
|
283
|
+
}
|
|
284
|
+
function yi(e) {
|
|
285
|
+
return e.type === "BooleanLiteral" || e.type === "Literal" && typeof e.value == "boolean";
|
|
286
|
+
}
|
|
287
|
+
function Hn(e) {
|
|
288
|
+
return e.type === "UnaryExpression" && (e.operator === "+" || e.operator === "-") && Ce(e.argument);
|
|
289
|
+
}
|
|
290
|
+
function V(e) {
|
|
291
|
+
return !!(e && (e.type === "StringLiteral" || e.type === "Literal" && typeof e.value == "string"));
|
|
292
|
+
}
|
|
293
|
+
function Xn(e) {
|
|
294
|
+
return e.type === "RegExpLiteral" || e.type === "Literal" && !!e.regex;
|
|
295
|
+
}
|
|
296
|
+
var Jr = k(["Literal", "BooleanLiteral", "BigIntLiteral", "DirectiveLiteral", "NullLiteral", "NumericLiteral", "RegExpLiteral", "StringLiteral"]);
|
|
297
|
+
var pp = k(["Identifier", "ThisExpression", "Super", "PrivateName", "PrivateIdentifier"]);
|
|
298
|
+
var Je = k(["ObjectTypeAnnotation", "TSTypeLiteral", "TSMappedType"]);
|
|
299
|
+
var Ht = k(["FunctionExpression", "ArrowFunctionExpression"]);
|
|
300
|
+
function cp(e) {
|
|
301
|
+
return e.type === "FunctionExpression" || e.type === "ArrowFunctionExpression" && e.body.type === "BlockStatement";
|
|
302
|
+
}
|
|
303
|
+
function Wn(e) {
|
|
304
|
+
return M(e) && e.callee.type === "Identifier" && ["async", "inject", "fakeAsync", "waitForAsync"].includes(e.callee.name);
|
|
305
|
+
}
|
|
306
|
+
var H = k(["JSXElement", "JSXFragment"]);
|
|
307
|
+
function mt(e) {
|
|
308
|
+
return e.method && e.kind === "init" || e.kind === "get" || e.kind === "set";
|
|
309
|
+
}
|
|
310
|
+
function Gr(e) {
|
|
311
|
+
return (e.type === "ObjectTypeProperty" || e.type === "ObjectTypeInternalSlot") && !e.static && !e.method && e.kind !== "get" && e.kind !== "set" && e.value.type === "FunctionTypeAnnotation";
|
|
312
|
+
}
|
|
313
|
+
function Ei(e) {
|
|
314
|
+
return (e.type === "TypeAnnotation" || e.type === "TSTypeAnnotation") && e.typeAnnotation.type === "FunctionTypeAnnotation" && !e.static && !bt(e, e.typeAnnotation);
|
|
315
|
+
}
|
|
316
|
+
var Te = k(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]);
|
|
317
|
+
function Tt(e) {
|
|
318
|
+
return J(e) || e.type === "BindExpression" && !!e.object;
|
|
319
|
+
}
|
|
320
|
+
var lp = k(["TSThisType", "NullLiteralTypeAnnotation", "BooleanLiteralTypeAnnotation", "StringLiteralTypeAnnotation", "BigIntLiteralTypeAnnotation", "NumberLiteralTypeAnnotation", "TSLiteralType", "TSTemplateLiteralType"]);
|
|
321
|
+
function Vt(e) {
|
|
322
|
+
return jr(e) || Nr(e) || lp(e) || e.type === "GenericTypeAnnotation" && !e.typeParameters || e.type === "TSTypeReference" && !e.typeArguments;
|
|
323
|
+
}
|
|
324
|
+
function mp(e) {
|
|
325
|
+
return e.type === "Identifier" && (e.name === "beforeEach" || e.name === "beforeAll" || e.name === "afterEach" || e.name === "afterAll");
|
|
326
|
+
}
|
|
327
|
+
var Dp = ["it", "it.only", "it.skip", "describe", "describe.only", "describe.skip", "test", "test.only", "test.skip", "test.fixme", "test.step", "test.describe", "test.describe.only", "test.describe.skip", "test.describe.fixme", "test.describe.parallel", "test.describe.parallel.only", "test.describe.serial", "test.describe.serial.only", "skip", "xit", "xdescribe", "xtest", "fit", "fdescribe", "ftest"];
|
|
328
|
+
function fp(e) {
|
|
329
|
+
return Pt(e, Dp);
|
|
330
|
+
}
|
|
331
|
+
function It(e, t) {
|
|
332
|
+
if (e?.type !== "CallExpression" || e.optional) return false;
|
|
333
|
+
let r = le(e);
|
|
334
|
+
if (r.length === 1) {
|
|
335
|
+
if (Wn(e) && It(t)) return Ht(r[0]);
|
|
336
|
+
if (mp(e.callee)) return Wn(r[0]);
|
|
337
|
+
} else if ((r.length === 2 || r.length === 3) && (r[0].type === "TemplateLiteral" || V(r[0])) && fp(e.callee)) return r[2] && !Ce(r[2]) ? false : (r.length === 2 ? Ht(r[1]) : cp(r[1]) && K(r[1]).length <= 1) || Wn(r[1]);
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
var Fi = (e) => (t) => (t?.type === "ChainExpression" && (t = t.expression), e(t));
|
|
341
|
+
var M = Fi(k(["CallExpression", "OptionalCallExpression"]));
|
|
342
|
+
var J = Fi(k(["MemberExpression", "OptionalMemberExpression"]));
|
|
343
|
+
function Vn(e, t = 5) {
|
|
344
|
+
return di(e, t) <= t;
|
|
345
|
+
}
|
|
346
|
+
function di(e, t) {
|
|
347
|
+
let r = 0;
|
|
348
|
+
for (let n in e) {
|
|
349
|
+
let s = e[n];
|
|
350
|
+
if (Lr(s) && typeof s.type == "string" && (r++, r += di(s, t - r)), r > t) return r;
|
|
351
|
+
}
|
|
352
|
+
return r;
|
|
353
|
+
}
|
|
354
|
+
var yp = 0.25;
|
|
355
|
+
function Fr(e, t) {
|
|
356
|
+
let { printWidth: r } = t;
|
|
357
|
+
if (T(e)) return false;
|
|
358
|
+
let n = r * yp;
|
|
359
|
+
if (e.type === "ThisExpression" || e.type === "Identifier" && e.name.length <= n || Hn(e) && !T(e.argument)) return true;
|
|
360
|
+
let s = e.type === "Literal" && "regex" in e && e.regex.pattern || e.type === "RegExpLiteral" && e.pattern;
|
|
361
|
+
return s ? s.length <= n : V(e) ? ut(pe(e), t).length <= n : e.type === "TemplateLiteral" ? e.expressions.length === 0 && e.quasis[0].value.raw.length <= n && !e.quasis[0].value.raw.includes(`
|
|
362
|
+
`) : e.type === "UnaryExpression" ? Fr(e.argument, { printWidth: r }) : e.type === "CallExpression" && e.arguments.length === 0 && e.callee.type === "Identifier" ? e.callee.name.length <= n - 2 : Jr(e);
|
|
363
|
+
}
|
|
364
|
+
function Ee(e, t) {
|
|
365
|
+
return H(t) ? Ot(t) : T(t, x.Leading, (r) => Z(e, I(r)));
|
|
366
|
+
}
|
|
367
|
+
function ci(e) {
|
|
368
|
+
return e.quasis.some((t) => t.value.raw.includes(`
|
|
369
|
+
`));
|
|
370
|
+
}
|
|
371
|
+
function Wr(e, t) {
|
|
372
|
+
return (e.type === "TemplateLiteral" && ci(e) || e.type === "TaggedTemplateExpression" && ci(e.quasi)) && !Z(t, w(e), { backwards: true });
|
|
373
|
+
}
|
|
374
|
+
function qr(e) {
|
|
375
|
+
if (!T(e)) return false;
|
|
376
|
+
let t = N(0, et(e, x.Dangling), -1);
|
|
377
|
+
return t && !ce(t);
|
|
378
|
+
}
|
|
379
|
+
function Ci(e) {
|
|
380
|
+
if (e.length <= 1) return false;
|
|
381
|
+
let t = 0;
|
|
382
|
+
for (let r of e) if (Ht(r)) {
|
|
383
|
+
if (t += 1, t > 1) return true;
|
|
384
|
+
} else if (M(r)) {
|
|
385
|
+
for (let n of le(r)) if (Ht(n)) return true;
|
|
386
|
+
}
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
function Ur(e) {
|
|
390
|
+
let { node: t, parent: r, key: n } = e;
|
|
391
|
+
return n === "callee" && M(t) && M(r) && r.arguments.length > 0 && t.arguments.length > r.arguments.length;
|
|
392
|
+
}
|
|
393
|
+
var Ep = /* @__PURE__ */ new Set(["!", "-", "+", "~"]);
|
|
394
|
+
function Re(e, t = 2) {
|
|
395
|
+
if (t <= 0) return false;
|
|
396
|
+
if (e.type === "ChainExpression" || e.type === "TSNonNullExpression") return Re(e.expression, t);
|
|
397
|
+
let r = (n) => Re(n, t - 1);
|
|
398
|
+
if (Xn(e)) return ot(e.pattern ?? e.regex.pattern) <= 5;
|
|
399
|
+
if (Jr(e) || pp(e) || e.type === "ArgumentPlaceholder") return true;
|
|
400
|
+
if (e.type === "TemplateLiteral") return e.quasis.every((n) => !n.value.raw.includes(`
|
|
401
|
+
`)) && e.expressions.every(r);
|
|
402
|
+
if (se(e)) return e.properties.every((n) => !n.computed && (n.shorthand || n.value && r(n.value)));
|
|
403
|
+
if (q(e)) return e.elements.every((n) => n === null || r(n));
|
|
404
|
+
if (Dt(e)) {
|
|
405
|
+
if (e.type === "ImportExpression" || Re(e.callee, t)) {
|
|
406
|
+
let n = le(e);
|
|
407
|
+
return n.length <= t && n.every(r);
|
|
408
|
+
}
|
|
409
|
+
return false;
|
|
410
|
+
}
|
|
411
|
+
return J(e) ? Re(e.object, t) && Re(e.property, t) : e.type === "UnaryExpression" && Ep.has(e.operator) || e.type === "UpdateExpression" ? Re(e.argument, t) : false;
|
|
412
|
+
}
|
|
413
|
+
function ie(e, t = "es5") {
|
|
414
|
+
return e.trailingComma === "es5" && t === "es5" || e.trailingComma === "all" && (t === "all" || t === "es5");
|
|
415
|
+
}
|
|
416
|
+
function ye(e, t) {
|
|
417
|
+
switch (e.type) {
|
|
418
|
+
case "BinaryExpression":
|
|
419
|
+
case "LogicalExpression":
|
|
420
|
+
case "AssignmentExpression":
|
|
421
|
+
case "NGPipeExpression":
|
|
422
|
+
return ye(e.left, t);
|
|
423
|
+
case "MemberExpression":
|
|
424
|
+
case "OptionalMemberExpression":
|
|
425
|
+
return ye(e.object, t);
|
|
426
|
+
case "TaggedTemplateExpression":
|
|
427
|
+
return e.tag.type === "FunctionExpression" ? false : ye(e.tag, t);
|
|
428
|
+
case "CallExpression":
|
|
429
|
+
case "OptionalCallExpression":
|
|
430
|
+
return e.callee.type === "FunctionExpression" ? false : ye(e.callee, t);
|
|
431
|
+
case "ConditionalExpression":
|
|
432
|
+
return ye(e.test, t);
|
|
433
|
+
case "UpdateExpression":
|
|
434
|
+
return !e.prefix && ye(e.argument, t);
|
|
435
|
+
case "BindExpression":
|
|
436
|
+
return e.object && ye(e.object, t);
|
|
437
|
+
case "SequenceExpression":
|
|
438
|
+
return ye(e.expressions[0], t);
|
|
439
|
+
case "ChainExpression":
|
|
440
|
+
case "TSSatisfiesExpression":
|
|
441
|
+
case "TSAsExpression":
|
|
442
|
+
case "TSNonNullExpression":
|
|
443
|
+
case "AsExpression":
|
|
444
|
+
case "AsConstExpression":
|
|
445
|
+
case "SatisfiesExpression":
|
|
446
|
+
return ye(e.expression, t);
|
|
447
|
+
default:
|
|
448
|
+
return t(e);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
var li = { "==": true, "!=": true, "===": true, "!==": true };
|
|
452
|
+
var vr = { "*": true, "/": true, "%": true };
|
|
453
|
+
var Yn = { ">>": true, ">>>": true, "<<": true };
|
|
454
|
+
function dr(e, t) {
|
|
455
|
+
return !(yr(t) !== yr(e) || e === "**" || li[e] && li[t] || t === "%" && vr[e] || e === "%" && vr[t] || t !== e && vr[t] && vr[e] || Yn[e] && Yn[t]);
|
|
456
|
+
}
|
|
457
|
+
var Fp = new Map([["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].flatMap((e, t) => e.map((r) => [r, t])));
|
|
458
|
+
function yr(e) {
|
|
459
|
+
return Fp.get(e);
|
|
460
|
+
}
|
|
461
|
+
function Ai(e) {
|
|
462
|
+
return !!Yn[e] || e === "|" || e === "^" || e === "&";
|
|
463
|
+
}
|
|
464
|
+
function Ti(e) {
|
|
465
|
+
if (e.rest) return true;
|
|
466
|
+
let t = K(e);
|
|
467
|
+
return N(0, t, -1)?.type === "RestElement";
|
|
468
|
+
}
|
|
469
|
+
var qn = /* @__PURE__ */ new WeakMap();
|
|
470
|
+
function K(e) {
|
|
471
|
+
if (qn.has(e)) return qn.get(e);
|
|
472
|
+
let t = [];
|
|
473
|
+
return e.this && t.push(e.this), t.push(...e.params), e.rest && t.push(e.rest), qn.set(e, t), t;
|
|
474
|
+
}
|
|
475
|
+
function xi(e, t) {
|
|
476
|
+
let { node: r } = e, n = 0, s = () => t(e, n++);
|
|
477
|
+
r.this && e.call(s, "this"), e.each(s, "params"), r.rest && e.call(s, "rest");
|
|
478
|
+
}
|
|
479
|
+
var Un = /* @__PURE__ */ new WeakMap();
|
|
480
|
+
function le(e) {
|
|
481
|
+
if (Un.has(e)) return Un.get(e);
|
|
482
|
+
if (e.type === "ChainExpression") return le(e.expression);
|
|
483
|
+
let t;
|
|
484
|
+
return e.type === "ImportExpression" || e.type === "TSImportType" ? (t = [e.source], e.options && t.push(e.options)) : e.type === "TSExternalModuleReference" ? t = [e.expression] : t = e.arguments, Un.set(e, t), t;
|
|
485
|
+
}
|
|
486
|
+
function $t(e, t) {
|
|
487
|
+
let { node: r } = e;
|
|
488
|
+
if (r.type === "ChainExpression") return e.call(() => $t(e, t), "expression");
|
|
489
|
+
r.type === "ImportExpression" || r.type === "TSImportType" ? (e.call(() => t(e, 0), "source"), r.options && e.call(() => t(e, 1), "options")) : r.type === "TSExternalModuleReference" ? e.call(() => t(e, 0), "expression") : e.each(t, "arguments");
|
|
490
|
+
}
|
|
491
|
+
function $n(e, t) {
|
|
492
|
+
let r = [];
|
|
493
|
+
if (e.type === "ChainExpression" && (e = e.expression, r.push("expression")), e.type === "ImportExpression" || e.type === "TSImportType") {
|
|
494
|
+
if (t === 0 || t === (e.options ? -2 : -1)) return [...r, "source"];
|
|
495
|
+
if (e.options && (t === 1 || t === -1)) return [...r, "options"];
|
|
496
|
+
throw new RangeError("Invalid argument index");
|
|
497
|
+
} else if (e.type === "TSExternalModuleReference") {
|
|
498
|
+
if (t === 0 || t === -1) return [...r, "expression"];
|
|
499
|
+
} else if (t < 0 && (t = e.arguments.length + t), t >= 0 && t < e.arguments.length) return [...r, "arguments", t];
|
|
500
|
+
throw new RangeError("Invalid argument index");
|
|
501
|
+
}
|
|
502
|
+
function Lt(e) {
|
|
503
|
+
return e.value.trim() === "prettier-ignore" && !e.unignore;
|
|
504
|
+
}
|
|
505
|
+
function Ot(e) {
|
|
506
|
+
return e?.prettierIgnore || T(e, x.PrettierIgnore);
|
|
507
|
+
}
|
|
508
|
+
var x = { Leading: 2, Trailing: 4, Dangling: 8, Block: 16, Line: 32, PrettierIgnore: 64, First: 128, Last: 256 };
|
|
509
|
+
var gi = (e, t) => {
|
|
510
|
+
if (typeof e == "function" && (t = e, e = 0), e || t) return (r, n, s) => !(e & x.Leading && !r.leading || e & x.Trailing && !r.trailing || e & x.Dangling && (r.leading || r.trailing) || e & x.Block && !ce(r) || e & x.Line && !At(r) || e & x.First && n !== 0 || e & x.Last && n !== s.length - 1 || e & x.PrettierIgnore && !Lt(r) || t && !t(r));
|
|
511
|
+
};
|
|
512
|
+
function T(e, t, r) {
|
|
513
|
+
if (!R(e?.comments)) return false;
|
|
514
|
+
let n = gi(t, r);
|
|
515
|
+
return n ? e.comments.some(n) : true;
|
|
516
|
+
}
|
|
517
|
+
function et(e, t, r) {
|
|
518
|
+
if (!Array.isArray(e?.comments)) return [];
|
|
519
|
+
let n = gi(t, r);
|
|
520
|
+
return n ? e.comments.filter(n) : e.comments;
|
|
521
|
+
}
|
|
522
|
+
var oe = (e, { originalText: t }) => Yt(t, I(e));
|
|
523
|
+
function Dt(e) {
|
|
524
|
+
return M(e) || e.type === "NewExpression" || e.type === "ImportExpression";
|
|
525
|
+
}
|
|
526
|
+
function Oe(e) {
|
|
527
|
+
return e && (e.type === "ObjectProperty" || e.type === "Property" && !mt(e));
|
|
528
|
+
}
|
|
529
|
+
var Ae = k(["TSAsExpression", "TSSatisfiesExpression", "AsExpression", "AsConstExpression", "SatisfiesExpression"]);
|
|
530
|
+
var Se = k(["TSUnionType", "UnionTypeAnnotation"]);
|
|
531
|
+
var xt = k(["TSIntersectionType", "IntersectionTypeAnnotation"]);
|
|
532
|
+
var Ue = k(["TSConditionalType", "ConditionalTypeAnnotation"]);
|
|
533
|
+
var hi = (e) => e?.type === "TSAsExpression" && e.typeAnnotation.type === "TSTypeReference" && e.typeAnnotation.typeName.type === "Identifier" && e.typeAnnotation.typeName.name === "const";
|
|
534
|
+
var Cr = k(["TSTypeAliasDeclaration", "TypeAlias"]);
|
|
535
|
+
function Yr({ key: e, parent: t }) {
|
|
536
|
+
return !(e === "types" && Se(t) || e === "types" && xt(t));
|
|
537
|
+
}
|
|
538
|
+
var dp = /* @__PURE__ */ new Set(["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "loc", "flags", "errors", "tokens"]);
|
|
539
|
+
var Kt = (e) => {
|
|
540
|
+
for (let t of e.quasis) delete t.value;
|
|
541
|
+
};
|
|
542
|
+
function Si(e, t, r) {
|
|
543
|
+
if (e.type === "Program" && delete t.sourceType, (e.type === "BigIntLiteral" || e.type === "Literal") && e.bigint && (t.bigint = e.bigint.toLowerCase()), e.type === "EmptyStatement" && !kt({ node: e, parent: r }) || e.type === "JSXText" || e.type === "JSXExpressionContainer" && (e.expression.type === "Literal" || e.expression.type === "StringLiteral") && e.expression.value === " ") return null;
|
|
544
|
+
if ((e.type === "Property" || e.type === "ObjectProperty" || e.type === "MethodDefinition" || e.type === "ClassProperty" || e.type === "ClassMethod" || e.type === "PropertyDefinition" || e.type === "TSDeclareMethod" || e.type === "TSPropertySignature" || e.type === "ObjectTypeProperty" || e.type === "ImportAttribute") && e.key && !e.computed) {
|
|
545
|
+
let { key: s } = e;
|
|
546
|
+
V(s) || Ce(s) ? t.key = String(s.value) : s.type === "Identifier" && (t.key = s.name);
|
|
547
|
+
}
|
|
548
|
+
if (e.type === "JSXElement" && e.openingElement.name.name === "style" && e.openingElement.attributes.some((s) => s.type === "JSXAttribute" && s.name.name === "jsx")) for (let { type: s, expression: i } of t.children) s === "JSXExpressionContainer" && i.type === "TemplateLiteral" && Kt(i);
|
|
549
|
+
e.type === "JSXAttribute" && e.name.name === "css" && e.value.type === "JSXExpressionContainer" && e.value.expression.type === "TemplateLiteral" && Kt(t.value.expression), e.type === "JSXAttribute" && e.value?.type === "Literal" && /["']|"|'/u.test(e.value.value) && (t.value.value = W(0, e.value.value, /["']|"|'/gu, '"'));
|
|
550
|
+
let n = e.expression || e.callee;
|
|
551
|
+
if (e.type === "Decorator" && n.type === "CallExpression" && n.callee.name === "Component" && n.arguments.length === 1) {
|
|
552
|
+
let s = e.expression.arguments[0].properties;
|
|
553
|
+
for (let [i, o] of t.expression.arguments[0].properties.entries()) switch (s[i].key.name) {
|
|
554
|
+
case "styles":
|
|
555
|
+
q(o.value) && Kt(o.value.elements[0]);
|
|
556
|
+
break;
|
|
557
|
+
case "template":
|
|
558
|
+
o.value.type === "TemplateLiteral" && Kt(o.value);
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
e.type === "TaggedTemplateExpression" && (e.tag.type === "MemberExpression" || e.tag.type === "Identifier" && (e.tag.name === "gql" || e.tag.name === "graphql" || e.tag.name === "css" || e.tag.name === "md" || e.tag.name === "markdown" || e.tag.name === "html") || e.tag.type === "CallExpression") && Kt(t.quasi), e.type === "TemplateLiteral" && Kt(t), e.type === "ChainExpression" && e.expression.type === "TSNonNullExpression" && (t.type = "TSNonNullExpression", t.expression.type = "ChainExpression");
|
|
563
|
+
}
|
|
564
|
+
Si.ignoredProperties = dp;
|
|
565
|
+
var Bi = Si;
|
|
566
|
+
var Cp = k(["File", "TemplateElement", "TSEmptyBodyFunctionExpression", "ChainExpression"]);
|
|
567
|
+
var Ap = (e, [t]) => t?.type === "ComponentParameter" && t.shorthand && t.name === e && t.local !== t.name || t?.type === "MatchObjectPatternProperty" && t.shorthand && t.key === e && t.value !== t.key || t?.type === "ObjectProperty" && t.shorthand && t.key === e && t.value !== t.key || t?.type === "Property" && t.shorthand && t.key === e && !mt(t) && t.value !== t.key;
|
|
568
|
+
var Tp = (e, [t]) => !!(e.type === "FunctionExpression" && t.type === "MethodDefinition" && t.value === e && K(e).length === 0 && !e.returnType && !R(e.typeParameters) && e.body);
|
|
569
|
+
var bi = (e, [t]) => t?.typeAnnotation === e && hi(t);
|
|
570
|
+
var xp = (e, [t, ...r]) => bi(e, [t]) || t?.typeName === e && bi(t, r);
|
|
571
|
+
function gp(e, t) {
|
|
572
|
+
return Cp(e) || Ap(e, t) || Tp(e, t) ? false : e.type === "EmptyStatement" ? kt({ node: e, parent: t[0] }) : !(xp(e, t) || e.type === "TSTypeAnnotation" && t[0].type === "TSPropertySignature");
|
|
573
|
+
}
|
|
574
|
+
var Pi = gp;
|
|
575
|
+
function hp(e) {
|
|
576
|
+
let t = e.type || e.kind || "(unknown type)", r = String(e.name || e.id && (typeof e.id == "object" ? e.id.name : e.id) || e.key && (typeof e.key == "object" ? e.key.name : e.key) || e.value && (typeof e.value == "object" ? "" : String(e.value)) || e.operator || "");
|
|
577
|
+
return r.length > 20 && (r = r.slice(0, 19) + "\u2026"), t + (r ? " " + r : "");
|
|
578
|
+
}
|
|
579
|
+
function Kn(e, t) {
|
|
580
|
+
(e.comments ?? (e.comments = [])).push(t), t.printed = false, t.nodeDescription = hp(e);
|
|
581
|
+
}
|
|
582
|
+
function te(e, t) {
|
|
583
|
+
t.leading = true, t.trailing = false, Kn(e, t);
|
|
584
|
+
}
|
|
585
|
+
function we(e, t, r) {
|
|
586
|
+
t.leading = false, t.trailing = false, r && (t.marker = r), Kn(e, t);
|
|
587
|
+
}
|
|
588
|
+
function $(e, t) {
|
|
589
|
+
t.leading = false, t.trailing = true, Kn(e, t);
|
|
590
|
+
}
|
|
591
|
+
function Sp(e, t) {
|
|
592
|
+
let r = null, n = t;
|
|
593
|
+
for (; n !== r; ) r = n, n = ze(e, n), n = qt(e, n), n = Ut(e, n), n = Ze(e, n);
|
|
594
|
+
return n;
|
|
595
|
+
}
|
|
596
|
+
var at = Sp;
|
|
597
|
+
function Bp(e, t) {
|
|
598
|
+
let r = at(e, t);
|
|
599
|
+
return r === false ? "" : e.charAt(r);
|
|
600
|
+
}
|
|
601
|
+
var _e = Bp;
|
|
602
|
+
function bp(e, t, r) {
|
|
603
|
+
for (let n = t; n < r; ++n) if (e.charAt(n) === `
|
|
604
|
+
`) return true;
|
|
605
|
+
return false;
|
|
606
|
+
}
|
|
607
|
+
var ue = bp;
|
|
608
|
+
var Qn = /* @__PURE__ */ new WeakMap();
|
|
609
|
+
function Pp(e) {
|
|
610
|
+
return Qn.has(e) || Qn.set(e, ce(e) && e.value[0] === "*" && /@(?:type|satisfies)\b/u.test(e.value)), Qn.get(e);
|
|
611
|
+
}
|
|
612
|
+
var Hr = Pp;
|
|
613
|
+
var Zn = (e, t) => At(e) || !ue(t, w(e), I(e));
|
|
614
|
+
function kp(e) {
|
|
615
|
+
return [ji, Ii, _i, Jp, wp, es, ts, ki, Li, Yp, Wp, qp, ns, Ni, Hp, Oi, Mi, rs, _p, Zp, vi, ss].some((t) => t(e));
|
|
616
|
+
}
|
|
617
|
+
function Ip(e) {
|
|
618
|
+
return [Op, _i, Ii, Ni, es, ts, ki, Li, Mi, Gp, Up, ns, $p, rs, Qp, zp, ec, vi, rc, tc, ss].some((t) => t(e));
|
|
619
|
+
}
|
|
620
|
+
function Lp(e) {
|
|
621
|
+
return [ji, es, ts, Rp, Oi, ns, vp, jp, rs, Kp, ss].some((t) => t(e));
|
|
622
|
+
}
|
|
623
|
+
function wt(e, t) {
|
|
624
|
+
let r = (e.body || e.properties).find(({ type: n }) => n !== "EmptyStatement");
|
|
625
|
+
r ? te(r, t) : we(e, t);
|
|
626
|
+
}
|
|
627
|
+
function zn(e, t) {
|
|
628
|
+
e.type === "BlockStatement" ? wt(e, t) : te(e, t);
|
|
629
|
+
}
|
|
630
|
+
function Op({ comment: e, followingNode: t }) {
|
|
631
|
+
return t && Hr(e) ? (te(t, e), true) : false;
|
|
632
|
+
}
|
|
633
|
+
function es({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n, text: s }) {
|
|
634
|
+
if (r?.type !== "IfStatement" || !n) return false;
|
|
635
|
+
if (_e(s, I(e)) === ")") return $(t, e), true;
|
|
636
|
+
if (n.type === "BlockStatement" && n === r.consequent && w(e) >= I(t) && I(e) <= w(n)) return te(n, e), true;
|
|
637
|
+
if (t === r.consequent && n === r.alternate) {
|
|
638
|
+
let o = at(s, I(r.consequent));
|
|
639
|
+
if (n.type === "BlockStatement" && w(e) >= o && I(e) <= w(n)) return te(n, e), true;
|
|
640
|
+
if (w(e) < o || r.alternate.type === "BlockStatement") return t.type === "BlockStatement" ? ($(t, e), true) : Zn(e, s) && !ue(s, w(t), w(e)) ? ($(t, e), true) : (we(r, e), true);
|
|
641
|
+
}
|
|
642
|
+
return n.type === "BlockStatement" ? (wt(n, e), true) : n.type === "IfStatement" ? (zn(n.consequent, e), true) : r.consequent === n ? (te(n, e), true) : false;
|
|
643
|
+
}
|
|
644
|
+
function ts({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n, text: s }) {
|
|
645
|
+
return r?.type !== "WhileStatement" || !n ? false : _e(s, I(e)) === ")" ? ($(t, e), true) : n.type === "BlockStatement" ? (wt(n, e), true) : r.body === n ? (te(n, e), true) : false;
|
|
646
|
+
}
|
|
647
|
+
function ki({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n }) {
|
|
648
|
+
return r?.type !== "TryStatement" && r?.type !== "CatchClause" || !n ? false : r.type === "CatchClause" && t ? ($(t, e), true) : n.type === "BlockStatement" ? (wt(n, e), true) : n.type === "TryStatement" ? (zn(n.finalizer, e), true) : n.type === "CatchClause" ? (zn(n.body, e), true) : false;
|
|
649
|
+
}
|
|
650
|
+
function wp({ comment: e, enclosingNode: t, followingNode: r }) {
|
|
651
|
+
return J(t) && r?.type === "Identifier" ? (te(t, e), true) : false;
|
|
652
|
+
}
|
|
653
|
+
function _p({ comment: e, enclosingNode: t, followingNode: r, options: n }) {
|
|
654
|
+
return !n.experimentalTernaries || !(t?.type === "ConditionalExpression" || Ue(t)) ? false : r?.type === "ConditionalExpression" || Ue(r) ? (we(t, e), true) : false;
|
|
655
|
+
}
|
|
656
|
+
function Ii({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n, text: s, options: i }) {
|
|
657
|
+
let o = t && !ue(s, I(t), w(e));
|
|
658
|
+
return (!t || !o) && (r?.type === "ConditionalExpression" || Ue(r)) && n ? i.experimentalTernaries && r.alternate === n && !(ce(e) && !ue(i.originalText, w(e), I(e))) ? (we(r, e), true) : (te(n, e), true) : false;
|
|
659
|
+
}
|
|
660
|
+
var Mp = k(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]);
|
|
661
|
+
function Li({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n }) {
|
|
662
|
+
if (Mp(r)) {
|
|
663
|
+
if (R(r.decorators) && n?.type !== "Decorator") return $(N(0, r.decorators, -1), e), true;
|
|
664
|
+
if (r.body && n === r.body) return wt(r.body, e), true;
|
|
665
|
+
if (n) {
|
|
666
|
+
if (r.superClass && n === r.superClass && t && (t === r.id || t === r.typeParameters)) return $(t, e), true;
|
|
667
|
+
for (let s of ["implements", "extends", "mixins"]) if (r[s] && n === r[s][0]) return t && (t === r.id || t === r.typeParameters || t === r.superClass) ? $(t, e) : we(r, e, s), true;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return false;
|
|
671
|
+
}
|
|
672
|
+
var Np = k(["ClassMethod", "ClassProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod", "MethodDefinition", "ClassAccessorProperty", "AccessorProperty", "TSAbstractAccessorProperty", "TSParameterProperty"]);
|
|
673
|
+
function Oi({ comment: e, precedingNode: t, enclosingNode: r, text: n }) {
|
|
674
|
+
return r && t && _e(n, I(e)) === "(" && (r.type === "Property" || r.type === "TSDeclareMethod" || r.type === "TSAbstractMethodDefinition") && t.type === "Identifier" && r.key === t && _e(n, I(t)) !== ":" ? ($(t, e), true) : t?.type === "Decorator" && Np(r) && (At(e) || e.placement === "ownLine") ? ($(t, e), true) : false;
|
|
675
|
+
}
|
|
676
|
+
var wi = k(["FunctionDeclaration", "FunctionExpression", "ClassMethod", "MethodDefinition", "ObjectMethod"]);
|
|
677
|
+
function jp({ comment: e, precedingNode: t, enclosingNode: r, text: n }) {
|
|
678
|
+
return _e(n, I(e)) !== "(" ? false : t && wi(r) ? ($(t, e), true) : false;
|
|
679
|
+
}
|
|
680
|
+
function vp({ comment: e, enclosingNode: t, text: r }) {
|
|
681
|
+
if (t?.type !== "ArrowFunctionExpression") return false;
|
|
682
|
+
let n = at(r, I(e));
|
|
683
|
+
return n !== false && r.slice(n, n + 2) === "=>" ? (we(t, e), true) : false;
|
|
684
|
+
}
|
|
685
|
+
function Rp({ comment: e, enclosingNode: t, text: r }) {
|
|
686
|
+
return _e(r, I(e)) !== ")" ? false : t && (Ri(t) && K(t).length === 0 || Dt(t) && le(t).length === 0) ? (we(t, e), true) : (t?.type === "MethodDefinition" || t?.type === "TSAbstractMethodDefinition") && K(t.value).length === 0 ? (we(t.value, e), true) : false;
|
|
687
|
+
}
|
|
688
|
+
function Jp({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n, text: s }) {
|
|
689
|
+
return t?.type === "ComponentTypeParameter" && (r?.type === "DeclareComponent" || r?.type === "ComponentTypeAnnotation") && n?.type !== "ComponentTypeParameter" ? ($(t, e), true) : (t?.type === "ComponentParameter" || t?.type === "RestElement") && r?.type === "ComponentDeclaration" && _e(s, I(e)) === ")" ? ($(t, e), true) : false;
|
|
690
|
+
}
|
|
691
|
+
function _i({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n, text: s }) {
|
|
692
|
+
return t?.type === "FunctionTypeParam" && r?.type === "FunctionTypeAnnotation" && n?.type !== "FunctionTypeParam" ? ($(t, e), true) : (t?.type === "Identifier" || t?.type === "AssignmentPattern" || t?.type === "ObjectPattern" || t?.type === "ArrayPattern" || t?.type === "RestElement" || t?.type === "TSParameterProperty") && Ri(r) && _e(s, I(e)) === ")" ? ($(t, e), true) : !ce(e) && n?.type === "BlockStatement" && wi(r) && (r.type === "MethodDefinition" ? r.value.body : r.body) === n && at(s, I(e)) === w(n) ? (wt(n, e), true) : false;
|
|
693
|
+
}
|
|
694
|
+
function Mi({ comment: e, enclosingNode: t }) {
|
|
695
|
+
return t?.type === "LabeledStatement" ? (te(t, e), true) : false;
|
|
696
|
+
}
|
|
697
|
+
function rs({ comment: e, enclosingNode: t }) {
|
|
698
|
+
return (t?.type === "ContinueStatement" || t?.type === "BreakStatement") && !t.label ? ($(t, e), true) : false;
|
|
699
|
+
}
|
|
700
|
+
function Gp({ comment: e, precedingNode: t, enclosingNode: r }) {
|
|
701
|
+
return M(r) && t && r.callee === t && r.arguments.length > 0 ? (te(r.arguments[0], e), true) : false;
|
|
702
|
+
}
|
|
703
|
+
function Wp({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n }) {
|
|
704
|
+
return Se(r) ? (Lt(e) && (n.prettierIgnore = true, e.unignore = true), t ? ($(t, e), true) : false) : (Se(n) && Lt(e) && (n.types[0].prettierIgnore = true, e.unignore = true), false);
|
|
705
|
+
}
|
|
706
|
+
function qp({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n }) {
|
|
707
|
+
return r && r.type === "MatchOrPattern" ? (Lt(e) && (n.prettierIgnore = true, e.unignore = true), t ? ($(t, e), true) : false) : (n && n.type === "MatchOrPattern" && Lt(e) && (n.types[0].prettierIgnore = true, e.unignore = true), false);
|
|
708
|
+
}
|
|
709
|
+
function Up({ comment: e, enclosingNode: t }) {
|
|
710
|
+
return Oe(t) ? (te(t, e), true) : false;
|
|
711
|
+
}
|
|
712
|
+
function ns({ comment: e, enclosingNode: t, ast: r, isLastComment: n }) {
|
|
713
|
+
return r?.body?.length === 0 ? (n ? we(r, e) : te(r, e), true) : t?.type === "Program" && t.body.length === 0 && !R(t.directives) ? (n ? we(t, e) : te(t, e), true) : false;
|
|
714
|
+
}
|
|
715
|
+
function Yp({ comment: e, enclosingNode: t, followingNode: r }) {
|
|
716
|
+
return (t?.type === "ForInStatement" || t?.type === "ForOfStatement") && r !== t.body ? (te(t, e), true) : false;
|
|
717
|
+
}
|
|
718
|
+
function Ni({ comment: e, precedingNode: t, enclosingNode: r, text: n }) {
|
|
719
|
+
if (r?.type === "ImportSpecifier" || r?.type === "ExportSpecifier") return te(r, e), true;
|
|
720
|
+
let s = t?.type === "ImportSpecifier" && r?.type === "ImportDeclaration", i = t?.type === "ExportSpecifier" && r?.type === "ExportNamedDeclaration";
|
|
721
|
+
return (s || i) && Z(n, I(e)) ? ($(t, e), true) : false;
|
|
722
|
+
}
|
|
723
|
+
function Hp({ comment: e, enclosingNode: t }) {
|
|
724
|
+
return t?.type === "AssignmentPattern" ? (te(t, e), true) : false;
|
|
725
|
+
}
|
|
726
|
+
var Xp = k(["VariableDeclarator", "AssignmentExpression", "TypeAlias", "TSTypeAliasDeclaration"]);
|
|
727
|
+
var Vp = k(["ObjectExpression", "ArrayExpression", "TemplateLiteral", "TaggedTemplateExpression", "ObjectTypeAnnotation", "TSTypeLiteral"]);
|
|
728
|
+
function $p({ comment: e, enclosingNode: t, followingNode: r }) {
|
|
729
|
+
return Xp(t) && r && (Vp(r) || ce(e)) ? (te(r, e), true) : false;
|
|
730
|
+
}
|
|
731
|
+
function Kp({ comment: e, enclosingNode: t, precedingNode: r, followingNode: n, text: s }) {
|
|
732
|
+
return !n && (t?.type === "TSMethodSignature" || t?.type === "TSDeclareFunction" || t?.type === "TSAbstractMethodDefinition") && (!r || r !== t.returnType) && _e(s, I(e)) === ";" ? ($(t, e), true) : false;
|
|
733
|
+
}
|
|
734
|
+
function ji({ comment: e, enclosingNode: t, followingNode: r }) {
|
|
735
|
+
if (Lt(e) && t?.type === "TSMappedType" && r === t.key) return t.prettierIgnore = true, e.unignore = true, true;
|
|
736
|
+
}
|
|
737
|
+
function vi({ comment: e, precedingNode: t, enclosingNode: r }) {
|
|
738
|
+
if (r?.type === "TSMappedType" && !t) return we(r, e), true;
|
|
739
|
+
}
|
|
740
|
+
function Qp({ comment: e, enclosingNode: t, followingNode: r }) {
|
|
741
|
+
return !t || t.type !== "SwitchCase" || t.test || !r || r !== t.consequent[0] ? false : (r.type === "BlockStatement" && At(e) ? wt(r, e) : we(t, e), true);
|
|
742
|
+
}
|
|
743
|
+
function zp({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n }) {
|
|
744
|
+
return Se(t) && ((r.type === "TSArrayType" || r.type === "ArrayTypeAnnotation") && !n || xt(r)) ? ($(N(0, t.types, -1), e), true) : false;
|
|
745
|
+
}
|
|
746
|
+
function Zp({ comment: e, enclosingNode: t, precedingNode: r, followingNode: n }) {
|
|
747
|
+
if ((t?.type === "ObjectPattern" || t?.type === "ArrayPattern") && n?.type === "TSTypeAnnotation") return r ? $(r, e) : we(t, e), true;
|
|
748
|
+
}
|
|
749
|
+
function ec({ comment: e, precedingNode: t, enclosingNode: r, followingNode: n, text: s }) {
|
|
750
|
+
return !n && r?.type === "UnaryExpression" && (t?.type === "LogicalExpression" || t?.type === "BinaryExpression") && ue(s, w(r.argument), w(t.right)) && Zn(e, s) && !ue(s, w(t.right), w(e)) ? ($(t.right, e), true) : false;
|
|
751
|
+
}
|
|
752
|
+
function tc({ enclosingNode: e, followingNode: t, comment: r }) {
|
|
753
|
+
if (e && (e.type === "TSPropertySignature" || e.type === "ObjectTypeProperty") && (Se(t) || xt(t))) return te(t, r), true;
|
|
754
|
+
}
|
|
755
|
+
function ss({ enclosingNode: e, precedingNode: t, followingNode: r, comment: n, text: s }) {
|
|
756
|
+
if (Ae(e) && t === e.expression && !Zn(n, s)) return r ? te(r, n) : $(e, n), true;
|
|
757
|
+
}
|
|
758
|
+
function rc({ comment: e, enclosingNode: t, followingNode: r, precedingNode: n }) {
|
|
759
|
+
return t && r && n && t.type === "ArrowFunctionExpression" && t.returnType === n && (n.type === "TSTypeAnnotation" || n.type === "TypeAnnotation") ? (te(r, e), true) : false;
|
|
760
|
+
}
|
|
761
|
+
var Ri = k(["ArrowFunctionExpression", "FunctionExpression", "FunctionDeclaration", "ObjectMethod", "ClassMethod", "TSDeclareFunction", "TSCallSignatureDeclaration", "TSConstructSignatureDeclaration", "TSMethodSignature", "TSConstructorType", "TSFunctionType", "TSDeclareMethod"]);
|
|
762
|
+
var nc = { endOfLine: Ip, ownLine: kp, remaining: Lp };
|
|
763
|
+
var Ji = nc;
|
|
764
|
+
function sc(e, { parser: t }) {
|
|
765
|
+
if (t === "flow" || t === "hermes" || t === "babel-flow") return e = W(0, e, /[\s(]/gu, ""), e === "" || e === "/*" || e === "/*::";
|
|
766
|
+
}
|
|
767
|
+
var Gi = sc;
|
|
768
|
+
var ic = k(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]);
|
|
769
|
+
function oc(e) {
|
|
770
|
+
let { key: t, parent: r } = e;
|
|
771
|
+
if (t === "types" && Se(r) || t === "argument" && r.type === "JSXSpreadAttribute" || t === "expression" && r.type === "JSXSpreadChild" || t === "superClass" && (r.type === "ClassDeclaration" || r.type === "ClassExpression") || (t === "id" || t === "typeParameters") && ic(r) || t === "patterns" && r.type === "MatchOrPattern") return true;
|
|
772
|
+
let { node: n } = e;
|
|
773
|
+
return Ot(n) ? false : Se(n) ? Yr(e) : !!H(n);
|
|
774
|
+
}
|
|
775
|
+
var Wi = oc;
|
|
776
|
+
var Ye = "string";
|
|
777
|
+
var Be = "array";
|
|
778
|
+
var tt = "cursor";
|
|
779
|
+
var He = "indent";
|
|
780
|
+
var Xe = "align";
|
|
781
|
+
var rt = "trim";
|
|
782
|
+
var Fe = "group";
|
|
783
|
+
var Me = "fill";
|
|
784
|
+
var be = "if-break";
|
|
785
|
+
var Ve = "indent-if-break";
|
|
786
|
+
var $e = "line-suffix";
|
|
787
|
+
var Ge = "line-suffix-boundary";
|
|
788
|
+
var me = "line";
|
|
789
|
+
var Pe = "label";
|
|
790
|
+
var Ne = "break-parent";
|
|
791
|
+
var Xr = /* @__PURE__ */ new Set([tt, He, Xe, rt, Fe, Me, be, Ve, $e, Ge, me, Pe, Ne]);
|
|
792
|
+
function uc(e) {
|
|
793
|
+
if (typeof e == "string") return Ye;
|
|
794
|
+
if (Array.isArray(e)) return Be;
|
|
795
|
+
if (!e) return;
|
|
796
|
+
let { type: t } = e;
|
|
797
|
+
if (Xr.has(t)) return t;
|
|
798
|
+
}
|
|
799
|
+
var We = uc;
|
|
800
|
+
var ac = (e) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(e);
|
|
801
|
+
function pc(e) {
|
|
802
|
+
let t = e === null ? "null" : typeof e;
|
|
803
|
+
if (t !== "string" && t !== "object") return `Unexpected doc '${t}',
|
|
804
|
+
Expected it to be 'string' or 'object'.`;
|
|
805
|
+
if (We(e)) throw new Error("doc is valid.");
|
|
806
|
+
let r = Object.prototype.toString.call(e);
|
|
807
|
+
if (r !== "[object Object]") return `Unexpected doc '${r}'.`;
|
|
808
|
+
let n = ac([...Xr].map((s) => `'${s}'`));
|
|
809
|
+
return `Unexpected doc.type '${e.type}'.
|
|
810
|
+
Expected it to be ${n}.`;
|
|
811
|
+
}
|
|
812
|
+
var is = class extends Error {
|
|
813
|
+
name = "InvalidDocError";
|
|
814
|
+
constructor(t) {
|
|
815
|
+
super(pc(t)), this.doc = t;
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
var gt = is;
|
|
819
|
+
var qi = {};
|
|
820
|
+
function cc(e, t, r, n) {
|
|
821
|
+
let s = [e];
|
|
822
|
+
for (; s.length > 0; ) {
|
|
823
|
+
let i = s.pop();
|
|
824
|
+
if (i === qi) {
|
|
825
|
+
r(s.pop());
|
|
826
|
+
continue;
|
|
827
|
+
}
|
|
828
|
+
r && s.push(i, qi);
|
|
829
|
+
let o = We(i);
|
|
830
|
+
if (!o) throw new gt(i);
|
|
831
|
+
if (t?.(i) !== false) switch (o) {
|
|
832
|
+
case Be:
|
|
833
|
+
case Me: {
|
|
834
|
+
let u = o === Be ? i : i.parts;
|
|
835
|
+
for (let p = u.length, c = p - 1; c >= 0; --c) s.push(u[c]);
|
|
836
|
+
break;
|
|
837
|
+
}
|
|
838
|
+
case be:
|
|
839
|
+
s.push(i.flatContents, i.breakContents);
|
|
840
|
+
break;
|
|
841
|
+
case Fe:
|
|
842
|
+
if (n && i.expandedStates) for (let u = i.expandedStates.length, p = u - 1; p >= 0; --p) s.push(i.expandedStates[p]);
|
|
843
|
+
else s.push(i.contents);
|
|
844
|
+
break;
|
|
845
|
+
case Xe:
|
|
846
|
+
case He:
|
|
847
|
+
case Ve:
|
|
848
|
+
case Pe:
|
|
849
|
+
case $e:
|
|
850
|
+
s.push(i.contents);
|
|
851
|
+
break;
|
|
852
|
+
case Ye:
|
|
853
|
+
case tt:
|
|
854
|
+
case rt:
|
|
855
|
+
case Ge:
|
|
856
|
+
case me:
|
|
857
|
+
case Ne:
|
|
858
|
+
break;
|
|
859
|
+
default:
|
|
860
|
+
throw new gt(i);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
var Vr = cc;
|
|
865
|
+
function ft(e, t) {
|
|
866
|
+
if (typeof e == "string") return t(e);
|
|
867
|
+
let r = /* @__PURE__ */ new Map();
|
|
868
|
+
return n(e);
|
|
869
|
+
function n(i) {
|
|
870
|
+
if (r.has(i)) return r.get(i);
|
|
871
|
+
let o = s(i);
|
|
872
|
+
return r.set(i, o), o;
|
|
873
|
+
}
|
|
874
|
+
function s(i) {
|
|
875
|
+
switch (We(i)) {
|
|
876
|
+
case Be:
|
|
877
|
+
return t(i.map(n));
|
|
878
|
+
case Me:
|
|
879
|
+
return t({ ...i, parts: i.parts.map(n) });
|
|
880
|
+
case be:
|
|
881
|
+
return t({ ...i, breakContents: n(i.breakContents), flatContents: n(i.flatContents) });
|
|
882
|
+
case Fe: {
|
|
883
|
+
let { expandedStates: o, contents: u } = i;
|
|
884
|
+
return o ? (o = o.map(n), u = o[0]) : u = n(u), t({ ...i, contents: u, expandedStates: o });
|
|
885
|
+
}
|
|
886
|
+
case Xe:
|
|
887
|
+
case He:
|
|
888
|
+
case Ve:
|
|
889
|
+
case Pe:
|
|
890
|
+
case $e:
|
|
891
|
+
return t({ ...i, contents: n(i.contents) });
|
|
892
|
+
case Ye:
|
|
893
|
+
case tt:
|
|
894
|
+
case rt:
|
|
895
|
+
case Ge:
|
|
896
|
+
case me:
|
|
897
|
+
case Ne:
|
|
898
|
+
return t(i);
|
|
899
|
+
default:
|
|
900
|
+
throw new gt(i);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
function Yi(e, t, r) {
|
|
905
|
+
let n = r, s = false;
|
|
906
|
+
function i(o) {
|
|
907
|
+
if (s) return false;
|
|
908
|
+
let u = t(o);
|
|
909
|
+
u !== void 0 && (s = true, n = u);
|
|
910
|
+
}
|
|
911
|
+
return Vr(e, i), n;
|
|
912
|
+
}
|
|
913
|
+
function lc(e) {
|
|
914
|
+
if (e.type === Fe && e.break || e.type === me && e.hard || e.type === Ne) return true;
|
|
915
|
+
}
|
|
916
|
+
function ne(e) {
|
|
917
|
+
return Yi(e, lc, false);
|
|
918
|
+
}
|
|
919
|
+
function Ui(e) {
|
|
920
|
+
if (e.length > 0) {
|
|
921
|
+
let t = N(0, e, -1);
|
|
922
|
+
!t.expandedStates && !t.break && (t.break = "propagated");
|
|
923
|
+
}
|
|
924
|
+
return null;
|
|
925
|
+
}
|
|
926
|
+
function Hi(e) {
|
|
927
|
+
let t = /* @__PURE__ */ new Set(), r = [];
|
|
928
|
+
function n(i) {
|
|
929
|
+
if (i.type === Ne && Ui(r), i.type === Fe) {
|
|
930
|
+
if (r.push(i), t.has(i)) return false;
|
|
931
|
+
t.add(i);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
function s(i) {
|
|
935
|
+
i.type === Fe && r.pop().break && Ui(r);
|
|
936
|
+
}
|
|
937
|
+
Vr(e, n, s, true);
|
|
938
|
+
}
|
|
939
|
+
function mc(e) {
|
|
940
|
+
return e.type === me && !e.hard ? e.soft ? "" : " " : e.type === be ? e.flatContents : e;
|
|
941
|
+
}
|
|
942
|
+
function _t(e) {
|
|
943
|
+
return ft(e, mc);
|
|
944
|
+
}
|
|
945
|
+
function Dc(e) {
|
|
946
|
+
switch (We(e)) {
|
|
947
|
+
case Me:
|
|
948
|
+
if (e.parts.every((t) => t === "")) return "";
|
|
949
|
+
break;
|
|
950
|
+
case Fe:
|
|
951
|
+
if (!e.contents && !e.id && !e.break && !e.expandedStates) return "";
|
|
952
|
+
if (e.contents.type === Fe && e.contents.id === e.id && e.contents.break === e.break && e.contents.expandedStates === e.expandedStates) return e.contents;
|
|
953
|
+
break;
|
|
954
|
+
case Xe:
|
|
955
|
+
case He:
|
|
956
|
+
case Ve:
|
|
957
|
+
case $e:
|
|
958
|
+
if (!e.contents) return "";
|
|
959
|
+
break;
|
|
960
|
+
case be:
|
|
961
|
+
if (!e.flatContents && !e.breakContents) return "";
|
|
962
|
+
break;
|
|
963
|
+
case Be: {
|
|
964
|
+
let t = [];
|
|
965
|
+
for (let r of e) {
|
|
966
|
+
if (!r) continue;
|
|
967
|
+
let [n, ...s] = Array.isArray(r) ? r : [r];
|
|
968
|
+
typeof n == "string" && typeof N(0, t, -1) == "string" ? t[t.length - 1] += n : t.push(n), t.push(...s);
|
|
969
|
+
}
|
|
970
|
+
return t.length === 0 ? "" : t.length === 1 ? t[0] : t;
|
|
971
|
+
}
|
|
972
|
+
case Ye:
|
|
973
|
+
case tt:
|
|
974
|
+
case rt:
|
|
975
|
+
case Ge:
|
|
976
|
+
case me:
|
|
977
|
+
case Pe:
|
|
978
|
+
case Ne:
|
|
979
|
+
break;
|
|
980
|
+
default:
|
|
981
|
+
throw new gt(e);
|
|
982
|
+
}
|
|
983
|
+
return e;
|
|
984
|
+
}
|
|
985
|
+
function Qt(e) {
|
|
986
|
+
return ft(e, (t) => Dc(t));
|
|
987
|
+
}
|
|
988
|
+
function qe(e, t = $r) {
|
|
989
|
+
return ft(e, (r) => typeof r == "string" ? L(t, r.split(`
|
|
990
|
+
`)) : r);
|
|
991
|
+
}
|
|
992
|
+
function fc(e) {
|
|
993
|
+
if (e.type === me) return true;
|
|
994
|
+
}
|
|
995
|
+
function Xi(e) {
|
|
996
|
+
return Yi(e, fc, false);
|
|
997
|
+
}
|
|
998
|
+
function Ar(e, t) {
|
|
999
|
+
return e.type === Pe ? { ...e, contents: t(e.contents) } : t(e);
|
|
1000
|
+
}
|
|
1001
|
+
function Vi(e) {
|
|
1002
|
+
let t = true;
|
|
1003
|
+
return Vr(e, (r) => {
|
|
1004
|
+
switch (We(r)) {
|
|
1005
|
+
case Ye:
|
|
1006
|
+
if (r === "") break;
|
|
1007
|
+
case rt:
|
|
1008
|
+
case Ge:
|
|
1009
|
+
case me:
|
|
1010
|
+
case Ne:
|
|
1011
|
+
return t = false, false;
|
|
1012
|
+
}
|
|
1013
|
+
}), t;
|
|
1014
|
+
}
|
|
1015
|
+
var de = Le;
|
|
1016
|
+
var Kr = Le;
|
|
1017
|
+
var $i = Le;
|
|
1018
|
+
var Ki = Le;
|
|
1019
|
+
function m(e) {
|
|
1020
|
+
return de(e), { type: He, contents: e };
|
|
1021
|
+
}
|
|
1022
|
+
function xe(e, t) {
|
|
1023
|
+
return Ki(e), de(t), { type: Xe, contents: t, n: e };
|
|
1024
|
+
}
|
|
1025
|
+
function Qi(e) {
|
|
1026
|
+
return xe(Number.NEGATIVE_INFINITY, e);
|
|
1027
|
+
}
|
|
1028
|
+
function Qr(e) {
|
|
1029
|
+
return xe(-1, e);
|
|
1030
|
+
}
|
|
1031
|
+
function zi(e, t, r) {
|
|
1032
|
+
de(e);
|
|
1033
|
+
let n = e;
|
|
1034
|
+
if (t > 0) {
|
|
1035
|
+
for (let s = 0; s < Math.floor(t / r); ++s) n = m(n);
|
|
1036
|
+
n = xe(t % r, n), n = xe(Number.NEGATIVE_INFINITY, n);
|
|
1037
|
+
}
|
|
1038
|
+
return n;
|
|
1039
|
+
}
|
|
1040
|
+
var ke = { type: Ne };
|
|
1041
|
+
var Tr = { type: tt };
|
|
1042
|
+
function zr(e) {
|
|
1043
|
+
return $i(e), { type: Me, parts: e };
|
|
1044
|
+
}
|
|
1045
|
+
function l(e, t = {}) {
|
|
1046
|
+
return de(e), Kr(t.expandedStates, true), { type: Fe, id: t.id, contents: e, break: !!t.shouldBreak, expandedStates: t.expandedStates };
|
|
1047
|
+
}
|
|
1048
|
+
function nt(e, t) {
|
|
1049
|
+
return l(e[0], { ...t, expandedStates: e });
|
|
1050
|
+
}
|
|
1051
|
+
function P(e, t = "", r = {}) {
|
|
1052
|
+
return de(e), t !== "" && de(t), { type: be, breakContents: e, flatContents: t, groupId: r.groupId };
|
|
1053
|
+
}
|
|
1054
|
+
function yt(e, t) {
|
|
1055
|
+
return de(e), { type: Ve, contents: e, groupId: t.groupId, negate: t.negate };
|
|
1056
|
+
}
|
|
1057
|
+
function L(e, t) {
|
|
1058
|
+
de(e), Kr(t);
|
|
1059
|
+
let r = [];
|
|
1060
|
+
for (let n = 0; n < t.length; n++) n !== 0 && r.push(e), r.push(t[n]);
|
|
1061
|
+
return r;
|
|
1062
|
+
}
|
|
1063
|
+
function pt(e, t) {
|
|
1064
|
+
return de(t), e ? { type: Pe, label: e, contents: t } : t;
|
|
1065
|
+
}
|
|
1066
|
+
var A = { type: me };
|
|
1067
|
+
var f = { type: me, soft: true };
|
|
1068
|
+
var os = { type: me, hard: true };
|
|
1069
|
+
var E = [os, ke];
|
|
1070
|
+
var yc = { type: me, hard: true, literal: true };
|
|
1071
|
+
var $r = [yc, ke];
|
|
1072
|
+
function us(e) {
|
|
1073
|
+
return de(e), { type: $e, contents: e };
|
|
1074
|
+
}
|
|
1075
|
+
var je = { type: Ge };
|
|
1076
|
+
var Ec = "cr";
|
|
1077
|
+
var Fc = "crlf";
|
|
1078
|
+
var dc = "\r";
|
|
1079
|
+
var Cc = `\r
|
|
1080
|
+
`;
|
|
1081
|
+
var Ac = `
|
|
1082
|
+
`;
|
|
1083
|
+
var Tc = Ac;
|
|
1084
|
+
function Zi(e) {
|
|
1085
|
+
return e === Ec ? dc : e === Fc ? Cc : Tc;
|
|
1086
|
+
}
|
|
1087
|
+
var xc = { type: 0 };
|
|
1088
|
+
var gc = { type: 1 };
|
|
1089
|
+
var as = { value: "", length: 0, queue: [], get root() {
|
|
1090
|
+
return as;
|
|
1091
|
+
} };
|
|
1092
|
+
function eo(e, t, r) {
|
|
1093
|
+
let n = t.type === 1 ? e.queue.slice(0, -1) : [...e.queue, t], s = "", i = 0, o = 0, u = 0;
|
|
1094
|
+
for (let d of n) switch (d.type) {
|
|
1095
|
+
case 0:
|
|
1096
|
+
y(), r.useTabs ? p(1) : c(r.tabWidth);
|
|
1097
|
+
break;
|
|
1098
|
+
case 3: {
|
|
1099
|
+
let { string: b } = d;
|
|
1100
|
+
y(), s += b, i += b.length;
|
|
1101
|
+
break;
|
|
1102
|
+
}
|
|
1103
|
+
case 2: {
|
|
1104
|
+
let { width: b } = d;
|
|
1105
|
+
o += 1, u += b;
|
|
1106
|
+
break;
|
|
1107
|
+
}
|
|
1108
|
+
default:
|
|
1109
|
+
throw new Error(`Unexpected indent comment '${d.type}'.`);
|
|
1110
|
+
}
|
|
1111
|
+
return F(), { ...e, value: s, length: i, queue: n };
|
|
1112
|
+
function p(d) {
|
|
1113
|
+
s += " ".repeat(d), i += r.tabWidth * d;
|
|
1114
|
+
}
|
|
1115
|
+
function c(d) {
|
|
1116
|
+
s += " ".repeat(d), i += d;
|
|
1117
|
+
}
|
|
1118
|
+
function y() {
|
|
1119
|
+
r.useTabs ? D() : F();
|
|
1120
|
+
}
|
|
1121
|
+
function D() {
|
|
1122
|
+
o > 0 && p(o), C();
|
|
1123
|
+
}
|
|
1124
|
+
function F() {
|
|
1125
|
+
u > 0 && c(u), C();
|
|
1126
|
+
}
|
|
1127
|
+
function C() {
|
|
1128
|
+
o = 0, u = 0;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
function to(e, t, r) {
|
|
1132
|
+
if (!t) return e;
|
|
1133
|
+
if (t.type === "root") return { ...e, root: e };
|
|
1134
|
+
if (t === Number.NEGATIVE_INFINITY) return e.root;
|
|
1135
|
+
let n;
|
|
1136
|
+
return typeof t == "number" ? t < 0 ? n = gc : n = { type: 2, width: t } : n = { type: 3, string: t }, eo(e, n, r);
|
|
1137
|
+
}
|
|
1138
|
+
function ro(e, t) {
|
|
1139
|
+
return eo(e, xc, t);
|
|
1140
|
+
}
|
|
1141
|
+
function hc(e) {
|
|
1142
|
+
let t = 0;
|
|
1143
|
+
for (let r = e.length - 1; r >= 0; r--) {
|
|
1144
|
+
let n = e[r];
|
|
1145
|
+
if (n === " " || n === " ") t++;
|
|
1146
|
+
else break;
|
|
1147
|
+
}
|
|
1148
|
+
return t;
|
|
1149
|
+
}
|
|
1150
|
+
function ps(e) {
|
|
1151
|
+
let t = hc(e);
|
|
1152
|
+
return { text: t === 0 ? e : e.slice(0, e.length - t), count: t };
|
|
1153
|
+
}
|
|
1154
|
+
var ve = /* @__PURE__ */ Symbol("MODE_BREAK");
|
|
1155
|
+
var ct = /* @__PURE__ */ Symbol("MODE_FLAT");
|
|
1156
|
+
var cs = /* @__PURE__ */ Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
1157
|
+
function Zr(e, t, r, n, s, i) {
|
|
1158
|
+
if (r === Number.POSITIVE_INFINITY) return true;
|
|
1159
|
+
let o = t.length, u = false, p = [e], c = "";
|
|
1160
|
+
for (; r >= 0; ) {
|
|
1161
|
+
if (p.length === 0) {
|
|
1162
|
+
if (o === 0) return true;
|
|
1163
|
+
p.push(t[--o]);
|
|
1164
|
+
continue;
|
|
1165
|
+
}
|
|
1166
|
+
let { mode: y, doc: D } = p.pop(), F = We(D);
|
|
1167
|
+
switch (F) {
|
|
1168
|
+
case Ye:
|
|
1169
|
+
D && (u && (c += " ", r -= 1, u = false), c += D, r -= ot(D));
|
|
1170
|
+
break;
|
|
1171
|
+
case Be:
|
|
1172
|
+
case Me: {
|
|
1173
|
+
let C = F === Be ? D : D.parts, d = D[cs] ?? 0;
|
|
1174
|
+
for (let b = C.length - 1; b >= d; b--) p.push({ mode: y, doc: C[b] });
|
|
1175
|
+
break;
|
|
1176
|
+
}
|
|
1177
|
+
case He:
|
|
1178
|
+
case Xe:
|
|
1179
|
+
case Ve:
|
|
1180
|
+
case Pe:
|
|
1181
|
+
p.push({ mode: y, doc: D.contents });
|
|
1182
|
+
break;
|
|
1183
|
+
case rt: {
|
|
1184
|
+
let { text: C, count: d } = ps(c);
|
|
1185
|
+
c = C, r += d;
|
|
1186
|
+
break;
|
|
1187
|
+
}
|
|
1188
|
+
case Fe: {
|
|
1189
|
+
if (i && D.break) return false;
|
|
1190
|
+
let C = D.break ? ve : y, d = D.expandedStates && C === ve ? N(0, D.expandedStates, -1) : D.contents;
|
|
1191
|
+
p.push({ mode: C, doc: d });
|
|
1192
|
+
break;
|
|
1193
|
+
}
|
|
1194
|
+
case be: {
|
|
1195
|
+
let d = (D.groupId ? s[D.groupId] || ct : y) === ve ? D.breakContents : D.flatContents;
|
|
1196
|
+
d && p.push({ mode: y, doc: d });
|
|
1197
|
+
break;
|
|
1198
|
+
}
|
|
1199
|
+
case me:
|
|
1200
|
+
if (y === ve || D.hard) return true;
|
|
1201
|
+
D.soft || (u = true);
|
|
1202
|
+
break;
|
|
1203
|
+
case $e:
|
|
1204
|
+
n = true;
|
|
1205
|
+
break;
|
|
1206
|
+
case Ge:
|
|
1207
|
+
if (n) return false;
|
|
1208
|
+
break;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
return false;
|
|
1212
|
+
}
|
|
1213
|
+
function ls(e, t) {
|
|
1214
|
+
let r = /* @__PURE__ */ Object.create(null), n = t.printWidth, s = Zi(t.endOfLine), i = 0, o = [{ indent: as, mode: ve, doc: e }], u = "", p = false, c = [], y = [], D = [], F = [], C = 0;
|
|
1215
|
+
for (Hi(e); o.length > 0; ) {
|
|
1216
|
+
let { indent: h, mode: g, doc: S } = o.pop();
|
|
1217
|
+
switch (We(S)) {
|
|
1218
|
+
case Ye: {
|
|
1219
|
+
let j = s !== `
|
|
1220
|
+
` ? W(0, S, `
|
|
1221
|
+
`, s) : S;
|
|
1222
|
+
j && (u += j, o.length > 0 && (i += ot(j)));
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
case Be:
|
|
1226
|
+
for (let j = S.length - 1; j >= 0; j--) o.push({ indent: h, mode: g, doc: S[j] });
|
|
1227
|
+
break;
|
|
1228
|
+
case tt:
|
|
1229
|
+
if (y.length >= 2) throw new Error("There are too many 'cursor' in doc.");
|
|
1230
|
+
y.push(C + u.length);
|
|
1231
|
+
break;
|
|
1232
|
+
case He:
|
|
1233
|
+
o.push({ indent: ro(h, t), mode: g, doc: S.contents });
|
|
1234
|
+
break;
|
|
1235
|
+
case Xe:
|
|
1236
|
+
o.push({ indent: to(h, S.n, t), mode: g, doc: S.contents });
|
|
1237
|
+
break;
|
|
1238
|
+
case rt:
|
|
1239
|
+
O();
|
|
1240
|
+
break;
|
|
1241
|
+
case Fe:
|
|
1242
|
+
switch (g) {
|
|
1243
|
+
case ct:
|
|
1244
|
+
if (!p) {
|
|
1245
|
+
o.push({ indent: h, mode: S.break ? ve : ct, doc: S.contents });
|
|
1246
|
+
break;
|
|
1247
|
+
}
|
|
1248
|
+
case ve: {
|
|
1249
|
+
p = false;
|
|
1250
|
+
let j = { indent: h, mode: ct, doc: S.contents }, U = n - i, fe = c.length > 0;
|
|
1251
|
+
if (!S.break && Zr(j, o, U, fe, r)) o.push(j);
|
|
1252
|
+
else if (S.expandedStates) {
|
|
1253
|
+
let Y = N(0, S.expandedStates, -1);
|
|
1254
|
+
if (S.break) {
|
|
1255
|
+
o.push({ indent: h, mode: ve, doc: Y });
|
|
1256
|
+
break;
|
|
1257
|
+
} else for (let z = 1; z < S.expandedStates.length + 1; z++) if (z >= S.expandedStates.length) {
|
|
1258
|
+
o.push({ indent: h, mode: ve, doc: Y });
|
|
1259
|
+
break;
|
|
1260
|
+
} else {
|
|
1261
|
+
let ee = S.expandedStates[z], Ie = { indent: h, mode: ct, doc: ee };
|
|
1262
|
+
if (Zr(Ie, o, U, fe, r)) {
|
|
1263
|
+
o.push(Ie);
|
|
1264
|
+
break;
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
} else o.push({ indent: h, mode: ve, doc: S.contents });
|
|
1268
|
+
break;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
S.id && (r[S.id] = N(0, o, -1).mode);
|
|
1272
|
+
break;
|
|
1273
|
+
case Me: {
|
|
1274
|
+
let j = n - i, U = S[cs] ?? 0, { parts: fe } = S, Y = fe.length - U;
|
|
1275
|
+
if (Y === 0) break;
|
|
1276
|
+
let z = fe[U + 0], ee = fe[U + 1], Ie = { indent: h, mode: ct, doc: z }, st = { indent: h, mode: ve, doc: z }, _ = Zr(Ie, [], j, c.length > 0, r, true);
|
|
1277
|
+
if (Y === 1) {
|
|
1278
|
+
_ ? o.push(Ie) : o.push(st);
|
|
1279
|
+
break;
|
|
1280
|
+
}
|
|
1281
|
+
let re = { indent: h, mode: ct, doc: ee }, ae = { indent: h, mode: ve, doc: ee };
|
|
1282
|
+
if (Y === 2) {
|
|
1283
|
+
_ ? o.push(re, Ie) : o.push(ae, st);
|
|
1284
|
+
break;
|
|
1285
|
+
}
|
|
1286
|
+
let it = fe[U + 2], Bt = { indent: h, mode: g, doc: { ...S, [cs]: U + 2 } }, Pr = Zr({ indent: h, mode: ct, doc: [z, ee, it] }, [], j, c.length > 0, r, true);
|
|
1287
|
+
o.push(Bt), Pr ? o.push(re, Ie) : _ ? o.push(ae, Ie) : o.push(ae, st);
|
|
1288
|
+
break;
|
|
1289
|
+
}
|
|
1290
|
+
case be:
|
|
1291
|
+
case Ve: {
|
|
1292
|
+
let j = S.groupId ? r[S.groupId] : g;
|
|
1293
|
+
if (j === ve) {
|
|
1294
|
+
let U = S.type === be ? S.breakContents : S.negate ? S.contents : m(S.contents);
|
|
1295
|
+
U && o.push({ indent: h, mode: g, doc: U });
|
|
1296
|
+
}
|
|
1297
|
+
if (j === ct) {
|
|
1298
|
+
let U = S.type === be ? S.flatContents : S.negate ? m(S.contents) : S.contents;
|
|
1299
|
+
U && o.push({ indent: h, mode: g, doc: U });
|
|
1300
|
+
}
|
|
1301
|
+
break;
|
|
1302
|
+
}
|
|
1303
|
+
case $e:
|
|
1304
|
+
c.push({ indent: h, mode: g, doc: S.contents });
|
|
1305
|
+
break;
|
|
1306
|
+
case Ge:
|
|
1307
|
+
c.length > 0 && o.push({ indent: h, mode: g, doc: os });
|
|
1308
|
+
break;
|
|
1309
|
+
case me:
|
|
1310
|
+
switch (g) {
|
|
1311
|
+
case ct:
|
|
1312
|
+
if (S.hard) p = true;
|
|
1313
|
+
else {
|
|
1314
|
+
S.soft || (u += " ", i += 1);
|
|
1315
|
+
break;
|
|
1316
|
+
}
|
|
1317
|
+
case ve:
|
|
1318
|
+
if (c.length > 0) {
|
|
1319
|
+
o.push({ indent: h, mode: g, doc: S }, ...c.reverse()), c.length = 0;
|
|
1320
|
+
break;
|
|
1321
|
+
}
|
|
1322
|
+
S.literal ? (u += s, i = 0, h.root && (h.root.value && (u += h.root.value), i = h.root.length)) : (O(), u += s + h.value, i = h.length);
|
|
1323
|
+
break;
|
|
1324
|
+
}
|
|
1325
|
+
break;
|
|
1326
|
+
case Pe:
|
|
1327
|
+
o.push({ indent: h, mode: g, doc: S.contents });
|
|
1328
|
+
break;
|
|
1329
|
+
case Ne:
|
|
1330
|
+
break;
|
|
1331
|
+
default:
|
|
1332
|
+
throw new gt(S);
|
|
1333
|
+
}
|
|
1334
|
+
o.length === 0 && c.length > 0 && (o.push(...c.reverse()), c.length = 0);
|
|
1335
|
+
}
|
|
1336
|
+
let d = D.join("") + u, b = [...F, ...y];
|
|
1337
|
+
if (b.length !== 2) return { formatted: d };
|
|
1338
|
+
let B = b[0];
|
|
1339
|
+
return { formatted: d, cursorNodeStart: B, cursorNodeText: d.slice(B, N(0, b, -1)) };
|
|
1340
|
+
function O() {
|
|
1341
|
+
let { text: h, count: g } = ps(u);
|
|
1342
|
+
h && (D.push(h), C += h.length), u = "", i -= g, y.length > 0 && (F.push(...y.map((S) => Math.min(S, C))), y.length = 0);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
function Sc(e, t, r = 0) {
|
|
1346
|
+
let n = 0;
|
|
1347
|
+
for (let s = r; s < e.length; ++s) e[s] === " " ? n = n + t - n % t : n++;
|
|
1348
|
+
return n;
|
|
1349
|
+
}
|
|
1350
|
+
var no = Sc;
|
|
1351
|
+
function Bc(e, t) {
|
|
1352
|
+
let r = e.lastIndexOf(`
|
|
1353
|
+
`);
|
|
1354
|
+
return r === -1 ? 0 : no(e.slice(r + 1).match(/^[\t ]*/u)[0], t);
|
|
1355
|
+
}
|
|
1356
|
+
var so = Bc;
|
|
1357
|
+
function en(e, t, r) {
|
|
1358
|
+
let { node: n } = e;
|
|
1359
|
+
if (n.type === "TemplateLiteral" && kc(e)) {
|
|
1360
|
+
let c = bc(e, t, r);
|
|
1361
|
+
if (c) return c;
|
|
1362
|
+
}
|
|
1363
|
+
let i = "expressions";
|
|
1364
|
+
n.type === "TSTemplateLiteralType" && (i = "types");
|
|
1365
|
+
let o = [], u = e.map(r, i);
|
|
1366
|
+
o.push(je, "`");
|
|
1367
|
+
let p = 0;
|
|
1368
|
+
return e.each(({ index: c, node: y }) => {
|
|
1369
|
+
if (o.push(r()), y.tail) return;
|
|
1370
|
+
let { tabWidth: D } = t, F = y.value.raw, C = F.includes(`
|
|
1371
|
+
`) ? so(F, D) : p;
|
|
1372
|
+
p = C;
|
|
1373
|
+
let d = u[c], b = n[i][c], B = ue(t.originalText, I(y), w(n.quasis[c + 1]));
|
|
1374
|
+
if (!B) {
|
|
1375
|
+
let h = ls(d, { ...t, printWidth: Number.POSITIVE_INFINITY }).formatted;
|
|
1376
|
+
h.includes(`
|
|
1377
|
+
`) ? B = true : d = h;
|
|
1378
|
+
}
|
|
1379
|
+
B && (T(b) || b.type === "Identifier" || J(b) || b.type === "ConditionalExpression" || b.type === "SequenceExpression" || Ae(b) || Te(b)) && (d = [m([f, d]), f]);
|
|
1380
|
+
let O = C === 0 && F.endsWith(`
|
|
1381
|
+
`) ? xe(Number.NEGATIVE_INFINITY, d) : zi(d, C, D);
|
|
1382
|
+
o.push(l(["${", O, je, "}"]));
|
|
1383
|
+
}, "quasis"), o.push("`"), o;
|
|
1384
|
+
}
|
|
1385
|
+
function io(e, t, r) {
|
|
1386
|
+
let n = r("quasi"), { node: s } = e, i = "", o = et(s.quasi, x.Leading)[0];
|
|
1387
|
+
return o && (ue(t.originalText, I(s.typeArguments ?? s.tag), w(o)) ? i = f : i = " "), pt(n.label && { tagged: true, ...n.label }, [r("tag"), r("typeArguments"), i, je, n]);
|
|
1388
|
+
}
|
|
1389
|
+
function bc(e, t, r) {
|
|
1390
|
+
let { node: n } = e, s = n.quasis[0].value.raw.trim().split(/\s*\|\s*/u);
|
|
1391
|
+
if (s.length > 1 || s.some((i) => i.length > 0)) {
|
|
1392
|
+
t.__inJestEach = true;
|
|
1393
|
+
let i = e.map(r, "expressions");
|
|
1394
|
+
t.__inJestEach = false;
|
|
1395
|
+
let o = i.map((D) => "${" + ls(D, { ...t, printWidth: Number.POSITIVE_INFINITY, endOfLine: "lf" }).formatted + "}"), u = [{ hasLineBreak: false, cells: [] }];
|
|
1396
|
+
for (let D = 1; D < n.quasis.length; D++) {
|
|
1397
|
+
let F = N(0, u, -1), C = o[D - 1];
|
|
1398
|
+
F.cells.push(C), C.includes(`
|
|
1399
|
+
`) && (F.hasLineBreak = true), n.quasis[D].value.raw.includes(`
|
|
1400
|
+
`) && u.push({ hasLineBreak: false, cells: [] });
|
|
1401
|
+
}
|
|
1402
|
+
let p = Math.max(s.length, ...u.map((D) => D.cells.length)), c = Array.from({ length: p }).fill(0), y = [{ cells: s }, ...u.filter((D) => D.cells.length > 0)];
|
|
1403
|
+
for (let { cells: D } of y.filter((F) => !F.hasLineBreak)) for (let [F, C] of D.entries()) c[F] = Math.max(c[F], ot(C));
|
|
1404
|
+
return [je, "`", m([E, L(E, y.map((D) => L(" | ", D.cells.map((F, C) => D.hasLineBreak ? F : F + " ".repeat(c[C] - ot(F))))))]), E, "`"];
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
function Pc(e, t) {
|
|
1408
|
+
let { node: r } = e, n = t();
|
|
1409
|
+
return T(r) && (n = l([m([f, n]), f])), ["${", n, je, "}"];
|
|
1410
|
+
}
|
|
1411
|
+
function zt(e, t) {
|
|
1412
|
+
return e.map(() => Pc(e, t), "expressions");
|
|
1413
|
+
}
|
|
1414
|
+
function tn(e, t) {
|
|
1415
|
+
return ft(e, (r) => typeof r == "string" ? t ? W(0, r, /(\\*)`/gu, "$1$1\\`") : ms(r) : r);
|
|
1416
|
+
}
|
|
1417
|
+
function ms(e) {
|
|
1418
|
+
return W(0, e, /([\\`]|\$\{)/gu, "\\$1");
|
|
1419
|
+
}
|
|
1420
|
+
function kc({ node: e, parent: t }) {
|
|
1421
|
+
let r = /^[fx]?(?:describe|it|test)$/u;
|
|
1422
|
+
return t.type === "TaggedTemplateExpression" && t.quasi === e && t.tag.type === "MemberExpression" && t.tag.property.type === "Identifier" && t.tag.property.name === "each" && (t.tag.object.type === "Identifier" && r.test(t.tag.object.name) || t.tag.object.type === "MemberExpression" && t.tag.object.property.type === "Identifier" && (t.tag.object.property.name === "only" || t.tag.object.property.name === "skip") && t.tag.object.object.type === "Identifier" && r.test(t.tag.object.object.name));
|
|
1423
|
+
}
|
|
1424
|
+
var fs = [(e, t) => e.type === "ObjectExpression" && t === "properties", (e, t) => e.type === "CallExpression" && e.callee.type === "Identifier" && e.callee.name === "Component" && t === "arguments", (e, t) => e.type === "Decorator" && t === "expression"];
|
|
1425
|
+
function oo(e) {
|
|
1426
|
+
let t = (n) => n.type === "TemplateLiteral", r = (n, s) => Oe(n) && !n.computed && n.key.type === "Identifier" && n.key.name === "styles" && s === "value";
|
|
1427
|
+
return e.match(t, (n, s) => q(n) && s === "elements", r, ...fs) || e.match(t, r, ...fs);
|
|
1428
|
+
}
|
|
1429
|
+
function ys(e) {
|
|
1430
|
+
return e.match((t) => t.type === "TemplateLiteral", (t, r) => Oe(t) && !t.computed && t.key.type === "Identifier" && t.key.name === "template" && r === "value", ...fs);
|
|
1431
|
+
}
|
|
1432
|
+
function Ds(e, t) {
|
|
1433
|
+
return T(e, x.Block | x.Leading, ({ value: r }) => r === ` ${t} `);
|
|
1434
|
+
}
|
|
1435
|
+
function rn({ node: e, parent: t }, r) {
|
|
1436
|
+
return Ds(e, r) || Ic(t) && Ds(t, r) || t.type === "ExpressionStatement" && Ds(t, r);
|
|
1437
|
+
}
|
|
1438
|
+
function Ic(e) {
|
|
1439
|
+
return e.type === "AsConstExpression" || e.type === "TSAsExpression" && e.typeAnnotation.type === "TSTypeReference" && e.typeAnnotation.typeName.type === "Identifier" && e.typeAnnotation.typeName.name === "const";
|
|
1440
|
+
}
|
|
1441
|
+
async function ao(e, t, r) {
|
|
1442
|
+
let { node: n } = r, s = "";
|
|
1443
|
+
for (let [p, c] of n.quasis.entries()) {
|
|
1444
|
+
let { raw: y } = c.value;
|
|
1445
|
+
p > 0 && (s += "@prettier-placeholder-" + (p - 1) + "-id"), s += y;
|
|
1446
|
+
}
|
|
1447
|
+
let i = await e(s, { parser: "scss" }), o = zt(r, t), u = Lc(i, o);
|
|
1448
|
+
if (!u) throw new Error("Couldn't insert all the expressions");
|
|
1449
|
+
return ["`", m([E, u]), f, "`"];
|
|
1450
|
+
}
|
|
1451
|
+
function Lc(e, t) {
|
|
1452
|
+
if (!R(t)) return e;
|
|
1453
|
+
let r = 0, n = ft(Qt(e), (s) => typeof s != "string" || !s.includes("@prettier-placeholder") ? s : s.split(/@prettier-placeholder-(\d+)-id/u).map((i, o) => o % 2 === 0 ? qe(i) : (r++, t[i])));
|
|
1454
|
+
return t.length === r ? n : null;
|
|
1455
|
+
}
|
|
1456
|
+
function Oc(e) {
|
|
1457
|
+
return e.match(void 0, (t, r) => r === "quasi" && t.type === "TaggedTemplateExpression" && Pt(t.tag, ["css", "css.global", "css.resolve"])) || e.match(void 0, (t, r) => r === "expression" && t.type === "JSXExpressionContainer", (t, r) => r === "children" && t.type === "JSXElement" && t.openingElement.name.type === "JSXIdentifier" && t.openingElement.name.name === "style" && t.openingElement.attributes.some((n) => n.type === "JSXAttribute" && n.name.type === "JSXIdentifier" && n.name.name === "jsx"));
|
|
1458
|
+
}
|
|
1459
|
+
function nn(e) {
|
|
1460
|
+
return e.type === "Identifier" && e.name === "styled";
|
|
1461
|
+
}
|
|
1462
|
+
function uo(e) {
|
|
1463
|
+
return /^[A-Z]/u.test(e.object.name) && e.property.name === "extend";
|
|
1464
|
+
}
|
|
1465
|
+
function wc({ parent: e }) {
|
|
1466
|
+
if (!e || e.type !== "TaggedTemplateExpression") return false;
|
|
1467
|
+
let t = e.tag.type === "ParenthesizedExpression" ? e.tag.expression : e.tag;
|
|
1468
|
+
switch (t.type) {
|
|
1469
|
+
case "MemberExpression":
|
|
1470
|
+
return nn(t.object) || uo(t);
|
|
1471
|
+
case "CallExpression":
|
|
1472
|
+
return nn(t.callee) || t.callee.type === "MemberExpression" && (t.callee.object.type === "MemberExpression" && (nn(t.callee.object.object) || uo(t.callee.object)) || t.callee.object.type === "CallExpression" && nn(t.callee.object.callee));
|
|
1473
|
+
case "Identifier":
|
|
1474
|
+
return t.name === "css";
|
|
1475
|
+
default:
|
|
1476
|
+
return false;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
function _c({ parent: e, grandparent: t }) {
|
|
1480
|
+
return t?.type === "JSXAttribute" && e.type === "JSXExpressionContainer" && t.name.type === "JSXIdentifier" && t.name.name === "css";
|
|
1481
|
+
}
|
|
1482
|
+
var po = (e) => Oc(e) || wc(e) || _c(e) || oo(e);
|
|
1483
|
+
async function co(e, t, r) {
|
|
1484
|
+
let { node: n } = r, s = n.quasis.length, i = zt(r, t), o = [];
|
|
1485
|
+
for (let u = 0; u < s; u++) {
|
|
1486
|
+
let p = n.quasis[u], c = u === 0, y = u === s - 1, D = p.value.cooked, F = D.split(`
|
|
1487
|
+
`), C = F.length, d = i[u], b = C > 2 && F[0].trim() === "" && F[1].trim() === "", B = C > 2 && F[C - 1].trim() === "" && F[C - 2].trim() === "", O = F.every((g) => /^\s*(?:#[^\n\r]*)?$/u.test(g));
|
|
1488
|
+
if (!y && /#[^\n\r]*$/u.test(F[C - 1])) return null;
|
|
1489
|
+
let h = null;
|
|
1490
|
+
O ? h = Mc(F) : h = await e(D, { parser: "graphql" }), h ? (h = tn(h, false), !c && b && o.push(""), o.push(h), !y && B && o.push("")) : !c && !y && b && o.push(""), d && o.push(d);
|
|
1491
|
+
}
|
|
1492
|
+
return ["`", m([E, L(E, o)]), E, "`"];
|
|
1493
|
+
}
|
|
1494
|
+
function Mc(e) {
|
|
1495
|
+
let t = [], r = false, n = e.map((s) => s.trim());
|
|
1496
|
+
for (let [s, i] of n.entries()) i !== "" && (n[s - 1] === "" && r ? t.push([E, i]) : t.push(i), r = true);
|
|
1497
|
+
return t.length === 0 ? null : L(E, t);
|
|
1498
|
+
}
|
|
1499
|
+
function lo({ node: e, parent: t }) {
|
|
1500
|
+
return rn({ node: e, parent: t }, "GraphQL") || t && (t.type === "TaggedTemplateExpression" && (t.tag.type === "MemberExpression" && t.tag.object.name === "graphql" && t.tag.property.name === "experimental" || t.tag.type === "Identifier" && (t.tag.name === "gql" || t.tag.name === "graphql")) || t.type === "CallExpression" && t.callee.type === "Identifier" && t.callee.name === "graphql");
|
|
1501
|
+
}
|
|
1502
|
+
var Es = 0;
|
|
1503
|
+
async function mo(e, t, r, n, s) {
|
|
1504
|
+
let { node: i } = n, o = Es;
|
|
1505
|
+
Es = Es + 1 >>> 0;
|
|
1506
|
+
let u = (O) => `PRETTIER_HTML_PLACEHOLDER_${O}_${o}_IN_JS`, p = i.quasis.map((O, h, g) => h === g.length - 1 ? O.value.cooked : O.value.cooked + u(h)).join(""), c = zt(n, r), y = new RegExp(u("(\\d+)"), "gu"), D = 0, F = await t(p, { parser: e, __onHtmlRoot(O) {
|
|
1507
|
+
D = O.children.length;
|
|
1508
|
+
} }), C = ft(F, (O) => {
|
|
1509
|
+
if (typeof O != "string") return O;
|
|
1510
|
+
let h = [], g = O.split(y);
|
|
1511
|
+
for (let S = 0; S < g.length; S++) {
|
|
1512
|
+
let j = g[S];
|
|
1513
|
+
if (S % 2 === 0) {
|
|
1514
|
+
j && (j = ms(j), s.__embeddedInHtml && (j = W(0, j, /<\/(?=script\b)/giu, "<\\/")), h.push(j));
|
|
1515
|
+
continue;
|
|
1516
|
+
}
|
|
1517
|
+
let U = Number(j);
|
|
1518
|
+
h.push(c[U]);
|
|
1519
|
+
}
|
|
1520
|
+
return h;
|
|
1521
|
+
}), d = /^\s/u.test(p) ? " " : "", b = /\s$/u.test(p) ? " " : "", B = s.htmlWhitespaceSensitivity === "ignore" ? E : d && b ? A : null;
|
|
1522
|
+
return B ? l(["`", m([B, l(C)]), B, "`"]) : pt({ hug: false }, l(["`", d, D > 1 ? m(l(C)) : l(C), b, "`"]));
|
|
1523
|
+
}
|
|
1524
|
+
function Do(e) {
|
|
1525
|
+
return rn(e, "HTML") || e.match((t) => t.type === "TemplateLiteral", (t, r) => t.type === "TaggedTemplateExpression" && t.tag.type === "Identifier" && t.tag.name === "html" && r === "quasi");
|
|
1526
|
+
}
|
|
1527
|
+
var fo = mo.bind(void 0, "html");
|
|
1528
|
+
var yo = mo.bind(void 0, "angular");
|
|
1529
|
+
async function Eo(e, t, r) {
|
|
1530
|
+
let { node: n } = r, s = W(0, n.quasis[0].value.raw, /((?:\\\\)*)\\`/gu, (p, c) => "\\".repeat(c.length / 2) + "`"), i = Nc(s), o = i !== "";
|
|
1531
|
+
o && (s = W(0, s, new RegExp(`^${i}`, "gmu"), ""));
|
|
1532
|
+
let u = tn(await e(s, { parser: "markdown", __inJsTemplate: true }), true);
|
|
1533
|
+
return ["`", o ? m([f, u]) : [$r, Qi(u)], f, "`"];
|
|
1534
|
+
}
|
|
1535
|
+
function Nc(e) {
|
|
1536
|
+
let t = e.match(/^([^\S\n]*)\S/mu);
|
|
1537
|
+
return t === null ? "" : t[1];
|
|
1538
|
+
}
|
|
1539
|
+
function Fo({ node: e, parent: t }) {
|
|
1540
|
+
return t?.type === "TaggedTemplateExpression" && e.quasis.length === 1 && t.tag.type === "Identifier" && (t.tag.name === "md" || t.tag.name === "markdown");
|
|
1541
|
+
}
|
|
1542
|
+
var jc = [{ test: po, print: ao }, { test: lo, print: co }, { test: Do, print: fo }, { test: ys, print: yo }, { test: Fo, print: Eo }].map(({ test: e, print: t }) => ({ test: e, print: Rc(t) }));
|
|
1543
|
+
function vc(e) {
|
|
1544
|
+
let { node: t } = e;
|
|
1545
|
+
if (t.type !== "TemplateLiteral" || Jc(t)) return;
|
|
1546
|
+
let r = jc.find(({ test: n }) => n(e));
|
|
1547
|
+
if (r) return t.quasis.length === 1 && t.quasis[0].value.raw.trim() === "" ? "``" : r.print;
|
|
1548
|
+
}
|
|
1549
|
+
function Rc(e) {
|
|
1550
|
+
return async (...t) => {
|
|
1551
|
+
let r = await e(...t);
|
|
1552
|
+
return r && pt({ embed: true, ...r.label }, r);
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1555
|
+
function Jc({ quasis: e }) {
|
|
1556
|
+
return e.some(({ value: { cooked: t } }) => t === null);
|
|
1557
|
+
}
|
|
1558
|
+
var Co = vc;
|
|
1559
|
+
var Gc = /\*\/$/;
|
|
1560
|
+
var Wc = /^\/\*\*?/;
|
|
1561
|
+
var go = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
|
|
1562
|
+
var qc = /(^|\s+)\/\/([^\n\r]*)/g;
|
|
1563
|
+
var Ao = /^(\r?\n)+/;
|
|
1564
|
+
var Uc = /(?:^|\r?\n) *(@[^\n\r]*?) *\r?\n *(?![^\n\r@]*\/\/[^]*)([^\s@][^\n\r@]+?) *\r?\n/g;
|
|
1565
|
+
var To = /(?:^|\r?\n) *@(\S+) *([^\n\r]*)/g;
|
|
1566
|
+
var Yc = /(\r?\n|^) *\* ?/g;
|
|
1567
|
+
var ho = [];
|
|
1568
|
+
function So(e) {
|
|
1569
|
+
let t = e.match(go);
|
|
1570
|
+
return t ? t[0].trimStart() : "";
|
|
1571
|
+
}
|
|
1572
|
+
function Bo(e) {
|
|
1573
|
+
let r = e.match(go)?.[0];
|
|
1574
|
+
return r == null ? e : e.slice(r.length);
|
|
1575
|
+
}
|
|
1576
|
+
function bo(e) {
|
|
1577
|
+
e = W(0, e.replace(Wc, "").replace(Gc, ""), Yc, "$1");
|
|
1578
|
+
let r = "";
|
|
1579
|
+
for (; r !== e; ) r = e, e = W(0, e, Uc, `
|
|
1580
|
+
$1 $2
|
|
1581
|
+
`);
|
|
1582
|
+
e = e.replace(Ao, "").trimEnd();
|
|
1583
|
+
let n = /* @__PURE__ */ Object.create(null), s = W(0, e, To, "").replace(Ao, "").trimEnd(), i;
|
|
1584
|
+
for (; i = To.exec(e); ) {
|
|
1585
|
+
let o = W(0, i[2], qc, "");
|
|
1586
|
+
if (typeof n[i[1]] == "string" || Array.isArray(n[i[1]])) {
|
|
1587
|
+
let u = n[i[1]];
|
|
1588
|
+
n[i[1]] = [...ho, ...Array.isArray(u) ? u : [u], o];
|
|
1589
|
+
} else n[i[1]] = o;
|
|
1590
|
+
}
|
|
1591
|
+
return { comments: s, pragmas: n };
|
|
1592
|
+
}
|
|
1593
|
+
function Po({ comments: e = "", pragmas: t = {} }) {
|
|
1594
|
+
let o = Object.keys(t), u = o.flatMap((c) => xo(c, t[c])).map((c) => ` * ${c}
|
|
1595
|
+
`).join("");
|
|
1596
|
+
if (!e) {
|
|
1597
|
+
if (o.length === 0) return "";
|
|
1598
|
+
if (o.length === 1 && !Array.isArray(t[o[0]])) {
|
|
1599
|
+
let c = t[o[0]];
|
|
1600
|
+
return `/** ${xo(o[0], c)[0]} */`;
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
let p = e.split(`
|
|
1604
|
+
`).map((c) => ` * ${c}`).join(`
|
|
1605
|
+
`) + `
|
|
1606
|
+
`;
|
|
1607
|
+
return `/**
|
|
1608
|
+
` + (e ? p : "") + (e && o.length > 0 ? ` *
|
|
1609
|
+
` : "") + u + " */";
|
|
1610
|
+
}
|
|
1611
|
+
function xo(e, t) {
|
|
1612
|
+
return [...ho, ...Array.isArray(t) ? t : [t]].map((r) => `@${e} ${r}`.trim());
|
|
1613
|
+
}
|
|
1614
|
+
var ko = "format";
|
|
1615
|
+
function Hc(e) {
|
|
1616
|
+
if (!e.startsWith("#!")) return "";
|
|
1617
|
+
let t = e.indexOf(`
|
|
1618
|
+
`);
|
|
1619
|
+
return t === -1 ? e : e.slice(0, t);
|
|
1620
|
+
}
|
|
1621
|
+
var Io = Hc;
|
|
1622
|
+
function Xc(e) {
|
|
1623
|
+
let t = Io(e);
|
|
1624
|
+
t && (e = e.slice(t.length + 1));
|
|
1625
|
+
let r = So(e), { pragmas: n, comments: s } = bo(r);
|
|
1626
|
+
return { shebang: t, text: e, pragmas: n, comments: s };
|
|
1627
|
+
}
|
|
1628
|
+
function Lo(e) {
|
|
1629
|
+
let { shebang: t, text: r, pragmas: n, comments: s } = Xc(e), i = Bo(r), o = Po({ pragmas: { [ko]: "", ...n }, comments: s.trimStart() });
|
|
1630
|
+
return (t ? `${t}
|
|
1631
|
+
` : "") + o + (i.startsWith(`
|
|
1632
|
+
`) ? `
|
|
1633
|
+
` : `
|
|
1634
|
+
|
|
1635
|
+
`) + i;
|
|
1636
|
+
}
|
|
1637
|
+
function Vc(e) {
|
|
1638
|
+
if (!ce(e)) return false;
|
|
1639
|
+
let t = `*${e.value}*`.split(`
|
|
1640
|
+
`);
|
|
1641
|
+
return t.length > 1 && t.every((r) => r.trimStart()[0] === "*");
|
|
1642
|
+
}
|
|
1643
|
+
var Fs = /* @__PURE__ */ new WeakMap();
|
|
1644
|
+
function $c(e) {
|
|
1645
|
+
return Fs.has(e) || Fs.set(e, Vc(e)), Fs.get(e);
|
|
1646
|
+
}
|
|
1647
|
+
var Oo = $c;
|
|
1648
|
+
function wo(e, t) {
|
|
1649
|
+
let r = e.node;
|
|
1650
|
+
if (At(r)) return t.originalText.slice(w(r), I(r)).trimEnd();
|
|
1651
|
+
if (Oo(r)) return Kc(r);
|
|
1652
|
+
if (ce(r)) return ["/*", qe(r.value), "*/"];
|
|
1653
|
+
throw new Error("Not a comment: " + JSON.stringify(r));
|
|
1654
|
+
}
|
|
1655
|
+
function Kc(e) {
|
|
1656
|
+
let t = e.value.split(`
|
|
1657
|
+
`);
|
|
1658
|
+
return ["/*", L(E, t.map((r, n) => n === 0 ? r.trimEnd() : " " + (n < t.length - 1 ? r.trim() : r.trimStart()))), "*/"];
|
|
1659
|
+
}
|
|
1660
|
+
function ds(e, t) {
|
|
1661
|
+
if (e.isRoot) return false;
|
|
1662
|
+
let { node: r, key: n, parent: s } = e;
|
|
1663
|
+
if (t.__isInHtmlInterpolation && !t.bracketSpacing && el(r) && xr(e)) return true;
|
|
1664
|
+
if (Qc(r)) return false;
|
|
1665
|
+
if (r.type === "Identifier") {
|
|
1666
|
+
if (r.extra?.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/u.test(r.name) || n === "left" && (r.name === "async" && !s.await || r.name === "let") && s.type === "ForOfStatement") return true;
|
|
1667
|
+
if (r.name === "let") {
|
|
1668
|
+
let i = e.findAncestor((o) => o.type === "ForOfStatement")?.left;
|
|
1669
|
+
if (i && ye(i, (o) => o === r)) return true;
|
|
1670
|
+
}
|
|
1671
|
+
if (n === "object" && r.name === "let" && s.type === "MemberExpression" && s.computed && !s.optional) {
|
|
1672
|
+
let i = e.findAncestor((u) => u.type === "ExpressionStatement" || u.type === "ForStatement" || u.type === "ForInStatement"), o = i ? i.type === "ExpressionStatement" ? i.expression : i.type === "ForStatement" ? i.init : i.left : void 0;
|
|
1673
|
+
if (o && ye(o, (u) => u === r)) return true;
|
|
1674
|
+
}
|
|
1675
|
+
if (n === "expression") switch (r.name) {
|
|
1676
|
+
case "await":
|
|
1677
|
+
case "interface":
|
|
1678
|
+
case "module":
|
|
1679
|
+
case "using":
|
|
1680
|
+
case "yield":
|
|
1681
|
+
case "let":
|
|
1682
|
+
case "component":
|
|
1683
|
+
case "hook":
|
|
1684
|
+
case "type": {
|
|
1685
|
+
let i = e.findAncestor((o) => !Ae(o));
|
|
1686
|
+
if (i !== s && i.type === "ExpressionStatement") return true;
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
return false;
|
|
1690
|
+
}
|
|
1691
|
+
if (r.type === "ObjectExpression" || r.type === "FunctionExpression" || r.type === "ClassExpression" || r.type === "DoExpression") {
|
|
1692
|
+
let i = e.findAncestor((o) => o.type === "ExpressionStatement")?.expression;
|
|
1693
|
+
if (i && ye(i, (o) => o === r)) return true;
|
|
1694
|
+
}
|
|
1695
|
+
if (r.type === "ObjectExpression") {
|
|
1696
|
+
let i = e.findAncestor((o) => o.type === "ArrowFunctionExpression")?.body;
|
|
1697
|
+
if (i && i.type !== "SequenceExpression" && i.type !== "AssignmentExpression" && ye(i, (o) => o === r)) return true;
|
|
1698
|
+
}
|
|
1699
|
+
switch (s.type) {
|
|
1700
|
+
case "ParenthesizedExpression":
|
|
1701
|
+
return false;
|
|
1702
|
+
case "ClassDeclaration":
|
|
1703
|
+
case "ClassExpression":
|
|
1704
|
+
if (n === "superClass" && (r.type === "ArrowFunctionExpression" || r.type === "AssignmentExpression" || r.type === "AwaitExpression" || r.type === "BinaryExpression" || r.type === "ConditionalExpression" || r.type === "LogicalExpression" || r.type === "NewExpression" || r.type === "ObjectExpression" || r.type === "SequenceExpression" || r.type === "TaggedTemplateExpression" || r.type === "UnaryExpression" || r.type === "UpdateExpression" || r.type === "YieldExpression" || r.type === "TSNonNullExpression" || r.type === "ClassExpression" && R(r.decorators))) return true;
|
|
1705
|
+
break;
|
|
1706
|
+
case "ExportDefaultDeclaration":
|
|
1707
|
+
return _o(e, t) || r.type === "SequenceExpression";
|
|
1708
|
+
case "Decorator":
|
|
1709
|
+
if (n === "expression" && !rl(r)) return true;
|
|
1710
|
+
break;
|
|
1711
|
+
case "TypeAnnotation":
|
|
1712
|
+
if (e.match(void 0, void 0, (i, o) => o === "returnType" && i.type === "ArrowFunctionExpression") && Zc(r)) return true;
|
|
1713
|
+
break;
|
|
1714
|
+
case "BinaryExpression":
|
|
1715
|
+
if (n === "left" && (s.operator === "in" || s.operator === "instanceof") && r.type === "UnaryExpression") return true;
|
|
1716
|
+
break;
|
|
1717
|
+
case "VariableDeclarator":
|
|
1718
|
+
if (n === "init" && e.match(void 0, void 0, (i, o) => o === "declarations" && i.type === "VariableDeclaration", (i, o) => o === "left" && i.type === "ForInStatement")) return true;
|
|
1719
|
+
break;
|
|
1720
|
+
}
|
|
1721
|
+
switch (r.type) {
|
|
1722
|
+
case "UpdateExpression":
|
|
1723
|
+
if (s.type === "UnaryExpression") return r.prefix && (r.operator === "++" && s.operator === "+" || r.operator === "--" && s.operator === "-");
|
|
1724
|
+
case "UnaryExpression":
|
|
1725
|
+
switch (s.type) {
|
|
1726
|
+
case "UnaryExpression":
|
|
1727
|
+
return r.operator === s.operator && (r.operator === "+" || r.operator === "-");
|
|
1728
|
+
case "BindExpression":
|
|
1729
|
+
return true;
|
|
1730
|
+
case "MemberExpression":
|
|
1731
|
+
case "OptionalMemberExpression":
|
|
1732
|
+
return n === "object";
|
|
1733
|
+
case "TaggedTemplateExpression":
|
|
1734
|
+
return true;
|
|
1735
|
+
case "NewExpression":
|
|
1736
|
+
case "CallExpression":
|
|
1737
|
+
case "OptionalCallExpression":
|
|
1738
|
+
return n === "callee";
|
|
1739
|
+
case "BinaryExpression":
|
|
1740
|
+
return n === "left" && s.operator === "**";
|
|
1741
|
+
case "TSNonNullExpression":
|
|
1742
|
+
return true;
|
|
1743
|
+
default:
|
|
1744
|
+
return false;
|
|
1745
|
+
}
|
|
1746
|
+
case "BinaryExpression":
|
|
1747
|
+
if (s.type === "UpdateExpression" || r.operator === "in" && zc(e)) return true;
|
|
1748
|
+
if (r.operator === "|>" && r.extra?.parenthesized) {
|
|
1749
|
+
let i = e.grandparent;
|
|
1750
|
+
if (i.type === "BinaryExpression" && i.operator === "|>") return true;
|
|
1751
|
+
}
|
|
1752
|
+
case "TSTypeAssertion":
|
|
1753
|
+
case "TSAsExpression":
|
|
1754
|
+
case "TSSatisfiesExpression":
|
|
1755
|
+
case "AsExpression":
|
|
1756
|
+
case "AsConstExpression":
|
|
1757
|
+
case "SatisfiesExpression":
|
|
1758
|
+
case "LogicalExpression":
|
|
1759
|
+
switch (s.type) {
|
|
1760
|
+
case "TSAsExpression":
|
|
1761
|
+
case "TSSatisfiesExpression":
|
|
1762
|
+
case "AsExpression":
|
|
1763
|
+
case "AsConstExpression":
|
|
1764
|
+
case "SatisfiesExpression":
|
|
1765
|
+
return !Ae(r);
|
|
1766
|
+
case "ConditionalExpression":
|
|
1767
|
+
return Ae(r) || fi(r);
|
|
1768
|
+
case "CallExpression":
|
|
1769
|
+
case "NewExpression":
|
|
1770
|
+
case "OptionalCallExpression":
|
|
1771
|
+
return n === "callee";
|
|
1772
|
+
case "ClassExpression":
|
|
1773
|
+
case "ClassDeclaration":
|
|
1774
|
+
return n === "superClass";
|
|
1775
|
+
case "TSTypeAssertion":
|
|
1776
|
+
case "TaggedTemplateExpression":
|
|
1777
|
+
case "UnaryExpression":
|
|
1778
|
+
case "JSXSpreadAttribute":
|
|
1779
|
+
case "SpreadElement":
|
|
1780
|
+
case "BindExpression":
|
|
1781
|
+
case "AwaitExpression":
|
|
1782
|
+
case "TSNonNullExpression":
|
|
1783
|
+
case "UpdateExpression":
|
|
1784
|
+
return true;
|
|
1785
|
+
case "MemberExpression":
|
|
1786
|
+
case "OptionalMemberExpression":
|
|
1787
|
+
return n === "object";
|
|
1788
|
+
case "AssignmentExpression":
|
|
1789
|
+
case "AssignmentPattern":
|
|
1790
|
+
return n === "left" && (r.type === "TSTypeAssertion" || Ae(r));
|
|
1791
|
+
case "LogicalExpression":
|
|
1792
|
+
if (r.type === "LogicalExpression") return s.operator !== r.operator;
|
|
1793
|
+
case "BinaryExpression": {
|
|
1794
|
+
let { operator: i, type: o } = r;
|
|
1795
|
+
if (!i && o !== "TSTypeAssertion") return true;
|
|
1796
|
+
let u = yr(i), p = s.operator, c = yr(p);
|
|
1797
|
+
return !!(c > u || n === "right" && c === u || c === u && !dr(p, i) || c < u && i === "%" && (p === "+" || p === "-") || Ai(p));
|
|
1798
|
+
}
|
|
1799
|
+
default:
|
|
1800
|
+
return false;
|
|
1801
|
+
}
|
|
1802
|
+
case "SequenceExpression":
|
|
1803
|
+
return s.type !== "ForStatement";
|
|
1804
|
+
case "YieldExpression":
|
|
1805
|
+
if (s.type === "AwaitExpression" || s.type === "TSTypeAssertion") return true;
|
|
1806
|
+
case "AwaitExpression":
|
|
1807
|
+
switch (s.type) {
|
|
1808
|
+
case "TaggedTemplateExpression":
|
|
1809
|
+
case "UnaryExpression":
|
|
1810
|
+
case "LogicalExpression":
|
|
1811
|
+
case "SpreadElement":
|
|
1812
|
+
case "TSAsExpression":
|
|
1813
|
+
case "TSSatisfiesExpression":
|
|
1814
|
+
case "TSNonNullExpression":
|
|
1815
|
+
case "AsExpression":
|
|
1816
|
+
case "AsConstExpression":
|
|
1817
|
+
case "SatisfiesExpression":
|
|
1818
|
+
case "BindExpression":
|
|
1819
|
+
return true;
|
|
1820
|
+
case "MemberExpression":
|
|
1821
|
+
case "OptionalMemberExpression":
|
|
1822
|
+
return n === "object";
|
|
1823
|
+
case "NewExpression":
|
|
1824
|
+
case "CallExpression":
|
|
1825
|
+
case "OptionalCallExpression":
|
|
1826
|
+
return n === "callee";
|
|
1827
|
+
case "ConditionalExpression":
|
|
1828
|
+
return n === "test";
|
|
1829
|
+
case "BinaryExpression":
|
|
1830
|
+
return !(!r.argument && s.operator === "|>");
|
|
1831
|
+
default:
|
|
1832
|
+
return false;
|
|
1833
|
+
}
|
|
1834
|
+
case "TSFunctionType":
|
|
1835
|
+
if (e.match((i) => i.type === "TSFunctionType", (i, o) => o === "typeAnnotation" && i.type === "TSTypeAnnotation", (i, o) => o === "returnType" && i.type === "ArrowFunctionExpression")) return true;
|
|
1836
|
+
case "TSConditionalType":
|
|
1837
|
+
case "TSConstructorType":
|
|
1838
|
+
case "ConditionalTypeAnnotation":
|
|
1839
|
+
if (n === "extendsType" && Ue(r) && s.type === r.type || n === "checkType" && Ue(s)) return true;
|
|
1840
|
+
if (n === "extendsType" && s.type === "TSConditionalType") {
|
|
1841
|
+
let { typeAnnotation: i } = r.returnType || r.typeAnnotation;
|
|
1842
|
+
if (i.type === "TSTypePredicate" && i.typeAnnotation && (i = i.typeAnnotation.typeAnnotation), i.type === "TSInferType" && i.typeParameter.constraint) return true;
|
|
1843
|
+
}
|
|
1844
|
+
case "TSUnionType":
|
|
1845
|
+
case "TSIntersectionType":
|
|
1846
|
+
if (Se(s) || xt(s)) return true;
|
|
1847
|
+
case "TSInferType":
|
|
1848
|
+
if (r.type === "TSInferType") {
|
|
1849
|
+
if (s.type === "TSRestType") return false;
|
|
1850
|
+
if (n === "types" && (s.type === "TSUnionType" || s.type === "TSIntersectionType") && r.typeParameter.type === "TSTypeParameter" && r.typeParameter.constraint) return true;
|
|
1851
|
+
}
|
|
1852
|
+
case "TSTypeOperator":
|
|
1853
|
+
return s.type === "TSArrayType" || s.type === "TSOptionalType" || s.type === "TSRestType" || n === "objectType" && s.type === "TSIndexedAccessType" || s.type === "TSTypeOperator" || s.type === "TSTypeAnnotation" && e.grandparent.type.startsWith("TSJSDoc");
|
|
1854
|
+
case "TSTypeQuery":
|
|
1855
|
+
return n === "objectType" && s.type === "TSIndexedAccessType" || n === "elementType" && s.type === "TSArrayType";
|
|
1856
|
+
case "TypeOperator":
|
|
1857
|
+
return s.type === "ArrayTypeAnnotation" || s.type === "NullableTypeAnnotation" || n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType") || s.type === "TypeOperator";
|
|
1858
|
+
case "TypeofTypeAnnotation":
|
|
1859
|
+
return n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType") || n === "elementType" && s.type === "ArrayTypeAnnotation";
|
|
1860
|
+
case "ArrayTypeAnnotation":
|
|
1861
|
+
return s.type === "NullableTypeAnnotation";
|
|
1862
|
+
case "IntersectionTypeAnnotation":
|
|
1863
|
+
case "UnionTypeAnnotation":
|
|
1864
|
+
return s.type === "TypeOperator" || s.type === "KeyofTypeAnnotation" || s.type === "ArrayTypeAnnotation" || s.type === "NullableTypeAnnotation" || s.type === "IntersectionTypeAnnotation" || s.type === "UnionTypeAnnotation" || n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType");
|
|
1865
|
+
case "InferTypeAnnotation":
|
|
1866
|
+
case "NullableTypeAnnotation":
|
|
1867
|
+
return s.type === "ArrayTypeAnnotation" || n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType");
|
|
1868
|
+
case "ComponentTypeAnnotation":
|
|
1869
|
+
case "FunctionTypeAnnotation": {
|
|
1870
|
+
if (r.type === "ComponentTypeAnnotation" && (r.rendersType === null || r.rendersType === void 0)) return false;
|
|
1871
|
+
if (e.match(void 0, (o, u) => u === "typeAnnotation" && o.type === "TypeAnnotation", (o, u) => u === "returnType" && o.type === "ArrowFunctionExpression") || e.match(void 0, (o, u) => u === "typeAnnotation" && o.type === "TypePredicate", (o, u) => u === "typeAnnotation" && o.type === "TypeAnnotation", (o, u) => u === "returnType" && o.type === "ArrowFunctionExpression")) return true;
|
|
1872
|
+
let i = s.type === "NullableTypeAnnotation" ? e.grandparent : s;
|
|
1873
|
+
return i.type === "UnionTypeAnnotation" || i.type === "IntersectionTypeAnnotation" || i.type === "ArrayTypeAnnotation" || n === "objectType" && (i.type === "IndexedAccessType" || i.type === "OptionalIndexedAccessType") || n === "checkType" && s.type === "ConditionalTypeAnnotation" || n === "extendsType" && s.type === "ConditionalTypeAnnotation" && r.returnType?.type === "InferTypeAnnotation" && r.returnType?.typeParameter.bound || i.type === "NullableTypeAnnotation" || s.type === "FunctionTypeParam" && s.name === null && K(r).some((o) => o.typeAnnotation?.type === "NullableTypeAnnotation");
|
|
1874
|
+
}
|
|
1875
|
+
case "OptionalIndexedAccessType":
|
|
1876
|
+
return n === "objectType" && s.type === "IndexedAccessType";
|
|
1877
|
+
case "StringLiteral":
|
|
1878
|
+
case "NumericLiteral":
|
|
1879
|
+
case "Literal":
|
|
1880
|
+
if (typeof r.value == "string" && s.type === "ExpressionStatement" && typeof s.directive != "string") {
|
|
1881
|
+
let i = e.grandparent;
|
|
1882
|
+
return i.type === "Program" || i.type === "BlockStatement";
|
|
1883
|
+
}
|
|
1884
|
+
return n === "object" && J(s) && Ce(r);
|
|
1885
|
+
case "AssignmentExpression":
|
|
1886
|
+
return !((n === "init" || n === "update") && s.type === "ForStatement" || n === "expression" && r.left.type !== "ObjectPattern" && s.type === "ExpressionStatement" || n === "key" && s.type === "TSPropertySignature" || s.type === "AssignmentExpression" || n === "expressions" && s.type === "SequenceExpression" && e.match(void 0, void 0, (i, o) => (o === "init" || o === "update") && i.type === "ForStatement") || n === "value" && s.type === "Property" && e.match(void 0, void 0, (i, o) => o === "properties" && i.type === "ObjectPattern") || s.type === "NGChainedExpression" || n === "node" && s.type === "JsExpressionRoot");
|
|
1887
|
+
case "ConditionalExpression":
|
|
1888
|
+
switch (s.type) {
|
|
1889
|
+
case "TaggedTemplateExpression":
|
|
1890
|
+
case "UnaryExpression":
|
|
1891
|
+
case "SpreadElement":
|
|
1892
|
+
case "BinaryExpression":
|
|
1893
|
+
case "LogicalExpression":
|
|
1894
|
+
case "NGPipeExpression":
|
|
1895
|
+
case "ExportDefaultDeclaration":
|
|
1896
|
+
case "AwaitExpression":
|
|
1897
|
+
case "JSXSpreadAttribute":
|
|
1898
|
+
case "TSTypeAssertion":
|
|
1899
|
+
case "TypeCastExpression":
|
|
1900
|
+
case "TSAsExpression":
|
|
1901
|
+
case "TSSatisfiesExpression":
|
|
1902
|
+
case "AsExpression":
|
|
1903
|
+
case "AsConstExpression":
|
|
1904
|
+
case "SatisfiesExpression":
|
|
1905
|
+
case "TSNonNullExpression":
|
|
1906
|
+
return true;
|
|
1907
|
+
case "NewExpression":
|
|
1908
|
+
case "CallExpression":
|
|
1909
|
+
case "OptionalCallExpression":
|
|
1910
|
+
return n === "callee";
|
|
1911
|
+
case "ConditionalExpression":
|
|
1912
|
+
return t.experimentalTernaries ? false : n === "test";
|
|
1913
|
+
case "MemberExpression":
|
|
1914
|
+
case "OptionalMemberExpression":
|
|
1915
|
+
return n === "object";
|
|
1916
|
+
default:
|
|
1917
|
+
return false;
|
|
1918
|
+
}
|
|
1919
|
+
case "FunctionExpression":
|
|
1920
|
+
switch (s.type) {
|
|
1921
|
+
case "NewExpression":
|
|
1922
|
+
case "CallExpression":
|
|
1923
|
+
case "OptionalCallExpression":
|
|
1924
|
+
return n === "callee";
|
|
1925
|
+
case "TaggedTemplateExpression":
|
|
1926
|
+
return true;
|
|
1927
|
+
default:
|
|
1928
|
+
return false;
|
|
1929
|
+
}
|
|
1930
|
+
case "ArrowFunctionExpression":
|
|
1931
|
+
switch (s.type) {
|
|
1932
|
+
case "BinaryExpression":
|
|
1933
|
+
return s.operator !== "|>" || r.extra?.parenthesized;
|
|
1934
|
+
case "NewExpression":
|
|
1935
|
+
case "CallExpression":
|
|
1936
|
+
case "OptionalCallExpression":
|
|
1937
|
+
return n === "callee";
|
|
1938
|
+
case "MemberExpression":
|
|
1939
|
+
case "OptionalMemberExpression":
|
|
1940
|
+
return n === "object";
|
|
1941
|
+
case "TSAsExpression":
|
|
1942
|
+
case "TSSatisfiesExpression":
|
|
1943
|
+
case "AsExpression":
|
|
1944
|
+
case "AsConstExpression":
|
|
1945
|
+
case "SatisfiesExpression":
|
|
1946
|
+
case "TSNonNullExpression":
|
|
1947
|
+
case "BindExpression":
|
|
1948
|
+
case "TaggedTemplateExpression":
|
|
1949
|
+
case "UnaryExpression":
|
|
1950
|
+
case "LogicalExpression":
|
|
1951
|
+
case "AwaitExpression":
|
|
1952
|
+
case "TSTypeAssertion":
|
|
1953
|
+
case "MatchExpressionCase":
|
|
1954
|
+
return true;
|
|
1955
|
+
case "TSInstantiationExpression":
|
|
1956
|
+
return n === "expression";
|
|
1957
|
+
case "ConditionalExpression":
|
|
1958
|
+
return n === "test";
|
|
1959
|
+
default:
|
|
1960
|
+
return false;
|
|
1961
|
+
}
|
|
1962
|
+
case "ClassExpression":
|
|
1963
|
+
switch (s.type) {
|
|
1964
|
+
case "NewExpression":
|
|
1965
|
+
return n === "callee";
|
|
1966
|
+
default:
|
|
1967
|
+
return false;
|
|
1968
|
+
}
|
|
1969
|
+
case "OptionalMemberExpression":
|
|
1970
|
+
case "OptionalCallExpression":
|
|
1971
|
+
case "CallExpression":
|
|
1972
|
+
case "MemberExpression":
|
|
1973
|
+
if (tl(e)) return true;
|
|
1974
|
+
case "TaggedTemplateExpression":
|
|
1975
|
+
case "TSNonNullExpression":
|
|
1976
|
+
if (n === "callee" && (s.type === "BindExpression" || s.type === "NewExpression")) {
|
|
1977
|
+
let i = r;
|
|
1978
|
+
for (; i; ) switch (i.type) {
|
|
1979
|
+
case "CallExpression":
|
|
1980
|
+
case "OptionalCallExpression":
|
|
1981
|
+
return true;
|
|
1982
|
+
case "MemberExpression":
|
|
1983
|
+
case "OptionalMemberExpression":
|
|
1984
|
+
case "BindExpression":
|
|
1985
|
+
i = i.object;
|
|
1986
|
+
break;
|
|
1987
|
+
case "TaggedTemplateExpression":
|
|
1988
|
+
i = i.tag;
|
|
1989
|
+
break;
|
|
1990
|
+
case "TSNonNullExpression":
|
|
1991
|
+
i = i.expression;
|
|
1992
|
+
break;
|
|
1993
|
+
default:
|
|
1994
|
+
return false;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
return false;
|
|
1998
|
+
case "BindExpression":
|
|
1999
|
+
return n === "callee" && (s.type === "BindExpression" || s.type === "NewExpression") || n === "object" && J(s);
|
|
2000
|
+
case "NGPipeExpression":
|
|
2001
|
+
return !(s.type === "NGRoot" || s.type === "NGMicrosyntaxExpression" || s.type === "ObjectProperty" && !r.extra?.parenthesized || q(s) || n === "arguments" && M(s) || n === "right" && s.type === "NGPipeExpression" || n === "property" && s.type === "MemberExpression" || s.type === "AssignmentExpression");
|
|
2002
|
+
case "JSXFragment":
|
|
2003
|
+
case "JSXElement":
|
|
2004
|
+
return n === "callee" || n === "left" && s.type === "BinaryExpression" && s.operator === "<" || !q(s) && s.type !== "ArrowFunctionExpression" && s.type !== "AssignmentExpression" && s.type !== "AssignmentPattern" && s.type !== "BinaryExpression" && s.type !== "NewExpression" && s.type !== "ConditionalExpression" && s.type !== "ExpressionStatement" && s.type !== "JsExpressionRoot" && s.type !== "JSXAttribute" && s.type !== "JSXElement" && s.type !== "JSXExpressionContainer" && s.type !== "JSXFragment" && s.type !== "LogicalExpression" && !M(s) && !Oe(s) && s.type !== "ReturnStatement" && s.type !== "ThrowStatement" && s.type !== "TypeCastExpression" && s.type !== "VariableDeclarator" && s.type !== "YieldExpression" && s.type !== "MatchExpressionCase";
|
|
2005
|
+
case "TSInstantiationExpression":
|
|
2006
|
+
return n === "object" && J(s);
|
|
2007
|
+
case "MatchOrPattern":
|
|
2008
|
+
return s.type === "MatchAsPattern";
|
|
2009
|
+
}
|
|
2010
|
+
return false;
|
|
2011
|
+
}
|
|
2012
|
+
var Qc = k(["BlockStatement", "BreakStatement", "ComponentDeclaration", "ClassBody", "ClassDeclaration", "ClassMethod", "ClassProperty", "PropertyDefinition", "ClassPrivateProperty", "ContinueStatement", "DebuggerStatement", "DeclareComponent", "DeclareClass", "DeclareExportAllDeclaration", "DeclareExportDeclaration", "DeclareFunction", "DeclareHook", "DeclareInterface", "DeclareModule", "DeclareModuleExports", "DeclareNamespace", "DeclareVariable", "DeclareEnum", "DoWhileStatement", "EnumDeclaration", "ExportAllDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExpressionStatement", "ForInStatement", "ForOfStatement", "ForStatement", "FunctionDeclaration", "HookDeclaration", "IfStatement", "ImportDeclaration", "InterfaceDeclaration", "LabeledStatement", "MethodDefinition", "ReturnStatement", "SwitchStatement", "ThrowStatement", "TryStatement", "TSDeclareFunction", "TSEnumDeclaration", "TSImportEqualsDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSNamespaceExportDeclaration", "TypeAlias", "VariableDeclaration", "WhileStatement", "WithStatement"]);
|
|
2013
|
+
function zc(e) {
|
|
2014
|
+
let t = 0, { node: r } = e;
|
|
2015
|
+
for (; r; ) {
|
|
2016
|
+
let n = e.getParentNode(t++);
|
|
2017
|
+
if (n?.type === "ForStatement" && n.init === r) return true;
|
|
2018
|
+
r = n;
|
|
2019
|
+
}
|
|
2020
|
+
return false;
|
|
2021
|
+
}
|
|
2022
|
+
function Zc(e) {
|
|
2023
|
+
return Er(e, (t) => t.type === "ObjectTypeAnnotation" && Er(t, (r) => r.type === "FunctionTypeAnnotation"));
|
|
2024
|
+
}
|
|
2025
|
+
function el(e) {
|
|
2026
|
+
return se(e);
|
|
2027
|
+
}
|
|
2028
|
+
function xr(e) {
|
|
2029
|
+
let { parent: t, key: r } = e;
|
|
2030
|
+
switch (t.type) {
|
|
2031
|
+
case "NGPipeExpression":
|
|
2032
|
+
if (r === "arguments" && e.isLast) return e.callParent(xr);
|
|
2033
|
+
break;
|
|
2034
|
+
case "ObjectProperty":
|
|
2035
|
+
if (r === "value") return e.callParent(() => e.key === "properties" && e.isLast);
|
|
2036
|
+
break;
|
|
2037
|
+
case "BinaryExpression":
|
|
2038
|
+
case "LogicalExpression":
|
|
2039
|
+
if (r === "right") return e.callParent(xr);
|
|
2040
|
+
break;
|
|
2041
|
+
case "ConditionalExpression":
|
|
2042
|
+
if (r === "alternate") return e.callParent(xr);
|
|
2043
|
+
break;
|
|
2044
|
+
case "UnaryExpression":
|
|
2045
|
+
if (t.prefix) return e.callParent(xr);
|
|
2046
|
+
break;
|
|
2047
|
+
}
|
|
2048
|
+
return false;
|
|
2049
|
+
}
|
|
2050
|
+
function _o(e, t) {
|
|
2051
|
+
let { node: r, parent: n } = e;
|
|
2052
|
+
return r.type === "FunctionExpression" || r.type === "ClassExpression" ? n.type === "ExportDefaultDeclaration" || !ds(e, t) : !Xt(r) || n.type !== "ExportDefaultDeclaration" && ds(e, t) ? false : e.call(() => _o(e, t), ...Rr(r));
|
|
2053
|
+
}
|
|
2054
|
+
function tl(e) {
|
|
2055
|
+
return !!(e.match(void 0, (t, r) => r === "expression" && t.type === "ChainExpression", (t, r) => r === "tag" && t.type === "TaggedTemplateExpression") || e.match((t) => t.type === "OptionalCallExpression" || t.type === "OptionalMemberExpression", (t, r) => r === "tag" && t.type === "TaggedTemplateExpression") || e.match((t) => t.type === "OptionalCallExpression" || t.type === "OptionalMemberExpression", (t, r) => r === "expression" && t.type === "TSNonNullExpression", (t, r) => r === "tag" && t.type === "TaggedTemplateExpression") || e.match(void 0, (t, r) => r === "expression" && t.type === "ChainExpression", (t, r) => r === "expression" && t.type === "TSNonNullExpression", (t, r) => r === "tag" && t.type === "TaggedTemplateExpression") || e.match(void 0, (t, r) => r === "expression" && t.type === "TSNonNullExpression", (t, r) => r === "expression" && t.type === "ChainExpression", (t, r) => r === "tag" && t.type === "TaggedTemplateExpression") || e.match((t) => t.type === "OptionalMemberExpression" || t.type === "OptionalCallExpression", (t, r) => r === "object" && t.type === "MemberExpression" || r === "callee" && (t.type === "CallExpression" || t.type === "NewExpression")) || e.match((t) => t.type === "OptionalMemberExpression" || t.type === "OptionalCallExpression", (t, r) => r === "expression" && t.type === "TSNonNullExpression", (t, r) => r === "object" && t.type === "MemberExpression" || r === "callee" && t.type === "CallExpression") || e.match((t) => t.type === "CallExpression" || t.type === "MemberExpression", (t, r) => r === "expression" && t.type === "ChainExpression") && (e.match(void 0, void 0, (t, r) => r === "callee" && (t.type === "CallExpression" && !t.optional || t.type === "NewExpression") || r === "object" && t.type === "MemberExpression" && !t.optional) || e.match(void 0, void 0, (t, r) => r === "expression" && t.type === "TSNonNullExpression", (t, r) => r === "object" && t.type === "MemberExpression" || r === "callee" && t.type === "CallExpression")) || e.match((t) => t.type === "CallExpression" || t.type === "MemberExpression", (t, r) => r === "expression" && t.type === "TSNonNullExpression", (t, r) => r === "expression" && t.type === "ChainExpression", (t, r) => r === "object" && t.type === "MemberExpression" || r === "callee" && t.type === "CallExpression"));
|
|
2056
|
+
}
|
|
2057
|
+
function Cs(e) {
|
|
2058
|
+
return e.type === "Identifier" ? true : J(e) ? !e.computed && !e.optional && e.property.type === "Identifier" && Cs(e.object) : false;
|
|
2059
|
+
}
|
|
2060
|
+
function rl(e) {
|
|
2061
|
+
return e.type === "ChainExpression" && (e = e.expression), Cs(e) || M(e) && !e.optional && Cs(e.callee);
|
|
2062
|
+
}
|
|
2063
|
+
var ge = ds;
|
|
2064
|
+
function nl(e, t) {
|
|
2065
|
+
let r = t - 1;
|
|
2066
|
+
r = ze(e, r, { backwards: true }), r = Ze(e, r, { backwards: true }), r = ze(e, r, { backwards: true });
|
|
2067
|
+
let n = Ze(e, r, { backwards: true });
|
|
2068
|
+
return r !== n;
|
|
2069
|
+
}
|
|
2070
|
+
var Mo = nl;
|
|
2071
|
+
var sl = () => true;
|
|
2072
|
+
function As(e, t) {
|
|
2073
|
+
let r = e.node;
|
|
2074
|
+
return r.printed = true, t.printer.printComment(e, t);
|
|
2075
|
+
}
|
|
2076
|
+
function il(e, t) {
|
|
2077
|
+
let r = e.node, n = [As(e, t)], { printer: s, originalText: i, locStart: o, locEnd: u } = t;
|
|
2078
|
+
if (s.isBlockComment?.(r)) {
|
|
2079
|
+
let y = Z(i, u(r)) ? Z(i, o(r), { backwards: true }) ? E : A : " ";
|
|
2080
|
+
n.push(y);
|
|
2081
|
+
} else n.push(E);
|
|
2082
|
+
let c = Ze(i, ze(i, u(r)));
|
|
2083
|
+
return c !== false && Z(i, c) && n.push(E), n;
|
|
2084
|
+
}
|
|
2085
|
+
function ol(e, t, r) {
|
|
2086
|
+
let n = e.node, s = As(e, t), { printer: i, originalText: o, locStart: u } = t, p = i.isBlockComment?.(n);
|
|
2087
|
+
if (r?.hasLineSuffix && !r?.isBlock || Z(o, u(n), { backwards: true })) {
|
|
2088
|
+
let c = Mo(o, u(n));
|
|
2089
|
+
return { doc: us([E, c ? E : "", s]), isBlock: p, hasLineSuffix: true };
|
|
2090
|
+
}
|
|
2091
|
+
return !p || r?.hasLineSuffix ? { doc: [us([" ", s]), ke], isBlock: p, hasLineSuffix: true } : { doc: [" ", s], isBlock: p, hasLineSuffix: false };
|
|
2092
|
+
}
|
|
2093
|
+
function v(e, t, r = {}) {
|
|
2094
|
+
let { node: n } = e;
|
|
2095
|
+
if (!R(n?.comments)) return "";
|
|
2096
|
+
let { indent: s = false, marker: i, filter: o = sl } = r, u = [];
|
|
2097
|
+
if (e.each(({ node: c }) => {
|
|
2098
|
+
c.leading || c.trailing || c.marker !== i || !o(c) || u.push(As(e, t));
|
|
2099
|
+
}, "comments"), u.length === 0) return "";
|
|
2100
|
+
let p = L(E, u);
|
|
2101
|
+
return s ? m([E, p]) : p;
|
|
2102
|
+
}
|
|
2103
|
+
function Mt(e, t) {
|
|
2104
|
+
let r = e.node;
|
|
2105
|
+
if (!r) return {};
|
|
2106
|
+
let n = t[/* @__PURE__ */ Symbol.for("printedComments")];
|
|
2107
|
+
if ((r.comments || []).filter((p) => !n.has(p)).length === 0) return { leading: "", trailing: "" };
|
|
2108
|
+
let i = [], o = [], u;
|
|
2109
|
+
return e.each(() => {
|
|
2110
|
+
let p = e.node;
|
|
2111
|
+
if (n?.has(p)) return;
|
|
2112
|
+
let { leading: c, trailing: y } = p;
|
|
2113
|
+
c ? i.push(il(e, t)) : y && (u = ol(e, t, u), o.push(u.doc));
|
|
2114
|
+
}, "comments"), { leading: i, trailing: o };
|
|
2115
|
+
}
|
|
2116
|
+
function De(e, t, r) {
|
|
2117
|
+
let { leading: n, trailing: s } = Mt(e, r);
|
|
2118
|
+
return !n && !s ? t : Ar(t, (i) => [n, i, s]);
|
|
2119
|
+
}
|
|
2120
|
+
var Et = class extends Error {
|
|
2121
|
+
name = "ArgExpansionBailout";
|
|
2122
|
+
};
|
|
2123
|
+
function Ke(e, t, r, n, s) {
|
|
2124
|
+
let i = e.node, o = K(i), u = s && i.typeParameters ? r("typeParameters") : "";
|
|
2125
|
+
if (o.length === 0) return [u, "(", v(e, t, { filter: (d) => _e(t.originalText, I(d)) === ")" }), ")"];
|
|
2126
|
+
let { parent: p } = e, c = It(p), y = No(i), D = [];
|
|
2127
|
+
if (xi(e, (d, b) => {
|
|
2128
|
+
let B = b === o.length - 1;
|
|
2129
|
+
B && i.rest && D.push("..."), D.push(r()), !B && (D.push(","), c || y ? D.push(" ") : oe(o[b], t) ? D.push(E, E) : D.push(A));
|
|
2130
|
+
}), n && !al(e)) {
|
|
2131
|
+
if (ne(u) || ne(D)) throw new Et();
|
|
2132
|
+
return l([_t(u), "(", _t(D), ")"]);
|
|
2133
|
+
}
|
|
2134
|
+
let F = o.every((d) => !R(d.decorators));
|
|
2135
|
+
return y && F ? [u, "(", ...D, ")"] : c ? [u, "(", ...D, ")"] : (Gr(p) || Ei(p) || p.type === "TypeAlias" || p.type === "UnionTypeAnnotation" || p.type === "IntersectionTypeAnnotation" || p.type === "FunctionTypeAnnotation" && p.returnType === i) && o.length === 1 && o[0].name === null && i.this !== o[0] && o[0].typeAnnotation && i.typeParameters === null && Vt(o[0].typeAnnotation) && !i.rest ? t.arrowParens === "always" || i.type === "HookTypeAnnotation" ? ["(", ...D, ")"] : D : [u, "(", m([f, ...D]), P(!Ti(i) && ie(t, "all") ? "," : ""), f, ")"];
|
|
2136
|
+
}
|
|
2137
|
+
function No(e) {
|
|
2138
|
+
if (!e) return false;
|
|
2139
|
+
let t = K(e);
|
|
2140
|
+
if (t.length !== 1) return false;
|
|
2141
|
+
let [r] = t;
|
|
2142
|
+
return !T(r) && (r.type === "ObjectPattern" || r.type === "ArrayPattern" || r.type === "Identifier" && r.typeAnnotation && (r.typeAnnotation.type === "TypeAnnotation" || r.typeAnnotation.type === "TSTypeAnnotation") && Je(r.typeAnnotation.typeAnnotation) || r.type === "FunctionTypeParam" && Je(r.typeAnnotation) && r !== e.rest || r.type === "AssignmentPattern" && (r.left.type === "ObjectPattern" || r.left.type === "ArrayPattern") && (r.right.type === "Identifier" || se(r.right) && r.right.properties.length === 0 || q(r.right) && r.right.elements.length === 0));
|
|
2143
|
+
}
|
|
2144
|
+
function ul(e) {
|
|
2145
|
+
let t;
|
|
2146
|
+
return e.returnType ? (t = e.returnType, t.typeAnnotation && (t = t.typeAnnotation)) : e.typeAnnotation && (t = e.typeAnnotation), t;
|
|
2147
|
+
}
|
|
2148
|
+
function lt(e, t) {
|
|
2149
|
+
let r = ul(e);
|
|
2150
|
+
if (!r) return false;
|
|
2151
|
+
let n = e.typeParameters?.params;
|
|
2152
|
+
if (n) {
|
|
2153
|
+
if (n.length > 1) return false;
|
|
2154
|
+
if (n.length === 1) {
|
|
2155
|
+
let s = n[0];
|
|
2156
|
+
if (s.constraint || s.default) return false;
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
return K(e).length === 1 && (Je(r) || ne(t));
|
|
2160
|
+
}
|
|
2161
|
+
function al(e) {
|
|
2162
|
+
return e.match((t) => t.type === "ArrowFunctionExpression" && t.body.type === "BlockStatement", (t, r) => {
|
|
2163
|
+
if (t.type === "CallExpression" && r === "arguments" && t.arguments.length === 1 && t.callee.type === "CallExpression") {
|
|
2164
|
+
let n = t.callee.callee;
|
|
2165
|
+
return n.type === "Identifier" || n.type === "MemberExpression" && !n.computed && n.object.type === "Identifier" && n.property.type === "Identifier";
|
|
2166
|
+
}
|
|
2167
|
+
return false;
|
|
2168
|
+
}, (t, r) => t.type === "VariableDeclarator" && r === "init" || t.type === "ExportDefaultDeclaration" && r === "declaration" || t.type === "TSExportAssignment" && r === "expression" || t.type === "AssignmentExpression" && r === "right" && t.left.type === "MemberExpression" && t.left.object.type === "Identifier" && t.left.object.name === "module" && t.left.property.type === "Identifier" && t.left.property.name === "exports", (t) => t.type !== "VariableDeclaration" || t.kind === "const" && t.declarations.length === 1);
|
|
2169
|
+
}
|
|
2170
|
+
function jo(e) {
|
|
2171
|
+
let t = K(e);
|
|
2172
|
+
return t.length > 1 && t.some((r) => r.type === "TSParameterProperty");
|
|
2173
|
+
}
|
|
2174
|
+
function Nt(e, t) {
|
|
2175
|
+
return (t === "params" || t === "this" || t === "rest") && No(e);
|
|
2176
|
+
}
|
|
2177
|
+
function X(e) {
|
|
2178
|
+
let { node: t } = e;
|
|
2179
|
+
return !t.optional || t.type === "Identifier" && t === e.parent.key ? "" : M(t) || J(t) && t.computed || t.type === "OptionalIndexedAccessType" ? "?." : "?";
|
|
2180
|
+
}
|
|
2181
|
+
function sn(e) {
|
|
2182
|
+
return e.node.definite || e.match(void 0, (t, r) => r === "id" && t.type === "VariableDeclarator" && t.definite) ? "!" : "";
|
|
2183
|
+
}
|
|
2184
|
+
var pl = k(["DeclareClass", "DeclareComponent", "DeclareFunction", "DeclareHook", "DeclareVariable", "DeclareExportDeclaration", "DeclareExportAllDeclaration", "DeclareOpaqueType", "DeclareTypeAlias", "DeclareEnum", "DeclareInterface"]);
|
|
2185
|
+
function Q(e) {
|
|
2186
|
+
let { node: t } = e;
|
|
2187
|
+
return t.declare || pl(t) && e.parent.type !== "DeclareExportDeclaration" ? "declare " : "";
|
|
2188
|
+
}
|
|
2189
|
+
var cl = k(["TSAbstractMethodDefinition", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]);
|
|
2190
|
+
function Zt({ node: e }) {
|
|
2191
|
+
return e.abstract || cl(e) ? "abstract " : "";
|
|
2192
|
+
}
|
|
2193
|
+
function Ft(e, t, r) {
|
|
2194
|
+
return e.type === "EmptyStatement" ? T(e, x.Leading) ? [" ", t] : t : e.type === "BlockStatement" || r ? [" ", t] : m([A, t]);
|
|
2195
|
+
}
|
|
2196
|
+
function jt(e) {
|
|
2197
|
+
return e.accessibility ? e.accessibility + " " : "";
|
|
2198
|
+
}
|
|
2199
|
+
var ll = /^[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC][\$0-9A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]*$/;
|
|
2200
|
+
var ml = (e) => ll.test(e);
|
|
2201
|
+
var vo = ml;
|
|
2202
|
+
function Dl(e) {
|
|
2203
|
+
return e.length === 1 ? e : e.toLowerCase().replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(?=\d)/u, "$1$2").replace(/^([+-]?[\d.]+)e[+-]?0+$/u, "$1").replace(/^([+-])?\./u, "$10.").replace(/(\.\d+?)0+(?=e|$)/u, "$1").replace(/\.(?=e|$)/u, "");
|
|
2204
|
+
}
|
|
2205
|
+
var dt = Dl;
|
|
2206
|
+
var fl = 0;
|
|
2207
|
+
function on(e, t, r) {
|
|
2208
|
+
let { node: n, parent: s, grandparent: i, key: o } = e, u = o !== "body" && (s.type === "IfStatement" || s.type === "WhileStatement" || s.type === "SwitchStatement" || s.type === "DoWhileStatement"), p = n.operator === "|>" && e.root.extra?.__isUsingHackPipeline, c = Ts(e, t, r, false, u);
|
|
2209
|
+
if (u) return c;
|
|
2210
|
+
if (p) return l(c);
|
|
2211
|
+
if (o === "callee" && (M(s) || s.type === "NewExpression") || s.type === "UnaryExpression" || J(s) && !s.computed) return l([m([f, ...c]), f]);
|
|
2212
|
+
let y = s.type === "ReturnStatement" || s.type === "ThrowStatement" || s.type === "JSXExpressionContainer" && i.type === "JSXAttribute" || n.operator !== "|" && s.type === "JsExpressionRoot" || n.type !== "NGPipeExpression" && (s.type === "NGRoot" && t.parser === "__ng_binding" || s.type === "NGMicrosyntaxExpression" && i.type === "NGMicrosyntax" && i.body.length === 1) || n === s.body && s.type === "ArrowFunctionExpression" || n !== s.body && s.type === "ForStatement" || s.type === "ConditionalExpression" && i.type !== "ReturnStatement" && i.type !== "ThrowStatement" && !M(i) && i.type !== "NewExpression" || s.type === "TemplateLiteral" || El(e), D = s.type === "AssignmentExpression" || s.type === "VariableDeclarator" || s.type === "ClassProperty" || s.type === "PropertyDefinition" || s.type === "TSAbstractPropertyDefinition" || s.type === "ClassPrivateProperty" || Oe(s), F = Te(n.left) && dr(n.operator, n.left.operator);
|
|
2213
|
+
if (y || er(n) && !F || !er(n) && D) return l(c);
|
|
2214
|
+
if (c.length === 0) return "";
|
|
2215
|
+
let C = H(n.right), d = c.findIndex((S) => typeof S != "string" && !Array.isArray(S) && S.type === Fe), b = c.slice(0, d === -1 ? 1 : d + 1), B = c.slice(b.length, C ? -1 : void 0), O = /* @__PURE__ */ Symbol("logicalChain-" + ++fl), h = l([...b, m(B)], { id: O });
|
|
2216
|
+
if (!C) return h;
|
|
2217
|
+
let g = N(0, c, -1);
|
|
2218
|
+
return l([h, yt(g, { groupId: O })]);
|
|
2219
|
+
}
|
|
2220
|
+
function Ts(e, t, r, n, s) {
|
|
2221
|
+
let { node: i } = e;
|
|
2222
|
+
if (!Te(i)) return [l(r())];
|
|
2223
|
+
let o = [];
|
|
2224
|
+
dr(i.operator, i.left.operator) ? o = e.call(() => Ts(e, t, r, true, s), "left") : o.push(l(r("left")));
|
|
2225
|
+
let u = er(i), p = i.right.type === "ChainExpression" ? i.right.expression : i.right, c = (i.operator === "|>" || i.type === "NGPipeExpression" || yl(e, t)) && !Ee(t.originalText, p), D = !T(p, x.Leading, Hr) && Ee(t.originalText, p), F = i.type === "NGPipeExpression" ? "|" : i.operator, C = i.type === "NGPipeExpression" && i.arguments.length > 0 ? l(m([f, ": ", L([A, ": "], e.map(() => xe(2, l(r())), "arguments"))])) : "", d;
|
|
2226
|
+
if (u) d = [F, Ee(t.originalText, p) ? m([A, r("right"), C]) : [" ", r("right"), C]];
|
|
2227
|
+
else {
|
|
2228
|
+
let g = F === "|>" && e.root.extra?.__isUsingHackPipeline ? e.call(() => Ts(e, t, r, true, s), "right") : r("right");
|
|
2229
|
+
if (t.experimentalOperatorPosition === "start") {
|
|
2230
|
+
let S = "";
|
|
2231
|
+
if (D) switch (We(g)) {
|
|
2232
|
+
case Be:
|
|
2233
|
+
S = g.splice(0, 1)[0];
|
|
2234
|
+
break;
|
|
2235
|
+
case Pe:
|
|
2236
|
+
S = g.contents.splice(0, 1)[0];
|
|
2237
|
+
break;
|
|
2238
|
+
}
|
|
2239
|
+
d = [A, S, F, " ", g, C];
|
|
2240
|
+
} else d = [c ? A : "", F, c ? " " : A, g, C];
|
|
2241
|
+
}
|
|
2242
|
+
let { parent: b } = e, B = T(i.left, x.Trailing | x.Line);
|
|
2243
|
+
if ((B || !(s && i.type === "LogicalExpression") && b.type !== i.type && i.left.type !== i.type && i.right.type !== i.type) && (d = l(d, { shouldBreak: B })), t.experimentalOperatorPosition === "start" ? o.push(u || D ? " " : "", d) : o.push(c ? "" : " ", d), n && T(i)) {
|
|
2244
|
+
let h = Qt(De(e, o, t));
|
|
2245
|
+
return h.type === Me ? h.parts : Array.isArray(h) ? h : [h];
|
|
2246
|
+
}
|
|
2247
|
+
return o;
|
|
2248
|
+
}
|
|
2249
|
+
function er(e) {
|
|
2250
|
+
return e.type !== "LogicalExpression" ? false : !!(se(e.right) && e.right.properties.length > 0 || q(e.right) && e.right.elements.length > 0 || H(e.right));
|
|
2251
|
+
}
|
|
2252
|
+
var Ro = (e) => e.type === "BinaryExpression" && e.operator === "|";
|
|
2253
|
+
function yl(e, t) {
|
|
2254
|
+
return (t.parser === "__vue_expression" || t.parser === "__vue_ts_expression") && Ro(e.node) && !e.hasAncestor((r) => !Ro(r) && r.type !== "JsExpressionRoot");
|
|
2255
|
+
}
|
|
2256
|
+
function El(e) {
|
|
2257
|
+
if (e.key !== "arguments") return false;
|
|
2258
|
+
let { parent: t } = e;
|
|
2259
|
+
if (!(M(t) && !t.optional && t.arguments.length === 1)) return false;
|
|
2260
|
+
let { callee: r } = t;
|
|
2261
|
+
return r.type === "Identifier" && r.name === "Boolean";
|
|
2262
|
+
}
|
|
2263
|
+
function un(e, t, r) {
|
|
2264
|
+
let { node: n } = e, { parent: s } = e, i = s.type !== "TypeParameterInstantiation" && (!Ue(s) || !t.experimentalTernaries) && s.type !== "TSTypeParameterInstantiation" && s.type !== "GenericTypeAnnotation" && s.type !== "TSTypeReference" && s.type !== "TSTypeAssertion" && s.type !== "TupleTypeAnnotation" && s.type !== "TSTupleType" && !(s.type === "FunctionTypeParam" && !s.name && e.grandparent.this !== s) && !((Cr(s) || s.type === "VariableDeclarator") && Ee(t.originalText, n)) && !(Cr(s) && T(s.id, x.Trailing | x.Line)), o = xs(n), u = e.map(() => {
|
|
2265
|
+
let C = r();
|
|
2266
|
+
return o || (C = xe(2, C)), De(e, C, t);
|
|
2267
|
+
}, "types"), p = "", c = "";
|
|
2268
|
+
if (Yr(e) && ({ leading: p, trailing: c } = Mt(e, t)), o) return [p, L(" | ", u), c];
|
|
2269
|
+
let y = i && !Ee(t.originalText, n), D = [P([y ? A : "", "| "]), L([A, "| "], u)];
|
|
2270
|
+
if (ge(e, t)) return [p, l([m(D), f]), c];
|
|
2271
|
+
let F = [p, l(D)];
|
|
2272
|
+
return (s.type === "TupleTypeAnnotation" || s.type === "TSTupleType") && s[s.type === "TupleTypeAnnotation" && s.types ? "types" : "elementTypes"].length > 1 ? [l([m([P(["(", f]), F]), f, P(")")]), c] : [l(i ? m(F) : F), c];
|
|
2273
|
+
}
|
|
2274
|
+
var Fl = k(["VoidTypeAnnotation", "TSVoidKeyword", "NullLiteralTypeAnnotation", "TSNullKeyword"]);
|
|
2275
|
+
var dl = k(["ObjectTypeAnnotation", "TSTypeLiteral", "GenericTypeAnnotation", "TSTypeReference"]);
|
|
2276
|
+
function xs(e) {
|
|
2277
|
+
let { types: t } = e;
|
|
2278
|
+
if (t.some((n) => T(n))) return false;
|
|
2279
|
+
let r = t.find((n) => dl(n));
|
|
2280
|
+
return r ? t.every((n) => n === r || Fl(n)) : false;
|
|
2281
|
+
}
|
|
2282
|
+
function Jo(e) {
|
|
2283
|
+
return Vt(e) || Je(e) ? true : Se(e) ? xs(e) : false;
|
|
2284
|
+
}
|
|
2285
|
+
var Cl = /* @__PURE__ */ new WeakSet();
|
|
2286
|
+
function G(e, t, r = "typeAnnotation") {
|
|
2287
|
+
let { node: { [r]: n } } = e;
|
|
2288
|
+
if (!n) return "";
|
|
2289
|
+
let s = false;
|
|
2290
|
+
if (n.type === "TSTypeAnnotation" || n.type === "TypeAnnotation") {
|
|
2291
|
+
let i = e.call(Go, r);
|
|
2292
|
+
(i === "=>" || i === ":" && T(n, x.Leading)) && (s = true), Cl.add(n);
|
|
2293
|
+
}
|
|
2294
|
+
return s ? [" ", t(r)] : t(r);
|
|
2295
|
+
}
|
|
2296
|
+
var Go = (e) => e.match((t) => t.type === "TSTypeAnnotation", (t, r) => (r === "returnType" || r === "typeAnnotation") && (t.type === "TSFunctionType" || t.type === "TSConstructorType")) ? "=>" : e.match((t) => t.type === "TSTypeAnnotation", (t, r) => r === "typeAnnotation" && (t.type === "TSJSDocNullableType" || t.type === "TSJSDocNonNullableType" || t.type === "TSTypePredicate")) || e.match((t) => t.type === "TypeAnnotation", (t, r) => r === "typeAnnotation" && t.type === "Identifier", (t, r) => r === "id" && t.type === "DeclareFunction") || e.match((t) => t.type === "TypeAnnotation", (t, r) => r === "typeAnnotation" && t.type === "Identifier", (t, r) => r === "id" && t.type === "DeclareHook") || e.match((t) => t.type === "TypeAnnotation", (t, r) => r === "bound" && t.type === "TypeParameter" && t.usesExtendsBound) ? "" : ":";
|
|
2297
|
+
function an(e, t, r) {
|
|
2298
|
+
let n = Go(e);
|
|
2299
|
+
return n ? [n, " ", r("typeAnnotation")] : r("typeAnnotation");
|
|
2300
|
+
}
|
|
2301
|
+
function Al(e, t, r, n) {
|
|
2302
|
+
let { node: s } = e, i = s.inexact ? "..." : "";
|
|
2303
|
+
return T(s, x.Dangling) ? l([r, i, v(e, t, { indent: true }), f, n]) : [r, i, n];
|
|
2304
|
+
}
|
|
2305
|
+
function tr(e, t, r) {
|
|
2306
|
+
let { node: n } = e, s = [], i = "[", o = "]", u = n.type === "TupleTypeAnnotation" && n.types ? "types" : n.type === "TSTupleType" || n.type === "TupleTypeAnnotation" ? "elementTypes" : "elements", p = n[u];
|
|
2307
|
+
if (p.length === 0) s.push(Al(e, t, i, o));
|
|
2308
|
+
else {
|
|
2309
|
+
let c = N(0, p, -1), y = c?.type !== "RestElement" && !n.inexact, D = c === null, F = /* @__PURE__ */ Symbol("array"), C = !t.__inJestEach && p.length > 1 && p.every((B, O, h) => {
|
|
2310
|
+
let g = B?.type;
|
|
2311
|
+
if (!q(B) && !se(B)) return false;
|
|
2312
|
+
let S = h[O + 1];
|
|
2313
|
+
if (S && g !== S.type) return false;
|
|
2314
|
+
let j = q(B) ? "elements" : "properties";
|
|
2315
|
+
return B[j] && B[j].length > 1;
|
|
2316
|
+
}), d = gs(n, t), b = y ? D ? "," : ie(t) ? d ? P(",", "", { groupId: F }) : P(",") : "" : "";
|
|
2317
|
+
s.push(l([i, m([f, d ? xl(e, t, r, b) : [Tl(e, t, r, u, n.inexact), b], v(e, t)]), f, o], { shouldBreak: C, id: F }));
|
|
2318
|
+
}
|
|
2319
|
+
return s.push(X(e), G(e, r)), s;
|
|
2320
|
+
}
|
|
2321
|
+
function gs(e, t) {
|
|
2322
|
+
return q(e) && e.elements.length > 0 && e.elements.every((r) => r && (Ce(r) || Hn(r) && !T(r.argument)) && !T(r, x.Trailing | x.Line, (n) => !Z(t.originalText, w(n), { backwards: true })));
|
|
2323
|
+
}
|
|
2324
|
+
function Wo({ node: e }, { originalText: t }) {
|
|
2325
|
+
let r = I(e);
|
|
2326
|
+
if (r === w(e)) return false;
|
|
2327
|
+
let { length: n } = t;
|
|
2328
|
+
for (; r < n && t[r] !== ","; ) r = qt(t, Ut(t, r + 1));
|
|
2329
|
+
return Yt(t, r);
|
|
2330
|
+
}
|
|
2331
|
+
function Tl(e, t, r, n, s) {
|
|
2332
|
+
let i = [];
|
|
2333
|
+
return e.each(({ node: o, isLast: u }) => {
|
|
2334
|
+
i.push(o ? l(r()) : ""), (!u || s) && i.push([",", A, o && Wo(e, t) ? f : ""]);
|
|
2335
|
+
}, n), s && i.push("..."), i;
|
|
2336
|
+
}
|
|
2337
|
+
function xl(e, t, r, n) {
|
|
2338
|
+
let s = [];
|
|
2339
|
+
return e.each(({ isLast: i, next: o }) => {
|
|
2340
|
+
s.push([r(), i ? n : ","]), i || s.push(Wo(e, t) ? [E, E] : T(o, x.Leading | x.Line) ? E : A);
|
|
2341
|
+
}, "elements"), zr(s);
|
|
2342
|
+
}
|
|
2343
|
+
function gl(e, t, r) {
|
|
2344
|
+
let { node: n } = e, s = le(n);
|
|
2345
|
+
if (s.length === 0) return ["(", v(e, t), ")"];
|
|
2346
|
+
let i = s.length - 1;
|
|
2347
|
+
if (Bl(s)) {
|
|
2348
|
+
let D = ["("];
|
|
2349
|
+
return $t(e, (F, C) => {
|
|
2350
|
+
D.push(r()), C !== i && D.push(", ");
|
|
2351
|
+
}), D.push(")"), D;
|
|
2352
|
+
}
|
|
2353
|
+
let o = false, u = [];
|
|
2354
|
+
$t(e, ({ node: D }, F) => {
|
|
2355
|
+
let C = r();
|
|
2356
|
+
F === i || (oe(D, t) ? (o = true, C = [C, ",", E, E]) : C = [C, ",", A]), u.push(C);
|
|
2357
|
+
});
|
|
2358
|
+
let p = !t.parser.startsWith("__ng_") && n.type !== "ImportExpression" && n.type !== "TSImportType" && n.type !== "TSExternalModuleReference" && ie(t, "all") ? "," : "";
|
|
2359
|
+
function c() {
|
|
2360
|
+
return l(["(", m([A, ...u]), p, A, ")"], { shouldBreak: true });
|
|
2361
|
+
}
|
|
2362
|
+
if (o || e.parent.type !== "Decorator" && Ci(s)) return c();
|
|
2363
|
+
if (Sl(s)) {
|
|
2364
|
+
let D = u.slice(1);
|
|
2365
|
+
if (D.some(ne)) return c();
|
|
2366
|
+
let F;
|
|
2367
|
+
try {
|
|
2368
|
+
F = r($n(n, 0), { expandFirstArg: true });
|
|
2369
|
+
} catch (C) {
|
|
2370
|
+
if (C instanceof Et) return c();
|
|
2371
|
+
throw C;
|
|
2372
|
+
}
|
|
2373
|
+
return ne(F) ? [ke, nt([["(", l(F, { shouldBreak: true }), ", ", ...D, ")"], c()])] : nt([["(", F, ", ", ...D, ")"], ["(", l(F, { shouldBreak: true }), ", ", ...D, ")"], c()]);
|
|
2374
|
+
}
|
|
2375
|
+
if (hl(s, u, t)) {
|
|
2376
|
+
let D = u.slice(0, -1);
|
|
2377
|
+
if (D.some(ne)) return c();
|
|
2378
|
+
let F;
|
|
2379
|
+
try {
|
|
2380
|
+
F = r($n(n, -1), { expandLastArg: true });
|
|
2381
|
+
} catch (C) {
|
|
2382
|
+
if (C instanceof Et) return c();
|
|
2383
|
+
throw C;
|
|
2384
|
+
}
|
|
2385
|
+
return ne(F) ? [ke, nt([["(", ...D, l(F, { shouldBreak: true }), ")"], c()])] : nt([["(", ...D, F, ")"], ["(", ...D, l(F, { shouldBreak: true }), ")"], c()]);
|
|
2386
|
+
}
|
|
2387
|
+
let y = ["(", m([f, ...u]), P(p), f, ")"];
|
|
2388
|
+
return Ur(e) ? y : l(y, { shouldBreak: u.some(ne) || o });
|
|
2389
|
+
}
|
|
2390
|
+
function gr(e, t = false) {
|
|
2391
|
+
return se(e) && (e.properties.length > 0 || T(e)) || q(e) && (e.elements.length > 0 || T(e)) || e.type === "TSTypeAssertion" && gr(e.expression) || Ae(e) && gr(e.expression) || e.type === "FunctionExpression" || e.type === "ArrowFunctionExpression" && (!e.returnType || !e.returnType.typeAnnotation || e.returnType.typeAnnotation.type !== "TSTypeReference" || bl(e.body)) && (e.body.type === "BlockStatement" || e.body.type === "ArrowFunctionExpression" && gr(e.body, true) || se(e.body) || q(e.body) || !t && (M(e.body) || e.body.type === "ConditionalExpression") || H(e.body)) || e.type === "DoExpression" || e.type === "ModuleExpression";
|
|
2392
|
+
}
|
|
2393
|
+
function hl(e, t, r) {
|
|
2394
|
+
let n = N(0, e, -1);
|
|
2395
|
+
if (e.length === 1) {
|
|
2396
|
+
let i = N(0, t, -1);
|
|
2397
|
+
if (i.label?.embed && i.label?.hug !== false) return true;
|
|
2398
|
+
}
|
|
2399
|
+
let s = N(0, e, -2);
|
|
2400
|
+
return !T(n, x.Leading) && !T(n, x.Trailing) && gr(n) && (!s || s.type !== n.type) && (e.length !== 2 || s.type !== "ArrowFunctionExpression" || !q(n)) && !(e.length > 1 && gs(n, r));
|
|
2401
|
+
}
|
|
2402
|
+
function Sl(e) {
|
|
2403
|
+
if (e.length !== 2) return false;
|
|
2404
|
+
let [t, r] = e;
|
|
2405
|
+
return t.type === "ModuleExpression" && Pl(r) ? true : !T(t) && (t.type === "FunctionExpression" || t.type === "ArrowFunctionExpression" && t.body.type === "BlockStatement") && r.type !== "FunctionExpression" && r.type !== "ArrowFunctionExpression" && r.type !== "ConditionalExpression" && Uo(r) && !gr(r);
|
|
2406
|
+
}
|
|
2407
|
+
function Uo(e) {
|
|
2408
|
+
if (e.type === "ParenthesizedExpression") return Uo(e.expression);
|
|
2409
|
+
if (Ae(e) || e.type === "TypeCastExpression") {
|
|
2410
|
+
let { typeAnnotation: t } = e;
|
|
2411
|
+
if (t.type === "TypeAnnotation" && (t = t.typeAnnotation), t.type === "TSArrayType" && (t = t.elementType, t.type === "TSArrayType" && (t = t.elementType)), t.type === "GenericTypeAnnotation" || t.type === "TSTypeReference") {
|
|
2412
|
+
let r = t.type === "GenericTypeAnnotation" ? t.typeParameters : t.typeArguments;
|
|
2413
|
+
r?.params.length === 1 && (t = r.params[0]);
|
|
2414
|
+
}
|
|
2415
|
+
return Vt(t) && Re(e.expression, 1);
|
|
2416
|
+
}
|
|
2417
|
+
return Dt(e) && le(e).length > 1 ? false : Te(e) ? Re(e.left, 1) && Re(e.right, 1) : Xn(e) || Re(e);
|
|
2418
|
+
}
|
|
2419
|
+
function Bl(e) {
|
|
2420
|
+
return e.length === 2 ? qo(e, 0) : e.length === 3 ? e[0].type === "Identifier" && qo(e, 1) : false;
|
|
2421
|
+
}
|
|
2422
|
+
function qo(e, t) {
|
|
2423
|
+
let r = e[t], n = e[t + 1];
|
|
2424
|
+
return r.type === "ArrowFunctionExpression" && K(r).length === 0 && r.body.type === "BlockStatement" && n.type === "ArrayExpression" && !e.some((s) => T(s));
|
|
2425
|
+
}
|
|
2426
|
+
function bl(e) {
|
|
2427
|
+
return e.type === "BlockStatement" && (e.body.some((t) => t.type !== "EmptyStatement") || T(e, x.Dangling));
|
|
2428
|
+
}
|
|
2429
|
+
function Pl(e) {
|
|
2430
|
+
if (!(e.type === "ObjectExpression" && e.properties.length === 1)) return false;
|
|
2431
|
+
let [t] = e.properties;
|
|
2432
|
+
return Oe(t) ? !t.computed && (t.key.type === "Identifier" && t.key.name === "type" || V(t.key) && t.key.value === "type") && V(t.value) && t.value.value === "module" : false;
|
|
2433
|
+
}
|
|
2434
|
+
var hr = gl;
|
|
2435
|
+
function Yo(e, t, r) {
|
|
2436
|
+
return [r("object"), l(m([f, hs(e, t, r)]))];
|
|
2437
|
+
}
|
|
2438
|
+
function hs(e, t, r) {
|
|
2439
|
+
return ["::", r("callee")];
|
|
2440
|
+
}
|
|
2441
|
+
var kl = (e) => ((e.type === "ChainExpression" || e.type === "TSNonNullExpression") && (e = e.expression), M(e) && le(e).length > 0);
|
|
2442
|
+
function Il(e) {
|
|
2443
|
+
let { node: t, ancestors: r } = e;
|
|
2444
|
+
for (let n of r) {
|
|
2445
|
+
if (!(J(n) && n.object === t || n.type === "TSNonNullExpression" && n.expression === t)) return n.type === "NewExpression" && n.callee === t;
|
|
2446
|
+
t = n;
|
|
2447
|
+
}
|
|
2448
|
+
return false;
|
|
2449
|
+
}
|
|
2450
|
+
function Ho(e, t, r) {
|
|
2451
|
+
let n = r("object"), s = Ss(e, t, r), { node: i } = e, o = e.findAncestor((c) => !(J(c) || c.type === "TSNonNullExpression")), u = e.findAncestor((c) => !(c.type === "ChainExpression" || c.type === "TSNonNullExpression")), p = o.type === "BindExpression" || o.type === "AssignmentExpression" && o.left.type !== "Identifier" || Il(e) || i.computed || i.object.type === "Identifier" && i.property.type === "Identifier" && !J(u) || (u.type === "AssignmentExpression" || u.type === "VariableDeclarator") && (kl(i.object) || n.label?.memberChain);
|
|
2452
|
+
return pt(n.label, [n, p ? s : l(m([f, s]))]);
|
|
2453
|
+
}
|
|
2454
|
+
function Ss(e, t, r) {
|
|
2455
|
+
let n = r("property"), { node: s } = e, i = X(e);
|
|
2456
|
+
return s.computed ? !s.property || Ce(s.property) ? [i, "[", n, "]"] : l([i, "[", m([f, n]), f, "]"]) : [i, ".", n];
|
|
2457
|
+
}
|
|
2458
|
+
function Xo(e, t, r) {
|
|
2459
|
+
if (e.node.type === "ChainExpression") return e.call(() => Xo(e, t, r), "expression");
|
|
2460
|
+
let n = (e.parent.type === "ChainExpression" ? e.grandparent : e.parent).type === "ExpressionStatement", s = [];
|
|
2461
|
+
function i(_) {
|
|
2462
|
+
let { originalText: re } = t, ae = at(re, I(_));
|
|
2463
|
+
return re.charAt(ae) === ")" ? ae !== false && Yt(re, ae + 1) : oe(_, t);
|
|
2464
|
+
}
|
|
2465
|
+
function o() {
|
|
2466
|
+
let { node: _ } = e;
|
|
2467
|
+
if (_.type === "ChainExpression") return e.call(o, "expression");
|
|
2468
|
+
if (M(_) && (Tt(_.callee) || M(_.callee))) {
|
|
2469
|
+
let re = i(_);
|
|
2470
|
+
s.unshift({ node: _, hasTrailingEmptyLine: re, printed: [De(e, [X(e), r("typeArguments"), hr(e, t, r)], t), re ? E : ""] }), e.call(o, "callee");
|
|
2471
|
+
} else Tt(_) ? (s.unshift({ node: _, needsParens: ge(e, t), printed: De(e, J(_) ? Ss(e, t, r) : hs(e, t, r), t) }), e.call(o, "object")) : _.type === "TSNonNullExpression" ? (s.unshift({ node: _, printed: De(e, "!", t) }), e.call(o, "expression")) : s.unshift({ node: _, printed: r() });
|
|
2472
|
+
}
|
|
2473
|
+
let { node: u } = e;
|
|
2474
|
+
s.unshift({ node: u, printed: [X(e), r("typeArguments"), hr(e, t, r)] }), u.callee && e.call(o, "callee");
|
|
2475
|
+
let p = [], c = [s[0]], y = 1;
|
|
2476
|
+
for (; y < s.length && (s[y].node.type === "TSNonNullExpression" || M(s[y].node) || J(s[y].node) && s[y].node.computed && Ce(s[y].node.property)); ++y) c.push(s[y]);
|
|
2477
|
+
if (!M(s[0].node)) for (; y + 1 < s.length && (Tt(s[y].node) && Tt(s[y + 1].node)); ++y) c.push(s[y]);
|
|
2478
|
+
p.push(c), c = [];
|
|
2479
|
+
let D = false;
|
|
2480
|
+
for (; y < s.length; ++y) {
|
|
2481
|
+
if (D && Tt(s[y].node)) {
|
|
2482
|
+
if (s[y].node.computed && Ce(s[y].node.property)) {
|
|
2483
|
+
c.push(s[y]);
|
|
2484
|
+
continue;
|
|
2485
|
+
}
|
|
2486
|
+
p.push(c), c = [], D = false;
|
|
2487
|
+
}
|
|
2488
|
+
(M(s[y].node) || s[y].node.type === "ImportExpression") && (D = true), c.push(s[y]), T(s[y].node, x.Trailing) && (p.push(c), c = [], D = false);
|
|
2489
|
+
}
|
|
2490
|
+
c.length > 0 && p.push(c);
|
|
2491
|
+
function F(_) {
|
|
2492
|
+
return /^[A-Z]|^[$_]+$/u.test(_);
|
|
2493
|
+
}
|
|
2494
|
+
function C(_) {
|
|
2495
|
+
return _.length <= t.tabWidth;
|
|
2496
|
+
}
|
|
2497
|
+
function d(_) {
|
|
2498
|
+
let re = _[1][0]?.node.computed;
|
|
2499
|
+
if (_[0].length === 1) {
|
|
2500
|
+
let it = _[0][0].node;
|
|
2501
|
+
return it.type === "ThisExpression" || it.type === "Identifier" && (F(it.name) || n && C(it.name) || re);
|
|
2502
|
+
}
|
|
2503
|
+
let ae = N(0, _[0], -1).node;
|
|
2504
|
+
return J(ae) && ae.property.type === "Identifier" && (F(ae.property.name) || re);
|
|
2505
|
+
}
|
|
2506
|
+
let b = p.length >= 2 && !T(p[1][0].node) && d(p);
|
|
2507
|
+
function B(_) {
|
|
2508
|
+
let re = _.map((ae) => ae.printed);
|
|
2509
|
+
return _.length > 0 && N(0, _, -1).needsParens ? ["(", ...re, ")"] : re;
|
|
2510
|
+
}
|
|
2511
|
+
function O(_) {
|
|
2512
|
+
return _.length === 0 ? "" : m([E, L(E, _.map(B))]);
|
|
2513
|
+
}
|
|
2514
|
+
let h = p.map(B), g = h, S = b ? 3 : 2, j = p.flat(), U = j.slice(1, -1).some((_) => T(_.node, x.Leading)) || j.slice(0, -1).some((_) => T(_.node, x.Trailing)) || p[S] && T(p[S][0].node, x.Leading);
|
|
2515
|
+
if (p.length <= S && !U && !p.some((_) => N(0, _, -1).hasTrailingEmptyLine)) return Ur(e) ? g : l(g);
|
|
2516
|
+
let fe = N(0, p[b ? 1 : 0], -1).node, Y = !M(fe) && i(fe), z = [B(p[0]), b ? p.slice(1, 2).map(B) : "", Y ? E : "", O(p.slice(b ? 2 : 1))], ee = s.map(({ node: _ }) => _).filter(M);
|
|
2517
|
+
function Ie() {
|
|
2518
|
+
let _ = N(0, N(0, p, -1), -1).node, re = N(0, h, -1);
|
|
2519
|
+
return M(_) && ne(re) && ee.slice(0, -1).some((ae) => ae.arguments.some(Ht));
|
|
2520
|
+
}
|
|
2521
|
+
let st;
|
|
2522
|
+
return U || ee.length > 2 && ee.some((_) => !_.arguments.every((re) => Re(re))) || h.slice(0, -1).some(ne) || Ie() ? st = l(z) : st = [ne(g) || Y ? ke : "", nt([g, z])], pt({ memberChain: true }, st);
|
|
2523
|
+
}
|
|
2524
|
+
var Vo = Xo;
|
|
2525
|
+
function vt(e, t, r) {
|
|
2526
|
+
let { node: n } = e, s = n.type === "NewExpression", i = X(e), o = le(n), u = n.type !== "TSImportType" && n.typeArguments ? r("typeArguments") : "", p = o.length === 1 && Wr(o[0], t.originalText);
|
|
2527
|
+
if (p || Ol(e) || wl(e) || It(n, e.parent)) {
|
|
2528
|
+
let D = [];
|
|
2529
|
+
if ($t(e, () => {
|
|
2530
|
+
D.push(r());
|
|
2531
|
+
}), !(p && D[0].label?.embed)) return [s ? "new " : "", $o(e, r), i, u, "(", L(", ", D), ")"];
|
|
2532
|
+
}
|
|
2533
|
+
let c = n.type === "ImportExpression" || n.type === "TSImportType" || n.type === "TSExternalModuleReference";
|
|
2534
|
+
if (!c && !s && Tt(n.callee) && !e.call(() => ge(e, t), "callee", ...n.callee.type === "ChainExpression" ? ["expression"] : [])) return Vo(e, t, r);
|
|
2535
|
+
let y = [s ? "new " : "", $o(e, r), i, u, hr(e, t, r)];
|
|
2536
|
+
return c || M(n.callee) ? l(y) : y;
|
|
2537
|
+
}
|
|
2538
|
+
function $o(e, t) {
|
|
2539
|
+
let { node: r } = e;
|
|
2540
|
+
return r.type === "ImportExpression" ? `import${r.phase ? `.${r.phase}` : ""}` : r.type === "TSImportType" ? "import" : r.type === "TSExternalModuleReference" ? "require" : t("callee");
|
|
2541
|
+
}
|
|
2542
|
+
var Ll = ["require", "require.resolve", "require.resolve.paths", "import.meta.resolve"];
|
|
2543
|
+
function Ol(e) {
|
|
2544
|
+
let { node: t } = e;
|
|
2545
|
+
if (!(t.type === "ImportExpression" || t.type === "TSImportType" || t.type === "TSExternalModuleReference" || t.type === "CallExpression" && !t.optional && Pt(t.callee, Ll))) return false;
|
|
2546
|
+
let r = le(t);
|
|
2547
|
+
return r.length === 1 && V(r[0]) && !T(r[0]);
|
|
2548
|
+
}
|
|
2549
|
+
function wl(e) {
|
|
2550
|
+
let { node: t } = e;
|
|
2551
|
+
if (t.type !== "CallExpression" || t.optional || t.callee.type !== "Identifier") return false;
|
|
2552
|
+
let r = le(t);
|
|
2553
|
+
return t.callee.name === "require" ? (r.length === 1 && V(r[0]) || r.length > 1) && !T(r[0]) : t.callee.name === "define" && e.parent.type === "ExpressionStatement" ? r.length === 1 || r.length === 2 && r[0].type === "ArrayExpression" || r.length === 3 && V(r[0]) && r[1].type === "ArrayExpression" : false;
|
|
2554
|
+
}
|
|
2555
|
+
function ht(e, t, r, n, s, i) {
|
|
2556
|
+
let o = _l(e, t, r, n, i), u = i ? r(i, { assignmentLayout: o }) : "";
|
|
2557
|
+
switch (o) {
|
|
2558
|
+
case "break-after-operator":
|
|
2559
|
+
return l([l(n), s, l(m([A, u]))]);
|
|
2560
|
+
case "never-break-after-operator":
|
|
2561
|
+
return l([l(n), s, " ", u]);
|
|
2562
|
+
case "fluid": {
|
|
2563
|
+
let p = /* @__PURE__ */ Symbol("assignment");
|
|
2564
|
+
return l([l(n), s, l(m(A), { id: p }), je, yt(u, { groupId: p })]);
|
|
2565
|
+
}
|
|
2566
|
+
case "break-lhs":
|
|
2567
|
+
return l([n, s, " ", l(u)]);
|
|
2568
|
+
case "chain":
|
|
2569
|
+
return [l(n), s, A, u];
|
|
2570
|
+
case "chain-tail":
|
|
2571
|
+
return [l(n), s, m([A, u])];
|
|
2572
|
+
case "chain-tail-arrow-chain":
|
|
2573
|
+
return [l(n), s, u];
|
|
2574
|
+
case "only-left":
|
|
2575
|
+
return n;
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
function zo(e, t, r) {
|
|
2579
|
+
let { node: n } = e;
|
|
2580
|
+
return ht(e, t, r, r("left"), [" ", n.operator], "right");
|
|
2581
|
+
}
|
|
2582
|
+
function Zo(e, t, r) {
|
|
2583
|
+
return ht(e, t, r, r("id"), " =", "init");
|
|
2584
|
+
}
|
|
2585
|
+
function _l(e, t, r, n, s) {
|
|
2586
|
+
let { node: i } = e, o = i[s];
|
|
2587
|
+
if (!o) return "only-left";
|
|
2588
|
+
let u = !pn(o);
|
|
2589
|
+
if (e.match(pn, eu, (F) => !u || F.type !== "ExpressionStatement" && F.type !== "VariableDeclaration")) return u ? o.type === "ArrowFunctionExpression" && o.body.type === "ArrowFunctionExpression" ? "chain-tail-arrow-chain" : "chain-tail" : "chain";
|
|
2590
|
+
if (!u && pn(o.right) || Ee(t.originalText, o)) return "break-after-operator";
|
|
2591
|
+
if (i.type === "ImportAttribute" || o.type === "CallExpression" && o.callee.name === "require" || t.parser === "json5" || t.parser === "jsonc" || t.parser === "json") return "never-break-after-operator";
|
|
2592
|
+
let y = Xi(n);
|
|
2593
|
+
if (Nl(i) || Rl(i) || Bs(i) && y) return "break-lhs";
|
|
2594
|
+
let D = Jl(i, n, t);
|
|
2595
|
+
return e.call(() => Ml(e, t, r, D), s) ? "break-after-operator" : jl(i) ? "break-lhs" : !y && (D || o.type === "TemplateLiteral" || o.type === "TaggedTemplateExpression" || yi(o) || Ce(o) || o.type === "ClassExpression") ? "never-break-after-operator" : "fluid";
|
|
2596
|
+
}
|
|
2597
|
+
function Ml(e, t, r, n) {
|
|
2598
|
+
let s = e.node;
|
|
2599
|
+
if (Te(s) && !er(s)) return true;
|
|
2600
|
+
switch (s.type) {
|
|
2601
|
+
case "StringLiteralTypeAnnotation":
|
|
2602
|
+
case "SequenceExpression":
|
|
2603
|
+
return true;
|
|
2604
|
+
case "TSConditionalType":
|
|
2605
|
+
case "ConditionalTypeAnnotation":
|
|
2606
|
+
if (!t.experimentalTernaries && !ql(s)) break;
|
|
2607
|
+
return true;
|
|
2608
|
+
case "ConditionalExpression": {
|
|
2609
|
+
if (!t.experimentalTernaries) {
|
|
2610
|
+
let { test: c } = s;
|
|
2611
|
+
return Te(c) && !er(c);
|
|
2612
|
+
}
|
|
2613
|
+
let { consequent: u, alternate: p } = s;
|
|
2614
|
+
return u.type === "ConditionalExpression" || p.type === "ConditionalExpression";
|
|
2615
|
+
}
|
|
2616
|
+
case "ClassExpression":
|
|
2617
|
+
return R(s.decorators);
|
|
2618
|
+
}
|
|
2619
|
+
if (n) return false;
|
|
2620
|
+
let i = s, o = [];
|
|
2621
|
+
for (; ; ) if (i.type === "UnaryExpression" || i.type === "AwaitExpression" || i.type === "YieldExpression" && i.argument !== null) i = i.argument, o.push("argument");
|
|
2622
|
+
else if (i.type === "TSNonNullExpression") i = i.expression, o.push("expression");
|
|
2623
|
+
else break;
|
|
2624
|
+
return !!(V(i) || e.call(() => tu(e, t, r), ...o));
|
|
2625
|
+
}
|
|
2626
|
+
function Nl(e) {
|
|
2627
|
+
if (eu(e)) {
|
|
2628
|
+
let t = e.left || e.id;
|
|
2629
|
+
return t.type === "ObjectPattern" && t.properties.length > 2 && t.properties.some((r) => Oe(r) && (!r.shorthand || r.value?.type === "AssignmentPattern"));
|
|
2630
|
+
}
|
|
2631
|
+
return false;
|
|
2632
|
+
}
|
|
2633
|
+
function pn(e) {
|
|
2634
|
+
return e.type === "AssignmentExpression";
|
|
2635
|
+
}
|
|
2636
|
+
function eu(e) {
|
|
2637
|
+
return pn(e) || e.type === "VariableDeclarator";
|
|
2638
|
+
}
|
|
2639
|
+
function jl(e) {
|
|
2640
|
+
let t = vl(e);
|
|
2641
|
+
if (R(t)) {
|
|
2642
|
+
let r = e.type === "TSTypeAliasDeclaration" ? "constraint" : "bound";
|
|
2643
|
+
if (t.length > 1 && t.some((n) => n[r] || n.default)) return true;
|
|
2644
|
+
}
|
|
2645
|
+
return false;
|
|
2646
|
+
}
|
|
2647
|
+
function vl(e) {
|
|
2648
|
+
if (Cr(e)) return e.typeParameters?.params;
|
|
2649
|
+
}
|
|
2650
|
+
function Rl(e) {
|
|
2651
|
+
if (e.type !== "VariableDeclarator") return false;
|
|
2652
|
+
let { typeAnnotation: t } = e.id;
|
|
2653
|
+
if (!t || !t.typeAnnotation) return false;
|
|
2654
|
+
let r = Ko(t.typeAnnotation);
|
|
2655
|
+
return R(r) && r.length > 1 && r.some((n) => R(Ko(n)) || n.type === "TSConditionalType");
|
|
2656
|
+
}
|
|
2657
|
+
function Bs(e) {
|
|
2658
|
+
return e.type === "VariableDeclarator" && e.init?.type === "ArrowFunctionExpression";
|
|
2659
|
+
}
|
|
2660
|
+
function Ko(e) {
|
|
2661
|
+
let t;
|
|
2662
|
+
switch (e.type) {
|
|
2663
|
+
case "GenericTypeAnnotation":
|
|
2664
|
+
t = e.typeParameters;
|
|
2665
|
+
break;
|
|
2666
|
+
case "TSTypeReference":
|
|
2667
|
+
t = e.typeArguments;
|
|
2668
|
+
break;
|
|
2669
|
+
}
|
|
2670
|
+
return t?.params;
|
|
2671
|
+
}
|
|
2672
|
+
function tu(e, t, r, n = false) {
|
|
2673
|
+
let { node: s } = e, i = () => tu(e, t, r, true);
|
|
2674
|
+
if (s.type === "ChainExpression" || s.type === "TSNonNullExpression") return e.call(i, "expression");
|
|
2675
|
+
if (M(s)) {
|
|
2676
|
+
if (vt(e, t, r).label?.memberChain) return false;
|
|
2677
|
+
let u = le(s);
|
|
2678
|
+
return !(u.length === 0 || u.length === 1 && Fr(u[0], t)) || Gl(s, r) ? false : e.call(i, "callee");
|
|
2679
|
+
}
|
|
2680
|
+
return J(s) ? e.call(i, "object") : n && (s.type === "Identifier" || s.type === "ThisExpression");
|
|
2681
|
+
}
|
|
2682
|
+
function Jl(e, t, r) {
|
|
2683
|
+
return Oe(e) ? (t = Qt(t), typeof t == "string" && ot(t) < r.tabWidth + 3) : false;
|
|
2684
|
+
}
|
|
2685
|
+
function Gl(e, t) {
|
|
2686
|
+
let r = Wl(e);
|
|
2687
|
+
if (R(r)) {
|
|
2688
|
+
if (r.length > 1) return true;
|
|
2689
|
+
if (r.length === 1) {
|
|
2690
|
+
let s = r[0];
|
|
2691
|
+
if (Se(s) || xt(s) || s.type === "TSTypeLiteral" || s.type === "ObjectTypeAnnotation") return true;
|
|
2692
|
+
}
|
|
2693
|
+
let n = e.typeParameters ? "typeParameters" : "typeArguments";
|
|
2694
|
+
if (ne(t(n))) return true;
|
|
2695
|
+
}
|
|
2696
|
+
return false;
|
|
2697
|
+
}
|
|
2698
|
+
function Wl(e) {
|
|
2699
|
+
return (e.typeParameters ?? e.typeArguments)?.params;
|
|
2700
|
+
}
|
|
2701
|
+
function Qo(e) {
|
|
2702
|
+
switch (e.type) {
|
|
2703
|
+
case "FunctionTypeAnnotation":
|
|
2704
|
+
case "GenericTypeAnnotation":
|
|
2705
|
+
case "TSFunctionType":
|
|
2706
|
+
return !!e.typeParameters;
|
|
2707
|
+
case "TSTypeReference":
|
|
2708
|
+
return !!e.typeArguments;
|
|
2709
|
+
default:
|
|
2710
|
+
return false;
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
function ql(e) {
|
|
2714
|
+
return Qo(e.checkType) || Qo(e.extendsType);
|
|
2715
|
+
}
|
|
2716
|
+
var cn = /* @__PURE__ */ new WeakMap();
|
|
2717
|
+
function nu(e) {
|
|
2718
|
+
return /^(?:\d+|\d+\.\d+)$/u.test(e);
|
|
2719
|
+
}
|
|
2720
|
+
function ru(e, t) {
|
|
2721
|
+
return t.parser === "json" || t.parser === "jsonc" || !V(e.key) || ut(pe(e.key), t).slice(1, -1) !== e.key.value ? false : !!(vo(e.key.value) && !(t.parser === "babel-ts" && e.type === "ClassProperty" || (t.parser === "typescript" || t.parser === "oxc-ts") && e.type === "PropertyDefinition") || nu(e.key.value) && String(Number(e.key.value)) === e.key.value && e.type !== "ImportAttribute" && (t.parser === "babel" || t.parser === "acorn" || t.parser === "oxc" || t.parser === "espree" || t.parser === "meriyah" || t.parser === "__babel_estree"));
|
|
2722
|
+
}
|
|
2723
|
+
function Ul(e, t) {
|
|
2724
|
+
let { key: r } = e.node;
|
|
2725
|
+
return (r.type === "Identifier" || Ce(r) && nu(dt(pe(r))) && String(r.value) === dt(pe(r)) && !(t.parser === "typescript" || t.parser === "babel-ts" || t.parser === "oxc-ts")) && (t.parser === "json" || t.parser === "jsonc" || t.quoteProps === "consistent" && cn.get(e.parent));
|
|
2726
|
+
}
|
|
2727
|
+
function Ct(e, t, r) {
|
|
2728
|
+
let { node: n } = e;
|
|
2729
|
+
if (n.computed) return ["[", r("key"), "]"];
|
|
2730
|
+
let { parent: s } = e, { key: i } = n;
|
|
2731
|
+
if (t.quoteProps === "consistent" && !cn.has(s)) {
|
|
2732
|
+
let o = e.siblings.some((u) => !u.computed && V(u.key) && !ru(u, t));
|
|
2733
|
+
cn.set(s, o);
|
|
2734
|
+
}
|
|
2735
|
+
if (Ul(e, t)) {
|
|
2736
|
+
let o = ut(JSON.stringify(i.type === "Identifier" ? i.name : i.value.toString()), t);
|
|
2737
|
+
return e.call(() => De(e, o, t), "key");
|
|
2738
|
+
}
|
|
2739
|
+
return ru(n, t) && (t.quoteProps === "as-needed" || t.quoteProps === "consistent" && !cn.get(s)) ? e.call(() => De(e, /^\d/u.test(i.value) ? dt(i.value) : i.value, t), "key") : r("key");
|
|
2740
|
+
}
|
|
2741
|
+
function ln(e, t, r) {
|
|
2742
|
+
let { node: n } = e;
|
|
2743
|
+
return n.shorthand ? r("value") : ht(e, t, r, Ct(e, t, r), ":", "value");
|
|
2744
|
+
}
|
|
2745
|
+
var Yl = ({ node: e, key: t, parent: r }) => t === "value" && e.type === "FunctionExpression" && (r.type === "ObjectMethod" || r.type === "ClassMethod" || r.type === "ClassPrivateMethod" || r.type === "MethodDefinition" || r.type === "TSAbstractMethodDefinition" || r.type === "TSDeclareMethod" || r.type === "Property" && mt(r));
|
|
2746
|
+
function mn(e, t, r, n) {
|
|
2747
|
+
if (Yl(e)) return Dn(e, t, r);
|
|
2748
|
+
let { node: s } = e, i = false;
|
|
2749
|
+
if ((s.type === "FunctionDeclaration" || s.type === "FunctionExpression") && n?.expandLastArg) {
|
|
2750
|
+
let { parent: y } = e;
|
|
2751
|
+
M(y) && (le(y).length > 1 || K(s).every((D) => D.type === "Identifier" && !D.typeAnnotation)) && (i = true);
|
|
2752
|
+
}
|
|
2753
|
+
let o = [Q(e), s.async ? "async " : "", `function${s.generator ? "*" : ""} `, s.id ? r("id") : ""], u = Ke(e, t, r, i), p = rr(e, r), c = lt(s, p);
|
|
2754
|
+
return o.push(r("typeParameters"), l([c ? l(u) : u, p]), s.body ? " " : "", r("body")), t.semi && (s.declare || !s.body) && o.push(";"), o;
|
|
2755
|
+
}
|
|
2756
|
+
function Sr(e, t, r) {
|
|
2757
|
+
let { node: n } = e, { kind: s } = n, i = n.value || n, o = [];
|
|
2758
|
+
return !s || s === "init" || s === "method" || s === "constructor" ? i.async && o.push("async ") : (Le(s === "get" || s === "set"), o.push(s, " ")), i.generator && o.push("*"), o.push(Ct(e, t, r), n.optional ? "?" : "", n === i ? Dn(e, t, r) : r("value")), o;
|
|
2759
|
+
}
|
|
2760
|
+
function Dn(e, t, r) {
|
|
2761
|
+
let { node: n } = e, s = Ke(e, t, r), i = rr(e, r), o = jo(n), u = lt(n, i), p = [r("typeParameters"), l([o ? l(s, { shouldBreak: true }) : u ? l(s) : s, i])];
|
|
2762
|
+
return n.body ? p.push(" ", r("body")) : p.push(t.semi ? ";" : ""), p;
|
|
2763
|
+
}
|
|
2764
|
+
function Hl(e) {
|
|
2765
|
+
let t = K(e);
|
|
2766
|
+
return t.length === 1 && !e.typeParameters && !T(e, x.Dangling) && t[0].type === "Identifier" && !t[0].typeAnnotation && !T(t[0]) && !t[0].optional && !e.predicate && !e.returnType;
|
|
2767
|
+
}
|
|
2768
|
+
function fn(e, t) {
|
|
2769
|
+
if (t.arrowParens === "always") return false;
|
|
2770
|
+
if (t.arrowParens === "avoid") {
|
|
2771
|
+
let { node: r } = e;
|
|
2772
|
+
return Hl(r);
|
|
2773
|
+
}
|
|
2774
|
+
return false;
|
|
2775
|
+
}
|
|
2776
|
+
function rr(e, t) {
|
|
2777
|
+
let { node: r } = e, s = [G(e, t, "returnType")];
|
|
2778
|
+
return r.predicate && s.push(t("predicate")), s;
|
|
2779
|
+
}
|
|
2780
|
+
function su(e, t, r) {
|
|
2781
|
+
let { node: n } = e, s = [];
|
|
2782
|
+
if (n.argument) {
|
|
2783
|
+
let u = r("argument");
|
|
2784
|
+
Xl(t, n.argument) ? u = ["(", m([E, u]), E, ")"] : (Te(n.argument) || t.experimentalTernaries && n.argument.type === "ConditionalExpression" && (n.argument.consequent.type === "ConditionalExpression" || n.argument.alternate.type === "ConditionalExpression")) && (u = l([P("("), m([f, u]), f, P(")")])), s.push(" ", u);
|
|
2785
|
+
}
|
|
2786
|
+
let i = T(n, x.Dangling), o = t.semi && i && T(n, x.Last | x.Line);
|
|
2787
|
+
return o && s.push(";"), i && s.push(" ", v(e, t)), !o && t.semi && s.push(";"), s;
|
|
2788
|
+
}
|
|
2789
|
+
function iu(e, t, r) {
|
|
2790
|
+
return ["return", su(e, t, r)];
|
|
2791
|
+
}
|
|
2792
|
+
function ou(e, t, r) {
|
|
2793
|
+
return ["throw", su(e, t, r)];
|
|
2794
|
+
}
|
|
2795
|
+
function Xl(e, t) {
|
|
2796
|
+
if (Ee(e.originalText, t) || T(t, x.Leading, (r) => ue(e.originalText, w(r), I(r))) && !H(t)) return true;
|
|
2797
|
+
if (Xt(t)) {
|
|
2798
|
+
let r = t, n;
|
|
2799
|
+
for (; n = mi(r); ) if (r = n, Ee(e.originalText, r)) return true;
|
|
2800
|
+
}
|
|
2801
|
+
return false;
|
|
2802
|
+
}
|
|
2803
|
+
function uu(e, t) {
|
|
2804
|
+
if (t.semi || Ps(e, t) || Is(e, t) || ks(e, t)) return false;
|
|
2805
|
+
let { node: r, key: n, parent: s } = e;
|
|
2806
|
+
return !!(r.type === "ExpressionStatement" && (n === "body" && (s.type === "Program" || s.type === "BlockStatement" || s.type === "StaticBlock" || s.type === "TSModuleBlock") || n === "consequent" && s.type === "SwitchCase") && e.call(() => au(e, t), "expression"));
|
|
2807
|
+
}
|
|
2808
|
+
function au(e, t) {
|
|
2809
|
+
let { node: r } = e;
|
|
2810
|
+
switch (r.type) {
|
|
2811
|
+
case "ParenthesizedExpression":
|
|
2812
|
+
case "TypeCastExpression":
|
|
2813
|
+
case "ArrayExpression":
|
|
2814
|
+
case "ArrayPattern":
|
|
2815
|
+
case "TemplateLiteral":
|
|
2816
|
+
case "TemplateElement":
|
|
2817
|
+
case "RegExpLiteral":
|
|
2818
|
+
return true;
|
|
2819
|
+
case "ArrowFunctionExpression":
|
|
2820
|
+
if (!fn(e, t)) return true;
|
|
2821
|
+
break;
|
|
2822
|
+
case "UnaryExpression": {
|
|
2823
|
+
let { prefix: n, operator: s } = r;
|
|
2824
|
+
if (n && (s === "+" || s === "-")) return true;
|
|
2825
|
+
break;
|
|
2826
|
+
}
|
|
2827
|
+
case "BindExpression":
|
|
2828
|
+
if (!r.object) return true;
|
|
2829
|
+
break;
|
|
2830
|
+
case "Literal":
|
|
2831
|
+
if (r.regex) return true;
|
|
2832
|
+
break;
|
|
2833
|
+
default:
|
|
2834
|
+
if (H(r)) return true;
|
|
2835
|
+
}
|
|
2836
|
+
return ge(e, t) ? true : Xt(r) ? e.call(() => au(e, t), ...Rr(r)) : false;
|
|
2837
|
+
}
|
|
2838
|
+
var bs = ({ node: e, parent: t }) => e.type === "ExpressionStatement" && t.type === "Program" && t.body.length === 1 && (Array.isArray(t.directives) && t.directives.length === 0 || !t.directives);
|
|
2839
|
+
function Ps(e, t) {
|
|
2840
|
+
return (t.parentParser === "markdown" || t.parentParser === "mdx") && bs(e) && H(e.node.expression);
|
|
2841
|
+
}
|
|
2842
|
+
function ks(e, t) {
|
|
2843
|
+
return t.__isHtmlInlineEventHandler && bs(e);
|
|
2844
|
+
}
|
|
2845
|
+
function Is(e, t) {
|
|
2846
|
+
return (t.parser === "__vue_event_binding" || t.parser === "__vue_ts_event_binding") && bs(e);
|
|
2847
|
+
}
|
|
2848
|
+
var Ls = class extends Error {
|
|
2849
|
+
name = "UnexpectedNodeError";
|
|
2850
|
+
constructor(t, r, n = "type") {
|
|
2851
|
+
super(`Unexpected ${r} node ${n}: ${JSON.stringify(t[n])}.`), this.node = t;
|
|
2852
|
+
}
|
|
2853
|
+
};
|
|
2854
|
+
var Qe = Ls;
|
|
2855
|
+
function Os(e) {
|
|
2856
|
+
if (typeof e != "string") throw new TypeError("Expected a string");
|
|
2857
|
+
return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
2858
|
+
}
|
|
2859
|
+
var ws = class {
|
|
2860
|
+
#e;
|
|
2861
|
+
constructor(t) {
|
|
2862
|
+
this.#e = new Set(t);
|
|
2863
|
+
}
|
|
2864
|
+
getLeadingWhitespaceCount(t) {
|
|
2865
|
+
let r = this.#e, n = 0;
|
|
2866
|
+
for (let s = 0; s < t.length && r.has(t.charAt(s)); s++) n++;
|
|
2867
|
+
return n;
|
|
2868
|
+
}
|
|
2869
|
+
getTrailingWhitespaceCount(t) {
|
|
2870
|
+
let r = this.#e, n = 0;
|
|
2871
|
+
for (let s = t.length - 1; s >= 0 && r.has(t.charAt(s)); s--) n++;
|
|
2872
|
+
return n;
|
|
2873
|
+
}
|
|
2874
|
+
getLeadingWhitespace(t) {
|
|
2875
|
+
let r = this.getLeadingWhitespaceCount(t);
|
|
2876
|
+
return t.slice(0, r);
|
|
2877
|
+
}
|
|
2878
|
+
getTrailingWhitespace(t) {
|
|
2879
|
+
let r = this.getTrailingWhitespaceCount(t);
|
|
2880
|
+
return t.slice(t.length - r);
|
|
2881
|
+
}
|
|
2882
|
+
hasLeadingWhitespace(t) {
|
|
2883
|
+
return this.#e.has(t.charAt(0));
|
|
2884
|
+
}
|
|
2885
|
+
hasTrailingWhitespace(t) {
|
|
2886
|
+
return this.#e.has(N(0, t, -1));
|
|
2887
|
+
}
|
|
2888
|
+
trimStart(t) {
|
|
2889
|
+
let r = this.getLeadingWhitespaceCount(t);
|
|
2890
|
+
return t.slice(r);
|
|
2891
|
+
}
|
|
2892
|
+
trimEnd(t) {
|
|
2893
|
+
let r = this.getTrailingWhitespaceCount(t);
|
|
2894
|
+
return t.slice(0, t.length - r);
|
|
2895
|
+
}
|
|
2896
|
+
trim(t) {
|
|
2897
|
+
return this.trimEnd(this.trimStart(t));
|
|
2898
|
+
}
|
|
2899
|
+
split(t, r = false) {
|
|
2900
|
+
let n = `[${Os([...this.#e].join(""))}]+`, s = new RegExp(r ? `(${n})` : n, "u");
|
|
2901
|
+
return t.split(s);
|
|
2902
|
+
}
|
|
2903
|
+
hasWhitespaceCharacter(t) {
|
|
2904
|
+
let r = this.#e;
|
|
2905
|
+
return Array.prototype.some.call(t, (n) => r.has(n));
|
|
2906
|
+
}
|
|
2907
|
+
hasNonWhitespaceCharacter(t) {
|
|
2908
|
+
let r = this.#e;
|
|
2909
|
+
return Array.prototype.some.call(t, (n) => !r.has(n));
|
|
2910
|
+
}
|
|
2911
|
+
isWhitespaceOnly(t) {
|
|
2912
|
+
let r = this.#e;
|
|
2913
|
+
return Array.prototype.every.call(t, (n) => r.has(n));
|
|
2914
|
+
}
|
|
2915
|
+
#t(t) {
|
|
2916
|
+
let r = Number.POSITIVE_INFINITY;
|
|
2917
|
+
for (let n of t.split(`
|
|
2918
|
+
`)) {
|
|
2919
|
+
if (n.length === 0) continue;
|
|
2920
|
+
let s = this.getLeadingWhitespaceCount(n);
|
|
2921
|
+
if (s === 0) return 0;
|
|
2922
|
+
n.length !== s && s < r && (r = s);
|
|
2923
|
+
}
|
|
2924
|
+
return r === Number.POSITIVE_INFINITY ? 0 : r;
|
|
2925
|
+
}
|
|
2926
|
+
dedentString(t) {
|
|
2927
|
+
let r = this.#t(t);
|
|
2928
|
+
return r === 0 ? t : t.split(`
|
|
2929
|
+
`).map((n) => n.slice(r)).join(`
|
|
2930
|
+
`);
|
|
2931
|
+
}
|
|
2932
|
+
};
|
|
2933
|
+
var pu = ws;
|
|
2934
|
+
var yn = new pu(`
|
|
2935
|
+
\r `);
|
|
2936
|
+
var _s = (e) => e === "" || e === A || e === E || e === f;
|
|
2937
|
+
function Vl(e, t, r) {
|
|
2938
|
+
let { node: n } = e;
|
|
2939
|
+
if (n.type === "JSXElement" && pm(n)) return [r("openingElement"), r("closingElement")];
|
|
2940
|
+
let s = n.type === "JSXElement" ? r("openingElement") : r("openingFragment"), i = n.type === "JSXElement" ? r("closingElement") : r("closingFragment");
|
|
2941
|
+
if (n.children.length === 1 && n.children[0].type === "JSXExpressionContainer" && (n.children[0].expression.type === "TemplateLiteral" || n.children[0].expression.type === "TaggedTemplateExpression")) return [s, ...e.map(r, "children"), i];
|
|
2942
|
+
n.children = n.children.map((g) => cm(g) ? { type: "JSXText", value: " ", raw: " " } : g);
|
|
2943
|
+
let o = n.children.some(H), u = n.children.filter((g) => g.type === "JSXExpressionContainer").length > 1, p = n.type === "JSXElement" && n.openingElement.attributes.length > 1, c = ne(s) || o || p || u, y = e.parent.rootMarker === "mdx", D = t.singleQuote ? "{' '}" : '{" "}', F = y ? A : P([D, f], " "), C = n.openingElement?.name?.name === "fbt", d = $l(e, t, r, F, C), b = n.children.some((g) => Br(g));
|
|
2944
|
+
for (let g = d.length - 2; g >= 0; g--) {
|
|
2945
|
+
let S = d[g] === "" && d[g + 1] === "", j = d[g] === E && d[g + 1] === "" && d[g + 2] === E, U = (d[g] === f || d[g] === E) && d[g + 1] === "" && d[g + 2] === F, fe = d[g] === F && d[g + 1] === "" && (d[g + 2] === f || d[g + 2] === E), Y = d[g] === F && d[g + 1] === "" && d[g + 2] === F, z = d[g] === f && d[g + 1] === "" && d[g + 2] === E || d[g] === E && d[g + 1] === "" && d[g + 2] === f;
|
|
2946
|
+
j && b || S || U || Y || z ? d.splice(g, 2) : fe && d.splice(g + 1, 2);
|
|
2947
|
+
}
|
|
2948
|
+
for (; d.length > 0 && _s(N(0, d, -1)); ) d.pop();
|
|
2949
|
+
for (; d.length > 1 && _s(d[0]) && _s(d[1]); ) d.shift(), d.shift();
|
|
2950
|
+
let B = [""];
|
|
2951
|
+
for (let [g, S] of d.entries()) {
|
|
2952
|
+
if (S === F) {
|
|
2953
|
+
if (g === 1 && Vi(d[g - 1])) {
|
|
2954
|
+
if (d.length === 2) {
|
|
2955
|
+
B.push([B.pop(), D]);
|
|
2956
|
+
continue;
|
|
2957
|
+
}
|
|
2958
|
+
B.push([D, E], "");
|
|
2959
|
+
continue;
|
|
2960
|
+
} else if (g === d.length - 1) {
|
|
2961
|
+
B.push([B.pop(), D]);
|
|
2962
|
+
continue;
|
|
2963
|
+
} else if (d[g - 1] === "" && d[g - 2] === E) {
|
|
2964
|
+
B.push([B.pop(), D]);
|
|
2965
|
+
continue;
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
g % 2 === 0 ? B.push([B.pop(), S]) : B.push(S, ""), ne(S) && (c = true);
|
|
2969
|
+
}
|
|
2970
|
+
let O = b ? zr(B) : l(B, { shouldBreak: true });
|
|
2971
|
+
if (t.cursorNode?.type === "JSXText" && n.children.includes(t.cursorNode) ? O = [Tr, O, Tr] : t.nodeBeforeCursor?.type === "JSXText" && n.children.includes(t.nodeBeforeCursor) ? O = [Tr, O] : t.nodeAfterCursor?.type === "JSXText" && n.children.includes(t.nodeAfterCursor) && (O = [O, Tr]), y) return O;
|
|
2972
|
+
let h = l([s, m([E, O]), E, i]);
|
|
2973
|
+
return c ? h : nt([l([s, ...d, i]), h]);
|
|
2974
|
+
}
|
|
2975
|
+
function $l(e, t, r, n, s) {
|
|
2976
|
+
let i = "", o = [i];
|
|
2977
|
+
function u(c) {
|
|
2978
|
+
i = c, o.push([o.pop(), c]);
|
|
2979
|
+
}
|
|
2980
|
+
function p(c) {
|
|
2981
|
+
c !== "" && (i = c, o.push(c, ""));
|
|
2982
|
+
}
|
|
2983
|
+
return e.each(({ node: c, next: y }) => {
|
|
2984
|
+
if (c.type === "JSXText") {
|
|
2985
|
+
let D = pe(c);
|
|
2986
|
+
if (Br(c)) {
|
|
2987
|
+
let F = yn.split(D, true);
|
|
2988
|
+
F[0] === "" && (F.shift(), /\n/u.test(F[0]) ? p(lu(s, F[1], c, y)) : p(n), F.shift());
|
|
2989
|
+
let C;
|
|
2990
|
+
if (N(0, F, -1) === "" && (F.pop(), C = F.pop()), F.length === 0) return;
|
|
2991
|
+
for (let [d, b] of F.entries()) d % 2 === 1 ? p(A) : u(b);
|
|
2992
|
+
C !== void 0 ? /\n/u.test(C) ? p(lu(s, i, c, y)) : p(n) : p(cu(s, i, c, y));
|
|
2993
|
+
} else /\n/u.test(D) ? D.match(/\n/gu).length > 1 && p(E) : p(n);
|
|
2994
|
+
} else {
|
|
2995
|
+
let D = r();
|
|
2996
|
+
if (u(D), y && Br(y)) {
|
|
2997
|
+
let C = yn.trim(pe(y)), [d] = yn.split(C);
|
|
2998
|
+
p(cu(s, d, c, y));
|
|
2999
|
+
} else p(E);
|
|
3000
|
+
}
|
|
3001
|
+
}, "children"), o;
|
|
3002
|
+
}
|
|
3003
|
+
function cu(e, t, r, n) {
|
|
3004
|
+
return e ? "" : r.type === "JSXElement" && !r.closingElement || n?.type === "JSXElement" && !n.closingElement ? t.length === 1 ? f : E : f;
|
|
3005
|
+
}
|
|
3006
|
+
function lu(e, t, r, n) {
|
|
3007
|
+
return e ? E : t.length === 1 ? r.type === "JSXElement" && !r.closingElement || n?.type === "JSXElement" && !n.closingElement ? E : f : E;
|
|
3008
|
+
}
|
|
3009
|
+
var Kl = k(["ArrayExpression", "JSXAttribute", "JSXElement", "JSXExpressionContainer", "JSXFragment", "ExpressionStatement", "NewExpression", "CallExpression", "OptionalCallExpression", "ConditionalExpression", "JsExpressionRoot", "MatchExpressionCase"]);
|
|
3010
|
+
function Ql(e, t, r) {
|
|
3011
|
+
let { parent: n } = e;
|
|
3012
|
+
if (Kl(n)) return t;
|
|
3013
|
+
let s = zl(e), i = ge(e, r);
|
|
3014
|
+
return l([i ? "" : P("("), m([f, t]), f, i ? "" : P(")")], { shouldBreak: s });
|
|
3015
|
+
}
|
|
3016
|
+
function zl(e) {
|
|
3017
|
+
return e.match(void 0, (t, r) => r === "body" && t.type === "ArrowFunctionExpression", (t, r) => r === "arguments" && M(t)) && (e.match(void 0, void 0, void 0, (t, r) => r === "expression" && t.type === "JSXExpressionContainer") || e.match(void 0, void 0, void 0, (t, r) => r === "expression" && t.type === "ChainExpression", (t, r) => r === "expression" && t.type === "JSXExpressionContainer"));
|
|
3018
|
+
}
|
|
3019
|
+
function Zl(e, t, r) {
|
|
3020
|
+
let { node: n } = e, s = [r("name")];
|
|
3021
|
+
if (n.value) {
|
|
3022
|
+
let i;
|
|
3023
|
+
if (V(n.value)) {
|
|
3024
|
+
let o = pe(n.value), u = W(0, W(0, o.slice(1, -1), "'", "'"), """, '"'), p = wr(u, t.jsxSingleQuote);
|
|
3025
|
+
u = p === '"' ? W(0, u, '"', """) : W(0, u, "'", "'"), i = e.call(() => De(e, qe(p + u + p), t), "value");
|
|
3026
|
+
} else i = r("value");
|
|
3027
|
+
s.push("=", i);
|
|
3028
|
+
}
|
|
3029
|
+
return s;
|
|
3030
|
+
}
|
|
3031
|
+
function em(e, t, r) {
|
|
3032
|
+
let { node: n } = e, s = (i, o) => i.type === "JSXEmptyExpression" || !T(i) && (q(i) || se(i) || i.type === "ArrowFunctionExpression" || i.type === "AwaitExpression" && (s(i.argument, i) || i.argument.type === "JSXElement") || M(i) || i.type === "ChainExpression" && M(i.expression) || i.type === "FunctionExpression" || i.type === "TemplateLiteral" || i.type === "TaggedTemplateExpression" || i.type === "DoExpression" || H(o) && (i.type === "ConditionalExpression" || Te(i)));
|
|
3033
|
+
return s(n.expression, e.parent) ? l(["{", r("expression"), je, "}"]) : l(["{", m([f, r("expression")]), f, je, "}"]);
|
|
3034
|
+
}
|
|
3035
|
+
function tm(e, t, r) {
|
|
3036
|
+
let { node: n } = e, s = T(n.name) || T(n.typeArguments);
|
|
3037
|
+
if (n.selfClosing && n.attributes.length === 0 && !s) return ["<", r("name"), r("typeArguments"), " />"];
|
|
3038
|
+
if (n.attributes?.length === 1 && V(n.attributes[0].value) && !n.attributes[0].value.value.includes(`
|
|
3039
|
+
`) && !s && !T(n.attributes[0])) return l(["<", r("name"), r("typeArguments"), " ", ...e.map(r, "attributes"), n.selfClosing ? " />" : ">"]);
|
|
3040
|
+
let i = n.attributes?.some((u) => V(u.value) && u.value.value.includes(`
|
|
3041
|
+
`)), o = t.singleAttributePerLine && n.attributes.length > 1 ? E : A;
|
|
3042
|
+
return l(["<", r("name"), r("typeArguments"), m(e.map(() => [o, r()], "attributes")), ...rm(n, t, s)], { shouldBreak: i });
|
|
3043
|
+
}
|
|
3044
|
+
function rm(e, t, r) {
|
|
3045
|
+
return e.selfClosing ? [A, "/>"] : nm(e, t, r) ? [">"] : [f, ">"];
|
|
3046
|
+
}
|
|
3047
|
+
function nm(e, t, r) {
|
|
3048
|
+
let n = e.attributes.length > 0 && T(N(0, e.attributes, -1), x.Trailing);
|
|
3049
|
+
return e.attributes.length === 0 && !r || (t.bracketSameLine || t.jsxBracketSameLine) && (!r || e.attributes.length > 0) && !n;
|
|
3050
|
+
}
|
|
3051
|
+
function sm(e, t, r) {
|
|
3052
|
+
let { node: n } = e, s = ["</"], i = r("name");
|
|
3053
|
+
return T(n.name, x.Leading | x.Line) ? s.push(m([E, i]), E) : T(n.name, x.Leading | x.Block) ? s.push(" ", i) : s.push(i), s.push(">"), s;
|
|
3054
|
+
}
|
|
3055
|
+
function im(e, t) {
|
|
3056
|
+
let { node: r } = e, n = T(r), s = T(r, x.Line), i = r.type === "JSXOpeningFragment";
|
|
3057
|
+
return [i ? "<" : "</", m([s ? E : n && !i ? " " : "", v(e, t)]), s ? E : "", ">"];
|
|
3058
|
+
}
|
|
3059
|
+
function om(e, t, r) {
|
|
3060
|
+
let n = De(e, Vl(e, t, r), t);
|
|
3061
|
+
return Ql(e, n, t);
|
|
3062
|
+
}
|
|
3063
|
+
function um(e, t) {
|
|
3064
|
+
let { node: r } = e, n = T(r, x.Line);
|
|
3065
|
+
return [v(e, t, { indent: n }), n ? E : ""];
|
|
3066
|
+
}
|
|
3067
|
+
function am(e, t, r) {
|
|
3068
|
+
let { node: n } = e;
|
|
3069
|
+
return ["{", e.call(({ node: s }) => {
|
|
3070
|
+
let i = ["...", r()];
|
|
3071
|
+
return T(s) ? [m([f, De(e, i, t)]), f] : i;
|
|
3072
|
+
}, n.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"];
|
|
3073
|
+
}
|
|
3074
|
+
function mu(e, t, r) {
|
|
3075
|
+
let { node: n } = e;
|
|
3076
|
+
if (n.type.startsWith("JSX")) switch (n.type) {
|
|
3077
|
+
case "JSXAttribute":
|
|
3078
|
+
return Zl(e, t, r);
|
|
3079
|
+
case "JSXIdentifier":
|
|
3080
|
+
return n.name;
|
|
3081
|
+
case "JSXNamespacedName":
|
|
3082
|
+
return L(":", [r("namespace"), r("name")]);
|
|
3083
|
+
case "JSXMemberExpression":
|
|
3084
|
+
return L(".", [r("object"), r("property")]);
|
|
3085
|
+
case "JSXSpreadAttribute":
|
|
3086
|
+
case "JSXSpreadChild":
|
|
3087
|
+
return am(e, t, r);
|
|
3088
|
+
case "JSXExpressionContainer":
|
|
3089
|
+
return em(e, t, r);
|
|
3090
|
+
case "JSXFragment":
|
|
3091
|
+
case "JSXElement":
|
|
3092
|
+
return om(e, t, r);
|
|
3093
|
+
case "JSXOpeningElement":
|
|
3094
|
+
return tm(e, t, r);
|
|
3095
|
+
case "JSXClosingElement":
|
|
3096
|
+
return sm(e, t, r);
|
|
3097
|
+
case "JSXOpeningFragment":
|
|
3098
|
+
case "JSXClosingFragment":
|
|
3099
|
+
return im(e, t);
|
|
3100
|
+
case "JSXEmptyExpression":
|
|
3101
|
+
return um(e, t);
|
|
3102
|
+
case "JSXText":
|
|
3103
|
+
throw new Error("JSXText should be handled by JSXElement");
|
|
3104
|
+
default:
|
|
3105
|
+
throw new Qe(n, "JSX");
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
function pm(e) {
|
|
3109
|
+
if (e.children.length === 0) return true;
|
|
3110
|
+
if (e.children.length > 1) return false;
|
|
3111
|
+
let t = e.children[0];
|
|
3112
|
+
return t.type === "JSXText" && !Br(t);
|
|
3113
|
+
}
|
|
3114
|
+
function Br(e) {
|
|
3115
|
+
return e.type === "JSXText" && (yn.hasNonWhitespaceCharacter(pe(e)) || !/\n/u.test(pe(e)));
|
|
3116
|
+
}
|
|
3117
|
+
function cm(e) {
|
|
3118
|
+
return e.type === "JSXExpressionContainer" && V(e.expression) && e.expression.value === " " && !T(e.expression);
|
|
3119
|
+
}
|
|
3120
|
+
function Du(e) {
|
|
3121
|
+
let { node: t, parent: r } = e;
|
|
3122
|
+
if (!H(t) || !H(r)) return false;
|
|
3123
|
+
let { index: n, siblings: s } = e, i;
|
|
3124
|
+
for (let o = n; o > 0; o--) {
|
|
3125
|
+
let u = s[o - 1];
|
|
3126
|
+
if (!(u.type === "JSXText" && !Br(u))) {
|
|
3127
|
+
i = u;
|
|
3128
|
+
break;
|
|
3129
|
+
}
|
|
3130
|
+
}
|
|
3131
|
+
return i?.type === "JSXExpressionContainer" && i.expression.type === "JSXEmptyExpression" && Ot(i.expression);
|
|
3132
|
+
}
|
|
3133
|
+
function lm(e) {
|
|
3134
|
+
return Ot(e.node) || Du(e);
|
|
3135
|
+
}
|
|
3136
|
+
var nr = lm;
|
|
3137
|
+
function yu(e, t, r) {
|
|
3138
|
+
let { node: n } = e;
|
|
3139
|
+
if (n.type.startsWith("NG")) switch (n.type) {
|
|
3140
|
+
case "NGRoot":
|
|
3141
|
+
return r("node");
|
|
3142
|
+
case "NGPipeExpression":
|
|
3143
|
+
return on(e, t, r);
|
|
3144
|
+
case "NGChainedExpression":
|
|
3145
|
+
return l(L([";", A], e.map(() => fm(e) ? r() : ["(", r(), ")"], "expressions")));
|
|
3146
|
+
case "NGEmptyExpression":
|
|
3147
|
+
return "";
|
|
3148
|
+
case "NGMicrosyntax":
|
|
3149
|
+
return e.map(() => [e.isFirst ? "" : fu(e) ? " " : [";", A], r()], "body");
|
|
3150
|
+
case "NGMicrosyntaxKey":
|
|
3151
|
+
return /^[$_a-z][\w$]*(?:-[$_a-z][\w$])*$/iu.test(n.name) ? n.name : JSON.stringify(n.name);
|
|
3152
|
+
case "NGMicrosyntaxExpression":
|
|
3153
|
+
return [r("expression"), n.alias === null ? "" : [" as ", r("alias")]];
|
|
3154
|
+
case "NGMicrosyntaxKeyedExpression": {
|
|
3155
|
+
let { index: s, parent: i } = e, o = fu(e) || mm(e) || (s === 1 && (n.key.name === "then" || n.key.name === "else" || n.key.name === "as") || s === 2 && (n.key.name === "else" && i.body[s - 1].type === "NGMicrosyntaxKeyedExpression" && i.body[s - 1].key.name === "then" || n.key.name === "track")) && i.body[0].type === "NGMicrosyntaxExpression";
|
|
3156
|
+
return [r("key"), o ? " " : ": ", r("expression")];
|
|
3157
|
+
}
|
|
3158
|
+
case "NGMicrosyntaxLet":
|
|
3159
|
+
return ["let ", r("key"), n.value === null ? "" : [" = ", r("value")]];
|
|
3160
|
+
case "NGMicrosyntaxAs":
|
|
3161
|
+
return [r("key"), " as ", r("alias")];
|
|
3162
|
+
default:
|
|
3163
|
+
throw new Qe(n, "Angular");
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
function fu({ node: e, index: t }) {
|
|
3167
|
+
return e.type === "NGMicrosyntaxKeyedExpression" && e.key.name === "of" && t === 1;
|
|
3168
|
+
}
|
|
3169
|
+
function mm(e) {
|
|
3170
|
+
let { node: t } = e;
|
|
3171
|
+
return e.parent.body[1].key.name === "of" && t.type === "NGMicrosyntaxKeyedExpression" && t.key.name === "track" && t.key.type === "NGMicrosyntaxKey";
|
|
3172
|
+
}
|
|
3173
|
+
var Dm = k(["CallExpression", "OptionalCallExpression", "AssignmentExpression"]);
|
|
3174
|
+
function fm({ node: e }) {
|
|
3175
|
+
return Er(e, Dm);
|
|
3176
|
+
}
|
|
3177
|
+
function Ms(e, t, r) {
|
|
3178
|
+
let { node: n } = e;
|
|
3179
|
+
return l([L(A, e.map(r, "decorators")), du(n, t) ? E : A]);
|
|
3180
|
+
}
|
|
3181
|
+
function Eu(e, t, r) {
|
|
3182
|
+
return Cu(e.node) ? [L(E, e.map(r, "declaration", "decorators")), E] : "";
|
|
3183
|
+
}
|
|
3184
|
+
function Fu(e, t, r) {
|
|
3185
|
+
let { node: n, parent: s } = e, { decorators: i } = n;
|
|
3186
|
+
if (!R(i) || Cu(s) || nr(e)) return "";
|
|
3187
|
+
let o = n.type === "ClassExpression" || n.type === "ClassDeclaration" || du(n, t);
|
|
3188
|
+
return [e.key === "declaration" && Di(s) ? E : o ? ke : "", L(A, e.map(r, "decorators")), A];
|
|
3189
|
+
}
|
|
3190
|
+
function du(e, t) {
|
|
3191
|
+
return e.decorators.some((r) => Z(t.originalText, I(r)));
|
|
3192
|
+
}
|
|
3193
|
+
function Cu(e) {
|
|
3194
|
+
if (e.type !== "ExportDefaultDeclaration" && e.type !== "ExportNamedDeclaration" && e.type !== "DeclareExportDeclaration") return false;
|
|
3195
|
+
let t = e.declaration?.decorators;
|
|
3196
|
+
return R(t) && bt(e, t[0]);
|
|
3197
|
+
}
|
|
3198
|
+
var Ns = /* @__PURE__ */ new WeakMap();
|
|
3199
|
+
function Au(e) {
|
|
3200
|
+
return Ns.has(e) || Ns.set(e, e.type === "ConditionalExpression" && !ye(e, (t) => t.type === "ObjectExpression")), Ns.get(e);
|
|
3201
|
+
}
|
|
3202
|
+
var ym = (e) => e.type === "SequenceExpression";
|
|
3203
|
+
function Tu(e, t, r, n = {}) {
|
|
3204
|
+
let s = [], i, o = [], u = false, p = !n.expandLastArg && e.node.body.type === "ArrowFunctionExpression", c;
|
|
3205
|
+
(function O() {
|
|
3206
|
+
let { node: h } = e, g = Em(e, t, r, n);
|
|
3207
|
+
if (s.length === 0) s.push(g);
|
|
3208
|
+
else {
|
|
3209
|
+
let { leading: S, trailing: j } = Mt(e, t);
|
|
3210
|
+
s.push([S, g]), o.unshift(j);
|
|
3211
|
+
}
|
|
3212
|
+
p && (u || (u = h.returnType && K(h).length > 0 || h.typeParameters || K(h).some((S) => S.type !== "Identifier"))), !p || h.body.type !== "ArrowFunctionExpression" ? (i = r("body", n), c = h.body) : e.call(O, "body");
|
|
3213
|
+
})();
|
|
3214
|
+
let y = !Ee(t.originalText, c) && (ym(c) || Fm(c, i, t) || !u && Au(c)), D = e.key === "callee" && Dt(e.parent), F = /* @__PURE__ */ Symbol("arrow-chain"), C = dm(e, n, { signatureDocs: s, shouldBreak: u }), d = false, b = false, B = false;
|
|
3215
|
+
return p && (D || n.assignmentLayout) && (b = true, B = !T(e.node, x.Leading & x.Line), d = n.assignmentLayout === "chain-tail-arrow-chain" || D && !y), i = Cm(e, t, n, { bodyDoc: i, bodyComments: o, functionBody: c, shouldPutBodyOnSameLine: y }), l([l(b ? m([B ? f : "", C]) : C, { shouldBreak: d, id: F }), " =>", p ? yt(i, { groupId: F }) : l(i), p && D ? P(f, "", { groupId: F }) : ""]);
|
|
3216
|
+
}
|
|
3217
|
+
function Em(e, t, r, n) {
|
|
3218
|
+
let { node: s } = e, i = [];
|
|
3219
|
+
if (s.async && i.push("async "), fn(e, t)) i.push(r(["params", 0]));
|
|
3220
|
+
else {
|
|
3221
|
+
let u = n.expandLastArg || n.expandFirstArg, p = rr(e, r);
|
|
3222
|
+
if (u) {
|
|
3223
|
+
if (ne(p)) throw new Et();
|
|
3224
|
+
p = l(_t(p));
|
|
3225
|
+
}
|
|
3226
|
+
i.push(l([Ke(e, t, r, u, true), p]));
|
|
3227
|
+
}
|
|
3228
|
+
let o = v(e, t, { filter(u) {
|
|
3229
|
+
let p = at(t.originalText, I(u));
|
|
3230
|
+
return p !== false && t.originalText.slice(p, p + 2) === "=>";
|
|
3231
|
+
} });
|
|
3232
|
+
return o && i.push(" ", o), i;
|
|
3233
|
+
}
|
|
3234
|
+
function Fm(e, t, r) {
|
|
3235
|
+
return q(e) || se(e) || e.type === "ArrowFunctionExpression" || e.type === "DoExpression" || e.type === "BlockStatement" || H(e) || t.label?.hug !== false && (t.label?.embed || Wr(e, r.originalText));
|
|
3236
|
+
}
|
|
3237
|
+
function dm(e, t, { signatureDocs: r, shouldBreak: n }) {
|
|
3238
|
+
if (r.length === 1) return r[0];
|
|
3239
|
+
let { parent: s, key: i } = e;
|
|
3240
|
+
return i !== "callee" && Dt(s) || Te(s) ? l([r[0], " =>", m([A, L([" =>", A], r.slice(1))])], { shouldBreak: n }) : i === "callee" && Dt(s) || t.assignmentLayout ? l(L([" =>", A], r), { shouldBreak: n }) : l(m(L([" =>", A], r)), { shouldBreak: n });
|
|
3241
|
+
}
|
|
3242
|
+
function Cm(e, t, r, { bodyDoc: n, bodyComments: s, functionBody: i, shouldPutBodyOnSameLine: o }) {
|
|
3243
|
+
let { node: u, parent: p } = e, c = r.expandLastArg && ie(t, "all") ? P(",") : "", y = (r.expandLastArg || p.type === "JSXExpressionContainer") && !T(u) ? f : "";
|
|
3244
|
+
return o && Au(i) ? [" ", l([P("", "("), m([f, n]), P("", ")"), c, y]), s] : o ? [" ", n, s] : [m([A, n, s]), c, y];
|
|
3245
|
+
}
|
|
3246
|
+
var Am = Array.prototype.findLast ?? function(e) {
|
|
3247
|
+
for (let t = this.length - 1; t >= 0; t--) {
|
|
3248
|
+
let r = this[t];
|
|
3249
|
+
if (e(r, t, this)) return r;
|
|
3250
|
+
}
|
|
3251
|
+
};
|
|
3252
|
+
var Tm = Wt("findLast", function() {
|
|
3253
|
+
if (Array.isArray(this)) return Am;
|
|
3254
|
+
});
|
|
3255
|
+
var xu = Tm;
|
|
3256
|
+
function br(e, t, r, n) {
|
|
3257
|
+
let { node: s } = e, i = [], o = xu(0, s[n], (u) => u.type !== "EmptyStatement");
|
|
3258
|
+
return e.each(({ node: u }) => {
|
|
3259
|
+
u.type !== "EmptyStatement" && (i.push(r()), u !== o && (i.push(E), oe(u, t) && i.push(E)));
|
|
3260
|
+
}, n), i;
|
|
3261
|
+
}
|
|
3262
|
+
function En(e, t, r) {
|
|
3263
|
+
let n = xm(e, t, r), { node: s, parent: i } = e;
|
|
3264
|
+
if (s.type === "Program" && i?.type !== "ModuleExpression") return n ? [n, E] : "";
|
|
3265
|
+
let o = [];
|
|
3266
|
+
if (s.type === "StaticBlock" && o.push("static "), o.push("{"), n) o.push(m([E, n]), E);
|
|
3267
|
+
else {
|
|
3268
|
+
let u = e.grandparent;
|
|
3269
|
+
i.type === "ArrowFunctionExpression" || i.type === "FunctionExpression" || i.type === "FunctionDeclaration" || i.type === "ComponentDeclaration" || i.type === "HookDeclaration" || i.type === "ObjectMethod" || i.type === "ClassMethod" || i.type === "ClassPrivateMethod" || i.type === "ForStatement" || i.type === "WhileStatement" || i.type === "DoWhileStatement" || i.type === "DoExpression" || i.type === "ModuleExpression" || i.type === "CatchClause" && !u.finalizer || i.type === "TSModuleDeclaration" || i.type === "MatchStatementCase" || s.type === "StaticBlock" || o.push(E);
|
|
3270
|
+
}
|
|
3271
|
+
return o.push("}"), o;
|
|
3272
|
+
}
|
|
3273
|
+
function xm(e, t, r) {
|
|
3274
|
+
let { node: n } = e, s = R(n.directives), i = n.body.some((p) => p.type !== "EmptyStatement"), o = T(n, x.Dangling);
|
|
3275
|
+
if (!s && !i && !o) return "";
|
|
3276
|
+
let u = [];
|
|
3277
|
+
return s && (u.push(br(e, t, r, "directives")), (i || o) && (u.push(E), oe(N(0, n.directives, -1), t) && u.push(E))), i && u.push(br(e, t, r, "body")), o && u.push(v(e, t)), u;
|
|
3278
|
+
}
|
|
3279
|
+
function gm(e) {
|
|
3280
|
+
let t = /* @__PURE__ */ new WeakMap();
|
|
3281
|
+
return function(r) {
|
|
3282
|
+
return t.has(r) || t.set(r, Symbol(e)), t.get(r);
|
|
3283
|
+
};
|
|
3284
|
+
}
|
|
3285
|
+
var gu = gm;
|
|
3286
|
+
function Rt(e, t, r) {
|
|
3287
|
+
let { node: n } = e, s = [], i = n.type === "ObjectTypeAnnotation", o = !Su(e), u = o ? A : E, p = T(n, x.Dangling), [c, y] = i && n.exact ? ["{|", "|}"] : "{}", D;
|
|
3288
|
+
if (hm(e, ({ node: F, next: C, isLast: d }) => {
|
|
3289
|
+
if (D ?? (D = F), s.push(r()), o && i) {
|
|
3290
|
+
let { parent: b } = e;
|
|
3291
|
+
b.inexact || !d ? s.push(",") : ie(t) && s.push(P(","));
|
|
3292
|
+
}
|
|
3293
|
+
!o && (Sm({ node: F, next: C }, t) || bu({ node: F, next: C }, t)) && s.push(";"), d || (s.push(u), oe(F, t) && s.push(E));
|
|
3294
|
+
}), p && s.push(v(e, t)), n.type === "ObjectTypeAnnotation" && n.inexact) {
|
|
3295
|
+
let F;
|
|
3296
|
+
T(n, x.Dangling) ? F = [T(n, x.Line) || Z(t.originalText, I(N(0, et(n), -1))) ? E : A, "..."] : F = [D ? A : "", "..."], s.push(F);
|
|
3297
|
+
}
|
|
3298
|
+
if (o) {
|
|
3299
|
+
let F = p || t.objectWrap === "preserve" && D && ue(t.originalText, w(n), w(D)), C;
|
|
3300
|
+
if (s.length === 0) C = c + y;
|
|
3301
|
+
else {
|
|
3302
|
+
let d = t.bracketSpacing ? A : f;
|
|
3303
|
+
C = [c, m([d, ...s]), d, y];
|
|
3304
|
+
}
|
|
3305
|
+
return e.match(void 0, (d, b) => b === "typeAnnotation", (d, b) => b === "typeAnnotation", Nt) || e.match(void 0, (d, b) => d.type === "FunctionTypeParam" && b === "typeAnnotation", Nt) ? C : l(C, { shouldBreak: F });
|
|
3306
|
+
}
|
|
3307
|
+
return [c, s.length > 0 ? [m([E, s]), E] : "", y];
|
|
3308
|
+
}
|
|
3309
|
+
function Su(e) {
|
|
3310
|
+
let { node: t } = e;
|
|
3311
|
+
if (t.type === "ObjectTypeAnnotation") {
|
|
3312
|
+
let { key: r, parent: n } = e;
|
|
3313
|
+
return r === "body" && (n.type === "InterfaceDeclaration" || n.type === "DeclareInterface" || n.type === "DeclareClass");
|
|
3314
|
+
}
|
|
3315
|
+
return t.type === "ClassBody" || t.type === "TSInterfaceBody";
|
|
3316
|
+
}
|
|
3317
|
+
function hm(e, t) {
|
|
3318
|
+
let { node: r } = e;
|
|
3319
|
+
if (r.type === "ClassBody" || r.type === "TSInterfaceBody") {
|
|
3320
|
+
e.each(t, "body");
|
|
3321
|
+
return;
|
|
3322
|
+
}
|
|
3323
|
+
if (r.type === "TSTypeLiteral") {
|
|
3324
|
+
e.each(t, "members");
|
|
3325
|
+
return;
|
|
3326
|
+
}
|
|
3327
|
+
if (r.type === "ObjectTypeAnnotation") {
|
|
3328
|
+
let n = ["properties", "indexers", "callProperties", "internalSlots"].flatMap((s) => e.map(({ node: i, index: o }) => ({ node: i, loc: w(i), selector: [s, o] }), s)).sort((s, i) => s.loc - i.loc);
|
|
3329
|
+
for (let [s, { node: i, selector: o }] of n.entries()) e.call(() => t({ node: i, next: n[s + 1]?.node, isLast: s === n.length - 1 }), ...o);
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
function he(e, t) {
|
|
3333
|
+
let { parent: r } = e;
|
|
3334
|
+
return e.callParent(Su) ? t.semi || r.type === "ObjectTypeAnnotation" ? ";" : "" : r.type === "TSTypeLiteral" ? e.isLast ? t.semi ? P(";") : "" : t.semi || bu({ node: e.node, next: e.next }, t) ? ";" : P("", ";") : "";
|
|
3335
|
+
}
|
|
3336
|
+
var hu = k(["ClassProperty", "PropertyDefinition", "ClassPrivateProperty", "ClassAccessorProperty", "AccessorProperty", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]);
|
|
3337
|
+
var Bu = (e) => {
|
|
3338
|
+
if (e.computed || e.typeAnnotation) return false;
|
|
3339
|
+
let { type: t, name: r } = e.key;
|
|
3340
|
+
return t === "Identifier" && (r === "static" || r === "get" || r === "set");
|
|
3341
|
+
};
|
|
3342
|
+
function Sm({ node: e, next: t }, r) {
|
|
3343
|
+
if (r.semi || !hu(e)) return false;
|
|
3344
|
+
if (!e.value && Bu(e)) return true;
|
|
3345
|
+
if (!t || t.static || t.accessibility || t.readonly) return false;
|
|
3346
|
+
if (!t.computed) {
|
|
3347
|
+
let n = t.key?.name;
|
|
3348
|
+
if (n === "in" || n === "instanceof") return true;
|
|
3349
|
+
}
|
|
3350
|
+
if (hu(t) && t.variance && !t.static && !t.declare) return true;
|
|
3351
|
+
switch (t.type) {
|
|
3352
|
+
case "ClassProperty":
|
|
3353
|
+
case "PropertyDefinition":
|
|
3354
|
+
case "TSAbstractPropertyDefinition":
|
|
3355
|
+
return t.computed;
|
|
3356
|
+
case "MethodDefinition":
|
|
3357
|
+
case "TSAbstractMethodDefinition":
|
|
3358
|
+
case "ClassMethod":
|
|
3359
|
+
case "ClassPrivateMethod": {
|
|
3360
|
+
if ((t.value ? t.value.async : t.async) || t.kind === "get" || t.kind === "set") return false;
|
|
3361
|
+
let s = t.value ? t.value.generator : t.generator;
|
|
3362
|
+
return !!(t.computed || s);
|
|
3363
|
+
}
|
|
3364
|
+
case "TSIndexSignature":
|
|
3365
|
+
return true;
|
|
3366
|
+
}
|
|
3367
|
+
return false;
|
|
3368
|
+
}
|
|
3369
|
+
var Bm = k(["TSPropertySignature"]);
|
|
3370
|
+
function bu({ node: e, next: t }, r) {
|
|
3371
|
+
if (r.semi || !Bm(e)) return false;
|
|
3372
|
+
if (Bu(e)) return true;
|
|
3373
|
+
if (!t) return false;
|
|
3374
|
+
switch (t.type) {
|
|
3375
|
+
case "TSCallSignatureDeclaration":
|
|
3376
|
+
return true;
|
|
3377
|
+
}
|
|
3378
|
+
return false;
|
|
3379
|
+
}
|
|
3380
|
+
var bm = gu("heritageGroup");
|
|
3381
|
+
var Pm = k(["TSInterfaceDeclaration", "DeclareInterface", "InterfaceDeclaration", "InterfaceTypeAnnotation"]);
|
|
3382
|
+
function sr(e, t, r) {
|
|
3383
|
+
let { node: n } = e, s = Pm(n), i = [Q(e), Zt(e), s ? "interface" : "class"], o = ku(e), u = [], p = [];
|
|
3384
|
+
if (n.type !== "InterfaceTypeAnnotation") {
|
|
3385
|
+
n.id && u.push(" ");
|
|
3386
|
+
for (let y of ["id", "typeParameters"]) if (n[y]) {
|
|
3387
|
+
let { leading: D, trailing: F } = e.call(() => Mt(e, t), y);
|
|
3388
|
+
u.push(D, r(y), m(F));
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
if (n.superClass) {
|
|
3392
|
+
let y = [Lm(e, t, r), r(n.superTypeArguments ? "superTypeArguments" : "superTypeParameters")], D = e.call(() => ["extends ", De(e, y, t)], "superClass");
|
|
3393
|
+
o ? p.push(A, l(D)) : p.push(" ", D);
|
|
3394
|
+
} else p.push(vs(e, t, r, "extends"));
|
|
3395
|
+
p.push(vs(e, t, r, "mixins"), vs(e, t, r, "implements"));
|
|
3396
|
+
let c;
|
|
3397
|
+
return o ? (c = bm(n), i.push(l([...u, m(p)], { id: c }))) : i.push(...u, ...p), !s && o && km(n.body) ? i.push(P(E, " ", { groupId: c })) : i.push(" "), i.push(r("body")), i;
|
|
3398
|
+
}
|
|
3399
|
+
function km(e) {
|
|
3400
|
+
return e.type === "ObjectTypeAnnotation" ? ["properties", "indexers", "callProperties", "internalSlots"].some((t) => R(e[t])) : R(e.body);
|
|
3401
|
+
}
|
|
3402
|
+
function Pu(e) {
|
|
3403
|
+
let t = e.superClass ? 1 : 0;
|
|
3404
|
+
for (let r of ["extends", "mixins", "implements"]) if (Array.isArray(e[r]) && (t += e[r].length), t > 1) return true;
|
|
3405
|
+
return t > 1;
|
|
3406
|
+
}
|
|
3407
|
+
function Im(e) {
|
|
3408
|
+
let { node: t } = e;
|
|
3409
|
+
if (T(t.id, x.Trailing) || T(t.typeParameters, x.Trailing) || T(t.superClass) || Pu(t)) return true;
|
|
3410
|
+
if (t.superClass) return e.parent.type === "AssignmentExpression" ? false : !(t.superTypeArguments ?? t.superTypeParameters) && J(t.superClass);
|
|
3411
|
+
let r = t.extends?.[0] ?? t.mixins?.[0] ?? t.implements?.[0];
|
|
3412
|
+
return r ? r.type === "InterfaceExtends" && r.id.type === "QualifiedTypeIdentifier" && !r.typeParameters || (r.type === "TSClassImplements" || r.type === "TSInterfaceHeritage") && J(r.expression) && !r.typeArguments : false;
|
|
3413
|
+
}
|
|
3414
|
+
var js = /* @__PURE__ */ new WeakMap();
|
|
3415
|
+
function ku(e) {
|
|
3416
|
+
let { node: t } = e;
|
|
3417
|
+
return js.has(t) || js.set(t, Im(e)), js.get(t);
|
|
3418
|
+
}
|
|
3419
|
+
function vs(e, t, r, n) {
|
|
3420
|
+
let { node: s } = e;
|
|
3421
|
+
if (!R(s[n])) return "";
|
|
3422
|
+
let i = v(e, t, { marker: n }), o = L([",", A], e.map(r, n));
|
|
3423
|
+
if (!Pu(s)) {
|
|
3424
|
+
let u = [`${n} `, i, o];
|
|
3425
|
+
return ku(e) ? [A, l(u)] : [" ", u];
|
|
3426
|
+
}
|
|
3427
|
+
return [A, i, i && E, n, l(m([A, o]))];
|
|
3428
|
+
}
|
|
3429
|
+
function Lm(e, t, r) {
|
|
3430
|
+
let n = r("superClass"), { parent: s } = e;
|
|
3431
|
+
return s.type === "AssignmentExpression" ? l(P(["(", m([f, n]), f, ")"], n)) : n;
|
|
3432
|
+
}
|
|
3433
|
+
function Fn(e, t, r) {
|
|
3434
|
+
let { node: n } = e, s = [];
|
|
3435
|
+
return R(n.decorators) && s.push(Ms(e, t, r)), s.push(jt(n)), n.static && s.push("static "), s.push(Zt(e)), n.override && s.push("override "), s.push(Sr(e, t, r)), s;
|
|
3436
|
+
}
|
|
3437
|
+
function dn(e, t, r) {
|
|
3438
|
+
let { node: n } = e, s = [];
|
|
3439
|
+
R(n.decorators) && s.push(Ms(e, t, r)), s.push(Q(e), jt(n)), n.static && s.push("static "), s.push(Zt(e)), n.override && s.push("override "), n.readonly && s.push("readonly "), n.variance && s.push(r("variance")), (n.type === "ClassAccessorProperty" || n.type === "AccessorProperty" || n.type === "TSAbstractAccessorProperty") && s.push("accessor "), s.push(Ct(e, t, r), X(e), sn(e), G(e, r));
|
|
3440
|
+
let i = n.type === "TSAbstractPropertyDefinition" || n.type === "TSAbstractAccessorProperty";
|
|
3441
|
+
return [ht(e, t, r, s, " =", i ? void 0 : "value"), t.semi ? ";" : ""];
|
|
3442
|
+
}
|
|
3443
|
+
var Om = k(["TSAsExpression", "TSTypeAssertion", "TSNonNullExpression", "TSInstantiationExpression", "TSSatisfiesExpression"]);
|
|
3444
|
+
function Rs(e) {
|
|
3445
|
+
return Om(e) ? Rs(e.expression) : e;
|
|
3446
|
+
}
|
|
3447
|
+
var Iu = k(["FunctionExpression", "ArrowFunctionExpression"]);
|
|
3448
|
+
function Lu(e) {
|
|
3449
|
+
return e.type === "MemberExpression" || e.type === "OptionalMemberExpression" || e.type === "Identifier" && e.name !== "undefined";
|
|
3450
|
+
}
|
|
3451
|
+
function wm(e, t) {
|
|
3452
|
+
if (Is(e, t)) {
|
|
3453
|
+
let r = Rs(e.node.expression);
|
|
3454
|
+
return Iu(r) || Lu(r);
|
|
3455
|
+
}
|
|
3456
|
+
return !(!t.semi || Ps(e, t) || ks(e, t));
|
|
3457
|
+
}
|
|
3458
|
+
function Ou(e, t, r) {
|
|
3459
|
+
return [r("expression"), wm(e, t) ? ";" : ""];
|
|
3460
|
+
}
|
|
3461
|
+
function wu(e, t, r) {
|
|
3462
|
+
if (t.__isVueBindings || t.__isVueForBindingLeft) {
|
|
3463
|
+
let n = e.map(r, "program", "body", 0, "params");
|
|
3464
|
+
if (n.length === 1) return n[0];
|
|
3465
|
+
let s = L([",", A], n);
|
|
3466
|
+
return t.__isVueForBindingLeft ? ["(", m([f, l(s)]), f, ")"] : s;
|
|
3467
|
+
}
|
|
3468
|
+
if (t.__isEmbeddedTypescriptGenericParameters) {
|
|
3469
|
+
let n = e.map(r, "program", "body", 0, "typeParameters", "params");
|
|
3470
|
+
return L([",", A], n);
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
function Nu(e, t) {
|
|
3474
|
+
let { node: r } = e;
|
|
3475
|
+
switch (r.type) {
|
|
3476
|
+
case "RegExpLiteral":
|
|
3477
|
+
return _u(r);
|
|
3478
|
+
case "BigIntLiteral":
|
|
3479
|
+
return Cn(r.extra.raw);
|
|
3480
|
+
case "NumericLiteral":
|
|
3481
|
+
return dt(r.extra.raw);
|
|
3482
|
+
case "StringLiteral":
|
|
3483
|
+
return qe(ut(r.extra.raw, t));
|
|
3484
|
+
case "NullLiteral":
|
|
3485
|
+
return "null";
|
|
3486
|
+
case "BooleanLiteral":
|
|
3487
|
+
return String(r.value);
|
|
3488
|
+
case "DirectiveLiteral":
|
|
3489
|
+
return Mu(r.extra.raw, t);
|
|
3490
|
+
case "Literal": {
|
|
3491
|
+
if (r.regex) return _u(r.regex);
|
|
3492
|
+
if (r.bigint) return Cn(r.raw);
|
|
3493
|
+
let { value: n } = r;
|
|
3494
|
+
return typeof n == "number" ? dt(r.raw) : typeof n == "string" ? _m(e) ? Mu(r.raw, t) : qe(ut(r.raw, t)) : String(n);
|
|
3495
|
+
}
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
function _m(e) {
|
|
3499
|
+
if (e.key !== "expression") return;
|
|
3500
|
+
let { parent: t } = e;
|
|
3501
|
+
return t.type === "ExpressionStatement" && typeof t.directive == "string";
|
|
3502
|
+
}
|
|
3503
|
+
function Cn(e) {
|
|
3504
|
+
return e.toLowerCase();
|
|
3505
|
+
}
|
|
3506
|
+
function _u({ pattern: e, flags: t }) {
|
|
3507
|
+
return t = [...t].sort().join(""), `/${e}/${t}`;
|
|
3508
|
+
}
|
|
3509
|
+
var Mm = "use strict";
|
|
3510
|
+
function Mu(e, t) {
|
|
3511
|
+
let r = e.slice(1, -1);
|
|
3512
|
+
if (r === Mm || !(r.includes('"') || r.includes("'"))) {
|
|
3513
|
+
let n = t.singleQuote ? "'" : '"';
|
|
3514
|
+
return n + r + n;
|
|
3515
|
+
}
|
|
3516
|
+
return e;
|
|
3517
|
+
}
|
|
3518
|
+
function Nm(e, t, r) {
|
|
3519
|
+
let n = e.originalText.slice(t, r);
|
|
3520
|
+
for (let s of e[/* @__PURE__ */ Symbol.for("comments")]) {
|
|
3521
|
+
let i = w(s);
|
|
3522
|
+
if (i > r) break;
|
|
3523
|
+
let o = I(s);
|
|
3524
|
+
if (o < t) continue;
|
|
3525
|
+
let u = i - t, p = o - t;
|
|
3526
|
+
n = n.slice(0, u) + W(0, n.slice(u, p), /[^\n]/gu, " ") + n.slice(p);
|
|
3527
|
+
}
|
|
3528
|
+
return n;
|
|
3529
|
+
}
|
|
3530
|
+
var Jt = Nm;
|
|
3531
|
+
var ju = k(["ImportDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "DeclareExportDeclaration", "DeclareExportAllDeclaration"]);
|
|
3532
|
+
var jm = k(["EnumBooleanBody", "EnumNumberBody", "EnumBigIntBody", "EnumStringBody", "EnumSymbolBody"]);
|
|
3533
|
+
function ir(e, t, r) {
|
|
3534
|
+
let { node: n, parent: s } = e, i = jm(n), o = n.type === "TSEnumBody" || i, u = ju(n), p = i && n.hasUnknownMembers, c = o ? "members" : u ? "attributes" : "properties", y = n[c], D = o || n.type === "ObjectPattern" && s.type !== "FunctionDeclaration" && s.type !== "FunctionExpression" && s.type !== "ArrowFunctionExpression" && s.type !== "ObjectMethod" && s.type !== "ClassMethod" && s.type !== "ClassPrivateMethod" && s.type !== "AssignmentPattern" && s.type !== "CatchClause" && n.properties.some((B) => B.value && (B.value.type === "ObjectPattern" || B.value.type === "ArrayPattern")) || n.type !== "ObjectPattern" && t.objectWrap === "preserve" && y.length > 0 && vm(n, y[0], t), F = [], C = e.map(({ node: B }) => {
|
|
3535
|
+
let O = [...F, l(r())];
|
|
3536
|
+
return F = [",", A], oe(B, t) && F.push(E), O;
|
|
3537
|
+
}, c);
|
|
3538
|
+
if (p) {
|
|
3539
|
+
let B;
|
|
3540
|
+
if (T(n, x.Dangling)) {
|
|
3541
|
+
let O = T(n, x.Line);
|
|
3542
|
+
B = [v(e, t), O || Z(t.originalText, I(N(0, et(n), -1))) ? E : A, "..."];
|
|
3543
|
+
} else B = ["..."];
|
|
3544
|
+
C.push([...F, ...B]);
|
|
3545
|
+
}
|
|
3546
|
+
let d = !(p || N(0, y, -1)?.type === "RestElement"), b;
|
|
3547
|
+
if (C.length === 0) {
|
|
3548
|
+
if (!T(n, x.Dangling)) return ["{}", G(e, r)];
|
|
3549
|
+
b = l(["{", v(e, t, { indent: true }), f, "}", X(e), G(e, r)]);
|
|
3550
|
+
} else {
|
|
3551
|
+
let B = t.bracketSpacing ? A : f;
|
|
3552
|
+
b = ["{", m([B, ...C]), P(d && ie(t) ? "," : ""), B, "}", X(e), G(e, r)];
|
|
3553
|
+
}
|
|
3554
|
+
return e.match((B) => B.type === "ObjectPattern" && !R(B.decorators), Nt) || Je(n) && (e.match(void 0, (B, O) => O === "typeAnnotation", (B, O) => O === "typeAnnotation", Nt) || e.match(void 0, (B, O) => B.type === "FunctionTypeParam" && O === "typeAnnotation", Nt)) || !D && e.match((B) => B.type === "ObjectPattern", (B) => B.type === "AssignmentExpression" || B.type === "VariableDeclarator") ? b : l(b, { shouldBreak: D });
|
|
3555
|
+
}
|
|
3556
|
+
function vm(e, t, r) {
|
|
3557
|
+
let n = r.originalText, s = w(e), i = w(t);
|
|
3558
|
+
if (ju(e)) {
|
|
3559
|
+
let o = w(e), u = Jt(r, o, i);
|
|
3560
|
+
s = o + u.lastIndexOf("{");
|
|
3561
|
+
}
|
|
3562
|
+
return ue(n, s, i);
|
|
3563
|
+
}
|
|
3564
|
+
function vu(e, t, r) {
|
|
3565
|
+
let { node: n } = e;
|
|
3566
|
+
return ["import", n.phase ? ` ${n.phase}` : "", Gs(n), Gu(e, t, r), Ju(e, t, r), qu(e, t, r), t.semi ? ";" : ""];
|
|
3567
|
+
}
|
|
3568
|
+
var Ru = (e) => e.type === "ExportDefaultDeclaration" || e.type === "DeclareExportDeclaration" && e.default;
|
|
3569
|
+
function An(e, t, r) {
|
|
3570
|
+
let { node: n } = e, s = [Eu(e, t, r), Q(e), "export", Ru(n) ? " default" : ""], { declaration: i, exported: o } = n;
|
|
3571
|
+
return T(n, x.Dangling) && (s.push(" ", v(e, t)), qr(n) && s.push(E)), i ? s.push(" ", r("declaration")) : (s.push(Gm(n)), n.type === "ExportAllDeclaration" || n.type === "DeclareExportAllDeclaration" ? (s.push(" *"), o && s.push(" as ", r("exported"))) : s.push(Gu(e, t, r)), s.push(Ju(e, t, r), qu(e, t, r))), s.push(Jm(n, t)), s;
|
|
3572
|
+
}
|
|
3573
|
+
var Rm = k(["ClassDeclaration", "ComponentDeclaration", "FunctionDeclaration", "TSInterfaceDeclaration", "DeclareClass", "DeclareComponent", "DeclareFunction", "DeclareHook", "HookDeclaration", "TSDeclareFunction", "EnumDeclaration"]);
|
|
3574
|
+
function Jm(e, t) {
|
|
3575
|
+
return t.semi && (!e.declaration || Ru(e) && !Rm(e.declaration)) ? ";" : "";
|
|
3576
|
+
}
|
|
3577
|
+
function Js(e, t = true) {
|
|
3578
|
+
return e && e !== "value" ? `${t ? " " : ""}${e}${t ? "" : " "}` : "";
|
|
3579
|
+
}
|
|
3580
|
+
function Gs(e, t) {
|
|
3581
|
+
return Js(e.importKind, t);
|
|
3582
|
+
}
|
|
3583
|
+
function Gm(e) {
|
|
3584
|
+
return Js(e.exportKind);
|
|
3585
|
+
}
|
|
3586
|
+
function Ju(e, t, r) {
|
|
3587
|
+
let { node: n } = e;
|
|
3588
|
+
return n.source ? [Wu(n, t) ? " from" : "", " ", r("source")] : "";
|
|
3589
|
+
}
|
|
3590
|
+
function Gu(e, t, r) {
|
|
3591
|
+
let { node: n } = e;
|
|
3592
|
+
if (!Wu(n, t)) return "";
|
|
3593
|
+
let s = [" "];
|
|
3594
|
+
if (R(n.specifiers)) {
|
|
3595
|
+
let i = [], o = [];
|
|
3596
|
+
e.each(() => {
|
|
3597
|
+
let u = e.node.type;
|
|
3598
|
+
if (u === "ExportNamespaceSpecifier" || u === "ExportDefaultSpecifier" || u === "ImportNamespaceSpecifier" || u === "ImportDefaultSpecifier") i.push(r());
|
|
3599
|
+
else if (u === "ExportSpecifier" || u === "ImportSpecifier") o.push(r());
|
|
3600
|
+
else throw new Qe(n, "specifier");
|
|
3601
|
+
}, "specifiers"), s.push(L(", ", i)), o.length > 0 && (i.length > 0 && s.push(", "), o.length > 1 || i.length > 0 || n.specifiers.some((p) => T(p)) ? s.push(l(["{", m([t.bracketSpacing ? A : f, L([",", A], o)]), P(ie(t) ? "," : ""), t.bracketSpacing ? A : f, "}"])) : s.push(["{", t.bracketSpacing ? " " : "", ...o, t.bracketSpacing ? " " : "", "}"]));
|
|
3602
|
+
} else s.push("{}");
|
|
3603
|
+
return s;
|
|
3604
|
+
}
|
|
3605
|
+
function Wu(e, t) {
|
|
3606
|
+
return e.type !== "ImportDeclaration" || R(e.specifiers) || e.importKind === "type" ? true : Jt(t, w(e), w(e.source)).trimEnd().endsWith("from");
|
|
3607
|
+
}
|
|
3608
|
+
function Wm(e, t) {
|
|
3609
|
+
if (e.extra?.deprecatedAssertSyntax) return "assert";
|
|
3610
|
+
let r = Jt(t, I(e.source), e.attributes?.[0] ? w(e.attributes[0]) : I(e)).trimStart();
|
|
3611
|
+
return r.startsWith("assert") ? "assert" : r.startsWith("with") || R(e.attributes) ? "with" : void 0;
|
|
3612
|
+
}
|
|
3613
|
+
var qm = (e) => {
|
|
3614
|
+
let { attributes: t } = e;
|
|
3615
|
+
if (t.length !== 1) return false;
|
|
3616
|
+
let [r] = t, { type: n, key: s, value: i } = r;
|
|
3617
|
+
return n === "ImportAttribute" && (s.type === "Identifier" && s.name === "type" || V(s) && s.value === "type") && V(i) && !T(r) && !T(s) && !T(i);
|
|
3618
|
+
};
|
|
3619
|
+
function qu(e, t, r) {
|
|
3620
|
+
let { node: n } = e;
|
|
3621
|
+
if (!n.source) return "";
|
|
3622
|
+
let s = Wm(n, t);
|
|
3623
|
+
if (!s) return "";
|
|
3624
|
+
let i = ir(e, t, r);
|
|
3625
|
+
return qm(n) && (i = _t(i)), [` ${s} `, i];
|
|
3626
|
+
}
|
|
3627
|
+
function Uu(e, t, r) {
|
|
3628
|
+
let { node: n } = e, { type: s } = n, i = s.startsWith("Import"), o = i ? "imported" : "local", u = i ? "local" : "exported", p = n[o], c = n[u], y = "", D = "";
|
|
3629
|
+
return s === "ExportNamespaceSpecifier" || s === "ImportNamespaceSpecifier" ? y = "*" : p && (y = r(o)), c && !Um(n) && (D = r(u)), [Js(s === "ImportSpecifier" ? n.importKind : n.exportKind, false), y, y && D ? " as " : "", D];
|
|
3630
|
+
}
|
|
3631
|
+
function Um(e) {
|
|
3632
|
+
if (e.type !== "ImportSpecifier" && e.type !== "ExportSpecifier") return false;
|
|
3633
|
+
let { local: t, [e.type === "ImportSpecifier" ? "imported" : "exported"]: r } = e;
|
|
3634
|
+
if (t.type !== r.type || !ai(t, r)) return false;
|
|
3635
|
+
if (V(t)) return t.value === r.value && pe(t) === pe(r);
|
|
3636
|
+
switch (t.type) {
|
|
3637
|
+
case "Identifier":
|
|
3638
|
+
return t.name === r.name;
|
|
3639
|
+
default:
|
|
3640
|
+
return false;
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
function or(e, t) {
|
|
3644
|
+
return ["...", t("argument"), G(e, t)];
|
|
3645
|
+
}
|
|
3646
|
+
function Ym(e) {
|
|
3647
|
+
let t = [e];
|
|
3648
|
+
for (let r = 0; r < t.length; r++) {
|
|
3649
|
+
let n = t[r];
|
|
3650
|
+
for (let s of ["test", "consequent", "alternate"]) {
|
|
3651
|
+
let i = n[s];
|
|
3652
|
+
if (H(i)) return true;
|
|
3653
|
+
i.type === "ConditionalExpression" && t.push(i);
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3656
|
+
return false;
|
|
3657
|
+
}
|
|
3658
|
+
function Hm(e, t, r) {
|
|
3659
|
+
let { node: n } = e, s = n.type === "ConditionalExpression", i = s ? "alternate" : "falseType", { parent: o } = e, u = s ? r("test") : [r("checkType"), " ", "extends", " ", r("extendsType")];
|
|
3660
|
+
return o.type === n.type && o[i] === n ? xe(2, u) : u;
|
|
3661
|
+
}
|
|
3662
|
+
var Xm = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"], ["AwaitExpression", "argument"]]);
|
|
3663
|
+
function Vm(e) {
|
|
3664
|
+
let { node: t } = e;
|
|
3665
|
+
if (t.type !== "ConditionalExpression") return false;
|
|
3666
|
+
let r, n = t;
|
|
3667
|
+
for (let s = 0; !r; s++) {
|
|
3668
|
+
let i = e.getParentNode(s);
|
|
3669
|
+
if (i.type === "ChainExpression" && i.expression === n || M(i) && i.callee === n || J(i) && i.object === n || i.type === "TSNonNullExpression" && i.expression === n) {
|
|
3670
|
+
n = i;
|
|
3671
|
+
continue;
|
|
3672
|
+
}
|
|
3673
|
+
i.type === "NewExpression" && i.callee === n || Ae(i) && i.expression === n ? (r = e.getParentNode(s + 1), n = i) : r = i;
|
|
3674
|
+
}
|
|
3675
|
+
return n === t ? false : r[Xm.get(r.type)] === n;
|
|
3676
|
+
}
|
|
3677
|
+
function Yu(e, t, r) {
|
|
3678
|
+
let { node: n } = e, s = n.type === "ConditionalExpression", i = s ? "consequent" : "trueType", o = s ? "alternate" : "falseType", u = s ? ["test"] : ["checkType", "extendsType"], p = n[i], c = n[o], y = [], D = false, { parent: F } = e, C = F.type === n.type && u.some((Y) => F[Y] === n), d = F.type === n.type && !C, b, B, O = 0;
|
|
3679
|
+
do
|
|
3680
|
+
B = b || n, b = e.getParentNode(O), O++;
|
|
3681
|
+
while (b && b.type === n.type && u.every((Y) => b[Y] !== B));
|
|
3682
|
+
let h = b || F, g = B;
|
|
3683
|
+
if (s && (H(n[u[0]]) || H(p) || H(c) || Ym(g))) {
|
|
3684
|
+
D = true, d = true;
|
|
3685
|
+
let Y = (ee) => [P("("), m([f, ee]), f, P(")")], z = (ee) => ee.type === "NullLiteral" || ee.type === "Literal" && ee.value === null || ee.type === "Identifier" && ee.name === "undefined";
|
|
3686
|
+
y.push(" ? ", z(p) ? r(i) : Y(r(i)), " : ", c.type === n.type || z(c) ? r(o) : Y(r(o)));
|
|
3687
|
+
} else {
|
|
3688
|
+
let Y = (ee) => t.useTabs ? m(r(ee)) : xe(2, r(ee)), z = [A, "? ", p.type === n.type ? P("", "(") : "", Y(i), p.type === n.type ? P("", ")") : "", A, ": ", Y(o)];
|
|
3689
|
+
y.push(F.type !== n.type || F[o] === n || C ? z : t.useTabs ? Qr(m(z)) : xe(Math.max(0, t.tabWidth - 2), z));
|
|
3690
|
+
}
|
|
3691
|
+
let S = (Y) => F === h ? l(Y) : Y, j = !D && (J(F) || F.type === "NGPipeExpression" && F.left === n) && !F.computed, U = Vm(e), fe = S([Hm(e, t, r), d ? y : m(y), s && j && !U ? f : ""]);
|
|
3692
|
+
return C || U ? l([m([f, fe]), f]) : fe;
|
|
3693
|
+
}
|
|
3694
|
+
function $m(e, t) {
|
|
3695
|
+
return (J(t) || t.type === "NGPipeExpression" && t.left === e) && !t.computed;
|
|
3696
|
+
}
|
|
3697
|
+
function Km(e, t, r, n) {
|
|
3698
|
+
return [...e.map((i) => et(i)), et(t), et(r)].flat().some((i) => ce(i) && ue(n.originalText, w(i), I(i)));
|
|
3699
|
+
}
|
|
3700
|
+
var Qm = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"], ["AwaitExpression", "argument"]]);
|
|
3701
|
+
function zm(e) {
|
|
3702
|
+
let { node: t } = e;
|
|
3703
|
+
if (t.type !== "ConditionalExpression") return false;
|
|
3704
|
+
let r, n = t;
|
|
3705
|
+
for (let s = 0; !r; s++) {
|
|
3706
|
+
let i = e.getParentNode(s);
|
|
3707
|
+
if (i.type === "ChainExpression" && i.expression === n || M(i) && i.callee === n || J(i) && i.object === n || i.type === "TSNonNullExpression" && i.expression === n) {
|
|
3708
|
+
n = i;
|
|
3709
|
+
continue;
|
|
3710
|
+
}
|
|
3711
|
+
i.type === "NewExpression" && i.callee === n || Ae(i) && i.expression === n ? (r = e.getParentNode(s + 1), n = i) : r = i;
|
|
3712
|
+
}
|
|
3713
|
+
return n === t ? false : r[Qm.get(r.type)] === n;
|
|
3714
|
+
}
|
|
3715
|
+
var Ws = (e) => [P("("), m([f, e]), f, P(")")];
|
|
3716
|
+
function ur(e, t, r, n) {
|
|
3717
|
+
if (!t.experimentalTernaries) return Yu(e, t, r);
|
|
3718
|
+
let { node: s } = e, i = s.type === "ConditionalExpression", o = Ue(s), u = i ? "consequent" : "trueType", p = i ? "alternate" : "falseType", c = i ? ["test"] : ["checkType", "extendsType"], y = s[u], D = s[p], F = c.map((mr) => s[mr]), { parent: C } = e, d = C.type === s.type, b = d && c.some((mr) => C[mr] === s), B = d && C[p] === s, O = y.type === s.type, h = D.type === s.type, g = h || B, S = t.tabWidth > 2 || t.useTabs, j, U, fe = 0;
|
|
3719
|
+
do
|
|
3720
|
+
U = j || s, j = e.getParentNode(fe), fe++;
|
|
3721
|
+
while (j && j.type === s.type && c.every((mr) => j[mr] !== U));
|
|
3722
|
+
let Y = j || C, z = n && n.assignmentLayout && n.assignmentLayout !== "break-after-operator" && (C.type === "AssignmentExpression" || C.type === "VariableDeclarator" || C.type === "ClassProperty" || C.type === "PropertyDefinition" || C.type === "ClassPrivateProperty" || C.type === "ObjectProperty" || C.type === "Property"), ee = (C.type === "ReturnStatement" || C.type === "ThrowStatement") && !(O || h), Ie = i && Y.type === "JSXExpressionContainer" && e.grandparent.type !== "JSXAttribute", st = zm(e), _ = $m(s, C), re = o && ge(e, t), ae = S ? t.useTabs ? " " : " ".repeat(t.tabWidth - 1) : "", it = Km(F, y, D, t) || O || h, Bt = !g && !d && !o && (Ie ? y.type === "NullLiteral" || y.type === "Literal" && y.value === null : Fr(y, t) && Vn(s.test, 3)), Mn = g || B || o && !d || d && i && Vn(s.test, 1) || Bt, Pr = [];
|
|
3723
|
+
!O && T(y, x.Dangling) && e.call(() => {
|
|
3724
|
+
Pr.push(v(e, t), E);
|
|
3725
|
+
}, "consequent");
|
|
3726
|
+
let cr = [];
|
|
3727
|
+
T(s.test, x.Dangling) && e.call(() => {
|
|
3728
|
+
cr.push(v(e, t));
|
|
3729
|
+
}, "test"), !h && T(D, x.Dangling) && e.call(() => {
|
|
3730
|
+
cr.push(v(e, t));
|
|
3731
|
+
}, "alternate"), T(s, x.Dangling) && cr.push(v(e, t));
|
|
3732
|
+
let Vs = /* @__PURE__ */ Symbol("test"), xa = /* @__PURE__ */ Symbol("consequent"), kr = /* @__PURE__ */ Symbol("test-and-consequent"), ga = i ? [Ws(r("test")), s.test.type === "ConditionalExpression" ? ke : ""] : [r("checkType"), " ", "extends", " ", Ue(s.extendsType) || s.extendsType.type === "TSMappedType" ? r("extendsType") : l(Ws(r("extendsType")))], $s = l([ga, " ?"], { id: Vs }), ha = r(u), Ir = m([O || Ie && (H(y) || d || g) ? E : A, Pr, ha]), Sa = Mn ? l([$s, g ? Ir : P(Ir, l(Ir, { id: xa }), { groupId: Vs })], { id: kr }) : [$s, Ir], Nn = r(p), Ks = Bt ? P(Nn, Qr(Ws(Nn)), { groupId: kr }) : Nn, lr = [Sa, cr.length > 0 ? [m([E, cr]), E] : h ? E : Bt ? P(A, " ", { groupId: kr }) : A, ":", h ? " " : S ? Mn ? P(ae, P(g || Bt ? " " : ae, " "), { groupId: kr }) : P(ae, " ") : " ", h ? Ks : l([m(Ks), Ie && !Bt ? f : ""]), _ && !st ? f : "", it ? ke : ""];
|
|
3733
|
+
return z && !it ? l(m([f, l(lr)])) : z || ee ? l(m(lr)) : st || o && b ? l([m([f, lr]), re ? f : ""]) : C === Y ? l(lr) : lr;
|
|
3734
|
+
}
|
|
3735
|
+
function Hu(e, t, r, n) {
|
|
3736
|
+
let { node: s } = e;
|
|
3737
|
+
if (Jr(s)) return Nu(e, t);
|
|
3738
|
+
switch (s.type) {
|
|
3739
|
+
case "JsExpressionRoot":
|
|
3740
|
+
return r("node");
|
|
3741
|
+
case "JsonRoot":
|
|
3742
|
+
return [v(e, t), r("node"), E];
|
|
3743
|
+
case "File":
|
|
3744
|
+
return wu(e, t, r) ?? r("program");
|
|
3745
|
+
case "ExpressionStatement":
|
|
3746
|
+
return Ou(e, t, r);
|
|
3747
|
+
case "ChainExpression":
|
|
3748
|
+
return r("expression");
|
|
3749
|
+
case "ParenthesizedExpression":
|
|
3750
|
+
return !T(s.expression) && (se(s.expression) || q(s.expression)) ? ["(", r("expression"), ")"] : l(["(", m([f, r("expression")]), f, ")"]);
|
|
3751
|
+
case "AssignmentExpression":
|
|
3752
|
+
return zo(e, t, r);
|
|
3753
|
+
case "VariableDeclarator":
|
|
3754
|
+
return Zo(e, t, r);
|
|
3755
|
+
case "BinaryExpression":
|
|
3756
|
+
case "LogicalExpression":
|
|
3757
|
+
return on(e, t, r);
|
|
3758
|
+
case "AssignmentPattern":
|
|
3759
|
+
return [r("left"), " = ", r("right")];
|
|
3760
|
+
case "OptionalMemberExpression":
|
|
3761
|
+
case "MemberExpression":
|
|
3762
|
+
return Ho(e, t, r);
|
|
3763
|
+
case "MetaProperty":
|
|
3764
|
+
return [r("meta"), ".", r("property")];
|
|
3765
|
+
case "BindExpression":
|
|
3766
|
+
return Yo(e, t, r);
|
|
3767
|
+
case "Identifier":
|
|
3768
|
+
return [s.name, X(e), sn(e), G(e, r)];
|
|
3769
|
+
case "V8IntrinsicIdentifier":
|
|
3770
|
+
return ["%", s.name];
|
|
3771
|
+
case "SpreadElement":
|
|
3772
|
+
return or(e, r);
|
|
3773
|
+
case "RestElement":
|
|
3774
|
+
return or(e, r);
|
|
3775
|
+
case "FunctionDeclaration":
|
|
3776
|
+
case "FunctionExpression":
|
|
3777
|
+
return mn(e, t, r, n);
|
|
3778
|
+
case "ArrowFunctionExpression":
|
|
3779
|
+
return Tu(e, t, r, n);
|
|
3780
|
+
case "YieldExpression":
|
|
3781
|
+
return [`yield${s.delegate ? "*" : ""}`, s.argument ? [" ", r("argument")] : ""];
|
|
3782
|
+
case "AwaitExpression": {
|
|
3783
|
+
let i = ["await"];
|
|
3784
|
+
if (s.argument) {
|
|
3785
|
+
i.push(" ", r("argument"));
|
|
3786
|
+
let { parent: o } = e;
|
|
3787
|
+
if (M(o) && o.callee === s || J(o) && o.object === s) {
|
|
3788
|
+
i = [m([f, ...i]), f];
|
|
3789
|
+
let u = e.findAncestor((p) => p.type === "AwaitExpression" || p.type === "BlockStatement");
|
|
3790
|
+
if (u?.type !== "AwaitExpression" || !ye(u.argument, (p) => p === s)) return l(i);
|
|
3791
|
+
}
|
|
3792
|
+
}
|
|
3793
|
+
return i;
|
|
3794
|
+
}
|
|
3795
|
+
case "ExportDefaultDeclaration":
|
|
3796
|
+
case "ExportNamedDeclaration":
|
|
3797
|
+
case "ExportAllDeclaration":
|
|
3798
|
+
return An(e, t, r);
|
|
3799
|
+
case "ImportDeclaration":
|
|
3800
|
+
return vu(e, t, r);
|
|
3801
|
+
case "ImportSpecifier":
|
|
3802
|
+
case "ExportSpecifier":
|
|
3803
|
+
case "ImportNamespaceSpecifier":
|
|
3804
|
+
case "ExportNamespaceSpecifier":
|
|
3805
|
+
case "ImportDefaultSpecifier":
|
|
3806
|
+
case "ExportDefaultSpecifier":
|
|
3807
|
+
return Uu(e, t, r);
|
|
3808
|
+
case "ImportAttribute":
|
|
3809
|
+
return ln(e, t, r);
|
|
3810
|
+
case "Program":
|
|
3811
|
+
case "BlockStatement":
|
|
3812
|
+
case "StaticBlock":
|
|
3813
|
+
return En(e, t, r);
|
|
3814
|
+
case "ClassBody":
|
|
3815
|
+
return Rt(e, t, r);
|
|
3816
|
+
case "ThrowStatement":
|
|
3817
|
+
return ou(e, t, r);
|
|
3818
|
+
case "ReturnStatement":
|
|
3819
|
+
return iu(e, t, r);
|
|
3820
|
+
case "NewExpression":
|
|
3821
|
+
case "ImportExpression":
|
|
3822
|
+
case "OptionalCallExpression":
|
|
3823
|
+
case "CallExpression":
|
|
3824
|
+
return vt(e, t, r);
|
|
3825
|
+
case "ObjectExpression":
|
|
3826
|
+
case "ObjectPattern":
|
|
3827
|
+
return ir(e, t, r);
|
|
3828
|
+
case "Property":
|
|
3829
|
+
return mt(s) ? Sr(e, t, r) : ln(e, t, r);
|
|
3830
|
+
case "ObjectProperty":
|
|
3831
|
+
return ln(e, t, r);
|
|
3832
|
+
case "ObjectMethod":
|
|
3833
|
+
return Sr(e, t, r);
|
|
3834
|
+
case "Decorator":
|
|
3835
|
+
return ["@", r("expression")];
|
|
3836
|
+
case "ArrayExpression":
|
|
3837
|
+
case "ArrayPattern":
|
|
3838
|
+
return tr(e, t, r);
|
|
3839
|
+
case "SequenceExpression": {
|
|
3840
|
+
let { parent: i } = e;
|
|
3841
|
+
if (i.type === "ExpressionStatement" || i.type === "ForStatement") {
|
|
3842
|
+
let u = [];
|
|
3843
|
+
return e.each(({ isFirst: p }) => {
|
|
3844
|
+
p ? u.push(r()) : u.push(",", m([A, r()]));
|
|
3845
|
+
}, "expressions"), l(u);
|
|
3846
|
+
}
|
|
3847
|
+
let o = L([",", A], e.map(r, "expressions"));
|
|
3848
|
+
return (i.type === "ReturnStatement" || i.type === "ThrowStatement") && e.key === "argument" || i.type === "ArrowFunctionExpression" && e.key === "body" ? l(P([m([f, o]), f], o)) : l(o);
|
|
3849
|
+
}
|
|
3850
|
+
case "ThisExpression":
|
|
3851
|
+
return "this";
|
|
3852
|
+
case "Super":
|
|
3853
|
+
return "super";
|
|
3854
|
+
case "Directive":
|
|
3855
|
+
return [r("value"), t.semi ? ";" : ""];
|
|
3856
|
+
case "UnaryExpression": {
|
|
3857
|
+
let i = [s.operator];
|
|
3858
|
+
return /[a-z]$/u.test(s.operator) && i.push(" "), T(s.argument) ? i.push(l(["(", m([f, r("argument")]), f, ")"])) : i.push(r("argument")), i;
|
|
3859
|
+
}
|
|
3860
|
+
case "UpdateExpression":
|
|
3861
|
+
return [s.prefix ? s.operator : "", r("argument"), s.prefix ? "" : s.operator];
|
|
3862
|
+
case "ConditionalExpression":
|
|
3863
|
+
return ur(e, t, r, n);
|
|
3864
|
+
case "VariableDeclaration": {
|
|
3865
|
+
let i = e.map(r, "declarations"), o = e.parent, u = o.type === "ForStatement" || o.type === "ForInStatement" || o.type === "ForOfStatement", p = s.declarations.some((y) => y.init), c;
|
|
3866
|
+
return i.length === 1 && !T(s.declarations[0]) ? c = i[0] : i.length > 0 && (c = m(i[0])), l([Q(e), s.kind, c ? [" ", c] : "", m(i.slice(1).map((y) => [",", p && !u ? E : A, y])), t.semi && !(u && o.body !== s) ? ";" : ""]);
|
|
3867
|
+
}
|
|
3868
|
+
case "WithStatement":
|
|
3869
|
+
return l(["with (", r("object"), ")", Ft(s.body, r("body"))]);
|
|
3870
|
+
case "IfStatement": {
|
|
3871
|
+
let i = Ft(s.consequent, r("consequent")), u = [l(["if (", l([m([f, r("test")]), f]), ")", i])];
|
|
3872
|
+
if (s.alternate) {
|
|
3873
|
+
let p = T(s.consequent, x.Trailing | x.Line) || qr(s), c = s.consequent.type === "BlockStatement" && !p;
|
|
3874
|
+
u.push(c ? " " : E), T(s, x.Dangling) && u.push(v(e, t), p ? E : " "), u.push("else", l(Ft(s.alternate, r("alternate"), s.alternate.type === "IfStatement")));
|
|
3875
|
+
}
|
|
3876
|
+
return u;
|
|
3877
|
+
}
|
|
3878
|
+
case "ForStatement": {
|
|
3879
|
+
let i = Ft(s.body, r("body")), o = v(e, t), u = o ? [o, f] : "";
|
|
3880
|
+
return !s.init && !s.test && !s.update ? [u, l(["for (;;)", i])] : [u, l(["for (", l([m([f, r("init"), ";", A, r("test"), ";", s.update ? [A, r("update")] : P("", A)]), f]), ")", i])];
|
|
3881
|
+
}
|
|
3882
|
+
case "WhileStatement":
|
|
3883
|
+
return l(["while (", l([m([f, r("test")]), f]), ")", Ft(s.body, r("body"))]);
|
|
3884
|
+
case "ForInStatement":
|
|
3885
|
+
return l(["for (", r("left"), " in ", r("right"), ")", Ft(s.body, r("body"))]);
|
|
3886
|
+
case "ForOfStatement":
|
|
3887
|
+
return l(["for", s.await ? " await" : "", " (", r("left"), " of ", r("right"), ")", Ft(s.body, r("body"))]);
|
|
3888
|
+
case "DoWhileStatement": {
|
|
3889
|
+
let i = Ft(s.body, r("body"));
|
|
3890
|
+
return [l(["do", i]), s.body.type === "BlockStatement" ? " " : E, "while (", l([m([f, r("test")]), f]), ")", t.semi ? ";" : ""];
|
|
3891
|
+
}
|
|
3892
|
+
case "DoExpression":
|
|
3893
|
+
return [s.async ? "async " : "", "do ", r("body")];
|
|
3894
|
+
case "BreakStatement":
|
|
3895
|
+
case "ContinueStatement":
|
|
3896
|
+
return [s.type === "BreakStatement" ? "break" : "continue", s.label ? [" ", r("label")] : "", t.semi ? ";" : ""];
|
|
3897
|
+
case "LabeledStatement":
|
|
3898
|
+
return [r("label"), `:${s.body.type === "EmptyStatement" && !T(s.body, x.Leading) ? "" : " "}`, r("body")];
|
|
3899
|
+
case "TryStatement":
|
|
3900
|
+
return ["try ", r("block"), s.handler ? [" ", r("handler")] : "", s.finalizer ? [" finally ", r("finalizer")] : ""];
|
|
3901
|
+
case "CatchClause":
|
|
3902
|
+
if (s.param) {
|
|
3903
|
+
let i = T(s.param, (u) => !ce(u) || u.leading && Z(t.originalText, I(u)) || u.trailing && Z(t.originalText, w(u), { backwards: true })), o = r("param");
|
|
3904
|
+
return ["catch ", i ? ["(", m([f, o]), f, ") "] : ["(", o, ") "], r("body")];
|
|
3905
|
+
}
|
|
3906
|
+
return ["catch ", r("body")];
|
|
3907
|
+
case "SwitchStatement":
|
|
3908
|
+
return [l(["switch (", m([f, r("discriminant")]), f, ")"]), " {", s.cases.length > 0 ? m([E, L(E, e.map(({ node: i, isLast: o }) => [r(), !o && oe(i, t) ? E : ""], "cases"))]) : "", E, "}"];
|
|
3909
|
+
case "SwitchCase": {
|
|
3910
|
+
let i = [];
|
|
3911
|
+
s.test ? i.push("case ", r("test"), ":") : i.push("default:"), T(s, x.Dangling) && i.push(" ", v(e, t));
|
|
3912
|
+
let o = s.consequent.filter((u) => u.type !== "EmptyStatement");
|
|
3913
|
+
if (o.length > 0) {
|
|
3914
|
+
let u = br(e, t, r, "consequent");
|
|
3915
|
+
i.push(o.length === 1 && o[0].type === "BlockStatement" ? [" ", u] : m([E, u]));
|
|
3916
|
+
}
|
|
3917
|
+
return i;
|
|
3918
|
+
}
|
|
3919
|
+
case "DebuggerStatement":
|
|
3920
|
+
return ["debugger", t.semi ? ";" : ""];
|
|
3921
|
+
case "ClassDeclaration":
|
|
3922
|
+
case "ClassExpression":
|
|
3923
|
+
return sr(e, t, r);
|
|
3924
|
+
case "ClassMethod":
|
|
3925
|
+
case "ClassPrivateMethod":
|
|
3926
|
+
case "MethodDefinition":
|
|
3927
|
+
return Fn(e, t, r);
|
|
3928
|
+
case "ClassProperty":
|
|
3929
|
+
case "PropertyDefinition":
|
|
3930
|
+
case "ClassPrivateProperty":
|
|
3931
|
+
case "ClassAccessorProperty":
|
|
3932
|
+
case "AccessorProperty":
|
|
3933
|
+
return dn(e, t, r);
|
|
3934
|
+
case "TemplateElement":
|
|
3935
|
+
return qe(s.value.raw);
|
|
3936
|
+
case "TemplateLiteral":
|
|
3937
|
+
return en(e, t, r);
|
|
3938
|
+
case "TaggedTemplateExpression":
|
|
3939
|
+
return io(e, t, r);
|
|
3940
|
+
case "PrivateIdentifier":
|
|
3941
|
+
return ["#", s.name];
|
|
3942
|
+
case "PrivateName":
|
|
3943
|
+
return ["#", r("id")];
|
|
3944
|
+
case "TopicReference":
|
|
3945
|
+
return "%";
|
|
3946
|
+
case "ArgumentPlaceholder":
|
|
3947
|
+
return "?";
|
|
3948
|
+
case "ModuleExpression":
|
|
3949
|
+
return ["module ", r("body")];
|
|
3950
|
+
case "VoidPattern":
|
|
3951
|
+
return "void";
|
|
3952
|
+
case "EmptyStatement":
|
|
3953
|
+
if (kt(e)) return ";";
|
|
3954
|
+
case "InterpreterDirective":
|
|
3955
|
+
default:
|
|
3956
|
+
throw new Qe(s, "ESTree");
|
|
3957
|
+
}
|
|
3958
|
+
}
|
|
3959
|
+
function Tn(e) {
|
|
3960
|
+
return [e("elementType"), "[]"];
|
|
3961
|
+
}
|
|
3962
|
+
var Zm = k(["SatisfiesExpression", "TSSatisfiesExpression"]);
|
|
3963
|
+
function xn(e, t, r) {
|
|
3964
|
+
let { parent: n, node: s, key: i } = e, u = s.type === "AsConstExpression" ? "const" : r("typeAnnotation"), p = [r("expression"), " ", Zm(s) ? "satisfies" : "as", " ", u];
|
|
3965
|
+
return i === "callee" && M(n) || i === "object" && J(n) ? l([m([f, ...p]), f]) : p;
|
|
3966
|
+
}
|
|
3967
|
+
function Xu(e, t, r) {
|
|
3968
|
+
let { node: n } = e, s = [Q(e), "component"];
|
|
3969
|
+
n.id && s.push(" ", r("id")), s.push(r("typeParameters"));
|
|
3970
|
+
let i = eD(e, t, r);
|
|
3971
|
+
return n.rendersType ? s.push(l([i, " ", r("rendersType")])) : s.push(l([i])), n.body && s.push(" ", r("body")), t.semi && n.type === "DeclareComponent" && s.push(";"), s;
|
|
3972
|
+
}
|
|
3973
|
+
function eD(e, t, r) {
|
|
3974
|
+
let { node: n } = e, s = n.params;
|
|
3975
|
+
if (n.rest && (s = [...s, n.rest]), s.length === 0) return ["(", v(e, t, { filter: (o) => _e(t.originalText, I(o)) === ")" }), ")"];
|
|
3976
|
+
let i = [];
|
|
3977
|
+
return rD(e, (o, u) => {
|
|
3978
|
+
let p = u === s.length - 1;
|
|
3979
|
+
p && n.rest && i.push("..."), i.push(r()), !p && (i.push(","), oe(s[u], t) ? i.push(E, E) : i.push(A));
|
|
3980
|
+
}), ["(", m([f, ...i]), P(ie(t, "all") && !tD(n, s) ? "," : ""), f, ")"];
|
|
3981
|
+
}
|
|
3982
|
+
function tD(e, t) {
|
|
3983
|
+
return e.rest || N(0, t, -1)?.type === "RestElement";
|
|
3984
|
+
}
|
|
3985
|
+
function rD(e, t) {
|
|
3986
|
+
let { node: r } = e, n = 0, s = (i) => t(i, n++);
|
|
3987
|
+
e.each(s, "params"), r.rest && e.call(s, "rest");
|
|
3988
|
+
}
|
|
3989
|
+
function Vu(e, t, r) {
|
|
3990
|
+
let { node: n } = e;
|
|
3991
|
+
return n.shorthand ? r("local") : [r("name"), " as ", r("local")];
|
|
3992
|
+
}
|
|
3993
|
+
function $u(e, t, r) {
|
|
3994
|
+
let { node: n } = e, s = [];
|
|
3995
|
+
return n.name && s.push(r("name"), n.optional ? "?: " : ": "), s.push(r("typeAnnotation")), s;
|
|
3996
|
+
}
|
|
3997
|
+
function qs(e, t, r) {
|
|
3998
|
+
return ir(e, t, r);
|
|
3999
|
+
}
|
|
4000
|
+
function Ku(e, t, r) {
|
|
4001
|
+
let { node: n } = e;
|
|
4002
|
+
return [n.type === "EnumSymbolBody" || n.explicitType ? `of ${n.type.slice(4, -4).toLowerCase()} ` : "", qs(e, t, r)];
|
|
4003
|
+
}
|
|
4004
|
+
function gn(e, t) {
|
|
4005
|
+
let { node: r } = e, n = t("id");
|
|
4006
|
+
r.computed && (n = ["[", n, "]"]);
|
|
4007
|
+
let s = "";
|
|
4008
|
+
return r.initializer && (s = t("initializer")), r.init && (s = t("init")), s ? [n, " = ", s] : n;
|
|
4009
|
+
}
|
|
4010
|
+
function hn(e, t) {
|
|
4011
|
+
let { node: r } = e;
|
|
4012
|
+
return [Q(e), r.const ? "const " : "", "enum ", t("id"), " ", t("body")];
|
|
4013
|
+
}
|
|
4014
|
+
function Sn(e, t, r) {
|
|
4015
|
+
let { node: n } = e, s = [Zt(e)];
|
|
4016
|
+
(n.type === "TSConstructorType" || n.type === "TSConstructSignatureDeclaration") && s.push("new ");
|
|
4017
|
+
let i = Ke(e, t, r, false, true), o = [];
|
|
4018
|
+
return n.type === "FunctionTypeAnnotation" ? o.push(nD(e) ? " => " : ": ", r("returnType")) : o.push(G(e, r, "returnType")), lt(n, o) && (i = l(i)), s.push(i, o), [l(s), n.type === "TSConstructSignatureDeclaration" || n.type === "TSCallSignatureDeclaration" ? he(e, t) : ""];
|
|
4019
|
+
}
|
|
4020
|
+
function nD(e) {
|
|
4021
|
+
let { node: t, parent: r } = e;
|
|
4022
|
+
return t.type === "FunctionTypeAnnotation" && (Gr(r) || !((r.type === "ObjectTypeProperty" || r.type === "ObjectTypeInternalSlot") && !r.variance && !r.optional && bt(r, t) || r.type === "ObjectTypeCallProperty" || e.getParentNode(2)?.type === "DeclareFunction"));
|
|
4023
|
+
}
|
|
4024
|
+
function zu(e, t, r) {
|
|
4025
|
+
let { node: n } = e, s = ["hook"];
|
|
4026
|
+
n.id && s.push(" ", r("id"));
|
|
4027
|
+
let i = Ke(e, t, r, false, true), o = rr(e, r), u = lt(n, o);
|
|
4028
|
+
return s.push(l([u ? l(i) : i, o]), n.body ? " " : "", r("body")), s;
|
|
4029
|
+
}
|
|
4030
|
+
function Zu(e, t, r) {
|
|
4031
|
+
let { node: n } = e, s = [Q(e), "hook"];
|
|
4032
|
+
return n.id && s.push(" ", r("id")), t.semi && s.push(";"), s;
|
|
4033
|
+
}
|
|
4034
|
+
function Qu(e) {
|
|
4035
|
+
let { node: t } = e;
|
|
4036
|
+
return t.type === "HookTypeAnnotation" && e.getParentNode(2)?.type === "DeclareHook";
|
|
4037
|
+
}
|
|
4038
|
+
function ea(e, t, r) {
|
|
4039
|
+
let { node: n } = e, s = Ke(e, t, r, false, true), i = [Qu(e) ? ": " : " => ", r("returnType")];
|
|
4040
|
+
return l([Qu(e) ? "" : "hook ", lt(n, i) ? l(s) : s, i]);
|
|
4041
|
+
}
|
|
4042
|
+
function Bn(e, t, r) {
|
|
4043
|
+
return [r("objectType"), X(e), "[", r("indexType"), "]"];
|
|
4044
|
+
}
|
|
4045
|
+
function bn(e, t, r) {
|
|
4046
|
+
return ["infer ", r("typeParameter")];
|
|
4047
|
+
}
|
|
4048
|
+
function Pn(e, t, r) {
|
|
4049
|
+
let n = false;
|
|
4050
|
+
return l(e.map(({ isFirst: s, previous: i, node: o, index: u }) => {
|
|
4051
|
+
let p = r();
|
|
4052
|
+
if (s) return p;
|
|
4053
|
+
let c = Je(o), y = Je(i);
|
|
4054
|
+
return y && c ? [" & ", n ? m(p) : p] : !y && !c || Ee(t.originalText, o) ? t.experimentalOperatorPosition === "start" ? m([A, "& ", p]) : m([" &", A, p]) : (u > 1 && (n = true), [" & ", u > 1 ? m(p) : p]);
|
|
4055
|
+
}, "types"));
|
|
4056
|
+
}
|
|
4057
|
+
function sD(e) {
|
|
4058
|
+
switch (e) {
|
|
4059
|
+
case null:
|
|
4060
|
+
return "";
|
|
4061
|
+
case "PlusOptional":
|
|
4062
|
+
return "+?";
|
|
4063
|
+
case "MinusOptional":
|
|
4064
|
+
return "-?";
|
|
4065
|
+
case "Optional":
|
|
4066
|
+
return "?";
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
function ra(e, t, r) {
|
|
4070
|
+
let { node: n } = e;
|
|
4071
|
+
return [l([n.variance ? r("variance") : "", "[", m([r("keyTparam"), " in ", r("sourceType")]), "]", sD(n.optional), ": ", r("propType")]), he(e, t)];
|
|
4072
|
+
}
|
|
4073
|
+
function ta(e, t) {
|
|
4074
|
+
return e === "+" || e === "-" ? e + t : t;
|
|
4075
|
+
}
|
|
4076
|
+
function na(e, t, r) {
|
|
4077
|
+
let { node: n } = e, s = false;
|
|
4078
|
+
if (t.objectWrap === "preserve") {
|
|
4079
|
+
let i = w(n), o = Jt(t, i + 1, w(n.key)), u = i + 1 + o.search(/\S/u);
|
|
4080
|
+
ue(t.originalText, i, u) && (s = true);
|
|
4081
|
+
}
|
|
4082
|
+
return l(["{", m([t.bracketSpacing ? A : f, T(n, x.Dangling) ? l([v(e, t), E]) : "", l([n.readonly ? [ta(n.readonly, "readonly"), " "] : "", "[", r("key"), " in ", r("constraint"), n.nameType ? [" as ", r("nameType")] : "", "]", n.optional ? ta(n.optional, "?") : "", n.typeAnnotation ? ": " : "", r("typeAnnotation")]), t.semi ? P(";") : ""]), t.bracketSpacing ? A : f, "}"], { shouldBreak: s });
|
|
4083
|
+
}
|
|
4084
|
+
function sa(e, t, r) {
|
|
4085
|
+
let { node: n } = e;
|
|
4086
|
+
return [l(["match (", m([f, r("argument")]), f, ")"]), " {", n.cases.length > 0 ? m([E, L(E, e.map(({ node: s, isLast: i }) => [r(), !i && oe(s, t) ? E : ""], "cases"))]) : "", E, "}"];
|
|
4087
|
+
}
|
|
4088
|
+
function ia(e, t, r) {
|
|
4089
|
+
let { node: n } = e, s = T(n, x.Dangling) ? [" ", v(e, t)] : [], i = n.type === "MatchStatementCase" ? [" ", r("body")] : m([A, r("body"), ","]);
|
|
4090
|
+
return [r("pattern"), n.guard ? l([m([A, "if (", r("guard"), ")"])]) : "", l([" =>", s, i])];
|
|
4091
|
+
}
|
|
4092
|
+
function oa(e, t, r) {
|
|
4093
|
+
let { node: n } = e;
|
|
4094
|
+
switch (n.type) {
|
|
4095
|
+
case "MatchOrPattern":
|
|
4096
|
+
return uD(e, t, r);
|
|
4097
|
+
case "MatchAsPattern":
|
|
4098
|
+
return [r("pattern"), " as ", r("target")];
|
|
4099
|
+
case "MatchWildcardPattern":
|
|
4100
|
+
return ["_"];
|
|
4101
|
+
case "MatchLiteralPattern":
|
|
4102
|
+
return r("literal");
|
|
4103
|
+
case "MatchUnaryPattern":
|
|
4104
|
+
return [n.operator, r("argument")];
|
|
4105
|
+
case "MatchIdentifierPattern":
|
|
4106
|
+
return r("id");
|
|
4107
|
+
case "MatchMemberPattern": {
|
|
4108
|
+
let s = n.property.type === "Identifier" ? [".", r("property")] : ["[", m([f, r("property")]), f, "]"];
|
|
4109
|
+
return l([r("base"), s]);
|
|
4110
|
+
}
|
|
4111
|
+
case "MatchBindingPattern":
|
|
4112
|
+
return [n.kind, " ", r("id")];
|
|
4113
|
+
case "MatchObjectPattern": {
|
|
4114
|
+
let s = e.map(r, "properties");
|
|
4115
|
+
return n.rest && s.push(r("rest")), l(["{", m([f, L([",", A], s)]), n.rest ? "" : P(","), f, "}"]);
|
|
4116
|
+
}
|
|
4117
|
+
case "MatchArrayPattern": {
|
|
4118
|
+
let s = e.map(r, "elements");
|
|
4119
|
+
return n.rest && s.push(r("rest")), l(["[", m([f, L([",", A], s)]), n.rest ? "" : P(","), f, "]"]);
|
|
4120
|
+
}
|
|
4121
|
+
case "MatchObjectPatternProperty":
|
|
4122
|
+
return n.shorthand ? r("pattern") : l([r("key"), ":", m([A, r("pattern")])]);
|
|
4123
|
+
case "MatchRestPattern": {
|
|
4124
|
+
let s = ["..."];
|
|
4125
|
+
return n.argument && s.push(r("argument")), s;
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
}
|
|
4129
|
+
var ua = k(["MatchWildcardPattern", "MatchLiteralPattern", "MatchUnaryPattern", "MatchIdentifierPattern"]);
|
|
4130
|
+
function iD(e) {
|
|
4131
|
+
let { patterns: t } = e;
|
|
4132
|
+
if (t.some((n) => T(n))) return false;
|
|
4133
|
+
let r = t.find((n) => n.type === "MatchObjectPattern");
|
|
4134
|
+
return r ? t.every((n) => n === r || ua(n)) : false;
|
|
4135
|
+
}
|
|
4136
|
+
function oD(e) {
|
|
4137
|
+
return ua(e) || e.type === "MatchObjectPattern" ? true : e.type === "MatchOrPattern" ? iD(e) : false;
|
|
4138
|
+
}
|
|
4139
|
+
function uD(e, t, r) {
|
|
4140
|
+
let { node: n } = e, { parent: s } = e, i = s.type !== "MatchStatementCase" && s.type !== "MatchExpressionCase" && s.type !== "MatchArrayPattern" && s.type !== "MatchObjectPatternProperty" && !Ee(t.originalText, n), o = oD(n), u = e.map(() => {
|
|
4141
|
+
let c = r();
|
|
4142
|
+
return o || (c = xe(2, c)), De(e, c, t);
|
|
4143
|
+
}, "patterns");
|
|
4144
|
+
if (o) return L(" | ", u);
|
|
4145
|
+
let p = [P(["| "]), L([A, "| "], u)];
|
|
4146
|
+
return ge(e, t) ? l([m([P([f]), p]), f]) : s.type === "MatchArrayPattern" && s.elements.length > 1 ? l([m([P(["(", f]), p]), f, P(")")]) : l(i ? m(p) : p);
|
|
4147
|
+
}
|
|
4148
|
+
function aa(e, t, r) {
|
|
4149
|
+
let { node: n } = e, s = [Q(e), "opaque type ", r("id"), r("typeParameters")];
|
|
4150
|
+
if (n.supertype && s.push(": ", r("supertype")), n.lowerBound || n.upperBound) {
|
|
4151
|
+
let i = [];
|
|
4152
|
+
n.lowerBound && i.push(m([A, "super ", r("lowerBound")])), n.upperBound && i.push(m([A, "extends ", r("upperBound")])), s.push(l(i));
|
|
4153
|
+
}
|
|
4154
|
+
return n.impltype && s.push(" = ", r("impltype")), s.push(t.semi ? ";" : ""), s;
|
|
4155
|
+
}
|
|
4156
|
+
function kn(e, t, r) {
|
|
4157
|
+
let { node: n } = e;
|
|
4158
|
+
return ["...", ...n.type === "TupleTypeSpreadElement" && n.label ? [r("label"), ": "] : [], r("typeAnnotation")];
|
|
4159
|
+
}
|
|
4160
|
+
function In(e, t, r) {
|
|
4161
|
+
let { node: n } = e;
|
|
4162
|
+
return [n.variance ? r("variance") : "", r("label"), n.optional ? "?" : "", ": ", r("elementType")];
|
|
4163
|
+
}
|
|
4164
|
+
function Ln(e, t, r) {
|
|
4165
|
+
let { node: n } = e, s = [Q(e), "type ", r("id"), r("typeParameters")], i = n.type === "TSTypeAliasDeclaration" ? "typeAnnotation" : "right";
|
|
4166
|
+
return [ht(e, t, r, s, " =", i), t.semi ? ";" : ""];
|
|
4167
|
+
}
|
|
4168
|
+
function aD(e, t, r) {
|
|
4169
|
+
let { node: n } = e;
|
|
4170
|
+
return K(n).length === 1 && n.type.startsWith("TS") && !n[r][0].constraint && e.parent.type === "ArrowFunctionExpression" && !(t.filepath && /\.ts$/u.test(t.filepath));
|
|
4171
|
+
}
|
|
4172
|
+
function Gt(e, t, r, n) {
|
|
4173
|
+
let { node: s } = e;
|
|
4174
|
+
if (!s[n]) return "";
|
|
4175
|
+
if (!Array.isArray(s[n])) return r(n);
|
|
4176
|
+
let i = It(e.grandparent), o = e.match((c) => !(c[n].length === 1 && Je(c[n][0])), void 0, (c, y) => y === "typeAnnotation", (c) => c.type === "Identifier", Bs);
|
|
4177
|
+
if (s[n].length === 0 || !o && (i || s[n].length === 1 && (s[n][0].type === "NullableTypeAnnotation" || Jo(s[n][0])))) return ["<", L(", ", e.map(r, n)), pD(e, t), ">"];
|
|
4178
|
+
let p = s.type === "TSTypeParameterInstantiation" ? "" : aD(e, t, n) ? "," : ie(t) ? P(",") : "";
|
|
4179
|
+
return l(["<", m([f, L([",", A], e.map(r, n))]), p, f, ">"]);
|
|
4180
|
+
}
|
|
4181
|
+
function pD(e, t) {
|
|
4182
|
+
let { node: r } = e;
|
|
4183
|
+
if (!T(r, x.Dangling)) return "";
|
|
4184
|
+
let n = !T(r, x.Line), s = v(e, t, { indent: !n });
|
|
4185
|
+
return n ? s : [s, E];
|
|
4186
|
+
}
|
|
4187
|
+
function On(e, t, r) {
|
|
4188
|
+
let { node: n } = e, s = [n.const ? "const " : ""], i = n.type === "TSTypeParameter" ? r("name") : n.name;
|
|
4189
|
+
if (n.variance && s.push(r("variance")), n.in && s.push("in "), n.out && s.push("out "), s.push(i), n.bound && (n.usesExtendsBound && s.push(" extends "), s.push(G(e, r, "bound"))), n.constraint) {
|
|
4190
|
+
let o = /* @__PURE__ */ Symbol("constraint");
|
|
4191
|
+
s.push(" extends", l(m(A), { id: o }), je, yt(r("constraint"), { groupId: o }));
|
|
4192
|
+
}
|
|
4193
|
+
if (n.default) {
|
|
4194
|
+
let o = /* @__PURE__ */ Symbol("default");
|
|
4195
|
+
s.push(" =", l(m(A), { id: o }), je, yt(r("default"), { groupId: o }));
|
|
4196
|
+
}
|
|
4197
|
+
return l(s);
|
|
4198
|
+
}
|
|
4199
|
+
function wn(e, t) {
|
|
4200
|
+
let { node: r } = e;
|
|
4201
|
+
return [r.type === "TSTypePredicate" && r.asserts ? "asserts " : r.type === "TypePredicate" && r.kind ? `${r.kind} ` : "", t("parameterName"), r.typeAnnotation ? [" is ", G(e, t)] : ""];
|
|
4202
|
+
}
|
|
4203
|
+
function _n({ node: e }, t) {
|
|
4204
|
+
let r = e.type === "TSTypeQuery" ? "exprName" : "argument";
|
|
4205
|
+
return ["typeof ", t(r), t("typeArguments")];
|
|
4206
|
+
}
|
|
4207
|
+
function pa(e, t, r) {
|
|
4208
|
+
let { node: n } = e;
|
|
4209
|
+
if (Nr(n)) return n.type.slice(0, -14).toLowerCase();
|
|
4210
|
+
switch (n.type) {
|
|
4211
|
+
case "ComponentDeclaration":
|
|
4212
|
+
case "DeclareComponent":
|
|
4213
|
+
case "ComponentTypeAnnotation":
|
|
4214
|
+
return Xu(e, t, r);
|
|
4215
|
+
case "ComponentParameter":
|
|
4216
|
+
return Vu(e, t, r);
|
|
4217
|
+
case "ComponentTypeParameter":
|
|
4218
|
+
return $u(e, t, r);
|
|
4219
|
+
case "HookDeclaration":
|
|
4220
|
+
return zu(e, t, r);
|
|
4221
|
+
case "DeclareHook":
|
|
4222
|
+
return Zu(e, t, r);
|
|
4223
|
+
case "HookTypeAnnotation":
|
|
4224
|
+
return ea(e, t, r);
|
|
4225
|
+
case "DeclareFunction":
|
|
4226
|
+
return [Q(e), "function ", r("id"), r("predicate"), t.semi ? ";" : ""];
|
|
4227
|
+
case "DeclareModule":
|
|
4228
|
+
return ["declare module ", r("id"), " ", r("body")];
|
|
4229
|
+
case "DeclareModuleExports":
|
|
4230
|
+
return ["declare module.exports", G(e, r), t.semi ? ";" : ""];
|
|
4231
|
+
case "DeclareNamespace":
|
|
4232
|
+
return ["declare namespace ", r("id"), " ", r("body")];
|
|
4233
|
+
case "DeclareVariable":
|
|
4234
|
+
return [Q(e), n.kind ?? "var", " ", r("id"), t.semi ? ";" : ""];
|
|
4235
|
+
case "DeclareExportDeclaration":
|
|
4236
|
+
case "DeclareExportAllDeclaration":
|
|
4237
|
+
return An(e, t, r);
|
|
4238
|
+
case "DeclareOpaqueType":
|
|
4239
|
+
case "OpaqueType":
|
|
4240
|
+
return aa(e, t, r);
|
|
4241
|
+
case "DeclareTypeAlias":
|
|
4242
|
+
case "TypeAlias":
|
|
4243
|
+
return Ln(e, t, r);
|
|
4244
|
+
case "IntersectionTypeAnnotation":
|
|
4245
|
+
return Pn(e, t, r);
|
|
4246
|
+
case "UnionTypeAnnotation":
|
|
4247
|
+
return un(e, t, r);
|
|
4248
|
+
case "ConditionalTypeAnnotation":
|
|
4249
|
+
return ur(e, t, r);
|
|
4250
|
+
case "InferTypeAnnotation":
|
|
4251
|
+
return bn(e, t, r);
|
|
4252
|
+
case "FunctionTypeAnnotation":
|
|
4253
|
+
return Sn(e, t, r);
|
|
4254
|
+
case "TupleTypeAnnotation":
|
|
4255
|
+
return tr(e, t, r);
|
|
4256
|
+
case "TupleTypeLabeledElement":
|
|
4257
|
+
return In(e, t, r);
|
|
4258
|
+
case "TupleTypeSpreadElement":
|
|
4259
|
+
return kn(e, t, r);
|
|
4260
|
+
case "GenericTypeAnnotation":
|
|
4261
|
+
return [r("id"), Gt(e, t, r, "typeParameters")];
|
|
4262
|
+
case "IndexedAccessType":
|
|
4263
|
+
case "OptionalIndexedAccessType":
|
|
4264
|
+
return Bn(e, t, r);
|
|
4265
|
+
case "TypeAnnotation":
|
|
4266
|
+
return an(e, t, r);
|
|
4267
|
+
case "TypeParameter":
|
|
4268
|
+
return On(e, t, r);
|
|
4269
|
+
case "TypeofTypeAnnotation":
|
|
4270
|
+
return _n(e, r);
|
|
4271
|
+
case "ExistsTypeAnnotation":
|
|
4272
|
+
return "*";
|
|
4273
|
+
case "ArrayTypeAnnotation":
|
|
4274
|
+
return Tn(r);
|
|
4275
|
+
case "DeclareEnum":
|
|
4276
|
+
case "EnumDeclaration":
|
|
4277
|
+
return hn(e, r);
|
|
4278
|
+
case "EnumBooleanBody":
|
|
4279
|
+
case "EnumNumberBody":
|
|
4280
|
+
case "EnumBigIntBody":
|
|
4281
|
+
case "EnumStringBody":
|
|
4282
|
+
case "EnumSymbolBody":
|
|
4283
|
+
return Ku(e, t, r);
|
|
4284
|
+
case "EnumBooleanMember":
|
|
4285
|
+
case "EnumNumberMember":
|
|
4286
|
+
case "EnumBigIntMember":
|
|
4287
|
+
case "EnumStringMember":
|
|
4288
|
+
case "EnumDefaultedMember":
|
|
4289
|
+
return gn(e, r);
|
|
4290
|
+
case "FunctionTypeParam": {
|
|
4291
|
+
let s = n.name ? r("name") : e.parent.this === n ? "this" : "";
|
|
4292
|
+
return [s, X(e), s ? ": " : "", r("typeAnnotation")];
|
|
4293
|
+
}
|
|
4294
|
+
case "DeclareClass":
|
|
4295
|
+
case "DeclareInterface":
|
|
4296
|
+
case "InterfaceDeclaration":
|
|
4297
|
+
case "InterfaceTypeAnnotation":
|
|
4298
|
+
return sr(e, t, r);
|
|
4299
|
+
case "ObjectTypeAnnotation":
|
|
4300
|
+
return Rt(e, t, r);
|
|
4301
|
+
case "ClassImplements":
|
|
4302
|
+
case "InterfaceExtends":
|
|
4303
|
+
return [r("id"), r("typeParameters")];
|
|
4304
|
+
case "NullableTypeAnnotation":
|
|
4305
|
+
return ["?", r("typeAnnotation")];
|
|
4306
|
+
case "Variance": {
|
|
4307
|
+
let { kind: s } = n;
|
|
4308
|
+
return Le(s === "plus" || s === "minus"), s === "plus" ? "+" : "-";
|
|
4309
|
+
}
|
|
4310
|
+
case "KeyofTypeAnnotation":
|
|
4311
|
+
return ["keyof ", r("argument")];
|
|
4312
|
+
case "ObjectTypeCallProperty":
|
|
4313
|
+
return [n.static ? "static " : "", r("value"), he(e, t)];
|
|
4314
|
+
case "ObjectTypeMappedTypeProperty":
|
|
4315
|
+
return ra(e, t, r);
|
|
4316
|
+
case "ObjectTypeIndexer":
|
|
4317
|
+
return [n.static ? "static " : "", n.variance ? r("variance") : "", "[", r("id"), n.id ? ": " : "", r("key"), "]: ", r("value"), he(e, t)];
|
|
4318
|
+
case "ObjectTypeProperty": {
|
|
4319
|
+
let s = "";
|
|
4320
|
+
return n.proto ? s = "proto " : n.static && (s = "static "), [s, n.kind !== "init" ? n.kind + " " : "", n.variance ? r("variance") : "", Ct(e, t, r), X(e), mt(n) ? "" : ": ", r("value"), he(e, t)];
|
|
4321
|
+
}
|
|
4322
|
+
case "ObjectTypeInternalSlot":
|
|
4323
|
+
return [n.static ? "static " : "", "[[", r("id"), "]]", X(e), n.method ? "" : ": ", r("value"), he(e, t)];
|
|
4324
|
+
case "ObjectTypeSpreadProperty":
|
|
4325
|
+
return or(e, r);
|
|
4326
|
+
case "QualifiedTypeofIdentifier":
|
|
4327
|
+
case "QualifiedTypeIdentifier":
|
|
4328
|
+
return [r("qualification"), ".", r("id")];
|
|
4329
|
+
case "NullLiteralTypeAnnotation":
|
|
4330
|
+
return "null";
|
|
4331
|
+
case "BooleanLiteralTypeAnnotation":
|
|
4332
|
+
return String(n.value);
|
|
4333
|
+
case "StringLiteralTypeAnnotation":
|
|
4334
|
+
return qe(ut(pe(n), t));
|
|
4335
|
+
case "NumberLiteralTypeAnnotation":
|
|
4336
|
+
return dt(pe(n));
|
|
4337
|
+
case "BigIntLiteralTypeAnnotation":
|
|
4338
|
+
return Cn(pe(n));
|
|
4339
|
+
case "TypeCastExpression":
|
|
4340
|
+
return ["(", r("expression"), G(e, r), ")"];
|
|
4341
|
+
case "TypePredicate":
|
|
4342
|
+
return wn(e, r);
|
|
4343
|
+
case "TypeOperator":
|
|
4344
|
+
return [n.operator, " ", r("typeAnnotation")];
|
|
4345
|
+
case "TypeParameterDeclaration":
|
|
4346
|
+
case "TypeParameterInstantiation":
|
|
4347
|
+
return Gt(e, t, r, "params");
|
|
4348
|
+
case "InferredPredicate":
|
|
4349
|
+
case "DeclaredPredicate":
|
|
4350
|
+
return [e.key === "predicate" && e.parent.type !== "DeclareFunction" && !e.parent.returnType ? ": " : " ", "%checks", ...n.type === "DeclaredPredicate" ? ["(", r("value"), ")"] : []];
|
|
4351
|
+
case "AsExpression":
|
|
4352
|
+
case "AsConstExpression":
|
|
4353
|
+
case "SatisfiesExpression":
|
|
4354
|
+
return xn(e, t, r);
|
|
4355
|
+
case "MatchExpression":
|
|
4356
|
+
case "MatchStatement":
|
|
4357
|
+
return sa(e, t, r);
|
|
4358
|
+
case "MatchExpressionCase":
|
|
4359
|
+
case "MatchStatementCase":
|
|
4360
|
+
return ia(e, t, r);
|
|
4361
|
+
case "MatchOrPattern":
|
|
4362
|
+
case "MatchAsPattern":
|
|
4363
|
+
case "MatchWildcardPattern":
|
|
4364
|
+
case "MatchLiteralPattern":
|
|
4365
|
+
case "MatchUnaryPattern":
|
|
4366
|
+
case "MatchIdentifierPattern":
|
|
4367
|
+
case "MatchMemberPattern":
|
|
4368
|
+
case "MatchBindingPattern":
|
|
4369
|
+
case "MatchObjectPattern":
|
|
4370
|
+
case "MatchObjectPatternProperty":
|
|
4371
|
+
case "MatchRestPattern":
|
|
4372
|
+
case "MatchArrayPattern":
|
|
4373
|
+
return oa(e, t, r);
|
|
4374
|
+
}
|
|
4375
|
+
}
|
|
4376
|
+
function ca(e, t, r) {
|
|
4377
|
+
let { node: n } = e, s = n.parameters.length > 1 ? P(ie(t) ? "," : "") : "", i = l([m([f, L([", ", f], e.map(r, "parameters"))]), s, f]);
|
|
4378
|
+
return [e.key === "body" && e.parent.type === "ClassBody" && n.static ? "static " : "", n.readonly ? "readonly " : "", "[", n.parameters ? i : "", "]", G(e, r), he(e, t)];
|
|
4379
|
+
}
|
|
4380
|
+
function Us(e, t, r) {
|
|
4381
|
+
let { node: n } = e;
|
|
4382
|
+
return [n.postfix ? "" : r, G(e, t), n.postfix ? r : ""];
|
|
4383
|
+
}
|
|
4384
|
+
function la(e, t, r) {
|
|
4385
|
+
let { node: n } = e, s = [], i = n.kind && n.kind !== "method" ? `${n.kind} ` : "";
|
|
4386
|
+
s.push(jt(n), i, n.computed ? "[" : "", r("key"), n.computed ? "]" : "", X(e));
|
|
4387
|
+
let o = Ke(e, t, r, false, true), u = G(e, r, "returnType"), p = lt(n, u);
|
|
4388
|
+
return s.push(p ? l(o) : o), n.returnType && s.push(l(u)), [l(s), he(e, t)];
|
|
4389
|
+
}
|
|
4390
|
+
function ma(e, t, r) {
|
|
4391
|
+
let { node: n } = e;
|
|
4392
|
+
return [Q(e), n.kind === "global" ? "" : `${n.kind} `, r("id"), n.body ? [" ", l(r("body"))] : t.semi ? ";" : ""];
|
|
4393
|
+
}
|
|
4394
|
+
function Da(e, t, r) {
|
|
4395
|
+
let { node: n } = e, s = !(q(n.expression) || se(n.expression)), i = l(["<", m([f, r("typeAnnotation")]), f, ">"]), o = [P("("), m([f, r("expression")]), f, P(")")];
|
|
4396
|
+
return s ? nt([[i, r("expression")], [i, l(o, { shouldBreak: true })], [i, r("expression")]]) : l([i, r("expression")]);
|
|
4397
|
+
}
|
|
4398
|
+
function fa(e, t, r) {
|
|
4399
|
+
let { node: n } = e;
|
|
4400
|
+
if (n.type.startsWith("TS")) {
|
|
4401
|
+
if (jr(n)) return n.type.slice(2, -7).toLowerCase();
|
|
4402
|
+
switch (n.type) {
|
|
4403
|
+
case "TSThisType":
|
|
4404
|
+
return "this";
|
|
4405
|
+
case "TSTypeAssertion":
|
|
4406
|
+
return Da(e, t, r);
|
|
4407
|
+
case "TSDeclareFunction":
|
|
4408
|
+
return mn(e, t, r);
|
|
4409
|
+
case "TSExportAssignment":
|
|
4410
|
+
return ["export = ", r("expression"), t.semi ? ";" : ""];
|
|
4411
|
+
case "TSModuleBlock":
|
|
4412
|
+
return En(e, t, r);
|
|
4413
|
+
case "TSInterfaceBody":
|
|
4414
|
+
case "TSTypeLiteral":
|
|
4415
|
+
return Rt(e, t, r);
|
|
4416
|
+
case "TSTypeAliasDeclaration":
|
|
4417
|
+
return Ln(e, t, r);
|
|
4418
|
+
case "TSQualifiedName":
|
|
4419
|
+
return [r("left"), ".", r("right")];
|
|
4420
|
+
case "TSAbstractMethodDefinition":
|
|
4421
|
+
case "TSDeclareMethod":
|
|
4422
|
+
return Fn(e, t, r);
|
|
4423
|
+
case "TSAbstractAccessorProperty":
|
|
4424
|
+
case "TSAbstractPropertyDefinition":
|
|
4425
|
+
return dn(e, t, r);
|
|
4426
|
+
case "TSInterfaceHeritage":
|
|
4427
|
+
case "TSClassImplements":
|
|
4428
|
+
case "TSInstantiationExpression":
|
|
4429
|
+
return [r("expression"), r("typeArguments")];
|
|
4430
|
+
case "TSTemplateLiteralType":
|
|
4431
|
+
return en(e, t, r);
|
|
4432
|
+
case "TSNamedTupleMember":
|
|
4433
|
+
return In(e, t, r);
|
|
4434
|
+
case "TSRestType":
|
|
4435
|
+
return kn(e, t, r);
|
|
4436
|
+
case "TSOptionalType":
|
|
4437
|
+
return [r("typeAnnotation"), "?"];
|
|
4438
|
+
case "TSInterfaceDeclaration":
|
|
4439
|
+
return sr(e, t, r);
|
|
4440
|
+
case "TSTypeParameterDeclaration":
|
|
4441
|
+
case "TSTypeParameterInstantiation":
|
|
4442
|
+
return Gt(e, t, r, "params");
|
|
4443
|
+
case "TSTypeParameter":
|
|
4444
|
+
return On(e, t, r);
|
|
4445
|
+
case "TSAsExpression":
|
|
4446
|
+
case "TSSatisfiesExpression":
|
|
4447
|
+
return xn(e, t, r);
|
|
4448
|
+
case "TSArrayType":
|
|
4449
|
+
return Tn(r);
|
|
4450
|
+
case "TSPropertySignature":
|
|
4451
|
+
return [n.readonly ? "readonly " : "", Ct(e, t, r), X(e), G(e, r), he(e, t)];
|
|
4452
|
+
case "TSParameterProperty":
|
|
4453
|
+
return [jt(n), n.static ? "static " : "", n.override ? "override " : "", n.readonly ? "readonly " : "", r("parameter")];
|
|
4454
|
+
case "TSTypeQuery":
|
|
4455
|
+
return _n(e, r);
|
|
4456
|
+
case "TSIndexSignature":
|
|
4457
|
+
return ca(e, t, r);
|
|
4458
|
+
case "TSTypePredicate":
|
|
4459
|
+
return wn(e, r);
|
|
4460
|
+
case "TSNonNullExpression":
|
|
4461
|
+
return [r("expression"), "!"];
|
|
4462
|
+
case "TSImportType":
|
|
4463
|
+
return [vt(e, t, r), n.qualifier ? [".", r("qualifier")] : "", Gt(e, t, r, "typeArguments")];
|
|
4464
|
+
case "TSLiteralType":
|
|
4465
|
+
return r("literal");
|
|
4466
|
+
case "TSIndexedAccessType":
|
|
4467
|
+
return Bn(e, t, r);
|
|
4468
|
+
case "TSTypeOperator":
|
|
4469
|
+
return [n.operator, " ", r("typeAnnotation")];
|
|
4470
|
+
case "TSMappedType":
|
|
4471
|
+
return na(e, t, r);
|
|
4472
|
+
case "TSMethodSignature":
|
|
4473
|
+
return la(e, t, r);
|
|
4474
|
+
case "TSNamespaceExportDeclaration":
|
|
4475
|
+
return ["export as namespace ", r("id"), t.semi ? ";" : ""];
|
|
4476
|
+
case "TSEnumDeclaration":
|
|
4477
|
+
return hn(e, r);
|
|
4478
|
+
case "TSEnumBody":
|
|
4479
|
+
return qs(e, t, r);
|
|
4480
|
+
case "TSEnumMember":
|
|
4481
|
+
return gn(e, r);
|
|
4482
|
+
case "TSImportEqualsDeclaration":
|
|
4483
|
+
return ["import ", Gs(n, false), r("id"), " = ", r("moduleReference"), t.semi ? ";" : ""];
|
|
4484
|
+
case "TSExternalModuleReference":
|
|
4485
|
+
return vt(e, t, r);
|
|
4486
|
+
case "TSModuleDeclaration":
|
|
4487
|
+
return ma(e, t, r);
|
|
4488
|
+
case "TSConditionalType":
|
|
4489
|
+
return ur(e, t, r);
|
|
4490
|
+
case "TSInferType":
|
|
4491
|
+
return bn(e, t, r);
|
|
4492
|
+
case "TSIntersectionType":
|
|
4493
|
+
return Pn(e, t, r);
|
|
4494
|
+
case "TSUnionType":
|
|
4495
|
+
return un(e, t, r);
|
|
4496
|
+
case "TSFunctionType":
|
|
4497
|
+
case "TSCallSignatureDeclaration":
|
|
4498
|
+
case "TSConstructorType":
|
|
4499
|
+
case "TSConstructSignatureDeclaration":
|
|
4500
|
+
return Sn(e, t, r);
|
|
4501
|
+
case "TSTupleType":
|
|
4502
|
+
return tr(e, t, r);
|
|
4503
|
+
case "TSTypeReference":
|
|
4504
|
+
return [r("typeName"), Gt(e, t, r, "typeArguments")];
|
|
4505
|
+
case "TSTypeAnnotation":
|
|
4506
|
+
return an(e, t, r);
|
|
4507
|
+
case "TSEmptyBodyFunctionExpression":
|
|
4508
|
+
return Dn(e, t, r);
|
|
4509
|
+
case "TSJSDocAllType":
|
|
4510
|
+
return "*";
|
|
4511
|
+
case "TSJSDocUnknownType":
|
|
4512
|
+
return "?";
|
|
4513
|
+
case "TSJSDocNullableType":
|
|
4514
|
+
return Us(e, r, "?");
|
|
4515
|
+
case "TSJSDocNonNullableType":
|
|
4516
|
+
return Us(e, r, "!");
|
|
4517
|
+
case "TSParenthesizedType":
|
|
4518
|
+
default:
|
|
4519
|
+
throw new Qe(n, "TypeScript");
|
|
4520
|
+
}
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
function cD(e, t, r, n) {
|
|
4524
|
+
for (let s of [yu, mu, pa, fa, Hu]) {
|
|
4525
|
+
let i = s(e, t, r, n);
|
|
4526
|
+
if (i !== void 0) return i;
|
|
4527
|
+
}
|
|
4528
|
+
}
|
|
4529
|
+
var lD = k(["ClassMethod", "ClassPrivateMethod", "ClassProperty", "ClassAccessorProperty", "AccessorProperty", "TSAbstractAccessorProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "ClassPrivateProperty", "MethodDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod"]);
|
|
4530
|
+
function mD(e, t, r, n) {
|
|
4531
|
+
e.isRoot && t.__onHtmlBindingRoot?.(e.node, t);
|
|
4532
|
+
let { node: s } = e, i = nr(e) ? t.originalText.slice(w(s), I(s)) : cD(e, t, r, n);
|
|
4533
|
+
if (!i) return "";
|
|
4534
|
+
if (lD(s)) return i;
|
|
4535
|
+
let o = R(s.decorators), u = Fu(e, t, r), p = s.type === "ClassExpression";
|
|
4536
|
+
if (o && !p) return Ar(i, (D) => l([u, D]));
|
|
4537
|
+
let c = ge(e, t), y = uu(e, t);
|
|
4538
|
+
return !u && !c && !y ? i : Ar(i, (D) => [y ? ";" : "", c ? "(" : "", c && p && o ? [m([A, u, D]), A] : [u, D], c ? ")" : ""]);
|
|
4539
|
+
}
|
|
4540
|
+
var Ys = mD;
|
|
4541
|
+
var DD = { experimental_avoidAstMutation: true };
|
|
4542
|
+
var ya = [{ name: "JSON.stringify", type: "data", aceMode: "json", extensions: [".importmap"], filenames: ["package.json", "package-lock.json", "composer.json"], tmScope: "source.json", aliases: ["geojson", "jsonl", "sarif", "topojson"], codemirrorMode: "javascript", codemirrorMimeType: "application/json", parsers: ["json-stringify"], vscodeLanguageIds: ["json"], linguistLanguageId: 174 }, { name: "JSON", type: "data", aceMode: "json", extensions: [".json", ".4DForm", ".4DProject", ".avsc", ".geojson", ".gltf", ".har", ".ice", ".JSON-tmLanguage", ".json.example", ".mcmeta", ".sarif", ".tact", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest", ".yy", ".yyp"], filenames: [".all-contributorsrc", ".arcconfig", ".auto-changelog", ".c8rc", ".htmlhintrc", ".imgbotconfig", ".nycrc", ".tern-config", ".tern-project", ".watchmanconfig", ".babelrc", ".jscsrc", ".jshintrc", ".jslintrc", ".swcrc"], tmScope: "source.json", aliases: ["geojson", "jsonl", "sarif", "topojson"], codemirrorMode: "javascript", codemirrorMimeType: "application/json", parsers: ["json"], vscodeLanguageIds: ["json"], linguistLanguageId: 174 }, { name: "JSON with Comments", type: "data", aceMode: "javascript", extensions: [".jsonc", ".code-snippets", ".code-workspace", ".sublime-build", ".sublime-color-scheme", ".sublime-commands", ".sublime-completions", ".sublime-keymap", ".sublime-macro", ".sublime-menu", ".sublime-mousemap", ".sublime-project", ".sublime-settings", ".sublime-theme", ".sublime-workspace", ".sublime_metrics", ".sublime_session"], filenames: [], tmScope: "source.json.comments", aliases: ["jsonc"], codemirrorMode: "javascript", codemirrorMimeType: "text/javascript", group: "JSON", parsers: ["jsonc"], vscodeLanguageIds: ["jsonc"], linguistLanguageId: 423 }, { name: "JSON5", type: "data", aceMode: "json5", extensions: [".json5"], tmScope: "source.js", codemirrorMode: "javascript", codemirrorMimeType: "application/json", parsers: ["json5"], vscodeLanguageIds: ["json5"], linguistLanguageId: 175 }];
|
|
4543
|
+
var Xs = {};
|
|
4544
|
+
jn(Xs, { getVisitorKeys: () => Fa, massageAstNode: () => Ca, print: () => yD });
|
|
4545
|
+
var ar = [[]];
|
|
4546
|
+
var Ea = { JsonRoot: ["node"], ArrayExpression: ["elements"], ObjectExpression: ["properties"], ObjectProperty: ["key", "value"], UnaryExpression: ["argument"], NullLiteral: ar[0], BooleanLiteral: ar[0], StringLiteral: ar[0], NumericLiteral: ar[0], Identifier: ar[0], TemplateLiteral: ["quasis"], TemplateElement: ar[0] };
|
|
4547
|
+
var fD = _r(Ea);
|
|
4548
|
+
var Fa = fD;
|
|
4549
|
+
function yD(e, t, r) {
|
|
4550
|
+
let { node: n } = e;
|
|
4551
|
+
switch (n.type) {
|
|
4552
|
+
case "JsonRoot":
|
|
4553
|
+
return [r("node"), E];
|
|
4554
|
+
case "ArrayExpression": {
|
|
4555
|
+
if (n.elements.length === 0) return "[]";
|
|
4556
|
+
let s = e.map(() => e.node === null ? "null" : r(), "elements");
|
|
4557
|
+
return ["[", m([E, L([",", E], s)]), E, "]"];
|
|
4558
|
+
}
|
|
4559
|
+
case "ObjectExpression":
|
|
4560
|
+
return n.properties.length === 0 ? "{}" : ["{", m([E, L([",", E], e.map(r, "properties"))]), E, "}"];
|
|
4561
|
+
case "ObjectProperty":
|
|
4562
|
+
return [r("key"), ": ", r("value")];
|
|
4563
|
+
case "UnaryExpression":
|
|
4564
|
+
return [n.operator === "+" ? "" : n.operator, r("argument")];
|
|
4565
|
+
case "NullLiteral":
|
|
4566
|
+
return "null";
|
|
4567
|
+
case "BooleanLiteral":
|
|
4568
|
+
return n.value ? "true" : "false";
|
|
4569
|
+
case "StringLiteral":
|
|
4570
|
+
return JSON.stringify(n.value);
|
|
4571
|
+
case "NumericLiteral":
|
|
4572
|
+
return da(e) ? JSON.stringify(String(n.value)) : JSON.stringify(n.value);
|
|
4573
|
+
case "Identifier":
|
|
4574
|
+
return da(e) ? JSON.stringify(n.name) : n.name;
|
|
4575
|
+
case "TemplateLiteral":
|
|
4576
|
+
return r(["quasis", 0]);
|
|
4577
|
+
case "TemplateElement":
|
|
4578
|
+
return JSON.stringify(n.value.cooked);
|
|
4579
|
+
default:
|
|
4580
|
+
throw new Qe(n, "JSON");
|
|
4581
|
+
}
|
|
4582
|
+
}
|
|
4583
|
+
function da(e) {
|
|
4584
|
+
return e.key === "key" && e.parent.type === "ObjectProperty";
|
|
4585
|
+
}
|
|
4586
|
+
var ED = /* @__PURE__ */ new Set(["start", "end", "extra", "loc", "comments", "leadingComments", "trailingComments", "innerComments", "errors", "range", "tokens"]);
|
|
4587
|
+
function Ca(e, t) {
|
|
4588
|
+
let { type: r } = e;
|
|
4589
|
+
if (r === "ObjectProperty") {
|
|
4590
|
+
let { key: n } = e;
|
|
4591
|
+
n.type === "Identifier" ? t.key = { type: "StringLiteral", value: n.name } : n.type === "NumericLiteral" && (t.key = { type: "StringLiteral", value: String(n.value) });
|
|
4592
|
+
return;
|
|
4593
|
+
}
|
|
4594
|
+
if (r === "UnaryExpression" && e.operator === "+") return t.argument;
|
|
4595
|
+
if (r === "ArrayExpression") {
|
|
4596
|
+
for (let [n, s] of e.elements.entries()) s === null && t.elements.splice(n, 0, { type: "NullLiteral" });
|
|
4597
|
+
return;
|
|
4598
|
+
}
|
|
4599
|
+
if (r === "TemplateLiteral") return { type: "StringLiteral", value: e.quasis[0].value.cooked };
|
|
4600
|
+
}
|
|
4601
|
+
Ca.ignoredProperties = ED;
|
|
4602
|
+
var pr = { bracketSpacing: { category: "Common", type: "boolean", default: true, description: "Print spaces between brackets.", oppositeDescription: "Do not print spaces between brackets." }, objectWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap object literals.", choices: [{ value: "preserve", description: "Keep as multi-line, if there is a newline between the opening brace and first property." }, { value: "collapse", description: "Fit to a single line when possible." }] }, singleQuote: { category: "Common", type: "boolean", default: false, description: "Use single quotes instead of double quotes." }, proseWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap prose.", choices: [{ value: "always", description: "Wrap prose if it exceeds the print width." }, { value: "never", description: "Do not wrap prose." }, { value: "preserve", description: "Wrap prose as-is." }] }, bracketSameLine: { category: "Common", type: "boolean", default: false, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: false, description: "Enforce single attribute per line in HTML, Vue and JSX." } };
|
|
4603
|
+
var St = "JavaScript";
|
|
4604
|
+
var FD = { arrowParens: { category: St, type: "choice", default: "always", description: "Include parentheses around a sole arrow function parameter.", choices: [{ value: "always", description: "Always include parens. Example: `(x) => x`" }, { value: "avoid", description: "Omit parens when possible. Example: `x => x`" }] }, bracketSameLine: pr.bracketSameLine, objectWrap: pr.objectWrap, bracketSpacing: pr.bracketSpacing, jsxBracketSameLine: { category: St, type: "boolean", description: "Put > on the last line instead of at a new line.", deprecated: "2.4.0" }, semi: { category: St, type: "boolean", default: true, description: "Print semicolons.", oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them." }, experimentalOperatorPosition: { category: St, type: "choice", default: "end", description: "Where to print operators when binary expressions wrap lines.", choices: [{ value: "start", description: "Print operators at the start of new lines." }, { value: "end", description: "Print operators at the end of previous lines." }] }, experimentalTernaries: { category: St, type: "boolean", default: false, description: "Use curious ternaries, with the question mark after the condition.", oppositeDescription: "Default behavior of ternaries; keep question marks on the same line as the consequent." }, singleQuote: pr.singleQuote, jsxSingleQuote: { category: St, type: "boolean", default: false, description: "Use single quotes in JSX." }, quoteProps: { category: St, type: "choice", default: "as-needed", description: "Change when properties in objects are quoted.", choices: [{ value: "as-needed", description: "Only add quotes around object properties where required." }, { value: "consistent", description: "If at least one property in an object requires quotes, quote all properties." }, { value: "preserve", description: "Respect the input use of quotes in object properties." }] }, trailingComma: { category: St, type: "choice", default: "all", description: "Print trailing commas wherever possible when multi-line.", choices: [{ value: "all", description: "Trailing commas wherever possible (including function arguments)." }, { value: "es5", description: "Trailing commas where valid in ES5 (objects, arrays, etc.)" }, { value: "none", description: "No trailing commas." }] }, singleAttributePerLine: pr.singleAttributePerLine };
|
|
4605
|
+
var Aa = FD;
|
|
4606
|
+
var dD = { estree: Hs, "estree-json": Xs };
|
|
4607
|
+
var CD = [...Qs, ...ya];
|
|
4608
|
+
export {
|
|
4609
|
+
Ta as default,
|
|
4610
|
+
CD as languages,
|
|
4611
|
+
Aa as options,
|
|
4612
|
+
dD as printers
|
|
4613
|
+
};
|