prettier-plugin-embed 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,46 +1,46 @@
1
- import { utils as G, builders as $ } from "prettier/doc";
2
- import Xe from "prettier/parser-babel";
3
- import Je from "prettier/parser-espree";
4
- import Ye from "prettier/parser-flow";
5
- import Ve from "prettier/parser-meriyah";
6
- import Qe from "prettier/parser-typescript";
7
- import { printers as Ze } from "prettier/plugins/estree.mjs";
8
- import { readFile as et } from "node:fs/promises";
9
- import { isAbsolute as tt, dirname as nt, resolve as rt, extname as st } from "node:path";
10
- import { Worker as ot } from "node:worker_threads";
11
- import { resolveConfigFile as it } from "prettier";
12
- const we = "embeddedCss", { group: at, indent: dt, softline: Y, lineSuffixBoundary: ct } = $, { mapDoc: lt } = G;
13
- function ut(t, n) {
1
+ import { utils as q, builders as I } from "prettier/doc";
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 = at([dt([Y, e]), Y])), ["${", e, ct, "}"];
16
+ return r?.comments?.length && (e = ut([mt([V, e]), V])), ["${", e, gt, "}"];
17
17
  }
18
- function S(t, n) {
18
+ function D(t, n) {
19
19
  return t.map(
20
- (r) => ut(r, n),
20
+ (r) => ft(r, n),
21
21
  "expressions"
22
22
  );
23
23
  }
24
- function k(t, n, r) {
25
- return lt(t, (s) => {
26
- if (typeof s != "string")
27
- return s;
28
- const o = [], a = s.split(n);
24
+ function L(t, n, r) {
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,23 +48,23 @@ 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 mt(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
  }
67
- const V = (() => {
67
+ const Q = (() => {
68
68
  const t = [...Array(26).keys()].map((n) => String.fromCharCode(n + 97)).concat([...Array(10).keys()].map((n) => `${n}`));
69
69
  return () => {
70
70
  let r = "";
@@ -73,9 +73,9 @@ const V = (() => {
73
73
  return r;
74
74
  };
75
75
  })();
76
- function L(t = "p", n = "") {
77
- const r = V(), e = V(), s = Q(t), o = Q(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 {
@@ -83,81 +83,87 @@ function L(t = "p", n = "") {
83
83
  placeholderRegex: i
84
84
  };
85
85
  }
86
- function Q(t) {
86
+ function Z(t) {
87
87
  return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
88
88
  }
89
- function I(t) {
89
+ function $(t) {
90
90
  return `${t}Identifiers`;
91
91
  }
92
- function gt(t) {
92
+ function Re(t) {
93
93
  return `${t}Parser`;
94
94
  }
95
- const { line: Z, group: O, indent: ee, softline: te } = $, 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 } = L("@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 = S(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 = k(b, c, v);
106
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
107
- return O([
108
+ }), u = L(f, l, y);
109
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
110
+ return T([
108
111
  "`",
109
- p,
110
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [O(d)] : ee([O(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 ? Z : te, y = u.length ? Z : te;
115
- return O([
117
+ const h = d.length ? ee : ne, _ = m.length ? ee : ne;
118
+ return T([
116
119
  "`",
117
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, O(d)] : ee([m, O(d)]),
118
- y,
120
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, T(u)] : te([h, T(u)]),
121
+ _,
119
122
  "`"
120
123
  ]);
121
- }, ft = ["css"], ht = I(we), 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: we,
132
- embedder: pt,
133
- options: bt
134
- }, Symbol.toStringTag, { value: "Module" })), H = "embeddedEs", { line: ne, group: T, indent: re, softline: se } = $, 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 } = L(), 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 = S(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 = k(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)] : re([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 ? ne : se, y = u.length ? ne : se;
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)] : re([m, T(d)]),
157
- y,
162
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, k(u)] : oe([h, k(u)]),
163
+ _,
158
164
  "`"
159
165
  ]);
160
- }, _t = [
166
+ }, It = [
161
167
  "js",
162
168
  "jsx",
163
169
  "es",
@@ -166,56 +172,56 @@ const { line: Z, group: O, indent: ee, softline: te } = $, pt = async (t, n, r,
166
172
  "cjs",
167
173
  "pac",
168
174
  "javascript"
169
- ], Et = I(H), xt = gt(H), $t = {
170
- [Et]: {
175
+ ], $t = $(H), St = Re(H), Dt = {
176
+ [$t]: {
171
177
  category: "Global",
172
178
  type: "string",
173
179
  array: !0,
174
- default: [{ value: [..._t] }],
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
- }, It = /* @__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: $t
189
- }, Symbol.toStringTag, { value: "Module" })), Pe = "embeddedGlsl", { line: oe, group: D, indent: ie, softline: ae } = $, St = 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 } = L(), l = a.quasis.map(
195
- (g, h, { length: _ }) => h === _ - 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 = S(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 = k(d, c, b);
203
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
204
- return D([
208
+ }), u = L(f, l, y);
209
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
210
+ return w([
205
211
  "`",
206
- p,
207
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [D(m)] : ie([D(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 ? oe : ae, f = u.length ? oe : ae;
212
- return D([
217
+ const h = d.length ? ie : ce, _ = m.length ? ie : ce;
218
+ return w([
213
219
  "`",
214
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [y, D(m)] : ie([y, D(m)]),
215
- f,
220
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, w(u)] : ae([h, w(u)]),
221
+ _,
216
222
  "`"
217
223
  ]);
218
- }, Lt = [
224
+ }, Tt = [
219
225
  "glsl",
220
226
  "fp",
221
227
  "frag",
@@ -238,63 +244,66 @@ const { line: Z, group: O, indent: ee, softline: te } = $, pt = async (t, n, r,
238
244
  "vrx",
239
245
  "vsh",
240
246
  "vshader"
241
- ], kt = I(Pe), Ot = {
247
+ ], kt = $(Ne), wt = {
242
248
  [kt]: {
243
249
  category: "Global",
244
250
  type: "string",
245
251
  array: !0,
246
- default: [{ value: [...Lt] }],
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: Pe,
252
- embedder: St,
253
- options: Ot
254
- }, Symbol.toStringTag, { value: "Module" })), Re = "embeddedHtml", { line: de, group: w, indent: ce, softline: le } = $, { mapDoc: Dt } = G, 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 } = L(), 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 = S(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 = Dt(b, (f) => {
265
- if (typeof f != "string")
266
- return f;
267
- const g = [], h = f.split(c);
268
- for (let _ = 0; _ < h.length; _++) {
269
- let E = h[_];
270
- if (_ % 2 == 0) {
271
- if (!E)
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
- E = E.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (E = E.replaceAll(/<\/(?=script\b)/gi, "<\\/")), g.push(E);
282
+ v = v.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (v = v.replaceAll(/<\/(?=script\b)/gi, "<\\/")), g.push(v);
274
283
  } else {
275
- const x = Number(E);
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)] : ce([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 ? de : le, y = u.length ? de : le;
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)] : ce([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: Z, group: O, indent: ee, softline: te } = $, pt = async (t, n, r,
307
316
  "jshtm",
308
317
  "volt",
309
318
  "rhtml"
310
- ], Rt = I(Re), Mt = {
311
- [Rt]: {
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
- }, Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
327
+ }, At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
319
328
  __proto__: null,
320
- embeddedLanguage: Re,
321
- embedder: wt,
322
- options: Mt
323
- }, Symbol.toStringTag, { value: "Module" })), Me = "embeddedMarkdown", { line: ue, group: P, indent: me, softline: ge } = $, Nt = 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 } = L(), 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 = S(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 = k(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)] : me([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 ? ue : ge, y = u.length ? ue : ge;
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)] : me([m, P(d)]),
347
- y,
358
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, j(u)] : ge([h, j(u)]),
359
+ _,
348
360
  "`"
349
361
  ]);
350
- }, jt = [
362
+ }, Bt = [
351
363
  "md",
352
364
  "livemd",
353
365
  "markdown",
@@ -359,74 +371,74 @@ const { line: Z, group: O, indent: ee, softline: te } = $, pt = async (t, n, r,
359
371
  "ronn",
360
372
  "scd",
361
373
  "workbook"
362
- ], Ft = I(Me), At = {
363
- [Ft]: {
374
+ ], Wt = $(Ae), Ut = {
375
+ [Wt]: {
364
376
  category: "Global",
365
377
  type: "string",
366
378
  array: !0,
367
- default: [{ value: [...jt] }],
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: Me,
373
- embedder: Nt,
374
- options: At
375
- }, Symbol.toStringTag, { value: "Module" })), X = "embeddedNoop", Wt = I(X), qt = {
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
- }, Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
395
+ }, qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
384
396
  __proto__: null,
385
397
  embeddedLanguage: X,
386
- options: qt
387
- }, Symbol.toStringTag, { value: "Module" })), Ce = "embeddedPhp", { line: pe, group: R, indent: fe, softline: he } = $, Ut = 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 } = L("$p"), l = a.quasis.map(
393
- (g, h, { length: _ }) => h === _ - 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 = S(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 = k(d, c, b);
401
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
402
- return R([
412
+ }), u = L(f, l, y);
413
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
414
+ return M([
403
415
  "`",
404
- p,
405
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [R(m)] : fe([R(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 ? pe : he, f = u.length ? pe : he;
410
- return R([
421
+ const h = d.length ? fe : be, _ = m.length ? fe : be;
422
+ return M([
411
423
  "`",
412
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [y, R(m)] : fe([y, R(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"], Gt = I(Ce), Ht = {
417
- [Gt]: {
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: Ut,
428
- options: Ht
429
- }, Symbol.toStringTag, { value: "Module" })), Ne = "embeddedRuby", q = [
439
+ embedder: Ht,
440
+ options: Yt
441
+ }, Symbol.toStringTag, { value: "Module" })), Be = "embeddedRuby", U = [
430
442
  "ruby",
431
443
  "arb",
432
444
  "axlsx",
@@ -452,267 +464,313 @@ const { line: Z, group: O, indent: ee, softline: te } = $, pt = async (t, n, r,
452
464
  "ru",
453
465
  "thor",
454
466
  "watchr"
455
- ], K = ["rbs"], U = ["haml"], Jt = [
456
- ...q,
467
+ ], K = ["rbs"], G = ["haml"], Qt = [
468
+ ...U,
457
469
  ...K,
458
- ...U
459
- ], Yt = "embeddedRubyParser", Vt = I(Ne), Qt = {
460
- [Vt]: {
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: be, group: M, indent: ye, softline: ve } = $, 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 } = L(), p = i.quasis.map(
480
- (_, E, { length: x }) => E === x - 1 ? _.value.cooked : _.value.cooked + c(E)
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 = S(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 = k(y, l, d);
488
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
489
- return M([
498
+ parser: u
499
+ }), _ = L(h, c, f);
500
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
501
+ return R([
490
502
  "`",
491
- u,
492
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [M(f)] : ye([M(f)]),
493
- v,
503
+ m,
504
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [R(_)] : ve([R(_)]),
505
+ E,
494
506
  "`"
495
507
  ]);
496
- const g = u.length ? be : ve, h = v.length ? be : ve;
497
- return M([
508
+ const p = m.length ? ye : Ee, g = E.length ? ye : Ee;
509
+ return R([
498
510
  "`",
499
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [g, M(f)] : ye([g, M(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))
510
- return q[0];
511
- if (nn(n))
512
- return K[0];
513
- if (rn(n))
520
+ for (let o = e; o >= 0; --o) {
521
+ if (on(n))
514
522
  return U[0];
523
+ if (sn(n))
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) {
519
- return q.includes(t);
530
+ function on(t) {
531
+ return U.includes(t);
520
532
  }
521
- function nn(t) {
533
+ function sn(t) {
522
534
  return K.includes(t);
523
535
  }
524
- function rn(t) {
525
- return U.includes(t);
536
+ function an(t) {
537
+ return G.includes(t);
526
538
  }
527
- const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
539
+ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
528
540
  __proto__: null,
529
- HAML_PARSER_IDENTIFIERS: U,
541
+ HAML_PARSER_IDENTIFIERS: G,
530
542
  RBS_PARSER_IDENTIFIERS: K,
531
- RUBY_PARSER_IDENTIFIERS: q,
532
- embeddedLanguage: Ne,
533
- embedder: Zt,
534
- options: Qt
535
- }, Symbol.toStringTag, { value: "Module" })), je = "embeddedSql", { hardline: on, group: C, line: _e, softline: Ee, indent: xe } = $, { mapDoc: an } = G, dn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
536
- A("prettier-plugin-sql", e, s), e = {
543
+ RUBY_PARSER_IDENTIFIERS: U,
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 } = L(), 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 = S(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 _ = 0; _ < h.length; _++) {
550
- let E = h[_];
551
- if (_ % 2 == 0) {
552
- if (!E)
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
- E = E.replaceAll(/([\\`]|\${)/g, "\\$1"), E.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(E);
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))
564
- return C([
650
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
651
+ return N([
565
652
  "`",
566
- p,
567
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [C(d)] : xe([C(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 : Ee, y = u.length ? _e : Ee;
572
- return C([
658
+ const h = d.length ? Ie : $e, _ = m.length ? Ie : $e;
659
+ return N([
573
660
  "`",
574
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, C(d)] : xe([m, C(d)]),
575
- y,
661
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, N(u)] : Se([h, N(u)]),
662
+ _,
576
663
  "`"
577
664
  ]);
578
- }, cn = [
579
- "sql",
580
- "bigquery",
581
- "db2",
582
- "db2i",
583
- "hive",
584
- "mariadb",
585
- "mysql",
586
- "n1ql",
587
- "postgresql",
588
- "plsql",
589
- "redshift",
590
- "singlestoredb",
591
- "snowflake",
592
- "spark",
593
- "sqlite",
594
- "transactsql",
595
- "tsql",
596
- "trino"
597
- ], ln = [
598
- "bigquery",
599
- "db2",
600
- "hive",
601
- "mariadb",
602
- "mysql",
603
- "postgresql",
604
- "transactsql",
605
- "flinksql",
606
- "snowflake"
607
- ], un = I(je), mn = {
608
- [un]: {
665
+ }, hn = ["sql"], bn = $(We), yn = {
666
+ [bn]: {
609
667
  category: "Global",
610
668
  type: "string",
611
669
  array: !0,
612
- // TODO: remove these hardcoded defaults once supported diacts are exported from prettier-plugin-sql
613
- default: [{ value: ["sql", "mysql", "mariadb", "postgresql"] }],
670
+ default: [{ value: [...hn] }],
614
671
  description: 'Specify embedded SQL language identifiers. This requires "prettier-plugin-sql".'
615
672
  }
616
- }, gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
673
+ }, vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
617
674
  __proto__: null,
618
- NODE_SQL_PARSER_DATABASES: ln,
619
- SQL_FORMATTER_LANGUAGES: cn,
620
- embeddedLanguage: je,
621
- embedder: dn,
622
- options: mn
623
- }, Symbol.toStringTag, { value: "Module" })), Fe = "embeddedTs", { line: $e, group: N, indent: Ie, softline: Se } = $, pn = 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 }) => {
624
679
  e = {
625
680
  ...e,
626
- ...o
681
+ ...s
627
682
  };
628
- const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = L(), l = a.quasis.map(
629
- (f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g)
630
- ).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = S(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, {
631
689
  ...e,
632
690
  parser: e.embeddedTsParser ?? "typescript",
633
691
  // set filepath to undefined to enable jsx auto detection:
634
692
  // https://github.com/prettier/prettier/blob/427a84d24203e2d54160cde153a1e6a6390fe65a/src/language-js/parse/typescript.js#L49-L53
635
693
  filepath: void 0
636
- }), d = k(b, c, v);
637
- if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
638
- return N([
694
+ }), u = L(f, l, y);
695
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
696
+ return F([
639
697
  "`",
640
- p,
641
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [N(d)] : Ie([N(d)]),
642
- u,
698
+ d,
699
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [F(u)] : Oe([F(u)]),
700
+ m,
643
701
  "`"
644
702
  ]);
645
- const m = p.length ? $e : Se, y = u.length ? $e : Se;
646
- return N([
703
+ const h = d.length ? De : Le, _ = m.length ? De : Le;
704
+ return F([
647
705
  "`",
648
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, N(d)] : Ie([m, N(d)]),
649
- y,
706
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, F(u)] : Oe([h, F(u)]),
707
+ _,
650
708
  "`"
651
709
  ]);
652
- }, fn = ["ts", "tsx", "cts", "mts", "typescript"], hn = "embeddedTsParser", bn = I(Fe), yn = {
653
- [bn]: {
710
+ }, _n = ["ts", "tsx", "cts", "mts", "typescript"], xn = Re(J), In = $(J), $n = {
711
+ [In]: {
654
712
  category: "Global",
655
713
  type: "string",
656
714
  array: !0,
657
- default: [{ value: [...fn] }],
715
+ default: [{ value: [..._n] }],
658
716
  description: "Specify embedded TS language parsers."
659
717
  },
660
- [hn]: {
718
+ [xn]: {
661
719
  category: "Global",
662
720
  type: "string",
663
721
  array: !1,
664
722
  default: "typescript",
665
723
  description: "Specify the embedded TS language parser."
666
724
  }
667
- }, vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
725
+ }, Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
668
726
  __proto__: null,
669
- embeddedLanguage: Fe,
670
- embedder: pn,
671
- options: yn
672
- }, Symbol.toStringTag, { value: "Module" })), J = "embeddedXml", { line: Le, group: j, indent: ke, softline: z } = $, _n = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
673
- A("@prettier/plugin-xml", e, s), e = {
727
+ embeddedLanguage: J,
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 = {
674
732
  ...e,
675
- ...o
733
+ ...s
676
734
  };
677
- const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = L(), l = a.quasis.map(
678
- (h, _, { length: E }) => _ === E - 1 ? h.value.cooked : h.value.cooked + i(_)
679
- ).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = l.slice(
680
- p.length,
681
- -u.length || void 0
682
- ), b = S(r, n), d = [];
683
- let m = 0;
684
- for (; m !== void 0; ) {
685
- const h = v.slice(m);
686
- 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)
687
745
  break;
688
- m > 0 && e.xmlWhitespaceSensitivity !== "strict" && d.push(z), e.__embeddedXmlFragmentRecoverIndex?.splice(
746
+ u > 0 && e.xmlWhitespaceSensitivity !== "strict" && f.push(z), e.__embeddedXmlFragmentRecoverIndex?.splice(
689
747
  0,
690
748
  e.__embeddedXmlFragmentRecoverIndex.length
691
749
  );
692
- let _ = await t(h, {
750
+ let b = await t(g, {
693
751
  ...e,
694
- parser: J
752
+ parser: Y
695
753
  });
696
- const [E, x] = e.__embeddedXmlFragmentRecoverIndex ?? [];
697
- E === void 0 ? m = void 0 : x === void 0 ? m += E : (_ = h.slice(E, x + 1), m += x + 1), d.push(_);
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);
698
756
  }
699
- const y = k(d, c, b);
700
- if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(s))
701
- return j([
757
+ const h = L(f, l, y);
758
+ if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(o))
759
+ return A([
702
760
  "`",
703
- p,
704
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [j(y)] : ke([j(y)]),
705
- u,
761
+ d,
762
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [A(h)] : ke([A(h)]),
763
+ m,
706
764
  "`"
707
765
  ]);
708
- const f = p.length ? Le : z, g = u.length ? Le : z;
709
- return j([
766
+ const _ = d.length ? Te : z, p = m.length ? Te : z;
767
+ return A([
710
768
  "`",
711
- e.noEmbeddedMultiLineIndentation?.includes(s) ? [f, j(y)] : ke([f, j(y)]),
712
- g,
769
+ e.noEmbeddedMultiLineIndentation?.includes(o) ? [_, A(h)] : ke([_, A(h)]),
770
+ p,
713
771
  "`"
714
772
  ]);
715
- }, En = [
773
+ }, On = [
716
774
  "xml",
717
775
  "xsd",
718
776
  "ascx",
@@ -769,12 +827,12 @@ const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
769
827
  "xpdl",
770
828
  "xul",
771
829
  "xoml"
772
- ], xn = I(J), $n = {
773
- [xn]: {
830
+ ], Ln = $(Y), Tn = {
831
+ [Ln]: {
774
832
  category: "Global",
775
833
  type: "string",
776
834
  array: !0,
777
- default: [{ value: [...En] }],
835
+ default: [{ value: [...On] }],
778
836
  description: 'Specify embedded XML language identifiers. This requires "@prettier/plugin-xml".'
779
837
  },
780
838
  /** @internal */
@@ -786,7 +844,7 @@ const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
786
844
  description: "This option is read only and used as a workaround to support xml fragments"
787
845
  }
788
846
  };
789
- function In(t) {
847
+ function kn(t) {
790
848
  const n = {
791
849
  loc: {
792
850
  start: {
@@ -806,7 +864,7 @@ function In(t) {
806
864
  );
807
865
  return Object.assign(r, n), r;
808
866
  }
809
- function Oe(t) {
867
+ function we(t) {
810
868
  const n = {
811
869
  loc: {
812
870
  start: {
@@ -826,20 +884,20 @@ function Oe(t) {
826
884
  );
827
885
  return Object.assign(r, n), r;
828
886
  }
829
- const Sn = {
887
+ const wn = {
830
888
  async parse(t, n) {
831
- 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);
832
890
  if (e.length > 0) {
833
891
  const a = e[0];
834
- throw In(a);
892
+ throw kn(a);
835
893
  }
836
- if (s.length > 0) {
894
+ if (o.length > 0) {
837
895
  let a = !1;
838
- for (const i of s) {
896
+ for (const i of o) {
839
897
  if (!["MismatchedTokenException", "NotAllInputParsedException"].includes(
840
898
  i.name
841
899
  ))
842
- throw Oe(i);
900
+ throw we(i);
843
901
  if (i.message === "Expecting token of type --> OPEN <-- but found --> '' <--") {
844
902
  a = !0;
845
903
  continue;
@@ -867,11 +925,11 @@ const Sn = {
867
925
  ), a = !0;
868
926
  break;
869
927
  }
870
- throw Oe(i);
928
+ throw we(i);
871
929
  }
872
- a && Ae(o);
930
+ a && Ke(s);
873
931
  }
874
- return o;
932
+ return s;
875
933
  },
876
934
  astFormat: "xml",
877
935
  locStart(t) {
@@ -881,97 +939,97 @@ const Sn = {
881
939
  return t.location.endOffset ?? NaN;
882
940
  }
883
941
  };
884
- function Ae(t) {
942
+ function Ke(t) {
885
943
  const n = t.children;
886
944
  for (const r in n) {
887
945
  const e = n[r] ?? [];
888
- for (let s = e.length - 1; s >= 0; --s) {
889
- const o = e[s];
890
- if (Ln(o)) {
891
- if (Object.keys(o.children).length === 0) {
892
- 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];
893
951
  continue;
894
952
  }
895
- Ae(o);
953
+ Ke(s);
896
954
  }
897
955
  }
898
956
  }
899
957
  }
900
- function Ln(t) {
958
+ function Pn(t) {
901
959
  return "name" in t && "children" in t && "location" in t;
902
960
  }
903
- const kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
961
+ const jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
904
962
  __proto__: null,
905
- embeddedLanguage: J,
906
- embedder: _n,
907
- options: $n,
908
- parser: Sn
909
- }, Symbol.toStringTag, { value: "Module" })), Be = [], We = {}, qe = {}, Ke = {}, On = /* @__PURE__ */ Object.assign({
910
- "./css/index.ts": yt,
911
- "./es/index.ts": It,
912
- "./glsl/index.ts": Tt,
913
- "./html/index.ts": Ct,
914
- "./markdown/index.ts": Bt,
915
- "./noop/index.ts": Kt,
916
- "./php/index.ts": Xt,
917
- "./ruby/index.ts": sn,
918
- "./sql/index.ts": gn,
919
- "./ts/index.ts": vn,
920
- "./xml/index.ts": kn
963
+ embeddedLanguage: Y,
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
921
979
  });
922
- Object.values(On).forEach(
980
+ Object.values(Mn).forEach(
923
981
  ({ embeddedLanguage: t, parser: n, embedder: r, options: e }) => {
924
- mt(Be, t, X), n && (We[t] = n), r && (qe[t] = r), Object.assign(Ke, e);
982
+ ht(Ge, t, X), n && (ze[t] = n), r && (qe[t] = r), Object.assign(He, e);
925
983
  }
926
984
  );
927
- const Tn = "noEmbeddedIdentificationByComment", Dn = "noEmbeddedIdentificationByTag", wn = "preserveEmbeddedExteriorWhitespaces", Pn = "noEmbeddedMultiLineIndentation", Rn = "embeddedOverrides", ir = {
928
- ...Ke,
929
- [Tn]: {
985
+ const Rn = "noEmbeddedIdentificationByComment", Nn = "noEmbeddedIdentificationByTag", Fn = "preserveEmbeddedExteriorWhitespaces", An = "noEmbeddedMultiLineIndentation", Cn = "embeddedOverrides", mr = {
986
+ ...He,
987
+ [Rn]: {
930
988
  category: "Global",
931
989
  type: "string",
932
990
  array: !0,
933
991
  default: [{ value: [] }],
934
992
  description: 'This option turns off "/* identifier */ `...`" comment-based language identification for the specified identifiers.'
935
993
  },
936
- [Dn]: {
994
+ [Nn]: {
937
995
  category: "Global",
938
996
  type: "string",
939
997
  array: !0,
940
998
  default: [{ value: [] }],
941
999
  description: 'This option turns off "identifier`...`" tag-based language identification for the specified identifiers.'
942
1000
  },
943
- [wn]: {
1001
+ [Fn]: {
944
1002
  category: "Config",
945
1003
  type: "string",
946
1004
  array: !0,
947
1005
  default: [{ value: [] }],
948
1006
  description: "This option preserves leading and trailing whitespaces in the formatting results for the specified identifiers."
949
1007
  },
950
- [Pn]: {
1008
+ [An]: {
951
1009
  category: "Global",
952
1010
  type: "string",
953
1011
  array: !0,
954
1012
  default: [{ value: [] }],
955
1013
  description: "This option turns off auto indentation in the formatting results for the specified identifiers when they are formatted to span multi lines."
956
1014
  },
957
- [Rn]: {
1015
+ [Cn]: {
958
1016
  category: "Global",
959
1017
  type: "string",
960
1018
  array: !1,
961
1019
  default: void 0,
962
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."
963
1021
  }
964
- }, ar = {
1022
+ }, gr = {
965
1023
  // parsers from internal
966
- ...Xe.parsers,
967
- ...Je.parsers,
968
- ...Ye.parsers,
969
1024
  ...Qe.parsers,
970
- ...Ve.parsers,
1025
+ ...Ze.parsers,
1026
+ ...et.parsers,
1027
+ ...nt.parsers,
1028
+ ...tt.parsers,
971
1029
  // parsers from this plugin
972
- ...We
1030
+ ...ze
973
1031
  };
974
- var Mn = {
1032
+ var Bn = {
975
1033
  isEqual: !0,
976
1034
  isMatchingKey: !0,
977
1035
  isPromise: !0,
@@ -980,24 +1038,24 @@ var Mn = {
980
1038
  onCacheChange: !0,
981
1039
  onCacheHit: !0,
982
1040
  transformKey: !0
983
- }, Cn = Array.prototype.slice;
1041
+ }, Wn = Array.prototype.slice;
984
1042
  function W(t) {
985
1043
  var n = t.length;
986
- return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] : Cn.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) : [];
987
1045
  }
988
- function Nn(t) {
1046
+ function Un(t) {
989
1047
  var n = {};
990
1048
  for (var r in t)
991
- Mn[r] || (n[r] = t[r]);
1049
+ Bn[r] || (n[r] = t[r]);
992
1050
  return n;
993
1051
  }
994
- function jn(t) {
1052
+ function Kn(t) {
995
1053
  return typeof t == "function" && t.isMemoized;
996
1054
  }
997
- function Fn(t, n) {
1055
+ function Gn(t, n) {
998
1056
  return t === n || t !== t && n !== n;
999
1057
  }
1000
- function Te(t, n) {
1058
+ function Pe(t, n) {
1001
1059
  var r = {};
1002
1060
  for (var e in t)
1003
1061
  r[e] = t[e];
@@ -1005,7 +1063,7 @@ function Te(t, n) {
1005
1063
  r[e] = n[e];
1006
1064
  return r;
1007
1065
  }
1008
- var An = (
1066
+ var zn = (
1009
1067
  /** @class */
1010
1068
  function() {
1011
1069
  function t(n) {
@@ -1038,110 +1096,110 @@ var An = (
1038
1096
  enumerable: !1,
1039
1097
  configurable: !0
1040
1098
  }), t.prototype._getKeyIndexFromMatchingKey = function(n) {
1041
- 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;
1042
1100
  if (!a)
1043
1101
  return -1;
1044
- if (e(o[0], n))
1102
+ if (e(s[0], n))
1045
1103
  return 0;
1046
- if (s > 1) {
1104
+ if (o > 1) {
1047
1105
  for (var i = 1; i < a; i++)
1048
- if (e(o[i], n))
1106
+ if (e(s[i], n))
1049
1107
  return i;
1050
1108
  }
1051
1109
  return -1;
1052
1110
  }, t.prototype._getKeyIndexForMany = function(n) {
1053
- var r = this.options.isEqual, e = this.keys, s = e.length;
1054
- if (!s)
1111
+ var r = this.options.isEqual, e = this.keys, o = e.length;
1112
+ if (!o)
1055
1113
  return -1;
1056
- if (s === 1)
1114
+ if (o === 1)
1057
1115
  return this._getKeyIndexForSingle(n);
1058
- var o = n.length, a, i;
1059
- if (o > 1) {
1060
- for (var c = 0; c < s; c++)
1061
- if (a = e[c], a.length === o) {
1062
- 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++)
1063
1121
  ;
1064
- if (i === o)
1065
- return c;
1122
+ if (i === s)
1123
+ return l;
1066
1124
  }
1067
1125
  } else
1068
- for (var c = 0; c < s; c++)
1069
- if (a = e[c], a.length === o && r(a[0], n[0]))
1070
- 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;
1071
1129
  return -1;
1072
1130
  }, t.prototype._getKeyIndexForSingle = function(n) {
1073
1131
  var r = this.keys;
1074
1132
  if (!r.length)
1075
1133
  return -1;
1076
- var e = r[0], s = e.length;
1077
- if (n.length !== s)
1134
+ var e = r[0], o = e.length;
1135
+ if (n.length !== o)
1078
1136
  return -1;
1079
- var o = this.options.isEqual;
1080
- if (s > 1) {
1081
- for (var a = 0; a < s; a++)
1082
- 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]))
1083
1141
  return -1;
1084
1142
  return 0;
1085
1143
  }
1086
- return o(e[0], n[0]) ? 0 : -1;
1144
+ return s(e[0], n[0]) ? 0 : -1;
1087
1145
  }, t.prototype.orderByLru = function(n, r, e) {
1088
- for (var s = this.keys, o = this.values, a = s.length, i = e; i--; )
1089
- s[i + 1] = s[i], o[i + 1] = o[i];
1090
- s[0] = n, o[0] = r;
1091
- var c = this.options.maxSize;
1092
- 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);
1093
1151
  }, t.prototype.updateAsyncCache = function(n) {
1094
- var r = this, e = this.options, s = e.onCacheChange, o = e.onCacheHit, a = this.keys[0], i = this.values[0];
1095
- this.values[0] = i.then(function(c) {
1096
- return r.shouldUpdateOnHit && o(r, r.options, n), r.shouldUpdateOnChange && s(r, r.options, n), c;
1097
- }, function(c) {
1098
- var l = r.getKeyIndex(a);
1099
- 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;
1100
1158
  });
1101
1159
  }, t;
1102
1160
  }()
1103
1161
  );
1104
- function Ue(t, n) {
1105
- if (n === void 0 && (n = {}), jn(t))
1106
- return Ue(t.fn, Te(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));
1107
1165
  if (typeof t != "function")
1108
1166
  throw new TypeError("You must pass a function to `memoize`.");
1109
- var r = n.isEqual, e = r === void 0 ? Fn : 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 = Te({
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({
1110
1168
  isEqual: e,
1111
- isMatchingKey: s,
1169
+ isMatchingKey: o,
1112
1170
  isPromise: a,
1113
- maxSize: c,
1114
- onCacheAdd: l,
1115
- onCacheChange: p,
1116
- onCacheHit: u,
1117
- transformKey: v
1118
- }, Nn(n)), d = new An(b), m = d.keys, y = d.values, f = d.canTransformKey, g = d.shouldCloneArguments, h = d.shouldUpdateOnAdd, _ = d.shouldUpdateOnChange, E = d.shouldUpdateOnHit, x = function() {
1119
- var B = g ? W(arguments) : arguments;
1120
- f && (B = v(B));
1121
- var F = m.length ? d.getKeyIndex(B) : -1;
1122
- if (F !== -1)
1123
- E && u(d, b, x), F && (d.orderByLru(m[F], y[F], F), _ && 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));
1124
1182
  else {
1125
- var Ge = t.apply(this, arguments), He = g ? B : W(arguments);
1126
- d.orderByLru(He, Ge, m.length), a && d.updateAsyncCache(x), h && l(d, b, x), _ && 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);
1127
1185
  }
1128
- return y[0];
1186
+ return h[0];
1129
1187
  };
1130
- 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;
1131
1189
  }
1132
- async function De(t) {
1190
+ async function je(t) {
1133
1191
  try {
1134
- const n = await et(t, { encoding: "utf-8" });
1192
+ const n = await ot(t, { encoding: "utf-8" });
1135
1193
  return JSON.parse(n);
1136
1194
  } catch {
1137
1195
  }
1138
1196
  }
1139
- const Bn = /* @__PURE__ */ new URL(
1197
+ const qn = /* @__PURE__ */ new URL(
1140
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);')
1141
1199
  );
1142
- async function Wn(t) {
1200
+ async function Hn(t) {
1143
1201
  return new Promise((n) => {
1144
- const r = new ot(Bn, {
1202
+ const r = new dt(qn, {
1145
1203
  workerData: {
1146
1204
  absolutePath: t
1147
1205
  }
@@ -1153,75 +1211,75 @@ async function Wn(t) {
1153
1211
  });
1154
1212
  });
1155
1213
  }
1156
- async function qn(t) {
1214
+ async function Xn(t) {
1157
1215
  console.error(
1158
1216
  "Ts module type embeddedOverrides has not been implemented yet."
1159
1217
  );
1160
1218
  }
1161
- const Kn = Ue(
1219
+ const Jn = Xe(
1162
1220
  async (t, n) => {
1163
- if (tt(t))
1221
+ if (st(t))
1164
1222
  return t;
1165
- const r = await it(n);
1223
+ const r = await lt(n);
1166
1224
  let e;
1167
- return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e = nt(r), rt(e, t);
1225
+ return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e = it(r), at(e, t);
1168
1226
  }
1169
- ), Un = async (t, n) => {
1170
- const r = Kn(
1227
+ ), Yn = async (t, n) => {
1228
+ const r = Jn(
1171
1229
  t,
1172
1230
  n
1173
- ), e = st(t);
1231
+ ), e = ct(t);
1174
1232
  if (e === ".json") {
1175
- const s = await r, o = await De(s);
1176
- if (o !== void 0)
1177
- return o;
1178
- 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}`);
1179
1237
  return;
1180
1238
  } else if (e === ".mjs" || e === ".cjs" || e === ".js") {
1181
- const s = await r, o = await Wn(s);
1182
- if (o !== void 0)
1183
- return o;
1184
- 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}`);
1185
1243
  return;
1186
1244
  } else if (e === ".mts" || e === ".cts" || e === ".ts") {
1187
- const s = await r, o = await qn();
1188
- if (o !== void 0)
1189
- return o;
1190
- 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}`);
1191
1249
  return;
1192
1250
  } else if (e === "") {
1193
- const s = await r, o = await De(s);
1194
- if (o !== void 0)
1195
- return o;
1251
+ const o = await r, s = await je(o);
1252
+ if (s !== void 0)
1253
+ return s;
1196
1254
  }
1197
1255
  try {
1198
1256
  return JSON.parse(t);
1199
1257
  } catch {
1200
1258
  console.error("Failed to parse embeddedOverrides as a json object");
1201
1259
  }
1202
- }, zn = async (t, n, r) => {
1260
+ }, Vn = async (t, n, r) => {
1203
1261
  if (t === void 0)
1204
1262
  return;
1205
- const e = await Un(
1263
+ const e = await Yn(
1206
1264
  t,
1207
1265
  r
1208
1266
  );
1209
1267
  if (e !== void 0)
1210
1268
  try {
1211
- for (const { identifiers: s, options: o } of e)
1212
- if (s.includes(n))
1213
- return o;
1269
+ for (const { identifiers: o, options: s } of e)
1270
+ if (o.includes(n))
1271
+ return s;
1214
1272
  } catch {
1215
1273
  console.error("Error parsing embedded override options.");
1216
1274
  }
1217
1275
  };
1218
- function Gn({ node: t, parent: n }, r, e) {
1276
+ function Qn({ node: t, parent: n }, r, e) {
1219
1277
  if (r.length === 0 || t.type !== "TemplateLiteral")
1220
1278
  return;
1221
- const s = t.comments ?? n?.comments;
1222
- if (!s)
1279
+ const o = t.comments ?? n?.comments;
1280
+ if (!o)
1223
1281
  return;
1224
- const o = s[s.length - 1];
1282
+ const s = o[o.length - 1];
1225
1283
  if (!(![
1226
1284
  "MultiLine",
1227
1285
  // meriyah
@@ -1229,77 +1287,77 @@ function Gn({ node: t, parent: n }, r, e) {
1229
1287
  // typescript, acorn, espree, flow
1230
1288
  "CommentBlock"
1231
1289
  // babel, babel-flow, babel-ts
1232
- ].includes(o.type) || !o.leading)) {
1290
+ ].includes(s.type) || !s.leading)) {
1233
1291
  for (const a of r)
1234
- if (` ${a} ` === o.value && !e.includes(a))
1292
+ if (` ${a} ` === s.value && !e.includes(a))
1235
1293
  return a;
1236
1294
  }
1237
1295
  }
1238
- function Hn({ node: t, parent: n }, r, e) {
1296
+ function Zn({ node: t, parent: n }, r, e) {
1239
1297
  if (r.length !== 0 && !(t.type !== "TemplateLiteral" || n?.type !== "TaggedTemplateExpression" || n.tag.type !== "Identifier")) {
1240
- for (const s of r)
1241
- if (n.tag.name === s && !e.includes(s))
1242
- return s;
1298
+ for (const o of r)
1299
+ if (n.tag.name === o && !e.includes(o))
1300
+ return o;
1243
1301
  }
1244
1302
  }
1245
- const { estree: ze } = Ze, Xn = function(t, n) {
1303
+ const { estree: Je } = rt, er = function(t, n) {
1246
1304
  const { node: r } = t;
1247
1305
  if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: e } }) => e === null))
1248
1306
  return null;
1249
- for (const e of Be) {
1250
- const s = n[I(e)];
1251
- if (!s)
1307
+ for (const e of Ge) {
1308
+ const o = n[$(e)];
1309
+ if (!o)
1252
1310
  continue;
1253
- const o = Gn(
1311
+ const s = Qn(
1254
1312
  t,
1255
- s,
1313
+ o,
1256
1314
  n.noEmbeddedIdentificationByComment ?? []
1257
- ) ?? Hn(
1315
+ ) ?? Zn(
1258
1316
  t,
1259
- s,
1317
+ o,
1260
1318
  n.noEmbeddedIdentificationByTag ?? []
1261
1319
  );
1262
- if (o === void 0)
1320
+ if (s === void 0)
1263
1321
  continue;
1264
1322
  const a = qe[e];
1265
1323
  if (!a)
1266
1324
  return null;
1267
1325
  const i = t.node;
1268
- return i.quasis.length === 1 && i.quasis[0].value.raw.trim() === "" ? "``" : async (c, l, p, u) => {
1269
- const v = await zn(
1270
- u.embeddedOverrides,
1271
- o,
1272
- 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
1273
1331
  );
1274
1332
  try {
1275
- const b = await a(c, l, p, u, {
1276
- identifier: o,
1277
- identifiers: s,
1278
- embeddedOverrideOptions: v
1333
+ const y = await a(l, c, d, m, {
1334
+ identifier: s,
1335
+ identifiers: o,
1336
+ embeddedOverrideOptions: E
1279
1337
  });
1280
- return $.label(
1281
- { embed: !0, ...b.label },
1282
- b
1338
+ return I.label(
1339
+ { embed: !0, ...y.label },
1340
+ y
1283
1341
  );
1284
- } catch (b) {
1285
- throw console.error(b), b;
1342
+ } catch (y) {
1343
+ throw console.error(y), y;
1286
1344
  }
1287
1345
  };
1288
1346
  }
1289
- return ze.embed?.(t, n) ?? null;
1290
- }, dr = {
1347
+ return Je.embed?.(t, n) ?? null;
1348
+ }, pr = {
1291
1349
  estree: {
1292
- ...ze,
1293
- embed: Xn
1350
+ ...Je,
1351
+ embed: er
1294
1352
  }
1295
1353
  };
1296
1354
  export {
1297
1355
  qe as embeddedEmbedders,
1298
- Be as embeddedLanguages,
1299
- Ke as embeddedOptions,
1300
- We as embeddedParsers,
1301
- I as makeIdentifiersOptionName,
1302
- ir as options,
1303
- ar as parsers,
1304
- dr as printers
1356
+ Ge as embeddedLanguages,
1357
+ He as embeddedOptions,
1358
+ ze as embeddedParsers,
1359
+ $ as makeIdentifiersOptionName,
1360
+ mr as options,
1361
+ gr as parsers,
1362
+ pr as printers
1305
1363
  };