UNPKG

prettier-plugin-embed

Version:

A configurable Prettier plugin to format embedded languages in JS/TS files.

1,485 lines 100 kB
import { builders as A, utils as bi } from "prettier/doc"; import Oi from "prettier/parser-babel"; import Gi from "prettier/parser-espree"; import Ii from "prettier/parser-flow"; import xi from "prettier/parser-meriyah"; import Pi from "prettier/parser-typescript"; import { printers as qi } from "prettier/plugins/estree.mjs"; import { resolveConfigFile as ji } from "prettier"; const { group: Fe, indent: Ri, softline: ze, lineSuffixBoundary: Bi, addAlignmentToDoc: wi, align: Ui, hardline: Ci } = A, { mapDoc: Wi, replaceEndOfLine: Fi } = bi; function zi(t, e) { let n = 0; for (const i of t) i === " " ? n = n + e - n % e : n++; return n; } function Je(t, e) { const n = t.lastIndexOf(` `); if (n === -1) return 0; const r = t.slice(n + 1).match(/^[\t ]*/)?.[0] ?? ""; return zi(r, e); } function Ji(t, e, n) { let i = e; const o = t.quasis[i]?.value.raw ?? ""; if (o.includes(` `)) return { indentSize: Je(o, n), previousQuasiText: o }; for (; i-- > 0; ) { const s = t.quasis[i]; if (!s) break; const l = s.value.raw; if (l.includes(` `)) return { indentSize: Je(l, n), previousQuasiText: o }; } return { indentSize: 0, previousQuasiText: o }; } function Xi(t, e, n, i, r) { const { node: o } = t; let s = e(); o?.comments?.length && (s = Fe([Ri([ze, s]), ze])); const { indentSize: l, previousQuasiText: p } = Ji( n, i, r ); let f = s; return f = l === 0 && p.endsWith(` `) ? Ui(Number.NEGATIVE_INFINITY, f) : wi(f, l, r), Fe(["${", f, Bi, "}"]); } function L(t, e, n) { const r = t.node; return t.map( (o, s) => Xi( o, e, r, s, 2 ), "expressions" ); } function M(t, e, n, i = !1) { return Wi(t, (o) => { if (typeof o != "string") return o; const s = [], l = o.split(e); for (let p = 0; p < l.length; p++) { let f = l[p]; if (p % 2 === 0) { if (!f) continue; if (f = f.replaceAll(/([\\`]|\${)/g, "\\$1"), i === "literalline") s.push(Fi(f)); else if (i === "hardline") for (const d of f.split(/(\n)/)) d === ` ` ? s.push(Ci) : s.push(d); else s.push(f); } else { const d = Number(f); s.push(n[d]); } } return s; }); } function Hi(t, e, n) { if (e === n) { t.unshift(e); return; } let i = 0, r = t.length; for (; i < r; ) { const o = i + r >>> 1; if (t[o] === n) { t.push(e); return; } t[o] < e ? i = o + 1 : r = o; } t.splice(i, 0, e); } const ye = (() => { const t = [...Array(26).keys()].map((e) => String.fromCharCode(e + 97)).concat([...Array(10).keys()].map((e) => `${e}`)); return () => { let n = ""; for (let i = 0; i < 16; ++i) n += t[Number.parseInt((Math.random() * t.length).toFixed(0), 10) % t.length]; return n; }; })(); function N(t = "p", e = "") { const n = ye(), i = ye(), r = Xe(t), o = Xe(e), s = (p) => `${t}${n}${p}${i}${e}`, l = new RegExp( `${r}${n}(\\d+)${i}${o}`, "ig" ); return { createPlaceholder: s, placeholderRegex: l }; } function Xe(t) { return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); } function T(t) { return `${t}Identifiers`; } function S(t) { return `${t}Comments`; } function v(t) { return `${t}Tags`; } function Qi(t) { return `${t}Plugin`; } function G(t) { return `${t}Parser`; } const $ = "9ff2b366e8ca4c97b9aed1a29b5b94ed", { line: He, group: P, indent: Qe, softline: Ve } = A, Vi = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N( "@prettier-placeholder" ), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: s.embeddedCssParser ?? "scss" }), a = M( D, f, b, // Use literalline to preserve original indentation in CSS comments // https://github.com/prettier/prettier/blob/3bfabd012873e5022f341aca75566966d91870f1/src/language-js/embed/css.js#L52 "literalline" ); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return P([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [P(a)] : Qe([P(a)]), c, "`" ]); const g = u.length ? He : Ve, E = c.length ? He : Ve; return P([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, P(a)] : Qe([g, P(a)]), E, "`" ]); }, ce = "embeddedCss", Yi = ["css"], Ki = ["css", "less", "scss"], Zi = T(ce), Ye = S(ce), Ke = v(ce), er = G(ce), tr = { [Zi]: { category: "Embed", type: "string", array: !0, default: [{ value: [...Yi] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded CSS language.", deprecated: `Please use \`${Ye}\` or \`${Ke}\`.` }, [Ye]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded CSS language." }, [Ke]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded CSS language." }, [er]: { category: "Embed", type: "choice", default: "scss", description: "The parser used to parse the embedded CSS language.", choices: Ki.map((t) => ({ value: t, description: `Use the "${t}" parser.` })) } }, nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: Vi, language: ce, options: tr }, Symbol.toStringTag, { value: "Module" })), { line: Ze, group: q, indent: et, softline: tt } = A, ir = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: s.embeddedEsParser ?? "babel" }), a = M(D, f, b); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return q([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [q(a)] : et([q(a)]), c, "`" ]); const g = u.length ? Ze : tt, E = c.length ? Ze : tt; return q([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, q(a)] : et([g, q(a)]), E, "`" ]); }, de = "embeddedEs", rr = [ "js", "jsx", "es", "es6", "mjs", "cjs", "pac", "javascript" ], sr = [ "babel", "babel-flow", "acorn", "espree", "flow", "meriyah" ], or = T(de), nt = S(de), it = v(de), ar = G(de), lr = { [or]: { category: "Embed", type: "string", array: !0, default: [{ value: [...rr] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language.", deprecated: `Please use \`${nt}\` or \`${it}\`.` }, [nt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language." }, [it]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language." }, [ar]: { category: "Embed", type: "choice", default: "babel", description: "The parser used to parse the embedded ECMASCript/JavaScript language.", choices: sr.map((t) => ({ value: t, description: `Use the "${t}" parser.` })) } }, cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: ir, language: de, options: lr }, Symbol.toStringTag, { value: "Module" })), { line: rt, group: j, indent: st, softline: ot } = A, dr = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "glsl-parser" }), a = M(D, f, b); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return j([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [j(a)] : st([j(a)]), c, "`" ]); const g = u.length ? rt : ot, E = c.length ? rt : ot; return j([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, j(a)] : st([g, j(a)]), E, "`" ]); }, $e = "embeddedGlsl", ur = ["glsl", "shader"], pr = T($e), at = S($e), lt = v($e), gr = { [pr]: { category: "Embed", type: "string", array: !0, default: [{ value: [...ur] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin.", deprecated: `Please use \`${at}\` or \`${lt}\`.` }, [at]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin." }, [lt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin." } }, mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: dr, language: $e, options: gr }, Symbol.toStringTag, { value: "Module" })), { line: ct, group: R, indent: dt, softline: ut } = A, hr = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "graphql" }), a = M(D, f, b); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return R([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [R(a)] : dt([R(a)]), c, "`" ]); const g = u.length ? ct : ut, E = c.length ? ct : ut; return R([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, R(a)] : dt([g, R(a)]), E, "`" ]); }, Te = "embeddedGraphql", fr = ["graphql", "gql"], Er = T(Te), pt = S(Te), gt = v(Te), br = { [Er]: { category: "Embed", type: "string", array: !0, default: [{ value: [...fr] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded GraphQL language.", deprecated: `Please use \`${pt}\` or \`${gt}\`.` }, [pt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded GraphQL language." }, [gt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded GraphQL language." } }, _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: hr, language: Te, options: br }, Symbol.toStringTag, { value: "Module" })), { line: mt, group: B, indent: ht, softline: ft } = A, { mapDoc: yr } = bi, Dr = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: s.embeddedHtmlParser ?? "html" }), a = yr(D, (m) => { if (typeof m != "string") return m; const h = [], _ = m.split(f); for (let k = 0; k < _.length; k++) { let O = _[k]; if (k % 2 === 0) { if (!O) continue; O = O.replaceAll(/([\\`]|\${)/g, "\\$1"), s.__embeddedInHtml && (O = O.replaceAll(/<\/(?=script\b)/gi, "<\\/")), h.push(O); } else { const ki = Number(O); h.push(b[ki]); } } return h; }); if (s.htmlWhitespaceSensitivity === "strict" || // TODO: is css mode should be included here? s.htmlWhitespaceSensitivity === "css" || s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return B([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [B(a)] : ht([B(a)]), c, "`" ]); const g = u.length ? mt : ft, E = c.length ? mt : ft; return B([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, B(a)] : ht([g, B(a)]), E, "`" ]); }, ue = "embeddedHtml", $r = ["html", "xhtml"], Tr = ["html", "vue", "angular", "lwc"], vr = T(ue), Et = S(ue), bt = v(ue), Ar = G(ue), Sr = { [vr]: { category: "Embed", type: "string", array: !0, default: [{ value: [...$r] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded HTML language.", deprecated: `Please use \`${Et}\` or \`${bt}\`.` }, [Et]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded HTML language." }, [bt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded HTML language." }, [Ar]: { category: "Embed", type: "choice", default: "html", description: "The parser used to parse the embedded HTML language.", choices: Tr.map((t) => ({ value: t, description: `Use the "${t}" parser.` })) } }, Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: Dr, language: ue, options: Sr }, Symbol.toStringTag, { value: "Module" })), { line: _t, group: w, indent: yt, softline: Dt } = A, Lr = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "ini" }), a = M(D, f, b); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return w([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [w(a)] : yt([w(a)]), c, "`" ]); const g = u.length ? _t : Dt, E = c.length ? _t : Dt; return w([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, w(a)] : yt([g, w(a)]), E, "`" ]); }, ve = "embeddedIni", Nr = ["ini", "cfg", "pro"], kr = T(ve), $t = S(ve), Tt = v(ve), Or = { [kr]: { category: "Embed", type: "string", array: !0, default: [{ value: [...Nr] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin.", deprecated: `Please use \`${$t}\` or \`${Tt}\`.` }, [$t]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin." }, [Tt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin." } }, Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: Lr, language: ve, options: Or }, Symbol.toStringTag, { value: "Module" })), { group: U, line: vt, softline: At, indent: St } = A, Ir = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "java" }), a = M( D, f, b, "hardline" ); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return U([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [U(a)] : St([U(a)]), c, "`" ]); const g = u.length ? vt : At, E = c.length ? vt : At; return U([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, U(a)] : St([g, U(a)]), E, "`" ]); }, Ae = "embeddedJava", xr = ["java"], Pr = T(Ae), Mt = S(Ae), Lt = v(Ae), qr = { [Pr]: { category: "Embed", type: "string", array: !0, default: [{ value: [...xr] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin.", deprecated: `Please use \`${Mt}\` or \`${Lt}\`.` }, [Mt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin." }, [Lt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin." } }, jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: Ir, language: Ae, options: qr }, Symbol.toStringTag, { value: "Module" })), { line: Nt, group: C, indent: kt, softline: Ot } = A, Rr = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = Br(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: s.embeddedJsonParser ?? "json" }), a = M(D, f, b); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return C([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [C(a)] : kt([C(a)]), c, "`" ]); const g = u.length ? Nt : Ot, E = c.length ? Nt : Ot; return C([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, C(a)] : kt([g, C(a)]), E, "`" ]); }; function Br() { const t = ye(), e = ye(), n = (r) => `'0${t}${r}${e}'`, i = new RegExp( `["']?0${t}(\\d+)${e}['"]?`, "ig" ); return { createPlaceholder: n, placeholderRegex: i }; } const pe = "embeddedJson", wr = ["json", "jsonl"], Ur = ["json", "json5", "jsonc", "json-stringify"], Cr = T(pe), Gt = S(pe), It = v(pe), Wr = G(pe), Fr = { [Cr]: { category: "Embed", type: "string", array: !0, default: [{ value: [...wr] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded JSON language.", deprecated: `Please use \`${Gt}\` or \`${It}\`.` }, [Gt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded JSON language." }, [It]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded JSON language." }, [Wr]: { category: "Embed", type: "choice", default: "json", description: "The parser used to parse the embedded JSON language.", choices: Ur.map((t) => ({ value: t, description: `Use the "${t}" parser.` })) } }, zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: Rr, language: pe, options: Fr }, Symbol.toStringTag, { value: "Module" })), { line: xt, group: W, indent: Pt, softline: qt } = A, Jr = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N("$p"), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "JSONata" }), a = M(D, f, b); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return W([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [W(a)] : Pt([W(a)]), c, "`" ]); const g = u.length ? xt : qt, E = c.length ? xt : qt; return W([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, W(a)] : Pt([g, W(a)]), E, "`" ]); }, Se = "embeddedJsonata", Xr = ["jsonata"], Hr = T(Se), jt = S(Se), Rt = v(Se), Qr = { [Hr]: { category: "Embed", type: "string", array: !0, default: [{ value: [...Xr] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin.", deprecated: `Please use \`${jt}\` or \`${Rt}\`.` }, [jt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin." }, [Rt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin." } }, Vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: Jr, language: Se, options: Qr }, Symbol.toStringTag, { value: "Module" })), { line: Bt, group: F, indent: wt, softline: Ut } = A, Yr = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "latex-parser" }), a = M(D, f, b); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return F([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [F(a)] : wt([F(a)]), c, "`" ]); const g = u.length ? Bt : Ut, E = c.length ? Bt : Ut; return F([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, F(a)] : wt([g, F(a)]), E, "`" ]); }, Me = "embeddedLatex", Kr = [ "latex", "tex", "aux", "cls", "bbl", "bib", "toc", "sty" ], Zr = T(Me), Ct = S(Me), Wt = v(Me), es = { [Zr]: { category: "Embed", type: "string", array: !0, default: [{ value: [...Kr] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin.", deprecated: `Please use \`${Ct}\` or \`${Wt}\`.` }, [Ct]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin." }, [Wt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin." } }, ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: Yr, language: Me, options: es }, Symbol.toStringTag, { value: "Module" })); function Ft(t, e) { var n = Object.keys(t); if (Object.getOwnPropertySymbols) { var i = Object.getOwnPropertySymbols(t); e && (i = i.filter(function(r) { return Object.getOwnPropertyDescriptor(t, r).enumerable; })), n.push.apply(n, i); } return n; } function zt(t) { for (var e = 1; e < arguments.length; e++) { var n = arguments[e] != null ? arguments[e] : {}; e % 2 ? Ft(Object(n), !0).forEach(function(i) { ns(t, i, n[i]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Ft(Object(n)).forEach(function(i) { Object.defineProperty(t, i, Object.getOwnPropertyDescriptor(n, i)); }); } return t; } function ns(t, e, n) { return e = is(e), e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t; } function is(t) { var e = rs(t, "string"); return typeof e == "symbol" ? e : String(e); } function rs(t, e) { if (typeof t != "object" || t === null) return t; var n = t[Symbol.toPrimitive]; if (n !== void 0) { var i = n.call(t, e); if (typeof i != "object") return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return (e === "string" ? String : Number)(t); } const _i = yi({}); function yi(t) { return e.withOptions = (n) => yi(zt(zt({}, t), n)), e; function e(n, ...i) { const r = typeof n == "string" ? [n] : n.raw, { alignValues: o = !1, escapeSpecialCharacters: s = Array.isArray(n), trimWhitespace: l = !0 } = t; let p = ""; for (let u = 0; u < r.length; u++) { let c = r[u]; if (s && (c = c.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{")), p += c, u < i.length) { const y = o ? ss(i[u], p) : i[u]; p += y; } } const f = p.split(` `); let d = null; for (const u of f) { const c = u.match(/^(\s+)\S+/); if (c) { const y = c[1].length; d ? d = Math.min(d, y) : d = y; } } if (d !== null) { const u = d; p = f.map((c) => c[0] === " " || c[0] === " " ? c.slice(u) : c).join(` `); } return l && (p = p.trim()), s && (p = p.replace(/\\n/g, ` `)), typeof Bun < "u" && (p = p.replace( // Matches e.g. \\u{1f60a} or \\u5F1F /\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g, (u, c, y) => { var b; const D = (b = c ?? y) !== null && b !== void 0 ? b : ""; return String.fromCodePoint(parseInt(D, 16)); } )), p; } } function ss(t, e) { if (typeof t != "string" || !t.includes(` `)) return t; const i = e.slice(e.lastIndexOf(` `) + 1).match(/^(\s+)/); if (i) { const r = i[1]; return t.replace(/\n/g, ` ${r}`); } return t; } const { line: Jt, group: se, indent: Xt, softline: je, dedentToRoot: Ht, literalline: os } = A, as = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t( // use `dedent` to fix unstable embedded markdown indentation with the `useTabs` option // https://github.com/Sec-ant/prettier-plugin-embed/pull/91#issuecomment-1963760555 // https://github.com/prettier/prettier/blob/1079517b32e5bb145afa7acba448af51f8a7b6e6/src/language-js/embed/markdown.js#L15-L19 _i(y), { ...s, parser: s.embeddedMarkdownParser ?? "markdown", // this will change the code fence delimiter from ``` to ~~~ // https://github.com/prettier/prettier/blob/1079517b32e5bb145afa7acba448af51f8a7b6e6/src/language-markdown/embed.js#L15 __inJsTemplate: !0 } ), a = M( D, f, b, "hardline" ); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return se([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? Ht(se(a)) : Xt([se(a)]), c, "`" ]); const g = u.length ? Jt : je, E = c.length ? Jt : je; return s.noEmbeddedMultiLineIndentation?.includes(r) ? ["`", os, Ht(a), je, "`"] : se([ "`", Xt([g, se(a)]), E, "`" ]); }, ge = "embeddedMarkdown", ls = ["md", "markdown"], cs = ["markdown", "mdx", "remark"], ds = T(ge), Qt = S(ge), Vt = v(ge), us = G(ge), ps = { [ds]: { category: "Embed", type: "string", array: !0, default: [{ value: [...ls] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Markdown language.", deprecated: `Please use \`${Qt}\` or \`${Vt}\`.` }, [Qt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded Markdown language." }, [Vt]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded Markdown language." }, [us]: { category: "Embed", type: "choice", default: "markdown", description: "The parser used to parse the embedded Markdown language.", choices: cs.map((t) => ({ value: t, description: `Use the "${t}" parser.` })) } }, gs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: as, language: ge, options: ps }, Symbol.toStringTag, { value: "Module" })), { line: Yt, group: z, indent: Kt, softline: Zt } = A, ms = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "nginx" }), a = M(D, f, b); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return z([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [z(a)] : Kt([z(a)]), c, "`" ]); const g = u.length ? Yt : Zt, E = c.length ? Yt : Zt; return z([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, z(a)] : Kt([g, z(a)]), E, "`" ]); }, Le = "embeddedNginx", hs = ["nginx"], fs = T(Le), en = S(Le), tn = v(Le), Es = { [fs]: { category: "Embed", type: "string", array: !0, default: [{ value: [...hs] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin.", deprecated: `Please use \`${en}\` or \`${tn}\`.` }, [en]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin." }, [tn]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin." } }, bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: ms, language: Le, options: Es }, Symbol.toStringTag, { value: "Module" })), me = "embeddedNoop", _s = T(me), nn = S(me), rn = v(me), ys = { [_s]: { category: "Embed", type: "string", array: !0, default: [{ value: [] }], description: "Tag or comment identifiers that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted.", deprecated: `Please use \`${nn}\` or \`${rn}\`.` }, [nn]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted." }, [rn]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted." } }, Ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, language: me, options: ys }, Symbol.toStringTag, { value: "Module" })), { line: sn, group: J, indent: on, softline: an } = A, $s = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "pegjs-parser" }), a = M(D, f, b); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return J([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [J(a)] : on([J(a)]), c, "`" ]); const g = u.length ? sn : an, E = c.length ? sn : an; return J([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, J(a)] : on([g, J(a)]), E, "`" ]); }, Ne = "embeddedPegjs", Ts = ["pegjs", "peggy", "peg"], vs = T(Ne), ln = S(Ne), cn = v(Ne), As = { [vs]: { category: "Embed", type: "string", array: !0, default: [{ value: [...Ts] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin.", deprecated: `Please use \`${ln}\` or \`${cn}\`.` }, [ln]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin." }, [cn]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin." } }, Ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: $s, language: Ne, options: As }, Symbol.toStringTag, { value: "Module" })), { line: dn, group: X, indent: un, softline: pn } = A, Ms = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N("$p"), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "php" }), a = M(D, f, b); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return X([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [X(a)] : un([X(a)]), c, "`" ]); const g = u.length ? dn : pn, E = c.length ? dn : pn; return X([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, X(a)] : un([g, X(a)]), E, "`" ]); }, ke = "embeddedPhp", Ls = ["php", "php5"], Ns = T(ke), gn = S(ke), mn = v(ke), ks = { [Ns]: { category: "Embed", type: "string", array: !0, default: [{ value: [...Ls] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin.", deprecated: `Please use \`${gn}\` or \`${mn}\`.` }, [gn]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin." }, [mn]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin." } }, Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: Ms, language: ke, options: ks }, Symbol.toStringTag, { value: "Module" })), { line: hn, group: H, indent: fn, softline: En } = A, Gs = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "prisma-parse" }), a = M( D, f, b, "hardline" ); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return H([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [H(a)] : fn([H(a)]), c, "`" ]); const g = u.length ? hn : En, E = c.length ? hn : En; return H([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, H(a)] : fn([g, H(a)]), E, "`" ]); }, Oe = "embeddedPrisma", Is = ["prisma"], xs = T(Oe), bn = S(Oe), _n = v(Oe), Ps = { [xs]: { category: "Embed", type: "string", array: !0, default: [{ value: [...Is] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin.", deprecated: `Please use \`${bn}\` or \`${_n}\`.` }, [bn]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin." }, [_n]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin." } }, qs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: Gs, language: Oe, options: Ps }, Symbol.toStringTag, { value: "Module" })), { line: yn, group: Q, indent: Dn, softline: $n } = A, js = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "dot-properties" }), a = M(D, f, b); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return Q([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [Q(a)] : Dn([Q(a)]), c, "`" ]); const g = u.length ? yn : $n, E = c.length ? yn : $n; return Q([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, Q(a)] : Dn([g, Q(a)]), E, "`" ]); }, Ge = "embeddedProperties", Rs = ["properties"], Bs = T(Ge), Tn = S(Ge), vn = v(Ge), ws = { [Bs]: { category: "Embed", type: "string", array: !0, default: [{ value: [...Rs] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin.", deprecated: `Please use \`${Tn}\` or \`${vn}\`.` }, [Tn]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin." }, [vn]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin." } }, Us = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: js, language: Ge, options: ws }, Symbol.toStringTag, { value: "Module" })), { group: V, line: An, softline: Sn, indent: Mn } = A, Cs = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "pug" }), a = M( D, f, b, "hardline" ); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return V([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [V(a)] : Mn([V(a)]), c, "`" ]); const g = u.length ? An : Sn, E = c.length ? An : Sn; return V([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, V(a)] : Mn([g, V(a)]), E, "`" ]); }, Ie = "embeddedPug", Ws = ["pug", "jade"], Fs = T(Ie), Ln = S(Ie), Nn = v(Ie), zs = { [Fs]: { category: "Embed", type: "string", array: !0, default: [{ value: [...Ws] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin.", deprecated: `Please use \`${Ln}\` or \`${Nn}\`.` }, [Ln]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin." }, [Nn]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin." } }, Js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: Cs, language: Ie, options: zs }, Symbol.toStringTag, { value: "Module" })), { line: kn, group: Y, indent: On, softline: Gn } = A, Xs = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: s.embeddedRubyParser ?? "ruby" }), a = M(D, f, b); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return Y([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [Y(a)] : On([Y(a)]), c, "`" ]); const g = u.length ? kn : Gn, E = c.length ? kn : Gn; return Y([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, Y(a)] : On([g, Y(a)]), E, "`" ]); }, he = "embeddedRuby", Hs = ["ruby"], Qs = ["ruby", "rbs", "haml"], Vs = T(he), In = S(he), xn = v(he), Ys = G(he), Ks = { [Vs]: { category: "Embed", type: "string", array: !0, default: [{ value: [...Hs] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.", deprecated: `Please use \`${In}\` or \`${xn}\`.` }, [In]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Block comments that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin." }, [xn]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], description: "Tags that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin." }, [Ys]: { category: "Embed", type: "choice", default: "ruby", description: "The parser used to parse the embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.", choices: Qs.map((t) => ({ value: t, description: `Use the "${t}" parser.` })) } }, Zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, embedder: Xs, language: he, options: Ks }, Symbol.toStringTag, { value: "Module" })), { group: K, line: Pn, softline: qn, indent: jn } = A, eo = async (t, e, n, i, { commentOrTag: r, embeddedOverrideOptions: o }) => { const s = { ...i, ...o }, { node: l } = n, { createPlaceholder: p, placeholderRegex: f } = N(), d = l.quasis.map( (m, h, { length: _ }) => h === _ - 1 ? m.value.cooked : m.value.cooked + p(h) ).join(""), u = d.match(/^\s+/)?.[0] ?? "", c = d.match(/\s+$/)?.[0] ?? "", y = d.slice( u.length, -c.length || void 0 ), b = L(n, e), D = await t(y, { ...s, parser: "sh" }), a = M( D, f, b, "hardline" ); if (s.preserveEmbeddedExteriorWhitespaces?.includes(r)) return K([ "`", u, s.noEmbeddedMultiLineIndentation?.includes(r) ? [K(a)] : jn([K(a)]), c, "`" ]); const g = u.length ? Pn : qn, E = c.length ? Pn : qn; return K([ "`", s.noEmbeddedMultiLineIndentation?.includes(r) ? [g, K(a)] : jn([g, K(a)]), E, "`" ]); }, xe = "embeddedSh", to = ["sh"], no = T(xe), Rn = S(xe), Bn = v(xe), io = { [no]: { category: "Embed", type: "string", array: !0, default: [{ value: [...to] }], description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin.", deprecated: `Please use \`${Rn}\` or \`${Bn}\`.` }, [Rn]: { category: "Embed", type: "string", array: !0, default: [{ value: [$] }], des