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