@luzmo/embed 5.0.5 → 5.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,766 +1,1227 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const SharedLib = require("@luzmo/shared-embed");
5
- function _interopNamespaceDefault(e2) {
6
- const n3 = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
- if (e2) {
8
- for (const k2 in e2) {
9
- if (k2 !== "default") {
10
- const d2 = Object.getOwnPropertyDescriptor(e2, k2);
11
- Object.defineProperty(n3, k2, d2.get ? d2 : {
12
- enumerable: true,
13
- get: () => e2[k2]
14
- });
15
- }
16
- }
17
- }
18
- n3.default = e2;
19
- return Object.freeze(n3);
20
- }
21
- const SharedLib__namespace = /* @__PURE__ */ _interopNamespaceDefault(SharedLib);
22
- /**
23
- * @license
24
- * Copyright 2019 Google LLC
25
- * SPDX-License-Identifier: BSD-3-Clause
26
- */
27
- const t$3 = globalThis, e$5 = t$3.ShadowRoot && (void 0 === t$3.ShadyCSS || t$3.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$2 = Symbol(), o$4 = /* @__PURE__ */ new WeakMap();
28
- let n$4 = class n {
29
- constructor(t2, e2, o2) {
30
- if (this._$cssResult$ = true, o2 !== s$2)
31
- throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
32
- this.cssText = t2, this.t = e2;
33
- }
34
- get styleSheet() {
35
- let t2 = this.o;
36
- const s2 = this.t;
37
- if (e$5 && void 0 === t2) {
38
- const e2 = void 0 !== s2 && 1 === s2.length;
39
- e2 && (t2 = o$4.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$4.set(s2, t2));
40
- }
41
- return t2;
42
- }
43
- toString() {
44
- return this.cssText;
45
- }
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
46
11
  };
47
- const r$5 = (t2) => new n$4("string" == typeof t2 ? t2 : t2 + "", void 0, s$2), i$4 = (t2, ...e2) => {
48
- const o2 = 1 === t2.length ? t2[0] : e2.reduce((e3, s2, o3) => e3 + ((t3) => {
49
- if (true === t3._$cssResult$)
50
- return t3.cssText;
51
- if ("number" == typeof t3)
52
- return t3;
53
- throw Error("Value passed to 'css' function must be a 'css' function result: " + t3 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
54
- })(s2) + t2[o3 + 1], t2[0]);
55
- return new n$4(o2, t2, s$2);
56
- }, S$1 = (s2, o2) => {
57
- if (e$5)
58
- s2.adoptedStyleSheets = o2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet);
59
- else
60
- for (const e2 of o2) {
61
- const o3 = document.createElement("style"), n3 = t$3.litNonce;
62
- void 0 !== n3 && o3.setAttribute("nonce", n3), o3.textContent = e2.cssText, s2.appendChild(o3);
63
- }
64
- }, c$2 = e$5 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
65
- let e2 = "";
66
- for (const s2 of t3.cssRules)
67
- e2 += s2.cssText;
68
- return r$5(e2);
69
- })(t2) : t2;
70
- /**
71
- * @license
72
- * Copyright 2017 Google LLC
73
- * SPDX-License-Identifier: BSD-3-Clause
74
- */
75
- const { is: i$3, defineProperty: e$4, getOwnPropertyDescriptor: r$4, getOwnPropertyNames: h$1, getOwnPropertySymbols: o$3, getPrototypeOf: n$3 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (t2, s2) => t2, u$1 = { toAttribute(t2, s2) {
76
- switch (s2) {
77
- case Boolean:
78
- t2 = t2 ? l$1 : null;
79
- break;
80
- case Object:
81
- case Array:
82
- t2 = null == t2 ? t2 : JSON.stringify(t2);
83
- }
84
- return t2;
85
- }, fromAttribute(t2, s2) {
86
- let i3 = t2;
87
- switch (s2) {
88
- case Boolean:
89
- i3 = null !== t2;
90
- break;
91
- case Number:
92
- i3 = null === t2 ? null : Number(t2);
93
- break;
94
- case Object:
95
- case Array:
96
- try {
97
- i3 = JSON.parse(t2);
98
- } catch (t3) {
99
- i3 = null;
100
- }
101
- }
102
- return i3;
103
- } }, f$1 = (t2, s2) => !i$3(t2, s2), y$1 = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$1 };
104
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), a$1.litPropertyMetadata ?? (a$1.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
105
- class b extends HTMLElement {
106
- static addInitializer(t2) {
107
- this._$Ei(), (this.l ?? (this.l = [])).push(t2);
108
- }
109
- static get observedAttributes() {
110
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
111
- }
112
- static createProperty(t2, s2 = y$1) {
113
- if (s2.state && (s2.attribute = false), this._$Ei(), this.elementProperties.set(t2, s2), !s2.noAccessor) {
114
- const i3 = Symbol(), r2 = this.getPropertyDescriptor(t2, i3, s2);
115
- void 0 !== r2 && e$4(this.prototype, t2, r2);
116
- }
117
- }
118
- static getPropertyDescriptor(t2, s2, i3) {
119
- const { get: e2, set: h2 } = r$4(this.prototype, t2) ?? { get() {
120
- return this[s2];
121
- }, set(t3) {
122
- this[s2] = t3;
123
- } };
124
- return { get() {
125
- return e2 == null ? void 0 : e2.call(this);
126
- }, set(s3) {
127
- const r2 = e2 == null ? void 0 : e2.call(this);
128
- h2.call(this, s3), this.requestUpdate(t2, r2, i3);
129
- }, configurable: true, enumerable: true };
130
- }
131
- static getPropertyOptions(t2) {
132
- return this.elementProperties.get(t2) ?? y$1;
133
- }
134
- static _$Ei() {
135
- if (this.hasOwnProperty(d$1("elementProperties")))
136
- return;
137
- const t2 = n$3(this);
138
- t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties);
12
+
13
+ // libs/embed-libs/shared-embed/src/lib/helpers/error.ts
14
+ var _handleError = (errorMessage, parameters) => {
15
+ let message = "The dashboard component encountered an error";
16
+ if (typeof parameters?.dashboardId === "string") {
17
+ message += ` for dashboard with id ${parameters.dashboardId}`;
139
18
  }
140
- static finalize() {
141
- if (this.hasOwnProperty(d$1("finalized")))
142
- return;
143
- if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
144
- const t3 = this.properties, s2 = [...h$1(t3), ...o$3(t3)];
145
- for (const i3 of s2)
146
- this.createProperty(i3, t3[i3]);
147
- }
148
- const t2 = this[Symbol.metadata];
149
- if (null !== t2) {
150
- const s2 = litPropertyMetadata.get(t2);
151
- if (void 0 !== s2)
152
- for (const [t3, i3] of s2)
153
- this.elementProperties.set(t3, i3);
154
- }
155
- this._$Eh = /* @__PURE__ */ new Map();
156
- for (const [t3, s2] of this.elementProperties) {
157
- const i3 = this._$Eu(t3, s2);
158
- void 0 !== i3 && this._$Eh.set(i3, t3);
159
- }
160
- this.elementStyles = this.finalizeStyles(this.styles);
161
- }
162
- static finalizeStyles(s2) {
163
- const i3 = [];
164
- if (Array.isArray(s2)) {
165
- const e2 = new Set(s2.flat(1 / 0).reverse());
166
- for (const s3 of e2)
167
- i3.unshift(c$2(s3));
168
- } else
169
- void 0 !== s2 && i3.push(c$2(s2));
170
- return i3;
171
- }
172
- static _$Eu(t2, s2) {
173
- const i3 = s2.attribute;
174
- return false === i3 ? void 0 : "string" == typeof i3 ? i3 : "string" == typeof t2 ? t2.toLowerCase() : void 0;
19
+ if (typeof parameters?.dashboardSlug === "string") {
20
+ message += ` for dashboard with slug ${parameters.dashboardSlug}`;
175
21
  }
176
- constructor() {
177
- super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
22
+ if (typeof parameters?.container === "string") {
23
+ message += ` in container ${parameters.container}`;
178
24
  }
179
- _$Ev() {
180
- var _a2;
181
- this._$Eg = new Promise((t2) => this.enableUpdating = t2), this._$AL = /* @__PURE__ */ new Map(), this._$ES(), this.requestUpdate(), (_a2 = this.constructor.l) == null ? void 0 : _a2.forEach((t2) => t2(this));
25
+ if (errorMessage) {
26
+ message += `:
27
+ ${errorMessage}`;
28
+ console.error(message);
182
29
  }
183
- addController(t2) {
184
- var _a2;
185
- (this._$E_ ?? (this._$E_ = /* @__PURE__ */ new Set())).add(t2), void 0 !== this.renderRoot && this.isConnected && ((_a2 = t2.hostConnected) == null ? void 0 : _a2.call(t2));
30
+ };
31
+
32
+ // libs/embed-libs/shared-embed/src/lib/helpers/browser-check.ts
33
+ var _browserCheck = (dashboardComponent) => {
34
+ let hasError = false;
35
+ let errorMessage = "";
36
+ const document_ = document.body || document.documentElement;
37
+ const style = document_.style;
38
+ const browserCheck = {
39
+ svg: !!("createElementNS" in document && document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect),
40
+ flexbox: style.webkitFlexWrap === "" || style.flexWrap === "",
41
+ postMessage: !!window.postMessage
42
+ };
43
+ const browserCheckKeys = ["svg", "flexbox", "postMessage"];
44
+ for (const key of browserCheckKeys) {
45
+ if (!browserCheck[key]) {
46
+ hasError = true;
47
+ dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
48
+ dashboardComponent.browserNotSupported.push(key);
49
+ errorMessage += `Your browser does not support: ${key}
50
+ `;
51
+ }
186
52
  }
187
- removeController(t2) {
188
- var _a2;
189
- (_a2 = this._$E_) == null ? void 0 : _a2.delete(t2);
53
+ const ua = window.navigator.userAgent;
54
+ const msie = ua.includes("MSIE");
55
+ const trident = ua.includes("Trident/");
56
+ if (msie || trident) {
57
+ hasError = true;
58
+ errorMessage = "IE is not supported.";
190
59
  }
191
- _$ES() {
192
- const t2 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties;
193
- for (const i3 of s2.keys())
194
- this.hasOwnProperty(i3) && (t2.set(i3, this[i3]), delete this[i3]);
195
- t2.size > 0 && (this._$Ep = t2);
60
+ if (hasError) {
61
+ _handleError(errorMessage);
196
62
  }
197
- createRenderRoot() {
198
- const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
199
- return S$1(t2, this.constructor.elementStyles), t2;
63
+ };
64
+
65
+ // libs/embed-libs/shared-embed/src/lib/helpers/default-parameters.ts
66
+ var DEFAULT_PARAMETERS = {
67
+ appServer: "https://app.luzmo.com/",
68
+ apiHost: "https://api.luzmo.com/",
69
+ dashboardId: null,
70
+ dashboardSlug: null,
71
+ container: null,
72
+ key: null,
73
+ token: null,
74
+ language: "auto",
75
+ qeVersion: null,
76
+ editMode: null,
77
+ screenMode: null,
78
+ switchScreenModeOnResize: true,
79
+ itemId: null,
80
+ mainColor: "",
81
+ accentColor: "",
82
+ itemDimensions: {
83
+ width: "auto",
84
+ height: "auto"
85
+ },
86
+ loaderBackground: "#f9f9f9",
87
+ loaderFontColor: "#5a5a5a",
88
+ loaderSpinnerColor: "rgba(255, 165, 0, 0.7)",
89
+ loaderSpinnerBackground: "rgba(169, 169, 169, 0.14)",
90
+ timezoneId: null,
91
+ contextId: null
92
+ };
93
+
94
+ // libs/embed-libs/shared-embed/src/lib/helpers/extents.ts
95
+ var EXTENTS = [
96
+ { mode: "mobile", width: [150, 767] },
97
+ { mode: "tablet", width: [768, 1199] },
98
+ { mode: "desktop", width: [1200, 1599] },
99
+ { mode: "largeScreen", width: [1600, 9999] },
100
+ { mode: "fixed", width: [] }
101
+ ];
102
+
103
+ // libs/embed-libs/shared-embed/src/lib/helpers/translations.ts
104
+ var TRANSLATIONS = {
105
+ initializing: { en: "Initializing...", nl: "Laden...", fr: "Chargement..." },
106
+ errorDashboard: {
107
+ en: "Oops, we could not load this dashboard!",
108
+ nl: "Oeps, we konden het dashboard niet laden.",
109
+ fr: "Le chargement a echou\xE9."
110
+ },
111
+ errorItem: {
112
+ en: "Oops, we could not load this item!",
113
+ nl: "Oeps, we konden de grafiek niet laden.",
114
+ fr: "Le chargement a echou\xE9."
200
115
  }
201
- connectedCallback() {
202
- var _a2;
203
- this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(true), (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t2) => {
204
- var _a3;
205
- return (_a3 = t2.hostConnected) == null ? void 0 : _a3.call(t2);
206
- });
116
+ };
117
+ var translations_default = TRANSLATIONS;
118
+
119
+ // libs/embed-libs/shared-embed/src/lib/helpers/utils.ts
120
+ var addTrailingSlash = (serverUrl) => {
121
+ if (!serverUrl) {
122
+ return "";
207
123
  }
208
- enableUpdating(t2) {
124
+ return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
125
+ };
126
+ var removeTrailingSlash = (serverUrl) => {
127
+ if (!serverUrl) {
128
+ return "";
209
129
  }
210
- disconnectedCallback() {
211
- var _a2;
212
- (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t2) => {
213
- var _a3;
214
- return (_a3 = t2.hostDisconnected) == null ? void 0 : _a3.call(t2);
130
+ return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
131
+ };
132
+ var formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
133
+ const combineRights = (securable, user2) => {
134
+ const matchingUser = securable.users.find((u) => u.id === user2.id);
135
+ const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
136
+ flagRead: matchingUser.userAccessRight.flagRead,
137
+ flagUse: matchingUser.userAccessRight.flagUse,
138
+ flagModify: matchingUser.userAccessRight.flagModify,
139
+ flagOwn: matchingUser.userAccessRight.flagOwn
140
+ } : {
141
+ flagRead: false,
142
+ flagUse: false,
143
+ flagModify: false,
144
+ flagOwn: false
145
+ };
146
+ const groups = securable.groups.filter(
147
+ (group) => user2.userGroups.includes(group.id) || group.public === true
148
+ );
149
+ const groupsAccess = groups.map((group) => {
150
+ if (group.groupAccessRight) {
151
+ return group.groupAccessRight;
152
+ }
215
153
  });
216
- }
217
- attributeChangedCallback(t2, s2, i3) {
218
- this._$AK(t2, i3);
219
- }
220
- _$EO(t2, s2) {
221
- var _a2;
222
- const i3 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i3);
223
- if (void 0 !== e2 && true === i3.reflect) {
224
- const r2 = (void 0 !== ((_a2 = i3.converter) == null ? void 0 : _a2.toAttribute) ? i3.converter : u$1).toAttribute(s2, i3.type);
225
- this._$Em = t2, null == r2 ? this.removeAttribute(e2) : this.setAttribute(e2, r2), this._$Em = null;
154
+ for (const groupAccess of groupsAccess) {
155
+ if (!securableAccessRights.flagRead && groupAccess.flagRead) {
156
+ securableAccessRights.flagRead = groupAccess.flagRead;
157
+ }
158
+ if (!securableAccessRights.flagUse && groupAccess.flagUse) {
159
+ securableAccessRights.flagUse = groupAccess.flagUse;
160
+ }
161
+ if (!securableAccessRights.flagModify && groupAccess.flagModify) {
162
+ securableAccessRights.flagModify = groupAccess.flagModify;
163
+ }
164
+ if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
165
+ securableAccessRights.flagOwn = groupAccess.flagOwn;
166
+ }
226
167
  }
227
- }
228
- _$AK(t2, s2) {
229
- var _a2;
230
- const i3 = this.constructor, e2 = i3._$Eh.get(t2);
231
- if (void 0 !== e2 && this._$Em !== e2) {
232
- const t3 = i3.getPropertyOptions(e2), r2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== ((_a2 = t3.converter) == null ? void 0 : _a2.fromAttribute) ? t3.converter : u$1;
233
- this._$Em = e2, this[e2] = r2.fromAttribute(s2, t3.type), this._$Em = null;
168
+ const integrationsAccess = securable.integrations?.length > 0 ? securable.integrations.map((integration) => {
169
+ if (integration.integrationAccessRight) {
170
+ return integration.integrationAccessRight;
171
+ }
172
+ }) : [];
173
+ for (const integrationAccess of integrationsAccess) {
174
+ if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
175
+ securableAccessRights.flagRead = integrationAccess.flagRead;
176
+ }
177
+ if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
178
+ securableAccessRights.flagUse = integrationAccess.flagUse;
179
+ }
180
+ if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
181
+ securableAccessRights.flagModify = integrationAccess.flagModify;
182
+ }
234
183
  }
235
- }
236
- requestUpdate(t2, s2, i3) {
237
- if (void 0 !== t2) {
238
- if (i3 ?? (i3 = this.constructor.getPropertyOptions(t2)), !(i3.hasChanged ?? f$1)(this[t2], s2))
239
- return;
240
- this.C(t2, s2, i3);
184
+ return securableAccessRights;
185
+ };
186
+ const localize = (item, locale) => {
187
+ if (item === null || item === void 0) {
188
+ return "";
241
189
  }
242
- false === this.isUpdatePending && (this._$Eg = this._$EP());
243
- }
244
- C(t2, s2, i3) {
245
- this._$AL.has(t2) || this._$AL.set(t2, s2), true === i3.reflect && this._$Em !== t2 && (this._$ET ?? (this._$ET = /* @__PURE__ */ new Set())).add(t2);
246
- }
247
- async _$EP() {
248
- this.isUpdatePending = true;
249
- try {
250
- await this._$Eg;
251
- } catch (t3) {
252
- Promise.reject(t3);
190
+ if (typeof item !== "object" || Object.keys(item).length === 0) {
191
+ if (typeof item === "object" && Object.keys(item).length === 0) {
192
+ return "";
193
+ }
194
+ return item;
253
195
  }
254
- const t2 = this.scheduleUpdate();
255
- return null != t2 && await t2, !this.isUpdatePending;
256
- }
257
- scheduleUpdate() {
258
- return this.performUpdate();
259
- }
260
- performUpdate() {
261
- var _a2;
262
- if (!this.isUpdatePending)
263
- return;
264
- if (!this.hasUpdated) {
265
- if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
266
- for (const [t4, s3] of this._$Ep)
267
- this[t4] = s3;
268
- this._$Ep = void 0;
196
+ let localizedItem;
197
+ localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
198
+ if (localizedItem === void 0 || localizedItem === null) {
199
+ localizedItem = "";
200
+ }
201
+ return localizedItem;
202
+ };
203
+ const treatedDashboards = [];
204
+ for (const dashboard of dashboards) {
205
+ const treatedDashboard = {
206
+ accessibleBy: [],
207
+ accessRights: combineRights(dashboard, user),
208
+ id: dashboard.id,
209
+ modifiedAt: dashboard.modified_at,
210
+ name: localize(dashboard.name, dashboardComponent.language),
211
+ slug: null,
212
+ tags: dashboard.tags.map((t) => t.tag).sort((t1, t2) => t1.localeCompare(t2))
213
+ };
214
+ const currentIntegration = dashboard.integrations.find(
215
+ (i) => i.id === integrationId
216
+ );
217
+ if (currentIntegration?.integrationAccessRight?.slug) {
218
+ treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
219
+ }
220
+ const users = dashboard.users.map((u) => ({
221
+ model: "User",
222
+ id: u.id,
223
+ name: localize(u.name, user.locale_id)
224
+ }));
225
+ const groups = dashboard.groups.map((g) => ({
226
+ model: "Group",
227
+ id: g.id,
228
+ name: localize(g.name, user.locale_id) || {}
229
+ }));
230
+ const integrations = dashboard.integrations.map((i) => ({
231
+ model: "Integration",
232
+ id: i.id,
233
+ name: localize(i.name, user.locale_id) || {}
234
+ }));
235
+ treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
236
+ treatedDashboards.push(treatedDashboard);
237
+ }
238
+ return treatedDashboards;
239
+ };
240
+ var VERSION = "0.0.0-shared-luzmo";
241
+ var sanitizeUrl = (url) => {
242
+ const invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
243
+ const ctrlCharactersRegex = /[^\u0020-\u007E]/gim;
244
+ const urlSchemeRegex = /^([^:]+):/gm;
245
+ const relativeFirstCharacters = /* @__PURE__ */ new Set([".", "/"]);
246
+ const isRelativeUrlWithoutProtocol = (relativeUrl) => relativeFirstCharacters.has(relativeUrl[0]);
247
+ if (!url) {
248
+ return "about:blank";
249
+ }
250
+ const sanitizedUrl = url.replaceAll(ctrlCharactersRegex, "").trim();
251
+ if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
252
+ return sanitizedUrl;
253
+ }
254
+ const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
255
+ if (!urlSchemeParseResults) {
256
+ return sanitizedUrl;
257
+ }
258
+ const urlScheme = urlSchemeParseResults[0];
259
+ if (invalidPrototcolRegex.test(urlScheme)) {
260
+ return "about:blank";
261
+ }
262
+ return sanitizedUrl;
263
+ };
264
+ var cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
265
+ var isObject = (o) => o && typeof o === "object";
266
+ var defaultsDeep = (target, defaults) => {
267
+ Object.entries(defaults).forEach(([k, v]) => {
268
+ if (k in target) {
269
+ if (target[k] === void 0) {
270
+ target[k] = v;
271
+ } else {
272
+ target[k] = isObject(v) ? defaultsDeep(
273
+ target[k],
274
+ v
275
+ ) : target[k];
269
276
  }
270
- const t3 = this.constructor.elementProperties;
271
- if (t3.size > 0)
272
- for (const [s3, i3] of t3)
273
- true !== i3.wrapped || this._$AL.has(s3) || void 0 === this[s3] || this.C(s3, this[s3], i3);
277
+ } else {
278
+ target[k] = v;
274
279
  }
275
- let t2 = false;
276
- const s2 = this._$AL;
277
- try {
278
- t2 = this.shouldUpdate(s2), t2 ? (this.willUpdate(s2), (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t3) => {
279
- var _a3;
280
- return (_a3 = t3.hostUpdate) == null ? void 0 : _a3.call(t3);
281
- }), this.update(s2)) : this._$Ej();
282
- } catch (s3) {
283
- throw t2 = false, this._$Ej(), s3;
280
+ });
281
+ return target;
282
+ };
283
+ var uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c) {
284
+ const r = Math.random() * 16 | 0;
285
+ const v = c == "x" ? r : r & 3 | 8;
286
+ return v.toString(16);
287
+ });
288
+
289
+ // libs/embed-libs/shared-embed/src/lib/helpers/iframe-url.ts
290
+ var createIframeUrl = (dashboardContent) => {
291
+ const searchString = [];
292
+ const {
293
+ appServer,
294
+ language,
295
+ qeVersion,
296
+ loaderBackground,
297
+ loaderSpinnerColor,
298
+ loaderSpinnerBackground,
299
+ loaderFontColor,
300
+ screenMode,
301
+ key,
302
+ token,
303
+ timezoneId,
304
+ itemEmbedding,
305
+ itemDimensions,
306
+ dashboardId,
307
+ dashboardSlug,
308
+ itemId,
309
+ mainColor,
310
+ accentColor,
311
+ editMode
312
+ } = dashboardContent.params;
313
+ if (language && language !== "auto") {
314
+ searchString.push("language=" + language);
315
+ }
316
+ if (qeVersion) {
317
+ searchString.push(`qe_version=${qeVersion}`);
318
+ }
319
+ if (loaderBackground) {
320
+ searchString.push(`ldrbg=${loaderBackground}`);
321
+ }
322
+ if (loaderFontColor) {
323
+ searchString.push(`ldrftclr=${loaderFontColor}`);
324
+ }
325
+ if (loaderSpinnerColor) {
326
+ searchString.push(`ldrspclr=${loaderSpinnerColor}`);
327
+ }
328
+ if (loaderSpinnerBackground) {
329
+ searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
330
+ }
331
+ if (mainColor) {
332
+ searchString.push(`mainColor=${mainColor}`);
333
+ }
334
+ if (accentColor) {
335
+ searchString.push(`accentColor=${accentColor}`);
336
+ }
337
+ if (screenMode && screenMode !== "auto") {
338
+ searchString.push("screenMode=" + screenMode);
339
+ }
340
+ if (timezoneId) {
341
+ searchString.push("timezoneId=" + timezoneId);
342
+ }
343
+ if (itemEmbedding && itemDimensions && itemDimensions.width) {
344
+ searchString.push("width=" + itemDimensions.width);
345
+ }
346
+ if (itemEmbedding && itemDimensions && itemDimensions.height) {
347
+ searchString.push("height=" + itemDimensions.height);
348
+ }
349
+ if (editMode) {
350
+ searchString.push("editMode=" + editMode);
351
+ }
352
+ const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
353
+ searchString.push("version=" + (dashboardContent.VERSION || VERSION));
354
+ const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
355
+ searchString.join("&")
356
+ )}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
357
+ searchString.join("&")
358
+ )}${keyTokenUrlAnchor}`;
359
+ return sanitizeUrl(iframeUrl);
360
+ };
361
+
362
+ // libs/embed-libs/shared-embed/src/lib/helpers/get-loader.ts
363
+ var getLoader = (dashboardComponent) => {
364
+ let errorMsg;
365
+ if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
366
+ dashboardComponent.params.error = true;
367
+ if (dashboardComponent.browserNotSupported) {
368
+ errorMsg = "Browser is not supported.";
284
369
  }
285
- t2 && this._$AE(s2);
286
- }
287
- willUpdate(t2) {
288
370
  }
289
- _$AE(t2) {
290
- var _a2;
291
- (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t3) => {
292
- var _a3;
293
- return (_a3 = t3.hostUpdated) == null ? void 0 : _a3.call(t3);
294
- }), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t2)), this.updated(t2);
295
- }
296
- _$Ej() {
297
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
298
- }
299
- get updateComplete() {
300
- return this.getUpdateComplete();
301
- }
302
- getUpdateComplete() {
303
- return this._$Eg;
304
- }
305
- shouldUpdate(t2) {
306
- return true;
371
+ const loadingMsg = translations_default.initializing[dashboardComponent.params.language] || translations_default.initializing.en;
372
+ return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
373
+ };
374
+
375
+ // libs/embed-libs/shared-embed/src/lib/helpers/promise-dispatch.ts
376
+ function resolvePromise(dashboardComponent, requestId, data) {
377
+ if (dashboardComponent.promises[requestId]) {
378
+ dashboardComponent.promises[requestId].resolve(data);
379
+ delete dashboardComponent.promises[requestId];
307
380
  }
308
- update(t2) {
309
- this._$ET && (this._$ET = this._$ET.forEach((t3) => this._$EO(t3, this[t3]))), this._$Ej();
381
+ }
382
+ function rejectPromise(dashboardComponent, requestId, data) {
383
+ if (dashboardComponent.promises[requestId]) {
384
+ dashboardComponent.promises[requestId].reject(data);
385
+ delete dashboardComponent.promises[requestId];
310
386
  }
311
- updated(t2) {
387
+ }
388
+
389
+ // libs/embed-libs/shared-embed/src/lib/helpers/styles.ts
390
+ function containerStyles(dashboardComponent) {
391
+ const styles = {};
392
+ if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
393
+ styles.background = dashboardComponent.params.loaderBackground;
312
394
  }
313
- firstUpdated(t2) {
395
+ return styles;
396
+ }
397
+ function containerLoaderStyles(dashboardComponent) {
398
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
399
+ const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
400
+ const display = dashboardComponent.iframeLoaded ? "none" : "";
401
+ return {
402
+ display,
403
+ height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
404
+ };
405
+ }
406
+ function loaderStyles(dashboardComponent) {
407
+ const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
408
+ if (dashboardComponent.params.itemEmbedding) {
409
+ dashboardComponent.loaderSize = 24;
410
+ dashboardComponent.borderWidth = 4;
411
+ dashboardComponent.minHeight = 200;
412
+ const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
413
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
414
+ const chartWidthDefined = width !== "auto";
415
+ const chartHeightDefined = height !== "auto";
416
+ return {
417
+ background,
418
+ width: chartWidthDefined ? `${width}px` : "100%",
419
+ height: `${chartHeightDefined ? height : "200"}px`,
420
+ "min-height": chartHeightDefined ? "" : "200px"
421
+ };
314
422
  }
423
+ return {
424
+ background
425
+ };
426
+ }
427
+ function plStyles(dashboardComponent) {
428
+ const {
429
+ loaderSpinnerColor: defaultSpinnerColor,
430
+ loaderSpinnerBackground: defaultSpinnerBackground
431
+ } = DEFAULT_PARAMETERS;
432
+ const spinnerColorBorder = generateBorderStyle(
433
+ dashboardComponent.borderWidth,
434
+ dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
435
+ );
436
+ const spinnerBackgroundBorder = generateBorderStyle(
437
+ dashboardComponent.borderWidth,
438
+ dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
439
+ );
440
+ const size = `${dashboardComponent.loaderSize}px`;
441
+ return {
442
+ "border-top": spinnerColorBorder,
443
+ "border-right": spinnerColorBorder,
444
+ "border-bottom": spinnerBackgroundBorder,
445
+ "border-left": spinnerBackgroundBorder,
446
+ width: size,
447
+ height: size
448
+ };
449
+ }
450
+ function lcStyles(dashboardComponent) {
451
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
452
+ const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
453
+ const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
454
+ const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
455
+ return {
456
+ padding: `${verticalPadding} 16px`
457
+ };
458
+ }
459
+ function calculateIframeStyles(dashboardComponent) {
460
+ const height = dashboardComponent.params.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
461
+ const width = dashboardComponent.params.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
462
+ if (dashboardComponent.params.itemEmbedding && height !== "auto") {
463
+ dashboardComponent.iframeHeight = `${height}px`;
464
+ } else if (dashboardComponent.params.itemEmbedding) {
465
+ dashboardComponent.iframeHeight = "200px";
466
+ } else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
467
+ dashboardComponent.iframeHeight = "100%";
468
+ } else {
469
+ dashboardComponent.iframeHeight = "400px";
470
+ }
471
+ dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
472
+ const styles = {
473
+ height: dashboardComponent.iframeHeight,
474
+ width: dashboardComponent.iframeWidth
475
+ };
476
+ if (dashboardComponent.iframeLoaded) {
477
+ styles.opacity = 1;
478
+ } else if (dashboardComponent.error) {
479
+ styles.opacity = 1;
480
+ styles.width = "100%";
481
+ styles.height = "400px";
482
+ } else {
483
+ styles.opacity = 0;
484
+ }
485
+ return styles;
315
486
  }
316
- b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[d$1("elementProperties")] = /* @__PURE__ */ new Map(), b[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1 == null ? void 0 : p$1({ ReactiveElement: b }), (a$1.reactiveElementVersions ?? (a$1.reactiveElementVersions = [])).push("2.0.3");
317
- /**
318
- * @license
319
- * Copyright 2017 Google LLC
320
- * SPDX-License-Identifier: BSD-3-Clause
321
- */
322
- const t$2 = globalThis, i$2 = t$2.trustedTypes, s$1 = i$2 ? i$2.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e$3 = "$lit$", h = `lit$${(Math.random() + "").slice(9)}$`, o$2 = "?" + h, n$2 = `<${o$2}>`, r$3 = document, l = () => r$3.createComment(""), c = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a = Array.isArray, u = (t2) => a(t2) || "function" == typeof (t2 == null ? void 0 : t2[Symbol.iterator]), d = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
323
- \f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y = (t2) => (i3, ...s2) => ({ _$litType$: t2, strings: i3, values: s2 }), x = y(1), w = Symbol.for("lit-noChange"), T = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), E = r$3.createTreeWalker(r$3, 129);
324
- function C(t2, i3) {
325
- if (!Array.isArray(t2) || !t2.hasOwnProperty("raw"))
326
- throw Error("invalid template strings array");
327
- return void 0 !== s$1 ? s$1.createHTML(i3) : i3;
487
+ function generateBorderStyle(borderWidth, color) {
488
+ return `${borderWidth}px solid ${color}`;
328
489
  }
329
- const P = (t2, i3) => {
330
- const s2 = t2.length - 1, o2 = [];
331
- let r2, l2 = 2 === i3 ? "<svg>" : "", c2 = f;
332
- for (let i4 = 0; i4 < s2; i4++) {
333
- const s3 = t2[i4];
334
- let a2, u2, d2 = -1, y2 = 0;
335
- for (; y2 < s3.length && (c2.lastIndex = y2, u2 = c2.exec(s3), null !== u2); )
336
- y2 = c2.lastIndex, c2 === f ? "!--" === u2[1] ? c2 = v : void 0 !== u2[1] ? c2 = _ : void 0 !== u2[2] ? ($.test(u2[2]) && (r2 = RegExp("</" + u2[2], "g")), c2 = m) : void 0 !== u2[3] && (c2 = m) : c2 === m ? ">" === u2[0] ? (c2 = r2 ?? f, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? m : '"' === u2[3] ? g : p) : c2 === g || c2 === p ? c2 = m : c2 === v || c2 === _ ? c2 = f : (c2 = m, r2 = void 0);
337
- const x2 = c2 === m && t2[i4 + 1].startsWith("/>") ? " " : "";
338
- l2 += c2 === f ? s3 + n$2 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e$3 + s3.slice(d2) + h + x2) : s3 + h + (-2 === d2 ? i4 : x2);
339
- }
340
- return [C(t2, l2 + (t2[s2] || "<?>") + (2 === i3 ? "</svg>" : "")), o2];
490
+
491
+ // libs/embed-libs/shared-embed/src/lib/helpers/update-iframe-url.ts
492
+ var updateIframeUrl = (iframe, iframeUrl) => {
493
+ if (iframe?.contentWindow) {
494
+ iframe.contentWindow.location.replace(iframeUrl);
495
+ }
341
496
  };
342
- class V {
343
- constructor({ strings: t2, _$litType$: s2 }, n3) {
344
- let r2;
345
- this.parts = [];
346
- let c2 = 0, a2 = 0;
347
- const u2 = t2.length - 1, d2 = this.parts, [f2, v2] = P(t2, s2);
348
- if (this.el = V.createElement(f2, n3), E.currentNode = this.el.content, 2 === s2) {
349
- const t3 = this.el.content.firstChild;
350
- t3.replaceWith(...t3.childNodes);
351
- }
352
- for (; null !== (r2 = E.nextNode()) && d2.length < u2; ) {
353
- if (1 === r2.nodeType) {
354
- if (r2.hasAttributes())
355
- for (const t3 of r2.getAttributeNames())
356
- if (t3.endsWith(e$3)) {
357
- const i3 = v2[a2++], s3 = r2.getAttribute(t3).split(h), e2 = /([.?@])?(.*)/.exec(i3);
358
- d2.push({ type: 1, index: c2, name: e2[2], strings: s3, ctor: "." === e2[1] ? k : "?" === e2[1] ? H : "@" === e2[1] ? I : R }), r2.removeAttribute(t3);
359
- } else
360
- t3.startsWith(h) && (d2.push({ type: 6, index: c2 }), r2.removeAttribute(t3));
361
- if ($.test(r2.tagName)) {
362
- const t3 = r2.textContent.split(h), s3 = t3.length - 1;
363
- if (s3 > 0) {
364
- r2.textContent = i$2 ? i$2.emptyScript : "";
365
- for (let i3 = 0; i3 < s3; i3++)
366
- r2.append(t3[i3], l()), E.nextNode(), d2.push({ type: 2, index: ++c2 });
367
- r2.append(t3[s3], l());
368
- }
369
- }
370
- } else if (8 === r2.nodeType)
371
- if (r2.data === o$2)
372
- d2.push({ type: 2, index: c2 });
373
- else {
374
- let t3 = -1;
375
- for (; -1 !== (t3 = r2.data.indexOf(h, t3 + 1)); )
376
- d2.push({ type: 7, index: c2 }), t3 += h.length - 1;
497
+
498
+ // libs/embed-libs/shared-embed/src/lib/methods/export-dashboard.ts
499
+ var exportDashboard = (dashboardComponent, iframe, format) => {
500
+ const requestId = uuidv4();
501
+ if (iframe?.contentWindow) {
502
+ iframe.contentWindow.postMessage(
503
+ {
504
+ action: "exportDashboard",
505
+ format: format || "png",
506
+ _version: dashboardComponent.VERSION,
507
+ requestId
508
+ },
509
+ "*"
510
+ );
511
+ return new Promise((resolve, reject) => {
512
+ dashboardComponent.promises[requestId] = { resolve, reject };
513
+ setTimeout(() => {
514
+ if (dashboardComponent.promises[requestId]) {
515
+ const errorMessage = "exportDashboard request timed out.";
516
+ dashboardComponent.promises[requestId].reject(
517
+ new Error(errorMessage)
518
+ );
519
+ delete dashboardComponent.promises[requestId];
377
520
  }
378
- c2++;
379
- }
521
+ }, 12e5);
522
+ });
380
523
  }
381
- static createElement(t2, i3) {
382
- const s2 = r$3.createElement("template");
383
- return s2.innerHTML = t2, s2;
524
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
525
+ };
526
+
527
+ // libs/embed-libs/shared-embed/src/lib/methods/get-accessible-dashboards.ts
528
+ var getAccessibleDashboards = (dashboardComponent, iframe) => {
529
+ if ((dashboardComponent.dashboardId || dashboardComponent.dashboardSlug) && iframe?.contentWindow) {
530
+ const requestId = uuidv4();
531
+ iframe.contentWindow.postMessage(
532
+ {
533
+ action: "getAccessibleDashboards",
534
+ _version: dashboardComponent.VERSION,
535
+ requestId
536
+ },
537
+ "*"
538
+ );
539
+ return new Promise((resolve, reject) => {
540
+ dashboardComponent.promises[requestId] = { resolve, reject };
541
+ setTimeout(() => {
542
+ if (dashboardComponent.promises[requestId]) {
543
+ const errorMessage = "getAccessibleDashboards request timed out.";
544
+ dashboardComponent.promises[requestId].reject(
545
+ new Error(errorMessage)
546
+ );
547
+ delete dashboardComponent.promises[requestId];
548
+ }
549
+ }, 2e3);
550
+ });
384
551
  }
385
- }
386
- function N(t2, i3, s2 = t2, e2) {
387
- var _a2, _b;
388
- if (i3 === w)
389
- return i3;
390
- let h2 = void 0 !== e2 ? (_a2 = s2._$Co) == null ? void 0 : _a2[e2] : s2._$Cl;
391
- const o2 = c(i3) ? void 0 : i3._$litDirective$;
392
- return (h2 == null ? void 0 : h2.constructor) !== o2 && ((_b = h2 == null ? void 0 : h2._$AO) == null ? void 0 : _b.call(h2, false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ?? (s2._$Co = []))[e2] = h2 : s2._$Cl = h2), void 0 !== h2 && (i3 = N(t2, h2._$AS(t2, i3.values), h2, e2)), i3;
393
- }
394
- class S {
395
- constructor(t2, i3) {
396
- this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i3;
397
- }
398
- get parentNode() {
399
- return this._$AM.parentNode;
400
- }
401
- get _$AU() {
402
- return this._$AM._$AU;
403
- }
404
- u(t2) {
405
- const { el: { content: i3 }, parts: s2 } = this._$AD, e2 = ((t2 == null ? void 0 : t2.creationScope) ?? r$3).importNode(i3, true);
406
- E.currentNode = e2;
407
- let h2 = E.nextNode(), o2 = 0, n3 = 0, l2 = s2[0];
408
- for (; void 0 !== l2; ) {
409
- if (o2 === l2.index) {
410
- let i4;
411
- 2 === l2.type ? i4 = new M(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i4 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i4 = new L(h2, this, t2)), this._$AV.push(i4), l2 = s2[++n3];
552
+ const fetchUser = new Promise((resolve, reject) => {
553
+ void (() => {
554
+ try {
555
+ const responsePromise = window.fetch(
556
+ `${String(dashboardComponent.params.apiHost)}0.1.0/authorization`,
557
+ {
558
+ method: "POST",
559
+ mode: "cors",
560
+ cache: "no-cache",
561
+ headers: { "Content-Type": "application/json" },
562
+ redirect: "follow",
563
+ body: JSON.stringify({
564
+ action: "get",
565
+ version: "0.1.0",
566
+ key: dashboardComponent.authKey,
567
+ token: dashboardComponent.authToken,
568
+ find: {
569
+ where: { id: dashboardComponent.authKey },
570
+ attributes: ["id", "integration_id"],
571
+ include: [
572
+ {
573
+ model: "User",
574
+ attributes: ["id", "name", "locale_id"],
575
+ include: [{ model: "Group" }]
576
+ }
577
+ ]
578
+ }
579
+ })
580
+ }
581
+ );
582
+ responsePromise.then((response) => response.json()).then((data) => {
583
+ if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user || !data.rows[0].integration_id) {
584
+ reject();
585
+ } else {
586
+ data.rows[0].user.userGroups = data.rows[0].user.groups.map(
587
+ (group) => group.id
588
+ );
589
+ delete data.rows[0].user.groups;
590
+ resolve({
591
+ integrationId: data.rows[0].integration_id,
592
+ user: data.rows[0].user
593
+ });
594
+ }
595
+ });
596
+ } catch (error) {
597
+ reject(error);
412
598
  }
413
- o2 !== (l2 == null ? void 0 : l2.index) && (h2 = E.nextNode(), o2++);
599
+ })();
600
+ });
601
+ return new Promise((resolve, reject) => void (() => {
602
+ try {
603
+ fetchUser.then((authorizationData) => {
604
+ const responsePromise = window.fetch(
605
+ `${String(dashboardComponent.params.apiHost)}0.1.0/securable`,
606
+ {
607
+ method: "POST",
608
+ mode: "cors",
609
+ cache: "no-cache",
610
+ headers: { "Content-Type": "application/json" },
611
+ redirect: "follow",
612
+ body: JSON.stringify({
613
+ action: "get",
614
+ version: "0.1.0",
615
+ key: dashboardComponent.authKey,
616
+ token: dashboardComponent.authToken,
617
+ find: {
618
+ where: { type: "dashboard", is_variant: false },
619
+ attributes: ["id", "name", "modified_at"],
620
+ order: [["modified_at", "desc"]],
621
+ include: [
622
+ { model: "Tag", attributes: ["tag"] },
623
+ { model: "User", attributes: ["id", "name"] },
624
+ {
625
+ model: "Group",
626
+ attributes: ["id", "name", "public"]
627
+ },
628
+ { model: "Integration", attributes: ["id", "name"] }
629
+ ]
630
+ }
631
+ })
632
+ }
633
+ );
634
+ responsePromise.then((response) => response.json()).then((data) => {
635
+ const dashboardList = data.rows.length > 0 ? formatDashboardList(
636
+ data.rows,
637
+ authorizationData.integrationId,
638
+ authorizationData.user,
639
+ dashboardComponent
640
+ ) : [];
641
+ resolve(dashboardList);
642
+ });
643
+ }).catch((error) => {
644
+ reject(error);
645
+ });
646
+ } catch (error) {
647
+ reject(error);
414
648
  }
415
- return E.currentNode = r$3, e2;
416
- }
417
- p(t2) {
418
- let i3 = 0;
419
- for (const s2 of this._$AV)
420
- void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i3), i3 += s2.strings.length - 2) : s2._$AI(t2[i3])), i3++;
421
- }
422
- }
423
- class M {
424
- get _$AU() {
425
- var _a2;
426
- return ((_a2 = this._$AM) == null ? void 0 : _a2._$AU) ?? this._$Cv;
649
+ })());
650
+ };
651
+
652
+ // libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
653
+ var getData = (dashboardComponent, iframe, itemId) => {
654
+ if (iframe?.contentWindow) {
655
+ const requestId = uuidv4();
656
+ iframe.contentWindow.postMessage(
657
+ {
658
+ action: "getData",
659
+ id: itemId,
660
+ _version: dashboardComponent.VERSION,
661
+ requestId
662
+ },
663
+ "*"
664
+ );
665
+ return new Promise((resolve, reject) => {
666
+ dashboardComponent.promises[requestId] = { resolve, reject };
667
+ setTimeout(() => {
668
+ if (dashboardComponent.promises[requestId]) {
669
+ const errorMessage = "getData request timed out.";
670
+ dashboardComponent.promises[requestId].reject(
671
+ new Error(errorMessage)
672
+ );
673
+ delete dashboardComponent.promises[requestId];
674
+ }
675
+ }, 2e3);
676
+ });
427
677
  }
428
- constructor(t2, i3, s2, e2) {
429
- this.type = 2, this._$AH = T, this._$AN = void 0, this._$AA = t2, this._$AB = i3, this._$AM = s2, this.options = e2, this._$Cv = (e2 == null ? void 0 : e2.isConnected) ?? true;
678
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
679
+ };
680
+
681
+ // libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
682
+ var getFilters = (dashboardComponent, iframe) => {
683
+ if (iframe?.contentWindow) {
684
+ const requestId = uuidv4();
685
+ iframe.contentWindow.postMessage(
686
+ { action: "getFilters", _version: dashboardComponent.VERSION, requestId },
687
+ "*"
688
+ );
689
+ return new Promise((resolve, reject) => {
690
+ dashboardComponent.promises[requestId] = { resolve, reject };
691
+ setTimeout(() => {
692
+ if (dashboardComponent.promises[requestId]) {
693
+ const errorMessage = "getFilters request timed out.";
694
+ dashboardComponent.promises[requestId].reject(
695
+ new Error(errorMessage)
696
+ );
697
+ delete dashboardComponent.promises[requestId];
698
+ }
699
+ }, 2e3);
700
+ });
430
701
  }
431
- get parentNode() {
432
- let t2 = this._$AA.parentNode;
433
- const i3 = this._$AM;
434
- return void 0 !== i3 && 11 === (t2 == null ? void 0 : t2.nodeType) && (t2 = i3.parentNode), t2;
702
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
703
+ };
704
+
705
+ // libs/embed-libs/shared-embed/src/lib/methods/refresh-data.ts
706
+ var refreshData = (dashboardComponent, iframe, itemId) => {
707
+ if (iframe) {
708
+ iframe.contentWindow.postMessage(
709
+ {
710
+ action: "refreshData",
711
+ id: itemId ?? null,
712
+ _version: dashboardComponent.VERSION
713
+ },
714
+ "*"
715
+ );
716
+ return Promise.resolve();
435
717
  }
436
- get startNode() {
437
- return this._$AA;
718
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
719
+ };
720
+
721
+ // libs/embed-libs/shared-embed/src/lib/methods/reload-dashboard.ts
722
+ var reloadDashboard = (dashboardComponent, iframe) => {
723
+ if (iframe) {
724
+ iframe.contentWindow.postMessage(
725
+ { action: "reloadDashboard", _version: dashboardComponent.VERSION },
726
+ "*"
727
+ );
728
+ return Promise.resolve();
438
729
  }
439
- get endNode() {
440
- return this._$AB;
730
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
731
+ };
732
+
733
+ // libs/embed-libs/shared-embed/src/lib/methods/set-authorization.ts
734
+ var setAuthorization = (dashboardComponent, iframe, key, token) => {
735
+ if (iframe) {
736
+ iframe.contentWindow.postMessage(
737
+ {
738
+ action: "setAuthorization",
739
+ key,
740
+ token,
741
+ _version: dashboardComponent.VERSION
742
+ },
743
+ "*"
744
+ );
745
+ return Promise.resolve();
441
746
  }
442
- _$AI(t2, i3 = this) {
443
- t2 = N(this, t2, i3), c(t2) ? t2 === T || null == t2 || "" === t2 ? (this._$AH !== T && this._$AR(), this._$AH = T) : t2 !== this._$AH && t2 !== w && this._(t2) : void 0 !== t2._$litType$ ? this.g(t2) : void 0 !== t2.nodeType ? this.$(t2) : u(t2) ? this.T(t2) : this._(t2);
747
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
748
+ };
749
+
750
+ // libs/embed-libs/shared-embed/src/lib/methods/set-edit-mode.ts
751
+ var setEditMode = (dashboardComponent, iframe, editMode) => {
752
+ if (iframe && iframe.contentWindow) {
753
+ const requestId = uuidv4();
754
+ if (dashboardComponent.params.editMode === editMode) {
755
+ return Promise.reject(
756
+ new Error("editMode parameter is currently already set to " + editMode)
757
+ );
758
+ } else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
759
+ return Promise.reject(
760
+ new Error(
761
+ "The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
762
+ )
763
+ );
764
+ }
765
+ iframe.contentWindow.postMessage(
766
+ {
767
+ action: "setEditMode",
768
+ editMode,
769
+ _version: dashboardComponent.VERSION,
770
+ requestId
771
+ },
772
+ "*"
773
+ );
774
+ return new Promise((resolve, reject) => {
775
+ dashboardComponent.promises[requestId] = { resolve, reject };
776
+ });
444
777
  }
445
- k(t2) {
446
- return this._$AA.parentNode.insertBefore(t2, this._$AB);
778
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
779
+ };
780
+
781
+ // libs/embed-libs/shared-embed/src/lib/methods/set-filters.ts
782
+ var setFilters = (dashboardComponent, iframe, itemId, filters) => {
783
+ if (iframe) {
784
+ const requestId = uuidv4();
785
+ iframe.contentWindow.postMessage(
786
+ {
787
+ action: "setFilters",
788
+ itemId,
789
+ filters,
790
+ _version: dashboardComponent.VERSION,
791
+ requestId
792
+ },
793
+ "*"
794
+ );
795
+ return new Promise((resolve, reject) => {
796
+ dashboardComponent.promises[requestId] = { resolve, reject };
797
+ setTimeout(() => {
798
+ if (dashboardComponent.promises[requestId]) {
799
+ const errorMessage = "setFilters request timed out.";
800
+ dashboardComponent.promises[requestId].reject(
801
+ new Error(errorMessage)
802
+ );
803
+ delete dashboardComponent.promises[requestId];
804
+ }
805
+ }, 2e3);
806
+ });
447
807
  }
448
- $(t2) {
449
- this._$AH !== t2 && (this._$AR(), this._$AH = this.k(t2));
808
+ return Promise.reject();
809
+ };
810
+
811
+ // libs/embed-libs/shared-embed/src/lib/methods/set-preview.ts
812
+ var setPreview = (dashboardComponent, iframe, preview) => {
813
+ if (iframe) {
814
+ const requestId = uuidv4();
815
+ iframe.contentWindow.postMessage(
816
+ {
817
+ action: "setPreview",
818
+ preview,
819
+ requestId,
820
+ _version: dashboardComponent.VERSION
821
+ },
822
+ "*"
823
+ );
824
+ return new Promise((resolve, reject) => {
825
+ dashboardComponent.promises[requestId] = { resolve, reject };
826
+ setTimeout(() => {
827
+ if (dashboardComponent.promises[requestId]) {
828
+ const errorMessage = "setPreview request timed out.";
829
+ dashboardComponent.promises[requestId].reject(
830
+ new Error(errorMessage)
831
+ );
832
+ delete dashboardComponent.promises[requestId];
833
+ }
834
+ }, 2e3);
835
+ });
450
836
  }
451
- _(t2) {
452
- this._$AH !== T && c(this._$AH) ? this._$AA.nextSibling.data = t2 : this.$(r$3.createTextNode(t2)), this._$AH = t2;
837
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
838
+ };
839
+
840
+ // libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
841
+ var _setCalculatedDimensions = (dashboardComponent) => {
842
+ if (!dashboardComponent.dimensions) {
843
+ dashboardComponent.params.error = true;
844
+ _handleError("Got no valid dimensions.", dashboardComponent.params);
845
+ return;
453
846
  }
454
- g(t2) {
455
- var _a2;
456
- const { values: i3, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = V.createElement(C(s2.h, s2.h[0]), this.options)), s2);
457
- if (((_a2 = this._$AH) == null ? void 0 : _a2._$AD) === e2)
458
- this._$AH.p(i3);
459
- else {
460
- const t3 = new S(e2, this), s3 = t3.u(this.options);
461
- t3.p(i3), this.$(s3), this._$AH = t3;
847
+ const dashboardDimensionKeys = Object.keys(
848
+ dashboardComponent.dimensions
849
+ );
850
+ const availableScreenModeExtents = [];
851
+ let currentMode;
852
+ let currentWidth = 0;
853
+ let currentHeight = 0;
854
+ if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
855
+ dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
856
+ }
857
+ if (dashboardComponent.dimensions && dashboardDimensionKeys?.[0] === "fixed") {
858
+ currentMode = "fixed";
859
+ currentWidth = dashboardComponent.dimensions.fixed[0];
860
+ currentHeight = dashboardComponent.dimensions.fixed[1];
861
+ } else {
862
+ const screenModes = [
863
+ "mobile",
864
+ "tablet",
865
+ "desktop",
866
+ "largeScreen"
867
+ ];
868
+ if (dashboardComponent.params.itemEmbedding) {
869
+ const [firstMatch] = dashboardDimensionKeys;
870
+ let match = cloneDeep(firstMatch);
871
+ for (const screenMode of screenModes) {
872
+ const found = dashboardDimensionKeys.find((key) => key === screenMode);
873
+ if (found) {
874
+ match = cloneDeep(found);
875
+ } else {
876
+ dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
877
+ }
878
+ }
462
879
  }
463
- }
464
- _$AC(t2) {
465
- let i3 = A.get(t2.strings);
466
- return void 0 === i3 && A.set(t2.strings, i3 = new V(t2)), i3;
467
- }
468
- T(t2) {
469
- a(this._$AH) || (this._$AH = [], this._$AR());
470
- const i3 = this._$AH;
471
- let s2, e2 = 0;
472
- for (const h2 of t2)
473
- e2 === i3.length ? i3.push(s2 = new M(this.k(l()), this.k(l()), this, this.options)) : s2 = i3[e2], s2._$AI(h2), e2++;
474
- e2 < i3.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i3.length = e2);
475
- }
476
- _$AR(t2 = this._$AA.nextSibling, i3) {
477
- var _a2;
478
- for ((_a2 = this._$AP) == null ? void 0 : _a2.call(this, false, true, i3); t2 && t2 !== this._$AB; ) {
479
- const i4 = t2.nextSibling;
480
- t2.remove(), t2 = i4;
880
+ for (const key of dashboardDimensionKeys) {
881
+ if (screenModes.includes(key)) {
882
+ const screenMode = EXTENTS.find((extent) => extent.mode === key);
883
+ availableScreenModeExtents.push({
884
+ ...screenMode,
885
+ height: dashboardComponent.dimensions[key][1] || 50
886
+ });
887
+ }
481
888
  }
482
- }
483
- setConnected(t2) {
484
- var _a2;
485
- void 0 === this._$AM && (this._$Cv = t2, (_a2 = this._$AP) == null ? void 0 : _a2.call(this, t2));
486
- }
487
- }
488
- class R {
489
- get tagName() {
490
- return this.element.tagName;
491
- }
492
- get _$AU() {
493
- return this._$AM._$AU;
494
- }
495
- constructor(t2, i3, s2, e2, h2) {
496
- this.type = 1, this._$AH = T, this._$AN = void 0, this.element = t2, this.name = i3, this._$AM = e2, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = T;
497
- }
498
- _$AI(t2, i3 = this, s2, e2) {
499
- const h2 = this.strings;
500
- let o2 = false;
501
- if (void 0 === h2)
502
- t2 = N(this, t2, i3, 0), o2 = !c(t2) || t2 !== this._$AH && t2 !== w, o2 && (this._$AH = t2);
503
- else {
504
- const e3 = t2;
505
- let n3, r2;
506
- for (t2 = h2[0], n3 = 0; n3 < h2.length - 1; n3++)
507
- r2 = N(this, e3[s2 + n3], i3, n3), r2 === w && (r2 = this._$AH[n3]), o2 || (o2 = !c(r2) || r2 !== this._$AH[n3]), r2 === T ? t2 = T : t2 !== T && (t2 += (r2 ?? "") + h2[n3 + 1]), this._$AH[n3] = r2;
889
+ if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
890
+ dashboardComponent.params.screenMode = "auto";
891
+ }
892
+ if (dashboardComponent.params.screenMode === "auto") {
893
+ availableScreenModeExtents.sort(
894
+ (a, b) => screenModes.indexOf(a.mode) - screenModes.indexOf(b.mode)
895
+ );
896
+ for (const screenModeExtent of availableScreenModeExtents) {
897
+ const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
898
+ if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
899
+ if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
900
+ currentMode = screenModeExtent.mode;
901
+ currentWidth = Number.parseInt(
902
+ dashboardComponent.params.itemDimensions.width,
903
+ 10
904
+ );
905
+ currentHeight = dashboardComponent.dimensions[currentMode][1];
906
+ }
907
+ } else {
908
+ if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
909
+ currentMode = screenModeExtent.mode;
910
+ if (dashboardComponent.params.itemEmbedding) {
911
+ currentWidth = dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto" ? Number.parseInt(
912
+ dashboardComponent.params.itemDimensions.width,
913
+ 10
914
+ ) : Math.min(
915
+ dashboardComponent.containerWidth,
916
+ screenModeExtentMaxWidth
917
+ );
918
+ currentHeight = dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto" ? Number.parseInt(
919
+ dashboardComponent.params.itemDimensions.height,
920
+ 10
921
+ ) : dashboardComponent.dimensions[currentMode][1];
922
+ if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
923
+ currentWidth = Number.parseInt(
924
+ dashboardComponent.params.itemDimensions.width,
925
+ 10
926
+ );
927
+ currentHeight = dashboardComponent.dimensions[currentMode][1];
928
+ }
929
+ } else {
930
+ currentWidth = Math.max(
931
+ Math.min(
932
+ screenModeExtentMaxWidth,
933
+ dashboardComponent.containerWidth
934
+ ),
935
+ screenModeExtentMinWidth
936
+ );
937
+ currentHeight = screenModeExtent.height;
938
+ }
939
+ }
940
+ }
941
+ }
942
+ } else {
943
+ const {
944
+ height: chosenModeHeight,
945
+ width: [chosenModeMinWidth, chosenModeMaxWidth]
946
+ } = availableScreenModeExtents.find(
947
+ (d) => d.mode === dashboardComponent.params.screenMode
948
+ );
949
+ currentMode = dashboardComponent.params.screenMode;
950
+ currentWidth = Math.max(
951
+ Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
952
+ chosenModeMinWidth
953
+ );
954
+ currentHeight = chosenModeHeight;
955
+ if (dashboardComponent.params.itemEmbedding) {
956
+ if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
957
+ currentWidth = Number.parseInt(
958
+ dashboardComponent.params.itemDimensions.width,
959
+ 10
960
+ );
961
+ }
962
+ if (dashboardComponent.params.itemDimensions?.height && dashboardComponent.params.itemDimensions?.height !== "auto") {
963
+ currentHeight = Number.parseInt(
964
+ dashboardComponent.params.itemDimensions.height,
965
+ 10
966
+ );
967
+ }
968
+ }
969
+ }
970
+ if (!currentMode && availableScreenModeExtents.length > 0) {
971
+ const [lowestModeExtent] = availableScreenModeExtents;
972
+ currentMode = lowestModeExtent.mode;
973
+ currentWidth = lowestModeExtent.width[0];
974
+ currentHeight = lowestModeExtent.height;
508
975
  }
509
- o2 && !e2 && this.O(t2);
510
- }
511
- O(t2) {
512
- t2 === T ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? "");
513
- }
514
- }
515
- class k extends R {
516
- constructor() {
517
- super(...arguments), this.type = 3;
518
976
  }
519
- O(t2) {
520
- this.element[this.name] = t2 === T ? void 0 : t2;
977
+ dashboardComponent.currentScreenMode = currentMode;
978
+ const style = {
979
+ height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
980
+ width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
981
+ opacity: 1
982
+ };
983
+ const dashboardEditModes = ["editFull", "editLimited"];
984
+ if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
985
+ style.height = "100%";
986
+ style.width = "100%";
987
+ } else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
988
+ style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
989
+ "px",
990
+ ""
991
+ )}px`;
992
+ style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
993
+ "px",
994
+ ""
995
+ )}px`;
996
+ } else {
997
+ style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
998
+ style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
999
+ }
1000
+ dashboardComponent.currentScreenMode = currentMode;
1001
+ dashboardComponent.iframeStyle = style;
1002
+ };
1003
+
1004
+ // libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
1005
+ var _extendAndValidate = (dashboardContent) => {
1006
+ const defaultKeys = Object.keys(
1007
+ DEFAULT_PARAMETERS
1008
+ );
1009
+ const errorMessages = [];
1010
+ const requiredStringParams = [
1011
+ "appServer",
1012
+ "language",
1013
+ "apiHost"
1014
+ ];
1015
+ const requiredStringOrEmptyParams = [
1016
+ "key",
1017
+ "token",
1018
+ "screenMode",
1019
+ "timezoneId",
1020
+ "itemId",
1021
+ "container",
1022
+ "loaderBackground",
1023
+ "loaderFontColor",
1024
+ "loaderSpinnerColor",
1025
+ "loaderSpinnerBackground"
1026
+ ];
1027
+ const objectParams = ["itemDimensions"];
1028
+ const screenModes = [
1029
+ "mobile",
1030
+ "tablet",
1031
+ "desktop",
1032
+ "largeScreen",
1033
+ "fixed",
1034
+ "auto"
1035
+ ];
1036
+ for (const key of defaultKeys) {
1037
+ if (dashboardContent.params[key] === null) {
1038
+ delete dashboardContent.params[key];
1039
+ }
1040
+ }
1041
+ dashboardContent.params = defaultsDeep(
1042
+ dashboardContent.params,
1043
+ DEFAULT_PARAMETERS
1044
+ );
1045
+ if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
1046
+ delete dashboardContent.params.dashboardId;
1047
+ delete dashboardContent.params.dashboardSlug;
1048
+ }
1049
+ for (const key of requiredStringParams) {
1050
+ if (typeof dashboardContent.params[key] !== "string") {
1051
+ delete dashboardContent.params[key];
1052
+ errorMessages.push(`${key} needs to be of type string.`);
1053
+ }
1054
+ }
1055
+ for (const key of requiredStringOrEmptyParams) {
1056
+ if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
1057
+ delete dashboardContent.params[key];
1058
+ errorMessages.push(`${key} needs to be of type string or empty.`);
1059
+ }
1060
+ }
1061
+ if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
1062
+ const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
1063
+ errorMessages.push(
1064
+ `"screenMode" needs should be one of these types: ${validTypesString}`
1065
+ );
1066
+ dashboardContent.params.screenMode = "auto";
521
1067
  }
522
- }
523
- class H extends R {
524
- constructor() {
525
- super(...arguments), this.type = 4;
1068
+ if (dashboardContent.params.itemId) {
1069
+ dashboardContent.params.itemEmbedding = true;
526
1070
  }
527
- O(t2) {
528
- this.element.toggleAttribute(this.name, !!t2 && t2 !== T);
1071
+ for (const key of objectParams) {
1072
+ if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
1073
+ delete dashboardContent.params[key];
1074
+ errorMessages.push(`${key} needs to be of type object or empty.`);
1075
+ }
529
1076
  }
530
- }
531
- class I extends R {
532
- constructor(t2, i3, s2, e2, h2) {
533
- super(t2, i3, s2, e2, h2), this.type = 5;
1077
+ if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
1078
+ errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
1079
+ dashboardContent.params.switchScreenModeOnResize = true;
534
1080
  }
535
- _$AI(t2, i3 = this) {
536
- if ((t2 = N(this, t2, i3, 0) ?? T) === w)
537
- return;
538
- const s2 = this._$AH, e2 = t2 === T && s2 !== T || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h2 = t2 !== T && (s2 === T || e2);
539
- e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
1081
+ if (dashboardContent.params.itemDimensions) {
1082
+ const itemDimensionsKeys = [
1083
+ "width",
1084
+ "height"
1085
+ ];
1086
+ for (const key of itemDimensionsKeys) {
1087
+ if (!["string", "number"].includes(
1088
+ typeof dashboardContent.params.itemDimensions[key]
1089
+ ) && dashboardContent.params.itemDimensions[key] !== null) {
1090
+ errorMessages.push(
1091
+ `itemDimensions ${key} needs to be of type string, number or empty.`
1092
+ );
1093
+ }
1094
+ }
540
1095
  }
541
- handleEvent(t2) {
542
- var _a2;
543
- "function" == typeof this._$AH ? this._$AH.call(((_a2 = this.options) == null ? void 0 : _a2.host) ?? this.element, t2) : this._$AH.handleEvent(t2);
1096
+ dashboardContent.params = defaultsDeep(
1097
+ dashboardContent.params,
1098
+ DEFAULT_PARAMETERS
1099
+ );
1100
+ if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
1101
+ dashboardContent.params.switchScreenModeOnResize = false;
544
1102
  }
545
- }
546
- class L {
547
- constructor(t2, i3, s2) {
548
- this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i3, this.options = s2;
1103
+ if (dashboardContent.params.itemDimensions.width !== "auto") {
1104
+ dashboardContent.params.itemDimensions.width = Number.parseInt(
1105
+ `${dashboardContent.params.itemDimensions.width}`.replace("px", ""),
1106
+ 10
1107
+ ) || "auto";
549
1108
  }
550
- get _$AU() {
551
- return this._$AM._$AU;
1109
+ if (dashboardContent.params.itemDimensions.height !== "auto") {
1110
+ dashboardContent.params.itemDimensions.height = Number.parseInt(
1111
+ `${dashboardContent.params.itemDimensions.height}`.replace("px", ""),
1112
+ 10
1113
+ ) || "auto";
552
1114
  }
553
- _$AI(t2) {
554
- N(this, t2);
1115
+ dashboardContent.params.itemEmbedding = !!dashboardContent.params.itemId;
1116
+ if (dashboardContent.params.error || errorMessages.length > 0) {
1117
+ _handleError(errorMessages.join("\n"), dashboardContent.params);
555
1118
  }
556
- }
557
- const Z = t$2.litHtmlPolyfillSupport;
558
- Z == null ? void 0 : Z(V, M), (t$2.litHtmlVersions ?? (t$2.litHtmlVersions = [])).push("3.1.1");
559
- const j = (t2, i3, s2) => {
560
- const e2 = (s2 == null ? void 0 : s2.renderBefore) ?? i3;
561
- let h2 = e2._$litPart$;
562
- if (void 0 === h2) {
563
- const t3 = (s2 == null ? void 0 : s2.renderBefore) ?? null;
564
- e2._$litPart$ = h2 = new M(i3.insertBefore(l(), t3), t3, void 0, s2 ?? {});
565
- }
566
- return h2._$AI(t2), h2;
567
1119
  };
568
- /**
569
- * @license
570
- * Copyright 2017 Google LLC
571
- * SPDX-License-Identifier: BSD-3-Clause
572
- */
573
- class s extends b {
574
- constructor() {
575
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
576
- }
577
- createRenderRoot() {
578
- var _a2;
579
- const t2 = super.createRenderRoot();
580
- return (_a2 = this.renderOptions).renderBefore ?? (_a2.renderBefore = t2.firstChild), t2;
581
- }
582
- update(t2) {
583
- const i3 = this.render();
584
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t2), this._$Do = j(i3, this.renderRoot, this.renderOptions);
585
- }
586
- connectedCallback() {
587
- var _a2;
588
- super.connectedCallback(), (_a2 = this._$Do) == null ? void 0 : _a2.setConnected(true);
589
- }
590
- disconnectedCallback() {
591
- var _a2;
592
- super.disconnectedCallback(), (_a2 = this._$Do) == null ? void 0 : _a2.setConnected(false);
593
- }
594
- render() {
595
- return w;
596
- }
597
- }
598
- s._$litElement$ = true, s["finalized"] = true, (_a = globalThis.litElementHydrateSupport) == null ? void 0 : _a.call(globalThis, { LitElement: s });
599
- const r$2 = globalThis.litElementPolyfillSupport;
600
- r$2 == null ? void 0 : r$2({ LitElement: s });
601
- (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.0.3");
602
- /**
603
- * @license
604
- * Copyright 2017 Google LLC
605
- * SPDX-License-Identifier: BSD-3-Clause
606
- */
607
- const t$1 = (t2) => (e2, o2) => {
608
- void 0 !== o2 ? o2.addInitializer(() => {
609
- customElements.define(t2, e2);
610
- }) : customElements.define(t2, e2);
1120
+
1121
+ // libs/embed-libs/shared-embed/src/lib/helpers/remote-federation.ts
1122
+ var remotesMap = {
1123
+ // "remote_app": { url: "http://localhost:4201/remoteEntry.mjs", format: "esm", from: "vite" },
611
1124
  };
612
- /**
613
- * @license
614
- * Copyright 2017 Google LLC
615
- * SPDX-License-Identifier: BSD-3-Clause
616
- */
617
- const o$1 = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$1 }, r$1 = (t2 = o$1, e2, r2) => {
618
- const { kind: n3, metadata: i3 } = r2;
619
- let s2 = globalThis.litPropertyMetadata.get(i3);
620
- if (void 0 === s2 && globalThis.litPropertyMetadata.set(i3, s2 = /* @__PURE__ */ new Map()), s2.set(r2.name, t2), "accessor" === n3) {
621
- const { name: o2 } = r2;
622
- return { set(r3) {
623
- const n4 = e2.get.call(this);
624
- e2.set.call(this, r3), this.requestUpdate(o2, n4, t2);
625
- }, init(e3) {
626
- return void 0 !== e3 && this.C(o2, void 0, t2), e3;
627
- } };
628
- }
629
- if ("setter" === n3) {
630
- const { name: o2 } = r2;
631
- return function(r3) {
632
- const n4 = this[o2];
633
- e2.call(this, r3), this.requestUpdate(o2, n4, t2);
634
- };
635
- }
636
- throw Error("Unsupported decorator location: " + n3);
1125
+ var loadJS = async (url, fn) => {
1126
+ const resolvedUrl = typeof url === "function" ? await url() : url;
1127
+ const script = document.createElement("script");
1128
+ script.type = "text/javascript";
1129
+ script.addEventListener("load", fn);
1130
+ script.src = resolvedUrl;
1131
+ document.querySelectorAll("head")[0].append(script);
637
1132
  };
638
- function n$1(t2) {
639
- return (e2, o2) => "object" == typeof o2 ? r$1(t2, e2, o2) : ((t3, e3, o3) => {
640
- const r2 = e3.hasOwnProperty(o3);
641
- return e3.constructor.createProperty(o3, r2 ? { ...t3, wrapped: true } : t3), r2 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0;
642
- })(t2, e2, o2);
1133
+ var wrapShareModule = (remoteFrom) => ({});
1134
+ async function __federationMethodEnsure(remoteId) {
1135
+ const remote = remotesMap[remoteId];
1136
+ if (remote.inited) {
1137
+ return remote.lib;
1138
+ }
1139
+ if (remote.format === "var") {
1140
+ return new Promise((resolve) => {
1141
+ const callback = () => {
1142
+ if (!remote.inited) {
1143
+ remote.lib = window[remoteId];
1144
+ remote.lib.init(wrapShareModule(remote.from));
1145
+ remote.inited = true;
1146
+ }
1147
+ resolve(remote.lib);
1148
+ };
1149
+ return loadJS(remote.url, callback);
1150
+ });
1151
+ } else if (["esm", "systemjs"].includes(remote.format)) {
1152
+ return new Promise((resolve, reject) => {
1153
+ const getUrl = typeof remote.url === "function" ? remote.url : () => Promise.resolve(remote.url);
1154
+ getUrl().then((url) => {
1155
+ import(
1156
+ /* @vite-ignore */
1157
+ /* webpackIgnore: true */
1158
+ url
1159
+ ).then((lib) => {
1160
+ if (!remote.inited) {
1161
+ const shareScope = wrapShareModule(remote.from);
1162
+ lib.init(shareScope);
1163
+ remote.lib = lib;
1164
+ remote.lib.init(shareScope);
1165
+ remote.inited = true;
1166
+ }
1167
+ resolve(remote.lib);
1168
+ }).catch(reject);
1169
+ });
1170
+ });
1171
+ }
643
1172
  }
644
- /**
645
- * @license
646
- * Copyright 2017 Google LLC
647
- * SPDX-License-Identifier: BSD-3-Clause
648
- */
649
- function r(r2) {
650
- return n$1({ ...r2, state: true, attribute: false });
1173
+ function __federationMethodWrapDefault(module, need) {
1174
+ if (!(module == null ? void 0 : module.default) && need) {
1175
+ const obj = /* @__PURE__ */ Object.create(null);
1176
+ obj.default = module;
1177
+ obj.__esModule = true;
1178
+ return obj;
1179
+ }
1180
+ return module;
651
1181
  }
652
- /**
653
- * @license
654
- * Copyright 2017 Google LLC
655
- * SPDX-License-Identifier: BSD-3-Clause
656
- */
657
- const e$2 = (e2, t2, c2) => (c2.configurable = true, c2.enumerable = true, Reflect.decorate && "object" != typeof t2 && Object.defineProperty(e2, t2, c2), c2);
658
- /**
659
- * @license
660
- * Copyright 2017 Google LLC
661
- * SPDX-License-Identifier: BSD-3-Clause
662
- */
663
- function e$1(e2, r2) {
664
- return (n3, s2, i3) => {
665
- const o2 = (t2) => {
666
- var _a2;
667
- return ((_a2 = t2.renderRoot) == null ? void 0 : _a2.querySelector(e2)) ?? null;
668
- };
669
- if (r2) {
670
- const { get: e3, set: r3 } = "object" == typeof s2 ? n3 : i3 ?? (() => {
671
- const t2 = Symbol();
672
- return { get() {
673
- return this[t2];
674
- }, set(e4) {
675
- this[t2] = e4;
676
- } };
677
- })();
678
- return e$2(n3, s2, { get() {
679
- let t2 = e3.call(this);
680
- return void 0 === t2 && (t2 = o2(this), (null !== t2 || this.hasUpdated) && r3.call(this, t2)), t2;
681
- } });
682
- }
683
- return e$2(n3, s2, { get() {
684
- return o2(this);
685
- } });
686
- };
1182
+ async function __federationMethodGetRemote(remoteName, componentName) {
1183
+ return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
687
1184
  }
688
- /**
689
- * @license
690
- * Copyright 2017 Google LLC
691
- * SPDX-License-Identifier: BSD-3-Clause
692
- */
693
- const t = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, e = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
694
- let i$1 = class i {
695
- constructor(t2) {
696
- }
697
- get _$AU() {
698
- return this._$AM._$AU;
699
- }
700
- _$AT(t2, e2, i3) {
701
- this._$Ct = t2, this._$AM = e2, this._$Ci = i3;
702
- }
703
- _$AS(t2, e2) {
704
- return this.update(t2, e2);
705
- }
706
- update(t2, e2) {
707
- return this.render(...e2);
708
- }
709
- };
710
- /**
711
- * @license
712
- * Copyright 2018 Google LLC
713
- * SPDX-License-Identifier: BSD-3-Clause
714
- */
715
- const n2 = "important", i2 = " !" + n2, o = e(class extends i$1 {
716
- constructor(t$12) {
717
- var _a2;
718
- if (super(t$12), t$12.type !== t.ATTRIBUTE || "style" !== t$12.name || ((_a2 = t$12.strings) == null ? void 0 : _a2.length) > 2)
719
- throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
720
- }
721
- render(t2) {
722
- return Object.keys(t2).reduce((e2, r2) => {
723
- const s2 = t2[r2];
724
- return null == s2 ? e2 : e2 + `${r2 = r2.includes("-") ? r2 : r2.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s2};`;
725
- }, "");
726
- }
727
- update(e2, [r2]) {
728
- const { style: s2 } = e2.element;
729
- if (void 0 === this.ut)
730
- return this.ut = new Set(Object.keys(r2)), this.render(r2);
731
- for (const t2 of this.ut)
732
- null == r2[t2] && (this.ut.delete(t2), t2.includes("-") ? s2.removeProperty(t2) : s2[t2] = null);
733
- for (const t2 in r2) {
734
- const e3 = r2[t2];
735
- if (null != e3) {
736
- this.ut.add(t2);
737
- const r3 = "string" == typeof e3 && e3.endsWith(i2);
738
- t2.includes("-") || r3 ? s2.setProperty(t2, r3 ? e3.slice(0, -11) : e3, r3 ? n2 : "") : s2[t2] = e3;
739
- }
740
- }
741
- return w;
742
- }
743
- });
744
- const version = "5.0.5";
745
- class LuzmoService {
1185
+
1186
+ // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
1187
+ import {
1188
+ html,
1189
+ LitElement
1190
+ } from "lit";
1191
+ import {
1192
+ customElement,
1193
+ property,
1194
+ query,
1195
+ state
1196
+ } from "lit/decorators.js";
1197
+ import {
1198
+ styleMap
1199
+ } from "lit/directives/style-map.js";
1200
+
1201
+ // libs/embed-libs/embed/package.json
1202
+ var version = "5.0.7";
1203
+
1204
+ // libs/embed-libs/embed/src/lib/luzmo-service.ts
1205
+ var LuzmoService = class {
746
1206
  constructor() {
747
1207
  this._components = [];
748
1208
  }
749
- }
750
- const LuzmoService$1 = new LuzmoService();
751
- const _setEventHandler = () => {
1209
+ };
1210
+ var luzmo_service_default = new LuzmoService();
1211
+
1212
+ // libs/embed-libs/embed/src/lib/helper/event-bus-handler.ts
1213
+ var _setEventHandler = () => {
752
1214
  if (typeof window.__luzmoMessageHandler === "function") {
753
1215
  return;
754
1216
  }
755
1217
  window.__luzmoMessageHandler = (event) => {
756
- var _a2;
757
- const dashboardComponent = LuzmoService$1._components.find(
758
- (c2) => event.data.name === c2._iframeId
1218
+ const dashboardComponent = luzmo_service_default._components.find(
1219
+ (c) => event.data.name === c._iframeId
759
1220
  );
760
1221
  if (!dashboardComponent) {
761
1222
  return;
762
1223
  }
763
- switch ((_a2 = event.data) == null ? void 0 : _a2.type) {
1224
+ switch (event.data?.type) {
764
1225
  case "load": {
765
1226
  dashboardComponent.dispatchEvent(
766
1227
  new CustomEvent("load", { detail: { data: event.data } })
@@ -785,7 +1246,7 @@ const _setEventHandler = () => {
785
1246
  break;
786
1247
  }
787
1248
  case "data": {
788
- SharedLib__namespace.resolvePromise(
1249
+ resolvePromise(
789
1250
  dashboardComponent,
790
1251
  event.data.requestId,
791
1252
  event.data.data
@@ -793,7 +1254,7 @@ const _setEventHandler = () => {
793
1254
  break;
794
1255
  }
795
1256
  case "filters": {
796
- SharedLib__namespace.resolvePromise(
1257
+ resolvePromise(
797
1258
  dashboardComponent,
798
1259
  event.data.requestId,
799
1260
  event.data.filters
@@ -801,7 +1262,7 @@ const _setEventHandler = () => {
801
1262
  break;
802
1263
  }
803
1264
  case "getAccessibleDashboards": {
804
- SharedLib__namespace.resolvePromise(
1265
+ resolvePromise(
805
1266
  dashboardComponent,
806
1267
  event.data.requestId,
807
1268
  event.data.accessibleDashboards
@@ -816,7 +1277,7 @@ const _setEventHandler = () => {
816
1277
  }
817
1278
  case "export": {
818
1279
  if (event.data.error) {
819
- SharedLib__namespace.rejectPromise(
1280
+ rejectPromise(
820
1281
  dashboardComponent,
821
1282
  event.data.requestId,
822
1283
  event.data
@@ -825,7 +1286,7 @@ const _setEventHandler = () => {
825
1286
  dashboardComponent.dispatchEvent(
826
1287
  new CustomEvent("exported", { detail: { data: event.data } })
827
1288
  );
828
- SharedLib__namespace.resolvePromise(
1289
+ resolvePromise(
829
1290
  dashboardComponent,
830
1291
  event.data.requestId,
831
1292
  event.data
@@ -855,31 +1316,31 @@ const _setEventHandler = () => {
855
1316
  }
856
1317
  case "setEditMode": {
857
1318
  if (event.data.error) {
858
- SharedLib__namespace.rejectPromise(
1319
+ rejectPromise(
859
1320
  dashboardComponent,
860
1321
  event.data.requestId,
861
1322
  event.data
862
1323
  );
863
1324
  } else {
864
- SharedLib__namespace.resolvePromise(
1325
+ resolvePromise(
865
1326
  dashboardComponent,
866
1327
  event.data.requestId,
867
1328
  event.data
868
1329
  );
869
1330
  dashboardComponent.params.editMode = event.data.editMode;
870
- dashboardComponent._containerStyle = SharedLib__namespace.containerStyles(dashboardComponent);
1331
+ dashboardComponent._containerStyle = containerStyles(dashboardComponent);
871
1332
  if (dashboardComponent.dimensions) {
872
- SharedLib__namespace._setCalculatedDimensions(dashboardComponent);
1333
+ _setCalculatedDimensions(dashboardComponent);
873
1334
  }
874
1335
  }
875
1336
  break;
876
1337
  }
877
1338
  case "setFilters": {
878
- event.data.error ? SharedLib__namespace.rejectPromise(
1339
+ event.data.error ? rejectPromise(
879
1340
  dashboardComponent,
880
1341
  event.data.requestId,
881
1342
  event.data
882
- ) : SharedLib__namespace.resolvePromise(
1343
+ ) : resolvePromise(
883
1344
  dashboardComponent,
884
1345
  event.data.requestId,
885
1346
  event.data
@@ -887,11 +1348,11 @@ const _setEventHandler = () => {
887
1348
  break;
888
1349
  }
889
1350
  case "setPreview": {
890
- event.data.error ? SharedLib__namespace.rejectPromise(
1351
+ event.data.error ? rejectPromise(
891
1352
  dashboardComponent,
892
1353
  event.data.requestId,
893
1354
  event.data
894
- ) : SharedLib__namespace.resolvePromise(
1355
+ ) : resolvePromise(
895
1356
  dashboardComponent,
896
1357
  event.data.requestId,
897
1358
  event.data
@@ -902,7 +1363,10 @@ const _setEventHandler = () => {
902
1363
  };
903
1364
  window.addEventListener("message", window.__luzmoMessageHandler, false);
904
1365
  };
905
- const dashboardStyles = i$4`
1366
+
1367
+ // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-styles.ts
1368
+ import { css } from "lit";
1369
+ var dashboardStyles = css`
906
1370
  @-webkit-keyframes spin {
907
1371
  0% {
908
1372
  -webkit-transform: rotate(0deg);
@@ -1003,25 +1467,16 @@ const dashboardStyles = i$4`
1003
1467
  transition-duration: 0.3s;
1004
1468
  }
