@harbour-enterprises/superdoc 0.29.0-next.7 → 0.29.0-next.8

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 (155) hide show
  1. package/dist/chunks/{PdfViewer-D2cnJhM1.es.js → PdfViewer-D52oZlMN.es.js} +2 -2
  2. package/dist/chunks/{PdfViewer-DyUG4__F.cjs → PdfViewer-DN5OVJ2m.cjs} +1 -1
  3. package/dist/chunks/{eventemitter3-xrnx5jJP.es.js → eventemitter3-D4gv5QOO.es.js} +1 -1
  4. package/dist/chunks/{index-DC11bH-A.es.js → index-Ckp6Xz_9.es.js} +166 -121
  5. package/dist/chunks/{index-BqhJhdcP-Dm9pUO-L.cjs → index-D08c3nkG-CEL2t8xk.cjs} +1 -1
  6. package/dist/chunks/{index-BqhJhdcP-B9XbOefk.es.js → index-D08c3nkG-DhTHMiRT.es.js} +1 -1
  7. package/dist/chunks/{index-DZIAPuKc.cjs → index-l9QIxky6.cjs} +164 -119
  8. package/dist/chunks/{jszip-9Y3n05fi.es.js → jszip-Bhl-Iudl.es.js} +1 -1
  9. package/dist/chunks/{super-editor.es-DNPslOnx.es.js → super-editor.es-BMKdFBfO.es.js} +138 -107
  10. package/dist/chunks/{super-editor.es-607cvQXw.cjs → super-editor.es-DfufVFpB.cjs} +136 -105
  11. package/dist/chunks/{vue-DVNiXx7E.es.js → vue-D1vcEBAQ.es.js} +17 -17
  12. package/dist/chunks/xml-js-jMPlIVKT.es.js +2 -0
  13. package/dist/packages/superdoc/src/components/CommentsLayer/comment-schemas.d.ts.map +1 -0
  14. package/dist/packages/superdoc/src/components/CommentsLayer/commentsList/super-comments-list.d.ts.map +1 -0
  15. package/dist/packages/superdoc/src/components/CommentsLayer/helpers.d.ts.map +1 -0
  16. package/dist/packages/superdoc/src/components/CommentsLayer/types.d.ts.map +1 -0
  17. package/dist/packages/superdoc/src/components/CommentsLayer/use-comment.d.ts.map +1 -0
  18. package/dist/packages/superdoc/src/components/CommentsLayer/use-conversation.d.ts.map +1 -0
  19. package/dist/packages/superdoc/src/components/CommentsLayer/use-floating-comment.d.ts.map +1 -0
  20. package/dist/packages/superdoc/src/components/PdfViewer/helpers/range.d.ts.map +1 -0
  21. package/dist/packages/superdoc/src/components/PdfViewer/helpers/read-file.d.ts.map +1 -0
  22. package/dist/packages/superdoc/src/components/PdfViewer/pdf/pdf-adapter.d.ts.map +1 -0
  23. package/dist/packages/superdoc/src/composables/use-ai.d.ts.map +1 -0
  24. package/dist/packages/superdoc/src/composables/use-document.d.ts.map +1 -0
  25. package/dist/packages/superdoc/src/composables/use-field.d.ts.map +1 -0
  26. package/dist/packages/superdoc/src/composables/use-high-contrast-mode.d.ts.map +1 -0
  27. package/dist/packages/superdoc/src/composables/use-selected-text.d.ts.map +1 -0
  28. package/dist/{core → packages/superdoc/src/core}/SuperDoc.d.ts +1 -1
  29. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -0
  30. package/dist/packages/superdoc/src/core/collaboration/collaboration-comments.d.ts.map +1 -0
  31. package/dist/packages/superdoc/src/core/collaboration/collaboration.d.ts.map +1 -0
  32. package/dist/packages/superdoc/src/core/collaboration/helpers.d.ts.map +1 -0
  33. package/dist/packages/superdoc/src/core/collaboration/permissions.d.ts.map +1 -0
  34. package/dist/packages/superdoc/src/core/create-app.d.ts.map +1 -0
  35. package/dist/packages/superdoc/src/core/helpers/export.d.ts.map +1 -0
  36. package/dist/packages/superdoc/src/core/helpers/file.d.ts.map +1 -0
  37. package/dist/{core → packages/superdoc/src/core}/index.d.ts.map +1 -1
  38. package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -0
  39. package/dist/packages/superdoc/src/helpers/floor.d.ts.map +1 -0
  40. package/dist/packages/superdoc/src/helpers/group-changes.d.ts.map +1 -0
  41. package/dist/packages/superdoc/src/helpers/use-selection.d.ts.map +1 -0
  42. package/dist/{icons.d.ts.map → packages/superdoc/src/icons.d.ts.map} +1 -1
  43. package/dist/{index.d.ts → packages/superdoc/src/index.d.ts} +5 -5
  44. package/dist/packages/superdoc/src/index.d.ts.map +1 -0
  45. package/dist/packages/superdoc/src/main.d.ts.map +1 -0
  46. package/dist/{stores → packages/superdoc/src/stores}/comments-store.d.ts +36 -36
  47. package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -0
  48. package/dist/packages/superdoc/src/stores/hrbr-fields-store.d.ts.map +1 -0
  49. package/dist/{stores → packages/superdoc/src/stores}/superdoc-store.d.ts +110 -110
  50. package/dist/{stores → packages/superdoc/src/stores}/superdoc-store.d.ts.map +1 -1
  51. package/dist/{super-editor.d.ts.map → packages/superdoc/src/super-editor.d.ts.map} +1 -1
  52. package/dist/shared/common/Telemetry.d.ts +237 -0
  53. package/dist/shared/common/Telemetry.d.ts.map +1 -0
  54. package/dist/shared/common/collaboration/awareness.d.ts +39 -0
  55. package/dist/shared/common/collaboration/awareness.d.ts.map +1 -0
  56. package/dist/shared/common/document-types.d.ts +10 -0
  57. package/dist/shared/common/document-types.d.ts.map +1 -0
  58. package/dist/shared/common/event-types.d.ts +14 -0
  59. package/dist/shared/common/event-types.d.ts.map +1 -0
  60. package/dist/shared/common/helpers/compare-superdoc-versions.d.ts +8 -0
  61. package/dist/shared/common/helpers/compare-superdoc-versions.d.ts.map +1 -0
  62. package/dist/shared/common/helpers/get-file-object.d.ts +50 -0
  63. package/dist/shared/common/helpers/get-file-object.d.ts.map +1 -0
  64. package/dist/shared/common/helpers/v-click-outside.d.ts +11 -0
  65. package/dist/shared/common/helpers/v-click-outside.d.ts.map +1 -0
  66. package/dist/shared/common/index.d.ts +10 -0
  67. package/dist/shared/common/index.d.ts.map +1 -0
  68. package/dist/shared/common/key-transform.d.ts +44 -0
  69. package/dist/shared/common/key-transform.d.ts.map +1 -0
  70. package/dist/style.css +56 -56
  71. package/dist/super-editor/ai-writer.es.js +3 -3
  72. package/dist/super-editor/chunks/{converter--SREdiqQ.js → converter-CqYeAv65.js} +324 -47
  73. package/dist/super-editor/chunks/{docx-zipper-BRGsc2Y2.js → docx-zipper-C97RawM-.js} +1 -1
  74. package/dist/super-editor/chunks/{editor-DsKLhlKe.js → editor-BrxCRICL.js} +4 -4
  75. package/dist/super-editor/chunks/{index-BqhJhdcP.js → index-D08c3nkG.js} +1 -1
  76. package/dist/super-editor/chunks/{toolbar-Dqed7MP7.js → toolbar-B33VzEsn.js} +2 -2
  77. package/dist/super-editor/converter.es.js +1 -2
  78. package/dist/super-editor/docx-zipper.es.js +2 -2
  79. package/dist/super-editor/editor.es.js +3 -3
  80. package/dist/super-editor/file-zipper.es.js +1 -1
  81. package/dist/super-editor/style.css +29 -29
  82. package/dist/super-editor/super-editor/src/index.d.ts +0 -1
  83. package/dist/super-editor/super-editor/src/index.d.ts.map +1 -1
  84. package/dist/super-editor/super-editor.es.js +77 -50
  85. package/dist/super-editor/toolbar.es.js +2 -2
  86. package/dist/super-editor.cjs +3 -3
  87. package/dist/super-editor.es.js +2 -2
  88. package/dist/superdoc.cjs +2 -3
  89. package/dist/superdoc.es.js +2 -3
  90. package/dist/superdoc.umd.js +44226 -44150
  91. package/dist/superdoc.umd.js.map +1 -1
  92. package/package.json +3 -3
  93. package/dist/chunks/xml-js-ByyNjzYS.es.js +0 -2
  94. package/dist/components/CommentsLayer/comment-schemas.d.ts.map +0 -1
  95. package/dist/components/CommentsLayer/commentsList/super-comments-list.d.ts.map +0 -1
  96. package/dist/components/CommentsLayer/helpers.d.ts.map +0 -1
  97. package/dist/components/CommentsLayer/types.d.ts.map +0 -1
  98. package/dist/components/CommentsLayer/use-comment.d.ts.map +0 -1
  99. package/dist/components/CommentsLayer/use-conversation.d.ts.map +0 -1
  100. package/dist/components/CommentsLayer/use-floating-comment.d.ts.map +0 -1
  101. package/dist/components/PdfViewer/helpers/range.d.ts.map +0 -1
  102. package/dist/components/PdfViewer/helpers/read-file.d.ts.map +0 -1
  103. package/dist/components/PdfViewer/pdf/pdf-adapter.d.ts.map +0 -1
  104. package/dist/composables/use-ai.d.ts.map +0 -1
  105. package/dist/composables/use-document.d.ts.map +0 -1
  106. package/dist/composables/use-field.d.ts.map +0 -1
  107. package/dist/composables/use-high-contrast-mode.d.ts.map +0 -1
  108. package/dist/composables/use-selected-text.d.ts.map +0 -1
  109. package/dist/core/SuperDoc.d.ts.map +0 -1
  110. package/dist/core/collaboration/collaboration-comments.d.ts.map +0 -1
  111. package/dist/core/collaboration/collaboration.d.ts.map +0 -1
  112. package/dist/core/collaboration/helpers.d.ts.map +0 -1
  113. package/dist/core/collaboration/permissions.d.ts.map +0 -1
  114. package/dist/core/create-app.d.ts.map +0 -1
  115. package/dist/core/helpers/export.d.ts.map +0 -1
  116. package/dist/core/helpers/file.d.ts.map +0 -1
  117. package/dist/core/types/index.d.ts.map +0 -1
  118. package/dist/helpers/floor.d.ts.map +0 -1
  119. package/dist/helpers/group-changes.d.ts.map +0 -1
  120. package/dist/helpers/use-selection.d.ts.map +0 -1
  121. package/dist/index.d.ts.map +0 -1
  122. package/dist/main.d.ts.map +0 -1
  123. package/dist/stores/comments-store.d.ts.map +0 -1
  124. package/dist/stores/hrbr-fields-store.d.ts.map +0 -1
  125. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/comment-schemas.d.ts +0 -0
  126. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/commentsList/super-comments-list.d.ts +0 -0
  127. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/helpers.d.ts +0 -0
  128. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/types.d.ts +0 -0
  129. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/use-comment.d.ts +0 -0
  130. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/use-conversation.d.ts +0 -0
  131. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/use-floating-comment.d.ts +0 -0
  132. /package/dist/{components → packages/superdoc/src/components}/PdfViewer/helpers/range.d.ts +0 -0
  133. /package/dist/{components → packages/superdoc/src/components}/PdfViewer/helpers/read-file.d.ts +0 -0
  134. /package/dist/{components → packages/superdoc/src/components}/PdfViewer/pdf/pdf-adapter.d.ts +0 -0
  135. /package/dist/{composables → packages/superdoc/src/composables}/use-ai.d.ts +0 -0
  136. /package/dist/{composables → packages/superdoc/src/composables}/use-document.d.ts +0 -0
  137. /package/dist/{composables → packages/superdoc/src/composables}/use-field.d.ts +0 -0
  138. /package/dist/{composables → packages/superdoc/src/composables}/use-high-contrast-mode.d.ts +0 -0
  139. /package/dist/{composables → packages/superdoc/src/composables}/use-selected-text.d.ts +0 -0
  140. /package/dist/{core → packages/superdoc/src/core}/collaboration/collaboration-comments.d.ts +0 -0
  141. /package/dist/{core → packages/superdoc/src/core}/collaboration/collaboration.d.ts +0 -0
  142. /package/dist/{core → packages/superdoc/src/core}/collaboration/helpers.d.ts +0 -0
  143. /package/dist/{core → packages/superdoc/src/core}/collaboration/permissions.d.ts +0 -0
  144. /package/dist/{core → packages/superdoc/src/core}/create-app.d.ts +0 -0
  145. /package/dist/{core → packages/superdoc/src/core}/helpers/export.d.ts +0 -0
  146. /package/dist/{core → packages/superdoc/src/core}/helpers/file.d.ts +0 -0
  147. /package/dist/{core → packages/superdoc/src/core}/index.d.ts +0 -0
  148. /package/dist/{core → packages/superdoc/src/core}/types/index.d.ts +0 -0
  149. /package/dist/{helpers → packages/superdoc/src/helpers}/floor.d.ts +0 -0
  150. /package/dist/{helpers → packages/superdoc/src/helpers}/group-changes.d.ts +0 -0
  151. /package/dist/{helpers → packages/superdoc/src/helpers}/use-selection.d.ts +0 -0
  152. /package/dist/{icons.d.ts → packages/superdoc/src/icons.d.ts} +0 -0
  153. /package/dist/{main.d.ts → packages/superdoc/src/main.d.ts} +0 -0
  154. /package/dist/{stores → packages/superdoc/src/stores}/hrbr-fields-store.d.ts +0 -0
  155. /package/dist/{super-editor.d.ts → packages/superdoc/src/super-editor.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
- import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-DVNiXx7E.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-DC11bH-A.es.js";
1
+ import { m as defineComponent, y as h, O as Transition, $ as process$1, J as watchEffect, a as computed, r as ref, j as onMounted, W as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, v as createVNode, x as unref } from "./vue-D1vcEBAQ.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-Ckp6Xz_9.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-BQxRC6G7.cjs");
4
- const superdoc = require("./index-DZIAPuKc.cjs");
4
+ const superdoc = require("./index-l9QIxky6.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from "./jszip-9Y3n05fi.es.js";
1
+ import { g as getDefaultExportFromCjs } from "./jszip-Bhl-Iudl.es.js";
2
2
  var eventemitter3 = { exports: {} };
3
3
  var hasRequiredEventemitter3;
4
4
  function requireEventemitter3() {
@@ -1,11 +1,11 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-DNPslOnx.es.js";
2
- import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-DVNiXx7E.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-BMKdFBfO.es.js";
3
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
- import { E as EventEmitter } from "./eventemitter3-xrnx5jJP.es.js";
3
+ import { E as EventEmitter } from "./eventemitter3-D4gv5QOO.es.js";
5
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
5
+ import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, a as computed, a2 as isRef, a3 as isReactive, E as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, A as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, C as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, G as provide, I as withDirectives, y as h, U as Teleport, R as renderSlot, V as isVNode, J as watchEffect, O as Transition, a8 as TransitionGroup, z as mergeProps, P as vShow, H as cloneVNode, T as Text, b as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, B as withCtx, f as createBaseVNode, D as normalizeStyle, e as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, d as renderList, c as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-D1vcEBAQ.es.js";
6
6
  import * as Y from "yjs";
7
7
  import { Doc, Map as Map$2 } from "yjs";
8
- import { B as Buffer$2 } from "./jszip-9Y3n05fi.es.js";
8
+ import { B as Buffer$2 } from "./jszip-Bhl-Iudl.es.js";
9
9
  import { v as v4 } from "./uuid-CjlX8hrF.es.js";
10
10
  const DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
11
11
  const PDF = "application/pdf";
@@ -15,7 +15,7 @@ const documentTypes = {
15
15
  pdf: PDF,
16
16
  html: HTML
17
17
  };
18
- const comments_module_events = Object.freeze({
18
+ const comments_module_events = {
19
19
  RESOLVED: "resolved",
20
20
  NEW: "new",
21
21
  ADD: "add",
@@ -28,16 +28,54 @@ const comments_module_events = Object.freeze({
28
28
  // Tracked changes
29
29
  CHANGE_ACCEPTED: "change-accepted",
30
30
  CHANGE_REJECTED: "change-rejected"
31
- });
31
+ };
32
+ class FileObjectError extends Error {
33
+ constructor(message, cause) {
34
+ super(message);
35
+ this.cause = cause;
36
+ this.name = "FileObjectError";
37
+ if (typeof Error.captureStackTrace === "function") {
38
+ Error.captureStackTrace(this, FileObjectError);
39
+ }
40
+ }
41
+ }
42
+ class InvalidDataUriError extends FileObjectError {
43
+ constructor(uri) {
44
+ super(`Invalid data URI format: URI must contain exactly one comma separator`);
45
+ this.uri = uri;
46
+ this.name = "InvalidDataUriError";
47
+ }
48
+ }
49
+ class FetchFailedError extends FileObjectError {
50
+ constructor(url, cause) {
51
+ super(`Failed to fetch file from URL: ${url}`, cause);
52
+ this.url = url;
53
+ this.name = "FetchFailedError";
54
+ }
55
+ }
32
56
  const getFileObject = async (fileUrl, name, type) => {
33
- if (fileUrl.startsWith("data:") && fileUrl.includes(";base64,")) {
34
- const binary = atob(fileUrl.split(",")[1]);
35
- const bytes = Uint8Array.from(binary, (c2) => c2.charCodeAt(0));
36
- return new File([bytes], name, { type });
37
- }
38
- const response = await fetch(fileUrl);
39
- const blob = await response.blob();
40
- return new File([blob], name, { type });
57
+ try {
58
+ if (fileUrl.startsWith("data:") && fileUrl.includes(";base64,")) {
59
+ const parts = fileUrl.split(",");
60
+ if (parts.length !== 2) {
61
+ throw new InvalidDataUriError(fileUrl);
62
+ }
63
+ const binary = atob(parts[1]);
64
+ const bytes = Uint8Array.from(binary, (c2) => c2.charCodeAt(0));
65
+ return new File([bytes], name, { type });
66
+ }
67
+ const response = await fetch(fileUrl);
68
+ if (!response.ok) {
69
+ throw new FetchFailedError(fileUrl, new Error(`HTTP ${response.status}: ${response.statusText}`));
70
+ }
71
+ const blob = await response.blob();
72
+ return new File([blob], name, { type });
73
+ } catch (error) {
74
+ if (error instanceof FileObjectError) {
75
+ throw error;
76
+ }
77
+ throw new FileObjectError("Failed to create file object", error);
78
+ }
41
79
  };
42
80
  function compareVersions(version1, version2) {
43
81
  const v1Parts = version1.split(".").map(Number);
@@ -54,68 +92,62 @@ const vClickOutside = {
54
92
  mounted(el, binding) {
55
93
  const clickOutsideHandler = (event) => {
56
94
  if (!el.contains(event.target)) {
57
- binding.value(event);
95
+ binding.value?.(event);
58
96
  }
59
97
  };
60
98
  document.addEventListener("click", clickOutsideHandler);
61
99
  el.__clickOutsideHandler = clickOutsideHandler;
62
100
  },
63
101
  unmounted(el) {
64
- document.removeEventListener("click", el.__clickOutsideHandler);
65
- delete el.__clickOutsideHandler;
102
+ if (el.__clickOutsideHandler) {
103
+ document.removeEventListener("click", el.__clickOutsideHandler);
104
+ delete el.__clickOutsideHandler;
105
+ }
66
106
  }
67
107
  };
108
+ function getCrypto() {
109
+ if (typeof globalThis === "undefined") {
110
+ return void 0;
111
+ }
112
+ const cryptoObj = globalThis.crypto ?? globalThis.msCrypto;
113
+ if (cryptoObj?.getRandomValues) {
114
+ return cryptoObj;
115
+ }
116
+ return void 0;
117
+ }
68
118
  function randomBytes(length2) {
69
119
  const array = new Uint8Array(length2);
120
+ const cryptoObj = getCrypto();
121
+ if (cryptoObj) {
122
+ cryptoObj.getRandomValues(array);
123
+ return array;
124
+ }
70
125
  for (let i = 0; i < length2; i++) {
71
126
  array[i] = Math.floor(Math.random() * 256);
72
127
  }
73
128
  return array;
74
129
  }
75
130
  class Telemetry {
76
- /** @type {boolean} */
77
- enabled;
78
- /** @type {string} */
79
- documentGuid;
80
- /** @type {string} */
81
- documentIdentifier;
82
- /** @type {string} */
83
- superdocVersion;
84
- /** @type {string} */
85
- licenseKey;
86
- /** @type {string} */
87
- endpoint;
88
- /** @type {string} */
89
- sessionId;
90
- /** @type {Object} */
91
- statistics = {
92
- nodeTypes: {},
93
- markTypes: {},
94
- attributes: {},
95
- errorCount: 0
96
- };
97
- /** @type {Array} */
98
- unknownElements = [];
99
- /** @type {Array} */
100
- errors = [];
101
- /** @type {Object} */
102
- fileStructure = {
103
- totalFiles: 0,
104
- maxDepth: 0,
105
- totalNodes: 0,
106
- files: []
107
- };
108
- /** @type {Object} */
109
- documentInfo = null;
110
- /** @type {string} */
111
- static COMMUNITY_LICENSE_KEY = "community-and-eval-agplv3";
112
- /** @type {string} */
113
- static DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
114
131
  /**
115
132
  * Initialize telemetry service
116
- * @param {TelemetryConfig} config
133
+ * @param config - Telemetry configuration
117
134
  */
118
- constructor(config = {}) {
135
+ constructor(config) {
136
+ this.statistics = {
137
+ nodeTypes: {},
138
+ markTypes: {},
139
+ attributes: {},
140
+ errorCount: 0
141
+ };
142
+ this.unknownElements = [];
143
+ this.errors = [];
144
+ this.fileStructure = {
145
+ totalFiles: 0,
146
+ maxDepth: 0,
147
+ totalNodes: 0,
148
+ files: []
149
+ };
150
+ this.documentInfo = null;
119
151
  this.enabled = config.enabled ?? true;
120
152
  this.licenseKey = config.licenseKey ?? Telemetry.COMMUNITY_LICENSE_KEY;
121
153
  this.endpoint = config.endpoint ?? Telemetry.DEFAULT_ENDPOINT;
@@ -124,9 +156,15 @@ class Telemetry {
124
156
  this.superdocVersion = config.superdocVersion;
125
157
  this.sessionId = this.generateId();
126
158
  }
159
+ static {
160
+ this.COMMUNITY_LICENSE_KEY = "community-and-eval-agplv3";
161
+ }
162
+ static {
163
+ this.DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
164
+ }
127
165
  /**
128
166
  * Get browser environment information
129
- * @returns {Object} Browser information
167
+ * @returns Browser information
130
168
  */
131
169
  getBrowserInfo() {
132
170
  return {
@@ -142,8 +180,8 @@ class Telemetry {
142
180
  }
143
181
  /**
144
182
  * Track document usage event
145
- * @param {string} name - Event name
146
- * @param {Object} properties - Additional properties
183
+ * @param name - Event name (use TelemetryEventNames for standard events)
184
+ * @param properties - Additional properties
147
185
  */
148
186
  async trackUsage(name, properties = {}) {
149
187
  if (!this.enabled) return;
@@ -164,16 +202,17 @@ class Telemetry {
164
202
  };
165
203
  await this.sendDataToTelemetry(event);
166
204
  }
167
- /**
168
- * Track parsing statistics
169
- * @param {string} category - Statistic category
170
- * @param {string|Object} data - Statistic data
171
- */
172
- trackStatistic(category, data) {
173
- if (category === "node") {
205
+ trackStatistic(categoryOrData, legacyData) {
206
+ let data;
207
+ if (typeof categoryOrData === "string") {
208
+ data = { ...legacyData, category: categoryOrData };
209
+ } else {
210
+ data = categoryOrData;
211
+ }
212
+ if (data.category === "node") {
174
213
  this.statistics.nodeTypes[data.elementName] = (this.statistics.nodeTypes[data.elementName] || 0) + 1;
175
214
  this.fileStructure.totalNodes++;
176
- } else if (category === "unknown") {
215
+ } else if (data.category === "unknown") {
177
216
  const addedElement = this.unknownElements.find((e) => e.elementName === data.elementName);
178
217
  if (addedElement) {
179
218
  addedElement.count += 1;
@@ -183,15 +222,16 @@ class Telemetry {
183
222
  };
184
223
  } else {
185
224
  this.unknownElements.push({
186
- ...data,
187
- count: 1
225
+ elementName: data.elementName,
226
+ count: 1,
227
+ attributes: data.attributes
188
228
  });
189
229
  }
190
- } else if (category === "error") {
230
+ } else if (data.category === "error") {
191
231
  this.errors.push(data);
192
232
  this.statistics.errorCount++;
193
233
  }
194
- if (data.marks?.length) {
234
+ if (data.category === "node" && data.marks?.length) {
195
235
  data.marks.forEach((mark) => {
196
236
  this.statistics.markTypes[mark.type] = (this.statistics.markTypes[mark.type] || 0) + 1;
197
237
  });
@@ -220,11 +260,11 @@ class Telemetry {
220
260
  }
221
261
  /**
222
262
  * Track file structure
223
- * @param {Object} structure - File structure information
224
- * @param {File} fileSource - original file
225
- * @param {String} documentId - document GUID
226
- * @param {string} documentIdentifier - document identifier (GUID or hash)
227
- * @param {string} internalId - document ID from settings.xml
263
+ * @param structure - File structure information
264
+ * @param fileSource - original file
265
+ * @param documentId - document GUID
266
+ * @param documentIdentifier - document identifier (GUID or hash)
267
+ * @param internalId - document ID from settings.xml
228
268
  */
229
269
  async trackFileStructure(structure, fileSource, documentId, documentIdentifier, internalId) {
230
270
  this.fileStructure = structure;
@@ -238,14 +278,14 @@ class Telemetry {
238
278
  }
239
279
  /**
240
280
  * Process document metadata
241
- * @param {File} file - Document file
242
- * @param {Object} options - Additional options
243
- * @returns {Promise<Object>} Document metadata
281
+ * @param file - Document file
282
+ * @param options - Additional options
283
+ * @returns Document metadata
244
284
  */
245
285
  async processDocument(file, options = {}) {
246
286
  if (!file) {
247
287
  console.warn("Telemetry: missing file source");
248
- return {};
288
+ return null;
249
289
  }
250
290
  return {
251
291
  guid: options.guid,
@@ -261,14 +301,12 @@ class Telemetry {
261
301
  };
262
302
  }
263
303
  isTelemetryDataChanged() {
264
- const initialStatistics = {};
265
- const initialFileStructure = {};
266
- if (Object.keys(this.statistics.nodeTypes).length <= 1) return;
267
- return this.statistics !== initialStatistics || initialFileStructure !== this.fileStructure || this.errors.length > 0 || this.unknownElements.length > 0;
304
+ if (Object.keys(this.statistics.nodeTypes).length <= 1) return false;
305
+ return Object.keys(this.statistics.nodeTypes).length > 0 || Object.keys(this.statistics.markTypes).length > 0 || Object.keys(this.statistics.attributes).length > 0 || this.statistics.errorCount > 0 || this.fileStructure.totalFiles > 0 || this.fileStructure.maxDepth > 0 || this.fileStructure.totalNodes > 0 || this.fileStructure.files.length > 0 || this.errors.length > 0 || this.unknownElements.length > 0;
268
306
  }
269
307
  /**
270
308
  * Sends current report
271
- * @returns {Promise<void>}
309
+ * @returns Promise that resolves when report is sent
272
310
  */
273
311
  async sendReport() {
274
312
  if (!this.enabled || !this.isTelemetryDataChanged()) return;
@@ -278,7 +316,8 @@ class Telemetry {
278
316
  type: "parsing",
279
317
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
280
318
  sessionId: this.sessionId,
281
- superdocId: this.superdocId,
319
+ documentGuid: this.documentGuid,
320
+ documentIdentifier: this.documentIdentifier,
282
321
  superdocVersion: this.superdocVersion,
283
322
  file: this.documentInfo,
284
323
  browser: this.getBrowserInfo(),
@@ -292,8 +331,8 @@ class Telemetry {
292
331
  }
293
332
  /**
294
333
  * Sends data to the service
295
- * @returns {Object} payload
296
- * @returns {Promise<void>}
334
+ * @param data - Payload to send
335
+ * @returns Promise that resolves when data is sent
297
336
  */
298
337
  async sendDataToTelemetry(data) {
299
338
  try {
@@ -316,12 +355,12 @@ class Telemetry {
316
355
  }
317
356
  /**
318
357
  * Generate unique identifier
319
- * @returns {string} Unique ID
358
+ * @returns Unique ID
320
359
  * @private
321
360
  */
322
361
  generateId() {
323
362
  const timestamp = Date.now();
324
- const random = randomBytes(4).toString("hex");
363
+ const random = Array.from(randomBytes(4)).map((b) => b.toString(16).padStart(2, "0")).join("");
325
364
  return `${timestamp}-${random}`;
326
365
  }
327
366
  /**
@@ -331,8 +370,7 @@ class Telemetry {
331
370
  this.statistics = {
332
371
  nodeTypes: {},
333
372
  markTypes: {},
334
- styleTypes: {},
335
- unknownElements: [],
373
+ attributes: {},
336
374
  errorCount: 0
337
375
  };
338
376
  this.fileStructure = {
@@ -345,6 +383,38 @@ class Telemetry {
345
383
  this.errors = [];
346
384
  }
347
385
  }
386
+ function hasUser(entry) {
387
+ return entry[1].user !== void 0;
388
+ }
389
+ const awarenessStatesToArray = (context, states) => {
390
+ const seenUsers = /* @__PURE__ */ new Set();
391
+ return Array.from(states.entries()).filter(hasUser).filter(([, value]) => {
392
+ const userEmail = value.user.email;
393
+ if (seenUsers.has(userEmail)) return false;
394
+ seenUsers.add(userEmail);
395
+ return true;
396
+ }).map(([key, value]) => {
397
+ const email = value.user.email;
398
+ let color = context.userColorMap.get(email);
399
+ if (!color) {
400
+ color = context.config.colors[context.colorIndex % context.config.colors.length];
401
+ context.userColorMap.set(email, color);
402
+ context.colorIndex++;
403
+ }
404
+ return {
405
+ clientId: key,
406
+ ...value.user,
407
+ color
408
+ };
409
+ });
410
+ };
411
+ const shuffleArray = (array) => {
412
+ for (let i = array.length - 1; i > 0; i--) {
413
+ const j = Math.floor(Math.random() * (i + 1));
414
+ [array[i], array[j]] = [array[j], array[i]];
415
+ }
416
+ return array;
417
+ };
348
418
  function set(target, key, val) {
349
419
  if (Array.isArray(target)) {
350
420
  target.length = Math.max(target.length, key);
@@ -3150,31 +3220,6 @@ class WebsocketProvider extends ObservableV2 {
3150
3220
  }
3151
3221
  }
3152
3222
  }
3153
- const awarenessStatesToArray = (context, states) => {
3154
- const seenUsers = /* @__PURE__ */ new Set();
3155
- return Array.from(states.entries()).filter(([, value]) => {
3156
- if (!value.user) return false;
3157
- return !seenUsers.has(value.user?.email) && seenUsers.add(value.user?.email);
3158
- }).map(([key, value]) => {
3159
- const email = value.user.email;
3160
- if (!context.userColorMap.has(email)) {
3161
- context.userColorMap.set(email, context.config.colors[context.colorIndex % context.config.colors.length]);
3162
- context.colorIndex++;
3163
- }
3164
- return {
3165
- clientId: key,
3166
- ...value.user,
3167
- color: context.userColorMap.get(email)
3168
- };
3169
- });
3170
- };
3171
- const shuffleArray = (array) => {
3172
- for (let i = array.length - 1; i > 0; i--) {
3173
- const j = Math.floor(Math.random() * (i + 1));
3174
- [array[i], array[j]] = [array[j], array[i]];
3175
- }
3176
- return array;
3177
- };
3178
3223
  function awarenessHandler(context, { changes = {}, states }) {
3179
3224
  const { added = [], removed = [] } = changes;
3180
3225
  const awarenessArray = awarenessStatesToArray(context, states);
@@ -17156,7 +17201,7 @@ const _sfc_main = {
17156
17201
  __name: "SuperDoc",
17157
17202
  emits: ["selection-update"],
17158
17203
  setup(__props, { emit: __emit }) {
17159
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-D2cnJhM1.es.js"));
17204
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-D52oZlMN.es.js"));
17160
17205
  const superdocStore = useSuperdocStore();
17161
17206
  const commentsStore = useCommentsStore();
17162
17207
  const {
@@ -17750,7 +17795,7 @@ const _sfc_main = {
17750
17795
  };
17751
17796
  }
17752
17797
  };
17753
- const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-715d68b1"]]);
17798
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-29e35f23"]]);
17754
17799
  const createSuperdocVueApp = () => {
17755
17800
  const app = createApp(App);
17756
17801
  const pinia = createPinia();
@@ -17920,7 +17965,7 @@ class SuperDoc extends EventEmitter {
17920
17965
  this.config.colors = shuffleArray(this.config.colors);
17921
17966
  this.userColorMap = /* @__PURE__ */ new Map();
17922
17967
  this.colorIndex = 0;
17923
- this.version = "0.29.0-next.7";
17968
+ this.version = "0.29.0-next.8";
17924
17969
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17925
17970
  this.superdocId = config.superdocId || v4();
17926
17971
  this.colors = this.config.colors;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./super-editor.es-607cvQXw.cjs");
3
+ const superEditor_es = require("./super-editor.es-DfufVFpB.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-DNPslOnx.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-BMKdFBfO.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {