@epam/statgpt-sdmx-toolkit 0.4.0-rc.35 → 0.4.0-rc.37

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/index.mjs CHANGED
@@ -3,7 +3,7 @@ const K = (t) => {
3
3
  const e = t.split("=");
4
4
  return e.length === 1 ? t : e[1];
5
5
  }
6
- }, H = (t) => {
6
+ }, C = (t) => {
7
7
  if (t == null)
8
8
  return {};
9
9
  const e = K(t), n = {
@@ -12,61 +12,61 @@ const K = (t) => {
12
12
  version: ""
13
13
  };
14
14
  return e && (e.includes(":") && (n.agency = e.split(":")[0], n.id = e.split(":")[1].split("(")[0]), e.includes("(") && e.includes(")") && (n.version = e.split("(")[1]?.split(")")[0])), n;
15
- }, Pt = (t) => {
16
- const [e, n] = t.split(")."), { agency: r, id: s, version: a } = H(e + ")");
15
+ }, tt = (t) => {
16
+ const [e, n] = t.split(")."), { agency: r, id: s, version: a } = C(e + ")");
17
17
  return { childId: n, agency: r, id: s, version: a };
18
- }, Mt = (t, e, n) => {
18
+ }, de = (t, e, n) => {
19
19
  const r = e === "" ? "" : `(${e})`;
20
20
  return `${n}:${t}${r}`;
21
21
  };
22
- var ue = /* @__PURE__ */ ((t) => (t.DESCENDANTS = "descendants", t.NONE = "none", t.ALL = "all", t))(ue || {}), Ze = /* @__PURE__ */ ((t) => (t.EXACT = "exact", t.AVAILABLE = "available", t))(Ze || {});
23
- function vt(t) {
22
+ var le = /* @__PURE__ */ ((t) => (t.DESCENDANTS = "descendants", t.NONE = "none", t.ALL = "all", t))(le || {}), nt = /* @__PURE__ */ ((t) => (t.EXACT = "exact", t.AVAILABLE = "available", t))(nt || {});
23
+ function At(t) {
24
24
  return {
25
25
  data: {
26
26
  codelists: t.data.codelists,
27
27
  conceptSchemes: t.data.conceptSchemes,
28
- dataConstraints: t.data.dataConstraints?.map(Ot),
28
+ dataConstraints: t.data.dataConstraints?.map(Nt),
29
29
  dataflows: t.data.dataflows,
30
30
  dataStructures: t.data.dataStructures,
31
31
  metadataStructures: t.data.metadataStructures
32
32
  }
33
33
  };
34
34
  }
35
- function Ot(t) {
35
+ function Nt(t) {
36
36
  return {
37
37
  ...t,
38
- cubeRegions: t.cubeRegions?.map(At)
38
+ cubeRegions: t.cubeRegions?.map(kt)
39
39
  };
40
40
  }
41
- function At(t) {
41
+ function kt(t) {
42
42
  return {
43
43
  isIncluded: t.include,
44
- memberSelection: t.keyValues.map(Nt)
44
+ memberSelection: t.keyValues.map(It)
45
45
  };
46
46
  }
47
- function Nt(t) {
47
+ function It(t) {
48
48
  return {
49
49
  included: t.include,
50
50
  componentId: t.id,
51
- selectionValues: t.values.map(kt)
51
+ selectionValues: t.values.map(Rt)
52
52
  };
53
53
  }
54
- function kt(t) {
54
+ function Rt(t) {
55
55
  return {
56
56
  memberValue: t.value
57
57
  };
58
58
  }
59
- const Rt = (t = "", e = "", n = "") => `sdmx/3.0/availability/dataflow/${t}/${e}/${n}`;
60
- class La {
59
+ const _t = (t = "", e = "", n = "") => `sdmx/3.0/availability/dataflow/${t}/${e}/${n}`;
60
+ class Wa {
61
61
  constructor(e) {
62
62
  this.client = e;
63
63
  }
64
64
  async getConstraints(e, n, r) {
65
- const { agency: s, id: a, version: o } = H(e), c = {
65
+ const { agency: s, id: a, version: o } = C(e), c = {
66
66
  filters: n || [],
67
- mode: Ze.AVAILABLE,
68
- references: ue.NONE
69
- }, i = Rt(s, a, o);
67
+ mode: nt.AVAILABLE,
68
+ references: le.NONE
69
+ }, i = _t(s, a, o);
70
70
  if (this.client.config.sdmxProxyUrl) {
71
71
  const u = await this.client.postRequest(
72
72
  i,
@@ -74,7 +74,7 @@ class La {
74
74
  this.client.config.sdmxProxyUrl,
75
75
  r
76
76
  );
77
- return vt(u);
77
+ return At(u);
78
78
  }
79
79
  return await this.client.postRequest(
80
80
  i,
@@ -84,8 +84,8 @@ class La {
84
84
  );
85
85
  }
86
86
  }
87
- var X = /* @__PURE__ */ ((t) => (t.CSV = "csv", t.JSON = "json", t.XML = "xml", t))(X || {}), _t = /* @__PURE__ */ ((t) => (t.ID = "id", t.NAME = "name", t.ID_NAME = "both", t))(_t || {}), It = /* @__PURE__ */ ((t) => (t.FULL_DATASET = "full", t.DATA_IN_TABLE = "query", t))(It || {});
88
- const Yt = (t, e) => {
87
+ var X = /* @__PURE__ */ ((t) => (t.CSV = "csv", t.JSON = "json", t.XML = "xml", t))(X || {}), Yt = /* @__PURE__ */ ((t) => (t.ID = "id", t.NAME = "name", t.ID_NAME = "both", t))(Yt || {}), Ct = /* @__PURE__ */ ((t) => (t.FULL_DATASET = "full", t.DATA_IN_TABLE = "query", t))(Ct || {});
88
+ const St = (t, e) => {
89
89
  switch (t) {
90
90
  case X.CSV:
91
91
  return B(
@@ -106,19 +106,19 @@ const Yt = (t, e) => {
106
106
  );
107
107
  }
108
108
  }, B = (t, e) => `${t}; labels=${e}`;
109
- var et = /* @__PURE__ */ ((t) => (t.REFERENCE_PARTIAL = "referencepartial", t.FULL = "full", t))(et || {});
110
- const Ct = "all", Lt = "sdmx/3.0/data/dataflow", tt = "&", Re = ":", St = "=", Wt = "+", Sa = ",", $t = "*", _e = (t, e, n) => {
111
- const { filterKey: r, timeFilter: s } = n, { agency: a, id: o, version: c } = H(t), i = [s || "", e].filter((d) => !!d).join(tt);
112
- return `${`${Lt}/${a}/${o}/${c}`}/${r || $t}?${i}`;
113
- }, qt = (t = "", e = "", n = "", r = ue.DESCENDANTS) => `sdmx/3.0/structure/dataflow/${t}/${e}/${n}?references=${r}&detail=${et.REFERENCE_PARTIAL}`;
114
- class Wa {
109
+ var rt = /* @__PURE__ */ ((t) => (t.REFERENCE_PARTIAL = "referencepartial", t.FULL = "full", t))(rt || {});
110
+ const Lt = "all", $t = "sdmx/3.0/data/dataflow", st = "&", _e = ":", Wt = "=", qt = "+", qa = ",", Ht = "*", Ye = (t, e, n) => {
111
+ const { filterKey: r, timeFilter: s } = n, { agency: a, id: o, version: c } = C(t), i = [s || "", e].filter((d) => !!d).join(st);
112
+ return `${`${$t}/${a}/${o}/${c}`}/${r || Ht}?${i}`;
113
+ }, Qt = (t = "", e = "", n = "", r = le.DESCENDANTS) => `sdmx/3.0/structure/dataflow/${t}/${e}/${n}?references=${r}&detail=${rt.REFERENCE_PARTIAL}`;
114
+ class Ha {
115
115
  constructor(e) {
116
116
  this.client = e;
117
117
  }
118
118
  async getDataSet(e, n, r) {
119
- const { agency: s, id: a, version: o } = H(e);
119
+ const { agency: s, id: a, version: o } = C(e);
120
120
  return await this.client.getRequest(
121
- qt(s, a, o, n),
121
+ Qt(s, a, o, n),
122
122
  void 0,
123
123
  r
124
124
  );
@@ -127,10 +127,10 @@ class Wa {
127
127
  const s = new URLSearchParams({
128
128
  includeHistory: "false",
129
129
  limit: "1000",
130
- attributes: Ct,
130
+ attributes: Lt,
131
131
  dimensionAtObservation: "TIME_PERIOD"
132
132
  // TODO: use time dimensions
133
- }).toString(), a = _e(e, s, n);
133
+ }).toString(), a = Ye(e, s, n);
134
134
  return await this.client.getRequest(
135
135
  a,
136
136
  void 0,
@@ -143,13 +143,13 @@ class Wa {
143
143
  compress: "false",
144
144
  attributes: c ? "all" : "none",
145
145
  limit: "1000"
146
- }).toString(), d = _e(e, u, a);
146
+ }).toString(), d = Ye(e, u, a);
147
147
  return this.client.streamRequest(
148
148
  d,
149
149
  {
150
150
  method: "GET",
151
151
  headers: {
152
- Accept: Yt(n, s),
152
+ Accept: St(n, s),
153
153
  "Accept-language": r
154
154
  }
155
155
  },
@@ -158,35 +158,35 @@ class Wa {
158
158
  );
159
159
  }
160
160
  }
161
- const Qt = (t, e) => t.error || t.message || `${e.status} ${e.statusText}`, Ft = "application/json", Ht = "Content-Type", j = "Api-Key", Ut = "X-CONVERSATION-ID", z = "Ocp-Apim-Subscription-Key";
162
- class Ie extends Error {
161
+ const Ft = (t, e) => t.error || t.message || `${e.status} ${e.statusText}`, Ut = "application/json", Bt = "Content-Type", j = "Api-Key", Vt = "X-CONVERSATION-ID", z = "Ocp-Apim-Subscription-Key";
162
+ class Ce extends Error {
163
163
  constructor(e) {
164
164
  super(e.message), this.isHttpError = !0, this.name = "HttpError", this.code = e.code, this.status = e.status, this.details = e.details, this.displayMessage = e.displayMessage;
165
165
  }
166
166
  }
167
- const nt = 6048e5, Bt = 864e5, de = 6e4, le = 36e5, Gt = 1e3, Ye = /* @__PURE__ */ Symbol.for("constructDateFrom");
167
+ const at = 6048e5, Gt = 864e5, fe = 6e4, me = 36e5, Xt = 1e3, Se = /* @__PURE__ */ Symbol.for("constructDateFrom");
168
168
  function E(t, e) {
169
- return typeof t == "function" ? t(e) : t && typeof t == "object" && Ye in t ? t[Ye](e) : t instanceof Date ? new t.constructor(e) : new Date(e);
169
+ return typeof t == "function" ? t(e) : t && typeof t == "object" && Se in t ? t[Se](e) : t instanceof Date ? new t.constructor(e) : new Date(e);
170
170
  }
171
171
  function p(t, e) {
172
172
  return E(e || t, t);
173
173
  }
174
- function rt(t, e, n) {
174
+ function ot(t, e, n) {
175
175
  const r = p(t, n?.in);
176
176
  return isNaN(e) ? E(n?.in || t, NaN) : (e && r.setDate(r.getDate() + e), r);
177
177
  }
178
- let Vt = {};
179
- function S() {
180
- return Vt;
178
+ let jt = {};
179
+ function $() {
180
+ return jt;
181
181
  }
182
- function I(t, e) {
183
- const n = S(), r = e?.weekStartsOn ?? e?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, s = p(t, e?.in), a = s.getDay(), o = (a < r ? 7 : 0) + a - r;
182
+ function _(t, e) {
183
+ const n = $(), r = e?.weekStartsOn ?? e?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, s = p(t, e?.in), a = s.getDay(), o = (a < r ? 7 : 0) + a - r;
184
184
  return s.setDate(s.getDate() - o), s.setHours(0, 0, 0, 0), s;
185
185
  }
186
186
  function L(t, e) {
187
- return I(t, { ...e, weekStartsOn: 1 });
187
+ return _(t, { ...e, weekStartsOn: 1 });
188
188
  }
189
- function st(t, e) {
189
+ function it(t, e) {
190
190
  const n = p(t, e?.in), r = n.getFullYear(), s = E(n, 0);
191
191
  s.setFullYear(r + 1, 0, 4), s.setHours(0, 0, 0, 0);
192
192
  const a = L(s), o = E(n, 0);
@@ -208,40 +208,40 @@ function J(t) {
208
208
  );
209
209
  return n.setUTCFullYear(e.getFullYear()), +t - +n;
210
210
  }
211
- function Xt(t, ...e) {
211
+ function zt(t, ...e) {
212
212
  const n = E.bind(
213
213
  null,
214
214
  e.find((r) => typeof r == "object")
215
215
  );
216
216
  return e.map(n);
217
217
  }
218
- function Ce(t, e) {
218
+ function Le(t, e) {
219
219
  const n = p(t, e?.in);
220
220
  return n.setHours(0, 0, 0, 0), n;
221
221
  }
222
- function jt(t, e, n) {
223
- const [r, s] = Xt(
222
+ function Kt(t, e, n) {
223
+ const [r, s] = zt(
224
224
  n?.in,
225
225
  t,
226
226
  e
227
- ), a = Ce(r), o = Ce(s), c = +a - J(a), i = +o - J(o);
228
- return Math.round((c - i) / Bt);
227
+ ), a = Le(r), o = Le(s), c = +a - J(a), i = +o - J(o);
228
+ return Math.round((c - i) / Gt);
229
229
  }
230
- function zt(t, e) {
231
- const n = st(t, e), r = E(t, 0);
230
+ function Jt(t, e) {
231
+ const n = it(t, e), r = E(t, 0);
232
232
  return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), L(r);
233
233
  }
234
- function Kt(t) {
234
+ function Zt(t) {
235
235
  return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]";
236
236
  }
237
237
  function re(t) {
238
- return !(!Kt(t) && typeof t != "number" || isNaN(+p(t)));
238
+ return !(!Zt(t) && typeof t != "number" || isNaN(+p(t)));
239
239
  }
240
- function Jt(t, e) {
240
+ function en(t, e) {
241
241
  const n = p(t, e?.in);
242
242
  return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
243
243
  }
244
- const Zt = {
244
+ const tn = {
245
245
  lessThanXSeconds: {
246
246
  one: "less than a second",
247
247
  other: "less than {{count}} seconds"
@@ -303,9 +303,9 @@ const Zt = {
303
303
  one: "almost 1 year",
304
304
  other: "almost {{count}} years"
305
305
  }
306
- }, en = (t, e, n) => {
306
+ }, nn = (t, e, n) => {
307
307
  let r;
308
- const s = Zt[t];
308
+ const s = tn[t];
309
309
  return typeof s == "string" ? r = s : e === 1 ? r = s.one : r = s.other.replace("{{count}}", e.toString()), n?.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
310
310
  };
311
311
  function te(t) {
@@ -314,43 +314,43 @@ function te(t) {
314
314
  return t.formats[n] || t.formats[t.defaultWidth];
315
315
  };
316
316
  }
317
- const tn = {
317
+ const rn = {
318
318
  full: "EEEE, MMMM do, y",
319
319
  long: "MMMM do, y",
320
320
  medium: "MMM d, y",
321
321
  short: "MM/dd/yyyy"
322
- }, nn = {
322
+ }, sn = {
323
323
  full: "h:mm:ss a zzzz",
324
324
  long: "h:mm:ss a z",
325
325
  medium: "h:mm:ss a",
326
326
  short: "h:mm a"
327
- }, rn = {
327
+ }, an = {
328
328
  full: "{{date}} 'at' {{time}}",
329
329
  long: "{{date}} 'at' {{time}}",
330
330
  medium: "{{date}}, {{time}}",
331
331
  short: "{{date}}, {{time}}"
332
- }, sn = {
332
+ }, on = {
333
333
  date: te({
334
- formats: tn,
334
+ formats: rn,
335
335
  defaultWidth: "full"
336
336
  }),
337
337
  time: te({
338
- formats: nn,
338
+ formats: sn,
339
339
  defaultWidth: "full"
340
340
  }),
341
341
  dateTime: te({
342
- formats: rn,
342
+ formats: an,
343
343
  defaultWidth: "full"
344
344
  })
345
- }, an = {
345
+ }, cn = {
346
346
  lastWeek: "'last' eeee 'at' p",
347
347
  yesterday: "'yesterday at' p",
348
348
  today: "'today at' p",
349
349
  tomorrow: "'tomorrow at' p",
350
350
  nextWeek: "eeee 'at' p",
351
351
  other: "P"
352
- }, on = (t, e, n, r) => an[t];
353
- function q(t) {
352
+ }, un = (t, e, n, r) => cn[t];
353
+ function H(t) {
354
354
  return (e, n) => {
355
355
  const r = n?.context ? String(n.context) : "standalone";
356
356
  let s;
@@ -365,15 +365,15 @@ function q(t) {
365
365
  return s[a];
366
366
  };
367
367
  }
368
- const cn = {
368
+ const dn = {
369
369
  narrow: ["B", "A"],
370
370
  abbreviated: ["BC", "AD"],
371
371
  wide: ["Before Christ", "Anno Domini"]
372
- }, un = {
372
+ }, ln = {
373
373
  narrow: ["1", "2", "3", "4"],
374
374
  abbreviated: ["Q1", "Q2", "Q3", "Q4"],
375
375
  wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
376
- }, dn = {
376
+ }, fn = {
377
377
  narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
378
378
  abbreviated: [
379
379
  "Jan",
@@ -403,7 +403,7 @@ const cn = {
403
403
  "November",
404
404
  "December"
405
405
  ]
406
- }, ln = {
406
+ }, mn = {
407
407
  narrow: ["S", "M", "T", "W", "T", "F", "S"],
408
408
  short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
409
409
  abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
@@ -416,7 +416,7 @@ const cn = {
416
416
  "Friday",
417
417
  "Saturday"
418
418
  ]
419
- }, fn = {
419
+ }, hn = {
420
420
  narrow: {
421
421
  am: "a",
422
422
  pm: "p",
@@ -447,7 +447,7 @@ const cn = {
447
447
  evening: "evening",
448
448
  night: "night"
449
449
  }
450
- }, mn = {
450
+ }, gn = {
451
451
  narrow: {
452
452
  am: "a",
453
453
  pm: "p",
@@ -478,7 +478,7 @@ const cn = {
478
478
  evening: "in the evening",
479
479
  night: "at night"
480
480
  }
481
- }, hn = (t, e) => {
481
+ }, wn = (t, e) => {
482
482
  const n = Number(t), r = n % 100;
483
483
  if (r > 20 || r < 10)
484
484
  switch (r % 10) {
@@ -490,29 +490,29 @@ const cn = {
490
490
  return n + "rd";
491
491
  }
492
492
  return n + "th";
493
- }, wn = {
494
- ordinalNumber: hn,
495
- era: q({
496
- values: cn,
493
+ }, yn = {
494
+ ordinalNumber: wn,
495
+ era: H({
496
+ values: dn,
497
497
  defaultWidth: "wide"
498
498
  }),
499
- quarter: q({
500
- values: un,
499
+ quarter: H({
500
+ values: ln,
501
501
  defaultWidth: "wide",
502
502
  argumentCallback: (t) => t - 1
503
503
  }),
504
- month: q({
505
- values: dn,
504
+ month: H({
505
+ values: fn,
506
506
  defaultWidth: "wide"
507
507
  }),
508
- day: q({
509
- values: ln,
508
+ day: H({
509
+ values: mn,
510
510
  defaultWidth: "wide"
511
511
  }),
512
- dayPeriod: q({
513
- values: fn,
512
+ dayPeriod: H({
513
+ values: hn,
514
514
  defaultWidth: "wide",
515
- formattingValues: mn,
515
+ formattingValues: gn,
516
516
  defaultFormattingWidth: "wide"
517
517
  })
518
518
  };
@@ -521,9 +521,9 @@ function Q(t) {
521
521
  const r = n.width, s = r && t.matchPatterns[r] || t.matchPatterns[t.defaultMatchWidth], a = e.match(s);
522
522
  if (!a)
523
523
  return null;
524
- const o = a[0], c = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], i = Array.isArray(c) ? yn(c, (l) => l.test(o)) : (
524
+ const o = a[0], c = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], i = Array.isArray(c) ? bn(c, (l) => l.test(o)) : (
525
525
  // [TODO] -- I challenge you to fix the type
526
- gn(c, (l) => l.test(o))
526
+ pn(c, (l) => l.test(o))
527
527
  );
528
528
  let u;
529
529
  u = t.valueCallback ? t.valueCallback(i) : i, u = n.valueCallback ? (
@@ -534,17 +534,17 @@ function Q(t) {
534
534
  return { value: u, rest: d };
535
535
  };
536
536
  }
537
- function gn(t, e) {
537
+ function pn(t, e) {
538
538
  for (const n in t)
539
539
  if (Object.prototype.hasOwnProperty.call(t, n) && e(t[n]))
540
540
  return n;
541
541
  }
542
- function yn(t, e) {
542
+ function bn(t, e) {
543
543
  for (let n = 0; n < t.length; n++)
544
544
  if (e(t[n]))
545
545
  return n;
546
546
  }
547
- function pn(t) {
547
+ function Dn(t) {
548
548
  return (e, n = {}) => {
549
549
  const r = e.match(t.matchPattern);
550
550
  if (!r) return null;
@@ -556,23 +556,23 @@ function pn(t) {
556
556
  return { value: o, rest: c };
557
557
  };
558
558
  }
559
- const bn = /^(\d+)(th|st|nd|rd)?/i, Dn = /\d+/i, Tn = {
559
+ const Tn = /^(\d+)(th|st|nd|rd)?/i, En = /\d+/i, xn = {
560
560
  narrow: /^(b|a)/i,
561
561
  abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
562
562
  wide: /^(before christ|before common era|anno domini|common era)/i
563
- }, En = {
563
+ }, Pn = {
564
564
  any: [/^b/i, /^(a|c)/i]
565
- }, xn = {
565
+ }, vn = {
566
566
  narrow: /^[1234]/i,
567
567
  abbreviated: /^q[1234]/i,
568
568
  wide: /^[1234](th|st|nd|rd)? quarter/i
569
- }, Pn = {
570
- any: [/1/i, /2/i, /3/i, /4/i]
571
569
  }, Mn = {
570
+ any: [/1/i, /2/i, /3/i, /4/i]
571
+ }, On = {
572
572
  narrow: /^[jfmasond]/i,
573
573
  abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
574
574
  wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
575
- }, vn = {
575
+ }, An = {
576
576
  narrow: [
577
577
  /^j/i,
578
578
  /^f/i,
@@ -601,18 +601,18 @@ const bn = /^(\d+)(th|st|nd|rd)?/i, Dn = /\d+/i, Tn = {
601
601
  /^n/i,
602
602
  /^d/i
603
603
  ]
604
- }, On = {
604
+ }, Nn = {
605
605
  narrow: /^[smtwf]/i,
606
606
  short: /^(su|mo|tu|we|th|fr|sa)/i,
607
607
  abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
608
608
  wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
609
- }, An = {
609
+ }, kn = {
610
610
  narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
611
611
  any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
612
- }, Nn = {
612
+ }, In = {
613
613
  narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
614
614
  any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
615
- }, kn = {
615
+ }, Rn = {
616
616
  any: {
617
617
  am: /^a/i,
618
618
  pm: /^p/i,
@@ -623,78 +623,78 @@ const bn = /^(\d+)(th|st|nd|rd)?/i, Dn = /\d+/i, Tn = {
623
623
  evening: /evening/i,
624
624
  night: /night/i
625
625
  }
626
- }, Rn = {
627
- ordinalNumber: pn({
628
- matchPattern: bn,
629
- parsePattern: Dn,
626
+ }, _n = {
627
+ ordinalNumber: Dn({
628
+ matchPattern: Tn,
629
+ parsePattern: En,
630
630
  valueCallback: (t) => parseInt(t, 10)
631
631
  }),
632
632
  era: Q({
633
- matchPatterns: Tn,
633
+ matchPatterns: xn,
634
634
  defaultMatchWidth: "wide",
635
- parsePatterns: En,
635
+ parsePatterns: Pn,
636
636
  defaultParseWidth: "any"
637
637
  }),
638
638
  quarter: Q({
639
- matchPatterns: xn,
639
+ matchPatterns: vn,
640
640
  defaultMatchWidth: "wide",
641
- parsePatterns: Pn,
641
+ parsePatterns: Mn,
642
642
  defaultParseWidth: "any",
643
643
  valueCallback: (t) => t + 1
644
644
  }),
645
645
  month: Q({
646
- matchPatterns: Mn,
646
+ matchPatterns: On,
647
647
  defaultMatchWidth: "wide",
648
- parsePatterns: vn,
648
+ parsePatterns: An,
649
649
  defaultParseWidth: "any"
650
650
  }),
651
651
  day: Q({
652
- matchPatterns: On,
652
+ matchPatterns: Nn,
653
653
  defaultMatchWidth: "wide",
654
- parsePatterns: An,
654
+ parsePatterns: kn,
655
655
  defaultParseWidth: "any"
656
656
  }),
657
657
  dayPeriod: Q({
658
- matchPatterns: Nn,
658
+ matchPatterns: In,
659
659
  defaultMatchWidth: "any",
660
- parsePatterns: kn,
660
+ parsePatterns: Rn,
661
661
  defaultParseWidth: "any"
662
662
  })
663
- }, at = {
663
+ }, ct = {
664
664
  code: "en-US",
665
- formatDistance: en,
666
- formatLong: sn,
667
- formatRelative: on,
668
- localize: wn,
669
- match: Rn,
665
+ formatDistance: nn,
666
+ formatLong: on,
667
+ formatRelative: un,
668
+ localize: yn,
669
+ match: _n,
670
670
  options: {
671
671
  weekStartsOn: 0,
672
672
  firstWeekContainsDate: 1
673
673
  }
674
674
  };
675
- function _n(t, e) {
675
+ function Yn(t, e) {
676
676
  const n = p(t, e?.in);
677
- return jt(n, Jt(n)) + 1;
677
+ return Kt(n, en(n)) + 1;
678
678
  }
679
- function ot(t, e) {
680
- const n = p(t, e?.in), r = +L(n) - +zt(n);
681
- return Math.round(r / nt) + 1;
679
+ function ut(t, e) {
680
+ const n = p(t, e?.in), r = +L(n) - +Jt(n);
681
+ return Math.round(r / at) + 1;
682
682
  }
683
- function fe(t, e) {
684
- const n = p(t, e?.in), r = n.getFullYear(), s = S(), a = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? s.firstWeekContainsDate ?? s.locale?.options?.firstWeekContainsDate ?? 1, o = E(e?.in || t, 0);
683
+ function he(t, e) {
684
+ const n = p(t, e?.in), r = n.getFullYear(), s = $(), a = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? s.firstWeekContainsDate ?? s.locale?.options?.firstWeekContainsDate ?? 1, o = E(e?.in || t, 0);
685
685
  o.setFullYear(r + 1, 0, a), o.setHours(0, 0, 0, 0);
686
- const c = I(o, e), i = E(e?.in || t, 0);
686
+ const c = _(o, e), i = E(e?.in || t, 0);
687
687
  i.setFullYear(r, 0, a), i.setHours(0, 0, 0, 0);
688
- const u = I(i, e);
688
+ const u = _(i, e);
689
689
  return +n >= +c ? r + 1 : +n >= +u ? r : r - 1;
690
690
  }
691
- function In(t, e) {
692
- const n = S(), r = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, s = fe(t, e), a = E(e?.in || t, 0);
693
- return a.setFullYear(s, 0, r), a.setHours(0, 0, 0, 0), I(a, e);
691
+ function Cn(t, e) {
692
+ const n = $(), r = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, s = he(t, e), a = E(e?.in || t, 0);
693
+ return a.setFullYear(s, 0, r), a.setHours(0, 0, 0, 0), _(a, e);
694
694
  }
695
- function it(t, e) {
696
- const n = p(t, e?.in), r = +I(n, e) - +In(n, e);
697
- return Math.round(r / nt) + 1;
695
+ function dt(t, e) {
696
+ const n = p(t, e?.in), r = +_(n, e) - +Cn(n, e);
697
+ return Math.round(r / at) + 1;
698
698
  }
699
699
  function h(t, e) {
700
700
  const n = t < 0 ? "-" : "", r = Math.abs(t).toString().padStart(e, "0");
@@ -753,14 +753,14 @@ const k = {
753
753
  );
754
754
  return h(s, e.length);
755
755
  }
756
- }, C = {
756
+ }, S = {
757
757
  midnight: "midnight",
758
758
  noon: "noon",
759
759
  morning: "morning",
760
760
  afternoon: "afternoon",
761
761
  evening: "evening",
762
762
  night: "night"
763
- }, Le = {
763
+ }, $e = {
764
764
  // Era
765
765
  G: function(t, e, n) {
766
766
  const r = t.getFullYear() > 0 ? 1 : 0;
@@ -787,7 +787,7 @@ const k = {
787
787
  },
788
788
  // Local week-numbering year
789
789
  Y: function(t, e, n, r) {
790
- const s = fe(t, r), a = s > 0 ? s : 1 - s;
790
+ const s = he(t, r), a = s > 0 ? s : 1 - s;
791
791
  if (e === "YY") {
792
792
  const o = a % 100;
793
793
  return h(o, 2);
@@ -796,7 +796,7 @@ const k = {
796
796
  },
797
797
  // ISO week-numbering year
798
798
  R: function(t, e) {
799
- const n = st(t);
799
+ const n = it(t);
800
800
  return h(n, e.length);
801
801
  },
802
802
  // Extended year. This is a single number designating the year of this calendar system.
@@ -933,12 +933,12 @@ const k = {
933
933
  },
934
934
  // Local week of year
935
935
  w: function(t, e, n, r) {
936
- const s = it(t, r);
936
+ const s = dt(t, r);
937
937
  return e === "wo" ? n.ordinalNumber(s, { unit: "week" }) : h(s, e.length);
938
938
  },
939
939
  // ISO week of year
940
940
  I: function(t, e, n) {
941
- const r = ot(t);
941
+ const r = ut(t);
942
942
  return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) : h(r, e.length);
943
943
  },
944
944
  // Day of the month
@@ -947,7 +947,7 @@ const k = {
947
947
  },
948
948
  // Day of year
949
949
  D: function(t, e, n) {
950
- const r = _n(t);
950
+ const r = Yn(t);
951
951
  return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : h(r, e.length);
952
952
  },
953
953
  // Day of week
@@ -1124,7 +1124,7 @@ const k = {
1124
1124
  b: function(t, e, n) {
1125
1125
  const r = t.getHours();
1126
1126
  let s;
1127
- switch (r === 12 ? s = C.noon : r === 0 ? s = C.midnight : s = r / 12 >= 1 ? "pm" : "am", e) {
1127
+ switch (r === 12 ? s = S.noon : r === 0 ? s = S.midnight : s = r / 12 >= 1 ? "pm" : "am", e) {
1128
1128
  case "b":
1129
1129
  case "bb":
1130
1130
  return n.dayPeriod(s, {
@@ -1152,7 +1152,7 @@ const k = {
1152
1152
  B: function(t, e, n) {
1153
1153
  const r = t.getHours();
1154
1154
  let s;
1155
- switch (r >= 17 ? s = C.evening : r >= 12 ? s = C.afternoon : r >= 4 ? s = C.morning : s = C.night, e) {
1155
+ switch (r >= 17 ? s = S.evening : r >= 12 ? s = S.afternoon : r >= 4 ? s = S.morning : s = S.night, e) {
1156
1156
  case "B":
1157
1157
  case "BB":
1158
1158
  case "BBB":
@@ -1214,7 +1214,7 @@ const k = {
1214
1214
  switch (e) {
1215
1215
  // Hours and optional minutes
1216
1216
  case "X":
1217
- return We(r);
1217
+ return qe(r);
1218
1218
  // Hours, minutes and optional seconds without `:` delimiter
1219
1219
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1220
1220
  // so this token always has the same output as `XX`
@@ -1232,7 +1232,7 @@ const k = {
1232
1232
  switch (e) {
1233
1233
  // Hours and optional minutes
1234
1234
  case "x":
1235
- return We(r);
1235
+ return qe(r);
1236
1236
  // Hours, minutes and optional seconds without `:` delimiter
1237
1237
  // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1238
1238
  // so this token always has the same output as `xx`
@@ -1252,7 +1252,7 @@ const k = {
1252
1252
  case "O":
1253
1253
  case "OO":
1254
1254
  case "OOO":
1255
- return "GMT" + Se(r, ":");
1255
+ return "GMT" + We(r, ":");
1256
1256
  default:
1257
1257
  return "GMT" + Y(r, ":");
1258
1258
  }
@@ -1265,7 +1265,7 @@ const k = {
1265
1265
  case "z":
1266
1266
  case "zz":
1267
1267
  case "zzz":
1268
- return "GMT" + Se(r, ":");
1268
+ return "GMT" + We(r, ":");
1269
1269
  default:
1270
1270
  return "GMT" + Y(r, ":");
1271
1271
  }
@@ -1280,18 +1280,18 @@ const k = {
1280
1280
  return h(+t, e.length);
1281
1281
  }
1282
1282
  };
1283
- function Se(t, e = "") {
1283
+ function We(t, e = "") {
1284
1284
  const n = t > 0 ? "-" : "+", r = Math.abs(t), s = Math.trunc(r / 60), a = r % 60;
1285
1285
  return a === 0 ? n + String(s) : n + String(s) + e + h(a, 2);
1286
1286
  }
1287
- function We(t, e) {
1287
+ function qe(t, e) {
1288
1288
  return t % 60 === 0 ? (t > 0 ? "-" : "+") + h(Math.abs(t) / 60, 2) : Y(t, e);
1289
1289
  }
1290
1290
  function Y(t, e = "") {
1291
1291
  const n = t > 0 ? "-" : "+", r = Math.abs(t), s = h(Math.trunc(r / 60), 2), a = h(r % 60, 2);
1292
1292
  return n + s + e + a;
1293
1293
  }
1294
- const $e = (t, e) => {
1294
+ const He = (t, e) => {
1295
1295
  switch (t) {
1296
1296
  case "P":
1297
1297
  return e.date({ width: "short" });
@@ -1302,7 +1302,7 @@ const $e = (t, e) => {
1302
1302
  default:
1303
1303
  return e.date({ width: "full" });
1304
1304
  }
1305
- }, ct = (t, e) => {
1305
+ }, lt = (t, e) => {
1306
1306
  switch (t) {
1307
1307
  case "p":
1308
1308
  return e.time({ width: "short" });
@@ -1313,10 +1313,10 @@ const $e = (t, e) => {
1313
1313
  default:
1314
1314
  return e.time({ width: "full" });
1315
1315
  }
1316
- }, Yn = (t, e) => {
1316
+ }, Sn = (t, e) => {
1317
1317
  const n = t.match(/(P+)(p+)?/) || [], r = n[1], s = n[2];
1318
1318
  if (!s)
1319
- return $e(t, e);
1319
+ return He(t, e);
1320
1320
  let a;
1321
1321
  switch (r) {
1322
1322
  case "P":
@@ -1332,46 +1332,46 @@ const $e = (t, e) => {
1332
1332
  a = e.dateTime({ width: "full" });
1333
1333
  break;
1334
1334
  }
1335
- return a.replace("{{date}}", $e(r, e)).replace("{{time}}", ct(s, e));
1335
+ return a.replace("{{date}}", He(r, e)).replace("{{time}}", lt(s, e));
1336
1336
  }, se = {
1337
- p: ct,
1338
- P: Yn
1339
- }, Cn = /^D+$/, Ln = /^Y+$/, Sn = ["D", "DD", "YY", "YYYY"];
1340
- function ut(t) {
1341
- return Cn.test(t);
1342
- }
1343
- function dt(t) {
1337
+ p: lt,
1338
+ P: Sn
1339
+ }, Ln = /^D+$/, $n = /^Y+$/, Wn = ["D", "DD", "YY", "YYYY"];
1340
+ function ft(t) {
1344
1341
  return Ln.test(t);
1345
1342
  }
1343
+ function mt(t) {
1344
+ return $n.test(t);
1345
+ }
1346
1346
  function ae(t, e, n) {
1347
- const r = Wn(t, e, n);
1348
- if (console.warn(r), Sn.includes(t)) throw new RangeError(r);
1347
+ const r = qn(t, e, n);
1348
+ if (console.warn(r), Wn.includes(t)) throw new RangeError(r);
1349
1349
  }
1350
- function Wn(t, e, n) {
1350
+ function qn(t, e, n) {
1351
1351
  const r = t[0] === "Y" ? "years" : "days of the month";
1352
1352
  return `Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
1353
1353
  }
1354
- const $n = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, qn = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Qn = /^'([^]*?)'?$/, Fn = /''/g, Hn = /[a-zA-Z]/;
1355
- function Un(t, e, n) {
1356
- const r = S(), s = r.locale ?? at, a = r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, o = r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, c = p(t, n?.in);
1354
+ const Hn = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Qn = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Fn = /^'([^]*?)'?$/, Un = /''/g, Bn = /[a-zA-Z]/;
1355
+ function Vn(t, e, n) {
1356
+ const r = $(), s = r.locale ?? ct, a = r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, o = r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, c = p(t, n?.in);
1357
1357
  if (!re(c))
1358
1358
  throw new RangeError("Invalid time value");
1359
- let i = e.match(qn).map((d) => {
1359
+ let i = e.match(Qn).map((d) => {
1360
1360
  const l = d[0];
1361
1361
  if (l === "p" || l === "P") {
1362
- const g = se[l];
1363
- return g(d, s.formatLong);
1362
+ const w = se[l];
1363
+ return w(d, s.formatLong);
1364
1364
  }
1365
1365
  return d;
1366
- }).join("").match($n).map((d) => {
1366
+ }).join("").match(Hn).map((d) => {
1367
1367
  if (d === "''")
1368
1368
  return { isToken: !1, value: "'" };
1369
1369
  const l = d[0];
1370
1370
  if (l === "'")
1371
- return { isToken: !1, value: Bn(d) };
1372
- if (Le[l])
1371
+ return { isToken: !1, value: Gn(d) };
1372
+ if ($e[l])
1373
1373
  return { isToken: !0, value: d };
1374
- if (l.match(Hn))
1374
+ if (l.match(Bn))
1375
1375
  throw new RangeError(
1376
1376
  "Format string contains an unescaped latin alphabet character `" + l + "`"
1377
1377
  );
@@ -1386,24 +1386,24 @@ function Un(t, e, n) {
1386
1386
  return i.map((d) => {
1387
1387
  if (!d.isToken) return d.value;
1388
1388
  const l = d.value;
1389
- (dt(l) || ut(l)) && ae(l, e, String(t));
1390
- const g = Le[l[0]];
1391
- return g(c, l, s.localize, u);
1389
+ (mt(l) || ft(l)) && ae(l, e, String(t));
1390
+ const w = $e[l[0]];
1391
+ return w(c, l, s.localize, u);
1392
1392
  }).join("");
1393
1393
  }
1394
- function Bn(t) {
1395
- const e = t.match(Qn);
1396
- return e ? e[1].replace(Fn, "'") : t;
1394
+ function Gn(t) {
1395
+ const e = t.match(Fn);
1396
+ return e ? e[1].replace(Un, "'") : t;
1397
1397
  }
1398
- function Gn() {
1399
- return Object.assign({}, S());
1398
+ function Xn() {
1399
+ return Object.assign({}, $());
1400
1400
  }
1401
- function Vn(t, e) {
1401
+ function jn(t, e) {
1402
1402
  const n = p(t, e?.in).getDay();
1403
1403
  return n === 0 ? 7 : n;
1404
1404
  }
1405
- function Xn(t, e) {
1406
- const n = jn(e) ? new e(0) : E(e, 0);
1405
+ function zn(t, e) {
1406
+ const n = Kn(e) ? new e(0) : E(e, 0);
1407
1407
  return n.setFullYear(t.getFullYear(), t.getMonth(), t.getDate()), n.setHours(
1408
1408
  t.getHours(),
1409
1409
  t.getMinutes(),
@@ -1411,17 +1411,17 @@ function Xn(t, e) {
1411
1411
  t.getMilliseconds()
1412
1412
  ), n;
1413
1413
  }
1414
- function jn(t) {
1414
+ function Kn(t) {
1415
1415
  return typeof t == "function" && t.prototype?.constructor === t;
1416
1416
  }
1417
- const zn = 10;
1418
- class lt {
1417
+ const Jn = 10;
1418
+ class ht {
1419
1419
  subPriority = 0;
1420
1420
  validate(e, n) {
1421
1421
  return !0;
1422
1422
  }
1423
1423
  }
1424
- class Kn extends lt {
1424
+ class Zn extends ht {
1425
1425
  constructor(e, n, r, s, a) {
1426
1426
  super(), this.value = e, this.validateValue = n, this.setValue = r, this.priority = s, a && (this.subPriority = a);
1427
1427
  }
@@ -1432,21 +1432,21 @@ class Kn extends lt {
1432
1432
  return this.setValue(e, n, this.value, r);
1433
1433
  }
1434
1434
  }
1435
- class Jn extends lt {
1436
- priority = zn;
1435
+ class er extends ht {
1436
+ priority = Jn;
1437
1437
  subPriority = -1;
1438
1438
  constructor(e, n) {
1439
1439
  super(), this.context = e || ((r) => E(n, r));
1440
1440
  }
1441
1441
  set(e, n) {
1442
- return n.timestampIsSet ? e : E(e, Xn(e, this.context));
1442
+ return n.timestampIsSet ? e : E(e, zn(e, this.context));
1443
1443
  }
1444
1444
  }
1445
1445
  class m {
1446
1446
  run(e, n, r, s) {
1447
1447
  const a = this.parse(e, n, r, s);
1448
1448
  return a ? {
1449
- setter: new Kn(
1449
+ setter: new Zn(
1450
1450
  a.value,
1451
1451
  this.validate,
1452
1452
  this.set,
@@ -1460,7 +1460,7 @@ class m {
1460
1460
  return !0;
1461
1461
  }
1462
1462
  }
1463
- class Zn extends m {
1463
+ class tr extends m {
1464
1464
  priority = 140;
1465
1465
  parse(e, n, r) {
1466
1466
  switch (n) {
@@ -1550,11 +1550,11 @@ function A(t, e) {
1550
1550
  };
1551
1551
  const r = n[1] === "+" ? 1 : -1, s = n[2] ? parseInt(n[2], 10) : 0, a = n[3] ? parseInt(n[3], 10) : 0, o = n[5] ? parseInt(n[5], 10) : 0;
1552
1552
  return {
1553
- value: r * (s * le + a * de + o * Gt),
1553
+ value: r * (s * me + a * fe + o * Xt),
1554
1554
  rest: e.slice(n[0].length)
1555
1555
  };
1556
1556
  }
1557
- function ft(t) {
1557
+ function gt(t) {
1558
1558
  return y(D.anyDigitsSigned, t);
1559
1559
  }
1560
1560
  function b(t, e) {
@@ -1585,7 +1585,7 @@ function Z(t, e) {
1585
1585
  return y(new RegExp("^-?\\d{1," + t + "}"), e);
1586
1586
  }
1587
1587
  }
1588
- function me(t) {
1588
+ function ge(t) {
1589
1589
  switch (t) {
1590
1590
  case "morning":
1591
1591
  return 4;
@@ -1599,7 +1599,7 @@ function me(t) {
1599
1599
  return 0;
1600
1600
  }
1601
1601
  }
1602
- function mt(t, e) {
1602
+ function wt(t, e) {
1603
1603
  const n = e > 0, r = n ? e : 1 - e;
1604
1604
  let s;
1605
1605
  if (r <= 50)
@@ -1610,10 +1610,10 @@ function mt(t, e) {
1610
1610
  }
1611
1611
  return n ? s : 1 - s;
1612
1612
  }
1613
- function ht(t) {
1613
+ function yt(t) {
1614
1614
  return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0;
1615
1615
  }
1616
- class er extends m {
1616
+ class nr extends m {
1617
1617
  priority = 130;
1618
1618
  incompatibleTokens = ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"];
1619
1619
  parse(e, n, r) {
@@ -1641,7 +1641,7 @@ class er extends m {
1641
1641
  set(e, n, r) {
1642
1642
  const s = e.getFullYear();
1643
1643
  if (r.isTwoDigitYear) {
1644
- const o = mt(
1644
+ const o = wt(
1645
1645
  r.year,
1646
1646
  s
1647
1647
  );
@@ -1651,7 +1651,7 @@ class er extends m {
1651
1651
  return e.setFullYear(a, 0, 1), e.setHours(0, 0, 0, 0), e;
1652
1652
  }
1653
1653
  }
1654
- class tr extends m {
1654
+ class rr extends m {
1655
1655
  priority = 130;
1656
1656
  parse(e, n, r) {
1657
1657
  const s = (a) => ({
@@ -1676,9 +1676,9 @@ class tr extends m {
1676
1676
  return n.isTwoDigitYear || n.year > 0;
1677
1677
  }
1678
1678
  set(e, n, r, s) {
1679
- const a = fe(e, s);
1679
+ const a = he(e, s);
1680
1680
  if (r.isTwoDigitYear) {
1681
- const c = mt(
1681
+ const c = wt(
1682
1682
  r.year,
1683
1683
  a
1684
1684
  );
@@ -1686,10 +1686,10 @@ class tr extends m {
1686
1686
  c,
1687
1687
  0,
1688
1688
  s.firstWeekContainsDate
1689
- ), e.setHours(0, 0, 0, 0), I(e, s);
1689
+ ), e.setHours(0, 0, 0, 0), _(e, s);
1690
1690
  }
1691
1691
  const o = !("era" in n) || n.era === 1 ? r.year : 1 - r.year;
1692
- return e.setFullYear(o, 0, s.firstWeekContainsDate), e.setHours(0, 0, 0, 0), I(e, s);
1692
+ return e.setFullYear(o, 0, s.firstWeekContainsDate), e.setHours(0, 0, 0, 0), _(e, s);
1693
1693
  }
1694
1694
  incompatibleTokens = [
1695
1695
  "y",
@@ -1707,7 +1707,7 @@ class tr extends m {
1707
1707
  "T"
1708
1708
  ];
1709
1709
  }
1710
- class nr extends m {
1710
+ class sr extends m {
1711
1711
  priority = 130;
1712
1712
  parse(e, n) {
1713
1713
  return Z(n === "R" ? 4 : n.length, e);
@@ -1734,7 +1734,7 @@ class nr extends m {
1734
1734
  "T"
1735
1735
  ];
1736
1736
  }
1737
- class rr extends m {
1737
+ class ar extends m {
1738
1738
  priority = 130;
1739
1739
  parse(e, n) {
1740
1740
  return Z(n === "u" ? 4 : n.length, e);
@@ -1744,7 +1744,7 @@ class rr extends m {
1744
1744
  }
1745
1745
  incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"];
1746
1746
  }
1747
- class sr extends m {
1747
+ class or extends m {
1748
1748
  priority = 120;
1749
1749
  parse(e, n, r) {
1750
1750
  switch (n) {
@@ -1806,7 +1806,7 @@ class sr extends m {
1806
1806
  "T"
1807
1807
  ];
1808
1808
  }
1809
- class ar extends m {
1809
+ class ir extends m {
1810
1810
  priority = 120;
1811
1811
  parse(e, n, r) {
1812
1812
  switch (n) {
@@ -1868,7 +1868,7 @@ class ar extends m {
1868
1868
  "T"
1869
1869
  ];
1870
1870
  }
1871
- class or extends m {
1871
+ class cr extends m {
1872
1872
  incompatibleTokens = [
1873
1873
  "Y",
1874
1874
  "R",
@@ -1931,7 +1931,7 @@ class or extends m {
1931
1931
  return e.setMonth(r, 1), e.setHours(0, 0, 0, 0), e;
1932
1932
  }
1933
1933
  }
1934
- class ir extends m {
1934
+ class ur extends m {
1935
1935
  priority = 110;
1936
1936
  parse(e, n, r) {
1937
1937
  const s = (a) => a - 1;
@@ -1994,11 +1994,11 @@ class ir extends m {
1994
1994
  "T"
1995
1995
  ];
1996
1996
  }
1997
- function cr(t, e, n) {
1998
- const r = p(t, n?.in), s = it(r, n) - e;
1997
+ function dr(t, e, n) {
1998
+ const r = p(t, n?.in), s = dt(r, n) - e;
1999
1999
  return r.setDate(r.getDate() - s * 7), p(r, n?.in);
2000
2000
  }
2001
- class ur extends m {
2001
+ class lr extends m {
2002
2002
  priority = 100;
2003
2003
  parse(e, n, r) {
2004
2004
  switch (n) {
@@ -2014,7 +2014,7 @@ class ur extends m {
2014
2014
  return n >= 1 && n <= 53;
2015
2015
  }
2016
2016
  set(e, n, r, s) {
2017
- return I(cr(e, r, s), s);
2017
+ return _(dr(e, r, s), s);
2018
2018
  }
2019
2019
  incompatibleTokens = [
2020
2020
  "y",
@@ -2032,11 +2032,11 @@ class ur extends m {
2032
2032
  "T"
2033
2033
  ];
2034
2034
  }
2035
- function dr(t, e, n) {
2036
- const r = p(t, n?.in), s = ot(r, n) - e;
2035
+ function fr(t, e, n) {
2036
+ const r = p(t, n?.in), s = ut(r, n) - e;
2037
2037
  return r.setDate(r.getDate() - s * 7), r;
2038
2038
  }
2039
- class lr extends m {
2039
+ class mr extends m {
2040
2040
  priority = 100;
2041
2041
  parse(e, n, r) {
2042
2042
  switch (n) {
@@ -2052,7 +2052,7 @@ class lr extends m {
2052
2052
  return n >= 1 && n <= 53;
2053
2053
  }
2054
2054
  set(e, n, r) {
2055
- return L(dr(e, r));
2055
+ return L(fr(e, r));
2056
2056
  }
2057
2057
  incompatibleTokens = [
2058
2058
  "y",
@@ -2071,7 +2071,7 @@ class lr extends m {
2071
2071
  "T"
2072
2072
  ];
2073
2073
  }
2074
- const fr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], mr = [
2074
+ const hr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], gr = [
2075
2075
  31,
2076
2076
  29,
2077
2077
  31,
@@ -2085,7 +2085,7 @@ const fr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], mr = [
2085
2085
  30,
2086
2086
  31
2087
2087
  ];
2088
- class hr extends m {
2088
+ class wr extends m {
2089
2089
  priority = 90;
2090
2090
  subPriority = 1;
2091
2091
  parse(e, n, r) {
@@ -2099,8 +2099,8 @@ class hr extends m {
2099
2099
  }
2100
2100
  }
2101
2101
  validate(e, n) {
2102
- const r = e.getFullYear(), s = ht(r), a = e.getMonth();
2103
- return s ? n >= 1 && n <= mr[a] : n >= 1 && n <= fr[a];
2102
+ const r = e.getFullYear(), s = yt(r), a = e.getMonth();
2103
+ return s ? n >= 1 && n <= gr[a] : n >= 1 && n <= hr[a];
2104
2104
  }
2105
2105
  set(e, n, r) {
2106
2106
  return e.setDate(r), e.setHours(0, 0, 0, 0), e;
@@ -2120,7 +2120,7 @@ class hr extends m {
2120
2120
  "T"
2121
2121
  ];
2122
2122
  }
2123
- class wr extends m {
2123
+ class yr extends m {
2124
2124
  priority = 90;
2125
2125
  subpriority = 1;
2126
2126
  parse(e, n, r) {
@@ -2136,7 +2136,7 @@ class wr extends m {
2136
2136
  }
2137
2137
  validate(e, n) {
2138
2138
  const r = e.getFullYear();
2139
- return ht(r) ? n >= 1 && n <= 366 : n >= 1 && n <= 365;
2139
+ return yt(r) ? n >= 1 && n <= 366 : n >= 1 && n <= 365;
2140
2140
  }
2141
2141
  set(e, n, r) {
2142
2142
  return e.setMonth(0, r), e.setHours(0, 0, 0, 0), e;
@@ -2159,11 +2159,11 @@ class wr extends m {
2159
2159
  "T"
2160
2160
  ];
2161
2161
  }
2162
- function he(t, e, n) {
2163
- const r = S(), s = n?.weekStartsOn ?? n?.locale?.options?.weekStartsOn ?? r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, a = p(t, n?.in), o = a.getDay(), i = (e % 7 + 7) % 7, u = 7 - s, d = e < 0 || e > 6 ? e - (o + u) % 7 : (i + u) % 7 - (o + u) % 7;
2164
- return rt(a, d, n);
2162
+ function we(t, e, n) {
2163
+ const r = $(), s = n?.weekStartsOn ?? n?.locale?.options?.weekStartsOn ?? r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, a = p(t, n?.in), o = a.getDay(), i = (e % 7 + 7) % 7, u = 7 - s, d = e < 0 || e > 6 ? e - (o + u) % 7 : (i + u) % 7 - (o + u) % 7;
2164
+ return ot(a, d, n);
2165
2165
  }
2166
- class gr extends m {
2166
+ class pr extends m {
2167
2167
  priority = 90;
2168
2168
  parse(e, n, r) {
2169
2169
  switch (n) {
@@ -2195,11 +2195,11 @@ class gr extends m {
2195
2195
  return n >= 0 && n <= 6;
2196
2196
  }
2197
2197
  set(e, n, r, s) {
2198
- return e = he(e, r, s), e.setHours(0, 0, 0, 0), e;
2198
+ return e = we(e, r, s), e.setHours(0, 0, 0, 0), e;
2199
2199
  }
2200
2200
  incompatibleTokens = ["D", "i", "e", "c", "t", "T"];
2201
2201
  }
2202
- class yr extends m {
2202
+ class br extends m {
2203
2203
  priority = 90;
2204
2204
  parse(e, n, r, s) {
2205
2205
  const a = (o) => {
@@ -2245,7 +2245,7 @@ class yr extends m {
2245
2245
  return n >= 0 && n <= 6;
2246
2246
  }
2247
2247
  set(e, n, r, s) {
2248
- return e = he(e, r, s), e.setHours(0, 0, 0, 0), e;
2248
+ return e = we(e, r, s), e.setHours(0, 0, 0, 0), e;
2249
2249
  }
2250
2250
  incompatibleTokens = [
2251
2251
  "y",
@@ -2265,7 +2265,7 @@ class yr extends m {
2265
2265
  "T"
2266
2266
  ];
2267
2267
  }
2268
- class pr extends m {
2268
+ class Dr extends m {
2269
2269
  priority = 90;
2270
2270
  parse(e, n, r, s) {
2271
2271
  const a = (o) => {
@@ -2311,7 +2311,7 @@ class pr extends m {
2311
2311
  return n >= 0 && n <= 6;
2312
2312
  }
2313
2313
  set(e, n, r, s) {
2314
- return e = he(e, r, s), e.setHours(0, 0, 0, 0), e;
2314
+ return e = we(e, r, s), e.setHours(0, 0, 0, 0), e;
2315
2315
  }
2316
2316
  incompatibleTokens = [
2317
2317
  "y",
@@ -2331,11 +2331,11 @@ class pr extends m {
2331
2331
  "T"
2332
2332
  ];
2333
2333
  }
2334
- function br(t, e, n) {
2335
- const r = p(t, n?.in), s = Vn(r, n), a = e - s;
2336
- return rt(r, a, n);
2334
+ function Tr(t, e, n) {
2335
+ const r = p(t, n?.in), s = jn(r, n), a = e - s;
2336
+ return ot(r, a, n);
2337
2337
  }
2338
- class Dr extends m {
2338
+ class Er extends m {
2339
2339
  priority = 90;
2340
2340
  parse(e, n, r) {
2341
2341
  const s = (a) => a === 0 ? 7 : a;
@@ -2406,7 +2406,7 @@ class Dr extends m {
2406
2406
  return n >= 1 && n <= 7;
2407
2407
  }
2408
2408
  set(e, n, r) {
2409
- return e = br(e, r), e.setHours(0, 0, 0, 0), e;
2409
+ return e = Tr(e, r), e.setHours(0, 0, 0, 0), e;
2410
2410
  }
2411
2411
  incompatibleTokens = [
2412
2412
  "y",
@@ -2426,7 +2426,7 @@ class Dr extends m {
2426
2426
  "T"
2427
2427
  ];
2428
2428
  }
2429
- class Tr extends m {
2429
+ class xr extends m {
2430
2430
  priority = 80;
2431
2431
  parse(e, n, r) {
2432
2432
  switch (n) {
@@ -2459,11 +2459,11 @@ class Tr extends m {
2459
2459
  }
2460
2460
  }
2461
2461
  set(e, n, r) {
2462
- return e.setHours(me(r), 0, 0, 0), e;
2462
+ return e.setHours(ge(r), 0, 0, 0), e;
2463
2463
  }
2464
2464
  incompatibleTokens = ["b", "B", "H", "k", "t", "T"];
2465
2465
  }
2466
- class Er extends m {
2466
+ class Pr extends m {
2467
2467
  priority = 80;
2468
2468
  parse(e, n, r) {
2469
2469
  switch (n) {
@@ -2496,11 +2496,11 @@ class Er extends m {
2496
2496
  }
2497
2497
  }
2498
2498
  set(e, n, r) {
2499
- return e.setHours(me(r), 0, 0, 0), e;
2499
+ return e.setHours(ge(r), 0, 0, 0), e;
2500
2500
  }
2501
2501
  incompatibleTokens = ["a", "B", "H", "k", "t", "T"];
2502
2502
  }
2503
- class xr extends m {
2503
+ class vr extends m {
2504
2504
  priority = 80;
2505
2505
  parse(e, n, r) {
2506
2506
  switch (n) {
@@ -2533,11 +2533,11 @@ class xr extends m {
2533
2533
  }
2534
2534
  }
2535
2535
  set(e, n, r) {
2536
- return e.setHours(me(r), 0, 0, 0), e;
2536
+ return e.setHours(ge(r), 0, 0, 0), e;
2537
2537
  }
2538
2538
  incompatibleTokens = ["a", "b", "t", "T"];
2539
2539
  }
2540
- class Pr extends m {
2540
+ class Mr extends m {
2541
2541
  priority = 70;
2542
2542
  parse(e, n, r) {
2543
2543
  switch (n) {
@@ -2558,7 +2558,7 @@ class Pr extends m {
2558
2558
  }
2559
2559
  incompatibleTokens = ["H", "K", "k", "t", "T"];
2560
2560
  }
2561
- class Mr extends m {
2561
+ class Or extends m {
2562
2562
  priority = 70;
2563
2563
  parse(e, n, r) {
2564
2564
  switch (n) {
@@ -2578,7 +2578,7 @@ class Mr extends m {
2578
2578
  }
2579
2579
  incompatibleTokens = ["a", "b", "h", "K", "k", "t", "T"];
2580
2580
  }
2581
- class vr extends m {
2581
+ class Ar extends m {
2582
2582
  priority = 70;
2583
2583
  parse(e, n, r) {
2584
2584
  switch (n) {
@@ -2598,7 +2598,7 @@ class vr extends m {
2598
2598
  }
2599
2599
  incompatibleTokens = ["h", "H", "k", "t", "T"];
2600
2600
  }
2601
- class Or extends m {
2601
+ class Nr extends m {
2602
2602
  priority = 70;
2603
2603
  parse(e, n, r) {
2604
2604
  switch (n) {
@@ -2619,7 +2619,7 @@ class Or extends m {
2619
2619
  }
2620
2620
  incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"];
2621
2621
  }
2622
- class Ar extends m {
2622
+ class kr extends m {
2623
2623
  priority = 60;
2624
2624
  parse(e, n, r) {
2625
2625
  switch (n) {
@@ -2639,7 +2639,7 @@ class Ar extends m {
2639
2639
  }
2640
2640
  incompatibleTokens = ["t", "T"];
2641
2641
  }
2642
- class Nr extends m {
2642
+ class Ir extends m {
2643
2643
  priority = 50;
2644
2644
  parse(e, n, r) {
2645
2645
  switch (n) {
@@ -2659,7 +2659,7 @@ class Nr extends m {
2659
2659
  }
2660
2660
  incompatibleTokens = ["t", "T"];
2661
2661
  }
2662
- class kr extends m {
2662
+ class Rr extends m {
2663
2663
  priority = 30;
2664
2664
  parse(e, n) {
2665
2665
  const r = (s) => Math.trunc(s * Math.pow(10, -n.length + 3));
@@ -2670,7 +2670,7 @@ class kr extends m {
2670
2670
  }
2671
2671
  incompatibleTokens = ["t", "T"];
2672
2672
  }
2673
- class Rr extends m {
2673
+ class _r extends m {
2674
2674
  priority = 10;
2675
2675
  parse(e, n) {
2676
2676
  switch (n) {
@@ -2703,7 +2703,7 @@ class Rr extends m {
2703
2703
  }
2704
2704
  incompatibleTokens = ["t", "T", "x"];
2705
2705
  }
2706
- class _r extends m {
2706
+ class Yr extends m {
2707
2707
  priority = 10;
2708
2708
  parse(e, n) {
2709
2709
  switch (n) {
@@ -2736,93 +2736,93 @@ class _r extends m {
2736
2736
  }
2737
2737
  incompatibleTokens = ["t", "T", "X"];
2738
2738
  }
2739
- class Ir extends m {
2739
+ class Cr extends m {
2740
2740
  priority = 40;
2741
2741
  parse(e) {
2742
- return ft(e);
2742
+ return gt(e);
2743
2743
  }
2744
2744
  set(e, n, r) {
2745
2745
  return [E(e, r * 1e3), { timestampIsSet: !0 }];
2746
2746
  }
2747
2747
  incompatibleTokens = "*";
2748
2748
  }
2749
- class Yr extends m {
2749
+ class Sr extends m {
2750
2750
  priority = 20;
2751
2751
  parse(e) {
2752
- return ft(e);
2752
+ return gt(e);
2753
2753
  }
2754
2754
  set(e, n, r) {
2755
2755
  return [E(e, r), { timestampIsSet: !0 }];
2756
2756
  }
2757
2757
  incompatibleTokens = "*";
2758
2758
  }
2759
- const Cr = {
2760
- G: new Zn(),
2761
- y: new er(),
2762
- Y: new tr(),
2763
- R: new nr(),
2764
- u: new rr(),
2765
- Q: new sr(),
2766
- q: new ar(),
2767
- M: new or(),
2768
- L: new ir(),
2769
- w: new ur(),
2770
- I: new lr(),
2771
- d: new hr(),
2772
- D: new wr(),
2773
- E: new gr(),
2774
- e: new yr(),
2775
- c: new pr(),
2776
- i: new Dr(),
2777
- a: new Tr(),
2778
- b: new Er(),
2779
- B: new xr(),
2780
- h: new Pr(),
2781
- H: new Mr(),
2782
- K: new vr(),
2783
- k: new Or(),
2784
- m: new Ar(),
2785
- s: new Nr(),
2786
- S: new kr(),
2787
- X: new Rr(),
2788
- x: new _r(),
2789
- t: new Ir(),
2790
- T: new Yr()
2791
- }, Lr = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Sr = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Wr = /^'([^]*?)'?$/, $r = /''/g, qr = /\S/, Qr = /[a-zA-Z]/;
2792
- function Fr(t, e, n, r) {
2793
- const s = () => E(n, NaN), a = Gn(), o = a.locale ?? at, c = a.firstWeekContainsDate ?? a.locale?.options?.firstWeekContainsDate ?? 1, i = a.weekStartsOn ?? a.locale?.options?.weekStartsOn ?? 0;
2759
+ const Lr = {
2760
+ G: new tr(),
2761
+ y: new nr(),
2762
+ Y: new rr(),
2763
+ R: new sr(),
2764
+ u: new ar(),
2765
+ Q: new or(),
2766
+ q: new ir(),
2767
+ M: new cr(),
2768
+ L: new ur(),
2769
+ w: new lr(),
2770
+ I: new mr(),
2771
+ d: new wr(),
2772
+ D: new yr(),
2773
+ E: new pr(),
2774
+ e: new br(),
2775
+ c: new Dr(),
2776
+ i: new Er(),
2777
+ a: new xr(),
2778
+ b: new Pr(),
2779
+ B: new vr(),
2780
+ h: new Mr(),
2781
+ H: new Or(),
2782
+ K: new Ar(),
2783
+ k: new Nr(),
2784
+ m: new kr(),
2785
+ s: new Ir(),
2786
+ S: new Rr(),
2787
+ X: new _r(),
2788
+ x: new Yr(),
2789
+ t: new Cr(),
2790
+ T: new Sr()
2791
+ }, $r = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Wr = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, qr = /^'([^]*?)'?$/, Hr = /''/g, Qr = /\S/, Fr = /[a-zA-Z]/;
2792
+ function Ur(t, e, n, r) {
2793
+ const s = () => E(n, NaN), a = Xn(), o = a.locale ?? ct, c = a.firstWeekContainsDate ?? a.locale?.options?.firstWeekContainsDate ?? 1, i = a.weekStartsOn ?? a.locale?.options?.weekStartsOn ?? 0;
2794
2794
  if (!e)
2795
2795
  return t ? s() : p(n, r?.in);
2796
2796
  const u = {
2797
2797
  firstWeekContainsDate: c,
2798
2798
  weekStartsOn: i,
2799
2799
  locale: o
2800
- }, d = [new Jn(r?.in, n)], l = e.match(Sr).map((f) => {
2801
- const w = f[0];
2802
- if (w in se) {
2803
- const P = se[w];
2800
+ }, d = [new er(r?.in, n)], l = e.match(Wr).map((f) => {
2801
+ const g = f[0];
2802
+ if (g in se) {
2803
+ const P = se[g];
2804
2804
  return P(f, o.formatLong);
2805
2805
  }
2806
2806
  return f;
2807
- }).join("").match(Lr), g = [];
2807
+ }).join("").match($r), w = [];
2808
2808
  for (let f of l) {
2809
- dt(f) && ae(f, e, t), ut(f) && ae(f, e, t);
2810
- const w = f[0], P = Cr[w];
2809
+ mt(f) && ae(f, e, t), ft(f) && ae(f, e, t);
2810
+ const g = f[0], P = Lr[g];
2811
2811
  if (P) {
2812
- const { incompatibleTokens: v } = P;
2813
- if (Array.isArray(v)) {
2814
- const $ = g.find(
2815
- (U) => v.includes(U.token) || U.token === w
2812
+ const { incompatibleTokens: M } = P;
2813
+ if (Array.isArray(M)) {
2814
+ const q = w.find(
2815
+ (U) => M.includes(U.token) || U.token === g
2816
2816
  );
2817
- if ($)
2817
+ if (q)
2818
2818
  throw new RangeError(
2819
- `The format string mustn't contain \`${$.fullToken}\` and \`${f}\` at the same time`
2819
+ `The format string mustn't contain \`${q.fullToken}\` and \`${f}\` at the same time`
2820
2820
  );
2821
- } else if (P.incompatibleTokens === "*" && g.length > 0)
2821
+ } else if (P.incompatibleTokens === "*" && w.length > 0)
2822
2822
  throw new RangeError(
2823
2823
  `The format string mustn't contain \`${f}\` and any other token at the same time`
2824
2824
  );
2825
- g.push({ token: w, fullToken: f });
2825
+ w.push({ token: g, fullToken: f });
2826
2826
  const W = P.run(
2827
2827
  t,
2828
2828
  f,
@@ -2833,49 +2833,49 @@ function Fr(t, e, n, r) {
2833
2833
  return s();
2834
2834
  d.push(W.setter), t = W.rest;
2835
2835
  } else {
2836
- if (w.match(Qr))
2836
+ if (g.match(Fr))
2837
2837
  throw new RangeError(
2838
- "Format string contains an unescaped latin alphabet character `" + w + "`"
2838
+ "Format string contains an unescaped latin alphabet character `" + g + "`"
2839
2839
  );
2840
- if (f === "''" ? f = "'" : w === "'" && (f = Hr(f)), t.indexOf(f) === 0)
2840
+ if (f === "''" ? f = "'" : g === "'" && (f = Br(f)), t.indexOf(f) === 0)
2841
2841
  t = t.slice(f.length);
2842
2842
  else
2843
2843
  return s();
2844
2844
  }
2845
2845
  }
2846
- if (t.length > 0 && qr.test(t))
2846
+ if (t.length > 0 && Qr.test(t))
2847
2847
  return s();
2848
- const M = d.map((f) => f.priority).sort((f, w) => w - f).filter((f, w, P) => P.indexOf(f) === w).map(
2849
- (f) => d.filter((w) => w.priority === f).sort((w, P) => P.subPriority - w.subPriority)
2848
+ const v = d.map((f) => f.priority).sort((f, g) => g - f).filter((f, g, P) => P.indexOf(f) === g).map(
2849
+ (f) => d.filter((g) => g.priority === f).sort((g, P) => P.subPriority - g.subPriority)
2850
2850
  ).map((f) => f[0]);
2851
2851
  let x = p(n, r?.in);
2852
2852
  if (isNaN(+x)) return s();
2853
2853
  const N = {};
2854
- for (const f of M) {
2854
+ for (const f of v) {
2855
2855
  if (!f.validate(x, u))
2856
2856
  return s();
2857
- const w = f.set(x, N, u);
2858
- Array.isArray(w) ? (x = w[0], Object.assign(N, w[1])) : x = w;
2857
+ const g = f.set(x, N, u);
2858
+ Array.isArray(g) ? (x = g[0], Object.assign(N, g[1])) : x = g;
2859
2859
  }
2860
2860
  return x;
2861
2861
  }
2862
- function Hr(t) {
2863
- return t.match(Wr)[1].replace($r, "'");
2862
+ function Br(t) {
2863
+ return t.match(qr)[1].replace(Hr, "'");
2864
2864
  }
2865
- function Ur(t, e) {
2866
- const n = () => E(e?.in, NaN), s = Xr(t);
2865
+ function Vr(t, e) {
2866
+ const n = () => E(e?.in, NaN), s = zr(t);
2867
2867
  let a;
2868
2868
  if (s.date) {
2869
- const u = jr(s.date, 2);
2870
- a = zr(u.restDateString, u.year);
2869
+ const u = Kr(s.date, 2);
2870
+ a = Jr(u.restDateString, u.year);
2871
2871
  }
2872
2872
  if (!a || isNaN(+a)) return n();
2873
2873
  const o = +a;
2874
2874
  let c = 0, i;
2875
- if (s.time && (c = Kr(s.time), isNaN(c)))
2875
+ if (s.time && (c = Zr(s.time), isNaN(c)))
2876
2876
  return n();
2877
2877
  if (s.timezone) {
2878
- if (i = Jr(s.timezone), isNaN(i)) return n();
2878
+ if (i = es(s.timezone), isNaN(i)) return n();
2879
2879
  } else {
2880
2880
  const u = new Date(o + c), d = p(0, e?.in);
2881
2881
  return d.setFullYear(
@@ -2891,26 +2891,26 @@ function Ur(t, e) {
2891
2891
  }
2892
2892
  return p(o + c + i, e?.in);
2893
2893
  }
2894
- const G = {
2894
+ const V = {
2895
2895
  dateTimeDelimiter: /[T ]/,
2896
2896
  timeZoneDelimiter: /[Z ]/i,
2897
2897
  timezone: /([Z+-].*)$/
2898
- }, Br = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, Gr = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, Vr = /^([+-])(\d{2})(?::?(\d{2}))?$/;
2899
- function Xr(t) {
2900
- const e = {}, n = t.split(G.dateTimeDelimiter);
2898
+ }, Gr = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, Xr = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, jr = /^([+-])(\d{2})(?::?(\d{2}))?$/;
2899
+ function zr(t) {
2900
+ const e = {}, n = t.split(V.dateTimeDelimiter);
2901
2901
  let r;
2902
2902
  if (n.length > 2)
2903
2903
  return e;
2904
- if (/:/.test(n[0]) ? r = n[0] : (e.date = n[0], r = n[1], G.timeZoneDelimiter.test(e.date) && (e.date = t.split(G.timeZoneDelimiter)[0], r = t.substr(
2904
+ if (/:/.test(n[0]) ? r = n[0] : (e.date = n[0], r = n[1], V.timeZoneDelimiter.test(e.date) && (e.date = t.split(V.timeZoneDelimiter)[0], r = t.substr(
2905
2905
  e.date.length,
2906
2906
  t.length
2907
2907
  ))), r) {
2908
- const s = G.timezone.exec(r);
2908
+ const s = V.timezone.exec(r);
2909
2909
  s ? (e.time = r.replace(s[1], ""), e.timezone = s[1]) : e.time = r;
2910
2910
  }
2911
2911
  return e;
2912
2912
  }
2913
- function jr(t, e) {
2913
+ function Kr(t, e) {
2914
2914
  const n = new RegExp(
2915
2915
  "^(?:(\\d{4}|[+-]\\d{" + (4 + e) + "})|(\\d{2}|[+-]\\d{" + (2 + e) + "})$)"
2916
2916
  ), r = t.match(n);
@@ -2921,84 +2921,84 @@ function jr(t, e) {
2921
2921
  restDateString: t.slice((r[1] || r[2]).length)
2922
2922
  };
2923
2923
  }
2924
- function zr(t, e) {
2924
+ function Jr(t, e) {
2925
2925
  if (e === null) return /* @__PURE__ */ new Date(NaN);
2926
- const n = t.match(Br);
2926
+ const n = t.match(Gr);
2927
2927
  if (!n) return /* @__PURE__ */ new Date(NaN);
2928
2928
  const r = !!n[4], s = F(n[1]), a = F(n[2]) - 1, o = F(n[3]), c = F(n[4]), i = F(n[5]) - 1;
2929
2929
  if (r)
2930
- return rs(e, c, i) ? Zr(e, c, i) : /* @__PURE__ */ new Date(NaN);
2930
+ return as(e, c, i) ? ts(e, c, i) : /* @__PURE__ */ new Date(NaN);
2931
2931
  {
2932
2932
  const u = /* @__PURE__ */ new Date(0);
2933
- return !ts(e, a, o) || !ns(e, s) ? /* @__PURE__ */ new Date(NaN) : (u.setUTCFullYear(e, a, Math.max(s, o)), u);
2933
+ return !rs(e, a, o) || !ss(e, s) ? /* @__PURE__ */ new Date(NaN) : (u.setUTCFullYear(e, a, Math.max(s, o)), u);
2934
2934
  }
2935
2935
  }
2936
2936
  function F(t) {
2937
2937
  return t ? parseInt(t) : 1;
2938
2938
  }
2939
- function Kr(t) {
2940
- const e = t.match(Gr);
2939
+ function Zr(t) {
2940
+ const e = t.match(Xr);
2941
2941
  if (!e) return NaN;
2942
2942
  const n = ne(e[1]), r = ne(e[2]), s = ne(e[3]);
2943
- return ss(n, r, s) ? n * le + r * de + s * 1e3 : NaN;
2943
+ return os(n, r, s) ? n * me + r * fe + s * 1e3 : NaN;
2944
2944
  }
2945
2945
  function ne(t) {
2946
2946
  return t && parseFloat(t.replace(",", ".")) || 0;
2947
2947
  }
2948
- function Jr(t) {
2948
+ function es(t) {
2949
2949
  if (t === "Z") return 0;
2950
- const e = t.match(Vr);
2950
+ const e = t.match(jr);
2951
2951
  if (!e) return 0;
2952
2952
  const n = e[1] === "+" ? -1 : 1, r = parseInt(e[2]), s = e[3] && parseInt(e[3]) || 0;
2953
- return as(r, s) ? n * (r * le + s * de) : NaN;
2953
+ return is(r, s) ? n * (r * me + s * fe) : NaN;
2954
2954
  }
2955
- function Zr(t, e, n) {
2955
+ function ts(t, e, n) {
2956
2956
  const r = /* @__PURE__ */ new Date(0);
2957
2957
  r.setUTCFullYear(t, 0, 4);
2958
2958
  const s = r.getUTCDay() || 7, a = (e - 1) * 7 + n + 1 - s;
2959
2959
  return r.setUTCDate(r.getUTCDate() + a), r;
2960
2960
  }
2961
- const es = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2962
- function wt(t) {
2961
+ const ns = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2962
+ function pt(t) {
2963
2963
  return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0;
2964
2964
  }
2965
- function ts(t, e, n) {
2966
- return e >= 0 && e <= 11 && n >= 1 && n <= (es[e] || (wt(t) ? 29 : 28));
2965
+ function rs(t, e, n) {
2966
+ return e >= 0 && e <= 11 && n >= 1 && n <= (ns[e] || (pt(t) ? 29 : 28));
2967
2967
  }
2968
- function ns(t, e) {
2969
- return e >= 1 && e <= (wt(t) ? 366 : 365);
2968
+ function ss(t, e) {
2969
+ return e >= 1 && e <= (pt(t) ? 366 : 365);
2970
2970
  }
2971
- function rs(t, e, n) {
2971
+ function as(t, e, n) {
2972
2972
  return e >= 1 && e <= 53 && n >= 0 && n <= 6;
2973
2973
  }
2974
- function ss(t, e, n) {
2974
+ function os(t, e, n) {
2975
2975
  return t === 24 ? e === 0 && n === 0 : n >= 0 && n < 60 && e >= 0 && e < 60 && t >= 0 && t < 25;
2976
2976
  }
2977
- function as(t, e) {
2977
+ function is(t, e) {
2978
2978
  return e >= 0 && e <= 59;
2979
2979
  }
2980
- const V = (t) => {
2980
+ const G = (t) => {
2981
2981
  if (!t.includes("T")) {
2982
- for (const n of os) {
2983
- const r = Fr(t, n, /* @__PURE__ */ new Date());
2982
+ for (const n of cs) {
2983
+ const r = Ur(t, n, /* @__PURE__ */ new Date());
2984
2984
  if (re(r))
2985
2985
  return r;
2986
2986
  }
2987
2987
  return null;
2988
2988
  }
2989
- const e = Ur(t);
2989
+ const e = Vr(t);
2990
2990
  return re(e) ? e : null;
2991
- }, os = ["yyyy-MM-dd", "MM-dd-yyyy"], oe = (t, e, n) => {
2991
+ }, cs = ["yyyy-MM-dd", "MM-dd-yyyy"], oe = (t, e, n) => {
2992
2992
  const r = {};
2993
- return e?.contentType !== null && (r[Ht] = e?.contentType || Ft), e?.jwt ? r.Authorization = `Bearer ${e.jwt}` : t && (r[j] = t), e?.chatReference && (r[Ut] = e.chatReference), { ...r, ...n };
2994
- }, is = (t) => {
2993
+ return e?.contentType !== null && (r[Bt] = e?.contentType || Ut), e?.jwt ? r.Authorization = `Bearer ${e.jwt}` : t && (r[j] = t), e?.chatReference && (r[Vt] = e.chatReference), { ...r, ...n };
2994
+ }, us = (t) => {
2995
2995
  const e = { ...t };
2996
2996
  return e[j] && (e[j] = e[j].substring(0, 8) + "...[REDACTED]"), e.Authorization && (e.Authorization = "Bearer [REDACTED]"), e[z] && (e[z] = e[z].substring(0, 8) + "...[REDACTED]"), e;
2997
- }, qe = async (t, e, n) => await fetch(t, {
2997
+ }, Qe = async (t, e, n) => await fetch(t, {
2998
2998
  method: n.method || "GET",
2999
2999
  headers: e,
3000
3000
  body: n.body ? JSON.stringify(n.body) : void 0
3001
- }), cs = async (t, e, n) => {
3001
+ }), ds = async (t, e, n) => {
3002
3002
  const r = n?.body === void 0 ? void 0 : n?.isFormData ? n.body : JSON.stringify(n.body);
3003
3003
  return await fetch(t, {
3004
3004
  method: n.method,
@@ -3007,7 +3007,7 @@ const V = (t) => {
3007
3007
  signal: n?.signal
3008
3008
  });
3009
3009
  };
3010
- class us {
3010
+ class ls {
3011
3011
  constructor() {
3012
3012
  this.decoder = new TextDecoder();
3013
3013
  }
@@ -3028,7 +3028,7 @@ class us {
3028
3028
  async initializeStreamRequest(e, n, r, s) {
3029
3029
  const a = oe(void 0, {
3030
3030
  jwt: s
3031
- }), o = await cs(
3031
+ }), o = await ds(
3032
3032
  e,
3033
3033
  {
3034
3034
  Accept: "text/event-stream",
@@ -3048,13 +3048,13 @@ class us {
3048
3048
  } catch {
3049
3049
  i.error = "Failed to parse error body";
3050
3050
  }
3051
- throw new Ie({
3051
+ throw new Ce({
3052
3052
  status: o.status,
3053
3053
  message: i.error ?? "No response body"
3054
3054
  });
3055
3055
  }
3056
3056
  if (!o.body)
3057
- throw new Ie({
3057
+ throw new Ce({
3058
3058
  message: "No response body",
3059
3059
  status: o.status
3060
3060
  });
@@ -3103,8 +3103,8 @@ class us {
3103
3103
  }
3104
3104
  }
3105
3105
  }
3106
- new us();
3107
- class $a {
3106
+ new ls();
3107
+ class Qa {
3108
3108
  constructor(e) {
3109
3109
  this.config = e, console.info("SdmxApiClient initialized", {
3110
3110
  apiUrl: e.apiUrl || "NOT SET"
@@ -3130,7 +3130,7 @@ class $a {
3130
3130
  const a = `${this.config.apiUrl}/${e}`, o = this.buildHeaders(s, n.headers), c = new ReadableStream({
3131
3131
  async start(u) {
3132
3132
  try {
3133
- const d = await qe(a, o, n);
3133
+ const d = await Qe(a, o, n);
3134
3134
  if (!d.ok) {
3135
3135
  const x = await d.text();
3136
3136
  throw console.error(
@@ -3139,13 +3139,13 @@ class $a {
3139
3139
  }
3140
3140
  const l = d.body?.getReader();
3141
3141
  if (!l) throw new Error("Failed to create stream reader");
3142
- const g = new Uint8Array([239, 187, 191]);
3143
- u.enqueue(g);
3144
- const M = async () => {
3142
+ const w = new Uint8Array([239, 187, 191]);
3143
+ u.enqueue(w);
3144
+ const v = async () => {
3145
3145
  const { done: x, value: N } = await l.read();
3146
- x ? u.close() : (u.enqueue(N), await M());
3146
+ x ? u.close() : (u.enqueue(N), await v());
3147
3147
  };
3148
- M();
3148
+ v();
3149
3149
  } catch (d) {
3150
3150
  u.error(d);
3151
3151
  }
@@ -3159,7 +3159,7 @@ class $a {
3159
3159
  const a = Date.now(), o = `${r || this.config.apiUrl}/${e}`, c = this.buildHeaders(s, n.headers);
3160
3160
  this.addInfoRequestLog("API Request", o, n, c);
3161
3161
  try {
3162
- const i = await qe(o, c, n), u = Date.now() - a;
3162
+ const i = await Qe(o, c, n), u = Date.now() - a;
3163
3163
  let d;
3164
3164
  const l = await i.text();
3165
3165
  try {
@@ -3179,8 +3179,8 @@ class $a {
3179
3179
  }
3180
3180
  if (!i.ok) {
3181
3181
  this.addErrorRequestLog(o, n, i, u, d);
3182
- const g = Qt(d, i);
3183
- throw new Error(`API request failed: ${g}`);
3182
+ const w = Ft(d, i);
3183
+ throw new Error(`API request failed: ${w}`);
3184
3184
  }
3185
3185
  return d;
3186
3186
  } catch (i) {
@@ -3209,7 +3209,7 @@ class $a {
3209
3209
  const a = {
3210
3210
  method: r.method || "GET",
3211
3211
  url: n,
3212
- headers: is(s)
3212
+ headers: us(s)
3213
3213
  };
3214
3214
  r.body && (a.body = r.body), console.info(e, a);
3215
3215
  }
@@ -3235,12 +3235,197 @@ class $a {
3235
3235
  });
3236
3236
  }
3237
3237
  }
3238
- const qa = ["FREQ", "FREQUENCY"], ds = "TIME_PERIOD", ls = "time_period_start", fs = "time_period_end";
3239
- var ms = /* @__PURE__ */ ((t) => (t.CONDITIONAL = "Conditional", t.MANDATORY = "Mandatory", t))(ms || {}), we = /* @__PURE__ */ ((t) => (t.DIMENSION = "Dimension", t.MEASURE_DIMENSION = "MeasureDimension", t.TIME_DIMENSION = "TimeDimension", t))(we || {}), hs = /* @__PURE__ */ ((t) => (t.UNBOUNDED = "unbounded", t))(hs || {});
3240
- const ws = (t, e) => {
3238
+ var ye = /* @__PURE__ */ ((t) => (t.LAST_UPDATE_AT = "lastUpdatedAt", t.SERIES_COUNT = "series_count", t))(ye || {});
3239
+ function Fa(t) {
3240
+ return t?.annotations?.find((e) => {
3241
+ if (e.id === ye.LAST_UPDATE_AT)
3242
+ return e;
3243
+ })?.value;
3244
+ }
3245
+ const pe = (t, e) => t?.names && t?.names[e] || t?.name, bt = (t, e, n) => {
3246
+ if (!(!t || e?.has(t?.id)) && (e?.set(t?.id, t), t?.parent)) {
3247
+ const r = n?.get(t?.parent);
3248
+ bt(r, e, n);
3249
+ }
3250
+ }, fs = (t, e) => {
3251
+ const n = /* @__PURE__ */ new Map(), r = new Map(t?.map((s) => [s.id, s]));
3252
+ return e?.forEach((s) => {
3253
+ bt(s, n, r);
3254
+ }), Array.from(n?.values());
3255
+ };
3256
+ var ms = /* @__PURE__ */ ((t) => (t.C = "c", t))(ms || {}), I = /* @__PURE__ */ ((t) => (t.EQUALS = "eq", t.NOT_EQUALS = "ne", t.LESS = "lt", t.LESS_OR_EQUAL = "le", t.GREATER = "gt", t.GREATER_OR_EQUAL = "ge", t.CONTAINS = "co", t.NOT_CONTAINS = "nc", t.STARTS = "sw", t.ENDS = "ew", t))(I || {}), hs = /* @__PURE__ */ ((t) => (t.BOOLEAN = "Boolean", t.DATE_TIME = "DateTime", t.DECIMAL = "Decimal", t.INTEGER = "Integer", t.OBSERVATION_TIME_PERIOD = "ObservationalTimePeriod", t.STRING = "String", t.TIME = "Time", t.TIME_RANGE = "TimeRange", t.URI = "URI", t))(hs || {}), gs = /* @__PURE__ */ ((t) => (t.ANNUAL = "A", t.QUARTERLY = "Q", t.MONTHLY = "M", t))(gs || {});
3257
+ const Ua = ["FREQ", "FREQUENCY"], ws = "TIME_PERIOD", ys = "time_period_start", ps = "time_period_end", Ba = (t) => {
3258
+ const e = t?.find(
3259
+ (a) => a.id === ys
3260
+ ), n = t?.find(
3261
+ (a) => a.id === ps
3262
+ ), r = n?.title ? new Date(n?.title) : null;
3263
+ return {
3264
+ startPeriod: e?.title ? new Date(e?.title) : null,
3265
+ endPeriod: r
3266
+ };
3267
+ }, bs = (t, e) => t.id.localeCompare(e.id), Ds = (t, e) => t.memberValue.localeCompare(e.memberValue), Ts = (t, e) => {
3268
+ const n = new Array(t.length), r = t.map((o, c) => [o, c]);
3269
+ r.sort(
3270
+ (o, c) => bs(o[0], c[0])
3271
+ );
3272
+ const s = [...e];
3273
+ s.sort(Ds);
3274
+ let a = 0;
3275
+ for (const o of r) {
3276
+ const c = o[0];
3277
+ for (; a < s.length && s[a].memberValue.localeCompare(c.id) < 0; )
3278
+ a += 1;
3279
+ a < s.length && s[a].memberValue === c.id && (n[o[1]] = o[0]);
3280
+ }
3281
+ return n.filter((o) => o != null);
3282
+ }, Es = (t) => !!t?.some((e) => e.parent), Va = (t, e, n, r, s = []) => {
3283
+ let a = t || [];
3284
+ if (xs(n || [], e || "")) {
3285
+ const o = (n || [])[0].cubeRegions?.find(
3286
+ ({ isIncluded: c }) => c
3287
+ );
3288
+ if (o) {
3289
+ const c = o.memberSelection?.find(
3290
+ ({ componentId: i }) => i === e
3291
+ );
3292
+ c ? a = a.length === 0 ? (c.selectionValues || []).map(({ memberValue: i }) => ({
3293
+ id: i,
3294
+ name: i
3295
+ })) : Ts(a, c.selectionValues) : a = [];
3296
+ }
3297
+ } else s.length !== 0 && (a = a.filter(({ id: o }) => s.includes(o)));
3298
+ return Es(t) && (a = fs(t, a)), a?.map((o) => ({
3299
+ ...o,
3300
+ name: r ? pe(o, r) : o?.name
3301
+ }));
3302
+ }, xs = (t, e) => t != null && t.length > 0 && e != null, Ps = (t) => {
3303
+ const e = [];
3304
+ return t?.filters?.forEach((n) => {
3305
+ n.componentCode !== ws && e.push({
3306
+ componentCode: n.componentCode,
3307
+ operator: I.EQUALS,
3308
+ value: n.values.join(",")
3309
+ });
3310
+ }), e;
3311
+ }, Ga = (t) => {
3312
+ const e = /* @__PURE__ */ new Map();
3313
+ return t?.forEach((n) => {
3314
+ e.set(n.urn, Ps(n));
3315
+ }), e;
3316
+ }, vs = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Fe = (t) => {
3317
+ if (typeof t != "string")
3318
+ throw new TypeError("Invalid argument expected string");
3319
+ const e = t.match(vs);
3320
+ if (!e)
3321
+ throw new Error(`Invalid argument not valid semver ('${t}' received)`);
3322
+ return e.shift(), e;
3323
+ }, Ue = (t) => t === "*" || t === "x" || t === "X", Be = (t) => {
3324
+ const e = parseInt(t, 10);
3325
+ return isNaN(e) ? t : e;
3326
+ }, Ms = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], Os = (t, e) => {
3327
+ if (Ue(t) || Ue(e))
3328
+ return 0;
3329
+ const [n, r] = Ms(Be(t), Be(e));
3330
+ return n > r ? 1 : n < r ? -1 : 0;
3331
+ }, Ve = (t, e) => {
3332
+ for (let n = 0; n < Math.max(t.length, e.length); n++) {
3333
+ const r = Os(t[n] || "0", e[n] || "0");
3334
+ if (r !== 0)
3335
+ return r;
3336
+ }
3337
+ return 0;
3338
+ }, As = (t, e) => {
3339
+ const n = Fe(t), r = Fe(e), s = n.pop(), a = r.pop(), o = Ve(n, r);
3340
+ return o !== 0 ? o : s && a ? Ve(s.split("."), a.split(".")) : s || a ? s ? -1 : 1 : 0;
3341
+ }, Ns = (t, e, n) => {
3342
+ ks(n);
3343
+ const r = As(t, e);
3344
+ return Dt[n].includes(r);
3345
+ }, Dt = {
3346
+ ">": [1],
3347
+ ">=": [0, 1],
3348
+ "=": [0],
3349
+ "<=": [-1, 0],
3350
+ "<": [-1],
3351
+ "!=": [-1, 1]
3352
+ }, Ge = Object.keys(Dt), ks = (t) => {
3353
+ if (Ge.indexOf(t) === -1)
3354
+ throw new Error(`Invalid operator, expected one of ${Ge.join("|")}`);
3355
+ }, ie = "+", be = (t, e) => {
3356
+ const { agency: n, id: r, version: s } = C(t), a = e.filter(
3357
+ (i) => i.agencyID === n && i.id === r && !i?.version?.includes(ie)
3358
+ );
3359
+ if (a.length === 1)
3360
+ return a[0];
3361
+ if (!s?.includes(ie))
3362
+ return a.find((i) => i.version === s);
3363
+ const o = a.map(
3364
+ (i) => i.version
3365
+ ), c = Is(s, o);
3366
+ return a.find(
3367
+ (i) => i.version === c[0]
3368
+ );
3369
+ }, Is = (t, e) => {
3370
+ const n = Rs(t, e);
3371
+ return n.length > 0 ? [n[0]] : [];
3372
+ }, Rs = (t, e) => {
3373
+ const n = [];
3374
+ return e.forEach((r) => {
3375
+ Ys(t, r) && n.push(r);
3376
+ }), n;
3377
+ }, _s = (t) => {
3378
+ const e = t.trim(), n = e.indexOf("+");
3379
+ if (n <= 0) return "";
3380
+ let r = n;
3381
+ for (; r > 0 && e[r - 1] >= "0" && e[r - 1] <= "9"; )
3382
+ r--;
3383
+ return r > 0 ? e.slice(0, r) : "";
3384
+ }, Ys = (t, e) => {
3385
+ const n = t.trim().replace(/\+/, ""), r = _s(t);
3386
+ return e.startsWith(r) && Ns(e, n, ">=");
3387
+ }, De = (t, e) => {
3388
+ const { concept: n } = Cs(t, e);
3389
+ return n;
3390
+ }, Cs = (t, e) => {
3391
+ if (t == null)
3392
+ return {
3393
+ concept: void 0,
3394
+ scheme: void 0
3395
+ };
3396
+ const { childId: n, agency: r, id: s, version: a } = tt(t);
3397
+ if (a?.includes(ie)) {
3398
+ const o = be(
3399
+ t,
3400
+ e
3401
+ );
3402
+ return {
3403
+ concept: Xe(o?.concepts || [], n),
3404
+ scheme: o
3405
+ };
3406
+ }
3407
+ for (const o of e)
3408
+ if (Ss(o, s, r, a))
3409
+ return {
3410
+ concept: Xe(o?.concepts || [], n),
3411
+ scheme: o
3412
+ };
3413
+ return {
3414
+ concept: void 0,
3415
+ scheme: void 0
3416
+ };
3417
+ }, Xe = (t, e) => t?.find((n) => n.id === e), Ss = (t, e, n, r) => t.id === e && t.agencyID === n && t.version === r, Xa = (t = [], e = [], n) => {
3418
+ const r = n?.conceptIdentity || "", s = De(r, e), a = K(
3419
+ n?.localRepresentation?.enumeration
3420
+ ), o = K(
3421
+ s?.coreRepresentation?.enumeration
3422
+ ), c = a || o;
3423
+ if (c != null)
3424
+ return be(c, t);
3425
+ }, Ls = (t, e) => {
3241
3426
  const n = t?.data?.dataSets?.[0], s = t?.data?.structures?.[0]?.attributes?.dimensionGroup || [], a = n?.dimensionGroupAttributes, o = {};
3242
3427
  for (const c of s) {
3243
- const i = c.relationship.dimensions, { codedSeriesKey: u, decodedSeriesKey: d } = gt(
3428
+ const i = c.relationship.dimensions, { codedSeriesKey: u, decodedSeriesKey: d } = Tt(
3244
3429
  t,
3245
3430
  e,
3246
3431
  i
@@ -3252,7 +3437,7 @@ const ws = (t, e) => {
3252
3437
  };
3253
3438
  }
3254
3439
  return o;
3255
- }, gt = (t, e, n) => {
3440
+ }, Tt = (t, e, n) => {
3256
3441
  const r = t?.data?.structures?.[0], s = [
3257
3442
  ...r?.dimensions.series || [],
3258
3443
  ...r?.dimensions.observation || []
@@ -3266,7 +3451,7 @@ const ws = (t, e) => {
3266
3451
  codedSeriesKey: a.join(":"),
3267
3452
  decodedSeriesKey: o.join(":")
3268
3453
  };
3269
- }, Qa = (t, e, n) => {
3454
+ }, ja = (t, e, n) => {
3270
3455
  const r = t?.data?.dataSets?.[0], s = t?.data?.structures?.[0], a = (s?.attributes?.dimensionGroup || []).filter(
3271
3456
  (l) => l.relationship.dimensions?.length === 1 && l.relationship.dimensions.includes(e || "")
3272
3457
  ), o = r?.dimensionGroupAttributes, c = [
@@ -3276,69 +3461,232 @@ const ws = (t, e) => {
3276
3461
  u[i] = n || "";
3277
3462
  const d = {};
3278
3463
  for (const l of a) {
3279
- const g = l.relationship.dimensions, { codedSeriesKey: M, decodedSeriesKey: x } = gt(
3464
+ const w = l.relationship.dimensions, { codedSeriesKey: v, decodedSeriesKey: x } = Tt(
3280
3465
  t,
3281
3466
  u,
3282
- g
3467
+ w
3283
3468
  );
3284
3469
  d[l.id] = {
3285
- values: o?.[M] || [],
3470
+ values: o?.[v] || [],
3286
3471
  decodedSeriesKey: x,
3287
- codedSeriesKey: M
3472
+ codedSeriesKey: v
3288
3473
  };
3289
3474
  }
3290
3475
  return d;
3291
- }, gs = (t, e) => {
3476
+ }, $s = (t, e) => {
3292
3477
  if (e == null)
3293
3478
  return;
3294
3479
  const n = t.values?.[e];
3295
3480
  return n ?? (e instanceof Array ? { values: e } : { value: e.toString() });
3296
- }, ys = "Observation", Fa = (t) => {
3297
- const e = t?.data?.dataSets, n = t?.data?.structures?.[0];
3298
- if (!e || !n)
3299
- return [];
3300
- const r = n.attributes, s = n.dimensions, a = r?.dimensionGroup || [], o = e[0].series || e[0].observations, c = s.series?.length ? s.series : s.observation, i = [];
3301
- for (const u in o) {
3302
- const d = [], { name: l, parsedTimeSeriesValue: g } = ps(
3303
- u,
3304
- c
3305
- ), M = o[u], x = M.attributes || [];
3306
- if (Object.keys(M).length === 0) {
3307
- i.push({
3308
- name: l,
3309
- parsedTimeSeriesValue: g,
3310
- values: d,
3311
- attributes: [],
3312
- dataSetAttrs: []
3313
- });
3314
- continue;
3481
+ }, za = (t, e, n, r) => {
3482
+ const s = e?.find(
3483
+ (a) => a?.id === t?.id
3484
+ )?.values;
3485
+ return n?.filter((a) => s?.some((o) => o.id === a.id))?.map((a) => ({
3486
+ ...a,
3487
+ name: r ? pe(a, r) : a?.name
3488
+ })) || [];
3489
+ }, Ws = (t, e) => {
3490
+ const n = e?.dataStructureComponents?.attributeList, r = t?.metadataStructureComponents?.metadataAttributeList;
3491
+ return n?.metadataAttributeUsages?.map((s) => {
3492
+ const a = r?.metadataAttributes?.find(
3493
+ (o) => o?.id === s?.metadataAttributeReference
3494
+ );
3495
+ return {
3496
+ ...a,
3497
+ attributeRelationship: s.attributeRelationship,
3498
+ isMandatory: Number(a?.minOccurs) > 0
3499
+ };
3500
+ });
3501
+ }, Ka = (t = [], e, n) => {
3502
+ const r = K(e?.conceptIdentity) || "", s = De(r, t);
3503
+ return n ? pe(s, n) : s?.name ?? s?.id ?? e?.id;
3504
+ };
3505
+ var qs = /* @__PURE__ */ ((t) => (t.CONDITIONAL = "Conditional", t.MANDATORY = "Mandatory", t))(qs || {}), Te = /* @__PURE__ */ ((t) => (t.DIMENSION = "Dimension", t.MEASURE_DIMENSION = "MeasureDimension", t.TIME_DIMENSION = "TimeDimension", t))(Te || {}), Hs = /* @__PURE__ */ ((t) => (t.UNBOUNDED = "unbounded", t))(Hs || {});
3506
+ function je(t) {
3507
+ return t?.dataStructures?.[0]?.dataStructureComponents?.dimensionList;
3508
+ }
3509
+ function Ja(t) {
3510
+ return t?.data?.structures?.[0]?.dimensions?.series || [];
3511
+ }
3512
+ function Za(t) {
3513
+ return t?.data?.structures?.[0]?.dimensions?.observation?.[0].values.map((e) => e.value ? e.value : e.id).filter((e) => e != null) || [];
3514
+ }
3515
+ function eo(t) {
3516
+ return t.find(
3517
+ (e) => e.type === Te.TIME_DIMENSION
3518
+ );
3519
+ }
3520
+ const to = (t) => {
3521
+ const e = /* @__PURE__ */ new Map(), n = t?.dataStructures?.[0], r = t?.metadataStructures?.[0], s = t?.conceptSchemes || [], a = t?.codelists || [];
3522
+ return t && [
3523
+ ...je(t)?.dimensions || [],
3524
+ ...je(t)?.timeDimensions || [],
3525
+ ...Ws(r, n),
3526
+ ...n?.dataStructureComponents?.attributeList?.attributes || []
3527
+ ].forEach(
3528
+ (c) => {
3529
+ const i = De(
3530
+ c?.conceptIdentity,
3531
+ s
3532
+ ), u = c?.localRepresentation?.enumeration || i?.coreRepresentation?.enumeration, d = be(
3533
+ u,
3534
+ a
3535
+ );
3536
+ c?.id && (u ? e.set(c?.id, {
3537
+ ...d,
3538
+ name: i?.name,
3539
+ names: i?.names
3540
+ }) : e.set(c?.id, {
3541
+ id: c?.id,
3542
+ name: i?.name,
3543
+ names: i?.names
3544
+ }));
3545
+ }
3546
+ ), e;
3547
+ }, no = (t) => t?.find(
3548
+ (e) => e.id === ye.SERIES_COUNT
3549
+ )?.title || "", Ee = 1440 * 60 * 1e3, xe = 7 * Ee;
3550
+ function Pe(t) {
3551
+ const e = `${t}-01-01`, n = new Date(e);
3552
+ if (n.getDay() !== 4) {
3553
+ const s = 1 + (4 - n.getDay() + 7) % 7;
3554
+ n.setMonth(0, s);
3555
+ }
3556
+ return n;
3557
+ }
3558
+ function Qs(t) {
3559
+ const e = new Date(t), r = -((e.getDay() + 6) % 7) + 3;
3560
+ return e.setDate(e.getDate() + r), new Date(e.valueOf());
3561
+ }
3562
+ function ze(t, e = "W") {
3563
+ const n = `${t}-12-31`, r = ee(new Date(n), e);
3564
+ if (r.weekYear === t)
3565
+ return r.weekNumber;
3566
+ const s = `${t}-12-24`;
3567
+ return ee(new Date(s), e).weekNumber;
3568
+ }
3569
+ function Et(t, e, n = "W") {
3570
+ return `${t}-${n}${e < 10 ? "0" + e : e}`;
3571
+ }
3572
+ function ee(t, e = "W") {
3573
+ const n = Qs(t), r = n.getFullYear(), s = Pe(r), a = 1 + Math.ceil(
3574
+ (n.getTime() - s.getTime()) / xe
3575
+ );
3576
+ return {
3577
+ code: Et(r, a, e),
3578
+ weekNumber: a,
3579
+ weekYear: r
3580
+ };
3581
+ }
3582
+ function Fs(t) {
3583
+ const [e, n] = t.split("-W"), s = Pe(+e).getTime() + (+n - 1) * xe - 3 * Ee;
3584
+ return new Date(s);
3585
+ }
3586
+ function Us(t) {
3587
+ const [e, n] = t.split("-W"), s = Pe(+e).getTime() + (+n - 1) * xe + 3 * Ee;
3588
+ return new Date(s);
3589
+ }
3590
+ const Bs = "/api/download", ro = (t, e, n, r, s, a, o) => {
3591
+ const c = new URLSearchParams({
3592
+ urn: t,
3593
+ format: e,
3594
+ compress: "false",
3595
+ filename: a,
3596
+ filters: JSON.stringify(s),
3597
+ attribute: r,
3598
+ language: n,
3599
+ isMetadata: o ? "true" : "none"
3600
+ }).toString(), i = `${Bs}?${c}`, u = document.createElement("a");
3601
+ u.href = i, u.download = a, document.body.appendChild(u), u.click(), document.body.removeChild(u);
3602
+ }, so = (t, e) => {
3603
+ const n = [];
3604
+ for (const r of t) {
3605
+ if (r.type !== Te.DIMENSION)
3606
+ continue;
3607
+ const s = e.find((a) => a.componentCode === r.id);
3608
+ s != null && s.values?.length > 0 ? n.push(s.values?.join(qt)) : n.push("*");
3609
+ }
3610
+ return n.join(".");
3611
+ }, Vs = (t, e) => {
3612
+ if (!t || !t.startPeriod && !t.endPeriod)
3613
+ return null;
3614
+ const n = [], { startPeriod: r, endPeriod: s } = t;
3615
+ if (r && n.push(
3616
+ `${I.GREATER_OR_EQUAL}${_e}${Ke(r)}`
3617
+ ), s && n.push(
3618
+ `${I.LESS_OR_EQUAL}${_e}${Ke(s)}`
3619
+ ), n.length === 0)
3620
+ return null;
3621
+ const a = e;
3622
+ return n.map(
3623
+ (o) => `${encodeURIComponent(`c[${a}]`)}${Wt}${encodeURIComponent(o)}`
3624
+ ).join(st);
3625
+ }, Ke = (t) => Vn(t, "yyyy-MM-dd"), ao = (t, e) => {
3626
+ const n = Gs(t, e) || null;
3627
+ return n ? Vs(n, e?.id) : null;
3628
+ }, Gs = (t, e) => {
3629
+ const n = e.id, r = t?.filters?.find(
3630
+ (i) => i.componentCode === n
3631
+ );
3632
+ if (!r || !r.values)
3633
+ return null;
3634
+ const s = r.values?.filter((i) => !!i);
3635
+ if (!s.length)
3636
+ return null;
3637
+ const a = r.operator;
3638
+ if (a === I.LESS_OR_EQUAL || a === I.LESS)
3639
+ return { startPeriod: null, endPeriod: G(s[0]) };
3640
+ if (a === I.GREATER_OR_EQUAL || a === I.GREATER)
3641
+ return { startPeriod: G(s[0]), endPeriod: null };
3642
+ const o = G(s[0]), c = G(s[1]);
3643
+ return { startPeriod: o, endPeriod: c };
3644
+ }, Xs = "Observation", oo = (t) => {
3645
+ const e = t?.data?.dataSets, n = t?.data?.structures?.[0];
3646
+ if (!e || !n)
3647
+ return [];
3648
+ const r = n.attributes, s = n.dimensions, a = r?.dimensionGroup || [], o = e[0].series || e[0].observations, c = s.series?.length ? s.series : s.observation, i = [];
3649
+ for (const u in o) {
3650
+ const d = [], { name: l, parsedTimeSeriesValue: w } = js(
3651
+ u,
3652
+ c
3653
+ ), v = o[u], x = v.attributes || [];
3654
+ if (Object.keys(v).length === 0) {
3655
+ i.push({
3656
+ name: l,
3657
+ parsedTimeSeriesValue: w,
3658
+ values: d,
3659
+ attributes: [],
3660
+ dataSetAttrs: []
3661
+ });
3662
+ continue;
3315
3663
  }
3316
3664
  d.push(
3317
- ...Es(M, n)
3665
+ ...Zs(v, n)
3318
3666
  );
3319
- const N = ie(
3667
+ const N = ce(
3320
3668
  r?.series || [],
3321
- (v) => x[v]
3322
- ), f = xs(
3669
+ (M) => x[M]
3670
+ ), f = ea(
3323
3671
  n.attributes?.dataSet || [],
3324
- e[0].attributes?.filter((v) => v != null) || []
3325
- ), w = ws(
3672
+ e[0].attributes?.filter((M) => M != null) || []
3673
+ ), g = Ls(
3326
3674
  t,
3327
- g
3328
- ), P = a.map((v, W) => {
3329
- const $ = w[v.id], U = gs(
3330
- v,
3331
- $.values[W]
3675
+ w
3676
+ ), P = a.map((M, W) => {
3677
+ const q = g[M.id], U = $s(
3678
+ M,
3679
+ q.values[W]
3332
3680
  );
3333
3681
  return {
3334
- attribute: v,
3682
+ attribute: M,
3335
3683
  dimensionGroupValue: U,
3336
- dimensionGroupData: $
3684
+ dimensionGroupData: q
3337
3685
  };
3338
3686
  });
3339
3687
  i.push({
3340
3688
  name: l,
3341
- parsedTimeSeriesValue: g,
3689
+ parsedTimeSeriesValue: w,
3342
3690
  values: d,
3343
3691
  attributes: N,
3344
3692
  dataSetAttrs: f,
@@ -3346,7 +3694,7 @@ const ws = (t, e) => {
3346
3694
  });
3347
3695
  }
3348
3696
  return i;
3349
- }, ps = (t, e) => {
3697
+ }, js = (t, e) => {
3350
3698
  const n = t.split(new RegExp("(?<!\\|):(?!\\||$)")), r = [];
3351
3699
  for (let s = 0; s < n.length; s++) {
3352
3700
  const a = e?.[s], o = Number(n[s]);
@@ -3360,33 +3708,33 @@ const ws = (t, e) => {
3360
3708
  r.push(c?.id || c?.value || "");
3361
3709
  }
3362
3710
  return {
3363
- name: Ds(r),
3711
+ name: Ks(r),
3364
3712
  parsedTimeSeriesValue: r
3365
3713
  };
3366
- }, ie = (t, e) => {
3714
+ }, ce = (t, e) => {
3367
3715
  const n = [];
3368
3716
  for (let r = 0; r < t.length; r++) {
3369
- const s = t[r], a = e(r), o = a != null && s.values != null ? bs(a, s) : void 0;
3717
+ const s = t[r], a = e(r), o = a != null && s.values != null ? zs(a, s) : void 0;
3370
3718
  n.push({
3371
3719
  name: s.id,
3372
3720
  value: o
3373
3721
  });
3374
3722
  }
3375
3723
  return n;
3376
- }, bs = (t, e) => {
3724
+ }, zs = (t, e) => {
3377
3725
  const n = e.values[t];
3378
3726
  return n == null ? typeof t == "object" ? t : t.toString() : n?.id || n?.value || n?.ids || n?.values;
3379
- }, Ds = (t) => t.map((e) => e ? Ts(e) : "").join("."), Ts = (t) => t.replace(/\./g, "|.").replace(/:/g, "|:"), Es = (t, e) => {
3727
+ }, Ks = (t) => t.map((e) => e ? Js(e) : "").join("."), Js = (t) => t.replace(/\./g, "|.").replace(/:/g, "|:"), Zs = (t, e) => {
3380
3728
  const n = e.measures?.observation?.length;
3381
3729
  if (t.observations == null)
3382
3730
  return [
3383
3731
  {
3384
- values: Qe(t, e.measures),
3385
- obsAttributes: ie(
3732
+ values: Je(t, e.measures),
3733
+ obsAttributes: ce(
3386
3734
  e.attributes?.observation || [],
3387
3735
  (o) => t[o + n]
3388
3736
  ),
3389
- dimensionAtObservation: ys
3737
+ dimensionAtObservation: Xs
3390
3738
  }
3391
3739
  ];
3392
3740
  const r = t.observations, s = e.dimensions.observation?.[0], a = [];
@@ -3394,87 +3742,47 @@ const ws = (t, e) => {
3394
3742
  const c = s?.values[o];
3395
3743
  a.push({
3396
3744
  dimensionAtObservation: c?.value || c?.id,
3397
- values: Qe(
3745
+ values: Je(
3398
3746
  r[o],
3399
3747
  e.measures
3400
3748
  ),
3401
- obsAttributes: ie(
3749
+ obsAttributes: ce(
3402
3750
  e.attributes?.observation || [],
3403
3751
  (i) => r[o][i + n]
3404
3752
  )
3405
3753
  });
3406
3754
  }
3407
3755
  return a;
3408
- }, Qe = (t, e) => e?.observation?.map((n, r) => ({ name: n.id, value: t[r] })) || [], xs = (t, e) => t.reduce(
3756
+ }, Je = (t, e) => e?.observation?.map((n, r) => ({ name: n.id, value: t[r] })) || [], ea = (t, e) => t.reduce(
3409
3757
  (n, r, s) => {
3410
3758
  const a = e[s];
3411
- return Ps(n, r, a, ""), n;
3759
+ return ta(n, r, a, ""), n;
3412
3760
  },
3413
3761
  []
3414
- ), Ps = (t, e, n, r) => {
3762
+ ), ta = (t, e, n, r) => {
3415
3763
  const s = n != null ? e?.values?.length > 0 ? e.values[n]?.id || e.values[n]?.value : String(n) : r;
3416
3764
  t.push({
3417
3765
  name: e.id,
3418
3766
  value: s || ""
3419
3767
  });
3420
- }, Ms = /^[0-9][0-9][0-9][0-9]-Q[1-4]$/, vs = /^[0-9][0-9][0-9][0-9]-W(0[1-9]|[1-4][0-9]|5[0-3])$/, Os = /^[0-9][0-9][0-9][0-9]-S[1-2]$/, As = /^[0-9][0-9][0-9][0-9]$/, Ns = /^[0-9][0-9][0-9][0-9]-(0[1-9]|1[0-2])-[0-9][0-9]$/, ks = /^[0-9][0-9][0-9][0-9]-M(0[1-9]|(1[0-2]))$/, ge = (t) => As.exec(t), ye = (t) => !!ge(t), Rs = (t) => Os.exec(t), pe = (t) => !!Rs(t), be = (t) => ks.exec(t), De = (t) => !!be(t), Te = (t) => Ms.exec(t), Ee = (t) => !!Te(t), _s = (t) => Ns.exec(t), Is = (t) => !!_s(t), Ys = (t) => vs.exec(t), xe = (t) => !!Ys(t), Pe = 1440 * 60 * 1e3, Me = 7 * Pe;
3421
- function ve(t) {
3422
- const e = `${t}-01-01`, n = new Date(e);
3423
- if (n.getDay() !== 4) {
3424
- const s = 1 + (4 - n.getDay() + 7) % 7;
3425
- n.setMonth(0, s);
3426
- }
3427
- return n;
3428
- }
3429
- function Cs(t) {
3430
- const e = new Date(t), r = -((e.getDay() + 6) % 7) + 3;
3431
- return e.setDate(e.getDate() + r), new Date(e.valueOf());
3432
- }
3433
- function Fe(t, e = "W") {
3434
- const n = `${t}-12-31`, r = ee(new Date(n), e);
3435
- if (r.weekYear === t)
3436
- return r.weekNumber;
3437
- const s = `${t}-12-24`;
3438
- return ee(new Date(s), e).weekNumber;
3439
- }
3440
- function yt(t, e, n = "W") {
3441
- return `${t}-${n}${e < 10 ? "0" + e : e}`;
3442
- }
3443
- function ee(t, e = "W") {
3444
- const n = Cs(t), r = n.getFullYear(), s = ve(r), a = 1 + Math.ceil(
3445
- (n.getTime() - s.getTime()) / Me
3446
- );
3447
- return {
3448
- code: yt(r, a, e),
3449
- weekNumber: a,
3450
- weekYear: r
3451
- };
3768
+ }, na = /^[0-9][0-9][0-9][0-9]-Q[1-4]$/, ra = /^[0-9][0-9][0-9][0-9]-W(0[1-9]|[1-4][0-9]|5[0-3])$/, sa = /^[0-9][0-9][0-9][0-9]-S[1-2]$/, aa = /^[0-9][0-9][0-9][0-9]$/, oa = /^[0-9][0-9][0-9][0-9]-(0[1-9]|1[0-2])-[0-9][0-9]$/, ia = /^[0-9][0-9][0-9][0-9]-M(0[1-9]|(1[0-2]))$/, ve = (t) => aa.exec(t), Me = (t) => !!ve(t), ca = (t) => sa.exec(t), Oe = (t) => !!ca(t), Ae = (t) => ia.exec(t), Ne = (t) => !!Ae(t), ke = (t) => na.exec(t), Ie = (t) => !!ke(t), ua = (t) => oa.exec(t), da = (t) => !!ua(t), la = (t) => ra.exec(t), Re = (t) => !!la(t);
3769
+ function xt(t) {
3770
+ return Me(t) ? fa(t) : Oe(t) ? ha(t) : Ie(t) ? wa(t) : Ne(t) ? pa(t) : Re(t) ? Fs(t) : Da(t);
3452
3771
  }
3453
- function Ls(t) {
3454
- const [e, n] = t.split("-W"), s = ve(+e).getTime() + (+n - 1) * Me - 3 * Pe;
3455
- return new Date(s);
3772
+ function Pt(t) {
3773
+ return Me(t) ? ma(t) : Oe(t) ? ga(t) : Ie(t) ? ya(t) : Ne(t) ? ba(t) : Re(t) ? Us(t) : Ta(t);
3456
3774
  }
3457
- function Ss(t) {
3458
- const [e, n] = t.split("-W"), s = ve(+e).getTime() + (+n - 1) * Me + 3 * Pe;
3459
- return new Date(s);
3460
- }
3461
- function pt(t) {
3462
- return ye(t) ? Ws(t) : pe(t) ? qs(t) : Ee(t) ? Fs(t) : De(t) ? Us(t) : xe(t) ? Ls(t) : Gs(t);
3463
- }
3464
- function bt(t) {
3465
- return ye(t) ? $s(t) : pe(t) ? Qs(t) : Ee(t) ? Hs(t) : De(t) ? Bs(t) : xe(t) ? Ss(t) : Vs(t);
3466
- }
3467
- function Ws(t) {
3468
- const e = ge(t);
3775
+ function fa(t) {
3776
+ const e = ve(t);
3469
3777
  if (e)
3470
3778
  return new Date(Number(e[0]), 0, 1);
3471
3779
  }
3472
- function $s(t) {
3473
- const e = ge(t);
3780
+ function ma(t) {
3781
+ const e = ve(t);
3474
3782
  if (e)
3475
3783
  return new Date(Number(e[0]) + 1, 0, 1);
3476
3784
  }
3477
- function qs(t) {
3785
+ function ha(t) {
3478
3786
  const [e, n] = t.split("-S");
3479
3787
  switch (+n) {
3480
3788
  case 1:
@@ -3483,7 +3791,7 @@ function qs(t) {
3483
3791
  return new Date(+e, 6, 1);
3484
3792
  }
3485
3793
  }
3486
- function Qs(t) {
3794
+ function ga(t) {
3487
3795
  const [e, n] = t.split("-S");
3488
3796
  switch (+n) {
3489
3797
  case 1:
@@ -3492,8 +3800,8 @@ function Qs(t) {
3492
3800
  return new Date(+e + 1, 0, 1);
3493
3801
  }
3494
3802
  }
3495
- function Fs(t) {
3496
- const e = Te(t);
3803
+ function wa(t) {
3804
+ const e = ke(t);
3497
3805
  if (!e)
3498
3806
  return;
3499
3807
  const [n, r] = e[0].split("-Q");
@@ -3508,8 +3816,8 @@ function Fs(t) {
3508
3816
  return new Date(+n, 9, 1);
3509
3817
  }
3510
3818
  }
3511
- function Hs(t) {
3512
- const e = Te(t);
3819
+ function ya(t) {
3820
+ const e = ke(t);
3513
3821
  if (!e)
3514
3822
  return;
3515
3823
  const [n, r] = e[0].split("-Q");
@@ -3524,45 +3832,45 @@ function Hs(t) {
3524
3832
  return new Date(+n + 1, 0, 1);
3525
3833
  }
3526
3834
  }
3527
- function Us(t) {
3528
- const e = be(t);
3835
+ function pa(t) {
3836
+ const e = Ae(t);
3529
3837
  if (!e)
3530
3838
  return;
3531
3839
  const [n, r] = e[0].split("-M");
3532
3840
  return new Date(+n, +r - 1, 1);
3533
3841
  }
3534
- function Bs(t) {
3535
- const e = be(t);
3842
+ function ba(t) {
3843
+ const e = Ae(t);
3536
3844
  if (!e)
3537
3845
  return;
3538
3846
  const [n, r] = e[0].split("-M");
3539
3847
  return new Date(+n, +r, 1);
3540
3848
  }
3541
- const Gs = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Vs = (t) => {
3849
+ const Da = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Ta = (t) => {
3542
3850
  const e = /* @__PURE__ */ new Date(`${t}T23:59:00`);
3543
3851
  return e.setMinutes(e.getMinutes() + 1), e;
3544
- }, Xs = 1, js = (t, e, n, r = !0, s = "Q") => {
3545
- const a = [], o = e && e > 3 ? na(e, r) : 1, c = n ? Math.floor((n - 1) / 3) : 4;
3852
+ }, Ea = 1, xa = (t, e, n, r = !0, s = "Q") => {
3853
+ const a = [], o = e && e > 3 ? ka(e, r) : 1, c = n ? Math.floor((n - 1) / 3) : 4;
3546
3854
  for (let i = o; i <= c; i++)
3547
3855
  a.push(`${t}-${s}${i}`);
3548
3856
  return a;
3549
- }, zs = (t, e, n, r = "S") => {
3857
+ }, Pa = (t, e, n, r = "S") => {
3550
3858
  const s = [];
3551
3859
  return (e || 1) < 7 && (n || 12) > 6 && s.push(`${t}-${r}1`), n == null && s.push(`${t}-${r}2`), s;
3552
- }, Ha = (t) => Math.ceil(t / 3), Dt = (t, e, n = "M") => `${t}-${n}${e.toString().padStart(2, "0")}`, Ks = (t, e, n = "M") => {
3860
+ }, io = (t) => Math.ceil(t / 3), vt = (t, e, n = "M") => `${t}-${n}${e.toString().padStart(2, "0")}`, va = (t, e, n = "M") => {
3553
3861
  const r = [];
3554
3862
  for (let s = e; s <= 12; s++)
3555
- r.push(Dt(t, s, n));
3863
+ r.push(vt(t, s, n));
3556
3864
  return r;
3557
- }, Js = (t, e, n, r = "M") => {
3865
+ }, Ma = (t, e, n, r = "M") => {
3558
3866
  const s = [];
3559
3867
  for (let a = e; a < n; a++)
3560
- s.push(Dt(t, a, r));
3868
+ s.push(vt(t, a, r));
3561
3869
  return s;
3562
- }, Zs = (t, e, n, r = "M") => {
3870
+ }, Oa = (t, e, n, r = "M") => {
3563
3871
  const s = e || 1, a = n == null, o = n || 12;
3564
- return a ? Ks(t, s, r) : Js(t, s, o, r);
3565
- }, Ua = (t, e, n = "M") => {
3872
+ return a ? va(t, s, r) : Ma(t, s, o, r);
3873
+ }, co = (t, e, n = "M") => {
3566
3874
  switch (e) {
3567
3875
  case 0:
3568
3876
  return [
@@ -3591,349 +3899,42 @@ const Gs = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Vs = (t) => {
3591
3899
  default:
3592
3900
  return [];
3593
3901
  }
3594
- }, ea = (t, e) => {
3595
- const n = R(e, !0), r = R(t), s = n.getFullYear(), a = r.getFullYear(), o = n.getTime() <= r.getTime() ? a + Xs - s : 0;
3902
+ }, Aa = (t, e) => {
3903
+ const n = R(e, !0), r = R(t), s = n.getFullYear(), a = r.getFullYear(), o = n.getTime() <= r.getTime() ? a + Ea - s : 0;
3596
3904
  return Array.from({ length: o }, (i, u) => s + u);
3597
3905
  }, R = (t, e = !1) => {
3598
- const n = ta(t, e);
3906
+ const n = Na(t, e);
3599
3907
  return n ? (n.getTimezoneOffset() > 0 && n.setMinutes(n.getMinutes() + n.getTimezoneOffset()), n) : /* @__PURE__ */ new Date();
3600
- }, ta = (t, e = !1) => {
3908
+ }, Na = (t, e = !1) => {
3601
3909
  const n = Number(t);
3602
- return t.toString().length !== 13 ? e ? pt(t) : bt(t) : isNaN(n) ? /* @__PURE__ */ new Date(`${t}T00:00:00.000Z`) : new Date(n);
3603
- }, na = (t, e) => e ? Math.floor((t + 1) / 3) : Math.ceil((t + 1) / 3), Ba = (t, e) => {
3604
- const n = Ue(t) - Ue(e);
3910
+ return t.toString().length !== 13 ? e ? xt(t) : Pt(t) : isNaN(n) ? /* @__PURE__ */ new Date(`${t}T00:00:00.000Z`) : new Date(n);
3911
+ }, ka = (t, e) => e ? Math.floor((t + 1) / 3) : Math.ceil((t + 1) / 3), uo = (t, e) => {
3912
+ const n = et(t) - et(e);
3605
3913
  if (n === 0 && t !== e) {
3606
- const r = He(t), s = He(e);
3914
+ const r = Ze(t), s = Ze(e);
3607
3915
  return r - s;
3608
3916
  }
3609
3917
  return n;
3610
- }, He = (t) => ye(t) ? 6 : pe(t) ? 5 : Ee(t) ? 4 : De(t) ? 3 : xe(t) ? 2 : Is(t) ? 1 : 0, Ue = (t, e = !1) => (e ? pt(t) : bt(t))?.getTime() || 0;
3611
- var Oe = /* @__PURE__ */ ((t) => (t.LAST_UPDATE_AT = "lastUpdatedAt", t.SERIES_COUNT = "series_count", t))(Oe || {}), ra = /* @__PURE__ */ ((t) => (t.C = "c", t))(ra || {}), _ = /* @__PURE__ */ ((t) => (t.EQUALS = "eq", t.NOT_EQUALS = "ne", t.LESS = "lt", t.LESS_OR_EQUAL = "le", t.GREATER = "gt", t.GREATER_OR_EQUAL = "ge", t.CONTAINS = "co", t.NOT_CONTAINS = "nc", t.STARTS = "sw", t.ENDS = "ew", t))(_ || {}), sa = /* @__PURE__ */ ((t) => (t.BOOLEAN = "Boolean", t.DATE_TIME = "DateTime", t.DECIMAL = "Decimal", t.INTEGER = "Integer", t.OBSERVATION_TIME_PERIOD = "ObservationalTimePeriod", t.STRING = "String", t.TIME = "Time", t.TIME_RANGE = "TimeRange", t.URI = "URI", t))(sa || {}), aa = /* @__PURE__ */ ((t) => (t.ANNUAL = "A", t.QUARTERLY = "Q", t.MONTHLY = "M", t))(aa || {});
3612
- function Ga(t) {
3613
- return t?.annotations?.find((e) => {
3614
- if (e.id === Oe.LAST_UPDATE_AT)
3615
- return e;
3616
- })?.value;
3617
- }
3618
- const Ae = (t, e) => t?.names && t?.names[e] || t?.name, Tt = (t, e, n) => {
3619
- if (!(!t || e?.has(t?.id)) && (e?.set(t?.id, t), t?.parent)) {
3620
- const r = n?.get(t?.parent);
3621
- Tt(r, e, n);
3622
- }
3623
- }, oa = (t, e) => {
3624
- const n = /* @__PURE__ */ new Map(), r = new Map(t?.map((s) => [s.id, s]));
3625
- return e?.forEach((s) => {
3626
- Tt(s, n, r);
3627
- }), Array.from(n?.values());
3628
- }, Va = (t) => {
3629
- const e = t?.find(
3630
- (a) => a.id === ls
3631
- ), n = t?.find(
3632
- (a) => a.id === fs
3633
- ), r = n?.title ? new Date(n?.title) : null;
3634
- return {
3635
- startPeriod: e?.title ? new Date(e?.title) : null,
3636
- endPeriod: r
3637
- };
3638
- }, ia = (t, e) => t.id.localeCompare(e.id), ca = (t, e) => t.memberValue.localeCompare(e.memberValue), ua = (t, e) => {
3639
- const n = new Array(t.length), r = t.map((o, c) => [o, c]);
3640
- r.sort(
3641
- (o, c) => ia(o[0], c[0])
3642
- );
3643
- const s = [...e];
3644
- s.sort(ca);
3645
- let a = 0;
3646
- for (const o of r) {
3647
- const c = o[0];
3648
- for (; a < s.length && s[a].memberValue.localeCompare(c.id) < 0; )
3649
- a += 1;
3650
- a < s.length && s[a].memberValue === c.id && (n[o[1]] = o[0]);
3651
- }
3652
- return n.filter((o) => o != null);
3653
- }, da = (t) => !!t?.some((e) => e.parent), Xa = (t, e, n, r, s = []) => {
3654
- let a = t || [];
3655
- if (la(n || [], e || "")) {
3656
- const o = (n || [])[0].cubeRegions?.find(
3657
- ({ isIncluded: c }) => c
3658
- );
3659
- if (o) {
3660
- const c = o.memberSelection?.find(
3661
- ({ componentId: i }) => i === e
3662
- );
3663
- c ? a = a.length === 0 ? (c.selectionValues || []).map(({ memberValue: i }) => ({
3664
- id: i,
3665
- name: i
3666
- })) : ua(a, c.selectionValues) : a = [];
3667
- }
3668
- } else s.length !== 0 && (a = a.filter(({ id: o }) => s.includes(o)));
3669
- return da(t) && (a = oa(t, a)), a?.map((o) => ({
3670
- ...o,
3671
- name: r ? Ae(o, r) : o?.name
3672
- }));
3673
- }, la = (t, e) => t != null && t.length > 0 && e != null, fa = (t) => {
3674
- const e = [];
3675
- return t?.filters?.forEach((n) => {
3676
- n.componentCode !== ds && e.push({
3677
- componentCode: n.componentCode,
3678
- operator: _.EQUALS,
3679
- value: n.values.join(",")
3680
- });
3681
- }), e;
3682
- }, ja = (t) => {
3683
- const e = /* @__PURE__ */ new Map();
3684
- return t?.forEach((n) => {
3685
- e.set(n.urn, fa(n));
3686
- }), e;
3687
- }, ma = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Be = (t) => {
3688
- if (typeof t != "string")
3689
- throw new TypeError("Invalid argument expected string");
3690
- const e = t.match(ma);
3691
- if (!e)
3692
- throw new Error(`Invalid argument not valid semver ('${t}' received)`);
3693
- return e.shift(), e;
3694
- }, Ge = (t) => t === "*" || t === "x" || t === "X", Ve = (t) => {
3695
- const e = parseInt(t, 10);
3696
- return isNaN(e) ? t : e;
3697
- }, ha = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], wa = (t, e) => {
3698
- if (Ge(t) || Ge(e))
3699
- return 0;
3700
- const [n, r] = ha(Ve(t), Ve(e));
3701
- return n > r ? 1 : n < r ? -1 : 0;
3702
- }, Xe = (t, e) => {
3703
- for (let n = 0; n < Math.max(t.length, e.length); n++) {
3704
- const r = wa(t[n] || "0", e[n] || "0");
3705
- if (r !== 0)
3706
- return r;
3707
- }
3708
- return 0;
3709
- }, ga = (t, e) => {
3710
- const n = Be(t), r = Be(e), s = n.pop(), a = r.pop(), o = Xe(n, r);
3711
- return o !== 0 ? o : s && a ? Xe(s.split("."), a.split(".")) : s || a ? s ? -1 : 1 : 0;
3712
- }, ya = (t, e, n) => {
3713
- pa(n);
3714
- const r = ga(t, e);
3715
- return Et[n].includes(r);
3716
- }, Et = {
3717
- ">": [1],
3718
- ">=": [0, 1],
3719
- "=": [0],
3720
- "<=": [-1, 0],
3721
- "<": [-1],
3722
- "!=": [-1, 1]
3723
- }, je = Object.keys(Et), pa = (t) => {
3724
- if (je.indexOf(t) === -1)
3725
- throw new Error(`Invalid operator, expected one of ${je.join("|")}`);
3726
- }, ce = "+", Ne = (t, e) => {
3727
- const { agency: n, id: r, version: s } = H(t), a = e.filter(
3728
- (i) => i.agencyID === n && i.id === r && !i?.version?.includes(ce)
3729
- );
3730
- if (a.length === 1)
3731
- return a[0];
3732
- if (!s?.includes(ce))
3733
- return a.find((i) => i.version === s);
3734
- const o = a.map(
3735
- (i) => i.version
3736
- ), c = ba(s, o);
3737
- return a.find(
3738
- (i) => i.version === c[0]
3739
- );
3740
- }, ba = (t, e) => {
3741
- const n = Da(t, e);
3742
- return n.length > 0 ? [n[0]] : [];
3743
- }, Da = (t, e) => {
3744
- const n = [];
3745
- return e.forEach((r) => {
3746
- Ea(t, r) && n.push(r);
3747
- }), n;
3748
- }, Ta = (t) => {
3749
- const e = t.trim(), n = e.indexOf("+");
3750
- if (n <= 0) return "";
3751
- let r = n;
3752
- for (; r > 0 && e[r - 1] >= "0" && e[r - 1] <= "9"; )
3753
- r--;
3754
- return r > 0 ? e.slice(0, r) : "";
3755
- }, Ea = (t, e) => {
3756
- const n = t.trim().replace(/\+/, ""), r = Ta(t);
3757
- return e.startsWith(r) && ya(e, n, ">=");
3758
- }, ke = (t, e) => {
3759
- const { concept: n } = xa(t, e);
3760
- return n;
3761
- }, xa = (t, e) => {
3762
- if (t == null)
3763
- return {
3764
- concept: void 0,
3765
- scheme: void 0
3766
- };
3767
- const { childId: n, agency: r, id: s, version: a } = Pt(t);
3768
- if (a?.includes(ce)) {
3769
- const o = Ne(
3770
- t,
3771
- e
3772
- );
3773
- return {
3774
- concept: ze(o?.concepts || [], n),
3775
- scheme: o
3776
- };
3777
- }
3778
- for (const o of e)
3779
- if (Pa(o, s, r, a))
3780
- return {
3781
- concept: ze(o?.concepts || [], n),
3782
- scheme: o
3783
- };
3784
- return {
3785
- concept: void 0,
3786
- scheme: void 0
3787
- };
3788
- }, ze = (t, e) => t?.find((n) => n.id === e), Pa = (t, e, n, r) => t.id === e && t.agencyID === n && t.version === r, za = (t = [], e = [], n) => {
3789
- const r = n?.conceptIdentity || "", s = ke(r, e), a = K(
3790
- n?.localRepresentation?.enumeration
3791
- ), o = K(
3792
- s?.coreRepresentation?.enumeration
3793
- ), c = a || o;
3794
- if (c != null)
3795
- return Ne(c, t);
3796
- }, Ka = (t, e, n, r) => {
3797
- const s = e?.find(
3798
- (a) => a?.id === t?.id
3799
- )?.values;
3800
- return n?.filter((a) => s?.some((o) => o.id === a.id))?.map((a) => ({
3801
- ...a,
3802
- name: r ? Ae(a, r) : a?.name
3803
- })) || [];
3804
- }, Ma = (t, e) => {
3805
- const n = e?.dataStructureComponents?.attributeList, r = t?.metadataStructureComponents?.metadataAttributeList;
3806
- return n?.metadataAttributeUsages?.map((s) => {
3807
- const a = r?.metadataAttributes?.find(
3808
- (o) => o?.id === s?.metadataAttributeReference
3809
- );
3810
- return {
3811
- ...a,
3812
- attributeRelationship: s.attributeRelationship,
3813
- isMandatory: Number(a?.minOccurs) > 0
3814
- };
3815
- });
3816
- }, Ja = (t = [], e, n) => {
3817
- const r = K(e?.conceptIdentity) || "", s = ke(r, t);
3818
- return n ? Ae(s, n) : s?.name ?? s?.id ?? e?.id;
3819
- };
3820
- function Ke(t) {
3821
- return t?.dataStructures?.[0]?.dataStructureComponents?.dimensionList;
3822
- }
3823
- function Za(t) {
3824
- return t?.data?.structures?.[0]?.dimensions?.series || [];
3825
- }
3826
- function eo(t) {
3827
- return t?.data?.structures?.[0]?.dimensions?.observation?.[0].values.map((e) => e.value ? e.value : e.id).filter((e) => e != null) || [];
3828
- }
3829
- function to(t) {
3830
- return t.find(
3831
- (e) => e.type === we.TIME_DIMENSION
3832
- );
3833
- }
3834
- const no = (t) => {
3835
- const e = /* @__PURE__ */ new Map(), n = t?.dataStructures?.[0], r = t?.metadataStructures?.[0], s = t?.conceptSchemes || [], a = t?.codelists || [];
3836
- return t && [
3837
- ...Ke(t)?.dimensions || [],
3838
- ...Ke(t)?.timeDimensions || [],
3839
- ...Ma(r, n),
3840
- ...n?.dataStructureComponents?.attributeList?.attributes || []
3841
- ].forEach(
3842
- (c) => {
3843
- const i = ke(
3844
- c?.conceptIdentity,
3845
- s
3846
- ), u = c?.localRepresentation?.enumeration || i?.coreRepresentation?.enumeration, d = Ne(
3847
- u,
3848
- a
3849
- );
3850
- c?.id && (u ? e.set(c?.id, {
3851
- ...d,
3852
- name: i?.name,
3853
- names: i?.names
3854
- }) : e.set(c?.id, {
3855
- id: c?.id,
3856
- name: i?.name,
3857
- names: i?.names
3858
- }));
3859
- }
3860
- ), e;
3861
- }, ro = (t) => t?.find(
3862
- (e) => e.id === Oe.SERIES_COUNT
3863
- )?.title || "", va = "/api/download", so = (t, e, n, r, s, a, o) => {
3864
- const c = new URLSearchParams({
3865
- urn: t,
3866
- format: e,
3867
- compress: "false",
3868
- filename: a,
3869
- filters: JSON.stringify(s),
3870
- attribute: r,
3871
- language: n,
3872
- isMetadata: o ? "true" : "none"
3873
- }).toString(), i = `${va}?${c}`, u = document.createElement("a");
3874
- u.href = i, u.download = a, document.body.appendChild(u), u.click(), document.body.removeChild(u);
3875
- }, ao = (t, e) => {
3876
- const n = [];
3877
- for (const r of t) {
3878
- if (r.type !== we.DIMENSION)
3879
- continue;
3880
- const s = e.find((a) => a.componentCode === r.id);
3881
- s != null && s.values?.length > 0 ? n.push(s.values?.join(Wt)) : n.push("*");
3882
- }
3883
- return n.join(".");
3884
- }, Oa = (t, e) => {
3885
- if (!t || !t.startPeriod && !t.endPeriod)
3886
- return null;
3887
- const n = [], { startPeriod: r, endPeriod: s } = t;
3888
- if (r && n.push(
3889
- `${_.GREATER_OR_EQUAL}${Re}${Je(r)}`
3890
- ), s && n.push(
3891
- `${_.LESS_OR_EQUAL}${Re}${Je(s)}`
3892
- ), n.length === 0)
3893
- return null;
3894
- const a = e;
3895
- return n.map(
3896
- (o) => `${encodeURIComponent(`c[${a}]`)}${St}${encodeURIComponent(o)}`
3897
- ).join(tt);
3898
- }, Je = (t) => Un(t, "yyyy-MM-dd"), oo = (t, e) => {
3899
- const n = Aa(t, e) || null;
3900
- return n ? Oa(n, e?.id) : null;
3901
- }, Aa = (t, e) => {
3902
- const n = e.id, r = t?.filters?.find(
3903
- (i) => i.componentCode === n
3904
- );
3905
- if (!r || !r.values)
3906
- return null;
3907
- const s = r.values?.filter((i) => !!i);
3908
- if (!s.length)
3909
- return null;
3910
- const a = r.operator;
3911
- if (a === _.LESS_OR_EQUAL || a === _.LESS)
3912
- return { startPeriod: null, endPeriod: V(s[0]) };
3913
- if (a === _.GREATER_OR_EQUAL || a === _.GREATER)
3914
- return { startPeriod: V(s[0]), endPeriod: null };
3915
- const o = V(s[0]), c = V(s[1]);
3916
- return { startPeriod: o, endPeriod: c };
3917
- }, xt = (t, e, n) => {
3918
+ }, Ze = (t) => Me(t) ? 6 : Oe(t) ? 5 : Ie(t) ? 4 : Ne(t) ? 3 : Re(t) ? 2 : da(t) ? 1 : 0, et = (t, e = !1) => (e ? xt(t) : Pt(t))?.getTime() || 0, Mt = (t, e, n) => {
3918
3919
  const r = R(e, !0), s = R(n), a = R(t, !0), o = R(t), c = r.getTime() > a.getTime() ? r : a, i = s.getTime() < o.getTime() ? s : o;
3919
3920
  return {
3920
3921
  start: c,
3921
3922
  end: i
3922
3923
  };
3923
- }, Na = (t, e, n, r = "W") => {
3924
- const s = +t, { start: a, end: o } = xt(t, e, n);
3924
+ }, Ia = (t, e, n, r = "W") => {
3925
+ const s = +t, { start: a, end: o } = Mt(t, e, n);
3925
3926
  if (a.getTime() > o.getTime())
3926
3927
  return [];
3927
- const c = ee(a, r), i = c.weekYear === s ? c.weekNumber : c.weekYear < s ? 1 : Fe(s, r), u = ee(o, r), d = u.weekYear === s ? u.weekNumber : u.weekYear > s ? Fe(s, r) : 1, l = [];
3928
+ const c = ee(a, r), i = c.weekYear === s ? c.weekNumber : c.weekYear < s ? 1 : ze(s, r), u = ee(o, r), d = u.weekYear === s ? u.weekNumber : u.weekYear > s ? ze(s, r) : 1, l = [];
3928
3929
  if (i < d)
3929
- for (let g = i; g <= d; g++)
3930
- l.push(yt(s, g, r));
3930
+ for (let w = i; w <= d; w++)
3931
+ l.push(Et(s, w, r));
3931
3932
  return l;
3932
- }, ka = (t) => {
3933
+ }, Ra = (t) => {
3933
3934
  const e = new Date(t);
3934
3935
  return e.setMinutes(e.getMinutes() - e.getTimezoneOffset()), e.toISOString().slice(0, 10);
3935
- }, Ra = (t, e, n) => {
3936
- const { start: r, end: s } = xt(t, e, n);
3936
+ }, _a = (t, e, n) => {
3937
+ const { start: r, end: s } = Mt(t, e, n);
3937
3938
  if (r.getTime() > s.getTime())
3938
3939
  return [];
3939
3940
  const a = [], o = new Date(
@@ -3942,11 +3943,11 @@ const no = (t) => {
3942
3943
  r.getDate()
3943
3944
  ), c = new Date(s.getFullYear(), s.getMonth(), s.getDate());
3944
3945
  for (; o.getTime() < c.getTime(); ) {
3945
- const i = ka(o);
3946
+ const i = Ra(o);
3946
3947
  a.push(i), o.setDate(o.getDate() + 1);
3947
3948
  }
3948
3949
  return a;
3949
- }, _a = (t) => ({
3950
+ }, Ya = (t) => ({
3950
3951
  isDailyExist: !!t?.some(({ memberValue: e }) => e === "D"),
3951
3952
  isWeeklyExist: !!t?.some(({ memberValue: e }) => e === "W"),
3952
3953
  isMonthlyExist: !!t?.some(({ memberValue: e }) => e === "M"),
@@ -3955,158 +3956,265 @@ const no = (t) => {
3955
3956
  isYearlyExist: !!t?.some(
3956
3957
  ({ memberValue: e }) => e === "A" || e === "Y"
3957
3958
  )
3958
- }), Ia = (t, e, n, r) => {
3959
+ }), Ca = (t, e, n, r) => {
3959
3960
  const s = r === 0 ? R(e.toString(), !0)?.getMonth() + 1 : void 0, a = r === t.length - 1 ? R(n.toString())?.getMonth() + 1 || 1 : void 0;
3960
3961
  return { startMonth: s, endMonth: a };
3961
- }, Ya = ["FREQUENCY", "FREQ"], io = (t, e) => {
3962
+ }, Sa = ["FREQUENCY", "FREQ"], lo = (t, e) => {
3962
3963
  const n = t?.[0]?.cubeRegions?.[0]?.memberSelection?.find(
3963
- (i) => Ya.includes(i.componentId)
3964
- )?.selectionValues, r = _a(n || []), s = e?.startPeriod?.getTime() || 1, a = e?.endPeriod?.getTime() || 1, o = ea(a, s), c = [];
3964
+ (i) => Sa.includes(i.componentId)
3965
+ )?.selectionValues, r = Ya(n || []), s = e?.startPeriod?.getTime() || 1, a = e?.endPeriod?.getTime() || 1, o = Aa(a, s), c = [];
3965
3966
  return o.forEach((i, u) => {
3966
- const d = [], { startMonth: l, endMonth: g } = Ia(
3967
+ const d = [], { startMonth: l, endMonth: w } = Ca(
3967
3968
  o,
3968
3969
  new Date(s),
3969
3970
  new Date(a),
3970
3971
  u
3971
3972
  ), {
3972
- isDailyExist: M,
3973
+ isDailyExist: v,
3973
3974
  isWeeklyExist: x,
3974
3975
  isMonthlyExist: N,
3975
3976
  isQuarterlyExist: f,
3976
- isSemiAnnualExist: w,
3977
+ isSemiAnnualExist: g,
3977
3978
  isYearlyExist: P
3978
3979
  } = r;
3979
- P && d.push(i.toString()), w && d.push(...zs(i, l, g)), f && d.push(
3980
- ...js(i, l, g, !1)
3981
- ), N && d.push(...Zs(i, l, g)), x && d.push(
3982
- ...Na(i, s.toString(), a.toString())
3983
- ), M && d.push(
3984
- ...Ra(i, s.toString(), a.toString())
3980
+ P && d.push(i.toString()), g && d.push(...Pa(i, l, w)), f && d.push(
3981
+ ...xa(i, l, w, !1)
3982
+ ), N && d.push(...Oa(i, l, w)), x && d.push(
3983
+ ...Ia(i, s.toString(), a.toString())
3984
+ ), v && d.push(
3985
+ ..._a(i, s.toString(), a.toString())
3985
3986
  ), c.push(...d);
3986
3987
  }), c;
3987
3988
  };
3988
- function Ca(t) {
3989
+ function La(t) {
3989
3990
  const { urn: e } = t.details;
3990
- return Mt(e.resourceId, e.version, e.agencyId);
3991
+ return de(e.resourceId, e.version, e.agencyId);
3991
3992
  }
3992
- function co(t) {
3993
+ function fo(t) {
3993
3994
  const e = {};
3994
3995
  for (const n of t.datasets) {
3995
- const r = n.dataset, s = Ca(r);
3996
+ const r = n.dataset, s = La(r);
3996
3997
  e[s] = r.details.dimensions;
3997
3998
  }
3998
3999
  return e;
3999
4000
  }
4001
+ function mo(t) {
4002
+ return t?.codelists?.length ? t.codelists.map((e) => ({
4003
+ id: e.id,
4004
+ agencyID: e.agencyID ?? "",
4005
+ version: e.version ?? "",
4006
+ name: e.name,
4007
+ codes: e.codes?.map((n) => ({
4008
+ id: n.id,
4009
+ name: n.name,
4010
+ description: n.description
4011
+ }))
4012
+ })) : (t?.glossaries ?? []).map((e) => ({
4013
+ id: e.id,
4014
+ agencyID: e.agencyID ?? "",
4015
+ version: e.version ?? "",
4016
+ name: e.name,
4017
+ codes: e.terms?.map((n) => ({
4018
+ id: n.id,
4019
+ name: n.name,
4020
+ description: n.description
4021
+ }))
4022
+ }));
4023
+ }
4024
+ function $a(t, e) {
4025
+ const n = (r) => {
4026
+ const s = r.indexOf("(");
4027
+ if (s === -1) return r;
4028
+ const a = r.indexOf(")", s);
4029
+ return a === -1 ? r : r.slice(0, s + 1) + "*" + r.slice(a);
4030
+ };
4031
+ return n(t) === n(e);
4032
+ }
4033
+ function ue(t) {
4034
+ return de(
4035
+ t.id,
4036
+ t.version ?? "",
4037
+ t.agencyID ?? ""
4038
+ );
4039
+ }
4040
+ function Ot(t, e, n) {
4041
+ e?.forEach((r) => {
4042
+ const { childId: s, agency: a, id: o, version: c } = tt(r.code), i = de(o, c, a), u = n?.find(
4043
+ (l) => $a(i, ue(l))
4044
+ ), d = u?.codes?.find((l) => l.id === s);
4045
+ if (d != null) {
4046
+ const l = r.code.replace(
4047
+ i,
4048
+ ue(u)
4049
+ );
4050
+ t.push({ ...d, code: l });
4051
+ }
4052
+ Ot(t, r.hierarchicalCodes, n);
4053
+ });
4054
+ }
4055
+ function ho(t, e) {
4056
+ const n = [];
4057
+ return Ot(n, t?.hierarchicalCodes, e), n;
4058
+ }
4059
+ function go(t) {
4060
+ const e = {};
4061
+ return t?.forEach((n) => {
4062
+ e[ue(n)] = n.codes;
4063
+ }), e;
4064
+ }
4065
+ function wo(t, e, n) {
4066
+ if (!n || n.length === 0 || !e)
4067
+ return t;
4068
+ const r = n[0].cubeRegions?.find(
4069
+ (o) => o.isIncluded
4070
+ );
4071
+ if (!r) return t;
4072
+ const s = r.memberSelection?.find(
4073
+ (o) => o.componentId === e
4074
+ );
4075
+ if (!s) return [];
4076
+ const a = new Set(s.selectionValues.map((o) => o.memberValue));
4077
+ return t.filter((o) => a.has(o.id));
4078
+ }
4079
+ class yo {
4080
+ constructor(e) {
4081
+ this.client = e;
4082
+ }
4083
+ async getAvailableHierarchies(e, n) {
4084
+ const { agency: r, id: s, version: a } = C(e), o = `${this.client.config.sdmxProxyUrl}/sdmx/3.0/structure/codelist`;
4085
+ return this.client.request(
4086
+ `${r}/${s}/${a}?references=hierarchy&detail=allcompletestubs`,
4087
+ { method: "GET" },
4088
+ o,
4089
+ n
4090
+ );
4091
+ }
4092
+ async getHierarchy(e, n) {
4093
+ const { agency: r, id: s, version: a } = C(e), o = `${this.client.config.sdmxProxyUrl}/sdmx/3.0/structure/hierarchy`;
4094
+ return this.client.request(
4095
+ `${r}/${s}/${a}?references=descendants&detail=full`,
4096
+ { method: "GET" },
4097
+ o,
4098
+ n
4099
+ );
4100
+ }
4101
+ }
4000
4102
  export {
4001
- Oe as Annotations,
4002
- ms as AssignmentStatus,
4003
- La as AvailabilityApi,
4004
- Lt as DATASET_DATA_URL,
4005
- Wa as DatasetApi,
4006
- we as DimensionType,
4007
- It as DownloadType,
4008
- qa as FREQUENCY_DIMENSION_ID,
4009
- Ya as FREQUENCY_DIM_ID,
4010
- _t as FileColumnsAttribute,
4011
- $t as GET_v3_FILTER_ALL,
4012
- Sa as GET_v3_FILTER_AND,
4013
- Wt as GET_v3_FILTER_OR,
4014
- ys as OBSERVATION_KEY,
4015
- hs as OccurrenceType,
4016
- aa as Periods,
4017
- sa as RepresentationTextType,
4018
- ra as SDMX_DATA_QUERY_PARAMS,
4019
- ce as SINGLE_WILDCARD_SYMBOL,
4020
- $a as SdmxApiClient,
4021
- Ze as SdmxAvailabilityMode,
4103
+ ye as Annotations,
4104
+ qs as AssignmentStatus,
4105
+ Wa as AvailabilityApi,
4106
+ $t as DATASET_DATA_URL,
4107
+ Ha as DatasetApi,
4108
+ Te as DimensionType,
4109
+ Ct as DownloadType,
4110
+ Ua as FREQUENCY_DIMENSION_ID,
4111
+ Sa as FREQUENCY_DIM_ID,
4112
+ Yt as FileColumnsAttribute,
4113
+ Ht as GET_v3_FILTER_ALL,
4114
+ qa as GET_v3_FILTER_AND,
4115
+ qt as GET_v3_FILTER_OR,
4116
+ yo as HierarchyApi,
4117
+ Xs as OBSERVATION_KEY,
4118
+ Hs as OccurrenceType,
4119
+ gs as Periods,
4120
+ hs as RepresentationTextType,
4121
+ ms as SDMX_DATA_QUERY_PARAMS,
4122
+ ie as SINGLE_WILDCARD_SYMBOL,
4123
+ Qa as SdmxApiClient,
4124
+ nt as SdmxAvailabilityMode,
4022
4125
  X as SdmxDataFormat,
4023
- et as SdmxDetails,
4024
- ue as SdmxReferences,
4025
- _ as SeriesFilterOperator,
4026
- ds as TIME_PERIOD,
4027
- fs as TIME_PERIOD_END_ANNOTATION_KEY,
4028
- ls as TIME_PERIOD_START_ANNOTATION_KEY,
4029
- co as buildDatasetDimensionsMetadataMap,
4030
- Ns as dailyPattern,
4031
- Ts as decodeDimensionId,
4032
- za as findCodelistByDimension,
4033
- _e as generateDatasetDataRequest,
4034
- Mt as generateShortUrn,
4035
- io as getAdditionalColumns,
4036
- Va as getAnnotationPeriod,
4037
- Ne as getArtifactByUrnWithWildCard,
4038
- Qa as getAttachedDimensionsSeriesByDimension,
4039
- ws as getAttachedDimensionsSeriesByTsId,
4040
- gt as getAttachedDimensionsSeriesKey,
4041
- gs as getAttributeValueFromDataQueryResponse,
4042
- Ka as getAvailableCodes,
4043
- Xa as getAvailableCodesFromConstrains,
4044
- Pt as getChildParsedUrn,
4045
- ke as getConcept,
4046
- ze as getConceptByUrn,
4047
- xa as getConceptWithScheme,
4048
- Ma as getConvertedMetaAttributes,
4049
- _s as getDailyRegExp,
4050
- Ra as getDaysColumns,
4051
- Ja as getDimensionTitle,
4052
- Ke as getDimensions,
4053
- oa as getFilteredItemsWithParents,
4054
- fa as getFiltersDtoFromDataQuery,
4055
- ja as getFiltersDtoMapFromDataQuery,
4126
+ rt as SdmxDetails,
4127
+ le as SdmxReferences,
4128
+ I as SeriesFilterOperator,
4129
+ ws as TIME_PERIOD,
4130
+ ps as TIME_PERIOD_END_ANNOTATION_KEY,
4131
+ ys as TIME_PERIOD_START_ANNOTATION_KEY,
4132
+ fo as buildDatasetDimensionsMetadataMap,
4133
+ oa as dailyPattern,
4134
+ Js as decodeDimensionId,
4135
+ Xa as findCodelistByDimension,
4136
+ Ye as generateDatasetDataRequest,
4137
+ de as generateShortUrn,
4138
+ lo as getAdditionalColumns,
4139
+ Ba as getAnnotationPeriod,
4140
+ be as getArtifactByUrnWithWildCard,
4141
+ ja as getAttachedDimensionsSeriesByDimension,
4142
+ Ls as getAttachedDimensionsSeriesByTsId,
4143
+ Tt as getAttachedDimensionsSeriesKey,
4144
+ $s as getAttributeValueFromDataQueryResponse,
4145
+ za as getAvailableCodes,
4146
+ Va as getAvailableCodesFromConstrains,
4147
+ tt as getChildParsedUrn,
4148
+ go as getCodeListsData,
4149
+ De as getConcept,
4150
+ Xe as getConceptByUrn,
4151
+ Cs as getConceptWithScheme,
4152
+ Ws as getConvertedMetaAttributes,
4153
+ ua as getDailyRegExp,
4154
+ _a as getDaysColumns,
4155
+ Ka as getDimensionTitle,
4156
+ je as getDimensions,
4157
+ fs as getFilteredItemsWithParents,
4158
+ Ps as getFiltersDtoFromDataQuery,
4159
+ Ga as getFiltersDtoMapFromDataQuery,
4160
+ wo as getHierarchyAvailableCodes,
4161
+ ho as getHierarchyCodes,
4056
4162
  ee as getISOWeek,
4057
4163
  K as getKeyFromUrn,
4058
- Ga as getLastUpdatedTime,
4059
- Fe as getLastWeekNumberOfYear,
4060
- Ae as getLocalizedName,
4061
- Zs as getMonthlyData,
4062
- Ua as getMonthlyDataByQuarter,
4063
- be as getMonthlyRegExp,
4064
- bt as getParsedEndPeriodDate,
4065
- Fa as getParsedResponse,
4066
- pt as getParsedStartPeriodDate,
4164
+ Fa as getLastUpdatedTime,
4165
+ ze as getLastWeekNumberOfYear,
4166
+ pe as getLocalizedName,
4167
+ Oa as getMonthlyData,
4168
+ co as getMonthlyDataByQuarter,
4169
+ Ae as getMonthlyRegExp,
4170
+ Pt as getParsedEndPeriodDate,
4171
+ oo as getParsedResponse,
4172
+ xt as getParsedStartPeriodDate,
4067
4173
  R as getPeriodDate,
4068
- _a as getPeriods,
4069
- Ha as getQuarterByMonth,
4070
- Te as getQuarterlyRegExp,
4071
- js as getQuartersData,
4072
- Oa as getQueryTimePeriodFilters,
4073
- Yt as getRequestAcceptHeader,
4074
- ba as getResolvedVersionBySingleWildcard,
4075
- zs as getSemiAnnualData,
4076
- Rs as getSemiAnnuallyRegExp,
4077
- ie as getSeriesAttributes,
4078
- ps as getSeriesName,
4079
- no as getStructureComponentsMap,
4080
- Za as getStructureDimensions,
4081
- to as getTimeDimension,
4082
- eo as getTimePeriods,
4083
- oo as getTimeQueryFilter,
4084
- Aa as getTimeRangeFromAttachment,
4085
- ro as getTimeSeriesCount,
4086
- ao as getTimeSeriesFilterKey,
4087
- Ds as getTimeSeriesId,
4088
- yt as getWeekCode,
4089
- Ss as getWeeklyPeriodEndDate,
4090
- Ls as getWeeklyPeriodStartDate,
4091
- Ys as getWeeklyRegExp,
4092
- Na as getWeeksColumns,
4093
- Ta as getWildCardPrefix,
4094
- xt as getYearPeriod,
4095
- ge as getYearlyRegExp,
4096
- ea as getYears,
4097
- Is as isDaily,
4098
- De as isMonthly,
4099
- Ee as isQuarterly,
4100
- pe as isSemiAnnually,
4101
- xe as isWeekly,
4102
- Ea as isWildCardVersionCorrect,
4103
- ye as isYearly,
4104
- ks as monthlyPattern,
4105
- so as openDownloadWindow,
4106
- Ms as quarterPattern,
4107
- Os as semiAnnuallyPattern,
4108
- Ba as sortPeriods,
4109
- H as splitUrn,
4110
- vs as weeklyPattern,
4111
- As as yearlyPattern
4174
+ Ya as getPeriods,
4175
+ io as getQuarterByMonth,
4176
+ ke as getQuarterlyRegExp,
4177
+ xa as getQuartersData,
4178
+ Vs as getQueryTimePeriodFilters,
4179
+ St as getRequestAcceptHeader,
4180
+ Is as getResolvedVersionBySingleWildcard,
4181
+ Pa as getSemiAnnualData,
4182
+ ca as getSemiAnnuallyRegExp,
4183
+ ce as getSeriesAttributes,
4184
+ js as getSeriesName,
4185
+ to as getStructureComponentsMap,
4186
+ Ja as getStructureDimensions,
4187
+ eo as getTimeDimension,
4188
+ Za as getTimePeriods,
4189
+ ao as getTimeQueryFilter,
4190
+ Gs as getTimeRangeFromAttachment,
4191
+ no as getTimeSeriesCount,
4192
+ so as getTimeSeriesFilterKey,
4193
+ Ks as getTimeSeriesId,
4194
+ Et as getWeekCode,
4195
+ Us as getWeeklyPeriodEndDate,
4196
+ Fs as getWeeklyPeriodStartDate,
4197
+ la as getWeeklyRegExp,
4198
+ Ia as getWeeksColumns,
4199
+ _s as getWildCardPrefix,
4200
+ Mt as getYearPeriod,
4201
+ ve as getYearlyRegExp,
4202
+ Aa as getYears,
4203
+ da as isDaily,
4204
+ Ne as isMonthly,
4205
+ Ie as isQuarterly,
4206
+ Oe as isSemiAnnually,
4207
+ Re as isWeekly,
4208
+ Ys as isWildCardVersionCorrect,
4209
+ Me as isYearly,
4210
+ ia as monthlyPattern,
4211
+ ro as openDownloadWindow,
4212
+ na as quarterPattern,
4213
+ mo as resolveCodelistsFromResponse,
4214
+ sa as semiAnnuallyPattern,
4215
+ uo as sortPeriods,
4216
+ C as splitUrn,
4217
+ $a as urnMatchesIgnoreVersion,
4218
+ ra as weeklyPattern,
4219
+ aa as yearlyPattern
4112
4220
  };