@wix/bookings 1.0.1771 → 1.0.1773

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