UNPKG

images-viewer-vue3

Version:
1,056 lines (1,055 loc) 29.5 kB
import { g as le, i as R, a as L, w as X, b as m, c as W, d as F, e as j, f as b, h as oe, j as Re, k as Te, l as ee, m as ve, n as S, o as ie, p as K, q as w, r as B, s as be, t as Se, u as we, v as ye, x as Pe } from "./npm-@intlify-shared-B92O6p09.js"; import { c as ke, d as Ve, a as Ue, b as We, C as $e } from "./npm-@intlify-message-compiler-BFc0vbAd.js"; /*! * core-base v10.0.4 * (c) 2024 kazuya kawaguchi * Released under the MIT License. */ function Ge() { typeof __INTLIFY_PROD_DEVTOOLS__ != "boolean" && (le().__INTLIFY_PROD_DEVTOOLS__ = !1), typeof __INTLIFY_DROP_MESSAGE_COMPILER__ != "boolean" && (le().__INTLIFY_DROP_MESSAGE_COMPILER__ = !1); } function Z(e) { return (a) => Ke(a, e); } function Ke(e, t) { const a = t.b || t.body; if ((a.t || a.type) === 1) { const n = a, r = n.c || n.cases; return e.plural(r.reduce((l, o) => [ ...l, ce(e, o) ], [])); } else return ce(e, a); } function ce(e, t) { const a = t.s || t.static; if (a != null) return e.type === "text" ? a : e.normalize([a]); { const n = (t.i || t.items).reduce((r, l) => [...r, J(e, l)], []); return e.normalize(n); } } function J(e, t) { const a = t.t || t.type; switch (a) { case 3: { const n = t; return n.v || n.value; } case 9: { const n = t; return n.v || n.value; } case 4: { const n = t; return e.interpolate(e.named(n.k || n.key)); } case 5: { const n = t; return e.interpolate(e.list(n.i != null ? n.i : n.index)); } case 6: { const n = t, r = n.m || n.modifier; return e.linked(J(e, n.k || n.key), r ? J(e, r) : void 0, e.type); } case 7: { const n = t; return n.v || n.value; } case 8: { const n = t; return n.v || n.value; } default: throw new Error(`unhandled node type on format message part: ${a}`); } } const Be = "Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS."; function Ye(e, t) { t && Ve(e) && X(Te(Be, { source: e })); } const je = (e) => e; let z = /* @__PURE__ */ Object.create(null); const Y = (e) => R(e) && (e.t === 0 || e.type === 0) && ("b" in e || "body" in e); function He(e, t = {}) { let a = !1; const n = t.onError || Ue; return t.onError = (r) => { a = !0, n(r); }, { ...We(e, t), detectError: a }; } // @__NO_SIDE_EFFECTS__ function wt(e, t) { if (!__INTLIFY_DROP_MESSAGE_COMPILER__ && m(e)) { const a = b(t.warnHtmlMessage) ? t.warnHtmlMessage : !0; process.env.NODE_ENV !== "production" && Ye(e, a); const r = (t.onCacheKey || je)(e), l = z[r]; if (l) return l; const { ast: o, detectError: i } = He(e, { ...t, location: process.env.NODE_ENV !== "production", jit: !0 }), s = Z(o); return i ? s : z[r] = s; } else { if (process.env.NODE_ENV !== "production" && !Y(e)) return X(`the message that is resolve with key '${t.key}' is not supported for jit compilation`), () => e; const a = e.cacheKey; if (a) { const n = z[a]; return n || (z[a] = Z(e)); } else return Z(e); } } let x = null; function yt(e) { x = e; } function xe(e, t, a) { x && x.emit("i18n:init", { timestamp: Date.now(), i18n: e, version: t, meta: a }); } const ze = /* @__PURE__ */ Xe("function:translate"); function Xe(e) { return (t) => x && x.emit(e, t); } const I = { INVALID_ARGUMENT: $e, // 17 INVALID_DATE_ARGUMENT: 18, INVALID_ISO_DATE_ARGUMENT: 19, NOT_SUPPORT_NON_STRING_MESSAGE: 20, NOT_SUPPORT_LOCALE_PROMISE_VALUE: 21, NOT_SUPPORT_LOCALE_ASYNC_FUNCTION: 22, NOT_SUPPORT_LOCALE_TYPE: 23 }, Pt = 24; function U(e) { return ke(e, null, process.env.NODE_ENV !== "production" ? { messages: Ze } : void 0); } const Ze = { [I.INVALID_ARGUMENT]: "Invalid arguments", [I.INVALID_DATE_ARGUMENT]: "The date provided is an invalid Date object.Make sure your Date represents a valid date.", [I.INVALID_ISO_DATE_ARGUMENT]: "The argument provided is not a valid ISO date string", [I.NOT_SUPPORT_NON_STRING_MESSAGE]: "Not support non-string message", [I.NOT_SUPPORT_LOCALE_PROMISE_VALUE]: "cannot support promise value", [I.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]: "cannot support async function", [I.NOT_SUPPORT_LOCALE_TYPE]: "cannot support locale type" }; function te(e, t) { return t.locale != null ? ue(t.locale) : ue(e.locale); } let q; function ue(e) { if (m(e)) return e; if (L(e)) { if (e.resolvedOnce && q != null) return q; if (e.constructor.name === "Function") { const t = e(); if (we(t)) throw U(I.NOT_SUPPORT_LOCALE_PROMISE_VALUE); return q = t; } else throw U(I.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION); } else throw U(I.NOT_SUPPORT_LOCALE_TYPE); } function qe(e, t, a) { return [.../* @__PURE__ */ new Set([ a, ...W(t) ? t : R(t) ? Object.keys(t) : m(t) ? [t] : [a] ])]; } function kt(e, t, a) { const n = m(a) ? a : Q, r = e; r.__localeChainCache || (r.__localeChainCache = /* @__PURE__ */ new Map()); let l = r.__localeChainCache.get(n); if (!l) { l = []; let o = [a]; for (; W(o); ) o = me(l, o, t); const i = W(t) || !F(t) ? t : t.default ? t.default : null; o = m(i) ? [i] : i, W(o) && me(l, o, !1), r.__localeChainCache.set(n, l); } return l; } function me(e, t, a) { let n = !0; for (let r = 0; r < t.length && b(n); r++) { const l = t[r]; m(l) && (n = Je(e, t[r], a)); } return n; } function Je(e, t, a) { let n; const r = t.split("-"); do { const l = r.join("-"); n = Qe(e, l, a), r.splice(-1, 1); } while (r.length && n === !0); return n; } function Qe(e, t, a) { let n = !1; if (!e.includes(t) && (n = !0, t)) { n = t[t.length - 1] !== "!"; const r = t.replace(/!/g, ""); e.push(r), (W(a) || F(a)) && a[r] && (n = a[r]); } return n; } const $ = []; $[ 0 /* States.BEFORE_PATH */ ] = { w: [ 0 /* States.BEFORE_PATH */ ], i: [ 3, 0 /* Actions.APPEND */ ], "[": [ 4 /* States.IN_SUB_PATH */ ], o: [ 7 /* States.AFTER_PATH */ ] }; $[ 1 /* States.IN_PATH */ ] = { w: [ 1 /* States.IN_PATH */ ], ".": [ 2 /* States.BEFORE_IDENT */ ], "[": [ 4 /* States.IN_SUB_PATH */ ], o: [ 7 /* States.AFTER_PATH */ ] }; $[ 2 /* States.BEFORE_IDENT */ ] = { w: [ 2 /* States.BEFORE_IDENT */ ], i: [ 3, 0 /* Actions.APPEND */ ], 0: [ 3, 0 /* Actions.APPEND */ ] }; $[ 3 /* States.IN_IDENT */ ] = { i: [ 3, 0 /* Actions.APPEND */ ], 0: [ 3, 0 /* Actions.APPEND */ ], w: [ 1, 1 /* Actions.PUSH */ ], ".": [ 2, 1 /* Actions.PUSH */ ], "[": [ 4, 1 /* Actions.PUSH */ ], o: [ 7, 1 /* Actions.PUSH */ ] }; $[ 4 /* States.IN_SUB_PATH */ ] = { "'": [ 5, 0 /* Actions.APPEND */ ], '"': [ 6, 0 /* Actions.APPEND */ ], "[": [ 4, 2 /* Actions.INC_SUB_PATH_DEPTH */ ], "]": [ 1, 3 /* Actions.PUSH_SUB_PATH */ ], o: 8, l: [ 4, 0 /* Actions.APPEND */ ] }; $[ 5 /* States.IN_SINGLE_QUOTE */ ] = { "'": [ 4, 0 /* Actions.APPEND */ ], o: 8, l: [ 5, 0 /* Actions.APPEND */ ] }; $[ 6 /* States.IN_DOUBLE_QUOTE */ ] = { '"': [ 4, 0 /* Actions.APPEND */ ], o: 8, l: [ 6, 0 /* Actions.APPEND */ ] }; const et = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/; function tt(e) { return et.test(e); } function nt(e) { const t = e.charCodeAt(0), a = e.charCodeAt(e.length - 1); return t === a && (t === 34 || t === 39) ? e.slice(1, -1) : e; } function at(e) { if (e == null) return "o"; switch (e.charCodeAt(0)) { case 91: // [ case 93: // ] case 46: // . case 34: // " case 39: return e; case 95: // _ case 36: // $ case 45: return "i"; case 9: // Tab (HT) case 10: // Newline (LF) case 13: // Return (CR) case 160: // No-break space (NBSP) case 65279: // Byte Order Mark (BOM) case 8232: // Line Separator (LS) case 8233: return "w"; } return "i"; } function rt(e) { const t = e.trim(); return e.charAt(0) === "0" && isNaN(parseInt(e)) ? !1 : tt(t) ? nt(t) : "*" + t; } function st(e) { const t = []; let a = -1, n = 0, r = 0, l, o, i, s, u, f, E; const c = []; c[ 0 /* Actions.APPEND */ ] = () => { o === void 0 ? o = i : o += i; }, c[ 1 /* Actions.PUSH */ ] = () => { o !== void 0 && (t.push(o), o = void 0); }, c[ 2 /* Actions.INC_SUB_PATH_DEPTH */ ] = () => { c[ 0 /* Actions.APPEND */ ](), r++; }, c[ 3 /* Actions.PUSH_SUB_PATH */ ] = () => { if (r > 0) r--, n = 4, c[ 0 /* Actions.APPEND */ ](); else { if (r = 0, o === void 0 || (o = rt(o), o === !1)) return !1; c[ 1 /* Actions.PUSH */ ](); } }; function g() { const D = e[a + 1]; if (n === 5 && D === "'" || n === 6 && D === '"') return a++, i = "\\" + D, c[ 0 /* Actions.APPEND */ ](), !0; } for (; n !== null; ) if (a++, l = e[a], !(l === "\\" && g())) { if (s = at(l), E = $[n], u = E[s] || E.l || 8, u === 8 || (n = u[0], u[1] !== void 0 && (f = c[u[1]], f && (i = l, f() === !1)))) return; if (n === 7) return t; } } const fe = /* @__PURE__ */ new Map(); function lt(e, t) { return R(e) ? e[t] : null; } function Vt(e, t) { if (!R(e)) return null; let a = fe.get(t); if (a || (a = st(t), a && fe.set(t, a)), !a) return null; const n = a.length; let r = e, l = 0; for (; l < n; ) { const o = r[a[l]]; if (o === void 0 || L(r)) return null; r = o, l++; } return r; } const v = { NOT_FOUND_KEY: 1, FALLBACK_TO_TRANSLATE: 2, CANNOT_FORMAT_NUMBER: 3, FALLBACK_TO_NUMBER_FORMAT: 4, CANNOT_FORMAT_DATE: 5, FALLBACK_TO_DATE_FORMAT: 6, EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER: 7 }, Ut = 8, ot = { [v.NOT_FOUND_KEY]: "Not found '{key}' key in '{locale}' locale messages.", [v.FALLBACK_TO_TRANSLATE]: "Fall back to translate '{key}' key with '{target}' locale.", [v.CANNOT_FORMAT_NUMBER]: "Cannot format a number value due to not supported Intl.NumberFormat.", [v.FALLBACK_TO_NUMBER_FORMAT]: "Fall back to number format '{key}' key with '{target}' locale.", [v.CANNOT_FORMAT_DATE]: "Cannot format a date value due to not supported Intl.DateTimeFormat.", [v.FALLBACK_TO_DATE_FORMAT]: "Fall back to datetime format '{key}' key with '{target}' locale.", [v.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]: "This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future." }; function G(e, ...t) { return Te(ot[e], ...t); } const it = "10.0.4", ne = -1, Q = "en-US", Oe = "", _e = (e) => `${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`; function ct() { return { upper: (e, t) => t === "text" && m(e) ? e.toUpperCase() : t === "vnode" && R(e) && "__v_isVNode" in e ? e.children.toUpperCase() : e, lower: (e, t) => t === "text" && m(e) ? e.toLowerCase() : t === "vnode" && R(e) && "__v_isVNode" in e ? e.children.toLowerCase() : e, capitalize: (e, t) => t === "text" && m(e) ? _e(e) : t === "vnode" && R(e) && "__v_isVNode" in e ? _e(e.children) : e }; } let pe; function Wt(e) { pe = e; } let Ae; function $t(e) { Ae = e; } let Me; function Gt(e) { Me = e; } let Ce = null; const Kt = /* @__NO_SIDE_EFFECTS__ */ (e) => { Ce = e; }, ut = /* @__NO_SIDE_EFFECTS__ */ () => Ce; let Fe = null; const Bt = (e) => { Fe = e; }, Yt = () => Fe; let de = 0; function jt(e = {}) { const t = L(e.onWarn) ? e.onWarn : X, a = m(e.version) ? e.version : it, n = m(e.locale) || L(e.locale) ? e.locale : Q, r = L(n) ? Q : n, l = W(e.fallbackLocale) || F(e.fallbackLocale) || m(e.fallbackLocale) || e.fallbackLocale === !1 ? e.fallbackLocale : r, o = F(e.messages) ? e.messages : { [r]: {} }, i = F(e.datetimeFormats) ? e.datetimeFormats : { [r]: {} }, s = F(e.numberFormats) ? e.numberFormats : { [r]: {} }, u = j({}, e.modifiers || {}, ct()), f = e.pluralRules || {}, E = L(e.missing) ? e.missing : null, c = b(e.missingWarn) || oe(e.missingWarn) ? e.missingWarn : !0, g = b(e.fallbackWarn) || oe(e.fallbackWarn) ? e.fallbackWarn : !0, D = !!e.fallbackFormat, O = !!e.unresolving, C = L(e.postTranslation) ? e.postTranslation : null, N = F(e.processor) ? e.processor : null, _ = b(e.warnHtmlMessage) ? e.warnHtmlMessage : !0, T = !!e.escapeParameter, d = L(e.messageCompiler) ? e.messageCompiler : pe; process.env.NODE_ENV !== "production" && L(e.messageCompiler) && Re(G(v.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER)); const p = L(e.messageResolver) ? e.messageResolver : Ae || lt, A = L(e.localeFallbacker) ? e.localeFallbacker : Me || qe, h = R(e.fallbackContext) ? e.fallbackContext : void 0, M = e, y = R(M.__datetimeFormatters) ? M.__datetimeFormatters : /* @__PURE__ */ new Map(), V = R(M.__numberFormatters) ? M.__numberFormatters : /* @__PURE__ */ new Map(), H = R(M.__meta) ? M.__meta : {}; de++; const k = { version: a, cid: de, locale: n, fallbackLocale: l, messages: o, modifiers: u, pluralRules: f, missing: E, missingWarn: c, fallbackWarn: g, fallbackFormat: D, unresolving: O, postTranslation: C, processor: N, warnHtmlMessage: _, escapeParameter: T, messageCompiler: d, messageResolver: p, localeFallbacker: A, fallbackContext: h, onWarn: t, __meta: H }; return k.datetimeFormats = i, k.numberFormats = s, k.__datetimeFormatters = y, k.__numberFormatters = V, process.env.NODE_ENV !== "production" && (k.__v_emitter = M.__v_emitter != null ? M.__v_emitter : void 0), (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__) && xe(k, a, H), k; } function ae(e, t) { return e instanceof RegExp ? e.test(t) : e; } function mt(e, t) { return e instanceof RegExp ? e.test(t) : e; } function re(e, t, a, n, r) { const { missing: l, onWarn: o } = e; if (process.env.NODE_ENV !== "production") { const i = e.__v_emitter; i && i.emit("missing", { locale: a, key: t, type: r, groupId: `${r}:${t}` }); } if (l !== null) { const i = l(e, a, t, r); return m(i) ? i : t; } else return process.env.NODE_ENV !== "production" && mt(n, t) && o(G(v.NOT_FOUND_KEY, { key: t, locale: a })), t; } function Ht(e, t, a) { const n = e; n.__localeChainCache = /* @__PURE__ */ new Map(), e.localeFallbacker(e, a, t); } function De(e, t) { return e === t ? !1 : e.split("-")[0] === t.split("-")[0]; } function ft(e, t) { const a = t.indexOf(e); if (a === -1) return !1; for (let n = a + 1; n < t.length; n++) if (De(e, t[n])) return !0; return !1; } const ge = typeof Intl < "u", Le = { dateTimeFormat: ge && typeof Intl.DateTimeFormat < "u", numberFormat: ge && typeof Intl.NumberFormat < "u" }; function xt(e, ...t) { const { datetimeFormats: a, unresolving: n, fallbackLocale: r, onWarn: l, localeFallbacker: o } = e, { __datetimeFormatters: i } = e; if (process.env.NODE_ENV !== "production" && !Le.dateTimeFormat) return l(G(v.CANNOT_FORMAT_DATE)), Oe; const [s, u, f, E] = dt(...t), c = b(f.missingWarn) ? f.missingWarn : e.missingWarn, g = b(f.fallbackWarn) ? f.fallbackWarn : e.fallbackWarn, D = !!f.part, O = te(e, f), C = o( e, // eslint-disable-line @typescript-eslint/no-explicit-any r, O ); if (!m(s) || s === "") return new Intl.DateTimeFormat(O, E).format(u); let N = {}, _, T = null, d = O, p = null; const A = "datetime format"; for (let y = 0; y < C.length; y++) { if (_ = p = C[y], process.env.NODE_ENV !== "production" && O !== _ && ae(g, s) && l(G(v.FALLBACK_TO_DATE_FORMAT, { key: s, target: _ })), process.env.NODE_ENV !== "production" && O !== _) { const V = e.__v_emitter; V && V.emit("fallback", { type: A, key: s, from: d, to: p, groupId: `${A}:${s}` }); } if (N = a[_] || {}, T = N[s], F(T)) break; re(e, s, _, c, A), d = p; } if (!F(T) || !m(_)) return n ? ne : s; let h = `${_}__${s}`; ee(E) || (h = `${h}__${JSON.stringify(E)}`); let M = i.get(h); return M || (M = new Intl.DateTimeFormat(_, j({}, T, E)), i.set(h, M)), D ? M.formatToParts(u) : M.format(u); } const _t = [ "localeMatcher", "weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName", "formatMatcher", "hour12", "timeZone", "dateStyle", "timeStyle", "calendar", "dayPeriod", "numberingSystem", "hourCycle", "fractionalSecondDigits" ]; function dt(...e) { const [t, a, n, r] = e, l = {}; let o = {}, i; if (m(t)) { const s = t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/); if (!s) throw U(I.INVALID_ISO_DATE_ARGUMENT); const u = s[3] ? s[3].trim().startsWith("T") ? `${s[1].trim()}${s[3].trim()}` : `${s[1].trim()}T${s[3].trim()}` : s[1].trim(); i = new Date(u); try { i.toISOString(); } catch { throw U(I.INVALID_ISO_DATE_ARGUMENT); } } else if (ve(t)) { if (isNaN(t.getTime())) throw U(I.INVALID_DATE_ARGUMENT); i = t; } else if (S(t)) i = t; else throw U(I.INVALID_ARGUMENT); return m(a) ? l.key = a : F(a) && Object.keys(a).forEach((s) => { _t.includes(s) ? o[s] = a[s] : l[s] = a[s]; }), m(n) ? l.locale = n : F(n) && (o = n), F(r) && (o = r), [l.key || "", i, l, o]; } function zt(e, t, a) { const n = e; for (const r in a) { const l = `${t}__${r}`; n.__datetimeFormatters.has(l) && n.__datetimeFormatters.delete(l); } } function Xt(e, ...t) { const { numberFormats: a, unresolving: n, fallbackLocale: r, onWarn: l, localeFallbacker: o } = e, { __numberFormatters: i } = e; if (process.env.NODE_ENV !== "production" && !Le.numberFormat) return l(G(v.CANNOT_FORMAT_NUMBER)), Oe; const [s, u, f, E] = Et(...t), c = b(f.missingWarn) ? f.missingWarn : e.missingWarn, g = b(f.fallbackWarn) ? f.fallbackWarn : e.fallbackWarn, D = !!f.part, O = te(e, f), C = o( e, // eslint-disable-line @typescript-eslint/no-explicit-any r, O ); if (!m(s) || s === "") return new Intl.NumberFormat(O, E).format(u); let N = {}, _, T = null, d = O, p = null; const A = "number format"; for (let y = 0; y < C.length; y++) { if (_ = p = C[y], process.env.NODE_ENV !== "production" && O !== _ && ae(g, s) && l(G(v.FALLBACK_TO_NUMBER_FORMAT, { key: s, target: _ })), process.env.NODE_ENV !== "production" && O !== _) { const V = e.__v_emitter; V && V.emit("fallback", { type: A, key: s, from: d, to: p, groupId: `${A}:${s}` }); } if (N = a[_] || {}, T = N[s], F(T)) break; re(e, s, _, c, A), d = p; } if (!F(T) || !m(_)) return n ? ne : s; let h = `${_}__${s}`; ee(E) || (h = `${h}__${JSON.stringify(E)}`); let M = i.get(h); return M || (M = new Intl.NumberFormat(_, j({}, T, E)), i.set(h, M)), D ? M.formatToParts(u) : M.format(u); } const gt = [ "localeMatcher", "style", "currency", "currencyDisplay", "currencySign", "useGrouping", "minimumIntegerDigits", "minimumFractionDigits", "maximumFractionDigits", "minimumSignificantDigits", "maximumSignificantDigits", "compactDisplay", "notation", "signDisplay", "unit", "unitDisplay", "roundingMode", "roundingPriority", "roundingIncrement", "trailingZeroDisplay" ]; function Et(...e) { const [t, a, n, r] = e, l = {}; let o = {}; if (!S(t)) throw U(I.INVALID_ARGUMENT); const i = t; return m(a) ? l.key = a : F(a) && Object.keys(a).forEach((s) => { gt.includes(s) ? o[s] = a[s] : l[s] = a[s]; }), m(n) ? l.locale = n : F(n) && (o = n), F(r) && (o = r), [l.key || "", i, l, o]; } function Zt(e, t, a) { const n = e; for (const r in a) { const l = `${t}__${r}`; n.__numberFormatters.has(l) && n.__numberFormatters.delete(l); } } const Nt = (e) => e, Tt = (e) => "", Ot = "text", pt = (e) => e.length === 0 ? "" : ye(e), At = Pe; function Ee(e, t) { return e = Math.abs(e), t === 2 ? e ? e > 1 ? 1 : 0 : 1 : e ? Math.min(e, 2) : 0; } function Mt(e) { const t = S(e.pluralIndex) ? e.pluralIndex : -1; return e.named && (S(e.named.count) || S(e.named.n)) ? S(e.named.count) ? e.named.count : S(e.named.n) ? e.named.n : t : t; } function Ct(e, t) { t.count || (t.count = e), t.n || (t.n = e); } function Ft(e = {}) { const t = e.locale, a = Mt(e), n = R(e.pluralRules) && m(t) && L(e.pluralRules[t]) ? e.pluralRules[t] : Ee, r = R(e.pluralRules) && m(t) && L(e.pluralRules[t]) ? Ee : void 0, l = (N) => N[n(a, N.length, r)], o = e.list || [], i = (N) => o[N], s = e.named || {}; S(e.pluralIndex) && Ct(a, s); const u = (N) => s[N]; function f(N, _) { const T = L(e.messages) ? e.messages(N, !!_) : R(e.messages) ? e.messages[N] : !1; return T || (e.parent ? e.parent.message(N) : Tt); } const E = (N) => e.modifiers ? e.modifiers[N] : Nt, c = F(e.processor) && L(e.processor.normalize) ? e.processor.normalize : pt, g = F(e.processor) && L(e.processor.interpolate) ? e.processor.interpolate : At, D = F(e.processor) && m(e.processor.type) ? e.processor.type : Ot, C = { list: i, named: u, plural: l, linked: (N, ..._) => { const [T, d] = _; let p = "text", A = ""; _.length === 1 ? R(T) ? (A = T.modifier || A, p = T.type || p) : m(T) && (A = T || A) : _.length === 2 && (m(T) && (A = T || A), m(d) && (p = d || p)); const h = f(N, !0)(C), M = ( // The message in vnode resolved with linked are returned as an array by processor.nomalize p === "vnode" && W(h) && A ? h[0] : h ); return A ? E(A)(M, p) : M; }, message: f, type: D, interpolate: g, normalize: c, values: j({}, o, s) }; return C; } const Ne = () => "", P = (e) => L(e); function qt(e, ...t) { const { fallbackFormat: a, postTranslation: n, unresolving: r, messageCompiler: l, fallbackLocale: o, messages: i } = e, [s, u] = ht(...t), f = b(u.missingWarn) ? u.missingWarn : e.missingWarn, E = b(u.fallbackWarn) ? u.fallbackWarn : e.fallbackWarn, c = b(u.escapeParameter) ? u.escapeParameter : e.escapeParameter, g = !!u.resolvedMessage, D = m(u.default) || b(u.default) ? b(u.default) ? l ? s : () => s : u.default : a ? l ? s : () => s : null, O = a || D != null && (m(D) || L(D)), C = te(e, u); c && Dt(u); let [N, _, T] = g ? [ s, C, i[C] || {} ] : he(e, s, C, o, E, f), d = N, p = s; if (!g && !(m(d) || Y(d) || P(d)) && O && (d = D, p = d), !g && (!(m(d) || Y(d) || P(d)) || !m(_))) return r ? ne : s; if (process.env.NODE_ENV !== "production" && m(d) && e.messageCompiler == null) return X(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${s}'.`), s; let A = !1; const h = () => { A = !0; }, M = P(d) ? d : Ie(e, s, _, d, p, h); if (A) return d; const y = vt(e, _, T, u), V = Ft(y), H = Lt(e, M, V), k = n ? n(H, s) : H; if (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__) { const se = { timestamp: Date.now(), key: m(s) ? s : P(d) ? d.key : "", locale: _ || (P(d) ? d.locale : ""), format: m(d) ? d : P(d) ? d.source : "", message: k }; se.meta = j({}, e.__meta, /* @__PURE__ */ ut() || {}), ze(se); } return k; } function Dt(e) { W(e.list) ? e.list = e.list.map((t) => m(t) ? ie(t) : t) : R(e.named) && Object.keys(e.named).forEach((t) => { m(e.named[t]) && (e.named[t] = ie(e.named[t])); }); } function he(e, t, a, n, r, l) { const { messages: o, onWarn: i, messageResolver: s, localeFallbacker: u } = e, f = u(e, n, a); let E = {}, c, g = null, D = a, O = null; const C = "translate"; for (let N = 0; N < f.length; N++) { if (c = O = f[N], process.env.NODE_ENV !== "production" && a !== c && !De(a, c) && ae(r, t) && i(G(v.FALLBACK_TO_TRANSLATE, { key: t, target: c })), process.env.NODE_ENV !== "production" && a !== c) { const p = e.__v_emitter; p && p.emit("fallback", { type: C, key: t, from: D, to: O, groupId: `${C}:${t}` }); } E = o[c] || {}; let _ = null, T, d; if (process.env.NODE_ENV !== "production" && K && (_ = window.performance.now(), T = "intlify-message-resolve-start", d = "intlify-message-resolve-end", w && w(T)), (g = s(E, t)) === null && (g = E[t]), process.env.NODE_ENV !== "production" && K) { const p = window.performance.now(), A = e.__v_emitter; A && _ && g && A.emit("message-resolve", { type: "message-resolve", key: t, message: g, time: p - _, groupId: `${C}:${t}` }), T && d && w && B && (w(d), B("intlify message resolve", T, d)); } if (m(g) || Y(g) || P(g)) break; if (!ft(c, f)) { const p = re( e, // eslint-disable-line @typescript-eslint/no-explicit-any t, c, l, C ); p !== t && (g = p); } D = O; } return [g, c, E]; } function Ie(e, t, a, n, r, l) { const { messageCompiler: o, warnHtmlMessage: i } = e; if (P(n)) { const c = n; return c.locale = c.locale || a, c.key = c.key || t, c; } if (o == null) { const c = () => n; return c.locale = a, c.key = t, c; } let s = null, u, f; process.env.NODE_ENV !== "production" && K && (s = window.performance.now(), u = "intlify-message-compilation-start", f = "intlify-message-compilation-end", w && w(u)); const E = o(n, It(e, a, r, n, i, l)); if (process.env.NODE_ENV !== "production" && K) { const c = window.performance.now(), g = e.__v_emitter; g && s && g.emit("message-compilation", { type: "message-compilation", message: n, time: c - s, groupId: `translate:${t}` }), u && f && w && B && (w(f), B("intlify message compilation", u, f)); } return E.locale = a, E.key = t, E.source = n, E; } function Lt(e, t, a) { let n = null, r, l; process.env.NODE_ENV !== "production" && K && (n = window.performance.now(), r = "intlify-message-evaluation-start", l = "intlify-message-evaluation-end", w && w(r)); const o = t(a); if (process.env.NODE_ENV !== "production" && K) { const i = window.performance.now(), s = e.__v_emitter; s && n && s.emit("message-evaluation", { type: "message-evaluation", value: o, time: i - n, groupId: `translate:${t.key}` }), r && l && w && B && (w(l), B("intlify message evaluation", r, l)); } return o; } function ht(...e) { const [t, a, n] = e, r = {}; if (!m(t) && !S(t) && !P(t) && !Y(t)) throw U(I.INVALID_ARGUMENT); const l = S(t) ? String(t) : (P(t), t); return S(a) ? r.plural = a : m(a) ? r.default = a : F(a) && !ee(a) ? r.named = a : W(a) && (r.list = a), S(n) ? r.plural = n : m(n) ? r.default = n : F(n) && j(r, n), [l, r]; } function It(e, t, a, n, r, l) { return { locale: t, key: a, warnHtmlMessage: r, onError: (o) => { if (l && l(o), process.env.NODE_ENV !== "production") { const i = Rt(n), s = `Message compilation error: ${o.message}`, u = o.location && i && be(i, o.location.start.offset, o.location.end.offset), f = e.__v_emitter; f && i && f.emit("compile-error", { message: i, error: o.message, start: o.location && o.location.start.offset, end: o.location && o.location.end.offset, groupId: `translate:${a}` }), console.error(u ? `${s} ${u}` : s); } else throw o; }, onCacheKey: (o) => Se(t, a, o) }; } function Rt(e) { if (m(e)) return e; if (e.loc && e.loc.source) return e.loc.source; } function vt(e, t, a, n) { const { modifiers: r, pluralRules: l, messageResolver: o, fallbackLocale: i, fallbackWarn: s, missingWarn: u, fallbackContext: f } = e, c = { locale: t, modifiers: r, pluralRules: l, messages: (g, D) => { let O = o(a, g); if (O == null && (f || D)) { const [, , C] = he( f || e, // NOTE: if has fallbackContext, fallback to root, else if use linked, fallback to local context g, t, i, s, u ); O = o(C, g); } if (m(O) || Y(O)) { let C = !1; const _ = Ie(e, g, t, O, g, () => { C = !0; }); return C ? Ne : _; } else return P(O) ? O : Ne; } }; return e.processor && (c.processor = e.processor), n.list && (c.list = n.list), n.named && (c.named = n.named), S(n.plural) && (c.pluralIndex = n.plural), c; } Ge(); export { Vt as A, Pt as C, Q as D, Oe as M, gt as N, _t as a, Ut as b, jt as c, zt as d, Zt as e, Kt as f, Yt as g, ne as h, Y as i, ae as j, mt as k, dt as l, xt as m, Et as n, Xt as o, ht as p, P as q, kt as r, yt as s, qt as t, Ht as u, Wt as v, $t as w, Gt as x, Bt as y, wt as z };