@wix/bookings 1.0.1772 → 1.0.1774
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-categories/runtime.js +2 -2
- package/_sdk-exports/context-locations/runtime.js +2 -2
- package/_sdk-exports/context-service/runtime.js +3 -3
- package/_sdk-exports/context-service-addons/runtime.js +2 -2
- package/_sdk-exports/context-services/runtime.js +3 -3
- package/build/cjs/context-categories.js +1774 -632
- package/build/cjs/context-categories.js.map +1 -1
- package/build/cjs/context-locations.js +1812 -670
- package/build/cjs/context-locations.js.map +1 -1
- package/build/cjs/context-service-addons.js +1858 -716
- package/build/cjs/context-service-addons.js.map +1 -1
- package/build/cjs/context-service.js +4413 -3286
- package/build/cjs/context-service.js.map +1 -1
- package/build/cjs/context-services.js +2410 -1268
- package/build/cjs/context-services.js.map +1 -1
- package/build/es/context-categories.mjs +1774 -632
- package/build/es/context-categories.mjs.map +1 -1
- package/build/es/context-locations.mjs +1812 -670
- package/build/es/context-locations.mjs.map +1 -1
- package/build/es/context-service-addons.mjs +1858 -716
- package/build/es/context-service-addons.mjs.map +1 -1
- package/build/es/context-service.mjs +4413 -3286
- package/build/es/context-service.mjs.map +1 -1
- package/build/es/context-services.mjs +2411 -1269
- package/build/es/context-services.mjs.map +1 -1
- package/package.json +6 -6
|
@@ -20,12 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// context-categories.ts
|
|
21
21
|
var context_categories_exports = {};
|
|
22
22
|
__export(context_categories_exports, {
|
|
23
|
-
CATEGORIES_CONTEXT_MISSING_PROVIDER_ERROR: () =>
|
|
24
|
-
CategoriesContextProvider: () =>
|
|
23
|
+
CATEGORIES_CONTEXT_MISSING_PROVIDER_ERROR: () => ki,
|
|
24
|
+
CategoriesContextProvider: () => Fi,
|
|
25
25
|
categoriesContext: () => $,
|
|
26
|
-
default: () =>
|
|
27
|
-
injectAccessTokenGetter: () =>
|
|
28
|
-
useCategoriesContext: () =>
|
|
26
|
+
default: () => Fi,
|
|
27
|
+
injectAccessTokenGetter: () => Ii,
|
|
28
|
+
useCategoriesContext: () => Ai
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(context_categories_exports);
|
|
31
31
|
|
|
@@ -34,11 +34,11 @@ var import_react = require("react");
|
|
|
34
34
|
var import_services_manager_react = require("@wix/services-manager-react");
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var p = {};
|
|
37
|
-
function m(
|
|
38
|
-
return () => ({ __type: `event-definition`, type:
|
|
37
|
+
function m(e5, t2 = false, n2 = (e6) => e6) {
|
|
38
|
+
return () => ({ __type: `event-definition`, type: e5, isDomainEvent: t2, transformations: n2 });
|
|
39
39
|
}
|
|
40
|
-
var h = (
|
|
41
|
-
switch (
|
|
40
|
+
var h = (e5) => {
|
|
41
|
+
switch (e5) {
|
|
42
42
|
case `get`:
|
|
43
43
|
case `GET`:
|
|
44
44
|
return `GET`;
|
|
@@ -61,184 +61,184 @@ var h = (e2) => {
|
|
|
61
61
|
case `OPTIONS`:
|
|
62
62
|
return `OPTIONS`;
|
|
63
63
|
default:
|
|
64
|
-
throw Error(`Unknown method: ${
|
|
64
|
+
throw Error(`Unknown method: ${e5}`);
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
var g = (
|
|
67
|
+
var g = (e5) => (t2) => async (n2) => {
|
|
68
68
|
let r2, i2 = (t3) => {
|
|
69
|
-
if (r2 =
|
|
69
|
+
if (r2 = e5(n2)(t3), r2.url === void 0) throw Error(`Url was not successfully created for this request, please reach out to support channels for assistance.`);
|
|
70
70
|
let { method: i3, url: a2, params: o2 } = r2;
|
|
71
71
|
return { ...r2, method: h(i3), url: a2, data: r2.data, params: o2 };
|
|
72
72
|
};
|
|
73
73
|
try {
|
|
74
|
-
let
|
|
74
|
+
let e6 = await t2.request(i2);
|
|
75
75
|
if (r2 === void 0) throw Error(`Request options were not created for this request, please reach out to support channels for assistance.`);
|
|
76
|
-
let n3 = Array.isArray(r2.transformResponse) ? r2.transformResponse : [r2.transformResponse], a2 =
|
|
76
|
+
let n3 = Array.isArray(r2.transformResponse) ? r2.transformResponse : [r2.transformResponse], a2 = e6.data;
|
|
77
77
|
return n3.forEach((t3) => {
|
|
78
|
-
t3 && (a2 = t3(
|
|
78
|
+
t3 && (a2 = t3(e6.data, e6.headers));
|
|
79
79
|
}), a2;
|
|
80
|
-
} catch (
|
|
81
|
-
throw typeof
|
|
80
|
+
} catch (e6) {
|
|
81
|
+
throw typeof e6 == `object` && e6 && `response` in e6 && typeof e6.response == `object` && e6.response !== null && `data` in e6.response ? e6.response.data : e6;
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
var _ = (
|
|
84
|
+
var _ = (e5) => e5.__isAmbassador ? true : !!e5().__isAmbassador;
|
|
85
85
|
var v = `__metadata`;
|
|
86
86
|
var y = `edge.wixapis.com`;
|
|
87
87
|
var b = class extends Error {
|
|
88
88
|
message;
|
|
89
89
|
response;
|
|
90
|
-
constructor(
|
|
91
|
-
super(
|
|
90
|
+
constructor(e5, t2) {
|
|
91
|
+
super(e5), this.message = e5, this.response = t2;
|
|
92
92
|
}
|
|
93
93
|
async details() {
|
|
94
|
-
let
|
|
95
|
-
return x(this.response.status,
|
|
94
|
+
let e5 = await this.response.json();
|
|
95
|
+
return x(this.response.status, e5?.message, e5?.details, { requestId: this.response.headers.get(`X-Wix-Request-Id`), details: e5 });
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
-
var x = (
|
|
99
|
-
var S = (
|
|
100
|
-
var
|
|
101
|
-
var
|
|
102
|
-
function
|
|
103
|
-
return
|
|
98
|
+
var x = (e5, t2, n2, r2) => ({ details: { ...!n2?.validationError && { applicationError: { description: t2, code: e5, data: r2 } }, ...n2 }, message: t2, requestId: r2?.requestId });
|
|
99
|
+
var S = (e5) => e5?.method && [`post`, `put`, `patch`].includes(e5.method.toLocaleLowerCase()) && e5.body ? { "Content-Type": `application/json` } : {};
|
|
100
|
+
var ee = (e5) => e5 && typeof e5 == `object` && !Array.isArray(e5);
|
|
101
|
+
var C = (e5) => e5.__type === `host`;
|
|
102
|
+
function w(e5, t2) {
|
|
103
|
+
return e5.create(t2);
|
|
104
104
|
}
|
|
105
|
-
var
|
|
106
|
-
function
|
|
107
|
-
return { [
|
|
105
|
+
var T = `x-wix-bi-gateway`;
|
|
106
|
+
function te(e5, t2, n2) {
|
|
107
|
+
return { [T]: ne({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e5.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e5.methodFqn, entity: e5.entityFqdn }) };
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
return Object.entries(
|
|
109
|
+
function ne(e5) {
|
|
110
|
+
return Object.entries(e5).filter(([e6, t2]) => !!t2).map(([e6, t2]) => `${e6}=${t2}`).join(`,`);
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function re(e5) {
|
|
113
113
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
114
114
|
globalThis.__wix_context__ = void 0, p.client = void 0, p.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
115
115
|
try {
|
|
116
|
-
return
|
|
116
|
+
return e5();
|
|
117
117
|
} finally {
|
|
118
118
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
var
|
|
122
|
-
function
|
|
123
|
-
return
|
|
124
|
-
}
|
|
125
|
-
var
|
|
126
|
-
var
|
|
127
|
-
var
|
|
128
|
-
var
|
|
129
|
-
function
|
|
130
|
-
let t2 =
|
|
131
|
-
t2 = t2.replace(
|
|
121
|
+
var ie = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
122
|
+
function E(e5) {
|
|
123
|
+
return le(e5).map((e6) => e6.toLocaleUpperCase()).join(`_`);
|
|
124
|
+
}
|
|
125
|
+
var ae = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
126
|
+
var oe = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
127
|
+
var se = `$1\0$2`;
|
|
128
|
+
var ce = /[^\p{L}\d]+/giu;
|
|
129
|
+
function le(e5) {
|
|
130
|
+
let t2 = e5.trim();
|
|
131
|
+
t2 = t2.replace(ae, se).replace(oe, se), t2 = t2.replace(ce, `\0`);
|
|
132
132
|
let n2 = 0, r2 = t2.length;
|
|
133
133
|
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
134
134
|
if (n2 === r2) return [];
|
|
135
135
|
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
136
136
|
return t2.slice(n2, r2).split(/\0/g);
|
|
137
137
|
}
|
|
138
|
-
var
|
|
139
|
-
var
|
|
140
|
-
var
|
|
141
|
-
function
|
|
142
|
-
if (typeof
|
|
143
|
-
if (
|
|
144
|
-
if (
|
|
145
|
-
if (
|
|
146
|
-
let t3 =
|
|
147
|
-
return
|
|
148
|
-
}
|
|
149
|
-
return
|
|
150
|
-
}
|
|
151
|
-
var
|
|
152
|
-
let r2 =
|
|
153
|
-
return
|
|
138
|
+
var ue = (e5) => `validationError` in (e5.response?.data?.details ?? {});
|
|
139
|
+
var de = (e5) => `applicationError` in (e5.response?.data?.details ?? {});
|
|
140
|
+
var fe = (e5) => (e5.response?.status ?? -1) >= 400 && (e5.response?.status ?? -1) < 500;
|
|
141
|
+
function pe(e5, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
142
|
+
if (typeof e5 != `object` || !e5) throw e5;
|
|
143
|
+
if (ue(e5)) return me(e5, t2, n2);
|
|
144
|
+
if (de(e5)) return he(e5);
|
|
145
|
+
if (fe(e5)) {
|
|
146
|
+
let t3 = e5.response?.status, n3 = e5.response?.statusText ?? `UNKNOWN`, r2 = e5.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: E(n3), data: {} }, requestId: e5.requestId };
|
|
147
|
+
return D(e5, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
148
|
+
}
|
|
149
|
+
return ge(e5);
|
|
150
|
+
}
|
|
151
|
+
var me = (e5, t2, n2) => {
|
|
152
|
+
let r2 = e5.response?.data, i2 = e5.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = _e(t2, a2, n2)?.sort((e6, t3) => e6.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e6, description: t3 }) => `"${e6}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
|
|
153
|
+
return D(e5, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e5.response?.status, requestId: i2 } });
|
|
154
154
|
};
|
|
155
|
-
var
|
|
156
|
-
var
|
|
157
|
-
let t2 =
|
|
158
|
-
return
|
|
155
|
+
var D = (e5, { message: t2, extraProperties: n2 }) => Object.assign(e5, { ...n2, message: t2 });
|
|
156
|
+
var he = (e5) => {
|
|
157
|
+
let t2 = e5.response?.status, n2 = e5.response?.statusText ?? `UNKNOWN`, r2 = e5.response?.data?.message ?? n2, i2 = e5.response?.data?.details?.applicationError?.description ?? n2, a2 = e5.response?.data?.details?.applicationError?.code ?? E(n2), o2 = e5.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e5.requestId };
|
|
158
|
+
return D(e5, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e5.requestId } });
|
|
159
159
|
};
|
|
160
|
-
var
|
|
161
|
-
var
|
|
162
|
-
let a2 = { ...
|
|
163
|
-
return r2?.filter((
|
|
164
|
-
let r3 = t2[
|
|
165
|
-
if (r3) return { ...
|
|
166
|
-
let s2 = o2?.sort((
|
|
160
|
+
var ge = (e5) => D(e5, { message: e5.requestId ? `System error occurred, request-id: ${e5.requestId}` : `System error occurred: ${JSON.stringify(e5)}`, extraProperties: { requestId: e5.requestId, status: e5.response?.status, code: E(e5.response?.statusText ?? `UNKNOWN`), ...!e5.response && { runtimeError: e5 } } });
|
|
161
|
+
var _e = ({ spreadPathsToArguments: e5, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
162
|
+
let a2 = { ...e5, ...t2 }, o2 = Object.keys(a2);
|
|
163
|
+
return r2?.filter((e6) => !r2.some((t3) => t3.field.length > e6.field.length && t3.field.startsWith(e6.field) && o2.includes(t3.field))).map((e6) => {
|
|
164
|
+
let r3 = t2[e6.field];
|
|
165
|
+
if (r3) return { ...e6, field: ve(r3, i2) };
|
|
166
|
+
let s2 = o2?.sort((e7, t3) => t3.length - e7.length)?.find((t3) => e6.field.startsWith(t3));
|
|
167
167
|
if (s2) {
|
|
168
168
|
let t3 = a2[s2];
|
|
169
|
-
if (t3) return { ...
|
|
169
|
+
if (t3) return { ...e6, field: e6.field.replace(s2, ve(t3, i2)) };
|
|
170
170
|
}
|
|
171
|
-
return n2 ? { ...
|
|
171
|
+
return n2 ? { ...e6, field: `${i2[0]}.${e6.field}` } : e6;
|
|
172
172
|
});
|
|
173
173
|
};
|
|
174
|
-
var
|
|
175
|
-
let n2 =
|
|
176
|
-
return n2 == null ?
|
|
174
|
+
var ve = (e5, t2) => {
|
|
175
|
+
let n2 = ye(e5);
|
|
176
|
+
return n2 == null ? e5 : e5.replace(`$[${n2}]`, t2[n2]);
|
|
177
177
|
};
|
|
178
|
-
var
|
|
179
|
-
let t2 =
|
|
178
|
+
var ye = (e5) => {
|
|
179
|
+
let t2 = e5.match(/\$\[(?<argIndex>\d+)\]/);
|
|
180
180
|
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
181
181
|
};
|
|
182
|
-
function
|
|
183
|
-
return
|
|
184
|
-
let i3 =
|
|
182
|
+
function be(e5, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
183
|
+
return re(() => e5({ request: async (e6) => {
|
|
184
|
+
let i3 = e6({ host: s2?.HTTPHost || `www.wixapis.com` }), a3 = i3;
|
|
185
185
|
a3.method === `GET` && a3.fallback?.length && (a3.params?.toString().length ?? 0) > 4e3 && (a3 = i3.fallback[0]);
|
|
186
186
|
let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ? y : o3}${a3.url}`;
|
|
187
187
|
a3.params && a3.params.toString() && (u3 += `?${a3.params.toString()}`);
|
|
188
188
|
try {
|
|
189
|
-
let
|
|
189
|
+
let e7 = te(i3, t2, c2), o4 = { method: a3.method, ...a3.data && { body: JSON.stringify(a3.data) }, headers: { ...e7 } }, s3 = await n2(u3, o4);
|
|
190
190
|
if (s3.status !== 200) {
|
|
191
|
-
let
|
|
191
|
+
let e8 = null;
|
|
192
192
|
try {
|
|
193
|
-
|
|
193
|
+
e8 = await s3.json();
|
|
194
194
|
} catch {
|
|
195
195
|
}
|
|
196
|
-
let t3 =
|
|
196
|
+
let t3 = Se(s3.status, e8?.message ?? s3.statusText, e8?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e8 }), n3 = pe(t3);
|
|
197
197
|
throw r2?.handleError(n3, { requestOptions: { url: a3.url, method: a3.method, entityFqdn: i3.entityFqdn, methodFqn: i3.methodFqn } }), t3;
|
|
198
198
|
}
|
|
199
199
|
let l3 = await s3.json();
|
|
200
200
|
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 };
|
|
201
|
-
} catch (
|
|
202
|
-
throw
|
|
201
|
+
} catch (e7) {
|
|
202
|
+
throw e7.message?.includes(`fetch is not defined`) && console.error(`Node.js v18+ is required`), e7;
|
|
203
203
|
}
|
|
204
204
|
}, fetchWithAuth: n2, wixAPIFetch: i2, getActiveToken: a2, getAuthHeaders: o2 }, { validateRequestSchema: u2 }));
|
|
205
205
|
}
|
|
206
|
-
var
|
|
206
|
+
var xe = class extends Error {
|
|
207
207
|
response;
|
|
208
208
|
requestId;
|
|
209
|
-
constructor(
|
|
210
|
-
super(), this.response =
|
|
209
|
+
constructor(e5) {
|
|
210
|
+
super(), this.response = e5.response, this.requestId = e5.requestId;
|
|
211
211
|
}
|
|
212
212
|
};
|
|
213
|
-
var
|
|
214
|
-
var
|
|
215
|
-
function
|
|
216
|
-
if (
|
|
217
|
-
let r2 =
|
|
218
|
-
for (let
|
|
219
|
-
let t3 = r2[
|
|
220
|
-
if (
|
|
213
|
+
var Se = (e5, t2, n2, r2) => new xe({ response: { data: { details: { ...!n2?.validationError && { applicationError: { description: t2, code: e5, data: r2 } }, ...n2 }, message: t2 }, status: e5 }, requestId: r2?.requestId });
|
|
214
|
+
var Ce = `.`;
|
|
215
|
+
function we(e5, t2, n2) {
|
|
216
|
+
if (e5 == null) throw Error(`Cannot set value on null or undefined`);
|
|
217
|
+
let r2 = Te(t2), i2 = e5;
|
|
218
|
+
for (let e6 = 0; e6 < r2.length; e6++) {
|
|
219
|
+
let t3 = r2[e6];
|
|
220
|
+
if (e6 === r2.length - 1) {
|
|
221
221
|
i2[t3] = n2;
|
|
222
222
|
break;
|
|
223
223
|
}
|
|
224
|
-
let a2 = r2[
|
|
224
|
+
let a2 = r2[e6 + 1];
|
|
225
225
|
(!(t3 in i2) || i2[t3] == null || typeof i2[t3] != `object` || i2[t3] === null) && (i2[t3] = typeof a2 == `number` ? [] : {}), i2 = i2[t3];
|
|
226
226
|
}
|
|
227
|
-
return
|
|
227
|
+
return e5;
|
|
228
228
|
}
|
|
229
|
-
function
|
|
230
|
-
return Array.isArray(
|
|
229
|
+
function Te(e5) {
|
|
230
|
+
return Array.isArray(e5) ? e5 : e5.split(Ce).map((e6) => Ee(e6) ? Number(e6) : e6);
|
|
231
231
|
}
|
|
232
|
-
function Ee(
|
|
233
|
-
return /^\d+$/.test(
|
|
232
|
+
function Ee(e5) {
|
|
233
|
+
return /^\d+$/.test(e5);
|
|
234
234
|
}
|
|
235
|
-
function De(
|
|
235
|
+
function De(e5) {
|
|
236
236
|
let t2 = {};
|
|
237
|
-
for (let [n2, r2] of Object.entries(
|
|
237
|
+
for (let [n2, r2] of Object.entries(e5)) Oe(n2) || we(t2, Te(n2), r2);
|
|
238
238
|
return t2;
|
|
239
239
|
}
|
|
240
|
-
function Oe(
|
|
241
|
-
return
|
|
240
|
+
function Oe(e5) {
|
|
241
|
+
return e5 === `__proto__` || e5 === `constructor` || e5 === `prototype`;
|
|
242
242
|
}
|
|
243
243
|
var ke = class {
|
|
244
244
|
BRACKET_PATTERN = /\[(\d+)\]/g;
|
|
@@ -253,593 +253,1714 @@ var ke = class {
|
|
|
253
253
|
ESCAPED_LEFT_BRACKET_PLACEHOLDER = `__LB__`;
|
|
254
254
|
modifiedFields;
|
|
255
255
|
cleanedModifiedFields;
|
|
256
|
-
constructor(
|
|
257
|
-
this.modifiedFields =
|
|
256
|
+
constructor(e5) {
|
|
257
|
+
this.modifiedFields = e5;
|
|
258
258
|
}
|
|
259
|
-
replaceEscapedCharacters(
|
|
260
|
-
return
|
|
259
|
+
replaceEscapedCharacters(e5) {
|
|
260
|
+
return e5.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);
|
|
261
261
|
}
|
|
262
|
-
restoreEscapedCharacters(
|
|
263
|
-
return
|
|
262
|
+
restoreEscapedCharacters(e5) {
|
|
263
|
+
return e5.replace(this.ESCAPED_DOT_PLACEHOLDER, `\\.`).replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER, `\\]`).replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER, `\\[`);
|
|
264
264
|
}
|
|
265
265
|
unflatten() {
|
|
266
|
-
return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([
|
|
266
|
+
return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([e5, t2]) => [this.replaceEscapedCharacters(this.bracketToDotNotation(e5)), t2])), De(this.cleanedModifiedFields);
|
|
267
267
|
}
|
|
268
|
-
flatten(
|
|
268
|
+
flatten(e5) {
|
|
269
269
|
let t2 = {};
|
|
270
270
|
for (let n2 of Object.keys(this.cleanedModifiedFields)) {
|
|
271
|
-
let r2 = this.splitPath(n2), i2 = this.navigatePath(
|
|
271
|
+
let r2 = this.splitPath(n2), i2 = this.navigatePath(e5, r2);
|
|
272
272
|
t2 = { ...t2, ...i2 };
|
|
273
273
|
}
|
|
274
|
-
return Object.fromEntries(Object.entries(t2).map(([
|
|
274
|
+
return Object.fromEntries(Object.entries(t2).map(([e6, t3]) => [this.restoreEscapedCharacters(e6), t3]));
|
|
275
275
|
}
|
|
276
|
-
splitPath(
|
|
277
|
-
let t2 = [], n2 = 0, r2 = Array.from(
|
|
278
|
-
for (let i2 of r2) i2.index > n2 && t2.push(
|
|
279
|
-
return n2 <
|
|
276
|
+
splitPath(e5) {
|
|
277
|
+
let t2 = [], n2 = 0, r2 = Array.from(e5.matchAll(this.SPLIT_PATTERN));
|
|
278
|
+
for (let i2 of r2) i2.index > n2 && t2.push(e5.substring(n2, i2.index)), i2[1] && t2.push(i2[1]), n2 = i2.index + i2[0].length;
|
|
279
|
+
return n2 < e5.length && t2.push(e5.substring(n2)), t2;
|
|
280
280
|
}
|
|
281
|
-
navigatePath(
|
|
282
|
-
let n2 =
|
|
281
|
+
navigatePath(e5, t2) {
|
|
282
|
+
let n2 = e5, r2 = [], i2 = (e6) => {
|
|
283
283
|
if (!Array.isArray(n2)) throw Error(`Expected array at path ${this.buildPathString(r2)}, but got ${typeof n2}`);
|
|
284
|
-
r2.push(`[${
|
|
285
|
-
}, a2 = (
|
|
286
|
-
let i3 =
|
|
284
|
+
r2.push(`[${e6}]`), n2 = n2[parseInt(e6, 10)];
|
|
285
|
+
}, a2 = (e6, t3) => {
|
|
286
|
+
let i3 = e6 in ie ? ie[e6] : void 0;
|
|
287
287
|
if (i3 && i3 in t3) {
|
|
288
288
|
r2.push(i3), n2 = t3[i3];
|
|
289
289
|
return;
|
|
290
290
|
}
|
|
291
|
-
let a3 = Ne(
|
|
291
|
+
let a3 = Ne(e6);
|
|
292
292
|
if (a3 && a3 in t3) {
|
|
293
293
|
r2.push(a3), n2 = t3[a3];
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
|
-
throw Error(`Cannot find key '${
|
|
297
|
-
}, o2 = (
|
|
298
|
-
r2.push(
|
|
296
|
+
throw Error(`Cannot find key '${e6}' or its transformations at path ${this.buildPathString(r2)}`);
|
|
297
|
+
}, o2 = (e6, t3) => {
|
|
298
|
+
r2.push(e6), n2 = t3[e6];
|
|
299
299
|
};
|
|
300
|
-
for (let
|
|
301
|
-
if (this.NUMERIC_PATTERN.test(
|
|
302
|
-
i2(
|
|
300
|
+
for (let e6 of t2) {
|
|
301
|
+
if (this.NUMERIC_PATTERN.test(e6)) {
|
|
302
|
+
i2(e6);
|
|
303
303
|
continue;
|
|
304
304
|
}
|
|
305
|
-
if (typeof n2 != `object` || !n2) throw Error(`Cannot access property '${
|
|
305
|
+
if (typeof n2 != `object` || !n2) throw Error(`Cannot access property '${e6}' on ${typeof n2} at path ${this.buildPathString(r2)}`);
|
|
306
306
|
let t3 = n2;
|
|
307
|
-
if (
|
|
308
|
-
o2(
|
|
307
|
+
if (e6 in n2) {
|
|
308
|
+
o2(e6, t3);
|
|
309
309
|
continue;
|
|
310
310
|
}
|
|
311
|
-
a2(
|
|
311
|
+
a2(e6, t3);
|
|
312
312
|
}
|
|
313
313
|
return { [this.buildPathString(r2)]: n2 };
|
|
314
314
|
}
|
|
315
|
-
buildPathString(
|
|
316
|
-
return
|
|
315
|
+
buildPathString(e5) {
|
|
316
|
+
return e5.join(`.`).replace(this.DOT_BEFORE_BRACKET_PATTERN, `[`);
|
|
317
317
|
}
|
|
318
|
-
bracketToDotNotation(
|
|
319
|
-
return
|
|
318
|
+
bracketToDotNotation(e5) {
|
|
319
|
+
return e5.replace(this.BRACKET_PATTERN, (t2, n2, r2) => r2 > 0 && e5[r2 - 1] === `\\` ? t2 : `.` + n2);
|
|
320
320
|
}
|
|
321
321
|
};
|
|
322
|
-
function Ae(
|
|
323
|
-
let n2 =
|
|
322
|
+
function Ae(e5, t2) {
|
|
323
|
+
let n2 = e5?.modifiedFields;
|
|
324
324
|
if (!n2) return null;
|
|
325
325
|
let r2 = je(n2);
|
|
326
326
|
if (!r2) return null;
|
|
327
327
|
let { unflattenedModifiedFields: i2, modifiedFieldsManipulator: a2 } = r2;
|
|
328
|
-
|
|
329
|
-
let o2 = t2(
|
|
328
|
+
e5 = { ...e5, modifiedFields: i2 };
|
|
329
|
+
let o2 = t2(e5), s2 = o2?.modifiedFields;
|
|
330
330
|
if (!s2) return null;
|
|
331
331
|
let c2 = Me(s2, a2);
|
|
332
332
|
return c2 === null ? null : (o2.modifiedFields = c2, o2);
|
|
333
333
|
}
|
|
334
|
-
function je(
|
|
335
|
-
if (typeof
|
|
336
|
-
let t2 = new ke(
|
|
334
|
+
function je(e5) {
|
|
335
|
+
if (typeof e5 == `object` && e5 && !Array.isArray(e5)) try {
|
|
336
|
+
let t2 = new ke(e5);
|
|
337
337
|
return { unflattenedModifiedFields: t2.unflatten(), modifiedFieldsManipulator: t2 };
|
|
338
338
|
} catch {
|
|
339
339
|
return null;
|
|
340
340
|
}
|
|
341
341
|
return null;
|
|
342
342
|
}
|
|
343
|
-
function Me(
|
|
344
|
-
if (typeof
|
|
345
|
-
return t2.flatten(
|
|
343
|
+
function Me(e5, t2) {
|
|
344
|
+
if (typeof e5 == `object` && e5 && !Array.isArray(e5)) try {
|
|
345
|
+
return t2.flatten(e5);
|
|
346
346
|
} catch {
|
|
347
347
|
return null;
|
|
348
348
|
}
|
|
349
349
|
return null;
|
|
350
350
|
}
|
|
351
|
-
function Ne(
|
|
352
|
-
return
|
|
351
|
+
function Ne(e5) {
|
|
352
|
+
return e5.replace(/[-_\s]+(.)?/g, (e6, t2) => t2 ? t2.toUpperCase() : ``).replace(/^./, (e6) => e6.toLowerCase());
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
return { emit(
|
|
356
|
-
for (let n2 = 0, r2 = this.events[
|
|
357
|
-
}, events: {}, on(
|
|
358
|
-
return (this.events[
|
|
359
|
-
this.events[
|
|
354
|
+
function Pe() {
|
|
355
|
+
return { emit(e5, ...t2) {
|
|
356
|
+
for (let n2 = 0, r2 = this.events[e5] || [], i2 = r2.length; n2 < i2; n2++) r2[n2](...t2);
|
|
357
|
+
}, events: {}, on(e5, t2) {
|
|
358
|
+
return (this.events[e5] ||= []).push(t2), () => {
|
|
359
|
+
this.events[e5] = this.events[e5]?.filter((e6) => t2 !== e6);
|
|
360
360
|
};
|
|
361
361
|
} };
|
|
362
362
|
}
|
|
363
|
-
var
|
|
364
|
-
function
|
|
363
|
+
var Fe = (e5) => e5.__type === `event-definition`;
|
|
364
|
+
function Ie(e5, t2, n2, r2) {
|
|
365
365
|
let i2;
|
|
366
|
-
if (
|
|
367
|
-
let { deletedEvent:
|
|
368
|
-
i2 =
|
|
366
|
+
if (e5.isDomainEvent) {
|
|
367
|
+
let { deletedEvent: e6, actionEvent: t3, createdEvent: a3, updatedEvent: o3, ...s3 } = n2, c2 = { ...r2, ...s3 };
|
|
368
|
+
i2 = e6 ? e6?.deletedEntity ? { entity: e6?.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 };
|
|
369
369
|
} else i2 = { data: n2, metadata: r2 };
|
|
370
|
-
let a2 =
|
|
370
|
+
let a2 = e5.transformations ?? ((e6) => e6), o2 = i2, s2 = i2;
|
|
371
371
|
if (s2.modifiedFields) {
|
|
372
|
-
let
|
|
373
|
-
if (typeof
|
|
372
|
+
let e6 = s2.modifiedFields;
|
|
373
|
+
if (typeof e6 == `object` && e6 && !Array.isArray(e6)) {
|
|
374
374
|
o2 = structuredClone(i2);
|
|
375
|
-
let
|
|
376
|
-
if (
|
|
375
|
+
let e7 = Ae(s2, a2);
|
|
376
|
+
if (e7) return t2(e7);
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
return t2(a2(o2));
|
|
380
380
|
}
|
|
381
|
-
function
|
|
382
|
-
let t2 = /* @__PURE__ */ new Map(), n2 =
|
|
383
|
-
return { initModule(
|
|
381
|
+
function Le(e5) {
|
|
382
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = Pe();
|
|
383
|
+
return { initModule(e6) {
|
|
384
384
|
return (r2) => {
|
|
385
|
-
let i2 = t2.get(
|
|
386
|
-
i2.push({ eventDefinition:
|
|
385
|
+
let i2 = t2.get(e6.type) ?? [];
|
|
386
|
+
i2.push({ eventDefinition: e6, handler: r2 }), t2.set(e6.type, i2), n2.emit(`registered`, e6);
|
|
387
387
|
};
|
|
388
|
-
}, client: { ...n2, getRegisteredEvents: () => t2, async process(
|
|
389
|
-
let { eventType: r2, identity: i2, instanceId: a2, payload: o2, accountInfo: s2 } = await this.parseJWT(
|
|
390
|
-
if (c2.length > 0 && !c2.some(({ type:
|
|
388
|
+
}, client: { ...n2, getRegisteredEvents: () => t2, async process(e6, n3 = { expectedEvents: [] }) {
|
|
389
|
+
let { eventType: r2, identity: i2, instanceId: a2, payload: o2, accountInfo: s2 } = await this.parseJWT(e6), c2 = [...n3.expectedEvents, ...Array.from(t2.keys()).map((e7) => ({ type: e7 }))];
|
|
390
|
+
if (c2.length > 0 && !c2.some(({ type: e7 }) => e7 === r2)) throw Error(`Unexpected event type: ${r2}. Expected one of: ${c2.map((e7) => e7.type).join(`, `)}`);
|
|
391
391
|
let l2 = t2.get(r2) ?? [];
|
|
392
|
-
return await Promise.all(l2.map(({ eventDefinition:
|
|
393
|
-
}, async processRequest(
|
|
394
|
-
let n3 = await
|
|
392
|
+
return await Promise.all(l2.map(({ eventDefinition: e7, handler: t3 }) => Ie(e7, t3, o2, { instanceId: a2, identity: i2, accountInfo: s2 }))), { instanceId: a2, eventType: r2, payload: o2, identity: i2, accountInfo: s2 };
|
|
393
|
+
}, async processRequest(e6, t3) {
|
|
394
|
+
let n3 = await e6.text();
|
|
395
395
|
return this.process(n3, t3);
|
|
396
396
|
}, async parseJWT(t3) {
|
|
397
|
-
let n3 =
|
|
397
|
+
let n3 = e5();
|
|
398
398
|
if (!n3.decodeJWT) throw Error(`decodeJWT is not supported by the authentication strategy`);
|
|
399
399
|
let { decoded: r2, valid: i2 } = await n3.decodeJWT(t3);
|
|
400
400
|
if (!i2) throw Error(`JWT is not valid`);
|
|
401
401
|
if (typeof r2.data != `string`) throw Error(`Unexpected type of JWT data: expected string, got ${typeof r2.data}`);
|
|
402
402
|
let a2 = JSON.parse(r2.data), o2 = a2.eventType, s2 = a2.accountInfo, c2 = a2.instanceId, l2 = a2.identity ? JSON.parse(a2.identity) : void 0;
|
|
403
403
|
return { instanceId: c2, eventType: o2, payload: JSON.parse(a2.data), identity: l2, accountInfo: s2 };
|
|
404
|
-
}, async parseRequest(
|
|
405
|
-
let t3 = await
|
|
404
|
+
}, async parseRequest(e6) {
|
|
405
|
+
let t3 = await e6.text();
|
|
406
406
|
return this.parseJWT(t3);
|
|
407
|
-
}, async executeHandlers(
|
|
408
|
-
let n3 = Array.from(t2.keys()).map((
|
|
409
|
-
if (n3.length > 0 && !n3.some(({ type: t3 }) => t3 ===
|
|
410
|
-
let r2 = t2.get(
|
|
411
|
-
await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) =>
|
|
407
|
+
}, async executeHandlers(e6) {
|
|
408
|
+
let n3 = Array.from(t2.keys()).map((e7) => ({ type: e7 }));
|
|
409
|
+
if (n3.length > 0 && !n3.some(({ type: t3 }) => t3 === e6.eventType)) throw Error(`Unexpected event type: ${e6.eventType}. Expected one of: ${n3.map((e7) => e7.type).join(`, `)}`);
|
|
410
|
+
let r2 = t2.get(e6.eventType) ?? [];
|
|
411
|
+
await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) => Ie(t3, n4, e6.payload, { instanceId: e6.instanceId, identity: e6.identity })));
|
|
412
412
|
}, apps: { AppInstalled: m(`AppInstalled`)(), AppRemoved: m(`AppRemoved`)() } } };
|
|
413
413
|
}
|
|
414
|
-
var
|
|
415
|
-
function
|
|
416
|
-
let t2 = /* @__PURE__ */ new Map(), n2 =
|
|
417
|
-
return { initModule(
|
|
414
|
+
var Re = (e5) => e5.__type === `service-plugin-definition`;
|
|
415
|
+
function ze(e5) {
|
|
416
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = Pe();
|
|
417
|
+
return { initModule(e6) {
|
|
418
418
|
return (r2) => {
|
|
419
|
-
let i2 = t2.get(
|
|
420
|
-
i2.push({ servicePluginDefinition:
|
|
419
|
+
let i2 = t2.get(e6.componentType.toLowerCase()) ?? [];
|
|
420
|
+
i2.push({ servicePluginDefinition: e6, implementation: r2 }), t2.set(e6.componentType.toLowerCase(), i2), n2.emit(`registered`, e6);
|
|
421
421
|
};
|
|
422
422
|
}, client: { ...n2, getRegisteredServicePlugins: () => t2, async parseJWT(t3) {
|
|
423
|
-
let n3 =
|
|
423
|
+
let n3 = e5();
|
|
424
424
|
if (!n3.decodeJWT) throw Error(`decodeJWT is not supported by the authentication strategy`);
|
|
425
425
|
let { decoded: r2, valid: i2 } = await n3.decodeJWT(t3, true);
|
|
426
426
|
if (!i2) throw Error(`JWT is not valid`);
|
|
427
427
|
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`);
|
|
428
428
|
return r2.data;
|
|
429
|
-
}, async process(
|
|
430
|
-
let t3 = await this.parseJWT(
|
|
431
|
-
return this.executeHandler(t3,
|
|
432
|
-
}, async parseRequest(
|
|
433
|
-
let t3 = await
|
|
429
|
+
}, async process(e6) {
|
|
430
|
+
let t3 = await this.parseJWT(e6.body);
|
|
431
|
+
return this.executeHandler(t3, e6.url);
|
|
432
|
+
}, async parseRequest(e6) {
|
|
433
|
+
let t3 = await e6.text();
|
|
434
434
|
return this.parseJWT(t3);
|
|
435
|
-
}, async processRequest(
|
|
436
|
-
let t3 = await this.parseRequest(
|
|
437
|
-
return this.processParsedRequest(t3,
|
|
438
|
-
}, async processParsedRequest(
|
|
435
|
+
}, async processRequest(e6) {
|
|
436
|
+
let t3 = await this.parseRequest(e6);
|
|
437
|
+
return this.processParsedRequest(t3, e6.url);
|
|
438
|
+
}, async processParsedRequest(e6, t3) {
|
|
439
439
|
try {
|
|
440
|
-
let n3 = await this.executeHandler(
|
|
440
|
+
let n3 = await this.executeHandler(e6, t3);
|
|
441
441
|
return Response.json(n3);
|
|
442
|
-
} catch (
|
|
443
|
-
if (
|
|
444
|
-
throw
|
|
442
|
+
} catch (e7) {
|
|
443
|
+
if (e7.errorType === `SPI` && e7.applicationCode && e7.httpCode) return Response.json({ applicationError: { code: e7.applicationCode, data: e7.data } }, { status: e7.httpCode });
|
|
444
|
+
throw e7;
|
|
445
445
|
}
|
|
446
|
-
}, async executeHandler(
|
|
447
|
-
let r2 =
|
|
446
|
+
}, async executeHandler(e6, n3) {
|
|
447
|
+
let r2 = e6.metadata.appExtensionType.toLowerCase(), i2 = t2.get(r2) ?? [];
|
|
448
448
|
if (i2.length === 0) throw Error(`No service plugin implementations found for component type ${r2}`);
|
|
449
449
|
if (i2.length > 1) throw Error(`Multiple service plugin implementations found for component type ${r2}. This is currently not supported`);
|
|
450
|
-
let { implementation: a2, servicePluginDefinition: o2 } = i2[0], s2 = o2.methods.find((
|
|
450
|
+
let { implementation: a2, servicePluginDefinition: o2 } = i2[0], s2 = o2.methods.find((e7) => n3.endsWith(e7.primaryHttpMappingPath));
|
|
451
451
|
if (!s2) throw Error(`Unexpect request: request url did not match any method: ` + n3);
|
|
452
452
|
let c2 = a2[s2.name];
|
|
453
453
|
if (!c2) throw Error(`Got request for service plugin method ${s2.name} but no implementation was provided. Available methods: ${Object.keys(a2).join(`, `)}`);
|
|
454
|
-
return s2.transformations.toREST(await c2(s2.transformations.fromREST(
|
|
454
|
+
return s2.transformations.toREST(await c2(s2.transformations.fromREST(e6)));
|
|
455
455
|
} } };
|
|
456
456
|
}
|
|
457
|
-
var
|
|
458
|
-
function
|
|
459
|
-
let t2 =
|
|
460
|
-
let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...
|
|
457
|
+
var O = `X-Wix-Consistent`;
|
|
458
|
+
function Be(e5) {
|
|
459
|
+
let t2 = e5.headers || { Authorization: `` }, n2 = { getAuthHeaders: (e6) => Promise.resolve({ headers: {} }) }, r2 = e5.auth, i2 = typeof r2 == `function` ? r2 : () => r2 ?? n2, a2 = () => i2().getAuthHeaders(e5.host), o2 = () => e5.fetch ?? fetch, s2 = async (n3, r3) => {
|
|
460
|
+
let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e5.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [O]: t2[O] } : {} }, l3 = e5.host?.getErrorHandler?.();
|
|
461
461
|
try {
|
|
462
462
|
if (typeof n3 == `string` || n3 instanceof URL) {
|
|
463
|
-
let
|
|
464
|
-
l3?.handleError(
|
|
465
|
-
let a3 =
|
|
466
|
-
return a3 && (t2[
|
|
463
|
+
let e6 = await i3(n3, { ...r3, headers: c3 });
|
|
464
|
+
l3?.handleError(e6, { requestOptions: { url: n3.toString(), method: r3?.method } });
|
|
465
|
+
let a3 = k(e6);
|
|
466
|
+
return a3 && (t2[O] = a3), e6;
|
|
467
467
|
}
|
|
468
468
|
{
|
|
469
|
-
for (let [
|
|
470
|
-
let
|
|
471
|
-
l3?.handleError(
|
|
472
|
-
let a3 =
|
|
473
|
-
return a3 && (t2[
|
|
469
|
+
for (let [e7, t3] of Object.entries(c3)) typeof t3 == `string` && n3.headers.set(e7, t3);
|
|
470
|
+
let e6 = await i3(n3, r3);
|
|
471
|
+
l3?.handleError(e6, { requestOptions: { url: n3.url, method: r3?.method } });
|
|
472
|
+
let a3 = k(e6);
|
|
473
|
+
return a3 && (t2[O] = a3), e6;
|
|
474
474
|
}
|
|
475
|
-
} catch (
|
|
476
|
-
throw l3?.handleError(
|
|
475
|
+
} catch (e6) {
|
|
476
|
+
throw l3?.handleError(e6, { requestOptions: { url: typeof n3 == `string` || n3 instanceof URL ? n3.toString() : n3.url, method: r3?.method } }), e6;
|
|
477
477
|
}
|
|
478
|
-
}, { client: c2, initModule: l2 } =
|
|
479
|
-
let i3 = o2(), s3 = await a2(), c3 = S(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...
|
|
480
|
-
return u3 && (t2[
|
|
478
|
+
}, { client: c2, initModule: l2 } = ze(i2), { client: u2, initModule: d2 } = Le(i2), f2 = async (n3, r3) => {
|
|
479
|
+
let i3 = o2(), s3 = await a2(), c3 = S(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e5.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [O]: t2[O] } : {} } }), u3 = k(l3);
|
|
480
|
+
return u3 && (t2[O] = u3), l3;
|
|
481
481
|
}, m2 = (t3, n3) => {
|
|
482
|
-
if (
|
|
483
|
-
if (
|
|
484
|
-
if (
|
|
482
|
+
if (Fe(t3)) return d2(t3);
|
|
483
|
+
if (Re(t3)) return l2(t3);
|
|
484
|
+
if (C(t3) && e5.host) return w(t3, e5.host);
|
|
485
485
|
if (typeof t3 == `function`) {
|
|
486
486
|
if (`__type` in t3 && t3.__type === `wix_spi_error`) return t3;
|
|
487
|
-
let r3 =
|
|
488
|
-
return
|
|
489
|
-
let n4 = new URL(
|
|
487
|
+
let r3 = e5.host?.apiBaseUrl ?? `www.wixapis.com`, o3 = e5.useCDN === void 0 ? i2().shouldUseCDN : e5.useCDN;
|
|
488
|
+
return be(re(() => _(t3)) ? g(t3) : t3, n3 ?? {}, f2, e5.host?.getErrorHandler?.(), (e6, t4) => {
|
|
489
|
+
let n4 = new URL(e6, `https://${r3}`);
|
|
490
490
|
return n4.host = r3, n4.protocol = `https`, f2(n4.toString(), t4);
|
|
491
|
-
}, i2().getActiveToken, async () => a2(), { HTTPHost: r3 },
|
|
491
|
+
}, i2().getActiveToken, async () => a2(), { HTTPHost: r3 }, e5.host?.name, o3, e5.validateRequestSchema);
|
|
492
492
|
}
|
|
493
|
-
return
|
|
494
|
-
}, h2 = (
|
|
495
|
-
for (let n3 in
|
|
493
|
+
return ee(t3) ? Object.fromEntries(Object.entries(t3).map(([e6, n4]) => [e6, m2(n4, t3[v])])) : t3;
|
|
494
|
+
}, h2 = (e6) => {
|
|
495
|
+
for (let n3 in e6) t2[n3] = e6[n3];
|
|
496
496
|
};
|
|
497
|
-
return { ...
|
|
497
|
+
return { ...e5.modules ? m2(e5.modules) : {}, get auth() {
|
|
498
498
|
let t3 = i2();
|
|
499
|
-
return t3.getAuthHeaders = t3.getAuthHeaders.bind(void 0,
|
|
500
|
-
}, setHeaders: h2, use: m2, enableContext(
|
|
501
|
-
|
|
499
|
+
return t3.getAuthHeaders = t3.getAuthHeaders.bind(void 0, e5.host), t3;
|
|
500
|
+
}, setHeaders: h2, use: m2, enableContext(e6, t3 = { elevated: false }) {
|
|
501
|
+
e6 === `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 ? p.elevatedClient = this : p.client = this;
|
|
502
502
|
}, fetch: (t3, n3) => {
|
|
503
|
-
let r3 =
|
|
503
|
+
let r3 = e5.host?.apiBaseUrl ?? `www.wixapis.com`, i3 = new URL(t3, `https://${r3}`);
|
|
504
504
|
return i3.host = r3, i3.protocol = `https`, f2(i3.toString(), n3);
|
|
505
505
|
}, fetchWithAuth: s2, async graphql(t3, n3, r3 = { apiVersion: `alpha` }) {
|
|
506
|
-
let i3 =
|
|
506
|
+
let i3 = e5?.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 }) });
|
|
507
507
|
if (a3.status !== 200) throw new b(`GraphQL request failed with status ${a3.status}`, a3);
|
|
508
508
|
let { data: o3, errors: s3 } = await a3.json();
|
|
509
509
|
return { data: o3 ?? {}, errors: s3 };
|
|
510
510
|
}, webhooks: u2, servicePlugins: c2 };
|
|
511
511
|
}
|
|
512
|
-
function
|
|
513
|
-
return
|
|
512
|
+
function k(e5) {
|
|
513
|
+
return e5.headers?.get(`X-Wix-Consistent`) ?? e5.headers?.get(`x-wix-consistent`);
|
|
514
514
|
}
|
|
515
|
-
var
|
|
516
|
-
var
|
|
517
|
-
function
|
|
518
|
-
return
|
|
515
|
+
var Ve = { _id: `id`, _createdDate: `createdDate`, _updatedDate: `updatedDate` };
|
|
516
|
+
var He = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
517
|
+
function Ue(e5, t2) {
|
|
518
|
+
return e5?.split(`.`).map((e6) => t2?.[e6] ?? e6).join(`.`);
|
|
519
519
|
}
|
|
520
|
-
var
|
|
521
|
-
function
|
|
522
|
-
return (
|
|
520
|
+
var We = `sort.fieldName`;
|
|
521
|
+
function Ge(e5, t2, n2) {
|
|
522
|
+
return (e5 === We || e5.endsWith(`.${We}`)) && typeof t2 == `string` ? Ue(t2, n2) : t2;
|
|
523
523
|
}
|
|
524
|
-
function
|
|
525
|
-
let r2 = (
|
|
526
|
-
if (Array.isArray(
|
|
527
|
-
i2(
|
|
524
|
+
function Ke(e5, t2, n2) {
|
|
525
|
+
let r2 = (e6) => n2.includes(e6), i2 = (e6, n3) => {
|
|
526
|
+
if (Array.isArray(e6)) e6.forEach((e7) => {
|
|
527
|
+
i2(e7, n3);
|
|
528
528
|
});
|
|
529
|
-
else if (typeof
|
|
530
|
-
let a2 =
|
|
531
|
-
Object.keys(a2).forEach((
|
|
532
|
-
let o2 = n3 === `` ?
|
|
529
|
+
else if (typeof e6 == `object` && e6) {
|
|
530
|
+
let a2 = e6;
|
|
531
|
+
Object.keys(a2).forEach((e7) => {
|
|
532
|
+
let o2 = n3 === `` ? e7 : `${n3}.${e7}`;
|
|
533
533
|
if (r2(o2)) return;
|
|
534
|
-
let s2 =
|
|
535
|
-
s2 !==
|
|
534
|
+
let s2 = qe(e7, t2);
|
|
535
|
+
s2 !== e7 && !(s2 in a2) && (a2[s2] = a2[e7], delete a2[e7]), a2[s2] = Ge(o2, a2[s2], t2), i2(a2[s2], o2);
|
|
536
536
|
});
|
|
537
537
|
}
|
|
538
538
|
};
|
|
539
|
-
return i2(
|
|
539
|
+
return i2(e5, ``), e5;
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function qe(e5, t2) {
|
|
542
542
|
let n2;
|
|
543
|
-
return n2 =
|
|
543
|
+
return n2 = e5.includes(`.`) ? e5.split(`.`).map((e6) => t2[e6] ?? e6).join(`.`) : t2[e5] ?? e5, n2;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
546
|
-
return
|
|
545
|
+
function Je(e5, t2 = []) {
|
|
546
|
+
return Ke(e5, Ve, t2);
|
|
547
547
|
}
|
|
548
|
-
function
|
|
549
|
-
return
|
|
548
|
+
function Ye(e5, t2 = []) {
|
|
549
|
+
return Ke(e5, He, t2);
|
|
550
550
|
}
|
|
551
|
-
function
|
|
552
|
-
return
|
|
551
|
+
function Xe(e5) {
|
|
552
|
+
return tt(e5).map((e6) => e6.toLocaleUpperCase()).join(`_`);
|
|
553
553
|
}
|
|
554
|
-
var
|
|
555
|
-
var
|
|
556
|
-
var
|
|
557
|
-
var
|
|
558
|
-
function
|
|
559
|
-
let t2 =
|
|
560
|
-
t2 = t2.replace(
|
|
554
|
+
var Ze = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
555
|
+
var Qe = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
556
|
+
var $e = `$1\0$2`;
|
|
557
|
+
var et = /[^\p{L}\d]+/giu;
|
|
558
|
+
function tt(e5) {
|
|
559
|
+
let t2 = e5.trim();
|
|
560
|
+
t2 = t2.replace(Ze, $e).replace(Qe, $e), t2 = t2.replace(et, `\0`);
|
|
561
561
|
let n2 = 0, r2 = t2.length;
|
|
562
562
|
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
563
563
|
if (n2 === r2) return [];
|
|
564
564
|
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
565
565
|
return t2.slice(n2, r2).split(/\0/g);
|
|
566
566
|
}
|
|
567
|
-
var
|
|
568
|
-
var
|
|
569
|
-
var
|
|
570
|
-
function
|
|
571
|
-
if (typeof
|
|
572
|
-
if (
|
|
573
|
-
if (
|
|
574
|
-
if (
|
|
575
|
-
let t3 =
|
|
576
|
-
return
|
|
577
|
-
}
|
|
578
|
-
return
|
|
579
|
-
}
|
|
580
|
-
var
|
|
581
|
-
let r2 =
|
|
582
|
-
return
|
|
567
|
+
var nt = (e5) => `validationError` in (e5.response?.data?.details ?? {});
|
|
568
|
+
var rt = (e5) => `applicationError` in (e5.response?.data?.details ?? {});
|
|
569
|
+
var it = (e5) => (e5.response?.status ?? -1) >= 400 && (e5.response?.status ?? -1) < 500;
|
|
570
|
+
function at(e5, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
571
|
+
if (typeof e5 != `object` || !e5) throw e5;
|
|
572
|
+
if (nt(e5)) return ot(e5, t2, n2);
|
|
573
|
+
if (rt(e5)) return st(e5);
|
|
574
|
+
if (it(e5)) {
|
|
575
|
+
let t3 = e5.response?.status, n3 = e5.response?.statusText ?? `UNKNOWN`, r2 = e5.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: Xe(n3), data: {} }, requestId: e5.requestId };
|
|
576
|
+
return A(e5, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
577
|
+
}
|
|
578
|
+
return ct(e5);
|
|
579
|
+
}
|
|
580
|
+
var ot = (e5, t2, n2) => {
|
|
581
|
+
let r2 = e5.response?.data, i2 = e5.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = lt(t2, a2, n2)?.sort((e6, t3) => e6.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e6, description: t3 }) => `"${e6}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
|
|
582
|
+
return A(e5, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e5.response?.status, requestId: i2 } });
|
|
583
583
|
};
|
|
584
|
-
var
|
|
585
|
-
var
|
|
586
|
-
let t2 =
|
|
587
|
-
return
|
|
584
|
+
var A = (e5, { message: t2, extraProperties: n2 }) => Object.assign(e5, { ...n2, message: t2 });
|
|
585
|
+
var st = (e5) => {
|
|
586
|
+
let t2 = e5.response?.status, n2 = e5.response?.statusText ?? `UNKNOWN`, r2 = e5.response?.data?.message ?? n2, i2 = e5.response?.data?.details?.applicationError?.description ?? n2, a2 = e5.response?.data?.details?.applicationError?.code ?? Xe(n2), o2 = e5.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e5.requestId };
|
|
587
|
+
return A(e5, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e5.requestId } });
|
|
588
588
|
};
|
|
589
|
-
var
|
|
590
|
-
var
|
|
591
|
-
let a2 = { ...
|
|
592
|
-
return r2?.filter((
|
|
593
|
-
let r3 = t2[
|
|
594
|
-
if (r3) return { ...
|
|
595
|
-
let s2 = o2?.sort((
|
|
589
|
+
var ct = (e5) => A(e5, { message: e5.requestId ? `System error occurred, request-id: ${e5.requestId}` : `System error occurred: ${JSON.stringify(e5)}`, extraProperties: { requestId: e5.requestId, status: e5.response?.status, code: Xe(e5.response?.statusText ?? `UNKNOWN`), ...!e5.response && { runtimeError: e5 } } });
|
|
590
|
+
var lt = ({ spreadPathsToArguments: e5, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
591
|
+
let a2 = { ...e5, ...t2 }, o2 = Object.keys(a2);
|
|
592
|
+
return r2?.filter((e6) => !r2.some((t3) => t3.field.length > e6.field.length && t3.field.startsWith(e6.field) && o2.includes(t3.field))).map((e6) => {
|
|
593
|
+
let r3 = t2[e6.field];
|
|
594
|
+
if (r3) return { ...e6, field: ut(r3, i2) };
|
|
595
|
+
let s2 = o2?.sort((e7, t3) => t3.length - e7.length)?.find((t3) => e6.field.startsWith(t3));
|
|
596
596
|
if (s2) {
|
|
597
597
|
let t3 = a2[s2];
|
|
598
|
-
if (t3) return { ...
|
|
598
|
+
if (t3) return { ...e6, field: e6.field.replace(s2, ut(t3, i2)) };
|
|
599
599
|
}
|
|
600
|
-
return n2 ? { ...
|
|
600
|
+
return n2 ? { ...e6, field: `${i2[0]}.${e6.field}` } : e6;
|
|
601
601
|
});
|
|
602
602
|
};
|
|
603
|
-
var
|
|
604
|
-
let n2 =
|
|
605
|
-
return n2 == null ?
|
|
603
|
+
var ut = (e5, t2) => {
|
|
604
|
+
let n2 = dt(e5);
|
|
605
|
+
return n2 == null ? e5 : e5.replace(`$[${n2}]`, t2[n2]);
|
|
606
606
|
};
|
|
607
|
-
var
|
|
608
|
-
let t2 =
|
|
607
|
+
var dt = (e5) => {
|
|
608
|
+
let t2 = e5.match(/\$\[(?<argIndex>\d+)\]/);
|
|
609
609
|
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
610
610
|
};
|
|
611
|
-
function
|
|
612
|
-
let
|
|
613
|
-
if (
|
|
614
|
-
return
|
|
611
|
+
function ft() {
|
|
612
|
+
let e5 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
613
|
+
if (e5) return { initWixModules(t3, n3) {
|
|
614
|
+
return j(() => e5(t3, n3));
|
|
615
615
|
}, fetchWithAuth() {
|
|
616
616
|
throw Error(`fetchWithAuth is not available in this context`);
|
|
617
617
|
}, graphql() {
|
|
618
618
|
throw Error(`graphql is not available in this context`);
|
|
619
619
|
} };
|
|
620
620
|
let t2 = typeof $wixContext < `u` ? $wixContext.client : p.client === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.client : p.client, n2 = typeof $wixContext < `u` ? $wixContext.elevatedClient : p.elevatedClient === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.elevatedClient : p.elevatedClient;
|
|
621
|
-
if (t2 || n2) return { initWixModules(
|
|
621
|
+
if (t2 || n2) return { initWixModules(e6, r2) {
|
|
622
622
|
if (r2) {
|
|
623
623
|
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`);
|
|
624
|
-
return
|
|
624
|
+
return j(() => n2.use(e6));
|
|
625
625
|
}
|
|
626
626
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
627
|
-
return
|
|
628
|
-
}, fetchWithAuth: (
|
|
627
|
+
return j(() => t2.use(e6));
|
|
628
|
+
}, fetchWithAuth: (e6, n3) => {
|
|
629
629
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
630
|
-
return t2.fetchWithAuth(
|
|
630
|
+
return t2.fetchWithAuth(e6, n3);
|
|
631
631
|
}, getAuth() {
|
|
632
632
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
633
633
|
return t2.auth;
|
|
634
|
-
}, async graphql(
|
|
634
|
+
}, async graphql(e6, n3, r2) {
|
|
635
635
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
636
|
-
return t2.graphql(
|
|
636
|
+
return t2.graphql(e6, n3, r2);
|
|
637
637
|
} };
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function j(e5) {
|
|
640
640
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
641
641
|
globalThis.__wix_context__ = void 0, p.client = void 0, p.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
642
642
|
try {
|
|
643
|
-
return
|
|
643
|
+
return e5();
|
|
644
644
|
} finally {
|
|
645
645
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
|
-
function
|
|
648
|
+
function pt(e5, t2) {
|
|
649
649
|
return (...n2) => {
|
|
650
|
-
let r2 =
|
|
651
|
-
return r2 ? r2.initWixModules(
|
|
650
|
+
let r2 = ft();
|
|
651
|
+
return r2 ? r2.initWixModules(e5, t2).apply(void 0, n2) : e5.apply(void 0, n2);
|
|
652
652
|
};
|
|
653
653
|
}
|
|
654
|
-
function
|
|
655
|
-
return
|
|
656
|
-
}
|
|
657
|
-
function
|
|
658
|
-
let t2 =
|
|
659
|
-
return
|
|
660
|
-
}
|
|
661
|
-
var
|
|
662
|
-
var
|
|
663
|
-
var
|
|
664
|
-
var
|
|
665
|
-
var
|
|
666
|
-
var
|
|
667
|
-
var
|
|
668
|
-
var
|
|
669
|
-
var
|
|
670
|
-
var
|
|
671
|
-
function
|
|
672
|
-
return
|
|
673
|
-
}
|
|
674
|
-
function
|
|
675
|
-
return
|
|
676
|
-
}
|
|
677
|
-
function
|
|
678
|
-
let n2 = t2[
|
|
654
|
+
function mt(e5, t2 = false) {
|
|
655
|
+
return pt(e5, t2);
|
|
656
|
+
}
|
|
657
|
+
function ht(e5) {
|
|
658
|
+
let t2 = Ot(Et(e5.host), e5.domainToMappings);
|
|
659
|
+
return Lt(Pt(e5.protoPath, e5.data || {}), t2);
|
|
660
|
+
}
|
|
661
|
+
var gt = [`wix.com`, `editorx.com`];
|
|
662
|
+
var _t = `_`;
|
|
663
|
+
var vt = `*.`;
|
|
664
|
+
var yt = RegExp(`\\.(${gt.join(`|`)})$`);
|
|
665
|
+
var bt = [`42.wixprod.net`, `uw2-edt-1.wixprod.net`, `virginia-edt.wixprod.net`];
|
|
666
|
+
var xt = { "payments.base44.com": `manage.wix.com`, "create.editorx.com": `editor.editorx.com` };
|
|
667
|
+
var St = `dev.wix-code.com`;
|
|
668
|
+
var Ct = /{(.*)}/;
|
|
669
|
+
var wt = RegExp(`\\.(${bt.join(`|`)})$`);
|
|
670
|
+
var Tt = RegExp(`.*\\.${St}$`);
|
|
671
|
+
function Et(e5) {
|
|
672
|
+
return Dt(e5).replace(yt, `._base_domain_`).replace(wt, `._api_base_domain_`).replace(Tt, `*.dev.wix-code.com`);
|
|
673
|
+
}
|
|
674
|
+
function Dt(e5) {
|
|
675
|
+
return xt[e5] ?? e5;
|
|
676
|
+
}
|
|
677
|
+
function Ot(e5, t2) {
|
|
678
|
+
let n2 = t2[e5];
|
|
679
679
|
if (n2) return n2;
|
|
680
|
-
let r2 =
|
|
680
|
+
let r2 = kt(e5, t2) ?? At(e5, t2);
|
|
681
681
|
if (!r2) {
|
|
682
|
-
if (
|
|
683
|
-
let
|
|
684
|
-
if (
|
|
682
|
+
if (Mt(e5)) {
|
|
683
|
+
let e6 = t2[Nt];
|
|
684
|
+
if (e6) return e6;
|
|
685
685
|
}
|
|
686
|
-
let n3 = t2[
|
|
686
|
+
let n3 = t2[_t];
|
|
687
687
|
if (n3) return n3;
|
|
688
688
|
}
|
|
689
689
|
return r2 ?? [];
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function kt(e5, t2) {
|
|
692
692
|
return Object.entries(t2).find(([t3]) => {
|
|
693
|
-
let [, ...n2] =
|
|
693
|
+
let [, ...n2] = e5.split(`.`);
|
|
694
694
|
return n2.join(`.`) === t3;
|
|
695
695
|
})?.[1];
|
|
696
696
|
}
|
|
697
|
-
function
|
|
698
|
-
let [n2] = Object.entries(t2).filter(([t3]) =>
|
|
697
|
+
function At(e5, t2) {
|
|
698
|
+
let [n2] = Object.entries(t2).filter(([t3]) => jt(e5, t3)).sort(([e6], [t3]) => t3.length - e6.length);
|
|
699
699
|
if (!n2) return;
|
|
700
700
|
let [, r2] = n2;
|
|
701
701
|
return r2;
|
|
702
702
|
}
|
|
703
|
-
function
|
|
704
|
-
if (!t2.startsWith(
|
|
703
|
+
function jt(e5, t2) {
|
|
704
|
+
if (!t2.startsWith(vt)) return false;
|
|
705
705
|
let n2 = t2.slice(1);
|
|
706
|
-
return
|
|
706
|
+
return e5.length > n2.length && e5.endsWith(n2);
|
|
707
707
|
}
|
|
708
|
-
function
|
|
709
|
-
return !!
|
|
708
|
+
function Mt(e5) {
|
|
709
|
+
return !!e5.match(/\._base_domain_$/);
|
|
710
710
|
}
|
|
711
|
-
var
|
|
712
|
-
function
|
|
713
|
-
return
|
|
711
|
+
var Nt = `www._base_domain_`;
|
|
712
|
+
function Pt(e5, t2) {
|
|
713
|
+
return e5.split(`/`).map((e6) => Ft(e6, t2)).join(`/`);
|
|
714
714
|
}
|
|
715
|
-
function
|
|
716
|
-
let n2 =
|
|
717
|
-
return r2 ?
|
|
715
|
+
function Ft(e5, t2) {
|
|
716
|
+
let n2 = e5.match(Ct) || [], r2 = n2[1];
|
|
717
|
+
return r2 ? It(t2, r2, e5, e5.replace(n2[0], ``)) : e5;
|
|
718
718
|
}
|
|
719
|
-
function
|
|
720
|
-
let i2 =
|
|
721
|
-
for (let
|
|
719
|
+
function It(e5, t2, n2, r2) {
|
|
720
|
+
let i2 = e5;
|
|
721
|
+
for (let e6 of t2.split(`.`)) {
|
|
722
722
|
if (!i2) return n2;
|
|
723
|
-
i2 = i2[
|
|
723
|
+
i2 = i2[e6];
|
|
724
724
|
}
|
|
725
725
|
return `${i2}${r2}`;
|
|
726
726
|
}
|
|
727
|
-
function
|
|
728
|
-
let n2 = t2?.find((t3) =>
|
|
729
|
-
return n2 ? n2.srcPath +
|
|
727
|
+
function Lt(e5, t2) {
|
|
728
|
+
let n2 = t2?.find((t3) => e5.startsWith(t3.destPath));
|
|
729
|
+
return n2 ? n2.srcPath + e5.slice(n2.destPath.length) : e5;
|
|
730
|
+
}
|
|
731
|
+
var M;
|
|
732
|
+
(function(e5) {
|
|
733
|
+
e5.QUERY_PARAM = `QUERY_PARAM`, e5.SUBDOMAIN = `SUBDOMAIN`, e5.SUBDIRECTORY = `SUBDIRECTORY`;
|
|
734
|
+
})(M ||= {});
|
|
735
|
+
var Rt = { cs: `\u010Ce\u0161tina`, da: `Dansk`, de: `Deutsch`, en: `English`, es: `Espa\xF1ol`, fr: `Fran\xE7ais`, hi: `\u0939\u093F\u0928\u094D\u0926\u0940`, id: `Bahasa Indonesia`, it: `Italiano`, ja: `\u65E5\u672C\u8A9E`, ko: `\uD55C\uAD6D\uC5B4`, nl: `Nederlands`, no: `Norsk`, pl: `Polski`, pt: `Portugu\xEAs`, ru: `\u0420\u0443\u0441\u0441\u043A\u0438\u0439`, sv: `Svenska`, th: `\u0E44\u0E17\u0E22`, tr: `T\xFCrk\xE7e`, uk: `\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430`, vi: `Ti\u1EBFng Vi\u1EC7t`, zh: `\u7E41\u9AD4\u4E2D\u6587`, sq: `Shqip`, am: `\u12A0\u121B\u122D\u129B`, ar: `\u0627\u0644\u0639\u0631\u0628\u064A\u0629`, hy: `\u0540\u0561\u0575\u0565\u0580\u0565\u0576`, az: `Az\u0259rbaycan dili`, eu: `Euskara`, be: `\u0411\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0430\u044F`, bn: `\u09AC\u09BE\u0982\u09B2\u09BE`, bs: `Bosanski`, bg: `\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438`, ca: `Catal\xE0`, ny: `ChiChe\u0175a`, co: `Corsu`, hr: `Hrvatski`, et: `Eesti`, fj: `Vosa Vakaviti`, fi: `Suomi`, ga: `Gaeilge`, gl: `Galego`, ka: `\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8`, el: `\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC`, gu: `\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0`, ht: `Krey\xF2l Ayisyen`, ha: `Hausa`, he: `\u05E2\u05D1\u05E8\u05D9\u05EA`, hu: `Magyar`, is: `\xCDslenska`, ig: `Igbo`, kn: `\u0C95\u0CA8\u0CCD\u0CA8\u0CA1`, kk: `\u049A\u0430\u0437\u0430\u049B \u0442\u0456\u043B\u0456`, km: `\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A`, ku: `Kurd\xEE`, ky: `\u041A\u044B\u0440\u0433\u044B\u0437\u0447\u0430`, lb: `L\xEBtzebuergesch`, lo: `\u0EA5\u0EB2\u0EA7`, la: `Latina`, lv: `Latvie\u0161u`, lt: `Lietuvi\u0173`, mk: `\u041C\u0430\u043A\u0435\u0434\u043E\u043D\u0441\u043A\u0438`, mg: `Malagasy`, ms: `Bahasa Melayu`, ml: `\u0D2E\u0D32\u0D2F\u0D3E\u0D33\u0D02`, mt: `Malti`, mn: `\u041C\u043E\u043D\u0433\u043E\u043B`, ne: `\u0928\u0947\u092A\u093E\u0932\u0940`, ps: `\u067E\u069A\u062A\u0648`, fa: `\u0641\u0627\u0631\u0633\u06CC`, ro: `Rom\xE2n\u0103`, sm: `Gagana Samoa`, sr: `\u0421\u0440\u043F\u0441\u043A\u0438`, sn: `Shona`, sd: `\u0633\u0646\u068C\u064A`, si: `\u0DC3\u0DD2\u0D82\u0DC4\u0DBD`, sk: `Sloven\u010Dina`, sl: `Sloven\u0161\u010Dina`, so: `Soomaaliga`, su: `Basa Sunda`, sw: `Kiswahili`, tl: `Filipino`, tg: `\u0422\u043E\u04B7\u0438\u043A\u04E3`, ta: `\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD`, te: `\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41`, tk: `T\xFCrkmen`, ur: `\u0627\u0631\u062F\u0648`, uz: `O'zbek`, cy: `Cymraeg`, xh: `isiXhosa`, yi: `\u05D9\u05D9\u05B4\u05D3\u05D9\u05E9`, yo: `Yor\xF9b\xE1`, zu: `isiZulu`, kl: `Kalaallisut`, fo: `F\xF8royskt`, ln: `Ling\xE1la`, mi: `M\u0101ori`, mr: `\u092E\u0930\u093E\u0920\u0940`, my: `\u1019\u103C\u1014\u103A\u1019\u102C`, se: `S\xE1megiella`, ug: `\u0626\u06C7\u064A\u063A\u06C7\u0631\u0686\u06D5`, qu: `Runa Simi`, aa: `Afar`, ab: `\u0410\u04A7\u0441\u0443\u0430`, ae: `Avestan`, ak: `Akan`, an: `Aragon\xE9s`, as: `\u0985\u09B8\u09AE\u09C0\u09AF\u09BC\u09BE`, av: `\u0410\u0432\u0430\u0440`, ay: `Aymar aru`, ba: `\u0411\u0430\u0448\u04A1\u043E\u0440\u0442\u0441\u0430`, bh: `\u092D\u094B\u091C\u092A\u0941\u0930\u0940`, bi: `Bislama`, bm: `Bamanankan`, bo: `\u0F56\u0F7C\u0F51\u0F0B\u0F66\u0F90\u0F51\u0F0B`, br: `Brezhoneg`, ce: `\u041D\u043E\u0445\u0447\u0438\u0439\u043D`, ch: `Chamoru`, cr: `\u14C0\u1426\u1403\u152D\u140D\u140F\u1423`, cu: `\u0426\u0440\u044C\u043A\u044A\u0432\u044C\u043D\u043E\u0441\u043B\u043E\u0432\u0463\u043D\u044C\u0441\u043A\u044A`, cv: `\u0427\u04D1\u0432\u0430\u0448\u043B\u0430`, dv: `\u078B\u07A8\u0788\u07AC\u0780\u07A8\u0784\u07A6\u0790\u07B0`, dz: `\u0F62\u0FAB\u0F7C\u0F44\u0F0B\u0F41`, ee: `E\u028Begbe`, eo: `Esperanto`, ff: `Fulah`, fy: `Frysk`, gd: `G\xE0idhlig`, gn: `Ava\xF1e'\u1EBD`, gv: `Gaelg`, ho: `Hiri Motu`, hz: `Otjiherero`, ia: `Interlingua`, ie: `Interlingue`, ii: `\uA188\uA320\uA259`, ik: `I\xF1upiaq`, io: `Ido`, iu: `\u1403\u14C4\u1483\u144E\u1450\u1466`, jv: `Basa Jawa`, ki: `Gikuyu`, kr: `Kanuri`, ks: `\u06A9\u0672\u0634\u064F\u0631`, kw: `Kernewek`, lg: `Luganda`, li: `Limburgs`, lu: `Tshiluba`, mh: `Kajin M\u0327aje\u013C`, na: `Dorerin Naoero`, nb: `Norsk Bokm\xE5l`, nd: `isiNdebele`, ng: `Oshiwambo`, nn: `Norsk Nynorsk`, nr: `isiNdebele (South)`, nv: `Din\xE9 Bizaad`, oc: `Occitan`, oj: `Anishinaabemowin`, om: `Afaan Oromoo`, or: `\u0B13\u0B21\u0B3C\u0B3F\u0B06`, os: `\u0418\u0440\u043E\u043D`, pa: `\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40`, pi: `\u{11005}\u{1102F}\u{11022}`, rm: `Rumantsch`, rn: `Ikirundi`, rw: `Kinyarwanda`, sa: `\u0938\u0902\u0938\u094D\u0915\u0943\u0924\u092E\u094D`, sc: `Sardu`, sg: `S\xE4ng\xF6`, ss: `SiSwati`, st: `Sesotho`, ti: `\u1275\u130D\u122D\u129B`, tn: `Setswana`, to: `Faka Tonga`, ts: `Xitsonga`, tt: `\u0422\u0430\u0442\u0430\u0440\u0447\u0430`, tw: `Twi`, ty: `Reo Tahiti`, ve: `Tshiven\u1E13a`, vo: `Volap\xFCk`, wa: `Walon`, wo: `Wolof`, za: `Sa\u026F cue\u014B\u0185` };
|
|
736
|
+
var zt = (e5, t2) => {
|
|
737
|
+
e5.searchParams.set(`lang`, t2);
|
|
738
|
+
};
|
|
739
|
+
var Bt = (e5, t2) => {
|
|
740
|
+
let n2 = e5.hostname.split(`.`);
|
|
741
|
+
n2[0] === `www` && (n2 = n2.slice(1)), n2 = [t2, ...n2], e5.hostname = n2.join(`.`);
|
|
742
|
+
};
|
|
743
|
+
var Vt = (e5, t2) => {
|
|
744
|
+
e5.pathname = `/${t2}${e5.pathname}`;
|
|
745
|
+
};
|
|
746
|
+
var Ht = (e5, t2) => {
|
|
747
|
+
if (!t2.languageCode || !t2?.resolutionMethod) return e5;
|
|
748
|
+
let n2 = new URL(e5);
|
|
749
|
+
return (t2?.resolutionMethod === `QUERY_PARAM` ? zt : t2?.resolutionMethod === `SUBDOMAIN` ? Bt : Vt)(n2, t2.languageCode), n2.href;
|
|
750
|
+
};
|
|
751
|
+
var Ut = (e5, t2) => {
|
|
752
|
+
if (!e5?.length) return e5;
|
|
753
|
+
let n2;
|
|
754
|
+
try {
|
|
755
|
+
n2 = new URL(e5);
|
|
756
|
+
} catch {
|
|
757
|
+
return e5;
|
|
758
|
+
}
|
|
759
|
+
n2.searchParams.delete(`lang`);
|
|
760
|
+
let r2 = n2.pathname.split(`/`)[1]?.toLowerCase();
|
|
761
|
+
if (t2.includes(r2 ?? ``)) {
|
|
762
|
+
let e6 = n2.pathname.split(`/`);
|
|
763
|
+
e6.splice(1, 1), n2.pathname = e6.join(`/`);
|
|
764
|
+
}
|
|
765
|
+
let i2 = n2.hostname.split(`.`)[0]?.toLowerCase();
|
|
766
|
+
if (t2.includes(i2 ?? ``)) {
|
|
767
|
+
let e6 = n2.hostname.split(`.`);
|
|
768
|
+
e6.shift(), n2.hostname = e6.join(`.`);
|
|
769
|
+
}
|
|
770
|
+
return n2.href;
|
|
771
|
+
};
|
|
772
|
+
function Wt() {
|
|
773
|
+
let e5 = Gt();
|
|
774
|
+
return e5 ? Kt(e5) : [];
|
|
775
|
+
}
|
|
776
|
+
function Gt() {
|
|
777
|
+
let e5 = typeof globals < `u` ? globals?.$ns?.[`wix-window`]?.multilingual : void 0, t2 = typeof window < `u` ? window?.essentials?.multilingual : void 0;
|
|
778
|
+
return e5 ?? t2 ?? globalThis?.__wix_site_metadata__?.multilingual;
|
|
779
|
+
}
|
|
780
|
+
function Kt(e5) {
|
|
781
|
+
try {
|
|
782
|
+
if (e5?.supportedLanguages?.length) {
|
|
783
|
+
let t2 = e5.supportedLanguages, n2 = t2.map((e6) => e6.languageCode).filter(Boolean), r2 = e5.cleanUrl ?? Xt(n2);
|
|
784
|
+
return t2.map((e6) => ({ id: e6.languageCode, displayName: qt(e6), regionalFormat: [e6.locale?.languageCode, e6.locale?.country].filter(Boolean).join(`-`), url: Jt(e6, r2), primary: e6.isPrimary, resolutionMethod: e6.resolutionMethod }));
|
|
785
|
+
}
|
|
786
|
+
if (e5?.siteLanguages?.length) {
|
|
787
|
+
let t2 = e5.siteLanguages, n2 = Xt(t2.map((e6) => e6.languageCode).filter(Boolean));
|
|
788
|
+
return t2.map((e6) => ({ id: e6.languageCode, displayName: qt(e6), regionalFormat: e6.locale, url: Jt(e6, n2), primary: e6.isPrimaryLanguage, resolutionMethod: e6.resolutionMethod ? Yt(e6.resolutionMethod) : void 0 }));
|
|
789
|
+
}
|
|
790
|
+
} catch (e6) {
|
|
791
|
+
return console.warn(`[Multilingual Manager] listSupportedLanguages failed`, e6), [];
|
|
792
|
+
}
|
|
793
|
+
return console.warn(`[Multilingual Manager] listSupportedLanguages is not available`), [];
|
|
794
|
+
}
|
|
795
|
+
function qt(e5) {
|
|
796
|
+
let t2 = Rt[e5.languageCode];
|
|
797
|
+
if (t2) return t2;
|
|
798
|
+
let n2 = e5.name ?? e5.countryCode;
|
|
799
|
+
if (n2) return n2;
|
|
800
|
+
}
|
|
801
|
+
function Jt(e5, t2) {
|
|
802
|
+
if (e5.url || !t2 || !e5.resolutionMethod) return e5.url;
|
|
803
|
+
if (e5.languageCode) try {
|
|
804
|
+
return Ht(t2, { languageCode: e5.languageCode, countryCode: e5.countryCode, resolutionMethod: Yt(e5.resolutionMethod), locale: { languageCode: e5.languageCode, country: e5.countryCode } });
|
|
805
|
+
} catch (e6) {
|
|
806
|
+
console.warn(`[Multilingual Manager] buildUrlForLanguage failed`, e6);
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
function Yt(e5) {
|
|
811
|
+
switch (e5) {
|
|
812
|
+
case `QUERY_PARAM`:
|
|
813
|
+
case `QueryParam`:
|
|
814
|
+
return M.QUERY_PARAM;
|
|
815
|
+
case `SUBDOMAIN`:
|
|
816
|
+
case `Subdomain`:
|
|
817
|
+
return M.SUBDOMAIN;
|
|
818
|
+
case `SUBDIRECTORY`:
|
|
819
|
+
case `Subdirectory`:
|
|
820
|
+
return M.SUBDIRECTORY;
|
|
821
|
+
default:
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
function Xt(e5) {
|
|
826
|
+
let t2 = typeof window < `u` && window.location?.href ? window.location.href : ``;
|
|
827
|
+
try {
|
|
828
|
+
return Ut(t2, e5);
|
|
829
|
+
} catch (e6) {
|
|
830
|
+
return console.warn(`[Multilingual Manager] cleanCurrentUrl failed`, e6), t2;
|
|
831
|
+
}
|
|
730
832
|
}
|
|
731
|
-
var
|
|
732
|
-
var
|
|
733
|
-
var
|
|
734
|
-
var
|
|
735
|
-
let
|
|
736
|
-
if (
|
|
833
|
+
var Zt = `x-wix-linguist`;
|
|
834
|
+
var Qt = `00000000-0000-0000-0000-000000000000`;
|
|
835
|
+
var $t = `false`;
|
|
836
|
+
var en = () => {
|
|
837
|
+
let e5 = N(`language`), t2 = N(`locale`);
|
|
838
|
+
if (e5) return { [Zt]: [e5, t2 || e5, $t, Qt].join(`|`) };
|
|
737
839
|
};
|
|
738
|
-
function
|
|
739
|
-
let
|
|
840
|
+
function tn() {
|
|
841
|
+
let e5 = null, t2 = null;
|
|
740
842
|
return { promise: new Promise((n2, r2) => {
|
|
741
|
-
|
|
742
|
-
}), resolve:
|
|
743
|
-
}
|
|
744
|
-
var
|
|
745
|
-
var
|
|
746
|
-
var
|
|
747
|
-
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 =
|
|
748
|
-
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language:
|
|
749
|
-
return
|
|
843
|
+
e5 = n2, t2 = r2;
|
|
844
|
+
}), resolve: e5, reject: t2 };
|
|
845
|
+
}
|
|
846
|
+
var nn = () => (typeof window < `u` ? window.commonConfig : void 0) ?? globalThis.commonConfig;
|
|
847
|
+
var N = (e5) => nn()?.[e5];
|
|
848
|
+
var rn = ({ createHost: e5 }) => ({ __type: `host`, create: (e6) => ({}), host: (t2) => {
|
|
849
|
+
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e5(t2), o2 = on();
|
|
850
|
+
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language: N(`language`), locale: N(`locale`), get passThroughHeaders() {
|
|
851
|
+
return en();
|
|
750
852
|
} } };
|
|
751
|
-
}, auth: (
|
|
853
|
+
}, auth: (e6) => {
|
|
752
854
|
let t2 = typeof window < `u` ? window.wixEmbedsAPI : void 0;
|
|
753
|
-
!
|
|
754
|
-
let n2 = false, { resolve: r2, promise: i2 } =
|
|
855
|
+
!e6 && an() && (e6 = t2?.getAccessTokenFunction?.());
|
|
856
|
+
let n2 = false, { resolve: r2, promise: i2 } = tn();
|
|
755
857
|
return { getAuthHeaders: async () => {
|
|
756
|
-
if (!
|
|
757
|
-
return { headers: { Authorization: await
|
|
758
|
-
}, getAccessTokenInjector: () => (n2 = true, (
|
|
759
|
-
r2(
|
|
858
|
+
if (!e6 && n2 && (e6 = await i2), !e6) throw Error(`Failed to resolve auth token`);
|
|
859
|
+
return { headers: { Authorization: await e6() } };
|
|
860
|
+
}, getAccessTokenInjector: () => (n2 = true, (e7) => {
|
|
861
|
+
r2(e7);
|
|
760
862
|
}) };
|
|
761
863
|
} });
|
|
762
|
-
function
|
|
864
|
+
function an() {
|
|
763
865
|
return typeof document < `u` && document.currentScript?.tagName === `SCRIPT`;
|
|
764
866
|
}
|
|
765
|
-
function
|
|
766
|
-
let
|
|
767
|
-
if (!
|
|
768
|
-
let t2 = new URL(
|
|
867
|
+
function on() {
|
|
868
|
+
let e5 = (typeof window < `u` ? window.wixEmbedsAPI : void 0)?.getExternalBaseUrl?.();
|
|
869
|
+
if (!e5) return;
|
|
870
|
+
let t2 = new URL(e5);
|
|
769
871
|
return t2?.pathname && t2.pathname !== `/` ? `${t2.hostname}${t2.pathname}` : t2.hostname;
|
|
770
872
|
}
|
|
771
|
-
var
|
|
772
|
-
if (!
|
|
773
|
-
return
|
|
873
|
+
var sn = ({ clientSdk: e5, applicationId: t2 }) => ({ invoke: async ({ namespace: n2, method: r2, args: i2 }) => {
|
|
874
|
+
if (!e5) throw Error(`Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction`);
|
|
875
|
+
return e5.invoke({ namespace: n2, method: r2, args: i2, applicationId: t2, accessToken: `accessToken` });
|
|
774
876
|
}, getAccessToken: () => {
|
|
775
877
|
throw Error(`Not implemented`);
|
|
776
878
|
}, observeState: () => ({ disconnect: () => {
|
|
777
879
|
} }) });
|
|
778
|
-
var
|
|
779
|
-
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ??
|
|
880
|
+
var cn = rn({ createHost: function(e5) {
|
|
881
|
+
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ?? e5?.clientSdk ?? (typeof window < `u` ? window?.clientSdk : void 0), { applicationId: n2 } = e5 || {};
|
|
780
882
|
if (!n2) throw Error(`"createHost" was called without a required field "applicationId"`);
|
|
781
|
-
return { channel:
|
|
883
|
+
return { channel: sn({ clientSdk: t2, applicationId: n2 }), close: () => {
|
|
782
884
|
} };
|
|
783
885
|
} });
|
|
784
|
-
var
|
|
785
|
-
let n2 =
|
|
786
|
-
return
|
|
886
|
+
var ln = (e5, t2) => {
|
|
887
|
+
let n2 = cn.host({ applicationId: e5, componentId: t2 }), r2 = cn.auth();
|
|
888
|
+
return Be({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
|
|
787
889
|
};
|
|
788
|
-
var
|
|
789
|
-
function
|
|
790
|
-
let
|
|
791
|
-
if (
|
|
792
|
-
return
|
|
890
|
+
var un = (e5) => ln(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`, e5);
|
|
891
|
+
function dn() {
|
|
892
|
+
let e5 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
893
|
+
if (e5) return { initWixModules(t3, n3) {
|
|
894
|
+
return P(() => e5(t3, n3));
|
|
793
895
|
}, fetchWithAuth() {
|
|
794
896
|
throw Error(`fetchWithAuth is not available in this context`);
|
|
795
897
|
}, graphql() {
|
|
796
898
|
throw Error(`graphql is not available in this context`);
|
|
797
899
|
} };
|
|
798
900
|
let t2 = typeof $wixContext < `u` ? $wixContext.client : p.client === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.client : p.client, n2 = typeof $wixContext < `u` ? $wixContext.elevatedClient : p.elevatedClient === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.elevatedClient : p.elevatedClient;
|
|
799
|
-
if (t2 || n2) return { initWixModules(
|
|
901
|
+
if (t2 || n2) return { initWixModules(e6, r2) {
|
|
800
902
|
if (r2) {
|
|
801
903
|
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`);
|
|
802
|
-
return
|
|
904
|
+
return P(() => n2.use(e6));
|
|
803
905
|
}
|
|
804
906
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
805
|
-
return
|
|
806
|
-
}, fetchWithAuth: (
|
|
907
|
+
return P(() => t2.use(e6));
|
|
908
|
+
}, fetchWithAuth: (e6, n3) => {
|
|
807
909
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
808
|
-
return t2.fetchWithAuth(
|
|
910
|
+
return t2.fetchWithAuth(e6, n3);
|
|
809
911
|
}, getAuth() {
|
|
810
912
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
811
913
|
return t2.auth;
|
|
812
|
-
}, async graphql(
|
|
914
|
+
}, async graphql(e6, n3, r2) {
|
|
813
915
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
814
|
-
return t2.graphql(
|
|
916
|
+
return t2.graphql(e6, n3, r2);
|
|
815
917
|
} };
|
|
816
918
|
}
|
|
817
|
-
function
|
|
919
|
+
function P(e5) {
|
|
818
920
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
819
921
|
globalThis.__wix_context__ = void 0, p.client = void 0, p.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
820
922
|
try {
|
|
821
|
-
return
|
|
923
|
+
return e5();
|
|
822
924
|
} finally {
|
|
823
925
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
824
926
|
}
|
|
825
927
|
}
|
|
826
|
-
function
|
|
827
|
-
return { ...
|
|
828
|
-
let r2 =
|
|
928
|
+
function fn(e5, t2) {
|
|
929
|
+
return { ...e5, ...Object.fromEntries(t2.map((t3) => [t3, (...n2) => {
|
|
930
|
+
let r2 = dn();
|
|
829
931
|
if (!r2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
830
|
-
return r2.initWixModules(
|
|
932
|
+
return r2.initWixModules(e5)[t3].apply(void 0, n2);
|
|
831
933
|
}])) };
|
|
832
934
|
}
|
|
833
|
-
function
|
|
834
|
-
return
|
|
935
|
+
function pn(e5) {
|
|
936
|
+
return fn({ __type: `host`, create: (t2) => Object.entries(e5).reduce((e6, [n2, r2]) => ({ ...e6, [n2]: r2(t2) }), {}) }, Object.keys(e5));
|
|
937
|
+
}
|
|
938
|
+
var F = (e5) => typeof e5 == `string`;
|
|
939
|
+
var I = () => {
|
|
940
|
+
let e5, t2, n2 = new Promise((n3, r2) => {
|
|
941
|
+
e5 = n3, t2 = r2;
|
|
942
|
+
});
|
|
943
|
+
return n2.resolve = e5, n2.reject = t2, n2;
|
|
944
|
+
};
|
|
945
|
+
var mn = (e5) => e5 == null ? `` : `` + e5;
|
|
946
|
+
var hn = (e5, t2, n2) => {
|
|
947
|
+
e5.forEach((e6) => {
|
|
948
|
+
t2[e6] && (n2[e6] = t2[e6]);
|
|
949
|
+
});
|
|
950
|
+
};
|
|
951
|
+
var gn = /###/g;
|
|
952
|
+
var _n = (e5) => e5 && e5.indexOf(`###`) > -1 ? e5.replace(gn, `.`) : e5;
|
|
953
|
+
var vn = (e5) => !e5 || F(e5);
|
|
954
|
+
var L = (e5, t2, n2) => {
|
|
955
|
+
let r2 = F(t2) ? t2.split(`.`) : t2, i2 = 0;
|
|
956
|
+
for (; i2 < r2.length - 1; ) {
|
|
957
|
+
if (vn(e5)) return {};
|
|
958
|
+
let t3 = _n(r2[i2]);
|
|
959
|
+
!e5[t3] && n2 && (e5[t3] = new n2()), e5 = Object.prototype.hasOwnProperty.call(e5, t3) ? e5[t3] : {}, ++i2;
|
|
960
|
+
}
|
|
961
|
+
return vn(e5) ? {} : { obj: e5, k: _n(r2[i2]) };
|
|
962
|
+
};
|
|
963
|
+
var yn = (e5, t2, n2) => {
|
|
964
|
+
let { obj: r2, k: i2 } = L(e5, t2, Object);
|
|
965
|
+
if (r2 !== void 0 || t2.length === 1) {
|
|
966
|
+
r2[i2] = n2;
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
let a2 = t2[t2.length - 1], o2 = t2.slice(0, t2.length - 1), s2 = L(e5, o2, Object);
|
|
970
|
+
for (; s2.obj === void 0 && o2.length; ) a2 = `${o2[o2.length - 1]}.${a2}`, o2 = o2.slice(0, o2.length - 1), s2 = L(e5, o2, Object), s2?.obj && s2.obj[`${s2.k}.${a2}`] !== void 0 && (s2.obj = void 0);
|
|
971
|
+
s2.obj[`${s2.k}.${a2}`] = n2;
|
|
972
|
+
};
|
|
973
|
+
var bn = (e5, t2, n2, r2) => {
|
|
974
|
+
let { obj: i2, k: a2 } = L(e5, t2, Object);
|
|
975
|
+
i2[a2] = i2[a2] || [], i2[a2].push(n2);
|
|
976
|
+
};
|
|
977
|
+
var R = (e5, t2) => {
|
|
978
|
+
let { obj: n2, k: r2 } = L(e5, t2);
|
|
979
|
+
if (n2 && Object.prototype.hasOwnProperty.call(n2, r2)) return n2[r2];
|
|
980
|
+
};
|
|
981
|
+
var xn = (e5, t2, n2) => {
|
|
982
|
+
let r2 = R(e5, n2);
|
|
983
|
+
return r2 === void 0 ? R(t2, n2) : r2;
|
|
984
|
+
};
|
|
985
|
+
var Sn = (e5, t2, n2) => {
|
|
986
|
+
for (let r2 in t2) r2 !== `__proto__` && r2 !== `constructor` && (r2 in e5 ? F(e5[r2]) || e5[r2] instanceof String || F(t2[r2]) || t2[r2] instanceof String ? n2 && (e5[r2] = t2[r2]) : Sn(e5[r2], t2[r2], n2) : e5[r2] = t2[r2]);
|
|
987
|
+
return e5;
|
|
988
|
+
};
|
|
989
|
+
var z = (e5) => e5.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, `\\$&`);
|
|
990
|
+
var Cn = { "&": `&`, "<": `<`, ">": `>`, '"': `"`, "'": `'`, "/": `/` };
|
|
991
|
+
var wn = (e5) => F(e5) ? e5.replace(/[&<>"'\/]/g, (e6) => Cn[e6]) : e5;
|
|
992
|
+
var Tn = class {
|
|
993
|
+
constructor(e5) {
|
|
994
|
+
this.capacity = e5, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
995
|
+
}
|
|
996
|
+
getRegExp(e5) {
|
|
997
|
+
let t2 = this.regExpMap.get(e5);
|
|
998
|
+
if (t2 !== void 0) return t2;
|
|
999
|
+
let n2 = new RegExp(e5);
|
|
1000
|
+
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e5, n2), this.regExpQueue.push(e5), n2;
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
var En = [` `, `,`, `?`, `!`, `;`];
|
|
1004
|
+
var Dn = new Tn(20);
|
|
1005
|
+
var On = (e5, t2, n2) => {
|
|
1006
|
+
t2 ||= ``, n2 ||= ``;
|
|
1007
|
+
let r2 = En.filter((e6) => t2.indexOf(e6) < 0 && n2.indexOf(e6) < 0);
|
|
1008
|
+
if (r2.length === 0) return true;
|
|
1009
|
+
let i2 = Dn.getRegExp(`(${r2.map((e6) => e6 === `?` ? `\\?` : e6).join(`|`)})`), a2 = !i2.test(e5);
|
|
1010
|
+
if (!a2) {
|
|
1011
|
+
let t3 = e5.indexOf(n2);
|
|
1012
|
+
t3 > 0 && !i2.test(e5.substring(0, t3)) && (a2 = true);
|
|
1013
|
+
}
|
|
1014
|
+
return a2;
|
|
1015
|
+
};
|
|
1016
|
+
var B = (e5, t2, n2 = `.`) => {
|
|
1017
|
+
if (!e5) return;
|
|
1018
|
+
if (e5[t2]) return Object.prototype.hasOwnProperty.call(e5, t2) ? e5[t2] : void 0;
|
|
1019
|
+
let r2 = t2.split(n2), i2 = e5;
|
|
1020
|
+
for (let e6 = 0; e6 < r2.length; ) {
|
|
1021
|
+
if (!i2 || typeof i2 != `object`) return;
|
|
1022
|
+
let t3, a2 = ``;
|
|
1023
|
+
for (let o2 = e6; o2 < r2.length; ++o2) if (o2 !== e6 && (a2 += n2), a2 += r2[o2], t3 = i2[a2], t3 !== void 0) {
|
|
1024
|
+
if ([`string`, `number`, `boolean`].indexOf(typeof t3) > -1 && o2 < r2.length - 1) continue;
|
|
1025
|
+
e6 += o2 - e6 + 1;
|
|
1026
|
+
break;
|
|
1027
|
+
}
|
|
1028
|
+
i2 = t3;
|
|
1029
|
+
}
|
|
1030
|
+
return i2;
|
|
1031
|
+
};
|
|
1032
|
+
var V = (e5) => e5?.replace(/_/g, `-`);
|
|
1033
|
+
var kn = { type: `logger`, log(e5) {
|
|
1034
|
+
this.output(`log`, e5);
|
|
1035
|
+
}, warn(e5) {
|
|
1036
|
+
this.output(`warn`, e5);
|
|
1037
|
+
}, error(e5) {
|
|
1038
|
+
this.output(`error`, e5);
|
|
1039
|
+
}, output(e5, t2) {
|
|
1040
|
+
console?.[e5]?.apply?.(console, t2);
|
|
1041
|
+
} };
|
|
1042
|
+
var H = new class e2 {
|
|
1043
|
+
constructor(e5, t2 = {}) {
|
|
1044
|
+
this.init(e5, t2);
|
|
1045
|
+
}
|
|
1046
|
+
init(e5, t2 = {}) {
|
|
1047
|
+
this.prefix = t2.prefix || `i18next:`, this.logger = e5 || kn, this.options = t2, this.debug = t2.debug;
|
|
1048
|
+
}
|
|
1049
|
+
log(...e5) {
|
|
1050
|
+
return this.forward(e5, `log`, ``, true);
|
|
1051
|
+
}
|
|
1052
|
+
warn(...e5) {
|
|
1053
|
+
return this.forward(e5, `warn`, ``, true);
|
|
1054
|
+
}
|
|
1055
|
+
error(...e5) {
|
|
1056
|
+
return this.forward(e5, `error`, ``);
|
|
1057
|
+
}
|
|
1058
|
+
deprecate(...e5) {
|
|
1059
|
+
return this.forward(e5, `warn`, `WARNING DEPRECATED: `, true);
|
|
1060
|
+
}
|
|
1061
|
+
forward(e5, t2, n2, r2) {
|
|
1062
|
+
return r2 && !this.debug ? null : (F(e5[0]) && (e5[0] = `${n2}${this.prefix} ${e5[0]}`), this.logger[t2](e5));
|
|
1063
|
+
}
|
|
1064
|
+
create(t2) {
|
|
1065
|
+
return new e2(this.logger, { prefix: `${this.prefix}:${t2}:`, ...this.options });
|
|
1066
|
+
}
|
|
1067
|
+
clone(t2) {
|
|
1068
|
+
return t2 ||= this.options, t2.prefix = t2.prefix || this.prefix, new e2(this.logger, t2);
|
|
1069
|
+
}
|
|
1070
|
+
}();
|
|
1071
|
+
var U = class {
|
|
1072
|
+
constructor() {
|
|
1073
|
+
this.observers = {};
|
|
1074
|
+
}
|
|
1075
|
+
on(e5, t2) {
|
|
1076
|
+
return e5.split(` `).forEach((e6) => {
|
|
1077
|
+
this.observers[e6] || (this.observers[e6] = /* @__PURE__ */ new Map());
|
|
1078
|
+
let n2 = this.observers[e6].get(t2) || 0;
|
|
1079
|
+
this.observers[e6].set(t2, n2 + 1);
|
|
1080
|
+
}), this;
|
|
1081
|
+
}
|
|
1082
|
+
off(e5, t2) {
|
|
1083
|
+
if (this.observers[e5]) {
|
|
1084
|
+
if (!t2) {
|
|
1085
|
+
delete this.observers[e5];
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
this.observers[e5].delete(t2);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
emit(e5, ...t2) {
|
|
1092
|
+
this.observers[e5] && Array.from(this.observers[e5].entries()).forEach(([e6, n2]) => {
|
|
1093
|
+
for (let r2 = 0; r2 < n2; r2++) e6(...t2);
|
|
1094
|
+
}), this.observers[`*`] && Array.from(this.observers[`*`].entries()).forEach(([n2, r2]) => {
|
|
1095
|
+
for (let i2 = 0; i2 < r2; i2++) n2.apply(n2, [e5, ...t2]);
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
var An = class extends U {
|
|
1100
|
+
constructor(e5, t2 = { ns: [`translation`], defaultNS: `translation` }) {
|
|
1101
|
+
super(), this.data = e5 || {}, this.options = t2, this.options.keySeparator === void 0 && (this.options.keySeparator = `.`), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = true);
|
|
1102
|
+
}
|
|
1103
|
+
addNamespaces(e5) {
|
|
1104
|
+
this.options.ns.indexOf(e5) < 0 && this.options.ns.push(e5);
|
|
1105
|
+
}
|
|
1106
|
+
removeNamespaces(e5) {
|
|
1107
|
+
let t2 = this.options.ns.indexOf(e5);
|
|
1108
|
+
t2 > -1 && this.options.ns.splice(t2, 1);
|
|
1109
|
+
}
|
|
1110
|
+
getResource(e5, t2, n2, r2 = {}) {
|
|
1111
|
+
let i2 = r2.keySeparator === void 0 ? this.options.keySeparator : r2.keySeparator, a2 = r2.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r2.ignoreJSONStructure, o2;
|
|
1112
|
+
e5.indexOf(`.`) > -1 ? o2 = e5.split(`.`) : (o2 = [e5, t2], n2 && (Array.isArray(n2) ? o2.push(...n2) : F(n2) && i2 ? o2.push(...n2.split(i2)) : o2.push(n2)));
|
|
1113
|
+
let s2 = R(this.data, o2);
|
|
1114
|
+
return !s2 && !t2 && !n2 && e5.indexOf(`.`) > -1 && (e5 = o2[0], t2 = o2[1], n2 = o2.slice(2).join(`.`)), s2 || !a2 || !F(n2) ? s2 : B(this.data?.[e5]?.[t2], n2, i2);
|
|
1115
|
+
}
|
|
1116
|
+
addResource(e5, t2, n2, r2, i2 = { silent: false }) {
|
|
1117
|
+
let a2 = i2.keySeparator === void 0 ? this.options.keySeparator : i2.keySeparator, o2 = [e5, t2];
|
|
1118
|
+
n2 && (o2 = o2.concat(a2 ? n2.split(a2) : n2)), e5.indexOf(`.`) > -1 && (o2 = e5.split(`.`), r2 = t2, t2 = o2[1]), this.addNamespaces(t2), yn(this.data, o2, r2), i2.silent || this.emit(`added`, e5, t2, n2, r2);
|
|
1119
|
+
}
|
|
1120
|
+
addResources(e5, t2, n2, r2 = { silent: false }) {
|
|
1121
|
+
for (let r3 in n2) (F(n2[r3]) || Array.isArray(n2[r3])) && this.addResource(e5, t2, r3, n2[r3], { silent: true });
|
|
1122
|
+
r2.silent || this.emit(`added`, e5, t2, n2);
|
|
1123
|
+
}
|
|
1124
|
+
addResourceBundle(e5, t2, n2, r2, i2, a2 = { silent: false, skipCopy: false }) {
|
|
1125
|
+
let o2 = [e5, t2];
|
|
1126
|
+
e5.indexOf(`.`) > -1 && (o2 = e5.split(`.`), r2 = n2, n2 = t2, t2 = o2[1]), this.addNamespaces(t2);
|
|
1127
|
+
let s2 = R(this.data, o2) || {};
|
|
1128
|
+
a2.skipCopy || (n2 = JSON.parse(JSON.stringify(n2))), r2 ? Sn(s2, n2, i2) : s2 = { ...s2, ...n2 }, yn(this.data, o2, s2), a2.silent || this.emit(`added`, e5, t2, n2);
|
|
1129
|
+
}
|
|
1130
|
+
removeResourceBundle(e5, t2) {
|
|
1131
|
+
this.hasResourceBundle(e5, t2) && delete this.data[e5][t2], this.removeNamespaces(t2), this.emit(`removed`, e5, t2);
|
|
1132
|
+
}
|
|
1133
|
+
hasResourceBundle(e5, t2) {
|
|
1134
|
+
return this.getResource(e5, t2) !== void 0;
|
|
1135
|
+
}
|
|
1136
|
+
getResourceBundle(e5, t2) {
|
|
1137
|
+
return t2 ||= this.options.defaultNS, this.getResource(e5, t2);
|
|
1138
|
+
}
|
|
1139
|
+
getDataByLanguage(e5) {
|
|
1140
|
+
return this.data[e5];
|
|
1141
|
+
}
|
|
1142
|
+
hasLanguageSomeTranslations(e5) {
|
|
1143
|
+
let t2 = this.getDataByLanguage(e5);
|
|
1144
|
+
return !!(t2 && Object.keys(t2) || []).find((e6) => t2[e6] && Object.keys(t2[e6]).length > 0);
|
|
1145
|
+
}
|
|
1146
|
+
toJSON() {
|
|
1147
|
+
return this.data;
|
|
1148
|
+
}
|
|
1149
|
+
};
|
|
1150
|
+
var jn = { processors: {}, addPostProcessor(e5) {
|
|
1151
|
+
this.processors[e5.name] = e5;
|
|
1152
|
+
}, handle(e5, t2, n2, r2, i2) {
|
|
1153
|
+
return e5.forEach((e6) => {
|
|
1154
|
+
t2 = this.processors[e6]?.process(t2, n2, r2, i2) ?? t2;
|
|
1155
|
+
}), t2;
|
|
1156
|
+
} };
|
|
1157
|
+
var Mn = Symbol(`i18next/PATH_KEY`);
|
|
1158
|
+
function Nn() {
|
|
1159
|
+
let e5 = [], t2 = /* @__PURE__ */ Object.create(null), n2;
|
|
1160
|
+
return t2.get = (r2, i2) => (n2?.revoke?.(), i2 === Mn ? e5 : (e5.push(i2), n2 = Proxy.revocable(r2, t2), n2.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), t2).proxy;
|
|
1161
|
+
}
|
|
1162
|
+
function W(e5, t2) {
|
|
1163
|
+
let { [Mn]: n2 } = e5(Nn()), r2 = t2?.keySeparator ?? `.`, i2 = t2?.nsSeparator ?? `:`;
|
|
1164
|
+
if (n2.length > 1 && i2) {
|
|
1165
|
+
let e6 = t2?.ns, a2 = Array.isArray(e6) ? e6 : null;
|
|
1166
|
+
if (a2 && a2.length > 1 && a2.slice(1).includes(n2[0])) return `${n2[0]}${i2}${n2.slice(1).join(r2)}`;
|
|
1167
|
+
}
|
|
1168
|
+
return n2.join(r2);
|
|
1169
|
+
}
|
|
1170
|
+
var Pn = {};
|
|
1171
|
+
var Fn = (e5) => !F(e5) && typeof e5 != `boolean` && typeof e5 != `number`;
|
|
1172
|
+
var In = class e3 extends U {
|
|
1173
|
+
constructor(e5, t2 = {}) {
|
|
1174
|
+
super(), hn([`resourceStore`, `languageUtils`, `pluralResolver`, `interpolator`, `backendConnector`, `i18nFormat`, `utils`], e5, this), this.options = t2, this.options.keySeparator === void 0 && (this.options.keySeparator = `.`), this.logger = H.create(`translator`);
|
|
1175
|
+
}
|
|
1176
|
+
changeLanguage(e5) {
|
|
1177
|
+
e5 && (this.language = e5);
|
|
1178
|
+
}
|
|
1179
|
+
exists(e5, t2 = { interpolation: {} }) {
|
|
1180
|
+
let n2 = { ...t2 };
|
|
1181
|
+
if (e5 == null) return false;
|
|
1182
|
+
let r2 = this.resolve(e5, n2);
|
|
1183
|
+
if (r2?.res === void 0) return false;
|
|
1184
|
+
let i2 = Fn(r2.res);
|
|
1185
|
+
return !(n2.returnObjects === false && i2);
|
|
1186
|
+
}
|
|
1187
|
+
extractFromKey(e5, t2) {
|
|
1188
|
+
let n2 = t2.nsSeparator === void 0 ? this.options.nsSeparator : t2.nsSeparator;
|
|
1189
|
+
n2 === void 0 && (n2 = `:`);
|
|
1190
|
+
let r2 = t2.keySeparator === void 0 ? this.options.keySeparator : t2.keySeparator, i2 = t2.ns || this.options.defaultNS || [], a2 = n2 && e5.indexOf(n2) > -1, o2 = !this.options.userDefinedKeySeparator && !t2.keySeparator && !this.options.userDefinedNsSeparator && !t2.nsSeparator && !On(e5, n2, r2);
|
|
1191
|
+
if (a2 && !o2) {
|
|
1192
|
+
let t3 = e5.match(this.interpolator.nestingRegexp);
|
|
1193
|
+
if (t3 && t3.length > 0) return { key: e5, namespaces: F(i2) ? [i2] : i2 };
|
|
1194
|
+
let a3 = e5.split(n2);
|
|
1195
|
+
(n2 !== r2 || n2 === r2 && this.options.ns.indexOf(a3[0]) > -1) && (i2 = a3.shift()), e5 = a3.join(r2);
|
|
1196
|
+
}
|
|
1197
|
+
return { key: e5, namespaces: F(i2) ? [i2] : i2 };
|
|
1198
|
+
}
|
|
1199
|
+
translate(t2, n2, r2) {
|
|
1200
|
+
let i2 = typeof n2 == `object` ? { ...n2 } : n2;
|
|
1201
|
+
if (typeof i2 != `object` && this.options.overloadTranslationOptionHandler && (i2 = this.options.overloadTranslationOptionHandler(arguments)), typeof i2 == `object` && (i2 = { ...i2 }), i2 ||= {}, t2 == null) return ``;
|
|
1202
|
+
typeof t2 == `function` && (t2 = W(t2, { ...this.options, ...i2 })), Array.isArray(t2) || (t2 = [String(t2)]), t2 = t2.map((e5) => typeof e5 == `function` ? W(e5, { ...this.options, ...i2 }) : String(e5));
|
|
1203
|
+
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;
|
|
1204
|
+
u2 === void 0 && (u2 = `:`);
|
|
1205
|
+
let d2 = i2.lng || this.language, f2 = i2.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
1206
|
+
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;
|
|
1207
|
+
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 && !F(i2.count), x2 = e3.hasDefaultValue(i2), S2 = b2 ? this.pluralResolver.getSuffix(d2, i2.count, i2) : ``, ee2 = i2.ordinal && b2 ? this.pluralResolver.getSuffix(d2, i2.count, { ordinal: false }) : ``, C2 = b2 && !i2.ordinal && i2.count === 0, w2 = C2 && i2[`defaultValue${this.options.pluralSeparator}zero`] || i2[`defaultValue${S2}`] || i2[`defaultValue${ee2}`] || i2.defaultValue, T2 = m2;
|
|
1208
|
+
y2 && !m2 && x2 && (T2 = w2);
|
|
1209
|
+
let te2 = Fn(T2), ne2 = Object.prototype.toString.apply(T2);
|
|
1210
|
+
if (y2 && T2 && te2 && _2.indexOf(ne2) < 0 && !(F(v2) && Array.isArray(T2))) {
|
|
1211
|
+
if (!i2.returnObjects && !this.options.returnObjects) {
|
|
1212
|
+
this.options.returnedObjectHandler || this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);
|
|
1213
|
+
let e5 = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h2, T2, { ...i2, ns: c2 }) : `key '${s2} (${this.language})' returned an object instead of string.`;
|
|
1214
|
+
return a2 ? (p2.res = e5, p2.usedParams = this.getUsedParamsDetails(i2), p2) : e5;
|
|
1215
|
+
}
|
|
1216
|
+
if (o2) {
|
|
1217
|
+
let e5 = Array.isArray(T2), t3 = e5 ? [] : {}, n3 = e5 ? g2 : h2;
|
|
1218
|
+
for (let e6 in T2) if (Object.prototype.hasOwnProperty.call(T2, e6)) {
|
|
1219
|
+
let r3 = `${n3}${o2}${e6}`;
|
|
1220
|
+
t3[e6] = x2 && !m2 ? this.translate(r3, { ...i2, defaultValue: Fn(w2) ? w2[e6] : void 0, joinArrays: false, ns: c2 }) : this.translate(r3, { ...i2, joinArrays: false, ns: c2 }), t3[e6] === r3 && (t3[e6] = T2[e6]);
|
|
1221
|
+
}
|
|
1222
|
+
m2 = t3;
|
|
1223
|
+
}
|
|
1224
|
+
} else if (y2 && F(v2) && Array.isArray(m2)) m2 = m2.join(v2), m2 &&= this.extendTranslation(m2, t2, i2, r2);
|
|
1225
|
+
else {
|
|
1226
|
+
let e5 = false, n3 = false;
|
|
1227
|
+
!this.isValidLookup(m2) && x2 && (e5 = true, m2 = w2), this.isValidLookup(m2) || (n3 = true, m2 = s2);
|
|
1228
|
+
let a3 = (i2.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n3 ? void 0 : m2, c3 = x2 && w2 !== m2 && this.options.updateMissing;
|
|
1229
|
+
if (n3 || e5 || c3) {
|
|
1230
|
+
if (this.logger.log(c3 ? `updateKey` : `missingKey`, d2, l2, s2, c3 ? w2 : m2), o2) {
|
|
1231
|
+
let e7 = this.resolve(s2, { ...i2, keySeparator: false });
|
|
1232
|
+
e7 && e7.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.`);
|
|
1233
|
+
}
|
|
1234
|
+
let e6 = [], t3 = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i2.lng || this.language);
|
|
1235
|
+
if (this.options.saveMissingTo === `fallback` && t3 && t3[0]) for (let n5 = 0; n5 < t3.length; n5++) e6.push(t3[n5]);
|
|
1236
|
+
else this.options.saveMissingTo === `all` ? e6 = this.languageUtils.toResolveHierarchy(i2.lng || this.language) : e6.push(i2.lng || this.language);
|
|
1237
|
+
let n4 = (e7, t4, n5) => {
|
|
1238
|
+
let r3 = x2 && n5 !== m2 ? n5 : a3;
|
|
1239
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(e7, l2, t4, r3, c3, i2) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e7, l2, t4, r3, c3, i2), this.emit(`missingKey`, e7, l2, t4, m2);
|
|
1240
|
+
};
|
|
1241
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && b2 ? e6.forEach((e7) => {
|
|
1242
|
+
let t4 = this.pluralResolver.getSuffixes(e7, i2);
|
|
1243
|
+
C2 && i2[`defaultValue${this.options.pluralSeparator}zero`] && t4.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t4.push(`${this.options.pluralSeparator}zero`), t4.forEach((t5) => {
|
|
1244
|
+
n4([e7], s2 + t5, i2[`defaultValue${t5}`] || w2);
|
|
1245
|
+
});
|
|
1246
|
+
}) : n4(e6, s2, w2));
|
|
1247
|
+
}
|
|
1248
|
+
m2 = this.extendTranslation(m2, t2, i2, p2, r2), n3 && m2 === s2 && this.options.appendNamespaceToMissingKey && (m2 = `${l2}${u2}${s2}`), (n3 || e5) && this.options.parseMissingKeyHandler && (m2 = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l2}${u2}${s2}` : s2, e5 ? m2 : void 0, i2));
|
|
1249
|
+
}
|
|
1250
|
+
return a2 ? (p2.res = m2, p2.usedParams = this.getUsedParamsDetails(i2), p2) : m2;
|
|
1251
|
+
}
|
|
1252
|
+
extendTranslation(e5, t2, n2, r2, i2) {
|
|
1253
|
+
if (this.i18nFormat?.parse) e5 = this.i18nFormat.parse(e5, { ...this.options.interpolation.defaultVariables, ...n2 }, n2.lng || this.language || r2.usedLng, r2.usedNS, r2.usedKey, { resolved: r2 });
|
|
1254
|
+
else if (!n2.skipInterpolation) {
|
|
1255
|
+
n2.interpolation && this.interpolator.init({ ...n2, interpolation: { ...this.options.interpolation, ...n2.interpolation } });
|
|
1256
|
+
let a3 = F(e5) && (n2?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n2.interpolation.skipOnVariables), o3;
|
|
1257
|
+
if (a3) {
|
|
1258
|
+
let t3 = e5.match(this.interpolator.nestingRegexp);
|
|
1259
|
+
o3 = t3 && t3.length;
|
|
1260
|
+
}
|
|
1261
|
+
let s2 = n2.replace && !F(n2.replace) ? n2.replace : n2;
|
|
1262
|
+
if (this.options.interpolation.defaultVariables && (s2 = { ...this.options.interpolation.defaultVariables, ...s2 }), e5 = this.interpolator.interpolate(e5, s2, n2.lng || this.language || r2.usedLng, n2), a3) {
|
|
1263
|
+
let t3 = e5.match(this.interpolator.nestingRegexp), r3 = t3 && t3.length;
|
|
1264
|
+
o3 < r3 && (n2.nest = false);
|
|
1265
|
+
}
|
|
1266
|
+
!n2.lng && r2 && r2.res && (n2.lng = this.language || r2.usedLng), n2.nest !== false && (e5 = this.interpolator.nest(e5, (...e6) => i2?.[0] === e6[0] && !n2.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e6[0]} in key: ${t2[0]}`), null) : this.translate(...e6, t2), n2)), n2.interpolation && this.interpolator.reset();
|
|
1267
|
+
}
|
|
1268
|
+
let a2 = n2.postProcess || this.options.postProcess, o2 = F(a2) ? [a2] : a2;
|
|
1269
|
+
return e5 != null && o2?.length && n2.applyPostProcessor !== false && (e5 = jn.handle(o2, e5, t2, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...r2, usedParams: this.getUsedParamsDetails(n2) }, ...n2 } : n2, this)), e5;
|
|
1270
|
+
}
|
|
1271
|
+
resolve(e5, t2 = {}) {
|
|
1272
|
+
let n2, r2, i2, a2, o2;
|
|
1273
|
+
return F(e5) && (e5 = [e5]), Array.isArray(e5) && (e5 = e5.map((e6) => typeof e6 == `function` ? W(e6, { ...this.options, ...t2 }) : e6)), e5.forEach((e6) => {
|
|
1274
|
+
if (this.isValidLookup(n2)) return;
|
|
1275
|
+
let s2 = this.extractFromKey(e6, t2), c2 = s2.key;
|
|
1276
|
+
r2 = c2;
|
|
1277
|
+
let l2 = s2.namespaces;
|
|
1278
|
+
this.options.fallbackNS && (l2 = l2.concat(this.options.fallbackNS));
|
|
1279
|
+
let u2 = t2.count !== void 0 && !F(t2.count), d2 = u2 && !t2.ordinal && t2.count === 0, f2 = t2.context !== void 0 && (F(t2.context) || typeof t2.context == `number`) && t2.context !== ``, p2 = t2.lngs ? t2.lngs : this.languageUtils.toResolveHierarchy(t2.lng || this.language, t2.fallbackLng);
|
|
1280
|
+
l2.forEach((e7) => {
|
|
1281
|
+
this.isValidLookup(n2) || (o2 = e7, !Pn[`${p2[0]}-${e7}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o2) && (Pn[`${p2[0]}-${e7}`] = 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) => {
|
|
1282
|
+
if (this.isValidLookup(n2)) return;
|
|
1283
|
+
a2 = r3;
|
|
1284
|
+
let o3 = [c2];
|
|
1285
|
+
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o3, c2, r3, e7, t2);
|
|
1286
|
+
else {
|
|
1287
|
+
let e8;
|
|
1288
|
+
u2 && (e8 = this.pluralResolver.getSuffix(r3, t2.count, t2));
|
|
1289
|
+
let n3 = `${this.options.pluralSeparator}zero`, i3 = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
1290
|
+
if (u2 && (t2.ordinal && e8.indexOf(i3) === 0 && o3.push(c2 + e8.replace(i3, this.options.pluralSeparator)), o3.push(c2 + e8), d2 && o3.push(c2 + n3)), f2) {
|
|
1291
|
+
let r4 = `${c2}${this.options.contextSeparator || `_`}${t2.context}`;
|
|
1292
|
+
o3.push(r4), u2 && (t2.ordinal && e8.indexOf(i3) === 0 && o3.push(r4 + e8.replace(i3, this.options.pluralSeparator)), o3.push(r4 + e8), d2 && o3.push(r4 + n3));
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
let s3;
|
|
1296
|
+
for (; s3 = o3.pop(); ) this.isValidLookup(n2) || (i2 = s3, n2 = this.getResource(r3, e7, s3, t2));
|
|
1297
|
+
}));
|
|
1298
|
+
});
|
|
1299
|
+
}), { res: n2, usedKey: r2, exactUsedKey: i2, usedLng: a2, usedNS: o2 };
|
|
1300
|
+
}
|
|
1301
|
+
isValidLookup(e5) {
|
|
1302
|
+
return e5 !== void 0 && !(!this.options.returnNull && e5 === null) && !(!this.options.returnEmptyString && e5 === ``);
|
|
1303
|
+
}
|
|
1304
|
+
getResource(e5, t2, n2, r2 = {}) {
|
|
1305
|
+
return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e5, t2, n2, r2) : this.resourceStore.getResource(e5, t2, n2, r2);
|
|
1306
|
+
}
|
|
1307
|
+
getUsedParamsDetails(e5 = {}) {
|
|
1308
|
+
let t2 = [`defaultValue`, `ordinal`, `context`, `replace`, `lng`, `lngs`, `fallbackLng`, `ns`, `keySeparator`, `nsSeparator`, `returnObjects`, `returnDetails`, `joinArrays`, `postProcess`, `interpolation`], n2 = e5.replace && !F(e5.replace), r2 = n2 ? e5.replace : e5;
|
|
1309
|
+
if (n2 && e5.count !== void 0 && (r2.count = e5.count), this.options.interpolation.defaultVariables && (r2 = { ...this.options.interpolation.defaultVariables, ...r2 }), !n2) {
|
|
1310
|
+
r2 = { ...r2 };
|
|
1311
|
+
for (let e6 of t2) delete r2[e6];
|
|
1312
|
+
}
|
|
1313
|
+
return r2;
|
|
1314
|
+
}
|
|
1315
|
+
static hasDefaultValue(e5) {
|
|
1316
|
+
for (let t2 in e5) if (Object.prototype.hasOwnProperty.call(e5, t2) && t2.substring(0, 12) === `defaultValue` && e5[t2] !== void 0) return true;
|
|
1317
|
+
return false;
|
|
1318
|
+
}
|
|
1319
|
+
};
|
|
1320
|
+
var Ln = class {
|
|
1321
|
+
constructor(e5) {
|
|
1322
|
+
this.options = e5, this.supportedLngs = this.options.supportedLngs || false, this.logger = H.create(`languageUtils`);
|
|
1323
|
+
}
|
|
1324
|
+
getScriptPartFromCode(e5) {
|
|
1325
|
+
if (e5 = V(e5), !e5 || e5.indexOf(`-`) < 0) return null;
|
|
1326
|
+
let t2 = e5.split(`-`);
|
|
1327
|
+
return t2.length === 2 || (t2.pop(), t2[t2.length - 1].toLowerCase() === `x`) ? null : this.formatLanguageCode(t2.join(`-`));
|
|
1328
|
+
}
|
|
1329
|
+
getLanguagePartFromCode(e5) {
|
|
1330
|
+
if (e5 = V(e5), !e5 || e5.indexOf(`-`) < 0) return e5;
|
|
1331
|
+
let t2 = e5.split(`-`);
|
|
1332
|
+
return this.formatLanguageCode(t2[0]);
|
|
1333
|
+
}
|
|
1334
|
+
formatLanguageCode(e5) {
|
|
1335
|
+
if (F(e5) && e5.indexOf(`-`) > -1) {
|
|
1336
|
+
let t2;
|
|
1337
|
+
try {
|
|
1338
|
+
t2 = Intl.getCanonicalLocales(e5)[0];
|
|
1339
|
+
} catch {
|
|
1340
|
+
}
|
|
1341
|
+
return t2 && this.options.lowerCaseLng && (t2 = t2.toLowerCase()), t2 || (this.options.lowerCaseLng ? e5.toLowerCase() : e5);
|
|
1342
|
+
}
|
|
1343
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? e5.toLowerCase() : e5;
|
|
1344
|
+
}
|
|
1345
|
+
isSupportedCode(e5) {
|
|
1346
|
+
return (this.options.load === `languageOnly` || this.options.nonExplicitSupportedLngs) && (e5 = this.getLanguagePartFromCode(e5)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e5) > -1;
|
|
1347
|
+
}
|
|
1348
|
+
getBestMatchFromCodes(e5) {
|
|
1349
|
+
if (!e5) return null;
|
|
1350
|
+
let t2;
|
|
1351
|
+
return e5.forEach((e6) => {
|
|
1352
|
+
if (t2) return;
|
|
1353
|
+
let n2 = this.formatLanguageCode(e6);
|
|
1354
|
+
(!this.options.supportedLngs || this.isSupportedCode(n2)) && (t2 = n2);
|
|
1355
|
+
}), !t2 && this.options.supportedLngs && e5.forEach((e6) => {
|
|
1356
|
+
if (t2) return;
|
|
1357
|
+
let n2 = this.getScriptPartFromCode(e6);
|
|
1358
|
+
if (this.isSupportedCode(n2)) return t2 = n2;
|
|
1359
|
+
let r2 = this.getLanguagePartFromCode(e6);
|
|
1360
|
+
if (this.isSupportedCode(r2)) return t2 = r2;
|
|
1361
|
+
t2 = this.options.supportedLngs.find((e7) => {
|
|
1362
|
+
if (e7 === r2 || !(e7.indexOf(`-`) < 0 && r2.indexOf(`-`) < 0) && (e7.indexOf(`-`) > 0 && r2.indexOf(`-`) < 0 && e7.substring(0, e7.indexOf(`-`)) === r2 || e7.indexOf(r2) === 0 && r2.length > 1)) return e7;
|
|
1363
|
+
});
|
|
1364
|
+
}), t2 ||= this.getFallbackCodes(this.options.fallbackLng)[0], t2;
|
|
1365
|
+
}
|
|
1366
|
+
getFallbackCodes(e5, t2) {
|
|
1367
|
+
if (!e5) return [];
|
|
1368
|
+
if (typeof e5 == `function` && (e5 = e5(t2)), F(e5) && (e5 = [e5]), Array.isArray(e5)) return e5;
|
|
1369
|
+
if (!t2) return e5.default || [];
|
|
1370
|
+
let n2 = e5[t2];
|
|
1371
|
+
return n2 ||= e5[this.getScriptPartFromCode(t2)], n2 ||= e5[this.formatLanguageCode(t2)], n2 ||= e5[this.getLanguagePartFromCode(t2)], n2 ||= e5.default, n2 || [];
|
|
1372
|
+
}
|
|
1373
|
+
toResolveHierarchy(e5, t2) {
|
|
1374
|
+
let n2 = this.getFallbackCodes((t2 === false ? [] : t2) || this.options.fallbackLng || [], e5), r2 = [], i2 = (e6) => {
|
|
1375
|
+
e6 && (this.isSupportedCode(e6) ? r2.push(e6) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e6}`));
|
|
1376
|
+
};
|
|
1377
|
+
return F(e5) && (e5.indexOf(`-`) > -1 || e5.indexOf(`_`) > -1) ? (this.options.load !== `languageOnly` && i2(this.formatLanguageCode(e5)), this.options.load !== `languageOnly` && this.options.load !== `currentOnly` && i2(this.getScriptPartFromCode(e5)), this.options.load !== `currentOnly` && i2(this.getLanguagePartFromCode(e5))) : F(e5) && i2(this.formatLanguageCode(e5)), n2.forEach((e6) => {
|
|
1378
|
+
r2.indexOf(e6) < 0 && i2(this.formatLanguageCode(e6));
|
|
1379
|
+
}), r2;
|
|
1380
|
+
}
|
|
1381
|
+
};
|
|
1382
|
+
var Rn = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 };
|
|
1383
|
+
var zn = { select: (e5) => e5 === 1 ? `one` : `other`, resolvedOptions: () => ({ pluralCategories: [`one`, `other`] }) };
|
|
1384
|
+
var Bn = class {
|
|
1385
|
+
constructor(e5, t2 = {}) {
|
|
1386
|
+
this.languageUtils = e5, this.options = t2, this.logger = H.create(`pluralResolver`), this.pluralRulesCache = {};
|
|
1387
|
+
}
|
|
1388
|
+
clearCache() {
|
|
1389
|
+
this.pluralRulesCache = {};
|
|
1390
|
+
}
|
|
1391
|
+
getRule(e5, t2 = {}) {
|
|
1392
|
+
let n2 = V(e5 === `dev` ? `en` : e5), r2 = t2.ordinal ? `ordinal` : `cardinal`, i2 = JSON.stringify({ cleanedCode: n2, type: r2 });
|
|
1393
|
+
if (i2 in this.pluralRulesCache) return this.pluralRulesCache[i2];
|
|
1394
|
+
let a2;
|
|
1395
|
+
try {
|
|
1396
|
+
a2 = new Intl.PluralRules(n2, { type: r2 });
|
|
1397
|
+
} catch {
|
|
1398
|
+
if (typeof Intl > `u`) return this.logger.error(`No Intl support, please use an Intl polyfill!`), zn;
|
|
1399
|
+
if (!e5.match(/-|_/)) return zn;
|
|
1400
|
+
let n3 = this.languageUtils.getLanguagePartFromCode(e5);
|
|
1401
|
+
a2 = this.getRule(n3, t2);
|
|
1402
|
+
}
|
|
1403
|
+
return this.pluralRulesCache[i2] = a2, a2;
|
|
1404
|
+
}
|
|
1405
|
+
needsPlural(e5, t2 = {}) {
|
|
1406
|
+
let n2 = this.getRule(e5, t2);
|
|
1407
|
+
return n2 ||= this.getRule(`dev`, t2), n2?.resolvedOptions().pluralCategories.length > 1;
|
|
1408
|
+
}
|
|
1409
|
+
getPluralFormsOfKey(e5, t2, n2 = {}) {
|
|
1410
|
+
return this.getSuffixes(e5, n2).map((e6) => `${t2}${e6}`);
|
|
1411
|
+
}
|
|
1412
|
+
getSuffixes(e5, t2 = {}) {
|
|
1413
|
+
let n2 = this.getRule(e5, t2);
|
|
1414
|
+
return n2 ||= this.getRule(`dev`, t2), n2 ? n2.resolvedOptions().pluralCategories.sort((e6, t3) => Rn[e6] - Rn[t3]).map((e6) => `${this.options.prepend}${t2.ordinal ? `ordinal${this.options.prepend}` : ``}${e6}`) : [];
|
|
1415
|
+
}
|
|
1416
|
+
getSuffix(e5, t2, n2 = {}) {
|
|
1417
|
+
let r2 = this.getRule(e5, n2);
|
|
1418
|
+
return r2 ? `${this.options.prepend}${n2.ordinal ? `ordinal${this.options.prepend}` : ``}${r2.select(t2)}` : (this.logger.warn(`no plural rule found for: ${e5}`), this.getSuffix(`dev`, t2, n2));
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
var Vn = (e5, t2, n2, r2 = `.`, i2 = true) => {
|
|
1422
|
+
let a2 = xn(e5, t2, n2);
|
|
1423
|
+
return !a2 && i2 && F(n2) && (a2 = B(e5, n2, r2), a2 === void 0 && (a2 = B(t2, n2, r2))), a2;
|
|
1424
|
+
};
|
|
1425
|
+
var G = (e5) => e5.replace(/\$/g, `$$$$`);
|
|
1426
|
+
var Hn = class {
|
|
1427
|
+
constructor(e5 = {}) {
|
|
1428
|
+
this.logger = H.create(`interpolator`), this.options = e5, this.format = e5?.interpolation?.format || ((e6) => e6), this.init(e5);
|
|
1429
|
+
}
|
|
1430
|
+
init(e5 = {}) {
|
|
1431
|
+
e5.interpolation ||= { escapeValue: true };
|
|
1432
|
+
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 } = e5.interpolation;
|
|
1433
|
+
this.escape = t2 === void 0 ? wn : t2, this.escapeValue = n2 === void 0 || n2, this.useRawValueToEscape = r2 !== void 0 && r2, this.prefix = i2 ? z(i2) : a2 || `{{`, this.suffix = o2 ? z(o2) : s2 || `}}`, this.formatSeparator = c2 || `,`, this.unescapePrefix = l2 ? `` : u2 || `-`, this.unescapeSuffix = this.unescapePrefix ? `` : l2 || ``, this.nestingPrefix = d2 ? z(d2) : f2 || z(`$t(`), this.nestingSuffix = p2 ? z(p2) : m2 || z(`)`), this.nestingOptionsSeparator = h2 || `,`, this.maxReplaces = g2 || 1e3, this.alwaysFormat = _2 !== void 0 && _2, this.resetRegExp();
|
|
1434
|
+
}
|
|
1435
|
+
reset() {
|
|
1436
|
+
this.options && this.init(this.options);
|
|
1437
|
+
}
|
|
1438
|
+
resetRegExp() {
|
|
1439
|
+
let e5 = (e6, t2) => e6?.source === t2 ? (e6.lastIndex = 0, e6) : new RegExp(t2, `g`);
|
|
1440
|
+
this.regexp = e5(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e5(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e5(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
|
|
1441
|
+
}
|
|
1442
|
+
interpolate(e5, t2, n2, r2) {
|
|
1443
|
+
let i2, a2, o2, s2 = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c2 = (e6) => {
|
|
1444
|
+
if (e6.indexOf(this.formatSeparator) < 0) {
|
|
1445
|
+
let i4 = Vn(t2, s2, e6, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
1446
|
+
return this.alwaysFormat ? this.format(i4, void 0, n2, { ...r2, ...t2, interpolationkey: e6 }) : i4;
|
|
1447
|
+
}
|
|
1448
|
+
let i3 = e6.split(this.formatSeparator), a3 = i3.shift().trim(), o3 = i3.join(this.formatSeparator).trim();
|
|
1449
|
+
return this.format(Vn(t2, s2, a3, this.options.keySeparator, this.options.ignoreJSONStructure), o3, n2, { ...r2, ...t2, interpolationkey: a3 });
|
|
1450
|
+
};
|
|
1451
|
+
this.resetRegExp();
|
|
1452
|
+
let l2 = r2?.missingInterpolationHandler || this.options.missingInterpolationHandler, u2 = r2?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r2.interpolation.skipOnVariables;
|
|
1453
|
+
return [{ regex: this.regexpUnescape, safeValue: (e6) => G(e6) }, { regex: this.regexp, safeValue: (e6) => this.escapeValue ? G(this.escape(e6)) : G(e6) }].forEach((t3) => {
|
|
1454
|
+
for (o2 = 0; i2 = t3.regex.exec(e5); ) {
|
|
1455
|
+
let n3 = i2[1].trim();
|
|
1456
|
+
if (a2 = c2(n3), a2 === void 0) {
|
|
1457
|
+
if (typeof l2 == `function`) {
|
|
1458
|
+
let t4 = l2(e5, i2, r2);
|
|
1459
|
+
a2 = F(t4) ? t4 : ``;
|
|
1460
|
+
} else if (r2 && Object.prototype.hasOwnProperty.call(r2, n3)) a2 = ``;
|
|
1461
|
+
else if (u2) {
|
|
1462
|
+
a2 = i2[0];
|
|
1463
|
+
continue;
|
|
1464
|
+
} else this.logger.warn(`missed to pass in variable ${n3} for interpolating ${e5}`), a2 = ``;
|
|
1465
|
+
} else !F(a2) && !this.useRawValueToEscape && (a2 = mn(a2));
|
|
1466
|
+
let s3 = t3.safeValue(a2);
|
|
1467
|
+
if (e5 = e5.replace(i2[0], s3), u2 ? (t3.regex.lastIndex += a2.length, t3.regex.lastIndex -= i2[0].length) : t3.regex.lastIndex = 0, o2++, o2 >= this.maxReplaces) break;
|
|
1468
|
+
}
|
|
1469
|
+
}), e5;
|
|
1470
|
+
}
|
|
1471
|
+
nest(e5, t2, n2 = {}) {
|
|
1472
|
+
let r2, i2, a2, o2 = (e6, t3) => {
|
|
1473
|
+
let n3 = this.nestingOptionsSeparator;
|
|
1474
|
+
if (e6.indexOf(n3) < 0) return e6;
|
|
1475
|
+
let r3 = e6.split(RegExp(`${z(n3)}[ ]*{`)), i3 = `{${r3[1]}`;
|
|
1476
|
+
e6 = r3[0], i3 = this.interpolate(i3, a2);
|
|
1477
|
+
let o3 = i3.match(/'/g), s2 = i3.match(/"/g);
|
|
1478
|
+
((o3?.length ?? 0) % 2 == 0 && !s2 || (s2?.length ?? 0) % 2 != 0) && (i3 = i3.replace(/'/g, `"`));
|
|
1479
|
+
try {
|
|
1480
|
+
a2 = JSON.parse(i3), t3 && (a2 = { ...t3, ...a2 });
|
|
1481
|
+
} catch (t4) {
|
|
1482
|
+
return this.logger.warn(`failed parsing options string in nesting for key ${e6}`, t4), `${e6}${n3}${i3}`;
|
|
1483
|
+
}
|
|
1484
|
+
return a2.defaultValue && a2.defaultValue.indexOf(this.prefix) > -1 && delete a2.defaultValue, e6;
|
|
1485
|
+
};
|
|
1486
|
+
for (; r2 = this.nestingRegexp.exec(e5); ) {
|
|
1487
|
+
let s2 = [];
|
|
1488
|
+
a2 = { ...n2 }, a2 = a2.replace && !F(a2.replace) ? a2.replace : a2, a2.applyPostProcessor = false, delete a2.defaultValue;
|
|
1489
|
+
let c2 = /{.*}/.test(r2[1]) ? r2[1].lastIndexOf(`}`) + 1 : r2[1].indexOf(this.formatSeparator);
|
|
1490
|
+
if (c2 !== -1 && (s2 = r2[1].slice(c2).split(this.formatSeparator).map((e6) => e6.trim()).filter(Boolean), r2[1] = r2[1].slice(0, c2)), i2 = t2(o2.call(this, r2[1].trim(), a2), a2), i2 && r2[0] === e5 && !F(i2)) return i2;
|
|
1491
|
+
F(i2) || (i2 = mn(i2)), i2 ||= (this.logger.warn(`missed to resolve ${r2[1]} for nesting ${e5}`), ``), s2.length && (i2 = s2.reduce((e6, t3) => this.format(e6, t3, n2.lng, { ...n2, interpolationkey: r2[1].trim() }), i2.trim())), e5 = e5.replace(r2[0], i2), this.regexp.lastIndex = 0;
|
|
1492
|
+
}
|
|
1493
|
+
return e5;
|
|
1494
|
+
}
|
|
1495
|
+
};
|
|
1496
|
+
var Un = (e5) => {
|
|
1497
|
+
let t2 = e5.toLowerCase().trim(), n2 = {};
|
|
1498
|
+
if (e5.indexOf(`(`) > -1) {
|
|
1499
|
+
let r2 = e5.split(`(`);
|
|
1500
|
+
t2 = r2[0].toLowerCase().trim();
|
|
1501
|
+
let i2 = r2[1].substring(0, r2[1].length - 1);
|
|
1502
|
+
t2 === `currency` && i2.indexOf(`:`) < 0 ? n2.currency ||= i2.trim() : t2 === `relativetime` && i2.indexOf(`:`) < 0 ? n2.range ||= i2.trim() : i2.split(`;`).forEach((e6) => {
|
|
1503
|
+
if (e6) {
|
|
1504
|
+
let [t3, ...r3] = e6.split(`:`), i3 = r3.join(`:`).trim().replace(/^'+|'+$/g, ``), a2 = t3.trim();
|
|
1505
|
+
n2[a2] || (n2[a2] = i3), i3 === `false` && (n2[a2] = false), i3 === `true` && (n2[a2] = true), isNaN(i3) || (n2[a2] = parseInt(i3, 10));
|
|
1506
|
+
}
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
return { formatName: t2, formatOptions: n2 };
|
|
1510
|
+
};
|
|
1511
|
+
var Wn = (e5) => {
|
|
1512
|
+
let t2 = {};
|
|
1513
|
+
return (n2, r2, i2) => {
|
|
1514
|
+
let a2 = i2;
|
|
1515
|
+
i2 && i2.interpolationkey && i2.formatParams && i2.formatParams[i2.interpolationkey] && i2[i2.interpolationkey] && (a2 = { ...a2, [i2.interpolationkey]: void 0 });
|
|
1516
|
+
let o2 = r2 + JSON.stringify(a2), s2 = t2[o2];
|
|
1517
|
+
return s2 || (s2 = e5(V(r2), i2), t2[o2] = s2), s2(n2);
|
|
1518
|
+
};
|
|
1519
|
+
};
|
|
1520
|
+
var Gn = (e5) => (t2, n2, r2) => e5(V(n2), r2)(t2);
|
|
1521
|
+
var Kn = class {
|
|
1522
|
+
constructor(e5 = {}) {
|
|
1523
|
+
this.logger = H.create(`formatter`), this.options = e5, this.init(e5);
|
|
1524
|
+
}
|
|
1525
|
+
init(e5, t2 = { interpolation: {} }) {
|
|
1526
|
+
this.formatSeparator = t2.interpolation.formatSeparator || `,`;
|
|
1527
|
+
let n2 = t2.cacheInBuiltFormats ? Wn : Gn;
|
|
1528
|
+
this.formats = { number: n2((e6, t3) => {
|
|
1529
|
+
let n3 = new Intl.NumberFormat(e6, { ...t3 });
|
|
1530
|
+
return (e7) => n3.format(e7);
|
|
1531
|
+
}), currency: n2((e6, t3) => {
|
|
1532
|
+
let n3 = new Intl.NumberFormat(e6, { ...t3, style: `currency` });
|
|
1533
|
+
return (e7) => n3.format(e7);
|
|
1534
|
+
}), datetime: n2((e6, t3) => {
|
|
1535
|
+
let n3 = new Intl.DateTimeFormat(e6, { ...t3 });
|
|
1536
|
+
return (e7) => n3.format(e7);
|
|
1537
|
+
}), relativetime: n2((e6, t3) => {
|
|
1538
|
+
let n3 = new Intl.RelativeTimeFormat(e6, { ...t3 });
|
|
1539
|
+
return (e7) => n3.format(e7, t3.range || `day`);
|
|
1540
|
+
}), list: n2((e6, t3) => {
|
|
1541
|
+
let n3 = new Intl.ListFormat(e6, { ...t3 });
|
|
1542
|
+
return (e7) => n3.format(e7);
|
|
1543
|
+
}) };
|
|
1544
|
+
}
|
|
1545
|
+
add(e5, t2) {
|
|
1546
|
+
this.formats[e5.toLowerCase().trim()] = t2;
|
|
1547
|
+
}
|
|
1548
|
+
addCached(e5, t2) {
|
|
1549
|
+
this.formats[e5.toLowerCase().trim()] = Wn(t2);
|
|
1550
|
+
}
|
|
1551
|
+
format(e5, t2, n2, r2 = {}) {
|
|
1552
|
+
let i2 = t2.split(this.formatSeparator);
|
|
1553
|
+
if (i2.length > 1 && i2[0].indexOf(`(`) > 1 && i2[0].indexOf(`)`) < 0 && i2.find((e6) => e6.indexOf(`)`) > -1)) {
|
|
1554
|
+
let e6 = i2.findIndex((e7) => e7.indexOf(`)`) > -1);
|
|
1555
|
+
i2[0] = [i2[0], ...i2.splice(1, e6)].join(this.formatSeparator);
|
|
1556
|
+
}
|
|
1557
|
+
return i2.reduce((e6, t3) => {
|
|
1558
|
+
let { formatName: i3, formatOptions: a2 } = Un(t3);
|
|
1559
|
+
if (this.formats[i3]) {
|
|
1560
|
+
let t4 = e6;
|
|
1561
|
+
try {
|
|
1562
|
+
let o2 = r2?.formatParams?.[r2.interpolationkey] || {}, s2 = o2.locale || o2.lng || r2.locale || r2.lng || n2;
|
|
1563
|
+
t4 = this.formats[i3](e6, s2, { ...a2, ...r2, ...o2 });
|
|
1564
|
+
} catch (e7) {
|
|
1565
|
+
this.logger.warn(e7);
|
|
1566
|
+
}
|
|
1567
|
+
return t4;
|
|
1568
|
+
}
|
|
1569
|
+
return this.logger.warn(`there was no format function for ${i3}`), e6;
|
|
1570
|
+
}, e5);
|
|
1571
|
+
}
|
|
1572
|
+
};
|
|
1573
|
+
var qn = (e5, t2) => {
|
|
1574
|
+
e5.pending[t2] !== void 0 && (delete e5.pending[t2], e5.pendingCount--);
|
|
1575
|
+
};
|
|
1576
|
+
var Jn = class extends U {
|
|
1577
|
+
constructor(e5, t2, n2, r2 = {}) {
|
|
1578
|
+
super(), this.backend = e5, this.store = t2, this.services = n2, this.languageUtils = n2.languageUtils, this.options = r2, this.logger = H.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);
|
|
1579
|
+
}
|
|
1580
|
+
queueLoad(e5, t2, n2, r2) {
|
|
1581
|
+
let i2 = {}, a2 = {}, o2 = {}, s2 = {};
|
|
1582
|
+
return e5.forEach((e6) => {
|
|
1583
|
+
let r3 = true;
|
|
1584
|
+
t2.forEach((t3) => {
|
|
1585
|
+
let o3 = `${e6}|${t3}`;
|
|
1586
|
+
!n2.reload && this.store.hasResourceBundle(e6, 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)));
|
|
1587
|
+
}), r3 || (o2[e6] = true);
|
|
1588
|
+
}), (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) };
|
|
1589
|
+
}
|
|
1590
|
+
loaded(e5, t2, n2) {
|
|
1591
|
+
let r2 = e5.split(`|`), i2 = r2[0], a2 = r2[1];
|
|
1592
|
+
t2 && this.emit(`failedLoading`, i2, a2, t2), !t2 && n2 && this.store.addResourceBundle(i2, a2, n2, void 0, void 0, { skipCopy: true }), this.state[e5] = t2 ? -1 : 2, t2 && n2 && (this.state[e5] = 0);
|
|
1593
|
+
let o2 = {};
|
|
1594
|
+
this.queue.forEach((n3) => {
|
|
1595
|
+
bn(n3.loaded, [i2], a2), qn(n3, e5), t2 && n3.errors.push(t2), n3.pendingCount === 0 && !n3.done && (Object.keys(n3.loaded).forEach((e6) => {
|
|
1596
|
+
o2[e6] || (o2[e6] = {});
|
|
1597
|
+
let t3 = n3.loaded[e6];
|
|
1598
|
+
t3.length && t3.forEach((t4) => {
|
|
1599
|
+
o2[e6][t4] === void 0 && (o2[e6][t4] = true);
|
|
1600
|
+
});
|
|
1601
|
+
}), n3.done = true, n3.errors.length ? n3.callback(n3.errors) : n3.callback());
|
|
1602
|
+
}), this.emit(`loaded`, o2), this.queue = this.queue.filter((e6) => !e6.done);
|
|
1603
|
+
}
|
|
1604
|
+
read(e5, t2, n2, r2 = 0, i2 = this.retryTimeout, a2) {
|
|
1605
|
+
if (!e5.length) return a2(null, {});
|
|
1606
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
1607
|
+
this.waitingReads.push({ lng: e5, ns: t2, fcName: n2, tried: r2, wait: i2, callback: a2 });
|
|
1608
|
+
return;
|
|
1609
|
+
}
|
|
1610
|
+
this.readingCalls++;
|
|
1611
|
+
let o2 = (o3, s3) => {
|
|
1612
|
+
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
1613
|
+
let e6 = this.waitingReads.shift();
|
|
1614
|
+
this.read(e6.lng, e6.ns, e6.fcName, e6.tried, e6.wait, e6.callback);
|
|
1615
|
+
}
|
|
1616
|
+
if (o3 && s3 && r2 < this.maxRetries) {
|
|
1617
|
+
setTimeout(() => {
|
|
1618
|
+
this.read.call(this, e5, t2, n2, r2 + 1, i2 * 2, a2);
|
|
1619
|
+
}, i2);
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
a2(o3, s3);
|
|
1623
|
+
}, s2 = this.backend[n2].bind(this.backend);
|
|
1624
|
+
if (s2.length === 2) {
|
|
1625
|
+
try {
|
|
1626
|
+
let n3 = s2(e5, t2);
|
|
1627
|
+
n3 && typeof n3.then == `function` ? n3.then((e6) => o2(null, e6)).catch(o2) : o2(null, n3);
|
|
1628
|
+
} catch (e6) {
|
|
1629
|
+
o2(e6);
|
|
1630
|
+
}
|
|
1631
|
+
return;
|
|
1632
|
+
}
|
|
1633
|
+
return s2(e5, t2, o2);
|
|
1634
|
+
}
|
|
1635
|
+
prepareLoading(e5, t2, n2 = {}, r2) {
|
|
1636
|
+
if (!this.backend) return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`), r2 && r2();
|
|
1637
|
+
F(e5) && (e5 = this.languageUtils.toResolveHierarchy(e5)), F(t2) && (t2 = [t2]);
|
|
1638
|
+
let i2 = this.queueLoad(e5, t2, n2, r2);
|
|
1639
|
+
if (!i2.toLoad.length) return i2.pending.length || r2(), null;
|
|
1640
|
+
i2.toLoad.forEach((e6) => {
|
|
1641
|
+
this.loadOne(e6);
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
load(e5, t2, n2) {
|
|
1645
|
+
this.prepareLoading(e5, t2, {}, n2);
|
|
1646
|
+
}
|
|
1647
|
+
reload(e5, t2, n2) {
|
|
1648
|
+
this.prepareLoading(e5, t2, { reload: true }, n2);
|
|
1649
|
+
}
|
|
1650
|
+
loadOne(e5, t2 = ``) {
|
|
1651
|
+
let n2 = e5.split(`|`), r2 = n2[0], i2 = n2[1];
|
|
1652
|
+
this.read(r2, i2, `read`, void 0, void 0, (n3, a2) => {
|
|
1653
|
+
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(e5, n3, a2);
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1656
|
+
saveMissing(e5, t2, n2, r2, i2, a2 = {}, o2 = () => {
|
|
1657
|
+
}) {
|
|
1658
|
+
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t2)) {
|
|
1659
|
+
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!!!`);
|
|
1660
|
+
return;
|
|
1661
|
+
}
|
|
1662
|
+
if (n2 != null && n2 !== ``) {
|
|
1663
|
+
if (this.backend?.create) {
|
|
1664
|
+
let s2 = { ...a2, isUpdate: i2 }, c2 = this.backend.create.bind(this.backend);
|
|
1665
|
+
if (c2.length < 6) try {
|
|
1666
|
+
let i3;
|
|
1667
|
+
i3 = c2.length === 5 ? c2(e5, t2, n2, r2, s2) : c2(e5, t2, n2, r2), i3 && typeof i3.then == `function` ? i3.then((e6) => o2(null, e6)).catch(o2) : o2(null, i3);
|
|
1668
|
+
} catch (e6) {
|
|
1669
|
+
o2(e6);
|
|
1670
|
+
}
|
|
1671
|
+
else c2(e5, t2, n2, r2, o2, s2);
|
|
1672
|
+
}
|
|
1673
|
+
e5 && e5[0] && this.store.addResource(e5[0], t2, n2, r2);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
};
|
|
1677
|
+
var K = () => ({ debug: false, initAsync: true, ns: [`translation`], defaultNS: [`translation`], fallbackLng: [`dev`], fallbackNS: false, supportedLngs: false, nonExplicitSupportedLngs: false, load: `all`, preload: false, simplifyPluralSuffix: true, keySeparator: `.`, nsSeparator: `:`, pluralSeparator: `_`, contextSeparator: `_`, 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: (e5) => {
|
|
1678
|
+
let t2 = {};
|
|
1679
|
+
if (typeof e5[1] == `object` && (t2 = e5[1]), F(e5[1]) && (t2.defaultValue = e5[1]), F(e5[2]) && (t2.tDescription = e5[2]), typeof e5[2] == `object` || typeof e5[3] == `object`) {
|
|
1680
|
+
let n2 = e5[3] || e5[2];
|
|
1681
|
+
Object.keys(n2).forEach((e6) => {
|
|
1682
|
+
t2[e6] = n2[e6];
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
return t2;
|
|
1686
|
+
}, interpolation: { escapeValue: true, format: (e5) => e5, prefix: `{{`, suffix: `}}`, formatSeparator: `,`, unescapePrefix: `-`, nestingPrefix: `$t(`, nestingSuffix: `)`, nestingOptionsSeparator: `,`, maxReplaces: 1e3, skipOnVariables: true }, cacheInBuiltFormats: true });
|
|
1687
|
+
var Yn = (e5) => (F(e5.ns) && (e5.ns = [e5.ns]), F(e5.fallbackLng) && (e5.fallbackLng = [e5.fallbackLng]), F(e5.fallbackNS) && (e5.fallbackNS = [e5.fallbackNS]), e5.supportedLngs?.indexOf?.(`cimode`) < 0 && (e5.supportedLngs = e5.supportedLngs.concat([`cimode`])), typeof e5.initImmediate == `boolean` && (e5.initAsync = e5.initImmediate), e5);
|
|
1688
|
+
var q = () => {
|
|
1689
|
+
};
|
|
1690
|
+
var Xn = (e5) => {
|
|
1691
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(e5)).forEach((t2) => {
|
|
1692
|
+
typeof e5[t2] == `function` && (e5[t2] = e5[t2].bind(e5));
|
|
1693
|
+
});
|
|
1694
|
+
};
|
|
1695
|
+
var Zn = `__i18next_supportNoticeShown`;
|
|
1696
|
+
var Qn = () => !!(typeof globalThis < `u` && globalThis[Zn] || typeof process < `u` && {}.I18NEXT_NO_SUPPORT_NOTICE || typeof process < `u`);
|
|
1697
|
+
var $n = () => {
|
|
1698
|
+
typeof globalThis < `u` && (globalThis[Zn] = true);
|
|
1699
|
+
};
|
|
1700
|
+
var er = (e5) => !!(e5?.modules?.backend?.name?.indexOf(`Locize`) > 0 || e5?.modules?.backend?.constructor?.name?.indexOf(`Locize`) > 0 || e5?.options?.backend?.backends && e5.options.backend.backends.some((e6) => e6?.name?.indexOf(`Locize`) > 0 || e6?.constructor?.name?.indexOf(`Locize`) > 0) || e5?.options?.backend?.projectId || e5?.options?.backend?.backendOptions && e5.options.backend.backendOptions.some((e6) => e6?.projectId));
|
|
1701
|
+
var J = class e4 extends U {
|
|
1702
|
+
constructor(e5 = {}, t2) {
|
|
1703
|
+
if (super(), this.options = Yn(e5), this.services = {}, this.logger = H, this.modules = { external: [] }, Xn(this), t2 && !this.isInitialized && !e5.isClone) {
|
|
1704
|
+
if (!this.options.initAsync) return this.init(e5, t2), this;
|
|
1705
|
+
setTimeout(() => {
|
|
1706
|
+
this.init(e5, t2);
|
|
1707
|
+
}, 0);
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
init(e5 = {}, t2) {
|
|
1711
|
+
this.isInitializing = true, typeof e5 == `function` && (t2 = e5, e5 = {}), e5.defaultNS == null && e5.ns && (F(e5.ns) ? e5.defaultNS = e5.ns : e5.ns.indexOf(`translation`) < 0 && (e5.defaultNS = e5.ns[0]));
|
|
1712
|
+
let n2 = K();
|
|
1713
|
+
this.options = { ...n2, ...this.options, ...Yn(e5) }, this.options.interpolation = { ...n2.interpolation, ...this.options.interpolation }, e5.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e5.keySeparator), e5.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e5.nsSeparator), typeof this.options.overloadTranslationOptionHandler != `function` && (this.options.overloadTranslationOptionHandler = n2.overloadTranslationOptionHandler), this.options.showSupportNotice !== false && !er(this) && !Qn() && (typeof console < `u` && console.info !== void 0 && console.info(`\u{1F310} i18next is made possible by our own product, Locize \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}`), $n());
|
|
1714
|
+
let r2 = (e6) => e6 ? typeof e6 == `function` ? new e6() : e6 : null;
|
|
1715
|
+
if (!this.options.isClone) {
|
|
1716
|
+
this.modules.logger ? H.init(r2(this.modules.logger), this.options) : H.init(null, this.options);
|
|
1717
|
+
let e6;
|
|
1718
|
+
e6 = this.modules.formatter ? this.modules.formatter : Kn;
|
|
1719
|
+
let t3 = new Ln(this.options);
|
|
1720
|
+
this.store = new An(this.options.resources, this.options);
|
|
1721
|
+
let i3 = this.services;
|
|
1722
|
+
i3.logger = H, i3.resourceStore = this.store, i3.languageUtils = t3, i3.pluralResolver = new Bn(t3, { prepend: this.options.pluralSeparator, simplifyPluralSuffix: this.options.simplifyPluralSuffix }), this.options.interpolation.format && this.options.interpolation.format !== n2.interpolation.format && this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`), e6 && (!this.options.interpolation.format || this.options.interpolation.format === n2.interpolation.format) && (i3.formatter = r2(e6), i3.formatter.init && i3.formatter.init(i3, this.options), this.options.interpolation.format = i3.formatter.format.bind(i3.formatter)), i3.interpolator = new Hn(this.options), i3.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i3.backendConnector = new Jn(r2(this.modules.backend), i3.resourceStore, i3, this.options), i3.backendConnector.on(`*`, (e7, ...t4) => {
|
|
1723
|
+
this.emit(e7, ...t4);
|
|
1724
|
+
}), this.modules.languageDetector && (i3.languageDetector = r2(this.modules.languageDetector), i3.languageDetector.init && i3.languageDetector.init(i3, this.options.detection, this.options)), this.modules.i18nFormat && (i3.i18nFormat = r2(this.modules.i18nFormat), i3.i18nFormat.init && i3.i18nFormat.init(this)), this.translator = new In(this.services, this.options), this.translator.on(`*`, (e7, ...t4) => {
|
|
1725
|
+
this.emit(e7, ...t4);
|
|
1726
|
+
}), this.modules.external.forEach((e7) => {
|
|
1727
|
+
e7.init && e7.init(this);
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1730
|
+
if (this.format = this.options.interpolation.format, t2 ||= q, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1731
|
+
let e6 = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1732
|
+
e6.length > 0 && e6[0] !== `dev` && (this.options.lng = e6[0]);
|
|
1733
|
+
}
|
|
1734
|
+
!this.services.languageDetector && !this.options.lng && this.logger.warn(`init: no languageDetector is used and no lng is defined`), [`getResource`, `hasResourceBundle`, `getResourceBundle`, `getDataByLanguage`].forEach((e6) => {
|
|
1735
|
+
this[e6] = (...t3) => this.store[e6](...t3);
|
|
1736
|
+
}), [`addResource`, `addResources`, `addResourceBundle`, `removeResourceBundle`].forEach((e6) => {
|
|
1737
|
+
this[e6] = (...t3) => (this.store[e6](...t3), this);
|
|
1738
|
+
});
|
|
1739
|
+
let i2 = I(), a2 = () => {
|
|
1740
|
+
let e6 = (e7, n3) => {
|
|
1741
|
+
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(e7, n3);
|
|
1742
|
+
};
|
|
1743
|
+
if (this.languages && !this.isInitialized) return e6(null, this.t.bind(this));
|
|
1744
|
+
this.changeLanguage(this.options.lng, e6);
|
|
1745
|
+
};
|
|
1746
|
+
return this.options.resources || !this.options.initAsync ? a2() : setTimeout(a2, 0), i2;
|
|
1747
|
+
}
|
|
1748
|
+
loadResources(e5, t2 = q) {
|
|
1749
|
+
let n2 = t2, r2 = F(e5) ? e5 : this.language;
|
|
1750
|
+
if (typeof e5 == `function` && (n2 = e5), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1751
|
+
if (r2?.toLowerCase() === `cimode` && (!this.options.preload || this.options.preload.length === 0)) return n2();
|
|
1752
|
+
let e6 = [], t3 = (t4) => {
|
|
1753
|
+
t4 && t4 !== `cimode` && this.services.languageUtils.toResolveHierarchy(t4).forEach((t5) => {
|
|
1754
|
+
t5 !== `cimode` && e6.indexOf(t5) < 0 && e6.push(t5);
|
|
1755
|
+
});
|
|
1756
|
+
};
|
|
1757
|
+
r2 ? t3(r2) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e7) => t3(e7)), this.options.preload?.forEach?.((e7) => t3(e7)), this.services.backendConnector.load(e6, this.options.ns, (e7) => {
|
|
1758
|
+
!e7 && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n2(e7);
|
|
1759
|
+
});
|
|
1760
|
+
} else n2(null);
|
|
1761
|
+
}
|
|
1762
|
+
reloadResources(e5, t2, n2) {
|
|
1763
|
+
let r2 = I();
|
|
1764
|
+
return typeof e5 == `function` && (n2 = e5, e5 = void 0), typeof t2 == `function` && (n2 = t2, t2 = void 0), e5 ||= this.languages, t2 ||= this.options.ns, n2 ||= q, this.services.backendConnector.reload(e5, t2, (e6) => {
|
|
1765
|
+
r2.resolve(), n2(e6);
|
|
1766
|
+
}), r2;
|
|
1767
|
+
}
|
|
1768
|
+
use(e5) {
|
|
1769
|
+
if (!e5) throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);
|
|
1770
|
+
if (!e5.type) throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);
|
|
1771
|
+
return e5.type === `backend` && (this.modules.backend = e5), (e5.type === `logger` || e5.log && e5.warn && e5.error) && (this.modules.logger = e5), e5.type === `languageDetector` && (this.modules.languageDetector = e5), e5.type === `i18nFormat` && (this.modules.i18nFormat = e5), e5.type === `postProcessor` && jn.addPostProcessor(e5), e5.type === `formatter` && (this.modules.formatter = e5), e5.type === `3rdParty` && this.modules.external.push(e5), this;
|
|
1772
|
+
}
|
|
1773
|
+
setResolvedLanguage(e5) {
|
|
1774
|
+
if (e5 && this.languages && !([`cimode`, `dev`].indexOf(e5) > -1)) {
|
|
1775
|
+
for (let e6 = 0; e6 < this.languages.length; e6++) {
|
|
1776
|
+
let t2 = this.languages[e6];
|
|
1777
|
+
if (!([`cimode`, `dev`].indexOf(t2) > -1) && this.store.hasLanguageSomeTranslations(t2)) {
|
|
1778
|
+
this.resolvedLanguage = t2;
|
|
1779
|
+
break;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
!this.resolvedLanguage && this.languages.indexOf(e5) < 0 && this.store.hasLanguageSomeTranslations(e5) && (this.resolvedLanguage = e5, this.languages.unshift(e5));
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
changeLanguage(e5, t2) {
|
|
1786
|
+
this.isLanguageChangingTo = e5;
|
|
1787
|
+
let n2 = I();
|
|
1788
|
+
this.emit(`languageChanging`, e5);
|
|
1789
|
+
let r2 = (e6) => {
|
|
1790
|
+
this.language = e6, this.languages = this.services.languageUtils.toResolveHierarchy(e6), this.resolvedLanguage = void 0, this.setResolvedLanguage(e6);
|
|
1791
|
+
}, i2 = (i3, a3) => {
|
|
1792
|
+
a3 ? this.isLanguageChangingTo === e5 && (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((...e6) => this.t(...e6)), t2 && t2(i3, (...e6) => this.t(...e6));
|
|
1793
|
+
}, a2 = (t3) => {
|
|
1794
|
+
!e5 && !t3 && this.services.languageDetector && (t3 = []);
|
|
1795
|
+
let n3 = F(t3) ? t3 : t3 && t3[0], a3 = this.store.hasLanguageSomeTranslations(n3) ? n3 : this.services.languageUtils.getBestMatchFromCodes(F(t3) ? [t3] : t3);
|
|
1796
|
+
a3 && (this.language || r2(a3), this.translator.language || this.translator.changeLanguage(a3), this.services.languageDetector?.cacheUserLanguage?.(a3)), this.loadResources(a3, (e6) => {
|
|
1797
|
+
i2(e6, a3);
|
|
1798
|
+
});
|
|
1799
|
+
};
|
|
1800
|
+
return !e5 && this.services.languageDetector && !this.services.languageDetector.async ? a2(this.services.languageDetector.detect()) : !e5 && 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(e5), n2;
|
|
1801
|
+
}
|
|
1802
|
+
getFixedT(e5, t2, n2) {
|
|
1803
|
+
let r2 = (e6, t3, ...i2) => {
|
|
1804
|
+
let a2;
|
|
1805
|
+
a2 = typeof t3 == `object` ? { ...t3 } : this.options.overloadTranslationOptionHandler([e6, t3].concat(i2)), a2.lng = a2.lng || r2.lng, a2.lngs = a2.lngs || r2.lngs, a2.ns = a2.ns || r2.ns, a2.keyPrefix !== `` && (a2.keyPrefix = a2.keyPrefix || n2 || r2.keyPrefix);
|
|
1806
|
+
let o2 = { ...this.options, ...a2 };
|
|
1807
|
+
typeof a2.keyPrefix == `function` && (a2.keyPrefix = W(a2.keyPrefix, o2));
|
|
1808
|
+
let s2 = this.options.keySeparator || `.`, c2;
|
|
1809
|
+
return a2.keyPrefix && Array.isArray(e6) ? c2 = e6.map((e7) => (typeof e7 == `function` && (e7 = W(e7, o2)), `${a2.keyPrefix}${s2}${e7}`)) : (typeof e6 == `function` && (e6 = W(e6, o2)), c2 = a2.keyPrefix ? `${a2.keyPrefix}${s2}${e6}` : e6), this.t(c2, a2);
|
|
1810
|
+
};
|
|
1811
|
+
return F(e5) ? r2.lng = e5 : r2.lngs = e5, r2.ns = t2, r2.keyPrefix = n2, r2;
|
|
1812
|
+
}
|
|
1813
|
+
t(...e5) {
|
|
1814
|
+
return this.translator?.translate(...e5);
|
|
1815
|
+
}
|
|
1816
|
+
exists(...e5) {
|
|
1817
|
+
return this.translator?.exists(...e5);
|
|
1818
|
+
}
|
|
1819
|
+
setDefaultNamespace(e5) {
|
|
1820
|
+
this.options.defaultNS = e5;
|
|
1821
|
+
}
|
|
1822
|
+
hasLoadedNamespace(e5, t2 = {}) {
|
|
1823
|
+
if (!this.isInitialized) return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`, this.languages), false;
|
|
1824
|
+
if (!this.languages || !this.languages.length) return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`, this.languages), false;
|
|
1825
|
+
let n2 = t2.lng || this.resolvedLanguage || this.languages[0], r2 = this.options ? this.options.fallbackLng : false, i2 = this.languages[this.languages.length - 1];
|
|
1826
|
+
if (n2.toLowerCase() === `cimode`) return true;
|
|
1827
|
+
let a2 = (e6, t3) => {
|
|
1828
|
+
let n3 = this.services.backendConnector.state[`${e6}|${t3}`];
|
|
1829
|
+
return n3 === -1 || n3 === 0 || n3 === 2;
|
|
1830
|
+
};
|
|
1831
|
+
if (t2.precheck) {
|
|
1832
|
+
let e6 = t2.precheck(this, a2);
|
|
1833
|
+
if (e6 !== void 0) return e6;
|
|
1834
|
+
}
|
|
1835
|
+
return !!(this.hasResourceBundle(n2, e5) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a2(n2, e5) && (!r2 || a2(i2, e5)));
|
|
1836
|
+
}
|
|
1837
|
+
loadNamespaces(e5, t2) {
|
|
1838
|
+
let n2 = I();
|
|
1839
|
+
return this.options.ns ? (F(e5) && (e5 = [e5]), e5.forEach((e6) => {
|
|
1840
|
+
this.options.ns.indexOf(e6) < 0 && this.options.ns.push(e6);
|
|
1841
|
+
}), this.loadResources((e6) => {
|
|
1842
|
+
n2.resolve(), t2 && t2(e6);
|
|
1843
|
+
}), n2) : (t2 && t2(), Promise.resolve());
|
|
1844
|
+
}
|
|
1845
|
+
loadLanguages(e5, t2) {
|
|
1846
|
+
let n2 = I();
|
|
1847
|
+
F(e5) && (e5 = [e5]);
|
|
1848
|
+
let r2 = this.options.preload || [], i2 = e5.filter((e6) => r2.indexOf(e6) < 0 && this.services.languageUtils.isSupportedCode(e6));
|
|
1849
|
+
return i2.length ? (this.options.preload = r2.concat(i2), this.loadResources((e6) => {
|
|
1850
|
+
n2.resolve(), t2 && t2(e6);
|
|
1851
|
+
}), n2) : (t2 && t2(), Promise.resolve());
|
|
1852
|
+
}
|
|
1853
|
+
dir(e5) {
|
|
1854
|
+
if (e5 ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e5) return `rtl`;
|
|
1855
|
+
try {
|
|
1856
|
+
let t3 = new Intl.Locale(e5);
|
|
1857
|
+
if (t3 && t3.getTextInfo) {
|
|
1858
|
+
let e6 = t3.getTextInfo();
|
|
1859
|
+
if (e6 && e6.direction) return e6.direction;
|
|
1860
|
+
}
|
|
1861
|
+
} catch {
|
|
1862
|
+
}
|
|
1863
|
+
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 Ln(K());
|
|
1864
|
+
return e5.toLowerCase().indexOf(`-latn`) > 1 ? `ltr` : t2.indexOf(n2.getLanguagePartFromCode(e5)) > -1 || e5.toLowerCase().indexOf(`-arab`) > 1 ? `rtl` : `ltr`;
|
|
1865
|
+
}
|
|
1866
|
+
static createInstance(t2 = {}, n2) {
|
|
1867
|
+
let r2 = new e4(t2, n2);
|
|
1868
|
+
return r2.createInstance = e4.createInstance, r2;
|
|
1869
|
+
}
|
|
1870
|
+
cloneInstance(t2 = {}, n2 = q) {
|
|
1871
|
+
let r2 = t2.forkResourceStore;
|
|
1872
|
+
r2 && delete t2.forkResourceStore;
|
|
1873
|
+
let i2 = { ...this.options, ...t2, isClone: true }, a2 = new e4(i2);
|
|
1874
|
+
if ((t2.debug !== void 0 || t2.prefix !== void 0) && (a2.logger = a2.logger.clone(t2)), [`store`, `services`, `language`].forEach((e5) => {
|
|
1875
|
+
a2[e5] = this[e5];
|
|
1876
|
+
}), a2.services = { ...this.services }, a2.services.utils = { hasLoadedNamespace: a2.hasLoadedNamespace.bind(a2) }, r2 && (a2.store = new An(Object.keys(this.store.data).reduce((e5, t3) => (e5[t3] = { ...this.store.data[t3] }, e5[t3] = Object.keys(e5[t3]).reduce((n3, r3) => (n3[r3] = { ...e5[t3][r3] }, n3), e5[t3]), e5), {}), i2), a2.services.resourceStore = a2.store), t2.interpolation) {
|
|
1877
|
+
let e5 = { ...K().interpolation, ...this.options.interpolation, ...t2.interpolation }, n3 = { ...i2, interpolation: e5 };
|
|
1878
|
+
a2.services.interpolator = new Hn(n3);
|
|
1879
|
+
}
|
|
1880
|
+
return a2.translator = new In(a2.services, i2), a2.translator.on(`*`, (e5, ...t3) => {
|
|
1881
|
+
a2.emit(e5, ...t3);
|
|
1882
|
+
}), a2.init(i2, n2), a2.translator.options = i2, a2.translator.backendConnector.services.utils = { hasLoadedNamespace: a2.hasLoadedNamespace.bind(a2) }, a2;
|
|
1883
|
+
}
|
|
1884
|
+
toJSON() {
|
|
1885
|
+
return { options: this.options, store: this.store, language: this.language, languages: this.languages, resolvedLanguage: this.resolvedLanguage };
|
|
1886
|
+
}
|
|
1887
|
+
}.createInstance();
|
|
1888
|
+
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;
|
|
1889
|
+
var tr = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
1890
|
+
var nr = { "&": `&`, "&": `&`, "<": `<`, "<": `<`, ">": `>`, ">": `>`, "'": `'`, "'": `'`, """: `"`, """: `"`, " ": ` `, " ": ` `, "©": `\xA9`, "©": `\xA9`, "®": `\xAE`, "®": `\xAE`, "…": `\u2026`, "…": `\u2026`, "/": `/`, "/": `/` };
|
|
1891
|
+
var rr = (e5) => nr[e5];
|
|
1892
|
+
var ir = { bindI18n: `languageChanged`, bindI18nStore: ``, transEmptyNodeValue: ``, transSupportBasicHtmlNodes: true, transWrapTextNodes: ``, transKeepBasicHtmlNodesFor: [`br`, `strong`, `i`, `p`], useSuspense: true, unescape: (e5) => e5.replace(tr, rr), transDefaultProps: void 0 };
|
|
1893
|
+
var ar = (e5 = {}) => {
|
|
1894
|
+
ir = { ...ir, ...e5 };
|
|
1895
|
+
};
|
|
1896
|
+
var or = { type: `3rdParty`, init(e5) {
|
|
1897
|
+
ar(e5.options.react);
|
|
1898
|
+
} };
|
|
1899
|
+
var Y = /* @__PURE__ */ new Map();
|
|
1900
|
+
var sr = 500;
|
|
1901
|
+
var X;
|
|
1902
|
+
function cr() {
|
|
1903
|
+
if (X === void 0) try {
|
|
1904
|
+
X = new Intl.NumberFormat(`en-US`, { useGrouping: false, maximumFractionDigits: 0 }).format(`9007199254740993`) === `9007199254740993`;
|
|
1905
|
+
} catch {
|
|
1906
|
+
X = false;
|
|
1907
|
+
}
|
|
1908
|
+
return X;
|
|
1909
|
+
}
|
|
1910
|
+
var lr = 15;
|
|
1911
|
+
function ur(e5) {
|
|
1912
|
+
if (!(typeof e5 != `string` || cr()) && e5.replace(/[^0-9]/g, ``).replace(/^0+/, ``).length > lr) throw Error(`Cannot format the amount '${e5}' exactly: this runtime's Intl implementation predates ES2023 string support and would lose precision. Use a runtime with ES2023 Intl support (for example Node 20+), or pass a value within 15 significant digits.`);
|
|
1913
|
+
}
|
|
1914
|
+
function dr(e5, t2, n2) {
|
|
1915
|
+
return `${e5}|${t2}|${Object.entries(n2).filter(([, e6]) => e6 !== void 0).sort(([e6], [t3]) => e6 < t3 ? -1 : 1).map(([e6, t3]) => `${e6}=${String(t3)}`).join(`&`)}`;
|
|
1916
|
+
}
|
|
1917
|
+
function fr(e5, t2, n2) {
|
|
1918
|
+
let r2 = dr(e5, t2, n2), i2 = Y.get(r2);
|
|
1919
|
+
return i2 || (i2 = new Intl.NumberFormat(e5, { ...n2, style: `currency`, currency: t2 }), Y.size >= sr && Y.clear(), Y.set(r2, i2)), i2;
|
|
1920
|
+
}
|
|
1921
|
+
function pr(e5, { value: t2, currency: n2 }, r2 = {}) {
|
|
1922
|
+
return ur(t2), fr(e5, n2, r2).format(t2);
|
|
1923
|
+
}
|
|
1924
|
+
function mr(e5, { value: t2, currency: n2 }, r2 = {}) {
|
|
1925
|
+
return ur(t2), fr(e5, n2, r2).formatToParts(t2);
|
|
835
1926
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
1927
|
+
function hr(e5) {
|
|
1928
|
+
return Wt().find((e6) => e6.primary)?.id ?? e5;
|
|
1929
|
+
}
|
|
1930
|
+
function gr(e5, t2) {
|
|
1931
|
+
let { locale: n2, ...r2 } = t2 ?? {}, i2 = n2 ?? e5.essentials?.locale;
|
|
1932
|
+
if (!i2) throw Error(`Host locale is not available on the current host. Make sure to use an updated version of the host initialization package.`);
|
|
1933
|
+
return { locale: i2, formatOptions: r2 };
|
|
1934
|
+
}
|
|
1935
|
+
var _r = pn({ getLanguage: (e5) => () => {
|
|
1936
|
+
let t2 = e5.essentials?.language;
|
|
1937
|
+
if (!t2) throw Error(`Host language is not available on the current host. Make sure to use an updated version of the host initialization package.`);
|
|
1938
|
+
return t2;
|
|
1939
|
+
}, getLocale: (e5) => () => {
|
|
1940
|
+
let t2 = e5.essentials?.locale;
|
|
1941
|
+
if (!t2) throw Error(`Host locale is not available on the current host. Make sure to use an updated version of the host initialization package.`);
|
|
1942
|
+
return t2;
|
|
1943
|
+
}, formatCurrency: (e5) => (t2, n2) => {
|
|
1944
|
+
let { locale: r2, formatOptions: i2 } = gr(e5, n2);
|
|
1945
|
+
return pr(r2, t2, i2);
|
|
1946
|
+
}, formatCurrencyToParts: (e5) => (t2, n2) => {
|
|
1947
|
+
let { locale: r2, formatOptions: i2 } = gr(e5, n2);
|
|
1948
|
+
return mr(r2, t2, i2);
|
|
1949
|
+
}, getTranslationFunction: (e5) => () => {
|
|
1950
|
+
let t2 = e5.translations?.();
|
|
1951
|
+
if (!t2) throw Error(`Host translation resources are not available.`);
|
|
1952
|
+
let n2 = J.createInstance(), r2 = hr(e5.essentials?.language) || `en`, i2 = { lng: e5.essentials?.language || r2, fallbackLng: r2, resources: t2 };
|
|
1953
|
+
return n2.use(or).init(i2, (e6) => {
|
|
1954
|
+
if (e6) throw e6;
|
|
1955
|
+
}), n2.t.bind(n2);
|
|
1956
|
+
} });
|
|
1957
|
+
var vr = class {
|
|
1958
|
+
constructor(e5) {
|
|
1959
|
+
this.message = e5, this.captureException = () => {
|
|
839
1960
|
console.error(this.message);
|
|
840
1961
|
}, this.captureMessage = () => {
|
|
841
1962
|
console.error(this.message);
|
|
842
|
-
}, this.startSpan = (
|
|
1963
|
+
}, this.startSpan = (e6, t2) => (console.error(this.message), t2(void 0)), this.startSpanManual = () => (console.error(this.message), { end: () => {
|
|
843
1964
|
}, fail: () => {
|
|
844
1965
|
} }), this.endSpanManual = () => {
|
|
845
1966
|
console.error(this.message);
|
|
@@ -848,331 +1969,352 @@ var Jt = class {
|
|
|
848
1969
|
};
|
|
849
1970
|
}
|
|
850
1971
|
};
|
|
851
|
-
var
|
|
852
|
-
var
|
|
853
|
-
var
|
|
854
|
-
function
|
|
1972
|
+
var yr = (e5) => new vr(e5);
|
|
1973
|
+
var br = pn({ getMonitoringClient: (e5) => () => e5.getMonitoringClient ? e5.getMonitoringClient() : yr(`Host monitoring client is not available on the current host. Make sure to use an updated version of the host initialization package.`) });
|
|
1974
|
+
var xr = { service: `service`, services: `services`, categories: `categories`, locations: `locations`, sessions: `sessions`, timeSlots: `time-slots`, serviceAddOns: `service-addons`, bookingsSettings: `bookings-settings`, serviceCta: `service-cta`, preferences: `preferences`, bookingSummary: `booking-summary`, bookingCheckout: `booking-checkout`, formValues: `form-values`, paymentOptions: `payment-options`, seo: `seo`, warmup: `warmup`, reschedule: `reschedule` };
|
|
1975
|
+
function Sr(e5) {
|
|
855
1976
|
try {
|
|
856
|
-
let t2 =
|
|
857
|
-
return t2 && typeof t2[
|
|
1977
|
+
let t2 = br.getMonitoringClient?.();
|
|
1978
|
+
return t2 && typeof t2[e5] == `function` ? t2 : null;
|
|
858
1979
|
} catch {
|
|
859
1980
|
return null;
|
|
860
1981
|
}
|
|
861
1982
|
}
|
|
862
|
-
function
|
|
863
|
-
let a2 =
|
|
1983
|
+
function Cr(e5, { feature: t2, action: n2, level: r2 = `error`, contexts: i2 }) {
|
|
1984
|
+
let a2 = Sr(`captureException`);
|
|
864
1985
|
if (!a2) return;
|
|
865
|
-
let o2 =
|
|
1986
|
+
let o2 = e5 instanceof Error ? e5 : Error(String(e5));
|
|
866
1987
|
a2.captureException(o2, { level: r2, tags: { feature: t2, action: n2 }, ...i2 ? { contexts: i2 } : {} });
|
|
867
1988
|
}
|
|
868
|
-
function
|
|
869
|
-
let i2 =
|
|
1989
|
+
function wr(e5, { feature: t2, tags: n2 }, r2) {
|
|
1990
|
+
let i2 = Sr(`startSpanManual`);
|
|
870
1991
|
if (!i2) return r2;
|
|
871
|
-
let a2 = i2.startSpanManual({ name:
|
|
872
|
-
return r2.then(() => a2.end(), (
|
|
1992
|
+
let a2 = i2.startSpanManual({ name: e5, tags: { feature: t2, ...n2 } });
|
|
1993
|
+
return r2.then(() => a2.end(), (e6) => a2.fail(e6)), r2;
|
|
873
1994
|
}
|
|
874
|
-
var
|
|
1995
|
+
var Tr = class extends import_react.Component {
|
|
875
1996
|
state = { hasError: false };
|
|
876
1997
|
static getDerivedStateFromError() {
|
|
877
1998
|
return { hasError: true };
|
|
878
1999
|
}
|
|
879
|
-
componentDidCatch(
|
|
880
|
-
|
|
2000
|
+
componentDidCatch(e5, t2) {
|
|
2001
|
+
Cr(e5, { feature: this.props.feature ?? `service`, action: `render`, contexts: { react: { componentStack: t2.componentStack } } });
|
|
881
2002
|
}
|
|
882
2003
|
render() {
|
|
883
2004
|
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
884
2005
|
}
|
|
885
2006
|
};
|
|
886
|
-
function
|
|
887
|
-
let t2 =
|
|
888
|
-
if (t2.__state || (t2.__state = { status: `pending` }, t2.then((
|
|
889
|
-
t2.__state = { status: `fulfilled`, value:
|
|
890
|
-
}, (
|
|
891
|
-
t2.__state = { status: `rejected`, reason:
|
|
2007
|
+
function Er(e5) {
|
|
2008
|
+
let t2 = e5;
|
|
2009
|
+
if (t2.__state || (t2.__state = { status: `pending` }, t2.then((e6) => {
|
|
2010
|
+
t2.__state = { status: `fulfilled`, value: e6 };
|
|
2011
|
+
}, (e6) => {
|
|
2012
|
+
t2.__state = { status: `rejected`, reason: e6 };
|
|
892
2013
|
})), t2.__state.status === `fulfilled`) return t2.__state.value;
|
|
893
2014
|
throw t2.__state.status === `rejected` ? t2.__state.reason : t2;
|
|
894
2015
|
}
|
|
895
|
-
function
|
|
896
|
-
let t2 = Promise.resolve(
|
|
897
|
-
return t2.__state = { status: `fulfilled`, value:
|
|
2016
|
+
function Dr(e5) {
|
|
2017
|
+
let t2 = Promise.resolve(e5);
|
|
2018
|
+
return t2.__state = { status: `fulfilled`, value: e5 }, t2;
|
|
898
2019
|
}
|
|
899
|
-
var
|
|
900
|
-
function
|
|
901
|
-
let r2 =
|
|
902
|
-
r2 || (r2 = /* @__PURE__ */ new WeakMap(),
|
|
2020
|
+
var Or = /* @__PURE__ */ new WeakMap();
|
|
2021
|
+
function kr(e5, t2, n2) {
|
|
2022
|
+
let r2 = Or.get(e5);
|
|
2023
|
+
r2 || (r2 = /* @__PURE__ */ new WeakMap(), Or.set(e5, r2));
|
|
903
2024
|
let i2 = r2.get(t2);
|
|
904
2025
|
i2 || (i2 = /* @__PURE__ */ new WeakMap(), r2.set(t2, i2));
|
|
905
2026
|
let a2 = i2.get(n2);
|
|
906
2027
|
if (!a2) {
|
|
907
|
-
let r3 =
|
|
908
|
-
a2 = r3.__state?.status === `fulfilled` ?
|
|
2028
|
+
let r3 = e5;
|
|
2029
|
+
a2 = r3.__state?.status === `fulfilled` ? Dr(t2(r3.__state.value)) : r3.__state?.status === `rejected` ? Dr(n2(r3.__state.reason)) : e5.then(t2, n2), i2.set(n2, a2);
|
|
909
2030
|
}
|
|
910
2031
|
return a2;
|
|
911
2032
|
}
|
|
912
|
-
function
|
|
913
|
-
return
|
|
914
|
-
}
|
|
915
|
-
var
|
|
916
|
-
var
|
|
917
|
-
function
|
|
918
|
-
let t2 =
|
|
919
|
-
if (t2 === null) return
|
|
920
|
-
let n2 = new URL(
|
|
921
|
-
n2.searchParams.delete(
|
|
922
|
-
for (let [
|
|
2033
|
+
function Z(e5) {
|
|
2034
|
+
return e5;
|
|
2035
|
+
}
|
|
2036
|
+
var Ar = Z(`@wix/site-service-url`);
|
|
2037
|
+
var jr = `appSectionParams`;
|
|
2038
|
+
function Mr(e5) {
|
|
2039
|
+
let t2 = e5.searchParams.get(jr);
|
|
2040
|
+
if (t2 === null) return e5;
|
|
2041
|
+
let n2 = new URL(e5);
|
|
2042
|
+
n2.searchParams.delete(jr);
|
|
2043
|
+
for (let [e6, r2] of Object.entries(Nr(t2))) typeof r2 == `string` && !n2.searchParams.has(e6) && n2.searchParams.set(e6, r2);
|
|
923
2044
|
return n2;
|
|
924
2045
|
}
|
|
925
|
-
function
|
|
2046
|
+
function Nr(e5) {
|
|
926
2047
|
try {
|
|
927
|
-
let t2 = JSON.parse(
|
|
2048
|
+
let t2 = JSON.parse(e5);
|
|
928
2049
|
return t2 && typeof t2 == `object` && !Array.isArray(t2) ? t2 : {};
|
|
929
2050
|
} catch {
|
|
930
2051
|
return {};
|
|
931
2052
|
}
|
|
932
2053
|
}
|
|
933
|
-
var
|
|
934
|
-
var
|
|
935
|
-
let t2 = new URL(
|
|
2054
|
+
var Pr = `bookings-uou:url-change`;
|
|
2055
|
+
var Fr = (e5) => {
|
|
2056
|
+
let t2 = new URL(e5);
|
|
936
2057
|
return t2.searchParams.sort(), t2.href;
|
|
937
2058
|
};
|
|
938
|
-
function
|
|
2059
|
+
function Ir(e5, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
|
|
939
2060
|
let r2 = globalThis.window;
|
|
940
2061
|
if (!r2?.history) return;
|
|
941
2062
|
let i2 = new URL(r2.location.href);
|
|
942
|
-
if (
|
|
2063
|
+
if (Fr(i2) === Fr(e5)) return;
|
|
943
2064
|
let a2 = { scrollY: r2.scrollY };
|
|
944
|
-
if (n2) r2.history.replaceState(a2, ``,
|
|
2065
|
+
if (n2) r2.history.replaceState(a2, ``, e5.href);
|
|
945
2066
|
else {
|
|
946
2067
|
r2.history.replaceState(a2, ``, i2.href);
|
|
947
2068
|
try {
|
|
948
|
-
r2.history.pushState(t2 ? a2 : null, ``,
|
|
2069
|
+
r2.history.pushState(t2 ? a2 : null, ``, e5.href);
|
|
949
2070
|
} catch {
|
|
950
2071
|
return;
|
|
951
2072
|
}
|
|
952
2073
|
}
|
|
953
|
-
r2.dispatchEvent(new Event(
|
|
2074
|
+
r2.dispatchEvent(new Event(Pr));
|
|
954
2075
|
}
|
|
955
|
-
function
|
|
2076
|
+
function Lr(e5) {
|
|
956
2077
|
let t2 = globalThis.window;
|
|
957
|
-
return t2 ? (t2.addEventListener(
|
|
958
|
-
t2.removeEventListener(
|
|
2078
|
+
return t2 ? (t2.addEventListener(Pr, e5), t2.addEventListener(`popstate`, e5), () => {
|
|
2079
|
+
t2.removeEventListener(Pr, e5), t2.removeEventListener(`popstate`, e5);
|
|
959
2080
|
}) : () => {
|
|
960
2081
|
};
|
|
961
2082
|
}
|
|
962
|
-
var
|
|
2083
|
+
var Rr = (e5) => {
|
|
963
2084
|
try {
|
|
964
|
-
return decodeURIComponent(
|
|
2085
|
+
return decodeURIComponent(e5);
|
|
965
2086
|
} catch {
|
|
966
|
-
return
|
|
2087
|
+
return e5;
|
|
967
2088
|
}
|
|
968
2089
|
};
|
|
969
|
-
function
|
|
2090
|
+
function zr(e5, t2) {
|
|
970
2091
|
let n2 = t2 ? new URL(t2).pathname : `/`;
|
|
971
|
-
return `./${
|
|
2092
|
+
return `./${Rr(new URL(e5).pathname.replace(n2, ``).replace(/^\/|\/$/g, ``))}`;
|
|
972
2093
|
}
|
|
973
|
-
function
|
|
974
|
-
let
|
|
975
|
-
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () =>
|
|
2094
|
+
function Br() {
|
|
2095
|
+
let e5 = (0, import_services_manager_react.useService)(Ar), t2 = (0, import_react.useCallback)(() => e5.currentUrl, [e5]), n2 = (0, import_react.useSyncExternalStore)(Lr, t2, t2), i2 = (0, import_react.useMemo)(() => Mr(new URL(n2)), [n2]), a2 = e5.siteUrl.replace(/\/$/, ``);
|
|
2096
|
+
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () => Mr(new URL(e5.currentUrl)), getRelativeUrl: () => zr(e5.currentUrl, a2), getExternalBaseUrl: () => a2, pushUrl: Ir };
|
|
976
2097
|
}
|
|
977
|
-
var
|
|
978
|
-
var
|
|
979
|
-
function
|
|
2098
|
+
var Q = { category: `category`, location: `location`, page: `page`, blob: `b`, resource: `resource`, referral: `referral`, timezone: `timezone`, bookingId: `bookingId`, token: `token`, rescheduleRedirectUrl: `rescheduleRedirectUrl` };
|
|
2099
|
+
var Vr = Z(`@wix/site-service-warmup-data`);
|
|
2100
|
+
function Hr() {
|
|
980
2101
|
try {
|
|
981
2102
|
return (0, import_services_manager_react.useGetService)();
|
|
982
2103
|
} catch {
|
|
983
2104
|
return null;
|
|
984
2105
|
}
|
|
985
2106
|
}
|
|
986
|
-
function
|
|
2107
|
+
function Ur(e5) {
|
|
987
2108
|
try {
|
|
988
|
-
return
|
|
2109
|
+
return e5 ? e5(Vr) : null;
|
|
989
2110
|
} catch {
|
|
990
2111
|
return null;
|
|
991
2112
|
}
|
|
992
2113
|
}
|
|
993
|
-
function
|
|
994
|
-
let
|
|
995
|
-
return { scope:
|
|
996
|
-
if (t2 || !
|
|
2114
|
+
function Wr() {
|
|
2115
|
+
let e5 = Ur(Hr()), t2 = typeof window > `u`;
|
|
2116
|
+
return { scope: e5 ?? void 0, get: async (n2) => {
|
|
2117
|
+
if (t2 || !e5) return null;
|
|
997
2118
|
try {
|
|
998
|
-
return await
|
|
999
|
-
} catch (
|
|
1000
|
-
return
|
|
2119
|
+
return await e5.get(n2);
|
|
2120
|
+
} catch (e6) {
|
|
2121
|
+
return Cr(e6, { feature: xr.warmup, action: `read`, level: `warning`, contexts: { warmup: { key: n2 } } }), null;
|
|
1001
2122
|
}
|
|
1002
2123
|
}, set: (n2, r2) => {
|
|
1003
|
-
if (t2 &&
|
|
1004
|
-
|
|
2124
|
+
if (t2 && e5) try {
|
|
2125
|
+
e5.set(n2, r2);
|
|
1005
2126
|
} catch {
|
|
1006
2127
|
}
|
|
1007
2128
|
} };
|
|
1008
2129
|
}
|
|
1009
|
-
var
|
|
1010
|
-
|
|
1011
|
-
|
|
2130
|
+
var Gr = Z(`@wix/site-service-locale`);
|
|
2131
|
+
var Kr = Z;
|
|
2132
|
+
var qr = Kr(`@wix/viewer-service-multilingual`);
|
|
2133
|
+
function Jr() {
|
|
2134
|
+
try {
|
|
2135
|
+
return _r.getLanguage() ?? `en`;
|
|
2136
|
+
} catch {
|
|
2137
|
+
return `en`;
|
|
2138
|
+
}
|
|
1012
2139
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
2140
|
+
function Yr(e5) {
|
|
2141
|
+
try {
|
|
2142
|
+
return (0, import_services_manager_react.useService)(e5);
|
|
2143
|
+
} catch {
|
|
2144
|
+
return null;
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
function Xr() {
|
|
2148
|
+
let e5 = Yr(Gr), t2 = Yr(qr);
|
|
2149
|
+
return t2?.multilingualEnabled && t2.currentLocale?.languageCode || e5?.language || Jr();
|
|
2150
|
+
}
|
|
2151
|
+
var Zr = `bookings-uou`;
|
|
2152
|
+
function Qr(e5) {
|
|
2153
|
+
return `${Zr}:${e5}:categories:all`;
|
|
2154
|
+
}
|
|
2155
|
+
var $r = 5e3;
|
|
2156
|
+
var ei = 100;
|
|
2157
|
+
var ti = `wix-warmup-data`;
|
|
2158
|
+
var ni = null;
|
|
2159
|
+
function ri(e5) {
|
|
1018
2160
|
if (typeof document < `u`) try {
|
|
1019
|
-
let t2 = document.getElementById(
|
|
1020
|
-
return t2 ? (
|
|
2161
|
+
let t2 = document.getElementById(ti)?.textContent;
|
|
2162
|
+
return t2 ? (ni?.text !== t2 && (ni = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), ni.data[e5] ?? void 0) : void 0;
|
|
1021
2163
|
} catch {
|
|
1022
2164
|
return;
|
|
1023
2165
|
}
|
|
1024
2166
|
}
|
|
1025
|
-
var
|
|
1026
|
-
var
|
|
1027
|
-
var
|
|
1028
|
-
var
|
|
1029
|
-
function
|
|
1030
|
-
if (!
|
|
1031
|
-
let t2 =
|
|
1032
|
-
return t2 || (t2 =
|
|
1033
|
-
}
|
|
1034
|
-
function
|
|
1035
|
-
if (
|
|
2167
|
+
var ii = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
|
|
2168
|
+
var ai = ii();
|
|
2169
|
+
var oi = /* @__PURE__ */ new WeakMap();
|
|
2170
|
+
var si = /* @__PURE__ */ new WeakMap();
|
|
2171
|
+
function ci(e5) {
|
|
2172
|
+
if (!e5) return ai;
|
|
2173
|
+
let t2 = oi.get(e5);
|
|
2174
|
+
return t2 || (t2 = ii(), oi.set(e5, t2)), t2;
|
|
2175
|
+
}
|
|
2176
|
+
function li({ key: e5, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
2177
|
+
if (e5 === null) return n2();
|
|
1036
2178
|
if (typeof window > `u`) {
|
|
1037
|
-
let r3 = () => n2().then((n3) => (t2.set(
|
|
2179
|
+
let r3 = () => n2().then((n3) => (t2.set(e5, n3), n3)), { scope: i3 } = t2;
|
|
1038
2180
|
if (!i3) return r3();
|
|
1039
|
-
let a3 =
|
|
1040
|
-
a3 || (a3 = /* @__PURE__ */ new Map(),
|
|
1041
|
-
let o3 = a3.get(
|
|
2181
|
+
let a3 = si.get(i3);
|
|
2182
|
+
a3 || (a3 = /* @__PURE__ */ new Map(), si.set(i3, a3));
|
|
2183
|
+
let o3 = a3.get(e5);
|
|
1042
2184
|
if (o3) return o3;
|
|
1043
2185
|
let s3 = r3();
|
|
1044
|
-
return a3.set(
|
|
2186
|
+
return a3.set(e5, s3), s3.catch(() => a3.delete(e5)), s3;
|
|
1045
2187
|
}
|
|
1046
|
-
let i2 =
|
|
1047
|
-
for (let [
|
|
1048
|
-
let o2 = i2.promises.get(
|
|
2188
|
+
let i2 = ci(t2.scope), a2 = Date.now();
|
|
2189
|
+
for (let [e6, t3] of i2.promises) t3.expiresAt <= a2 && i2.promises.delete(e6);
|
|
2190
|
+
let o2 = i2.promises.get(e5);
|
|
1049
2191
|
if (o2 && !r2) return o2.promise;
|
|
1050
|
-
r2 && i2.invalidatedWarmup.add(
|
|
1051
|
-
let s2 = !i2.invalidatedWarmup.has(
|
|
2192
|
+
r2 && i2.invalidatedWarmup.add(e5);
|
|
2193
|
+
let s2 = !i2.invalidatedWarmup.has(e5);
|
|
1052
2194
|
if (s2) {
|
|
1053
|
-
let t3 =
|
|
2195
|
+
let t3 = ri(e5);
|
|
1054
2196
|
if (t3 !== void 0) {
|
|
1055
|
-
let n3 =
|
|
1056
|
-
return i2.promises.set(
|
|
2197
|
+
let n3 = Dr(t3);
|
|
2198
|
+
return i2.promises.set(e5, { promise: n3, expiresAt: a2 + $r }), n3;
|
|
1057
2199
|
}
|
|
1058
2200
|
}
|
|
1059
2201
|
let c2 = (async () => {
|
|
1060
2202
|
if (s2) {
|
|
1061
|
-
let n3 = await t2.get(
|
|
2203
|
+
let n3 = await t2.get(e5);
|
|
1062
2204
|
if (n3 != null) return n3;
|
|
1063
2205
|
}
|
|
1064
2206
|
return n2();
|
|
1065
2207
|
})();
|
|
1066
|
-
i2.promises.size >=
|
|
2208
|
+
i2.promises.size >= ei && i2.promises.delete(i2.promises.keys().next().value);
|
|
1067
2209
|
let l2 = { promise: c2, expiresAt: 1 / 0 };
|
|
1068
|
-
return i2.promises.set(
|
|
1069
|
-
l2.expiresAt = Date.now() +
|
|
2210
|
+
return i2.promises.set(e5, l2), c2.then(() => {
|
|
2211
|
+
l2.expiresAt = Date.now() + $r;
|
|
1070
2212
|
}, () => {
|
|
1071
|
-
i2.promises.get(
|
|
2213
|
+
i2.promises.get(e5) === l2 && i2.promises.delete(e5);
|
|
1072
2214
|
}), c2;
|
|
1073
2215
|
}
|
|
1074
|
-
function
|
|
1075
|
-
return
|
|
2216
|
+
function ui(e5) {
|
|
2217
|
+
return ht(Object.assign(e5, { domainToMappings: { "*.dev.wix-code.com": [{ srcPath: `/_api/services-2`, destPath: `` }, { srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "www.wixapis.com": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }, { srcPath: `/bookings/services/v2/bulk/services`, destPath: `/v2/bulk/services` }], "manage._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/_api/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }], "editor._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/_api/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }], "blocks._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/_api/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }], "create.editorx": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/_api/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }], _: [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "www._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "bo._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "wixbo.ai": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "wix-bo.com": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "editor.wixapps.net": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "api._api_base_domain_": [{ srcPath: `/services-2`, destPath: `` }] } }));
|
|
1076
2218
|
}
|
|
1077
|
-
var
|
|
1078
|
-
function
|
|
2219
|
+
var di = `@wix/auto_sdk_bookings_services`;
|
|
2220
|
+
function fi(e5) {
|
|
1079
2221
|
function t2({ host: t3 }) {
|
|
1080
|
-
return { entityFqdn: `wix.bookings.services.v2.service`, method: `POST`, methodFqn: `wix.bookings.services.v2.ServicesService.QueryCategories`, packageName:
|
|
2222
|
+
return { entityFqdn: `wix.bookings.services.v2.service`, method: `POST`, methodFqn: `wix.bookings.services.v2.ServicesService.QueryCategories`, packageName: di, migrationOptions: { optInTransformResponse: true }, url: ui({ protoPath: `/v2/services/categories/query`, data: e5, host: t3 }), data: e5 };
|
|
1081
2223
|
}
|
|
1082
2224
|
return t2;
|
|
1083
2225
|
}
|
|
1084
|
-
async function
|
|
1085
|
-
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 =
|
|
2226
|
+
async function pi(e5) {
|
|
2227
|
+
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = fi(Je({ filter: e5?.filter }));
|
|
1086
2228
|
n2?.onSiteCall?.();
|
|
1087
2229
|
try {
|
|
1088
|
-
let
|
|
1089
|
-
return n2?.onSuccess?.(
|
|
1090
|
-
} catch (
|
|
1091
|
-
let t3 =
|
|
1092
|
-
throw n2?.onError?.(
|
|
2230
|
+
let e6 = await t2.request(r2);
|
|
2231
|
+
return n2?.onSuccess?.(e6), Ye(e6.data);
|
|
2232
|
+
} catch (e6) {
|
|
2233
|
+
let t3 = at(e6, { spreadPathsToArguments: {}, explicitPathsToArguments: { filter: `$[0].filter` }, singleArgumentUnchanged: false }, [`options`]);
|
|
2234
|
+
throw n2?.onError?.(e6), t3;
|
|
1093
2235
|
}
|
|
1094
2236
|
}
|
|
1095
|
-
function
|
|
1096
|
-
return (t2) =>
|
|
2237
|
+
function mi(e5) {
|
|
2238
|
+
return (t2) => pi(t2, { httpClient: e5 });
|
|
1097
2239
|
}
|
|
1098
|
-
var
|
|
1099
|
-
async function
|
|
1100
|
-
return [...(await
|
|
2240
|
+
var hi = mt(mi);
|
|
2241
|
+
async function gi() {
|
|
2242
|
+
return [...(await hi({ filter: { services: {} } })).categories ?? []].sort((e5, t2) => (e5.sortOrder ?? 0) - (t2.sortOrder ?? 0));
|
|
1101
2243
|
}
|
|
1102
|
-
function
|
|
1103
|
-
let { searchParams: i2 } =
|
|
2244
|
+
function _i({ isLoading: e5, hasError: t2, refetch: n2, children: r2 }) {
|
|
2245
|
+
let { searchParams: i2 } = Br(), a2 = { categories: [], categoryItems: [], selectedCategoryId: i2.get(Q.category), selectedCategoryIndex: -1, selectedCategory: null, selectedCategoryName: null, hasMultipleCategories: false, isLoading: e5, hasError: t2, refetch: n2, selectCategory: () => {
|
|
1104
2246
|
} };
|
|
1105
2247
|
return (0, import_jsx_runtime.jsx)($.Provider, { value: a2, children: r2 });
|
|
1106
2248
|
}
|
|
1107
|
-
function
|
|
1108
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2249
|
+
function vi({ refetch: e5, children: t2 }) {
|
|
2250
|
+
return (0, import_jsx_runtime.jsx)(_i, { isLoading: true, hasError: false, refetch: e5, children: t2 });
|
|
1109
2251
|
}
|
|
1110
|
-
function
|
|
1111
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2252
|
+
function yi({ refetch: e5, children: t2 }) {
|
|
2253
|
+
return (0, import_jsx_runtime.jsx)(_i, { isLoading: false, hasError: true, refetch: e5, children: t2 });
|
|
1112
2254
|
}
|
|
1113
|
-
function
|
|
1114
|
-
let t2 =
|
|
1115
|
-
return [...new Set(t2.filter((
|
|
2255
|
+
function bi(e5) {
|
|
2256
|
+
let t2 = e5?.$in ?? (e5?.$eq == null ? [] : [e5.$eq]);
|
|
2257
|
+
return [...new Set(t2.filter((e6) => typeof e6 == `string` && e6 !== ``))].sort().join(`,`);
|
|
1116
2258
|
}
|
|
1117
|
-
function
|
|
1118
|
-
return
|
|
2259
|
+
function xi(e5) {
|
|
2260
|
+
return e5 ? e5.split(`,`) : null;
|
|
1119
2261
|
}
|
|
1120
|
-
var
|
|
1121
|
-
function
|
|
1122
|
-
return { evid: 32, src: 16, endpoint: ``, params:
|
|
2262
|
+
var Si = Kr(`@wix/site-service-business-logger`);
|
|
2263
|
+
function Ci(e5) {
|
|
2264
|
+
return { evid: 32, src: 16, endpoint: ``, params: e5 };
|
|
1123
2265
|
}
|
|
1124
|
-
var
|
|
1125
|
-
return
|
|
2266
|
+
var wi = function(e5) {
|
|
2267
|
+
return e5.BOOK_ONLINE = `bookingsBookOnline`, e5.SERVICE_PAGE = `bookingsServicePage`, e5.CALENDAR_PAGE = `bookingsCalendar`, e5.FORM_PAGE = `bookingsForm`, e5;
|
|
1126
2268
|
}({});
|
|
1127
|
-
var
|
|
1128
|
-
|
|
1129
|
-
var
|
|
1130
|
-
var
|
|
1131
|
-
let { reportBi: t2 } = (0, import_services_manager_react.useService)(
|
|
2269
|
+
var Ti = { SERVICES: `services_context`, SERVICE: `service_context`, TIME_SLOTS: `time_slots_context`, BOOKING_CHECKOUT: `booking_checkout_context`, CATEGORIES: `categories_context`, LOCATIONS: `locations_context`, SERVICE_ADD_ONS: `service_addons_context`, PREFERENCES: `preferences_context` };
|
|
2270
|
+
wi.BOOK_ONLINE;
|
|
2271
|
+
var Ei = `new_bookings_server`;
|
|
2272
|
+
var Di = (e5) => {
|
|
2273
|
+
let { reportBi: t2 } = (0, import_services_manager_react.useService)(Si);
|
|
1132
2274
|
return (0, import_react.useCallback)((n2) => {
|
|
1133
|
-
t2({ widget_name:
|
|
1134
|
-
}, [t2,
|
|
2275
|
+
t2({ widget_name: e5, bookingsPlatform: Ei, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
|
|
2276
|
+
}, [t2, e5]);
|
|
1135
2277
|
};
|
|
1136
|
-
var
|
|
1137
|
-
let n2 =
|
|
2278
|
+
var Oi = (e5, t2 = true) => {
|
|
2279
|
+
let n2 = Di(e5), { getParsedUrl: r2 } = Br(), i2 = (0, import_react.useRef)(false);
|
|
1138
2280
|
(0, import_react.useEffect)(() => {
|
|
1139
|
-
t2 && !i2.current && (i2.current = true, n2(
|
|
2281
|
+
t2 && !i2.current && (i2.current = true, n2(Ci({ referralInfo: r2().searchParams.get(Q.referral) ?? void 0 })));
|
|
1140
2282
|
}, [t2, n2, r2]);
|
|
1141
2283
|
};
|
|
1142
2284
|
var $ = (0, import_react.createContext)(null);
|
|
1143
|
-
var
|
|
1144
|
-
function
|
|
1145
|
-
let
|
|
1146
|
-
if (!
|
|
1147
|
-
return
|
|
1148
|
-
}
|
|
1149
|
-
function
|
|
1150
|
-
return { categoryId:
|
|
1151
|
-
}
|
|
1152
|
-
var
|
|
1153
|
-
var
|
|
1154
|
-
function
|
|
1155
|
-
let { categories: l2, hasError: u2 } =
|
|
1156
|
-
let
|
|
1157
|
-
return
|
|
1158
|
-
}, [l2, n2]), { pathname: p2, searchParams: m2, pushUrl: h2, getExternalBaseUrl: g2 } =
|
|
2285
|
+
var ki = `useCategoriesContext must be used within CategoriesContextProvider`;
|
|
2286
|
+
function Ai() {
|
|
2287
|
+
let e5 = (0, import_react.useContext)($);
|
|
2288
|
+
if (!e5) throw Error(ki);
|
|
2289
|
+
return e5;
|
|
2290
|
+
}
|
|
2291
|
+
function ji(e5, t2) {
|
|
2292
|
+
return { categoryId: e5._id ?? null, categoryName: e5.name ?? null, isSelected: e5._id != null && e5._id === t2 };
|
|
2293
|
+
}
|
|
2294
|
+
var Mi = (e5) => ({ categories: e5, hasError: false });
|
|
2295
|
+
var Ni = () => ({ categories: [], hasError: true });
|
|
2296
|
+
function Pi({ categoriesPromise: e5, initialCategoryId: t2, categoryIdsKey: n2, refetch: i2, children: c2 }) {
|
|
2297
|
+
let { categories: l2, hasError: u2 } = Er(e5), d2 = (0, import_react.useMemo)(() => {
|
|
2298
|
+
let e6 = xi(n2);
|
|
2299
|
+
return e6 ? l2.filter((t3) => t3._id && e6.includes(t3._id)) : l2;
|
|
2300
|
+
}, [l2, n2]), { pathname: p2, searchParams: m2, pushUrl: h2, getExternalBaseUrl: g2 } = Br(), _2 = m2.get(Q.category), v2 = (0, import_react.useCallback)((e6) => {
|
|
1159
2301
|
let t3 = new URLSearchParams(m2);
|
|
1160
|
-
|
|
2302
|
+
e6 ? t3.set(Q.category, e6) : t3.delete(Q.category), t3.delete(Q.page);
|
|
1161
2303
|
let n3 = t3.toString(), r2 = n3 ? `${p2}?${n3}` : p2;
|
|
1162
2304
|
h2(new URL(r2, `${g2()}/`), { disableScrollToTop: true, skipHistory: false });
|
|
1163
2305
|
}, [p2, m2, h2, g2]), y2 = (0, import_react.useRef)(false);
|
|
1164
2306
|
(0, import_react.useEffect)(() => {
|
|
1165
|
-
y2.current || (y2.current = true, t2 && !m2.get(
|
|
2307
|
+
y2.current || (y2.current = true, t2 && !m2.get(Q.category) && v2(t2));
|
|
1166
2308
|
}, [t2, m2, v2]);
|
|
1167
|
-
let b2 = d2.findIndex((
|
|
1168
|
-
return (0, import_jsx_runtime.jsx)($.Provider, { value:
|
|
2309
|
+
let b2 = d2.findIndex((e6) => e6._id === _2), x2 = d2.find((e6) => e6._id === _2) ?? null, S2 = d2.filter((e6) => e6._id).length > 1, ee2 = (0, import_react.useMemo)(() => ({ categories: d2, categoryItems: d2.map((e6) => ji(e6, _2)), selectedCategoryId: _2, selectedCategoryIndex: b2, selectedCategory: x2, selectedCategoryName: x2?.name ?? null, hasMultipleCategories: S2, isLoading: false, hasError: u2, refetch: i2, selectCategory: v2 }), [d2, _2, b2, x2, S2, u2, i2, v2]);
|
|
2310
|
+
return (0, import_jsx_runtime.jsx)($.Provider, { value: ee2, children: c2 });
|
|
1169
2311
|
}
|
|
1170
|
-
function
|
|
1171
|
-
|
|
1172
|
-
let s2 =
|
|
1173
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2312
|
+
function Fi({ initialCategoryId: e5, categoriesPicker: n2, refreshSignal: i2 = 0, children: a2 }) {
|
|
2313
|
+
Oi(Ti.CATEGORIES);
|
|
2314
|
+
let s2 = Wr(), l2 = Xr(), u2 = bi(n2?.categoryId), [d2, p2] = (0, import_react.useState)(0), m2 = (0, import_react.useMemo)(() => kr(li({ key: Qr(l2), refresh: d2 !== 0 || i2 !== 0, warmupData: s2, fetchData: () => wr(`categories-context-load`, { feature: xr.categories }, gi()) }), Mi, Ni), [d2, i2, l2]), h2 = (0, import_react.useCallback)(() => p2((e6) => e6 + 1), []);
|
|
2315
|
+
return (0, import_jsx_runtime.jsx)(Tr, { fallback: (0, import_jsx_runtime.jsx)(yi, { refetch: h2, children: a2 }), feature: xr.categories, children: (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(vi, { refetch: h2, children: a2 }), children: (0, import_jsx_runtime.jsx)(Pi, { categoriesPromise: m2, initialCategoryId: e5, categoryIdsKey: u2, refetch: h2, children: a2 }) }) });
|
|
1174
2316
|
}
|
|
1175
|
-
var
|
|
2317
|
+
var Ii = un(`73a358c8-c2c8-4342-bf64-9079e92178fc`);
|
|
1176
2318
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1177
2319
|
0 && (module.exports = {
|
|
1178
2320
|
CATEGORIES_CONTEXT_MISSING_PROVIDER_ERROR,
|