@wix/blog 1.0.691 → 1.0.692
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/_sdk-exports/context-blog-feed-context-provider/runtime.d.ts +483 -0
- package/_sdk-exports/context-blog-feed-context-provider/runtime.js +5 -0
- package/_sdk-exports/context-category-item-context-provider/runtime.d.ts +189 -0
- package/_sdk-exports/context-category-item-context-provider/runtime.js +2 -0
- package/_sdk-exports/context-post-by-id-context-provider/runtime.d.ts +31 -0
- package/_sdk-exports/context-post-by-id-context-provider/runtime.js +5 -0
- package/_sdk-exports/context-post-context-provider/runtime.d.ts +3213 -0
- package/_sdk-exports/context-post-context-provider/runtime.js +5 -0
- package/_sdk-exports/context-post-item-context-provider/runtime.d.ts +386 -0
- package/_sdk-exports/context-post-item-context-provider/runtime.js +5 -0
- package/_sdk-exports/context-related-posts-context-provider/runtime.d.ts +341 -0
- package/_sdk-exports/context-related-posts-context-provider/runtime.js +5 -0
- package/_sdk-exports/context-tag-item-context-provider/runtime.d.ts +185 -0
- package/_sdk-exports/context-tag-item-context-provider/runtime.js +2 -0
- package/blog-feed-context-provider/package.json +3 -0
- package/build/cjs/context-blog-feed-context-provider.d.ts +483 -0
- package/build/cjs/context-blog-feed-context-provider.js +4601 -0
- package/build/cjs/context-blog-feed-context-provider.js.map +1 -0
- package/build/cjs/context-category-item-context-provider.d.ts +189 -0
- package/build/cjs/context-category-item-context-provider.js +578 -0
- package/build/cjs/context-category-item-context-provider.js.map +1 -0
- package/build/cjs/context-post-by-id-context-provider.d.ts +31 -0
- package/build/cjs/context-post-by-id-context-provider.js +4531 -0
- package/build/cjs/context-post-by-id-context-provider.js.map +1 -0
- package/build/cjs/context-post-context-provider.d.ts +3213 -0
- package/build/cjs/context-post-context-provider.js +5404 -0
- package/build/cjs/context-post-context-provider.js.map +1 -0
- package/build/cjs/context-post-item-context-provider.d.ts +386 -0
- package/build/cjs/context-post-item-context-provider.js +3682 -0
- package/build/cjs/context-post-item-context-provider.js.map +1 -0
- package/build/cjs/context-related-posts-context-provider.d.ts +341 -0
- package/build/cjs/context-related-posts-context-provider.js +4355 -0
- package/build/cjs/context-related-posts-context-provider.js.map +1 -0
- package/build/cjs/context-tag-item-context-provider.d.ts +185 -0
- package/build/cjs/context-tag-item-context-provider.js +578 -0
- package/build/cjs/context-tag-item-context-provider.js.map +1 -0
- package/build/es/context-blog-feed-context-provider.d.mts +483 -0
- package/build/es/context-blog-feed-context-provider.mjs +4571 -0
- package/build/es/context-blog-feed-context-provider.mjs.map +1 -0
- package/build/es/context-category-item-context-provider.d.mts +189 -0
- package/build/es/context-category-item-context-provider.mjs +549 -0
- package/build/es/context-category-item-context-provider.mjs.map +1 -0
- package/build/es/context-post-by-id-context-provider.d.mts +31 -0
- package/build/es/context-post-by-id-context-provider.mjs +4491 -0
- package/build/es/context-post-by-id-context-provider.mjs.map +1 -0
- package/build/es/context-post-context-provider.d.mts +3213 -0
- package/build/es/context-post-context-provider.mjs +5374 -0
- package/build/es/context-post-context-provider.mjs.map +1 -0
- package/build/es/context-post-item-context-provider.d.mts +386 -0
- package/build/es/context-post-item-context-provider.mjs +3652 -0
- package/build/es/context-post-item-context-provider.mjs.map +1 -0
- package/build/es/context-related-posts-context-provider.d.mts +341 -0
- package/build/es/context-related-posts-context-provider.mjs +4325 -0
- package/build/es/context-related-posts-context-provider.mjs.map +1 -0
- package/build/es/context-tag-item-context-provider.d.mts +185 -0
- package/build/es/context-tag-item-context-provider.mjs +549 -0
- package/build/es/context-tag-item-context-provider.mjs.map +1 -0
- package/build/internal/cjs/context-blog-feed-context-provider.d.ts +483 -0
- package/build/internal/cjs/context-category-item-context-provider.d.ts +189 -0
- package/build/internal/cjs/context-post-by-id-context-provider.d.ts +31 -0
- package/build/internal/cjs/context-post-context-provider.d.ts +3213 -0
- package/build/internal/cjs/context-post-item-context-provider.d.ts +386 -0
- package/build/internal/cjs/context-related-posts-context-provider.d.ts +341 -0
- package/build/internal/cjs/context-tag-item-context-provider.d.ts +185 -0
- package/build/internal/es/context-blog-feed-context-provider.d.mts +483 -0
- package/build/internal/es/context-category-item-context-provider.d.mts +189 -0
- package/build/internal/es/context-post-by-id-context-provider.d.mts +31 -0
- package/build/internal/es/context-post-context-provider.d.mts +3213 -0
- package/build/internal/es/context-post-item-context-provider.d.mts +386 -0
- package/build/internal/es/context-related-posts-context-provider.d.mts +341 -0
- package/build/internal/es/context-tag-item-context-provider.d.mts +185 -0
- package/category-item-context-provider/package.json +3 -0
- package/context/blog-feed-context-provider/package.json +3 -0
- package/context/category-item-context-provider/package.json +3 -0
- package/context/post-by-id-context-provider/package.json +3 -0
- package/context/post-context-provider/package.json +3 -0
- package/context/post-item-context-provider/package.json +3 -0
- package/context/related-posts-context-provider/package.json +3 -0
- package/context/tag-item-context-provider/package.json +3 -0
- package/package.json +103 -4
- package/post-by-id-context-provider/package.json +3 -0
- package/post-context-provider/package.json +3 -0
- package/post-item-context-provider/package.json +3 -0
- package/related-posts-context-provider/package.json +3 -0
- package/tag-item-context-provider/package.json +3 -0
|
@@ -0,0 +1,3682 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to2, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to2, key) && key !== except)
|
|
14
|
+
__defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to2;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// context-post-item-context-provider.ts
|
|
21
|
+
var context_post_item_context_provider_exports = {};
|
|
22
|
+
__export(context_post_item_context_provider_exports, {
|
|
23
|
+
PostItemContextProvider: () => ps,
|
|
24
|
+
default: () => ps,
|
|
25
|
+
injectAccessTokenGetter: () => ms,
|
|
26
|
+
usePostItemContext: () => ds
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(context_post_item_context_provider_exports);
|
|
29
|
+
|
|
30
|
+
// _sdk-exports/context-post-item-context-provider/runtime.js
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_services_manager_react = require("@wix/services-manager-react");
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_meta = {};
|
|
35
|
+
var f = Object.defineProperty;
|
|
36
|
+
var p = (e6, t2) => {
|
|
37
|
+
let n2 = {};
|
|
38
|
+
for (var r2 in e6) f(n2, r2, { get: e6[r2], enumerable: true });
|
|
39
|
+
return t2 || f(n2, Symbol.toStringTag, { value: `Module` }), n2;
|
|
40
|
+
};
|
|
41
|
+
var m = {};
|
|
42
|
+
function h(e6, t2 = false, n2 = (e7) => e7) {
|
|
43
|
+
return () => ({ __type: `event-definition`, type: e6, isDomainEvent: t2, transformations: n2 });
|
|
44
|
+
}
|
|
45
|
+
var g = (e6) => {
|
|
46
|
+
switch (e6) {
|
|
47
|
+
case `get`:
|
|
48
|
+
case `GET`:
|
|
49
|
+
return `GET`;
|
|
50
|
+
case `post`:
|
|
51
|
+
case `POST`:
|
|
52
|
+
return `POST`;
|
|
53
|
+
case `put`:
|
|
54
|
+
case `PUT`:
|
|
55
|
+
return `PUT`;
|
|
56
|
+
case `delete`:
|
|
57
|
+
case `DELETE`:
|
|
58
|
+
return `DELETE`;
|
|
59
|
+
case `patch`:
|
|
60
|
+
case `PATCH`:
|
|
61
|
+
return `PATCH`;
|
|
62
|
+
case `head`:
|
|
63
|
+
case `HEAD`:
|
|
64
|
+
return `HEAD`;
|
|
65
|
+
case `options`:
|
|
66
|
+
case `OPTIONS`:
|
|
67
|
+
return `OPTIONS`;
|
|
68
|
+
default:
|
|
69
|
+
throw Error(`Unknown method: ${e6}`);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var _ = (e6) => (t2) => async (n2) => {
|
|
73
|
+
let r2, i2 = (t3) => {
|
|
74
|
+
if (r2 = e6(n2)(t3), r2.url === void 0) throw Error(`Url was not successfully created for this request, please reach out to support channels for assistance.`);
|
|
75
|
+
let { method: i3, url: a2, params: o2 } = r2;
|
|
76
|
+
return { ...r2, method: g(i3), url: a2, data: r2.data, params: o2 };
|
|
77
|
+
};
|
|
78
|
+
try {
|
|
79
|
+
let e7 = await t2.request(i2);
|
|
80
|
+
if (r2 === void 0) throw Error(`Request options were not created for this request, please reach out to support channels for assistance.`);
|
|
81
|
+
let n3 = Array.isArray(r2.transformResponse) ? r2.transformResponse : [r2.transformResponse], a2 = e7.data;
|
|
82
|
+
return n3.forEach((t3) => {
|
|
83
|
+
t3 && (a2 = t3(e7.data, e7.headers));
|
|
84
|
+
}), a2;
|
|
85
|
+
} catch (e7) {
|
|
86
|
+
throw typeof e7 == `object` && e7 && `response` in e7 && typeof e7.response == `object` && e7.response !== null && `data` in e7.response ? e7.response.data : e7;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
var v = (e6) => e6.__isAmbassador ? true : !!e6().__isAmbassador;
|
|
90
|
+
var y = `__metadata`;
|
|
91
|
+
var b = `edge.wixapis.com`;
|
|
92
|
+
var x = class extends Error {
|
|
93
|
+
message;
|
|
94
|
+
response;
|
|
95
|
+
constructor(e6, t2) {
|
|
96
|
+
super(e6), this.message = e6, this.response = t2;
|
|
97
|
+
}
|
|
98
|
+
async details() {
|
|
99
|
+
let e6 = await this.response.json();
|
|
100
|
+
return S(this.response.status, e6?.message, e6?.details, { requestId: this.response.headers.get(`X-Wix-Request-Id`), details: e6 });
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var S = (e6, t2, n2, r2) => ({ details: { ...!n2?.validationError && { applicationError: { description: t2, code: e6, data: r2 } }, ...n2 }, message: t2, requestId: r2?.requestId });
|
|
104
|
+
var C = (e6) => e6?.method && [`post`, `put`, `patch`].includes(e6.method.toLocaleLowerCase()) && e6.body ? { "Content-Type": `application/json` } : {};
|
|
105
|
+
var ee = (e6) => e6 && typeof e6 == `object` && !Array.isArray(e6);
|
|
106
|
+
var w = (e6) => e6.__type === `host`;
|
|
107
|
+
function T(e6, t2) {
|
|
108
|
+
return e6.create(t2);
|
|
109
|
+
}
|
|
110
|
+
var te = `x-wix-bi-gateway`;
|
|
111
|
+
function ne(e6, t2, n2) {
|
|
112
|
+
return { [te]: re({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e6.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e6.methodFqn, entity: e6.entityFqdn }) };
|
|
113
|
+
}
|
|
114
|
+
function re(e6) {
|
|
115
|
+
return Object.entries(e6).filter(([e7, t2]) => !!t2).map(([e7, t2]) => `${e7}=${t2}`).join(`,`);
|
|
116
|
+
}
|
|
117
|
+
function ie(e6) {
|
|
118
|
+
let t2 = globalThis.__wix_context__, n2 = { client: m.client, elevatedClient: m.elevatedClient }, r2;
|
|
119
|
+
globalThis.__wix_context__ = void 0, m.client = void 0, m.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
120
|
+
try {
|
|
121
|
+
return e6();
|
|
122
|
+
} finally {
|
|
123
|
+
globalThis.__wix_context__ = t2, m.client = n2.client, m.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
var ae = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
127
|
+
function oe(e6) {
|
|
128
|
+
return de(e6).map((e7) => e7.toLocaleUpperCase()).join(`_`);
|
|
129
|
+
}
|
|
130
|
+
var se = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
131
|
+
var ce = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
132
|
+
var le = `$1\0$2`;
|
|
133
|
+
var ue = /[^\p{L}\d]+/giu;
|
|
134
|
+
function de(e6) {
|
|
135
|
+
let t2 = e6.trim();
|
|
136
|
+
t2 = t2.replace(se, le).replace(ce, le), t2 = t2.replace(ue, `\0`);
|
|
137
|
+
let n2 = 0, r2 = t2.length;
|
|
138
|
+
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
139
|
+
if (n2 === r2) return [];
|
|
140
|
+
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
141
|
+
return t2.slice(n2, r2).split(/\0/g);
|
|
142
|
+
}
|
|
143
|
+
var fe = (e6) => `validationError` in (e6.response?.data?.details ?? {});
|
|
144
|
+
var pe = (e6) => `applicationError` in (e6.response?.data?.details ?? {});
|
|
145
|
+
var me = (e6) => (e6.response?.status ?? -1) >= 400 && (e6.response?.status ?? -1) < 500;
|
|
146
|
+
function he(e6, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
147
|
+
if (typeof e6 != `object` || !e6) throw e6;
|
|
148
|
+
if (fe(e6)) return ge(e6, t2, n2);
|
|
149
|
+
if (pe(e6)) return ve(e6);
|
|
150
|
+
if (me(e6)) {
|
|
151
|
+
let t3 = e6.response?.status, n3 = e6.response?.statusText ?? `UNKNOWN`, r2 = e6.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: oe(n3), data: {} }, requestId: e6.requestId };
|
|
152
|
+
return _e(e6, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
153
|
+
}
|
|
154
|
+
return ye(e6);
|
|
155
|
+
}
|
|
156
|
+
var ge = (e6, t2, n2) => {
|
|
157
|
+
let r2 = e6.response?.data, i2 = e6.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = be(t2, a2, n2)?.sort((e7, t3) => e7.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e7, description: t3 }) => `"${e7}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
|
|
158
|
+
return _e(e6, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e6.response?.status, requestId: i2 } });
|
|
159
|
+
};
|
|
160
|
+
var _e = (e6, { message: t2, extraProperties: n2 }) => Object.assign(e6, { ...n2, message: t2 });
|
|
161
|
+
var ve = (e6) => {
|
|
162
|
+
let t2 = e6.response?.status, n2 = e6.response?.statusText ?? `UNKNOWN`, r2 = e6.response?.data?.message ?? n2, i2 = e6.response?.data?.details?.applicationError?.description ?? n2, a2 = e6.response?.data?.details?.applicationError?.code ?? oe(n2), o2 = e6.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e6.requestId };
|
|
163
|
+
return _e(e6, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e6.requestId } });
|
|
164
|
+
};
|
|
165
|
+
var ye = (e6) => _e(e6, { message: e6.requestId ? `System error occurred, request-id: ${e6.requestId}` : `System error occurred: ${JSON.stringify(e6)}`, extraProperties: { requestId: e6.requestId, status: e6.response?.status, code: oe(e6.response?.statusText ?? `UNKNOWN`), ...!e6.response && { runtimeError: e6 } } });
|
|
166
|
+
var be = ({ spreadPathsToArguments: e6, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
167
|
+
let a2 = { ...e6, ...t2 }, o2 = Object.keys(a2);
|
|
168
|
+
return r2?.filter((e7) => !r2.some((t3) => t3.field.length > e7.field.length && t3.field.startsWith(e7.field) && o2.includes(t3.field))).map((e7) => {
|
|
169
|
+
let r3 = t2[e7.field];
|
|
170
|
+
if (r3) return { ...e7, field: xe(r3, i2) };
|
|
171
|
+
let s2 = o2?.sort((e8, t3) => t3.length - e8.length)?.find((t3) => e7.field.startsWith(t3));
|
|
172
|
+
if (s2) {
|
|
173
|
+
let t3 = a2[s2];
|
|
174
|
+
if (t3) return { ...e7, field: e7.field.replace(s2, xe(t3, i2)) };
|
|
175
|
+
}
|
|
176
|
+
return n2 ? { ...e7, field: `${i2[0]}.${e7.field}` } : e7;
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
var xe = (e6, t2) => {
|
|
180
|
+
let n2 = Se(e6);
|
|
181
|
+
return n2 == null ? e6 : e6.replace(`$[${n2}]`, t2[n2]);
|
|
182
|
+
};
|
|
183
|
+
var Se = (e6) => {
|
|
184
|
+
let t2 = e6.match(/\$\[(?<argIndex>\d+)\]/);
|
|
185
|
+
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
186
|
+
};
|
|
187
|
+
function Ce(e6, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
188
|
+
return ie(() => e6({ request: async (e7) => {
|
|
189
|
+
let i3 = e7({ host: s2?.HTTPHost || `www.wixapis.com` }), a3 = i3;
|
|
190
|
+
a3.method === `GET` && a3.fallback?.length && (a3.params?.toString().length ?? 0) > 4e3 && (a3 = i3.fallback[0]);
|
|
191
|
+
let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ? b : o3}${a3.url}`;
|
|
192
|
+
a3.params && a3.params.toString() && (u3 += `?${a3.params.toString()}`);
|
|
193
|
+
try {
|
|
194
|
+
let e8 = ne(i3, t2, c2), o4 = { method: a3.method, ...a3.data && { body: JSON.stringify(a3.data) }, headers: { ...e8 } }, s3 = await n2(u3, o4);
|
|
195
|
+
if (s3.status !== 200) {
|
|
196
|
+
let e9 = null;
|
|
197
|
+
try {
|
|
198
|
+
e9 = await s3.json();
|
|
199
|
+
} catch {
|
|
200
|
+
}
|
|
201
|
+
let t3 = Te(s3.status, e9?.message ?? s3.statusText, e9?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e9 }), n3 = he(t3);
|
|
202
|
+
throw r2?.handleError(n3, { requestOptions: { url: a3.url, method: a3.method, entityFqdn: i3.entityFqdn, methodFqn: i3.methodFqn } }), t3;
|
|
203
|
+
}
|
|
204
|
+
let l3 = await s3.json();
|
|
205
|
+
return { data: a3.migrationOptions?.optInTransformResponse && a3.transformResponse ? Array.isArray(a3.transformResponse) ? a3.transformResponse[0](l3) : a3.transformResponse(l3) : l3, headers: s3.headers, status: s3.status, statusText: s3.statusText };
|
|
206
|
+
} catch (e8) {
|
|
207
|
+
throw e8.message?.includes(`fetch is not defined`) && console.error(`Node.js v18+ is required`), e8;
|
|
208
|
+
}
|
|
209
|
+
}, fetchWithAuth: n2, wixAPIFetch: i2, getActiveToken: a2, getAuthHeaders: o2 }, { validateRequestSchema: u2 }));
|
|
210
|
+
}
|
|
211
|
+
var we = class extends Error {
|
|
212
|
+
response;
|
|
213
|
+
requestId;
|
|
214
|
+
constructor(e6) {
|
|
215
|
+
super(), this.response = e6.response, this.requestId = e6.requestId;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
var Te = (e6, t2, n2, r2) => new we({ response: { data: { details: { ...!n2?.validationError && { applicationError: { description: t2, code: e6, data: r2 } }, ...n2 }, message: t2 }, status: e6 }, requestId: r2?.requestId });
|
|
219
|
+
var Ee = `.`;
|
|
220
|
+
function De(e6, t2, n2) {
|
|
221
|
+
if (e6 == null) throw Error(`Cannot set value on null or undefined`);
|
|
222
|
+
let r2 = Oe(t2), i2 = e6;
|
|
223
|
+
for (let e7 = 0; e7 < r2.length; e7++) {
|
|
224
|
+
let t3 = r2[e7];
|
|
225
|
+
if (e7 === r2.length - 1) {
|
|
226
|
+
i2[t3] = n2;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
let a2 = r2[e7 + 1];
|
|
230
|
+
(!(t3 in i2) || i2[t3] == null || typeof i2[t3] != `object` || i2[t3] === null) && (i2[t3] = typeof a2 == `number` ? [] : {}), i2 = i2[t3];
|
|
231
|
+
}
|
|
232
|
+
return e6;
|
|
233
|
+
}
|
|
234
|
+
function Oe(e6) {
|
|
235
|
+
return Array.isArray(e6) ? e6 : e6.split(Ee).map((e7) => ke(e7) ? Number(e7) : e7);
|
|
236
|
+
}
|
|
237
|
+
function ke(e6) {
|
|
238
|
+
return /^\d+$/.test(e6);
|
|
239
|
+
}
|
|
240
|
+
function Ae(e6) {
|
|
241
|
+
let t2 = {};
|
|
242
|
+
for (let [n2, r2] of Object.entries(e6)) je(n2) || De(t2, Oe(n2), r2);
|
|
243
|
+
return t2;
|
|
244
|
+
}
|
|
245
|
+
function je(e6) {
|
|
246
|
+
return e6 === `__proto__` || e6 === `constructor` || e6 === `prototype`;
|
|
247
|
+
}
|
|
248
|
+
var Me = class {
|
|
249
|
+
BRACKET_PATTERN = /\[(\d+)\]/g;
|
|
250
|
+
NUMERIC_PATTERN = /^\d+$/;
|
|
251
|
+
ESCAPED_DOT_PATTERN = /\\\./g;
|
|
252
|
+
ESCAPED_LEFT_BRACKET_PATTERN = /\\\[/g;
|
|
253
|
+
ESCAPED_RIGHT_BRACKET_PATTERN = /\\\]/g;
|
|
254
|
+
SPLIT_PATTERN = /\.|\[(\d+)\]/g;
|
|
255
|
+
DOT_BEFORE_BRACKET_PATTERN = /\.\[/g;
|
|
256
|
+
ESCAPED_DOT_PLACEHOLDER = `__DOT__`;
|
|
257
|
+
ESCAPED_RIGHT_BRACKET_PLACEHOLDER = `__RB__`;
|
|
258
|
+
ESCAPED_LEFT_BRACKET_PLACEHOLDER = `__LB__`;
|
|
259
|
+
modifiedFields;
|
|
260
|
+
cleanedModifiedFields;
|
|
261
|
+
constructor(e6) {
|
|
262
|
+
this.modifiedFields = e6;
|
|
263
|
+
}
|
|
264
|
+
replaceEscapedCharacters(e6) {
|
|
265
|
+
return e6.replace(this.ESCAPED_DOT_PATTERN, this.ESCAPED_DOT_PLACEHOLDER).replace(this.ESCAPED_LEFT_BRACKET_PATTERN, this.ESCAPED_LEFT_BRACKET_PLACEHOLDER).replace(this.ESCAPED_RIGHT_BRACKET_PATTERN, this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER);
|
|
266
|
+
}
|
|
267
|
+
restoreEscapedCharacters(e6) {
|
|
268
|
+
return e6.replace(this.ESCAPED_DOT_PLACEHOLDER, `\\.`).replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER, `\\]`).replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER, `\\[`);
|
|
269
|
+
}
|
|
270
|
+
unflatten() {
|
|
271
|
+
return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([e6, t2]) => [this.replaceEscapedCharacters(this.bracketToDotNotation(e6)), t2])), Ae(this.cleanedModifiedFields);
|
|
272
|
+
}
|
|
273
|
+
flatten(e6) {
|
|
274
|
+
let t2 = {};
|
|
275
|
+
for (let n2 of Object.keys(this.cleanedModifiedFields)) {
|
|
276
|
+
let r2 = this.splitPath(n2), i2 = this.navigatePath(e6, r2);
|
|
277
|
+
t2 = { ...t2, ...i2 };
|
|
278
|
+
}
|
|
279
|
+
return Object.fromEntries(Object.entries(t2).map(([e7, t3]) => [this.restoreEscapedCharacters(e7), t3]));
|
|
280
|
+
}
|
|
281
|
+
splitPath(e6) {
|
|
282
|
+
let t2 = [], n2 = 0, r2 = Array.from(e6.matchAll(this.SPLIT_PATTERN));
|
|
283
|
+
for (let i2 of r2) i2.index > n2 && t2.push(e6.substring(n2, i2.index)), i2[1] && t2.push(i2[1]), n2 = i2.index + i2[0].length;
|
|
284
|
+
return n2 < e6.length && t2.push(e6.substring(n2)), t2;
|
|
285
|
+
}
|
|
286
|
+
navigatePath(e6, t2) {
|
|
287
|
+
let n2 = e6, r2 = [], i2 = (e7) => {
|
|
288
|
+
if (!Array.isArray(n2)) throw Error(`Expected array at path ${this.buildPathString(r2)}, but got ${typeof n2}`);
|
|
289
|
+
r2.push(`[${e7}]`), n2 = n2[parseInt(e7, 10)];
|
|
290
|
+
}, a2 = (e7, t3) => {
|
|
291
|
+
let i3 = e7 in ae ? ae[e7] : void 0;
|
|
292
|
+
if (i3 && i3 in t3) {
|
|
293
|
+
r2.push(i3), n2 = t3[i3];
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
let a3 = Ie(e7);
|
|
297
|
+
if (a3 && a3 in t3) r2.push(a3), n2 = t3[a3];
|
|
298
|
+
else throw Error(`Cannot find key '${e7}' or its transformations at path ${this.buildPathString(r2)}`);
|
|
299
|
+
}, o2 = (e7, t3) => {
|
|
300
|
+
r2.push(e7), n2 = t3[e7];
|
|
301
|
+
};
|
|
302
|
+
for (let e7 of t2) {
|
|
303
|
+
if (this.NUMERIC_PATTERN.test(e7)) {
|
|
304
|
+
i2(e7);
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
if (typeof n2 != `object` || !n2) throw Error(`Cannot access property '${e7}' on ${typeof n2} at path ${this.buildPathString(r2)}`);
|
|
308
|
+
let t3 = n2;
|
|
309
|
+
e7 in n2 ? o2(e7, t3) : a2(e7, t3);
|
|
310
|
+
}
|
|
311
|
+
return { [this.buildPathString(r2)]: n2 };
|
|
312
|
+
}
|
|
313
|
+
buildPathString(e6) {
|
|
314
|
+
return e6.join(`.`).replace(this.DOT_BEFORE_BRACKET_PATTERN, `[`);
|
|
315
|
+
}
|
|
316
|
+
bracketToDotNotation(e6) {
|
|
317
|
+
return e6.replace(this.BRACKET_PATTERN, (t2, n2, r2) => r2 > 0 && e6[r2 - 1] === `\\` ? t2 : `.` + n2);
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
function Ne(e6, t2) {
|
|
321
|
+
let n2 = e6?.modifiedFields;
|
|
322
|
+
if (!n2) return null;
|
|
323
|
+
let r2 = Pe(n2);
|
|
324
|
+
if (!r2) return null;
|
|
325
|
+
let { unflattenedModifiedFields: i2, modifiedFieldsManipulator: a2 } = r2;
|
|
326
|
+
e6 = { ...e6, modifiedFields: i2 };
|
|
327
|
+
let o2 = t2(e6), s2 = o2?.modifiedFields;
|
|
328
|
+
if (!s2) return null;
|
|
329
|
+
let c2 = Fe(s2, a2);
|
|
330
|
+
return c2 === null ? null : (o2.modifiedFields = c2, o2);
|
|
331
|
+
}
|
|
332
|
+
function Pe(e6) {
|
|
333
|
+
if (typeof e6 == `object` && e6 && !Array.isArray(e6)) try {
|
|
334
|
+
let t2 = new Me(e6);
|
|
335
|
+
return { unflattenedModifiedFields: t2.unflatten(), modifiedFieldsManipulator: t2 };
|
|
336
|
+
} catch {
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
function Fe(e6, t2) {
|
|
342
|
+
if (typeof e6 == `object` && e6 && !Array.isArray(e6)) try {
|
|
343
|
+
return t2.flatten(e6);
|
|
344
|
+
} catch {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
function Ie(e6) {
|
|
350
|
+
return e6.replace(/[-_\s]+(.)?/g, (e7, t2) => t2 ? t2.toUpperCase() : ``).replace(/^./, (e7) => e7.toLowerCase());
|
|
351
|
+
}
|
|
352
|
+
function Le() {
|
|
353
|
+
return { emit(e6, ...t2) {
|
|
354
|
+
for (let n2 = 0, r2 = this.events[e6] || [], i2 = r2.length; n2 < i2; n2++) r2[n2](...t2);
|
|
355
|
+
}, events: {}, on(e6, t2) {
|
|
356
|
+
return (this.events[e6] ||= []).push(t2), () => {
|
|
357
|
+
this.events[e6] = this.events[e6]?.filter((e7) => t2 !== e7);
|
|
358
|
+
};
|
|
359
|
+
} };
|
|
360
|
+
}
|
|
361
|
+
var Re = (e6) => e6.__type === `event-definition`;
|
|
362
|
+
function ze(e6, t2, n2, r2) {
|
|
363
|
+
let i2;
|
|
364
|
+
if (e6.isDomainEvent) {
|
|
365
|
+
let { deletedEvent: e7, actionEvent: t3, createdEvent: a3, updatedEvent: o3, ...s3 } = n2, c2 = { ...r2, ...s3 };
|
|
366
|
+
i2 = e7 ? e7?.deletedEntity ? { entity: e7?.deletedEntity, metadata: c2 } : { metadata: c2 } : t3 ? { data: t3.body, metadata: c2 } : o3 ? { entity: o3.currentEntity, metadata: c2, ...o3.modifiedFields ? { modifiedFields: o3.modifiedFields } : {} } : { entity: a3?.entity, metadata: c2 };
|
|
367
|
+
} else i2 = { data: n2, metadata: r2 };
|
|
368
|
+
let a2 = e6.transformations ?? ((e7) => e7), o2 = i2, s2 = i2;
|
|
369
|
+
if (s2.modifiedFields) {
|
|
370
|
+
let e7 = s2.modifiedFields;
|
|
371
|
+
if (typeof e7 == `object` && e7 && !Array.isArray(e7)) {
|
|
372
|
+
o2 = structuredClone(i2);
|
|
373
|
+
let e8 = Ne(s2, a2);
|
|
374
|
+
if (e8) return t2(e8);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return t2(a2(o2));
|
|
378
|
+
}
|
|
379
|
+
function Be(e6) {
|
|
380
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = Le();
|
|
381
|
+
return { initModule(e7) {
|
|
382
|
+
return (r2) => {
|
|
383
|
+
let i2 = t2.get(e7.type) ?? [];
|
|
384
|
+
i2.push({ eventDefinition: e7, handler: r2 }), t2.set(e7.type, i2), n2.emit(`registered`, e7);
|
|
385
|
+
};
|
|
386
|
+
}, client: { ...n2, getRegisteredEvents: () => t2, async process(e7, n3 = { expectedEvents: [] }) {
|
|
387
|
+
let { eventType: r2, identity: i2, instanceId: a2, payload: o2, accountInfo: s2 } = await this.parseJWT(e7), c2 = [...n3.expectedEvents, ...Array.from(t2.keys()).map((e8) => ({ type: e8 }))];
|
|
388
|
+
if (c2.length > 0 && !c2.some(({ type: e8 }) => e8 === r2)) throw Error(`Unexpected event type: ${r2}. Expected one of: ${c2.map((e8) => e8.type).join(`, `)}`);
|
|
389
|
+
let l2 = t2.get(r2) ?? [];
|
|
390
|
+
return await Promise.all(l2.map(({ eventDefinition: e8, handler: t3 }) => ze(e8, t3, o2, { instanceId: a2, identity: i2, accountInfo: s2 }))), { instanceId: a2, eventType: r2, payload: o2, identity: i2, accountInfo: s2 };
|
|
391
|
+
}, async processRequest(e7, t3) {
|
|
392
|
+
let n3 = await e7.text();
|
|
393
|
+
return this.process(n3, t3);
|
|
394
|
+
}, async parseJWT(t3) {
|
|
395
|
+
let n3 = e6();
|
|
396
|
+
if (!n3.decodeJWT) throw Error(`decodeJWT is not supported by the authentication strategy`);
|
|
397
|
+
let { decoded: r2, valid: i2 } = await n3.decodeJWT(t3);
|
|
398
|
+
if (!i2) throw Error(`JWT is not valid`);
|
|
399
|
+
if (typeof r2.data != `string`) throw Error(`Unexpected type of JWT data: expected string, got ${typeof r2.data}`);
|
|
400
|
+
let a2 = JSON.parse(r2.data), o2 = a2.eventType, s2 = a2.accountInfo, c2 = a2.instanceId, l2 = a2.identity ? JSON.parse(a2.identity) : void 0;
|
|
401
|
+
return { instanceId: c2, eventType: o2, payload: JSON.parse(a2.data), identity: l2, accountInfo: s2 };
|
|
402
|
+
}, async parseRequest(e7) {
|
|
403
|
+
let t3 = await e7.text();
|
|
404
|
+
return this.parseJWT(t3);
|
|
405
|
+
}, async executeHandlers(e7) {
|
|
406
|
+
let n3 = Array.from(t2.keys()).map((e8) => ({ type: e8 }));
|
|
407
|
+
if (n3.length > 0 && !n3.some(({ type: t3 }) => t3 === e7.eventType)) throw Error(`Unexpected event type: ${e7.eventType}. Expected one of: ${n3.map((e8) => e8.type).join(`, `)}`);
|
|
408
|
+
let r2 = t2.get(e7.eventType) ?? [];
|
|
409
|
+
await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) => ze(t3, n4, e7.payload, { instanceId: e7.instanceId, identity: e7.identity })));
|
|
410
|
+
}, apps: { AppInstalled: h(`AppInstalled`)(), AppRemoved: h(`AppRemoved`)() } } };
|
|
411
|
+
}
|
|
412
|
+
var Ve = (e6) => e6.__type === `service-plugin-definition`;
|
|
413
|
+
function He(e6) {
|
|
414
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = Le();
|
|
415
|
+
return { initModule(e7) {
|
|
416
|
+
return (r2) => {
|
|
417
|
+
let i2 = t2.get(e7.componentType.toLowerCase()) ?? [];
|
|
418
|
+
i2.push({ servicePluginDefinition: e7, implementation: r2 }), t2.set(e7.componentType.toLowerCase(), i2), n2.emit(`registered`, e7);
|
|
419
|
+
};
|
|
420
|
+
}, client: { ...n2, getRegisteredServicePlugins: () => t2, async parseJWT(t3) {
|
|
421
|
+
let n3 = e6();
|
|
422
|
+
if (!n3.decodeJWT) throw Error(`decodeJWT is not supported by the authentication strategy`);
|
|
423
|
+
let { decoded: r2, valid: i2 } = await n3.decodeJWT(t3, true);
|
|
424
|
+
if (!i2) throw Error(`JWT is not valid`);
|
|
425
|
+
if (typeof r2.data != `object` || r2.data === null || !(`metadata` in r2.data) || typeof r2.data.metadata != `object` || r2.data.metadata === null || !(`appExtensionType` in r2.data.metadata) || typeof r2.data.metadata.appExtensionType != `string`) throw Error(`Unexpected JWT data: expected object with metadata.appExtensionType string`);
|
|
426
|
+
return r2.data;
|
|
427
|
+
}, async process(e7) {
|
|
428
|
+
let t3 = await this.parseJWT(e7.body);
|
|
429
|
+
return this.executeHandler(t3, e7.url);
|
|
430
|
+
}, async parseRequest(e7) {
|
|
431
|
+
let t3 = await e7.text();
|
|
432
|
+
return this.parseJWT(t3);
|
|
433
|
+
}, async processRequest(e7) {
|
|
434
|
+
let t3 = await this.parseRequest(e7);
|
|
435
|
+
return this.processParsedRequest(t3, e7.url);
|
|
436
|
+
}, async processParsedRequest(e7, t3) {
|
|
437
|
+
try {
|
|
438
|
+
let n3 = await this.executeHandler(e7, t3);
|
|
439
|
+
return Response.json(n3);
|
|
440
|
+
} catch (e8) {
|
|
441
|
+
if (e8.errorType === `SPI` && e8.applicationCode && e8.httpCode) return Response.json({ applicationError: { code: e8.applicationCode, data: e8.data } }, { status: e8.httpCode });
|
|
442
|
+
throw e8;
|
|
443
|
+
}
|
|
444
|
+
}, async executeHandler(e7, n3) {
|
|
445
|
+
let r2 = e7.metadata.appExtensionType.toLowerCase(), i2 = t2.get(r2) ?? [];
|
|
446
|
+
if (i2.length === 0) throw Error(`No service plugin implementations found for component type ${r2}`);
|
|
447
|
+
if (i2.length > 1) throw Error(`Multiple service plugin implementations found for component type ${r2}. This is currently not supported`);
|
|
448
|
+
let { implementation: a2, servicePluginDefinition: o2 } = i2[0], s2 = o2.methods.find((e8) => n3.endsWith(e8.primaryHttpMappingPath));
|
|
449
|
+
if (!s2) throw Error(`Unexpect request: request url did not match any method: ` + n3);
|
|
450
|
+
let c2 = a2[s2.name];
|
|
451
|
+
if (!c2) throw Error(`Got request for service plugin method ${s2.name} but no implementation was provided. Available methods: ${Object.keys(a2).join(`, `)}`);
|
|
452
|
+
return s2.transformations.toREST(await c2(s2.transformations.fromREST(e7)));
|
|
453
|
+
} } };
|
|
454
|
+
}
|
|
455
|
+
var E = `X-Wix-Consistent`;
|
|
456
|
+
function Ue(e6) {
|
|
457
|
+
let t2 = e6.headers || { Authorization: `` }, n2 = { getAuthHeaders: (e7) => Promise.resolve({ headers: {} }) }, r2 = e6.auth, i2 = typeof r2 == `function` ? r2 : () => r2 ?? n2, a2 = () => i2().getAuthHeaders(e6.host), o2 = () => e6.fetch ?? fetch, s2 = async (n3, r3) => {
|
|
458
|
+
let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e6.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [E]: t2[E] } : {} }, l3 = e6.host?.getErrorHandler?.();
|
|
459
|
+
try {
|
|
460
|
+
if (typeof n3 == `string` || n3 instanceof URL) {
|
|
461
|
+
let e7 = await i3(n3, { ...r3, headers: c3 });
|
|
462
|
+
l3?.handleError(e7, { requestOptions: { url: n3.toString(), method: r3?.method } });
|
|
463
|
+
let a3 = We(e7);
|
|
464
|
+
return a3 && (t2[E] = a3), e7;
|
|
465
|
+
}
|
|
466
|
+
{
|
|
467
|
+
for (let [e8, t3] of Object.entries(c3)) typeof t3 == `string` && n3.headers.set(e8, t3);
|
|
468
|
+
let e7 = await i3(n3, r3);
|
|
469
|
+
l3?.handleError(e7, { requestOptions: { url: n3.url, method: r3?.method } });
|
|
470
|
+
let a3 = We(e7);
|
|
471
|
+
return a3 && (t2[E] = a3), e7;
|
|
472
|
+
}
|
|
473
|
+
} catch (e7) {
|
|
474
|
+
throw l3?.handleError(e7, { requestOptions: { url: typeof n3 == `string` || n3 instanceof URL ? n3.toString() : n3.url, method: r3?.method } }), e7;
|
|
475
|
+
}
|
|
476
|
+
}, { client: c2, initModule: l2 } = He(i2), { client: u2, initModule: d2 } = Be(i2), f2 = async (n3, r3) => {
|
|
477
|
+
let i3 = o2(), s3 = await a2(), c3 = C(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e6.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [E]: t2[E] } : {} } }), u3 = We(l3);
|
|
478
|
+
return u3 && (t2[E] = u3), l3;
|
|
479
|
+
}, p2 = (t3, n3) => {
|
|
480
|
+
if (Re(t3)) return d2(t3);
|
|
481
|
+
if (Ve(t3)) return l2(t3);
|
|
482
|
+
if (w(t3) && e6.host) return T(t3, e6.host);
|
|
483
|
+
if (typeof t3 == `function`) {
|
|
484
|
+
if (`__type` in t3 && t3.__type === `wix_spi_error`) return t3;
|
|
485
|
+
let r3 = e6.host?.apiBaseUrl ?? `www.wixapis.com`, o3 = e6.useCDN === void 0 ? i2().shouldUseCDN : e6.useCDN;
|
|
486
|
+
return Ce(ie(() => v(t3)) ? _(t3) : t3, n3 ?? {}, f2, e6.host?.getErrorHandler?.(), (e7, t4) => {
|
|
487
|
+
let n4 = new URL(e7, `https://${r3}`);
|
|
488
|
+
return n4.host = r3, n4.protocol = `https`, f2(n4.toString(), t4);
|
|
489
|
+
}, i2().getActiveToken, async () => a2(), { HTTPHost: r3 }, e6.host?.name, o3, e6.validateRequestSchema);
|
|
490
|
+
}
|
|
491
|
+
return ee(t3) ? Object.fromEntries(Object.entries(t3).map(([e7, n4]) => [e7, p2(n4, t3[y])])) : t3;
|
|
492
|
+
}, h2 = (e7) => {
|
|
493
|
+
for (let n3 in e7) t2[n3] = e7[n3];
|
|
494
|
+
};
|
|
495
|
+
return { ...e6.modules ? p2(e6.modules) : {}, get auth() {
|
|
496
|
+
let t3 = i2();
|
|
497
|
+
return t3.getAuthHeaders = t3.getAuthHeaders.bind(void 0, e6.host), t3;
|
|
498
|
+
}, setHeaders: h2, use: p2, enableContext(e7, t3 = { elevated: false }) {
|
|
499
|
+
e7 === `global` ? globalThis.__wix_context__ == null ? t3.elevated ? globalThis.__wix_context__ = { elevatedClient: this } : globalThis.__wix_context__ = { client: this } : t3.elevated ? globalThis.__wix_context__.elevatedClient = this : globalThis.__wix_context__.client = this : t3.elevated ? m.elevatedClient = this : m.client = this;
|
|
500
|
+
}, fetch: (t3, n3) => {
|
|
501
|
+
let r3 = e6.host?.apiBaseUrl ?? `www.wixapis.com`, i3 = new URL(t3, `https://${r3}`);
|
|
502
|
+
return i3.host = r3, i3.protocol = `https`, f2(i3.toString(), n3);
|
|
503
|
+
}, fetchWithAuth: s2, async graphql(t3, n3, r3 = { apiVersion: `alpha` }) {
|
|
504
|
+
let i3 = e6?.host?.apiBaseUrl ?? `www.wixapis.com`, a3 = await f2(`https://${i3}/graphql/${r3.apiVersion}`, { method: `POST`, headers: { "Content-Type": `application/json` }, body: JSON.stringify({ query: t3, variables: n3 }) });
|
|
505
|
+
if (a3.status !== 200) throw new x(`GraphQL request failed with status ${a3.status}`, a3);
|
|
506
|
+
let { data: o3, errors: s3 } = await a3.json();
|
|
507
|
+
return { data: o3 ?? {}, errors: s3 };
|
|
508
|
+
}, webhooks: u2, servicePlugins: c2 };
|
|
509
|
+
}
|
|
510
|
+
function We(e6) {
|
|
511
|
+
return e6.headers?.get(`X-Wix-Consistent`) ?? e6.headers?.get(`x-wix-consistent`);
|
|
512
|
+
}
|
|
513
|
+
var Ge = { _id: `id`, _createdDate: `createdDate`, _updatedDate: `updatedDate` };
|
|
514
|
+
var Ke = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
515
|
+
var qe = `items`;
|
|
516
|
+
var Je = `pagingMetadata`;
|
|
517
|
+
var Ye = Ge;
|
|
518
|
+
function Xe(e6, t2) {
|
|
519
|
+
return e6?.split(`.`).map((e7) => t2?.[e7] ?? e7).join(`.`);
|
|
520
|
+
}
|
|
521
|
+
var Ze = `sort.fieldName`;
|
|
522
|
+
function Qe(e6, t2, n2) {
|
|
523
|
+
return (e6 === Ze || e6.endsWith(`.${Ze}`)) && typeof t2 == `string` ? Xe(t2, n2) : t2;
|
|
524
|
+
}
|
|
525
|
+
function $e(e6, t2, n2) {
|
|
526
|
+
let r2 = (e7) => n2.includes(e7), i2 = (e7, n3) => {
|
|
527
|
+
if (Array.isArray(e7)) e7.forEach((e8) => {
|
|
528
|
+
i2(e8, n3);
|
|
529
|
+
});
|
|
530
|
+
else if (typeof e7 == `object` && e7) {
|
|
531
|
+
let a2 = e7;
|
|
532
|
+
Object.keys(a2).forEach((e8) => {
|
|
533
|
+
let o2 = n3 === `` ? e8 : `${n3}.${e8}`;
|
|
534
|
+
if (r2(o2)) return;
|
|
535
|
+
let s2 = et(e8, t2);
|
|
536
|
+
s2 !== e8 && !(s2 in a2) && (a2[s2] = a2[e8], delete a2[e8]), a2[s2] = Qe(o2, a2[s2], t2), i2(a2[s2], o2);
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
return i2(e6, ``), e6;
|
|
541
|
+
}
|
|
542
|
+
function et(e6, t2) {
|
|
543
|
+
let n2;
|
|
544
|
+
return n2 = e6.includes(`.`) ? e6.split(`.`).map((e7) => t2[e7] ?? e7).join(`.`) : t2[e6] ?? e6, n2;
|
|
545
|
+
}
|
|
546
|
+
function D(e6, t2 = []) {
|
|
547
|
+
return $e(e6, Ge, t2);
|
|
548
|
+
}
|
|
549
|
+
function O(e6, t2 = []) {
|
|
550
|
+
return $e(e6, Ke, t2);
|
|
551
|
+
}
|
|
552
|
+
function tt(e6) {
|
|
553
|
+
return e6?.toISOString();
|
|
554
|
+
}
|
|
555
|
+
function nt(e6) {
|
|
556
|
+
return e6 ? new Date(e6) : void 0;
|
|
557
|
+
}
|
|
558
|
+
var rt = /* @__PURE__ */ new WeakMap();
|
|
559
|
+
function it() {
|
|
560
|
+
return { leaves: void 0, fields: void 0, mapFields: void 0, anyField: void 0 };
|
|
561
|
+
}
|
|
562
|
+
function at(e6, t2) {
|
|
563
|
+
let n2 = e6.get(t2);
|
|
564
|
+
return n2 || (n2 = it(), e6.set(t2, n2)), n2;
|
|
565
|
+
}
|
|
566
|
+
function ot(e6, t2) {
|
|
567
|
+
return t2 === `*` ? (e6.anyField ??= it(), e6.anyField) : t2.endsWith(`{}`) ? (e6.mapFields ??= /* @__PURE__ */ new Map(), at(e6.mapFields, t2.slice(0, -2))) : (e6.fields ??= /* @__PURE__ */ new Map(), at(e6.fields, t2));
|
|
568
|
+
}
|
|
569
|
+
function st(e6) {
|
|
570
|
+
let t2 = it();
|
|
571
|
+
for (let n2 of e6) {
|
|
572
|
+
let e7 = n2.path.split(`.`).reduce(ot, t2);
|
|
573
|
+
e7.leaves ??= [], e7.leaves.push(n2);
|
|
574
|
+
}
|
|
575
|
+
return t2;
|
|
576
|
+
}
|
|
577
|
+
function ct(e6) {
|
|
578
|
+
let t2 = rt.get(e6);
|
|
579
|
+
return t2 || (t2 = st(e6), rt.set(e6, t2)), t2;
|
|
580
|
+
}
|
|
581
|
+
function k(e6) {
|
|
582
|
+
return typeof e6 == `object` && !!e6;
|
|
583
|
+
}
|
|
584
|
+
function lt(e6, { isRepeated: t2, isMap: n2 }, r2) {
|
|
585
|
+
return t2 ? Array.isArray(e6) ? e6.map(r2) : e6 : n2 ? k(e6) ? Object.fromEntries(Object.entries(e6).map(([e7, t3]) => [e7, r2(t3)])) : e6 : r2(e6);
|
|
586
|
+
}
|
|
587
|
+
function A(e6, t2, n2) {
|
|
588
|
+
k(e6) && ft(e6, t2, n2);
|
|
589
|
+
}
|
|
590
|
+
function ut(e6, t2, n2) {
|
|
591
|
+
for (let [r2, i2] of t2) {
|
|
592
|
+
if (!(r2 in e6)) continue;
|
|
593
|
+
if (i2.leaves) for (let t4 of i2.leaves) e6[r2] = lt(e6[r2], t4, n2);
|
|
594
|
+
let t3 = e6[r2];
|
|
595
|
+
Array.isArray(t3) ? t3.forEach((e7) => A(e7, i2, n2)) : A(t3, i2, n2);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function dt(e6, t2, n2) {
|
|
599
|
+
for (let [r2, i2] of t2) {
|
|
600
|
+
let t3 = e6[r2];
|
|
601
|
+
k(t3) && Object.values(t3).forEach((e7) => A(e7, i2, n2));
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function ft(e6, { fields: t2, mapFields: n2, anyField: r2 }, i2) {
|
|
605
|
+
t2 && ut(e6, t2, i2), n2 && dt(e6, n2, i2), r2 && Object.values(e6).forEach((e7) => A(e7, r2, i2));
|
|
606
|
+
}
|
|
607
|
+
function j(e6, t2) {
|
|
608
|
+
if (!k(e6)) return e6;
|
|
609
|
+
for (let { paths: n2, transformFn: r2 } of t2) ft(e6, ct(n2), r2);
|
|
610
|
+
return e6;
|
|
611
|
+
}
|
|
612
|
+
function pt(e6) {
|
|
613
|
+
return vt(e6).map((e7) => e7.toLocaleUpperCase()).join(`_`);
|
|
614
|
+
}
|
|
615
|
+
var mt = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
616
|
+
var ht = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
617
|
+
var gt = `$1\0$2`;
|
|
618
|
+
var _t = /[^\p{L}\d]+/giu;
|
|
619
|
+
function vt(e6) {
|
|
620
|
+
let t2 = e6.trim();
|
|
621
|
+
t2 = t2.replace(mt, gt).replace(ht, gt), t2 = t2.replace(_t, `\0`);
|
|
622
|
+
let n2 = 0, r2 = t2.length;
|
|
623
|
+
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
624
|
+
if (n2 === r2) return [];
|
|
625
|
+
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
626
|
+
return t2.slice(n2, r2).split(/\0/g);
|
|
627
|
+
}
|
|
628
|
+
var yt = (e6) => `validationError` in (e6.response?.data?.details ?? {});
|
|
629
|
+
var bt = (e6) => `applicationError` in (e6.response?.data?.details ?? {});
|
|
630
|
+
var xt = (e6) => (e6.response?.status ?? -1) >= 400 && (e6.response?.status ?? -1) < 500;
|
|
631
|
+
function M(e6, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
632
|
+
if (typeof e6 != `object` || !e6) throw e6;
|
|
633
|
+
if (yt(e6)) return St(e6, t2, n2);
|
|
634
|
+
if (bt(e6)) return Ct(e6);
|
|
635
|
+
if (xt(e6)) {
|
|
636
|
+
let t3 = e6.response?.status, n3 = e6.response?.statusText ?? `UNKNOWN`, r2 = e6.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: pt(n3), data: {} }, requestId: e6.requestId };
|
|
637
|
+
return N(e6, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
638
|
+
}
|
|
639
|
+
return wt(e6);
|
|
640
|
+
}
|
|
641
|
+
var St = (e6, t2, n2) => {
|
|
642
|
+
let r2 = e6.response?.data, i2 = e6.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = Tt(t2, a2, n2)?.sort((e7, t3) => e7.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e7, description: t3 }) => `"${e7}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
|
|
643
|
+
return N(e6, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e6.response?.status, requestId: i2 } });
|
|
644
|
+
};
|
|
645
|
+
var N = (e6, { message: t2, extraProperties: n2 }) => Object.assign(e6, { ...n2, message: t2 });
|
|
646
|
+
var Ct = (e6) => {
|
|
647
|
+
let t2 = e6.response?.status, n2 = e6.response?.statusText ?? `UNKNOWN`, r2 = e6.response?.data?.message ?? n2, i2 = e6.response?.data?.details?.applicationError?.description ?? n2, a2 = e6.response?.data?.details?.applicationError?.code ?? pt(n2), o2 = e6.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e6.requestId };
|
|
648
|
+
return N(e6, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e6.requestId } });
|
|
649
|
+
};
|
|
650
|
+
var wt = (e6) => N(e6, { message: e6.requestId ? `System error occurred, request-id: ${e6.requestId}` : `System error occurred: ${JSON.stringify(e6)}`, extraProperties: { requestId: e6.requestId, status: e6.response?.status, code: pt(e6.response?.statusText ?? `UNKNOWN`), ...!e6.response && { runtimeError: e6 } } });
|
|
651
|
+
var Tt = ({ spreadPathsToArguments: e6, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
652
|
+
let a2 = { ...e6, ...t2 }, o2 = Object.keys(a2);
|
|
653
|
+
return r2?.filter((e7) => !r2.some((t3) => t3.field.length > e7.field.length && t3.field.startsWith(e7.field) && o2.includes(t3.field))).map((e7) => {
|
|
654
|
+
let r3 = t2[e7.field];
|
|
655
|
+
if (r3) return { ...e7, field: Et(r3, i2) };
|
|
656
|
+
let s2 = o2?.sort((e8, t3) => t3.length - e8.length)?.find((t3) => e7.field.startsWith(t3));
|
|
657
|
+
if (s2) {
|
|
658
|
+
let t3 = a2[s2];
|
|
659
|
+
if (t3) return { ...e7, field: e7.field.replace(s2, Et(t3, i2)) };
|
|
660
|
+
}
|
|
661
|
+
return n2 ? { ...e7, field: `${i2[0]}.${e7.field}` } : e7;
|
|
662
|
+
});
|
|
663
|
+
};
|
|
664
|
+
var Et = (e6, t2) => {
|
|
665
|
+
let n2 = Dt(e6);
|
|
666
|
+
return n2 == null ? e6 : e6.replace(`$[${n2}]`, t2[n2]);
|
|
667
|
+
};
|
|
668
|
+
var Dt = (e6) => {
|
|
669
|
+
let t2 = e6.match(/\$\[(?<argIndex>\d+)\]/);
|
|
670
|
+
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
671
|
+
};
|
|
672
|
+
function Ot() {
|
|
673
|
+
let e6 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
674
|
+
if (e6) return { initWixModules(t3, n3) {
|
|
675
|
+
return kt(() => e6(t3, n3));
|
|
676
|
+
}, fetchWithAuth() {
|
|
677
|
+
throw Error(`fetchWithAuth is not available in this context`);
|
|
678
|
+
}, graphql() {
|
|
679
|
+
throw Error(`graphql is not available in this context`);
|
|
680
|
+
} };
|
|
681
|
+
let t2 = typeof $wixContext < `u` ? $wixContext.client : m.client === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.client : m.client, n2 = typeof $wixContext < `u` ? $wixContext.elevatedClient : m.elevatedClient === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.elevatedClient : m.elevatedClient;
|
|
682
|
+
if (t2 || n2) return { initWixModules(e7, r2) {
|
|
683
|
+
if (r2) {
|
|
684
|
+
if (!n2) throw Error(`An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules`);
|
|
685
|
+
return kt(() => n2.use(e7));
|
|
686
|
+
}
|
|
687
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
688
|
+
return kt(() => t2.use(e7));
|
|
689
|
+
}, fetchWithAuth: (e7, n3) => {
|
|
690
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
691
|
+
return t2.fetchWithAuth(e7, n3);
|
|
692
|
+
}, getAuth() {
|
|
693
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
694
|
+
return t2.auth;
|
|
695
|
+
}, async graphql(e7, n3, r2) {
|
|
696
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
697
|
+
return t2.graphql(e7, n3, r2);
|
|
698
|
+
} };
|
|
699
|
+
}
|
|
700
|
+
function kt(e6) {
|
|
701
|
+
let t2 = globalThis.__wix_context__, n2 = { client: m.client, elevatedClient: m.elevatedClient }, r2;
|
|
702
|
+
globalThis.__wix_context__ = void 0, m.client = void 0, m.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
703
|
+
try {
|
|
704
|
+
return e6();
|
|
705
|
+
} finally {
|
|
706
|
+
globalThis.__wix_context__ = t2, m.client = n2.client, m.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
function At(e6, t2) {
|
|
710
|
+
return (...n2) => {
|
|
711
|
+
let r2 = Ot();
|
|
712
|
+
return r2 ? r2.initWixModules(e6, t2).apply(void 0, n2) : e6.apply(void 0, n2);
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
function jt(e6, t2 = false) {
|
|
716
|
+
return At(e6, t2);
|
|
717
|
+
}
|
|
718
|
+
function Mt(e6, t2) {
|
|
719
|
+
let n2 = Pt(e6), r2 = Object.entries(n2).some(([e7, t3]) => e7.includes(`.`) || Array.isArray(t3) && t3.some((e8) => typeof e8 == `object`));
|
|
720
|
+
return t2 && r2 ? new URLSearchParams({ ".r": It(JSON.stringify(e6)) }) : Object.entries(n2).reduce((e7, [t3, n3]) => ((Array.isArray(n3) ? n3 : [n3]).forEach((r3) => {
|
|
721
|
+
r3 == null || Array.isArray(n3) && typeof r3 == `object` || e7.append(t3, r3);
|
|
722
|
+
}), e7), new URLSearchParams());
|
|
723
|
+
}
|
|
724
|
+
function Nt(e6) {
|
|
725
|
+
let t2 = Yt(qt(e6.host), e6.domainToMappings);
|
|
726
|
+
return an(tn(e6.protoPath, e6.data || {}), t2);
|
|
727
|
+
}
|
|
728
|
+
function Pt(e6, t2 = ``) {
|
|
729
|
+
let n2 = {};
|
|
730
|
+
return Object.entries(e6).forEach(([e7, r2]) => {
|
|
731
|
+
let i2 = typeof r2 == `object` && !!r2 && !Array.isArray(r2), a2 = Ft(t2, e7);
|
|
732
|
+
if (i2) {
|
|
733
|
+
let e8 = Pt(r2, a2);
|
|
734
|
+
Object.assign(n2, e8);
|
|
735
|
+
} else n2[a2] = r2;
|
|
736
|
+
}), n2;
|
|
737
|
+
}
|
|
738
|
+
function Ft(e6, t2) {
|
|
739
|
+
return `${e6}${e6 ? `.` : ``}${t2}`;
|
|
740
|
+
}
|
|
741
|
+
var It = (e6) => {
|
|
742
|
+
let t2 = new TextEncoder().encode(e6);
|
|
743
|
+
return (typeof btoa < `u` ? btoa(String.fromCodePoint(...t2)) : Buffer.from(e6, `utf-8`).toString(`base64`)).replace(/=/g, ``).replace(/\+/g, `-`).replace(/\//g, `_`);
|
|
744
|
+
};
|
|
745
|
+
var Lt = [`wix.com`, `editorx.com`];
|
|
746
|
+
var Rt = `_`;
|
|
747
|
+
var zt = `*.`;
|
|
748
|
+
var Bt = RegExp(`\\.(${Lt.join(`|`)})$`);
|
|
749
|
+
var Vt = [`42.wixprod.net`, `uw2-edt-1.wixprod.net`, `virginia-edt.wixprod.net`];
|
|
750
|
+
var Ht = { "payments.base44.com": `manage.wix.com`, "create.editorx.com": `editor.editorx.com` };
|
|
751
|
+
var Ut = `dev.wix-code.com`;
|
|
752
|
+
var Wt = /{(.*)}/;
|
|
753
|
+
var Gt = RegExp(`\\.(${Vt.join(`|`)})$`);
|
|
754
|
+
var Kt = RegExp(`.*\\.${Ut}$`);
|
|
755
|
+
function qt(e6) {
|
|
756
|
+
return Jt(e6).replace(Bt, `._base_domain_`).replace(Gt, `._api_base_domain_`).replace(Kt, `*.dev.wix-code.com`);
|
|
757
|
+
}
|
|
758
|
+
function Jt(e6) {
|
|
759
|
+
return Ht[e6] ?? e6;
|
|
760
|
+
}
|
|
761
|
+
function Yt(e6, t2) {
|
|
762
|
+
let n2 = t2[e6];
|
|
763
|
+
if (n2) return n2;
|
|
764
|
+
let r2 = Xt(e6, t2) ?? Zt(e6, t2);
|
|
765
|
+
if (!r2) {
|
|
766
|
+
if ($t(e6)) {
|
|
767
|
+
let e7 = t2[en];
|
|
768
|
+
if (e7) return e7;
|
|
769
|
+
}
|
|
770
|
+
let n3 = t2[Rt];
|
|
771
|
+
if (n3) return n3;
|
|
772
|
+
}
|
|
773
|
+
return r2 ?? [];
|
|
774
|
+
}
|
|
775
|
+
function Xt(e6, t2) {
|
|
776
|
+
return Object.entries(t2).find(([t3]) => {
|
|
777
|
+
let [, ...n2] = e6.split(`.`);
|
|
778
|
+
return n2.join(`.`) === t3;
|
|
779
|
+
})?.[1];
|
|
780
|
+
}
|
|
781
|
+
function Zt(e6, t2) {
|
|
782
|
+
let [n2] = Object.entries(t2).filter(([t3]) => Qt(e6, t3)).sort(([e7], [t3]) => t3.length - e7.length);
|
|
783
|
+
if (!n2) return;
|
|
784
|
+
let [, r2] = n2;
|
|
785
|
+
return r2;
|
|
786
|
+
}
|
|
787
|
+
function Qt(e6, t2) {
|
|
788
|
+
if (!t2.startsWith(zt)) return false;
|
|
789
|
+
let n2 = t2.slice(1);
|
|
790
|
+
return e6.length > n2.length && e6.endsWith(n2);
|
|
791
|
+
}
|
|
792
|
+
function $t(e6) {
|
|
793
|
+
return !!e6.match(/\._base_domain_$/);
|
|
794
|
+
}
|
|
795
|
+
var en = `www._base_domain_`;
|
|
796
|
+
function tn(e6, t2) {
|
|
797
|
+
return e6.split(`/`).map((e7) => nn(e7, t2)).join(`/`);
|
|
798
|
+
}
|
|
799
|
+
function nn(e6, t2) {
|
|
800
|
+
let n2 = e6.match(Wt) || [], r2 = n2[1];
|
|
801
|
+
return r2 ? rn(t2, r2, e6, e6.replace(n2[0], ``)) : e6;
|
|
802
|
+
}
|
|
803
|
+
function rn(e6, t2, n2, r2) {
|
|
804
|
+
let i2 = e6;
|
|
805
|
+
for (let e7 of t2.split(`.`)) {
|
|
806
|
+
if (!i2) return n2;
|
|
807
|
+
i2 = i2[e7];
|
|
808
|
+
}
|
|
809
|
+
return `${i2}${r2}`;
|
|
810
|
+
}
|
|
811
|
+
function an(e6, t2) {
|
|
812
|
+
let n2 = t2?.find((t3) => e6.startsWith(t3.destPath));
|
|
813
|
+
return n2 ? n2.srcPath + e6.slice(n2.destPath.length) : e6;
|
|
814
|
+
}
|
|
815
|
+
function on(e6) {
|
|
816
|
+
return e6 === `NaN` ? NaN : e6 === `Infinity` ? 1 / 0 : e6 === `-Infinity` ? -1 / 0 : e6;
|
|
817
|
+
}
|
|
818
|
+
var sn = `modulepreload`;
|
|
819
|
+
var cn = function(e6, t2) {
|
|
820
|
+
return new URL(e6, t2).href;
|
|
821
|
+
};
|
|
822
|
+
var ln = {};
|
|
823
|
+
var un = function(e6) {
|
|
824
|
+
return e6.pathname.endsWith(`.css`);
|
|
825
|
+
};
|
|
826
|
+
var dn = function(e6, t2, n2) {
|
|
827
|
+
if (t2 in e6) return e6[t2];
|
|
828
|
+
let r2 = n2();
|
|
829
|
+
if (!r2) {
|
|
830
|
+
e6[t2] = void 0;
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
let i2 = r2.then(() => {
|
|
834
|
+
e6[t2] = void 0;
|
|
835
|
+
}, (n3) => {
|
|
836
|
+
throw e6[t2] = void 0, n3;
|
|
837
|
+
});
|
|
838
|
+
return e6[t2] = i2, i2;
|
|
839
|
+
};
|
|
840
|
+
var fn = function(e6, t2, n2) {
|
|
841
|
+
let r2 = Promise.resolve();
|
|
842
|
+
if (t2 && t2.length > 0) {
|
|
843
|
+
let o3 = function(e8) {
|
|
844
|
+
return Promise.all(e8.map((e9) => Promise.resolve(e9).then((e10) => ({ status: `fulfilled`, value: e10 }), (e10) => ({ status: `rejected`, reason: e10 }))));
|
|
845
|
+
}, s3 = function(e8) {
|
|
846
|
+
return import_meta.resolve ? new URL(import_meta.resolve(e8)) : new URL(e8, import_meta.url);
|
|
847
|
+
};
|
|
848
|
+
var o2 = o3, s2 = s3;
|
|
849
|
+
let e7, i3 = document.querySelector(`meta[property=csp-nonce]`), a2 = i3?.nonce || i3?.getAttribute(`nonce`);
|
|
850
|
+
r2 = o3(t2.map((t3) => {
|
|
851
|
+
t3 = cn(t3, n2);
|
|
852
|
+
let r3 = s3(t3), i4 = un(r3);
|
|
853
|
+
return dn(ln, r3.href, () => {
|
|
854
|
+
if (e7 === void 0) {
|
|
855
|
+
e7 = { all: /* @__PURE__ */ new Set(), styles: /* @__PURE__ */ new Set() };
|
|
856
|
+
let t5 = document.getElementsByTagName(`link`);
|
|
857
|
+
for (let n3 = t5.length - 1; n3 >= 0; n3--) {
|
|
858
|
+
let r4 = t5[n3];
|
|
859
|
+
e7.all.add(r4.href), r4.rel === `stylesheet` && e7.styles.add(r4.href);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
if ((i4 ? e7.styles : e7.all).has(r3.href)) return;
|
|
863
|
+
let t4 = document.createElement(`link`);
|
|
864
|
+
if (t4.rel = i4 ? `stylesheet` : sn, i4 || (t4.as = `script`), t4.crossOrigin = ``, t4.href = r3.href, a2 && t4.setAttribute(`nonce`, a2), document.head.appendChild(t4), i4) return new Promise((e8, n3) => {
|
|
865
|
+
t4.addEventListener(`load`, e8), t4.addEventListener(`error`, () => n3(Error(`Unable to preload CSS for ${r3}`)));
|
|
866
|
+
});
|
|
867
|
+
});
|
|
868
|
+
}).filter((e8) => e8 !== void 0));
|
|
869
|
+
}
|
|
870
|
+
function i2(e7) {
|
|
871
|
+
let t3 = new Event(`vite:preloadError`, { cancelable: true });
|
|
872
|
+
if (t3.payload = e7, window.dispatchEvent(t3), !t3.defaultPrevented) throw e7;
|
|
873
|
+
}
|
|
874
|
+
return r2.then((t3) => {
|
|
875
|
+
for (let e7 of t3 || []) e7.status === `rejected` && i2(e7.reason);
|
|
876
|
+
return e6().catch(i2);
|
|
877
|
+
});
|
|
878
|
+
};
|
|
879
|
+
var pn = `x-wix-linguist`;
|
|
880
|
+
var mn = `00000000-0000-0000-0000-000000000000`;
|
|
881
|
+
var hn = `false`;
|
|
882
|
+
var gn = () => {
|
|
883
|
+
let e6 = yn(`language`), t2 = yn(`locale`);
|
|
884
|
+
if (e6) return { [pn]: [e6, t2 || e6, hn, mn].join(`|`) };
|
|
885
|
+
};
|
|
886
|
+
function _n() {
|
|
887
|
+
let e6 = null, t2 = null;
|
|
888
|
+
return { promise: new Promise((n2, r2) => {
|
|
889
|
+
e6 = n2, t2 = r2;
|
|
890
|
+
}), resolve: e6, reject: t2 };
|
|
891
|
+
}
|
|
892
|
+
var vn = () => (typeof window < `u` ? window.commonConfig : void 0) ?? globalThis.commonConfig;
|
|
893
|
+
var yn = (e6) => vn()?.[e6];
|
|
894
|
+
var bn = ({ createHost: e6 }) => ({ __type: `host`, create: (e7) => ({}), host: (t2) => {
|
|
895
|
+
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e6(t2), o2 = Sn();
|
|
896
|
+
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language: yn(`language`), locale: yn(`locale`), get passThroughHeaders() {
|
|
897
|
+
return gn();
|
|
898
|
+
} } };
|
|
899
|
+
}, auth: (e7) => {
|
|
900
|
+
let t2 = typeof window < `u` ? window.wixEmbedsAPI : void 0;
|
|
901
|
+
!e7 && xn() && (e7 = t2?.getAccessTokenFunction?.());
|
|
902
|
+
let n2 = false, { resolve: r2, promise: i2 } = _n();
|
|
903
|
+
return { getAuthHeaders: async () => {
|
|
904
|
+
if (!e7 && n2 && (e7 = await i2), !e7) throw Error(`Failed to resolve auth token`);
|
|
905
|
+
return { headers: { Authorization: await e7() } };
|
|
906
|
+
}, getAccessTokenInjector: () => (n2 = true, (e8) => {
|
|
907
|
+
r2(e8);
|
|
908
|
+
}) };
|
|
909
|
+
} });
|
|
910
|
+
function xn() {
|
|
911
|
+
return typeof document < `u` && document.currentScript?.tagName === `SCRIPT`;
|
|
912
|
+
}
|
|
913
|
+
function Sn() {
|
|
914
|
+
let e6 = (typeof window < `u` ? window.wixEmbedsAPI : void 0)?.getExternalBaseUrl?.();
|
|
915
|
+
if (!e6) return;
|
|
916
|
+
let t2 = new URL(e6);
|
|
917
|
+
return t2?.pathname && t2.pathname !== `/` ? `${t2.hostname}${t2.pathname}` : t2.hostname;
|
|
918
|
+
}
|
|
919
|
+
var Cn = ({ clientSdk: e6, applicationId: t2 }) => ({ invoke: async ({ namespace: n2, method: r2, args: i2 }) => {
|
|
920
|
+
if (!e6) throw Error(`Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction`);
|
|
921
|
+
return e6.invoke({ namespace: n2, method: r2, args: i2, applicationId: t2, accessToken: `accessToken` });
|
|
922
|
+
}, getAccessToken: () => {
|
|
923
|
+
throw Error(`Not implemented`);
|
|
924
|
+
}, observeState: () => ({ disconnect: () => {
|
|
925
|
+
} }) });
|
|
926
|
+
var wn = bn({ createHost: function(e6) {
|
|
927
|
+
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ?? e6?.clientSdk ?? (typeof window < `u` ? window?.clientSdk : void 0), { applicationId: n2 } = e6 || {};
|
|
928
|
+
if (!n2) throw Error(`"createHost" was called without a required field "applicationId"`);
|
|
929
|
+
return { channel: Cn({ clientSdk: t2, applicationId: n2 }), close: () => {
|
|
930
|
+
} };
|
|
931
|
+
} });
|
|
932
|
+
var Tn = (e6, t2) => {
|
|
933
|
+
let n2 = wn.host({ applicationId: e6, componentId: t2 }), r2 = wn.auth();
|
|
934
|
+
return Ue({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
|
|
935
|
+
};
|
|
936
|
+
var En = (e6) => Tn(`14bcded7-0066-7c35-14d7-466cb3f09103`, e6);
|
|
937
|
+
var Dn = { post: `post`, feed: `feed`, relatedPosts: `related-posts`, comments: `comments`, seo: `seo`, likes: `likes` };
|
|
938
|
+
var On = (e6, t2) => e6 && typeof e6[t2] == `function` ? e6 : null;
|
|
939
|
+
function kn(e6, t2, { feature: n2, action: r2, level: i2 = `error`, contexts: a2 }) {
|
|
940
|
+
let o2 = On(e6, `captureException`);
|
|
941
|
+
if (!o2) return;
|
|
942
|
+
let s2 = t2 instanceof Error ? t2 : Error(String(t2));
|
|
943
|
+
o2.captureException(s2, { level: i2, tags: { feature: n2, action: r2 }, ...a2 ? { contexts: a2 } : {} });
|
|
944
|
+
}
|
|
945
|
+
function An(e6) {
|
|
946
|
+
return Object.keys(e6).length === 1 && `$and` in e6 && Array.isArray(e6.$and);
|
|
947
|
+
}
|
|
948
|
+
function jn(e6) {
|
|
949
|
+
return Object.keys(e6).length === 1 && `$or` in e6 && Array.isArray(e6.$or);
|
|
950
|
+
}
|
|
951
|
+
function Mn(e6) {
|
|
952
|
+
return Object.keys(e6).length === 1 && `$not` in e6 && typeof e6.$not == `object`;
|
|
953
|
+
}
|
|
954
|
+
function P(e6, t2) {
|
|
955
|
+
return e6 === void 0 || Object.keys(e6).length === 0 ? t2 : t2 === void 0 || Object.keys(t2).length === 0 ? e6 : { $and: [...An(e6) ? e6.$and : [e6], ...An(t2) ? t2.$and : [t2]] };
|
|
956
|
+
}
|
|
957
|
+
function Nn(e6, t2) {
|
|
958
|
+
return e6 === void 0 || Object.keys(e6).length === 0 ? t2 : t2 === void 0 || Object.keys(t2).length === 0 ? e6 : { $or: [...jn(e6) ? e6.$or : [e6], ...jn(t2) ? t2.$or : [t2]] };
|
|
959
|
+
}
|
|
960
|
+
function Pn(e6) {
|
|
961
|
+
if (e6 !== void 0 && Object.keys(e6).length !== 0) return Mn(e6) ? e6.$not : { $not: e6 };
|
|
962
|
+
}
|
|
963
|
+
var Fn = class {
|
|
964
|
+
_items;
|
|
965
|
+
_fetchNextPage;
|
|
966
|
+
_fetchPrevPage;
|
|
967
|
+
_originQuery;
|
|
968
|
+
_limit;
|
|
969
|
+
constructor({ items: e6, originQuery: t2, fetchNextPage: n2, fetchPrevPage: r2, limit: i2 }) {
|
|
970
|
+
this._items = e6, this._fetchNextPage = n2, this._fetchPrevPage = r2, this._originQuery = t2, this._limit = i2;
|
|
971
|
+
}
|
|
972
|
+
get items() {
|
|
973
|
+
return this._items;
|
|
974
|
+
}
|
|
975
|
+
get length() {
|
|
976
|
+
return this._items.length;
|
|
977
|
+
}
|
|
978
|
+
get pageSize() {
|
|
979
|
+
return this._limit;
|
|
980
|
+
}
|
|
981
|
+
get query() {
|
|
982
|
+
return this._originQuery;
|
|
983
|
+
}
|
|
984
|
+
async next() {
|
|
985
|
+
if (!this.hasNext()) throw Error(`No next page to fetch`);
|
|
986
|
+
return await this._fetchNextPage();
|
|
987
|
+
}
|
|
988
|
+
async prev() {
|
|
989
|
+
if (!this.hasPrev()) throw Error(`No previous page to fetch`);
|
|
990
|
+
return await this._fetchPrevPage();
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
var In = class extends Fn {
|
|
994
|
+
_nextCursor;
|
|
995
|
+
_prevCursor;
|
|
996
|
+
cursors;
|
|
997
|
+
constructor({ items: e6, originQuery: t2, fetchNextPage: n2, fetchPrevPage: r2, limit: i2, nextCursor: a2, prevCursor: o2 }) {
|
|
998
|
+
super({ items: e6, originQuery: t2, fetchNextPage: n2, fetchPrevPage: r2, limit: i2 }), this._nextCursor = a2, this._prevCursor = o2, this.cursors = { next: a2, prev: o2 };
|
|
999
|
+
}
|
|
1000
|
+
hasNext() {
|
|
1001
|
+
return !!this._nextCursor;
|
|
1002
|
+
}
|
|
1003
|
+
hasPrev() {
|
|
1004
|
+
return !!this._prevCursor;
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
1007
|
+
var Ln = class extends Fn {
|
|
1008
|
+
_totalCount;
|
|
1009
|
+
_offset;
|
|
1010
|
+
_tooManyToCount;
|
|
1011
|
+
constructor({ items: e6, fetchNextPage: t2, fetchPrevPage: n2, offset: r2, originQuery: i2, limit: a2, totalCount: o2, tooManyToCount: s2 }) {
|
|
1012
|
+
super({ items: e6, fetchNextPage: t2, fetchPrevPage: n2, originQuery: i2, limit: a2 }), this._totalCount = o2, this._offset = r2, this._tooManyToCount = s2;
|
|
1013
|
+
}
|
|
1014
|
+
get currentPage() {
|
|
1015
|
+
return this._limit === 0 ? void 0 : Math.floor(this._offset / this._limit);
|
|
1016
|
+
}
|
|
1017
|
+
get totalPages() {
|
|
1018
|
+
return this._tooManyToCount || this._limit === 0 ? void 0 : Math.ceil(this._totalCount / this._limit);
|
|
1019
|
+
}
|
|
1020
|
+
get totalCount() {
|
|
1021
|
+
return this._tooManyToCount ? void 0 : this._totalCount;
|
|
1022
|
+
}
|
|
1023
|
+
hasNext() {
|
|
1024
|
+
return this._limit !== 0 && this.currentPage !== void 0 && this.totalPages !== void 0 && this.currentPage < this.totalPages - 1;
|
|
1025
|
+
}
|
|
1026
|
+
hasPrev() {
|
|
1027
|
+
return !!(this._limit !== 0 && this.currentPage && this.currentPage > 0);
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
function Rn(e6) {
|
|
1031
|
+
let t2 = (n2) => ({ query: n2, async find() {
|
|
1032
|
+
try {
|
|
1033
|
+
let r2 = e6.requestTransformer(e6.pagingMethod === `CURSOR` && n2.cursorPaging.cursor ? { cursorPaging: n2.cursorPaging } : n2), i2 = await e6.func(r2), { [qe]: a2, [Je]: o2 } = e6.responseTransformer(i2);
|
|
1034
|
+
if (e6.pagingMethod === `OFFSET`) {
|
|
1035
|
+
let e7 = n2;
|
|
1036
|
+
return new Ln({ items: a2 ?? [], fetchNextPage: () => t2({ ...e7, paging: { offset: e7.paging.offset + e7.paging.limit, limit: e7.paging.limit } }).find(), fetchPrevPage: () => t2({ ...n2, paging: { offset: Math.max(e7.paging.offset - e7.paging.limit, 0), limit: e7.paging.limit } }).find(), offset: e7.paging.offset, limit: e7.paging.limit, totalCount: o2?.total, tooManyToCount: o2?.tooManyToCount, originQuery: this });
|
|
1037
|
+
}
|
|
1038
|
+
let s2 = n2.cursorPaging;
|
|
1039
|
+
return new In({ items: a2 ?? [], limit: s2.limit, originQuery: this, fetchNextPage: () => t2({ ...n2, cursorPaging: { cursor: o2?.cursors?.next ?? void 0, limit: s2.limit } }).find(), fetchPrevPage: () => t2({ ...n2, cursorPaging: { cursor: o2?.cursors?.prev ?? void 0, limit: s2.limit } }).find(), prevCursor: o2?.cursors?.prev ?? void 0, nextCursor: o2?.cursors?.next ?? void 0 });
|
|
1040
|
+
} catch (t3) {
|
|
1041
|
+
throw e6.errorTransformer(t3);
|
|
1042
|
+
}
|
|
1043
|
+
}, skipTo(e7) {
|
|
1044
|
+
return t2({ ...n2, cursorPaging: { cursor: e7, limit: n2.cursorPaging.limit } });
|
|
1045
|
+
}, eq(r2, i2) {
|
|
1046
|
+
let a2 = i2 === void 0 ? null : i2, o2 = { [F(e6.transformationPaths, r2)]: a2 };
|
|
1047
|
+
return t2({ ...n2, filter: P(n2.filter, o2) });
|
|
1048
|
+
}, ne(r2, i2) {
|
|
1049
|
+
let a2 = i2 === void 0 ? null : i2, o2 = { [F(e6.transformationPaths, r2)]: { $ne: a2 } };
|
|
1050
|
+
return t2({ ...n2, filter: P(n2.filter, o2) });
|
|
1051
|
+
}, ge(r2, i2) {
|
|
1052
|
+
let a2 = { [F(e6.transformationPaths, r2)]: { $gte: i2 } };
|
|
1053
|
+
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1054
|
+
}, gt(r2, i2) {
|
|
1055
|
+
let a2 = { [F(e6.transformationPaths, r2)]: { $gt: i2 } };
|
|
1056
|
+
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1057
|
+
}, le(r2, i2) {
|
|
1058
|
+
let a2 = { [F(e6.transformationPaths, r2)]: { $lte: i2 } };
|
|
1059
|
+
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1060
|
+
}, lt(r2, i2) {
|
|
1061
|
+
let a2 = { [F(e6.transformationPaths, r2)]: { $lt: i2 } };
|
|
1062
|
+
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1063
|
+
}, isNotEmpty(e7) {
|
|
1064
|
+
return this.ne(e7, null);
|
|
1065
|
+
}, isEmpty(e7) {
|
|
1066
|
+
return this.eq(e7, null);
|
|
1067
|
+
}, startsWith(r2, i2) {
|
|
1068
|
+
let a2 = { [F(e6.transformationPaths, r2)]: { $startsWith: i2 } };
|
|
1069
|
+
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1070
|
+
}, endsWith(r2, i2) {
|
|
1071
|
+
let a2 = { [F(e6.transformationPaths, r2)]: { $endsWith: i2 } };
|
|
1072
|
+
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1073
|
+
}, contains(r2, i2) {
|
|
1074
|
+
let a2 = { [F(e6.transformationPaths, r2)]: { $contains: i2 } };
|
|
1075
|
+
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1076
|
+
}, hasSome(r2, ...i2) {
|
|
1077
|
+
let a2 = { [F(e6.transformationPaths, r2)]: { $hasSome: Array.isArray(i2[0]) ? i2[0] : i2 } };
|
|
1078
|
+
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1079
|
+
}, hasAll(r2, ...i2) {
|
|
1080
|
+
let a2 = { [F(e6.transformationPaths, r2)]: { $hasAll: Array.isArray(i2[0]) ? i2[0] : i2 } };
|
|
1081
|
+
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1082
|
+
}, between(e7, t3, n3) {
|
|
1083
|
+
return this.ge(e7, t3).lt(e7, n3);
|
|
1084
|
+
}, in(r2, i2) {
|
|
1085
|
+
let a2 = { [F(e6.transformationPaths, r2)]: { $in: i2 } };
|
|
1086
|
+
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1087
|
+
}, exists(r2, i2 = true) {
|
|
1088
|
+
let a2 = { [F(e6.transformationPaths, r2)]: { $exists: i2 } };
|
|
1089
|
+
return t2({ ...n2, filter: P(n2.filter, a2) });
|
|
1090
|
+
}, or(e7) {
|
|
1091
|
+
return t2({ ...n2, filter: Nn(n2.filter, e7.query.filter) });
|
|
1092
|
+
}, and(e7) {
|
|
1093
|
+
return t2({ ...n2, filter: P(n2.filter, e7.query.filter) });
|
|
1094
|
+
}, not(e7) {
|
|
1095
|
+
return t2({ ...n2, filter: Pn(e7.query.filter) });
|
|
1096
|
+
}, ascending(...r2) {
|
|
1097
|
+
return t2({ ...n2, sort: [...n2.sort ?? [], ...r2.map((t3) => ({ fieldName: F(e6.transformationPaths, t3), order: `ASC` }))] });
|
|
1098
|
+
}, descending(...r2) {
|
|
1099
|
+
return t2({ ...n2, sort: [...n2.sort ?? [], ...r2.map((t3) => ({ fieldName: F(e6.transformationPaths, t3), order: `DESC` }))] });
|
|
1100
|
+
}, skip(e7) {
|
|
1101
|
+
return t2({ ...n2, paging: { offset: e7, limit: `limit` in n2.paging ? n2.paging.limit : 50 } });
|
|
1102
|
+
}, limit(r2) {
|
|
1103
|
+
if (e6.pagingMethod === `CURSOR`) {
|
|
1104
|
+
let e7 = n2;
|
|
1105
|
+
return t2({ ...n2, cursorPaging: { limit: r2, cursor: `cursor` in e7.cursorPaging ? e7.cursorPaging.cursor : void 0 } });
|
|
1106
|
+
}
|
|
1107
|
+
let i2 = n2;
|
|
1108
|
+
return t2({ ...n2, paging: { limit: r2, offset: `offset` in i2.paging ? i2.paging.offset : 0 } });
|
|
1109
|
+
} });
|
|
1110
|
+
return t2({ filter: {}, ...e6.pagingMethod === `OFFSET` ? { paging: { offset: 0, limit: 50 } } : { cursorPaging: { limit: 50 } } });
|
|
1111
|
+
}
|
|
1112
|
+
function F(e6, t2) {
|
|
1113
|
+
let n2 = Object.entries(e6).find(([e7]) => e7 === t2 || t2.startsWith(`${e7}.`))?.[0];
|
|
1114
|
+
return n2 ? t2.replace(n2, e6[n2]) : Xe(t2, { ...e6, ...Ye });
|
|
1115
|
+
}
|
|
1116
|
+
var zn = `filter`;
|
|
1117
|
+
var Bn = `sort`;
|
|
1118
|
+
var Vn = `cursorPaging`;
|
|
1119
|
+
var Hn = `paging`;
|
|
1120
|
+
var Un = [zn, Bn, Vn];
|
|
1121
|
+
var Wn = [zn, Bn, Hn];
|
|
1122
|
+
function Gn(e6, t2) {
|
|
1123
|
+
return !e6 || typeof e6 != `object` ? false : t2.some((t3) => e6.hasOwnProperty(t3));
|
|
1124
|
+
}
|
|
1125
|
+
function Kn(e6) {
|
|
1126
|
+
return Gn(e6, Un);
|
|
1127
|
+
}
|
|
1128
|
+
function qn(e6) {
|
|
1129
|
+
return Gn(e6, Wn);
|
|
1130
|
+
}
|
|
1131
|
+
function Jn(e6) {
|
|
1132
|
+
let { hasOptionsParameter: t2 } = e6;
|
|
1133
|
+
return function(...n2) {
|
|
1134
|
+
return t2 ? Xn(n2, e6) : Yn(n2, e6);
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
function Yn(e6, t2) {
|
|
1138
|
+
return e6.length === 0 ? t2.builderQueryFunction() : t2.typedQueryFunction(e6[0]);
|
|
1139
|
+
}
|
|
1140
|
+
function Xn(e6, t2) {
|
|
1141
|
+
switch (e6.length) {
|
|
1142
|
+
case 0:
|
|
1143
|
+
return t2.builderQueryFunction();
|
|
1144
|
+
case 1:
|
|
1145
|
+
return Kn(e6[0]) || qn(e6[0]) ? t2.typedQueryFunction(e6[0]) : t2.builderQueryFunction(e6[0]);
|
|
1146
|
+
default:
|
|
1147
|
+
return t2.typedQueryFunction(e6[0], e6[1]);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
var Zn = [{ path: `like.createdDate` }];
|
|
1151
|
+
var Qn = [{ path: `likes.createdDate` }];
|
|
1152
|
+
function $n(e6) {
|
|
1153
|
+
return Nt(Object.assign(e6, { domainToMappings: { _: [{ srcPath: `/_api/blog-like-service`, destPath: `` }], "api._api_base_domain_": [{ srcPath: `/blog-like-service`, destPath: `` }], "social-blog._base_domain_": [{ srcPath: `/_api/blog-like-service`, destPath: `` }], "manage._base_domain_": [{ srcPath: `/_api/blog-like-service`, destPath: `` }], "apps._base_domain_": [{ srcPath: `/_api/blog-like-service`, destPath: `` }], "www.wixapis.com": [{ srcPath: `/blog/v1/likes`, destPath: `/v1/likes` }], "*.dev.wix-code.com": [{ srcPath: `/blog/v1/likes`, destPath: `/v1/likes` }] } }));
|
|
1154
|
+
}
|
|
1155
|
+
var er = `@wix/auto_sdk_blog_likes`;
|
|
1156
|
+
function tr(e6) {
|
|
1157
|
+
function t2({ host: t3 }) {
|
|
1158
|
+
let n2 = j(e6, [{ transformFn: tt, paths: Zn }]);
|
|
1159
|
+
return { entityFqdn: `wix.blog.v1.like`, method: `POST`, methodFqn: `wix.blog.v1.LikeService.CreateLike`, packageName: er, migrationOptions: { optInTransformResponse: true }, url: $n({ protoPath: `/v1/likes`, data: n2, host: t3 }), data: n2, transformResponse: (e7) => j(e7, [{ transformFn: nt, paths: Zn }]) };
|
|
1160
|
+
}
|
|
1161
|
+
return t2;
|
|
1162
|
+
}
|
|
1163
|
+
function nr(e6) {
|
|
1164
|
+
function t2({ host: t3 }) {
|
|
1165
|
+
return { entityFqdn: `wix.blog.v1.like`, method: `POST`, methodFqn: `wix.blog.v1.LikeService.QueryLikes`, packageName: er, migrationOptions: { optInTransformResponse: true }, url: $n({ protoPath: `/v1/likes/query`, data: e6, host: t3 }), data: e6, transformResponse: (e7) => j(e7, [{ transformFn: nt, paths: Qn }]) };
|
|
1166
|
+
}
|
|
1167
|
+
return t2;
|
|
1168
|
+
}
|
|
1169
|
+
function rr(e6) {
|
|
1170
|
+
function t2({ host: t3 }) {
|
|
1171
|
+
return { entityFqdn: `wix.blog.v1.like`, method: `DELETE`, methodFqn: `wix.blog.v1.LikeService.DeleteLikeByFqdnAndEntityId`, packageName: er, migrationOptions: { optInTransformResponse: true }, url: $n({ protoPath: `/v1/likes/fqdn/{fqdn}/entity-id/{entityId}`, data: e6, host: t3 }), params: Mt(e6) };
|
|
1172
|
+
}
|
|
1173
|
+
return t2;
|
|
1174
|
+
}
|
|
1175
|
+
async function ir(e6) {
|
|
1176
|
+
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = tr(D({ like: e6?.like }));
|
|
1177
|
+
n2?.onSiteCall?.();
|
|
1178
|
+
try {
|
|
1179
|
+
let e7 = await t2.request(r2);
|
|
1180
|
+
return n2?.onSuccess?.(e7), O(e7.data)?.like;
|
|
1181
|
+
} catch (e7) {
|
|
1182
|
+
let t3 = M(e7, { spreadPathsToArguments: {}, explicitPathsToArguments: { like: `$[0].like` }, singleArgumentUnchanged: false }, [`options`]);
|
|
1183
|
+
throw n2?.onError?.(e7), t3;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
function ar() {
|
|
1187
|
+
let { httpClient: e6, sideEffects: t2 } = arguments[0];
|
|
1188
|
+
return Rn({ func: async (n2) => {
|
|
1189
|
+
let r2 = nr(n2);
|
|
1190
|
+
t2?.onSiteCall?.();
|
|
1191
|
+
try {
|
|
1192
|
+
let n3 = await e6.request(r2);
|
|
1193
|
+
return t2?.onSuccess?.(n3), n3;
|
|
1194
|
+
} catch (e7) {
|
|
1195
|
+
throw t2?.onError?.(e7), e7;
|
|
1196
|
+
}
|
|
1197
|
+
}, requestTransformer: (e7) => {
|
|
1198
|
+
let t3 = [e7, {}];
|
|
1199
|
+
return D({ ...t3?.[1], query: t3?.[0] });
|
|
1200
|
+
}, responseTransformer: ({ data: e7 }) => {
|
|
1201
|
+
let t3 = O(j(e7, []));
|
|
1202
|
+
return { items: t3?.likes, pagingMetadata: t3?.pagingMetadata };
|
|
1203
|
+
}, errorTransformer: (e7) => {
|
|
1204
|
+
throw M(e7, { spreadPathsToArguments: {}, explicitPathsToArguments: { query: `$[0]` }, singleArgumentUnchanged: false });
|
|
1205
|
+
}, pagingMethod: `CURSOR`, transformationPaths: {} });
|
|
1206
|
+
}
|
|
1207
|
+
async function or(e6) {
|
|
1208
|
+
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = nr(D({ query: e6 }));
|
|
1209
|
+
n2?.onSiteCall?.();
|
|
1210
|
+
try {
|
|
1211
|
+
let e7 = await t2.request(r2);
|
|
1212
|
+
return n2?.onSuccess?.(e7), O(e7.data);
|
|
1213
|
+
} catch (e7) {
|
|
1214
|
+
let t3 = M(e7, { spreadPathsToArguments: {}, explicitPathsToArguments: { query: `$[0]` }, singleArgumentUnchanged: false }, [`query`]);
|
|
1215
|
+
throw n2?.onError?.(e7), t3;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
async function sr(e6) {
|
|
1219
|
+
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = rr(D({ fqdn: e6?.fqdn, entityId: e6?.entityId }));
|
|
1220
|
+
n2?.onSiteCall?.();
|
|
1221
|
+
try {
|
|
1222
|
+
let e7 = await t2.request(r2);
|
|
1223
|
+
n2?.onSuccess?.(e7);
|
|
1224
|
+
} catch (e7) {
|
|
1225
|
+
let t3 = M(e7, { spreadPathsToArguments: {}, explicitPathsToArguments: { fqdn: `$[0].fqdn`, entityId: `$[0].entityId` }, singleArgumentUnchanged: false }, [`identifiers`]);
|
|
1226
|
+
throw n2?.onError?.(e7), t3;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
function cr(e6) {
|
|
1230
|
+
return (t2) => ir(t2, { httpClient: e6 });
|
|
1231
|
+
}
|
|
1232
|
+
function lr(e6) {
|
|
1233
|
+
return () => ar({ httpClient: e6 });
|
|
1234
|
+
}
|
|
1235
|
+
function ur(e6) {
|
|
1236
|
+
return (t2) => or(t2, { httpClient: e6 });
|
|
1237
|
+
}
|
|
1238
|
+
function dr(e6) {
|
|
1239
|
+
return (t2) => sr(t2, { httpClient: e6 });
|
|
1240
|
+
}
|
|
1241
|
+
function fr(e6) {
|
|
1242
|
+
let t2 = Jn({ builderQueryFunction: () => lr(e6)(), typedQueryFunction: (t3) => ur(e6)(t3), hasOptionsParameter: false });
|
|
1243
|
+
function n2(e7) {
|
|
1244
|
+
return t2(...arguments);
|
|
1245
|
+
}
|
|
1246
|
+
return n2;
|
|
1247
|
+
}
|
|
1248
|
+
var pr = jt(cr);
|
|
1249
|
+
var mr = jt(dr);
|
|
1250
|
+
var hr = jt(fr);
|
|
1251
|
+
var gr = [{ path: `metrics.averageRating` }];
|
|
1252
|
+
function _r(e6) {
|
|
1253
|
+
return Nt(Object.assign(e6, { domainToMappings: { _: [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "apps._base_domain_": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "www._base_domain_": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "www.wixapis.com": [{ srcPath: `/v3/posts`, destPath: `/v3/posts` }, { srcPath: `/blog/v3/posts`, destPath: `/v3/posts` }, { srcPath: `/_api/v3/posts`, destPath: `/v3/posts` }], "manage._base_domain_": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }, { srcPath: `/_api/post-service-api-proxy/v3/bulk/posts`, destPath: `/v3/bulk/posts` }], "*.dev.wix-code.com": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "editor._base_domain_": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "blocks._base_domain_": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "create.editorx": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "editor.wixapps.net": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }], "dev._base_domain_": [{ srcPath: `/_api/communities-blog-node-api/v3/posts`, destPath: `/v3/posts` }] } }));
|
|
1254
|
+
}
|
|
1255
|
+
var vr = `@wix/auto_sdk_blog_posts`;
|
|
1256
|
+
function yr(e6) {
|
|
1257
|
+
function t2({ host: t3 }) {
|
|
1258
|
+
return { entityFqdn: `wix.blog.v3.post`, method: `GET`, methodFqn: `com.wixpress.npm.communities.platformized.blog.v3.PostService.GetPostMetrics`, packageName: vr, migrationOptions: { optInTransformResponse: true }, url: _r({ protoPath: `/v3/posts/{postId}/metrics`, data: e6, host: t3 }), params: Mt(e6), transformResponse: (e7) => j(e7, [{ transformFn: on, paths: gr }]) };
|
|
1259
|
+
}
|
|
1260
|
+
return t2;
|
|
1261
|
+
}
|
|
1262
|
+
async function br(e6) {
|
|
1263
|
+
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = yr(D({ postId: e6 }, []));
|
|
1264
|
+
n2?.onSiteCall?.();
|
|
1265
|
+
try {
|
|
1266
|
+
let e7 = await t2.request(r2);
|
|
1267
|
+
return n2?.onSuccess?.(e7), O(e7.data, []);
|
|
1268
|
+
} catch (e7) {
|
|
1269
|
+
let t3 = M(e7, { spreadPathsToArguments: {}, explicitPathsToArguments: { postId: `$[0]` }, singleArgumentUnchanged: false }, [`postId`]);
|
|
1270
|
+
throw n2?.onError?.(e7), t3;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
function xr(e6) {
|
|
1274
|
+
return (t2) => br(t2, { httpClient: e6 });
|
|
1275
|
+
}
|
|
1276
|
+
var Sr = jt(xr);
|
|
1277
|
+
var Cr = `wix.blog.v3.post`;
|
|
1278
|
+
var wr = async (e6) => {
|
|
1279
|
+
await pr({ like: { entityId: e6, fqdn: Cr } });
|
|
1280
|
+
};
|
|
1281
|
+
var Tr = async (e6) => {
|
|
1282
|
+
await mr({ fqdn: Cr, entityId: e6 });
|
|
1283
|
+
};
|
|
1284
|
+
var Er = (e6) => typeof e6 == `number` ? e6 : void 0;
|
|
1285
|
+
var Dr = async (e6) => {
|
|
1286
|
+
let [t2, n2] = await Promise.allSettled([hr().eq(`fqdn`, Cr).eq(`entityId`, e6).limit(1).find(), Sr(e6)]), r2 = n2.status === `fulfilled` ? n2.value.metrics : void 0;
|
|
1287
|
+
return { liked: t2.status === `fulfilled` && t2.value.items.length > 0, likeCount: Er(r2?.likes), viewCount: Er(r2?.views), commentCount: Er(r2?.comments) };
|
|
1288
|
+
};
|
|
1289
|
+
function I(e6) {
|
|
1290
|
+
return e6;
|
|
1291
|
+
}
|
|
1292
|
+
var Or = I(`@wix/site-service-editor-context`);
|
|
1293
|
+
var kr = () => {
|
|
1294
|
+
try {
|
|
1295
|
+
return !!(0, import_services_manager_react.useService)(Or).previewMode;
|
|
1296
|
+
} catch {
|
|
1297
|
+
return false;
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
var Ar = I(`@wix/viewer-service-site-members`);
|
|
1301
|
+
var jr = () => {
|
|
1302
|
+
try {
|
|
1303
|
+
return (0, import_services_manager_react.useService)(Ar);
|
|
1304
|
+
} catch {
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
var Mr = { liked: false, baselineLiked: false, freshLikeCount: void 0, viewCount: void 0, commentCount: void 0, isLikeCountLoaded: false };
|
|
1309
|
+
var L = `wix-blog:post-like-toggled`;
|
|
1310
|
+
var Nr = () => {
|
|
1311
|
+
let e6 = window;
|
|
1312
|
+
return e6[L] ??= /* @__PURE__ */ new Map();
|
|
1313
|
+
};
|
|
1314
|
+
var Pr = (e6) => {
|
|
1315
|
+
Nr().set(e6.postId, e6.liked), window.dispatchEvent(new CustomEvent(L, { detail: e6 }));
|
|
1316
|
+
};
|
|
1317
|
+
var Fr = (e6, t2) => ({ isLiked: e6.liked, likeCount: Math.max(0, (e6.freshLikeCount ?? t2) + Number(e6.liked) - Number(e6.baselineLiked)), isLikeCountLoaded: e6.isLikeCountLoaded, viewCount: e6.viewCount, commentCount: e6.commentCount });
|
|
1318
|
+
var Ir = (e6, t2, i2 = false, l2) => {
|
|
1319
|
+
let u2 = kr() || i2, [d2, f2] = (0, import_react.useState)(Mr), p2 = (0, import_react.useRef)(Mr), m2 = (0, import_react.useRef)(t2), h2 = (0, import_react.useRef)(/* @__PURE__ */ new Set()), g2 = (0, import_react.useRef)(false), _2 = (0, import_react.useRef)(false), v2 = (0, import_react.useRef)(void 0), y2 = jr(), [b2, x2] = (0, import_react.useState)(0);
|
|
1320
|
+
(0, import_react.useEffect)(() => {
|
|
1321
|
+
let e7 = y2?.addMemberLoginListener?.(() => {
|
|
1322
|
+
Nr().clear(), x2((e8) => e8 + 1);
|
|
1323
|
+
});
|
|
1324
|
+
return () => {
|
|
1325
|
+
e7 !== void 0 && y2?.removeMemberLoginListener?.(e7);
|
|
1326
|
+
};
|
|
1327
|
+
}, [y2]);
|
|
1328
|
+
let S2 = (0, import_react.useCallback)((e7) => {
|
|
1329
|
+
let t3 = p2.current, r2 = { ...t3, ...e7 };
|
|
1330
|
+
Object.keys(r2).every((e8) => r2[e8] === t3[e8]) || (p2.current = r2, h2.current.forEach((e8) => e8()), (0, import_react.startTransition)(() => f2(r2)));
|
|
1331
|
+
}, []), C2 = (0, import_react.useMemo)(() => ({ get: () => Fr(p2.current, m2.current), subscribe: (e7) => (h2.current.add(e7), () => {
|
|
1332
|
+
h2.current.delete(e7);
|
|
1333
|
+
}) }), []);
|
|
1334
|
+
(0, import_react.useEffect)(() => {
|
|
1335
|
+
m2.current !== t2 && (m2.current = t2, h2.current.forEach((e7) => e7()));
|
|
1336
|
+
}, [t2]), (0, import_react.useEffect)(() => {
|
|
1337
|
+
if (v2.current !== e6 && (v2.current = e6, S2(Mr)), _2.current = false, !e6 || u2) {
|
|
1338
|
+
S2({ isLikeCountLoaded: true });
|
|
1339
|
+
return;
|
|
1340
|
+
}
|
|
1341
|
+
let t3 = false;
|
|
1342
|
+
return Dr(e6).then(({ liked: e7, likeCount: n2, viewCount: r2, commentCount: i3 }) => {
|
|
1343
|
+
t3 || S2({ isLikeCountLoaded: true, viewCount: r2, commentCount: i3, baselineLiked: e7, freshLikeCount: n2, ...!_2.current && { liked: e7 } });
|
|
1344
|
+
}).catch((n2) => {
|
|
1345
|
+
t3 || S2({ isLikeCountLoaded: true }), kn(l2, n2, { feature: Dn.likes, action: `read-like-state`, level: `warning`, contexts: { likes: { postId: e6 } } });
|
|
1346
|
+
}), () => {
|
|
1347
|
+
t3 = true;
|
|
1348
|
+
};
|
|
1349
|
+
}, [e6, u2, l2, S2, b2]), (0, import_react.useEffect)(() => {
|
|
1350
|
+
if (!e6) return;
|
|
1351
|
+
let t3 = (e7) => {
|
|
1352
|
+
_2.current = true, S2({ liked: e7 });
|
|
1353
|
+
}, n2 = Nr().get(e6);
|
|
1354
|
+
n2 !== void 0 && t3(n2);
|
|
1355
|
+
let r2 = (n3) => {
|
|
1356
|
+
let { detail: r3 } = n3;
|
|
1357
|
+
r3.postId === e6 && t3(r3.liked);
|
|
1358
|
+
};
|
|
1359
|
+
return window.addEventListener(L, r2), () => window.removeEventListener(L, r2);
|
|
1360
|
+
}, [e6, S2]);
|
|
1361
|
+
let ee2 = (0, import_react.useCallback)(async (t3) => {
|
|
1362
|
+
if (!e6 || g2.current) return;
|
|
1363
|
+
_2.current = true;
|
|
1364
|
+
let n2 = !p2.current.liked;
|
|
1365
|
+
if (S2({ liked: n2 }), Pr({ postId: e6, liked: n2 }), !u2) {
|
|
1366
|
+
g2.current = true;
|
|
1367
|
+
try {
|
|
1368
|
+
await (n2 ? wr(e6) : Tr(e6));
|
|
1369
|
+
} catch (t4) {
|
|
1370
|
+
S2({ liked: !n2 }), Pr({ postId: e6, liked: !n2 }), kn(l2, t4, { feature: Dn.likes, action: n2 ? `like-post` : `unlike-post`, contexts: { likes: { postId: e6 } } });
|
|
1371
|
+
} finally {
|
|
1372
|
+
g2.current = false;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
}, [e6, u2, l2, S2]);
|
|
1376
|
+
return { ...Fr(d2, t2), toggleLike: ee2, liveLikes: C2 };
|
|
1377
|
+
};
|
|
1378
|
+
var Lr = I(`@wix/site-service-locale`);
|
|
1379
|
+
var Rr = () => {
|
|
1380
|
+
try {
|
|
1381
|
+
let { locale: e6, language: t2 } = (0, import_services_manager_react.useService)(Lr);
|
|
1382
|
+
return e6 || t2;
|
|
1383
|
+
} catch {
|
|
1384
|
+
return;
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1387
|
+
var zr = () => {
|
|
1388
|
+
let e6 = /* @__PURE__ */ new Map();
|
|
1389
|
+
return { getOrInsert: (t2, n2) => (e6.has(t2) || e6.set(t2, n2().finally(() => {
|
|
1390
|
+
e6.delete(t2);
|
|
1391
|
+
})), e6.get(t2)) };
|
|
1392
|
+
};
|
|
1393
|
+
var Br = async (e6) => {
|
|
1394
|
+
try {
|
|
1395
|
+
let { default: t2 } = await e6();
|
|
1396
|
+
return t2;
|
|
1397
|
+
} catch {
|
|
1398
|
+
return;
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1401
|
+
var Vr = ({ isDev: e6, loadMessages: t2, loadDevMessages: n2 }) => {
|
|
1402
|
+
let r2 = zr(), i2 = async (r3) => {
|
|
1403
|
+
let [i3, a2] = await Promise.all([Br(() => t2(r3)), !e6 || !n2 ? void 0 : Br(() => n2(r3))]);
|
|
1404
|
+
if (i3 && a2) return { ...i3, ...a2 };
|
|
1405
|
+
if (i3) return i3;
|
|
1406
|
+
if (a2) return a2;
|
|
1407
|
+
throw Error(`No translation files found for ${r3}`);
|
|
1408
|
+
};
|
|
1409
|
+
return (e7) => r2.getOrInsert(e7, () => i2(e7));
|
|
1410
|
+
};
|
|
1411
|
+
var R = (e6) => typeof e6 == `string`;
|
|
1412
|
+
var z = () => {
|
|
1413
|
+
let e6, t2, n2 = new Promise((n3, r2) => {
|
|
1414
|
+
e6 = n3, t2 = r2;
|
|
1415
|
+
});
|
|
1416
|
+
return n2.resolve = e6, n2.reject = t2, n2;
|
|
1417
|
+
};
|
|
1418
|
+
var Hr = (e6) => e6 == null ? `` : String(e6);
|
|
1419
|
+
var Ur = (e6, t2, n2) => {
|
|
1420
|
+
e6.forEach((e7) => {
|
|
1421
|
+
t2[e7] && (n2[e7] = t2[e7]);
|
|
1422
|
+
});
|
|
1423
|
+
};
|
|
1424
|
+
var Wr = /###/g;
|
|
1425
|
+
var Gr = (e6) => e6 && e6.includes(`###`) ? e6.replace(Wr, `.`) : e6;
|
|
1426
|
+
var Kr = (e6) => !e6 || R(e6);
|
|
1427
|
+
var B = (e6, t2, n2) => {
|
|
1428
|
+
let r2 = R(t2) ? t2.split(`.`) : t2, i2 = 0;
|
|
1429
|
+
for (; i2 < r2.length - 1; ) {
|
|
1430
|
+
if (Kr(e6)) return {};
|
|
1431
|
+
let t3 = Gr(r2[i2]);
|
|
1432
|
+
!e6[t3] && n2 && (e6[t3] = new n2()), e6 = Object.prototype.hasOwnProperty.call(e6, t3) ? e6[t3] : {}, ++i2;
|
|
1433
|
+
}
|
|
1434
|
+
return Kr(e6) ? {} : { obj: e6, k: Gr(r2[i2]) };
|
|
1435
|
+
};
|
|
1436
|
+
var qr = (e6, t2, n2) => {
|
|
1437
|
+
let { obj: r2, k: i2 } = B(e6, t2, Object);
|
|
1438
|
+
if (r2 !== void 0 || t2.length === 1) {
|
|
1439
|
+
r2[i2] = n2;
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
let a2 = t2[t2.length - 1], o2 = t2.slice(0, t2.length - 1), s2 = B(e6, o2, Object);
|
|
1443
|
+
for (; s2.obj === void 0 && o2.length; ) a2 = `${o2[o2.length - 1]}.${a2}`, o2 = o2.slice(0, o2.length - 1), s2 = B(e6, o2, Object), s2?.obj && s2.obj[`${s2.k}.${a2}`] !== void 0 && (s2.obj = void 0);
|
|
1444
|
+
s2.obj[`${s2.k}.${a2}`] = n2;
|
|
1445
|
+
};
|
|
1446
|
+
var Jr = (e6, t2, n2, r2) => {
|
|
1447
|
+
let { obj: i2, k: a2 } = B(e6, t2, Object);
|
|
1448
|
+
i2[a2] = i2[a2] || [], i2[a2].push(n2);
|
|
1449
|
+
};
|
|
1450
|
+
var V = (e6, t2) => {
|
|
1451
|
+
let { obj: n2, k: r2 } = B(e6, t2);
|
|
1452
|
+
if (n2 && Object.prototype.hasOwnProperty.call(n2, r2)) return n2[r2];
|
|
1453
|
+
};
|
|
1454
|
+
var Yr = (e6, t2, n2) => {
|
|
1455
|
+
let r2 = V(e6, n2);
|
|
1456
|
+
return r2 === void 0 ? V(t2, n2) : r2;
|
|
1457
|
+
};
|
|
1458
|
+
var Xr = (e6, t2, n2) => {
|
|
1459
|
+
for (let r2 in t2) r2 !== `__proto__` && r2 !== `constructor` && (Object.prototype.hasOwnProperty.call(e6, r2) ? R(e6[r2]) || e6[r2] instanceof String || R(t2[r2]) || t2[r2] instanceof String ? n2 && (e6[r2] = t2[r2]) : Xr(e6[r2], t2[r2], n2) : e6[r2] = t2[r2]);
|
|
1460
|
+
return e6;
|
|
1461
|
+
};
|
|
1462
|
+
var H = (e6) => e6.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, `\\$&`);
|
|
1463
|
+
var Zr = { "&": `&`, "<": `<`, ">": `>`, '"': `"`, "'": `'`, "/": `/` };
|
|
1464
|
+
var Qr = (e6) => R(e6) ? e6.replace(/[&<>"'\/]/g, (e7) => Zr[e7]) : e6;
|
|
1465
|
+
var $r = class {
|
|
1466
|
+
constructor(e6) {
|
|
1467
|
+
this.capacity = e6, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
1468
|
+
}
|
|
1469
|
+
getRegExp(e6) {
|
|
1470
|
+
let t2 = this.regExpMap.get(e6);
|
|
1471
|
+
if (t2 !== void 0) return t2;
|
|
1472
|
+
let n2 = new RegExp(e6);
|
|
1473
|
+
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e6, n2), this.regExpQueue.push(e6), n2;
|
|
1474
|
+
}
|
|
1475
|
+
};
|
|
1476
|
+
var ei = [` `, `,`, `?`, `!`, `;`];
|
|
1477
|
+
var ti = new $r(20);
|
|
1478
|
+
var ni = (e6, t2, n2) => {
|
|
1479
|
+
t2 ||= ``, n2 ||= ``;
|
|
1480
|
+
let r2 = ei.filter((e7) => !t2.includes(e7) && !n2.includes(e7));
|
|
1481
|
+
if (r2.length === 0) return true;
|
|
1482
|
+
let i2 = ti.getRegExp(`(${r2.map((e7) => e7 === `?` ? `\\?` : e7).join(`|`)})`), a2 = !i2.test(e6);
|
|
1483
|
+
if (!a2) {
|
|
1484
|
+
let t3 = e6.indexOf(n2);
|
|
1485
|
+
t3 > 0 && !i2.test(e6.substring(0, t3)) && (a2 = true);
|
|
1486
|
+
}
|
|
1487
|
+
return a2;
|
|
1488
|
+
};
|
|
1489
|
+
var ri = (e6, t2, n2 = `.`) => {
|
|
1490
|
+
if (!e6) return;
|
|
1491
|
+
if (e6[t2]) return Object.prototype.hasOwnProperty.call(e6, t2) ? e6[t2] : void 0;
|
|
1492
|
+
let r2 = t2.split(n2), i2 = e6;
|
|
1493
|
+
for (let e7 = 0; e7 < r2.length; ) {
|
|
1494
|
+
if (!i2 || typeof i2 != `object`) return;
|
|
1495
|
+
let t3, a2 = ``;
|
|
1496
|
+
for (let o2 = e7; o2 < r2.length; ++o2) if (o2 !== e7 && (a2 += n2), a2 += r2[o2], t3 = i2[a2], t3 !== void 0) {
|
|
1497
|
+
if ([`string`, `number`, `boolean`].includes(typeof t3) && o2 < r2.length - 1) continue;
|
|
1498
|
+
e7 += o2 - e7 + 1;
|
|
1499
|
+
break;
|
|
1500
|
+
}
|
|
1501
|
+
i2 = t3;
|
|
1502
|
+
}
|
|
1503
|
+
return i2;
|
|
1504
|
+
};
|
|
1505
|
+
var U = (e6) => e6?.replace(/_/g, `-`);
|
|
1506
|
+
var ii = { type: `logger`, log(e6) {
|
|
1507
|
+
this.output(`log`, e6);
|
|
1508
|
+
}, warn(e6) {
|
|
1509
|
+
this.output(`warn`, e6);
|
|
1510
|
+
}, error(e6) {
|
|
1511
|
+
this.output(`error`, e6);
|
|
1512
|
+
}, output(e6, t2) {
|
|
1513
|
+
console?.[e6]?.apply?.(console, t2);
|
|
1514
|
+
} };
|
|
1515
|
+
var W = new class e2 {
|
|
1516
|
+
constructor(e6, t2 = {}) {
|
|
1517
|
+
this.init(e6, t2);
|
|
1518
|
+
}
|
|
1519
|
+
init(e6, t2 = {}) {
|
|
1520
|
+
this.prefix = t2.prefix || `i18next:`, this.logger = e6 || ii, this.options = t2, this.debug = t2.debug;
|
|
1521
|
+
}
|
|
1522
|
+
log(...e6) {
|
|
1523
|
+
return this.forward(e6, `log`, ``, true);
|
|
1524
|
+
}
|
|
1525
|
+
warn(...e6) {
|
|
1526
|
+
return this.forward(e6, `warn`, ``, true);
|
|
1527
|
+
}
|
|
1528
|
+
error(...e6) {
|
|
1529
|
+
return this.forward(e6, `error`, ``);
|
|
1530
|
+
}
|
|
1531
|
+
deprecate(...e6) {
|
|
1532
|
+
return this.forward(e6, `warn`, `WARNING DEPRECATED: `, true);
|
|
1533
|
+
}
|
|
1534
|
+
forward(e6, t2, n2, r2) {
|
|
1535
|
+
return r2 && !this.debug ? null : (e6 = e6.map((e7) => R(e7) ? e7.replace(/[\r\n\x00-\x1F\x7F]/g, ` `) : e7), R(e6[0]) && (e6[0] = `${n2}${this.prefix} ${e6[0]}`), this.logger[t2](e6));
|
|
1536
|
+
}
|
|
1537
|
+
create(t2) {
|
|
1538
|
+
return new e2(this.logger, { prefix: `${this.prefix}:${t2}:`, ...this.options });
|
|
1539
|
+
}
|
|
1540
|
+
clone(t2) {
|
|
1541
|
+
return t2 ||= this.options, t2.prefix = t2.prefix || this.prefix, new e2(this.logger, t2);
|
|
1542
|
+
}
|
|
1543
|
+
}();
|
|
1544
|
+
var G = class {
|
|
1545
|
+
constructor() {
|
|
1546
|
+
this.observers = {};
|
|
1547
|
+
}
|
|
1548
|
+
on(e6, t2) {
|
|
1549
|
+
return e6.split(` `).forEach((e7) => {
|
|
1550
|
+
this.observers[e7] || (this.observers[e7] = /* @__PURE__ */ new Map());
|
|
1551
|
+
let n2 = this.observers[e7].get(t2) || 0;
|
|
1552
|
+
this.observers[e7].set(t2, n2 + 1);
|
|
1553
|
+
}), this;
|
|
1554
|
+
}
|
|
1555
|
+
off(e6, t2) {
|
|
1556
|
+
this.observers[e6] && (t2 ? this.observers[e6].delete(t2) : delete this.observers[e6]);
|
|
1557
|
+
}
|
|
1558
|
+
once(e6, t2) {
|
|
1559
|
+
let n2 = (...r2) => {
|
|
1560
|
+
t2(...r2), this.off(e6, n2);
|
|
1561
|
+
};
|
|
1562
|
+
return this.on(e6, n2), this;
|
|
1563
|
+
}
|
|
1564
|
+
emit(e6, ...t2) {
|
|
1565
|
+
this.observers[e6] && Array.from(this.observers[e6].entries()).forEach(([e7, n2]) => {
|
|
1566
|
+
for (let r2 = 0; r2 < n2; r2++) e7(...t2);
|
|
1567
|
+
}), this.observers[`*`] && Array.from(this.observers[`*`].entries()).forEach(([n2, r2]) => {
|
|
1568
|
+
for (let i2 = 0; i2 < r2; i2++) n2(e6, ...t2);
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
};
|
|
1572
|
+
var ai = /* @__PURE__ */ new WeakSet();
|
|
1573
|
+
var oi = class extends G {
|
|
1574
|
+
constructor(e6, t2 = { ns: [`translation`], defaultNS: `translation` }) {
|
|
1575
|
+
super(), this.data = e6 || {}, this.options = t2, this.options.keySeparator === void 0 && (this.options.keySeparator = `.`), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = true);
|
|
1576
|
+
}
|
|
1577
|
+
addNamespaces(e6) {
|
|
1578
|
+
this.options.ns.includes(e6) || this.options.ns.push(e6);
|
|
1579
|
+
}
|
|
1580
|
+
removeNamespaces(e6) {
|
|
1581
|
+
let t2 = this.options.ns.indexOf(e6);
|
|
1582
|
+
t2 > -1 && this.options.ns.splice(t2, 1);
|
|
1583
|
+
}
|
|
1584
|
+
getResource(e6, t2, n2, r2 = {}) {
|
|
1585
|
+
let i2 = r2.keySeparator === void 0 ? this.options.keySeparator : r2.keySeparator, a2 = r2.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r2.ignoreJSONStructure, o2;
|
|
1586
|
+
e6.includes(`.`) ? o2 = e6.split(`.`) : (o2 = [e6, t2], n2 && (Array.isArray(n2) ? o2.push(...n2) : R(n2) && i2 ? o2.push(...n2.split(i2)) : o2.push(n2)));
|
|
1587
|
+
let s2 = V(this.data, o2);
|
|
1588
|
+
return !s2 && !t2 && !n2 && e6.includes(`.`) && (e6 = o2[0], t2 = o2[1], n2 = o2.slice(2).join(`.`)), s2 || !a2 || !R(n2) ? s2 : ri(this.data?.[e6]?.[t2], n2, i2);
|
|
1589
|
+
}
|
|
1590
|
+
addResource(e6, t2, n2, r2, i2 = { silent: false }) {
|
|
1591
|
+
let a2 = i2.keySeparator === void 0 ? this.options.keySeparator : i2.keySeparator, o2 = [e6, t2];
|
|
1592
|
+
n2 && (o2 = o2.concat(a2 ? n2.split(a2) : n2)), e6.includes(`.`) && (o2 = e6.split(`.`), r2 = t2, t2 = o2[1]), this.addNamespaces(t2), qr(this.data, o2, r2), i2.silent || this.emit(`added`, e6, t2, n2, r2);
|
|
1593
|
+
}
|
|
1594
|
+
addResources(e6, t2, n2, r2 = { silent: false }) {
|
|
1595
|
+
for (let r3 in n2) (R(n2[r3]) || Array.isArray(n2[r3])) && this.addResource(e6, t2, r3, n2[r3], { silent: true });
|
|
1596
|
+
r2.silent || this.emit(`added`, e6, t2, n2);
|
|
1597
|
+
}
|
|
1598
|
+
addResourceBundle(e6, t2, n2, r2, i2, a2 = { silent: false, skipCopy: false }) {
|
|
1599
|
+
let o2 = [e6, t2];
|
|
1600
|
+
e6.includes(`.`) && (o2 = e6.split(`.`), r2 = n2, n2 = t2, t2 = o2[1]), this.addNamespaces(t2);
|
|
1601
|
+
let s2 = V(this.data, o2) || {};
|
|
1602
|
+
a2.skipCopy || (n2 = JSON.parse(JSON.stringify(n2))), r2 ? Xr(s2, n2, i2) : s2 = { ...s2, ...n2 }, qr(this.data, o2, s2), a2.silent || this.emit(`added`, e6, t2, n2);
|
|
1603
|
+
}
|
|
1604
|
+
removeResourceBundle(e6, t2) {
|
|
1605
|
+
this.hasResourceBundle(e6, t2) && delete this.data[e6][t2], this.removeNamespaces(t2), this.emit(`removed`, e6, t2);
|
|
1606
|
+
}
|
|
1607
|
+
hasResourceBundle(e6, t2) {
|
|
1608
|
+
return this.getResource(e6, t2) !== void 0;
|
|
1609
|
+
}
|
|
1610
|
+
getResourceBundle(e6, t2) {
|
|
1611
|
+
return t2 ||= this.options.defaultNS, this.getResource(e6, t2);
|
|
1612
|
+
}
|
|
1613
|
+
getDataByLanguage(e6) {
|
|
1614
|
+
return this.data[e6];
|
|
1615
|
+
}
|
|
1616
|
+
hasLanguageSomeTranslations(e6) {
|
|
1617
|
+
let t2 = this.getDataByLanguage(e6);
|
|
1618
|
+
return !!(t2 && Object.keys(t2) || []).find((e7) => {
|
|
1619
|
+
let n2 = t2[e7];
|
|
1620
|
+
return ai.has(n2) ? true : !n2 || Object.keys(n2).length === 0 ? false : (typeof n2 == `object` && ai.add(n2), true);
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
toJSON() {
|
|
1624
|
+
return this.data;
|
|
1625
|
+
}
|
|
1626
|
+
};
|
|
1627
|
+
var si = { processors: {}, addPostProcessor(e6) {
|
|
1628
|
+
this.processors[e6.name] = e6;
|
|
1629
|
+
}, handle(e6, t2, n2, r2, i2) {
|
|
1630
|
+
return e6.forEach((e7) => {
|
|
1631
|
+
t2 = this.processors[e7]?.process(t2, n2, r2, i2) ?? t2;
|
|
1632
|
+
}), t2;
|
|
1633
|
+
} };
|
|
1634
|
+
var ci = Symbol(`i18next/PATH_KEY`);
|
|
1635
|
+
function li() {
|
|
1636
|
+
let e6 = [], t2 = /* @__PURE__ */ Object.create(null), n2;
|
|
1637
|
+
return t2.get = (r2, i2) => (n2?.revoke?.(), i2 === ci ? e6 : (e6.push(i2), n2 = Proxy.revocable(r2, t2), n2.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), t2).proxy;
|
|
1638
|
+
}
|
|
1639
|
+
function K(e6, t2) {
|
|
1640
|
+
let { [ci]: n2 } = e6(li()), r2 = t2?.keySeparator ?? `.`, i2 = t2?.nsSeparator ?? `:`, a2 = t2?.enableSelector === `strict`;
|
|
1641
|
+
if (n2.length > 1 && i2) {
|
|
1642
|
+
let e7 = t2?.ns, o2 = a2 ? Array.isArray(e7) ? e7 : e7 ? [e7] : null : Array.isArray(e7) ? e7 : null;
|
|
1643
|
+
if (o2 && (a2 ? o2 : o2.length > 1 ? o2.slice(1) : []).includes(n2[0])) return `${n2[0]}${i2}${n2.slice(1).join(r2)}`;
|
|
1644
|
+
}
|
|
1645
|
+
return n2.join(r2);
|
|
1646
|
+
}
|
|
1647
|
+
var ui = (e6) => !R(e6) && typeof e6 != `boolean` && typeof e6 != `number`;
|
|
1648
|
+
var di = class e3 extends G {
|
|
1649
|
+
constructor(e6, t2 = {}) {
|
|
1650
|
+
super(), Ur([`resourceStore`, `languageUtils`, `pluralResolver`, `interpolator`, `backendConnector`, `i18nFormat`, `utils`], e6, this), this.options = t2, this.options.keySeparator === void 0 && (this.options.keySeparator = `.`), this.logger = W.create(`translator`), this.checkedLoadedFor = {};
|
|
1651
|
+
}
|
|
1652
|
+
changeLanguage(e6) {
|
|
1653
|
+
e6 && (this.language = e6);
|
|
1654
|
+
}
|
|
1655
|
+
exists(e6, t2 = { interpolation: {} }) {
|
|
1656
|
+
let n2 = { ...t2 };
|
|
1657
|
+
if (e6 == null) return false;
|
|
1658
|
+
let r2 = this.resolve(e6, n2);
|
|
1659
|
+
if (r2?.res === void 0) return false;
|
|
1660
|
+
let i2 = ui(r2.res);
|
|
1661
|
+
return !(n2.returnObjects === false && i2);
|
|
1662
|
+
}
|
|
1663
|
+
extractFromKey(e6, t2) {
|
|
1664
|
+
let n2 = t2.nsSeparator === void 0 ? this.options.nsSeparator : t2.nsSeparator;
|
|
1665
|
+
n2 === void 0 && (n2 = `:`);
|
|
1666
|
+
let r2 = t2.keySeparator === void 0 ? this.options.keySeparator : t2.keySeparator, i2 = t2.ns || this.options.defaultNS || [], a2 = n2 && e6.includes(n2), o2 = !this.options.userDefinedKeySeparator && !t2.keySeparator && !this.options.userDefinedNsSeparator && !t2.nsSeparator && !ni(e6, n2, r2);
|
|
1667
|
+
if (a2 && !o2) {
|
|
1668
|
+
let t3 = e6.match(this.interpolator.nestingRegexp);
|
|
1669
|
+
if (t3 && t3.length > 0) return { key: e6, namespaces: R(i2) ? [i2] : i2 };
|
|
1670
|
+
let a3 = e6.split(n2);
|
|
1671
|
+
(n2 !== r2 || n2 === r2 && this.options.ns.includes(a3[0])) && (i2 = a3.shift()), e6 = a3.join(r2);
|
|
1672
|
+
}
|
|
1673
|
+
return { key: e6, namespaces: R(i2) ? [i2] : i2 };
|
|
1674
|
+
}
|
|
1675
|
+
translate(t2, n2, r2) {
|
|
1676
|
+
let i2 = typeof n2 == `object` ? { ...n2 } : n2;
|
|
1677
|
+
if (typeof i2 != `object` && this.options.overloadTranslationOptionHandler && (i2 = this.options.overloadTranslationOptionHandler(arguments)), typeof i2 == `object` && (i2 = { ...i2 }), i2 ||= {}, t2 == null) return ``;
|
|
1678
|
+
typeof t2 == `function` && (t2 = K(t2, { ...this.options, ...i2 })), Array.isArray(t2) || (t2 = [String(t2)]), t2 = t2.map((e6) => typeof e6 == `function` ? K(e6, { ...this.options, ...i2 }) : String(e6));
|
|
1679
|
+
let a2 = i2.returnDetails === void 0 ? this.options.returnDetails : i2.returnDetails, o2 = i2.keySeparator === void 0 ? this.options.keySeparator : i2.keySeparator, { key: s2, namespaces: c2 } = this.extractFromKey(t2[t2.length - 1], i2), l2 = c2[c2.length - 1], u2 = i2.nsSeparator === void 0 ? this.options.nsSeparator : i2.nsSeparator;
|
|
1680
|
+
u2 === void 0 && (u2 = `:`);
|
|
1681
|
+
let d2 = i2.lng || this.language, f2 = i2.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
1682
|
+
if (d2?.toLowerCase() === `cimode`) return f2 ? a2 ? { res: `${l2}${u2}${s2}`, usedKey: s2, exactUsedKey: s2, usedLng: d2, usedNS: l2, usedParams: this.getUsedParamsDetails(i2) } : `${l2}${u2}${s2}` : a2 ? { res: s2, usedKey: s2, exactUsedKey: s2, usedLng: d2, usedNS: l2, usedParams: this.getUsedParamsDetails(i2) } : s2;
|
|
1683
|
+
let p2 = this.resolve(t2, i2), m2 = p2?.res, h2 = p2?.usedKey || s2, g2 = p2?.exactUsedKey || s2, _2 = [`[object Number]`, `[object Function]`, `[object RegExp]`], v2 = i2.joinArrays === void 0 ? this.options.joinArrays : i2.joinArrays, y2 = !this.i18nFormat || this.i18nFormat.handleAsObject, b2 = i2.count !== void 0 && !R(i2.count), x2 = e3.hasDefaultValue(i2), S2 = b2 ? this.pluralResolver.getSuffix(d2, i2.count, i2) : ``, C2 = i2.ordinal && b2 ? this.pluralResolver.getSuffix(d2, i2.count, { ordinal: false }) : ``, ee2 = b2 && !i2.ordinal && i2.count === 0, w2 = ee2 && i2[`defaultValue${this.options.pluralSeparator}zero`] || i2[`defaultValue${S2}`] || i2[`defaultValue${C2}`] || i2.defaultValue, T2 = m2;
|
|
1684
|
+
y2 && !m2 && x2 && (T2 = w2);
|
|
1685
|
+
let te2 = ui(T2), ne2 = Object.prototype.toString.apply(T2);
|
|
1686
|
+
if (y2 && T2 && te2 && !_2.includes(ne2) && !(R(v2) && Array.isArray(T2))) {
|
|
1687
|
+
if (!i2.returnObjects && !this.options.returnObjects) {
|
|
1688
|
+
this.options.returnedObjectHandler || this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);
|
|
1689
|
+
let e6 = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h2, T2, { ...i2, ns: c2 }) : `key '${s2} (${this.language})' returned an object instead of string.`;
|
|
1690
|
+
return a2 ? (p2.res = e6, p2.usedParams = this.getUsedParamsDetails(i2), p2) : e6;
|
|
1691
|
+
}
|
|
1692
|
+
if (o2) {
|
|
1693
|
+
let e6 = Array.isArray(T2), t3 = e6 ? [] : {}, n3 = e6 ? g2 : h2;
|
|
1694
|
+
for (let e7 in T2) if (Object.prototype.hasOwnProperty.call(T2, e7)) {
|
|
1695
|
+
let r3 = `${n3}${o2}${e7}`;
|
|
1696
|
+
t3[e7] = x2 && !m2 ? this.translate(r3, { ...i2, defaultValue: ui(w2) ? w2[e7] : void 0, joinArrays: false, ns: c2 }) : this.translate(r3, { ...i2, joinArrays: false, ns: c2 }), t3[e7] === r3 && (t3[e7] = T2[e7]);
|
|
1697
|
+
}
|
|
1698
|
+
m2 = t3;
|
|
1699
|
+
}
|
|
1700
|
+
} else if (y2 && R(v2) && Array.isArray(m2)) m2 = m2.join(v2), m2 &&= this.extendTranslation(m2, t2, i2, r2);
|
|
1701
|
+
else {
|
|
1702
|
+
let e6 = false, n3 = false;
|
|
1703
|
+
!this.isValidLookup(m2) && x2 && (e6 = true, m2 = w2), this.isValidLookup(m2) || (n3 = true, m2 = s2);
|
|
1704
|
+
let a3 = (i2.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n3 ? void 0 : m2, c3 = x2 && w2 !== m2 && this.options.updateMissing;
|
|
1705
|
+
if (n3 || e6 || c3) {
|
|
1706
|
+
if (this.logger.log(c3 ? `updateKey` : `missingKey`, d2, l2, b2 && !c3 ? `${s2}${this.pluralResolver.getSuffix(d2, i2.count, i2)}` : s2, c3 ? w2 : m2), o2) {
|
|
1707
|
+
let e8 = this.resolve(s2, { ...i2, keySeparator: false });
|
|
1708
|
+
e8 && e8.res && this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`);
|
|
1709
|
+
}
|
|
1710
|
+
let e7 = [], t3 = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i2.lng || this.language);
|
|
1711
|
+
if (this.options.saveMissingTo === `fallback` && t3 && t3[0]) for (let n5 = 0; n5 < t3.length; n5++) e7.push(t3[n5]);
|
|
1712
|
+
else this.options.saveMissingTo === `all` ? e7 = this.languageUtils.toResolveHierarchy(i2.lng || this.language) : e7.push(i2.lng || this.language);
|
|
1713
|
+
let n4 = (e8, t4, n5) => {
|
|
1714
|
+
let r3 = x2 && n5 !== m2 ? n5 : a3;
|
|
1715
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(e8, l2, t4, r3, c3, i2) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e8, l2, t4, r3, c3, i2), this.emit(`missingKey`, e8, l2, t4, m2);
|
|
1716
|
+
};
|
|
1717
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && b2 ? e7.forEach((e8) => {
|
|
1718
|
+
let t4 = this.pluralResolver.getSuffixes(e8, i2);
|
|
1719
|
+
ee2 && i2[`defaultValue${this.options.pluralSeparator}zero`] && !t4.includes(`${this.options.pluralSeparator}zero`) && t4.push(`${this.options.pluralSeparator}zero`), t4.forEach((t5) => {
|
|
1720
|
+
n4([e8], s2 + t5, i2[`defaultValue${t5}`] || w2);
|
|
1721
|
+
});
|
|
1722
|
+
}) : n4(e7, s2, w2));
|
|
1723
|
+
}
|
|
1724
|
+
m2 = this.extendTranslation(m2, t2, i2, p2, r2), n3 && m2 === s2 && this.options.appendNamespaceToMissingKey && (m2 = `${l2}${u2}${s2}`), (n3 || e6) && this.options.parseMissingKeyHandler && (m2 = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l2}${u2}${s2}` : s2, e6 ? m2 : void 0, i2));
|
|
1725
|
+
}
|
|
1726
|
+
return a2 ? (p2.res = m2, p2.usedParams = this.getUsedParamsDetails(i2), p2) : m2;
|
|
1727
|
+
}
|
|
1728
|
+
extendTranslation(e6, t2, n2, r2, i2) {
|
|
1729
|
+
if (this.i18nFormat?.parse) e6 = this.i18nFormat.parse(e6, { ...this.options.interpolation.defaultVariables, ...n2 }, n2.lng || this.language || r2.usedLng, r2.usedNS, r2.usedKey, { resolved: r2 });
|
|
1730
|
+
else if (!n2.skipInterpolation) {
|
|
1731
|
+
n2.interpolation && this.interpolator.init({ ...n2, interpolation: { ...this.options.interpolation, ...n2.interpolation } });
|
|
1732
|
+
let a3 = R(e6) && (n2?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n2.interpolation.skipOnVariables), o3;
|
|
1733
|
+
if (a3) {
|
|
1734
|
+
let t3 = e6.match(this.interpolator.nestingRegexp);
|
|
1735
|
+
o3 = t3 && t3.length;
|
|
1736
|
+
}
|
|
1737
|
+
let s2 = n2.replace && !R(n2.replace) ? n2.replace : n2;
|
|
1738
|
+
if (this.options.interpolation.defaultVariables && (s2 = { ...this.options.interpolation.defaultVariables, ...s2 }), e6 = this.interpolator.interpolate(e6, s2, n2.lng || this.language || r2.usedLng, n2), a3) {
|
|
1739
|
+
let t3 = e6.match(this.interpolator.nestingRegexp), r3 = t3 && t3.length;
|
|
1740
|
+
o3 < r3 && (n2.nest = false);
|
|
1741
|
+
}
|
|
1742
|
+
!n2.lng && r2 && r2.res && (n2.lng = this.language || r2.usedLng), n2.nest !== false && (e6 = this.interpolator.nest(e6, (...e7) => i2?.[0] === e7[0] && !n2.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e7[0]} in key: ${t2[0]}`), null) : this.translate(...e7, t2), n2)), n2.interpolation && this.interpolator.reset();
|
|
1743
|
+
}
|
|
1744
|
+
let a2 = n2.postProcess || this.options.postProcess, o2 = R(a2) ? [a2] : a2;
|
|
1745
|
+
return e6 != null && o2?.length && n2.applyPostProcessor !== false && (e6 = si.handle(o2, e6, t2, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...r2, usedParams: this.getUsedParamsDetails(n2) }, ...n2 } : n2, this)), e6;
|
|
1746
|
+
}
|
|
1747
|
+
resolve(e6, t2 = {}) {
|
|
1748
|
+
let n2, r2, i2, a2, o2;
|
|
1749
|
+
return R(e6) && (e6 = [e6]), Array.isArray(e6) && (e6 = e6.map((e7) => typeof e7 == `function` ? K(e7, { ...this.options, ...t2 }) : e7)), e6.forEach((e7) => {
|
|
1750
|
+
if (this.isValidLookup(n2)) return;
|
|
1751
|
+
let s2 = this.extractFromKey(e7, t2), c2 = s2.key;
|
|
1752
|
+
r2 = c2;
|
|
1753
|
+
let l2 = s2.namespaces;
|
|
1754
|
+
this.options.fallbackNS && (l2 = l2.concat(this.options.fallbackNS));
|
|
1755
|
+
let u2 = t2.count !== void 0 && !R(t2.count), d2 = u2 && !t2.ordinal && t2.count === 0, f2 = t2.context !== void 0 && (R(t2.context) || typeof t2.context == `number`) && t2.context !== ``, p2 = t2.lngs ? t2.lngs : this.languageUtils.toResolveHierarchy(t2.lng || this.language, t2.fallbackLng);
|
|
1756
|
+
l2.forEach((e8) => {
|
|
1757
|
+
this.isValidLookup(n2) || (o2 = e8, !this.checkedLoadedFor[`${p2[0]}-${e8}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o2) && (this.checkedLoadedFor[`${p2[0]}-${e8}`] = true, this.logger.warn(`key "${r2}" for languages "${p2.join(`, `)}" won't get resolved as namespace "${o2}" was not yet loaded`, `This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)), p2.forEach((r3) => {
|
|
1758
|
+
if (this.isValidLookup(n2)) return;
|
|
1759
|
+
a2 = r3;
|
|
1760
|
+
let o3 = [c2];
|
|
1761
|
+
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o3, c2, r3, e8, t2);
|
|
1762
|
+
else {
|
|
1763
|
+
let e9;
|
|
1764
|
+
u2 && (e9 = this.pluralResolver.getSuffix(r3, t2.count, t2));
|
|
1765
|
+
let n3 = `${this.options.pluralSeparator}zero`, i3 = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
1766
|
+
if (u2 && (t2.ordinal && e9.startsWith(i3) && o3.push(c2 + e9.replace(i3, this.options.pluralSeparator)), o3.push(c2 + e9), d2 && o3.push(c2 + n3)), f2) {
|
|
1767
|
+
let r4 = `${c2}${this.options.contextSeparator || `_`}${t2.context}`;
|
|
1768
|
+
o3.push(r4), u2 && (t2.ordinal && e9.startsWith(i3) && o3.push(r4 + e9.replace(i3, this.options.pluralSeparator)), o3.push(r4 + e9), d2 && o3.push(r4 + n3));
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
let s3;
|
|
1772
|
+
for (; s3 = o3.pop(); ) this.isValidLookup(n2) || (i2 = s3, n2 = this.getResource(r3, e8, s3, t2));
|
|
1773
|
+
}));
|
|
1774
|
+
});
|
|
1775
|
+
}), { res: n2, usedKey: r2, exactUsedKey: i2, usedLng: a2, usedNS: o2 };
|
|
1776
|
+
}
|
|
1777
|
+
isValidLookup(e6) {
|
|
1778
|
+
return e6 !== void 0 && !(!this.options.returnNull && e6 === null) && !(!this.options.returnEmptyString && e6 === ``);
|
|
1779
|
+
}
|
|
1780
|
+
getResource(e6, t2, n2, r2 = {}) {
|
|
1781
|
+
return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e6, t2, n2, r2) : this.resourceStore.getResource(e6, t2, n2, r2);
|
|
1782
|
+
}
|
|
1783
|
+
getUsedParamsDetails(e6 = {}) {
|
|
1784
|
+
let t2 = [`defaultValue`, `ordinal`, `context`, `replace`, `lng`, `lngs`, `fallbackLng`, `ns`, `keySeparator`, `nsSeparator`, `returnObjects`, `returnDetails`, `joinArrays`, `postProcess`, `interpolation`], n2 = e6.replace && !R(e6.replace), r2 = n2 ? e6.replace : e6;
|
|
1785
|
+
if (n2 && e6.count !== void 0 && (r2 = { ...r2, count: e6.count }), this.options.interpolation.defaultVariables && (r2 = { ...this.options.interpolation.defaultVariables, ...r2 }), !n2) {
|
|
1786
|
+
r2 = { ...r2 };
|
|
1787
|
+
for (let e7 of t2) delete r2[e7];
|
|
1788
|
+
}
|
|
1789
|
+
return r2;
|
|
1790
|
+
}
|
|
1791
|
+
static hasDefaultValue(e6) {
|
|
1792
|
+
for (let t2 in e6) if (Object.prototype.hasOwnProperty.call(e6, t2) && t2.startsWith(`defaultValue`) && e6[t2] !== void 0) return true;
|
|
1793
|
+
return false;
|
|
1794
|
+
}
|
|
1795
|
+
};
|
|
1796
|
+
var fi = class {
|
|
1797
|
+
constructor(e6) {
|
|
1798
|
+
this.options = e6, this.supportedLngs = this.options.supportedLngs || false, this.logger = W.create(`languageUtils`), this.resolveHierarchyCache = {};
|
|
1799
|
+
}
|
|
1800
|
+
clearCache() {
|
|
1801
|
+
this.resolveHierarchyCache = {};
|
|
1802
|
+
}
|
|
1803
|
+
getScriptPartFromCode(e6) {
|
|
1804
|
+
if (e6 = U(e6), !e6 || !e6.includes(`-`)) return null;
|
|
1805
|
+
let t2 = e6.split(`-`);
|
|
1806
|
+
return t2.length === 2 || (t2.pop(), t2[t2.length - 1].toLowerCase() === `x`) ? null : this.formatLanguageCode(t2.join(`-`));
|
|
1807
|
+
}
|
|
1808
|
+
getLanguagePartFromCode(e6) {
|
|
1809
|
+
if (e6 = U(e6), !e6 || !e6.includes(`-`)) return e6;
|
|
1810
|
+
let t2 = e6.split(`-`);
|
|
1811
|
+
return this.formatLanguageCode(t2[0]);
|
|
1812
|
+
}
|
|
1813
|
+
formatLanguageCode(e6) {
|
|
1814
|
+
if (R(e6) && e6.includes(`-`)) {
|
|
1815
|
+
let t2;
|
|
1816
|
+
try {
|
|
1817
|
+
t2 = Intl.getCanonicalLocales(e6)[0];
|
|
1818
|
+
} catch {
|
|
1819
|
+
}
|
|
1820
|
+
return t2 && this.options.lowerCaseLng && (t2 = t2.toLowerCase()), t2 || (this.options.lowerCaseLng ? e6.toLowerCase() : e6);
|
|
1821
|
+
}
|
|
1822
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? e6.toLowerCase() : e6;
|
|
1823
|
+
}
|
|
1824
|
+
isSupportedCode(e6) {
|
|
1825
|
+
return (this.options.load === `languageOnly` || this.options.nonExplicitSupportedLngs) && (e6 = this.getLanguagePartFromCode(e6)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.includes(e6);
|
|
1826
|
+
}
|
|
1827
|
+
getBestMatchFromCodes(e6) {
|
|
1828
|
+
if (!e6) return null;
|
|
1829
|
+
let t2;
|
|
1830
|
+
return e6.forEach((e7) => {
|
|
1831
|
+
if (t2) return;
|
|
1832
|
+
let n2 = this.formatLanguageCode(e7);
|
|
1833
|
+
(!this.options.supportedLngs || this.isSupportedCode(n2)) && (t2 = n2);
|
|
1834
|
+
}), !t2 && this.options.supportedLngs && e6.forEach((e7) => {
|
|
1835
|
+
if (t2) return;
|
|
1836
|
+
let n2 = this.getScriptPartFromCode(e7);
|
|
1837
|
+
if (this.isSupportedCode(n2)) return t2 = n2;
|
|
1838
|
+
let r2 = this.getLanguagePartFromCode(e7);
|
|
1839
|
+
if (this.isSupportedCode(r2)) return t2 = r2;
|
|
1840
|
+
t2 = this.options.supportedLngs.find((e8) => e8 === r2 ? true : !e8.includes(`-`) && !r2.includes(`-`) ? false : !!(e8.includes(`-`) && !r2.includes(`-`) && e8.slice(0, e8.indexOf(`-`)) === r2 || e8.startsWith(r2) && r2.length > 1));
|
|
1841
|
+
}), t2 ||= this.getFallbackCodes(this.options.fallbackLng)[0], t2;
|
|
1842
|
+
}
|
|
1843
|
+
getFallbackCodes(e6, t2) {
|
|
1844
|
+
if (!e6) return [];
|
|
1845
|
+
if (typeof e6 == `function` && (e6 = e6(t2)), R(e6) && (e6 = [e6]), Array.isArray(e6)) return e6;
|
|
1846
|
+
if (!t2) return e6.default || [];
|
|
1847
|
+
let n2 = e6[t2];
|
|
1848
|
+
return n2 ||= e6[this.getScriptPartFromCode(t2)], n2 ||= e6[this.formatLanguageCode(t2)], n2 ||= e6[this.getLanguagePartFromCode(t2)], n2 ||= e6.default, n2 || [];
|
|
1849
|
+
}
|
|
1850
|
+
toResolveHierarchy(e6, t2) {
|
|
1851
|
+
let n2 = this.options.fallbackLng, r2 = Array.isArray(n2) ? n2.join(`|`) : n2;
|
|
1852
|
+
r2 !== this._cachedFallbackLng && (this.resolveHierarchyCache = {}, this._cachedFallbackLng = r2);
|
|
1853
|
+
let i2 = t2 === void 0 || t2 === false || R(t2), a2 = t2 === void 0 && typeof this.options.fallbackLng == `function`, o2 = R(e6) && i2 && !a2, s2 = null;
|
|
1854
|
+
if (o2) {
|
|
1855
|
+
let n3;
|
|
1856
|
+
n3 = t2 === void 0 ? `undefined` : t2 === false ? `boolean:false` : `string:${t2}`, s2 = `${e6.length}:${e6}|${n3}`;
|
|
1857
|
+
}
|
|
1858
|
+
if (s2 !== null) {
|
|
1859
|
+
let e7 = this.resolveHierarchyCache[s2];
|
|
1860
|
+
if (e7 !== void 0) return e7.slice();
|
|
1861
|
+
}
|
|
1862
|
+
let c2 = this.getFallbackCodes((t2 === false ? [] : t2) || this.options.fallbackLng || [], e6), l2 = [], u2 = (e7) => {
|
|
1863
|
+
e7 && (this.isSupportedCode(e7) ? l2.push(e7) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e7}`));
|
|
1864
|
+
};
|
|
1865
|
+
return R(e6) && (e6.includes(`-`) || e6.includes(`_`)) ? (this.options.load !== `languageOnly` && u2(this.formatLanguageCode(e6)), this.options.load !== `languageOnly` && this.options.load !== `currentOnly` && u2(this.getScriptPartFromCode(e6)), this.options.load !== `currentOnly` && u2(this.getLanguagePartFromCode(e6))) : R(e6) && u2(this.formatLanguageCode(e6)), c2.forEach((e7) => {
|
|
1866
|
+
l2.includes(e7) || u2(this.formatLanguageCode(e7));
|
|
1867
|
+
}), s2 === null ? l2 : (this.resolveHierarchyCache[s2] = l2, l2.slice());
|
|
1868
|
+
}
|
|
1869
|
+
};
|
|
1870
|
+
var pi = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 };
|
|
1871
|
+
var mi = { select: (e6) => e6 === 1 ? `one` : `other`, resolvedOptions: () => ({ pluralCategories: [`one`, `other`] }) };
|
|
1872
|
+
var hi = class {
|
|
1873
|
+
constructor(e6, t2 = {}) {
|
|
1874
|
+
this.languageUtils = e6, this.options = t2, this.logger = W.create(`pluralResolver`), this.pluralRulesCache = {};
|
|
1875
|
+
}
|
|
1876
|
+
clearCache() {
|
|
1877
|
+
this.pluralRulesCache = {};
|
|
1878
|
+
}
|
|
1879
|
+
getRule(e6, t2 = {}) {
|
|
1880
|
+
let n2 = U(e6 === `dev` ? `en` : e6), r2 = t2.ordinal ? `ordinal` : `cardinal`, i2 = JSON.stringify({ cleanedCode: n2, type: r2 });
|
|
1881
|
+
if (i2 in this.pluralRulesCache) return this.pluralRulesCache[i2];
|
|
1882
|
+
let a2;
|
|
1883
|
+
try {
|
|
1884
|
+
a2 = new Intl.PluralRules(n2, { type: r2 });
|
|
1885
|
+
} catch {
|
|
1886
|
+
if (typeof Intl > `u`) return this.logger.error(`No Intl support, please use an Intl polyfill!`), mi;
|
|
1887
|
+
if (!e6.match(/-|_/)) return mi;
|
|
1888
|
+
let n3 = this.languageUtils.getLanguagePartFromCode(e6);
|
|
1889
|
+
a2 = this.getRule(n3, t2);
|
|
1890
|
+
}
|
|
1891
|
+
return this.pluralRulesCache[i2] = a2, a2;
|
|
1892
|
+
}
|
|
1893
|
+
needsPlural(e6, t2 = {}) {
|
|
1894
|
+
let n2 = this.getRule(e6, t2);
|
|
1895
|
+
return n2 ||= this.getRule(`dev`, t2), n2?.resolvedOptions().pluralCategories.length > 1;
|
|
1896
|
+
}
|
|
1897
|
+
getPluralFormsOfKey(e6, t2, n2 = {}) {
|
|
1898
|
+
return this.getSuffixes(e6, n2).map((e7) => `${t2}${e7}`);
|
|
1899
|
+
}
|
|
1900
|
+
getSuffixes(e6, t2 = {}) {
|
|
1901
|
+
let n2 = this.getRule(e6, t2);
|
|
1902
|
+
return n2 ||= this.getRule(`dev`, t2), n2 ? n2.resolvedOptions().pluralCategories.sort((e7, t3) => pi[e7] - pi[t3]).map((e7) => `${this.options.prepend}${t2.ordinal ? `ordinal${this.options.prepend}` : ``}${e7}`) : [];
|
|
1903
|
+
}
|
|
1904
|
+
getSuffix(e6, t2, n2 = {}) {
|
|
1905
|
+
let r2 = this.getRule(e6, n2);
|
|
1906
|
+
return r2 ? `${this.options.prepend}${n2.ordinal ? `ordinal${this.options.prepend}` : ``}${r2.select(t2)}` : (this.logger.warn(`no plural rule found for: ${e6}`), this.getSuffix(`dev`, t2, n2));
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1909
|
+
var gi = (e6, t2, n2, r2 = `.`, i2 = true) => {
|
|
1910
|
+
let a2 = Yr(e6, t2, n2);
|
|
1911
|
+
return !a2 && i2 && R(n2) && (a2 = ri(e6, n2, r2), a2 === void 0 && (a2 = ri(t2, n2, r2))), a2;
|
|
1912
|
+
};
|
|
1913
|
+
var _i = (e6) => e6.replace(/\$/g, `$$$$`);
|
|
1914
|
+
var vi = class {
|
|
1915
|
+
constructor(e6 = {}) {
|
|
1916
|
+
this.logger = W.create(`interpolator`), this.options = e6, this.format = e6?.interpolation?.format || ((e7) => e7), this.init(e6);
|
|
1917
|
+
}
|
|
1918
|
+
init(e6 = {}) {
|
|
1919
|
+
e6.interpolation ||= { escapeValue: true };
|
|
1920
|
+
let { escape: t2, escapeValue: n2, useRawValueToEscape: r2, prefix: i2, prefixEscaped: a2, suffix: o2, suffixEscaped: s2, formatSeparator: c2, unescapeSuffix: l2, unescapePrefix: u2, nestingPrefix: d2, nestingPrefixEscaped: f2, nestingSuffix: p2, nestingSuffixEscaped: m2, nestingOptionsSeparator: h2, maxReplaces: g2, alwaysFormat: _2 } = e6.interpolation;
|
|
1921
|
+
this.escape = t2 === void 0 ? Qr : t2, this.escapeValue = n2 === void 0 || n2, this.useRawValueToEscape = r2 !== void 0 && r2, this.prefix = i2 ? H(i2) : a2 || `{{`, this.suffix = o2 ? H(o2) : s2 || `}}`, this.formatSeparator = c2 || `,`, this.unescapePrefix = l2 ? `` : u2 ? H(u2) : `-`, this.unescapeSuffix = this.unescapePrefix ? `` : l2 ? H(l2) : ``, this.nestingPrefix = d2 ? H(d2) : f2 || H(`$t(`), this.nestingSuffix = p2 ? H(p2) : m2 || H(`)`), this.nestingOptionsSeparator = h2 || `,`, this.maxReplaces = g2 || 1e3, this.alwaysFormat = _2 !== void 0 && _2, this.resetRegExp();
|
|
1922
|
+
}
|
|
1923
|
+
reset() {
|
|
1924
|
+
this.options && this.init(this.options);
|
|
1925
|
+
}
|
|
1926
|
+
resetRegExp() {
|
|
1927
|
+
let e6 = (e7, t2) => e7?.source === t2 ? (e7.lastIndex = 0, e7) : new RegExp(t2, `g`);
|
|
1928
|
+
this.regexp = e6(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e6(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e6(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']|"[^"]*"|'[^']*'|\\((?:[^()"']|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
|
|
1929
|
+
}
|
|
1930
|
+
interpolate(e6, t2, n2, r2) {
|
|
1931
|
+
let i2, a2, o2, s2 = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c2 = (e7) => {
|
|
1932
|
+
if (!e7.includes(this.formatSeparator)) {
|
|
1933
|
+
let i4 = gi(t2, s2, e7, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
1934
|
+
return this.alwaysFormat ? this.format(i4, void 0, n2, { ...r2, ...t2, interpolationkey: e7 }) : i4;
|
|
1935
|
+
}
|
|
1936
|
+
let i3 = e7.split(this.formatSeparator), a3 = i3.shift().trim(), o3 = i3.join(this.formatSeparator).trim();
|
|
1937
|
+
return this.format(gi(t2, s2, a3, this.options.keySeparator, this.options.ignoreJSONStructure), o3, n2, { ...r2, ...t2, interpolationkey: a3 });
|
|
1938
|
+
};
|
|
1939
|
+
this.resetRegExp(), !this.escapeValue && typeof e6 == `string` && /\$t\([^)]*\{[^}]*\{\{/.test(e6) && this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false \u2014 if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);
|
|
1940
|
+
let l2 = r2?.missingInterpolationHandler || this.options.missingInterpolationHandler, u2 = r2?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r2.interpolation.skipOnVariables;
|
|
1941
|
+
return [{ regex: this.regexpUnescape, safeValue: (e7) => e7 }, { regex: this.regexp, safeValue: (e7) => this.escapeValue ? this.escape(e7) : e7 }].forEach((t3) => {
|
|
1942
|
+
for (o2 = 0; i2 = t3.regex.exec(e6); ) {
|
|
1943
|
+
let n3 = i2[1].trim();
|
|
1944
|
+
if (a2 = c2(n3), a2 === void 0) {
|
|
1945
|
+
if (typeof l2 == `function`) {
|
|
1946
|
+
let t4 = l2(e6, i2, r2);
|
|
1947
|
+
a2 = R(t4) ? t4 : ``;
|
|
1948
|
+
} else if (r2 && Object.prototype.hasOwnProperty.call(r2, n3)) a2 = ``;
|
|
1949
|
+
else if (u2) {
|
|
1950
|
+
a2 = i2[0];
|
|
1951
|
+
continue;
|
|
1952
|
+
} else this.logger.warn(`missed to pass in variable ${n3} for interpolating ${e6}`), a2 = ``;
|
|
1953
|
+
} else !R(a2) && !this.useRawValueToEscape && (a2 = Hr(a2));
|
|
1954
|
+
let s3 = t3.safeValue(a2);
|
|
1955
|
+
if (e6 = e6.replace(i2[0], _i(s3)), u2 ? (t3.regex.lastIndex += s3.length, t3.regex.lastIndex -= i2[0].length) : t3.regex.lastIndex = 0, o2++, o2 >= this.maxReplaces) break;
|
|
1956
|
+
}
|
|
1957
|
+
}), e6;
|
|
1958
|
+
}
|
|
1959
|
+
nest(e6, t2, n2 = {}) {
|
|
1960
|
+
let r2, i2, a2, o2 = (e7, t3) => {
|
|
1961
|
+
let n3 = this.nestingOptionsSeparator;
|
|
1962
|
+
if (!e7.includes(n3)) return e7;
|
|
1963
|
+
let r3 = e7.split(RegExp(`${H(n3)}[ ]*{`)), i3 = `{${r3[1]}`;
|
|
1964
|
+
e7 = r3[0], i3 = this.interpolate(i3, a2);
|
|
1965
|
+
let o3 = i3.match(/'/g), s3 = i3.match(/"/g);
|
|
1966
|
+
((o3?.length ?? 0) % 2 == 0 && !s3 || (s3?.length ?? 0) % 2 != 0) && (i3 = i3.replace(/'/g, `"`));
|
|
1967
|
+
try {
|
|
1968
|
+
a2 = JSON.parse(i3), t3 && (a2 = { ...t3, ...a2 });
|
|
1969
|
+
} catch (t4) {
|
|
1970
|
+
return this.logger.warn(`failed parsing options string in nesting for key ${e7}`, t4), `${e7}${n3}${i3}`;
|
|
1971
|
+
}
|
|
1972
|
+
return a2.defaultValue && a2.defaultValue.includes(this.prefix) && delete a2.defaultValue, e7;
|
|
1973
|
+
}, s2 = new RegExp(this.nestingRegexp), c2 = ``, l2 = 0;
|
|
1974
|
+
for (; r2 = s2.exec(e6); ) {
|
|
1975
|
+
let u2 = [];
|
|
1976
|
+
a2 = { ...n2 }, a2 = a2.replace && !R(a2.replace) ? a2.replace : a2, a2.applyPostProcessor = false, delete a2.defaultValue;
|
|
1977
|
+
let d2 = /{.*}/s.test(r2[1]) ? r2[1].lastIndexOf(`}`) + 1 : r2[1].indexOf(this.formatSeparator);
|
|
1978
|
+
if (d2 !== -1 && (u2 = r2[1].slice(d2).split(this.formatSeparator).map((e7) => e7.trim()).filter(Boolean), r2[1] = r2[1].slice(0, d2)), i2 = t2(o2.call(this, r2[1].trim(), a2), a2), i2 && r2[0] === e6 && !R(i2)) return i2;
|
|
1979
|
+
R(i2) || (i2 = Hr(i2)), i2 ||= (this.logger.warn(`missed to resolve ${r2[1]} for nesting ${e6}`), ``), u2.length && (i2 = u2.reduce((e7, t3) => this.format(e7, t3, n2.lng, { ...n2, interpolationkey: r2[1].trim() }), i2.trim())), c2 += e6.slice(l2, r2.index) + Hr(i2), l2 = s2.lastIndex, this.regexp.lastIndex = 0;
|
|
1980
|
+
}
|
|
1981
|
+
return l2 ? c2 + e6.slice(l2) : e6;
|
|
1982
|
+
}
|
|
1983
|
+
};
|
|
1984
|
+
var yi = (e6) => {
|
|
1985
|
+
let t2 = e6.toLowerCase().trim(), n2 = {};
|
|
1986
|
+
if (e6.includes(`(`)) {
|
|
1987
|
+
let r2 = e6.split(`(`);
|
|
1988
|
+
t2 = r2[0].toLowerCase().trim();
|
|
1989
|
+
let i2 = r2[1].slice(0, -1);
|
|
1990
|
+
t2 === `currency` && !i2.includes(`:`) ? n2.currency ||= i2.trim() : t2 === `relativetime` && !i2.includes(`:`) ? n2.range ||= i2.trim() : i2.split(`;`).forEach((e7) => {
|
|
1991
|
+
if (e7) {
|
|
1992
|
+
let [t3, ...r3] = e7.split(`:`), i3 = r3.join(`:`).trim().replace(/^'+|'+$/g, ``), a2 = t3.trim();
|
|
1993
|
+
n2[a2] || (n2[a2] = i3), i3 === `false` && (n2[a2] = false), i3 === `true` && (n2[a2] = true), isNaN(i3) || (n2[a2] = parseInt(i3, 10));
|
|
1994
|
+
}
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
return { formatName: t2, formatOptions: n2 };
|
|
1998
|
+
};
|
|
1999
|
+
var bi = (e6) => {
|
|
2000
|
+
let t2 = {};
|
|
2001
|
+
return (n2, r2, i2) => {
|
|
2002
|
+
let a2 = i2;
|
|
2003
|
+
i2 && i2.interpolationkey && i2.formatParams && i2.formatParams[i2.interpolationkey] && i2[i2.interpolationkey] && (a2 = { ...a2, [i2.interpolationkey]: void 0 });
|
|
2004
|
+
let o2 = r2 + JSON.stringify(a2), s2 = t2[o2];
|
|
2005
|
+
return s2 || (s2 = e6(U(r2), i2), t2[o2] = s2), s2(n2);
|
|
2006
|
+
};
|
|
2007
|
+
};
|
|
2008
|
+
var xi = (e6) => (t2, n2, r2) => e6(U(n2), r2)(t2);
|
|
2009
|
+
var Si = class {
|
|
2010
|
+
constructor(e6 = {}) {
|
|
2011
|
+
this.logger = W.create(`formatter`), this.options = e6, this.init(e6);
|
|
2012
|
+
}
|
|
2013
|
+
init(e6, t2 = { interpolation: {} }) {
|
|
2014
|
+
this.formatSeparator = t2.interpolation.formatSeparator || `,`;
|
|
2015
|
+
let n2 = t2.cacheInBuiltFormats ? bi : xi;
|
|
2016
|
+
this.formats = { number: n2((e7, t3) => {
|
|
2017
|
+
let n3 = new Intl.NumberFormat(e7, { ...t3 });
|
|
2018
|
+
return (e8) => n3.format(e8);
|
|
2019
|
+
}), currency: n2((e7, t3) => {
|
|
2020
|
+
let n3 = new Intl.NumberFormat(e7, { ...t3, style: `currency` });
|
|
2021
|
+
return (e8) => n3.format(e8);
|
|
2022
|
+
}), datetime: n2((e7, t3) => {
|
|
2023
|
+
let n3 = new Intl.DateTimeFormat(e7, { ...t3 });
|
|
2024
|
+
return (e8) => n3.format(e8);
|
|
2025
|
+
}), relativetime: n2((e7, t3) => {
|
|
2026
|
+
let n3 = new Intl.RelativeTimeFormat(e7, { ...t3 });
|
|
2027
|
+
return (e8) => n3.format(e8, t3.range || `day`);
|
|
2028
|
+
}), list: n2((e7, t3) => {
|
|
2029
|
+
let n3 = new Intl.ListFormat(e7, { ...t3 });
|
|
2030
|
+
return (e8) => n3.format(e8);
|
|
2031
|
+
}) };
|
|
2032
|
+
}
|
|
2033
|
+
add(e6, t2) {
|
|
2034
|
+
this.formats[e6.toLowerCase().trim()] = t2;
|
|
2035
|
+
}
|
|
2036
|
+
addCached(e6, t2) {
|
|
2037
|
+
this.formats[e6.toLowerCase().trim()] = bi(t2);
|
|
2038
|
+
}
|
|
2039
|
+
format(e6, t2, n2, r2 = {}) {
|
|
2040
|
+
if (!t2 || e6 == null) return e6;
|
|
2041
|
+
let i2 = t2.split(this.formatSeparator), a2 = [];
|
|
2042
|
+
for (let e7 = 0; e7 < i2.length; e7++) {
|
|
2043
|
+
let t3 = i2[e7];
|
|
2044
|
+
for (; t3.indexOf(`(`) > -1 && !t3.includes(`)`) && e7 + 1 < i2.length; ) t3 = `${t3}${this.formatSeparator}${i2[++e7]}`;
|
|
2045
|
+
a2.push(t3);
|
|
2046
|
+
}
|
|
2047
|
+
return a2.reduce((e7, t3) => {
|
|
2048
|
+
let { formatName: i3, formatOptions: a3 } = yi(t3);
|
|
2049
|
+
if (this.formats[i3]) {
|
|
2050
|
+
let t4 = e7;
|
|
2051
|
+
try {
|
|
2052
|
+
let o2 = r2?.formatParams?.[r2.interpolationkey] || {}, s2 = o2.locale || o2.lng || r2.locale || r2.lng || n2;
|
|
2053
|
+
t4 = this.formats[i3](e7, s2, { ...a3, ...r2, ...o2 });
|
|
2054
|
+
} catch (e8) {
|
|
2055
|
+
this.logger.warn(e8);
|
|
2056
|
+
}
|
|
2057
|
+
return t4;
|
|
2058
|
+
}
|
|
2059
|
+
return this.logger.warn(`there was no format function for ${i3}`), e7;
|
|
2060
|
+
}, e6);
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
var Ci = (e6, t2) => {
|
|
2064
|
+
e6.pending[t2] !== void 0 && (delete e6.pending[t2], e6.pendingCount--);
|
|
2065
|
+
};
|
|
2066
|
+
var wi = class extends G {
|
|
2067
|
+
constructor(e6, t2, n2, r2 = {}) {
|
|
2068
|
+
super(), this.backend = e6, this.store = t2, this.services = n2, this.languageUtils = n2.languageUtils, this.options = r2, this.logger = W.create(`backendConnector`), this.waitingReads = [], this.maxParallelReads = r2.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r2.maxRetries >= 0 ? r2.maxRetries : 5, this.retryTimeout = r2.retryTimeout >= 1 ? r2.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n2, r2.backend, r2);
|
|
2069
|
+
}
|
|
2070
|
+
queueLoad(e6, t2, n2, r2) {
|
|
2071
|
+
let i2 = {}, a2 = {}, o2 = {}, s2 = {};
|
|
2072
|
+
return e6.forEach((e7) => {
|
|
2073
|
+
let r3 = true;
|
|
2074
|
+
t2.forEach((t3) => {
|
|
2075
|
+
let o3 = `${e7}|${t3}`;
|
|
2076
|
+
!n2.reload && this.store.hasResourceBundle(e7, t3) ? this.state[o3] = 2 : this.state[o3] < 0 || (this.state[o3] === 1 ? a2[o3] === void 0 && (a2[o3] = true) : (this.state[o3] = 1, r3 = false, a2[o3] === void 0 && (a2[o3] = true), i2[o3] === void 0 && (i2[o3] = true), s2[t3] === void 0 && (s2[t3] = true)));
|
|
2077
|
+
}), r3 || (o2[e7] = true);
|
|
2078
|
+
}), (Object.keys(i2).length || Object.keys(a2).length) && this.queue.push({ pending: a2, pendingCount: Object.keys(a2).length, loaded: {}, errors: [], callback: r2 }), { toLoad: Object.keys(i2), pending: Object.keys(a2), toLoadLanguages: Object.keys(o2), toLoadNamespaces: Object.keys(s2) };
|
|
2079
|
+
}
|
|
2080
|
+
loaded(e6, t2, n2) {
|
|
2081
|
+
let r2 = e6.split(`|`), i2 = r2[0], a2 = r2[1];
|
|
2082
|
+
t2 && this.emit(`failedLoading`, i2, a2, t2), !t2 && n2 && this.store.addResourceBundle(i2, a2, n2, void 0, void 0, { skipCopy: true }), this.state[e6] = t2 ? -1 : 2, t2 && n2 && (this.state[e6] = 0);
|
|
2083
|
+
let o2 = {};
|
|
2084
|
+
this.queue.forEach((n3) => {
|
|
2085
|
+
Jr(n3.loaded, [i2], a2), Ci(n3, e6), t2 && n3.errors.push(t2), n3.pendingCount === 0 && !n3.done && (Object.keys(n3.loaded).forEach((e7) => {
|
|
2086
|
+
o2[e7] || (o2[e7] = {});
|
|
2087
|
+
let t3 = n3.loaded[e7];
|
|
2088
|
+
t3.length && t3.forEach((t4) => {
|
|
2089
|
+
o2[e7][t4] === void 0 && (o2[e7][t4] = true);
|
|
2090
|
+
});
|
|
2091
|
+
}), n3.done = true, n3.errors.length ? n3.callback(n3.errors) : n3.callback());
|
|
2092
|
+
}), this.emit(`loaded`, o2), this.queue = this.queue.filter((e7) => !e7.done);
|
|
2093
|
+
}
|
|
2094
|
+
read(e6, t2, n2, r2 = 0, i2 = this.retryTimeout, a2) {
|
|
2095
|
+
if (!e6.length) return a2(null, {});
|
|
2096
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
2097
|
+
this.waitingReads.push({ lng: e6, ns: t2, fcName: n2, tried: r2, wait: i2, callback: a2 });
|
|
2098
|
+
return;
|
|
2099
|
+
}
|
|
2100
|
+
this.readingCalls++;
|
|
2101
|
+
let o2 = (o3, s3) => {
|
|
2102
|
+
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
2103
|
+
let e7 = this.waitingReads.shift();
|
|
2104
|
+
this.read(e7.lng, e7.ns, e7.fcName, e7.tried, e7.wait, e7.callback);
|
|
2105
|
+
}
|
|
2106
|
+
o3 && s3 && r2 < this.maxRetries ? setTimeout(() => {
|
|
2107
|
+
this.read(e6, t2, n2, r2 + 1, i2 * 2, a2);
|
|
2108
|
+
}, i2) : a2(o3, s3);
|
|
2109
|
+
}, s2 = this.backend[n2].bind(this.backend);
|
|
2110
|
+
if (s2.length === 2) try {
|
|
2111
|
+
let n3 = s2(e6, t2);
|
|
2112
|
+
n3 && typeof n3.then == `function` ? n3.then((e7) => o2(null, e7)).catch(o2) : o2(null, n3);
|
|
2113
|
+
} catch (e7) {
|
|
2114
|
+
o2(e7);
|
|
2115
|
+
}
|
|
2116
|
+
else return s2(e6, t2, o2);
|
|
2117
|
+
}
|
|
2118
|
+
prepareLoading(e6, t2, n2 = {}, r2) {
|
|
2119
|
+
if (!this.backend) return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`), r2 && r2();
|
|
2120
|
+
R(e6) && (e6 = this.languageUtils.toResolveHierarchy(e6)), R(t2) && (t2 = [t2]);
|
|
2121
|
+
let i2 = this.queueLoad(e6, t2, n2, r2);
|
|
2122
|
+
if (!i2.toLoad.length) return i2.pending.length || r2(), null;
|
|
2123
|
+
i2.toLoad.forEach((e7) => {
|
|
2124
|
+
this.loadOne(e7);
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2127
|
+
load(e6, t2, n2) {
|
|
2128
|
+
this.prepareLoading(e6, t2, {}, n2);
|
|
2129
|
+
}
|
|
2130
|
+
reload(e6, t2, n2) {
|
|
2131
|
+
this.prepareLoading(e6, t2, { reload: true }, n2);
|
|
2132
|
+
}
|
|
2133
|
+
loadOne(e6, t2 = ``) {
|
|
2134
|
+
let n2 = e6.split(`|`), r2 = n2[0], i2 = n2[1];
|
|
2135
|
+
this.read(r2, i2, `read`, void 0, void 0, (n3, a2) => {
|
|
2136
|
+
n3 && this.logger.warn(`${t2}loading namespace ${i2} for language ${r2} failed`, n3), !n3 && a2 && this.logger.log(`${t2}loaded namespace ${i2} for language ${r2}`, a2), this.loaded(e6, n3, a2);
|
|
2137
|
+
});
|
|
2138
|
+
}
|
|
2139
|
+
saveMissing(e6, t2, n2, r2, i2, a2 = {}, o2 = () => {
|
|
2140
|
+
}) {
|
|
2141
|
+
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t2)) this.logger.warn(`did not save key "${n2}" as the namespace "${t2}" was not yet loaded`, `This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);
|
|
2142
|
+
else if (n2 != null && n2 !== ``) {
|
|
2143
|
+
if (this.backend?.create) {
|
|
2144
|
+
let s2 = { ...a2, isUpdate: i2 }, c2 = this.backend.create.bind(this.backend);
|
|
2145
|
+
if (c2.length < 6) try {
|
|
2146
|
+
let i3;
|
|
2147
|
+
i3 = c2.length === 5 ? c2(e6, t2, n2, r2, s2) : c2(e6, t2, n2, r2), i3 && typeof i3.then == `function` ? i3.then((e7) => o2(null, e7)).catch(o2) : o2(null, i3);
|
|
2148
|
+
} catch (e7) {
|
|
2149
|
+
o2(e7);
|
|
2150
|
+
}
|
|
2151
|
+
else c2(e6, t2, n2, r2, o2, s2);
|
|
2152
|
+
}
|
|
2153
|
+
e6 && e6[0] && this.store.addResource(e6[0], t2, n2, r2);
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
};
|
|
2157
|
+
var Ti = () => ({ debug: false, initAsync: true, ns: [`translation`], defaultNS: [`translation`], fallbackLng: [`dev`], fallbackNS: false, supportedLngs: false, nonExplicitSupportedLngs: false, load: `all`, preload: false, keySeparator: `.`, nsSeparator: `:`, pluralSeparator: `_`, contextSeparator: `_`, enableSelector: false, partialBundledLanguages: false, saveMissing: false, updateMissing: false, saveMissingTo: `fallback`, saveMissingPlurals: true, missingKeyHandler: false, missingInterpolationHandler: false, postProcess: false, postProcessPassResolved: false, returnNull: false, returnEmptyString: true, returnObjects: false, joinArrays: false, returnedObjectHandler: false, parseMissingKeyHandler: false, appendNamespaceToMissingKey: false, appendNamespaceToCIMode: false, overloadTranslationOptionHandler: (e6) => {
|
|
2158
|
+
let t2 = {};
|
|
2159
|
+
if (typeof e6[1] == `object` && (t2 = e6[1]), R(e6[1]) && (t2.defaultValue = e6[1]), R(e6[2]) && (t2.tDescription = e6[2]), typeof e6[2] == `object` || typeof e6[3] == `object`) {
|
|
2160
|
+
let n2 = e6[3] || e6[2];
|
|
2161
|
+
Object.keys(n2).forEach((e7) => {
|
|
2162
|
+
t2[e7] = n2[e7];
|
|
2163
|
+
});
|
|
2164
|
+
}
|
|
2165
|
+
return t2;
|
|
2166
|
+
}, interpolation: { escapeValue: true, prefix: `{{`, suffix: `}}`, formatSeparator: `,`, unescapePrefix: `-`, nestingPrefix: `$t(`, nestingSuffix: `)`, nestingOptionsSeparator: `,`, maxReplaces: 1e3, skipOnVariables: true }, cacheInBuiltFormats: true });
|
|
2167
|
+
var Ei = (e6) => (R(e6.ns) && (e6.ns = [e6.ns]), R(e6.fallbackLng) && (e6.fallbackLng = [e6.fallbackLng]), R(e6.fallbackNS) && (e6.fallbackNS = [e6.fallbackNS]), e6.supportedLngs && !e6.supportedLngs.includes(`cimode`) && (e6.supportedLngs = e6.supportedLngs.concat([`cimode`])), e6);
|
|
2168
|
+
var q = () => {
|
|
2169
|
+
};
|
|
2170
|
+
var Di = (e6) => {
|
|
2171
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(e6)).forEach((t2) => {
|
|
2172
|
+
typeof e6[t2] == `function` && (e6[t2] = e6[t2].bind(e6));
|
|
2173
|
+
});
|
|
2174
|
+
};
|
|
2175
|
+
var J = class e4 extends G {
|
|
2176
|
+
constructor(e6 = {}, t2) {
|
|
2177
|
+
if (super(), this.options = Ei(e6), this.services = {}, this.logger = W, this.modules = { external: [] }, Di(this), t2 && !this.isInitialized && !e6.isClone) {
|
|
2178
|
+
if (!this.options.initAsync) return this.init(e6, t2), this;
|
|
2179
|
+
setTimeout(() => {
|
|
2180
|
+
this.init(e6, t2);
|
|
2181
|
+
}, 0);
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
init(e6 = {}, t2) {
|
|
2185
|
+
this.isInitializing = true, typeof e6 == `function` && (t2 = e6, e6 = {}), e6.defaultNS == null && e6.ns && (R(e6.ns) ? e6.defaultNS = e6.ns : e6.ns.includes(`translation`) || (e6.defaultNS = e6.ns[0]));
|
|
2186
|
+
let n2 = Ti();
|
|
2187
|
+
this.options = { ...n2, ...this.options, ...Ei(e6) }, this.options.interpolation = { ...n2.interpolation, ...this.options.interpolation }, e6.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e6.keySeparator), e6.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e6.nsSeparator), typeof this.options.overloadTranslationOptionHandler != `function` && (this.options.overloadTranslationOptionHandler = n2.overloadTranslationOptionHandler);
|
|
2188
|
+
let r2 = (e7) => e7 ? typeof e7 == `function` ? new e7() : e7 : null;
|
|
2189
|
+
if (!this.options.isClone) {
|
|
2190
|
+
this.modules.logger ? W.init(r2(this.modules.logger), this.options) : W.init(null, this.options);
|
|
2191
|
+
let e7;
|
|
2192
|
+
e7 = this.modules.formatter ? this.modules.formatter : Si;
|
|
2193
|
+
let t3 = new fi(this.options);
|
|
2194
|
+
this.store = new oi(this.options.resources, this.options);
|
|
2195
|
+
let n3 = this.services;
|
|
2196
|
+
n3.logger = W, n3.resourceStore = this.store, n3.languageUtils = t3, n3.pluralResolver = new hi(t3, { prepend: this.options.pluralSeparator }), e7 && (n3.formatter = r2(e7), n3.formatter.init && n3.formatter.init(n3, this.options), this.options.interpolation.format = n3.formatter.format.bind(n3.formatter)), n3.interpolator = new vi(this.options), n3.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, n3.backendConnector = new wi(r2(this.modules.backend), n3.resourceStore, n3, this.options), n3.backendConnector.on(`*`, (e8, ...t4) => {
|
|
2197
|
+
this.emit(e8, ...t4);
|
|
2198
|
+
}), this.modules.languageDetector && (n3.languageDetector = r2(this.modules.languageDetector), n3.languageDetector.init && n3.languageDetector.init(n3, this.options.detection, this.options)), this.modules.i18nFormat && (n3.i18nFormat = r2(this.modules.i18nFormat), n3.i18nFormat.init && n3.i18nFormat.init(this)), this.translator = new di(this.services, this.options), this.translator.on(`*`, (e8, ...t4) => {
|
|
2199
|
+
this.emit(e8, ...t4);
|
|
2200
|
+
}), this.modules.external.forEach((e8) => {
|
|
2201
|
+
e8.init && e8.init(this);
|
|
2202
|
+
});
|
|
2203
|
+
}
|
|
2204
|
+
if (this.format = this.options.interpolation.format, t2 ||= q, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
2205
|
+
let e7 = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
2206
|
+
e7.length > 0 && e7[0] !== `dev` && (this.options.lng = e7[0]);
|
|
2207
|
+
}
|
|
2208
|
+
!this.services.languageDetector && !this.options.lng && this.logger.warn(`init: no languageDetector is used and no lng is defined`), [`getResource`, `hasResourceBundle`, `getResourceBundle`, `getDataByLanguage`].forEach((e7) => {
|
|
2209
|
+
this[e7] = (...t3) => this.store[e7](...t3);
|
|
2210
|
+
}), [`addResource`, `addResources`, `addResourceBundle`, `removeResourceBundle`].forEach((e7) => {
|
|
2211
|
+
this[e7] = (...t3) => (this.store[e7](...t3), this);
|
|
2212
|
+
});
|
|
2213
|
+
let i2 = z(), a2 = () => {
|
|
2214
|
+
let e7 = (e8, n3) => {
|
|
2215
|
+
this.isInitializing = false, this.isInitialized && !this.initializedStoreOnce && this.logger.warn(`init: i18next is already initialized. You should call init just once!`), this.isInitialized = true, this.options.isClone || this.logger.log(`initialized`, this.options), this.emit(`initialized`, this.options), i2.resolve(n3), t2(e8, n3);
|
|
2216
|
+
};
|
|
2217
|
+
if ((this.languages || this.isLanguageChangingTo) && !this.isInitialized) return e7(null, this.t.bind(this));
|
|
2218
|
+
this.changeLanguage(this.options.lng, e7);
|
|
2219
|
+
};
|
|
2220
|
+
return this.options.resources || !this.options.initAsync ? a2() : setTimeout(a2, 0), i2;
|
|
2221
|
+
}
|
|
2222
|
+
loadResources(e6, t2 = q) {
|
|
2223
|
+
let n2 = t2, r2 = R(e6) ? e6 : this.language;
|
|
2224
|
+
if (typeof e6 == `function` && (n2 = e6), !this.options.resources || this.options.partialBundledLanguages) {
|
|
2225
|
+
if (r2?.toLowerCase() === `cimode` && (!this.options.preload || this.options.preload.length === 0)) return n2();
|
|
2226
|
+
let e7 = [], t3 = (t4) => {
|
|
2227
|
+
t4 && t4 !== `cimode` && this.services.languageUtils.toResolveHierarchy(t4).forEach((t5) => {
|
|
2228
|
+
t5 !== `cimode` && (e7.includes(t5) || e7.push(t5));
|
|
2229
|
+
});
|
|
2230
|
+
};
|
|
2231
|
+
r2 ? t3(r2) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e8) => t3(e8)), this.options.preload?.forEach?.((e8) => t3(e8)), this.services.backendConnector.load(e7, this.options.ns, (e8) => {
|
|
2232
|
+
!e8 && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n2(e8);
|
|
2233
|
+
});
|
|
2234
|
+
} else n2(null);
|
|
2235
|
+
}
|
|
2236
|
+
reloadResources(e6, t2, n2) {
|
|
2237
|
+
let r2 = z();
|
|
2238
|
+
return typeof e6 == `function` && (n2 = e6, e6 = void 0), typeof t2 == `function` && (n2 = t2, t2 = void 0), e6 ||= this.languages, t2 ||= this.options.ns, n2 ||= q, this.services.backendConnector.reload(e6, t2, (e7) => {
|
|
2239
|
+
r2.resolve(), n2(e7);
|
|
2240
|
+
}), r2;
|
|
2241
|
+
}
|
|
2242
|
+
use(e6) {
|
|
2243
|
+
if (!e6) throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);
|
|
2244
|
+
if (!e6.type) throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);
|
|
2245
|
+
return e6.type === `backend` && (this.modules.backend = e6), (e6.type === `logger` || e6.log && e6.warn && e6.error) && (this.modules.logger = e6), e6.type === `languageDetector` && (this.modules.languageDetector = e6), e6.type === `i18nFormat` && (this.modules.i18nFormat = e6), e6.type === `postProcessor` && si.addPostProcessor(e6), e6.type === `formatter` && (this.modules.formatter = e6), e6.type === `3rdParty` && this.modules.external.push(e6), this;
|
|
2246
|
+
}
|
|
2247
|
+
setResolvedLanguage(e6) {
|
|
2248
|
+
if (e6 && this.languages && ![`cimode`, `dev`].includes(e6)) {
|
|
2249
|
+
for (let e7 = 0; e7 < this.languages.length; e7++) {
|
|
2250
|
+
let t2 = this.languages[e7];
|
|
2251
|
+
if (![`cimode`, `dev`].includes(t2) && this.store.hasLanguageSomeTranslations(t2)) {
|
|
2252
|
+
this.resolvedLanguage = t2;
|
|
2253
|
+
break;
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
!this.resolvedLanguage && !this.languages.includes(e6) && this.store.hasLanguageSomeTranslations(e6) && (this.resolvedLanguage = e6, this.languages.unshift(e6));
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
changeLanguage(e6, t2) {
|
|
2260
|
+
this.isLanguageChangingTo = e6;
|
|
2261
|
+
let n2 = z();
|
|
2262
|
+
this.emit(`languageChanging`, e6);
|
|
2263
|
+
let r2 = (e7) => {
|
|
2264
|
+
this.language = e7, this.languages = this.services.languageUtils.toResolveHierarchy(e7), this.resolvedLanguage = void 0, this.setResolvedLanguage(e7);
|
|
2265
|
+
}, i2 = (i3, a3) => {
|
|
2266
|
+
a3 ? this.isLanguageChangingTo === e6 && (r2(a3), this.translator.changeLanguage(a3), this.isLanguageChangingTo = void 0, this.emit(`languageChanged`, a3), this.logger.log(`languageChanged`, a3)) : this.isLanguageChangingTo = void 0, n2.resolve((...e7) => this.t(...e7)), t2 && t2(i3, (...e7) => this.t(...e7));
|
|
2267
|
+
}, a2 = (t3) => {
|
|
2268
|
+
!e6 && !t3 && this.services.languageDetector && (t3 = []);
|
|
2269
|
+
let n3 = R(t3) ? t3 : t3 && t3[0], a3 = this.store.hasLanguageSomeTranslations(n3) ? n3 : this.services.languageUtils.getBestMatchFromCodes(R(t3) ? [t3] : t3);
|
|
2270
|
+
a3 && (this.language || r2(a3), this.translator.language || this.translator.changeLanguage(a3), this.services.languageDetector?.cacheUserLanguage?.(a3)), this.loadResources(a3, (e7) => {
|
|
2271
|
+
i2(e7, a3);
|
|
2272
|
+
});
|
|
2273
|
+
};
|
|
2274
|
+
return !e6 && this.services.languageDetector && !this.services.languageDetector.async ? a2(this.services.languageDetector.detect()) : !e6 && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(a2) : this.services.languageDetector.detect(a2) : a2(e6), n2;
|
|
2275
|
+
}
|
|
2276
|
+
getFixedT(e6, t2, n2, r2) {
|
|
2277
|
+
let i2 = r2?.scopeNs, a2 = (e7, t3, ...r3) => {
|
|
2278
|
+
let o2;
|
|
2279
|
+
o2 = typeof t3 == `object` ? { ...t3 } : this.options.overloadTranslationOptionHandler([e7, t3].concat(r3)), o2.lng = o2.lng || a2.lng, o2.lngs = o2.lngs || a2.lngs;
|
|
2280
|
+
let s2 = o2.ns !== void 0 && o2.ns !== null;
|
|
2281
|
+
o2.ns = o2.ns || a2.ns, o2.keyPrefix !== `` && (o2.keyPrefix = o2.keyPrefix || n2 || a2.keyPrefix);
|
|
2282
|
+
let c2 = { ...this.options, ...o2 };
|
|
2283
|
+
Array.isArray(i2) && !s2 && (c2.ns = i2), typeof o2.keyPrefix == `function` && (o2.keyPrefix = K(o2.keyPrefix, c2));
|
|
2284
|
+
let l2 = this.options.keySeparator || `.`, u2;
|
|
2285
|
+
return o2.keyPrefix && Array.isArray(e7) ? u2 = e7.map((e8) => (typeof e8 == `function` && (e8 = K(e8, c2)), `${o2.keyPrefix}${l2}${e8}`)) : (typeof e7 == `function` && (e7 = K(e7, c2)), u2 = o2.keyPrefix ? `${o2.keyPrefix}${l2}${e7}` : e7), this.t(u2, o2);
|
|
2286
|
+
};
|
|
2287
|
+
return R(e6) ? a2.lng = e6 : a2.lngs = e6, a2.ns = t2, a2.keyPrefix = n2, a2;
|
|
2288
|
+
}
|
|
2289
|
+
t(...e6) {
|
|
2290
|
+
return this.translator?.translate(...e6);
|
|
2291
|
+
}
|
|
2292
|
+
exists(...e6) {
|
|
2293
|
+
return this.translator?.exists(...e6);
|
|
2294
|
+
}
|
|
2295
|
+
setDefaultNamespace(e6) {
|
|
2296
|
+
this.options.defaultNS = e6;
|
|
2297
|
+
}
|
|
2298
|
+
hasLoadedNamespace(e6, t2 = {}) {
|
|
2299
|
+
if (!this.isInitialized) return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`, this.languages), false;
|
|
2300
|
+
if (!this.languages || !this.languages.length) return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`, this.languages), false;
|
|
2301
|
+
let n2 = t2.lng || this.resolvedLanguage || this.languages[0], r2 = this.options ? this.options.fallbackLng : false, i2 = this.languages[this.languages.length - 1];
|
|
2302
|
+
if (n2.toLowerCase() === `cimode`) return true;
|
|
2303
|
+
let a2 = (e7, t3) => {
|
|
2304
|
+
let n3 = this.services.backendConnector.state[`${e7}|${t3}`];
|
|
2305
|
+
return n3 === -1 || n3 === 0 || n3 === 2;
|
|
2306
|
+
};
|
|
2307
|
+
if (t2.precheck) {
|
|
2308
|
+
let e7 = t2.precheck(this, a2);
|
|
2309
|
+
if (e7 !== void 0) return e7;
|
|
2310
|
+
}
|
|
2311
|
+
return !!(this.hasResourceBundle(n2, e6) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a2(n2, e6) && (!r2 || a2(i2, e6)));
|
|
2312
|
+
}
|
|
2313
|
+
loadNamespaces(e6, t2) {
|
|
2314
|
+
let n2 = z();
|
|
2315
|
+
return this.options.ns ? (R(e6) && (e6 = [e6]), e6.forEach((e7) => {
|
|
2316
|
+
this.options.ns.includes(e7) || this.options.ns.push(e7);
|
|
2317
|
+
}), this.loadResources((e7) => {
|
|
2318
|
+
n2.resolve(), t2 && t2(e7);
|
|
2319
|
+
}), n2) : (t2 && t2(), Promise.resolve());
|
|
2320
|
+
}
|
|
2321
|
+
loadLanguages(e6, t2) {
|
|
2322
|
+
let n2 = z();
|
|
2323
|
+
R(e6) && (e6 = [e6]);
|
|
2324
|
+
let r2 = this.options.preload || [], i2 = e6.filter((e7) => !r2.includes(e7) && this.services.languageUtils.isSupportedCode(e7));
|
|
2325
|
+
return i2.length ? (this.options.preload = r2.concat(i2), this.loadResources((e7) => {
|
|
2326
|
+
n2.resolve(), t2 && t2(e7);
|
|
2327
|
+
}), n2) : (t2 && t2(), Promise.resolve());
|
|
2328
|
+
}
|
|
2329
|
+
dir(e6) {
|
|
2330
|
+
if (e6 ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e6) return `rtl`;
|
|
2331
|
+
try {
|
|
2332
|
+
let t3 = new Intl.Locale(e6);
|
|
2333
|
+
if (t3 && t3.getTextInfo) {
|
|
2334
|
+
let e7 = t3.getTextInfo();
|
|
2335
|
+
if (e7 && e7.direction) return e7.direction;
|
|
2336
|
+
}
|
|
2337
|
+
} catch {
|
|
2338
|
+
}
|
|
2339
|
+
let t2 = `ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`), n2 = this.services?.languageUtils || new fi(Ti());
|
|
2340
|
+
return e6.toLowerCase().indexOf(`-latn`) > 1 ? `ltr` : t2.includes(n2.getLanguagePartFromCode(e6)) || e6.toLowerCase().indexOf(`-arab`) > 1 ? `rtl` : `ltr`;
|
|
2341
|
+
}
|
|
2342
|
+
static createInstance(t2 = {}, n2) {
|
|
2343
|
+
let r2 = new e4(t2, n2);
|
|
2344
|
+
return r2.createInstance = e4.createInstance, r2;
|
|
2345
|
+
}
|
|
2346
|
+
cloneInstance(t2 = {}, n2 = q) {
|
|
2347
|
+
let r2 = t2.forkResourceStore;
|
|
2348
|
+
r2 && delete t2.forkResourceStore;
|
|
2349
|
+
let i2 = { ...this.options, ...t2, isClone: true }, a2 = new e4(i2);
|
|
2350
|
+
if ((t2.debug !== void 0 || t2.prefix !== void 0) && (a2.logger = a2.logger.clone(t2)), [`store`, `services`, `language`].forEach((e6) => {
|
|
2351
|
+
a2[e6] = this[e6];
|
|
2352
|
+
}), a2.services = { ...this.services }, a2.services.utils = { hasLoadedNamespace: a2.hasLoadedNamespace.bind(a2) }, r2 && (a2.store = new oi(Object.keys(this.store.data).reduce((e6, t3) => (e6[t3] = { ...this.store.data[t3] }, e6[t3] = Object.keys(e6[t3]).reduce((n3, r3) => (n3[r3] = { ...e6[t3][r3] }, n3), e6[t3]), e6), {}), i2), a2.services.resourceStore = a2.store), t2.interpolation) {
|
|
2353
|
+
let e6 = { ...Ti().interpolation, ...this.options.interpolation, ...t2.interpolation }, n3 = { ...i2, interpolation: e6 };
|
|
2354
|
+
a2.services.interpolator = new vi(n3);
|
|
2355
|
+
}
|
|
2356
|
+
return a2.translator = new di(a2.services, i2), a2.translator.on(`*`, (e6, ...t3) => {
|
|
2357
|
+
a2.emit(e6, ...t3);
|
|
2358
|
+
}), a2.init(i2, n2), a2.translator.options = i2, a2.translator.backendConnector.services.utils = { hasLoadedNamespace: a2.hasLoadedNamespace.bind(a2) }, a2;
|
|
2359
|
+
}
|
|
2360
|
+
toJSON() {
|
|
2361
|
+
return { options: this.options, store: this.store, language: this.language, languages: this.languages, resolvedLanguage: this.resolvedLanguage };
|
|
2362
|
+
}
|
|
2363
|
+
}.createInstance();
|
|
2364
|
+
J.createInstance, J.dir, J.init, J.loadResources, J.reloadResources, J.use, J.changeLanguage, J.getFixedT, J.t, J.exists, J.setDefaultNamespace, J.hasLoadedNamespace, J.loadNamespaces, J.loadLanguages;
|
|
2365
|
+
var Oi = ({ locale: e6, asyncMessagesLoader: t2, messages: n2, useSuspense: r2 = false, disableAutoInit: i2 = false, bindI18n: a2 }, { icu: o2 } = {}) => {
|
|
2366
|
+
let s2 = { lng: e6, fallbackLng: `en`, keySeparator: false, react: { useSuspense: r2, bindI18n: a2 }, _polyfill: { isLoading: false } }, c2 = J.createInstance(i2 ? s2 : void 0);
|
|
2367
|
+
return o2 && c2.use(o2), t2 && c2.use({ type: `backend`, read: async (e7, n3, r3) => {
|
|
2368
|
+
try {
|
|
2369
|
+
return r3(null, await t2(e7));
|
|
2370
|
+
} catch (e8) {
|
|
2371
|
+
return r3(e8, null);
|
|
2372
|
+
}
|
|
2373
|
+
} }), n2 && (s2.resources = { [e6]: { translation: n2 } }), i2 || c2.init(s2), c2;
|
|
2374
|
+
};
|
|
2375
|
+
var ki = [`__proto__`, `constructor`, `prototype`];
|
|
2376
|
+
function Ai(e6, t2, n2) {
|
|
2377
|
+
function r2(e7) {
|
|
2378
|
+
return e7 && e7.indexOf(`###`) > -1 ? e7.replace(/###/g, `.`) : e7;
|
|
2379
|
+
}
|
|
2380
|
+
function i2() {
|
|
2381
|
+
return !e6 || typeof e6 == `string`;
|
|
2382
|
+
}
|
|
2383
|
+
for (var a2 = typeof t2 == `string` ? t2.split(`.`) : [].concat(t2); a2.length > 1; ) {
|
|
2384
|
+
if (i2()) return {};
|
|
2385
|
+
var o2 = r2(a2.shift());
|
|
2386
|
+
if (ki.indexOf(o2) > -1) return {};
|
|
2387
|
+
!e6[o2] && n2 && (e6[o2] = new n2()), e6 = e6[o2];
|
|
2388
|
+
}
|
|
2389
|
+
if (i2()) return {};
|
|
2390
|
+
var s2 = r2(a2.shift());
|
|
2391
|
+
return ki.indexOf(s2) > -1 ? {} : { obj: e6, k: s2 };
|
|
2392
|
+
}
|
|
2393
|
+
function ji(e6, t2, n2) {
|
|
2394
|
+
var r2 = Ai(e6, t2, Object), i2 = r2.obj, a2 = r2.k;
|
|
2395
|
+
i2 !== void 0 && (i2[a2] = n2);
|
|
2396
|
+
}
|
|
2397
|
+
function Mi(e6, t2) {
|
|
2398
|
+
var n2 = Ai(e6, t2), r2 = n2.obj, i2 = n2.k;
|
|
2399
|
+
if (r2) return r2[i2];
|
|
2400
|
+
}
|
|
2401
|
+
var Ni = [];
|
|
2402
|
+
var Pi = Ni.forEach;
|
|
2403
|
+
var Fi = Ni.slice;
|
|
2404
|
+
function Ii(e6) {
|
|
2405
|
+
return Pi.call(Fi.call(arguments, 1), function(t2) {
|
|
2406
|
+
if (t2) for (var n2 = 0, r2 = Object.keys(t2); n2 < r2.length; n2++) {
|
|
2407
|
+
var i2 = r2[n2];
|
|
2408
|
+
ki.indexOf(i2) > -1 || e6[i2] === void 0 && (e6[i2] = t2[i2]);
|
|
2409
|
+
}
|
|
2410
|
+
}), e6;
|
|
2411
|
+
}
|
|
2412
|
+
function Li(e6, t2) {
|
|
2413
|
+
let n2 = t2 && t2.cache ? t2.cache : qi, r2 = t2 && t2.serializer ? t2.serializer : Gi;
|
|
2414
|
+
return (t2 && t2.strategy ? t2.strategy : Hi)(e6, { cache: n2, serializer: r2 });
|
|
2415
|
+
}
|
|
2416
|
+
function Ri(e6) {
|
|
2417
|
+
return e6 == null || typeof e6 == `number` || typeof e6 == `boolean`;
|
|
2418
|
+
}
|
|
2419
|
+
function zi(e6, t2, n2, r2) {
|
|
2420
|
+
let i2 = Ri(r2) ? r2 : n2(r2), a2 = t2.get(i2);
|
|
2421
|
+
return a2 === void 0 && (a2 = e6.call(this, r2), t2.set(i2, a2)), a2;
|
|
2422
|
+
}
|
|
2423
|
+
function Bi(e6, t2, n2) {
|
|
2424
|
+
let r2 = Array.prototype.slice.call(arguments, 3), i2 = n2(r2), a2 = t2.get(i2);
|
|
2425
|
+
return a2 === void 0 && (a2 = e6.apply(this, r2), t2.set(i2, a2)), a2;
|
|
2426
|
+
}
|
|
2427
|
+
function Vi(e6, t2, n2, r2, i2) {
|
|
2428
|
+
return n2.bind(t2, e6, r2, i2);
|
|
2429
|
+
}
|
|
2430
|
+
function Hi(e6, t2) {
|
|
2431
|
+
let n2 = e6.length === 1 ? zi : Bi;
|
|
2432
|
+
return Vi(e6, this, n2, t2.cache.create(), t2.serializer);
|
|
2433
|
+
}
|
|
2434
|
+
function Ui(e6, t2) {
|
|
2435
|
+
return Vi(e6, this, Bi, t2.cache.create(), t2.serializer);
|
|
2436
|
+
}
|
|
2437
|
+
function Wi(e6, t2) {
|
|
2438
|
+
return Vi(e6, this, zi, t2.cache.create(), t2.serializer);
|
|
2439
|
+
}
|
|
2440
|
+
var Gi = function() {
|
|
2441
|
+
return JSON.stringify(arguments);
|
|
2442
|
+
};
|
|
2443
|
+
var Ki = class {
|
|
2444
|
+
constructor() {
|
|
2445
|
+
this.cache = /* @__PURE__ */ Object.create(null);
|
|
2446
|
+
}
|
|
2447
|
+
get(e6) {
|
|
2448
|
+
return this.cache[e6];
|
|
2449
|
+
}
|
|
2450
|
+
set(e6, t2) {
|
|
2451
|
+
this.cache[e6] = t2;
|
|
2452
|
+
}
|
|
2453
|
+
};
|
|
2454
|
+
var qi = { create: function() {
|
|
2455
|
+
return new Ki();
|
|
2456
|
+
} };
|
|
2457
|
+
var Ji = { variadic: Ui, monadic: Wi };
|
|
2458
|
+
var Yi = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
|
|
2459
|
+
function Xi(e6) {
|
|
2460
|
+
let t2 = {};
|
|
2461
|
+
return e6.replace(Yi, (e7) => {
|
|
2462
|
+
let n2 = e7.length;
|
|
2463
|
+
switch (e7[0]) {
|
|
2464
|
+
case `G`:
|
|
2465
|
+
t2.era = n2 === 4 ? `long` : n2 === 5 ? `narrow` : `short`;
|
|
2466
|
+
break;
|
|
2467
|
+
case `y`:
|
|
2468
|
+
t2.year = n2 === 2 ? `2-digit` : `numeric`;
|
|
2469
|
+
break;
|
|
2470
|
+
case `Y`:
|
|
2471
|
+
case `u`:
|
|
2472
|
+
case `U`:
|
|
2473
|
+
case `r`:
|
|
2474
|
+
throw RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");
|
|
2475
|
+
case `q`:
|
|
2476
|
+
case `Q`:
|
|
2477
|
+
throw RangeError("`q/Q` (quarter) patterns are not supported");
|
|
2478
|
+
case `M`:
|
|
2479
|
+
case `L`:
|
|
2480
|
+
t2.month = [`numeric`, `2-digit`, `short`, `long`, `narrow`][n2 - 1];
|
|
2481
|
+
break;
|
|
2482
|
+
case `w`:
|
|
2483
|
+
case `W`:
|
|
2484
|
+
throw RangeError("`w/W` (week) patterns are not supported");
|
|
2485
|
+
case `d`:
|
|
2486
|
+
t2.day = [`numeric`, `2-digit`][n2 - 1];
|
|
2487
|
+
break;
|
|
2488
|
+
case `D`:
|
|
2489
|
+
case `F`:
|
|
2490
|
+
case `g`:
|
|
2491
|
+
throw RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");
|
|
2492
|
+
case `E`:
|
|
2493
|
+
t2.weekday = n2 === 4 ? `long` : n2 === 5 ? `narrow` : `short`;
|
|
2494
|
+
break;
|
|
2495
|
+
case `e`:
|
|
2496
|
+
if (n2 < 4) throw RangeError("`e..eee` (weekday) patterns are not supported");
|
|
2497
|
+
t2.weekday = [`short`, `long`, `narrow`, `short`][n2 - 3];
|
|
2498
|
+
break;
|
|
2499
|
+
case `c`:
|
|
2500
|
+
if (n2 < 4) throw RangeError("`c..ccc` (weekday) patterns are not supported");
|
|
2501
|
+
t2.weekday = [`short`, `long`, `narrow`, `short`][n2 - 3];
|
|
2502
|
+
break;
|
|
2503
|
+
case `a`:
|
|
2504
|
+
t2.hour12 = true;
|
|
2505
|
+
break;
|
|
2506
|
+
case `b`:
|
|
2507
|
+
case `B`:
|
|
2508
|
+
throw RangeError("`b/B` (period) patterns are not supported, use `a` instead");
|
|
2509
|
+
case `h`:
|
|
2510
|
+
t2.hourCycle = `h12`, t2.hour = [`numeric`, `2-digit`][n2 - 1];
|
|
2511
|
+
break;
|
|
2512
|
+
case `H`:
|
|
2513
|
+
t2.hourCycle = `h23`, t2.hour = [`numeric`, `2-digit`][n2 - 1];
|
|
2514
|
+
break;
|
|
2515
|
+
case `K`:
|
|
2516
|
+
t2.hourCycle = `h11`, t2.hour = [`numeric`, `2-digit`][n2 - 1];
|
|
2517
|
+
break;
|
|
2518
|
+
case `k`:
|
|
2519
|
+
t2.hourCycle = `h24`, t2.hour = [`numeric`, `2-digit`][n2 - 1];
|
|
2520
|
+
break;
|
|
2521
|
+
case `j`:
|
|
2522
|
+
case `J`:
|
|
2523
|
+
case `C`:
|
|
2524
|
+
throw RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");
|
|
2525
|
+
case `m`:
|
|
2526
|
+
t2.minute = [`numeric`, `2-digit`][n2 - 1];
|
|
2527
|
+
break;
|
|
2528
|
+
case `s`:
|
|
2529
|
+
t2.second = [`numeric`, `2-digit`][n2 - 1];
|
|
2530
|
+
break;
|
|
2531
|
+
case `S`:
|
|
2532
|
+
case `A`:
|
|
2533
|
+
throw RangeError("`S/A` (second) patterns are not supported, use `s` instead");
|
|
2534
|
+
case `z`:
|
|
2535
|
+
t2.timeZoneName = n2 < 4 ? `short` : `long`;
|
|
2536
|
+
break;
|
|
2537
|
+
case `Z`:
|
|
2538
|
+
case `O`:
|
|
2539
|
+
case `v`:
|
|
2540
|
+
case `V`:
|
|
2541
|
+
case `X`:
|
|
2542
|
+
case `x`:
|
|
2543
|
+
throw RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead");
|
|
2544
|
+
}
|
|
2545
|
+
return ``;
|
|
2546
|
+
}), t2;
|
|
2547
|
+
}
|
|
2548
|
+
var Zi = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
|
|
2549
|
+
function Qi(e6) {
|
|
2550
|
+
if (e6.length === 0) throw Error(`Number skeleton cannot be empty`);
|
|
2551
|
+
let t2 = e6.split(Zi).filter((e7) => e7.length > 0), n2 = [];
|
|
2552
|
+
for (let e7 of t2) {
|
|
2553
|
+
let t3 = e7.split(`/`);
|
|
2554
|
+
if (t3.length === 0) throw Error(`Invalid number skeleton`);
|
|
2555
|
+
let [r2, ...i2] = t3;
|
|
2556
|
+
for (let e8 of i2) if (e8.length === 0) throw Error(`Invalid number skeleton`);
|
|
2557
|
+
n2.push({ stem: r2, options: i2 });
|
|
2558
|
+
}
|
|
2559
|
+
return n2;
|
|
2560
|
+
}
|
|
2561
|
+
function $i(e6) {
|
|
2562
|
+
return e6.replace(/^(.*?)-/, ``);
|
|
2563
|
+
}
|
|
2564
|
+
var ea = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
|
|
2565
|
+
var ta = /^(@+)?(\+|#+)?[rs]?$/g;
|
|
2566
|
+
var na = /(\*)(0+)|(#+)(0+)|(0+)/g;
|
|
2567
|
+
var ra = /^(0+)$/;
|
|
2568
|
+
function ia(e6) {
|
|
2569
|
+
let t2 = {};
|
|
2570
|
+
return e6[e6.length - 1] === `r` ? t2.roundingPriority = `morePrecision` : e6[e6.length - 1] === `s` && (t2.roundingPriority = `lessPrecision`), e6.replace(ta, function(e7, n2, r2) {
|
|
2571
|
+
return typeof r2 == `string` ? r2 === `+` ? t2.minimumSignificantDigits = n2.length : n2[0] === `#` ? t2.maximumSignificantDigits = n2.length : (t2.minimumSignificantDigits = n2.length, t2.maximumSignificantDigits = n2.length + (typeof r2 == `string` ? r2.length : 0)) : (t2.minimumSignificantDigits = n2.length, t2.maximumSignificantDigits = n2.length), ``;
|
|
2572
|
+
}), t2;
|
|
2573
|
+
}
|
|
2574
|
+
function aa(e6) {
|
|
2575
|
+
switch (e6) {
|
|
2576
|
+
case `sign-auto`:
|
|
2577
|
+
return { signDisplay: `auto` };
|
|
2578
|
+
case `sign-accounting`:
|
|
2579
|
+
case `()`:
|
|
2580
|
+
return { currencySign: `accounting` };
|
|
2581
|
+
case `sign-always`:
|
|
2582
|
+
case `+!`:
|
|
2583
|
+
return { signDisplay: `always` };
|
|
2584
|
+
case `sign-accounting-always`:
|
|
2585
|
+
case `()!`:
|
|
2586
|
+
return { signDisplay: `always`, currencySign: `accounting` };
|
|
2587
|
+
case `sign-except-zero`:
|
|
2588
|
+
case `+?`:
|
|
2589
|
+
return { signDisplay: `exceptZero` };
|
|
2590
|
+
case `sign-accounting-except-zero`:
|
|
2591
|
+
case `()?`:
|
|
2592
|
+
return { signDisplay: `exceptZero`, currencySign: `accounting` };
|
|
2593
|
+
case `sign-never`:
|
|
2594
|
+
case `+_`:
|
|
2595
|
+
return { signDisplay: `never` };
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
function oa(e6) {
|
|
2599
|
+
let t2;
|
|
2600
|
+
if (e6[0] === `E` && e6[1] === `E` ? (t2 = { notation: `engineering` }, e6 = e6.slice(2)) : e6[0] === `E` && (t2 = { notation: `scientific` }, e6 = e6.slice(1)), t2) {
|
|
2601
|
+
let n2 = e6.slice(0, 2);
|
|
2602
|
+
if (n2 === `+!` ? (t2.signDisplay = `always`, e6 = e6.slice(2)) : n2 === `+?` && (t2.signDisplay = `exceptZero`, e6 = e6.slice(2)), !ra.test(e6)) throw Error(`Malformed concise eng/scientific notation`);
|
|
2603
|
+
t2.minimumIntegerDigits = e6.length;
|
|
2604
|
+
}
|
|
2605
|
+
return t2;
|
|
2606
|
+
}
|
|
2607
|
+
function sa(e6) {
|
|
2608
|
+
return aa(e6) || {};
|
|
2609
|
+
}
|
|
2610
|
+
function ca(e6) {
|
|
2611
|
+
let t2 = {};
|
|
2612
|
+
for (let n2 of e6) {
|
|
2613
|
+
switch (n2.stem) {
|
|
2614
|
+
case `percent`:
|
|
2615
|
+
case `%`:
|
|
2616
|
+
t2.style = `percent`;
|
|
2617
|
+
continue;
|
|
2618
|
+
case `%x100`:
|
|
2619
|
+
t2.style = `percent`, t2.scale = 100;
|
|
2620
|
+
continue;
|
|
2621
|
+
case `currency`:
|
|
2622
|
+
t2.style = `currency`, t2.currency = n2.options[0];
|
|
2623
|
+
continue;
|
|
2624
|
+
case `group-off`:
|
|
2625
|
+
case `,_`:
|
|
2626
|
+
t2.useGrouping = false;
|
|
2627
|
+
continue;
|
|
2628
|
+
case `precision-integer`:
|
|
2629
|
+
case `.`:
|
|
2630
|
+
t2.maximumFractionDigits = 0;
|
|
2631
|
+
continue;
|
|
2632
|
+
case `measure-unit`:
|
|
2633
|
+
case `unit`:
|
|
2634
|
+
t2.style = `unit`, t2.unit = $i(n2.options[0]);
|
|
2635
|
+
continue;
|
|
2636
|
+
case `compact-short`:
|
|
2637
|
+
case `K`:
|
|
2638
|
+
t2.notation = `compact`, t2.compactDisplay = `short`;
|
|
2639
|
+
continue;
|
|
2640
|
+
case `compact-long`:
|
|
2641
|
+
case `KK`:
|
|
2642
|
+
t2.notation = `compact`, t2.compactDisplay = `long`;
|
|
2643
|
+
continue;
|
|
2644
|
+
case `scientific`:
|
|
2645
|
+
t2 = { ...t2, notation: `scientific`, ...n2.options.reduce((e8, t3) => ({ ...e8, ...sa(t3) }), {}) };
|
|
2646
|
+
continue;
|
|
2647
|
+
case `engineering`:
|
|
2648
|
+
t2 = { ...t2, notation: `engineering`, ...n2.options.reduce((e8, t3) => ({ ...e8, ...sa(t3) }), {}) };
|
|
2649
|
+
continue;
|
|
2650
|
+
case `notation-simple`:
|
|
2651
|
+
t2.notation = `standard`;
|
|
2652
|
+
continue;
|
|
2653
|
+
case `unit-width-narrow`:
|
|
2654
|
+
t2.currencyDisplay = `narrowSymbol`, t2.unitDisplay = `narrow`;
|
|
2655
|
+
continue;
|
|
2656
|
+
case `unit-width-short`:
|
|
2657
|
+
t2.currencyDisplay = `code`, t2.unitDisplay = `short`;
|
|
2658
|
+
continue;
|
|
2659
|
+
case `unit-width-full-name`:
|
|
2660
|
+
t2.currencyDisplay = `name`, t2.unitDisplay = `long`;
|
|
2661
|
+
continue;
|
|
2662
|
+
case `unit-width-iso-code`:
|
|
2663
|
+
t2.currencyDisplay = `symbol`;
|
|
2664
|
+
continue;
|
|
2665
|
+
case `scale`:
|
|
2666
|
+
t2.scale = parseFloat(n2.options[0]);
|
|
2667
|
+
continue;
|
|
2668
|
+
case `rounding-mode-floor`:
|
|
2669
|
+
t2.roundingMode = `floor`;
|
|
2670
|
+
continue;
|
|
2671
|
+
case `rounding-mode-ceiling`:
|
|
2672
|
+
t2.roundingMode = `ceil`;
|
|
2673
|
+
continue;
|
|
2674
|
+
case `rounding-mode-down`:
|
|
2675
|
+
t2.roundingMode = `trunc`;
|
|
2676
|
+
continue;
|
|
2677
|
+
case `rounding-mode-up`:
|
|
2678
|
+
t2.roundingMode = `expand`;
|
|
2679
|
+
continue;
|
|
2680
|
+
case `rounding-mode-half-even`:
|
|
2681
|
+
t2.roundingMode = `halfEven`;
|
|
2682
|
+
continue;
|
|
2683
|
+
case `rounding-mode-half-down`:
|
|
2684
|
+
t2.roundingMode = `halfTrunc`;
|
|
2685
|
+
continue;
|
|
2686
|
+
case `rounding-mode-half-up`:
|
|
2687
|
+
t2.roundingMode = `halfExpand`;
|
|
2688
|
+
continue;
|
|
2689
|
+
case `integer-width`:
|
|
2690
|
+
if (n2.options.length > 1) throw RangeError(`integer-width stems only accept a single optional option`);
|
|
2691
|
+
n2.options[0].replace(na, function(e8, n3, r3, i2, a2, o2) {
|
|
2692
|
+
if (n3) t2.minimumIntegerDigits = r3.length;
|
|
2693
|
+
else if (i2 && a2) throw Error(`We currently do not support maximum integer digits`);
|
|
2694
|
+
else if (o2) throw Error(`We currently do not support exact integer digits`);
|
|
2695
|
+
return ``;
|
|
2696
|
+
});
|
|
2697
|
+
continue;
|
|
2698
|
+
}
|
|
2699
|
+
if (ra.test(n2.stem)) {
|
|
2700
|
+
t2.minimumIntegerDigits = n2.stem.length;
|
|
2701
|
+
continue;
|
|
2702
|
+
}
|
|
2703
|
+
if (ea.test(n2.stem)) {
|
|
2704
|
+
if (n2.options.length > 1) throw RangeError(`Fraction-precision stems only accept a single optional option`);
|
|
2705
|
+
n2.stem.replace(ea, function(e9, n3, r3, i2, a2, o2) {
|
|
2706
|
+
return r3 === `*` ? t2.minimumFractionDigits = n3.length : i2 && i2[0] === `#` ? t2.maximumFractionDigits = i2.length : a2 && o2 ? (t2.minimumFractionDigits = a2.length, t2.maximumFractionDigits = a2.length + o2.length) : (t2.minimumFractionDigits = n3.length, t2.maximumFractionDigits = n3.length), ``;
|
|
2707
|
+
});
|
|
2708
|
+
let e8 = n2.options[0];
|
|
2709
|
+
e8 === `w` ? t2 = { ...t2, trailingZeroDisplay: `stripIfInteger` } : e8 && (t2 = { ...t2, ...ia(e8) });
|
|
2710
|
+
continue;
|
|
2711
|
+
}
|
|
2712
|
+
if (ta.test(n2.stem)) {
|
|
2713
|
+
t2 = { ...t2, ...ia(n2.stem) };
|
|
2714
|
+
continue;
|
|
2715
|
+
}
|
|
2716
|
+
let e7 = aa(n2.stem);
|
|
2717
|
+
e7 && (t2 = { ...t2, ...e7 });
|
|
2718
|
+
let r2 = oa(n2.stem);
|
|
2719
|
+
r2 && (t2 = { ...t2, ...r2 });
|
|
2720
|
+
}
|
|
2721
|
+
return t2;
|
|
2722
|
+
}
|
|
2723
|
+
var la = function(e6) {
|
|
2724
|
+
return e6[e6.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = `EXPECT_ARGUMENT_CLOSING_BRACE`, e6[e6.EMPTY_ARGUMENT = 2] = `EMPTY_ARGUMENT`, e6[e6.MALFORMED_ARGUMENT = 3] = `MALFORMED_ARGUMENT`, e6[e6.EXPECT_ARGUMENT_TYPE = 4] = `EXPECT_ARGUMENT_TYPE`, e6[e6.INVALID_ARGUMENT_TYPE = 5] = `INVALID_ARGUMENT_TYPE`, e6[e6.EXPECT_ARGUMENT_STYLE = 6] = `EXPECT_ARGUMENT_STYLE`, e6[e6.INVALID_NUMBER_SKELETON = 7] = `INVALID_NUMBER_SKELETON`, e6[e6.INVALID_DATE_TIME_SKELETON = 8] = `INVALID_DATE_TIME_SKELETON`, e6[e6.EXPECT_NUMBER_SKELETON = 9] = `EXPECT_NUMBER_SKELETON`, e6[e6.EXPECT_DATE_TIME_SKELETON = 10] = `EXPECT_DATE_TIME_SKELETON`, e6[e6.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = `UNCLOSED_QUOTE_IN_ARGUMENT_STYLE`, e6[e6.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = `EXPECT_SELECT_ARGUMENT_OPTIONS`, e6[e6.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = `EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE`, e6[e6.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = `INVALID_PLURAL_ARGUMENT_OFFSET_VALUE`, e6[e6.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = `EXPECT_SELECT_ARGUMENT_SELECTOR`, e6[e6.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = `EXPECT_PLURAL_ARGUMENT_SELECTOR`, e6[e6.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = `EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT`, e6[e6.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = `EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT`, e6[e6.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = `INVALID_PLURAL_ARGUMENT_SELECTOR`, e6[e6.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = `DUPLICATE_PLURAL_ARGUMENT_SELECTOR`, e6[e6.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = `DUPLICATE_SELECT_ARGUMENT_SELECTOR`, e6[e6.MISSING_OTHER_CLAUSE = 22] = `MISSING_OTHER_CLAUSE`, e6[e6.INVALID_TAG = 23] = `INVALID_TAG`, e6[e6.INVALID_TAG_NAME = 25] = `INVALID_TAG_NAME`, e6[e6.UNMATCHED_CLOSING_TAG = 26] = `UNMATCHED_CLOSING_TAG`, e6[e6.UNCLOSED_TAG = 27] = `UNCLOSED_TAG`, e6;
|
|
2725
|
+
}({});
|
|
2726
|
+
function ua(e6) {
|
|
2727
|
+
return e6.type === 0;
|
|
2728
|
+
}
|
|
2729
|
+
function da(e6) {
|
|
2730
|
+
return e6.type === 1;
|
|
2731
|
+
}
|
|
2732
|
+
function fa(e6) {
|
|
2733
|
+
return e6.type === 2;
|
|
2734
|
+
}
|
|
2735
|
+
function pa(e6) {
|
|
2736
|
+
return e6.type === 3;
|
|
2737
|
+
}
|
|
2738
|
+
function ma(e6) {
|
|
2739
|
+
return e6.type === 4;
|
|
2740
|
+
}
|
|
2741
|
+
function ha(e6) {
|
|
2742
|
+
return e6.type === 5;
|
|
2743
|
+
}
|
|
2744
|
+
function ga(e6) {
|
|
2745
|
+
return e6.type === 6;
|
|
2746
|
+
}
|
|
2747
|
+
function _a(e6) {
|
|
2748
|
+
return e6.type === 7;
|
|
2749
|
+
}
|
|
2750
|
+
function va(e6) {
|
|
2751
|
+
return e6.type === 8;
|
|
2752
|
+
}
|
|
2753
|
+
function ya(e6) {
|
|
2754
|
+
return !!(e6 && typeof e6 == `object` && e6.type === 0);
|
|
2755
|
+
}
|
|
2756
|
+
function ba(e6) {
|
|
2757
|
+
return !!(e6 && typeof e6 == `object` && e6.type === 1);
|
|
2758
|
+
}
|
|
2759
|
+
var xa = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
|
2760
|
+
var Y = { "001": [`H`, `h`], 419: [`h`, `H`, `hB`, `hb`], AC: [`H`, `h`, `hb`, `hB`], AD: [`H`, `hB`], AE: [`h`, `hB`, `hb`, `H`], AF: [`H`, `hb`, `hB`, `h`], AG: [`h`, `hb`, `H`, `hB`], AI: [`H`, `h`, `hb`, `hB`], AL: [`h`, `H`, `hB`], AM: [`H`, `hB`], AO: [`H`, `hB`], AR: [`h`, `H`, `hB`, `hb`], AS: [`h`, `H`], AT: [`H`, `hB`], AU: [`h`, `hb`, `H`, `hB`], AW: [`H`, `hB`], AX: [`H`], AZ: [`H`, `hB`, `h`], BA: [`H`, `hB`, `h`], BB: [`h`, `hb`, `H`, `hB`], BD: [`h`, `hB`, `H`], BE: [`H`, `hB`], BF: [`H`, `hB`], BG: [`H`, `hB`, `h`], BH: [`h`, `hB`, `hb`, `H`], BI: [`H`, `h`], BJ: [`H`, `hB`], BL: [`H`, `hB`], BM: [`h`, `hb`, `H`, `hB`], BN: [`hb`, `hB`, `h`, `H`], BO: [`h`, `H`, `hB`, `hb`], BQ: [`H`], BR: [`H`, `hB`], BS: [`h`, `hb`, `H`, `hB`], BT: [`h`, `H`], BW: [`H`, `h`, `hb`, `hB`], BY: [`H`, `h`], BZ: [`H`, `h`, `hb`, `hB`], CA: [`h`, `hb`, `H`, `hB`], CC: [`H`, `h`, `hb`, `hB`], CD: [`hB`, `H`], CF: [`H`, `h`, `hB`], CG: [`H`, `hB`], CH: [`H`, `hB`, `h`], CI: [`H`, `hB`], CK: [`H`, `h`, `hb`, `hB`], CL: [`h`, `H`, `hB`, `hb`], CM: [`H`, `h`, `hB`], CN: [`H`, `hB`, `hb`, `h`], CO: [`h`, `H`, `hB`, `hb`], CP: [`H`], CR: [`h`, `H`, `hB`, `hb`], CU: [`h`, `H`, `hB`, `hb`], CV: [`H`, `hB`], CW: [`H`, `hB`], CX: [`H`, `h`, `hb`, `hB`], CY: [`h`, `H`, `hb`, `hB`], CZ: [`H`], DE: [`H`, `hB`], DG: [`H`, `h`, `hb`, `hB`], DJ: [`h`, `H`], DK: [`H`], DM: [`h`, `hb`, `H`, `hB`], DO: [`h`, `H`, `hB`, `hb`], DZ: [`h`, `hB`, `hb`, `H`], EA: [`H`, `h`, `hB`, `hb`], EC: [`h`, `H`, `hB`, `hb`], EE: [`H`, `hB`], EG: [`h`, `hB`, `hb`, `H`], EH: [`h`, `hB`, `hb`, `H`], ER: [`h`, `H`], ES: [`H`, `hB`, `h`, `hb`], ET: [`hB`, `hb`, `h`, `H`], FI: [`H`], FJ: [`h`, `hb`, `H`, `hB`], FK: [`H`, `h`, `hb`, `hB`], FM: [`h`, `hb`, `H`, `hB`], FO: [`H`, `h`], FR: [`H`, `hB`], GA: [`H`, `hB`], GB: [`H`, `h`, `hb`, `hB`], GD: [`h`, `hb`, `H`, `hB`], GE: [`H`, `hB`, `h`], GF: [`H`, `hB`], GG: [`H`, `h`, `hb`, `hB`], GH: [`h`, `H`], GI: [`H`, `h`, `hb`, `hB`], GL: [`H`, `h`], GM: [`h`, `hb`, `H`, `hB`], GN: [`H`, `hB`], GP: [`H`, `hB`], GQ: [`H`, `hB`, `h`, `hb`], GR: [`h`, `H`, `hb`, `hB`], GS: [`H`, `h`, `hb`, `hB`], GT: [`h`, `H`, `hB`, `hb`], GU: [`h`, `hb`, `H`, `hB`], GW: [`H`, `hB`], GY: [`h`, `hb`, `H`, `hB`], HK: [`h`, `hB`, `hb`, `H`], HN: [`h`, `H`, `hB`, `hb`], HR: [`H`, `hB`], HU: [`H`, `h`], IC: [`H`, `h`, `hB`, `hb`], ID: [`H`], IE: [`H`, `h`, `hb`, `hB`], IL: [`H`, `hB`], IM: [`H`, `h`, `hb`, `hB`], IN: [`h`, `H`], IO: [`H`, `h`, `hb`, `hB`], IQ: [`h`, `hB`, `hb`, `H`], IR: [`hB`, `H`], IS: [`H`], IT: [`H`, `hB`], JE: [`H`, `h`, `hb`, `hB`], JM: [`h`, `hb`, `H`, `hB`], JO: [`h`, `hB`, `hb`, `H`], JP: [`H`, `K`, `h`], KE: [`hB`, `hb`, `H`, `h`], KG: [`H`, `h`, `hB`, `hb`], KH: [`hB`, `h`, `H`, `hb`], KI: [`h`, `hb`, `H`, `hB`], KM: [`H`, `h`, `hB`, `hb`], KN: [`h`, `hb`, `H`, `hB`], KP: [`h`, `H`, `hB`, `hb`], KR: [`h`, `H`, `hB`, `hb`], KW: [`h`, `hB`, `hb`, `H`], KY: [`h`, `hb`, `H`, `hB`], KZ: [`H`, `hB`], LA: [`H`, `hb`, `hB`, `h`], LB: [`h`, `hB`, `hb`, `H`], LC: [`h`, `hb`, `H`, `hB`], LI: [`H`, `hB`, `h`], LK: [`H`, `h`, `hB`, `hb`], LR: [`h`, `hb`, `H`, `hB`], LS: [`h`, `H`], LT: [`H`, `h`, `hb`, `hB`], LU: [`H`, `h`, `hB`], LV: [`H`, `hB`, `hb`, `h`], LY: [`h`, `hB`, `hb`, `H`], MA: [`H`, `h`, `hB`, `hb`], MC: [`H`, `hB`], MD: [`H`, `hB`], ME: [`H`, `hB`, `h`], MF: [`H`, `hB`], MG: [`H`, `h`], MH: [`h`, `hb`, `H`, `hB`], MK: [`H`, `h`, `hb`, `hB`], ML: [`H`], MM: [`hB`, `hb`, `H`, `h`], MN: [`H`, `h`, `hb`, `hB`], MO: [`h`, `hB`, `hb`, `H`], MP: [`h`, `hb`, `H`, `hB`], MQ: [`H`, `hB`], MR: [`h`, `hB`, `hb`, `H`], MS: [`H`, `h`, `hb`, `hB`], MT: [`H`, `h`], MU: [`H`, `h`], MV: [`H`, `h`], MW: [`h`, `hb`, `H`, `hB`], MX: [`h`, `H`, `hB`, `hb`], MY: [`hb`, `hB`, `h`, `H`], MZ: [`H`, `hB`], NA: [`h`, `H`, `hB`, `hb`], NC: [`H`, `hB`], NE: [`H`], NF: [`H`, `h`, `hb`, `hB`], NG: [`H`, `h`, `hb`, `hB`], NI: [`h`, `H`, `hB`, `hb`], NL: [`H`, `hB`], NO: [`H`, `h`], NP: [`H`, `h`, `hB`], NR: [`H`, `h`, `hb`, `hB`], NU: [`H`, `h`, `hb`, `hB`], NZ: [`h`, `hb`, `H`, `hB`], OM: [`h`, `hB`, `hb`, `H`], PA: [`h`, `H`, `hB`, `hb`], PE: [`h`, `H`, `hB`, `hb`], PF: [`H`, `h`, `hB`], PG: [`h`, `H`], PH: [`h`, `hB`, `hb`, `H`], PK: [`h`, `hB`, `H`], PL: [`H`, `h`], PM: [`H`, `hB`], PN: [`H`, `h`, `hb`, `hB`], PR: [`h`, `H`, `hB`, `hb`], PS: [`h`, `hB`, `hb`, `H`], PT: [`H`, `hB`], PW: [`h`, `H`], PY: [`h`, `H`, `hB`, `hb`], QA: [`h`, `hB`, `hb`, `H`], RE: [`H`, `hB`], RO: [`H`, `hB`], RS: [`H`, `hB`, `h`], RU: [`H`], RW: [`H`, `h`], SA: [`h`, `hB`, `hb`, `H`], SB: [`h`, `hb`, `H`, `hB`], SC: [`H`, `h`, `hB`], SD: [`h`, `hB`, `hb`, `H`], SE: [`H`], SG: [`h`, `hb`, `H`, `hB`], SH: [`H`, `h`, `hb`, `hB`], SI: [`H`, `hB`], SJ: [`H`], SK: [`H`], SL: [`h`, `hb`, `H`, `hB`], SM: [`H`, `h`, `hB`], SN: [`H`, `h`, `hB`], SO: [`h`, `H`], SR: [`H`, `hB`], SS: [`h`, `hb`, `H`, `hB`], ST: [`H`, `hB`], SV: [`h`, `H`, `hB`, `hb`], SX: [`H`, `h`, `hb`, `hB`], SY: [`h`, `hB`, `hb`, `H`], SZ: [`h`, `hb`, `H`, `hB`], TA: [`H`, `h`, `hb`, `hB`], TC: [`h`, `hb`, `H`, `hB`], TD: [`h`, `H`, `hB`], TF: [`H`, `h`, `hB`], TG: [`H`, `hB`], TH: [`H`, `h`], TJ: [`H`, `h`], TL: [`H`, `hB`, `hb`, `h`], TM: [`H`, `h`], TN: [`h`, `hB`, `hb`, `H`], TO: [`h`, `H`], TR: [`H`, `hB`], TT: [`h`, `hb`, `H`, `hB`], TW: [`hB`, `hb`, `h`, `H`], TZ: [`hB`, `hb`, `H`, `h`], UA: [`H`, `hB`, `h`], UG: [`hB`, `hb`, `H`, `h`], UM: [`h`, `hb`, `H`, `hB`], US: [`h`, `hb`, `H`, `hB`], UY: [`h`, `H`, `hB`, `hb`], UZ: [`H`, `hB`, `h`], VA: [`H`, `h`, `hB`], VC: [`h`, `hb`, `H`, `hB`], VE: [`h`, `H`, `hB`, `hb`], VG: [`h`, `hb`, `H`, `hB`], VI: [`h`, `hb`, `H`, `hB`], VN: [`H`, `h`], VU: [`h`, `H`], WF: [`H`, `hB`], WS: [`h`, `H`], XK: [`H`, `hB`, `h`], YE: [`h`, `hB`, `hb`, `H`], YT: [`H`, `hB`], ZA: [`H`, `h`, `hb`, `hB`], ZM: [`h`, `hb`, `H`, `hB`], ZW: [`H`, `h`], "af-ZA": [`H`, `h`, `hB`, `hb`], "ar-001": [`h`, `hB`, `hb`, `H`], "ca-ES": [`H`, `h`, `hB`], "en-001": [`h`, `hb`, `H`, `hB`], "en-HK": [`h`, `hb`, `H`, `hB`], "en-IL": [`H`, `h`, `hb`, `hB`], "en-MY": [`h`, `hb`, `H`, `hB`], "es-BR": [`H`, `h`, `hB`, `hb`], "es-ES": [`H`, `h`, `hB`, `hb`], "es-GQ": [`H`, `h`, `hB`, `hb`], "fr-CA": [`H`, `h`, `hB`], "gl-ES": [`H`, `h`, `hB`], "gu-IN": [`hB`, `hb`, `h`, `H`], "hi-IN": [`hB`, `h`, `H`], "it-CH": [`H`, `h`, `hB`], "it-IT": [`H`, `h`, `hB`], "kn-IN": [`hB`, `h`, `H`], "ku-SY": [`H`, `hB`], "ml-IN": [`hB`, `h`, `H`], "mr-IN": [`hB`, `hb`, `h`, `H`], "pa-IN": [`hB`, `hb`, `h`, `H`], "ta-IN": [`hB`, `h`, `hb`, `H`], "te-IN": [`hB`, `h`, `H`], "zu-ZA": [`H`, `hB`, `hb`, `h`] };
|
|
2761
|
+
function Sa(e6, t2) {
|
|
2762
|
+
let n2 = ``;
|
|
2763
|
+
for (let r2 = 0; r2 < e6.length; r2++) {
|
|
2764
|
+
let i2 = e6.charAt(r2);
|
|
2765
|
+
if (i2 === `j`) {
|
|
2766
|
+
let a2 = 0;
|
|
2767
|
+
for (; r2 + 1 < e6.length && e6.charAt(r2 + 1) === i2; ) a2++, r2++;
|
|
2768
|
+
let o2 = 1 + (a2 & 1), s2 = a2 < 2 ? 1 : 3 + (a2 >> 1), c2 = Ca(t2);
|
|
2769
|
+
for ((c2 == `H` || c2 == `k`) && (s2 = 0); s2-- > 0; ) n2 += `a`;
|
|
2770
|
+
for (; o2-- > 0; ) n2 = c2 + n2;
|
|
2771
|
+
} else n2 += i2 === `J` ? `H` : i2;
|
|
2772
|
+
}
|
|
2773
|
+
return n2;
|
|
2774
|
+
}
|
|
2775
|
+
function Ca(e6) {
|
|
2776
|
+
let t2 = e6.hourCycle;
|
|
2777
|
+
if (t2 === void 0) {
|
|
2778
|
+
let n3 = e6;
|
|
2779
|
+
t2 = n3.getHourCycles?.()[0] ?? n3.hourCycles?.[0];
|
|
2780
|
+
}
|
|
2781
|
+
if (t2) switch (t2) {
|
|
2782
|
+
case `h24`:
|
|
2783
|
+
return `k`;
|
|
2784
|
+
case `h23`:
|
|
2785
|
+
return `H`;
|
|
2786
|
+
case `h12`:
|
|
2787
|
+
return `h`;
|
|
2788
|
+
case `h11`:
|
|
2789
|
+
return `K`;
|
|
2790
|
+
default:
|
|
2791
|
+
throw Error(`Invalid hourCycle`);
|
|
2792
|
+
}
|
|
2793
|
+
let n2 = e6.language, r2;
|
|
2794
|
+
return n2 !== `root` && (r2 = e6.maximize().region), (Y[`${n2}-${r2}`] || Y[r2 || ``] || Y[n2 || ``] || Y[`${n2}-001`] || Y[`001`])[0].charAt(0);
|
|
2795
|
+
}
|
|
2796
|
+
var wa = RegExp(`^${xa.source}*`);
|
|
2797
|
+
var Ta = RegExp(`${xa.source}*$`);
|
|
2798
|
+
function X(e6, t2) {
|
|
2799
|
+
return { start: e6, end: t2 };
|
|
2800
|
+
}
|
|
2801
|
+
var Ea = !!Object.fromEntries;
|
|
2802
|
+
var Da = !!String.prototype.trimStart;
|
|
2803
|
+
var Oa = !!String.prototype.trimEnd;
|
|
2804
|
+
var ka = Ea ? Object.fromEntries : function(e6) {
|
|
2805
|
+
let t2 = {};
|
|
2806
|
+
for (let [n2, r2] of e6) t2[n2] = r2;
|
|
2807
|
+
return t2;
|
|
2808
|
+
};
|
|
2809
|
+
var Aa = Da ? function(e6) {
|
|
2810
|
+
return e6.trimStart();
|
|
2811
|
+
} : function(e6) {
|
|
2812
|
+
return e6.replace(wa, ``);
|
|
2813
|
+
};
|
|
2814
|
+
var ja = Oa ? function(e6) {
|
|
2815
|
+
return e6.trimEnd();
|
|
2816
|
+
} : function(e6) {
|
|
2817
|
+
return e6.replace(Ta, ``);
|
|
2818
|
+
};
|
|
2819
|
+
var Ma = RegExp(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`, `yu`);
|
|
2820
|
+
function Na(e6, t2) {
|
|
2821
|
+
return Ma.lastIndex = t2, Ma.exec(e6)[1] ?? ``;
|
|
2822
|
+
}
|
|
2823
|
+
function Pa(e6) {
|
|
2824
|
+
if (e6.length === 0) return null;
|
|
2825
|
+
let t2 = 1, n2 = 1;
|
|
2826
|
+
for (let r2 = 0; r2 < e6.length; ) {
|
|
2827
|
+
let i2 = e6.charCodeAt(r2);
|
|
2828
|
+
switch (i2) {
|
|
2829
|
+
case 35:
|
|
2830
|
+
case 39:
|
|
2831
|
+
case 60:
|
|
2832
|
+
case 123:
|
|
2833
|
+
case 125:
|
|
2834
|
+
return null;
|
|
2835
|
+
}
|
|
2836
|
+
if (i2 === 10) t2++, n2 = 1, r2++;
|
|
2837
|
+
else if (n2++, i2 >= 55296 && i2 <= 56319 && r2 + 1 < e6.length) {
|
|
2838
|
+
let t3 = e6.charCodeAt(r2 + 1);
|
|
2839
|
+
r2 += t3 >= 56320 && t3 <= 57343 ? 2 : 1;
|
|
2840
|
+
} else r2++;
|
|
2841
|
+
}
|
|
2842
|
+
return { offset: e6.length, line: t2, column: n2 };
|
|
2843
|
+
}
|
|
2844
|
+
var Fa = class {
|
|
2845
|
+
constructor(e6, t2 = {}) {
|
|
2846
|
+
this.message = e6, this.position = { offset: 0, line: 1, column: 1 }, this.ignoreTag = !!t2.ignoreTag, this.locale = t2.locale, this.requiresOtherClause = !!t2.requiresOtherClause, this.shouldParseSkeletons = !!t2.shouldParseSkeletons;
|
|
2847
|
+
}
|
|
2848
|
+
parse() {
|
|
2849
|
+
if (this.offset() !== 0) throw Error(`parser can only be used once`);
|
|
2850
|
+
if (this.message.length > 0) {
|
|
2851
|
+
let e6 = this.message.charCodeAt(0);
|
|
2852
|
+
if (e6 !== 35 && e6 !== 39 && e6 !== 60 && e6 !== 123 && e6 !== 125) {
|
|
2853
|
+
let e7 = Pa(this.message);
|
|
2854
|
+
if (e7) {
|
|
2855
|
+
let t2 = this.clonePosition();
|
|
2856
|
+
return this.position = e7, { val: [{ type: 0, value: this.message, location: X(t2, this.clonePosition()) }], err: null };
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
return this.parseMessage(0, ``, false);
|
|
2861
|
+
}
|
|
2862
|
+
parseMessage(e6, t2, n2) {
|
|
2863
|
+
let r2 = [];
|
|
2864
|
+
for (; !this.isEOF(); ) {
|
|
2865
|
+
let i2 = this.char();
|
|
2866
|
+
if (i2 === 123) {
|
|
2867
|
+
let t3 = this.parseArgument(e6, n2);
|
|
2868
|
+
if (t3.err) return t3;
|
|
2869
|
+
r2.push(t3.val);
|
|
2870
|
+
} else if (i2 === 125 && e6 > 0) break;
|
|
2871
|
+
else if (i2 === 35 && (t2 === `plural` || t2 === `selectordinal`)) {
|
|
2872
|
+
let e7 = this.clonePosition();
|
|
2873
|
+
this.bump(), r2.push({ type: 7, location: X(e7, this.clonePosition()) });
|
|
2874
|
+
} else if (i2 === 60 && !this.ignoreTag && this.peek() === 47) {
|
|
2875
|
+
if (n2) break;
|
|
2876
|
+
return this.error(26, X(this.clonePosition(), this.clonePosition()));
|
|
2877
|
+
} else if (i2 === 60 && !this.ignoreTag && Ia(this.peek() || 0)) {
|
|
2878
|
+
let n3 = this.parseTag(e6, t2);
|
|
2879
|
+
if (n3.err) return n3;
|
|
2880
|
+
r2.push(n3.val);
|
|
2881
|
+
} else {
|
|
2882
|
+
let n3 = this.parseLiteral(e6, t2);
|
|
2883
|
+
if (n3.err) return n3;
|
|
2884
|
+
r2.push(n3.val);
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
return { val: r2, err: null };
|
|
2888
|
+
}
|
|
2889
|
+
parseTag(e6, t2) {
|
|
2890
|
+
let n2 = this.clonePosition();
|
|
2891
|
+
this.bump();
|
|
2892
|
+
let r2 = this.parseTagName();
|
|
2893
|
+
if (this.bumpSpace(), this.bumpIf(`/>`)) return { val: { type: 0, value: `<${r2}/>`, location: X(n2, this.clonePosition()) }, err: null };
|
|
2894
|
+
if (this.bumpIf(`>`)) {
|
|
2895
|
+
let i2 = this.parseMessage(e6 + 1, t2, true);
|
|
2896
|
+
if (i2.err) return i2;
|
|
2897
|
+
let a2 = i2.val, o2 = this.clonePosition();
|
|
2898
|
+
if (this.bumpIf(`</`)) {
|
|
2899
|
+
if (this.isEOF() || !Ia(this.char())) return this.error(23, X(o2, this.clonePosition()));
|
|
2900
|
+
let e7 = this.clonePosition();
|
|
2901
|
+
return r2 === this.parseTagName() ? (this.bumpSpace(), this.bumpIf(`>`) ? { val: { type: 8, value: r2, children: a2, location: X(n2, this.clonePosition()) }, err: null } : this.error(23, X(o2, this.clonePosition()))) : this.error(26, X(e7, this.clonePosition()));
|
|
2902
|
+
}
|
|
2903
|
+
return this.error(27, X(n2, this.clonePosition()));
|
|
2904
|
+
}
|
|
2905
|
+
return this.error(23, X(n2, this.clonePosition()));
|
|
2906
|
+
}
|
|
2907
|
+
parseTagName() {
|
|
2908
|
+
let e6 = this.offset();
|
|
2909
|
+
for (this.bump(); !this.isEOF() && Ra(this.char()); ) this.bump();
|
|
2910
|
+
return this.message.slice(e6, this.offset());
|
|
2911
|
+
}
|
|
2912
|
+
parseLiteral(e6, t2) {
|
|
2913
|
+
let n2 = this.clonePosition(), r2 = ``;
|
|
2914
|
+
for (; ; ) {
|
|
2915
|
+
let n3 = this.tryParseQuote(t2);
|
|
2916
|
+
if (n3) {
|
|
2917
|
+
r2 += n3;
|
|
2918
|
+
continue;
|
|
2919
|
+
}
|
|
2920
|
+
let i3 = this.tryParseUnquoted(e6, t2);
|
|
2921
|
+
if (i3) {
|
|
2922
|
+
r2 += i3;
|
|
2923
|
+
continue;
|
|
2924
|
+
}
|
|
2925
|
+
let a2 = this.tryParseLeftAngleBracket();
|
|
2926
|
+
if (a2) r2 += a2;
|
|
2927
|
+
else break;
|
|
2928
|
+
}
|
|
2929
|
+
let i2 = X(n2, this.clonePosition());
|
|
2930
|
+
return { val: { type: 0, value: r2, location: i2 }, err: null };
|
|
2931
|
+
}
|
|
2932
|
+
tryParseLeftAngleBracket() {
|
|
2933
|
+
return !this.isEOF() && this.char() === 60 && (this.ignoreTag || !La(this.peek() || 0)) ? (this.bump(), `<`) : null;
|
|
2934
|
+
}
|
|
2935
|
+
tryParseQuote(e6) {
|
|
2936
|
+
if (this.isEOF() || this.char() !== 39) return null;
|
|
2937
|
+
switch (this.peek()) {
|
|
2938
|
+
case 39:
|
|
2939
|
+
return this.bump(), this.bump(), `'`;
|
|
2940
|
+
case 123:
|
|
2941
|
+
case 60:
|
|
2942
|
+
case 62:
|
|
2943
|
+
case 125:
|
|
2944
|
+
break;
|
|
2945
|
+
case 35:
|
|
2946
|
+
if (e6 === `plural` || e6 === `selectordinal`) break;
|
|
2947
|
+
return null;
|
|
2948
|
+
default:
|
|
2949
|
+
return null;
|
|
2950
|
+
}
|
|
2951
|
+
this.bump();
|
|
2952
|
+
let t2 = [this.char()];
|
|
2953
|
+
for (this.bump(); !this.isEOF(); ) {
|
|
2954
|
+
let e7 = this.char();
|
|
2955
|
+
if (e7 === 39) {
|
|
2956
|
+
if (this.peek() === 39) t2.push(39), this.bump();
|
|
2957
|
+
else {
|
|
2958
|
+
this.bump();
|
|
2959
|
+
break;
|
|
2960
|
+
}
|
|
2961
|
+
} else t2.push(e7);
|
|
2962
|
+
this.bump();
|
|
2963
|
+
}
|
|
2964
|
+
return String.fromCodePoint(...t2);
|
|
2965
|
+
}
|
|
2966
|
+
tryParseUnquoted(e6, t2) {
|
|
2967
|
+
if (this.isEOF()) return null;
|
|
2968
|
+
let n2 = this.char();
|
|
2969
|
+
return n2 === 60 || n2 === 123 || n2 === 35 && (t2 === `plural` || t2 === `selectordinal`) || n2 === 125 && e6 > 0 ? null : (this.bump(), String.fromCodePoint(n2));
|
|
2970
|
+
}
|
|
2971
|
+
parseArgument(e6, t2) {
|
|
2972
|
+
let n2 = this.clonePosition();
|
|
2973
|
+
if (this.bump(), this.bumpSpace(), this.isEOF()) return this.error(1, X(n2, this.clonePosition()));
|
|
2974
|
+
if (this.char() === 125) return this.bump(), this.error(2, X(n2, this.clonePosition()));
|
|
2975
|
+
let r2 = this.parseIdentifierIfPossible().value;
|
|
2976
|
+
if (!r2) return this.error(3, X(n2, this.clonePosition()));
|
|
2977
|
+
if (this.bumpSpace(), this.isEOF()) return this.error(1, X(n2, this.clonePosition()));
|
|
2978
|
+
switch (this.char()) {
|
|
2979
|
+
case 125:
|
|
2980
|
+
return this.bump(), { val: { type: 1, value: r2, location: X(n2, this.clonePosition()) }, err: null };
|
|
2981
|
+
case 44:
|
|
2982
|
+
return this.bump(), this.bumpSpace(), this.isEOF() ? this.error(1, X(n2, this.clonePosition())) : this.parseArgumentOptions(e6, t2, r2, n2);
|
|
2983
|
+
default:
|
|
2984
|
+
return this.error(3, X(n2, this.clonePosition()));
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
parseIdentifierIfPossible() {
|
|
2988
|
+
let e6 = this.clonePosition(), t2 = this.offset(), n2 = Na(this.message, t2), r2 = t2 + n2.length;
|
|
2989
|
+
return this.bumpTo(r2), { value: n2, location: X(e6, this.clonePosition()) };
|
|
2990
|
+
}
|
|
2991
|
+
parseArgumentOptions(e6, t2, n2, r2) {
|
|
2992
|
+
let i2 = this.clonePosition(), a2 = this.parseIdentifierIfPossible().value, o2 = this.clonePosition();
|
|
2993
|
+
switch (a2) {
|
|
2994
|
+
case ``:
|
|
2995
|
+
return this.error(4, X(i2, o2));
|
|
2996
|
+
case `number`:
|
|
2997
|
+
case `date`:
|
|
2998
|
+
case `time`: {
|
|
2999
|
+
this.bumpSpace();
|
|
3000
|
+
let e7 = null;
|
|
3001
|
+
if (this.bumpIf(`,`)) {
|
|
3002
|
+
this.bumpSpace();
|
|
3003
|
+
let t4 = this.clonePosition(), n3 = this.parseSimpleArgStyleIfPossible();
|
|
3004
|
+
if (n3.err) return n3;
|
|
3005
|
+
let r3 = ja(n3.val);
|
|
3006
|
+
if (r3.length === 0) return this.error(6, X(this.clonePosition(), this.clonePosition()));
|
|
3007
|
+
e7 = { style: r3, styleLocation: X(t4, this.clonePosition()) };
|
|
3008
|
+
}
|
|
3009
|
+
let t3 = this.tryParseArgumentClose(r2);
|
|
3010
|
+
if (t3.err) return t3;
|
|
3011
|
+
let i3 = X(r2, this.clonePosition());
|
|
3012
|
+
if (e7 && e7.style.startsWith(`::`)) {
|
|
3013
|
+
let t4 = Aa(e7.style.slice(2));
|
|
3014
|
+
if (a2 === `number`) {
|
|
3015
|
+
let r3 = this.parseNumberSkeletonFromString(t4, e7.styleLocation);
|
|
3016
|
+
return r3.err ? r3 : { val: { type: 2, value: n2, location: i3, style: r3.val }, err: null };
|
|
3017
|
+
}
|
|
3018
|
+
{
|
|
3019
|
+
if (t4.length === 0) return this.error(10, i3);
|
|
3020
|
+
let r3 = t4;
|
|
3021
|
+
this.locale && (r3 = Sa(t4, this.locale));
|
|
3022
|
+
let o3 = { type: 1, pattern: r3, location: e7.styleLocation, parsedOptions: this.shouldParseSkeletons ? Xi(r3) : {} };
|
|
3023
|
+
return { val: { type: a2 === `date` ? 3 : 4, value: n2, location: i3, style: o3 }, err: null };
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
3026
|
+
return { val: { type: a2 === `number` ? 2 : a2 === `date` ? 3 : 4, value: n2, location: i3, style: e7?.style ?? null }, err: null };
|
|
3027
|
+
}
|
|
3028
|
+
case `plural`:
|
|
3029
|
+
case `selectordinal`:
|
|
3030
|
+
case `select`: {
|
|
3031
|
+
let i3 = this.clonePosition();
|
|
3032
|
+
if (this.bumpSpace(), !this.bumpIf(`,`)) return this.error(12, X(i3, { ...i3 }));
|
|
3033
|
+
this.bumpSpace();
|
|
3034
|
+
let o3 = this.parseIdentifierIfPossible(), s2 = 0;
|
|
3035
|
+
if (a2 !== `select` && o3.value === `offset`) {
|
|
3036
|
+
if (!this.bumpIf(`:`)) return this.error(13, X(this.clonePosition(), this.clonePosition()));
|
|
3037
|
+
this.bumpSpace();
|
|
3038
|
+
let e7 = this.tryParseDecimalInteger(13, 14);
|
|
3039
|
+
if (e7.err) return e7;
|
|
3040
|
+
this.bumpSpace(), o3 = this.parseIdentifierIfPossible(), s2 = e7.val;
|
|
3041
|
+
}
|
|
3042
|
+
let c2 = this.tryParsePluralOrSelectOptions(e6, a2, t2, o3);
|
|
3043
|
+
if (c2.err) return c2;
|
|
3044
|
+
let l2 = this.tryParseArgumentClose(r2);
|
|
3045
|
+
if (l2.err) return l2;
|
|
3046
|
+
let u2 = X(r2, this.clonePosition());
|
|
3047
|
+
return a2 === `select` ? { val: { type: 5, value: n2, options: ka(c2.val), location: u2 }, err: null } : { val: { type: 6, value: n2, options: ka(c2.val), offset: s2, pluralType: a2 === `plural` ? `cardinal` : `ordinal`, location: u2 }, err: null };
|
|
3048
|
+
}
|
|
3049
|
+
default:
|
|
3050
|
+
return this.error(5, X(i2, o2));
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
tryParseArgumentClose(e6) {
|
|
3054
|
+
return this.isEOF() || this.char() !== 125 ? this.error(1, X(e6, this.clonePosition())) : (this.bump(), { val: true, err: null });
|
|
3055
|
+
}
|
|
3056
|
+
parseSimpleArgStyleIfPossible() {
|
|
3057
|
+
let e6 = 0, t2 = this.clonePosition();
|
|
3058
|
+
for (; !this.isEOF(); ) switch (this.char()) {
|
|
3059
|
+
case 39: {
|
|
3060
|
+
this.bump();
|
|
3061
|
+
let e7 = this.clonePosition();
|
|
3062
|
+
if (!this.bumpUntil(`'`)) return this.error(11, X(e7, this.clonePosition()));
|
|
3063
|
+
this.bump();
|
|
3064
|
+
break;
|
|
3065
|
+
}
|
|
3066
|
+
case 123:
|
|
3067
|
+
e6 += 1, this.bump();
|
|
3068
|
+
break;
|
|
3069
|
+
case 125:
|
|
3070
|
+
if (e6 > 0) --e6;
|
|
3071
|
+
else return { val: this.message.slice(t2.offset, this.offset()), err: null };
|
|
3072
|
+
break;
|
|
3073
|
+
default:
|
|
3074
|
+
this.bump();
|
|
3075
|
+
}
|
|
3076
|
+
return { val: this.message.slice(t2.offset, this.offset()), err: null };
|
|
3077
|
+
}
|
|
3078
|
+
parseNumberSkeletonFromString(e6, t2) {
|
|
3079
|
+
let n2 = [];
|
|
3080
|
+
try {
|
|
3081
|
+
n2 = Qi(e6);
|
|
3082
|
+
} catch {
|
|
3083
|
+
return this.error(7, t2);
|
|
3084
|
+
}
|
|
3085
|
+
return { val: { type: 0, tokens: n2, location: t2, parsedOptions: this.shouldParseSkeletons ? ca(n2) : {} }, err: null };
|
|
3086
|
+
}
|
|
3087
|
+
tryParsePluralOrSelectOptions(e6, t2, n2, r2) {
|
|
3088
|
+
let i2 = false, a2 = [], o2 = /* @__PURE__ */ new Set(), { value: s2, location: c2 } = r2;
|
|
3089
|
+
for (; ; ) {
|
|
3090
|
+
if (s2.length === 0) {
|
|
3091
|
+
let e7 = this.clonePosition();
|
|
3092
|
+
if (t2 !== `select` && this.bumpIf(`=`)) {
|
|
3093
|
+
let t3 = this.tryParseDecimalInteger(16, 19);
|
|
3094
|
+
if (t3.err) return t3;
|
|
3095
|
+
c2 = X(e7, this.clonePosition()), s2 = this.message.slice(e7.offset, this.offset());
|
|
3096
|
+
} else break;
|
|
3097
|
+
}
|
|
3098
|
+
if (o2.has(s2)) return this.error(t2 === `select` ? 21 : 20, c2);
|
|
3099
|
+
s2 === `other` && (i2 = true), this.bumpSpace();
|
|
3100
|
+
let r3 = this.clonePosition();
|
|
3101
|
+
if (!this.bumpIf(`{`)) return this.error(t2 === `select` ? 17 : 18, X(this.clonePosition(), this.clonePosition()));
|
|
3102
|
+
let l2 = this.parseMessage(e6 + 1, t2, n2);
|
|
3103
|
+
if (l2.err) return l2;
|
|
3104
|
+
let u2 = this.tryParseArgumentClose(r3);
|
|
3105
|
+
if (u2.err) return u2;
|
|
3106
|
+
a2.push([s2, { value: l2.val, location: X(r3, this.clonePosition()) }]), o2.add(s2), this.bumpSpace(), { value: s2, location: c2 } = this.parseIdentifierIfPossible();
|
|
3107
|
+
}
|
|
3108
|
+
return a2.length === 0 ? this.error(t2 === `select` ? 15 : 16, X(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !i2 ? this.error(22, X(this.clonePosition(), this.clonePosition())) : { val: a2, err: null };
|
|
3109
|
+
}
|
|
3110
|
+
tryParseDecimalInteger(e6, t2) {
|
|
3111
|
+
let n2 = 1, r2 = this.clonePosition();
|
|
3112
|
+
this.bumpIf(`+`) || this.bumpIf(`-`) && (n2 = -1);
|
|
3113
|
+
let i2 = false, a2 = 0;
|
|
3114
|
+
for (; !this.isEOF(); ) {
|
|
3115
|
+
let e7 = this.char();
|
|
3116
|
+
if (e7 >= 48 && e7 <= 57) i2 = true, a2 = a2 * 10 + (e7 - 48), this.bump();
|
|
3117
|
+
else break;
|
|
3118
|
+
}
|
|
3119
|
+
let o2 = X(r2, this.clonePosition());
|
|
3120
|
+
return i2 ? (a2 *= n2, Number.isSafeInteger(a2) ? { val: a2, err: null } : this.error(t2, o2)) : this.error(e6, o2);
|
|
3121
|
+
}
|
|
3122
|
+
offset() {
|
|
3123
|
+
return this.position.offset;
|
|
3124
|
+
}
|
|
3125
|
+
isEOF() {
|
|
3126
|
+
return this.offset() === this.message.length;
|
|
3127
|
+
}
|
|
3128
|
+
clonePosition() {
|
|
3129
|
+
return { offset: this.position.offset, line: this.position.line, column: this.position.column };
|
|
3130
|
+
}
|
|
3131
|
+
char() {
|
|
3132
|
+
let e6 = this.position.offset;
|
|
3133
|
+
if (e6 >= this.message.length) throw Error(`out of bound`);
|
|
3134
|
+
let t2 = this.message.codePointAt(e6);
|
|
3135
|
+
if (t2 === void 0) throw Error(`Offset ${e6} is at invalid UTF-16 code unit boundary`);
|
|
3136
|
+
return t2;
|
|
3137
|
+
}
|
|
3138
|
+
error(e6, t2) {
|
|
3139
|
+
return { val: null, err: { kind: e6, message: this.message, location: t2 } };
|
|
3140
|
+
}
|
|
3141
|
+
bump() {
|
|
3142
|
+
if (this.isEOF()) return;
|
|
3143
|
+
let e6 = this.char();
|
|
3144
|
+
e6 === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += e6 < 65536 ? 1 : 2);
|
|
3145
|
+
}
|
|
3146
|
+
bumpIf(e6) {
|
|
3147
|
+
if (this.message.startsWith(e6, this.offset())) {
|
|
3148
|
+
for (let t2 = 0; t2 < e6.length; t2++) this.bump();
|
|
3149
|
+
return true;
|
|
3150
|
+
}
|
|
3151
|
+
return false;
|
|
3152
|
+
}
|
|
3153
|
+
bumpUntil(e6) {
|
|
3154
|
+
let t2 = this.offset(), n2 = this.message.indexOf(e6, t2);
|
|
3155
|
+
return n2 >= 0 ? (this.bumpTo(n2), true) : (this.bumpTo(this.message.length), false);
|
|
3156
|
+
}
|
|
3157
|
+
bumpTo(e6) {
|
|
3158
|
+
if (this.offset() > e6) throw Error(`targetOffset ${e6} must be greater than or equal to the current offset ${this.offset()}`);
|
|
3159
|
+
for (e6 = Math.min(e6, this.message.length); ; ) {
|
|
3160
|
+
let t2 = this.offset();
|
|
3161
|
+
if (t2 === e6) break;
|
|
3162
|
+
if (t2 > e6) throw Error(`targetOffset ${e6} is at invalid UTF-16 code unit boundary`);
|
|
3163
|
+
if (this.bump(), this.isEOF()) break;
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
bumpSpace() {
|
|
3167
|
+
for (; !this.isEOF() && za(this.char()); ) this.bump();
|
|
3168
|
+
}
|
|
3169
|
+
peek() {
|
|
3170
|
+
if (this.isEOF()) return null;
|
|
3171
|
+
let e6 = this.char(), t2 = this.offset();
|
|
3172
|
+
return this.message.charCodeAt(t2 + (e6 >= 65536 ? 2 : 1)) ?? null;
|
|
3173
|
+
}
|
|
3174
|
+
};
|
|
3175
|
+
function Ia(e6) {
|
|
3176
|
+
return e6 >= 97 && e6 <= 122 || e6 >= 65 && e6 <= 90;
|
|
3177
|
+
}
|
|
3178
|
+
function La(e6) {
|
|
3179
|
+
return Ia(e6) || e6 === 47;
|
|
3180
|
+
}
|
|
3181
|
+
function Ra(e6) {
|
|
3182
|
+
return e6 === 45 || e6 === 46 || e6 >= 48 && e6 <= 57 || e6 === 95 || e6 >= 97 && e6 <= 122 || e6 >= 65 && e6 <= 90 || e6 == 183 || e6 >= 192 && e6 <= 214 || e6 >= 216 && e6 <= 246 || e6 >= 248 && e6 <= 893 || e6 >= 895 && e6 <= 8191 || e6 >= 8204 && e6 <= 8205 || e6 >= 8255 && e6 <= 8256 || e6 >= 8304 && e6 <= 8591 || e6 >= 11264 && e6 <= 12271 || e6 >= 12289 && e6 <= 55295 || e6 >= 63744 && e6 <= 64975 || e6 >= 65008 && e6 <= 65533 || e6 >= 65536 && e6 <= 983039;
|
|
3183
|
+
}
|
|
3184
|
+
function za(e6) {
|
|
3185
|
+
return e6 >= 9 && e6 <= 13 || e6 === 32 || e6 === 133 || e6 >= 8206 && e6 <= 8207 || e6 === 8232 || e6 === 8233;
|
|
3186
|
+
}
|
|
3187
|
+
function Ba(e6) {
|
|
3188
|
+
e6.forEach((e7) => {
|
|
3189
|
+
if (delete e7.location, ha(e7) || ga(e7)) for (let t2 in e7.options) delete e7.options[t2].location, Ba(e7.options[t2].value);
|
|
3190
|
+
else fa(e7) && ya(e7.style) || (pa(e7) || ma(e7)) && ba(e7.style) ? delete e7.style.location : va(e7) && Ba(e7.children);
|
|
3191
|
+
});
|
|
3192
|
+
}
|
|
3193
|
+
function Va(e6, t2 = {}) {
|
|
3194
|
+
t2 = { shouldParseSkeletons: true, requiresOtherClause: true, ...t2 };
|
|
3195
|
+
let n2 = new Fa(e6, t2).parse();
|
|
3196
|
+
if (n2.err) {
|
|
3197
|
+
let e7 = SyntaxError(la[n2.err.kind]);
|
|
3198
|
+
throw e7.location = n2.err.location, e7.originalMessage = n2.err.message, e7;
|
|
3199
|
+
}
|
|
3200
|
+
return t2?.captureLocation || Ba(n2.val), n2.val;
|
|
3201
|
+
}
|
|
3202
|
+
var Ha = class extends Error {
|
|
3203
|
+
constructor(e6, t2, n2) {
|
|
3204
|
+
super(e6), this.code = t2, this.originalMessage = n2;
|
|
3205
|
+
}
|
|
3206
|
+
toString() {
|
|
3207
|
+
return `[formatjs Error: ${this.code}] ${this.message}`;
|
|
3208
|
+
}
|
|
3209
|
+
};
|
|
3210
|
+
var Ua = class extends Ha {
|
|
3211
|
+
constructor(e6, t2, n2, r2) {
|
|
3212
|
+
super(`Invalid values for "${e6}": "${t2}". Options are "${Object.keys(n2).join(`", "`)}"`, `INVALID_VALUE`, r2);
|
|
3213
|
+
}
|
|
3214
|
+
};
|
|
3215
|
+
var Wa = class extends Ha {
|
|
3216
|
+
constructor(e6, t2, n2) {
|
|
3217
|
+
super(`Value for "${e6}" must be of type ${t2}`, `INVALID_VALUE`, n2);
|
|
3218
|
+
}
|
|
3219
|
+
};
|
|
3220
|
+
var Ga = class extends Ha {
|
|
3221
|
+
constructor(e6, t2) {
|
|
3222
|
+
super(`The intl string context variable "${e6}" was not provided to the string "${t2}"`, `MISSING_VALUE`, t2);
|
|
3223
|
+
}
|
|
3224
|
+
};
|
|
3225
|
+
function Ka(e6) {
|
|
3226
|
+
return e6.length < 2 ? e6 : e6.reduce((e7, t2) => {
|
|
3227
|
+
let n2 = e7[e7.length - 1];
|
|
3228
|
+
return !n2 || n2.type !== 0 || t2.type !== 0 ? e7.push(t2) : n2.value += t2.value, e7;
|
|
3229
|
+
}, []);
|
|
3230
|
+
}
|
|
3231
|
+
function qa(e6) {
|
|
3232
|
+
return typeof e6 == `function`;
|
|
3233
|
+
}
|
|
3234
|
+
function Ja(e6, t2, n2, r2, i2, a2, o2) {
|
|
3235
|
+
if (e6.length === 1 && ua(e6[0])) return [{ type: 0, value: e6[0].value }];
|
|
3236
|
+
let s2 = [];
|
|
3237
|
+
for (let c2 of e6) {
|
|
3238
|
+
if (ua(c2)) {
|
|
3239
|
+
s2.push({ type: 0, value: c2.value });
|
|
3240
|
+
continue;
|
|
3241
|
+
}
|
|
3242
|
+
if (_a(c2)) {
|
|
3243
|
+
typeof a2 == `number` && s2.push({ type: 0, value: n2.getNumberFormat(t2).format(a2) });
|
|
3244
|
+
continue;
|
|
3245
|
+
}
|
|
3246
|
+
let { value: e7 } = c2;
|
|
3247
|
+
if (!(i2 && e7 in i2)) throw new Ga(e7, o2);
|
|
3248
|
+
let l2 = i2[e7];
|
|
3249
|
+
if (da(c2)) (!l2 || typeof l2 == `string` || typeof l2 == `number` || typeof l2 == `bigint`) && (l2 = typeof l2 == `string` || typeof l2 == `number` || typeof l2 == `bigint` ? String(l2) : ``), s2.push({ type: typeof l2 == `string` ? 0 : 1, value: l2 });
|
|
3250
|
+
else if (pa(c2)) {
|
|
3251
|
+
let e8 = typeof c2.style == `string` ? r2.date[c2.style] : ba(c2.style) ? c2.style.parsedOptions : void 0;
|
|
3252
|
+
s2.push({ type: 0, value: n2.getDateTimeFormat(t2, e8).format(l2) });
|
|
3253
|
+
} else if (ma(c2)) {
|
|
3254
|
+
let e8 = typeof c2.style == `string` ? r2.time[c2.style] : ba(c2.style) ? c2.style.parsedOptions : r2.time.medium;
|
|
3255
|
+
s2.push({ type: 0, value: n2.getDateTimeFormat(t2, e8).format(l2) });
|
|
3256
|
+
} else if (fa(c2)) {
|
|
3257
|
+
let e8 = typeof c2.style == `string` ? r2.number[c2.style] : ya(c2.style) ? c2.style.parsedOptions : void 0;
|
|
3258
|
+
if (e8 && e8.scale) {
|
|
3259
|
+
let t3 = e8.scale || 1;
|
|
3260
|
+
if (typeof l2 == `bigint`) {
|
|
3261
|
+
if (!Number.isInteger(t3)) throw TypeError(`Cannot apply fractional scale ${t3} to bigint value. Scale must be an integer when formatting bigint.`);
|
|
3262
|
+
l2 *= BigInt(t3);
|
|
3263
|
+
} else l2 *= t3;
|
|
3264
|
+
}
|
|
3265
|
+
s2.push({ type: 0, value: n2.getNumberFormat(t2, e8).format(l2) });
|
|
3266
|
+
} else {
|
|
3267
|
+
if (va(c2)) {
|
|
3268
|
+
let { children: e8, value: l3 } = c2, u2 = i2[l3];
|
|
3269
|
+
if (!qa(u2)) throw new Wa(l3, `function`, o2);
|
|
3270
|
+
let d2 = u2(Ja(e8, t2, n2, r2, i2, a2).map((e9) => e9.value));
|
|
3271
|
+
Array.isArray(d2) || (d2 = [d2]), s2.push(...d2.map((e9) => ({ type: typeof e9 == `string` ? 0 : 1, value: e9 })));
|
|
3272
|
+
}
|
|
3273
|
+
if (ha(c2)) {
|
|
3274
|
+
let e8 = l2, a3 = (Object.prototype.hasOwnProperty.call(c2.options, e8) ? c2.options[e8] : void 0) || c2.options.other;
|
|
3275
|
+
if (!a3) throw new Ua(c2.value, l2, Object.keys(c2.options), o2);
|
|
3276
|
+
s2.push(...Ja(a3.value, t2, n2, r2, i2));
|
|
3277
|
+
} else if (ga(c2)) {
|
|
3278
|
+
let e8 = `=${l2}`, a3 = Object.prototype.hasOwnProperty.call(c2.options, e8) ? c2.options[e8] : void 0;
|
|
3279
|
+
if (!a3) {
|
|
3280
|
+
if (!Intl.PluralRules) throw new Ha(`Intl.PluralRules is not available in this environment.
|
|
3281
|
+
Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
3282
|
+
`, `MISSING_INTL_API`, o2);
|
|
3283
|
+
let e9 = typeof l2 == `bigint` ? Number(l2) : l2, r3 = n2.getPluralRules(t2, { type: c2.pluralType }).select(e9 - (c2.offset || 0));
|
|
3284
|
+
a3 = (Object.prototype.hasOwnProperty.call(c2.options, r3) ? c2.options[r3] : void 0) || c2.options.other;
|
|
3285
|
+
}
|
|
3286
|
+
if (!a3) throw new Ua(c2.value, l2, Object.keys(c2.options), o2);
|
|
3287
|
+
let u2 = typeof l2 == `bigint` ? Number(l2) : l2;
|
|
3288
|
+
s2.push(...Ja(a3.value, t2, n2, r2, i2, u2 - (c2.offset || 0)));
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
return Ka(s2);
|
|
3293
|
+
}
|
|
3294
|
+
function Ya(e6, t2) {
|
|
3295
|
+
return t2 ? { ...e6, ...t2, ...Object.keys(e6).reduce((n2, r2) => (n2[r2] = { ...e6[r2], ...t2[r2] }, n2), {}) } : e6;
|
|
3296
|
+
}
|
|
3297
|
+
function Xa(e6, t2) {
|
|
3298
|
+
return t2 ? Object.keys(e6).reduce((n2, r2) => (n2[r2] = Ya(e6[r2], t2[r2]), n2), { ...e6 }) : e6;
|
|
3299
|
+
}
|
|
3300
|
+
function Za(e6) {
|
|
3301
|
+
return { create() {
|
|
3302
|
+
return { get(t2) {
|
|
3303
|
+
return e6[t2];
|
|
3304
|
+
}, set(t2, n2) {
|
|
3305
|
+
e6[t2] = n2;
|
|
3306
|
+
} };
|
|
3307
|
+
} };
|
|
3308
|
+
}
|
|
3309
|
+
function Qa(e6 = { number: {}, dateTime: {}, pluralRules: {} }) {
|
|
3310
|
+
return { getNumberFormat: Li((...e7) => new Intl.NumberFormat(...e7), { cache: Za(e6.number), strategy: Ji.variadic }), getDateTimeFormat: Li((...e7) => new Intl.DateTimeFormat(...e7), { cache: Za(e6.dateTime), strategy: Ji.variadic }), getPluralRules: Li((...e7) => new Intl.PluralRules(...e7), { cache: Za(e6.pluralRules), strategy: Ji.variadic }) };
|
|
3311
|
+
}
|
|
3312
|
+
var $a = class e5 {
|
|
3313
|
+
constructor(t2, n2 = e5.defaultLocale, r2, i2) {
|
|
3314
|
+
if (this.formatterCache = { number: {}, dateTime: {}, pluralRules: {} }, this.format = (e6) => {
|
|
3315
|
+
let t3 = this.formatToParts(e6);
|
|
3316
|
+
if (t3.length === 1) return t3[0].value;
|
|
3317
|
+
let n3 = t3.reduce((e7, t4) => (!e7.length || t4.type !== 0 || typeof e7[e7.length - 1] != `string` ? e7.push(t4.value) : e7[e7.length - 1] += t4.value, e7), []);
|
|
3318
|
+
return n3.length <= 1 ? n3[0] || `` : n3;
|
|
3319
|
+
}, this.formatToParts = (e6) => Ja(this.ast, this.locales, this.formatters, this.formats, e6, void 0, this.message), this.resolvedOptions = () => ({ locale: this.resolvedLocale?.toString() || Intl.NumberFormat.supportedLocalesOf(this.locales)[0] }), this.getAst = () => this.ast, this.locales = n2, this.resolvedLocale = e5.resolveLocale(n2), typeof t2 == `string`) {
|
|
3320
|
+
if (this.message = t2, !e5.__parse) throw TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
|
|
3321
|
+
let { ...n3 } = i2 || {};
|
|
3322
|
+
this.ast = e5.__parse(t2, { ...n3, locale: this.resolvedLocale });
|
|
3323
|
+
} else this.ast = t2;
|
|
3324
|
+
if (!Array.isArray(this.ast)) throw TypeError(`A message must be provided as a String or AST.`);
|
|
3325
|
+
this.formats = Xa(e5.formats, r2), this.formatters = i2 && i2.formatters || Qa(this.formatterCache);
|
|
3326
|
+
}
|
|
3327
|
+
static {
|
|
3328
|
+
this.memoizedDefaultLocale = null;
|
|
3329
|
+
}
|
|
3330
|
+
static get defaultLocale() {
|
|
3331
|
+
return e5.memoizedDefaultLocale ||= new Intl.NumberFormat().resolvedOptions().locale, e5.memoizedDefaultLocale;
|
|
3332
|
+
}
|
|
3333
|
+
static {
|
|
3334
|
+
this.resolveLocale = (e6) => {
|
|
3335
|
+
if (Intl.Locale === void 0) return;
|
|
3336
|
+
let t2 = Intl.NumberFormat.supportedLocalesOf(e6);
|
|
3337
|
+
return t2.length > 0 ? new Intl.Locale(t2[0]) : new Intl.Locale(typeof e6 == `string` ? e6 : e6[0]);
|
|
3338
|
+
};
|
|
3339
|
+
}
|
|
3340
|
+
static {
|
|
3341
|
+
this.__parse = Va;
|
|
3342
|
+
}
|
|
3343
|
+
static {
|
|
3344
|
+
this.formats = { number: { integer: { maximumFractionDigits: 0 }, currency: { style: `currency` }, percent: { style: `percent` } }, date: { short: { month: `numeric`, day: `numeric`, year: `2-digit` }, medium: { month: `short`, day: `numeric`, year: `numeric` }, long: { month: `long`, day: `numeric`, year: `numeric` }, full: { weekday: `long`, month: `long`, day: `numeric`, year: `numeric` } }, time: { short: { hour: `numeric`, minute: `numeric` }, medium: { hour: `numeric`, minute: `numeric`, second: `numeric` }, long: { hour: `numeric`, minute: `numeric`, second: `numeric`, timeZoneName: `short` }, full: { hour: `numeric`, minute: `numeric`, second: `numeric`, timeZoneName: `short` } } };
|
|
3345
|
+
}
|
|
3346
|
+
};
|
|
3347
|
+
function eo(e6, t2) {
|
|
3348
|
+
return ao(e6) || io(e6, t2) || no(e6, t2) || to();
|
|
3349
|
+
}
|
|
3350
|
+
function to() {
|
|
3351
|
+
throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3352
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
3353
|
+
}
|
|
3354
|
+
function no(e6, t2) {
|
|
3355
|
+
if (e6) {
|
|
3356
|
+
if (typeof e6 == `string`) return ro(e6, t2);
|
|
3357
|
+
var n2 = {}.toString.call(e6).slice(8, -1);
|
|
3358
|
+
return n2 === `Object` && e6.constructor && (n2 = e6.constructor.name), n2 === `Map` || n2 === `Set` ? Array.from(e6) : n2 === `Arguments` || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2) ? ro(e6, t2) : void 0;
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
function ro(e6, t2) {
|
|
3362
|
+
(t2 == null || t2 > e6.length) && (t2 = e6.length);
|
|
3363
|
+
for (var n2 = 0, r2 = Array(t2); n2 < t2; n2++) r2[n2] = e6[n2];
|
|
3364
|
+
return r2;
|
|
3365
|
+
}
|
|
3366
|
+
function io(e6, t2) {
|
|
3367
|
+
var n2 = e6 == null ? null : typeof Symbol < `u` && e6[Symbol.iterator] || e6[`@@iterator`];
|
|
3368
|
+
if (n2 != null) {
|
|
3369
|
+
var r2, i2, a2, o2, s2 = [], c2 = true, l2 = false;
|
|
3370
|
+
try {
|
|
3371
|
+
if (a2 = (n2 = n2.call(e6)).next, t2 === 0) {
|
|
3372
|
+
if (Object(n2) !== n2) return;
|
|
3373
|
+
c2 = false;
|
|
3374
|
+
} else for (; !(c2 = (r2 = a2.call(n2)).done) && (s2.push(r2.value), s2.length !== t2); c2 = true) ;
|
|
3375
|
+
} catch (e7) {
|
|
3376
|
+
l2 = true, i2 = e7;
|
|
3377
|
+
} finally {
|
|
3378
|
+
try {
|
|
3379
|
+
if (!c2 && n2.return != null && (o2 = n2.return(), Object(o2) !== o2)) return;
|
|
3380
|
+
} finally {
|
|
3381
|
+
if (l2) throw i2;
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
return s2;
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
function ao(e6) {
|
|
3388
|
+
if (Array.isArray(e6)) return e6;
|
|
3389
|
+
}
|
|
3390
|
+
function Z(e6) {
|
|
3391
|
+
"@babel/helpers - typeof";
|
|
3392
|
+
return Z = typeof Symbol == `function` && typeof Symbol.iterator == `symbol` ? function(e7) {
|
|
3393
|
+
return typeof e7;
|
|
3394
|
+
} : function(e7) {
|
|
3395
|
+
return e7 && typeof Symbol == `function` && e7.constructor === Symbol && e7 !== Symbol.prototype ? `symbol` : typeof e7;
|
|
3396
|
+
}, Z(e6);
|
|
3397
|
+
}
|
|
3398
|
+
function oo(e6, t2) {
|
|
3399
|
+
var n2 = Object.keys(e6);
|
|
3400
|
+
if (Object.getOwnPropertySymbols) {
|
|
3401
|
+
var r2 = Object.getOwnPropertySymbols(e6);
|
|
3402
|
+
t2 && (r2 = r2.filter(function(t3) {
|
|
3403
|
+
return Object.getOwnPropertyDescriptor(e6, t3).enumerable;
|
|
3404
|
+
})), n2.push.apply(n2, r2);
|
|
3405
|
+
}
|
|
3406
|
+
return n2;
|
|
3407
|
+
}
|
|
3408
|
+
function so(e6) {
|
|
3409
|
+
for (var t2 = 1; t2 < arguments.length; t2++) {
|
|
3410
|
+
var n2 = arguments[t2] == null ? {} : arguments[t2];
|
|
3411
|
+
t2 % 2 ? oo(Object(n2), true).forEach(function(t3) {
|
|
3412
|
+
co(e6, t3, n2[t3]);
|
|
3413
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e6, Object.getOwnPropertyDescriptors(n2)) : oo(Object(n2)).forEach(function(t3) {
|
|
3414
|
+
Object.defineProperty(e6, t3, Object.getOwnPropertyDescriptor(n2, t3));
|
|
3415
|
+
});
|
|
3416
|
+
}
|
|
3417
|
+
return e6;
|
|
3418
|
+
}
|
|
3419
|
+
function co(e6, t2, n2) {
|
|
3420
|
+
return (t2 = po(t2)) in e6 ? Object.defineProperty(e6, t2, { value: n2, enumerable: true, configurable: true, writable: true }) : e6[t2] = n2, e6;
|
|
3421
|
+
}
|
|
3422
|
+
function lo(e6, t2) {
|
|
3423
|
+
if (!(e6 instanceof t2)) throw TypeError(`Cannot call a class as a function`);
|
|
3424
|
+
}
|
|
3425
|
+
function uo(e6, t2) {
|
|
3426
|
+
for (var n2 = 0; n2 < t2.length; n2++) {
|
|
3427
|
+
var r2 = t2[n2];
|
|
3428
|
+
r2.enumerable = r2.enumerable || false, r2.configurable = true, `value` in r2 && (r2.writable = true), Object.defineProperty(e6, po(r2.key), r2);
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
function fo(e6, t2, n2) {
|
|
3432
|
+
return t2 && uo(e6.prototype, t2), n2 && uo(e6, n2), Object.defineProperty(e6, "prototype", { writable: false }), e6;
|
|
3433
|
+
}
|
|
3434
|
+
function po(e6) {
|
|
3435
|
+
var t2 = mo(e6, `string`);
|
|
3436
|
+
return Z(t2) == `symbol` ? t2 : t2 + ``;
|
|
3437
|
+
}
|
|
3438
|
+
function mo(e6, t2) {
|
|
3439
|
+
if (Z(e6) != `object` || !e6) return e6;
|
|
3440
|
+
var n2 = e6[Symbol.toPrimitive];
|
|
3441
|
+
if (n2 !== void 0) {
|
|
3442
|
+
var r2 = n2.call(e6, t2 || `default`);
|
|
3443
|
+
if (Z(r2) != `object`) return r2;
|
|
3444
|
+
throw TypeError(`@@toPrimitive must return a primitive value.`);
|
|
3445
|
+
}
|
|
3446
|
+
return (t2 === `string` ? String : Number)(e6);
|
|
3447
|
+
}
|
|
3448
|
+
function ho() {
|
|
3449
|
+
return { memoize: true, memoizeFallback: false, bindI18n: ``, bindI18nStore: ``, parseErrorHandler: function(e6, t2, n2, r2) {
|
|
3450
|
+
return n2;
|
|
3451
|
+
}, parseLngForICU: function(e6) {
|
|
3452
|
+
return e6;
|
|
3453
|
+
}, escapeVariables: false };
|
|
3454
|
+
}
|
|
3455
|
+
var go = function() {
|
|
3456
|
+
function e6(t2) {
|
|
3457
|
+
lo(this, e6), this.type = `i18nFormat`, this.mem = {}, this.init(null, t2);
|
|
3458
|
+
}
|
|
3459
|
+
return fo(e6, [{ key: `init`, value: function(e7, t2) {
|
|
3460
|
+
var n2 = this, r2 = e7 && e7.options && e7.options.i18nFormat || {};
|
|
3461
|
+
if (this.options = Ii(r2, t2, this.options || {}, ho()), this.formats = this.options.formats, e7) {
|
|
3462
|
+
var i2 = this.options, a2 = i2.bindI18n, o2 = i2.bindI18nStore, s2 = i2.memoize;
|
|
3463
|
+
e7.IntlMessageFormat = $a, e7.ICU = this, s2 && (a2 && e7.on(a2, function() {
|
|
3464
|
+
return n2.clearCache();
|
|
3465
|
+
}), o2 && e7.store.on(o2, function() {
|
|
3466
|
+
return n2.clearCache();
|
|
3467
|
+
}));
|
|
3468
|
+
}
|
|
3469
|
+
} }, { key: `addUserDefinedFormats`, value: function(e7) {
|
|
3470
|
+
this.formats = this.formats ? so(so({}, this.formats), e7) : e7;
|
|
3471
|
+
} }, { key: `parse`, value: function(e7, t2, n2, r2, i2, a2) {
|
|
3472
|
+
var o2 = a2 && a2.resolved && a2.resolved.res, s2 = this.options.memoize && `${n2}.${r2}.${i2.replace(/\./g, `###`)}`, c2;
|
|
3473
|
+
this.options.memoize && (c2 = Mi(this.mem, s2));
|
|
3474
|
+
try {
|
|
3475
|
+
return c2 || (c2 = new $a(e7, this.options.parseLngForICU(n2), this.formats, { ignoreTag: true }), this.options.memoize && (this.options.memoizeFallback || !a2 || o2) && ji(this.mem, s2, c2)), c2.format(this.escapeVariableValues(t2));
|
|
3476
|
+
} catch (n3) {
|
|
3477
|
+
return this.options.parseErrorHandler(n3, i2, e7, t2);
|
|
3478
|
+
}
|
|
3479
|
+
} }, { key: `addLookupKeys`, value: function(e7, t2, n2, r2, i2) {
|
|
3480
|
+
return e7;
|
|
3481
|
+
} }, { key: `clearCache`, value: function() {
|
|
3482
|
+
this.mem = {};
|
|
3483
|
+
} }, { key: `escapeVariableValues`, value: function(e7) {
|
|
3484
|
+
if (!this.options.escapeVariables || !e7 || Z(e7) !== `object`) return e7;
|
|
3485
|
+
for (var t2 = {}, n2 = 0, r2 = Object.entries(e7); n2 < r2.length; n2++) {
|
|
3486
|
+
var i2 = eo(r2[n2], 2), a2 = i2[0], o2 = i2[1];
|
|
3487
|
+
t2[a2] = typeof o2 == `string` ? o2.replace(/&/g, `&`).replace(/</g, `<`).replace(/>/g, `>`).replace(/"/g, `"`).replace(/'/g, `'`) : o2;
|
|
3488
|
+
}
|
|
3489
|
+
return t2;
|
|
3490
|
+
} }]), e6;
|
|
3491
|
+
}();
|
|
3492
|
+
go.type = `i18nFormat`;
|
|
3493
|
+
function _o({ icuOptions: e6 = {}, ...t2 }) {
|
|
3494
|
+
let { parseErrorHandler: n2 = void 0 } = t2;
|
|
3495
|
+
return Oi(t2, { icu: new go({ parseErrorHandler: n2, bindI18n: t2.bindI18n, ...e6 }) });
|
|
3496
|
+
}
|
|
3497
|
+
var vo = (e6, t2, n2, r2) => {
|
|
3498
|
+
let i2 = [n2, { code: t2, ...r2 || {} }];
|
|
3499
|
+
if (e6?.services?.logger?.forward) return e6.services.logger.forward(i2, `warn`, `react-i18next::`, true);
|
|
3500
|
+
Q(i2[0]) && (i2[0] = `react-i18next:: ${i2[0]}`), e6?.services?.logger?.warn ? e6.services.logger.warn(...i2) : console?.warn && console.warn(...i2);
|
|
3501
|
+
};
|
|
3502
|
+
var yo = {};
|
|
3503
|
+
var bo = (e6, t2, n2, r2) => {
|
|
3504
|
+
Q(n2) && yo[n2] || (Q(n2) && (yo[n2] = /* @__PURE__ */ new Date()), vo(e6, t2, n2, r2));
|
|
3505
|
+
};
|
|
3506
|
+
var xo = (e6, t2) => () => {
|
|
3507
|
+
if (e6.isInitialized) t2();
|
|
3508
|
+
else {
|
|
3509
|
+
let n2 = () => {
|
|
3510
|
+
setTimeout(() => {
|
|
3511
|
+
e6.off(`initialized`, n2);
|
|
3512
|
+
}, 0), t2();
|
|
3513
|
+
};
|
|
3514
|
+
e6.on(`initialized`, n2);
|
|
3515
|
+
}
|
|
3516
|
+
};
|
|
3517
|
+
var So = (e6, t2, n2) => {
|
|
3518
|
+
e6.loadNamespaces(t2, xo(e6, n2));
|
|
3519
|
+
};
|
|
3520
|
+
var Co = (e6, t2, n2, r2) => {
|
|
3521
|
+
if (Q(n2) && (n2 = [n2]), e6.options.preload && e6.options.preload.indexOf(t2) > -1) return So(e6, n2, r2);
|
|
3522
|
+
n2.forEach((t3) => {
|
|
3523
|
+
e6.options.ns.indexOf(t3) < 0 && e6.options.ns.push(t3);
|
|
3524
|
+
}), e6.loadLanguages(t2, xo(e6, r2));
|
|
3525
|
+
};
|
|
3526
|
+
var wo = (e6, t2, n2 = {}) => !t2.languages || !t2.languages.length ? (bo(t2, `NO_LANGUAGES`, `i18n.languages were undefined or empty`, { languages: t2.languages }), true) : t2.hasLoadedNamespace(e6, { lng: n2.lng, precheck: (t3, r2) => {
|
|
3527
|
+
if (n2.bindI18n && n2.bindI18n.indexOf(`languageChanging`) > -1 && t3.services.backendConnector.backend && t3.isLanguageChangingTo && !r2(t3.isLanguageChangingTo, e6)) return false;
|
|
3528
|
+
} });
|
|
3529
|
+
var Q = (e6) => typeof e6 == `string`;
|
|
3530
|
+
var To = (e6) => typeof e6 == `object` && !!e6;
|
|
3531
|
+
var Eo = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
3532
|
+
var Do = { "&": `&`, "&": `&`, "<": `<`, "<": `<`, ">": `>`, ">": `>`, "'": `'`, "'": `'`, """: `"`, """: `"`, " ": ` `, " ": ` `, "©": `\xA9`, "©": `\xA9`, "®": `\xAE`, "®": `\xAE`, "…": `\u2026`, "…": `\u2026`, "/": `/`, "/": `/` };
|
|
3533
|
+
var Oo = (e6) => Do[e6];
|
|
3534
|
+
var ko = { bindI18n: `languageChanged`, bindI18nStore: ``, transEmptyNodeValue: ``, transSupportBasicHtmlNodes: true, transWrapTextNodes: ``, transKeepBasicHtmlNodesFor: [`br`, `strong`, `i`, `p`], useSuspense: true, unescape: (e6) => e6.replace(Eo, Oo) };
|
|
3535
|
+
var Ao = () => ko;
|
|
3536
|
+
var jo;
|
|
3537
|
+
var Mo = () => jo;
|
|
3538
|
+
var No = (0, import_react.createContext)();
|
|
3539
|
+
var Po = class {
|
|
3540
|
+
constructor() {
|
|
3541
|
+
this.usedNamespaces = {};
|
|
3542
|
+
}
|
|
3543
|
+
addUsedNamespaces(e6) {
|
|
3544
|
+
e6.forEach((e7) => {
|
|
3545
|
+
this.usedNamespaces[e7] || (this.usedNamespaces[e7] = true);
|
|
3546
|
+
});
|
|
3547
|
+
}
|
|
3548
|
+
getUsedNamespaces() {
|
|
3549
|
+
return Object.keys(this.usedNamespaces);
|
|
3550
|
+
}
|
|
3551
|
+
};
|
|
3552
|
+
var Fo = (e6, t2) => {
|
|
3553
|
+
let n2 = (0, import_react.useRef)();
|
|
3554
|
+
return (0, import_react.useEffect)(() => {
|
|
3555
|
+
n2.current = t2 ? n2.current : e6;
|
|
3556
|
+
}, [e6, t2]), n2.current;
|
|
3557
|
+
};
|
|
3558
|
+
var Io = (e6, t2, n2, r2) => e6.getFixedT(t2, n2, r2);
|
|
3559
|
+
var Lo = (e6, t2, n2, i2) => (0, import_react.useCallback)(Io(e6, t2, n2, i2), [e6, t2, n2, i2]);
|
|
3560
|
+
var Ro = (e6, t2 = {}) => {
|
|
3561
|
+
let { i18n: n2 } = t2, { i18n: r2, defaultNS: o2 } = (0, import_react.useContext)(No) || {}, l2 = n2 || r2 || Mo();
|
|
3562
|
+
if (l2 && !l2.reportNamespaces && (l2.reportNamespaces = new Po()), !l2) {
|
|
3563
|
+
bo(l2, `NO_I18NEXT_INSTANCE`, `useTranslation: You will need to pass in an i18next instance by using initReactI18next`);
|
|
3564
|
+
let e7 = (e8, t4) => Q(t4) ? t4 : To(t4) && Q(t4.defaultValue) ? t4.defaultValue : Array.isArray(e8) ? e8[e8.length - 1] : e8, t3 = [e7, {}, false];
|
|
3565
|
+
return t3.t = e7, t3.i18n = {}, t3.ready = false, t3;
|
|
3566
|
+
}
|
|
3567
|
+
l2.options.react?.wait && bo(l2, `DEPRECATED_OPTION`, `useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.`);
|
|
3568
|
+
let u2 = { ...Ao(), ...l2.options.react, ...t2 }, { useSuspense: d2, keyPrefix: f2 } = u2, p2 = e6 || o2 || l2.options?.defaultNS;
|
|
3569
|
+
p2 = Q(p2) ? [p2] : p2 || [`translation`], l2.reportNamespaces.addUsedNamespaces?.(p2);
|
|
3570
|
+
let m2 = (l2.isInitialized || l2.initializedStoreOnce) && p2.every((e7) => wo(e7, l2, u2)), h2 = Lo(l2, t2.lng || null, u2.nsMode === `fallback` ? p2 : p2[0], f2), g2 = () => h2, _2 = () => Io(l2, t2.lng || null, u2.nsMode === `fallback` ? p2 : p2[0], f2), [v2, y2] = (0, import_react.useState)(g2), b2 = p2.join();
|
|
3571
|
+
t2.lng && (b2 = `${t2.lng}${b2}`);
|
|
3572
|
+
let x2 = Fo(b2), S2 = (0, import_react.useRef)(true);
|
|
3573
|
+
(0, import_react.useEffect)(() => {
|
|
3574
|
+
let { bindI18n: e7, bindI18nStore: n3 } = u2;
|
|
3575
|
+
S2.current = true, !m2 && !d2 && (t2.lng ? Co(l2, t2.lng, p2, () => {
|
|
3576
|
+
S2.current && y2(_2);
|
|
3577
|
+
}) : So(l2, p2, () => {
|
|
3578
|
+
S2.current && y2(_2);
|
|
3579
|
+
})), m2 && x2 && x2 !== b2 && S2.current && y2(_2);
|
|
3580
|
+
let r3 = () => {
|
|
3581
|
+
S2.current && y2(_2);
|
|
3582
|
+
};
|
|
3583
|
+
return e7 && l2?.on(e7, r3), n3 && l2?.store.on(n3, r3), () => {
|
|
3584
|
+
S2.current = false, l2 && e7 && e7?.split(` `).forEach((e8) => l2.off(e8, r3)), n3 && l2 && n3.split(` `).forEach((e8) => l2.store.off(e8, r3));
|
|
3585
|
+
};
|
|
3586
|
+
}, [l2, b2]), (0, import_react.useEffect)(() => {
|
|
3587
|
+
S2.current && m2 && y2(g2);
|
|
3588
|
+
}, [l2, f2, m2]);
|
|
3589
|
+
let C2 = [v2, l2, m2];
|
|
3590
|
+
if (C2.t = v2, C2.i18n = l2, C2.ready = m2, m2 || !m2 && !d2) return C2;
|
|
3591
|
+
throw new Promise((e7) => {
|
|
3592
|
+
t2.lng ? Co(l2, t2.lng, p2, () => e7()) : So(l2, p2, () => e7());
|
|
3593
|
+
});
|
|
3594
|
+
};
|
|
3595
|
+
function zo({ i18n: e6, defaultNS: n2, children: r2 }) {
|
|
3596
|
+
let i2 = (0, import_react.useMemo)(() => ({ i18n: e6, defaultNS: n2 }), [e6, n2]);
|
|
3597
|
+
return (0, import_react.createElement)(No.Provider, { value: i2 }, r2);
|
|
3598
|
+
}
|
|
3599
|
+
var Bo = I(`@wix/site-service-renderer-configuration`);
|
|
3600
|
+
var Vo = () => {
|
|
3601
|
+
let e6, t2;
|
|
3602
|
+
try {
|
|
3603
|
+
e6 = (0, import_services_manager_react.useService)(Bo).languageCode;
|
|
3604
|
+
} catch {
|
|
3605
|
+
}
|
|
3606
|
+
try {
|
|
3607
|
+
t2 = (0, import_services_manager_react.useService)(Lr).language;
|
|
3608
|
+
} catch {
|
|
3609
|
+
}
|
|
3610
|
+
return e6 || t2;
|
|
3611
|
+
};
|
|
3612
|
+
var Ho = `wix-warmup-data`;
|
|
3613
|
+
var Uo = null;
|
|
3614
|
+
function Wo(e6) {
|
|
3615
|
+
if (typeof document < `u`) try {
|
|
3616
|
+
let t2 = document.getElementById(Ho)?.textContent;
|
|
3617
|
+
return t2 ? (Uo?.text !== t2 && (Uo = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), Uo.data[e6] ?? void 0) : void 0;
|
|
3618
|
+
} catch {
|
|
3619
|
+
return;
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
var Go = `blog-builder:i18n`;
|
|
3623
|
+
var Ko = () => Wo(Go);
|
|
3624
|
+
var qo = /* @__PURE__ */ new Map();
|
|
3625
|
+
function Jo(e6, t2) {
|
|
3626
|
+
let n2 = qo.get(e6);
|
|
3627
|
+
if (n2) return n2;
|
|
3628
|
+
let r2 = Ko(), i2 = r2?.locale === e6 ? r2.messages : void 0, a2 = _o({ locale: e6, useSuspense: true, ...i2 ? { messages: i2 } : { asyncMessagesLoader: t2 } });
|
|
3629
|
+
return qo.set(e6, a2), a2;
|
|
3630
|
+
}
|
|
3631
|
+
var Yo = (e6, t2, n2) => {
|
|
3632
|
+
let r2 = t2.lastIndexOf(`?`), i2 = e6[r2 === -1 || r2 < t2.lastIndexOf(`/`) ? t2 : t2.slice(0, r2)];
|
|
3633
|
+
return i2 ? typeof i2 == `function` ? i2() : Promise.resolve(i2) : new Promise((e7, r3) => {
|
|
3634
|
+
(typeof queueMicrotask == `function` ? queueMicrotask : setTimeout)(r3.bind(null, Error(`Unknown variable dynamic import: ` + t2 + (t2.split(`/`).length === n2 ? `` : `. Note that variables only represent file names one level deep.`))));
|
|
3635
|
+
});
|
|
3636
|
+
};
|
|
3637
|
+
var Xo = (e6) => e6.split(`-`)[0] ?? e6;
|
|
3638
|
+
Vr({ isDev: false, loadMessages: (e6) => Yo(Object.assign({ "../assets/locale/messages_en.dev.json": () => fn(() => Promise.resolve().then(() => Qo), void 0, import_meta.url), "../assets/locale/messages_en.json": () => fn(() => Promise.resolve().then(() => es), void 0, import_meta.url) }), `../assets/locale/messages_${Xo(e6)}.json`, 4), loadDevMessages: (e6) => Yo(Object.assign({ "../assets/locale/messages_en.dev.json": () => fn(() => Promise.resolve().then(() => Qo), void 0, import_meta.url) }), `../assets/locale/messages_${Xo(e6)}.dev.json`, 4) });
|
|
3639
|
+
function Zo(e6) {
|
|
3640
|
+
let t2 = Vo(), n2 = Ko()?.locale ?? t2 ?? `en`;
|
|
3641
|
+
return { i18n: Jo(n2, e6), locale: n2 };
|
|
3642
|
+
}
|
|
3643
|
+
var Qo = p({ default: () => $o });
|
|
3644
|
+
var $o = { "post.time-to-read": `{count, plural, one {# min read} other {# min read}}`, "post.view-count": `{count, plural, one {{formatted} view} other {{formatted} views}}`, "post.comment-count": `{count, plural, one {{formatted} comment} other {{formatted} comments}}`, "post.like-count": `{count, plural, one {{formatted} like} other {{formatted} likes}}`, "post-list.empty-state.title": `No posts yet`, "post-list.empty-state.description": `Once posts are published, they will appear here.`, "related-posts.empty-state.title": `No related posts yet`, "related-posts.empty-state.description": `Once more posts are published, they will appear here.`, "post-actions.like": `Like post`, "post-actions.unlike": `Unlike post`, "post-actions.share": `Share post`, "post-actions.share-dialog": `Share post`, "post-actions.link-copied": `Link copied`, "post-actions.copy-manually": `Copy the link below to share this post.`, "post-actions.link-label": `Post link`, "post-actions.copy-link": `Copy link`, "post-actions.close": `Close`, "post-counters.loading-likes": `Loading likes`, "cover-media.play": `Play video`, "cover-media.placeholder-alt": `Post cover image`, "post-comments.loading": `Loading comments\u2026`, "post-comments.no-post": `No post resolved for this URL yet.`, "post-comments.unavailable": `Comments are unavailable \u2014 no app instance.`, "post-comments.demo-notice": `Sample comments are shown while editing. Visitors will see real comments.`, "canvas.post-title": `Post Title`, "canvas.author-name": `Author Name`, "canvas.excerpt": `Share the key idea of your post here. This short summary shows on feed cards and in search results, and tells readers why the post is worth their time.`, "canvas.content": `This is where the full post appears. Write your story here, add images, galleries and video from the dashboard, and use headings and quotes to keep it easy to read.`, "canvas.category": `Category`, "canvas.category-numbered": `Category {number}`, "canvas.tag-numbered": `Tag {number}`, "canvas.author-photo-alt": `Author photo`, "category-header.all-posts": `All Posts` };
|
|
3645
|
+
var es = p({ default: () => ns, title: () => ts });
|
|
3646
|
+
var ts = `My App`;
|
|
3647
|
+
var ns = { "canvas.category": `Category`, "post-list.empty-state.description": `Once posts are published, they will appear here.`, "canvas.tag-numbered": `Tag {number}`, "cover-media.play": `Play video`, "post-comments.unavailable": `Comments are unavailable \u2014 no app instance.`, "post-counters.loading-likes": `Loading likes`, "post-comments.loading": `Loading comments\u2026`, "post-actions.like": `Like post`, "canvas.content": `This is where the full post appears. Write your story here, add images, galleries and video from the dashboard, and use headings and quotes to keep it easy to read.`, "related-posts.empty-state.title": `No related posts yet`, "post.time-to-read": `{count, plural, one {# min read} other {# min read}}`, "post-actions.link-copied": `Link copied`, "category-header.all-posts": `All Posts`, "post-actions.copy-manually": `Copy the link below to share this post.`, "post-actions.copy-link": `Copy link`, "cover-media.placeholder-alt": `Post cover image`, "post-actions.link-label": `Post link`, "post-list.empty-state.title": `No posts yet`, "post-actions.share-dialog": `Share post`, "canvas.post-title": `Post Title`, "post-actions.unlike": `Unlike post`, "post-comments.no-post": `No post resolved for this URL yet.`, "post.like-count": `{count, plural, one {{formatted} like} other {{formatted} likes}}`, "canvas.category-numbered": `Category {number}`, "post.comment-count": `{count, plural, one {{formatted} comment} other {{formatted} comments}}`, "post-actions.share": `Share post`, "post.view-count": `{count, plural, one {{formatted} view} other {{formatted} views}}`, "post-actions.close": `Close`, "canvas.category-description": `Add a short description of this category so readers know what they will find here. It shows under the category title, above the posts.`, "canvas.author-photo-alt": `Author photo`, "canvas.author-name": `Author Name`, "post-comments.demo-notice": `Sample comments are shown while editing. Visitors will see real comments.`, title: ts, "related-posts.empty-state.description": `Once more posts are published, they will appear here.`, "canvas.excerpt": `Share the key idea of your post here. This short summary shows on feed cards and in search results, and tells readers why the post is worth their time.` };
|
|
3648
|
+
var rs = Object.assign({ "../assets/locale/messages_en.dev.json": Qo, "../assets/locale/messages_en.json": es });
|
|
3649
|
+
var is = (e6, t2) => {
|
|
3650
|
+
let n2 = rs[`../assets/locale/messages_${Xo(e6)}${t2}.json`];
|
|
3651
|
+
return n2 ? Promise.resolve(n2) : Promise.reject(Error(`no messages file`));
|
|
3652
|
+
};
|
|
3653
|
+
var as = Vr({ isDev: false, loadMessages: (e6) => is(e6, ``), loadDevMessages: (e6) => is(e6, `.dev`) });
|
|
3654
|
+
var os = (e6, t2, n2) => typeof e6 != `number` || !Number.isFinite(e6) || e6 < 0 ? `` : new Intl.NumberFormat(n2, t2 === `compact` ? { notation: `compact`, maximumFractionDigits: 1 } : void 0).format(e6);
|
|
3655
|
+
var $ = { timeToRead: `post.time-to-read`, viewCount: `post.view-count`, commentCount: `post.comment-count`, likeCount: `post.like-count`, noPostsTitle: `post-list.empty-state.title`, noPostsDescription: `post-list.empty-state.description`, noRelatedPostsTitle: `related-posts.empty-state.title`, noRelatedPostsDescription: `related-posts.empty-state.description`, canvasPostTitle: `canvas.post-title`, canvasAuthorName: `canvas.author-name`, canvasExcerpt: `canvas.excerpt`, canvasContent: `canvas.content`, canvasCategory: `canvas.category`, canvasCategoryNumbered: `canvas.category-numbered`, canvasTagNumbered: `canvas.tag-numbered`, canvasCoverAlt: `cover-media.placeholder-alt`, canvasAuthorPhotoAlt: `canvas.author-photo-alt` };
|
|
3656
|
+
var ss = (e6, t2) => {
|
|
3657
|
+
let n2 = (n3) => (r2) => e6(n3, { count: r2, formatted: os(r2, `full`, t2) });
|
|
3658
|
+
return { timeToRead: (t3) => e6($.timeToRead, { count: t3 }), viewCount: n2($.viewCount), commentCount: n2($.commentCount), likeCount: n2($.likeCount), noPostsEmptyState: () => ({ title: e6($.noPostsTitle), description: e6($.noPostsDescription) }), noRelatedPostsEmptyState: () => ({ title: e6($.noRelatedPostsTitle), description: e6($.noRelatedPostsDescription) }), canvas: { postTitle: () => e6($.canvasPostTitle), authorName: () => e6($.canvasAuthorName), excerpt: () => e6($.canvasExcerpt), content: () => e6($.canvasContent), category: () => e6($.canvasCategory), categoryNumbered: (t3) => e6($.canvasCategoryNumbered, { number: t3 }), tagNumbered: (t3) => e6($.canvasTagNumbered, { number: t3 }), coverAlt: () => e6($.canvasCoverAlt), authorPhotoAlt: () => e6($.canvasAuthorPhotoAlt) } };
|
|
3659
|
+
};
|
|
3660
|
+
var cs = (e6) => e6.replace(/&/g, `&`).replace(/</g, `<`).replace(/>/g, `>`).replace(/"/g, `"`).replace(/'/g, `'`);
|
|
3661
|
+
var ls = (e6) => ({ text: e6, html: `<p>${cs(e6)}</p>`, linkList: [] });
|
|
3662
|
+
var us = (0, import_react.createContext)(null);
|
|
3663
|
+
us.displayName = `PostItemContext`;
|
|
3664
|
+
function ds() {
|
|
3665
|
+
return (0, import_react.useContext)(us);
|
|
3666
|
+
}
|
|
3667
|
+
function fs({ postData: e6, children: t2 }) {
|
|
3668
|
+
let n2 = Rr(), { t: r2, ready: i2 } = Ro(void 0, { useSuspense: false }), a2 = (0, import_react.useMemo)(() => ss(r2, n2), [r2, n2]), { isLiked: s2, likeCount: c2, isLikeCountLoaded: l2, viewCount: u2, commentCount: f2, toggleLike: p2, liveLikes: m2 } = Ir(e6.recentPostItem.slug ? e6._id : void 0, 0), h2 = (0, import_react.useMemo)(() => ({ ...e6, isLiked: s2, isLikeCountLoaded: l2, toggleLike: p2, liveLikes: m2, likeCountValue: c2, viewCountValue: u2 ?? e6.initialViewCount, commentCountValue: f2 ?? e6.initialCommentCount, likeCount: ls(i2 ? a2.likeCount(c2) : ``), viewCount: u2 === void 0 || !i2 ? e6.viewCount : ls(a2.viewCount(u2)), commentCount: f2 === void 0 || !i2 ? e6.commentCount : ls(a2.commentCount(f2)) }), [e6, s2, c2, l2, u2, f2, p2, m2, a2, i2]);
|
|
3669
|
+
return (0, import_jsx_runtime.jsx)(us.Provider, { value: h2, children: t2 });
|
|
3670
|
+
}
|
|
3671
|
+
function ps({ postData: e6, children: t2 }) {
|
|
3672
|
+
let { i18n: n2 } = Zo(as);
|
|
3673
|
+
return e6 === void 0 ? (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: t2 }) : (0, import_jsx_runtime.jsx)(zo, { i18n: n2, children: (0, import_jsx_runtime.jsx)(fs, { postData: e6, children: t2 }) });
|
|
3674
|
+
}
|
|
3675
|
+
var ms = En(`bd5dc6d6-7a0d-48d5-99da-457340ce6f2d`);
|
|
3676
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
3677
|
+
0 && (module.exports = {
|
|
3678
|
+
PostItemContextProvider,
|
|
3679
|
+
injectAccessTokenGetter,
|
|
3680
|
+
usePostItemContext
|
|
3681
|
+
});
|
|
3682
|
+
//# sourceMappingURL=context-post-item-context-provider.js.map
|