@epam/statgpt-sdmx-toolkit 0.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +68 -0
  3. package/api/availability-api.d.ts +8 -0
  4. package/api/dataset-api.d.ts +13 -0
  5. package/api/index.d.ts +4 -0
  6. package/api/sdmx-api-client.d.ts +13 -0
  7. package/api/sdmx-config.d.ts +6 -0
  8. package/constants/attributes.d.ts +1 -0
  9. package/constants/dataset-data-url.d.ts +1 -0
  10. package/constants/filter-operators.d.ts +2 -0
  11. package/constants/frequency-dimension.d.ts +1 -0
  12. package/constants/index.d.ts +2 -0
  13. package/index.cjs +1 -0
  14. package/index.d.ts +6 -0
  15. package/index.mjs +1031 -0
  16. package/models/data/data-message.d.ts +9 -0
  17. package/models/data/dataset.d.ts +13 -0
  18. package/models/data/index.d.ts +4 -0
  19. package/models/data/structure.d.ts +29 -0
  20. package/models/data/time-series.d.ts +18 -0
  21. package/models/dataset-query-filters.d.ts +4 -0
  22. package/models/dimension-group.d.ts +11 -0
  23. package/models/index.d.ts +14 -0
  24. package/models/series-filter.d.ts +6 -0
  25. package/models/splitted-urn.d.ts +8 -0
  26. package/models/structural-metadata/codelist.d.ts +8 -0
  27. package/models/structural-metadata/common-artefact-properties.d.ts +9 -0
  28. package/models/structural-metadata/concept-scheme.d.ts +9 -0
  29. package/models/structural-metadata/constraints.d.ts +16 -0
  30. package/models/structural-metadata/data-structure.d.ts +89 -0
  31. package/models/structural-metadata/dataflow.d.ts +4 -0
  32. package/models/structural-metadata/representation.d.ts +8 -0
  33. package/models/structural-metadata-base.d.ts +26 -0
  34. package/models/structural-metadata.d.ts +16 -0
  35. package/package.json +21 -0
  36. package/parsers/index.d.ts +5 -0
  37. package/parsers/request-parser/data-response-parser.d.ts +12 -0
  38. package/parsers/time-period-parser/define-period.d.ts +18 -0
  39. package/parsers/time-period-parser/get-periodic-date.d.ts +7 -0
  40. package/parsers/time-period-parser/period-sorting.d.ts +1 -0
  41. package/parsers/time-period-parser/time-period.d.ts +2 -0
  42. package/types/annotations.d.ts +4 -0
  43. package/types/attribute-index-value.d.ts +1 -0
  44. package/types/data-query-params.d.ts +3 -0
  45. package/types/details.d.ts +4 -0
  46. package/types/files.d.ts +14 -0
  47. package/types/index.d.ts +9 -0
  48. package/types/logical-operator-type.d.ts +12 -0
  49. package/types/periods.d.ts +5 -0
  50. package/types/references.d.ts +9 -0
  51. package/types/representation-text-type.d.ts +11 -0
  52. package/types/series.d.ts +4 -0
  53. package/utils/annotations.d.ts +2 -0
  54. package/utils/constraint.d.ts +8 -0
  55. package/utils/create-readable-stream.d.ts +1 -0
  56. package/utils/download.d.ts +3 -0
  57. package/utils/find-codelist-by-dimension.d.ts +4 -0
  58. package/utils/get-attached-dimensions-series.d.ts +8 -0
  59. package/utils/get-attributes-value.d.ts +3 -0
  60. package/utils/get-available-codes.d.ts +4 -0
  61. package/utils/get-concept.d.ts +7 -0
  62. package/utils/get-converted-meta-attributes.d.ts +2 -0
  63. package/utils/get-dataset.d.ts +2 -0
  64. package/utils/get-dimension-title.d.ts +3 -0
  65. package/utils/get-dimensions.d.ts +8 -0
  66. package/utils/get-file-headers.d.ts +1 -0
  67. package/utils/get-filtered-items.d.ts +4 -0
  68. package/utils/get-localized-name.d.ts +2 -0
  69. package/utils/get-structure-components.d.ts +4 -0
  70. package/utils/index.d.ts +21 -0
  71. package/utils/query-filters.d.ts +7 -0
  72. package/utils/time-series-count.d.ts +2 -0
  73. package/utils/urn.d.ts +5 -0
  74. package/utils/weekly-periods.utils.d.ts +9 -0
  75. package/utils/wildcards.d.ts +6 -0
