calmlens 0.25.0 → 0.27.1

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.
Files changed (95) hide show
  1. package/README.md +15 -15
  2. package/bin/calmlens.js +2383 -677
  3. package/cjs/{BrowserUpload-AO2-2U5Z.js → BrowserUpload-CTqIjCV5.js} +1 -1
  4. package/{esm/BrowserUpload-D2lemMIU.d.ts → cjs/BrowserUpload-D4sEmd0X.d.ts} +2 -2
  5. package/{esm/CalmLensAppClient-Dt0t9Bk6.d.ts → cjs/CalmLensAppClient-CCeFnKX8.d.ts} +5 -11
  6. package/cjs/{CalmLensAppClient-nv6qwja0.js → CalmLensAppClient-CZm-9g22.js} +23 -16
  7. package/cjs/{CalmLensOptionKeys-BvCac9NO.js → CalmLensOptionKeys-C1w3SqmL.js} +165 -95
  8. package/cjs/CalmLensServerClient-B7PfocET.d.ts +346 -0
  9. package/cjs/{CalmLensServerClient-B60kCBCR.js → CalmLensServerClient-ucq3ITjd.js} +281 -315
  10. package/cjs/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-HUERg5hI.d.ts} +142 -155
  11. package/cjs/{Classification-CxRedzgH-C9qlYW_J.d.ts → Classification-CMM2tZpJ-IdIh63n0.d.ts} +6 -7
  12. package/cjs/{Core-Cw4IxFUq.js → Core-D-1KCqT7.js} +39 -16
  13. package/cjs/{Core-DSMxC2GL.d.ts → Core-DXAs8mcx.d.ts} +10 -3
  14. package/{esm/ModerationContextLimits-Bqr0duav.js → cjs/ModerationContextLimits-BcYKgU2X.js} +859 -44
  15. package/cjs/ReactUpload-BTciTpwB.d.ts +27 -0
  16. package/cjs/{ReactUpload--oDFltw2.js → ReactUpload-BymgWiC8.js} +38 -2
  17. package/cjs/{TestTriggers-CiFcTHX3-BmfH4J3f.js → TestTriggers-Cvi7e2KA-DcT1pc_W.js} +91 -22
  18. package/{esm/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts → cjs/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts} +1 -1
  19. package/cjs/{UploadController-ObdgTaBl.js → UploadController-C8GPbDKI.js} +16 -3
  20. package/{esm/WebhookPayload-DLGGOGW6.d.ts → cjs/WebhookPayload-mUmOFH55.d.ts} +152 -9
  21. package/cjs/app.d.ts +6 -6
  22. package/cjs/app.js +20 -2
  23. package/cjs/elements.d.ts +5 -5
  24. package/cjs/elements.js +105 -68
  25. package/cjs/{index-AAWuerkU.d.ts → index-Ck7x1YjM.d.ts} +3 -3
  26. package/cjs/index.d.ts +5 -5
  27. package/cjs/index.js +19 -1
  28. package/cjs/react-native.d.ts +3 -3
  29. package/cjs/react-native.js +7 -5
  30. package/cjs/react.d.ts +5 -4
  31. package/cjs/react.js +11 -15
  32. package/cjs/server.d.ts +6 -6
  33. package/cjs/server.js +20 -2
  34. package/cjs/test-inputs.d.ts +1 -1
  35. package/cjs/test-inputs.js +13 -13
  36. package/cjs/testing.d.ts +18 -21
  37. package/cjs/testing.js +99 -147
  38. package/cjs/{ui-CcuGKTcL.d.ts → ui-BfJNO3c6.d.ts} +2 -2
  39. package/cjs/{ui-CA16jyfZ.js → ui-CW8BqtZk.js} +7 -5
  40. package/cjs/ui.d.ts +3 -3
  41. package/cjs/ui.js +4 -3
  42. package/cjs/vue.d.ts +15 -8
  43. package/cjs/vue.js +30 -17
  44. package/esm/{BrowserUpload-Co4T6uGk.js → BrowserUpload-C01iLeOs.js} +1 -1
  45. package/{cjs/BrowserUpload-D2lemMIU.d.ts → esm/BrowserUpload-D4sEmd0X.d.ts} +2 -2
  46. package/{cjs/CalmLensAppClient-Dt0t9Bk6.d.ts → esm/CalmLensAppClient-CCeFnKX8.d.ts} +5 -11
  47. package/esm/{CalmLensAppClient-BRzy4dwn.js → CalmLensAppClient-CgDogQQC.js} +23 -16
  48. package/esm/{CalmLensOptionKeys-bE3rb5PN.js → CalmLensOptionKeys-CEwNbpEz.js} +160 -96
  49. package/esm/CalmLensServerClient-B7PfocET.d.ts +346 -0
  50. package/esm/{CalmLensServerClient-_PRi90wI.js → CalmLensServerClient-TT6zrAG5.js} +281 -315
  51. package/esm/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-HUERg5hI.d.ts} +142 -155
  52. package/esm/{Classification-CxRedzgH-C9qlYW_J.d.ts → Classification-CMM2tZpJ-IdIh63n0.d.ts} +6 -7
  53. package/esm/{Core-CtbYmeXG.js → Core-CP6NaqJz.js} +39 -16
  54. package/esm/{Core-DSMxC2GL.d.ts → Core-DXAs8mcx.d.ts} +10 -3
  55. package/{cjs/ModerationContextLimits-Cn9RvnZH.js → esm/ModerationContextLimits-BmV8QD32.js} +476 -301
  56. package/esm/{ReactUpload-B5itHBSF.js → ReactUpload-B72Oq3qE.js} +34 -4
  57. package/esm/ReactUpload-BTciTpwB.d.ts +27 -0
  58. package/esm/{TestTriggers-CiFcTHX3-BK2-sgOC.js → TestTriggers-Cvi7e2KA-BA83CRJb.js} +87 -23
  59. package/{cjs/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts → esm/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts} +1 -1
  60. package/esm/{UploadController-C7fL3Iz9.js → UploadController-Q7xTqh5w.js} +11 -4
  61. package/{cjs/WebhookPayload-DLGGOGW6.d.ts → esm/WebhookPayload-mUmOFH55.d.ts} +152 -9
  62. package/esm/app.d.ts +6 -6
  63. package/esm/app.js +3 -3
  64. package/esm/elements.d.ts +5 -5
  65. package/esm/elements.js +105 -69
  66. package/esm/{index-AAWuerkU.d.ts → index-Ck7x1YjM.d.ts} +3 -3
  67. package/esm/index.d.ts +5 -5
  68. package/esm/index.js +1 -1
  69. package/esm/react-native.d.ts +3 -3
  70. package/esm/react-native.js +6 -6
  71. package/esm/react.d.ts +5 -4
  72. package/esm/react.js +10 -16
  73. package/esm/server.d.ts +6 -6
  74. package/esm/server.js +3 -3
  75. package/esm/styles.css +37 -14
  76. package/esm/svelte/CalmLensAsset.svelte +1 -1
  77. package/esm/svelte/CalmLensUploader.svelte +17 -17
  78. package/esm/svelte/context.js +21 -0
  79. package/esm/svelte/index.d.ts +12 -0
  80. package/esm/svelte/index.js +1 -0
  81. package/esm/test-inputs.d.ts +1 -1
  82. package/esm/test-inputs.js +1 -1
  83. package/esm/testing.d.ts +18 -21
  84. package/esm/testing.js +93 -141
  85. package/esm/{ui-B98AucZA.js → ui-BBDJJkFL.js} +7 -5
  86. package/esm/{ui-CcuGKTcL.d.ts → ui-BfJNO3c6.d.ts} +2 -2
  87. package/esm/ui.d.ts +3 -3
  88. package/esm/ui.js +4 -4
  89. package/esm/vue.d.ts +15 -8
  90. package/esm/vue.js +30 -19
  91. package/package.json +16 -6
  92. package/cjs/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
  93. package/cjs/ReactUpload-CW4NzAsh.d.ts +0 -17
  94. package/esm/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
  95. package/esm/ReactUpload-CW4NzAsh.d.ts +0 -17
