calmlens 0.31.0 → 0.32.0
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/bin/calmlens.js +47 -39
- package/cjs/{BrowserUpload-IiRDbL85.js → BrowserUpload-CbbFE-2v.js} +1 -1
- package/cjs/{BrowserUpload-BAH54V1q.d.ts → BrowserUpload-Dx2l9wC0.d.ts} +2 -2
- package/cjs/{CalmLensAppClient-BBcq6pJg.js → CalmLensAppClient-DOYOJ70t.js} +4 -4
- package/{esm/CalmLensAppClient-CdlcDd5l.d.ts → cjs/CalmLensAppClient-v1Ho7mJQ.d.ts} +3 -3
- package/cjs/{CalmLensCdn-2VbArrj-.js → CalmLensCdn-xQMrClXN.js} +56 -22
- package/cjs/{CalmLensConnection-CpnDGa8W.js → CalmLensConnection-DbsCA8xF.js} +7 -16
- package/cjs/{CalmLensServerClient-CtS66dCU.d.ts → CalmLensServerClient-CoiZN7Fr.d.ts} +9 -9
- package/cjs/{CalmLensServerClient-DbemlDXj.js → CalmLensServerClient-DtqFQgUn.js} +12 -15
- package/cjs/{CalmLensTypes-87kiUg0H.d.ts → CalmLensTypes-DjuOXp3b.d.ts} +8 -15
- package/cjs/{Core-xy9aV1ED.js → Core-BtFJ2xfb.js} +2 -2
- package/cjs/{Core-Ccy4-_sN.d.ts → Core-DaCkaDkb.d.ts} +2 -2
- package/cjs/{ReactUpload-BX3XOVfb.js → ReactUpload-CRtUXzMP.js} +1 -1
- package/cjs/{ReactUpload-DBhppuxM.d.ts → ReactUpload-DMtaeFN2.d.ts} +1 -1
- package/{esm/TestTriggers-Daxebd0V.d.ts → cjs/TestTriggers-CjDhhz78.d.ts} +1 -11
- package/cjs/{UploadController-CmTjpOfp.js → UploadController-tKqKphf3.js} +1 -1
- package/cjs/{WebhookPayload-B4rA_Dvm.d.ts → WebhookPayload-C3F9j4p7.d.ts} +1 -1
- package/cjs/app.d.ts +4 -4
- package/cjs/app.js +2 -2
- package/cjs/elements.d.ts +4 -4
- package/cjs/elements.js +4 -4
- package/cjs/{index-CWUnLKoF.d.ts → index-xF6Neq8A.d.ts} +2 -2
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +1 -1
- package/cjs/react-native.d.ts +2 -2
- package/cjs/react-native.js +4 -4
- package/cjs/react.d.ts +4 -4
- package/cjs/react.js +5 -5
- package/cjs/server.d.ts +4 -4
- package/cjs/server.js +2 -2
- package/cjs/test-inputs.d.ts +15 -3
- package/cjs/test-inputs.js +105 -2
- package/cjs/testing.d.ts +14 -6
- package/cjs/testing.js +122 -52
- package/cjs/{ui-BJKh49aM.js → ui-B5tgw_En.js} +8 -8
- package/cjs/{ui-sjnJhloQ.d.ts → ui-C_AhYdIA.d.ts} +2 -2
- package/cjs/ui.d.ts +2 -2
- package/cjs/ui.js +3 -3
- package/cjs/vue.d.ts +5 -5
- package/cjs/vue.js +4 -4
- package/esm/{BrowserUpload-C5aXj6QC.js → BrowserUpload-Dizcs8rx.js} +1 -1
- package/esm/{BrowserUpload-BAH54V1q.d.ts → BrowserUpload-Dx2l9wC0.d.ts} +2 -2
- package/esm/{CalmLensAppClient-gAd0C_Q_.js → CalmLensAppClient-C0Ud7eYa.js} +4 -4
- package/{cjs/CalmLensAppClient-CdlcDd5l.d.ts → esm/CalmLensAppClient-v1Ho7mJQ.d.ts} +3 -3
- package/esm/{CalmLensCdn-CcxEY6wB.js → CalmLensCdn--hZgorld.js} +39 -23
- package/esm/{CalmLensConnection-CfGVp95D.js → CalmLensConnection-dz5Kl3uC.js} +7 -16
- package/esm/{CalmLensServerClient-CPWeRVWO.js → CalmLensServerClient-BBPwU8mm.js} +12 -15
- package/esm/{CalmLensServerClient-CtS66dCU.d.ts → CalmLensServerClient-CoiZN7Fr.d.ts} +9 -9
- package/esm/{CalmLensTypes-87kiUg0H.d.ts → CalmLensTypes-DjuOXp3b.d.ts} +8 -15
- package/esm/{Core-Ccy4-_sN.d.ts → Core-DaCkaDkb.d.ts} +2 -2
- package/esm/{Core-DTcxpv3O.js → Core-Dti4LlA-.js} +2 -2
- package/esm/{ReactUpload-Dg7MtjbJ.js → ReactUpload-Cmz063Os.js} +1 -1
- package/esm/{ReactUpload-DBhppuxM.d.ts → ReactUpload-DMtaeFN2.d.ts} +1 -1
- package/{cjs/TestTriggers-Daxebd0V.d.ts → esm/TestTriggers-CjDhhz78.d.ts} +1 -11
- package/esm/{UploadController-DVsTVJVv.js → UploadController-D3um1cq9.js} +1 -1
- package/esm/{WebhookPayload-B4rA_Dvm.d.ts → WebhookPayload-C3F9j4p7.d.ts} +1 -1
- package/esm/app.d.ts +4 -4
- package/esm/app.js +2 -2
- package/esm/elements.d.ts +4 -4
- package/esm/elements.js +4 -4
- package/esm/{index-CWUnLKoF.d.ts → index-xF6Neq8A.d.ts} +2 -2
- package/esm/index.d.ts +3 -3
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +2 -2
- package/esm/react-native.js +4 -4
- package/esm/react.d.ts +4 -4
- package/esm/react.js +5 -5
- package/esm/server.d.ts +4 -4
- package/esm/server.js +2 -2
- package/esm/test-inputs.d.ts +15 -3
- package/esm/test-inputs.js +105 -2
- package/esm/testing.d.ts +14 -6
- package/esm/testing.js +122 -52
- package/esm/{ui-DUao8UY0.js → ui-B7Z6FH5F.js} +8 -8
- package/esm/{ui-sjnJhloQ.d.ts → ui-C_AhYdIA.d.ts} +2 -2
- package/esm/ui.d.ts +2 -2
- package/esm/ui.js +3 -3
- package/esm/vue.d.ts +5 -5
- package/esm/vue.js +4 -4
- package/package.json +1 -1
package/esm/testing.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { C as invalidConfig, S as invalidArgument, T as API_ERROR_DEFINITIONS, l as CalmLensError, w as API_ERROR_CODES, x as SDK_ERROR_CODES } from "./CalmLensError-C15tWu8W.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as WEBHOOK_TIMESTAMP_HEADER, f as signUploadTokenWithApiKey, m as stringifyJsonCanonical, n as WEBHOOK_DELIVERY_HEADER, p as decodeUploadToken, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
4
|
-
import { _ as validateAssetPayload, g as assetToData, h as assetDataToUint8Array, n as MOCK_HOOKS } from "./CalmLensConnection-
|
|
2
|
+
import { F as sleep, M as getRejectedUploadMimeTypeError, N as normalizeUploadMimeType, O as MAX_IMAGE_UPLOAD_BYTES, S as validateAppClientOptions, _ as randomUuid, f as checkTransformOptions, h as parseTransformSelector, m as isAcceptedUploadMimeType, t as ASSET_RESOURCE_PATHS, w as validateServerClientOptions } from "./CalmLensCdn--hZgorld.js";
|
|
3
|
+
import { a as WEBHOOK_TIMESTAMP_HEADER, f as signUploadTokenWithApiKey, m as stringifyJsonCanonical, n as WEBHOOK_DELIVERY_HEADER, p as decodeUploadToken, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient } from "./CalmLensServerClient-BBPwU8mm.js";
|
|
4
|
+
import { _ as validateAssetPayload, g as assetToData, h as assetDataToUint8Array, n as MOCK_HOOKS } from "./CalmLensConnection-dz5Kl3uC.js";
|
|
5
5
|
import { t as hmacSha256Hex } from "./CryptoUtils-BLCa-oZe-DKr3LmN6.js";
|
|
6
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
7
|
-
import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-
|
|
6
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-C0Ud7eYa.js";
|
|
7
|
+
import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-D3um1cq9.js";
|
|
8
8
|
import { f as getTestInputTag, g as CLASSIFICATION_CATEGORIES, h as lazySchema, t as withValidTestInputArguments } from "./CalmLensTestInputArguments-CqPADTkl.js";
|
|
9
9
|
import * as zod from "zod";
|
|
10
10
|
// src/contract/MediaTestTriggers.js
|
|
@@ -8700,20 +8700,6 @@ const MOCK_ASSET_FILTER_FIELDS = {
|
|
|
8700
8700
|
"=out="
|
|
8701
8701
|
]
|
|
8702
8702
|
},
|
|
8703
|
-
description: {
|
|
8704
|
-
kind: "text",
|
|
8705
|
-
nullable: true,
|
|
8706
|
-
operators: [
|
|
8707
|
-
"==",
|
|
8708
|
-
"!=",
|
|
8709
|
-
">",
|
|
8710
|
-
">=",
|
|
8711
|
-
"<",
|
|
8712
|
-
"<=",
|
|
8713
|
-
"=in=",
|
|
8714
|
-
"=out="
|
|
8715
|
-
]
|
|
8716
|
-
},
|
|
8717
8703
|
externalId: {
|
|
8718
8704
|
kind: "text",
|
|
8719
8705
|
nullable: true,
|
|
@@ -9232,17 +9218,20 @@ const filterAssets = (items, filter) => {
|
|
|
9232
9218
|
return items.filter((item) => matchesNode(item, node));
|
|
9233
9219
|
};
|
|
9234
9220
|
const MAX_SEARCH_TOKENS = 8;
|
|
9235
|
-
/**
|
|
9236
|
-
|
|
9221
|
+
/**
|
|
9222
|
+
* The keyword fields the API searches, in the order it reports matches. `extractedText` is the
|
|
9223
|
+
* asset's retained text: empty unless its content is stored.
|
|
9224
|
+
*/
|
|
9225
|
+
const searchFieldValues = (asset, extractedText) => [
|
|
9237
9226
|
["name", asset.name],
|
|
9238
9227
|
["id", asset.id],
|
|
9239
9228
|
["externalId", asset.externalId ?? ""],
|
|
9240
|
-
["description", asset.description ?? ""],
|
|
9241
9229
|
["tags", asset.tags?.join(" ") ?? ""],
|
|
9242
9230
|
["type", asset.type],
|
|
9243
9231
|
["content.format", asset.content?.format ?? ""],
|
|
9244
9232
|
["content.extension", asset.content?.extension ?? ""],
|
|
9245
|
-
["classification.moderation.decision", asset.classification.moderation.decision ?? "pending"]
|
|
9233
|
+
["classification.moderation.decision", asset.classification.moderation.decision ?? "pending"],
|
|
9234
|
+
["content.extractedText", extractedText]
|
|
9246
9235
|
];
|
|
9247
9236
|
/** The API's keyword score for the whole lowercased query. */
|
|
9248
9237
|
const keywordScore = (values, query) => {
|
|
@@ -9261,15 +9250,15 @@ const keywordScore = (values, query) => {
|
|
|
9261
9250
|
};
|
|
9262
9251
|
/**
|
|
9263
9252
|
* Keyword search as the API runs it: every whitespace-separated token (case-insensitive, at
|
|
9264
|
-
* most 8) must appear in some searchable field
|
|
9265
|
-
* newest first.
|
|
9253
|
+
* most 8) must appear in some searchable field, including the asset's retained text, which
|
|
9254
|
+
* `extractedTexts` maps by asset ID. Results are ranked by the API's score, then newest first.
|
|
9266
9255
|
*/
|
|
9267
|
-
const searchAssets = (assets, query, limit) => {
|
|
9256
|
+
const searchAssets = (assets, extractedTexts, query, limit) => {
|
|
9268
9257
|
const normalized = query.trim().toLowerCase();
|
|
9269
9258
|
const tokens = [...new Set(normalized.split(/\s+/).filter(Boolean))].slice(0, MAX_SEARCH_TOKENS);
|
|
9270
9259
|
if (tokens.length === 0) return [];
|
|
9271
9260
|
return assets.map((asset) => {
|
|
9272
|
-
const fields = searchFieldValues(asset).map(([field, value]) => [field, value.toLowerCase()]);
|
|
9261
|
+
const fields = searchFieldValues(asset, extractedTexts.get(asset.id) ?? "").map(([field, value]) => [field, value.toLowerCase()]);
|
|
9273
9262
|
return {
|
|
9274
9263
|
asset,
|
|
9275
9264
|
matches: tokens.every((token) => fields.some(([, value]) => value.includes(token))),
|
|
@@ -9379,8 +9368,12 @@ const checkMockUploadPreset = (preset) => {
|
|
|
9379
9368
|
if (unknown.length) throw invalidArgument(`Unknown mockOptions.preset key${unknown.length > 1 ? "s" : ""}: ${unknown.join(", ")}`, { options: unknown });
|
|
9380
9369
|
};
|
|
9381
9370
|
const MAX_PAGE_SIZE = 100;
|
|
9382
|
-
/**
|
|
9371
|
+
/** Hashes with a lower PDQ quality never match (HashList.ts, HASH_MATCH_MIN_QUALITY). */
|
|
9383
9372
|
const HASH_MATCH_MIN_QUALITY = 50;
|
|
9373
|
+
/** Hashes this many bits apart or fewer match (HashList.ts, HASH_MATCH_MAX_DISTANCE). */
|
|
9374
|
+
const HASH_MATCH_MAX_DISTANCE = 31;
|
|
9375
|
+
/** A block list blocks only matches this close; looser ones are flagged (HASH_BLOCK_MAX_DISTANCE). */
|
|
9376
|
+
const HASH_BLOCK_MAX_DISTANCE = 16;
|
|
9384
9377
|
/** The most hash matches an asset records (HashList.ts). */
|
|
9385
9378
|
const MAX_RECORDED_HASH_MATCHES = 10;
|
|
9386
9379
|
const MAX_DECISION_NOTE_LENGTH = 1499;
|
|
@@ -9625,7 +9618,6 @@ const invalidField = (code, path) => new ApiFailure(400, API_ERROR_CODES.INVALID
|
|
|
9625
9618
|
/** The asset fields an upload carries in its body; the API refuses them in the query string. */
|
|
9626
9619
|
const UPLOAD_OPTION_KEYS = [
|
|
9627
9620
|
"name",
|
|
9628
|
-
"description",
|
|
9629
9621
|
"processingOptions",
|
|
9630
9622
|
"visibility",
|
|
9631
9623
|
"metadata",
|
|
@@ -9864,6 +9856,7 @@ var MockCalmLensApi = class {
|
|
|
9864
9856
|
this.idempotentResults = /* @__PURE__ */ new Map();
|
|
9865
9857
|
this.pendingFailures = [];
|
|
9866
9858
|
this.servedUrls = /* @__PURE__ */ new Map();
|
|
9859
|
+
this.perceptualHashes = [];
|
|
9867
9860
|
this.pendingReviews = /* @__PURE__ */ new Map();
|
|
9868
9861
|
this.requestCount = 0;
|
|
9869
9862
|
this.useTimers = false;
|
|
@@ -9928,6 +9921,24 @@ var MockCalmLensApi = class {
|
|
|
9928
9921
|
type: type.trim()
|
|
9929
9922
|
});
|
|
9930
9923
|
}
|
|
9924
|
+
/**
|
|
9925
|
+
* Makes an image upload of exactly `content` hash as `hash` (64 hexadecimal characters, a PDQ
|
|
9926
|
+
* hash) with `quality`, instead of the SHA-256 of its bytes.
|
|
9927
|
+
*/
|
|
9928
|
+
setPerceptualHash(content, hash, quality = 100) {
|
|
9929
|
+
const bytes = typeof content === "string" ? new TextEncoder().encode(content) : content instanceof ArrayBuffer ? new Uint8Array(content.slice(0)) : content instanceof Uint8Array ? new Uint8Array(content) : void 0;
|
|
9930
|
+
if (!bytes) throw invalidArgument("content must be bytes or a string");
|
|
9931
|
+
if (typeof hash !== "string" || !/^[0-9a-f]{64}$/i.test(hash.trim())) throw invalidArgument("hash must be a PDQ hash of 64 hexadecimal characters");
|
|
9932
|
+
if (typeof quality !== "number" || !Number.isInteger(quality) || quality < 0 || quality > 100) throw invalidArgument("quality must be a whole number from 0 to 100");
|
|
9933
|
+
const declared = {
|
|
9934
|
+
bytes,
|
|
9935
|
+
hash: hash.trim().toLowerCase(),
|
|
9936
|
+
quality
|
|
9937
|
+
};
|
|
9938
|
+
const index = this.perceptualHashes.findIndex((known) => sameBytes(known.bytes, bytes));
|
|
9939
|
+
if (index === -1) this.perceptualHashes.push(declared);
|
|
9940
|
+
else this.perceptualHashes[index] = declared;
|
|
9941
|
+
}
|
|
9931
9942
|
/** A `fetch` that answers a client's requests from memory; app clients pass their session. */
|
|
9932
9943
|
createFetch(endpoints, session) {
|
|
9933
9944
|
return ((input, init) => this.handle(input, init, endpoints(), session));
|
|
@@ -10025,7 +10036,11 @@ var MockCalmLensApi = class {
|
|
|
10025
10036
|
if (asset.upload.status === "uploading" || asset.classification.status === "processing") throw fail(API_ERROR_CODES.ASSET_PROCESSING);
|
|
10026
10037
|
const status = asset.classification.moderation.decision;
|
|
10027
10038
|
if (decision !== "purged" && decision !== "blocked" && status === null) throw fail(API_ERROR_CODES.ASSET_DECISION_NOT_ALLOWED);
|
|
10028
|
-
if (status === decision)
|
|
10039
|
+
if (status === decision) {
|
|
10040
|
+
if (!asset.classification.moderation.pendingReview) throw fail(API_ERROR_CODES.ASSET_DECISION_UNCHANGED);
|
|
10041
|
+
asset.classification.moderation.pendingReview = null;
|
|
10042
|
+
return this.databaseStorage.updateAsset(asset);
|
|
10043
|
+
}
|
|
10029
10044
|
if (decision !== "purged" && decision !== "blocked" && status === "purged") throw fail(API_ERROR_CODES.ASSET_CONTENT_PURGED);
|
|
10030
10045
|
return this.recordDecision(asset, decision, { note });
|
|
10031
10046
|
}
|
|
@@ -10037,7 +10052,7 @@ var MockCalmLensApi = class {
|
|
|
10037
10052
|
async recordDecision(asset, decision, review) {
|
|
10038
10053
|
const decided = await this.applyOutcome(asset, decision, "requested");
|
|
10039
10054
|
const now = this.now();
|
|
10040
|
-
|
|
10055
|
+
decided.classification.moderation.pendingReview = null;
|
|
10041
10056
|
decided.classification.moderation.manualReviews = [...decided.classification.moderation.manualReviews ?? [], {
|
|
10042
10057
|
id: this.createId("rev"),
|
|
10043
10058
|
decision,
|
|
@@ -10729,8 +10744,9 @@ var MockCalmLensApi = class {
|
|
|
10729
10744
|
}
|
|
10730
10745
|
/**
|
|
10731
10746
|
* Keyword search like the API's: every whitespace-separated token must appear,
|
|
10732
|
-
* case-insensitively, in the asset's name, ID, external ID,
|
|
10733
|
-
*
|
|
10747
|
+
* case-insensitively, in the asset's name, ID, external ID, tags, type, content format or
|
|
10748
|
+
* extension, moderation status, or retained text while its content is stored. There is no
|
|
10749
|
+
* semantic search.
|
|
10734
10750
|
*/
|
|
10735
10751
|
async searchAssets(params) {
|
|
10736
10752
|
const query = (params.get("query") ?? "").trim();
|
|
@@ -10739,9 +10755,11 @@ var MockCalmLensApi = class {
|
|
|
10739
10755
|
const pageSize = this.integer(params, "pageSize", 10);
|
|
10740
10756
|
if (pageSize < 1) throw invalidField("validation/too-small", "pageSize");
|
|
10741
10757
|
if (pageSize > MAX_SEARCH_PAGE_SIZE) throw invalidField("validation/too-big", "pageSize");
|
|
10758
|
+
const assets = await this.databaseStorage.listAssets(this.projectId);
|
|
10759
|
+
const extractedTexts = new Map(await Promise.all(assets.map(async (asset) => [asset.id, await this.searchText(asset)])));
|
|
10742
10760
|
return {
|
|
10743
10761
|
query,
|
|
10744
|
-
items: searchAssets(
|
|
10762
|
+
items: searchAssets(assets, extractedTexts, query, pageSize),
|
|
10745
10763
|
semanticStatus: "disabled"
|
|
10746
10764
|
};
|
|
10747
10765
|
}
|
|
@@ -11084,7 +11102,6 @@ var MockCalmLensApi = class {
|
|
|
11084
11102
|
createdAt: now,
|
|
11085
11103
|
updatedAt: now,
|
|
11086
11104
|
name: fields.name,
|
|
11087
|
-
description: fields.description ?? null,
|
|
11088
11105
|
externalId: fields.externalId ?? null,
|
|
11089
11106
|
externalUrl: fields.url ?? fields.externalUrl ?? null,
|
|
11090
11107
|
type,
|
|
@@ -11266,6 +11283,9 @@ var MockCalmLensApi = class {
|
|
|
11266
11283
|
* a text asset's own text or the text found in it. Only the references CalmLens uses are kept.
|
|
11267
11284
|
*/
|
|
11268
11285
|
async selectContext(items) {
|
|
11286
|
+
items.forEach((item, index) => {
|
|
11287
|
+
if (!isId(item.assetId, "asset")) throw invalidField("validation/invalid-format", `context.items.${index}.assetId`);
|
|
11288
|
+
});
|
|
11269
11289
|
const posts = await Promise.all(items.map(async (item) => {
|
|
11270
11290
|
const asset = await this.databaseStorage.getAsset(item.assetId);
|
|
11271
11291
|
if (!asset || asset.projectId !== this.projectId) throw fail(API_ERROR_CODES.CONTEXT_ASSET_NOT_FOUND, { details: { assetId: item.assetId } });
|
|
@@ -11278,10 +11298,19 @@ var MockCalmLensApi = class {
|
|
|
11278
11298
|
}
|
|
11279
11299
|
/** An earlier post's text, to the most CalmLens reads of one post; empty once its content is gone. */
|
|
11280
11300
|
async contextText(asset) {
|
|
11301
|
+
const text = (await this.retainedText(asset)).trim();
|
|
11302
|
+
return Array.from(text).slice(0, MODERATION_CONTEXT_MAX_ITEM_CHARACTERS).join("");
|
|
11303
|
+
}
|
|
11304
|
+
/** The text keyword search reads, like the API: the retained text, only while content is stored. */
|
|
11305
|
+
async searchText(asset) {
|
|
11306
|
+
return asset.content.status === "stored" ? this.retainedText(asset) : "";
|
|
11307
|
+
}
|
|
11308
|
+
/** A text upload's stored bytes, or the text extracted from its content (such as OCR). */
|
|
11309
|
+
async retainedText(asset) {
|
|
11281
11310
|
const extracted = asset.content.extractedText;
|
|
11282
11311
|
const bytes = asset.type === "plaintext-document" && await this.storedBytes(asset);
|
|
11283
|
-
|
|
11284
|
-
return
|
|
11312
|
+
if (bytes) return new TextDecoder().decode(bytes);
|
|
11313
|
+
return extracted?.type === "string" ? extracted.content : "";
|
|
11285
11314
|
}
|
|
11286
11315
|
async storedBytes(asset) {
|
|
11287
11316
|
if (asset.content.status === "removed") return null;
|
|
@@ -11292,28 +11321,40 @@ var MockCalmLensApi = class {
|
|
|
11292
11321
|
}
|
|
11293
11322
|
/**
|
|
11294
11323
|
* A decided image with its hash and the project's hash list matches, as the API records them
|
|
11295
|
-
* (AssetClassification.ts,
|
|
11324
|
+
* (AssetClassification.ts, HashMatching.ts and HashList.ts). The mock computes no PDQ hash: an
|
|
11296
11325
|
* image's `content.perceptualHash` is the SHA-256 of its bytes in lowercase hex, with quality
|
|
11297
|
-
* 100,
|
|
11298
|
-
*
|
|
11299
|
-
*
|
|
11300
|
-
*
|
|
11326
|
+
* 100, unless `setPerceptualHash` declared one for those bytes. An entry matches a hash up to 31
|
|
11327
|
+
* bits away, so different images' SHA-256 stand-ins never match, and an entry taken from an
|
|
11328
|
+
* image matches the same bytes at distance 0. Hashes below quality 50 never match. A match takes
|
|
11329
|
+
* its list's action, except that a block list only flags matches more than 16 bits away;
|
|
11330
|
+
* blocking matches come first, then the closest. A block raises an allowed, limited or
|
|
11331
|
+
* age-restricted decision to `blocked`, with `source: "hash-list"`, and a flag only records the
|
|
11332
|
+
* match.
|
|
11301
11333
|
*/
|
|
11302
11334
|
async withHashMatches(asset, bytes) {
|
|
11303
|
-
const hash
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11335
|
+
const { hash, quality } = this.perceptualHashes.find((known) => sameBytes(known.bytes, bytes)) ?? {
|
|
11336
|
+
hash: await sha256Hex(bytes),
|
|
11337
|
+
quality: 100
|
|
11338
|
+
};
|
|
11339
|
+
const matches = [...this.hashListEntries.values()].flatMap((entry) => {
|
|
11340
|
+
const list = this.hashLists.get(entry.hashListId);
|
|
11341
|
+
const distance = hashDistance(hash, entry.hash);
|
|
11342
|
+
if (!list || quality < HASH_MATCH_MIN_QUALITY || entry.quality !== null && entry.quality < HASH_MATCH_MIN_QUALITY || distance > HASH_MATCH_MAX_DISTANCE) return [];
|
|
11343
|
+
const action = list.action === "block" && distance <= HASH_BLOCK_MAX_DISTANCE ? "block" : "flag";
|
|
11344
|
+
return [{
|
|
11345
|
+
source: "hash-list",
|
|
11346
|
+
hashListId: entry.hashListId,
|
|
11347
|
+
hashListEntryId: entry.id,
|
|
11348
|
+
distance,
|
|
11349
|
+
action
|
|
11350
|
+
}];
|
|
11351
|
+
}).sort((a, b) => Number(b.action === "block") - Number(a.action === "block") || a.distance - b.distance).slice(0, MAX_RECORDED_HASH_MATCHES);
|
|
11311
11352
|
const hashed = {
|
|
11312
11353
|
...asset,
|
|
11313
11354
|
content: {
|
|
11314
11355
|
...asset.content,
|
|
11315
11356
|
perceptualHash: hash,
|
|
11316
|
-
perceptualHashQuality:
|
|
11357
|
+
perceptualHashQuality: quality
|
|
11317
11358
|
}
|
|
11318
11359
|
};
|
|
11319
11360
|
if (!matches.length) return hashed;
|
|
@@ -12236,6 +12277,25 @@ var MockCalmLensApi = class {
|
|
|
12236
12277
|
});
|
|
12237
12278
|
}
|
|
12238
12279
|
};
|
|
12280
|
+
/** The SHA-256 of `bytes` in lowercase hex. */
|
|
12281
|
+
async function sha256Hex(bytes) {
|
|
12282
|
+
return [...new Uint8Array(await crypto.subtle.digest("SHA-256", bytes))].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
12283
|
+
}
|
|
12284
|
+
/** How many bits two 64-character hex hashes differ by. */
|
|
12285
|
+
function hashDistance(a, b) {
|
|
12286
|
+
let distance = 0;
|
|
12287
|
+
for (let i = 0; i < 64; i += 8) {
|
|
12288
|
+
let bits = (Number.parseInt(a.slice(i, i + 8), 16) ^ Number.parseInt(b.slice(i, i + 8), 16)) >>> 0;
|
|
12289
|
+
while (bits) {
|
|
12290
|
+
bits &= bits - 1;
|
|
12291
|
+
distance++;
|
|
12292
|
+
}
|
|
12293
|
+
}
|
|
12294
|
+
return distance;
|
|
12295
|
+
}
|
|
12296
|
+
function sameBytes(a, b) {
|
|
12297
|
+
return a.length === b.length && a.every((byte, i) => byte === b[i]);
|
|
12298
|
+
}
|
|
12239
12299
|
// src/testing/MockStorage.ts
|
|
12240
12300
|
var InMemoryMockImageStorage = class {
|
|
12241
12301
|
constructor() {
|
|
@@ -12421,7 +12481,7 @@ var MockCalmLensServerClient = class extends CalmLensServerClient {
|
|
|
12421
12481
|
}
|
|
12422
12482
|
/**
|
|
12423
12483
|
* Fetches a URL of the mock's CDN as a browser would, without the API key: a signed asset URL
|
|
12424
|
-
* from `cdn.signAssetUrl
|
|
12484
|
+
* from `cdn.signAssetUrl`, or a public one from `cdn.getAssetUrl`.
|
|
12425
12485
|
* The request is recorded like any other.
|
|
12426
12486
|
*/
|
|
12427
12487
|
fetchCdn(url, init) {
|
|
@@ -12467,6 +12527,16 @@ var MockCalmLensServerClient = class extends CalmLensServerClient {
|
|
|
12467
12527
|
this.#api.serveUrl(url, content);
|
|
12468
12528
|
}
|
|
12469
12529
|
/**
|
|
12530
|
+
* Makes the mock hash an image upload of exactly `content` (bytes, or text as UTF-8) as `hash`, a
|
|
12531
|
+
* PDQ hash of 64 hexadecimal characters, with `quality` (0 to 100, default 100), instead of the
|
|
12532
|
+
* SHA-256 of its bytes. Hash list entries match hashes up to 31 bits away, as in CalmLens, so a
|
|
12533
|
+
* test can make a resized or recompressed copy a near match of a listed image: declare the
|
|
12534
|
+
* copy's hash a few bits from the entry's.
|
|
12535
|
+
*/
|
|
12536
|
+
setPerceptualHash(content, hash, quality = 100) {
|
|
12537
|
+
this.#api.setPerceptualHash(content, hash, quality);
|
|
12538
|
+
}
|
|
12539
|
+
/**
|
|
12470
12540
|
* Changes the grants of the mock's API key, as editing the key in the portal would: later
|
|
12471
12541
|
* requests, such as `cdn.serve`, use them. The key itself stays the same, so idempotency keys
|
|
12472
12542
|
* it used still replay.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as appendAssetLocation } from "./CalmLensCdn
|
|
2
|
-
import "./Core-
|
|
1
|
+
import { a as assetUrlOf, r as appendAssetLocation } from "./CalmLensCdn--hZgorld.js";
|
|
2
|
+
import "./Core-Dti4LlA-.js";
|
|
3
3
|
// src/ui/viewers/PdfLoader.ts
|
|
4
4
|
let loading;
|
|
5
5
|
/**
|
|
@@ -81,11 +81,11 @@ const responseCode = async (response) => {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
/**
|
|
84
|
-
* The CDN URLs a viewer loads: resource paths beneath the asset URL
|
|
85
|
-
* with the viewer claims that say something. When a URL
|
|
86
|
-
* signed one does, it asks `onExpired` once for a fresh
|
|
87
|
-
* has worked (`loaded`), so a URL that keeps failing ends in the
|
|
88
|
-
* `onExpired` nothing is refreshed.
|
|
84
|
+
* The CDN URLs a viewer loads: resource paths beneath the asset URL of `src` (a public or signed
|
|
85
|
+
* asset URL, or a resource URL beneath one), with the viewer claims that say something. When a URL
|
|
86
|
+
* stops working (`refresh`), as an expired signed one does, it asks `onExpired` once for a fresh
|
|
87
|
+
* URL, and again only after that one has worked (`loaded`), so a URL that keeps failing ends in the
|
|
88
|
+
* viewer's fallback. Without `onExpired` nothing is refreshed.
|
|
89
89
|
*/
|
|
90
90
|
var ViewerUrls = class {
|
|
91
91
|
#options;
|
|
@@ -112,7 +112,7 @@ var ViewerUrls = class {
|
|
|
112
112
|
/** A resource's URL beneath the asset URL. The placeholder is never age-gated, so it needs no age claim. */
|
|
113
113
|
url(resource, transform) {
|
|
114
114
|
const { viewerClaims } = this.#options;
|
|
115
|
-
return appendAssetLocation(this.#src, {
|
|
115
|
+
return appendAssetLocation(assetUrlOf(this.#src), {
|
|
116
116
|
resource,
|
|
117
117
|
transform,
|
|
118
118
|
viewerClaims: resource === "placeholder" && viewerClaims ? { region: viewerClaims.region } : viewerClaims
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./CalmLensTypes-
|
|
2
|
-
import { K as AssetOptions, Z as AssetView, ct as DocumentViewerOptions, dt as TextViewerOptions, lt as PdfAssetOptions, pt as ViewerOptions, q as AssetSession, ut as SpreadsheetViewerOptions } from "./Core-
|
|
1
|
+
import "./CalmLensTypes-DjuOXp3b.js";
|
|
2
|
+
import { K as AssetOptions, Z as AssetView, ct as DocumentViewerOptions, dt as TextViewerOptions, lt as PdfAssetOptions, pt as ViewerOptions, q as AssetSession, ut as SpreadsheetViewerOptions } from "./Core-DaCkaDkb.js";
|
|
3
3
|
import "pdfjs-dist";
|
|
4
4
|
/** A viewer mounted into an element, which it owns the children of. */
|
|
5
5
|
interface AssetViewer<O extends ViewerOptions = ViewerOptions> {
|
package/esm/ui.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, I as UploadItem, J as AssetSessionState, K as AssetOptions, L as UploadSnapshot, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, h as UploaderProps, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, k as CalmLensUpload, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage, z as createUploadController } from "./Core-
|
|
2
|
-
import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-
|
|
1
|
+
import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, I as UploadItem, J as AssetSessionState, K as AssetOptions, L as UploadSnapshot, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, h as UploaderProps, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, k as CalmLensUpload, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage, z as createUploadController } from "./Core-DaCkaDkb.js";
|
|
2
|
+
import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-C_AhYdIA.js";
|
|
3
3
|
export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, type AssetDisplay, type AssetDisplayOptions, type AssetDocumentOptions, type AssetEventHandlers, type AssetImageOptions, type AssetImageSource, type AssetOptions, type AssetProps, AssetSession, type AssetSessionState, type AssetSpreadsheetOptions, type AssetVideoOptions, type AssetView, type AssetViewer, type AssetViewerKind, AssetViewerMount, AssetViewerName, AssetViewerOptionsByKind, CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensProvidedOptions, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, type DocumentViewerOptions, ICONS, ICON_ATTRIBUTES, INSTANT_LOAD_MS, type IconName, type MediaPlayback, MediaStreamPlayer, type MountedViewerKind, type PdfAssetOptions, type ProgressFetchOptions, type SpreadsheetCell, type SpreadsheetRow, type SpreadsheetSheet, type SpreadsheetViewerOptions, type TextViewerOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, VIEWER_STYLES, type ViewerAsset, type ViewerMessages, type ViewerOptions, type ViewerState, type ViewerTextOptions, createDocumentViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isImageReady, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, withProvidedOptions };
|
package/esm/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-
|
|
2
|
-
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-
|
|
3
|
-
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-
|
|
1
|
+
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-B7Z6FH5F.js";
|
|
2
|
+
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-Dti4LlA-.js";
|
|
3
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-D3um1cq9.js";
|
|
4
4
|
export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, ICONS, ICON_ATTRIBUTES, INSTANT_LOAD_MS, MediaStreamPlayer, UploadController, VIEWER_STYLES, createDocumentViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isImageReady, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, withProvidedOptions };
|
package/esm/vue.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { O as CalmLensAppClientOptions, g as AssetModerationStatus, i as AssetAvailability, nn as ViewerClaims } from "./CalmLensTypes-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } from "./Core-
|
|
4
|
-
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-
|
|
5
|
-
import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-
|
|
1
|
+
import { O as CalmLensAppClientOptions, g as AssetModerationStatus, i as AssetAvailability, nn as ViewerClaims } from "./CalmLensTypes-DjuOXp3b.js";
|
|
2
|
+
import "./index-xF6Neq8A.js";
|
|
3
|
+
import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } from "./Core-DaCkaDkb.js";
|
|
4
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-Dx2l9wC0.js";
|
|
5
|
+
import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-C_AhYdIA.js";
|
|
6
6
|
import { App, MaybeRefOrGetter, PropType, ShallowRef } from "vue";
|
|
7
7
|
/** Shows a text asset's text, escaped, in a scrolling region. */
|
|
8
8
|
export declare const CalmLensTextViewer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
package/esm/vue.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-
|
|
2
|
-
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-
|
|
3
|
-
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-
|
|
1
|
+
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-B7Z6FH5F.js";
|
|
2
|
+
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-Dti4LlA-.js";
|
|
3
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-D3um1cq9.js";
|
|
4
4
|
import { c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
|
|
5
|
-
import { t as createUploadController } from "./BrowserUpload-
|
|
5
|
+
import { t as createUploadController } from "./BrowserUpload-Dizcs8rx.js";
|
|
6
6
|
import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, onScopeDispose, provide, ref, shallowRef, toValue, watch, watchEffect } from "vue";
|
|
7
7
|
// src/viewers/Vue.ts
|
|
8
8
|
const optional$1 = (type) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "calmlens",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Official CalmLens SDK for JavaScript and TypeScript: content moderation, asset storage and CDN delivery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://calmlens.com/docs/sdk/javascript",
|