@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,45 @@
|
|
|
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/pretty-distance.ts
|
|
21
|
+
var pretty_distance_exports = {};
|
|
22
|
+
__export(pretty_distance_exports, {
|
|
23
|
+
prettyDistance: () => prettyDistance
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(pretty_distance_exports);
|
|
26
|
+
var FORMAT_MAP = {
|
|
27
|
+
short: {
|
|
28
|
+
m: "m",
|
|
29
|
+
km: "km",
|
|
30
|
+
mi: "mi"
|
|
31
|
+
},
|
|
32
|
+
long: {
|
|
33
|
+
m: "meters",
|
|
34
|
+
km: "kilometers",
|
|
35
|
+
mi: "miles"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
function prettyDistance(options) {
|
|
39
|
+
const units = FORMAT_MAP[options.format][options.unit];
|
|
40
|
+
return `${options.value.toFixed(options.fixed)} ${units}`;
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
prettyDistance
|
|
45
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
type PrettyDistanceOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* The distance value to be formatted.
|
|
4
|
+
* @default 0
|
|
5
|
+
*/
|
|
6
|
+
value: number;
|
|
7
|
+
/**
|
|
8
|
+
* The unit of measurement for the distance.
|
|
9
|
+
* @default "m"
|
|
10
|
+
*/
|
|
11
|
+
unit: "m" | "km" | "mi";
|
|
12
|
+
/**
|
|
13
|
+
* The format of the output string.
|
|
14
|
+
* @default "short"
|
|
15
|
+
*/
|
|
16
|
+
format: keyof typeof FORMAT_MAP;
|
|
17
|
+
/**
|
|
18
|
+
* The number of decimal places to include in the output.
|
|
19
|
+
* @default 2
|
|
20
|
+
*/
|
|
21
|
+
fixed: number;
|
|
22
|
+
};
|
|
23
|
+
declare const FORMAT_MAP: {
|
|
24
|
+
short: {
|
|
25
|
+
m: string;
|
|
26
|
+
km: string;
|
|
27
|
+
mi: string;
|
|
28
|
+
};
|
|
29
|
+
long: {
|
|
30
|
+
m: string;
|
|
31
|
+
km: string;
|
|
32
|
+
mi: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Formats a distance value into a human-readable string.
|
|
37
|
+
*
|
|
38
|
+
* @param {number} [value=0] - The distance value to be formatted.
|
|
39
|
+
* @param {string} [unit="m"] - The unit of measurement for the distance.
|
|
40
|
+
* @param {"short" | "long"} [format="short"] - The format of the output string.
|
|
41
|
+
* @param {number} [fixed=2] - The number of decimal places to include in the output.
|
|
42
|
+
* @returns {string} - The formatted distance string.
|
|
43
|
+
*/
|
|
44
|
+
declare function prettyDistance(options: PrettyDistanceOptions): string;
|
|
45
|
+
|
|
46
|
+
export { type PrettyDistanceOptions, prettyDistance };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
type PrettyDistanceOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* The distance value to be formatted.
|
|
4
|
+
* @default 0
|
|
5
|
+
*/
|
|
6
|
+
value: number;
|
|
7
|
+
/**
|
|
8
|
+
* The unit of measurement for the distance.
|
|
9
|
+
* @default "m"
|
|
10
|
+
*/
|
|
11
|
+
unit: "m" | "km" | "mi";
|
|
12
|
+
/**
|
|
13
|
+
* The format of the output string.
|
|
14
|
+
* @default "short"
|
|
15
|
+
*/
|
|
16
|
+
format: keyof typeof FORMAT_MAP;
|
|
17
|
+
/**
|
|
18
|
+
* The number of decimal places to include in the output.
|
|
19
|
+
* @default 2
|
|
20
|
+
*/
|
|
21
|
+
fixed: number;
|
|
22
|
+
};
|
|
23
|
+
declare const FORMAT_MAP: {
|
|
24
|
+
short: {
|
|
25
|
+
m: string;
|
|
26
|
+
km: string;
|
|
27
|
+
mi: string;
|
|
28
|
+
};
|
|
29
|
+
long: {
|
|
30
|
+
m: string;
|
|
31
|
+
km: string;
|
|
32
|
+
mi: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Formats a distance value into a human-readable string.
|
|
37
|
+
*
|
|
38
|
+
* @param {number} [value=0] - The distance value to be formatted.
|
|
39
|
+
* @param {string} [unit="m"] - The unit of measurement for the distance.
|
|
40
|
+
* @param {"short" | "long"} [format="short"] - The format of the output string.
|
|
41
|
+
* @param {number} [fixed=2] - The number of decimal places to include in the output.
|
|
42
|
+
* @returns {string} - The formatted distance string.
|
|
43
|
+
*/
|
|
44
|
+
declare function prettyDistance(options: PrettyDistanceOptions): string;
|
|
45
|
+
|
|
46
|
+
export { type PrettyDistanceOptions, prettyDistance };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// utils/pretty-distance.ts
|
|
2
|
+
var FORMAT_MAP = {
|
|
3
|
+
short: {
|
|
4
|
+
m: "m",
|
|
5
|
+
km: "km",
|
|
6
|
+
mi: "mi"
|
|
7
|
+
},
|
|
8
|
+
long: {
|
|
9
|
+
m: "meters",
|
|
10
|
+
km: "kilometers",
|
|
11
|
+
mi: "miles"
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
function prettyDistance(options) {
|
|
15
|
+
const units = FORMAT_MAP[options.format][options.unit];
|
|
16
|
+
return `${options.value.toFixed(options.fixed)} ${units}`;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
prettyDistance
|
|
20
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
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/random-string.ts
|
|
21
|
+
var random_string_exports = {};
|
|
22
|
+
__export(random_string_exports, {
|
|
23
|
+
randomString: () => randomString
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(random_string_exports);
|
|
26
|
+
var randomString = (length) => {
|
|
27
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
28
|
+
let result = "";
|
|
29
|
+
for (let i = 0; i < length; i++) {
|
|
30
|
+
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
randomString
|
|
37
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a random string of the specified length.
|
|
3
|
+
*
|
|
4
|
+
* @param {number} length - The length of the random string to generate.
|
|
5
|
+
* @returns {string} - The generated random string.
|
|
6
|
+
*/
|
|
7
|
+
declare const randomString: (length: number) => string;
|
|
8
|
+
|
|
9
|
+
export { randomString };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a random string of the specified length.
|
|
3
|
+
*
|
|
4
|
+
* @param {number} length - The length of the random string to generate.
|
|
5
|
+
* @returns {string} - The generated random string.
|
|
6
|
+
*/
|
|
7
|
+
declare const randomString: (length: number) => string;
|
|
8
|
+
|
|
9
|
+
export { randomString };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// utils/random-string.ts
|
|
2
|
+
var randomString = (length) => {
|
|
3
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
4
|
+
let result = "";
|
|
5
|
+
for (let i = 0; i < length; i++) {
|
|
6
|
+
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
7
|
+
}
|
|
8
|
+
return result;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
randomString
|
|
12
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
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/resource-type.ts
|
|
21
|
+
var resource_type_exports = {};
|
|
22
|
+
__export(resource_type_exports, {
|
|
23
|
+
ResourceType: () => ResourceType,
|
|
24
|
+
resourceType: () => resourceType
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(resource_type_exports);
|
|
27
|
+
var ResourceType = /* @__PURE__ */ ((ResourceType2) => {
|
|
28
|
+
ResourceType2["IMAGE"] = "image";
|
|
29
|
+
ResourceType2["VIDEO"] = "video";
|
|
30
|
+
ResourceType2["UNKNOWN"] = "unknown";
|
|
31
|
+
return ResourceType2;
|
|
32
|
+
})(ResourceType || {});
|
|
33
|
+
function resourceType(url) {
|
|
34
|
+
if (!url) return "unknown" /* UNKNOWN */;
|
|
35
|
+
const extension = url.split(".").pop()?.toLowerCase();
|
|
36
|
+
if (!extension) return "unknown" /* UNKNOWN */;
|
|
37
|
+
const imageExtensions = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "tiff", "ico"];
|
|
38
|
+
const videoExtensions = ["mp4", "webm", "ogg", "mov", "avi", "wmv", "flv", "mkv", "m4v", "3gp"];
|
|
39
|
+
if (imageExtensions.includes(extension)) {
|
|
40
|
+
return "image" /* IMAGE */;
|
|
41
|
+
} else if (videoExtensions.includes(extension)) {
|
|
42
|
+
return "video" /* VIDEO */;
|
|
43
|
+
}
|
|
44
|
+
return "unknown" /* UNKNOWN */;
|
|
45
|
+
}
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
ResourceType,
|
|
49
|
+
resourceType
|
|
50
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource types that can be identified
|
|
3
|
+
*/
|
|
4
|
+
declare enum ResourceType {
|
|
5
|
+
IMAGE = "image",
|
|
6
|
+
VIDEO = "video",
|
|
7
|
+
UNKNOWN = "unknown"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Determines the type of resource based on its URL extension
|
|
11
|
+
* @param url - The URL of the resource to analyze
|
|
12
|
+
* @returns The resource type (image, video, or unknown)
|
|
13
|
+
*/
|
|
14
|
+
declare function resourceType(url: string): ResourceType;
|
|
15
|
+
|
|
16
|
+
export { ResourceType, resourceType };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource types that can be identified
|
|
3
|
+
*/
|
|
4
|
+
declare enum ResourceType {
|
|
5
|
+
IMAGE = "image",
|
|
6
|
+
VIDEO = "video",
|
|
7
|
+
UNKNOWN = "unknown"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Determines the type of resource based on its URL extension
|
|
11
|
+
* @param url - The URL of the resource to analyze
|
|
12
|
+
* @returns The resource type (image, video, or unknown)
|
|
13
|
+
*/
|
|
14
|
+
declare function resourceType(url: string): ResourceType;
|
|
15
|
+
|
|
16
|
+
export { ResourceType, resourceType };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// utils/resource-type.ts
|
|
2
|
+
var ResourceType = /* @__PURE__ */ ((ResourceType2) => {
|
|
3
|
+
ResourceType2["IMAGE"] = "image";
|
|
4
|
+
ResourceType2["VIDEO"] = "video";
|
|
5
|
+
ResourceType2["UNKNOWN"] = "unknown";
|
|
6
|
+
return ResourceType2;
|
|
7
|
+
})(ResourceType || {});
|
|
8
|
+
function resourceType(url) {
|
|
9
|
+
if (!url) return "unknown" /* UNKNOWN */;
|
|
10
|
+
const extension = url.split(".").pop()?.toLowerCase();
|
|
11
|
+
if (!extension) return "unknown" /* UNKNOWN */;
|
|
12
|
+
const imageExtensions = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "tiff", "ico"];
|
|
13
|
+
const videoExtensions = ["mp4", "webm", "ogg", "mov", "avi", "wmv", "flv", "mkv", "m4v", "3gp"];
|
|
14
|
+
if (imageExtensions.includes(extension)) {
|
|
15
|
+
return "image" /* IMAGE */;
|
|
16
|
+
} else if (videoExtensions.includes(extension)) {
|
|
17
|
+
return "video" /* VIDEO */;
|
|
18
|
+
}
|
|
19
|
+
return "unknown" /* UNKNOWN */;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
ResourceType,
|
|
23
|
+
resourceType
|
|
24
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// utils/safe-html.ts
|
|
31
|
+
var safe_html_exports = {};
|
|
32
|
+
__export(safe_html_exports, {
|
|
33
|
+
safeHTML: () => safeHTML
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(safe_html_exports);
|
|
36
|
+
var import_unsafe_html = require("lit/directives/unsafe-html.js");
|
|
37
|
+
|
|
38
|
+
// utils/sanitize.ts
|
|
39
|
+
var import_dompurify = __toESM(require("dompurify"), 1);
|
|
40
|
+
var DEFAULT_PURIFY_CONFIG = {
|
|
41
|
+
ALLOWED_TAGS: [
|
|
42
|
+
// Text formatting
|
|
43
|
+
"p",
|
|
44
|
+
"br",
|
|
45
|
+
"span",
|
|
46
|
+
"b",
|
|
47
|
+
"strong",
|
|
48
|
+
"i",
|
|
49
|
+
"em",
|
|
50
|
+
"u",
|
|
51
|
+
"s",
|
|
52
|
+
"del",
|
|
53
|
+
// Lists
|
|
54
|
+
"ul",
|
|
55
|
+
"ol",
|
|
56
|
+
"li",
|
|
57
|
+
// Code
|
|
58
|
+
"code",
|
|
59
|
+
"pre",
|
|
60
|
+
// Links
|
|
61
|
+
"a",
|
|
62
|
+
// Headers (limited)
|
|
63
|
+
"h1",
|
|
64
|
+
"h2",
|
|
65
|
+
"h3",
|
|
66
|
+
"h4",
|
|
67
|
+
// Tables
|
|
68
|
+
"table",
|
|
69
|
+
"thead",
|
|
70
|
+
"tbody",
|
|
71
|
+
"tr",
|
|
72
|
+
"th",
|
|
73
|
+
"td"
|
|
74
|
+
],
|
|
75
|
+
ALLOWED_ATTR: [
|
|
76
|
+
// Links
|
|
77
|
+
"href",
|
|
78
|
+
"target",
|
|
79
|
+
"rel",
|
|
80
|
+
// Accessibility
|
|
81
|
+
"title",
|
|
82
|
+
"aria-label",
|
|
83
|
+
"role",
|
|
84
|
+
// Tables
|
|
85
|
+
"colspan",
|
|
86
|
+
"rowspan"
|
|
87
|
+
],
|
|
88
|
+
FORCE_HTTPS: true,
|
|
89
|
+
ALLOW_DATA_ATTR: false
|
|
90
|
+
};
|
|
91
|
+
var sanitize = (html, purifyConfig = DEFAULT_PURIFY_CONFIG) => {
|
|
92
|
+
return import_dompurify.default.sanitize(html, purifyConfig);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// utils/safe-html.ts
|
|
96
|
+
function safeHTML(html = "") {
|
|
97
|
+
return (0, import_unsafe_html.unsafeHTML)(
|
|
98
|
+
sanitize(html, {
|
|
99
|
+
ADD_ATTR: ["target", "rel"],
|
|
100
|
+
ADD_TAGS: ["ol-"],
|
|
101
|
+
CUSTOM_ELEMENT_HANDLING: {
|
|
102
|
+
tagNameCheck: /^ol-/,
|
|
103
|
+
attributeNameCheck: null,
|
|
104
|
+
allowCustomizedBuiltInElements: true
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
+
0 && (module.exports = {
|
|
111
|
+
safeHTML
|
|
112
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as lit_directive_js from 'lit/directive.js';
|
|
2
|
+
import * as lit_directives_unsafe_html_js from 'lit/directives/unsafe-html.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Parse and sanitizes HTML content by removing potentially dangerous tags and attributes.
|
|
6
|
+
*
|
|
7
|
+
* @param html - The HTML string to be sanitized
|
|
8
|
+
* @returns A sanitized version of the input HTML string with only allowed tags and attributes
|
|
9
|
+
*/
|
|
10
|
+
declare function safeHTML(html?: string): lit_directive_js.DirectiveResult<typeof lit_directives_unsafe_html_js.UnsafeHTMLDirective>;
|
|
11
|
+
|
|
12
|
+
export { safeHTML };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as lit_directive_js from 'lit/directive.js';
|
|
2
|
+
import * as lit_directives_unsafe_html_js from 'lit/directives/unsafe-html.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Parse and sanitizes HTML content by removing potentially dangerous tags and attributes.
|
|
6
|
+
*
|
|
7
|
+
* @param html - The HTML string to be sanitized
|
|
8
|
+
* @returns A sanitized version of the input HTML string with only allowed tags and attributes
|
|
9
|
+
*/
|
|
10
|
+
declare function safeHTML(html?: string): lit_directive_js.DirectiveResult<typeof lit_directives_unsafe_html_js.UnsafeHTMLDirective>;
|
|
11
|
+
|
|
12
|
+
export { safeHTML };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// utils/safe-html.ts
|
|
2
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
3
|
+
|
|
4
|
+
// utils/sanitize.ts
|
|
5
|
+
import DOMPurify from "dompurify";
|
|
6
|
+
var DEFAULT_PURIFY_CONFIG = {
|
|
7
|
+
ALLOWED_TAGS: [
|
|
8
|
+
// Text formatting
|
|
9
|
+
"p",
|
|
10
|
+
"br",
|
|
11
|
+
"span",
|
|
12
|
+
"b",
|
|
13
|
+
"strong",
|
|
14
|
+
"i",
|
|
15
|
+
"em",
|
|
16
|
+
"u",
|
|
17
|
+
"s",
|
|
18
|
+
"del",
|
|
19
|
+
// Lists
|
|
20
|
+
"ul",
|
|
21
|
+
"ol",
|
|
22
|
+
"li",
|
|
23
|
+
// Code
|
|
24
|
+
"code",
|
|
25
|
+
"pre",
|
|
26
|
+
// Links
|
|
27
|
+
"a",
|
|
28
|
+
// Headers (limited)
|
|
29
|
+
"h1",
|
|
30
|
+
"h2",
|
|
31
|
+
"h3",
|
|
32
|
+
"h4",
|
|
33
|
+
// Tables
|
|
34
|
+
"table",
|
|
35
|
+
"thead",
|
|
36
|
+
"tbody",
|
|
37
|
+
"tr",
|
|
38
|
+
"th",
|
|
39
|
+
"td"
|
|
40
|
+
],
|
|
41
|
+
ALLOWED_ATTR: [
|
|
42
|
+
// Links
|
|
43
|
+
"href",
|
|
44
|
+
"target",
|
|
45
|
+
"rel",
|
|
46
|
+
// Accessibility
|
|
47
|
+
"title",
|
|
48
|
+
"aria-label",
|
|
49
|
+
"role",
|
|
50
|
+
// Tables
|
|
51
|
+
"colspan",
|
|
52
|
+
"rowspan"
|
|
53
|
+
],
|
|
54
|
+
FORCE_HTTPS: true,
|
|
55
|
+
ALLOW_DATA_ATTR: false
|
|
56
|
+
};
|
|
57
|
+
var sanitize = (html, purifyConfig = DEFAULT_PURIFY_CONFIG) => {
|
|
58
|
+
return DOMPurify.sanitize(html, purifyConfig);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// utils/safe-html.ts
|
|
62
|
+
function safeHTML(html = "") {
|
|
63
|
+
return unsafeHTML(
|
|
64
|
+
sanitize(html, {
|
|
65
|
+
ADD_ATTR: ["target", "rel"],
|
|
66
|
+
ADD_TAGS: ["ol-"],
|
|
67
|
+
CUSTOM_ELEMENT_HANDLING: {
|
|
68
|
+
tagNameCheck: /^ol-/,
|
|
69
|
+
attributeNameCheck: null,
|
|
70
|
+
allowCustomizedBuiltInElements: true
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
safeHTML
|
|
77
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// utils/sanitize.ts
|
|
31
|
+
var sanitize_exports = {};
|
|
32
|
+
__export(sanitize_exports, {
|
|
33
|
+
sanitize: () => sanitize
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(sanitize_exports);
|
|
36
|
+
var import_dompurify = __toESM(require("dompurify"), 1);
|
|
37
|
+
var DEFAULT_PURIFY_CONFIG = {
|
|
38
|
+
ALLOWED_TAGS: [
|
|
39
|
+
// Text formatting
|
|
40
|
+
"p",
|
|
41
|
+
"br",
|
|
42
|
+
"span",
|
|
43
|
+
"b",
|
|
44
|
+
"strong",
|
|
45
|
+
"i",
|
|
46
|
+
"em",
|
|
47
|
+
"u",
|
|
48
|
+
"s",
|
|
49
|
+
"del",
|
|
50
|
+
// Lists
|
|
51
|
+
"ul",
|
|
52
|
+
"ol",
|
|
53
|
+
"li",
|
|
54
|
+
// Code
|
|
55
|
+
"code",
|
|
56
|
+
"pre",
|
|
57
|
+
// Links
|
|
58
|
+
"a",
|
|
59
|
+
// Headers (limited)
|
|
60
|
+
"h1",
|
|
61
|
+
"h2",
|
|
62
|
+
"h3",
|
|
63
|
+
"h4",
|
|
64
|
+
// Tables
|
|
65
|
+
"table",
|
|
66
|
+
"thead",
|
|
67
|
+
"tbody",
|
|
68
|
+
"tr",
|
|
69
|
+
"th",
|
|
70
|
+
"td"
|
|
71
|
+
],
|
|
72
|
+
ALLOWED_ATTR: [
|
|
73
|
+
// Links
|
|
74
|
+
"href",
|
|
75
|
+
"target",
|
|
76
|
+
"rel",
|
|
77
|
+
// Accessibility
|
|
78
|
+
"title",
|
|
79
|
+
"aria-label",
|
|
80
|
+
"role",
|
|
81
|
+
// Tables
|
|
82
|
+
"colspan",
|
|
83
|
+
"rowspan"
|
|
84
|
+
],
|
|
85
|
+
FORCE_HTTPS: true,
|
|
86
|
+
ALLOW_DATA_ATTR: false
|
|
87
|
+
};
|
|
88
|
+
var sanitize = (html, purifyConfig = DEFAULT_PURIFY_CONFIG) => {
|
|
89
|
+
return import_dompurify.default.sanitize(html, purifyConfig);
|
|
90
|
+
};
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
sanitize
|
|
94
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Config } from 'dompurify';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sanitizes HTML content by removing potentially dangerous tags and attributes.
|
|
5
|
+
*
|
|
6
|
+
* @param html - The HTML string to be sanitized
|
|
7
|
+
* @returns A sanitized version of the input HTML string with only allowed tags and attributes
|
|
8
|
+
*/
|
|
9
|
+
declare const sanitize: (html: string, purifyConfig?: Config) => string;
|
|
10
|
+
|
|
11
|
+
export { sanitize };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Config } from 'dompurify';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sanitizes HTML content by removing potentially dangerous tags and attributes.
|
|
5
|
+
*
|
|
6
|
+
* @param html - The HTML string to be sanitized
|
|
7
|
+
* @returns A sanitized version of the input HTML string with only allowed tags and attributes
|
|
8
|
+
*/
|
|
9
|
+
declare const sanitize: (html: string, purifyConfig?: Config) => string;
|
|
10
|
+
|
|
11
|
+
export { sanitize };
|