@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,11 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// context-service-addons.ts
|
|
21
21
|
var context_service_addons_exports = {};
|
|
22
22
|
__export(context_service_addons_exports, {
|
|
23
|
-
ServiceAddOnsContextProvider: () =>
|
|
24
|
-
default: () =>
|
|
25
|
-
injectAccessTokenGetter: () =>
|
|
23
|
+
ServiceAddOnsContextProvider: () => ha,
|
|
24
|
+
default: () => ha,
|
|
25
|
+
injectAccessTokenGetter: () => ga,
|
|
26
26
|
serviceAddOnsContext: () => $,
|
|
27
|
-
useServiceAddOnsContext: () =>
|
|
27
|
+
useServiceAddOnsContext: () => pa
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(context_service_addons_exports);
|
|
30
30
|
|
|
@@ -34,11 +34,11 @@ var import_service = require("@wix/bookings/context/service");
|
|
|
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,186 +61,186 @@ 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
|
-
var
|
|
87
|
-
var
|
|
86
|
+
var y = `edge.wixapis.com`;
|
|
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
|
|
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
|
|
99
|
-
var
|
|
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 ee = (e5) => e5?.method && [`post`, `put`, `patch`].includes(e5.method.toLocaleLowerCase()) && e5.body ? { "Content-Type": `application/json` } : {};
|
|
100
|
+
var te = (e5) => e5 && typeof e5 == `object` && !Array.isArray(e5);
|
|
101
|
+
var ne = (e5) => e5.__type === `host`;
|
|
102
|
+
function S(e5, t2) {
|
|
103
|
+
return e5.create(t2);
|
|
104
104
|
}
|
|
105
|
-
var
|
|
106
|
-
function
|
|
107
|
-
return { [
|
|
105
|
+
var C = `x-wix-bi-gateway`;
|
|
106
|
+
function re(e5, t2, n2) {
|
|
107
|
+
return { [C]: ie({ 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 ie(e5) {
|
|
110
|
+
return Object.entries(e5).filter(([e6, t2]) => !!t2).map(([e6, t2]) => `${e6}=${t2}`).join(`,`);
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function ae(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 oe = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
122
|
+
function se(e5) {
|
|
123
|
+
return fe(e5).map((e6) => e6.toLocaleUpperCase()).join(`_`);
|
|
124
|
+
}
|
|
125
|
+
var ce = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
126
|
+
var le = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
127
|
+
var ue = `$1\0$2`;
|
|
128
|
+
var de = /[^\p{L}\d]+/giu;
|
|
129
|
+
function fe(e5) {
|
|
130
|
+
let t2 = e5.trim();
|
|
131
|
+
t2 = t2.replace(ce, ue).replace(le, ue), t2 = t2.replace(de, `\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 pe = (e5) => `validationError` in (e5.response?.data?.details ?? {});
|
|
139
|
+
var me = (e5) => `applicationError` in (e5.response?.data?.details ?? {});
|
|
140
|
+
var he = (e5) => (e5.response?.status ?? -1) >= 400 && (e5.response?.status ?? -1) < 500;
|
|
141
|
+
function ge(e5, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
142
|
+
if (typeof e5 != `object` || !e5) throw e5;
|
|
143
|
+
if (pe(e5)) return _e(e5, t2, n2);
|
|
144
|
+
if (me(e5)) return ve(e5);
|
|
145
|
+
if (he(e5)) {
|
|
146
|
+
let t3 = e5.response?.status, n3 = e5.response?.statusText ?? `UNKNOWN`, r2 = e5.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: se(n3), data: {} }, requestId: e5.requestId };
|
|
147
|
+
return w(e5, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
148
|
+
}
|
|
149
|
+
return ye(e5);
|
|
150
|
+
}
|
|
151
|
+
var _e = (e5, t2, n2) => {
|
|
152
|
+
let r2 = e5.response?.data, i2 = e5.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = be(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 w(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 w = (e5, { message: t2, extraProperties: n2 }) => Object.assign(e5, { ...n2, message: t2 });
|
|
156
|
+
var ve = (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 ?? se(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 w(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 ye = (e5) => w(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: se(e5.response?.statusText ?? `UNKNOWN`), ...!e5.response && { runtimeError: e5 } } });
|
|
161
|
+
var be = ({ 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: xe(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, xe(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 xe = (e5, t2) => {
|
|
175
|
+
let n2 = Se(e5);
|
|
176
|
+
return n2 == null ? e5 : e5.replace(`$[${n2}]`, t2[n2]);
|
|
177
177
|
};
|
|
178
|
-
var
|
|
179
|
-
let t2 =
|
|
178
|
+
var Se = (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 Ce(e5, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
183
|
+
return ae(() => 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
|
-
let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ?
|
|
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 = re(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 = Te(s3.status, e8?.message ?? s3.statusText, e8?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e8 }), n3 = ge(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 we = 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 Te = (e5, t2, n2, r2) => new we({ response: { data: { details: { ...!n2?.validationError && { applicationError: { description: t2, code: e5, data: r2 } }, ...n2 }, message: t2 }, status: e5 }, requestId: r2?.requestId });
|
|
214
|
+
var Ee = `.`;
|
|
215
|
+
function De(e5, t2, n2) {
|
|
216
|
+
if (e5 == null) throw Error(`Cannot set value on null or undefined`);
|
|
217
|
+
let r2 = Oe(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 Oe(e5) {
|
|
230
|
+
return Array.isArray(e5) ? e5 : e5.split(Ee).map((e6) => ke(e6) ? Number(e6) : e6);
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
return /^\d+$/.test(
|
|
232
|
+
function ke(e5) {
|
|
233
|
+
return /^\d+$/.test(e5);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function Ae(e5) {
|
|
236
236
|
let t2 = {};
|
|
237
|
-
for (let [n2, r2] of Object.entries(
|
|
237
|
+
for (let [n2, r2] of Object.entries(e5)) je(n2) || De(t2, Oe(n2), r2);
|
|
238
238
|
return t2;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
return
|
|
240
|
+
function je(e5) {
|
|
241
|
+
return e5 === `__proto__` || e5 === `constructor` || e5 === `prototype`;
|
|
242
242
|
}
|
|
243
|
-
var
|
|
243
|
+
var Me = class {
|
|
244
244
|
BRACKET_PATTERN = /\[(\d+)\]/g;
|
|
245
245
|
NUMERIC_PATTERN = /^\d+$/;
|
|
246
246
|
ESCAPED_DOT_PATTERN = /\\\./g;
|
|
@@ -253,702 +253,1823 @@ var Pe = 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])), Ae(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 oe ? oe[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 =
|
|
291
|
+
let a3 = Ie(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
|
|
323
|
-
let n2 =
|
|
322
|
+
function Ne(e5, t2) {
|
|
323
|
+
let n2 = e5?.modifiedFields;
|
|
324
324
|
if (!n2) return null;
|
|
325
|
-
let r2 =
|
|
325
|
+
let r2 = Pe(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
|
-
let c2 =
|
|
331
|
+
let c2 = Fe(s2, a2);
|
|
332
332
|
return c2 === null ? null : (o2.modifiedFields = c2, o2);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
if (typeof
|
|
336
|
-
let t2 = new
|
|
334
|
+
function Pe(e5) {
|
|
335
|
+
if (typeof e5 == `object` && e5 && !Array.isArray(e5)) try {
|
|
336
|
+
let t2 = new Me(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
|
|
344
|
-
if (typeof
|
|
345
|
-
return t2.flatten(
|
|
343
|
+
function Fe(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
|
|
352
|
-
return
|
|
351
|
+
function Ie(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 Le() {
|
|
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 Re = (e5) => e5.__type === `event-definition`;
|
|
364
|
+
function ze(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 = Ne(s2, a2);
|
|
376
|
+
if (e7) return t2(e7);
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
return t2(a2(o2));
|
|
380
380
|
}
|
|
381
|
-
function Be(
|
|
382
|
-
let t2 = /* @__PURE__ */ new Map(), n2 =
|
|
383
|
-
return { initModule(
|
|
381
|
+
function Be(e5) {
|
|
382
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = Le();
|
|
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 }) => ze(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 }) => ze(t3, n4, e6.payload, { instanceId: e6.instanceId, identity: e6.identity })));
|
|
412
412
|
}, apps: { AppInstalled: m(`AppInstalled`)(), AppRemoved: m(`AppRemoved`)() } } };
|
|
413
413
|
}
|
|
414
|
-
var Ve = (
|
|
415
|
-
function He(
|
|
416
|
-
let t2 = /* @__PURE__ */ new Map(), n2 =
|
|
417
|
-
return { initModule(
|
|
414
|
+
var Ve = (e5) => e5.__type === `service-plugin-definition`;
|
|
415
|
+
function He(e5) {
|
|
416
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = Le();
|
|
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
457
|
var T = `X-Wix-Consistent`;
|
|
458
|
-
function Ue(
|
|
459
|
-
let t2 =
|
|
460
|
-
let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...
|
|
458
|
+
function Ue(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`] ? { [T]: t2[T] } : {} }, l3 = e5.host?.getErrorHandler?.();
|
|
461
461
|
try {
|
|
462
462
|
if (typeof n3 == `string` || n3 instanceof URL) {
|
|
463
|
-
let
|
|
464
|
-
l3?.handleError(
|
|
465
|
-
let a3 = E(
|
|
466
|
-
return a3 && (t2[T] = a3),
|
|
463
|
+
let e6 = await i3(n3, { ...r3, headers: c3 });
|
|
464
|
+
l3?.handleError(e6, { requestOptions: { url: n3.toString(), method: r3?.method } });
|
|
465
|
+
let a3 = E(e6);
|
|
466
|
+
return a3 && (t2[T] = a3), e6;
|
|
467
467
|
}
|
|
468
468
|
{
|
|
469
|
-
for (let [
|
|
470
|
-
let
|
|
471
|
-
l3?.handleError(
|
|
472
|
-
let a3 = E(
|
|
473
|
-
return a3 && (t2[T] = a3),
|
|
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 = E(e6);
|
|
473
|
+
return a3 && (t2[T] = 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
478
|
}, { client: c2, initModule: l2 } = He(i2), { client: u2, initModule: d2 } = Be(i2), f2 = async (n3, r3) => {
|
|
479
|
-
let i3 = o2(), s3 = await a2(), c3 =
|
|
479
|
+
let i3 = o2(), s3 = await a2(), c3 = ee(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e5.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [T]: t2[T] } : {} } }), u3 = E(l3);
|
|
480
480
|
return u3 && (t2[T] = u3), l3;
|
|
481
481
|
}, m2 = (t3, n3) => {
|
|
482
|
-
if (
|
|
482
|
+
if (Re(t3)) return d2(t3);
|
|
483
483
|
if (Ve(t3)) return l2(t3);
|
|
484
|
-
if (
|
|
484
|
+
if (ne(t3) && e5.host) return S(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 Ce(ae(() => _(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 te(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 =
|
|
507
|
-
if (a3.status !== 200) throw new
|
|
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
|
+
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 E(
|
|
513
|
-
return
|
|
512
|
+
function E(e5) {
|
|
513
|
+
return e5.headers?.get(`X-Wix-Consistent`) ?? e5.headers?.get(`x-wix-consistent`);
|
|
514
514
|
}
|
|
515
515
|
var We = { _id: `id`, _createdDate: `createdDate`, _updatedDate: `updatedDate` };
|
|
516
516
|
var Ge = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
517
|
-
function Ke(
|
|
518
|
-
return
|
|
517
|
+
function Ke(e5, t2) {
|
|
518
|
+
return e5?.split(`.`).map((e6) => t2?.[e6] ?? e6).join(`.`);
|
|
519
519
|
}
|
|
520
520
|
var qe = `sort.fieldName`;
|
|
521
|
-
function Je(
|
|
522
|
-
return (
|
|
521
|
+
function Je(e5, t2, n2) {
|
|
522
|
+
return (e5 === qe || e5.endsWith(`.${qe}`)) && typeof t2 == `string` ? Ke(t2, n2) : t2;
|
|
523
523
|
}
|
|
524
|
-
function Ye(
|
|
525
|
-
let r2 = (
|
|
526
|
-
if (Array.isArray(
|
|
527
|
-
i2(
|
|
524
|
+
function Ye(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 = Xe(
|
|
535
|
-
s2 !==
|
|
534
|
+
let s2 = Xe(e7, t2);
|
|
535
|
+
s2 !== e7 && !(s2 in a2) && (a2[s2] = a2[e7], delete a2[e7]), a2[s2] = Je(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 Xe(
|
|
541
|
+
function Xe(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 Ze(
|
|
546
|
-
return Ye(
|
|
545
|
+
function Ze(e5, t2 = []) {
|
|
546
|
+
return Ye(e5, We, t2);
|
|
547
547
|
}
|
|
548
|
-
function Qe(
|
|
549
|
-
return Ye(
|
|
548
|
+
function Qe(e5, t2 = []) {
|
|
549
|
+
return Ye(e5, Ge, t2);
|
|
550
550
|
}
|
|
551
|
-
function $e(
|
|
552
|
-
return
|
|
551
|
+
function $e(e5) {
|
|
552
|
+
return e5 ? new Date(e5) : void 0;
|
|
553
553
|
}
|
|
554
554
|
var et = /* @__PURE__ */ new WeakMap();
|
|
555
|
-
function
|
|
555
|
+
function tt() {
|
|
556
556
|
return { leaves: void 0, fields: void 0, mapFields: void 0, anyField: void 0 };
|
|
557
557
|
}
|
|
558
|
-
function
|
|
559
|
-
let n2 =
|
|
560
|
-
return n2 || (n2 =
|
|
558
|
+
function nt(e5, t2) {
|
|
559
|
+
let n2 = e5.get(t2);
|
|
560
|
+
return n2 || (n2 = tt(), e5.set(t2, n2)), n2;
|
|
561
561
|
}
|
|
562
|
-
function
|
|
563
|
-
return t2 === `*` ? (
|
|
562
|
+
function rt(e5, t2) {
|
|
563
|
+
return t2 === `*` ? (e5.anyField ??= tt(), e5.anyField) : t2.endsWith(`{}`) ? (e5.mapFields ??= /* @__PURE__ */ new Map(), nt(e5.mapFields, t2.slice(0, -2))) : (e5.fields ??= /* @__PURE__ */ new Map(), nt(e5.fields, t2));
|
|
564
564
|
}
|
|
565
|
-
function
|
|
566
|
-
let t2 =
|
|
567
|
-
for (let n2 of
|
|
568
|
-
let
|
|
569
|
-
|
|
565
|
+
function it(e5) {
|
|
566
|
+
let t2 = tt();
|
|
567
|
+
for (let n2 of e5) {
|
|
568
|
+
let e6 = n2.path.split(`.`).reduce(rt, t2);
|
|
569
|
+
e6.leaves ??= [], e6.leaves.push(n2);
|
|
570
570
|
}
|
|
571
571
|
return t2;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
let t2 = et.get(
|
|
575
|
-
return t2 || (t2 =
|
|
573
|
+
function at(e5) {
|
|
574
|
+
let t2 = et.get(e5);
|
|
575
|
+
return t2 || (t2 = it(e5), et.set(e5, t2)), t2;
|
|
576
576
|
}
|
|
577
|
-
function
|
|
578
|
-
return typeof
|
|
577
|
+
function D(e5) {
|
|
578
|
+
return typeof e5 == `object` && !!e5;
|
|
579
579
|
}
|
|
580
|
-
function
|
|
581
|
-
return t2 ? Array.isArray(
|
|
580
|
+
function ot(e5, { isRepeated: t2, isMap: n2 }, r2) {
|
|
581
|
+
return t2 ? Array.isArray(e5) ? e5.map(r2) : e5 : n2 ? D(e5) ? Object.fromEntries(Object.entries(e5).map(([e6, t3]) => [e6, r2(t3)])) : e5 : r2(e5);
|
|
582
582
|
}
|
|
583
|
-
function
|
|
584
|
-
|
|
583
|
+
function O(e5, t2, n2) {
|
|
584
|
+
D(e5) && lt(e5, t2, n2);
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function st(e5, t2, n2) {
|
|
587
587
|
for (let [r2, i2] of t2) {
|
|
588
|
-
if (!(r2 in
|
|
589
|
-
if (i2.leaves) for (let t4 of i2.leaves)
|
|
590
|
-
let t3 =
|
|
591
|
-
Array.isArray(t3) ? t3.forEach((
|
|
588
|
+
if (!(r2 in e5)) continue;
|
|
589
|
+
if (i2.leaves) for (let t4 of i2.leaves) e5[r2] = ot(e5[r2], t4, n2);
|
|
590
|
+
let t3 = e5[r2];
|
|
591
|
+
Array.isArray(t3) ? t3.forEach((e6) => O(e6, i2, n2)) : O(t3, i2, n2);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function ct(e5, t2, n2) {
|
|
595
595
|
for (let [r2, i2] of t2) {
|
|
596
|
-
let t3 =
|
|
597
|
-
|
|
596
|
+
let t3 = e5[r2];
|
|
597
|
+
D(t3) && Object.values(t3).forEach((e6) => O(e6, i2, n2));
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
function
|
|
601
|
-
t2 &&
|
|
600
|
+
function lt(e5, { fields: t2, mapFields: n2, anyField: r2 }, i2) {
|
|
601
|
+
t2 && st(e5, t2, i2), n2 && ct(e5, n2, i2), r2 && Object.values(e5).forEach((e6) => O(e6, r2, i2));
|
|
602
602
|
}
|
|
603
|
-
function
|
|
604
|
-
if (!
|
|
605
|
-
for (let { paths: n2, transformFn: r2 } of t2)
|
|
606
|
-
return
|
|
603
|
+
function ut(e5, t2) {
|
|
604
|
+
if (!D(e5)) return e5;
|
|
605
|
+
for (let { paths: n2, transformFn: r2 } of t2) lt(e5, at(n2), r2);
|
|
606
|
+
return e5;
|
|
607
607
|
}
|
|
608
|
-
function
|
|
609
|
-
return
|
|
608
|
+
function dt(e5) {
|
|
609
|
+
return gt(e5).map((e6) => e6.toLocaleUpperCase()).join(`_`);
|
|
610
610
|
}
|
|
611
|
-
var
|
|
612
|
-
var
|
|
613
|
-
var
|
|
614
|
-
var
|
|
615
|
-
function
|
|
616
|
-
let t2 =
|
|
617
|
-
t2 = t2.replace(
|
|
611
|
+
var ft = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
612
|
+
var pt = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
613
|
+
var mt = `$1\0$2`;
|
|
614
|
+
var ht = /[^\p{L}\d]+/giu;
|
|
615
|
+
function gt(e5) {
|
|
616
|
+
let t2 = e5.trim();
|
|
617
|
+
t2 = t2.replace(ft, mt).replace(pt, mt), t2 = t2.replace(ht, `\0`);
|
|
618
618
|
let n2 = 0, r2 = t2.length;
|
|
619
619
|
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
620
620
|
if (n2 === r2) return [];
|
|
621
621
|
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
622
622
|
return t2.slice(n2, r2).split(/\0/g);
|
|
623
623
|
}
|
|
624
|
-
var
|
|
625
|
-
var
|
|
626
|
-
var
|
|
627
|
-
function
|
|
628
|
-
if (typeof
|
|
629
|
-
if (
|
|
630
|
-
if (
|
|
631
|
-
if (
|
|
632
|
-
let t3 =
|
|
633
|
-
return
|
|
634
|
-
}
|
|
635
|
-
return
|
|
636
|
-
}
|
|
637
|
-
var
|
|
638
|
-
let r2 =
|
|
639
|
-
return
|
|
624
|
+
var _t = (e5) => `validationError` in (e5.response?.data?.details ?? {});
|
|
625
|
+
var vt = (e5) => `applicationError` in (e5.response?.data?.details ?? {});
|
|
626
|
+
var yt = (e5) => (e5.response?.status ?? -1) >= 400 && (e5.response?.status ?? -1) < 500;
|
|
627
|
+
function bt(e5, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
628
|
+
if (typeof e5 != `object` || !e5) throw e5;
|
|
629
|
+
if (_t(e5)) return xt(e5, t2, n2);
|
|
630
|
+
if (vt(e5)) return St(e5);
|
|
631
|
+
if (yt(e5)) {
|
|
632
|
+
let t3 = e5.response?.status, n3 = e5.response?.statusText ?? `UNKNOWN`, r2 = e5.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: dt(n3), data: {} }, requestId: e5.requestId };
|
|
633
|
+
return k(e5, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
634
|
+
}
|
|
635
|
+
return Ct(e5);
|
|
636
|
+
}
|
|
637
|
+
var xt = (e5, t2, n2) => {
|
|
638
|
+
let r2 = e5.response?.data, i2 = e5.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = wt(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 };
|
|
639
|
+
return k(e5, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e5.response?.status, requestId: i2 } });
|
|
640
640
|
};
|
|
641
|
-
var
|
|
642
|
-
var
|
|
643
|
-
let t2 =
|
|
644
|
-
return
|
|
641
|
+
var k = (e5, { message: t2, extraProperties: n2 }) => Object.assign(e5, { ...n2, message: t2 });
|
|
642
|
+
var St = (e5) => {
|
|
643
|
+
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 ?? dt(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 };
|
|
644
|
+
return k(e5, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e5.requestId } });
|
|
645
645
|
};
|
|
646
|
-
var
|
|
647
|
-
var
|
|
648
|
-
let a2 = { ...
|
|
649
|
-
return r2?.filter((
|
|
650
|
-
let r3 = t2[
|
|
651
|
-
if (r3) return { ...
|
|
652
|
-
let s2 = o2?.sort((
|
|
646
|
+
var Ct = (e5) => k(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: dt(e5.response?.statusText ?? `UNKNOWN`), ...!e5.response && { runtimeError: e5 } } });
|
|
647
|
+
var wt = ({ spreadPathsToArguments: e5, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
648
|
+
let a2 = { ...e5, ...t2 }, o2 = Object.keys(a2);
|
|
649
|
+
return r2?.filter((e6) => !r2.some((t3) => t3.field.length > e6.field.length && t3.field.startsWith(e6.field) && o2.includes(t3.field))).map((e6) => {
|
|
650
|
+
let r3 = t2[e6.field];
|
|
651
|
+
if (r3) return { ...e6, field: Tt(r3, i2) };
|
|
652
|
+
let s2 = o2?.sort((e7, t3) => t3.length - e7.length)?.find((t3) => e6.field.startsWith(t3));
|
|
653
653
|
if (s2) {
|
|
654
654
|
let t3 = a2[s2];
|
|
655
|
-
if (t3) return { ...
|
|
655
|
+
if (t3) return { ...e6, field: e6.field.replace(s2, Tt(t3, i2)) };
|
|
656
656
|
}
|
|
657
|
-
return n2 ? { ...
|
|
657
|
+
return n2 ? { ...e6, field: `${i2[0]}.${e6.field}` } : e6;
|
|
658
658
|
});
|
|
659
659
|
};
|
|
660
|
-
var
|
|
661
|
-
let n2 =
|
|
662
|
-
return n2 == null ?
|
|
660
|
+
var Tt = (e5, t2) => {
|
|
661
|
+
let n2 = Et(e5);
|
|
662
|
+
return n2 == null ? e5 : e5.replace(`$[${n2}]`, t2[n2]);
|
|
663
663
|
};
|
|
664
|
-
var
|
|
665
|
-
let t2 =
|
|
664
|
+
var Et = (e5) => {
|
|
665
|
+
let t2 = e5.match(/\$\[(?<argIndex>\d+)\]/);
|
|
666
666
|
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
667
667
|
};
|
|
668
|
-
function
|
|
669
|
-
let
|
|
670
|
-
if (
|
|
671
|
-
return
|
|
668
|
+
function Dt() {
|
|
669
|
+
let e5 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
670
|
+
if (e5) return { initWixModules(t3, n3) {
|
|
671
|
+
return Ot(() => e5(t3, n3));
|
|
672
672
|
}, fetchWithAuth() {
|
|
673
673
|
throw Error(`fetchWithAuth is not available in this context`);
|
|
674
674
|
}, graphql() {
|
|
675
675
|
throw Error(`graphql is not available in this context`);
|
|
676
676
|
} };
|
|
677
677
|
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;
|
|
678
|
-
if (t2 || n2) return { initWixModules(
|
|
678
|
+
if (t2 || n2) return { initWixModules(e6, r2) {
|
|
679
679
|
if (r2) {
|
|
680
680
|
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`);
|
|
681
|
-
return
|
|
681
|
+
return Ot(() => n2.use(e6));
|
|
682
682
|
}
|
|
683
683
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
684
|
-
return
|
|
685
|
-
}, fetchWithAuth: (
|
|
684
|
+
return Ot(() => t2.use(e6));
|
|
685
|
+
}, fetchWithAuth: (e6, n3) => {
|
|
686
686
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
687
|
-
return t2.fetchWithAuth(
|
|
687
|
+
return t2.fetchWithAuth(e6, n3);
|
|
688
688
|
}, getAuth() {
|
|
689
689
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
690
690
|
return t2.auth;
|
|
691
|
-
}, async graphql(
|
|
691
|
+
}, async graphql(e6, n3, r2) {
|
|
692
692
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
693
|
-
return t2.graphql(
|
|
693
|
+
return t2.graphql(e6, n3, r2);
|
|
694
694
|
} };
|
|
695
695
|
}
|
|
696
|
-
function
|
|
696
|
+
function Ot(e5) {
|
|
697
697
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
698
698
|
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);
|
|
699
699
|
try {
|
|
700
|
-
return
|
|
700
|
+
return e5();
|
|
701
701
|
} finally {
|
|
702
702
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
function
|
|
705
|
+
function kt(e5, t2) {
|
|
706
706
|
return (...n2) => {
|
|
707
|
-
let r2 =
|
|
708
|
-
return r2 ? r2.initWixModules(
|
|
707
|
+
let r2 = Dt();
|
|
708
|
+
return r2 ? r2.initWixModules(e5, t2).apply(void 0, n2) : e5.apply(void 0, n2);
|
|
709
709
|
};
|
|
710
710
|
}
|
|
711
|
-
function
|
|
712
|
-
return
|
|
713
|
-
}
|
|
714
|
-
function
|
|
715
|
-
let t2 =
|
|
716
|
-
return
|
|
717
|
-
}
|
|
718
|
-
var
|
|
719
|
-
var
|
|
720
|
-
var
|
|
721
|
-
var
|
|
722
|
-
var
|
|
723
|
-
var
|
|
724
|
-
var
|
|
725
|
-
var
|
|
726
|
-
var
|
|
727
|
-
var
|
|
728
|
-
function
|
|
729
|
-
return
|
|
730
|
-
}
|
|
731
|
-
function
|
|
732
|
-
return
|
|
733
|
-
}
|
|
734
|
-
function
|
|
735
|
-
let n2 = t2[
|
|
711
|
+
function At(e5, t2 = false) {
|
|
712
|
+
return kt(e5, t2);
|
|
713
|
+
}
|
|
714
|
+
function jt(e5) {
|
|
715
|
+
let t2 = Wt(Ht(e5.host), e5.domainToMappings);
|
|
716
|
+
return $t(Xt(e5.protoPath, e5.data || {}), t2);
|
|
717
|
+
}
|
|
718
|
+
var Mt = [`wix.com`, `editorx.com`];
|
|
719
|
+
var Nt = `_`;
|
|
720
|
+
var Pt = `*.`;
|
|
721
|
+
var Ft = RegExp(`\\.(${Mt.join(`|`)})$`);
|
|
722
|
+
var It = [`42.wixprod.net`, `uw2-edt-1.wixprod.net`, `virginia-edt.wixprod.net`];
|
|
723
|
+
var Lt = { "payments.base44.com": `manage.wix.com`, "create.editorx.com": `editor.editorx.com` };
|
|
724
|
+
var Rt = `dev.wix-code.com`;
|
|
725
|
+
var zt = /{(.*)}/;
|
|
726
|
+
var Bt = RegExp(`\\.(${It.join(`|`)})$`);
|
|
727
|
+
var Vt = RegExp(`.*\\.${Rt}$`);
|
|
728
|
+
function Ht(e5) {
|
|
729
|
+
return Ut(e5).replace(Ft, `._base_domain_`).replace(Bt, `._api_base_domain_`).replace(Vt, `*.dev.wix-code.com`);
|
|
730
|
+
}
|
|
731
|
+
function Ut(e5) {
|
|
732
|
+
return Lt[e5] ?? e5;
|
|
733
|
+
}
|
|
734
|
+
function Wt(e5, t2) {
|
|
735
|
+
let n2 = t2[e5];
|
|
736
736
|
if (n2) return n2;
|
|
737
|
-
let r2 =
|
|
737
|
+
let r2 = Gt(e5, t2) ?? Kt(e5, t2);
|
|
738
738
|
if (!r2) {
|
|
739
|
-
if (
|
|
740
|
-
let
|
|
741
|
-
if (
|
|
739
|
+
if (Jt(e5)) {
|
|
740
|
+
let e6 = t2[Yt];
|
|
741
|
+
if (e6) return e6;
|
|
742
742
|
}
|
|
743
|
-
let n3 = t2[
|
|
743
|
+
let n3 = t2[Nt];
|
|
744
744
|
if (n3) return n3;
|
|
745
745
|
}
|
|
746
746
|
return r2 ?? [];
|
|
747
747
|
}
|
|
748
|
-
function
|
|
748
|
+
function Gt(e5, t2) {
|
|
749
749
|
return Object.entries(t2).find(([t3]) => {
|
|
750
|
-
let [, ...n2] =
|
|
750
|
+
let [, ...n2] = e5.split(`.`);
|
|
751
751
|
return n2.join(`.`) === t3;
|
|
752
752
|
})?.[1];
|
|
753
753
|
}
|
|
754
|
-
function
|
|
755
|
-
let [n2] = Object.entries(t2).filter(([t3]) =>
|
|
754
|
+
function Kt(e5, t2) {
|
|
755
|
+
let [n2] = Object.entries(t2).filter(([t3]) => qt(e5, t3)).sort(([e6], [t3]) => t3.length - e6.length);
|
|
756
756
|
if (!n2) return;
|
|
757
757
|
let [, r2] = n2;
|
|
758
758
|
return r2;
|
|
759
759
|
}
|
|
760
|
-
function
|
|
761
|
-
if (!t2.startsWith(
|
|
760
|
+
function qt(e5, t2) {
|
|
761
|
+
if (!t2.startsWith(Pt)) return false;
|
|
762
762
|
let n2 = t2.slice(1);
|
|
763
|
-
return
|
|
763
|
+
return e5.length > n2.length && e5.endsWith(n2);
|
|
764
764
|
}
|
|
765
|
-
function
|
|
766
|
-
return !!
|
|
765
|
+
function Jt(e5) {
|
|
766
|
+
return !!e5.match(/\._base_domain_$/);
|
|
767
767
|
}
|
|
768
|
-
var
|
|
769
|
-
function
|
|
770
|
-
return
|
|
768
|
+
var Yt = `www._base_domain_`;
|
|
769
|
+
function Xt(e5, t2) {
|
|
770
|
+
return e5.split(`/`).map((e6) => Zt(e6, t2)).join(`/`);
|
|
771
771
|
}
|
|
772
|
-
function
|
|
773
|
-
let n2 =
|
|
774
|
-
return r2 ?
|
|
772
|
+
function Zt(e5, t2) {
|
|
773
|
+
let n2 = e5.match(zt) || [], r2 = n2[1];
|
|
774
|
+
return r2 ? Qt(t2, r2, e5, e5.replace(n2[0], ``)) : e5;
|
|
775
775
|
}
|
|
776
|
-
function
|
|
777
|
-
let i2 =
|
|
778
|
-
for (let
|
|
776
|
+
function Qt(e5, t2, n2, r2) {
|
|
777
|
+
let i2 = e5;
|
|
778
|
+
for (let e6 of t2.split(`.`)) {
|
|
779
779
|
if (!i2) return n2;
|
|
780
|
-
i2 = i2[
|
|
780
|
+
i2 = i2[e6];
|
|
781
781
|
}
|
|
782
782
|
return `${i2}${r2}`;
|
|
783
783
|
}
|
|
784
|
-
function
|
|
785
|
-
let n2 = t2?.find((t3) =>
|
|
786
|
-
return n2 ? n2.srcPath +
|
|
784
|
+
function $t(e5, t2) {
|
|
785
|
+
let n2 = t2?.find((t3) => e5.startsWith(t3.destPath));
|
|
786
|
+
return n2 ? n2.srcPath + e5.slice(n2.destPath.length) : e5;
|
|
787
|
+
}
|
|
788
|
+
var A;
|
|
789
|
+
(function(e5) {
|
|
790
|
+
e5.QUERY_PARAM = `QUERY_PARAM`, e5.SUBDOMAIN = `SUBDOMAIN`, e5.SUBDIRECTORY = `SUBDIRECTORY`;
|
|
791
|
+
})(A ||= {});
|
|
792
|
+
var en = { 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` };
|
|
793
|
+
var tn = (e5, t2) => {
|
|
794
|
+
e5.searchParams.set(`lang`, t2);
|
|
795
|
+
};
|
|
796
|
+
var nn = (e5, t2) => {
|
|
797
|
+
let n2 = e5.hostname.split(`.`);
|
|
798
|
+
n2[0] === `www` && (n2 = n2.slice(1)), n2 = [t2, ...n2], e5.hostname = n2.join(`.`);
|
|
799
|
+
};
|
|
800
|
+
var rn = (e5, t2) => {
|
|
801
|
+
e5.pathname = `/${t2}${e5.pathname}`;
|
|
802
|
+
};
|
|
803
|
+
var an = (e5, t2) => {
|
|
804
|
+
if (!t2.languageCode || !t2?.resolutionMethod) return e5;
|
|
805
|
+
let n2 = new URL(e5);
|
|
806
|
+
return (t2?.resolutionMethod === `QUERY_PARAM` ? tn : t2?.resolutionMethod === `SUBDOMAIN` ? nn : rn)(n2, t2.languageCode), n2.href;
|
|
807
|
+
};
|
|
808
|
+
var on = (e5, t2) => {
|
|
809
|
+
if (!e5?.length) return e5;
|
|
810
|
+
let n2;
|
|
811
|
+
try {
|
|
812
|
+
n2 = new URL(e5);
|
|
813
|
+
} catch {
|
|
814
|
+
return e5;
|
|
815
|
+
}
|
|
816
|
+
n2.searchParams.delete(`lang`);
|
|
817
|
+
let r2 = n2.pathname.split(`/`)[1]?.toLowerCase();
|
|
818
|
+
if (t2.includes(r2 ?? ``)) {
|
|
819
|
+
let e6 = n2.pathname.split(`/`);
|
|
820
|
+
e6.splice(1, 1), n2.pathname = e6.join(`/`);
|
|
821
|
+
}
|
|
822
|
+
let i2 = n2.hostname.split(`.`)[0]?.toLowerCase();
|
|
823
|
+
if (t2.includes(i2 ?? ``)) {
|
|
824
|
+
let e6 = n2.hostname.split(`.`);
|
|
825
|
+
e6.shift(), n2.hostname = e6.join(`.`);
|
|
826
|
+
}
|
|
827
|
+
return n2.href;
|
|
828
|
+
};
|
|
829
|
+
function sn() {
|
|
830
|
+
let e5 = cn();
|
|
831
|
+
return e5 ? ln(e5) : [];
|
|
832
|
+
}
|
|
833
|
+
function cn() {
|
|
834
|
+
let e5 = typeof globals < `u` ? globals?.$ns?.[`wix-window`]?.multilingual : void 0, t2 = typeof window < `u` ? window?.essentials?.multilingual : void 0;
|
|
835
|
+
return e5 ?? t2 ?? globalThis?.__wix_site_metadata__?.multilingual;
|
|
836
|
+
}
|
|
837
|
+
function ln(e5) {
|
|
838
|
+
try {
|
|
839
|
+
if (e5?.supportedLanguages?.length) {
|
|
840
|
+
let t2 = e5.supportedLanguages, n2 = t2.map((e6) => e6.languageCode).filter(Boolean), r2 = e5.cleanUrl ?? pn(n2);
|
|
841
|
+
return t2.map((e6) => ({ id: e6.languageCode, displayName: un(e6), regionalFormat: [e6.locale?.languageCode, e6.locale?.country].filter(Boolean).join(`-`), url: dn(e6, r2), primary: e6.isPrimary, resolutionMethod: e6.resolutionMethod }));
|
|
842
|
+
}
|
|
843
|
+
if (e5?.siteLanguages?.length) {
|
|
844
|
+
let t2 = e5.siteLanguages, n2 = pn(t2.map((e6) => e6.languageCode).filter(Boolean));
|
|
845
|
+
return t2.map((e6) => ({ id: e6.languageCode, displayName: un(e6), regionalFormat: e6.locale, url: dn(e6, n2), primary: e6.isPrimaryLanguage, resolutionMethod: e6.resolutionMethod ? fn(e6.resolutionMethod) : void 0 }));
|
|
846
|
+
}
|
|
847
|
+
} catch (e6) {
|
|
848
|
+
return console.warn(`[Multilingual Manager] listSupportedLanguages failed`, e6), [];
|
|
849
|
+
}
|
|
850
|
+
return console.warn(`[Multilingual Manager] listSupportedLanguages is not available`), [];
|
|
851
|
+
}
|
|
852
|
+
function un(e5) {
|
|
853
|
+
let t2 = en[e5.languageCode];
|
|
854
|
+
if (t2) return t2;
|
|
855
|
+
let n2 = e5.name ?? e5.countryCode;
|
|
856
|
+
if (n2) return n2;
|
|
857
|
+
}
|
|
858
|
+
function dn(e5, t2) {
|
|
859
|
+
if (e5.url || !t2 || !e5.resolutionMethod) return e5.url;
|
|
860
|
+
if (e5.languageCode) try {
|
|
861
|
+
return an(t2, { languageCode: e5.languageCode, countryCode: e5.countryCode, resolutionMethod: fn(e5.resolutionMethod), locale: { languageCode: e5.languageCode, country: e5.countryCode } });
|
|
862
|
+
} catch (e6) {
|
|
863
|
+
console.warn(`[Multilingual Manager] buildUrlForLanguage failed`, e6);
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
function fn(e5) {
|
|
868
|
+
switch (e5) {
|
|
869
|
+
case `QUERY_PARAM`:
|
|
870
|
+
case `QueryParam`:
|
|
871
|
+
return A.QUERY_PARAM;
|
|
872
|
+
case `SUBDOMAIN`:
|
|
873
|
+
case `Subdomain`:
|
|
874
|
+
return A.SUBDOMAIN;
|
|
875
|
+
case `SUBDIRECTORY`:
|
|
876
|
+
case `Subdirectory`:
|
|
877
|
+
return A.SUBDIRECTORY;
|
|
878
|
+
default:
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
function pn(e5) {
|
|
883
|
+
let t2 = typeof window < `u` && window.location?.href ? window.location.href : ``;
|
|
884
|
+
try {
|
|
885
|
+
return on(t2, e5);
|
|
886
|
+
} catch (e6) {
|
|
887
|
+
return console.warn(`[Multilingual Manager] cleanCurrentUrl failed`, e6), t2;
|
|
888
|
+
}
|
|
787
889
|
}
|
|
788
|
-
var
|
|
789
|
-
var
|
|
790
|
-
var
|
|
791
|
-
var
|
|
792
|
-
let
|
|
793
|
-
if (
|
|
890
|
+
var mn = `x-wix-linguist`;
|
|
891
|
+
var hn = `00000000-0000-0000-0000-000000000000`;
|
|
892
|
+
var gn = `false`;
|
|
893
|
+
var _n = () => {
|
|
894
|
+
let e5 = j(`language`), t2 = j(`locale`);
|
|
895
|
+
if (e5) return { [mn]: [e5, t2 || e5, gn, hn].join(`|`) };
|
|
794
896
|
};
|
|
795
|
-
function
|
|
796
|
-
let
|
|
897
|
+
function vn() {
|
|
898
|
+
let e5 = null, t2 = null;
|
|
797
899
|
return { promise: new Promise((n2, r2) => {
|
|
798
|
-
|
|
799
|
-
}), resolve:
|
|
800
|
-
}
|
|
801
|
-
var
|
|
802
|
-
var
|
|
803
|
-
var
|
|
804
|
-
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 =
|
|
805
|
-
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language:
|
|
806
|
-
return
|
|
900
|
+
e5 = n2, t2 = r2;
|
|
901
|
+
}), resolve: e5, reject: t2 };
|
|
902
|
+
}
|
|
903
|
+
var yn = () => (typeof window < `u` ? window.commonConfig : void 0) ?? globalThis.commonConfig;
|
|
904
|
+
var j = (e5) => yn()?.[e5];
|
|
905
|
+
var bn = ({ createHost: e5 }) => ({ __type: `host`, create: (e6) => ({}), host: (t2) => {
|
|
906
|
+
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e5(t2), o2 = Sn();
|
|
907
|
+
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language: j(`language`), locale: j(`locale`), get passThroughHeaders() {
|
|
908
|
+
return _n();
|
|
807
909
|
} } };
|
|
808
|
-
}, auth: (
|
|
910
|
+
}, auth: (e6) => {
|
|
809
911
|
let t2 = typeof window < `u` ? window.wixEmbedsAPI : void 0;
|
|
810
|
-
!
|
|
811
|
-
let n2 = false, { resolve: r2, promise: i2 } =
|
|
912
|
+
!e6 && xn() && (e6 = t2?.getAccessTokenFunction?.());
|
|
913
|
+
let n2 = false, { resolve: r2, promise: i2 } = vn();
|
|
812
914
|
return { getAuthHeaders: async () => {
|
|
813
|
-
if (!
|
|
814
|
-
return { headers: { Authorization: await
|
|
815
|
-
}, getAccessTokenInjector: () => (n2 = true, (
|
|
816
|
-
r2(
|
|
915
|
+
if (!e6 && n2 && (e6 = await i2), !e6) throw Error(`Failed to resolve auth token`);
|
|
916
|
+
return { headers: { Authorization: await e6() } };
|
|
917
|
+
}, getAccessTokenInjector: () => (n2 = true, (e7) => {
|
|
918
|
+
r2(e7);
|
|
817
919
|
}) };
|
|
818
920
|
} });
|
|
819
|
-
function
|
|
921
|
+
function xn() {
|
|
820
922
|
return typeof document < `u` && document.currentScript?.tagName === `SCRIPT`;
|
|
821
923
|
}
|
|
822
|
-
function
|
|
823
|
-
let
|
|
824
|
-
if (!
|
|
825
|
-
let t2 = new URL(
|
|
924
|
+
function Sn() {
|
|
925
|
+
let e5 = (typeof window < `u` ? window.wixEmbedsAPI : void 0)?.getExternalBaseUrl?.();
|
|
926
|
+
if (!e5) return;
|
|
927
|
+
let t2 = new URL(e5);
|
|
826
928
|
return t2?.pathname && t2.pathname !== `/` ? `${t2.hostname}${t2.pathname}` : t2.hostname;
|
|
827
929
|
}
|
|
828
|
-
var
|
|
829
|
-
if (!
|
|
830
|
-
return
|
|
930
|
+
var Cn = ({ clientSdk: e5, applicationId: t2 }) => ({ invoke: async ({ namespace: n2, method: r2, args: i2 }) => {
|
|
931
|
+
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`);
|
|
932
|
+
return e5.invoke({ namespace: n2, method: r2, args: i2, applicationId: t2, accessToken: `accessToken` });
|
|
831
933
|
}, getAccessToken: () => {
|
|
832
934
|
throw Error(`Not implemented`);
|
|
833
935
|
}, observeState: () => ({ disconnect: () => {
|
|
834
936
|
} }) });
|
|
835
|
-
var
|
|
836
|
-
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ??
|
|
937
|
+
var wn = bn({ createHost: function(e5) {
|
|
938
|
+
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ?? e5?.clientSdk ?? (typeof window < `u` ? window?.clientSdk : void 0), { applicationId: n2 } = e5 || {};
|
|
837
939
|
if (!n2) throw Error(`"createHost" was called without a required field "applicationId"`);
|
|
838
|
-
return { channel:
|
|
940
|
+
return { channel: Cn({ clientSdk: t2, applicationId: n2 }), close: () => {
|
|
839
941
|
} };
|
|
840
942
|
} });
|
|
841
|
-
var
|
|
842
|
-
let n2 =
|
|
943
|
+
var Tn = (e5, t2) => {
|
|
944
|
+
let n2 = wn.host({ applicationId: e5, componentId: t2 }), r2 = wn.auth();
|
|
843
945
|
return Ue({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
|
|
844
946
|
};
|
|
845
|
-
var
|
|
846
|
-
function
|
|
847
|
-
for (let n2 of
|
|
848
|
-
let
|
|
849
|
-
if (
|
|
947
|
+
var En = (e5) => Tn(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`, e5);
|
|
948
|
+
function M(e5, t2) {
|
|
949
|
+
for (let n2 of e5) {
|
|
950
|
+
let e6 = n2.addOns.find((e7) => e7.addOnId === t2);
|
|
951
|
+
if (e6) return { group: n2, addOn: e6 };
|
|
850
952
|
}
|
|
851
953
|
return null;
|
|
852
954
|
}
|
|
853
|
-
function
|
|
854
|
-
return
|
|
955
|
+
function Dn(e5, t2) {
|
|
956
|
+
return M(e5, t2)?.addOn ?? null;
|
|
855
957
|
}
|
|
856
|
-
function
|
|
857
|
-
return t2.filter((t3) =>
|
|
958
|
+
function N(e5, t2) {
|
|
959
|
+
return t2.filter((t3) => M(e5, t3.id) !== null);
|
|
858
960
|
}
|
|
859
|
-
function
|
|
860
|
-
return n2.filter((n3) =>
|
|
961
|
+
function On(e5, t2, n2) {
|
|
962
|
+
return n2.filter((n3) => M(e5, n3.id)?.group === t2).length;
|
|
861
963
|
}
|
|
862
|
-
function
|
|
863
|
-
return !
|
|
964
|
+
function kn(e5, t2) {
|
|
965
|
+
return !e5.maxNumberOfAddOns || t2 < e5.maxNumberOfAddOns;
|
|
864
966
|
}
|
|
865
|
-
function
|
|
866
|
-
return
|
|
867
|
-
let r2 =
|
|
868
|
-
return { ...n2, addOns: n2.addOns.map((
|
|
869
|
-
let n3 = t2.find((t3) => t3.id ===
|
|
870
|
-
return { ...
|
|
871
|
-
}), selectedCount: r2, canSelectMore:
|
|
967
|
+
function An(e5, t2) {
|
|
968
|
+
return e5.map((n2) => {
|
|
969
|
+
let r2 = On(e5, n2, t2);
|
|
970
|
+
return { ...n2, addOns: n2.addOns.map((e6) => {
|
|
971
|
+
let n3 = t2.find((t3) => t3.id === e6.addOnId)?.quantity ?? 0;
|
|
972
|
+
return { ...e6, isSelected: n3 > 0, selectedQuantity: n3 };
|
|
973
|
+
}), selectedCount: r2, canSelectMore: kn(n2, r2) };
|
|
872
974
|
});
|
|
873
975
|
}
|
|
874
|
-
function
|
|
875
|
-
let r2 =
|
|
876
|
-
return r2 ? t2.some((
|
|
976
|
+
function jn(e5, t2, n2) {
|
|
977
|
+
let r2 = M(e5, n2);
|
|
978
|
+
return r2 ? t2.some((e6) => e6.id === n2) ? true : kn(r2.group, On(e5, r2.group, t2)) : false;
|
|
877
979
|
}
|
|
878
|
-
function
|
|
879
|
-
let n2 =
|
|
980
|
+
function Mn(e5, t2) {
|
|
981
|
+
let n2 = e5.maxQuantity ?? 1;
|
|
880
982
|
return Number.isFinite(t2) ? Math.min(Math.max(Math.trunc(t2), 0), n2) : 0;
|
|
881
983
|
}
|
|
882
|
-
var
|
|
883
|
-
function
|
|
884
|
-
return
|
|
984
|
+
var Nn = { category: `category`, location: `location`, page: `page`, blob: `b`, resource: `resource`, referral: `referral`, timezone: `timezone`, bookingId: `bookingId`, token: `token`, rescheduleRedirectUrl: `rescheduleRedirectUrl` };
|
|
985
|
+
function P(e5) {
|
|
986
|
+
return e5.addOns ?? [];
|
|
885
987
|
}
|
|
886
|
-
function
|
|
887
|
-
let n2 = { ...
|
|
988
|
+
function Pn(e5, t2) {
|
|
989
|
+
let n2 = { ...e5 };
|
|
888
990
|
return t2.length ? n2.addOns = t2 : delete n2.addOns, n2;
|
|
889
991
|
}
|
|
890
|
-
function
|
|
891
|
-
let n2 =
|
|
892
|
-
return
|
|
992
|
+
function Fn(e5, t2) {
|
|
993
|
+
let n2 = P(e5);
|
|
994
|
+
return Pn(e5, n2.some((e6) => e6.id === t2) ? n2.filter((e6) => e6.id !== t2) : [...n2, { id: t2, quantity: 1 }]);
|
|
893
995
|
}
|
|
894
|
-
function
|
|
895
|
-
let r2 =
|
|
896
|
-
return n2 <= 0 ?
|
|
996
|
+
function In(e5, t2, n2) {
|
|
997
|
+
let r2 = P(e5);
|
|
998
|
+
return n2 <= 0 ? Pn(e5, r2.filter((e6) => e6.id !== t2)) : Pn(e5, r2.some((e6) => e6.id === t2) ? r2.map((e6) => e6.id === t2 ? { ...e6, quantity: n2 } : e6) : [...r2, { id: t2, quantity: n2 }]);
|
|
897
999
|
}
|
|
898
|
-
function
|
|
899
|
-
let
|
|
900
|
-
if (
|
|
901
|
-
return
|
|
1000
|
+
function Ln() {
|
|
1001
|
+
let e5 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
1002
|
+
if (e5) return { initWixModules(t3, n3) {
|
|
1003
|
+
return Rn(() => e5(t3, n3));
|
|
902
1004
|
}, fetchWithAuth() {
|
|
903
1005
|
throw Error(`fetchWithAuth is not available in this context`);
|
|
904
1006
|
}, graphql() {
|
|
905
1007
|
throw Error(`graphql is not available in this context`);
|
|
906
1008
|
} };
|
|
907
1009
|
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;
|
|
908
|
-
if (t2 || n2) return { initWixModules(
|
|
1010
|
+
if (t2 || n2) return { initWixModules(e6, r2) {
|
|
909
1011
|
if (r2) {
|
|
910
1012
|
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`);
|
|
911
|
-
return
|
|
1013
|
+
return Rn(() => n2.use(e6));
|
|
912
1014
|
}
|
|
913
1015
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
914
|
-
return
|
|
915
|
-
}, fetchWithAuth: (
|
|
1016
|
+
return Rn(() => t2.use(e6));
|
|
1017
|
+
}, fetchWithAuth: (e6, n3) => {
|
|
916
1018
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
917
|
-
return t2.fetchWithAuth(
|
|
1019
|
+
return t2.fetchWithAuth(e6, n3);
|
|
918
1020
|
}, getAuth() {
|
|
919
1021
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
920
1022
|
return t2.auth;
|
|
921
|
-
}, async graphql(
|
|
1023
|
+
}, async graphql(e6, n3, r2) {
|
|
922
1024
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
923
|
-
return t2.graphql(
|
|
1025
|
+
return t2.graphql(e6, n3, r2);
|
|
924
1026
|
} };
|
|
925
1027
|
}
|
|
926
|
-
function
|
|
1028
|
+
function Rn(e5) {
|
|
927
1029
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
928
1030
|
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);
|
|
929
1031
|
try {
|
|
930
|
-
return
|
|
1032
|
+
return e5();
|
|
931
1033
|
} finally {
|
|
932
1034
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
933
1035
|
}
|
|
934
1036
|
}
|
|
935
|
-
function
|
|
936
|
-
return { ...
|
|
937
|
-
let r2 =
|
|
1037
|
+
function zn(e5, t2) {
|
|
1038
|
+
return { ...e5, ...Object.fromEntries(t2.map((t3) => [t3, (...n2) => {
|
|
1039
|
+
let r2 = Ln();
|
|
938
1040
|
if (!r2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
939
|
-
return r2.initWixModules(
|
|
1041
|
+
return r2.initWixModules(e5)[t3].apply(void 0, n2);
|
|
940
1042
|
}])) };
|
|
941
1043
|
}
|
|
942
|
-
function
|
|
943
|
-
return
|
|
1044
|
+
function Bn(e5) {
|
|
1045
|
+
return zn({ __type: `host`, create: (t2) => Object.entries(e5).reduce((e6, [n2, r2]) => ({ ...e6, [n2]: r2(t2) }), {}) }, Object.keys(e5));
|
|
1046
|
+
}
|
|
1047
|
+
var F = (e5) => typeof e5 == `string`;
|
|
1048
|
+
var I = () => {
|
|
1049
|
+
let e5, t2, n2 = new Promise((n3, r2) => {
|
|
1050
|
+
e5 = n3, t2 = r2;
|
|
1051
|
+
});
|
|
1052
|
+
return n2.resolve = e5, n2.reject = t2, n2;
|
|
1053
|
+
};
|
|
1054
|
+
var Vn = (e5) => e5 == null ? `` : `` + e5;
|
|
1055
|
+
var Hn = (e5, t2, n2) => {
|
|
1056
|
+
e5.forEach((e6) => {
|
|
1057
|
+
t2[e6] && (n2[e6] = t2[e6]);
|
|
1058
|
+
});
|
|
1059
|
+
};
|
|
1060
|
+
var Un = /###/g;
|
|
1061
|
+
var Wn = (e5) => e5 && e5.indexOf(`###`) > -1 ? e5.replace(Un, `.`) : e5;
|
|
1062
|
+
var Gn = (e5) => !e5 || F(e5);
|
|
1063
|
+
var L = (e5, t2, n2) => {
|
|
1064
|
+
let r2 = F(t2) ? t2.split(`.`) : t2, i2 = 0;
|
|
1065
|
+
for (; i2 < r2.length - 1; ) {
|
|
1066
|
+
if (Gn(e5)) return {};
|
|
1067
|
+
let t3 = Wn(r2[i2]);
|
|
1068
|
+
!e5[t3] && n2 && (e5[t3] = new n2()), e5 = Object.prototype.hasOwnProperty.call(e5, t3) ? e5[t3] : {}, ++i2;
|
|
1069
|
+
}
|
|
1070
|
+
return Gn(e5) ? {} : { obj: e5, k: Wn(r2[i2]) };
|
|
1071
|
+
};
|
|
1072
|
+
var Kn = (e5, t2, n2) => {
|
|
1073
|
+
let { obj: r2, k: i2 } = L(e5, t2, Object);
|
|
1074
|
+
if (r2 !== void 0 || t2.length === 1) {
|
|
1075
|
+
r2[i2] = n2;
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
let a2 = t2[t2.length - 1], o2 = t2.slice(0, t2.length - 1), s2 = L(e5, o2, Object);
|
|
1079
|
+
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);
|
|
1080
|
+
s2.obj[`${s2.k}.${a2}`] = n2;
|
|
1081
|
+
};
|
|
1082
|
+
var qn = (e5, t2, n2, r2) => {
|
|
1083
|
+
let { obj: i2, k: a2 } = L(e5, t2, Object);
|
|
1084
|
+
i2[a2] = i2[a2] || [], i2[a2].push(n2);
|
|
1085
|
+
};
|
|
1086
|
+
var R = (e5, t2) => {
|
|
1087
|
+
let { obj: n2, k: r2 } = L(e5, t2);
|
|
1088
|
+
if (n2 && Object.prototype.hasOwnProperty.call(n2, r2)) return n2[r2];
|
|
1089
|
+
};
|
|
1090
|
+
var Jn = (e5, t2, n2) => {
|
|
1091
|
+
let r2 = R(e5, n2);
|
|
1092
|
+
return r2 === void 0 ? R(t2, n2) : r2;
|
|
1093
|
+
};
|
|
1094
|
+
var Yn = (e5, t2, n2) => {
|
|
1095
|
+
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]) : Yn(e5[r2], t2[r2], n2) : e5[r2] = t2[r2]);
|
|
1096
|
+
return e5;
|
|
1097
|
+
};
|
|
1098
|
+
var z = (e5) => e5.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, `\\$&`);
|
|
1099
|
+
var Xn = { "&": `&`, "<": `<`, ">": `>`, '"': `"`, "'": `'`, "/": `/` };
|
|
1100
|
+
var Zn = (e5) => F(e5) ? e5.replace(/[&<>"'\/]/g, (e6) => Xn[e6]) : e5;
|
|
1101
|
+
var Qn = class {
|
|
1102
|
+
constructor(e5) {
|
|
1103
|
+
this.capacity = e5, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
1104
|
+
}
|
|
1105
|
+
getRegExp(e5) {
|
|
1106
|
+
let t2 = this.regExpMap.get(e5);
|
|
1107
|
+
if (t2 !== void 0) return t2;
|
|
1108
|
+
let n2 = new RegExp(e5);
|
|
1109
|
+
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e5, n2), this.regExpQueue.push(e5), n2;
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
var $n = [` `, `,`, `?`, `!`, `;`];
|
|
1113
|
+
var er = new Qn(20);
|
|
1114
|
+
var tr = (e5, t2, n2) => {
|
|
1115
|
+
t2 ||= ``, n2 ||= ``;
|
|
1116
|
+
let r2 = $n.filter((e6) => t2.indexOf(e6) < 0 && n2.indexOf(e6) < 0);
|
|
1117
|
+
if (r2.length === 0) return true;
|
|
1118
|
+
let i2 = er.getRegExp(`(${r2.map((e6) => e6 === `?` ? `\\?` : e6).join(`|`)})`), a2 = !i2.test(e5);
|
|
1119
|
+
if (!a2) {
|
|
1120
|
+
let t3 = e5.indexOf(n2);
|
|
1121
|
+
t3 > 0 && !i2.test(e5.substring(0, t3)) && (a2 = true);
|
|
1122
|
+
}
|
|
1123
|
+
return a2;
|
|
1124
|
+
};
|
|
1125
|
+
var B = (e5, t2, n2 = `.`) => {
|
|
1126
|
+
if (!e5) return;
|
|
1127
|
+
if (e5[t2]) return Object.prototype.hasOwnProperty.call(e5, t2) ? e5[t2] : void 0;
|
|
1128
|
+
let r2 = t2.split(n2), i2 = e5;
|
|
1129
|
+
for (let e6 = 0; e6 < r2.length; ) {
|
|
1130
|
+
if (!i2 || typeof i2 != `object`) return;
|
|
1131
|
+
let t3, a2 = ``;
|
|
1132
|
+
for (let o2 = e6; o2 < r2.length; ++o2) if (o2 !== e6 && (a2 += n2), a2 += r2[o2], t3 = i2[a2], t3 !== void 0) {
|
|
1133
|
+
if ([`string`, `number`, `boolean`].indexOf(typeof t3) > -1 && o2 < r2.length - 1) continue;
|
|
1134
|
+
e6 += o2 - e6 + 1;
|
|
1135
|
+
break;
|
|
1136
|
+
}
|
|
1137
|
+
i2 = t3;
|
|
1138
|
+
}
|
|
1139
|
+
return i2;
|
|
1140
|
+
};
|
|
1141
|
+
var V = (e5) => e5?.replace(/_/g, `-`);
|
|
1142
|
+
var nr = { type: `logger`, log(e5) {
|
|
1143
|
+
this.output(`log`, e5);
|
|
1144
|
+
}, warn(e5) {
|
|
1145
|
+
this.output(`warn`, e5);
|
|
1146
|
+
}, error(e5) {
|
|
1147
|
+
this.output(`error`, e5);
|
|
1148
|
+
}, output(e5, t2) {
|
|
1149
|
+
console?.[e5]?.apply?.(console, t2);
|
|
1150
|
+
} };
|
|
1151
|
+
var H = new class e2 {
|
|
1152
|
+
constructor(e5, t2 = {}) {
|
|
1153
|
+
this.init(e5, t2);
|
|
1154
|
+
}
|
|
1155
|
+
init(e5, t2 = {}) {
|
|
1156
|
+
this.prefix = t2.prefix || `i18next:`, this.logger = e5 || nr, this.options = t2, this.debug = t2.debug;
|
|
1157
|
+
}
|
|
1158
|
+
log(...e5) {
|
|
1159
|
+
return this.forward(e5, `log`, ``, true);
|
|
1160
|
+
}
|
|
1161
|
+
warn(...e5) {
|
|
1162
|
+
return this.forward(e5, `warn`, ``, true);
|
|
1163
|
+
}
|
|
1164
|
+
error(...e5) {
|
|
1165
|
+
return this.forward(e5, `error`, ``);
|
|
1166
|
+
}
|
|
1167
|
+
deprecate(...e5) {
|
|
1168
|
+
return this.forward(e5, `warn`, `WARNING DEPRECATED: `, true);
|
|
1169
|
+
}
|
|
1170
|
+
forward(e5, t2, n2, r2) {
|
|
1171
|
+
return r2 && !this.debug ? null : (F(e5[0]) && (e5[0] = `${n2}${this.prefix} ${e5[0]}`), this.logger[t2](e5));
|
|
1172
|
+
}
|
|
1173
|
+
create(t2) {
|
|
1174
|
+
return new e2(this.logger, { prefix: `${this.prefix}:${t2}:`, ...this.options });
|
|
1175
|
+
}
|
|
1176
|
+
clone(t2) {
|
|
1177
|
+
return t2 ||= this.options, t2.prefix = t2.prefix || this.prefix, new e2(this.logger, t2);
|
|
1178
|
+
}
|
|
1179
|
+
}();
|
|
1180
|
+
var U = class {
|
|
1181
|
+
constructor() {
|
|
1182
|
+
this.observers = {};
|
|
1183
|
+
}
|
|
1184
|
+
on(e5, t2) {
|
|
1185
|
+
return e5.split(` `).forEach((e6) => {
|
|
1186
|
+
this.observers[e6] || (this.observers[e6] = /* @__PURE__ */ new Map());
|
|
1187
|
+
let n2 = this.observers[e6].get(t2) || 0;
|
|
1188
|
+
this.observers[e6].set(t2, n2 + 1);
|
|
1189
|
+
}), this;
|
|
1190
|
+
}
|
|
1191
|
+
off(e5, t2) {
|
|
1192
|
+
if (this.observers[e5]) {
|
|
1193
|
+
if (!t2) {
|
|
1194
|
+
delete this.observers[e5];
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
this.observers[e5].delete(t2);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
emit(e5, ...t2) {
|
|
1201
|
+
this.observers[e5] && Array.from(this.observers[e5].entries()).forEach(([e6, n2]) => {
|
|
1202
|
+
for (let r2 = 0; r2 < n2; r2++) e6(...t2);
|
|
1203
|
+
}), this.observers[`*`] && Array.from(this.observers[`*`].entries()).forEach(([n2, r2]) => {
|
|
1204
|
+
for (let i2 = 0; i2 < r2; i2++) n2.apply(n2, [e5, ...t2]);
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
var rr = class extends U {
|
|
1209
|
+
constructor(e5, t2 = { ns: [`translation`], defaultNS: `translation` }) {
|
|
1210
|
+
super(), this.data = e5 || {}, this.options = t2, this.options.keySeparator === void 0 && (this.options.keySeparator = `.`), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = true);
|
|
1211
|
+
}
|
|
1212
|
+
addNamespaces(e5) {
|
|
1213
|
+
this.options.ns.indexOf(e5) < 0 && this.options.ns.push(e5);
|
|
1214
|
+
}
|
|
1215
|
+
removeNamespaces(e5) {
|
|
1216
|
+
let t2 = this.options.ns.indexOf(e5);
|
|
1217
|
+
t2 > -1 && this.options.ns.splice(t2, 1);
|
|
1218
|
+
}
|
|
1219
|
+
getResource(e5, t2, n2, r2 = {}) {
|
|
1220
|
+
let i2 = r2.keySeparator === void 0 ? this.options.keySeparator : r2.keySeparator, a2 = r2.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r2.ignoreJSONStructure, o2;
|
|
1221
|
+
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)));
|
|
1222
|
+
let s2 = R(this.data, o2);
|
|
1223
|
+
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);
|
|
1224
|
+
}
|
|
1225
|
+
addResource(e5, t2, n2, r2, i2 = { silent: false }) {
|
|
1226
|
+
let a2 = i2.keySeparator === void 0 ? this.options.keySeparator : i2.keySeparator, o2 = [e5, t2];
|
|
1227
|
+
n2 && (o2 = o2.concat(a2 ? n2.split(a2) : n2)), e5.indexOf(`.`) > -1 && (o2 = e5.split(`.`), r2 = t2, t2 = o2[1]), this.addNamespaces(t2), Kn(this.data, o2, r2), i2.silent || this.emit(`added`, e5, t2, n2, r2);
|
|
1228
|
+
}
|
|
1229
|
+
addResources(e5, t2, n2, r2 = { silent: false }) {
|
|
1230
|
+
for (let r3 in n2) (F(n2[r3]) || Array.isArray(n2[r3])) && this.addResource(e5, t2, r3, n2[r3], { silent: true });
|
|
1231
|
+
r2.silent || this.emit(`added`, e5, t2, n2);
|
|
1232
|
+
}
|
|
1233
|
+
addResourceBundle(e5, t2, n2, r2, i2, a2 = { silent: false, skipCopy: false }) {
|
|
1234
|
+
let o2 = [e5, t2];
|
|
1235
|
+
e5.indexOf(`.`) > -1 && (o2 = e5.split(`.`), r2 = n2, n2 = t2, t2 = o2[1]), this.addNamespaces(t2);
|
|
1236
|
+
let s2 = R(this.data, o2) || {};
|
|
1237
|
+
a2.skipCopy || (n2 = JSON.parse(JSON.stringify(n2))), r2 ? Yn(s2, n2, i2) : s2 = { ...s2, ...n2 }, Kn(this.data, o2, s2), a2.silent || this.emit(`added`, e5, t2, n2);
|
|
1238
|
+
}
|
|
1239
|
+
removeResourceBundle(e5, t2) {
|
|
1240
|
+
this.hasResourceBundle(e5, t2) && delete this.data[e5][t2], this.removeNamespaces(t2), this.emit(`removed`, e5, t2);
|
|
1241
|
+
}
|
|
1242
|
+
hasResourceBundle(e5, t2) {
|
|
1243
|
+
return this.getResource(e5, t2) !== void 0;
|
|
1244
|
+
}
|
|
1245
|
+
getResourceBundle(e5, t2) {
|
|
1246
|
+
return t2 ||= this.options.defaultNS, this.getResource(e5, t2);
|
|
1247
|
+
}
|
|
1248
|
+
getDataByLanguage(e5) {
|
|
1249
|
+
return this.data[e5];
|
|
1250
|
+
}
|
|
1251
|
+
hasLanguageSomeTranslations(e5) {
|
|
1252
|
+
let t2 = this.getDataByLanguage(e5);
|
|
1253
|
+
return !!(t2 && Object.keys(t2) || []).find((e6) => t2[e6] && Object.keys(t2[e6]).length > 0);
|
|
1254
|
+
}
|
|
1255
|
+
toJSON() {
|
|
1256
|
+
return this.data;
|
|
1257
|
+
}
|
|
1258
|
+
};
|
|
1259
|
+
var ir = { processors: {}, addPostProcessor(e5) {
|
|
1260
|
+
this.processors[e5.name] = e5;
|
|
1261
|
+
}, handle(e5, t2, n2, r2, i2) {
|
|
1262
|
+
return e5.forEach((e6) => {
|
|
1263
|
+
t2 = this.processors[e6]?.process(t2, n2, r2, i2) ?? t2;
|
|
1264
|
+
}), t2;
|
|
1265
|
+
} };
|
|
1266
|
+
var ar = Symbol(`i18next/PATH_KEY`);
|
|
1267
|
+
function or() {
|
|
1268
|
+
let e5 = [], t2 = /* @__PURE__ */ Object.create(null), n2;
|
|
1269
|
+
return t2.get = (r2, i2) => (n2?.revoke?.(), i2 === ar ? e5 : (e5.push(i2), n2 = Proxy.revocable(r2, t2), n2.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), t2).proxy;
|
|
1270
|
+
}
|
|
1271
|
+
function W(e5, t2) {
|
|
1272
|
+
let { [ar]: n2 } = e5(or()), r2 = t2?.keySeparator ?? `.`, i2 = t2?.nsSeparator ?? `:`;
|
|
1273
|
+
if (n2.length > 1 && i2) {
|
|
1274
|
+
let e6 = t2?.ns, a2 = Array.isArray(e6) ? e6 : null;
|
|
1275
|
+
if (a2 && a2.length > 1 && a2.slice(1).includes(n2[0])) return `${n2[0]}${i2}${n2.slice(1).join(r2)}`;
|
|
1276
|
+
}
|
|
1277
|
+
return n2.join(r2);
|
|
1278
|
+
}
|
|
1279
|
+
var sr = {};
|
|
1280
|
+
var cr = (e5) => !F(e5) && typeof e5 != `boolean` && typeof e5 != `number`;
|
|
1281
|
+
var lr = class e3 extends U {
|
|
1282
|
+
constructor(e5, t2 = {}) {
|
|
1283
|
+
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`);
|
|
1284
|
+
}
|
|
1285
|
+
changeLanguage(e5) {
|
|
1286
|
+
e5 && (this.language = e5);
|
|
1287
|
+
}
|
|
1288
|
+
exists(e5, t2 = { interpolation: {} }) {
|
|
1289
|
+
let n2 = { ...t2 };
|
|
1290
|
+
if (e5 == null) return false;
|
|
1291
|
+
let r2 = this.resolve(e5, n2);
|
|
1292
|
+
if (r2?.res === void 0) return false;
|
|
1293
|
+
let i2 = cr(r2.res);
|
|
1294
|
+
return !(n2.returnObjects === false && i2);
|
|
1295
|
+
}
|
|
1296
|
+
extractFromKey(e5, t2) {
|
|
1297
|
+
let n2 = t2.nsSeparator === void 0 ? this.options.nsSeparator : t2.nsSeparator;
|
|
1298
|
+
n2 === void 0 && (n2 = `:`);
|
|
1299
|
+
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 && !tr(e5, n2, r2);
|
|
1300
|
+
if (a2 && !o2) {
|
|
1301
|
+
let t3 = e5.match(this.interpolator.nestingRegexp);
|
|
1302
|
+
if (t3 && t3.length > 0) return { key: e5, namespaces: F(i2) ? [i2] : i2 };
|
|
1303
|
+
let a3 = e5.split(n2);
|
|
1304
|
+
(n2 !== r2 || n2 === r2 && this.options.ns.indexOf(a3[0]) > -1) && (i2 = a3.shift()), e5 = a3.join(r2);
|
|
1305
|
+
}
|
|
1306
|
+
return { key: e5, namespaces: F(i2) ? [i2] : i2 };
|
|
1307
|
+
}
|
|
1308
|
+
translate(t2, n2, r2) {
|
|
1309
|
+
let i2 = typeof n2 == `object` ? { ...n2 } : n2;
|
|
1310
|
+
if (typeof i2 != `object` && this.options.overloadTranslationOptionHandler && (i2 = this.options.overloadTranslationOptionHandler(arguments)), typeof i2 == `object` && (i2 = { ...i2 }), i2 ||= {}, t2 == null) return ``;
|
|
1311
|
+
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));
|
|
1312
|
+
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;
|
|
1313
|
+
u2 === void 0 && (u2 = `:`);
|
|
1314
|
+
let d2 = i2.lng || this.language, f2 = i2.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
1315
|
+
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;
|
|
1316
|
+
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), ee2 = b2 ? this.pluralResolver.getSuffix(d2, i2.count, i2) : ``, te2 = i2.ordinal && b2 ? this.pluralResolver.getSuffix(d2, i2.count, { ordinal: false }) : ``, ne2 = b2 && !i2.ordinal && i2.count === 0, S2 = ne2 && i2[`defaultValue${this.options.pluralSeparator}zero`] || i2[`defaultValue${ee2}`] || i2[`defaultValue${te2}`] || i2.defaultValue, C2 = m2;
|
|
1317
|
+
y2 && !m2 && x2 && (C2 = S2);
|
|
1318
|
+
let re2 = cr(C2), ie2 = Object.prototype.toString.apply(C2);
|
|
1319
|
+
if (y2 && C2 && re2 && _2.indexOf(ie2) < 0 && !(F(v2) && Array.isArray(C2))) {
|
|
1320
|
+
if (!i2.returnObjects && !this.options.returnObjects) {
|
|
1321
|
+
this.options.returnedObjectHandler || this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);
|
|
1322
|
+
let e5 = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h2, C2, { ...i2, ns: c2 }) : `key '${s2} (${this.language})' returned an object instead of string.`;
|
|
1323
|
+
return a2 ? (p2.res = e5, p2.usedParams = this.getUsedParamsDetails(i2), p2) : e5;
|
|
1324
|
+
}
|
|
1325
|
+
if (o2) {
|
|
1326
|
+
let e5 = Array.isArray(C2), t3 = e5 ? [] : {}, n3 = e5 ? g2 : h2;
|
|
1327
|
+
for (let e6 in C2) if (Object.prototype.hasOwnProperty.call(C2, e6)) {
|
|
1328
|
+
let r3 = `${n3}${o2}${e6}`;
|
|
1329
|
+
t3[e6] = x2 && !m2 ? this.translate(r3, { ...i2, defaultValue: cr(S2) ? S2[e6] : void 0, joinArrays: false, ns: c2 }) : this.translate(r3, { ...i2, joinArrays: false, ns: c2 }), t3[e6] === r3 && (t3[e6] = C2[e6]);
|
|
1330
|
+
}
|
|
1331
|
+
m2 = t3;
|
|
1332
|
+
}
|
|
1333
|
+
} else if (y2 && F(v2) && Array.isArray(m2)) m2 = m2.join(v2), m2 &&= this.extendTranslation(m2, t2, i2, r2);
|
|
1334
|
+
else {
|
|
1335
|
+
let e5 = false, n3 = false;
|
|
1336
|
+
!this.isValidLookup(m2) && x2 && (e5 = true, m2 = S2), this.isValidLookup(m2) || (n3 = true, m2 = s2);
|
|
1337
|
+
let a3 = (i2.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n3 ? void 0 : m2, c3 = x2 && S2 !== m2 && this.options.updateMissing;
|
|
1338
|
+
if (n3 || e5 || c3) {
|
|
1339
|
+
if (this.logger.log(c3 ? `updateKey` : `missingKey`, d2, l2, s2, c3 ? S2 : m2), o2) {
|
|
1340
|
+
let e7 = this.resolve(s2, { ...i2, keySeparator: false });
|
|
1341
|
+
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.`);
|
|
1342
|
+
}
|
|
1343
|
+
let e6 = [], t3 = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i2.lng || this.language);
|
|
1344
|
+
if (this.options.saveMissingTo === `fallback` && t3 && t3[0]) for (let n5 = 0; n5 < t3.length; n5++) e6.push(t3[n5]);
|
|
1345
|
+
else this.options.saveMissingTo === `all` ? e6 = this.languageUtils.toResolveHierarchy(i2.lng || this.language) : e6.push(i2.lng || this.language);
|
|
1346
|
+
let n4 = (e7, t4, n5) => {
|
|
1347
|
+
let r3 = x2 && n5 !== m2 ? n5 : a3;
|
|
1348
|
+
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);
|
|
1349
|
+
};
|
|
1350
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && b2 ? e6.forEach((e7) => {
|
|
1351
|
+
let t4 = this.pluralResolver.getSuffixes(e7, i2);
|
|
1352
|
+
ne2 && i2[`defaultValue${this.options.pluralSeparator}zero`] && t4.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t4.push(`${this.options.pluralSeparator}zero`), t4.forEach((t5) => {
|
|
1353
|
+
n4([e7], s2 + t5, i2[`defaultValue${t5}`] || S2);
|
|
1354
|
+
});
|
|
1355
|
+
}) : n4(e6, s2, S2));
|
|
1356
|
+
}
|
|
1357
|
+
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));
|
|
1358
|
+
}
|
|
1359
|
+
return a2 ? (p2.res = m2, p2.usedParams = this.getUsedParamsDetails(i2), p2) : m2;
|
|
1360
|
+
}
|
|
1361
|
+
extendTranslation(e5, t2, n2, r2, i2) {
|
|
1362
|
+
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 });
|
|
1363
|
+
else if (!n2.skipInterpolation) {
|
|
1364
|
+
n2.interpolation && this.interpolator.init({ ...n2, interpolation: { ...this.options.interpolation, ...n2.interpolation } });
|
|
1365
|
+
let a3 = F(e5) && (n2?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n2.interpolation.skipOnVariables), o3;
|
|
1366
|
+
if (a3) {
|
|
1367
|
+
let t3 = e5.match(this.interpolator.nestingRegexp);
|
|
1368
|
+
o3 = t3 && t3.length;
|
|
1369
|
+
}
|
|
1370
|
+
let s2 = n2.replace && !F(n2.replace) ? n2.replace : n2;
|
|
1371
|
+
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) {
|
|
1372
|
+
let t3 = e5.match(this.interpolator.nestingRegexp), r3 = t3 && t3.length;
|
|
1373
|
+
o3 < r3 && (n2.nest = false);
|
|
1374
|
+
}
|
|
1375
|
+
!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();
|
|
1376
|
+
}
|
|
1377
|
+
let a2 = n2.postProcess || this.options.postProcess, o2 = F(a2) ? [a2] : a2;
|
|
1378
|
+
return e5 != null && o2?.length && n2.applyPostProcessor !== false && (e5 = ir.handle(o2, e5, t2, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...r2, usedParams: this.getUsedParamsDetails(n2) }, ...n2 } : n2, this)), e5;
|
|
1379
|
+
}
|
|
1380
|
+
resolve(e5, t2 = {}) {
|
|
1381
|
+
let n2, r2, i2, a2, o2;
|
|
1382
|
+
return F(e5) && (e5 = [e5]), Array.isArray(e5) && (e5 = e5.map((e6) => typeof e6 == `function` ? W(e6, { ...this.options, ...t2 }) : e6)), e5.forEach((e6) => {
|
|
1383
|
+
if (this.isValidLookup(n2)) return;
|
|
1384
|
+
let s2 = this.extractFromKey(e6, t2), c2 = s2.key;
|
|
1385
|
+
r2 = c2;
|
|
1386
|
+
let l2 = s2.namespaces;
|
|
1387
|
+
this.options.fallbackNS && (l2 = l2.concat(this.options.fallbackNS));
|
|
1388
|
+
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);
|
|
1389
|
+
l2.forEach((e7) => {
|
|
1390
|
+
this.isValidLookup(n2) || (o2 = e7, !sr[`${p2[0]}-${e7}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o2) && (sr[`${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) => {
|
|
1391
|
+
if (this.isValidLookup(n2)) return;
|
|
1392
|
+
a2 = r3;
|
|
1393
|
+
let o3 = [c2];
|
|
1394
|
+
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o3, c2, r3, e7, t2);
|
|
1395
|
+
else {
|
|
1396
|
+
let e8;
|
|
1397
|
+
u2 && (e8 = this.pluralResolver.getSuffix(r3, t2.count, t2));
|
|
1398
|
+
let n3 = `${this.options.pluralSeparator}zero`, i3 = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
1399
|
+
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) {
|
|
1400
|
+
let r4 = `${c2}${this.options.contextSeparator || `_`}${t2.context}`;
|
|
1401
|
+
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));
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
let s3;
|
|
1405
|
+
for (; s3 = o3.pop(); ) this.isValidLookup(n2) || (i2 = s3, n2 = this.getResource(r3, e7, s3, t2));
|
|
1406
|
+
}));
|
|
1407
|
+
});
|
|
1408
|
+
}), { res: n2, usedKey: r2, exactUsedKey: i2, usedLng: a2, usedNS: o2 };
|
|
1409
|
+
}
|
|
1410
|
+
isValidLookup(e5) {
|
|
1411
|
+
return e5 !== void 0 && !(!this.options.returnNull && e5 === null) && !(!this.options.returnEmptyString && e5 === ``);
|
|
1412
|
+
}
|
|
1413
|
+
getResource(e5, t2, n2, r2 = {}) {
|
|
1414
|
+
return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e5, t2, n2, r2) : this.resourceStore.getResource(e5, t2, n2, r2);
|
|
1415
|
+
}
|
|
1416
|
+
getUsedParamsDetails(e5 = {}) {
|
|
1417
|
+
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;
|
|
1418
|
+
if (n2 && e5.count !== void 0 && (r2.count = e5.count), this.options.interpolation.defaultVariables && (r2 = { ...this.options.interpolation.defaultVariables, ...r2 }), !n2) {
|
|
1419
|
+
r2 = { ...r2 };
|
|
1420
|
+
for (let e6 of t2) delete r2[e6];
|
|
1421
|
+
}
|
|
1422
|
+
return r2;
|
|
1423
|
+
}
|
|
1424
|
+
static hasDefaultValue(e5) {
|
|
1425
|
+
for (let t2 in e5) if (Object.prototype.hasOwnProperty.call(e5, t2) && t2.substring(0, 12) === `defaultValue` && e5[t2] !== void 0) return true;
|
|
1426
|
+
return false;
|
|
1427
|
+
}
|
|
1428
|
+
};
|
|
1429
|
+
var ur = class {
|
|
1430
|
+
constructor(e5) {
|
|
1431
|
+
this.options = e5, this.supportedLngs = this.options.supportedLngs || false, this.logger = H.create(`languageUtils`);
|
|
1432
|
+
}
|
|
1433
|
+
getScriptPartFromCode(e5) {
|
|
1434
|
+
if (e5 = V(e5), !e5 || e5.indexOf(`-`) < 0) return null;
|
|
1435
|
+
let t2 = e5.split(`-`);
|
|
1436
|
+
return t2.length === 2 || (t2.pop(), t2[t2.length - 1].toLowerCase() === `x`) ? null : this.formatLanguageCode(t2.join(`-`));
|
|
1437
|
+
}
|
|
1438
|
+
getLanguagePartFromCode(e5) {
|
|
1439
|
+
if (e5 = V(e5), !e5 || e5.indexOf(`-`) < 0) return e5;
|
|
1440
|
+
let t2 = e5.split(`-`);
|
|
1441
|
+
return this.formatLanguageCode(t2[0]);
|
|
1442
|
+
}
|
|
1443
|
+
formatLanguageCode(e5) {
|
|
1444
|
+
if (F(e5) && e5.indexOf(`-`) > -1) {
|
|
1445
|
+
let t2;
|
|
1446
|
+
try {
|
|
1447
|
+
t2 = Intl.getCanonicalLocales(e5)[0];
|
|
1448
|
+
} catch {
|
|
1449
|
+
}
|
|
1450
|
+
return t2 && this.options.lowerCaseLng && (t2 = t2.toLowerCase()), t2 || (this.options.lowerCaseLng ? e5.toLowerCase() : e5);
|
|
1451
|
+
}
|
|
1452
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? e5.toLowerCase() : e5;
|
|
1453
|
+
}
|
|
1454
|
+
isSupportedCode(e5) {
|
|
1455
|
+
return (this.options.load === `languageOnly` || this.options.nonExplicitSupportedLngs) && (e5 = this.getLanguagePartFromCode(e5)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e5) > -1;
|
|
1456
|
+
}
|
|
1457
|
+
getBestMatchFromCodes(e5) {
|
|
1458
|
+
if (!e5) return null;
|
|
1459
|
+
let t2;
|
|
1460
|
+
return e5.forEach((e6) => {
|
|
1461
|
+
if (t2) return;
|
|
1462
|
+
let n2 = this.formatLanguageCode(e6);
|
|
1463
|
+
(!this.options.supportedLngs || this.isSupportedCode(n2)) && (t2 = n2);
|
|
1464
|
+
}), !t2 && this.options.supportedLngs && e5.forEach((e6) => {
|
|
1465
|
+
if (t2) return;
|
|
1466
|
+
let n2 = this.getScriptPartFromCode(e6);
|
|
1467
|
+
if (this.isSupportedCode(n2)) return t2 = n2;
|
|
1468
|
+
let r2 = this.getLanguagePartFromCode(e6);
|
|
1469
|
+
if (this.isSupportedCode(r2)) return t2 = r2;
|
|
1470
|
+
t2 = this.options.supportedLngs.find((e7) => {
|
|
1471
|
+
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;
|
|
1472
|
+
});
|
|
1473
|
+
}), t2 ||= this.getFallbackCodes(this.options.fallbackLng)[0], t2;
|
|
1474
|
+
}
|
|
1475
|
+
getFallbackCodes(e5, t2) {
|
|
1476
|
+
if (!e5) return [];
|
|
1477
|
+
if (typeof e5 == `function` && (e5 = e5(t2)), F(e5) && (e5 = [e5]), Array.isArray(e5)) return e5;
|
|
1478
|
+
if (!t2) return e5.default || [];
|
|
1479
|
+
let n2 = e5[t2];
|
|
1480
|
+
return n2 ||= e5[this.getScriptPartFromCode(t2)], n2 ||= e5[this.formatLanguageCode(t2)], n2 ||= e5[this.getLanguagePartFromCode(t2)], n2 ||= e5.default, n2 || [];
|
|
1481
|
+
}
|
|
1482
|
+
toResolveHierarchy(e5, t2) {
|
|
1483
|
+
let n2 = this.getFallbackCodes((t2 === false ? [] : t2) || this.options.fallbackLng || [], e5), r2 = [], i2 = (e6) => {
|
|
1484
|
+
e6 && (this.isSupportedCode(e6) ? r2.push(e6) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e6}`));
|
|
1485
|
+
};
|
|
1486
|
+
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) => {
|
|
1487
|
+
r2.indexOf(e6) < 0 && i2(this.formatLanguageCode(e6));
|
|
1488
|
+
}), r2;
|
|
1489
|
+
}
|
|
1490
|
+
};
|
|
1491
|
+
var dr = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 };
|
|
1492
|
+
var fr = { select: (e5) => e5 === 1 ? `one` : `other`, resolvedOptions: () => ({ pluralCategories: [`one`, `other`] }) };
|
|
1493
|
+
var pr = class {
|
|
1494
|
+
constructor(e5, t2 = {}) {
|
|
1495
|
+
this.languageUtils = e5, this.options = t2, this.logger = H.create(`pluralResolver`), this.pluralRulesCache = {};
|
|
1496
|
+
}
|
|
1497
|
+
clearCache() {
|
|
1498
|
+
this.pluralRulesCache = {};
|
|
1499
|
+
}
|
|
1500
|
+
getRule(e5, t2 = {}) {
|
|
1501
|
+
let n2 = V(e5 === `dev` ? `en` : e5), r2 = t2.ordinal ? `ordinal` : `cardinal`, i2 = JSON.stringify({ cleanedCode: n2, type: r2 });
|
|
1502
|
+
if (i2 in this.pluralRulesCache) return this.pluralRulesCache[i2];
|
|
1503
|
+
let a2;
|
|
1504
|
+
try {
|
|
1505
|
+
a2 = new Intl.PluralRules(n2, { type: r2 });
|
|
1506
|
+
} catch {
|
|
1507
|
+
if (typeof Intl > `u`) return this.logger.error(`No Intl support, please use an Intl polyfill!`), fr;
|
|
1508
|
+
if (!e5.match(/-|_/)) return fr;
|
|
1509
|
+
let n3 = this.languageUtils.getLanguagePartFromCode(e5);
|
|
1510
|
+
a2 = this.getRule(n3, t2);
|
|
1511
|
+
}
|
|
1512
|
+
return this.pluralRulesCache[i2] = a2, a2;
|
|
1513
|
+
}
|
|
1514
|
+
needsPlural(e5, t2 = {}) {
|
|
1515
|
+
let n2 = this.getRule(e5, t2);
|
|
1516
|
+
return n2 ||= this.getRule(`dev`, t2), n2?.resolvedOptions().pluralCategories.length > 1;
|
|
1517
|
+
}
|
|
1518
|
+
getPluralFormsOfKey(e5, t2, n2 = {}) {
|
|
1519
|
+
return this.getSuffixes(e5, n2).map((e6) => `${t2}${e6}`);
|
|
1520
|
+
}
|
|
1521
|
+
getSuffixes(e5, t2 = {}) {
|
|
1522
|
+
let n2 = this.getRule(e5, t2);
|
|
1523
|
+
return n2 ||= this.getRule(`dev`, t2), n2 ? n2.resolvedOptions().pluralCategories.sort((e6, t3) => dr[e6] - dr[t3]).map((e6) => `${this.options.prepend}${t2.ordinal ? `ordinal${this.options.prepend}` : ``}${e6}`) : [];
|
|
1524
|
+
}
|
|
1525
|
+
getSuffix(e5, t2, n2 = {}) {
|
|
1526
|
+
let r2 = this.getRule(e5, n2);
|
|
1527
|
+
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));
|
|
1528
|
+
}
|
|
1529
|
+
};
|
|
1530
|
+
var mr = (e5, t2, n2, r2 = `.`, i2 = true) => {
|
|
1531
|
+
let a2 = Jn(e5, t2, n2);
|
|
1532
|
+
return !a2 && i2 && F(n2) && (a2 = B(e5, n2, r2), a2 === void 0 && (a2 = B(t2, n2, r2))), a2;
|
|
1533
|
+
};
|
|
1534
|
+
var hr = (e5) => e5.replace(/\$/g, `$$$$`);
|
|
1535
|
+
var gr = class {
|
|
1536
|
+
constructor(e5 = {}) {
|
|
1537
|
+
this.logger = H.create(`interpolator`), this.options = e5, this.format = e5?.interpolation?.format || ((e6) => e6), this.init(e5);
|
|
1538
|
+
}
|
|
1539
|
+
init(e5 = {}) {
|
|
1540
|
+
e5.interpolation ||= { escapeValue: true };
|
|
1541
|
+
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;
|
|
1542
|
+
this.escape = t2 === void 0 ? Zn : 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();
|
|
1543
|
+
}
|
|
1544
|
+
reset() {
|
|
1545
|
+
this.options && this.init(this.options);
|
|
1546
|
+
}
|
|
1547
|
+
resetRegExp() {
|
|
1548
|
+
let e5 = (e6, t2) => e6?.source === t2 ? (e6.lastIndex = 0, e6) : new RegExp(t2, `g`);
|
|
1549
|
+
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}`);
|
|
1550
|
+
}
|
|
1551
|
+
interpolate(e5, t2, n2, r2) {
|
|
1552
|
+
let i2, a2, o2, s2 = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c2 = (e6) => {
|
|
1553
|
+
if (e6.indexOf(this.formatSeparator) < 0) {
|
|
1554
|
+
let i4 = mr(t2, s2, e6, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
1555
|
+
return this.alwaysFormat ? this.format(i4, void 0, n2, { ...r2, ...t2, interpolationkey: e6 }) : i4;
|
|
1556
|
+
}
|
|
1557
|
+
let i3 = e6.split(this.formatSeparator), a3 = i3.shift().trim(), o3 = i3.join(this.formatSeparator).trim();
|
|
1558
|
+
return this.format(mr(t2, s2, a3, this.options.keySeparator, this.options.ignoreJSONStructure), o3, n2, { ...r2, ...t2, interpolationkey: a3 });
|
|
1559
|
+
};
|
|
1560
|
+
this.resetRegExp();
|
|
1561
|
+
let l2 = r2?.missingInterpolationHandler || this.options.missingInterpolationHandler, u2 = r2?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r2.interpolation.skipOnVariables;
|
|
1562
|
+
return [{ regex: this.regexpUnescape, safeValue: (e6) => hr(e6) }, { regex: this.regexp, safeValue: (e6) => this.escapeValue ? hr(this.escape(e6)) : hr(e6) }].forEach((t3) => {
|
|
1563
|
+
for (o2 = 0; i2 = t3.regex.exec(e5); ) {
|
|
1564
|
+
let n3 = i2[1].trim();
|
|
1565
|
+
if (a2 = c2(n3), a2 === void 0) {
|
|
1566
|
+
if (typeof l2 == `function`) {
|
|
1567
|
+
let t4 = l2(e5, i2, r2);
|
|
1568
|
+
a2 = F(t4) ? t4 : ``;
|
|
1569
|
+
} else if (r2 && Object.prototype.hasOwnProperty.call(r2, n3)) a2 = ``;
|
|
1570
|
+
else if (u2) {
|
|
1571
|
+
a2 = i2[0];
|
|
1572
|
+
continue;
|
|
1573
|
+
} else this.logger.warn(`missed to pass in variable ${n3} for interpolating ${e5}`), a2 = ``;
|
|
1574
|
+
} else !F(a2) && !this.useRawValueToEscape && (a2 = Vn(a2));
|
|
1575
|
+
let s3 = t3.safeValue(a2);
|
|
1576
|
+
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;
|
|
1577
|
+
}
|
|
1578
|
+
}), e5;
|
|
1579
|
+
}
|
|
1580
|
+
nest(e5, t2, n2 = {}) {
|
|
1581
|
+
let r2, i2, a2, o2 = (e6, t3) => {
|
|
1582
|
+
let n3 = this.nestingOptionsSeparator;
|
|
1583
|
+
if (e6.indexOf(n3) < 0) return e6;
|
|
1584
|
+
let r3 = e6.split(RegExp(`${z(n3)}[ ]*{`)), i3 = `{${r3[1]}`;
|
|
1585
|
+
e6 = r3[0], i3 = this.interpolate(i3, a2);
|
|
1586
|
+
let o3 = i3.match(/'/g), s2 = i3.match(/"/g);
|
|
1587
|
+
((o3?.length ?? 0) % 2 == 0 && !s2 || (s2?.length ?? 0) % 2 != 0) && (i3 = i3.replace(/'/g, `"`));
|
|
1588
|
+
try {
|
|
1589
|
+
a2 = JSON.parse(i3), t3 && (a2 = { ...t3, ...a2 });
|
|
1590
|
+
} catch (t4) {
|
|
1591
|
+
return this.logger.warn(`failed parsing options string in nesting for key ${e6}`, t4), `${e6}${n3}${i3}`;
|
|
1592
|
+
}
|
|
1593
|
+
return a2.defaultValue && a2.defaultValue.indexOf(this.prefix) > -1 && delete a2.defaultValue, e6;
|
|
1594
|
+
};
|
|
1595
|
+
for (; r2 = this.nestingRegexp.exec(e5); ) {
|
|
1596
|
+
let s2 = [];
|
|
1597
|
+
a2 = { ...n2 }, a2 = a2.replace && !F(a2.replace) ? a2.replace : a2, a2.applyPostProcessor = false, delete a2.defaultValue;
|
|
1598
|
+
let c2 = /{.*}/.test(r2[1]) ? r2[1].lastIndexOf(`}`) + 1 : r2[1].indexOf(this.formatSeparator);
|
|
1599
|
+
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;
|
|
1600
|
+
F(i2) || (i2 = Vn(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;
|
|
1601
|
+
}
|
|
1602
|
+
return e5;
|
|
1603
|
+
}
|
|
1604
|
+
};
|
|
1605
|
+
var _r = (e5) => {
|
|
1606
|
+
let t2 = e5.toLowerCase().trim(), n2 = {};
|
|
1607
|
+
if (e5.indexOf(`(`) > -1) {
|
|
1608
|
+
let r2 = e5.split(`(`);
|
|
1609
|
+
t2 = r2[0].toLowerCase().trim();
|
|
1610
|
+
let i2 = r2[1].substring(0, r2[1].length - 1);
|
|
1611
|
+
t2 === `currency` && i2.indexOf(`:`) < 0 ? n2.currency ||= i2.trim() : t2 === `relativetime` && i2.indexOf(`:`) < 0 ? n2.range ||= i2.trim() : i2.split(`;`).forEach((e6) => {
|
|
1612
|
+
if (e6) {
|
|
1613
|
+
let [t3, ...r3] = e6.split(`:`), i3 = r3.join(`:`).trim().replace(/^'+|'+$/g, ``), a2 = t3.trim();
|
|
1614
|
+
n2[a2] || (n2[a2] = i3), i3 === `false` && (n2[a2] = false), i3 === `true` && (n2[a2] = true), isNaN(i3) || (n2[a2] = parseInt(i3, 10));
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
return { formatName: t2, formatOptions: n2 };
|
|
1619
|
+
};
|
|
1620
|
+
var vr = (e5) => {
|
|
1621
|
+
let t2 = {};
|
|
1622
|
+
return (n2, r2, i2) => {
|
|
1623
|
+
let a2 = i2;
|
|
1624
|
+
i2 && i2.interpolationkey && i2.formatParams && i2.formatParams[i2.interpolationkey] && i2[i2.interpolationkey] && (a2 = { ...a2, [i2.interpolationkey]: void 0 });
|
|
1625
|
+
let o2 = r2 + JSON.stringify(a2), s2 = t2[o2];
|
|
1626
|
+
return s2 || (s2 = e5(V(r2), i2), t2[o2] = s2), s2(n2);
|
|
1627
|
+
};
|
|
1628
|
+
};
|
|
1629
|
+
var yr = (e5) => (t2, n2, r2) => e5(V(n2), r2)(t2);
|
|
1630
|
+
var br = class {
|
|
1631
|
+
constructor(e5 = {}) {
|
|
1632
|
+
this.logger = H.create(`formatter`), this.options = e5, this.init(e5);
|
|
1633
|
+
}
|
|
1634
|
+
init(e5, t2 = { interpolation: {} }) {
|
|
1635
|
+
this.formatSeparator = t2.interpolation.formatSeparator || `,`;
|
|
1636
|
+
let n2 = t2.cacheInBuiltFormats ? vr : yr;
|
|
1637
|
+
this.formats = { number: n2((e6, t3) => {
|
|
1638
|
+
let n3 = new Intl.NumberFormat(e6, { ...t3 });
|
|
1639
|
+
return (e7) => n3.format(e7);
|
|
1640
|
+
}), currency: n2((e6, t3) => {
|
|
1641
|
+
let n3 = new Intl.NumberFormat(e6, { ...t3, style: `currency` });
|
|
1642
|
+
return (e7) => n3.format(e7);
|
|
1643
|
+
}), datetime: n2((e6, t3) => {
|
|
1644
|
+
let n3 = new Intl.DateTimeFormat(e6, { ...t3 });
|
|
1645
|
+
return (e7) => n3.format(e7);
|
|
1646
|
+
}), relativetime: n2((e6, t3) => {
|
|
1647
|
+
let n3 = new Intl.RelativeTimeFormat(e6, { ...t3 });
|
|
1648
|
+
return (e7) => n3.format(e7, t3.range || `day`);
|
|
1649
|
+
}), list: n2((e6, t3) => {
|
|
1650
|
+
let n3 = new Intl.ListFormat(e6, { ...t3 });
|
|
1651
|
+
return (e7) => n3.format(e7);
|
|
1652
|
+
}) };
|
|
1653
|
+
}
|
|
1654
|
+
add(e5, t2) {
|
|
1655
|
+
this.formats[e5.toLowerCase().trim()] = t2;
|
|
1656
|
+
}
|
|
1657
|
+
addCached(e5, t2) {
|
|
1658
|
+
this.formats[e5.toLowerCase().trim()] = vr(t2);
|
|
1659
|
+
}
|
|
1660
|
+
format(e5, t2, n2, r2 = {}) {
|
|
1661
|
+
let i2 = t2.split(this.formatSeparator);
|
|
1662
|
+
if (i2.length > 1 && i2[0].indexOf(`(`) > 1 && i2[0].indexOf(`)`) < 0 && i2.find((e6) => e6.indexOf(`)`) > -1)) {
|
|
1663
|
+
let e6 = i2.findIndex((e7) => e7.indexOf(`)`) > -1);
|
|
1664
|
+
i2[0] = [i2[0], ...i2.splice(1, e6)].join(this.formatSeparator);
|
|
1665
|
+
}
|
|
1666
|
+
return i2.reduce((e6, t3) => {
|
|
1667
|
+
let { formatName: i3, formatOptions: a2 } = _r(t3);
|
|
1668
|
+
if (this.formats[i3]) {
|
|
1669
|
+
let t4 = e6;
|
|
1670
|
+
try {
|
|
1671
|
+
let o2 = r2?.formatParams?.[r2.interpolationkey] || {}, s2 = o2.locale || o2.lng || r2.locale || r2.lng || n2;
|
|
1672
|
+
t4 = this.formats[i3](e6, s2, { ...a2, ...r2, ...o2 });
|
|
1673
|
+
} catch (e7) {
|
|
1674
|
+
this.logger.warn(e7);
|
|
1675
|
+
}
|
|
1676
|
+
return t4;
|
|
1677
|
+
}
|
|
1678
|
+
return this.logger.warn(`there was no format function for ${i3}`), e6;
|
|
1679
|
+
}, e5);
|
|
1680
|
+
}
|
|
1681
|
+
};
|
|
1682
|
+
var xr = (e5, t2) => {
|
|
1683
|
+
e5.pending[t2] !== void 0 && (delete e5.pending[t2], e5.pendingCount--);
|
|
1684
|
+
};
|
|
1685
|
+
var Sr = class extends U {
|
|
1686
|
+
constructor(e5, t2, n2, r2 = {}) {
|
|
1687
|
+
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);
|
|
1688
|
+
}
|
|
1689
|
+
queueLoad(e5, t2, n2, r2) {
|
|
1690
|
+
let i2 = {}, a2 = {}, o2 = {}, s2 = {};
|
|
1691
|
+
return e5.forEach((e6) => {
|
|
1692
|
+
let r3 = true;
|
|
1693
|
+
t2.forEach((t3) => {
|
|
1694
|
+
let o3 = `${e6}|${t3}`;
|
|
1695
|
+
!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)));
|
|
1696
|
+
}), r3 || (o2[e6] = true);
|
|
1697
|
+
}), (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) };
|
|
1698
|
+
}
|
|
1699
|
+
loaded(e5, t2, n2) {
|
|
1700
|
+
let r2 = e5.split(`|`), i2 = r2[0], a2 = r2[1];
|
|
1701
|
+
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);
|
|
1702
|
+
let o2 = {};
|
|
1703
|
+
this.queue.forEach((n3) => {
|
|
1704
|
+
qn(n3.loaded, [i2], a2), xr(n3, e5), t2 && n3.errors.push(t2), n3.pendingCount === 0 && !n3.done && (Object.keys(n3.loaded).forEach((e6) => {
|
|
1705
|
+
o2[e6] || (o2[e6] = {});
|
|
1706
|
+
let t3 = n3.loaded[e6];
|
|
1707
|
+
t3.length && t3.forEach((t4) => {
|
|
1708
|
+
o2[e6][t4] === void 0 && (o2[e6][t4] = true);
|
|
1709
|
+
});
|
|
1710
|
+
}), n3.done = true, n3.errors.length ? n3.callback(n3.errors) : n3.callback());
|
|
1711
|
+
}), this.emit(`loaded`, o2), this.queue = this.queue.filter((e6) => !e6.done);
|
|
1712
|
+
}
|
|
1713
|
+
read(e5, t2, n2, r2 = 0, i2 = this.retryTimeout, a2) {
|
|
1714
|
+
if (!e5.length) return a2(null, {});
|
|
1715
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
1716
|
+
this.waitingReads.push({ lng: e5, ns: t2, fcName: n2, tried: r2, wait: i2, callback: a2 });
|
|
1717
|
+
return;
|
|
1718
|
+
}
|
|
1719
|
+
this.readingCalls++;
|
|
1720
|
+
let o2 = (o3, s3) => {
|
|
1721
|
+
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
1722
|
+
let e6 = this.waitingReads.shift();
|
|
1723
|
+
this.read(e6.lng, e6.ns, e6.fcName, e6.tried, e6.wait, e6.callback);
|
|
1724
|
+
}
|
|
1725
|
+
if (o3 && s3 && r2 < this.maxRetries) {
|
|
1726
|
+
setTimeout(() => {
|
|
1727
|
+
this.read.call(this, e5, t2, n2, r2 + 1, i2 * 2, a2);
|
|
1728
|
+
}, i2);
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1731
|
+
a2(o3, s3);
|
|
1732
|
+
}, s2 = this.backend[n2].bind(this.backend);
|
|
1733
|
+
if (s2.length === 2) {
|
|
1734
|
+
try {
|
|
1735
|
+
let n3 = s2(e5, t2);
|
|
1736
|
+
n3 && typeof n3.then == `function` ? n3.then((e6) => o2(null, e6)).catch(o2) : o2(null, n3);
|
|
1737
|
+
} catch (e6) {
|
|
1738
|
+
o2(e6);
|
|
1739
|
+
}
|
|
1740
|
+
return;
|
|
1741
|
+
}
|
|
1742
|
+
return s2(e5, t2, o2);
|
|
1743
|
+
}
|
|
1744
|
+
prepareLoading(e5, t2, n2 = {}, r2) {
|
|
1745
|
+
if (!this.backend) return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`), r2 && r2();
|
|
1746
|
+
F(e5) && (e5 = this.languageUtils.toResolveHierarchy(e5)), F(t2) && (t2 = [t2]);
|
|
1747
|
+
let i2 = this.queueLoad(e5, t2, n2, r2);
|
|
1748
|
+
if (!i2.toLoad.length) return i2.pending.length || r2(), null;
|
|
1749
|
+
i2.toLoad.forEach((e6) => {
|
|
1750
|
+
this.loadOne(e6);
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
load(e5, t2, n2) {
|
|
1754
|
+
this.prepareLoading(e5, t2, {}, n2);
|
|
1755
|
+
}
|
|
1756
|
+
reload(e5, t2, n2) {
|
|
1757
|
+
this.prepareLoading(e5, t2, { reload: true }, n2);
|
|
1758
|
+
}
|
|
1759
|
+
loadOne(e5, t2 = ``) {
|
|
1760
|
+
let n2 = e5.split(`|`), r2 = n2[0], i2 = n2[1];
|
|
1761
|
+
this.read(r2, i2, `read`, void 0, void 0, (n3, a2) => {
|
|
1762
|
+
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);
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1765
|
+
saveMissing(e5, t2, n2, r2, i2, a2 = {}, o2 = () => {
|
|
1766
|
+
}) {
|
|
1767
|
+
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t2)) {
|
|
1768
|
+
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!!!`);
|
|
1769
|
+
return;
|
|
1770
|
+
}
|
|
1771
|
+
if (n2 != null && n2 !== ``) {
|
|
1772
|
+
if (this.backend?.create) {
|
|
1773
|
+
let s2 = { ...a2, isUpdate: i2 }, c2 = this.backend.create.bind(this.backend);
|
|
1774
|
+
if (c2.length < 6) try {
|
|
1775
|
+
let i3;
|
|
1776
|
+
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);
|
|
1777
|
+
} catch (e6) {
|
|
1778
|
+
o2(e6);
|
|
1779
|
+
}
|
|
1780
|
+
else c2(e5, t2, n2, r2, o2, s2);
|
|
1781
|
+
}
|
|
1782
|
+
e5 && e5[0] && this.store.addResource(e5[0], t2, n2, r2);
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
};
|
|
1786
|
+
var Cr = () => ({ 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) => {
|
|
1787
|
+
let t2 = {};
|
|
1788
|
+
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`) {
|
|
1789
|
+
let n2 = e5[3] || e5[2];
|
|
1790
|
+
Object.keys(n2).forEach((e6) => {
|
|
1791
|
+
t2[e6] = n2[e6];
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
return t2;
|
|
1795
|
+
}, interpolation: { escapeValue: true, format: (e5) => e5, prefix: `{{`, suffix: `}}`, formatSeparator: `,`, unescapePrefix: `-`, nestingPrefix: `$t(`, nestingSuffix: `)`, nestingOptionsSeparator: `,`, maxReplaces: 1e3, skipOnVariables: true }, cacheInBuiltFormats: true });
|
|
1796
|
+
var wr = (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);
|
|
1797
|
+
var G = () => {
|
|
1798
|
+
};
|
|
1799
|
+
var Tr = (e5) => {
|
|
1800
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(e5)).forEach((t2) => {
|
|
1801
|
+
typeof e5[t2] == `function` && (e5[t2] = e5[t2].bind(e5));
|
|
1802
|
+
});
|
|
1803
|
+
};
|
|
1804
|
+
var Er = `__i18next_supportNoticeShown`;
|
|
1805
|
+
var Dr = () => !!(typeof globalThis < `u` && globalThis[Er] || typeof process < `u` && {}.I18NEXT_NO_SUPPORT_NOTICE || typeof process < `u`);
|
|
1806
|
+
var Or = () => {
|
|
1807
|
+
typeof globalThis < `u` && (globalThis[Er] = true);
|
|
1808
|
+
};
|
|
1809
|
+
var kr = (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));
|
|
1810
|
+
var K = class e4 extends U {
|
|
1811
|
+
constructor(e5 = {}, t2) {
|
|
1812
|
+
if (super(), this.options = wr(e5), this.services = {}, this.logger = H, this.modules = { external: [] }, Tr(this), t2 && !this.isInitialized && !e5.isClone) {
|
|
1813
|
+
if (!this.options.initAsync) return this.init(e5, t2), this;
|
|
1814
|
+
setTimeout(() => {
|
|
1815
|
+
this.init(e5, t2);
|
|
1816
|
+
}, 0);
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
init(e5 = {}, t2) {
|
|
1820
|
+
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]));
|
|
1821
|
+
let n2 = Cr();
|
|
1822
|
+
this.options = { ...n2, ...this.options, ...wr(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 && !kr(this) && !Dr() && (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}`), Or());
|
|
1823
|
+
let r2 = (e6) => e6 ? typeof e6 == `function` ? new e6() : e6 : null;
|
|
1824
|
+
if (!this.options.isClone) {
|
|
1825
|
+
this.modules.logger ? H.init(r2(this.modules.logger), this.options) : H.init(null, this.options);
|
|
1826
|
+
let e6;
|
|
1827
|
+
e6 = this.modules.formatter ? this.modules.formatter : br;
|
|
1828
|
+
let t3 = new ur(this.options);
|
|
1829
|
+
this.store = new rr(this.options.resources, this.options);
|
|
1830
|
+
let i3 = this.services;
|
|
1831
|
+
i3.logger = H, i3.resourceStore = this.store, i3.languageUtils = t3, i3.pluralResolver = new pr(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 gr(this.options), i3.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i3.backendConnector = new Sr(r2(this.modules.backend), i3.resourceStore, i3, this.options), i3.backendConnector.on(`*`, (e7, ...t4) => {
|
|
1832
|
+
this.emit(e7, ...t4);
|
|
1833
|
+
}), 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 lr(this.services, this.options), this.translator.on(`*`, (e7, ...t4) => {
|
|
1834
|
+
this.emit(e7, ...t4);
|
|
1835
|
+
}), this.modules.external.forEach((e7) => {
|
|
1836
|
+
e7.init && e7.init(this);
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
if (this.format = this.options.interpolation.format, t2 ||= G, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1840
|
+
let e6 = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1841
|
+
e6.length > 0 && e6[0] !== `dev` && (this.options.lng = e6[0]);
|
|
1842
|
+
}
|
|
1843
|
+
!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) => {
|
|
1844
|
+
this[e6] = (...t3) => this.store[e6](...t3);
|
|
1845
|
+
}), [`addResource`, `addResources`, `addResourceBundle`, `removeResourceBundle`].forEach((e6) => {
|
|
1846
|
+
this[e6] = (...t3) => (this.store[e6](...t3), this);
|
|
1847
|
+
});
|
|
1848
|
+
let i2 = I(), a2 = () => {
|
|
1849
|
+
let e6 = (e7, n3) => {
|
|
1850
|
+
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);
|
|
1851
|
+
};
|
|
1852
|
+
if (this.languages && !this.isInitialized) return e6(null, this.t.bind(this));
|
|
1853
|
+
this.changeLanguage(this.options.lng, e6);
|
|
1854
|
+
};
|
|
1855
|
+
return this.options.resources || !this.options.initAsync ? a2() : setTimeout(a2, 0), i2;
|
|
1856
|
+
}
|
|
1857
|
+
loadResources(e5, t2 = G) {
|
|
1858
|
+
let n2 = t2, r2 = F(e5) ? e5 : this.language;
|
|
1859
|
+
if (typeof e5 == `function` && (n2 = e5), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1860
|
+
if (r2?.toLowerCase() === `cimode` && (!this.options.preload || this.options.preload.length === 0)) return n2();
|
|
1861
|
+
let e6 = [], t3 = (t4) => {
|
|
1862
|
+
t4 && t4 !== `cimode` && this.services.languageUtils.toResolveHierarchy(t4).forEach((t5) => {
|
|
1863
|
+
t5 !== `cimode` && e6.indexOf(t5) < 0 && e6.push(t5);
|
|
1864
|
+
});
|
|
1865
|
+
};
|
|
1866
|
+
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) => {
|
|
1867
|
+
!e7 && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n2(e7);
|
|
1868
|
+
});
|
|
1869
|
+
} else n2(null);
|
|
1870
|
+
}
|
|
1871
|
+
reloadResources(e5, t2, n2) {
|
|
1872
|
+
let r2 = I();
|
|
1873
|
+
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 ||= G, this.services.backendConnector.reload(e5, t2, (e6) => {
|
|
1874
|
+
r2.resolve(), n2(e6);
|
|
1875
|
+
}), r2;
|
|
1876
|
+
}
|
|
1877
|
+
use(e5) {
|
|
1878
|
+
if (!e5) throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);
|
|
1879
|
+
if (!e5.type) throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);
|
|
1880
|
+
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` && ir.addPostProcessor(e5), e5.type === `formatter` && (this.modules.formatter = e5), e5.type === `3rdParty` && this.modules.external.push(e5), this;
|
|
1881
|
+
}
|
|
1882
|
+
setResolvedLanguage(e5) {
|
|
1883
|
+
if (e5 && this.languages && !([`cimode`, `dev`].indexOf(e5) > -1)) {
|
|
1884
|
+
for (let e6 = 0; e6 < this.languages.length; e6++) {
|
|
1885
|
+
let t2 = this.languages[e6];
|
|
1886
|
+
if (!([`cimode`, `dev`].indexOf(t2) > -1) && this.store.hasLanguageSomeTranslations(t2)) {
|
|
1887
|
+
this.resolvedLanguage = t2;
|
|
1888
|
+
break;
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
!this.resolvedLanguage && this.languages.indexOf(e5) < 0 && this.store.hasLanguageSomeTranslations(e5) && (this.resolvedLanguage = e5, this.languages.unshift(e5));
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
changeLanguage(e5, t2) {
|
|
1895
|
+
this.isLanguageChangingTo = e5;
|
|
1896
|
+
let n2 = I();
|
|
1897
|
+
this.emit(`languageChanging`, e5);
|
|
1898
|
+
let r2 = (e6) => {
|
|
1899
|
+
this.language = e6, this.languages = this.services.languageUtils.toResolveHierarchy(e6), this.resolvedLanguage = void 0, this.setResolvedLanguage(e6);
|
|
1900
|
+
}, i2 = (i3, a3) => {
|
|
1901
|
+
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));
|
|
1902
|
+
}, a2 = (t3) => {
|
|
1903
|
+
!e5 && !t3 && this.services.languageDetector && (t3 = []);
|
|
1904
|
+
let n3 = F(t3) ? t3 : t3 && t3[0], a3 = this.store.hasLanguageSomeTranslations(n3) ? n3 : this.services.languageUtils.getBestMatchFromCodes(F(t3) ? [t3] : t3);
|
|
1905
|
+
a3 && (this.language || r2(a3), this.translator.language || this.translator.changeLanguage(a3), this.services.languageDetector?.cacheUserLanguage?.(a3)), this.loadResources(a3, (e6) => {
|
|
1906
|
+
i2(e6, a3);
|
|
1907
|
+
});
|
|
1908
|
+
};
|
|
1909
|
+
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;
|
|
1910
|
+
}
|
|
1911
|
+
getFixedT(e5, t2, n2) {
|
|
1912
|
+
let r2 = (e6, t3, ...i2) => {
|
|
1913
|
+
let a2;
|
|
1914
|
+
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);
|
|
1915
|
+
let o2 = { ...this.options, ...a2 };
|
|
1916
|
+
typeof a2.keyPrefix == `function` && (a2.keyPrefix = W(a2.keyPrefix, o2));
|
|
1917
|
+
let s2 = this.options.keySeparator || `.`, c2;
|
|
1918
|
+
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);
|
|
1919
|
+
};
|
|
1920
|
+
return F(e5) ? r2.lng = e5 : r2.lngs = e5, r2.ns = t2, r2.keyPrefix = n2, r2;
|
|
1921
|
+
}
|
|
1922
|
+
t(...e5) {
|
|
1923
|
+
return this.translator?.translate(...e5);
|
|
1924
|
+
}
|
|
1925
|
+
exists(...e5) {
|
|
1926
|
+
return this.translator?.exists(...e5);
|
|
1927
|
+
}
|
|
1928
|
+
setDefaultNamespace(e5) {
|
|
1929
|
+
this.options.defaultNS = e5;
|
|
1930
|
+
}
|
|
1931
|
+
hasLoadedNamespace(e5, t2 = {}) {
|
|
1932
|
+
if (!this.isInitialized) return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`, this.languages), false;
|
|
1933
|
+
if (!this.languages || !this.languages.length) return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`, this.languages), false;
|
|
1934
|
+
let n2 = t2.lng || this.resolvedLanguage || this.languages[0], r2 = this.options ? this.options.fallbackLng : false, i2 = this.languages[this.languages.length - 1];
|
|
1935
|
+
if (n2.toLowerCase() === `cimode`) return true;
|
|
1936
|
+
let a2 = (e6, t3) => {
|
|
1937
|
+
let n3 = this.services.backendConnector.state[`${e6}|${t3}`];
|
|
1938
|
+
return n3 === -1 || n3 === 0 || n3 === 2;
|
|
1939
|
+
};
|
|
1940
|
+
if (t2.precheck) {
|
|
1941
|
+
let e6 = t2.precheck(this, a2);
|
|
1942
|
+
if (e6 !== void 0) return e6;
|
|
1943
|
+
}
|
|
1944
|
+
return !!(this.hasResourceBundle(n2, e5) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a2(n2, e5) && (!r2 || a2(i2, e5)));
|
|
1945
|
+
}
|
|
1946
|
+
loadNamespaces(e5, t2) {
|
|
1947
|
+
let n2 = I();
|
|
1948
|
+
return this.options.ns ? (F(e5) && (e5 = [e5]), e5.forEach((e6) => {
|
|
1949
|
+
this.options.ns.indexOf(e6) < 0 && this.options.ns.push(e6);
|
|
1950
|
+
}), this.loadResources((e6) => {
|
|
1951
|
+
n2.resolve(), t2 && t2(e6);
|
|
1952
|
+
}), n2) : (t2 && t2(), Promise.resolve());
|
|
1953
|
+
}
|
|
1954
|
+
loadLanguages(e5, t2) {
|
|
1955
|
+
let n2 = I();
|
|
1956
|
+
F(e5) && (e5 = [e5]);
|
|
1957
|
+
let r2 = this.options.preload || [], i2 = e5.filter((e6) => r2.indexOf(e6) < 0 && this.services.languageUtils.isSupportedCode(e6));
|
|
1958
|
+
return i2.length ? (this.options.preload = r2.concat(i2), this.loadResources((e6) => {
|
|
1959
|
+
n2.resolve(), t2 && t2(e6);
|
|
1960
|
+
}), n2) : (t2 && t2(), Promise.resolve());
|
|
1961
|
+
}
|
|
1962
|
+
dir(e5) {
|
|
1963
|
+
if (e5 ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e5) return `rtl`;
|
|
1964
|
+
try {
|
|
1965
|
+
let t3 = new Intl.Locale(e5);
|
|
1966
|
+
if (t3 && t3.getTextInfo) {
|
|
1967
|
+
let e6 = t3.getTextInfo();
|
|
1968
|
+
if (e6 && e6.direction) return e6.direction;
|
|
1969
|
+
}
|
|
1970
|
+
} catch {
|
|
1971
|
+
}
|
|
1972
|
+
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 ur(Cr());
|
|
1973
|
+
return e5.toLowerCase().indexOf(`-latn`) > 1 ? `ltr` : t2.indexOf(n2.getLanguagePartFromCode(e5)) > -1 || e5.toLowerCase().indexOf(`-arab`) > 1 ? `rtl` : `ltr`;
|
|
1974
|
+
}
|
|
1975
|
+
static createInstance(t2 = {}, n2) {
|
|
1976
|
+
let r2 = new e4(t2, n2);
|
|
1977
|
+
return r2.createInstance = e4.createInstance, r2;
|
|
1978
|
+
}
|
|
1979
|
+
cloneInstance(t2 = {}, n2 = G) {
|
|
1980
|
+
let r2 = t2.forkResourceStore;
|
|
1981
|
+
r2 && delete t2.forkResourceStore;
|
|
1982
|
+
let i2 = { ...this.options, ...t2, isClone: true }, a2 = new e4(i2);
|
|
1983
|
+
if ((t2.debug !== void 0 || t2.prefix !== void 0) && (a2.logger = a2.logger.clone(t2)), [`store`, `services`, `language`].forEach((e5) => {
|
|
1984
|
+
a2[e5] = this[e5];
|
|
1985
|
+
}), a2.services = { ...this.services }, a2.services.utils = { hasLoadedNamespace: a2.hasLoadedNamespace.bind(a2) }, r2 && (a2.store = new rr(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) {
|
|
1986
|
+
let e5 = { ...Cr().interpolation, ...this.options.interpolation, ...t2.interpolation }, n3 = { ...i2, interpolation: e5 };
|
|
1987
|
+
a2.services.interpolator = new gr(n3);
|
|
1988
|
+
}
|
|
1989
|
+
return a2.translator = new lr(a2.services, i2), a2.translator.on(`*`, (e5, ...t3) => {
|
|
1990
|
+
a2.emit(e5, ...t3);
|
|
1991
|
+
}), a2.init(i2, n2), a2.translator.options = i2, a2.translator.backendConnector.services.utils = { hasLoadedNamespace: a2.hasLoadedNamespace.bind(a2) }, a2;
|
|
1992
|
+
}
|
|
1993
|
+
toJSON() {
|
|
1994
|
+
return { options: this.options, store: this.store, language: this.language, languages: this.languages, resolvedLanguage: this.resolvedLanguage };
|
|
1995
|
+
}
|
|
1996
|
+
}.createInstance();
|
|
1997
|
+
K.createInstance, K.dir, K.init, K.loadResources, K.reloadResources, K.use, K.changeLanguage, K.getFixedT, K.t, K.exists, K.setDefaultNamespace, K.hasLoadedNamespace, K.loadNamespaces, K.loadLanguages;
|
|
1998
|
+
var Ar = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
1999
|
+
var jr = { "&": `&`, "&": `&`, "<": `<`, "<": `<`, ">": `>`, ">": `>`, "'": `'`, "'": `'`, """: `"`, """: `"`, " ": ` `, " ": ` `, "©": `\xA9`, "©": `\xA9`, "®": `\xAE`, "®": `\xAE`, "…": `\u2026`, "…": `\u2026`, "/": `/`, "/": `/` };
|
|
2000
|
+
var Mr = (e5) => jr[e5];
|
|
2001
|
+
var Nr = { bindI18n: `languageChanged`, bindI18nStore: ``, transEmptyNodeValue: ``, transSupportBasicHtmlNodes: true, transWrapTextNodes: ``, transKeepBasicHtmlNodesFor: [`br`, `strong`, `i`, `p`], useSuspense: true, unescape: (e5) => e5.replace(Ar, Mr), transDefaultProps: void 0 };
|
|
2002
|
+
var Pr = (e5 = {}) => {
|
|
2003
|
+
Nr = { ...Nr, ...e5 };
|
|
2004
|
+
};
|
|
2005
|
+
var Fr = { type: `3rdParty`, init(e5) {
|
|
2006
|
+
Pr(e5.options.react);
|
|
2007
|
+
} };
|
|
2008
|
+
var q = /* @__PURE__ */ new Map();
|
|
2009
|
+
var Ir = 500;
|
|
2010
|
+
var J;
|
|
2011
|
+
function Lr() {
|
|
2012
|
+
if (J === void 0) try {
|
|
2013
|
+
J = new Intl.NumberFormat(`en-US`, { useGrouping: false, maximumFractionDigits: 0 }).format(`9007199254740993`) === `9007199254740993`;
|
|
2014
|
+
} catch {
|
|
2015
|
+
J = false;
|
|
2016
|
+
}
|
|
2017
|
+
return J;
|
|
2018
|
+
}
|
|
2019
|
+
var Rr = 15;
|
|
2020
|
+
function zr(e5) {
|
|
2021
|
+
if (!(typeof e5 != `string` || Lr()) && e5.replace(/[^0-9]/g, ``).replace(/^0+/, ``).length > Rr) 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.`);
|
|
2022
|
+
}
|
|
2023
|
+
function Br(e5, t2, n2) {
|
|
2024
|
+
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(`&`)}`;
|
|
2025
|
+
}
|
|
2026
|
+
function Vr(e5, t2, n2) {
|
|
2027
|
+
let r2 = Br(e5, t2, n2), i2 = q.get(r2);
|
|
2028
|
+
return i2 || (i2 = new Intl.NumberFormat(e5, { ...n2, style: `currency`, currency: t2 }), q.size >= Ir && q.clear(), q.set(r2, i2)), i2;
|
|
2029
|
+
}
|
|
2030
|
+
function Hr(e5, { value: t2, currency: n2 }, r2 = {}) {
|
|
2031
|
+
return zr(t2), Vr(e5, n2, r2).format(t2);
|
|
2032
|
+
}
|
|
2033
|
+
function Ur(e5, { value: t2, currency: n2 }, r2 = {}) {
|
|
2034
|
+
return zr(t2), Vr(e5, n2, r2).formatToParts(t2);
|
|
944
2035
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
2036
|
+
function Wr(e5) {
|
|
2037
|
+
return sn().find((e6) => e6.primary)?.id ?? e5;
|
|
2038
|
+
}
|
|
2039
|
+
function Gr(e5, t2) {
|
|
2040
|
+
let { locale: n2, ...r2 } = t2 ?? {}, i2 = n2 ?? e5.essentials?.locale;
|
|
2041
|
+
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.`);
|
|
2042
|
+
return { locale: i2, formatOptions: r2 };
|
|
2043
|
+
}
|
|
2044
|
+
var Kr = Bn({ getLanguage: (e5) => () => {
|
|
2045
|
+
let t2 = e5.essentials?.language;
|
|
2046
|
+
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.`);
|
|
2047
|
+
return t2;
|
|
2048
|
+
}, getLocale: (e5) => () => {
|
|
2049
|
+
let t2 = e5.essentials?.locale;
|
|
2050
|
+
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.`);
|
|
2051
|
+
return t2;
|
|
2052
|
+
}, formatCurrency: (e5) => (t2, n2) => {
|
|
2053
|
+
let { locale: r2, formatOptions: i2 } = Gr(e5, n2);
|
|
2054
|
+
return Hr(r2, t2, i2);
|
|
2055
|
+
}, formatCurrencyToParts: (e5) => (t2, n2) => {
|
|
2056
|
+
let { locale: r2, formatOptions: i2 } = Gr(e5, n2);
|
|
2057
|
+
return Ur(r2, t2, i2);
|
|
2058
|
+
}, getTranslationFunction: (e5) => () => {
|
|
2059
|
+
let t2 = e5.translations?.();
|
|
2060
|
+
if (!t2) throw Error(`Host translation resources are not available.`);
|
|
2061
|
+
let n2 = K.createInstance(), r2 = Wr(e5.essentials?.language) || `en`, i2 = { lng: e5.essentials?.language || r2, fallbackLng: r2, resources: t2 };
|
|
2062
|
+
return n2.use(Fr).init(i2, (e6) => {
|
|
2063
|
+
if (e6) throw e6;
|
|
2064
|
+
}), n2.t.bind(n2);
|
|
2065
|
+
} });
|
|
2066
|
+
var qr = class {
|
|
2067
|
+
constructor(e5) {
|
|
2068
|
+
this.message = e5, this.captureException = () => {
|
|
948
2069
|
console.error(this.message);
|
|
949
2070
|
}, this.captureMessage = () => {
|
|
950
2071
|
console.error(this.message);
|
|
951
|
-
}, this.startSpan = (
|
|
2072
|
+
}, this.startSpan = (e6, t2) => (console.error(this.message), t2(void 0)), this.startSpanManual = () => (console.error(this.message), { end: () => {
|
|
952
2073
|
}, fail: () => {
|
|
953
2074
|
} }), this.endSpanManual = () => {
|
|
954
2075
|
console.error(this.message);
|
|
@@ -957,359 +2078,380 @@ var _n = class {
|
|
|
957
2078
|
};
|
|
958
2079
|
}
|
|
959
2080
|
};
|
|
960
|
-
var
|
|
961
|
-
var
|
|
962
|
-
var
|
|
963
|
-
function
|
|
2081
|
+
var Jr = (e5) => new qr(e5);
|
|
2082
|
+
var Yr = Bn({ getMonitoringClient: (e5) => () => e5.getMonitoringClient ? e5.getMonitoringClient() : Jr(`Host monitoring client is not available on the current host. Make sure to use an updated version of the host initialization package.`) });
|
|
2083
|
+
var Y = { 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` };
|
|
2084
|
+
function Xr(e5) {
|
|
964
2085
|
try {
|
|
965
|
-
let t2 =
|
|
966
|
-
return t2 && typeof t2[
|
|
2086
|
+
let t2 = Yr.getMonitoringClient?.();
|
|
2087
|
+
return t2 && typeof t2[e5] == `function` ? t2 : null;
|
|
967
2088
|
} catch {
|
|
968
2089
|
return null;
|
|
969
2090
|
}
|
|
970
2091
|
}
|
|
971
|
-
function
|
|
972
|
-
let a2 =
|
|
2092
|
+
function Zr(e5, { feature: t2, action: n2, level: r2 = `error`, contexts: i2 }) {
|
|
2093
|
+
let a2 = Xr(`captureException`);
|
|
973
2094
|
if (!a2) return;
|
|
974
|
-
let o2 =
|
|
2095
|
+
let o2 = e5 instanceof Error ? e5 : Error(String(e5));
|
|
975
2096
|
a2.captureException(o2, { level: r2, tags: { feature: t2, action: n2 }, ...i2 ? { contexts: i2 } : {} });
|
|
976
2097
|
}
|
|
977
|
-
function
|
|
978
|
-
let i2 =
|
|
2098
|
+
function Qr(e5, { feature: t2, tags: n2 }, r2) {
|
|
2099
|
+
let i2 = Xr(`startSpanManual`);
|
|
979
2100
|
if (!i2) return r2;
|
|
980
|
-
let a2 = i2.startSpanManual({ name:
|
|
981
|
-
return r2.then(() => a2.end(), (
|
|
2101
|
+
let a2 = i2.startSpanManual({ name: e5, tags: { feature: t2, ...n2 } });
|
|
2102
|
+
return r2.then(() => a2.end(), (e6) => a2.fail(e6)), r2;
|
|
982
2103
|
}
|
|
983
|
-
var
|
|
2104
|
+
var $r = class extends import_react.Component {
|
|
984
2105
|
state = { hasError: false };
|
|
985
2106
|
static getDerivedStateFromError() {
|
|
986
2107
|
return { hasError: true };
|
|
987
2108
|
}
|
|
988
|
-
componentDidCatch(
|
|
989
|
-
|
|
2109
|
+
componentDidCatch(e5, t2) {
|
|
2110
|
+
Zr(e5, { feature: this.props.feature ?? `service`, action: `render`, contexts: { react: { componentStack: t2.componentStack } } });
|
|
990
2111
|
}
|
|
991
2112
|
render() {
|
|
992
2113
|
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
993
2114
|
}
|
|
994
2115
|
};
|
|
995
|
-
function
|
|
996
|
-
let t2 =
|
|
997
|
-
if (t2.__state || (t2.__state = { status: `pending` }, t2.then((
|
|
998
|
-
t2.__state = { status: `fulfilled`, value:
|
|
999
|
-
}, (
|
|
1000
|
-
t2.__state = { status: `rejected`, reason:
|
|
2116
|
+
function ei(e5) {
|
|
2117
|
+
let t2 = e5;
|
|
2118
|
+
if (t2.__state || (t2.__state = { status: `pending` }, t2.then((e6) => {
|
|
2119
|
+
t2.__state = { status: `fulfilled`, value: e6 };
|
|
2120
|
+
}, (e6) => {
|
|
2121
|
+
t2.__state = { status: `rejected`, reason: e6 };
|
|
1001
2122
|
})), t2.__state.status === `fulfilled`) return t2.__state.value;
|
|
1002
2123
|
throw t2.__state.status === `rejected` ? t2.__state.reason : t2;
|
|
1003
2124
|
}
|
|
1004
|
-
function
|
|
1005
|
-
let t2 = Promise.resolve(
|
|
1006
|
-
return t2.__state = { status: `fulfilled`, value:
|
|
2125
|
+
function X(e5) {
|
|
2126
|
+
let t2 = Promise.resolve(e5);
|
|
2127
|
+
return t2.__state = { status: `fulfilled`, value: e5 }, t2;
|
|
1007
2128
|
}
|
|
1008
|
-
var
|
|
1009
|
-
function
|
|
1010
|
-
let r2 =
|
|
1011
|
-
r2 || (r2 = /* @__PURE__ */ new WeakMap(),
|
|
2129
|
+
var ti = /* @__PURE__ */ new WeakMap();
|
|
2130
|
+
function ni(e5, t2, n2) {
|
|
2131
|
+
let r2 = ti.get(e5);
|
|
2132
|
+
r2 || (r2 = /* @__PURE__ */ new WeakMap(), ti.set(e5, r2));
|
|
1012
2133
|
let i2 = r2.get(t2);
|
|
1013
2134
|
i2 || (i2 = /* @__PURE__ */ new WeakMap(), r2.set(t2, i2));
|
|
1014
2135
|
let a2 = i2.get(n2);
|
|
1015
2136
|
if (!a2) {
|
|
1016
|
-
let r3 =
|
|
1017
|
-
a2 = r3.__state?.status === `fulfilled` ?
|
|
2137
|
+
let r3 = e5;
|
|
2138
|
+
a2 = r3.__state?.status === `fulfilled` ? X(t2(r3.__state.value)) : r3.__state?.status === `rejected` ? X(n2(r3.__state.reason)) : e5.then(t2, n2), i2.set(n2, a2);
|
|
1018
2139
|
}
|
|
1019
2140
|
return a2;
|
|
1020
2141
|
}
|
|
1021
|
-
function
|
|
1022
|
-
return
|
|
2142
|
+
function Z(e5) {
|
|
2143
|
+
return e5;
|
|
1023
2144
|
}
|
|
1024
|
-
var
|
|
1025
|
-
function
|
|
2145
|
+
var ri = Z(`@wix/site-service-warmup-data`);
|
|
2146
|
+
function ii() {
|
|
1026
2147
|
try {
|
|
1027
2148
|
return (0, import_services_manager_react.useGetService)();
|
|
1028
2149
|
} catch {
|
|
1029
2150
|
return null;
|
|
1030
2151
|
}
|
|
1031
2152
|
}
|
|
1032
|
-
function
|
|
2153
|
+
function ai(e5) {
|
|
1033
2154
|
try {
|
|
1034
|
-
return
|
|
2155
|
+
return e5 ? e5(ri) : null;
|
|
1035
2156
|
} catch {
|
|
1036
2157
|
return null;
|
|
1037
2158
|
}
|
|
1038
2159
|
}
|
|
1039
|
-
function
|
|
1040
|
-
let
|
|
1041
|
-
return { scope:
|
|
1042
|
-
if (t2 || !
|
|
2160
|
+
function oi() {
|
|
2161
|
+
let e5 = ai(ii()), t2 = typeof window > `u`;
|
|
2162
|
+
return { scope: e5 ?? void 0, get: async (n2) => {
|
|
2163
|
+
if (t2 || !e5) return null;
|
|
1043
2164
|
try {
|
|
1044
|
-
return await
|
|
1045
|
-
} catch (
|
|
1046
|
-
return
|
|
2165
|
+
return await e5.get(n2);
|
|
2166
|
+
} catch (e6) {
|
|
2167
|
+
return Zr(e6, { feature: Y.warmup, action: `read`, level: `warning`, contexts: { warmup: { key: n2 } } }), null;
|
|
1047
2168
|
}
|
|
1048
2169
|
}, set: (n2, r2) => {
|
|
1049
|
-
if (t2 &&
|
|
1050
|
-
|
|
2170
|
+
if (t2 && e5) try {
|
|
2171
|
+
e5.set(n2, r2);
|
|
1051
2172
|
} catch {
|
|
1052
2173
|
}
|
|
1053
2174
|
} };
|
|
1054
2175
|
}
|
|
1055
|
-
var
|
|
1056
|
-
var
|
|
1057
|
-
var
|
|
1058
|
-
function
|
|
1059
|
-
|
|
2176
|
+
var si = Z(`@wix/site-service-locale`);
|
|
2177
|
+
var ci = Z;
|
|
2178
|
+
var li = ci(`@wix/viewer-service-multilingual`);
|
|
2179
|
+
function ui() {
|
|
2180
|
+
try {
|
|
2181
|
+
return Kr.getLanguage() ?? `en`;
|
|
2182
|
+
} catch {
|
|
2183
|
+
return `en`;
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
function di(e5) {
|
|
2187
|
+
try {
|
|
2188
|
+
return (0, import_services_manager_react.useService)(e5);
|
|
2189
|
+
} catch {
|
|
2190
|
+
return null;
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
function fi() {
|
|
2194
|
+
let e5 = di(si), t2 = di(li);
|
|
2195
|
+
return t2?.multilingualEnabled && t2.currentLocale?.languageCode || e5?.language || ui();
|
|
2196
|
+
}
|
|
2197
|
+
var pi = [];
|
|
2198
|
+
var mi = [];
|
|
2199
|
+
var hi = `useServiceAddOnsContext must be used within ServiceAddOnsContextProvider`;
|
|
2200
|
+
function gi({ isLoading: e5, hasError: t2, children: n2 }) {
|
|
2201
|
+
let r2 = { addOnGroups: pi, selected: mi, isLoading: e5, hasError: t2, toggleAddOn: () => {
|
|
1060
2202
|
}, setAddOnQuantity: () => {
|
|
1061
2203
|
} };
|
|
1062
2204
|
return (0, import_jsx_runtime.jsx)($.Provider, { value: r2, children: n2 });
|
|
1063
2205
|
}
|
|
1064
|
-
function
|
|
1065
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2206
|
+
function _i({ children: e5 }) {
|
|
2207
|
+
return (0, import_jsx_runtime.jsx)(gi, { isLoading: true, hasError: false, children: e5 });
|
|
1066
2208
|
}
|
|
1067
|
-
function
|
|
1068
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2209
|
+
function vi({ children: e5 }) {
|
|
2210
|
+
return (0, import_jsx_runtime.jsx)(gi, { isLoading: false, hasError: true, children: e5 });
|
|
1069
2211
|
}
|
|
1070
|
-
function
|
|
1071
|
-
if (!
|
|
2212
|
+
function yi(e5) {
|
|
2213
|
+
if (!e5) return;
|
|
1072
2214
|
let t2 = ``;
|
|
1073
|
-
return (
|
|
2215
|
+
return (e5.filename || e5.altText) && (t2 = `/${encodeURIComponent(e5.filename || e5.altText)}`), e5.id ? `wix:image://v1/${e5.id}${t2}#originWidth=${e5.width}&originHeight=${e5.height}` : e5.url;
|
|
1074
2216
|
}
|
|
1075
|
-
var
|
|
1076
|
-
function
|
|
1077
|
-
return
|
|
2217
|
+
var bi = [{ path: `addOnGroupsDetails.addOns.mainMedia.image.urlExpirationDate` }];
|
|
2218
|
+
function xi(e5) {
|
|
2219
|
+
return jt(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: `` }] } }));
|
|
1078
2220
|
}
|
|
1079
|
-
var
|
|
1080
|
-
function
|
|
2221
|
+
var Si = `@wix/auto_sdk_bookings_services`;
|
|
2222
|
+
function Ci(e5) {
|
|
1081
2223
|
function t2({ host: t3 }) {
|
|
1082
|
-
return { entityFqdn: `wix.bookings.services.v2.service`, method: `POST`, methodFqn: `wix.bookings.services.v2.AddOnGroupsService.ListAddOnGroupsByServiceId`, packageName:
|
|
2224
|
+
return { entityFqdn: `wix.bookings.services.v2.service`, method: `POST`, methodFqn: `wix.bookings.services.v2.AddOnGroupsService.ListAddOnGroupsByServiceId`, packageName: Si, migrationOptions: { optInTransformResponse: true }, url: xi({ protoPath: `/v2/services/add-on-groups/list-add-on-groups-by-service-id`, data: e5, host: t3 }), data: e5, transformResponse: (e6) => ut(e6, [{ transformFn: $e, paths: bi }]) };
|
|
1083
2225
|
}
|
|
1084
2226
|
return t2;
|
|
1085
2227
|
}
|
|
1086
|
-
var
|
|
1087
|
-
async function
|
|
1088
|
-
let { httpClient: n2, sideEffects: r2 } = arguments[2], i2 =
|
|
2228
|
+
var wi = [{ path: `addOnGroupsDetails.addOns.mainMedia.image` }];
|
|
2229
|
+
async function Ti(e5, t2) {
|
|
2230
|
+
let { httpClient: n2, sideEffects: r2 } = arguments[2], i2 = Ci(Ze({ serviceId: e5, groupIds: t2?.groupIds }));
|
|
1089
2231
|
r2?.onSiteCall?.();
|
|
1090
2232
|
try {
|
|
1091
|
-
let
|
|
1092
|
-
return r2?.onSuccess?.(
|
|
1093
|
-
} catch (
|
|
1094
|
-
let t3 =
|
|
1095
|
-
throw r2?.onError?.(
|
|
2233
|
+
let e6 = await n2.request(i2);
|
|
2234
|
+
return r2?.onSuccess?.(e6), Qe(ut(e6.data, [{ transformFn: yi, paths: wi }]));
|
|
2235
|
+
} catch (e6) {
|
|
2236
|
+
let t3 = bt(e6, { spreadPathsToArguments: {}, explicitPathsToArguments: { serviceId: `$[0]`, groupIds: `$[1].groupIds` }, singleArgumentUnchanged: false }, [`serviceId`, `options`]);
|
|
2237
|
+
throw r2?.onError?.(e6), t3;
|
|
1096
2238
|
}
|
|
1097
2239
|
}
|
|
1098
|
-
function
|
|
1099
|
-
return (t2, n2) =>
|
|
2240
|
+
function Ei(e5) {
|
|
2241
|
+
return (t2, n2) => Ti(t2, n2, { httpClient: e5 });
|
|
1100
2242
|
}
|
|
1101
|
-
var
|
|
1102
|
-
function
|
|
1103
|
-
let n2 =
|
|
2243
|
+
var Di = At(Ei);
|
|
2244
|
+
function Oi(e5, t2) {
|
|
2245
|
+
let n2 = e5?.value, r2 = e5?.currency;
|
|
1104
2246
|
if (n2 == null || !r2) return null;
|
|
1105
2247
|
let i2 = Number(n2);
|
|
1106
2248
|
if (!Number.isFinite(i2)) return null;
|
|
1107
2249
|
let a2 = i2 % 1 == 0 ? 0 : 2;
|
|
1108
2250
|
return new Intl.NumberFormat(t2, { style: `currency`, currency: r2, currencyDisplay: `symbol`, maximumFractionDigits: a2, minimumFractionDigits: a2 }).format(i2).replace(/\p{Zs}/gu, `\xA0`);
|
|
1109
2251
|
}
|
|
1110
|
-
async function
|
|
1111
|
-
return (await
|
|
2252
|
+
async function ki(e5) {
|
|
2253
|
+
return (await Di(e5)).addOnGroupsDetails ?? [];
|
|
1112
2254
|
}
|
|
1113
|
-
function
|
|
1114
|
-
let n2 =
|
|
1115
|
-
return { addOnId:
|
|
2255
|
+
function Ai(e5, t2) {
|
|
2256
|
+
let n2 = e5.price?.value == null ? null : Number(e5.price.value);
|
|
2257
|
+
return { addOnId: e5.addOnId ?? null, addOnName: e5.nameTranslated ?? e5.name ?? null, addOnPrice: Oi(e5.price, t2), addOnPriceValue: n2 != null && Number.isFinite(n2) ? n2 : null, addOnCurrency: e5.price?.currency ?? null, durationInMinutes: e5.durationInMinutes ?? null, maxQuantity: e5.maxQuantity ?? null, isSelected: false, selectedQuantity: 0 };
|
|
1116
2258
|
}
|
|
1117
|
-
function
|
|
1118
|
-
return
|
|
2259
|
+
function ji(e5, t2) {
|
|
2260
|
+
return e5.map((e6) => ({ groupId: e6.groupId ?? null, groupName: e6.groupNameTranslated ?? e6.groupName ?? null, prompt: e6.promptTranslated ?? e6.prompt ?? null, maxNumberOfAddOns: e6.maxNumberOfAddOns ?? null, addOns: (e6.addOns ?? []).map((e7) => Ai(e7, t2)), selectedCount: 0, canSelectMore: true }));
|
|
1119
2261
|
}
|
|
1120
|
-
var
|
|
1121
|
-
function
|
|
1122
|
-
return `${
|
|
2262
|
+
var Mi = `bookings-uou`;
|
|
2263
|
+
function Ni(e5, t2, n2) {
|
|
2264
|
+
return `${Mi}:${e5}:addons:${t2}:${n2}`;
|
|
1123
2265
|
}
|
|
1124
|
-
var
|
|
1125
|
-
var
|
|
1126
|
-
var
|
|
1127
|
-
var
|
|
1128
|
-
function
|
|
2266
|
+
var Pi = 5e3;
|
|
2267
|
+
var Fi = 100;
|
|
2268
|
+
var Ii = `wix-warmup-data`;
|
|
2269
|
+
var Li = null;
|
|
2270
|
+
function Ri(e5) {
|
|
1129
2271
|
if (typeof document < `u`) try {
|
|
1130
|
-
let t2 = document.getElementById(
|
|
1131
|
-
return t2 ? (
|
|
2272
|
+
let t2 = document.getElementById(Ii)?.textContent;
|
|
2273
|
+
return t2 ? (Li?.text !== t2 && (Li = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), Li.data[e5] ?? void 0) : void 0;
|
|
1132
2274
|
} catch {
|
|
1133
2275
|
return;
|
|
1134
2276
|
}
|
|
1135
2277
|
}
|
|
1136
|
-
var
|
|
1137
|
-
var
|
|
1138
|
-
var
|
|
1139
|
-
var
|
|
1140
|
-
function
|
|
1141
|
-
if (!
|
|
1142
|
-
let t2 =
|
|
1143
|
-
return t2 || (t2 =
|
|
1144
|
-
}
|
|
1145
|
-
function
|
|
1146
|
-
if (
|
|
2278
|
+
var zi = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
|
|
2279
|
+
var Bi = zi();
|
|
2280
|
+
var Vi = /* @__PURE__ */ new WeakMap();
|
|
2281
|
+
var Hi = /* @__PURE__ */ new WeakMap();
|
|
2282
|
+
function Ui(e5) {
|
|
2283
|
+
if (!e5) return Bi;
|
|
2284
|
+
let t2 = Vi.get(e5);
|
|
2285
|
+
return t2 || (t2 = zi(), Vi.set(e5, t2)), t2;
|
|
2286
|
+
}
|
|
2287
|
+
function Wi({ key: e5, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
2288
|
+
if (e5 === null) return n2();
|
|
1147
2289
|
if (typeof window > `u`) {
|
|
1148
|
-
let r3 = () => n2().then((n3) => (t2.set(
|
|
2290
|
+
let r3 = () => n2().then((n3) => (t2.set(e5, n3), n3)), { scope: i3 } = t2;
|
|
1149
2291
|
if (!i3) return r3();
|
|
1150
|
-
let a3 =
|
|
1151
|
-
a3 || (a3 = /* @__PURE__ */ new Map(),
|
|
1152
|
-
let o3 = a3.get(
|
|
2292
|
+
let a3 = Hi.get(i3);
|
|
2293
|
+
a3 || (a3 = /* @__PURE__ */ new Map(), Hi.set(i3, a3));
|
|
2294
|
+
let o3 = a3.get(e5);
|
|
1153
2295
|
if (o3) return o3;
|
|
1154
2296
|
let s3 = r3();
|
|
1155
|
-
return a3.set(
|
|
2297
|
+
return a3.set(e5, s3), s3.catch(() => a3.delete(e5)), s3;
|
|
1156
2298
|
}
|
|
1157
|
-
let i2 =
|
|
1158
|
-
for (let [
|
|
1159
|
-
let o2 = i2.promises.get(
|
|
2299
|
+
let i2 = Ui(t2.scope), a2 = Date.now();
|
|
2300
|
+
for (let [e6, t3] of i2.promises) t3.expiresAt <= a2 && i2.promises.delete(e6);
|
|
2301
|
+
let o2 = i2.promises.get(e5);
|
|
1160
2302
|
if (o2 && !r2) return o2.promise;
|
|
1161
|
-
r2 && i2.invalidatedWarmup.add(
|
|
1162
|
-
let s2 = !i2.invalidatedWarmup.has(
|
|
2303
|
+
r2 && i2.invalidatedWarmup.add(e5);
|
|
2304
|
+
let s2 = !i2.invalidatedWarmup.has(e5);
|
|
1163
2305
|
if (s2) {
|
|
1164
|
-
let t3 =
|
|
2306
|
+
let t3 = Ri(e5);
|
|
1165
2307
|
if (t3 !== void 0) {
|
|
1166
|
-
let n3 =
|
|
1167
|
-
return i2.promises.set(
|
|
2308
|
+
let n3 = X(t3);
|
|
2309
|
+
return i2.promises.set(e5, { promise: n3, expiresAt: a2 + Pi }), n3;
|
|
1168
2310
|
}
|
|
1169
2311
|
}
|
|
1170
2312
|
let c2 = (async () => {
|
|
1171
2313
|
if (s2) {
|
|
1172
|
-
let n3 = await t2.get(
|
|
2314
|
+
let n3 = await t2.get(e5);
|
|
1173
2315
|
if (n3 != null) return n3;
|
|
1174
2316
|
}
|
|
1175
2317
|
return n2();
|
|
1176
2318
|
})();
|
|
1177
|
-
i2.promises.size >=
|
|
2319
|
+
i2.promises.size >= Fi && i2.promises.delete(i2.promises.keys().next().value);
|
|
1178
2320
|
let l2 = { promise: c2, expiresAt: 1 / 0 };
|
|
1179
|
-
return i2.promises.set(
|
|
1180
|
-
l2.expiresAt = Date.now() +
|
|
2321
|
+
return i2.promises.set(e5, l2), c2.then(() => {
|
|
2322
|
+
l2.expiresAt = Date.now() + Pi;
|
|
1181
2323
|
}, () => {
|
|
1182
|
-
i2.promises.get(
|
|
2324
|
+
i2.promises.get(e5) === l2 && i2.promises.delete(e5);
|
|
1183
2325
|
}), c2;
|
|
1184
2326
|
}
|
|
1185
|
-
function
|
|
1186
|
-
return
|
|
1187
|
-
throw
|
|
2327
|
+
function Gi(e5, t2) {
|
|
2328
|
+
return Qr(`service-addons-context-load`, { feature: Y.serviceAddOns, tags: { serviceId: e5 } }, ki(e5)).then((e6) => ji(e6, t2), (t3) => {
|
|
2329
|
+
throw Zr(t3, { feature: Y.serviceAddOns, action: `fetch-add-on-groups`, level: `warning`, contexts: { service: { serviceId: e5 } } }), t3;
|
|
1188
2330
|
});
|
|
1189
2331
|
}
|
|
1190
|
-
function
|
|
1191
|
-
return
|
|
1192
|
-
}
|
|
1193
|
-
var
|
|
1194
|
-
function
|
|
1195
|
-
return { evid: 32, src: 16, endpoint: ``, params:
|
|
1196
|
-
}
|
|
1197
|
-
var
|
|
1198
|
-
var
|
|
1199
|
-
function
|
|
1200
|
-
let t2 =
|
|
1201
|
-
if (t2 === null) return
|
|
1202
|
-
let n2 = new URL(
|
|
1203
|
-
n2.searchParams.delete(
|
|
1204
|
-
for (let [
|
|
2332
|
+
function Ki({ serviceId: e5, locale: t2, language: n2, warmupData: r2 }) {
|
|
2333
|
+
return Wi({ key: Ni(n2, e5, t2), warmupData: r2, fetchData: () => Gi(e5, t2) });
|
|
2334
|
+
}
|
|
2335
|
+
var qi = ci(`@wix/site-service-business-logger`);
|
|
2336
|
+
function Ji(e5) {
|
|
2337
|
+
return { evid: 32, src: 16, endpoint: ``, params: e5 };
|
|
2338
|
+
}
|
|
2339
|
+
var Yi = Z(`@wix/site-service-url`);
|
|
2340
|
+
var Xi = `appSectionParams`;
|
|
2341
|
+
function Zi(e5) {
|
|
2342
|
+
let t2 = e5.searchParams.get(Xi);
|
|
2343
|
+
if (t2 === null) return e5;
|
|
2344
|
+
let n2 = new URL(e5);
|
|
2345
|
+
n2.searchParams.delete(Xi);
|
|
2346
|
+
for (let [e6, r2] of Object.entries(Qi(t2))) typeof r2 == `string` && !n2.searchParams.has(e6) && n2.searchParams.set(e6, r2);
|
|
1205
2347
|
return n2;
|
|
1206
2348
|
}
|
|
1207
|
-
function
|
|
2349
|
+
function Qi(e5) {
|
|
1208
2350
|
try {
|
|
1209
|
-
let t2 = JSON.parse(
|
|
2351
|
+
let t2 = JSON.parse(e5);
|
|
1210
2352
|
return t2 && typeof t2 == `object` && !Array.isArray(t2) ? t2 : {};
|
|
1211
2353
|
} catch {
|
|
1212
2354
|
return {};
|
|
1213
2355
|
}
|
|
1214
2356
|
}
|
|
1215
2357
|
var Q = `bookings-uou:url-change`;
|
|
1216
|
-
var
|
|
1217
|
-
let t2 = new URL(
|
|
2358
|
+
var $i = (e5) => {
|
|
2359
|
+
let t2 = new URL(e5);
|
|
1218
2360
|
return t2.searchParams.sort(), t2.href;
|
|
1219
2361
|
};
|
|
1220
|
-
function
|
|
2362
|
+
function ea(e5, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
|
|
1221
2363
|
let r2 = globalThis.window;
|
|
1222
2364
|
if (!r2?.history) return;
|
|
1223
2365
|
let i2 = new URL(r2.location.href);
|
|
1224
|
-
if (
|
|
2366
|
+
if ($i(i2) === $i(e5)) return;
|
|
1225
2367
|
let a2 = { scrollY: r2.scrollY };
|
|
1226
|
-
if (n2) r2.history.replaceState(a2, ``,
|
|
2368
|
+
if (n2) r2.history.replaceState(a2, ``, e5.href);
|
|
1227
2369
|
else {
|
|
1228
2370
|
r2.history.replaceState(a2, ``, i2.href);
|
|
1229
2371
|
try {
|
|
1230
|
-
r2.history.pushState(t2 ? a2 : null, ``,
|
|
2372
|
+
r2.history.pushState(t2 ? a2 : null, ``, e5.href);
|
|
1231
2373
|
} catch {
|
|
1232
2374
|
return;
|
|
1233
2375
|
}
|
|
1234
2376
|
}
|
|
1235
2377
|
r2.dispatchEvent(new Event(Q));
|
|
1236
2378
|
}
|
|
1237
|
-
function
|
|
2379
|
+
function ta(e5) {
|
|
1238
2380
|
let t2 = globalThis.window;
|
|
1239
|
-
return t2 ? (t2.addEventListener(Q,
|
|
1240
|
-
t2.removeEventListener(Q,
|
|
2381
|
+
return t2 ? (t2.addEventListener(Q, e5), t2.addEventListener(`popstate`, e5), () => {
|
|
2382
|
+
t2.removeEventListener(Q, e5), t2.removeEventListener(`popstate`, e5);
|
|
1241
2383
|
}) : () => {
|
|
1242
2384
|
};
|
|
1243
2385
|
}
|
|
1244
|
-
var
|
|
2386
|
+
var na = (e5) => {
|
|
1245
2387
|
try {
|
|
1246
|
-
return decodeURIComponent(
|
|
2388
|
+
return decodeURIComponent(e5);
|
|
1247
2389
|
} catch {
|
|
1248
|
-
return
|
|
2390
|
+
return e5;
|
|
1249
2391
|
}
|
|
1250
2392
|
};
|
|
1251
|
-
function
|
|
2393
|
+
function ra(e5, t2) {
|
|
1252
2394
|
let n2 = t2 ? new URL(t2).pathname : `/`;
|
|
1253
|
-
return `./${
|
|
2395
|
+
return `./${na(new URL(e5).pathname.replace(n2, ``).replace(/^\/|\/$/g, ``))}`;
|
|
1254
2396
|
}
|
|
1255
|
-
function
|
|
1256
|
-
let
|
|
1257
|
-
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () =>
|
|
2397
|
+
function ia() {
|
|
2398
|
+
let e5 = (0, import_services_manager_react.useService)(Yi), t2 = (0, import_react.useCallback)(() => e5.currentUrl, [e5]), n2 = (0, import_react.useSyncExternalStore)(ta, t2, t2), i2 = (0, import_react.useMemo)(() => Zi(new URL(n2)), [n2]), a2 = e5.siteUrl.replace(/\/$/, ``);
|
|
2399
|
+
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () => Zi(new URL(e5.currentUrl)), getRelativeUrl: () => ra(e5.currentUrl, a2), getExternalBaseUrl: () => a2, pushUrl: ea };
|
|
1258
2400
|
}
|
|
1259
|
-
var
|
|
1260
|
-
return
|
|
2401
|
+
var aa = function(e5) {
|
|
2402
|
+
return e5.BOOK_ONLINE = `bookingsBookOnline`, e5.SERVICE_PAGE = `bookingsServicePage`, e5.CALENDAR_PAGE = `bookingsCalendar`, e5.FORM_PAGE = `bookingsForm`, e5;
|
|
1261
2403
|
}({});
|
|
1262
|
-
var
|
|
1263
|
-
|
|
1264
|
-
var
|
|
1265
|
-
var
|
|
1266
|
-
let { reportBi: t2 } = (0, import_services_manager_react.useService)(
|
|
2404
|
+
var oa = { 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` };
|
|
2405
|
+
aa.BOOK_ONLINE;
|
|
2406
|
+
var sa = `new_bookings_server`;
|
|
2407
|
+
var ca = (e5) => {
|
|
2408
|
+
let { reportBi: t2 } = (0, import_services_manager_react.useService)(qi);
|
|
1267
2409
|
return (0, import_react.useCallback)((n2) => {
|
|
1268
|
-
t2({ widget_name:
|
|
1269
|
-
}, [t2,
|
|
2410
|
+
t2({ widget_name: e5, bookingsPlatform: sa, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
|
|
2411
|
+
}, [t2, e5]);
|
|
1270
2412
|
};
|
|
1271
|
-
var
|
|
1272
|
-
let n2 =
|
|
2413
|
+
var la = (e5, t2 = true) => {
|
|
2414
|
+
let n2 = ca(e5), { getParsedUrl: r2 } = ia(), i2 = (0, import_react.useRef)(false);
|
|
1273
2415
|
(0, import_react.useEffect)(() => {
|
|
1274
|
-
t2 && !i2.current && (i2.current = true, n2(
|
|
2416
|
+
t2 && !i2.current && (i2.current = true, n2(Ji({ referralInfo: r2().searchParams.get(Nn.referral) ?? void 0 })));
|
|
1275
2417
|
}, [t2, n2, r2]);
|
|
1276
2418
|
};
|
|
1277
|
-
var
|
|
1278
|
-
var
|
|
1279
|
-
var
|
|
2419
|
+
var ua = X({ addOnGroups: pi, hasError: false });
|
|
2420
|
+
var da = (e5) => ({ addOnGroups: e5, hasError: false });
|
|
2421
|
+
var fa = () => ({ addOnGroups: pi, hasError: true });
|
|
1280
2422
|
var $ = (0, import_react.createContext)(null);
|
|
1281
|
-
function
|
|
1282
|
-
let
|
|
1283
|
-
if (!
|
|
1284
|
-
return
|
|
2423
|
+
function pa() {
|
|
2424
|
+
let e5 = (0, import_react.useContext)($);
|
|
2425
|
+
if (!e5) throw Error(hi);
|
|
2426
|
+
return e5;
|
|
1285
2427
|
}
|
|
1286
|
-
function
|
|
1287
|
-
let { addOnGroups: l2, hasError: u2 } =
|
|
2428
|
+
function ma({ addOnsPromise: e5, isLoading: t2, pickedAddOns: n2, forwardToggleAddOn: i2, forwardSetAddOnQuantity: a2, children: c2 }) {
|
|
2429
|
+
let { addOnGroups: l2, hasError: u2 } = ei(e5), d2 = (0, import_react.useMemo)(() => N(l2, n2), [l2, n2]), p2 = (0, import_react.useMemo)(() => An(l2, d2), [l2, d2]), m2 = (0, import_react.useRef)({ source: n2, picks: n2 });
|
|
1288
2430
|
m2.current.source !== n2 && (m2.current = { source: n2, picks: n2 });
|
|
1289
|
-
let h2 = (
|
|
2431
|
+
let h2 = (e6) => {
|
|
1290
2432
|
let t3 = m2.current;
|
|
1291
|
-
t3.picks =
|
|
2433
|
+
t3.picks = P(e6({ serviceId: ``, addOns: t3.picks }));
|
|
1292
2434
|
}, g2 = (0, import_react.useCallback)(() => {
|
|
1293
|
-
let
|
|
1294
|
-
return
|
|
1295
|
-
}, [l2, a2]), _2 = (0, import_react.useCallback)((
|
|
1296
|
-
let n3 =
|
|
1297
|
-
!t2 &&
|
|
1298
|
-
}, [t2, l2, g2, i2]), v2 = (0, import_react.useCallback)((
|
|
1299
|
-
let r2 = t2 ? null :
|
|
2435
|
+
let e6 = m2.current, t3 = N(l2, e6.picks);
|
|
2436
|
+
return e6.picks.filter((e7) => !t3.includes(e7)).forEach((e7) => a2(e7.id, 0)), e6.picks = t3, t3;
|
|
2437
|
+
}, [l2, a2]), _2 = (0, import_react.useCallback)((e6) => {
|
|
2438
|
+
let n3 = N(l2, m2.current.picks);
|
|
2439
|
+
!t2 && jn(l2, n3, e6) && (g2(), i2(e6), h2((t3) => Fn(t3, e6)));
|
|
2440
|
+
}, [t2, l2, g2, i2]), v2 = (0, import_react.useCallback)((e6, n3) => {
|
|
2441
|
+
let r2 = t2 ? null : Dn(l2, e6);
|
|
1300
2442
|
if (!r2) return;
|
|
1301
|
-
let i3 =
|
|
1302
|
-
s2 === o2 || o2 === 0 && !
|
|
1303
|
-
}, [t2, l2, g2, a2]),
|
|
1304
|
-
return (0, import_jsx_runtime.jsx)($.Provider, { value:
|
|
2443
|
+
let i3 = N(l2, m2.current.picks), o2 = i3.find((t3) => t3.id === e6)?.quantity ?? 0, s2 = Mn(r2, n3);
|
|
2444
|
+
s2 === o2 || o2 === 0 && !jn(l2, i3, e6) || (g2(), a2(e6, s2), h2((t3) => In(t3, e6, s2)));
|
|
2445
|
+
}, [t2, l2, g2, a2]), y2 = (0, import_react.useMemo)(() => ({ addOnGroups: p2, selected: d2, isLoading: t2, hasError: u2, toggleAddOn: _2, setAddOnQuantity: v2 }), [p2, d2, t2, u2, _2, v2]);
|
|
2446
|
+
return (0, import_jsx_runtime.jsx)($.Provider, { value: y2, children: c2 });
|
|
1305
2447
|
}
|
|
1306
|
-
function
|
|
2448
|
+
function ha({ children: e5 }) {
|
|
1307
2449
|
let { service: n2, serviceId: r2, hasAddOns: i2, locale: a2, isLoading: s2, bookingsSettingsLoading: c2, selection: u2, toggleAddOn: d2, setAddOnQuantity: p2 } = (0, import_service.useServiceContext)();
|
|
1308
|
-
|
|
1309
|
-
let m2 = (0, import_react.useMemo)(() =>
|
|
1310
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2450
|
+
la(oa.SERVICE_ADD_ONS, !s2 && !c2);
|
|
2451
|
+
let m2 = (0, import_react.useMemo)(() => P(u2), [u2]), h2 = oi(), g2 = fi(), _2 = n2 && i2 && r2 ? r2 : null, v2 = (0, import_react.useMemo)(() => _2 ? ni(Ki({ serviceId: _2, locale: a2, language: g2, warmupData: h2 }), da, fa) : ua, [_2, a2, g2]), y2 = !_2 && !!s2;
|
|
2452
|
+
return (0, import_jsx_runtime.jsx)($r, { fallback: (0, import_jsx_runtime.jsx)(vi, { children: e5 }), feature: Y.serviceAddOns, children: (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(_i, { children: e5 }), children: (0, import_jsx_runtime.jsx)(ma, { addOnsPromise: v2, isLoading: y2, pickedAddOns: m2, forwardToggleAddOn: d2, forwardSetAddOnQuantity: p2, children: e5 }) }) });
|
|
1311
2453
|
}
|
|
1312
|
-
var
|
|
2454
|
+
var ga = En(`bcc1b809-bde5-4d7d-a7bb-89831fe5ccb8`);
|
|
1313
2455
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1314
2456
|
0 && (module.exports = {
|
|
1315
2457
|
ServiceAddOnsContextProvider,
|