@onlive.ai/common-121 0.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -0
- package/package.json +39 -0
- package/services/audio.service.cjs +75 -0
- package/services/audio.service.d.cts +14 -0
- package/services/audio.service.d.ts +14 -0
- package/services/audio.service.js +52 -0
- package/services/firebase/firebase-api.cjs +108 -0
- package/services/firebase/firebase-api.d.cts +54 -0
- package/services/firebase/firebase-api.d.ts +54 -0
- package/services/firebase/firebase-api.js +105 -0
- package/services/firebase/firebase.service.cjs +193 -0
- package/services/firebase/firebase.service.d.cts +40 -0
- package/services/firebase/firebase.service.d.ts +40 -0
- package/services/firebase/firebase.service.js +190 -0
- package/services/livekit.service.cjs +353 -0
- package/services/livekit.service.d.cts +131 -0
- package/services/livekit.service.d.ts +131 -0
- package/services/livekit.service.js +329 -0
- package/services/request.provider.cjs +48 -0
- package/services/request.provider.d.cts +27 -0
- package/services/request.provider.d.ts +27 -0
- package/services/request.provider.js +22 -0
- package/themes/dark.cjs +433 -0
- package/themes/dark.d.cts +5 -0
- package/themes/dark.d.ts +5 -0
- package/themes/dark.js +408 -0
- package/themes/light.cjs +433 -0
- package/themes/light.d.cts +5 -0
- package/themes/light.d.ts +5 -0
- package/themes/light.js +408 -0
- package/types/tracking-options.cjs +18 -0
- package/types/tracking-options.d.cts +27 -0
- package/types/tracking-options.d.ts +27 -0
- package/types/tracking-options.js +0 -0
- package/types/window-context.cjs +18 -0
- package/types/window-context.d.cts +8 -0
- package/types/window-context.d.ts +8 -0
- package/types/window-context.js +0 -0
- package/utils/adopt-styles.cjs +66 -0
- package/utils/adopt-styles.d.cts +5 -0
- package/utils/adopt-styles.d.ts +5 -0
- package/utils/adopt-styles.js +41 -0
- package/utils/browser-preferences.cjs +67 -0
- package/utils/browser-preferences.d.cts +18 -0
- package/utils/browser-preferences.d.ts +18 -0
- package/utils/browser-preferences.js +42 -0
- package/utils/classify-media.cjs +38 -0
- package/utils/classify-media.d.cts +9 -0
- package/utils/classify-media.d.ts +9 -0
- package/utils/classify-media.js +13 -0
- package/utils/decorators.cjs +53 -0
- package/utils/decorators.d.cts +34 -0
- package/utils/decorators.d.ts +34 -0
- package/utils/decorators.js +28 -0
- package/utils/detected-lang.cjs +47 -0
- package/utils/detected-lang.d.cts +10 -0
- package/utils/detected-lang.d.ts +10 -0
- package/utils/detected-lang.js +22 -0
- package/utils/fullscreen.cjs +52 -0
- package/utils/fullscreen.d.cts +16 -0
- package/utils/fullscreen.d.ts +16 -0
- package/utils/fullscreen.js +26 -0
- package/utils/insert-script.cjs +55 -0
- package/utils/insert-script.d.cts +29 -0
- package/utils/insert-script.d.ts +29 -0
- package/utils/insert-script.js +30 -0
- package/utils/markdown.cjs +103 -0
- package/utils/markdown.d.cts +12 -0
- package/utils/markdown.d.ts +12 -0
- package/utils/markdown.js +68 -0
- package/utils/merge.cjs +47 -0
- package/utils/merge.d.cts +23 -0
- package/utils/merge.d.ts +23 -0
- package/utils/merge.js +22 -0
- package/utils/multiband-track-volume.cjs +90 -0
- package/utils/multiband-track-volume.d.cts +27 -0
- package/utils/multiband-track-volume.d.ts +27 -0
- package/utils/multiband-track-volume.js +65 -0
- package/utils/onlive-url-params.cjs +38 -0
- package/utils/onlive-url-params.d.cts +14 -0
- package/utils/onlive-url-params.d.ts +14 -0
- package/utils/onlive-url-params.js +13 -0
- package/utils/pretty-distance.cjs +45 -0
- package/utils/pretty-distance.d.cts +46 -0
- package/utils/pretty-distance.d.ts +46 -0
- package/utils/pretty-distance.js +20 -0
- package/utils/random-string.cjs +37 -0
- package/utils/random-string.d.cts +9 -0
- package/utils/random-string.d.ts +9 -0
- package/utils/random-string.js +12 -0
- package/utils/resource-type.cjs +50 -0
- package/utils/resource-type.d.cts +16 -0
- package/utils/resource-type.d.ts +16 -0
- package/utils/resource-type.js +24 -0
- package/utils/safe-html.cjs +112 -0
- package/utils/safe-html.d.cts +12 -0
- package/utils/safe-html.d.ts +12 -0
- package/utils/safe-html.js +77 -0
- package/utils/sanitize.cjs +94 -0
- package/utils/sanitize.d.cts +11 -0
- package/utils/sanitize.d.ts +11 -0
- package/utils/sanitize.js +59 -0
- package/utils/spread.cjs +70 -0
- package/utils/spread.d.cts +14 -0
- package/utils/spread.d.ts +14 -0
- package/utils/spread.js +47 -0
- package/utils/watch.cjs +54 -0
- package/utils/watch.d.cts +28 -0
- package/utils/watch.d.ts +28 -0
- package/utils/watch.js +29 -0
- package/vite-env.d.ts +22 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// utils/browser-preferences.ts
|
|
21
|
+
var browser_preferences_exports = {};
|
|
22
|
+
__export(browser_preferences_exports, {
|
|
23
|
+
browserPreferences: () => browserPreferences
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(browser_preferences_exports);
|
|
26
|
+
function browserPreferences() {
|
|
27
|
+
if (typeof window === "undefined") {
|
|
28
|
+
return {
|
|
29
|
+
pageUrl: "",
|
|
30
|
+
language: "en",
|
|
31
|
+
timezone: "UTC",
|
|
32
|
+
timezoneOffset: 0,
|
|
33
|
+
userAgent: "",
|
|
34
|
+
colorScheme: "light",
|
|
35
|
+
screenWidth: 0,
|
|
36
|
+
screenHeight: 0,
|
|
37
|
+
screenSize: "medium",
|
|
38
|
+
devicePixelRatio: 1
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const pageUrl = window.location.href;
|
|
42
|
+
const language = navigator.language || "en";
|
|
43
|
+
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
44
|
+
const timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
45
|
+
const userAgent = navigator.userAgent;
|
|
46
|
+
const colorScheme = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
47
|
+
const screenWidth = window.screen.width;
|
|
48
|
+
const screenHeight = window.screen.height;
|
|
49
|
+
const screenSize = window.innerWidth < 768 ? "small" : window.innerWidth < 1200 ? "medium" : "large";
|
|
50
|
+
const devicePixelRatio = window.devicePixelRatio || 1;
|
|
51
|
+
return {
|
|
52
|
+
pageUrl,
|
|
53
|
+
language,
|
|
54
|
+
timezone,
|
|
55
|
+
timezoneOffset,
|
|
56
|
+
userAgent,
|
|
57
|
+
colorScheme,
|
|
58
|
+
screenWidth,
|
|
59
|
+
screenHeight,
|
|
60
|
+
screenSize,
|
|
61
|
+
devicePixelRatio
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
browserPreferences
|
|
67
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility function to collect browser preferences.
|
|
3
|
+
* @returns An object containing information about the browser environment.
|
|
4
|
+
*/
|
|
5
|
+
declare function browserPreferences(): {
|
|
6
|
+
pageUrl: string;
|
|
7
|
+
language: string;
|
|
8
|
+
timezone: string;
|
|
9
|
+
timezoneOffset: number;
|
|
10
|
+
userAgent: string;
|
|
11
|
+
colorScheme: "dark" | "light";
|
|
12
|
+
screenWidth: number;
|
|
13
|
+
screenHeight: number;
|
|
14
|
+
screenSize: "small" | "medium" | "large";
|
|
15
|
+
devicePixelRatio: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { browserPreferences };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility function to collect browser preferences.
|
|
3
|
+
* @returns An object containing information about the browser environment.
|
|
4
|
+
*/
|
|
5
|
+
declare function browserPreferences(): {
|
|
6
|
+
pageUrl: string;
|
|
7
|
+
language: string;
|
|
8
|
+
timezone: string;
|
|
9
|
+
timezoneOffset: number;
|
|
10
|
+
userAgent: string;
|
|
11
|
+
colorScheme: "dark" | "light";
|
|
12
|
+
screenWidth: number;
|
|
13
|
+
screenHeight: number;
|
|
14
|
+
screenSize: "small" | "medium" | "large";
|
|
15
|
+
devicePixelRatio: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { browserPreferences };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// utils/browser-preferences.ts
|
|
2
|
+
function browserPreferences() {
|
|
3
|
+
if (typeof window === "undefined") {
|
|
4
|
+
return {
|
|
5
|
+
pageUrl: "",
|
|
6
|
+
language: "en",
|
|
7
|
+
timezone: "UTC",
|
|
8
|
+
timezoneOffset: 0,
|
|
9
|
+
userAgent: "",
|
|
10
|
+
colorScheme: "light",
|
|
11
|
+
screenWidth: 0,
|
|
12
|
+
screenHeight: 0,
|
|
13
|
+
screenSize: "medium",
|
|
14
|
+
devicePixelRatio: 1
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const pageUrl = window.location.href;
|
|
18
|
+
const language = navigator.language || "en";
|
|
19
|
+
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
20
|
+
const timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
21
|
+
const userAgent = navigator.userAgent;
|
|
22
|
+
const colorScheme = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
23
|
+
const screenWidth = window.screen.width;
|
|
24
|
+
const screenHeight = window.screen.height;
|
|
25
|
+
const screenSize = window.innerWidth < 768 ? "small" : window.innerWidth < 1200 ? "medium" : "large";
|
|
26
|
+
const devicePixelRatio = window.devicePixelRatio || 1;
|
|
27
|
+
return {
|
|
28
|
+
pageUrl,
|
|
29
|
+
language,
|
|
30
|
+
timezone,
|
|
31
|
+
timezoneOffset,
|
|
32
|
+
userAgent,
|
|
33
|
+
colorScheme,
|
|
34
|
+
screenWidth,
|
|
35
|
+
screenHeight,
|
|
36
|
+
screenSize,
|
|
37
|
+
devicePixelRatio
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
browserPreferences
|
|
42
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// utils/classify-media.ts
|
|
21
|
+
var classify_media_exports = {};
|
|
22
|
+
__export(classify_media_exports, {
|
|
23
|
+
classifyMedia: () => classifyMedia
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(classify_media_exports);
|
|
26
|
+
var classifyMedia = (type = "") => {
|
|
27
|
+
if (type.startsWith("image/")) {
|
|
28
|
+
return "image";
|
|
29
|
+
}
|
|
30
|
+
if (type.startsWith("video/") || type.startsWith("audio/") || type === "application/x-mpegURL" || type === "application/vnd.apple.mpegurl" || type === "application/dash+xml" || type === "application/x-shockwave-flash") {
|
|
31
|
+
return "video";
|
|
32
|
+
}
|
|
33
|
+
return "file";
|
|
34
|
+
};
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
classifyMedia
|
|
38
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classifies the media type based on the MIME type.
|
|
3
|
+
*
|
|
4
|
+
* @param type - The MIME type of the media.
|
|
5
|
+
* @returns The classified media type: "image", "video", or "file".
|
|
6
|
+
*/
|
|
7
|
+
declare const classifyMedia: (type?: string) => "image" | "video" | "file";
|
|
8
|
+
|
|
9
|
+
export { classifyMedia };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classifies the media type based on the MIME type.
|
|
3
|
+
*
|
|
4
|
+
* @param type - The MIME type of the media.
|
|
5
|
+
* @returns The classified media type: "image", "video", or "file".
|
|
6
|
+
*/
|
|
7
|
+
declare const classifyMedia: (type?: string) => "image" | "video" | "file";
|
|
8
|
+
|
|
9
|
+
export { classifyMedia };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// utils/classify-media.ts
|
|
2
|
+
var classifyMedia = (type = "") => {
|
|
3
|
+
if (type.startsWith("image/")) {
|
|
4
|
+
return "image";
|
|
5
|
+
}
|
|
6
|
+
if (type.startsWith("video/") || type.startsWith("audio/") || type === "application/x-mpegURL" || type === "application/vnd.apple.mpegurl" || type === "application/dash+xml" || type === "application/x-shockwave-flash") {
|
|
7
|
+
return "video";
|
|
8
|
+
}
|
|
9
|
+
return "file";
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
classifyMedia
|
|
13
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// utils/decorators.ts
|
|
21
|
+
var decorators_exports = {};
|
|
22
|
+
__export(decorators_exports, {
|
|
23
|
+
uniqueCustomElement: () => uniqueCustomElement
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(decorators_exports);
|
|
26
|
+
var legacyCustomElement = (tagName, clazz) => {
|
|
27
|
+
if (!customElements.get(tagName)) {
|
|
28
|
+
window.customElements.define(tagName, clazz);
|
|
29
|
+
} else {
|
|
30
|
+
console.debug(
|
|
31
|
+
`Custom element <${tagName}> is already defined, skipping definition of ${clazz.name}.`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return clazz;
|
|
35
|
+
};
|
|
36
|
+
var standardCustomElement = (tagName, descriptor) => {
|
|
37
|
+
const { kind, elements } = descriptor;
|
|
38
|
+
return {
|
|
39
|
+
kind,
|
|
40
|
+
elements,
|
|
41
|
+
// This callback is called once the class is otherwise fully defined
|
|
42
|
+
finisher(clazz) {
|
|
43
|
+
if (!customElements.get(tagName)) {
|
|
44
|
+
window.customElements.define(tagName, clazz);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
var uniqueCustomElement = (tagName) => (classOrDescriptor) => typeof classOrDescriptor === "function" ? legacyCustomElement(tagName, classOrDescriptor) : standardCustomElement(tagName, classOrDescriptor);
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
uniqueCustomElement
|
|
53
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type Constructor<T> = {
|
|
2
|
+
new (...args: unknown[]): T;
|
|
3
|
+
};
|
|
4
|
+
interface ClassDescriptor {
|
|
5
|
+
kind: "class";
|
|
6
|
+
elements: ClassElement[];
|
|
7
|
+
finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;
|
|
8
|
+
}
|
|
9
|
+
interface ClassElement {
|
|
10
|
+
kind: "field" | "method";
|
|
11
|
+
key: PropertyKey;
|
|
12
|
+
placement: "static" | "prototype" | "own";
|
|
13
|
+
initializer?: Function;
|
|
14
|
+
extras?: ClassElement[];
|
|
15
|
+
finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;
|
|
16
|
+
descriptor?: PropertyDescriptor;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Class decorator factory that defines the decorated class as a custom element with collision detection.
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
* @uniqueCustomElement('my-element')
|
|
23
|
+
* class MyElement {
|
|
24
|
+
* override render() {
|
|
25
|
+
* return html``;
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
* @category Decorator
|
|
30
|
+
* @param tagName The name of the custom element to define.
|
|
31
|
+
*/
|
|
32
|
+
declare const uniqueCustomElement: (tagName: string) => (classOrDescriptor: Constructor<HTMLElement> | ClassDescriptor) => any;
|
|
33
|
+
|
|
34
|
+
export { type Constructor, uniqueCustomElement };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type Constructor<T> = {
|
|
2
|
+
new (...args: unknown[]): T;
|
|
3
|
+
};
|
|
4
|
+
interface ClassDescriptor {
|
|
5
|
+
kind: "class";
|
|
6
|
+
elements: ClassElement[];
|
|
7
|
+
finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;
|
|
8
|
+
}
|
|
9
|
+
interface ClassElement {
|
|
10
|
+
kind: "field" | "method";
|
|
11
|
+
key: PropertyKey;
|
|
12
|
+
placement: "static" | "prototype" | "own";
|
|
13
|
+
initializer?: Function;
|
|
14
|
+
extras?: ClassElement[];
|
|
15
|
+
finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;
|
|
16
|
+
descriptor?: PropertyDescriptor;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Class decorator factory that defines the decorated class as a custom element with collision detection.
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
* @uniqueCustomElement('my-element')
|
|
23
|
+
* class MyElement {
|
|
24
|
+
* override render() {
|
|
25
|
+
* return html``;
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
* @category Decorator
|
|
30
|
+
* @param tagName The name of the custom element to define.
|
|
31
|
+
*/
|
|
32
|
+
declare const uniqueCustomElement: (tagName: string) => (classOrDescriptor: Constructor<HTMLElement> | ClassDescriptor) => any;
|
|
33
|
+
|
|
34
|
+
export { type Constructor, uniqueCustomElement };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// utils/decorators.ts
|
|
2
|
+
var legacyCustomElement = (tagName, clazz) => {
|
|
3
|
+
if (!customElements.get(tagName)) {
|
|
4
|
+
window.customElements.define(tagName, clazz);
|
|
5
|
+
} else {
|
|
6
|
+
console.debug(
|
|
7
|
+
`Custom element <${tagName}> is already defined, skipping definition of ${clazz.name}.`
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
return clazz;
|
|
11
|
+
};
|
|
12
|
+
var standardCustomElement = (tagName, descriptor) => {
|
|
13
|
+
const { kind, elements } = descriptor;
|
|
14
|
+
return {
|
|
15
|
+
kind,
|
|
16
|
+
elements,
|
|
17
|
+
// This callback is called once the class is otherwise fully defined
|
|
18
|
+
finisher(clazz) {
|
|
19
|
+
if (!customElements.get(tagName)) {
|
|
20
|
+
window.customElements.define(tagName, clazz);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
var uniqueCustomElement = (tagName) => (classOrDescriptor) => typeof classOrDescriptor === "function" ? legacyCustomElement(tagName, classOrDescriptor) : standardCustomElement(tagName, classOrDescriptor);
|
|
26
|
+
export {
|
|
27
|
+
uniqueCustomElement
|
|
28
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// utils/detected-lang.ts
|
|
21
|
+
var detected_lang_exports = {};
|
|
22
|
+
__export(detected_lang_exports, {
|
|
23
|
+
detectedLang: () => detectedLang
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(detected_lang_exports);
|
|
26
|
+
var import_intl_localematcher = require("@formatjs/intl-localematcher");
|
|
27
|
+
var SUPPORTED_LOCALES = ["en", "es", "fr", "de", "it", "pt"];
|
|
28
|
+
var detectedLang = (supportedLocales = SUPPORTED_LOCALES, lang = "en") => {
|
|
29
|
+
try {
|
|
30
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
31
|
+
const olLang = urlParams.get("olLang");
|
|
32
|
+
if (olLang && supportedLocales.includes(olLang)) {
|
|
33
|
+
return olLang;
|
|
34
|
+
}
|
|
35
|
+
} catch (error) {
|
|
36
|
+
}
|
|
37
|
+
const browserLocales = navigator.languages || [navigator.language];
|
|
38
|
+
try {
|
|
39
|
+
return (0, import_intl_localematcher.match)(browserLocales, supportedLocales, lang, { algorithm: "best fit" });
|
|
40
|
+
} catch {
|
|
41
|
+
return lang;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
detectedLang
|
|
47
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects the best matching language from the browser's languages against a list of supported locales.
|
|
3
|
+
*
|
|
4
|
+
* @param {string[]} supportedLocales - An array of supported locale strings.
|
|
5
|
+
* @param {string} lang - The default language to fall back to if no match is found.
|
|
6
|
+
* @returns {string} - The best matching locale or the default language.
|
|
7
|
+
*/
|
|
8
|
+
declare const detectedLang: (supportedLocales?: string[], lang?: string) => string;
|
|
9
|
+
|
|
10
|
+
export { detectedLang };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects the best matching language from the browser's languages against a list of supported locales.
|
|
3
|
+
*
|
|
4
|
+
* @param {string[]} supportedLocales - An array of supported locale strings.
|
|
5
|
+
* @param {string} lang - The default language to fall back to if no match is found.
|
|
6
|
+
* @returns {string} - The best matching locale or the default language.
|
|
7
|
+
*/
|
|
8
|
+
declare const detectedLang: (supportedLocales?: string[], lang?: string) => string;
|
|
9
|
+
|
|
10
|
+
export { detectedLang };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// utils/detected-lang.ts
|
|
2
|
+
import { match } from "@formatjs/intl-localematcher";
|
|
3
|
+
var SUPPORTED_LOCALES = ["en", "es", "fr", "de", "it", "pt"];
|
|
4
|
+
var detectedLang = (supportedLocales = SUPPORTED_LOCALES, lang = "en") => {
|
|
5
|
+
try {
|
|
6
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
7
|
+
const olLang = urlParams.get("olLang");
|
|
8
|
+
if (olLang && supportedLocales.includes(olLang)) {
|
|
9
|
+
return olLang;
|
|
10
|
+
}
|
|
11
|
+
} catch (error) {
|
|
12
|
+
}
|
|
13
|
+
const browserLocales = navigator.languages || [navigator.language];
|
|
14
|
+
try {
|
|
15
|
+
return match(browserLocales, supportedLocales, lang, { algorithm: "best fit" });
|
|
16
|
+
} catch {
|
|
17
|
+
return lang;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
detectedLang
|
|
22
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// utils/fullscreen.ts
|
|
21
|
+
var fullscreen_exports = {};
|
|
22
|
+
__export(fullscreen_exports, {
|
|
23
|
+
enterFullScreen: () => enterFullScreen,
|
|
24
|
+
exitFullScreen: () => exitFullScreen
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(fullscreen_exports);
|
|
27
|
+
var enterFullScreen = async (el) => {
|
|
28
|
+
try {
|
|
29
|
+
if ("requestFullscreen" in el) return await el.requestFullscreen();
|
|
30
|
+
if ("mozRequestFullScreen" in el) return await el.mozRequestFullScreen();
|
|
31
|
+
if ("webkitRequestFullscreen" in el) return await el.webkitRequestFullscreen();
|
|
32
|
+
if ("msRequestFullscreen" in el) return await el.msRequestFullscreen();
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.error(e);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var exitFullScreen = async (el) => {
|
|
38
|
+
try {
|
|
39
|
+
if (el.fullscreenElement) {
|
|
40
|
+
if ("exitFullscreen" in el) return await el.exitFullscreen();
|
|
41
|
+
if ("mozCancelFullScreen" in el) return await el.mozCancelFullScreen();
|
|
42
|
+
if ("webkitExitFullscreen" in el) return await el.webkitExitFullscreen();
|
|
43
|
+
}
|
|
44
|
+
} catch (e) {
|
|
45
|
+
console.error(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
enterFullScreen,
|
|
51
|
+
exitFullScreen
|
|
52
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enters full screen mode for the given element.
|
|
3
|
+
* This function checks for the appropriate method to call based on the browser's implementation.
|
|
4
|
+
*
|
|
5
|
+
* @param {any} el - The element to enter full screen mode.
|
|
6
|
+
*/
|
|
7
|
+
declare const enterFullScreen: (el: any) => Promise<any>;
|
|
8
|
+
/**
|
|
9
|
+
* Exits full screen mode for the given element.
|
|
10
|
+
* This function checks for the appropriate method to call based on the browser's implementation.
|
|
11
|
+
*
|
|
12
|
+
* @param {any} el - The element to exit full screen mode.
|
|
13
|
+
*/
|
|
14
|
+
declare const exitFullScreen: (el: any) => Promise<any>;
|
|
15
|
+
|
|
16
|
+
export { enterFullScreen, exitFullScreen };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enters full screen mode for the given element.
|
|
3
|
+
* This function checks for the appropriate method to call based on the browser's implementation.
|
|
4
|
+
*
|
|
5
|
+
* @param {any} el - The element to enter full screen mode.
|
|
6
|
+
*/
|
|
7
|
+
declare const enterFullScreen: (el: any) => Promise<any>;
|
|
8
|
+
/**
|
|
9
|
+
* Exits full screen mode for the given element.
|
|
10
|
+
* This function checks for the appropriate method to call based on the browser's implementation.
|
|
11
|
+
*
|
|
12
|
+
* @param {any} el - The element to exit full screen mode.
|
|
13
|
+
*/
|
|
14
|
+
declare const exitFullScreen: (el: any) => Promise<any>;
|
|
15
|
+
|
|
16
|
+
export { enterFullScreen, exitFullScreen };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// utils/fullscreen.ts
|
|
2
|
+
var enterFullScreen = async (el) => {
|
|
3
|
+
try {
|
|
4
|
+
if ("requestFullscreen" in el) return await el.requestFullscreen();
|
|
5
|
+
if ("mozRequestFullScreen" in el) return await el.mozRequestFullScreen();
|
|
6
|
+
if ("webkitRequestFullscreen" in el) return await el.webkitRequestFullscreen();
|
|
7
|
+
if ("msRequestFullscreen" in el) return await el.msRequestFullscreen();
|
|
8
|
+
} catch (e) {
|
|
9
|
+
console.error(e);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
var exitFullScreen = async (el) => {
|
|
13
|
+
try {
|
|
14
|
+
if (el.fullscreenElement) {
|
|
15
|
+
if ("exitFullscreen" in el) return await el.exitFullscreen();
|
|
16
|
+
if ("mozCancelFullScreen" in el) return await el.mozCancelFullScreen();
|
|
17
|
+
if ("webkitExitFullscreen" in el) return await el.webkitExitFullscreen();
|
|
18
|
+
}
|
|
19
|
+
} catch (e) {
|
|
20
|
+
console.error(e);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
enterFullScreen,
|
|
25
|
+
exitFullScreen
|
|
26
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// utils/insert-script.ts
|
|
21
|
+
var insert_script_exports = {};
|
|
22
|
+
__export(insert_script_exports, {
|
|
23
|
+
insertScript: () => insertScript
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(insert_script_exports);
|
|
26
|
+
var insertScript = async ({
|
|
27
|
+
src = "",
|
|
28
|
+
async = false,
|
|
29
|
+
defer = false,
|
|
30
|
+
module: module2 = false,
|
|
31
|
+
system = false
|
|
32
|
+
}) => new Promise((resolve, reject) => {
|
|
33
|
+
const el = document.createElement("script");
|
|
34
|
+
el.src = src;
|
|
35
|
+
if (async) {
|
|
36
|
+
el.async = true;
|
|
37
|
+
}
|
|
38
|
+
if (defer) {
|
|
39
|
+
el.defer = true;
|
|
40
|
+
}
|
|
41
|
+
if (module2) {
|
|
42
|
+
el.type = "module";
|
|
43
|
+
} else if (system) {
|
|
44
|
+
el.type = "systemjs-module";
|
|
45
|
+
} else {
|
|
46
|
+
el.type = "text/javascript";
|
|
47
|
+
}
|
|
48
|
+
el.addEventListener("load", resolve);
|
|
49
|
+
el.addEventListener("error", reject);
|
|
50
|
+
document.head.append(el);
|
|
51
|
+
});
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
insertScript
|
|
55
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamically inserts a script element into the document head.
|
|
3
|
+
*
|
|
4
|
+
* @param options - Configuration options for the script element
|
|
5
|
+
* @param options.src - The source URL of the script
|
|
6
|
+
* @param options.async - Whether to load the script asynchronously (default: false)
|
|
7
|
+
* @param options.defer - Whether to defer loading the script (default: false)
|
|
8
|
+
* @param options.module - Whether to set type as "module" (default: false)
|
|
9
|
+
* @param options.system - Whether to set type as "systemjs-module" (default: false)
|
|
10
|
+
*
|
|
11
|
+
* @returns Promise that resolves when the script is loaded or rejects if loading fails
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* await insertScript({
|
|
16
|
+
* src: 'https://example.com/script.js',
|
|
17
|
+
* async: true
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare const insertScript: ({ src, async, defer, module, system, }: {
|
|
22
|
+
src?: string | undefined;
|
|
23
|
+
async?: boolean | undefined;
|
|
24
|
+
defer?: boolean | undefined;
|
|
25
|
+
module?: boolean | undefined;
|
|
26
|
+
system?: boolean | undefined;
|
|
27
|
+
}) => Promise<unknown>;
|
|
28
|
+
|
|
29
|
+
export { insertScript };
|