prettier-plugin-embed 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,46 +1,46 @@
1
1
  import { utils as q, builders as I } from "prettier/doc";
2
- import Je from "prettier/parser-babel";
3
- import Ye from "prettier/parser-espree";
4
- import Ve from "prettier/parser-flow";
5
- import Qe from "prettier/parser-meriyah";
6
- import Ze from "prettier/parser-typescript";
7
- import { printers as et } from "prettier/plugins/estree.mjs";
8
- import { readFile as tt } from "node:fs/promises";
9
- import { isAbsolute as nt, dirname as rt, resolve as st, extname as ot } from "node:path";
10
- import { Worker as it } from "node:worker_threads";
11
- import { resolveConfigFile as at } from "prettier";
12
- const Pe = "embeddedCss", { group: dt, indent: ct, softline: V, lineSuffixBoundary: lt } = I, { mapDoc: ut } = q;
13
- function mt(t, n) {
2
+ import Qe from "prettier/parser-babel";
3
+ import Ze from "prettier/parser-espree";
4
+ import et from "prettier/parser-flow";
5
+ import tt from "prettier/parser-meriyah";
6
+ import nt from "prettier/parser-typescript";
7
+ import { printers as rt } from "prettier/plugins/estree.mjs";
8
+ import { readFile as ot } from "node:fs/promises";
9
+ import { isAbsolute as st, dirname as it, resolve as at, extname as ct } from "node:path";
10
+ import { Worker as dt } from "node:worker_threads";
11
+ import { resolveConfigFile as lt } from "prettier";
12
+ const Me = "embeddedCss", { group: ut, indent: mt, softline: V, lineSuffixBoundary: gt } = I, { mapDoc: pt } = q;
13
+ function ft(t, n) {
14
14
  const { node: r } = t;
15
15
  let e = n();
16
- return r?.comments?.length && (e = dt([ct([V, e]), V])), ["${", e, lt, "}"];
16
+ return r?.comments?.length && (e = ut([mt([V, e]), V])), ["${", e, gt, "}"];
17
17
  }
18
18
  function D(t, n) {
19
19
  return t.map(
20
- (r) => mt(r, n),
20
+ (r) => ft(r, n),
21
21
  "expressions"
22
22
  );
23
23
  }
24
24
  function L(t, n, r) {
25
- return ut(t, (s) => {
26
- if (typeof s != "string")
27
- return s;
28
- const o = [], a = s.split(n);
25
+ return pt(t, (o) => {
26
+ if (typeof o != "string")
27
+ return o;
28
+ const s = [], a = o.split(n);
29
29
  for (let i = 0; i < a.length; i++) {
30
- let c = a[i];
30
+ let l = a[i];
31
31
  if (i % 2 == 0) {
32
- if (!c)
32
+ if (!l)
33
33
  continue;
34
- c = c.replaceAll(/([\\`]|\${)/g, "\\$1"), o.push(c);
34
+ l = l.replaceAll(/([\\`]|\${)/g, "\\$1"), s.push(l);
35
35
  } else {
36
- const l = Number(c);
37
- o.push(r[l]);
36
+ const c = Number(l);
37
+ s.push(r[c]);
38
38
  }
39
39
  }
40
- return o;
40
+ return s;
41
41
  });
42
42
  }
43
- function A(t, n, r) {
43
+ function B(t, n, r) {
44
44
  if (!(n.plugins?.some(
45
45
  (e) => e.name?.includes(t) ?? !1
46
46
  ) ?? !1))
@@ -48,19 +48,19 @@ function A(t, n, r) {
48
48
  `Cannot format embedded language identified by "${r}", because plugin "${t}" is not loaded.`
49
49
  );
50
50
  }
51
- function gt(t, n, r) {
51
+ function ht(t, n, r) {
52
52
  if (n === r) {
53
53
  t.unshift(n);
54
54
  return;
55
55
  }
56
- let e = 0, s = t.length;
57
- for (; e < s; ) {
58
- const o = e + s >>> 1;
59
- if (t[o] === r) {
56
+ let e = 0, o = t.length;
57
+ for (; e < o; ) {
58
+ const s = e + o >>> 1;
59
+ if (t[s] === r) {
60
60
  t.push(n);
61
61
  return;
62
62
  }
63
- t[o] < n ? e = o + 1 : s = o;
63
+ t[s] < n ? e = s + 1 : o = s;
64
64
  }
65
65
  t.splice(e, 0, n);
66
66
  }
@@ -73,9 +73,9 @@ const Q = (() => {
73
73
  return r;
74
74
  };
75
75
  })();
76
- function S(t = "p", n = "") {
77
- const r = Q(), e = Q(), s = Z(t), o = Z(n), a = (c) => `${t}${r}${c}${e}${n}`, i = new RegExp(
78
- `${s}${r}(\\d+)${e}${o}`,
76
+ function O(t = "p", n = "") {
77
+ const r = Q(), e = Q(), o = Z(t), s = Z(n), a = (l) => `${t}${r}${l}${e}${n}`, i = new RegExp(
78
+ `${o}${r}(\\d+)${e}${s}`,
79
79
  "g"
80
80
  );
81
81
  return {
@@ -89,75 +89,81 @@ function Z(t) {
89
89
  function $(t) {
90
90
  return `${t}Identifiers`;
91
91
  }
92
- function Me(t) {
92
+ function Re(t) {
93
93
  return `${t}Parser`;
94
94
  }
95
- const { line: ee, group: k, indent: te, softline: ne } = I, pt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
95
+ const { line: ee, group: T, indent: te, softline: ne } = I, bt = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
96
96
  e = {
97
97
  ...e,
98
- ...o
98
+ ...s
99
99
  };
100
- const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S("@p"), l = a.quasis.map(
101
- (f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g)
102
- ).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = D(r, n), b = await t(l, {
100
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: l } = O("@p"), c = a.quasis.map(
101
+ (p, g, { length: b }) => g === b - 1 ? p.value.cooked : p.value.cooked + i(g)
102
+ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", m = c.match(/\s+$/)?.[0] ?? "", E = c.slice(
103
+ d.length,
104
+ -m.length || void 0
105
+ ), y = D(r, n), f = await t(E, {
103
106
  ...e,
104
107
  parser: "scss"
105
- }), d = L(b, c, v);
106
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
107
- return k([
108
+ }), u = L(f, l, y);
109
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
110
+ return T([
108
111
  "`",
109
- p,
110
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [k(d)] : te([k(d)]),
111
- u,
112
+ d,
113
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [T(u)] : te([T(u)]),
114
+ m,
112
115
  "`"
113
116
  ]);
114
- const m = p.length ? ee : ne, y = u.length ? ee : ne;
115
- return k([
117
+ const h = d.length ? ee : ne, _ = m.length ? ee : ne;
118
+ return T([
116
119
  "`",
117
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, k(d)] : te([m, k(d)]),
118
- y,
120
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, T(u)] : te([h, T(u)]),
121
+ _,
119
122
  "`"
120
123
  ]);
121
- }, ft = ["css"], ht = $(Pe), bt = {
122
- [ht]: {
124
+ }, yt = ["css"], vt = $(Me), Et = {
125
+ [vt]: {
123
126
  category: "Global",
124
127
  type: "string",
125
128
  array: !0,
126
- default: [{ value: [...ft] }],
129
+ default: [{ value: [...yt] }],
127
130
  description: "Specify embedded CSS language identifiers."
128
131
  }
129
- }, yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
132
+ }, _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
130
133
  __proto__: null,
131
- embeddedLanguage: Pe,
132
- embedder: pt,
133
- options: bt
134
- }, Symbol.toStringTag, { value: "Module" })), H = "embeddedEs", { line: re, group: T, indent: se, softline: oe } = I, vt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
134
+ embeddedLanguage: Me,
135
+ embedder: bt,
136
+ options: Et
137
+ }, Symbol.toStringTag, { value: "Module" })), H = "embeddedEs", { line: re, group: k, indent: oe, softline: se } = I, xt = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
135
138
  e = {
136
139
  ...e,
137
- ...o
140
+ ...s
138
141
  };
139
- const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map(
140
- (f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g)
141
- ).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = D(r, n), b = await t(l, {
142
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: l } = O(), c = a.quasis.map(
143
+ (p, g, { length: b }) => g === b - 1 ? p.value.cooked : p.value.cooked + i(g)
144
+ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", m = c.match(/\s+$/)?.[0] ?? "", E = c.slice(
145
+ d.length,
146
+ -m.length || void 0
147
+ ), y = D(r, n), f = await t(E, {
142
148
  ...e,
143
149
  parser: e.embeddedEsParser ?? "babel"
144
- }), d = L(b, c, v);
145
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
146
- return T([
150
+ }), u = L(f, l, y);
151
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
152
+ return k([
147
153
  "`",
148
- p,
149
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [T(d)] : se([T(d)]),
150
- u,
154
+ d,
155
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [k(u)] : oe([k(u)]),
156
+ m,
151
157
  "`"
152
158
  ]);
153
- const m = p.length ? re : oe, y = u.length ? re : oe;
154
- return T([
159
+ const h = d.length ? re : se, _ = m.length ? re : se;
160
+ return k([
155
161
  "`",
156
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, T(d)] : se([m, T(d)]),
157
- y,
162
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, k(u)] : oe([h, k(u)]),
163
+ _,
158
164
  "`"
159
165
  ]);
160
- }, Et = [
166
+ }, It = [
161
167
  "js",
162
168
  "jsx",
163
169
  "es",
@@ -166,56 +172,56 @@ const { line: ee, group: k, indent: te, softline: ne } = I, pt = async (t, n, r,
166
172
  "cjs",
167
173
  "pac",
168
174
  "javascript"
169
- ], _t = $(H), xt = Me(H), It = {
170
- [_t]: {
175
+ ], $t = $(H), St = Re(H), Dt = {
176
+ [$t]: {
171
177
  category: "Global",
172
178
  type: "string",
173
179
  array: !0,
174
- default: [{ value: [...Et] }],
180
+ default: [{ value: [...It] }],
175
181
  description: "Specify embedded ES language identifiers."
176
182
  },
177
- [xt]: {
183
+ [St]: {
178
184
  category: "Global",
179
185
  type: "string",
180
186
  array: !1,
181
187
  default: "babel",
182
188
  description: "Specify the embedded ES language parser."
183
189
  }
184
- }, $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
190
+ }, Ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
185
191
  __proto__: null,
186
192
  embeddedLanguage: H,
187
- embedder: vt,
188
- options: It
189
- }, Symbol.toStringTag, { value: "Module" })), Re = "embeddedGlsl", { line: ie, group: O, indent: ae, softline: de } = I, Dt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
190
- A("prettier-plugin-glsl", e, s), e = {
193
+ embedder: xt,
194
+ options: Dt
195
+ }, Symbol.toStringTag, { value: "Module" })), Ne = "embeddedGlsl", { line: ie, group: w, indent: ae, softline: ce } = I, Lt = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
196
+ B("prettier-plugin-glsl", e, o), e = {
191
197
  ...e,
192
- ...o
198
+ ...s
193
199
  };
194
- const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map(
195
- (g, h, { length: E }) => h === E - 1 ? g.value.cooked : g.value.cooked + i(h)
196
- ).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = l.slice(
197
- p.length,
198
- -u.length || void 0
199
- ), b = D(r, n), d = await t(v, {
200
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: l } = O(), c = a.quasis.map(
201
+ (p, g, { length: b }) => g === b - 1 ? p.value.cooked : p.value.cooked + i(g)
202
+ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", m = c.match(/\s+$/)?.[0] ?? "", E = c.slice(
203
+ d.length,
204
+ -m.length || void 0
205
+ ), y = D(r, n), f = await t(E, {
200
206
  ...e,
201
207
  parser: "glsl-parser"
202
- }), m = L(d, c, b);
203
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
204
- return O([
208
+ }), u = L(f, l, y);
209
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
210
+ return w([
205
211
  "`",
206
- p,
207
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [O(m)] : ae([O(m)]),
208
- u,
212
+ d,
213
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [w(u)] : ae([w(u)]),
214
+ m,
209
215
  "`"
210
216
  ]);
211
- const y = p.length ? ie : de, f = u.length ? ie : de;
212
- return O([
217
+ const h = d.length ? ie : ce, _ = m.length ? ie : ce;
218
+ return w([
213
219
  "`",
214
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [y, O(m)] : ae([y, O(m)]),
215
- f,
220
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, w(u)] : ae([h, w(u)]),
221
+ _,
216
222
  "`"
217
223
  ]);
218
- }, St = [
224
+ }, Tt = [
219
225
  "glsl",
220
226
  "fp",
221
227
  "frag",
@@ -238,63 +244,66 @@ const { line: ee, group: k, indent: te, softline: ne } = I, pt = async (t, n, r,
238
244
  "vrx",
239
245
  "vsh",
240
246
  "vshader"
241
- ], Lt = $(Re), kt = {
242
- [Lt]: {
247
+ ], kt = $(Ne), wt = {
248
+ [kt]: {
243
249
  category: "Global",
244
250
  type: "string",
245
251
  array: !0,
246
- default: [{ value: [...St] }],
252
+ default: [{ value: [...Tt] }],
247
253
  description: 'Specify embedded GLSL language identifiers. This requires "prettier-plugin-glsl".'
248
254
  }
249
- }, Tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
255
+ }, Pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
250
256
  __proto__: null,
251
- embeddedLanguage: Re,
252
- embedder: Dt,
253
- options: kt
254
- }, Symbol.toStringTag, { value: "Module" })), Ne = "embeddedHtml", { line: ce, group: w, indent: le, softline: ue } = I, { mapDoc: Ot } = q, wt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
257
+ embeddedLanguage: Ne,
258
+ embedder: Lt,
259
+ options: wt
260
+ }, Symbol.toStringTag, { value: "Module" })), Fe = "embeddedHtml", { line: de, group: P, indent: le, softline: ue } = I, { mapDoc: jt } = q, Mt = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
255
261
  e = {
256
262
  ...e,
257
- ...o
263
+ ...s
258
264
  };
