superdoc 2.23.0-next.1 → 2.23.0-next.2

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.
@@ -5090,8 +5090,12 @@ function selectionBlockRange(selection) {
5090
5090
  */
5091
5091
  function selectionBlockIds(selection) {
5092
5092
  const ids = [];
5093
+ const seen = /* @__PURE__ */ new Set();
5093
5094
  const push = (id) => {
5094
- if (typeof id === "string" && id.length > 0 && !ids.includes(id)) ids.push(id);
5095
+ if (typeof id === "string" && id.length > 0 && !seen.has(id)) {
5096
+ seen.add(id);
5097
+ ids.push(id);
5098
+ }
5095
5099
  };
5096
5100
  const target = selection.target;
5097
5101
  const segments = target && Array.isArray(target.segments) ? target.segments : [];
@@ -5089,8 +5089,12 @@ function selectionBlockRange(selection) {
5089
5089
  */
5090
5090
  function selectionBlockIds(selection) {
5091
5091
  const ids = [];
5092
+ const seen = /* @__PURE__ */ new Set();
5092
5093
  const push = (id) => {
5093
- if (typeof id === "string" && id.length > 0 && !ids.includes(id)) ids.push(id);
5094
+ if (typeof id === "string" && id.length > 0 && !seen.has(id)) {
5095
+ seen.add(id);
5096
+ ids.push(id);
5097
+ }
5094
5098
  };
5095
5099
  const target = selection.target;
5096
5100
  const segments = target && Array.isArray(target.segments) ? target.segments : [];
@@ -19,7 +19,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
19
19
  var PRIVATE_ENGINE_INFO = (0, _superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
20
20
  var ENGINE_INFO = Object.freeze({
21
21
  ...PRIVATE_ENGINE_INFO,
22
- superdocVersion: "2.23.0-next.1",
22
+ superdocVersion: "2.23.0-next.2",
23
23
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
24
24
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
25
25
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -18,7 +18,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
18
18
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
19
19
  var ENGINE_INFO = Object.freeze({
20
20
  ...PRIVATE_ENGINE_INFO,
21
- superdocVersion: "2.23.0-next.1",
21
+ superdocVersion: "2.23.0-next.2",
22
22
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
23
23
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
24
24
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-MSiU8Kg0.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CbiiPcgr.cjs");
3
3
  const require_slice_source = require("../chunks/slice-source-CFaqq0Vo.cjs");
4
4
  let react = require("react");
5
5
  //#region src/public/ui/react.ts
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-DmGX1w-i.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-DHW9Toxn.es.js";
2
2
  import { t as toSliceSource } from "../chunks/slice-source-gfOhG2MW.es.js";
3
3
  import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
4
4
  //#region src/public/ui/react.ts
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-MSiU8Kg0.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CbiiPcgr.cjs");
3
3
  const require_slice_source = require("../chunks/slice-source-CFaqq0Vo.cjs");
4
4
  let superdoc_entry_vue = require("vue");
5
5
  //#region src/public/ui/vue.ts
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-DmGX1w-i.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-DHW9Toxn.es.js";
2
2
  import { t as toSliceSource } from "../chunks/slice-source-gfOhG2MW.es.js";
3
3
  import { computed, inject, onScopeDispose, provide, shallowRef, toRaw, toValue, watch } from "vue";
4
4
  //#region src/public/ui/vue.ts
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-MSiU8Kg0.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CbiiPcgr.cjs");
3
3
  exports.BUILT_IN_COMMAND_IDS = require_create_super_doc_ui.BUILT_IN_COMMAND_IDS;
4
4
  exports.createSuperDocUI = require_create_super_doc_ui.createSuperDocUI;
5
5
  exports.shallowEqual = require_create_super_doc_ui.shallowEqual;
@@ -1,2 +1,2 @@
1
- import { a as BUILT_IN_COMMAND_IDS, t as createSuperDocUI, u as shallowEqual } from "../chunks/create-super-doc-ui-DmGX1w-i.es.js";
1
+ import { a as BUILT_IN_COMMAND_IDS, t as createSuperDocUI, u as shallowEqual } from "../chunks/create-super-doc-ui-DHW9Toxn.es.js";
2
2
  export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };
package/dist/style.css CHANGED
@@ -2340,34 +2340,34 @@ img[data-v-c95b2073] {
2340
2340
  pointer-events: auto;
2341
2341
  }
2342
2342
 
2343
- .superdoc[data-v-99399849] {
2343
+ .superdoc[data-v-3a8081b4] {
2344
2344
  display: flex;
2345
2345
  position: relative;
2346
2346
  }
2347
- .right-sidebar[data-v-99399849] {
2347
+ .right-sidebar[data-v-3a8081b4] {
2348
2348
  min-width: 320px;
2349
2349
  height: 100%;
2350
2350
  }
2351
- .floating-comments[data-v-99399849] {
2351
+ .floating-comments[data-v-3a8081b4] {
2352
2352
  min-width: 300px;
2353
2353
  width: 300px;
2354
2354
  height: 100%;
2355
2355
  overflow: visible;
2356
2356
  }
2357
- .superdoc__layers[data-v-99399849] {
2357
+ .superdoc__layers[data-v-3a8081b4] {
2358
2358
  height: 100%;
2359
2359
  position: relative;
2360
2360
  box-sizing: border-box;
2361
2361
  }
2362
- .superdoc__document[data-v-99399849] {
2362
+ .superdoc__document[data-v-3a8081b4] {
2363
2363
  width: 100%;
2364
2364
  position: relative;
2365
2365
  }
2366
- .superdoc__sub-document[data-v-99399849] {
2366
+ .superdoc__sub-document[data-v-3a8081b4] {
2367
2367
  width: 100%;
2368
2368
  position: relative;
2369
2369
  }
2370
- .superdoc__selection-layer[data-v-99399849] {
2370
+ .superdoc__selection-layer[data-v-3a8081b4] {
2371
2371
  position: absolute;
2372
2372
  min-width: 100%;
2373
2373
  min-height: 100%;
@@ -2378,13 +2378,13 @@ img[data-v-c95b2073] {
2378
2378
  /* SD-3497: PDF whiteboard overlay sits above the rendered PDF canvas but below
2379
2379
  the PDF comment anchors (z-index 6 in PdfCommentsLayer) so anchors stay
2380
2380
  clickable, and below the selection layer (z-index 10). */
2381
- .superdoc__whiteboard-layer[data-v-99399849] {
2381
+ .superdoc__whiteboard-layer[data-v-3a8081b4] {
2382
2382
  z-index: 4;
2383
2383
  }
2384
- .superdoc__temp-selection[data-v-99399849] {
2384
+ .superdoc__temp-selection[data-v-3a8081b4] {
2385
2385
  position: absolute;
2386
2386
  }
2387
- .superdoc__right-sidebar[data-v-99399849] {
2387
+ .superdoc__right-sidebar[data-v-3a8081b4] {
2388
2388
  width: 320px;
2389
2389
  min-width: 320px;
2390
2390
  padding: 0 10px;
@@ -2392,7 +2392,7 @@ img[data-v-c95b2073] {
2392
2392
  position: relative;
2393
2393
  z-index: 2;
2394
2394
  }
2395
- .superdoc__compact-comment-popover[data-v-99399849] {
2395
+ .superdoc__compact-comment-popover[data-v-3a8081b4] {
2396
2396
  position: absolute;
2397
2397
  top: 12px;
2398
2398
  right: 12px;
@@ -2401,14 +2401,14 @@ img[data-v-c95b2073] {
2401
2401
  }
2402
2402
 
2403
2403
  /* Tools styles */
2404
- .tools[data-v-99399849] {
2404
+ .tools[data-v-3a8081b4] {
2405
2405
  position: absolute;
2406
2406
  z-index: 3;
2407
2407
  display: flex;
2408
2408
  flex-direction: column;
2409
2409
  gap: var(--sd-ui-tools-gap, 6px);
2410
2410
  }
2411
- .tools-item[data-v-99399849] {
2411
+ .tools-item[data-v-3a8081b4] {
2412
2412
  display: flex;
2413
2413
  align-items: center;
2414
2414
  justify-content: center;
@@ -2419,10 +2419,10 @@ img[data-v-c95b2073] {
2419
2419
  cursor: pointer;
2420
2420
  position: relative;
2421
2421
  }
2422
- .tools-item i[data-v-99399849] {
2422
+ .tools-item i[data-v-3a8081b4] {
2423
2423
  cursor: pointer;
2424
2424
  }
2425
- .superdoc__tools-icon[data-v-99399849] {
2425
+ .superdoc__tools-icon[data-v-3a8081b4] {
2426
2426
  width: var(--sd-ui-tools-icon-size, 20px);
2427
2427
  height: var(--sd-ui-tools-icon-size, 20px);
2428
2428
  flex-shrink: 0;
@@ -2437,22 +2437,22 @@ img[data-v-c95b2073] {
2437
2437
 
2438
2438
  /* 834px is iPad screen size in portrait orientation */
2439
2439
  @media (max-width: 834px) {
2440
- .superdoc .superdoc__layers[data-v-99399849] {
2440
+ .superdoc .superdoc__layers[data-v-3a8081b4] {
2441
2441
  margin: 0;
2442
2442
  border: 0 !important;
2443
2443
  box-shadow: none;
2444
2444
  }
2445
- .superdoc__sub-document[data-v-99399849] {
2445
+ .superdoc__sub-document[data-v-3a8081b4] {
2446
2446
  max-width: 100%;
2447
2447
  }
2448
- .superdoc__right-sidebar[data-v-99399849] {
2448
+ .superdoc__right-sidebar[data-v-3a8081b4] {
2449
2449
  padding: 10px;
2450
2450
  position: relative;
2451
2451
  }
2452
2452
  }
2453
2453
 
2454
2454
  /* AI Writer styles */
2455
- .ai-writer-container[data-v-99399849] {
2455
+ .ai-writer-container[data-v-3a8081b4] {
2456
2456
  position: fixed;
2457
2457
  z-index: 1000;
2458
2458
  background: white;
@@ -2468,10 +2468,10 @@ img[data-v-c95b2073] {
2468
2468
  transform: translateY(-50%);
2469
2469
  z-index: 50;
2470
2470
  } */
2471
- .ai-tool > svg[data-v-99399849] {
2471
+ .ai-tool > svg[data-v-3a8081b4] {
2472
2472
  fill: transparent;
2473
2473
  }
2474
- .ai-tool[data-v-99399849]::before {
2474
+ .ai-tool[data-v-3a8081b4]::before {
2475
2475
  content: '';
2476
2476
  position: absolute;
2477
2477
  width: 20px;
@@ -2492,7 +2492,7 @@ img[data-v-c95b2073] {
2492
2492
  filter: brightness(1.2);
2493
2493
  transition: filter 0.2s ease;
2494
2494
  }
2495
- .ai-tool[data-v-99399849]:hover::before {
2495
+ .ai-tool[data-v-3a8081b4]:hover::before {
2496
2496
  filter: brightness(1.3);
2497
2497
  }
2498
2498
 
@@ -2340,34 +2340,34 @@ img[data-v-c95b2073] {
2340
2340
  pointer-events: auto;
2341
2341
  }
2342
2342
 
2343
- .superdoc[data-v-99399849] {
2343
+ .superdoc[data-v-3a8081b4] {
2344
2344
  display: flex;
2345
2345
  position: relative;
2346
2346
  }
2347
- .right-sidebar[data-v-99399849] {
2347
+ .right-sidebar[data-v-3a8081b4] {
2348
2348
  min-width: 320px;
2349
2349
  height: 100%;
2350
2350
  }
2351
- .floating-comments[data-v-99399849] {
2351
+ .floating-comments[data-v-3a8081b4] {
2352
2352
  min-width: 300px;
2353
2353
  width: 300px;
2354
2354
  height: 100%;
2355
2355
  overflow: visible;
2356
2356
  }
2357
- .superdoc__layers[data-v-99399849] {
2357
+ .superdoc__layers[data-v-3a8081b4] {
2358
2358
  height: 100%;
2359
2359
  position: relative;
2360
2360
  box-sizing: border-box;
2361
2361
  }
2362
- .superdoc__document[data-v-99399849] {
2362
+ .superdoc__document[data-v-3a8081b4] {
2363
2363
  width: 100%;
2364
2364
  position: relative;
2365
2365
  }
2366
- .superdoc__sub-document[data-v-99399849] {
2366
+ .superdoc__sub-document[data-v-3a8081b4] {
2367
2367
  width: 100%;
2368
2368
  position: relative;
2369
2369
  }
2370
- .superdoc__selection-layer[data-v-99399849] {
2370
+ .superdoc__selection-layer[data-v-3a8081b4] {
2371
2371
  position: absolute;
2372
2372
  min-width: 100%;
2373
2373
  min-height: 100%;
@@ -2378,13 +2378,13 @@ img[data-v-c95b2073] {
2378
2378
  /* SD-3497: PDF whiteboard overlay sits above the rendered PDF canvas but below
2379
2379
  the PDF comment anchors (z-index 6 in PdfCommentsLayer) so anchors stay
2380
2380
  clickable, and below the selection layer (z-index 10). */
2381
- .superdoc__whiteboard-layer[data-v-99399849] {
2381
+ .superdoc__whiteboard-layer[data-v-3a8081b4] {
2382
2382
  z-index: 4;
2383
2383
  }
2384
- .superdoc__temp-selection[data-v-99399849] {
2384
+ .superdoc__temp-selection[data-v-3a8081b4] {
2385
2385
  position: absolute;
2386
2386
  }
2387
- .superdoc__right-sidebar[data-v-99399849] {
2387
+ .superdoc__right-sidebar[data-v-3a8081b4] {
2388
2388
  width: 320px;
2389
2389
  min-width: 320px;
2390
2390
  padding: 0 10px;
@@ -2392,7 +2392,7 @@ img[data-v-c95b2073] {
2392
2392
  position: relative;
2393
2393
  z-index: 2;
2394
2394
  }
2395
- .superdoc__compact-comment-popover[data-v-99399849] {
2395
+ .superdoc__compact-comment-popover[data-v-3a8081b4] {
2396
2396
  position: absolute;
2397
2397
  top: 12px;
2398
2398
  right: 12px;
@@ -2401,14 +2401,14 @@ img[data-v-c95b2073] {
2401
2401
  }
2402
2402
 
2403
2403
  /* Tools styles */
2404
- .tools[data-v-99399849] {
2404
+ .tools[data-v-3a8081b4] {
2405
2405
  position: absolute;
2406
2406
  z-index: 3;
2407
2407
  display: flex;
2408
2408
  flex-direction: column;
2409
2409
  gap: var(--sd-ui-tools-gap, 6px);
2410
2410
  }
2411
- .tools-item[data-v-99399849] {
2411
+ .tools-item[data-v-3a8081b4] {
2412
2412
  display: flex;
2413
2413
  align-items: center;
2414
2414
  justify-content: center;
@@ -2419,10 +2419,10 @@ img[data-v-c95b2073] {
2419
2419
  cursor: pointer;
2420
2420
  position: relative;
2421
2421
  }
2422
- .tools-item i[data-v-99399849] {
2422
+ .tools-item i[data-v-3a8081b4] {
2423
2423
  cursor: pointer;
2424
2424
  }
2425
- .superdoc__tools-icon[data-v-99399849] {
2425
+ .superdoc__tools-icon[data-v-3a8081b4] {
2426
2426
  width: var(--sd-ui-tools-icon-size, 20px);
2427
2427
  height: var(--sd-ui-tools-icon-size, 20px);
2428
2428
  flex-shrink: 0;
@@ -2437,22 +2437,22 @@ img[data-v-c95b2073] {
2437
2437
 
2438
2438
  /* 834px is iPad screen size in portrait orientation */
2439
2439
  @media (max-width: 834px) {
2440
- .superdoc .superdoc__layers[data-v-99399849] {
2440
+ .superdoc .superdoc__layers[data-v-3a8081b4] {
2441
2441
  margin: 0;
2442
2442
  border: 0 !important;
2443
2443
  box-shadow: none;
2444
2444
  }
2445
- .superdoc__sub-document[data-v-99399849] {
2445
+ .superdoc__sub-document[data-v-3a8081b4] {
2446
2446
  max-width: 100%;
2447
2447
  }
2448
- .superdoc__right-sidebar[data-v-99399849] {
2448
+ .superdoc__right-sidebar[data-v-3a8081b4] {
2449
2449
  padding: 10px;
2450
2450
  position: relative;
2451
2451
  }
2452
2452
  }
2453
2453
 
2454
2454
  /* AI Writer styles */
2455
- .ai-writer-container[data-v-99399849] {
2455
+ .ai-writer-container[data-v-3a8081b4] {
2456
2456
  position: fixed;
2457
2457
  z-index: 1000;
2458
2458
  background: white;
@@ -2468,10 +2468,10 @@ img[data-v-c95b2073] {
2468
2468
  transform: translateY(-50%);
2469
2469
  z-index: 50;
2470
2470
  } */
2471
- .ai-tool > svg[data-v-99399849] {
2471
+ .ai-tool > svg[data-v-3a8081b4] {
2472
2472
  fill: transparent;
2473
2473
  }
2474
- .ai-tool[data-v-99399849]::before {
2474
+ .ai-tool[data-v-3a8081b4]::before {
2475
2475
  content: '';
2476
2476
  position: absolute;
2477
2477
  width: 20px;
@@ -2492,7 +2492,7 @@ img[data-v-c95b2073] {
2492
2492
  filter: brightness(1.2);
2493
2493
  transition: filter 0.2s ease;
2494
2494
  }
2495
- .ai-tool[data-v-99399849]:hover::before {
2495
+ .ai-tool[data-v-3a8081b4]:hover::before {
2496
2496
  filter: brightness(1.3);
2497
2497
  }
2498
2498
 
@@ -10,6 +10,7 @@ export const PERMISSIONS: Readonly<{
10
10
  UPLOAD_VERSION: "UPLOAD_VERSION";
11
11
  VERSION_HISTORY: "VERSION_HISTORY";
12
12
  }>;
13
+ export function createTrackedChangePermissionResolver(superdoc: any): (payload?: {}) => any;
13
14
  export function isAllowed(permission: string, role: string, isInternal: boolean, context?: {
14
15
  comment?: object | null | undefined;
15
16
  superdoc?: object | null | undefined;
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./chunks/rolldown-runtime-74VwNCz7.cjs");
3
3
  const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
4
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-MSiU8Kg0.cjs");
4
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-CbiiPcgr.cjs");
5
5
  const require_eventemitter3 = require("./chunks/eventemitter3-C_TAnXOl.cjs");
6
6
  const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
7
7
  const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-CYxINHh_.cjs");
@@ -299,24 +299,12 @@ var awarenessStatesToArray = (context, states) => {
299
299
  };
300
300
  });
301
301
  };
302
- /**
303
- * Shuffle an array of hex colors
304
- * @param array - List of hex colors
305
- * @returns Shuffled array of hex colors
306
- */
307
- var shuffleArray = (array) => {
308
- for (let i = array.length - 1; i > 0; i--) {
309
- const j = Math.floor(Math.random() * (i + 1));
310
- [array[i], array[j]] = [array[j], array[i]];
311
- }
312
- return array;
313
- };
314
302
  //#endregion
315
303
  //#region ../../shared/common/Telemetry.ts
316
304
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
317
305
  function getSuperdocVersion() {
318
306
  try {
319
- return "2.23.0-next.1";
307
+ return "2.23.0-next.2";
320
308
  } catch {
321
309
  return "unknown";
322
310
  }
@@ -7946,6 +7934,14 @@ var useCommentsStore = defineStore("comments", () => {
7946
7934
  if (!normalizedId) return null;
7947
7935
  return normalizedId.startsWith("imported:") ? normalizedId : `imported:${normalizedId}`;
7948
7936
  };
7937
+ const positionEntriesByAlias = require__plugin_vue_export_helper.computed(() => {
7938
+ const aliases = /* @__PURE__ */ new Map();
7939
+ for (const [key, entry] of Object.entries(editorCommentPositions.value || {})) for (const alias of [normalizeCommentId(entry?.key), normalizeCommentId(entry?.threadId)]) if (alias && !aliases.has(alias)) aliases.set(alias, {
7940
+ key,
7941
+ entry
7942
+ });
7943
+ return aliases;
7944
+ });
7949
7945
  const getPositionEntryByAlias = (id) => {
7950
7946
  const normalizedId = normalizeCommentId(id);
7951
7947
  if (!normalizedId) return {
@@ -7957,15 +7953,7 @@ var useCommentsStore = defineStore("comments", () => {
7957
7953
  key: normalizedId,
7958
7954
  entry: positions[normalizedId]
7959
7955
  };
7960
- for (const [key, entry] of Object.entries(positions)) {
7961
- const entryKey = normalizeCommentId(entry?.key);
7962
- const threadId = normalizeCommentId(entry?.threadId);
7963
- if (entryKey === normalizedId || threadId === normalizedId) return {
7964
- key,
7965
- entry
7966
- };
7967
- }
7968
- return {
7956
+ return positionEntriesByAlias.value.get(normalizedId) ?? {
7969
7957
  key: null,
7970
7958
  entry: null
7971
7959
  };
@@ -8014,6 +8002,41 @@ var useCommentsStore = defineStore("comments", () => {
8014
8002
  });
8015
8003
  return matches.length === 1 ? matches[0] : null;
8016
8004
  };
8005
+ const commentIdentityIndex = require__plugin_vue_export_helper.computed(() => {
8006
+ const list = commentsList.value;
8007
+ if (!require__plugin_vue_export_helper.isReactive(list)) return null;
8008
+ const primary = /* @__PURE__ */ new Map();
8009
+ const aliases = /* @__PURE__ */ new Map();
8010
+ for (const comment of list) {
8011
+ if (!require__plugin_vue_export_helper.isReactive(comment)) return null;
8012
+ for (const key of [
8013
+ "commentId",
8014
+ "importedId",
8015
+ "trackedChangeAnchorKey",
8016
+ "trackedChange"
8017
+ ]) {
8018
+ const descriptor = Object.getOwnPropertyDescriptor(comment, key);
8019
+ if (descriptor?.get || descriptor?.set || !descriptor && key in comment) return null;
8020
+ }
8021
+ const ids = [
8022
+ comment.commentId,
8023
+ comment.importedId,
8024
+ comment.trackedChangeAnchorKey
8025
+ ];
8026
+ if (ids.some((id) => id != null && typeof id !== "string")) return null;
8027
+ if (ids[0] != null && !primary.has(ids[0])) primary.set(ids[0], comment);
8028
+ const importedPositionId = comment.trackedChange ? buildTrackedChangeImportedPositionId(ids[1]) : null;
8029
+ for (const alias of [
8030
+ ids[1],
8031
+ ids[2],
8032
+ importedPositionId
8033
+ ]) if (alias != null && !aliases.has(alias)) aliases.set(alias, comment);
8034
+ }
8035
+ return {
8036
+ primary,
8037
+ aliases
8038
+ };
8039
+ });
8017
8040
  /**
8018
8041
  * Get a comment by either ID or imported ID
8019
8042
  *
@@ -8025,7 +8048,8 @@ var useCommentsStore = defineStore("comments", () => {
8025
8048
  const byPrimaryId = (c) => c.commentId == id;
8026
8049
  const byAliasId = (c) => c.importedId == id || c.trackedChangeAnchorKey == id || c?.trackedChange && buildTrackedChangeImportedPositionId(c.importedId) == id;
8027
8050
  const findIn = (list) => list.find(byPrimaryId) ?? list.find(byAliasId);
8028
- return findIn(commentsList.value) ?? findIn(reviewDirectoryList.value) ?? getTrackedChangeCommentByPositionAlias(id);
8051
+ const index = typeof id === "string" ? commentIdentityIndex.value : null;
8052
+ return (index ? index.primary.get(id) ?? index.aliases.get(id) : findIn(commentsList.value)) ?? findIn(reviewDirectoryList.value) ?? getTrackedChangeCommentByPositionAlias(id);
8029
8053
  };
8030
8054
  const getThreadParent = (comment) => {
8031
8055
  if (!comment?.parentCommentId) return comment;
@@ -12525,6 +12549,19 @@ var pickResolver = (context = {}) => {
12525
12549
  if (typeof deprecatedResolver === "function") return deprecatedResolver;
12526
12550
  return null;
12527
12551
  };
12552
+ var BUILT_IN_PERMISSION_METHOD = Symbol.for("superdoc.internal.permission-method.builtin");
12553
+ var BUILT_IN_PERMISSION_RESOLVER = Symbol.for("superdoc.internal.permission-resolver.builtin");
12554
+ /** Create the shell's internal, live tracked-change permission shim. */
12555
+ var createTrackedChangePermissionResolver = (superdoc) => {
12556
+ const isBuiltInPolicy = () => superdoc.canPerformPermission?.[BUILT_IN_PERMISSION_METHOD] === true && pickResolver({ superdoc }) === null;
12557
+ const resolver = (payload = {}) => isBuiltInPolicy() ? defaultDecisionFor(payload.permission, superdoc.config.role, superdoc.config.isInternal) : superdoc.canPerformPermission({
12558
+ ...payload,
12559
+ role: superdoc.config.role,
12560
+ isInternal: superdoc.config.isInternal
12561
+ });
12562
+ Object.defineProperty(resolver, BUILT_IN_PERMISSION_RESOLVER, { value: isBuiltInPolicy });
12563
+ return resolver;
12564
+ };
12528
12565
  var defaultDecisionFor = (permission, role, isInternal) => {
12529
12566
  const internalExternal = isInternal ? "internal" : "external";
12530
12567
  return PERMISSION_MATRIX[permission]?.[internalExternal]?.includes(role) ?? false;
@@ -23523,11 +23560,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
23523
23560
  contentControlsChrome: proxy.$superdoc.uiConfig.contentControls.options.chrome,
23524
23561
  resolveTrackedChangeColor: composeAuthorColorResolver(proxy.$superdoc.config.modules?.trackChanges?.authorColors)
23525
23562
  } : void 0,
23526
- permissionResolver: (payload = {}) => proxy.$superdoc.canPerformPermission({
23527
- role: proxy.$superdoc.config.role,
23528
- isInternal: proxy.$superdoc.config.isInternal,
23529
- ...payload
23530
- })
23563
+ permissionResolver: createTrackedChangePermissionResolver(proxy.$superdoc)
23531
23564
  };
23532
23565
  };
23533
23566
  const REPLAY_MUTABLE_COMMENT_FIELDS = /* @__PURE__ */ new Set([
@@ -24570,7 +24603,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
24570
24603
  ], 38);
24571
24604
  };
24572
24605
  }
24573
- }, [["__scopeId", "data-v-99399849"]]);
24606
+ }, [["__scopeId", "data-v-3a8081b4"]]);
24574
24607
  //#endregion
24575
24608
  //#region src/core/create-app.js
24576
24609
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
@@ -46384,13 +46417,13 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46384
46417
  commentsBlock.allowResolve = this.#interactionConfig.comments.allowResolve;
46385
46418
  }
46386
46419
  }
46387
- this.config.colors = shuffleArray(this.config.colors);
46388
46420
  this.userColorMap = /* @__PURE__ */ new Map();
46389
46421
  this.colorIndex = 0;
46390
- this.version = "2.23.0-next.1";
46422
+ this.version = "2.23.0-next.2";
46391
46423
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46392
46424
  this.superdocId = config.superdocId || require_uuid.v4();
46393
46425
  this.colors = this.config.colors ?? [];
46426
+ this.#assignUserColor();
46394
46427
  this.#initDocuments();
46395
46428
  await loadDefaultV2IntegrationOrFallback();
46396
46429
  if (this.#destroyed) return;
@@ -48799,6 +48832,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
48799
48832
  this.highContrastModeStore?.setHighContrastMode(isHighContrast);
48800
48833
  }
48801
48834
  };
48835
+ Object.defineProperty(SuperDoc.prototype.canPerformPermission, Symbol.for("superdoc.internal.permission-method.builtin"), { value: true });
48802
48836
  //#endregion
48803
48837
  //#region src/core/theme/create-theme.ts
48804
48838
  var COLORS_TO_VARS = {