1005
1469
  `;
1006
- var __defProp = Object.defineProperty;
1007
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
1008
- var __decorateClass = (decorators, target, key, kind) => {
1009
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
1010
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
1011
- if (decorator = decorators[i3])
1012
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1013
- if (kind && result)
1014
- __defProp(target, key, result);
1015
- return result;
1016
- };
1017
- exports.LuzmoDashboard = class LuzmoDashboard extends s {
1470
+
1471
+ // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
1472
+ var LuzmoDashboard = class extends LitElement {
1018
1473
  constructor(inputParameters) {
1019
1474
  super();
1020
1475
  this.language = "auto";
1021
1476
  this.screenMode = "auto";
1022
1477
  this.switchScreenModeOnResize = true;
1023
1478
  this.editMode = "view";
1024
- this.dev = false;
1479
+ this.experimental = false;
1025
1480
  this.iframeStyle = {};
1026
1481
  this._containerStyle = {};
1027
1482
  this._loaderStyle = {};
@@ -1061,20 +1516,19 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1061
1516
  this.loaderSize = 32;
1062
1517
  this.borderWidth = 3;
1063
1518
  this.minHeight = 400;
1064
- this._containerId = SharedLib__namespace.uuidv4();
1519
+ this._containerId = uuidv4();
1065
1520
  this._iframeId = `luzmo-dashboard-${this._containerId}`;
1066
1521
  this.iframeLoaded = false;
1067
1522
  this.promises = {};
1068
1523
  this.setInputParameters(inputParameters);
1069
1524
  this.params = this._setOptions();
1070
1525
  this._onResize = () => {
1071
- var _a2;
1072
- if ((_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector(".dashboard-container")) {
1526
+ if (this.shadowRoot?.querySelector(".dashboard-container")) {
1073
1527
  this.containerWidth = this.container.clientWidth;
1074
1528
  if (this.params.switchScreenModeOnResize && this.params.screenMode === "auto") {
1075
- for (const d2 of SharedLib__namespace.EXTENTS) {
1076
- if (d2.width[0] <= window.innerWidth && window.innerWidth <= d2.width[1]) {
1077
- this.currentScreenMode = d2.mode;
1529
+ for (const d of EXTENTS) {
1530
+ if (d.width[0] <= window.innerWidth && window.innerWidth <= d.width[1]) {
1531
+ this.currentScreenMode = d.mode;
1078
1532
  }
1079
1533
  }
1080
1534
  }
@@ -1093,13 +1547,13 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1093
1547
  });
1094
1548
  }
1095
1549
  loadLibrary(appServer) {
1096
- if (SharedLib.remotesMap[appServer]) {
1097
- return Promise.resolve(SharedLib.remotesMap[appServer].module);
1550
+ if (remotesMap[appServer]) {
1551
+ return Promise.resolve(remotesMap[appServer].module);
1098
1552
  }
1099
- SharedLib.remotesMap[appServer] = { url: (appServer == null ? void 0 : appServer.startsWith("http://localhost")) ? `${SharedLib__namespace.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib__namespace.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`, format: "esm", from: "vite", module: void 0 };
1100
- return SharedLib.__federationMethodGetRemote(appServer, "./DashboardApp").then((module2) => {
1101
- const wrappedModule = SharedLib.__federationMethodWrapDefault(module2, true);
1102
- SharedLib.remotesMap[appServer].module = wrappedModule;
1553
+ remotesMap[appServer] = { url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`, format: "esm", from: "vite", module: void 0 };
1554
+ return __federationMethodGetRemote(appServer, "./DashboardApp").then((module) => {
1555
+ const wrappedModule = __federationMethodWrapDefault(module, true);
1556
+ remotesMap[appServer].module = wrappedModule;
1103
1557
  return wrappedModule;
1104
1558
  });
