plossy 0.4.0 → 0.5.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.
package/dist/plossy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Plossy v0.4.0 | MIT License
2
+ * Plossy v0.5.0 | MIT License
3
3
  *
4
4
  * Includes icons from Lucide (https://lucide.dev), some of them derived from Feather.
5
5
  * Full third-party notices (also shipped as LICENSE-LUCIDE):
@@ -53,6 +53,230 @@
53
53
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
54
54
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
55
55
 
56
+ // src/js/locale/en.js
57
+ var en_default = {
58
+ // Shared
59
+ close: "Close",
60
+ clear: "Clear",
61
+ previous: "Previous",
62
+ next: "Next",
63
+ loading: "Loading",
64
+ // Combobox
65
+ "combobox.empty": "No results",
66
+ "combobox.loading": "Searching\u2026",
67
+ "combobox.create": "Add",
68
+ "combobox.options": "Options",
69
+ "combobox.remove": "Remove: {label}",
70
+ "combobox.minLength": { one: "Type at least {n} character to search", other: "Type at least {n} characters to search" },
71
+ "combobox.error": "Couldn\u2019t load results",
72
+ // Datepicker
73
+ "datepicker.dialog": "Choose a date",
74
+ "datepicker.prevMonth": "Previous month",
75
+ "datepicker.nextMonth": "Next month",
76
+ "datepicker.prevYear": "Previous year",
77
+ "datepicker.nextYear": "Next year",
78
+ "datepicker.prevYears": "Previous years",
79
+ "datepicker.nextYears": "Next years",
80
+ "datepicker.pickMonth": "Choose a month",
81
+ "datepicker.pickYear": "Choose a year",
82
+ "datepicker.today": "Today",
83
+ "datepicker.clear": "Clear",
84
+ // Countdown (screen reader text)
85
+ "countdown.days": "days",
86
+ "countdown.hours": "hr",
87
+ "countdown.minutes": "min",
88
+ "countdown.seconds": "s",
89
+ // Slider, Slideshow
90
+ "slider.carousel": "carousel",
91
+ "slider.slide": "slide",
92
+ "slider.position": "{n} of {count}",
93
+ "slider.previous": "Previous slide",
94
+ "slider.next": "Next slide",
95
+ "slider.goto": "Slide {n}",
96
+ // Lightbox
97
+ "lightbox.label": "Gallery",
98
+ "lightbox.role": "gallery",
99
+ "lightbox.thumbs": "Thumbnails",
100
+ "lightbox.item": "Item {n}",
101
+ "lightbox.error": "Couldn\u2019t load the content.",
102
+ "lightbox.embed": "Embedded content",
103
+ // Modal (Plossy.modal.alert / confirm / prompt)
104
+ "modal.ok": "OK",
105
+ "modal.cancel": "Cancel",
106
+ "modal.close": "Close",
107
+ // Notification, Offcanvas, To top
108
+ "notification.close": "Close notification",
109
+ "offcanvas.label": "Side panel",
110
+ "totop.label": "Back to top",
111
+ // Quantity, Rating, OTP
112
+ "quantity.label": "Quantity",
113
+ "quantity.minus": "Decrease",
114
+ "quantity.plus": "Increase",
115
+ "rating.label": "Rating",
116
+ "otp.label": "One-time code",
117
+ "otp.char": "Character {n} of {count}",
118
+ // Password toggle, password strength
119
+ "password.show": "Show password",
120
+ "password.hide": "Hide password",
121
+ "strength.levels": "Weak, Fair, Good, Strong",
122
+ "strength.meter": "Password strength",
123
+ "strength.empty": "No password",
124
+ "strength.met": "met",
125
+ "strength.unmet": "not met",
126
+ "strength.rule.length": { one: "At least {n} character", other: "At least {n} characters" },
127
+ "strength.rule.case": "Lowercase and uppercase letter",
128
+ "strength.rule.digit": "At least one digit",
129
+ "strength.rule.symbol": "A special character (e.g. ! @ # ?)",
130
+ // Form validation
131
+ "validation.required": "This field is required.",
132
+ "validation.checkbox": "Check this box to continue.",
133
+ "validation.radio": "Choose one of the options.",
134
+ "validation.file": "Choose a file.",
135
+ "validation.select": "Choose an item from the list.",
136
+ "validation.email": "Enter a valid email address, e.g. jane@example.com.",
137
+ "validation.url": "Enter a valid URL, e.g. https://example.com.",
138
+ "validation.type": "Enter a value in the correct format.",
139
+ "validation.pattern": "Enter a value in the required format.",
140
+ "validation.minlength": { one: "Enter at least {n} character (currently {length}).", other: "Enter at least {n} characters (currently {length})." },
141
+ "validation.maxlength": { one: "Enter at most {n} character (currently {length}).", other: "Enter at most {n} characters (currently {length})." },
142
+ "validation.min": "The value can\u2019t be less than {min}.",
143
+ "validation.max": "The value can\u2019t be greater than {max}.",
144
+ "validation.step": "Enter a value that matches the allowed step.",
145
+ "validation.bad": "Enter a valid value.",
146
+ // Upload
147
+ "upload.choose": "Choose files",
148
+ "upload.type": "The file \u201C{name}\u201D has a format that isn\u2019t allowed.",
149
+ "upload.size": "The file \u201C{name}\u201D is too large ({size}). The maximum size is {max} MB.",
150
+ "upload.count": { one: "You can add at most {n} file.", other: "You can add at most {n} files." },
151
+ "upload.remove": "Remove file {name}",
152
+ "upload.progress": "Upload progress: {name}",
153
+ "upload.uploading": "Uploading\u2026 {percent}%",
154
+ "upload.done": "Uploaded",
155
+ "upload.failed": "Couldn\u2019t upload the file.",
156
+ "upload.failedStatus": "Couldn\u2019t upload the file (error {status}).",
157
+ "upload.failedNetwork": "Couldn\u2019t upload the file \u2014 check your connection.",
158
+ // Sortable (screen reader announcements)
159
+ "sortable.help": "Press space to pick up an item. Use the arrow keys to move it, space or Enter to drop it, and Escape to cancel.",
160
+ "sortable.role": "sortable item",
161
+ "sortable.lifted": "Picked up: {label}. Position {n} of {count}. Use the arrow keys to move, space to drop, Escape to cancel.",
162
+ "sortable.moved": "Position {n} of {count}.",
163
+ "sortable.cancelled": "Cancelled. {label} returns to position {n} of {count}.",
164
+ "sortable.dropped": "Dropped: {label}. Position {n} of {count}."
165
+ };
166
+
167
+ // src/js/locale/pl.js
168
+ var pl_default = {
169
+ close: "Zamknij",
170
+ clear: "Wyczy\u015B\u0107",
171
+ previous: "Poprzedni",
172
+ next: "Nast\u0119pny",
173
+ loading: "Wczytywanie",
174
+ "combobox.empty": "Brak wynik\xF3w",
175
+ "combobox.loading": "Szukam\u2026",
176
+ "combobox.create": "Dodaj",
177
+ "combobox.options": "Opcje",
178
+ "combobox.remove": "Usu\u0144: {label}",
179
+ "combobox.minLength": "Wpisz co najmniej {n} zn., aby wyszuka\u0107",
180
+ "combobox.error": "Nie uda\u0142o si\u0119 pobra\u0107 wynik\xF3w",
181
+ "datepicker.dialog": "Wybierz dat\u0119",
182
+ "datepicker.prevMonth": "Poprzedni miesi\u0105c",
183
+ "datepicker.nextMonth": "Nast\u0119pny miesi\u0105c",
184
+ "datepicker.prevYear": "Poprzedni rok",
185
+ "datepicker.nextYear": "Nast\u0119pny rok",
186
+ "datepicker.prevYears": "Poprzednie lata",
187
+ "datepicker.nextYears": "Nast\u0119pne lata",
188
+ "datepicker.pickMonth": "Wybierz miesi\u0105c",
189
+ "datepicker.pickYear": "Wybierz rok",
190
+ "datepicker.today": "Dzi\u015B",
191
+ "datepicker.clear": "Wyczy\u015B\u0107",
192
+ "countdown.days": "dni",
193
+ "countdown.hours": "godz.",
194
+ "countdown.minutes": "min",
195
+ "countdown.seconds": "s",
196
+ "slider.carousel": "karuzela",
197
+ "slider.slide": "slajd",
198
+ "slider.position": "{n} z {count}",
199
+ "slider.previous": "Poprzedni slajd",
200
+ "slider.next": "Nast\u0119pny slajd",
201
+ "slider.goto": "Slajd {n}",
202
+ "lightbox.label": "Galeria",
203
+ "lightbox.role": "galeria",
204
+ "lightbox.thumbs": "Miniatury",
205
+ "lightbox.item": "Pozycja {n}",
206
+ "lightbox.error": "Nie uda\u0142o si\u0119 wczyta\u0107 zawarto\u015Bci.",
207
+ "lightbox.embed": "Osadzona tre\u015B\u0107",
208
+ "modal.ok": "OK",
209
+ "modal.cancel": "Anuluj",
210
+ "modal.close": "Zamknij",
211
+ "notification.close": "Zamknij powiadomienie",
212
+ "offcanvas.label": "Panel boczny",
213
+ "totop.label": "Wr\xF3\u0107 na g\xF3r\u0119 strony",
214
+ "quantity.label": "Ilo\u015B\u0107",
215
+ "quantity.minus": "Mniej",
216
+ "quantity.plus": "Wi\u0119cej",
217
+ "rating.label": "Ocena",
218
+ "otp.label": "Kod jednorazowy",
219
+ "otp.char": "Znak {n} z {count}",
220
+ "password.show": "Poka\u017C has\u0142o",
221
+ "password.hide": "Ukryj has\u0142o",
222
+ "strength.levels": "S\u0142abe, \u015Arednie, Dobre, Silne",
223
+ "strength.meter": "Si\u0142a has\u0142a",
224
+ "strength.empty": "Brak has\u0142a",
225
+ "strength.met": "spe\u0142nione",
226
+ "strength.unmet": "niespe\u0142nione",
227
+ "strength.rule.length": "Co najmniej {n} znak\xF3w",
228
+ "strength.rule.case": "Ma\u0142a i wielka litera",
229
+ "strength.rule.digit": "Co najmniej jedna cyfra",
230
+ "strength.rule.symbol": "Znak specjalny (np. ! @ # ?)",
231
+ "validation.required": "To pole jest wymagane.",
232
+ "validation.checkbox": "Zaznacz to pole, aby kontynuowa\u0107.",
233
+ "validation.radio": "Wybierz jedn\u0105 z opcji.",
234
+ "validation.file": "Wybierz plik.",
235
+ "validation.select": "Wybierz pozycj\u0119 z listy.",
236
+ "validation.email": "Podaj poprawny adres e-mail, np. jan@example.com.",
237
+ "validation.url": "Podaj poprawny adres URL, np. https://example.com.",
238
+ "validation.type": "Podaj warto\u015B\u0107 w poprawnym formacie.",
239
+ "validation.pattern": "Podaj warto\u015B\u0107 w wymaganym formacie.",
240
+ "validation.minlength": {
241
+ one: "Wpisz co najmniej {n} znak (obecnie {length}).",
242
+ few: "Wpisz co najmniej {n} znaki (obecnie {length}).",
243
+ many: "Wpisz co najmniej {n} znak\xF3w (obecnie {length}).",
244
+ other: "Wpisz co najmniej {n} znaku (obecnie {length})."
245
+ },
246
+ "validation.maxlength": {
247
+ one: "Wpisz najwy\u017Cej {n} znak (obecnie {length}).",
248
+ few: "Wpisz najwy\u017Cej {n} znaki (obecnie {length}).",
249
+ many: "Wpisz najwy\u017Cej {n} znak\xF3w (obecnie {length}).",
250
+ other: "Wpisz najwy\u017Cej {n} znaku (obecnie {length})."
251
+ },
252
+ "validation.min": "Warto\u015B\u0107 nie mo\u017Ce by\u0107 mniejsza ni\u017C {min}.",
253
+ "validation.max": "Warto\u015B\u0107 nie mo\u017Ce by\u0107 wi\u0119ksza ni\u017C {max}.",
254
+ "validation.step": "Podaj warto\u015B\u0107 zgodn\u0105 z dozwolonym krokiem.",
255
+ "validation.bad": "Podaj poprawn\u0105 warto\u015B\u0107.",
256
+ "upload.choose": "Wybierz pliki",
257
+ "upload.type": "Plik \u201E{name}\u201D ma niedozwolony format.",
258
+ "upload.size": "Plik \u201E{name}\u201D jest za du\u017Cy ({size}). Maksymalny rozmiar to {max} MB.",
259
+ "upload.count": {
260
+ one: "Mo\u017Cna doda\u0107 najwy\u017Cej {n} plik.",
261
+ few: "Mo\u017Cna doda\u0107 najwy\u017Cej {n} pliki.",
262
+ many: "Mo\u017Cna doda\u0107 najwy\u017Cej {n} plik\xF3w.",
263
+ other: "Mo\u017Cna doda\u0107 najwy\u017Cej {n} pliku."
264
+ },
265
+ "upload.remove": "Usu\u0144 plik {name}",
266
+ "upload.progress": "Post\u0119p przesy\u0142ania: {name}",
267
+ "upload.uploading": "Przesy\u0142anie\u2026 {percent}%",
268
+ "upload.done": "Przes\u0142ano",
269
+ "upload.failed": "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku.",
270
+ "upload.failedStatus": "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku (b\u0142\u0105d {status}).",
271
+ "upload.failedNetwork": "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku \u2014 sprawd\u017A po\u0142\u0105czenie.",
272
+ "sortable.help": "Naci\u015Bnij spacj\u0119, aby podnie\u015B\u0107 element. Strza\u0142kami zmie\u0144 jego pozycj\u0119, spacj\u0105 lub Enterem upu\u015B\u0107, klawiszem Escape anuluj.",
273
+ "sortable.role": "element sortowalny",
274
+ "sortable.lifted": "Podniesiono: {label}. Pozycja {n} z {count}. Strza\u0142kami zmie\u0144 pozycj\u0119, spacj\u0105 upu\u015B\u0107, Escape anuluje.",
275
+ "sortable.moved": "Pozycja {n} z {count}.",
276
+ "sortable.cancelled": "Anulowano. {label} wraca na pozycj\u0119 {n} z {count}.",
277
+ "sortable.dropped": "Upuszczono: {label}. Pozycja {n} z {count}."
278
+ };
279
+
56
280
  // src/js/core.js
57
281
  var registry = /* @__PURE__ */ new Map();
58
282
  var store = /* @__PURE__ */ new WeakMap();
@@ -66,8 +290,35 @@
66
290
  var PERSIST = "data-pl-persist";
67
291
  var config = {
68
292
  /** Niszczy instancje elementów usuniętych z dokumentu. `false` — dawne zachowanie (instancje żyją dalej). */
69
- autoDestroy: true
293
+ autoDestroy: true,
294
+ /** Język tekstów interfejsu (np. 'pl'). `null` — według atrybutu `lang` elementu lub strony, domyślnie angielski. */
295
+ locale: null
70
296
  };
297
+ var locales = { en: en_default, pl: pl_default };
298
+ function langOf(el) {
299
+ if (config.locale) return String(config.locale);
300
+ const owner = el?.closest?.("[lang]") || document.documentElement;
301
+ return owner.getAttribute("lang") || "en";
302
+ }
303
+ function localeOf(el) {
304
+ const tag = langOf(el).toLowerCase();
305
+ if (locales[tag]) return tag;
306
+ const base = tag.split("-")[0];
307
+ return locales[base] ? base : "en";
308
+ }
309
+ function t(key, vars = {}, el = null) {
310
+ const lang = localeOf(el);
311
+ let text = locales[lang][key] ?? locales.en[key] ?? key;
312
+ if (typeof text === "object") {
313
+ const form = new Intl.PluralRules(lang).select(Number(vars.n) || 0);
314
+ text = text[form] ?? text.other;
315
+ }
316
+ return String(text).replace(/\{(\w+)\}/g, (match, name) => name in vars ? String(vars[name]) : match);
317
+ }
318
+ function addLocale(code, messages) {
319
+ const key = String(code).toLowerCase();
320
+ locales[key] = { ...locales[key] || {}, ...messages };
321
+ }
71
322
  var api = {};
72
323
  var $ = (sel, ctx = document) => typeof sel === "string" ? ctx.querySelector(sel) : sel || null;
73
324
  var $$ = (sel, ctx = document) => typeof sel === "string" ? [...ctx.querySelectorAll(sel)] : sel ? sel instanceof Element ? [sel] : [...sel] : [];
@@ -494,6 +745,8 @@
494
745
  scan,
495
746
  getInstance,
496
747
  config,
748
+ addLocale,
749
+ locales,
497
750
  Component,
498
751
  util: {
499
752
  $,
@@ -501,6 +754,8 @@
501
754
  uid,
502
755
  clamp,
503
756
  parseOptions,
757
+ t,
758
+ langOf,
504
759
  queryTargets,
505
760
  focusables,
506
761
  animationsDone,
@@ -725,7 +980,6 @@
725
980
  ["minutes", 60],
726
981
  ["seconds", 1]
727
982
  ];
728
- var LABELS = { days: "dni", hours: "godz.", minutes: "min", seconds: "s" };
729
983
  var Countdown = class extends Component {
730
984
  init() {
731
985
  this.timer = null;
@@ -760,7 +1014,7 @@
760
1014
  if (date !== "" && date !== null && date !== void 0) {
761
1015
  const time = typeof date === "number" ? date : Date.parse(date);
762
1016
  if (!Number.isNaN(time)) return time;
763
- console.warn(`[Plossy] countdown: nieprawid\u0142owa data \u201E${date}"`);
1017
+ console.warn(`[Plossy] countdown: invalid date "${date}"`);
764
1018
  }
765
1019
  return Date.now() + Math.max(0, Number(seconds) || 0) * 1e3;
766
1020
  }
@@ -842,7 +1096,7 @@
842
1096
  }
843
1097
  if (!changed) return;
844
1098
  this.el.style.setProperty("--pl-countdown-progress", this.total ? String(1 - ms / this.total) : "0");
845
- const key = Object.entries(values).filter(([unit]) => unit !== "seconds" || Object.keys(values).length === 1).map(([unit, value]) => `${value} ${LABELS[unit]}`).join(" ");
1099
+ const key = Object.entries(values).filter(([unit]) => unit !== "seconds" || Object.keys(values).length === 1).map(([unit, value]) => `${value} ${t(`countdown.${unit}`, {}, this.el)}`).join(" ");
846
1100
  if (key !== this.srKey) {
847
1101
  this.srKey = key;
848
1102
  this.sr.textContent = key;
@@ -1299,7 +1553,7 @@
1299
1553
  const { el } = this;
1300
1554
  this.active = null;
1301
1555
  if (!el.hasAttribute("aria-label") && !el.textContent.trim()) {
1302
- el.setAttribute("aria-label", "Wr\xF3\u0107 na g\xF3r\u0119 strony");
1556
+ el.setAttribute("aria-label", t("totop.label", {}, el));
1303
1557
  }
1304
1558
  if (!el.matches("a[href], button")) {
1305
1559
  if (!el.hasAttribute("role")) el.setAttribute("role", "button");
@@ -1391,14 +1645,14 @@
1391
1645
  // src/js/components/upload.js
1392
1646
  var svg = (name) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${icons_default[name] || ""}</svg>`;
1393
1647
  var escapeHtml = (str) => String(str).replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
1394
- function formatSize(bytes) {
1648
+ function formatSize(bytes, lang = "en") {
1395
1649
  const units = ["B", "KB", "MB", "GB"];
1396
1650
  let i = 0;
1397
1651
  while (bytes >= 1024 && i < units.length - 1) {
1398
1652
  bytes /= 1024;
1399
1653
  i++;
1400
1654
  }
1401
- return `${bytes.toLocaleString("pl-PL", { maximumFractionDigits: i ? 1 : 0 })} ${units[i]}`;
1655
+ return `${bytes.toLocaleString(lang, { maximumFractionDigits: i ? 1 : 0 })} ${units[i]}`;
1402
1656
  }
1403
1657
  function typeIcon(file) {
1404
1658
  const type = file.type || "";
@@ -1434,7 +1688,7 @@
1434
1688
  this.input.type = "file";
1435
1689
  this.input.tabIndex = -1;
1436
1690
  this.input.name = options.name;
1437
- this.input.setAttribute("aria-label", "Wybierz pliki");
1691
+ this.input.setAttribute("aria-label", t("upload.choose", {}, el));
1438
1692
  this.input.hidden = true;
1439
1693
  el.append(this.input);
1440
1694
  if (!el.hasAttribute("tabindex")) el.tabIndex = 0;
@@ -1526,14 +1780,14 @@
1526
1780
  for (const file of files) {
1527
1781
  let error = null;
1528
1782
  if (!matchesAccept(file, options.accept)) {
1529
- error = { type: "type", message: `Plik \u201E${file.name}\u201D ma niedozwolony format.` };
1783
+ error = { type: "type", message: t("upload.type", { name: file.name }, this.el) };
1530
1784
  } else if (options.maxSize && file.size > options.maxSize * 1024 * 1024) {
1531
1785
  error = {
1532
1786
  type: "size",
1533
- message: `Plik \u201E${file.name}\u201D jest za du\u017Cy (${formatSize(file.size)}). Maksymalny rozmiar to ${options.maxSize} MB.`
1787
+ message: t("upload.size", { name: file.name, size: formatSize(file.size, langOf(this.el)), max: options.maxSize }, this.el)
1534
1788
  };
1535
1789
  } else if (options.maxFiles && this.entries.length + accepted.length >= options.maxFiles) {
1536
- error = { type: "count", message: `Mo\u017Cna doda\u0107 najwy\u017Cej ${options.maxFiles} ${plural(options.maxFiles)}.` };
1790
+ error = { type: "count", message: t("upload.count", { n: options.maxFiles }, this.el) };
1537
1791
  }
1538
1792
  if (error) {
1539
1793
  if (error.type !== "count" || !errors.some((other) => other.type === "count")) errors.push({ ...error, file });
@@ -1564,7 +1818,7 @@
1564
1818
  thumb = `<img src="${entry.objectUrl}" alt="">`;
1565
1819
  }
1566
1820
  const name = escapeHtml(file.name);
1567
- item.innerHTML = `<span class="pl-upload-thumb">${thumb}</span><span class="pl-upload-info"><span class="pl-upload-name" title="${name}">${name}</span><span class="pl-upload-meta"></span></span><button class="pl-upload-remove" type="button" aria-label="Usu\u0144 plik ${name}">${svg("x")}</button><span class="pl-upload-progress" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-label="Post\u0119p przesy\u0142ania: ${name}"><span class="pl-upload-bar"></span></span>`;
1821
+ item.innerHTML = `<span class="pl-upload-thumb">${thumb}</span><span class="pl-upload-info"><span class="pl-upload-name" title="${name}">${name}</span><span class="pl-upload-meta"></span></span><button class="pl-upload-remove" type="button" aria-label="${escapeHtml(t("upload.remove", { name: file.name }, this.el))}">${svg("x")}</button><span class="pl-upload-progress" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-label="${escapeHtml(t("upload.progress", { name: file.name }, this.el))}"><span class="pl-upload-bar"></span></span>`;
1568
1822
  entry.el = item;
1569
1823
  this.list.append(item);
1570
1824
  this.describe(entry);
@@ -1574,7 +1828,7 @@
1574
1828
  describe(entry, text) {
1575
1829
  const { file } = entry;
1576
1830
  const ext = file.name.includes(".") ? file.name.split(".").pop().toUpperCase() : "";
1577
- const base = [formatSize(file.size), ext].filter(Boolean).join(" \xB7 ");
1831
+ const base = [formatSize(file.size, langOf(this.el)), ext].filter(Boolean).join(" \xB7 ");
1578
1832
  const meta2 = $(".pl-upload-meta", entry.el);
1579
1833
  if (meta2) meta2.textContent = text ? `${text}` : base;
1580
1834
  entry.base = base;
@@ -1594,7 +1848,7 @@
1594
1848
  entry.el.classList.remove("pl-upload-item-error");
1595
1849
  entry.el.style.setProperty("--pl-upload-value", percent / 100);
1596
1850
  $(".pl-upload-progress", entry.el)?.setAttribute("aria-valuenow", percent);
1597
- this.describe(entry, `Przesy\u0142anie\u2026 ${percent}%`);
1851
+ this.describe(entry, t("upload.uploading", { percent }, this.el));
1598
1852
  this.emit("progress", { file: entry.file, percent, ...detail });
1599
1853
  }
1600
1854
  /** Oznacza plik jako przesłany. */
@@ -1607,12 +1861,12 @@
1607
1861
  entry.el.classList.remove("pl-upload-item-uploading", "pl-upload-item-error");
1608
1862
  entry.el.classList.add("pl-upload-item-done");
1609
1863
  this.describe(entry);
1610
- this.describe(entry, `${entry.base} \xB7 Przes\u0142ano`);
1864
+ this.describe(entry, `${entry.base} \xB7 ${t("upload.done", {}, this.el)}`);
1611
1865
  this.emit("complete", { file: entry.file, response, xhr });
1612
1866
  if (this.entries.every((other) => other.status === "done")) this.emit("completeall", { files: this.files });
1613
1867
  }
1614
1868
  /** Oznacza plik jako nieprzesłany. */
1615
- fail(target, message = "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku.", xhr = null) {
1869
+ fail(target, message = t("upload.failed", {}, this.el), xhr = null) {
1616
1870
  const entry = this.find(target);
1617
1871
  if (!entry) return;
1618
1872
  entry.status = "error";
@@ -1648,12 +1902,12 @@
1648
1902
  }
1649
1903
  this.complete(entry, response, xhr);
1650
1904
  } else {
1651
- this.fail(entry, `Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku (b\u0142\u0105d ${xhr.status}).`, xhr);
1905
+ this.fail(entry, t("upload.failedStatus", { status: xhr.status }, this.el), xhr);
1652
1906
  }
1653
1907
  });
1654
1908
  xhr.addEventListener("error", () => {
1655
1909
  entry.xhr = null;
1656
- this.fail(entry, "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku \u2014 sprawd\u017A po\u0142\u0105czenie.", xhr);
1910
+ this.fail(entry, t("upload.failedNetwork", {}, this.el), xhr);
1657
1911
  });
1658
1912
  if (!this.emit("beforesend", { file: entry.file, xhr, data }, true)) {
1659
1913
  entry.xhr = null;
@@ -1745,12 +1999,6 @@
1745
1999
  messages: true
1746
2000
  // pokazuj komunikaty błędów pod strefą
1747
2001
  });
1748
- function plural(n) {
1749
- if (n === 1) return "plik";
1750
- const mod10 = n % 10;
1751
- const mod100 = n % 100;
1752
- return mod10 >= 2 && mod10 <= 4 && !(mod100 >= 12 && mod100 <= 14) ? "pliki" : "plik\xF3w";
1753
- }
1754
2002
  register("upload", Upload);
1755
2003
 
1756
2004
  // src/js/components/otp.js
@@ -1775,7 +2023,7 @@
1775
2023
  const disabled = this.input.disabled;
1776
2024
  const initial = this.sanitize(this.input.value || "");
1777
2025
  el.setAttribute("role", "group");
1778
- if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) el.setAttribute("aria-label", options.label);
2026
+ if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) el.setAttribute("aria-label", options.label ?? t("otp.label", {}, el));
1779
2027
  this.boxes = [];
1780
2028
  this.generated = [];
1781
2029
  let group = null;
@@ -1803,7 +2051,7 @@
1803
2051
  box.spellcheck = false;
1804
2052
  box.disabled = disabled;
1805
2053
  box.style.setProperty("--pl-otp-index", i);
1806
- box.setAttribute("aria-label", `Znak ${i + 1} z ${length}`);
2054
+ box.setAttribute("aria-label", t("otp.char", { n: i + 1, count: length }, this.el));
1807
2055
  group.append(box);
1808
2056
  this.boxes.push(box);
1809
2057
  }
@@ -1830,20 +2078,20 @@
1830
2078
  const box = event.target;
1831
2079
  if (!box.classList?.contains("pl-otp-box")) return;
1832
2080
  const index = this.boxes.indexOf(box);
1833
- let chars2 = this.sanitize(box.value);
2081
+ let chars = this.sanitize(box.value);
1834
2082
  const prev = this.prev?.[index];
1835
- if (prev && chars2.length === 2) chars2 = chars2.replace(prev, "") || prev;
2083
+ if (prev && chars.length === 2) chars = chars.replace(prev, "") || prev;
1836
2084
  box.value = "";
1837
- if (chars2) this.fill(chars2.length >= this.options.length ? 0 : index, chars2);
2085
+ if (chars) this.fill(chars.length >= this.options.length ? 0 : index, chars);
1838
2086
  else this.update();
1839
2087
  });
1840
2088
  this.on(el, "paste", (event) => {
1841
2089
  const box = event.target;
1842
2090
  if (!box.classList?.contains("pl-otp-box")) return;
1843
2091
  event.preventDefault();
1844
- const chars2 = this.sanitize(event.clipboardData?.getData("text") || "");
1845
- if (!chars2) return this.reject(box);
1846
- this.fill(chars2.length >= this.options.length ? 0 : this.boxes.indexOf(box), chars2);
2092
+ const chars = this.sanitize(event.clipboardData?.getData("text") || "");
2093
+ if (!chars) return this.reject(box);
2094
+ this.fill(chars.length >= this.options.length ? 0 : this.boxes.indexOf(box), chars);
1847
2095
  });
1848
2096
  this.on(el, "keydown", (event) => {
1849
2097
  const box = event.target;
@@ -1915,10 +2163,10 @@
1915
2163
  return this.boxes.every((box) => box.value);
1916
2164
  }
1917
2165
  /** Wpisuje znaki od pozycji `index` i przenosi fokus dalej. */
1918
- fill(index, chars2) {
2166
+ fill(index, chars) {
1919
2167
  index = Math.max(0, index);
1920
2168
  let last = index;
1921
- [...chars2].slice(0, this.boxes.length - index).forEach((char, offset) => {
2169
+ [...chars].slice(0, this.boxes.length - index).forEach((char, offset) => {
1922
2170
  const box = this.boxes[index + offset];
1923
2171
  box.value = char;
1924
2172
  this.pop(box);
@@ -1944,9 +2192,9 @@
1944
2192
  setTimeout(() => box.classList.remove("pl-otp-shake"), 450);
1945
2193
  }
1946
2194
  write(code, silent = false) {
1947
- const chars2 = [...this.sanitize(code)];
2195
+ const chars = [...this.sanitize(code)];
1948
2196
  this.boxes.forEach((box, i) => {
1949
- box.value = chars2[i] || "";
2197
+ box.value = chars[i] || "";
1950
2198
  });
1951
2199
  this.update(silent);
1952
2200
  }
@@ -2035,24 +2283,21 @@
2035
2283
  autofocus: false,
2036
2284
  submit: false,
2037
2285
  // po wpisaniu całego kodu wysyła formularz
2038
- label: "Kod jednorazowy"
2286
+ label: null
2287
+ // domyślnie z tekstów języka strony
2039
2288
  });
2040
2289
  __publicField(Otp, "primary", "length");
2041
2290
  register("otp", Otp);
2042
2291
 
2043
2292
  // src/js/components/strength.js
2044
- var RULES = {
2045
- length: (min) => `Co najmniej ${min} znak\xF3w`,
2046
- case: () => "Ma\u0142a i wielka litera",
2047
- digit: () => "Co najmniej jedna cyfra",
2048
- symbol: () => "Znak specjalny (np. ! @ # ?)"
2049
- };
2293
+ var RULES = ["length", "case", "digit", "symbol"];
2050
2294
  var Strength = class extends Component {
2051
2295
  init() {
2052
2296
  var _a;
2053
2297
  const { el, options } = this;
2054
2298
  el.classList.add("pl-strength");
2055
2299
  this.input = options.input && $(options.input) || $("input", el);
2300
+ options.labels ?? (options.labels = t("strength.levels", {}, el));
2056
2301
  if (typeof options.labels === "string") options.labels = options.labels.split(",").map((label) => label.trim());
2057
2302
  this.created = [];
2058
2303
  this.score = 0;
@@ -2069,7 +2314,7 @@
2069
2314
  for (let i = 0; i < 4; i++) this.meter.append(this.make("span", "pl-strength-segment"));
2070
2315
  }
2071
2316
  this.meter.setAttribute("role", "meter");
2072
- this.meter.setAttribute("aria-label", "Si\u0142a has\u0142a");
2317
+ this.meter.setAttribute("aria-label", t("strength.meter", {}, el));
2073
2318
  this.meter.setAttribute("aria-valuemin", "0");
2074
2319
  this.meter.setAttribute("aria-valuemax", "4");
2075
2320
  this.labelEl = $(".pl-strength-label", el);
@@ -2086,10 +2331,10 @@
2086
2331
  this.created.push(this.rulesEl);
2087
2332
  }
2088
2333
  if (this.rulesEl && !this.rulesEl.children.length) {
2089
- for (const [rule, text] of Object.entries(RULES)) {
2334
+ for (const rule of RULES) {
2090
2335
  const item = this.make("li", "pl-strength-rule");
2091
2336
  item.dataset.rule = rule;
2092
- item.textContent = text(options.minLength);
2337
+ item.textContent = t(`strength.rule.${rule}`, { n: options.minLength }, el);
2093
2338
  this.rulesEl.append(item);
2094
2339
  }
2095
2340
  }
@@ -2140,13 +2385,13 @@
2140
2385
  this.el.dataset.score = score;
2141
2386
  [...this.meter.children].forEach((segment, i) => segment.classList.toggle("pl-active", i < score));
2142
2387
  this.meter.setAttribute("aria-valuenow", score);
2143
- this.meter.setAttribute("aria-valuetext", label || "Brak has\u0142a");
2388
+ this.meter.setAttribute("aria-valuetext", label || t("strength.empty", {}, this.el));
2144
2389
  if (this.labelEl) this.labelEl.textContent = label;
2145
2390
  if (this.rulesEl) {
2146
2391
  for (const item of this.rulesEl.querySelectorAll("[data-rule]")) {
2147
2392
  const met = !!rules[item.dataset.rule];
2148
2393
  item.classList.toggle("pl-active", met);
2149
- item.setAttribute("aria-label", `${item.textContent} \u2014 ${met ? "spe\u0142nione" : "niespe\u0142nione"}`);
2394
+ item.setAttribute("aria-label", `${item.textContent} \u2014 ${t(met ? "strength.met" : "strength.unmet", {}, this.el)}`);
2150
2395
  }
2151
2396
  }
2152
2397
  const changed = score !== this.score;
@@ -2161,7 +2406,8 @@
2161
2406
  // lista wymagań odhaczanych na żywo
2162
2407
  label: true,
2163
2408
  // etykieta słowna
2164
- labels: ["S\u0142abe", "\u015Arednie", "Dobre", "Silne"],
2409
+ labels: null,
2410
+ // cztery poziomy; domyślnie z tekstów języka strony
2165
2411
  input: "",
2166
2412
  // selektor pola, gdy leży poza komponentem
2167
2413
  emptyLabel: ""
@@ -2179,7 +2425,7 @@
2179
2425
  el.classList.toggle("pl-rating-readonly", !!options.readonly);
2180
2426
  el.style.setProperty("--pl-rating-max", max);
2181
2427
  el.setAttribute("role", "radiogroup");
2182
- if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) el.setAttribute("aria-label", options.label);
2428
+ if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) el.setAttribute("aria-label", options.label ?? t("rating.label", {}, el));
2183
2429
  const name = options.name || uid("pl-rating");
2184
2430
  const make = (value) => {
2185
2431
  const input = document.createElement("input");
@@ -2271,7 +2517,8 @@
2271
2517
  readonly: false,
2272
2518
  clearable: true,
2273
2519
  // ponowne kliknięcie wybranej gwiazdki zeruje ocenę
2274
- label: "Ocena",
2520
+ label: null,
2521
+ // domyślnie z tekstów języka strony
2275
2522
  star: "gwiazdka|gwiazdki|gwiazdek"
2276
2523
  // odmiana do etykiet ARIA
2277
2524
  });
@@ -2293,12 +2540,12 @@
2293
2540
  }
2294
2541
  this.input.classList.add("pl-quantity-input");
2295
2542
  if (!this.input.hasAttribute("inputmode")) this.input.inputMode = "numeric";
2296
- if (!this.input.hasAttribute("aria-label") && !this.input.labels?.length) this.input.setAttribute("aria-label", "Ilo\u015B\u0107");
2543
+ if (!this.input.hasAttribute("aria-label") && !this.input.labels?.length) this.input.setAttribute("aria-label", t("quantity.label", {}, el));
2297
2544
  const make = (dir) => {
2298
2545
  const button = document.createElement("button");
2299
2546
  button.type = "button";
2300
2547
  button.className = `pl-quantity-button ${dir < 0 ? "pl-quantity-minus" : "pl-quantity-plus"}`;
2301
- button.setAttribute("aria-label", dir < 0 ? options.minusLabel : options.plusLabel);
2548
+ button.setAttribute("aria-label", dir < 0 ? options.minusLabel ?? t("quantity.minus", {}, el) : options.plusLabel ?? t("quantity.plus", {}, el));
2302
2549
  button.tabIndex = -1;
2303
2550
  this.on(button, "pointerdown", (event) => {
2304
2551
  if (event.button) return;
@@ -2414,8 +2661,9 @@
2414
2661
  step: null,
2415
2662
  repeat: true,
2416
2663
  // przytrzymanie przycisku powtarza zmianę
2417
- minusLabel: "Mniej",
2418
- plusLabel: "Wi\u0119cej"
2664
+ minusLabel: null,
2665
+ // domyślnie z tekstów języka strony
2666
+ plusLabel: null
2419
2667
  });
2420
2668
  register("quantity", Quantity);
2421
2669
 
@@ -2433,6 +2681,9 @@
2433
2681
  var Combobox = class extends Component {
2434
2682
  init() {
2435
2683
  const { el, options } = this;
2684
+ options.emptyText ?? (options.emptyText = t("combobox.empty", {}, el));
2685
+ options.loadingText ?? (options.loadingText = t("combobox.loading", {}, el));
2686
+ options.createText ?? (options.createText = t("combobox.create", {}, el));
2436
2687
  this.isSelect = el.tagName === "SELECT";
2437
2688
  this.multiple = this.isSelect && el.multiple;
2438
2689
  this.isOpen = false;
@@ -2505,7 +2756,7 @@
2505
2756
  this.clearButton.type = "button";
2506
2757
  this.clearButton.className = "pl-combobox-clear";
2507
2758
  this.clearButton.tabIndex = -1;
2508
- this.clearButton.setAttribute("aria-label", "Wyczy\u015B\u0107");
2759
+ this.clearButton.setAttribute("aria-label", t("clear", {}, el));
2509
2760
  this.clearButton.innerHTML = svg2("x");
2510
2761
  this.clearButton.hidden = true;
2511
2762
  if (options.clearable) control.append(this.clearButton);
@@ -2520,7 +2771,7 @@
2520
2771
  list.hidden = true;
2521
2772
  if (this.multiple) list.setAttribute("aria-multiselectable", "true");
2522
2773
  if (input.getAttribute("aria-labelledby")) list.setAttribute("aria-labelledby", input.getAttribute("aria-labelledby"));
2523
- else list.setAttribute("aria-label", this.placeholder || "Opcje");
2774
+ else list.setAttribute("aria-label", this.placeholder || t("combobox.options", {}, el));
2524
2775
  wrapper.append(control, list);
2525
2776
  this.onDestroy(() => {
2526
2777
  this.stopPlace?.();
@@ -2660,7 +2911,7 @@
2660
2911
  const chip = document.createElement("span");
2661
2912
  chip.className = "pl-combobox-chip";
2662
2913
  chip.dataset.value = item.value;
2663
- chip.innerHTML = `<span class="pl-combobox-chip-label">${escapeHtml2(item.label)}</span><button class="pl-combobox-chip-remove" type="button" tabindex="-1" aria-label="Usu\u0144: ${escapeHtml2(item.label)}">${svg2("x")}</button>`;
2914
+ chip.innerHTML = `<span class="pl-combobox-chip-label">${escapeHtml2(item.label)}</span><button class="pl-combobox-chip-remove" type="button" tabindex="-1" aria-label="${escapeHtml2(t("combobox.remove", { label: item.label }, this.el))}">${svg2("x")}</button>`;
2664
2915
  control.insertBefore(chip, input);
2665
2916
  }
2666
2917
  chips.forEach((chip) => chip.remove());
@@ -2797,7 +3048,7 @@
2797
3048
  this.request++;
2798
3049
  this.setLoading(false);
2799
3050
  this.items = this.isSelect ? [...this.selected] : [];
2800
- this.renderList(options.minLength > 0 ? `Wpisz co najmniej ${options.minLength} zn., aby wyszuka\u0107` : options.emptyText);
3051
+ this.renderList(options.minLength > 0 ? t("combobox.minLength", { n: options.minLength }, this.el) : options.emptyText);
2801
3052
  return;
2802
3053
  }
2803
3054
  this.setLoading(true);
@@ -2822,7 +3073,7 @@
2822
3073
  } catch (error) {
2823
3074
  if (signal.aborted || token2 !== this.request) return;
2824
3075
  this.setLoading(false);
2825
- this.renderMessage("Nie uda\u0142o si\u0119 pobra\u0107 wynik\xF3w");
3076
+ this.renderMessage(t("combobox.error", {}, this.el));
2826
3077
  this.emit("error", { error });
2827
3078
  }
2828
3079
  }
@@ -3103,9 +3354,10 @@
3103
3354
  // opóźnienie zapytań `source` (ms)
3104
3355
  placement: "bottom-start",
3105
3356
  offset: 6,
3106
- emptyText: "Brak wynik\xF3w",
3107
- loadingText: "Szukam\u2026",
3108
- createText: "Dodaj"
3357
+ emptyText: null,
3358
+ // domyślnie z tekstów języka strony
3359
+ loadingText: null,
3360
+ createText: null
3109
3361
  });
3110
3362
  register("combobox", Combobox);
3111
3363
 
@@ -3136,26 +3388,16 @@
3136
3388
  return date.getMonth() === Number(match[2]) - 1 ? date : null;
3137
3389
  }
3138
3390
  var TOKENS = /yyyy|yy|MMMM|MMM|MM|M|dd|d/g;
3139
- var LABELS2 = {
3140
- dialog: "Wybierz dat\u0119",
3141
- prevMonth: "Poprzedni miesi\u0105c",
3142
- nextMonth: "Nast\u0119pny miesi\u0105c",
3143
- prevYear: "Poprzedni rok",
3144
- nextYear: "Nast\u0119pny rok",
3145
- prevYears: "Poprzednie lata",
3146
- nextYears: "Nast\u0119pne lata",
3147
- pickMonth: "Wybierz miesi\u0105c",
3148
- pickYear: "Wybierz rok",
3149
- today: "Dzi\u015B",
3150
- clear: "Wyczy\u015B\u0107"
3151
- };
3391
+ var LABEL_KEYS = ["dialog", "prevMonth", "nextMonth", "prevYear", "nextYear", "prevYears", "nextYears", "pickMonth", "pickYear", "today", "clear"];
3152
3392
  var Datepicker = class extends Component {
3153
3393
  init() {
3154
3394
  const { el, options } = this;
3155
3395
  this.isInput = el.tagName === "INPUT";
3156
3396
  this.inline = !!options.inline || !this.isInput;
3157
3397
  this.input = this.isInput ? el : null;
3158
- this.labels = { ...LABELS2, ...options.labels || {} };
3398
+ options.locale ?? (options.locale = langOf(el));
3399
+ const defaults = Object.fromEntries(LABEL_KEYS.map((key) => [key, t(`datepicker.${key}`, {}, el)]));
3400
+ this.labels = { ...defaults, ...options.labels || {} };
3159
3401
  this.isOpen = false;
3160
3402
  this.view = "days";
3161
3403
  this.start = null;
@@ -3216,7 +3458,7 @@
3216
3458
  try {
3217
3459
  return new Intl.DateTimeFormat(options.locale, opts);
3218
3460
  } catch {
3219
- return new Intl.DateTimeFormat("pl", opts);
3461
+ return new Intl.DateTimeFormat("en", opts);
3220
3462
  }
3221
3463
  };
3222
3464
  this.fmt = {
@@ -3802,7 +4044,8 @@
3802
4044
  // dni tygodnia: 0 = niedziela … 6 = sobota, np. "0,6"
3803
4045
  disabledDates: "",
3804
4046
  // konkretne daty ISO rozdzielone przecinkami
3805
- locale: "pl",
4047
+ locale: null,
4048
+ // domyślnie język strony (atrybut lang)
3806
4049
  format: "dd.MM.yyyy",
3807
4050
  separator: " \u2013 ",
3808
4051
  // łącznik dat zakresu
@@ -3821,7 +4064,6 @@
3821
4064
  register("datepicker", Datepicker);
3822
4065
 
3823
4066
  // src/js/components/range.js
3824
- var numberFormat = typeof Intl !== "undefined" ? new Intl.NumberFormat("pl-PL", { maximumFractionDigits: 6 }) : null;
3825
4067
  var Range = class extends Component {
3826
4068
  init() {
3827
4069
  const { el, options } = this;
@@ -3929,7 +4171,8 @@
3929
4171
  return max > min ? clamp((Number(input.value) - min) / (max - min), 0, 1) : 0;
3930
4172
  }
3931
4173
  format(value) {
3932
- const text = numberFormat ? numberFormat.format(value) : String(value);
4174
+ this.numberFormat ?? (this.numberFormat = new Intl.NumberFormat(langOf(this.el), { maximumFractionDigits: 6 }));
4175
+ const text = this.numberFormat.format(value);
3933
4176
  return `${this.options.prefix}${text}${this.options.suffix}`;
3934
4177
  }
3935
4178
  /** Wartość (liczba) albo para [od, do] w trybie dual. */
@@ -4144,7 +4387,7 @@
4144
4387
  const { el, options } = this;
4145
4388
  const visible = this.visible;
4146
4389
  el.setAttribute("aria-pressed", String(visible));
4147
- el.setAttribute("aria-label", visible ? options.labelHide : options.labelShow);
4390
+ el.setAttribute("aria-label", visible ? options.labelHide ?? t("password.hide", {}, el) : options.labelShow ?? t("password.show", {}, el));
4148
4391
  el.classList.toggle("pl-active", visible);
4149
4392
  const icon = el.matches("[data-pl-icon]") ? el : $("[data-pl-icon]", el);
4150
4393
  if (icon) {
@@ -4175,8 +4418,9 @@
4175
4418
  // selektor pola; domyślnie pole hasła w tym samym opakowaniu
4176
4419
  iconShow: "eye",
4177
4420
  iconHide: "eye-off",
4178
- labelShow: "Poka\u017C has\u0142o",
4179
- labelHide: "Ukryj has\u0142o"
4421
+ labelShow: null,
4422
+ // domyślnie z tekstów języka strony
4423
+ labelHide: null
4180
4424
  });
4181
4425
  __publicField(PasswordToggle, "primary", "target");
4182
4426
  register("password-toggle", PasswordToggle);
@@ -4232,7 +4476,7 @@
4232
4476
  init() {
4233
4477
  const { el } = this;
4234
4478
  if (el.matches("button") && !el.hasAttribute("type")) el.type = "button";
4235
- if (!el.hasAttribute("aria-label") && !el.textContent.trim()) el.setAttribute("aria-label", "Wyczy\u015B\u0107");
4479
+ if (!el.hasAttribute("aria-label") && !el.textContent.trim()) el.setAttribute("aria-label", t("clear", {}, el));
4236
4480
  this.on(el, "click", (event) => {
4237
4481
  event.preventDefault();
4238
4482
  this.clear();
@@ -4252,38 +4496,31 @@
4252
4496
  __publicField(FormClear, "defaults", { target: "" });
4253
4497
  __publicField(FormClear, "primary", "target");
4254
4498
  register("form-clear", FormClear);
4255
- var plural2 = (n, one, few, many) => {
4256
- const mod10 = n % 10;
4257
- const mod100 = n % 100;
4258
- if (n === 1) return one;
4259
- if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) return few;
4260
- return many;
4261
- };
4262
- var chars = (n) => `${n} ${plural2(n, "znak", "znaki", "znak\xF3w")}`;
4263
4499
  function messageFor(field) {
4264
4500
  const v = field.validity;
4265
4501
  const custom = (key) => field.getAttribute(`data-pl-message-${key}`);
4502
+ const text = (key, vars) => t(`validation.${key}`, vars, field);
4266
4503
  if (v.valueMissing) {
4267
4504
  if (custom("required")) return custom("required");
4268
- if (field.type === "checkbox") return "Zaznacz to pole, aby kontynuowa\u0107.";
4269
- if (field.type === "radio") return "Wybierz jedn\u0105 z opcji.";
4270
- if (field.type === "file") return "Wybierz plik.";
4271
- if (field.matches("select")) return "Wybierz pozycj\u0119 z listy.";
4272
- return "To pole jest wymagane.";
4505
+ if (field.type === "checkbox") return text("checkbox");
4506
+ if (field.type === "radio") return text("radio");
4507
+ if (field.type === "file") return text("file");
4508
+ if (field.matches("select")) return text("select");
4509
+ return text("required");
4273
4510
  }
4274
4511
  if (v.typeMismatch) {
4275
4512
  if (custom("type")) return custom("type");
4276
- if (field.type === "email") return "Podaj poprawny adres e-mail, np. jan@example.com.";
4277
- if (field.type === "url") return "Podaj poprawny adres URL, np. https://example.com.";
4278
- return "Podaj warto\u015B\u0107 w poprawnym formacie.";
4279
- }
4280
- if (v.patternMismatch) return custom("pattern") || field.title || "Podaj warto\u015B\u0107 w wymaganym formacie.";
4281
- if (v.tooShort) return custom("minlength") || `Wpisz co najmniej ${chars(field.minLength)} (obecnie ${field.value.length}).`;
4282
- if (v.tooLong) return custom("maxlength") || `Wpisz najwy\u017Cej ${chars(field.maxLength)} (obecnie ${field.value.length}).`;
4283
- if (v.rangeUnderflow) return custom("min") || `Warto\u015B\u0107 nie mo\u017Ce by\u0107 mniejsza ni\u017C ${field.min}.`;
4284
- if (v.rangeOverflow) return custom("max") || `Warto\u015B\u0107 nie mo\u017Ce by\u0107 wi\u0119ksza ni\u017C ${field.max}.`;
4285
- if (v.stepMismatch) return custom("step") || "Podaj warto\u015B\u0107 zgodn\u0105 z dozwolonym krokiem.";
4286
- if (v.badInput) return custom("type") || "Podaj poprawn\u0105 warto\u015B\u0107.";
4513
+ if (field.type === "email") return text("email");
4514
+ if (field.type === "url") return text("url");
4515
+ return text("type");
4516
+ }
4517
+ if (v.patternMismatch) return custom("pattern") || field.title || text("pattern");
4518
+ if (v.tooShort) return custom("minlength") || text("minlength", { n: field.minLength, length: field.value.length });
4519
+ if (v.tooLong) return custom("maxlength") || text("maxlength", { n: field.maxLength, length: field.value.length });
4520
+ if (v.rangeUnderflow) return custom("min") || text("min", { min: field.min });
4521
+ if (v.rangeOverflow) return custom("max") || text("max", { max: field.max });
4522
+ if (v.stepMismatch) return custom("step") || text("step");
4523
+ if (v.badInput) return custom("type") || text("bad");
4287
4524
  if (v.customError) return field.validationMessage;
4288
4525
  return "";
4289
4526
  }
@@ -5013,7 +5250,7 @@
5013
5250
  const button = document.createElement("button");
5014
5251
  button.type = "button";
5015
5252
  button.className = "pl-close";
5016
- button.setAttribute("aria-label", "Zamknij");
5253
+ button.setAttribute("aria-label", t("close", {}, this.el));
5017
5254
  button.setAttribute("data-pl-popover-close", "");
5018
5255
  return button;
5019
5256
  };
@@ -5359,7 +5596,7 @@
5359
5596
  __publicField(Modal, "defaults", { ...Overlay.defaults });
5360
5597
  register("modal", Modal);
5361
5598
  delegateOpen("modal");
5362
- var labels = { ok: "OK", cancel: "Anuluj", close: "Zamknij" };
5599
+ var labels = {};
5363
5600
  var escapeHtml3 = (value) => String(value ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
5364
5601
  function dialog(content, options = {}) {
5365
5602
  const { cls = "", ...rest } = options;
@@ -5384,8 +5621,8 @@
5384
5621
  const {
5385
5622
  title = "",
5386
5623
  html = false,
5387
- ok = labels.ok,
5388
- cancel = labels.cancel,
5624
+ ok = labels.ok ?? t("modal.ok"),
5625
+ cancel = labels.cancel ?? t("modal.cancel"),
5389
5626
  tone = "primary",
5390
5627
  cls = "pl-modal-small pl-modal-center",
5391
5628
  placeholder = "",
@@ -5449,7 +5686,7 @@
5449
5686
  this.side = side;
5450
5687
  SIDES.forEach((name) => el.classList.toggle(`pl-offcanvas-${name}`, name === side));
5451
5688
  el.classList.toggle("pl-offcanvas-no-overlay", !this.options.overlay);
5452
- if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) el.setAttribute("aria-label", "Panel boczny");
5689
+ if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) el.setAttribute("aria-label", t("offcanvas.label", {}, el));
5453
5690
  this.on(el, "click", (event) => {
5454
5691
  if (!this.options.anchorClose) return;
5455
5692
  const link = event.target.closest('a[href^="#"]');
@@ -5649,7 +5886,7 @@
5649
5886
  const close = document.createElement("button");
5650
5887
  close.type = "button";
5651
5888
  close.className = "pl-close pl-notification-close";
5652
- close.setAttribute("aria-label", "Zamknij powiadomienie");
5889
+ close.setAttribute("aria-label", t("notification.close"));
5653
5890
  close.addEventListener("click", () => this.close());
5654
5891
  el.append(close);
5655
5892
  }
@@ -5917,20 +6154,20 @@
5917
6154
  const el = document.createElement("dialog");
5918
6155
  el.className = `pl-lightbox pl-lightbox-${animation === "fade" ? "fade" : "slide"}`;
5919
6156
  el.dataset.plTheme = "dark";
5920
- el.setAttribute("aria-label", "Galeria");
5921
- el.setAttribute("aria-roledescription", "galeria");
6157
+ el.setAttribute("aria-label", t("lightbox.label", {}, el));
6158
+ el.setAttribute("aria-roledescription", t("lightbox.role", {}, el));
5922
6159
  el.innerHTML = `
5923
6160
  <div class="pl-lightbox-backdrop"></div>
5924
6161
  <div class="pl-lightbox-toolbar">
5925
6162
  ${counter && many ? '<span class="pl-lightbox-counter" aria-live="polite"></span>' : ""}
5926
- <button class="pl-close pl-lightbox-close" type="button" aria-label="Zamknij"></button>
6163
+ <button class="pl-close pl-lightbox-close" type="button" aria-label="${t("close", {}, el)}"></button>
5927
6164
  </div>
5928
6165
  <div class="pl-lightbox-stage"></div>
5929
- ${many ? `<button class="pl-lightbox-nav pl-lightbox-previous pl-slidenav-previous" type="button" aria-label="Poprzedni">${ICONS2.previous}</button>
5930
- <button class="pl-lightbox-nav pl-lightbox-next pl-slidenav-next" type="button" aria-label="Nast\u0119pny">${ICONS2.next}</button>` : ""}
6166
+ ${many ? `<button class="pl-lightbox-nav pl-lightbox-previous pl-slidenav-previous" type="button" aria-label="${t("previous", {}, el)}">${ICONS2.previous}</button>
6167
+ <button class="pl-lightbox-nav pl-lightbox-next pl-slidenav-next" type="button" aria-label="${t("next", {}, el)}">${ICONS2.next}</button>` : ""}
5931
6168
  <div class="pl-lightbox-footer">
5932
6169
  <div class="pl-lightbox-caption"></div>
5933
- ${thumbs && many ? '<div class="pl-lightbox-thumbs" role="tablist" aria-label="Miniatury"></div>' : ""}
6170
+ ${thumbs && many ? `<div class="pl-lightbox-thumbs" role="tablist" aria-label="${t("lightbox.thumbs", {}, el)}"></div>` : ""}
5934
6171
  </div>`;
5935
6172
  this.el = el;
5936
6173
  this.stage = el.querySelector(".pl-lightbox-stage");
@@ -5945,7 +6182,7 @@
5945
6182
  button.type = "button";
5946
6183
  button.className = "pl-lightbox-thumb";
5947
6184
  button.setAttribute("role", "tab");
5948
- button.setAttribute("aria-label", `Pozycja ${i + 1}${item.caption ? `: ${item.caption}` : ""}`);
6185
+ button.setAttribute("aria-label", `${t("lightbox.item", { n: i + 1 }, this.el)}${item.caption ? `: ${item.caption}` : ""}`);
5949
6186
  const src = item.thumb || (item.type === "image" ? item.source : "");
5950
6187
  if (src) {
5951
6188
  const img = document.createElement("img");
@@ -6055,7 +6292,7 @@
6055
6292
  const spinner = document.createElement("div");
6056
6293
  spinner.className = "pl-lightbox-spinner";
6057
6294
  spinner.setAttribute("role", "status");
6058
- spinner.setAttribute("aria-label", "Wczytywanie");
6295
+ spinner.setAttribute("aria-label", t("loading", {}, this.el));
6059
6296
  const done = () => {
6060
6297
  wrap.classList.remove("pl-loading");
6061
6298
  spinner.remove();
@@ -6064,7 +6301,7 @@
6064
6301
  done();
6065
6302
  const error = document.createElement("div");
6066
6303
  error.className = "pl-lightbox-error";
6067
- error.textContent = "Nie uda\u0142o si\u0119 wczyta\u0107 zawarto\u015Bci.";
6304
+ error.textContent = t("lightbox.error", {}, this.el);
6068
6305
  wrap.querySelector(".pl-lightbox-media")?.replaceWith(error);
6069
6306
  };
6070
6307
  let media;
@@ -6081,7 +6318,7 @@
6081
6318
  media = document.createElement("iframe");
6082
6319
  media.allow = "autoplay; fullscreen; picture-in-picture; encrypted-media";
6083
6320
  media.allowFullscreen = true;
6084
- media.title = item.caption || "Osadzona tre\u015B\u0107";
6321
+ media.title = item.caption || t("lightbox.embed", {}, this.el);
6085
6322
  media.addEventListener("load", done, { once: true });
6086
6323
  media.src = embedUrl(item.source);
6087
6324
  } else {
@@ -6872,12 +7109,12 @@
6872
7109
 
6873
7110
  // src/js/components/scroll.js
6874
7111
  var EASINGS = {
6875
- linear: (t) => t,
6876
- "ease-in": (t) => t * t * t,
6877
- "ease-out": (t) => 1 - (1 - t) ** 4,
6878
- "ease-in-out": (t) => t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2,
7112
+ linear: (t2) => t2,
7113
+ "ease-in": (t2) => t2 * t2 * t2,
7114
+ "ease-out": (t2) => 1 - (1 - t2) ** 4,
7115
+ "ease-in-out": (t2) => t2 < 0.5 ? 8 * t2 ** 4 : 1 - (-2 * t2 + 2) ** 4 / 2,
6879
7116
  // Lekkie przestrzelenie i powrót.
6880
- spring: (t) => 1 + 2.2 * (t - 1) ** 3 + 1.2 * (t - 1) ** 2
7117
+ spring: (t2) => 1 + 2.2 * (t2 - 1) ** 3 + 1.2 * (t2 - 1) ** 2
6881
7118
  };
6882
7119
  var running = /* @__PURE__ */ new WeakMap();
6883
7120
  function scrollParent(el) {
@@ -6931,9 +7168,9 @@
6931
7168
  finish(false);
6932
7169
  };
6933
7170
  const step = (now) => {
6934
- const t = clamp((now - startTime) / time, 0, 1);
6935
- container.scrollTop = start2 + distance * ease(t);
6936
- if (t < 1) frame = requestAnimationFrame(step);
7171
+ const t2 = clamp((now - startTime) / time, 0, 1);
7172
+ container.scrollTop = start2 + distance * ease(t2);
7173
+ if (t2 < 1) frame = requestAnimationFrame(step);
6937
7174
  else {
6938
7175
  container.scrollTop = end;
6939
7176
  finish(true);
@@ -7726,9 +7963,9 @@
7726
7963
  function velocityTracker() {
7727
7964
  let samples = [];
7728
7965
  return {
7729
- add(x, t) {
7730
- samples.push({ x, t });
7731
- while (samples.length > 2 && t - samples[0].t > 100) samples.shift();
7966
+ add(x, t2) {
7967
+ samples.push({ x, t: t2 });
7968
+ while (samples.length > 2 && t2 - samples[0].t > 100) samples.shift();
7732
7969
  },
7733
7970
  get(now) {
7734
7971
  if (samples.length < 2) return 0;
@@ -7757,11 +7994,11 @@
7757
7994
  this._timer = 0;
7758
7995
  this._remaining = 0;
7759
7996
  this._startedAt = 0;
7760
- const L = this.constructor.labels;
7997
+ const carousel = t("slider.carousel", {}, el);
7761
7998
  if (!el.hasAttribute("role")) el.setAttribute("role", "region");
7762
- el.setAttribute("aria-roledescription", L.carousel);
7999
+ el.setAttribute("aria-roledescription", carousel);
7763
8000
  if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) {
7764
- el.setAttribute("aria-label", L.carousel[0].toUpperCase() + L.carousel.slice(1));
8001
+ el.setAttribute("aria-label", carousel[0].toUpperCase() + carousel.slice(1));
7765
8002
  }
7766
8003
  if (!el.hasAttribute("tabindex")) el.tabIndex = 0;
7767
8004
  (_a = this.list).id || (_a.id = uid(`pl-${p}`));
@@ -7821,20 +8058,19 @@
7821
8058
  }
7822
8059
  /** Opisuje slajdy dla czytników ekranu. */
7823
8060
  labelSlides() {
7824
- const L = this.constructor.labels;
7825
8061
  const slides = this.slides;
8062
+ const role = t("slider.slide", {}, this.el);
7826
8063
  slides.forEach((slide, i) => {
7827
8064
  if (!slide.matches("li")) slide.setAttribute("role", "group");
7828
- slide.setAttribute("aria-roledescription", L.slide);
8065
+ slide.setAttribute("aria-roledescription", role);
7829
8066
  if (slide.hasAttribute("aria-label") && !slide.dataset.plAuto) return;
7830
8067
  slide.dataset.plAuto = "1";
7831
- slide.setAttribute("aria-label", `${i + 1} ${L.of} ${slides.length}`);
8068
+ slide.setAttribute("aria-label", t("slider.position", { n: i + 1, count: slides.length }, this.el));
7832
8069
  });
7833
8070
  }
7834
8071
  /** Buduje kropki w pustych `.pl-{p}-nav` i numeruje pozycje własnych nawigacji. */
7835
8072
  buildNav() {
7836
8073
  const p = this.constructor.prefix;
7837
- const L = this.constructor.labels;
7838
8074
  const indexes = this.navIndexes();
7839
8075
  for (const nav of $$(`.pl-${p}-nav`, this.el)) {
7840
8076
  if (!this.owns(nav)) continue;
@@ -7842,7 +8078,7 @@
7842
8078
  this.generatedNavs.add(nav);
7843
8079
  const current2 = [...nav.children].map((li) => li.getAttribute(this.attr)).join();
7844
8080
  if (current2 !== indexes.join()) {
7845
- nav.innerHTML = indexes.map((i) => `<li ${this.attr}="${i}"><a href="#" role="button" aria-label="${L.goto} ${i + 1}"></a></li>`).join("");
8081
+ nav.innerHTML = indexes.map((i) => `<li ${this.attr}="${i}"><a href="#" role="button" aria-label="${t("slider.goto", { n: i + 1 }, this.el)}"></a></li>`).join("");
7846
8082
  }
7847
8083
  } else {
7848
8084
  [...nav.children].forEach((item, i) => {
@@ -7945,14 +8181,6 @@
7945
8181
  }
7946
8182
  };
7947
8183
  __publicField(Carousel, "prefix", "slider");
7948
- __publicField(Carousel, "labels", {
7949
- carousel: "karuzela",
7950
- slide: "slajd",
7951
- of: "z",
7952
- previous: "Poprzedni slajd",
7953
- next: "Nast\u0119pny slajd",
7954
- goto: "Slajd"
7955
- });
7956
8184
  var Slider = class extends Carousel {
7957
8185
  init() {
7958
8186
  if (!this.setup()) return;
@@ -8652,7 +8880,7 @@
8652
8880
  helpText = document.createElement("div");
8653
8881
  helpText.id = "pl-sortable-help";
8654
8882
  helpText.hidden = true;
8655
- helpText.textContent = "Naci\u015Bnij spacj\u0119, aby podnie\u015B\u0107 element. Strza\u0142kami zmie\u0144 jego pozycj\u0119, spacj\u0105 lub Enterem upu\u015B\u0107, klawiszem Escape anuluj.";
8883
+ helpText.textContent = t("sortable.help");
8656
8884
  liveRegion = document.createElement("div");
8657
8885
  liveRegion.setAttribute("aria-live", "assertive");
8658
8886
  liveRegion.setAttribute("aria-atomic", "true");
@@ -8746,7 +8974,7 @@
8746
8974
  if (!item.dataset.plSortableTab && item.hasAttribute("tabindex")) continue;
8747
8975
  item.dataset.plSortableTab = item === current2 ? "0" : "-1";
8748
8976
  item.tabIndex = item === current2 ? 0 : -1;
8749
- item.setAttribute("aria-roledescription", "element sortowalny");
8977
+ item.setAttribute("aria-roledescription", t("sortable.role", {}, this.el));
8750
8978
  item.setAttribute("aria-describedby", help.id);
8751
8979
  }
8752
8980
  }
@@ -8884,22 +9112,22 @@
8884
9112
  return;
8885
9113
  }
8886
9114
  if (animating.has(target)) return;
8887
- const t = target.getBoundingClientRect();
9115
+ const t2 = target.getBoundingClientRect();
8888
9116
  const r = item.getBoundingClientRect();
8889
9117
  let before;
8890
9118
  if (item.parentElement === sortable.el) {
8891
9119
  before = Boolean(item.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_PRECEDING);
8892
- const sameRow = t.top < r.bottom - 1 && t.bottom > r.top + 1;
8893
- if (sameRow && t.width > r.width + 1) {
8894
- if (before ? s.x > t.left + r.width : s.x < t.right - r.width) return;
8895
- } else if (!sameRow && t.height > r.height + 1) {
8896
- if (before ? s.y > t.top + r.height : s.y < t.bottom - r.height) return;
9120
+ const sameRow = t2.top < r.bottom - 1 && t2.bottom > r.top + 1;
9121
+ if (sameRow && t2.width > r.width + 1) {
9122
+ if (before ? s.x > t2.left + r.width : s.x < t2.right - r.width) return;
9123
+ } else if (!sameRow && t2.height > r.height + 1) {
9124
+ if (before ? s.y > t2.top + r.height : s.y < t2.bottom - r.height) return;
8897
9125
  }
8898
9126
  } else {
8899
9127
  const sibling = target.nextElementSibling || target.previousElementSibling;
8900
9128
  const sr = sibling?.getBoundingClientRect();
8901
- const horizontal = sr ? sr.top < t.bottom - 1 && sr.bottom > t.top + 1 : false;
8902
- before = horizontal ? s.x < t.left + t.width / 2 : s.y < t.top + t.height / 2;
9129
+ const horizontal = sr ? sr.top < t2.bottom - 1 && sr.bottom > t2.top + 1 : false;
9130
+ before = horizontal ? s.x < t2.left + t2.width / 2 : s.y < t2.top + t2.height / 2;
8903
9131
  }
8904
9132
  this.insert(sortable, before ? target : target.nextElementSibling);
8905
9133
  }
@@ -9030,7 +9258,7 @@
9030
9258
  if (!this.emit("start", { item, index, from: index }, true)) return;
9031
9259
  this.kb = { item, next: item.nextElementSibling, index };
9032
9260
  item.classList.add("pl-sortable-grabbed");
9033
- announce(`Podniesiono: ${this.label(item)}. Pozycja ${index + 1} z ${count}. Strza\u0142kami zmie\u0144 pozycj\u0119, spacj\u0105 upu\u015B\u0107, Escape anuluje.`);
9261
+ announce(t("sortable.lifted", { label: this.label(item), n: index + 1, count }, this.el));
9034
9262
  } else if (arrow || key === "Home" || key === "End") {
9035
9263
  const next = key === "Home" ? this.items[0] : key === "End" ? this.items[count - 1] : this.neighbor(item, key);
9036
9264
  if (next) {
@@ -9050,7 +9278,7 @@
9050
9278
  item.focus({ preventScroll: true });
9051
9279
  this.kbMoving = false;
9052
9280
  item.scrollIntoView({ block: "nearest", inline: "nearest" });
9053
- announce(`Pozycja ${this.items.indexOf(item) + 1} z ${count}.`);
9281
+ announce(t("sortable.moved", { n: this.items.indexOf(item) + 1, count }, this.el));
9054
9282
  } else if (key === " " || key === "Enter") {
9055
9283
  event.preventDefault();
9056
9284
  this.dropKey();
@@ -9077,7 +9305,7 @@
9077
9305
  const to = this.items.indexOf(item);
9078
9306
  const count = this.items.length;
9079
9307
  announce(
9080
- cancelled ? `Anulowano. ${this.label(item)} wraca na pozycj\u0119 ${to + 1} z ${count}.` : `Upuszczono: ${this.label(item)}. Pozycja ${to + 1} z ${count}.`
9308
+ cancelled ? t("sortable.cancelled", { label: this.label(item), n: to + 1, count }, this.el) : t("sortable.dropped", { label: this.label(item), n: to + 1, count }, this.el)
9081
9309
  );
9082
9310
  if (to !== k.index) this.emit("moved", { item, from: k.index, to });
9083
9311
  this.emit("stop", { item, from: k.index, to, target: this, cancelled });
@@ -9100,7 +9328,6 @@
9100
9328
  // src/js/components/filter.js
9101
9329
  var EASE3 = "cubic-bezier(0.33, 0.5, 0.2, 1)";
9102
9330
  var CONTROL = "[data-pl-filter-control]";
9103
- var collator = typeof Intl !== "undefined" ? new Intl.Collator("pl", { numeric: true, sensitivity: "base" }) : null;
9104
9331
  function parseControl(control) {
9105
9332
  const raw = control.getAttribute("data-pl-filter-control") || "";
9106
9333
  const parsed = parseOptions(raw, { filter: "", group: "", sort: "", order: "asc" }, "filter");
@@ -9226,7 +9453,8 @@
9226
9453
  const [attribute, order] = this.state.sort;
9227
9454
  let sorted = children;
9228
9455
  if (attribute) {
9229
- const compare = (a, b) => collator ? collator.compare(a, b) : a < b ? -1 : a > b ? 1 : 0;
9456
+ const collator = new Intl.Collator(langOf(this.el), { numeric: true, sensitivity: "base" });
9457
+ const compare = (a, b) => collator.compare(a, b);
9230
9458
  sorted = [...children].sort(
9231
9459
  (a, b) => compare(a.getAttribute(attribute) || "", b.getAttribute(attribute) || "") * (order === "desc" ? -1 : 1)
9232
9460
  );
@@ -9490,9 +9718,9 @@
9490
9718
 
9491
9719
  // src/js/components/counter.js
9492
9720
  var EASINGS2 = {
9493
- linear: (t) => t,
9494
- "ease-out": (t) => 1 - (1 - t) ** 4,
9495
- "ease-in-out": (t) => t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2
9721
+ linear: (t2) => t2,
9722
+ "ease-out": (t2) => 1 - (1 - t2) ** 4,
9723
+ "ease-in-out": (t2) => t2 < 0.5 ? 8 * t2 ** 4 : 1 - (-2 * t2 + 2) ** 4 / 2
9496
9724
  };
9497
9725
  var Counter = class extends Component {
9498
9726
  init() {
@@ -9501,21 +9729,30 @@
9501
9729
  this.timer = 0;
9502
9730
  this.done = false;
9503
9731
  const text = el.textContent.trim();
9732
+ options.locale ?? (options.locale = langOf(el));
9504
9733
  if (options.to === null || options.to === "") {
9505
- const parsed = parseFloat(text.replace(/[^\d,.-]/g, "").replace(/\.(?=\d{3}(\D|$))/g, "").replace(",", "."));
9734
+ const decimal = (() => {
9735
+ try {
9736
+ return new Intl.NumberFormat(options.locale).format(1.5).replace(/\d/g, "") || ".";
9737
+ } catch {
9738
+ return ".";
9739
+ }
9740
+ })();
9741
+ const digits = text.replace(new RegExp(`[^\\d\\-${decimal === "." ? "\\." : decimal}]`, "g"), "");
9742
+ const parsed = parseFloat(decimal === "." ? digits : digits.replace(decimal, "."));
9506
9743
  this.to = Number.isNaN(parsed) ? 0 : parsed;
9507
9744
  } else {
9508
9745
  this.to = Number(options.to) || 0;
9509
9746
  }
9510
9747
  this.from = Number(options.from) || 0;
9511
9748
  try {
9512
- this.formatter = new Intl.NumberFormat(options.locale || "pl-PL", {
9749
+ this.formatter = new Intl.NumberFormat(options.locale || "en", {
9513
9750
  minimumFractionDigits: options.decimals,
9514
9751
  maximumFractionDigits: options.decimals,
9515
9752
  useGrouping: "always"
9516
9753
  });
9517
9754
  } catch {
9518
- this.formatter = new Intl.NumberFormat("pl-PL", { minimumFractionDigits: options.decimals, maximumFractionDigits: options.decimals });
9755
+ this.formatter = new Intl.NumberFormat("en", { minimumFractionDigits: options.decimals, maximumFractionDigits: options.decimals });
9519
9756
  }
9520
9757
  this.visual = document.createElement("span");
9521
9758
  this.visual.setAttribute("aria-hidden", "true");
@@ -9602,9 +9839,9 @@
9602
9839
  const run = () => {
9603
9840
  const startTime = performance.now();
9604
9841
  const step = (now) => {
9605
- const t = Math.min((now - startTime) / duration, 1);
9606
- if (t < 1) {
9607
- this.render(from + (end - from) * ease(t));
9842
+ const t2 = Math.min((now - startTime) / duration, 1);
9843
+ if (t2 < 1) {
9844
+ this.render(from + (end - from) * ease(t2));
9608
9845
  this.frame = requestAnimationFrame(step);
9609
9846
  } else {
9610
9847
  this.frame = 0;
@@ -9625,12 +9862,13 @@
9625
9862
  delay: 0,
9626
9863
  decimals: 0,
9627
9864
  separator: null,
9628
- // separator tysięcy; domyślnie wg locale (pl-PL: spacja niełamiąca)
9865
+ // separator tysięcy; domyślnie wg języka (pl: spacja niełamiąca, en: przecinek)
9629
9866
  decimal: null,
9630
- // separator dziesiętny; domyślnie wg locale (pl-PL: przecinek)
9867
+ // separator dziesiętny; domyślnie wg języka (pl: przecinek, en: kropka)
9631
9868
  prefix: "",
9632
9869
  suffix: "",
9633
- locale: "pl-PL",
9870
+ locale: null,
9871
+ // domyślnie język strony (atrybut lang)
9634
9872
  easing: "ease-out",
9635
9873
  // linear | ease-out | ease-in-out
9636
9874
  once: true,