259
- const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map(
260
- (f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g)
261
- ).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = D(r, n), b = await t(l, {
265
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: l } = O(), c = a.quasis.map(
266
+ (p, g, { length: b }) => g === b - 1 ? p.value.cooked : p.value.cooked + i(g)
267
+ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", m = c.match(/\s+$/)?.[0] ?? "", E = c.slice(
268
+ d.length,
269
+ -m.length || void 0
270
+ ), y = D(r, n), f = await t(E, {
262
271
  ...e,
263
272
  parser: "html"
264
- }), d = Ot(b, (f) => {
265
- if (typeof f != "string")
266
- return f;
267
- const g = [], h = f.split(c);
268
- for (let E = 0; E < h.length; E++) {
269
- let _ = h[E];
270
- if (E % 2 == 0) {
271
- if (!_)
273
+ }), u = jt(f, (p) => {
274
+ if (typeof p != "string")
275
+ return p;
276
+ const g = [], b = p.split(l);
277
+ for (let x = 0; x < b.length; x++) {
278
+ let v = b[x];
279
+ if (x % 2 == 0) {
280
+ if (!v)
272
281
  continue;
273
- _ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (_ = _.replaceAll(/<\/(?=script\b)/gi, "<\\/")), g.push(_);
282
+ v = v.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (v = v.replaceAll(/<\/(?=script\b)/gi, "<\\/")), g.push(v);
274
283
  } else {
275
- const x = Number(_);
276
- g.push(v[x]);
284
+ const S = Number(v);
285
+ g.push(y[S]);
277
286
  }
278
287
  }
279
288
  return g;
280
289
  });
281
290
  if (e.htmlWhitespaceSensitivity === "strict" || // TODO: is css mode should be included here?
282
- e.htmlWhitespaceSensitivity === "css" || e.preserveEmbeddedExteriorWhitespaces?.includes(s))
283
- return w([
291
+ e.htmlWhitespaceSensitivity === "css" || e.preserveEmbeddedExteriorWhitespaces?.includes(o))
292
+ return P([
284
293
  "`",
285
- p,
286
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [w(d)] : le([w(d)]),
287
- u,
294
+ d,
295
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [P(u)] : le([P(u)]),
296
+ m,
288
297
  "`"
289
298
  ]);
290
- const m = p.length ? ce : ue, y = u.length ? ce : ue;
291
- return w([
299
+ const h = d.length ? de : ue, _ = m.length ? de : ue;
300
+ return P([
292
301
  "`",
293
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, w(d)] : le([m, w(d)]),
294
- y,
302
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, P(u)] : le([h, P(u)]),
303
+ _,
295
304
  "`"
296
305
  ]);
297
- }, Pt = [
306
+ }, Rt = [
298
307
  "html",
299
308
  "htm",
300
309
  "shtml",
@@ -307,47 +316,50 @@ const { line: ee, group: k, indent: te, softline: ne } = I, pt = async (t, n, r,
307
316
  "jshtm",
308
317
  "volt",
309
318
  "rhtml"
310
- ], Mt = $(Ne), Rt = {
311
- [Mt]: {
319
+ ], Nt = $(Fe), Ft = {
320
+ [Nt]: {
312
321
  category: "Global",
313
322
  type: "string",
314
323
  array: !0,
315
- default: [{ value: [...Pt] }],
324
+ default: [{ value: [...Rt] }],
316
325
  description: "Specify embedded HTML language identifiers."
317
326
  }
318
- }, Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
327
+ }, At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
319
328
  __proto__: null,
320
- embeddedLanguage: Ne,
321
- embedder: wt,
322
- options: Rt
323
- }, Symbol.toStringTag, { value: "Module" })), Fe = "embeddedMarkdown", { line: me, group: P, indent: ge, softline: pe } = I, Ft = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
329
+ embeddedLanguage: Fe,
330
+ embedder: Mt,
331
+ options: Ft
332
+ }, Symbol.toStringTag, { value: "Module" })), Ae = "embeddedMarkdown", { line: me, group: j, indent: ge, softline: pe } = I, Ct = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
324
333
  e = {
325
334
  ...e,
326
- ...o
335
+ ...s
327
336
  };