1105
1559
  }
@@ -1134,11 +1588,11 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1134
1588
  this[key] = value;
1135
1589
  }
1136
1590
  }
1137
- if (inputParameters.dev) {
1138
- this.dev = inputParameters.dev;
1591
+ if (inputParameters.experimental) {
1592
+ this.experimental = inputParameters.experimental;
1139
1593
  }
1140
1594
  if (inputParameters.appServer) {
1141
- this.appServer = SharedLib__namespace.addTrailingSlash(inputParameters.appServer);
1595
+ this.appServer = addTrailingSlash(inputParameters.appServer);
1142
1596
  }
1143
1597
  }
1144
1598
  // Set resize event listener
@@ -1156,14 +1610,12 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1156
1610
  }
1157
1611
  }
1158
1612
  firstUpdated() {
1159
- var _a2;
1160
- this._loaderMsg = (_a2 = SharedLib__namespace.getLoader(this)) == null ? void 0 : _a2.loadingMsg;
1613
+ this._loaderMsg = getLoader(this)?.loadingMsg;
1161
1614
  this._loaderStyles();
1162
- LuzmoService$1._components.push(this);
1615
+ luzmo_service_default._components.push(this);
1163
1616
  this.initComponent();
1164
1617
  }
1165
1618
  initComponent() {
1166
- var _a2, _b;
1167
1619
  this.params = this._setOptions();
1168
1620
  if (this.getIsViewMode()) {
1169
1621
  this.loadLibrary(this.params.appServer).then(async () => {
@@ -1172,25 +1624,32 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1172
1624
  const oldReference = this.renderRoot.querySelector("dashboard-component");
1173
1625
  this.dashboardReference = oldReference.cloneNode(true);
1174
1626
  oldReference.replaceWith(this.dashboardReference);
1175
- this.dashboardReference.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
1176
- this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
1177
- this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
1178
- this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
1179
- this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
1180
- this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
1627
+ this.dashboardReference.addEventListener("load", (payload) => {
1628
+ setTimeout(() => {
1629
+ this.containerWidth = this.dashboardReference.offsetWidth;
1630
+ this.dimensions = payload.detail.dimensions;
1631
+ _setCalculatedDimensions(this);
1632
+ this.dispatchEvent(new CustomEvent("load", payload.detail));
1633
+ });
1634
+ });
1635
+ this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload.detail)));
1636
+ this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload.detail)));
1637
+ this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload.detail)));
1638
+ this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload.detail)));
1639
+ this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload.detail)));
1181
1640
  this.setAllAttributes();
