@luzmo/embed 5.0.4 → 5.0.6

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.
@@ -1,2027 +1,10 @@
1
- (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["libs/embedded-libs/embed"] = {}));
3
- })(this, function(exports2) {
4
- var _a;
5
- "use strict";
6
- const _handleError = (errorMessage, parameters) => {
7
- let message = "The dashboard component encountered an error";
8
- if (typeof (parameters == null ? void 0 : parameters.dashboardId) === "string") {
9
- message += ` for dashboard with id ${parameters.dashboardId}`;
10
- }
11
- if (typeof (parameters == null ? void 0 : parameters.dashboardSlug) === "string") {
12
- message += ` for dashboard with slug ${parameters.dashboardSlug}`;
13
- }
14
- if (typeof (parameters == null ? void 0 : parameters.container) === "string") {
15
- message += ` in container ${parameters.container}`;
16
- }
17
- if (errorMessage) {
18
- message += `:
19
- ${errorMessage}`;
20
- console.error(message);
21
- }
22
- };
23
- const _browserCheck = (dashboardComponent) => {
24
- let hasError = false;
25
- let errorMessage = "";
26
- const document_ = document.body || document.documentElement;
27
- const style = document_.style;
28
- const browserCheck = {
29
- svg: !!("createElementNS" in document && document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect),
30
- flexbox: style.webkitFlexWrap === "" || style.flexWrap === "",
31
- postMessage: !!window.postMessage
32
- };
33
- const browserCheckKeys = ["svg", "flexbox", "postMessage"];
34
- for (const key of browserCheckKeys) {
35
- if (!browserCheck[key]) {
36
- hasError = true;
37
- dashboardComponent.browserNotSupported = dashboardComponent.browserNotSupported || [];
38
- dashboardComponent.browserNotSupported.push(key);
39
- errorMessage += `Your browser does not support: ${key}
40
- `;
41
- }
42
- }
43
- const ua = window.navigator.userAgent;
44
- const msie = ua.includes("MSIE");
45
- const trident = ua.includes("Trident/");
46
- if (msie || trident) {
47
- hasError = true;
48
- errorMessage = "IE is not supported.";
49
- }
50
- if (hasError) {
51
- _handleError(errorMessage);
52
- }
53
- };
54
- const DEFAULT_PARAMETERS = {
55
- appServer: "https://app.luzmo.com/",
56
- apiHost: "https://api.luzmo.com/",
57
- dashboardId: null,
58
- dashboardSlug: null,
59
- container: null,
60
- key: null,
61
- token: null,
62
- language: "auto",
63
- qeVersion: null,
64
- editMode: null,
65
- screenMode: null,
66
- switchScreenModeOnResize: true,
67
- itemId: null,
68
- mainColor: "",
69
- accentColor: "",
70
- itemDimensions: {
71
- width: "auto",
72
- height: "auto"
73
- },
74
- loaderBackground: "#f9f9f9",
75
- loaderFontColor: "#5a5a5a",
76
- loaderSpinnerColor: "rgba(255, 165, 0, 0.7)",
77
- loaderSpinnerBackground: "rgba(169, 169, 169, 0.14)",
78
- timezoneId: null
79
- };
80
- const EXTENTS = [
81
- { mode: "mobile", width: [150, 767] },
82
- { mode: "tablet", width: [768, 1199] },
83
- { mode: "desktop", width: [1200, 1599] },
84
- { mode: "largeScreen", width: [1600, 9999] },
85
- { mode: "fixed", width: [] }
86
- ];
87
- const TRANSLATIONS = {
88
- initializing: { en: "Initializing...", nl: "Laden...", fr: "Chargement..." },
89
- errorDashboard: {
90
- en: "Oops, we could not load this dashboard!",
91
- nl: "Oeps, we konden het dashboard niet laden.",
92
- fr: "Le chargement a echoué."
93
- },
94
- errorItem: {
95
- en: "Oops, we could not load this item!",
96
- nl: "Oeps, we konden de grafiek niet laden.",
97
- fr: "Le chargement a echoué."
98
- }
99
- };
100
- const addTrailingSlash = (serverUrl) => {
101
- if (!serverUrl) {
102
- return "";
103
- }
104
- return serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
105
- };
106
- const removeTrailingSlash = (serverUrl) => {
107
- if (!serverUrl) {
108
- return "";
109
- }
110
- return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
111
- };
112
- const formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
113
- var _a2;
114
- const combineRights = (securable, user2) => {
115
- var _a3;
116
- const matchingUser = securable.users.find((u2) => u2.id === user2.id);
117
- const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
118
- flagRead: matchingUser.userAccessRight.flagRead,
119
- flagUse: matchingUser.userAccessRight.flagUse,
120
- flagModify: matchingUser.userAccessRight.flagModify,
121
- flagOwn: matchingUser.userAccessRight.flagOwn
122
- } : {
123
- flagRead: false,
124
- flagUse: false,
125
- flagModify: false,
126
- flagOwn: false
127
- };
128
- const groups = securable.groups.filter(
129
- (group) => user2.userGroups.includes(group.id) || group.public === true
130
- );
131
- const groupsAccess = groups.map((group) => {
132
- if (group.groupAccessRight) {
133
- return group.groupAccessRight;
134
- }
135
- });
136
- for (const groupAccess of groupsAccess) {
137
- if (!securableAccessRights.flagRead && groupAccess.flagRead) {
138
- securableAccessRights.flagRead = groupAccess.flagRead;
139
- }
140
- if (!securableAccessRights.flagUse && groupAccess.flagUse) {
141
- securableAccessRights.flagUse = groupAccess.flagUse;
142
- }
143
- if (!securableAccessRights.flagModify && groupAccess.flagModify) {
144
- securableAccessRights.flagModify = groupAccess.flagModify;
145
- }
146
- if (!securableAccessRights.flagOwn && groupAccess.flagOwn) {
147
- securableAccessRights.flagOwn = groupAccess.flagOwn;
148
- }
149
- }
150
- const integrationsAccess = ((_a3 = securable.integrations) == null ? void 0 : _a3.length) > 0 ? securable.integrations.map((integration) => {
151
- if (integration.integrationAccessRight) {
152
- return integration.integrationAccessRight;
153
- }
154
- }) : [];
155
- for (const integrationAccess of integrationsAccess) {
156
- if (!securableAccessRights.flagRead && integrationAccess.flagRead) {
157
- securableAccessRights.flagRead = integrationAccess.flagRead;
158
- }
159
- if (!securableAccessRights.flagUse && integrationAccess.flagUse) {
160
- securableAccessRights.flagUse = integrationAccess.flagUse;
161
- }
162
- if (!securableAccessRights.flagModify && integrationAccess.flagModify) {
163
- securableAccessRights.flagModify = integrationAccess.flagModify;
164
- }
165
- }
166
- return securableAccessRights;
167
- };
168
- const localize = (item, locale) => {
169
- if (item === null || item === void 0) {
170
- return "";
171
- }
172
- if (typeof item !== "object" || Object.keys(item).length === 0) {
173
- if (typeof item === "object" && Object.keys(item).length === 0) {
174
- return "";
175
- }
176
- return item;
177
- }
178
- let localizedItem;
179
- localizedItem = locale && item[locale] ? item[locale] : item[Object.keys(item)[0]];
180
- if (localizedItem === void 0 || localizedItem === null) {
181
- localizedItem = "";
182
- }
183
- return localizedItem;
184
- };
185
- const treatedDashboards = [];
186
- for (const dashboard of dashboards) {
187
- const treatedDashboard = {
188
- accessibleBy: [],
189
- accessRights: combineRights(dashboard, user),
190
- id: dashboard.id,
191
- modifiedAt: dashboard.modified_at,
192
- name: localize(dashboard.name, dashboardComponent.language),
193
- slug: null,
194
- tags: dashboard.tags.map((t2) => t2.tag).sort((t1, t2) => t1.localeCompare(t2))
195
- };
196
- const currentIntegration = dashboard.integrations.find(
197
- (i2) => i2.id === integrationId
198
- );
199
- if ((_a2 = currentIntegration == null ? void 0 : currentIntegration.integrationAccessRight) == null ? void 0 : _a2.slug) {
200
- treatedDashboard.slug = currentIntegration.integrationAccessRight.slug;
201
- }
202
- const users = dashboard.users.map((u2) => ({
203
- model: "User",
204
- id: u2.id,
205
- name: localize(u2.name, user.locale_id)
206
- }));
207
- const groups = dashboard.groups.map((g2) => ({
208
- model: "Group",
209
- id: g2.id,
210
- name: localize(g2.name, user.locale_id) || {}
211
- }));
212
- const integrations = dashboard.integrations.map((i2) => ({
213
- model: "Integration",
214
- id: i2.id,
215
- name: localize(i2.name, user.locale_id) || {}
216
- }));
217
- treatedDashboard.accessibleBy = [...users, ...groups, ...integrations];
218
- treatedDashboards.push(treatedDashboard);
219
- }
220
- return treatedDashboards;
221
- };
222
- const VERSION = "0.0.0-shared-luzmo";
223
- const sanitizeUrl = (url) => {
224
- const invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
225
- const ctrlCharactersRegex = /[^\u0020-\u007E]/gim;
226
- const urlSchemeRegex = /^([^:]+):/gm;
227
- const relativeFirstCharacters = /* @__PURE__ */ new Set([".", "/"]);
228
- const isRelativeUrlWithoutProtocol = (relativeUrl) => relativeFirstCharacters.has(relativeUrl[0]);
229
- if (!url) {
230
- return "about:blank";
231
- }
232
- const sanitizedUrl = url.replaceAll(ctrlCharactersRegex, "").trim();
233
- if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
234
- return sanitizedUrl;
235
- }
236
- const urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
237
- if (!urlSchemeParseResults) {
238
- return sanitizedUrl;
239
- }
240
- const urlScheme = urlSchemeParseResults[0];
241
- if (invalidPrototcolRegex.test(urlScheme)) {
242
- return "about:blank";
243
- }
244
- return sanitizedUrl;
245
- };
246
- const cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
247
- const isObject = (o2) => o2 && typeof o2 === "object";
248
- const defaultsDeep = (target, defaults) => {
249
- Object.entries(defaults).forEach(([k2, v2]) => {
250
- if (k2 in target) {
251
- if (target[k2] === void 0) {
252
- target[k2] = v2;
253
- } else {
254
- target[k2] = isObject(v2) ? defaultsDeep(
255
- target[k2],
256
- v2
257
- ) : target[k2];
258
- }
259
- } else {
260
- target[k2] = v2;
261
- }
262
- });
263
- return target;
264
- };
265
- const uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c2) {
266
- const r2 = Math.random() * 16 | 0;
267
- const v2 = c2 == "x" ? r2 : r2 & 3 | 8;
268
- return v2.toString(16);
269
- });
270
- const createIframeUrl = (dashboardContent) => {
271
- const searchString = [];
272
- const {
273
- appServer,
274
- language,
275
- qeVersion,
276
- loaderBackground,
277
- loaderSpinnerColor,
278
- loaderSpinnerBackground,
279
- loaderFontColor,
280
- screenMode,
281
- key,
282
- token,
283
- timezoneId,
284
- itemEmbedding,
285
- itemDimensions,
286
- dashboardId,
287
- dashboardSlug,
288
- itemId,
289
- mainColor,
290
- accentColor,
291
- editMode
292
- } = dashboardContent.params;
293
- if (language && language !== "auto") {
294
- searchString.push("language=" + language);
295
- }
296
- if (qeVersion) {
297
- searchString.push(`qe_version=${qeVersion}`);
298
- }
299
- if (loaderBackground) {
300
- searchString.push(`ldrbg=${loaderBackground}`);
301
- }
302
- if (loaderFontColor) {
303
- searchString.push(`ldrftclr=${loaderFontColor}`);
304
- }
305
- if (loaderSpinnerColor) {
306
- searchString.push(`ldrspclr=${loaderSpinnerColor}`);
307
- }
308
- if (loaderSpinnerBackground) {
309
- searchString.push(`ldrspbg=${loaderSpinnerBackground}`);
310
- }
311
- if (mainColor) {
312
- searchString.push(`mainColor=${mainColor}`);
313
- }
314
- if (accentColor) {
315
- searchString.push(`accentColor=${accentColor}`);
316
- }
317
- if (screenMode && screenMode !== "auto") {
318
- searchString.push("screenMode=" + screenMode);
319
- }
320
- if (timezoneId) {
321
- searchString.push("timezoneId=" + timezoneId);
322
- }
323
- if (itemEmbedding && itemDimensions && itemDimensions.width) {
324
- searchString.push("width=" + itemDimensions.width);
325
- }
326
- if (itemEmbedding && itemDimensions && itemDimensions.height) {
327
- searchString.push("height=" + itemDimensions.height);
328
- }
329
- if (editMode) {
330
- searchString.push("editMode=" + editMode);
331
- }
332
- const keyTokenUrlAnchor = key && token ? "#" + key + ":" + token : "";
333
- searchString.push("version=" + (dashboardContent.VERSION || VERSION));
334
- const iframeUrl = itemEmbedding ? `${appServer}i/${dashboardId || dashboardSlug}/${itemId}?${encodeURIComponent(
335
- searchString.join("&")
336
- )}${keyTokenUrlAnchor}` : `${appServer}i/${dashboardId || dashboardSlug}?${encodeURIComponent(
337
- searchString.join("&")
338
- )}${keyTokenUrlAnchor}`;
339
- return sanitizeUrl(iframeUrl);
340
- };
341
- const getLoader = (dashboardComponent) => {
342
- let errorMsg;
343
- if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
344
- dashboardComponent.params.error = true;
345
- if (dashboardComponent.browserNotSupported) {
346
- errorMsg = "Browser is not supported.";
347
- }
348
- }
349
- const loadingMsg = TRANSLATIONS.initializing[dashboardComponent.params.language] || TRANSLATIONS.initializing.en;
350
- return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
351
- };
352
- function resolvePromise(dashboardComponent, requestId, data) {
353
- if (dashboardComponent.promises[requestId]) {
354
- dashboardComponent.promises[requestId].resolve(data);
355
- delete dashboardComponent.promises[requestId];
356
- }
357
- }
358
- function rejectPromise(dashboardComponent, requestId, data) {
359
- if (dashboardComponent.promises[requestId]) {
360
- dashboardComponent.promises[requestId].reject(data);
361
- delete dashboardComponent.promises[requestId];
362
- }
363
- }
364
- function containerStyles(dashboardComponent) {
365
- const styles = {
366
- width: "100%",
367
- height: "100%"
368
- };
369
- if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
370
- styles.background = dashboardComponent.params.loaderBackground;
371
- }
372
- return styles;
373
- }
374
- function containerLoaderStyles(dashboardComponent) {
375
- var _a2;
376
- const height = ((_a2 = dashboardComponent.params.itemDimensions) == null ? void 0 : _a2.height) || DEFAULT_PARAMETERS.itemDimensions.height;
377
- const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
378
- const display = dashboardComponent.iframeLoaded ? "none" : "";
379
- return {
380
- display,
381
- height: `${chartHeightDefined ? height : dashboardComponent.minHeight}px`
382
- };
383
- }
384
- function loaderStyles(dashboardComponent) {
385
- var _a2, _b;
386
- const background = dashboardComponent.params.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
387
- if (dashboardComponent.params.itemEmbedding) {
388
- dashboardComponent.loaderSize = 24;
389
- dashboardComponent.borderWidth = 4;
390
- dashboardComponent.minHeight = 200;
391
- const width = ((_a2 = dashboardComponent.params.itemDimensions) == null ? void 0 : _a2.width) || DEFAULT_PARAMETERS.itemDimensions.width;
392
- const height = ((_b = dashboardComponent.params.itemDimensions) == null ? void 0 : _b.height) || DEFAULT_PARAMETERS.itemDimensions.height;
393
- const chartWidthDefined = width !== "auto";
394
- const chartHeightDefined = height !== "auto";
395
- return {
396
- background,
397
- width: chartWidthDefined ? `${width}px` : "100%",
398
- height: `${chartHeightDefined ? height : "200"}px`,
399
- "min-height": chartHeightDefined ? "" : "200px"
400
- };
401
- }
402
- return {
403
- background
404
- };
405
- }
406
- function plStyles(dashboardComponent) {
407
- const {
408
- loaderSpinnerColor: defaultSpinnerColor,
409
- loaderSpinnerBackground: defaultSpinnerBackground
410
- } = DEFAULT_PARAMETERS;
411
- const spinnerColorBorder = generateBorderStyle(
412
- dashboardComponent.borderWidth,
413
- dashboardComponent.params.loaderSpinnerColor || defaultSpinnerColor
414
- );
415
- const spinnerBackgroundBorder = generateBorderStyle(
416
- dashboardComponent.borderWidth,
417
- dashboardComponent.params.loaderSpinnerBackground || defaultSpinnerBackground
418
- );
419
- const size = `${dashboardComponent.loaderSize}px`;
420
- return {
421
- "border-top": spinnerColorBorder,
422
- "border-right": spinnerColorBorder,
423
- "border-bottom": spinnerBackgroundBorder,
424
- "border-left": spinnerBackgroundBorder,
425
- width: size,
426
- height: size
427
- };
428
- }
429
- function lcStyles(dashboardComponent) {
430
- var _a2;
431
- const height = ((_a2 = dashboardComponent.params.itemDimensions) == null ? void 0 : _a2.height) || DEFAULT_PARAMETERS.itemDimensions.height;
432
- const chartHeightDefined = dashboardComponent.params.itemEmbedding && height !== "auto";
433
- const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
434
- const verticalPadding = dashboardComponent.params.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
435
- return {
436
- padding: `${verticalPadding} 16px`
437
- };
438
- }
439
- function calculateIframeStyles(dashboardComponent) {
440
- var _a2, _b;
441
- const height = ((_a2 = dashboardComponent.params.itemDimensions) == null ? void 0 : _a2.height) || DEFAULT_PARAMETERS.itemDimensions.height;
442
- const width = ((_b = dashboardComponent.params.itemDimensions) == null ? void 0 : _b.width) || DEFAULT_PARAMETERS.itemDimensions.width;
443
- if (dashboardComponent.params.itemEmbedding && height !== "auto") {
444
- dashboardComponent.iframeHeight = `${height}px`;
445
- } else if (dashboardComponent.params.itemEmbedding) {
446
- dashboardComponent.iframeHeight = "200px";
447
- } else if (["editFull", "editLimited"].includes(dashboardComponent.params.editMode)) {
448
- dashboardComponent.iframeHeight = "100%";
449
- } else {
450
- dashboardComponent.iframeHeight = "400px";
451
- }
452
- dashboardComponent.iframeWidth = dashboardComponent.params.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
453
- const styles = {
454
- height: dashboardComponent.iframeHeight,
455
- width: dashboardComponent.iframeWidth
456
- };
457
- if (dashboardComponent.iframeLoaded) {
458
- styles.opacity = 1;
459
- } else if (dashboardComponent.error) {
460
- styles.opacity = 1;
461
- styles.width = "100%";
462
- styles.height = "400px";
463
- } else {
464
- styles.opacity = 0;
465
- }
466
- return styles;
467
- }
468
- function generateBorderStyle(borderWidth, color) {
469
- return `${borderWidth}px solid ${color}`;
470
- }
471
- const updateIframeUrl = (iframe, iframeUrl) => {
472
- if (iframe == null ? void 0 : iframe.contentWindow) {
473
- iframe.contentWindow.location.replace(iframeUrl);
474
- }
475
- };
476
- const remotesMap = {
477
- // "remote_app": { url: "http://localhost:4201/remoteEntry.mjs", format: "esm", from: "vite" },
478
- };
479
- const loadJS = async (url, fn) => {
480
- const resolvedUrl = typeof url === "function" ? await url() : url;
481
- const script = document.createElement("script");
482
- script.type = "text/javascript";
483
- script.onload = fn;
484
- script.src = resolvedUrl;
485
- document.getElementsByTagName("head")[0].appendChild(script);
486
- };
487
- const wrapShareModule = (remoteFrom) => {
488
- return {};
489
- };
490
- async function __federation_method_ensure(remoteId) {
491
- const remote = remotesMap[remoteId];
492
- if (!remote.inited) {
493
- if ("var" === remote.format) {
494
- return new Promise((resolve) => {
495
- const callback = () => {
496
- if (!remote.inited) {
497
- remote.lib = window[remoteId];
498
- remote.lib.init(wrapShareModule(remote.from));
499
- remote.inited = true;
500
- }
501
- resolve(remote.lib);
502
- };
503
- return loadJS(remote.url, callback);
504
- });
505
- } else if (["esm", "systemjs"].includes(remote.format)) {
506
- return new Promise((resolve, reject) => {
507
- const getUrl = typeof remote.url === "function" ? remote.url : () => Promise.resolve(remote.url);
508
- getUrl().then((url) => {
509
- import(
510
- /* @vite-ignore */
511
- url
512
- ).then((lib) => {
513
- if (!remote.inited) {
514
- const shareScope = wrapShareModule(remote.from);
515
- lib.init(shareScope);
516
- remote.lib = lib;
517
- remote.lib.init(shareScope);
518
- remote.inited = true;
519
- }
520
- resolve(remote.lib);
521
- }).catch(reject);
522
- });
523
- });
524
- }
525
- } else {
526
- return remote.lib;
527
- }
528
- }
529
- function __federation_method_wrapDefault(module2, need) {
530
- if (!(module2 == null ? void 0 : module2.default) && need) {
531
- let obj = /* @__PURE__ */ Object.create(null);
532
- obj.default = module2;
533
- obj.__esModule = true;
534
- return obj;
535
- }
536
- return module2;
537
- }
538
- function __federation_method_getRemote(remoteName, componentName) {
539
- return __federation_method_ensure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
540
- }
541
- const exportDashboard = (dashboardComponent, iframe, format) => {
542
- const requestId = uuidv4();
543
- if (iframe == null ? void 0 : iframe.contentWindow) {
544
- iframe.contentWindow.postMessage(
545
- {
546
- action: "exportDashboard",
547
- format: format || "png",
548
- _version: dashboardComponent.VERSION,
549
- requestId
550
- },
551
- "*"
552
- );
553
- return new Promise((resolve, reject) => {
554
- dashboardComponent.promises[requestId] = { resolve, reject };
555
- setTimeout(() => {
556
- if (dashboardComponent.promises[requestId]) {
557
- const errorMessage = "exportDashboard request timed out.";
558
- dashboardComponent.promises[requestId].reject(
559
- new Error(errorMessage)
560
- );
561
- delete dashboardComponent.promises[requestId];
562
- }
563
- }, 12e5);
564
- });
565
- }
566
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
567
- };
568
- const getAccessibleDashboards = (dashboardComponent, iframe) => {
569
- if ((dashboardComponent.dashboardId || dashboardComponent.dashboardSlug) && (iframe == null ? void 0 : iframe.contentWindow)) {
570
- const requestId = uuidv4();
571
- iframe.contentWindow.postMessage(
572
- {
573
- action: "getAccessibleDashboards",
574
- _version: dashboardComponent.VERSION,
575
- requestId
576
- },
577
- "*"
578
- );
579
- return new Promise((resolve, reject) => {
580
- dashboardComponent.promises[requestId] = { resolve, reject };
581
- setTimeout(() => {
582
- if (dashboardComponent.promises[requestId]) {
583
- const errorMessage = "getAccessibleDashboards request timed out.";
584
- dashboardComponent.promises[requestId].reject(
585
- new Error(errorMessage)
586
- );
587
- delete dashboardComponent.promises[requestId];
588
- }
589
- }, 2e3);
590
- });
591
- }
592
- const fetchUser = new Promise((resolve, reject) => {
593
- void (() => {
594
- try {
595
- const responsePromise = window.fetch(
596
- `${String(dashboardComponent.params.apiHost)}0.1.0/authorization`,
597
- {
598
- method: "POST",
599
- mode: "cors",
600
- cache: "no-cache",
601
- headers: { "Content-Type": "application/json" },
602
- redirect: "follow",
603
- body: JSON.stringify({
604
- action: "get",
605
- version: "0.1.0",
606
- key: dashboardComponent.authKey,
607
- token: dashboardComponent.authToken,
608
- find: {
609
- where: { id: dashboardComponent.authKey },
610
- attributes: ["id", "integration_id"],
611
- include: [
612
- {
613
- model: "User",
614
- attributes: ["id", "name", "locale_id"],
615
- include: [{ model: "Group" }]
616
- }
617
- ]
618
- }
619
- })
620
- }
621
- );
622
- responsePromise.then((response) => response.json()).then((data) => {
623
- if (!data || !data.rows || data.rows.length === 0 || !data.rows[0].user || !data.rows[0].integration_id) {
624
- reject();
625
- } else {
626
- data.rows[0].user.userGroups = data.rows[0].user.groups.map(
627
- (group) => group.id
628
- );
629
- delete data.rows[0].user.groups;
630
- resolve({
631
- integrationId: data.rows[0].integration_id,
632
- user: data.rows[0].user
633
- });
634
- }
635
- });
636
- } catch (error) {
637
- reject(error);
638
- }
639
- })();
640
- });
641
- return new Promise((resolve, reject) => void (() => {
642
- try {
643
- fetchUser.then((authorizationData) => {
644
- const responsePromise = window.fetch(
645
- `${String(dashboardComponent.params.apiHost)}0.1.0/securable`,
646
- {
647
- method: "POST",
648
- mode: "cors",
649
- cache: "no-cache",
650
- headers: { "Content-Type": "application/json" },
651
- redirect: "follow",
652
- body: JSON.stringify({
653
- action: "get",
654
- version: "0.1.0",
655
- key: dashboardComponent.authKey,
656
- token: dashboardComponent.authToken,
657
- find: {
658
- where: { type: "dashboard", is_variant: false },
659
- attributes: ["id", "name", "modified_at"],
660
- order: [["modified_at", "desc"]],
661
- include: [
662
- { model: "Tag", attributes: ["tag"] },
663
- { model: "User", attributes: ["id", "name"] },
664
- {
665
- model: "Group",
666
- attributes: ["id", "name", "public"]
667
- },
668
- { model: "Integration", attributes: ["id", "name"] }
669
- ]
670
- }
671
- })
672
- }
673
- );
674
- responsePromise.then((response) => response.json()).then((data) => {
675
- const dashboardList = data.rows.length > 0 ? formatDashboardList(
676
- data.rows,
677
- authorizationData.integrationId,
678
- authorizationData.user,
679
- dashboardComponent
680
- ) : [];
681
- resolve(dashboardList);
682
- });
683
- }).catch((error) => {
684
- reject(error);
685
- });
686
- } catch (error) {
687
- reject(error);
688
- }
689
- })());
690
- };
691
- const getData = (dashboardComponent, iframe, itemId) => {
692
- if (iframe == null ? void 0 : iframe.contentWindow) {
693
- const requestId = uuidv4();
694
- iframe.contentWindow.postMessage(
695
- {
696
- action: "getData",
697
- id: itemId,
698
- _version: dashboardComponent.VERSION,
699
- requestId
700
- },
701
- "*"
702
- );
703
- return new Promise((resolve, reject) => {
704
- dashboardComponent.promises[requestId] = { resolve, reject };
705
- setTimeout(() => {
706
- if (dashboardComponent.promises[requestId]) {
707
- const errorMessage = "getData request timed out.";
708
- dashboardComponent.promises[requestId].reject(
709
- new Error(errorMessage)
710
- );
711
- delete dashboardComponent.promises[requestId];
712
- }
713
- }, 2e3);
714
- });
715
- }
716
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
717
- };
718
- const getFilters = (dashboardComponent, iframe) => {
719
- if (iframe == null ? void 0 : iframe.contentWindow) {
720
- const requestId = uuidv4();
721
- iframe.contentWindow.postMessage(
722
- { action: "getFilters", _version: dashboardComponent.VERSION, requestId },
723
- "*"
724
- );
725
- return new Promise((resolve, reject) => {
726
- dashboardComponent.promises[requestId] = { resolve, reject };
727
- setTimeout(() => {
728
- if (dashboardComponent.promises[requestId]) {
729
- const errorMessage = "getFilters request timed out.";
730
- dashboardComponent.promises[requestId].reject(
731
- new Error(errorMessage)
732
- );
733
- delete dashboardComponent.promises[requestId];
734
- }
735
- }, 2e3);
736
- });
737
- }
738
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
739
- };
740
- const refreshData = (dashboardComponent, iframe, itemId) => {
741
- if (iframe) {
742
- iframe.contentWindow.postMessage(
743
- {
744
- action: "refreshData",
745
- id: itemId ?? null,
746
- _version: dashboardComponent.VERSION
747
- },
748
- "*"
749
- );
750
- return Promise.resolve();
751
- }
752
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
753
- };
754
- const reloadDashboard = (dashboardComponent, iframe) => {
755
- if (iframe) {
756
- iframe.contentWindow.postMessage(
757
- { action: "reloadDashboard", _version: dashboardComponent.VERSION },
758
- "*"
759
- );
760
- return Promise.resolve();
761
- }
762
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
763
- };
764
- const setAuthorization = (dashboardComponent, iframe, key, token) => {
765
- if (iframe) {
766
- iframe.contentWindow.postMessage(
767
- {
768
- action: "setAuthorization",
769
- key,
770
- token,
771
- _version: dashboardComponent.VERSION
772
- },
773
- "*"
774
- );
775
- return Promise.resolve();
776
- }
777
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
778
- };
779
- const setEditMode = (dashboardComponent, iframe, editMode) => {
780
- if (iframe && iframe.contentWindow) {
781
- const requestId = uuidv4();
782
- if (dashboardComponent.params.editMode === editMode) {
783
- return Promise.reject(
784
- new Error("editMode parameter is currently already set to " + editMode)
785
- );
786
- } else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
787
- return Promise.reject(
788
- new Error(
789
- "The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
790
- )
791
- );
792
- }
793
- iframe.contentWindow.postMessage(
794
- {
795
- action: "setEditMode",
796
- editMode,
797
- _version: dashboardComponent.VERSION,
798
- requestId
799
- },
800
- "*"
801
- );
802
- return new Promise((resolve, reject) => {
803
- dashboardComponent.promises[requestId] = { resolve, reject };
804
- });
805
- }
806
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
807
- };
808
- const setFilters = (dashboardComponent, iframe, itemId, filters) => {
809
- if (iframe) {
810
- const requestId = uuidv4();
811
- iframe.contentWindow.postMessage(
812
- {
813
- action: "setFilters",
814
- itemId,
815
- filters,
816
- _version: dashboardComponent.VERSION,
817
- requestId
818
- },
819
- "*"
820
- );
821
- return new Promise((resolve, reject) => {
822
- dashboardComponent.promises[requestId] = { resolve, reject };
823
- setTimeout(() => {
824
- if (dashboardComponent.promises[requestId]) {
825
- const errorMessage = "setFilters request timed out.";
826
- dashboardComponent.promises[requestId].reject(
827
- new Error(errorMessage)
828
- );
829
- delete dashboardComponent.promises[requestId];
830
- }
831
- }, 2e3);
832
- });
833
- }
834
- return Promise.reject();
835
- };
836
- const setPreview = (dashboardComponent, iframe, preview) => {
837
- if (iframe) {
838
- const requestId = uuidv4();
839
- iframe.contentWindow.postMessage(
840
- {
841
- action: "setPreview",
842
- preview,
843
- requestId,
844
- _version: dashboardComponent.VERSION
845
- },
846
- "*"
847
- );
848
- return new Promise((resolve, reject) => {
849
- dashboardComponent.promises[requestId] = { resolve, reject };
850
- setTimeout(() => {
851
- if (dashboardComponent.promises[requestId]) {
852
- const errorMessage = "setPreview request timed out.";
853
- dashboardComponent.promises[requestId].reject(
854
- new Error(errorMessage)
855
- );
856
- delete dashboardComponent.promises[requestId];
857
- }
858
- }, 2e3);
859
- });
860
- }
861
- return Promise.reject(new Error("Cannot retrieve contentWindow."));
862
- };
863
- const _setCalculatedDimensions = (dashboardComponent) => {
864
- var _a2, _b, _c, _d, _e, _f, _g, _h;
865
- if (!dashboardComponent.dimensions) {
866
- dashboardComponent.params.error = true;
867
- _handleError("Got no valid dimensions.", dashboardComponent.params);
868
- return;
869
- }
870
- const dashboardDimensionKeys = Object.keys(
871
- dashboardComponent.dimensions
872
- );
873
- const availableScreenModeExtents = [];
874
- let currentMode;
875
- let currentWidth = 0;
876
- let currentHeight = 0;
877
- if (!dashboardComponent.params.switchScreenModeOnResize && dashboardComponent.currentScreenMode) {
878
- dashboardComponent.params.screenMode = dashboardComponent.currentScreenMode;
879
- }
880
- if (dashboardComponent.dimensions && (dashboardDimensionKeys == null ? void 0 : dashboardDimensionKeys[0]) === "fixed") {
881
- currentMode = "fixed";
882
- currentWidth = dashboardComponent.dimensions.fixed[0];
883
- currentHeight = dashboardComponent.dimensions.fixed[1];
884
- } else {
885
- const screenModes = [
886
- "mobile",
887
- "tablet",
888
- "desktop",
889
- "largeScreen"
890
- ];
891
- if (dashboardComponent.params.itemEmbedding) {
892
- const [firstMatch] = dashboardDimensionKeys;
893
- let match = cloneDeep(firstMatch);
894
- for (const screenMode of screenModes) {
895
- const found = dashboardDimensionKeys.find((key) => key === screenMode);
896
- if (found) {
897
- match = cloneDeep(found);
898
- } else {
899
- dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
900
- }
901
- }
902
- }
903
- for (const key of dashboardDimensionKeys) {
904
- if (screenModes.includes(key)) {
905
- const screenMode = EXTENTS.find((extent) => extent.mode === key);
906
- availableScreenModeExtents.push({
907
- ...screenMode,
908
- height: dashboardComponent.dimensions[key][1] || 50
909
- });
910
- }
911
- }
912
- if (!availableScreenModeExtents.map((screenModeExtent) => screenModeExtent.mode).includes(dashboardComponent.params.screenMode)) {
913
- dashboardComponent.params.screenMode = "auto";
914
- }
915
- if (dashboardComponent.params.screenMode === "auto") {
916
- availableScreenModeExtents.sort(
917
- (a2, b2) => screenModes.indexOf(a2.mode) - screenModes.indexOf(b2.mode)
918
- );
919
- for (const screenModeExtent of availableScreenModeExtents) {
920
- const [screenModeExtentMinWidth, screenModeExtentMaxWidth] = screenModeExtent.width;
921
- if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
922
- if (screenModeExtentMinWidth < dashboardComponent.params.itemDimensions.width) {
923
- currentMode = screenModeExtent.mode;
924
- currentWidth = Number.parseInt(
925
- dashboardComponent.params.itemDimensions.width,
926
- 10
927
- );
928
- currentHeight = dashboardComponent.dimensions[currentMode][1];
929
- }
930
- } else {
931
- if (screenModeExtentMinWidth < dashboardComponent.containerWidth) {
932
- currentMode = screenModeExtent.mode;
933
- if (dashboardComponent.params.itemEmbedding) {
934
- currentWidth = ((_a2 = dashboardComponent.params.itemDimensions) == null ? void 0 : _a2.width) && ((_b = dashboardComponent.params.itemDimensions) == null ? void 0 : _b.width) !== "auto" ? Number.parseInt(
935
- dashboardComponent.params.itemDimensions.width,
936
- 10
937
- ) : Math.min(
938
- dashboardComponent.containerWidth,
939
- screenModeExtentMaxWidth
940
- );
941
- currentHeight = ((_c = dashboardComponent.params.itemDimensions) == null ? void 0 : _c.height) && ((_d = dashboardComponent.params.itemDimensions) == null ? void 0 : _d.height) !== "auto" ? Number.parseInt(
942
- dashboardComponent.params.itemDimensions.height,
943
- 10
944
- ) : dashboardComponent.dimensions[currentMode][1];
945
- if (dashboardComponent.params.itemDimensions && dashboardComponent.params.itemDimensions.width !== "auto" && dashboardComponent.params.itemDimensions.height === "auto") {
946
- currentWidth = Number.parseInt(
947
- dashboardComponent.params.itemDimensions.width,
948
- 10
949
- );
950
- currentHeight = dashboardComponent.dimensions[currentMode][1];
951
- }
952
- } else {
953
- currentWidth = Math.max(
954
- Math.min(
955
- screenModeExtentMaxWidth,
956
- dashboardComponent.containerWidth
957
- ),
958
- screenModeExtentMinWidth
959
- );
960
- currentHeight = screenModeExtent.height;
961
- }
962
- }
963
- }
964
- }
965
- } else {
966
- const {
967
- height: chosenModeHeight,
968
- width: [chosenModeMinWidth, chosenModeMaxWidth]
969
- } = availableScreenModeExtents.find(
970
- (d2) => d2.mode === dashboardComponent.params.screenMode
971
- );
972
- currentMode = dashboardComponent.params.screenMode;
973
- currentWidth = Math.max(
974
- Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
975
- chosenModeMinWidth
976
- );
977
- currentHeight = chosenModeHeight;
978
- if (dashboardComponent.params.itemEmbedding) {
979
- if (((_e = dashboardComponent.params.itemDimensions) == null ? void 0 : _e.width) && ((_f = dashboardComponent.params.itemDimensions) == null ? void 0 : _f.width) !== "auto") {
980
- currentWidth = Number.parseInt(
981
- dashboardComponent.params.itemDimensions.width,
982
- 10
983
- );
984
- }
985
- if (((_g = dashboardComponent.params.itemDimensions) == null ? void 0 : _g.height) && ((_h = dashboardComponent.params.itemDimensions) == null ? void 0 : _h.height) !== "auto") {
986
- currentHeight = Number.parseInt(
987
- dashboardComponent.params.itemDimensions.height,
988
- 10
989
- );
990
- }
991
- }
992
- }
993
- if (!currentMode && availableScreenModeExtents.length > 0) {
994
- const [lowestModeExtent] = availableScreenModeExtents;
995
- currentMode = lowestModeExtent.mode;
996
- currentWidth = lowestModeExtent.width[0];
997
- currentHeight = lowestModeExtent.height;
998
- }
999
- }
1000
- dashboardComponent.currentScreenMode = currentMode;
1001
- const style = {
1002
- height: currentHeight === 0 ? "100%" : `${String(currentHeight)}px`,
1003
- width: currentWidth === 0 ? "100%" : `${String(currentWidth)}px`,
1004
- opacity: 1
1005
- };
1006
- const dashboardEditModes = ["editFull", "editLimited"];
1007
- if (dashboardEditModes.includes(dashboardComponent.params.editMode)) {
1008
- style.height = "100%";
1009
- style.width = "100%";
1010
- } else if (dashboardComponent.params.itemEmbedding && dashboardComponent.params.itemDimensions) {
1011
- style.height = dashboardComponent.params.itemDimensions.height === "auto" ? style.height : `${String(dashboardComponent.params.itemDimensions.height).replace(
1012
- "px",
1013
- ""
1014
- )}px`;
1015
- style.width = dashboardComponent.params.itemDimensions.width === "auto" ? style.width : `${String(dashboardComponent.params.itemDimensions.width).replace(
1016
- "px",
1017
- ""
1018
- )}px`;
1019
- } else {
1020
- style.height = currentHeight === 0 ? "100%" : `${String(currentHeight)}px`;
1021
- style.width = currentWidth === 0 ? "100%" : `${String(currentWidth)}px`;
1022
- }
1023
- dashboardComponent.currentScreenMode = currentMode;
1024
- dashboardComponent.iframeStyle = style;
1025
- };
1026
- const _extendAndValidate = (dashboardContent) => {
1027
- const defaultKeys = Object.keys(
1028
- DEFAULT_PARAMETERS
1029
- );
1030
- const errorMessages = [];
1031
- const requiredStringParams = [
1032
- "appServer",
1033
- "language",
1034
- "apiHost"
1035
- ];
1036
- const requiredStringOrEmptyParams = [
1037
- "key",
1038
- "token",
1039
- "screenMode",
1040
- "timezoneId",
1041
- "itemId",
1042
- "container",
1043
- "loaderBackground",
1044
- "loaderFontColor",
1045
- "loaderSpinnerColor",
1046
- "loaderSpinnerBackground"
1047
- ];
1048
- const objectParams = ["itemDimensions"];
1049
- const screenModes = [
1050
- "mobile",
1051
- "tablet",
1052
- "desktop",
1053
- "largeScreen",
1054
- "fixed",
1055
- "auto"
1056
- ];
1057
- for (const key of defaultKeys) {
1058
- if (dashboardContent.params[key] === null) {
1059
- delete dashboardContent.params[key];
1060
- }
1061
- }
1062
- dashboardContent.params = defaultsDeep(
1063
- dashboardContent.params,
1064
- DEFAULT_PARAMETERS
1065
- );
1066
- if ((!dashboardContent.params.dashboardId || typeof dashboardContent.params.dashboardId !== "string") && (!dashboardContent.params.dashboardSlug || typeof dashboardContent.params.dashboardSlug !== "string")) {
1067
- delete dashboardContent.params.dashboardId;
1068
- delete dashboardContent.params.dashboardSlug;
1069
- }
1070
- for (const key of requiredStringParams) {
1071
- if (typeof dashboardContent.params[key] !== "string") {
1072
- delete dashboardContent.params[key];
1073
- errorMessages.push(`${key} needs to be of type string.`);
1074
- }
1075
- }
1076
- for (const key of requiredStringOrEmptyParams) {
1077
- if (typeof dashboardContent.params[key] !== "string" && dashboardContent.params[key] !== null && dashboardContent.params[key] !== void 0) {
1078
- delete dashboardContent.params[key];
1079
- errorMessages.push(`${key} needs to be of type string or empty.`);
1080
- }
1081
- }
1082
- if (dashboardContent.params.screenMode && !screenModes.includes(dashboardContent.params.screenMode)) {
1083
- const validTypesString = screenModes.map((mode) => `"${mode}"`).join(", ");
1084
- errorMessages.push(
1085
- `"screenMode" needs should be one of these types: ${validTypesString}`
1086
- );
1087
- dashboardContent.params.screenMode = "auto";
1088
- }
1089
- if (dashboardContent.params.itemId) {
1090
- dashboardContent.params.itemEmbedding = true;
1091
- }
1092
- for (const key of objectParams) {
1093
- if (typeof dashboardContent.params[key] !== "object" && dashboardContent.params[key] !== null) {
1094
- delete dashboardContent.params[key];
1095
- errorMessages.push(`${key} needs to be of type object or empty.`);
1096
- }
1097
- }
1098
- if (typeof dashboardContent.params.switchScreenModeOnResize !== "boolean") {
1099
- errorMessages.push("switchScreenModeOnResize needs to be of type boolean.");
1100
- dashboardContent.params.switchScreenModeOnResize = true;
1101
- }
1102
- if (dashboardContent.params.itemDimensions) {
1103
- const itemDimensionsKeys = [
1104
- "width",
1105
- "height"
1106
- ];
1107
- for (const key of itemDimensionsKeys) {
1108
- if (!["string", "number"].includes(
1109
- typeof dashboardContent.params.itemDimensions[key]
1110
- ) && dashboardContent.params.itemDimensions[key] !== null) {
1111
- errorMessages.push(
1112
- `itemDimensions ${key} needs to be of type string, number or empty.`
1113
- );
1114
- }
1115
- }
1116
- }
1117
- dashboardContent.params = defaultsDeep(
1118
- dashboardContent.params,
1119
- DEFAULT_PARAMETERS
1120
- );
1121
- if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
1122
- dashboardContent.params.switchScreenModeOnResize = false;
1123
- }
1124
- if (dashboardContent.params.itemDimensions.width !== "auto") {
1125
- dashboardContent.params.itemDimensions.width = Number.parseInt(
1126
- `${dashboardContent.params.itemDimensions.width}`.replace("px", ""),
1127
- 10
1128
- ) || "auto";
1129
- }
1130
- if (dashboardContent.params.itemDimensions.height !== "auto") {
1131
- dashboardContent.params.itemDimensions.height = Number.parseInt(
1132
- `${dashboardContent.params.itemDimensions.height}`.replace("px", ""),
1133
- 10
1134
- ) || "auto";
1135
- }
1136
- dashboardContent.params.itemEmbedding = !!dashboardContent.params.itemId;
1137
- if (dashboardContent.params.error || errorMessages.length > 0) {
1138
- _handleError(errorMessages.join("\n"), dashboardContent.params);
1139
- }
1140
- };
1141
- /**
1142
- * @license
1143
- * Copyright 2019 Google LLC
1144
- * SPDX-License-Identifier: BSD-3-Clause
1145
- */
1146
- 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();
1147
- let n$4 = class n {
1148
- constructor(t2, e2, o2) {
1149
- if (this._$cssResult$ = true, o2 !== s$2)
1150
- throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
1151
- this.cssText = t2, this.t = e2;
1152
- }
1153
- get styleSheet() {
1154
- let t2 = this.o;
1155
- const s2 = this.t;
1156
- if (e$5 && void 0 === t2) {
1157
- const e2 = void 0 !== s2 && 1 === s2.length;
1158
- e2 && (t2 = o$4.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$4.set(s2, t2));
1159
- }
1160
- return t2;
1161
- }
1162
- toString() {
1163
- return this.cssText;
1164
- }
1165
- };
1166
- const r$5 = (t2) => new n$4("string" == typeof t2 ? t2 : t2 + "", void 0, s$2), i$4 = (t2, ...e2) => {
1167
- const o2 = 1 === t2.length ? t2[0] : e2.reduce((e3, s2, o3) => e3 + ((t3) => {
1168
- if (true === t3._$cssResult$)
1169
- return t3.cssText;
1170
- if ("number" == typeof t3)
1171
- return t3;
1172
- 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.");
1173
- })(s2) + t2[o3 + 1], t2[0]);
1174
- return new n$4(o2, t2, s$2);
1175
- }, S$1 = (s2, o2) => {
1176
- if (e$5)
1177
- s2.adoptedStyleSheets = o2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet);
1178
- else
1179
- for (const e2 of o2) {
1180
- const o3 = document.createElement("style"), n2 = t$3.litNonce;
1181
- void 0 !== n2 && o3.setAttribute("nonce", n2), o3.textContent = e2.cssText, s2.appendChild(o3);
1182
- }
1183
- }, c$2 = e$5 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
1184
- let e2 = "";
1185
- for (const s2 of t3.cssRules)
1186
- e2 += s2.cssText;
1187
- return r$5(e2);
1188
- })(t2) : t2;
1189
- /**
1190
- * @license
1191
- * Copyright 2017 Google LLC
1192
- * SPDX-License-Identifier: BSD-3-Clause
1193
- */
1194
- 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) {
1195
- switch (s2) {
1196
- case Boolean:
1197
- t2 = t2 ? l$1 : null;
1198
- break;
1199
- case Object:
1200
- case Array:
1201
- t2 = null == t2 ? t2 : JSON.stringify(t2);
1202
- }
1203
- return t2;
1204
- }, fromAttribute(t2, s2) {
1205
- let i2 = t2;
1206
- switch (s2) {
1207
- case Boolean:
1208
- i2 = null !== t2;
1209
- break;
1210
- case Number:
1211
- i2 = null === t2 ? null : Number(t2);
1212
- break;
1213
- case Object:
1214
- case Array:
1215
- try {
1216
- i2 = JSON.parse(t2);
1217
- } catch (t3) {
1218
- i2 = null;
1219
- }
1220
- }
1221
- return i2;
1222
- } }, f$1 = (t2, s2) => !i$3(t2, s2), y$1 = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$1 };
1223
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), a$1.litPropertyMetadata ?? (a$1.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
1224
- class b extends HTMLElement {
1225
- static addInitializer(t2) {
1226
- this._$Ei(), (this.l ?? (this.l = [])).push(t2);
1227
- }
1228
- static get observedAttributes() {
1229
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
1230
- }
1231
- static createProperty(t2, s2 = y$1) {
1232
- if (s2.state && (s2.attribute = false), this._$Ei(), this.elementProperties.set(t2, s2), !s2.noAccessor) {
1233
- const i2 = Symbol(), r2 = this.getPropertyDescriptor(t2, i2, s2);
1234
- void 0 !== r2 && e$4(this.prototype, t2, r2);
1235
- }
1236
- }
1237
- static getPropertyDescriptor(t2, s2, i2) {
1238
- const { get: e2, set: h2 } = r$4(this.prototype, t2) ?? { get() {
1239
- return this[s2];
1240
- }, set(t3) {
1241
- this[s2] = t3;
1242
- } };
1243
- return { get() {
1244
- return e2 == null ? void 0 : e2.call(this);
1245
- }, set(s3) {
1246
- const r2 = e2 == null ? void 0 : e2.call(this);
1247
- h2.call(this, s3), this.requestUpdate(t2, r2, i2);
1248
- }, configurable: true, enumerable: true };
1249
- }
1250
- static getPropertyOptions(t2) {
1251
- return this.elementProperties.get(t2) ?? y$1;
1252
- }
1253
- static _$Ei() {
1254
- if (this.hasOwnProperty(d$1("elementProperties")))
1255
- return;
1256
- const t2 = n$3(this);
1257
- t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties);
1258
- }
1259
- static finalize() {
1260
- if (this.hasOwnProperty(d$1("finalized")))
1261
- return;
1262
- if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
1263
- const t3 = this.properties, s2 = [...h$1(t3), ...o$3(t3)];
1264
- for (const i2 of s2)
1265
- this.createProperty(i2, t3[i2]);
1266
- }
1267
- const t2 = this[Symbol.metadata];
1268
- if (null !== t2) {
1269
- const s2 = litPropertyMetadata.get(t2);
1270
- if (void 0 !== s2)
1271
- for (const [t3, i2] of s2)
1272
- this.elementProperties.set(t3, i2);
1273
- }
1274
- this._$Eh = /* @__PURE__ */ new Map();
1275
- for (const [t3, s2] of this.elementProperties) {
1276
- const i2 = this._$Eu(t3, s2);
1277
- void 0 !== i2 && this._$Eh.set(i2, t3);
1278
- }
1279
- this.elementStyles = this.finalizeStyles(this.styles);
1280
- }
1281
- static finalizeStyles(s2) {
1282
- const i2 = [];
1283
- if (Array.isArray(s2)) {
1284
- const e2 = new Set(s2.flat(1 / 0).reverse());
1285
- for (const s3 of e2)
1286
- i2.unshift(c$2(s3));
1287
- } else
1288
- void 0 !== s2 && i2.push(c$2(s2));
1289
- return i2;
1290
- }
1291
- static _$Eu(t2, s2) {
1292
- const i2 = s2.attribute;
1293
- return false === i2 ? void 0 : "string" == typeof i2 ? i2 : "string" == typeof t2 ? t2.toLowerCase() : void 0;
1294
- }
1295
- constructor() {
1296
- super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
1297
- }
1298
- _$Ev() {
1299
- var _a2;
1300
- 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));
1301
- }
1302
- addController(t2) {
1303
- var _a2;
1304
- (this._$E_ ?? (this._$E_ = /* @__PURE__ */ new Set())).add(t2), void 0 !== this.renderRoot && this.isConnected && ((_a2 = t2.hostConnected) == null ? void 0 : _a2.call(t2));
1305
- }
1306
- removeController(t2) {
1307
- var _a2;
1308
- (_a2 = this._$E_) == null ? void 0 : _a2.delete(t2);
1309
- }
1310
- _$ES() {
1311
- const t2 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties;
1312
- for (const i2 of s2.keys())
1313
- this.hasOwnProperty(i2) && (t2.set(i2, this[i2]), delete this[i2]);
1314
- t2.size > 0 && (this._$Ep = t2);
1315
- }
1316
- createRenderRoot() {
1317
- const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
1318
- return S$1(t2, this.constructor.elementStyles), t2;
1319
- }
1320
- connectedCallback() {
1321
- var _a2;
1322
- this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(true), (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t2) => {
1323
- var _a3;
1324
- return (_a3 = t2.hostConnected) == null ? void 0 : _a3.call(t2);
1325
- });
1326
- }
1327
- enableUpdating(t2) {
1328
- }
1329
- disconnectedCallback() {
1330
- var _a2;
1331
- (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t2) => {
1332
- var _a3;
1333
- return (_a3 = t2.hostDisconnected) == null ? void 0 : _a3.call(t2);
1334
- });
1335
- }
1336
- attributeChangedCallback(t2, s2, i2) {
1337
- this._$AK(t2, i2);
1338
- }
1339
- _$EO(t2, s2) {
1340
- var _a2;
1341
- const i2 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i2);
1342
- if (void 0 !== e2 && true === i2.reflect) {
1343
- const r2 = (void 0 !== ((_a2 = i2.converter) == null ? void 0 : _a2.toAttribute) ? i2.converter : u$1).toAttribute(s2, i2.type);
1344
- this._$Em = t2, null == r2 ? this.removeAttribute(e2) : this.setAttribute(e2, r2), this._$Em = null;
1345
- }
1346
- }
1347
- _$AK(t2, s2) {
1348
- var _a2;
1349
- const i2 = this.constructor, e2 = i2._$Eh.get(t2);
1350
- if (void 0 !== e2 && this._$Em !== e2) {
1351
- const t3 = i2.getPropertyOptions(e2), r2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== ((_a2 = t3.converter) == null ? void 0 : _a2.fromAttribute) ? t3.converter : u$1;
1352
- this._$Em = e2, this[e2] = r2.fromAttribute(s2, t3.type), this._$Em = null;
1353
- }
1354
- }
1355
- requestUpdate(t2, s2, i2, e2 = false, r2) {
1356
- if (void 0 !== t2) {
1357
- if (i2 ?? (i2 = this.constructor.getPropertyOptions(t2)), !(i2.hasChanged ?? f$1)(e2 ? r2 : this[t2], s2))
1358
- return;
1359
- this.C(t2, s2, i2);
1360
- }
1361
- false === this.isUpdatePending && (this._$Eg = this._$EP());
1362
- }
1363
- C(t2, s2, i2) {
1364
- this._$AL.has(t2) || this._$AL.set(t2, s2), true === i2.reflect && this._$Em !== t2 && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(t2);
1365
- }
1366
- async _$EP() {
1367
- this.isUpdatePending = true;
1368
- try {
1369
- await this._$Eg;
1370
- } catch (t3) {
1371
- Promise.reject(t3);
1372
- }
1373
- const t2 = this.scheduleUpdate();
1374
- return null != t2 && await t2, !this.isUpdatePending;
1375
- }
1376
- scheduleUpdate() {
1377
- return this.performUpdate();
1378
- }
1379
- performUpdate() {
1380
- var _a2;
1381
- if (!this.isUpdatePending)
1382
- return;
1383
- if (!this.hasUpdated) {
1384
- if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
1385
- for (const [t4, s3] of this._$Ep)
1386
- this[t4] = s3;
1387
- this._$Ep = void 0;
1388
- }
1389
- const t3 = this.constructor.elementProperties;
1390
- if (t3.size > 0)
1391
- for (const [s3, i2] of t3)
1392
- true !== i2.wrapped || this._$AL.has(s3) || void 0 === this[s3] || this.C(s3, this[s3], i2);
1393
- }
1394
- let t2 = false;
1395
- const s2 = this._$AL;
1396
- try {
1397
- t2 = this.shouldUpdate(s2), t2 ? (this.willUpdate(s2), (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t3) => {
1398
- var _a3;
1399
- return (_a3 = t3.hostUpdate) == null ? void 0 : _a3.call(t3);
1400
- }), this.update(s2)) : this._$ET();
1401
- } catch (s3) {
1402
- throw t2 = false, this._$ET(), s3;
1403
- }
1404
- t2 && this._$AE(s2);
1405
- }
1406
- willUpdate(t2) {
1407
- }
1408
- _$AE(t2) {
1409
- var _a2;
1410
- (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t3) => {
1411
- var _a3;
1412
- return (_a3 = t3.hostUpdated) == null ? void 0 : _a3.call(t3);
1413
- }), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t2)), this.updated(t2);
1414
- }
1415
- _$ET() {
1416
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
1417
- }
1418
- get updateComplete() {
1419
- return this.getUpdateComplete();
1420
- }
1421
- getUpdateComplete() {
1422
- return this._$Eg;
1423
- }
1424
- shouldUpdate(t2) {
1425
- return true;
1426
- }
1427
- update(t2) {
1428
- this._$Ej && (this._$Ej = this._$Ej.forEach((t3) => this._$EO(t3, this[t3]))), this._$ET();
1429
- }
1430
- updated(t2) {
1431
- }
1432
- firstUpdated(t2) {
1433
- }
1434
- }
1435
- 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.2");
1436
- /**
1437
- * @license
1438
- * Copyright 2017 Google LLC
1439
- * SPDX-License-Identifier: BSD-3-Clause
1440
- */
1441
- 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}*(?:[^
1442
- \f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y = (t2) => (i2, ...s2) => ({ _$litType$: t2, strings: i2, 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);
1443
- function C(t2, i2) {
1444
- if (!Array.isArray(t2) || !t2.hasOwnProperty("raw"))
1445
- throw Error("invalid template strings array");
1446
- return void 0 !== s$1 ? s$1.createHTML(i2) : i2;
1447
- }
1448
- const P = (t2, i2) => {
1449
- const s2 = t2.length - 1, o2 = [];
1450
- let r2, l2 = 2 === i2 ? "<svg>" : "", c2 = f;
1451
- for (let i3 = 0; i3 < s2; i3++) {
1452
- const s3 = t2[i3];
1453
- let a2, u2, d2 = -1, y2 = 0;
1454
- for (; y2 < s3.length && (c2.lastIndex = y2, u2 = c2.exec(s3), null !== u2); )
1455
- 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);
1456
- const x2 = c2 === m && t2[i3 + 1].startsWith("/>") ? " " : "";
1457
- 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 ? i3 : x2);
1458
- }
1459
- return [C(t2, l2 + (t2[s2] || "<?>") + (2 === i2 ? "</svg>" : "")), o2];
1460
- };
1461
- class V {
1462
- constructor({ strings: t2, _$litType$: s2 }, n2) {
1463
- let r2;
1464
- this.parts = [];
1465
- let c2 = 0, a2 = 0;
1466
- const u2 = t2.length - 1, d2 = this.parts, [f2, v2] = P(t2, s2);
1467
- if (this.el = V.createElement(f2, n2), E.currentNode = this.el.content, 2 === s2) {
1468
- const t3 = this.el.content.firstChild;
1469
- t3.replaceWith(...t3.childNodes);
1470
- }
1471
- for (; null !== (r2 = E.nextNode()) && d2.length < u2; ) {
1472
- if (1 === r2.nodeType) {
1473
- if (r2.hasAttributes())
1474
- for (const t3 of r2.getAttributeNames())
1475
- if (t3.endsWith(e$3)) {
1476
- const i2 = v2[a2++], s3 = r2.getAttribute(t3).split(h), e2 = /([.?@])?(.*)/.exec(i2);
1477
- 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);
1478
- } else
1479
- t3.startsWith(h) && (d2.push({ type: 6, index: c2 }), r2.removeAttribute(t3));
1480
- if ($.test(r2.tagName)) {
1481
- const t3 = r2.textContent.split(h), s3 = t3.length - 1;
1482
- if (s3 > 0) {
1483
- r2.textContent = i$2 ? i$2.emptyScript : "";
1484
- for (let i2 = 0; i2 < s3; i2++)
1485
- r2.append(t3[i2], l()), E.nextNode(), d2.push({ type: 2, index: ++c2 });
1486
- r2.append(t3[s3], l());
1487
- }
1488
- }
1489
- } else if (8 === r2.nodeType)
1490
- if (r2.data === o$2)
1491
- d2.push({ type: 2, index: c2 });
1492
- else {
1493
- let t3 = -1;
1494
- for (; -1 !== (t3 = r2.data.indexOf(h, t3 + 1)); )
1495
- d2.push({ type: 7, index: c2 }), t3 += h.length - 1;
1496
- }
1497
- c2++;
1498
- }
1499
- }
1500
- static createElement(t2, i2) {
1501
- const s2 = r$3.createElement("template");
1502
- return s2.innerHTML = t2, s2;
1503
- }
1504
- }
1505
- function N(t2, i2, s2 = t2, e2) {
1506
- var _a2, _b;
1507
- if (i2 === w)
1508
- return i2;
1509
- let h2 = void 0 !== e2 ? (_a2 = s2._$Co) == null ? void 0 : _a2[e2] : s2._$Cl;
1510
- const o2 = c(i2) ? void 0 : i2._$litDirective$;
1511
- 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 && (i2 = N(t2, h2._$AS(t2, i2.values), h2, e2)), i2;
1512
- }
1513
- class S {
1514
- constructor(t2, i2) {
1515
- this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i2;
1516
- }
1517
- get parentNode() {
1518
- return this._$AM.parentNode;
1519
- }
1520
- get _$AU() {
1521
- return this._$AM._$AU;
1522
- }
1523
- u(t2) {
1524
- const { el: { content: i2 }, parts: s2 } = this._$AD, e2 = ((t2 == null ? void 0 : t2.creationScope) ?? r$3).importNode(i2, true);
1525
- E.currentNode = e2;
1526
- let h2 = E.nextNode(), o2 = 0, n2 = 0, l2 = s2[0];
1527
- for (; void 0 !== l2; ) {
1528
- if (o2 === l2.index) {
1529
- let i3;
1530
- 2 === l2.type ? i3 = new M(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i3 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i3 = new L(h2, this, t2)), this._$AV.push(i3), l2 = s2[++n2];
1531
- }
1532
- o2 !== (l2 == null ? void 0 : l2.index) && (h2 = E.nextNode(), o2++);
1533
- }
1534
- return E.currentNode = r$3, e2;
1535
- }
1536
- p(t2) {
1537
- let i2 = 0;
1538
- for (const s2 of this._$AV)
1539
- void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i2), i2 += s2.strings.length - 2) : s2._$AI(t2[i2])), i2++;
1540
- }
1541
- }
1542
- class M {
1543
- get _$AU() {
1544
- var _a2;
1545
- return ((_a2 = this._$AM) == null ? void 0 : _a2._$AU) ?? this._$Cv;
1546
- }
1547
- constructor(t2, i2, s2, e2) {
1548
- this.type = 2, this._$AH = T, this._$AN = void 0, this._$AA = t2, this._$AB = i2, this._$AM = s2, this.options = e2, this._$Cv = (e2 == null ? void 0 : e2.isConnected) ?? true;
1549
- }
1550
- get parentNode() {
1551
- let t2 = this._$AA.parentNode;
1552
- const i2 = this._$AM;
1553
- return void 0 !== i2 && 11 === (t2 == null ? void 0 : t2.nodeType) && (t2 = i2.parentNode), t2;
1554
- }
1555
- get startNode() {
1556
- return this._$AA;
1557
- }
1558
- get endNode() {
1559
- return this._$AB;
1560
- }
1561
- _$AI(t2, i2 = this) {
1562
- t2 = N(this, t2, i2), 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);
1563
- }
1564
- k(t2) {
1565
- return this._$AA.parentNode.insertBefore(t2, this._$AB);
1566
- }
1567
- $(t2) {
1568
- this._$AH !== t2 && (this._$AR(), this._$AH = this.k(t2));
1569
- }
1570
- _(t2) {
1571
- this._$AH !== T && c(this._$AH) ? this._$AA.nextSibling.data = t2 : this.$(r$3.createTextNode(t2)), this._$AH = t2;
1572
- }
1573
- g(t2) {
1574
- var _a2;
1575
- const { values: i2, _$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);
1576
- if (((_a2 = this._$AH) == null ? void 0 : _a2._$AD) === e2)
1577
- this._$AH.p(i2);
1578
- else {
1579
- const t3 = new S(e2, this), s3 = t3.u(this.options);
1580
- t3.p(i2), this.$(s3), this._$AH = t3;
1581
- }
1582
- }
1583
- _$AC(t2) {
1584
- let i2 = A.get(t2.strings);
1585
- return void 0 === i2 && A.set(t2.strings, i2 = new V(t2)), i2;
1586
- }
1587
- T(t2) {
1588
- a(this._$AH) || (this._$AH = [], this._$AR());
1589
- const i2 = this._$AH;
1590
- let s2, e2 = 0;
1591
- for (const h2 of t2)
1592
- e2 === i2.length ? i2.push(s2 = new M(this.k(l()), this.k(l()), this, this.options)) : s2 = i2[e2], s2._$AI(h2), e2++;
1593
- e2 < i2.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i2.length = e2);
1594
- }
1595
- _$AR(t2 = this._$AA.nextSibling, i2) {
1596
- var _a2;
1597
- for ((_a2 = this._$AP) == null ? void 0 : _a2.call(this, false, true, i2); t2 && t2 !== this._$AB; ) {
1598
- const i3 = t2.nextSibling;
1599
- t2.remove(), t2 = i3;
1600
- }
1601
- }
1602
- setConnected(t2) {
1603
- var _a2;
1604
- void 0 === this._$AM && (this._$Cv = t2, (_a2 = this._$AP) == null ? void 0 : _a2.call(this, t2));
1605
- }
1606
- }
1607
- class R {
1608
- get tagName() {
1609
- return this.element.tagName;
1610
- }
1611
- get _$AU() {
1612
- return this._$AM._$AU;
1613
- }
1614
- constructor(t2, i2, s2, e2, h2) {
1615
- this.type = 1, this._$AH = T, this._$AN = void 0, this.element = t2, this.name = i2, 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;
1616
- }
1617
- _$AI(t2, i2 = this, s2, e2) {
1618
- const h2 = this.strings;
1619
- let o2 = false;
1620
- if (void 0 === h2)
1621
- t2 = N(this, t2, i2, 0), o2 = !c(t2) || t2 !== this._$AH && t2 !== w, o2 && (this._$AH = t2);
1622
- else {
1623
- const e3 = t2;
1624
- let n2, r2;
1625
- for (t2 = h2[0], n2 = 0; n2 < h2.length - 1; n2++)
1626
- r2 = N(this, e3[s2 + n2], i2, n2), r2 === w && (r2 = this._$AH[n2]), o2 || (o2 = !c(r2) || r2 !== this._$AH[n2]), r2 === T ? t2 = T : t2 !== T && (t2 += (r2 ?? "") + h2[n2 + 1]), this._$AH[n2] = r2;
1627
- }
1628
- o2 && !e2 && this.O(t2);
1629
- }
1630
- O(t2) {
1631
- t2 === T ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? "");
1632
- }
1633
- }
1634
- class k extends R {
1635
- constructor() {
1636
- super(...arguments), this.type = 3;
1637
- }
1638
- O(t2) {
1639
- this.element[this.name] = t2 === T ? void 0 : t2;
1640
- }
1641
- }
1642
- class H extends R {
1643
- constructor() {
1644
- super(...arguments), this.type = 4;
1645
- }
1646
- O(t2) {
1647
- this.element.toggleAttribute(this.name, !!t2 && t2 !== T);
1648
- }
1649
- }
1650
- class I extends R {
1651
- constructor(t2, i2, s2, e2, h2) {
1652
- super(t2, i2, s2, e2, h2), this.type = 5;
1653
- }
1654
- _$AI(t2, i2 = this) {
1655
- if ((t2 = N(this, t2, i2, 0) ?? T) === w)
1656
- return;
1657
- 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);
1658
- e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
1659
- }
1660
- handleEvent(t2) {
1661
- var _a2;
1662
- "function" == typeof this._$AH ? this._$AH.call(((_a2 = this.options) == null ? void 0 : _a2.host) ?? this.element, t2) : this._$AH.handleEvent(t2);
1663
- }
1664
- }
1665
- class L {
1666
- constructor(t2, i2, s2) {
1667
- this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i2, this.options = s2;
1668
- }
1669
- get _$AU() {
1670
- return this._$AM._$AU;
1671
- }
1672
- _$AI(t2) {
1673
- N(this, t2);
1674
- }
1675
- }
1676
- const Z = t$2.litHtmlPolyfillSupport;
1677
- Z == null ? void 0 : Z(V, M), (t$2.litHtmlVersions ?? (t$2.litHtmlVersions = [])).push("3.1.0");
1678
- const j = (t2, i2, s2) => {
1679
- const e2 = (s2 == null ? void 0 : s2.renderBefore) ?? i2;
1680
- let h2 = e2._$litPart$;
1681
- if (void 0 === h2) {
1682
- const t3 = (s2 == null ? void 0 : s2.renderBefore) ?? null;
1683
- e2._$litPart$ = h2 = new M(i2.insertBefore(l(), t3), t3, void 0, s2 ?? {});
1684
- }
1685
- return h2._$AI(t2), h2;
1686
- };
1687
- /**
1688
- * @license
1689
- * Copyright 2017 Google LLC
1690
- * SPDX-License-Identifier: BSD-3-Clause
1691
- */
1692
- class s extends b {
1693
- constructor() {
1694
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
1695
- }
1696
- createRenderRoot() {
1697
- var _a2;
1698
- const t2 = super.createRenderRoot();
1699
- return (_a2 = this.renderOptions).renderBefore ?? (_a2.renderBefore = t2.firstChild), t2;
1700
- }
1701
- update(t2) {
1702
- const i2 = this.render();
1703
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t2), this._$Do = j(i2, this.renderRoot, this.renderOptions);
1704
- }
1705
- connectedCallback() {
1706
- var _a2;
1707
- super.connectedCallback(), (_a2 = this._$Do) == null ? void 0 : _a2.setConnected(true);
1708
- }
1709
- disconnectedCallback() {
1710
- var _a2;
1711
- super.disconnectedCallback(), (_a2 = this._$Do) == null ? void 0 : _a2.setConnected(false);
1712
- }
1713
- render() {
1714
- return w;
1715
- }
1716
- }
1717
- s._$litElement$ = true, s["finalized"] = true, (_a = globalThis.litElementHydrateSupport) == null ? void 0 : _a.call(globalThis, { LitElement: s });
1718
- const r$2 = globalThis.litElementPolyfillSupport;
1719
- r$2 == null ? void 0 : r$2({ LitElement: s });
1720
- (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.0.2");
1721
- /**
1722
- * @license
1723
- * Copyright 2017 Google LLC
1724
- * SPDX-License-Identifier: BSD-3-Clause
1725
- */
1726
- const t$1 = (t2) => (e2, o2) => {
1727
- void 0 !== o2 ? o2.addInitializer(() => {
1728
- customElements.define(t2, e2);
1729
- }) : customElements.define(t2, e2);
1730
- };
1731
- /**
1732
- * @license
1733
- * Copyright 2017 Google LLC
1734
- * SPDX-License-Identifier: BSD-3-Clause
1735
- */
1736
- const o$1 = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$1 }, r$1 = (t2 = o$1, e2, r2) => {
1737
- const { kind: n2, metadata: i2 } = r2;
1738
- let s2 = globalThis.litPropertyMetadata.get(i2);
1739
- if (void 0 === s2 && globalThis.litPropertyMetadata.set(i2, s2 = /* @__PURE__ */ new Map()), s2.set(r2.name, t2), "accessor" === n2) {
1740
- const { name: o2 } = r2;
1741
- return { set(r3) {
1742
- const n3 = e2.get.call(this);
1743
- e2.set.call(this, r3), this.requestUpdate(o2, n3, t2);
1744
- }, init(e3) {
1745
- return void 0 !== e3 && this.C(o2, void 0, t2), e3;
1746
- } };
1747
- }
1748
- if ("setter" === n2) {
1749
- const { name: o2 } = r2;
1750
- return function(r3) {
1751
- const n3 = this[o2];
1752
- e2.call(this, r3), this.requestUpdate(o2, n3, t2);
1753
- };
1754
- }
1755
- throw Error("Unsupported decorator location: " + n2);
1756
- };
1757
- function n$1(t2) {
1758
- return (e2, o2) => "object" == typeof o2 ? r$1(t2, e2, o2) : ((t3, e3, o3) => {
1759
- const r2 = e3.hasOwnProperty(o3);
1760
- return e3.constructor.createProperty(o3, r2 ? { ...t3, wrapped: true } : t3), r2 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0;
1761
- })(t2, e2, o2);
1762
- }
1763
- /**
1764
- * @license
1765
- * Copyright 2017 Google LLC
1766
- * SPDX-License-Identifier: BSD-3-Clause
1767
- */
1768
- function r(r2) {
1769
- return n$1({ ...r2, state: true, attribute: false });
1770
- }
1771
- /**
1772
- * @license
1773
- * Copyright 2017 Google LLC
1774
- * SPDX-License-Identifier: BSD-3-Clause
1775
- */
1776
- const e$2 = (e2, t2, c2) => (c2.configurable = true, c2.enumerable = true, Reflect.decorate && "object" != typeof t2 && Object.defineProperty(e2, t2, c2), c2);
1777
- /**
1778
- * @license
1779
- * Copyright 2017 Google LLC
1780
- * SPDX-License-Identifier: BSD-3-Clause
1781
- */
1782
- function e$1(e2, r2) {
1783
- return (n2, s2, i2) => {
1784
- const o2 = (t2) => {
1785
- var _a2;
1786
- return ((_a2 = t2.renderRoot) == null ? void 0 : _a2.querySelector(e2)) ?? null;
1787
- };
1788
- if (r2) {
1789
- const { get: e3, set: r3 } = "object" == typeof s2 ? n2 : i2 ?? (() => {
1790
- const t2 = Symbol();
1791
- return { get() {
1792
- return this[t2];
1793
- }, set(e4) {
1794
- this[t2] = e4;
1795
- } };
1796
- })();
1797
- return e$2(n2, s2, { get() {
1798
- let t2 = e3.call(this);
1799
- return void 0 === t2 && (t2 = o2(this), (null !== t2 || this.hasUpdated) && r3.call(this, t2)), t2;
1800
- } });
1801
- }
1802
- return e$2(n2, s2, { get() {
1803
- return o2(this);
1804
- } });
1805
- };
1806
- }
1807
- /**
1808
- * @license
1809
- * Copyright 2017 Google LLC
1810
- * SPDX-License-Identifier: BSD-3-Clause
1811
- */
1812
- const t = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, e = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
1813
- let i$1 = class i {
1814
- constructor(t2) {
1815
- }
1816
- get _$AU() {
1817
- return this._$AM._$AU;
1818
- }
1819
- _$AT(t2, e2, i2) {
1820
- this._$Ct = t2, this._$AM = e2, this._$Ci = i2;
1821
- }
1822
- _$AS(t2, e2) {
1823
- return this.update(t2, e2);
1824
- }
1825
- update(t2, e2) {
1826
- return this.render(...e2);
1827
- }
1828
- };
1829
- /**
1830
- * @license
1831
- * Copyright 2018 Google LLC
1832
- * SPDX-License-Identifier: BSD-3-Clause
1833
- */
1834
- const n = "important", i = " !" + n, o = e(class extends i$1 {
1835
- constructor(t$12) {
1836
- var _a2;
1837
- if (super(t$12), t$12.type !== t.ATTRIBUTE || "style" !== t$12.name || ((_a2 = t$12.strings) == null ? void 0 : _a2.length) > 2)
1838
- throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
1839
- }
1840
- render(t2) {
1841
- return Object.keys(t2).reduce((e2, r2) => {
1842
- const s2 = t2[r2];
1843
- return null == s2 ? e2 : e2 + `${r2 = r2.includes("-") ? r2 : r2.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s2};`;
1844
- }, "");
1845
- }
1846
- update(e2, [r2]) {
1847
- const { style: s2 } = e2.element;
1848
- if (void 0 === this.ut)
1849
- return this.ut = new Set(Object.keys(r2)), this.render(r2);
1850
- for (const t2 of this.ut)
1851
- null == r2[t2] && (this.ut.delete(t2), t2.includes("-") ? s2.removeProperty(t2) : s2[t2] = null);
1852
- for (const t2 in r2) {
1853
- const e3 = r2[t2];
1854
- if (null != e3) {
1855
- this.ut.add(t2);
1856
- const r3 = "string" == typeof e3 && e3.endsWith(i);
1857
- t2.includes("-") || r3 ? s2.setProperty(t2, r3 ? e3.slice(0, -11) : e3, r3 ? n : "") : s2[t2] = e3;
1858
- }
1859
- }
1860
- return w;
1861
- }
1862
- });
1863
- const version = "5.0.3";
1864
- class LuzmoService {
1865
- constructor() {
1866
- this._components = [];
1867
- }
1868
- }
1869
- const LuzmoService$1 = new LuzmoService();
1870
- const _setEventHandler = () => {
1871
- if (typeof window.__luzmoMessageHandler === "function") {
1872
- return;
1873
- }
1874
- window.__luzmoMessageHandler = (event) => {
1875
- var _a2;
1876
- const dashboardComponent = LuzmoService$1._components.find(
1877
- (c2) => event.data.name === c2._iframeId
1878
- );
1879
- if (!dashboardComponent) {
1880
- return;
1881
- }
1882
- switch ((_a2 = event.data) == null ? void 0 : _a2.type) {
1883
- case "load": {
1884
- dashboardComponent.dispatchEvent(
1885
- new CustomEvent("load", { detail: { data: event.data } })
1886
- );
1887
- if (dashboardComponent._loadTimeoutHandle) {
1888
- clearTimeout(dashboardComponent._loadTimeoutHandle);
1889
- dashboardComponent._loadTimeoutHandle = void 0;
1890
- }
1891
- dashboardComponent.iframeLoaded = true;
1892
- dashboardComponent.dimensions = event.data.dimensions;
1893
- dashboardComponent._calculateDimAfterDashboardLoaded();
1894
- break;
1895
- }
1896
- case "error": {
1897
- dashboardComponent.dashboardError = true;
1898
- if (dashboardComponent._loadTimeoutHandle) {
1899
- clearTimeout(dashboardComponent._loadTimeoutHandle);
1900
- dashboardComponent._loadTimeoutHandle = void 0;
1901
- }
1902
- dashboardComponent.iframeLoaded = true;
1903
- dashboardComponent._displayError();
1904
- break;
1905
- }
1906
- case "data": {
1907
- resolvePromise(
1908
- dashboardComponent,
1909
- event.data.requestId,
1910
- event.data.data
1911
- );
1912
- break;
1913
- }
1914
- case "filters": {
1915
- resolvePromise(
1916
- dashboardComponent,
1917
- event.data.requestId,
1918
- event.data.filters
1919
- );
1920
- break;
1921
- }
1922
- case "getAccessibleDashboards": {
1923
- resolvePromise(
1924
- dashboardComponent,
1925
- event.data.requestId,
1926
- event.data.accessibleDashboards
1927
- );
1928
- break;
1929
- }
1930
- case "dashboardAction": {
1931
- dashboardComponent.dispatchEvent(
1932
- new CustomEvent("dashboardAction", { detail: { data: event.data } })
1933
- );
1934
- break;
1935
- }
1936
- case "export": {
1937
- if (event.data.error) {
1938
- rejectPromise(
1939
- dashboardComponent,
1940
- event.data.requestId,
1941
- event.data
1942
- );
1943
- } else {
1944
- dashboardComponent.dispatchEvent(
1945
- new CustomEvent("exported", { detail: { data: event.data } })
1946
- );
1947
- resolvePromise(
1948
- dashboardComponent,
1949
- event.data.requestId,
1950
- event.data
1951
- );
1952
- }
1953
- break;
1954
- }
1955
- case "changedFilters": {
1956
- dashboardComponent.dispatchEvent(
1957
- new CustomEvent("changedFilters", { detail: { data: event.data } })
1958
- );
1959
- break;
1960
- }
1961
- case "customEvent": {
1962
- dashboardComponent.dispatchEvent(
1963
- new CustomEvent("customEvent", { detail: { data: event.data } })
1964
- );
1965
- break;
1966
- }
1967
- case "chartsRendered":
1968
- case "itemsRendered": {
1969
- event.data.type = "itemsRendered";
1970
- dashboardComponent.dispatchEvent(
1971
- new CustomEvent("itemsRendered", { detail: { data: event.data } })
1972
- );
1973
- break;
1974
- }
1975
- case "setEditMode": {
1976
- if (event.data.error) {
1977
- rejectPromise(
1978
- dashboardComponent,
1979
- event.data.requestId,
1980
- event.data
1981
- );
1982
- } else {
1983
- resolvePromise(
1984
- dashboardComponent,
1985
- event.data.requestId,
1986
- event.data
1987
- );
1988
- dashboardComponent.params.editMode = event.data.editMode;
1989
- dashboardComponent._containerStyle = containerStyles(dashboardComponent);
1990
- if (dashboardComponent.dimensions) {
1991
- _setCalculatedDimensions(dashboardComponent);
1992
- }
1993
- }
1994
- break;
1995
- }
1996
- case "setFilters": {
1997
- event.data.error ? rejectPromise(
1998
- dashboardComponent,
1999
- event.data.requestId,
2000
- event.data
2001
- ) : resolvePromise(
2002
- dashboardComponent,
2003
- event.data.requestId,
2004
- event.data
2005
- );
2006
- break;
2007
- }
2008
- case "setPreview": {
2009
- event.data.error ? rejectPromise(
2010
- dashboardComponent,
2011
- event.data.requestId,
2012
- event.data
2013
- ) : resolvePromise(
2014
- dashboardComponent,
2015
- event.data.requestId,
2016
- event.data
2017
- );
2018
- break;
2019
- }
2020
- }
2021
- };
2022
- window.addEventListener("message", window.__luzmoMessageHandler, false);
2023
- };
2024
- const dashboardStyles = i$4`
1
+ var Dt=Object.defineProperty;var Pt=Object.getOwnPropertyDescriptor;var m=(t,e,r,i)=>{for(var s=i>1?void 0:i?Pt(e,r):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(s=(i?a(e,r,s):a(s))||s);return i&&s&&Dt(e,r,s),s};var P=(t,e)=>{let r="The dashboard component encountered an error";typeof e?.dashboardId=="string"&&(r+=` for dashboard with id ${e.dashboardId}`),typeof e?.dashboardSlug=="string"&&(r+=` for dashboard with slug ${e.dashboardSlug}`),typeof e?.container=="string"&&(r+=` in container ${e.container}`),t&&(r+=`:
2
+ ${t}`,console.error(r))};var Te=t=>{let e=!1,r="",s=(document.body||document.documentElement).style,o={svg:!!("createElementNS"in document&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),flexbox:s.webkitFlexWrap===""||s.flexWrap==="",postMessage:!!window.postMessage},a=["svg","flexbox","postMessage"];for(let h of a)o[h]||(e=!0,t.browserNotSupported=t.browserNotSupported||[],t.browserNotSupported.push(h),r+=`Your browser does not support: ${h}
3
+ `);let n=window.navigator.userAgent,d=n.includes("MSIE"),l=n.includes("Trident/");(d||l)&&(e=!0,r="IE is not supported."),e&&P(r)};var w={appServer:"https://app.luzmo.com/",apiHost:"https://api.luzmo.com/",dashboardId:null,dashboardSlug:null,container:null,key:null,token:null,language:"auto",qeVersion:null,editMode:null,screenMode:null,switchScreenModeOnResize:!0,itemId:null,mainColor:"",accentColor:"",itemDimensions:{width:"auto",height:"auto"},loaderBackground:"#f9f9f9",loaderFontColor:"#5a5a5a",loaderSpinnerColor:"rgba(255, 165, 0, 0.7)",loaderSpinnerBackground:"rgba(169, 169, 169, 0.14)",timezoneId:null,contextId:null};var Y=[{mode:"mobile",width:[150,767]},{mode:"tablet",width:[768,1199]},{mode:"desktop",width:[1200,1599]},{mode:"largeScreen",width:[1600,9999]},{mode:"fixed",width:[]}];var Tt={initializing:{en:"Initializing...",nl:"Laden...",fr:"Chargement..."},errorDashboard:{en:"Oops, we could not load this dashboard!",nl:"Oeps, we konden het dashboard niet laden.",fr:"Le chargement a echou\xE9."},errorItem:{en:"Oops, we could not load this item!",nl:"Oeps, we konden de grafiek niet laden.",fr:"Le chargement a echou\xE9."}},ne=Tt;var z=t=>t?t.endsWith("/")?t:`${t}/`:"",T=t=>t?t.endsWith("/")?t.slice(0,-1):t:"",ke=(t,e,r,i)=>{let s=(n,d)=>{let l=n.users.find(f=>f.id===d.id),h=l&&l.userAccessRight?{flagRead:l.userAccessRight.flagRead,flagUse:l.userAccessRight.flagUse,flagModify:l.userAccessRight.flagModify,flagOwn:l.userAccessRight.flagOwn}:{flagRead:!1,flagUse:!1,flagModify:!1,flagOwn:!1},S=n.groups.filter(f=>d.userGroups.includes(f.id)||f.public===!0).map(f=>{if(f.groupAccessRight)return f.groupAccessRight});for(let f of S)!h.flagRead&&f.flagRead&&(h.flagRead=f.flagRead),!h.flagUse&&f.flagUse&&(h.flagUse=f.flagUse),!h.flagModify&&f.flagModify&&(h.flagModify=f.flagModify),!h.flagOwn&&f.flagOwn&&(h.flagOwn=f.flagOwn);let g=n.integrations?.length>0?n.integrations.map(f=>{if(f.integrationAccessRight)return f.integrationAccessRight}):[];for(let f of g)!h.flagRead&&f.flagRead&&(h.flagRead=f.flagRead),!h.flagUse&&f.flagUse&&(h.flagUse=f.flagUse),!h.flagModify&&f.flagModify&&(h.flagModify=f.flagModify);return h},o=(n,d)=>{if(n==null)return"";if(typeof n!="object"||Object.keys(n).length===0)return typeof n=="object"&&Object.keys(n).length===0?"":n;let l;return l=d&&n[d]?n[d]:n[Object.keys(n)[0]],l==null&&(l=""),l},a=[];for(let n of t){let d={accessibleBy:[],accessRights:s(n,r),id:n.id,modifiedAt:n.modified_at,name:o(n.name,i.language),slug:null,tags:n.tags.map(g=>g.tag).sort((g,f)=>g.localeCompare(f))},l=n.integrations.find(g=>g.id===e);l?.integrationAccessRight?.slug&&(d.slug=l.integrationAccessRight.slug);let h=n.users.map(g=>({model:"User",id:g.id,name:o(g.name,r.locale_id)})),p=n.groups.map(g=>({model:"Group",id:g.id,name:o(g.name,r.locale_id)||{}})),S=n.integrations.map(g=>({model:"Integration",id:g.id,name:o(g.name,r.locale_id)||{}}));d.accessibleBy=[...h,...p,...S],a.push(d)}return a},Oe="0.0.0-shared-luzmo",He=t=>{let e=/^(%20|\s)*(javascript|data)/im,r=/[^\u0020-\u007E]/gim,i=/^([^:]+):/gm,s=new Set([".","/"]),o=l=>s.has(l[0]);if(!t)return"about:blank";let a=t.replaceAll(r,"").trim();if(o(a))return a;let n=a.match(i);if(!n)return a;let d=n[0];return e.test(d)?"about:blank":a},de=t=>JSON.parse(JSON.stringify(t)),kt=t=>t&&typeof t=="object",Z=(t,e)=>(Object.entries(e).forEach(([r,i])=>{r in t?t[r]===void 0?t[r]=i:t[r]=kt(i)?Z(t[r],i):t[r]:t[r]=i}),t);var y=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g,function(t){let e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)});var le=t=>{let e=[],{appServer:r,language:i,qeVersion:s,loaderBackground:o,loaderSpinnerColor:a,loaderSpinnerBackground:n,loaderFontColor:d,screenMode:l,key:h,token:p,timezoneId:S,itemEmbedding:g,itemDimensions:f,dashboardId:Ie,dashboardSlug:Ae,itemId:Rt,mainColor:Re,accentColor:Le,editMode:De}=t.params;i&&i!=="auto"&&e.push("language="+i),s&&e.push(`qe_version=${s}`),o&&e.push(`ldrbg=${o}`),d&&e.push(`ldrftclr=${d}`),a&&e.push(`ldrspclr=${a}`),n&&e.push(`ldrspbg=${n}`),Re&&e.push(`mainColor=${Re}`),Le&&e.push(`accentColor=${Le}`),l&&l!=="auto"&&e.push("screenMode="+l),S&&e.push("timezoneId="+S),g&&f&&f.width&&e.push("width="+f.width),g&&f&&f.height&&e.push("height="+f.height),De&&e.push("editMode="+De);let Pe=h&&p?"#"+h+":"+p:"";e.push("version="+(t.VERSION||Oe));let Lt=g?`${r}i/${Ie||Ae}/${Rt}?${encodeURIComponent(e.join("&"))}${Pe}`:`${r}i/${Ie||Ae}?${encodeURIComponent(e.join("&"))}${Pe}`;return He(Lt)};var he=t=>{let e;(t.params.error||t.browserNotSupported.length>0)&&(t.params.error=!0,t.browserNotSupported&&(e="Browser is not supported."));let r=ne.initializing[t.params.language]||ne.initializing.en;return t.browserNotSupported||t.params.error?{loadingMsg:r,errorMsg:e}:{loadingMsg:r,errorMsg:""}};function v(t,e,r){t.promises[e]&&(t.promises[e].resolve(r),delete t.promises[e])}function F(t,e,r){t.promises[e]&&(t.promises[e].reject(r),delete t.promises[e])}function Q(t){let e={};return t.params.loaderBackground&&!t.iframeLoaded&&(e.background=t.params.loaderBackground),e}function Fe(t){let e=t.params.itemDimensions?.height||w.itemDimensions.height,r=t.params.itemEmbedding&&e!=="auto";return{display:t.iframeLoaded?"none":"",height:`${r?e:t.minHeight}px`}}function Ne(t){let e=t.params.loaderBackground||w.loaderBackground;if(t.params.itemEmbedding){t.loaderSize=24,t.borderWidth=4,t.minHeight=200;let r=t.params.itemDimensions?.width||w.itemDimensions.width,i=t.params.itemDimensions?.height||w.itemDimensions.height,s=r!=="auto",o=i!=="auto";return{background:e,width:s?`${r}px`:"100%",height:`${o?i:"200"}px`,"min-height":o?"":"200px"}}return{background:e}}function Ue(t){let{loaderSpinnerColor:e,loaderSpinnerBackground:r}=w,i=ze(t.borderWidth,t.params.loaderSpinnerColor||e),s=ze(t.borderWidth,t.params.loaderSpinnerBackground||r),o=`${t.loaderSize}px`;return{"border-top":i,"border-right":i,"border-bottom":s,"border-left":s,width:o,height:o}}function je(t){let e=t.params.itemDimensions?.height||w.itemDimensions.height,r=t.params.itemEmbedding&&e!=="auto",i=o=>`${(o-t.loaderSize-32)/2}px`;return{padding:`${t.params.itemId?i(r?Number.parseInt(`${e}`,10):t.minHeight):"128px"} 16px`}}function ce(t){let e=t.params.itemDimensions?.height||w.itemDimensions.height,r=t.params.itemDimensions?.width||w.itemDimensions.width;t.params.itemEmbedding&&e!=="auto"?t.iframeHeight=`${e}px`:t.params.itemEmbedding?t.iframeHeight="200px":["editFull","editLimited"].includes(t.params.editMode)?t.iframeHeight="100%":t.iframeHeight="400px",t.iframeWidth=t.params.itemEmbedding&&r!=="auto"?`${r}px`:"100%";let i={height:t.iframeHeight,width:t.iframeWidth};return t.iframeLoaded?i.opacity=1:t.error?(i.opacity=1,i.width="100%",i.height="400px"):i.opacity=0,i}function ze(t,e){return`${t}px solid ${e}`}var Ve=(t,e)=>{t?.contentWindow&&t.contentWindow.location.replace(e)};var me=(t,e,r)=>{let i=y();return e?.contentWindow?(e.contentWindow.postMessage({action:"exportDashboard",format:r||"png",_version:t.VERSION,requestId:i},"*"),new Promise((s,o)=>{t.promises[i]={resolve:s,reject:o},setTimeout(()=>{if(t.promises[i]){let a="exportDashboard request timed out.";t.promises[i].reject(new Error(a)),delete t.promises[i]}},12e5)})):Promise.reject(new Error("Cannot retrieve contentWindow."))};var We=(t,e)=>{if((t.dashboardId||t.dashboardSlug)&&e?.contentWindow){let i=y();return e.contentWindow.postMessage({action:"getAccessibleDashboards",_version:t.VERSION,requestId:i},"*"),new Promise((s,o)=>{t.promises[i]={resolve:s,reject:o},setTimeout(()=>{if(t.promises[i]){let a="getAccessibleDashboards request timed out.";t.promises[i].reject(new Error(a)),delete t.promises[i]}},2e3)})}let r=new Promise((i,s)=>{(()=>{try{window.fetch(`${String(t.params.apiHost)}0.1.0/authorization`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:t.authKey,token:t.authToken,find:{where:{id:t.authKey},attributes:["id","integration_id"],include:[{model:"User",attributes:["id","name","locale_id"],include:[{model:"Group"}]}]}})}).then(a=>a.json()).then(a=>{!a||!a.rows||a.rows.length===0||!a.rows[0].user||!a.rows[0].integration_id?s():(a.rows[0].user.userGroups=a.rows[0].user.groups.map(n=>n.id),delete a.rows[0].user.groups,i({integrationId:a.rows[0].integration_id,user:a.rows[0].user}))})}catch(o){s(o)}})()});return new Promise((i,s)=>void(()=>{try{r.then(o=>{window.fetch(`${String(t.params.apiHost)}0.1.0/securable`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:t.authKey,token:t.authToken,find:{where:{type:"dashboard",is_variant:!1},attributes:["id","name","modified_at"],order:[["modified_at","desc"]],include:[{model:"Tag",attributes:["tag"]},{model:"User",attributes:["id","name"]},{model:"Group",attributes:["id","name","public"]},{model:"Integration",attributes:["id","name"]}]}})}).then(n=>n.json()).then(n=>{let d=n.rows.length>0?ke(n.rows,o.integrationId,o.user,t):[];i(d)})}).catch(o=>{s(o)})}catch(o){s(o)}})())};var Be=(t,e,r)=>{if(e?.contentWindow){let i=y();return e.contentWindow.postMessage({action:"getData",id:r,_version:t.VERSION,requestId:i},"*"),new Promise((s,o)=>{t.promises[i]={resolve:s,reject:o},setTimeout(()=>{if(t.promises[i]){let a="getData request timed out.";t.promises[i].reject(new Error(a)),delete t.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))};var qe=(t,e)=>{if(e?.contentWindow){let r=y();return e.contentWindow.postMessage({action:"getFilters",_version:t.VERSION,requestId:r},"*"),new Promise((i,s)=>{t.promises[r]={resolve:i,reject:s},setTimeout(()=>{if(t.promises[r]){let o="getFilters request timed out.";t.promises[r].reject(new Error(o)),delete t.promises[r]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))};var ue=(t,e,r)=>e?(e.contentWindow.postMessage({action:"refreshData",id:r??null,_version:t.VERSION},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow."));var Ce=(t,e)=>e?(e.contentWindow.postMessage({action:"reloadDashboard",_version:t.VERSION},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow."));var Ke=(t,e,r,i)=>e?(e.contentWindow.postMessage({action:"setAuthorization",key:r,token:i,_version:t.VERSION},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow."));var Ge=(t,e,r)=>{if(e&&e.contentWindow){let i=y();return t.params.editMode===r?Promise.reject(new Error("editMode parameter is currently already set to "+r)):r!=="editFull"&&r!=="editLimited"&&r!=="view"?Promise.reject(new Error("The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'.")):(e.contentWindow.postMessage({action:"setEditMode",editMode:r,_version:t.VERSION,requestId:i},"*"),new Promise((s,o)=>{t.promises[i]={resolve:s,reject:o}}))}return Promise.reject(new Error("Cannot retrieve contentWindow."))};var Je=(t,e,r,i)=>{if(e){let s=y();return e.contentWindow.postMessage({action:"setFilters",itemId:r,filters:i,_version:t.VERSION,requestId:s},"*"),new Promise((o,a)=>{t.promises[s]={resolve:o,reject:a},setTimeout(()=>{if(t.promises[s]){let n="setFilters request timed out.";t.promises[s].reject(new Error(n)),delete t.promises[s]}},2e3)})}return Promise.reject()};var Xe=(t,e,r)=>{if(e){let i=y();return e.contentWindow.postMessage({action:"setPreview",preview:r,requestId:i,_version:t.VERSION},"*"),new Promise((s,o)=>{t.promises[i]={resolve:s,reject:o},setTimeout(()=>{if(t.promises[i]){let a="setPreview request timed out.";t.promises[i].reject(new Error(a)),delete t.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))};var ee=t=>{if(!t.dimensions){t.params.error=!0,P("Got no valid dimensions.",t.params);return}let e=Object.keys(t.dimensions),r=[],i,s=0,o=0;if(!t.params.switchScreenModeOnResize&&t.currentScreenMode&&(t.params.screenMode=t.currentScreenMode),t.dimensions&&e?.[0]==="fixed")i="fixed",s=t.dimensions.fixed[0],o=t.dimensions.fixed[1];else{let d=["mobile","tablet","desktop","largeScreen"];if(t.params.itemEmbedding){let[l]=e,h=de(l);for(let p of d){let S=e.find(g=>g===p);S?h=de(S):t.dimensions[p]=t.dimensions[h]}}for(let l of e)if(d.includes(l)){let h=Y.find(p=>p.mode===l);r.push({...h,height:t.dimensions[l][1]||50})}if(r.map(l=>l.mode).includes(t.params.screenMode)||(t.params.screenMode="auto"),t.params.screenMode==="auto"){r.sort((l,h)=>d.indexOf(l.mode)-d.indexOf(h.mode));for(let l of r){let[h,p]=l.width;t.params.itemEmbedding&&t.params.itemDimensions&&t.params.itemDimensions.width!=="auto"&&t.params.itemDimensions.height==="auto"?h<t.params.itemDimensions.width&&(i=l.mode,s=Number.parseInt(t.params.itemDimensions.width,10),o=t.dimensions[i][1]):h<t.containerWidth&&(i=l.mode,t.params.itemEmbedding?(s=t.params.itemDimensions?.width&&t.params.itemDimensions?.width!=="auto"?Number.parseInt(t.params.itemDimensions.width,10):Math.min(t.containerWidth,p),o=t.params.itemDimensions?.height&&t.params.itemDimensions?.height!=="auto"?Number.parseInt(t.params.itemDimensions.height,10):t.dimensions[i][1],t.params.itemDimensions&&t.params.itemDimensions.width!=="auto"&&t.params.itemDimensions.height==="auto"&&(s=Number.parseInt(t.params.itemDimensions.width,10),o=t.dimensions[i][1])):(s=Math.max(Math.min(p,t.containerWidth),h),o=l.height))}}else{let{height:l,width:[h,p]}=r.find(S=>S.mode===t.params.screenMode);i=t.params.screenMode,s=Math.max(Math.min(p,t.containerWidth),h),o=l,t.params.itemEmbedding&&(t.params.itemDimensions?.width&&t.params.itemDimensions?.width!=="auto"&&(s=Number.parseInt(t.params.itemDimensions.width,10)),t.params.itemDimensions?.height&&t.params.itemDimensions?.height!=="auto"&&(o=Number.parseInt(t.params.itemDimensions.height,10)))}if(!i&&r.length>0){let[l]=r;i=l.mode,s=l.width[0],o=l.height}}t.currentScreenMode=i;let a={height:o===0?"100%":`${String(o)}px`,width:s===0?"100%":`${String(s)}px`,opacity:1};["editFull","editLimited"].includes(t.params.editMode)?(a.height="100%",a.width="100%"):t.params.itemEmbedding&&t.params.itemDimensions?(a.height=t.params.itemDimensions.height==="auto"?a.height:`${String(t.params.itemDimensions.height).replace("px","")}px`,a.width=t.params.itemDimensions.width==="auto"?a.width:`${String(t.params.itemDimensions.width).replace("px","")}px`):(a.height=o===0?"100%":`${String(o)}px`,a.width=s===0?"100%":`${String(s)}px`),t.currentScreenMode=i,t.iframeStyle=a};var pe=t=>{let e=Object.keys(w),r=[],i=["appServer","language","apiHost"],s=["key","token","screenMode","timezoneId","itemId","container","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground"],o=["itemDimensions"],a=["mobile","tablet","desktop","largeScreen","fixed","auto"];for(let n of e)t.params[n]===null&&delete t.params[n];t.params=Z(t.params,w),(!t.params.dashboardId||typeof t.params.dashboardId!="string")&&(!t.params.dashboardSlug||typeof t.params.dashboardSlug!="string")&&(delete t.params.dashboardId,delete t.params.dashboardSlug);for(let n of i)typeof t.params[n]!="string"&&(delete t.params[n],r.push(`${n} needs to be of type string.`));for(let n of s)typeof t.params[n]!="string"&&t.params[n]!==null&&t.params[n]!==void 0&&(delete t.params[n],r.push(`${n} needs to be of type string or empty.`));if(t.params.screenMode&&!a.includes(t.params.screenMode)){let n=a.map(d=>`"${d}"`).join(", ");r.push(`"screenMode" needs should be one of these types: ${n}`),t.params.screenMode="auto"}t.params.itemId&&(t.params.itemEmbedding=!0);for(let n of o)typeof t.params[n]!="object"&&t.params[n]!==null&&(delete t.params[n],r.push(`${n} needs to be of type object or empty.`));if(typeof t.params.switchScreenModeOnResize!="boolean"&&(r.push("switchScreenModeOnResize needs to be of type boolean."),t.params.switchScreenModeOnResize=!0),t.params.itemDimensions){let n=["width","height"];for(let d of n)!["string","number"].includes(typeof t.params.itemDimensions[d])&&t.params.itemDimensions[d]!==null&&r.push(`itemDimensions ${d} needs to be of type string, number or empty.`)}t.params=Z(t.params,w),t.params.screenMode&&t.params.screenMode!=="auto"&&(t.params.switchScreenModeOnResize=!1),t.params.itemDimensions.width!=="auto"&&(t.params.itemDimensions.width=Number.parseInt(`${t.params.itemDimensions.width}`.replace("px",""),10)||"auto"),t.params.itemDimensions.height!=="auto"&&(t.params.itemDimensions.height=Number.parseInt(`${t.params.itemDimensions.height}`.replace("px",""),10)||"auto"),t.params.itemEmbedding=!!t.params.itemId,(t.params.error||r.length>0)&&P(r.join(`
4
+ `),t.params)};var k={},Ot=async(t,e)=>{let r=typeof t=="function"?await t():t,i=document.createElement("script");i.type="text/javascript",i.addEventListener("load",e),i.src=r,document.querySelectorAll("head")[0].append(i)},Ye=t=>({});async function Ht(t){let e=k[t];if(e.inited)return e.lib;if(e.format==="var")return new Promise(r=>{let i=()=>{e.inited||(e.lib=window[t],e.lib.init(Ye(e.from)),e.inited=!0),r(e.lib)};return Ot(e.url,i)});if(["esm","systemjs"].includes(e.format))return new Promise((r,i)=>{(typeof e.url=="function"?e.url:()=>Promise.resolve(e.url))().then(o=>{import(o).then(a=>{if(!e.inited){let n=Ye(e.from);a.init(n),e.lib=a,e.lib.init(n),e.inited=!0}r(e.lib)}).catch(i)})})}function Ze(t,e){if(!t?.default&&e){let r=Object.create(null);return r.default=t,r.__esModule=!0,r}return t}async function Qe(t,e){return Ht(t).then(r=>r.get(e).then(i=>i()))}var tt=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(e){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBraileLabel="",this.ariaBraileRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var rt=new WeakMap,N=t=>{let e=rt.get(t);return e===void 0&&rt.set(t,e=new Map),e},zt=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(N(this)).map(([e,r])=>({name:e,value:r}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}setAttribute(e,r){N(this).set(e,String(r))}removeAttribute(e){N(this).delete(e)}toggleAttribute(e,r){if(this.hasAttribute(e)){if(r===void 0||!r)return this.removeAttribute(e),!1}else return r===void 0||r?(this.setAttribute(e,""),!0):!1;return!0}hasAttribute(e){return N(this).has(e)}attachShadow(e){let r={host:this};return this.__shadowRootMode=e.mode,e&&e.mode==="open"&&(this.__shadowRoot=r),r}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let e=new tt(this);return this.__internals=e,e}getAttribute(e){return N(this).get(e)??null}};var Ft=class extends zt{},it=Ft;var Nt=class{constructor(){this.__definitions=new Map}define(e,r){if(this.__definitions.has(e))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${e}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
5
+ Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${e}" has already been used with this registry`);this.__definitions.set(e,{ctor:r,observedAttributes:r.observedAttributes??[]})}get(e){return this.__definitions.get(e)?.ctor}},Ut=Nt;var st=new Ut;var U=globalThis,te=U.ShadowRoot&&(U.ShadyCSS===void 0||U.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,fe=Symbol(),ot=new WeakMap,j=class{constructor(e,r,i){if(this._$cssResult$=!0,i!==fe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o,r=this.t;if(te&&e===void 0){let i=r!==void 0&&r.length===1;i&&(e=ot.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&ot.set(r,e))}return e}toString(){return this.cssText}},at=t=>new j(typeof t=="string"?t:t+"",void 0,fe),ge=(t,...e)=>{let r=t.length===1?t[0]:e.reduce((i,s,o)=>i+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new j(r,t,fe)},Se=(t,e)=>{if(te)t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of e){let i=document.createElement("style"),s=U.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=r.cssText,t.appendChild(i)}},re=te||U.CSSStyleSheet===void 0?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(let i of e.cssRules)r+=i.cssText;return at(r)})(t):t;var{is:jt,defineProperty:Vt,getOwnPropertyDescriptor:Wt,getOwnPropertyNames:Bt,getOwnPropertySymbols:qt,getPrototypeOf:Ct}=Object,B=globalThis;B.customElements??=st;var nt=B.trustedTypes,Kt=nt?nt.emptyScript:"",Gt=B.reactiveElementPolyfillSupport,V=(t,e)=>t,W={toAttribute(t,e){switch(e){case Boolean:t=t?Kt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=t!==null;break;case Number:r=t===null?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch{r=null}}return r}},ie=(t,e)=>!jt(t,e),dt={attribute:!0,type:String,converter:W,reflect:!1,hasChanged:ie};Symbol.metadata??=Symbol("metadata"),B.litPropertyMetadata??=new WeakMap;var x=class extends(globalThis.HTMLElement??it){static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,r=dt){if(r.state&&(r.attribute=!1),this._$Ei(),this.elementProperties.set(e,r),!r.noAccessor){let i=Symbol(),s=this.getPropertyDescriptor(e,i,r);s!==void 0&&Vt(this.prototype,e,s)}}static getPropertyDescriptor(e,r,i){let{get:s,set:o}=Wt(this.prototype,e)??{get(){return this[r]},set(a){this[r]=a}};return{get(){return s?.call(this)},set(a){let n=s?.call(this);o.call(this,a),this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??dt}static _$Ei(){if(this.hasOwnProperty(V("elementProperties")))return;let e=Ct(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(V("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(V("properties"))){let r=this.properties,i=[...Bt(r),...qt(r)];for(let s of i)this.createProperty(s,r[s])}let e=this[Symbol.metadata];if(e!==null){let r=litPropertyMetadata.get(e);if(r!==void 0)for(let[i,s]of r)this.elementProperties.set(i,s)}this._$Eh=new Map;for(let[r,i]of this.elementProperties){let s=this._$Eu(r,i);s!==void 0&&this._$Eh.set(s,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let r=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let s of i)r.unshift(re(s))}else e!==void 0&&r.push(re(e));return r}static _$Eu(e,r){let i=r.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,r=this.constructor.elementProperties;for(let i of r.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Se(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,r,i){this._$AK(e,i)}_$EC(e,r){let i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){let o=(i.converter?.toAttribute!==void 0?i.converter:W).toAttribute(r,i.type);this._$Em=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,r){let i=this.constructor,s=i._$Eh.get(e);if(s!==void 0&&this._$Em!==s){let o=i.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:W;this._$Em=s,this[s]=a.fromAttribute(r,o.type),this._$Em=null}}requestUpdate(e,r,i){if(e!==void 0){if(i??=this.constructor.getPropertyOptions(e),!(i.hasChanged??ie)(this[e],r))return;this.P(e,r,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,r,i){this._$AL.has(e)||this._$AL.set(e,r),i.reflect===!0&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[s,o]of i)o.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.P(s,this[s],o)}let e=!1,r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(r)):this._$EU()}catch(i){throw e=!1,this._$EU(),i}e&&this._$AE(r)}willUpdate(e){}_$AE(e){this._$EO?.forEach(r=>r.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(r=>this._$EC(r,this[r])),this._$EU()}updated(e){}firstUpdated(e){}};x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[V("elementProperties")]=new Map,x[V("finalized")]=new Map,Gt?.({ReactiveElement:x}),(B.reactiveElementVersions??=[]).push("2.0.4");var oe=globalThis,se=oe.trustedTypes,lt=se?se.createPolicy("lit-html",{createHTML:t=>t}):void 0,ft="$lit$",M=`lit$${(Math.random()+"").slice(9)}$`,gt="?"+M,Jt=`<${gt}>`,L=oe.document===void 0?{createTreeWalker:()=>({})}:document,C=()=>L.createComment(""),K=t=>t===null||typeof t!="object"&&typeof t!="function",St=Array.isArray,Xt=t=>St(t)||typeof t?.[Symbol.iterator]=="function",be=`[
6
+ \f\r]`,q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ht=/-->/g,ct=/>/g,A=RegExp(`>|${be}(?:([^\\s"'>=/]+)(${be}*=${be}*(?:[^
7
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),mt=/'/g,ut=/"/g,bt=/^(?:script|style|textarea|title)$/i,yt=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),_=yt(1),os=yt(2),E=Symbol.for("lit-noChange"),b=Symbol.for("lit-nothing"),pt=new WeakMap,R=L.createTreeWalker(L,129);function wt(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return lt!==void 0?lt.createHTML(e):e}var Yt=(t,e)=>{let r=t.length-1,i=[],s,o=e===2?"<svg>":"",a=q;for(let n=0;n<r;n++){let d=t[n],l,h,p=-1,S=0;for(;S<d.length&&(a.lastIndex=S,h=a.exec(d),h!==null);)S=a.lastIndex,a===q?h[1]==="!--"?a=ht:h[1]!==void 0?a=ct:h[2]!==void 0?(bt.test(h[2])&&(s=RegExp("</"+h[2],"g")),a=A):h[3]!==void 0&&(a=A):a===A?h[0]===">"?(a=s??q,p=-1):h[1]===void 0?p=-2:(p=a.lastIndex-h[2].length,l=h[1],a=h[3]===void 0?A:h[3]==='"'?ut:mt):a===ut||a===mt?a=A:a===ht||a===ct?a=q:(a=A,s=void 0);let g=a===A&&t[n+1].startsWith("/>")?" ":"";o+=a===q?d+Jt:p>=0?(i.push(l),d.slice(0,p)+ft+d.slice(p)+M+g):d+M+(p===-2?n:g)}return[wt(t,o+(t[r]||"<?>")+(e===2?"</svg>":"")),i]},G=class t{constructor({strings:e,_$litType$:r},i){let s;this.parts=[];let o=0,a=0,n=e.length-1,d=this.parts,[l,h]=Yt(e,r);if(this.el=t.createElement(l,i),R.currentNode=this.el.content,r===2){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(s=R.nextNode())!==null&&d.length<n;){if(s.nodeType===1){if(s.hasAttributes())for(let p of s.getAttributeNames())if(p.endsWith(ft)){let S=h[a++],g=s.getAttribute(p).split(M),f=/([.?@])?(.*)/.exec(S);d.push({type:1,index:o,name:f[2],strings:g,ctor:f[1]==="."?we:f[1]==="?"?_e:f[1]==="@"?xe:H}),s.removeAttribute(p)}else p.startsWith(M)&&(d.push({type:6,index:o}),s.removeAttribute(p));if(bt.test(s.tagName)){let p=s.textContent.split(M),S=p.length-1;if(S>0){s.textContent=se?se.emptyScript:"";for(let g=0;g<S;g++)s.append(p[g],C()),R.nextNode(),d.push({type:2,index:++o});s.append(p[S],C())}}}else if(s.nodeType===8)if(s.data===gt)d.push({type:2,index:o});else{let p=-1;for(;(p=s.data.indexOf(M,p+1))!==-1;)d.push({type:7,index:o}),p+=M.length-1}o++}}static createElement(e,r){let i=L.createElement("template");return i.innerHTML=e,i}};function O(t,e,r=t,i){if(e===E)return e;let s=i!==void 0?r._$Co?.[i]:r._$Cl,o=K(e)?void 0:e._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(!1),o===void 0?s=void 0:(s=new o(t),s._$AT(t,r,i)),i!==void 0?(r._$Co??=[])[i]=s:r._$Cl=s),s!==void 0&&(e=O(t,s._$AS(t,e.values),s,i)),e}var ye=class{constructor(e,r){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:r},parts:i}=this._$AD,s=(e?.creationScope??L).importNode(r,!0);R.currentNode=s;let o=R.nextNode(),a=0,n=0,d=i[0];for(;d!==void 0;){if(a===d.index){let l;d.type===2?l=new J(o,o.nextSibling,this,e):d.type===1?l=new d.ctor(o,d.name,d.strings,this,e):d.type===6&&(l=new Ee(o,this,e)),this._$AV.push(l),d=i[++n]}a!==d?.index&&(o=R.nextNode(),a++)}return R.currentNode=L,s}p(e){let r=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,r),r+=i.strings.length-2):i._$AI(e[r])),r++}},J=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,r,i,s){this.type=2,this._$AH=b,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,r=this._$AM;return r!==void 0&&e?.nodeType===11&&(e=r.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,r=this){e=O(this,e,r),K(e)?e===b||e==null||e===""?(this._$AH!==b&&this._$AR(),this._$AH=b):e!==this._$AH&&e!==E&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Xt(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==b&&K(this._$AH)?this._$AA.nextSibling.data=e:this.T(L.createTextNode(e)),this._$AH=e}$(e){let{values:r,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=G.createElement(wt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(r);else{let o=new ye(s,this),a=o.u(this.options);o.p(r),this.T(a),this._$AH=o}}_$AC(e){let r=pt.get(e.strings);return r===void 0&&pt.set(e.strings,r=new G(e)),r}k(e){St(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,i,s=0;for(let o of e)s===r.length?r.push(i=new t(this.S(C()),this.S(C()),this,this.options)):i=r[s],i._$AI(o),s++;s<r.length&&(this._$AR(i&&i._$AB.nextSibling,s),r.length=s)}_$AR(e=this._$AA.nextSibling,r){for(this._$AP?.(!1,!0,r);e&&e!==this._$AB;){let i=e.nextSibling;e.remove(),e=i}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},H=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,r,i,s,o){this.type=1,this._$AH=b,this._$AN=void 0,this.element=e,this.name=r,this._$AM=s,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=b}_$AI(e,r=this,i,s){let o=this.strings,a=!1;if(o===void 0)e=O(this,e,r,0),a=!K(e)||e!==this._$AH&&e!==E,a&&(this._$AH=e);else{let n=e,d,l;for(e=o[0],d=0;d<o.length-1;d++)l=O(this,n[i+d],r,d),l===E&&(l=this._$AH[d]),a||=!K(l)||l!==this._$AH[d],l===b?e=b:e!==b&&(e+=(l??"")+o[d+1]),this._$AH[d]=l}a&&!s&&this.j(e)}j(e){e===b?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},we=class extends H{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===b?void 0:e}},_e=class extends H{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==b)}},xe=class extends H{constructor(e,r,i,s,o){super(e,r,i,s,o),this.type=5}_$AI(e,r=this){if((e=O(this,e,r,0)??b)===E)return;let i=this._$AH,s=e===b&&i!==b||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==b&&(i===b||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ee=class{constructor(e,r,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){O(this,e)}};var Zt=oe.litHtmlPolyfillSupport;Zt?.(G,J),(oe.litHtmlVersions??=[]).push("3.1.2");var _t=(t,e,r)=>{let i=r?.renderBefore??e,s=i._$litPart$;if(s===void 0){let o=r?.renderBefore??null;i._$litPart$=s=new J(e.insertBefore(C(),o),o,void 0,r??{})}return s._$AI(t),s};var $=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=_t(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return E}};$._$litElement$=!0,$.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:$});var Qt=globalThis.litElementPolyfillSupport;Qt?.({LitElement:$});(globalThis.litElementVersions??=[]).push("4.0.4");var xt=t=>(e,r)=>{r!==void 0?r.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)};var er={attribute:!0,type:String,converter:W,reflect:!1,hasChanged:ie},tr=(t=er,e,r)=>{let{kind:i,metadata:s}=r,o=globalThis.litPropertyMetadata.get(s);if(o===void 0&&globalThis.litPropertyMetadata.set(s,o=new Map),o.set(r.name,t),i==="accessor"){let{name:a}=r;return{set(n){let d=e.get.call(this);e.set.call(this,n),this.requestUpdate(a,d,t)},init(n){return n!==void 0&&this.P(a,void 0,t),n}}}if(i==="setter"){let{name:a}=r;return function(n){let d=this[a];e.call(this,n),this.requestUpdate(a,d,t)}}throw Error("Unsupported decorator location: "+i)};function u(t){return(e,r)=>typeof r=="object"?tr(t,e,r):((i,s,o)=>{let a=s.hasOwnProperty(o);return s.constructor.createProperty(o,a?{...i,wrapped:!0}:i),a?Object.getOwnPropertyDescriptor(s,o):void 0})(t,e,r)}function ve(t){return u({...t,state:!0,attribute:!1})}var D=(t,e,r)=>(r.configurable=!0,r.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(t,e,r),r);function Me(t,e){return(r,i,s)=>{let o=a=>a.renderRoot?.querySelector(t)??null;if(e){let{get:a,set:n}=typeof i=="object"?r:s??(()=>{let d=Symbol();return{get(){return this[d]},set(l){this[d]=l}}})();return D(r,i,{get(){let d=a.call(this);return d===void 0&&(d=o(this),(d!==null||this.hasUpdated)&&n.call(this,d)),d}})}return D(r,i,{get(){return o(this)}})}}var Et={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},vt=t=>(...e)=>({_$litDirective$:t,values:e}),ae=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,r,i){this._$Ct=e,this._$AM=r,this._$Ci=i}_$AS(e,r){return this.update(e,r)}update(e,r){return this.render(...r)}};var Mt="important",rr=" !"+Mt,I=vt(class extends ae{constructor(t){if(super(t),t.type!==Et.ATTRIBUTE||t.name!=="style"||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,r)=>{let i=t[r];return i==null?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(t,[e]){let{style:r}=t.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?r.removeProperty(i):r[i]=null);for(let i in e){let s=e[i];if(s!=null){this.ft.add(i);let o=typeof s=="string"&&s.endsWith(rr);i.includes("-")||o?r.setProperty(i,o?s.slice(0,-11):s,o?Mt:""):r[i]=s}}return E}});var $t="5.0.6";var $e=class{constructor(){this._components=[]}},X=new $e;var It=()=>{typeof window.__luzmoMessageHandler!="function"&&(window.__luzmoMessageHandler=t=>{let e=X._components.find(r=>t.data.name===r._iframeId);if(e)switch(t.data?.type){case"load":{e.dispatchEvent(new CustomEvent("load",{detail:{data:t.data}})),e._loadTimeoutHandle&&(clearTimeout(e._loadTimeoutHandle),e._loadTimeoutHandle=void 0),e.iframeLoaded=!0,e.dimensions=t.data.dimensions,e._calculateDimAfterDashboardLoaded();break}case"error":{e.dashboardError=!0,e._loadTimeoutHandle&&(clearTimeout(e._loadTimeoutHandle),e._loadTimeoutHandle=void 0),e.iframeLoaded=!0,e._displayError();break}case"data":{v(e,t.data.requestId,t.data.data);break}case"filters":{v(e,t.data.requestId,t.data.filters);break}case"getAccessibleDashboards":{v(e,t.data.requestId,t.data.accessibleDashboards);break}case"dashboardAction":{e.dispatchEvent(new CustomEvent("dashboardAction",{detail:{data:t.data}}));break}case"export":{t.data.error?F(e,t.data.requestId,t.data):(e.dispatchEvent(new CustomEvent("exported",{detail:{data:t.data}})),v(e,t.data.requestId,t.data));break}case"changedFilters":{e.dispatchEvent(new CustomEvent("changedFilters",{detail:{data:t.data}}));break}case"customEvent":{e.dispatchEvent(new CustomEvent("customEvent",{detail:{data:t.data}}));break}case"chartsRendered":case"itemsRendered":{t.data.type="itemsRendered",e.dispatchEvent(new CustomEvent("itemsRendered",{detail:{data:t.data}}));break}case"setEditMode":{t.data.error?F(e,t.data.requestId,t.data):(v(e,t.data.requestId,t.data),e.params.editMode=t.data.editMode,e._containerStyle=Q(e),e.dimensions&&ee(e));break}case"setFilters":{t.data.error?F(e,t.data.requestId,t.data):v(e,t.data.requestId,t.data);break}case"setPreview":{t.data.error?F(e,t.data.requestId,t.data):v(e,t.data.requestId,t.data);break}}},window.addEventListener("message",window.__luzmoMessageHandler,!1))};var At=ge`
2025
8
  @-webkit-keyframes spin {
2026
9
  0% {
2027
10
  -webkit-transform: rotate(0deg);
@@ -2121,421 +104,29 @@ ${errorMessage}`;
2121
104
  position: absolute;
2122
105
  transition-duration: 0.3s;
2123
106
  }
2124
- `;
2125
- var __defProp = Object.defineProperty;
2126
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2127
- var __decorateClass = (decorators, target, key, kind) => {
2128
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
2129
- for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
2130
- if (decorator = decorators[i2])
2131
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2132
- if (kind && result)
2133
- __defProp(target, key, result);
2134
- return result;
2135
- };
2136
- exports2.LuzmoDashboard = class LuzmoDashboard extends s {
2137
- constructor(inputParameters) {
2138
- super();
2139
- this.language = "auto";
2140
- this.screenMode = "auto";
2141
- this.switchScreenModeOnResize = true;
2142
- this.editMode = "view";
2143
- this.dev = false;
2144
- this.iframeStyle = {};
2145
- this._containerStyle = {};
2146
- this._loaderStyle = {};
2147
- this._lcStyle = {};
2148
- this._loadingCircleStyle = {};
2149
- this._containerLoaderStyle = {};
2150
- this._loaderMsg = "";
2151
- this._itemEmbedding = false;
2152
- this.browserError = false;
2153
- this.browserErrorMsg = "";
2154
- this.dashboardError = false;
2155
- this.browserNotSupported = [];
2156
- this.VERSION = version + "-wc-luzmo";
2157
- this.isLibraryLoaded = false;
2158
- this.attributesMap = {
2159
- dashboardId: "dashboard-id",
2160
- dashboardSlug: "dashboard-slug",
2161
- itemId: "item-id",
2162
- language: "language",
2163
- qeVersion: "qe-version",
2164
- screenMode: "screen-mode",
2165
- switchScreenModeOnResize: "switch-screen-mode-on-resize",
2166
- authKey: "auth-key",
2167
- authToken: "auth-token",
2168
- editMode: "edit-mode",
2169
- mainColor: "main-color",
2170
- accentColor: "accent-color",
2171
- loaderBackground: "loader-background",
2172
- loaderFontColor: "loader-font-color",
2173
- loaderSpinnerColor: "loader-spinner-color",
2174
- loaderSpinnerBackground: "loader-spinner-background",
2175
- appServer: "app-server",
2176
- apiHost: "api-host",
2177
- itemDimensions: "item-dimensions",
2178
- timezoneId: "timezone-id"
2179
- };
2180
- this.loaderSize = 32;
2181
- this.borderWidth = 3;
2182
- this.minHeight = 400;
2183
- this._containerId = uuidv4();
2184
- this._iframeId = `luzmo-dashboard-${this._containerId}`;
2185
- this.iframeLoaded = false;
2186
- this.promises = {};
2187
- this.setInputParameters(inputParameters);
2188
- this.params = this._setOptions();
2189
- this._onResize = () => {
2190
- var _a2;
2191
- if ((_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector(".dashboard-container")) {
2192
- this.containerWidth = this.container.clientWidth;
2193
- if (this.params.switchScreenModeOnResize && this.params.screenMode === "auto") {
2194
- for (const d2 of EXTENTS) {
2195
- if (d2.width[0] <= window.innerWidth && window.innerWidth <= d2.width[1]) {
2196
- this.currentScreenMode = d2.mode;
2197
- }
2198
- }
2199
- }
2200
- if (this.iframeLoaded) {
2201
- this._calculateDimAfterDashboardLoaded();
2202
- }
2203
- }
2204
- };
2205
- this._resizeObserver = new ResizeObserver((entries) => {
2206
- window.requestAnimationFrame(() => {
2207
- if (!Array.isArray(entries) || entries.length === 0) {
2208
- return;
2209
- }
2210
- this._onResize();
2211
- });
2212
- });
2213
- }
2214
- loadLibrary(appServer) {
2215
- if (remotesMap[appServer]) {
2216
- return Promise.resolve(remotesMap[appServer].module);
2217
- }
2218
- remotesMap[appServer] = { url: (appServer == null ? void 0 : appServer.startsWith("http://localhost")) ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`, format: "esm", from: "vite", module: void 0 };
2219
- return __federation_method_getRemote(appServer, "./DashboardApp").then((module2) => {
2220
- const wrappedModule = __federation_method_wrapDefault(module2, true);
2221
- remotesMap[appServer].module = wrappedModule;
2222
- return wrappedModule;
2223
- });
2224
- }
2225
- setInputParameters(inputParameters) {
2226
- if (!inputParameters) {
2227
- return;
2228
- }
2229
- const params = [
2230
- "dashboardId",
2231
- "dashboardSlug",
2232
- "itemId",
2233
- "language",
2234
- "qeVersion",
2235
- "screenMode",
2236
- "switchScreenModeOnResize",
2237
- "accentColor",
2238
- "mainColor",
2239
- "authToken",
2240
- "authKey",
2241
- "editMode",
2242
- "loaderBackground",
2243
- "loaderFontColor",
2244
- "loaderSpinnerColor",
2245
- "loaderSpinnerBackground",
2246
- "timezoneId",
2247
- "itemDimensions",
2248
- "apiHost"
2249
- ];
2250
- for (const key of params) {
2251
- const value = inputParameters[key];
2252
- if (value) {
2253
- this[key] = value;
2254
- }
2255
- }
2256
- if (inputParameters.dev) {
2257
- this.dev = inputParameters.dev;
2258
- }
2259
- if (inputParameters.appServer) {
2260
- this.appServer = addTrailingSlash(inputParameters.appServer);
2261
- }
2262
- }
2263
- // Set resize event listener
2264
- connectedCallback() {
2265
- super.connectedCallback();
2266
- }
2267
- // Set resize event listener
2268
- disconnectedCallback() {
2269
- super.disconnectedCallback();
2270
- this._resizeObserver.disconnect();
2271
- for (const promiseKey of Object.keys(this.promises)) {
2272
- this.promises[promiseKey].reject(
2273
- new Error("Dashboard component was removed")
2274
- );
2275
- }
2276
- }
2277
- firstUpdated() {
2278
- var _a2;
2279
- this._loaderMsg = (_a2 = getLoader(this)) == null ? void 0 : _a2.loadingMsg;
2280
- this._loaderStyles();
2281
- LuzmoService$1._components.push(this);
2282
- this.initComponent();
2283
- }
2284
- initComponent() {
2285
- var _a2, _b;
2286
- this.params = this._setOptions();
2287
- if (this.getIsViewMode()) {
2288
- this.loadLibrary(this.params.appServer).then(async () => {
2289
- this.isLibraryLoaded = true;
2290
- await this.updateComplete;
2291
- const oldReference = this.renderRoot.querySelector("dashboard-component");
2292
- this.dashboardReference = oldReference.cloneNode(true);
2293
- oldReference.replaceWith(this.dashboardReference);
2294
- this.dashboardReference.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
2295
- this.dashboardReference.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
2296
- this.dashboardReference.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
2297
- this.dashboardReference.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
2298
- this.dashboardReference.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
2299
- this.dashboardReference.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
2300
- this.setAllAttributes();
2301
- });
2302
- } else {
2303
- this.containerWidth = (_a2 = this.container) == null ? void 0 : _a2.clientWidth;
2304
- _extendAndValidate(this);
2305
- _browserCheck(this);
2306
- this._setupLoader();
2307
- if (!this.params.error) {
2308
- this._loaderStyles();
2309
- _setEventHandler();
2310
- this._iframeUrl = createIframeUrl(this);
2311
- (_b = this.iframe) == null ? void 0 : _b.setAttribute("src", this._iframeUrl);
2312
- this.iframeStyle = calculateIframeStyles(this);
2313
- }
2314
- if (this.container) {
2315
- this._resizeObserver.observe(this.container);
2316
- }
2317
- }
2318
- }
2319
- setAllAttributes() {
2320
- if (this.dashboardReference) {
2321
- for (const key in this.attributesMap) {
2322
- if (!["authKey", "authToken", "apiHost"].includes(key) && this.params[key]) {
2323
- this.dashboardReference.setAttribute(this.attributesMap[key], this.params[key]);
2324
- }
2325
- if (this.params.apiHost) {
2326
- this.dashboardReference.setAttribute("api-host", removeTrailingSlash(this.params.apiHost));
2327
- }
2328
- if (this.params.key) {
2329
- this.dashboardReference.setAttribute("auth-key", this.params.key);
2330
- }
2331
- if (this.params.token) {
2332
- this.dashboardReference.setAttribute("auth-token", this.params.token);
2333
- }
2334
- }
2335
- }
2336
- }
2337
- // Reload dashboard when triggerproperty changes
2338
- updated(changedProperties) {
2339
- const triggerProperties = /* @__PURE__ */ new Set([
2340
- "dashboardId",
2341
- "dashboardSlug",
2342
- "itemId",
2343
- "language",
2344
- "qeVersion",
2345
- "editMode",
2346
- "screenMode",
2347
- "switchScreenModeOnResize",
2348
- "authToken",
2349
- "authKey",
2350
- "appServer",
2351
- "timezoneId",
2352
- "itemDimensions"
2353
- ]);
2354
- if (!this.getIsViewMode()) {
2355
- for (const [propertyName] of changedProperties.entries()) {
2356
- if (triggerProperties.has(propertyName) && propertyName !== "editMode") {
2357
- this.iframeLoaded = false;
2358
- if (this._loadTimeoutHandle) {
2359
- clearTimeout(this._loadTimeoutHandle);
2360
- }
2361
- this._loadTimeoutHandle = setTimeout(() => {
2362
- console.error(
2363
- "Failed to load dashboard, appServer is likely down or unreachable."
2364
- );
2365
- }, 15 * 1e3);
2366
- this.params = this._setOptions();
2367
- _extendAndValidate(this);
2368
- this._setupLoader();
2369
- this._loaderStyles();
2370
- this._iframeUrl = createIframeUrl(this);
2371
- if (this.iframe) {
2372
- this._updateIframeUrl();
2373
- }
2374
- this.iframeStyle = calculateIframeStyles(this);
2375
- } else if (triggerProperties.has(propertyName) && propertyName === "editMode") {
2376
- if (this.iframeLoaded) {
2377
- this.setEditMode(this.editMode);
2378
- }
2379
- this.params = this._setOptions();
2380
- }
2381
- }
2382
- } else {
2383
- if (this.dashboardReference) {
2384
- for (const [propertyName] of changedProperties.entries()) {
2385
- if (propertyName === "appSever") {
2386
- this.loadLibrary(changedProperties[propertyName]).then(async () => {
2387
- this.isLibraryLoaded = true;
2388
- await this.updateComplete;
2389
- this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
2390
- this.setAllAttributes();
2391
- });
2392
- } else if (this.attributesMap[propertyName]) {
2393
- this.dashboardReference.setAttribute(this.attributesMap[propertyName] ?? propertyName, this[propertyName]);
2394
- }
2395
- }
2396
- }
2397
- }
2398
- }
2399
- // Set params
2400
- _setOptions() {
2401
- const defaultParameters = {
2402
- dashboardId: this.dashboardId,
2403
- dashboardSlug: this.dashboardSlug
2404
- };
2405
- if (this.itemId) {
2406
- defaultParameters.itemId = this.itemId;
2407
- this._itemEmbedding = true;
2408
- } else {
2409
- this._itemEmbedding = false;
2410
- }
2411
- if (this.language) {
2412
- defaultParameters.language = this.language;
2413
- }
2414
- if (this.qeVersion) {
2415
- defaultParameters.qeVersion = this.qeVersion;
2416
- }
2417
- if (this.screenMode) {
2418
- defaultParameters.screenMode = this.screenMode;
2419
- }
2420
- defaultParameters.switchScreenModeOnResize = this.switchScreenModeOnResize;
2421
- if (this.authToken) {
2422
- defaultParameters.token = this.authToken;
2423
- }
2424
- if (this.authKey) {
2425
- defaultParameters.key = this.authKey;
2426
- }
2427
- if (this.editMode) {
2428
- defaultParameters.editMode = this.editMode;
2429
- }
2430
- if (this.mainColor) {
2431
- defaultParameters.mainColor = this.mainColor;
2432
- }
2433
- if (this.accentColor) {
2434
- defaultParameters.accentColor = this.accentColor;
2435
- }
2436
- if (this.loaderBackground) {
2437
- defaultParameters.loaderBackground = this.loaderBackground;
2438
- }
2439
- if (this.loaderFontColor) {
2440
- defaultParameters.loaderFontColor = this.loaderFontColor;
2441
- }
2442
- if (this.loaderSpinnerColor) {
2443
- defaultParameters.loaderSpinnerColor = this.loaderSpinnerColor;
2444
- }
2445
- if (this.loaderSpinnerBackground) {
2446
- defaultParameters.loaderSpinnerBackground = this.loaderSpinnerBackground;
2447
- }
2448
- if (this.timezoneId) {
2449
- defaultParameters.timezoneId = this.timezoneId;
2450
- }
2451
- if (this.itemDimensions) {
2452
- defaultParameters.itemDimensions = this.itemDimensions;
2453
- }
2454
- if (this.appServer) {
2455
- this.appServer = this.getIsViewMode() ? removeTrailingSlash(this.appServer) : addTrailingSlash(this.appServer);
2456
- defaultParameters.appServer = this.appServer;
2457
- } else {
2458
- this.appServer = addTrailingSlash(
2459
- DEFAULT_PARAMETERS.appServer
2460
- );
2461
- defaultParameters.appServer = this.appServer;
2462
- }
2463
- if (this.apiHost) {
2464
- this.apiHost = this.getIsViewMode() ? removeTrailingSlash(this.apiHost) : addTrailingSlash(this.apiHost);
2465
- defaultParameters.apiHost = this.apiHost;
2466
- } else {
2467
- this.apiHost = this.appServer.endsWith("luzmo.com/") ? this.appServer.replace("app", "api") : this.appServer;
2468
- defaultParameters.apiHost = this.apiHost;
2469
- }
2470
- return defaultParameters;
2471
- }
2472
- _updateIframeUrl() {
2473
- updateIframeUrl(this.iframe, this._iframeUrl);
2474
- }
2475
- // Setup loader / browser error
2476
- _setupLoader() {
2477
- const data = getLoader(this);
2478
- this._loaderMsg = data.loadingMsg;
2479
- if (data.errorMsg) {
2480
- this.browserError = true;
2481
- this.browserErrorMsg = data.errorMsg;
2482
- this._displayError();
2483
- }
2484
- }
2485
- _displayError() {
2486
- if (this.dashboardError) {
2487
- this._loaderStyles();
2488
- this.iframeStyle.opacity = 1;
2489
- }
2490
- if (this.browserError) {
2491
- this._containerStyle.display = "none";
2492
- }
2493
- }
2494
- _calculateDimAfterDashboardLoaded() {
2495
- this.dashboardError = false;
2496
- this._loaderStyles();
2497
- _setCalculatedDimensions(this);
2498
- }
2499
- // Set loader styles
2500
- _loaderStyles() {
2501
- this._containerStyle = containerStyles(this);
2502
- this._loaderStyle = loaderStyles(this);
2503
- this._loadingCircleStyle = plStyles(this);
2504
- this._containerLoaderStyle = containerLoaderStyles(this);
2505
- this._lcStyle = lcStyles(this);
2506
- }
2507
- static get styles() {
2508
- return [dashboardStyles];
2509
- }
2510
- render() {
2511
- let toBeRenderedHTML = x``;
2512
- const loader = x`
107
+ `;var c=class extends ${constructor(r){super();this.language="auto";this.screenMode="auto";this.switchScreenModeOnResize=!0;this.editMode="view";this.experimental=!1;this.iframeStyle={};this._containerStyle={};this._loaderStyle={};this._lcStyle={};this._loadingCircleStyle={};this._containerLoaderStyle={};this._loaderMsg="";this._itemEmbedding=!1;this.browserError=!1;this.browserErrorMsg="";this.dashboardError=!1;this.browserNotSupported=[];this.VERSION=$t+"-wc-luzmo";this.isLibraryLoaded=!1;this.attributesMap={dashboardId:"dashboard-id",dashboardSlug:"dashboard-slug",itemId:"item-id",language:"language",qeVersion:"qe-version",screenMode:"screen-mode",switchScreenModeOnResize:"switch-screen-mode-on-resize",authKey:"auth-key",authToken:"auth-token",editMode:"edit-mode",mainColor:"main-color",accentColor:"accent-color",loaderBackground:"loader-background",loaderFontColor:"loader-font-color",loaderSpinnerColor:"loader-spinner-color",loaderSpinnerBackground:"loader-spinner-background",appServer:"app-server",apiHost:"api-host",itemDimensions:"item-dimensions",timezoneId:"timezone-id"};this.loaderSize=32;this.borderWidth=3;this.minHeight=400;this._containerId=y(),this._iframeId=`luzmo-dashboard-${this._containerId}`,this.iframeLoaded=!1,this.promises={},this.setInputParameters(r),this.params=this._setOptions(),this._onResize=()=>{if(this.shadowRoot?.querySelector(".dashboard-container")){if(this.containerWidth=this.container.clientWidth,this.params.switchScreenModeOnResize&&this.params.screenMode==="auto")for(let i of Y)i.width[0]<=window.innerWidth&&window.innerWidth<=i.width[1]&&(this.currentScreenMode=i.mode);this.iframeLoaded&&this._calculateDimAfterDashboardLoaded()}},this._resizeObserver=new ResizeObserver(i=>{window.requestAnimationFrame(()=>{!Array.isArray(i)||i.length===0||this._onResize()})})}loadLibrary(r){return k[r]?Promise.resolve(k[r].module):(k[r]={url:r?.startsWith("http://localhost")?`${T(r)}/remoteEntry.mjs`:`${T(r)}/dashboard-app/remoteEntry.mjs`,format:"esm",from:"vite",module:void 0},Qe(r,"./DashboardApp").then(i=>{let s=Ze(i,!0);return k[r].module=s,s}))}setInputParameters(r){if(!r)return;let i=["dashboardId","dashboardSlug","itemId","language","qeVersion","screenMode","switchScreenModeOnResize","accentColor","mainColor","authToken","authKey","editMode","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground","timezoneId","itemDimensions","apiHost"];for(let s of i){let o=r[s];o&&(this[s]=o)}r.experimental&&(this.experimental=r.experimental),r.appServer&&(this.appServer=z(r.appServer))}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver.disconnect();for(let r of Object.keys(this.promises))this.promises[r].reject(new Error("Dashboard component was removed"))}firstUpdated(){this._loaderMsg=he(this)?.loadingMsg,this._loaderStyles(),X._components.push(this),this.initComponent()}initComponent(){this.params=this._setOptions(),this.getIsViewMode()?this.loadLibrary(this.params.appServer).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete;let r=this.renderRoot.querySelector("dashboard-component");this.dashboardReference=r.cloneNode(!0),r.replaceWith(this.dashboardReference),this.dashboardReference.addEventListener("load",i=>this.dispatchEvent(new CustomEvent("load",i.detail))),this.dashboardReference.addEventListener("itemsRendered",i=>this.dispatchEvent(new CustomEvent("itemsRendered",i.detail))),this.dashboardReference.addEventListener("customEvent",i=>this.dispatchEvent(new CustomEvent("customEvent",i.detail))),this.dashboardReference.addEventListener("changedFilters",i=>this.dispatchEvent(new CustomEvent("changedFilters",i.detail))),this.dashboardReference.addEventListener("dashboardAction",i=>this.dispatchEvent(new CustomEvent("dashboardAction",i.detail))),this.dashboardReference.addEventListener("export",i=>this.dispatchEvent(new CustomEvent("exported",i.detail))),this.setAllAttributes()}):(this.containerWidth=this.container?.clientWidth,pe(this),Te(this),this._setupLoader(),this.params.error||(this._loaderStyles(),It(),this._iframeUrl=le(this),this.iframe?.setAttribute("src",this._iframeUrl),this.iframeStyle=ce(this)),this.container&&this._resizeObserver.observe(this.container))}setAllAttributes(){if(this.dashboardReference)for(let r in this.attributesMap)!["authKey","authToken","apiHost","itemDimensions"].includes(r)&&this.params[r]&&this.dashboardReference.setAttribute(this.attributesMap[r],this.params[r]),this.params.itemDimensions&&this.dashboardReference.setAttribute("item-dimensions",JSON.stringify(this.params.itemDimensions)),this.params.apiHost&&this.dashboardReference.setAttribute("api-host",T(this.params.apiHost)),this.params.key&&this.dashboardReference.setAttribute("auth-key",this.params.key),this.params.token&&this.dashboardReference.setAttribute("auth-token",this.params.token)}updated(r){let i=new Set(["dashboardId","dashboardSlug","itemId","language","qeVersion","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","timezoneId","itemDimensions"]);if(this.getIsViewMode()){if(this.dashboardReference){for(let[s]of r.entries())if(s==="appSever")this.loadLibrary(r[s]).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete,this.dashboardReference=this.renderRoot.querySelector("dashboard-component"),this.setAllAttributes()});else if(this.attributesMap[s]){let o=this.attributesMap[s]??s,a=typeof this[s]=="object"?JSON.stringify(this[s]):this[s]?.toString()||this[s];this.dashboardReference.setAttribute(o,a)}}}else for(let[s]of r.entries())i.has(s)&&s!=="editMode"?(this.iframeLoaded=!1,this._loadTimeoutHandle&&clearTimeout(this._loadTimeoutHandle),this._loadTimeoutHandle=setTimeout(()=>{console.error("Failed to load dashboard, appServer is likely down or unreachable.")},15*1e3),this.params=this._setOptions(),pe(this),this._setupLoader(),this._loaderStyles(),this._iframeUrl=le(this),this.iframe&&this._updateIframeUrl(),this.iframeStyle=ce(this)):i.has(s)&&s==="editMode"&&(this.iframeLoaded&&this.setEditMode(this.editMode),this.params=this._setOptions())}_setOptions(){let r={dashboardId:this.dashboardId,dashboardSlug:this.dashboardSlug};return this.itemId?(r.itemId=this.itemId,this._itemEmbedding=!0):this._itemEmbedding=!1,this.language&&(r.language=this.language),this.qeVersion&&(r.qeVersion=this.qeVersion),this.screenMode&&(r.screenMode=this.screenMode),r.switchScreenModeOnResize=this.switchScreenModeOnResize,this.authToken&&(r.token=this.authToken),this.authKey&&(r.key=this.authKey),this.editMode&&(r.editMode=this.editMode),this.mainColor&&(r.mainColor=this.mainColor),this.accentColor&&(r.accentColor=this.accentColor),this.loaderBackground&&(r.loaderBackground=this.loaderBackground),this.loaderFontColor&&(r.loaderFontColor=this.loaderFontColor),this.loaderSpinnerColor&&(r.loaderSpinnerColor=this.loaderSpinnerColor),this.loaderSpinnerBackground&&(r.loaderSpinnerBackground=this.loaderSpinnerBackground),this.timezoneId&&(r.timezoneId=this.timezoneId),this.itemDimensions&&(r.itemDimensions=this.itemDimensions),this.appServer?(this.appServer=this.getIsViewMode()?T(this.appServer):z(this.appServer),r.appServer=this.appServer):(this.appServer=z(w.appServer),r.appServer=this.appServer),this.apiHost?(this.apiHost=this.getIsViewMode()?T(this.apiHost):z(this.apiHost),r.apiHost=this.apiHost):(this.apiHost=this.appServer.includes("luzmo.com")?this.appServer.replace("app","api"):this.appServer,r.apiHost=this.apiHost),r}_updateIframeUrl(){Ve(this.iframe,this._iframeUrl)}_setupLoader(){let r=he(this);this._loaderMsg=r.loadingMsg,r.errorMsg&&(this.browserError=!0,this.browserErrorMsg=r.errorMsg,this._displayError())}_displayError(){this.dashboardError&&(this._loaderStyles(),this.iframeStyle.opacity=1),this.browserError&&(this._containerStyle.display="none")}_calculateDimAfterDashboardLoaded(){this.dashboardError=!1,this._loaderStyles(),ee(this)}_loaderStyles(){this._containerStyle=Q(this),this._loaderStyle=Ne(this),this._loadingCircleStyle=Ue(this),this._containerLoaderStyle=Fe(this),this._lcStyle=je(this)}static get styles(){return[At]}render(){let r=_``,i=_`
2513
108
  <div
2514
109
  class="luzmo-container-loader"
2515
110
  id="luzmo-container-loader-${this._containerId}"
2516
- style=${o(
2517
- this._containerLoaderStyle
2518
- )}
111
+ style=${I(this._containerLoaderStyle)}
2519
112
  >
2520
113
  <div
2521
114
  class="luzmo-loader"
2522
115
  id="luzmo-loader-${this._containerId}"
2523
- style=${o(this._loaderStyle)}
116
+ style=${I(this._loaderStyle)}
2524
117
  >
2525
118
  <div
2526
119
  class="luzmo-lc"
2527
- style=${o(this._lcStyle)}
120
+ style=${I(this._lcStyle)}
2528
121
  >
2529
122
  <div
2530
123
  class="luzmo-loading-circle"
2531
- style=${o(
2532
- this._loadingCircleStyle
2533
- )}
124
+ style=${I(this._loadingCircleStyle)}
2534
125
  ></div>
2535
- ${this._itemEmbedding ? "" : x`
126
+ ${this._itemEmbedding?"":_`
2536
127
  <div
2537
128
  class="luzmo-loading-message"
2538
- style=${o({ color: this.loaderFontColor })}
129
+ style=${I({color:this.loaderFontColor})}
2539
130
  >
2540
131
  ${this._loaderMsg}
2541
132
  </div>
@@ -2543,310 +134,162 @@ ${errorMessage}`;
2543
134
  </div>
2544
135
  </div>
2545
136
  </div>
2546
- `;
2547
- if (!this.getIsViewMode()) {
2548
- toBeRenderedHTML = x`
2549
- ${this.dashboardId || this.dashboardSlug ? x`
2550
- ${loader}
137
+ `;return this.getIsViewMode()?r=this.isLibraryLoaded?_`
138
+ ${this.dashboardId||this.dashboardSlug?_`<dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}" api-host="${this.params.apiHost}"></dashboard-component>`:_`
139
+ <div id="luzmo-error-${this._containerId}">
140
+ <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
141
+ </div>
142
+ `}
143
+ `:_`${i}`:r=_`
144
+ ${this.dashboardId||this.dashboardSlug?_`
145
+ ${i}
2551
146
  <iframe
2552
147
  class="luzmo-embed-dashboard"
2553
148
  id="${this._iframeId}"
2554
149
  name="${this._iframeId}"
2555
- style=${o(this.iframeStyle)}
150
+ style=${I(this.iframeStyle)}
2556
151
  src="${this._iframeUrl}"
2557
152
  frameborder="0"
2558
153
  ></iframe>
2559
- ` : x`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
2560
- ${this.browserError ? x`
154
+ `:_`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
155
+ ${this.browserError?_`
2561
156
  <div id="luzmo-error-${this._containerId}">
2562
157
  <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
2563
158
  </div>
2564
- ` : ""}
2565
- `;
2566
- } else {
2567
- toBeRenderedHTML = this.isLibraryLoaded ? x`
2568
- ${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`
2569
- <div id="luzmo-error-${this._containerId}">
2570
- <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
2571
- </div>
2572
- `}
2573
- ` : x`${loader}`;
2574
- }
2575
- return x`
159
+ `:""}
160
+ `,_`
2576
161
  <div
2577
162
  class="dashboard-container"
2578
- style=${o(this._containerStyle)}
163
+ style=${I(Object.assign({},this._containerStyle,{width:this.iframeStyle.width??"100%",height:this.iframeStyle.height??"100%"}))}
2579
164
  >
2580
- ${toBeRenderedHTML}
165
+ ${r}
2581
166
  </div>
2582
- `;
2583
- }
2584
- getDashboards() {
2585
- return new Promise(
2586
- (resolve) => resolve(LuzmoService$1._components)
2587
- );
2588
- }
2589
- // Public methods
2590
- getData(itemId) {
2591
- if (this.getIsViewMode() && this.dashboardReference) {
2592
- return this.dashboardReference.getData(itemId);
2593
- }
2594
- if (!this.getIsViewMode()) {
2595
- return getData(this, this.iframe, itemId);
2596
- }
2597
- return Promise.reject();
2598
- }
2599
- getFilters() {
2600
- if (this.getIsViewMode() && this.dashboardReference) {
2601
- return this.dashboardReference.getFilters();
2602
- }
2603
- if (!this.getIsViewMode()) {
2604
- return getFilters(this, this.iframe);
2605
- }
2606
- return Promise.reject();
2607
- }
2608
- setFilters(itemId, filters) {
2609
- if (this.getIsViewMode() && this.dashboardReference) {
2610
- return Promise.reject();
2611
- }
2612
- if (!this.getIsViewMode()) {
2613
- return setFilters(this, this.iframe, itemId, filters);
2614
- }
2615
- return Promise.reject();
2616
- }
2617
- setAuthorization(key, token) {
2618
- if (this.getIsViewMode() && this.dashboardReference) {
2619
- return this.dashboardReference.setAuthorization(key, token);
2620
- }
2621
- if (!this.getIsViewMode()) {
2622
- return setAuthorization(this, this.iframe, key, token);
2623
- }
2624
- return Promise.reject();
2625
- }
2626
- refreshData(itemId) {
2627
- if (this.getIsViewMode() && this.dashboardReference) {
2628
- return this.dashboardReference.refreshData(itemId);
2629
- }
2630
- if (!this.getIsViewMode()) {
2631
- return itemId ? refreshData(this, this.iframe, itemId) : refreshData(this, this.iframe);
2632
- }
2633
- return Promise.reject();
2634
- }
2635
- reloadDashboard() {
2636
- if (this.getIsViewMode() && this.dashboardReference) {
2637
- return this.dashboardReference.reloadDashboard();
2638
- }
2639
- if (!this.getIsViewMode()) {
2640
- return reloadDashboard(this, this.iframe);
2641
- }
2642
- return Promise.reject();
2643
- }
2644
- exportDashboard(format) {
2645
- if (this.getIsViewMode() && this.dashboardReference) {
2646
- return this.dashboardReference.exportDashboard(format);
2647
- }
2648
- if (!this.getIsViewMode()) {
2649
- return format ? exportDashboard(this, this.iframe, format) : exportDashboard(this, this.iframe);
2650
- }
2651
- return Promise.reject();
2652
- }
2653
- getAccessibleDashboards() {
2654
- if (!this.getIsViewMode()) {
2655
- return getAccessibleDashboards(this, this.iframe);
2656
- }
2657
- if (this.getIsViewMode() && this.dashboardReference) {
2658
- return this.dashboardReference.getAccessibleDashboards();
2659
- }
2660
- return Promise.reject();
2661
- }
2662
- setEditMode(editMode) {
2663
- if (this.dashboardReference && editMode === "view") {
2664
- this.editMode = "view";
2665
- this.params.editMode = "view";
2666
- this.initComponent();
2667
- return Promise.resolve({
2668
- type: "setEditMode",
2669
- editMode
2670
- });
2671
- }
2672
- if (this.dashboardReference && ["editFull", "editLimited"].includes(editMode)) {
2673
- this.editMode = editMode;
2674
- this.params.editMode = editMode;
2675
- this.initComponent();
2676
- return Promise.resolve({
2677
- type: "setEditMode",
2678
- editMode
2679
- });
2680
- }
2681
- if (this.getIsViewMode() && this.dashboardReference) {
2682
- return this.dashboardReference.setEditMode(editMode);
2683
- }
2684
- if (!this.getIsViewMode()) {
2685
- return setEditMode(this, this.iframe, editMode);
2686
- }
2687
- return Promise.reject();
2688
- }
2689
- setPreview(preview) {
2690
- if (this.getIsViewMode() && this.dashboardReference) {
2691
- return this.dashboardReference.setPreview(preview);
2692
- }
2693
- return setPreview(this, this.iframe, preview);
2694
- }
2695
- getIsViewMode() {
2696
- if (this.dev && this.params.editMode === "view" || this.params.editMode === void 0) {
2697
- return true;
2698
- }
2699
- return false;
2700
- }
2701
- };
2702
- __decorateClass([
2703
- e$1(".dashboard-container")
2704
- ], exports2.LuzmoDashboard.prototype, "container", 2);
2705
- __decorateClass([
2706
- e$1("iframe")
2707
- ], exports2.LuzmoDashboard.prototype, "iframe", 2);
2708
- __decorateClass([
2709
- n$1()
2710
- ], exports2.LuzmoDashboard.prototype, "dashboardId", 2);
2711
- __decorateClass([
2712
- n$1()
2713
- ], exports2.LuzmoDashboard.prototype, "dashboardSlug", 2);
2714
- __decorateClass([
2715
- n$1()
2716
- ], exports2.LuzmoDashboard.prototype, "itemId", 2);
2717
- __decorateClass([
2718
- n$1()
2719
- ], exports2.LuzmoDashboard.prototype, "language", 2);
2720
- __decorateClass([
2721
- n$1()
2722
- ], exports2.LuzmoDashboard.prototype, "qeVersion", 2);
2723
- __decorateClass([
2724
- n$1()
2725
- ], exports2.LuzmoDashboard.prototype, "screenMode", 2);
2726
- __decorateClass([
2727
- n$1({
2728
- converter: {
2729
- fromAttribute: (value) => value === "true",
2730
- toAttribute: String
2731
- }
2732
- })
2733
- ], exports2.LuzmoDashboard.prototype, "switchScreenModeOnResize", 2);
2734
- __decorateClass([
2735
- n$1()
2736
- ], exports2.LuzmoDashboard.prototype, "editMode", 2);
2737
- __decorateClass([
2738
- n$1()
2739
- ], exports2.LuzmoDashboard.prototype, "mainColor", 2);
2740
- __decorateClass([
2741
- n$1()
2742
- ], exports2.LuzmoDashboard.prototype, "accentColor", 2);
2743
- __decorateClass([
2744
- n$1()
2745
- ], exports2.LuzmoDashboard.prototype, "authToken", 2);
2746
- __decorateClass([
2747
- n$1()
2748
- ], exports2.LuzmoDashboard.prototype, "authKey", 2);
2749
- __decorateClass([
2750
- n$1()
2751
- ], exports2.LuzmoDashboard.prototype, "loaderBackground", 2);
2752
- __decorateClass([
2753
- n$1()
2754
- ], exports2.LuzmoDashboard.prototype, "loaderFontColor", 2);
2755
- __decorateClass([
2756
- n$1()
2757
- ], exports2.LuzmoDashboard.prototype, "loaderSpinnerColor", 2);
2758
- __decorateClass([
2759
- n$1()
2760
- ], exports2.LuzmoDashboard.prototype, "loaderSpinnerBackground", 2);
2761
- __decorateClass([
2762
- n$1()
2763
- ], exports2.LuzmoDashboard.prototype, "appServer", 2);
2764
- __decorateClass([
2765
- n$1()
2766
- ], exports2.LuzmoDashboard.prototype, "timezoneId", 2);
2767
- __decorateClass([
2768
- n$1()
2769
- ], exports2.LuzmoDashboard.prototype, "apiHost", 2);
2770
- __decorateClass([
2771
- n$1({ type: Object })
2772
- ], exports2.LuzmoDashboard.prototype, "itemDimensions", 2);
2773
- __decorateClass([
2774
- n$1()
2775
- ], exports2.LuzmoDashboard.prototype, "dev", 2);
2776
- __decorateClass([
2777
- n$1({ attribute: false })
2778
- ], exports2.LuzmoDashboard.prototype, "_containerId", 2);
2779
- __decorateClass([
2780
- n$1({ attribute: false })
2781
- ], exports2.LuzmoDashboard.prototype, "_iframeId", 2);
2782
- __decorateClass([
2783
- n$1({ attribute: false })
2784
- ], exports2.LuzmoDashboard.prototype, "params", 2);
2785
- __decorateClass([
2786
- n$1({ attribute: false })
2787
- ], exports2.LuzmoDashboard.prototype, "_iframeUrl", 2);
2788
- __decorateClass([
2789
- n$1({ attribute: false })
2790
- ], exports2.LuzmoDashboard.prototype, "iframeLoaded", 2);
2791
- __decorateClass([
2792
- n$1({ attribute: false })
2793
- ], exports2.LuzmoDashboard.prototype, "promises", 2);
2794
- __decorateClass([
2795
- n$1({ attribute: false })
2796
- ], exports2.LuzmoDashboard.prototype, "iframeStyle", 2);
2797
- __decorateClass([
2798
- n$1({ attribute: false })
2799
- ], exports2.LuzmoDashboard.prototype, "_containerStyle", 2);
2800
- __decorateClass([
2801
- n$1({ attribute: false })
2802
- ], exports2.LuzmoDashboard.prototype, "_loaderStyle", 2);
2803
- __decorateClass([
2804
- n$1({ attribute: false })
2805
- ], exports2.LuzmoDashboard.prototype, "_lcStyle", 2);
2806
- __decorateClass([
2807
- n$1({ attribute: false })
2808
- ], exports2.LuzmoDashboard.prototype, "_loadingCircleStyle", 2);
2809
- __decorateClass([
2810
- n$1({ attribute: false })
2811
- ], exports2.LuzmoDashboard.prototype, "_containerLoaderStyle", 2);
2812
- __decorateClass([
2813
- n$1({ attribute: false })
2814
- ], exports2.LuzmoDashboard.prototype, "_loaderMsg", 2);
2815
- __decorateClass([
2816
- n$1({ attribute: false })
2817
- ], exports2.LuzmoDashboard.prototype, "containerWidth", 2);
2818
- __decorateClass([
2819
- n$1({ attribute: false })
2820
- ], exports2.LuzmoDashboard.prototype, "dimensions", 2);
2821
- __decorateClass([
2822
- n$1({ attribute: false })
2823
- ], exports2.LuzmoDashboard.prototype, "currentScreenMode", 2);
2824
- __decorateClass([
2825
- n$1({ attribute: false })
2826
- ], exports2.LuzmoDashboard.prototype, "_itemEmbedding", 2);
2827
- __decorateClass([
2828
- n$1({ attribute: false })
2829
- ], exports2.LuzmoDashboard.prototype, "browserError", 2);
2830
- __decorateClass([
2831
- n$1({ attribute: false })
2832
- ], exports2.LuzmoDashboard.prototype, "browserErrorMsg", 2);
2833
- __decorateClass([
2834
- n$1({ attribute: false })
2835
- ], exports2.LuzmoDashboard.prototype, "dashboardError", 2);
2836
- __decorateClass([
2837
- n$1({ attribute: false })
2838
- ], exports2.LuzmoDashboard.prototype, "browserNotSupported", 2);
2839
- __decorateClass([
2840
- n$1({ attribute: false })
2841
- ], exports2.LuzmoDashboard.prototype, "VERSION", 2);
2842
- __decorateClass([
2843
- r()
2844
- ], exports2.LuzmoDashboard.prototype, "isLibraryLoaded", 2);
2845
- __decorateClass([
2846
- r()
2847
- ], exports2.LuzmoDashboard.prototype, "dashboardReference", 2);
2848
- exports2.LuzmoDashboard = __decorateClass([
2849
- t$1("luzmo-dashboard")
2850
- ], exports2.LuzmoDashboard);
2851
- Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
2852
- });
167
+ `}getDashboards(){return new Promise(r=>r(X._components))}getData(r){return this.getIsViewMode()&&this.dashboardReference?this.dashboardReference.getData(r):this.getIsViewMode()?Promise.reject():Be(this,this.iframe,r)}getFilters(){return this.getIsViewMode()&&this.dashboardReference?this.dashboardReference.getFilters():this.getIsViewMode()?Promise.reject():qe(this,this.iframe)}setFilters(r,i){return this.getIsViewMode()&&this.dashboardReference?this.dashboardReference.setFilters(r,i):this.getIsViewMode()?Promise.reject():Je(this,this.iframe,r,i)}setAuthorization(r,i){return this.getIsViewMode()&&this.dashboardReference?this.dashboardReference.setAuthorization(r,i):this.getIsViewMode()?Promise.reject():Ke(this,this.iframe,r,i)}refreshData(r){return this.getIsViewMode()&&this.dashboardReference?this.dashboardReference.refreshData(r):this.getIsViewMode()?Promise.reject():r?ue(this,this.iframe,r):ue(this,this.iframe)}reloadDashboard(){return this.getIsViewMode()&&this.dashboardReference?this.dashboardReference.reloadDashboard():this.getIsViewMode()?Promise.reject():Ce(this,this.iframe)}exportDashboard(r){return this.getIsViewMode()&&this.dashboardReference?this.dashboardReference.exportDashboard(r):this.getIsViewMode()?Promise.reject():r?me(this,this.iframe,r):me(this,this.iframe)}getAccessibleDashboards(){return this.getIsViewMode()?this.getIsViewMode()&&this.dashboardReference?this.dashboardReference.getAccessibleDashboards():Promise.reject():We(this,this.iframe)}addFilters(r,i){return this.dashboardReference.addFilters(r,i)}setEditMode(r){return this.dashboardReference&&r==="view"?(this.editMode="view",this.params.editMode="view",this.initComponent(),Promise.resolve({type:"setEditMode",editMode:r})):this.dashboardReference&&["editFull","editLimited"].includes(r)?(this.editMode=r,this.params.editMode=r,this.initComponent(),Promise.resolve({type:"setEditMode",editMode:r})):this.getIsViewMode()&&this.dashboardReference?this.dashboardReference.setEditMode(r):this.getIsViewMode()?Promise.reject():Ge(this,this.iframe,r)}setPreview(r){return this.getIsViewMode()&&this.dashboardReference?this.dashboardReference.setPreview(r):Xe(this,this.iframe,r)}getIsViewMode(){return!!(this.experimental&&this.params.editMode==="view"||this.params.editMode===void 0)}};m([Me(".dashboard-container")],c.prototype,"container",2),m([Me("iframe")],c.prototype,"iframe",2),m([u()],c.prototype,"dashboardId",2),m([u()],c.prototype,"dashboardSlug",2),m([u()],c.prototype,"itemId",2),m([u()],c.prototype,"language",2),m([u()],c.prototype,"qeVersion",2),m([u()],c.prototype,"screenMode",2),m([u({converter:{fromAttribute:r=>r==="true",toAttribute:String}})],c.prototype,"switchScreenModeOnResize",2),m([u()],c.prototype,"editMode",2),m([u()],c.prototype,"mainColor",2),m([u()],c.prototype,"accentColor",2),m([u()],c.prototype,"authToken",2),m([u()],c.prototype,"authKey",2),m([u()],c.prototype,"loaderBackground",2),m([u()],c.prototype,"loaderFontColor",2),m([u()],c.prototype,"loaderSpinnerColor",2),m([u()],c.prototype,"loaderSpinnerBackground",2),m([u()],c.prototype,"appServer",2),m([u()],c.prototype,"timezoneId",2),m([u()],c.prototype,"apiHost",2),m([u({type:Object})],c.prototype,"itemDimensions",2),m([u()],c.prototype,"experimental",2),m([u({attribute:!1})],c.prototype,"_containerId",2),m([u({attribute:!1})],c.prototype,"_iframeId",2),m([u({attribute:!1})],c.prototype,"params",2),m([u({attribute:!1})],c.prototype,"_iframeUrl",2),m([u({attribute:!1})],c.prototype,"iframeLoaded",2),m([u({attribute:!1})],c.prototype,"promises",2),m([u({attribute:!1})],c.prototype,"iframeStyle",2),m([u({attribute:!1})],c.prototype,"_containerStyle",2),m([u({attribute:!1})],c.prototype,"_loaderStyle",2),m([u({attribute:!1})],c.prototype,"_lcStyle",2),m([u({attribute:!1})],c.prototype,"_loadingCircleStyle",2),m([u({attribute:!1})],c.prototype,"_containerLoaderStyle",2),m([u({attribute:!1})],c.prototype,"_loaderMsg",2),m([u({attribute:!1})],c.prototype,"containerWidth",2),m([u({attribute:!1})],c.prototype,"dimensions",2),m([u({attribute:!1})],c.prototype,"currentScreenMode",2),m([u({attribute:!1})],c.prototype,"_itemEmbedding",2),m([u({attribute:!1})],c.prototype,"browserError",2),m([u({attribute:!1})],c.prototype,"browserErrorMsg",2),m([u({attribute:!1})],c.prototype,"dashboardError",2),m([u({attribute:!1})],c.prototype,"browserNotSupported",2),m([u({attribute:!1})],c.prototype,"VERSION",2),m([ve()],c.prototype,"isLibraryLoaded",2),m([ve()],c.prototype,"dashboardReference",2),c=m([xt("luzmo-dashboard")],c);export{c as LuzmoDashboard};
168
+ /*! Bundled license information:
169
+
170
+ @lit-labs/ssr-dom-shim/lib/element-internals.js:
171
+ (**
172
+ * @license
173
+ * Copyright 2023 Google LLC
174
+ * SPDX-License-Identifier: BSD-3-Clause
175
+ *)
176
+
177
+ @lit-labs/ssr-dom-shim/index.js:
178
+ (**
179
+ * @license
180
+ * Copyright 2019 Google LLC
181
+ * SPDX-License-Identifier: BSD-3-Clause
182
+ *)
183
+
184
+ @lit/reactive-element/node/css-tag.js:
185
+ (**
186
+ * @license
187
+ * Copyright 2019 Google LLC
188
+ * SPDX-License-Identifier: BSD-3-Clause
189
+ *)
190
+
191
+ lit-html/node/lit-html.js:
192
+ (**
193
+ * @license
194
+ * Copyright 2017 Google LLC
195
+ * SPDX-License-Identifier: BSD-3-Clause
196
+ *)
197
+
198
+ lit-element/lit-element.js:
199
+ (**
200
+ * @license
201
+ * Copyright 2017 Google LLC
202
+ * SPDX-License-Identifier: BSD-3-Clause
203
+ *)
204
+
205
+ lit-html/node/is-server.js:
206
+ (**
207
+ * @license
208
+ * Copyright 2022 Google LLC
209
+ * SPDX-License-Identifier: BSD-3-Clause
210
+ *)
211
+
212
+ @lit/reactive-element/node/decorators/custom-element.js:
213
+ (**
214
+ * @license
215
+ * Copyright 2017 Google LLC
216
+ * SPDX-License-Identifier: BSD-3-Clause
217
+ *)
218
+
219
+ @lit/reactive-element/node/decorators/property.js:
220
+ (**
221
+ * @license
222
+ * Copyright 2017 Google LLC
223
+ * SPDX-License-Identifier: BSD-3-Clause
224
+ *)
225
+
226
+ @lit/reactive-element/node/decorators/state.js:
227
+ (**
228
+ * @license
229
+ * Copyright 2017 Google LLC
230
+ * SPDX-License-Identifier: BSD-3-Clause
231
+ *)
232
+
233
+ @lit/reactive-element/node/decorators/event-options.js:
234
+ (**
235
+ * @license
236
+ * Copyright 2017 Google LLC
237
+ * SPDX-License-Identifier: BSD-3-Clause
238
+ *)
239
+
240
+ @lit/reactive-element/node/decorators/base.js:
241
+ (**
242
+ * @license
243
+ * Copyright 2017 Google LLC
244
+ * SPDX-License-Identifier: BSD-3-Clause
245
+ *)
246
+
247
+ @lit/reactive-element/node/decorators/query.js:
248
+ (**
249
+ * @license
250
+ * Copyright 2017 Google LLC
251
+ * SPDX-License-Identifier: BSD-3-Clause
252
+ *)
253
+
254
+ @lit/reactive-element/node/decorators/query-all.js:
255
+ (**
256
+ * @license
257
+ * Copyright 2017 Google LLC
258
+ * SPDX-License-Identifier: BSD-3-Clause
259
+ *)
260
+
261
+ @lit/reactive-element/node/decorators/query-async.js:
262
+ (**
263
+ * @license
264
+ * Copyright 2017 Google LLC
265
+ * SPDX-License-Identifier: BSD-3-Clause
266
+ *)
267
+
268
+ @lit/reactive-element/node/decorators/query-assigned-elements.js:
269
+ (**
270
+ * @license
271
+ * Copyright 2021 Google LLC
272
+ * SPDX-License-Identifier: BSD-3-Clause
273
+ *)
274
+
275
+ @lit/reactive-element/node/decorators/query-assigned-nodes.js:
276
+ (**
277
+ * @license
278
+ * Copyright 2017 Google LLC
279
+ * SPDX-License-Identifier: BSD-3-Clause
280
+ *)
281
+
282
+ lit-html/node/directive.js:
283
+ (**
284
+ * @license
285
+ * Copyright 2017 Google LLC
286
+ * SPDX-License-Identifier: BSD-3-Clause
287
+ *)
288
+
289
+ lit-html/node/directives/style-map.js:
290
+ (**
291
+ * @license
292
+ * Copyright 2018 Google LLC
293
+ * SPDX-License-Identifier: BSD-3-Clause
294
+ *)
295
+ */