328
- const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map(
329
- (f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g)
330
- ).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = D(r, n), b = await t(l, {
337
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: l } = O(), c = a.quasis.map(
338
+ (p, g, { length: b }) => g === b - 1 ? p.value.cooked : p.value.cooked + i(g)
339
+ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", m = c.match(/\s+$/)?.[0] ?? "", E = c.slice(
340
+ d.length,
341
+ -m.length || void 0
342
+ ), y = D(r, n), f = await t(E, {
331
343
  ...e,
332
344
  parser: "markdown",
333
345
  __inJsTemplate: !0
334
- }), d = L(b, c, v);
335
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
336
- return P([
346
+ }), u = L(f, l, y);
347
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
348
+ return j([
337
349
  "`",
338
- p,
339
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [P(d)] : ge([P(d)]),
340
- u,
350
+ d,
351
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [j(u)] : ge([j(u)]),
352
+ m,
341
353
  "`"
342
354
  ]);
343
- const m = p.length ? me : pe, y = u.length ? me : pe;
344
- return P([
355
+ const h = d.length ? me : pe, _ = m.length ? me : pe;
356
+ return j([
345
357
  "`",
346
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, P(d)] : ge([m, P(d)]),
347
- y,
358
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, j(u)] : ge([h, j(u)]),
359
+ _,
348
360
  "`"
349
361
  ]);
350
- }, Ct = [
362
+ }, Bt = [
351
363
  "md",
352
364
  "livemd",
353
365
  "markdown",
@@ -359,74 +371,74 @@ const { line: ee, group: k, indent: te, softline: ne } = I, pt = async (t, n, r,
359
371
  "ronn",
360
372
  "scd",
361
373
  "workbook"
362
- ], jt = $(Fe), At = {
363
- [jt]: {
374
+ ], Wt = $(Ae), Ut = {
375
+ [Wt]: {
364
376
  category: "Global",
365
377
  type: "string",
366
378
  array: !0,
367
- default: [{ value: [...Ct] }],
379
+ default: [{ value: [...Bt] }],
368
380
  description: "Specify embedded Markdown language identifiers."
369
381
  }
370
- }, Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
382
+ }, Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
371
383
  __proto__: null,
372
- embeddedLanguage: Fe,
373
- embedder: Ft,
374
- options: At
375
- }, Symbol.toStringTag, { value: "Module" })), X = "embeddedNoop", Wt = $(X), Ut = {
376
- [Wt]: {
384
+ embeddedLanguage: Ae,
385
+ embedder: Ct,
386
+ options: Ut
387
+ }, Symbol.toStringTag, { value: "Module" })), X = "embeddedNoop", Gt = $(X), zt = {
388
+ [Gt]: {
377
389
  category: "Global",
378
390
  type: "string",
379
391
  array: !0,
380
392
  default: [{ value: [] }],
381
393
  description: "Specify embedded language identifiers that will not be formatted."
382
394
  }
383
- }, Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
395
+ }, qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
384
396
  __proto__: null,
385
397
  embeddedLanguage: X,
386
- options: Ut
387
- }, Symbol.toStringTag, { value: "Module" })), Ce = "embeddedPhp", { line: fe, group: M, indent: he, softline: be } = I, Kt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
388
- A("@prettier/plugin-php", e, s), e = {
398
+ options: zt
399
+ }, Symbol.toStringTag, { value: "Module" })), Ce = "embeddedPhp", { line: fe, group: M, indent: he, softline: be } = I, Ht = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
400
+ B("@prettier/plugin-php", e, o), e = {
389
401
  ...e,
390
- ...o
402
+ ...s
391
403
  };
392
- const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S("$p"), l = a.quasis.map(
393
- (g, h, { length: E }) => h === E - 1 ? g.value.cooked : g.value.cooked + i(h)
394
- ).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = l.slice(
395
- p.length,
396
- -u.length || void 0
397
- ), b = D(r, n), d = await t(v, {
404
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: l } = O("$p"), c = a.quasis.map(
405
+ (p, g, { length: b }) => g === b - 1 ? p.value.cooked : p.value.cooked + i(g)
406
+ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", m = c.match(/\s+$/)?.[0] ?? "", E = c.slice(
407
+ d.length,
408
+ -m.length || void 0
409
+ ), y = D(r, n), f = await t(E, {
398
410
  ...e,
399
411
  parser: "php"
400
- }), m = L(d, c, b);
401
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
412
+ }), u = L(f, l, y);
413
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
402
414
  return M([
403
415
  "`",
404
- p,
405
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [M(m)] : he([M(m)]),
406
- u,
416
+ d,
417
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [M(u)] : he([M(u)]),
418
+ m,
407
419
  "`"
408
420
  ]);
409
- const y = p.length ? fe : be, f = u.length ? fe : be;
421
+ const h = d.length ? fe : be, _ = m.length ? fe : be;
410
422
  return M([
411
423
  "`",
412
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [y, M(m)] : he([y, M(m)]),
413
- f,
424
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, M(u)] : he([h, M(u)]),
425
+ _,
414
426
  "`"
415
427
  ]);
416
- }, zt = ["php", "php5", "phtml", "ctp"], qt = $(Ce), Ht = {
417
- [qt]: {
428
+ }, Xt = ["php", "php5", "phtml", "ctp"], Jt = $(Ce), Yt = {
429
+ [Jt]: {
418
430
  category: "Global",
419
431
  type: "string",
420
432
  array: !0,
421
- default: [{ value: [...zt] }],
433
+ default: [{ value: [...Xt] }],
422
434
  description: 'Specify embedded PHP language identifiers. This requires "@prettier/plugin-php".'
423
435
  }
424
- }, Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
436
+ }, Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
425
437
  __proto__: null,
426
438
  embeddedLanguage: Ce,