1182
1641
  });
1183
1642
  } else {
1184
- this.containerWidth = (_a2 = this.container) == null ? void 0 : _a2.clientWidth;
1185
- SharedLib__namespace._extendAndValidate(this);
1186
- SharedLib__namespace._browserCheck(this);
1643
+ this.containerWidth = this.container?.clientWidth;
1644
+ _extendAndValidate(this);
1645
+ _browserCheck(this);
1187
1646
  this._setupLoader();
1188
1647
  if (!this.params.error) {
1189
1648
  this._loaderStyles();
1190
1649
  _setEventHandler();
1191
- this._iframeUrl = SharedLib__namespace.createIframeUrl(this);
1192
- (_b = this.iframe) == null ? void 0 : _b.setAttribute("src", this._iframeUrl);
1193
- this.iframeStyle = SharedLib__namespace.calculateIframeStyles(this);
1650
+ this._iframeUrl = createIframeUrl(this);
1651
+ this.iframe?.setAttribute("src", this._iframeUrl);
1652
+ this.iframeStyle = calculateIframeStyles(this);
1194
1653
  }
1195
1654
  if (this.container) {
1196
1655
  this._resizeObserver.observe(this.container);
@@ -1200,11 +1659,14 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1200
1659
  setAllAttributes() {
1201
1660
  if (this.dashboardReference) {
1202
1661
  for (const key in this.attributesMap) {
1203
- if (!["authKey", "authToken", "apiHost"].includes(key) && this.params[key]) {
1662
+ if (!["authKey", "authToken", "apiHost", "itemDimensions"].includes(key) && this.params[key]) {
1204
1663
  this.dashboardReference.setAttribute(this.attributesMap[key], this.params[key]);
1205
1664
  }
1665
+ if (this.params.itemDimensions) {
1666
+ this.dashboardReference.setAttribute("item-dimensions", JSON.stringify(this.params.itemDimensions));
1667
+ }
1206
1668
  if (this.params.apiHost) {
1207
- this.dashboardReference.setAttribute("api-host", SharedLib__namespace.removeTrailingSlash(this.params.apiHost));
1669
+ this.dashboardReference.setAttribute("api-host", removeTrailingSlash(this.params.apiHost));
1208
1670
  }
1209
1671
  if (this.params.key) {
1210
1672
  this.dashboardReference.setAttribute("auth-key", this.params.key);
@@ -1232,7 +1694,24 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1232
1694
  "timezoneId",
1233
1695
  "itemDimensions"
1234
1696
  ]);
1235
- if (!this.getIsViewMode()) {
1697
+ if (this.getIsViewMode()) {
1698
+ if (this.dashboardReference) {
1699
+ for (const [propertyName] of changedProperties.entries()) {
1700
+ if (propertyName === "appSever") {
1701
+ this.loadLibrary(changedProperties[propertyName]).then(async () => {
1702
+ this.isLibraryLoaded = true;
1703
+ await this.updateComplete;
1704
+ this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
1705
+ this.setAllAttributes();
1706
+ });
1707
+ } else if (this.attributesMap[propertyName]) {
1708
+ const mappedAttributeName = this.attributesMap[propertyName] ?? propertyName;
1709
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() || this[propertyName];
1710
+ this.dashboardReference.setAttribute(mappedAttributeName, attributeValue);
1711
+ }
1712
+ }
1713
+ }
1714
+ } else {
1236
1715
  for (const [propertyName] of changedProperties.entries()) {
1237
1716
  if (triggerProperties.has(propertyName) && propertyName !== "editMode") {
1238
1717
  this.iframeLoaded = false;
@@ -1245,14 +1724,14 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1245
1724
  );
1246
1725
  }, 15 * 1e3);
1247
1726
  this.params = this._setOptions();
1248
- SharedLib__namespace._extendAndValidate(this);
1727
+ _extendAndValidate(this);
1249
1728
  this._setupLoader();
1250
1729
  this._loaderStyles();
1251
- this._iframeUrl = SharedLib__namespace.createIframeUrl(this);
1730
+ this._iframeUrl = createIframeUrl(this);
1252
1731
  if (this.iframe) {
1253
1732
  this._updateIframeUrl();
1254
1733
  }
1255
- this.iframeStyle = SharedLib__namespace.calculateIframeStyles(this);
1734
+ this.iframeStyle = calculateIframeStyles(this);
1256
1735
  } else if (triggerProperties.has(propertyName) && propertyName === "editMode") {
1257
1736
  if (this.iframeLoaded) {
1258
1737
  this.setEditMode(this.editMode);
@@ -1260,21 +1739,6 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1260
1739
  this.params = this._setOptions();
1261
1740
  }
1262
1741
  }
1263
- } else {
1264
- if (this.dashboardReference) {
1265
- for (const [propertyName] of changedProperties.entries()) {
1266
- if (propertyName === "appSever") {
1267
- this.loadLibrary(changedProperties[propertyName]).then(async () => {
1268
- this.isLibraryLoaded = true;
1269
- await this.updateComplete;
1270
- this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
1271
- this.setAllAttributes();
1272
- });
1273
- } else if (this.attributesMap[propertyName]) {
1274
- this.dashboardReference.setAttribute(this.attributesMap[propertyName] ?? propertyName, this[propertyName]);
1275
- }
1276
- }
1277
- }
1278
1742
  }
1279
1743
  }
1280
1744
  // Set params
@@ -1333,29 +1797,29 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1333
1797
  defaultParameters.itemDimensions = this.itemDimensions;
1334
1798
  }
1335
1799
  if (this.appServer) {
1336
- this.appServer = this.getIsViewMode() ? SharedLib__namespace.removeTrailingSlash(this.appServer) : SharedLib__namespace.addTrailingSlash(this.appServer);
1800
+ this.appServer = this.getIsViewMode() ? removeTrailingSlash(this.appServer) : addTrailingSlash(this.appServer);
1337
1801
  defaultParameters.appServer = this.appServer;
1338
1802
  } else {
1339
- this.appServer = SharedLib__namespace.addTrailingSlash(
1340
- SharedLib__namespace.DEFAULT_PARAMETERS.appServer
1803
+ this.appServer = addTrailingSlash(
1804
+ DEFAULT_PARAMETERS.appServer
1341
1805
  );
1342
1806
  defaultParameters.appServer = this.appServer;
1343
1807
  }
1344
1808
  if (this.apiHost) {
1345
- this.apiHost = this.getIsViewMode() ? SharedLib__namespace.removeTrailingSlash(this.apiHost) : SharedLib__namespace.addTrailingSlash(this.apiHost);
1809
+ this.apiHost = this.getIsViewMode() ? removeTrailingSlash(this.apiHost) : addTrailingSlash(this.apiHost);
1346
1810
  defaultParameters.apiHost = this.apiHost;
1347
1811
  } else {
1348
- this.apiHost = this.appServer.endsWith("luzmo.com/") ? this.appServer.replace("app", "api") : this.appServer;
1812
+ this.apiHost = this.appServer.includes("luzmo.com") ? this.appServer.replace("app", "api") : this.appServer;
1349
1813
  defaultParameters.apiHost = this.apiHost;
1350
1814
  }
1351
1815
  return defaultParameters;
1352
1816
  }
1353
1817
  _updateIframeUrl() {
1354
- SharedLib__namespace.updateIframeUrl(this.iframe, this._iframeUrl);
1818
+ updateIframeUrl(this.iframe, this._iframeUrl);
1355
1819
  }
1356
1820
  // Setup loader / browser error
1357
1821
  _setupLoader() {
1358
- const data = SharedLib__namespace.getLoader(this);
1822
+ const data = getLoader(this);
1359
1823
  this._loaderMsg = data.loadingMsg;
1360
1824
  if (data.errorMsg) {
1361
1825
  this.browserError = true;
@@ -1375,48 +1839,48 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1375
1839
  _calculateDimAfterDashboardLoaded() {
1376
1840
  this.dashboardError = false;
1377
1841
  this._loaderStyles();
1378
- SharedLib__namespace._setCalculatedDimensions(this);
1842
+ _setCalculatedDimensions(this);
1379
1843
  }
1380
1844
  // Set loader styles
1381
1845
  _loaderStyles() {
1382
- this._containerStyle = SharedLib__namespace.containerStyles(this);
1383
- this._loaderStyle = SharedLib__namespace.loaderStyles(this);
1384
- this._loadingCircleStyle = SharedLib__namespace.plStyles(this);
1385
- this._containerLoaderStyle = SharedLib__namespace.containerLoaderStyles(this);
1386
- this._lcStyle = SharedLib__namespace.lcStyles(this);
1846
+ this._containerStyle = containerStyles(this);
1847
+ this._loaderStyle = loaderStyles(this);
1848
+ this._loadingCircleStyle = plStyles(this);
1849
+ this._containerLoaderStyle = containerLoaderStyles(this);
1850
+ this._lcStyle = lcStyles(this);
1387
1851
  }
1388
1852
  static get styles() {
1389
1853
  return [dashboardStyles];
1390
1854
  }
1391
1855
  render() {
1392
- let toBeRenderedHTML = x``;
1393
- const loader = x`
1856
+ let toBeRenderedHTML = html``;
1857
+ const loader = html`
1394
1858
  <div
1395
1859
  class="luzmo-container-loader"
1396
1860
  id="luzmo-container-loader-${this._containerId}"
1397
- style=${o(
1861
+ style=${styleMap(
1398
1862
  this._containerLoaderStyle
1399
1863
  )}
1400
1864
  >
1401
1865
  <div
1402
1866
  class="luzmo-loader"
1403
1867
  id="luzmo-loader-${this._containerId}"
1404
- style=${o(this._loaderStyle)}
1868
+ style=${styleMap(this._loaderStyle)}
1405
1869
  >
1406
1870
  <div
1407
1871
  class="luzmo-lc"
1408
- style=${o(this._lcStyle)}
1872
+ style=${styleMap(this._lcStyle)}
1409
1873
  >
1410
1874
  <div
1411
1875
  class="luzmo-loading-circle"
1412
- style=${o(
1876
+ style=${styleMap(
1413
1877
  this._loadingCircleStyle
1414
1878
  )}
1415
1879
  ></div>
1416
- ${this._itemEmbedding ? "" : x`
1880
+ ${this._itemEmbedding ? "" : html`
1417
1881
  <div
1418
1882
  class="luzmo-loading-message"
1419
- style=${o({ color: this.loaderFontColor })}
1883
+ style=${styleMap({ color: this.loaderFontColor })}
1420
1884
  >
1421
1885
  ${this._loaderMsg}
1422
1886
  </div>
@@ -1425,38 +1889,41 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1425
1889
  </div>
1426
1890
  </div>
1427
1891
  `;
1428
- if (!this.getIsViewMode()) {
1429
- toBeRenderedHTML = x`
1430
- ${this.dashboardId || this.dashboardSlug ? x`
1892
+ if (this.getIsViewMode()) {
1893
+ toBeRenderedHTML = this.isLibraryLoaded ? html`
1894
+ ${this.dashboardId || this.dashboardSlug ? html`<dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}" api-host="${this.params.apiHost}"></dashboard-component>` : html`
1895
+ <div id="luzmo-error-${this._containerId}">
1896
+ <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
1897
+ </div>
1898
+ `}
1899
+ ` : html`${loader}`;
1900
+ } else {
1901
+ toBeRenderedHTML = html`
1902
+ ${this.dashboardId || this.dashboardSlug ? html`
1431
1903
  ${loader}
1432
1904
  <iframe
1433
1905
  class="luzmo-embed-dashboard"
1434
1906
  id="${this._iframeId}"
1435
1907
  name="${this._iframeId}"
1436
- style=${o(this.iframeStyle)}
1908
+ style=${styleMap(this.iframeStyle)}
1437
1909
  src="${this._iframeUrl}"
1438
1910
  frameborder="0"
1439
1911
  ></iframe>
1440
- ` : x`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
1441
- ${this.browserError ? x`
1912
+ ` : html`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
1913
+ ${this.browserError ? html`
1442
1914
  <div id="luzmo-error-${this._containerId}">
1443
1915
  <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
1444
1916
  </div>
1445
1917
  ` : ""}
1446
1918
  `;
1447
- } else {
1448
- toBeRenderedHTML = this.isLibraryLoaded ? x`
1449
- ${this.dashboardId || this.dashboardSlug ? x`<dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}" api-host="${this.params.apiHost}"></dashboard-component>` : x`
1450
- <div id="luzmo-error-${this._containerId}">
1451
- <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
1452
- </div>
1453
- `}
1454
- ` : x`${loader}`;
1455
1919
  }
1456
- return x`
1920
+ return html`
1457
1921
  <div
1458
1922
  class="dashboard-container"
1459
- style=${o(this._containerStyle)}
1923
+ style=${styleMap(Object.assign({}, this._containerStyle, {
1924
+ width: this.iframeStyle.width ?? "100%",
1925
+ height: this.iframeStyle.height ?? "100%"
1926
+ }))}
1460
1927
  >
1461
1928
  ${toBeRenderedHTML}
1462
1929
  </div>
@@ -1464,7 +1931,7 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1464
1931
  }
1465
1932
  getDashboards() {
1466
1933
  return new Promise(
1467
- (resolve) => resolve(LuzmoService$1._components)
1934
+ (resolve) => resolve(luzmo_service_default._components)
1468
1935
  );
1469
1936
  }
1470
1937
  // Public methods
@@ -1473,7 +1940,7 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1473
1940
  return this.dashboardReference.getData(itemId);
1474
1941
  }
1475
1942
  if (!this.getIsViewMode()) {
1476
- return SharedLib__namespace.getData(this, this.iframe, itemId);
1943
+ return getData(this, this.iframe, itemId);
1477
1944
  }
1478
1945
  return Promise.reject();
1479
1946
  }
@@ -1482,16 +1949,16 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1482
1949
  return this.dashboardReference.getFilters();
1483
1950
  }
1484
1951
  if (!this.getIsViewMode()) {
1485
- return SharedLib__namespace.getFilters(this, this.iframe);
1952
+ return getFilters(this, this.iframe);
1486
1953
  }
1487
1954
  return Promise.reject();
1488
1955
  }
1489
1956
  setFilters(itemId, filters) {
1490
1957
  if (this.getIsViewMode() && this.dashboardReference) {
1491
- return Promise.reject();
1958
+ return this.dashboardReference.setFilters(itemId, filters);
1492
1959
  }
1493
1960
  if (!this.getIsViewMode()) {
1494
- return SharedLib__namespace.setFilters(this, this.iframe, itemId, filters);
1961
+ return setFilters(this, this.iframe, itemId, filters);
1495
1962
  }
1496
1963
  return Promise.reject();
1497
1964
  }
@@ -1500,7 +1967,7 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1500
1967
  return this.dashboardReference.setAuthorization(key, token);
1501
1968
  }
1502
1969
  if (!this.getIsViewMode()) {
1503
- return SharedLib__namespace.setAuthorization(this, this.iframe, key, token);
1970
+ return setAuthorization(this, this.iframe, key, token);
1504
1971
  }
1505
1972
  return Promise.reject();
1506
1973
  }
@@ -1509,7 +1976,7 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1509
1976
  return this.dashboardReference.refreshData(itemId);
1510
1977
  }
1511
1978
  if (!this.getIsViewMode()) {
1512
- return itemId ? SharedLib__namespace.refreshData(this, this.iframe, itemId) : SharedLib__namespace.refreshData(this, this.iframe);
1979
+ return itemId ? refreshData(this, this.iframe, itemId) : refreshData(this, this.iframe);
1513
1980
  }
1514
1981
  return Promise.reject();
1515
1982
  }
@@ -1518,7 +1985,7 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1518
1985
  return this.dashboardReference.reloadDashboard();
1519
1986
  }
1520
1987
  if (!this.getIsViewMode()) {
1521
- return SharedLib__namespace.reloadDashboard(this, this.iframe);
1988
+ return reloadDashboard(this, this.iframe);
1522
1989
  }
1523
1990
  return Promise.reject();
1524
1991
  }
@@ -1527,19 +1994,22 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1527
1994
  return this.dashboardReference.exportDashboard(format);
1528
1995
  }
1529
1996
  if (!this.getIsViewMode()) {
1530
- return format ? SharedLib__namespace.exportDashboard(this, this.iframe, format) : SharedLib__namespace.exportDashboard(this, this.iframe);
1997
+ return format ? exportDashboard(this, this.iframe, format) : exportDashboard(this, this.iframe);
1531
1998
  }
1532
1999
  return Promise.reject();
1533
2000
  }
1534
2001
  getAccessibleDashboards() {
1535
2002
  if (!this.getIsViewMode()) {
1536
- return SharedLib__namespace.getAccessibleDashboards(this, this.iframe);
2003
+ return getAccessibleDashboards(this, this.iframe);
1537
2004
  }
1538
2005
  if (this.getIsViewMode() && this.dashboardReference) {
1539
2006
  return this.dashboardReference.getAccessibleDashboards();
1540
2007
  }
1541
2008
  return Promise.reject();
1542
2009
  }
2010
+ addFilters(itemId, filters) {
2011
+ return this.dashboardReference.addFilters(itemId, filters);
2012
+ }
1543
2013
  setEditMode(editMode) {
1544
2014
  if (this.dashboardReference && editMode === "view") {
1545
2015
  this.editMode = "view";
@@ -1563,7 +2033,7 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1563
2033
  return this.dashboardReference.setEditMode(editMode);
1564
2034
  }
1565
2035
  if (!this.getIsViewMode()) {
1566
- return SharedLib__namespace.setEditMode(this, this.iframe, editMode);
2036
+ return setEditMode(this, this.iframe, editMode);
1567
2037
  }
1568
2038
  return Promise.reject();
1569
2039
  }
@@ -1571,161 +2041,164 @@ exports.LuzmoDashboard = class LuzmoDashboard extends s {
1571
2041
  if (this.getIsViewMode() && this.dashboardReference) {
1572
2042
  return this.dashboardReference.setPreview(preview);
1573
2043
  }
1574
- return SharedLib__namespace.setPreview(this, this.iframe, preview);
2044
+ return setPreview(this, this.iframe, preview);
1575
2045
  }
1576
2046
  getIsViewMode() {
1577
- if (this.dev && this.params.editMode === "view" || this.params.editMode === void 0) {
2047
+ if (this.experimental && this.params.editMode === "view" || this.params.editMode === void 0) {
1578
2048
  return true;
1579
2049
  }
1580
2050
  return false;
1581
2051
  }
1582
2052
  };
1583
2053
  __decorateClass([
1584
- e$1(".dashboard-container")
1585
- ], exports.LuzmoDashboard.prototype, "container", 2);
2054
+ query(".dashboard-container")
2055
+ ], LuzmoDashboard.prototype, "container", 2);
1586
2056
  __decorateClass([
1587
- e$1("iframe")
1588
- ], exports.LuzmoDashboard.prototype, "iframe", 2);
2057
+ query("iframe")
2058
+ ], LuzmoDashboard.prototype, "iframe", 2);
1589
2059
  __decorateClass([
1590
- n$1()
1591
- ], exports.LuzmoDashboard.prototype, "dashboardId", 2);
2060
+ property()
2061
+ ], LuzmoDashboard.prototype, "dashboardId", 2);
1592
2062
  __decorateClass([
1593
- n$1()
1594
- ], exports.LuzmoDashboard.prototype, "dashboardSlug", 2);
2063
+ property()
2064
+ ], LuzmoDashboard.prototype, "dashboardSlug", 2);
1595
2065
  __decorateClass([
1596
- n$1()
1597
- ], exports.LuzmoDashboard.prototype, "itemId", 2);
2066
+ property()
2067
+ ], LuzmoDashboard.prototype, "itemId", 2);
1598
2068
  __decorateClass([
1599
- n$1()
1600
- ], exports.LuzmoDashboard.prototype, "language", 2);
2069
+ property()
2070
+ ], LuzmoDashboard.prototype, "language", 2);
1601
2071
  __decorateClass([
1602
- n$1()
1603
- ], exports.LuzmoDashboard.prototype, "qeVersion", 2);
2072
+ property()
2073
+ ], LuzmoDashboard.prototype, "qeVersion", 2);
1604
2074
  __decorateClass([
1605
- n$1()
1606
- ], exports.LuzmoDashboard.prototype, "screenMode", 2);
2075
+ property()
2076
+ ], LuzmoDashboard.prototype, "screenMode", 2);
1607
2077
  __decorateClass([
1608
- n$1({
2078
+ property({
1609
2079
  converter: {
1610
2080
  fromAttribute: (value) => value === "true",
1611
2081
  toAttribute: String
1612
2082
  }
1613
2083
  })
1614
- ], exports.LuzmoDashboard.prototype, "switchScreenModeOnResize", 2);
2084
+ ], LuzmoDashboard.prototype, "switchScreenModeOnResize", 2);
1615
2085
  __decorateClass([
1616
- n$1()
1617
- ], exports.LuzmoDashboard.prototype, "editMode", 2);
2086
+ property()
2087
+ ], LuzmoDashboard.prototype, "editMode", 2);
1618
2088
  __decorateClass([
1619
- n$1()
1620
- ], exports.LuzmoDashboard.prototype, "mainColor", 2);
2089
+ property()
2090
+ ], LuzmoDashboard.prototype, "mainColor", 2);
1621
2091
  __decorateClass([
1622
- n$1()
1623
- ], exports.LuzmoDashboard.prototype, "accentColor", 2);
2092
+ property()
2093
+ ], LuzmoDashboard.prototype, "accentColor", 2);
1624
2094
  __decorateClass([
1625
- n$1()
1626
- ], exports.LuzmoDashboard.prototype, "authToken", 2);
2095
+ property()
2096
+ ], LuzmoDashboard.prototype, "authToken", 2);
1627
2097
  __decorateClass([
1628
- n$1()
1629
- ], exports.LuzmoDashboard.prototype, "authKey", 2);
2098
+ property()
2099
+ ], LuzmoDashboard.prototype, "authKey", 2);
1630
2100
  __decorateClass([
1631
- n$1()
1632
- ], exports.LuzmoDashboard.prototype, "loaderBackground", 2);
2101
+ property()
2102
+ ], LuzmoDashboard.prototype, "loaderBackground", 2);
1633
2103
  __decorateClass([
1634
- n$1()
1635
- ], exports.LuzmoDashboard.prototype, "loaderFontColor", 2);
2104
+ property()
2105
+ ], LuzmoDashboard.prototype, "loaderFontColor", 2);
1636
2106
  __decorateClass([
1637
- n$1()
1638
- ], exports.LuzmoDashboard.prototype, "loaderSpinnerColor", 2);
2107
+ property()
2108
+ ], LuzmoDashboard.prototype, "loaderSpinnerColor", 2);
1639
2109
  __decorateClass([
1640
- n$1()
1641
- ], exports.LuzmoDashboard.prototype, "loaderSpinnerBackground", 2);
2110
+ property()
2111
+ ], LuzmoDashboard.prototype, "loaderSpinnerBackground", 2);
1642
2112
  __decorateClass([
1643
- n$1()
1644
- ], exports.LuzmoDashboard.prototype, "appServer", 2);
2113
+ property()
2114
+ ], LuzmoDashboard.prototype, "appServer", 2);
1645
2115
  __decorateClass([
1646
- n$1()
1647
- ], exports.LuzmoDashboard.prototype, "timezoneId", 2);
2116
+ property()
2117
+ ], LuzmoDashboard.prototype, "timezoneId", 2);
1648
2118
  __decorateClass([
1649
- n$1()
1650
- ], exports.LuzmoDashboard.prototype, "apiHost", 2);
2119
+ property()
2120
+ ], LuzmoDashboard.prototype, "apiHost", 2);
1651
2121
  __decorateClass([
1652
- n$1({ type: Object })
1653
- ], exports.LuzmoDashboard.prototype, "itemDimensions", 2);
2122
+ property({ type: Object })
2123
+ ], LuzmoDashboard.prototype, "itemDimensions", 2);
1654
2124
  __decorateClass([
1655
- n$1()
1656
- ], exports.LuzmoDashboard.prototype, "dev", 2);
2125
+ property()
2126
+ ], LuzmoDashboard.prototype, "experimental", 2);
1657
2127
  __decorateClass([
1658
- n$1({ attribute: false })
1659
- ], exports.LuzmoDashboard.prototype, "_containerId", 2);
2128
+ property({ attribute: false })
2129
+ ], LuzmoDashboard.prototype, "_containerId", 2);
1660
2130
  __decorateClass([
1661
- n$1({ attribute: false })
1662
- ], exports.LuzmoDashboard.prototype, "_iframeId", 2);
2131
+ property({ attribute: false })
2132
+ ], LuzmoDashboard.prototype, "_iframeId", 2);
1663
2133
  __decorateClass([
1664
- n$1({ attribute: false })
1665
- ], exports.LuzmoDashboard.prototype, "params", 2);
2134
+ property({ attribute: false })
2135
+ ], LuzmoDashboard.prototype, "params", 2);
1666
2136
  __decorateClass([
1667
- n$1({ attribute: false })
1668
- ], exports.LuzmoDashboard.prototype, "_iframeUrl", 2);
2137
+ property({ attribute: false })
2138
+ ], LuzmoDashboard.prototype, "_iframeUrl", 2);
1669
2139
  __decorateClass([
1670
- n$1({ attribute: false })
1671
- ], exports.LuzmoDashboard.prototype, "iframeLoaded", 2);
2140
+ property({ attribute: false })
2141
+ ], LuzmoDashboard.prototype, "iframeLoaded", 2);
1672
2142
  __decorateClass([
1673
- n$1({ attribute: false })
1674
- ], exports.LuzmoDashboard.prototype, "promises", 2);
2143
+ property({ attribute: false })
2144
+ ], LuzmoDashboard.prototype, "promises", 2);
1675
2145
  __decorateClass([
1676
- n$1({ attribute: false })
1677
- ], exports.LuzmoDashboard.prototype, "iframeStyle", 2);
2146
+ property({ attribute: false })
2147
+ ], LuzmoDashboard.prototype, "iframeStyle", 2);
1678
2148
  __decorateClass([
1679
- n$1({ attribute: false })
1680
- ], exports.LuzmoDashboard.prototype, "_containerStyle", 2);
2149
+ property({ attribute: false })
2150
+ ], LuzmoDashboard.prototype, "_containerStyle", 2);
1681
2151
  __decorateClass([
1682
- n$1({ attribute: false })
1683
- ], exports.LuzmoDashboard.prototype, "_loaderStyle", 2);
2152
+ property({ attribute: false })
2153
+ ], LuzmoDashboard.prototype, "_loaderStyle", 2);
1684
2154
  __decorateClass([
1685
- n$1({ attribute: false })
1686
- ], exports.LuzmoDashboard.prototype, "_lcStyle", 2);
2155
+ property({ attribute: false })
2156
+ ], LuzmoDashboard.prototype, "_lcStyle", 2);
1687
2157
  __decorateClass([
1688
- n$1({ attribute: false })
1689
- ], exports.LuzmoDashboard.prototype, "_loadingCircleStyle", 2);
2158
+ property({ attribute: false })
2159
+ ], LuzmoDashboard.prototype, "_loadingCircleStyle", 2);
1690
2160
  __decorateClass([
1691
- n$1({ attribute: false })
1692
- ], exports.LuzmoDashboard.prototype, "_containerLoaderStyle", 2);
2161
+ property({ attribute: false })
2162
+ ], LuzmoDashboard.prototype, "_containerLoaderStyle", 2);
1693
2163
  __decorateClass([
1694
- n$1({ attribute: false })
1695
- ], exports.LuzmoDashboard.prototype, "_loaderMsg", 2);
2164
+ property({ attribute: false })
2165
+ ], LuzmoDashboard.prototype, "_loaderMsg", 2);
1696
2166
  __decorateClass([
1697
- n$1({ attribute: false })
1698
- ], exports.LuzmoDashboard.prototype, "containerWidth", 2);
2167
+ property({ attribute: false })
2168
+ ], LuzmoDashboard.prototype, "containerWidth", 2);
1699
2169
  __decorateClass([
1700
- n$1({ attribute: false })
1701
- ], exports.LuzmoDashboard.prototype, "dimensions", 2);
2170
+ property({ attribute: false })
2171
+ ], LuzmoDashboard.prototype, "dimensions", 2);
1702
2172
  __decorateClass([
1703
- n$1({ attribute: false })
1704
- ], exports.LuzmoDashboard.prototype, "currentScreenMode", 2);
2173
+ property({ attribute: false })
2174
+ ], LuzmoDashboard.prototype, "currentScreenMode", 2);
1705
2175
  __decorateClass([
1706
- n$1({ attribute: false })
1707
- ], exports.LuzmoDashboard.prototype, "_itemEmbedding", 2);
2176
+ property({ attribute: false })
2177
+ ], LuzmoDashboard.prototype, "_itemEmbedding", 2);
1708
2178
  __decorateClass([
1709
- n$1({ attribute: false })
1710
- ], exports.LuzmoDashboard.prototype, "browserError", 2);
2179
+ property({ attribute: false })
2180
+ ], LuzmoDashboard.prototype, "browserError", 2);
1711
2181
  __decorateClass([
1712
- n$1({ attribute: false })
1713
- ], exports.LuzmoDashboard.prototype, "browserErrorMsg", 2);
2182
+ property({ attribute: false })
2183
+ ], LuzmoDashboard.prototype, "browserErrorMsg", 2);
1714
2184
  __decorateClass([
1715
- n$1({ attribute: false })
1716
- ], exports.LuzmoDashboard.prototype, "dashboardError", 2);
2185
+ property({ attribute: false })
2186
+ ], LuzmoDashboard.prototype, "dashboardError", 2);
1717
2187
  __decorateClass([
1718
- n$1({ attribute: false })
1719
- ], exports.LuzmoDashboard.prototype, "browserNotSupported", 2);
2188
+ property({ attribute: false })
2189
+ ], LuzmoDashboard.prototype, "browserNotSupported", 2);
1720
2190
  __decorateClass([
1721
- n$1({ attribute: false })
1722
- ], exports.LuzmoDashboard.prototype, "VERSION", 2);
2191
+ property({ attribute: false })
2192
+ ], LuzmoDashboard.prototype, "VERSION", 2);
1723
2193
  __decorateClass([
1724
- r()
1725
- ], exports.LuzmoDashboard.prototype, "isLibraryLoaded", 2);
2194
+ state()
2195
+ ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
1726
2196
  __decorateClass([
1727
- r()
1728
- ], exports.LuzmoDashboard.prototype, "dashboardReference", 2);
1729
- exports.LuzmoDashboard = __decorateClass([
1730
- t$1("luzmo-dashboard")
1731
- ], exports.LuzmoDashboard);
2197
+ state()
2198
+ ], LuzmoDashboard.prototype, "dashboardReference", 2);
2199
+ LuzmoDashboard = __decorateClass([
2200
+ customElement("luzmo-dashboard")
2201
+ ], LuzmoDashboard);
2202
+ export {
2203
+ LuzmoDashboard
2204
+ };