@i18n-micro/vue 1.3.12 → 1.4.0

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.mjs CHANGED
@@ -1,8 +1,7 @@
1
- import { defineComponent as q, inject as S, h as g, computed as k, ref as Q, onMounted as ae, onUnmounted as oe, nextTick as re, shallowRef as z } from "vue";
1
+ import { defineComponent as G, inject as S, h as g, computed as k, ref as Q, onMounted as ae, onUnmounted as oe, nextTick as re, shallowRef as z } from "vue";
2
2
  import { BaseI18n as le } from "@i18n-micro/core";
3
- import { FormatService as Pe, defaultPlural as $e, interpolate as Re } from "@i18n-micro/core";
4
- import { RouterLink as ie } from "vue-router";
5
- const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-locales"), ee = /* @__PURE__ */ Symbol("i18n-default-locale"), U = /* @__PURE__ */ Symbol("i18n-router-strategy"), ce = q({
3
+ import { FormatService as Se, defaultPlural as we, interpolate as ke } from "@i18n-micro/core";
4
+ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-locales"), ee = /* @__PURE__ */ Symbol("i18n-default-locale"), U = /* @__PURE__ */ Symbol("i18n-router-strategy"), ie = G({
6
5
  name: "I18nGroup",
7
6
  props: {
8
7
  prefix: {
@@ -27,7 +26,7 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
27
26
  e.default?.({ prefix: t.prefix, t: o })
28
27
  );
29
28
  }
