@luzmo/embed 6.0.0-beta.0 → 6.0.0-beta.1

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.
@@ -43,856 +43,867 @@ var __decorateClass = (decorators, target, key, kind) => {
43
43
  var src_exports2 = {};
44
44
  __export(src_exports2, {
45
45
  LuzmoEmbedDashboard: () => LuzmoEmbedDashboard,
46
- LuzmoEmbedVizItem: () => LuzmoEmbedVizItem
46
+ LuzmoEmbedVizItem: () => LuzmoEmbedVizItem,
47
+ filterUtils: () => filterUtils
47
48
  });
48
49
  module.exports = __toCommonJS(src_exports2);
49
50
 
50
- // node_modules/@lit/reactive-element/decorators/custom-element.js
51
- var t = (t5) => (e7, o6) => {
52
- void 0 !== o6 ? o6.addInitializer(() => {
53
- customElements.define(t5, e7);
54
- }) : customElements.define(t5, e7);
51
+ // libs/embed-libs/shared-embed/src/lib/helpers/error.ts
52
+ var _handleError = (errorMessage, parameters) => {
53
+ let message = "The dashboard component encountered an error";
54
+ if (typeof parameters?.dashboardId === "string") {
55
+ message += ` for dashboard with id ${parameters.dashboardId}`;
56
+ }
57
+ if (typeof parameters?.dashboardSlug === "string") {
58
+ message += ` for dashboard with slug ${parameters.dashboardSlug}`;
59
+ }
60
+ if (typeof parameters?.container === "string") {
61
+ message += ` in container ${parameters.container}`;
62
+ }
63
+ if (errorMessage) {
64
+ message += `:
65
+ ${errorMessage}`;
66
+ console.warn(message);
67
+ }
55
68
  };
56
69
 
57
- // node_modules/@lit/reactive-element/css-tag.js
58
- var t2 = globalThis;
59
- var e = t2.ShadowRoot && (void 0 === t2.ShadyCSS || t2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
60
- var s = Symbol();
61
- var o = /* @__PURE__ */ new WeakMap();
62
- var n = class {
63
- constructor(t5, e7, o6) {
64
- if (this._$cssResult$ = true, o6 !== s)
65
- throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
66
- this.cssText = t5, this.t = e7;
67
- }
68
- get styleSheet() {
69
- let t5 = this.o;
70
- const s4 = this.t;
71
- if (e && void 0 === t5) {
72
- const e7 = void 0 !== s4 && 1 === s4.length;
73
- e7 && (t5 = o.get(s4)), void 0 === t5 && ((this.o = t5 = new CSSStyleSheet()).replaceSync(this.cssText), e7 && o.set(s4, t5));
70
+ // libs/embed-libs/shared-embed/src/lib/helpers/browser-check.ts
71
+ var _browserCheck = (dashboardComponent) => {
72
+ let hasError = false;
73
+ let errorMessage = "";
74
+ const document_ = document.body || document.documentElement;
75
+ const style = document_.style;
76
+ const browserCheck = {
77
+ svg: !!("createElementNS" in document && document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect),
78
+ flexbox: style.webkitFlexWrap === "" || style.flexWrap === "",
79
+ postMessage: !!window.postMessage
80
+ };
81
+ const browserCheckKeys = ["svg", "flexbox", "postMessage"];
82
+ for (const key of browserCheckKeys) {
83
+ if (!browserCheck[key]) {
84
+ hasError = true;
85
+ dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
86
+ dashboardComponent.browserNotSupported.push(key);
87
+ errorMessage += `Your browser does not support: ${key}
88
+ `;
74
89
  }
75
- return t5;
76
90
  }
77
- toString() {
78
- return this.cssText;
91
+ const ua = window.navigator.userAgent;
92
+ const msie = ua.includes("MSIE");
93
+ const trident = ua.includes("Trident/");
94
+ if (msie || trident) {
95
+ hasError = true;
96
+ errorMessage = "IE is not supported.";
97
+ }
98
+ if (hasError) {
99
+ _handleError(errorMessage);
79
100
  }
80
101
  };
81
- var r = (t5) => new n("string" == typeof t5 ? t5 : t5 + "", void 0, s);
82
- var i = (t5, ...e7) => {
83
- const o6 = 1 === t5.length ? t5[0] : e7.reduce((e8, s4, o7) => e8 + ((t6) => {
84
- if (true === t6._$cssResult$)
85
- return t6.cssText;
86
- if ("number" == typeof t6)
87
- return t6;
88
- throw Error("Value passed to 'css' function must be a 'css' function result: " + t6 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
89
- })(s4) + t5[o7 + 1], t5[0]);
90
- return new n(o6, t5, s);
91
- };
92
- var S = (s4, o6) => {
93
- if (e)
94
- s4.adoptedStyleSheets = o6.map((t5) => t5 instanceof CSSStyleSheet ? t5 : t5.styleSheet);
95
- else
96
- for (const e7 of o6) {
97
- const o7 = document.createElement("style"), n6 = t2.litNonce;
98
- void 0 !== n6 && o7.setAttribute("nonce", n6), o7.textContent = e7.cssText, s4.appendChild(o7);
99
- }
102
+
103
+ // libs/embed-libs/shared-embed/src/lib/helpers/default-parameters.ts
104
+ var DEFAULT_PARAMETERS = {
105
+ appServer: "https://app.luzmo.com/",
106
+ apiHost: "https://api.luzmo.com/",
107
+ dashboardId: null,
108
+ dashboardSlug: null,
109
+ container: null,
110
+ key: null,
111
+ token: null,
112
+ language: "auto",
113
+ qeVersion: null,
114
+ editMode: null,
115
+ screenMode: null,
116
+ switchScreenModeOnResize: true,
117
+ itemId: null,
118
+ mainColor: "",
119
+ accentColor: "",
120
+ itemDimensions: {
121
+ width: "auto",
122
+ height: "auto"
123
+ },
124
+ loaderBackground: "#f9f9f9",
125
+ loaderFontColor: "#5a5a5a",
126
+ loaderSpinnerColor: "rgba(255, 165, 0, 0.7)",
127
+ loaderSpinnerBackground: "rgba(169, 169, 169, 0.14)",
128
+ timezoneId: null,
129
+ contextId: null
100
130
  };
101
- var c = e ? (t5) => t5 : (t5) => t5 instanceof CSSStyleSheet ? ((t6) => {
102
- let e7 = "";
103
- for (const s4 of t6.cssRules)
104
- e7 += s4.cssText;
105
- return r(e7);
106
- })(t5) : t5;
107
131
 
108
- // node_modules/@lit/reactive-element/reactive-element.js
109
- var { is: i2, defineProperty: e2, getOwnPropertyDescriptor: r2, getOwnPropertyNames: h, getOwnPropertySymbols: o2, getPrototypeOf: n2 } = Object;
110
- var a = globalThis;
111
- var c2 = a.trustedTypes;
112
- var l = c2 ? c2.emptyScript : "";
113
- var p = a.reactiveElementPolyfillSupport;
114
- var d = (t5, s4) => t5;
115
- var u = { toAttribute(t5, s4) {
116
- switch (s4) {
117
- case Boolean:
118
- t5 = t5 ? l : null;
119
- break;
120
- case Object:
121
- case Array:
122
- t5 = null == t5 ? t5 : JSON.stringify(t5);
123
- }
124
- return t5;
125
- }, fromAttribute(t5, s4) {
126
- let i6 = t5;
127
- switch (s4) {
128
- case Boolean:
129
- i6 = null !== t5;
130
- break;
131
- case Number:
132
- i6 = null === t5 ? null : Number(t5);
133
- break;
134
- case Object:
135
- case Array:
136
- try {
137
- i6 = JSON.parse(t5);
138
- } catch (t6) {
139
- i6 = null;
140
- }
132
+ // libs/embed-libs/shared-embed/src/lib/helpers/extents.ts
133
+ var EXTENTS = [
134
+ { mode: "mobile", width: [150, 767] },
135
+ { mode: "tablet", width: [768, 1199] },
136
+ { mode: "desktop", width: [1200, 1599] },
137
+ { mode: "largeScreen", width: [1600, 9999] },
138
+ { mode: "fixed", width: [] }
139
+ ];
140
+
141
+ // libs/embed-libs/shared-embed/src/lib/helpers/translations.ts
142
+ var TRANSLATIONS = {
143
+ initializing: { en: "Initializing...", nl: "Laden...", fr: "Chargement..." },
144
+ errorDashboard: {
145
+ en: "Oops, we could not load this dashboard!",
146
+ nl: "Oeps, we konden het dashboard niet laden.",
147
+ fr: "Le chargement a echou\xE9."
148
+ },
149
+ errorItem: {
150
+ en: "Oops, we could not load this item!",
151
+ nl: "Oeps, we konden de grafiek niet laden.",
152
+ fr: "Le chargement a echou\xE9."
141
153
  }
142
- return i6;
143
- } };
144
- var f = (t5, s4) => !i2(t5, s4);
145
- var y = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
146
- Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
147
- var b = class extends HTMLElement {
148
- static addInitializer(t5) {
149
- this._$Ei(), (this.l ??= []).push(t5);
154
+ };
155
+ var translations_default = TRANSLATIONS;
156
+
157
+ // libs/embed-libs/shared-embed/src/lib/helpers/utils.ts
158
+ var addTrailingSlash = (serverUrl) => {
159
+ if (!serverUrl) {
160
+ return "";
150
161
  }
151
- static get observedAttributes() {
152
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
162
+ return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
163
+ };
164
+ var removeTrailingSlash = (serverUrl) => {
165
+ if (!serverUrl) {
166
+ return "";
153
167
  }
154
- static createProperty(t5, s4 = y) {
155
- if (s4.state && (s4.attribute = false), this._$Ei(), this.elementProperties.set(t5, s4), !s4.noAccessor) {
156
- const i6 = Symbol(), r7 = this.getPropertyDescriptor(t5, i6, s4);
157
- void 0 !== r7 && e2(this.prototype, t5, r7);
168
+ return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
169
+ };
170
+ var formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
171
+ const combineRights = (securable, user2) => {
172
+ const matchingUser = securable.users.find((u3) => u3.id === user2.id);
173
+ const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
174
+ flagRead: matchingUser.userAccessRight.flagRead,
175
+ flagUse: matchingUser.userAccessRight.flagUse,
176
+ flagModify: matchingUser.userAccessRight.flagModify,
177
+ flagOwn: matchingUser.userAccessRight.flagOwn
178
+ } : {
179
+ flagRead: false,
180
+ flagUse: false,
181
+ flagModify: false,
182
+ flagOwn: false
183
+ };
184
+ const groups = securable.groups.filter(
185
+ (group) => user2.userGroups.includes(group.id) || group.public === true
186
+ );
187
+ const groupsAccess = groups.map((group) => {
188
+ if (group.groupAccessRight) {
189
+ return group.groupAccessRight;
190
+ }
191
+ });
192
+ for (const groupAccess of groupsAccess) {
193
+ if (!securableAccessRights.flagRead && groupAccess.flagRead) {
194
+ securableAccessRights.flagRead = groupAccess.flagRead;
195
+ }
196
+ if (!securableAccessRights.flagUse && groupAccess.flagUse) {
197
+ securableAccessRights.flagUse = groupAccess.flagUse;
198
+ }
199
+ if (!securableAccessRights.flagModify && groupAccess.flagModify) {
200
+ securableAccessRights.flagModify = groupAccess.flagModify;
201
+ }
202
+ if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
203
+ securableAccessRights.flagOwn = groupAccess.flagOwn;
204
+ }
158
205
  }
159
- }
160
- static getPropertyDescriptor(t5, s4, i6) {
161
- const { get: e7, set: h3 } = r2(this.prototype, t5) ?? { get() {
162
- return this[s4];
163
- }, set(t6) {
164
- this[s4] = t6;
165
- } };
166
- return { get() {
167
- return e7?.call(this);
168
- }, set(s5) {
169
- const r7 = e7?.call(this);
170
- h3.call(this, s5), this.requestUpdate(t5, r7, i6);
171
- }, configurable: true, enumerable: true };
172
- }
173
- static getPropertyOptions(t5) {
174
- return this.elementProperties.get(t5) ?? y;
175
- }
176
- static _$Ei() {
177
- if (this.hasOwnProperty(d("elementProperties")))
178
- return;
179
- const t5 = n2(this);
180
- t5.finalize(), void 0 !== t5.l && (this.l = [...t5.l]), this.elementProperties = new Map(t5.elementProperties);
181
- }
182
- static finalize() {
183
- if (this.hasOwnProperty(d("finalized")))
184
- return;
185
- if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
186
- const t6 = this.properties, s4 = [...h(t6), ...o2(t6)];
187
- for (const i6 of s4)
188
- this.createProperty(i6, t6[i6]);
206
+ const integrationsAccess = securable.integrations?.length > 0 ? securable.integrations.map((integration) => {
207
+ if (integration.integrationAccessRight) {
208
+ return integration.integrationAccessRight;
209
+ }
210
+ }) : [];
211
+ for (const integrationAccess of integrationsAccess) {
212
+ if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
213
+ securableAccessRights.flagRead = integrationAccess.flagRead;
214
+ }
215
+ if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
216
+ securableAccessRights.flagUse = integrationAccess.flagUse;
217
+ }
218
+ if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
219
+ securableAccessRights.flagModify = integrationAccess.flagModify;
220
+ }
189
221
  }
190
- const t5 = this[Symbol.metadata];
191
- if (null !== t5) {
192
- const s4 = litPropertyMetadata.get(t5);
193
- if (void 0 !== s4)
194
- for (const [t6, i6] of s4)
195
- this.elementProperties.set(t6, i6);
222
+ return securableAccessRights;
223
+ };
224
+ const localize = (item, locale) => {
225
+ if (item === null || item === void 0) {
226
+ return "";
196
227
  }
197
- this._$Eh = /* @__PURE__ */ new Map();
198
- for (const [t6, s4] of this.elementProperties) {
199
- const i6 = this._$Eu(t6, s4);
200
- void 0 !== i6 && this._$Eh.set(i6, t6);
228
+ if (typeof item !== "object" || Object.keys(item).length === 0) {
229
+ if (typeof item === "object" && Object.keys(item).length === 0) {
230
+ return "";
231
+ }
232
+ return item;
201
233
  }
202
- this.elementStyles = this.finalizeStyles(this.styles);
203
- }
204
- static finalizeStyles(s4) {
205
- const i6 = [];
206
- if (Array.isArray(s4)) {
207
- const e7 = new Set(s4.flat(1 / 0).reverse());
208
- for (const s5 of e7)
209
- i6.unshift(c(s5));
210
- } else
211
- void 0 !== s4 && i6.push(c(s4));
212
- return i6;
234
+ let localizedItem;
235
+ localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
236
+ if (localizedItem === void 0 || localizedItem === null) {
237
+ localizedItem = "";
238
+ }
239
+ return localizedItem;
240
+ };
241
+ const treatedDashboards = [];
242
+ for (const dashboard of dashboards) {
243
+ const treatedDashboard = {
244
+ accessibleBy: [],
245
+ accessRights: combineRights(dashboard, user),
246
+ id: dashboard.id,
247
+ modifiedAt: dashboard.modified_at,
248
+ name: localize(dashboard.name, dashboardComponent.language),
249
+ slug: null,
250
+ tags: dashboard.tags.map((t5) => t5.tag).sort((t1, t22) => t1.localeCompare(t22))
251
+ };
252
+ const currentIntegration = dashboard.integrations.find(
253
+ (i6) => i6.id === integrationId
254
+ );
255
+ if (currentIntegration?.integrationAccessRight?.slug) {
256
+ treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
257
+ }
258
+ const users = dashboard.users.map((u3) => ({
259
+ model: "User",
260
+ id: u3.id,
261
+ name: localize(u3.name, user.locale_id)
262
+ }));
263
+ const groups = dashboard.groups.map((g2) => ({
264
+ model: "Group",
265
+ id: g2.id,
266
+ name: localize(g2.name, user.locale_id) || {}
267
+ }));
268
+ const integrations = dashboard.integrations.map((i6) => ({
269
+ model: "Integration",
270
+ id: i6.id,
271
+ name: localize(i6.name, user.locale_id) || {}
272
+ }));
273
+ treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
274
+ treatedDashboards.push(treatedDashboard);
213
275
  }
214
- static _$Eu(t5, s4) {
215
- const i6 = s4.attribute;
216
- return false === i6 ? void 0 : "string" == typeof i6 ? i6 : "string" == typeof t5 ? t5.toLowerCase() : void 0;
276
+ return treatedDashboards;
277
+ };
278
+ var VERSION = "0.0.0-unknown-luzmo";
279
+ var sanitizeUrl = (url) => {
280
+ const invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
281
+ const ctrlCharactersRegex = /[^\u0020-\u007E]/gim;
282
+ const urlSchemeRegex = /^([^:]+):/gm;
283
+ const relativeFirstCharacters = /* @__PURE__ */ new Set([".", "/"]);
284
+ const isRelativeUrlWithoutProtocol = (relativeUrl) => relativeFirstCharacters.has(relativeUrl[0]);
285
+ if (!url) {
286
+ return "about:blank";
217
287
  }
218
- constructor() {
219
- super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
288
+ const sanitizedUrl = url.replaceAll(ctrlCharactersRegex, "").trim();
289
+ if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
290
+ return sanitizedUrl;
220
291
  }
221
- _$Ev() {
222
- this._$ES = new Promise((t5) => this.enableUpdating = t5), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t5) => t5(this));
292
+ const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
293
+ if (!urlSchemeParseResults) {
294
+ return sanitizedUrl;
223
295
  }
224
- addController(t5) {
225
- (this._$EO ??= /* @__PURE__ */ new Set()).add(t5), void 0 !== this.renderRoot && this.isConnected && t5.hostConnected?.();
296
+ const urlScheme = urlSchemeParseResults[0];
297
+ if (invalidPrototcolRegex.test(urlScheme)) {
298
+ return "about:blank";
226
299
  }
227
- removeController(t5) {
228
- this._$EO?.delete(t5);
300
+ return sanitizedUrl;
301
+ };
302
+ var cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
303
+ var isObject = (o6) => o6 && typeof o6 === "object";
304
+ var defaultsDeep = (target, defaults) => {
305
+ Object.entries(defaults).forEach(([k2, v2]) => {
306
+ if (k2 in target) {
307
+ if (target[k2] === void 0) {
308
+ target[k2] = v2;
309
+ } else {
310
+ target[k2] = isObject(v2) ? defaultsDeep(
311
+ target[k2],
312
+ v2
313
+ ) : target[k2];
314
+ }
315
+ } else {
316
+ target[k2] = v2;
317
+ }
318
+ });
319
+ return target;
320
+ };
321
+ var uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c4) {
322
+ const r7 = Math.random() * 16 | 0;
323
+ const v2 = c4 == "x" ? r7 : r7 & 3 | 8;
324
+ return v2.toString(16);
325
+ });
326
+
327
+ // libs/embed-libs/shared-embed/src/lib/helpers/iframe-url.ts
328
+ var createIframeUrl = (dashboardContent) => {
329
+ const searchString = [];
330
+ const {
331
+ appServer,
332
+ language,
333
+ qeVersion,
334
+ loaderBackground,
335
+ loaderSpinnerColor,
336
+ loaderSpinnerBackground,
337
+ loaderFontColor,
338
+ screenMode,
339
+ key,
340
+ token,
341
+ timezoneId,
342
+ itemEmbedding,
343
+ itemDimensions,
344
+ dashboardId,
345
+ dashboardSlug,
346
+ itemId,
347
+ mainColor,
348
+ accentColor,
349
+ editMode
350
+ } = dashboardContent.params;
351
+ if (language && language !== "auto") {
352
+ searchString.push("language=" + language);
229
353
  }
230
- _$E_() {
231
- const t5 = /* @__PURE__ */ new Map(), s4 = this.constructor.elementProperties;
232
- for (const i6 of s4.keys())
233
- this.hasOwnProperty(i6) && (t5.set(i6, this[i6]), delete this[i6]);
234
- t5.size > 0 && (this._$Ep = t5);
354
+ if (qeVersion) {
355
+ searchString.push(`qe_version=${qeVersion}`);
235
356
  }
236
- createRenderRoot() {
237
- const t5 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
238
- return S(t5, this.constructor.elementStyles), t5;
357
+ if (loaderBackground) {
358
+ searchString.push(`ldrbg=${loaderBackground}`);
239
359
  }
240
- connectedCallback() {
241
- this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t5) => t5.hostConnected?.());
360
+ if (loaderFontColor) {
361
+ searchString.push(`ldrftclr=${loaderFontColor}`);
242
362
  }
243
- enableUpdating(t5) {
363
+ if (loaderSpinnerColor) {
364
+ searchString.push(`ldrspclr=${loaderSpinnerColor}`);
244
365
  }
245
- disconnectedCallback() {
246
- this._$EO?.forEach((t5) => t5.hostDisconnected?.());
366
+ if (loaderSpinnerBackground) {
367
+ searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
247
368
  }
248
- attributeChangedCallback(t5, s4, i6) {
249
- this._$AK(t5, i6);
369
+ if (mainColor) {
370
+ searchString.push(`mainColor=${mainColor}`);
250
371
  }
251
- _$EC(t5, s4) {
252
- const i6 = this.constructor.elementProperties.get(t5), e7 = this.constructor._$Eu(t5, i6);
253
- if (void 0 !== e7 && true === i6.reflect) {
254
- const r7 = (void 0 !== i6.converter?.toAttribute ? i6.converter : u).toAttribute(s4, i6.type);
255
- this._$Em = t5, null == r7 ? this.removeAttribute(e7) : this.setAttribute(e7, r7), this._$Em = null;
256
- }
372
+ if (accentColor) {
373
+ searchString.push(`accentColor=${accentColor}`);
257
374
  }
258
- _$AK(t5, s4) {
259
- const i6 = this.constructor, e7 = i6._$Eh.get(t5);
260
- if (void 0 !== e7 && this._$Em !== e7) {
261
- const t6 = i6.getPropertyOptions(e7), r7 = "function" == typeof t6.converter ? { fromAttribute: t6.converter } : void 0 !== t6.converter?.fromAttribute ? t6.converter : u;
262
- this._$Em = e7, this[e7] = r7.fromAttribute(s4, t6.type), this._$Em = null;
263
- }
375
+ if (screenMode && screenMode !== "auto") {
376
+ searchString.push("screenMode=" + screenMode);
264
377
  }
265
- requestUpdate(t5, s4, i6) {
266
- if (void 0 !== t5) {
267
- if (i6 ??= this.constructor.getPropertyOptions(t5), !(i6.hasChanged ?? f)(this[t5], s4))
268
- return;
269
- this.P(t5, s4, i6);
270
- }
271
- false === this.isUpdatePending && (this._$ES = this._$ET());
378
+ if (timezoneId) {
379
+ searchString.push("timezoneId=" + timezoneId);
272
380
  }
273
- P(t5, s4, i6) {
274
- this._$AL.has(t5) || this._$AL.set(t5, s4), true === i6.reflect && this._$Em !== t5 && (this._$Ej ??= /* @__PURE__ */ new Set()).add(t5);
381
+ if (itemEmbedding && itemDimensions && itemDimensions.width) {
382
+ searchString.push("width=" + itemDimensions.width);
275
383
  }
276
- async _$ET() {
277
- this.isUpdatePending = true;
278
- try {
279
- await this._$ES;
280
- } catch (t6) {
281
- Promise.reject(t6);
282
- }
283
- const t5 = this.scheduleUpdate();
284
- return null != t5 && await t5, !this.isUpdatePending;
384
+ if (itemEmbedding && itemDimensions && itemDimensions.height) {
385
+ searchString.push("height=" + itemDimensions.height);
285
386
  }
286
- scheduleUpdate() {
287
- return this.performUpdate();
387
+ if (editMode) {
388
+ searchString.push("editMode=" + editMode);
288
389
  }
289
- performUpdate() {
290
- if (!this.isUpdatePending)
291
- return;
292
- if (!this.hasUpdated) {
293
- if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
294
- for (const [t7, s5] of this._$Ep)
295
- this[t7] = s5;
296
- this._$Ep = void 0;
297
- }
298
- const t6 = this.constructor.elementProperties;
299
- if (t6.size > 0)
300
- for (const [s5, i6] of t6)
301
- true !== i6.wrapped || this._$AL.has(s5) || void 0 === this[s5] || this.P(s5, this[s5], i6);
302
- }
303
- let t5 = false;
304
- const s4 = this._$AL;
305
- try {
306
- t5 = this.shouldUpdate(s4), t5 ? (this.willUpdate(s4), this._$EO?.forEach((t6) => t6.hostUpdate?.()), this.update(s4)) : this._$EU();
307
- } catch (s5) {
308
- throw t5 = false, this._$EU(), s5;
390
+ const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
391
+ searchString.push("version=" + (dashboardContent.libVersion || VERSION));
392
+ const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
393
+ searchString.join("&")
394
+ )}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
395
+ searchString.join("&")
396
+ )}${keyTokenUrlAnchor}`;
397
+ return sanitizeUrl(iframeUrl);
398
+ };
399
+
400
+ // libs/embed-libs/shared-embed/src/lib/helpers/get-loader.ts
401
+ var getLoader = (dashboardComponent) => {
402
+ let errorMsg;
403
+ if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
404
+ dashboardComponent.params.error = true;
405
+ if (dashboardComponent.browserNotSupported) {
406
+ errorMsg = "Browser is not supported.";
309
407
  }
310
- t5 && this._$AE(s4);
311
- }
312
- willUpdate(t5) {
313
- }
314
- _$AE(t5) {
315
- this._$EO?.forEach((t6) => t6.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t5)), this.updated(t5);
316
- }
317
- _$EU() {
318
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
319
- }
320
- get updateComplete() {
321
- return this.getUpdateComplete();
322
- }
323
- getUpdateComplete() {
324
- return this._$ES;
325
- }
326
- shouldUpdate(t5) {
327
- return true;
328
- }
329
- update(t5) {
330
- this._$Ej &&= this._$Ej.forEach((t6) => this._$EC(t6, this[t6])), this._$EU();
331
- }
332
- updated(t5) {
333
- }
334
- firstUpdated(t5) {
335
408
  }
409
+ const loadingMsg = translations_default.initializing[dashboardComponent.params.language] || translations_default.initializing.en;
410
+ return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
336
411
  };
337
- b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[d("elementProperties")] = /* @__PURE__ */ new Map(), b[d("finalized")] = /* @__PURE__ */ new Map(), p?.({ ReactiveElement: b }), (a.reactiveElementVersions ??= []).push("2.0.4");
338
412
 
339
- // node_modules/@lit/reactive-element/decorators/property.js
340
- var o3 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
341
- var r3 = (t5 = o3, e7, r7) => {
342
- const { kind: n6, metadata: i6 } = r7;
343
- let s4 = globalThis.litPropertyMetadata.get(i6);
344
- if (void 0 === s4 && globalThis.litPropertyMetadata.set(i6, s4 = /* @__PURE__ */ new Map()), s4.set(r7.name, t5), "accessor" === n6) {
345
- const { name: o6 } = r7;
346
- return { set(r8) {
347
- const n7 = e7.get.call(this);
348
- e7.set.call(this, r8), this.requestUpdate(o6, n7, t5);
349
- }, init(e8) {
350
- return void 0 !== e8 && this.P(o6, void 0, t5), e8;
351
- } };
413
+ // libs/embed-libs/shared-embed/src/lib/helpers/promise-dispatch.ts
414
+ function resolvePromise(dashboardComponent, requestId, data) {
415
+ if (dashboardComponent.promises[requestId]) {
416
+ dashboardComponent.promises[requestId].resolve(data);
417
+ delete dashboardComponent.promises[requestId];
352
418
  }
353
- if ("setter" === n6) {
354
- const { name: o6 } = r7;
355
- return function(r8) {
356
- const n7 = this[o6];
357
- e7.call(this, r8), this.requestUpdate(o6, n7, t5);
358
- };
419
+ }
420
+ function rejectPromise(dashboardComponent, requestId, data) {
421
+ if (dashboardComponent.promises[requestId]) {
422
+ dashboardComponent.promises[requestId].reject(data);
423
+ delete dashboardComponent.promises[requestId];
359
424
  }
360
- throw Error("Unsupported decorator location: " + n6);
361
- };
362
- function n3(t5) {
363
- return (e7, o6) => "object" == typeof o6 ? r3(t5, e7, o6) : ((t6, e8, o7) => {
364
- const r7 = e8.hasOwnProperty(o7);
365
- return e8.constructor.createProperty(o7, r7 ? { ...t6, wrapped: true } : t6), r7 ? Object.getOwnPropertyDescriptor(e8, o7) : void 0;
366
- })(t5, e7, o6);
367
425
  }
368
426
 
369
- // node_modules/@lit/reactive-element/decorators/state.js
370
- function r4(r7) {
371
- return n3({ ...r7, state: true, attribute: false });
427
+ // libs/embed-libs/shared-embed/src/lib/helpers/styles.ts
428
+ function containerStyles(dashboardComponent) {
429
+ const styles = {};
430
+ if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
431
+ styles.background = dashboardComponent.params.loaderBackground;
432
+ }
433
+ return styles;
372
434
  }
373
-
374
- // node_modules/@lit/reactive-element/decorators/base.js
375
- var e3 = (e7, t5, c4) => (c4.configurable = true, c4.enumerable = true, Reflect.decorate && "object" != typeof t5 && Object.defineProperty(e7, t5, c4), c4);
376
-
377
- // node_modules/@lit/reactive-element/decorators/query.js
378
- function e4(e7, r7) {
379
- return (n6, s4, i6) => {
380
- const o6 = (t5) => t5.renderRoot?.querySelector(e7) ?? null;
381
- if (r7) {
382
- const { get: e8, set: r8 } = "object" == typeof s4 ? n6 : i6 ?? (() => {
383
- const t5 = Symbol();
384
- return { get() {
385
- return this[t5];
386
- }, set(e9) {
387
- this[t5] = e9;
388
- } };
389
- })();
390
- return e3(n6, s4, { get() {
391
- let t5 = e8.call(this);
392
- return void 0 === t5 && (t5 = o6(this), (null !== t5 || this.hasUpdated) && r8.call(this, t5)), t5;
393
- } });
394
- }
395
- return e3(n6, s4, { get() {
396
- return o6(this);
397
- } });
435
+ function containerLoaderStyles(dashboardComponent) {
436
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
437
+ const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
438
+ const display = dashboardComponent.iframeLoaded ? "none" : "";
439
+ return {
440
+ display,
441
+ height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
398
442
  };
399
443
  }
400
-
401
- // libs/embed-libs/shared-embed/src/lib/helpers/error.ts
402
- var _handleError = (errorMessage, parameters) => {
403
- let message = "The dashboard component encountered an error";
404
- if (typeof parameters?.dashboardId === "string") {
405
- message += ` for dashboard with id ${parameters.dashboardId}`;
444
+ function loaderStyles(dashboardComponent) {
445
+ const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
446
+ if (dashboardComponent.params.itemEmbedding) {
447
+ dashboardComponent.loaderSize = 24;
448
+ dashboardComponent.borderWidth = 4;
449
+ dashboardComponent.minHeight = 200;
450
+ const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
451
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
452
+ const chartWidthDefined = width !== "auto";
453
+ const chartHeightDefined = height !== "auto";
454
+ return {
455
+ background,
456
+ width: chartWidthDefined ? `${width}px` : "100%",
457
+ height: `${chartHeightDefined ? height : "200"}px`,
458
+ "min-height": chartHeightDefined ? "" : "200px"
459
+ };
406
460
  }
407
- if (typeof parameters?.dashboardSlug === "string") {
408
- message += ` for dashboard with slug ${parameters.dashboardSlug}`;
461
+ return {
462
+ background
463
+ };
464
+ }
465
+ function plStyles(dashboardComponent) {
466
+ const {
467
+ loaderSpinnerColor: defaultSpinnerColor,
468
+ loaderSpinnerBackground: defaultSpinnerBackground
469
+ } = DEFAULT_PARAMETERS;
470
+ const spinnerColorBorder = generateBorderStyle(
471
+ dashboardComponent.borderWidth,
472
+ dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
473
+ );
474
+ const spinnerBackgroundBorder = generateBorderStyle(
475
+ dashboardComponent.borderWidth,
476
+ dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
477
+ );
478
+ const size = `${dashboardComponent.loaderSize}px`;
479
+ return {
480
+ "border-top": spinnerColorBorder,
481
+ "border-right": spinnerColorBorder,
482
+ "border-bottom": spinnerBackgroundBorder,
483
+ "border-left": spinnerBackgroundBorder,
484
+ width: size,
485
+ height: size
486
+ };
487
+ }
488
+ function lcStyles(dashboardComponent) {
489
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
490
+ const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
491
+ const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
492
+ const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
493
+ return {
494
+ padding: `${verticalPadding} 16px`
495
+ };
496
+ }
497
+ function calculateIframeStyles(dashboardComponent) {
498
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
499
+ const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
500
+ if (dashboardComponent.params.itemEmbedding && height !== "auto") {
501
+ dashboardComponent.iframeHeight = `${height}px`;
502
+ } else if (dashboardComponent.params.itemEmbedding) {
503
+ dashboardComponent.iframeHeight = "200px";
504
+ } else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
505
+ dashboardComponent.iframeHeight = "100%";
506
+ } else {
507
+ dashboardComponent.iframeHeight = "400px";
409
508
  }
410
- if (typeof parameters?.container === "string") {
411
- message += ` in container ${parameters.container}`;
509
+ dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
510
+ const styles = {
511
+ height: dashboardComponent.iframeHeight,
512
+ width: dashboardComponent.iframeWidth
513
+ };
514
+ if (dashboardComponent.iframeLoaded) {
515
+ styles.opacity = 1;
516
+ } else if (dashboardComponent.error) {
517
+ styles.opacity = 1;
518
+ styles.width = "100%";
519
+ styles.height = "400px";
520
+ } else {
521
+ styles.opacity = 0;
412
522
  }
413
- if (errorMessage) {
414
- message += `:
415
- ${errorMessage}`;
416
- console.warn(message);
523
+ return styles;
524
+ }
525
+ function generateBorderStyle(borderWidth, color) {
526
+ return `${borderWidth}px solid ${color}`;
527
+ }
528
+
529
+ // libs/embed-libs/shared-embed/src/lib/helpers/update-iframe-url.ts
530
+ var updateIframeUrl = (iframe, iframeUrl) => {
531
+ if (iframe?.contentWindow) {
532
+ iframe.contentWindow.location.replace(iframeUrl);
417
533
  }
418
534
  };
419
535
 
420
- // libs/embed-libs/shared-embed/src/lib/helpers/browser-check.ts
421
- var _browserCheck = (dashboardComponent) => {
422
- let hasError = false;
423
- let errorMessage = "";
424
- const document_ = document.body || document.documentElement;
425
- const style = document_.style;
426
- const browserCheck = {
427
- svg: !!("createElementNS" in document && document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect),
428
- flexbox: style.webkitFlexWrap === "" || style.flexWrap === "",
429
- postMessage: !!window.postMessage
430
- };
431
- const browserCheckKeys = ["svg", "flexbox", "postMessage"];
432
- for (const key of browserCheckKeys) {
433
- if (!browserCheck[key]) {
434
- hasError = true;
435
- dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
436
- dashboardComponent.browserNotSupported.push(key);
437
- errorMessage += `Your browser does not support: ${key}
438
- `;
439
- }
440
- }
441
- const ua = window.navigator.userAgent;
442
- const msie = ua.includes("MSIE");
443
- const trident = ua.includes("Trident/");
444
- if (msie || trident) {
445
- hasError = true;
446
- errorMessage = "IE is not supported.";
447
- }
448
- if (hasError) {
449
- _handleError(errorMessage);
450
- }
451
- };
452
-
453
- // libs/embed-libs/shared-embed/src/lib/helpers/default-parameters.ts
454
- var DEFAULT_PARAMETERS = {
455
- appServer: "https://app.luzmo.com/",
456
- apiHost: "https://api.luzmo.com/",
457
- dashboardId: null,
458
- dashboardSlug: null,
459
- container: null,
460
- key: null,
461
- token: null,
462
- language: "auto",
463
- qeVersion: null,
464
- editMode: null,
465
- screenMode: null,
466
- switchScreenModeOnResize: true,
467
- itemId: null,
468
- mainColor: "",
469
- accentColor: "",
470
- itemDimensions: {
471
- width: "auto",
472
- height: "auto"
536
+ // libs/embed-libs/shared-embed/src/lib/helpers/set-filter-utils.ts
537
+ var filterUtils = {
538
+ merge(...filters) {
539
+ return filters.reduce((acc, filter) => {
540
+ acc.and.push(...filter.and);
541
+ return acc;
542
+ }, {
543
+ and: []
544
+ });
473
545
  },
474
- loaderBackground: "#f9f9f9",
475
- loaderFontColor: "#5a5a5a",
476
- loaderSpinnerColor: "rgba(255, 165, 0, 0.7)",
477
- loaderSpinnerBackground: "rgba(169, 169, 169, 0.14)",
478
- timezoneId: null,
479
- contextId: null
480
- };
481
-
482
- // libs/embed-libs/shared-embed/src/lib/helpers/extents.ts
483
- var EXTENTS = [
484
- { mode: "mobile", width: [150, 767] },
485
- { mode: "tablet", width: [768, 1199] },
486
- { mode: "desktop", width: [1200, 1599] },
487
- { mode: "largeScreen", width: [1600, 9999] },
488
- { mode: "fixed", width: [] }
489
- ];
490
-
491
- // libs/embed-libs/shared-embed/src/lib/helpers/translations.ts
492
- var TRANSLATIONS = {
493
- initializing: { en: "Initializing...", nl: "Laden...", fr: "Chargement..." },
494
- errorDashboard: {
495
- en: "Oops, we could not load this dashboard!",
496
- nl: "Oeps, we konden het dashboard niet laden.",
497
- fr: "Le chargement a echou\xE9."
546
+ isIn(slot, values, otherOptions) {
547
+ return {
548
+ and: [{
549
+ expression: "? in ?",
550
+ parameters: [
551
+ {
552
+ slot,
553
+ ...otherOptions
554
+ },
555
+ values
556
+ ]
557
+ }]
558
+ };
498
559
  },
499
- errorItem: {
500
- en: "Oops, we could not load this item!",
501
- nl: "Oeps, we konden de grafiek niet laden.",
502
- fr: "Le chargement a echou\xE9."
560
+ between(slot, values, otherOptions) {
561
+ return {
562
+ and: [{
563
+ expression: "? between ?",
564
+ parameters: [
565
+ {
566
+ slot,
567
+ ...otherOptions
568
+ },
569
+ [values[0], values[1]]
570
+ ]
571
+ }]
572
+ };
573
+ },
574
+ range(slot, values, otherOptions) {
575
+ const expressions = otherOptions?.expressions ?? ["? >= ?", "? < ?"];
576
+ return {
577
+ and: [{
578
+ expression: expressions[0],
579
+ parameters: [
580
+ {
581
+ slot,
582
+ ...otherOptions
583
+ },
584
+ [values[0]]
585
+ ]
586
+ }, {
587
+ expression: expressions[1],
588
+ parameters: [
589
+ {
590
+ slot,
591
+ ...otherOptions
592
+ },
593
+ [values[1]]
594
+ ]
595
+ }]
596
+ };
503
597
  }
504
598
  };
505
- var translations_default = TRANSLATIONS;
506
599
 
507
- // libs/embed-libs/shared-embed/src/lib/helpers/utils.ts
508
- var addTrailingSlash = (serverUrl) => {
509
- if (!serverUrl) {
510
- return "";
600
+ // libs/embed-libs/shared-embed/src/lib/methods/export-dashboard.ts
601
+ var exportDashboard = (dashboardComponent, iframe, format) => {
602
+ const requestId = uuidv4();
603
+ if (iframe?.contentWindow) {
604
+ iframe.contentWindow.postMessage(
605
+ {
606
+ action: "exportDashboard",
607
+ format: format || "png",
608
+ _version: dashboardComponent.libVersion,
609
+ requestId
610
+ },
611
+ "*"
612
+ );
613
+ return new Promise((resolve, reject) => {
614
+ dashboardComponent.promises[requestId] = { resolve, reject };
615
+ setTimeout(() => {
616
+ if (dashboardComponent.promises[requestId]) {
617
+ const errorMessage = "exportDashboard request timed out.";
618
+ dashboardComponent.promises[requestId].reject(
619
+ new Error(errorMessage)
620
+ );
621
+ delete dashboardComponent.promises[requestId];
622
+ }
623
+ }, 12e5);
624
+ });
511
625
  }
512
- return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
626
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
513
627
  };
514
- var removeTrailingSlash = (serverUrl) => {
515
- if (!serverUrl) {
516
- return "";
628
+
629
+ // libs/embed-libs/shared-embed/src/lib/methods/get-accessible-dashboards.ts
630
+ var getAccessibleDashboards = (dashboardComponent) => {
631
+ if ((dashboardComponent.currentAuthKey ?? dashboardComponent.authKey) && (dashboardComponent.currentAuthToken ?? dashboardComponent.authToken)) {
632
+ const fetchUser = new Promise((resolve, reject) => {
633
+ void (() => {
634
+ try {
635
+ const responsePromise = window.fetch(
636
+ // With experimental=true URLs remove the trailing slash, since the web component expects them to not have it.
637
+ // Fixes incorrect url with experimental=true
638
+ `${addTrailingSlash(dashboardComponent.params.apiHost)}0.1.0/authorization`,
639
+ {
640
+ method: "POST",
641
+ mode: "cors",
642
+ cache: "no-cache",
643
+ headers: { "Content-Type": "application/json" },
644
+ redirect: "follow",
645
+ body: JSON.stringify({
646
+ action: "get",
647
+ version: "0.1.0",
648
+ key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
649
+ token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
650
+ find: {
651
+ where: { id: dashboardComponent.authKey },
652
+ attributes: ["id", "integration_id"],
653
+ include: [
654
+ {
655
+ model: "User",
656
+ attributes: ["id", "name", "locale_id"],
657
+ include: [{ model: "Group" }]
658
+ }
659
+ ]
660
+ }
661
+ })
662
+ }
663
+ );
664
+ responsePromise.then((response) => response.json()).then((data) => {
665
+ if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user) {
666
+ reject("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com.");
667
+ } else {
668
+ data.rows[0].user.userGroups = data.rows[0].user.groups.map(
669
+ (group) => group.id
670
+ );
671
+ delete data.rows[0].user.groups;
672
+ resolve({
673
+ integrationId: data.rows[0].integration_id,
674
+ user: data.rows[0].user
675
+ });
676
+ }
677
+ });
678
+ } catch (error) {
679
+ reject(error);
680
+ }
681
+ })();
682
+ });
683
+ return new Promise((resolve, reject) => void (() => {
684
+ try {
685
+ fetchUser.then((authorizationData) => {
686
+ const responsePromise = window.fetch(
687
+ // With experimental=true URLs remove the trailing slash, since the web component expects them to not have it.
688
+ // Fixes incorrect url with experimental=true
689
+ `${addTrailingSlash(dashboardComponent.params.apiHost)}0.1.0/securable`,
690
+ {
691
+ method: "POST",
692
+ mode: "cors",
693
+ cache: "no-cache",
694
+ headers: { "Content-Type": "application/json" },
695
+ redirect: "follow",
696
+ body: JSON.stringify({
697
+ action: "get",
698
+ version: "0.1.0",
699
+ key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
700
+ token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
701
+ find: {
702
+ where: { type: "dashboard", is_variant: false },
703
+ attributes: ["id", "name", "modified_at"],
704
+ order: [["modified_at", "desc"]],
705
+ include: [
706
+ { model: "Tag", attributes: ["tag"] },
707
+ { model: "User", attributes: ["id", "name"] },
708
+ {
709
+ model: "Group",
710
+ attributes: ["id", "name", "public"]
711
+ },
712
+ { model: "Integration", attributes: ["id", "name"] }
713
+ ]
714
+ }
715
+ })
716
+ }
717
+ );
718
+ responsePromise.then((response) => response.json()).then((data) => {
719
+ const dashboardList = data.rows.length > 0 ? formatDashboardList(
720
+ data.rows,
721
+ authorizationData.integrationId,
722
+ authorizationData.user,
723
+ dashboardComponent
724
+ ) : [];
725
+ resolve(dashboardList);
726
+ });
727
+ }).catch((error) => {
728
+ reject(error);
729
+ });
730
+ } catch (error) {
731
+ reject(error);
732
+ }
733
+ })());
517
734
  }
518
- return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
735
+ throw new Error("No authKey or authToken found in the luzmo-dashboard component.");
519
736
  };
520
- var formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
521
- const combineRights = (securable, user2) => {
522
- const matchingUser = securable.users.find((u3) => u3.id === user2.id);
523
- const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
524
- flagRead: matchingUser.userAccessRight.flagRead,
525
- flagUse: matchingUser.userAccessRight.flagUse,
526
- flagModify: matchingUser.userAccessRight.flagModify,
527
- flagOwn: matchingUser.userAccessRight.flagOwn
528
- } : {
529
- flagRead: false,
530
- flagUse: false,
531
- flagModify: false,
532
- flagOwn: false
533
- };
534
- const groups = securable.groups.filter(
535
- (group) => user2.userGroups.includes(group.id) || group.public === true
737
+
738
+ // libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
739
+ var getData = (dashboardComponent, iframe, itemId) => {
740
+ if (iframe?.contentWindow) {
741
+ const requestId = uuidv4();
742
+ iframe.contentWindow.postMessage(
743
+ {
744
+ action: "getData",
745
+ id: itemId,
746
+ _version: dashboardComponent.libVersion,
747
+ requestId
748
+ },
749
+ "*"
536
750
  );
537
- const groupsAccess = groups.map((group) => {
538
- if (group.groupAccessRight) {
539
- return group.groupAccessRight;
540
- }
751
+ return new Promise((resolve, reject) => {
752
+ dashboardComponent.promises[requestId] = { resolve, reject };
753
+ setTimeout(() => {
754
+ if (dashboardComponent.promises[requestId]) {
755
+ const errorMessage = "getData request timed out.";
756
+ dashboardComponent.promises[requestId].reject(
757
+ new Error(errorMessage)
758
+ );
759
+ delete dashboardComponent.promises[requestId];
760
+ }
761
+ }, 2e3);
541
762
  });
542
- for (const groupAccess of groupsAccess) {
543
- if (!securableAccessRights.flagRead && groupAccess.flagRead) {
544
- securableAccessRights.flagRead = groupAccess.flagRead;
545
- }
546
- if (!securableAccessRights.flagUse && groupAccess.flagUse) {
547
- securableAccessRights.flagUse = groupAccess.flagUse;
548
- }
549
- if (!securableAccessRights.flagModify && groupAccess.flagModify) {
550
- securableAccessRights.flagModify = groupAccess.flagModify;
551
- }
552
- if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
553
- securableAccessRights.flagOwn = groupAccess.flagOwn;
554
- }
555
- }
556
- const integrationsAccess = securable.integrations?.length > 0 ? securable.integrations.map((integration) => {
557
- if (integration.integrationAccessRight) {
558
- return integration.integrationAccessRight;
559
- }
560
- }) : [];
561
- for (const integrationAccess of integrationsAccess) {
562
- if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
563
- securableAccessRights.flagRead = integrationAccess.flagRead;
564
- }
565
- if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
566
- securableAccessRights.flagUse = integrationAccess.flagUse;
567
- }
568
- if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
569
- securableAccessRights.flagModify = integrationAccess.flagModify;
570
- }
571
- }
572
- return securableAccessRights;
573
- };
574
- const localize = (item, locale) => {
575
- if (item === null || item === void 0) {
576
- return "";
577
- }
578
- if (typeof item !== "object" || Object.keys(item).length === 0) {
579
- if (typeof item === "object" && Object.keys(item).length === 0) {
580
- return "";
581
- }
582
- return item;
583
- }
584
- let localizedItem;
585
- localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
586
- if (localizedItem === void 0 || localizedItem === null) {
587
- localizedItem = "";
588
- }
589
- return localizedItem;
590
- };
591
- const treatedDashboards = [];
592
- for (const dashboard of dashboards) {
593
- const treatedDashboard = {
594
- accessibleBy: [],
595
- accessRights: combineRights(dashboard, user),
596
- id: dashboard.id,
597
- modifiedAt: dashboard.modified_at,
598
- name: localize(dashboard.name, dashboardComponent.language),
599
- slug: null,
600
- tags: dashboard.tags.map((t5) => t5.tag).sort((t1, t22) => t1.localeCompare(t22))
601
- };
602
- const currentIntegration = dashboard.integrations.find(
603
- (i6) => i6.id === integrationId
604
- );
605
- if (currentIntegration?.integrationAccessRight?.slug) {
606
- treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
607
- }
608
- const users = dashboard.users.map((u3) => ({
609
- model: "User",
610
- id: u3.id,
611
- name: localize(u3.name, user.locale_id)
612
- }));
613
- const groups = dashboard.groups.map((g2) => ({
614
- model: "Group",
615
- id: g2.id,
616
- name: localize(g2.name, user.locale_id) || {}
617
- }));
618
- const integrations = dashboard.integrations.map((i6) => ({
619
- model: "Integration",
620
- id: i6.id,
621
- name: localize(i6.name, user.locale_id) || {}
622
- }));
623
- treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
624
- treatedDashboards.push(treatedDashboard);
625
763
  }
626
- return treatedDashboards;
764
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
627
765
  };
628
- var VERSION = "0.0.0-unknown-luzmo";
629
- var sanitizeUrl = (url) => {
630
- const invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
631
- const ctrlCharactersRegex = /[^\u0020-\u007E]/gim;
632
- const urlSchemeRegex = /^([^:]+):/gm;
633
- const relativeFirstCharacters = /* @__PURE__ */ new Set([".", "/"]);
634
- const isRelativeUrlWithoutProtocol = (relativeUrl) => relativeFirstCharacters.has(relativeUrl[0]);
635
- if (!url) {
636
- return "about:blank";
766
+
767
+ // libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
768
+ var getFilters = (dashboardComponent, iframe) => {
769
+ if (iframe?.contentWindow) {
770
+ const requestId = uuidv4();
771
+ iframe.contentWindow.postMessage(
772
+ { action: "getFilters", _version: dashboardComponent.libVersion, requestId },
773
+ "*"
774
+ );
775
+ return new Promise((resolve, reject) => {
776
+ dashboardComponent.promises[requestId] = { resolve, reject };
777
+ setTimeout(() => {
778
+ if (dashboardComponent.promises[requestId]) {
779
+ const errorMessage = "getFilters request timed out.";
780
+ dashboardComponent.promises[requestId].reject(
781
+ new Error(errorMessage)
782
+ );
783
+ delete dashboardComponent.promises[requestId];
784
+ }
785
+ }, 2e3);
786
+ });
637
787
  }
638
- const sanitizedUrl = url.replaceAll(ctrlCharactersRegex, "").trim();
639
- if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
640
- return sanitizedUrl;
788
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
789
+ };
790
+
791
+ // libs/embed-libs/shared-embed/src/lib/methods/refresh-data.ts
792
+ var refreshData = (dashboardComponent, iframe, itemId) => {
793
+ if (iframe) {
794
+ iframe.contentWindow.postMessage(
795
+ {
796
+ action: "refreshData",
797
+ id: itemId ?? null,
798
+ _version: dashboardComponent.libVersion
799
+ },
800
+ "*"
801
+ );
802
+ return Promise.resolve();
641
803
  }
642
- const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
643
- if (!urlSchemeParseResults) {
644
- return sanitizedUrl;
804
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
805
+ };
806
+
807
+ // libs/embed-libs/shared-embed/src/lib/methods/reload-dashboard.ts
808
+ var reloadDashboard = (dashboardComponent, iframe) => {
809
+ if (iframe) {
810
+ iframe.contentWindow.postMessage(
811
+ { action: "reloadDashboard", _version: dashboardComponent.libVersion },
812
+ "*"
813
+ );
814
+ return Promise.resolve();
645
815
  }
646
- const urlScheme = urlSchemeParseResults[0];
647
- if (invalidPrototcolRegex.test(urlScheme)) {
648
- return "about:blank";
816
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
817
+ };
818
+
819
+ // libs/embed-libs/shared-embed/src/lib/methods/set-authorization.ts
820
+ var setAuthorization = (dashboardComponent, iframe, key, token) => {
821
+ if (iframe) {
822
+ iframe.contentWindow.postMessage(
823
+ {
824
+ action: "setAuthorization",
825
+ key,
826
+ token,
827
+ _version: dashboardComponent.libVersion
828
+ },
829
+ "*"
830
+ );
831
+ return Promise.resolve();
649
832
  }
650
- return sanitizedUrl;
833
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
651
834
  };
652
- var cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
653
- var isObject = (o6) => o6 && typeof o6 === "object";
654
- var defaultsDeep = (target, defaults) => {
655
- Object.entries(defaults).forEach(([k2, v2]) => {
656
- if (k2 in target) {
657
- if (target[k2] === void 0) {
658
- target[k2] = v2;
659
- } else {
660
- target[k2] = isObject(v2) ? defaultsDeep(
661
- target[k2],
662
- v2
663
- ) : target[k2];
664
- }
665
- } else {
666
- target[k2] = v2;
835
+
836
+ // libs/embed-libs/shared-embed/src/lib/methods/set-edit-mode.ts
837
+ var setEditMode = (dashboardComponent, iframe, editMode) => {
838
+ if (iframe && iframe.contentWindow) {
839
+ const requestId = uuidv4();
840
+ if (dashboardComponent.params.editMode === editMode) {
841
+ return Promise.reject(
842
+ new Error("editMode parameter is currently already set to " + editMode)
843
+ );
844
+ } else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
845
+ return Promise.reject(
846
+ new Error(
847
+ "The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
848
+ )
849
+ );
667
850
  }
668
- });
669
- return target;
851
+ iframe.contentWindow.postMessage(
852
+ {
853
+ action: "setEditMode",
854
+ editMode,
855
+ _version: dashboardComponent.libVersion,
856
+ requestId
857
+ },
858
+ "*"
859
+ );
860
+ return new Promise((resolve, reject) => {
861
+ dashboardComponent.promises[requestId] = { resolve, reject };
862
+ });
863
+ }
864
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
670
865
  };
671
- var uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c4) {
672
- const r7 = Math.random() * 16 | 0;
673
- const v2 = c4 == "x" ? r7 : r7 & 3 | 8;
674
- return v2.toString(16);
675
- });
676
866
 
677
- // libs/embed-libs/shared-embed/src/lib/helpers/iframe-url.ts
678
- var createIframeUrl = (dashboardContent) => {
679
- const searchString = [];
680
- const {
681
- appServer,
682
- language,
683
- qeVersion,
684
- loaderBackground,
685
- loaderSpinnerColor,
686
- loaderSpinnerBackground,
687
- loaderFontColor,
688
- screenMode,
689
- key,
690
- token,
691
- timezoneId,
692
- itemEmbedding,
693
- itemDimensions,
694
- dashboardId,
695
- dashboardSlug,
696
- itemId,
697
- mainColor,
698
- accentColor,
699
- editMode
700
- } = dashboardContent.params;
701
- if (language && language !== "auto") {
702
- searchString.push("language=" + language);
703
- }
704
- if (qeVersion) {
705
- searchString.push(`qe_version=${qeVersion}`);
706
- }
707
- if (loaderBackground) {
708
- searchString.push(`ldrbg=${loaderBackground}`);
709
- }
710
- if (loaderFontColor) {
711
- searchString.push(`ldrftclr=${loaderFontColor}`);
712
- }
713
- if (loaderSpinnerColor) {
714
- searchString.push(`ldrspclr=${loaderSpinnerColor}`);
715
- }
716
- if (loaderSpinnerBackground) {
717
- searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
718
- }
719
- if (mainColor) {
720
- searchString.push(`mainColor=${mainColor}`);
721
- }
722
- if (accentColor) {
723
- searchString.push(`accentColor=${accentColor}`);
724
- }
725
- if (screenMode && screenMode !== "auto") {
726
- searchString.push("screenMode=" + screenMode);
727
- }
728
- if (timezoneId) {
729
- searchString.push("timezoneId=" + timezoneId);
730
- }
731
- if (itemEmbedding && itemDimensions && itemDimensions.width) {
732
- searchString.push("width=" + itemDimensions.width);
733
- }
734
- if (itemEmbedding && itemDimensions && itemDimensions.height) {
735
- searchString.push("height=" + itemDimensions.height);
736
- }
737
- if (editMode) {
738
- searchString.push("editMode=" + editMode);
739
- }
740
- const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
741
- searchString.push("version=" + (dashboardContent.libVersion || VERSION));
742
- const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
743
- searchString.join("&")
744
- )}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
745
- searchString.join("&")
746
- )}${keyTokenUrlAnchor}`;
747
- return sanitizeUrl(iframeUrl);
748
- };
749
-
750
- // libs/embed-libs/shared-embed/src/lib/helpers/get-loader.ts
751
- var getLoader = (dashboardComponent) => {
752
- let errorMsg;
753
- if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
754
- dashboardComponent.params.error = true;
755
- if (dashboardComponent.browserNotSupported) {
756
- errorMsg = "Browser is not supported.";
757
- }
758
- }
759
- const loadingMsg = translations_default.initializing[dashboardComponent.params.language] || translations_default.initializing.en;
760
- return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
761
- };
762
-
763
- // libs/embed-libs/shared-embed/src/lib/helpers/promise-dispatch.ts
764
- function resolvePromise(dashboardComponent, requestId, data) {
765
- if (dashboardComponent.promises[requestId]) {
766
- dashboardComponent.promises[requestId].resolve(data);
767
- delete dashboardComponent.promises[requestId];
768
- }
769
- }
770
- function rejectPromise(dashboardComponent, requestId, data) {
771
- if (dashboardComponent.promises[requestId]) {
772
- dashboardComponent.promises[requestId].reject(data);
773
- delete dashboardComponent.promises[requestId];
774
- }
775
- }
776
-
777
- // libs/embed-libs/shared-embed/src/lib/helpers/styles.ts
778
- function containerStyles(dashboardComponent) {
779
- const styles = {};
780
- if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
781
- styles.background = dashboardComponent.params.loaderBackground;
782
- }
783
- return styles;
784
- }
785
- function containerLoaderStyles(dashboardComponent) {
786
- const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
787
- const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
788
- const display = dashboardComponent.iframeLoaded ? "none" : "";
789
- return {
790
- display,
791
- height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
792
- };
793
- }
794
- function loaderStyles(dashboardComponent) {
795
- const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
796
- if (dashboardComponent.params.itemEmbedding) {
797
- dashboardComponent.loaderSize = 24;
798
- dashboardComponent.borderWidth = 4;
799
- dashboardComponent.minHeight = 200;
800
- const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
801
- const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
802
- const chartWidthDefined = width !== "auto";
803
- const chartHeightDefined = height !== "auto";
804
- return {
805
- background,
806
- width: chartWidthDefined ? `${width}px` : "100%",
807
- height: `${chartHeightDefined ? height : "200"}px`,
808
- "min-height": chartHeightDefined ? "" : "200px"
809
- };
810
- }
811
- return {
812
- background
813
- };
814
- }
815
- function plStyles(dashboardComponent) {
816
- const {
817
- loaderSpinnerColor: defaultSpinnerColor,
818
- loaderSpinnerBackground: defaultSpinnerBackground
819
- } = DEFAULT_PARAMETERS;
820
- const spinnerColorBorder = generateBorderStyle(
821
- dashboardComponent.borderWidth,
822
- dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
823
- );
824
- const spinnerBackgroundBorder = generateBorderStyle(
825
- dashboardComponent.borderWidth,
826
- dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
827
- );
828
- const size = `${dashboardComponent.loaderSize}px`;
829
- return {
830
- "border-top": spinnerColorBorder,
831
- "border-right": spinnerColorBorder,
832
- "border-bottom": spinnerBackgroundBorder,
833
- "border-left": spinnerBackgroundBorder,
834
- width: size,
835
- height: size
836
- };
837
- }
838
- function lcStyles(dashboardComponent) {
839
- const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
840
- const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
841
- const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
842
- const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
843
- return {
844
- padding: `${verticalPadding} 16px`
845
- };
846
- }
847
- function calculateIframeStyles(dashboardComponent) {
848
- const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
849
- const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
850
- if (dashboardComponent.params.itemEmbedding && height !== "auto") {
851
- dashboardComponent.iframeHeight = `${height}px`;
852
- } else if (dashboardComponent.params.itemEmbedding) {
853
- dashboardComponent.iframeHeight = "200px";
854
- } else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
855
- dashboardComponent.iframeHeight = "100%";
856
- } else {
857
- dashboardComponent.iframeHeight = "400px";
858
- }
859
- dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
860
- const styles = {
861
- height: dashboardComponent.iframeHeight,
862
- width: dashboardComponent.iframeWidth
863
- };
864
- if (dashboardComponent.iframeLoaded) {
865
- styles.opacity = 1;
866
- } else if (dashboardComponent.error) {
867
- styles.opacity = 1;
868
- styles.width = "100%";
869
- styles.height = "400px";
870
- } else {
871
- styles.opacity = 0;
872
- }
873
- return styles;
874
- }
875
- function generateBorderStyle(borderWidth, color) {
876
- return `${borderWidth}px solid ${color}`;
877
- }
878
-
879
- // libs/embed-libs/shared-embed/src/lib/helpers/update-iframe-url.ts
880
- var updateIframeUrl = (iframe, iframeUrl) => {
881
- if (iframe?.contentWindow) {
882
- iframe.contentWindow.location.replace(iframeUrl);
867
+ // libs/embed-libs/shared-embed/src/lib/methods/set-filters.ts
868
+ var setFilters = (dashboardComponent, iframe, itemId, filters) => {
869
+ if (iframe) {
870
+ const requestId = uuidv4();
871
+ iframe.contentWindow.postMessage(
872
+ {
873
+ action: "setFilters",
874
+ itemId,
875
+ filters,
876
+ _version: dashboardComponent.libVersion,
877
+ requestId
878
+ },
879
+ "*"
880
+ );
881
+ return new Promise((resolve, reject) => {
882
+ dashboardComponent.promises[requestId] = { resolve, reject };
883
+ setTimeout(() => {
884
+ if (dashboardComponent.promises[requestId]) {
885
+ const errorMessage = "setFilters request timed out.";
886
+ dashboardComponent.promises[requestId].reject(
887
+ new Error(errorMessage)
888
+ );
889
+ delete dashboardComponent.promises[requestId];
890
+ }
891
+ }, 2e3);
892
+ });
883
893
  }
894
+ return Promise.reject();
884
895
  };
885
896
 
886
- // libs/embed-libs/shared-embed/src/lib/methods/export-dashboard.ts
887
- var exportDashboard = (dashboardComponent, iframe, format) => {
888
- const requestId = uuidv4();
889
- if (iframe?.contentWindow) {
897
+ // libs/embed-libs/shared-embed/src/lib/methods/set-preview.ts
898
+ var setPreview = (dashboardComponent, iframe, preview) => {
899
+ if (iframe) {
900
+ const requestId = uuidv4();
890
901
  iframe.contentWindow.postMessage(
891
902
  {
892
- action: "exportDashboard",
893
- format: format || "png",
894
- _version: dashboardComponent.libVersion,
895
- requestId
903
+ action: "setPreview",
904
+ preview,
905
+ requestId,
906
+ _version: dashboardComponent.libVersion
896
907
  },
897
908
  "*"
898
909
  );
@@ -900,560 +911,263 @@ var exportDashboard = (dashboardComponent, iframe, format) => {
900
911
  dashboardComponent.promises[requestId] = { resolve, reject };
901
912
  setTimeout(() => {
902
913
  if (dashboardComponent.promises[requestId]) {
903
- const errorMessage = "exportDashboard request timed out.";
914
+ const errorMessage = "setPreview request timed out.";
904
915
  dashboardComponent.promises[requestId].reject(
905
916
  new Error(errorMessage)
906
917
  );
907
918
  delete dashboardComponent.promises[requestId];
908
919
  }
909
- }, 12e5);
920
+ }, 2e3);
910
921
  });
911
922
  }
912
923
  return Promise.reject(new Error("Cannot retrieve contentWindow."));
913
924
  };
914
925
 
915
- // libs/embed-libs/shared-embed/src/lib/methods/get-accessible-dashboards.ts
916
- var getAccessibleDashboards = (dashboardComponent) => {
917
- if ((dashboardComponent.currentAuthKey ?? dashboardComponent.authKey) && (dashboardComponent.currentAuthToken ?? dashboardComponent.authToken)) {
918
- const fetchUser = new Promise((resolve, reject) => {
919
- void (() => {
920
- try {
921
- const responsePromise = window.fetch(
922
- // With experimental=true URLs remove the trailing slash, since the web component expects them to not have it.
923
- // Fixes incorrect url with experimental=true
924
- `${addTrailingSlash(dashboardComponent.params.apiHost)}0.1.0/authorization`,
925
- {
926
- method: "POST",
927
- mode: "cors",
928
- cache: "no-cache",
929
- headers: { "Content-Type": "application/json" },
930
- redirect: "follow",
931
- body: JSON.stringify({
932
- action: "get",
933
- version: "0.1.0",
934
- key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
935
- token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
936
- find: {
937
- where: { id: dashboardComponent.authKey },
938
- attributes: ["id", "integration_id"],
939
- include: [
940
- {
941
- model: "User",
942
- attributes: ["id", "name", "locale_id"],
943
- include: [{ model: "Group" }]
944
- }
945
- ]
946
- }
947
- })
948
- }
949
- );
950
- responsePromise.then((response) => response.json()).then((data) => {
951
- if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user) {
952
- reject("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com.");
926
+ // libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
927
+ var _setCalculatedDimensions = (dashboardComponent) => {
928
+ if (!dashboardComponent.dimensions) {
929
+ dashboardComponent.params.error = true;
930
+ _handleError("Got no valid dimensions.", dashboardComponent.params);
931
+ return;
932
+ }
933
+ const dashboardDimensionKeys = Object.keys(
934
+ dashboardComponent.dimensions
935
+ );
936
+ const availableScreenModeExtents = [];
937
+ let currentMode;
938
+ let currentWidth = 0;
939
+ let currentHeight = 0;
940
+ if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
941
+ dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
942
+ }
943
+ if (dashboardComponent.dimensions && dashboardDimensionKeys?.[0] === "fixed") {
944
+ currentMode = "fixed";
945
+ currentWidth = dashboardComponent.dimensions.fixed[0];
946
+ currentHeight = dashboardComponent.dimensions.fixed[1];
947
+ } else {
948
+ const screenModes = [
949
+ "mobile",
950
+ "tablet",
951
+ "desktop",
952
+ "largeScreen"
953
+ ];
954
+ if (dashboardComponent.params.itemEmbedding) {
955
+ const [firstMatch] = dashboardDimensionKeys;
956
+ let match = cloneDeep(firstMatch);
957
+ for (const screenMode of screenModes) {
958
+ const found = dashboardDimensionKeys.find((key) => key === screenMode);
959
+ if (found) {
960
+ match = cloneDeep(found);
961
+ } else {
962
+ dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
963
+ }
964
+ }
965
+ }
966
+ for (const key of dashboardDimensionKeys) {
967
+ if (screenModes.includes(key)) {
968
+ const screenMode = EXTENTS.find((extent) => extent.mode === key);
969
+ availableScreenModeExtents.push({
970
+ ...screenMode,
971
+ height: dashboardComponent.dimensions[key][1] || 50
972
+ });
973
+ }
974
+ }
975
+ if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
976
+ dashboardComponent.params.screenMode = "auto";
977
+ }
978
+ if (dashboardComponent.params.screenMode === "auto") {
979
+ availableScreenModeExtents.sort(
980
+ (a3, b3) => screenModes.indexOf(a3.mode) - screenModes.indexOf(b3.mode)
981
+ );
982
+ for (const screenModeExtent of availableScreenModeExtents) {
983
+ const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
984
+ if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
985
+ if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
986
+ currentMode = screenModeExtent.mode;
987
+ currentWidth = Number.parseInt(
988
+ dashboardComponent.params.itemDimensions.width,
989
+ 10
990
+ );
991
+ currentHeight = dashboardComponent.dimensions[currentMode][1];
992
+ }
993
+ } else {
994
+ if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
995
+ currentMode = screenModeExtent.mode;
996
+ if (dashboardComponent.params.itemEmbedding) {
997
+ currentWidth = dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto" ? Number.parseInt(
998
+ dashboardComponent.params.itemDimensions.width,
999
+ 10
1000
+ ) : Math.min(
1001
+ dashboardComponent.containerWidth,
1002
+ screenModeExtentMaxWidth
1003
+ );
1004
+ currentHeight = dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto" ? Number.parseInt(
1005
+ dashboardComponent.params.itemDimensions.height,
1006
+ 10
1007
+ ) : dashboardComponent.dimensions[currentMode][1];
1008
+ if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
1009
+ currentWidth = Number.parseInt(
1010
+ dashboardComponent.params.itemDimensions.width,
1011
+ 10
1012
+ );
1013
+ currentHeight = dashboardComponent.dimensions[currentMode][1];
1014
+ }
953
1015
  } else {
954
- data.rows[0].user.userGroups = data.rows[0].user.groups.map(
955
- (group) => group.id
1016
+ currentWidth = Math.max(
1017
+ Math.min(
1018
+ screenModeExtentMaxWidth,
1019
+ dashboardComponent.containerWidth
1020
+ ),
1021
+ screenModeExtentMinWidth
956
1022
  );
957
- delete data.rows[0].user.groups;
958
- resolve({
959
- integrationId: data.rows[0].integration_id,
960
- user: data.rows[0].user
961
- });
1023
+ currentHeight = screenModeExtent.height;
962
1024
  }
963
- });
964
- } catch (error) {
965
- reject(error);
1025
+ }
966
1026
  }
967
- })();
968
- });
969
- return new Promise((resolve, reject) => void (() => {
970
- try {
971
- fetchUser.then((authorizationData) => {
972
- const responsePromise = window.fetch(
973
- // With experimental=true URLs remove the trailing slash, since the web component expects them to not have it.
974
- // Fixes incorrect url with experimental=true
975
- `${addTrailingSlash(dashboardComponent.params.apiHost)}0.1.0/securable`,
976
- {
977
- method: "POST",
978
- mode: "cors",
979
- cache: "no-cache",
980
- headers: { "Content-Type": "application/json" },
981
- redirect: "follow",
982
- body: JSON.stringify({
983
- action: "get",
984
- version: "0.1.0",
985
- key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
986
- token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
987
- find: {
988
- where: { type: "dashboard", is_variant: false },
989
- attributes: ["id", "name", "modified_at"],
990
- order: [["modified_at", "desc"]],
991
- include: [
992
- { model: "Tag", attributes: ["tag"] },
993
- { model: "User", attributes: ["id", "name"] },
994
- {
995
- model: "Group",
996
- attributes: ["id", "name", "public"]
997
- },
998
- { model: "Integration", attributes: ["id", "name"] }
999
- ]
1000
- }
1001
- })
1002
- }
1003
- );
1004
- responsePromise.then((response) => response.json()).then((data) => {
1005
- const dashboardList = data.rows.length > 0 ? formatDashboardList(
1006
- data.rows,
1007
- authorizationData.integrationId,
1008
- authorizationData.user,
1009
- dashboardComponent
1010
- ) : [];
1011
- resolve(dashboardList);
1012
- });
1013
- }).catch((error) => {
1014
- reject(error);
1015
- });
1016
- } catch (error) {
1017
- reject(error);
1018
1027
  }
1019
- })());
1020
- }
1021
- throw new Error("No authKey or authToken found in the luzmo-dashboard component.");
1022
- };
1023
-
1024
- // libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
1025
- var getData = (dashboardComponent, iframe, itemId) => {
1026
- if (iframe?.contentWindow) {
1027
- const requestId = uuidv4();
1028
- iframe.contentWindow.postMessage(
1029
- {
1030
- action: "getData",
1031
- id: itemId,
1032
- _version: dashboardComponent.libVersion,
1033
- requestId
1034
- },
1035
- "*"
1036
- );
1037
- return new Promise((resolve, reject) => {
1038
- dashboardComponent.promises[requestId] = { resolve, reject };
1039
- setTimeout(() => {
1040
- if (dashboardComponent.promises[requestId]) {
1041
- const errorMessage = "getData request timed out.";
1042
- dashboardComponent.promises[requestId].reject(
1043
- new Error(errorMessage)
1028
+ } else {
1029
+ const {
1030
+ height: chosenModeHeight,
1031
+ width: [chosenModeMinWidth, chosenModeMaxWidth]
1032
+ } = availableScreenModeExtents.find(
1033
+ (d3) => d3.mode === dashboardComponent.params.screenMode
1034
+ );
1035
+ currentMode = dashboardComponent.params.screenMode;
1036
+ currentWidth = Math.max(
1037
+ Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
1038
+ chosenModeMinWidth
1039
+ );
1040
+ currentHeight = chosenModeHeight;
1041
+ if (dashboardComponent.params.itemEmbedding) {
1042
+ if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
1043
+ currentWidth = Number.parseInt(
1044
+ dashboardComponent.params.itemDimensions.width,
1045
+ 10
1044
1046
  );
1045
- delete dashboardComponent.promises[requestId];
1046
1047
  }
1047
- }, 2e3);
1048
- });
1049
- }
1050
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
1051
- };
1052
-
1053
- // libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
1054
- var getFilters = (dashboardComponent, iframe) => {
1055
- if (iframe?.contentWindow) {
1056
- const requestId = uuidv4();
1057
- iframe.contentWindow.postMessage(
1058
- { action: "getFilters", _version: dashboardComponent.libVersion, requestId },
1059
- "*"
1060
- );
1061
- return new Promise((resolve, reject) => {
1062
- dashboardComponent.promises[requestId] = { resolve, reject };
1063
- setTimeout(() => {
1064
- if (dashboardComponent.promises[requestId]) {
1065
- const errorMessage = "getFilters request timed out.";
1066
- dashboardComponent.promises[requestId].reject(
1067
- new Error(errorMessage)
1048
+ if (dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto") {
1049
+ currentHeight = Number.parseInt(
1050
+ dashboardComponent.params.itemDimensions.height,
1051
+ 10
1068
1052
  );
1069
- delete dashboardComponent.promises[requestId];
1070
1053
  }
1071
- }, 2e3);
1072
- });
1054
+ }
1055
+ }
1056
+ if (!currentMode && availableScreenModeExtents.length > 0) {
1057
+ const [lowestModeExtent] = availableScreenModeExtents;
1058
+ currentMode = lowestModeExtent.mode;
1059
+ currentWidth = lowestModeExtent.width[0];
1060
+ currentHeight = lowestModeExtent.height;
1061
+ }
1073
1062
  }
1074
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
1075
- };
1076
-
1077
- // libs/embed-libs/shared-embed/src/lib/methods/refresh-data.ts
1078
- var refreshData = (dashboardComponent, iframe, itemId) => {
1079
- if (iframe) {
1080
- iframe.contentWindow.postMessage(
1081
- {
1082
- action: "refreshData",
1083
- id: itemId ?? null,
1084
- _version: dashboardComponent.libVersion
1085
- },
1086
- "*"
1087
- );
1088
- return Promise.resolve();
1063
+ dashboardComponent.currentScreenMode = currentMode;
1064
+ const style = {
1065
+ height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
1066
+ width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
1067
+ opacity: 1
1068
+ };
1069
+ const dashboardEditModes = ["editFull", "editLimited"];
1070
+ if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
1071
+ style.height = "100%";
1072
+ style.width = "100%";
1073
+ } else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
1074
+ style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
1075
+ "px",
1076
+ ""
1077
+ )}px`;
1078
+ style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
1079
+ "px",
1080
+ ""
1081
+ )}px`;
1082
+ } else {
1083
+ style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
1084
+ style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
1089
1085
  }
1090
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
1086
+ dashboardComponent.currentScreenMode = currentMode;
1087
+ dashboardComponent.iframeStyle = style;
1091
1088
  };
1092
1089
 
1093
- // libs/embed-libs/shared-embed/src/lib/methods/reload-dashboard.ts
1094
- var reloadDashboard = (dashboardComponent, iframe) => {
1095
- if (iframe) {
1096
- iframe.contentWindow.postMessage(
1097
- { action: "reloadDashboard", _version: dashboardComponent.libVersion },
1098
- "*"
1099
- );
1100
- return Promise.resolve();
1090
+ // libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
1091
+ var _extendAndValidate = (dashboardContent) => {
1092
+ const defaultKeys = Object.keys(
1093
+ DEFAULT_PARAMETERS
1094
+ );
1095
+ const errorMessages = [];
1096
+ const requiredStringParams = [
1097
+ "appServer",
1098
+ "language",
1099
+ "apiHost"
1100
+ ];
1101
+ const requiredStringOrEmptyParams = [
1102
+ "key",
1103
+ "token",
1104
+ "screenMode",
1105
+ "timezoneId",
1106
+ "itemId",
1107
+ "container",
1108
+ "loaderBackground",
1109
+ "loaderFontColor",
1110
+ "loaderSpinnerColor",
1111
+ "loaderSpinnerBackground"
1112
+ ];
1113
+ const objectParams = ["itemDimensions"];
1114
+ const screenModes = [
1115
+ "mobile",
1116
+ "tablet",
1117
+ "desktop",
1118
+ "largeScreen",
1119
+ "fixed",
1120
+ "auto"
1121
+ ];
1122
+ for (const key of defaultKeys) {
1123
+ if (dashboardContent.params[key] === null) {
1124
+ delete dashboardContent.params[key];
1125
+ }
1101
1126
  }
1102
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
1103
- };
1104
-
1105
- // libs/embed-libs/shared-embed/src/lib/methods/set-authorization.ts
1106
- var setAuthorization = (dashboardComponent, iframe, key, token) => {
1107
- if (iframe) {
1108
- iframe.contentWindow.postMessage(
1109
- {
1110
- action: "setAuthorization",
1111
- key,
1112
- token,
1113
- _version: dashboardComponent.libVersion
1114
- },
1115
- "*"
1116
- );
1117
- return Promise.resolve();
1127
+ dashboardContent.params = defaultsDeep(
1128
+ dashboardContent.params,
1129
+ DEFAULT_PARAMETERS
1130
+ );
1131
+ if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
1132
+ delete dashboardContent.params.dashboardId;
1133
+ delete dashboardContent.params.dashboardSlug;
1118
1134
  }
1119
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
1120
- };
1121
-
1122
- // libs/embed-libs/shared-embed/src/lib/methods/set-edit-mode.ts
1123
- var setEditMode = (dashboardComponent, iframe, editMode) => {
1124
- if (iframe && iframe.contentWindow) {
1125
- const requestId = uuidv4();
1126
- if (dashboardComponent.params.editMode === editMode) {
1127
- return Promise.reject(
1128
- new Error("editMode parameter is currently already set to " + editMode)
1129
- );
1130
- } else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
1131
- return Promise.reject(
1132
- new Error(
1133
- "The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
1134
- )
1135
- );
1135
+ for (const key of requiredStringParams) {
1136
+ if (typeof dashboardContent.params[key] !== "string") {
1137
+ delete dashboardContent.params[key];
1138
+ errorMessages.push(`${key} needs to be of type string.`);
1136
1139
  }
1137
- iframe.contentWindow.postMessage(
1138
- {
1139
- action: "setEditMode",
1140
- editMode,
1141
- _version: dashboardComponent.libVersion,
1142
- requestId
1143
- },
1144
- "*"
1145
- );
1146
- return new Promise((resolve, reject) => {
1147
- dashboardComponent.promises[requestId] = { resolve, reject };
1148
- });
1149
1140
  }
1150
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
1151
- };
1152
-
1153
- // libs/embed-libs/shared-embed/src/lib/methods/set-filters.ts
1154
- var setFilters = (dashboardComponent, iframe, itemId, filters) => {
1155
- if (iframe) {
1156
- const requestId = uuidv4();
1157
- iframe.contentWindow.postMessage(
1158
- {
1159
- action: "setFilters",
1160
- itemId,
1161
- filters,
1162
- _version: dashboardComponent.libVersion,
1163
- requestId
1164
- },
1165
- "*"
1166
- );
1167
- return new Promise((resolve, reject) => {
1168
- dashboardComponent.promises[requestId] = { resolve, reject };
1169
- setTimeout(() => {
1170
- if (dashboardComponent.promises[requestId]) {
1171
- const errorMessage = "setFilters request timed out.";
1172
- dashboardComponent.promises[requestId].reject(
1173
- new Error(errorMessage)
1174
- );
1175
- delete dashboardComponent.promises[requestId];
1176
- }
1177
- }, 2e3);
1178
- });
1141
+ for (const key of requiredStringOrEmptyParams) {
1142
+ if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
1143
+ delete dashboardContent.params[key];
1144
+ errorMessages.push(`${key} needs to be of type string or empty.`);
1145
+ }
1179
1146
  }
1180
- return Promise.reject();
1181
- };
1182
-
1183
- // libs/embed-libs/shared-embed/src/lib/methods/set-preview.ts
1184
- var setPreview = (dashboardComponent, iframe, preview) => {
1185
- if (iframe) {
1186
- const requestId = uuidv4();
1187
- iframe.contentWindow.postMessage(
1188
- {
1189
- action: "setPreview",
1190
- preview,
1191
- requestId,
1192
- _version: dashboardComponent.libVersion
1193
- },
1194
- "*"
1147
+ if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
1148
+ const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
1149
+ errorMessages.push(
1150
+ `"screenMode" needs should be one of these types: ${validTypesString}`
1195
1151
  );
1196
- return new Promise((resolve, reject) => {
1197
- dashboardComponent.promises[requestId] = { resolve, reject };
1198
- setTimeout(() => {
1199
- if (dashboardComponent.promises[requestId]) {
1200
- const errorMessage = "setPreview request timed out.";
1201
- dashboardComponent.promises[requestId].reject(
1202
- new Error(errorMessage)
1203
- );
1204
- delete dashboardComponent.promises[requestId];
1205
- }
1206
- }, 2e3);
1207
- });
1152
+ dashboardContent.params.screenMode = "auto";
1208
1153
  }
1209
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
1210
- };
1211
-
1212
- // libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
1213
- var _setCalculatedDimensions = (dashboardComponent) => {
1214
- if (!dashboardComponent.dimensions) {
1215
- dashboardComponent.params.error = true;
1216
- _handleError("Got no valid dimensions.", dashboardComponent.params);
1217
- return;
1154
+ if (dashboardContent.params.itemId) {
1155
+ dashboardContent.params.itemEmbedding = true;
1218
1156
  }
1219
- const dashboardDimensionKeys = Object.keys(
1220
- dashboardComponent.dimensions
1221
- );
1222
- const availableScreenModeExtents = [];
1223
- let currentMode;
1224
- let currentWidth = 0;
1225
- let currentHeight = 0;
1226
- if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
1227
- dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
1157
+ for (const key of objectParams) {
1158
+ if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
1159
+ delete dashboardContent.params[key];
1160
+ errorMessages.push(`${key} needs to be of type object or empty.`);
1161
+ }
1228
1162
  }
1229
- if (dashboardComponent.dimensions && dashboardDimensionKeys?.[0] === "fixed") {
1230
- currentMode = "fixed";
1231
- currentWidth = dashboardComponent.dimensions.fixed[0];
1232
- currentHeight = dashboardComponent.dimensions.fixed[1];
1233
- } else {
1234
- const screenModes = [
1235
- "mobile",
1236
- "tablet",
1237
- "desktop",
1238
- "largeScreen"
1239
- ];
1240
- if (dashboardComponent.params.itemEmbedding) {
1241
- const [firstMatch] = dashboardDimensionKeys;
1242
- let match = cloneDeep(firstMatch);
1243
- for (const screenMode of screenModes) {
1244
- const found = dashboardDimensionKeys.find((key) => key === screenMode);
1245
- if (found) {
1246
- match = cloneDeep(found);
1247
- } else {
1248
- dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
1249
- }
1250
- }
1251
- }
1252
- for (const key of dashboardDimensionKeys) {
1253
- if (screenModes.includes(key)) {
1254
- const screenMode = EXTENTS.find((extent) => extent.mode === key);
1255
- availableScreenModeExtents.push({
1256
- ...screenMode,
1257
- height: dashboardComponent.dimensions[key][1] || 50
1258
- });
1259
- }
1260
- }
1261
- if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
1262
- dashboardComponent.params.screenMode = "auto";
1263
- }
1264
- if (dashboardComponent.params.screenMode === "auto") {
1265
- availableScreenModeExtents.sort(
1266
- (a3, b3) => screenModes.indexOf(a3.mode) - screenModes.indexOf(b3.mode)
1267
- );
1268
- for (const screenModeExtent of availableScreenModeExtents) {
1269
- const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
1270
- if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
1271
- if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
1272
- currentMode = screenModeExtent.mode;
1273
- currentWidth = Number.parseInt(
1274
- dashboardComponent.params.itemDimensions.width,
1275
- 10
1276
- );
1277
- currentHeight = dashboardComponent.dimensions[currentMode][1];
1278
- }
1279
- } else {
1280
- if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
1281
- currentMode = screenModeExtent.mode;
1282
- if (dashboardComponent.params.itemEmbedding) {
1283
- currentWidth = dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto" ? Number.parseInt(
1284
- dashboardComponent.params.itemDimensions.width,
1285
- 10
1286
- ) : Math.min(
1287
- dashboardComponent.containerWidth,
1288
- screenModeExtentMaxWidth
1289
- );
1290
- currentHeight = dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto" ? Number.parseInt(
1291
- dashboardComponent.params.itemDimensions.height,
1292
- 10
1293
- ) : dashboardComponent.dimensions[currentMode][1];
1294
- if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
1295
- currentWidth = Number.parseInt(
1296
- dashboardComponent.params.itemDimensions.width,
1297
- 10
1298
- );
1299
- currentHeight = dashboardComponent.dimensions[currentMode][1];
1300
- }
1301
- } else {
1302
- currentWidth = Math.max(
1303
- Math.min(
1304
- screenModeExtentMaxWidth,
1305
- dashboardComponent.containerWidth
1306
- ),
1307
- screenModeExtentMinWidth
1308
- );
1309
- currentHeight = screenModeExtent.height;
1310
- }
1311
- }
1312
- }
1313
- }
1314
- } else {
1315
- const {
1316
- height: chosenModeHeight,
1317
- width: [chosenModeMinWidth, chosenModeMaxWidth]
1318
- } = availableScreenModeExtents.find(
1319
- (d3) => d3.mode === dashboardComponent.params.screenMode
1320
- );
1321
- currentMode = dashboardComponent.params.screenMode;
1322
- currentWidth = Math.max(
1323
- Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
1324
- chosenModeMinWidth
1325
- );
1326
- currentHeight = chosenModeHeight;
1327
- if (dashboardComponent.params.itemEmbedding) {
1328
- if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
1329
- currentWidth = Number.parseInt(
1330
- dashboardComponent.params.itemDimensions.width,
1331
- 10
1332
- );
1333
- }
1334
- if (dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto") {
1335
- currentHeight = Number.parseInt(
1336
- dashboardComponent.params.itemDimensions.height,
1337
- 10
1338
- );
1339
- }
1340
- }
1341
- }
1342
- if (!currentMode && availableScreenModeExtents.length > 0) {
1343
- const [lowestModeExtent] = availableScreenModeExtents;
1344
- currentMode = lowestModeExtent.mode;
1345
- currentWidth = lowestModeExtent.width[0];
1346
- currentHeight = lowestModeExtent.height;
1347
- }
1348
- }
1349
- dashboardComponent.currentScreenMode = currentMode;
1350
- const style = {
1351
- height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
1352
- width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
1353
- opacity: 1
1354
- };
1355
- const dashboardEditModes = ["editFull", "editLimited"];
1356
- if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
1357
- style.height = "100%";
1358
- style.width = "100%";
1359
- } else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
1360
- style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
1361
- "px",
1362
- ""
1363
- )}px`;
1364
- style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
1365
- "px",
1366
- ""
1367
- )}px`;
1368
- } else {
1369
- style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
1370
- style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
1371
- }
1372
- dashboardComponent.currentScreenMode = currentMode;
1373
- dashboardComponent.iframeStyle = style;
1374
- };
1375
-
1376
- // libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
1377
- var _extendAndValidate = (dashboardContent) => {
1378
- const defaultKeys = Object.keys(
1379
- DEFAULT_PARAMETERS
1380
- );
1381
- const errorMessages = [];
1382
- const requiredStringParams = [
1383
- "appServer",
1384
- "language",
1385
- "apiHost"
1386
- ];
1387
- const requiredStringOrEmptyParams = [
1388
- "key",
1389
- "token",
1390
- "screenMode",
1391
- "timezoneId",
1392
- "itemId",
1393
- "container",
1394
- "loaderBackground",
1395
- "loaderFontColor",
1396
- "loaderSpinnerColor",
1397
- "loaderSpinnerBackground"
1398
- ];
1399
- const objectParams = ["itemDimensions"];
1400
- const screenModes = [
1401
- "mobile",
1402
- "tablet",
1403
- "desktop",
1404
- "largeScreen",
1405
- "fixed",
1406
- "auto"
1407
- ];
1408
- for (const key of defaultKeys) {
1409
- if (dashboardContent.params[key] === null) {
1410
- delete dashboardContent.params[key];
1411
- }
1412
- }
1413
- dashboardContent.params = defaultsDeep(
1414
- dashboardContent.params,
1415
- DEFAULT_PARAMETERS
1416
- );
1417
- if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
1418
- delete dashboardContent.params.dashboardId;
1419
- delete dashboardContent.params.dashboardSlug;
1420
- }
1421
- for (const key of requiredStringParams) {
1422
- if (typeof dashboardContent.params[key] !== "string") {
1423
- delete dashboardContent.params[key];
1424
- errorMessages.push(`${key} needs to be of type string.`);
1425
- }
1426
- }
1427
- for (const key of requiredStringOrEmptyParams) {
1428
- if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
1429
- delete dashboardContent.params[key];
1430
- errorMessages.push(`${key} needs to be of type string or empty.`);
1431
- }
1432
- }
1433
- if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
1434
- const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
1435
- errorMessages.push(
1436
- `"screenMode" needs should be one of these types: ${validTypesString}`
1437
- );
1438
- dashboardContent.params.screenMode = "auto";
1439
- }
1440
- if (dashboardContent.params.itemId) {
1441
- dashboardContent.params.itemEmbedding = true;
1442
- }
1443
- for (const key of objectParams) {
1444
- if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
1445
- delete dashboardContent.params[key];
1446
- errorMessages.push(`${key} needs to be of type object or empty.`);
1447
- }
1448
- }
1449
- if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
1450
- errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
1451
- dashboardContent.params.switchScreenModeOnResize = true;
1452
- }
1453
- if (dashboardContent.params.itemDimensions) {
1454
- const itemDimensionsKeys = [
1455
- "width",
1456
- "height"
1163
+ if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
1164
+ errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
1165
+ dashboardContent.params.switchScreenModeOnResize = true;
1166
+ }
1167
+ if (dashboardContent.params.itemDimensions) {
1168
+ const itemDimensionsKeys = [
1169
+ "width",
1170
+ "height"
1457
1171
  ];
1458
1172
  for (const key of itemDimensionsKeys) {
1459
1173
  if (!["string", "number"].includes(
@@ -5446,6 +5160,7 @@ var slotParser = z.object({
5446
5160
  format: z.string().optional(),
5447
5161
  label: z.union([z.string(), z.record(z.string())]).optional(),
5448
5162
  column: z.string().uuid().optional(),
5163
+ formula: z.string().uuid().optional(),
5449
5164
  set: z.string().uuid().optional(),
5450
5165
  aggregationFunc: z.string().optional(),
5451
5166
  subtype: z.string().optional(),
@@ -5527,7 +5242,8 @@ var vizItemOptionsParser = z.object({
5527
5242
  tileProvider: z.record(z.any()).optional(),
5528
5243
  vectorTileProvider: z.record(z.any()).optional(),
5529
5244
  sources: z.record(z.any()).optional(),
5530
- display: z.union([z.record(z.any()), z.object({ title: z.boolean() })]).optional()
5245
+ display: z.union([z.record(z.any()), z.object({ title: z.boolean() })]).optional(),
5246
+ timezoneId: z.string().optional()
5531
5247
  });
5532
5248
  var canFilterParser = z.union([z.array(z.string()), z.literal("all")]);
5533
5249
  var libraryTypeToWebComponentTypeMapping = {
@@ -5629,6 +5345,357 @@ async function loadLibrary(appServer, componentName = "DashboardApp") {
5629
5345
  return wrappedModule;
5630
5346
  }
5631
5347
 
5348
+ // node_modules/@lit/reactive-element/decorators/custom-element.js
5349
+ var t = (t5) => (e7, o6) => {
5350
+ void 0 !== o6 ? o6.addInitializer(() => {
5351
+ customElements.define(t5, e7);
5352
+ }) : customElements.define(t5, e7);
5353
+ };
5354
+
5355
+ // node_modules/@lit/reactive-element/css-tag.js
5356
+ var t2 = globalThis;
5357
+ var e = t2.ShadowRoot && (void 0 === t2.ShadyCSS || t2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
5358
+ var s = Symbol();
5359
+ var o = /* @__PURE__ */ new WeakMap();
5360
+ var n = class {
5361
+ constructor(t5, e7, o6) {
5362
+ if (this._$cssResult$ = true, o6 !== s)
5363
+ throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
5364
+ this.cssText = t5, this.t = e7;
5365
+ }
5366
+ get styleSheet() {
5367
+ let t5 = this.o;
5368
+ const s4 = this.t;
5369
+ if (e && void 0 === t5) {
5370
+ const e7 = void 0 !== s4 && 1 === s4.length;
5371
+ e7 && (t5 = o.get(s4)), void 0 === t5 && ((this.o = t5 = new CSSStyleSheet()).replaceSync(this.cssText), e7 && o.set(s4, t5));
5372
+ }
5373
+ return t5;
5374
+ }
5375
+ toString() {
5376
+ return this.cssText;
5377
+ }
5378
+ };
5379
+ var r = (t5) => new n("string" == typeof t5 ? t5 : t5 + "", void 0, s);
5380
+ var i = (t5, ...e7) => {
5381
+ const o6 = 1 === t5.length ? t5[0] : e7.reduce((e8, s4, o7) => e8 + ((t6) => {
5382
+ if (true === t6._$cssResult$)
5383
+ return t6.cssText;
5384
+ if ("number" == typeof t6)
5385
+ return t6;
5386
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + t6 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
5387
+ })(s4) + t5[o7 + 1], t5[0]);
5388
+ return new n(o6, t5, s);
5389
+ };
5390
+ var S = (s4, o6) => {
5391
+ if (e)
5392
+ s4.adoptedStyleSheets = o6.map((t5) => t5 instanceof CSSStyleSheet ? t5 : t5.styleSheet);
5393
+ else
5394
+ for (const e7 of o6) {
5395
+ const o7 = document.createElement("style"), n6 = t2.litNonce;
5396
+ void 0 !== n6 && o7.setAttribute("nonce", n6), o7.textContent = e7.cssText, s4.appendChild(o7);
5397
+ }
5398
+ };
5399
+ var c = e ? (t5) => t5 : (t5) => t5 instanceof CSSStyleSheet ? ((t6) => {
5400
+ let e7 = "";
5401
+ for (const s4 of t6.cssRules)
5402
+ e7 += s4.cssText;
5403
+ return r(e7);
5404
+ })(t5) : t5;
5405
+
5406
+ // node_modules/@lit/reactive-element/reactive-element.js
5407
+ var { is: i2, defineProperty: e2, getOwnPropertyDescriptor: r2, getOwnPropertyNames: h, getOwnPropertySymbols: o2, getPrototypeOf: n2 } = Object;
5408
+ var a = globalThis;
5409
+ var c2 = a.trustedTypes;
5410
+ var l = c2 ? c2.emptyScript : "";
5411
+ var p = a.reactiveElementPolyfillSupport;
5412
+ var d = (t5, s4) => t5;
5413
+ var u = { toAttribute(t5, s4) {
5414
+ switch (s4) {
5415
+ case Boolean:
5416
+ t5 = t5 ? l : null;
5417
+ break;
5418
+ case Object:
5419
+ case Array:
5420
+ t5 = null == t5 ? t5 : JSON.stringify(t5);
5421
+ }
5422
+ return t5;
5423
+ }, fromAttribute(t5, s4) {
5424
+ let i6 = t5;
5425
+ switch (s4) {
5426
+ case Boolean:
5427
+ i6 = null !== t5;
5428
+ break;
5429
+ case Number:
5430
+ i6 = null === t5 ? null : Number(t5);
5431
+ break;
5432
+ case Object:
5433
+ case Array:
5434
+ try {
5435
+ i6 = JSON.parse(t5);
5436
+ } catch (t6) {
5437
+ i6 = null;
5438
+ }
5439
+ }
5440
+ return i6;
5441
+ } };
5442
+ var f = (t5, s4) => !i2(t5, s4);
5443
+ var y = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
5444
+ Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
5445
+ var b = class extends HTMLElement {
5446
+ static addInitializer(t5) {
5447
+ this._$Ei(), (this.l ??= []).push(t5);
5448
+ }
5449
+ static get observedAttributes() {
5450
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
5451
+ }
5452
+ static createProperty(t5, s4 = y) {
5453
+ if (s4.state && (s4.attribute = false), this._$Ei(), this.elementProperties.set(t5, s4), !s4.noAccessor) {
5454
+ const i6 = Symbol(), r7 = this.getPropertyDescriptor(t5, i6, s4);
5455
+ void 0 !== r7 && e2(this.prototype, t5, r7);
5456
+ }
5457
+ }
5458
+ static getPropertyDescriptor(t5, s4, i6) {
5459
+ const { get: e7, set: h3 } = r2(this.prototype, t5) ?? { get() {
5460
+ return this[s4];
5461
+ }, set(t6) {
5462
+ this[s4] = t6;
5463
+ } };
5464
+ return { get() {
5465
+ return e7?.call(this);
5466
+ }, set(s5) {
5467
+ const r7 = e7?.call(this);
5468
+ h3.call(this, s5), this.requestUpdate(t5, r7, i6);
5469
+ }, configurable: true, enumerable: true };
5470
+ }
5471
+ static getPropertyOptions(t5) {
5472
+ return this.elementProperties.get(t5) ?? y;
5473
+ }
5474
+ static _$Ei() {
5475
+ if (this.hasOwnProperty(d("elementProperties")))
5476
+ return;
5477
+ const t5 = n2(this);
5478
+ t5.finalize(), void 0 !== t5.l && (this.l = [...t5.l]), this.elementProperties = new Map(t5.elementProperties);
5479
+ }
5480
+ static finalize() {
5481
+ if (this.hasOwnProperty(d("finalized")))
5482
+ return;
5483
+ if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
5484
+ const t6 = this.properties, s4 = [...h(t6), ...o2(t6)];
5485
+ for (const i6 of s4)
5486
+ this.createProperty(i6, t6[i6]);
5487
+ }
5488
+ const t5 = this[Symbol.metadata];
5489
+ if (null !== t5) {
5490
+ const s4 = litPropertyMetadata.get(t5);
5491
+ if (void 0 !== s4)
5492
+ for (const [t6, i6] of s4)
5493
+ this.elementProperties.set(t6, i6);
5494
+ }
5495
+ this._$Eh = /* @__PURE__ */ new Map();
5496
+ for (const [t6, s4] of this.elementProperties) {
5497
+ const i6 = this._$Eu(t6, s4);
5498
+ void 0 !== i6 && this._$Eh.set(i6, t6);
5499
+ }
5500
+ this.elementStyles = this.finalizeStyles(this.styles);
5501
+ }
5502
+ static finalizeStyles(s4) {
5503
+ const i6 = [];
5504
+ if (Array.isArray(s4)) {
5505
+ const e7 = new Set(s4.flat(1 / 0).reverse());
5506
+ for (const s5 of e7)
5507
+ i6.unshift(c(s5));
5508
+ } else
5509
+ void 0 !== s4 && i6.push(c(s4));
5510
+ return i6;
5511
+ }
5512
+ static _$Eu(t5, s4) {
5513
+ const i6 = s4.attribute;
5514
+ return false === i6 ? void 0 : "string" == typeof i6 ? i6 : "string" == typeof t5 ? t5.toLowerCase() : void 0;
5515
+ }
5516
+ constructor() {
5517
+ super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
5518
+ }
5519
+ _$Ev() {
5520
+ this._$ES = new Promise((t5) => this.enableUpdating = t5), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t5) => t5(this));
5521
+ }
5522
+ addController(t5) {
5523
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(t5), void 0 !== this.renderRoot && this.isConnected && t5.hostConnected?.();
5524
+ }
5525
+ removeController(t5) {
5526
+ this._$EO?.delete(t5);
5527
+ }
5528
+ _$E_() {
5529
+ const t5 = /* @__PURE__ */ new Map(), s4 = this.constructor.elementProperties;
5530
+ for (const i6 of s4.keys())
5531
+ this.hasOwnProperty(i6) && (t5.set(i6, this[i6]), delete this[i6]);
5532
+ t5.size > 0 && (this._$Ep = t5);
5533
+ }
5534
+ createRenderRoot() {
5535
+ const t5 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
5536
+ return S(t5, this.constructor.elementStyles), t5;
5537
+ }
5538
+ connectedCallback() {
5539
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t5) => t5.hostConnected?.());
5540
+ }
5541
+ enableUpdating(t5) {
5542
+ }
5543
+ disconnectedCallback() {
5544
+ this._$EO?.forEach((t5) => t5.hostDisconnected?.());
5545
+ }
5546
+ attributeChangedCallback(t5, s4, i6) {
5547
+ this._$AK(t5, i6);
5548
+ }
5549
+ _$EC(t5, s4) {
5550
+ const i6 = this.constructor.elementProperties.get(t5), e7 = this.constructor._$Eu(t5, i6);
5551
+ if (void 0 !== e7 && true === i6.reflect) {
5552
+ const r7 = (void 0 !== i6.converter?.toAttribute ? i6.converter : u).toAttribute(s4, i6.type);
5553
+ this._$Em = t5, null == r7 ? this.removeAttribute(e7) : this.setAttribute(e7, r7), this._$Em = null;
5554
+ }
5555
+ }
5556
+ _$AK(t5, s4) {
5557
+ const i6 = this.constructor, e7 = i6._$Eh.get(t5);
5558
+ if (void 0 !== e7 && this._$Em !== e7) {
5559
+ const t6 = i6.getPropertyOptions(e7), r7 = "function" == typeof t6.converter ? { fromAttribute: t6.converter } : void 0 !== t6.converter?.fromAttribute ? t6.converter : u;
5560
+ this._$Em = e7, this[e7] = r7.fromAttribute(s4, t6.type), this._$Em = null;
5561
+ }
5562
+ }
5563
+ requestUpdate(t5, s4, i6) {
5564
+ if (void 0 !== t5) {
5565
+ if (i6 ??= this.constructor.getPropertyOptions(t5), !(i6.hasChanged ?? f)(this[t5], s4))
5566
+ return;
5567
+ this.P(t5, s4, i6);
5568
+ }
5569
+ false === this.isUpdatePending && (this._$ES = this._$ET());
5570
+ }
5571
+ P(t5, s4, i6) {
5572
+ this._$AL.has(t5) || this._$AL.set(t5, s4), true === i6.reflect && this._$Em !== t5 && (this._$Ej ??= /* @__PURE__ */ new Set()).add(t5);
5573
+ }
5574
+ async _$ET() {
5575
+ this.isUpdatePending = true;
5576
+ try {
5577
+ await this._$ES;
5578
+ } catch (t6) {
5579
+ Promise.reject(t6);
5580
+ }
5581
+ const t5 = this.scheduleUpdate();
5582
+ return null != t5 && await t5, !this.isUpdatePending;
5583
+ }
5584
+ scheduleUpdate() {
5585
+ return this.performUpdate();
5586
+ }
5587
+ performUpdate() {
5588
+ if (!this.isUpdatePending)
5589
+ return;
5590
+ if (!this.hasUpdated) {
5591
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
5592
+ for (const [t7, s5] of this._$Ep)
5593
+ this[t7] = s5;
5594
+ this._$Ep = void 0;
5595
+ }
5596
+ const t6 = this.constructor.elementProperties;
5597
+ if (t6.size > 0)
5598
+ for (const [s5, i6] of t6)
5599
+ true !== i6.wrapped || this._$AL.has(s5) || void 0 === this[s5] || this.P(s5, this[s5], i6);
5600
+ }
5601
+ let t5 = false;
5602
+ const s4 = this._$AL;
5603
+ try {
5604
+ t5 = this.shouldUpdate(s4), t5 ? (this.willUpdate(s4), this._$EO?.forEach((t6) => t6.hostUpdate?.()), this.update(s4)) : this._$EU();
5605
+ } catch (s5) {
5606
+ throw t5 = false, this._$EU(), s5;
5607
+ }
5608
+ t5 && this._$AE(s4);
5609
+ }
5610
+ willUpdate(t5) {
5611
+ }
5612
+ _$AE(t5) {
5613
+ this._$EO?.forEach((t6) => t6.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t5)), this.updated(t5);
5614
+ }
5615
+ _$EU() {
5616
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
5617
+ }
5618
+ get updateComplete() {
5619
+ return this.getUpdateComplete();
5620
+ }
5621
+ getUpdateComplete() {
5622
+ return this._$ES;
5623
+ }
5624
+ shouldUpdate(t5) {
5625
+ return true;
5626
+ }
5627
+ update(t5) {
5628
+ this._$Ej &&= this._$Ej.forEach((t6) => this._$EC(t6, this[t6])), this._$EU();
5629
+ }
5630
+ updated(t5) {
5631
+ }
5632
+ firstUpdated(t5) {
5633
+ }
5634
+ };
5635
+ b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[d("elementProperties")] = /* @__PURE__ */ new Map(), b[d("finalized")] = /* @__PURE__ */ new Map(), p?.({ ReactiveElement: b }), (a.reactiveElementVersions ??= []).push("2.0.4");
5636
+
5637
+ // node_modules/@lit/reactive-element/decorators/property.js
5638
+ var o3 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
5639
+ var r3 = (t5 = o3, e7, r7) => {
5640
+ const { kind: n6, metadata: i6 } = r7;
5641
+ let s4 = globalThis.litPropertyMetadata.get(i6);
5642
+ if (void 0 === s4 && globalThis.litPropertyMetadata.set(i6, s4 = /* @__PURE__ */ new Map()), s4.set(r7.name, t5), "accessor" === n6) {
5643
+ const { name: o6 } = r7;
5644
+ return { set(r8) {
5645
+ const n7 = e7.get.call(this);
5646
+ e7.set.call(this, r8), this.requestUpdate(o6, n7, t5);
5647
+ }, init(e8) {
5648
+ return void 0 !== e8 && this.P(o6, void 0, t5), e8;
5649
+ } };
5650
+ }
5651
+ if ("setter" === n6) {
5652
+ const { name: o6 } = r7;
5653
+ return function(r8) {
5654
+ const n7 = this[o6];
5655
+ e7.call(this, r8), this.requestUpdate(o6, n7, t5);
5656
+ };
5657
+ }
5658
+ throw Error("Unsupported decorator location: " + n6);
5659
+ };
5660
+ function n3(t5) {
5661
+ return (e7, o6) => "object" == typeof o6 ? r3(t5, e7, o6) : ((t6, e8, o7) => {
5662
+ const r7 = e8.hasOwnProperty(o7);
5663
+ return e8.constructor.createProperty(o7, r7 ? { ...t6, wrapped: true } : t6), r7 ? Object.getOwnPropertyDescriptor(e8, o7) : void 0;
5664
+ })(t5, e7, o6);
5665
+ }
5666
+
5667
+ // node_modules/@lit/reactive-element/decorators/state.js
5668
+ function r4(r7) {
5669
+ return n3({ ...r7, state: true, attribute: false });
5670
+ }
5671
+
5672
+ // node_modules/@lit/reactive-element/decorators/base.js
5673
+ var e3 = (e7, t5, c4) => (c4.configurable = true, c4.enumerable = true, Reflect.decorate && "object" != typeof t5 && Object.defineProperty(e7, t5, c4), c4);
5674
+
5675
+ // node_modules/@lit/reactive-element/decorators/query.js
5676
+ function e4(e7, r7) {
5677
+ return (n6, s4, i6) => {
5678
+ const o6 = (t5) => t5.renderRoot?.querySelector(e7) ?? null;
5679
+ if (r7) {
5680
+ const { get: e8, set: r8 } = "object" == typeof s4 ? n6 : i6 ?? (() => {
5681
+ const t5 = Symbol();
5682
+ return { get() {
5683
+ return this[t5];
5684
+ }, set(e9) {
5685
+ this[t5] = e9;
5686
+ } };
5687
+ })();
5688
+ return e3(n6, s4, { get() {
5689
+ let t5 = e8.call(this);
5690
+ return void 0 === t5 && (t5 = o6(this), (null !== t5 || this.hasUpdated) && r8.call(this, t5)), t5;
5691
+ } });
5692
+ }
5693
+ return e3(n6, s4, { get() {
5694
+ return o6(this);
5695
+ } });
5696
+ };
5697
+ }
5698
+
5632
5699
  // node_modules/lit-html/lit-html.js
5633
5700
  var t3 = globalThis;
5634
5701
  var i3 = t3.trustedTypes;
@@ -5978,7 +6045,7 @@ var o5 = e6(class extends i4 {
5978
6045
  });
5979
6046
 
5980
6047
  // libs/embed-libs/embed/package.json
5981
- var version = "6.0.0-beta.0";
6048
+ var version = "6.0.0-beta.1";
5982
6049
 
5983
6050
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
5984
6051
  var LuzmoService = class {