package/index.mjs ADDED
@@ -0,0 +1,1031 @@
1
+ const $ = (e) => {
2
+ if (e != null) {
3
+ const t = e.split("=");
4
+ return t.length === 1 ? e : t[1];
5
+ }
6
+ }, p = (e) => {
7
+ var r;
8
+ if (e == null)
9
+ return {};
10
+ const t = $(e), n = {
11
+ agency: "",
12
+ id: "",
13
+ version: ""
14
+ };
15
+ return t && (t.includes(":") && (n.agency = t.split(":")[0], n.id = t.split(":")[1].split("(")[0]), t.includes("(") && t.includes(")") && (n.version = (r = t.split("(")[1]) == null ? void 0 : r.split(")")[0])), n;
16
+ }, Re = (e) => {
17
+ const [t, n] = e.split(")."), { agency: r, id: s, version: o } = p(t + ")");
18
+ return { childId: n, agency: r, id: s, version: o };
19
+ }, Jt = (e, t, n) => {
20
+ const r = t === "" ? "" : `(${t})`;
21
+ return `${n}:${e}${r}`;
22
+ };
23
+ var I = /* @__PURE__ */ ((e) => (e.DESCENDANTS = "descendants", e.NONE = "none", e.ALL = "all", e))(I || {}), le = /* @__PURE__ */ ((e) => (e.EXACT = "exact", e.AVAILABLE = "available", e))(le || {});
24
+ const Ne = (e = "", t = "", n = "") => `sdmx/3.0/availability/dataflow/${e}/${t}/${n}`;
25
+ class Xt {
26
+ constructor(t) {
27
+ this.client = t;
28
+ }
29
+ async getConstraints(t, n) {
30
+ const { agency: r, id: s, version: o } = p(t), i = {
31
+ filters: n || [],
32
+ mode: le.AVAILABLE,
33
+ references: I.NONE
34
+ }, c = Ne(r, s, o);
35
+ return await this.client.postRequest(c, { body: i });
36
+ }
37
+ }
38
+ var S = /* @__PURE__ */ ((e) => (e.CSV = "csv", e.JSON = "json", e.XML = "xml", e))(S || {}), me = /* @__PURE__ */ ((e) => (e.ID = "id", e.NAME = "name", e.ID_NAME = "both", e))(me || {}), Pe = /* @__PURE__ */ ((e) => (e.FULL_DATASET = "full", e.DATA_IN_TABLE = "query", e))(Pe || {});
39
+ const Ie = (e, t) => {
40
+ switch (e) {
41
+ case S.CSV:
42
+ return w(
43
+ "application/vnd.sdmx.data+csv;version=2.0.0",
44
+ t
45
+ );
46
+ case S.XML:
47
+ return w(
48
+ "application/vnd.sdmx.data+xml;version=3.0.0",
49
+ t
50
+ );
51
+ case S.JSON:
52
+ return w(`application/${e}`, t);
53
+ default:
54
+ return w(
55
+ "application/vnd.sdmx.data+csv;version=2.0.0",
56
+ t
57
+ );
58
+ }
59
+ }, w = (e, t) => `${e}; labels=${t}`;
60
+ var O = /* @__PURE__ */ ((e) => (e.REFERENCE_PARTIAL = "referencepartial", e.FULL = "full", e))(O || {});
61
+ const Oe = "all", be = "sdmx/3.0/data/dataflow", F = (e, t, n) => {
62
+ const { filterKey: r, timeFilter: s } = n, { agency: o, id: i, version: c } = p(e), a = [encodeURIComponent(s || ""), t].filter((g) => !!g).join("&");
63
+ return `${`${be}/${o}/${i}/${c}`}/${r || "*"}?${a}`;
64
+ }, _e = (e = "", t = "", n = "", r = I.DESCENDANTS) => `sdmx/3.0/structure/dataflow/${e}/${t}/${n}?references=${r}&detail=${O.REFERENCE_PARTIAL}&forceDataflowDynamicAnnotations=true`;
65
+ class Zt {
66
+ constructor(t) {
67
+ this.client = t;
68
+ }
69
+ async getDataSet(t, n) {
70
+ const { agency: r, id: s, version: o } = p(t);
71
+ return await this.client.getRequest(
72
+ _e(r, s, o, n)
73
+ );
74
+ }
75
+ async getDatasetData(t, n) {
76
+ const r = new URLSearchParams({
77
+ includeHistory: "false",
78
+ limit: "10000",
79
+ attributes: Oe,
80
+ dimensionAtObservation: "TIME_PERIOD",
81
+ // TODO: use time dimensions
82
+ detail: O.FULL
83
+ }).toString(), s = F(t, r, n);
84
+ return await this.client.request(s, {
85
+ method: "GET"
86
+ });
87
+ }
88
+ async downloadDataSet(t, n, r, s, o, i, c = !1) {
89
+ const a = new URLSearchParams({
90
+ format: n,
91
+ compress: "false",
92
+ attributes: c ? "all" : "none"
93
+ }).toString(), u = F(t, a, o);
94
+ return this.client.streamRequest(
95
+ u,
96
+ {
97
+ method: "GET",
98
+ headers: {
99
+ Accept: Ie(n, s),
100
+ "Accept-language": r
101
+ }
102
+ },
103
+ i
104
+ );
105
+ }
106
+ }
107
+ const z = async (e, t, n) => await fetch(e, {
108
+ method: n.method || "GET",
109
+ headers: t,
110
+ body: n.body ? JSON.stringify(n.body) : void 0
111
+ }), Le = "application/json", Ue = "Content-Type", R = "Api-Key", qe = "X-CONVERSATION-ID", H = (e, t, n) => {
112
+ const r = {
113
+ [Ue]: (t == null ? void 0 : t.contentType) || Le
114
+ };
115
+ return t != null && t.jwt && (r.Authorization = `Bearer ${t.jwt}`), t != null && t.chatReference && (r[qe] = t.chatReference), { ...r, ...n };
116
+ }, We = (e) => {
117
+ const t = { ...e };
118
+ return t[R] && (t[R] = t[R].substring(0, 8) + "...[REDACTED]"), t.Authorization && (t.Authorization = "Bearer [REDACTED]"), t;
119
+ }, xe = (e, t) => e.error || e.message || `${t.status} ${t.statusText}`;
120
+ class en {
121
+ constructor(t) {
122
+ this.config = t, console.info("SdmxApiClient initialized", {
123
+ apiUrl: t.apiUrl || "NOT SET"
124
+ });
125
+ }
126
+ async getRequest(t, n) {
127
+ return this.request(t, { ...n, method: "GET" });
128
+ }
129
+ async postRequest(t, n) {
130
+ return this.request(t, { ...n, method: "POST" });
131
+ }
132
+ async streamRequest(t, n, r) {
133
+ const s = `${this.config.apiUrl}/${t}`, o = {
134
+ ...H(void 0, {
135
+ jwt: this.config.jwt
136
+ }),
137
+ ...n.headers
138
+ };
139
+ this.config.apiKey != null && (o["Ocp-Apim-Subscription-Key"] = this.config.apiKey);
140
+ const i = new ReadableStream({
141
+ async start(a) {
142
+ var u;
143
+ try {
144
+ const l = await z(s, o, n);
145
+ if (!l.ok) {
146
+ const f = await l.text();
147
+ throw console.error(
148
+ `Fetch failed! Status: ${l.status}, Body: ${f}`
149
+ ), new Error(`Fetch failed with status ${l.status}`);
150
+ }
151
+ const g = (u = l.body) == null ? void 0 : u.getReader();
152
+ if (!g) throw new Error("Failed to create stream reader");
153
+ const h = new Uint8Array([239, 187, 191]);
154
+ a.enqueue(h);
155
+ const d = async () => {
156
+ const { done: f, value: E } = await g.read();
157
+ f ? a.close() : (a.enqueue(E), await d());
158
+ };
159
+ d();
160
+ } catch (l) {
161
+ a.error(l);
162
+ }
163
+ }
164
+ }), c = new Headers({
165
+ "Content-Disposition": `attachment; filename=${encodeURIComponent(r)}`
166
+ });
167
+ return new Response(i, { headers: c });
168
+ }
169
+ async request(t, n) {
170
+ const r = Date.now(), s = t.includes("availability") && this.config.constrainsApiUrl ? `${this.config.constrainsApiUrl}/${t}` : `${this.config.apiUrl}/${t}`, o = {
171
+ ...H(void 0, {
172
+ jwt: this.config.jwt
173
+ }),
174
+ ...n.headers
175
+ };
176
+ this.config.apiKey != null && (o["Ocp-Apim-Subscription-Key"] = this.config.apiKey), this.addInfoRequestLog("API Request", s, n, o);
177
+ try {
178
+ const i = await z(s, o, n), c = Date.now() - r;
179
+ let a;
180
+ const u = await i.text();
181
+ try {
182
+ a = u ? JSON.parse(u) : {};
183
+ } catch {
184
+ if (this.addErrorRequestParsing(
185
+ s,
186
+ n,
187
+ i,
188
+ c,
189
+ u
190
+ ), !i.ok)
191
+ throw new Error(
192
+ `API request failed: ${i.status} ${i.statusText} - ${u.substring(0, 100)}`
193
+ );
194
+ a = { data: u };
195
+ }
196
+ if (!i.ok) {
197
+ this.addErrorRequestLog(s, n, i, c, a);
198
+ const l = xe(a, i);
199
+ throw new Error(`API request failed: ${l}`);
200
+ }
201
+ return a;
202
+ } catch (i) {
203
+ const c = Date.now() - r;
204
+ throw console.error("API Request Exception", {
205
+ method: n.method,
206
+ url: s,
207
+ duration: `${c}ms`,
208
+ error: i instanceof Error ? i.message : String(i)
209
+ }), i;
210
+ }
211
+ }
212
+ addInfoRequestLog(t, n, r, s) {
213
+ const o = {
214
+ method: r.method || "GET",
215
+ url: n,
216
+ headers: We(s)
217
+ };
218
+ r.body && (o.body = r.body), console.info(t, o);
219
+ }
220
+ addErrorRequestLog(t, n, r, s, o) {
221
+ console.error("API Request Failed", {
222
+ method: n.method,
223
+ url: t,
224
+ status: r.status,
225
+ statusText: r.statusText,
226
+ duration: `${s}ms`,
227
+ response: o
228
+ });
229
+ }
230
+ addErrorRequestParsing(t, n, r, s, o) {
231
+ console.error("API Response Parse Error", {
232
+ method: n.method,
233
+ url: t,
234
+ status: r.status,
235
+ statusText: r.statusText,
236
+ duration: `${s}ms`,
237
+ responseText: o.substring(0, 200),
238
+ error: "Response is not valid JSON"
239
+ });
240
+ }
241
+ }
242
+ const de = "+", tn = ",";
243
+ var Be = /* @__PURE__ */ ((e) => (e.CONDITIONAL = "Conditional", e.MANDATORY = "Mandatory", e))(Be || {}), b = /* @__PURE__ */ ((e) => (e.DIMENSION = "Dimension", e.MEASURE_DIMENSION = "MeasureDimension", e.TIME_DIMENSION = "TimeDimension", e))(b || {}), Ce = /* @__PURE__ */ ((e) => (e.UNBOUNDED = "unbounded", e))(Ce || {});
244
+ const Ve = (e, t) => {
245
+ var c, a, u, l, g;
246
+ const n = (a = (c = e == null ? void 0 : e.data) == null ? void 0 : c.dataSets) == null ? void 0 : a[0], r = (l = (u = e == null ? void 0 : e.data) == null ? void 0 : u.structures) == null ? void 0 : l[0], s = ((g = r == null ? void 0 : r.attributes) == null ? void 0 : g.dimensionGroup) || [], o = n == null ? void 0 : n.dimensionGroupAttributes, i = {};
247
+ for (const h of s) {
248
+ const d = h.relationship.dimensions, { codedSeriesKey: f, decodedSeriesKey: E } = fe(
249
+ e,
250
+ t,
251
+ d
252
+ );
253
+ i[h.id] = {
254
+ values: (o == null ? void 0 : o[f]) || [],
255
+ decodedSeriesKey: E,
256
+ codedSeriesKey: f
257
+ };
258
+ }
259
+ return i;
260
+ }, fe = (e, t, n) => {
261
+ var c, a;
262
+ const r = (a = (c = e == null ? void 0 : e.data) == null ? void 0 : c.structures) == null ? void 0 : a[0], s = [
263
+ ...(r == null ? void 0 : r.dimensions.series) || [],
264
+ ...(r == null ? void 0 : r.dimensions.observation) || []
265
+ ], o = new Array(s == null ? void 0 : s.length), i = new Array(s == null ? void 0 : s.length);
266
+ return n == null || n.forEach((u) => {
267
+ const l = (s == null ? void 0 : s.findIndex((d) => d.id === u)) || 0, g = t[l], h = s[l].values.findIndex(
268
+ (d) => d.id === g || d.value === g
269
+ ) || 0;
270
+ o[l] = h >= 0 ? h : g, i[l] = g;
271
+ }), {
272
+ codedSeriesKey: o.join(":"),
273
+ decodedSeriesKey: i.join(":")
274
+ };
275
+ }, nn = (e, t, n) => {
276
+ var g, h, d, f, E;
277
+ const r = (h = (g = e == null ? void 0 : e.data) == null ? void 0 : g.dataSets) == null ? void 0 : h[0], s = (f = (d = e == null ? void 0 : e.data) == null ? void 0 : d.structures) == null ? void 0 : f[0], o = (((E = s == null ? void 0 : s.attributes) == null ? void 0 : E.dimensionGroup) || []).filter(
278
+ (A) => {
279
+ var y;
280
+ return ((y = A.relationship.dimensions) == null ? void 0 : y.length) === 1 && A.relationship.dimensions.includes(t || "");
281
+ }
282
+ ), i = r == null ? void 0 : r.dimensionGroupAttributes, c = [
283
+ ...(s == null ? void 0 : s.dimensions.series) || [],
284
+ ...(s == null ? void 0 : s.dimensions.observation) || []
285
+ ], a = c == null ? void 0 : c.findIndex((A) => A.id === t), u = new Array(c == null ? void 0 : c.length);
286
+ u[a] = n || "";
287
+ const l = {};
288
+ for (const A of o) {
289
+ const y = A.relationship.dimensions, { codedSeriesKey: D, decodedSeriesKey: v } = fe(
290
+ e,
291
+ u,
292
+ y
293
+ );
294
+ l[A.id] = {
295
+ values: (i == null ? void 0 : i[D]) || [],
296
+ decodedSeriesKey: v,
297
+ codedSeriesKey: D
298
+ };
299
+ }
300
+ return l;
301
+ }, Ye = (e, t) => {
302
+ var r;
303
+ if (t == null)
304
+ return;
305
+ const n = (r = e.values) == null ? void 0 : r[t];
306
+ return n ?? (t instanceof Array ? { values: t } : { value: t.toString() });
307
+ }, ke = "Observation", rn = (e) => {
308
+ var u, l, g, h, d, f;
309
+ const t = (u = e == null ? void 0 : e.data) == null ? void 0 : u.dataSets, n = (g = (l = e == null ? void 0 : e.data) == null ? void 0 : l.structures) == null ? void 0 : g[0];
310
+ if (!t || !n)
311
+ return [];
312
+ const r = n.attributes, s = n.dimensions, o = (r == null ? void 0 : r.dimensionGroup) || [], i = t[0].series || t[0].observations, c = (h = s.series) != null && h.length ? s.series : s.observation, a = [];
313
+ for (const E in i) {
314
+ const A = [], { name: y, parsedTimeSeriesValue: D } = Ke(
315
+ E,
316
+ c
317
+ ), v = i[E], De = v.attributes || [];
318
+ if (Object.keys(v).length === 0) {
319
+ a.push({
320
+ name: y,
321
+ parsedTimeSeriesValue: D,
322
+ values: A,
323
+ attributes: [],
324
+ dataSetAttrs: []
325
+ });
326
+ continue;
327
+ }
328
+ A.push(
329
+ ...je(v, n)
330
+ );
331
+ const Te = N(
332
+ (r == null ? void 0 : r.series) || [],
333
+ (T) => De[T]
334
+ ), ve = Fe(
335
+ ((d = n.attributes) == null ? void 0 : d.dataSet) || [],
336
+ ((f = t[0].attributes) == null ? void 0 : f.filter((T) => T != null)) || []
337
+ ), pe = Ve(
338
+ e,
339
+ D
340
+ ), we = o.map((T, Se) => {
341
+ const j = pe[T.id], $e = Ye(
342
+ T,
343
+ j.values[Se]
344
+ );
345
+ return {
346
+ attribute: T,
347
+ dimensionGroupValue: $e,
348
+ dimensionGroupData: j
349
+ };
350
+ });
351
+ a.push({
352
+ name: y,
353
+ parsedTimeSeriesValue: D,
354
+ values: A,
355
+ attributes: Te,
356
+ dataSetAttrs: ve,
357
+ dimensionGroupAttributes: we
358
+ });
359
+ }
360
+ return a;
361
+ }, Ke = (e, t) => {
362
+ const n = e.split(new RegExp("(?<!\\|):(?!\\||$)")), r = [];
363
+ for (let s = 0; s < n.length; s++) {
364
+ const o = t == null ? void 0 : t[s], i = Number(n[s]);
365
+ if (i < 0 || o == null)
366
+ continue;
367
+ const c = o.values[i];
368
+ if (c == null) {
369
+ r.push(n[s].replace("|:", ":"));
370
+ continue;
371
+ }
372
+ r.push((c == null ? void 0 : c.id) || (c == null ? void 0 : c.value) || "");
373
+ }
374
+ return {
375
+ name: Ge(r),
376
+ parsedTimeSeriesValue: r
377
+ };
378
+ }, N = (e, t) => {
379
+ const n = [];
380
+ for (let r = 0; r < e.length; r++) {
381
+ const s = e[r], o = t(r), i = o != null && s.values != null ? Me(o, s) : void 0;
382
+ n.push({
383
+ name: s.id,
384
+ value: i
385
+ });
386
+ }
387
+ return n;
388
+ }, Me = (e, t) => {
389
+ const n = t.values[e];
390
+ return n == null ? typeof e == "object" ? e : e.toString() : (n == null ? void 0 : n.id) || (n == null ? void 0 : n.value) || (n == null ? void 0 : n.ids) || (n == null ? void 0 : n.values);
391
+ }, Ge = (e) => e.map((t) => t ? Qe(t) : "").join("."), Qe = (e) => e.replace(/\./g, "|.").replace(/:/g, "|:"), je = (e, t) => {
392
+ var i, c, a, u, l;
393
+ const n = (c = (i = t.measures) == null ? void 0 : i.observation) == null ? void 0 : c.length;
394
+ if (e.observations == null)
395
+ return [
396
+ {
397
+ values: J(e, t.measures),
398
+ obsAttributes: N(
399
+ ((a = t.attributes) == null ? void 0 : a.observation) || [],
400
+ (g) => e[g + n]
401
+ ),
402
+ dimensionAtObservation: ke
403
+ }
404
+ ];
405
+ const r = e.observations, s = (u = t.dimensions.observation) == null ? void 0 : u[0], o = [];
406
+ for (const g in r) {
407
+ const h = s == null ? void 0 : s.values[g];
408
+ o.push({
409
+ dimensionAtObservation: (h == null ? void 0 : h.value) || (h == null ? void 0 : h.id),
410
+ values: J(
411
+ r[g],
412
+ t.measures
413
+ ),
414
+ obsAttributes: N(
415
+ ((l = t.attributes) == null ? void 0 : l.observation) || [],
416
+ (d) => r[g][d + n]
417
+ )
418
+ });
419
+ }
420
+ return o;
421
+ }, J = (e, t) => {
422
+ var n;
423
+ return ((n = t == null ? void 0 : t.observation) == null ? void 0 : n.map((r, s) => ({ name: r.id, value: e[s] }))) || [];
424
+ }, Fe = (e, t) => e.reduce(
425
+ (n, r, s) => {
426
+ const o = t[s];
427
+ return ze(n, r, o, ""), n;
428
+ },
429
+ []
430
+ ), ze = (e, t, n, r) => {
431
+ var o, i, c;
432
+ const s = n != null ? ((o = t == null ? void 0 : t.values) == null ? void 0 : o.length) > 0 ? ((i = t.values[n]) == null ? void 0 : i.id) || ((c = t.values[n]) == null ? void 0 : c.value) : String(n) : r;
433
+ e.push({
434
+ name: t.id,
435
+ value: s || ""
436
+ });
437
+ }, He = /^[0-9][0-9][0-9][0-9]-Q[1-4]$/, Je = /^[0-9][0-9][0-9][0-9]-W[0-9][0-9]?$/, Xe = /^[0-9][0-9][0-9][0-9]-S[1-2]$/, Ze = /^[0-9][0-9][0-9][0-9]$/, et = /^[0-9][0-9][0-9][0-9]-(0[1-9]|1[0-2])-[0-9][0-9]$/, tt = /^[0-9][0-9][0-9][0-9]-M(0[1-9]|(1[0-2]))$/, _ = (e) => Ze.exec(e), L = (e) => !!_(e), nt = (e) => Xe.exec(e), U = (e) => !!nt(e), q = (e) => tt.exec(e), W = (e) => !!q(e), x = (e) => He.exec(e), B = (e) => !!x(e), rt = (e) => et.exec(e), st = (e) => !!rt(e), ot = (e) => Je.exec(e), C = (e) => !!ot(e), V = 1440 * 60 * 1e3, Y = 7 * V;
438
+ function k(e) {
439
+ const t = `${e}-01-01`, n = new Date(t);
440
+ if (n.getDay() !== 4) {
441
+ const s = 1 + (4 - n.getDay() + 7) % 7;
442
+ n.setMonth(0, s);
443
+ }
444
+ return n;
445
+ }
446
+ function it(e) {
447
+ const t = new Date(e), r = -((t.getDay() + 6) % 7) + 3;
448
+ return t.setDate(t.getDate() + r), new Date(t.valueOf());
449
+ }
450
+ function sn(e, t = "W") {
451
+ const n = `${e}-12-31`, r = X(new Date(n), t);
452
+ if (r.weekYear === e)
453
+ return r.weekNumber;
454
+ const s = `${e}-12-24`;
455
+ return X(new Date(s), t).weekNumber;
456
+ }
457
+ function ct(e, t, n = "W") {
458
+ return `${e}-${n}${t < 10 ? "0" + t : t}`;
459
+ }
460
+ function X(e, t = "W") {
461
+ const n = it(e), r = n.getFullYear(), s = k(r), o = 1 + Math.ceil(
462
+ (n.getTime() - s.getTime()) / Y
463
+ );
464
+ return {
465
+ code: ct(r, o, t),
466
+ weekNumber: o,
467
+ weekYear: r
468
+ };
469
+ }
470
+ function at(e) {
471
+ const [t, n] = e.split("-W"), s = k(+t).getTime() + (+n - 1) * Y - 3 * V;
472
+ return new Date(s);
473
+ }
474
+ function ut(e) {
475
+ const [t, n] = e.split("-W"), s = k(+t).getTime() + (+n - 1) * Y + 3 * V;
476
+ return new Date(s);
477
+ }
478
+ function ge(e) {
479
+ return L(e) ? lt(e) : U(e) ? ft(e) : B(e) ? ht(e) : W(e) ? Et(e) : C(e) ? at(e) : Dt(e);
480
+ }
481
+ function he(e) {
482
+ return L(e) ? dt(e) : U(e) ? gt(e) : B(e) ? At(e) : W(e) ? yt(e) : C(e) ? ut(e) : Tt(e);
483
+ }
484
+ function lt(e) {
485
+ const t = _(e);
486
+ if (t)
487
+ return new Date(Number(t[0]), 0, 1);
488
+ }
489
+ function dt(e) {
490
+ const t = _(e);
491
+ if (t)
492
+ return new Date(Number(t[0]) + 1, 0, 1);
493
+ }
494
+ function ft(e) {
495
+ const [t, n] = e.split("-S");
496
+ switch (+n) {
497
+ case 1:
498
+ return new Date(+t, 0, 1);
499
+ case 2:
500
+ return new Date(+t, 6, 1);
501
+ }
502
+ }
503
+ function gt(e) {
504
+ const [t, n] = e.split("-S");
505
+ switch (+n) {
506
+ case 1:
507
+ return new Date(+t, 6, 1);
508
+ case 2:
509
+ return new Date(+t + 1, 0, 1);
510
+ }
511
+ }
512
+ function ht(e) {
513
+ const t = x(e);
514
+ if (!t)
515
+ return;
516
+ const [n, r] = t[0].split("-Q");
517
+ switch (+r) {
518
+ case 1:
519
+ return new Date(+n, 0, 1);
520
+ case 2:
521
+ return new Date(+n, 3, 1);
522
+ case 3:
523
+ return new Date(+n, 6, 1);
524
+ case 4:
525
+ return new Date(+n, 9, 1);
526
+ }
527
+ }
528
+ function At(e) {
529
+ const t = x(e);
530
+ if (!t)
531
+ return;
532
+ const [n, r] = t[0].split("-Q");
533
+ switch (+r) {
534
+ case 1:
535
+ return new Date(+n, 3, 1);
536
+ case 2:
537
+ return new Date(+n, 6, 1);
538
+ case 3:
539
+ return new Date(+n, 9, 1);
540
+ case 4:
541
+ return new Date(+n + 1, 0, 1);
542
+ }
543
+ }
544
+ function Et(e) {
545
+ const t = q(e);
546
+ if (!t)
547
+ return;
548
+ const [n, r] = t[0].split("-M");
549
+ return new Date(+n, +r - 1, 1);
550
+ }
551
+ function yt(e) {
552
+ const t = q(e);
553
+ if (!t)
554
+ return;
555
+ const [n, r] = t[0].split("-M");
556
+ return new Date(+n, +r, 1);
557
+ }
558
+ const Dt = (e) => /* @__PURE__ */ new Date(`${e}T00:00:00`), Tt = (e) => {
559
+ const t = /* @__PURE__ */ new Date(`${e}T23:59:00`);
560
+ return t.setMinutes(t.getMinutes() + 1), t;
561
+ }, vt = 1, on = (e, t, n, r = !0, s = "Q") => {
562
+ const o = [], i = t && t > 3 ? $t(t, r) : 1, c = n ? Math.floor((n - 1) / 3) : 4;
563
+ for (let a = i; a <= c; a++)
564
+ o.push(`${e}-${s}${a}`);
565
+ return o;
566
+ }, cn = (e, t, n, r = "S") => {
567
+ const s = [];
568
+ return (t || 1) < 7 && (n || 12) > 6 && s.push(`${e}-${r}1`), n == null && s.push(`${e}-${r}2`), s;
569
+ }, an = (e) => Math.ceil(e / 3), Ae = (e, t, n = "M") => `${e}-${n}${t.toString().padStart(2, "0")}`, pt = (e, t, n = "M") => {
570
+ const r = [];
571
+ for (let s = t; s <= 12; s++)
572
+ r.push(Ae(e, s, n));
573
+ return r;
574
+ }, wt = (e, t, n, r = "M") => {
575
+ const s = [];
576
+ for (let o = t; o < n; o++)
577
+ s.push(Ae(e, o, r));
578
+ return s;
579
+ }, un = (e, t, n, r = "M") => {
580
+ const s = t || 1, o = n == null, i = n || 12;
581
+ return o ? pt(e, s, r) : wt(e, s, i, r);
582
+ }, ln = (e, t, n = "M") => {
583
+ switch (t) {
584
+ case 0:
585
+ return [
586
+ `${e}-${n}01`,
587
+ `${e}-${n}02`,
588
+ `${e}-${n}03`
589
+ ];
590
+ case 1:
591
+ return [
592
+ `${e}-${n}04`,
593
+ `${e}-${n}05`,
594
+ `${e}-${n}06`
595
+ ];
596
+ case 2:
597
+ return [
598
+ `${e}-${n}07`,
599
+ `${e}-${n}08`,
600
+ `${e}-${n}09`
601
+ ];
602
+ case 3:
603
+ return [
604
+ `${e}-${n}10`,
605
+ `${e}-${n}11`,
606
+ `${e}-${n}12`
607
+ ];
608
+ default:
609
+ return [];
610
+ }
611
+ }, dn = (e, t) => {
612
+ const n = Z(t, !0), r = Z(e), s = n.getFullYear(), o = r.getFullYear(), i = n.getTime() <= r.getTime() ? o + vt - s : 0;
613
+ return Array.from({ length: i }, (a, u) => s + u);
614
+ }, Z = (e, t = !1) => {
615
+ const n = St(e, t);
616
+ return n ? (n.getTimezoneOffset() > 0 && n.setMinutes(n.getMinutes() + n.getTimezoneOffset()), n) : /* @__PURE__ */ new Date();
617
+ }, St = (e, t = !1) => {
618
+ const n = Number(e);
619
+ return e.toString().length !== 13 ? t ? ge(e) : he(e) : isNaN(n) ? /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`) : new Date(n);
620
+ }, $t = (e, t) => t ? Math.floor((e + 1) / 3) : Math.ceil((e + 1) / 3), fn = (e, t) => {
621
+ const n = te(e) - te(t);
622
+ if (n === 0 && e !== t) {
623
+ const r = ee(e), s = ee(t);
624
+ return r - s;
625
+ }
626
+ return n;
627
+ }, ee = (e) => L(e) ? 6 : U(e) ? 5 : B(e) ? 4 : W(e) ? 3 : C(e) ? 2 : st(e) ? 1 : 0, te = (e, t = !1) => {
628
+ const n = t ? ge(e) : he(e);
629
+ return (n == null ? void 0 : n.getTime()) || 0;
630
+ };
631
+ var K = /* @__PURE__ */ ((e) => (e.LAST_UPDATE_AT = "lastUpdatedAt", e.SERIES_COUNT = "series_count", e))(K || {}), Rt = /* @__PURE__ */ ((e) => (e.C = "c", e))(Rt || {}), m = /* @__PURE__ */ ((e) => (e.EQUALS = "eq", e.NOT_EQUALS = "ne", e.LESS = "lt", e.LESS_OR_EQUAL = "le", e.GREATER = "gt", e.GREATER_OR_EQUAL = "ge", e.CONTAINS = "co", e.NOT_CONTAINS = "nc", e.STARTS = "sw", e.ENDS = "ew", e))(m || {}), Nt = /* @__PURE__ */ ((e) => (e.BOOLEAN = "Boolean", e.DATE_TIME = "DateTime", e.DECIMAL = "Decimal", e.INTEGER = "Integer", e.OBSERVATION_TIME_PERIOD = "ObservationalTimePeriod", e.STRING = "String", e.TIME = "Time", e.TIME_RANGE = "TimeRange", e.URI = "URI", e))(Nt || {});
632
+ function gn(e) {
633
+ var t, n;
634
+ return (n = (t = e == null ? void 0 : e.annotations) == null ? void 0 : t.find((r) => {
635
+ if (r.id === K.LAST_UPDATE_AT)
636
+ return r;
637
+ })) == null ? void 0 : n.value;
638
+ }
639
+ const M = (e, t) => (e == null ? void 0 : e.names) && (e == null ? void 0 : e.names[t]) || (e == null ? void 0 : e.name), Ee = (e, t, n) => {
640
+ if (!(!e || t != null && t.has(e == null ? void 0 : e.id)) && (t == null || t.set(e == null ? void 0 : e.id, e), e != null && e.parent)) {
641
+ const r = n == null ? void 0 : n.get(e == null ? void 0 : e.parent);
642
+ Ee(r, t, n);
643
+ }
644
+ }, mt = (e, t) => {
645
+ const n = /* @__PURE__ */ new Map(), r = new Map(e == null ? void 0 : e.map((s) => [s.id, s]));
646
+ return t == null || t.forEach((s) => {
647
+ Ee(s, n, r);
648
+ }), Array.from(n == null ? void 0 : n.values());
649
+ }, Pt = "time_period_end", It = "time_period_start", hn = (e) => {
650
+ const t = e == null ? void 0 : e.find(
651
+ (o) => o.id === It
652
+ ), n = e == null ? void 0 : e.find(
653
+ (o) => o.id === Pt
654
+ ), r = n != null && n.title ? new Date(n == null ? void 0 : n.title) : null;
655
+ return {
656
+ startPeriod: t != null && t.title ? new Date(t == null ? void 0 : t.title) : null,
657
+ endPeriod: r
658
+ };
659
+ }, Ot = (e, t) => e.id.localeCompare(t.id), bt = (e, t) => e.memberValue.localeCompare(t.memberValue), _t = (e, t) => {
660
+ const n = new Array(e.length), r = e.map((i, c) => [i, c]);
661
+ r.sort(
662
+ (i, c) => Ot(i[0], c[0])
663
+ );
664
+ const s = [...t];
665
+ s.sort(bt);
666
+ let o = 0;
667
+ for (const i of r) {
668
+ const c = i[0];
669
+ for (; o < s.length && s[o].memberValue.localeCompare(c.id) < 0; )
670
+ o += 1;
671
+ o < s.length && s[o].memberValue === c.id && (n[i[1]] = i[0]);
672
+ }
673
+ return n.filter((i) => i != null);
674
+ }, Lt = (e) => !!(e != null && e.some((t) => t.parent)), An = (e, t, n, r, s = []) => {
675
+ var i, c;
676
+ let o = e || [];
677
+ if (Ut(n || [], t || "")) {
678
+ const a = (i = (n || [])[0].cubeRegions) == null ? void 0 : i.find(
679
+ ({ isIncluded: u }) => u
680
+ );
681
+ if (a) {
682
+ const u = (c = a.memberSelection) == null ? void 0 : c.find(
683
+ ({ componentId: l }) => l === t
684
+ );
685
+ u ? o = o.length === 0 ? (u.selectionValues || []).map(({ memberValue: l }) => ({
686
+ id: l,
687
+ name: l
688
+ })) : _t(o, u.selectionValues) : o = [];
689
+ }
690
+ } else s.length !== 0 && (o = o.filter(({ id: a }) => s.includes(a)));
691
+ return Lt(e) && (o = mt(e, o)), o == null ? void 0 : o.map((a) => ({
692
+ ...a,
693
+ name: r ? M(a, r) : a == null ? void 0 : a.name
694
+ }));
695
+ }, Ut = (e, t) => e != null && e.length > 0 && t != null, qt = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, ne = (e) => {
696
+ if (typeof e != "string")
697
+ throw new TypeError("Invalid argument expected string");
698
+ const t = e.match(qt);
699
+ if (!t)
700
+ throw new Error(`Invalid argument not valid semver ('${e}' received)`);
701
+ return t.shift(), t;
702
+ }, re = (e) => e === "*" || e === "x" || e === "X", se = (e) => {
703
+ const t = parseInt(e, 10);
704
+ return isNaN(t) ? e : t;
705
+ }, Wt = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], xt = (e, t) => {
706
+ if (re(e) || re(t))
707
+ return 0;
708
+ const [n, r] = Wt(se(e), se(t));
709
+ return n > r ? 1 : n < r ? -1 : 0;
710
+ }, oe = (e, t) => {
711
+ for (let n = 0; n < Math.max(e.length, t.length); n++) {
712
+ const r = xt(e[n] || "0", t[n] || "0");
713
+ if (r !== 0)
714
+ return r;
715
+ }
716
+ return 0;
717
+ }, Bt = (e, t) => {
718
+ const n = ne(e), r = ne(t), s = n.pop(), o = r.pop(), i = oe(n, r);
719
+ return i !== 0 ? i : s && o ? oe(s.split("."), o.split(".")) : s || o ? s ? -1 : 1 : 0;
720
+ }, Ct = (e, t, n) => {
721
+ Vt(n);
722
+ const r = Bt(e, t);
723
+ return ye[n].includes(r);
724
+ }, ye = {
725
+ ">": [1],
726
+ ">=": [0, 1],
727
+ "=": [0],
728
+ "<=": [-1, 0],
729
+ "<": [-1],
730
+ "!=": [-1, 1]
731
+ }, ie = Object.keys(ye), Vt = (e) => {
732
+ if (ie.indexOf(e) === -1)
733
+ throw new Error(`Invalid operator, expected one of ${ie.join("|")}`);
734
+ }, P = "+", G = (e, t) => {
735
+ const { agency: n, id: r, version: s } = p(e), o = t.filter(
736
+ (a) => {
737
+ var u;
738
+ return a.agencyID === n && a.id === r && !((u = a == null ? void 0 : a.version) != null && u.includes(P));
739
+ }
740
+ );
741
+ if (o.length === 1)
742
+ return o[0];
743
+ if (!(s != null && s.includes(P)))
744
+ return o.find((a) => a.version === s);
745
+ const i = o.map(
746
+ (a) => a.version
747
+ ), c = Yt(s, i);
748
+ return o.find(
749
+ (a) => a.version === c[0]
750
+ );
751
+ }, Yt = (e, t) => {
752
+ const n = kt(e, t);
753
+ return n.length > 0 ? [n[0]] : [];
754
+ }, kt = (e, t) => {
755
+ const n = [];
756
+ return t.forEach((r) => {
757
+ Mt(e, r) && n.push(r);
758
+ }), n;
759
+ }, Kt = (e) => {
760
+ const t = e.trim().replace(/\d+\+/, "*"), [n] = t.split("*");
761
+ return new RegExp(`^${n}`);
762
+ }, Mt = (e, t) => {
763
+ const n = e.trim().replace(/\+/, "");
764
+ return Kt(e).test(t) && Ct(t, n, ">=");
765
+ }, Q = (e, t) => {
766
+ const { concept: n } = Gt(e, t);
767
+ return n;
768
+ }, Gt = (e, t) => {
769
+ if (e == null)
770
+ return {
771
+ concept: void 0,
772
+ scheme: void 0
773
+ };
774
+ const { childId: n, agency: r, id: s, version: o } = Re(e);
775
+ if (o != null && o.includes(P)) {
776
+ const i = G(
777
+ e,
778
+ t
779
+ );
780
+ return {
781
+ concept: ce((i == null ? void 0 : i.concepts) || [], n),
782
+ scheme: i
783
+ };
784
+ }
785
+ for (const i of t)
786
+ if (Qt(i, s, r, o))
787
+ return {
788
+ concept: ce((i == null ? void 0 : i.concepts) || [], n),
789
+ scheme: i
790
+ };
791
+ return {
792
+ concept: void 0,
793
+ scheme: void 0
794
+ };
795
+ }, ce = (e, t) => e == null ? void 0 : e.find((n) => n.id === t), Qt = (e, t, n, r) => e.id === t && e.agencyID === n && e.version === r, En = (e = [], t = [], n) => {
796
+ var a, u;
797
+ const r = (n == null ? void 0 : n.conceptIdentity) || "", s = Q(r, t), o = $(
798
+ (a = n == null ? void 0 : n.localRepresentation) == null ? void 0 : a.enumeration
799
+ ), i = $(
800
+ (u = s == null ? void 0 : s.coreRepresentation) == null ? void 0 : u.enumeration
801
+ ), c = o || i;
802
+ if (c != null)
803
+ return G(c, e);
804
+ }, yn = (e, t, n, r) => {
805
+ var o, i;
806
+ const s = (o = t == null ? void 0 : t.find(
807
+ (c) => (c == null ? void 0 : c.id) === (e == null ? void 0 : e.id)
808
+ )) == null ? void 0 : o.values;
809
+ return ((i = n == null ? void 0 : n.filter((c) => s == null ? void 0 : s.some((a) => a.id === c.id))) == null ? void 0 : i.map((c) => ({
810
+ ...c,
811
+ name: r ? M(c, r) : c == null ? void 0 : c.name
812
+ }))) || [];
813
+ }, jt = (e, t) => {
814
+ var s, o, i;
815
+ const n = (s = t == null ? void 0 : t.dataStructureComponents) == null ? void 0 : s.attributeList, r = (o = e == null ? void 0 : e.metadataStructureComponents) == null ? void 0 : o.metadataAttributeList;
816
+ return (i = n == null ? void 0 : n.metadataAttributeUsages) == null ? void 0 : i.map((c) => {
817
+ var u;
818
+ const a = (u = r == null ? void 0 : r.metadataAttributes) == null ? void 0 : u.find(
819
+ (l) => (l == null ? void 0 : l.id) === (c == null ? void 0 : c.metadataAttributeReference)
820
+ );
821
+ return {
822
+ ...a,
823
+ attributeRelationship: c.attributeRelationship,
824
+ isMandatory: Number(a == null ? void 0 : a.minOccurs) > 0
825
+ };
826
+ });
827
+ }, Dn = (e = [], t, n) => {
828
+ const r = $(t == null ? void 0 : t.conceptIdentity) || "", s = Q(r, e);
829
+ return n ? M(s, n) : (s == null ? void 0 : s.name) ?? (s == null ? void 0 : s.id) ?? (t == null ? void 0 : t.id);
830
+ };
831
+ function ae(e) {
832
+ var t, n, r;
833
+ return (r = (n = (t = e == null ? void 0 : e.dataStructures) == null ? void 0 : t[0]) == null ? void 0 : n.dataStructureComponents) == null ? void 0 : r.dimensionList;
834
+ }
835
+ function Tn(e) {
836
+ var t, n, r, s;
837
+ return ((s = (r = (n = (t = e == null ? void 0 : e.data) == null ? void 0 : t.structures) == null ? void 0 : n[0]) == null ? void 0 : r.dimensions) == null ? void 0 : s.series) || [];
838
+ }
839
+ function vn(e) {
840
+ var t, n, r, s, o;
841
+ return ((o = (s = (r = (n = (t = e == null ? void 0 : e.data) == null ? void 0 : t.structures) == null ? void 0 : n[0]) == null ? void 0 : r.dimensions) == null ? void 0 : s.observation) == null ? void 0 : o[0].values.map((i) => i.value).filter((i) => i != null)) || [];
842
+ }
843
+ function pn(e) {
844
+ return e.find(
845
+ (t) => t.type === b.TIME_DIMENSION
846
+ );
847
+ }
848
+ const wn = (e) => {
849
+ var i, c, a, u, l, g;
850
+ const t = /* @__PURE__ */ new Map(), n = (i = e == null ? void 0 : e.dataStructures) == null ? void 0 : i[0], r = (c = e == null ? void 0 : e.metadataStructures) == null ? void 0 : c[0], s = (e == null ? void 0 : e.conceptSchemes) || [], o = (e == null ? void 0 : e.codelists) || [];
851
+ return e && [
852
+ ...((a = ae(e)) == null ? void 0 : a.dimensions) || [],
853
+ ...((u = ae(e)) == null ? void 0 : u.timeDimensions) || [],
854
+ ...jt(r, n),
855
+ ...((g = (l = n == null ? void 0 : n.dataStructureComponents) == null ? void 0 : l.attributeList) == null ? void 0 : g.attributes) || []
856
+ ].forEach(
857
+ (d) => {
858
+ var y, D;
859
+ const f = Q(
860
+ d == null ? void 0 : d.conceptIdentity,
861
+ s
862
+ ), E = ((y = d == null ? void 0 : d.localRepresentation) == null ? void 0 : y.enumeration) || ((D = f == null ? void 0 : f.coreRepresentation) == null ? void 0 : D.enumeration), A = G(
863
+ E,
864
+ o
865
+ );
866
+ d != null && d.id && (E ? t.set(d == null ? void 0 : d.id, {
867
+ ...A,
868
+ name: f == null ? void 0 : f.name,
869
+ names: f == null ? void 0 : f.names
870
+ }) : t.set(d == null ? void 0 : d.id, {
871
+ id: d == null ? void 0 : d.id,
872
+ name: f == null ? void 0 : f.name,
873
+ names: f == null ? void 0 : f.names
874
+ }));
875
+ }
876
+ ), t;
877
+ }, Sn = (e) => {
878
+ var t;
879
+ return ((t = e == null ? void 0 : e.find(
880
+ (n) => n.id === K.SERIES_COUNT
881
+ )) == null ? void 0 : t.title) || "";
882
+ }, Ft = "/api/download", $n = (e, t, n, r, s, o, i) => {
883
+ const c = new URLSearchParams({
884
+ urn: e,
885
+ format: t,
886
+ compress: "false",
887
+ filename: o,
888
+ filters: JSON.stringify(s),
889
+ attribute: r,
890
+ language: n,
891
+ isMetadata: i ? "true" : "none"
892
+ }).toString();
893
+ window.open(`${Ft}?${c}`, "_blank");
894
+ }, ue = (e) => isNaN(Date.parse(e)) ? null : new Date(e), Rn = (e, t) => {
895
+ var r, s;
896
+ const n = [];
897
+ for (const o of e) {
898
+ if (o.type !== b.DIMENSION)
899
+ continue;
900
+ const i = t.find((c) => c.componentCode === o.id);
901
+ i != null && ((r = i.values) == null ? void 0 : r.length) > 0 ? n.push((s = i.values) == null ? void 0 : s.join(de)) : n.push("*");
902
+ }
903
+ return n.join(".");
904
+ }, zt = (e, t) => {
905
+ if (!e || !e.startPeriod && !e.endPeriod)
906
+ return null;
907
+ const n = [], { startPeriod: r, endPeriod: s } = e;
908
+ if (r && n.push(
909
+ `${m.GREATER_OR_EQUAL}:${r.toISOString().split("T")[0]}`
910
+ ), s && n.push(
911
+ `${m.LESS_OR_EQUAL}:${s.toISOString().split("T")[0]}`
912
+ ), n.length === 0)
913
+ return null;
914
+ const o = n.join(de);
915
+ return `c${encodeURIComponent(`[${t}]`)}=${o}`;
916
+ }, Nn = (e, t) => {
917
+ const n = Ht(e, t) || null;
918
+ return n ? zt(n, t == null ? void 0 : t.id) : null;
919
+ }, Ht = (e, t) => {
920
+ var c, a;
921
+ const n = t.id, r = (c = e == null ? void 0 : e.filters) == null ? void 0 : c.find(
922
+ (u) => u.componentCode === n
923
+ );
924
+ if (!r || !r.values)
925
+ return null;
926
+ const s = (a = r.values) == null ? void 0 : a.filter((u) => !!u);
927
+ if (!s.length)
928
+ return null;
929
+ const o = ue(s[0]), i = ue(s[1]);
930
+ return { startPeriod: o, endPeriod: i };
931
+ };
932
+ export {
933
+ K as Annotations,
934
+ Be as AssignmentStatus,
935
+ Xt as AvailabilityApi,
936
+ be as DATASET_DATA_URL,
937
+ Zt as DatasetApi,
938
+ b as DimensionType,
939
+ Pe as DownloadType,
940
+ me as FileColumnsAttribute,
941
+ tn as GET_v3_FILTER_AND,
942
+ de as GET_v3_FILTER_OR,
943
+ ke as OBSERVATION_KEY,
944
+ Ce as OccurrenceType,
945
+ Nt as RepresentationTextType,
946
+ Rt as SDMX_DATA_QUERY_PARAMS,
947
+ P as SINGLE_WILDCARD_SYMBOL,
948
+ en as SdmxApiClient,
949
+ le as SdmxAvailabilityMode,
950
+ S as SdmxDataFormat,
951
+ O as SdmxDetails,
952
+ I as SdmxReferences,
953
+ m as SeriesFilterOperator,
954
+ Pt as TIME_PERIOD_END,
955
+ It as TIME_PERIOD_START,
956
+ et as dailyPattern,
957
+ Qe as decodeDimensionId,
958
+ En as findCodelistByDimension,
959
+ F as generateDatasetDataRequest,
960
+ Jt as generateShortUrn,
961
+ hn as getAnnotationPeriod,
962
+ G as getArtifactByUrnWithWildCard,
963
+ nn as getAttachedDimensionsSeriesByDimension,
964
+ Ve as getAttachedDimensionsSeriesByTsId,
965
+ fe as getAttachedDimensionsSeriesKey,
966
+ Ye as getAttributeValueFromDataQueryResponse,
967
+ yn as getAvailableCodes,
968
+ An as getAvailableCodesFromConstrains,
969
+ Re as getChildParsedUrn,
970
+ Q as getConcept,
971
+ ce as getConceptByUrn,
972
+ Gt as getConceptWithScheme,
973
+ jt as getConvertedMetaAttributes,
974
+ rt as getDailyRegExp,
975
+ Dn as getDimensionTitle,
976
+ ae as getDimensions,
977
+ mt as getFilteredItemsWithParents,
978
+ X as getISOWeek,
979
+ $ as getKeyFromUrn,
980
+ gn as getLastUpdatedTime,
981
+ sn as getLastWeekNumberOfYear,
982
+ M as getLocalizedName,
983
+ un as getMonthlyData,
984
+ ln as getMonthlyDataByQuarter,
985
+ q as getMonthlyRegExp,
986
+ he as getParsedEndPeriodDate,
987
+ rn as getParsedResponse,
988
+ ge as getParsedStartPeriodDate,
989
+ Z as getPeriodDate,
990
+ an as getQuarterByMonth,
991
+ x as getQuarterlyRegExp,
992
+ on as getQuartersData,
993
+ zt as getQueryTimePeriodFilters,
994
+ Ie as getRequestAcceptHeader,
995
+ Yt as getResolvedVersionBySingleWildcard,
996
+ cn as getSemiAnnualData,
997
+ nt as getSemiAnnuallyRegExp,
998
+ N as getSeriesAttributes,
999
+ Ke as getSeriesName,
1000
+ wn as getStructureComponentsMap,
1001
+ Tn as getStructureDimensions,
1002
+ pn as getTimeDimension,
1003
+ vn as getTimePeriods,
1004
+ Nn as getTimeQueryFilter,
1005
+ Ht as getTimeRangeFromAttachment,
1006
+ Sn as getTimeSeriesCount,
1007
+ Rn as getTimeSeriesFilterKey,
1008
+ Ge as getTimeSeriesId,
1009
+ ct as getWeekCode,
1010
+ ut as getWeeklyPeriodEndDate,
1011
+ at as getWeeklyPeriodStartDate,
1012
+ ot as getWeeklyRegExp,
1013
+ Kt as getWildCardRegexp,
1014
+ _ as getYearlyRegExp,
1015
+ dn as getYears,
1016
+ st as isDaily,
1017
+ W as isMonthly,
1018
+ B as isQuarterly,
1019
+ U as isSemiAnnually,
1020
+ C as isWeekly,
1021
+ Mt as isWildCardVersionCorrect,
1022
+ L as isYearly,
1023
+ tt as monthlyPattern,
1024
+ $n as openDownloadWindow,
1025
+ He as quarterPattern,
1026
+ Xe as semiAnnuallyPattern,
1027
+ fn as sortPeriods,
1028
+ p as splitUrn,
1029
+ Je as weeklyPattern,
1030
+ Ze as yearlyPattern
1031
+ };