@startinblox/components-ds4go 3.0.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/.storybook/preview.ts +1 -0
  2. package/biome.json +1 -1
  3. package/dist/custom-getter-ZPFnoSjt-BCNOlbJZ-B4tuxA42.js +338 -0
  4. package/dist/en-BySYJZMr-CWZl5AwU-CWZl5AwU.js +14 -0
  5. package/dist/fr-BZZDTsmw-CNDWt66j-CNDWt66j.js +14 -0
  6. package/dist/index-BSwVRtNS.js +104980 -0
  7. package/dist/index.js +1 -3032
  8. package/dist/quill.snow-C_A_QkE8-D-uedtvC-D-uedtvC.js +13 -0
  9. package/dist/slimselect-NFLzJMfV-DZ7j6Vsj-DZ7j6Vsj.js +5 -0
  10. package/package.json +9 -8
  11. package/src/components/cards/ds4go-card-catalog.ts +132 -0
  12. package/src/components/catalog/ds4go-catalog-filter-holder.ts +459 -0
  13. package/src/components/catalog/ds4go-customer-holder.ts +162 -0
  14. package/src/components/catalog/ds4go-fact-bundle-holder.ts +7 -7
  15. package/src/components/modal/ds4go-customer-modal.ts +134 -0
  16. package/src/components/modal/ds4go-fact-bundle-modal.ts +2 -2
  17. package/src/components/solid-customer-list.ts +195 -0
  18. package/src/components/solid-dsif-explorer-poc.ts +8 -8
  19. package/src/components/solid-dsp-connector.ts +12 -4
  20. package/src/components/solid-fact-bundle-creation.ts +266 -169
  21. package/src/components/solid-fact-bundle.ts +9 -4
  22. package/src/helpers/components/orbitComponent.ts +12 -13
  23. package/src/helpers/i18n/configureLocalization.ts +12 -5
  24. package/src/helpers/index.ts +0 -2
  25. package/src/styles/cards/ds4go-card-catalog.scss +149 -0
  26. package/src/styles/fact-bundle-creation.scss +6 -2
  27. package/src/styles/modal/ds4go-customer-modal.scss +91 -0
  28. package/src/styles/modal/ds4go-fact-bundle-modal.scss +1 -1
  29. package/vite.config.ts +7 -7
  30. package/src/components/solid-boilerplate.ts +0 -76
  31. package/src/helpers/components/ResourceMapper.ts +0 -469
  32. package/src/helpers/components/orbitDspComponent.ts +0 -250
  33. package/src/helpers/mappings/dsp-mapping-config.ts +0 -545
