@sarastya-technology/xos-erp-component 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,3240 @@
1
+ import Q, { forwardRef as vt, createElement as Re, createContext as Rt, useContext as Pt, useMemo as ee, useCallback as G, useRef as se, useState as K, useSyncExternalStore as $t, useEffect as ie } from "react";
2
+ var me = { exports: {} }, le = {};
3
+ var Fe;
4
+ function Tt() {
5
+ if (Fe) return le;
6
+ Fe = 1;
7
+ var i = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
8
+ function t(s, n, r) {
9
+ var a = null;
10
+ if (r !== void 0 && (a = "" + r), n.key !== void 0 && (a = "" + n.key), "key" in n) {
11
+ r = {};
12
+ for (var o in n)
13
+ o !== "key" && (r[o] = n[o]);
14
+ } else r = n;
15
+ return n = r.ref, {
16
+ $$typeof: i,
17
+ type: s,
18
+ key: a,
19
+ ref: n !== void 0 ? n : null,
20
+ props: r
21
+ };
22
+ }
23
+ return le.Fragment = e, le.jsx = t, le.jsxs = t, le;
24
+ }
25
+ var ce = {};
26
+ var Ie;
27
+ function At() {
28
+ return Ie || (Ie = 1, process.env.NODE_ENV !== "production" && (function() {
29
+ function i(f) {
30
+ if (f == null) return null;
31
+ if (typeof f == "function")
32
+ return f.$$typeof === z ? null : f.displayName || f.name || null;
33
+ if (typeof f == "string") return f;
34
+ switch (f) {
35
+ case w:
36
+ return "Fragment";
37
+ case N:
38
+ return "Profiler";
39
+ case j:
40
+ return "StrictMode";
41
+ case k:
42
+ return "Suspense";
43
+ case E:
44
+ return "SuspenseList";
45
+ case R:
46
+ return "Activity";
47
+ case P:
48
+ return "ViewTransition";
49
+ }
50
+ if (typeof f == "object")
51
+ switch (typeof f.tag == "number" && console.error(
52
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
53
+ ), f.$$typeof) {
54
+ case L:
55
+ return "Portal";
56
+ case b:
57
+ return f.displayName || "Context";
58
+ case C:
59
+ return (f._context.displayName || "Context") + ".Consumer";
60
+ case v:
61
+ var x = f.render;
62
+ return f = f.displayName, f || (f = x.displayName || x.name || "", f = f !== "" ? "ForwardRef(" + f + ")" : "ForwardRef"), f;
63
+ case T:
64
+ return x = f.displayName || null, x !== null ? x : i(f.type) || "Memo";
65
+ case _:
66
+ x = f._payload, f = f._init;
67
+ try {
68
+ return i(f(x));
69
+ } catch {
70
+ }
71
+ }
72
+ return null;
73
+ }
74
+ function e(f) {
75
+ return "" + f;
76
+ }
77
+ function t(f) {
78
+ try {
79
+ e(f);
80
+ var x = !1;
81
+ } catch {
82
+ x = !0;
83
+ }
84
+ if (x) {
85
+ x = console;
86
+ var O = x.error, D = typeof Symbol == "function" && Symbol.toStringTag && f[Symbol.toStringTag] || f.constructor.name || "Object";
87
+ return O.call(
88
+ x,
89
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
90
+ D
91
+ ), e(f);
92
+ }
93
+ }
94
+ function s(f) {
95
+ if (f === w) return "<>";
96
+ if (typeof f == "object" && f !== null && f.$$typeof === _)
97
+ return "<...>";
98
+ try {
99
+ var x = i(f);
100
+ return x ? "<" + x + ">" : "<...>";
101
+ } catch {
102
+ return "<...>";
103
+ }
104
+ }
105
+ function n() {
106
+ var f = A.A;
107
+ return f === null ? null : f.getOwner();
108
+ }
109
+ function r() {
110
+ return Error("react-stack-top-frame");
111
+ }
112
+ function a(f) {
113
+ if (I.call(f, "key")) {
114
+ var x = Object.getOwnPropertyDescriptor(f, "key").get;
115
+ if (x && x.isReactWarning) return !1;
116
+ }
117
+ return f.key !== void 0;
118
+ }
119
+ function o(f, x) {
120
+ function O() {
121
+ B || (B = !0, console.error(
122
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
123
+ x
124
+ ));
125
+ }
126
+ O.isReactWarning = !0, Object.defineProperty(f, "key", {
127
+ get: O,
128
+ configurable: !0
129
+ });
130
+ }
131
+ function c() {
132
+ var f = i(this.type);
133
+ return M[f] || (M[f] = !0, console.error(
134
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
135
+ )), f = this.props.ref, f !== void 0 ? f : null;
136
+ }
137
+ function d(f, x, O, D, F, V) {
138
+ var $ = O.ref;
139
+ return f = {
140
+ $$typeof: g,
141
+ type: f,
142
+ key: x,
143
+ props: O,
144
+ _owner: D
145
+ }, ($ !== void 0 ? $ : null) !== null ? Object.defineProperty(f, "ref", {
146
+ enumerable: !1,
147
+ get: c
148
+ }) : Object.defineProperty(f, "ref", { enumerable: !1, value: null }), f._store = {}, Object.defineProperty(f._store, "validated", {
149
+ configurable: !1,
150
+ enumerable: !1,
151
+ writable: !0,
152
+ value: 0
153
+ }), Object.defineProperty(f, "_debugInfo", {
154
+ configurable: !1,
155
+ enumerable: !1,
156
+ writable: !0,
157
+ value: null
158
+ }), Object.defineProperty(f, "_debugStack", {
159
+ configurable: !1,
160
+ enumerable: !1,
161
+ writable: !0,
162
+ value: F
163
+ }), Object.defineProperty(f, "_debugTask", {
164
+ configurable: !1,
165
+ enumerable: !1,
166
+ writable: !0,
167
+ value: V
168
+ }), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
169
+ }
170
+ function u(f, x, O, D, F, V) {
171
+ var $ = x.children;
172
+ if ($ !== void 0)
173
+ if (D)
174
+ if (Z($)) {
175
+ for (D = 0; D < $.length; D++)
176
+ h($[D]);
177
+ Object.freeze && Object.freeze($);
178
+ } else
179
+ console.error(
180
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
181
+ );
182
+ else h($);
183
+ if (I.call(x, "key")) {
184
+ $ = i(f);
185
+ var Y = Object.keys(x).filter(function(_t) {
186
+ return _t !== "key";
187
+ });
188
+ D = 0 < Y.length ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}", y[$ + D] || (Y = 0 < Y.length ? "{" + Y.join(": ..., ") + ": ...}" : "{}", console.error(
189
+ `A props object containing a "key" prop is being spread into JSX:
190
+ let props = %s;
191
+ <%s {...props} />
192
+ React keys must be passed directly to JSX without using spread:
193
+ let props = %s;
194
+ <%s key={someKey} {...props} />`,
195
+ D,
196
+ $,
197
+ Y,
198
+ $
199
+ ), y[$ + D] = !0);
200
+ }
201
+ if ($ = null, O !== void 0 && (t(O), $ = "" + O), a(x) && (t(x.key), $ = "" + x.key), "key" in x) {
202
+ O = {};
203
+ for (var Le in x)
204
+ Le !== "key" && (O[Le] = x[Le]);
205
+ } else O = x;
206
+ return $ && o(
207
+ O,
208
+ typeof f == "function" ? f.displayName || f.name || "Unknown" : f
209
+ ), d(
210
+ f,
211
+ $,
212
+ O,
213
+ n(),
214
+ F,
215
+ V
216
+ );
217
+ }
218
+ function h(f) {
219
+ p(f) ? f._store && (f._store.validated = 1) : typeof f == "object" && f !== null && f.$$typeof === _ && (f._payload.status === "fulfilled" ? p(f._payload.value) && f._payload.value._store && (f._payload.value._store.validated = 1) : f._store && (f._store.validated = 1));
220
+ }
221
+ function p(f) {
222
+ return typeof f == "object" && f !== null && f.$$typeof === g;
223
+ }
224
+ var m = Q, g = /* @__PURE__ */ Symbol.for("react.transitional.element"), L = /* @__PURE__ */ Symbol.for("react.portal"), w = /* @__PURE__ */ Symbol.for("react.fragment"), j = /* @__PURE__ */ Symbol.for("react.strict_mode"), N = /* @__PURE__ */ Symbol.for("react.profiler"), C = /* @__PURE__ */ Symbol.for("react.consumer"), b = /* @__PURE__ */ Symbol.for("react.context"), v = /* @__PURE__ */ Symbol.for("react.forward_ref"), k = /* @__PURE__ */ Symbol.for("react.suspense"), E = /* @__PURE__ */ Symbol.for("react.suspense_list"), T = /* @__PURE__ */ Symbol.for("react.memo"), _ = /* @__PURE__ */ Symbol.for("react.lazy"), R = /* @__PURE__ */ Symbol.for("react.activity"), P = /* @__PURE__ */ Symbol.for("react.view_transition"), z = /* @__PURE__ */ Symbol.for("react.client.reference"), A = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, I = Object.prototype.hasOwnProperty, Z = Array.isArray, q = console.createTask ? console.createTask : function() {
225
+ return null;
226
+ };
227
+ m = {
228
+ react_stack_bottom_frame: function(f) {
229
+ return f();
230
+ }
231
+ };
232
+ var B, M = {}, U = m.react_stack_bottom_frame.bind(
233
+ m,
234
+ r
235
+ )(), J = q(s(r)), y = {};
236
+ ce.Fragment = w, ce.jsx = function(f, x, O) {
237
+ var D = 1e4 > A.recentlyCreatedOwnerStacks++;
238
+ if (D) {
239
+ var F = Error.stackTraceLimit;
240
+ Error.stackTraceLimit = 10;
241
+ var V = Error("react-stack-top-frame");
242
+ Error.stackTraceLimit = F;
243
+ } else V = U;
244
+ return u(
245
+ f,
246
+ x,
247
+ O,
248
+ !1,
249
+ V,
250
+ D ? q(s(f)) : J
251
+ );
252
+ }, ce.jsxs = function(f, x, O) {
253
+ var D = 1e4 > A.recentlyCreatedOwnerStacks++;
254
+ if (D) {
255
+ var F = Error.stackTraceLimit;
256
+ Error.stackTraceLimit = 10;
257
+ var V = Error("react-stack-top-frame");
258
+ Error.stackTraceLimit = F;
259
+ } else V = U;
260
+ return u(
261
+ f,
262
+ x,
263
+ O,
264
+ !0,
265
+ V,
266
+ D ? q(s(f)) : J
267
+ );
268
+ };
269
+ })()), ce;
270
+ }
271
+ var Me;
272
+ function Dt() {
273
+ return Me || (Me = 1, process.env.NODE_ENV === "production" ? me.exports = Tt() : me.exports = At()), me.exports;
274
+ }
275
+ var l = Dt();
276
+ const Cn = ({
277
+ isOpen: i,
278
+ title: e,
279
+ message: t,
280
+ cancelLabel: s,
281
+ confirmLabel: n,
282
+ onClose: r,
283
+ onConfirm: a
284
+ }) => i ? /* @__PURE__ */ l.jsx(
285
+ "div",
286
+ {
287
+ className: "list-close-confirmation-overlay",
288
+ onClick: (o) => {
289
+ o.target === o.currentTarget && r();
290
+ },
291
+ children: /* @__PURE__ */ l.jsxs("div", { className: "list-close-confirmation-box", children: [
292
+ /* @__PURE__ */ l.jsxs("div", { className: "list-close-confirmation-content", children: [
293
+ /* @__PURE__ */ l.jsx("div", { className: "list-close-confirmation-icon-wrapper", children: /* @__PURE__ */ l.jsxs("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
294
+ /* @__PURE__ */ l.jsx("line", { x1: "12", y1: "6", x2: "12", y2: "13", stroke: "#f59e0b", strokeWidth: "2.75", strokeLinecap: "round" }),
295
+ /* @__PURE__ */ l.jsx("circle", { cx: "12", cy: "17.5", r: "1.5", fill: "#f59e0b" })
296
+ ] }) }),
297
+ /* @__PURE__ */ l.jsxs("div", { className: "list-close-confirmation-text", children: [
298
+ /* @__PURE__ */ l.jsx("h3", { className: "list-close-confirmation-title", children: e }),
299
+ /* @__PURE__ */ l.jsx("p", { className: "list-close-confirmation-message", children: t })
300
+ ] })
301
+ ] }),
302
+ /* @__PURE__ */ l.jsxs("div", { className: "list-close-confirmation-actions", children: [
303
+ /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-close-confirmation-cancel", onClick: r, children: s }),
304
+ /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-close-confirmation-confirm", onClick: a, children: n })
305
+ ] })
306
+ ] })
307
+ }
308
+ ) : null;
309
+ const Ft = (i) => i.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), It = (i) => i.replace(
310
+ /^([A-Z])|[\s-_]+(\w)/g,
311
+ (e, t, s) => s ? s.toUpperCase() : t.toLowerCase()
312
+ ), ze = (i) => {
313
+ const e = It(i);
314
+ return e.charAt(0).toUpperCase() + e.slice(1);
315
+ }, wt = (...i) => i.filter((e, t, s) => !!e && e.trim() !== "" && s.indexOf(e) === t).join(" ").trim(), Mt = (i) => {
316
+ for (const e in i)
317
+ if (e.startsWith("aria-") || e === "role" || e === "title")
318
+ return !0;
319
+ };
320
+ var zt = {
321
+ xmlns: "http://www.w3.org/2000/svg",
322
+ width: 24,
323
+ height: 24,
324
+ viewBox: "0 0 24 24",
325
+ fill: "none",
326
+ stroke: "currentColor",
327
+ strokeWidth: 2,
328
+ strokeLinecap: "round",
329
+ strokeLinejoin: "round"
330
+ };
331
+ const Vt = vt(
332
+ ({
333
+ color: i = "currentColor",
334
+ size: e = 24,
335
+ strokeWidth: t = 2,
336
+ absoluteStrokeWidth: s,
337
+ className: n = "",
338
+ children: r,
339
+ iconNode: a,
340
+ ...o
341
+ }, c) => Re(
342
+ "svg",
343
+ {
344
+ ref: c,
345
+ ...zt,
346
+ width: e,
347
+ height: e,
348
+ stroke: i,
349
+ strokeWidth: s ? Number(t) * 24 / Number(e) : t,
350
+ className: wt("lucide", n),
351
+ ...!r && !Mt(o) && { "aria-hidden": "true" },
352
+ ...o
353
+ },
354
+ [
355
+ ...a.map(([d, u]) => Re(d, u)),
356
+ ...Array.isArray(r) ? r : [r]
357
+ ]
358
+ )
359
+ );
360
+ const W = (i, e) => {
361
+ const t = vt(
362
+ ({ className: s, ...n }, r) => Re(Vt, {
363
+ ref: r,
364
+ iconNode: e,
365
+ className: wt(
366
+ `lucide-${Ft(ze(i))}`,
367
+ `lucide-${i}`,
368
+ s
369
+ ),
370
+ ...n
371
+ })
372
+ );
373
+ return t.displayName = ze(i), t;
374
+ };
375
+ const Kt = [
376
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
377
+ ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
378
+ ], Ut = W("arrow-right", Kt);
379
+ const Bt = [
380
+ ["path", { d: "M8 2v4", key: "1cmpym" }],
381
+ ["path", { d: "M16 2v4", key: "4m81vk" }],
382
+ ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
383
+ ["path", { d: "M3 10h18", key: "8toen8" }]
384
+ ], Wt = W("calendar", Bt);
385
+ const Ht = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], Yt = W("check", Ht);
386
+ const qt = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], Nt = W("chevron-down", qt);
387
+ const Jt = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], De = W("chevron-left", Jt);
388
+ const Gt = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], jt = W("chevron-right", Gt);
389
+ const Qt = [
390
+ ["path", { d: "M12 6v6l4 2", key: "mmk7yg" }],
391
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
392
+ ], Zt = W("clock", Qt);
393
+ const Xt = [
394
+ ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
395
+ ["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
396
+ ["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
397
+ ], es = W("ellipsis", Xt);
398
+ const ts = [
399
+ [
400
+ "path",
401
+ {
402
+ d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",
403
+ key: "sc7q7i"
404
+ }
405
+ ]
406
+ ], Ve = W("funnel", ts);
407
+ const ss = [
408
+ ["path", { d: "M12 17v5", key: "bb1du9" }],
409
+ [
410
+ "path",
411
+ {
412
+ d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",
413
+ key: "1nkz8b"
414
+ }
415
+ ]
416
+ ], ns = W("pin", ss);
417
+ const is = [
418
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
419
+ ["path", { d: "M12 5v14", key: "s699le" }]
420
+ ], rs = W("plus", is);
421
+ const as = [
422
+ ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
423
+ ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
424
+ ], os = W("rotate-ccw", as);
425
+ const ls = [
426
+ ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
427
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
428
+ ], cs = W("search", ls);
429
+ const ds = [
430
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
431
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
432
+ ], us = W("x", ds), S = (i) => typeof i == "string", de = () => {
433
+ let i, e;
434
+ const t = new Promise((s, n) => {
435
+ i = s, e = n;
436
+ });
437
+ return t.resolve = i, t.reject = e, t;
438
+ }, ue = (i) => i == null ? "" : String(i), hs = (i) => S(i) && /^[A-Za-z0-9_@.-]{1,128}$/.test(i) && !i.includes("..") && !["__proto__", "constructor", "prototype"].includes(i), Pe = (i) => i?.callbackApi ?? i?.constructor?.callbackApi, fs = (i, e, t) => {
439
+ i.forEach((s) => {
440
+ e[s] && (t[s] = e[s]);
441
+ });
442
+ }, ps = /###/g, Ke = (i) => i && i.includes("###") ? i.replace(ps, ".") : i, Ue = (i) => !i || typeof i != "object" && typeof i != "function", he = (i, e, t) => {
443
+ const s = S(e) ? e.split(".") : e;
444
+ let n = 0;
445
+ for (; n < s.length - 1; ) {
446
+ if (Ue(i)) return {};
447
+ const r = Ke(s[n]);
448
+ !i[r] && t && (i[r] = new t()), Object.prototype.hasOwnProperty.call(i, r) ? i = i[r] : i = {}, ++n;
449
+ }
450
+ return Ue(i) ? {} : {
451
+ obj: i,
452
+ k: Ke(s[n])
453
+ };
454
+ }, Be = (i, e, t) => {
455
+ const {
456
+ obj: s,
457
+ k: n
458
+ } = he(i, e, Object);
459
+ if (s !== void 0 && !(Array.isArray(s) && n === "length") || e.length === 1) {
460
+ s[n] = t;
461
+ return;
462
+ }
463
+ let r = e[e.length - 1], a = e.slice(0, e.length - 1), o = he(i, a, Object);
464
+ for (; o.obj === void 0 && a.length; )
465
+ r = `${a[a.length - 1]}.${r}`, a = a.slice(0, a.length - 1), o = he(i, a, Object), o?.obj && typeof o.obj[`${o.k}.${r}`] < "u" && (o.obj = void 0);
466
+ o.obj[`${o.k}.${r}`] = t;
467
+ }, gs = (i, e, t, s) => {
468
+ const {
469
+ obj: n,
470
+ k: r
471
+ } = he(i, e, Object);
472
+ (!Object.prototype.hasOwnProperty.call(n, r) || !n[r]) && (n[r] = []), n[r].push(t);
473
+ }, Ne = (i, e) => {
474
+ const {
475
+ obj: t,
476
+ k: s
477
+ } = he(i, e);
478
+ if (t && Object.prototype.hasOwnProperty.call(t, s))
479
+ return t[s];
480
+ }, ms = (i, e, t) => {
481
+ const s = Ne(i, t);
482
+ return s !== void 0 ? s : Ne(e, t);
483
+ }, We = (i) => i === null || typeof i != "object" || i instanceof String, St = (i, e, t) => {
484
+ for (const s in e)
485
+ s !== "__proto__" && s !== "constructor" && (Object.prototype.hasOwnProperty.call(i, s) ? We(i[s]) || We(e[s]) ? t && (i[s] = e[s]) : St(i[s], e[s], t) : i[s] = e[s]);
486
+ return i;
487
+ }, X = (i) => i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), xs = {
488
+ "&": "&amp;",
489
+ "<": "&lt;",
490
+ ">": "&gt;",
491
+ '"': "&quot;",
492
+ "'": "&#39;"
493
+ }, ys = (i) => S(i) ? i.replace(/[&<>"']/g, (e) => xs[e]) : i;
494
+ class bs {
495
+ constructor(e) {
496
+ this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
497
+ }
498
+ getRegExp(e) {
499
+ const t = this.regExpMap.get(e);
500
+ if (t !== void 0)
501
+ return t;
502
+ const s = new RegExp(e);
503
+ return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, s), this.regExpQueue.push(e), s;
504
+ }
505
+ }
506
+ const vs = [" ", ",", "?", "!", ";"], ws = new bs(20), Ns = (i, e, t) => {
507
+ e = e || "", t = t || "";
508
+ const s = vs.filter((a) => !e.includes(a) && !t.includes(a));
509
+ if (s.length === 0) return !0;
510
+ const n = ws.getRegExp(`(${s.map((a) => a === "?" ? "\\?" : a).join("|")})`);
511
+ let r = !n.test(i);
512
+ if (!r) {
513
+ const a = i.indexOf(t);
514
+ a > 0 && !n.test(i.substring(0, a)) && (r = !0);
515
+ }
516
+ return r;
517
+ }, $e = (i, e, t = ".") => {
518
+ if (!i) return;
519
+ if (i[e] || !t)
520
+ return Object.prototype.hasOwnProperty.call(i, e) ? i[e] : void 0;
521
+ const s = e.split(t);
522
+ let n = i;
523
+ for (let r = 0; r < s.length; ) {
524
+ if (!n || typeof n != "object")
525
+ return;
526
+ let a, o = "";
527
+ for (let c = r; c < s.length; ++c)
528
+ if (c !== r && (o += t), o += s[c], a = n[o], (typeof a == "function" || o === "__proto__") && !Object.prototype.hasOwnProperty.call(n, o) && (a = void 0), a !== void 0) {
529
+ if (["string", "number", "boolean"].includes(typeof a) && c < s.length - 1)
530
+ continue;
531
+ r += c - r + 1;
532
+ break;
533
+ }
534
+ n = a;
535
+ }
536
+ return n;
537
+ }, re = (i) => i?.replace(/_/g, "-"), js = {
538
+ type: "logger",
539
+ log(i) {
540
+ this.output("log", i);
541
+ },
542
+ warn(i) {
543
+ this.output("warn", i);
544
+ },
545
+ error(i) {
546
+ this.output("error", i);
547
+ },
548
+ output(i, e) {
549
+ console?.[i]?.apply?.(console, e);
550
+ }
551
+ };
552
+ class pe {
553
+ constructor(e, t = {}) {
554
+ this.init(e, t);
555
+ }
556
+ init(e, t = {}) {
557
+ this.prefix = t.prefix || "i18next:", this.logger = e || js, this.options = t, this.debug = t.debug, this.seen = /* @__PURE__ */ new Set();
558
+ }
559
+ log(...e) {
560
+ return this.forward(e, "log", "", !0);
561
+ }
562
+ warn(...e) {
563
+ return this.forward(e, "warn", "", !0);
564
+ }
565
+ error(...e) {
566
+ return this.forward(e, "error", "");
567
+ }
568
+ deprecate(...e) {
569
+ return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
570
+ }
571
+ once(e, t, ...s) {
572
+ return !this.debug || this.seen.has(e) || this.seen.size >= 1e3 ? null : (this.seen.add(e), this[t](...s));
573
+ }
574
+ forward(e, t, s, n) {
575
+ return n && !this.debug ? null : (e = e.map((r) => S(r) ? r.replace(/[\r\n\x00-\x1F\x7F]/g, " ") : r), S(e[0]) && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
576
+ }
577
+ create(e) {
578
+ return new pe(this.logger, {
579
+ prefix: `${this.prefix}:${e}:`,
580
+ ...this.options
581
+ });
582
+ }
583
+ clone(e) {
584
+ return e = e || this.options, e.prefix = e.prefix || this.prefix, new pe(this.logger, e);
585
+ }
586
+ }
587
+ var ne = new pe();
588
+ const He = /* @__PURE__ */ new WeakSet();
589
+ class Ce {
590
+ constructor() {
591
+ this.observers = {};
592
+ }
593
+ on(e, t) {
594
+ return e.split(" ").forEach((s) => {
595
+ this.observers[s] || (this.observers[s] = /* @__PURE__ */ new Map());
596
+ const n = this.observers[s].get(t) || 0;
597
+ this.observers[s].set(t, n + 1);
598
+ }), this;
599
+ }
600
+ off(e, t) {
601
+ (typeof e == "string" ? e.split(" ") : [e]).forEach((s) => {
602
+ if (this.observers[s]) {
603
+ if (!t) {
604
+ delete this.observers[s];
605
+ return;
606
+ }
607
+ this.observers[s].delete(t), He.has(t) && this.observers[s].forEach((n, r) => {
608
+ r.listener === t && this.observers[s].delete(r);
609
+ });
610
+ }
611
+ });
612
+ }
613
+ once(e, t) {
614
+ const s = (...n) => {
615
+ this.off(e, s), t(...n);
616
+ };
617
+ return s.listener = t, He.add(t), this.on(e, s), this;
618
+ }
619
+ emit(e, ...t) {
620
+ this.observers[e] && Array.from(this.observers[e].entries()).forEach(([n, r]) => {
621
+ for (let a = 0; a < r; a++)
622
+ n(...t);
623
+ }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([n, r]) => {
624
+ for (let a = 0; a < r; a++)
625
+ n(e, ...t);
626
+ });
627
+ }
628
+ }
629
+ const Ye = /* @__PURE__ */ new WeakSet(), Oe = (i, ...e) => {
630
+ if (e.some((t) => !S(t)))
631
+ throw new TypeError(`${i}: pass language, namespace${i === "addResource" ? " and key" : ""} as separate strings; the dotted form ('en.translation.key') was removed in i18next v27`);
632
+ };
633
+ class qe extends Ce {
634
+ constructor(e, t = {
635
+ ns: ["translation"],
636
+ defaultNS: "translation"
637
+ }, s = ne) {
638
+ super(), this.data = e || {}, this.options = t, this.logger = s.create("resourceStore"), this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
639
+ }
640
+ addNamespaces(e) {
641
+ this.options.ns.includes(e) || this.options.ns.push(e);
642
+ }
643
+ removeNamespaces(e) {
644
+ const t = this.options.ns.indexOf(e);
645
+ t > -1 && this.options.ns.splice(t, 1);
646
+ }
647
+ getResource(e, t, s, n = {}) {
648
+ const r = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, a = n.ignoreJSONStructure !== void 0 ? n.ignoreJSONStructure : this.options.ignoreJSONStructure, o = [e, t];
649
+ s && (Array.isArray(s) ? o.push(...s) : S(s) && r ? o.push(...s.split(r)) : o.push(s));
650
+ const c = Ne(this.data, o);
651
+ return c != null || !a || !S(s) ? c : $e(this.data?.[e]?.[t], s, r);
652
+ }
653
+ addResource(e, t, s, n, r = {
654
+ silent: !1
655
+ }) {
656
+ Oe("addResource", e, t, s);
657
+ const a = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator;
658
+ let o = [e, t];
659
+ s && (o = o.concat(a ? s.split(a) : s)), this.addNamespaces(t), Be(this.data, o, n), r.silent || this.emit("added", e, t, s, n);
660
+ }
661
+ addResources(e, t, s, n = {
662
+ silent: !1
663
+ }) {
664
+ Oe("addResources", e, t), Object.keys(s || {}).forEach((r) => {
665
+ r === "__proto__" || r === "constructor" || this.addResource(e, t, r, s[r], {
666
+ silent: !0
667
+ });
668
+ }), n.silent || this.emit("added", e, t, s);
669
+ }
670
+ addResourceBundle(e, t, s, n, r, a = {
671
+ silent: !1,
672
+ skipCopy: !1
673
+ }) {
674
+ Oe("addResourceBundle", e, t);
675
+ const o = [e, t];
676
+ this.addNamespaces(t);
677
+ let c = Ne(this.data, o) || {};
678
+ a.skipCopy || (s = JSON.parse(JSON.stringify(s))), n ? St(c, s, r) : c = {
679
+ ...c,
680
+ ...s
681
+ }, Be(this.data, o, c), a.silent || this.emit("added", e, t, s);
682
+ }
683
+ removeResourceBundle(e, t) {
684
+ this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
685
+ }
686
+ hasResourceBundle(e, t) {
687
+ return this.getResource(e, t) !== void 0;
688
+ }
689
+ getResourceBundle(e, t) {
690
+ return t || (t = this.options.defaultNS), this.getResource(e, t);
691
+ }
692
+ getDataByLanguage(e) {
693
+ return this.data[e];
694
+ }
695
+ hasLanguageSomeTranslations(e) {
696
+ const t = this.getDataByLanguage(e);
697
+ return !!(t && Object.keys(t) || []).find((n) => {
698
+ const r = t[n];
699
+ return Ye.has(r) ? !0 : !r || Object.keys(r).length === 0 ? !1 : (typeof r == "object" && Ye.add(r), !0);
700
+ });
701
+ }
702
+ toJSON() {
703
+ return this.data;
704
+ }
705
+ }
706
+ const kt = /* @__PURE__ */ Symbol("i18next/PATH_KEY");
707
+ function Ss() {
708
+ const i = [], e = /* @__PURE__ */ Object.create(null);
709
+ let t;
710
+ return e.get = (s, n) => (t?.revoke?.(), n === kt ? i : (i.push(n), t = Proxy.revocable(s, e), t.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
711
+ }
712
+ function te(i, e) {
713
+ const {
714
+ [kt]: t
715
+ } = i(Ss()), s = e?.keySeparator || ".", n = e?.nsSeparator ?? ":", r = e?.enableSelector === "strict";
716
+ if (t.length > 1 && n) {
717
+ const a = e?.ns, o = r ? Array.isArray(a) ? a : a ? [a] : null : Array.isArray(a) ? a : null;
718
+ if (o && (r ? o : o.length > 1 ? o.slice(1) : []).includes(t[0]))
719
+ return `${t[0]}${n}${t.slice(1).join(s)}`;
720
+ }
721
+ return t.join(s);
722
+ }
723
+ const Je = (i) => i === 0 || typeof i == "bigint" && !i, xe = (i) => !S(i) && typeof i != "boolean" && typeof i != "number";
724
+ class je extends Ce {
725
+ constructor(e, t = {}) {
726
+ super(), fs(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils", "postProcessors"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = (e.logger || ne).create("translator"), this.checkedLoadedFor = {};
727
+ }
728
+ changeLanguage(e) {
729
+ e && (this.language = e);
730
+ }
731
+ exists(e, t = {
732
+ interpolation: {}
733
+ }) {
734
+ const s = {
735
+ ...t
736
+ };
737
+ if (e == null) return !1;
738
+ const n = this.resolve(e, s);
739
+ if (n?.res === void 0) return !1;
740
+ const r = xe(n.res);
741
+ return !(s.returnObjects === !1 && r);
742
+ }
743
+ extractFromKey(e, t) {
744
+ let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
745
+ s === void 0 && (s = ":");
746
+ const n = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
747
+ let r = t.ns || this.options.defaultNS || [];
748
+ const a = s && e.includes(s), o = a && !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Ns(e, s, n);
749
+ if (a && !o) {
750
+ const c = e.match(this.interpolator.nestingRegexp);
751
+ if (c && c.length > 0)
752
+ return {
753
+ key: e,
754
+ namespaces: S(r) ? [r] : r
755
+ };
756
+ const d = e.split(s);
757
+ (s !== n || s === n && this.options.ns.includes(d[0])) && (r = d.shift()), e = d.join(n === !1 ? s : n);
758
+ }
759
+ return {
760
+ key: e,
761
+ namespaces: S(r) ? [r] : r
762
+ };
763
+ }
764
+ translate(e, t, s) {
765
+ let n = typeof t == "object" ? {
766
+ ...t
767
+ } : t;
768
+ if (typeof n != "object" && this.options.overloadTranslationOptionHandler && (n = this.options.overloadTranslationOptionHandler(arguments)), typeof n == "object" && (n = {
769
+ ...n
770
+ }), n || (n = {}), e == null) return "";
771
+ typeof e == "function" && (e = te(e, {
772
+ ...this.options,
773
+ ...n
774
+ })), Array.isArray(e) || (e = [String(e)]), e = e.map((M) => typeof M == "function" ? te(M, {
775
+ ...this.options,
776
+ ...n
777
+ }) : String(M));
778
+ const r = n.returnDetails !== void 0 ? n.returnDetails : this.options.returnDetails, a = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, {
779
+ key: o,
780
+ namespaces: c
781
+ } = this.extractFromKey(e[e.length - 1], n), d = c[c.length - 1];
782
+ let u = n.nsSeparator !== void 0 ? n.nsSeparator : this.options.nsSeparator;
783
+ u === void 0 && (u = ":");
784
+ const h = n.lng || this.language, p = n.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
785
+ if (h?.toLowerCase() === "cimode")
786
+ return p ? r ? {
787
+ res: `${d}${u}${o}`,
788
+ usedKey: o,
789
+ exactUsedKey: o,
790
+ usedLng: h,
791
+ usedNS: d,
792
+ usedParams: this.getUsedParamsDetails(n)
793
+ } : `${d}${u}${o}` : r ? {
794
+ res: o,
795
+ usedKey: o,
796
+ exactUsedKey: o,
797
+ usedLng: h,
798
+ usedNS: d,
799
+ usedParams: this.getUsedParamsDetails(n)
800
+ } : o;
801
+ const m = this.resolve(e, n);
802
+ let g = m?.res;
803
+ const L = m?.usedKey || o, w = m?.exactUsedKey || o, j = ["[object Number]", "[object Function]", "[object RegExp]"], N = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, C = !this.i18nFormat || this.i18nFormat.handleAsObject, b = n.count !== void 0 && !S(n.count), v = je.hasDefaultValue(n), k = b ? this.pluralResolver.getSuffix(h, n.count, n) : "", E = n.ordinal && b ? this.pluralResolver.getSuffix(h, n.count, {
804
+ ordinal: !1
805
+ }) : "", T = b && !n.ordinal && Je(n.count), _ = this.options.pluralSeparator, R = n.defaultValue ?? (b ? n[`defaultValue${n.ordinal ? `${_}ordinal${_}` : _}other`] : void 0), P = n[`defaultValue${k}`] ?? n[`defaultValue${E}`] ?? R, z = (T ? n[`defaultValue${_}zero`] : void 0) ?? P;
806
+ let A = g;
807
+ C && !g && v && (A = z);
808
+ const I = xe(A), Z = Object.prototype.toString.apply(A), q = C && A && I && !j.includes(Z) && !(S(N) && Array.isArray(A)), B = q && !n.returnObjects && !this.options.returnObjects;
809
+ if (B && this.options.returnedObjectHandler) {
810
+ const M = this.options.returnedObjectHandler(L, A, {
811
+ ...n,
812
+ ns: c
813
+ });
814
+ return r ? (m.res = M, m.usedParams = this.getUsedParamsDetails(n), m) : M;
815
+ }
816
+ if (B && this.logger.warn("accessing an object - but returnObjects options is not enabled!"), q && !B) {
817
+ if (a) {
818
+ const M = Array.isArray(A), U = M ? [] : {}, J = M ? w : L;
819
+ for (const y in A)
820
+ if (Object.prototype.hasOwnProperty.call(A, y)) {
821
+ const f = `${J}${a}${y}`;
822
+ v && !g ? U[y] = this.translate(f, {
823
+ ...n,
824
+ defaultValue: xe(z) ? z[y] : void 0,
825
+ joinArrays: !1,
826
+ ns: c
827
+ }) : U[y] = this.translate(f, {
828
+ ...n,
829
+ joinArrays: !1,
830
+ ns: c
831
+ }), U[y] === f && (U[y] = A[y]);
832
+ }
833
+ g = U;
834
+ }
835
+ } else if (C && S(N) && Array.isArray(g))
836
+ g = g.join(N), g && (g = this.extendTranslation(g, e, n, m, s));
837
+ else {
838
+ let M = !1, U = !1;
839
+ B && (g = void 0), !this.isValidLookup(g) && v && !(B && xe(z)) && (M = !0, g = z), !this.isValidLookup(g) && !(M && g === "") && (U = !0, g = o);
840
+ const y = (n.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && U ? void 0 : g, f = v && z !== g && this.options.updateMissing;
841
+ if (!B && (U || M || f)) {
842
+ if (this.logger.log(f ? "updateKey" : "missingKey", h, d, b && !f ? `${o}${this.pluralResolver.getSuffix(h, n.count, n)}` : o, f ? z : g), a && this.logger.debug) {
843
+ const F = this.resolve(o, {
844
+ ...n,
845
+ keySeparator: !1
846
+ });
847
+ F && F.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.");
848
+ }
849
+ let x = [];
850
+ const O = this.languageUtils.getFallbackCodes(this.options.fallbackLng, n.lng || this.language);
851
+ if (this.options.saveMissingTo === "fallback" && O && O[0])
852
+ for (let F = 0; F < O.length; F++)
853
+ x.push(O[F]);
854
+ else this.options.saveMissingTo === "all" ? x = this.languageUtils.toResolveHierarchy(n.lng || this.language) : x.push(n.lng || this.language);
855
+ const D = (F, V, $) => {
856
+ const Y = v && $ !== g ? $ : y;
857
+ this.options.missingKeyHandler ? this.options.missingKeyHandler(F, d, V, Y, f, n) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(F, d, V, Y, f, n, void 0, this.utils?.hasLoadedNamespace), this.emit("missingKey", F, d, V, g);
858
+ };
859
+ this.options.saveMissing && (this.options.saveMissingPlurals && b ? x.forEach((F) => {
860
+ const V = this.pluralResolver.getSuffixes(F, n), $ = n[`defaultValue${_}zero`];
861
+ T && $ !== void 0 && $ !== null && !V.includes(`${_}zero`) && V.push(`${_}zero`), V.forEach((Y) => {
862
+ D([F], o + Y, n[`defaultValue${Y}`] ?? (Y === k ? P : R) ?? z);
863
+ });
864
+ }) : D(x, o, z));
865
+ }
866
+ g = this.extendTranslation(g, e, n, m, s), U && g === o && this.options.appendNamespaceToMissingKey && (g = `${d}${u}${o}`), (U || M) && this.options.parseMissingKeyHandler && (g = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${d}${u}${o}` : o, M ? g : void 0, n));
867
+ }
868
+ return r ? (m.res = g, m.usedParams = this.getUsedParamsDetails(n), m) : g;
869
+ }
870
+ extendTranslation(e, t, s, n, r) {
871
+ if (this.i18nFormat?.parse)
872
+ e = this.i18nFormat.parse(e, {
873
+ ...this.options.interpolation.defaultVariables,
874
+ ...s
875
+ }, s.lng || this.language || n.usedLng, n.usedNS, n.usedKey, {
876
+ resolved: n
877
+ });
878
+ else if (!s.skipInterpolation) {
879
+ s.interpolation && this.interpolator.init({
880
+ ...s,
881
+ interpolation: {
882
+ ...this.options.interpolation,
883
+ ...s.interpolation
884
+ }
885
+ });
886
+ const c = S(e) && (s?.interpolation?.skipOnVariables !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
887
+ let d;
888
+ if (c) {
889
+ const h = e.includes(this.interpolator.nestingPrefixText) ? e.match(this.interpolator.nestingRegexp) : null;
890
+ d = h && h.length;
891
+ }
892
+ let u = s.replace && !S(s.replace) ? s.replace : s;
893
+ if (this.options.interpolation.defaultVariables && (u = {
894
+ ...this.options.interpolation.defaultVariables,
895
+ ...u
896
+ }), e = this.interpolator.interpolate(e, u, s.lng || this.language || n.usedLng, s), c) {
897
+ const h = e.includes(this.interpolator.nestingPrefixText) ? e.match(this.interpolator.nestingRegexp) : null, p = h && h.length;
898
+ d < p && (s.nest = !1);
899
+ }
900
+ !s.lng && n && n.res && (s.lng = this.language || n.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, (...h) => r?.[0] === h[0] && !s.context ? (this.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${t[0]}`), null) : this.translate(...h, t), s)), s.interpolation && this.interpolator.reset();
901
+ }
902
+ const a = s.postProcess || this.options.postProcess, o = S(a) ? [a] : a;
903
+ if (e != null && o?.length && s.applyPostProcessor !== !1) {
904
+ const c = this.options?.postProcessPassResolved ? {
905
+ i18nResolved: {
906
+ ...n,
907
+ usedParams: this.getUsedParamsDetails(s)
908
+ },
909
+ ...s
910
+ } : s;
911
+ o.forEach((d) => {
912
+ const u = this.postProcessors?.[d];
913
+ if (!u) {
914
+ this.logger.once(`postProcess:${d}`, "warn", `postProcess: '${d}' is not registered on this i18next instance; call use() with it on this instance`);
915
+ return;
916
+ }
917
+ e = u.process(e, t, c, this) ?? e;
918
+ });
919
+ }
920
+ return e;
921
+ }
922
+ resolve(e, t = {}) {
923
+ let s, n, r, a, o;
924
+ return S(e) && (e = [e]), Array.isArray(e) && (e = e.map((c) => typeof c == "function" ? te(c, {
925
+ ...this.options,
926
+ ...t
927
+ }) : c)), e.forEach((c) => {
928
+ if (this.isValidLookup(s)) return;
929
+ const d = this.extractFromKey(c, t), u = d.key;
930
+ n = u;
931
+ let h = d.namespaces;
932
+ this.options.fallbackNS && (h = h.concat(this.options.fallbackNS));
933
+ const p = t.count !== void 0 && !S(t.count), m = p && !t.ordinal && Je(t.count), g = t.context !== void 0 && (S(t.context) || typeof t.context == "number") && t.context !== "", L = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
934
+ h.forEach((w) => {
935
+ this.isValidLookup(s) || (o = w, !this.checkedLoadedFor[`${L[0]}-${w}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (this.checkedLoadedFor[`${L[0]}-${w}`] = !0, this.logger.warn(`key "${n}" for languages "${L.join(", ")}" won't get resolved as namespace "${o}" 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!!!")), L.forEach((j) => {
936
+ if (this.isValidLookup(s)) return;
937
+ a = j;
938
+ const N = [u];
939
+ if (this.i18nFormat?.addLookupKeys)
940
+ this.i18nFormat.addLookupKeys(N, u, j, w, t);
941
+ else {
942
+ let b;
943
+ p && (b = this.pluralResolver.getSuffix(j, t.count, t));
944
+ const v = `${this.options.pluralSeparator}zero`, k = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
945
+ if (p && (t.ordinal && b.startsWith(k) && N.push(u + b.replace(k, this.options.pluralSeparator)), N.push(u + b), m && N.push(u + v)), g) {
946
+ const E = `${u}${this.options.contextSeparator || "_"}${t.context}`;
947
+ N.push(E), p && (t.ordinal && b.startsWith(k) && N.push(E + b.replace(k, this.options.pluralSeparator)), N.push(E + b), m && N.push(E + v));
948
+ }
949
+ if (p) {
950
+ const E = `${t.ordinal ? k : this.options.pluralSeparator}other`;
951
+ b !== E && (g && N.unshift(`${u}${this.options.contextSeparator || "_"}${t.context}${E}`), N.unshift(u + E));
952
+ }
953
+ }
954
+ let C;
955
+ for (; C = N.pop(); )
956
+ this.isValidLookup(s) || (r = C, s = this.getResource(j, w, C, t));
957
+ }));
958
+ });
959
+ }), {
960
+ res: s,
961
+ usedKey: n,
962
+ exactUsedKey: r,
963
+ usedLng: a,
964
+ usedNS: o
965
+ };
966
+ }
967
+ isValidLookup(e) {
968
+ return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
969
+ }
970
+ getResource(e, t, s, n = {}) {
971
+ return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, s, n) : this.resourceStore.getResource(e, t, s, n);
972
+ }
973
+ getUsedParamsDetails(e = {}) {
974
+ const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && !S(e.replace);
975
+ let n = s ? e.replace : e;
976
+ if (s && typeof e.count < "u" && (n = {
977
+ ...n,
978
+ count: e.count
979
+ }), this.options.interpolation.defaultVariables && (n = {
980
+ ...this.options.interpolation.defaultVariables,
981
+ ...n
982
+ }), !s) {
983
+ n = {
984
+ ...n
985
+ };
986
+ for (const r of t)
987
+ delete n[r];
988
+ }
989
+ return n;
990
+ }
991
+ static hasDefaultValue(e) {
992
+ const t = "defaultValue";
993
+ for (const s in e)
994
+ if (Object.prototype.hasOwnProperty.call(e, s) && s.startsWith(t) && e[s] !== void 0)
995
+ return !0;
996
+ return !1;
997
+ }
998
+ }
999
+ class Ge {
1000
+ constructor(e, t = ne) {
1001
+ this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = t.create("languageUtils"), this.resolveHierarchyCache = {}, this.formattedCodes = /* @__PURE__ */ new Map();
1002
+ }
1003
+ clearCache() {
1004
+ this.resolveHierarchyCache = {}, this.formattedCodes.clear();
1005
+ }
1006
+ getScriptPartFromCode(e) {
1007
+ if (e = re(e), !e || !e.includes("-")) return null;
1008
+ const t = e.split("-");
1009
+ return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
1010
+ }
1011
+ getLanguagePartFromCode(e) {
1012
+ if (e = re(e), !e) return e;
1013
+ if (!e.includes("-")) return this.formatLanguageCode(e);
1014
+ const t = e.split("-");
1015
+ return this.formatLanguageCode(t[0]);
1016
+ }
1017
+ formatLanguageCode(e) {
1018
+ if (!S(e)) return e;
1019
+ let t = this.formattedCodes.get(e);
1020
+ return t !== void 0 || (t = this.formatUncached(e), this.formattedCodes.size >= 1e3 && this.formattedCodes.clear(), this.formattedCodes.set(e, t)), t;
1021
+ }
1022
+ formatUncached(e) {
1023
+ const t = e.includes("-");
1024
+ if (t || this.options.cleanCode !== !1) {
1025
+ let s;
1026
+ try {
1027
+ s = Intl.getCanonicalLocales(e)[0];
1028
+ } catch {
1029
+ }
1030
+ if (s && (t || s.toLowerCase() === e.toLowerCase()))
1031
+ return this.options.lowerCaseLng ? s.toLowerCase() : s;
1032
+ if (s) return e.toLowerCase();
1033
+ }
1034
+ return this.options.lowerCaseLng || this.options.cleanCode && !t ? e.toLowerCase() : e;
1035
+ }
1036
+ isSupportedCode(e) {
1037
+ if ((this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length) return !0;
1038
+ if (!Array.isArray(this.supportedLngs)) return this.supportedLngs.includes(e);
1039
+ const t = this.formatLanguageCode(e);
1040
+ return this.supportedLngs.some((s) => this.formatLanguageCode(s) === t);
1041
+ }
1042
+ getBestMatchFromCodes(e) {
1043
+ if (!e) return null;
1044
+ let t;
1045
+ return e.forEach((s) => {
1046
+ if (t) return;
1047
+ const n = this.formatLanguageCode(s);
1048
+ (!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
1049
+ }), !t && this.options.supportedLngs && e.forEach((s) => {
1050
+ if (t) return;
1051
+ const n = this.getScriptPartFromCode(s);
1052
+ if (this.isSupportedCode(n)) return t = n;
1053
+ const r = this.getLanguagePartFromCode(s);
1054
+ if (this.isSupportedCode(r)) return t = r;
1055
+ t = this.options.supportedLngs.map((a) => this.formatLanguageCode(a)).find((a) => a === r ? !0 : !a.includes("-") && !r.includes("-") ? !1 : !!(a.includes("-") && !r.includes("-") && a.slice(0, a.indexOf("-")) === r));
1056
+ }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
1057
+ }
1058
+ getFallbackCodes(e, t) {
1059
+ if (!e) return [];
1060
+ if (typeof e == "function" && (e = e(t)), S(e) && (e = [e]), Array.isArray(e)) return e;
1061
+ const s = (r) => Object.prototype.hasOwnProperty.call(e, r) ? e[r] : void 0;
1062
+ if (!t) return s("default") || [];
1063
+ let n = s(t);
1064
+ return n || (n = s(this.getScriptPartFromCode(t))), n || (n = s(this.formatLanguageCode(t))), n || (n = s(this.getLanguagePartFromCode(t))), n || (n = s("default")), n || [];
1065
+ }
1066
+ toResolveHierarchy(e, t) {
1067
+ const s = this.options.fallbackLng, n = Array.isArray(s) ? s.join("|") : s;
1068
+ n !== this._cachedFallbackLng && (this.resolveHierarchyCache = {}, this._cachedFallbackLng = n);
1069
+ const r = t === void 0 || t === !1 || S(t), a = t === void 0 && typeof this.options.fallbackLng == "function", o = S(e) && r && !a;
1070
+ let c = null;
1071
+ if (o) {
1072
+ let p;
1073
+ t === void 0 ? p = "undefined" : t === !1 ? p = "boolean:false" : p = `string:${t}`, c = `${e.length}:${e}|${p}`;
1074
+ }
1075
+ if (c !== null) {
1076
+ const p = this.resolveHierarchyCache[c];
1077
+ if (p !== void 0) return p.slice();
1078
+ }
1079
+ const d = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), u = [], h = (p) => {
1080
+ p && (this.isSupportedCode(p) ? u.push(p) : this.logger.warn(`rejecting language code not found in supportedLngs: ${p}`));
1081
+ };
1082
+ return S(e) && (e.includes("-") || e.includes("_")) ? (this.options.load !== "languageOnly" && h(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && h(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && h(this.getLanguagePartFromCode(e))) : S(e) && h(this.formatLanguageCode(e)), d.forEach((p) => {
1083
+ const m = this.formatLanguageCode(p);
1084
+ u.includes(m) || h(m);
1085
+ }), c !== null ? (Object.keys(this.resolveHierarchyCache).length >= 1e3 && (this.resolveHierarchyCache = {}), this.resolveHierarchyCache[c] = u, u.slice()) : u;
1086
+ }
1087
+ }
1088
+ const Qe = {
1089
+ zero: 0,
1090
+ one: 1,
1091
+ two: 2,
1092
+ few: 3,
1093
+ many: 4,
1094
+ other: 5
1095
+ }, Ze = {
1096
+ select: (i) => i === 1 ? "one" : "other",
1097
+ resolvedOptions: () => ({
1098
+ pluralCategories: ["one", "other"]
1099
+ })
1100
+ };
1101
+ class ks {
1102
+ constructor(e, t = {}, s = ne) {
1103
+ this.languageUtils = e, this.options = t, this.logger = s.create("pluralResolver"), this.pluralRulesCache = {};
1104
+ }
1105
+ clearCache() {
1106
+ this.pluralRulesCache = {};
1107
+ }
1108
+ getRule(e, t = {}) {
1109
+ const s = re(e === "dev" ? "en" : e), n = t.ordinal ? "ordinal" : "cardinal", r = JSON.stringify({
1110
+ cleanedCode: s,
1111
+ type: n
1112
+ });
1113
+ if (r in this.pluralRulesCache)
1114
+ return this.pluralRulesCache[r];
1115
+ let a;
1116
+ try {
1117
+ a = new Intl.PluralRules(s, {
1118
+ type: n
1119
+ });
1120
+ } catch {
1121
+ if (typeof Intl > "u")
1122
+ return this.logger.error("No Intl support, please use an Intl polyfill!"), Ze;
1123
+ if (!e.match(/-|_/)) return Ze;
1124
+ const c = this.languageUtils.getLanguagePartFromCode(e);
1125
+ a = this.getRule(c, t);
1126
+ }
1127
+ return Object.keys(this.pluralRulesCache).length >= 1e3 && (this.pluralRulesCache = {}), this.pluralRulesCache[r] = a, a;
1128
+ }
1129
+ needsPlural(e, t = {}) {
1130
+ let s = this.getRule(e, t);
1131
+ return s || (s = this.getRule("dev", t)), s?.resolvedOptions().pluralCategories.length > 1;
1132
+ }
1133
+ getPluralFormsOfKey(e, t, s = {}) {
1134
+ return this.getSuffixes(e, s).map((n) => `${t}${n}`);
1135
+ }
1136
+ getSuffixes(e, t = {}) {
1137
+ let s = this.getRule(e, t);
1138
+ return s || (s = this.getRule("dev", t)), s ? s.resolvedOptions().pluralCategories.sort((n, r) => Qe[n] - Qe[r]).map((n) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${n}`) : [];
1139
+ }
1140
+ getSuffix(e, t, s = {}) {
1141
+ const n = this.getRule(e, s);
1142
+ if (n) {
1143
+ const r = typeof t == "bigint" ? Number(t) : t;
1144
+ return `${this.options.prepend}${s.ordinal ? `ordinal${this.options.prepend}` : ""}${n.select(r)}`;
1145
+ }
1146
+ return this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, s);
1147
+ }
1148
+ }
1149
+ const Xe = (i, e, t, s = ".", n = !0) => {
1150
+ let r = ms(i, e, t);
1151
+ return r == null && n && S(t) && (r = $e(i, t, s), r === void 0 && (r = $e(e, t, s))), r;
1152
+ }, et = (i) => ue(i).replace(/["'\\&<>\u0000-\u001f]/g, (e) => `\\u${e.charCodeAt(0).toString(16).padStart(4, "0")}`);
1153
+ class tt {
1154
+ constructor(e = {}, t = ne) {
1155
+ this.logger = t.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((s) => s), this.init(e);
1156
+ }
1157
+ init(e = {}) {
1158
+ e.interpolation || (e.interpolation = {
1159
+ escapeValue: !0
1160
+ });
1161
+ const {
1162
+ escape: t,
1163
+ escapeValue: s,
1164
+ useRawValueToEscape: n,
1165
+ prefix: r,
1166
+ suffix: a,
1167
+ formatSeparator: o,
1168
+ unescapeSuffix: c,
1169
+ unescapePrefix: d,
1170
+ nestingPrefix: u,
1171
+ nestingSuffix: h,
1172
+ nestingOptionsSeparator: p,
1173
+ maxReplaces: m,
1174
+ alwaysFormat: g
1175
+ } = e.interpolation;
1176
+ this.escape = t !== void 0 ? t : ys, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = n !== void 0 ? n : !1, this.prefix = r ? X(r) : "{{", this.suffix = a ? X(a) : "}}", this.formatSeparator = o || ",", this.unescapePrefix = c ? "" : d ? X(d) : "-", this.unescapeSuffix = this.unescapePrefix ? "" : c ? X(c) : "", this.prefixText = r || "{{", this.nestingPrefixText = u || "$t(", this.nestingPrefix = X(u || "$t("), this.nestingSuffix = X(h || ")"), this.nestingOptionsSeparator = p || ",", this.maxReplaces = m || 1e3, this.alwaysFormat = g !== void 0 ? g : !1, this.resetRegExp();
1177
+ }
1178
+ reset() {
1179
+ this.options && this.init(this.options);
1180
+ }
1181
+ resetRegExp() {
1182
+ const e = (t, s) => t?.source === s ? (t.lastIndex = 0, t) : new RegExp(s, "g");
1183
+ this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']|"[^"]*"|'[^']*'|\\((?:[^()"']|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
1184
+ }
1185
+ interpolate(e, t, s, n, r) {
1186
+ let a, o, c;
1187
+ const d = e, u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, h = (j) => {
1188
+ if (!j.includes(this.formatSeparator)) {
1189
+ const v = Xe(t, u, j, this.options.keySeparator, this.options.ignoreJSONStructure);
1190
+ return this.alwaysFormat ? this.format(v, void 0, s, {
1191
+ ...n,
1192
+ ...t,
1193
+ interpolationkey: j
1194
+ }) : v;
1195
+ }
1196
+ const N = j.split(this.formatSeparator), C = N.shift().trim(), b = N.join(this.formatSeparator).trim();
1197
+ return this.format(Xe(t, u, C, this.options.keySeparator, this.options.ignoreJSONStructure), b, s, {
1198
+ ...n,
1199
+ ...t,
1200
+ interpolationkey: C
1201
+ });
1202
+ };
1203
+ this.resetRegExp(), typeof e == "string" && /\$t\([^)]*\{[^}]*\{\{-/.test(e) && this.logger.warn("nesting options string contains a variable inserted unescaped with {{- }}: if its value is attacker-controlled it can inject additional nesting options (e.g. redirect lng/ns). Use {{var}} there, which is escaped for the options, or sanitise untrusted input before passing it to t().");
1204
+ const p = n?.missingInterpolationHandler || this.options.missingInterpolationHandler, m = n?.interpolation?.skipOnVariables !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
1205
+ if (S(e) && !e.includes(this.prefixText)) return e;
1206
+ if (!r && (r = (j) => this.escapeValue ? this.escape(j) : j, S(e) && e.includes(this.nestingPrefixText))) {
1207
+ const j = new RegExp(this.nestingRegexp), N = new RegExp(`${X(this.nestingOptionsSeparator)}[ ]*{`);
1208
+ let C = "", b = 0, v;
1209
+ for (; v = j.exec(e); ) {
1210
+ const k = v.index + this.nestingPrefixText.length, E = N.exec(v[1]), T = E ? k + E.index + E[0].length - 1 : -1, _ = k + v[1].lastIndexOf("}") + 1;
1211
+ T !== -1 && _ > T && !e.startsWith(this.prefixText, T) && (C += this.interpolate(e.slice(b, T), t, s, n, r) + e.slice(T, _), b = _);
1212
+ }
1213
+ if (b) return C + this.interpolate(e.slice(b), t, s, n, r);
1214
+ }
1215
+ const g = [{
1216
+ regex: this.regexpUnescape,
1217
+ safeValue: (j) => j
1218
+ }, {
1219
+ regex: this.regexp,
1220
+ safeValue: r
1221
+ }], L = [];
1222
+ let w = 0;
1223
+ return g.forEach((j) => {
1224
+ for (c = 0; a = j.regex.exec(e); ) {
1225
+ const N = a.index - w, C = L.find(([k, E]) => N >= k && N < E);
1226
+ if (C) {
1227
+ j.regex.lastIndex = C[1] + w;
1228
+ continue;
1229
+ }
1230
+ const b = a[1].trim();
1231
+ if (o = h(b), o === void 0)
1232
+ if (typeof p == "function") {
1233
+ const k = p(e, a, n);
1234
+ o = S(k) ? k : "";
1235
+ } else if (n && Object.prototype.hasOwnProperty.call(n, b.split(this.formatSeparator)[0].trim()))
1236
+ o = "";
1237
+ else if (m) {
1238
+ this.logger.debug && this.logger.once(`${d}\0${a[0]}`, "warn", `missed to pass in variable ${b} for interpolating ${d}`), o = a[0];
1239
+ continue;
1240
+ } else
1241
+ this.logger.warn(`missed to pass in variable ${b} for interpolating ${e}`), o = "";
1242
+ else !S(o) && !this.useRawValueToEscape && (o = ue(o));
1243
+ const v = ue(j.safeValue(o));
1244
+ if (e = e.slice(0, a.index) + v + e.slice(a.index + a[0].length), m ? (j.regex === this.regexpUnescape ? L.push([a.index, a.index + v.length]) : w += v.length - a[0].length, j.regex.lastIndex += v.length, j.regex.lastIndex -= a[0].length) : j.regex.lastIndex = 0, c++, c >= this.maxReplaces)
1245
+ break;
1246
+ }
1247
+ }), e;
1248
+ }
1249
+ nest(e, t, s = {}) {
1250
+ let n, r, a;
1251
+ const o = (h, p) => {
1252
+ const m = this.nestingOptionsSeparator;
1253
+ if (!h.includes(m)) return h;
1254
+ const g = h.split(new RegExp(`${X(m)}[ ]*{`)), L = `{${g[1]}`;
1255
+ h = g[0];
1256
+ let w;
1257
+ const j = (N) => {
1258
+ w = this.interpolate(L, p, s.lng, s, N);
1259
+ const C = w.match(/'/g), b = w.match(/"/g);
1260
+ return ((C?.length ?? 0) % 2 === 0 && !b || (b?.length ?? 0) % 2 !== 0) && (w = w.replace(/'/g, '"')), JSON.parse(w);
1261
+ };
1262
+ try {
1263
+ const N = j(et), C = this.escapeValue ? Object.keys(N).filter((b) => b.startsWith("defaultValue") || b === "joinArrays") : [];
1264
+ if (C.length) {
1265
+ const b = j((v) => et(this.escape(v)));
1266
+ C.forEach((v) => {
1267
+ N[v] = b[v];
1268
+ });
1269
+ }
1270
+ a = p ? {
1271
+ ...p,
1272
+ ...N
1273
+ } : N;
1274
+ } catch (N) {
1275
+ return this.logger.warn(`failed parsing options string in nesting for key ${h}`, N), `${h}${m}${w}`;
1276
+ }
1277
+ return a.defaultValue && a.defaultValue.includes(this.prefix) && delete a.defaultValue, h;
1278
+ };
1279
+ if (S(e) && !e.includes(this.nestingPrefixText)) return e;
1280
+ const c = new RegExp(this.nestingRegexp);
1281
+ let d = "", u = 0;
1282
+ for (; n = c.exec(e); ) {
1283
+ let h = [];
1284
+ a = {
1285
+ ...s
1286
+ }, a = a.replace && !S(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
1287
+ const p = /{.*}/s.test(n[1]) ? n[1].lastIndexOf("}") + 1 : n[1].indexOf(this.formatSeparator);
1288
+ if (p !== -1 && (h = n[1].slice(p).split(this.formatSeparator).map((m) => m.trim()).filter(Boolean), n[1] = n[1].slice(0, p)), r = t(o.call(this, n[1].trim(), a), a), r && n[0] === e && !S(r)) return r;
1289
+ S(r) || (r = ue(r)), r || (this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`), r = ""), h.length && (r = h.reduce((m, g) => this.format(m, g, s.lng, {
1290
+ ...s,
1291
+ interpolationkey: n[1].trim()
1292
+ }), r.trim())), d += e.slice(u, n.index) + ue(r), u = c.lastIndex, this.regexp.lastIndex = 0;
1293
+ }
1294
+ return u ? d + e.slice(u) : e;
1295
+ }
1296
+ }
1297
+ const Cs = (i) => {
1298
+ let e = i.toLowerCase().trim();
1299
+ const t = {};
1300
+ if (i.includes("(")) {
1301
+ const s = i.split("(");
1302
+ e = s[0].toLowerCase().trim();
1303
+ const n = s[1].slice(0, -1);
1304
+ e === "currency" && !n.includes(":") ? t.currency || (t.currency = n.trim()) : e === "relativetime" && !n.includes(":") ? t.range || (t.range = n.trim()) : n.split(";").forEach((a) => {
1305
+ if (a) {
1306
+ const [o, ...c] = a.split(":"), d = c.join(":").trim().replace(/^'+|'+$/g, ""), u = o.trim();
1307
+ t[u] || (t[u] = d), d === "false" && (t[u] = !1), d === "true" && (t[u] = !0), !isNaN(d) && d.trim() !== "" && (t[u] = parseInt(d, 10));
1308
+ }
1309
+ });
1310
+ }
1311
+ return {
1312
+ formatName: e,
1313
+ formatOptions: t
1314
+ };
1315
+ }, Ls = 1e3, st = (i) => {
1316
+ const e = /* @__PURE__ */ new Map();
1317
+ return (t, s, n) => {
1318
+ let r = n;
1319
+ n && n.interpolationkey && n.formatParams && n.formatParams[n.interpolationkey] && n[n.interpolationkey] && (r = {
1320
+ ...r,
1321
+ [n.interpolationkey]: void 0
1322
+ });
1323
+ let a;
1324
+ try {
1325
+ a = s + JSON.stringify(r);
1326
+ } catch {
1327
+ return i(re(s), n)(t);
1328
+ }
1329
+ let o = e.get(a);
1330
+ return o || (o = i(re(s), n), e.size >= Ls && e.delete(e.keys().next().value), e.set(a, o)), o(t);
1331
+ };
1332
+ }, Os = (i) => (e, t, s) => i(re(t), s)(e);
1333
+ class Es {
1334
+ constructor(e = {}) {
1335
+ this.logger = ne.create("formatter"), this.options = e, this.init(e);
1336
+ }
1337
+ init(e, t = {
1338
+ interpolation: {}
1339
+ }) {
1340
+ e?.logger?.create && (this.logger = e.logger.create("formatter")), this.formatSeparator = t.interpolation.formatSeparator || ",";
1341
+ const s = t.cacheInBuiltFormats ? st : Os;
1342
+ this.formats = {
1343
+ number: s((n, r) => {
1344
+ const a = new Intl.NumberFormat(n, {
1345
+ ...r
1346
+ });
1347
+ return (o) => a.format(o);
1348
+ }),
1349
+ currency: s((n, r) => {
1350
+ const a = new Intl.NumberFormat(n, {
1351
+ ...r,
1352
+ style: "currency"
1353
+ });
1354
+ return (o) => a.format(o);
1355
+ }),
1356
+ datetime: s((n, r) => {
1357
+ const a = new Intl.DateTimeFormat(n, {
1358
+ ...r
1359
+ });
1360
+ return (o) => a.format(o);
1361
+ }),
1362
+ relativetime: s((n, r) => {
1363
+ const a = new Intl.RelativeTimeFormat(n, {
1364
+ ...r
1365
+ });
1366
+ return (o) => a.format(o, r.range || "day");
1367
+ }),
1368
+ list: s((n, r) => {
1369
+ const a = new Intl.ListFormat(n, {
1370
+ ...r
1371
+ });
1372
+ return (o) => a.format(o);
1373
+ })
1374
+ };
1375
+ }
1376
+ add(e, t) {
1377
+ this.formats[e.toLowerCase().trim()] = t;
1378
+ }
1379
+ addCached(e, t) {
1380
+ this.formats[e.toLowerCase().trim()] = st(t);
1381
+ }
1382
+ format(e, t, s, n = {}) {
1383
+ if (!t || e == null) return e;
1384
+ const r = t.split(this.formatSeparator), a = [];
1385
+ for (let c = 0; c < r.length; c++) {
1386
+ let d = r[c];
1387
+ for (; d.indexOf("(") > -1 && !d.includes(")") && c + 1 < r.length; )
1388
+ d = `${d}${this.formatSeparator}${r[++c]}`;
1389
+ a.push(d);
1390
+ }
1391
+ return a.reduce((c, d) => {
1392
+ const {
1393
+ formatName: u,
1394
+ formatOptions: h
1395
+ } = Cs(d);
1396
+ if (this.formats[u]) {
1397
+ let p = c;
1398
+ try {
1399
+ const m = n?.formatParams?.[n.interpolationkey] || {}, g = m.locale || m.lng || n.locale || n.lng || s;
1400
+ p = this.formats[u](c, g, {
1401
+ ...h,
1402
+ ...n,
1403
+ ...m
1404
+ });
1405
+ } catch (m) {
1406
+ this.logger.warn(m);
1407
+ }
1408
+ return p;
1409
+ } else
1410
+ this.logger.warn(`there was no format function for ${u}`);
1411
+ return c;
1412
+ }, e);
1413
+ }
1414
+ }
1415
+ const _s = 1e3, Rs = (i, e) => {
1416
+ i.pending[e] !== void 0 && (delete i.pending[e], i.pendingCount--);
1417
+ };
1418
+ class Ps extends Ce {
1419
+ constructor(e, t, s, n = {}) {
1420
+ super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = n, this.logger = (s.logger || ne).create("backendConnector"), this.waitingReads = [], this.maxParallelReads = n.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = n.maxRetries >= 0 ? n.maxRetries : 5, this.retryTimeout = n.retryTimeout >= 1 ? n.retryTimeout : 350, this.state = {}, this.failed = /* @__PURE__ */ new Set(), this.queue = [], this.backend?.init?.(s, n.backend, n), this.callbackApi = Pe(this.backend), this.backend && this.callbackApi === void 0 && (this.backend.read || this.backend.create) && this.logger.deprecate("backend: set callbackApi to declare the calling convention (true: read(language, namespace, callback) and create(languages, namespace, key, fallbackValue, callback, options); false: both return a promise or a value); guessing it from the number of parameters is deprecated");
1421
+ }
1422
+ queueLoad(e, t, s, n) {
1423
+ const r = {}, a = {}, o = {}, c = {};
1424
+ return e.forEach((d) => {
1425
+ let u = !0;
1426
+ t.forEach((h) => {
1427
+ const p = `${d}|${h}`;
1428
+ !s.reload && this.store.hasResourceBundle(d, h) ? this.state[p] = 2 : !s.reload && this.state[p] < 0 || (this.state[p] === 1 ? a[p] === void 0 && (a[p] = !0) : (this.state[p] = 1, u = !1, a[p] === void 0 && (a[p] = !0), r[p] === void 0 && (r[p] = !0), c[h] === void 0 && (c[h] = !0)));
1429
+ }), u || (o[d] = !0);
1430
+ }), (Object.keys(r).length || Object.keys(a).length) && this.queue.push({
1431
+ pending: a,
1432
+ pendingCount: Object.keys(a).length,
1433
+ loaded: {},
1434
+ errors: [],
1435
+ callback: n
1436
+ }), {
1437
+ toLoad: Object.keys(r),
1438
+ pending: Object.keys(a),
1439
+ toLoadLanguages: Object.keys(o),
1440
+ toLoadNamespaces: Object.keys(c)
1441
+ };
1442
+ }
1443
+ loaded(e, t, s) {
1444
+ const n = e.split("|"), r = n[0], a = n[1];
1445
+ if (t && this.emit("failedLoading", r, a, t), !t && s && this.store.addResourceBundle(r, a, s, void 0, void 0, {
1446
+ skipCopy: !0
1447
+ }), this.state[e] = t ? -1 : 2, t && s && (this.state[e] = 0), this.failed.delete(e), t && (this.failed.add(e), this.failed.size > _s)) {
1448
+ const d = this.failed.values().next().value;
1449
+ this.failed.delete(d), this.state[d] < 1 && delete this.state[d];
1450
+ }
1451
+ const o = {}, c = [];
1452
+ if (this.queue.forEach((d) => {
1453
+ if (gs(d.loaded, [r], a), Rs(d, e), t && d.errors.push(t), d.pendingCount === 0 && !d.done) {
1454
+ Object.keys(d.loaded).forEach((u) => {
1455
+ Object.prototype.hasOwnProperty.call(o, u) || (o[u] = {});
1456
+ const h = d.loaded[u];
1457
+ h.length && h.forEach((p) => {
1458
+ o[u][p] === void 0 && (o[u][p] = !0);
1459
+ });
1460
+ }), d.done = !0;
1461
+ try {
1462
+ d.errors.length ? d.callback(d.errors) : d.callback();
1463
+ } catch (u) {
1464
+ c.push(u);
1465
+ }
1466
+ }
1467
+ }), this.queue = this.queue.filter((d) => !d.done), this.emit("loaded", o), c.length) throw c[0];
1468
+ }
1469
+ read(e, t, s, n = 0, r = this.retryTimeout, a) {
1470
+ if (!e.length) return a(null, {});
1471
+ if (this.readingCalls >= this.maxParallelReads) {
1472
+ this.waitingReads.push({
1473
+ lng: e,
1474
+ ns: t,
1475
+ fcName: s,
1476
+ tried: n,
1477
+ wait: r,
1478
+ callback: a
1479
+ });
1480
+ return;
1481
+ }
1482
+ this.readingCalls++;
1483
+ const o = (d, u) => {
1484
+ if (this.readingCalls--, this.waitingReads.length > 0) {
1485
+ const h = this.waitingReads.shift();
1486
+ this.read(h.lng, h.ns, h.fcName, h.tried, h.wait, h.callback);
1487
+ }
1488
+ if (d && u && n < this.maxRetries) {
1489
+ setTimeout(() => {
1490
+ this.read(e, t, s, n + 1, r * 2, a);
1491
+ }, r);
1492
+ return;
1493
+ }
1494
+ a(d, u);
1495
+ }, c = this.backend[s].bind(this.backend);
1496
+ if (this.callbackApi === !1 || this.callbackApi === void 0 && c.length === 2) {
1497
+ let d;
1498
+ try {
1499
+ d = c(e, t);
1500
+ } catch (u) {
1501
+ o(u);
1502
+ return;
1503
+ }
1504
+ d && typeof d.then == "function" ? d.then((u) => o(null, u), o) : o(null, d);
1505
+ return;
1506
+ }
1507
+ return c(e, t, o);
1508
+ }
1509
+ prepareLoading(e, t, s = {}, n) {
1510
+ if (!this.backend)
1511
+ return this.logger.warn("No backend was added via i18next.use. Will not load resources."), n && n();
1512
+ S(e) && (e = this.languageUtils.toResolveHierarchy(e)), S(t) && (t = [t]);
1513
+ const r = this.queueLoad(e, t, s, n);
1514
+ if (!r.toLoad.length)
1515
+ return r.pending.length || n(), null;
1516
+ r.toLoad.forEach((a) => {
1517
+ this.loadOne(a);
1518
+ });
1519
+ }
1520
+ load(e, t, s) {
1521
+ this.prepareLoading(e, t, {}, s);
1522
+ }
1523
+ reload(e, t, s) {
1524
+ this.prepareLoading(e, t, {
1525
+ reload: !0
1526
+ }, s);
1527
+ }
1528
+ loadOne(e, t = "") {
1529
+ const s = e.split("|"), n = s[0], r = s[1];
1530
+ this.read(n, r, "read", void 0, void 0, (a, o) => {
1531
+ a && this.logger.warn(`${t}loading namespace ${r} for language ${n} failed`, a), !a && o && this.logger.log(`${t}loaded namespace ${r} for language ${n}`, o), this.loaded(e, a, o);
1532
+ });
1533
+ }
1534
+ saveMissing(e, t, s, n, r, a = {}, o = () => {
1535
+ }, c = this.newestCloneHasLoadedNamespace || this.services?.utils?.hasLoadedNamespace) {
1536
+ if (c && !c(t)) {
1537
+ this.logger.warn(`did not save key "${s}" as the namespace "${t}" 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!!!");
1538
+ return;
1539
+ }
1540
+ if (!(s == null || s === "")) {
1541
+ if (this.backend?.create) {
1542
+ const d = {
1543
+ ...a,
1544
+ isUpdate: r
1545
+ }, u = this.backend.create.bind(this.backend);
1546
+ if (this.callbackApi === !1 || this.callbackApi === void 0 && u.length < 6)
1547
+ try {
1548
+ let h;
1549
+ this.callbackApi === !1 || u.length === 5 ? h = u(e, t, s, n, d) : h = u(e, t, s, n), h && typeof h.then == "function" ? h.then((p) => o(null, p)).catch(o) : o(null, h);
1550
+ } catch (h) {
1551
+ o(h);
1552
+ }
1553
+ else
1554
+ u(e, t, s, n, o, d);
1555
+ }
1556
+ !e || !e[0] || this.store.addResource(e[0], t, s, n);
1557
+ }
1558
+ }
1559
+ }
1560
+ const Te = () => ({
1561
+ debug: !1,
1562
+ initAsync: !0,
1563
+ ns: ["translation"],
1564
+ defaultNS: ["translation"],
1565
+ fallbackLng: !1,
1566
+ fallbackNS: !1,
1567
+ supportedLngs: !1,
1568
+ nonExplicitSupportedLngs: !1,
1569
+ load: "all",
1570
+ preload: !1,
1571
+ keySeparator: ".",
1572
+ nsSeparator: ":",
1573
+ pluralSeparator: "_",
1574
+ contextSeparator: "_",
1575
+ enableSelector: !1,
1576
+ partialBundledLanguages: !1,
1577
+ saveMissing: !1,
1578
+ updateMissing: !1,
1579
+ saveMissingTo: "fallback",
1580
+ saveMissingPlurals: !0,
1581
+ missingKeyHandler: !1,
1582
+ missingInterpolationHandler: !1,
1583
+ postProcess: !1,
1584
+ postProcessPassResolved: !1,
1585
+ returnNull: !1,
1586
+ returnEmptyString: !1,
1587
+ returnObjects: !1,
1588
+ joinArrays: !1,
1589
+ returnedObjectHandler: !1,
1590
+ parseMissingKeyHandler: !1,
1591
+ appendNamespaceToMissingKey: !1,
1592
+ appendNamespaceToCIMode: !1,
1593
+ overloadTranslationOptionHandler: (i) => {
1594
+ let e = {};
1595
+ if (typeof i[1] == "object" && (e = i[1]), S(i[1]) && (e.defaultValue = i[1]), S(i[2]) && (e.tDescription = i[2]), typeof i[2] == "object" || typeof i[3] == "object") {
1596
+ const t = i[3] || i[2];
1597
+ Object.keys(t).forEach((s) => {
1598
+ e[s] = t[s];
1599
+ });
1600
+ }
1601
+ return e;
1602
+ },
1603
+ interpolation: {
1604
+ escapeValue: !0,
1605
+ prefix: "{{",
1606
+ suffix: "}}",
1607
+ formatSeparator: ",",
1608
+ unescapePrefix: "-",
1609
+ nestingPrefix: "$t(",
1610
+ nestingSuffix: ")",
1611
+ nestingOptionsSeparator: ",",
1612
+ maxReplaces: 1e3,
1613
+ skipOnVariables: !0
1614
+ },
1615
+ cacheInBuiltFormats: !0
1616
+ }), nt = (i) => (S(i.ns) && (i.ns = [i.ns]), S(i.fallbackLng) && (i.fallbackLng = [i.fallbackLng]), S(i.fallbackNS) && (i.fallbackNS = [i.fallbackNS]), i.supportedLngs && !i.supportedLngs.includes("cimode") && (i.supportedLngs = i.supportedLngs.concat(["cimode"])), i), ye = () => {
1617
+ }, it = (i) => {
1618
+ const e = Te(), t = {
1619
+ ...e,
1620
+ ...i
1621
+ };
1622
+ return t.interpolation = {
1623
+ ...e.interpolation,
1624
+ ...i.interpolation
1625
+ }, typeof t.overloadTranslationOptionHandler != "function" && (t.overloadTranslationOptionHandler = e.overloadTranslationOptionHandler), t;
1626
+ }, rt = (i) => {
1627
+ const e = [].concat(i.supportedLngs || [], i.preload || []);
1628
+ e.push(...Object.keys(i.resources || {}));
1629
+ const t = i.fallbackLng;
1630
+ return S(t) || Array.isArray(t) ? e.push(...[].concat(t)) : t && typeof t == "object" && Object.keys(t).forEach((s) => {
1631
+ s !== "default" && e.push(s), e.push(...[].concat(t[s]));
1632
+ }), e;
1633
+ }, Ee = (i, e) => !S(e) || hs(e) || i.configuredLngs?.has(e) ? !1 : (i.logger.once(`lng:${e}`, "warn", `refused the language code '${e.slice(0, 64)}' from lng, changeLanguage(), the language detector or loadLanguages(): it is not configured and has other characters than letters, digits, '-', '_', '@' and '.' (or '..', or more than 128). List it in supportedLngs to use it`), !0), $s = (i) => {
1634
+ Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach((t) => {
1635
+ typeof i[t] == "function" && (i[t] = i[t].bind(i));
1636
+ });
1637
+ };
1638
+ class fe extends Ce {
1639
+ constructor(e = {}, t) {
1640
+ if (super(), this.userOptions = nt(e), this.options = it(this.userOptions), this.services = {
1641
+ postProcessors: /* @__PURE__ */ Object.create(null)
1642
+ }, this.logger = new pe(null, this.options), this.modules = {
1643
+ external: []
1644
+ }, $s(this), t && !this.isInitialized && !e.isClone) {
1645
+ if (!this.userOptions.initAsync)
1646
+ return this.init(e, t), this;
1647
+ setTimeout(() => {
1648
+ this.init(e, t);
1649
+ }, 0);
1650
+ }
1651
+ }
1652
+ init(e = {}, t) {
1653
+ this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (S(e.ns) ? e.defaultNS = e.ns : e.ns.includes("translation") || (e.defaultNS = e.ns[0])), nt(e);
1654
+ const s = {
1655
+ ...this.userOptions,
1656
+ ...e
1657
+ };
1658
+ this.options = it({
1659
+ ...this.options,
1660
+ ...e
1661
+ }), s.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = s.keySeparator), s.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = s.nsSeparator), this.options.isClone || (this.configuredLngs = /* @__PURE__ */ new Set([...this.configuredLngs || [], ...rt(s)]));
1662
+ const n = (d) => d ? typeof d == "function" ? new d() : d : null;
1663
+ if (!this.options.isClone) {
1664
+ this.logger.init(n(this.modules.logger), this.options);
1665
+ const {
1666
+ logger: d
1667
+ } = this;
1668
+ this.pendingWarnings?.forEach((m) => this.logger.warn(m)), this.pendingWarnings = void 0;
1669
+ let u;
1670
+ this.modules.formatter ? u = this.modules.formatter : u = Es;
1671
+ const h = new Ge(this.options, d);
1672
+ this.store = new qe(this.options.resources, this.options, d);
1673
+ const p = this.services;
1674
+ p.logger = d, p.resourceStore = this.store, p.languageUtils = h, p.pluralResolver = new ks(h, {
1675
+ prepend: this.options.pluralSeparator
1676
+ }, d), u && (p.formatter = n(u), p.formatter.init && p.formatter.init(p, this.options), this.options.interpolation.format = p.formatter.format.bind(p.formatter)), p.interpolator = new tt(this.options, d), p.utils = {
1677
+ hasLoadedNamespace: this.hasLoadedNamespace.bind(this),
1678
+ reloadResources: this.reloadResources.bind(this)
1679
+ }, p.backendConnector = new Ps(n(this.modules.backend), p.resourceStore, p, this.options), p.backendConnector.on("*", (m, ...g) => {
1680
+ this.emit(m, ...g);
1681
+ }), this.modules.languageDetector && (p.languageDetector = n(this.modules.languageDetector), p.languageDetector.init && p.languageDetector.init(p, this.options.detection, this.options), p.languageDetector.async && Pe(p.languageDetector) === void 0 && this.logger.deprecate("languageDetector: set callbackApi to declare how the async detect() answers (true: detect(callback); false: detect() returns a promise); guessing it from the number of parameters is deprecated")), this.modules.i18nFormat && (p.i18nFormat = n(this.modules.i18nFormat), p.i18nFormat.init && p.i18nFormat.init(this)), this.translator = new je(this.services, this.options), this.translator.on("*", (m, ...g) => {
1682
+ this.emit(m, ...g);
1683
+ }), this.modules.external.forEach((m) => {
1684
+ m.init && m.init(this);
1685
+ });
1686
+ }
1687
+ if (this.format = this.options.interpolation.format, t || (t = ye), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1688
+ const d = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1689
+ d.length > 0 && d[0] !== "dev" && (this.options.lng = d[0]);
1690
+ }
1691
+ !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((d) => {
1692
+ this[d] = (...u) => this.store[d](...u);
1693
+ }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((d) => {
1694
+ this[d] = (...u) => (this.store[d](...u), this);
1695
+ });
1696
+ const o = de(), c = () => {
1697
+ const d = (u, h) => {
1698
+ this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), o.resolve(h), t(u, h);
1699
+ };
1700
+ if ((this.languages || this.isLanguageChangingTo) && !this.isInitialized) return d(null, this.t.bind(this));
1701
+ this.changeLanguage(this.options.lng, d);
1702
+ };
1703
+ return this.options.resources || !this.options.initAsync ? c() : setTimeout(c, 0), o;
1704
+ }
1705
+ loadResources(e, t = ye) {
1706
+ let s = t;
1707
+ const n = S(e) ? e : this.language;
1708
+ if (typeof e == "function" && (s = e), !this.options.resources || this.options.partialBundledLanguages) {
1709
+ if (n?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return s();
1710
+ const r = [], a = (o) => {
1711
+ if (!o || o === "cimode") return;
1712
+ this.services.languageUtils.toResolveHierarchy(o).forEach((d) => {
1713
+ d !== "cimode" && (r.includes(d) || r.push(d));
1714
+ });
1715
+ };
1716
+ n ? a(n) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((c) => a(c)), this.options.preload?.forEach?.((o) => a(o)), this.services.backendConnector.load(r, this.options.ns, (o) => {
1717
+ !o && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), s(o);
1718
+ });
1719
+ } else
1720
+ s(null);
1721
+ }
1722
+ reloadResources(e, t, s) {
1723
+ const n = de();
1724
+ if (typeof e == "function" && (s = e, e = void 0), typeof t == "function" && (s = t, t = void 0), !e) {
1725
+ const r = Object.keys(this.services.backendConnector.state).map((a) => a.split("|")[0]);
1726
+ e = [.../* @__PURE__ */ new Set([...this.languages || [], ...r])].filter((a) => a !== "cimode");
1727
+ }
1728
+ return t || (t = this.options.ns), s || (s = ye), this.services.backendConnector.reload(e, t, (r) => {
1729
+ n.resolve(), s(r);
1730
+ }), n;
1731
+ }
1732
+ use(e) {
1733
+ if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1734
+ if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1735
+ const t = (s) => {
1736
+ if (this.modules[s] && this.modules[s] !== e) {
1737
+ const n = `use: this ${s} replaces the ${s} passed to an earlier use() call; only one ${s} is used per instance`;
1738
+ this.isInitializing || this.isInitialized ? this.logger.warn(n) : (this.pendingWarnings = this.pendingWarnings || []).push(n);
1739
+ }
1740
+ this.modules[s] = e;
1741
+ };
1742
+ return e.type === "backend" && t("backend"), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && t("languageDetector"), e.type === "i18nFormat" && t("i18nFormat"), e.type === "postProcessor" && (this.services.postProcessors[e.name] = e), e.type === "formatter" && t("formatter"), e.type === "3rdParty" && this.modules.external.push(e), this;
1743
+ }
1744
+ hydrate(e, t) {
1745
+ return this.options.isClone ? this : this.services.resourceStore ? (e && !this.initializedStoreOnce && (this.services.resourceStore.data = e, Object.values(e).forEach((s) => {
1746
+ Object.keys(s).forEach((n) => {
1747
+ this.options.ns.includes(n) || this.options.ns.push(n);
1748
+ });
1749
+ }), this.initializedStoreOnce = !0, this.isInitialized = !0), t && !this.initializedLanguageOnce && (this.changeLanguage(t), this.initializedLanguageOnce = !0), this) : (this.logger.warn("hydrate: call init() first, the instance has no resource store yet"), this);
1750
+ }
1751
+ setResolvedLanguage(e) {
1752
+ if (!(!e || !this.languages) && !["cimode", "dev"].includes(e)) {
1753
+ for (let t = 0; t < this.languages.length; t++) {
1754
+ const s = this.languages[t];
1755
+ if (!["cimode", "dev"].includes(s) && this.store.hasLanguageSomeTranslations(s)) {
1756
+ this.resolvedLanguage = s;
1757
+ break;
1758
+ }
1759
+ }
1760
+ !this.resolvedLanguage && !this.languages.includes(e) && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
1761
+ }
1762
+ }
1763
+ changeLanguage(e, t) {
1764
+ this.isLanguageChangingTo = e;
1765
+ const s = de();
1766
+ this.emit("languageChanging", e);
1767
+ const n = (o) => {
1768
+ this.language = o, this.languages = this.services.languageUtils.toResolveHierarchy(o), this.resolvedLanguage = void 0, this.setResolvedLanguage(o);
1769
+ }, r = (o, c) => {
1770
+ c ? this.isLanguageChangingTo === e && (n(c), this.translator.changeLanguage(c), this.isLanguageChangingTo = void 0, this.emit("languageChanged", c), this.logger.log("languageChanged", c)) : this.isLanguageChangingTo = void 0, s.resolve((...d) => this.t(...d)), t && t(o, (...d) => this.t(...d));
1771
+ }, a = (o) => {
1772
+ !e && !o && this.services.languageDetector && (o = []);
1773
+ const {
1774
+ supportedLngs: c
1775
+ } = this.options;
1776
+ if (o && !c) {
1777
+ const h = [].concat(o).filter((p) => !Ee(this, p));
1778
+ h.length < [].concat(o).length && (o = h);
1779
+ }
1780
+ const d = S(o) ? o : o && o[0];
1781
+ let u = this.store.hasLanguageSomeTranslations(d) ? d : this.services.languageUtils.getBestMatchFromCodes(S(o) ? [o] : o);
1782
+ c && Ee(this, u) && (u = this.services.languageUtils.getBestMatchFromCodes([])), u && (this.language || n(u), this.translator.language || this.translator.changeLanguage(u), this.services.languageDetector?.cacheUserLanguage?.(u)), this.loadResources(u, (h) => {
1783
+ r(h, u);
1784
+ });
1785
+ };
1786
+ if (!e && this.services.languageDetector && !this.services.languageDetector.async)
1787
+ a(this.services.languageDetector.detect());
1788
+ else if (!e && this.services.languageDetector && this.services.languageDetector.async) {
1789
+ const o = Pe(this.services.languageDetector);
1790
+ o === !1 || o === void 0 && this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(a) : this.services.languageDetector.detect(a);
1791
+ } else
1792
+ a(e);
1793
+ return s;
1794
+ }
1795
+ getFixedT(e, t, s, n) {
1796
+ const r = n?.scopeNs, a = (o, c, ...d) => {
1797
+ let u;
1798
+ typeof c != "object" ? u = this.options.overloadTranslationOptionHandler([o, c].concat(d)) : u = {
1799
+ ...c
1800
+ }, u.lng = u.lng || a.lng, u.lngs = u.lngs || a.lngs;
1801
+ const h = u.ns !== void 0 && u.ns !== null;
1802
+ u.ns = u.ns || a.ns, u.keyPrefix !== "" && (u.keyPrefix = u.keyPrefix || s || a.keyPrefix);
1803
+ const p = {
1804
+ ...this.options,
1805
+ ...u
1806
+ };
1807
+ Array.isArray(r) && !h && (p.ns = r), typeof u.keyPrefix == "function" && (u.keyPrefix = te(u.keyPrefix, p));
1808
+ const m = this.options.keySeparator || ".";
1809
+ let g;
1810
+ return u.keyPrefix && Array.isArray(o) ? g = o.map((L) => (typeof L == "function" && (L = te(L, p)), `${u.keyPrefix}${m}${L}`)) : (typeof o == "function" && (o = te(o, p)), g = u.keyPrefix ? `${u.keyPrefix}${m}${o}` : o), this.t(g, u);
1811
+ };
1812
+ return S(e) ? a.lng = e : a.lngs = e, a.ns = t, a.keyPrefix = s, a;
1813
+ }
1814
+ t(...e) {
1815
+ return this.translator ? this.translator.translate(...e) : (this.logger.warn("t: called before init(); returning an empty string"), "");
1816
+ }
1817
+ exists(...e) {
1818
+ return this.translator?.exists(...e);
1819
+ }
1820
+ setDefaultNamespace(e) {
1821
+ this.options.defaultNS = e, this.translator?.options && (this.translator.options.defaultNS = e);
1822
+ }
1823
+ hasLoadedNamespace(e, t = {}) {
1824
+ if (!this.isInitialized)
1825
+ return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1826
+ if (!this.languages || !this.languages.length)
1827
+ return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1828
+ const s = t.lng || this.resolvedLanguage || this.languages[0], n = this.options ? this.options.fallbackLng : !1, r = this.languages[this.languages.length - 1];
1829
+ if (s.toLowerCase() === "cimode") return !0;
1830
+ const a = (d, u) => {
1831
+ const h = this.services.backendConnector.state[`${d}|${u}`];
1832
+ return h === -1 || h === 0 || h === 2;
1833
+ };
1834
+ if (t.precheck) {
1835
+ const d = t.precheck(this, a);
1836
+ if (d !== void 0) return d;
1837
+ }
1838
+ if (this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return !0;
1839
+ const {
1840
+ languageUtils: o
1841
+ } = this.services, c = t.lng ? o.isSupportedCode(s) && o.toResolveHierarchy(s, !1)[0] : s;
1842
+ return !!((!c || a(c, e)) && (!n || a(r, e)));
1843
+ }
1844
+ loadNamespaces(e, t) {
1845
+ const s = de();
1846
+ return !this.options.ns || !this.services.backendConnector ? (t && t(), Promise.resolve()) : (S(e) && (e = [e]), e.forEach((n) => {
1847
+ this.options.ns.includes(n) || this.options.ns.push(n);
1848
+ }), this.loadResources((n) => {
1849
+ s.resolve(), t && t(n);
1850
+ }), s);
1851
+ }
1852
+ loadLanguages(e, t) {
1853
+ const s = de();
1854
+ S(e) && (e = [e]);
1855
+ const n = this.options.preload || [], r = e.filter((a) => !n.includes(a) && !Ee(this, a) && this.services.languageUtils.isSupportedCode(a));
1856
+ return r.length ? (this.options.preload = n.concat(r), this.loadResources((a) => {
1857
+ s.resolve(), t && t(a);
1858
+ }), s) : (t && t(), Promise.resolve());
1859
+ }
1860
+ dir(e) {
1861
+ if (e || (e = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language)), !e) return "ltr";
1862
+ try {
1863
+ const n = new Intl.Locale(e);
1864
+ if (n && n.getTextInfo) {
1865
+ const r = n.getTextInfo();
1866
+ if (r && r.direction) return r.direction;
1867
+ }
1868
+ } catch {
1869
+ }
1870
+ const t = ["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"], s = this.services?.languageUtils || new Ge(Te());
1871
+ return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.includes(s.getLanguagePartFromCode(e)?.toLowerCase()) || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1872
+ }
1873
+ static createInstance(e = {}, t) {
1874
+ const s = new fe(e, t);
1875
+ return s.createInstance = fe.createInstance, s;
1876
+ }
1877
+ cloneInstance(e = {}, t = ye) {
1878
+ const s = e.forkResourceStore;
1879
+ s && (e = {
1880
+ ...e
1881
+ }, delete e.forkResourceStore);
1882
+ const n = {
1883
+ ...this.options,
1884
+ preload: !1,
1885
+ ...e,
1886
+ isClone: !0
1887
+ }, r = new fe(n);
1888
+ if (r.logger = e.debug !== void 0 || e.prefix !== void 0 ? this.logger.clone(e) : this.logger, ["store", "language"].forEach((o) => {
1889
+ r[o] = this[o];
1890
+ }), r.services = {
1891
+ ...this.services
1892
+ }, r.services.postProcessors = Object.create(this.services.postProcessors), r.services.utils = {
1893
+ ...r.services.utils,
1894
+ hasLoadedNamespace: r.hasLoadedNamespace.bind(r),
1895
+ reloadResources: r.reloadResources.bind(r)
1896
+ }, s) {
1897
+ const o = (d) => {
1898
+ const u = Array.isArray(d) ? [...d] : {
1899
+ ...d
1900
+ };
1901
+ return Object.keys(u).forEach((h) => {
1902
+ u[h] && typeof u[h] == "object" && (u[h] = o(u[h]));
1903
+ }), u;
1904
+ }, c = o(this.store.data);
1905
+ r.store = new qe(c, n, this.logger), r.services.resourceStore = r.store;
1906
+ }
1907
+ if (e.interpolation) {
1908
+ const c = {
1909
+ ...Te().interpolation,
1910
+ ...this.options.interpolation,
1911
+ ...e.interpolation
1912
+ }, d = {
1913
+ ...n,
1914
+ interpolation: c
1915
+ };
1916
+ r.services.interpolator = new tt(d, this.logger);
1917
+ }
1918
+ return r.configuredLngs = /* @__PURE__ */ new Set([...this.configuredLngs || [], ...rt(e)]), r.translator = new je(r.services, n), r.translator.on("*", (o, ...c) => {
1919
+ r.emit(o, ...c);
1920
+ }), r.init(n, t), r.translator.options = n, r.translator.backendConnector.newestCloneHasLoadedNamespace = r.hasLoadedNamespace.bind(r), r;
1921
+ }
1922
+ toJSON() {
1923
+ return {
1924
+ options: this.options,
1925
+ store: this.store,
1926
+ language: this.language,
1927
+ languages: this.languages,
1928
+ resolvedLanguage: this.resolvedLanguage
1929
+ };
1930
+ }
1931
+ }
1932
+ const H = fe.createInstance();
1933
+ H.createInstance;
1934
+ H.dir;
1935
+ H.init;
1936
+ H.loadResources;
1937
+ H.reloadResources;
1938
+ H.use;
1939
+ H.changeLanguage;
1940
+ H.getFixedT;
1941
+ H.t;
1942
+ H.exists;
1943
+ H.setDefaultNamespace;
1944
+ H.hasLoadedNamespace;
1945
+ H.loadNamespaces;
1946
+ H.loadLanguages;
1947
+ const Ts = (i, e, t, s) => {
1948
+ const n = [t, {
1949
+ code: e,
1950
+ ...s || {}
1951
+ }];
1952
+ if (i?.services?.logger?.forward)
1953
+ return i.services.logger.forward(n, "warn", "react-i18next::", !0);
1954
+ ae(n[0]) && (n[0] = `react-i18next:: ${n[0]}`), i?.services?.logger?.warn ? i.services.logger.warn(...n) : console?.warn && console.warn(...n);
1955
+ }, at = /* @__PURE__ */ new WeakMap(), As = /* @__PURE__ */ new Set(), we = (i, e, t, s) => {
1956
+ if (ae(t)) {
1957
+ let n = As;
1958
+ const r = i?.services?.logger || i;
1959
+ if (Lt(r) && (n = at.get(r), n || at.set(r, n = /* @__PURE__ */ new Set())), n.has(t)) return;
1960
+ n.add(t);
1961
+ }
1962
+ Ts(i, e, t, s);
1963
+ }, Ds = () => {
1964
+ try {
1965
+ return process.env.NODE_ENV !== "production";
1966
+ } catch {
1967
+ return !1;
1968
+ }
1969
+ }, Ct = (i, e) => () => {
1970
+ i.isInitialized ? e() : i.once("initialized", () => e());
1971
+ }, Ae = (i, e, t) => {
1972
+ i.loadNamespaces(e, Ct(i, t));
1973
+ }, ot = (i, e, t, s) => {
1974
+ if (ae(t) && (t = [t]), i.options.preload && i.options.preload.indexOf(e) > -1) return Ae(i, t, s);
1975
+ t.forEach((n) => {
1976
+ i.options.ns.indexOf(n) < 0 && i.options.ns.push(n);
1977
+ }), i.loadLanguages(e, Ct(i, s));
1978
+ }, Fs = (i, e, t = {}) => !e.languages || !e.languages.length ? (we(e, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
1979
+ languages: e.languages
1980
+ }), !0) : e.hasLoadedNamespace(i, {
1981
+ lng: t.lng,
1982
+ precheck: (s, n) => {
1983
+ if (t.bindI18n && t.bindI18n.indexOf("languageChanging") > -1 && s.services.backendConnector.backend && s.isLanguageChangingTo && !n(s.isLanguageChangingTo, i)) return !1;
1984
+ }
1985
+ }), ae = (i) => typeof i == "string", Lt = (i) => typeof i == "object" && i !== null, Is = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, Ms = {
1986
+ "&amp;": "&",
1987
+ "&#38;": "&",
1988
+ "&lt;": "<",
1989
+ "&#60;": "<",
1990
+ "&gt;": ">",
1991
+ "&#62;": ">",
1992
+ "&apos;": "'",
1993
+ "&#39;": "'",
1994
+ "&quot;": '"',
1995
+ "&#34;": '"',
1996
+ "&nbsp;": " ",
1997
+ "&#160;": " ",
1998
+ "&copy;": "©",
1999
+ "&#169;": "©",
2000
+ "&reg;": "®",
2001
+ "&#174;": "®",
2002
+ "&hellip;": "…",
2003
+ "&#8230;": "…",
2004
+ "&#x2F;": "/",
2005
+ "&#47;": "/"
2006
+ }, zs = (i) => Ms[i], Vs = (i) => i.replace(Is, zs);
2007
+ let Ks = {
2008
+ bindI18n: "languageChanged",
2009
+ bindI18nStore: "",
2010
+ transEmptyNodeValue: "",
2011
+ transSupportBasicHtmlNodes: !0,
2012
+ transWrapTextNodes: "",
2013
+ transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
2014
+ useSuspense: !0,
2015
+ unescape: Vs,
2016
+ transDefaultProps: void 0
2017
+ };
2018
+ const Us = () => Ks;
2019
+ let Bs;
2020
+ const Ws = () => Bs, Hs = Rt();
2021
+ class Ys {
2022
+ constructor() {
2023
+ this.usedNamespaces = {};
2024
+ }
2025
+ addUsedNamespaces(e) {
2026
+ e.forEach((t) => {
2027
+ this.usedNamespaces[t] || (this.usedNamespaces[t] = !0);
2028
+ });
2029
+ }
2030
+ getUsedNamespaces() {
2031
+ return Object.keys(this.usedNamespaces);
2032
+ }
2033
+ }
2034
+ const qs = (i, e) => {
2035
+ if (ae(e)) return e;
2036
+ if (Lt(e) && ae(e.defaultValue)) return e.defaultValue;
2037
+ if (typeof i == "function") return "";
2038
+ if (Array.isArray(i)) {
2039
+ const t = i[i.length - 1];
2040
+ return typeof t == "function" ? "" : t;
2041
+ }
2042
+ return i;
2043
+ }, Js = (i) => `${i.language}|${i.resolvedLanguage}|${i.languages?.join(",")}`, Gs = (i) => new Proxy(i, {
2044
+ get: (e, t) => t === "__original" ? e : Reflect.get(e, t)
2045
+ }), Qs = {
2046
+ t: qs,
2047
+ ready: !1
2048
+ }, Zs = () => () => {
2049
+ }, Xs = (i, {
2050
+ bindI18n: e,
2051
+ bindI18nStore: t
2052
+ }, s) => (e && i.on(e, s), t && i.store.on(t, s), () => {
2053
+ e && i.off(e, s), t && i.store.off(t, s);
2054
+ }), lt = /* @__PURE__ */ new WeakMap(), ct = (i, e) => {
2055
+ if (!e) return 0;
2056
+ let t = lt.get(i);
2057
+ t || lt.set(i, t = /* @__PURE__ */ new Map());
2058
+ let s = 0;
2059
+ return e.split(" ").forEach((n) => {
2060
+ t.has(n) || (t.set(n, 0), i.on(n, () => t.set(n, t.get(n) + 1))), s += t.get(n);
2061
+ }), s;
2062
+ }, en = (i, {
2063
+ bindI18n: e,
2064
+ bindI18nStore: t
2065
+ }) => ct(i, e) + ct(i.store, t), oe = (i, e = {}) => {
2066
+ const {
2067
+ i18n: t
2068
+ } = e, {
2069
+ i18n: s,
2070
+ defaultNS: n
2071
+ } = Pt(Hs) || {}, r = t || s || Ws();
2072
+ r && !r.reportNamespaces && (r.reportNamespaces = new Ys()), r || we(r, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.");
2073
+ const a = ee(() => ({
2074
+ ...Us(),
2075
+ ...r?.options?.react,
2076
+ ...e
2077
+ }), [r, e]), {
2078
+ useSuspense: o,
2079
+ keyPrefix: c,
2080
+ bindI18n: d,
2081
+ bindI18nStore: u
2082
+ } = a, h = i, p = ae(h) ? [h] : h, m = JSON.stringify(p), g = ee(() => p, [m]);
2083
+ r?.reportNamespaces?.addUsedNamespaces?.(g);
2084
+ const L = G((R) => r ? Xs(r, {
2085
+ bindI18n: d,
2086
+ bindI18nStore: u
2087
+ }, R) : Zs, [r, d, u]), w = se(), j = G(() => {
2088
+ if (!r)
2089
+ return Qs;
2090
+ const R = !!(r.isInitialized || r.initializedStoreOnce) && g.every((B) => Fs(B, r, a)), P = e.lng || r.language, z = en(r, a), A = typeof c == "function" ? te(c, {
2091
+ ...r.options,
2092
+ ns: g
2093
+ }) : c, I = w.current;
2094
+ if (I && I.i18n === r && I.ready === R && I.lng === P && I.namespaces === g && I.keyPrefix === A && I.revision === z)
2095
+ return I;
2096
+ const q = {
2097
+ t: r.getFixedT(P, a.nsMode === "fallback" ? g : g[0], c, {
2098
+ scopeNs: g
2099
+ }),
2100
+ i18n: r,
2101
+ ready: R,
2102
+ lng: P,
2103
+ namespaces: g,
2104
+ keyPrefix: A,
2105
+ revision: z
2106
+ };
2107
+ return w.current = q, q;
2108
+ }, [r, g, c, a, e.lng]), [N, C] = K(0);
2109
+ let {
2110
+ t: b,
2111
+ ready: v
2112
+ } = $t(L, j, j), k;
2113
+ r && o && !v && (k = new Promise((R) => {
2114
+ const P = () => R();
2115
+ e.lng ? ot(r, e.lng, g, P) : Ae(r, g, P);
2116
+ }), {
2117
+ t: b,
2118
+ ready: v
2119
+ } = j()), ie(() => {
2120
+ if (r && !v && !o) {
2121
+ const R = () => C((P) => P + 1);
2122
+ e.lng ? ot(r, e.lng, g, R) : Ae(r, g, R);
2123
+ }
2124
+ }, [r, e.lng, g, v, o, N]);
2125
+ const E = r || {}, T = se(null), _ = ee(() => {
2126
+ const R = E, P = Js(R);
2127
+ (T.current?.original !== R || T.current.lang !== P) && (T.current = {
2128
+ original: R,
2129
+ lang: P,
2130
+ wrapper: Gs(R)
2131
+ });
2132
+ const z = T.current.wrapper, A = !v && !o ? (...Z) => (we(r, "USE_T_BEFORE_READY", "useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."), b(...Z)) : b, I = [A, z, v];
2133
+ return I.t = A, I.i18n = z, I.ready = v, I;
2134
+ }, [b, E, v, E.resolvedLanguage, E.language, E.languages]);
2135
+ if (r && o && !v)
2136
+ throw Ds() && we(r, "SUSPENDED_WHILE_LOADING", "useTranslation: suspended while translations are loading (useSuspense is true by default). Add a <Suspense> boundary above this component, or set react.useSuspense: false in the i18next init options. https://react.i18next.com/latest/usetranslation-hook"), k;
2137
+ return _;
2138
+ }, Ln = ({
2139
+ isOpen: i,
2140
+ fieldCount: e,
2141
+ loading: t,
2142
+ isResetting: s,
2143
+ onToggle: n,
2144
+ onReset: r,
2145
+ onApply: a,
2146
+ children: o
2147
+ }) => {
2148
+ const { t: c } = oe("common");
2149
+ return /* @__PURE__ */ l.jsxs("div", { className: `list-filter-card ${i ? "" : "is-collapsed"}`, children: [
2150
+ i ? /* @__PURE__ */ l.jsx("div", { className: "list-list-filter-fields", children: o }) : /* @__PURE__ */ l.jsxs("div", { className: "list-filter-collapsed-left", children: [
2151
+ /* @__PURE__ */ l.jsx(Ve, { size: 15, strokeWidth: 2, className: "list-filter-collapsed-icon" }),
2152
+ /* @__PURE__ */ l.jsx("span", { className: "list-filter-collapsed-title", children: c("filters", "Filters") }),
2153
+ /* @__PURE__ */ l.jsxs("span", { className: "list-filter-count-badge", children: [
2154
+ e,
2155
+ " ",
2156
+ c("fields", "fields")
2157
+ ] })
2158
+ ] }),
2159
+ /* @__PURE__ */ l.jsxs("div", { className: "list-filter-actions", children: [
2160
+ /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-filter-toggle", onClick: n, children: i ? `${c("hide_filters", "Hide filters")} (${e})` : c("more_filters", "More filters") }),
2161
+ i && /* @__PURE__ */ l.jsxs("div", { className: "list-filter-buttons", children: [
2162
+ /* @__PURE__ */ l.jsx(
2163
+ "button",
2164
+ {
2165
+ type: "button",
2166
+ className: "list-filter-reset",
2167
+ disabled: t,
2168
+ onClick: r,
2169
+ title: c("reset_filter", "Reset filter"),
2170
+ "aria-label": c("reset_filter", "Reset filter"),
2171
+ children: /* @__PURE__ */ l.jsx(os, { size: 16, strokeWidth: 2, className: s ? "icon-spin" : "" })
2172
+ }
2173
+ ),
2174
+ /* @__PURE__ */ l.jsxs("button", { type: "button", className: "list-filter-apply", disabled: t, onClick: a, children: [
2175
+ /* @__PURE__ */ l.jsx(Ve, { size: 15, strokeWidth: 2 }),
2176
+ /* @__PURE__ */ l.jsx("span", { children: c("apply_filter", "Apply Filter") })
2177
+ ] })
2178
+ ] })
2179
+ ] })
2180
+ ] });
2181
+ }, On = ({ label: i, children: e }) => /* @__PURE__ */ l.jsxs("label", { className: "list-filter-field", children: [
2182
+ /* @__PURE__ */ l.jsx("span", { className: "list-filter-label", children: i }),
2183
+ e
2184
+ ] }), En = ({
2185
+ className: i = "",
2186
+ pageRef: e,
2187
+ topBar: t,
2188
+ filter: s,
2189
+ search: n,
2190
+ selection: r,
2191
+ table: a,
2192
+ preview: o,
2193
+ dialogs: c
2194
+ }) => /* @__PURE__ */ l.jsxs("div", { className: ["list-page", "full-page", i].filter(Boolean).join(" "), ref: e, children: [
2195
+ t,
2196
+ s,
2197
+ n,
2198
+ r,
2199
+ /* @__PURE__ */ l.jsxs("div", { className: "split-view", children: [
2200
+ a,
2201
+ o
2202
+ ] }),
2203
+ c
2204
+ ] });
2205
+ var Ot = {
2206
+ color: void 0,
2207
+ size: void 0,
2208
+ className: void 0,
2209
+ style: void 0,
2210
+ attr: void 0
2211
+ }, dt = Q.createContext && /* @__PURE__ */ Q.createContext(Ot), tn = ["attr", "size", "title"];
2212
+ function sn(i, e) {
2213
+ if (i == null) return {};
2214
+ var t, s, n = nn(i, e);
2215
+ if (Object.getOwnPropertySymbols) {
2216
+ var r = Object.getOwnPropertySymbols(i);
2217
+ for (s = 0; s < r.length; s++) t = r[s], e.indexOf(t) === -1 && {}.propertyIsEnumerable.call(i, t) && (n[t] = i[t]);
2218
+ }
2219
+ return n;
2220
+ }
2221
+ function nn(i, e) {
2222
+ if (i == null) return {};
2223
+ var t = {};
2224
+ for (var s in i) if ({}.hasOwnProperty.call(i, s)) {
2225
+ if (e.indexOf(s) !== -1) continue;
2226
+ t[s] = i[s];
2227
+ }
2228
+ return t;
2229
+ }
2230
+ function Se() {
2231
+ return Se = Object.assign ? Object.assign.bind() : function(i) {
2232
+ for (var e = 1; e < arguments.length; e++) {
2233
+ var t = arguments[e];
2234
+ for (var s in t) ({}).hasOwnProperty.call(t, s) && (i[s] = t[s]);
2235
+ }
2236
+ return i;
2237
+ }, Se.apply(null, arguments);
2238
+ }
2239
+ function ut(i, e) {
2240
+ var t = Object.keys(i);
2241
+ if (Object.getOwnPropertySymbols) {
2242
+ var s = Object.getOwnPropertySymbols(i);
2243
+ e && (s = s.filter(function(n) {
2244
+ return Object.getOwnPropertyDescriptor(i, n).enumerable;
2245
+ })), t.push.apply(t, s);
2246
+ }
2247
+ return t;
2248
+ }
2249
+ function ke(i) {
2250
+ for (var e = 1; e < arguments.length; e++) {
2251
+ var t = arguments[e] != null ? arguments[e] : {};
2252
+ e % 2 ? ut(Object(t), !0).forEach(function(s) {
2253
+ rn(i, s, t[s]);
2254
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(i, Object.getOwnPropertyDescriptors(t)) : ut(Object(t)).forEach(function(s) {
2255
+ Object.defineProperty(i, s, Object.getOwnPropertyDescriptor(t, s));
2256
+ });
2257
+ }
2258
+ return i;
2259
+ }
2260
+ function rn(i, e, t) {
2261
+ return (e = an(e)) in i ? Object.defineProperty(i, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : i[e] = t, i;
2262
+ }
2263
+ function an(i) {
2264
+ var e = on(i, "string");
2265
+ return typeof e == "symbol" ? e : e + "";
2266
+ }
2267
+ function on(i, e) {
2268
+ if (typeof i != "object" || !i) return i;
2269
+ var t = i[Symbol.toPrimitive];
2270
+ if (t !== void 0) {
2271
+ var s = t.call(i, e);
2272
+ if (typeof s != "object") return s;
2273
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2274
+ }
2275
+ return (e === "string" ? String : Number)(i);
2276
+ }
2277
+ function Et(i) {
2278
+ return i && i.map((e, t) => /* @__PURE__ */ Q.createElement(e.tag, ke({
2279
+ key: t
2280
+ }, e.attr), Et(e.child)));
2281
+ }
2282
+ function ge(i) {
2283
+ return (e) => /* @__PURE__ */ Q.createElement(ln, Se({
2284
+ attr: ke({}, i.attr)
2285
+ }, e), Et(i.child));
2286
+ }
2287
+ function ln(i) {
2288
+ var e = (t) => {
2289
+ var s = i.attr, n = i.size, r = i.title, a = sn(i, tn), o = n || t.size || "1em", c;
2290
+ return t.className && (c = t.className), i.className && (c = (c ? c + " " : "") + i.className), /* @__PURE__ */ Q.createElement("svg", Se({
2291
+ stroke: "currentColor",
2292
+ fill: "currentColor",
2293
+ strokeWidth: "0"
2294
+ }, t.attr, s, a, {
2295
+ className: c,
2296
+ style: ke(ke({
2297
+ color: i.color || t.color
2298
+ }, t.style), i.style),
2299
+ height: o,
2300
+ width: o,
2301
+ xmlns: "http://www.w3.org/2000/svg"
2302
+ }), r && /* @__PURE__ */ Q.createElement("title", null, r), i.children);
2303
+ };
2304
+ return dt !== void 0 ? /* @__PURE__ */ Q.createElement(dt.Consumer, null, (t) => e(t)) : e(Ot);
2305
+ }
2306
+ function cn(i) {
2307
+ return ge({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0" }, child: [] }] })(i);
2308
+ }
2309
+ function dn(i) {
2310
+ return ge({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71z" }, child: [] }, { tag: "path", attr: { d: "M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0" }, child: [] }] })(i);
2311
+ }
2312
+ function un(i) {
2313
+ return ge({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708z" }, child: [] }] })(i);
2314
+ }
2315
+ function ht(i) {
2316
+ return ge({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708" }, child: [] }] })(i);
2317
+ }
2318
+ function ft(i) {
2319
+ return ge({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z" }, child: [] }] })(i);
2320
+ }
2321
+ const hn = [
2322
+ ["filter_equals", "Equals"],
2323
+ ["filter_not_equals", "Does Not Equal"],
2324
+ ["filter_begins_with", "Begins With"],
2325
+ ["filter_ends_with", "Ends With"],
2326
+ ["filter_contains", "Contains"],
2327
+ ["filter_not_contains", "Does Not Contain"],
2328
+ ["filter_is_blank", "Is Blank"],
2329
+ ["filter_is_not_blank", "Is Not Blank"],
2330
+ ["filter_custom", "Custom Filter"]
2331
+ ], _n = ({
2332
+ id: i,
2333
+ label: e = "Select",
2334
+ value: t = "",
2335
+ options: s = [],
2336
+ onChange: n,
2337
+ placeholder: r = "Select...",
2338
+ searchPlaceholder: a = "Search values...",
2339
+ className: o = ""
2340
+ }) => {
2341
+ const { t: c } = oe("common"), [d, u] = K(!1), [h, p] = K("values"), [m, g] = K(""), [L, w] = K([]), [j, N] = K("filter_begins_with"), [C, b] = K(""), [v, k] = K(!1), E = se(null), T = se(null), _ = ee(() => s.map((y) => typeof y == "object" && y !== null ? {
2342
+ id: String(y.id ?? y.name ?? ""),
2343
+ name: String(y.name ?? y.id ?? "")
2344
+ } : { id: String(y), name: String(y) }), [s]), [R, P] = K(t || ""), z = () => {
2345
+ u((y) => {
2346
+ const f = !y;
2347
+ return f && (P(t || ""), k(!1)), f;
2348
+ });
2349
+ };
2350
+ ie(() => {
2351
+ const y = (f) => {
2352
+ E.current && !E.current.contains(f.target) && (u(!1), k(!1));
2353
+ };
2354
+ return document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y);
2355
+ }, []), ie(() => {
2356
+ const y = (f) => {
2357
+ T.current && !T.current.contains(f.target) && k(!1);
2358
+ };
2359
+ if (v)
2360
+ return document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y);
2361
+ }, [v]);
2362
+ const A = ee(() => {
2363
+ if (!m.trim()) return _;
2364
+ const y = m.toLowerCase();
2365
+ return _.filter((f) => f.name.toLowerCase().includes(y));
2366
+ }, [_, m]), I = ee(() => {
2367
+ if (!t) return r;
2368
+ if (t === "__BLANK__") return "(Blank)";
2369
+ if (t === "__NOT_BLANK__") return "(Not Blank)";
2370
+ const y = _.find((f) => f.id === String(t));
2371
+ return y ? y.name : t;
2372
+ }, [t, _, r]), Z = () => {
2373
+ if (n?.(R), R) {
2374
+ const y = _.find((x) => x.id === R), f = y ? y.name : R;
2375
+ w((x) => [f, ...x.filter((O) => O !== f)].slice(0, 5));
2376
+ }
2377
+ u(!1);
2378
+ }, q = () => {
2379
+ if (j === "filter_is_blank") {
2380
+ const x = _.find((O) => !O.name || O.name.trim() === "");
2381
+ x ? (n?.(x.id), P(x.id)) : (n?.("__BLANK__"), P("__BLANK__")), u(!1);
2382
+ return;
2383
+ }
2384
+ if (j === "filter_is_not_blank") {
2385
+ n?.("__NOT_BLANK__"), P("__NOT_BLANK__"), u(!1);
2386
+ return;
2387
+ }
2388
+ if (!C.trim()) {
2389
+ n?.(""), u(!1);
2390
+ return;
2391
+ }
2392
+ const y = C.trim().toLowerCase();
2393
+ let f = null;
2394
+ j === "filter_begins_with" ? f = _.find((x) => x.name.toLowerCase().startsWith(y)) : j === "filter_ends_with" ? f = _.find((x) => x.name.toLowerCase().endsWith(y)) : j === "filter_equals" ? f = _.find((x) => x.name.toLowerCase() === y) : j === "filter_not_equals" ? f = _.find((x) => x.name.toLowerCase() !== y) : j === "filter_not_contains" ? f = _.find((x) => !x.name.toLowerCase().includes(y)) : f = _.find((x) => x.name.toLowerCase().includes(y)), f ? (n?.(f.id), P(f.id), w((x) => [f.name, ...x.filter((O) => O !== f.name)].slice(0, 5))) : (n?.(C.trim()), P(C.trim())), u(!1);
2395
+ }, B = () => {
2396
+ P(""), b(""), n?.(""), u(!1);
2397
+ }, M = (y) => {
2398
+ y.stopPropagation(), w([]);
2399
+ }, U = (y) => {
2400
+ const f = _.find((x) => x.name.toLowerCase() === y.toLowerCase());
2401
+ f ? P(f.id) : g(y);
2402
+ }, J = !R || R === "ALL";
2403
+ return /* @__PURE__ */ l.jsxs("div", { className: `list-filter-dropdown-container ${o}`, ref: E, children: [
2404
+ /* @__PURE__ */ l.jsxs(
2405
+ "button",
2406
+ {
2407
+ type: "button",
2408
+ id: i,
2409
+ className: `list-filter-dropdown-trigger ${d ? "open" : ""} ${t ? "has-value" : ""}`,
2410
+ onClick: z,
2411
+ "aria-expanded": d,
2412
+ "aria-haspopup": "dialog",
2413
+ children: [
2414
+ /* @__PURE__ */ l.jsx("span", { className: "list-filter-dropdown-trigger-text", children: I }),
2415
+ /* @__PURE__ */ l.jsx(ht, { size: 11, className: `list-filter-dropdown-trigger-chevron ${d ? "open" : ""}` })
2416
+ ]
2417
+ }
2418
+ ),
2419
+ d && /* @__PURE__ */ l.jsxs("div", { className: "list-filter-dropdown-popover", role: "dialog", "aria-label": e, children: [
2420
+ /* @__PURE__ */ l.jsxs("div", { className: "list-filter-dropdown-tabs", children: [
2421
+ /* @__PURE__ */ l.jsxs(
2422
+ "button",
2423
+ {
2424
+ type: "button",
2425
+ className: `list-filter-dropdown-tab-btn ${h === "values" ? "active" : ""}`,
2426
+ onClick: () => {
2427
+ p("values"), k(!1);
2428
+ },
2429
+ children: [
2430
+ /* @__PURE__ */ l.jsx("span", { className: "list-filter-dropdown-tab-text", children: c("filter_values", "Values") }),
2431
+ h === "values" && /* @__PURE__ */ l.jsx("span", { className: "list-filter-dropdown-tab-indicator" })
2432
+ ]
2433
+ }
2434
+ ),
2435
+ /* @__PURE__ */ l.jsxs(
2436
+ "button",
2437
+ {
2438
+ type: "button",
2439
+ className: `list-filter-dropdown-tab-btn ${h === "condition" ? "active" : ""}`,
2440
+ onClick: () => {
2441
+ p("condition"), k(!1);
2442
+ },
2443
+ children: [
2444
+ /* @__PURE__ */ l.jsx("span", { className: "list-filter-dropdown-tab-text", children: c("filter_condition", "Condition") }),
2445
+ h === "condition" && /* @__PURE__ */ l.jsx("span", { className: "list-filter-dropdown-tab-indicator" })
2446
+ ]
2447
+ }
2448
+ )
2449
+ ] }),
2450
+ h === "values" && /* @__PURE__ */ l.jsxs("div", { className: "list-filter-dropdown-body", children: [
2451
+ /* @__PURE__ */ l.jsxs("div", { className: "list-filter-dropdown-list-search-box", children: [
2452
+ /* @__PURE__ */ l.jsx(cn, { size: 12, className: "list-filter-dropdown-list-search-icon" }),
2453
+ /* @__PURE__ */ l.jsx(
2454
+ "input",
2455
+ {
2456
+ type: "text",
2457
+ className: "list-filter-dropdown-list-search-input",
2458
+ placeholder: c("search_values", a),
2459
+ value: m,
2460
+ onChange: (y) => g(y.target.value),
2461
+ autoFocus: !0
2462
+ }
2463
+ )
2464
+ ] }),
2465
+ L.length > 0 && !m && /* @__PURE__ */ l.jsxs("div", { className: "list-filter-dropdown-recent-section", children: [
2466
+ /* @__PURE__ */ l.jsxs("div", { className: "list-filter-dropdown-recent-header", children: [
2467
+ /* @__PURE__ */ l.jsx("span", { className: "list-filter-dropdown-recent-title", children: c("recent_searches", "Recent searches") }),
2468
+ /* @__PURE__ */ l.jsx(
2469
+ "button",
2470
+ {
2471
+ type: "button",
2472
+ className: "list-filter-dropdown-clear-recent-btn",
2473
+ onClick: M,
2474
+ children: c("clear_all", "Clear all")
2475
+ }
2476
+ )
2477
+ ] }),
2478
+ /* @__PURE__ */ l.jsx("div", { className: "list-filter-dropdown-recent-list", children: L.map((y, f) => /* @__PURE__ */ l.jsxs(
2479
+ "div",
2480
+ {
2481
+ className: "list-filter-dropdown-recent-item",
2482
+ onClick: () => U(y),
2483
+ children: [
2484
+ /* @__PURE__ */ l.jsx(dn, { size: 12, className: "list-filter-dropdown-clock-icon" }),
2485
+ /* @__PURE__ */ l.jsx("span", { children: y })
2486
+ ]
2487
+ },
2488
+ `recent-${y}-${f}`
2489
+ )) })
2490
+ ] }),
2491
+ /* @__PURE__ */ l.jsxs("div", { className: "list-filter-dropdown-options-list", children: [
2492
+ /* @__PURE__ */ l.jsxs(
2493
+ "div",
2494
+ {
2495
+ className: `list-filter-dropdown-option-item list-filter-dropdown-all-values ${J ? "selected" : ""}`,
2496
+ onClick: () => P(""),
2497
+ children: [
2498
+ /* @__PURE__ */ l.jsx("span", { className: `list-filter-dropdown-checkbox ${J ? "checked-blue" : ""}`, children: J && /* @__PURE__ */ l.jsx(ft, { size: 14, className: "list-filter-dropdown-check-white" }) }),
2499
+ /* @__PURE__ */ l.jsx("span", { className: "list-filter-dropdown-all-label", children: c("all_values", "(All values)") })
2500
+ ]
2501
+ }
2502
+ ),
2503
+ A.length === 0 ? /* @__PURE__ */ l.jsx("div", { className: "list-filter-dropdown-no-options", children: c("no_matches_found", "No matches found") }) : A.map((y, f) => {
2504
+ const x = R === y.id;
2505
+ return /* @__PURE__ */ l.jsxs(
2506
+ "div",
2507
+ {
2508
+ className: `list-filter-dropdown-option-item ${x ? "selected-single" : ""}`,
2509
+ onClick: () => P(x ? "" : y.id),
2510
+ children: [
2511
+ /* @__PURE__ */ l.jsx("span", { className: `list-filter-dropdown-checkbox ${x ? "checked-blue" : ""}`, children: x && /* @__PURE__ */ l.jsx(ft, { size: 14, className: "list-filter-dropdown-check-white" }) }),
2512
+ /* @__PURE__ */ l.jsx("span", { className: "list-filter-dropdown-option-label", children: y.name })
2513
+ ]
2514
+ },
2515
+ `opt-${y.id}-${f}`
2516
+ );
2517
+ })
2518
+ ] }),
2519
+ /* @__PURE__ */ l.jsxs("div", { className: "list-filter-dropdown-footer", children: [
2520
+ /* @__PURE__ */ l.jsx(
2521
+ "button",
2522
+ {
2523
+ type: "button",
2524
+ className: "list-filter-dropdown-clear-filter-btn",
2525
+ onClick: B,
2526
+ children: c("clear_filter", "Clear filter")
2527
+ }
2528
+ ),
2529
+ /* @__PURE__ */ l.jsx(
2530
+ "button",
2531
+ {
2532
+ type: "button",
2533
+ className: "list-filter-dropdown-apply-btn",
2534
+ onClick: Z,
2535
+ children: c("apply", "Apply")
2536
+ }
2537
+ )
2538
+ ] })
2539
+ ] }),
2540
+ h === "condition" && /* @__PURE__ */ l.jsxs("div", { className: "list-filter-dropdown-body list-filter-dropdown-condition-body", children: [
2541
+ /* @__PURE__ */ l.jsxs("div", { className: "list-filter-dropdown-condition-select-wrap", ref: T, children: [
2542
+ /* @__PURE__ */ l.jsxs(
2543
+ "button",
2544
+ {
2545
+ type: "button",
2546
+ className: `list-filter-dropdown-condition-select-btn ${v ? "open" : ""}`,
2547
+ onClick: () => k((y) => !y),
2548
+ "aria-expanded": v,
2549
+ children: [
2550
+ /* @__PURE__ */ l.jsx("span", { children: c(j, "Begins With") }),
2551
+ v ? /* @__PURE__ */ l.jsx(un, { size: 11, className: "list-filter-dropdown-select-chevron" }) : /* @__PURE__ */ l.jsx(ht, { size: 11, className: "list-filter-dropdown-select-chevron" })
2552
+ ]
2553
+ }
2554
+ ),
2555
+ v && /* @__PURE__ */ l.jsx("div", { className: "list-filter-dropdown-condition-menu", role: "listbox", children: hn.map(([y, f]) => /* @__PURE__ */ l.jsx(
2556
+ "button",
2557
+ {
2558
+ type: "button",
2559
+ role: "option",
2560
+ "aria-selected": j === y,
2561
+ className: `list-filter-dropdown-condition-menu-item ${j === y ? "active" : ""}`,
2562
+ onClick: () => {
2563
+ N(y), k(!1);
2564
+ },
2565
+ children: c(y, f)
2566
+ },
2567
+ y
2568
+ )) })
2569
+ ] }),
2570
+ /* @__PURE__ */ l.jsx(
2571
+ "input",
2572
+ {
2573
+ type: "text",
2574
+ className: "list-filter-dropdown-condition-input",
2575
+ placeholder: c("enter_value", "Enter a value..."),
2576
+ value: C,
2577
+ onChange: (y) => b(y.target.value),
2578
+ autoFocus: !0
2579
+ }
2580
+ ),
2581
+ /* @__PURE__ */ l.jsxs("div", { className: "list-filter-dropdown-footer", children: [
2582
+ /* @__PURE__ */ l.jsx(
2583
+ "button",
2584
+ {
2585
+ type: "button",
2586
+ className: "list-filter-dropdown-clear-filter-btn",
2587
+ onClick: B,
2588
+ children: c("clear_filter", "Clear filter")
2589
+ }
2590
+ ),
2591
+ /* @__PURE__ */ l.jsx(
2592
+ "button",
2593
+ {
2594
+ type: "button",
2595
+ className: "list-filter-dropdown-apply-btn",
2596
+ onClick: q,
2597
+ children: c("apply", "Apply")
2598
+ }
2599
+ )
2600
+ ] })
2601
+ ] })
2602
+ ] })
2603
+ ] });
2604
+ }, Rn = ({
2605
+ currentPage: i,
2606
+ totalPages: e,
2607
+ pageNumbers: t,
2608
+ pageSizeInput: s,
2609
+ gotoPageInput: n,
2610
+ onPageSizeInputChange: r,
2611
+ onPageSizeCommit: a,
2612
+ onPageChange: o,
2613
+ onGotoPageInputChange: c,
2614
+ onGotoSubmit: d
2615
+ }) => {
2616
+ const { t: u } = oe("common");
2617
+ return /* @__PURE__ */ l.jsxs("div", { className: "list-pagination", children: [
2618
+ /* @__PURE__ */ l.jsxs("div", { className: "list-pagination-entries", children: [
2619
+ /* @__PURE__ */ l.jsx("span", { children: u("show", "Show") }),
2620
+ /* @__PURE__ */ l.jsx(
2621
+ "input",
2622
+ {
2623
+ type: "text",
2624
+ className: "list-pagination-size-input",
2625
+ value: s,
2626
+ onChange: (h) => r(h.target.value),
2627
+ onBlur: a,
2628
+ onKeyDown: (h) => {
2629
+ h.key === "Enter" && (a(), h.target.blur());
2630
+ }
2631
+ }
2632
+ ),
2633
+ /* @__PURE__ */ l.jsx("span", { children: u("entries_per_page", "entries per page") })
2634
+ ] }),
2635
+ /* @__PURE__ */ l.jsxs("div", { className: "list-pagination-controls", children: [
2636
+ /* @__PURE__ */ l.jsx(
2637
+ "button",
2638
+ {
2639
+ type: "button",
2640
+ className: "list-pagination-button",
2641
+ disabled: i <= 1,
2642
+ onClick: () => o(i - 1),
2643
+ children: /* @__PURE__ */ l.jsx(De, { size: 15 })
2644
+ }
2645
+ ),
2646
+ t.map(
2647
+ (h, p) => h === "..." ? /* @__PURE__ */ l.jsx("span", { className: "list-pagination-ellipsis", children: "..." }, `ellipsis-${p}`) : /* @__PURE__ */ l.jsx(
2648
+ "button",
2649
+ {
2650
+ type: "button",
2651
+ className: `list-pagination-button ${h === i ? "active" : ""}`,
2652
+ onClick: () => o(h),
2653
+ children: h
2654
+ },
2655
+ `page-${h}`
2656
+ )
2657
+ ),
2658
+ /* @__PURE__ */ l.jsx(
2659
+ "button",
2660
+ {
2661
+ type: "button",
2662
+ className: "list-pagination-button",
2663
+ disabled: i >= e,
2664
+ onClick: () => o(i + 1),
2665
+ children: /* @__PURE__ */ l.jsx(jt, { size: 15 })
2666
+ }
2667
+ ),
2668
+ /* @__PURE__ */ l.jsxs("div", { className: "list-pagination-goto", children: [
2669
+ /* @__PURE__ */ l.jsx("span", { children: u("go_to", "Go to") }),
2670
+ /* @__PURE__ */ l.jsx(
2671
+ "input",
2672
+ {
2673
+ type: "text",
2674
+ className: "list-pagination-goto-input",
2675
+ value: n,
2676
+ onChange: (h) => c(h.target.value),
2677
+ onKeyDown: (h) => h.key === "Enter" && d()
2678
+ }
2679
+ ),
2680
+ /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-pagination-go", onClick: d, children: u("go", "Go") })
2681
+ ] })
2682
+ ] })
2683
+ ] });
2684
+ }, Pn = ({
2685
+ row: i,
2686
+ detailRows: e,
2687
+ loading: t,
2688
+ onClose: s,
2689
+ onOpen: n,
2690
+ labels: r,
2691
+ getDetailMeta: a,
2692
+ getDetailUnit: o
2693
+ }) => i ? /* @__PURE__ */ l.jsxs("div", { className: "list-list-preview", children: [
2694
+ /* @__PURE__ */ l.jsxs("div", { className: "list-preview-header", children: [
2695
+ /* @__PURE__ */ l.jsx("span", { className: "list-preview-title", children: r.title }),
2696
+ /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-preview-close-btn", onClick: s, title: r.close, children: /* @__PURE__ */ l.jsx(us, { size: 18 }) })
2697
+ ] }),
2698
+ /* @__PURE__ */ l.jsxs("div", { className: "list-preview-item-info", children: [
2699
+ /* @__PURE__ */ l.jsx("div", { className: "list-preview-item-number", children: i.transactionNumber }),
2700
+ /* @__PURE__ */ l.jsx("div", { className: "list-preview-item-sub", children: r.summary(i) })
2701
+ ] }),
2702
+ /* @__PURE__ */ l.jsx("div", { className: "list-preview-list", children: t ? /* @__PURE__ */ l.jsx("div", { className: "list-preview-loading", children: r.loading }) : e.length === 0 ? /* @__PURE__ */ l.jsx("div", { className: "list-preview-empty", children: r.empty }) : e.map((c, d) => {
2703
+ const u = a(c), h = o(c);
2704
+ return /* @__PURE__ */ l.jsxs("div", { className: "list-preview-row", children: [
2705
+ /* @__PURE__ */ l.jsxs("div", { className: "list-preview-row-left", children: [
2706
+ /* @__PURE__ */ l.jsx("div", { className: "list-preview-row-name", children: c.itemName }),
2707
+ u && /* @__PURE__ */ l.jsx("div", { className: "list-preview-row-batch", children: u })
2708
+ ] }),
2709
+ /* @__PURE__ */ l.jsxs("div", { className: "list-preview-row-right", children: [
2710
+ c.qty,
2711
+ h ? ` ${h}` : ""
2712
+ ] })
2713
+ ] }, c.id || `detail-${d}`);
2714
+ }) }),
2715
+ /* @__PURE__ */ l.jsxs("div", { className: "list-preview-summary-box", children: [
2716
+ /* @__PURE__ */ l.jsx("span", { className: "list-preview-summary-label", children: r.totalItems }),
2717
+ /* @__PURE__ */ l.jsxs("span", { className: "list-preview-summary-value", children: [
2718
+ e.length,
2719
+ " ",
2720
+ r.items
2721
+ ] })
2722
+ ] }),
2723
+ /* @__PURE__ */ l.jsxs("button", { type: "button", className: "list-preview-open-full-btn", onClick: () => n(i), children: [
2724
+ /* @__PURE__ */ l.jsx("span", { children: r.open }),
2725
+ /* @__PURE__ */ l.jsx(Ut, { size: 15 })
2726
+ ] })
2727
+ ] }) : null, $n = ({
2728
+ containerRef: i,
2729
+ value: e,
2730
+ placeholder: t,
2731
+ isOpen: s,
2732
+ pinnedItems: n,
2733
+ recentItems: r,
2734
+ activeAction: a,
2735
+ actions: o,
2736
+ labels: c
2737
+ }) => /* @__PURE__ */ l.jsxs("div", { className: "list-search", ref: i, children: [
2738
+ /* @__PURE__ */ l.jsx(cs, { size: 16, className: "list-search-icon" }),
2739
+ /* @__PURE__ */ l.jsx(
2740
+ "input",
2741
+ {
2742
+ type: "text",
2743
+ className: "list-search-input",
2744
+ placeholder: t,
2745
+ value: e,
2746
+ onFocus: o.open,
2747
+ onClick: o.open,
2748
+ onChange: (d) => o.change(d.target.value),
2749
+ onKeyDown: (d) => {
2750
+ d.key === "Enter" && o.submit(), d.key === "Escape" && o.close();
2751
+ }
2752
+ }
2753
+ ),
2754
+ s && /* @__PURE__ */ l.jsxs("div", { className: "list-search-dropdown", children: [
2755
+ n.length > 0 && /* @__PURE__ */ l.jsx(pt, { title: c.pinned, items: n, type: "pinned", icon: /* @__PURE__ */ l.jsx(ns, { size: 14, className: "list-search-item-icon" }), activeAction: a, actions: o, labels: c }),
2756
+ /* @__PURE__ */ l.jsx(pt, { title: c.recent, items: r, type: "recent", icon: /* @__PURE__ */ l.jsx(Zt, { size: 14, className: "list-search-item-icon" }), activeAction: a, actions: o, labels: c, clearAll: r.length > 0 })
2757
+ ] })
2758
+ ] }), pt = ({ title: i, items: e, type: t, icon: s, activeAction: n, actions: r, labels: a, clearAll: o }) => /* @__PURE__ */ l.jsxs("div", { className: "list-search-section", children: [
2759
+ /* @__PURE__ */ l.jsxs("div", { className: "list-search-section-header", children: [
2760
+ /* @__PURE__ */ l.jsx("span", { className: "list-search-section-title", children: i }),
2761
+ o && /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-search-clear-all", onClick: r.clearAll, children: a.clearAll })
2762
+ ] }),
2763
+ /* @__PURE__ */ l.jsx("div", { className: "list-search-list", children: e.map((c) => {
2764
+ const d = n?.type === t && n?.id === c.id;
2765
+ return /* @__PURE__ */ l.jsxs("div", { className: "list-search-item", onClick: () => r.select(c), children: [
2766
+ /* @__PURE__ */ l.jsxs("div", { className: "list-search-item-left", children: [
2767
+ s,
2768
+ /* @__PURE__ */ l.jsx("span", { className: "list-search-item-text", children: c.searchValue })
2769
+ ] }),
2770
+ /* @__PURE__ */ l.jsxs("div", { className: "list-search-item-action-wrapper", children: [
2771
+ /* @__PURE__ */ l.jsx(
2772
+ "button",
2773
+ {
2774
+ type: "button",
2775
+ className: `list-search-more-btn ${d ? "active" : ""}`,
2776
+ title: a.options,
2777
+ onClick: (u) => {
2778
+ u.stopPropagation(), r.toggleAction(t, c);
2779
+ },
2780
+ children: /* @__PURE__ */ l.jsx(es, { size: 16 })
2781
+ }
2782
+ ),
2783
+ d && /* @__PURE__ */ l.jsx("div", { className: "list-search-popover-menu", children: t === "pinned" ? /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-search-popover-item", onClick: (u) => {
2784
+ u.stopPropagation(), r.unpin(c);
2785
+ }, children: a.unpin }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
2786
+ /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-search-popover-item", onClick: (u) => {
2787
+ u.stopPropagation(), r.pin(c);
2788
+ }, children: a.pin }),
2789
+ /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-search-popover-item", onClick: (u) => {
2790
+ u.stopPropagation(), r.clear(c);
2791
+ }, children: a.clear })
2792
+ ] }) })
2793
+ ] })
2794
+ ] }, `${t}-${c.id}`);
2795
+ }) })
2796
+ ] }), Tn = ({
2797
+ label: i,
2798
+ clearLabel: e,
2799
+ onClear: t,
2800
+ onSelectItem: s,
2801
+ selectItemLabel: n = "Select item",
2802
+ selecting: r = !1,
2803
+ selectingLabel: a
2804
+ }) => /* @__PURE__ */ l.jsxs("div", { className: "list-selection-banner", children: [
2805
+ /* @__PURE__ */ l.jsx("div", { className: "list-selection-banner-left", children: /* @__PURE__ */ l.jsx("span", { className: "list-selection-banner-text", children: i }) }),
2806
+ /* @__PURE__ */ l.jsxs("div", { className: "list-selection-banner-actions", children: [
2807
+ /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-selection-clear", onClick: t, children: e }),
2808
+ s && /* @__PURE__ */ l.jsx(
2809
+ "button",
2810
+ {
2811
+ type: "button",
2812
+ className: "list-selection-select",
2813
+ onClick: s,
2814
+ disabled: r,
2815
+ children: r && a || n
2816
+ }
2817
+ )
2818
+ ] })
2819
+ ] }), gt = ({ checked: i = !1, indeterminate: e = !1, onChange: t, ariaLabel: s = "checkbox", className: n = "", highlightBorder: r = !1 }) => /* @__PURE__ */ l.jsxs("label", { className: `list-checkbox-wrapper ${n}`, onClick: (a) => a.stopPropagation(), children: [
2820
+ /* @__PURE__ */ l.jsx("input", { type: "checkbox", className: "list-checkbox-input", checked: i, ref: (a) => {
2821
+ a && (a.indeterminate = e);
2822
+ }, onChange: (a) => t?.(a.target.checked), "aria-label": s }),
2823
+ /* @__PURE__ */ l.jsxs("span", { className: `list-checkbox-box ${i ? "checked" : ""} ${e ? "indeterminate" : ""} ${r && !i ? "highlight-blue" : ""}`, children: [
2824
+ i && /* @__PURE__ */ l.jsx("svg", { width: "12", height: "10", viewBox: "0 0 12 10", fill: "none", className: "list-checkbox-svg", "aria-hidden": "true", children: /* @__PURE__ */ l.jsx("path", { d: "M1.5 5.2L4.3 8L10.5 1.8", stroke: "#ffffff", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
2825
+ e && !i && /* @__PURE__ */ l.jsx("span", { className: "list-checkbox-bar" })
2826
+ ] })
2827
+ ] }), An = ({
2828
+ title: i,
2829
+ columns: e,
2830
+ rows: t,
2831
+ rowKey: s,
2832
+ selectedRowId: n,
2833
+ onRowClick: r,
2834
+ loading: a,
2835
+ error: o,
2836
+ emptyMessage: c,
2837
+ loadingMessage: d,
2838
+ retryLabel: u,
2839
+ onRetry: h,
2840
+ footer: p,
2841
+ selection: m
2842
+ }) => /* @__PURE__ */ l.jsxs("div", { className: "list-table-card", children: [
2843
+ /* @__PURE__ */ l.jsx("div", { className: "list-table-header", children: /* @__PURE__ */ l.jsx("div", { className: "list-table-title", children: i }) }),
2844
+ /* @__PURE__ */ l.jsx("div", { className: "list-table-container", children: /* @__PURE__ */ l.jsxs("table", { className: "list-table", children: [
2845
+ /* @__PURE__ */ l.jsx("thead", { children: /* @__PURE__ */ l.jsxs("tr", { children: [
2846
+ m && /* @__PURE__ */ l.jsx("th", { className: "list-table-checkbox-cell", children: /* @__PURE__ */ l.jsx(
2847
+ gt,
2848
+ {
2849
+ checked: m.selectedKeys.length > 0 && t.every((g) => m.selectedKeys.includes(s(g))),
2850
+ onChange: m.onToggleAll,
2851
+ ariaLabel: m.allLabel || "Select all rows"
2852
+ }
2853
+ ) }),
2854
+ e.map((g) => /* @__PURE__ */ l.jsx("th", { children: g.header }, g.key))
2855
+ ] }) }),
2856
+ /* @__PURE__ */ l.jsx("tbody", { children: a ? /* @__PURE__ */ l.jsx("tr", { children: /* @__PURE__ */ l.jsx("td", { colSpan: e.length + +!!m, className: "list-table-loading", children: d }) }) : o ? /* @__PURE__ */ l.jsx("tr", { children: /* @__PURE__ */ l.jsxs("td", { colSpan: e.length + +!!m, className: "list-table-empty", children: [
2857
+ /* @__PURE__ */ l.jsx("span", { style: { color: "#dc2626", marginRight: "10px" }, children: o }),
2858
+ /* @__PURE__ */ l.jsx(
2859
+ "button",
2860
+ {
2861
+ type: "button",
2862
+ className: "list-filter-apply",
2863
+ style: { display: "inline-flex", height: "30px", padding: "0 10px" },
2864
+ onClick: h,
2865
+ children: u
2866
+ }
2867
+ )
2868
+ ] }) }) : t.length === 0 ? /* @__PURE__ */ l.jsx("tr", { children: /* @__PURE__ */ l.jsx("td", { colSpan: e.length + +!!m, className: "list-table-empty", children: c }) }) : t.map((g) => {
2869
+ const L = s(g);
2870
+ return /* @__PURE__ */ l.jsxs(
2871
+ "tr",
2872
+ {
2873
+ className: n === L ? "list-table-row-selected" : "",
2874
+ tabIndex: 0,
2875
+ "aria-selected": n === L,
2876
+ onClick: () => r(g),
2877
+ onKeyDown: (w) => {
2878
+ (w.key === "Enter" || w.key === " ") && (w.preventDefault(), r(g));
2879
+ },
2880
+ children: [
2881
+ m && /* @__PURE__ */ l.jsx("td", { className: "list-table-checkbox-cell", onClick: (w) => w.stopPropagation(), children: /* @__PURE__ */ l.jsx(
2882
+ gt,
2883
+ {
2884
+ checked: m.selectedKeys.includes(L),
2885
+ onChange: (w) => m.onToggle(g, w),
2886
+ ariaLabel: m.rowLabel?.(g) || `Select row ${L}`
2887
+ }
2888
+ ) }),
2889
+ e.map((w) => {
2890
+ const j = w.render ? w.render(g) : g[w.key], N = typeof w.title == "function" ? w.title(g) : w.title;
2891
+ return /* @__PURE__ */ l.jsx("td", { className: w.className, title: N, children: j }, w.key);
2892
+ })
2893
+ ]
2894
+ },
2895
+ L
2896
+ );
2897
+ }) })
2898
+ ] }) }),
2899
+ p
2900
+ ] }), mt = ["word", "pdf", "json", "txt", "rtf", "mht", "excel"], fn = ["png", "jpeg", "gif"], pn = [["Small (720px)", 720], ["Medium (1280px)", 1280], ["Large (1920px)", 1920], ["Original Size", "original"]], _e = (i, e) => e(`export_${i}`, {
2901
+ word: "Export to Word (.docx)",
2902
+ pdf: "Export to PDF (.pdf)",
2903
+ json: "Export to JSON (.json)",
2904
+ txt: "Export to Text (.txt)",
2905
+ rtf: "Export to RTF (.rtf)",
2906
+ mht: "Export to MHTML (.mht)",
2907
+ excel: "Export to Excel (.xlsx)",
2908
+ png: "Export to PNG (.png)",
2909
+ jpeg: "Export to JPEG (.jpg)",
2910
+ gif: "Export to GIF (.gif)"
2911
+ }[i]), gn = ({ onExport: i }) => {
2912
+ const { t: e } = oe("common"), [t, s] = K(!1), [n, r] = K(null), a = se(null);
2913
+ ie(() => {
2914
+ const c = (d) => {
2915
+ a.current && !a.current.contains(d.target) && (s(!1), r(null));
2916
+ };
2917
+ return document.addEventListener("mousedown", c), () => document.removeEventListener("mousedown", c);
2918
+ }, []);
2919
+ const o = (c, d) => {
2920
+ s(!1), r(null), i(c, d);
2921
+ };
2922
+ return /* @__PURE__ */ l.jsxs("div", { className: "list-export-wrapper", ref: a, children: [
2923
+ /* @__PURE__ */ l.jsxs("button", { type: "button", className: "list-export-button", onClick: () => {
2924
+ s((c) => !c), r(null);
2925
+ }, "aria-expanded": t, children: [
2926
+ /* @__PURE__ */ l.jsx("span", { children: "Export" }),
2927
+ /* @__PURE__ */ l.jsx(Nt, { size: 14, strokeWidth: 2, className: "list-export-chevron", "aria-hidden": "true" })
2928
+ ] }),
2929
+ t && /* @__PURE__ */ l.jsxs("div", { className: "list-export-dropdown-menu", children: [
2930
+ mt.slice(0, 2).map((c) => /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-export-dropdown-item", onClick: () => o(c), children: _e(c, e) }, c)),
2931
+ fn.map((c) => /* @__PURE__ */ l.jsxs("div", { className: "list-export-subitem-wrap", onMouseEnter: () => r(c), onMouseLeave: () => r(null), children: [
2932
+ /* @__PURE__ */ l.jsxs("button", { type: "button", className: `list-export-dropdown-item with-arrow ${n === c ? "active" : ""}`, onClick: () => r((d) => d === c ? null : c), children: [
2933
+ /* @__PURE__ */ l.jsx("span", { children: _e(c, e) }),
2934
+ /* @__PURE__ */ l.jsx("span", { className: "list-export-arrow", children: "›" })
2935
+ ] }),
2936
+ n === c && /* @__PURE__ */ l.jsx("div", { className: "list-export-submenu", children: pn.map(([d, u]) => /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-export-submenu-item", onClick: () => o(c, u), children: d }, d)) })
2937
+ ] }, c)),
2938
+ mt.slice(2).map((c) => /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-export-dropdown-item", onClick: () => o(c), children: _e(c, e) }, c))
2939
+ ] })
2940
+ ] });
2941
+ }, Dn = ({ syncInfo: i, onClose: e, onNew: t, onExport: s, rightActions: n }) => {
2942
+ const { t: r } = oe("common");
2943
+ return /* @__PURE__ */ l.jsxs("div", { className: "list-top-bar", children: [
2944
+ /* @__PURE__ */ l.jsxs("div", { className: "list-top-bar-left", children: [
2945
+ /* @__PURE__ */ l.jsxs("button", { type: "button", className: "list-top-bar-close", onClick: e, children: [
2946
+ /* @__PURE__ */ l.jsx(De, { size: 16, strokeWidth: 2.2 }),
2947
+ /* @__PURE__ */ l.jsx("span", { children: r("close", "Close") })
2948
+ ] }),
2949
+ /* @__PURE__ */ l.jsx("span", { className: "list-top-bar-sync", children: i })
2950
+ ] }),
2951
+ /* @__PURE__ */ l.jsxs("div", { className: "list-top-bar-right", children: [
2952
+ s && /* @__PURE__ */ l.jsx(gn, { onExport: s }),
2953
+ n || t && /* @__PURE__ */ l.jsxs("button", { type: "button", className: "list-top-bar-new", onClick: t, children: [
2954
+ /* @__PURE__ */ l.jsx(rs, { size: 16, strokeWidth: 2.5 }),
2955
+ /* @__PURE__ */ l.jsx("span", { children: r("new", "New") })
2956
+ ] })
2957
+ ] })
2958
+ ] });
2959
+ }, mn = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], xn = (i) => {
2960
+ if (!i) return "";
2961
+ const e = String(i).trim(), t = e.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})/);
2962
+ if (t) {
2963
+ const [, r, a, o] = t;
2964
+ return `${o}-${a.padStart(2, "0")}-${r.padStart(2, "0")}`;
2965
+ }
2966
+ const s = e.match(/^(\d{4})[/-](\d{1,2})[/-](\d{1,2})/);
2967
+ if (s) {
2968
+ const [, r, a, o] = s;
2969
+ return `${r}-${a.padStart(2, "0")}-${o.padStart(2, "0")}`;
2970
+ }
2971
+ const n = new Date(i);
2972
+ return Number.isNaN(n.getTime()) ? "" : `${n.getFullYear()}-${String(n.getMonth() + 1).padStart(2, "0")}-${String(n.getDate()).padStart(2, "0")}`;
2973
+ }, yn = (i, e) => new Date(2026, i, 1).toLocaleString(e === "id" ? "id-ID" : "en-US", { month: "long" }), bn = (i, e) => {
2974
+ const t = new Date(i, e, 1).getDay(), s = new Date(i, e + 1, 0).getDate(), n = new Date(i, e, 0).getDate(), r = [];
2975
+ for (let a = t - 1; a >= 0; a -= 1)
2976
+ r.push({ day: n - a, month: e === 0 ? 11 : e - 1, year: e === 0 ? i - 1 : i, isCurrentMonth: !1 });
2977
+ for (let a = 1; a <= s; a += 1) r.push({ day: a, month: e, year: i, isCurrentMonth: !0 });
2978
+ for (let a = 1; r.length < 42; a += 1)
2979
+ r.push({ day: a, month: e === 11 ? 0 : e + 1, year: e === 11 ? i + 1 : i, isCurrentMonth: !1 });
2980
+ return r;
2981
+ }, vn = (i) => `${i.year}-${String(i.month + 1).padStart(2, "0")}-${String(i.day).padStart(2, "0")}`, wn = (i, e) => xn(e) === vn(i), xt = ({ label: i, month: e, language: t, selectedDate: s, onPrevious: n, onNext: r, onSelect: a, isDisabled: o = () => !1 }) => /* @__PURE__ */ l.jsxs("div", { className: "list-period-calendar", children: [
2982
+ /* @__PURE__ */ l.jsx("div", { className: "list-period-calendar-title", children: i }),
2983
+ /* @__PURE__ */ l.jsxs("div", { className: "list-period-calendar-card", children: [
2984
+ /* @__PURE__ */ l.jsxs("div", { className: "list-period-calendar-header", children: [
2985
+ /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-period-calendar-nav", onClick: n, children: /* @__PURE__ */ l.jsx(De, { size: 14 }) }),
2986
+ /* @__PURE__ */ l.jsxs("span", { className: "list-period-calendar-month", children: [
2987
+ yn(e.getMonth(), t),
2988
+ " ",
2989
+ e.getFullYear()
2990
+ ] }),
2991
+ /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-period-calendar-nav", onClick: r, children: /* @__PURE__ */ l.jsx(jt, { size: 14 }) })
2992
+ ] }),
2993
+ /* @__PURE__ */ l.jsx("div", { className: "list-period-calendar-weekdays", children: mn.map((c) => /* @__PURE__ */ l.jsx("span", { children: c }, c)) }),
2994
+ /* @__PURE__ */ l.jsx("div", { className: "list-period-calendar-days", children: bn(e.getFullYear(), e.getMonth()).map((c, d) => /* @__PURE__ */ l.jsx(
2995
+ "button",
2996
+ {
2997
+ type: "button",
2998
+ disabled: o(c),
2999
+ className: `list-period-calendar-day ${c.isCurrentMonth ? "" : "other-month"} ${wn(c, s) ? "selected" : ""}`,
3000
+ onClick: () => a(c),
3001
+ children: c.day
3002
+ },
3003
+ `${i}-${d}`
3004
+ )) })
3005
+ ] })
3006
+ ] }), yt = [
3007
+ { items: [{ id: "all", labelKey: "period_all", fallback: "All Periods" }] },
3008
+ { labelKey: "period_recent", fallback: "RECENT", items: ["today", "yesterday"] },
3009
+ { labelKey: "period_short", fallback: "SHORT PERIOD", items: ["this_week", "last_week", "this_month", "last_month"] },
3010
+ { labelKey: "period_long", fallback: "LONG PERIOD", items: ["this_quarter", "last_quarter", "this_year", "last_year"] },
3011
+ { labelKey: "period_custom", fallback: "CUSTOM", items: ["custom"] }
3012
+ ], Nn = (i) => {
3013
+ const e = /* @__PURE__ */ new Date(), t = (s) => `${String(s.getDate()).padStart(2, "0")}/${String(s.getMonth() + 1).padStart(2, "0")}/${s.getFullYear()}`;
3014
+ switch (i) {
3015
+ case "today":
3016
+ return { start: t(e), end: t(e) };
3017
+ case "yesterday": {
3018
+ const s = new Date(e);
3019
+ return s.setDate(e.getDate() - 1), { start: t(s), end: t(s) };
3020
+ }
3021
+ case "this_week":
3022
+ case "last_week": {
3023
+ const s = new Date(e), n = s.getDate() - s.getDay() + (s.getDay() === 0 ? -6 : 1) + (i === "last_week" ? -7 : 0), r = new Date(s.setDate(n)), a = new Date(r);
3024
+ return a.setDate(r.getDate() + 6), { start: t(r), end: t(a) };
3025
+ }
3026
+ case "this_month":
3027
+ return { start: t(new Date(e.getFullYear(), e.getMonth(), 1)), end: t(new Date(e.getFullYear(), e.getMonth() + 1, 0)) };
3028
+ case "last_month":
3029
+ return { start: t(new Date(e.getFullYear(), e.getMonth() - 1, 1)), end: t(new Date(e.getFullYear(), e.getMonth(), 0)) };
3030
+ case "this_quarter": {
3031
+ const s = Math.floor(e.getMonth() / 3);
3032
+ return { start: t(new Date(e.getFullYear(), s * 3, 1)), end: t(new Date(e.getFullYear(), (s + 1) * 3, 0)) };
3033
+ }
3034
+ case "last_quarter": {
3035
+ const s = Math.floor(e.getMonth() / 3) - 1, n = s < 0 ? e.getFullYear() - 1 : e.getFullYear(), r = (s + 4) % 4;
3036
+ return { start: t(new Date(n, r * 3, 1)), end: t(new Date(n, (r + 1) * 3, 0)) };
3037
+ }
3038
+ case "this_year":
3039
+ return { start: t(new Date(e.getFullYear(), 0, 1)), end: t(new Date(e.getFullYear(), 11, 31)) };
3040
+ case "last_year":
3041
+ return { start: t(new Date(e.getFullYear() - 1, 0, 1)), end: t(new Date(e.getFullYear() - 1, 11, 31)) };
3042
+ default:
3043
+ return { start: "", end: "" };
3044
+ }
3045
+ }, Fn = ({ value: i, picker: e, isEndDateDisabled: t, actions: s, dropdownRef: n, label: r }) => {
3046
+ const { t: a, i18n: o } = oe("common"), c = (h) => s.selectPreset(
3047
+ h,
3048
+ h === "custom" ? null : Nn(h)
3049
+ ), d = yt.flatMap((h) => h.items).find((h) => (typeof h == "string" ? h : h.id) === i.period), u = d ? a(typeof d == "string" ? `period_${d}` : d.labelKey, typeof d == "string" ? d : d.fallback) : a("period_all", "All Periods");
3050
+ return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
3051
+ /* @__PURE__ */ l.jsxs("div", { className: "list-filter-field", ref: n, children: [
3052
+ /* @__PURE__ */ l.jsx("label", { className: "list-filter-label", children: r || a("period", "Period") }),
3053
+ /* @__PURE__ */ l.jsxs("div", { className: "list-period-select-wrapper", children: [
3054
+ /* @__PURE__ */ l.jsxs("button", { type: "button", className: "list-period-select-trigger", onClick: s.toggle, children: [
3055
+ /* @__PURE__ */ l.jsx("span", { children: u }),
3056
+ /* @__PURE__ */ l.jsx(Nt, { size: 14, className: "list-period-select-icon" })
3057
+ ] }),
3058
+ e.isOpen && /* @__PURE__ */ l.jsxs("div", { className: `list-period-popup ${e.showCustom ? "has-picker" : ""}`, children: [
3059
+ /* @__PURE__ */ l.jsx("div", { className: "list-period-menu", children: yt.map((h, p) => /* @__PURE__ */ l.jsxs(Q.Fragment, { children: [
3060
+ h.labelKey && /* @__PURE__ */ l.jsx("div", { className: "list-period-group-label", children: a(h.labelKey, h.fallback) }),
3061
+ h.items.map((m) => {
3062
+ const g = typeof m == "string" ? { id: m, labelKey: `period_${m}`, fallback: m } : m;
3063
+ return /* @__PURE__ */ l.jsxs(
3064
+ "div",
3065
+ {
3066
+ role: "button",
3067
+ tabIndex: 0,
3068
+ className: `list-period-item ${i.period === g.id ? "active" : ""}`,
3069
+ onClick: () => c(g.id),
3070
+ onKeyDown: (L) => {
3071
+ (L.key === "Enter" || L.key === " ") && (L.preventDefault(), c(g.id));
3072
+ },
3073
+ children: [
3074
+ /* @__PURE__ */ l.jsx("span", { children: a(g.labelKey, g.fallback) }),
3075
+ i.period === g.id && /* @__PURE__ */ l.jsx(Yt, { size: 14, className: "list-period-check" })
3076
+ ]
3077
+ },
3078
+ g.id
3079
+ );
3080
+ })
3081
+ ] }, h.labelKey || p)) }),
3082
+ e.showCustom && /* @__PURE__ */ l.jsxs("div", { className: "list-period-picker", children: [
3083
+ /* @__PURE__ */ l.jsxs("div", { className: "list-period-calendars", children: [
3084
+ /* @__PURE__ */ l.jsx(xt, { label: a("start_date", "Start Date"), month: e.startMonth, language: o.language, selectedDate: e.tempStartDate, onPrevious: s.startPrevious, onNext: s.startNext, onSelect: s.startSelect }),
3085
+ /* @__PURE__ */ l.jsx(xt, { label: a("end_date", "End Date"), month: e.endMonth, language: o.language, selectedDate: e.tempEndDate, isDisabled: t, onPrevious: s.endPrevious, onNext: s.endNext, onSelect: s.endSelect })
3086
+ ] }),
3087
+ /* @__PURE__ */ l.jsxs("div", { className: "list-period-actions", children: [
3088
+ /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-period-cancel", onClick: s.cancel, children: a("cancel", "Cancel") }),
3089
+ /* @__PURE__ */ l.jsx("button", { type: "button", className: "list-period-apply", onClick: s.apply, children: a("apply", "Apply") })
3090
+ ] })
3091
+ ] })
3092
+ ] })
3093
+ ] })
3094
+ ] }),
3095
+ [[a("start_date", "Start Date"), i.startDate], [a("end_date", "End Date"), i.endDate]].map(([h, p]) => /* @__PURE__ */ l.jsxs("div", { className: "list-filter-field", children: [
3096
+ /* @__PURE__ */ l.jsx("label", { className: "list-filter-label", children: h }),
3097
+ /* @__PURE__ */ l.jsxs("div", { className: "list-period-date-wrapper", children: [
3098
+ /* @__PURE__ */ l.jsx("input", { type: "text", className: "list-period-date-input", placeholder: a("date_placeholder", "dd mm yyyy"), value: p, disabled: !0, readOnly: !0 }),
3099
+ /* @__PURE__ */ l.jsx(Wt, { size: 15, className: "list-period-date-icon" })
3100
+ ] })
3101
+ ] }, h))
3102
+ ] });
3103
+ }, In = (i, e = 10) => {
3104
+ const [t, s] = K(1), [n, r] = K(e), [a, o] = K(String(e)), [c, d] = K("1"), u = Math.max(1, Math.ceil(i / n)), h = Math.min(t, u), p = () => {
3105
+ const w = parseInt(a, 10);
3106
+ if (!Number.isNaN(w) && w > 0) {
3107
+ r(w), o(String(w)), s(1);
3108
+ return;
3109
+ }
3110
+ o(String(n));
3111
+ }, m = (w) => {
3112
+ const j = Math.max(1, Math.min(w, u));
3113
+ s(j), d(String(j));
3114
+ }, g = () => {
3115
+ const w = parseInt(c, 10);
3116
+ if (!Number.isNaN(w) && w >= 1 && w <= u) {
3117
+ s(w);
3118
+ return;
3119
+ }
3120
+ d(String(t));
3121
+ }, L = ee(() => {
3122
+ if (u <= 6) return Array.from({ length: u }, (j, N) => N + 1);
3123
+ const w = [1];
3124
+ h > 3 && w.push("...");
3125
+ for (let j = Math.max(2, h - 1); j <= Math.min(u - 1, h + 1); j += 1)
3126
+ w.includes(j) || w.push(j);
3127
+ return h < u - 2 && w.push("..."), w.includes(u) || w.push(u), w;
3128
+ }, [h, u]);
3129
+ return {
3130
+ currentPage: t,
3131
+ setCurrentPage: s,
3132
+ pageSize: n,
3133
+ pageSizeInput: a,
3134
+ setPageSizeInput: o,
3135
+ gotoPageInput: c,
3136
+ setGotoPageInput: d,
3137
+ totalPages: u,
3138
+ safePage: h,
3139
+ pageNumbers: L,
3140
+ handlePageSizeCommit: p,
3141
+ handlePageChange: m,
3142
+ handleGotoSubmit: g
3143
+ };
3144
+ }, jn = "xos:user-search-history", bt = "xos:user-search-history:response", Sn = 8e3, be = (i) => ({
3145
+ ...i,
3146
+ id: String(i?.id || ""),
3147
+ searchValue: String(i?.searchValue || ""),
3148
+ isPinned: !!i?.isPinned
3149
+ }), ve = (i, e, t) => [e, ...i.filter((s) => s.id !== e.id)].slice(0, t), Mn = ({ instanceId: i, source: e, pageKey: t, pageName: s, limit: n = 3 }) => {
3150
+ const [r, a] = K([]), [o, c] = K([]), d = se(/* @__PURE__ */ new Map()), u = se(0);
3151
+ ie(() => {
3152
+ const N = d.current, C = (b) => {
3153
+ const { requestId: v, data: k, error: E } = b.detail || {}, T = N.get(v);
3154
+ T && (clearTimeout(T.timeout), N.delete(v), E ? T.reject(new Error(E)) : T.resolve(k));
3155
+ };
3156
+ return window.addEventListener(bt, C), () => {
3157
+ window.removeEventListener(bt, C), N.forEach(({ timeout: b, reject: v }) => {
3158
+ clearTimeout(b), v(new Error("Search history request cancelled."));
3159
+ }), N.clear();
3160
+ };
3161
+ }, []);
3162
+ const h = G((N, C = {}) => new Promise((b, v) => {
3163
+ if (!i) {
3164
+ v(new Error("Search history instance is unavailable."));
3165
+ return;
3166
+ }
3167
+ const k = `search-history-${Date.now()}-${++u.current}`, E = setTimeout(() => {
3168
+ d.current.delete(k), v(new Error("Search history request timed out."));
3169
+ }, Sn);
3170
+ d.current.set(k, { resolve: b, reject: v, timeout: E }), window.dispatchEvent(new CustomEvent(jn, {
3171
+ detail: { requestId: k, source: e, instanceId: i, action: N, payload: C }
3172
+ }));
3173
+ }), [i, e]), p = G((N) => {
3174
+ const C = (N?.pinned || []).map(be).filter((k) => k.id && k.searchValue).slice(0, n), b = new Set(C.map((k) => k.id)), v = (N?.recent || []).map(be).filter((k) => k.id && k.searchValue && !k.isPinned && !b.has(k.id)).slice(0, n);
3175
+ a(C), c(v);
3176
+ }, [n]), m = G(async () => {
3177
+ try {
3178
+ const N = await h("list", { pageKey: t, limit: n });
3179
+ return p(N), N;
3180
+ } catch {
3181
+ return null;
3182
+ }
3183
+ }, [p, n, t, h]);
3184
+ ie(() => {
3185
+ const N = window.setTimeout(() => {
3186
+ m();
3187
+ }, 0);
3188
+ return () => window.clearTimeout(N);
3189
+ }, [m]);
3190
+ const g = G(async (N) => {
3191
+ const C = String(N || "").trim();
3192
+ if (!C) return null;
3193
+ try {
3194
+ const b = be(await h("record-search", { pageKey: t, pageName: s, searchValue: C, pageData: {} }));
3195
+ return b.isPinned ? (a((v) => ve(v, b, n)), c((v) => v.filter((k) => k.id !== b.id))) : c((v) => ve(v, b, n)), b;
3196
+ } catch {
3197
+ return null;
3198
+ }
3199
+ }, [n, t, s, h]), L = G(async (N, C) => {
3200
+ if (!N?.id) return null;
3201
+ try {
3202
+ const b = be(await h("set-pin-status", { id: N.id, isPinned: C }));
3203
+ return b.isPinned ? (a((v) => ve(v, b, n)), c((v) => v.filter((k) => k.id !== b.id))) : (a((v) => v.filter((k) => k.id !== b.id)), c((v) => ve(v, b, n))), b;
3204
+ } catch {
3205
+ return null;
3206
+ }
3207
+ }, [n, h]), w = G(async (N) => {
3208
+ if (!N?.id) return !1;
3209
+ try {
3210
+ return await h("delete-search", { id: N.id }), a((C) => C.filter((b) => b.id !== N.id)), c((C) => C.filter((b) => b.id !== N.id)), !0;
3211
+ } catch {
3212
+ return !1;
3213
+ }
3214
+ }, [h]), j = G(async () => {
3215
+ try {
3216
+ return await h("clear-recent-searches", { pageKey: t }), c([]), !0;
3217
+ } catch {
3218
+ return !1;
3219
+ }
3220
+ }, [t, h]);
3221
+ return { pinnedItems: r, recentItems: o, load: m, save: g, setPinned: L, remove: w, clearRecent: j };
3222
+ };
3223
+ export {
3224
+ _n as FilterDropdownSelect,
3225
+ Cn as ListCloseConfirmation,
3226
+ Ln as ListFilterCard,
3227
+ On as ListFilterField,
3228
+ En as ListPageLayout,
3229
+ Rn as ListPagination,
3230
+ Pn as ListPreviewCard,
3231
+ $n as ListSearchBar,
3232
+ Tn as ListSelectionBanner,
3233
+ An as ListTable,
3234
+ Dn as ListTopBar,
3235
+ Fn as PeriodDateFilter,
3236
+ vn as cellToYmd,
3237
+ xn as toYmd,
3238
+ In as useListPagination,
3239
+ Mn as useUserSearchHistory
3240
+ };