package/cjs/testing.js CHANGED
@@ -1,15 +1,15 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_TestTriggers_CiFcTHX3 = require("./TestTriggers-CiFcTHX3-BmfH4J3f.js");
3
- const require_ModerationContextLimits = require("./ModerationContextLimits-Cn9RvnZH.js");
4
- const require_CalmLensServerClient = require("./CalmLensServerClient-B60kCBCR.js");
5
- const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-BvCac9NO.js");
2
+ const require_TestTriggers_Cvi7e2KA = require("./TestTriggers-Cvi7e2KA-DcT1pc_W.js");
3
+ const require_ModerationContextLimits = require("./ModerationContextLimits-BcYKgU2X.js");
4
+ const require_CalmLensServerClient = require("./CalmLensServerClient-ucq3ITjd.js");
5
+ const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-C1w3SqmL.js");
6
6
  const require_CryptoUtils_B_x8lMIx = require("./CryptoUtils-B_x8lMIx-YBW1-bvL.js");
7
- const require_CalmLensAppClient = require("./CalmLensAppClient-nv6qwja0.js");
8
- const require_UploadController = require("./UploadController-ObdgTaBl.js");
7
+ const require_CalmLensAppClient = require("./CalmLensAppClient-CZm-9g22.js");
8
+ const require_UploadController = require("./UploadController-C8GPbDKI.js");
9
9
  let zod = require("zod");
10
- zod = require_TestTriggers_CiFcTHX3.__toESM(zod, 1);
10
+ zod = require_TestTriggers_Cvi7e2KA.__toESM(zod, 1);
11
11
  // src/contract/MediaTestTriggers.js
