@tooinfinity/lingua-react 1.0.0 → 1.1.0

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.
@@ -1,24 +1,1031 @@
1
- import { usePage as i } from "@inertiajs/react";
2
- function u() {
3
- const { props: s } = i(), e = s.lingua;
1
+ import { usePage as Er, router as _r } from "@inertiajs/react";
2
+ import * as L from "react";
3
+ import We, { forwardRef as Ye, createElement as le } from "react";
4
+ function xr() {
5
+ const { props: l } = Er(), n = l.lingua;
4
6
  return {
5
- __: (r, n) => {
6
- const c = r.split(".");
7
- let t = e == null ? void 0 : e.translations;
8
- for (const o of c) {
9
- if (t == null) break;
10
- t = t[o];
11
- }
12
- return typeof t != "string" ? r : n ? Object.entries(n).reduce(
13
- (o, [l, f]) => o.replace(new RegExp(`:${l}`, "g"), String(f)),
14
- t
15
- ) : t;
7
+ __: (d, T) => {
8
+ const p = d.split(".");
9
+ let h = n == null ? void 0 : n.translations;
10
+ for (const v of p) {
11
+ if (h == null) break;
12
+ h = h[v];
13
+ }
14
+ return typeof h != "string" ? d : T ? Object.entries(T).reduce(
15
+ (v, [u, x]) => v.replace(new RegExp(`:${u}`, "g"), String(x)),
16
+ h
17
+ ) : h;
16
18
  },
17
- locale: (e == null ? void 0 : e.locale) ?? "en",
18
- locales: (e == null ? void 0 : e.locales) ?? ["en"]
19
+ locale: (n == null ? void 0 : n.locale) ?? "en",
20
+ locales: (n == null ? void 0 : n.locales) ?? ["en"]
19
21
  };
20
22
  }
23
+ var Z = { exports: {} }, V = {};
24
+ /**
25
+ * @license React
26
+ * react-jsx-runtime.production.min.js
27
+ *
28
+ * Copyright (c) Facebook, Inc. and its affiliates.
29
+ *
30
+ * This source code is licensed under the MIT license found in the
31
+ * LICENSE file in the root directory of this source tree.
32
+ */
33
+ var Fe;
34
+ function Rr() {
35
+ if (Fe) return V;
36
+ Fe = 1;
37
+ var l = We, n = Symbol.for("react.element"), g = Symbol.for("react.fragment"), d = Object.prototype.hasOwnProperty, T = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: !0, ref: !0, __self: !0, __source: !0 };
38
+ function h(v, u, x) {
39
+ var m, k = {}, O = null, N = null;
40
+ x !== void 0 && (O = "" + x), u.key !== void 0 && (O = "" + u.key), u.ref !== void 0 && (N = u.ref);
41
+ for (m in u) d.call(u, m) && !p.hasOwnProperty(m) && (k[m] = u[m]);
42
+ if (v && v.defaultProps) for (m in u = v.defaultProps, u) k[m] === void 0 && (k[m] = u[m]);
43
+ return { $$typeof: n, type: v, key: O, ref: N, props: k, _owner: T.current };
44
+ }
45
+ return V.Fragment = g, V.jsx = h, V.jsxs = h, V;
46
+ }
47
+ var B = {};
48
+ /**
49
+ * @license React
50
+ * react-jsx-runtime.development.js
51
+ *
52
+ * Copyright (c) Facebook, Inc. and its affiliates.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE file in the root directory of this source tree.
56
+ */
57
+ var Ie;
58
+ function kr() {
59
+ return Ie || (Ie = 1, process.env.NODE_ENV !== "production" && (function() {
60
+ var l = We, n = Symbol.for("react.element"), g = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), T = Symbol.for("react.strict_mode"), p = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), v = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), x = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), k = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), N = Symbol.for("react.offscreen"), s = Symbol.iterator, w = "@@iterator";
61
+ function D(e) {
62
+ if (e === null || typeof e != "object")
63
+ return null;
64
+ var r = s && e[s] || e[w];
65
+ return typeof r == "function" ? r : null;
66
+ }
67
+ var C = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
68
+ function E(e) {
69
+ {
70
+ for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++)
71
+ t[a - 1] = arguments[a];
72
+ q("error", e, t);
73
+ }
74
+ }
75
+ function q(e, r, t) {
76
+ {
77
+ var a = C.ReactDebugCurrentFrame, c = a.getStackAddendum();
78
+ c !== "" && (r += "%s", t = t.concat([c]));
79
+ var f = t.map(function(i) {
80
+ return String(i);
81
+ });
82
+ f.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, f);
83
+ }
84
+ }
85
+ var J = !1, $ = !1, P = !1, Ve = !1, Be = !1, ce;
86
+ ce = Symbol.for("react.module.reference");
87
+ function Ke(e) {
88
+ return !!(typeof e == "string" || typeof e == "function" || e === d || e === p || Be || e === T || e === x || e === m || Ve || e === N || J || $ || P || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === k || e.$$typeof === h || e.$$typeof === v || e.$$typeof === u || // This needs to include all possible module reference object
89
+ // types supported by any Flight configuration anywhere since
90
+ // we don't know which Flight build this will end up being used
91
+ // with.
92
+ e.$$typeof === ce || e.getModuleId !== void 0));
93
+ }
94
+ function qe(e, r, t) {
95
+ var a = e.displayName;
96
+ if (a)
97
+ return a;
98
+ var c = r.displayName || r.name || "";
99
+ return c !== "" ? t + "(" + c + ")" : t;
100
+ }
101
+ function fe(e) {
102
+ return e.displayName || "Context";
103
+ }
104
+ function A(e) {
105
+ if (e == null)
106
+ return null;
107
+ if (typeof e.tag == "number" && E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
108
+ return e.displayName || e.name || null;
109
+ if (typeof e == "string")
110
+ return e;
111
+ switch (e) {
112
+ case d:
113
+ return "Fragment";
114
+ case g:
115
+ return "Portal";
116
+ case p:
117
+ return "Profiler";
118
+ case T:
119
+ return "StrictMode";
120
+ case x:
121
+ return "Suspense";
122
+ case m:
123
+ return "SuspenseList";
124
+ }
125
+ if (typeof e == "object")
126
+ switch (e.$$typeof) {
127
+ case v:
128
+ var r = e;
129
+ return fe(r) + ".Consumer";
130
+ case h:
131
+ var t = e;
132
+ return fe(t._context) + ".Provider";
133
+ case u:
134
+ return qe(e, e.render, "ForwardRef");
135
+ case k:
136
+ var a = e.displayName || null;
137
+ return a !== null ? a : A(e.type) || "Memo";
138
+ case O: {
139
+ var c = e, f = c._payload, i = c._init;
140
+ try {
141
+ return A(i(f));
142
+ } catch {
143
+ return null;
144
+ }
145
+ }
146
+ }
147
+ return null;
148
+ }
149
+ var F = Object.assign, M = 0, de, ve, pe, ge, he, be, me;
150
+ function ye() {
151
+ }
152
+ ye.__reactDisabledLog = !0;
153
+ function Je() {
154
+ {
155
+ if (M === 0) {
156
+ de = console.log, ve = console.info, pe = console.warn, ge = console.error, he = console.group, be = console.groupCollapsed, me = console.groupEnd;
157
+ var e = {
158
+ configurable: !0,
159
+ enumerable: !0,
160
+ value: ye,
161
+ writable: !0
162
+ };
163
+ Object.defineProperties(console, {
164
+ info: e,
165
+ log: e,
166
+ warn: e,
167
+ error: e,
168
+ group: e,
169
+ groupCollapsed: e,
170
+ groupEnd: e
171
+ });
172
+ }
173
+ M++;
174
+ }
175
+ }
176
+ function ze() {
177
+ {
178
+ if (M--, M === 0) {
179
+ var e = {
180
+ configurable: !0,
181
+ enumerable: !0,
182
+ writable: !0
183
+ };
184
+ Object.defineProperties(console, {
185
+ log: F({}, e, {
186
+ value: de
187
+ }),
188
+ info: F({}, e, {
189
+ value: ve
190
+ }),
191
+ warn: F({}, e, {
192
+ value: pe
193
+ }),
194
+ error: F({}, e, {
195
+ value: ge
196
+ }),
197
+ group: F({}, e, {
198
+ value: he
199
+ }),
200
+ groupCollapsed: F({}, e, {
201
+ value: be
202
+ }),
203
+ groupEnd: F({}, e, {
204
+ value: me
205
+ })
206
+ });
207
+ }
208
+ M < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
209
+ }
210
+ }
211
+ var Q = C.ReactCurrentDispatcher, ee;
212
+ function z(e, r, t) {
213
+ {
214
+ if (ee === void 0)
215
+ try {
216
+ throw Error();
217
+ } catch (c) {
218
+ var a = c.stack.trim().match(/\n( *(at )?)/);
219
+ ee = a && a[1] || "";
220
+ }
221
+ return `
222
+ ` + ee + e;
223
+ }
224
+ }
225
+ var re = !1, G;
226
+ {
227
+ var Ge = typeof WeakMap == "function" ? WeakMap : Map;
228
+ G = new Ge();
229
+ }
230
+ function Ee(e, r) {
231
+ if (!e || re)
232
+ return "";
233
+ {
234
+ var t = G.get(e);
235
+ if (t !== void 0)
236
+ return t;
237
+ }
238
+ var a;
239
+ re = !0;
240
+ var c = Error.prepareStackTrace;
241
+ Error.prepareStackTrace = void 0;
242
+ var f;
243
+ f = Q.current, Q.current = null, Je();
244
+ try {
245
+ if (r) {
246
+ var i = function() {
247
+ throw Error();
248
+ };
249
+ if (Object.defineProperty(i.prototype, "props", {
250
+ set: function() {
251
+ throw Error();
252
+ }
253
+ }), typeof Reflect == "object" && Reflect.construct) {
254
+ try {
255
+ Reflect.construct(i, []);
256
+ } catch (j) {
257
+ a = j;
258
+ }
259
+ Reflect.construct(e, [], i);
260
+ } else {
261
+ try {
262
+ i.call();
263
+ } catch (j) {
264
+ a = j;
265
+ }
266
+ e.call(i.prototype);
267
+ }
268
+ } else {
269
+ try {
270
+ throw Error();
271
+ } catch (j) {
272
+ a = j;
273
+ }
274
+ e();
275
+ }
276
+ } catch (j) {
277
+ if (j && a && typeof j.stack == "string") {
278
+ for (var o = j.stack.split(`
279
+ `), R = a.stack.split(`
280
+ `), b = o.length - 1, y = R.length - 1; b >= 1 && y >= 0 && o[b] !== R[y]; )
281
+ y--;
282
+ for (; b >= 1 && y >= 0; b--, y--)
283
+ if (o[b] !== R[y]) {
284
+ if (b !== 1 || y !== 1)
285
+ do
286
+ if (b--, y--, y < 0 || o[b] !== R[y]) {
287
+ var S = `
288
+ ` + o[b].replace(" at new ", " at ");
289
+ return e.displayName && S.includes("<anonymous>") && (S = S.replace("<anonymous>", e.displayName)), typeof e == "function" && G.set(e, S), S;
290
+ }
291
+ while (b >= 1 && y >= 0);
292
+ break;
293
+ }
294
+ }
295
+ } finally {
296
+ re = !1, Q.current = f, ze(), Error.prepareStackTrace = c;
297
+ }
298
+ var Y = e ? e.displayName || e.name : "", I = Y ? z(Y) : "";
299
+ return typeof e == "function" && G.set(e, I), I;
300
+ }
301
+ function Xe(e, r, t) {
302
+ return Ee(e, !1);
303
+ }
304
+ function He(e) {
305
+ var r = e.prototype;
306
+ return !!(r && r.isReactComponent);
307
+ }
308
+ function X(e, r, t) {
309
+ if (e == null)
310
+ return "";
311
+ if (typeof e == "function")
312
+ return Ee(e, He(e));
313
+ if (typeof e == "string")
314
+ return z(e);
315
+ switch (e) {
316
+ case x:
317
+ return z("Suspense");
318
+ case m:
319
+ return z("SuspenseList");
320
+ }
321
+ if (typeof e == "object")
322
+ switch (e.$$typeof) {
323
+ case u:
324
+ return Xe(e.render);
325
+ case k:
326
+ return X(e.type, r, t);
327
+ case O: {
328
+ var a = e, c = a._payload, f = a._init;
329
+ try {
330
+ return X(f(c), r, t);
331
+ } catch {
332
+ }
333
+ }
334
+ }
335
+ return "";
336
+ }
337
+ var U = Object.prototype.hasOwnProperty, _e = {}, xe = C.ReactDebugCurrentFrame;
338
+ function H(e) {
339
+ if (e) {
340
+ var r = e._owner, t = X(e.type, e._source, r ? r.type : null);
341
+ xe.setExtraStackFrame(t);
342
+ } else
343
+ xe.setExtraStackFrame(null);
344
+ }
345
+ function Ze(e, r, t, a, c) {
346
+ {
347
+ var f = Function.call.bind(U);
348
+ for (var i in e)
349
+ if (f(e, i)) {
350
+ var o = void 0;
351
+ try {
352
+ if (typeof e[i] != "function") {
353
+ var R = Error((a || "React class") + ": " + t + " type `" + i + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[i] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
354
+ throw R.name = "Invariant Violation", R;
355
+ }
356
+ o = e[i](r, i, a, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
357
+ } catch (b) {
358
+ o = b;
359
+ }
360
+ o && !(o instanceof Error) && (H(c), E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", a || "React class", t, i, typeof o), H(null)), o instanceof Error && !(o.message in _e) && (_e[o.message] = !0, H(c), E("Failed %s type: %s", t, o.message), H(null));
361
+ }
362
+ }
363
+ }
364
+ var Qe = Array.isArray;
365
+ function te(e) {
366
+ return Qe(e);
367
+ }
368
+ function er(e) {
369
+ {
370
+ var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
371
+ return t;
372
+ }
373
+ }
374
+ function rr(e) {
375
+ try {
376
+ return Re(e), !1;
377
+ } catch {
378
+ return !0;
379
+ }
380
+ }
381
+ function Re(e) {
382
+ return "" + e;
383
+ }
384
+ function ke(e) {
385
+ if (rr(e))
386
+ return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", er(e)), Re(e);
387
+ }
388
+ var we = C.ReactCurrentOwner, tr = {
389
+ key: !0,
390
+ ref: !0,
391
+ __self: !0,
392
+ __source: !0
393
+ }, je, Te;
394
+ function ar(e) {
395
+ if (U.call(e, "ref")) {
396
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
397
+ if (r && r.isReactWarning)
398
+ return !1;
399
+ }
400
+ return e.ref !== void 0;
401
+ }
402
+ function nr(e) {
403
+ if (U.call(e, "key")) {
404
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
405
+ if (r && r.isReactWarning)
406
+ return !1;
407
+ }
408
+ return e.key !== void 0;
409
+ }
410
+ function or(e, r) {
411
+ typeof e.ref == "string" && we.current;
412
+ }
413
+ function ir(e, r) {
414
+ {
415
+ var t = function() {
416
+ je || (je = !0, E("%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://reactjs.org/link/special-props)", r));
417
+ };
418
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
419
+ get: t,
420
+ configurable: !0
421
+ });
422
+ }
423
+ }
424
+ function sr(e, r) {
425
+ {
426
+ var t = function() {
427
+ Te || (Te = !0, E("%s: `ref` 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://reactjs.org/link/special-props)", r));
428
+ };
429
+ t.isReactWarning = !0, Object.defineProperty(e, "ref", {
430
+ get: t,
431
+ configurable: !0
432
+ });
433
+ }
434
+ }
435
+ var lr = function(e, r, t, a, c, f, i) {
436
+ var o = {
437
+ // This tag allows us to uniquely identify this as a React Element
438
+ $$typeof: n,
439
+ // Built-in properties that belong on the element
440
+ type: e,
441
+ key: r,
442
+ ref: t,
443
+ props: i,
444
+ // Record the component responsible for creating this element.
445
+ _owner: f
446
+ };
447
+ return o._store = {}, Object.defineProperty(o._store, "validated", {
448
+ configurable: !1,
449
+ enumerable: !1,
450
+ writable: !0,
451
+ value: !1
452
+ }), Object.defineProperty(o, "_self", {
453
+ configurable: !1,
454
+ enumerable: !1,
455
+ writable: !1,
456
+ value: a
457
+ }), Object.defineProperty(o, "_source", {
458
+ configurable: !1,
459
+ enumerable: !1,
460
+ writable: !1,
461
+ value: c
462
+ }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
463
+ };
464
+ function ur(e, r, t, a, c) {
465
+ {
466
+ var f, i = {}, o = null, R = null;
467
+ t !== void 0 && (ke(t), o = "" + t), nr(r) && (ke(r.key), o = "" + r.key), ar(r) && (R = r.ref, or(r, c));
468
+ for (f in r)
469
+ U.call(r, f) && !tr.hasOwnProperty(f) && (i[f] = r[f]);
470
+ if (e && e.defaultProps) {
471
+ var b = e.defaultProps;
472
+ for (f in b)
473
+ i[f] === void 0 && (i[f] = b[f]);
474
+ }
475
+ if (o || R) {
476
+ var y = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
477
+ o && ir(i, y), R && sr(i, y);
478
+ }
479
+ return lr(e, o, R, c, a, we.current, i);
480
+ }
481
+ }
482
+ var ae = C.ReactCurrentOwner, Se = C.ReactDebugCurrentFrame;
483
+ function W(e) {
484
+ if (e) {
485
+ var r = e._owner, t = X(e.type, e._source, r ? r.type : null);
486
+ Se.setExtraStackFrame(t);
487
+ } else
488
+ Se.setExtraStackFrame(null);
489
+ }
490
+ var ne;
491
+ ne = !1;
492
+ function oe(e) {
493
+ return typeof e == "object" && e !== null && e.$$typeof === n;
494
+ }
495
+ function Ce() {
496
+ {
497
+ if (ae.current) {
498
+ var e = A(ae.current.type);
499
+ if (e)
500
+ return `
501
+
502
+ Check the render method of \`` + e + "`.";
503
+ }
504
+ return "";
505
+ }
506
+ }
507
+ function cr(e) {
508
+ return "";
509
+ }
510
+ var Oe = {};
511
+ function fr(e) {
512
+ {
513
+ var r = Ce();
514
+ if (!r) {
515
+ var t = typeof e == "string" ? e : e.displayName || e.name;
516
+ t && (r = `
517
+
518
+ Check the top-level render call using <` + t + ">.");
519
+ }
520
+ return r;
521
+ }
522
+ }
523
+ function Pe(e, r) {
524
+ {
525
+ if (!e._store || e._store.validated || e.key != null)
526
+ return;
527
+ e._store.validated = !0;
528
+ var t = fr(r);
529
+ if (Oe[t])
530
+ return;
531
+ Oe[t] = !0;
532
+ var a = "";
533
+ e && e._owner && e._owner !== ae.current && (a = " It was passed a child from " + A(e._owner.type) + "."), W(e), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, a), W(null);
534
+ }
535
+ }
536
+ function De(e, r) {
537
+ {
538
+ if (typeof e != "object")
539
+ return;
540
+ if (te(e))
541
+ for (var t = 0; t < e.length; t++) {
542
+ var a = e[t];
543
+ oe(a) && Pe(a, r);
544
+ }
545
+ else if (oe(e))
546
+ e._store && (e._store.validated = !0);
547
+ else if (e) {
548
+ var c = D(e);
549
+ if (typeof c == "function" && c !== e.entries)
550
+ for (var f = c.call(e), i; !(i = f.next()).done; )
551
+ oe(i.value) && Pe(i.value, r);
552
+ }
553
+ }
554
+ }
555
+ function dr(e) {
556
+ {
557
+ var r = e.type;
558
+ if (r == null || typeof r == "string")
559
+ return;
560
+ var t;
561
+ if (typeof r == "function")
562
+ t = r.propTypes;
563
+ else if (typeof r == "object" && (r.$$typeof === u || // Note: Memo only checks outer props here.
564
+ // Inner props are checked in the reconciler.
565
+ r.$$typeof === k))
566
+ t = r.propTypes;
567
+ else
568
+ return;
569
+ if (t) {
570
+ var a = A(r);
571
+ Ze(t, e.props, "prop", a, e);
572
+ } else if (r.PropTypes !== void 0 && !ne) {
573
+ ne = !0;
574
+ var c = A(r);
575
+ E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", c || "Unknown");
576
+ }
577
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
578
+ }
579
+ }
580
+ function vr(e) {
581
+ {
582
+ for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
583
+ var a = r[t];
584
+ if (a !== "children" && a !== "key") {
585
+ W(e), E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", a), W(null);
586
+ break;
587
+ }
588
+ }
589
+ e.ref !== null && (W(e), E("Invalid attribute `ref` supplied to `React.Fragment`."), W(null));
590
+ }
591
+ }
592
+ var Ae = {};
593
+ function $e(e, r, t, a, c, f) {
594
+ {
595
+ var i = Ke(e);
596
+ if (!i) {
597
+ var o = "";
598
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (o += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
599
+ var R = cr();
600
+ R ? o += R : o += Ce();
601
+ var b;
602
+ e === null ? b = "null" : te(e) ? b = "array" : e !== void 0 && e.$$typeof === n ? (b = "<" + (A(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : b = typeof e, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", b, o);
603
+ }
604
+ var y = ur(e, r, t, c, f);
605
+ if (y == null)
606
+ return y;
607
+ if (i) {
608
+ var S = r.children;
609
+ if (S !== void 0)
610
+ if (a)
611
+ if (te(S)) {
612
+ for (var Y = 0; Y < S.length; Y++)
613
+ De(S[Y], e);
614
+ Object.freeze && Object.freeze(S);
615
+ } else
616
+ E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
617
+ else
618
+ De(S, e);
619
+ }
620
+ if (U.call(r, "key")) {
621
+ var I = A(e), j = Object.keys(r).filter(function(yr) {
622
+ return yr !== "key";
623
+ }), ie = j.length > 0 ? "{key: someKey, " + j.join(": ..., ") + ": ...}" : "{key: someKey}";
624
+ if (!Ae[I + ie]) {
625
+ var mr = j.length > 0 ? "{" + j.join(": ..., ") + ": ...}" : "{}";
626
+ E(`A props object containing a "key" prop is being spread into JSX:
627
+ let props = %s;
628
+ <%s {...props} />
629
+ React keys must be passed directly to JSX without using spread:
630
+ let props = %s;
631
+ <%s key={someKey} {...props} />`, ie, I, mr, I), Ae[I + ie] = !0;
632
+ }
633
+ }
634
+ return e === d ? vr(y) : dr(y), y;
635
+ }
636
+ }
637
+ function pr(e, r, t) {
638
+ return $e(e, r, t, !0);
639
+ }
640
+ function gr(e, r, t) {
641
+ return $e(e, r, t, !1);
642
+ }
643
+ var hr = gr, br = pr;
644
+ B.Fragment = d, B.jsx = hr, B.jsxs = br;
645
+ })()), B;
646
+ }
647
+ var Le;
648
+ function wr() {
649
+ return Le || (Le = 1, process.env.NODE_ENV === "production" ? Z.exports = Rr() : Z.exports = kr()), Z.exports;
650
+ }
651
+ var _ = wr();
652
+ /**
653
+ * @license lucide-react v0.511.0 - ISC
654
+ *
655
+ * This source code is licensed under the ISC license.
656
+ * See the LICENSE file in the root directory of this source tree.
657
+ */
658
+ const jr = (l) => l.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Tr = (l) => l.replace(
659
+ /^([A-Z])|[\s-_]+(\w)/g,
660
+ (n, g, d) => d ? d.toUpperCase() : g.toLowerCase()
661
+ ), Ne = (l) => {
662
+ const n = Tr(l);
663
+ return n.charAt(0).toUpperCase() + n.slice(1);
664
+ }, Me = (...l) => l.filter((n, g, d) => !!n && n.trim() !== "" && d.indexOf(n) === g).join(" ").trim(), Sr = (l) => {
665
+ for (const n in l)
666
+ if (n.startsWith("aria-") || n === "role" || n === "title")
667
+ return !0;
668
+ };
669
+ /**
670
+ * @license lucide-react v0.511.0 - ISC
671
+ *
672
+ * This source code is licensed under the ISC license.
673
+ * See the LICENSE file in the root directory of this source tree.
674
+ */
675
+ var Cr = {
676
+ xmlns: "http://www.w3.org/2000/svg",
677
+ width: 24,
678
+ height: 24,
679
+ viewBox: "0 0 24 24",
680
+ fill: "none",
681
+ stroke: "currentColor",
682
+ strokeWidth: 2,
683
+ strokeLinecap: "round",
684
+ strokeLinejoin: "round"
685
+ };
686
+ /**
687
+ * @license lucide-react v0.511.0 - ISC
688
+ *
689
+ * This source code is licensed under the ISC license.
690
+ * See the LICENSE file in the root directory of this source tree.
691
+ */
692
+ const Or = Ye(
693
+ ({
694
+ color: l = "currentColor",
695
+ size: n = 24,
696
+ strokeWidth: g = 2,
697
+ absoluteStrokeWidth: d,
698
+ className: T = "",
699
+ children: p,
700
+ iconNode: h,
701
+ ...v
702
+ }, u) => le(
703
+ "svg",
704
+ {
705
+ ref: u,
706
+ ...Cr,
707
+ width: n,
708
+ height: n,
709
+ stroke: l,
710
+ strokeWidth: d ? Number(g) * 24 / Number(n) : g,
711
+ className: Me("lucide", T),
712
+ ...!p && !Sr(v) && { "aria-hidden": "true" },
713
+ ...v
714
+ },
715
+ [
716
+ ...h.map(([x, m]) => le(x, m)),
717
+ ...Array.isArray(p) ? p : [p]
718
+ ]
719
+ )
720
+ );
721
+ /**
722
+ * @license lucide-react v0.511.0 - ISC
723
+ *
724
+ * This source code is licensed under the ISC license.
725
+ * See the LICENSE file in the root directory of this source tree.
726
+ */
727
+ const ue = (l, n) => {
728
+ const g = Ye(
729
+ ({ className: d, ...T }, p) => le(Or, {
730
+ ref: p,
731
+ iconNode: n,
732
+ className: Me(
733
+ `lucide-${jr(Ne(l))}`,
734
+ `lucide-${l}`,
735
+ d
736
+ ),
737
+ ...T
738
+ })
739
+ );
740
+ return g.displayName = Ne(l), g;
741
+ };
742
+ /**
743
+ * @license lucide-react v0.511.0 - ISC
744
+ *
745
+ * This source code is licensed under the ISC license.
746
+ * See the LICENSE file in the root directory of this source tree.
747
+ */
748
+ const Pr = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], Dr = ue("check", Pr);
749
+ /**
750
+ * @license lucide-react v0.511.0 - ISC
751
+ *
752
+ * This source code is licensed under the ISC license.
753
+ * See the LICENSE file in the root directory of this source tree.
754
+ */
755
+ const Ar = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], $r = ue("chevron-down", Ar);
756
+ /**
757
+ * @license lucide-react v0.511.0 - ISC
758
+ *
759
+ * This source code is licensed under the ISC license.
760
+ * See the LICENSE file in the root directory of this source tree.
761
+ */
762
+ const Fr = [
763
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
764
+ ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
765
+ ["path", { d: "M2 12h20", key: "9i4pu4" }]
766
+ ], Ir = ue("globe", Fr), Ue = {
767
+ en: { name: "English", flag: "🇺🇸" },
768
+ es: { name: "Español", flag: "🇪🇸" },
769
+ fr: { name: "Français", flag: "🇫🇷" },
770
+ de: { name: "Deutsch", flag: "🇩🇪" },
771
+ it: { name: "Italiano", flag: "🇮🇹" },
772
+ pt: { name: "Português", flag: "🇵🇹" },
773
+ nl: { name: "Nederlands", flag: "🇳🇱" },
774
+ pl: { name: "Polski", flag: "🇵🇱" },
775
+ ru: { name: "Русский", flag: "🇷🇺" },
776
+ ja: { name: "日本語", flag: "🇯🇵" },
777
+ zh: { name: "中文", flag: "🇨🇳" },
778
+ ko: { name: "한국어", flag: "🇰🇷" },
779
+ ar: { name: "العربية", flag: "🇸🇦" },
780
+ hi: { name: "हिन्दी", flag: "🇮🇳" },
781
+ tr: { name: "Türkçe", flag: "🇹🇷" },
782
+ vi: { name: "Tiếng Việt", flag: "🇻🇳" },
783
+ th: { name: "ไทย", flag: "🇹🇭" },
784
+ sv: { name: "Svenska", flag: "🇸🇪" },
785
+ da: { name: "Dansk", flag: "🇩🇰" },
786
+ fi: { name: "Suomi", flag: "🇫🇮" },
787
+ no: { name: "Norsk", flag: "🇳🇴" },
788
+ cs: { name: "Čeština", flag: "🇨🇿" },
789
+ uk: { name: "Українська", flag: "🇺🇦" },
790
+ el: { name: "Ελληνικά", flag: "🇬🇷" },
791
+ he: { name: "עברית", flag: "🇮🇱" },
792
+ id: { name: "Bahasa Indonesia", flag: "🇮🇩" },
793
+ ms: { name: "Bahasa Melayu", flag: "🇲🇾" },
794
+ ro: { name: "Română", flag: "🇷🇴" },
795
+ hu: { name: "Magyar", flag: "🇭🇺" },
796
+ bg: { name: "Български", flag: "🇧🇬" }
797
+ };
798
+ function K(l, n) {
799
+ var g;
800
+ return n != null && n[l] ? n[l] : ((g = Ue[l]) == null ? void 0 : g.name) ?? l.toUpperCase();
801
+ }
802
+ function se(l) {
803
+ var n;
804
+ return ((n = Ue[l]) == null ? void 0 : n.flag) ?? "🌐";
805
+ }
806
+ function Wr({
807
+ endpoint: l = "/locale",
808
+ className: n = "",
809
+ showFlag: g = !1,
810
+ localeNames: d,
811
+ variant: T = "dropdown"
812
+ }) {
813
+ const { locale: p, locales: h } = xr(), [v, u] = L.useState(!1), x = L.useRef(null), m = L.useRef(null), k = L.useCallback(
814
+ (s) => {
815
+ if (s === p) {
816
+ u(!1);
817
+ return;
818
+ }
819
+ _r.post(
820
+ l,
821
+ { locale: s },
822
+ {
823
+ preserveState: !0,
824
+ preserveScroll: !0,
825
+ onSuccess: () => {
826
+ u(!1);
827
+ }
828
+ }
829
+ );
830
+ },
831
+ [p, l]
832
+ );
833
+ L.useEffect(() => {
834
+ function s(w) {
835
+ x.current && !x.current.contains(w.target) && u(!1);
836
+ }
837
+ if (v)
838
+ return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
839
+ }, [v]);
840
+ const O = L.useCallback(
841
+ (s) => {
842
+ var w;
843
+ switch (s.key) {
844
+ case "Escape":
845
+ u(!1), (w = m.current) == null || w.focus();
846
+ break;
847
+ case "ArrowDown":
848
+ s.preventDefault(), v || u(!0);
849
+ break;
850
+ case "ArrowUp":
851
+ s.preventDefault();
852
+ break;
853
+ case "Enter":
854
+ case " ":
855
+ v || (s.preventDefault(), u(!0));
856
+ break;
857
+ }
858
+ },
859
+ [v]
860
+ ), N = L.useCallback(
861
+ (s, w, D) => {
862
+ var C, E, q, J;
863
+ switch (s.key) {
864
+ case "Enter":
865
+ case " ":
866
+ s.preventDefault(), k(w);
867
+ break;
868
+ case "ArrowDown":
869
+ s.preventDefault();
870
+ {
871
+ const $ = D + 1;
872
+ if ($ < h.length) {
873
+ const P = (C = x.current) == null ? void 0 : C.querySelector(
874
+ `[data-locale-index="${$}"]`
875
+ );
876
+ P == null || P.focus();
877
+ }
878
+ }
879
+ break;
880
+ case "ArrowUp":
881
+ s.preventDefault();
882
+ {
883
+ const $ = D - 1;
884
+ if ($ >= 0) {
885
+ const P = (E = x.current) == null ? void 0 : E.querySelector(
886
+ `[data-locale-index="${$}"]`
887
+ );
888
+ P == null || P.focus();
889
+ } else
890
+ (q = m.current) == null || q.focus(), u(!1);
891
+ }
892
+ break;
893
+ case "Escape":
894
+ u(!1), (J = m.current) == null || J.focus();
895
+ break;
896
+ case "Tab":
897
+ u(!1);
898
+ break;
899
+ }
900
+ },
901
+ [k, h.length]
902
+ );
903
+ return h.length <= 1 ? null : T === "buttons" ? /* @__PURE__ */ _.jsx(
904
+ "div",
905
+ {
906
+ className: `inline-flex items-center gap-1 rounded-lg border border-slate-200 bg-white p-1 dark:border-slate-700 dark:bg-slate-800 ${n}`,
907
+ role: "group",
908
+ "aria-label": "Language selection",
909
+ children: h.map((s) => {
910
+ const w = s === p;
911
+ return /* @__PURE__ */ _.jsxs(
912
+ "button",
913
+ {
914
+ type: "button",
915
+ onClick: () => k(s),
916
+ className: `
917
+ inline-flex items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium
918
+ transition-all duration-150
919
+ focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2
920
+ dark:focus:ring-slate-500 dark:focus:ring-offset-slate-800
921
+ ${w ? "bg-slate-900 text-white shadow-sm dark:bg-slate-100 dark:text-slate-900" : "text-slate-600 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-700 dark:hover:text-slate-100"}
922
+ `,
923
+ "aria-pressed": w,
924
+ "aria-label": `Switch to ${K(s, d)}`,
925
+ children: [
926
+ g && /* @__PURE__ */ _.jsx("span", { className: "text-base", "aria-hidden": "true", children: se(s) }),
927
+ /* @__PURE__ */ _.jsx("span", { children: K(s, d) })
928
+ ]
929
+ },
930
+ s
931
+ );
932
+ })
933
+ }
934
+ ) : /* @__PURE__ */ _.jsxs(
935
+ "div",
936
+ {
937
+ ref: x,
938
+ className: `relative inline-block text-left ${n}`,
939
+ children: [
940
+ /* @__PURE__ */ _.jsxs(
941
+ "button",
942
+ {
943
+ ref: m,
944
+ type: "button",
945
+ onClick: () => u(!v),
946
+ onKeyDown: O,
947
+ className: `
948
+ inline-flex items-center justify-center gap-2 rounded-md border border-slate-200 bg-white
949
+ px-3 py-2 text-sm font-medium text-slate-700 shadow-sm
950
+ transition-all duration-150
951
+ hover:bg-slate-50 hover:text-slate-900
952
+ focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2
953
+ dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300
954
+ dark:hover:bg-slate-700 dark:hover:text-slate-100
955
+ dark:focus:ring-slate-500 dark:focus:ring-offset-slate-900
956
+ `,
957
+ "aria-haspopup": "listbox",
958
+ "aria-expanded": v,
959
+ "aria-label": `Current language: ${K(p, d)}. Click to change language.`,
960
+ children: [
961
+ g ? /* @__PURE__ */ _.jsx("span", { className: "text-base", "aria-hidden": "true", children: se(p) }) : /* @__PURE__ */ _.jsx(Ir, { className: "h-4 w-4", "aria-hidden": "true" }),
962
+ /* @__PURE__ */ _.jsx("span", { children: K(p, d) }),
963
+ /* @__PURE__ */ _.jsx(
964
+ $r,
965
+ {
966
+ className: `h-4 w-4 transition-transform duration-200 ${v ? "rotate-180" : ""}`,
967
+ "aria-hidden": "true"
968
+ }
969
+ )
970
+ ]
971
+ }
972
+ ),
973
+ v && /* @__PURE__ */ _.jsx(
974
+ "div",
975
+ {
976
+ className: `
977
+ absolute right-0 z-50 mt-2 min-w-[160px] origin-top-right
978
+ rounded-md border border-slate-200 bg-white shadow-lg
979
+ ring-1 ring-black ring-opacity-5
980
+ dark:border-slate-700 dark:bg-slate-800
981
+ animate-in fade-in-0 zoom-in-95
982
+ `,
983
+ role: "listbox",
984
+ "aria-label": "Available languages",
985
+ "aria-activedescendant": `locale-option-${p}`,
986
+ children: /* @__PURE__ */ _.jsx("div", { className: "py-1", children: h.map((s, w) => {
987
+ const D = s === p;
988
+ return /* @__PURE__ */ _.jsxs(
989
+ "button",
990
+ {
991
+ id: `locale-option-${s}`,
992
+ type: "button",
993
+ role: "option",
994
+ "aria-selected": D,
995
+ "data-locale-index": w,
996
+ onClick: () => k(s),
997
+ onKeyDown: (C) => N(C, s, w),
998
+ className: `
999
+ flex w-full items-center justify-between gap-2 px-3 py-2 text-sm
1000
+ transition-colors duration-150
1001
+ focus:outline-none focus:bg-slate-100 dark:focus:bg-slate-700
1002
+ ${D ? "bg-slate-50 text-slate-900 dark:bg-slate-700/50 dark:text-slate-100" : "text-slate-700 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-slate-700 dark:hover:text-slate-100"}
1003
+ `,
1004
+ children: [
1005
+ /* @__PURE__ */ _.jsxs("span", { className: "flex items-center gap-2", children: [
1006
+ g && /* @__PURE__ */ _.jsx("span", { className: "text-base", "aria-hidden": "true", children: se(s) }),
1007
+ /* @__PURE__ */ _.jsx("span", { children: K(s, d) })
1008
+ ] }),
1009
+ D && /* @__PURE__ */ _.jsx(
1010
+ Dr,
1011
+ {
1012
+ className: "h-4 w-4 text-slate-600 dark:text-slate-400",
1013
+ "aria-hidden": "true"
1014
+ }
1015
+ )
1016
+ ]
1017
+ },
1018
+ s
1019
+ );
1020
+ }) })
1021
+ }
1022
+ )
1023
+ ]
1024
+ }
1025
+ );
1026
+ }
21
1027
  export {
22
- u as useTranslations
1028
+ Wr as LocaleSwitcher,
1029
+ xr as useTranslations
23
1030
  };
24
1031
  //# sourceMappingURL=lingua-react.js.map