@bendyline/docblocks-react 2.7.5 → 2.7.7

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 (29) hide show
  1. package/THIRD_PARTY_NOTICES.txt +26 -26
  2. package/dist/{AiDiagrams-5P657GFC.js → AiDiagrams-7KBAOXPB.js} +4 -2
  3. package/dist/{AiEditorAssistant-V4MZRC6Q.js → AiEditorAssistant-4B2PFFOT.js} +128 -12
  4. package/dist/{AiStudyDialog-GSCFTG3G.js → AiStudyDialog-JPVFFZBB.js} +14 -4
  5. package/dist/{AudioExportDialog-IOYIEAER.js → AudioExportDialog-EICCBSSE.js} +1 -1
  6. package/dist/{ExportDialog-LGWBXIWN.js → ExportDialog-EYDGTJ3S.js} +1 -1
  7. package/dist/{ExportToolbarControls-HOV424TO.js → ExportToolbarControls-2XY2CKGH.js} +45 -4
  8. package/dist/{PresentationMaker-H5B44Q7P.js → PresentationMaker-VYQKNL3L.js} +2 -2
  9. package/dist/{SpeechToolbarControl-KNI2C4JJ.js → SpeechToolbarControl-E6OSJGHL.js} +217 -71
  10. package/dist/{TextFromNarration-EYOMW2IW.js → TextFromNarration-ME6FAYWO.js} +1 -1
  11. package/dist/{WorkspaceSearchPanel-J6BKEZQJ.js → WorkspaceSearchPanel-MEBBTK7F.js} +3 -3
  12. package/dist/{chunk-I44HKDQX.js → chunk-3TSJQESW.js} +16 -3
  13. package/dist/chunk-5OIHB3SR.js +1162 -0
  14. package/dist/chunk-6QHZNL6C.js +208 -0
  15. package/dist/{chunk-FBPCURCS.js → chunk-7HBKKXRV.js} +291 -82
  16. package/dist/{chunk-KBDZDFPU.js → chunk-BNKIPCXO.js} +4 -1
  17. package/dist/{chunk-2IYBBFQX.js → chunk-BZRYQENB.js} +59 -16
  18. package/dist/{chunk-GFK4TCKN.js → chunk-G63YXKBC.js} +8 -5
  19. package/dist/{chunk-DICE7VBJ.js → chunk-KHQ44ZFA.js} +16 -1
  20. package/dist/{chunk-CUCWCZRO.js → chunk-N7AKLJPY.js} +143 -98
  21. package/dist/{chunk-USKX66SA.js → chunk-T2PA7QEF.js} +1 -1
  22. package/dist/editor.js +2 -2
  23. package/dist/export/index.js +1 -1
  24. package/dist/index.js +232 -134
  25. package/dist/settings/index.js +2 -1
  26. package/package.json +8 -8
  27. package/src/styles/docblocks.css +547 -11
  28. package/dist/chunk-I4JURPYS.js +0 -812
  29. package/dist/{QuickOpenDialog-ENVFGIHS.js → QuickOpenDialog-3QEX7RZG.js} +3 -3
package/dist/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  ProgressivePlayer
3
- } from "./chunk-2IYBBFQX.js";
3
+ } from "./chunk-BZRYQENB.js";
4
+ import {
5
+ useConfirmDialog
6
+ } from "./chunk-KBUHWZCF.js";
4
7
  import {
5
8
  BackupIcon,
6
9
  FolderIcon,
@@ -14,13 +17,10 @@ import {
14
17
  SortByNameIcon,
15
18
  SplitViewIcon,
16
19
  WorkspaceIcon
17
- } from "./chunk-DICE7VBJ.js";
18
- import {
19
- useConfirmDialog
20
- } from "./chunk-KBUHWZCF.js";
20
+ } from "./chunk-KHQ44ZFA.js";
21
21
  import {
22
22
  createSpeechInputProvider
23
- } from "./chunk-KBDZDFPU.js";
23
+ } from "./chunk-BNKIPCXO.js";
24
24
  import {
25
25
  sharedDocumentFilename
26
26
  } from "./chunk-SPUPWCSI.js";
@@ -87,7 +87,8 @@ import {
87
87
  saveProofingPreferences,
88
88
  saveThemePreference,
89
89
  saveWriteCanvasPreferences
90
- } from "./chunk-FBPCURCS.js";
90
+ } from "./chunk-7HBKKXRV.js";
91
+ import "./chunk-TBLZBNQF.js";
91
92
  import {
92
93
  FindButton,
93
94
  focusFindInput,
@@ -100,17 +101,17 @@ import {
100
101
  matchShortcut,
101
102
  shortcutLabel
102
103
  } from "./chunk-ACQF63SB.js";
103
- import "./chunk-USKX66SA.js";
104
+ import "./chunk-T2PA7QEF.js";
104
105
  import {
105
106
  buildIssueReportUrl,
106
107
  displayBuildDate,
107
108
  localDateStamp,
108
109
  openExternalUrl
109
- } from "./chunk-CUCWCZRO.js";
110
+ } from "./chunk-N7AKLJPY.js";
110
111
  import "./chunk-K4I3NJFL.js";
111
112
  import {
112
113
  ExportDialog
113
- } from "./chunk-GFK4TCKN.js";
114
+ } from "./chunk-G63YXKBC.js";
114
115
  import "./chunk-H3BK5MK6.js";
