@adyen/adyen-platform-experience-web 1.0.2 → 1.0.3

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.
Files changed (54) hide show
  1. package/dist/cjs/index.js +2 -2
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/es/components/internal/Calendar/calendar/facade/Calendar.js +221 -211
  4. package/dist/es/components/internal/Calendar/calendar/timeframe/frames/MonthFrame.js +103 -94
  5. package/dist/es/components/internal/Calendar/calendar/timeframe/frames/TimeFrame.js +201 -200
  6. package/dist/es/components/internal/Calendar/calendar/timerange/presets/lastNDays.js +19 -18
  7. package/dist/es/components/internal/Calendar/calendar/timerange/presets/shared/offsetMonth.js +18 -17
  8. package/dist/es/components/internal/Calendar/calendar/timerange/presets/shared/offsetWeek.js +17 -20
  9. package/dist/es/components/internal/Calendar/calendar/timerange/presets/yearToDate.js +9 -12
  10. package/dist/es/components/internal/Calendar/calendar/timerange/utils.js +39 -43
  11. package/dist/es/components/internal/Calendar/calendar/timeslice/TimeSlice.js +10 -10
  12. package/dist/es/components/internal/Calendar/calendar/timeslice/index.js +25 -26
  13. package/dist/es/components/internal/Calendar/calendar/utils.js +64 -16
  14. package/dist/es/components/internal/Calendar/hooks/useCalendar.js +40 -38
  15. package/dist/es/components/internal/Calendar/hooks/useTimezone.js +2 -2
  16. package/dist/es/components/internal/DatePicker/DatePicker.js +17 -16
  17. package/dist/es/components/internal/FilterBar/filters/AmountFilter/AmountFilter.js +14 -14
  18. package/dist/es/components/internal/FilterBar/filters/AmountFilter/RangeSelection.js +19 -17
  19. package/dist/es/components/internal/FilterBar/filters/DateFilter/DateFilterCore.js +81 -76
  20. package/dist/es/core/Http/utils.js +1 -1
  21. package/dist/es/core/Localization/datetime/restamper/utils.js +26 -26
  22. package/dist/es/core/core.js +1 -1
  23. package/dist/es/primitives/time/today/main.js +38 -43
  24. package/dist/style.css +1 -1
  25. package/dist/types/components/internal/Calendar/calendar/facade/Calendar.d.ts.map +1 -1
  26. package/dist/types/components/internal/Calendar/calendar/timeframe/frames/MonthFrame.d.ts +1 -1
  27. package/dist/types/components/internal/Calendar/calendar/timeframe/frames/MonthFrame.d.ts.map +1 -1
  28. package/dist/types/components/internal/Calendar/calendar/timeframe/frames/TimeFrame.d.ts +3 -3
  29. package/dist/types/components/internal/Calendar/calendar/timeframe/frames/TimeFrame.d.ts.map +1 -1
  30. package/dist/types/components/internal/Calendar/calendar/timeframe/frames/YearFrame.d.ts +1 -1
  31. package/dist/types/components/internal/Calendar/calendar/timeframe/frames/YearFrame.d.ts.map +1 -1
  32. package/dist/types/components/internal/Calendar/calendar/timerange/presets/lastNDays.d.ts.map +1 -1
  33. package/dist/types/components/internal/Calendar/calendar/timerange/presets/shared/offsetMonth.d.ts.map +1 -1
  34. package/dist/types/components/internal/Calendar/calendar/timerange/presets/shared/offsetWeek.d.ts.map +1 -1
  35. package/dist/types/components/internal/Calendar/calendar/timerange/presets/yearToDate.d.ts.map +1 -1
  36. package/dist/types/components/internal/Calendar/calendar/timerange/utils.d.ts +0 -5
  37. package/dist/types/components/internal/Calendar/calendar/timerange/utils.d.ts.map +1 -1
  38. package/dist/types/components/internal/Calendar/calendar/timeslice/TimeSlice.d.ts +2 -2
  39. package/dist/types/components/internal/Calendar/calendar/timeslice/TimeSlice.d.ts.map +1 -1
  40. package/dist/types/components/internal/Calendar/calendar/timeslice/index.d.ts.map +1 -1
  41. package/dist/types/components/internal/Calendar/calendar/types.d.ts +6 -1
  42. package/dist/types/components/internal/Calendar/calendar/types.d.ts.map +1 -1
  43. package/dist/types/components/internal/Calendar/calendar/utils.d.ts +13 -4
  44. package/dist/types/components/internal/Calendar/calendar/utils.d.ts.map +1 -1
  45. package/dist/types/components/internal/Calendar/hooks/useCalendar.d.ts +1 -1
  46. package/dist/types/components/internal/Calendar/hooks/useCalendar.d.ts.map +1 -1
  47. package/dist/types/components/internal/Calendar/types.d.ts +1 -0
  48. package/dist/types/components/internal/Calendar/types.d.ts.map +1 -1
  49. package/dist/types/components/internal/DatePicker/DatePicker.d.ts.map +1 -1
  50. package/dist/types/components/internal/FilterBar/filters/AmountFilter/RangeSelection.d.ts.map +1 -1
  51. package/dist/types/components/internal/FilterBar/filters/DateFilter/DateFilterCore.d.ts.map +1 -1
  52. package/dist/types/core/Localization/datetime/restamper/utils.d.ts.map +1 -1
  53. package/dist/types/primitives/time/today/main.d.ts.map +1 -1
  54. package/package.json +2 -1
@@ -7,15 +7,15 @@ import { jsx as D } from "../../../../../external/preact/jsx-runtime/dist/jsxRun
7
7
  import F from "../BaseFilter/BaseFilter.js";
8
8
  import { isUndefined as f } from "../../../../../utils/value/is.js";
9
9
  import { EMPTY_OBJECT as O } from "../../../../../utils/value/constants.js";
10
- const H = ({
11
- updateFilters: $,
10
+ const G = ({
11
+ updateFilters: p,
12
12
  selectedCurrencies: t,
13
13
  availableCurrencies: m,
14
14
  ...y
15
15
  }) => {
16
16
  const {
17
17
  i18n: g
18
- } = B(), [S, U] = E(), [M, x] = E(), h = w(() => (t == null ? void 0 : t.length) === 1 || (m == null ? void 0 : m.length) === 1, [m == null ? void 0 : m.length, t == null ? void 0 : t.length]), p = L((n, o) => {
18
+ } = B(), [h, U] = E(), [$, x] = E(), M = w(() => (t == null ? void 0 : t.length) === 1 || (m == null ? void 0 : m.length) === 1, [m == null ? void 0 : m.length, t == null ? void 0 : t.length]), S = L((n, o) => {
19
19
  const A = (t == null ? void 0 : t[0]) || (m == null ? void 0 : m[0]), I = o && A ? {
20
20
  style: "currency",
21
21
  currency: A,
@@ -30,26 +30,26 @@ const H = ({
30
30
  U({
31
31
  minAmount: o,
32
32
  maxAmount: A
33
- }), f(o) && f(A) && x(void 0), $({
34
- minAmount: f(o) ? void 0 : String(o * T),
35
- maxAmount: f(A) ? void 0 : String(A * T)
33
+ }), f(o) && f(A) && x(void 0), p({
34
+ minAmount: f(o) ? void 0 : String(Math.round(o * T)),
35
+ maxAmount: f(A) ? void 0 : String(Math.round(A * T))
36
36
  });
37
- }, [$]);
38
- if (S && (S.minAmount || S.maxAmount)) {
37
+ }, [p]);
38
+ if (h && (h.minAmount || h.maxAmount)) {
39
39
  const {
40
40
  minAmount: n,
41
41
  maxAmount: o
42
- } = S ?? {};
43
- !f(n) && !f(o) && n <= o ? x(`${p(n, h)} ${g.get("to").toLowerCase()} ${p(o, h)}`) : !f(n) && f(o) && n >= 0 ? x(`${g.get("from")} ${p(n, h)}`) : f(n) && !f(o) ? x(`${g.get("to")} ${p(o, h)}`) : x(void 0);
42
+ } = h ?? {};
43
+ !f(n) && !f(o) && n <= o ? x(`${S(n, M)} ${g.get("to").toLowerCase()} ${S(o, M)}`) : !f(n) && f(o) && n >= 0 ? x(`${g.get("from")} ${S(n, M)}`) : f(n) && !f(o) ? x(`${g.get("to")} ${S(o, M)}`) : x(void 0);
44
44
  }
45
45
  return D(F, {
46
46
  ...y,
47
- updateFilters: $,
47
+ updateFilters: p,
48
48
  minAmount: y.minAmount,
49
49
  maxAmount: y.maxAmount,
50
50
  onChange: V,
51
- value: M,
52
- label: M || y.label,
51
+ value: $,
52
+ label: $ || y.label,
53
53
  type: "text",
54
54
  containerSize: z.MEDIUM,
55
55
  selectedCurrencies: t,
@@ -58,5 +58,5 @@ const H = ({
58
58
  });
59
59
  };
60
60
  export {
61
- H as AmountFilter
61
+ G as AmountFilter
62
62
  };
@@ -1,10 +1,10 @@
1
- import p from "../../../FormFields/InputBase.js";
1
+ import A from "../../../FormFields/InputBase.js";
2
2
  import "./AmountFilter.scss.js";
3
- import { useState as A, useCallback as g, useEffect as x, useMemo as b } from "../../../../../external/preact/hooks/dist/hooks.module.js";
3
+ import { useState as g, useCallback as p, useEffect as x, useMemo as b } from "../../../../../external/preact/hooks/dist/hooks.module.js";
4
4
  import h from "../../../../../core/Context/useCoreContext.js";
5
5
  import { AMOUNT_MULTIPLIER as T } from "./constants.js";
6
6
  import { jsx as r } from "../../../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js";
7
- import { isUndefined as i } from "../../../../../utils/value/is.js";
7
+ import { isUndefined as o } from "../../../../../utils/value/is.js";
8
8
  import { CommitAction as F } from "../../../../../hooks/useCommitAction/types.js";
9
9
  const R = ({
10
10
  onChange: l,
@@ -12,45 +12,46 @@ const R = ({
12
12
  onValueUpdated: s,
13
13
  selectedCurrencies: I,
14
14
  availableCurrencies: M,
15
- value: y,
15
+ value: V,
16
16
  ...m
17
17
  }) => {
18
18
  const {
19
19
  i18n: n
20
- } = h(), [e, c] = A(i(m.minAmount) ? void 0 : parseFloat(m.minAmount) / T), [t, v] = A(i(m.maxAmount) ? void 0 : parseFloat(m.maxAmount) / T), d = g(() => {
20
+ } = h(), [e, c] = g(o(m.minAmount) ? void 0 : parseFloat(m.minAmount) / T), [t, d] = g(o(m.maxAmount) ? void 0 : parseFloat(m.maxAmount) / T), v = p(() => {
21
21
  l({
22
22
  minAmount: e,
23
23
  maxAmount: t
24
24
  });
25
- }, [t, e, l]), f = g(() => {
25
+ }, [t, e, l]), f = p(() => {
26
26
  l({
27
27
  minAmount: void 0,
28
28
  maxAmount: void 0
29
- }), v(void 0), c(void 0);
29
+ }), d(void 0), c(void 0);
30
30
  }, [l]);
31
31
  x(() => {
32
- u === F.APPLY && d(), u === F.CLEAR && f();
33
- }, [d, f, u]);
34
- const o = b(() => ({
32
+ u === F.APPLY && v(), u === F.CLEAR && f();
33
+ }, [v, f, u]);
34
+ const i = b(() => ({
35
35
  minAmount: e,
36
36
  maxAmount: t
37
37
  }), [t, e]);
38
38
  return x(() => {
39
- o.minAmount || o.maxAmount ? s(`${o.minAmount}-${o.maxAmount}`) : s(null);
40
- }, [o, s]), r("div", {
39
+ i.minAmount || i.maxAmount ? s(`${i.minAmount}-${i.maxAmount}`) : s(null);
40
+ }, [i, s]), r("div", {
41
41
  className: "adyen-pe-range-selection-filter",
42
42
  children: [r("div", {
43
43
  className: "adyen-pe-range-selection-filter__input",
44
44
  children: [r("label", {
45
45
  htmlFor: "minValue",
46
46
  children: `${n.get("from")}:`
47
- }), r(p, {
47
+ }), r(A, {
48
+ "data-testid": "minValueFilter",
48
49
  lang: n.locale,
49
50
  name: "minValue",
50
51
  type: "number",
51
52
  value: e,
52
53
  onInput: (a) => {
53
- a.currentTarget && c(a.currentTarget.value !== "" ? parseFloat(a.currentTarget.value) : void 0);
54
+ a.currentTarget && c(a.currentTarget.value !== "" ? a.currentTarget.value : void 0);
54
55
  },
55
56
  min: 0,
56
57
  isInvalid: e ? e < 0 : !1,
@@ -61,16 +62,17 @@ const R = ({
61
62
  children: [r("label", {
62
63
  htmlFor: "maxValue",
63
64
  children: `${n.get("to")}:`
64
- }), r(p, {
65
+ }), r(A, {
66
+ "data-testid": "maxValueFilter",
65
67
  lang: n.locale,
66
68
  name: "maxValue",
67
69
  type: "number",
68
70
  value: t,
69
71
  onInput: (a) => {
70
- a.currentTarget && v(a.currentTarget.value !== "" ? parseFloat(a.currentTarget.value) : void 0);
72
+ a.currentTarget && d(a.currentTarget.value !== "" ? a.currentTarget.value : void 0);
71
73
  },
72
74
  min: e,
73
- isInvalid: !i(t) && !i(e) && t < e,
75
+ isInvalid: !o(t) && !o(e) && t < e,
74
76
  errorMessage: n.get("toValueShouldBeGreaterThanTheFromValue")
75
77
  })]
76
78
  })]
@@ -1,25 +1,26 @@
1
- import k from "../../../../hooks/useTimezoneAwareDateFormatting.js";
2
- import { useState as p, useCallback as v, useMemo as R, useEffect as C, useRef as I } from "../../../../../external/preact/hooks/dist/hooks.module.js";
3
- import x from "../../../../../core/Context/useCoreContext.js";
4
- import { DateRangeFilterParam as E } from "./types.js";
1
+ import B from "../../../../hooks/useTimezoneAwareDateFormatting.js";
2
+ import { useState as h, useCallback as M, useMemo as T, useEffect as E, useRef as x } from "../../../../../external/preact/hooks/dist/hooks.module.js";
3
+ import { BASE_LOCALE as L } from "../../../../../core/Localization/datetime/restamper/constants.js";
4
+ import k from "../../../../../core/Context/useCoreContext.js";
5
+ import { DateRangeFilterParam as b } from "./types.js";
5
6
  import "./DateFilterCore.scss.js";
6
7
  import { jsx as S } from "../../../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js";
7
- import V from "../BaseFilter/BaseFilter.js";
8
- import L from "../../../DatePicker/DatePicker.js";
9
- import { EMPTY_OBJECT as Y } from "../../../../../utils/value/constants.js";
10
- import { CommitAction as M } from "../../../../../hooks/useCommitAction/types.js";
11
- const B = {
8
+ import _ from "../BaseFilter/BaseFilter.js";
9
+ import z from "../../../DatePicker/DatePicker.js";
10
+ import { EMPTY_OBJECT as I } from "../../../../../utils/value/constants.js";
11
+ import { CommitAction as A } from "../../../../../hooks/useCommitAction/types.js";
12
+ const V = {
12
13
  month: "short",
13
14
  day: "numeric",
14
15
  year: "numeric"
15
- }, _ = new Intl.DateTimeFormat("en-US", B), A = (s, t, n, o) => {
16
- const e = n && t(n), r = o && t(o);
17
- if (e && r)
18
- return `${e} - ${r}`;
19
- if (e)
16
+ }, v = (s, e, n, o) => {
17
+ const t = n && e(n), r = o && e(o);
18
+ if (t && r)
19
+ return `${t} - ${r}`;
20
+ if (t)
20
21
  return s.get("filter.date.since", {
21
22
  values: {
22
- date: e
23
+ date: t
23
24
  }
24
25
  });
25
26
  if (r)
@@ -28,114 +29,118 @@ const B = {
28
29
  date: r
29
30
  }
30
31
  });
31
- }, a = (s) => {
32
+ }, i = (s) => {
32
33
  try {
33
34
  return new Date(s || "").toISOString();
34
35
  } catch {
35
36
  return "";
36
37
  }
37
- }, $ = (() => {
38
+ }, Y = (() => {
38
39
  const s = ({
39
- editAction: t,
40
+ editAction: e,
40
41
  from: n,
41
42
  to: o,
42
- now: e,
43
+ now: t,
43
44
  onChange: r,
44
- onValueUpdated: g,
45
+ onValueUpdated: F,
45
46
  showTimezoneInfo: w,
46
47
  selectedPresetOption: f,
47
- timeRangePresetOptions: i,
48
+ timeRangePresetOptions: c,
48
49
  timezone: D,
49
- sinceDate: c,
50
- untilDate: P
50
+ sinceDate: m,
51
+ untilDate: O
51
52
  }) => {
52
53
  const {
53
- i18n: y
54
- } = x(), {
54
+ i18n: P
55
+ } = k(), {
55
56
  fullDateFormat: d
56
- } = k(D), [F, O] = p(f), u = R(() => [new Date(n), new Date(o)], [n, o]), m = I(), T = v((l, h) => {
57
- g(A(y, d, a(l), a(h)));
58
- }, [y, d, g]);
59
- return C(() => {
60
- var l, h, b;
61
- switch (t) {
62
- case M.APPLY:
57
+ } = B(D), [g, R] = h(f), u = T(() => [new Date(n), new Date(o)], [n, o]), a = x(), y = M((l, C) => {
58
+ F(v(P, d, i(l), i(C)));
59
+ }, [P, d, F]);
60
+ return E(() => {
61
+ var l, C, p;
62
+ switch (e) {
63
+ case A.APPLY:
63
64
  r({
64
- selectedPresetOption: F,
65
- [E.FROM]: a((l = m.current) == null ? void 0 : l.from),
66
- [E.TO]: a((h = m.current) == null ? void 0 : h.to)
65
+ selectedPresetOption: g,
66
+ [b.FROM]: i((l = a.current) == null ? void 0 : l.from),
67
+ [b.TO]: i((C = a.current) == null ? void 0 : C.to)
67
68
  });
68
69
  break;
69
- case M.CLEAR:
70
- (b = m.current) == null || b.clear(), r();
70
+ case A.CLEAR:
71
+ (p = a.current) == null || p.clear(), r();
71
72
  }
72
- }, [t, r, F]), S(L, {
73
- ref: m,
74
- now: e,
73
+ }, [e, r, g]), S(z, {
74
+ ref: a,
75
+ now: t,
75
76
  originDate: u,
76
- onHighlight: T,
77
- onPresetOptionSelected: O,
77
+ onHighlight: y,
78
+ onPresetOptionSelected: R,
78
79
  selectedPresetOption: f,
79
- timeRangePresetOptions: i,
80
+ timeRangePresetOptions: c,
80
81
  timezone: D,
81
82
  showTimezoneInfo: w,
82
- sinceDate: a(c),
83
- untilDate: a(P)
83
+ sinceDate: i(m),
84
+ untilDate: i(O)
84
85
  });
85
86
  };
86
- return (t) => S(s, {
87
- ...t
87
+ return (e) => S(s, {
88
+ ...e
88
89
  });
89
- })(), j = (s, t, n) => s.formatRange(t, n);
90
- function X({
90
+ })(), $ = (s, e, n) => s.formatRange(e, n);
91
+ function U({
91
92
  title: s,
92
- from: t,
93
+ from: e,
93
94
  to: n,
94
95
  selectedPresetOption: o,
95
- ...e
96
+ ...t
96
97
  }) {
97
98
  const {
98
99
  i18n: r
99
- } = x(), {
100
- fullDateFormat: g
101
- } = k(e.timezone), [w, f] = p(), [i, D] = p(), [c, P] = p(), y = v((u) => {
100
+ } = k(), {
101
+ fullDateFormat: F
102
+ } = B(t.timezone), [w, f] = h(), [c, D] = h(), [m, O] = h(), P = M((u) => {
102
103
  const {
103
- from: m,
104
- to: T,
104
+ from: a,
105
+ to: y,
105
106
  selectedPresetOption: l
106
- } = u ?? Y;
107
+ } = u ?? I;
107
108
  try {
108
- f(w ?? l), D(a(i ?? m)), P(a(c ?? T));
109
+ f(w ?? l), D(i(c ?? a)), O(i(m ?? y));
109
110
  } finally {
110
- e.onChange({
111
- from: m,
112
- to: T,
111
+ t.onChange({
112
+ from: a,
113
+ to: y,
113
114
  selectedPresetOption: l
114
115
  });
115
116
  }
116
- }, [w, i, c, e]), [d, F] = R(() => {
117
- let u = _;
117
+ }, [w, c, m, t]), d = T(() => r.get("rangePreset.custom"), [r]), g = T(() => {
118
+ const u = {
119
+ ...V,
120
+ timeZone: t.timezone
121
+ };
122
+ let a = new Intl.DateTimeFormat(L, u);
118
123
  try {
119
- u = new Intl.DateTimeFormat(r.locale, B);
124
+ a = new Intl.DateTimeFormat(r.locale, u);
120
125
  } catch {
121
126
  }
122
- return [r.get("rangePreset.custom"), u];
123
- }, [r]);
124
- C(() => f(o), [o]), C(() => D(a(t || Date.now())), [t]), C(() => P(a(n || Date.now())), [n]);
125
- const O = R(() => o === d && i && c ? j(F, new Date(i), new Date(c)) : o ?? e.label, [d, F, i, c, o, e.label]);
126
- return S(V, {
127
- ...e,
128
- from: t,
127
+ return a;
128
+ }, [r, t.timezone]);
129
+ E(() => f(o), [o]), E(() => D(i(e || Date.now())), [e]), E(() => O(i(n || Date.now())), [n]);
130
+ const R = T(() => o === d && c && m ? $(g, new Date(c), new Date(m)) : o ?? t.label, [d, g, c, m, o, t.label]);
131
+ return S(_, {
132
+ ...t,
133
+ from: e,
129
134
  to: n,
130
135
  type: "date",
131
- label: O,
132
- onChange: y,
133
- render: $,
136
+ label: R,
137
+ onChange: P,
138
+ render: Y,
134
139
  selectedPresetOption: o,
135
- value: A(r, g, t, n),
140
+ value: v(r, F, e, n),
136
141
  withContentPadding: !1
137
142
  });
138
143
  }
139
144
  export {
140
- X as default
145
+ U as default
141
146
  };
@@ -22,7 +22,7 @@ const E = (e) => {
22
22
  Accept: "application/json, text/plain, */*",
23
23
  "Content-Type": "application/json",
24
24
  ...o,
25
- "SDK-Version": "1.0.2"
25
+ "SDK-Version": "1.0.3"
26
26
  },
27
27
  redirect: "follow",
28
28
  signal: e.signal,
@@ -1,33 +1,33 @@
1
- import { SYSTEM_TIMEZONE_FORMATTER as c, REGEX_TZ_OFFSET as r } from "./constants.js";
2
- import { EMPTY_ARRAY as i } from "../../../../utils/value/constants.js";
3
- import { mod as E } from "../../../../utils/value/number.js";
4
- const p = /\+(?=-)|([+-]00:00)/g, O = new RegExp("(?<=^\\D?)(\\d)$"), S = ([t, e]) => (Math.abs(t * 60) + e) * (t < 0 ? -1 : 1), _ = (t) => Object.freeze([
1
+ import { SYSTEM_TIMEZONE_FORMATTER as n, REGEX_TZ_OFFSET as m } from "./constants.js";
2
+ import { EMPTY_ARRAY as r } from "../../../../utils/value/constants.js";
3
+ import { mod as i } from "../../../../utils/value/number.js";
4
+ const E = /\+(?=-)|([+-]00:00)/g, p = new RegExp("(?<=^\\D?)(\\d)$"), O = ([t, s]) => (Math.abs(t * 60) + s) * (t < 0 ? -1 : 1), S = (t) => Object.freeze([
5
5
  Math.floor(t / 60),
6
6
  // offset hours
7
- E(t, 60)
7
+ i(t, 60)
8
8
  // offset minutes
9
- ]), M = (t) => parseInt(t, 10) || 0, g = (t) => `GMT+${_(t).map((o) => `${o}`.replace(O, "0$1")).join(":")}`.replace(p, ""), T = (t) => {
10
- var s;
11
- const e = ((s = t == null ? void 0 : t.match(r)) == null ? void 0 : s[0].split(":", 2).map(M)) ?? i;
12
- return S(e.concat(0, 0).slice(0, 2));
13
- }, F = (t, e = c) => {
14
- var n;
15
- const s = T((n = c) == null ? void 0 : n.format(t));
16
- return T(e == null ? void 0 : e.format(t)) - s;
17
- }, m = (t, e, s = 1) => {
9
+ ]), _ = (t) => parseInt(t, 10) || 0, F = (t) => `GMT+${S(t).map((o) => `${o}`.replace(p, "0$1")).join(":")}`.replace(E, ""), c = (t) => {
10
+ var e;
11
+ const s = ((e = t == null ? void 0 : t.match(m)) == null ? void 0 : e[0].split(":", 2).map(_)) ?? r;
12
+ return O(s.concat(0, 0).slice(0, 2));
13
+ }, R = (t, s = n) => {
14
+ var f;
15
+ const e = c((f = n) == null ? void 0 : f.format(t));
16
+ return c(s == null ? void 0 : s.format(t)) - e;
17
+ }, T = (t, s, e = 1) => {
18
18
  const {
19
19
  offset: o,
20
- timestamp: n
21
- } = t(e), f = new Date(n);
22
- return f.setMinutes(f.getMinutes() - o * s);
23
- }, R = (t, e) => m(t, e, 1), z = (t, e) => m(t, e, -1);
20
+ timestamp: f
21
+ } = t(s);
22
+ return f - o * e * 6e4;
23
+ }, g = (t, s) => T(t, s, 1), u = (t, s) => T(t, s, -1);
24
24
  export {
25
- S as computeTimezoneOffsetInMinutes,
26
- _ as computeTimezoneOffsetsFromMinutes,
27
- g as getGMTSuffixForTimezoneOffset,
28
- F as getTimezoneOffsetForTimestamp,
29
- T as getTimezoneOffsetFromFormattedDateString,
30
- M as parseTimezoneOffset,
31
- R as systemToTimezone,
32
- z as timezoneToSystem
25
+ O as computeTimezoneOffsetInMinutes,
26
+ S as computeTimezoneOffsetsFromMinutes,
27
+ F as getGMTSuffixForTimezoneOffset,
28
+ R as getTimezoneOffsetForTimestamp,
29
+ c as getTimezoneOffsetFromFormattedDateString,
30
+ _ as parseTimezoneOffset,
31
+ g as systemToTimezone,
32
+ u as timezoneToSystem
33
33
  };
@@ -68,7 +68,7 @@ class e {
68
68
  };
69
69
  }
70
70
  }
71
- i(e, "version", "1.0.2");
71
+ i(e, "version", "1.0.3");
72
72
  const g = e;
73
73
  export {
74
74
  g as default
@@ -1,60 +1,55 @@
1
- import w from "../../../core/Localization/datetime/restamper/restamper.js";
2
- import { createWatchlist as y, isWatchlistUnsubscribeToken as O } from "../../reactive/watchlist/main.js";
1
+ import g from "../../../core/Localization/datetime/restamper/restamper.js";
2
+ import { createWatchlist as y, isWatchlistUnsubscribeToken as h } from "../../reactive/watchlist/main.js";
3
3
  import { clock as S } from "../clock/main.js";
4
4
  import { timezoneToSystem as W, systemToTimezone as b } from "../../../core/Localization/datetime/restamper/utils.js";
5
5
  import { isNull as z } from "../../../utils/value/is.js";
6
- import { struct as h } from "../../../utils/struct/main.js";
7
- import { enumerable as u, getter as x } from "../../../utils/struct/property.js";
8
- const N = (() => {
9
- const f = /* @__PURE__ */ new Map(), s = w(), l = (n = Date.now()) => {
10
- const t = new Date(n), o = new Date(W(s, n)), e = t.getDate() - o.getDate();
11
- if (e) {
12
- const i = e > 1 ? -1 : e < -1 ? 1 : e;
13
- t.setDate(t.getDate() - i);
14
- }
15
- const r = b(s, t.setHours(0, 0, 0, 0)), m = b(s, t.setDate(t.getDate() + 1));
16
- return [r, m - r];
6
+ import { struct as x } from "../../../utils/struct/main.js";
7
+ import { enumerable as c, getter as N } from "../../../utils/struct/property.js";
8
+ const O = (() => {
9
+ const a = /* @__PURE__ */ new Map(), r = g(), u = (m = Date.now()) => {
10
+ const t = new Date(W(r, m)), e = b(r, t.setHours(0, 0, 0, 0)), s = b(r, t.setDate(t.getDate() + 1));
11
+ return [e, s - e];
17
12
  };
18
- return (n) => {
19
- s.tz = n;
20
- const t = s.tz.current;
21
- return f.get(t) ?? (() => {
22
- let o = null, e = null, r = null;
23
- const m = () => (s.tz = t, o ?? l()[0]), i = (a = Date.now()) => {
24
- s.tz = t, [o, e] = l(a);
13
+ return (m) => {
14
+ r.tz = m;
15
+ const t = r.tz.current;
16
+ return a.get(t) ?? (() => {
17
+ let e = null, s = null, o = null;
18
+ const p = () => (r.tz = t, e ?? u()[0]), l = (n = Date.now()) => {
19
+ r.tz = t, [e, s] = u(n);
25
20
  }, {
26
- cancelSubscriptions: T,
27
- requestNotification: d,
28
- subscribe: g,
29
- on: p
21
+ cancelSubscriptions: w,
22
+ requestNotification: D,
23
+ subscribe: d,
24
+ on: f
30
25
  } = y({
31
- timestamp: m
26
+ timestamp: p
32
27
  });
33
- p.resume = () => {
34
- r = S.subscribe((a) => {
35
- if (O(a))
28
+ f.resume = () => {
29
+ o = S.subscribe((n) => {
30
+ if (h(n))
36
31
  return;
37
32
  const {
38
- now: c
39
- } = a;
40
- if (z(o) || z(e))
41
- return i(c);
42
- c - o < e || (i(c), d());
33
+ now: i
34
+ } = n;
35
+ if (z(e) || z(s))
36
+ return l(i);
37
+ i - e < s || (l(i), D());
43
38
  });
44
- }, p.idle = () => {
45
- r == null || r(), o = e = r = null;
39
+ }, f.idle = () => {
40
+ o == null || o(), e = s = o = null;
46
41
  };
47
- const D = h({
48
- cancelSubscriptions: u(T),
49
- timestamp: x(m),
50
- timezone: u(t),
51
- subscribe: u(g)
42
+ const T = x({
43
+ cancelSubscriptions: c(w),
44
+ timestamp: N(p),
45
+ timezone: c(t),
46
+ subscribe: c(d)
52
47
  });
53
- return f.set(t, D), D;
48
+ return a.set(t, T), T;
54
49
  })();
55
50
  };
56
- })(), v = N;
51
+ })(), v = O;
57
52
  export {
58
53
  v as default,
59
- N as today
54
+ O as today
60
55
  };