odm-client 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/mongodb-client.d.ts +9 -7
- package/dist/client/mongodb-index.d.ts +2 -2
- package/dist/cloudbase-index.cjs +1 -1
- package/dist/cloudbase-index.js +66 -56
- package/dist/decorators/index.d.ts +7 -0
- package/dist/deps/_commonjsHelpers-KaVRbhAgd4-5pgl5rkso.js +28 -0
- package/dist/deps/_commonjsHelpers-KaVRbhAgd4-r4alsdeis.js +1 -0
- package/dist/deps/acorn-DYjaOAP8Gz-29lcn4w0b.js +16 -0
- package/dist/deps/acorn-DYjaOAP8Gz-gyct7wut5.js +3005 -0
- package/dist/deps/angular-1bp1uAROl4-bz9b1prej.js +2533 -0
- package/dist/deps/angular-1bp1uAROl4-z3xa5q2km.js +3 -0
- package/dist/deps/babel-_P9jsDBVVy-ipfz7c01i.js +7217 -0
- package/dist/deps/babel-_P9jsDBVVy-kjb76ly0t.js +15 -0
- package/dist/deps/estree-Q-oFBmJEml-u09jq3zep.js +44 -0
- package/dist/deps/estree-Q-oFBmJEml-w9z7zljkf.js +4528 -0
- package/dist/deps/flow-j77MFvzLrn-kf5rv1yl1.js +20 -0
- package/dist/deps/flow-j77MFvzLrn-l8rtylmcl.js +27411 -0
- package/dist/deps/glimmer-ewQPb5nTUl-5p9240228.js +37 -0
- package/dist/deps/glimmer-ewQPb5nTUl-xsdp5ejns.js +2703 -0
- package/dist/deps/graphql-8EXR1_taGG-a4my17998.js +28 -0
- package/dist/deps/graphql-8EXR1_taGG-iqqy1396h.js +1221 -0
- package/dist/deps/html-dGbiW_CFWL-inuu6eaf1.js +25 -0
- package/dist/deps/html-dGbiW_CFWL-mq1pmq7je.js +2791 -0
- package/dist/deps/markdown-vAYIRClyWZ-el25zjeip.js +62 -0
- package/dist/deps/markdown-vAYIRClyWZ-f8svm8az3.js +3190 -0
- package/dist/deps/meriyah-d5_qqf88x--ntk7vora9.js +5 -0
- package/dist/deps/meriyah-d5_qqf88x--tbqv1nv9b.js +2645 -0
- package/dist/deps/postcss-Vz5bDQ3hJO-if8y8k5xi.js +4739 -0
- package/dist/deps/postcss-Vz5bDQ3hJO-rmv75nb4j.js +61 -0
- package/dist/deps/typescript-2hCq12HCbJ-n0w7fscoa.js +21 -0
- package/dist/deps/typescript-2hCq12HCbJ-yusfiayfb.js +12947 -0
- package/dist/deps/yaml-I5o0CrcX7J-ibk1yd293.js +4079 -0
- package/dist/deps/yaml-I5o0CrcX7J-xyc4o9p22.js +159 -0
- package/dist/generator/cloudbase-init-generator.d.ts +8 -0
- package/dist/generator/enum-generator.d.ts +3 -0
- package/dist/generator/index.d.ts +6 -0
- package/dist/generator/mongodb-init-generator.d.ts +9 -0
- package/dist/generator/parser.d.ts +21 -0
- package/dist/generator/table-generator.d.ts +3 -0
- package/dist/generator/type-generator.d.ts +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -29
- package/dist/index2.cjs +42770 -0
- package/dist/index2.js +242204 -0
- package/dist/mongodb-index.cjs +11 -11
- package/dist/mongodb-index.js +2103 -2106
- package/dist/types/index.d.ts +14 -0
- package/package.json +3 -1
- /package/dist/deps/{query-builder-h6B2D2BCoQ-4ajykqs3m.js → query-builder-h6B2D2BCoQ-f5zcr506g.js} +0 -0
- /package/dist/deps/{query-builder-h6B2D2BCoQ-wqso6i87o.js → query-builder-h6B2D2BCoQ-iw94q0kiz.js} +0 -0
|
@@ -0,0 +1,4528 @@
|
|
|
1
|
+
var Cs = Object.defineProperty;
|
|
2
|
+
var Pr = (e) => {
|
|
3
|
+
throw TypeError(e);
|
|
4
|
+
};
|
|
5
|
+
var hs = (e, t, n) => t in e ? Cs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
6
|
+
var Gt = (e, t, n) => hs(e, typeof t != "symbol" ? t + "" : t, n), mn = (e, t, n) => t.has(e) || Pr("Cannot " + n);
|
|
7
|
+
var Ne = (e, t, n) => (mn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), Fn = (e, t, n) => t.has(e) ? Pr("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), kr = (e, t, n, r) => (mn(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), wr = (e, t, n) => (mn(e, t, "access private method"), n);
|
|
8
|
+
var xs = Object.defineProperty, Gn = (e, t) => {
|
|
9
|
+
for (var n in t) xs(e, n, { get: t[n], enumerable: !0 });
|
|
10
|
+
}, Ts = {};
|
|
11
|
+
Gn(Ts, { languages: () => vy, options: () => by, printers: () => By });
|
|
12
|
+
var Ss = [{ 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 }], pu = {};
|
|
13
|
+
Gn(pu, { canAttachComment: () => Vo, embed: () => Jp, features: () => Ey, getVisitorKeys: () => mu, handleComments: () => vi, hasPrettierIgnore: () => Ar, insertPragma: () => Qp, isBlockComment: () => Se, isGap: () => ki, massageAstNode: () => Ro, print: () => su, printComment: () => nl, printPrettierIgnored: () => su, willPrintOwnComments: () => Ni });
|
|
14
|
+
var Vn = (e, t) => (n, r, ...u) => n | 1 && r == null ? void 0 : (t.call(r) ?? r[e]).apply(r, u), bs = String.prototype.replaceAll ?? function(e, t) {
|
|
15
|
+
return e.global ? this.replace(e, t) : this.split(e).join(t);
|
|
16
|
+
}, Bs = Vn("replaceAll", function() {
|
|
17
|
+
if (typeof this == "string") return bs;
|
|
18
|
+
}), z = Bs;
|
|
19
|
+
function vs(e) {
|
|
20
|
+
return this[e < 0 ? this.length + e : e];
|
|
21
|
+
}
|
|
22
|
+
var Ps = Vn("at", function() {
|
|
23
|
+
if (Array.isArray(this) || typeof this == "string") return vs;
|
|
24
|
+
}), J = Ps;
|
|
25
|
+
function ks(e) {
|
|
26
|
+
return e !== null && typeof e == "object";
|
|
27
|
+
}
|
|
28
|
+
var lu = ks;
|
|
29
|
+
function* ws(e, t) {
|
|
30
|
+
let { getVisitorKeys: n, filter: r = () => !0 } = t, u = (a) => lu(a) && r(a);
|
|
31
|
+
for (let a of n(e)) {
|
|
32
|
+
let s = e[a];
|
|
33
|
+
if (Array.isArray(s)) for (let o of s) u(o) && (yield o);
|
|
34
|
+
else u(s) && (yield s);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function* Is(e, t) {
|
|
38
|
+
let n = [e];
|
|
39
|
+
for (let r = 0; r < n.length; r++) {
|
|
40
|
+
let u = n[r];
|
|
41
|
+
for (let a of ws(u, t)) yield a, n.push(a);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function Ns(e, { getVisitorKeys: t, predicate: n }) {
|
|
45
|
+
for (let r of Is(e, { getVisitorKeys: t })) if (n(r)) return !0;
|
|
46
|
+
return !1;
|
|
47
|
+
}
|
|
48
|
+
var js = () => /[#*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;
|
|
49
|
+
function Ms(e) {
|
|
50
|
+
return e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
|
|
51
|
+
}
|
|
52
|
+
function Ls(e) {
|
|
53
|
+
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;
|
|
54
|
+
}
|
|
55
|
+
var Os = "©®‼⁉™ℹ↔↕↖↗↘↙↩↪⌨⏏⏱⏲⏸⏹⏺▪▫▶◀◻◼☀☁☂☃☄☎☑☘☝☠☢☣☦☪☮☯☸☹☺♀♂♟♠♣♥♦♨♻♾⚒⚔⚕⚖⚗⚙⚛⚜⚠⚧⚰⚱⛈⛏⛑⛓⛩⛱⛷⛸⛹✂✈✉✌✍✏✒✔✖✝✡✳✴❄❇❣❤➡⤴⤵⬅⬆⬇", Js = /[^\x20-\x7F]/u, qs = new Set(Os);
|
|
56
|
+
function Xs(e) {
|
|
57
|
+
if (!e) return 0;
|
|
58
|
+
if (!Js.test(e)) return e.length;
|
|
59
|
+
e = e.replace(js(), (n) => qs.has(n) ? " " : " ");
|
|
60
|
+
let t = 0;
|
|
61
|
+
for (let n of e) {
|
|
62
|
+
let r = n.codePointAt(0);
|
|
63
|
+
r <= 31 || r >= 127 && r <= 159 || r >= 768 && r <= 879 || r >= 65024 && r <= 65039 || (t += Ms(r) || Ls(r) ? 2 : 1);
|
|
64
|
+
}
|
|
65
|
+
return t;
|
|
66
|
+
}
|
|
67
|
+
var lt = Xs;
|
|
68
|
+
function Kn(e) {
|
|
69
|
+
return (t, n, r) => {
|
|
70
|
+
let u = !!(r != null && r.backwards);
|
|
71
|
+
if (n === !1) return !1;
|
|
72
|
+
let { length: a } = t, s = n;
|
|
73
|
+
for (; s >= 0 && s < a; ) {
|
|
74
|
+
let o = t.charAt(s);
|
|
75
|
+
if (e instanceof RegExp) {
|
|
76
|
+
if (!e.test(o)) return s;
|
|
77
|
+
} else if (!e.includes(o)) return s;
|
|
78
|
+
u ? s-- : s++;
|
|
79
|
+
}
|
|
80
|
+
return s === -1 || s === a ? s : !1;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
var ct = Kn(" "), Rs = Kn(",; "), _s = Kn(/[^\n\r]/u), Ir = (e) => e === `
|
|
84
|
+
` || e === "\r" || e === "\u2028" || e === "\u2029";
|
|
85
|
+
function Ws(e, t, n) {
|
|
86
|
+
let r = !!(n != null && n.backwards);
|
|
87
|
+
if (t === !1) return !1;
|
|
88
|
+
let u = e.charAt(t);
|
|
89
|
+
if (r) {
|
|
90
|
+
if (e.charAt(t - 1) === "\r" && u === `
|
|
91
|
+
`) return t - 2;
|
|
92
|
+
if (Ir(u)) return t - 1;
|
|
93
|
+
} else {
|
|
94
|
+
if (u === "\r" && e.charAt(t + 1) === `
|
|
95
|
+
`) return t + 2;
|
|
96
|
+
if (Ir(u)) return t + 1;
|
|
97
|
+
}
|
|
98
|
+
return t;
|
|
99
|
+
}
|
|
100
|
+
var Dt = Ws;
|
|
101
|
+
function Us(e, t, n = {}) {
|
|
102
|
+
let r = ct(e, n.backwards ? t - 1 : t, n), u = Dt(e, r, n);
|
|
103
|
+
return r !== u;
|
|
104
|
+
}
|
|
105
|
+
var oe = Us;
|
|
106
|
+
function $s(e, t) {
|
|
107
|
+
if (t === !1) return !1;
|
|
108
|
+
if (e.charAt(t) === "/" && e.charAt(t + 1) === "*") {
|
|
109
|
+
for (let n = t + 2; n < e.length; ++n) if (e.charAt(n) === "*" && e.charAt(n + 1) === "/") return n + 2;
|
|
110
|
+
}
|
|
111
|
+
return t;
|
|
112
|
+
}
|
|
113
|
+
var Hn = $s;
|
|
114
|
+
function Gs(e, t) {
|
|
115
|
+
return t === !1 ? !1 : e.charAt(t) === "/" && e.charAt(t + 1) === "/" ? _s(e, t) : t;
|
|
116
|
+
}
|
|
117
|
+
var zn = Gs;
|
|
118
|
+
function Vs(e, t) {
|
|
119
|
+
let n = null, r = t;
|
|
120
|
+
for (; r !== n; ) n = r, r = Rs(e, r), r = Hn(e, r), r = ct(e, r);
|
|
121
|
+
return r = zn(e, r), r = Dt(e, r), r !== !1 && oe(e, r);
|
|
122
|
+
}
|
|
123
|
+
var Yn = Vs;
|
|
124
|
+
function Ks(e) {
|
|
125
|
+
return Array.isArray(e) && e.length > 0;
|
|
126
|
+
}
|
|
127
|
+
var W = Ks, Hs = () => {
|
|
128
|
+
}, zs = Hs, cu = Object.freeze({ character: "'", codePoint: 39 }), Du = Object.freeze({ character: '"', codePoint: 34 }), Ys = Object.freeze({ preferred: cu, alternate: Du }), Qs = Object.freeze({ preferred: Du, alternate: cu });
|
|
129
|
+
function Zs(e, t) {
|
|
130
|
+
let { preferred: n, alternate: r } = t === !0 || t === "'" ? Ys : Qs, { length: u } = e, a = 0, s = 0;
|
|
131
|
+
for (let o = 0; o < u; o++) {
|
|
132
|
+
let p = e.charCodeAt(o);
|
|
133
|
+
p === n.codePoint ? a++ : p === r.codePoint && s++;
|
|
134
|
+
}
|
|
135
|
+
return (a > s ? r : n).character;
|
|
136
|
+
}
|
|
137
|
+
var yu = Zs, eo = /\\(["'\\])|(["'])/gu;
|
|
138
|
+
function to(e, t) {
|
|
139
|
+
let n = t === '"' ? "'" : '"', r = z(0, e, eo, (u, a, s) => a ? a === n ? n : u : s === t ? "\\" + s : s);
|
|
140
|
+
return t + r + t;
|
|
141
|
+
}
|
|
142
|
+
var no = to;
|
|
143
|
+
function ro(e, t) {
|
|
144
|
+
let n = e.slice(1, -1), r = t.parser === "json" || t.parser === "jsonc" || t.parser === "json5" && t.quoteProps === "preserve" && !t.singleQuote ? '"' : t.__isInHtmlAttribute ? "'" : yu(n, t.singleQuote);
|
|
145
|
+
return e.charAt(0) === r ? e : no(n, r);
|
|
146
|
+
}
|
|
147
|
+
var yt = ro, du = (e) => Number.isInteger(e) && e >= 0;
|
|
148
|
+
function M(e) {
|
|
149
|
+
var r, u, a;
|
|
150
|
+
let t = ((r = e.range) == null ? void 0 : r[0]) ?? e.start, n = (a = ((u = e.declaration) == null ? void 0 : u.decorators) ?? e.decorators) == null ? void 0 : a[0];
|
|
151
|
+
return n ? Math.min(M(n), t) : t;
|
|
152
|
+
}
|
|
153
|
+
function j(e) {
|
|
154
|
+
var t;
|
|
155
|
+
return ((t = e.range) == null ? void 0 : t[1]) ?? e.end;
|
|
156
|
+
}
|
|
157
|
+
function sn(e, t) {
|
|
158
|
+
let n = M(e);
|
|
159
|
+
return du(n) && n === M(t);
|
|
160
|
+
}
|
|
161
|
+
function uo(e, t) {
|
|
162
|
+
let n = j(e);
|
|
163
|
+
return du(n) && n === j(t);
|
|
164
|
+
}
|
|
165
|
+
function ao(e, t) {
|
|
166
|
+
return sn(e, t) && uo(e, t);
|
|
167
|
+
}
|
|
168
|
+
var St = null;
|
|
169
|
+
function vt(e) {
|
|
170
|
+
if (St !== null && typeof St.property) {
|
|
171
|
+
let t = St;
|
|
172
|
+
return St = vt.prototype = null, t;
|
|
173
|
+
}
|
|
174
|
+
return St = vt.prototype = e ?? /* @__PURE__ */ Object.create(null), new vt();
|
|
175
|
+
}
|
|
176
|
+
var so = 10;
|
|
177
|
+
for (let e = 0; e <= so; e++) vt();
|
|
178
|
+
function oo(e) {
|
|
179
|
+
return vt(e);
|
|
180
|
+
}
|
|
181
|
+
function io(e, t = "type") {
|
|
182
|
+
oo(e);
|
|
183
|
+
function n(r) {
|
|
184
|
+
let u = r[t], a = e[u];
|
|
185
|
+
if (!Array.isArray(a)) throw Object.assign(new Error(`Missing visitor keys for '${u}'.`), { node: r });
|
|
186
|
+
return a;
|
|
187
|
+
}
|
|
188
|
+
return n;
|
|
189
|
+
}
|
|
190
|
+
var fu = io, i = [["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"]], po = { AccessorProperty: i[0], AnyTypeAnnotation: i[1], ArgumentPlaceholder: i[1], ArrayExpression: ["elements"], ArrayPattern: ["elements", "typeAnnotation", "decorators"], ArrayTypeAnnotation: i[2], ArrowFunctionExpression: ["typeParameters", "params", "predicate", "returnType", "body"], AsConstExpression: i[3], AsExpression: i[4], AssignmentExpression: i[5], AssignmentPattern: ["left", "right", "decorators", "typeAnnotation"], AwaitExpression: i[6], BigIntLiteral: i[1], BigIntLiteralTypeAnnotation: i[1], BigIntTypeAnnotation: i[1], BinaryExpression: i[5], BindExpression: ["object", "callee"], BlockStatement: i[7], BooleanLiteral: i[1], BooleanLiteralTypeAnnotation: i[1], BooleanTypeAnnotation: i[1], BreakStatement: i[8], CallExpression: i[9], CatchClause: ["param", "body"], ChainExpression: i[3], ClassAccessorProperty: i[0], ClassBody: i[10], ClassDeclaration: i[11], ClassExpression: i[11], ClassImplements: i[12], ClassMethod: i[13], ClassPrivateMethod: i[13], ClassPrivateProperty: i[14], ClassProperty: i[14], ComponentDeclaration: ["id", "params", "body", "typeParameters", "rendersType"], ComponentParameter: ["name", "local"], ComponentTypeAnnotation: ["params", "rest", "typeParameters", "rendersType"], ComponentTypeParameter: i[15], ConditionalExpression: i[16], ConditionalTypeAnnotation: i[17], ContinueStatement: i[8], DebuggerStatement: i[1], DeclareClass: ["id", "typeParameters", "extends", "mixins", "implements", "body"], DeclareComponent: ["id", "params", "rest", "typeParameters", "rendersType"], DeclaredPredicate: i[18], DeclareEnum: i[19], DeclareExportAllDeclaration: ["source", "attributes"], DeclareExportDeclaration: i[20], DeclareFunction: ["id", "predicate"], DeclareHook: i[21], DeclareInterface: i[22], DeclareModule: i[19], DeclareModuleExports: i[23], DeclareNamespace: i[19], DeclareOpaqueType: ["id", "typeParameters", "supertype", "lowerBound", "upperBound"], DeclareTypeAlias: i[24], DeclareVariable: i[21], Decorator: i[3], Directive: i[18], DirectiveLiteral: i[1], DoExpression: i[10], DoWhileStatement: i[25], EmptyStatement: i[1], EmptyTypeAnnotation: i[1], EnumBigIntBody: i[26], EnumBigIntMember: i[27], EnumBooleanBody: i[26], EnumBooleanMember: i[27], EnumDeclaration: i[19], EnumDefaultedMember: i[21], EnumNumberBody: i[26], EnumNumberMember: i[27], EnumStringBody: i[26], EnumStringMember: i[27], EnumSymbolBody: i[26], ExistsTypeAnnotation: i[1], ExperimentalRestProperty: i[6], ExperimentalSpreadProperty: i[6], ExportAllDeclaration: ["source", "attributes", "exported"], ExportDefaultDeclaration: ["declaration"], ExportDefaultSpecifier: i[28], ExportNamedDeclaration: i[20], ExportNamespaceSpecifier: i[28], ExportSpecifier: ["local", "exported"], ExpressionStatement: i[3], File: ["program"], ForInStatement: i[29], ForOfStatement: i[29], ForStatement: ["init", "test", "update", "body"], FunctionDeclaration: i[30], FunctionExpression: i[30], FunctionTypeAnnotation: ["typeParameters", "this", "params", "rest", "returnType"], FunctionTypeParam: i[15], GenericTypeAnnotation: i[12], HookDeclaration: i[31], HookTypeAnnotation: ["params", "returnType", "rest", "typeParameters"], Identifier: ["typeAnnotation", "decorators"], IfStatement: i[16], ImportAttribute: i[32], ImportDeclaration: ["specifiers", "source", "attributes"], ImportDefaultSpecifier: i[33], ImportExpression: ["source", "options"], ImportNamespaceSpecifier: i[33], ImportSpecifier: ["imported", "local"], IndexedAccessType: i[34], InferredPredicate: i[1], InferTypeAnnotation: i[35], InterfaceDeclaration: i[22], InterfaceExtends: i[12], InterfaceTypeAnnotation: ["extends", "body"], InterpreterDirective: i[1], IntersectionTypeAnnotation: i[36], JsExpressionRoot: i[37], JsonRoot: i[37], JSXAttribute: ["name", "value"], JSXClosingElement: ["name"], JSXClosingFragment: i[1], JSXElement: ["openingElement", "children", "closingElement"], JSXEmptyExpression: i[1], JSXExpressionContainer: i[3], JSXFragment: ["openingFragment", "children", "closingFragment"], JSXIdentifier: i[1], JSXMemberExpression: i[38], JSXNamespacedName: ["namespace", "name"], JSXOpeningElement: ["name", "typeArguments", "attributes"], JSXOpeningFragment: i[1], JSXSpreadAttribute: i[6], JSXSpreadChild: i[3], JSXText: i[1], KeyofTypeAnnotation: i[6], LabeledStatement: ["label", "body"], Literal: i[1], LogicalExpression: i[5], MatchArrayPattern: ["elements", "rest"], MatchAsPattern: ["pattern", "target"], MatchBindingPattern: i[21], MatchExpression: i[39], MatchExpressionCase: i[40], MatchIdentifierPattern: i[21], MatchLiteralPattern: i[41], MatchMemberPattern: ["base", "property"], MatchObjectPattern: ["properties", "rest"], MatchObjectPatternProperty: ["key", "pattern"], MatchOrPattern: ["patterns"], MatchRestPattern: i[6], MatchStatement: i[39], MatchStatementCase: i[40], MatchUnaryPattern: i[6], MatchWildcardPattern: i[1], MemberExpression: i[38], MetaProperty: ["meta", "property"], MethodDefinition: i[42], MixedTypeAnnotation: i[1], ModuleExpression: i[10], NeverTypeAnnotation: i[1], NewExpression: i[9], NGChainedExpression: i[43], NGEmptyExpression: i[1], NGMicrosyntax: i[10], NGMicrosyntaxAs: ["key", "alias"], NGMicrosyntaxExpression: ["expression", "alias"], NGMicrosyntaxKey: i[1], NGMicrosyntaxKeyedExpression: ["key", "expression"], NGMicrosyntaxLet: i[32], NGPipeExpression: ["left", "right", "arguments"], NGRoot: i[37], NullableTypeAnnotation: i[23], NullLiteral: i[1], NullLiteralTypeAnnotation: i[1], NumberLiteralTypeAnnotation: i[1], NumberTypeAnnotation: i[1], NumericLiteral: i[1], ObjectExpression: ["properties"], ObjectMethod: i[13], ObjectPattern: ["decorators", "properties", "typeAnnotation"], ObjectProperty: i[42], ObjectTypeAnnotation: ["properties", "indexers", "callProperties", "internalSlots"], ObjectTypeCallProperty: i[18], ObjectTypeIndexer: ["variance", "id", "key", "value"], ObjectTypeInternalSlot: ["id", "value"], ObjectTypeMappedTypeProperty: ["keyTparam", "propType", "sourceType", "variance"], ObjectTypeProperty: ["key", "value", "variance"], ObjectTypeSpreadProperty: i[6], OpaqueType: ["id", "typeParameters", "supertype", "impltype", "lowerBound", "upperBound"], OptionalCallExpression: i[9], OptionalIndexedAccessType: i[34], OptionalMemberExpression: i[38], ParenthesizedExpression: i[3], PipelineBareFunction: ["callee"], PipelinePrimaryTopicReference: i[1], PipelineTopicExpression: i[3], Placeholder: i[1], PrivateIdentifier: i[1], PrivateName: i[21], Program: i[7], Property: i[32], PropertyDefinition: i[14], QualifiedTypeIdentifier: i[44], QualifiedTypeofIdentifier: i[44], RegExpLiteral: i[1], RestElement: ["argument", "typeAnnotation", "decorators"], ReturnStatement: i[6], SatisfiesExpression: i[4], SequenceExpression: i[43], SpreadElement: i[6], StaticBlock: i[10], StringLiteral: i[1], StringLiteralTypeAnnotation: i[1], StringTypeAnnotation: i[1], Super: i[1], SwitchCase: ["test", "consequent"], SwitchStatement: ["discriminant", "cases"], SymbolTypeAnnotation: i[1], TaggedTemplateExpression: ["tag", "typeArguments", "quasi"], TemplateElement: i[1], TemplateLiteral: ["quasis", "expressions"], ThisExpression: i[1], ThisTypeAnnotation: i[1], ThrowStatement: i[6], TopicReference: i[1], TryStatement: ["block", "handler", "finalizer"], TSAbstractAccessorProperty: i[45], TSAbstractKeyword: i[1], TSAbstractMethodDefinition: i[32], TSAbstractPropertyDefinition: i[45], TSAnyKeyword: i[1], TSArrayType: i[2], TSAsExpression: i[4], TSAsyncKeyword: i[1], TSBigIntKeyword: i[1], TSBooleanKeyword: i[1], TSCallSignatureDeclaration: i[46], TSClassImplements: i[47], TSConditionalType: i[17], TSConstructorType: i[46], TSConstructSignatureDeclaration: i[46], TSDeclareFunction: i[31], TSDeclareKeyword: i[1], TSDeclareMethod: ["decorators", "key", "typeParameters", "params", "returnType"], TSEmptyBodyFunctionExpression: ["id", "typeParameters", "params", "returnType"], TSEnumBody: i[26], TSEnumDeclaration: i[19], TSEnumMember: ["id", "initializer"], TSExportAssignment: i[3], TSExportKeyword: i[1], TSExternalModuleReference: i[3], TSFunctionType: i[46], TSImportEqualsDeclaration: ["id", "moduleReference"], TSImportType: ["options", "qualifier", "typeArguments", "source"], TSIndexedAccessType: i[34], TSIndexSignature: ["parameters", "typeAnnotation"], TSInferType: i[35], TSInstantiationExpression: i[47], TSInterfaceBody: i[10], TSInterfaceDeclaration: i[22], TSInterfaceHeritage: i[47], TSIntersectionType: i[36], TSIntrinsicKeyword: i[1], TSJSDocAllType: i[1], TSJSDocNonNullableType: i[23], TSJSDocNullableType: i[23], TSJSDocUnknownType: i[1], TSLiteralType: i[41], TSMappedType: ["key", "constraint", "nameType", "typeAnnotation"], TSMethodSignature: ["key", "typeParameters", "params", "returnType"], TSModuleBlock: i[10], TSModuleDeclaration: i[19], TSNamedTupleMember: ["label", "elementType"], TSNamespaceExportDeclaration: i[21], TSNeverKeyword: i[1], TSNonNullExpression: i[3], TSNullKeyword: i[1], TSNumberKeyword: i[1], TSObjectKeyword: i[1], TSOptionalType: i[23], TSParameterProperty: ["parameter", "decorators"], TSParenthesizedType: i[23], TSPrivateKeyword: i[1], TSPropertySignature: ["key", "typeAnnotation"], TSProtectedKeyword: i[1], TSPublicKeyword: i[1], TSQualifiedName: i[5], TSReadonlyKeyword: i[1], TSRestType: i[23], TSSatisfiesExpression: i[4], TSStaticKeyword: i[1], TSStringKeyword: i[1], TSSymbolKeyword: i[1], TSTemplateLiteralType: ["quasis", "types"], TSThisType: i[1], TSTupleType: ["elementTypes"], TSTypeAliasDeclaration: ["id", "typeParameters", "typeAnnotation"], TSTypeAnnotation: i[23], TSTypeAssertion: i[4], TSTypeLiteral: i[26], TSTypeOperator: i[23], TSTypeParameter: ["name", "constraint", "default"], TSTypeParameterDeclaration: i[48], TSTypeParameterInstantiation: i[48], TSTypePredicate: i[49], TSTypeQuery: ["exprName", "typeArguments"], TSTypeReference: ["typeName", "typeArguments"], TSUndefinedKeyword: i[1], TSUnionType: i[36], TSUnknownKeyword: i[1], TSVoidKeyword: i[1], TupleTypeAnnotation: ["types", "elementTypes"], TupleTypeLabeledElement: ["label", "elementType", "variance"], TupleTypeSpreadElement: ["label", "typeAnnotation"], TypeAlias: i[24], TypeAnnotation: i[23], TypeCastExpression: i[4], TypeofTypeAnnotation: ["argument", "typeArguments"], TypeOperator: i[23], TypeParameter: ["bound", "default", "variance"], TypeParameterDeclaration: i[48], TypeParameterInstantiation: i[48], TypePredicate: i[49], UnaryExpression: i[6], UndefinedTypeAnnotation: i[1], UnionTypeAnnotation: i[36], UnknownTypeAnnotation: i[1], UpdateExpression: i[6], V8IntrinsicIdentifier: i[1], VariableDeclaration: ["declarations"], VariableDeclarator: i[27], Variance: i[1], VoidPattern: i[1], VoidTypeAnnotation: i[1], WhileStatement: i[25], WithStatement: ["object", "body"], YieldExpression: i[6] }, lo = fu(po), mu = lo;
|
|
191
|
+
function co(e) {
|
|
192
|
+
let t = new Set(e);
|
|
193
|
+
return (n) => t.has(n == null ? void 0 : n.type);
|
|
194
|
+
}
|
|
195
|
+
var I = co;
|
|
196
|
+
function Do(e) {
|
|
197
|
+
var t;
|
|
198
|
+
return ((t = e.extra) == null ? void 0 : t.raw) ?? e.raw;
|
|
199
|
+
}
|
|
200
|
+
var ie = Do, yo = I(["Block", "CommentBlock", "MultiLine"]), Se = yo, fo = I(["AnyTypeAnnotation", "ThisTypeAnnotation", "NumberTypeAnnotation", "VoidTypeAnnotation", "BooleanTypeAnnotation", "BigIntTypeAnnotation", "SymbolTypeAnnotation", "StringTypeAnnotation", "NeverTypeAnnotation", "UndefinedTypeAnnotation", "UnknownTypeAnnotation", "EmptyTypeAnnotation", "MixedTypeAnnotation"]), Fu = fo, mo = I(["Line", "CommentLine", "SingleLine", "HashbangComment", "HTMLOpen", "HTMLClose", "Hashbang", "InterpreterDirective"]), Ot = mo;
|
|
201
|
+
function Fo(e, t) {
|
|
202
|
+
let n = t.split(".");
|
|
203
|
+
for (let r = n.length - 1; r >= 0; r--) {
|
|
204
|
+
let u = n[r];
|
|
205
|
+
if (r === 0) return e.type === "Identifier" && e.name === u;
|
|
206
|
+
if (r === 1 && e.type === "MetaProperty" && e.property.type === "Identifier" && e.property.name === u) {
|
|
207
|
+
e = e.meta;
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (e.type === "MemberExpression" && !e.optional && !e.computed && e.property.type === "Identifier" && e.property.name === u) {
|
|
211
|
+
e = e.object;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
return !1;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function Eo(e, t) {
|
|
218
|
+
return t.some((n) => Fo(e, n));
|
|
219
|
+
}
|
|
220
|
+
var Qn = Eo;
|
|
221
|
+
function Ao({ type: e }) {
|
|
222
|
+
return e.startsWith("TS") && e.endsWith("Keyword");
|
|
223
|
+
}
|
|
224
|
+
var Eu = Ao;
|
|
225
|
+
function go({ node: e, parent: t }) {
|
|
226
|
+
return (e == null ? void 0 : e.type) !== "EmptyStatement" ? !1 : 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 : !1;
|
|
227
|
+
}
|
|
228
|
+
var Zn = go;
|
|
229
|
+
function wn(e, t) {
|
|
230
|
+
return t(e) || Ns(e, { getVisitorKeys: mu, predicate: t });
|
|
231
|
+
}
|
|
232
|
+
function er(e) {
|
|
233
|
+
return e.type === "AssignmentExpression" || e.type === "BinaryExpression" || e.type === "LogicalExpression" || e.type === "NGPipeExpression" || e.type === "ConditionalExpression" || O(e) || _(e) || e.type === "SequenceExpression" || e.type === "TaggedTemplateExpression" || e.type === "BindExpression" || e.type === "UpdateExpression" && !e.prefix || ge(e) || e.type === "TSNonNullExpression" || e.type === "ChainExpression";
|
|
234
|
+
}
|
|
235
|
+
function Co(e) {
|
|
236
|
+
return e.expressions ? e.expressions[0] : e.left ?? e.test ?? e.callee ?? e.object ?? e.tag ?? e.argument ?? e.expression;
|
|
237
|
+
}
|
|
238
|
+
function Au(e) {
|
|
239
|
+
if (e.expressions) return ["expressions", 0];
|
|
240
|
+
if (e.left) return ["left"];
|
|
241
|
+
if (e.test) return ["test"];
|
|
242
|
+
if (e.object) return ["object"];
|
|
243
|
+
if (e.callee) return ["callee"];
|
|
244
|
+
if (e.tag) return ["tag"];
|
|
245
|
+
if (e.argument) return ["argument"];
|
|
246
|
+
if (e.expression) return ["expression"];
|
|
247
|
+
throw new Error("Unexpected node has no left side.");
|
|
248
|
+
}
|
|
249
|
+
var ho = I(["ExportDefaultDeclaration", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "DeclareExportAllDeclaration"]), ee = I(["ArrayExpression"]), he = I(["ObjectExpression"]);
|
|
250
|
+
function xo(e) {
|
|
251
|
+
return e.type === "LogicalExpression" && e.operator === "??";
|
|
252
|
+
}
|
|
253
|
+
function ve(e) {
|
|
254
|
+
return e.type === "NumericLiteral" || e.type === "Literal" && typeof e.value == "number";
|
|
255
|
+
}
|
|
256
|
+
function To(e) {
|
|
257
|
+
return e.type === "BooleanLiteral" || e.type === "Literal" && typeof e.value == "boolean";
|
|
258
|
+
}
|
|
259
|
+
function gu(e) {
|
|
260
|
+
return e.type === "UnaryExpression" && (e.operator === "+" || e.operator === "-") && ve(e.argument);
|
|
261
|
+
}
|
|
262
|
+
function Q(e) {
|
|
263
|
+
return !!(e && (e.type === "StringLiteral" || e.type === "Literal" && typeof e.value == "string"));
|
|
264
|
+
}
|
|
265
|
+
function Cu(e) {
|
|
266
|
+
return e.type === "RegExpLiteral" || e.type === "Literal" && !!e.regex;
|
|
267
|
+
}
|
|
268
|
+
var tr = I(["Literal", "BooleanLiteral", "BigIntLiteral", "DirectiveLiteral", "NullLiteral", "NumericLiteral", "RegExpLiteral", "StringLiteral"]), So = I(["Identifier", "ThisExpression", "Super", "PrivateName", "PrivateIdentifier"]), _e = I(["ObjectTypeAnnotation", "TSTypeLiteral", "TSMappedType"]), It = I(["FunctionExpression", "ArrowFunctionExpression"]);
|
|
269
|
+
function bo(e) {
|
|
270
|
+
return e.type === "FunctionExpression" || e.type === "ArrowFunctionExpression" && e.body.type === "BlockStatement";
|
|
271
|
+
}
|
|
272
|
+
function En(e) {
|
|
273
|
+
return O(e) && e.callee.type === "Identifier" && ["async", "inject", "fakeAsync", "waitForAsync"].includes(e.callee.name);
|
|
274
|
+
}
|
|
275
|
+
var Y = I(["JSXElement", "JSXFragment"]);
|
|
276
|
+
function Jt(e) {
|
|
277
|
+
return e.method && e.kind === "init" || e.kind === "get" || e.kind === "set";
|
|
278
|
+
}
|
|
279
|
+
function hu(e) {
|
|
280
|
+
return (e.type === "ObjectTypeProperty" || e.type === "ObjectTypeInternalSlot") && !e.static && !e.method && e.kind !== "get" && e.kind !== "set" && e.value.type === "FunctionTypeAnnotation";
|
|
281
|
+
}
|
|
282
|
+
function Bo(e) {
|
|
283
|
+
return (e.type === "TypeAnnotation" || e.type === "TSTypeAnnotation") && e.typeAnnotation.type === "FunctionTypeAnnotation" && !e.static && !sn(e, e.typeAnnotation);
|
|
284
|
+
}
|
|
285
|
+
var Me = I(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]);
|
|
286
|
+
function pt(e) {
|
|
287
|
+
return _(e) || e.type === "BindExpression" && !!e.object;
|
|
288
|
+
}
|
|
289
|
+
var vo = I(["TSThisType", "NullLiteralTypeAnnotation", "BooleanLiteralTypeAnnotation", "StringLiteralTypeAnnotation", "BigIntLiteralTypeAnnotation", "NumberLiteralTypeAnnotation", "TSLiteralType", "TSTemplateLiteralType"]);
|
|
290
|
+
function nr(e) {
|
|
291
|
+
return Eu(e) || Fu(e) || vo(e) || e.type === "GenericTypeAnnotation" && !e.typeParameters || e.type === "TSTypeReference" && !e.typeArguments;
|
|
292
|
+
}
|
|
293
|
+
function Po(e) {
|
|
294
|
+
return e.type === "Identifier" && (e.name === "beforeEach" || e.name === "beforeAll" || e.name === "afterEach" || e.name === "afterAll");
|
|
295
|
+
}
|
|
296
|
+
var ko = ["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"];
|
|
297
|
+
function wo(e) {
|
|
298
|
+
return Qn(e, ko);
|
|
299
|
+
}
|
|
300
|
+
function on(e, t) {
|
|
301
|
+
if ((e == null ? void 0 : e.type) !== "CallExpression" || e.optional) return !1;
|
|
302
|
+
let n = ye(e);
|
|
303
|
+
if (n.length === 1) {
|
|
304
|
+
if (En(e) && on(t)) return It(n[0]);
|
|
305
|
+
if (Po(e.callee)) return En(n[0]);
|
|
306
|
+
} else if ((n.length === 2 || n.length === 3) && (n[0].type === "TemplateLiteral" || Q(n[0])) && wo(e.callee)) return n[2] && !ve(n[2]) ? !1 : (n.length === 2 ? It(n[1]) : bo(n[1]) && ne(n[1]).length <= 1) || En(n[1]);
|
|
307
|
+
return !1;
|
|
308
|
+
}
|
|
309
|
+
var xu = (e) => (t) => ((t == null ? void 0 : t.type) === "ChainExpression" && (t = t.expression), e(t)), O = xu(I(["CallExpression", "OptionalCallExpression"])), _ = xu(I(["MemberExpression", "OptionalMemberExpression"]));
|
|
310
|
+
function Nr(e, t = 5) {
|
|
311
|
+
return Tu(e, t) <= t;
|
|
312
|
+
}
|
|
313
|
+
function Tu(e, t) {
|
|
314
|
+
let n = 0;
|
|
315
|
+
for (let r in e) {
|
|
316
|
+
let u = e[r];
|
|
317
|
+
if (lu(u) && typeof u.type == "string" && (n++, n += Tu(u, t - n)), n > t) return n;
|
|
318
|
+
}
|
|
319
|
+
return n;
|
|
320
|
+
}
|
|
321
|
+
var Io = 0.25;
|
|
322
|
+
function rr(e, t) {
|
|
323
|
+
let { printWidth: n } = t;
|
|
324
|
+
if (x(e)) return !1;
|
|
325
|
+
let r = n * Io;
|
|
326
|
+
if (e.type === "ThisExpression" || e.type === "Identifier" && e.name.length <= r || gu(e) && !x(e.argument)) return !0;
|
|
327
|
+
let u = e.type === "Literal" && "regex" in e && e.regex.pattern || e.type === "RegExpLiteral" && e.pattern;
|
|
328
|
+
return u ? u.length <= r : Q(e) ? yt(ie(e), t).length <= r : e.type === "TemplateLiteral" ? e.expressions.length === 0 && e.quasis[0].value.raw.length <= r && !e.quasis[0].value.raw.includes(`
|
|
329
|
+
`) : e.type === "UnaryExpression" ? rr(e.argument, { printWidth: n }) : e.type === "CallExpression" && e.arguments.length === 0 && e.callee.type === "Identifier" ? e.callee.name.length <= r - 2 : tr(e);
|
|
330
|
+
}
|
|
331
|
+
function Ce(e, t) {
|
|
332
|
+
return Y(t) ? pn(t) : x(t, B.Leading, (n) => oe(e, j(n)));
|
|
333
|
+
}
|
|
334
|
+
function jr(e) {
|
|
335
|
+
return e.quasis.some((t) => t.value.raw.includes(`
|
|
336
|
+
`));
|
|
337
|
+
}
|
|
338
|
+
function Su(e, t) {
|
|
339
|
+
return (e.type === "TemplateLiteral" && jr(e) || e.type === "TaggedTemplateExpression" && jr(e.quasi)) && !oe(t, M(e), { backwards: !0 });
|
|
340
|
+
}
|
|
341
|
+
function bu(e) {
|
|
342
|
+
if (!x(e)) return !1;
|
|
343
|
+
let t = J(0, Ye(e, B.Dangling), -1);
|
|
344
|
+
return t && !Se(t);
|
|
345
|
+
}
|
|
346
|
+
function No(e) {
|
|
347
|
+
if (e.length <= 1) return !1;
|
|
348
|
+
let t = 0;
|
|
349
|
+
for (let n of e) if (It(n)) {
|
|
350
|
+
if (t += 1, t > 1) return !0;
|
|
351
|
+
} else if (O(n)) {
|
|
352
|
+
for (let r of ye(n)) if (It(r)) return !0;
|
|
353
|
+
}
|
|
354
|
+
return !1;
|
|
355
|
+
}
|
|
356
|
+
function Bu(e) {
|
|
357
|
+
let { node: t, parent: n, key: r } = e;
|
|
358
|
+
return r === "callee" && O(t) && O(n) && n.arguments.length > 0 && t.arguments.length > n.arguments.length;
|
|
359
|
+
}
|
|
360
|
+
var jo = /* @__PURE__ */ new Set(["!", "-", "+", "~"]);
|
|
361
|
+
function Ae(e, t = 2) {
|
|
362
|
+
if (t <= 0) return !1;
|
|
363
|
+
if (e.type === "ChainExpression" || e.type === "TSNonNullExpression") return Ae(e.expression, t);
|
|
364
|
+
let n = (r) => Ae(r, t - 1);
|
|
365
|
+
if (Cu(e)) return lt(e.pattern ?? e.regex.pattern) <= 5;
|
|
366
|
+
if (tr(e) || So(e) || e.type === "ArgumentPlaceholder") return !0;
|
|
367
|
+
if (e.type === "TemplateLiteral") return e.quasis.every((r) => !r.value.raw.includes(`
|
|
368
|
+
`)) && e.expressions.every(n);
|
|
369
|
+
if (he(e)) return e.properties.every((r) => !r.computed && (r.shorthand || r.value && n(r.value)));
|
|
370
|
+
if (ee(e)) return e.elements.every((r) => r === null || n(r));
|
|
371
|
+
if (ft(e)) {
|
|
372
|
+
if (e.type === "ImportExpression" || Ae(e.callee, t)) {
|
|
373
|
+
let r = ye(e);
|
|
374
|
+
return r.length <= t && r.every(n);
|
|
375
|
+
}
|
|
376
|
+
return !1;
|
|
377
|
+
}
|
|
378
|
+
return _(e) ? Ae(e.object, t) && Ae(e.property, t) : e.type === "UnaryExpression" && jo.has(e.operator) || e.type === "UpdateExpression" ? Ae(e.argument, t) : !1;
|
|
379
|
+
}
|
|
380
|
+
function we(e, t = "es5") {
|
|
381
|
+
return e.trailingComma === "es5" && t === "es5" || e.trailingComma === "all" && (t === "all" || t === "es5");
|
|
382
|
+
}
|
|
383
|
+
function re(e, t) {
|
|
384
|
+
switch (e.type) {
|
|
385
|
+
case "BinaryExpression":
|
|
386
|
+
case "LogicalExpression":
|
|
387
|
+
case "AssignmentExpression":
|
|
388
|
+
case "NGPipeExpression":
|
|
389
|
+
return re(e.left, t);
|
|
390
|
+
case "MemberExpression":
|
|
391
|
+
case "OptionalMemberExpression":
|
|
392
|
+
return re(e.object, t);
|
|
393
|
+
case "TaggedTemplateExpression":
|
|
394
|
+
return e.tag.type === "FunctionExpression" ? !1 : re(e.tag, t);
|
|
395
|
+
case "CallExpression":
|
|
396
|
+
case "OptionalCallExpression":
|
|
397
|
+
return e.callee.type === "FunctionExpression" ? !1 : re(e.callee, t);
|
|
398
|
+
case "ConditionalExpression":
|
|
399
|
+
return re(e.test, t);
|
|
400
|
+
case "UpdateExpression":
|
|
401
|
+
return !e.prefix && re(e.argument, t);
|
|
402
|
+
case "BindExpression":
|
|
403
|
+
return e.object && re(e.object, t);
|
|
404
|
+
case "SequenceExpression":
|
|
405
|
+
return re(e.expressions[0], t);
|
|
406
|
+
case "ChainExpression":
|
|
407
|
+
case "TSSatisfiesExpression":
|
|
408
|
+
case "TSAsExpression":
|
|
409
|
+
case "TSNonNullExpression":
|
|
410
|
+
case "AsExpression":
|
|
411
|
+
case "AsConstExpression":
|
|
412
|
+
case "SatisfiesExpression":
|
|
413
|
+
return re(e.expression, t);
|
|
414
|
+
default:
|
|
415
|
+
return t(e);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
var Mr = { "==": !0, "!=": !0, "===": !0, "!==": !0 }, Vt = { "*": !0, "/": !0, "%": !0 }, In = { ">>": !0, ">>>": !0, "<<": !0 };
|
|
419
|
+
function ur(e, t) {
|
|
420
|
+
return !(en(t) !== en(e) || e === "**" || Mr[e] && Mr[t] || t === "%" && Vt[e] || e === "%" && Vt[t] || t !== e && Vt[t] && Vt[e] || In[e] && In[t]);
|
|
421
|
+
}
|
|
422
|
+
var Mo = new Map([["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].flatMap((e, t) => e.map((n) => [n, t])));
|
|
423
|
+
function en(e) {
|
|
424
|
+
return Mo.get(e);
|
|
425
|
+
}
|
|
426
|
+
function Lo(e) {
|
|
427
|
+
return !!In[e] || e === "|" || e === "^" || e === "&";
|
|
428
|
+
}
|
|
429
|
+
function Oo(e) {
|
|
430
|
+
var n;
|
|
431
|
+
if (e.rest) return !0;
|
|
432
|
+
let t = ne(e);
|
|
433
|
+
return ((n = J(0, t, -1)) == null ? void 0 : n.type) === "RestElement";
|
|
434
|
+
}
|
|
435
|
+
var An = /* @__PURE__ */ new WeakMap();
|
|
436
|
+
function ne(e) {
|
|
437
|
+
if (An.has(e)) return An.get(e);
|
|
438
|
+
let t = [];
|
|
439
|
+
return e.this && t.push(e.this), t.push(...e.params), e.rest && t.push(e.rest), An.set(e, t), t;
|
|
440
|
+
}
|
|
441
|
+
function Jo(e, t) {
|
|
442
|
+
let { node: n } = e, r = 0, u = () => t(e, r++);
|
|
443
|
+
n.this && e.call(u, "this"), e.each(u, "params"), n.rest && e.call(u, "rest");
|
|
444
|
+
}
|
|
445
|
+
var gn = /* @__PURE__ */ new WeakMap();
|
|
446
|
+
function ye(e) {
|
|
447
|
+
if (gn.has(e)) return gn.get(e);
|
|
448
|
+
if (e.type === "ChainExpression") return ye(e.expression);
|
|
449
|
+
let t;
|
|
450
|
+
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, gn.set(e, t), t;
|
|
451
|
+
}
|
|
452
|
+
function tn(e, t) {
|
|
453
|
+
let { node: n } = e;
|
|
454
|
+
if (n.type === "ChainExpression") return e.call(() => tn(e, t), "expression");
|
|
455
|
+
n.type === "ImportExpression" || n.type === "TSImportType" ? (e.call(() => t(e, 0), "source"), n.options && e.call(() => t(e, 1), "options")) : n.type === "TSExternalModuleReference" ? e.call(() => t(e, 0), "expression") : e.each(t, "arguments");
|
|
456
|
+
}
|
|
457
|
+
function Lr(e, t) {
|
|
458
|
+
let n = [];
|
|
459
|
+
if (e.type === "ChainExpression" && (e = e.expression, n.push("expression")), e.type === "ImportExpression" || e.type === "TSImportType") {
|
|
460
|
+
if (t === 0 || t === (e.options ? -2 : -1)) return [...n, "source"];
|
|
461
|
+
if (e.options && (t === 1 || t === -1)) return [...n, "options"];
|
|
462
|
+
throw new RangeError("Invalid argument index");
|
|
463
|
+
} else if (e.type === "TSExternalModuleReference") {
|
|
464
|
+
if (t === 0 || t === -1) return [...n, "expression"];
|
|
465
|
+
} else if (t < 0 && (t = e.arguments.length + t), t >= 0 && t < e.arguments.length) return [...n, "arguments", t];
|
|
466
|
+
throw new RangeError("Invalid argument index");
|
|
467
|
+
}
|
|
468
|
+
function dt(e) {
|
|
469
|
+
return e.value.trim() === "prettier-ignore" && !e.unignore;
|
|
470
|
+
}
|
|
471
|
+
function pn(e) {
|
|
472
|
+
return (e == null ? void 0 : e.prettierIgnore) || x(e, B.PrettierIgnore);
|
|
473
|
+
}
|
|
474
|
+
var B = { Leading: 2, Trailing: 4, Dangling: 8, Block: 16, Line: 32, PrettierIgnore: 64, First: 128, Last: 256 }, vu = (e, t) => {
|
|
475
|
+
if (typeof e == "function" && (t = e, e = 0), e || t) return (n, r, u) => !(e & B.Leading && !n.leading || e & B.Trailing && !n.trailing || e & B.Dangling && (n.leading || n.trailing) || e & B.Block && !Se(n) || e & B.Line && !Ot(n) || e & B.First && r !== 0 || e & B.Last && r !== u.length - 1 || e & B.PrettierIgnore && !dt(n) || t && !t(n));
|
|
476
|
+
};
|
|
477
|
+
function x(e, t, n) {
|
|
478
|
+
if (!W(e == null ? void 0 : e.comments)) return !1;
|
|
479
|
+
let r = vu(t, n);
|
|
480
|
+
return r ? e.comments.some(r) : !0;
|
|
481
|
+
}
|
|
482
|
+
function Ye(e, t, n) {
|
|
483
|
+
if (!Array.isArray(e == null ? void 0 : e.comments)) return [];
|
|
484
|
+
let r = vu(t, n);
|
|
485
|
+
return r ? e.comments.filter(r) : e.comments;
|
|
486
|
+
}
|
|
487
|
+
var Ie = (e, { originalText: t }) => Yn(t, j(e));
|
|
488
|
+
function ft(e) {
|
|
489
|
+
return O(e) || e.type === "NewExpression" || e.type === "ImportExpression";
|
|
490
|
+
}
|
|
491
|
+
function Ue(e) {
|
|
492
|
+
return e && (e.type === "ObjectProperty" || e.type === "Property" && !Jt(e));
|
|
493
|
+
}
|
|
494
|
+
var ge = I(["TSAsExpression", "TSSatisfiesExpression", "AsExpression", "AsConstExpression", "SatisfiesExpression"]), Pe = I(["TSUnionType", "UnionTypeAnnotation"]), qt = I(["TSIntersectionType", "IntersectionTypeAnnotation"]), We = I(["TSConditionalType", "ConditionalTypeAnnotation"]), qo = (e) => (e == null ? void 0 : e.type) === "TSAsExpression" && e.typeAnnotation.type === "TSTypeReference" && e.typeAnnotation.typeName.type === "Identifier" && e.typeAnnotation.typeName.name === "const", Nn = I(["TSTypeAliasDeclaration", "TypeAlias"]);
|
|
495
|
+
function Pu({ key: e, parent: t }) {
|
|
496
|
+
return !(e === "types" && Pe(t) || e === "types" && qt(t));
|
|
497
|
+
}
|
|
498
|
+
var Xo = /* @__PURE__ */ new Set(["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "loc", "flags", "errors", "tokens"]), ot = (e) => {
|
|
499
|
+
for (let t of e.quasis) delete t.value;
|
|
500
|
+
};
|
|
501
|
+
function ku(e, t, n) {
|
|
502
|
+
var u;
|
|
503
|
+
if (e.type === "Program" && delete t.sourceType, (e.type === "BigIntLiteral" || e.type === "Literal") && e.bigint && (t.bigint = e.bigint.toLowerCase()), e.type === "EmptyStatement" && !Zn({ node: e, parent: n }) || e.type === "JSXText" || e.type === "JSXExpressionContainer" && (e.expression.type === "Literal" || e.expression.type === "StringLiteral") && e.expression.value === " ") return null;
|
|
504
|
+
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) {
|
|
505
|
+
let { key: a } = e;
|
|
506
|
+
Q(a) || ve(a) ? t.key = String(a.value) : a.type === "Identifier" && (t.key = a.name);
|
|
507
|
+
}
|
|
508
|
+
if (e.type === "JSXElement" && e.openingElement.name.name === "style" && e.openingElement.attributes.some((a) => a.type === "JSXAttribute" && a.name.name === "jsx")) for (let { type: a, expression: s } of t.children) a === "JSXExpressionContainer" && s.type === "TemplateLiteral" && ot(s);
|
|
509
|
+
e.type === "JSXAttribute" && e.name.name === "css" && e.value.type === "JSXExpressionContainer" && e.value.expression.type === "TemplateLiteral" && ot(t.value.expression), e.type === "JSXAttribute" && ((u = e.value) == null ? void 0 : u.type) === "Literal" && /["']|"|'/u.test(e.value.value) && (t.value.value = z(0, e.value.value, /["']|"|'/gu, '"'));
|
|
510
|
+
let r = e.expression || e.callee;
|
|
511
|
+
if (e.type === "Decorator" && r.type === "CallExpression" && r.callee.name === "Component" && r.arguments.length === 1) {
|
|
512
|
+
let a = e.expression.arguments[0].properties;
|
|
513
|
+
for (let [s, o] of t.expression.arguments[0].properties.entries()) switch (a[s].key.name) {
|
|
514
|
+
case "styles":
|
|
515
|
+
ee(o.value) && ot(o.value.elements[0]);
|
|
516
|
+
break;
|
|
517
|
+
case "template":
|
|
518
|
+
o.value.type === "TemplateLiteral" && ot(o.value);
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
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") && ot(t.quasi), e.type === "TemplateLiteral" && ot(t), e.type === "ChainExpression" && e.expression.type === "TSNonNullExpression" && (t.type = "TSNonNullExpression", t.expression.type = "ChainExpression");
|
|
523
|
+
}
|
|
524
|
+
ku.ignoredProperties = Xo;
|
|
525
|
+
var Ro = ku, _o = I(["File", "TemplateElement", "TSEmptyBodyFunctionExpression", "ChainExpression"]), Wo = (e, [t]) => (t == null ? void 0 : t.type) === "ComponentParameter" && t.shorthand && t.name === e && t.local !== t.name || (t == null ? void 0 : t.type) === "MatchObjectPatternProperty" && t.shorthand && t.key === e && t.value !== t.key || (t == null ? void 0 : t.type) === "ObjectProperty" && t.shorthand && t.key === e && t.value !== t.key || (t == null ? void 0 : t.type) === "Property" && t.shorthand && t.key === e && !Jt(t) && t.value !== t.key, Uo = (e, [t]) => !!(e.type === "FunctionExpression" && t.type === "MethodDefinition" && t.value === e && ne(e).length === 0 && !e.returnType && !W(e.typeParameters) && e.body), Or = (e, [t]) => (t == null ? void 0 : t.typeAnnotation) === e && qo(t), $o = (e, [t, ...n]) => Or(e, [t]) || (t == null ? void 0 : t.typeName) === e && Or(t, n);
|
|
526
|
+
function Go(e, t) {
|
|
527
|
+
return _o(e) || Wo(e, t) || Uo(e, t) ? !1 : e.type === "EmptyStatement" ? Zn({ node: e, parent: t[0] }) : !($o(e, t) || e.type === "TSTypeAnnotation" && t[0].type === "TSPropertySignature");
|
|
528
|
+
}
|
|
529
|
+
var Vo = Go;
|
|
530
|
+
function Ko(e) {
|
|
531
|
+
let t = e.type || e.kind || "(unknown type)", n = 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 || "");
|
|
532
|
+
return n.length > 20 && (n = n.slice(0, 19) + "…"), t + (n ? " " + n : "");
|
|
533
|
+
}
|
|
534
|
+
function ar(e, t) {
|
|
535
|
+
(e.comments ?? (e.comments = [])).push(t), t.printed = !1, t.nodeDescription = Ko(e);
|
|
536
|
+
}
|
|
537
|
+
function V(e, t) {
|
|
538
|
+
t.leading = !0, t.trailing = !1, ar(e, t);
|
|
539
|
+
}
|
|
540
|
+
function le(e, t, n) {
|
|
541
|
+
t.leading = !1, t.trailing = !1, n && (t.marker = n), ar(e, t);
|
|
542
|
+
}
|
|
543
|
+
function $(e, t) {
|
|
544
|
+
t.leading = !1, t.trailing = !0, ar(e, t);
|
|
545
|
+
}
|
|
546
|
+
function Ho(e, t) {
|
|
547
|
+
let n = null, r = t;
|
|
548
|
+
for (; r !== n; ) n = r, r = ct(e, r), r = Hn(e, r), r = zn(e, r), r = Dt(e, r);
|
|
549
|
+
return r;
|
|
550
|
+
}
|
|
551
|
+
var Ft = Ho;
|
|
552
|
+
function zo(e, t) {
|
|
553
|
+
let n = Ft(e, t);
|
|
554
|
+
return n === !1 ? "" : e.charAt(n);
|
|
555
|
+
}
|
|
556
|
+
var xe = zo;
|
|
557
|
+
function Yo(e, t, n) {
|
|
558
|
+
for (let r = t; r < n; ++r) if (e.charAt(r) === `
|
|
559
|
+
`) return !0;
|
|
560
|
+
return !1;
|
|
561
|
+
}
|
|
562
|
+
var ce = Yo, Cn = /* @__PURE__ */ new WeakMap();
|
|
563
|
+
function Qo(e) {
|
|
564
|
+
return Cn.has(e) || Cn.set(e, Se(e) && e.value[0] === "*" && /@(?:type|satisfies)\b/u.test(e.value)), Cn.get(e);
|
|
565
|
+
}
|
|
566
|
+
var wu = Qo, sr = (e, t) => Ot(e) || !ce(t, M(e), j(e));
|
|
567
|
+
function Zo(e) {
|
|
568
|
+
return [Xu, Nu, Ou, li, ri, or, ir, Iu, ju, fi, Di, yi, lr, qu, mi, Mu, Ju, pr, ui, xi, Ru, cr].some((t) => t(e));
|
|
569
|
+
}
|
|
570
|
+
function ei(e) {
|
|
571
|
+
return [ni, Ou, Nu, qu, or, ir, Iu, ju, Ju, ci, di, lr, Ai, pr, Ci, hi, Ti, Ru, bi, Si, cr].some((t) => t(e));
|
|
572
|
+
}
|
|
573
|
+
function ti(e) {
|
|
574
|
+
return [Xu, or, ir, pi, Mu, lr, ii, oi, pr, gi, cr].some((t) => t(e));
|
|
575
|
+
}
|
|
576
|
+
function Ze(e, t) {
|
|
577
|
+
let n = (e.body || e.properties).find(({ type: r }) => r !== "EmptyStatement");
|
|
578
|
+
n ? V(n, t) : le(e, t);
|
|
579
|
+
}
|
|
580
|
+
function jn(e, t) {
|
|
581
|
+
e.type === "BlockStatement" ? Ze(e, t) : V(e, t);
|
|
582
|
+
}
|
|
583
|
+
function ni({ comment: e, followingNode: t }) {
|
|
584
|
+
return t && wu(e) ? (V(t, e), !0) : !1;
|
|
585
|
+
}
|
|
586
|
+
function or({ comment: e, precedingNode: t, enclosingNode: n, followingNode: r, text: u }) {
|
|
587
|
+
if ((n == null ? void 0 : n.type) !== "IfStatement" || !r) return !1;
|
|
588
|
+
if (xe(u, j(e)) === ")") return $(t, e), !0;
|
|
589
|
+
if (r.type === "BlockStatement" && r === n.consequent && M(e) >= j(t) && j(e) <= M(r)) return V(r, e), !0;
|
|
590
|
+
if (t === n.consequent && r === n.alternate) {
|
|
591
|
+
let a = Ft(u, j(n.consequent));
|
|
592
|
+
if (r.type === "BlockStatement" && M(e) >= a && j(e) <= M(r)) return V(r, e), !0;
|
|
593
|
+
if (M(e) < a || n.alternate.type === "BlockStatement") return t.type === "BlockStatement" || sr(e, u) && !ce(u, M(t), M(e)) ? ($(t, e), !0) : (le(n, e), !0);
|
|
594
|
+
}
|
|
595
|
+
return r.type === "BlockStatement" ? (Ze(r, e), !0) : r.type === "IfStatement" ? (jn(r.consequent, e), !0) : n.consequent === r ? (V(r, e), !0) : !1;
|
|
596
|
+
}
|
|
597
|
+
function ir({ comment: e, precedingNode: t, enclosingNode: n, followingNode: r, text: u }) {
|
|
598
|
+
return (n == null ? void 0 : n.type) !== "WhileStatement" || !r ? !1 : xe(u, j(e)) === ")" ? ($(t, e), !0) : r.type === "BlockStatement" ? (Ze(r, e), !0) : n.body === r ? (V(r, e), !0) : !1;
|
|
599
|
+
}
|
|
600
|
+
function Iu({ comment: e, precedingNode: t, enclosingNode: n, followingNode: r }) {
|
|
601
|
+
return (n == null ? void 0 : n.type) !== "TryStatement" && (n == null ? void 0 : n.type) !== "CatchClause" || !r ? !1 : n.type === "CatchClause" && t ? ($(t, e), !0) : r.type === "BlockStatement" ? (Ze(r, e), !0) : r.type === "TryStatement" ? (jn(r.finalizer, e), !0) : r.type === "CatchClause" ? (jn(r.body, e), !0) : !1;
|
|
602
|
+
}
|
|
603
|
+
function ri({ comment: e, enclosingNode: t, followingNode: n }) {
|
|
604
|
+
return _(t) && (n == null ? void 0 : n.type) === "Identifier" ? (V(t, e), !0) : !1;
|
|
605
|
+
}
|
|
606
|
+
function ui({ comment: e, enclosingNode: t, followingNode: n, options: r }) {
|
|
607
|
+
return !r.experimentalTernaries || !((t == null ? void 0 : t.type) === "ConditionalExpression" || We(t)) ? !1 : (n == null ? void 0 : n.type) === "ConditionalExpression" || We(n) ? (le(t, e), !0) : !1;
|
|
608
|
+
}
|
|
609
|
+
function Nu({ comment: e, precedingNode: t, enclosingNode: n, followingNode: r, text: u, options: a }) {
|
|
610
|
+
let s = t && !ce(u, j(t), M(e));
|
|
611
|
+
return (!t || !s) && ((n == null ? void 0 : n.type) === "ConditionalExpression" || We(n)) && r ? a.experimentalTernaries && n.alternate === r && !(Se(e) && !ce(a.originalText, M(e), j(e))) ? (le(n, e), !0) : (V(r, e), !0) : !1;
|
|
612
|
+
}
|
|
613
|
+
var ai = I(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]);
|
|
614
|
+
function ju({ comment: e, precedingNode: t, enclosingNode: n, followingNode: r }) {
|
|
615
|
+
if (ai(n)) {
|
|
616
|
+
if (W(n.decorators) && (r == null ? void 0 : r.type) !== "Decorator") return $(J(0, n.decorators, -1), e), !0;
|
|
617
|
+
if (n.body && r === n.body) return Ze(n.body, e), !0;
|
|
618
|
+
if (r) {
|
|
619
|
+
if (n.superClass && r === n.superClass && t && (t === n.id || t === n.typeParameters)) return $(t, e), !0;
|
|
620
|
+
for (let u of ["implements", "extends", "mixins"]) if (n[u] && r === n[u][0]) return t && (t === n.id || t === n.typeParameters || t === n.superClass) ? $(t, e) : le(n, e, u), !0;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return !1;
|
|
624
|
+
}
|
|
625
|
+
var si = I(["ClassMethod", "ClassProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod", "MethodDefinition", "ClassAccessorProperty", "AccessorProperty", "TSAbstractAccessorProperty", "TSParameterProperty"]);
|
|
626
|
+
function Mu({ comment: e, precedingNode: t, enclosingNode: n, text: r }) {
|
|
627
|
+
return n && t && xe(r, j(e)) === "(" && (n.type === "Property" || n.type === "TSDeclareMethod" || n.type === "TSAbstractMethodDefinition") && t.type === "Identifier" && n.key === t && xe(r, j(t)) !== ":" || (t == null ? void 0 : t.type) === "Decorator" && si(n) && (Ot(e) || e.placement === "ownLine") ? ($(t, e), !0) : !1;
|
|
628
|
+
}
|
|
629
|
+
var Lu = I(["FunctionDeclaration", "FunctionExpression", "ClassMethod", "MethodDefinition", "ObjectMethod"]);
|
|
630
|
+
function oi({ comment: e, precedingNode: t, enclosingNode: n, text: r }) {
|
|
631
|
+
return xe(r, j(e)) !== "(" ? !1 : t && Lu(n) ? ($(t, e), !0) : !1;
|
|
632
|
+
}
|
|
633
|
+
function ii({ comment: e, enclosingNode: t, text: n }) {
|
|
634
|
+
if ((t == null ? void 0 : t.type) !== "ArrowFunctionExpression") return !1;
|
|
635
|
+
let r = Ft(n, j(e));
|
|
636
|
+
return r !== !1 && n.slice(r, r + 2) === "=>" ? (le(t, e), !0) : !1;
|
|
637
|
+
}
|
|
638
|
+
function pi({ comment: e, enclosingNode: t, text: n }) {
|
|
639
|
+
return xe(n, j(e)) !== ")" ? !1 : t && (_u(t) && ne(t).length === 0 || ft(t) && ye(t).length === 0) ? (le(t, e), !0) : ((t == null ? void 0 : t.type) === "MethodDefinition" || (t == null ? void 0 : t.type) === "TSAbstractMethodDefinition") && ne(t.value).length === 0 ? (le(t.value, e), !0) : !1;
|
|
640
|
+
}
|
|
641
|
+
function li({ comment: e, precedingNode: t, enclosingNode: n, followingNode: r, text: u }) {
|
|
642
|
+
return (t == null ? void 0 : t.type) === "ComponentTypeParameter" && ((n == null ? void 0 : n.type) === "DeclareComponent" || (n == null ? void 0 : n.type) === "ComponentTypeAnnotation") && (r == null ? void 0 : r.type) !== "ComponentTypeParameter" || ((t == null ? void 0 : t.type) === "ComponentParameter" || (t == null ? void 0 : t.type) === "RestElement") && (n == null ? void 0 : n.type) === "ComponentDeclaration" && xe(u, j(e)) === ")" ? ($(t, e), !0) : !1;
|
|
643
|
+
}
|
|
644
|
+
function Ou({ comment: e, precedingNode: t, enclosingNode: n, followingNode: r, text: u }) {
|
|
645
|
+
return (t == null ? void 0 : t.type) === "FunctionTypeParam" && (n == null ? void 0 : n.type) === "FunctionTypeAnnotation" && (r == null ? void 0 : r.type) !== "FunctionTypeParam" || ((t == null ? void 0 : t.type) === "Identifier" || (t == null ? void 0 : t.type) === "AssignmentPattern" || (t == null ? void 0 : t.type) === "ObjectPattern" || (t == null ? void 0 : t.type) === "ArrayPattern" || (t == null ? void 0 : t.type) === "RestElement" || (t == null ? void 0 : t.type) === "TSParameterProperty") && _u(n) && xe(u, j(e)) === ")" ? ($(t, e), !0) : !Se(e) && (r == null ? void 0 : r.type) === "BlockStatement" && Lu(n) && (n.type === "MethodDefinition" ? n.value.body : n.body) === r && Ft(u, j(e)) === M(r) ? (Ze(r, e), !0) : !1;
|
|
646
|
+
}
|
|
647
|
+
function Ju({ comment: e, enclosingNode: t }) {
|
|
648
|
+
return (t == null ? void 0 : t.type) === "LabeledStatement" ? (V(t, e), !0) : !1;
|
|
649
|
+
}
|
|
650
|
+
function pr({ comment: e, enclosingNode: t }) {
|
|
651
|
+
return ((t == null ? void 0 : t.type) === "ContinueStatement" || (t == null ? void 0 : t.type) === "BreakStatement") && !t.label ? ($(t, e), !0) : !1;
|
|
652
|
+
}
|
|
653
|
+
function ci({ comment: e, precedingNode: t, enclosingNode: n }) {
|
|
654
|
+
return O(n) && t && n.callee === t && n.arguments.length > 0 ? (V(n.arguments[0], e), !0) : !1;
|
|
655
|
+
}
|
|
656
|
+
function Di({ comment: e, precedingNode: t, enclosingNode: n, followingNode: r }) {
|
|
657
|
+
return Pe(n) ? (dt(e) && (r.prettierIgnore = !0, e.unignore = !0), t ? ($(t, e), !0) : !1) : (Pe(r) && dt(e) && (r.types[0].prettierIgnore = !0, e.unignore = !0), !1);
|
|
658
|
+
}
|
|
659
|
+
function yi({ comment: e, precedingNode: t, enclosingNode: n, followingNode: r }) {
|
|
660
|
+
return n && n.type === "MatchOrPattern" ? (dt(e) && (r.prettierIgnore = !0, e.unignore = !0), t ? ($(t, e), !0) : !1) : (r && r.type === "MatchOrPattern" && dt(e) && (r.types[0].prettierIgnore = !0, e.unignore = !0), !1);
|
|
661
|
+
}
|
|
662
|
+
function di({ comment: e, enclosingNode: t }) {
|
|
663
|
+
return Ue(t) ? (V(t, e), !0) : !1;
|
|
664
|
+
}
|
|
665
|
+
function lr({ comment: e, enclosingNode: t, ast: n, isLastComment: r }) {
|
|
666
|
+
var u;
|
|
667
|
+
return ((u = n == null ? void 0 : n.body) == null ? void 0 : u.length) === 0 ? (r ? le(n, e) : V(n, e), !0) : (t == null ? void 0 : t.type) === "Program" && t.body.length === 0 && !W(t.directives) ? (r ? le(t, e) : V(t, e), !0) : !1;
|
|
668
|
+
}
|
|
669
|
+
function fi({ comment: e, enclosingNode: t, followingNode: n }) {
|
|
670
|
+
return ((t == null ? void 0 : t.type) === "ForInStatement" || (t == null ? void 0 : t.type) === "ForOfStatement") && n !== t.body ? (V(t, e), !0) : !1;
|
|
671
|
+
}
|
|
672
|
+
function qu({ comment: e, precedingNode: t, enclosingNode: n, text: r }) {
|
|
673
|
+
if ((n == null ? void 0 : n.type) === "ImportSpecifier" || (n == null ? void 0 : n.type) === "ExportSpecifier") return V(n, e), !0;
|
|
674
|
+
let u = (t == null ? void 0 : t.type) === "ImportSpecifier" && (n == null ? void 0 : n.type) === "ImportDeclaration", a = (t == null ? void 0 : t.type) === "ExportSpecifier" && (n == null ? void 0 : n.type) === "ExportNamedDeclaration";
|
|
675
|
+
return (u || a) && oe(r, j(e)) ? ($(t, e), !0) : !1;
|
|
676
|
+
}
|
|
677
|
+
function mi({ comment: e, enclosingNode: t }) {
|
|
678
|
+
return (t == null ? void 0 : t.type) === "AssignmentPattern" ? (V(t, e), !0) : !1;
|
|
679
|
+
}
|
|
680
|
+
var Fi = I(["VariableDeclarator", "AssignmentExpression", "TypeAlias", "TSTypeAliasDeclaration"]), Ei = I(["ObjectExpression", "ArrayExpression", "TemplateLiteral", "TaggedTemplateExpression", "ObjectTypeAnnotation", "TSTypeLiteral"]);
|
|
681
|
+
function Ai({ comment: e, enclosingNode: t, followingNode: n }) {
|
|
682
|
+
return Fi(t) && n && (Ei(n) || Se(e)) ? (V(n, e), !0) : !1;
|
|
683
|
+
}
|
|
684
|
+
function gi({ comment: e, enclosingNode: t, precedingNode: n, followingNode: r, text: u }) {
|
|
685
|
+
return !r && ((t == null ? void 0 : t.type) === "TSMethodSignature" || (t == null ? void 0 : t.type) === "TSDeclareFunction" || (t == null ? void 0 : t.type) === "TSAbstractMethodDefinition") && (!n || n !== t.returnType) && xe(u, j(e)) === ";" ? ($(t, e), !0) : !1;
|
|
686
|
+
}
|
|
687
|
+
function Xu({ comment: e, enclosingNode: t, followingNode: n }) {
|
|
688
|
+
if (dt(e) && (t == null ? void 0 : t.type) === "TSMappedType" && n === t.key) return t.prettierIgnore = !0, e.unignore = !0, !0;
|
|
689
|
+
}
|
|
690
|
+
function Ru({ comment: e, precedingNode: t, enclosingNode: n }) {
|
|
691
|
+
if ((n == null ? void 0 : n.type) === "TSMappedType" && !t) return le(n, e), !0;
|
|
692
|
+
}
|
|
693
|
+
function Ci({ comment: e, enclosingNode: t, followingNode: n }) {
|
|
694
|
+
return !t || t.type !== "SwitchCase" || t.test || !n || n !== t.consequent[0] ? !1 : (n.type === "BlockStatement" && Ot(e) ? Ze(n, e) : le(t, e), !0);
|
|
695
|
+
}
|
|
696
|
+
function hi({ comment: e, precedingNode: t, enclosingNode: n, followingNode: r }) {
|
|
697
|
+
return Pe(t) && ((n.type === "TSArrayType" || n.type === "ArrayTypeAnnotation") && !r || qt(n)) ? ($(J(0, t.types, -1), e), !0) : !1;
|
|
698
|
+
}
|
|
699
|
+
function xi({ comment: e, enclosingNode: t, precedingNode: n, followingNode: r }) {
|
|
700
|
+
if (((t == null ? void 0 : t.type) === "ObjectPattern" || (t == null ? void 0 : t.type) === "ArrayPattern") && (r == null ? void 0 : r.type) === "TSTypeAnnotation") return n ? $(n, e) : le(t, e), !0;
|
|
701
|
+
}
|
|
702
|
+
function Ti({ comment: e, precedingNode: t, enclosingNode: n, followingNode: r, text: u }) {
|
|
703
|
+
return !r && (n == null ? void 0 : n.type) === "UnaryExpression" && ((t == null ? void 0 : t.type) === "LogicalExpression" || (t == null ? void 0 : t.type) === "BinaryExpression") && ce(u, M(n.argument), M(t.right)) && sr(e, u) && !ce(u, M(t.right), M(e)) ? ($(t.right, e), !0) : !1;
|
|
704
|
+
}
|
|
705
|
+
function Si({ enclosingNode: e, followingNode: t, comment: n }) {
|
|
706
|
+
if (e && (e.type === "TSPropertySignature" || e.type === "ObjectTypeProperty") && (Pe(t) || qt(t))) return V(t, n), !0;
|
|
707
|
+
}
|
|
708
|
+
function cr({ enclosingNode: e, precedingNode: t, followingNode: n, comment: r, text: u }) {
|
|
709
|
+
if (ge(e) && t === e.expression && !sr(r, u)) return n ? V(n, r) : $(e, r), !0;
|
|
710
|
+
}
|
|
711
|
+
function bi({ comment: e, enclosingNode: t, followingNode: n, precedingNode: r }) {
|
|
712
|
+
return t && n && r && t.type === "ArrowFunctionExpression" && t.returnType === r && (r.type === "TSTypeAnnotation" || r.type === "TypeAnnotation") ? (V(n, e), !0) : !1;
|
|
713
|
+
}
|
|
714
|
+
var _u = I(["ArrowFunctionExpression", "FunctionExpression", "FunctionDeclaration", "ObjectMethod", "ClassMethod", "TSDeclareFunction", "TSCallSignatureDeclaration", "TSConstructSignatureDeclaration", "TSMethodSignature", "TSConstructorType", "TSFunctionType", "TSDeclareMethod"]), Bi = { endOfLine: ei, ownLine: Zo, remaining: ti }, vi = Bi;
|
|
715
|
+
function Pi(e, { parser: t }) {
|
|
716
|
+
if (t === "flow" || t === "hermes" || t === "babel-flow") return e = z(0, e, /[\s(]/gu, ""), e === "" || e === "/*" || e === "/*::";
|
|
717
|
+
}
|
|
718
|
+
var ki = Pi, wi = I(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]);
|
|
719
|
+
function Ii(e) {
|
|
720
|
+
let { key: t, parent: n } = e;
|
|
721
|
+
if (t === "types" && Pe(n) || t === "argument" && n.type === "JSXSpreadAttribute" || t === "expression" && n.type === "JSXSpreadChild" || t === "superClass" && (n.type === "ClassDeclaration" || n.type === "ClassExpression") || (t === "id" || t === "typeParameters") && wi(n) || t === "patterns" && n.type === "MatchOrPattern") return !0;
|
|
722
|
+
let { node: r } = e;
|
|
723
|
+
return pn(r) ? !1 : Pe(r) ? Pu(e) : !!Y(r);
|
|
724
|
+
}
|
|
725
|
+
var Ni = Ii, et = "string", Le = "array", Et = "cursor", tt = "indent", nt = "align", rt = "trim", Ee = "group", $e = "fill", Be = "if-break", ut = "indent-if-break", at = "line-suffix", Ge = "line-suffix-boundary", pe = "line", Je = "label", qe = "break-parent", Wu = /* @__PURE__ */ new Set([Et, tt, nt, rt, Ee, $e, Be, ut, at, Ge, pe, Je, qe]);
|
|
726
|
+
function ji(e) {
|
|
727
|
+
if (typeof e == "string") return et;
|
|
728
|
+
if (Array.isArray(e)) return Le;
|
|
729
|
+
if (!e) return;
|
|
730
|
+
let { type: t } = e;
|
|
731
|
+
if (Wu.has(t)) return t;
|
|
732
|
+
}
|
|
733
|
+
var Ve = ji, Mi = (e) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(e);
|
|
734
|
+
function Li(e) {
|
|
735
|
+
let t = e === null ? "null" : typeof e;
|
|
736
|
+
if (t !== "string" && t !== "object") return `Unexpected doc '${t}',
|
|
737
|
+
Expected it to be 'string' or 'object'.`;
|
|
738
|
+
if (Ve(e)) throw new Error("doc is valid.");
|
|
739
|
+
let n = Object.prototype.toString.call(e);
|
|
740
|
+
if (n !== "[object Object]") return `Unexpected doc '${n}'.`;
|
|
741
|
+
let r = Mi([...Wu].map((u) => `'${u}'`));
|
|
742
|
+
return `Unexpected doc.type '${e.type}'.
|
|
743
|
+
Expected it to be ${r}.`;
|
|
744
|
+
}
|
|
745
|
+
var Oi = class extends Error {
|
|
746
|
+
constructor(t) {
|
|
747
|
+
super(Li(t));
|
|
748
|
+
Gt(this, "name", "InvalidDocError");
|
|
749
|
+
this.doc = t;
|
|
750
|
+
}
|
|
751
|
+
}, Nt = Oi, Jr = {};
|
|
752
|
+
function Ji(e, t, n, r) {
|
|
753
|
+
let u = [e];
|
|
754
|
+
for (; u.length > 0; ) {
|
|
755
|
+
let a = u.pop();
|
|
756
|
+
if (a === Jr) {
|
|
757
|
+
n(u.pop());
|
|
758
|
+
continue;
|
|
759
|
+
}
|
|
760
|
+
n && u.push(a, Jr);
|
|
761
|
+
let s = Ve(a);
|
|
762
|
+
if (!s) throw new Nt(a);
|
|
763
|
+
if ((t == null ? void 0 : t(a)) !== !1) switch (s) {
|
|
764
|
+
case Le:
|
|
765
|
+
case $e: {
|
|
766
|
+
let o = s === Le ? a : a.parts;
|
|
767
|
+
for (let p = o.length, l = p - 1; l >= 0; --l) u.push(o[l]);
|
|
768
|
+
break;
|
|
769
|
+
}
|
|
770
|
+
case Be:
|
|
771
|
+
u.push(a.flatContents, a.breakContents);
|
|
772
|
+
break;
|
|
773
|
+
case Ee:
|
|
774
|
+
if (r && a.expandedStates) for (let o = a.expandedStates.length, p = o - 1; p >= 0; --p) u.push(a.expandedStates[p]);
|
|
775
|
+
else u.push(a.contents);
|
|
776
|
+
break;
|
|
777
|
+
case nt:
|
|
778
|
+
case tt:
|
|
779
|
+
case ut:
|
|
780
|
+
case Je:
|
|
781
|
+
case at:
|
|
782
|
+
u.push(a.contents);
|
|
783
|
+
break;
|
|
784
|
+
case et:
|
|
785
|
+
case Et:
|
|
786
|
+
case rt:
|
|
787
|
+
case Ge:
|
|
788
|
+
case pe:
|
|
789
|
+
case qe:
|
|
790
|
+
break;
|
|
791
|
+
default:
|
|
792
|
+
throw new Nt(a);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
var Dr = Ji;
|
|
797
|
+
function At(e, t) {
|
|
798
|
+
if (typeof e == "string") return t(e);
|
|
799
|
+
let n = /* @__PURE__ */ new Map();
|
|
800
|
+
return r(e);
|
|
801
|
+
function r(a) {
|
|
802
|
+
if (n.has(a)) return n.get(a);
|
|
803
|
+
let s = u(a);
|
|
804
|
+
return n.set(a, s), s;
|
|
805
|
+
}
|
|
806
|
+
function u(a) {
|
|
807
|
+
switch (Ve(a)) {
|
|
808
|
+
case Le:
|
|
809
|
+
return t(a.map(r));
|
|
810
|
+
case $e:
|
|
811
|
+
return t({ ...a, parts: a.parts.map(r) });
|
|
812
|
+
case Be:
|
|
813
|
+
return t({ ...a, breakContents: r(a.breakContents), flatContents: r(a.flatContents) });
|
|
814
|
+
case Ee: {
|
|
815
|
+
let { expandedStates: s, contents: o } = a;
|
|
816
|
+
return s ? (s = s.map(r), o = s[0]) : o = r(o), t({ ...a, contents: o, expandedStates: s });
|
|
817
|
+
}
|
|
818
|
+
case nt:
|
|
819
|
+
case tt:
|
|
820
|
+
case ut:
|
|
821
|
+
case Je:
|
|
822
|
+
case at:
|
|
823
|
+
return t({ ...a, contents: r(a.contents) });
|
|
824
|
+
case et:
|
|
825
|
+
case Et:
|
|
826
|
+
case rt:
|
|
827
|
+
case Ge:
|
|
828
|
+
case pe:
|
|
829
|
+
case qe:
|
|
830
|
+
return t(a);
|
|
831
|
+
default:
|
|
832
|
+
throw new Nt(a);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
function Uu(e, t, n) {
|
|
837
|
+
let r = n, u = !1;
|
|
838
|
+
function a(s) {
|
|
839
|
+
if (u) return !1;
|
|
840
|
+
let o = t(s);
|
|
841
|
+
o !== void 0 && (u = !0, r = o);
|
|
842
|
+
}
|
|
843
|
+
return Dr(e, a), r;
|
|
844
|
+
}
|
|
845
|
+
function qi(e) {
|
|
846
|
+
if (e.type === Ee && e.break || e.type === pe && e.hard || e.type === qe) return !0;
|
|
847
|
+
}
|
|
848
|
+
function ue(e) {
|
|
849
|
+
return Uu(e, qi, !1);
|
|
850
|
+
}
|
|
851
|
+
function qr(e) {
|
|
852
|
+
if (e.length > 0) {
|
|
853
|
+
let t = J(0, e, -1);
|
|
854
|
+
!t.expandedStates && !t.break && (t.break = "propagated");
|
|
855
|
+
}
|
|
856
|
+
return null;
|
|
857
|
+
}
|
|
858
|
+
function Xi(e) {
|
|
859
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
860
|
+
function r(a) {
|
|
861
|
+
if (a.type === qe && qr(n), a.type === Ee) {
|
|
862
|
+
if (n.push(a), t.has(a)) return !1;
|
|
863
|
+
t.add(a);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
function u(a) {
|
|
867
|
+
a.type === Ee && n.pop().break && qr(n);
|
|
868
|
+
}
|
|
869
|
+
Dr(e, r, u, !0);
|
|
870
|
+
}
|
|
871
|
+
function Ri(e) {
|
|
872
|
+
return e.type === pe && !e.hard ? e.soft ? "" : " " : e.type === Be ? e.flatContents : e;
|
|
873
|
+
}
|
|
874
|
+
function nn(e) {
|
|
875
|
+
return At(e, Ri);
|
|
876
|
+
}
|
|
877
|
+
function _i(e) {
|
|
878
|
+
switch (Ve(e)) {
|
|
879
|
+
case $e:
|
|
880
|
+
if (e.parts.every((t) => t === "")) return "";
|
|
881
|
+
break;
|
|
882
|
+
case Ee:
|
|
883
|
+
if (!e.contents && !e.id && !e.break && !e.expandedStates) return "";
|
|
884
|
+
if (e.contents.type === Ee && e.contents.id === e.id && e.contents.break === e.break && e.contents.expandedStates === e.expandedStates) return e.contents;
|
|
885
|
+
break;
|
|
886
|
+
case nt:
|
|
887
|
+
case tt:
|
|
888
|
+
case ut:
|
|
889
|
+
case at:
|
|
890
|
+
if (!e.contents) return "";
|
|
891
|
+
break;
|
|
892
|
+
case Be:
|
|
893
|
+
if (!e.flatContents && !e.breakContents) return "";
|
|
894
|
+
break;
|
|
895
|
+
case Le: {
|
|
896
|
+
let t = [];
|
|
897
|
+
for (let n of e) {
|
|
898
|
+
if (!n) continue;
|
|
899
|
+
let [r, ...u] = Array.isArray(n) ? n : [n];
|
|
900
|
+
typeof r == "string" && typeof J(0, t, -1) == "string" ? t[t.length - 1] += r : t.push(r), t.push(...u);
|
|
901
|
+
}
|
|
902
|
+
return t.length === 0 ? "" : t.length === 1 ? t[0] : t;
|
|
903
|
+
}
|
|
904
|
+
case et:
|
|
905
|
+
case Et:
|
|
906
|
+
case rt:
|
|
907
|
+
case Ge:
|
|
908
|
+
case pe:
|
|
909
|
+
case Je:
|
|
910
|
+
case qe:
|
|
911
|
+
break;
|
|
912
|
+
default:
|
|
913
|
+
throw new Nt(e);
|
|
914
|
+
}
|
|
915
|
+
return e;
|
|
916
|
+
}
|
|
917
|
+
function yr(e) {
|
|
918
|
+
return At(e, (t) => _i(t));
|
|
919
|
+
}
|
|
920
|
+
function Qe(e, t = Ku) {
|
|
921
|
+
return At(e, (n) => typeof n == "string" ? L(t, n.split(`
|
|
922
|
+
`)) : n);
|
|
923
|
+
}
|
|
924
|
+
function Wi(e) {
|
|
925
|
+
if (e.type === pe) return !0;
|
|
926
|
+
}
|
|
927
|
+
function Ui(e) {
|
|
928
|
+
return Uu(e, Wi, !1);
|
|
929
|
+
}
|
|
930
|
+
function Mn(e, t) {
|
|
931
|
+
return e.type === Je ? { ...e, contents: t(e.contents) } : t(e);
|
|
932
|
+
}
|
|
933
|
+
function $i(e) {
|
|
934
|
+
let t = !0;
|
|
935
|
+
return Dr(e, (n) => {
|
|
936
|
+
switch (Ve(n)) {
|
|
937
|
+
case et:
|
|
938
|
+
if (n === "") break;
|
|
939
|
+
case rt:
|
|
940
|
+
case Ge:
|
|
941
|
+
case pe:
|
|
942
|
+
case qe:
|
|
943
|
+
return t = !1, !1;
|
|
944
|
+
}
|
|
945
|
+
}), t;
|
|
946
|
+
}
|
|
947
|
+
var Gi = zs;
|
|
948
|
+
function A(e) {
|
|
949
|
+
return { type: tt, contents: e };
|
|
950
|
+
}
|
|
951
|
+
function Te(e, t) {
|
|
952
|
+
return { type: nt, contents: t, n: e };
|
|
953
|
+
}
|
|
954
|
+
function Vi(e) {
|
|
955
|
+
return Te(Number.NEGATIVE_INFINITY, e);
|
|
956
|
+
}
|
|
957
|
+
function $u(e) {
|
|
958
|
+
return Te(-1, e);
|
|
959
|
+
}
|
|
960
|
+
function Ki(e, t, n) {
|
|
961
|
+
let r = e;
|
|
962
|
+
if (t > 0) {
|
|
963
|
+
for (let u = 0; u < Math.floor(t / n); ++u) r = A(r);
|
|
964
|
+
r = Te(t % n, r), r = Te(Number.NEGATIVE_INFINITY, r);
|
|
965
|
+
}
|
|
966
|
+
return r;
|
|
967
|
+
}
|
|
968
|
+
var Oe = { type: qe }, Kt = { type: Et };
|
|
969
|
+
function Gu(e) {
|
|
970
|
+
return { type: $e, parts: e };
|
|
971
|
+
}
|
|
972
|
+
function D(e, t = {}) {
|
|
973
|
+
return Gi(t.expandedStates), { type: Ee, id: t.id, contents: e, break: !!t.shouldBreak, expandedStates: t.expandedStates };
|
|
974
|
+
}
|
|
975
|
+
function ze(e, t) {
|
|
976
|
+
return D(e[0], { ...t, expandedStates: e });
|
|
977
|
+
}
|
|
978
|
+
function k(e, t = "", n = {}) {
|
|
979
|
+
return { type: Be, breakContents: e, flatContents: t, groupId: n.groupId };
|
|
980
|
+
}
|
|
981
|
+
function jt(e, t) {
|
|
982
|
+
return { type: ut, contents: e, groupId: t.groupId, negate: t.negate };
|
|
983
|
+
}
|
|
984
|
+
function L(e, t) {
|
|
985
|
+
let n = [];
|
|
986
|
+
for (let r = 0; r < t.length; r++) r !== 0 && n.push(e), n.push(t[r]);
|
|
987
|
+
return n;
|
|
988
|
+
}
|
|
989
|
+
function Xt(e, t) {
|
|
990
|
+
return e ? { type: Je, label: e, contents: t } : t;
|
|
991
|
+
}
|
|
992
|
+
var T = { type: pe }, F = { type: pe, soft: !0 }, Vu = { type: pe, hard: !0 }, g = [Vu, Oe], Hi = { type: pe, hard: !0, literal: !0 }, Ku = [Hi, Oe];
|
|
993
|
+
function Xr(e) {
|
|
994
|
+
return { type: at, contents: e };
|
|
995
|
+
}
|
|
996
|
+
var ke = { type: Ge }, zi = "cr", Yi = "crlf", Qi = "\r", Zi = `\r
|
|
997
|
+
`, ep = `
|
|
998
|
+
`, tp = ep;
|
|
999
|
+
function np(e) {
|
|
1000
|
+
return e === zi ? Qi : e === Yi ? Zi : tp;
|
|
1001
|
+
}
|
|
1002
|
+
var rp = { type: 0 }, up = { type: 1 }, Hu = { value: "", length: 0, queue: [], get root() {
|
|
1003
|
+
return Hu;
|
|
1004
|
+
} };
|
|
1005
|
+
function zu(e, t, n) {
|
|
1006
|
+
let r = t.type === 1 ? e.queue.slice(0, -1) : [...e.queue, t], u = "", a = 0, s = 0, o = 0;
|
|
1007
|
+
for (let c of r) switch (c.type) {
|
|
1008
|
+
case 0:
|
|
1009
|
+
y(), n.useTabs ? p(1) : l(n.tabWidth);
|
|
1010
|
+
break;
|
|
1011
|
+
case 3: {
|
|
1012
|
+
let { string: E } = c;
|
|
1013
|
+
y(), u += E, a += E.length;
|
|
1014
|
+
break;
|
|
1015
|
+
}
|
|
1016
|
+
case 2: {
|
|
1017
|
+
let { width: E } = c;
|
|
1018
|
+
s += 1, o += E;
|
|
1019
|
+
break;
|
|
1020
|
+
}
|
|
1021
|
+
default:
|
|
1022
|
+
throw new Error(`Unexpected indent comment '${c.type}'.`);
|
|
1023
|
+
}
|
|
1024
|
+
return f(), { ...e, value: u, length: a, queue: r };
|
|
1025
|
+
function p(c) {
|
|
1026
|
+
u += " ".repeat(c), a += n.tabWidth * c;
|
|
1027
|
+
}
|
|
1028
|
+
function l(c) {
|
|
1029
|
+
u += " ".repeat(c), a += c;
|
|
1030
|
+
}
|
|
1031
|
+
function y() {
|
|
1032
|
+
n.useTabs ? d() : f();
|
|
1033
|
+
}
|
|
1034
|
+
function d() {
|
|
1035
|
+
s > 0 && p(s), m();
|
|
1036
|
+
}
|
|
1037
|
+
function f() {
|
|
1038
|
+
o > 0 && l(o), m();
|
|
1039
|
+
}
|
|
1040
|
+
function m() {
|
|
1041
|
+
s = 0, o = 0;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
function ap(e, t, n) {
|
|
1045
|
+
if (!t) return e;
|
|
1046
|
+
if (t.type === "root") return { ...e, root: e };
|
|
1047
|
+
if (t === Number.NEGATIVE_INFINITY) return e.root;
|
|
1048
|
+
let r;
|
|
1049
|
+
return typeof t == "number" ? t < 0 ? r = up : r = { type: 2, width: t } : r = { type: 3, string: t }, zu(e, r, n);
|
|
1050
|
+
}
|
|
1051
|
+
function sp(e, t) {
|
|
1052
|
+
return zu(e, rp, t);
|
|
1053
|
+
}
|
|
1054
|
+
function op(e) {
|
|
1055
|
+
let t = 0;
|
|
1056
|
+
for (let n = e.length - 1; n >= 0; n--) {
|
|
1057
|
+
let r = e[n];
|
|
1058
|
+
if (r === " " || r === " ") t++;
|
|
1059
|
+
else break;
|
|
1060
|
+
}
|
|
1061
|
+
return t;
|
|
1062
|
+
}
|
|
1063
|
+
function Yu(e) {
|
|
1064
|
+
let t = op(e);
|
|
1065
|
+
return { text: t === 0 ? e : e.slice(0, e.length - t), count: t };
|
|
1066
|
+
}
|
|
1067
|
+
var se = Symbol("MODE_BREAK"), be = Symbol("MODE_FLAT"), Ln = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
1068
|
+
function Ht(e, t, n, r, u, a) {
|
|
1069
|
+
if (n === Number.POSITIVE_INFINITY) return !0;
|
|
1070
|
+
let s = t.length, o = !1, p = [e], l = "";
|
|
1071
|
+
for (; n >= 0; ) {
|
|
1072
|
+
if (p.length === 0) {
|
|
1073
|
+
if (s === 0) return !0;
|
|
1074
|
+
p.push(t[--s]);
|
|
1075
|
+
continue;
|
|
1076
|
+
}
|
|
1077
|
+
let { mode: y, doc: d } = p.pop(), f = Ve(d);
|
|
1078
|
+
switch (f) {
|
|
1079
|
+
case et:
|
|
1080
|
+
d && (o && (l += " ", n -= 1, o = !1), l += d, n -= lt(d));
|
|
1081
|
+
break;
|
|
1082
|
+
case Le:
|
|
1083
|
+
case $e: {
|
|
1084
|
+
let m = f === Le ? d : d.parts, c = d[Ln] ?? 0;
|
|
1085
|
+
for (let E = m.length - 1; E >= c; E--) p.push({ mode: y, doc: m[E] });
|
|
1086
|
+
break;
|
|
1087
|
+
}
|
|
1088
|
+
case tt:
|
|
1089
|
+
case nt:
|
|
1090
|
+
case ut:
|
|
1091
|
+
case Je:
|
|
1092
|
+
p.push({ mode: y, doc: d.contents });
|
|
1093
|
+
break;
|
|
1094
|
+
case rt: {
|
|
1095
|
+
let { text: m, count: c } = Yu(l);
|
|
1096
|
+
l = m, n += c;
|
|
1097
|
+
break;
|
|
1098
|
+
}
|
|
1099
|
+
case Ee: {
|
|
1100
|
+
if (a && d.break) return !1;
|
|
1101
|
+
let m = d.break ? se : y, c = d.expandedStates && m === se ? J(0, d.expandedStates, -1) : d.contents;
|
|
1102
|
+
p.push({ mode: m, doc: c });
|
|
1103
|
+
break;
|
|
1104
|
+
}
|
|
1105
|
+
case Be: {
|
|
1106
|
+
let m = (d.groupId ? u[d.groupId] || be : y) === se ? d.breakContents : d.flatContents;
|
|
1107
|
+
m && p.push({ mode: y, doc: m });
|
|
1108
|
+
break;
|
|
1109
|
+
}
|
|
1110
|
+
case pe:
|
|
1111
|
+
if (y === se || d.hard) return !0;
|
|
1112
|
+
d.soft || (o = !0);
|
|
1113
|
+
break;
|
|
1114
|
+
case at:
|
|
1115
|
+
r = !0;
|
|
1116
|
+
break;
|
|
1117
|
+
case Ge:
|
|
1118
|
+
if (r) return !1;
|
|
1119
|
+
break;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
return !1;
|
|
1123
|
+
}
|
|
1124
|
+
function Qu(e, t) {
|
|
1125
|
+
let n = /* @__PURE__ */ Object.create(null), r = t.printWidth, u = np(t.endOfLine), a = 0, s = [{ indent: Hu, mode: se, doc: e }], o = "", p = !1, l = [], y = [], d = [], f = [], m = 0;
|
|
1126
|
+
for (Xi(e); s.length > 0; ) {
|
|
1127
|
+
let { indent: C, mode: N, doc: b } = s.pop();
|
|
1128
|
+
switch (Ve(b)) {
|
|
1129
|
+
case et: {
|
|
1130
|
+
let w = u !== `
|
|
1131
|
+
` ? z(0, b, `
|
|
1132
|
+
`, u) : b;
|
|
1133
|
+
w && (o += w, s.length > 0 && (a += lt(w)));
|
|
1134
|
+
break;
|
|
1135
|
+
}
|
|
1136
|
+
case Le:
|
|
1137
|
+
for (let w = b.length - 1; w >= 0; w--) s.push({ indent: C, mode: N, doc: b[w] });
|
|
1138
|
+
break;
|
|
1139
|
+
case Et:
|
|
1140
|
+
if (y.length >= 2) throw new Error("There are too many 'cursor' in doc.");
|
|
1141
|
+
y.push(m + o.length);
|
|
1142
|
+
break;
|
|
1143
|
+
case tt:
|
|
1144
|
+
s.push({ indent: sp(C, t), mode: N, doc: b.contents });
|
|
1145
|
+
break;
|
|
1146
|
+
case nt:
|
|
1147
|
+
s.push({ indent: ap(C, b.n, t), mode: N, doc: b.contents });
|
|
1148
|
+
break;
|
|
1149
|
+
case rt:
|
|
1150
|
+
h();
|
|
1151
|
+
break;
|
|
1152
|
+
case Ee:
|
|
1153
|
+
switch (N) {
|
|
1154
|
+
case be:
|
|
1155
|
+
if (!p) {
|
|
1156
|
+
s.push({ indent: C, mode: b.break ? se : be, doc: b.contents });
|
|
1157
|
+
break;
|
|
1158
|
+
}
|
|
1159
|
+
case se: {
|
|
1160
|
+
p = !1;
|
|
1161
|
+
let w = { indent: C, mode: be, doc: b.contents }, q = r - a, K = l.length > 0;
|
|
1162
|
+
if (!b.break && Ht(w, s, q, K, n)) s.push(w);
|
|
1163
|
+
else if (b.expandedStates) {
|
|
1164
|
+
let v = J(0, b.expandedStates, -1);
|
|
1165
|
+
if (b.break) {
|
|
1166
|
+
s.push({ indent: C, mode: se, doc: v });
|
|
1167
|
+
break;
|
|
1168
|
+
} else for (let X = 1; X < b.expandedStates.length + 1; X++) if (X >= b.expandedStates.length) {
|
|
1169
|
+
s.push({ indent: C, mode: se, doc: v });
|
|
1170
|
+
break;
|
|
1171
|
+
} else {
|
|
1172
|
+
let U = b.expandedStates[X], te = { indent: C, mode: be, doc: U };
|
|
1173
|
+
if (Ht(te, s, q, K, n)) {
|
|
1174
|
+
s.push(te);
|
|
1175
|
+
break;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
} else s.push({ indent: C, mode: se, doc: b.contents });
|
|
1179
|
+
break;
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
b.id && (n[b.id] = J(0, s, -1).mode);
|
|
1183
|
+
break;
|
|
1184
|
+
case $e: {
|
|
1185
|
+
let w = r - a, q = b[Ln] ?? 0, { parts: K } = b, v = K.length - q;
|
|
1186
|
+
if (v === 0) break;
|
|
1187
|
+
let X = K[q + 0], U = K[q + 1], te = { indent: C, mode: be, doc: X }, de = { indent: C, mode: se, doc: X }, P = Ht(te, [], w, l.length > 0, n, !0);
|
|
1188
|
+
if (v === 1) {
|
|
1189
|
+
P ? s.push(te) : s.push(de);
|
|
1190
|
+
break;
|
|
1191
|
+
}
|
|
1192
|
+
let G = { indent: C, mode: be, doc: U }, H = { indent: C, mode: se, doc: U };
|
|
1193
|
+
if (v === 2) {
|
|
1194
|
+
P ? s.push(G, te) : s.push(H, de);
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
let He = K[q + 2], fe = { indent: C, mode: N, doc: { ...b, [Ln]: q + 2 } }, Wt = Ht({ indent: C, mode: be, doc: [X, U, He] }, [], w, l.length > 0, n, !0);
|
|
1198
|
+
s.push(fe), Wt ? s.push(G, te) : P ? s.push(H, te) : s.push(H, de);
|
|
1199
|
+
break;
|
|
1200
|
+
}
|
|
1201
|
+
case Be:
|
|
1202
|
+
case ut: {
|
|
1203
|
+
let w = b.groupId ? n[b.groupId] : N;
|
|
1204
|
+
if (w === se) {
|
|
1205
|
+
let q = b.type === Be ? b.breakContents : b.negate ? b.contents : A(b.contents);
|
|
1206
|
+
q && s.push({ indent: C, mode: N, doc: q });
|
|
1207
|
+
}
|
|
1208
|
+
if (w === be) {
|
|
1209
|
+
let q = b.type === Be ? b.flatContents : b.negate ? A(b.contents) : b.contents;
|
|
1210
|
+
q && s.push({ indent: C, mode: N, doc: q });
|
|
1211
|
+
}
|
|
1212
|
+
break;
|
|
1213
|
+
}
|
|
1214
|
+
case at:
|
|
1215
|
+
l.push({ indent: C, mode: N, doc: b.contents });
|
|
1216
|
+
break;
|
|
1217
|
+
case Ge:
|
|
1218
|
+
l.length > 0 && s.push({ indent: C, mode: N, doc: Vu });
|
|
1219
|
+
break;
|
|
1220
|
+
case pe:
|
|
1221
|
+
switch (N) {
|
|
1222
|
+
case be:
|
|
1223
|
+
if (b.hard) p = !0;
|
|
1224
|
+
else {
|
|
1225
|
+
b.soft || (o += " ", a += 1);
|
|
1226
|
+
break;
|
|
1227
|
+
}
|
|
1228
|
+
case se:
|
|
1229
|
+
if (l.length > 0) {
|
|
1230
|
+
s.push({ indent: C, mode: N, doc: b }, ...l.reverse()), l.length = 0;
|
|
1231
|
+
break;
|
|
1232
|
+
}
|
|
1233
|
+
b.literal ? (o += u, a = 0, C.root && (C.root.value && (o += C.root.value), a = C.root.length)) : (h(), o += u + C.value, a = C.length);
|
|
1234
|
+
break;
|
|
1235
|
+
}
|
|
1236
|
+
break;
|
|
1237
|
+
case Je:
|
|
1238
|
+
s.push({ indent: C, mode: N, doc: b.contents });
|
|
1239
|
+
break;
|
|
1240
|
+
case qe:
|
|
1241
|
+
break;
|
|
1242
|
+
default:
|
|
1243
|
+
throw new Nt(b);
|
|
1244
|
+
}
|
|
1245
|
+
s.length === 0 && l.length > 0 && (s.push(...l.reverse()), l.length = 0);
|
|
1246
|
+
}
|
|
1247
|
+
let c = d.join("") + o, E = [...f, ...y];
|
|
1248
|
+
if (E.length !== 2) return { formatted: c };
|
|
1249
|
+
let S = E[0];
|
|
1250
|
+
return { formatted: c, cursorNodeStart: S, cursorNodeText: c.slice(S, J(0, E, -1)) };
|
|
1251
|
+
function h() {
|
|
1252
|
+
let { text: C, count: N } = Yu(o);
|
|
1253
|
+
C && (d.push(C), m += C.length), o = "", a -= N, y.length > 0 && (f.push(...y.map((b) => Math.min(b, m))), y.length = 0);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
function ip(e, t, n = 0) {
|
|
1257
|
+
let r = 0;
|
|
1258
|
+
for (let u = n; u < e.length; ++u) e[u] === " " ? r = r + t - r % t : r++;
|
|
1259
|
+
return r;
|
|
1260
|
+
}
|
|
1261
|
+
var pp = ip;
|
|
1262
|
+
function lp(e, t) {
|
|
1263
|
+
let n = e.lastIndexOf(`
|
|
1264
|
+
`);
|
|
1265
|
+
return n === -1 ? 0 : pp(e.slice(n + 1).match(/^[\t ]*/u)[0], t);
|
|
1266
|
+
}
|
|
1267
|
+
var cp = lp;
|
|
1268
|
+
function Zu(e, t, n) {
|
|
1269
|
+
let { node: r } = e;
|
|
1270
|
+
if (r.type === "TemplateLiteral" && fp(e)) {
|
|
1271
|
+
let p = yp(e, t, n);
|
|
1272
|
+
if (p) return p;
|
|
1273
|
+
}
|
|
1274
|
+
let u = "expressions";
|
|
1275
|
+
r.type === "TSTemplateLiteralType" && (u = "types");
|
|
1276
|
+
let a = [], s = e.map(n, u);
|
|
1277
|
+
a.push(ke, "`");
|
|
1278
|
+
let o = 0;
|
|
1279
|
+
return e.each(({ index: p, node: l }) => {
|
|
1280
|
+
if (a.push(n()), l.tail) return;
|
|
1281
|
+
let { tabWidth: y } = t, d = l.value.raw, f = d.includes(`
|
|
1282
|
+
`) ? cp(d, y) : o;
|
|
1283
|
+
o = f;
|
|
1284
|
+
let m = s[p], c = r[u][p], E = ce(t.originalText, j(l), M(r.quasis[p + 1]));
|
|
1285
|
+
if (!E) {
|
|
1286
|
+
let h = Qu(m, { ...t, printWidth: Number.POSITIVE_INFINITY }).formatted;
|
|
1287
|
+
h.includes(`
|
|
1288
|
+
`) ? E = !0 : m = h;
|
|
1289
|
+
}
|
|
1290
|
+
E && (x(c) || c.type === "Identifier" || _(c) || c.type === "ConditionalExpression" || c.type === "SequenceExpression" || ge(c) || Me(c)) && (m = [A([F, m]), F]);
|
|
1291
|
+
let S = f === 0 && d.endsWith(`
|
|
1292
|
+
`) ? Te(Number.NEGATIVE_INFINITY, m) : Ki(m, f, y);
|
|
1293
|
+
a.push(D(["${", S, ke, "}"]));
|
|
1294
|
+
}, "quasis"), a.push("`"), a;
|
|
1295
|
+
}
|
|
1296
|
+
function Dp(e, t, n) {
|
|
1297
|
+
let r = n("quasi"), { node: u } = e, a = "", s = Ye(u.quasi, B.Leading)[0];
|
|
1298
|
+
return s && (ce(t.originalText, j(u.typeArguments ?? u.tag), M(s)) ? a = F : a = " "), Xt(r.label && { tagged: !0, ...r.label }, [n("tag"), n("typeArguments"), a, ke, r]);
|
|
1299
|
+
}
|
|
1300
|
+
function yp(e, t, n) {
|
|
1301
|
+
let { node: r } = e, u = r.quasis[0].value.raw.trim().split(/\s*\|\s*/u);
|
|
1302
|
+
if (u.length > 1 || u.some((a) => a.length > 0)) {
|
|
1303
|
+
t.__inJestEach = !0;
|
|
1304
|
+
let a = e.map(n, "expressions");
|
|
1305
|
+
t.__inJestEach = !1;
|
|
1306
|
+
let s = a.map((d) => "${" + Qu(d, { ...t, printWidth: Number.POSITIVE_INFINITY, endOfLine: "lf" }).formatted + "}"), o = [{ hasLineBreak: !1, cells: [] }];
|
|
1307
|
+
for (let d = 1; d < r.quasis.length; d++) {
|
|
1308
|
+
let f = J(0, o, -1), m = s[d - 1];
|
|
1309
|
+
f.cells.push(m), m.includes(`
|
|
1310
|
+
`) && (f.hasLineBreak = !0), r.quasis[d].value.raw.includes(`
|
|
1311
|
+
`) && o.push({ hasLineBreak: !1, cells: [] });
|
|
1312
|
+
}
|
|
1313
|
+
let p = Math.max(u.length, ...o.map((d) => d.cells.length)), l = Array.from({ length: p }).fill(0), y = [{ cells: u }, ...o.filter((d) => d.cells.length > 0)];
|
|
1314
|
+
for (let { cells: d } of y.filter((f) => !f.hasLineBreak)) for (let [f, m] of d.entries()) l[f] = Math.max(l[f], lt(m));
|
|
1315
|
+
return [ke, "`", A([g, L(g, y.map((d) => L(" | ", d.cells.map((f, m) => d.hasLineBreak ? f : f + " ".repeat(l[m] - lt(f))))))]), g, "`"];
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
function dp(e, t) {
|
|
1319
|
+
let { node: n } = e, r = t();
|
|
1320
|
+
return x(n) && (r = D([A([F, r]), F])), ["${", r, ke, "}"];
|
|
1321
|
+
}
|
|
1322
|
+
function dr(e, t) {
|
|
1323
|
+
return e.map(() => dp(e, t), "expressions");
|
|
1324
|
+
}
|
|
1325
|
+
function ea(e, t) {
|
|
1326
|
+
return At(e, (n) => typeof n == "string" ? t ? z(0, n, /(\\*)`/gu, "$1$1\\`") : ta(n) : n);
|
|
1327
|
+
}
|
|
1328
|
+
function ta(e) {
|
|
1329
|
+
return z(0, e, /([\\`]|\$\{)/gu, "\\$1");
|
|
1330
|
+
}
|
|
1331
|
+
function fp({ node: e, parent: t }) {
|
|
1332
|
+
let n = /^[fx]?(?:describe|it|test)$/u;
|
|
1333
|
+
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" && n.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" && n.test(t.tag.object.object.name));
|
|
1334
|
+
}
|
|
1335
|
+
var On = [(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"];
|
|
1336
|
+
function mp(e) {
|
|
1337
|
+
let t = (r) => r.type === "TemplateLiteral", n = (r, u) => Ue(r) && !r.computed && r.key.type === "Identifier" && r.key.name === "styles" && u === "value";
|
|
1338
|
+
return e.match(t, (r, u) => ee(r) && u === "elements", n, ...On) || e.match(t, n, ...On);
|
|
1339
|
+
}
|
|
1340
|
+
function Fp(e) {
|
|
1341
|
+
return e.match((t) => t.type === "TemplateLiteral", (t, n) => Ue(t) && !t.computed && t.key.type === "Identifier" && t.key.name === "template" && n === "value", ...On);
|
|
1342
|
+
}
|
|
1343
|
+
function hn(e, t) {
|
|
1344
|
+
return x(e, B.Block | B.Leading, ({ value: n }) => n === ` ${t} `);
|
|
1345
|
+
}
|
|
1346
|
+
function na({ node: e, parent: t }, n) {
|
|
1347
|
+
return hn(e, n) || Ep(t) && hn(t, n) || t.type === "ExpressionStatement" && hn(t, n);
|
|
1348
|
+
}
|
|
1349
|
+
function Ep(e) {
|
|
1350
|
+
return e.type === "AsConstExpression" || e.type === "TSAsExpression" && e.typeAnnotation.type === "TSTypeReference" && e.typeAnnotation.typeName.type === "Identifier" && e.typeAnnotation.typeName.name === "const";
|
|
1351
|
+
}
|
|
1352
|
+
async function Ap(e, t, n) {
|
|
1353
|
+
let { node: r } = n, u = "";
|
|
1354
|
+
for (let [p, l] of r.quasis.entries()) {
|
|
1355
|
+
let { raw: y } = l.value;
|
|
1356
|
+
p > 0 && (u += "@prettier-placeholder-" + (p - 1) + "-id"), u += y;
|
|
1357
|
+
}
|
|
1358
|
+
let a = await e(u, { parser: "scss" }), s = dr(n, t), o = gp(a, s);
|
|
1359
|
+
if (!o) throw new Error("Couldn't insert all the expressions");
|
|
1360
|
+
return ["`", A([g, o]), F, "`"];
|
|
1361
|
+
}
|
|
1362
|
+
function gp(e, t) {
|
|
1363
|
+
if (!W(t)) return e;
|
|
1364
|
+
let n = 0, r = At(yr(e), (u) => typeof u != "string" || !u.includes("@prettier-placeholder") ? u : u.split(/@prettier-placeholder-(\d+)-id/u).map((a, s) => s % 2 === 0 ? Qe(a) : (n++, t[a])));
|
|
1365
|
+
return t.length === n ? r : null;
|
|
1366
|
+
}
|
|
1367
|
+
function Cp(e) {
|
|
1368
|
+
return e.match(void 0, (t, n) => n === "quasi" && t.type === "TaggedTemplateExpression" && Qn(t.tag, ["css", "css.global", "css.resolve"])) || e.match(void 0, (t, n) => n === "expression" && t.type === "JSXExpressionContainer", (t, n) => n === "children" && t.type === "JSXElement" && t.openingElement.name.type === "JSXIdentifier" && t.openingElement.name.name === "style" && t.openingElement.attributes.some((r) => r.type === "JSXAttribute" && r.name.type === "JSXIdentifier" && r.name.name === "jsx"));
|
|
1369
|
+
}
|
|
1370
|
+
function zt(e) {
|
|
1371
|
+
return e.type === "Identifier" && e.name === "styled";
|
|
1372
|
+
}
|
|
1373
|
+
function Rr(e) {
|
|
1374
|
+
return /^[A-Z]/u.test(e.object.name) && e.property.name === "extend";
|
|
1375
|
+
}
|
|
1376
|
+
function hp({ parent: e }) {
|
|
1377
|
+
if (!e || e.type !== "TaggedTemplateExpression") return !1;
|
|
1378
|
+
let t = e.tag.type === "ParenthesizedExpression" ? e.tag.expression : e.tag;
|
|
1379
|
+
switch (t.type) {
|
|
1380
|
+
case "MemberExpression":
|
|
1381
|
+
return zt(t.object) || Rr(t);
|
|
1382
|
+
case "CallExpression":
|
|
1383
|
+
return zt(t.callee) || t.callee.type === "MemberExpression" && (t.callee.object.type === "MemberExpression" && (zt(t.callee.object.object) || Rr(t.callee.object)) || t.callee.object.type === "CallExpression" && zt(t.callee.object.callee));
|
|
1384
|
+
case "Identifier":
|
|
1385
|
+
return t.name === "css";
|
|
1386
|
+
default:
|
|
1387
|
+
return !1;
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
function xp({ parent: e, grandparent: t }) {
|
|
1391
|
+
return (t == null ? void 0 : t.type) === "JSXAttribute" && e.type === "JSXExpressionContainer" && t.name.type === "JSXIdentifier" && t.name.name === "css";
|
|
1392
|
+
}
|
|
1393
|
+
var Tp = (e) => Cp(e) || hp(e) || xp(e) || mp(e);
|
|
1394
|
+
async function Sp(e, t, n) {
|
|
1395
|
+
let { node: r } = n, u = r.quasis.length, a = dr(n, t), s = [];
|
|
1396
|
+
for (let o = 0; o < u; o++) {
|
|
1397
|
+
let p = r.quasis[o], l = o === 0, y = o === u - 1, d = p.value.cooked, f = d.split(`
|
|
1398
|
+
`), m = f.length, c = a[o], E = m > 2 && f[0].trim() === "" && f[1].trim() === "", S = m > 2 && f[m - 1].trim() === "" && f[m - 2].trim() === "", h = f.every((N) => /^\s*(?:#[^\n\r]*)?$/u.test(N));
|
|
1399
|
+
if (!y && /#[^\n\r]*$/u.test(f[m - 1])) return null;
|
|
1400
|
+
let C = null;
|
|
1401
|
+
h ? C = bp(f) : C = await e(d, { parser: "graphql" }), C ? (C = ea(C, !1), !l && E && s.push(""), s.push(C), !y && S && s.push("")) : !l && !y && E && s.push(""), c && s.push(c);
|
|
1402
|
+
}
|
|
1403
|
+
return ["`", A([g, L(g, s)]), g, "`"];
|
|
1404
|
+
}
|
|
1405
|
+
function bp(e) {
|
|
1406
|
+
let t = [], n = !1, r = e.map((u) => u.trim());
|
|
1407
|
+
for (let [u, a] of r.entries()) a !== "" && (r[u - 1] === "" && n ? t.push([g, a]) : t.push(a), n = !0);
|
|
1408
|
+
return t.length === 0 ? null : L(g, t);
|
|
1409
|
+
}
|
|
1410
|
+
function Bp({ node: e, parent: t }) {
|
|
1411
|
+
return na({ 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");
|
|
1412
|
+
}
|
|
1413
|
+
var xn = 0;
|
|
1414
|
+
async function ra(e, t, n, r, u) {
|
|
1415
|
+
let { node: a } = r, s = xn;
|
|
1416
|
+
xn = xn + 1 >>> 0;
|
|
1417
|
+
let o = (h) => `PRETTIER_HTML_PLACEHOLDER_${h}_${s}_IN_JS`, p = a.quasis.map((h, C, N) => C === N.length - 1 ? h.value.cooked : h.value.cooked + o(C)).join(""), l = dr(r, n), y = new RegExp(o("(\\d+)"), "gu"), d = 0, f = await t(p, { parser: e, __onHtmlRoot(h) {
|
|
1418
|
+
d = h.children.length;
|
|
1419
|
+
} }), m = At(f, (h) => {
|
|
1420
|
+
if (typeof h != "string") return h;
|
|
1421
|
+
let C = [], N = h.split(y);
|
|
1422
|
+
for (let b = 0; b < N.length; b++) {
|
|
1423
|
+
let w = N[b];
|
|
1424
|
+
if (b % 2 === 0) {
|
|
1425
|
+
w && (w = ta(w), u.__embeddedInHtml && (w = z(0, w, /<\/(?=script\b)/giu, "<\\/")), C.push(w));
|
|
1426
|
+
continue;
|
|
1427
|
+
}
|
|
1428
|
+
let q = Number(w);
|
|
1429
|
+
C.push(l[q]);
|
|
1430
|
+
}
|
|
1431
|
+
return C;
|
|
1432
|
+
}), c = /^\s/u.test(p) ? " " : "", E = /\s$/u.test(p) ? " " : "", S = u.htmlWhitespaceSensitivity === "ignore" ? g : c && E ? T : null;
|
|
1433
|
+
return S ? D(["`", A([S, D(m)]), S, "`"]) : Xt({ hug: !1 }, D(["`", c, d > 1 ? A(D(m)) : D(m), E, "`"]));
|
|
1434
|
+
}
|
|
1435
|
+
function vp(e) {
|
|
1436
|
+
return na(e, "HTML") || e.match((t) => t.type === "TemplateLiteral", (t, n) => t.type === "TaggedTemplateExpression" && t.tag.type === "Identifier" && t.tag.name === "html" && n === "quasi");
|
|
1437
|
+
}
|
|
1438
|
+
var Pp = ra.bind(void 0, "html"), kp = ra.bind(void 0, "angular");
|
|
1439
|
+
async function wp(e, t, n) {
|
|
1440
|
+
let { node: r } = n, u = z(0, r.quasis[0].value.raw, /((?:\\\\)*)\\`/gu, (p, l) => "\\".repeat(l.length / 2) + "`"), a = Ip(u), s = a !== "";
|
|
1441
|
+
s && (u = z(0, u, new RegExp(`^${a}`, "gmu"), ""));
|
|
1442
|
+
let o = ea(await e(u, { parser: "markdown", __inJsTemplate: !0 }), !0);
|
|
1443
|
+
return ["`", s ? A([F, o]) : [Ku, Vi(o)], F, "`"];
|
|
1444
|
+
}
|
|
1445
|
+
function Ip(e) {
|
|
1446
|
+
let t = e.match(/^([^\S\n]*)\S/mu);
|
|
1447
|
+
return t === null ? "" : t[1];
|
|
1448
|
+
}
|
|
1449
|
+
function Np({ node: e, parent: t }) {
|
|
1450
|
+
return (t == null ? void 0 : t.type) === "TaggedTemplateExpression" && e.quasis.length === 1 && t.tag.type === "Identifier" && (t.tag.name === "md" || t.tag.name === "markdown");
|
|
1451
|
+
}
|
|
1452
|
+
var jp = [{ test: Tp, print: Ap }, { test: Bp, print: Sp }, { test: vp, print: Pp }, { test: Fp, print: kp }, { test: Np, print: wp }].map(({ test: e, print: t }) => ({ test: e, print: Lp(t) }));
|
|
1453
|
+
function Mp(e) {
|
|
1454
|
+
let { node: t } = e;
|
|
1455
|
+
if (t.type !== "TemplateLiteral" || Op(t)) return;
|
|
1456
|
+
let n = jp.find(({ test: r }) => r(e));
|
|
1457
|
+
if (n) return t.quasis.length === 1 && t.quasis[0].value.raw.trim() === "" ? "``" : n.print;
|
|
1458
|
+
}
|
|
1459
|
+
function Lp(e) {
|
|
1460
|
+
return async (...t) => {
|
|
1461
|
+
let n = await e(...t);
|
|
1462
|
+
return n && Xt({ embed: !0, ...n.label }, n);
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
function Op({ quasis: e }) {
|
|
1466
|
+
return e.some(({ value: { cooked: t } }) => t === null);
|
|
1467
|
+
}
|
|
1468
|
+
var Jp = Mp, qp = /\*\/$/, Xp = /^\/\*\*?/, ua = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/, Rp = /(^|\s+)\/\/([^\n\r]*)/g, _r = /^(\r?\n)+/, _p = /(?:^|\r?\n) *(@[^\n\r]*?) *\r?\n *(?![^\n\r@]*\/\/[^]*)([^\s@][^\n\r@]+?) *\r?\n/g, Wr = /(?:^|\r?\n) *@(\S+) *([^\n\r]*)/g, Wp = /(\r?\n|^) *\* ?/g, aa = [];
|
|
1469
|
+
function Up(e) {
|
|
1470
|
+
let t = e.match(ua);
|
|
1471
|
+
return t ? t[0].trimStart() : "";
|
|
1472
|
+
}
|
|
1473
|
+
function $p(e) {
|
|
1474
|
+
var n;
|
|
1475
|
+
let t = (n = e.match(ua)) == null ? void 0 : n[0];
|
|
1476
|
+
return t == null ? e : e.slice(t.length);
|
|
1477
|
+
}
|
|
1478
|
+
function Gp(e) {
|
|
1479
|
+
e = z(0, e.replace(Xp, "").replace(qp, ""), Wp, "$1");
|
|
1480
|
+
let t = "";
|
|
1481
|
+
for (; t !== e; ) t = e, e = z(0, e, _p, `
|
|
1482
|
+
$1 $2
|
|
1483
|
+
`);
|
|
1484
|
+
e = e.replace(_r, "").trimEnd();
|
|
1485
|
+
let n = /* @__PURE__ */ Object.create(null), r = z(0, e, Wr, "").replace(_r, "").trimEnd(), u;
|
|
1486
|
+
for (; u = Wr.exec(e); ) {
|
|
1487
|
+
let a = z(0, u[2], Rp, "");
|
|
1488
|
+
if (typeof n[u[1]] == "string" || Array.isArray(n[u[1]])) {
|
|
1489
|
+
let s = n[u[1]];
|
|
1490
|
+
n[u[1]] = [...aa, ...Array.isArray(s) ? s : [s], a];
|
|
1491
|
+
} else n[u[1]] = a;
|
|
1492
|
+
}
|
|
1493
|
+
return { comments: r, pragmas: n };
|
|
1494
|
+
}
|
|
1495
|
+
function Vp({ comments: e = "", pragmas: t = {} }) {
|
|
1496
|
+
let n = Object.keys(t), r = n.flatMap((a) => Ur(a, t[a])).map((a) => ` * ${a}
|
|
1497
|
+
`).join("");
|
|
1498
|
+
if (!e) {
|
|
1499
|
+
if (n.length === 0) return "";
|
|
1500
|
+
if (n.length === 1 && !Array.isArray(t[n[0]])) {
|
|
1501
|
+
let a = t[n[0]];
|
|
1502
|
+
return `/** ${Ur(n[0], a)[0]} */`;
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
let u = e.split(`
|
|
1506
|
+
`).map((a) => ` * ${a}`).join(`
|
|
1507
|
+
`) + `
|
|
1508
|
+
`;
|
|
1509
|
+
return `/**
|
|
1510
|
+
` + (e ? u : "") + (e && n.length > 0 ? ` *
|
|
1511
|
+
` : "") + r + " */";
|
|
1512
|
+
}
|
|
1513
|
+
function Ur(e, t) {
|
|
1514
|
+
return [...aa, ...Array.isArray(t) ? t : [t]].map((n) => `@${e} ${n}`.trim());
|
|
1515
|
+
}
|
|
1516
|
+
var Kp = "format";
|
|
1517
|
+
function Hp(e) {
|
|
1518
|
+
if (!e.startsWith("#!")) return "";
|
|
1519
|
+
let t = e.indexOf(`
|
|
1520
|
+
`);
|
|
1521
|
+
return t === -1 ? e : e.slice(0, t);
|
|
1522
|
+
}
|
|
1523
|
+
var zp = Hp;
|
|
1524
|
+
function Yp(e) {
|
|
1525
|
+
let t = zp(e);
|
|
1526
|
+
t && (e = e.slice(t.length + 1));
|
|
1527
|
+
let n = Up(e), { pragmas: r, comments: u } = Gp(n);
|
|
1528
|
+
return { shebang: t, text: e, pragmas: r, comments: u };
|
|
1529
|
+
}
|
|
1530
|
+
function Qp(e) {
|
|
1531
|
+
let { shebang: t, text: n, pragmas: r, comments: u } = Yp(e), a = $p(n), s = Vp({ pragmas: { [Kp]: "", ...r }, comments: u.trimStart() });
|
|
1532
|
+
return (t ? `${t}
|
|
1533
|
+
` : "") + s + (a.startsWith(`
|
|
1534
|
+
`) ? `
|
|
1535
|
+
` : `
|
|
1536
|
+
|
|
1537
|
+
`) + a;
|
|
1538
|
+
}
|
|
1539
|
+
function Zp(e) {
|
|
1540
|
+
if (!Se(e)) return !1;
|
|
1541
|
+
let t = `*${e.value}*`.split(`
|
|
1542
|
+
`);
|
|
1543
|
+
return t.length > 1 && t.every((n) => n.trimStart()[0] === "*");
|
|
1544
|
+
}
|
|
1545
|
+
var Tn = /* @__PURE__ */ new WeakMap();
|
|
1546
|
+
function el(e) {
|
|
1547
|
+
return Tn.has(e) || Tn.set(e, Zp(e)), Tn.get(e);
|
|
1548
|
+
}
|
|
1549
|
+
var tl = el;
|
|
1550
|
+
function nl(e, t) {
|
|
1551
|
+
let n = e.node;
|
|
1552
|
+
if (Ot(n)) return t.originalText.slice(M(n), j(n)).trimEnd();
|
|
1553
|
+
if (tl(n)) return rl(n);
|
|
1554
|
+
if (Se(n)) return ["/*", Qe(n.value), "*/"];
|
|
1555
|
+
throw new Error("Not a comment: " + JSON.stringify(n));
|
|
1556
|
+
}
|
|
1557
|
+
function rl(e) {
|
|
1558
|
+
let t = e.value.split(`
|
|
1559
|
+
`);
|
|
1560
|
+
return ["/*", L(g, t.map((n, r) => r === 0 ? n.trimEnd() : " " + (r < t.length - 1 ? n.trim() : n.trimStart()))), "*/"];
|
|
1561
|
+
}
|
|
1562
|
+
function Jn(e, t) {
|
|
1563
|
+
var a, s, o, p, l, y, d, f, m;
|
|
1564
|
+
if (e.isRoot) return !1;
|
|
1565
|
+
let { node: n, key: r, parent: u } = e;
|
|
1566
|
+
if (t.__isInHtmlInterpolation && !t.bracketSpacing && ol(n) && Bt(e)) return !0;
|
|
1567
|
+
if (ul(n)) return !1;
|
|
1568
|
+
if (n.type === "Identifier") {
|
|
1569
|
+
if ((a = n.extra) != null && a.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/u.test(n.name) || r === "left" && (n.name === "async" && !u.await || n.name === "let") && u.type === "ForOfStatement") return !0;
|
|
1570
|
+
if (n.name === "let") {
|
|
1571
|
+
let c = (s = e.findAncestor((E) => E.type === "ForOfStatement")) == null ? void 0 : s.left;
|
|
1572
|
+
if (c && re(c, (E) => E === n)) return !0;
|
|
1573
|
+
}
|
|
1574
|
+
if (r === "object" && n.name === "let" && u.type === "MemberExpression" && u.computed && !u.optional) {
|
|
1575
|
+
let c = e.findAncestor((S) => S.type === "ExpressionStatement" || S.type === "ForStatement" || S.type === "ForInStatement"), E = c ? c.type === "ExpressionStatement" ? c.expression : c.type === "ForStatement" ? c.init : c.left : void 0;
|
|
1576
|
+
if (E && re(E, (S) => S === n)) return !0;
|
|
1577
|
+
}
|
|
1578
|
+
if (r === "expression") switch (n.name) {
|
|
1579
|
+
case "await":
|
|
1580
|
+
case "interface":
|
|
1581
|
+
case "module":
|
|
1582
|
+
case "using":
|
|
1583
|
+
case "yield":
|
|
1584
|
+
case "let":
|
|
1585
|
+
case "component":
|
|
1586
|
+
case "hook":
|
|
1587
|
+
case "type": {
|
|
1588
|
+
let c = e.findAncestor((E) => !ge(E));
|
|
1589
|
+
if (c !== u && c.type === "ExpressionStatement") return !0;
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
return !1;
|
|
1593
|
+
}
|
|
1594
|
+
if (n.type === "ObjectExpression" || n.type === "FunctionExpression" || n.type === "ClassExpression" || n.type === "DoExpression") {
|
|
1595
|
+
let c = (o = e.findAncestor((E) => E.type === "ExpressionStatement")) == null ? void 0 : o.expression;
|
|
1596
|
+
if (c && re(c, (E) => E === n)) return !0;
|
|
1597
|
+
}
|
|
1598
|
+
if (n.type === "ObjectExpression") {
|
|
1599
|
+
let c = (p = e.findAncestor((E) => E.type === "ArrowFunctionExpression")) == null ? void 0 : p.body;
|
|
1600
|
+
if (c && c.type !== "SequenceExpression" && c.type !== "AssignmentExpression" && re(c, (E) => E === n)) return !0;
|
|
1601
|
+
}
|
|
1602
|
+
switch (u.type) {
|
|
1603
|
+
case "ParenthesizedExpression":
|
|
1604
|
+
return !1;
|
|
1605
|
+
case "ClassDeclaration":
|
|
1606
|
+
case "ClassExpression":
|
|
1607
|
+
if (r === "superClass" && (n.type === "ArrowFunctionExpression" || n.type === "AssignmentExpression" || n.type === "AwaitExpression" || n.type === "BinaryExpression" || n.type === "ConditionalExpression" || n.type === "LogicalExpression" || n.type === "NewExpression" || n.type === "ObjectExpression" || n.type === "SequenceExpression" || n.type === "TaggedTemplateExpression" || n.type === "UnaryExpression" || n.type === "UpdateExpression" || n.type === "YieldExpression" || n.type === "TSNonNullExpression" || n.type === "ClassExpression" && W(n.decorators))) return !0;
|
|
1608
|
+
break;
|
|
1609
|
+
case "ExportDefaultDeclaration":
|
|
1610
|
+
return sa(e, t) || n.type === "SequenceExpression";
|
|
1611
|
+
case "Decorator":
|
|
1612
|
+
if (r === "expression" && !pl(n)) return !0;
|
|
1613
|
+
break;
|
|
1614
|
+
case "TypeAnnotation":
|
|
1615
|
+
if (e.match(void 0, void 0, (c, E) => E === "returnType" && c.type === "ArrowFunctionExpression") && sl(n)) return !0;
|
|
1616
|
+
break;
|
|
1617
|
+
case "BinaryExpression":
|
|
1618
|
+
if (r === "left" && (u.operator === "in" || u.operator === "instanceof") && n.type === "UnaryExpression") return !0;
|
|
1619
|
+
break;
|
|
1620
|
+
case "VariableDeclarator":
|
|
1621
|
+
if (r === "init" && e.match(void 0, void 0, (c, E) => E === "declarations" && c.type === "VariableDeclaration", (c, E) => E === "left" && c.type === "ForInStatement")) return !0;
|
|
1622
|
+
break;
|
|
1623
|
+
}
|
|
1624
|
+
switch (n.type) {
|
|
1625
|
+
case "UpdateExpression":
|
|
1626
|
+
if (u.type === "UnaryExpression") return n.prefix && (n.operator === "++" && u.operator === "+" || n.operator === "--" && u.operator === "-");
|
|
1627
|
+
case "UnaryExpression":
|
|
1628
|
+
switch (u.type) {
|
|
1629
|
+
case "UnaryExpression":
|
|
1630
|
+
return n.operator === u.operator && (n.operator === "+" || n.operator === "-");
|
|
1631
|
+
case "BindExpression":
|
|
1632
|
+
return !0;
|
|
1633
|
+
case "MemberExpression":
|
|
1634
|
+
case "OptionalMemberExpression":
|
|
1635
|
+
return r === "object";
|
|
1636
|
+
case "TaggedTemplateExpression":
|
|
1637
|
+
return !0;
|
|
1638
|
+
case "NewExpression":
|
|
1639
|
+
case "CallExpression":
|
|
1640
|
+
case "OptionalCallExpression":
|
|
1641
|
+
return r === "callee";
|
|
1642
|
+
case "BinaryExpression":
|
|
1643
|
+
return r === "left" && u.operator === "**";
|
|
1644
|
+
case "TSNonNullExpression":
|
|
1645
|
+
return !0;
|
|
1646
|
+
default:
|
|
1647
|
+
return !1;
|
|
1648
|
+
}
|
|
1649
|
+
case "BinaryExpression":
|
|
1650
|
+
if (u.type === "UpdateExpression" || n.operator === "in" && al(e)) return !0;
|
|
1651
|
+
if (n.operator === "|>" && ((l = n.extra) != null && l.parenthesized)) {
|
|
1652
|
+
let c = e.grandparent;
|
|
1653
|
+
if (c.type === "BinaryExpression" && c.operator === "|>") return !0;
|
|
1654
|
+
}
|
|
1655
|
+
case "TSTypeAssertion":
|
|
1656
|
+
case "TSAsExpression":
|
|
1657
|
+
case "TSSatisfiesExpression":
|
|
1658
|
+
case "AsExpression":
|
|
1659
|
+
case "AsConstExpression":
|
|
1660
|
+
case "SatisfiesExpression":
|
|
1661
|
+
case "LogicalExpression":
|
|
1662
|
+
switch (u.type) {
|
|
1663
|
+
case "TSAsExpression":
|
|
1664
|
+
case "TSSatisfiesExpression":
|
|
1665
|
+
case "AsExpression":
|
|
1666
|
+
case "AsConstExpression":
|
|
1667
|
+
case "SatisfiesExpression":
|
|
1668
|
+
return !ge(n);
|
|
1669
|
+
case "ConditionalExpression":
|
|
1670
|
+
return ge(n) || xo(n);
|
|
1671
|
+
case "CallExpression":
|
|
1672
|
+
case "NewExpression":
|
|
1673
|
+
case "OptionalCallExpression":
|
|
1674
|
+
return r === "callee";
|
|
1675
|
+
case "ClassExpression":
|
|
1676
|
+
case "ClassDeclaration":
|
|
1677
|
+
return r === "superClass";
|
|
1678
|
+
case "TSTypeAssertion":
|
|
1679
|
+
case "TaggedTemplateExpression":
|
|
1680
|
+
case "UnaryExpression":
|
|
1681
|
+
case "JSXSpreadAttribute":
|
|
1682
|
+
case "SpreadElement":
|
|
1683
|
+
case "BindExpression":
|
|
1684
|
+
case "AwaitExpression":
|
|
1685
|
+
case "TSNonNullExpression":
|
|
1686
|
+
case "UpdateExpression":
|
|
1687
|
+
return !0;
|
|
1688
|
+
case "MemberExpression":
|
|
1689
|
+
case "OptionalMemberExpression":
|
|
1690
|
+
return r === "object";
|
|
1691
|
+
case "AssignmentExpression":
|
|
1692
|
+
case "AssignmentPattern":
|
|
1693
|
+
return r === "left" && (n.type === "TSTypeAssertion" || ge(n));
|
|
1694
|
+
case "LogicalExpression":
|
|
1695
|
+
if (n.type === "LogicalExpression") return u.operator !== n.operator;
|
|
1696
|
+
case "BinaryExpression": {
|
|
1697
|
+
let { operator: c, type: E } = n;
|
|
1698
|
+
if (!c && E !== "TSTypeAssertion") return !0;
|
|
1699
|
+
let S = en(c), h = u.operator, C = en(h);
|
|
1700
|
+
return !!(C > S || r === "right" && C === S || C === S && !ur(h, c) || C < S && c === "%" && (h === "+" || h === "-") || Lo(h));
|
|
1701
|
+
}
|
|
1702
|
+
default:
|
|
1703
|
+
return !1;
|
|
1704
|
+
}
|
|
1705
|
+
case "SequenceExpression":
|
|
1706
|
+
return u.type !== "ForStatement";
|
|
1707
|
+
case "YieldExpression":
|
|
1708
|
+
if (u.type === "AwaitExpression" || u.type === "TSTypeAssertion") return !0;
|
|
1709
|
+
case "AwaitExpression":
|
|
1710
|
+
switch (u.type) {
|
|
1711
|
+
case "TaggedTemplateExpression":
|
|
1712
|
+
case "UnaryExpression":
|
|
1713
|
+
case "LogicalExpression":
|
|
1714
|
+
case "SpreadElement":
|
|
1715
|
+
case "TSAsExpression":
|
|
1716
|
+
case "TSSatisfiesExpression":
|
|
1717
|
+
case "TSNonNullExpression":
|
|
1718
|
+
case "AsExpression":
|
|
1719
|
+
case "AsConstExpression":
|
|
1720
|
+
case "SatisfiesExpression":
|
|
1721
|
+
case "BindExpression":
|
|
1722
|
+
return !0;
|
|
1723
|
+
case "MemberExpression":
|
|
1724
|
+
case "OptionalMemberExpression":
|
|
1725
|
+
return r === "object";
|
|
1726
|
+
case "NewExpression":
|
|
1727
|
+
case "CallExpression":
|
|
1728
|
+
case "OptionalCallExpression":
|
|
1729
|
+
return r === "callee";
|
|
1730
|
+
case "ConditionalExpression":
|
|
1731
|
+
return r === "test";
|
|
1732
|
+
case "BinaryExpression":
|
|
1733
|
+
return !(!n.argument && u.operator === "|>");
|
|
1734
|
+
default:
|
|
1735
|
+
return !1;
|
|
1736
|
+
}
|
|
1737
|
+
case "TSFunctionType":
|
|
1738
|
+
if (e.match((c) => c.type === "TSFunctionType", (c, E) => E === "typeAnnotation" && c.type === "TSTypeAnnotation", (c, E) => E === "returnType" && c.type === "ArrowFunctionExpression")) return !0;
|
|
1739
|
+
case "TSConditionalType":
|
|
1740
|
+
case "TSConstructorType":
|
|
1741
|
+
case "ConditionalTypeAnnotation":
|
|
1742
|
+
if (r === "extendsType" && We(n) && u.type === n.type || r === "checkType" && We(u)) return !0;
|
|
1743
|
+
if (r === "extendsType" && u.type === "TSConditionalType") {
|
|
1744
|
+
let { typeAnnotation: c } = n.returnType || n.typeAnnotation;
|
|
1745
|
+
if (c.type === "TSTypePredicate" && c.typeAnnotation && (c = c.typeAnnotation.typeAnnotation), c.type === "TSInferType" && c.typeParameter.constraint) return !0;
|
|
1746
|
+
}
|
|
1747
|
+
case "TSUnionType":
|
|
1748
|
+
case "TSIntersectionType":
|
|
1749
|
+
if (Pe(u) || qt(u)) return !0;
|
|
1750
|
+
case "TSInferType":
|
|
1751
|
+
if (n.type === "TSInferType") {
|
|
1752
|
+
if (u.type === "TSRestType") return !1;
|
|
1753
|
+
if (r === "types" && (u.type === "TSUnionType" || u.type === "TSIntersectionType") && n.typeParameter.type === "TSTypeParameter" && n.typeParameter.constraint) return !0;
|
|
1754
|
+
}
|
|
1755
|
+
case "TSTypeOperator":
|
|
1756
|
+
return u.type === "TSArrayType" || u.type === "TSOptionalType" || u.type === "TSRestType" || r === "objectType" && u.type === "TSIndexedAccessType" || u.type === "TSTypeOperator" || u.type === "TSTypeAnnotation" && e.grandparent.type.startsWith("TSJSDoc");
|
|
1757
|
+
case "TSTypeQuery":
|
|
1758
|
+
return r === "objectType" && u.type === "TSIndexedAccessType" || r === "elementType" && u.type === "TSArrayType";
|
|
1759
|
+
case "TypeOperator":
|
|
1760
|
+
return u.type === "ArrayTypeAnnotation" || u.type === "NullableTypeAnnotation" || r === "objectType" && (u.type === "IndexedAccessType" || u.type === "OptionalIndexedAccessType") || u.type === "TypeOperator";
|
|
1761
|
+
case "TypeofTypeAnnotation":
|
|
1762
|
+
return r === "objectType" && (u.type === "IndexedAccessType" || u.type === "OptionalIndexedAccessType") || r === "elementType" && u.type === "ArrayTypeAnnotation";
|
|
1763
|
+
case "ArrayTypeAnnotation":
|
|
1764
|
+
return u.type === "NullableTypeAnnotation";
|
|
1765
|
+
case "IntersectionTypeAnnotation":
|
|
1766
|
+
case "UnionTypeAnnotation":
|
|
1767
|
+
return u.type === "TypeOperator" || u.type === "KeyofTypeAnnotation" || u.type === "ArrayTypeAnnotation" || u.type === "NullableTypeAnnotation" || u.type === "IntersectionTypeAnnotation" || u.type === "UnionTypeAnnotation" || r === "objectType" && (u.type === "IndexedAccessType" || u.type === "OptionalIndexedAccessType");
|
|
1768
|
+
case "InferTypeAnnotation":
|
|
1769
|
+
case "NullableTypeAnnotation":
|
|
1770
|
+
return u.type === "ArrayTypeAnnotation" || r === "objectType" && (u.type === "IndexedAccessType" || u.type === "OptionalIndexedAccessType");
|
|
1771
|
+
case "ComponentTypeAnnotation":
|
|
1772
|
+
case "FunctionTypeAnnotation": {
|
|
1773
|
+
if (n.type === "ComponentTypeAnnotation" && (n.rendersType === null || n.rendersType === void 0)) return !1;
|
|
1774
|
+
if (e.match(void 0, (E, S) => S === "typeAnnotation" && E.type === "TypeAnnotation", (E, S) => S === "returnType" && E.type === "ArrowFunctionExpression") || e.match(void 0, (E, S) => S === "typeAnnotation" && E.type === "TypePredicate", (E, S) => S === "typeAnnotation" && E.type === "TypeAnnotation", (E, S) => S === "returnType" && E.type === "ArrowFunctionExpression")) return !0;
|
|
1775
|
+
let c = u.type === "NullableTypeAnnotation" ? e.grandparent : u;
|
|
1776
|
+
return c.type === "UnionTypeAnnotation" || c.type === "IntersectionTypeAnnotation" || c.type === "ArrayTypeAnnotation" || r === "objectType" && (c.type === "IndexedAccessType" || c.type === "OptionalIndexedAccessType") || r === "checkType" && u.type === "ConditionalTypeAnnotation" || r === "extendsType" && u.type === "ConditionalTypeAnnotation" && ((y = n.returnType) == null ? void 0 : y.type) === "InferTypeAnnotation" && ((d = n.returnType) == null ? void 0 : d.typeParameter.bound) || c.type === "NullableTypeAnnotation" || u.type === "FunctionTypeParam" && u.name === null && ne(n).some((E) => {
|
|
1777
|
+
var S;
|
|
1778
|
+
return ((S = E.typeAnnotation) == null ? void 0 : S.type) === "NullableTypeAnnotation";
|
|
1779
|
+
});
|
|
1780
|
+
}
|
|
1781
|
+
case "OptionalIndexedAccessType":
|
|
1782
|
+
return r === "objectType" && u.type === "IndexedAccessType";
|
|
1783
|
+
case "StringLiteral":
|
|
1784
|
+
case "NumericLiteral":
|
|
1785
|
+
case "Literal":
|
|
1786
|
+
if (typeof n.value == "string" && u.type === "ExpressionStatement" && typeof u.directive != "string") {
|
|
1787
|
+
let c = e.grandparent;
|
|
1788
|
+
return c.type === "Program" || c.type === "BlockStatement";
|
|
1789
|
+
}
|
|
1790
|
+
return r === "object" && _(u) && ve(n);
|
|
1791
|
+
case "AssignmentExpression":
|
|
1792
|
+
return !((r === "init" || r === "update") && u.type === "ForStatement" || r === "expression" && n.left.type !== "ObjectPattern" && u.type === "ExpressionStatement" || r === "key" && u.type === "TSPropertySignature" || u.type === "AssignmentExpression" || r === "expressions" && u.type === "SequenceExpression" && e.match(void 0, void 0, (c, E) => (E === "init" || E === "update") && c.type === "ForStatement") || r === "value" && u.type === "Property" && e.match(void 0, void 0, (c, E) => E === "properties" && c.type === "ObjectPattern") || u.type === "NGChainedExpression" || r === "node" && u.type === "JsExpressionRoot");
|
|
1793
|
+
case "ConditionalExpression":
|
|
1794
|
+
switch (u.type) {
|
|
1795
|
+
case "TaggedTemplateExpression":
|
|
1796
|
+
case "UnaryExpression":
|
|
1797
|
+
case "SpreadElement":
|
|
1798
|
+
case "BinaryExpression":
|
|
1799
|
+
case "LogicalExpression":
|
|
1800
|
+
case "NGPipeExpression":
|
|
1801
|
+
case "ExportDefaultDeclaration":
|
|
1802
|
+
case "AwaitExpression":
|
|
1803
|
+
case "JSXSpreadAttribute":
|
|
1804
|
+
case "TSTypeAssertion":
|
|
1805
|
+
case "TypeCastExpression":
|
|
1806
|
+
case "TSAsExpression":
|
|
1807
|
+
case "TSSatisfiesExpression":
|
|
1808
|
+
case "AsExpression":
|
|
1809
|
+
case "AsConstExpression":
|
|
1810
|
+
case "SatisfiesExpression":
|
|
1811
|
+
case "TSNonNullExpression":
|
|
1812
|
+
return !0;
|
|
1813
|
+
case "NewExpression":
|
|
1814
|
+
case "CallExpression":
|
|
1815
|
+
case "OptionalCallExpression":
|
|
1816
|
+
return r === "callee";
|
|
1817
|
+
case "ConditionalExpression":
|
|
1818
|
+
return t.experimentalTernaries ? !1 : r === "test";
|
|
1819
|
+
case "MemberExpression":
|
|
1820
|
+
case "OptionalMemberExpression":
|
|
1821
|
+
return r === "object";
|
|
1822
|
+
default:
|
|
1823
|
+
return !1;
|
|
1824
|
+
}
|
|
1825
|
+
case "FunctionExpression":
|
|
1826
|
+
switch (u.type) {
|
|
1827
|
+
case "NewExpression":
|
|
1828
|
+
case "CallExpression":
|
|
1829
|
+
case "OptionalCallExpression":
|
|
1830
|
+
return r === "callee";
|
|
1831
|
+
case "TaggedTemplateExpression":
|
|
1832
|
+
return !0;
|
|
1833
|
+
default:
|
|
1834
|
+
return !1;
|
|
1835
|
+
}
|
|
1836
|
+
case "ArrowFunctionExpression":
|
|
1837
|
+
switch (u.type) {
|
|
1838
|
+
case "BinaryExpression":
|
|
1839
|
+
return u.operator !== "|>" || ((f = n.extra) == null ? void 0 : f.parenthesized);
|
|
1840
|
+
case "NewExpression":
|
|
1841
|
+
case "CallExpression":
|
|
1842
|
+
case "OptionalCallExpression":
|
|
1843
|
+
return r === "callee";
|
|
1844
|
+
case "MemberExpression":
|
|
1845
|
+
case "OptionalMemberExpression":
|
|
1846
|
+
return r === "object";
|
|
1847
|
+
case "TSAsExpression":
|
|
1848
|
+
case "TSSatisfiesExpression":
|
|
1849
|
+
case "AsExpression":
|
|
1850
|
+
case "AsConstExpression":
|
|
1851
|
+
case "SatisfiesExpression":
|
|
1852
|
+
case "TSNonNullExpression":
|
|
1853
|
+
case "BindExpression":
|
|
1854
|
+
case "TaggedTemplateExpression":
|
|
1855
|
+
case "UnaryExpression":
|
|
1856
|
+
case "LogicalExpression":
|
|
1857
|
+
case "AwaitExpression":
|
|
1858
|
+
case "TSTypeAssertion":
|
|
1859
|
+
case "MatchExpressionCase":
|
|
1860
|
+
return !0;
|
|
1861
|
+
case "TSInstantiationExpression":
|
|
1862
|
+
return r === "expression";
|
|
1863
|
+
case "ConditionalExpression":
|
|
1864
|
+
return r === "test";
|
|
1865
|
+
default:
|
|
1866
|
+
return !1;
|
|
1867
|
+
}
|
|
1868
|
+
case "ClassExpression":
|
|
1869
|
+
switch (u.type) {
|
|
1870
|
+
case "NewExpression":
|
|
1871
|
+
return r === "callee";
|
|
1872
|
+
default:
|
|
1873
|
+
return !1;
|
|
1874
|
+
}
|
|
1875
|
+
case "OptionalMemberExpression":
|
|
1876
|
+
case "OptionalCallExpression":
|
|
1877
|
+
case "CallExpression":
|
|
1878
|
+
case "MemberExpression":
|
|
1879
|
+
if (il(e)) return !0;
|
|
1880
|
+
case "TaggedTemplateExpression":
|
|
1881
|
+
case "TSNonNullExpression":
|
|
1882
|
+
if (r === "callee" && (u.type === "BindExpression" || u.type === "NewExpression")) {
|
|
1883
|
+
let c = n;
|
|
1884
|
+
for (; c; ) switch (c.type) {
|
|
1885
|
+
case "CallExpression":
|
|
1886
|
+
case "OptionalCallExpression":
|
|
1887
|
+
return !0;
|
|
1888
|
+
case "MemberExpression":
|
|
1889
|
+
case "OptionalMemberExpression":
|
|
1890
|
+
case "BindExpression":
|
|
1891
|
+
c = c.object;
|
|
1892
|
+
break;
|
|
1893
|
+
case "TaggedTemplateExpression":
|
|
1894
|
+
c = c.tag;
|
|
1895
|
+
break;
|
|
1896
|
+
case "TSNonNullExpression":
|
|
1897
|
+
c = c.expression;
|
|
1898
|
+
break;
|
|
1899
|
+
default:
|
|
1900
|
+
return !1;
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
return !1;
|
|
1904
|
+
case "BindExpression":
|
|
1905
|
+
return r === "callee" && (u.type === "BindExpression" || u.type === "NewExpression") || r === "object" && _(u);
|
|
1906
|
+
case "NGPipeExpression":
|
|
1907
|
+
return !(u.type === "NGRoot" || u.type === "NGMicrosyntaxExpression" || u.type === "ObjectProperty" && !((m = n.extra) != null && m.parenthesized) || ee(u) || r === "arguments" && O(u) || r === "right" && u.type === "NGPipeExpression" || r === "property" && u.type === "MemberExpression" || u.type === "AssignmentExpression");
|
|
1908
|
+
case "JSXFragment":
|
|
1909
|
+
case "JSXElement":
|
|
1910
|
+
return r === "callee" || r === "left" && u.type === "BinaryExpression" && u.operator === "<" || !ee(u) && u.type !== "ArrowFunctionExpression" && u.type !== "AssignmentExpression" && u.type !== "AssignmentPattern" && u.type !== "BinaryExpression" && u.type !== "NewExpression" && u.type !== "ConditionalExpression" && u.type !== "ExpressionStatement" && u.type !== "JsExpressionRoot" && u.type !== "JSXAttribute" && u.type !== "JSXElement" && u.type !== "JSXExpressionContainer" && u.type !== "JSXFragment" && u.type !== "LogicalExpression" && !O(u) && !Ue(u) && u.type !== "ReturnStatement" && u.type !== "ThrowStatement" && u.type !== "TypeCastExpression" && u.type !== "VariableDeclarator" && u.type !== "YieldExpression" && u.type !== "MatchExpressionCase";
|
|
1911
|
+
case "TSInstantiationExpression":
|
|
1912
|
+
return r === "object" && _(u);
|
|
1913
|
+
case "MatchOrPattern":
|
|
1914
|
+
return u.type === "MatchAsPattern";
|
|
1915
|
+
}
|
|
1916
|
+
return !1;
|
|
1917
|
+
}
|
|
1918
|
+
var ul = I(["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"]);
|
|
1919
|
+
function al(e) {
|
|
1920
|
+
let t = 0, { node: n } = e;
|
|
1921
|
+
for (; n; ) {
|
|
1922
|
+
let r = e.getParentNode(t++);
|
|
1923
|
+
if ((r == null ? void 0 : r.type) === "ForStatement" && r.init === n) return !0;
|
|
1924
|
+
n = r;
|
|
1925
|
+
}
|
|
1926
|
+
return !1;
|
|
1927
|
+
}
|
|
1928
|
+
function sl(e) {
|
|
1929
|
+
return wn(e, (t) => t.type === "ObjectTypeAnnotation" && wn(t, (n) => n.type === "FunctionTypeAnnotation"));
|
|
1930
|
+
}
|
|
1931
|
+
function ol(e) {
|
|
1932
|
+
return he(e);
|
|
1933
|
+
}
|
|
1934
|
+
function Bt(e) {
|
|
1935
|
+
let { parent: t, key: n } = e;
|
|
1936
|
+
switch (t.type) {
|
|
1937
|
+
case "NGPipeExpression":
|
|
1938
|
+
if (n === "arguments" && e.isLast) return e.callParent(Bt);
|
|
1939
|
+
break;
|
|
1940
|
+
case "ObjectProperty":
|
|
1941
|
+
if (n === "value") return e.callParent(() => e.key === "properties" && e.isLast);
|
|
1942
|
+
break;
|
|
1943
|
+
case "BinaryExpression":
|
|
1944
|
+
case "LogicalExpression":
|
|
1945
|
+
if (n === "right") return e.callParent(Bt);
|
|
1946
|
+
break;
|
|
1947
|
+
case "ConditionalExpression":
|
|
1948
|
+
if (n === "alternate") return e.callParent(Bt);
|
|
1949
|
+
break;
|
|
1950
|
+
case "UnaryExpression":
|
|
1951
|
+
if (t.prefix) return e.callParent(Bt);
|
|
1952
|
+
break;
|
|
1953
|
+
}
|
|
1954
|
+
return !1;
|
|
1955
|
+
}
|
|
1956
|
+
function sa(e, t) {
|
|
1957
|
+
let { node: n, parent: r } = e;
|
|
1958
|
+
return n.type === "FunctionExpression" || n.type === "ClassExpression" ? r.type === "ExportDefaultDeclaration" || !Jn(e, t) : !er(n) || r.type !== "ExportDefaultDeclaration" && Jn(e, t) ? !1 : e.call(() => sa(e, t), ...Au(n));
|
|
1959
|
+
}
|
|
1960
|
+
function il(e) {
|
|
1961
|
+
return !!(e.match(void 0, (t, n) => n === "expression" && t.type === "ChainExpression", (t, n) => n === "tag" && t.type === "TaggedTemplateExpression") || e.match((t) => t.type === "OptionalCallExpression" || t.type === "OptionalMemberExpression", (t, n) => n === "tag" && t.type === "TaggedTemplateExpression") || e.match((t) => t.type === "OptionalCallExpression" || t.type === "OptionalMemberExpression", (t, n) => n === "expression" && t.type === "TSNonNullExpression", (t, n) => n === "tag" && t.type === "TaggedTemplateExpression") || e.match(void 0, (t, n) => n === "expression" && t.type === "ChainExpression", (t, n) => n === "expression" && t.type === "TSNonNullExpression", (t, n) => n === "tag" && t.type === "TaggedTemplateExpression") || e.match(void 0, (t, n) => n === "expression" && t.type === "TSNonNullExpression", (t, n) => n === "expression" && t.type === "ChainExpression", (t, n) => n === "tag" && t.type === "TaggedTemplateExpression") || e.match((t) => t.type === "OptionalMemberExpression" || t.type === "OptionalCallExpression", (t, n) => n === "object" && t.type === "MemberExpression" || n === "callee" && (t.type === "CallExpression" || t.type === "NewExpression")) || e.match((t) => t.type === "OptionalMemberExpression" || t.type === "OptionalCallExpression", (t, n) => n === "expression" && t.type === "TSNonNullExpression", (t, n) => n === "object" && t.type === "MemberExpression" || n === "callee" && t.type === "CallExpression") || e.match((t) => t.type === "CallExpression" || t.type === "MemberExpression", (t, n) => n === "expression" && t.type === "ChainExpression") && (e.match(void 0, void 0, (t, n) => n === "callee" && (t.type === "CallExpression" && !t.optional || t.type === "NewExpression") || n === "object" && t.type === "MemberExpression" && !t.optional) || e.match(void 0, void 0, (t, n) => n === "expression" && t.type === "TSNonNullExpression", (t, n) => n === "object" && t.type === "MemberExpression" || n === "callee" && t.type === "CallExpression")) || e.match((t) => t.type === "CallExpression" || t.type === "MemberExpression", (t, n) => n === "expression" && t.type === "TSNonNullExpression", (t, n) => n === "expression" && t.type === "ChainExpression", (t, n) => n === "object" && t.type === "MemberExpression" || n === "callee" && t.type === "CallExpression"));
|
|
1962
|
+
}
|
|
1963
|
+
function qn(e) {
|
|
1964
|
+
return e.type === "Identifier" ? !0 : _(e) ? !e.computed && !e.optional && e.property.type === "Identifier" && qn(e.object) : !1;
|
|
1965
|
+
}
|
|
1966
|
+
function pl(e) {
|
|
1967
|
+
return e.type === "ChainExpression" && (e = e.expression), qn(e) || O(e) && !e.optional && qn(e.callee);
|
|
1968
|
+
}
|
|
1969
|
+
var Ke = Jn;
|
|
1970
|
+
function ll(e, t) {
|
|
1971
|
+
let n = t - 1;
|
|
1972
|
+
n = ct(e, n, { backwards: !0 }), n = Dt(e, n, { backwards: !0 }), n = ct(e, n, { backwards: !0 });
|
|
1973
|
+
let r = Dt(e, n, { backwards: !0 });
|
|
1974
|
+
return n !== r;
|
|
1975
|
+
}
|
|
1976
|
+
var cl = ll, Dl = () => !0;
|
|
1977
|
+
function fr(e, t) {
|
|
1978
|
+
let n = e.node;
|
|
1979
|
+
return n.printed = !0, t.printer.printComment(e, t);
|
|
1980
|
+
}
|
|
1981
|
+
function yl(e, t) {
|
|
1982
|
+
var l;
|
|
1983
|
+
let n = e.node, r = [fr(e, t)], { printer: u, originalText: a, locStart: s, locEnd: o } = t;
|
|
1984
|
+
if ((l = u.isBlockComment) != null && l.call(u, n)) {
|
|
1985
|
+
let y = oe(a, o(n)) ? oe(a, s(n), { backwards: !0 }) ? g : T : " ";
|
|
1986
|
+
r.push(y);
|
|
1987
|
+
} else r.push(g);
|
|
1988
|
+
let p = Dt(a, ct(a, o(n)));
|
|
1989
|
+
return p !== !1 && oe(a, p) && r.push(g), r;
|
|
1990
|
+
}
|
|
1991
|
+
function dl(e, t, n) {
|
|
1992
|
+
var l;
|
|
1993
|
+
let r = e.node, u = fr(e, t), { printer: a, originalText: s, locStart: o } = t, p = (l = a.isBlockComment) == null ? void 0 : l.call(a, r);
|
|
1994
|
+
if (n != null && n.hasLineSuffix && !(n != null && n.isBlock) || oe(s, o(r), { backwards: !0 })) {
|
|
1995
|
+
let y = cl(s, o(r));
|
|
1996
|
+
return { doc: Xr([g, y ? g : "", u]), isBlock: p, hasLineSuffix: !0 };
|
|
1997
|
+
}
|
|
1998
|
+
return !p || n != null && n.hasLineSuffix ? { doc: [Xr([" ", u]), Oe], isBlock: p, hasLineSuffix: !0 } : { doc: [" ", u], isBlock: p, hasLineSuffix: !1 };
|
|
1999
|
+
}
|
|
2000
|
+
function R(e, t, n = {}) {
|
|
2001
|
+
let { node: r } = e;
|
|
2002
|
+
if (!W(r == null ? void 0 : r.comments)) return "";
|
|
2003
|
+
let { indent: u = !1, marker: a, filter: s = Dl } = n, o = [];
|
|
2004
|
+
if (e.each(({ node: l }) => {
|
|
2005
|
+
l.leading || l.trailing || l.marker !== a || !s(l) || o.push(fr(e, t));
|
|
2006
|
+
}, "comments"), o.length === 0) return "";
|
|
2007
|
+
let p = L(g, o);
|
|
2008
|
+
return u ? A([g, p]) : p;
|
|
2009
|
+
}
|
|
2010
|
+
function ln(e, t) {
|
|
2011
|
+
let n = e.node;
|
|
2012
|
+
if (!n) return {};
|
|
2013
|
+
let r = t[Symbol.for("printedComments")];
|
|
2014
|
+
if ((n.comments || []).filter((o) => !r.has(o)).length === 0) return { leading: "", trailing: "" };
|
|
2015
|
+
let u = [], a = [], s;
|
|
2016
|
+
return e.each(() => {
|
|
2017
|
+
let o = e.node;
|
|
2018
|
+
if (r != null && r.has(o)) return;
|
|
2019
|
+
let { leading: p, trailing: l } = o;
|
|
2020
|
+
p ? u.push(yl(e, t)) : l && (s = dl(e, t, s), a.push(s.doc));
|
|
2021
|
+
}, "comments"), { leading: u, trailing: a };
|
|
2022
|
+
}
|
|
2023
|
+
function Fe(e, t, n) {
|
|
2024
|
+
let { leading: r, trailing: u } = ln(e, n);
|
|
2025
|
+
return !r && !u ? t : Mn(t, (a) => [r, a, u]);
|
|
2026
|
+
}
|
|
2027
|
+
var rn = class extends Error {
|
|
2028
|
+
constructor() {
|
|
2029
|
+
super(...arguments);
|
|
2030
|
+
Gt(this, "name", "ArgExpansionBailout");
|
|
2031
|
+
}
|
|
2032
|
+
};
|
|
2033
|
+
function st(e, t, n, r, u) {
|
|
2034
|
+
let a = e.node, s = ne(a), o = u && a.typeParameters ? n("typeParameters") : "";
|
|
2035
|
+
if (s.length === 0) return [o, "(", R(e, t, { filter: (m) => xe(t.originalText, j(m)) === ")" }), ")"];
|
|
2036
|
+
let { parent: p } = e, l = on(p), y = oa(a), d = [];
|
|
2037
|
+
if (Jo(e, (m, c) => {
|
|
2038
|
+
let E = c === s.length - 1;
|
|
2039
|
+
E && a.rest && d.push("..."), d.push(n()), !E && (d.push(","), l || y ? d.push(" ") : Ie(s[c], t) ? d.push(g, g) : d.push(T));
|
|
2040
|
+
}), r && !ml(e)) {
|
|
2041
|
+
if (ue(o) || ue(d)) throw new rn();
|
|
2042
|
+
return D([nn(o), "(", nn(d), ")"]);
|
|
2043
|
+
}
|
|
2044
|
+
let f = s.every((m) => !W(m.decorators));
|
|
2045
|
+
return y && f ? [o, "(", ...d, ")"] : l ? [o, "(", ...d, ")"] : (hu(p) || Bo(p) || p.type === "TypeAlias" || p.type === "UnionTypeAnnotation" || p.type === "IntersectionTypeAnnotation" || p.type === "FunctionTypeAnnotation" && p.returnType === a) && s.length === 1 && s[0].name === null && a.this !== s[0] && s[0].typeAnnotation && a.typeParameters === null && nr(s[0].typeAnnotation) && !a.rest ? t.arrowParens === "always" || a.type === "HookTypeAnnotation" ? ["(", ...d, ")"] : d : [o, "(", A([F, ...d]), k(!Oo(a) && we(t, "all") ? "," : ""), F, ")"];
|
|
2046
|
+
}
|
|
2047
|
+
function oa(e) {
|
|
2048
|
+
if (!e) return !1;
|
|
2049
|
+
let t = ne(e);
|
|
2050
|
+
if (t.length !== 1) return !1;
|
|
2051
|
+
let [n] = t;
|
|
2052
|
+
return !x(n) && (n.type === "ObjectPattern" || n.type === "ArrayPattern" || n.type === "Identifier" && n.typeAnnotation && (n.typeAnnotation.type === "TypeAnnotation" || n.typeAnnotation.type === "TSTypeAnnotation") && _e(n.typeAnnotation.typeAnnotation) || n.type === "FunctionTypeParam" && _e(n.typeAnnotation) && n !== e.rest || n.type === "AssignmentPattern" && (n.left.type === "ObjectPattern" || n.left.type === "ArrayPattern") && (n.right.type === "Identifier" || he(n.right) && n.right.properties.length === 0 || ee(n.right) && n.right.elements.length === 0));
|
|
2053
|
+
}
|
|
2054
|
+
function fl(e) {
|
|
2055
|
+
let t;
|
|
2056
|
+
return e.returnType ? (t = e.returnType, t.typeAnnotation && (t = t.typeAnnotation)) : e.typeAnnotation && (t = e.typeAnnotation), t;
|
|
2057
|
+
}
|
|
2058
|
+
function gt(e, t) {
|
|
2059
|
+
var u;
|
|
2060
|
+
let n = fl(e);
|
|
2061
|
+
if (!n) return !1;
|
|
2062
|
+
let r = (u = e.typeParameters) == null ? void 0 : u.params;
|
|
2063
|
+
if (r) {
|
|
2064
|
+
if (r.length > 1) return !1;
|
|
2065
|
+
if (r.length === 1) {
|
|
2066
|
+
let a = r[0];
|
|
2067
|
+
if (a.constraint || a.default) return !1;
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
return ne(e).length === 1 && (_e(n) || ue(t));
|
|
2071
|
+
}
|
|
2072
|
+
function ml(e) {
|
|
2073
|
+
return e.match((t) => t.type === "ArrowFunctionExpression" && t.body.type === "BlockStatement", (t, n) => {
|
|
2074
|
+
if (t.type === "CallExpression" && n === "arguments" && t.arguments.length === 1 && t.callee.type === "CallExpression") {
|
|
2075
|
+
let r = t.callee.callee;
|
|
2076
|
+
return r.type === "Identifier" || r.type === "MemberExpression" && !r.computed && r.object.type === "Identifier" && r.property.type === "Identifier";
|
|
2077
|
+
}
|
|
2078
|
+
return !1;
|
|
2079
|
+
}, (t, n) => t.type === "VariableDeclarator" && n === "init" || t.type === "ExportDefaultDeclaration" && n === "declaration" || t.type === "TSExportAssignment" && n === "expression" || t.type === "AssignmentExpression" && n === "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);
|
|
2080
|
+
}
|
|
2081
|
+
function Fl(e) {
|
|
2082
|
+
let t = ne(e);
|
|
2083
|
+
return t.length > 1 && t.some((n) => n.type === "TSParameterProperty");
|
|
2084
|
+
}
|
|
2085
|
+
function Pt(e, t) {
|
|
2086
|
+
return (t === "params" || t === "this" || t === "rest") && oa(e);
|
|
2087
|
+
}
|
|
2088
|
+
function ae(e) {
|
|
2089
|
+
let { node: t } = e;
|
|
2090
|
+
return !t.optional || t.type === "Identifier" && t === e.parent.key ? "" : O(t) || _(t) && t.computed || t.type === "OptionalIndexedAccessType" ? "?." : "?";
|
|
2091
|
+
}
|
|
2092
|
+
function ia(e) {
|
|
2093
|
+
return e.node.definite || e.match(void 0, (t, n) => n === "id" && t.type === "VariableDeclarator" && t.definite) ? "!" : "";
|
|
2094
|
+
}
|
|
2095
|
+
var El = I(["DeclareClass", "DeclareComponent", "DeclareFunction", "DeclareHook", "DeclareVariable", "DeclareExportDeclaration", "DeclareExportAllDeclaration", "DeclareOpaqueType", "DeclareTypeAlias", "DeclareEnum", "DeclareInterface"]);
|
|
2096
|
+
function De(e) {
|
|
2097
|
+
let { node: t } = e;
|
|
2098
|
+
return t.declare || El(t) && e.parent.type !== "DeclareExportDeclaration" ? "declare " : "";
|
|
2099
|
+
}
|
|
2100
|
+
var Al = I(["TSAbstractMethodDefinition", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]);
|
|
2101
|
+
function cn({ node: e }) {
|
|
2102
|
+
return e.abstract || Al(e) ? "abstract " : "";
|
|
2103
|
+
}
|
|
2104
|
+
function Xe(e, t, n) {
|
|
2105
|
+
return e.type === "EmptyStatement" ? x(e, B.Leading) ? [" ", t] : t : e.type === "BlockStatement" || n ? [" ", t] : A([T, t]);
|
|
2106
|
+
}
|
|
2107
|
+
function Dn(e) {
|
|
2108
|
+
return e.accessibility ? e.accessibility + " " : "";
|
|
2109
|
+
}
|
|
2110
|
+
var gl = /^[\$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]*$/, Cl = (e) => gl.test(e), hl = Cl;
|
|
2111
|
+
function xl(e) {
|
|
2112
|
+
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, "");
|
|
2113
|
+
}
|
|
2114
|
+
var mt = xl, Tl = 0;
|
|
2115
|
+
function pa(e, t, n) {
|
|
2116
|
+
var b;
|
|
2117
|
+
let { node: r, parent: u, grandparent: a, key: s } = e, o = s !== "body" && (u.type === "IfStatement" || u.type === "WhileStatement" || u.type === "SwitchStatement" || u.type === "DoWhileStatement"), p = r.operator === "|>" && ((b = e.root.extra) == null ? void 0 : b.__isUsingHackPipeline), l = Xn(e, t, n, !1, o);
|
|
2118
|
+
if (o) return l;
|
|
2119
|
+
if (p) return D(l);
|
|
2120
|
+
if (s === "callee" && (O(u) || u.type === "NewExpression") || u.type === "UnaryExpression" || _(u) && !u.computed) return D([A([F, ...l]), F]);
|
|
2121
|
+
let y = u.type === "ReturnStatement" || u.type === "ThrowStatement" || u.type === "JSXExpressionContainer" && a.type === "JSXAttribute" || r.operator !== "|" && u.type === "JsExpressionRoot" || r.type !== "NGPipeExpression" && (u.type === "NGRoot" && t.parser === "__ng_binding" || u.type === "NGMicrosyntaxExpression" && a.type === "NGMicrosyntax" && a.body.length === 1) || r === u.body && u.type === "ArrowFunctionExpression" || r !== u.body && u.type === "ForStatement" || u.type === "ConditionalExpression" && a.type !== "ReturnStatement" && a.type !== "ThrowStatement" && !O(a) && a.type !== "NewExpression" || u.type === "TemplateLiteral" || bl(e), d = u.type === "AssignmentExpression" || u.type === "VariableDeclarator" || u.type === "ClassProperty" || u.type === "PropertyDefinition" || u.type === "TSAbstractPropertyDefinition" || u.type === "ClassPrivateProperty" || Ue(u), f = Me(r.left) && ur(r.operator, r.left.operator);
|
|
2122
|
+
if (y || Mt(r) && !f || !Mt(r) && d) return D(l);
|
|
2123
|
+
if (l.length === 0) return "";
|
|
2124
|
+
let m = Y(r.right), c = l.findIndex((w) => typeof w != "string" && !Array.isArray(w) && w.type === Ee), E = l.slice(0, c === -1 ? 1 : c + 1), S = l.slice(E.length, m ? -1 : void 0), h = Symbol("logicalChain-" + ++Tl), C = D([...E, A(S)], { id: h });
|
|
2125
|
+
if (!m) return C;
|
|
2126
|
+
let N = J(0, l, -1);
|
|
2127
|
+
return D([C, jt(N, { groupId: h })]);
|
|
2128
|
+
}
|
|
2129
|
+
function Xn(e, t, n, r, u) {
|
|
2130
|
+
var S;
|
|
2131
|
+
let { node: a } = e;
|
|
2132
|
+
if (!Me(a)) return [D(n())];
|
|
2133
|
+
let s = [];
|
|
2134
|
+
ur(a.operator, a.left.operator) ? s = e.call(() => Xn(e, t, n, !0, u), "left") : s.push(D(n("left")));
|
|
2135
|
+
let o = Mt(a), p = a.right.type === "ChainExpression" ? a.right.expression : a.right, l = (a.operator === "|>" || a.type === "NGPipeExpression" || Sl(e, t)) && !Ce(t.originalText, p), y = !x(p, B.Leading, wu) && Ce(t.originalText, p), d = a.type === "NGPipeExpression" ? "|" : a.operator, f = a.type === "NGPipeExpression" && a.arguments.length > 0 ? D(A([F, ": ", L([T, ": "], e.map(() => Te(2, D(n())), "arguments"))])) : "", m;
|
|
2136
|
+
if (o) m = [d, Ce(t.originalText, p) ? A([T, n("right"), f]) : [" ", n("right"), f]];
|
|
2137
|
+
else {
|
|
2138
|
+
let h = d === "|>" && ((S = e.root.extra) != null && S.__isUsingHackPipeline) ? e.call(() => Xn(e, t, n, !0, u), "right") : n("right");
|
|
2139
|
+
if (t.experimentalOperatorPosition === "start") {
|
|
2140
|
+
let C = "";
|
|
2141
|
+
if (y) switch (Ve(h)) {
|
|
2142
|
+
case Le:
|
|
2143
|
+
C = h.splice(0, 1)[0];
|
|
2144
|
+
break;
|
|
2145
|
+
case Je:
|
|
2146
|
+
C = h.contents.splice(0, 1)[0];
|
|
2147
|
+
break;
|
|
2148
|
+
}
|
|
2149
|
+
m = [T, C, d, " ", h, f];
|
|
2150
|
+
} else m = [l ? T : "", d, l ? " " : T, h, f];
|
|
2151
|
+
}
|
|
2152
|
+
let { parent: c } = e, E = x(a.left, B.Trailing | B.Line);
|
|
2153
|
+
if ((E || !(u && a.type === "LogicalExpression") && c.type !== a.type && a.left.type !== a.type && a.right.type !== a.type) && (m = D(m, { shouldBreak: E })), t.experimentalOperatorPosition === "start" ? s.push(o || y ? " " : "", m) : s.push(l ? "" : " ", m), r && x(a)) {
|
|
2154
|
+
let h = yr(Fe(e, s, t));
|
|
2155
|
+
return h.type === $e ? h.parts : Array.isArray(h) ? h : [h];
|
|
2156
|
+
}
|
|
2157
|
+
return s;
|
|
2158
|
+
}
|
|
2159
|
+
function Mt(e) {
|
|
2160
|
+
return e.type !== "LogicalExpression" ? !1 : !!(he(e.right) && e.right.properties.length > 0 || ee(e.right) && e.right.elements.length > 0 || Y(e.right));
|
|
2161
|
+
}
|
|
2162
|
+
var $r = (e) => e.type === "BinaryExpression" && e.operator === "|";
|
|
2163
|
+
function Sl(e, t) {
|
|
2164
|
+
return (t.parser === "__vue_expression" || t.parser === "__vue_ts_expression") && $r(e.node) && !e.hasAncestor((n) => !$r(n) && n.type !== "JsExpressionRoot");
|
|
2165
|
+
}
|
|
2166
|
+
function bl(e) {
|
|
2167
|
+
if (e.key !== "arguments") return !1;
|
|
2168
|
+
let { parent: t } = e;
|
|
2169
|
+
if (!(O(t) && !t.optional && t.arguments.length === 1)) return !1;
|
|
2170
|
+
let { callee: n } = t;
|
|
2171
|
+
return n.type === "Identifier" && n.name === "Boolean";
|
|
2172
|
+
}
|
|
2173
|
+
function la(e, t, n) {
|
|
2174
|
+
let { node: r } = e, { parent: u } = e, a = u.type !== "TypeParameterInstantiation" && (!We(u) || !t.experimentalTernaries) && u.type !== "TSTypeParameterInstantiation" && u.type !== "GenericTypeAnnotation" && u.type !== "TSTypeReference" && u.type !== "TSTypeAssertion" && u.type !== "TupleTypeAnnotation" && u.type !== "TSTupleType" && !(u.type === "FunctionTypeParam" && !u.name && e.grandparent.this !== u) && !((Nn(u) || u.type === "VariableDeclarator") && Ce(t.originalText, r)) && !(Nn(u) && x(u.id, B.Trailing | B.Line)), s = ca(r), o = e.map(() => {
|
|
2175
|
+
let m = n();
|
|
2176
|
+
return s || (m = Te(2, m)), Fe(e, m, t);
|
|
2177
|
+
}, "types"), p = "", l = "";
|
|
2178
|
+
if (Pu(e) && ({ leading: p, trailing: l } = ln(e, t)), s) return [p, L(" | ", o), l];
|
|
2179
|
+
let y = a && !Ce(t.originalText, r), d = [k([y ? T : "", "| "]), L([T, "| "], o)];
|
|
2180
|
+
if (Ke(e, t)) return [p, D([A(d), F]), l];
|
|
2181
|
+
let f = [p, D(d)];
|
|
2182
|
+
return (u.type === "TupleTypeAnnotation" || u.type === "TSTupleType") && u[u.type === "TupleTypeAnnotation" && u.types ? "types" : "elementTypes"].length > 1 ? [D([A([k(["(", F]), f]), F, k(")")]), l] : [D(a ? A(f) : f), l];
|
|
2183
|
+
}
|
|
2184
|
+
var Bl = I(["VoidTypeAnnotation", "TSVoidKeyword", "NullLiteralTypeAnnotation", "TSNullKeyword"]), vl = I(["ObjectTypeAnnotation", "TSTypeLiteral", "GenericTypeAnnotation", "TSTypeReference"]);
|
|
2185
|
+
function ca(e) {
|
|
2186
|
+
let { types: t } = e;
|
|
2187
|
+
if (t.some((r) => x(r))) return !1;
|
|
2188
|
+
let n = t.find((r) => vl(r));
|
|
2189
|
+
return n ? t.every((r) => r === n || Bl(r)) : !1;
|
|
2190
|
+
}
|
|
2191
|
+
function Pl(e) {
|
|
2192
|
+
return nr(e) || _e(e) ? !0 : Pe(e) ? ca(e) : !1;
|
|
2193
|
+
}
|
|
2194
|
+
var kl = /* @__PURE__ */ new WeakSet();
|
|
2195
|
+
function Z(e, t, n = "typeAnnotation") {
|
|
2196
|
+
let { node: { [n]: r } } = e;
|
|
2197
|
+
if (!r) return "";
|
|
2198
|
+
let u = !1;
|
|
2199
|
+
if (r.type === "TSTypeAnnotation" || r.type === "TypeAnnotation") {
|
|
2200
|
+
let a = e.call(Da, n);
|
|
2201
|
+
(a === "=>" || a === ":" && x(r, B.Leading)) && (u = !0), kl.add(r);
|
|
2202
|
+
}
|
|
2203
|
+
return u ? [" ", t(n)] : t(n);
|
|
2204
|
+
}
|
|
2205
|
+
var Da = (e) => e.match((t) => t.type === "TSTypeAnnotation", (t, n) => (n === "returnType" || n === "typeAnnotation") && (t.type === "TSFunctionType" || t.type === "TSConstructorType")) ? "=>" : e.match((t) => t.type === "TSTypeAnnotation", (t, n) => n === "typeAnnotation" && (t.type === "TSJSDocNullableType" || t.type === "TSJSDocNonNullableType" || t.type === "TSTypePredicate")) || e.match((t) => t.type === "TypeAnnotation", (t, n) => n === "typeAnnotation" && t.type === "Identifier", (t, n) => n === "id" && t.type === "DeclareFunction") || e.match((t) => t.type === "TypeAnnotation", (t, n) => n === "typeAnnotation" && t.type === "Identifier", (t, n) => n === "id" && t.type === "DeclareHook") || e.match((t) => t.type === "TypeAnnotation", (t, n) => n === "bound" && t.type === "TypeParameter" && t.usesExtendsBound) ? "" : ":";
|
|
2206
|
+
function ya(e, t, n) {
|
|
2207
|
+
let r = Da(e);
|
|
2208
|
+
return r ? [r, " ", n("typeAnnotation")] : n("typeAnnotation");
|
|
2209
|
+
}
|
|
2210
|
+
function wl(e, t, n, r) {
|
|
2211
|
+
let { node: u } = e, a = u.inexact ? "..." : "";
|
|
2212
|
+
return x(u, B.Dangling) ? D([n, a, R(e, t, { indent: !0 }), F, r]) : [n, a, r];
|
|
2213
|
+
}
|
|
2214
|
+
function mr(e, t, n) {
|
|
2215
|
+
let { node: r } = e, u = [], a = "[", s = "]", o = r.type === "TupleTypeAnnotation" && r.types ? "types" : r.type === "TSTupleType" || r.type === "TupleTypeAnnotation" ? "elementTypes" : "elements", p = r[o];
|
|
2216
|
+
if (p.length === 0) u.push(wl(e, t, a, s));
|
|
2217
|
+
else {
|
|
2218
|
+
let l = J(0, p, -1), y = (l == null ? void 0 : l.type) !== "RestElement" && !r.inexact, d = l === null, f = Symbol("array"), m = !t.__inJestEach && p.length > 1 && p.every((S, h, C) => {
|
|
2219
|
+
let N = S == null ? void 0 : S.type;
|
|
2220
|
+
if (!ee(S) && !he(S)) return !1;
|
|
2221
|
+
let b = C[h + 1];
|
|
2222
|
+
if (b && N !== b.type) return !1;
|
|
2223
|
+
let w = ee(S) ? "elements" : "properties";
|
|
2224
|
+
return S[w] && S[w].length > 1;
|
|
2225
|
+
}), c = da(r, t), E = y ? d ? "," : we(t) ? c ? k(",", "", { groupId: f }) : k(",") : "" : "";
|
|
2226
|
+
u.push(D([a, A([F, c ? Nl(e, t, n, E) : [Il(e, t, n, o, r.inexact), E], R(e, t)]), F, s], { shouldBreak: m, id: f }));
|
|
2227
|
+
}
|
|
2228
|
+
return u.push(ae(e), Z(e, n)), u;
|
|
2229
|
+
}
|
|
2230
|
+
function da(e, t) {
|
|
2231
|
+
return ee(e) && e.elements.length > 0 && e.elements.every((n) => n && (ve(n) || gu(n) && !x(n.argument)) && !x(n, B.Trailing | B.Line, (r) => !oe(t.originalText, M(r), { backwards: !0 })));
|
|
2232
|
+
}
|
|
2233
|
+
function fa({ node: e }, { originalText: t }) {
|
|
2234
|
+
let n = j(e);
|
|
2235
|
+
if (n === M(e)) return !1;
|
|
2236
|
+
let { length: r } = t;
|
|
2237
|
+
for (; n < r && t[n] !== ","; ) n = Hn(t, zn(t, n + 1));
|
|
2238
|
+
return Yn(t, n);
|
|
2239
|
+
}
|
|
2240
|
+
function Il(e, t, n, r, u) {
|
|
2241
|
+
let a = [];
|
|
2242
|
+
return e.each(({ node: s, isLast: o }) => {
|
|
2243
|
+
a.push(s ? D(n()) : ""), (!o || u) && a.push([",", T, s && fa(e, t) ? F : ""]);
|
|
2244
|
+
}, r), u && a.push("..."), a;
|
|
2245
|
+
}
|
|
2246
|
+
function Nl(e, t, n, r) {
|
|
2247
|
+
let u = [];
|
|
2248
|
+
return e.each(({ isLast: a, next: s }) => {
|
|
2249
|
+
u.push([n(), a ? r : ","]), a || u.push(fa(e, t) ? [g, g] : x(s, B.Leading | B.Line) ? g : T);
|
|
2250
|
+
}, "elements"), Gu(u);
|
|
2251
|
+
}
|
|
2252
|
+
function jl(e, t, n) {
|
|
2253
|
+
let { node: r } = e, u = ye(r);
|
|
2254
|
+
if (u.length === 0) return ["(", R(e, t), ")"];
|
|
2255
|
+
let a = u.length - 1;
|
|
2256
|
+
if (Ol(u)) {
|
|
2257
|
+
let d = ["("];
|
|
2258
|
+
return tn(e, (f, m) => {
|
|
2259
|
+
d.push(n()), m !== a && d.push(", ");
|
|
2260
|
+
}), d.push(")"), d;
|
|
2261
|
+
}
|
|
2262
|
+
let s = !1, o = [];
|
|
2263
|
+
tn(e, ({ node: d }, f) => {
|
|
2264
|
+
let m = n();
|
|
2265
|
+
f === a || (Ie(d, t) ? (s = !0, m = [m, ",", g, g]) : m = [m, ",", T]), o.push(m);
|
|
2266
|
+
});
|
|
2267
|
+
let p = !t.parser.startsWith("__ng_") && r.type !== "ImportExpression" && r.type !== "TSImportType" && r.type !== "TSExternalModuleReference" && we(t, "all") ? "," : "";
|
|
2268
|
+
function l() {
|
|
2269
|
+
return D(["(", A([T, ...o]), p, T, ")"], { shouldBreak: !0 });
|
|
2270
|
+
}
|
|
2271
|
+
if (s || e.parent.type !== "Decorator" && No(u)) return l();
|
|
2272
|
+
if (Ll(u)) {
|
|
2273
|
+
let d = o.slice(1);
|
|
2274
|
+
if (d.some(ue)) return l();
|
|
2275
|
+
let f;
|
|
2276
|
+
try {
|
|
2277
|
+
f = n(Lr(r, 0), { expandFirstArg: !0 });
|
|
2278
|
+
} catch (m) {
|
|
2279
|
+
if (m instanceof rn) return l();
|
|
2280
|
+
throw m;
|
|
2281
|
+
}
|
|
2282
|
+
return ue(f) ? [Oe, ze([["(", D(f, { shouldBreak: !0 }), ", ", ...d, ")"], l()])] : ze([["(", f, ", ", ...d, ")"], ["(", D(f, { shouldBreak: !0 }), ", ", ...d, ")"], l()]);
|
|
2283
|
+
}
|
|
2284
|
+
if (Ml(u, o, t)) {
|
|
2285
|
+
let d = o.slice(0, -1);
|
|
2286
|
+
if (d.some(ue)) return l();
|
|
2287
|
+
let f;
|
|
2288
|
+
try {
|
|
2289
|
+
f = n(Lr(r, -1), { expandLastArg: !0 });
|
|
2290
|
+
} catch (m) {
|
|
2291
|
+
if (m instanceof rn) return l();
|
|
2292
|
+
throw m;
|
|
2293
|
+
}
|
|
2294
|
+
return ue(f) ? [Oe, ze([["(", ...d, D(f, { shouldBreak: !0 }), ")"], l()])] : ze([["(", ...d, f, ")"], ["(", ...d, D(f, { shouldBreak: !0 }), ")"], l()]);
|
|
2295
|
+
}
|
|
2296
|
+
let y = ["(", A([F, ...o]), k(p), F, ")"];
|
|
2297
|
+
return Bu(e) ? y : D(y, { shouldBreak: o.some(ue) || s });
|
|
2298
|
+
}
|
|
2299
|
+
function kt(e, t = !1) {
|
|
2300
|
+
return he(e) && (e.properties.length > 0 || x(e)) || ee(e) && (e.elements.length > 0 || x(e)) || e.type === "TSTypeAssertion" && kt(e.expression) || ge(e) && kt(e.expression) || e.type === "FunctionExpression" || e.type === "ArrowFunctionExpression" && (!e.returnType || !e.returnType.typeAnnotation || e.returnType.typeAnnotation.type !== "TSTypeReference" || Jl(e.body)) && (e.body.type === "BlockStatement" || e.body.type === "ArrowFunctionExpression" && kt(e.body, !0) || he(e.body) || ee(e.body) || !t && (O(e.body) || e.body.type === "ConditionalExpression") || Y(e.body)) || e.type === "DoExpression" || e.type === "ModuleExpression";
|
|
2301
|
+
}
|
|
2302
|
+
function Ml(e, t, n) {
|
|
2303
|
+
var a, s;
|
|
2304
|
+
let r = J(0, e, -1);
|
|
2305
|
+
if (e.length === 1) {
|
|
2306
|
+
let o = J(0, t, -1);
|
|
2307
|
+
if ((a = o.label) != null && a.embed && ((s = o.label) == null ? void 0 : s.hug) !== !1) return !0;
|
|
2308
|
+
}
|
|
2309
|
+
let u = J(0, e, -2);
|
|
2310
|
+
return !x(r, B.Leading) && !x(r, B.Trailing) && kt(r) && (!u || u.type !== r.type) && (e.length !== 2 || u.type !== "ArrowFunctionExpression" || !ee(r)) && !(e.length > 1 && da(r, n));
|
|
2311
|
+
}
|
|
2312
|
+
function Ll(e) {
|
|
2313
|
+
if (e.length !== 2) return !1;
|
|
2314
|
+
let [t, n] = e;
|
|
2315
|
+
return t.type === "ModuleExpression" && ql(n) ? !0 : !x(t) && (t.type === "FunctionExpression" || t.type === "ArrowFunctionExpression" && t.body.type === "BlockStatement") && n.type !== "FunctionExpression" && n.type !== "ArrowFunctionExpression" && n.type !== "ConditionalExpression" && ma(n) && !kt(n);
|
|
2316
|
+
}
|
|
2317
|
+
function ma(e) {
|
|
2318
|
+
if (e.type === "ParenthesizedExpression") return ma(e.expression);
|
|
2319
|
+
if (ge(e) || e.type === "TypeCastExpression") {
|
|
2320
|
+
let { typeAnnotation: t } = e;
|
|
2321
|
+
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") {
|
|
2322
|
+
let n = t.type === "GenericTypeAnnotation" ? t.typeParameters : t.typeArguments;
|
|
2323
|
+
(n == null ? void 0 : n.params.length) === 1 && (t = n.params[0]);
|
|
2324
|
+
}
|
|
2325
|
+
return nr(t) && Ae(e.expression, 1);
|
|
2326
|
+
}
|
|
2327
|
+
return ft(e) && ye(e).length > 1 ? !1 : Me(e) ? Ae(e.left, 1) && Ae(e.right, 1) : Cu(e) || Ae(e);
|
|
2328
|
+
}
|
|
2329
|
+
function Ol(e) {
|
|
2330
|
+
return e.length === 2 ? Gr(e, 0) : e.length === 3 ? e[0].type === "Identifier" && Gr(e, 1) : !1;
|
|
2331
|
+
}
|
|
2332
|
+
function Gr(e, t) {
|
|
2333
|
+
let n = e[t], r = e[t + 1];
|
|
2334
|
+
return n.type === "ArrowFunctionExpression" && ne(n).length === 0 && n.body.type === "BlockStatement" && r.type === "ArrayExpression" && !e.some((u) => x(u));
|
|
2335
|
+
}
|
|
2336
|
+
function Jl(e) {
|
|
2337
|
+
return e.type === "BlockStatement" && (e.body.some((t) => t.type !== "EmptyStatement") || x(e, B.Dangling));
|
|
2338
|
+
}
|
|
2339
|
+
function ql(e) {
|
|
2340
|
+
if (!(e.type === "ObjectExpression" && e.properties.length === 1)) return !1;
|
|
2341
|
+
let [t] = e.properties;
|
|
2342
|
+
return Ue(t) ? !t.computed && (t.key.type === "Identifier" && t.key.name === "type" || Q(t.key) && t.key.value === "type") && Q(t.value) && t.value.value === "module" : !1;
|
|
2343
|
+
}
|
|
2344
|
+
var Rn = jl;
|
|
2345
|
+
function Xl(e, t, n) {
|
|
2346
|
+
return [n("object"), D(A([F, Fa(e, t, n)]))];
|
|
2347
|
+
}
|
|
2348
|
+
function Fa(e, t, n) {
|
|
2349
|
+
return ["::", n("callee")];
|
|
2350
|
+
}
|
|
2351
|
+
var Rl = (e) => ((e.type === "ChainExpression" || e.type === "TSNonNullExpression") && (e = e.expression), O(e) && ye(e).length > 0);
|
|
2352
|
+
function _l(e) {
|
|
2353
|
+
let { node: t, ancestors: n } = e;
|
|
2354
|
+
for (let r of n) {
|
|
2355
|
+
if (!(_(r) && r.object === t || r.type === "TSNonNullExpression" && r.expression === t)) return r.type === "NewExpression" && r.callee === t;
|
|
2356
|
+
t = r;
|
|
2357
|
+
}
|
|
2358
|
+
return !1;
|
|
2359
|
+
}
|
|
2360
|
+
function Wl(e, t, n) {
|
|
2361
|
+
var l;
|
|
2362
|
+
let r = n("object"), u = Ea(e, t, n), { node: a } = e, s = e.findAncestor((y) => !(_(y) || y.type === "TSNonNullExpression")), o = e.findAncestor((y) => !(y.type === "ChainExpression" || y.type === "TSNonNullExpression")), p = s.type === "BindExpression" || s.type === "AssignmentExpression" && s.left.type !== "Identifier" || _l(e) || a.computed || a.object.type === "Identifier" && a.property.type === "Identifier" && !_(o) || (o.type === "AssignmentExpression" || o.type === "VariableDeclarator") && (Rl(a.object) || ((l = r.label) == null ? void 0 : l.memberChain));
|
|
2363
|
+
return Xt(r.label, [r, p ? u : D(A([F, u]))]);
|
|
2364
|
+
}
|
|
2365
|
+
function Ea(e, t, n) {
|
|
2366
|
+
let r = n("property"), { node: u } = e, a = ae(e);
|
|
2367
|
+
return u.computed ? !u.property || ve(u.property) ? [a, "[", r, "]"] : D([a, "[", A([F, r]), F, "]"]) : [a, ".", r];
|
|
2368
|
+
}
|
|
2369
|
+
function Aa(e, t, n) {
|
|
2370
|
+
if (e.node.type === "ChainExpression") return e.call(() => Aa(e, t, n), "expression");
|
|
2371
|
+
let r = (e.parent.type === "ChainExpression" ? e.grandparent : e.parent).type === "ExpressionStatement", u = [];
|
|
2372
|
+
function a(P) {
|
|
2373
|
+
let { originalText: G } = t, H = Ft(G, j(P));
|
|
2374
|
+
return G.charAt(H) === ")" ? H !== !1 && Yn(G, H + 1) : Ie(P, t);
|
|
2375
|
+
}
|
|
2376
|
+
function s() {
|
|
2377
|
+
let { node: P } = e;
|
|
2378
|
+
if (P.type === "ChainExpression") return e.call(s, "expression");
|
|
2379
|
+
if (O(P) && (pt(P.callee) || O(P.callee))) {
|
|
2380
|
+
let G = a(P);
|
|
2381
|
+
u.unshift({ node: P, hasTrailingEmptyLine: G, printed: [Fe(e, [ae(e), n("typeArguments"), Rn(e, t, n)], t), G ? g : ""] }), e.call(s, "callee");
|
|
2382
|
+
} else pt(P) ? (u.unshift({ node: P, needsParens: Ke(e, t), printed: Fe(e, _(P) ? Ea(e, t, n) : Fa(e, t, n), t) }), e.call(s, "object")) : P.type === "TSNonNullExpression" ? (u.unshift({ node: P, printed: Fe(e, "!", t) }), e.call(s, "expression")) : u.unshift({ node: P, printed: n() });
|
|
2383
|
+
}
|
|
2384
|
+
let { node: o } = e;
|
|
2385
|
+
u.unshift({ node: o, printed: [ae(e), n("typeArguments"), Rn(e, t, n)] }), o.callee && e.call(s, "callee");
|
|
2386
|
+
let p = [], l = [u[0]], y = 1;
|
|
2387
|
+
for (; y < u.length && (u[y].node.type === "TSNonNullExpression" || O(u[y].node) || _(u[y].node) && u[y].node.computed && ve(u[y].node.property)); ++y) l.push(u[y]);
|
|
2388
|
+
if (!O(u[0].node)) for (; y + 1 < u.length && pt(u[y].node) && pt(u[y + 1].node); ++y) l.push(u[y]);
|
|
2389
|
+
p.push(l), l = [];
|
|
2390
|
+
let d = !1;
|
|
2391
|
+
for (; y < u.length; ++y) {
|
|
2392
|
+
if (d && pt(u[y].node)) {
|
|
2393
|
+
if (u[y].node.computed && ve(u[y].node.property)) {
|
|
2394
|
+
l.push(u[y]);
|
|
2395
|
+
continue;
|
|
2396
|
+
}
|
|
2397
|
+
p.push(l), l = [], d = !1;
|
|
2398
|
+
}
|
|
2399
|
+
(O(u[y].node) || u[y].node.type === "ImportExpression") && (d = !0), l.push(u[y]), x(u[y].node, B.Trailing) && (p.push(l), l = [], d = !1);
|
|
2400
|
+
}
|
|
2401
|
+
l.length > 0 && p.push(l);
|
|
2402
|
+
function f(P) {
|
|
2403
|
+
return /^[A-Z]|^[$_]+$/u.test(P);
|
|
2404
|
+
}
|
|
2405
|
+
function m(P) {
|
|
2406
|
+
return P.length <= t.tabWidth;
|
|
2407
|
+
}
|
|
2408
|
+
function c(P) {
|
|
2409
|
+
var He;
|
|
2410
|
+
let G = (He = P[1][0]) == null ? void 0 : He.node.computed;
|
|
2411
|
+
if (P[0].length === 1) {
|
|
2412
|
+
let fe = P[0][0].node;
|
|
2413
|
+
return fe.type === "ThisExpression" || fe.type === "Identifier" && (f(fe.name) || r && m(fe.name) || G);
|
|
2414
|
+
}
|
|
2415
|
+
let H = J(0, P[0], -1).node;
|
|
2416
|
+
return _(H) && H.property.type === "Identifier" && (f(H.property.name) || G);
|
|
2417
|
+
}
|
|
2418
|
+
let E = p.length >= 2 && !x(p[1][0].node) && c(p);
|
|
2419
|
+
function S(P) {
|
|
2420
|
+
let G = P.map((H) => H.printed);
|
|
2421
|
+
return P.length > 0 && J(0, P, -1).needsParens ? ["(", ...G, ")"] : G;
|
|
2422
|
+
}
|
|
2423
|
+
function h(P) {
|
|
2424
|
+
return P.length === 0 ? "" : A([g, L(g, P.map(S))]);
|
|
2425
|
+
}
|
|
2426
|
+
let C = p.map(S), N = C, b = E ? 3 : 2, w = p.flat(), q = w.slice(1, -1).some((P) => x(P.node, B.Leading)) || w.slice(0, -1).some((P) => x(P.node, B.Trailing)) || p[b] && x(p[b][0].node, B.Leading);
|
|
2427
|
+
if (p.length <= b && !q && !p.some((P) => J(0, P, -1).hasTrailingEmptyLine)) return Bu(e) ? N : D(N);
|
|
2428
|
+
let K = J(0, p[E ? 1 : 0], -1).node, v = !O(K) && a(K), X = [S(p[0]), E ? p.slice(1, 2).map(S) : "", v ? g : "", h(p.slice(E ? 2 : 1))], U = u.map(({ node: P }) => P).filter(O);
|
|
2429
|
+
function te() {
|
|
2430
|
+
let P = J(0, J(0, p, -1), -1).node, G = J(0, C, -1);
|
|
2431
|
+
return O(P) && ue(G) && U.slice(0, -1).some((H) => H.arguments.some(It));
|
|
2432
|
+
}
|
|
2433
|
+
let de;
|
|
2434
|
+
return q || U.length > 2 && U.some((P) => !P.arguments.every((G) => Ae(G))) || C.slice(0, -1).some(ue) || te() ? de = D(X) : de = [ue(N) || v ? Oe : "", ze([N, X])], Xt({ memberChain: !0 }, de);
|
|
2435
|
+
}
|
|
2436
|
+
var Ul = Aa;
|
|
2437
|
+
function un(e, t, n) {
|
|
2438
|
+
var d;
|
|
2439
|
+
let { node: r } = e, u = r.type === "NewExpression", a = ae(e), s = ye(r), o = r.type !== "TSImportType" && r.typeArguments ? n("typeArguments") : "", p = s.length === 1 && Su(s[0], t.originalText);
|
|
2440
|
+
if (p || Gl(e) || Vl(e) || on(r, e.parent)) {
|
|
2441
|
+
let f = [];
|
|
2442
|
+
if (tn(e, () => {
|
|
2443
|
+
f.push(n());
|
|
2444
|
+
}), !(p && ((d = f[0].label) != null && d.embed))) return [u ? "new " : "", Vr(e, n), a, o, "(", L(", ", f), ")"];
|
|
2445
|
+
}
|
|
2446
|
+
let l = r.type === "ImportExpression" || r.type === "TSImportType" || r.type === "TSExternalModuleReference";
|
|
2447
|
+
if (!l && !u && pt(r.callee) && !e.call(() => Ke(e, t), "callee", ...r.callee.type === "ChainExpression" ? ["expression"] : [])) return Ul(e, t, n);
|
|
2448
|
+
let y = [u ? "new " : "", Vr(e, n), a, o, Rn(e, t, n)];
|
|
2449
|
+
return l || O(r.callee) ? D(y) : y;
|
|
2450
|
+
}
|
|
2451
|
+
function Vr(e, t) {
|
|
2452
|
+
let { node: n } = e;
|
|
2453
|
+
return n.type === "ImportExpression" ? `import${n.phase ? `.${n.phase}` : ""}` : n.type === "TSImportType" ? "import" : n.type === "TSExternalModuleReference" ? "require" : t("callee");
|
|
2454
|
+
}
|
|
2455
|
+
var $l = ["require", "require.resolve", "require.resolve.paths", "import.meta.resolve"];
|
|
2456
|
+
function Gl(e) {
|
|
2457
|
+
let { node: t } = e;
|
|
2458
|
+
if (!(t.type === "ImportExpression" || t.type === "TSImportType" || t.type === "TSExternalModuleReference" || t.type === "CallExpression" && !t.optional && Qn(t.callee, $l))) return !1;
|
|
2459
|
+
let n = ye(t);
|
|
2460
|
+
return n.length === 1 && Q(n[0]) && !x(n[0]);
|
|
2461
|
+
}
|
|
2462
|
+
function Vl(e) {
|
|
2463
|
+
let { node: t } = e;
|
|
2464
|
+
if (t.type !== "CallExpression" || t.optional || t.callee.type !== "Identifier") return !1;
|
|
2465
|
+
let n = ye(t);
|
|
2466
|
+
return t.callee.name === "require" ? (n.length === 1 && Q(n[0]) || n.length > 1) && !x(n[0]) : t.callee.name === "define" && e.parent.type === "ExpressionStatement" ? n.length === 1 || n.length === 2 && n[0].type === "ArrayExpression" || n.length === 3 && Q(n[0]) && n[1].type === "ArrayExpression" : !1;
|
|
2467
|
+
}
|
|
2468
|
+
function Rt(e, t, n, r, u, a) {
|
|
2469
|
+
let s = zl(e, t, n, r, a), o = a ? n(a, { assignmentLayout: s }) : "";
|
|
2470
|
+
switch (s) {
|
|
2471
|
+
case "break-after-operator":
|
|
2472
|
+
return D([D(r), u, D(A([T, o]))]);
|
|
2473
|
+
case "never-break-after-operator":
|
|
2474
|
+
return D([D(r), u, " ", o]);
|
|
2475
|
+
case "fluid": {
|
|
2476
|
+
let p = Symbol("assignment");
|
|
2477
|
+
return D([D(r), u, D(A(T), { id: p }), ke, jt(o, { groupId: p })]);
|
|
2478
|
+
}
|
|
2479
|
+
case "break-lhs":
|
|
2480
|
+
return D([r, u, " ", D(o)]);
|
|
2481
|
+
case "chain":
|
|
2482
|
+
return [D(r), u, T, o];
|
|
2483
|
+
case "chain-tail":
|
|
2484
|
+
return [D(r), u, A([T, o])];
|
|
2485
|
+
case "chain-tail-arrow-chain":
|
|
2486
|
+
return [D(r), u, o];
|
|
2487
|
+
case "only-left":
|
|
2488
|
+
return r;
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
function Kl(e, t, n) {
|
|
2492
|
+
let { node: r } = e;
|
|
2493
|
+
return Rt(e, t, n, n("left"), [" ", r.operator], "right");
|
|
2494
|
+
}
|
|
2495
|
+
function Hl(e, t, n) {
|
|
2496
|
+
return Rt(e, t, n, n("id"), " =", "init");
|
|
2497
|
+
}
|
|
2498
|
+
function zl(e, t, n, r, u) {
|
|
2499
|
+
let { node: a } = e, s = a[u];
|
|
2500
|
+
if (!s) return "only-left";
|
|
2501
|
+
let o = !Yt(s);
|
|
2502
|
+
if (e.match(Yt, ga, (y) => !o || y.type !== "ExpressionStatement" && y.type !== "VariableDeclaration")) return o ? s.type === "ArrowFunctionExpression" && s.body.type === "ArrowFunctionExpression" ? "chain-tail-arrow-chain" : "chain-tail" : "chain";
|
|
2503
|
+
if (!o && Yt(s.right) || Ce(t.originalText, s)) return "break-after-operator";
|
|
2504
|
+
if (a.type === "ImportAttribute" || s.type === "CallExpression" && s.callee.name === "require" || t.parser === "json5" || t.parser === "jsonc" || t.parser === "json") return "never-break-after-operator";
|
|
2505
|
+
let p = Ui(r);
|
|
2506
|
+
if (Ql(a) || tc(a) || Ca(a) && p) return "break-lhs";
|
|
2507
|
+
let l = nc(a, r, t);
|
|
2508
|
+
return e.call(() => Yl(e, t, n, l), u) ? "break-after-operator" : Zl(a) ? "break-lhs" : !p && (l || s.type === "TemplateLiteral" || s.type === "TaggedTemplateExpression" || To(s) || ve(s) || s.type === "ClassExpression") ? "never-break-after-operator" : "fluid";
|
|
2509
|
+
}
|
|
2510
|
+
function Yl(e, t, n, r) {
|
|
2511
|
+
let u = e.node;
|
|
2512
|
+
if (Me(u) && !Mt(u)) return !0;
|
|
2513
|
+
switch (u.type) {
|
|
2514
|
+
case "StringLiteralTypeAnnotation":
|
|
2515
|
+
case "SequenceExpression":
|
|
2516
|
+
return !0;
|
|
2517
|
+
case "TSConditionalType":
|
|
2518
|
+
case "ConditionalTypeAnnotation":
|
|
2519
|
+
if (!t.experimentalTernaries && !ac(u)) break;
|
|
2520
|
+
return !0;
|
|
2521
|
+
case "ConditionalExpression": {
|
|
2522
|
+
if (!t.experimentalTernaries) {
|
|
2523
|
+
let { test: l } = u;
|
|
2524
|
+
return Me(l) && !Mt(l);
|
|
2525
|
+
}
|
|
2526
|
+
let { consequent: o, alternate: p } = u;
|
|
2527
|
+
return o.type === "ConditionalExpression" || p.type === "ConditionalExpression";
|
|
2528
|
+
}
|
|
2529
|
+
case "ClassExpression":
|
|
2530
|
+
return W(u.decorators);
|
|
2531
|
+
}
|
|
2532
|
+
if (r) return !1;
|
|
2533
|
+
let a = u, s = [];
|
|
2534
|
+
for (; ; ) if (a.type === "UnaryExpression" || a.type === "AwaitExpression" || a.type === "YieldExpression" && a.argument !== null) a = a.argument, s.push("argument");
|
|
2535
|
+
else if (a.type === "TSNonNullExpression") a = a.expression, s.push("expression");
|
|
2536
|
+
else break;
|
|
2537
|
+
return !!(Q(a) || e.call(() => ha(e, t, n), ...s));
|
|
2538
|
+
}
|
|
2539
|
+
function Ql(e) {
|
|
2540
|
+
if (ga(e)) {
|
|
2541
|
+
let t = e.left || e.id;
|
|
2542
|
+
return t.type === "ObjectPattern" && t.properties.length > 2 && t.properties.some((n) => {
|
|
2543
|
+
var r;
|
|
2544
|
+
return Ue(n) && (!n.shorthand || ((r = n.value) == null ? void 0 : r.type) === "AssignmentPattern");
|
|
2545
|
+
});
|
|
2546
|
+
}
|
|
2547
|
+
return !1;
|
|
2548
|
+
}
|
|
2549
|
+
function Yt(e) {
|
|
2550
|
+
return e.type === "AssignmentExpression";
|
|
2551
|
+
}
|
|
2552
|
+
function ga(e) {
|
|
2553
|
+
return Yt(e) || e.type === "VariableDeclarator";
|
|
2554
|
+
}
|
|
2555
|
+
function Zl(e) {
|
|
2556
|
+
let t = ec(e);
|
|
2557
|
+
if (W(t)) {
|
|
2558
|
+
let n = e.type === "TSTypeAliasDeclaration" ? "constraint" : "bound";
|
|
2559
|
+
if (t.length > 1 && t.some((r) => r[n] || r.default)) return !0;
|
|
2560
|
+
}
|
|
2561
|
+
return !1;
|
|
2562
|
+
}
|
|
2563
|
+
function ec(e) {
|
|
2564
|
+
var t;
|
|
2565
|
+
if (Nn(e)) return (t = e.typeParameters) == null ? void 0 : t.params;
|
|
2566
|
+
}
|
|
2567
|
+
function tc(e) {
|
|
2568
|
+
if (e.type !== "VariableDeclarator") return !1;
|
|
2569
|
+
let { typeAnnotation: t } = e.id;
|
|
2570
|
+
if (!t || !t.typeAnnotation) return !1;
|
|
2571
|
+
let n = Kr(t.typeAnnotation);
|
|
2572
|
+
return W(n) && n.length > 1 && n.some((r) => W(Kr(r)) || r.type === "TSConditionalType");
|
|
2573
|
+
}
|
|
2574
|
+
function Ca(e) {
|
|
2575
|
+
var t;
|
|
2576
|
+
return e.type === "VariableDeclarator" && ((t = e.init) == null ? void 0 : t.type) === "ArrowFunctionExpression";
|
|
2577
|
+
}
|
|
2578
|
+
function Kr(e) {
|
|
2579
|
+
let t;
|
|
2580
|
+
switch (e.type) {
|
|
2581
|
+
case "GenericTypeAnnotation":
|
|
2582
|
+
t = e.typeParameters;
|
|
2583
|
+
break;
|
|
2584
|
+
case "TSTypeReference":
|
|
2585
|
+
t = e.typeArguments;
|
|
2586
|
+
break;
|
|
2587
|
+
}
|
|
2588
|
+
return t == null ? void 0 : t.params;
|
|
2589
|
+
}
|
|
2590
|
+
function ha(e, t, n, r = !1) {
|
|
2591
|
+
var s;
|
|
2592
|
+
let { node: u } = e, a = () => ha(e, t, n, !0);
|
|
2593
|
+
if (u.type === "ChainExpression" || u.type === "TSNonNullExpression") return e.call(a, "expression");
|
|
2594
|
+
if (O(u)) {
|
|
2595
|
+
if ((s = un(e, t, n).label) != null && s.memberChain) return !1;
|
|
2596
|
+
let o = ye(u);
|
|
2597
|
+
return !(o.length === 0 || o.length === 1 && rr(o[0], t)) || rc(u, n) ? !1 : e.call(a, "callee");
|
|
2598
|
+
}
|
|
2599
|
+
return _(u) ? e.call(a, "object") : r && (u.type === "Identifier" || u.type === "ThisExpression");
|
|
2600
|
+
}
|
|
2601
|
+
function nc(e, t, n) {
|
|
2602
|
+
return Ue(e) ? (t = yr(t), typeof t == "string" && lt(t) < n.tabWidth + 3) : !1;
|
|
2603
|
+
}
|
|
2604
|
+
function rc(e, t) {
|
|
2605
|
+
let n = uc(e);
|
|
2606
|
+
if (W(n)) {
|
|
2607
|
+
if (n.length > 1) return !0;
|
|
2608
|
+
if (n.length === 1) {
|
|
2609
|
+
let u = n[0];
|
|
2610
|
+
if (Pe(u) || qt(u) || u.type === "TSTypeLiteral" || u.type === "ObjectTypeAnnotation") return !0;
|
|
2611
|
+
}
|
|
2612
|
+
let r = e.typeParameters ? "typeParameters" : "typeArguments";
|
|
2613
|
+
if (ue(t(r))) return !0;
|
|
2614
|
+
}
|
|
2615
|
+
return !1;
|
|
2616
|
+
}
|
|
2617
|
+
function uc(e) {
|
|
2618
|
+
var t;
|
|
2619
|
+
return (t = e.typeParameters ?? e.typeArguments) == null ? void 0 : t.params;
|
|
2620
|
+
}
|
|
2621
|
+
function Hr(e) {
|
|
2622
|
+
switch (e.type) {
|
|
2623
|
+
case "FunctionTypeAnnotation":
|
|
2624
|
+
case "GenericTypeAnnotation":
|
|
2625
|
+
case "TSFunctionType":
|
|
2626
|
+
return !!e.typeParameters;
|
|
2627
|
+
case "TSTypeReference":
|
|
2628
|
+
return !!e.typeArguments;
|
|
2629
|
+
default:
|
|
2630
|
+
return !1;
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
function ac(e) {
|
|
2634
|
+
return Hr(e.checkType) || Hr(e.extendsType);
|
|
2635
|
+
}
|
|
2636
|
+
var Qt = /* @__PURE__ */ new WeakMap();
|
|
2637
|
+
function xa(e) {
|
|
2638
|
+
return /^(?:\d+|\d+\.\d+)$/u.test(e);
|
|
2639
|
+
}
|
|
2640
|
+
function zr(e, t) {
|
|
2641
|
+
return t.parser === "json" || t.parser === "jsonc" || !Q(e.key) || yt(ie(e.key), t).slice(1, -1) !== e.key.value ? !1 : !!(hl(e.key.value) && !(t.parser === "babel-ts" && e.type === "ClassProperty" || (t.parser === "typescript" || t.parser === "oxc-ts") && e.type === "PropertyDefinition") || xa(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"));
|
|
2642
|
+
}
|
|
2643
|
+
function sc(e, t) {
|
|
2644
|
+
let { key: n } = e.node;
|
|
2645
|
+
return (n.type === "Identifier" || ve(n) && xa(mt(ie(n))) && String(n.value) === mt(ie(n)) && !(t.parser === "typescript" || t.parser === "babel-ts" || t.parser === "oxc-ts")) && (t.parser === "json" || t.parser === "jsonc" || t.quoteProps === "consistent" && Qt.get(e.parent));
|
|
2646
|
+
}
|
|
2647
|
+
function _t(e, t, n) {
|
|
2648
|
+
let { node: r } = e;
|
|
2649
|
+
if (r.computed) return ["[", n("key"), "]"];
|
|
2650
|
+
let { parent: u } = e, { key: a } = r;
|
|
2651
|
+
if (t.quoteProps === "consistent" && !Qt.has(u)) {
|
|
2652
|
+
let s = e.siblings.some((o) => !o.computed && Q(o.key) && !zr(o, t));
|
|
2653
|
+
Qt.set(u, s);
|
|
2654
|
+
}
|
|
2655
|
+
if (sc(e, t)) {
|
|
2656
|
+
let s = yt(JSON.stringify(a.type === "Identifier" ? a.name : a.value.toString()), t);
|
|
2657
|
+
return e.call(() => Fe(e, s, t), "key");
|
|
2658
|
+
}
|
|
2659
|
+
return zr(r, t) && (t.quoteProps === "as-needed" || t.quoteProps === "consistent" && !Qt.get(u)) ? e.call(() => Fe(e, /^\d/u.test(a.value) ? mt(a.value) : a.value, t), "key") : n("key");
|
|
2660
|
+
}
|
|
2661
|
+
function Sn(e, t, n) {
|
|
2662
|
+
let { node: r } = e;
|
|
2663
|
+
return r.shorthand ? n("value") : Rt(e, t, n, _t(e, t, n), ":", "value");
|
|
2664
|
+
}
|
|
2665
|
+
var oc = ({ node: e, key: t, parent: n }) => t === "value" && e.type === "FunctionExpression" && (n.type === "ObjectMethod" || n.type === "ClassMethod" || n.type === "ClassPrivateMethod" || n.type === "MethodDefinition" || n.type === "TSAbstractMethodDefinition" || n.type === "TSDeclareMethod" || n.type === "Property" && Jt(n));
|
|
2666
|
+
function Ta(e, t, n, r) {
|
|
2667
|
+
if (oc(e)) return Fr(e, t, n);
|
|
2668
|
+
let { node: u } = e, a = !1;
|
|
2669
|
+
if ((u.type === "FunctionDeclaration" || u.type === "FunctionExpression") && (r != null && r.expandLastArg)) {
|
|
2670
|
+
let { parent: y } = e;
|
|
2671
|
+
O(y) && (ye(y).length > 1 || ne(u).every((d) => d.type === "Identifier" && !d.typeAnnotation)) && (a = !0);
|
|
2672
|
+
}
|
|
2673
|
+
let s = [De(e), u.async ? "async " : "", `function${u.generator ? "*" : ""} `, u.id ? n("id") : ""], o = st(e, t, n, a), p = yn(e, n), l = gt(u, p);
|
|
2674
|
+
return s.push(n("typeParameters"), D([l ? D(o) : o, p]), u.body ? " " : "", n("body")), t.semi && (u.declare || !u.body) && s.push(";"), s;
|
|
2675
|
+
}
|
|
2676
|
+
function _n(e, t, n) {
|
|
2677
|
+
let { node: r } = e, { kind: u } = r, a = r.value || r, s = [];
|
|
2678
|
+
return !u || u === "init" || u === "method" || u === "constructor" ? a.async && s.push("async ") : s.push(u, " "), a.generator && s.push("*"), s.push(_t(e, t, n), r.optional ? "?" : "", r === a ? Fr(e, t, n) : n("value")), s;
|
|
2679
|
+
}
|
|
2680
|
+
function Fr(e, t, n) {
|
|
2681
|
+
let { node: r } = e, u = st(e, t, n), a = yn(e, n), s = Fl(r), o = gt(r, a), p = [n("typeParameters"), D([s ? D(u, { shouldBreak: !0 }) : o ? D(u) : u, a])];
|
|
2682
|
+
return r.body ? p.push(" ", n("body")) : p.push(t.semi ? ";" : ""), p;
|
|
2683
|
+
}
|
|
2684
|
+
function ic(e) {
|
|
2685
|
+
let t = ne(e);
|
|
2686
|
+
return t.length === 1 && !e.typeParameters && !x(e, B.Dangling) && t[0].type === "Identifier" && !t[0].typeAnnotation && !x(t[0]) && !t[0].optional && !e.predicate && !e.returnType;
|
|
2687
|
+
}
|
|
2688
|
+
function Sa(e, t) {
|
|
2689
|
+
if (t.arrowParens === "always") return !1;
|
|
2690
|
+
if (t.arrowParens === "avoid") {
|
|
2691
|
+
let { node: n } = e;
|
|
2692
|
+
return ic(n);
|
|
2693
|
+
}
|
|
2694
|
+
return !1;
|
|
2695
|
+
}
|
|
2696
|
+
function yn(e, t) {
|
|
2697
|
+
let { node: n } = e, r = [Z(e, t, "returnType")];
|
|
2698
|
+
return n.predicate && r.push(t("predicate")), r;
|
|
2699
|
+
}
|
|
2700
|
+
function ba(e, t, n) {
|
|
2701
|
+
let { node: r } = e, u = [];
|
|
2702
|
+
if (r.argument) {
|
|
2703
|
+
let o = n("argument");
|
|
2704
|
+
cc(t, r.argument) ? o = ["(", A([g, o]), g, ")"] : (Me(r.argument) || t.experimentalTernaries && r.argument.type === "ConditionalExpression" && (r.argument.consequent.type === "ConditionalExpression" || r.argument.alternate.type === "ConditionalExpression")) && (o = D([k("("), A([F, o]), F, k(")")])), u.push(" ", o);
|
|
2705
|
+
}
|
|
2706
|
+
let a = x(r, B.Dangling), s = t.semi && a && x(r, B.Last | B.Line);
|
|
2707
|
+
return s && u.push(";"), a && u.push(" ", R(e, t)), !s && t.semi && u.push(";"), u;
|
|
2708
|
+
}
|
|
2709
|
+
function pc(e, t, n) {
|
|
2710
|
+
return ["return", ba(e, t, n)];
|
|
2711
|
+
}
|
|
2712
|
+
function lc(e, t, n) {
|
|
2713
|
+
return ["throw", ba(e, t, n)];
|
|
2714
|
+
}
|
|
2715
|
+
function cc(e, t) {
|
|
2716
|
+
if (Ce(e.originalText, t) || x(t, B.Leading, (n) => ce(e.originalText, M(n), j(n))) && !Y(t)) return !0;
|
|
2717
|
+
if (er(t)) {
|
|
2718
|
+
let n = t, r;
|
|
2719
|
+
for (; r = Co(n); ) if (n = r, Ce(e.originalText, n)) return !0;
|
|
2720
|
+
}
|
|
2721
|
+
return !1;
|
|
2722
|
+
}
|
|
2723
|
+
function Dc(e, t) {
|
|
2724
|
+
if (t.semi || va(e, t) || ka(e, t) || Pa(e, t)) return !1;
|
|
2725
|
+
let { node: n, key: r, parent: u } = e;
|
|
2726
|
+
return !!(n.type === "ExpressionStatement" && (r === "body" && (u.type === "Program" || u.type === "BlockStatement" || u.type === "StaticBlock" || u.type === "TSModuleBlock") || r === "consequent" && u.type === "SwitchCase") && e.call(() => Ba(e, t), "expression"));
|
|
2727
|
+
}
|
|
2728
|
+
function Ba(e, t) {
|
|
2729
|
+
let { node: n } = e;
|
|
2730
|
+
switch (n.type) {
|
|
2731
|
+
case "ParenthesizedExpression":
|
|
2732
|
+
case "TypeCastExpression":
|
|
2733
|
+
case "ArrayExpression":
|
|
2734
|
+
case "ArrayPattern":
|
|
2735
|
+
case "TemplateLiteral":
|
|
2736
|
+
case "TemplateElement":
|
|
2737
|
+
case "RegExpLiteral":
|
|
2738
|
+
return !0;
|
|
2739
|
+
case "ArrowFunctionExpression":
|
|
2740
|
+
if (!Sa(e, t)) return !0;
|
|
2741
|
+
break;
|
|
2742
|
+
case "UnaryExpression": {
|
|
2743
|
+
let { prefix: r, operator: u } = n;
|
|
2744
|
+
if (r && (u === "+" || u === "-")) return !0;
|
|
2745
|
+
break;
|
|
2746
|
+
}
|
|
2747
|
+
case "BindExpression":
|
|
2748
|
+
if (!n.object) return !0;
|
|
2749
|
+
break;
|
|
2750
|
+
case "Literal":
|
|
2751
|
+
if (n.regex) return !0;
|
|
2752
|
+
break;
|
|
2753
|
+
default:
|
|
2754
|
+
if (Y(n)) return !0;
|
|
2755
|
+
}
|
|
2756
|
+
return Ke(e, t) ? !0 : er(n) ? e.call(() => Ba(e, t), ...Au(n)) : !1;
|
|
2757
|
+
}
|
|
2758
|
+
var Er = ({ node: e, parent: t }) => e.type === "ExpressionStatement" && t.type === "Program" && t.body.length === 1 && (Array.isArray(t.directives) && t.directives.length === 0 || !t.directives);
|
|
2759
|
+
function va(e, t) {
|
|
2760
|
+
return (t.parentParser === "markdown" || t.parentParser === "mdx") && Er(e) && Y(e.node.expression);
|
|
2761
|
+
}
|
|
2762
|
+
function Pa(e, t) {
|
|
2763
|
+
return t.__isHtmlInlineEventHandler && Er(e);
|
|
2764
|
+
}
|
|
2765
|
+
function ka(e, t) {
|
|
2766
|
+
return (t.parser === "__vue_event_binding" || t.parser === "__vue_ts_event_binding") && Er(e);
|
|
2767
|
+
}
|
|
2768
|
+
var yc = class extends Error {
|
|
2769
|
+
constructor(t, n, r = "type") {
|
|
2770
|
+
super(`Unexpected ${n} node ${r}: ${JSON.stringify(t[r])}.`);
|
|
2771
|
+
Gt(this, "name", "UnexpectedNodeError");
|
|
2772
|
+
this.node = t;
|
|
2773
|
+
}
|
|
2774
|
+
}, Ct = yc;
|
|
2775
|
+
function dc(e) {
|
|
2776
|
+
if (typeof e != "string") throw new TypeError("Expected a string");
|
|
2777
|
+
return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
2778
|
+
}
|
|
2779
|
+
var me, an, wa, iu, fc = (iu = class {
|
|
2780
|
+
constructor(e) {
|
|
2781
|
+
Fn(this, an);
|
|
2782
|
+
Fn(this, me);
|
|
2783
|
+
kr(this, me, new Set(e));
|
|
2784
|
+
}
|
|
2785
|
+
getLeadingWhitespaceCount(e) {
|
|
2786
|
+
let t = Ne(this, me), n = 0;
|
|
2787
|
+
for (let r = 0; r < e.length && t.has(e.charAt(r)); r++) n++;
|
|
2788
|
+
return n;
|
|
2789
|
+
}
|
|
2790
|
+
getTrailingWhitespaceCount(e) {
|
|
2791
|
+
let t = Ne(this, me), n = 0;
|
|
2792
|
+
for (let r = e.length - 1; r >= 0 && t.has(e.charAt(r)); r--) n++;
|
|
2793
|
+
return n;
|
|
2794
|
+
}
|
|
2795
|
+
getLeadingWhitespace(e) {
|
|
2796
|
+
let t = this.getLeadingWhitespaceCount(e);
|
|
2797
|
+
return e.slice(0, t);
|
|
2798
|
+
}
|
|
2799
|
+
getTrailingWhitespace(e) {
|
|
2800
|
+
let t = this.getTrailingWhitespaceCount(e);
|
|
2801
|
+
return e.slice(e.length - t);
|
|
2802
|
+
}
|
|
2803
|
+
hasLeadingWhitespace(e) {
|
|
2804
|
+
return Ne(this, me).has(e.charAt(0));
|
|
2805
|
+
}
|
|
2806
|
+
hasTrailingWhitespace(e) {
|
|
2807
|
+
return Ne(this, me).has(J(0, e, -1));
|
|
2808
|
+
}
|
|
2809
|
+
trimStart(e) {
|
|
2810
|
+
let t = this.getLeadingWhitespaceCount(e);
|
|
2811
|
+
return e.slice(t);
|
|
2812
|
+
}
|
|
2813
|
+
trimEnd(e) {
|
|
2814
|
+
let t = this.getTrailingWhitespaceCount(e);
|
|
2815
|
+
return e.slice(0, e.length - t);
|
|
2816
|
+
}
|
|
2817
|
+
trim(e) {
|
|
2818
|
+
return this.trimEnd(this.trimStart(e));
|
|
2819
|
+
}
|
|
2820
|
+
split(e, t = !1) {
|
|
2821
|
+
let n = `[${dc([...Ne(this, me)].join(""))}]+`, r = new RegExp(t ? `(${n})` : n, "u");
|
|
2822
|
+
return e.split(r);
|
|
2823
|
+
}
|
|
2824
|
+
hasWhitespaceCharacter(e) {
|
|
2825
|
+
let t = Ne(this, me);
|
|
2826
|
+
return Array.prototype.some.call(e, (n) => t.has(n));
|
|
2827
|
+
}
|
|
2828
|
+
hasNonWhitespaceCharacter(e) {
|
|
2829
|
+
let t = Ne(this, me);
|
|
2830
|
+
return Array.prototype.some.call(e, (n) => !t.has(n));
|
|
2831
|
+
}
|
|
2832
|
+
isWhitespaceOnly(e) {
|
|
2833
|
+
let t = Ne(this, me);
|
|
2834
|
+
return Array.prototype.every.call(e, (n) => t.has(n));
|
|
2835
|
+
}
|
|
2836
|
+
dedentString(e) {
|
|
2837
|
+
let t = wr(this, an, wa).call(this, e);
|
|
2838
|
+
return t === 0 ? e : e.split(`
|
|
2839
|
+
`).map((n) => n.slice(t)).join(`
|
|
2840
|
+
`);
|
|
2841
|
+
}
|
|
2842
|
+
}, me = new WeakMap(), an = new WeakSet(), wa = function(e) {
|
|
2843
|
+
let t = Number.POSITIVE_INFINITY;
|
|
2844
|
+
for (let n of e.split(`
|
|
2845
|
+
`)) {
|
|
2846
|
+
if (n.length === 0) continue;
|
|
2847
|
+
let r = this.getLeadingWhitespaceCount(n);
|
|
2848
|
+
if (r === 0) return 0;
|
|
2849
|
+
n.length !== r && r < t && (t = r);
|
|
2850
|
+
}
|
|
2851
|
+
return t === Number.POSITIVE_INFINITY ? 0 : t;
|
|
2852
|
+
}, iu), mc = fc, Zt = new mc(`
|
|
2853
|
+
\r `), bn = (e) => e === "" || e === T || e === g || e === F;
|
|
2854
|
+
function Fc(e, t, n) {
|
|
2855
|
+
var N, b, w, q, K;
|
|
2856
|
+
let { node: r } = e;
|
|
2857
|
+
if (r.type === "JSXElement" && Nc(r)) return [n("openingElement"), n("closingElement")];
|
|
2858
|
+
let u = r.type === "JSXElement" ? n("openingElement") : n("openingFragment"), a = r.type === "JSXElement" ? n("closingElement") : n("closingFragment");
|
|
2859
|
+
if (r.children.length === 1 && r.children[0].type === "JSXExpressionContainer" && (r.children[0].expression.type === "TemplateLiteral" || r.children[0].expression.type === "TaggedTemplateExpression")) return [u, ...e.map(n, "children"), a];
|
|
2860
|
+
r.children = r.children.map((v) => jc(v) ? { type: "JSXText", value: " ", raw: " " } : v);
|
|
2861
|
+
let s = r.children.some(Y), o = r.children.filter((v) => v.type === "JSXExpressionContainer").length > 1, p = r.type === "JSXElement" && r.openingElement.attributes.length > 1, l = ue(u) || s || p || o, y = e.parent.rootMarker === "mdx", d = t.singleQuote ? "{' '}" : '{" "}', f = y ? T : k([d, F], " "), m = ((b = (N = r.openingElement) == null ? void 0 : N.name) == null ? void 0 : b.name) === "fbt", c = Ec(e, t, n, f, m), E = r.children.some((v) => Lt(v));
|
|
2862
|
+
for (let v = c.length - 2; v >= 0; v--) {
|
|
2863
|
+
let X = c[v] === "" && c[v + 1] === "", U = c[v] === g && c[v + 1] === "" && c[v + 2] === g, te = (c[v] === F || c[v] === g) && c[v + 1] === "" && c[v + 2] === f, de = c[v] === f && c[v + 1] === "" && (c[v + 2] === F || c[v + 2] === g), P = c[v] === f && c[v + 1] === "" && c[v + 2] === f, G = c[v] === F && c[v + 1] === "" && c[v + 2] === g || c[v] === g && c[v + 1] === "" && c[v + 2] === F;
|
|
2864
|
+
U && E || X || te || P || G ? c.splice(v, 2) : de && c.splice(v + 1, 2);
|
|
2865
|
+
}
|
|
2866
|
+
for (; c.length > 0 && bn(J(0, c, -1)); ) c.pop();
|
|
2867
|
+
for (; c.length > 1 && bn(c[0]) && bn(c[1]); ) c.shift(), c.shift();
|
|
2868
|
+
let S = [""];
|
|
2869
|
+
for (let [v, X] of c.entries()) {
|
|
2870
|
+
if (X === f) {
|
|
2871
|
+
if (v === 1 && $i(c[v - 1])) {
|
|
2872
|
+
if (c.length === 2) {
|
|
2873
|
+
S.push([S.pop(), d]);
|
|
2874
|
+
continue;
|
|
2875
|
+
}
|
|
2876
|
+
S.push([d, g], "");
|
|
2877
|
+
continue;
|
|
2878
|
+
} else if (v === c.length - 1) {
|
|
2879
|
+
S.push([S.pop(), d]);
|
|
2880
|
+
continue;
|
|
2881
|
+
} else if (c[v - 1] === "" && c[v - 2] === g) {
|
|
2882
|
+
S.push([S.pop(), d]);
|
|
2883
|
+
continue;
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
v % 2 === 0 ? S.push([S.pop(), X]) : S.push(X, ""), ue(X) && (l = !0);
|
|
2887
|
+
}
|
|
2888
|
+
let h = E ? Gu(S) : D(S, { shouldBreak: !0 });
|
|
2889
|
+
if (((w = t.cursorNode) == null ? void 0 : w.type) === "JSXText" && r.children.includes(t.cursorNode) ? h = [Kt, h, Kt] : ((q = t.nodeBeforeCursor) == null ? void 0 : q.type) === "JSXText" && r.children.includes(t.nodeBeforeCursor) ? h = [Kt, h] : ((K = t.nodeAfterCursor) == null ? void 0 : K.type) === "JSXText" && r.children.includes(t.nodeAfterCursor) && (h = [h, Kt]), y) return h;
|
|
2890
|
+
let C = D([u, A([g, h]), g, a]);
|
|
2891
|
+
return l ? C : ze([D([u, ...c, a]), C]);
|
|
2892
|
+
}
|
|
2893
|
+
function Ec(e, t, n, r, u) {
|
|
2894
|
+
let a = "", s = [a];
|
|
2895
|
+
function o(l) {
|
|
2896
|
+
a = l, s.push([s.pop(), l]);
|
|
2897
|
+
}
|
|
2898
|
+
function p(l) {
|
|
2899
|
+
l !== "" && (a = l, s.push(l, ""));
|
|
2900
|
+
}
|
|
2901
|
+
return e.each(({ node: l, next: y }) => {
|
|
2902
|
+
if (l.type === "JSXText") {
|
|
2903
|
+
let d = ie(l);
|
|
2904
|
+
if (Lt(l)) {
|
|
2905
|
+
let f = Zt.split(d, !0);
|
|
2906
|
+
f[0] === "" && (f.shift(), /\n/u.test(f[0]) ? p(Qr(u, f[1], l, y)) : p(r), f.shift());
|
|
2907
|
+
let m;
|
|
2908
|
+
if (J(0, f, -1) === "" && (f.pop(), m = f.pop()), f.length === 0) return;
|
|
2909
|
+
for (let [c, E] of f.entries()) c % 2 === 1 ? p(T) : o(E);
|
|
2910
|
+
m !== void 0 ? /\n/u.test(m) ? p(Qr(u, a, l, y)) : p(r) : p(Yr(u, a, l, y));
|
|
2911
|
+
} else /\n/u.test(d) ? d.match(/\n/gu).length > 1 && p(g) : p(r);
|
|
2912
|
+
} else {
|
|
2913
|
+
let d = n();
|
|
2914
|
+
if (o(d), y && Lt(y)) {
|
|
2915
|
+
let f = Zt.trim(ie(y)), [m] = Zt.split(f);
|
|
2916
|
+
p(Yr(u, m, l, y));
|
|
2917
|
+
} else p(g);
|
|
2918
|
+
}
|
|
2919
|
+
}, "children"), s;
|
|
2920
|
+
}
|
|
2921
|
+
function Yr(e, t, n, r) {
|
|
2922
|
+
return e ? "" : n.type === "JSXElement" && !n.closingElement || (r == null ? void 0 : r.type) === "JSXElement" && !r.closingElement ? t.length === 1 ? F : g : F;
|
|
2923
|
+
}
|
|
2924
|
+
function Qr(e, t, n, r) {
|
|
2925
|
+
return e ? g : t.length === 1 ? n.type === "JSXElement" && !n.closingElement || (r == null ? void 0 : r.type) === "JSXElement" && !r.closingElement ? g : F : g;
|
|
2926
|
+
}
|
|
2927
|
+
var Ac = I(["ArrayExpression", "JSXAttribute", "JSXElement", "JSXExpressionContainer", "JSXFragment", "ExpressionStatement", "NewExpression", "CallExpression", "OptionalCallExpression", "ConditionalExpression", "JsExpressionRoot", "MatchExpressionCase"]);
|
|
2928
|
+
function gc(e, t, n) {
|
|
2929
|
+
let { parent: r } = e;
|
|
2930
|
+
if (Ac(r)) return t;
|
|
2931
|
+
let u = Cc(e), a = Ke(e, n);
|
|
2932
|
+
return D([a ? "" : k("("), A([F, t]), F, a ? "" : k(")")], { shouldBreak: u });
|
|
2933
|
+
}
|
|
2934
|
+
function Cc(e) {
|
|
2935
|
+
return e.match(void 0, (t, n) => n === "body" && t.type === "ArrowFunctionExpression", (t, n) => n === "arguments" && O(t)) && (e.match(void 0, void 0, void 0, (t, n) => n === "expression" && t.type === "JSXExpressionContainer") || e.match(void 0, void 0, void 0, (t, n) => n === "expression" && t.type === "ChainExpression", (t, n) => n === "expression" && t.type === "JSXExpressionContainer"));
|
|
2936
|
+
}
|
|
2937
|
+
function hc(e, t, n) {
|
|
2938
|
+
let { node: r } = e, u = [n("name")];
|
|
2939
|
+
if (r.value) {
|
|
2940
|
+
let a;
|
|
2941
|
+
if (Q(r.value)) {
|
|
2942
|
+
let s = ie(r.value), o = z(0, z(0, s.slice(1, -1), "'", "'"), """, '"'), p = yu(o, t.jsxSingleQuote);
|
|
2943
|
+
o = p === '"' ? z(0, o, '"', """) : z(0, o, "'", "'"), a = e.call(() => Fe(e, Qe(p + o + p), t), "value");
|
|
2944
|
+
} else a = n("value");
|
|
2945
|
+
u.push("=", a);
|
|
2946
|
+
}
|
|
2947
|
+
return u;
|
|
2948
|
+
}
|
|
2949
|
+
function xc(e, t, n) {
|
|
2950
|
+
let { node: r } = e, u = (a, s) => a.type === "JSXEmptyExpression" || !x(a) && (ee(a) || he(a) || a.type === "ArrowFunctionExpression" || a.type === "AwaitExpression" && (u(a.argument, a) || a.argument.type === "JSXElement") || O(a) || a.type === "ChainExpression" && O(a.expression) || a.type === "FunctionExpression" || a.type === "TemplateLiteral" || a.type === "TaggedTemplateExpression" || a.type === "DoExpression" || Y(s) && (a.type === "ConditionalExpression" || Me(a)));
|
|
2951
|
+
return u(r.expression, e.parent) ? D(["{", n("expression"), ke, "}"]) : D(["{", A([F, n("expression")]), F, ke, "}"]);
|
|
2952
|
+
}
|
|
2953
|
+
function Tc(e, t, n) {
|
|
2954
|
+
var o, p;
|
|
2955
|
+
let { node: r } = e, u = x(r.name) || x(r.typeArguments);
|
|
2956
|
+
if (r.selfClosing && r.attributes.length === 0 && !u) return ["<", n("name"), n("typeArguments"), " />"];
|
|
2957
|
+
if (((o = r.attributes) == null ? void 0 : o.length) === 1 && Q(r.attributes[0].value) && !r.attributes[0].value.value.includes(`
|
|
2958
|
+
`) && !u && !x(r.attributes[0])) return D(["<", n("name"), n("typeArguments"), " ", ...e.map(n, "attributes"), r.selfClosing ? " />" : ">"]);
|
|
2959
|
+
let a = (p = r.attributes) == null ? void 0 : p.some((l) => Q(l.value) && l.value.value.includes(`
|
|
2960
|
+
`)), s = t.singleAttributePerLine && r.attributes.length > 1 ? g : T;
|
|
2961
|
+
return D(["<", n("name"), n("typeArguments"), A(e.map(() => [s, n()], "attributes")), ...Sc(r, t, u)], { shouldBreak: a });
|
|
2962
|
+
}
|
|
2963
|
+
function Sc(e, t, n) {
|
|
2964
|
+
return e.selfClosing ? [T, "/>"] : bc(e, t, n) ? [">"] : [F, ">"];
|
|
2965
|
+
}
|
|
2966
|
+
function bc(e, t, n) {
|
|
2967
|
+
let r = e.attributes.length > 0 && x(J(0, e.attributes, -1), B.Trailing);
|
|
2968
|
+
return e.attributes.length === 0 && !n || (t.bracketSameLine || t.jsxBracketSameLine) && (!n || e.attributes.length > 0) && !r;
|
|
2969
|
+
}
|
|
2970
|
+
function Bc(e, t, n) {
|
|
2971
|
+
let { node: r } = e, u = ["</"], a = n("name");
|
|
2972
|
+
return x(r.name, B.Leading | B.Line) ? u.push(A([g, a]), g) : x(r.name, B.Leading | B.Block) ? u.push(" ", a) : u.push(a), u.push(">"), u;
|
|
2973
|
+
}
|
|
2974
|
+
function vc(e, t) {
|
|
2975
|
+
let { node: n } = e, r = x(n), u = x(n, B.Line), a = n.type === "JSXOpeningFragment";
|
|
2976
|
+
return [a ? "<" : "</", A([u ? g : r && !a ? " " : "", R(e, t)]), u ? g : "", ">"];
|
|
2977
|
+
}
|
|
2978
|
+
function Pc(e, t, n) {
|
|
2979
|
+
let r = Fe(e, Fc(e, t, n), t);
|
|
2980
|
+
return gc(e, r, t);
|
|
2981
|
+
}
|
|
2982
|
+
function kc(e, t) {
|
|
2983
|
+
let { node: n } = e, r = x(n, B.Line);
|
|
2984
|
+
return [R(e, t, { indent: r }), r ? g : ""];
|
|
2985
|
+
}
|
|
2986
|
+
function wc(e, t, n) {
|
|
2987
|
+
let { node: r } = e;
|
|
2988
|
+
return ["{", e.call(({ node: u }) => {
|
|
2989
|
+
let a = ["...", n()];
|
|
2990
|
+
return x(u) ? [A([F, Fe(e, a, t)]), F] : a;
|
|
2991
|
+
}, r.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"];
|
|
2992
|
+
}
|
|
2993
|
+
function Ic(e, t, n) {
|
|
2994
|
+
let { node: r } = e;
|
|
2995
|
+
if (r.type.startsWith("JSX")) switch (r.type) {
|
|
2996
|
+
case "JSXAttribute":
|
|
2997
|
+
return hc(e, t, n);
|
|
2998
|
+
case "JSXIdentifier":
|
|
2999
|
+
return r.name;
|
|
3000
|
+
case "JSXNamespacedName":
|
|
3001
|
+
return L(":", [n("namespace"), n("name")]);
|
|
3002
|
+
case "JSXMemberExpression":
|
|
3003
|
+
return L(".", [n("object"), n("property")]);
|
|
3004
|
+
case "JSXSpreadAttribute":
|
|
3005
|
+
case "JSXSpreadChild":
|
|
3006
|
+
return wc(e, t, n);
|
|
3007
|
+
case "JSXExpressionContainer":
|
|
3008
|
+
return xc(e, t, n);
|
|
3009
|
+
case "JSXFragment":
|
|
3010
|
+
case "JSXElement":
|
|
3011
|
+
return Pc(e, t, n);
|
|
3012
|
+
case "JSXOpeningElement":
|
|
3013
|
+
return Tc(e, t, n);
|
|
3014
|
+
case "JSXClosingElement":
|
|
3015
|
+
return Bc(e, t, n);
|
|
3016
|
+
case "JSXOpeningFragment":
|
|
3017
|
+
case "JSXClosingFragment":
|
|
3018
|
+
return vc(e, t);
|
|
3019
|
+
case "JSXEmptyExpression":
|
|
3020
|
+
return kc(e, t);
|
|
3021
|
+
case "JSXText":
|
|
3022
|
+
throw new Error("JSXText should be handled by JSXElement");
|
|
3023
|
+
default:
|
|
3024
|
+
throw new Ct(r, "JSX");
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
function Nc(e) {
|
|
3028
|
+
if (e.children.length === 0) return !0;
|
|
3029
|
+
if (e.children.length > 1) return !1;
|
|
3030
|
+
let t = e.children[0];
|
|
3031
|
+
return t.type === "JSXText" && !Lt(t);
|
|
3032
|
+
}
|
|
3033
|
+
function Lt(e) {
|
|
3034
|
+
return e.type === "JSXText" && (Zt.hasNonWhitespaceCharacter(ie(e)) || !/\n/u.test(ie(e)));
|
|
3035
|
+
}
|
|
3036
|
+
function jc(e) {
|
|
3037
|
+
return e.type === "JSXExpressionContainer" && Q(e.expression) && e.expression.value === " " && !x(e.expression);
|
|
3038
|
+
}
|
|
3039
|
+
function Mc(e) {
|
|
3040
|
+
let { node: t, parent: n } = e;
|
|
3041
|
+
if (!Y(t) || !Y(n)) return !1;
|
|
3042
|
+
let { index: r, siblings: u } = e, a;
|
|
3043
|
+
for (let s = r; s > 0; s--) {
|
|
3044
|
+
let o = u[s - 1];
|
|
3045
|
+
if (!(o.type === "JSXText" && !Lt(o))) {
|
|
3046
|
+
a = o;
|
|
3047
|
+
break;
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
return (a == null ? void 0 : a.type) === "JSXExpressionContainer" && a.expression.type === "JSXEmptyExpression" && pn(a.expression);
|
|
3051
|
+
}
|
|
3052
|
+
function Lc(e) {
|
|
3053
|
+
return pn(e.node) || Mc(e);
|
|
3054
|
+
}
|
|
3055
|
+
var Ar = Lc;
|
|
3056
|
+
function Oc(e, t, n) {
|
|
3057
|
+
let { node: r } = e;
|
|
3058
|
+
if (r.type.startsWith("NG")) switch (r.type) {
|
|
3059
|
+
case "NGRoot":
|
|
3060
|
+
return n("node");
|
|
3061
|
+
case "NGPipeExpression":
|
|
3062
|
+
return pa(e, t, n);
|
|
3063
|
+
case "NGChainedExpression":
|
|
3064
|
+
return D(L([";", T], e.map(() => Xc(e) ? n() : ["(", n(), ")"], "expressions")));
|
|
3065
|
+
case "NGEmptyExpression":
|
|
3066
|
+
return "";
|
|
3067
|
+
case "NGMicrosyntax":
|
|
3068
|
+
return e.map(() => [e.isFirst ? "" : Zr(e) ? " " : [";", T], n()], "body");
|
|
3069
|
+
case "NGMicrosyntaxKey":
|
|
3070
|
+
return /^[$_a-z][\w$]*(?:-[$_a-z][\w$])*$/iu.test(r.name) ? r.name : JSON.stringify(r.name);
|
|
3071
|
+
case "NGMicrosyntaxExpression":
|
|
3072
|
+
return [n("expression"), r.alias === null ? "" : [" as ", n("alias")]];
|
|
3073
|
+
case "NGMicrosyntaxKeyedExpression": {
|
|
3074
|
+
let { index: u, parent: a } = e, s = Zr(e) || Jc(e) || (u === 1 && (r.key.name === "then" || r.key.name === "else" || r.key.name === "as") || u === 2 && (r.key.name === "else" && a.body[u - 1].type === "NGMicrosyntaxKeyedExpression" && a.body[u - 1].key.name === "then" || r.key.name === "track")) && a.body[0].type === "NGMicrosyntaxExpression";
|
|
3075
|
+
return [n("key"), s ? " " : ": ", n("expression")];
|
|
3076
|
+
}
|
|
3077
|
+
case "NGMicrosyntaxLet":
|
|
3078
|
+
return ["let ", n("key"), r.value === null ? "" : [" = ", n("value")]];
|
|
3079
|
+
case "NGMicrosyntaxAs":
|
|
3080
|
+
return [n("key"), " as ", n("alias")];
|
|
3081
|
+
default:
|
|
3082
|
+
throw new Ct(r, "Angular");
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
function Zr({ node: e, index: t }) {
|
|
3086
|
+
return e.type === "NGMicrosyntaxKeyedExpression" && e.key.name === "of" && t === 1;
|
|
3087
|
+
}
|
|
3088
|
+
function Jc(e) {
|
|
3089
|
+
let { node: t } = e;
|
|
3090
|
+
return e.parent.body[1].key.name === "of" && t.type === "NGMicrosyntaxKeyedExpression" && t.key.name === "track" && t.key.type === "NGMicrosyntaxKey";
|
|
3091
|
+
}
|
|
3092
|
+
var qc = I(["CallExpression", "OptionalCallExpression", "AssignmentExpression"]);
|
|
3093
|
+
function Xc({ node: e }) {
|
|
3094
|
+
return wn(e, qc);
|
|
3095
|
+
}
|
|
3096
|
+
function Ia(e, t, n) {
|
|
3097
|
+
let { node: r } = e;
|
|
3098
|
+
return D([L(T, e.map(n, "decorators")), Na(r, t) ? g : T]);
|
|
3099
|
+
}
|
|
3100
|
+
function Rc(e, t, n) {
|
|
3101
|
+
return ja(e.node) ? [L(g, e.map(n, "declaration", "decorators")), g] : "";
|
|
3102
|
+
}
|
|
3103
|
+
function _c(e, t, n) {
|
|
3104
|
+
let { node: r, parent: u } = e, { decorators: a } = r;
|
|
3105
|
+
if (!W(a) || ja(u) || Ar(e)) return "";
|
|
3106
|
+
let s = r.type === "ClassExpression" || r.type === "ClassDeclaration" || Na(r, t);
|
|
3107
|
+
return [e.key === "declaration" && ho(u) ? g : s ? Oe : "", L(T, e.map(n, "decorators")), T];
|
|
3108
|
+
}
|
|
3109
|
+
function Na(e, t) {
|
|
3110
|
+
return e.decorators.some((n) => oe(t.originalText, j(n)));
|
|
3111
|
+
}
|
|
3112
|
+
function ja(e) {
|
|
3113
|
+
var n;
|
|
3114
|
+
if (e.type !== "ExportDefaultDeclaration" && e.type !== "ExportNamedDeclaration" && e.type !== "DeclareExportDeclaration") return !1;
|
|
3115
|
+
let t = (n = e.declaration) == null ? void 0 : n.decorators;
|
|
3116
|
+
return W(t) && sn(e, t[0]);
|
|
3117
|
+
}
|
|
3118
|
+
var Bn = /* @__PURE__ */ new WeakMap();
|
|
3119
|
+
function Ma(e) {
|
|
3120
|
+
return Bn.has(e) || Bn.set(e, e.type === "ConditionalExpression" && !re(e, (t) => t.type === "ObjectExpression")), Bn.get(e);
|
|
3121
|
+
}
|
|
3122
|
+
var Wc = (e) => e.type === "SequenceExpression";
|
|
3123
|
+
function Uc(e, t, n, r = {}) {
|
|
3124
|
+
let u = [], a, s = [], o = !1, p = !r.expandLastArg && e.node.body.type === "ArrowFunctionExpression", l;
|
|
3125
|
+
(function h() {
|
|
3126
|
+
let { node: C } = e, N = $c(e, t, n, r);
|
|
3127
|
+
if (u.length === 0) u.push(N);
|
|
3128
|
+
else {
|
|
3129
|
+
let { leading: b, trailing: w } = ln(e, t);
|
|
3130
|
+
u.push([b, N]), s.unshift(w);
|
|
3131
|
+
}
|
|
3132
|
+
p && (o || (o = C.returnType && ne(C).length > 0 || C.typeParameters || ne(C).some((b) => b.type !== "Identifier"))), !p || C.body.type !== "ArrowFunctionExpression" ? (a = n("body", r), l = C.body) : e.call(h, "body");
|
|
3133
|
+
})();
|
|
3134
|
+
let y = !Ce(t.originalText, l) && (Wc(l) || Gc(l, a, t) || !o && Ma(l)), d = e.key === "callee" && ft(e.parent), f = Symbol("arrow-chain"), m = Vc(e, r, { signatureDocs: u, shouldBreak: o }), c = !1, E = !1, S = !1;
|
|
3135
|
+
return p && (d || r.assignmentLayout) && (E = !0, S = !x(e.node, B.Leading & B.Line), c = r.assignmentLayout === "chain-tail-arrow-chain" || d && !y), a = Kc(e, t, r, { bodyDoc: a, bodyComments: s, functionBody: l, shouldPutBodyOnSameLine: y }), D([D(E ? A([S ? F : "", m]) : m, { shouldBreak: c, id: f }), " =>", p ? jt(a, { groupId: f }) : D(a), p && d ? k(F, "", { groupId: f }) : ""]);
|
|
3136
|
+
}
|
|
3137
|
+
function $c(e, t, n, r) {
|
|
3138
|
+
let { node: u } = e, a = [];
|
|
3139
|
+
if (u.async && a.push("async "), Sa(e, t)) a.push(n(["params", 0]));
|
|
3140
|
+
else {
|
|
3141
|
+
let o = r.expandLastArg || r.expandFirstArg, p = yn(e, n);
|
|
3142
|
+
if (o) {
|
|
3143
|
+
if (ue(p)) throw new rn();
|
|
3144
|
+
p = D(nn(p));
|
|
3145
|
+
}
|
|
3146
|
+
a.push(D([st(e, t, n, o, !0), p]));
|
|
3147
|
+
}
|
|
3148
|
+
let s = R(e, t, { filter(o) {
|
|
3149
|
+
let p = Ft(t.originalText, j(o));
|
|
3150
|
+
return p !== !1 && t.originalText.slice(p, p + 2) === "=>";
|
|
3151
|
+
} });
|
|
3152
|
+
return s && a.push(" ", s), a;
|
|
3153
|
+
}
|
|
3154
|
+
function Gc(e, t, n) {
|
|
3155
|
+
var r, u;
|
|
3156
|
+
return ee(e) || he(e) || e.type === "ArrowFunctionExpression" || e.type === "DoExpression" || e.type === "BlockStatement" || Y(e) || ((r = t.label) == null ? void 0 : r.hug) !== !1 && (((u = t.label) == null ? void 0 : u.embed) || Su(e, n.originalText));
|
|
3157
|
+
}
|
|
3158
|
+
function Vc(e, t, { signatureDocs: n, shouldBreak: r }) {
|
|
3159
|
+
if (n.length === 1) return n[0];
|
|
3160
|
+
let { parent: u, key: a } = e;
|
|
3161
|
+
return a !== "callee" && ft(u) || Me(u) ? D([n[0], " =>", A([T, L([" =>", T], n.slice(1))])], { shouldBreak: r }) : a === "callee" && ft(u) || t.assignmentLayout ? D(L([" =>", T], n), { shouldBreak: r }) : D(A(L([" =>", T], n)), { shouldBreak: r });
|
|
3162
|
+
}
|
|
3163
|
+
function Kc(e, t, n, { bodyDoc: r, bodyComments: u, functionBody: a, shouldPutBodyOnSameLine: s }) {
|
|
3164
|
+
let { node: o, parent: p } = e, l = n.expandLastArg && we(t, "all") ? k(",") : "", y = (n.expandLastArg || p.type === "JSXExpressionContainer") && !x(o) ? F : "";
|
|
3165
|
+
return s && Ma(a) ? [" ", D([k("", "("), A([F, r]), k("", ")"), l, y]), u] : s ? [" ", r, u] : [A([T, r, u]), l, y];
|
|
3166
|
+
}
|
|
3167
|
+
var Hc = Array.prototype.findLast ?? function(e) {
|
|
3168
|
+
for (let t = this.length - 1; t >= 0; t--) {
|
|
3169
|
+
let n = this[t];
|
|
3170
|
+
if (e(n, t, this)) return n;
|
|
3171
|
+
}
|
|
3172
|
+
}, zc = Vn("findLast", function() {
|
|
3173
|
+
if (Array.isArray(this)) return Hc;
|
|
3174
|
+
}), Yc = zc;
|
|
3175
|
+
function Wn(e, t, n, r) {
|
|
3176
|
+
let { node: u } = e, a = [], s = Yc(0, u[r], (o) => o.type !== "EmptyStatement");
|
|
3177
|
+
return e.each(({ node: o }) => {
|
|
3178
|
+
o.type !== "EmptyStatement" && (a.push(n()), o !== s && (a.push(g), Ie(o, t) && a.push(g)));
|
|
3179
|
+
}, r), a;
|
|
3180
|
+
}
|
|
3181
|
+
function La(e, t, n) {
|
|
3182
|
+
let r = Qc(e, t, n), { node: u, parent: a } = e;
|
|
3183
|
+
if (u.type === "Program" && (a == null ? void 0 : a.type) !== "ModuleExpression") return r ? [r, g] : "";
|
|
3184
|
+
let s = [];
|
|
3185
|
+
if (u.type === "StaticBlock" && s.push("static "), s.push("{"), r) s.push(A([g, r]), g);
|
|
3186
|
+
else {
|
|
3187
|
+
let o = e.grandparent;
|
|
3188
|
+
a.type === "ArrowFunctionExpression" || a.type === "FunctionExpression" || a.type === "FunctionDeclaration" || a.type === "ComponentDeclaration" || a.type === "HookDeclaration" || a.type === "ObjectMethod" || a.type === "ClassMethod" || a.type === "ClassPrivateMethod" || a.type === "ForStatement" || a.type === "WhileStatement" || a.type === "DoWhileStatement" || a.type === "DoExpression" || a.type === "ModuleExpression" || a.type === "CatchClause" && !o.finalizer || a.type === "TSModuleDeclaration" || a.type === "MatchStatementCase" || u.type === "StaticBlock" || s.push(g);
|
|
3189
|
+
}
|
|
3190
|
+
return s.push("}"), s;
|
|
3191
|
+
}
|
|
3192
|
+
function Qc(e, t, n) {
|
|
3193
|
+
let { node: r } = e, u = W(r.directives), a = r.body.some((p) => p.type !== "EmptyStatement"), s = x(r, B.Dangling);
|
|
3194
|
+
if (!u && !a && !s) return "";
|
|
3195
|
+
let o = [];
|
|
3196
|
+
return u && (o.push(Wn(e, t, n, "directives")), (a || s) && (o.push(g), Ie(J(0, r.directives, -1), t) && o.push(g))), a && o.push(Wn(e, t, n, "body")), s && o.push(R(e, t)), o;
|
|
3197
|
+
}
|
|
3198
|
+
function Zc(e) {
|
|
3199
|
+
let t = /* @__PURE__ */ new WeakMap();
|
|
3200
|
+
return function(n) {
|
|
3201
|
+
return t.has(n) || t.set(n, Symbol(e)), t.get(n);
|
|
3202
|
+
};
|
|
3203
|
+
}
|
|
3204
|
+
var eD = Zc;
|
|
3205
|
+
function gr(e, t, n) {
|
|
3206
|
+
let { node: r } = e, u = [], a = r.type === "ObjectTypeAnnotation", s = !Oa(e), o = s ? T : g, p = x(r, B.Dangling), [l, y] = a && r.exact ? ["{|", "|}"] : "{}", d;
|
|
3207
|
+
if (tD(e, ({ node: f, next: m, isLast: c }) => {
|
|
3208
|
+
if (d ?? (d = f), u.push(n()), s && a) {
|
|
3209
|
+
let { parent: E } = e;
|
|
3210
|
+
E.inexact || !c ? u.push(",") : we(t) && u.push(k(","));
|
|
3211
|
+
}
|
|
3212
|
+
!s && (nD({ node: f, next: m }, t) || qa({ node: f, next: m }, t)) && u.push(";"), c || (u.push(o), Ie(f, t) && u.push(g));
|
|
3213
|
+
}), p && u.push(R(e, t)), r.type === "ObjectTypeAnnotation" && r.inexact) {
|
|
3214
|
+
let f;
|
|
3215
|
+
x(r, B.Dangling) ? f = [x(r, B.Line) || oe(t.originalText, j(J(0, Ye(r), -1))) ? g : T, "..."] : f = [d ? T : "", "..."], u.push(f);
|
|
3216
|
+
}
|
|
3217
|
+
if (s) {
|
|
3218
|
+
let f = p || t.objectWrap === "preserve" && d && ce(t.originalText, M(r), M(d)), m;
|
|
3219
|
+
if (u.length === 0) m = l + y;
|
|
3220
|
+
else {
|
|
3221
|
+
let c = t.bracketSpacing ? T : F;
|
|
3222
|
+
m = [l, A([c, ...u]), c, y];
|
|
3223
|
+
}
|
|
3224
|
+
return e.match(void 0, (c, E) => E === "typeAnnotation", (c, E) => E === "typeAnnotation", Pt) || e.match(void 0, (c, E) => c.type === "FunctionTypeParam" && E === "typeAnnotation", Pt) ? m : D(m, { shouldBreak: f });
|
|
3225
|
+
}
|
|
3226
|
+
return [l, u.length > 0 ? [A([g, u]), g] : "", y];
|
|
3227
|
+
}
|
|
3228
|
+
function Oa(e) {
|
|
3229
|
+
let { node: t } = e;
|
|
3230
|
+
if (t.type === "ObjectTypeAnnotation") {
|
|
3231
|
+
let { key: n, parent: r } = e;
|
|
3232
|
+
return n === "body" && (r.type === "InterfaceDeclaration" || r.type === "DeclareInterface" || r.type === "DeclareClass");
|
|
3233
|
+
}
|
|
3234
|
+
return t.type === "ClassBody" || t.type === "TSInterfaceBody";
|
|
3235
|
+
}
|
|
3236
|
+
function tD(e, t) {
|
|
3237
|
+
let { node: n } = e;
|
|
3238
|
+
if (n.type === "ClassBody" || n.type === "TSInterfaceBody") {
|
|
3239
|
+
e.each(t, "body");
|
|
3240
|
+
return;
|
|
3241
|
+
}
|
|
3242
|
+
if (n.type === "TSTypeLiteral") {
|
|
3243
|
+
e.each(t, "members");
|
|
3244
|
+
return;
|
|
3245
|
+
}
|
|
3246
|
+
if (n.type === "ObjectTypeAnnotation") {
|
|
3247
|
+
let r = ["properties", "indexers", "callProperties", "internalSlots"].flatMap((u) => e.map(({ node: a, index: s }) => ({ node: a, loc: M(a), selector: [u, s] }), u)).sort((u, a) => u.loc - a.loc);
|
|
3248
|
+
for (let [u, { node: a, selector: s }] of r.entries()) e.call(() => {
|
|
3249
|
+
var o;
|
|
3250
|
+
return t({ node: a, next: (o = r[u + 1]) == null ? void 0 : o.node, isLast: u === r.length - 1 });
|
|
3251
|
+
}, ...s);
|
|
3252
|
+
}
|
|
3253
|
+
}
|
|
3254
|
+
function je(e, t) {
|
|
3255
|
+
let { parent: n } = e;
|
|
3256
|
+
return e.callParent(Oa) ? t.semi || n.type === "ObjectTypeAnnotation" ? ";" : "" : n.type === "TSTypeLiteral" ? e.isLast ? t.semi ? k(";") : "" : t.semi || qa({ node: e.node, next: e.next }, t) ? ";" : k("", ";") : "";
|
|
3257
|
+
}
|
|
3258
|
+
var eu = I(["ClassProperty", "PropertyDefinition", "ClassPrivateProperty", "ClassAccessorProperty", "AccessorProperty", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]), Ja = (e) => {
|
|
3259
|
+
if (e.computed || e.typeAnnotation) return !1;
|
|
3260
|
+
let { type: t, name: n } = e.key;
|
|
3261
|
+
return t === "Identifier" && (n === "static" || n === "get" || n === "set");
|
|
3262
|
+
};
|
|
3263
|
+
function nD({ node: e, next: t }, n) {
|
|
3264
|
+
var r;
|
|
3265
|
+
if (n.semi || !eu(e)) return !1;
|
|
3266
|
+
if (!e.value && Ja(e)) return !0;
|
|
3267
|
+
if (!t || t.static || t.accessibility || t.readonly) return !1;
|
|
3268
|
+
if (!t.computed) {
|
|
3269
|
+
let u = (r = t.key) == null ? void 0 : r.name;
|
|
3270
|
+
if (u === "in" || u === "instanceof") return !0;
|
|
3271
|
+
}
|
|
3272
|
+
if (eu(t) && t.variance && !t.static && !t.declare) return !0;
|
|
3273
|
+
switch (t.type) {
|
|
3274
|
+
case "ClassProperty":
|
|
3275
|
+
case "PropertyDefinition":
|
|
3276
|
+
case "TSAbstractPropertyDefinition":
|
|
3277
|
+
return t.computed;
|
|
3278
|
+
case "MethodDefinition":
|
|
3279
|
+
case "TSAbstractMethodDefinition":
|
|
3280
|
+
case "ClassMethod":
|
|
3281
|
+
case "ClassPrivateMethod": {
|
|
3282
|
+
if ((t.value ? t.value.async : t.async) || t.kind === "get" || t.kind === "set") return !1;
|
|
3283
|
+
let u = t.value ? t.value.generator : t.generator;
|
|
3284
|
+
return !!(t.computed || u);
|
|
3285
|
+
}
|
|
3286
|
+
case "TSIndexSignature":
|
|
3287
|
+
return !0;
|
|
3288
|
+
}
|
|
3289
|
+
return !1;
|
|
3290
|
+
}
|
|
3291
|
+
var rD = I(["TSPropertySignature"]);
|
|
3292
|
+
function qa({ node: e, next: t }, n) {
|
|
3293
|
+
if (n.semi || !rD(e)) return !1;
|
|
3294
|
+
if (Ja(e)) return !0;
|
|
3295
|
+
if (!t) return !1;
|
|
3296
|
+
switch (t.type) {
|
|
3297
|
+
case "TSCallSignatureDeclaration":
|
|
3298
|
+
return !0;
|
|
3299
|
+
}
|
|
3300
|
+
return !1;
|
|
3301
|
+
}
|
|
3302
|
+
var uD = eD("heritageGroup"), aD = I(["TSInterfaceDeclaration", "DeclareInterface", "InterfaceDeclaration", "InterfaceTypeAnnotation"]);
|
|
3303
|
+
function Cr(e, t, n) {
|
|
3304
|
+
let { node: r } = e, u = aD(r), a = [De(e), cn(e), u ? "interface" : "class"], s = Ra(e), o = [], p = [];
|
|
3305
|
+
if (r.type !== "InterfaceTypeAnnotation") {
|
|
3306
|
+
r.id && o.push(" ");
|
|
3307
|
+
for (let y of ["id", "typeParameters"]) if (r[y]) {
|
|
3308
|
+
let { leading: d, trailing: f } = e.call(() => ln(e, t), y);
|
|
3309
|
+
o.push(d, n(y), A(f));
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
if (r.superClass) {
|
|
3313
|
+
let y = [iD(e, t, n), n(r.superTypeArguments ? "superTypeArguments" : "superTypeParameters")], d = e.call(() => ["extends ", Fe(e, y, t)], "superClass");
|
|
3314
|
+
s ? p.push(T, D(d)) : p.push(" ", d);
|
|
3315
|
+
} else p.push(Pn(e, t, n, "extends"));
|
|
3316
|
+
p.push(Pn(e, t, n, "mixins"), Pn(e, t, n, "implements"));
|
|
3317
|
+
let l;
|
|
3318
|
+
return s ? (l = uD(r), a.push(D([...o, A(p)], { id: l }))) : a.push(...o, ...p), !u && s && sD(r.body) ? a.push(k(g, " ", { groupId: l })) : a.push(" "), a.push(n("body")), a;
|
|
3319
|
+
}
|
|
3320
|
+
function sD(e) {
|
|
3321
|
+
return e.type === "ObjectTypeAnnotation" ? ["properties", "indexers", "callProperties", "internalSlots"].some((t) => W(e[t])) : W(e.body);
|
|
3322
|
+
}
|
|
3323
|
+
function Xa(e) {
|
|
3324
|
+
let t = e.superClass ? 1 : 0;
|
|
3325
|
+
for (let n of ["extends", "mixins", "implements"]) if (Array.isArray(e[n]) && (t += e[n].length), t > 1) return !0;
|
|
3326
|
+
return t > 1;
|
|
3327
|
+
}
|
|
3328
|
+
function oD(e) {
|
|
3329
|
+
var r, u, a;
|
|
3330
|
+
let { node: t } = e;
|
|
3331
|
+
if (x(t.id, B.Trailing) || x(t.typeParameters, B.Trailing) || x(t.superClass) || Xa(t)) return !0;
|
|
3332
|
+
if (t.superClass) return e.parent.type === "AssignmentExpression" ? !1 : !(t.superTypeArguments ?? t.superTypeParameters) && _(t.superClass);
|
|
3333
|
+
let n = ((r = t.extends) == null ? void 0 : r[0]) ?? ((u = t.mixins) == null ? void 0 : u[0]) ?? ((a = t.implements) == null ? void 0 : a[0]);
|
|
3334
|
+
return n ? n.type === "InterfaceExtends" && n.id.type === "QualifiedTypeIdentifier" && !n.typeParameters || (n.type === "TSClassImplements" || n.type === "TSInterfaceHeritage") && _(n.expression) && !n.typeArguments : !1;
|
|
3335
|
+
}
|
|
3336
|
+
var vn = /* @__PURE__ */ new WeakMap();
|
|
3337
|
+
function Ra(e) {
|
|
3338
|
+
let { node: t } = e;
|
|
3339
|
+
return vn.has(t) || vn.set(t, oD(e)), vn.get(t);
|
|
3340
|
+
}
|
|
3341
|
+
function Pn(e, t, n, r) {
|
|
3342
|
+
let { node: u } = e;
|
|
3343
|
+
if (!W(u[r])) return "";
|
|
3344
|
+
let a = R(e, t, { marker: r }), s = L([",", T], e.map(n, r));
|
|
3345
|
+
if (!Xa(u)) {
|
|
3346
|
+
let o = [`${r} `, a, s];
|
|
3347
|
+
return Ra(e) ? [T, D(o)] : [" ", o];
|
|
3348
|
+
}
|
|
3349
|
+
return [T, a, a && g, r, D(A([T, s]))];
|
|
3350
|
+
}
|
|
3351
|
+
function iD(e, t, n) {
|
|
3352
|
+
let r = n("superClass"), { parent: u } = e;
|
|
3353
|
+
return u.type === "AssignmentExpression" ? D(k(["(", A([F, r]), F, ")"], r)) : r;
|
|
3354
|
+
}
|
|
3355
|
+
function _a(e, t, n) {
|
|
3356
|
+
let { node: r } = e, u = [];
|
|
3357
|
+
return W(r.decorators) && u.push(Ia(e, t, n)), u.push(Dn(r)), r.static && u.push("static "), u.push(cn(e)), r.override && u.push("override "), u.push(_n(e, t, n)), u;
|
|
3358
|
+
}
|
|
3359
|
+
function Wa(e, t, n) {
|
|
3360
|
+
let { node: r } = e, u = [];
|
|
3361
|
+
W(r.decorators) && u.push(Ia(e, t, n)), u.push(De(e), Dn(r)), r.static && u.push("static "), u.push(cn(e)), r.override && u.push("override "), r.readonly && u.push("readonly "), r.variance && u.push(n("variance")), (r.type === "ClassAccessorProperty" || r.type === "AccessorProperty" || r.type === "TSAbstractAccessorProperty") && u.push("accessor "), u.push(_t(e, t, n), ae(e), ia(e), Z(e, n));
|
|
3362
|
+
let a = r.type === "TSAbstractPropertyDefinition" || r.type === "TSAbstractAccessorProperty";
|
|
3363
|
+
return [Rt(e, t, n, u, " =", a ? void 0 : "value"), t.semi ? ";" : ""];
|
|
3364
|
+
}
|
|
3365
|
+
var pD = I(["TSAsExpression", "TSTypeAssertion", "TSNonNullExpression", "TSInstantiationExpression", "TSSatisfiesExpression"]);
|
|
3366
|
+
function Ua(e) {
|
|
3367
|
+
return pD(e) ? Ua(e.expression) : e;
|
|
3368
|
+
}
|
|
3369
|
+
var lD = I(["FunctionExpression", "ArrowFunctionExpression"]);
|
|
3370
|
+
function cD(e) {
|
|
3371
|
+
return e.type === "MemberExpression" || e.type === "OptionalMemberExpression" || e.type === "Identifier" && e.name !== "undefined";
|
|
3372
|
+
}
|
|
3373
|
+
function DD(e, t) {
|
|
3374
|
+
if (ka(e, t)) {
|
|
3375
|
+
let n = Ua(e.node.expression);
|
|
3376
|
+
return lD(n) || cD(n);
|
|
3377
|
+
}
|
|
3378
|
+
return !(!t.semi || va(e, t) || Pa(e, t));
|
|
3379
|
+
}
|
|
3380
|
+
function yD(e, t, n) {
|
|
3381
|
+
return [n("expression"), DD(e, t) ? ";" : ""];
|
|
3382
|
+
}
|
|
3383
|
+
function dD(e, t, n) {
|
|
3384
|
+
if (t.__isVueBindings || t.__isVueForBindingLeft) {
|
|
3385
|
+
let r = e.map(n, "program", "body", 0, "params");
|
|
3386
|
+
if (r.length === 1) return r[0];
|
|
3387
|
+
let u = L([",", T], r);
|
|
3388
|
+
return t.__isVueForBindingLeft ? ["(", A([F, D(u)]), F, ")"] : u;
|
|
3389
|
+
}
|
|
3390
|
+
if (t.__isEmbeddedTypescriptGenericParameters) {
|
|
3391
|
+
let r = e.map(n, "program", "body", 0, "typeParameters", "params");
|
|
3392
|
+
return L([",", T], r);
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
function fD(e, t) {
|
|
3396
|
+
let { node: n } = e;
|
|
3397
|
+
switch (n.type) {
|
|
3398
|
+
case "RegExpLiteral":
|
|
3399
|
+
return tu(n);
|
|
3400
|
+
case "BigIntLiteral":
|
|
3401
|
+
return Un(n.extra.raw);
|
|
3402
|
+
case "NumericLiteral":
|
|
3403
|
+
return mt(n.extra.raw);
|
|
3404
|
+
case "StringLiteral":
|
|
3405
|
+
return Qe(yt(n.extra.raw, t));
|
|
3406
|
+
case "NullLiteral":
|
|
3407
|
+
return "null";
|
|
3408
|
+
case "BooleanLiteral":
|
|
3409
|
+
return String(n.value);
|
|
3410
|
+
case "DirectiveLiteral":
|
|
3411
|
+
return nu(n.extra.raw, t);
|
|
3412
|
+
case "Literal": {
|
|
3413
|
+
if (n.regex) return tu(n.regex);
|
|
3414
|
+
if (n.bigint) return Un(n.raw);
|
|
3415
|
+
let { value: r } = n;
|
|
3416
|
+
return typeof r == "number" ? mt(n.raw) : typeof r == "string" ? mD(e) ? nu(n.raw, t) : Qe(yt(n.raw, t)) : String(r);
|
|
3417
|
+
}
|
|
3418
|
+
}
|
|
3419
|
+
}
|
|
3420
|
+
function mD(e) {
|
|
3421
|
+
if (e.key !== "expression") return;
|
|
3422
|
+
let { parent: t } = e;
|
|
3423
|
+
return t.type === "ExpressionStatement" && typeof t.directive == "string";
|
|
3424
|
+
}
|
|
3425
|
+
function Un(e) {
|
|
3426
|
+
return e.toLowerCase();
|
|
3427
|
+
}
|
|
3428
|
+
function tu({ pattern: e, flags: t }) {
|
|
3429
|
+
return t = [...t].sort().join(""), `/${e}/${t}`;
|
|
3430
|
+
}
|
|
3431
|
+
var FD = "use strict";
|
|
3432
|
+
function nu(e, t) {
|
|
3433
|
+
let n = e.slice(1, -1);
|
|
3434
|
+
if (n === FD || !(n.includes('"') || n.includes("'"))) {
|
|
3435
|
+
let r = t.singleQuote ? "'" : '"';
|
|
3436
|
+
return r + n + r;
|
|
3437
|
+
}
|
|
3438
|
+
return e;
|
|
3439
|
+
}
|
|
3440
|
+
function ED(e, t, n) {
|
|
3441
|
+
let r = e.originalText.slice(t, n);
|
|
3442
|
+
for (let u of e[Symbol.for("comments")]) {
|
|
3443
|
+
let a = M(u);
|
|
3444
|
+
if (a > n) break;
|
|
3445
|
+
let s = j(u);
|
|
3446
|
+
if (s < t) continue;
|
|
3447
|
+
let o = a - t, p = s - t;
|
|
3448
|
+
r = r.slice(0, o) + z(0, r.slice(o, p), /[^\n]/gu, " ") + r.slice(p);
|
|
3449
|
+
}
|
|
3450
|
+
return r;
|
|
3451
|
+
}
|
|
3452
|
+
var dn = ED, $a = I(["ImportDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "DeclareExportDeclaration", "DeclareExportAllDeclaration"]), AD = I(["EnumBooleanBody", "EnumNumberBody", "EnumBigIntBody", "EnumStringBody", "EnumSymbolBody"]);
|
|
3453
|
+
function hr(e, t, n) {
|
|
3454
|
+
var S;
|
|
3455
|
+
let { node: r, parent: u } = e, a = AD(r), s = r.type === "TSEnumBody" || a, o = $a(r), p = a && r.hasUnknownMembers, l = s ? "members" : o ? "attributes" : "properties", y = r[l], d = s || r.type === "ObjectPattern" && u.type !== "FunctionDeclaration" && u.type !== "FunctionExpression" && u.type !== "ArrowFunctionExpression" && u.type !== "ObjectMethod" && u.type !== "ClassMethod" && u.type !== "ClassPrivateMethod" && u.type !== "AssignmentPattern" && u.type !== "CatchClause" && r.properties.some((h) => h.value && (h.value.type === "ObjectPattern" || h.value.type === "ArrayPattern")) || r.type !== "ObjectPattern" && t.objectWrap === "preserve" && y.length > 0 && gD(r, y[0], t), f = [], m = e.map(({ node: h }) => {
|
|
3456
|
+
let C = [...f, D(n())];
|
|
3457
|
+
return f = [",", T], Ie(h, t) && f.push(g), C;
|
|
3458
|
+
}, l);
|
|
3459
|
+
if (p) {
|
|
3460
|
+
let h;
|
|
3461
|
+
if (x(r, B.Dangling)) {
|
|
3462
|
+
let C = x(r, B.Line);
|
|
3463
|
+
h = [R(e, t), C || oe(t.originalText, j(J(0, Ye(r), -1))) ? g : T, "..."];
|
|
3464
|
+
} else h = ["..."];
|
|
3465
|
+
m.push([...f, ...h]);
|
|
3466
|
+
}
|
|
3467
|
+
let c = !(p || ((S = J(0, y, -1)) == null ? void 0 : S.type) === "RestElement"), E;
|
|
3468
|
+
if (m.length === 0) {
|
|
3469
|
+
if (!x(r, B.Dangling)) return ["{}", Z(e, n)];
|
|
3470
|
+
E = D(["{", R(e, t, { indent: !0 }), F, "}", ae(e), Z(e, n)]);
|
|
3471
|
+
} else {
|
|
3472
|
+
let h = t.bracketSpacing ? T : F;
|
|
3473
|
+
E = ["{", A([h, ...m]), k(c && we(t) ? "," : ""), h, "}", ae(e), Z(e, n)];
|
|
3474
|
+
}
|
|
3475
|
+
return e.match((h) => h.type === "ObjectPattern" && !W(h.decorators), Pt) || _e(r) && (e.match(void 0, (h, C) => C === "typeAnnotation", (h, C) => C === "typeAnnotation", Pt) || e.match(void 0, (h, C) => h.type === "FunctionTypeParam" && C === "typeAnnotation", Pt)) || !d && e.match((h) => h.type === "ObjectPattern", (h) => h.type === "AssignmentExpression" || h.type === "VariableDeclarator") ? E : D(E, { shouldBreak: d });
|
|
3476
|
+
}
|
|
3477
|
+
function gD(e, t, n) {
|
|
3478
|
+
let r = n.originalText, u = M(e), a = M(t);
|
|
3479
|
+
if ($a(e)) {
|
|
3480
|
+
let s = M(e), o = dn(n, s, a);
|
|
3481
|
+
u = s + o.lastIndexOf("{");
|
|
3482
|
+
}
|
|
3483
|
+
return ce(r, u, a);
|
|
3484
|
+
}
|
|
3485
|
+
function CD(e, t, n) {
|
|
3486
|
+
let { node: r } = e;
|
|
3487
|
+
return ["import", r.phase ? ` ${r.phase}` : "", Ka(r), za(e, t, n), Ha(e, t, n), Qa(e, t, n), t.semi ? ";" : ""];
|
|
3488
|
+
}
|
|
3489
|
+
var Ga = (e) => e.type === "ExportDefaultDeclaration" || e.type === "DeclareExportDeclaration" && e.default;
|
|
3490
|
+
function Va(e, t, n) {
|
|
3491
|
+
let { node: r } = e, u = [Rc(e, t, n), De(e), "export", Ga(r) ? " default" : ""], { declaration: a, exported: s } = r;
|
|
3492
|
+
return x(r, B.Dangling) && (u.push(" ", R(e, t)), bu(r) && u.push(g)), a ? u.push(" ", n("declaration")) : (u.push(TD(r)), r.type === "ExportAllDeclaration" || r.type === "DeclareExportAllDeclaration" ? (u.push(" *"), s && u.push(" as ", n("exported"))) : u.push(za(e, t, n)), u.push(Ha(e, t, n), Qa(e, t, n))), u.push(xD(r, t)), u;
|
|
3493
|
+
}
|
|
3494
|
+
var hD = I(["ClassDeclaration", "ComponentDeclaration", "FunctionDeclaration", "TSInterfaceDeclaration", "DeclareClass", "DeclareComponent", "DeclareFunction", "DeclareHook", "HookDeclaration", "TSDeclareFunction", "EnumDeclaration"]);
|
|
3495
|
+
function xD(e, t) {
|
|
3496
|
+
return t.semi && (!e.declaration || Ga(e) && !hD(e.declaration)) ? ";" : "";
|
|
3497
|
+
}
|
|
3498
|
+
function xr(e, t = !0) {
|
|
3499
|
+
return e && e !== "value" ? `${t ? " " : ""}${e}${t ? "" : " "}` : "";
|
|
3500
|
+
}
|
|
3501
|
+
function Ka(e, t) {
|
|
3502
|
+
return xr(e.importKind, t);
|
|
3503
|
+
}
|
|
3504
|
+
function TD(e) {
|
|
3505
|
+
return xr(e.exportKind);
|
|
3506
|
+
}
|
|
3507
|
+
function Ha(e, t, n) {
|
|
3508
|
+
let { node: r } = e;
|
|
3509
|
+
return r.source ? [Ya(r, t) ? " from" : "", " ", n("source")] : "";
|
|
3510
|
+
}
|
|
3511
|
+
function za(e, t, n) {
|
|
3512
|
+
let { node: r } = e;
|
|
3513
|
+
if (!Ya(r, t)) return "";
|
|
3514
|
+
let u = [" "];
|
|
3515
|
+
if (W(r.specifiers)) {
|
|
3516
|
+
let a = [], s = [];
|
|
3517
|
+
e.each(() => {
|
|
3518
|
+
let o = e.node.type;
|
|
3519
|
+
if (o === "ExportNamespaceSpecifier" || o === "ExportDefaultSpecifier" || o === "ImportNamespaceSpecifier" || o === "ImportDefaultSpecifier") a.push(n());
|
|
3520
|
+
else if (o === "ExportSpecifier" || o === "ImportSpecifier") s.push(n());
|
|
3521
|
+
else throw new Ct(r, "specifier");
|
|
3522
|
+
}, "specifiers"), u.push(L(", ", a)), s.length > 0 && (a.length > 0 && u.push(", "), s.length > 1 || a.length > 0 || r.specifiers.some((o) => x(o)) ? u.push(D(["{", A([t.bracketSpacing ? T : F, L([",", T], s)]), k(we(t) ? "," : ""), t.bracketSpacing ? T : F, "}"])) : u.push(["{", t.bracketSpacing ? " " : "", ...s, t.bracketSpacing ? " " : "", "}"]));
|
|
3523
|
+
} else u.push("{}");
|
|
3524
|
+
return u;
|
|
3525
|
+
}
|
|
3526
|
+
function Ya(e, t) {
|
|
3527
|
+
return e.type !== "ImportDeclaration" || W(e.specifiers) || e.importKind === "type" ? !0 : dn(t, M(e), M(e.source)).trimEnd().endsWith("from");
|
|
3528
|
+
}
|
|
3529
|
+
function SD(e, t) {
|
|
3530
|
+
var r, u;
|
|
3531
|
+
if ((r = e.extra) != null && r.deprecatedAssertSyntax) return "assert";
|
|
3532
|
+
let n = dn(t, j(e.source), (u = e.attributes) != null && u[0] ? M(e.attributes[0]) : j(e)).trimStart();
|
|
3533
|
+
return n.startsWith("assert") ? "assert" : n.startsWith("with") || W(e.attributes) ? "with" : void 0;
|
|
3534
|
+
}
|
|
3535
|
+
var bD = (e) => {
|
|
3536
|
+
let { attributes: t } = e;
|
|
3537
|
+
if (t.length !== 1) return !1;
|
|
3538
|
+
let [n] = t, { type: r, key: u, value: a } = n;
|
|
3539
|
+
return r === "ImportAttribute" && (u.type === "Identifier" && u.name === "type" || Q(u) && u.value === "type") && Q(a) && !x(n) && !x(u) && !x(a);
|
|
3540
|
+
};
|
|
3541
|
+
function Qa(e, t, n) {
|
|
3542
|
+
let { node: r } = e;
|
|
3543
|
+
if (!r.source) return "";
|
|
3544
|
+
let u = SD(r, t);
|
|
3545
|
+
if (!u) return "";
|
|
3546
|
+
let a = hr(e, t, n);
|
|
3547
|
+
return bD(r) && (a = nn(a)), [` ${u} `, a];
|
|
3548
|
+
}
|
|
3549
|
+
function BD(e, t, n) {
|
|
3550
|
+
let { node: r } = e, { type: u } = r, a = u.startsWith("Import"), s = a ? "imported" : "local", o = a ? "local" : "exported", p = r[s], l = r[o], y = "", d = "";
|
|
3551
|
+
return u === "ExportNamespaceSpecifier" || u === "ImportNamespaceSpecifier" ? y = "*" : p && (y = n(s)), l && !vD(r) && (d = n(o)), [xr(u === "ImportSpecifier" ? r.importKind : r.exportKind, !1), y, y && d ? " as " : "", d];
|
|
3552
|
+
}
|
|
3553
|
+
function vD(e) {
|
|
3554
|
+
if (e.type !== "ImportSpecifier" && e.type !== "ExportSpecifier") return !1;
|
|
3555
|
+
let { local: t, [e.type === "ImportSpecifier" ? "imported" : "exported"]: n } = e;
|
|
3556
|
+
if (t.type !== n.type || !ao(t, n)) return !1;
|
|
3557
|
+
if (Q(t)) return t.value === n.value && ie(t) === ie(n);
|
|
3558
|
+
switch (t.type) {
|
|
3559
|
+
case "Identifier":
|
|
3560
|
+
return t.name === n.name;
|
|
3561
|
+
default:
|
|
3562
|
+
return !1;
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
function $n(e, t) {
|
|
3566
|
+
return ["...", t("argument"), Z(e, t)];
|
|
3567
|
+
}
|
|
3568
|
+
function PD(e) {
|
|
3569
|
+
let t = [e];
|
|
3570
|
+
for (let n = 0; n < t.length; n++) {
|
|
3571
|
+
let r = t[n];
|
|
3572
|
+
for (let u of ["test", "consequent", "alternate"]) {
|
|
3573
|
+
let a = r[u];
|
|
3574
|
+
if (Y(a)) return !0;
|
|
3575
|
+
a.type === "ConditionalExpression" && t.push(a);
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
return !1;
|
|
3579
|
+
}
|
|
3580
|
+
function kD(e, t, n) {
|
|
3581
|
+
let { node: r } = e, u = r.type === "ConditionalExpression", a = u ? "alternate" : "falseType", { parent: s } = e, o = u ? n("test") : [n("checkType"), " ", "extends", " ", n("extendsType")];
|
|
3582
|
+
return s.type === r.type && s[a] === r ? Te(2, o) : o;
|
|
3583
|
+
}
|
|
3584
|
+
var wD = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"], ["AwaitExpression", "argument"]]);
|
|
3585
|
+
function ID(e) {
|
|
3586
|
+
let { node: t } = e;
|
|
3587
|
+
if (t.type !== "ConditionalExpression") return !1;
|
|
3588
|
+
let n, r = t;
|
|
3589
|
+
for (let u = 0; !n; u++) {
|
|
3590
|
+
let a = e.getParentNode(u);
|
|
3591
|
+
if (a.type === "ChainExpression" && a.expression === r || O(a) && a.callee === r || _(a) && a.object === r || a.type === "TSNonNullExpression" && a.expression === r) {
|
|
3592
|
+
r = a;
|
|
3593
|
+
continue;
|
|
3594
|
+
}
|
|
3595
|
+
a.type === "NewExpression" && a.callee === r || ge(a) && a.expression === r ? (n = e.getParentNode(u + 1), r = a) : n = a;
|
|
3596
|
+
}
|
|
3597
|
+
return r === t ? !1 : n[wD.get(n.type)] === r;
|
|
3598
|
+
}
|
|
3599
|
+
function ND(e, t, n) {
|
|
3600
|
+
let { node: r } = e, u = r.type === "ConditionalExpression", a = u ? "consequent" : "trueType", s = u ? "alternate" : "falseType", o = u ? ["test"] : ["checkType", "extendsType"], p = r[a], l = r[s], y = [], d = !1, { parent: f } = e, m = f.type === r.type && o.some((v) => f[v] === r), c = f.type === r.type && !m, E, S, h = 0;
|
|
3601
|
+
do
|
|
3602
|
+
S = E || r, E = e.getParentNode(h), h++;
|
|
3603
|
+
while (E && E.type === r.type && o.every((v) => E[v] !== S));
|
|
3604
|
+
let C = E || f, N = S;
|
|
3605
|
+
if (u && (Y(r[o[0]]) || Y(p) || Y(l) || PD(N))) {
|
|
3606
|
+
d = !0, c = !0;
|
|
3607
|
+
let v = (U) => [k("("), A([F, U]), F, k(")")], X = (U) => U.type === "NullLiteral" || U.type === "Literal" && U.value === null || U.type === "Identifier" && U.name === "undefined";
|
|
3608
|
+
y.push(" ? ", X(p) ? n(a) : v(n(a)), " : ", l.type === r.type || X(l) ? n(s) : v(n(s)));
|
|
3609
|
+
} else {
|
|
3610
|
+
let v = (U) => t.useTabs ? A(n(U)) : Te(2, n(U)), X = [T, "? ", p.type === r.type ? k("", "(") : "", v(a), p.type === r.type ? k("", ")") : "", T, ": ", v(s)];
|
|
3611
|
+
y.push(f.type !== r.type || f[s] === r || m ? X : t.useTabs ? $u(A(X)) : Te(Math.max(0, t.tabWidth - 2), X));
|
|
3612
|
+
}
|
|
3613
|
+
let b = (v) => f === C ? D(v) : v, w = !d && (_(f) || f.type === "NGPipeExpression" && f.left === r) && !f.computed, q = ID(e), K = b([kD(e, t, n), c ? y : A(y), u && w && !q ? F : ""]);
|
|
3614
|
+
return m || q ? D([A([F, K]), F]) : K;
|
|
3615
|
+
}
|
|
3616
|
+
function jD(e, t) {
|
|
3617
|
+
return (_(t) || t.type === "NGPipeExpression" && t.left === e) && !t.computed;
|
|
3618
|
+
}
|
|
3619
|
+
function MD(e, t, n, r) {
|
|
3620
|
+
return [...e.map((u) => Ye(u)), Ye(t), Ye(n)].flat().some((u) => Se(u) && ce(r.originalText, M(u), j(u)));
|
|
3621
|
+
}
|
|
3622
|
+
var LD = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"], ["AwaitExpression", "argument"]]);
|
|
3623
|
+
function OD(e) {
|
|
3624
|
+
let { node: t } = e;
|
|
3625
|
+
if (t.type !== "ConditionalExpression") return !1;
|
|
3626
|
+
let n, r = t;
|
|
3627
|
+
for (let u = 0; !n; u++) {
|
|
3628
|
+
let a = e.getParentNode(u);
|
|
3629
|
+
if (a.type === "ChainExpression" && a.expression === r || O(a) && a.callee === r || _(a) && a.object === r || a.type === "TSNonNullExpression" && a.expression === r) {
|
|
3630
|
+
r = a;
|
|
3631
|
+
continue;
|
|
3632
|
+
}
|
|
3633
|
+
a.type === "NewExpression" && a.callee === r || ge(a) && a.expression === r ? (n = e.getParentNode(u + 1), r = a) : n = a;
|
|
3634
|
+
}
|
|
3635
|
+
return r === t ? !1 : n[LD.get(n.type)] === r;
|
|
3636
|
+
}
|
|
3637
|
+
var kn = (e) => [k("("), A([F, e]), F, k(")")];
|
|
3638
|
+
function Tr(e, t, n, r) {
|
|
3639
|
+
if (!t.experimentalTernaries) return ND(e, t, n);
|
|
3640
|
+
let { node: u } = e, a = u.type === "ConditionalExpression", s = We(u), o = a ? "consequent" : "trueType", p = a ? "alternate" : "falseType", l = a ? ["test"] : ["checkType", "extendsType"], y = u[o], d = u[p], f = l.map((Tt) => u[Tt]), { parent: m } = e, c = m.type === u.type, E = c && l.some((Tt) => m[Tt] === u), S = c && m[p] === u, h = y.type === u.type, C = d.type === u.type, N = C || S, b = t.tabWidth > 2 || t.useTabs, w, q, K = 0;
|
|
3641
|
+
do
|
|
3642
|
+
q = w || u, w = e.getParentNode(K), K++;
|
|
3643
|
+
while (w && w.type === u.type && l.every((Tt) => w[Tt] !== q));
|
|
3644
|
+
let v = w || m, X = r && r.assignmentLayout && r.assignmentLayout !== "break-after-operator" && (m.type === "AssignmentExpression" || m.type === "VariableDeclarator" || m.type === "ClassProperty" || m.type === "PropertyDefinition" || m.type === "ClassPrivateProperty" || m.type === "ObjectProperty" || m.type === "Property"), U = (m.type === "ReturnStatement" || m.type === "ThrowStatement") && !(h || C), te = a && v.type === "JSXExpressionContainer" && e.grandparent.type !== "JSXAttribute", de = OD(e), P = jD(u, m), G = s && Ke(e, t), H = b ? t.useTabs ? " " : " ".repeat(t.tabWidth - 1) : "", He = MD(f, y, d, t) || h || C, fe = !N && !c && !s && (te ? y.type === "NullLiteral" || y.type === "Literal" && y.value === null : rr(y, t) && Nr(u.test, 3)), Wt = N || S || s && !c || c && a && Nr(u.test, 1) || fe, Sr = [];
|
|
3645
|
+
!h && x(y, B.Dangling) && e.call(() => {
|
|
3646
|
+
Sr.push(R(e, t), g);
|
|
3647
|
+
}, "consequent");
|
|
3648
|
+
let ht = [];
|
|
3649
|
+
x(u.test, B.Dangling) && e.call(() => {
|
|
3650
|
+
ht.push(R(e, t));
|
|
3651
|
+
}, "test"), !C && x(d, B.Dangling) && e.call(() => {
|
|
3652
|
+
ht.push(R(e, t));
|
|
3653
|
+
}, "alternate"), x(u, B.Dangling) && ht.push(R(e, t));
|
|
3654
|
+
let br = Symbol("test"), Fs = Symbol("consequent"), Ut = Symbol("test-and-consequent"), Es = a ? [kn(n("test")), u.test.type === "ConditionalExpression" ? Oe : ""] : [n("checkType"), " ", "extends", " ", We(u.extendsType) || u.extendsType.type === "TSMappedType" ? n("extendsType") : D(kn(n("extendsType")))], Br = D([Es, " ?"], { id: br }), As = n(o), $t = A([h || te && (Y(y) || c || N) ? g : T, Sr, As]), gs = Wt ? D([Br, N ? $t : k($t, D($t, { id: Fs }), { groupId: br })], { id: Ut }) : [Br, $t], fn = n(p), vr = fe ? k(fn, $u(kn(fn)), { groupId: Ut }) : fn, xt = [gs, ht.length > 0 ? [A([g, ht]), g] : C ? g : fe ? k(T, " ", { groupId: Ut }) : T, ":", C ? " " : b ? Wt ? k(H, k(N || fe ? " " : H, " "), { groupId: Ut }) : k(H, " ") : " ", C ? vr : D([A(vr), te && !fe ? F : ""]), P && !de ? F : "", He ? Oe : ""];
|
|
3655
|
+
return X && !He ? D(A([F, D(xt)])) : X || U ? D(A(xt)) : de || s && E ? D([A([F, xt]), G ? F : ""]) : m === v ? D(xt) : xt;
|
|
3656
|
+
}
|
|
3657
|
+
function JD(e, t, n, r) {
|
|
3658
|
+
let { node: u } = e;
|
|
3659
|
+
if (tr(u)) return fD(e, t);
|
|
3660
|
+
switch (u.type) {
|
|
3661
|
+
case "JsExpressionRoot":
|
|
3662
|
+
return n("node");
|
|
3663
|
+
case "JsonRoot":
|
|
3664
|
+
return [R(e, t), n("node"), g];
|
|
3665
|
+
case "File":
|
|
3666
|
+
return dD(e, t, n) ?? n("program");
|
|
3667
|
+
case "ExpressionStatement":
|
|
3668
|
+
return yD(e, t, n);
|
|
3669
|
+
case "ChainExpression":
|
|
3670
|
+
return n("expression");
|
|
3671
|
+
case "ParenthesizedExpression":
|
|
3672
|
+
return !x(u.expression) && (he(u.expression) || ee(u.expression)) ? ["(", n("expression"), ")"] : D(["(", A([F, n("expression")]), F, ")"]);
|
|
3673
|
+
case "AssignmentExpression":
|
|
3674
|
+
return Kl(e, t, n);
|
|
3675
|
+
case "VariableDeclarator":
|
|
3676
|
+
return Hl(e, t, n);
|
|
3677
|
+
case "BinaryExpression":
|
|
3678
|
+
case "LogicalExpression":
|
|
3679
|
+
return pa(e, t, n);
|
|
3680
|
+
case "AssignmentPattern":
|
|
3681
|
+
return [n("left"), " = ", n("right")];
|
|
3682
|
+
case "OptionalMemberExpression":
|
|
3683
|
+
case "MemberExpression":
|
|
3684
|
+
return Wl(e, t, n);
|
|
3685
|
+
case "MetaProperty":
|
|
3686
|
+
return [n("meta"), ".", n("property")];
|
|
3687
|
+
case "BindExpression":
|
|
3688
|
+
return Xl(e, t, n);
|
|
3689
|
+
case "Identifier":
|
|
3690
|
+
return [u.name, ae(e), ia(e), Z(e, n)];
|
|
3691
|
+
case "V8IntrinsicIdentifier":
|
|
3692
|
+
return ["%", u.name];
|
|
3693
|
+
case "SpreadElement":
|
|
3694
|
+
return $n(e, n);
|
|
3695
|
+
case "RestElement":
|
|
3696
|
+
return $n(e, n);
|
|
3697
|
+
case "FunctionDeclaration":
|
|
3698
|
+
case "FunctionExpression":
|
|
3699
|
+
return Ta(e, t, n, r);
|
|
3700
|
+
case "ArrowFunctionExpression":
|
|
3701
|
+
return Uc(e, t, n, r);
|
|
3702
|
+
case "YieldExpression":
|
|
3703
|
+
return [`yield${u.delegate ? "*" : ""}`, u.argument ? [" ", n("argument")] : ""];
|
|
3704
|
+
case "AwaitExpression": {
|
|
3705
|
+
let a = ["await"];
|
|
3706
|
+
if (u.argument) {
|
|
3707
|
+
a.push(" ", n("argument"));
|
|
3708
|
+
let { parent: s } = e;
|
|
3709
|
+
if (O(s) && s.callee === u || _(s) && s.object === u) {
|
|
3710
|
+
a = [A([F, ...a]), F];
|
|
3711
|
+
let o = e.findAncestor((p) => p.type === "AwaitExpression" || p.type === "BlockStatement");
|
|
3712
|
+
if ((o == null ? void 0 : o.type) !== "AwaitExpression" || !re(o.argument, (p) => p === u)) return D(a);
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
return a;
|
|
3716
|
+
}
|
|
3717
|
+
case "ExportDefaultDeclaration":
|
|
3718
|
+
case "ExportNamedDeclaration":
|
|
3719
|
+
case "ExportAllDeclaration":
|
|
3720
|
+
return Va(e, t, n);
|
|
3721
|
+
case "ImportDeclaration":
|
|
3722
|
+
return CD(e, t, n);
|
|
3723
|
+
case "ImportSpecifier":
|
|
3724
|
+
case "ExportSpecifier":
|
|
3725
|
+
case "ImportNamespaceSpecifier":
|
|
3726
|
+
case "ExportNamespaceSpecifier":
|
|
3727
|
+
case "ImportDefaultSpecifier":
|
|
3728
|
+
case "ExportDefaultSpecifier":
|
|
3729
|
+
return BD(e, t, n);
|
|
3730
|
+
case "ImportAttribute":
|
|
3731
|
+
return Sn(e, t, n);
|
|
3732
|
+
case "Program":
|
|
3733
|
+
case "BlockStatement":
|
|
3734
|
+
case "StaticBlock":
|
|
3735
|
+
return La(e, t, n);
|
|
3736
|
+
case "ClassBody":
|
|
3737
|
+
return gr(e, t, n);
|
|
3738
|
+
case "ThrowStatement":
|
|
3739
|
+
return lc(e, t, n);
|
|
3740
|
+
case "ReturnStatement":
|
|
3741
|
+
return pc(e, t, n);
|
|
3742
|
+
case "NewExpression":
|
|
3743
|
+
case "ImportExpression":
|
|
3744
|
+
case "OptionalCallExpression":
|
|
3745
|
+
case "CallExpression":
|
|
3746
|
+
return un(e, t, n);
|
|
3747
|
+
case "ObjectExpression":
|
|
3748
|
+
case "ObjectPattern":
|
|
3749
|
+
return hr(e, t, n);
|
|
3750
|
+
case "Property":
|
|
3751
|
+
return Jt(u) ? _n(e, t, n) : Sn(e, t, n);
|
|
3752
|
+
case "ObjectProperty":
|
|
3753
|
+
return Sn(e, t, n);
|
|
3754
|
+
case "ObjectMethod":
|
|
3755
|
+
return _n(e, t, n);
|
|
3756
|
+
case "Decorator":
|
|
3757
|
+
return ["@", n("expression")];
|
|
3758
|
+
case "ArrayExpression":
|
|
3759
|
+
case "ArrayPattern":
|
|
3760
|
+
return mr(e, t, n);
|
|
3761
|
+
case "SequenceExpression": {
|
|
3762
|
+
let { parent: a } = e;
|
|
3763
|
+
if (a.type === "ExpressionStatement" || a.type === "ForStatement") {
|
|
3764
|
+
let o = [];
|
|
3765
|
+
return e.each(({ isFirst: p }) => {
|
|
3766
|
+
p ? o.push(n()) : o.push(",", A([T, n()]));
|
|
3767
|
+
}, "expressions"), D(o);
|
|
3768
|
+
}
|
|
3769
|
+
let s = L([",", T], e.map(n, "expressions"));
|
|
3770
|
+
return (a.type === "ReturnStatement" || a.type === "ThrowStatement") && e.key === "argument" || a.type === "ArrowFunctionExpression" && e.key === "body" ? D(k([A([F, s]), F], s)) : D(s);
|
|
3771
|
+
}
|
|
3772
|
+
case "ThisExpression":
|
|
3773
|
+
return "this";
|
|
3774
|
+
case "Super":
|
|
3775
|
+
return "super";
|
|
3776
|
+
case "Directive":
|
|
3777
|
+
return [n("value"), t.semi ? ";" : ""];
|
|
3778
|
+
case "UnaryExpression": {
|
|
3779
|
+
let a = [u.operator];
|
|
3780
|
+
return /[a-z]$/u.test(u.operator) && a.push(" "), x(u.argument) ? a.push(D(["(", A([F, n("argument")]), F, ")"])) : a.push(n("argument")), a;
|
|
3781
|
+
}
|
|
3782
|
+
case "UpdateExpression":
|
|
3783
|
+
return [u.prefix ? u.operator : "", n("argument"), u.prefix ? "" : u.operator];
|
|
3784
|
+
case "ConditionalExpression":
|
|
3785
|
+
return Tr(e, t, n, r);
|
|
3786
|
+
case "VariableDeclaration": {
|
|
3787
|
+
let a = e.map(n, "declarations"), s = e.parent, o = s.type === "ForStatement" || s.type === "ForInStatement" || s.type === "ForOfStatement", p = u.declarations.some((y) => y.init), l;
|
|
3788
|
+
return a.length === 1 && !x(u.declarations[0]) ? l = a[0] : a.length > 0 && (l = A(a[0])), D([De(e), u.kind, l ? [" ", l] : "", A(a.slice(1).map((y) => [",", p && !o ? g : T, y])), t.semi && !(o && s.body !== u) ? ";" : ""]);
|
|
3789
|
+
}
|
|
3790
|
+
case "WithStatement":
|
|
3791
|
+
return D(["with (", n("object"), ")", Xe(u.body, n("body"))]);
|
|
3792
|
+
case "IfStatement": {
|
|
3793
|
+
let a = Xe(u.consequent, n("consequent")), s = [D(["if (", D([A([F, n("test")]), F]), ")", a])];
|
|
3794
|
+
if (u.alternate) {
|
|
3795
|
+
let o = x(u.consequent, B.Trailing | B.Line) || bu(u), p = u.consequent.type === "BlockStatement" && !o;
|
|
3796
|
+
s.push(p ? " " : g), x(u, B.Dangling) && s.push(R(e, t), o ? g : " "), s.push("else", D(Xe(u.alternate, n("alternate"), u.alternate.type === "IfStatement")));
|
|
3797
|
+
}
|
|
3798
|
+
return s;
|
|
3799
|
+
}
|
|
3800
|
+
case "ForStatement": {
|
|
3801
|
+
let a = Xe(u.body, n("body")), s = R(e, t), o = s ? [s, F] : "";
|
|
3802
|
+
return !u.init && !u.test && !u.update ? [o, D(["for (;;)", a])] : [o, D(["for (", D([A([F, n("init"), ";", T, n("test"), ";", u.update ? [T, n("update")] : k("", T)]), F]), ")", a])];
|
|
3803
|
+
}
|
|
3804
|
+
case "WhileStatement":
|
|
3805
|
+
return D(["while (", D([A([F, n("test")]), F]), ")", Xe(u.body, n("body"))]);
|
|
3806
|
+
case "ForInStatement":
|
|
3807
|
+
return D(["for (", n("left"), " in ", n("right"), ")", Xe(u.body, n("body"))]);
|
|
3808
|
+
case "ForOfStatement":
|
|
3809
|
+
return D(["for", u.await ? " await" : "", " (", n("left"), " of ", n("right"), ")", Xe(u.body, n("body"))]);
|
|
3810
|
+
case "DoWhileStatement": {
|
|
3811
|
+
let a = Xe(u.body, n("body"));
|
|
3812
|
+
return [D(["do", a]), u.body.type === "BlockStatement" ? " " : g, "while (", D([A([F, n("test")]), F]), ")", t.semi ? ";" : ""];
|
|
3813
|
+
}
|
|
3814
|
+
case "DoExpression":
|
|
3815
|
+
return [u.async ? "async " : "", "do ", n("body")];
|
|
3816
|
+
case "BreakStatement":
|
|
3817
|
+
case "ContinueStatement":
|
|
3818
|
+
return [u.type === "BreakStatement" ? "break" : "continue", u.label ? [" ", n("label")] : "", t.semi ? ";" : ""];
|
|
3819
|
+
case "LabeledStatement":
|
|
3820
|
+
return [n("label"), `:${u.body.type === "EmptyStatement" && !x(u.body, B.Leading) ? "" : " "}`, n("body")];
|
|
3821
|
+
case "TryStatement":
|
|
3822
|
+
return ["try ", n("block"), u.handler ? [" ", n("handler")] : "", u.finalizer ? [" finally ", n("finalizer")] : ""];
|
|
3823
|
+
case "CatchClause":
|
|
3824
|
+
if (u.param) {
|
|
3825
|
+
let a = x(u.param, (o) => !Se(o) || o.leading && oe(t.originalText, j(o)) || o.trailing && oe(t.originalText, M(o), { backwards: !0 })), s = n("param");
|
|
3826
|
+
return ["catch ", a ? ["(", A([F, s]), F, ") "] : ["(", s, ") "], n("body")];
|
|
3827
|
+
}
|
|
3828
|
+
return ["catch ", n("body")];
|
|
3829
|
+
case "SwitchStatement":
|
|
3830
|
+
return [D(["switch (", A([F, n("discriminant")]), F, ")"]), " {", u.cases.length > 0 ? A([g, L(g, e.map(({ node: a, isLast: s }) => [n(), !s && Ie(a, t) ? g : ""], "cases"))]) : "", g, "}"];
|
|
3831
|
+
case "SwitchCase": {
|
|
3832
|
+
let a = [];
|
|
3833
|
+
u.test ? a.push("case ", n("test"), ":") : a.push("default:"), x(u, B.Dangling) && a.push(" ", R(e, t));
|
|
3834
|
+
let s = u.consequent.filter((o) => o.type !== "EmptyStatement");
|
|
3835
|
+
if (s.length > 0) {
|
|
3836
|
+
let o = Wn(e, t, n, "consequent");
|
|
3837
|
+
a.push(s.length === 1 && s[0].type === "BlockStatement" ? [" ", o] : A([g, o]));
|
|
3838
|
+
}
|
|
3839
|
+
return a;
|
|
3840
|
+
}
|
|
3841
|
+
case "DebuggerStatement":
|
|
3842
|
+
return ["debugger", t.semi ? ";" : ""];
|
|
3843
|
+
case "ClassDeclaration":
|
|
3844
|
+
case "ClassExpression":
|
|
3845
|
+
return Cr(e, t, n);
|
|
3846
|
+
case "ClassMethod":
|
|
3847
|
+
case "ClassPrivateMethod":
|
|
3848
|
+
case "MethodDefinition":
|
|
3849
|
+
return _a(e, t, n);
|
|
3850
|
+
case "ClassProperty":
|
|
3851
|
+
case "PropertyDefinition":
|
|
3852
|
+
case "ClassPrivateProperty":
|
|
3853
|
+
case "ClassAccessorProperty":
|
|
3854
|
+
case "AccessorProperty":
|
|
3855
|
+
return Wa(e, t, n);
|
|
3856
|
+
case "TemplateElement":
|
|
3857
|
+
return Qe(u.value.raw);
|
|
3858
|
+
case "TemplateLiteral":
|
|
3859
|
+
return Zu(e, t, n);
|
|
3860
|
+
case "TaggedTemplateExpression":
|
|
3861
|
+
return Dp(e, t, n);
|
|
3862
|
+
case "PrivateIdentifier":
|
|
3863
|
+
return ["#", u.name];
|
|
3864
|
+
case "PrivateName":
|
|
3865
|
+
return ["#", n("id")];
|
|
3866
|
+
case "TopicReference":
|
|
3867
|
+
return "%";
|
|
3868
|
+
case "ArgumentPlaceholder":
|
|
3869
|
+
return "?";
|
|
3870
|
+
case "ModuleExpression":
|
|
3871
|
+
return ["module ", n("body")];
|
|
3872
|
+
case "VoidPattern":
|
|
3873
|
+
return "void";
|
|
3874
|
+
case "EmptyStatement":
|
|
3875
|
+
if (Zn(e)) return ";";
|
|
3876
|
+
case "InterpreterDirective":
|
|
3877
|
+
default:
|
|
3878
|
+
throw new Ct(u, "ESTree");
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
function Za(e) {
|
|
3882
|
+
return [e("elementType"), "[]"];
|
|
3883
|
+
}
|
|
3884
|
+
var qD = I(["SatisfiesExpression", "TSSatisfiesExpression"]);
|
|
3885
|
+
function es(e, t, n) {
|
|
3886
|
+
let { parent: r, node: u, key: a } = e, s = u.type === "AsConstExpression" ? "const" : n("typeAnnotation"), o = [n("expression"), " ", qD(u) ? "satisfies" : "as", " ", s];
|
|
3887
|
+
return a === "callee" && O(r) || a === "object" && _(r) ? D([A([F, ...o]), F]) : o;
|
|
3888
|
+
}
|
|
3889
|
+
function XD(e, t, n) {
|
|
3890
|
+
let { node: r } = e, u = [De(e), "component"];
|
|
3891
|
+
r.id && u.push(" ", n("id")), u.push(n("typeParameters"));
|
|
3892
|
+
let a = RD(e, t, n);
|
|
3893
|
+
return r.rendersType ? u.push(D([a, " ", n("rendersType")])) : u.push(D([a])), r.body && u.push(" ", n("body")), t.semi && r.type === "DeclareComponent" && u.push(";"), u;
|
|
3894
|
+
}
|
|
3895
|
+
function RD(e, t, n) {
|
|
3896
|
+
let { node: r } = e, u = r.params;
|
|
3897
|
+
if (r.rest && (u = [...u, r.rest]), u.length === 0) return ["(", R(e, t, { filter: (s) => xe(t.originalText, j(s)) === ")" }), ")"];
|
|
3898
|
+
let a = [];
|
|
3899
|
+
return WD(e, (s, o) => {
|
|
3900
|
+
let p = o === u.length - 1;
|
|
3901
|
+
p && r.rest && a.push("..."), a.push(n()), !p && (a.push(","), Ie(u[o], t) ? a.push(g, g) : a.push(T));
|
|
3902
|
+
}), ["(", A([F, ...a]), k(we(t, "all") && !_D(r, u) ? "," : ""), F, ")"];
|
|
3903
|
+
}
|
|
3904
|
+
function _D(e, t) {
|
|
3905
|
+
var n;
|
|
3906
|
+
return e.rest || ((n = J(0, t, -1)) == null ? void 0 : n.type) === "RestElement";
|
|
3907
|
+
}
|
|
3908
|
+
function WD(e, t) {
|
|
3909
|
+
let { node: n } = e, r = 0, u = (a) => t(a, r++);
|
|
3910
|
+
e.each(u, "params"), n.rest && e.call(u, "rest");
|
|
3911
|
+
}
|
|
3912
|
+
function UD(e, t, n) {
|
|
3913
|
+
let { node: r } = e;
|
|
3914
|
+
return r.shorthand ? n("local") : [n("name"), " as ", n("local")];
|
|
3915
|
+
}
|
|
3916
|
+
function $D(e, t, n) {
|
|
3917
|
+
let { node: r } = e, u = [];
|
|
3918
|
+
return r.name && u.push(n("name"), r.optional ? "?: " : ": "), u.push(n("typeAnnotation")), u;
|
|
3919
|
+
}
|
|
3920
|
+
function ts(e, t, n) {
|
|
3921
|
+
return hr(e, t, n);
|
|
3922
|
+
}
|
|
3923
|
+
function GD(e, t, n) {
|
|
3924
|
+
let { node: r } = e;
|
|
3925
|
+
return [r.type === "EnumSymbolBody" || r.explicitType ? `of ${r.type.slice(4, -4).toLowerCase()} ` : "", ts(e, t, n)];
|
|
3926
|
+
}
|
|
3927
|
+
function ns(e, t) {
|
|
3928
|
+
let { node: n } = e, r = t("id");
|
|
3929
|
+
n.computed && (r = ["[", r, "]"]);
|
|
3930
|
+
let u = "";
|
|
3931
|
+
return n.initializer && (u = t("initializer")), n.init && (u = t("init")), u ? [r, " = ", u] : r;
|
|
3932
|
+
}
|
|
3933
|
+
function rs(e, t) {
|
|
3934
|
+
let { node: n } = e;
|
|
3935
|
+
return [De(e), n.const ? "const " : "", "enum ", t("id"), " ", t("body")];
|
|
3936
|
+
}
|
|
3937
|
+
function us(e, t, n) {
|
|
3938
|
+
let { node: r } = e, u = [cn(e)];
|
|
3939
|
+
(r.type === "TSConstructorType" || r.type === "TSConstructSignatureDeclaration") && u.push("new ");
|
|
3940
|
+
let a = st(e, t, n, !1, !0), s = [];
|
|
3941
|
+
return r.type === "FunctionTypeAnnotation" ? s.push(VD(e) ? " => " : ": ", n("returnType")) : s.push(Z(e, n, "returnType")), gt(r, s) && (a = D(a)), u.push(a, s), [D(u), r.type === "TSConstructSignatureDeclaration" || r.type === "TSCallSignatureDeclaration" ? je(e, t) : ""];
|
|
3942
|
+
}
|
|
3943
|
+
function VD(e) {
|
|
3944
|
+
var r;
|
|
3945
|
+
let { node: t, parent: n } = e;
|
|
3946
|
+
return t.type === "FunctionTypeAnnotation" && (hu(n) || !((n.type === "ObjectTypeProperty" || n.type === "ObjectTypeInternalSlot") && !n.variance && !n.optional && sn(n, t) || n.type === "ObjectTypeCallProperty" || ((r = e.getParentNode(2)) == null ? void 0 : r.type) === "DeclareFunction"));
|
|
3947
|
+
}
|
|
3948
|
+
function KD(e, t, n) {
|
|
3949
|
+
let { node: r } = e, u = ["hook"];
|
|
3950
|
+
r.id && u.push(" ", n("id"));
|
|
3951
|
+
let a = st(e, t, n, !1, !0), s = yn(e, n), o = gt(r, s);
|
|
3952
|
+
return u.push(D([o ? D(a) : a, s]), r.body ? " " : "", n("body")), u;
|
|
3953
|
+
}
|
|
3954
|
+
function HD(e, t, n) {
|
|
3955
|
+
let { node: r } = e, u = [De(e), "hook"];
|
|
3956
|
+
return r.id && u.push(" ", n("id")), t.semi && u.push(";"), u;
|
|
3957
|
+
}
|
|
3958
|
+
function ru(e) {
|
|
3959
|
+
var n;
|
|
3960
|
+
let { node: t } = e;
|
|
3961
|
+
return t.type === "HookTypeAnnotation" && ((n = e.getParentNode(2)) == null ? void 0 : n.type) === "DeclareHook";
|
|
3962
|
+
}
|
|
3963
|
+
function zD(e, t, n) {
|
|
3964
|
+
let { node: r } = e, u = st(e, t, n, !1, !0), a = [ru(e) ? ": " : " => ", n("returnType")];
|
|
3965
|
+
return D([ru(e) ? "" : "hook ", gt(r, a) ? D(u) : u, a]);
|
|
3966
|
+
}
|
|
3967
|
+
function as(e, t, n) {
|
|
3968
|
+
return [n("objectType"), ae(e), "[", n("indexType"), "]"];
|
|
3969
|
+
}
|
|
3970
|
+
function ss(e, t, n) {
|
|
3971
|
+
return ["infer ", n("typeParameter")];
|
|
3972
|
+
}
|
|
3973
|
+
function os(e, t, n) {
|
|
3974
|
+
let r = !1;
|
|
3975
|
+
return D(e.map(({ isFirst: u, previous: a, node: s, index: o }) => {
|
|
3976
|
+
let p = n();
|
|
3977
|
+
if (u) return p;
|
|
3978
|
+
let l = _e(s), y = _e(a);
|
|
3979
|
+
return y && l ? [" & ", r ? A(p) : p] : !y && !l || Ce(t.originalText, s) ? t.experimentalOperatorPosition === "start" ? A([T, "& ", p]) : A([" &", T, p]) : (o > 1 && (r = !0), [" & ", o > 1 ? A(p) : p]);
|
|
3980
|
+
}, "types"));
|
|
3981
|
+
}
|
|
3982
|
+
function YD(e) {
|
|
3983
|
+
switch (e) {
|
|
3984
|
+
case null:
|
|
3985
|
+
return "";
|
|
3986
|
+
case "PlusOptional":
|
|
3987
|
+
return "+?";
|
|
3988
|
+
case "MinusOptional":
|
|
3989
|
+
return "-?";
|
|
3990
|
+
case "Optional":
|
|
3991
|
+
return "?";
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3994
|
+
function QD(e, t, n) {
|
|
3995
|
+
let { node: r } = e;
|
|
3996
|
+
return [D([r.variance ? n("variance") : "", "[", A([n("keyTparam"), " in ", n("sourceType")]), "]", YD(r.optional), ": ", n("propType")]), je(e, t)];
|
|
3997
|
+
}
|
|
3998
|
+
function uu(e, t) {
|
|
3999
|
+
return e === "+" || e === "-" ? e + t : t;
|
|
4000
|
+
}
|
|
4001
|
+
function ZD(e, t, n) {
|
|
4002
|
+
let { node: r } = e, u = !1;
|
|
4003
|
+
if (t.objectWrap === "preserve") {
|
|
4004
|
+
let a = M(r), s = dn(t, a + 1, M(r.key)), o = a + 1 + s.search(/\S/u);
|
|
4005
|
+
ce(t.originalText, a, o) && (u = !0);
|
|
4006
|
+
}
|
|
4007
|
+
return D(["{", A([t.bracketSpacing ? T : F, x(r, B.Dangling) ? D([R(e, t), g]) : "", D([r.readonly ? [uu(r.readonly, "readonly"), " "] : "", "[", n("key"), " in ", n("constraint"), r.nameType ? [" as ", n("nameType")] : "", "]", r.optional ? uu(r.optional, "?") : "", r.typeAnnotation ? ": " : "", n("typeAnnotation")]), t.semi ? k(";") : ""]), t.bracketSpacing ? T : F, "}"], { shouldBreak: u });
|
|
4008
|
+
}
|
|
4009
|
+
function ey(e, t, n) {
|
|
4010
|
+
let { node: r } = e;
|
|
4011
|
+
return [D(["match (", A([F, n("argument")]), F, ")"]), " {", r.cases.length > 0 ? A([g, L(g, e.map(({ node: u, isLast: a }) => [n(), !a && Ie(u, t) ? g : ""], "cases"))]) : "", g, "}"];
|
|
4012
|
+
}
|
|
4013
|
+
function ty(e, t, n) {
|
|
4014
|
+
let { node: r } = e, u = x(r, B.Dangling) ? [" ", R(e, t)] : [], a = r.type === "MatchStatementCase" ? [" ", n("body")] : A([T, n("body"), ","]);
|
|
4015
|
+
return [n("pattern"), r.guard ? D([A([T, "if (", n("guard"), ")"])]) : "", D([" =>", u, a])];
|
|
4016
|
+
}
|
|
4017
|
+
function ny(e, t, n) {
|
|
4018
|
+
let { node: r } = e;
|
|
4019
|
+
switch (r.type) {
|
|
4020
|
+
case "MatchOrPattern":
|
|
4021
|
+
return ay(e, t, n);
|
|
4022
|
+
case "MatchAsPattern":
|
|
4023
|
+
return [n("pattern"), " as ", n("target")];
|
|
4024
|
+
case "MatchWildcardPattern":
|
|
4025
|
+
return ["_"];
|
|
4026
|
+
case "MatchLiteralPattern":
|
|
4027
|
+
return n("literal");
|
|
4028
|
+
case "MatchUnaryPattern":
|
|
4029
|
+
return [r.operator, n("argument")];
|
|
4030
|
+
case "MatchIdentifierPattern":
|
|
4031
|
+
return n("id");
|
|
4032
|
+
case "MatchMemberPattern": {
|
|
4033
|
+
let u = r.property.type === "Identifier" ? [".", n("property")] : ["[", A([F, n("property")]), F, "]"];
|
|
4034
|
+
return D([n("base"), u]);
|
|
4035
|
+
}
|
|
4036
|
+
case "MatchBindingPattern":
|
|
4037
|
+
return [r.kind, " ", n("id")];
|
|
4038
|
+
case "MatchObjectPattern": {
|
|
4039
|
+
let u = e.map(n, "properties");
|
|
4040
|
+
return r.rest && u.push(n("rest")), D(["{", A([F, L([",", T], u)]), r.rest ? "" : k(","), F, "}"]);
|
|
4041
|
+
}
|
|
4042
|
+
case "MatchArrayPattern": {
|
|
4043
|
+
let u = e.map(n, "elements");
|
|
4044
|
+
return r.rest && u.push(n("rest")), D(["[", A([F, L([",", T], u)]), r.rest ? "" : k(","), F, "]"]);
|
|
4045
|
+
}
|
|
4046
|
+
case "MatchObjectPatternProperty":
|
|
4047
|
+
return r.shorthand ? n("pattern") : D([n("key"), ":", A([T, n("pattern")])]);
|
|
4048
|
+
case "MatchRestPattern": {
|
|
4049
|
+
let u = ["..."];
|
|
4050
|
+
return r.argument && u.push(n("argument")), u;
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
var is = I(["MatchWildcardPattern", "MatchLiteralPattern", "MatchUnaryPattern", "MatchIdentifierPattern"]);
|
|
4055
|
+
function ry(e) {
|
|
4056
|
+
let { patterns: t } = e;
|
|
4057
|
+
if (t.some((r) => x(r))) return !1;
|
|
4058
|
+
let n = t.find((r) => r.type === "MatchObjectPattern");
|
|
4059
|
+
return n ? t.every((r) => r === n || is(r)) : !1;
|
|
4060
|
+
}
|
|
4061
|
+
function uy(e) {
|
|
4062
|
+
return is(e) || e.type === "MatchObjectPattern" ? !0 : e.type === "MatchOrPattern" ? ry(e) : !1;
|
|
4063
|
+
}
|
|
4064
|
+
function ay(e, t, n) {
|
|
4065
|
+
let { node: r } = e, { parent: u } = e, a = u.type !== "MatchStatementCase" && u.type !== "MatchExpressionCase" && u.type !== "MatchArrayPattern" && u.type !== "MatchObjectPatternProperty" && !Ce(t.originalText, r), s = uy(r), o = e.map(() => {
|
|
4066
|
+
let l = n();
|
|
4067
|
+
return s || (l = Te(2, l)), Fe(e, l, t);
|
|
4068
|
+
}, "patterns");
|
|
4069
|
+
if (s) return L(" | ", o);
|
|
4070
|
+
let p = [k(["| "]), L([T, "| "], o)];
|
|
4071
|
+
return Ke(e, t) ? D([A([k([F]), p]), F]) : u.type === "MatchArrayPattern" && u.elements.length > 1 ? D([A([k(["(", F]), p]), F, k(")")]) : D(a ? A(p) : p);
|
|
4072
|
+
}
|
|
4073
|
+
function sy(e, t, n) {
|
|
4074
|
+
let { node: r } = e, u = [De(e), "opaque type ", n("id"), n("typeParameters")];
|
|
4075
|
+
if (r.supertype && u.push(": ", n("supertype")), r.lowerBound || r.upperBound) {
|
|
4076
|
+
let a = [];
|
|
4077
|
+
r.lowerBound && a.push(A([T, "super ", n("lowerBound")])), r.upperBound && a.push(A([T, "extends ", n("upperBound")])), u.push(D(a));
|
|
4078
|
+
}
|
|
4079
|
+
return r.impltype && u.push(" = ", n("impltype")), u.push(t.semi ? ";" : ""), u;
|
|
4080
|
+
}
|
|
4081
|
+
function ps(e, t, n) {
|
|
4082
|
+
let { node: r } = e;
|
|
4083
|
+
return ["...", ...r.type === "TupleTypeSpreadElement" && r.label ? [n("label"), ": "] : [], n("typeAnnotation")];
|
|
4084
|
+
}
|
|
4085
|
+
function ls(e, t, n) {
|
|
4086
|
+
let { node: r } = e;
|
|
4087
|
+
return [r.variance ? n("variance") : "", n("label"), r.optional ? "?" : "", ": ", n("elementType")];
|
|
4088
|
+
}
|
|
4089
|
+
function cs(e, t, n) {
|
|
4090
|
+
let { node: r } = e, u = [De(e), "type ", n("id"), n("typeParameters")], a = r.type === "TSTypeAliasDeclaration" ? "typeAnnotation" : "right";
|
|
4091
|
+
return [Rt(e, t, n, u, " =", a), t.semi ? ";" : ""];
|
|
4092
|
+
}
|
|
4093
|
+
function oy(e, t, n) {
|
|
4094
|
+
let { node: r } = e;
|
|
4095
|
+
return ne(r).length === 1 && r.type.startsWith("TS") && !r[n][0].constraint && e.parent.type === "ArrowFunctionExpression" && !(t.filepath && /\.ts$/u.test(t.filepath));
|
|
4096
|
+
}
|
|
4097
|
+
function wt(e, t, n, r) {
|
|
4098
|
+
let { node: u } = e;
|
|
4099
|
+
if (!u[r]) return "";
|
|
4100
|
+
if (!Array.isArray(u[r])) return n(r);
|
|
4101
|
+
let a = on(e.grandparent), s = e.match((p) => !(p[r].length === 1 && _e(p[r][0])), void 0, (p, l) => l === "typeAnnotation", (p) => p.type === "Identifier", Ca);
|
|
4102
|
+
if (u[r].length === 0 || !s && (a || u[r].length === 1 && (u[r][0].type === "NullableTypeAnnotation" || Pl(u[r][0])))) return ["<", L(", ", e.map(n, r)), iy(e, t), ">"];
|
|
4103
|
+
let o = u.type === "TSTypeParameterInstantiation" ? "" : oy(e, t, r) ? "," : we(t) ? k(",") : "";
|
|
4104
|
+
return D(["<", A([F, L([",", T], e.map(n, r))]), o, F, ">"]);
|
|
4105
|
+
}
|
|
4106
|
+
function iy(e, t) {
|
|
4107
|
+
let { node: n } = e;
|
|
4108
|
+
if (!x(n, B.Dangling)) return "";
|
|
4109
|
+
let r = !x(n, B.Line), u = R(e, t, { indent: !r });
|
|
4110
|
+
return r ? u : [u, g];
|
|
4111
|
+
}
|
|
4112
|
+
function Ds(e, t, n) {
|
|
4113
|
+
let { node: r } = e, u = [r.const ? "const " : ""], a = r.type === "TSTypeParameter" ? n("name") : r.name;
|
|
4114
|
+
if (r.variance && u.push(n("variance")), r.in && u.push("in "), r.out && u.push("out "), u.push(a), r.bound && (r.usesExtendsBound && u.push(" extends "), u.push(Z(e, n, "bound"))), r.constraint) {
|
|
4115
|
+
let s = Symbol("constraint");
|
|
4116
|
+
u.push(" extends", D(A(T), { id: s }), ke, jt(n("constraint"), { groupId: s }));
|
|
4117
|
+
}
|
|
4118
|
+
if (r.default) {
|
|
4119
|
+
let s = Symbol("default");
|
|
4120
|
+
u.push(" =", D(A(T), { id: s }), ke, jt(n("default"), { groupId: s }));
|
|
4121
|
+
}
|
|
4122
|
+
return D(u);
|
|
4123
|
+
}
|
|
4124
|
+
function ys(e, t) {
|
|
4125
|
+
let { node: n } = e;
|
|
4126
|
+
return [n.type === "TSTypePredicate" && n.asserts ? "asserts " : n.type === "TypePredicate" && n.kind ? `${n.kind} ` : "", t("parameterName"), n.typeAnnotation ? [" is ", Z(e, t)] : ""];
|
|
4127
|
+
}
|
|
4128
|
+
function ds({ node: e }, t) {
|
|
4129
|
+
let n = e.type === "TSTypeQuery" ? "exprName" : "argument";
|
|
4130
|
+
return ["typeof ", t(n), t("typeArguments")];
|
|
4131
|
+
}
|
|
4132
|
+
function py(e, t, n) {
|
|
4133
|
+
let { node: r } = e;
|
|
4134
|
+
if (Fu(r)) return r.type.slice(0, -14).toLowerCase();
|
|
4135
|
+
switch (r.type) {
|
|
4136
|
+
case "ComponentDeclaration":
|
|
4137
|
+
case "DeclareComponent":
|
|
4138
|
+
case "ComponentTypeAnnotation":
|
|
4139
|
+
return XD(e, t, n);
|
|
4140
|
+
case "ComponentParameter":
|
|
4141
|
+
return UD(e, t, n);
|
|
4142
|
+
case "ComponentTypeParameter":
|
|
4143
|
+
return $D(e, t, n);
|
|
4144
|
+
case "HookDeclaration":
|
|
4145
|
+
return KD(e, t, n);
|
|
4146
|
+
case "DeclareHook":
|
|
4147
|
+
return HD(e, t, n);
|
|
4148
|
+
case "HookTypeAnnotation":
|
|
4149
|
+
return zD(e, t, n);
|
|
4150
|
+
case "DeclareFunction":
|
|
4151
|
+
return [De(e), "function ", n("id"), n("predicate"), t.semi ? ";" : ""];
|
|
4152
|
+
case "DeclareModule":
|
|
4153
|
+
return ["declare module ", n("id"), " ", n("body")];
|
|
4154
|
+
case "DeclareModuleExports":
|
|
4155
|
+
return ["declare module.exports", Z(e, n), t.semi ? ";" : ""];
|
|
4156
|
+
case "DeclareNamespace":
|
|
4157
|
+
return ["declare namespace ", n("id"), " ", n("body")];
|
|
4158
|
+
case "DeclareVariable":
|
|
4159
|
+
return [De(e), r.kind ?? "var", " ", n("id"), t.semi ? ";" : ""];
|
|
4160
|
+
case "DeclareExportDeclaration":
|
|
4161
|
+
case "DeclareExportAllDeclaration":
|
|
4162
|
+
return Va(e, t, n);
|
|
4163
|
+
case "DeclareOpaqueType":
|
|
4164
|
+
case "OpaqueType":
|
|
4165
|
+
return sy(e, t, n);
|
|
4166
|
+
case "DeclareTypeAlias":
|
|
4167
|
+
case "TypeAlias":
|
|
4168
|
+
return cs(e, t, n);
|
|
4169
|
+
case "IntersectionTypeAnnotation":
|
|
4170
|
+
return os(e, t, n);
|
|
4171
|
+
case "UnionTypeAnnotation":
|
|
4172
|
+
return la(e, t, n);
|
|
4173
|
+
case "ConditionalTypeAnnotation":
|
|
4174
|
+
return Tr(e, t, n);
|
|
4175
|
+
case "InferTypeAnnotation":
|
|
4176
|
+
return ss(e, t, n);
|
|
4177
|
+
case "FunctionTypeAnnotation":
|
|
4178
|
+
return us(e, t, n);
|
|
4179
|
+
case "TupleTypeAnnotation":
|
|
4180
|
+
return mr(e, t, n);
|
|
4181
|
+
case "TupleTypeLabeledElement":
|
|
4182
|
+
return ls(e, t, n);
|
|
4183
|
+
case "TupleTypeSpreadElement":
|
|
4184
|
+
return ps(e, t, n);
|
|
4185
|
+
case "GenericTypeAnnotation":
|
|
4186
|
+
return [n("id"), wt(e, t, n, "typeParameters")];
|
|
4187
|
+
case "IndexedAccessType":
|
|
4188
|
+
case "OptionalIndexedAccessType":
|
|
4189
|
+
return as(e, t, n);
|
|
4190
|
+
case "TypeAnnotation":
|
|
4191
|
+
return ya(e, t, n);
|
|
4192
|
+
case "TypeParameter":
|
|
4193
|
+
return Ds(e, t, n);
|
|
4194
|
+
case "TypeofTypeAnnotation":
|
|
4195
|
+
return ds(e, n);
|
|
4196
|
+
case "ExistsTypeAnnotation":
|
|
4197
|
+
return "*";
|
|
4198
|
+
case "ArrayTypeAnnotation":
|
|
4199
|
+
return Za(n);
|
|
4200
|
+
case "DeclareEnum":
|
|
4201
|
+
case "EnumDeclaration":
|
|
4202
|
+
return rs(e, n);
|
|
4203
|
+
case "EnumBooleanBody":
|
|
4204
|
+
case "EnumNumberBody":
|
|
4205
|
+
case "EnumBigIntBody":
|
|
4206
|
+
case "EnumStringBody":
|
|
4207
|
+
case "EnumSymbolBody":
|
|
4208
|
+
return GD(e, t, n);
|
|
4209
|
+
case "EnumBooleanMember":
|
|
4210
|
+
case "EnumNumberMember":
|
|
4211
|
+
case "EnumBigIntMember":
|
|
4212
|
+
case "EnumStringMember":
|
|
4213
|
+
case "EnumDefaultedMember":
|
|
4214
|
+
return ns(e, n);
|
|
4215
|
+
case "FunctionTypeParam": {
|
|
4216
|
+
let u = r.name ? n("name") : e.parent.this === r ? "this" : "";
|
|
4217
|
+
return [u, ae(e), u ? ": " : "", n("typeAnnotation")];
|
|
4218
|
+
}
|
|
4219
|
+
case "DeclareClass":
|
|
4220
|
+
case "DeclareInterface":
|
|
4221
|
+
case "InterfaceDeclaration":
|
|
4222
|
+
case "InterfaceTypeAnnotation":
|
|
4223
|
+
return Cr(e, t, n);
|
|
4224
|
+
case "ObjectTypeAnnotation":
|
|
4225
|
+
return gr(e, t, n);
|
|
4226
|
+
case "ClassImplements":
|
|
4227
|
+
case "InterfaceExtends":
|
|
4228
|
+
return [n("id"), n("typeParameters")];
|
|
4229
|
+
case "NullableTypeAnnotation":
|
|
4230
|
+
return ["?", n("typeAnnotation")];
|
|
4231
|
+
case "Variance": {
|
|
4232
|
+
let { kind: u } = r;
|
|
4233
|
+
return u === "plus" ? "+" : "-";
|
|
4234
|
+
}
|
|
4235
|
+
case "KeyofTypeAnnotation":
|
|
4236
|
+
return ["keyof ", n("argument")];
|
|
4237
|
+
case "ObjectTypeCallProperty":
|
|
4238
|
+
return [r.static ? "static " : "", n("value"), je(e, t)];
|
|
4239
|
+
case "ObjectTypeMappedTypeProperty":
|
|
4240
|
+
return QD(e, t, n);
|
|
4241
|
+
case "ObjectTypeIndexer":
|
|
4242
|
+
return [r.static ? "static " : "", r.variance ? n("variance") : "", "[", n("id"), r.id ? ": " : "", n("key"), "]: ", n("value"), je(e, t)];
|
|
4243
|
+
case "ObjectTypeProperty": {
|
|
4244
|
+
let u = "";
|
|
4245
|
+
return r.proto ? u = "proto " : r.static && (u = "static "), [u, r.kind !== "init" ? r.kind + " " : "", r.variance ? n("variance") : "", _t(e, t, n), ae(e), Jt(r) ? "" : ": ", n("value"), je(e, t)];
|
|
4246
|
+
}
|
|
4247
|
+
case "ObjectTypeInternalSlot":
|
|
4248
|
+
return [r.static ? "static " : "", "[[", n("id"), "]]", ae(e), r.method ? "" : ": ", n("value"), je(e, t)];
|
|
4249
|
+
case "ObjectTypeSpreadProperty":
|
|
4250
|
+
return $n(e, n);
|
|
4251
|
+
case "QualifiedTypeofIdentifier":
|
|
4252
|
+
case "QualifiedTypeIdentifier":
|
|
4253
|
+
return [n("qualification"), ".", n("id")];
|
|
4254
|
+
case "NullLiteralTypeAnnotation":
|
|
4255
|
+
return "null";
|
|
4256
|
+
case "BooleanLiteralTypeAnnotation":
|
|
4257
|
+
return String(r.value);
|
|
4258
|
+
case "StringLiteralTypeAnnotation":
|
|
4259
|
+
return Qe(yt(ie(r), t));
|
|
4260
|
+
case "NumberLiteralTypeAnnotation":
|
|
4261
|
+
return mt(ie(r));
|
|
4262
|
+
case "BigIntLiteralTypeAnnotation":
|
|
4263
|
+
return Un(ie(r));
|
|
4264
|
+
case "TypeCastExpression":
|
|
4265
|
+
return ["(", n("expression"), Z(e, n), ")"];
|
|
4266
|
+
case "TypePredicate":
|
|
4267
|
+
return ys(e, n);
|
|
4268
|
+
case "TypeOperator":
|
|
4269
|
+
return [r.operator, " ", n("typeAnnotation")];
|
|
4270
|
+
case "TypeParameterDeclaration":
|
|
4271
|
+
case "TypeParameterInstantiation":
|
|
4272
|
+
return wt(e, t, n, "params");
|
|
4273
|
+
case "InferredPredicate":
|
|
4274
|
+
case "DeclaredPredicate":
|
|
4275
|
+
return [e.key === "predicate" && e.parent.type !== "DeclareFunction" && !e.parent.returnType ? ": " : " ", "%checks", ...r.type === "DeclaredPredicate" ? ["(", n("value"), ")"] : []];
|
|
4276
|
+
case "AsExpression":
|
|
4277
|
+
case "AsConstExpression":
|
|
4278
|
+
case "SatisfiesExpression":
|
|
4279
|
+
return es(e, t, n);
|
|
4280
|
+
case "MatchExpression":
|
|
4281
|
+
case "MatchStatement":
|
|
4282
|
+
return ey(e, t, n);
|
|
4283
|
+
case "MatchExpressionCase":
|
|
4284
|
+
case "MatchStatementCase":
|
|
4285
|
+
return ty(e, t, n);
|
|
4286
|
+
case "MatchOrPattern":
|
|
4287
|
+
case "MatchAsPattern":
|
|
4288
|
+
case "MatchWildcardPattern":
|
|
4289
|
+
case "MatchLiteralPattern":
|
|
4290
|
+
case "MatchUnaryPattern":
|
|
4291
|
+
case "MatchIdentifierPattern":
|
|
4292
|
+
case "MatchMemberPattern":
|
|
4293
|
+
case "MatchBindingPattern":
|
|
4294
|
+
case "MatchObjectPattern":
|
|
4295
|
+
case "MatchObjectPatternProperty":
|
|
4296
|
+
case "MatchRestPattern":
|
|
4297
|
+
case "MatchArrayPattern":
|
|
4298
|
+
return ny(e, t, n);
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4301
|
+
function ly(e, t, n) {
|
|
4302
|
+
let { node: r } = e, u = r.parameters.length > 1 ? k(we(t) ? "," : "") : "", a = D([A([F, L([", ", F], e.map(n, "parameters"))]), u, F]);
|
|
4303
|
+
return [e.key === "body" && e.parent.type === "ClassBody" && r.static ? "static " : "", r.readonly ? "readonly " : "", "[", r.parameters ? a : "", "]", Z(e, n), je(e, t)];
|
|
4304
|
+
}
|
|
4305
|
+
function au(e, t, n) {
|
|
4306
|
+
let { node: r } = e;
|
|
4307
|
+
return [r.postfix ? "" : n, Z(e, t), r.postfix ? n : ""];
|
|
4308
|
+
}
|
|
4309
|
+
function cy(e, t, n) {
|
|
4310
|
+
let { node: r } = e, u = [], a = r.kind && r.kind !== "method" ? `${r.kind} ` : "";
|
|
4311
|
+
u.push(Dn(r), a, r.computed ? "[" : "", n("key"), r.computed ? "]" : "", ae(e));
|
|
4312
|
+
let s = st(e, t, n, !1, !0), o = Z(e, n, "returnType"), p = gt(r, o);
|
|
4313
|
+
return u.push(p ? D(s) : s), r.returnType && u.push(D(o)), [D(u), je(e, t)];
|
|
4314
|
+
}
|
|
4315
|
+
function Dy(e, t, n) {
|
|
4316
|
+
let { node: r } = e;
|
|
4317
|
+
return [De(e), r.kind === "global" ? "" : `${r.kind} `, n("id"), r.body ? [" ", D(n("body"))] : t.semi ? ";" : ""];
|
|
4318
|
+
}
|
|
4319
|
+
function yy(e, t, n) {
|
|
4320
|
+
let { node: r } = e, u = !(ee(r.expression) || he(r.expression)), a = D(["<", A([F, n("typeAnnotation")]), F, ">"]), s = [k("("), A([F, n("expression")]), F, k(")")];
|
|
4321
|
+
return u ? ze([[a, n("expression")], [a, D(s, { shouldBreak: !0 })], [a, n("expression")]]) : D([a, n("expression")]);
|
|
4322
|
+
}
|
|
4323
|
+
function dy(e, t, n) {
|
|
4324
|
+
let { node: r } = e;
|
|
4325
|
+
if (r.type.startsWith("TS")) {
|
|
4326
|
+
if (Eu(r)) return r.type.slice(2, -7).toLowerCase();
|
|
4327
|
+
switch (r.type) {
|
|
4328
|
+
case "TSThisType":
|
|
4329
|
+
return "this";
|
|
4330
|
+
case "TSTypeAssertion":
|
|
4331
|
+
return yy(e, t, n);
|
|
4332
|
+
case "TSDeclareFunction":
|
|
4333
|
+
return Ta(e, t, n);
|
|
4334
|
+
case "TSExportAssignment":
|
|
4335
|
+
return ["export = ", n("expression"), t.semi ? ";" : ""];
|
|
4336
|
+
case "TSModuleBlock":
|
|
4337
|
+
return La(e, t, n);
|
|
4338
|
+
case "TSInterfaceBody":
|
|
4339
|
+
case "TSTypeLiteral":
|
|
4340
|
+
return gr(e, t, n);
|
|
4341
|
+
case "TSTypeAliasDeclaration":
|
|
4342
|
+
return cs(e, t, n);
|
|
4343
|
+
case "TSQualifiedName":
|
|
4344
|
+
return [n("left"), ".", n("right")];
|
|
4345
|
+
case "TSAbstractMethodDefinition":
|
|
4346
|
+
case "TSDeclareMethod":
|
|
4347
|
+
return _a(e, t, n);
|
|
4348
|
+
case "TSAbstractAccessorProperty":
|
|
4349
|
+
case "TSAbstractPropertyDefinition":
|
|
4350
|
+
return Wa(e, t, n);
|
|
4351
|
+
case "TSInterfaceHeritage":
|
|
4352
|
+
case "TSClassImplements":
|
|
4353
|
+
case "TSInstantiationExpression":
|
|
4354
|
+
return [n("expression"), n("typeArguments")];
|
|
4355
|
+
case "TSTemplateLiteralType":
|
|
4356
|
+
return Zu(e, t, n);
|
|
4357
|
+
case "TSNamedTupleMember":
|
|
4358
|
+
return ls(e, t, n);
|
|
4359
|
+
case "TSRestType":
|
|
4360
|
+
return ps(e, t, n);
|
|
4361
|
+
case "TSOptionalType":
|
|
4362
|
+
return [n("typeAnnotation"), "?"];
|
|
4363
|
+
case "TSInterfaceDeclaration":
|
|
4364
|
+
return Cr(e, t, n);
|
|
4365
|
+
case "TSTypeParameterDeclaration":
|
|
4366
|
+
case "TSTypeParameterInstantiation":
|
|
4367
|
+
return wt(e, t, n, "params");
|
|
4368
|
+
case "TSTypeParameter":
|
|
4369
|
+
return Ds(e, t, n);
|
|
4370
|
+
case "TSAsExpression":
|
|
4371
|
+
case "TSSatisfiesExpression":
|
|
4372
|
+
return es(e, t, n);
|
|
4373
|
+
case "TSArrayType":
|
|
4374
|
+
return Za(n);
|
|
4375
|
+
case "TSPropertySignature":
|
|
4376
|
+
return [r.readonly ? "readonly " : "", _t(e, t, n), ae(e), Z(e, n), je(e, t)];
|
|
4377
|
+
case "TSParameterProperty":
|
|
4378
|
+
return [Dn(r), r.static ? "static " : "", r.override ? "override " : "", r.readonly ? "readonly " : "", n("parameter")];
|
|
4379
|
+
case "TSTypeQuery":
|
|
4380
|
+
return ds(e, n);
|
|
4381
|
+
case "TSIndexSignature":
|
|
4382
|
+
return ly(e, t, n);
|
|
4383
|
+
case "TSTypePredicate":
|
|
4384
|
+
return ys(e, n);
|
|
4385
|
+
case "TSNonNullExpression":
|
|
4386
|
+
return [n("expression"), "!"];
|
|
4387
|
+
case "TSImportType":
|
|
4388
|
+
return [un(e, t, n), r.qualifier ? [".", n("qualifier")] : "", wt(e, t, n, "typeArguments")];
|
|
4389
|
+
case "TSLiteralType":
|
|
4390
|
+
return n("literal");
|
|
4391
|
+
case "TSIndexedAccessType":
|
|
4392
|
+
return as(e, t, n);
|
|
4393
|
+
case "TSTypeOperator":
|
|
4394
|
+
return [r.operator, " ", n("typeAnnotation")];
|
|
4395
|
+
case "TSMappedType":
|
|
4396
|
+
return ZD(e, t, n);
|
|
4397
|
+
case "TSMethodSignature":
|
|
4398
|
+
return cy(e, t, n);
|
|
4399
|
+
case "TSNamespaceExportDeclaration":
|
|
4400
|
+
return ["export as namespace ", n("id"), t.semi ? ";" : ""];
|
|
4401
|
+
case "TSEnumDeclaration":
|
|
4402
|
+
return rs(e, n);
|
|
4403
|
+
case "TSEnumBody":
|
|
4404
|
+
return ts(e, t, n);
|
|
4405
|
+
case "TSEnumMember":
|
|
4406
|
+
return ns(e, n);
|
|
4407
|
+
case "TSImportEqualsDeclaration":
|
|
4408
|
+
return ["import ", Ka(r, !1), n("id"), " = ", n("moduleReference"), t.semi ? ";" : ""];
|
|
4409
|
+
case "TSExternalModuleReference":
|
|
4410
|
+
return un(e, t, n);
|
|
4411
|
+
case "TSModuleDeclaration":
|
|
4412
|
+
return Dy(e, t, n);
|
|
4413
|
+
case "TSConditionalType":
|
|
4414
|
+
return Tr(e, t, n);
|
|
4415
|
+
case "TSInferType":
|
|
4416
|
+
return ss(e, t, n);
|
|
4417
|
+
case "TSIntersectionType":
|
|
4418
|
+
return os(e, t, n);
|
|
4419
|
+
case "TSUnionType":
|
|
4420
|
+
return la(e, t, n);
|
|
4421
|
+
case "TSFunctionType":
|
|
4422
|
+
case "TSCallSignatureDeclaration":
|
|
4423
|
+
case "TSConstructorType":
|
|
4424
|
+
case "TSConstructSignatureDeclaration":
|
|
4425
|
+
return us(e, t, n);
|
|
4426
|
+
case "TSTupleType":
|
|
4427
|
+
return mr(e, t, n);
|
|
4428
|
+
case "TSTypeReference":
|
|
4429
|
+
return [n("typeName"), wt(e, t, n, "typeArguments")];
|
|
4430
|
+
case "TSTypeAnnotation":
|
|
4431
|
+
return ya(e, t, n);
|
|
4432
|
+
case "TSEmptyBodyFunctionExpression":
|
|
4433
|
+
return Fr(e, t, n);
|
|
4434
|
+
case "TSJSDocAllType":
|
|
4435
|
+
return "*";
|
|
4436
|
+
case "TSJSDocUnknownType":
|
|
4437
|
+
return "?";
|
|
4438
|
+
case "TSJSDocNullableType":
|
|
4439
|
+
return au(e, n, "?");
|
|
4440
|
+
case "TSJSDocNonNullableType":
|
|
4441
|
+
return au(e, n, "!");
|
|
4442
|
+
case "TSParenthesizedType":
|
|
4443
|
+
default:
|
|
4444
|
+
throw new Ct(r, "TypeScript");
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
4447
|
+
}
|
|
4448
|
+
function fy(e, t, n, r) {
|
|
4449
|
+
for (let u of [Oc, Ic, py, dy, JD]) {
|
|
4450
|
+
let a = u(e, t, n, r);
|
|
4451
|
+
if (a !== void 0) return a;
|
|
4452
|
+
}
|
|
4453
|
+
}
|
|
4454
|
+
var my = I(["ClassMethod", "ClassPrivateMethod", "ClassProperty", "ClassAccessorProperty", "AccessorProperty", "TSAbstractAccessorProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "ClassPrivateProperty", "MethodDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod"]);
|
|
4455
|
+
function Fy(e, t, n, r) {
|
|
4456
|
+
var d;
|
|
4457
|
+
e.isRoot && ((d = t.__onHtmlBindingRoot) == null || d.call(t, e.node, t));
|
|
4458
|
+
let { node: u } = e, a = Ar(e) ? t.originalText.slice(M(u), j(u)) : fy(e, t, n, r);
|
|
4459
|
+
if (!a) return "";
|
|
4460
|
+
if (my(u)) return a;
|
|
4461
|
+
let s = W(u.decorators), o = _c(e, t, n), p = u.type === "ClassExpression";
|
|
4462
|
+
if (s && !p) return Mn(a, (f) => D([o, f]));
|
|
4463
|
+
let l = Ke(e, t), y = Dc(e, t);
|
|
4464
|
+
return !o && !l && !y ? a : Mn(a, (f) => [y ? ";" : "", l ? "(" : "", l && p && s ? [A([T, o, f]), T] : [o, f], l ? ")" : ""]);
|
|
4465
|
+
}
|
|
4466
|
+
var su = Fy, Ey = { experimental_avoidAstMutation: !0 }, Ay = [{ 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 }], fs = {};
|
|
4467
|
+
Gn(fs, { getVisitorKeys: () => hy, massageAstNode: () => ms, print: () => xy });
|
|
4468
|
+
var it = [[]], gy = { JsonRoot: ["node"], ArrayExpression: ["elements"], ObjectExpression: ["properties"], ObjectProperty: ["key", "value"], UnaryExpression: ["argument"], NullLiteral: it[0], BooleanLiteral: it[0], StringLiteral: it[0], NumericLiteral: it[0], Identifier: it[0], TemplateLiteral: ["quasis"], TemplateElement: it[0] }, Cy = fu(gy), hy = Cy;
|
|
4469
|
+
function xy(e, t, n) {
|
|
4470
|
+
let { node: r } = e;
|
|
4471
|
+
switch (r.type) {
|
|
4472
|
+
case "JsonRoot":
|
|
4473
|
+
return [n("node"), g];
|
|
4474
|
+
case "ArrayExpression": {
|
|
4475
|
+
if (r.elements.length === 0) return "[]";
|
|
4476
|
+
let u = e.map(() => e.node === null ? "null" : n(), "elements");
|
|
4477
|
+
return ["[", A([g, L([",", g], u)]), g, "]"];
|
|
4478
|
+
}
|
|
4479
|
+
case "ObjectExpression":
|
|
4480
|
+
return r.properties.length === 0 ? "{}" : ["{", A([g, L([",", g], e.map(n, "properties"))]), g, "}"];
|
|
4481
|
+
case "ObjectProperty":
|
|
4482
|
+
return [n("key"), ": ", n("value")];
|
|
4483
|
+
case "UnaryExpression":
|
|
4484
|
+
return [r.operator === "+" ? "" : r.operator, n("argument")];
|
|
4485
|
+
case "NullLiteral":
|
|
4486
|
+
return "null";
|
|
4487
|
+
case "BooleanLiteral":
|
|
4488
|
+
return r.value ? "true" : "false";
|
|
4489
|
+
case "StringLiteral":
|
|
4490
|
+
return JSON.stringify(r.value);
|
|
4491
|
+
case "NumericLiteral":
|
|
4492
|
+
return ou(e) ? JSON.stringify(String(r.value)) : JSON.stringify(r.value);
|
|
4493
|
+
case "Identifier":
|
|
4494
|
+
return ou(e) ? JSON.stringify(r.name) : r.name;
|
|
4495
|
+
case "TemplateLiteral":
|
|
4496
|
+
return n(["quasis", 0]);
|
|
4497
|
+
case "TemplateElement":
|
|
4498
|
+
return JSON.stringify(r.value.cooked);
|
|
4499
|
+
default:
|
|
4500
|
+
throw new Ct(r, "JSON");
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4503
|
+
function ou(e) {
|
|
4504
|
+
return e.key === "key" && e.parent.type === "ObjectProperty";
|
|
4505
|
+
}
|
|
4506
|
+
var Ty = /* @__PURE__ */ new Set(["start", "end", "extra", "loc", "comments", "leadingComments", "trailingComments", "innerComments", "errors", "range", "tokens"]);
|
|
4507
|
+
function ms(e, t) {
|
|
4508
|
+
let { type: n } = e;
|
|
4509
|
+
if (n === "ObjectProperty") {
|
|
4510
|
+
let { key: r } = e;
|
|
4511
|
+
r.type === "Identifier" ? t.key = { type: "StringLiteral", value: r.name } : r.type === "NumericLiteral" && (t.key = { type: "StringLiteral", value: String(r.value) });
|
|
4512
|
+
return;
|
|
4513
|
+
}
|
|
4514
|
+
if (n === "UnaryExpression" && e.operator === "+") return t.argument;
|
|
4515
|
+
if (n === "ArrayExpression") {
|
|
4516
|
+
for (let [r, u] of e.elements.entries()) u === null && t.elements.splice(r, 0, { type: "NullLiteral" });
|
|
4517
|
+
return;
|
|
4518
|
+
}
|
|
4519
|
+
if (n === "TemplateLiteral") return { type: "StringLiteral", value: e.quasis[0].value.cooked };
|
|
4520
|
+
}
|
|
4521
|
+
ms.ignoredProperties = Ty;
|
|
4522
|
+
var bt = { bracketSpacing: { category: "Common", type: "boolean", default: !0, 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: !1, description: "Use single quotes instead of double quotes." }, bracketSameLine: { category: "Common", type: "boolean", default: !1, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: !1, description: "Enforce single attribute per line in HTML, Vue and JSX." } }, Re = "JavaScript", Sy = { arrowParens: { category: Re, 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: bt.bracketSameLine, objectWrap: bt.objectWrap, bracketSpacing: bt.bracketSpacing, jsxBracketSameLine: { category: Re, type: "boolean", description: "Put > on the last line instead of at a new line.", deprecated: "2.4.0" }, semi: { category: Re, type: "boolean", default: !0, description: "Print semicolons.", oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them." }, experimentalOperatorPosition: { category: Re, 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: Re, type: "boolean", default: !1, 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: bt.singleQuote, jsxSingleQuote: { category: Re, type: "boolean", default: !1, description: "Use single quotes in JSX." }, quoteProps: { category: Re, 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: Re, 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: bt.singleAttributePerLine }, by = Sy, By = { estree: pu, "estree-json": fs }, vy = [...Ss, ...Ay];
|
|
4523
|
+
export {
|
|
4524
|
+
Ts as default,
|
|
4525
|
+
vy as languages,
|
|
4526
|
+
by as options,
|
|
4527
|
+
By as printers
|
|
4528
|
+
};
|