30
- }), se = q({
29
+ }), ce = G({
31
30
  name: "I18nLink",
32
31
  props: {
33
32
  to: {
@@ -58,12 +57,12 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
58
57
  return typeof t.to == "string" ? t.to : t.to.path || "/";
59
58
  const i = o.resolvePath(t.to, a.locale.value);
60
59
  return typeof i == "string" ? i : i.path || "/";
61
- }), s = k(() => {
60
+ }), u = k(() => {
62
61
  if (c.value || !o)
63
62
  return !1;
64
63
  const i = o.getCurrentPath().replace(/#.*$/, "").replace(/\/$/, ""), n = r.value.replace(/#.*$/, "").replace(/\/$/, "");
65
64
  return i === n;
66
- }), f = k(() => s.value ? t.activeStyle : {});
65
+ }), f = k(() => u.value ? t.activeStyle : {});
67
66
  return () => c.value ? g(
68
67
  "a",
69
68
  {
@@ -92,7 +91,7 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
92
91
  e.default?.()
93
92
  );
94
93
  }
95
- }), ue = q({
94
+ }), se = G({
96
95
  name: "I18nSwitcher",
97
96
  props: {
98
97
  customLabels: {
@@ -167,25 +166,25 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
167
166
  throw new Error(
168
167
  "[i18n-micro] I18nSwitcher: locales not provided. Make sure app.provide(I18nLocalesKey, locales) is called or pass locales prop."
169
168
  );
170
- const r = k(() => t.locales || c || []), s = k(() => r.value.filter((u) => !u.disabled)), f = k(() => t.currentLocale !== void 0 ? typeof t.currentLocale == "function" ? t.currentLocale() : t.currentLocale : a.locale.value), i = k(() => r.value.some((u) => u.code === f.value && u.disabled)), n = k(() => t.getLocaleName ? t.getLocaleName() || null : r.value.find((p) => p.code === a.locale.value)?.displayName || null), l = Q(!1), m = Q(null), v = (u) => {
171
- u && (u.stopPropagation(), u.preventDefault()), l.value = !l.value;
172
- }, L = (u) => t.customLabels[u.code] || u.displayName || u.code, T = k(() => {
173
- const u = r.value.find((p) => p.code === f.value);
174
- return u ? L(u) : n.value || f.value;
175
- }), P = async (u) => {
169
+ const r = k(() => t.locales || c || []), u = k(() => r.value.filter((s) => !s.disabled)), f = k(() => t.currentLocale !== void 0 ? typeof t.currentLocale == "function" ? t.currentLocale() : t.currentLocale : a.locale.value), i = k(() => r.value.some((s) => s.code === f.value && s.disabled)), n = k(() => t.getLocaleName ? t.getLocaleName() || null : r.value.find((m) => m.code === a.locale.value)?.displayName || null), l = Q(!1), y = Q(null), p = (s) => {
170
+ s && (s.stopPropagation(), s.preventDefault()), l.value = !l.value;
171
+ }, L = (s) => t.customLabels[s.code] || s.displayName || s.code, T = k(() => {
172
+ const s = r.value.find((m) => m.code === f.value);
173
+ return s ? L(s) : n.value || f.value;
174
+ }), P = async (s) => {
176
175
  if (l.value = !1, await re(), t.switchLocale) {
177
- t.switchLocale(u);
176
+ t.switchLocale(s);
178
177
  return;
179
178
  }
180
- if (a.locale.value = u, !o)
179
+ if (a.locale.value = s, !o)
181
180
  return;
182
- const p = o.getCurrentPath(), b = t.localeRoute ? (() => {
183
- const d = t.localeRoute(p, u);
181
+ const m = o.getCurrentPath(), b = t.localeRoute ? (() => {
182
+ const d = t.localeRoute(m, s);
184
183
  return typeof d == "string" ? d : d.path || "/";
185
184
  })() : o?.resolvePath ? (() => {
186
- const d = o.resolvePath(p, u);
185
+ const d = o.resolvePath(m, s);
187
186
  return typeof d == "string" ? d : d.path || "/";
188
- })() : p;
187
+ })() : m;
189
188
  o.push({ path: b });
190
189
  }, $ = {
191
190
  position: "relative",
@@ -216,14 +215,14 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
216
215
  }, _ = {
217
216
  margin: "0",
218
217
  padding: "0"
219
- }, C = {
218
+ }, R = {
220
219
  display: "block",
221
220
  padding: "8px 12px",
222
221
  color: "#333",
223
222
  textDecoration: "none",
224
223
  transition: "background-color 0.3s ease",
225
224
  cursor: "pointer"
226
- }, G = {
225
+ }, Z = {
227
226
  fontWeight: "bold",
228
227
  color: "#007bff",
229
228
  // Current locale is not a meaningful switch target
@@ -234,11 +233,11 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
234
233
  transition: "transform 0.3s ease"
235
234
  }, F = {
236
235
  transform: "rotate(180deg)"
237
- }, y = (u) => u ? Array.isArray(u) ? u : [u] : [], O = (u) => {
236
+ }, v = (s) => s ? Array.isArray(s) ? s : [s] : [], O = (s) => {
238
237
  if (!l.value) return;
239
- const p = u.target;
240
- if (!p || !m.value) return;
241
- const b = m.value.contains(p), d = p.closest(".i18n-switcher-button") !== null;
238
+ const m = s.target;
239
+ if (!m || !y.value) return;
240
+ const b = y.value.contains(m), d = m.closest(".i18n-switcher-button") !== null;
242
241
  !b && !d && (l.value = !1);
243
242
  };
244
243
  return ae(() => {
@@ -246,10 +245,10 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
246
245
  }), oe(() => {
247
246
  document.removeEventListener("click", O);
248
247
  }), () => {
249
- const u = [];
250
- e["before-button"] && u.push(...y(e["before-button"]()));
251
- const p = [];
252
- if (e["before-selected-locale"] && p.push(...y(e["before-selected-locale"]())), p.push(g("span", T.value)), e["after-selected-locale"] && p.push(...y(e["after-selected-locale"]())), p.push(
248
+ const s = [];
249
+ e["before-button"] && s.push(...v(e["before-button"]()));
250
+ const m = [];
251
+ if (e["before-selected-locale"] && m.push(...v(e["before-selected-locale"]())), m.push(g("span", T.value)), e["after-selected-locale"] && m.push(...v(e["after-selected-locale"]())), m.push(
253
252
  g(
254
253
  "span",
255
254
  {
@@ -261,7 +260,7 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
261
260
  },
262
261
  "▼"
263
262
  )
264
- ), u.push(
263
+ ), s.push(
265
264
  g(
266
265
  "button",
267
266
  {
@@ -272,22 +271,22 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
272
271
  ...i.value ? t.customDisabledLinkStyle : {}
273
272
  },
274
273
  onClick: (b) => {
275
- b.preventDefault(), b.stopPropagation(), v(b);
274
+ b.preventDefault(), b.stopPropagation(), p(b);
276
275
  },
277
276
  type: "button",
278
277
  ariaHaspopup: !0,
279
278
  ariaExpanded: l.value
280
279
  },
281
- p
280
+ m
282
281
  )
283
- ), e["before-dropdown"] && u.push(...y(e["before-dropdown"]())), l.value) {
282
+ ), e["before-dropdown"] && s.push(...v(e["before-dropdown"]())), l.value) {
284
283
  const b = [];
285
- e["before-dropdown-items"] && b.push(...y(e["before-dropdown-items"]())), s.value.forEach((d) => {
284
+ e["before-dropdown-items"] && b.push(...v(e["before-dropdown-items"]())), u.value.forEach((d) => {
286
285
  const A = [];
287
- e["before-item"] && A.push(...y(e["before-item"]({ locale: d })));
286
+ e["before-item"] && A.push(...v(e["before-item"]({ locale: d })));
288
287
  const E = [];
289
- e["before-link-content"] && E.push(...y(e["before-link-content"]({ locale: d }))), E.push(L(d)), e["after-link-content"] && E.push(...y(e["after-link-content"]({ locale: d })));
290
- const B = typeof window < "u" ? window.location.pathname : "/", H = t.localeRoute ? t.localeRoute(B, d.code) : o?.resolvePath ? o.resolvePath(B, d.code) : B, j = typeof H == "string" ? H : H.path || "#", N = d.code === f.value;
288
+ e["before-link-content"] && E.push(...v(e["before-link-content"]({ locale: d }))), E.push(L(d)), e["after-link-content"] && E.push(...v(e["after-link-content"]({ locale: d })));
289
+ const H = typeof window < "u" ? window.location.pathname : "/", B = t.localeRoute ? t.localeRoute(H, d.code) : o?.resolvePath ? o.resolvePath(H, d.code) : H, j = typeof B == "string" ? B : B.path || "#", N = d.code === f.value;
291
290
  A.push(
292
291
  g(
293
292
  "a",
@@ -295,8 +294,8 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
295
294
  class: `switcher-locale-${d.code}`,
296
295
  href: typeof j == "string" ? j : "#",
297
296
  style: {
298
- ...C,
299
- ...N ? G : {},
297
+ ...R,
298
+ ...N ? Z : {},
300
299
  ...t.customLinkStyle,
301
300
  // active-specific customization wins over the generic link style
302
301
  // (matches the React/Preact/Solid switchers)
@@ -309,7 +308,7 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
309
308
  },
310
309
  E
311
310
  )
312
- ), e["after-item"] && A.push(...y(e["after-item"]({ locale: d }))), b.push(
311
+ ), e["after-item"] && A.push(...v(e["after-item"]({ locale: d }))), b.push(
313
312
  g(
314
313
  "li",
315
314
  {
@@ -319,7 +318,7 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
319
318
  A
320
319
  )
321
320
  );
322
- }), e["after-dropdown-items"] && b.push(...y(e["after-dropdown-items"]())), u.push(
321
+ }), e["after-dropdown-items"] && b.push(...v(e["after-dropdown-items"]())), s.push(
323
322
  g(
324
323
  "ul",
325
324
  {
@@ -330,18 +329,18 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
330
329
  )
331
330
  );
332
331
  }
333
- return e["after-dropdown"] && u.push(...y(e["after-dropdown"]())), g(
332
+ return e["after-dropdown"] && s.push(...v(e["after-dropdown"]())), g(
334
333
  "div",
335
334
  {
336
- ref: m,
335
+ ref: y,
337
336
  class: "i18n-switcher-wrapper",
338
337
  style: { ...$, ...t.customWrapperStyle }
339
338
  },
340
- u
339
+ s
341
340
  );
342
341
  };
343
342
  }
344
- }), fe = q({
343
+ }), ue = G({
345
344
  name: "I18nT",
346
345
  props: {
347
346
  keypath: {
@@ -392,8 +391,8 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
392
391
  return () => {
393
392
  const c = {}, r = o.getRoute();
394
393
  if (t.number !== void 0) {
395
- const n = Number(t.number), l = o.tn(n), m = o.t(t.keypath, { number: l, ...t.params }, void 0, r);
396
- return g(t.tag, { ...a, innerHTML: m });
394
+ const n = Number(t.number), l = o.tn(n), y = o.t(t.keypath, { number: l, ...t.params }, void 0, r);
395
+ return g(t.tag, { ...a, innerHTML: y });
397
396
  }
398
397
  if (t.date !== void 0) {
399
398
  const n = o.td(t.date), l = o.t(t.keypath, { date: n, ...t.params }, void 0, r);
@@ -411,7 +410,7 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
411
410
  n,
412
411
  t.params,
413
412
  o.locale.value,
414
- (m, v, L) => o.t(m, v, L, r)
413
+ (y, p, L) => o.t(y, p, L, r)
415
414
  );
416
415
  return g(t.tag, { ...a, innerHTML: l || "" });
417
416
  } else {
@@ -419,21 +418,21 @@ const W = /* @__PURE__ */ Symbol("i18n"), Y = /* @__PURE__ */ Symbol("i18n-local
419
418
  return g(t.tag, { ...a, innerHTML: l });
420
419
  }
421
420
  }
422
- const s = (o.t(t.keypath, { ...t.params, ...c }, void 0, r) ?? "").toString();
423
- if (t.hideIfEmpty && !s.trim())
421
+ const u = (o.t(t.keypath, { ...t.params, ...c }, void 0, r) ?? "").toString();
422
+ if (t.hideIfEmpty && !u.trim())
424
423
  return t.defaultValue ?? null;
425
424
  if (t.html)
426
- return g(t.tag, { ...a, innerHTML: s });
425
+ return g(t.tag, { ...a, innerHTML: u });
427
426
  if (e.default)
428
- return g(t.tag, a, e.default({ translation: s }));
427
+ return g(t.tag, a, e.default({ translation: u }));
429
428
  const f = [];
430
429
  let i = 0;
431
430
  for (const [n, l] of Object.entries(e)) {
432
431
  if (n === "default") continue;
433
- const m = `{${n}}`, v = s.indexOf(m, i);
434
- v !== -1 && (v > i && f.push(s.slice(i, v)), l && f.push(g(l)), i = v + m.length);
432
+ const y = `{${n}}`, p = u.indexOf(y, i);
433
+ p !== -1 && (p > i && f.push(u.slice(i, p)), l && f.push(g(l)), i = p + y.length);
435
434
  }
436
- return i < s.length && f.push(s.slice(i)), e.default ? g(t.tag, a, e.default({ children: f })) : f.length > 0 ? g(t.tag, a, f) : g(t.tag, a, s);
435
+ return i < u.length && f.push(u.slice(i)), e.default ? g(t.tag, a, e.default({ children: f })) : f.length > 0 ? g(t.tag, a, f) : g(t.tag, a, u);
437
436
  };
438
437
  }
439
438
  });
@@ -444,21 +443,21 @@ function te(t) {
444
443
  const e = t.match(/^([A-Za-z]{2,3})(?:[-_](.+))?$/);
445
444
  return e ? { language: e[1], region: e[2] } : { language: t };
446
445
  }
447
- function de(t, e = {}) {
446
+ function fe(t, e = {}) {
448
447
  const { hreflangBaseLanguage: a = !1 } = e;
449
448
  if (!a)
450
- return t.map((s) => {
451
- const f = String(s.code);
452
- return { hreflang: J(s), localeCode: f };
449
+ return t.map((u) => {
450
+ const f = String(u.code);
451
+ return { hreflang: J(u), localeCode: f };
453
452
  });
454
453
  const o = /* @__PURE__ */ new Map();
455
- for (const s of t) {
456
- const f = String(s.code), i = J(s), { language: n, region: l } = te(i);
454
+ for (const u of t) {
455
+ const f = String(u.code), i = J(u), { language: n, region: l } = te(i);
457
456
  n && l && !o.has(n) && o.set(n, f), o.set(i, f);
458
457
  }
459
458
  const c = /* @__PURE__ */ new Set(), r = [];
460
- for (const s of t) {
461
- const f = String(s.code), i = J(s), { language: n, region: l } = te(i);
459
+ for (const u of t) {
460
+ const f = String(u.code), i = J(u), { language: n, region: l } = te(i);
462
461
  n && l && o.get(n) === f && !c.has(n) && (c.add(n), r.push({ hreflang: n, localeCode: f })), c.has(i) || (c.add(i), r.push({ hreflang: i, localeCode: f }));
463
462
  }
464
463
  return r;
@@ -470,15 +469,15 @@ function X(t) {
470
469
  if (!a) return null;
471
470
  const o = a.indexOf("_");
472
471
  if (o > 0) {
473
- const r = a.slice(0, o), s = a.slice(o + 1);
474
- if (r.length >= 2 && s.length === 2)
475
- return `${r.toLowerCase()}_${s.toUpperCase()}`;
472
+ const r = a.slice(0, o), u = a.slice(o + 1);
473
+ if (r.length >= 2 && u.length === 2)
474
+ return `${r.toLowerCase()}_${u.toUpperCase()}`;
476
475
  }
477
476
  const c = a.indexOf("-");
478
477
  if (c > 0) {
479
- const r = a.slice(0, c), s = a.slice(c + 1);
480
- if (r.length >= 2 && s.length === 2 && /^[A-Za-z]{2}$/.test(s))
481
- return `${r.toLowerCase()}_${s.toUpperCase()}`;
478
+ const r = a.slice(0, c), u = a.slice(c + 1);
479
+ if (r.length >= 2 && u.length === 2 && /^[A-Za-z]{2}$/.test(u))
480
+ return `${r.toLowerCase()}_${u.toUpperCase()}`;
482
481
  }
483
482
  return null;
484
483
  }
@@ -489,7 +488,7 @@ function ne(t, e = {}) {
489
488
  `[i18n] Cannot derive ${a} for locale '${o}'${c}. Set locale.og (e.g. 'en_US') or use iso with a 2-letter region (e.g. 'en-US').`
490
489
  );
491
490
  }
492
- function he(t) {
491
+ function de(t) {
493
492
  const e = S(W), a = S(U, void 0), o = S(Y, void 0), c = S(ee, void 0);
494
493
  if (!e)
495
494
  throw new Error("[i18n-micro] useI18n() must be called after app.use(i18n). Make sure i18n plugin is installed.");
@@ -497,7 +496,7 @@ function he(t) {
497
496
  throw new Error("[i18n-micro] I18nLocalesKey not provided. Make sure app.provide(I18nLocalesKey, locales) is called.");
498
497
  if (!c)
499
498
  throw new Error("[i18n-micro] I18nDefaultLocaleKey not provided. Make sure app.provide(I18nDefaultLocaleKey, defaultLocale) is called.");
500
- const r = t?.locales || o, s = t?.defaultLocale || c, f = (i, n) => a?.resolvePath ? a.resolvePath(i, n || e.locale.value) : i;
499
+ const r = t?.locales || o, u = t?.defaultLocale || c, f = (i, n) => a?.resolvePath ? a.resolvePath(i, n || e.locale.value) : i;
501
500
  return {
502
501
  // Direct access to instance
503
502
  instance: e,
@@ -510,7 +509,7 @@ function he(t) {
510
509
  }),
511
510
  // Locale helpers
512
511
  getLocales: () => r,
513
- defaultLocale: () => s,
512
+ defaultLocale: () => u,
514
513
  getLocaleName: () => r.find((n) => n.code === e.locale.value)?.displayName || null,
515
514
  // Routing helpers
516
515
  localeRoute: f,
@@ -545,45 +544,45 @@ function he(t) {
545
544
  clearCache: e.clearCache.bind(e)
546
545
  };
547
546
  }
548
- function be(t = {}) {
549
- const { addDirAttribute: e = !0, identifierAttribute: a = "id", addSeoAttributes: o = !0, baseUrl: c = "/", hreflangBaseLanguage: r = !1 } = t, { getLocale: s, getLocales: f, localeRoute: i } = he(), n = S(U, void 0), l = Q({
547
+ function ve(t = {}) {
548
+ const { addDirAttribute: e = !0, identifierAttribute: a = "id", addSeoAttributes: o = !0, baseUrl: c = "/", hreflangBaseLanguage: r = !1 } = t, { getLocale: u, getLocales: f, localeRoute: i } = de(), n = S(U, void 0), l = Q({
550
549
  htmlAttrs: {},
551
550
  link: [],
552
551
  meta: []
553
552
  });
554
- function m(L, T) {
553
+ function y(L, T) {
555
554
  const P = new URL(L, "http://localhost"), $ = new URLSearchParams(P.search), M = {};
556
555
  for (const _ of T)
557
556
  $.has(_) && (M[_] = $.get(_));
558
557
  const D = new URLSearchParams(M);
559
558
  return D.toString() ? `${P.pathname}?${D.toString()}` : P.pathname;
560
559
  }
561
- function v(L = []) {
560
+ function p(L = []) {
562
561
  if (!n) {
563
562
  l.value = { htmlAttrs: {}, link: [], meta: [] };
564
563
  return;
565
564
  }
566
- const T = s(), P = f(), $ = P.find((h) => h.code === T);
565
+ const T = u(), P = f(), $ = P.find((h) => h.code === T);
567
566
  if (!$)
568
567
  return;
569
568
  const M = $.iso || T, D = X($), _ = $.dir || "auto";
570
- let C = n.getCurrentPath();
571
- C.startsWith("/") || (C = `/${C}`);
572
- const G = C.split("/").filter(Boolean), V = P.find((h) => G[0] === h.code);
573
- let F = C, y, O;
574
- const u = typeof c == "function" ? c() : c;
569
+ let R = n.getCurrentPath();
570
+ R.startsWith("/") || (R = `/${R}`);
571
+ const Z = R.split("/").filter(Boolean), V = P.find((h) => Z[0] === h.code);
572
+ let F = R, v, O;
573
+ const s = typeof c == "function" ? c() : c;
575
574
  if (V) {
576
- F = C.slice(V.code.length + 1) || "/", y = m(F, L);
575
+ F = R.slice(V.code.length + 1) || "/", v = y(F, L);
577
576
  const h = `/${T}`;
578
- O = `${u}${h}${y.startsWith("/") ? "" : "/"}${y}`;
577
+ O = `${s}${h}${v.startsWith("/") ? "" : "/"}${v}`;
579
578
  } else
580
- y = m(C, L), O = `${u}${y.startsWith("/") ? "" : "/"}${y}`;
581
- const p = {
579
+ v = y(R, L), O = `${s}${v.startsWith("/") ? "" : "/"}${v}`;
580
+ const m = {
582
581
  lang: M,
583
582
  ...e ? { dir: _ } : {}
584
583
  };
585
584
  if (!o) {
586
- l.value = { htmlAttrs: p, link: [], meta: [] };
585
+ l.value = { htmlAttrs: m, link: [], meta: [] };
587
586
  return;
588
587
  }
589
588
  const b = P.filter((h) => !h.disabled && h.seo !== !1);
@@ -603,27 +602,27 @@ function be(t = {}) {
603
602
  property: "og:locale:alternate",
604
603
  content: x
605
604
  } : (ne(h, { tag: "og:locale:alternate" }), null);
606
- }).filter((h) => h !== null), B = {
605
+ }).filter((h) => h !== null), H = {
607
606
  [a]: "i18n-can",
608
607
  rel: "canonical",
609
608
  href: O
610
- }, H = (() => {
609
+ }, B = (() => {
611
610
  if (!i || !n)
612
611
  return [];
613
612
  const h = /* @__PURE__ */ new Map(), x = n.getCurrentPath();
614
613
  for (const w of b) {
615
- const I = i(x, w.code), R = typeof I == "string" ? I : I?.path || "/";
616
- if (!R) continue;
617
- let Z;
618
- R.startsWith("http://") || R.startsWith("https://") ? Z = R : Z = `${typeof c == "function" ? c() : c}${R.startsWith("/") ? "" : "/"}${R}`, h.set(String(w.code), Z);
614
+ const I = i(x, w.code), C = typeof I == "string" ? I : I?.path || "/";
615
+ if (!C) continue;
616
+ let q;
617
+ C.startsWith("http://") || C.startsWith("https://") ? q = C : q = `${typeof c == "function" ? c() : c}${C.startsWith("/") ? "" : "/"}${C}`, h.set(String(w.code), q);
619
618
  }
620
- return de(b, { hreflangBaseLanguage: r }).flatMap(({ hreflang: w, localeCode: I }) => {
621
- const R = h.get(I);
622
- return R ? [
619
+ return fe(b, { hreflangBaseLanguage: r }).flatMap(({ hreflang: w, localeCode: I }) => {
620
+ const C = h.get(I);
621
+ return C ? [
623
622
  {
624
623
  [a]: `i18n-alternate-${w}`,
625
624
  rel: "alternate",
626
- href: R,
625
+ href: C,
627
626
  hreflang: w
628
627
  }
629
628
  ] : [];
@@ -644,17 +643,17 @@ function be(t = {}) {
644
643
  }
645
644
  }
646
645
  l.value = {
647
- htmlAttrs: p,
646
+ htmlAttrs: m,
648
647
  meta: [...d ? [d] : [], A, ...E],
649
- link: [B, ...H, ...N ? [N] : []]
648
+ link: [H, ...B, ...N ? [N] : []]
650
649
  };
651
650
  }
652
651
  return {
653
652
  metaObject: l,
654
- updateMeta: v
653
+ updateMeta: p
655
654
  };
656
655
  }
657
- class ge extends le {
656
+ class he extends le {
658
657
  constructor(e) {
659
658
  const a = {
660
659
  translations: /* @__PURE__ */ new Map()
@@ -726,61 +725,35 @@ class ge extends le {
726
725
  return e;
727
726
  }
728
727
  }
729
- function Le(t) {
730
- const { routingStrategy: e, locales: a, defaultLocale: o, ...c } = t, r = new ge(c);
731
- let s = null, f = e || null;
728
+ function pe(t) {
729
+ const { routingStrategy: e, locales: a, defaultLocale: o, ...c } = t, r = new he(c);
730
+ let u = null, f = e || null;
732
731
  return {
733
732
  global: r,
734
733
  // Access to instance outside components
735
734
  setRoutingStrategy: (n) => {
736
- f = n, s && s.provide(U, n);
735
+ f = n, u && u.provide(U, n);
737
736
  },
738
737
  // Method for setting adapter after creation
739
738
  install(n) {
740
- s = n, n.provide(W, r), f && n.provide(U, f), a && n.provide(Y, a), o && n.provide(ee, o), n.config.globalProperties.$t = (l, m, v, L) => r.t(l, m, v, L), n.config.globalProperties.$ts = (l, m, v, L) => r.ts(l, m, v, L), n.config.globalProperties.$tc = (l, m, v) => r.tc(l, m, v), n.config.globalProperties.$tn = r.tn.bind(r), n.config.globalProperties.$td = r.td.bind(r), n.config.globalProperties.$tdr = r.tdr.bind(r), n.config.globalProperties.$has = (l, m) => r.has(l, m), n.config.globalProperties.$i18n = r, n.component("I18nT", fe), n.component("I18nLink", se), n.component("I18nGroup", ce), n.component("I18nSwitcher", ue);
739
+ u = n, n.provide(W, r), f && n.provide(U, f), a && n.provide(Y, a), o && n.provide(ee, o), n.config.globalProperties.$t = (l, y, p, L) => r.t(l, y, p, L), n.config.globalProperties.$ts = (l, y, p, L) => r.ts(l, y, p, L), n.config.globalProperties.$tc = (l, y, p) => r.tc(l, y, p), n.config.globalProperties.$tn = r.tn.bind(r), n.config.globalProperties.$td = r.td.bind(r), n.config.globalProperties.$tdr = r.tdr.bind(r), n.config.globalProperties.$has = (l, y) => r.has(l, y), n.config.globalProperties.$i18n = r, n.component("I18nT", ue), n.component("I18nLink", ce), n.component("I18nGroup", ie), n.component("I18nSwitcher", se);
741
740
  }
742
741
  };
743
742
  }
744
- function Se(t, e, a) {
745
- const o = e.map((r) => r.code), c = (r, s) => {
746
- const i = (typeof r == "string" ? r : r.path || "/").split("/").filter(Boolean), n = i[0];
747
- n !== void 0 && o.includes(n) && i.shift();
748
- const l = `/${i.join("/")}`;
749
- return s === a ? l : `/${s}${l === "/" ? "" : l}`;
750
- };
751
- return {
752
- linkComponent: ie,
753
- getCurrentPath: () => t.currentRoute.value.path,
754
- push: (r) => {
755
- t.push(r.path).catch(() => {
756
- });
757
- },
758
- replace: (r) => {
759
- t.replace(r.path).catch(() => {
760
- });
761
- },
762
- resolvePath: (r, s) => c(r, s),
763
- getRoute: () => ({
764
- fullPath: t.currentRoute.value.fullPath,
765
- query: t.currentRoute.value.query
766
- })
767
- };
768
- }
769
743
  export {
770
- Pe as FormatService,
744
+ Se as FormatService,
771
745
  ee as I18nDefaultLocaleKey,
772
- ce as I18nGroup,
746
+ ie as I18nGroup,
773
747
  W as I18nInjectionKey,
774
- se as I18nLink,
748
+ ce as I18nLink,
775
749
  Y as I18nLocalesKey,
776
- ue as I18nSwitcher,
777
- fe as I18nT,
778
- ge as VueI18n,
779
- Le as createI18n,
780
- Se as createVueRouterAdapter,
781
- $e as defaultPlural,
782
- Re as interpolate,
783
- he as useI18n,
784
- be as useLocaleHead
750
+ se as I18nSwitcher,
751
+ ue as I18nT,
752
+ he as VueI18n,
753
+ pe as createI18n,
754
+ we as defaultPlural,
755
+ ke as interpolate,
756
+ de as useI18n,
757
+ ve as useLocaleHead
785
758
  };
786
759
  //# sourceMappingURL=index.mjs.map