427
- embedder: Kt,
428
- options: Ht
429
- }, Symbol.toStringTag, { value: "Module" })), je = "embeddedRuby", U = [
439
+ embedder: Ht,
440
+ options: Yt
441
+ }, Symbol.toStringTag, { value: "Module" })), Be = "embeddedRuby", U = [
430
442
  "ruby",
431
443
  "arb",
432
444
  "axlsx",
@@ -452,235 +464,313 @@ const { line: ee, group: k, indent: te, softline: ne } = I, pt = async (t, n, r,
452
464
  "ru",
453
465
  "thor",
454
466
  "watchr"
455
- ], G = ["rbs"], K = ["haml"], Jt = [
467
+ ], K = ["rbs"], G = ["haml"], Qt = [
456
468
  ...U,
457
- ...G,
458
- ...K
459
- ], Yt = "embeddedRubyParser", Vt = $(je), Qt = {
460
- [Vt]: {
469
+ ...K,
470
+ ...G
471
+ ], Zt = "embeddedRubyParser", en = $(Be), tn = {
472
+ [en]: {
461
473
  category: "Global",
462
474
  type: "string",
463
475
  array: !0,
464
- default: [{ value: [...Jt] }],
476
+ default: [{ value: [...Qt] }],
465
477
  description: 'Specify embedded Ruby language identifiers. This requires "@prettier/plugin-ruby".'
466
478
  },
467
- [Yt]: {
479
+ [Zt]: {
468
480
  category: "Global",
469
481
  type: "string",
470
482
  array: !1,
471
483
  default: void 0,
472
484
  description: "Specify the embedded Ruby language parser."
473
485
  }
474
- }, { line: ye, group: R, indent: ve, softline: Ee } = I, Zt = async (t, n, r, e, { identifier: s, identifiers: o, embeddedOverrideOptions: a }) => {
475
- A("@prettier/plugin-ruby", e, s), e = {
486
+ }, { line: ye, group: R, indent: ve, softline: Ee } = I, nn = async (t, n, r, e, { identifier: o, identifiers: s, embeddedOverrideOptions: a }) => {
487
+ B("@prettier/plugin-ruby", e, o), e = {
476
488
  ...e,
477
489
  ...a
478
490
  };
479
- const { node: i } = r, { createPlaceholder: c, placeholderRegex: l } = S(), p = i.quasis.map(
480
- (E, _, { length: x }) => _ === x - 1 ? E.value.cooked : E.value.cooked + c(_)
481
- ).join(""), u = p.match(/^\s+/)?.[0] ?? "", v = p.match(/\s+$/)?.[0] ?? "", b = p.slice(
482
- u.length,
483
- -v.length || void 0
484
- ), d = D(r, n), m = en(e, s, o), y = await t(b, {
491
+ const { node: i } = r, { createPlaceholder: l, placeholderRegex: c } = O(), d = i.quasis.map(
492
+ (b, x, { length: v }) => x === v - 1 ? b.value.cooked : b.value.cooked + l(x)
493
+ ).join(""), m = d.match(/^\s+/)?.[0] ?? "", E = d.match(/\s+$/)?.[0] ?? "", y = d.slice(
494
+ m.length,
495
+ -E.length || void 0
496
+ ), f = D(r, n), u = rn(e, o, s), h = await t(y, {
485
497
  ...e,
486
- parser: m
487
- }), f = L(y, l, d);
488
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
498
+ parser: u
499
+ }), _ = L(h, c, f);
500
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
489
501
  return R([
490
502
  "`",
491
- u,
492
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [R(f)] : ve([R(f)]),
493
- v,
503
+ m,
504
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [R(_)] : ve([R(_)]),
505
+ E,
494
506
  "`"
495
507
  ]);
496
- const g = u.length ? ye : Ee, h = v.length ? ye : Ee;
508
+ const p = m.length ? ye : Ee, g = E.length ? ye : Ee;
497
509
  return R([
498
510
  "`",
499
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [g, R(f)] : ve([g, R(f)]),
500
- h,
511
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [p, R(_)] : ve([p, R(_)]),
512
+ g,
501
513
  "`"
502
514
  ]);
503
515
  };
504
- function en(t, n, r) {
516
+ function rn(t, n, r) {
505
517
  if (typeof t.embeddedRubyParser == "string")
506
518
  return t.embeddedRubyParser;
507
519
  const e = r.indexOf(n);
508
- for (let s = e; s >= 0; --s) {
509
- if (tn(n))
520
+ for (let o = e; o >= 0; --o) {
521
+ if (on(n))
510
522
  return U[0];
511
- if (nn(n))
512
- return G[0];
513
- if (rn(n))
523
+ if (sn(n))
514
524
  return K[0];
525
+ if (an(n))
526
+ return G[0];
515
527
  }
516
528
  throw new SyntaxError(`Unrecognized ruby identifier: ${n}`);
517
529
  }
518
- function tn(t) {
530
+ function on(t) {
519
531
  return U.includes(t);
520
532
  }
521
- function nn(t) {
522
- return G.includes(t);
523
- }
524
- function rn(t) {
533
+ function sn(t) {
525
534
  return K.includes(t);
526
535
  }
527
- const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
536
+ function an(t) {
537
+ return G.includes(t);
538
+ }
539
+ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
528
540
  __proto__: null,
529
- HAML_PARSER_IDENTIFIERS: K,
530
- RBS_PARSER_IDENTIFIERS: G,
541
+ HAML_PARSER_IDENTIFIERS: G,
542
+ RBS_PARSER_IDENTIFIERS: K,
531
543
  RUBY_PARSER_IDENTIFIERS: U,
532
- embeddedLanguage: je,
533
- embedder: Zt,
534
- options: Qt
535
- }, Symbol.toStringTag, { value: "Module" })), Ae = "embeddedSql", { hardline: on, group: N, line: _e, softline: xe, indent: Ie } = I, { mapDoc: an } = q, dn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
536
- A("prettier-plugin-sql", e, s), e = {
544
+ embeddedLanguage: Be,
545
+ embedder: nn,
546
+ options: tn
547
+ }, Symbol.toStringTag, { value: "Module" })), We = "embeddedSql";
548
+ function _e(t, n) {
549
+ var r = Object.keys(t);
550
+ if (Object.getOwnPropertySymbols) {
551
+ var e = Object.getOwnPropertySymbols(t);
552
+ n && (e = e.filter(function(o) {
553
+ return Object.getOwnPropertyDescriptor(t, o).enumerable;
554
+ })), r.push.apply(r, e);
555
+ }
556
+ return r;
557
+ }
558
+ function xe(t) {
559
+ for (var n = 1; n < arguments.length; n++) {
560
+ var r = arguments[n] != null ? arguments[n] : {};
561
+ n % 2 ? _e(Object(r), !0).forEach(function(e) {
562
+ dn(t, e, r[e]);
563
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : _e(Object(r)).forEach(function(e) {
564
+ Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
565
+ });
566
+ }
567
+ return t;
568
+ }
569
+ function dn(t, n, r) {
570
+ return n = ln(n), n in t ? Object.defineProperty(t, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = r, t;
571
+ }
572
+ function ln(t) {
573
+ var n = un(t, "string");
574
+ return typeof n == "symbol" ? n : String(n);
575
+ }
576
+ function un(t, n) {
577
+ if (typeof t != "object" || t === null)
578
+ return t;
579
+ var r = t[Symbol.toPrimitive];
580
+ if (r !== void 0) {
581
+ var e = r.call(t, n || "default");
582
+ if (typeof e != "object")
583
+ return e;
584
+ throw new TypeError("@@toPrimitive must return a primitive value.");
585
+ }
586
+ return (n === "string" ? String : Number)(t);
587
+ }
588
+ const mn = Ue({});
589
+ function Ue(t) {
590
+ return n.withOptions = (r) => Ue(xe(xe({}, t), r)), n;
591
+ function n(r, ...e) {
592
+ const o = typeof r == "string" ? [r] : r.raw, {
593
+ escapeSpecialCharacters: s = Array.isArray(r)
594
+ } = t;
595
+ let a = "";
596
+ for (let c = 0; c < o.length; c++) {
597
+ let d = o[c];
598
+ s && (d = d.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\{/g, "{")), a += d, c < e.length && (a += e[c]);
599
+ }
600
+ const i = a.split(`
601
+ `);
602
+ let l = null;
603
+ for (const c of i) {
604
+ const d = c.match(/^(\s+)\S+/);
605
+ if (d) {
606
+ const m = d[1].length;
607
+ l ? l = Math.min(l, m) : l = m;
608
+ }
609
+ }
610
+ if (l !== null) {
611
+ const c = l;
612
+ a = i.map((d) => d[0] === " " || d[0] === " " ? d.slice(c) : d).join(`
613
+ `);
614
+ }
615
+ return a.trim().replace(/\\n/g, `
616
+ `);
617
+ }
618
+ }
619
+ const { hardline: gn, group: N, line: Ie, softline: $e, indent: Se } = I, { mapDoc: pn } = q, fn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
620
+ B("prettier-plugin-sql", e, o), e = {
537
621
  ...e,
538
- ...o
622
+ ...s
539
623
  };
540
- const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map(
541
- (f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g)
542
- ).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = D(r, n), b = await t(l, {
624
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: l } = O(), c = a.quasis.map(
625
+ (p, g, { length: b }) => g === b - 1 ? p.value.cooked : p.value.cooked + i(g)
626
+ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", m = c.match(/\s+$/)?.[0] ?? "", E = c.slice(
627
+ d.length,
628
+ -m.length || void 0
629
+ ), y = D(r, n), f = await t(mn(E), {
543
630
  ...e,
544
631
  parser: "sql"
545
- }), d = an(b, (f) => {
546
- if (typeof f != "string")
547
- return f;
548
- const g = [], h = f.split(c);
549
- for (let E = 0; E < h.length; E++) {
550
- let _ = h[E];
551
- if (E % 2 == 0) {
552
- if (!_)
632
+ }), u = pn(f, (p) => {
633
+ if (typeof p != "string")
634
+ return p;
635
+ const g = [], b = p.split(l);
636
+ for (let x = 0; x < b.length; x++) {
637
+ let v = b[x];
638
+ if (x % 2 == 0) {
639
+ if (!v)
553
640
  continue;
554
- _ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((x) => x === `
555
- ` ? g.push(on) : g.push(x));
641
+ v = v.replaceAll(/([\\`]|\${)/g, "\\$1"), v.split(/(\n)/).forEach((S) => S === `
642
+ ` ? g.push(gn) : g.push(S));
556
643
  } else {
557
- const x = Number(_);
558
- g.push(v[x]);
644
+ const S = Number(v);
645
+ g.push(y[S]);
559
646
  }
560
647
  }
561
648
  return g;
562
649
  });
563
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
650
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
564
651
  return N([
565
652
  "`",
566
- p,
567
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [N(d)] : Ie([N(d)]),
568
- u,
653
+ d,
654
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [N(u)] : Se([N(u)]),
655
+ m,
569
656
  "`"
570
657
  ]);
571
- const m = p.length ? _e : xe, y = u.length ? _e : xe;
658
+ const h = d.length ? Ie : $e, _ = m.length ? Ie : $e;
572
659
  return N([
573
660
  "`",
574
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, N(d)] : Ie([m, N(d)]),
575
- y,
661
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, N(u)] : Se([h, N(u)]),
662
+ _,
576
663
  "`"
577
664
  ]);
578
- }, cn = ["sql"], ln = $(Ae), un = {
579
- [ln]: {
665
+ }, hn = ["sql"], bn = $(We), yn = {
666
+ [bn]: {
580
667
  category: "Global",
581
668
  type: "string",
582
669
  array: !0,
583
- default: [{ value: [...cn] }],
670
+ default: [{ value: [...hn] }],
584
671
  description: 'Specify embedded SQL language identifiers. This requires "prettier-plugin-sql".'
585
672
  }
586
- }, mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
673
+ }, vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
587
674
  __proto__: null,
588
- embeddedLanguage: Ae,
589
- embedder: dn,
590
- options: un
591
- }, Symbol.toStringTag, { value: "Module" })), J = "embeddedTs", { line: $e, group: F, indent: De, softline: Se } = I, gn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
675
+ embeddedLanguage: We,
676
+ embedder: fn,
677
+ options: yn
678
+ }, Symbol.toStringTag, { value: "Module" })), J = "embeddedTs", { line: De, group: F, indent: Oe, softline: Le } = I, En = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
592
679
  e = {
593
680
  ...e,
594
- ...o
681
+ ...s
595
682
  };
596
- const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map(
597
- (f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g)
598
- ).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = D(r, n), b = await t(l, {
683
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: l } = O(), c = a.quasis.map(
684
+ (p, g, { length: b }) => g === b - 1 ? p.value.cooked : p.value.cooked + i(g)
685
+ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", m = c.match(/\s+$/)?.[0] ?? "", E = c.slice(
686
+ d.length,
687
+ -m.length || void 0
688
+ ), y = D(r, n), f = await t(E, {
599
689
  ...e,
600
690
  parser: e.embeddedTsParser ?? "typescript",
601
691
  // set filepath to undefined to enable jsx auto detection:
602
692
  // https://github.com/prettier/prettier/blob/427a84d24203e2d54160cde153a1e6a6390fe65a/src/language-js/parse/typescript.js#L49-L53
603
693
  filepath: void 0
604
- }), d = L(b, c, v);
605
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
694
+ }), u = L(f, l, y);
695
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
606
696
  return F([
607
697
  "`",
608
- p,
609
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [F(d)] : De([F(d)]),
610
- u,
698
+ d,
699
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [F(u)] : Oe([F(u)]),
700
+ m,
611
701
  "`"
612
702
  ]);
613
- const m = p.length ? $e : Se, y = u.length ? $e : Se;
703
+ const h = d.length ? De : Le, _ = m.length ? De : Le;
614
704
  return F([
615
705
  "`",
616
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, F(d)] : De([m, F(d)]),
617
- y,
706
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, F(u)] : Oe([h, F(u)]),
707
+ _,
618
708
  "`"
619
709
  ]);
620
- }, pn = ["ts", "tsx", "cts", "mts", "typescript"], fn = Me(J), hn = $(J), bn = {
621
- [hn]: {
710
+ }, _n = ["ts", "tsx", "cts", "mts", "typescript"], xn = Re(J), In = $(J), $n = {
711
+ [In]: {
622
712
  category: "Global",
623
713
  type: "string",
624
714
  array: !0,
625
- default: [{ value: [...pn] }],
715
+ default: [{ value: [..._n] }],
626
716
  description: "Specify embedded TS language parsers."
627
717
  },
628
- [fn]: {
718
+ [xn]: {
629
719
  category: "Global",
630
720
  type: "string",
631
721
  array: !1,
632
722
  default: "typescript",
633
723
  description: "Specify the embedded TS language parser."
634
724
  }
635
- }, yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
725
+ }, Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
636
726
  __proto__: null,
637
727
  embeddedLanguage: J,
638
- embedder: gn,
639
- options: bn
640
- }, Symbol.toStringTag, { value: "Module" })), Y = "embeddedXml", { line: Le, group: C, indent: ke, softline: z } = I, vn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
641
- A("@prettier/plugin-xml", e, s), e = {
728
+ embedder: En,
729
+ options: $n
730
+ }, Symbol.toStringTag, { value: "Module" })), Y = "embeddedXml", { line: Te, group: A, indent: ke, softline: z } = I, Dn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
731
+ B("@prettier/plugin-xml", e, o), e = {
642
732
  ...e,
643
- ...o
733
+ ...s
644
734
  };