12
- const MEDIA_TEST_SIGNALS = [...require_TestTriggers_CiFcTHX3.CLASSIFICATION_CATEGORIES, "violence.graphic"];
12
+ const MEDIA_TEST_SIGNALS = [...require_TestTriggers_Cvi7e2KA.CLASSIFICATION_CATEGORIES, "violence.graphic"];
13
13
  const HEX_WORDS = [
14
14
  "zero",
15
15
  "one",
@@ -31,9 +31,9 @@ const HEX_WORDS = [
31
31
  /** Read this aloud, or render it as large, high-contrast text in a video frame. */
32
32
  async function generateMediaTestCode(signal, testInputKey) {
33
33
  if (!MEDIA_TEST_SIGNALS.includes(signal)) throw new RangeError("Unsupported media test signal");
34
- return `Calm Lens test ${[...await require_TestTriggers_CiFcTHX3.getTestInputTag("media", signal, testInputKey)].map((character) => HEX_WORDS[Number.parseInt(character, 16)]).join(" ")} ${signal.replace(/[.-]/g, " ")} end test`;
34
+ return `Calm Lens test ${[...await require_TestTriggers_Cvi7e2KA.getTestInputTag("media", signal, testInputKey)].map((character) => HEX_WORDS[Number.parseInt(character, 16)]).join(" ")} ${signal.replace(/[.-]/g, " ")} end test`;
35
35
  }
36
- // src/contract/Ids-BESMSxGb.js
36
+ // src/contract/Ids-C2cLdFM0.js
37
37
  var __defProp = Object.defineProperty;
38
38
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
39
39
  var __exportAll = (all, no_symbols) => {
@@ -4268,7 +4268,7 @@ function registry() {
4268
4268
  return new $ZodRegistry();
4269
4269
  }
4270
4270
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
4271
- const globalRegistry = globalThis.__zod_globalRegistry;
4271
+ const globalRegistry$1 = globalThis.__zod_globalRegistry;
4272
4272
  function snapshotChecks(def) {
4273
4273
  if (def.checks) def.checks = [...def.checks];
4274
4274
  return def;
@@ -5006,8 +5006,8 @@ function _check(fn, params) {
5006
5006
  function describe$1(description) {
5007
5007
  const ch = new $ZodCheck({ check: "describe" });
5008
5008
  ch._zod.onattach = [(inst) => {
5009
- const existing = globalRegistry.get(inst) ?? {};
5010
- globalRegistry.add(inst, {
5009
+ const existing = globalRegistry$1.get(inst) ?? {};
5010
+ globalRegistry$1.add(inst, {
5011
5011
  ...existing,
5012
5012
  description
5013
5013
  });
@@ -5019,8 +5019,8 @@ function describe$1(description) {
5019
5019
  function meta$1(metadata) {
5020
5020
  const ch = new $ZodCheck({ check: "meta" });
5021
5021
  ch._zod.onattach = [(inst) => {
5022
- const existing = globalRegistry.get(inst) ?? {};
5023
- globalRegistry.add(inst, {
5022
+ const existing = globalRegistry$1.get(inst) ?? {};
5023
+ globalRegistry$1.add(inst, {
5024
5024
  ...existing,
5025
5025
  ...metadata
5026
5026
  });
@@ -5116,7 +5116,7 @@ function initializeContext(params) {
5116
5116
  if (target === "draft-7") target = "draft-07";
5117
5117
  return {
5118
5118
  processors: params.processors ?? {},
5119
- metadataRegistry: params?.metadata ?? globalRegistry,
5119
+ metadataRegistry: params?.metadata ?? globalRegistry$1,
5120
5120
  target,
5121
5121
  unrepresentable: params?.unrepresentable ?? "throw",
5122
5122
  override: params?.override ?? (() => {}),
@@ -6472,13 +6472,13 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
6472
6472
  },
6473
6473
  describe(description) {
6474
6474
  const cl = this.clone();
6475
- globalRegistry.add(cl, { description });
6475
+ globalRegistry$1.add(cl, { description });
6476
6476
  return cl;
6477
6477
  },
6478
6478
  meta(...args) {
6479
- if (args.length === 0) return globalRegistry.get(this);
6479
+ if (args.length === 0) return globalRegistry$1.get(this);
6480
6480
  const cl = this.clone();
6481
- globalRegistry.add(cl, args[0]);
6481
+ globalRegistry$1.add(cl, args[0]);
6482
6482
  return cl;
6483
6483
  },
6484
6484
  isOptional() {
@@ -6554,7 +6554,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
6554
6554
  return createToJSONSchemaMethod(this, {})(params);
6555
6555
  },
6556
6556
  get description() {
6557
- return globalRegistry.get(this)?.description;
6557
+ return globalRegistry$1.get(this)?.description;
6558
6558
  },
6559
6559
  get _def() {
6560
6560
  return this._zod.def;
@@ -7830,6 +7830,14 @@ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
7830
7830
  ...schemas_exports,
7831
7831
  ...checks_exports
7832
7832
  });
7833
+ const createMetaType = (type) => {
7834
+ return Object.assign((value) => {
7835
+ return {
7836
+ type,
7837
+ data: value ?? {}
7838
+ };
7839
+ }, type);
7840
+ };
7833
7841
  (/* @__PURE__ */ __commonJSMin(((exports, module) => {
7834
7842
  const CHARS_GLOBAL_BACKSLASH_SUPPORTED_RX = /[\0\b\t\n\r\x1a"'\\]/g;
7835
7843
  const CHARS_ESCAPE_BACKSLASH_SUPPORTED_MAP = {
@@ -7886,6 +7894,39 @@ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
7886
7894
  }
7887
7895
  module.exports = escapeString;
7888
7896
  })))();
7897
+ const isZodTypeExtends = (type, zodType) => {
7898
+ if (type instanceof zodType) return type;
7899
+ if (type.def.type === "union") {
7900
+ for (const option of type.def.options) if (isZodTypeExtends(option, zodType)) return option;
7901
+ return false;
7902
+ }
7903
+ const rootType = type.def.innerType ?? type.def.in;
7904
+ if (rootType) return isZodTypeExtends(rootType, zodType);
7905
+ return false;
7906
+ };
7907
+ createMetaType({
7908
+ id: "foreignKey",
7909
+ check: (type) => {
7910
+ if (isZodTypeExtends(type, zod.ZodString) || isZodTypeExtends(type, zod.ZodNumber)) return { success: true };
7911
+ return {
7912
+ success: false,
7913
+ message: "Foreign key must be a string or number"
7914
+ };
7915
+ }
7916
+ });
7917
+ createMetaType({
7918
+ id: "primaryKey",
7919
+ check: (type) => {
7920
+ if (isZodTypeExtends(type, zod.ZodString) || isZodTypeExtends(type, zod.ZodNumber)) return { success: true };
7921
+ return {
7922
+ success: false,
7923
+ message: "Primary key must be a string or number"
7924
+ };
7925
+ }
7926
+ });
7927
+ createMetaType({ id: "updatedAt" });
7928
+ createMetaType({ id: "monotonicTimestamp" });
7929
+ createMetaType({ id: "backfill" });
7889
7930
  /**
7890
7931
  * The prefix of every kind of object customers can see, so an ID says what it identifies:
7891
7932
  * `proj_8fK2mQx7Lp4NvB3tRz9Y` is a project. Rows that never leave the backend (usage meters, upload
@@ -7989,8 +8030,8 @@ const EXAMPLE_IDS = {
7989
8030
  * across the packages that build records from plain strings).
7990
8031
  */
7991
8032
  const idField = (prefix) => zod.string().regex(idPattern(prefix), { message: `Must be a valid ID: "${prefix}_" followed by 20 letters or digits` }).meta({ examples: [EXAMPLE_IDS[prefix]] });
7992
- // src/contract/Permissions-DPNlE8m-.js
7993
- const ACTION_SCHEMA = zod.enum([
8033
+ // src/contract/Permissions-CzuRcPMS.js
8034
+ const ACTION_SCHEMA = /* @__PURE__ */ require_TestTriggers_Cvi7e2KA.lazySchema(() => zod.enum([
7994
8035
  "assets:read",
7995
8036
  "assets:download",
7996
8037
  "assets:create",
@@ -8022,7 +8063,7 @@ const ACTION_SCHEMA = zod.enum([
8022
8063
  "reviews:read",
8023
8064
  "reviews:write",
8024
8065
  "project:manage"
8025
- ]);
8066
+ ]));
8026
8067
  const PROJECT_ACTIONS = [...[
8027
8068
  "settings",
8028
8069
  "members",
@@ -8038,19 +8079,12 @@ const PROJECT_ACTIONS = [...[
8038
8079
  const isProjectAction = (action) => PROJECT_ACTIONS.includes(action);
8039
8080
  /** The actions that include `action`: its feature's write action and project:manage. */
8040
8081
  const actionsImplying = (action) => !isProjectAction(action) || action === "project:manage" ? [] : action.endsWith(":read") ? [action.replace(/:read$/, ":write"), "project:manage"] : ["project:manage"];
8041
- const GRANT_SCHEMA = zod.object({
8082
+ const GRANT_SCHEMA = /* @__PURE__ */ require_TestTriggers_Cvi7e2KA.lazySchema(() => zod.object({
8042
8083
  actions: zod.array(ACTION_SCHEMA),
8043
8084
  folderId: idField("fldr").nullable(),
8044
8085
  includeSubfolders: zod.boolean()
8045
- }).strict().refine((g) => g.folderId === null || !g.actions.some(isProjectAction), "Project configuration permissions require project scope");
8046
- const GRANTS_SCHEMA = zod.array(GRANT_SCHEMA).max(100);
8047
- zod.enum([
8048
- "admin",
8049
- "configurator",
8050
- "editor",
8051
- "viewer",
8052
- "custom"
8053
- ]);
8086
+ }).strict().refine((g) => g.folderId === null || !g.actions.some(isProjectAction), "Project configuration permissions require project scope"));
8087
+ const GRANTS_SCHEMA = /* @__PURE__ */ require_TestTriggers_Cvi7e2KA.lazySchema(() => zod.array(GRANT_SCHEMA).max(100));
8054
8088
  [...ACTION_SCHEMA.options.filter((a) => !isProjectAction(a))];
8055
8089
  [...ACTION_SCHEMA.options.filter((a) => !isProjectAction(a))];
8056
8090
  const permits = (grants, action, folderId, folders) => grants.some((grant) => {
@@ -8066,14 +8100,6 @@ const permits = (grants, action, folderId, folders) => grants.some((grant) => {
8066
8100
  }
8067
8101
  return false;
8068
8102
  });
8069
- /**
8070
- * What a person can let an AI assistant or the CLI do for them. `read` looks at assets, folders,
8071
- * hash lists and events; `write` also creates, changes and deletes assets, folders and hash lists.
8072
- * Members, API keys, connectors, sharing, downloads and project settings are never delegated.
8073
- */
8074
- const AGENT_SCOPE_SCHEMA = zod.enum(["read", "write"]);
8075
- zod.array(AGENT_SCOPE_SCHEMA).min(1).max(2);
8076
- zod.enum(["active", "banned"]);
8077
8103
  // src/testing/MockApiKey.ts
8078
8104
  const MOCK_API_KEY_PREFIX = "sk_test_";
8079
8105
  const toBase64Url = (value) => btoa(value).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
@@ -8666,9 +8692,9 @@ const MOCK_ASSET_FILTER_FIELDS = {
8666
8692
  "=out="
8667
8693
  ]
8668
8694
  },
8669
- "classification.moderation.status": {
8695
+ "classification.moderation.decision": {
8670
8696
  kind: "text",
8671
- nullable: false,
8697
+ nullable: true,
8672
8698
  operators: [
8673
8699
  "==",
8674
8700
  "!=",
@@ -9063,7 +9089,7 @@ const searchFieldValues = (asset) => [
9063
9089
  ["type", asset.type],
9064
9090
  ["content.format", asset.content?.format ?? ""],
9065
9091
  ["content.extension", asset.content?.extension ?? ""],
9066
- ["classification.moderation.status", asset.classification.moderation.status]
9092
+ ["classification.moderation.decision", asset.classification.moderation.decision ?? "pending"]
9067
9093
  ];
9068
9094
  /** The API's keyword score for the whole lowercased query. */
9069
9095
  const keywordScore = (values, query) => {
@@ -9118,21 +9144,17 @@ const REVIEW_DECISIONS = [
9118
9144
  */
9119
9145
  const MOCK_OPERATIONS = [
9120
9146
  "assets.list",
9121
- "assets.iterate",
9122
9147
  "assets.search",
9123
9148
  "assets.retrieve",
9124
9149
  "assets.waitForDecision",
9125
9150
  "assets.update",
9126
9151
  "assets.listChildren",
9127
- "assets.iterateChildren",
9128
9152
  "assets.listTimeline",
9129
- "assets.iterateTimeline",
9130
9153
  "assets.create",
9131
9154
  "assets.classify",
9132
9155
  "assets.uploadPart",
9133
9156
  "assets.move",
9134
9157
  "assets.retry",
9135
- "assets.explain",
9136
9158
  "assets.decide",
9137
9159
  "assets.removeContent",
9138
9160
  "assets.delete",
@@ -9142,26 +9164,21 @@ const MOCK_OPERATIONS = [
9142
9164
  "cdn.getAssetInfo",
9143
9165
  "cdn.signAssetUrl",
9144
9166
  "events.list",
9145
- "events.pages",
9146
9167
  "folders.list",
9147
- "folders.iterate",
9148
9168
  "folders.retrieve",
9149
9169
  "folders.create",
9150
9170
  "folders.update",
9151
9171
  "folders.delete",
9152
9172
  "folders.move",
9153
9173
  "hashLists.list",
9154
- "hashLists.iterate",
9155
9174
  "hashLists.retrieve",
9156
9175
  "hashLists.create",
9157
9176
  "hashLists.update",
9158
9177
  "hashLists.delete",
9159
9178
  "hashLists.listEntries",
9160
- "hashLists.iterateEntries",
9161
9179
  "hashLists.addEntry",
9162
9180
  "hashLists.removeEntry",
9163
9181
  "policies.list",
9164
- "policies.iterate",
9165
9182
  "policies.retrieve",
9166
9183
  "policies.create",
9167
9184
  "policies.update",
@@ -9172,7 +9189,6 @@ const MOCK_OPERATIONS = [
9172
9189
  "policies.retrieveAssigned",
9173
9190
  "policies.assign",
9174
9191
  "lenses.list",
9175
- "lenses.iterate",
9176
9192
  "lenses.create",
9177
9193
  "lenses.retrieve",
9178
9194
  "lenses.update",
@@ -9180,7 +9196,6 @@ const MOCK_OPERATIONS = [
9180
9196
  "ensureLens",
9181
9197
  "ensureLenses",
9182
9198
  "uploadPresets.list",
9183
- "uploadPresets.iterate",
9184
9199
  "uploadPresets.ensure",
9185
9200
  "uploadPresets.delete",
9186
9201
  "projectSettings.get",
@@ -9238,7 +9253,7 @@ const toEventAsset = (asset) => ({
9238
9253
  classification: {
9239
9254
  status: asset.classification.status,
9240
9255
  testInput: asset.classification.testInput,
9241
- moderation: { status: asset.classification.moderation.status }
9256
+ moderation: { decision: asset.classification.moderation.decision }
9242
9257
  },
9243
9258
  content: { status: asset.content.status }
9244
9259
  });
@@ -9519,7 +9534,7 @@ const MOCK_PRESET_NAMES = {
9519
9534
  * personal information and profanity, `block` otherwise) and no rules. The mock holds no built-in
9520
9535
  * preset settings, and uploads are never decided by a policy.
9521
9536
  */
9522
- const mockPresetSettings = () => ({ categorySettings: Object.fromEntries(require_TestTriggers_CiFcTHX3.CLASSIFICATION_CATEGORIES.map((category) => [category, {
9537
+ const mockPresetSettings = () => ({ categorySettings: Object.fromEntries(require_TestTriggers_Cvi7e2KA.CLASSIFICATION_CATEGORIES.map((category) => [category, {
9523
9538
  action: category === "personal-information" || category === "profanity" ? "allow" : "block",
9524
9539
  allowances: [],
9525
9540
  restrictions: []
@@ -9531,13 +9546,13 @@ const mockPresetSettings = () => ({ categorySettings: Object.fromEntries(require
9531
9546
  const checkPolicySettings = (settings) => {
9532
9547
  const categories = settings?.categorySettings;
9533
9548
  if (!categories || typeof categories !== "object") throw invalidField("validation/invalid-type", "settings.categorySettings");
9534
- for (const category of require_TestTriggers_CiFcTHX3.CLASSIFICATION_CATEGORIES) {
9549
+ for (const category of require_TestTriggers_Cvi7e2KA.CLASSIFICATION_CATEGORIES) {
9535
9550
  const value = categories[category];
9536
9551
  if (!value || typeof value !== "object") throw invalidField("validation/invalid-type", `settings.categorySettings.${category}`);
9537
9552
  for (const key of ["allowances", "restrictions"]) if (!Array.isArray(value[key])) throw invalidField("validation/invalid-type", `settings.categorySettings.${category}.${key}`);
9538
9553
  if (typeof value.action !== "string") throw invalidField("validation/invalid-value", `settings.categorySettings.${category}.action`);
9539
9554
  }
9540
- for (const key of Object.keys(categories)) if (!require_TestTriggers_CiFcTHX3.CLASSIFICATION_CATEGORIES.includes(key)) throw invalidField("validation/unknown-field", `settings.categorySettings.${key}`);
9555
+ for (const key of Object.keys(categories)) if (!require_TestTriggers_Cvi7e2KA.CLASSIFICATION_CATEGORIES.includes(key)) throw invalidField("validation/unknown-field", `settings.categorySettings.${key}`);
9541
9556
  };
9542
9557
  /** The client methods that send a request, the one it is recorded under first. */
9543
9558
  const operationsOf = (request) => {
@@ -9546,29 +9561,29 @@ const operationsOf = (request) => {
9546
9561
  const [root] = segments;
9547
9562
  if (root === "projects") {
9548
9563
  switch (segments.slice(2).join("/")) {
9549
- case "events": return ["events.list", "events.pages"];
9550
- case "lenses": return method === "GET" ? ["lenses.list", "lenses.iterate"] : method === "POST" ? ["lenses.create"] : ["ensureLenses", "ensureLens"];
9551
- case "folders": return method === "GET" ? ["folders.list", "folders.iterate"] : ["folders.create"];
9552
- case "hash-lists": return method === "GET" ? ["hashLists.list", "hashLists.iterate"] : ["hashLists.create"];
9564
+ case "events": return ["events.list"];
9565
+ case "lenses": return method === "GET" ? ["lenses.list"] : method === "POST" ? ["lenses.create"] : ["ensureLenses", "ensureLens"];
9566
+ case "folders": return method === "GET" ? ["folders.list"] : ["folders.create"];
9567
+ case "hash-lists": return method === "GET" ? ["hashLists.list"] : ["hashLists.create"];
9553
9568
  case "policy": return method === "GET" ? ["policies.retrieveAssigned"] : ["policies.assign"];
9554
- case "upload-presets": return method === "GET" ? ["uploadPresets.list", "uploadPresets.iterate"] : ["uploadPresets.ensure"];
9569
+ case "upload-presets": return method === "GET" ? ["uploadPresets.list"] : ["uploadPresets.ensure"];
9555
9570
  case "settings": return method === "GET" ? ["projectSettings.get"] : ["projectSettings.update"];
9556
9571
  case "metadata-fields": return method === "GET" ? ["metadataFields.list"] : ["metadataFields.ensure"];
9557
9572
  case "assets/search": return ["assets.search"];
9558
9573
  case "assets/batch": return ["assets.batch"];
9559
9574
  case "signed-asset-urls": return ["cdn.signAssetUrl"];
9560
9575
  case "assets":
9561
- if (method === "GET") return ["assets.list", "assets.iterate"];
9576
+ if (method === "GET") return ["assets.list"];
9562
9577
  if (query.get("wait") === "false") return ["assets.create"];
9563
9578
  return isTextUpload(request) ? ["assets.classify", "text.classify"] : ["assets.classify"];
9564
9579
  }
9565
- if (segments[2] === "assets" && segments[4] === "timeline" && segments.length === 5) return ["assets.listTimeline", "assets.iterateTimeline"];
9580
+ if (segments[2] === "assets" && segments[4] === "timeline" && segments.length === 5) return ["assets.listTimeline"];
9566
9581
  if (segments[2] === "metadata-fields" && segments.length === 4) return ["metadataFields.delete"];
9567
9582
  return [];
9568
9583
  }
9569
9584
  if (root === "policies") {
9570
9585
  const [, policyId, policyAction] = segments;
9571
- if (policyId === void 0) return method === "GET" ? ["policies.list", "policies.iterate"] : ["policies.create"];
9586
+ if (policyId === void 0) return method === "GET" ? ["policies.list"] : ["policies.create"];
9572
9587
  if (policyAction === "reset") return ["policies.reset"];
9573
9588
  if (policyAction === "upgrade") return ["policies.upgrade"];
9574
9589
  if (policyAction === "automatic-updates") return ["policies.setAutomaticUpdates"];
@@ -9587,7 +9602,7 @@ const operationsOf = (request) => {
9587
9602
  return method === "GET" ? ["folders.retrieve"] : method === "PATCH" ? ["folders.update"] : ["folders.delete"];
9588
9603
  }
9589
9604
  if (root === "hash-lists" && id !== void 0) {
9590
- if (action === "entries") return method === "GET" ? ["hashLists.listEntries", "hashLists.iterateEntries"] : ["hashLists.addEntry"];
9605
+ if (action === "entries") return method === "GET" ? ["hashLists.listEntries"] : ["hashLists.addEntry"];
9591
9606
  return method === "GET" ? ["hashLists.retrieve"] : method === "PATCH" ? ["hashLists.update"] : ["hashLists.delete"];
9592
9607
  }
9593
9608
  if (root === "hash-list-entries" && id !== void 0) return ["hashLists.removeEntry"];
@@ -9595,11 +9610,10 @@ const operationsOf = (request) => {
9595
9610
  switch (action) {
9596
9611
  case void 0: return method === "GET" ? ["assets.retrieve", "assets.waitForDecision"] : method === "PATCH" ? ["assets.update"] : ["assets.delete"];
9597
9612
  case "content": return ["assets.removeContent"];
9598
- case "children": return ["assets.listChildren", "assets.iterateChildren"];
9613
+ case "children": return ["assets.listChildren"];
9599
9614
  case "part": return ["assets.uploadPart"];
9600
9615
  case "move": return ["assets.move"];
9601
9616
  case "retry": return ["assets.retry"];
9602
- case "explain": return ["assets.explain"];
9603
9617
  case "decision": return ["assets.decide"];
9604
9618
  }
9605
9619
  return [];
@@ -9646,7 +9660,6 @@ var MockCalmLensApi = class {
9646
9660
  this.eventFeed = [];
9647
9661
  this.assetEventSequences = /* @__PURE__ */ new Map();
9648
9662
  this.processingOptions = /* @__PURE__ */ new Map();
9649
- this.pendingReruns = /* @__PURE__ */ new Set();
9650
9663
  this.openUploads = /* @__PURE__ */ new Map();
9651
9664
  this.idempotentResults = /* @__PURE__ */ new Map();
9652
9665
  this.pendingFailures = [];
@@ -9693,7 +9706,7 @@ var MockCalmLensApi = class {
9693
9706
  if (!asset) return this.pushEvent(input);
9694
9707
  const snapshot = toEventAsset(asset);
9695
9708
  const announced = ANNOUNCED_STATUS[input.type];
9696
- if (announced) snapshot.classification.moderation.status = announced;
9709
+ if (announced) snapshot.classification.moderation.decision = announced;
9697
9710
  return this.pushEvent({
9698
9711
  ...input,
9699
9712
  asset: snapshot
@@ -9744,11 +9757,9 @@ var MockCalmLensApi = class {
9744
9757
  } catch (failure) {
9745
9758
  throw this.toError(failure);
9746
9759
  }
9747
- const rerun = this.pendingReruns.has(asset.id);
9748
- if (!rerun && asset.classification.status !== "processing") throw require_ModerationContextLimits.invalidArgument(`asset ${assetId} isn't processing`);
9760
+ if (asset.classification.status !== "processing") throw require_ModerationContextLimits.invalidArgument(`asset ${assetId} isn't processing`);
9749
9761
  const settled = decision === void 0 ? void 0 : toDecision(decision);
9750
- if (!rerun) return structuredClone(await this.moderateStored(asset, "complete", settled));
9751
- return structuredClone(await this.settleRerun(asset, settled ?? await this.decisionFor(asset, "complete", true)));
9762
+ return structuredClone(await this.moderateStored(asset, "complete", settled));
9752
9763
  }
9753
9764
  /**
9754
9765
  * `POST /assets/:assetId/decision`, like the API: an asset still uploading or processing can't
@@ -9767,8 +9778,8 @@ var MockCalmLensApi = class {
9767
9778
  if (note.length > MAX_DECISION_NOTE_LENGTH) throw invalidField("validation/too-big", "note");
9768
9779
  const asset = await this.findOwnAsset(assetId);
9769
9780
  if (asset.upload.status === "uploading" || asset.classification.status === "processing") throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_PROCESSING);
9770
- const status = asset.classification.moderation.status;
9771
- if (decision !== "purged" && decision !== "blocked" && status === "pending") throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_DECISION_NOT_ALLOWED);
9781
+ const status = asset.classification.moderation.decision;
9782
+ if (decision !== "purged" && decision !== "blocked" && status === null) throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_DECISION_NOT_ALLOWED);
9772
9783
  if (status === decision) throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_DECISION_UNCHANGED);
9773
9784
  if (decision !== "purged" && decision !== "blocked" && status === "purged") throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_CONTENT_PURGED);
9774
9785
  return this.recordDecision(asset, decision, { note });
@@ -9779,7 +9790,6 @@ var MockCalmLensApi = class {
9779
9790
  * the mock API key's; the test hook records no note, the API's handler records it.
9780
9791
  */
9781
9792
  async recordDecision(asset, decision, review) {
9782
- this.pendingReruns.delete(asset.id);
9783
9793
  const decided = await this.applyOutcome(asset, decision, "requested");
9784
9794
  const now = this.now();
9785
9795
  if (!review) decided.classification.moderation.pendingReview = null;
@@ -10065,7 +10075,6 @@ var MockCalmLensApi = class {
10065
10075
  case "POST part": return [200, await this.uploadPart(id, request)];
10066
10076
  case "POST move": return [200, await this.moveAsset(id, this.json(request))];
10067
10077
  case "POST retry": return [200, await this.retryAsset(id)];
10068
- case "POST explain": return [200, await this.explainAsset(id, this.json(request))];
10069
10078
  case "POST decision": return [200, await this.decideAsset(id, this.json(request))];
10070
10079
  case "DELETE content": return [200, await this.removeContent(await this.findOwnAsset(id))];
10071
10080
  }
@@ -10481,53 +10490,12 @@ var MockCalmLensApi = class {
10481
10490
  }
10482
10491
  async retryAsset(assetId) {
10483
10492
  const asset = await this.findOwnAsset(assetId);
10484
- if (asset.classification.status !== "failed" || asset.classification.moderation.status !== "pending") throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_NOT_RETRYABLE);
10493
+ if (asset.classification.status !== "failed" || asset.classification.moderation.decision !== null) throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_NOT_RETRYABLE);
10485
10494
  if (asset.content.status === "removed") throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_CONTENT_UNAVAILABLE);
10486
10495
  const retried = await this.databaseStorage.updateAsset(await this.applyOutcome(asset, "pending"));
10487
10496
  this.recordLifecycleEvent("asset.retried", retried);
10488
10497
  return this.moderateStored(retried, "retry");
10489
10498
  }
10490
- async explainAsset(assetId, body) {
10491
- const asset = await this.findOwnAsset(assetId);
10492
- if (asset.classification.status !== "completed") throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_NOT_DECIDED);
10493
- if (!body.rerun) {
10494
- if (asset.classification.moderation?.explanationComplete !== false) return asset;
10495
- return this.databaseStorage.updateAsset({
10496
- ...asset,
10497
- updatedAt: this.now(),
10498
- classification: {
10499
- ...asset.classification,
10500
- moderation: {
10501
- ...asset.classification.moderation,
10502
- explanationComplete: true
10503
- }
10504
- }
10505
- });
10506
- }
10507
- if (asset.classification.moderation.manualReviews.length) throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_REVIEWED);
10508
- if (asset.content.status === "removed") throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_CONTENT_UNAVAILABLE);
10509
- this.pushEvent({
10510
- type: "asset.rerun-requested",
10511
- actor: MOCK_API_KEY_ACTOR,
10512
- severity: "low",
10513
- assetId: asset.id,
10514
- asset: toEventAsset(asset),
10515
- facts: [
10516
- assetNameFact(asset),
10517
- {
10518
- key: "asset-type",
10519
- value: asset.type
10520
- },
10521
- {
10522
- key: "moderation-status",
10523
- value: asset.classification.moderation.status
10524
- }
10525
- ]
10526
- });
10527
- const response = structuredClone(asset);
10528
- await this.settleRerun(asset, await this.decisionFor(asset, "rerun", true));
10529
- return response;
10530
- }
10531
10499
  /**
10532
10500
  * Checks every asset like the API (an ID that is not an asset ID is
10533
10501
  * `validation/invalid-format`, an unknown
@@ -10793,7 +10761,7 @@ var MockCalmLensApi = class {
10793
10761
  progress: null,
10794
10762
  testInput: false,
10795
10763
  moderation: {
10796
- status: "pending",
10764
+ decision: null,
10797
10765
  manualReviews: [],
10798
10766
  automatedStatus: null,
10799
10767
  policy: null,
@@ -10972,20 +10940,6 @@ var MockCalmLensApi = class {
10972
10940
  this.recordProcessingEvents(stored, decision);
10973
10941
  return stored;
10974
10942
  }
10975
- /**
10976
- * Applies a re-run's `decision` to a decided asset like the pipeline: a `pending` decision stays
10977
- * queued for `completeProcessing`, a `failed` one keeps the asset's decision, and any other
10978
- * replaces it with the pipeline's events.
10979
- */
10980
- async settleRerun(asset, decision) {
10981
- this.pendingReruns.delete(asset.id);
10982
- if (decision.status === "pending") {
10983
- this.pendingReruns.add(asset.id);
10984
- return asset;
10985
- }
10986
- if (decision.status === "failed") return asset;
10987
- return this.settle(asset, decision);
10988
- }
10989
10943
  /** Asks `moderate` (unless `decision` is given) and settles a processing asset. */
10990
10944
  async moderateStored(asset, trigger, decision) {
10991
10945
  return this.settle(asset, decision ?? await this.decisionFor(asset, trigger, true));
@@ -11126,7 +11080,7 @@ var MockCalmLensApi = class {
11126
11080
  completedAt: decided ? now : null,
11127
11081
  moderation: {
11128
11082
  ...asset.classification.moderation,
11129
- status: decided ? outcome : "pending",
11083
+ decision: decided ? outcome : null,
11130
11084
  ...report
11131
11085
  }
11132
11086
  }
@@ -11177,7 +11131,7 @@ var MockCalmLensApi = class {
11177
11131
  classification: {
11178
11132
  status: asset.classification.status,
11179
11133
  failureReason: asset.classification.failureReason,
11180
- ...preset.showDecisions !== false && { moderation: { status: asset.classification.moderation.status } }
11134
+ ...preset.showDecisions !== false && { moderation: { decision: asset.classification.moderation.decision } }
11181
11135
  }
11182
11136
  });
11183
11137
  const [assetId, action] = rest;
@@ -11645,9 +11599,10 @@ var MockCalmLensApi = class {
11645
11599
  const grants = hasApiKey ? this.grants : [];
11646
11600
  const folders = await this.databaseStorage.listFolders?.(this.projectId) ?? [];
11647
11601
  const canDownload = () => permits(grants, "assets:download", asset.folderId ?? null, folders);
11648
- const status = asset.classification.moderation.status;
11602
+ const status = asset.classification.moderation.decision;
11649
11603
  const isHead = request.method === "HEAD";
11650
11604
  const { rendered, preview } = asset.content;
11605
+ if (resource !== "info" && asset.content.status === "removed") return notFound();
11651
11606
  if (asset.visibility !== "public" && !grant && !hasApiKey && resource !== "info") return notFound();
11652
11607
  if (resource === "info") return this.serveInfo(request, asset, Boolean(grant) || canDownload());
11653
11608
  if (asset.content.safetyHold) return notAvailable();
@@ -11664,7 +11619,7 @@ var MockCalmLensApi = class {
11664
11619
  });
11665
11620
  }
11666
11621
  const storedContent = await this.imageStorage.getContent(asset.id);
11667
- if (asset.upload.status === "uploading" || status === "purged" || status === "blocked" || asset.classification.status === "failed" || asset.content.status === "removed" || resource === "original" && !storedContent) return notAvailable();
11622
+ if (asset.upload.status === "uploading" || status === "purged" || status === "blocked" || asset.classification.status === "failed" || resource === "original" && !storedContent) return notAvailable();
11668
11623
  let claims = {};
11669
11624
  try {
11670
11625
  claims = JSON.parse(query.get("viewerClaims") ?? request.headers.get("X-CalmLens-Viewer-Claims") ?? "{}");
@@ -11743,7 +11698,7 @@ var MockCalmLensApi = class {
11743
11698
  } catch {
11744
11699
  return this.jsonResponse(400, { code: "viewer-claims/invalid" }, url);
11745
11700
  }
11746
- const status = asset.classification.moderation.status;
11701
+ const status = asset.classification.moderation.decision;
11747
11702
  const restrictedInfo = isPrivate || status === "blocked" || status === "purged";
11748
11703
  if (restrictedInfo && !authorised) return this.jsonResponse(403, { code: "asset/not-available" }, url);
11749
11704
  const availability = asset.content.safetyHold || asset.upload.status === "uploading" || status === "blocked" || status === "purged" || asset.classification.status === "failed" || asset.content.status === "removed" ? "unavailable" : status === "age-restricted" && claims.ageConfirmed !== true ? "age-restricted" : "available";
@@ -12014,11 +11969,8 @@ var MockCalmLensServerClient = class extends require_CalmLensServerClient.CalmLe
12014
11969
  * else what `mockOptions.moderate` returns for the `complete` trigger (`allowed` by default).
12015
11970
  * The asset gets the decision's report, and `asset.classified` and the automated
12016
11971
  * `asset.<status>` (or `asset.failed`) join the events feed. No review is recorded, so the
12017
- * asset can still be moderated again. A decided asset whose re-run (`assets.explain` with
12018
- * `rerun: true`) is still pending gets the decision in place of its old one, unless it is
12019
- * `pending` or `failed`. Rejects with `asset/not-found` for an unknown asset and
12020
- * `sdk/invalid-argument` for one that isn't processing or awaiting a pending re-run. It sends
12021
- * no request.
11972
+ * asset can still be moderated again. Rejects with `asset/not-found` for an unknown asset and
11973
+ * `sdk/invalid-argument` for one that isn't processing. It sends no request.
12022
11974
  */
12023
11975
  completeProcessing(assetId, decision) {
12024
11976
  return this.#api.completeProcessing(assetId, decision);
@@ -1,5 +1,5 @@
1
- import "./CalmLensTypes-BhR7LFDu.js";
2
- import { G as AssetSession, W as AssetOptions, Y as AssetView, at as ImageViewerOptions, ct as TextViewerOptions, ft as WebsiteViewerOptions, it as DocumentViewerOptions, ot as PdfAssetOptions, st as SpreadsheetViewerOptions, ut as ViewerOptions } from "./Core-DSMxC2GL.js";
1
+ import "./CalmLensTypes-HUERg5hI.js";
2
+ import { K as AssetOptions, Z as AssetView, ct as PdfAssetOptions, ft as ViewerOptions, lt as SpreadsheetViewerOptions, mt as WebsiteViewerOptions, ot as DocumentViewerOptions, q as AssetSession, st as ImageViewerOptions, ut as TextViewerOptions } from "./Core-DXAs8mcx.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> {
@@ -1,6 +1,6 @@
1
- const require_ModerationContextLimits = require("./ModerationContextLimits-Cn9RvnZH.js");
2
- const require_UploadController = require("./UploadController-ObdgTaBl.js");
3
- require("./Core-Cw4IxFUq.js");
1
+ const require_ModerationContextLimits = require("./ModerationContextLimits-BcYKgU2X.js");
2
+ const require_UploadController = require("./UploadController-C8GPbDKI.js");
3
+ require("./Core-D-1KCqT7.js");
4
4
  // src/ui/viewers/PdfLoader.ts
5
5
  let loading;
6
6
  /**
@@ -398,7 +398,9 @@ var DocumentViewer = class extends ViewerBase {
398
398
  toolbar.insertBefore(next, count.nextSibling);
399
399
  page.addEventListener("change", () => this.#go(Number(page.value)));
400
400
  page.addEventListener("keydown", (event) => {
401
- if (event.key === "Enter") this.#go(Number(page.value));
401
+ if (event.key !== "Enter") return;
402
+ event.preventDefault();
403
+ if (!event.isComposing && event.keyCode !== 229) this.#go(Number(page.value));
402
404
  });
403
405
  zoomOut.addEventListener("click", () => this.#setZoom(this.#scale / ZOOM_STEP));
404
406
  zoomIn.addEventListener("click", () => this.#setZoom(this.#scale * ZOOM_STEP));
@@ -488,7 +490,7 @@ var DocumentViewer = class extends ViewerBase {
488
490
  const page = await document.getPage(pageNumber);
489
491
  if (render !== this.#renders) return;
490
492
  const natural = page.getViewport({ scale: 1 });
491
- const available = controls.pages.clientWidth - 32;
493
+ const available = controls.pages.clientWidth;
492
494
  const scale = this.#zoom ?? (available > 0 ? available / natural.width : 1);
493
495
  this.#scale = scale;
494
496
  controls.zoomLevel.textContent = formatViewerMessage(messages.zoomLevel, { percent: Math.round(scale * 100) });