package/dist/index.js CHANGED
@@ -1,3032 +1 @@
1
- import { StoreType as me, StoreService as ge } from "https://cdn.jsdelivr.net/npm/@startinblox/core@beta/+esm";
2
- const nt = globalThis, xt = nt.ShadowRoot && (nt.ShadyCSS === void 0 || nt.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Pt = /* @__PURE__ */ Symbol(), Ot = /* @__PURE__ */ new WeakMap();
3
- let te = class {
4
- constructor(t, r, i) {
5
- if (this._$cssResult$ = !0, i !== Pt) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
6
- this.cssText = t, this.t = r;
7
- }
8
- get styleSheet() {
9
- let t = this.o;
10
- const r = this.t;
11
- if (xt && t === void 0) {
12
- const i = r !== void 0 && r.length === 1;
13
- i && (t = Ot.get(r)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && Ot.set(r, t));
14
- }
15
- return t;
16
- }
17
- toString() {
18
- return this.cssText;
19
- }
20
- };
21
- const Et = (e) => new te(typeof e == "string" ? e : e + "", void 0, Pt), tt = (e, ...t) => {
22
- const r = e.length === 1 ? e[0] : t.reduce((i, s, o) => i + ((n) => {
23
- if (n._$cssResult$ === !0) return n.cssText;
24
- if (typeof n == "number") return n;
25
- throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
26
- })(s) + e[o + 1], e[0]);
27
- return new te(r, e, Pt);
28
- }, ye = (e, t) => {
29
- if (xt) e.adoptedStyleSheets = t.map((r) => r instanceof CSSStyleSheet ? r : r.styleSheet);
30
- else for (const r of t) {
31
- const i = document.createElement("style"), s = nt.litNonce;
32
- s !== void 0 && i.setAttribute("nonce", s), i.textContent = r.cssText, e.appendChild(i);
33
- }
34
- }, Lt = xt ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
35
- let r = "";
36
- for (const i of t.cssRules) r += i.cssText;
37
- return Et(r);
38
- })(e) : e;
39
- const { is: ve, defineProperty: be, getOwnPropertyDescriptor: $e, getOwnPropertyNames: _e, getOwnPropertySymbols: we, getPrototypeOf: Ae } = Object, ht = globalThis, Tt = ht.trustedTypes, Ce = Tt ? Tt.emptyScript : "", Se = ht.reactiveElementPolyfillSupport, G = (e, t) => e, at = { toAttribute(e, t) {
40
- switch (t) {
41
- case Boolean:
42
- e = e ? Ce : null;
43
- break;
44
- case Object:
45
- case Array:
46
- e = e == null ? e : JSON.stringify(e);
47
- }
48
- return e;
49
- }, fromAttribute(e, t) {
50
- let r = e;
51
- switch (t) {
52
- case Boolean:
53
- r = e !== null;
54
- break;
55
- case Number:
56
- r = e === null ? null : Number(e);
57
- break;
58
- case Object:
59
- case Array:
60
- try {
61
- r = JSON.parse(e);
62
- } catch {
63
- r = null;
64
- }
65
- }
66
- return r;
67
- } }, pt = (e, t) => !ve(e, t), It = { attribute: !0, type: String, converter: at, reflect: !1, useDefault: !1, hasChanged: pt };
68
- Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), ht.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
69
- let B = class extends HTMLElement {
70
- static addInitializer(t) {
71
- this._$Ei(), (this.l ??= []).push(t);
72
- }
73
- static get observedAttributes() {
74
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
75
- }
76
- static createProperty(t, r = It) {
77
- if (r.state && (r.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((r = Object.create(r)).wrapped = !0), this.elementProperties.set(t, r), !r.noAccessor) {
78
- const i = /* @__PURE__ */ Symbol(), s = this.getPropertyDescriptor(t, i, r);
79
- s !== void 0 && be(this.prototype, t, s);
80
- }
81
- }
82
- static getPropertyDescriptor(t, r, i) {
83
- const { get: s, set: o } = $e(this.prototype, t) ?? { get() {
84
- return this[r];
85
- }, set(n) {
86
- this[r] = n;
87
- } };
88
- return { get: s, set(n) {
89
- const a = s?.call(this);
90
- o?.call(this, n), this.requestUpdate(t, a, i);
91
- }, configurable: !0, enumerable: !0 };
92
- }
93
- static getPropertyOptions(t) {
94
- return this.elementProperties.get(t) ?? It;
95
- }
96
- static _$Ei() {
97
- if (this.hasOwnProperty(G("elementProperties"))) return;
98
- const t = Ae(this);
99
- t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
100
- }
101
- static finalize() {
102
- if (this.hasOwnProperty(G("finalized"))) return;
103
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(G("properties"))) {
104
- const r = this.properties, i = [..._e(r), ...we(r)];
105
- for (const s of i) this.createProperty(s, r[s]);
106
- }
107
- const t = this[Symbol.metadata];
108
- if (t !== null) {
109
- const r = litPropertyMetadata.get(t);
110
- if (r !== void 0) for (const [i, s] of r) this.elementProperties.set(i, s);
111
- }
112
- this._$Eh = /* @__PURE__ */ new Map();
113
- for (const [r, i] of this.elementProperties) {
114
- const s = this._$Eu(r, i);
115
- s !== void 0 && this._$Eh.set(s, r);
116
- }
117
- this.elementStyles = this.finalizeStyles(this.styles);
118
- }
119
- static finalizeStyles(t) {
120
- const r = [];
121
- if (Array.isArray(t)) {
122
- const i = new Set(t.flat(1 / 0).reverse());
123
- for (const s of i) r.unshift(Lt(s));
124
- } else t !== void 0 && r.push(Lt(t));
125
- return r;
126
- }
127
- static _$Eu(t, r) {
128
- const i = r.attribute;
129
- return i === !1 ? void 0 : typeof i == "string" ? i : typeof t == "string" ? t.toLowerCase() : void 0;
130
- }
131
- constructor() {
132
- super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
133
- }
134
- _$Ev() {
135
- this._$ES = new Promise((t) => this.enableUpdating = t), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t) => t(this));
136
- }
137
- addController(t) {
138
- (this._$EO ??= /* @__PURE__ */ new Set()).add(t), this.renderRoot !== void 0 && this.isConnected && t.hostConnected?.();
139
- }
140
- removeController(t) {
141
- this._$EO?.delete(t);
142
- }
143
- _$E_() {
144
- const t = /* @__PURE__ */ new Map(), r = this.constructor.elementProperties;
145
- for (const i of r.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
146
- t.size > 0 && (this._$Ep = t);
147
- }
148
- createRenderRoot() {
149
- const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
150
- return ye(t, this.constructor.elementStyles), t;
151
- }
152
- connectedCallback() {
153
- this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((t) => t.hostConnected?.());
154
- }
155
- enableUpdating(t) {
156
- }
157
- disconnectedCallback() {
158
- this._$EO?.forEach((t) => t.hostDisconnected?.());
159
- }
160
- attributeChangedCallback(t, r, i) {
161
- this._$AK(t, i);
162
- }
163
- _$ET(t, r) {
164
- const i = this.constructor.elementProperties.get(t), s = this.constructor._$Eu(t, i);
165
- if (s !== void 0 && i.reflect === !0) {
166
- const o = (i.converter?.toAttribute !== void 0 ? i.converter : at).toAttribute(r, i.type);
167
- this._$Em = t, o == null ? this.removeAttribute(s) : this.setAttribute(s, o), this._$Em = null;
168
- }
169
- }
170
- _$AK(t, r) {
171
- const i = this.constructor, s = i._$Eh.get(t);
172
- if (s !== void 0 && this._$Em !== s) {
173
- const o = i.getPropertyOptions(s), n = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : at;
174
- this._$Em = s;
175
- const a = n.fromAttribute(r, o.type);
176
- this[s] = a ?? this._$Ej?.get(s) ?? a, this._$Em = null;
177
- }
178
- }
179
- requestUpdate(t, r, i, s = !1, o) {
180
- if (t !== void 0) {
181
- const n = this.constructor;
182
- if (s === !1 && (o = this[t]), i ??= n.getPropertyOptions(t), !((i.hasChanged ?? pt)(o, r) || i.useDefault && i.reflect && o === this._$Ej?.get(t) && !this.hasAttribute(n._$Eu(t, i)))) return;
183
- this.C(t, r, i);
184
- }
185
- this.isUpdatePending === !1 && (this._$ES = this._$EP());
186
- }
187
- C(t, r, { useDefault: i, reflect: s, wrapped: o }, n) {
188
- i && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, n ?? r ?? this[t]), o !== !0 || n !== void 0) || (this._$AL.has(t) || (this.hasUpdated || i || (r = void 0), this._$AL.set(t, r)), s === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t));
189
- }
190
- async _$EP() {
191
- this.isUpdatePending = !0;
192
- try {
193
- await this._$ES;
194
- } catch (r) {
195
- Promise.reject(r);
196
- }
197
- const t = this.scheduleUpdate();
198
- return t != null && await t, !this.isUpdatePending;
199
- }
200
- scheduleUpdate() {
201
- return this.performUpdate();
202
- }
203
- performUpdate() {
204
- if (!this.isUpdatePending) return;
205
- if (!this.hasUpdated) {
206
- if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
207
- for (const [s, o] of this._$Ep) this[s] = o;
208
- this._$Ep = void 0;
209
- }
210
- const i = this.constructor.elementProperties;
211
- if (i.size > 0) for (const [s, o] of i) {
212
- const { wrapped: n } = o, a = this[s];
213
- n !== !0 || this._$AL.has(s) || a === void 0 || this.C(s, void 0, o, a);
214
- }
215
- }
216
- let t = !1;
217
- const r = this._$AL;
218
- try {
219
- t = this.shouldUpdate(r), t ? (this.willUpdate(r), this._$EO?.forEach((i) => i.hostUpdate?.()), this.update(r)) : this._$EM();
220
- } catch (i) {
221
- throw t = !1, this._$EM(), i;
222
- }
223
- t && this._$AE(r);
224
- }
225
- willUpdate(t) {
226
- }
227
- _$AE(t) {
228
- this._$EO?.forEach((r) => r.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
229
- }
230
- _$EM() {
231
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
232
- }
233
- get updateComplete() {
234
- return this.getUpdateComplete();
235
- }
236
- getUpdateComplete() {
237
- return this._$ES;
238
- }
239
- shouldUpdate(t) {
240
- return !0;
241
- }
242
- update(t) {
243
- this._$Eq &&= this._$Eq.forEach((r) => this._$ET(r, this[r])), this._$EM();
244
- }
245
- updated(t) {
246
- }
247
- firstUpdated(t) {
248
- }
249
- };
250
- B.elementStyles = [], B.shadowRootOptions = { mode: "open" }, B[G("elementProperties")] = /* @__PURE__ */ new Map(), B[G("finalized")] = /* @__PURE__ */ new Map(), Se?.({ ReactiveElement: B }), (ht.reactiveElementVersions ??= []).push("2.1.2");
251
- const Rt = globalThis, Ft = (e) => e, ct = Rt.trustedTypes, Nt = ct ? ct.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, ee = "$lit$", E = `lit$${Math.random().toFixed(9).slice(2)}$`, re = "?" + E, xe = `<${re}>`, F = document, J = () => F.createComment(""), Z = (e) => e === null || typeof e != "object" && typeof e != "function", jt = Array.isArray, Pe = (e) => jt(e) || typeof e?.[Symbol.iterator] == "function", gt = `[
252
- \f\r]`, K = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Mt = /-->/g, Bt = />/g, k = RegExp(`>|${gt}(?:([^\\s"'>=/]+)(${gt}*=${gt}*(?:[^
253
- \f\r"'\`<>=]|("|')|))|$)`, "g"), qt = /'/g, Ht = /"/g, se = /^(?:script|style|textarea|title)$/i, Ee = (e) => (t, ...r) => ({ _$litType$: e, strings: t, values: r }), f = Ee(1), V = /* @__PURE__ */ Symbol.for("lit-noChange"), l = /* @__PURE__ */ Symbol.for("lit-nothing"), zt = /* @__PURE__ */ new WeakMap(), T = F.createTreeWalker(F, 129);
254
- function ie(e, t) {
255
- if (!jt(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
256
- return Nt !== void 0 ? Nt.createHTML(t) : t;
257
- }
258
- const Re = (e, t) => {
259
- const r = e.length - 1, i = [];
260
- let s, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = K;
261
- for (let a = 0; a < r; a++) {
262
- const c = e[a];
263
- let d, p, u = -1, g = 0;
264
- for (; g < c.length && (n.lastIndex = g, p = n.exec(c), p !== null); ) g = n.lastIndex, n === K ? p[1] === "!--" ? n = Mt : p[1] !== void 0 ? n = Bt : p[2] !== void 0 ? (se.test(p[2]) && (s = RegExp("</" + p[2], "g")), n = k) : p[3] !== void 0 && (n = k) : n === k ? p[0] === ">" ? (n = s ?? K, u = -1) : p[1] === void 0 ? u = -2 : (u = n.lastIndex - p[2].length, d = p[1], n = p[3] === void 0 ? k : p[3] === '"' ? Ht : qt) : n === Ht || n === qt ? n = k : n === Mt || n === Bt ? n = K : (n = k, s = void 0);
265
- const w = n === k && e[a + 1].startsWith("/>") ? " " : "";
266
- o += n === K ? c + xe : u >= 0 ? (i.push(d), c.slice(0, u) + ee + c.slice(u) + E + w) : c + E + (u === -2 ? a : w);
267
- }
268
- return [ie(e, o + (e[r] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
269
- };
270
- class X {
271
- constructor({ strings: t, _$litType$: r }, i) {
272
- let s;
273
- this.parts = [];
274
- let o = 0, n = 0;
275
- const a = t.length - 1, c = this.parts, [d, p] = Re(t, r);
276
- if (this.el = X.createElement(d, i), T.currentNode = this.el.content, r === 2 || r === 3) {
277
- const u = this.el.content.firstChild;
278
- u.replaceWith(...u.childNodes);
279
- }
280
- for (; (s = T.nextNode()) !== null && c.length < a; ) {
281
- if (s.nodeType === 1) {
282
- if (s.hasAttributes()) for (const u of s.getAttributeNames()) if (u.endsWith(ee)) {
283
- const g = p[n++], w = s.getAttribute(u).split(E), it = /([.?@])?(.*)/.exec(g);
284
- c.push({ type: 1, index: o, name: it[2], strings: w, ctor: it[1] === "." ? Ue : it[1] === "?" ? ke : it[1] === "@" ? De : ft }), s.removeAttribute(u);
285
- } else u.startsWith(E) && (c.push({ type: 6, index: o }), s.removeAttribute(u));
286
- if (se.test(s.tagName)) {
287
- const u = s.textContent.split(E), g = u.length - 1;
288
- if (g > 0) {
289
- s.textContent = ct ? ct.emptyScript : "";
290
- for (let w = 0; w < g; w++) s.append(u[w], J()), T.nextNode(), c.push({ type: 2, index: ++o });
291
- s.append(u[g], J());
292
- }
293
- }
294
- } else if (s.nodeType === 8) if (s.data === re) c.push({ type: 2, index: o });
295
- else {
296
- let u = -1;
297
- for (; (u = s.data.indexOf(E, u + 1)) !== -1; ) c.push({ type: 7, index: o }), u += E.length - 1;
298
- }
299
- o++;
300
- }
301
- }
302
- static createElement(t, r) {
303
- const i = F.createElement("template");
304
- return i.innerHTML = t, i;
305
- }
306
- }
307
- function W(e, t, r = e, i) {
308
- if (t === V) return t;
309
- let s = i !== void 0 ? r._$Co?.[i] : r._$Cl;
310
- const o = Z(t) ? void 0 : t._$litDirective$;
311
- return s?.constructor !== o && (s?._$AO?.(!1), o === void 0 ? s = void 0 : (s = new o(e), s._$AT(e, r, i)), i !== void 0 ? (r._$Co ??= [])[i] = s : r._$Cl = s), s !== void 0 && (t = W(e, s._$AS(e, t.values), s, i)), t;
312
- }
313
- class je {
314
- constructor(t, r) {
315
- this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = r;
316
- }
317
- get parentNode() {
318
- return this._$AM.parentNode;
319
- }
320
- get _$AU() {
321
- return this._$AM._$AU;
322
- }
323
- u(t) {
324
- const { el: { content: r }, parts: i } = this._$AD, s = (t?.creationScope ?? F).importNode(r, !0);
325
- T.currentNode = s;
326
- let o = T.nextNode(), n = 0, a = 0, c = i[0];
327
- for (; c !== void 0; ) {
328
- if (n === c.index) {
329
- let d;
330
- c.type === 2 ? d = new et(o, o.nextSibling, this, t) : c.type === 1 ? d = new c.ctor(o, c.name, c.strings, this, t) : c.type === 6 && (d = new Oe(o, this, t)), this._$AV.push(d), c = i[++a];
331
- }
332
- n !== c?.index && (o = T.nextNode(), n++);
333
- }
334
- return T.currentNode = F, s;
335
- }
336
- p(t) {
337
- let r = 0;
338
- for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, r), r += i.strings.length - 2) : i._$AI(t[r])), r++;
339
- }
340
- }
341
- class et {
342
- get _$AU() {
343
- return this._$AM?._$AU ?? this._$Cv;
344
- }
345
- constructor(t, r, i, s) {
346
- this.type = 2, this._$AH = l, this._$AN = void 0, this._$AA = t, this._$AB = r, this._$AM = i, this.options = s, this._$Cv = s?.isConnected ?? !0;
347
- }
348
- get parentNode() {
349
- let t = this._$AA.parentNode;
350
- const r = this._$AM;
351
- return r !== void 0 && t?.nodeType === 11 && (t = r.parentNode), t;
352
- }
353
- get startNode() {
354
- return this._$AA;
355
- }
356
- get endNode() {
357
- return this._$AB;
358
- }
359
- _$AI(t, r = this) {
360
- t = W(this, t, r), Z(t) ? t === l || t == null || t === "" ? (this._$AH !== l && this._$AR(), this._$AH = l) : t !== this._$AH && t !== V && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Pe(t) ? this.k(t) : this._(t);
361
- }
362
- O(t) {
363
- return this._$AA.parentNode.insertBefore(t, this._$AB);
364
- }
365
- T(t) {
366
- this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
367
- }
368
- _(t) {
369
- this._$AH !== l && Z(this._$AH) ? this._$AA.nextSibling.data = t : this.T(F.createTextNode(t)), this._$AH = t;
370
- }
371
- $(t) {
372
- const { values: r, _$litType$: i } = t, s = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = X.createElement(ie(i.h, i.h[0]), this.options)), i);
373
- if (this._$AH?._$AD === s) this._$AH.p(r);
374
- else {
375
- const o = new je(s, this), n = o.u(this.options);
376
- o.p(r), this.T(n), this._$AH = o;
377
- }
378
- }
379
- _$AC(t) {
380
- let r = zt.get(t.strings);
381
- return r === void 0 && zt.set(t.strings, r = new X(t)), r;
382
- }
383
- k(t) {
384
- jt(this._$AH) || (this._$AH = [], this._$AR());
385
- const r = this._$AH;
386
- let i, s = 0;
387
- for (const o of t) s === r.length ? r.push(i = new et(this.O(J()), this.O(J()), this, this.options)) : i = r[s], i._$AI(o), s++;
388
- s < r.length && (this._$AR(i && i._$AB.nextSibling, s), r.length = s);
389
- }
390
- _$AR(t = this._$AA.nextSibling, r) {
391
- for (this._$AP?.(!1, !0, r); t !== this._$AB; ) {
392
- const i = Ft(t).nextSibling;
393
- Ft(t).remove(), t = i;
394
- }
395
- }
396
- setConnected(t) {
397
- this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
398
- }
399
- }
400
- class ft {
401
- get tagName() {
402
- return this.element.tagName;
403
- }
404
- get _$AU() {
405
- return this._$AM._$AU;
406
- }
407
- constructor(t, r, i, s, o) {
408
- this.type = 1, this._$AH = l, this._$AN = void 0, this.element = t, this.name = r, this._$AM = s, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = l;
409
- }
410
- _$AI(t, r = this, i, s) {
411
- const o = this.strings;
412
- let n = !1;
413
- if (o === void 0) t = W(this, t, r, 0), n = !Z(t) || t !== this._$AH && t !== V, n && (this._$AH = t);
414
- else {
415
- const a = t;
416
- let c, d;
417
- for (t = o[0], c = 0; c < o.length - 1; c++) d = W(this, a[i + c], r, c), d === V && (d = this._$AH[c]), n ||= !Z(d) || d !== this._$AH[c], d === l ? t = l : t !== l && (t += (d ?? "") + o[c + 1]), this._$AH[c] = d;
418
- }
419
- n && !s && this.j(t);
420
- }
421
- j(t) {
422
- t === l ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
423
- }
424
- }
425
- class Ue extends ft {
426
- constructor() {
427
- super(...arguments), this.type = 3;
428
- }
429
- j(t) {
430
- this.element[this.name] = t === l ? void 0 : t;
431
- }
432
- }
433
- class ke extends ft {
434
- constructor() {
435
- super(...arguments), this.type = 4;
436
- }
437
- j(t) {
438
- this.element.toggleAttribute(this.name, !!t && t !== l);
439
- }
440
- }
441
- class De extends ft {
442
- constructor(t, r, i, s, o) {
443
- super(t, r, i, s, o), this.type = 5;
444
- }
445
- _$AI(t, r = this) {
446
- if ((t = W(this, t, r, 0) ?? l) === V) return;
447
- const i = this._$AH, s = t === l && i !== l || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, o = t !== l && (i === l || s);
448
- s && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
449
- }
450
- handleEvent(t) {
451
- typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
452
- }
453
- }
454
- class Oe {
455
- constructor(t, r, i) {
456
- this.element = t, this.type = 6, this._$AN = void 0, this._$AM = r, this.options = i;
457
- }
458
- get _$AU() {
459
- return this._$AM._$AU;
460
- }
461
- _$AI(t) {
462
- W(this, t);
463
- }
464
- }
465
- const Le = Rt.litHtmlPolyfillSupport;
466
- Le?.(X, et), (Rt.litHtmlVersions ??= []).push("3.3.2");
467
- const Te = (e, t, r) => {
468
- const i = r?.renderBefore ?? t;
469
- let s = i._$litPart$;
470
- if (s === void 0) {
471
- const o = r?.renderBefore ?? null;
472
- i._$litPart$ = s = new et(t.insertBefore(J(), o), o, void 0, r ?? {});
473
- }
474
- return s._$AI(e), s;
475
- };
476
- const Ut = globalThis;
477
- let z = class extends B {
478
- constructor() {
479
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
480
- }
481
- createRenderRoot() {
482
- const t = super.createRenderRoot();
483
- return this.renderOptions.renderBefore ??= t.firstChild, t;
484
- }
485
- update(t) {
486
- const r = this.render();
487
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Te(r, this.renderRoot, this.renderOptions);
488
- }
489
- connectedCallback() {
490
- super.connectedCallback(), this._$Do?.setConnected(!0);
491
- }
492
- disconnectedCallback() {
493
- super.disconnectedCallback(), this._$Do?.setConnected(!1);
494
- }
495
- render() {
496
- return V;
497
- }
498
- };
499
- z._$litElement$ = !0, z.finalized = !0, Ut.litElementHydrateSupport?.({ LitElement: z });
500
- const Ie = Ut.litElementPolyfillSupport;
501
- Ie?.({ LitElement: z });
502
- (Ut.litElementVersions ??= []).push("4.2.2");
503
- class Fe extends z {
504
- constructor() {
505
- super(...arguments), this.object = {
506
- "@id": ""
507
- }, this.isType = (t, r) => {
508
- const s = (r ?? this.object)["@type"];
509
- return Array.isArray(s) ? s.includes(t) : typeof s == "string" ? s === t : !1;
510
- };
511
- }
512
- }
513
- const M = (e) => (t, r) => {
514
- r !== void 0 ? r.addInitializer(() => {
515
- customElements.define(e, t);
516
- }) : customElements.define(e, t);
517
- };
518
- const Ne = { attribute: !0, type: String, converter: at, reflect: !1, hasChanged: pt }, Me = (e = Ne, t, r) => {
519
- const { kind: i, metadata: s } = r;
520
- let o = globalThis.litPropertyMetadata.get(s);
521
- if (o === void 0 && globalThis.litPropertyMetadata.set(s, o = /* @__PURE__ */ new Map()), i === "setter" && ((e = Object.create(e)).wrapped = !0), o.set(r.name, e), i === "accessor") {
522
- const { name: n } = r;
523
- return { set(a) {
524
- const c = t.get.call(this);
525
- t.set.call(this, a), this.requestUpdate(n, c, e, !0, a);
526
- }, init(a) {
527
- return a !== void 0 && this.C(n, void 0, e, a), a;
528
- } };
529
- }
530
- if (i === "setter") {
531
- const { name: n } = r;
532
- return function(a) {
533
- const c = this[n];
534
- t.call(this, a), this.requestUpdate(n, c, e, !0, a);
535
- };
536
- }
537
- throw Error("Unsupported decorator location: " + i);
538
- };
539
- function v(e) {
540
- return (t, r) => typeof r == "object" ? Me(e, t, r) : ((i, s, o) => {
541
- const n = s.hasOwnProperty(o);
542
- return s.constructor.createProperty(o, i), n ? Object.getOwnPropertyDescriptor(s, o) : void 0;
543
- })(e, t, r);
544
- }
545
- function m(e) {
546
- return v({ ...e, state: !0, attribute: !1 });
547
- }
548
- var Be = Object.defineProperty, qe = (e, t, r, i) => {
549
- for (var s = void 0, o = e.length - 1, n; o >= 0; o--)
550
- (n = e[o]) && (s = n(t, r, s) || s);
551
- return s && Be(t, r, s), s;
552
- };
553
- class kt extends z {
554
- constructor() {
555
- super(...arguments), this.objects = [], this.hasType = (t, r) => (r ?? this.objects ?? []).some((s) => {
556
- const o = s["@type"];
557
- return Array.isArray(o) ? o.includes(t) : typeof o == "string" ? o === t : !1;
558
- });
559
- }
560
- }
561
- qe([
562
- v({ attribute: !1 })
563
- ], kt.prototype, "objects");
564
- var He = Object.defineProperty, x = (e, t, r, i) => {
565
- for (var s = void 0, o = e.length - 1, n; o >= 0; o--)
566
- (n = e[o]) && (s = n(t, r, s) || s);
567
- return s && He(t, r, s), s;
568
- };
569
- class $ extends kt {
570
- constructor({
571
- defaultRoute: t = !1,
572
- setupSubscriptions: r = !0,
573
- ignoreRouter: i = !1
574
- } = {}) {
575
- super(), this.ready = !1, this.cherryPickedProperties = [], this.currentRoute = "";
576
- const s = () => {
577
- document.readyState === "complete" && this._attach(t, r, i).then(
578
- (o) => {
579
- o && this.requestUpdate();
580
- }
581
- );
582
- };
583
- document.readyState === "complete" ? s() : document.addEventListener("readystatechange", s);
584
- }
585
- async _attach(t, r, i) {
586
- if (!this.orbit && window.orbit && (this.orbit = window.orbit, r)) {
587
- if (ne({
588
- component: this,
589
- defaultRoute: t,
590
- ignoreRouter: i
591
- }), this.route && (this.component = this.orbit.getComponentFromRoute(this.route), this.component))
592
- for (const s of this.orbit.components)
593
- s.uniq === this.component.uniq && (s.instance = this);
594
- return await this._afterAttach(), this.ready = !0, this.dispatchEvent(
595
- new CustomEvent("component-ready", {
596
- detail: {
597
- component: this.component
598
- }
599
- })
600
- ), Promise.resolve(!0);
601
- }
602
- return Promise.resolve(!1);
603
- }
604
- async _afterAttach() {
605
- return Promise.resolve();
606
- }
607
- _navigate(t) {
608
- window.sibRouter.previousRoute = this.currentRoute, window.sibRouter.previousResource = window.sibRouter.currentResource;
609
- const r = t.target?.closest("[navigation-target]");
610
- let i = r.getAttribute("navigation-target");
611
- const s = r.getAttribute("navigation-subrouter"), o = r.getAttribute("navigation-resource"), n = r.getAttribute("navigation-rdf-type");
612
- if (n) {
613
- const a = window.orbit?.components?.filter(
614
- (c) => c?.routeAttributes?.["rdf-type"] === n
615
- );
616
- a && (i = a[0]?.uniq);
617
- }
618
- i && L(
619
- (window.orbit ? window.orbit.getRoute(i, !0) : i) + (s ? `-${s}` : ""),
620
- o
621
- ), t.preventDefault();
622
- }
623
- _normalizeLdpContains(t) {
624
- return t === null ? [] : Array.isArray(t) ? t : [t];
625
- }
626
- async _expandContainer(t, r = !0, i = this.cherryPickedProperties) {
627
- const s = [];
628
- return await Promise.all(
629
- t.map(async (o) => {
630
- const n = await this._getProxyValue(
631
- await o,
632
- r,
633
- i
634
- );
635
- n && s.push(n);
636
- })
637
- ), s;
638
- }
639
- async _getProperties(t, r = !0, i = this.cherryPickedProperties) {
640
- const s = await t.properties, o = {
641
- "@id": t["@id"],
642
- "@type": t["@type"],
643
- "@context": t.serverContext,
644
- _originalResource: t
645
- }, n = i.map(async (c) => {
646
- if (!s?.includes(c.key)) return;
647
- let d = await t.get(c.key);
648
- return c.expand && (d = await this._getProxyValue(d, r, i)), c.cast && (d = await c.cast(d)), { prop: c, value: d };
649
- }), a = (await Promise.all(n)).filter(
650
- (c) => c !== void 0
651
- );
652
- for (const { prop: c, value: d } of a)
653
- d !== void 0 && (o[c.value] = d);
654
- return await this._responseAdaptator(o);
655
- }
656
- async _hasCherryPickedProperties(t) {
657
- const r = await t.properties;
658
- for (const i of this.cherryPickedProperties)
659
- if (r?.includes(i.key))
660
- return !0;
661
- return !1;
662
- }
663
- async _getProxyValue(t, r = !0, i = this.cherryPickedProperties) {
664
- try {
665
- if (!t) return;
666
- let s = t;
667
- if (typeof t == "string" ? s = await window.sibStore.getData(t, Gt) : t.isFullResource && !t.isFullResource?.() && (s = await window.sibStore.getData(t["@id"], Gt)), !s) return { _originalResource: s };
668
- if (typeof s != "object" || s === null) return;
669
- if (s.isContainer?.() && s["ldp:contains"]) {
670
- if (await this._hasCherryPickedProperties(s))
671
- return await this._getProperties(s, r, i);
672
- const o = this._normalizeLdpContains(await s["ldp:contains"]);
673
- return await this._expandContainer(o, r, i);
674
- }
675
- return await this._getProperties(s, r, i);
676
- } catch {
677
- }
678
- }
679
- async _responseAdaptator(t) {
680
- return Promise.resolve(t);
681
- }
682
- gatekeeper() {
683
- if (!this.orbit || !this.noRouter && this.route && this.currentRoute && !this.route.startsWith(this.currentRoute) || !this.dataSrc)
684
- return l;
685
- }
686
- }
687
- x([
688
- m()
689
- ], $.prototype, "ready");
690
- x([
691
- v({ attribute: "default-data-src", reflect: !0 })
692
- ], $.prototype, "defaultDataSrc");
693
- x([
694
- v({ attribute: "data-src", reflect: !0 })
695
- ], $.prototype, "dataSrc");
696
- x([
697
- v({ attribute: "nested-field" })
698
- ], $.prototype, "nestedField");
699
- x([
700
- v({ attribute: "uniq" })
701
- ], $.prototype, "uniq");
702
- x([
703
- v({ attribute: "route" })
704
- ], $.prototype, "route");
705
- x([
706
- v({ attribute: !1 })
707
- ], $.prototype, "cherryPickedProperties");
708
- x([
709
- m()
710
- ], $.prototype, "orbit");
711
- x([
712
- m()
713
- ], $.prototype, "currentRoute");
714
- function H(e) {
715
- return e ? e.replace(/^urn:uuid:/i, "").replace(/^urn:tems:/i, "") : "";
716
- }
717
- function ze(e, t, r) {
718
- if (!e) return null;
719
- const i = JSON.parse(JSON.stringify(e));
720
- i["@id"] && (i["@id"] = H(i["@id"]));
721
- const s = q(t, ["@id"]) || "";
722
- return i.target = H(s), i;
723
- }
724
- function q(e, t) {
725
- if (t.length === 0)
726
- return;
727
- let r = e;
728
- for (const i of t) {
729
- if (r == null)
730
- return;
731
- r = r[i];
732
- }
733
- return r;
734
- }
735
- class Ve {
736
- constructor(t) {
737
- this.config = t;
738
- }
739
- /**
740
- * Maps source data to TEMS-compatible resource
741
- */
742
- map(t, r = {}) {
743
- const i = {};
744
- for (const [s, o] of Object.entries(this.config.baseFields)) {
745
- const n = this.mapField(t, o, r);
746
- n !== void 0 && (i[s] = n);
747
- }
748
- if (this.config.containerFields)
749
- for (const [s, o] of Object.entries(
750
- this.config.containerFields
751
- )) {
752
- const n = this.mapContainerField(t, o, r);
753
- n && (i[s] = n);
754
- }
755
- if (this.config.nestedObjects)
756
- for (const [s, o] of Object.entries(
757
- this.config.nestedObjects
758
- )) {
759
- const n = this.mapNestedObject(t, o, r);
760
- n && (i[s] = n);
761
- }
762
- if (this.config.contractFields)
763
- for (const [s, o] of Object.entries(
764
- this.config.contractFields
765
- )) {
766
- const n = this.mapField(t, o, r);
767
- n !== void 0 && (i[s] = n);
768
- }
769
- return this.config.postProcess ? this.config.postProcess(i, t, r) : i;
770
- }
771
- /**
772
- * Maps a single field
773
- */
774
- mapField(t, r, i) {
775
- let s = q(t, r.source);
776
- return r.transform && (s = r.transform(s, t, i)), (s == null || s === "") && r.fallback && (typeof r.fallback == "function" ? s = r.fallback(t, i) : s = q(t, [r.fallback])), (s == null || s === "") && (s = r.defaultValue), s;
777
- }
778
- /**
779
- * Maps a container field (array wrapped in LDP container)
780
- */
781
- mapContainerField(t, r, i) {
782
- let s = q(t, r.source);
783
- if (!s)
784
- return null;
785
- r.transform && (s = r.transform(s, t, i)), Array.isArray(s) || (s = [s]), r.filter && (s = s.filter(
786
- (n, a) => r.filter(n, a, i)
787
- ));
788
- const o = s.map((n, a) => {
789
- const c = {
790
- "@type": r.itemType
791
- };
792
- for (const [d, p] of Object.entries(r.itemFields)) {
793
- const u = p(n, a, i);
794
- u !== void 0 && (c[d] = u);
795
- }
796
- return c;
797
- });
798
- return {
799
- "@type": r.containerType,
800
- "ldp:contains": o
801
- };
802
- }
803
- /**
804
- * Maps a nested object
805
- */
806
- mapNestedObject(t, r, i) {
807
- const s = q(t, r.source);
808
- if (!s)
809
- return null;
810
- const o = {};
811
- r.type && (o["@type"] = r.type);
812
- for (const [n, a] of Object.entries(r.fields)) {
813
- let c;
814
- Array.isArray(a) ? c = q(s, a) : c = this.mapField(s, a, i), c !== void 0 && (o[n] = c);
815
- }
816
- return Object.keys(o).length > (r.type ? 1 : 0) ? o : null;
817
- }
818
- /**
819
- * Unwraps LDP containers (converts ldp:contains arrays to plain arrays)
820
- *
821
- * This is typically called by components after mapping to simplify data structure
822
- * for rendering.
823
- */
824
- static unwrapLdpContainers(t) {
825
- const r = { ...t };
826
- for (const [i, s] of Object.entries(r))
827
- s && typeof s == "object" && s["@type"] === "ldp:Container" && s["ldp:contains"] && (r[i] = s["ldp:contains"]);
828
- return r;
829
- }
830
- }
831
- function y(e) {
832
- return e["dcat:distribution"]?.[0] || e.properties || e;
833
- }
834
- function Vt(e) {
835
- const t = y(e);
836
- return e["dcat:endpointUrl"] || e["dcat:endpointURL"] || e["http://www.w3.org/ns/dcat#endpointUrl"] || e.endpointUrl || e.endpointURL || // Then check distribution/props level
837
- t["http://www.w3.org/ns/dcat#endpointUrl"] || t["dcat:endpointUrl"] || t["dcat:endpointURL"] || t["dcat:accessService"]?.["dcat:endpointURL"] || t.endpointURL || t.endpointUrl || "";
838
- }
839
- function We(e) {
840
- const t = y(e);
841
- return e.contenttype || e.contentType || e["http://www.w3.org/ns/dcat#mediaType"] || e["dcat:mediaType"] || // Then check distribution/props level
842
- t.contenttype || t.contentType || t["http://www.w3.org/ns/dcat#mediaType"] || t["dcat:mediaType"] || "";
843
- }
844
- const Ke = {
845
- baseFields: {
846
- "@id": {
847
- source: ["@id"],
848
- transform: (e, t, r) => {
849
- const s = H(e || t.id || "") || e?.split("/").pop() || "unknown", o = r.providerParticipantId ? `${encodeURIComponent(r.providerParticipantId)}/` : "";
850
- return `${r.temsServiceBase || "https://api.tems.example.com/services/"}${o}${encodeURIComponent(s)}/`;
851
- }
852
- },
853
- "@type": {
854
- source: [],
855
- defaultValue: "tems:Service"
856
- },
857
- name: {
858
- source: [],
859
- transform: (e, t) => {
860
- const r = y(t);
861
- return (
862
- // Source-level fields (EDC catalog returns these at top level)
863
- t.name || t.title || t["dct:title"] || t["dcterms:title"] || // EDC namespace fields at source level
864
- t["https://w3id.org/edc/v0.0.1/ns/name"] || t["edc:name"] || // Distribution/props level
865
- r["dct:title"] || r["dcterms:title"] || r.title || r["https://w3id.org/edc/v0.0.1/ns/name"] || r["edc:name"] || r.name || // Fall back to ID but extract meaningful part
866
- (t["@id"]?.startsWith("urn:uuid:") ? t["@id"] : t["@id"]?.split("/").pop() || t["@id"]) || t.id || ""
867
- );
868
- }
869
- },
870
- description: {
871
- source: [],
872
- transform: (e, t) => {
873
- const r = y(t);
874
- return (
875
- // Source-level fields (EDC catalog returns these at top level)
876
- t.description || t["dct:description"] || t["dcterms:description"] || t["https://w3id.org/edc/v0.0.1/ns/description"] || t["edc:description"] || // Distribution/props level
877
- r["dct:description"] || r["dcterms:description"] || r.description || r["https://w3id.org/edc/v0.0.1/ns/description"] || r["edc:description"] || ""
878
- );
879
- }
880
- },
881
- long_description: {
882
- source: [],
883
- transform: (e, t) => {
884
- const r = y(t), i = Array.isArray(r["dcat:keyword"]) ? r["dcat:keyword"] : r["dcat:keyword"] ? [r["dcat:keyword"]] : [], s = r["dct:description"] || r["dcterms:description"] || r.description || "";
885
- return i.length > 0 ? `Keywords: ${i.join(", ")}` : s;
886
- }
887
- },
888
- url: {
889
- source: [],
890
- transform: (e, t) => Vt(t)
891
- },
892
- endpointUrl: {
893
- source: [],
894
- transform: (e, t) => Vt(t)
895
- },
896
- contentType: {
897
- source: [],
898
- transform: (e, t) => We(t)
899
- },
900
- activation_status: {
901
- source: [],
902
- transform: (e, t) => {
903
- const r = y(t);
904
- return (r["dcat:endpointURL"] || r["dcat:accessService"]?.["dcat:endpointURL"] || r.endpointURL || "").trim().length > 0;
905
- }
906
- },
907
- is_in_app: {
908
- source: [],
909
- transform: (e, t) => {
910
- const r = y(t);
911
- return (r["dcat:endpointURL"] || r["dcat:accessService"]?.["dcat:endpointURL"] || r.endpointURL || "").trim().length > 0;
912
- }
913
- },
914
- is_external: {
915
- source: [],
916
- transform: (e, t) => {
917
- const r = y(t);
918
- return (r["dcat:endpointURL"] || r["dcat:accessService"]?.["dcat:endpointURL"] || r.endpointURL || "").trim().length > 0;
919
- }
920
- },
921
- is_api: {
922
- source: [],
923
- transform: (e, t) => {
924
- const r = y(t);
925
- return (r["dcat:endpointURL"] || r["dcat:accessService"]?.["dcat:endpointURL"] || r.endpointURL || "").trim().length > 0;
926
- }
927
- },
928
- contact_url: {
929
- source: [],
930
- transform: (e, t) => {
931
- const r = y(t);
932
- return r["dcat:endpointDescription"] || r["dct:conformsTo"] || "";
933
- }
934
- },
935
- documentation_url: {
936
- source: [],
937
- transform: (e, t) => {
938
- const r = y(t);
939
- return r["dcat:endpointDescription"] || r["dct:conformsTo"] || "";
940
- }
941
- },
942
- creation_date: {
943
- source: [],
944
- transform: (e, t) => {
945
- const r = y(t);
946
- return r["dct:issued"] || r["dcterms:issued"] || (/* @__PURE__ */ new Date()).toISOString();
947
- }
948
- },
949
- update_date: {
950
- source: [],
951
- transform: (e, t) => {
952
- const r = y(t), i = r["dct:issued"] || r["dcterms:issued"] || (/* @__PURE__ */ new Date()).toISOString();
953
- return r["dct:modified"] || r["dcterms:modified"] || i;
954
- }
955
- },
956
- release_date: {
957
- source: [],
958
- transform: (e, t) => {
959
- const r = y(t);
960
- return r["dct:issued"] || r["dcterms:issued"] || (/* @__PURE__ */ new Date()).toISOString();
961
- }
962
- },
963
- last_update: {
964
- source: [],
965
- transform: (e, t) => {
966
- const r = y(t), i = r["dct:issued"] || r["dcterms:issued"] || (/* @__PURE__ */ new Date()).toISOString();
967
- return r["dct:modified"] || r["dcterms:modified"] || i;
968
- }
969
- },
970
- activation_date: {
971
- source: [],
972
- defaultValue: null
973
- },
974
- licence: {
975
- source: [],
976
- defaultValue: null
977
- },
978
- developper: {
979
- source: [],
980
- defaultValue: null
981
- },
982
- data_offers: {
983
- source: [],
984
- defaultValue: []
985
- }
986
- },
987
- containerFields: {
988
- categories: {
989
- source: [],
990
- containerType: "ldp:Container",
991
- itemType: "tems:Category",
992
- transform: (e, t) => {
993
- const i = y(t)["dcat:keyword"];
994
- return i ? Array.isArray(i) ? i : [i] : [];
995
- },
996
- itemFields: {
997
- "@id": (e, t, r) => `${r.temsCategoryBase || "https://api.tems.example.com/categories/"}${encodeURIComponent(e)}/`,
998
- name: (e) => e
999
- }
1000
- },
1001
- images: {
1002
- source: [],
1003
- containerType: "ldp:Container",
1004
- itemType: "tems:Image",
1005
- transform: (e, t) => {
1006
- const r = y(t), i = [];
1007
- return r["foaf:thumbnail"]?.["rdf:resource"] && i.push(r["foaf:thumbnail"]["rdf:resource"]), r["dcterms:creator"]?.["foaf:thumbnail"]?.["rdf:resource"] && i.push(
1008
- r["dcterms:creator"]["foaf:thumbnail"]["rdf:resource"]
1009
- ), i;
1010
- },
1011
- itemFields: {
1012
- "@id": (e, t, r) => {
1013
- const i = e.split("/").pop() || `image-${t}`;
1014
- return `${r.temsImageBase || "https://api.tems.example.com/images/"}${encodeURIComponent(i)}/`;
1015
- },
1016
- url: (e) => e,
1017
- iframe: () => !1,
1018
- name: (e) => e.split("/").pop() || "image"
1019
- }
1020
- }
1021
- },
1022
- nestedObjects: {
1023
- provider: {
1024
- source: [],
1025
- type: "tems:Provider",
1026
- fields: {
1027
- "@id": {
1028
- source: [],
1029
- transform: (e, t, r) => {
1030
- const i = r.providerParticipantId || r.providerName || "unknown";
1031
- return `${r.temsProviderBase || "https://api.tems.example.com/providers/"}${encodeURIComponent(i)}/`;
1032
- }
1033
- },
1034
- name: {
1035
- source: [],
1036
- transform: (e, t, r) => y(t)["dcterms:creator"]?.["foaf:name"] || r.providerName || ""
1037
- },
1038
- image: {
1039
- source: [],
1040
- transform: (e, t, r) => {
1041
- const s = y(t)["dcterms:creator"]?.["foaf:thumbnail"]?.["rdf:resource"];
1042
- if (!s) return;
1043
- const o = s.split("/").pop() || "provider-logo";
1044
- return {
1045
- // FIXME: Avoid magic strings
1046
- "@id": `${r.temsImageBase || "https://api.tems.example.com/images/"}${encodeURIComponent(o)}/`,
1047
- "@type": "tems:Image",
1048
- iframe: !1,
1049
- url: s,
1050
- name: o
1051
- };
1052
- }
1053
- }
1054
- }
1055
- }
1056
- },
1057
- contractFields: {
1058
- counterPartyAddress: {
1059
- source: [],
1060
- transform: (e, t, r) => r.providerAddress
1061
- },
1062
- counterPartyId: {
1063
- source: [],
1064
- transform: (e, t, r) => r.providerParticipantId || r.providerName
1065
- },
1066
- assetId: {
1067
- source: ["@id"],
1068
- transform: (e, t) => H(e || t.id || "")
1069
- },
1070
- datasetId: {
1071
- source: ["@id"],
1072
- transform: (e, t) => H(e || t.id || "")
1073
- },
1074
- // Index endpoint URL for index assets - try multiple property variations
1075
- // Priority: source-level dcat:endpointUrl (index endpoint) over props-level dcat:endpointURL (protocol URL)
1076
- indexEndpointUrl: {
1077
- source: [],
1078
- transform: (e, t, r) => {
1079
- const i = y(t);
1080
- console.log("[DSP Mapping] indexEndpointUrl extraction for:", {
1081
- assetId: t["@id"] || t.id,
1082
- assetName: t.name || i.name || i["dct:title"],
1083
- provider: r.providerName,
1084
- providerParticipantId: r.providerParticipantId,
1085
- "source.dcat:endpointUrl": t["dcat:endpointUrl"],
1086
- "props.dcat:endpointUrl": i["dcat:endpointUrl"],
1087
- "source.dcat:endpointURL": t["dcat:endpointURL"],
1088
- "props.dcat:accessService": i["dcat:accessService"]
1089
- });
1090
- const s = t["dcat:endpointUrl"] || i["dcat:endpointUrl"] || t["dcat:endpointURL"] || i["dcat:accessService"]?.["dcat:endpointUrl"] || i["dcat:accessService"]?.["dcat:endpointURL"] || i.endpointUrl || i.endpointURL || void 0;
1091
- return console.log("[DSP Mapping] indexEndpointUrl result:", s), s;
1092
- }
1093
- },
1094
- policy: {
1095
- source: ["odrl:hasPolicy"],
1096
- fallback: (e) => e.hasPolicy,
1097
- transform: (e, t, r) => {
1098
- if (!e) return;
1099
- const i = ze(e, t);
1100
- if (i) {
1101
- const s = (o) => Array.isArray(o) ? o.map((n) => (n["@id"] && (n["@id"] = H(n["@id"])), n)) : o;
1102
- i["odrl:permission"] && (i["odrl:permission"] = s(
1103
- i["odrl:permission"]
1104
- )), i["odrl:prohibition"] && (i["odrl:prohibition"] = s(
1105
- i["odrl:prohibition"]
1106
- )), i["odrl:obligation"] && (i["odrl:obligation"] = s(
1107
- i["odrl:obligation"]
1108
- ));
1109
- }
1110
- return i;
1111
- }
1112
- }
1113
- },
1114
- // Post-processing to add provider metadata fields
1115
- postProcess: (e, t, r) => ({
1116
- ...e,
1117
- _provider: r.providerName,
1118
- _providerAddress: r.providerAddress,
1119
- _providerColor: r.providerColor || "#1976d2",
1120
- _providerParticipantId: r.providerParticipantId
1121
- })
1122
- };
1123
- var Ge = Object.defineProperty, j = (e, t, r, i) => {
1124
- for (var s = void 0, o = e.length - 1, n; o >= 0; o--)
1125
- (n = e[o]) && (s = n(t, r, s) || s);
1126
- return s && Ge(t, r, s), s;
1127
- };
1128
- class P extends $ {
1129
- constructor() {
1130
- super(...arguments), this.providers = [];
1131
- }
1132
- willUpdate(t) {
1133
- (!this.providers || this.providers.length === 0) && this.component?.parameters?.providers && (this.providers = this.component.parameters.providers || []);
1134
- }
1135
- async _attach(t, r, i) {
1136
- if (!this.orbit && window.orbit && (this.orbit = window.orbit, r)) {
1137
- if (ne({
1138
- component: this,
1139
- defaultRoute: t,
1140
- ignoreRouter: i
1141
- }), this.route && (this.component = this.orbit.getComponentFromRoute(this.route), this.component))
1142
- for (const o of this.orbit.components)
1143
- o.uniq === this.component.uniq && (o.instance = this);
1144
- if (!this.participantConnectorUri) {
1145
- const o = this.component?.parameters;
1146
- o?.["participant-connector-uri"] && (this.participantConnectorUri = o["participant-connector-uri"]), o?.["participant-api-key"] && (this.participantApiKey = o["participant-api-key"]), o?.providers && (this.providers = o.providers), o?.["participant-id"] && (this.participantId = o["participant-id"]);
1147
- }
1148
- const s = this.component?.parameters;
1149
- if (s?.["api-gateway-config"]) {
1150
- this.apiGatewayConfig = s["api-gateway-config"];
1151
- try {
1152
- this._apiGatewayConfigParsed = typeof this.apiGatewayConfig == "string" ? JSON.parse(this.apiGatewayConfig) : this.apiGatewayConfig;
1153
- } catch {
1154
- this._apiGatewayConfigParsed = null;
1155
- }
1156
- }
1157
- if (!this.storeService && this.participantConnectorUri)
1158
- try {
1159
- const o = `dsp-connector-${this.component.uniq}`, n = {
1160
- type: me.DataspaceConnector,
1161
- endpoint: this.participantConnectorUri,
1162
- catalogEndpoint: `${this.participantConnectorUri}/management/v3/catalog/request`,
1163
- contractNegotiationEndpoint: `${this.participantConnectorUri}/management/v3/contractnegotiations`,
1164
- transferProcessEndpoint: `${this.participantConnectorUri}/management/v3/transferprocesses`,
1165
- edrsEndpoint: `${this.participantConnectorUri}/management/v3/edrs`,
1166
- authMethod: "dsp-api-key",
1167
- dspApiKey: this.participantApiKey || "password",
1168
- participantId: this.participantId || "stbx-consumer",
1169
- retryAttempts: 10,
1170
- timeout: 3e4,
1171
- // Include API Gateway configuration ONLY if available
1172
- ...this._apiGatewayConfigParsed && {
1173
- apiGatewayConfig: this._apiGatewayConfigParsed
1174
- }
1175
- };
1176
- this.storeService = ge.addStore(o, n), this.dspStoreService = this.storeService, window.dspStore || (window.dspStore = this.storeService);
1177
- } catch (o) {
1178
- console.error("DSP Store initialization error:", o);
1179
- }
1180
- return await this._afterAttach(), this.ready = !0, this.dispatchEvent(
1181
- new CustomEvent("component-ready", {
1182
- detail: {
1183
- component: this.component
1184
- }
1185
- })
1186
- ), Promise.resolve(!0);
1187
- }
1188
- return Promise.resolve(!1);
1189
- }
1190
- /**
1191
- * Fetch catalog from multiple DSP providers
1192
- */
1193
- async fetchFederatedCatalog() {
1194
- if (!this.storeService || !this.providers || this.providers.length === 0)
1195
- return console.warn("DSP store or providers not configured"), [];
1196
- try {
1197
- const t = "https://api.tems.example.com/services/", r = new Ve(Ke), i = this.providers.map(async (n) => {
1198
- try {
1199
- const a = await this.storeService.getCatalog(n.address);
1200
- if (a?.["dcat:dataset"]) {
1201
- const c = a["dcat:dataset"], d = Array.isArray(c) ? c : [c], p = a.participantId || a["edc:participantId"] || a["https://w3id.org/edc/v0.0.1/ns/participantId"], u = n.participantId || p;
1202
- return d.map((g) => {
1203
- const w = {
1204
- temsServiceBase: t,
1205
- temsCategoryBase: t.replace(
1206
- "/services/",
1207
- "/providers/categories/"
1208
- ),
1209
- temsImageBase: t.replace(
1210
- "/services/",
1211
- "/objects/images/"
1212
- ),
1213
- temsProviderBase: t.replace("/services/", "/providers/"),
1214
- // Provider context for mapping - use config's participantId as authoritative
1215
- providerName: n.name,
1216
- providerAddress: n.address,
1217
- providerColor: n.color,
1218
- providerParticipantId: u
1219
- };
1220
- return r.map(g, w);
1221
- });
1222
- }
1223
- return [];
1224
- } catch {
1225
- return [];
1226
- }
1227
- });
1228
- return (await Promise.all(i)).flat();
1229
- } catch {
1230
- return [];
1231
- }
1232
- }
1233
- /**
1234
- * Get current DataspaceConnectorStore instance
1235
- */
1236
- getStoreService() {
1237
- return this.storeService;
1238
- }
1239
- }
1240
- j([
1241
- v({ attribute: "participant-connector-uri", reflect: !0 })
1242
- ], P.prototype, "participantConnectorUri");
1243
- j([
1244
- v({ attribute: "participant-id", reflect: !0 })
1245
- ], P.prototype, "participantId");
1246
- j([
1247
- v({ attribute: "participant-api-key", reflect: !0 })
1248
- ], P.prototype, "participantApiKey");
1249
- j([
1250
- v({ attribute: "api-gateway-config", reflect: !0 })
1251
- ], P.prototype, "apiGatewayConfig");
1252
- j([
1253
- m()
1254
- ], P.prototype, "storeService");
1255
- j([
1256
- m()
1257
- ], P.prototype, "dspStoreService");
1258
- j([
1259
- m()
1260
- ], P.prototype, "_apiGatewayConfigParsed");
1261
- j([
1262
- v({ type: Array })
1263
- ], P.prototype, "providers");
1264
- const oe = (e, { keywords: t = [], attributes: r = ["dataSrc"] } = {}) => {
1265
- const i = () => {
1266
- if (!t.length || !r.length) return;
1267
- e.caching === void 0 && (e.caching = 0), e.hasCachedDatas === void 0 && (e.hasCachedDatas = !1);
1268
- let s = !1;
1269
- const o = new Set(t);
1270
- e.cacheListener = (n) => {
1271
- const a = n.detail.id || n.detail.resource?.["@id"];
1272
- if (!a || !Array.from(o).some((p) => {
1273
- const u = a.indexOf(p);
1274
- return u !== -1 && (u === 0 || a[u - 1] === "/");
1275
- })) return;
1276
- let d = !1;
1277
- for (const p of r)
1278
- e[p] && a !== e[p] && (window.sibStore.clearCache(e[p]), d = !0);
1279
- d && (e.caching++, e.hasCachedDatas = !1, s || (s = !0, requestAnimationFrame(() => {
1280
- e.requestUpdate(), s = !1;
1281
- })));
1282
- }, e._subscriptions.add(["save", e.cacheListener]), e._subscribe();
1283
- };
1284
- if (document.readyState !== "complete") {
1285
- const s = () => {
1286
- document.readyState === "complete" && (document.removeEventListener("readystatechange", s), i());
1287
- };
1288
- document.addEventListener("readystatechange", s);
1289
- } else
1290
- i();
1291
- };
1292
- function Je() {
1293
- return `${Date.now()}-${Math.random().toString(16).slice(2)}`;
1294
- }
1295
- const ne = ({
1296
- component: e,
1297
- defaultRoute: t = !1,
1298
- ignoreRouter: r = !1
1299
- }) => {
1300
- if (e.uniq || (e.uniq = Je(), t && !e.route && !r && (e.route = t)), e._subscriptions = /* @__PURE__ */ new Set(), !r) {
1301
- e.route || (e.route = e.uniq, window.orbit && (e.route = window.orbit.getRoute(e.uniq))), e.noRouter = !0;
1302
- let i = document.querySelector("solid-router");
1303
- const s = window.sibRouter.currentResource;
1304
- for (; i; ) {
1305
- e.noRouter = !1, e.currentRoute = i.currentRouteName, e.currentResource = s;
1306
- const o = `[data-view="${i.currentRouteName}"] solid-router`;
1307
- i = document.querySelector(o);
1308
- }
1309
- e.navigationListener = () => {
1310
- let o = document.querySelector("solid-router");
1311
- const n = window.sibRouter.currentResource;
1312
- for (; o; ) {
1313
- e.noRouter = !1, e.currentRoute = o.currentRouteName, e.currentResource = n;
1314
- const a = `[data-view="${o.currentRouteName}"] solid-router`;
1315
- o = document.querySelector(a);
1316
- }
1317
- e.requestUpdate();
1318
- }, e._subscriptions.add(["navigate", e.navigationListener]);
1319
- }
1320
- e._subscribe = () => {
1321
- e._unsubscribe();
1322
- for (const i of e._subscriptions)
1323
- document.addEventListener(i[0], i[1]);
1324
- }, e._unsubscribe = () => {
1325
- for (const i of e._subscriptions)
1326
- document.removeEventListener(i[0], i[1]);
1327
- }, e._subscribe();
1328
- };
1329
- function Wt(e) {
1330
- return !Number.isNaN(new Date(e).getTime());
1331
- }
1332
- const bt = (e, t, r) => {
1333
- if (e == null)
1334
- return !1;
1335
- const i = t.split(".");
1336
- let s = e;
1337
- for (const o of i)
1338
- if (s && typeof s == "object" && o in s)
1339
- s = s[o];
1340
- else
1341
- return !1;
1342
- if (Wt(s)) {
1343
- if (new Date(s) > r)
1344
- return !0;
1345
- } else
1346
- return !1;
1347
- return Array.isArray(e) ? e.some(
1348
- (o) => bt(o, t, r)
1349
- ) : typeof e == "object" ? Object.entries(e).some(([o, n]) => o === t && Wt(n) ? !1 : bt(n, t, r)) : !1;
1350
- }, Ze = (e, t, r) => {
1351
- if (!t || !r || typeof r != "string")
1352
- return e;
1353
- const i = new Date(r);
1354
- return Number.isNaN(i.getTime()) ? (console.warn(`Invalid threshold date provided: ${r}`), e) : e.filter(
1355
- (s) => bt(s, t, i)
1356
- );
1357
- };
1358
- function Xe(e) {
1359
- return typeof e != "string" && typeof e != "number" && !(e instanceof Date) ? !1 : !Number.isNaN(new Date(e).getTime());
1360
- }
1361
- const $t = (e, t, r, i) => {
1362
- if (e == null)
1363
- return !1;
1364
- const s = t.split(".");
1365
- let o = e;
1366
- for (const n of s)
1367
- if (o && typeof o == "object" && n in o)
1368
- o = o[n];
1369
- else
1370
- return !1;
1371
- if (typeof o == "number") {
1372
- if (typeof r == "number" && typeof i == "number" && r <= o && o <= i)
1373
- return !0;
1374
- } else if (Xe(o)) {
1375
- const n = new Date(o);
1376
- if (r instanceof Date && i instanceof Date && r <= n && n <= i)
1377
- return !0;
1378
- } else
1379
- return !1;
1380
- return Array.isArray(e) ? e.some(
1381
- (n) => $t(n, t, r, i)
1382
- ) : typeof e == "object" ? Object.entries(e).some(
1383
- ([n, a]) => $t(a, t, r, i)
1384
- ) : !1;
1385
- }, Qe = (e, t, r) => {
1386
- if (!t || !r)
1387
- return e;
1388
- const i = t.split(".");
1389
- return e.filter((s) => {
1390
- let o = s;
1391
- for (const a of i)
1392
- if (o && typeof o == "object" && a in o)
1393
- o = o[a];
1394
- else
1395
- return !1;
1396
- const n = o;
1397
- return n ? typeof n == "object" && !Array.isArray(n) && n !== null && "@id" in n && n["@id"] === r ? !0 : Array.isArray(n) ? n.some(
1398
- (a) => typeof a == "object" && a !== null && "@id" in a && a["@id"] === r
1399
- ) : !1 : !1;
1400
- });
1401
- }, Ye = (e, t, r) => {
1402
- if (!t || !r || typeof r != "string")
1403
- return e;
1404
- const [i, s] = r.split("/").map(Number);
1405
- return Number.isNaN(i) || Number.isNaN(s) ? e : i > s ? (console.warn(`Start number is after end number in interval: ${r}`), e) : e.filter(
1406
- (o) => $t(o, t, i, s)
1407
- );
1408
- }, _t = (e, t, r) => {
1409
- if (e == null)
1410
- return 0;
1411
- if (typeof e != "object") {
1412
- const s = String(e).toLowerCase(), o = t.replace(
1413
- /[.*+?^${}()|[\]\\]/g,
1414
- "\\$&"
1415
- ), n = new RegExp(`\\b${o}\\b`);
1416
- let a = 0;
1417
- return n.test(s) ? a = 2 : s.includes(t) && (a = 1), a;
1418
- }
1419
- if (Array.isArray(e)) {
1420
- let s = 0;
1421
- for (const o of e)
1422
- if (s = Math.max(
1423
- s,
1424
- _t(
1425
- o,
1426
- t
1427
- )
1428
- ), s === 2) break;
1429
- return s;
1430
- }
1431
- let i = 0;
1432
- for (const s of Object.values(e))
1433
- if (i = Math.max(
1434
- i,
1435
- _t(
1436
- s,
1437
- t
1438
- )
1439
- ), i === 2) break;
1440
- return i;
1441
- }, tr = (e, t, r) => {
1442
- if (!t || !r || r.trim() === "")
1443
- return e;
1444
- const i = r.toLowerCase(), s = t.split(".");
1445
- return e.map((o) => {
1446
- let n = o;
1447
- for (const c of s)
1448
- if (n && typeof n == "object" && c in n)
1449
- n = n[c];
1450
- else {
1451
- n = null;
1452
- break;
1453
- }
1454
- let a = 0;
1455
- return n && (a = _t(
1456
- n,
1457
- i
1458
- )), { obj: o, score: a };
1459
- }).filter((o) => o.score > 0).sort((o, n) => n.score - o.score).map((o) => o.obj);
1460
- }, er = (e, t) => t ? e.filter((r) => {
1461
- const i = r["@type"];
1462
- return i ? typeof i == "string" ? i === t : Array.isArray(i) ? i.some((s) => s === t) : !1 : !1;
1463
- }) : e, wt = (e, t, r) => {
1464
- if (e == null)
1465
- return 0;
1466
- if (typeof e != "object") {
1467
- const s = String(e).toLowerCase(), o = t.replace(
1468
- /[.*+?^${}()|[\]\\]/g,
1469
- "\\$&"
1470
- ), n = new RegExp(`\\b${o}\\b`);
1471
- let a = 0;
1472
- return n.test(s) ? r === "name" || r === "title" ? a = 4 : a = 3 : s.includes(t) && (r === "name" || r === "title" ? a = 2 : a = 1), a;
1473
- }
1474
- if (Array.isArray(e)) {
1475
- let s = 0;
1476
- for (const o of e)
1477
- if (s = Math.max(
1478
- s,
1479
- wt(o, t)
1480
- ), s === 4) break;
1481
- return s;
1482
- }
1483
- let i = 0;
1484
- for (const [s, o] of Object.entries(e))
1485
- if (i = Math.max(
1486
- i,
1487
- wt(o, t, s)
1488
- ), i === 4) break;
1489
- return i;
1490
- }, ae = (e, t) => {
1491
- if (!t || t.trim() === "")
1492
- return e;
1493
- const r = t.toLowerCase();
1494
- return e.map((i) => ({
1495
- obj: i,
1496
- score: wt(i, r)
1497
- })).filter((i) => i.score > 0).sort((i, s) => s.score - i.score).map((i) => i.obj);
1498
- }, D = (e, t) => {
1499
- let r = e;
1500
- for (const i of t)
1501
- if (r && i in r)
1502
- r = r[i];
1503
- else
1504
- return;
1505
- return r;
1506
- }, S = (e, t, r = "asc") => {
1507
- const i = Array.isArray(t) ? t : [t], s = r !== "asc", o = [...e], a = (() => {
1508
- const c = D(o[0], i);
1509
- if (typeof c == "number")
1510
- return (d, p) => {
1511
- const u = D(d, i), g = D(p, i);
1512
- return u == null ? g == null ? 0 : 1 : g == null ? -1 : u - g;
1513
- };
1514
- if (typeof c == "string")
1515
- return (d, p) => {
1516
- const u = D(d, i), g = D(p, i);
1517
- return u == null ? g == null ? 0 : 1 : g == null ? -1 : u.localeCompare(g);
1518
- };
1519
- if (c instanceof Date)
1520
- return (d, p) => {
1521
- const u = D(d, i), g = D(p, i);
1522
- return u == null ? g == null ? 0 : 1 : g == null ? -1 : u.getTime() - g.getTime();
1523
- };
1524
- throw new TypeError(`Unsupported data type for key "${t}"`);
1525
- })();
1526
- return o.sort((c, d) => {
1527
- const p = a(c, d);
1528
- return s ? -p : p;
1529
- }), o;
1530
- }, Kt = /* @__PURE__ */ new Map(), rr = (e) => {
1531
- const t = JSON.stringify(e);
1532
- let r = Kt.get(t);
1533
- return r || (r = new Intl.DateTimeFormat(void 0, e), Kt.set(t, r)), r;
1534
- }, I = (e, t = {
1535
- day: "2-digit",
1536
- month: "2-digit",
1537
- year: "2-digit"
1538
- }) => {
1539
- if (!e) return "";
1540
- const r = typeof e == "string" ? new Date(e) : e, s = rr(t).format(r);
1541
- return typeof e == "string" && s === "Invalid Date" ? e : s;
1542
- }, L = (e, t = !1) => {
1543
- window.dispatchEvent(
1544
- new CustomEvent("requestNavigation", {
1545
- detail: {
1546
- route: e,
1547
- resource: typeof t == "string" ? { "@id": t } : t
1548
- }
1549
- })
1550
- );
1551
- }, sr = "https://cdn.startinblox.com/owl/ds4go.jsonld#", ir = { "@id": "ds4go:link", "@type": "@id" }, or = { "@id": "ds4go:enclosure", "@type": "@id" }, nr = { "@id": "ds4go:url", "@type": "@id" }, Gt = {
1552
- ds4go: sr,
1553
- link: ir,
1554
- enclosure: or,
1555
- url: nr
1556
- };
1557
- const At = "lit-localize-status";
1558
- const ar = (e, ...t) => ({
1559
- strTag: !0,
1560
- strings: e,
1561
- values: t
1562
- }), R = ar, cr = (e) => typeof e != "string" && "strTag" in e, ce = (e, t, r) => {
1563
- let i = e[0];
1564
- for (let s = 1; s < e.length; s++)
1565
- i += t[r ? r[s - 1] : s - 1], i += e[s];
1566
- return i;
1567
- };
1568
- const le = ((e) => cr(e) ? ce(e.strings, e.values) : e);
1569
- let h = le, Jt = !1;
1570
- function lr(e) {
1571
- if (Jt)
1572
- throw new Error("lit-localize can only be configured once");
1573
- h = e, Jt = !0;
1574
- }
1575
- class dr {
1576
- constructor(t) {
1577
- this.__litLocalizeEventHandler = (r) => {
1578
- r.detail.status === "ready" && this.host.requestUpdate();
1579
- }, this.host = t;
1580
- }
1581
- hostConnected() {
1582
- window.addEventListener(At, this.__litLocalizeEventHandler);
1583
- }
1584
- hostDisconnected() {
1585
- window.removeEventListener(At, this.__litLocalizeEventHandler);
1586
- }
1587
- }
1588
- const ur = (e) => e.addController(new dr(e)), hr = ur;
1589
- const pr = () => (e, t) => (e.addInitializer(hr), e);
1590
- class de {
1591
- constructor() {
1592
- this.settled = !1, this.promise = new Promise((t, r) => {
1593
- this._resolve = t, this._reject = r;
1594
- });
1595
- }
1596
- resolve(t) {
1597
- this.settled = !0, this._resolve(t);
1598
- }
1599
- reject(t) {
1600
- this.settled = !0, this._reject(t);
1601
- }
1602
- }
1603
- const C = [];
1604
- for (let e = 0; e < 256; e++)
1605
- C[e] = (e >> 4 & 15).toString(16) + (e & 15).toString(16);
1606
- function fr(e) {
1607
- let t = 0, r = 8997, i = 0, s = 33826, o = 0, n = 40164, a = 0, c = 52210;
1608
- for (let d = 0; d < e.length; d++)
1609
- r ^= e.charCodeAt(d), t = r * 435, i = s * 435, o = n * 435, a = c * 435, o += r << 8, a += s << 8, i += t >>> 16, r = t & 65535, o += i >>> 16, s = i & 65535, c = a + (o >>> 16) & 65535, n = o & 65535;
1610
- return C[c >> 8] + C[c & 255] + C[n >> 8] + C[n & 255] + C[s >> 8] + C[s & 255] + C[r >> 8] + C[r & 255];
1611
- }
1612
- const mr = "", gr = "h", yr = "s";
1613
- function vr(e, t) {
1614
- return (t ? gr : yr) + fr(typeof e == "string" ? e : e.join(mr));
1615
- }
1616
- const Zt = /* @__PURE__ */ new WeakMap(), Xt = /* @__PURE__ */ new Map();
1617
- function br(e, t, r) {
1618
- if (e) {
1619
- const i = r?.id ?? $r(t), s = e[i];
1620
- if (s) {
1621
- if (typeof s == "string")
1622
- return s;
1623
- if ("strTag" in s)
1624
- return ce(
1625
- s.strings,
1626
- // Cast `template` because its type wasn't automatically narrowed (but
1627
- // we know it must be the same type as `localized`).
1628
- t.values,
1629
- s.values
1630
- );
1631
- {
1632
- let o = Zt.get(s);
1633
- return o === void 0 && (o = s.values, Zt.set(s, o)), {
1634
- ...s,
1635
- values: o.map((n) => t.values[n])
1636
- };
1637
- }
1638
- }
1639
- }
1640
- return le(t);
1641
- }
1642
- function $r(e) {
1643
- const t = typeof e == "string" ? e : e.strings;
1644
- let r = Xt.get(t);
1645
- return r === void 0 && (r = vr(t, typeof e != "string" && !("strTag" in e)), Xt.set(t, r)), r;
1646
- }
1647
- function yt(e) {
1648
- window.dispatchEvent(new CustomEvent(At, { detail: e }));
1649
- }
1650
- let lt = "", vt, ue, dt, Ct, he, O = new de();
1651
- O.resolve();
1652
- let ot = 0;
1653
- const _r = (e) => (lr(((t, r) => br(he, t, r))), lt = ue = e.sourceLocale, dt = new Set(e.targetLocales), dt.add(e.sourceLocale), Ct = e.loadLocale, { getLocale: wr, setLocale: Ar }), wr = () => lt, Ar = (e) => {
1654
- if (e === (vt ?? lt))
1655
- return O.promise;
1656
- if (!dt || !Ct)
1657
- throw new Error("Internal error");
1658
- if (!dt.has(e))
1659
- throw new Error("Invalid locale code");
1660
- ot++;
1661
- const t = ot;
1662
- return vt = e, O.settled && (O = new de()), yt({ status: "loading", loadingLocale: e }), (e === ue ? (
1663
- // We could switch to the source locale synchronously, but we prefer to
1664
- // queue it on a microtask so that switching locales is consistently
1665
- // asynchronous.
1666
- Promise.resolve({ templates: void 0 })
1667
- ) : Ct(e)).then((i) => {
1668
- ot === t && (lt = e, vt = void 0, he = i.templates, yt({ status: "ready", readyLocale: e }), O.resolve());
1669
- }, (i) => {
1670
- ot === t && (yt({
1671
- status: "error",
1672
- errorLocale: e,
1673
- errorMessage: i.toString()
1674
- }), O.reject(i));
1675
- }), O.promise;
1676
- };
1677
- var Cr = Object.defineProperty, Sr = Object.getOwnPropertyDescriptor, Dt = (e, t, r, i) => {
1678
- for (var s = i > 1 ? void 0 : i ? Sr(t, r) : t, o = e.length - 1, n; o >= 0; o--)
1679
- (n = e[o]) && (s = (i ? n(t, r, s) : n(s)) || s);
1680
- return i && s && Cr(t, r, s), s;
1681
- };
1682
- let Q = class extends kt {
1683
- constructor() {
1684
- super(...arguments), this.search = [], this._displayObjects = [];
1685
- }
1686
- filter(e, t = []) {
1687
- if (!t || t.length === 0 || !e || e.length === 0)
1688
- return e;
1689
- const r = /* @__PURE__ */ new Map();
1690
- for (const s of t) {
1691
- const o = s.name, n = r.get(o) || [];
1692
- n.push(s), r.set(o, n);
1693
- }
1694
- let i = [...e];
1695
- for (const s of r.values()) {
1696
- if (i.length === 0)
1697
- break;
1698
- const o = [];
1699
- for (const n of s)
1700
- switch (n.type) {
1701
- case "interval":
1702
- o.push(
1703
- Ye(
1704
- i,
1705
- n.name,
1706
- n.value
1707
- )
1708
- );
1709
- break;
1710
- case "dateAfter":
1711
- o.push(
1712
- Ze(
1713
- i,
1714
- n.name,
1715
- n.value
1716
- )
1717
- );
1718
- break;
1719
- case "matchId":
1720
- o.push(
1721
- Qe(
1722
- i,
1723
- n.name,
1724
- n.value
1725
- )
1726
- );
1727
- break;
1728
- case "matchType":
1729
- o.push(
1730
- er(i, n.value)
1731
- );
1732
- break;
1733
- case "exact":
1734
- o.push(
1735
- tr(
1736
- i,
1737
- n.name,
1738
- n.value
1739
- )
1740
- );
1741
- break;
1742
- default:
1743
- o.push(
1744
- ae(i, n.value)
1745
- );
1746
- }
1747
- i = [...o.flat()];
1748
- }
1749
- return i;
1750
- }
1751
- _handleClickEvent(e) {
1752
- this.dispatchEvent(new CustomEvent("clicked", { detail: e }));
1753
- }
1754
- willUpdate(e) {
1755
- (e.has("objects") || e.has("search")) && (this.objects ? this._displayObjects = this.filter(this.objects, this.search) : this._displayObjects = [], this.dispatchEvent(
1756
- new CustomEvent("result-count", {
1757
- detail: this._displayObjects.length
1758
- })
1759
- ));
1760
- }
1761
- render() {
1762
- return !this._displayObjects || this._displayObjects.length === 0 ? l : f`<div class="card-grid card-grid-vertical">
1763
- ${this._displayObjects.map((e) => {
1764
- const t = [
1765
- {
1766
- name: `${e.facts.length} ${e.facts.length > 1 ? h("facts") : h("fact")}`,
1767
- type: "information"
1768
- }
1769
- ];
1770
- return f`<tems-card-catalog
1771
- .object=${l}
1772
- type=${"bill-image"}
1773
- .tags=${t}
1774
- .header=${e.name || l}
1775
- .content=${e.description || l}
1776
- date=${e.updated_at || l}
1777
- @click=${() => this._handleClickEvent(e)}
1778
- ></tems-card-catalog>`;
1779
- })}
1780
- </div>`;
1781
- }
1782
- };
1783
- Q.styles = tt`
1784
- .card-grid {
1785
- display: flex;
1786
- flex-direction: row;
1787
- flex-wrap: wrap;
1788
- gap: 20px;
1789
- }
1790
- .card-grid-vertical {
1791
- justify-content: stretch;
1792
- }
1793
- .card-grid-vertical tems-card-catalog {
1794
- width: 354px;
1795
- height: auto;
1796
- }
1797
- tems-card-catalog {
1798
- cursor: pointer;
1799
- }
1800
- `;
1801
- Dt([
1802
- m()
1803
- ], Q.prototype, "search", 2);
1804
- Dt([
1805
- m()
1806
- ], Q.prototype, "_displayObjects", 2);
1807
- Q = Dt([
1808
- M("ds4go-fact-bundle-holder")
1809
- ], Q);
1810
- const xr = ".flex{display:flex}.flex.flex-row{flex-direction:row}.flex.flex-column{flex-direction:column}.flex.wrap{flex-wrap:wrap}.flex.flex-1{flex:1}.flex .half,.flex.half{flex-basis:50%}.flex.justify-content-center{justify-content:center}.flex.justify-content-space-between{justify-content:space-between}.flex.align-items-center{align-items:center}.flex.align-items-flex-start{align-items:flex-start}.flex .align-items-flex-end{align-items:flex-end}.full-width{width:100%}.modal{background-color:var(--color-surface-primary);border:var(--border-width-sm) solid var(--color-border-primary);border-radius:var(--border-radius-lg);color:var(--color-text-body);display:flex;flex-direction:column;font-family:var(--font-family-body);font-size:var(--typography-size-body-md);font-style:normal;font-weight:var(--font-weight-regular);gap:var(--scale-600);height:90vh;letter-spacing:var(--font-letter-spacing-default);line-height:var(--line-height-body-md);padding:var(--scale-600) var(--scale-900);width:90vw}.modal .topbar{display:flex;flex-direction:row;gap:var(--scale-400);width:100%}.modal .topbar tems-button:nth-child(2){margin-left:auto}.modal .modal-content-wrapper{display:flex;flex:1;flex-direction:column;overflow:hidden}.modal .modal-content-wrapper .modal-box{display:flex;flex:1;overflow-x:hidden;overflow-y:scroll}.modal .modal-content-wrapper .modal-content{display:flex;flex-direction:column;gap:var(--scale-400);height:fit-content;width:100%}.modal .modal-content-wrapper tems-division{width:fit-content}.modal .modal-content-wrapper tems-division div{display:block;height:auto;overflow:hidden;text-overflow:ellipsis}.modal .modal-content-wrapper .card-grid{display:flex;flex-direction:row;flex-wrap:wrap;gap:20px}.modal .modal-content-wrapper .card-grid-vertical{justify-content:stretch}.modal .modal-content-wrapper .card-grid-vertical tems-card-catalog{height:auto;width:354px}@media screen and (min-width:1100px){div.modal{height:fit-content;max-height:80vw;max-width:80vw;width:fit-content}}";
1811
- var Pr = Object.defineProperty, Er = Object.getOwnPropertyDescriptor, pe = (e, t, r, i) => {
1812
- for (var s = i > 1 ? void 0 : i ? Er(t, r) : t, o = e.length - 1, n; o >= 0; o--)
1813
- (n = e[o]) && (s = (i ? n(t, r, s) : n(s)) || s);
1814
- return i && s && Pr(t, r, s), s;
1815
- };
1816
- let ut = class extends Fe {
1817
- constructor() {
1818
- super(...arguments), this.object = { "@id": "" };
1819
- }
1820
- _closeModal() {
1821
- this.dispatchEvent(new CustomEvent("close"));
1822
- }
1823
- render() {
1824
- return f`<div class="modal">
1825
- <div class="topbar">
1826
- <tems-button
1827
- @click=${this._closeModal}
1828
- type="outline-gray"
1829
- .iconLeft=${f`<icon-material-symbols-close-rounded></icon-material-symbols-close-rounded>`}
1830
- ></tems-button>
1831
- </div>
1832
- <div class="modal-content-wrapper">
1833
- <div class="modal-box">
1834
- <div class="modal-content">
1835
- <tems-division type="h3"
1836
- ><div>${String(this.object.name || "")}</div></tems-division
1837
- >
1838
- <tems-division type="body-m"
1839
- ><div>${String(this.object.description || "")}</div></tems-division
1840
- >
1841
- <tems-division type="h4"
1842
- ><div>${h("All facts in this bundle")}</div></tems-division
1843
- >
1844
- <div class="card-grid card-grid-vertical">
1845
- ${this.object.facts.map((e) => {
1846
- const t = e.categories.map((r) => ({
1847
- name: r.name,
1848
- type: "information"
1849
- }));
1850
- if (t.length > 3) {
1851
- const r = t.length - 3;
1852
- t.splice(3, r), t.push({
1853
- name: `+${r} ${h("more")}`,
1854
- type: "information"
1855
- });
1856
- }
1857
- return f`<tems-card-catalog
1858
- .object=${l}
1859
- .tags=${t}
1860
- .header=${e.name || l}
1861
- .content=${e.description || l}
1862
- date=${e.updated_at || l}
1863
- ></tems-card-catalog>`;
1864
- })}
1865
- </div>
1866
- <tems-division type="body-sm"
1867
- ><div>
1868
- <div>
1869
- ${h("Bundle created on")} ${String(this.object.created_at)}
1870
- </div>
1871
- <div>
1872
- ${h("Bundle updated on")} ${String(this.object.updated_at)}
1873
- </div>
1874
- </div></tems-division
1875
- >
1876
- </div>
1877
- </div>
1878
- </div>
1879
- </div>`;
1880
- }
1881
- };
1882
- ut.styles = tt`
1883
- ${Et(xr)}
1884
- `;
1885
- pe([
1886
- v({ attribute: !1, type: Object })
1887
- ], ut.prototype, "object", 2);
1888
- ut = pe([
1889
- M("ds4go-fact-bundle-modal"),
1890
- pr()
1891
- ], ut);
1892
- const Rr = /* @__PURE__ */ Symbol();
1893
- class rt {
1894
- get taskComplete() {
1895
- return this.t || (this.i === 1 ? this.t = new Promise(((t, r) => {
1896
- this.o = t, this.h = r;
1897
- })) : this.i === 3 ? this.t = Promise.reject(this.l) : this.t = Promise.resolve(this.u)), this.t;
1898
- }
1899
- constructor(t, r, i) {
1900
- this.p = 0, this.i = 0, (this._ = t).addController(this);
1901
- const s = typeof r == "object" ? r : { task: r, args: i };
1902
- this.v = s.task, this.j = s.args, this.m = s.argsEqual ?? jr, this.k = s.onComplete, this.A = s.onError, this.autoRun = s.autoRun ?? !0, "initialValue" in s && (this.u = s.initialValue, this.i = 2, this.O = this.T?.());
1903
- }
1904
- hostUpdate() {
1905
- this.autoRun === !0 && this.S();
1906
- }
1907
- hostUpdated() {
1908
- this.autoRun === "afterUpdate" && this.S();
1909
- }
1910
- T() {
1911
- if (this.j === void 0) return;
1912
- const t = this.j();
1913
- if (!Array.isArray(t)) throw Error("The args function must return an array");
1914
- return t;
1915
- }
1916
- async S() {
1917
- const t = this.T(), r = this.O;
1918
- this.O = t, t === r || t === void 0 || r !== void 0 && this.m(r, t) || await this.run(t);
1919
- }
1920
- async run(t) {
1921
- let r, i;
1922
- t ??= this.T(), this.O = t, this.i === 1 ? this.q?.abort() : (this.t = void 0, this.o = void 0, this.h = void 0), this.i = 1, this.autoRun === "afterUpdate" ? queueMicrotask((() => this._.requestUpdate())) : this._.requestUpdate();
1923
- const s = ++this.p;
1924
- this.q = new AbortController();
1925
- let o = !1;
1926
- try {
1927
- r = await this.v(t, { signal: this.q.signal });
1928
- } catch (n) {
1929
- o = !0, i = n;
1930
- }
1931
- if (this.p === s) {
1932
- if (r === Rr) this.i = 0;
1933
- else {
1934
- if (o === !1) {
1935
- try {
1936
- this.k?.(r);
1937
- } catch {
1938
- }
1939
- this.i = 2, this.o?.(r);
1940
- } else {
1941
- try {
1942
- this.A?.(i);
1943
- } catch {
1944
- }
1945
- this.i = 3, this.h?.(i);
1946
- }
1947
- this.u = r, this.l = i;
1948
- }
1949
- this._.requestUpdate();
1950
- }
1951
- }
1952
- abort(t) {
1953
- this.i === 1 && this.q?.abort(t);
1954
- }
1955
- get value() {
1956
- return this.u;
1957
- }
1958
- get error() {
1959
- return this.l;
1960
- }
1961
- get status() {
1962
- return this.i;
1963
- }
1964
- render(t) {
1965
- switch (this.i) {
1966
- case 0:
1967
- return t.initial?.();
1968
- case 1:
1969
- return t.pending?.();
1970
- case 2:
1971
- return t.complete?.(this.value);
1972
- case 3:
1973
- return t.error?.(this.error);
1974
- default:
1975
- throw Error("Unexpected status: " + this.i);
1976
- }
1977
- }
1978
- }
1979
- const jr = (e, t) => e === t || e.length === t.length && e.every(((r, i) => !pt(r, t[i])));
1980
- !window.orbit && !"/".includes("cypress") && await new Promise((e) => {
1981
- document.addEventListener("orbit-ready", () => {
1982
- e(!0);
1983
- });
1984
- });
1985
- var Ur = Object.getOwnPropertyDescriptor, kr = (e, t, r, i) => {
1986
- for (var s = i > 1 ? void 0 : i ? Ur(t, r) : t, o = e.length - 1, n; o >= 0; o--)
1987
- (n = e[o]) && (s = n(s) || s);
1988
- return s;
1989
- };
1990
- let St = class extends $ {
1991
- constructor() {
1992
- super(...arguments), this.cherryPickedProperties = [{ key: "name", value: "name" }], this._getResource = new rt(this, {
1993
- task: async ([e]) => {
1994
- if (!(!e || !this.orbit || !this.noRouter && this.route && this.currentRoute && !this.route.startsWith(this.currentRoute))) {
1995
- if (!this.hasCachedDatas || this.oldDataSrc !== e) {
1996
- if (!e) return;
1997
- this.datas = await this._getProxyValue(e), this.hasCachedDatas = !0;
1998
- }
1999
- return this.oldDataSrc !== e && (this.oldDataSrc = e), S(this.datas, "name", "asc");
2000
- }
2001
- },
2002
- args: () => [this.dataSrc, this.caching, this.currentRoute]
2003
- });
2004
- }
2005
- async _afterAttach() {
2006
- return oe(this, {
2007
- keywords: ["some-keyword", "for-invalidating", "cache"]
2008
- }), Promise.resolve();
2009
- }
2010
- render() {
2011
- return this.gatekeeper() || this._getResource.render({
2012
- pending: () => f`<solid-loader></solid-loader>`,
2013
- complete: (e) => e ? f`<div>
2014
- <sample-objects .objects=${e}></sample-objects>
2015
- </div>` : l
2016
- });
2017
- }
2018
- };
2019
- St.styles = tt`
2020
- div {
2021
- background-color: red;
2022
- position: absolute;
2023
- top: 0;
2024
- left: 0;
2025
- right: 0;
2026
- bottom: 0;
2027
- }
2028
- `;
2029
- St = kr([
2030
- M("solid-boilerplate")
2031
- ], St);
2032
- var Dr = Object.defineProperty, Or = Object.getOwnPropertyDescriptor, U = (e, t, r, i) => {
2033
- for (var s = i > 1 ? void 0 : i ? Or(t, r) : t, o = e.length - 1, n; o >= 0; o--)
2034
- (n = e[o]) && (s = (i ? n(t, r, s) : n(s)) || s);
2035
- return i && s && Dr(t, r, s), s;
2036
- };
2037
- let A = class extends $ {
2038
- constructor() {
2039
- super(...arguments), this.search = [], this.resultCount = this.objects?.length || 0, this.cherryPickedProperties = [
2040
- { key: "dct:title", value: "title" },
2041
- { key: "dct:description", value: "description" },
2042
- { key: "dcat:dataset", value: "dataset", expand: !0 },
2043
- { key: "dct:creator", value: "creator" }
2044
- ], this.sectors = [], this._getResource = new rt(this, {
2045
- task: async ([e, t, r]) => {
2046
- if (!(!e || !this.orbit || !this.noRouter && this.route && this.currentRoute && !this.route.startsWith(this.currentRoute))) {
2047
- if (this.displayFiltering = !this.component.parameters.disableFiltering, !this.hasCachedDatas) {
2048
- if (!e) return;
2049
- this.sectors = [];
2050
- try {
2051
- const i = await fetch(e);
2052
- this.sectors = await i.json(), this.hasCachedDatas = !0;
2053
- } catch (i) {
2054
- console.warn(`Failed to fetch sector authority ${e}`, i);
2055
- return;
2056
- }
2057
- }
2058
- if (t) {
2059
- this.catalogs = [];
2060
- const i = t === "*" ? this.sectors : this.sectors.filter((s) => s.id === t);
2061
- if (i.length > 0 && (this.catalogs = (await Promise.all(
2062
- i.map(async (s) => {
2063
- try {
2064
- return (await (await fetch(
2065
- `${s.federatedCatalogEndpoint}/discovery`
2066
- )).json()).catalogs;
2067
- } catch (o) {
2068
- return console.warn(
2069
- `Failed to fetch sector authority ${s.federatedCatalogEndpoint}/discovery`,
2070
- o
2071
- ), [];
2072
- }
2073
- })
2074
- )).flat()), r) {
2075
- if (r === "*")
2076
- return this.object = {
2077
- "@id": "urn:uuid:all-catalogs",
2078
- "dct:title": h("All Catalogs"),
2079
- "dct:description": "",
2080
- "dcat:dataset": (await Promise.all(
2081
- this.catalogs.map(async (o) => {
2082
- try {
2083
- return (await (await fetch(o.endpoints.catalog)).json())["dcat:dataset"];
2084
- } catch (n) {
2085
- return console.warn(
2086
- `Failed to fetch catalog from ${o.endpoints.catalog}`,
2087
- n
2088
- ), [];
2089
- }
2090
- })
2091
- )).flat()
2092
- }, this.object;
2093
- const s = this.catalogs.find(
2094
- (o) => o.catalogId === r
2095
- );
2096
- if (s)
2097
- try {
2098
- return this.object = await (await fetch(s.endpoints.catalog)).json(), this.object["dcat:dataset"] = S(
2099
- this.object["dcat:dataset"],
2100
- "dct:title",
2101
- "asc"
2102
- ), this.object;
2103
- } catch (o) {
2104
- console.warn(
2105
- `Failed to fetch catalog from ${s.endpoints.catalog}`,
2106
- o
2107
- );
2108
- return;
2109
- }
2110
- }
2111
- return S(this.catalogs, "catalogId", "asc");
2112
- }
2113
- return S(this.sectors, "id", "asc");
2114
- }
2115
- },
2116
- args: () => [
2117
- this.dataSrc,
2118
- this.sectorId,
2119
- this.catalogId,
2120
- this.caching,
2121
- this.currentRoute
2122
- ]
2123
- });
2124
- }
2125
- async _afterAttach() {
2126
- return this.menuComponent = document.querySelector(
2127
- `[uniq="${this.orbit?.getComponent("menu")?.uniq}"]`
2128
- ), Promise.resolve();
2129
- }
2130
- _search(e) {
2131
- e.preventDefault(), this.search = e.detail, this.filterCount = this.search.filter((t) => t.name !== "search").length;
2132
- }
2133
- _resultCountUpdate(e) {
2134
- this.resultCount = e.detail ?? 0;
2135
- }
2136
- _back() {
2137
- this.catalogId ? this.catalogId = "" : this.sectorId && (this.sectorId = "");
2138
- }
2139
- _selectSector(e) {
2140
- this.sectors.find((t) => t.id === e) ? this.sectorId = e : this.sectorId = "";
2141
- }
2142
- _selectCatalog(e) {
2143
- this.catalogs?.find((t) => t.catalogId === e) ? this.catalogId = e : this.catalogId = "";
2144
- }
2145
- render() {
2146
- return this.gatekeeper() || this._getResource.render({
2147
- pending: () => f`<solid-loader></solid-loader>`,
2148
- error: (e) => (console.warn("[solid-dsif-explorer-poc] Task error:", e), l),
2149
- complete: (e) => f`<tems-viewport>
2150
- <tems-header
2151
- slot="header"
2152
- heading=${this.catalogId ? e ? this.catalogId === "*" ? `${h("All Datasets")}` : `${h("Datasets from")}
2153
- ${e["dct:title"]} (From ${this.sectorId})` : `${h(R`Error while loading catalog ${this.catalogId}`)}` : this.sectorId ? this.sectorId === "*" ? `${h("All Sectors")}` : `${h("Catalogs available in")} ${this.sectorId}` : `${h("Root Authority")}`}
2154
- >${(this.sectorId || this.catalogId) && !(this.catalogId === "*" && this.sectorId === "*") && !(this.sectorId === "*" && !this.catalogId) ? f`<div slot="cta">
2155
- <tems-button
2156
- type="primary"
2157
- label=${h(
2158
- R`Back to ${this.catalogId ? this.sectorId : "Root Authority"}`
2159
- )}
2160
- @click=${this._back}
2161
- ></tems-button>
2162
- </div>` : l}</tems-header
2163
- >
2164
- <div slot="content">
2165
- ${e ? f`<div>
2166
- ${this.catalogId ? f`<tems-division type="body-m"
2167
- >${e["dct:description"]}</tems-division
2168
- >` : l}
2169
- <div class="card-grid card-grid-vertical">
2170
- ${this.catalogId ? f`${e["dcat:dataset"].map(
2171
- (t) => f`<tems-card-catalog
2172
- .object=${l}
2173
- type=${"bill-image"}
2174
- .header=${t["dct:title"] || l}
2175
- .content=${t["dct:description"] || l}
2176
- ></tems-card-catalog>`
2177
- )}` : this.sectorId ? f`${e.map(
2178
- (t) => f`<tems-card-catalog
2179
- class="cursor-pointer"
2180
- .object=${l}
2181
- type=${"bill-image"}
2182
- .header=${t.catalogId || l}
2183
- .content=${t.description || l}
2184
- date=${I(t.lastUpdated) || l}
2185
- @click=${() => this._selectCatalog(t.catalogId)}
2186
- ></tems-card-catalog>`
2187
- )}` : f`${e.map(
2188
- (t) => f`<tems-card-catalog
2189
- class="cursor-pointer"
2190
- .object=${l}
2191
- type=${"bill-image"}
2192
- .header=${t.id || l}
2193
- .content=${t.description || l}
2194
- date=${I(t.lastUpdated) || l}
2195
- @click=${() => this._selectSector(t.id)}
2196
- ></tems-card-catalog>`
2197
- )}`}
2198
- </div>
2199
- </div>` : f`<p>
2200
- ${h(
2201
- "No data available, data source may be temporarily unavailable."
2202
- )}
2203
- </p>
2204
- ${this.sectorId || this.catalogId ? f`<tems-button
2205
- type="primary"
2206
- label=${h("Back")}
2207
- @click=${this._back}
2208
- ></tems-button>` : f`<tems-button
2209
- type="primary"
2210
- label=${h("Retry")}
2211
- @click=${this.requestUpdate}
2212
- ></tems-button>`}`}
2213
- </div>
2214
- </tems-viewport>`
2215
- });
2216
- }
2217
- };
2218
- A.styles = tt`
2219
- .card-grid {
2220
- margin: var(--scale-900) 0;
2221
- display: flex;
2222
- flex-direction: row;
2223
- flex-wrap: wrap;
2224
- gap: 20px;
2225
- }
2226
- .card-grid-vertical {
2227
- justify-content: stretch;
2228
- }
2229
- .card-grid-vertical tems-card-catalog {
2230
- width: 354px;
2231
- height: auto;
2232
- }
2233
- tems-card-catalog.cursor-pointer {
2234
- cursor: pointer;
2235
- }
2236
- tems-division {
2237
- margin-top: var(--scale-900);
2238
- }
2239
- `;
2240
- U([
2241
- v({ attribute: "sector-id", type: String })
2242
- ], A.prototype, "sectorId", 2);
2243
- U([
2244
- v({ attribute: "catalog-id", type: String })
2245
- ], A.prototype, "catalogId", 2);
2246
- U([
2247
- m()
2248
- ], A.prototype, "search", 2);
2249
- U([
2250
- m()
2251
- ], A.prototype, "resultCount", 2);
2252
- U([
2253
- m()
2254
- ], A.prototype, "sectors", 2);
2255
- U([
2256
- m()
2257
- ], A.prototype, "catalogs", 2);
2258
- U([
2259
- m()
2260
- ], A.prototype, "object", 2);
2261
- A = U([
2262
- M("solid-dsif-explorer-poc")
2263
- ], A);
2264
- var Lr = Object.defineProperty, Tr = Object.getOwnPropertyDescriptor, mt = (e, t, r, i) => {
2265
- for (var s = i > 1 ? void 0 : i ? Tr(t, r) : t, o = e.length - 1, n; o >= 0; o--)
2266
- (n = e[o]) && (s = (i ? n(t, r, s) : n(s)) || s);
2267
- return i && s && Lr(t, r, s), s;
2268
- };
2269
- let Y = class extends P {
2270
- constructor() {
2271
- super(...arguments), this.assets = [], this.policies = [], this.contracts = [], this._getResource = new rt(this, {
2272
- task: async () => {
2273
- if (this.orbit) {
2274
- if (!this.hasCachedDatas) {
2275
- const e = await this.fetchFederatedCatalog();
2276
- e !== void 0 && Array.isArray(e) && (this.datas = await Promise.all(
2277
- e.map(
2278
- async (t) => await this._responseAdaptator(t)
2279
- )
2280
- ), this.hasCachedDatas = !0);
2281
- }
2282
- return Array.isArray(this.datas) || (this.datas = []), this.datas;
2283
- }
2284
- },
2285
- args: () => [this.caching, this.currentRoute]
2286
- });
2287
- }
2288
- async _responseAdaptator(e) {
2289
- return e.providers ? Array.isArray(e.providers) || (e.providers = [e.providers].filter((t) => t)) : e.provider && (e.providers = [e.provider].filter((t) => t)), e;
2290
- }
2291
- async loadAssets() {
2292
- if (!this.storeService) {
2293
- console.error("Store not initialized. Check connector configuration.");
2294
- return;
2295
- }
2296
- try {
2297
- const e = await this.storeService.getAllAssets();
2298
- this.assets = Array.isArray(e) ? e : [];
2299
- } catch (e) {
2300
- console.error("Failed to load assets:", e);
2301
- }
2302
- }
2303
- async createAsset(e) {
2304
- if (!this.storeService) return !1;
2305
- try {
2306
- return await this.storeService.createAsset(e), await this.loadAssets(), this.dispatchEvent(
2307
- new CustomEvent("asset-created", {
2308
- detail: { asset: e },
2309
- bubbles: !0,
2310
- composed: !0
2311
- })
2312
- ), !0;
2313
- } catch (t) {
2314
- return console.error("Failed to create asset", t), !1;
2315
- }
2316
- }
2317
- async loadPolicies() {
2318
- if (!this.storeService) {
2319
- console.error("Store not initialized. Check connector configuration.");
2320
- return;
2321
- }
2322
- try {
2323
- const e = await this.storeService.getAllPolicies();
2324
- this.policies = Array.isArray(e) ? e : [];
2325
- } catch (e) {
2326
- console.error("Failed to load policies", e);
2327
- }
2328
- }
2329
- async createPolicy(e) {
2330
- if (!this.storeService) return !1;
2331
- try {
2332
- return await this.storeService.createPolicy(e), await this.loadPolicies(), this.dispatchEvent(
2333
- new CustomEvent("policy-created", {
2334
- detail: { policy: e },
2335
- bubbles: !0,
2336
- composed: !0
2337
- })
2338
- ), !0;
2339
- } catch (t) {
2340
- return console.error("Failed to create policy", t), !1;
2341
- }
2342
- }
2343
- async loadContracts() {
2344
- if (!this.storeService) {
2345
- console.error("Store not initialized. Check connector configuration.");
2346
- return;
2347
- }
2348
- try {
2349
- const e = await this.storeService.getAllContractDefinitions();
2350
- this.contracts = Array.isArray(e) ? e : [];
2351
- } catch (e) {
2352
- console.error("Failed to load contract definitions", e);
2353
- }
2354
- }
2355
- async createContract(e) {
2356
- if (!this.storeService) return !1;
2357
- try {
2358
- return await this.storeService.createContractDefinition(e), await this.loadContracts(), this.dispatchEvent(
2359
- new CustomEvent("contract-created", {
2360
- detail: { contract: e },
2361
- bubbles: !0,
2362
- composed: !0
2363
- })
2364
- ), !0;
2365
- } catch (t) {
2366
- return console.error("Failed to create contract definition", t), !1;
2367
- }
2368
- }
2369
- render() {
2370
- return this._getResource.render({
2371
- pending: () => l,
2372
- complete: () => l,
2373
- error: (e) => l
2374
- });
2375
- }
2376
- };
2377
- mt([
2378
- m()
2379
- ], Y.prototype, "assets", 2);
2380
- mt([
2381
- m()
2382
- ], Y.prototype, "policies", 2);
2383
- mt([
2384
- m()
2385
- ], Y.prototype, "contracts", 2);
2386
- Y = mt([
2387
- M("solid-dsp-connector")
2388
- ], Y);
2389
- const Ir = ".flex{display:flex}.flex.flex-row{flex-direction:row}.flex.flex-column{flex-direction:column}.flex.wrap{flex-wrap:wrap}.flex.flex-1{flex:1}.flex .half,.flex.half{flex-basis:50%}.flex.justify-content-center{justify-content:center}.flex.justify-content-space-between{justify-content:space-between}.flex.align-items-center{align-items:center}.flex.align-items-flex-start{align-items:flex-start}.flex .align-items-flex-end{align-items:flex-end}.full-width{width:100%}[slot=content]{height:100%}section{height:calc(100% - var(--scale-900)*2);padding:var(--scale-900) 0}section,section>div{gap:var(--scale-400)}section>div{display:flex;flex:1;flex-direction:column;height:100%}section>div:first-child{max-width:400px}.card-grid{align-content:flex-start;display:flex;flex:1;flex-direction:row;flex-wrap:wrap;gap:20px;overflow-y:scroll}.card-grid-vertical{justify-content:stretch}.card-grid-vertical tems-card-catalog{height:fit-content;width:354px}tems-card-catalog{cursor:pointer}tems-card-catalog[selected]{--color-border-primary:var(--color-surface-action-solid)}tems-search-bar{--scale-900:0}.gap-400{gap:var(--scale-400)}div.select{align-items:flex-start;display:flex;flex-direction:column;gap:var(--scale-200);width:100%}select{appearance:none;background-color:var(--color-surface-primary);border:var(--border-width-sm) solid var(--color-border-primary);border-radius:var(--border-radius-md);color:var(--color-text-body);cursor:pointer;font-family:var(--font-family-body);font-size:var(--typography-size-body-sm);font-style:normal;font-weight:var(--font-weight-regular);letter-spacing:var(--font-letter-spacing-default);line-height:var(--line-height-body-sm);padding:var(--scale-100) var(--scale-300);width:100%}select:hover{border:var(--border-width-sm) solid var(--color-border-action)}select option{background-color:var(--color-surface-primary);color:var(--color-text-body);cursor:pointer;font-family:var(--font-family-body);font-size:var(--typography-size-body-sm);font-style:normal;font-weight:var(--font-weight-regular);letter-spacing:var(--font-letter-spacing-default);line-height:var(--line-height-body-sm);padding:var(--scale-100) var(--scale-300)}";
2390
- var Fr = Object.defineProperty, Nr = Object.getOwnPropertyDescriptor, _ = (e, t, r, i) => {
2391
- for (var s = i > 1 ? void 0 : i ? Nr(t, r) : t, o = e.length - 1, n; o >= 0; o--)
2392
- (n = e[o]) && (s = (i ? n(t, r, s) : n(s)) || s);
2393
- return i && s && Fr(t, r, s), s;
2394
- };
2395
- let b = class extends $ {
2396
- constructor() {
2397
- super(...arguments), this.header = "DS4GO Fact Bundling Creation", this.selectedFacts = [], this.bundleName = "", this.bundleDescription = "", this.bundleLanguage = "en", this.policyTemplates = [
2398
- {
2399
- id: "policy-open-access",
2400
- name: h("Open access"),
2401
- policy: {
2402
- "@type": "Set",
2403
- permission: [
2404
- {
2405
- action: "use"
2406
- }
2407
- ],
2408
- prohibition: [],
2409
- obligation: []
2410
- }
2411
- }
2412
- ], this.bundleAccessPolicy = this.policyTemplates[0].id, this.bundleContractPolicy = this.policyTemplates[0].id, this.filterFactText = "", this.spliceLength = 0, this.cherryPickedProperties = [
2413
- { key: "created_at", value: "created_at", cast: I },
2414
- { key: "updated_at", value: "updated_at", cast: I },
2415
- { key: "name", value: "name" },
2416
- { key: "description", value: "description" },
2417
- { key: "author", value: "author" },
2418
- {
2419
- key: "categories",
2420
- value: "categories",
2421
- expand: !0,
2422
- cast: (t) => S(t, "name")
2423
- }
2424
- ], this._getResource = new rt(this, {
2425
- task: async ([t, r, i]) => {
2426
- if (!(!t || !this.orbit || !this.noRouter && this.route && this.currentRoute && !this.route.startsWith(this.currentRoute))) {
2427
- if (!this.hasCachedDatas || this.oldDataSrc !== t) {
2428
- if (!t) return;
2429
- this.facts = await this._getProxyValue(t), this.hasCachedDatas = !0;
2430
- }
2431
- return this.oldDataSrc !== t && (this.oldDataSrc = t), Array.isArray(this.facts) || (this.facts = []), r ? S(
2432
- ae(
2433
- this.facts.filter(
2434
- (s) => !i.includes(s)
2435
- ),
2436
- r
2437
- ),
2438
- "name",
2439
- "asc"
2440
- ) : (i.length === 0 && (this.spliceLength = Math.floor((window.innerWidth - 800) / 354) * Math.floor((window.innerHeight - 255) / 500)), S(
2441
- this.facts.filter(
2442
- (s) => !this.selectedFacts.includes(s)
2443
- ),
2444
- "name",
2445
- "asc"
2446
- ));
2447
- }
2448
- },
2449
- args: () => [
2450
- this.factsSrc,
2451
- this.filterFactText,
2452
- this.selectedFacts,
2453
- this.caching,
2454
- this.currentRoute
2455
- ]
2456
- });
2457
- }
2458
- async _afterAttach() {
2459
- return this.dspConnector = this.orbit?.components.find((t) => t.type === "dsp-connector"), Promise.resolve();
2460
- }
2461
- _showMoreResults() {
2462
- this.spliceLength += Math.floor((window.innerWidth - 800) / 354);
2463
- }
2464
- _showAllResults() {
2465
- this.spliceLength = this.facts.length;
2466
- }
2467
- async _createFactBundle() {
2468
- if (!this.bundleName || !(this.selectedFacts.length > 0))
2469
- return;
2470
- const t = {
2471
- "@context": [
2472
- "https://cdn.startinblox.com/owl/context.jsonld",
2473
- "https://cdn.startinblox.com/owl/ds4go.jsonld"
2474
- ],
2475
- "@type": ["ldp:Container", "ds4go:FactBundle"],
2476
- name: this.bundleName,
2477
- description: this.bundleDescription || "",
2478
- "ldp:contains": this.selectedFacts.map((s) => ({
2479
- "@id": s["@id"]
2480
- }))
2481
- }, r = await window.sibStore.post(
2482
- t,
2483
- this.dataSrc
2484
- );
2485
- if (document.dispatchEvent(
2486
- new CustomEvent("save", {
2487
- detail: { resource: { "@id": r } },
2488
- bubbles: !0
2489
- })
2490
- ), document.dispatchEvent(
2491
- new CustomEvent("save", {
2492
- detail: { resource: { "@id": this.dataSrc } },
2493
- bubbles: !0
2494
- })
2495
- ), this.dspConnector) {
2496
- const s = await window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(r)).then((c) => `sha-256:${Array.from(new Uint8Array(c)).map((d) => d.toString(16).padStart(2, "0")).join("")}`);
2497
- await this.dspConnector.instance?.createAsset({
2498
- "@id": `urn:asset-id:${s}`,
2499
- properties: {
2500
- name: this.bundleName,
2501
- description: this.bundleDescription,
2502
- contenttype: "application/ld+json",
2503
- language: this.bundleLanguage
2504
- },
2505
- dataAddress: {
2506
- "@type": "DataAddress",
2507
- type: "HttpData",
2508
- baseUrl: r
2509
- }
2510
- }), await Promise.all([
2511
- this.dspConnector.instance?.createPolicy({
2512
- "@id": `urn:access-policy-id:${s}`,
2513
- "@type": "PolicyDefinition",
2514
- policy: {
2515
- "@context": "http://www.w3.org/ns/odrl.jsonld",
2516
- ...this.policyTemplates.find(
2517
- (c) => c.id === this.bundleAccessPolicy
2518
- )?.policy
2519
- }
2520
- }),
2521
- this.dspConnector.instance?.createPolicy({
2522
- "@id": `urn:contract-policy-id:${s}`,
2523
- "@type": "PolicyDefinition",
2524
- policy: {
2525
- "@context": "http://www.w3.org/ns/odrl.jsonld",
2526
- ...this.policyTemplates.find(
2527
- (c) => c.id === this.bundleContractPolicy
2528
- )?.policy
2529
- }
2530
- }),
2531
- this.dspConnector.instance?.createContract({
2532
- "@id": `urn:contract-id:${s}`,
2533
- "@type": "ContractDefinition",
2534
- accessPolicyId: `urn:access-policy-id:${s}`,
2535
- contractPolicyId: `urn:contract-policy-id:${s}`,
2536
- assetsSelector: [
2537
- {
2538
- "@type": "Criterion",
2539
- operandLeft: "https://w3id.org/edc/v0.0.1/ns/id",
2540
- operator: "=",
2541
- operandRight: `urn:asset-id:${s}`
2542
- }
2543
- ]
2544
- })
2545
- ]);
2546
- const o = document.querySelector(
2547
- "solid-tems-assets-management"
2548
- );
2549
- o && o.loadAssets();
2550
- const n = document.querySelector(
2551
- "solid-tems-policies-management"
2552
- );
2553
- n && n.loadPolicies();
2554
- const a = document.querySelector(
2555
- "solid-tems-contracts-management"
2556
- );
2557
- a && a.loadData();
2558
- }
2559
- this.bundleName = "", this.bundleDescription = "", this.selectedFacts = [];
2560
- const i = this.orbit?.components.find((s) => s.type === "fact-bundle");
2561
- document.dispatchEvent(
2562
- new CustomEvent("save", {
2563
- detail: { resource: { "@id": i?.defaultDataSrc } },
2564
- bubbles: !0
2565
- })
2566
- ), i && L(
2567
- i?.route,
2568
- i?.defaultDataSrc
2569
- );
2570
- }
2571
- _updateBundleName(t) {
2572
- this.bundleName = t.detail.value;
2573
- }
2574
- _updateBundleDescription(t) {
2575
- this.bundleDescription = t.detail.value;
2576
- }
2577
- _updateBundleLanguage(t) {
2578
- this.bundleLanguage = t.detail.value;
2579
- }
2580
- _selectBundleAccessPolicy(t) {
2581
- t.preventDefault(), t.target && (this.bundleAccessPolicy = t.target.value);
2582
- }
2583
- _selectBundleContractPolicy(t) {
2584
- t.preventDefault(), t.target && (this.bundleContractPolicy = t.target.value);
2585
- }
2586
- _toggleFactSelection(t) {
2587
- this.selectedFacts.includes(t) ? this.selectedFacts = this.selectedFacts.filter((r) => r !== t) : this.selectedFacts = [...this.selectedFacts, t];
2588
- }
2589
- _searchFacts(t) {
2590
- this.filterFactText = t.detail;
2591
- }
2592
- render() {
2593
- return this.gatekeeper() || this._getResource.render({
2594
- pending: () => f`<solid-loader></solid-loader>`,
2595
- error: (t) => (console.warn("[solid-fact-bundle-creation] Task error:", t), l),
2596
- complete: (t) => {
2597
- if (!t) return l;
2598
- const r = t.slice(0, this.spliceLength), i = this.selectedFacts.length, s = !!this.bundleName && i > 0 && !!this.bundleLanguage && !!this.bundleAccessPolicy && !!this.bundleContractPolicy;
2599
- return f`<tems-viewport>
2600
- <tems-header slot="header" heading=${this.header}>
2601
- <div slot="cta">
2602
- <tems-button
2603
- type="primary"
2604
- disabled=${!s || l}
2605
- label=${h("Create bundle")}
2606
- @click=${this._createFactBundle}
2607
- ></tems-button>
2608
- </div>
2609
- </tems-header>
2610
- <div slot="content">
2611
- <section class="flex flex-1">
2612
- <div>
2613
- <div>
2614
- <tems-input
2615
- type="text"
2616
- label=${h("Bundle name")}
2617
- placeholder=${h("Bundle name")}
2618
- required=""
2619
- .value=${this.bundleName}
2620
- @change=${this._updateBundleName}
2621
- ></tems-input>
2622
- </div>
2623
- <div>
2624
- <tems-textarea
2625
- rows="4"
2626
- label=${h("Bundle description")}
2627
- placeholder=${h("Bundle description")}
2628
- .value=${this.bundleDescription}
2629
- @change=${this._updateBundleDescription}
2630
- ></tems-textarea>
2631
- </div>
2632
- <div>
2633
- <tems-input
2634
- type="text"
2635
- label=${h("Language")}
2636
- placeholder=${h("Language code (en, de, es, fr...)")}
2637
- hint=${h("Comma-separated, eg.: en,de,es,fr)")}
2638
- required=""
2639
- .value=${this.bundleLanguage}
2640
- @change=${this._updateBundleLanguage}
2641
- ></tems-input>
2642
- </div>
2643
- <div class="select">
2644
- <tems-label label=${h("Access policy")}></tems-label>
2645
- <select @change=${this._selectBundleAccessPolicy}>
2646
- ${this.policyTemplates.map((o) => f`<option
2647
- value="${o.id}"
2648
- ?selected="${o.id === this.bundleAccessPolicy}"
2649
- >
2650
- ${o.name}
2651
- </option>`)}
2652
- </select>
2653
- </div>
2654
- <div class="select">
2655
- <tems-label label=${h("Contract policy")}></tems-label>
2656
- <select @change=${this._selectBundleContractPolicy}>
2657
- ${this.policyTemplates.map((o) => f`<option
2658
- value="${o.id}"
2659
- ?selected="${o.id === this.bundleContractPolicy}"
2660
- >
2661
- ${o.name}
2662
- </option>`)}
2663
- </select>
2664
- </div>
2665
- ${i > 0 ? f`<tems-division type="h4">
2666
- <div>
2667
- ${h(
2668
- R`${i} selected fact${i > 1 ? "s" : ""}`
2669
- )}
2670
- </div></tems-division
2671
- >
2672
- <div class="card-grid card-grid-vertical">
2673
- ${this.selectedFacts.map((o) => {
2674
- const n = o.categories.map((a) => ({
2675
- name: a.name,
2676
- type: "information"
2677
- }));
2678
- if (n.length > 3) {
2679
- const a = n.length - 3;
2680
- n.splice(3, a), n.push({
2681
- name: `+${a} ${h("more")}`,
2682
- type: "information"
2683
- });
2684
- }
2685
- return f`<tems-card-catalog
2686
- .object=${l}
2687
- .header=${o.name || l}
2688
- date=${o.updated_at || l}
2689
- @click=${this._toggleFactSelection.bind(
2690
- this,
2691
- o
2692
- )}
2693
- selected=${!0}
2694
- ></tems-card-catalog>`;
2695
- })}
2696
- </div>` : l}
2697
- </div>
2698
- ${r.length > 0 || this.filterFactText ? f`<div>
2699
- <div>
2700
- <tems-search-bar
2701
- .displayFilters=${!1}
2702
- .displaySavedSearch=${!1}
2703
- .displayViews=${!1}
2704
- .dropdownCardElement=${!1}
2705
- .dropdownListElement=${!1}
2706
- .dropdownTableElement=${!1}
2707
- .dropdownMapElement=${!1}
2708
- .displayActiveTags=${!1}
2709
- .value=${this.filterFactText}
2710
- @search=${this._searchFacts}
2711
- ></tems-search-bar>
2712
- </div>
2713
- ${r.length > 0 ? f` <div class="card-grid card-grid-vertical">
2714
- ${r.map((o) => {
2715
- const n = o.categories.map(
2716
- (a) => ({
2717
- name: a.name,
2718
- type: "information"
2719
- })
2720
- );
2721
- if (n.length > 3) {
2722
- const a = n.length - 3;
2723
- n.splice(3, a), n.push({
2724
- name: `+${a} ${h("more")}`,
2725
- type: "information"
2726
- });
2727
- }
2728
- return f`<tems-card-catalog
2729
- .object=${l}
2730
- .tags=${n}
2731
- .header=${o.name || l}
2732
- .content=${o.description || l}
2733
- date=${o.updated_at || l}
2734
- @click=${this._toggleFactSelection.bind(
2735
- this,
2736
- o
2737
- )}
2738
- ></tems-card-catalog>`;
2739
- })}
2740
- </div>
2741
- ${r.length < t.length ? f`<div
2742
- class="flex flex-row justify-content-space-between align-items-flex-end"
2743
- >
2744
- <div>
2745
- ${h(
2746
- R`Displaying ${r.length} of ${t.length} result${t.length > 1 ? "s" : ""}`
2747
- )}
2748
- </div>
2749
- <div class="flex flex-row gap-400">
2750
- <tems-button
2751
- @click=${this._showMoreResults}
2752
- type="primary"
2753
- size="sm"
2754
- label=${h("Show more results")}
2755
- ></tems-button>
2756
- <tems-button
2757
- @click=${this._showAllResults}
2758
- type="primary"
2759
- size="sm"
2760
- label=${h("Show all results")}
2761
- ></tems-button>
2762
- </div>
2763
- </div>` : l}` : f`${h("No results found")}
2764
- ${this.filterFactText ? `for "${this.filterFactText}".` : ""}`}
2765
- </div>` : l}
2766
- </section>
2767
- </div>
2768
- </tems-viewport>`;
2769
- }
2770
- });
2771
- }
2772
- };
2773
- b.styles = [Et(Ir)];
2774
- _([
2775
- v({ attribute: "header", type: String })
2776
- ], b.prototype, "header", 2);
2777
- _([
2778
- v({ attribute: "facts-src", reflect: !0 })
2779
- ], b.prototype, "factsSrc", 2);
2780
- _([
2781
- m()
2782
- ], b.prototype, "selectedFacts", 2);
2783
- _([
2784
- m()
2785
- ], b.prototype, "bundleName", 2);
2786
- _([
2787
- m()
2788
- ], b.prototype, "bundleDescription", 2);
2789
- _([
2790
- m()
2791
- ], b.prototype, "bundleLanguage", 2);
2792
- _([
2793
- m()
2794
- ], b.prototype, "bundleAccessPolicy", 2);
2795
- _([
2796
- m()
2797
- ], b.prototype, "bundleContractPolicy", 2);
2798
- _([
2799
- m()
2800
- ], b.prototype, "filterFactText", 2);
2801
- _([
2802
- m()
2803
- ], b.prototype, "spliceLength", 2);
2804
- _([
2805
- m()
2806
- ], b.prototype, "dspConnector", 2);
2807
- b = _([
2808
- M("solid-fact-bundle-creation")
2809
- ], b);
2810
- var Mr = Object.defineProperty, Br = Object.getOwnPropertyDescriptor, st = (e, t, r, i) => {
2811
- for (var s = i > 1 ? void 0 : i ? Br(t, r) : t, o = e.length - 1, n; o >= 0; o--)
2812
- (n = e[o]) && (s = (i ? n(t, r, s) : n(s)) || s);
2813
- return i && s && Mr(t, r, s), s;
2814
- };
2815
- let N = class extends $ {
2816
- constructor() {
2817
- super(...arguments), this.header = "DS4GO Fact Bundling", this.search = [], this.resultCount = this.objects?.length || 0, this.cherryPickedProperties = [
2818
- { key: "created_at", value: "created_at", cast: I },
2819
- { key: "updated_at", value: "updated_at", cast: I },
2820
- { key: "name", value: "name" },
2821
- { key: "description", value: "description" }
2822
- ], this._getResource = new rt(this, {
2823
- task: async ([e, t]) => {
2824
- if (!(!e || !this.orbit || !this.noRouter && this.route && this.currentRoute && !this.route.startsWith(this.currentRoute))) {
2825
- if (this.menuComponent.ready || await new Promise((r) => {
2826
- this.menuComponent.addEventListener("user-ready", () => {
2827
- r(!0);
2828
- });
2829
- }), this.displayFiltering = !this.component.parameters.disableFiltering, !this.hasCachedDatas || this.oldDataSrc !== e) {
2830
- if (!e) return;
2831
- this.objects = await this._getProxyValue(e), this.hasCachedDatas = !0;
2832
- }
2833
- return this.oldDataSrc !== e && (this.oldDataSrc = e), Array.isArray(this.objects) || (this.objects = []), t ? this.object = this.objects.find(
2834
- (r) => r["@id"] === t
2835
- ) : this.dataSrc = e, S(this.objects, "name", "asc");
2836
- }
2837
- },
2838
- args: () => [
2839
- this.defaultDataSrc,
2840
- this.dataSrc,
2841
- this.caching,
2842
- this.currentRoute
2843
- ]
2844
- });
2845
- }
2846
- async _responseAdaptator(e) {
2847
- return e?._originalResource?.hasType("ds4go:FactBundle") && (e.facts = await Promise.all(
2848
- (await e._originalResource["ldp:contains"]).map(
2849
- (t) => this._getProxyValue(t["@id"], !1, [
2850
- { key: "updated_at", value: "updated_at", cast: I },
2851
- { key: "name", value: "name" },
2852
- { key: "description", value: "description" },
2853
- {
2854
- key: "categories",
2855
- value: "categories",
2856
- expand: !0,
2857
- cast: (r) => S(r, "name")
2858
- },
2859
- { key: "author", value: "author" },
2860
- { key: "link", value: "link" },
2861
- { key: "enclosure", value: "enclosure" },
2862
- { key: "medias", value: "medias", expand: !0 },
2863
- { key: "url", value: "url" },
2864
- { key: "file_size", value: "file_size" },
2865
- { key: "file_type", value: "file_type" },
2866
- { key: "width", value: "width" },
2867
- { key: "height", value: "height" }
2868
- // Can't get raw review json, as store does not support datas without ids
2869
- // { key: "review", value: "review" },
2870
- ])
2871
- )
2872
- )), Promise.resolve(e);
2873
- }
2874
- async _afterAttach() {
2875
- return oe(this, {
2876
- keywords: ["factbundles"]
2877
- }), this.menuComponent = document.querySelector(
2878
- `[uniq="${this.orbit?.getComponent("menu")?.uniq}"]`
2879
- ), this.bundleCreationComponent = this.orbit?.components.find((e) => e.type === "fact-bundle-creation"), Promise.resolve();
2880
- }
2881
- _search(e) {
2882
- e.preventDefault(), this.search = e.detail, this.filterCount = this.search.filter((t) => t.name !== "search").length;
2883
- }
2884
- _openModal(e) {
2885
- if (e.preventDefault(), this.route)
2886
- if ("use-id" in (this.component.routeAttributes || {}))
2887
- L(this.route, e.detail["@id"]);
2888
- else {
2889
- const t = e.detail["@type"]?.at(-1) ?? e.detail["@type"];
2890
- if (t) {
2891
- const r = window.orbit?.components?.filter(
2892
- (i) => i?.routeAttributes?.["rdf-type"] === t
2893
- );
2894
- r?.[0]?.route && L(r[0]?.route, e.detail["@id"]);
2895
- }
2896
- }
2897
- }
2898
- _closeModal(e) {
2899
- e.preventDefault(), this.route && L(this.route, this.defaultDataSrc);
2900
- }
2901
- _closeModalFromBackground(e) {
2902
- e.preventDefault(), this.route && e.target?.classList.contains("modal") && L(this.route, this.defaultDataSrc);
2903
- }
2904
- _resultCountUpdate(e) {
2905
- this.resultCount = e.detail ?? 0;
2906
- }
2907
- _goToBundleCreation(e) {
2908
- e.preventDefault(), this.bundleCreationComponent?.route && L(this.bundleCreationComponent.route);
2909
- }
2910
- render() {
2911
- return this.gatekeeper() || this._getResource.render({
2912
- pending: () => f`<solid-loader></solid-loader>`,
2913
- error: (e) => (console.warn("[solid-fact-bundle] Task error:", e), l),
2914
- complete: (e) => f`<tems-viewport>
2915
- <tems-header slot="header" heading=${this.header}>
2916
- <div slot="cta">
2917
- <tems-button
2918
- type="primary"
2919
- disabled=${!this.bundleCreationComponent?.route || l}
2920
- label=${h("Create a bundle")}
2921
- @click=${this._goToBundleCreation}
2922
- ></tems-button>
2923
- </div>
2924
- </tems-header>
2925
- <div slot="content">
2926
- <tems-catalog-filter-holder
2927
- .displayFiltering=${this.displayFiltering}
2928
- @search=${this._search}
2929
- .search=${this.search}
2930
- .objects=${e}
2931
- .resultCount=${this.resultCount}
2932
- .filterCount=${this.filterCount}
2933
- ></tems-catalog-filter-holder>
2934
- <ds4go-fact-bundle-holder
2935
- .objects=${e}
2936
- .search=${this.search}
2937
- @clicked=${this._openModal}
2938
- @result-count=${this._resultCountUpdate}
2939
- ></ds4go-fact-bundle-holder>
2940
- ${this.object ? f`<div
2941
- class="modal"
2942
- @click=${this._closeModalFromBackground}
2943
- >
2944
- <ds4go-fact-bundle-modal
2945
- .object=${this.object}
2946
- @close=${this._closeModal}
2947
- ></ds4go-fact-bundle-modal>
2948
- </div>` : l}
2949
- </div>
2950
- </tems-viewport>`
2951
- });
2952
- }
2953
- };
2954
- N.styles = tt`
2955
- .modal {
2956
- position: fixed;
2957
- top: 0;
2958
- left: 0;
2959
- right: 0;
2960
- bottom: 0;
2961
- background-color: rgba(0, 2, 49, 0.2);
2962
- z-index: 9999;
2963
- display: flex;
2964
- justify-content: center;
2965
- align-items: center;
2966
- }
2967
- `;
2968
- st([
2969
- v({ attribute: "header", type: String })
2970
- ], N.prototype, "header", 2);
2971
- st([
2972
- m()
2973
- ], N.prototype, "search", 2);
2974
- st([
2975
- m()
2976
- ], N.prototype, "resultCount", 2);
2977
- st([
2978
- m()
2979
- ], N.prototype, "bundleCreationComponent", 2);
2980
- N = st([
2981
- M("solid-fact-bundle")
2982
- ], N);
2983
- const qr = {
2984
- s20acf344316637a0: "All Catalogs",
2985
- s67269ab6dc51ec41: R`Error while loading catalog ${0}`,
2986
- s0b88896b7338837d: "All Datasets",
2987
- s541d9cd11a5bc840: "Datasets from",
2988
- s01ceffa02fa6bd7f: "All Sectors",
2989
- s4aaac20ff7887391: "Catalogs available in",
2990
- sa89a60c3e1230cec: "Root Authority",
2991
- se5784a16a6799dad: R`Back to ${0}`,
2992
- s6665daa6d6147db0: "No data available, data source may be temporarily unavailable.",
2993
- sc16e00a7a8b2fde2: "Back",
2994
- s2c8189544e3ea679: "Retry",
2995
- sc7e3b594ffcd9d61: "Open access",
2996
- seb1a452f2df70baf: "Create bundle",
2997
- sed5b6ae54e00125c: "Bundle name",
2998
- s11099da36cbc3173: "Bundle description",
2999
- sefcf950b3cc4fc3b: "Language",
3000
- s6ae6714aac4ba43d: "Language code (en, de, es, fr...)",
3001
- s21fb127cabcd5617: "Comma-separated, eg.: en,de,es,fr)",
3002
- sa6ef22f7e7e95e2b: "Access policy",
3003
- s6de61424bb681993: "Contract policy",
3004
- sac1b0231875ff056: R`${0} selected fact${1}`,
3005
- s0d1be7a2c400c080: "more",
3006
- s8272d3578b7c78d5: R`Displaying ${0} of ${1} result${2}`,
3007
- sa40e7f4f2a43e2f7: "Show more results",
3008
- sacf246e0fa11730d: "Show all results",
3009
- s9094c0cde8fb5058: "No results found",
3010
- sf5509a9f253b9836: "Create a bundle",
3011
- sefa717c1620c4ae4: "facts",
3012
- sef234a791696afff: "fact",
3013
- s4979bd417e7c8052: "All facts in this bundle",
3014
- s57a40de45f324b96: "Bundle created on",
3015
- sd3682395cf86f913: "Bundle updated on"
3016
- }, Hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3017
- __proto__: null,
3018
- templates: qr
3019
- }, Symbol.toStringTag, { value: "Module" })), zr = "en", fe = [
3020
- "en"
3021
- ], Vr = /* @__PURE__ */ Object.assign({ "../../generated/locales/en.ts": Hr }), Wr = new Map(
3022
- fe.map((e) => [
3023
- e,
3024
- Vr[`../../generated/locales/${e}.ts`]
3025
- ])
3026
- ), { getLocale: Qt, setLocale: Yt } = _r({
3027
- sourceLocale: zr,
3028
- targetLocales: fe,
3029
- loadLocale: async (e) => Wr.get(e)
3030
- });
3031
- window.getLocale = window.getLocale ? window.getLocale.push(Qt) : [Qt];
3032
- window.setLocale = window.setLocale ? window.setLocale.push(Yt) : [Yt];
1
+ import "./index-BSwVRtNS.js";