645
- const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map(
646
- (h, E, { length: _ }) => E === _ - 1 ? h.value.cooked : h.value.cooked + i(E)
647
- ).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = l.slice(
648
- p.length,
649
- -u.length || void 0
650
- ), b = D(r, n), d = [];
651
- let m = 0;
652
- for (; m !== void 0; ) {
653
- const h = v.slice(m);
654
- if (h.length === 0)
735
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: l } = O(), c = a.quasis.map(
736
+ (g, b, { length: x }) => b === x - 1 ? g.value.cooked : g.value.cooked + i(b)
737
+ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", m = c.match(/\s+$/)?.[0] ?? "", E = c.slice(
738
+ d.length,
739
+ -m.length || void 0
740
+ ), y = D(r, n), f = [];
741
+ let u = 0;
742
+ for (; u !== void 0; ) {
743
+ const g = E.slice(u);
744
+ if (g.length === 0)
655
745
  break;
656
- m > 0 && e.xmlWhitespaceSensitivity !== "strict" && d.push(z), e.__embeddedXmlFragmentRecoverIndex?.splice(
746
+ u > 0 && e.xmlWhitespaceSensitivity !== "strict" && f.push(z), e.__embeddedXmlFragmentRecoverIndex?.splice(
657
747
  0,
658
748
  e.__embeddedXmlFragmentRecoverIndex.length
659
749
  );
660
- let E = await t(h, {
750
+ let b = await t(g, {
661
751
  ...e,
662
752
  parser: Y
663
753
  });
664
- const [_, x] = e.__embeddedXmlFragmentRecoverIndex ?? [];
665
- _ === void 0 ? m = void 0 : x === void 0 ? m += _ : (E = h.slice(_, x + 1), m += x + 1), d.push(E);
754
+ const [x, v] = e.__embeddedXmlFragmentRecoverIndex ?? [];
755
+ x === void 0 ? u = void 0 : v === void 0 ? u += x : (b = g.slice(x, v + 1), u += v + 1), f.push(b);
666
756
  }
667
- const y = L(d, c, b);
668
- if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(s))
669
- return C([
757
+ const h = L(f, l, y);
758
+ if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(o))
759
+ return A([
670
760
  "`",
671
- p,
672
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [C(y)] : ke([C(y)]),
673
- u,
761
+ d,
762
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [A(h)] : ke([A(h)]),
763
+ m,
674
764
  "`"
675
765
  ]);
676
- const f = p.length ? Le : z, g = u.length ? Le : z;
677
- return C([
766
+ const _ = d.length ? Te : z, p = m.length ? Te : z;
767
+ return A([
678
768
  "`",
679
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [f, C(y)] : ke([f, C(y)]),
680
- g,
769
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [_, A(h)] : ke([_, A(h)]),
770
+ p,
681
771
  "`"
682
772
  ]);
683
- }, En = [
773
+ }, On = [
684
774
  "xml",
685
775
  "xsd",
686
776
  "ascx",
@@ -737,12 +827,12 @@ const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
737
827
  "xpdl",
738
828
  "xul",
739
829
  "xoml"
740
- ], _n = $(Y), xn = {
741
- [_n]: {
830
+ ], Ln = $(Y), Tn = {
831
+ [Ln]: {
742
832
  category: "Global",
743
833
  type: "string",
744
834
  array: !0,
745
- default: [{ value: [...En] }],
835
+ default: [{ value: [...On] }],
746
836
  description: 'Specify embedded XML language identifiers. This requires "@prettier/plugin-xml".'
747
837
  },
748
838
  /** @internal */
@@ -754,7 +844,7 @@ const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
754
844
  description: "This option is read only and used as a workaround to support xml fragments"
755
845
  }
756
846
  };
757
- function In(t) {
847
+ function kn(t) {
758
848
  const n = {
759
849
  loc: {
760
850
  start: {
@@ -774,7 +864,7 @@ function In(t) {
774
864
  );
775
865
  return Object.assign(r, n), r;
776
866
  }
777
- function Te(t) {
867
+ function we(t) {
778
868
  const n = {
779
869
  loc: {
780
870
  start: {
@@ -794,20 +884,20 @@ function Te(t) {
794
884
  );
795
885
  return Object.assign(r, n), r;
796
886
  }
797
- const $n = {
887
+ const wn = {
798
888
  async parse(t, n) {
799
- const { parse: r } = await import("@xml-tools/parser"), { lexErrors: e, parseErrors: s, cst: o } = r(t);
889
+ const { parse: r } = await import("@xml-tools/parser"), { lexErrors: e, parseErrors: o, cst: s } = r(t);
800
890
  if (e.length > 0) {
801
891
  const a = e[0];
802
- throw In(a);
892
+ throw kn(a);
803
893
  }
804
- if (s.length > 0) {
894
+ if (o.length > 0) {
805
895
  let a = !1;
806
- for (const i of s) {
896
+ for (const i of o) {
807
897
  if (!["MismatchedTokenException", "NotAllInputParsedException"].includes(
808
898
  i.name
809
899
  ))
810
- throw Te(i);
900
+ throw we(i);
811
901
  if (i.message === "Expecting token of type --> OPEN <-- but found --> '' <--") {
812
902
  a = !0;
813
903
  continue;
@@ -835,11 +925,11 @@ const $n = {
835
925
  ), a = !0;
836
926
  break;
837
927
  }
838
- throw Te(i);
928
+ throw we(i);
839
929
  }
840
- a && Be(o);
930
+ a && Ke(s);
841
931
  }
842
- return o;
932
+ return s;
843
933
  },
844
934
  astFormat: "xml",
845
935
  locStart(t) {
@@ -849,97 +939,97 @@ const $n = {
849
939
  return t.location.endOffset ?? NaN;
850
940
  }
851
941
  };
852
- function Be(t) {
942
+ function Ke(t) {
853
943
  const n = t.children;
854
944
  for (const r in n) {
855
945
  const e = n[r] ?? [];
856
- for (let s = e.length - 1; s >= 0; --s) {
857
- const o = e[s];
858
- if (Dn(o)) {
859
- if (Object.keys(o.children).length === 0) {
860
- e.splice(s, 1), e.length === 0 && delete n[r];
946
+ for (let o = e.length - 1; o >= 0; --o) {
947
+ const s = e[o];
948
+ if (Pn(s)) {
949
+ if (Object.keys(s.children).length === 0) {
950
+ e.splice(o, 1), e.length === 0 && delete n[r];
861
951
  continue;
862
952
  }
863
- Be(o);
953
+ Ke(s);
864
954
  }
865
955
  }
866
956
  }
867
957
  }
868
- function Dn(t) {
958
+ function Pn(t) {
869
959
  return "name" in t && "children" in t && "location" in t;
870
960
  }
871
- const Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
961
+ const jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
872
962
  __proto__: null,
873
963
  embeddedLanguage: Y,
874
- embedder: vn,
875
- options: xn,
876
- parser: $n
877
- }, Symbol.toStringTag, { value: "Module" })), We = [], Ue = {}, Ge = {}, Ke = {}, Ln = /* @__PURE__ */ Object.assign({
878
- "./css/index.ts": yt,
879
- "./es/index.ts": $t,
880
- "./glsl/index.ts": Tt,
881
- "./html/index.ts": Nt,
882
- "./markdown/index.ts": Bt,
883
- "./noop/index.ts": Gt,
884
- "./php/index.ts": Xt,
885
- "./ruby/index.ts": sn,
886
- "./sql/index.ts": mn,
887
- "./ts/index.ts": yn,
888
- "./xml/index.ts": Sn
964
+ embedder: Dn,
965
+ options: Tn,
966
+ parser: wn
967
+ }, Symbol.toStringTag, { value: "Module" })), Ge = [], ze = {}, qe = {}, He = {}, Mn = /* @__PURE__ */ Object.assign({
968
+ "./css/index.ts": _t,
969
+ "./es/index.ts": Ot,
970
+ "./glsl/index.ts": Pt,
971
+ "./html/index.ts": At,
972
+ "./markdown/index.ts": Kt,
973
+ "./noop/index.ts": qt,
974
+ "./php/index.ts": Vt,
975
+ "./ruby/index.ts": cn,
976
+ "./sql/index.ts": vn,
977
+ "./ts/index.ts": Sn,
978
+ "./xml/index.ts": jn
889
979
  });
890
- Object.values(Ln).forEach(
980
+ Object.values(Mn).forEach(
891
981
  ({ embeddedLanguage: t, parser: n, embedder: r, options: e }) => {
892
- gt(We, t, X), n && (Ue[t] = n), r && (Ge[t] = r), Object.assign(Ke, e);
982
+ ht(Ge, t, X), n && (ze[t] = n), r && (qe[t] = r), Object.assign(He, e);
893
983
  }
894
984
  );
895
- const kn = "noEmbeddedIdentificationByComment", Tn = "noEmbeddedIdentificationByTag", On = "preserveEmbeddedExteriorWhitespaces", wn = "noEmbeddedMultiLineIndentation", Pn = "embeddedOverrides", or = {
896
- ...Ke,
897
- [kn]: {
985
+ const Rn = "noEmbeddedIdentificationByComment", Nn = "noEmbeddedIdentificationByTag", Fn = "preserveEmbeddedExteriorWhitespaces", An = "noEmbeddedMultiLineIndentation", Cn = "embeddedOverrides", mr = {
986
+ ...He,
987
+ [Rn]: {
898
988
  category: "Global",
899
989
  type: "string",
900
990
  array: !0,
901
991
  default: [{ value: [] }],
902
992
  description: 'This option turns off "/* identifier */ `...`" comment-based language identification for the specified identifiers.'
903
993
  },
904
- [Tn]: {
994
+ [Nn]: {
905
995
  category: "Global",
906
996
  type: "string",
907
997
  array: !0,
908
998
  default: [{ value: [] }],
909
999
  description: 'This option turns off "identifier`...`" tag-based language identification for the specified identifiers.'
910
1000
  },
911
- [On]: {
1001
+ [Fn]: {
912
1002
  category: "Config",
913
1003
  type: "string",
914
1004
  array: !0,
915
1005
  default: [{ value: [] }],
916
1006
  description: "This option preserves leading and trailing whitespaces in the formatting results for the specified identifiers."
917
1007
  },
918
- [wn]: {
1008
+ [An]: {
919
1009
  category: "Global",
920
1010
  type: "string",
921
1011
  array: !0,
922
1012
  default: [{ value: [] }],
923
1013
  description: "This option turns off auto indentation in the formatting results for the specified identifiers when they are formatted to span multi lines."
924
1014
  },
925
- [Pn]: {
1015
+ [Cn]: {
926
1016
  category: "Global",
927
1017
  type: "string",
928
1018
  array: !1,
929
1019
  default: void 0,
930
1020
  description: "This option accepts option overrides for the specified identifiers. It should either be a stringified JSON or an absolute filepath to the option overrides file."
931
1021
  }
932
- }, ir = {
1022
+ }, gr = {
933
1023
  // parsers from internal
934
- ...Je.parsers,
935
- ...Ye.parsers,
936
- ...Ve.parsers,
937
- ...Ze.parsers,
938
1024
  ...Qe.parsers,
1025
+ ...Ze.parsers,
1026
+ ...et.parsers,
1027
+ ...nt.parsers,
1028
+ ...tt.parsers,
939
1029
  // parsers from this plugin
940
- ...Ue
1030
+ ...ze
941
1031
  };
942
- var Mn = {
1032
+ var Bn = {
943
1033
  isEqual: !0,
944
1034
  isMatchingKey: !0,
945
1035
  isPromise: !0,
@@ -948,24 +1038,24 @@ var Mn = {
948
1038
  onCacheChange: !0,
949
1039
  onCacheHit: !0,
950
1040
  transformKey: !0
951
- }, Rn = Array.prototype.slice;
1041
+ }, Wn = Array.prototype.slice;
952
1042
  function W(t) {
953
1043
  var n = t.length;
954
- return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] : Rn.call(t, 0) : [];
1044
+ return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] : Wn.call(t, 0) : [];
955
1045
  }
956
- function Nn(t) {
1046
+ function Un(t) {
957
1047
  var n = {};
958
1048
  for (var r in t)
959
- Mn[r] || (n[r] = t[r]);
1049
+ Bn[r] || (n[r] = t[r]);
960
1050
  return n;
961
1051
  }
962
- function Fn(t) {
1052
+ function Kn(t) {
963
1053
  return typeof t == "function" && t.isMemoized;
964
1054
  }
965
- function Cn(t, n) {
1055
+ function Gn(t, n) {
966
1056
  return t === n || t !== t && n !== n;
967
1057
  }
968
- function Oe(t, n) {
1058
+ function Pe(t, n) {
969
1059
  var r = {};
970
1060
  for (var e in t)
971
1061
  r[e] = t[e];
@@ -973,7 +1063,7 @@ function Oe(t, n) {
973
1063
  r[e] = n[e];
974
1064
  return r;
975
1065
  }
976
- var jn = (
1066
+ var zn = (
977
1067
  /** @class */
978
1068
  function() {
979
1069
  function t(n) {
@@ -1006,110 +1096,110 @@ var jn = (
1006
1096
  enumerable: !1,
1007
1097
  configurable: !0
1008
1098
  }), t.prototype._getKeyIndexFromMatchingKey = function(n) {
1009
- var r = this.options, e = r.isMatchingKey, s = r.maxSize, o = this.keys, a = o.length;
1099
+ var r = this.options, e = r.isMatchingKey, o = r.maxSize, s = this.keys, a = s.length;
1010
1100
  if (!a)
1011
1101
  return -1;
1012
- if (e(o[0], n))
1102
+ if (e(s[0], n))
1013
1103
  return 0;
1014
- if (s > 1) {
1104
+ if (o > 1) {
1015
1105
  for (var i = 1; i < a; i++)
1016
- if (e(o[i], n))
1106
+ if (e(s[i], n))
1017
1107
  return i;
1018
1108
  }
1019
1109
  return -1;
1020
1110
  }, t.prototype._getKeyIndexForMany = function(n) {
1021
- var r = this.options.isEqual, e = this.keys, s = e.length;
1022
- if (!s)
1111
+ var r = this.options.isEqual, e = this.keys, o = e.length;
1112
+ if (!o)
1023
1113
  return -1;
1024
- if (s === 1)
1114
+ if (o === 1)
1025
1115
  return this._getKeyIndexForSingle(n);
1026
- var o = n.length, a, i;
1027
- if (o > 1) {
1028
- for (var c = 0; c < s; c++)
1029
- if (a = e[c], a.length === o) {
1030
- for (i = 0; i < o && r(a[i], n[i]); i++)
1116
+ var s = n.length, a, i;
1117
+ if (s > 1) {
1118
+ for (var l = 0; l < o; l++)
1119
+ if (a = e[l], a.length === s) {
1120
+ for (i = 0; i < s && r(a[i], n[i]); i++)
1031
1121
  ;
1032
- if (i === o)
1033
- return c;
1122
+ if (i === s)
1123
+ return l;
1034
1124
  }
1035
1125
  } else
1036
- for (var c = 0; c < s; c++)
1037
- if (a = e[c], a.length === o && r(a[0], n[0]))
1038
- return c;
1126
+ for (var l = 0; l < o; l++)
1127
+ if (a = e[l], a.length === s && r(a[0], n[0]))
1128
+ return l;
1039
1129
  return -1;
1040
1130
  }, t.prototype._getKeyIndexForSingle = function(n) {
1041
1131
  var r = this.keys;
1042
1132
  if (!r.length)
1043
1133
  return -1;
1044
- var e = r[0], s = e.length;
1045
- if (n.length !== s)
1134
+ var e = r[0], o = e.length;
1135
+ if (n.length !== o)
1046
1136
  return -1;
1047
- var o = this.options.isEqual;
1048
- if (s > 1) {
1049
- for (var a = 0; a < s; a++)
1050
- if (!o(e[a], n[a]))
1137
+ var s = this.options.isEqual;
1138
+ if (o > 1) {
1139
+ for (var a = 0; a < o; a++)
1140
+ if (!s(e[a], n[a]))
1051
1141
  return -1;
1052
1142
  return 0;
1053
1143
  }
1054
- return o(e[0], n[0]) ? 0 : -1;
1144
+ return s(e[0], n[0]) ? 0 : -1;
1055
1145
  }, t.prototype.orderByLru = function(n, r, e) {
1056
- for (var s = this.keys, o = this.values, a = s.length, i = e; i--; )
1057
- s[i + 1] = s[i], o[i + 1] = o[i];
1058
- s[0] = n, o[0] = r;
1059
- var c = this.options.maxSize;
1060
- a === c && e === a ? (s.pop(), o.pop()) : e >= c && (s.length = o.length = c);
1146
+ for (var o = this.keys, s = this.values, a = o.length, i = e; i--; )
1147
+ o[i + 1] = o[i], s[i + 1] = s[i];
1148
+ o[0] = n, s[0] = r;
1149
+ var l = this.options.maxSize;
1150
+ a === l && e === a ? (o.pop(), s.pop()) : e >= l && (o.length = s.length = l);
1061
1151
  }, t.prototype.updateAsyncCache = function(n) {
1062
- var r = this, e = this.options, s = e.onCacheChange, o = e.onCacheHit, a = this.keys[0], i = this.values[0];
1063
- this.values[0] = i.then(function(c) {
1064
- return r.shouldUpdateOnHit && o(r, r.options, n), r.shouldUpdateOnChange && s(r, r.options, n), c;
1065
- }, function(c) {
1066
- var l = r.getKeyIndex(a);
1067
- throw l !== -1 && (r.keys.splice(l, 1), r.values.splice(l, 1)), c;
1152
+ var r = this, e = this.options, o = e.onCacheChange, s = e.onCacheHit, a = this.keys[0], i = this.values[0];
1153
+ this.values[0] = i.then(function(l) {
1154
+ return r.shouldUpdateOnHit && s(r, r.options, n), r.shouldUpdateOnChange && o(r, r.options, n), l;
1155
+ }, function(l) {
1156
+ var c = r.getKeyIndex(a);
1157
+ throw c !== -1 && (r.keys.splice(c, 1), r.values.splice(c, 1)), l;
1068
1158
  });
1069
1159
  }, t;
1070
1160
  }()
1071
1161
  );
1072
- function ze(t, n) {
1073
- if (n === void 0 && (n = {}), Fn(t))
1074
- return ze(t.fn, Oe(t.options, n));
1162
+ function Xe(t, n) {
1163
+ if (n === void 0 && (n = {}), Kn(t))
1164
+ return Xe(t.fn, Pe(t.options, n));
1075
1165
  if (typeof t != "function")
1076
1166
  throw new TypeError("You must pass a function to `memoize`.");
1077
- var r = n.isEqual, e = r === void 0 ? Cn : r, s = n.isMatchingKey, o = n.isPromise, a = o === void 0 ? !1 : o, i = n.maxSize, c = i === void 0 ? 1 : i, l = n.onCacheAdd, p = n.onCacheChange, u = n.onCacheHit, v = n.transformKey, b = Oe({
1167
+ var r = n.isEqual, e = r === void 0 ? Gn : r, o = n.isMatchingKey, s = n.isPromise, a = s === void 0 ? !1 : s, i = n.maxSize, l = i === void 0 ? 1 : i, c = n.onCacheAdd, d = n.onCacheChange, m = n.onCacheHit, E = n.transformKey, y = Pe({
1078
1168
  isEqual: e,
1079
- isMatchingKey: s,
1169
+ isMatchingKey: o,
1080
1170
  isPromise: a,
1081
- maxSize: c,
1082
- onCacheAdd: l,
1083
- onCacheChange: p,
1084
- onCacheHit: u,
1085
- transformKey: v
1086
- }, Nn(n)), d = new jn(b), m = d.keys, y = d.values, f = d.canTransformKey, g = d.shouldCloneArguments, h = d.shouldUpdateOnAdd, E = d.shouldUpdateOnChange, _ = d.shouldUpdateOnHit, x = function() {
1087
- var B = g ? W(arguments) : arguments;
1088
- f && (B = v(B));
1089
- var j = m.length ? d.getKeyIndex(B) : -1;
1090
- if (j !== -1)
1091
- _ && u(d, b, x), j && (d.orderByLru(m[j], y[j], j), E && p(d, b, x));
1171
+ maxSize: l,
1172
+ onCacheAdd: c,
1173
+ onCacheChange: d,
1174
+ onCacheHit: m,
1175
+ transformKey: E
1176
+ }, Un(n)), f = new zn(y), u = f.keys, h = f.values, _ = f.canTransformKey, p = f.shouldCloneArguments, g = f.shouldUpdateOnAdd, b = f.shouldUpdateOnChange, x = f.shouldUpdateOnHit, v = function() {
1177
+ var S = p ? W(arguments) : arguments;
1178
+ _ && (S = E(S));
1179
+ var C = u.length ? f.getKeyIndex(S) : -1;
1180
+ if (C !== -1)
1181
+ x && m(f, y, v), C && (f.orderByLru(u[C], h[C], C), b && d(f, y, v));
1092
1182
  else {
1093
- var He = t.apply(this, arguments), Xe = g ? B : W(arguments);
1094
- d.orderByLru(Xe, He, m.length), a && d.updateAsyncCache(x), h && l(d, b, x), E && p(d, b, x);
1183
+ var Ye = t.apply(this, arguments), Ve = p ? S : W(arguments);
1184
+ f.orderByLru(Ve, Ye, u.length), a && f.updateAsyncCache(v), g && c(f, y, v), b && d(f, y, v);
1095
1185
  }
1096
- return y[0];
1186
+ return h[0];
1097
1187
  };
1098
- return x.cache = d, x.fn = t, x.isMemoized = !0, x.options = b, x;
1188
+ return v.cache = f, v.fn = t, v.isMemoized = !0, v.options = y, v;
1099
1189
  }
1100
- async function we(t) {
1190
+ async function je(t) {
1101
1191
  try {
1102
- const n = await tt(t, { encoding: "utf-8" });
1192
+ const n = await ot(t, { encoding: "utf-8" });
1103
1193
  return JSON.parse(n);
1104
1194
  } catch {
1105
1195
  }
1106
1196
  }
1107
- const An = /* @__PURE__ */ new URL(
1197
+ const qn = /* @__PURE__ */ new URL(
1108
1198
  "data:text/javascript," + encodeURIComponent('import{pathToFileURL as r}from"node:url";import{parentPort as t,workerData as a}from"node:worker_threads";const s=async({absolutePath:o})=>{try{const e=await import(r(o).href);t?.postMessage(e.embeddedOverrides??e.default??void 0)}catch{t?.postMessage(void 0)}};s(a);')
1109
1199
  );
1110
- async function Bn(t) {
1200
+ async function Hn(t) {
1111
1201
  return new Promise((n) => {
1112
- const r = new it(An, {
1202
+ const r = new dt(qn, {
1113
1203
  workerData: {
1114
1204
  absolutePath: t
1115
1205
  }
@@ -1121,75 +1211,75 @@ async function Bn(t) {
1121
1211
  });
1122
1212
  });
1123
1213
  }
1124
- async function Wn(t) {
1214
+ async function Xn(t) {
1125
1215
  console.error(
1126
1216
  "Ts module type embeddedOverrides has not been implemented yet."
1127
1217
  );
1128
1218
  }
1129
- const Un = ze(
1219
+ const Jn = Xe(
1130
1220
  async (t, n) => {
1131
- if (nt(t))
1221
+ if (st(t))
1132
1222
  return t;
1133
- const r = await at(n);
1223
+ const r = await lt(n);
1134
1224
  let e;
1135
- return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e = rt(r), st(e, t);
1225
+ return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e = it(r), at(e, t);
1136
1226
  }
1137
- ), Gn = async (t, n) => {
1138
- const r = Un(
1227
+ ), Yn = async (t, n) => {
1228
+ const r = Jn(
1139
1229
  t,
1140
1230
  n
1141
- ), e = ot(t);
1231
+ ), e = ct(t);
1142
1232
  if (e === ".json") {
1143
- const s = await r, o = await we(s);
1144
- if (o !== void 0)
1145
- return o;
1146
- console.error(`Failed to parse the json file: ${s}`);
1233
+ const o = await r, s = await je(o);
1234
+ if (s !== void 0)
1235
+ return s;
1236
+ console.error(`Failed to parse the json file: ${o}`);
1147
1237
  return;
1148
1238
  } else if (e === ".mjs" || e === ".cjs" || e === ".js") {
1149
- const s = await r, o = await Bn(s);
1150
- if (o !== void 0)
1151
- return o;
1152
- console.error(`Failed to parse the js module file: ${s}`);
1239
+ const o = await r, s = await Hn(o);
1240
+ if (s !== void 0)
1241
+ return s;
1242
+ console.error(`Failed to parse the js module file: ${o}`);
1153
1243
  return;
1154
1244
  } else if (e === ".mts" || e === ".cts" || e === ".ts") {
1155
- const s = await r, o = await Wn();
1156
- if (o !== void 0)
1157
- return o;
1158
- console.error(`Failed to parse the ts module file: ${s}`);
1245
+ const o = await r, s = await Xn();
1246
+ if (s !== void 0)
1247
+ return s;
1248
+ console.error(`Failed to parse the ts module file: ${o}`);
1159
1249
  return;
1160
1250
  } else if (e === "") {
1161
- const s = await r, o = await we(s);
1162
- if (o !== void 0)
1163
- return o;
1251
+ const o = await r, s = await je(o);
1252
+ if (s !== void 0)
1253
+ return s;
1164
1254
  }
1165
1255
  try {
1166
1256
  return JSON.parse(t);
1167
1257
  } catch {
1168
1258
  console.error("Failed to parse embeddedOverrides as a json object");
1169
1259
  }
1170
- }, Kn = async (t, n, r) => {
1260
+ }, Vn = async (t, n, r) => {
1171
1261
  if (t === void 0)
1172
1262
  return;
1173
- const e = await Gn(
1263
+ const e = await Yn(
1174
1264
  t,
1175
1265
  r
1176
1266
  );
1177
1267
  if (e !== void 0)
1178
1268
  try {
1179
- for (const { identifiers: s, options: o } of e)
1180
- if (s.includes(n))
1181
- return o;
1269
+ for (const { identifiers: o, options: s } of e)
1270
+ if (o.includes(n))
1271
+ return s;
1182
1272
  } catch {
1183
1273
  console.error("Error parsing embedded override options.");
1184
1274
  }
1185
1275
  };
1186
- function zn({ node: t, parent: n }, r, e) {
1276
+ function Qn({ node: t, parent: n }, r, e) {
1187
1277
  if (r.length === 0 || t.type !== "TemplateLiteral")
1188
1278
  return;
1189
- const s = t.comments ?? n?.comments;
1190
- if (!s)
1279
+ const o = t.comments ?? n?.comments;
1280
+ if (!o)
1191
1281
  return;
1192
- const o = s[s.length - 1];
1282
+ const s = o[o.length - 1];
1193
1283
  if (!(![
1194
1284
  "MultiLine",
1195
1285
  // meriyah
@@ -1197,77 +1287,77 @@ function zn({ node: t, parent: n }, r, e) {
1197
1287
  // typescript, acorn, espree, flow
1198
1288
  "CommentBlock"
1199
1289
  // babel, babel-flow, babel-ts
1200
- ].includes(o.type) || !o.leading)) {
1290
+ ].includes(s.type) || !s.leading)) {
1201
1291
  for (const a of r)
1202
- if (` ${a} ` === o.value && !e.includes(a))
1292
+ if (` ${a} ` === s.value && !e.includes(a))
1203
1293
  return a;
1204
1294
  }
1205
1295
  }
1206
- function qn({ node: t, parent: n }, r, e) {
1296
+ function Zn({ node: t, parent: n }, r, e) {
1207
1297
  if (r.length !== 0 && !(t.type !== "TemplateLiteral" || n?.type !== "TaggedTemplateExpression" || n.tag.type !== "Identifier")) {
1208
- for (const s of r)
1209
- if (n.tag.name === s && !e.includes(s))
1210
- return s;
1298
+ for (const o of r)
1299
+ if (n.tag.name === o && !e.includes(o))
1300
+ return o;
1211
1301
  }
1212
1302
  }
1213
- const { estree: qe } = et, Hn = function(t, n) {
1303
+ const { estree: Je } = rt, er = function(t, n) {
1214
1304
  const { node: r } = t;
1215
1305
  if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: e } }) => e === null))
1216
1306
  return null;
1217
- for (const e of We) {
1218
- const s = n[$(e)];
1219
- if (!s)
1307
+ for (const e of Ge) {
1308
+ const o = n[$(e)];
1309
+ if (!o)
1220
1310
  continue;
1221
- const o = zn(
1311
+ const s = Qn(
1222
1312
  t,
1223
- s,
1313
+ o,
1224
1314
  n.noEmbeddedIdentificationByComment ?? []
1225
- ) ?? qn(
1315
+ ) ?? Zn(
1226
1316
  t,
1227
- s,
1317
+ o,
1228
1318
  n.noEmbeddedIdentificationByTag ?? []
1229
1319
  );
1230
- if (o === void 0)
1320
+ if (s === void 0)
1231
1321
  continue;
1232
- const a = Ge[e];
1322
+ const a = qe[e];
1233
1323
  if (!a)
1234
1324
  return null;
1235
1325
  const i = t.node;
1236
- return i.quasis.length === 1 && i.quasis[0].value.raw.trim() === "" ? "``" : async (c, l, p, u) => {
1237
- const v = await Kn(
1238
- u.embeddedOverrides,
1239
- o,
1240
- u.filepath
1326
+ return i.quasis.length === 1 && i.quasis[0].value.raw.trim() === "" ? "``" : async (l, c, d, m) => {
1327
+ const E = await Vn(
1328
+ m.embeddedOverrides,
1329
+ s,
1330
+ m.filepath
1241
1331
  );
1242
1332
  try {
1243
- const b = await a(c, l, p, u, {
1244
- identifier: o,
1245
- identifiers: s,
1246
- embeddedOverrideOptions: v
1333
+ const y = await a(l, c, d, m, {
1334
+ identifier: s,
1335
+ identifiers: o,
1336
+ embeddedOverrideOptions: E
1247
1337
  });
1248
1338
  return I.label(
1249
- { embed: !0, ...b.label },
1250
- b
1339
+ { embed: !0, ...y.label },
1340
+ y
1251
1341
  );
1252
- } catch (b) {
1253
- throw console.error(b), b;
1342
+ } catch (y) {
1343
+ throw console.error(y), y;
1254
1344
  }
1255
1345
  };
1256
1346
  }
1257
- return qe.embed?.(t, n) ?? null;
1258
- }, ar = {
1347
+ return Je.embed?.(t, n) ?? null;
1348
+ }, pr = {
1259
1349
  estree: {
1260
- ...qe,
1261
- embed: Hn
1350
+ ...Je,
1351
+ embed: er
1262
1352
  }
1263
1353
  };
1264
1354
  export {
1265
- Ge as embeddedEmbedders,
1266
- We as embeddedLanguages,
1267
- Ke as embeddedOptions,
1268
- Ue as embeddedParsers,
1355
+ qe as embeddedEmbedders,
1356
+ Ge as embeddedLanguages,
1357
+ He as embeddedOptions,
1358
+ ze as embeddedParsers,
1269
1359
  $ as makeIdentifiersOptionName,
1270
- or as options,
1271
- ir as parsers,
1272
- ar as printers
1360
+ mr as options,
1361
+ gr as parsers,
1362
+ pr as printers
1273
1363
  };