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