calmlens 0.27.4 → 0.27.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.
- package/README.md +2 -2
- package/bin/calmlens.js +26 -15
- package/cjs/{BrowserUpload-CFtjSpBI.d.ts → BrowserUpload-CdOfuIcV.d.ts} +2 -2
- package/cjs/{BrowserUpload-Ch9y2ZDx.js → BrowserUpload-GQtZti-D.js} +1 -1
- package/{esm/CalmLensAppClient-DzoSqUgG.d.ts → cjs/CalmLensAppClient-Btp8f-34.d.ts} +2 -2
- package/cjs/{CalmLensAppClient-DGtj1vUV.js → CalmLensAppClient-Bwt3gP0C.js} +3 -3
- package/cjs/{CalmLensOptionKeys-DbL03fZj.js → CalmLensOptionKeys--gTpTkwt.js} +1 -1
- package/cjs/{CalmLensServerClient-D62AeRAi.js → CalmLensServerClient-BYMzGkQK.js} +7 -7
- package/cjs/{CalmLensServerClient-D3K5HS9v.d.ts → CalmLensServerClient-C3kaPLUZ.d.ts} +2 -2
- package/cjs/{CalmLensTypes-OWZsGvBX.d.ts → CalmLensTypes-DxxyZt2L.d.ts} +73 -5
- package/cjs/{Core-Cv2zLAJ-.js → Core-52DVaX7d.js} +63 -21
- package/{esm/Core-BXeXyiNv.d.ts → cjs/Core-Dhijt6JU.d.ts} +13 -14
- package/cjs/{CryptoUtils-B_x8lMIx-YBW1-bvL.js → CryptoUtils-BLCa-oZe-leCkr1ko.js} +1 -2
- package/cjs/{ModerationContextLimits-DjacyIkw.js → ModerationContextLimits-DJyIjzIn.js} +21 -3
- package/cjs/{ReactUpload-C47UrgH2.d.ts → ReactUpload-BuqLPgNr.d.ts} +1 -1
- package/cjs/{ReactUpload-CytoQTh_.js → ReactUpload-DHuhGYsr.js} +1 -1
- package/cjs/{TestTriggers-Cvi7e2KA-DcT1pc_W.js → TestTriggers-DP4m92jg-C0HD-A4r.js} +14 -14
- package/cjs/{UploadController-fpTC5TUO.js → UploadController-ChzDPMmm.js} +2 -2
- package/{esm/WebhookPayload-CrMU6lg0.d.ts → cjs/WebhookPayload-D_yWJA9M.d.ts} +5 -1
- package/cjs/app.d.ts +4 -4
- package/cjs/app.js +2 -2
- package/cjs/elements.d.ts +8 -19
- package/cjs/elements.js +45 -53
- package/cjs/{index-BDxmVi-G.d.ts → index-CUA-HDNu.d.ts} +2 -2
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +1 -1
- package/cjs/react-native.d.ts +3 -3
- package/cjs/react-native.js +6 -4
- package/cjs/react.d.ts +5 -11
- package/cjs/react.js +29 -36
- package/cjs/server.d.ts +4 -4
- package/cjs/server.js +2 -2
- package/cjs/test-inputs.js +13 -13
- package/cjs/testing.d.ts +4 -4
- package/cjs/testing.js +54 -32
- package/cjs/{ui-5IdEYYpC.d.ts → ui-BSm_qphN.d.ts} +3 -9
- package/cjs/{ui-BvyDbJBb.js → ui-C1_SDSiq.js} +2 -201
- package/cjs/ui.d.ts +3 -3
- package/cjs/ui.js +5 -5
- package/cjs/vue.d.ts +6 -319
- package/cjs/vue.js +27 -17
- package/esm/{BrowserUpload-BE8OVeBC.js → BrowserUpload-BaKFKEBz.js} +1 -1
- package/esm/{BrowserUpload-CFtjSpBI.d.ts → BrowserUpload-CdOfuIcV.d.ts} +2 -2
- package/{cjs/CalmLensAppClient-DzoSqUgG.d.ts → esm/CalmLensAppClient-Btp8f-34.d.ts} +2 -2
- package/esm/{CalmLensAppClient-C1cpQEYR.js → CalmLensAppClient-DM6c3pGC.js} +3 -3
- package/esm/{CalmLensOptionKeys-DoCKKuLT.js → CalmLensOptionKeys-CKZs8i3_.js} +1 -1
- package/esm/{CalmLensServerClient-D3K5HS9v.d.ts → CalmLensServerClient-C3kaPLUZ.d.ts} +2 -2
- package/esm/{CalmLensServerClient-CSCrJ7wX.js → CalmLensServerClient-Da2UfUo4.js} +3 -3
- package/esm/{CalmLensTypes-OWZsGvBX.d.ts → CalmLensTypes-DxxyZt2L.d.ts} +73 -5
- package/{cjs/Core-BXeXyiNv.d.ts → esm/Core-Dhijt6JU.d.ts} +13 -14
- package/esm/{Core-Df2PSa1n.js → Core-kYMRW5C1.js} +52 -22
- package/esm/{CryptoUtils-B_x8lMIx-DhuWGzqn.js → CryptoUtils-BLCa-oZe-DKr3LmN6.js} +1 -2
- package/esm/{ModerationContextLimits-tu_PY4fn.js → ModerationContextLimits-ZIlK9n2X.js} +21 -3
- package/esm/{ReactUpload-C47UrgH2.d.ts → ReactUpload-BuqLPgNr.d.ts} +1 -1
- package/esm/{ReactUpload-BsbisXS6.js → ReactUpload-CipY3cmO.js} +1 -1
- package/esm/{TestTriggers-Cvi7e2KA-BA83CRJb.js → TestTriggers-DP4m92jg-DhOI4S1V.js} +11 -11
- package/esm/{UploadController-Dqjf23bS.js → UploadController-D-14HWII.js} +2 -2
- package/{cjs/WebhookPayload-CrMU6lg0.d.ts → esm/WebhookPayload-D_yWJA9M.d.ts} +5 -1
- package/esm/app.d.ts +4 -4
- package/esm/app.js +2 -2
- package/esm/elements.d.ts +8 -19
- package/esm/elements.js +44 -50
- package/esm/{index-BDxmVi-G.d.ts → index-CUA-HDNu.d.ts} +2 -2
- package/esm/index.d.ts +3 -3
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +3 -3
- package/esm/react-native.js +5 -5
- package/esm/react.d.ts +5 -11
- package/esm/react.js +29 -34
- package/esm/server.d.ts +4 -4
- package/esm/server.js +2 -2
- package/esm/styles.css +12 -16
- package/esm/svelte/CalmLensAsset.svelte +22 -4
- package/esm/svelte/index.d.ts +0 -6
- package/esm/svelte/index.js +0 -2
- package/esm/test-inputs.js +1 -1
- package/esm/testing.d.ts +4 -4
- package/esm/testing.js +45 -23
- package/esm/{ui-5IdEYYpC.d.ts → ui-BSm_qphN.d.ts} +3 -9
- package/esm/{ui-DF7-9mB3.js → ui-CgIG3knW.js} +3 -190
- package/esm/ui.d.ts +3 -3
- package/esm/ui.js +4 -4
- package/esm/vue.d.ts +6 -319
- package/esm/vue.js +26 -14
- package/package.json +1 -1
- package/esm/svelte/CalmLensImageViewer.svelte +0 -7
- package/esm/svelte/CalmLensWebsiteViewer.svelte +0 -7
package/README.md
CHANGED
|
@@ -36,8 +36,8 @@ const client = new CalmLensServerClient({
|
|
|
36
36
|
// Text (comments, captions, bios): waits for the decision
|
|
37
37
|
const comment = await client.text.classify({ text: "Great photo!", externalId: "comment-42" });
|
|
38
38
|
|
|
39
|
-
const {
|
|
40
|
-
if (
|
|
39
|
+
const { decision } = comment.classification.moderation;
|
|
40
|
+
if (decision === "allowed" || decision === "limited") {
|
|
41
41
|
// publish it; keep "limited" out of recommendations, trending and notifications
|
|
42
42
|
} else {
|
|
43
43
|
// "age-restricted": show it only behind your own age check; "blocked" or "purged": don't publish it
|
package/bin/calmlens.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
5
|
// package.json
|
|
6
|
-
var version = "0.27.
|
|
6
|
+
var version = "0.27.6";
|
|
7
7
|
|
|
8
8
|
// src/contract/ModerationCategories-CHFRoeWV.js
|
|
9
9
|
var CLASSIFICATION_CATEGORIES = [
|
|
@@ -64,6 +64,7 @@ var API_ERROR_CODES = {
|
|
|
64
64
|
INVALID_IMAGE: "image/invalid",
|
|
65
65
|
IMAGE_TOO_LARGE: "image/too-large",
|
|
66
66
|
FREE_UPLOADS_EXHAUSTED: "usage/free-uploads-exhausted",
|
|
67
|
+
WEBSITE_BILLING_REQUIRED: "payment/billing-required",
|
|
67
68
|
UPLOADS_PAUSED: "usage/uploads-paused",
|
|
68
69
|
UNSUPPORTED_UPLOAD_TYPE: "upload/unsupported-type",
|
|
69
70
|
INVALID_UPLOAD_PAYLOAD: "upload-payload/invalid",
|
|
@@ -103,6 +104,7 @@ var API_ERROR_CODES = {
|
|
|
103
104
|
HASH_LIST_ENTRY_NOT_FOUND: "hash-list-entry/not-found",
|
|
104
105
|
HASH_LIST_LIMIT_REACHED: "hash-list/limit-reached",
|
|
105
106
|
HASH_LIST_ENTRY_LIMIT_REACHED: "hash-list-entry/limit-reached",
|
|
107
|
+
HASH_LIST_ENTRY_QUALITY_TOO_LOW: "hash-list-entry/quality-too-low",
|
|
106
108
|
HASH_LIST_ASSET_NOT_HASHED: "hash-list/asset-not-hashed",
|
|
107
109
|
POLICY_NOT_FOUND: "policy/not-found",
|
|
108
110
|
POLICY_REVISION_CONFLICT: "policy/revision-conflict",
|
|
@@ -882,7 +884,7 @@ class CalmLensTransport {
|
|
|
882
884
|
}
|
|
883
885
|
}
|
|
884
886
|
|
|
885
|
-
// src/contract/SharedConstants-
|
|
887
|
+
// src/contract/SharedConstants-D-QkbICw.js
|
|
886
888
|
var IMPERSONATION_COOKIE_NAME = "CL_impersonation";
|
|
887
889
|
var DAY_MS = 86400000;
|
|
888
890
|
var YEAR_MS = 365 * DAY_MS;
|
|
@@ -995,7 +997,7 @@ var FIRST_PARTY_COOKIES = {
|
|
|
995
997
|
},
|
|
996
998
|
ASSET_DASHBOARD_STATE: {
|
|
997
999
|
name: "CL_assetDashboardState",
|
|
998
|
-
description: "Remembers your asset dashboard view (view mode
|
|
1000
|
+
description: "Remembers your asset dashboard view (view mode and metadata grouping)",
|
|
999
1001
|
expirationDescription: "1 year",
|
|
1000
1002
|
expirationMs: YEAR_MS,
|
|
1001
1003
|
type: "functional",
|
|
@@ -1043,6 +1045,14 @@ var FIRST_PARTY_COOKIES = {
|
|
|
1043
1045
|
type: "functional",
|
|
1044
1046
|
providerName: "CalmLens"
|
|
1045
1047
|
},
|
|
1048
|
+
CHATGPT_AD_CLICK: {
|
|
1049
|
+
name: "CL_chatgptAdClick",
|
|
1050
|
+
description: "Links a ChatGPT ad click to signups, moderation checks and credit checkouts",
|
|
1051
|
+
expirationDescription: "30 days",
|
|
1052
|
+
expirationMs: 30 * DAY_MS,
|
|
1053
|
+
type: "marketing",
|
|
1054
|
+
providerName: "CalmLens"
|
|
1055
|
+
},
|
|
1046
1056
|
SEARCH_SDK_LANGUAGE: {
|
|
1047
1057
|
name: "CL_searchSdkLanguage",
|
|
1048
1058
|
description: "Remembers the SDK you chose to filter documentation search results by",
|
|
@@ -2510,7 +2520,7 @@ var NULLABLE_OPTION_KEYS = {
|
|
|
2510
2520
|
"text.classify": ["authorId", "context", "description", "externalId", "folderId", "metadata", "processingOptions", "tags", "uploadPresetId", "visibility"]
|
|
2511
2521
|
};
|
|
2512
2522
|
|
|
2513
|
-
// src/contract/CryptoUtils-
|
|
2523
|
+
// src/contract/CryptoUtils-BLCa-oZe.js
|
|
2514
2524
|
var encoder = new TextEncoder;
|
|
2515
2525
|
var bytesToHex = (bytes) => Array.from(bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
2516
2526
|
var sha256Hex = async (value) => bytesToHex(await crypto.subtle.digest("SHA-256", encoder.encode(value)));
|
|
@@ -8869,7 +8879,7 @@ function refine(fn, _params = {}) {
|
|
|
8869
8879
|
function superRefine(fn, params) {
|
|
8870
8880
|
return _superRefine(fn, params);
|
|
8871
8881
|
}
|
|
8872
|
-
// src/contract/LazySchema-
|
|
8882
|
+
// src/contract/LazySchema-BKMpWIaF.js
|
|
8873
8883
|
var registryMap = globalRegistry._map;
|
|
8874
8884
|
var lazySchema = (build) => {
|
|
8875
8885
|
let schema;
|
|
@@ -8877,10 +8887,10 @@ var lazySchema = (build) => {
|
|
|
8877
8887
|
if (!schema) {
|
|
8878
8888
|
const built = build();
|
|
8879
8889
|
schema = built;
|
|
8890
|
+
const internals = built._zod;
|
|
8880
8891
|
const meta = registryMap.get(built);
|
|
8881
8892
|
if (meta !== undefined)
|
|
8882
8893
|
registryMap.set(proxy, meta);
|
|
8883
|
-
const internals = built._zod;
|
|
8884
8894
|
const process2 = internals.processJSONSchema;
|
|
8885
8895
|
if (process2)
|
|
8886
8896
|
internals.processJSONSchema = (context, json, params) => {
|
|
@@ -8930,7 +8940,7 @@ var lazySchema = (build) => {
|
|
|
8930
8940
|
return proxy;
|
|
8931
8941
|
};
|
|
8932
8942
|
|
|
8933
|
-
// src/contract/Jurisdiction-
|
|
8943
|
+
// src/contract/Jurisdiction-uODFGQGo.js
|
|
8934
8944
|
var JURISDICTIONS = {
|
|
8935
8945
|
global: {
|
|
8936
8946
|
name: "Global",
|
|
@@ -8979,7 +8989,7 @@ Object.keys(JURISDICTIONS).filter((code) => JURISDICTIONS[code].optional);
|
|
|
8979
8989
|
var COUNTRIES = new Set("AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW".split(" "));
|
|
8980
8990
|
var EU_COUNTRIES2 = new Set("AT BE BG HR CY CZ DK EE FI FR DE GR HU IE IT LV LT LU MT NL PL PT RO SK SI ES SE".split(" "));
|
|
8981
8991
|
|
|
8982
|
-
// src/contract/TestRegionalActions-
|
|
8992
|
+
// src/contract/TestRegionalActions-Ce8EVv4q.js
|
|
8983
8993
|
var msg = (text) => text;
|
|
8984
8994
|
var MODERATION_QUALIFIER_INFO = {
|
|
8985
8995
|
"sexual-pornographic-media": {
|
|
@@ -10004,7 +10014,7 @@ var TEST_REGIONAL_ACTIONS_SCHEMA = /* @__PURE__ */ lazySchema(() => array(object
|
|
|
10004
10014
|
])
|
|
10005
10015
|
}).strict()).max(7).refine((entries) => new Set(entries.map((entry) => entry.region)).size === entries.length, "Choose each region once"));
|
|
10006
10016
|
|
|
10007
|
-
// src/contract/TestTriggers-
|
|
10017
|
+
// src/contract/TestTriggers-DP4m92jg.js
|
|
10008
10018
|
var TEST_IMAGE_GRID_LEVELS = [
|
|
10009
10019
|
72,
|
|
10010
10020
|
128,
|
|
@@ -10073,19 +10083,19 @@ function testInputForSignal(signal, kind = "text") {
|
|
|
10073
10083
|
}
|
|
10074
10084
|
}
|
|
10075
10085
|
var TEST_DETECTION_BOX_MAX = 1e4;
|
|
10076
|
-
var basisPoints = number2().int().min(0).max(TEST_DETECTION_BOX_MAX);
|
|
10086
|
+
var basisPoints = /* @__PURE__ */ lazySchema(() => number2().int().min(0).max(TEST_DETECTION_BOX_MAX));
|
|
10077
10087
|
var detectionShape = {
|
|
10078
|
-
box: tuple([
|
|
10088
|
+
box: /* @__PURE__ */ lazySchema(() => tuple([
|
|
10079
10089
|
basisPoints,
|
|
10080
10090
|
basisPoints,
|
|
10081
10091
|
basisPoints,
|
|
10082
10092
|
basisPoints
|
|
10083
|
-
]),
|
|
10084
|
-
confidence: number2().int().min(0).max(100).optional()
|
|
10093
|
+
])),
|
|
10094
|
+
confidence: /* @__PURE__ */ lazySchema(() => number2().int().min(0).max(100).optional())
|
|
10085
10095
|
};
|
|
10086
10096
|
var fitsImage = ({ box: [left, top, width, height] }) => left + width <= 1e4 && top + height <= 1e4;
|
|
10087
10097
|
var BOX_MESSAGE = msg("A box must lie inside the image: left + width and top + height are at most 10000.");
|
|
10088
|
-
var ageYears = number2().int().min(0).max(120);
|
|
10098
|
+
var ageYears = /* @__PURE__ */ lazySchema(() => number2().int().min(0).max(120));
|
|
10089
10099
|
var TEST_DETECTED_PERSON_SCHEMA = /* @__PURE__ */ lazySchema(() => object(detectionShape).strict().refine(fitsImage, BOX_MESSAGE));
|
|
10090
10100
|
var TEST_DETECTED_FACE_SCHEMA = /* @__PURE__ */ lazySchema(() => object({
|
|
10091
10101
|
...detectionShape,
|
|
@@ -10597,7 +10607,7 @@ var applyConfiguration = async (client, config, state, plan, log = () => {}) =>
|
|
|
10597
10607
|
// src/cli/listen.ts
|
|
10598
10608
|
import { randomBytes } from "node:crypto";
|
|
10599
10609
|
|
|
10600
|
-
// src/contract/Ids-
|
|
10610
|
+
// src/contract/Ids-BBz_iuDy.js
|
|
10601
10611
|
var __defProp = Object.defineProperty;
|
|
10602
10612
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
10603
10613
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -18914,6 +18924,7 @@ createMetaType({
|
|
|
18914
18924
|
createMetaType({ id: "updatedAt" });
|
|
18915
18925
|
createMetaType({ id: "monotonicTimestamp" });
|
|
18916
18926
|
createMetaType({ id: "backfill" });
|
|
18927
|
+
createMetaType({ id: "computed" });
|
|
18917
18928
|
var ID_PREFIXES = {
|
|
18918
18929
|
organisation: "org",
|
|
18919
18930
|
project: "proj",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as UploadFile, I as UploadItem$1, L as UploadSnapshot$1, N as UploadController, P as UploadControllerOptions$1, h as UploaderProps$1, k as CalmLensUpload$1 } from "./Core-
|
|
2
|
-
import { r as UseCalmLensUploadResult$1 } from "./ReactUpload-
|
|
1
|
+
import { F as UploadFile, I as UploadItem$1, L as UploadSnapshot$1, N as UploadController, P as UploadControllerOptions$1, h as UploaderProps$1, k as CalmLensUpload$1 } from "./Core-Dhijt6JU.js";
|
|
2
|
+
import { r as UseCalmLensUploadResult$1 } from "./ReactUpload-BuqLPgNr.js";
|
|
3
3
|
type UploadItem<F extends UploadFile = File> = UploadItem$1<F>;
|
|
4
4
|
type CalmLensUpload<F extends UploadFile = File> = CalmLensUpload$1<F>;
|
|
5
5
|
type UploadSnapshot<F extends UploadFile = File> = UploadSnapshot$1<F>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_UploadController = require("./UploadController-
|
|
1
|
+
const require_UploadController = require("./UploadController-ChzDPMmm.js");
|
|
2
2
|
// src/ui/BrowserUpload.ts
|
|
3
3
|
/** Creates an upload queue for the browser components, such as one a form starts on submit. */
|
|
4
4
|
const createUploadController = (options) => require_UploadController.createUploadController(options);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as RetrieveAssetOptions, M as CdnAssetUrlOptions, O as CalmLensAppClientOptions, Ot as RequestOptions, Qt as UploadedAsset, Zt as UploadPresetSubmitAssetOptions, qt as UploadAssetPartOptions } from "./CalmLensTypes-
|
|
1
|
+
import { At as RetrieveAssetOptions, M as CdnAssetUrlOptions, O as CalmLensAppClientOptions, Ot as RequestOptions, Qt as UploadedAsset, Zt as UploadPresetSubmitAssetOptions, qt as UploadAssetPartOptions } from "./CalmLensTypes-DxxyZt2L.js";
|
|
2
2
|
declare const inspectSymbol: unique symbol;
|
|
3
3
|
declare class CalmLensAppClient {
|
|
4
4
|
#private;
|
|
@@ -37,7 +37,7 @@ declare class CalmLensAppClient {
|
|
|
37
37
|
* mode, chosen when it started, applies when the final part arrives.
|
|
38
38
|
*/
|
|
39
39
|
uploadPart: (partOptions: UploadAssetPartOptions, requestOptions?: RequestOptions) => Promise<UploadedAsset>;
|
|
40
|
-
/** Checks an upload this client made. `
|
|
40
|
+
/** Checks an upload this client made. `classification.moderation.decision` is present when the preset shows decisions. */
|
|
41
41
|
retrieve: (options: RetrieveAssetOptions, requestOptions?: RequestOptions) => Promise<UploadedAsset>;
|
|
42
42
|
};
|
|
43
43
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
-
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-DJyIjzIn.js");
|
|
2
|
+
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys--gTpTkwt.js");
|
|
3
3
|
// src/client/CalmLensAppClient.ts
|
|
4
4
|
const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
5
5
|
/** `options`, once `checkOptionKeys` finds only keys `operation` takes. */
|
|
@@ -119,7 +119,7 @@ getAssetUrl: (urlOptions) => {
|
|
|
119
119
|
const data = await this.#connection.forCall("assets.uploadPart", requestOptions).uploadPart(`${this.uploadsPath}/${encodedAssetId}/part`, options, this.authHeaders(assetId));
|
|
120
120
|
return require_CalmLensOptionKeys.expectUploadedAsset(data);
|
|
121
121
|
},
|
|
122
|
-
/** Checks an upload this client made. `
|
|
122
|
+
/** Checks an upload this client made. `classification.moderation.decision` is present when the preset shows decisions. */
|
|
123
123
|
retrieve: async (options, requestOptions) => {
|
|
124
124
|
const { assetId } = checked("assets.retrieve", options);
|
|
125
125
|
const encodedAssetId = require_ModerationContextLimits.encodePathSegment(assetId, "Asset ID");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-DJyIjzIn.js");
|
|
2
2
|
// src/contract/AssetPayload.js
|
|
3
3
|
const bufferInputToBytes = (value) => {
|
|
4
4
|
if (value instanceof ArrayBuffer) return new Uint8Array(value);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
-
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys
|
|
3
|
-
const
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-DJyIjzIn.js");
|
|
2
|
+
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys--gTpTkwt.js");
|
|
3
|
+
const require_CryptoUtils_BLCa_oZe = require("./CryptoUtils-BLCa-oZe-leCkr1ko.js");
|
|
4
4
|
// src/contract/JsonUtils.js
|
|
5
5
|
const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
|
|
6
6
|
if (!nestedValue || typeof nestedValue !== "object" || Array.isArray(nestedValue)) return nestedValue;
|
|
@@ -21,11 +21,11 @@ const fromBase64Url = (value) => {
|
|
|
21
21
|
*/
|
|
22
22
|
const uploadTokenKeyPrefix = (apiKey) => apiKey.substring(0, apiKey.startsWith("clsk_") ? 13 : 8);
|
|
23
23
|
/** The signing secret: the SHA-256 of the API key, which the backend stores instead of the key. */
|
|
24
|
-
const signingSecret = (apiKey) =>
|
|
24
|
+
const signingSecret = (apiKey) => require_CryptoUtils_BLCa_oZe.sha256Hex(apiKey);
|
|
25
25
|
/** Signs `claims` with `apiKey` and returns the token. */
|
|
26
26
|
const signUploadToken = async (claims, apiKey) => {
|
|
27
27
|
const body = toBase64Url(JSON.stringify(claims));
|
|
28
|
-
const signature = await
|
|
28
|
+
const signature = await require_CryptoUtils_BLCa_oZe.hmacSha256Hex(await signingSecret(apiKey), SIGNING_CONTEXT + body);
|
|
29
29
|
return `${UPLOAD_TOKEN_PREFIX}${body}.${signature}`;
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
@@ -115,9 +115,9 @@ async function verifyWebhookSignature(options) {
|
|
|
115
115
|
if (Math.abs(Math.floor(nowMs / 1e3) - Number(timestampText)) > toleranceSeconds) return false;
|
|
116
116
|
const candidates = signature.split(",").map((part) => part.trim()).filter((part) => part.startsWith("v1=")).map((part) => part.slice(3).toLowerCase());
|
|
117
117
|
if (candidates.length === 0) return false;
|
|
118
|
-
const expected = await
|
|
118
|
+
const expected = await require_CryptoUtils_BLCa_oZe.hmacSha256Hex(secret, `${timestampText}.${body}`);
|
|
119
119
|
let matched = false;
|
|
120
|
-
for (const candidate of candidates) if (
|
|
120
|
+
for (const candidate of candidates) if (require_CryptoUtils_BLCa_oZe.timingSafeEqual(expected, candidate)) matched = true;
|
|
121
121
|
return matched;
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as HashListEntry, u as HashList } from "./Classification-CMM2tZpJ-IdIh63n0.js";
|
|
2
|
-
import { $ as FolderPage, $t as VerifyWebhookSignatureOptions, An as Policy, At as RetrieveAssetOptions, B as CreateHashListOptions, Bt as UpdateAssetOptions, D as BatchAssetsResponse, E as BatchAssetsOptions, Et as RemoveAssetContentOptions, Ft as SignUploadTokenOptions, G as DeleteAssetOptions, Gt as UpdateProjectSettingsOptions, Ht as UpdateHashListOptions, I as ClassifyTextOptions, In as AssetInfo, It as SignedAssetUrl, J as EnsureLensesOptions, K as DeleteMetadataFieldOptions, Kt as UpgradePolicyOptions, Lt as SignedUploadToken, M as CdnAssetUrlOptions, Nt as SetPolicyAutomaticUpdatesOptions, Ot as RequestOptions, P as CdnServeOptions, Pn as AssetSearchQuery, Pt as SignAssetUrlOptions, Q as FolderIdOptions, T as AssignPolicyOptions, Tt as PolicyPage, U as CreatePolicyOptions, Ut as UpdateLensOptions, V as CreateLensOptions, Vt as UpdateFolderOptions, W as DecideAssetOptions, Wt as UpdatePolicyOptions, X as EnsureUploadPresetsOptions, Xt as UploadPresetPage, Y as EnsureMetadataFieldsOptions, Yt as UploadPresetIdOptions, Z as EnsureUploadPresetsResponse, _ as AssetPage, _n as Folder, _t as ListLensesOptions, b as AssetTimelinePage, bt as MoveAssetOptions, ct as LensIdOptions, dt as ListAssetTimelineOptions, et as GetAssetInfoOptions, ft as ListAssetsOptions, gt as ListHashListsOptions, ht as ListHashListEntriesOptions, it as HashListPage, jt as RetryAssetOptions, k as CalmLensServerClientOptions, kt as ResetPolicyOptions, lt as LensPage, mt as ListFoldersOptions, nt as HashListEntryPage, o as AssetChildrenPage, on as GetEventsResponse, pt as ListEventsOptions, q as EnsureLensOptions, qt as UploadAssetPartOptions, r as Asset, rt as HashListIdOptions, st as Lens, t as AddHashListEntryOptions, tn as WaitForAssetDecisionOptions, tt as HashListEntryIdOptions, ut as ListAssetChildrenOptions, v as AssetSearchResponse, vn as MetadataFieldsResource, vt as ListPoliciesOptions, wt as PolicyIdOptions, xt as MoveFolderOptions, yn as ProjectSettingsResource, yt as ListUploadPresetsOptions, z as CreateFolderOptions, zt as SubmitAssetOptions } from "./CalmLensTypes-
|
|
3
|
-
import { d as ListPromise, l as CalmLensResponse, r as CdnResponse } from "./WebhookPayload-
|
|
2
|
+
import { $ as FolderPage, $t as VerifyWebhookSignatureOptions, An as Policy, At as RetrieveAssetOptions, B as CreateHashListOptions, Bt as UpdateAssetOptions, D as BatchAssetsResponse, E as BatchAssetsOptions, Et as RemoveAssetContentOptions, Ft as SignUploadTokenOptions, G as DeleteAssetOptions, Gt as UpdateProjectSettingsOptions, Ht as UpdateHashListOptions, I as ClassifyTextOptions, In as AssetInfo, It as SignedAssetUrl, J as EnsureLensesOptions, K as DeleteMetadataFieldOptions, Kt as UpgradePolicyOptions, Lt as SignedUploadToken, M as CdnAssetUrlOptions, Nt as SetPolicyAutomaticUpdatesOptions, Ot as RequestOptions, P as CdnServeOptions, Pn as AssetSearchQuery, Pt as SignAssetUrlOptions, Q as FolderIdOptions, T as AssignPolicyOptions, Tt as PolicyPage, U as CreatePolicyOptions, Ut as UpdateLensOptions, V as CreateLensOptions, Vt as UpdateFolderOptions, W as DecideAssetOptions, Wt as UpdatePolicyOptions, X as EnsureUploadPresetsOptions, Xt as UploadPresetPage, Y as EnsureMetadataFieldsOptions, Yt as UploadPresetIdOptions, Z as EnsureUploadPresetsResponse, _ as AssetPage, _n as Folder, _t as ListLensesOptions, b as AssetTimelinePage, bt as MoveAssetOptions, ct as LensIdOptions, dt as ListAssetTimelineOptions, et as GetAssetInfoOptions, ft as ListAssetsOptions, gt as ListHashListsOptions, ht as ListHashListEntriesOptions, it as HashListPage, jt as RetryAssetOptions, k as CalmLensServerClientOptions, kt as ResetPolicyOptions, lt as LensPage, mt as ListFoldersOptions, nt as HashListEntryPage, o as AssetChildrenPage, on as GetEventsResponse, pt as ListEventsOptions, q as EnsureLensOptions, qt as UploadAssetPartOptions, r as Asset, rt as HashListIdOptions, st as Lens, t as AddHashListEntryOptions, tn as WaitForAssetDecisionOptions, tt as HashListEntryIdOptions, ut as ListAssetChildrenOptions, v as AssetSearchResponse, vn as MetadataFieldsResource, vt as ListPoliciesOptions, wt as PolicyIdOptions, xt as MoveFolderOptions, yn as ProjectSettingsResource, yt as ListUploadPresetsOptions, z as CreateFolderOptions, zt as SubmitAssetOptions } from "./CalmLensTypes-DxxyZt2L.js";
|
|
3
|
+
import { d as ListPromise, l as CalmLensResponse, r as CdnResponse } from "./WebhookPayload-D_yWJA9M.js";
|
|
4
4
|
interface TransportRequest {
|
|
5
5
|
/** The client method sending the request, such as `assets.retrieve`, for hooks and logs. */
|
|
6
6
|
operation?: string;
|
|
@@ -5017,11 +5017,11 @@ declare const ASSET_CLASSIFICATION_SCHEMA: zod.ZodObject<{
|
|
|
5017
5017
|
"processing-error": "processing-error";
|
|
5018
5018
|
"resolution-limit": "resolution-limit";
|
|
5019
5019
|
"too-many-items": "too-many-items";
|
|
5020
|
-
"website-unavailable": "website-unavailable";
|
|
5021
5020
|
"type-mismatch": "type-mismatch";
|
|
5022
5021
|
"undecodable-content": "undecodable-content";
|
|
5023
5022
|
"unsupported-format": "unsupported-format";
|
|
5024
5023
|
"uploads-paused": "uploads-paused";
|
|
5024
|
+
"website-unavailable": "website-unavailable";
|
|
5025
5025
|
}>>;
|
|
5026
5026
|
updatedAt: zod.ZodNullable<zod.ZodNumber>;
|
|
5027
5027
|
completedAt: zod.ZodNullable<zod.ZodNumber>;
|
|
@@ -10140,11 +10140,11 @@ declare const ASSET_SCHEMA: zod.ZodObject<{
|
|
|
10140
10140
|
"processing-error": "processing-error";
|
|
10141
10141
|
"resolution-limit": "resolution-limit";
|
|
10142
10142
|
"too-many-items": "too-many-items";
|
|
10143
|
-
"website-unavailable": "website-unavailable";
|
|
10144
10143
|
"type-mismatch": "type-mismatch";
|
|
10145
10144
|
"undecodable-content": "undecodable-content";
|
|
10146
10145
|
"unsupported-format": "unsupported-format";
|
|
10147
10146
|
"uploads-paused": "uploads-paused";
|
|
10147
|
+
"website-unavailable": "website-unavailable";
|
|
10148
10148
|
}>>;
|
|
10149
10149
|
updatedAt: zod.ZodNullable<zod.ZodNumber>;
|
|
10150
10150
|
completedAt: zod.ZodNullable<zod.ZodNumber>;
|
|
@@ -15396,11 +15396,11 @@ declare const ASSET_SEARCH_RESULT_SCHEMA: zod.ZodObject<{
|
|
|
15396
15396
|
"processing-error": "processing-error";
|
|
15397
15397
|
"resolution-limit": "resolution-limit";
|
|
15398
15398
|
"too-many-items": "too-many-items";
|
|
15399
|
-
"website-unavailable": "website-unavailable";
|
|
15400
15399
|
"type-mismatch": "type-mismatch";
|
|
15401
15400
|
"undecodable-content": "undecodable-content";
|
|
15402
15401
|
"unsupported-format": "unsupported-format";
|
|
15403
15402
|
"uploads-paused": "uploads-paused";
|
|
15403
|
+
"website-unavailable": "website-unavailable";
|
|
15404
15404
|
}>>;
|
|
15405
15405
|
updatedAt: zod.ZodNullable<zod.ZodNumber>;
|
|
15406
15406
|
completedAt: zod.ZodNullable<zod.ZodNumber>;
|
|
@@ -36368,11 +36368,11 @@ declare const EVENT_TYPE_INFO: {
|
|
|
36368
36368
|
"processing-error": "processing-error";
|
|
36369
36369
|
"resolution-limit": "resolution-limit";
|
|
36370
36370
|
"too-many-items": "too-many-items";
|
|
36371
|
-
"website-unavailable": "website-unavailable";
|
|
36372
36371
|
"type-mismatch": "type-mismatch";
|
|
36373
36372
|
"undecodable-content": "undecodable-content";
|
|
36374
36373
|
"unsupported-format": "unsupported-format";
|
|
36375
36374
|
"uploads-paused": "uploads-paused";
|
|
36375
|
+
"website-unavailable": "website-unavailable";
|
|
36376
36376
|
}>>;
|
|
36377
36377
|
};
|
|
36378
36378
|
/** Example data, used for synthetic test sends (`createSampleEvent`). */
|
|
@@ -36431,11 +36431,11 @@ declare const EVENT_TYPE_INFO: {
|
|
|
36431
36431
|
"processing-error": "processing-error";
|
|
36432
36432
|
"resolution-limit": "resolution-limit";
|
|
36433
36433
|
"too-many-items": "too-many-items";
|
|
36434
|
-
"website-unavailable": "website-unavailable";
|
|
36435
36434
|
"type-mismatch": "type-mismatch";
|
|
36436
36435
|
"undecodable-content": "undecodable-content";
|
|
36437
36436
|
"unsupported-format": "unsupported-format";
|
|
36438
36437
|
"uploads-paused": "uploads-paused";
|
|
36438
|
+
"website-unavailable": "website-unavailable";
|
|
36439
36439
|
}>;
|
|
36440
36440
|
}, zod.core.$strip>;
|
|
36441
36441
|
};
|
|
@@ -36511,6 +36511,72 @@ declare const EVENT_TYPE_INFO: {
|
|
|
36511
36511
|
totalSections: zod.ZodNumber;
|
|
36512
36512
|
}, zod.core.$strip>;
|
|
36513
36513
|
};
|
|
36514
|
+
readonly "asset.media-ready": {
|
|
36515
|
+
id: "asset.media-ready";
|
|
36516
|
+
name: string;
|
|
36517
|
+
description: string;
|
|
36518
|
+
category: EventCategory;
|
|
36519
|
+
severity: EventSeverity;
|
|
36520
|
+
/** Whether the in-app connector (notification bell) subscribes to the type by default. */
|
|
36521
|
+
notify: boolean;
|
|
36522
|
+
/**
|
|
36523
|
+
* The project-wide permission needed to see events of this type (portal feed, public events
|
|
36524
|
+
* feed) and to subscribe a connector to it.
|
|
36525
|
+
*/
|
|
36526
|
+
permission: PermissionAction;
|
|
36527
|
+
/** Types of unreleased features are left out of the published contract until enabled. */
|
|
36528
|
+
enabled?: boolean;
|
|
36529
|
+
fields: {
|
|
36530
|
+
assetName: EventFieldDefinition<zod.ZodOptional<zod.ZodNullable<zod.ZodString>>>;
|
|
36531
|
+
assetType: EventFieldDefinition<zod.ZodOptional<zod.ZodNullable<zod.ZodEnum<{
|
|
36532
|
+
audio: "audio";
|
|
36533
|
+
file: "file";
|
|
36534
|
+
image: "image";
|
|
36535
|
+
"multimedia-document": "multimedia-document";
|
|
36536
|
+
"plaintext-document": "plaintext-document";
|
|
36537
|
+
video: "video";
|
|
36538
|
+
website: "website";
|
|
36539
|
+
}>>>>;
|
|
36540
|
+
};
|
|
36541
|
+
/** Example data, used for synthetic test sends (`createSampleEvent`). */
|
|
36542
|
+
example: NoInfer<{
|
|
36543
|
+
assetName?: string | null | undefined;
|
|
36544
|
+
assetType?: "audio" | "file" | "image" | "multimedia-document" | "plaintext-document" | "video" | "website" | null | undefined;
|
|
36545
|
+
}>;
|
|
36546
|
+
factInfo: {
|
|
36547
|
+
label: string;
|
|
36548
|
+
description: string;
|
|
36549
|
+
display: EventFieldDisplay;
|
|
36550
|
+
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
36551
|
+
hidden?: boolean;
|
|
36552
|
+
/**
|
|
36553
|
+
* Personal or account-level data that stays in the portal. Webhook, Slack and email deliveries,
|
|
36554
|
+
* and the public events feed, leave the fact out and word the title and description without it.
|
|
36555
|
+
*/
|
|
36556
|
+
inAppOnly?: boolean;
|
|
36557
|
+
/**
|
|
36558
|
+
* A person's name: `actor` names the event's `actor`, `member` the member in the `member-user-id`
|
|
36559
|
+
* fact. Deleting their account removes it from the events that name them.
|
|
36560
|
+
*/
|
|
36561
|
+
names?: "actor" | "member";
|
|
36562
|
+
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
36563
|
+
valueLabels?: Readonly<Record<string, string>>;
|
|
36564
|
+
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
36565
|
+
key: string;
|
|
36566
|
+
}[];
|
|
36567
|
+
values: zod.ZodObject<{
|
|
36568
|
+
assetName: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
36569
|
+
assetType: zod.ZodOptional<zod.ZodNullable<zod.ZodEnum<{
|
|
36570
|
+
audio: "audio";
|
|
36571
|
+
file: "file";
|
|
36572
|
+
image: "image";
|
|
36573
|
+
"multimedia-document": "multimedia-document";
|
|
36574
|
+
"plaintext-document": "plaintext-document";
|
|
36575
|
+
video: "video";
|
|
36576
|
+
website: "website";
|
|
36577
|
+
}>>>;
|
|
36578
|
+
}, zod.core.$strip>;
|
|
36579
|
+
};
|
|
36514
36580
|
readonly "asset.deleted": {
|
|
36515
36581
|
id: "asset.deleted";
|
|
36516
36582
|
name: string;
|
|
@@ -38176,6 +38242,7 @@ declare const PUBLIC_EVENT_SCHEMA: zod.ZodObject<{
|
|
|
38176
38242
|
"asset.hash-matched": "asset.hash-matched";
|
|
38177
38243
|
"asset.limited": "asset.limited";
|
|
38178
38244
|
"asset.link-flagged": "asset.link-flagged";
|
|
38245
|
+
"asset.media-ready": "asset.media-ready";
|
|
38179
38246
|
"asset.progress-updated": "asset.progress-updated";
|
|
38180
38247
|
"asset.purged": "asset.purged";
|
|
38181
38248
|
"asset.region-restricted": "asset.region-restricted";
|
|
@@ -42376,6 +42443,7 @@ declare const GET_EVENTS_QUERY_SCHEMA: zod.ZodObject<{
|
|
|
42376
42443
|
"asset.hash-matched": "asset.hash-matched";
|
|
42377
42444
|
"asset.limited": "asset.limited";
|
|
42378
42445
|
"asset.link-flagged": "asset.link-flagged";
|
|
42446
|
+
"asset.media-ready": "asset.media-ready";
|
|
42379
42447
|
"asset.progress-updated": "asset.progress-updated";
|
|
42380
42448
|
"asset.purged": "asset.purged";
|
|
42381
42449
|
"asset.region-restricted": "asset.region-restricted";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
-
const require_UploadController = require("./UploadController-
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-DJyIjzIn.js");
|
|
2
|
+
const require_UploadController = require("./UploadController-ChzDPMmm.js");
|
|
3
3
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
4
4
|
// src/ui/viewers/ViewerAsset.ts
|
|
5
5
|
/** Spreadsheet MIME types, as `content.format` reports them (compared lower-cased). */
|
|
@@ -89,7 +89,7 @@ const VIEWER_STYLES = `
|
|
|
89
89
|
/* An opaque surface of its own, so sticky headers and the toolbar cover what scrolls under them. */
|
|
90
90
|
background: var(--calmlens-viewer-background, Canvas); color: var(--calmlens-viewer-text, CanvasText);
|
|
91
91
|
}
|
|
92
|
-
.calmlens-viewer:is([data-kind="text"], [data-kind="document"], [data-kind="spreadsheet"]
|
|
92
|
+
.calmlens-viewer:is([data-kind="text"], [data-kind="document"], [data-kind="spreadsheet"]) > .calmlens-viewer__frame { min-height: 320px; }
|
|
93
93
|
.calmlens-viewer :focus-visible {
|
|
94
94
|
outline: 2px solid var(--calmlens-focus-ring); outline-offset: -2px;
|
|
95
95
|
}
|
|
@@ -110,18 +110,6 @@ const VIEWER_STYLES = `
|
|
|
110
110
|
.calmlens-viewer__spacer { flex: 1; }
|
|
111
111
|
.calmlens-viewer__link { text-decoration: none; overflow-wrap: anywhere; }
|
|
112
112
|
.calmlens-viewer__scroll { flex: 1; min-height: 0; overflow: auto; position: relative; }
|
|
113
|
-
/* Images fit inside the frame, keeping their shape; without a frame height, the box takes it. */
|
|
114
|
-
.calmlens-viewer[data-kind="image"] > .calmlens-viewer__frame { aspect-ratio: var(--calmlens-viewer-ratio, auto); max-height: 100%; }
|
|
115
|
-
.calmlens-viewer[data-kind="image"] > .calmlens-viewer__frame > img {
|
|
116
|
-
position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
|
|
117
|
-
}
|
|
118
|
-
.calmlens-viewer:not([data-kind="image"]) .calmlens-viewer__placeholder {
|
|
119
|
-
position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top;
|
|
120
|
-
}
|
|
121
|
-
.calmlens-viewer__placeholder { filter: blur(12px); transform: scale(1.05); }
|
|
122
|
-
.calmlens-viewer__image { opacity: 0; transition: opacity 250ms; }
|
|
123
|
-
.calmlens-viewer[data-state="loaded"] .calmlens-viewer__image { opacity: 1; }
|
|
124
|
-
.calmlens-viewer[data-kind="website"] .calmlens-viewer__image { position: relative; display: block; width: 100%; height: auto; }
|
|
125
113
|
.calmlens-viewer__text {
|
|
126
114
|
margin: 0 auto; padding: 20px 24px; max-width: 75ch; white-space: pre-wrap; overflow-wrap: anywhere;
|
|
127
115
|
font-family: inherit; font-size: 1rem; line-height: 1.6;
|
|
@@ -178,6 +166,20 @@ const decodePlaceholderHash = (hash) => {
|
|
|
178
166
|
}
|
|
179
167
|
return decodedPlaceholders.get(hash);
|
|
180
168
|
};
|
|
169
|
+
/** Default responsive widths offered for full rendered images, up to 2560px. */
|
|
170
|
+
const DEFAULT_IMAGE_WIDTHS = [
|
|
171
|
+
320,
|
|
172
|
+
640,
|
|
173
|
+
960,
|
|
174
|
+
1280,
|
|
175
|
+
1920,
|
|
176
|
+
2560
|
|
177
|
+
];
|
|
178
|
+
const hasExplicitSize = (transform) => {
|
|
179
|
+
if (!transform) return false;
|
|
180
|
+
if (typeof transform === "string") return /(?:^|,)\s*(?:width|height)=/i.test(transform);
|
|
181
|
+
return transform.width !== void 0 || transform.height !== void 0;
|
|
182
|
+
};
|
|
181
183
|
const withWidth = (base, width) => {
|
|
182
184
|
if (width === void 0) return base;
|
|
183
185
|
if (base === void 0 || typeof base !== "string") return {
|
|
@@ -255,17 +257,30 @@ const getAssetView = (options, state) => {
|
|
|
255
257
|
};
|
|
256
258
|
const image = options.image ?? {};
|
|
257
259
|
const still = (resource, size) => {
|
|
258
|
-
const widths = [...new Set(image.widths ?? [])].filter((width) => Number.isSafeInteger(width) && width > 0).sort((a, b) => a - b);
|
|
259
260
|
const build = (width) => url(resource, {
|
|
260
261
|
lens: image.lens,
|
|
261
262
|
transform: withWidth(image.transform, width)
|
|
262
263
|
});
|
|
263
|
-
const
|
|
264
|
+
const explicitWidths = image.widths !== void 0;
|
|
265
|
+
let sources;
|
|
266
|
+
if (explicitWidths) sources = [...new Set(image.widths ?? [])].filter((width) => Number.isSafeInteger(width) && width > 0).sort((a, b) => a - b).map((width) => ({
|
|
264
267
|
src: build(width),
|
|
265
268
|
width
|
|
266
269
|
}));
|
|
270
|
+
else if (resource === "rendered" && !image.lens && !hasExplicitSize(image.transform)) {
|
|
271
|
+
const maxWidth = size?.width ?? void 0;
|
|
272
|
+
const candidates = DEFAULT_IMAGE_WIDTHS.filter((width) => !maxWidth || width < maxWidth);
|
|
273
|
+
sources = candidates.map((width) => ({
|
|
274
|
+
src: build(width),
|
|
275
|
+
width
|
|
276
|
+
}));
|
|
277
|
+
if (maxWidth && candidates.length > 0 && maxWidth <= DEFAULT_IMAGE_WIDTHS.at(-1)) sources.push({
|
|
278
|
+
src: build(),
|
|
279
|
+
width: maxWidth
|
|
280
|
+
});
|
|
281
|
+
} else sources = [];
|
|
267
282
|
return {
|
|
268
|
-
src: sources.at(-1)?.src ?? build(),
|
|
283
|
+
src: explicitWidths ? sources.at(-1)?.src ?? build() : build(),
|
|
269
284
|
srcSet: sources.length ? sources.map(({ src: source, width }) => `${source} ${width}w`).join(", ") : void 0,
|
|
270
285
|
sources: sources.length ? sources : void 0,
|
|
271
286
|
width: size?.width ?? void 0,
|
|
@@ -363,6 +378,13 @@ const pickAssetSource = (view, displayWidth) => {
|
|
|
363
378
|
const getPeakHeights = (peaks) => peaks.map((peak) => Math.round(Math.min(1, Math.max(.02, peak)) * 1e3) / 10);
|
|
364
379
|
/** How much of a media element has played, in percent, to one decimal place. */
|
|
365
380
|
const getPlayedPercent = (media) => Number.isFinite(media.duration) && media.duration > 0 ? Math.round(Math.min(1, Math.max(0, media.currentTime / media.duration)) * 1e3) / 10 : 0;
|
|
381
|
+
/**
|
|
382
|
+
* How soon after an image element mounts an `onload` still counts as a browser cache hit (such as
|
|
383
|
+
* the HTTP disk cache, where `complete` is false on mount) and appears immediately without fading.
|
|
384
|
+
*/
|
|
385
|
+
const INSTANT_LOAD_MS = 50;
|
|
386
|
+
/** True when an image element is already decoded in the browser's memory cache. */
|
|
387
|
+
const isImageReady = (image) => Boolean(image?.complete && image.naturalWidth > 0);
|
|
366
388
|
const codeOf = (error) => require_ModerationContextLimits.CalmLensError.isCalmLensError(error) ? error.code : void 0;
|
|
367
389
|
/**
|
|
368
390
|
* One `CalmLensAsset`'s connection to the CDN. Each render calls `update` with the options and
|
|
@@ -793,7 +815,7 @@ const CALMLENS_STYLES = `
|
|
|
793
815
|
}
|
|
794
816
|
.calmlens-icon-button:hover { background: color-mix(in srgb, var(--calmlens-accent) 8%, transparent); border-color: var(--calmlens-border); }
|
|
795
817
|
@media (prefers-reduced-motion: reduce) {
|
|
796
|
-
.calmlens-dropzone, .calmlens-dropzone__icon
|
|
818
|
+
.calmlens-dropzone, .calmlens-dropzone__icon { transition: none; }
|
|
797
819
|
.calmlens-progress:indeterminate {
|
|
798
820
|
--calmlens-progress-animation: calmlens-indeterminate-still 1s both;
|
|
799
821
|
}
|
|
@@ -812,9 +834,17 @@ const CALMLENS_STYLES = `
|
|
|
812
834
|
.calmlens-asset:not([data-sized]) .calmlens-asset__content { position: relative; height: auto; }
|
|
813
835
|
.calmlens-asset:not([data-sized])[data-kind="age-restricted"], .calmlens-asset:not([data-sized])[data-kind="unavailable"],
|
|
814
836
|
.calmlens-asset:not([data-sized])[data-state="error"] { min-height: 160px; }
|
|
815
|
-
.calmlens-asset__placeholder { transform: scale(1.1); filter: blur(12px); }
|
|
816
|
-
.calmlens-asset__content { opacity: 0;
|
|
837
|
+
.calmlens-asset__placeholder { transform: scale(1.1); filter: blur(12px); opacity: 1; pointer-events: none; }
|
|
838
|
+
.calmlens-asset__content { opacity: 0; }
|
|
817
839
|
.calmlens-asset[data-state="loaded"] .calmlens-asset__content { opacity: 1; }
|
|
840
|
+
.calmlens-asset[data-state="loaded"]:not([data-kind="age-restricted"]) .calmlens-asset__placeholder { opacity: 0; visibility: hidden; }
|
|
841
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
842
|
+
.calmlens-asset[data-state="loaded"]:not([data-instant]) { transition: background-color 250ms; }
|
|
843
|
+
.calmlens-asset[data-state="loaded"]:not([data-instant]) .calmlens-asset__content { transition: opacity 250ms; }
|
|
844
|
+
.calmlens-asset[data-state="loaded"]:not([data-kind="age-restricted"], [data-instant]) .calmlens-asset__placeholder {
|
|
845
|
+
transition: opacity 250ms, visibility 0s linear 250ms;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
818
848
|
.calmlens-asset[data-kind="video"] .calmlens-asset__content, .calmlens-asset[data-kind="audio"] .calmlens-asset__content { opacity: 1; }
|
|
819
849
|
/* Documents, text and spreadsheets fill the box with their viewer; a document shows its first
|
|
820
850
|
page's still and an open link until the viewer loads. */
|
|
@@ -914,6 +944,12 @@ Object.defineProperty(exports, "ICON_ATTRIBUTES", {
|
|
|
914
944
|
return ICON_ATTRIBUTES;
|
|
915
945
|
}
|
|
916
946
|
});
|
|
947
|
+
Object.defineProperty(exports, "INSTANT_LOAD_MS", {
|
|
948
|
+
enumerable: true,
|
|
949
|
+
get: function() {
|
|
950
|
+
return INSTANT_LOAD_MS;
|
|
951
|
+
}
|
|
952
|
+
});
|
|
917
953
|
Object.defineProperty(exports, "VIEWER_STYLES", {
|
|
918
954
|
enumerable: true,
|
|
919
955
|
get: function() {
|
|
@@ -998,6 +1034,12 @@ Object.defineProperty(exports, "getUploadItemOutcome", {
|
|
|
998
1034
|
return getUploadItemOutcome;
|
|
999
1035
|
}
|
|
1000
1036
|
});
|
|
1037
|
+
Object.defineProperty(exports, "isImageReady", {
|
|
1038
|
+
enumerable: true,
|
|
1039
|
+
get: function() {
|
|
1040
|
+
return isImageReady;
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1001
1043
|
Object.defineProperty(exports, "isSpreadsheetFormat", {
|
|
1002
1044
|
enumerable: true,
|
|
1003
1045
|
get: function() {
|