115
116
  import {
116
117
  DEFAULT_OPTIONS,
@@ -125,8 +126,7 @@ import {
125
126
  import { useCallback as useCallback5, useEffect as useEffect5, useMemo, useRef as useRef5, useState as useState4 } from "react";
126
127
  import {
127
128
  isFileSystemMoveStateError,
128
- parseWorkspacePath as parseWorkspacePath4,
129
- tryParseWorkspacePath as tryParseWorkspacePath2
129
+ parseWorkspacePath as parseWorkspacePath4
130
130
  } from "@bendyline/docblocks/filesystem";
131
131
 
132
132
  // src/FileExplorer/useFileTree.ts
@@ -630,6 +630,54 @@ function useFileTree(provider, metadataRefreshKey, metadataRefreshPath) {
630
630
  };
631
631
  }
632
632
 
633
+ // src/FileExplorer/read-issue-text.ts
634
+ import { tryParseWorkspacePath } from "@bendyline/docblocks/filesystem";
635
+ function readIssueText(issue) {
636
+ const failingPath = tryParseWorkspacePath(issue.path);
637
+ if (failingPath && failingPath !== issue.directoryPath) {
638
+ return fileIssueText(issue, failingPath);
639
+ }
640
+ return issue.directoryPath === "" ? workspaceIssueText(issue) : folderIssueText(issue);
641
+ }
642
+ function fileIssueText(issue, path) {
643
+ switch (issue.code) {
644
+ case "not-found":
645
+ return `${path} can't be found.`;
646
+ case "permission-denied":
647
+ return `DocBlocks doesn't have permission to open ${path}.`;
648
+ default:
649
+ return `${path} couldn't be read.`;
650
+ }
651
+ }
652
+ function workspaceIssueText(issue) {
653
+ switch (issue.code) {
654
+ case "not-found":
655
+ return "This workspace's folder can't be found. It may have been moved or deleted.";
656
+ case "permission-denied":
657
+ return "DocBlocks doesn't have permission to open this workspace.";
658
+ case "quota-exceeded":
659
+ return "Your device is out of storage space.";
660
+ case "corrupt":
661
+ return "Some of this workspace's saved data couldn't be read.";
662
+ default:
663
+ return "Your documents couldn't be loaded.";
664
+ }
665
+ }
666
+ function folderIssueText(issue) {
667
+ switch (issue.code) {
668
+ case "not-found":
669
+ return "This folder can't be found.";
670
+ case "permission-denied":
671
+ return "DocBlocks doesn't have permission to open this folder.";
672
+ case "quota-exceeded":
673
+ return "Your device is out of storage space.";
674
+ case "corrupt":
675
+ return "Some of this folder's saved data couldn't be read.";
676
+ default:
677
+ return "This folder couldn't be opened.";
678
+ }
679
+ }
680
+
633
681
  // src/FileExplorer/FileTreeNode.tsx
634
682
  import { useCallback as useCallback3, useState as useState2, useRef as useRef3, useEffect as useEffect3, useLayoutEffect } from "react";
635
683
  import { createPortal } from "react-dom";
@@ -1362,7 +1410,7 @@ import { useCallback as useCallback4, useEffect as useEffect4, useId, useLayoutE
1362
1410
  import { createPortal as createPortal2 } from "react-dom";
1363
1411
 
1364
1412
  // src/DocBlocksShell/pinned-documents.ts
1365
- import { tryParseWorkspacePath } from "@bendyline/docblocks/filesystem";
1413
+ import { tryParseWorkspacePath as tryParseWorkspacePath2 } from "@bendyline/docblocks/filesystem";
1366
1414
  var PINNED_DOCUMENTS_STORAGE_KEY = "docblocks-pinned-documents-v1";
1367
1415
  var MAX_PINNED_DOCUMENTS = 100;
1368
1416
  var MAX_WORKSPACE_ID_LENGTH = 256;
@@ -1380,11 +1428,11 @@ function resolvePinnedDocumentStorage() {
1380
1428
  }
1381
1429
  }
1382
1430
  function pinnedDocumentKey(document2) {
1383
- const path = tryParseWorkspacePath(document2.path);
1431
+ const path = tryParseWorkspacePath2(document2.path);
1384
1432
  return `${document2.workspaceId}\0${path ?? document2.path}`;
1385
1433
  }
1386
1434
  function pinnedDocumentName(document2) {
1387
- const canonical = tryParseWorkspacePath(document2.path);
1435
+ const canonical = tryParseWorkspacePath2(document2.path);
1388
1436
  const path = canonical ?? document2.path;
1389
1437
  return path.slice(path.lastIndexOf("/") + 1);
1390
1438
  }
@@ -1401,7 +1449,7 @@ function parsePinnedDocument(value) {
1401
1449
  if (keys.some((key) => key !== "workspaceId" && key !== "workspaceName" && key !== "path") || typeof record.workspaceId !== "string" || record.workspaceId.length === 0 || record.workspaceId.length > MAX_WORKSPACE_ID_LENGTH || typeof record.workspaceName !== "string" || record.workspaceName.length === 0 || record.workspaceName.length > MAX_WORKSPACE_NAME_LENGTH || typeof record.path !== "string" || record.path.length === 0 || record.path.length > MAX_DOCUMENT_PATH_LENGTH) {
1402
1450
  return null;
1403
1451
  }
1404
- const path = tryParseWorkspacePath(record.path);
1452
+ const path = tryParseWorkspacePath2(record.path);
1405
1453
  if (!path) return null;
1406
1454
  return {
1407
1455
  workspaceId: record.workspaceId,
@@ -1453,8 +1501,8 @@ function removePinnedDocument(documents, target) {
1453
1501
  return documents.filter((document2) => pinnedDocumentKey(document2) !== key);
1454
1502
  }
1455
1503
  function relocatePinnedDocuments(documents, workspaceId, oldPath, newPath) {
1456
- const oldCanonical = tryParseWorkspacePath(oldPath);
1457
- const newCanonical = tryParseWorkspacePath(newPath);
1504
+ const oldCanonical = tryParseWorkspacePath2(oldPath);
1505
+ const newCanonical = tryParseWorkspacePath2(newPath);
1458
1506
  if (!oldCanonical || !newCanonical) return [...documents];
1459
1507
  return parsePinnedDocuments(
1460
1508
  documents.map((document2) => {
@@ -2428,8 +2476,11 @@ function isSupportedImportFile(file) {
2428
2476
  if (mimeType.startsWith("text/") || mimeType.startsWith("image/")) return true;
2429
2477
  return !extension && DIRECT_IMPORT_BASENAMES.has(file.name.toLowerCase());
2430
2478
  }
2479
+ function isEditorMediaMimeType(mimeType) {
2480
+ return /^(?:image|video|audio)\//i.test(mimeType);
2481
+ }
2431
2482
  function isEditorDocumentImportFile(file) {
2432
- if (file.type.toLowerCase().startsWith("image/")) return false;
2483
+ if (isEditorMediaMimeType(file.type)) return false;
2433
2484
  const extension = extensionOfFileName(file.name);
2434
2485
  if (DIRECT_IMPORT_IMAGE_EXTENSIONS.has(extension)) return false;
2435
2486
  return isSupportedImportFile(file);
@@ -2500,10 +2551,6 @@ var NEW_ITEM_HINT_ID = "db-new-item-hint";
2500
2551
  function normalisePath2(path) {
2501
2552
  return parseWorkspacePath4(path);
2502
2553
  }
2503
- function readIssueText(issue) {
2504
- const failingPath = tryParseWorkspacePath2(issue.path);
2505
- return failingPath && failingPath !== issue.directoryPath ? `${failingPath}: ${issue.message}` : issue.message;
2506
- }
2507
2554
  function hasEquivalentPath2(paths, path) {
2508
2555
  const canonical = normalisePath2(path);
2509
2556
  return paths.has(path) || paths.has(canonical) || canonical !== "" && paths.has(`/${canonical}`);
@@ -3762,7 +3809,7 @@ import {
3762
3809
  useCallback as useCallback19,
3763
3810
  useEffect as useEffect30,
3764
3811
  useLayoutEffect as useLayoutEffect4,
3765
- useRef as useRef20,
3812
+ useRef as useRef21,
3766
3813
  useMemo as useMemo6,
3767
3814
  lazy as lazy2,
3768
3815
  Suspense as Suspense2
@@ -3771,7 +3818,7 @@ import {
3771
3818
  DocumentVersionManager
3772
3819
  } from "@bendyline/squisq/versions";
3773
3820
  import {
3774
- FileSystemContentContainer as FileSystemContentContainer2,
3821
+ FileSystemContentContainer as FileSystemContentContainer3,
3775
3822
  createFileMediaProvider,
3776
3823
  decodeUtf8Text,
3777
3824
  FsError as FsError6,
@@ -3794,8 +3841,8 @@ import {
3794
3841
  getDocBlocksHost,
3795
3842
  getHostEnvironment as getHostEnvironment2,
3796
3843
  hasDocBlocksHost,
3797
- hostSupports as hostSupports2,
3798
- maybeGetDocBlocksHost as maybeGetDocBlocksHost4
3844
+ hostSupports as hostSupports3,
3845
+ maybeGetDocBlocksHost as maybeGetDocBlocksHost5
3799
3846
  } from "@bendyline/docblocks/host";
3800
3847
  import {
3801
3848
  parseSharedDocumentHash
@@ -3809,7 +3856,7 @@ import {
3809
3856
  saveWorkspace as saveWorkspace3,
3810
3857
  touchWorkspace as touchWorkspace2,
3811
3858
  registerTransientWorkspace,
3812
- getTransientWorkspace,
3859
+ getTransientWorkspace as getTransientWorkspace2,
3813
3860
  unregisterTransientWorkspace,
3814
3861
  appendWorkspaceBackup,
3815
3862
  finishWorkspaceBackup
@@ -5232,7 +5279,7 @@ function useDocumentSession(autoSaveDelayMs = 500) {
5232
5279
  import { lazy, Suspense } from "react";
5233
5280
  import { jsx as jsx13 } from "react/jsx-runtime";
5234
5281
  var ExportToolbarControlsImplementation = lazy(
5235
- () => import("./ExportToolbarControls-HOV424TO.js").then((module) => ({
5282
+ () => import("./ExportToolbarControls-2XY2CKGH.js").then((module) => ({
5236
5283
  default: module.ExportToolbarControls
5237
5284
  }))
5238
5285
  );
@@ -6810,10 +6857,14 @@ function useEdgeSwipe({
6810
6857
  }
6811
6858
 
6812
6859
  // src/DocBlocksShell/useEditorFileDrop.ts
6813
- import { useEffect as useEffect27, useState as useState21 } from "react";
6860
+ import { useEffect as useEffect27, useRef as useRef18, useState as useState21 } from "react";
6814
6861
  var INTERNAL_DRAG_TYPE2 = "application/x-docblocks-entry";
6815
6862
  function useEditorFileDrop(targetRef, enabled, onFiles) {
6816
6863
  const [dropActive, setDropActive] = useState21(false);
6864
+ const onFilesRef = useRef18(onFiles);
6865
+ useEffect27(() => {
6866
+ onFilesRef.current = onFiles;
6867
+ }, [onFiles]);
6817
6868
  useEffect27(() => {
6818
6869
  const element = targetRef.current;
6819
6870
  if (!enabled || !element) {
@@ -6828,7 +6879,7 @@ function useEditorFileDrop(targetRef, enabled, onFiles) {
6828
6879
  if (items.length === 0) return false;
6829
6880
  return items.some((item) => {
6830
6881
  const file = item.getAsFile();
6831
- return file ? isEditorDocumentImportFile(file) : !item.type.toLowerCase().startsWith("image/");
6882
+ return file ? isEditorDocumentImportFile(file) : !isEditorMediaMimeType(item.type);
6832
6883
  });
6833
6884
  };
6834
6885
  const onDragEnter = (event) => {
@@ -6858,7 +6909,7 @@ function useEditorFileDrop(targetRef, enabled, onFiles) {
6858
6909
  if (files.length === 0) return;
6859
6910
  event.preventDefault();
6860
6911
  event.stopPropagation();
6861
- onFiles(files);
6912
+ onFilesRef.current(files);
6862
6913
  };
6863
6914
  element.addEventListener("dragenter", onDragEnter, true);
6864
6915
  element.addEventListener("dragover", onDragOver, true);
@@ -6871,14 +6922,14 @@ function useEditorFileDrop(targetRef, enabled, onFiles) {
6871
6922
  element.removeEventListener("drop", onDrop, true);
6872
6923
  setDropActive(false);
6873
6924
  };
6874
- }, [targetRef, enabled, onFiles]);
6925
+ }, [targetRef, enabled]);
6875
6926
  return dropActive;
6876
6927
  }
6877
6928
 
6878
6929
  // src/DocBlocksShell/useShellShortcuts.ts
6879
- import { useEffect as useEffect28, useRef as useRef18 } from "react";
6930
+ import { useEffect as useEffect28, useRef as useRef19 } from "react";
6880
6931
  function useShellShortcuts(handlers, layoutMode) {
6881
- const handlersRef = useRef18(handlers);
6932
+ const handlersRef = useRef19(handlers);
6882
6933
  handlersRef.current = handlers;
6883
6934
  useEffect28(() => {
6884
6935
  if (typeof window === "undefined") return;
@@ -7115,7 +7166,7 @@ function useDocumentLinkProvider(index, selectedFile, ensureIndex) {
7115
7166
  }
7116
7167
 
7117
7168
  // src/WorkspaceIndex/useWorkspaceIndex.ts
7118
- import { useCallback as useCallback18, useEffect as useEffect29, useMemo as useMemo5, useRef as useRef19, useState as useState23, useSyncExternalStore as useSyncExternalStore4 } from "react";
7169
+ import { useCallback as useCallback18, useEffect as useEffect29, useMemo as useMemo5, useRef as useRef20, useState as useState23, useSyncExternalStore as useSyncExternalStore4 } from "react";
7119
7170
  import { getFileSystemProviderV2 as getFileSystemProviderV29 } from "@bendyline/docblocks/filesystem";
7120
7171
  import { maybeGetDocBlocksHost as maybeGetDocBlocksHost3 } from "@bendyline/docblocks/host";
7121
7172
  var IDLE_WORKSPACE_INDEX_STATUS = Object.freeze({
@@ -7148,7 +7199,7 @@ function whenIdle(callback) {
7148
7199
  function useWorkspaceIndex(provider, workspaceId, mode = "eager") {
7149
7200
  const providerV2 = provider && mode !== "off" ? getFileSystemProviderV29(provider) : null;
7150
7201
  const [index, setIndex] = useState23(null);
7151
- const startRequestedRef = useRef19(false);
7202
+ const startRequestedRef = useRef20(false);
7152
7203
  useEffect29(() => {
7153
7204
  setIndex(null);
7154
7205
  startRequestedRef.current = false;
@@ -7403,6 +7454,47 @@ async function copyTransientWorkspaceContents(source, destination) {
7403
7454
  }
7404
7455
  }
7405
7456
 
7457
+ // src/DocBlocksShell/document-relative-media.ts
7458
+ import {
7459
+ FileSystemContentContainer as FileSystemContentContainer2,
7460
+ isDocumentMediaPath,
7461
+ resolveDocumentRelativeMediaPath,
7462
+ tryParseWorkspacePath as tryParseWorkspacePath5
7463
+ } from "@bendyline/docblocks/filesystem";
7464
+ import { hostSupports as hostSupports2, maybeGetDocBlocksHost as maybeGetDocBlocksHost4 } from "@bendyline/docblocks/host";
7465
+ import { getTransientWorkspace } from "@bendyline/docblocks/workspace";
7466
+ function looseFileMediaReader(workspaceId) {
7467
+ const origin = getTransientWorkspace(workspaceId)?.descriptor.origin;
7468
+ if (origin?.kind !== "loose-file" || !hostSupports2("externalRelativeMedia")) return null;
7469
+ const external = maybeGetDocBlocksHost4()?.external;
7470
+ if (!external?.readRelativeMedia) return null;
7471
+ const { resourceId } = origin;
7472
+ return async (path) => await external.readRelativeMedia?.(resourceId, path) ?? null;
7473
+ }
7474
+ var LooseFileMediaContainer = class extends FileSystemContentContainer2 {
7475
+ constructor(provider, directory, readBeside) {
7476
+ super(provider, directory);
7477
+ this.directory = directory;
7478
+ this.readBeside = readBeside;
7479
+ }
7480
+ async readFile(path) {
7481
+ const data = await super.readFile(path);
7482
+ if (data) return data;
7483
+ const beside = tryParseWorkspacePath5(this.directory ? `${this.directory}/${path}` : path);
7484
+ if (!beside || !isDocumentMediaPath(beside)) return null;
7485
+ return this.readBeside(beside).catch(() => null);
7486
+ }
7487
+ };
7488
+ function createMediaContainer(provider, directory, readBesideLooseFile) {
7489
+ return readBesideLooseFile ? new LooseFileMediaContainer(provider, directory, readBesideLooseFile) : new FileSystemContentContainer2(provider, directory);
7490
+ }
7491
+ function createDocumentRelativeMediaReader(root, documentDirectory) {
7492
+ return async (ref) => {
7493
+ const path = resolveDocumentRelativeMediaPath(documentDirectory, ref);
7494
+ return path === null ? null : root.readFile(path);
7495
+ };
7496
+ }
7497
+
7406
7498
  // src/DocBlocksShell/native-file-actions.ts
7407
7499
  function createNativeFileActions(entry, workspaceId, host) {
7408
7500
  if (entry.kind !== "file" || workspaceId === null || host === null) return [];
@@ -7521,13 +7613,13 @@ var EditorShell = lazy2(loadEditorShell);
7521
7613
  var DocumentConflictDialog = lazy2(() => import("./DocumentConflictDialog-DZ2BV2IH.js"));
7522
7614
  var GitUI = lazy2(() => import("./GitUI-F3CNBURE.js").then((m) => ({ default: m.GitUI })));
7523
7615
  var QuickOpenDialog = lazy2(
7524
- () => import("./QuickOpenDialog-ENVFGIHS.js").then((m) => ({ default: m.QuickOpenDialog }))
7616
+ () => import("./QuickOpenDialog-3QEX7RZG.js").then((m) => ({ default: m.QuickOpenDialog }))
7525
7617
  );
7526
7618
  var KeyboardShortcutsDialog = lazy2(
7527
7619
  () => import("./KeyboardShortcutsDialog-HVKDFP5Z.js").then((m) => ({ default: m.KeyboardShortcutsDialog }))
7528
7620
  );
7529
7621
  var WorkspaceSearchPanel = lazy2(
7530
- () => import("./WorkspaceSearchPanel-J6BKEZQJ.js").then((m) => ({
7622
+ () => import("./WorkspaceSearchPanel-MEBBTK7F.js").then((m) => ({
7531
7623
  default: m.WorkspaceSearchPanel
7532
7624
  }))
7533
7625
  );
@@ -7538,37 +7630,37 @@ var GitToolbarControl = lazy2(
7538
7630
  () => import("./GitToolbarControl-B7KG4MFP.js").then((m) => ({ default: m.GitToolbarControl }))
7539
7631
  );
7540
7632
  var AiToolbarControl = lazy2(
7541
- () => import("./AiEditorAssistant-V4MZRC6Q.js").then((module) => ({
7633
+ () => import("./AiEditorAssistant-4B2PFFOT.js").then((module) => ({
7542
7634
  default: module.AiToolbarControl
7543
7635
  }))
7544
7636
  );
7545
7637
  var PresentationMaker = lazy2(
7546
- () => import("./PresentationMaker-H5B44Q7P.js").then((module) => ({
7638
+ () => import("./PresentationMaker-VYQKNL3L.js").then((module) => ({
7547
7639
  default: module.PresentationMaker
7548
7640
  }))
7549
7641
  );
7550
7642
  var AiReviewPanel = lazy2(
7551
- () => import("./AiEditorAssistant-V4MZRC6Q.js").then((module) => ({
7643
+ () => import("./AiEditorAssistant-4B2PFFOT.js").then((module) => ({
7552
7644
  default: module.AiReviewPanel
7553
7645
  }))
7554
7646
  );
7555
7647
  var AiIllustratePanel = lazy2(
7556
- () => import("./AiDiagrams-5P657GFC.js").then((module) => ({
7648
+ () => import("./AiDiagrams-7KBAOXPB.js").then((module) => ({
7557
7649
  default: module.AiIllustratePanel
7558
7650
  }))
7559
7651
  );
7560
7652
  var TextFromNarration = lazy2(
7561
- () => import("./TextFromNarration-EYOMW2IW.js").then((module) => ({
7653
+ () => import("./TextFromNarration-ME6FAYWO.js").then((module) => ({
7562
7654
  default: module.TextFromNarration
7563
7655
  }))
7564
7656
  );
7565
7657
  var SpeechToolbarControl = lazy2(
7566
- () => import("./SpeechToolbarControl-KNI2C4JJ.js").then((module) => ({
7658
+ () => import("./SpeechToolbarControl-E6OSJGHL.js").then((module) => ({
7567
7659
  default: module.SpeechToolbarControl
7568
7660
  }))
7569
7661
  );
7570
7662
  var SpeechMenuBridge = lazy2(
7571
- () => import("./SpeechToolbarControl-KNI2C4JJ.js").then((module) => ({
7663
+ () => import("./SpeechToolbarControl-E6OSJGHL.js").then((module) => ({
7572
7664
  default: module.SpeechMenuBridge
7573
7665
  }))
7574
7666
  );
@@ -7931,13 +8023,13 @@ function DocBlocksShell({
7931
8023
  [writeCanvasSettings]
7932
8024
  );
7933
8025
  const resolvedTheme = resolveShellTheme({ preference: themePreference, hostTheme, osTheme });
7934
- const ai = hostSupports2("aiAssist") ? maybeGetDocBlocksHost4()?.ai : void 0;
7935
- const speech = hostSupports2("speechModelManagement") ? maybeGetDocBlocksHost4()?.speech : void 0;
7936
- const trayMenu = hostSupports2("trayIcon") ? maybeGetDocBlocksHost4()?.menu : void 0;
8026
+ const ai = hostSupports3("aiAssist") ? maybeGetDocBlocksHost5()?.ai : void 0;
8027
+ const speech = hostSupports3("speechModelManagement") ? maybeGetDocBlocksHost5()?.speech : void 0;
8028
+ const trayMenu = hostSupports3("trayIcon") ? maybeGetDocBlocksHost5()?.menu : void 0;
7937
8029
  const [settingsRequest, setSettingsRequest] = useState24(0);
7938
8030
  const openSettings = useCallback19(() => setSettingsRequest((count) => count + 1), []);
7939
8031
  const speechInput = useMemo6(
7940
- () => speech && hostSupports2("speechInput") ? createSpeechInputProvider(speech, { onRequestSetup: openSettings }) : null,
8032
+ () => speech && hostSupports3("speechInput") ? createSpeechInputProvider(speech, { onRequestSetup: openSettings }) : null,
7941
8033
  [speech, openSettings]
7942
8034
  );
7943
8035
  const handleThemeChange = useCallback19((pref) => {
@@ -7945,7 +8037,7 @@ function DocBlocksShell({
7945
8037
  saveThemePreference(pref);
7946
8038
  }, []);
7947
8039
  useEffect30(() => {
7948
- if (hostSupports2("ownsWindowChrome") || typeof document === "undefined") return;
8040
+ if (hostSupports3("ownsWindowChrome") || typeof document === "undefined") return;
7949
8041
  const metas = document.querySelectorAll('meta[name="theme-color"]');
7950
8042
  metas.forEach((meta) => {
7951
8043
  meta.content = DB_CHROME_COLORS[resolvedTheme];
@@ -7969,7 +8061,7 @@ function DocBlocksShell({
7969
8061
  setViewPreferences(prefs);
7970
8062
  saveViewPreferences(prefs);
7971
8063
  }, []);
7972
- const shellRef = useRef20(null);
8064
+ const shellRef = useRef21(null);
7973
8065
  const formFactor = useFormFactor(shellRef);
7974
8066
  const [sidebarPreference, setSidebarPreference] = useState24(loadSidebarPreference);
7975
8067
  const layoutMode = resolveLayoutMode(formFactor, sidebarPreference);
@@ -7991,7 +8083,7 @@ function DocBlocksShell({
7991
8083
  const drawerOpen = singlePane && !mobileShowEditor;
7992
8084
  const [sidebarWidth, setSidebarWidth] = useState24(loadSidebarWidth);
7993
8085
  const canRestoreSplitView = sidebarPreference === "collapsed" && formFactor.splitPaneAllowed;
7994
- const editorAreaRef = useRef20(null);
8086
+ const editorAreaRef = useRef21(null);
7995
8087
  const [desktopToolbarWrapped, setDesktopToolbarWrapped] = useState24(false);
7996
8088
  useEffect30(() => {
7997
8089
  const editorArea = editorAreaRef.current;
@@ -7999,7 +8091,7 @@ function DocBlocksShell({
7999
8091
  setDesktopToolbarWrapped(false);
8000
8092
  return;
8001
8093
  }
8002
- const wrapWidth = hostSupports2("ownsWindowChrome") ? DESKTOP_TOOLBAR_WRAP_WIDTH : WEB_TOOLBAR_WRAP_WIDTH;
8094
+ const wrapWidth = hostSupports3("ownsWindowChrome") ? DESKTOP_TOOLBAR_WRAP_WIDTH : WEB_TOOLBAR_WRAP_WIDTH;
8003
8095
  const updateWrappedState = () => {
8004
8096
  setDesktopToolbarWrapped(editorArea.getBoundingClientRect().width <= wrapWidth);
8005
8097
  };
@@ -8012,7 +8104,7 @@ function DocBlocksShell({
8012
8104
  observer.observe(editorArea);
8013
8105
  return () => observer.disconnect();
8014
8106
  }, [singlePane]);
8015
- const showBrowserStorageWarning = hostSupports2("browserOriginStorage");
8107
+ const showBrowserStorageWarning = hostSupports3("browserOriginStorage");
8016
8108
  const hostEnvironment = getHostEnvironment2();
8017
8109
  const desktopApp = hostEnvironment?.surface === "electron";
8018
8110
  const appVersion = hostEnvironment ? `${hostEnvironment.appVersion} ${hostEnvironment.surfaceLabel}` : issueReportVersion ?? "web";
@@ -8023,7 +8115,7 @@ function DocBlocksShell({
8023
8115
  });
8024
8116
  const [browserStoragePersistent, setBrowserStoragePersistent] = useState24(false);
8025
8117
  const [saveToast, setSaveToast] = useState24(null);
8026
- const saveToastTimerRef = useRef20(null);
8118
+ const saveToastTimerRef = useRef21(null);
8027
8119
  const showToast = useCallback19((kind, message) => {
8028
8120
  setSaveToast({ kind, message });
8029
8121
  if (saveToastTimerRef.current) clearTimeout(saveToastTimerRef.current);
@@ -8044,8 +8136,8 @@ function DocBlocksShell({
8044
8136
  const [installPromptEvent, setInstallPromptEvent] = useState24(
8045
8137
  null
8046
8138
  );
8047
- const panesRef = useRef20(null);
8048
- const sidebarRef = useRef20(null);
8139
+ const panesRef = useRef21(null);
8140
+ const sidebarRef = useRef21(null);
8049
8141
  useInert(sidebarRef, singlePane && !drawerOpen);
8050
8142
  useInert(editorAreaRef, drawerOpen);
8051
8143
  const openDrawer = useCallback19(() => setMobileShowEditor(false), []);
@@ -8058,7 +8150,7 @@ function DocBlocksShell({
8058
8150
  onOpen: openDrawer,
8059
8151
  onClose: closeDrawer
8060
8152
  });
8061
- const dragStateRef = useRef20(null);
8153
+ const dragStateRef = useRef21(null);
8062
8154
  const handleResizerPointerDown = useCallback19(
8063
8155
  (e) => {
8064
8156
  if (e.button !== 0) return;
@@ -8122,7 +8214,7 @@ function DocBlocksShell({
8122
8214
  const rememberNewFileFormat = useCallback19(
8123
8215
  (format) => {
8124
8216
  setDefaultNewFileFormat(format);
8125
- if (activeWorkspaceId && getTransientWorkspace(activeWorkspaceId) === null) {
8217
+ if (activeWorkspaceId && getTransientWorkspace2(activeWorkspaceId) === null) {
8126
8218
  saveLastNewFileFormat(activeWorkspaceId, format);
8127
8219
  }
8128
8220
  },
@@ -8135,7 +8227,7 @@ function DocBlocksShell({
8135
8227
  );
8136
8228
  const effectiveProofingIgnoreStore = proofingIgnoreStore === void 0 ? defaultProofingIgnoreStore : proofingIgnoreStore;
8137
8229
  useEffect30(() => {
8138
- if (!provider || getTransientWorkspace(provider.id)) return;
8230
+ if (!provider || getTransientWorkspace2(provider.id)) return;
8139
8231
  const providerV2 = getFileSystemProviderV211(provider);
8140
8232
  return providerV2 ? retainFileSystemProvider(providerV2) : void 0;
8141
8233
  }, [provider]);
@@ -8159,8 +8251,8 @@ function DocBlocksShell({
8159
8251
  savePinnedDocuments(pinnedDocuments);
8160
8252
  }, [pinnedDocuments]);
8161
8253
  useEffect30(() => {
8162
- const menu = maybeGetDocBlocksHost4()?.menu;
8163
- if (!hostSupports2("pinnedDocumentMirror") || !menu) return;
8254
+ const menu = maybeGetDocBlocksHost5()?.menu;
8255
+ if (!hostSupports3("pinnedDocumentMirror") || !menu) return;
8164
8256
  menu.setPinnedDocuments(
8165
8257
  pinnedDocuments.map((document2) => ({
8166
8258
  workspaceId: document2.workspaceId,
@@ -8247,7 +8339,7 @@ function DocBlocksShell({
8247
8339
  return;
8248
8340
  }
8249
8341
  let cancelled = false;
8250
- const electron = hostSupports2("nativeWorkspaces");
8342
+ const electron = hostSupports3("nativeWorkspaces");
8251
8343
  void listWorkspaces2().then((workspaces) => {
8252
8344
  if (cancelled) return;
8253
8345
  setTransientMoveDestinations(
@@ -8263,19 +8355,19 @@ function DocBlocksShell({
8263
8355
  };
8264
8356
  }, [activeWorkspaceDescriptor]);
8265
8357
  const nativeWorkspaceId = provider && activeWorkspaceDescriptor?.id === activeWorkspaceId && provider.id === activeWorkspaceId && activeWorkspaceDescriptor.type === "host-native" ? activeWorkspaceDescriptor.id : null;
8266
- const workingTreeChangedRef = useRef20(() => void 0);
8358
+ const workingTreeChangedRef = useRef21(() => void 0);
8267
8359
  const handleWorkingTreeChanged = useCallback19(() => workingTreeChangedRef.current(), []);
8268
8360
  const git = useGit(provider, nativeWorkspaceId, resolvedTheme, handleWorkingTreeChanged);
8269
- const gitRef = useRef20(git);
8361
+ const gitRef = useRef21(git);
8270
8362
  gitRef.current = git;
8271
8363
  const { scheduleRefresh: gitScheduleRefresh } = git;
8272
- const workspaceSettingsEnabled = provider !== null && provider.id === activeWorkspaceId && getTransientWorkspace(provider.id) === null;
8364
+ const workspaceSettingsEnabled = provider !== null && provider.id === activeWorkspaceId && getTransientWorkspace2(provider.id) === null;
8273
8365
  const workspaceSettings = useWorkspaceSettings(provider, workspaceSettingsEnabled);
8274
8366
  const { refresh: refreshWorkspaceSettings, save: saveWorkspaceSettings } = workspaceSettings;
8275
8367
  const workspaceDefaultThemeId = resolveWorkspaceDefaultThemeId(workspaceSettings.settings);
8276
- const workspaceDefaultThemeRef = useRef20(workspaceDefaultThemeId);
8368
+ const workspaceDefaultThemeRef = useRef21(workspaceDefaultThemeId);
8277
8369
  workspaceDefaultThemeRef.current = workspaceDefaultThemeId;
8278
- const outsideInRenderRef = useRef20({
8370
+ const outsideInRenderRef = useRef21({
8279
8371
  defaultThemeId: () => workspaceDefaultThemeRef.current
8280
8372
  });
8281
8373
  const workspaceOutputs = useWorkspaceOutputs(
@@ -8284,10 +8376,10 @@ function DocBlocksShell({
8284
8376
  workspaceSettings.settings,
8285
8377
  workspaceSettingsEnabled
8286
8378
  );
8287
- const workspaceOutputsSchedulerRef = useRef20(workspaceOutputs.scheduler);
8379
+ const workspaceOutputsSchedulerRef = useRef21(workspaceOutputs.scheduler);
8288
8380
  workspaceOutputsSchedulerRef.current = workspaceOutputs.scheduler;
8289
8381
  const workspaceIndex = useWorkspaceIndex(provider, activeWorkspaceId, workspaceIndexMode);
8290
- const workspaceIndexRef = useRef20(workspaceIndex.index);
8382
+ const workspaceIndexRef = useRef21(workspaceIndex.index);
8291
8383
  workspaceIndexRef.current = workspaceIndex.index;
8292
8384
  const notifyWorkspaceChanged = useCallback19(
8293
8385
  (workspaceId, path) => {
@@ -8349,7 +8441,7 @@ function DocBlocksShell({
8349
8441
  const [selectedImage, setSelectedImage] = useState24(void 0);
8350
8442
  const [selectedManagedOutput, setSelectedManagedOutput] = useState24(void 0);
8351
8443
  const [findMode, setFindMode] = useState24(false);
8352
- const findModeRef = useRef20(findMode);
8444
+ const findModeRef = useRef21(findMode);
8353
8445
  findModeRef.current = findMode;
8354
8446
  useEffect30(() => {
8355
8447
  setFindMode(false);
@@ -8372,7 +8464,7 @@ function DocBlocksShell({
8372
8464
  const [searchFocusRequest, setSearchFocusRequest] = useState24(0);
8373
8465
  useEffect30(() => {
8374
8466
  if (!activeWorkspaceId || !selectedFile) return;
8375
- if (getTransientWorkspace(activeWorkspaceId) === null) {
8467
+ if (getTransientWorkspace2(activeWorkspaceId) === null) {
8376
8468
  recordRecentDocument(activeWorkspaceId, selectedFile);
8377
8469
  }
8378
8470
  workspaceIndex.index?.prioritize([selectedFile]);
@@ -8421,8 +8513,8 @@ function DocBlocksShell({
8421
8513
  useDocumentTitle(selectedFile, homeDocumentTitle, homeDocumentPath);
8422
8514
  const exportDestinationAdapter = useMemo6(() => {
8423
8515
  if (!selectedFile) return void 0;
8424
- const exports = maybeGetDocBlocksHost4()?.exports;
8425
- if (hostSupports2("exportRememberedTargets") && exports?.resolveTarget && exports.pickTarget) {
8516
+ const exports = maybeGetDocBlocksHost5()?.exports;
8517
+ if (hostSupports3("exportRememberedTargets") && exports?.resolveTarget && exports.pickTarget) {
8426
8518
  if (activeWorkspaceId) {
8427
8519
  const documentId = JSON.stringify([activeWorkspaceId, selectedFile]);
8428
8520
  const resolveTarget = exports.resolveTarget.bind(exports);
@@ -8431,7 +8523,7 @@ function DocBlocksShell({
8431
8523
  resolveTarget: (filename) => resolveTarget(documentId, filename),
8432
8524
  pickTarget: (filename, currentTarget) => pickTarget(documentId, filename, currentTarget?.grantId ?? null),
8433
8525
  saveBlob: (blob, filename, target) => saveBlobToHost(exports, documentId, blob, filename, target?.grantId ?? null),
8434
- ...hostSupports2("openSavedExports") && exports.openSaved ? {
8526
+ ...hostSupports3("openSavedExports") && exports.openSaved ? {
8435
8527
  openSaved: async (target) => {
8436
8528
  if (!target.grantId) throw new Error("The saved export has no native target.");
8437
8529
  await exports.openSaved(documentId, target.grantId);
@@ -8440,7 +8532,7 @@ function DocBlocksShell({
8440
8532
  };
8441
8533
  }
8442
8534
  }
8443
- if (hostSupports2("exportDestinations") && exports && activeWorkspaceId) {
8535
+ if (hostSupports3("exportDestinations") && exports && activeWorkspaceId) {
8444
8536
  const documentId = JSON.stringify([activeWorkspaceId, selectedFile]);
8445
8537
  return {
8446
8538
  showDestination: false,
@@ -8455,7 +8547,7 @@ function DocBlocksShell({
8455
8547
  return createBrowserSaveAsAdapter();
8456
8548
  }, [activeWorkspaceId, selectedFile]);
8457
8549
  const saveRenderedImageOutput = useMemo6(
8458
- () => hostSupports2("exportDestinations") && exportDestinationAdapter ? createImageSaveOutput(exportDestinationAdapter) : void 0,
8550
+ () => hostSupports3("exportDestinations") && exportDestinationAdapter ? createImageSaveOutput(exportDestinationAdapter) : void 0,
8459
8551
  [exportDestinationAdapter]
8460
8552
  );
8461
8553
  const [selectedFolder, setSelectedFolder] = useState24(null);
@@ -8507,7 +8599,7 @@ function DocBlocksShell({
8507
8599
  const [initialSharedMode, setInitialSharedMode] = useState24(null);
8508
8600
  const [showWelcomeGateway, setShowWelcomeGateway] = useState24(false);
8509
8601
  const welcomeScreenShown = showWelcomeGateway && !singlePane;
8510
- const welcomeCoveredRef = useRef20(null);
8602
+ const welcomeCoveredRef = useRef21(null);
8511
8603
  useInert(welcomeCoveredRef, welcomeScreenShown);
8512
8604
  const closeWelcomeGateway = useCallback19(() => {
8513
8605
  setShowWelcomeGateway((showing) => {
@@ -8516,10 +8608,10 @@ function DocBlocksShell({
8516
8608
  });
8517
8609
  }, []);
8518
8610
  const [aiPanel, setAiPanel] = useState24(null);
8519
- const navigationRequestRef = useRef20(0);
8611
+ const navigationRequestRef = useRef21(0);
8520
8612
  const workspaceAuthorityBarrier = useMemo6(() => new WorkspaceAuthorityBarrier(), []);
8521
- const preparedCloseRequestRef = useRef20(null);
8522
- const pendingDbkConflictsRef = useRef20(/* @__PURE__ */ new Map());
8613
+ const preparedCloseRequestRef = useRef21(null);
8614
+ const pendingDbkConflictsRef = useRef21(/* @__PURE__ */ new Map());
8523
8615
  const afterWorkspaceCommit = useCallback19(
8524
8616
  (workspaceId, path) => {
8525
8617
  gitScheduleRefresh();
@@ -8537,11 +8629,11 @@ function DocBlocksShell({
8537
8629
  outsideInRenderRef.current
8538
8630
  );
8539
8631
  }
8540
- const transient = getTransientWorkspace(workspaceId);
8632
+ const transient = getTransientWorkspace2(workspaceId);
8541
8633
  const baseTarget = createFileSystemDocumentTarget2(fsProvider, filePath);
8542
8634
  const originKind = transient?.descriptor.origin?.kind;
8543
8635
  const needsExternalResources = originKind === "loose-file" || originKind === "dbk";
8544
- if (!transient?.descriptor.origin || needsExternalResources && !hostSupports2("externalResources")) {
8636
+ if (!transient?.descriptor.origin || needsExternalResources && !hostSupports3("externalResources")) {
8545
8637
  return {
8546
8638
  key: baseTarget.key,
8547
8639
  async commit(request) {
@@ -8703,12 +8795,12 @@ function DocBlocksShell({
8703
8795
  },
8704
8796
  [afterWorkspaceCommit, gitScheduleRefresh]
8705
8797
  );
8706
- const mediaContainerRef = useRef20(null);
8798
+ const mediaContainerRef = useRef21(null);
8707
8799
  const [mediaProvider, setMediaProvider] = useState24(null);
8708
8800
  const [mediaProviderScope, setMediaProviderScope] = useState24(null);
8709
8801
  const mediaProviderCurrent = mediaProviderScope !== null && mediaProviderScope.provider === provider && mediaProviderScope.file === selectedFile && mediaProviderScope.outsideIn === selectedOutsideIn;
8710
8802
  const [mediaEpoch, setMediaEpoch] = useState24(0);
8711
- const versionsContainerRef = useRef20(null);
8803
+ const versionsContainerRef = useRef21(null);
8712
8804
  const [versionsContainer, setVersionsContainer] = useState24(null);
8713
8805
  const pushHash = useCallback19((wsId, filePath) => {
8714
8806
  const hash = buildHash(wsId, filePath);
@@ -8720,7 +8812,7 @@ function DocBlocksShell({
8720
8812
  async (wsId, filePath, push, view, navigationRequestId, sharedMode = null) => {
8721
8813
  const requestId = navigationRequestId ?? ++navigationRequestRef.current;
8722
8814
  if (requestId !== navigationRequestRef.current) return null;
8723
- const transient = getTransientWorkspace(wsId);
8815
+ const transient = getTransientWorkspace2(wsId);
8724
8816
  let ws;
8725
8817
  let fsProvider = null;
8726
8818
  if (transient) {
@@ -8826,7 +8918,7 @@ function DocBlocksShell({
8826
8918
  if (opened) closeWelcomeGateway();
8827
8919
  return opened;
8828
8920
  } finally {
8829
- if (!opened && getTransientWorkspace(options.id)?.provider === options.provider) {
8921
+ if (!opened && getTransientWorkspace2(options.id)?.provider === options.provider) {
8830
8922
  await unregisterTransientWorkspace(options.id);
8831
8923
  }
8832
8924
  }
@@ -8927,11 +9019,11 @@ function DocBlocksShell({
8927
9019
  showBrowserStorageWarning
8928
9020
  ]
8929
9021
  );
8930
- const startupOpenFromIdsRef = useRef20(openFromIds);
9022
+ const startupOpenFromIdsRef = useRef21(openFromIds);
8931
9023
  startupOpenFromIdsRef.current = openFromIds;
8932
- const startupOpenSharedDocumentRef = useRef20(openSharedDocument);
9024
+ const startupOpenSharedDocumentRef = useRef21(openSharedDocument);
8933
9025
  startupOpenSharedDocumentRef.current = openSharedDocument;
8934
- const startupSeedWelcomeFileRef = useRef20(seedWelcomeFile);
9026
+ const startupSeedWelcomeFileRef = useRef21(seedWelcomeFile);
8935
9027
  startupSeedWelcomeFileRef.current = seedWelcomeFile;
8936
9028
  const [focusAfterWelcome, setFocusAfterWelcome] = useState24(false);
8937
9029
  const handleTourWelcome = useCallback19(() => {
@@ -8948,7 +9040,7 @@ function DocBlocksShell({
8948
9040
  let cancelled = false;
8949
9041
  const isCurrent = () => !cancelled && requestId === navigationRequestRef.current;
8950
9042
  void (async () => {
8951
- const electron = hostSupports2("workspaceAuthority");
9043
+ const electron = hostSupports3("workspaceAuthority");
8952
9044
  let workspaceIdRemap = {};
8953
9045
  const defaultHostWorkspaceIds = /* @__PURE__ */ new Set();
8954
9046
  const isDefaultWorkspace = (workspaceId) => isAppDefaultWorkspace(workspaceId, electron ? defaultHostWorkspaceIds : null);
@@ -9278,7 +9370,7 @@ function DocBlocksShell({
9278
9370
  };
9279
9371
  }, []);
9280
9372
  const [offlineReadyToast, setOfflineReadyToast] = useState24(false);
9281
- const offlineReadyAnnouncedRef = useRef20(false);
9373
+ const offlineReadyAnnouncedRef = useRef21(false);
9282
9374
  useEffect30(() => {
9283
9375
  if (!offlineReady || offlineReadyAnnouncedRef.current) return;
9284
9376
  offlineReadyAnnouncedRef.current = true;
@@ -9294,7 +9386,7 @@ function DocBlocksShell({
9294
9386
  setStorageFull(false);
9295
9387
  }
9296
9388
  }, [documentSnapshot.error, documentSnapshot.status]);
9297
- const autoPersistRequestedRef = useRef20(false);
9389
+ const autoPersistRequestedRef = useRef21(false);
9298
9390
  useEffect30(() => {
9299
9391
  if (!showBrowserStorageWarning || browserStoragePersistent) return;
9300
9392
  if (autoPersistRequestedRef.current) return;
@@ -9329,12 +9421,18 @@ function DocBlocksShell({
9329
9421
  const parentDir = dirnameOf(selectedFile);
9330
9422
  const base = basenameOf(selectedFile);
9331
9423
  const baseNoExt = base.replace(/\.[^.]+$/, "");
9332
- const container = new FileSystemContentContainer2(provider, parentDir);
9424
+ const readBeside = looseFileMediaReader(provider.id);
9425
+ const container = createMediaContainer(provider, parentDir, readBeside);
9333
9426
  const vPrefix = parentDir ? `${parentDir}/${baseNoExt}_files` : `${baseNoExt}_files`;
9334
- const vContainer = new FileSystemContentContainer2(provider, vPrefix, {
9427
+ const vContainer = new FileSystemContentContainer3(provider, vPrefix, {
9335
9428
  documentMediaPrefix: `${baseNoExt}_files`
9336
9429
  });
9337
- const mp = createFileMediaProvider(container, base);
9430
+ const mp = createFileMediaProvider(container, base, {
9431
+ readDocumentRelative: createDocumentRelativeMediaReader(
9432
+ createMediaContainer(provider, "", readBeside),
9433
+ parentDir
9434
+ )
9435
+ });
9338
9436
  mediaContainerRef.current = container;
9339
9437
  versionsContainerRef.current = vContainer;
9340
9438
  setMediaProvider(mp);
@@ -9395,7 +9493,7 @@ function DocBlocksShell({
9395
9493
  useEffect30(() => {
9396
9494
  if (!provider) return;
9397
9495
  const providerV2 = getFileSystemProviderV211(provider);
9398
- const lifecycle = maybeGetDocBlocksHost4()?.lifecycle;
9496
+ const lifecycle = maybeGetDocBlocksHost5()?.lifecycle;
9399
9497
  if (!providerV2 || !providerV2.capabilities.watch && !lifecycle?.onResume && !managedOutputRefreshToken)
9400
9498
  return;
9401
9499
  const watchedFile = selectedSourceFile ?? selectedFile;
@@ -9495,7 +9593,7 @@ function DocBlocksShell({
9495
9593
  const [showConflictComparison, setShowConflictComparison] = useState24(false);
9496
9594
  const readConflictFile = useCallback19(async () => {
9497
9595
  const path = selectedSourceFile ?? selectedFile;
9498
- if (!provider || !path || activeWorkspaceId && getTransientWorkspace(activeWorkspaceId)) {
9596
+ if (!provider || !path || activeWorkspaceId && getTransientWorkspace2(activeWorkspaceId)) {
9499
9597
  return null;
9500
9598
  }
9501
9599
  return readStableFileSnapshot(provider, path);
@@ -9566,8 +9664,8 @@ function DocBlocksShell({
9566
9664
  };
9567
9665
  }, [documentSession, documentSnapshot.status, documentSnapshot.targetKey]);
9568
9666
  useEffect30(() => {
9569
- const lifecycle = maybeGetDocBlocksHost4()?.lifecycle;
9570
- if (!hostSupports2("guardedClose") || !lifecycle) return;
9667
+ const lifecycle = maybeGetDocBlocksHost5()?.lifecycle;
9668
+ if (!hostSupports3("guardedClose") || !lifecycle) return;
9571
9669
  const stopPrepare = lifecycle.onPrepareClose(async (request) => {
9572
9670
  preparedCloseRequestRef.current = request.requestId;
9573
9671
  try {
@@ -9597,7 +9695,7 @@ function DocBlocksShell({
9597
9695
  await touchWorkspace2(ws.id);
9598
9696
  if (requestId !== navigationRequestRef.current) return;
9599
9697
  let nextProvider = null;
9600
- const transient = getTransientWorkspace(ws.id);
9698
+ const transient = getTransientWorkspace2(ws.id);
9601
9699
  if (transient) {
9602
9700
  nextProvider = transient.provider;
9603
9701
  } else if (ws.type === "host-native") {
@@ -9698,11 +9796,11 @@ function DocBlocksShell({
9698
9796
  let adoptedNextProvider = nextProvider !== null;
9699
9797
  try {
9700
9798
  if (!nextProvider) {
9701
- const transient = getTransientWorkspace(workspace.id);
9799
+ const transient = getTransientWorkspace2(workspace.id);
9702
9800
  if (transient) {
9703
9801
  nextProvider = transient.provider;
9704
9802
  } else if (workspace.type === "host-native") {
9705
- nextProvider = hostSupports2("nativeWorkspaces") ? await createHostProviderFromWorkspace(workspace) : null;
9803
+ nextProvider = hostSupports3("nativeWorkspaces") ? await createHostProviderFromWorkspace(workspace) : null;
9706
9804
  ownsNextProvider = nextProvider !== null;
9707
9805
  } else if (workspace.type === "native") {
9708
9806
  nextProvider = await (await loadNativeFileSystem()).restoreNativeFolder(workspace.id);
@@ -9817,7 +9915,7 @@ function DocBlocksShell({
9817
9915
  if (!activeWorkspaceId || !provider || !selectedFile) {
9818
9916
  throw new Error("Select the temporary document before moving it.");
9819
9917
  }
9820
- const transient = getTransientWorkspace(activeWorkspaceId);
9918
+ const transient = getTransientWorkspace2(activeWorkspaceId);
9821
9919
  if (!transient || transient.provider !== provider) {
9822
9920
  throw new Error("This workspace is no longer temporary.");
9823
9921
  }
@@ -9890,7 +9988,7 @@ function DocBlocksShell({
9890
9988
  void touchWorkspace2(destination.id).catch(() => void 0);
9891
9989
  if (sourceTargetKey) pendingDbkConflictsRef.current.delete(sourceTargetKey);
9892
9990
  const origin = transient.descriptor.origin;
9893
- const externalApi = maybeGetDocBlocksHost4()?.external;
9991
+ const externalApi = maybeGetDocBlocksHost5()?.external;
9894
9992
  if (externalApi && origin && (origin.kind === "loose-file" || origin.kind === "dbk")) {
9895
9993
  try {
9896
9994
  await externalApi.revoke(origin.resourceId);
@@ -9929,7 +10027,7 @@ function DocBlocksShell({
9929
10027
  const handleOpenFolder = useCallback19(async () => {
9930
10028
  const requestId = ++navigationRequestRef.current;
9931
10029
  try {
9932
- if (hostSupports2("workspaceFolderPicker")) {
10030
+ if (hostSupports3("workspaceFolderPicker")) {
9933
10031
  const info = await getDocBlocksHost().workspaces.pickFolder?.();
9934
10032
  if (!info) return;
9935
10033
  if (requestId !== navigationRequestRef.current) return;
@@ -10147,7 +10245,7 @@ function DocBlocksShell({
10147
10245
  singlePane
10148
10246
  ]);
10149
10247
  const canFind = selectedFile !== null && mediaProvider !== null && selectedManagedOutput !== "catalog-html" && selectedImage === void 0;
10150
- const canFindRef = useRef20(canFind);
10248
+ const canFindRef = useRef21(canFind);
10151
10249
  canFindRef.current = canFind;
10152
10250
  const { ensure: ensureWorkspaceIndex } = workspaceIndex;
10153
10251
  const openQuickOpen = useCallback19(() => {
@@ -10224,7 +10322,7 @@ function DocBlocksShell({
10224
10322
  );
10225
10323
  useShellShortcuts(shortcutHandlers, layoutMode);
10226
10324
  useEffect30(
10227
- () => maybeGetDocBlocksHost4()?.lifecycle?.onBack?.(() => {
10325
+ () => maybeGetDocBlocksHost5()?.lifecycle?.onBack?.(() => {
10228
10326
  if (dismissTopmostDialog()) return true;
10229
10327
  const escape = new KeyboardEvent("keydown", {
10230
10328
  key: "Escape",
@@ -10245,7 +10343,7 @@ function DocBlocksShell({
10245
10343
  }),
10246
10344
  [singlePane, mobileShowEditor]
10247
10345
  );
10248
- const actionNewHandledRef = useRef20(false);
10346
+ const actionNewHandledRef = useRef21(false);
10249
10347
  useEffect30(() => {
10250
10348
  if (!provider || actionNewHandledRef.current) return;
10251
10349
  if (typeof window === "undefined") return;
@@ -10262,8 +10360,8 @@ function DocBlocksShell({
10262
10360
  void handleNewFile();
10263
10361
  }, [provider, handleNewFile]);
10264
10362
  const handleRevealWorkspace = useCallback19(async () => {
10265
- const shell = maybeGetDocBlocksHost4()?.shell;
10266
- if (!hostSupports2("revealInFileManager") || !shell?.revealInFolder || !activeWorkspaceId) {
10363
+ const shell = maybeGetDocBlocksHost5()?.shell;
10364
+ if (!hostSupports3("revealInFileManager") || !shell?.revealInFolder || !activeWorkspaceId) {
10267
10365
  return;
10268
10366
  }
10269
10367
  const ws = await getWorkspace(activeWorkspaceId);
@@ -10272,8 +10370,8 @@ function DocBlocksShell({
10272
10370
  }
10273
10371
  }, [activeWorkspaceId]);
10274
10372
  const handleOpenWorkspaceFolder = useCallback19(() => {
10275
- const shell = maybeGetDocBlocksHost4()?.shell;
10276
- if (!hostSupports2("openWorkspaceFolder") || !shell?.openWorkspaceFolder || !nativeWorkspaceId) {
10373
+ const shell = maybeGetDocBlocksHost5()?.shell;
10374
+ if (!hostSupports3("openWorkspaceFolder") || !shell?.openWorkspaceFolder || !nativeWorkspaceId) {
10277
10375
  return;
10278
10376
  }
10279
10377
  void shell.openWorkspaceFolder(nativeWorkspaceId).catch((error) => {
@@ -10284,8 +10382,8 @@ function DocBlocksShell({
10284
10382
  });
10285
10383
  }, [nativeWorkspaceId, showToast]);
10286
10384
  useEffect30(() => {
10287
- const host = maybeGetDocBlocksHost4();
10288
- if (!hostSupports2("menuCommands") || !host?.onMenuCommand) return;
10385
+ const host = maybeGetDocBlocksHost5();
10386
+ if (!hostSupports3("menuCommands") || !host?.onMenuCommand) return;
10289
10387
  return host.onMenuCommand((cmd) => {
10290
10388
  switch (cmd) {
10291
10389
  case "file:new":
@@ -10434,7 +10532,7 @@ function DocBlocksShell({
10434
10532
  defaultNewFileFormat
10435
10533
  ]
10436
10534
  );
10437
- const wikiNavigationRef = useRef20(handleSelect);
10535
+ const wikiNavigationRef = useRef21(handleSelect);
10438
10536
  wikiNavigationRef.current = handleSelect;
10439
10537
  const wikiLinks = useMemo6(() => {
10440
10538
  if (!provider || !selectedFile || !activeWorkspaceId) return null;
@@ -10579,7 +10677,7 @@ function DocBlocksShell({
10579
10677
  const nativeActions = createNativeFileActions(
10580
10678
  entry,
10581
10679
  nativeWorkspaceId,
10582
- maybeGetDocBlocksHost4()
10680
+ maybeGetDocBlocksHost5()
10583
10681
  );
10584
10682
  return [...nativeActions, ...outsideInActionsForEntry(entry)];
10585
10683
  },
@@ -10818,13 +10916,13 @@ function DocBlocksShell({
10818
10916
  if (activeWorkspaceId === workspace.id && provider) {
10819
10917
  return { kind: "ready", workspace, provider, owned: false };
10820
10918
  }
10821
- const transient = getTransientWorkspace(workspace.id);
10919
+ const transient = getTransientWorkspace2(workspace.id);
10822
10920
  if (transient) {
10823
10921
  return { kind: "ready", workspace, provider: transient.provider, owned: false };
10824
10922
  }
10825
10923
  let pinnedProvider = null;
10826
10924
  if (workspace.type === "host-native") {
10827
- pinnedProvider = hostSupports2("nativeWorkspaces") ? await createHostProviderFromWorkspace(workspace) : null;
10925
+ pinnedProvider = hostSupports3("nativeWorkspaces") ? await createHostProviderFromWorkspace(workspace) : null;
10828
10926
  } else if (workspace.type === "native") {
10829
10927
  pinnedProvider = await (await loadNativeFileSystem()).restoreNativeFolder(workspace.id);
10830
10928
  } else {
@@ -11009,8 +11107,8 @@ function DocBlocksShell({
11009
11107
  showToast
11010
11108
  ]
11011
11109
  );
11012
- const restoreInputRef = useRef20(null);
11013
- const restoreInProgress = useRef20(false);
11110
+ const restoreInputRef = useRef21(null);
11111
+ const restoreInProgress = useRef21(false);
11014
11112
  const handleRestoreBackup = useCallback19(
11015
11113
  async (file) => {
11016
11114
  if (restoreInProgress.current) {
@@ -11040,7 +11138,7 @@ function DocBlocksShell({
11040
11138
  );
11041
11139
  const importOrRestore = useCallback19(
11042
11140
  async (files) => {
11043
- const backups = hostSupports2("nativeWorkspaces") ? [] : files.filter((file) => /\.zip$/i.test(file.name));
11141
+ const backups = hostSupports3("nativeWorkspaces") ? [] : files.filter((file) => /\.zip$/i.test(file.name));
11044
11142
  const documents = files.filter((file) => !backups.includes(file));
11045
11143
  const result = provider ? await importDroppedFiles(documents, provider) : null;
11046
11144
  for (const file of backups) await handleRestoreBackup(file);
@@ -11187,8 +11285,8 @@ function DocBlocksShell({
11187
11285
  [adoptTransientWorkspace]
11188
11286
  );
11189
11287
  useEffect30(() => {
11190
- const host = maybeGetDocBlocksHost4();
11191
- if (!hostSupports2("openRequests") || !host) return;
11288
+ const host = maybeGetDocBlocksHost5();
11289
+ if (!hostSupports3("openRequests") || !host) return;
11192
11290
  return host.onOpenRequest((req) => {
11193
11291
  const requestId = ++navigationRequestRef.current;
11194
11292
  void (req.kind === "workspace-file" ? workspaceAuthorityBarrier.wait().then(() => {
@@ -11254,7 +11352,7 @@ function DocBlocksShell({
11254
11352
  [adoptTransientWorkspace]
11255
11353
  );
11256
11354
  useEffect30(() => {
11257
- if (hostSupports2("openRequests") || typeof window === "undefined") return;
11355
+ if (hostSupports3("openRequests") || typeof window === "undefined") return;
11258
11356
  const launchQueue = window.launchQueue;
11259
11357
  if (!launchQueue) return;
11260
11358
  launchQueue.setConsumer((params) => {
@@ -11301,7 +11399,7 @@ function DocBlocksShell({
11301
11399
  import("@bendyline/squisq/storage"),
11302
11400
  import("@bendyline/squisq-formats/container")
11303
11401
  ]);
11304
- const electron = hostSupports2("nativeWorkspaces");
11402
+ const electron = hostSupports3("nativeWorkspaces");
11305
11403
  const all = await listWorkspaces2();
11306
11404
  const candidates = all.filter(
11307
11405
  (w) => electron ? w.type === "host-native" || w.type === "transient" : w.type !== "host-native"
@@ -11317,7 +11415,7 @@ function DocBlocksShell({
11317
11415
  let p = null;
11318
11416
  let ownsProvider = false;
11319
11417
  try {
11320
- const transient = getTransientWorkspace(ws.id);
11418
+ const transient = getTransientWorkspace2(ws.id);
11321
11419
  if (transient) {
11322
11420
  p = transient.provider;
11323
11421
  } else if (ws.type === "host-native") {
@@ -11443,7 +11541,7 @@ function DocBlocksShell({
11443
11541
  }
11444
11542
  } else if (ws?.type === "transient") {
11445
11543
  const origin = ws.origin;
11446
- const externalApi = maybeGetDocBlocksHost4()?.external;
11544
+ const externalApi = maybeGetDocBlocksHost5()?.external;
11447
11545
  if (externalApi && origin && (origin.kind === "loose-file" || origin.kind === "dbk")) {
11448
11546
  try {
11449
11547
  await externalApi.revoke(origin.resourceId);
@@ -11467,7 +11565,7 @@ function DocBlocksShell({
11467
11565
  return;
11468
11566
  }
11469
11567
  if (requestId !== navigationRequestRef.current) return;
11470
- const electron = hostSupports2("nativeWorkspaces");
11568
+ const electron = hostSupports3("nativeWorkspaces");
11471
11569
  const remaining = (await listWorkspaces2()).filter(
11472
11570
  (w) => electron ? w.type === "host-native" : w.type !== "host-native"
11473
11571
  );
@@ -11624,7 +11722,7 @@ function DocBlocksShell({
11624
11722
  onVersioningPreferenceChange: handleVersioningPreferenceChange,
11625
11723
  onOpenWorkspaceSettings: activeWorkspaceDescriptor ? handleOpenWorkspaceSettings : void 0,
11626
11724
  onDownloadAllWorkspaces: handleDownloadAllWorkspaces,
11627
- onRestoreBackup: hostSupports2("nativeWorkspaces") ? void 0 : () => restoreInputRef.current?.click(),
11725
+ onRestoreBackup: hostSupports3("nativeWorkspaces") ? void 0 : () => restoreInputRef.current?.click(),
11628
11726
  onShowKeyboardShortcuts: singlePane ? void 0 : openKeyboardShortcuts,
11629
11727
  onKeepBrowserData: showBrowserStorageWarning && !browserStoragePersistent ? handleKeepBrowserData : void 0,
11630
11728
  onInstallApp: installPromptEvent ? handleInstallApp : void 0,
@@ -11719,7 +11817,7 @@ function DocBlocksShell({
11719
11817
  onPinnedDocumentDelete: handlePinnedDocumentDelete,
11720
11818
  onTogglePin: handleTogglePin,
11721
11819
  onSelect: handleSelect,
11722
- onOpenWorkspaceFolder: hostSupports2("openWorkspaceFolder") && nativeWorkspaceId ? handleOpenWorkspaceFolder : void 0,
11820
+ onOpenWorkspaceFolder: hostSupports3("openWorkspaceFolder") && nativeWorkspaceId ? handleOpenWorkspaceFolder : void 0,
11723
11821
  actionsForEntry,
11724
11822
  onTreeMutation: handleTreeMutation,
11725
11823
  onTreeChange: handleTreeChange,
@@ -11933,7 +12031,7 @@ function DocBlocksShell({
11933
12031
  onOpenSettings: openSettings
11934
12032
  }
11935
12033
  ),
11936
- hostSupports2("speechOutput") ? /* @__PURE__ */ jsx19(
12034
+ hostSupports3("speechOutput") ? /* @__PURE__ */ jsx19(
11937
12035
  SpeechToolbarControl,
11938
12036
  {
11939
12037
  speech,
@@ -12018,7 +12116,7 @@ function DocBlocksShell({
12018
12116
  children: "New folder"
12019
12117
  }
12020
12118
  ),
12021
- (hostSupports2("workspaceFolderPicker") || typeof globalThis.showDirectoryPicker === "function") && /* @__PURE__ */ jsx19(
12119
+ (hostSupports3("workspaceFolderPicker") || typeof globalThis.showDirectoryPicker === "function") && /* @__PURE__ */ jsx19(
12022
12120
  "button",
12023
12121
  {
12024
12122
  type: "button",