@hiai-gg/docsmint 0.3.6 → 0.3.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 (237) hide show
  1. package/backend/src/lib/logger.ts +45 -15
  2. package/dist/backend/index.js +238 -150
  3. package/dist/frontend/CategoryDialog-DphkZqIB.js +611 -0
  4. package/dist/frontend/ConfirmDialog-BLF3x_hr.js +214 -0
  5. package/dist/frontend/CreateSnapshotDialog-D5vPvFTL.js +216 -0
  6. package/dist/frontend/DatePicker-CLNTdvTk.js +259 -0
  7. package/dist/frontend/DeleteDialog-DxYFJivN.js +174 -0
  8. package/dist/frontend/FolderDialog-CRVZM2Oi.js +250 -0
  9. package/dist/frontend/FolderNode-C2zG7uii.js +298 -0
  10. package/dist/frontend/FolderTreeSelector-CyB8y2Sm.js +103 -0
  11. package/dist/frontend/Icon-CooFj4Ee.js +64 -0
  12. package/dist/frontend/SettingsDialog-DCM4-N6_.js +1016 -0
  13. package/dist/frontend/ShareDialog-DYu3RKQu.js +165 -0
  14. package/dist/frontend/TagCreateDialog-DXQs2bL9.js +260 -0
  15. package/dist/frontend/api/attachments.d.ts +6 -0
  16. package/dist/frontend/api/attachments.js +2 -0
  17. package/dist/frontend/api/categories.js +1 -1
  18. package/dist/frontend/api/documents.js +1 -1
  19. package/dist/frontend/api/folders.js +1 -1
  20. package/dist/frontend/api/settings.js +1 -1
  21. package/dist/frontend/api/share.d.ts +5 -0
  22. package/dist/frontend/api/share.js +2 -0
  23. package/dist/frontend/api/tags.js +1 -1
  24. package/dist/frontend/api-keys-CpkrA8rD.js +35 -0
  25. package/dist/frontend/attachments-BuILSs56.js +50 -0
  26. package/dist/frontend/{settings-PCrOtied.js → auth-client-Cygmp1I2.js} +205 -265
  27. package/dist/frontend/awareness-snQ3RD9f.js +3714 -0
  28. package/dist/frontend/camera-iKXDOOWT.js +29 -0
  29. package/dist/frontend/{categories-BE6ZpZl8.js → categories-izQovv2w.js} +1 -1
  30. package/dist/frontend/check-D-UuvBuh.js +25 -0
  31. package/dist/frontend/chevron-down-CiPtYyFh.js +25 -0
  32. package/dist/frontend/circle-check-tSPE1V6t.js +29 -0
  33. package/dist/frontend/{client-B9hzI0W8.js → client-GbtOH90i.js} +1 -1
  34. package/dist/frontend/clipboard-Cgzxc0_R.js +16 -0
  35. package/dist/frontend/clock-DJHbHZb8.js +29 -0
  36. package/dist/frontend/clsx-C7bIvsDS.js +1738 -0
  37. package/dist/frontend/collaboration.d.ts +6 -0
  38. package/dist/frontend/collaboration.js +182 -0
  39. package/dist/frontend/components/category-dialog.d.ts +2 -0
  40. package/dist/frontend/components/category-dialog.js +2 -0
  41. package/dist/frontend/components/create-snapshot-dialog.d.ts +2 -0
  42. package/dist/frontend/components/create-snapshot-dialog.js +2 -0
  43. package/dist/frontend/components/delete-dialog.d.ts +2 -0
  44. package/dist/frontend/components/delete-dialog.js +2 -0
  45. package/dist/frontend/components/editor/document-editor.d.ts +3 -0
  46. package/dist/frontend/components/editor/document-editor.js +3032 -0
  47. package/dist/frontend/components/editor/document-title.d.ts +2 -0
  48. package/dist/frontend/components/editor/document-title.js +31 -0
  49. package/dist/frontend/components/editor/docx-serializer.d.ts +2 -0
  50. package/dist/frontend/components/editor/docx-serializer.js +14600 -0
  51. package/dist/frontend/components/editor/extensions.d.ts +2 -0
  52. package/dist/frontend/components/editor/extensions.js +2 -0
  53. package/dist/frontend/components/editor/markdown-toggle.d.ts +2 -0
  54. package/dist/frontend/components/editor/markdown-toggle.js +72 -0
  55. package/dist/frontend/components/editor/markdown.d.ts +1 -0
  56. package/dist/frontend/components/editor/markdown.js +2 -0
  57. package/dist/frontend/components/folder-node.d.ts +3 -0
  58. package/dist/frontend/components/folder-node.js +2 -0
  59. package/dist/frontend/components/folder-tree-selector.d.ts +2 -0
  60. package/dist/frontend/components/folder-tree-selector.js +2 -0
  61. package/dist/frontend/components/save-as-dialog.d.ts +2 -0
  62. package/dist/frontend/components/save-as-dialog.js +272 -0
  63. package/dist/frontend/components/settings.js +1 -1
  64. package/dist/frontend/components/share-dialog.d.ts +2 -0
  65. package/dist/frontend/components/share-dialog.js +2 -0
  66. package/dist/frontend/components/sidebar.js +1145 -3693
  67. package/dist/frontend/components/tag-create-dialog.d.ts +2 -0
  68. package/dist/frontend/components/tag-create-dialog.js +2 -0
  69. package/dist/frontend/components/version-history.d.ts +2 -0
  70. package/dist/frontend/components/version-history.js +294 -0
  71. package/dist/frontend/{context-DbnW5yib.js → context-BMD6XTPe.js} +0 -3
  72. package/dist/frontend/copy-GppwRMjX.js +32 -0
  73. package/dist/frontend/dashboard.js +1113 -1157
  74. package/dist/frontend/{SettingsDialog-D4pgFD0D.js → db-ByrlYfaI.js} +923 -2002
  75. package/dist/frontend/dialog-D6NxYVmy.js +213 -0
  76. package/dist/frontend/dndzone-BzsOINtP.js +1199 -0
  77. package/dist/frontend/doc-tabs.d.ts +7 -0
  78. package/dist/frontend/doc-tabs.js +14 -0
  79. package/dist/frontend/document-drop-coordinator-C4xHMjwC.js +68 -0
  80. package/dist/frontend/document-drop-coordinator.d.ts +2 -0
  81. package/dist/frontend/document-drop-coordinator.js +2 -0
  82. package/dist/frontend/{documents-DFVS9SsL.js → documents-BsDkvzCm.js} +1 -1
  83. package/dist/frontend/editorExtensions-BMHvUbdk.js +27021 -0
  84. package/dist/frontend/ellipsis-vertical-P9MHvCps.js +530 -0
  85. package/dist/frontend/extension.js +8 -7
  86. package/dist/frontend/floating-layer-anchor-CPwucTfd.js +4515 -0
  87. package/dist/frontend/folder-DeWhnD7O.js +45 -0
  88. package/dist/frontend/folder-refresh.d.ts +8 -0
  89. package/dist/frontend/folder-refresh.js +2 -0
  90. package/dist/frontend/{folders-CGe9diAG.js → folders-CTuV_JtU.js} +1 -1
  91. package/dist/frontend/frontend.css +1 -1
  92. package/dist/frontend/i18n.js +1 -1
  93. package/dist/frontend/identity-DyWeNzu_.js +69 -0
  94. package/dist/frontend/input-B5Rak-5G.js +23 -0
  95. package/dist/frontend/keyboard.d.ts +14 -0
  96. package/dist/frontend/keyboard.js +2 -0
  97. package/dist/frontend/keyboard.svelte-CApmX0vl.js +133 -0
  98. package/dist/frontend/label-CW9rxoAb.js +30 -0
  99. package/dist/frontend/loader-circle-BA6aLO71.js +268 -0
  100. package/dist/frontend/markdown-BwnyjITU.js +11 -0
  101. package/dist/frontend/messages-BpYaLbzE.js +1091 -0
  102. package/dist/frontend/offline/identity.d.ts +6 -0
  103. package/dist/frontend/offline/identity.js +2 -0
  104. package/dist/frontend/resolve-BG4HgzpN.js +19 -0
  105. package/dist/frontend/rolldown-runtime-CWhphoD1.js +23 -0
  106. package/dist/frontend/rotate-ccw-B4Q7brmV.js +25 -0
  107. package/dist/frontend/search.js +637 -602
  108. package/dist/frontend/select-value-sF86Geyh.js +1446 -0
  109. package/dist/frontend/settings-blyobazp.js +62 -0
  110. package/dist/frontend/share-Cu7SSJuJ.js +28 -0
  111. package/dist/frontend/shared-document.js +94 -93
  112. package/dist/frontend/subfolders-refresh-store.svelte-B2dKVmgz.js +65 -0
  113. package/dist/frontend/tag-HxRazVN_.js +54 -0
  114. package/dist/frontend/tag-store.svelte-CqrUXo0o.js +29 -0
  115. package/dist/frontend/{tags-DVXTut0p.js → tags-CtCV0Djo.js} +1 -1
  116. package/dist/frontend/textarea-i1720bE7.js +23 -0
  117. package/dist/frontend/theme.js +1 -1
  118. package/dist/frontend/theme.svelte-DKfCy12k.js +49 -0
  119. package/dist/frontend/types.d.ts +6 -0
  120. package/dist/frontend/types.js +0 -0
  121. package/dist/frontend/utils/clipboard.d.ts +1 -0
  122. package/dist/frontend/utils/clipboard.js +2 -0
  123. package/dist/frontend/utils/dndzone.d.ts +4 -0
  124. package/dist/frontend/utils/dndzone.js +2 -0
  125. package/dist/frontend/utils-CffiyuTo.js +19 -0
  126. package/dist/frontend/utils-hzdMVeCv.js +7 -0
  127. package/dist/frontend/utils.d.ts +4 -0
  128. package/dist/frontend/utils.js +2 -0
  129. package/dist/frontend/x-CzBsnJ2x.js +25 -0
  130. package/dist/frontend-ssr/api/attachments.js +2 -0
  131. package/dist/frontend-ssr/api/categories.js +2 -0
  132. package/dist/frontend-ssr/api/documents.js +2 -0
  133. package/dist/frontend-ssr/api/folders.js +2 -0
  134. package/dist/frontend-ssr/api/settings.js +2 -0
  135. package/dist/frontend-ssr/api/share.js +2 -0
  136. package/dist/frontend-ssr/api/tags.js +2 -0
  137. package/dist/frontend-ssr/assets/CategoryDialog-C2xaZKHq.js +584 -0
  138. package/dist/frontend-ssr/assets/ConfirmDialog-DjMFKc0V.js +420 -0
  139. package/dist/frontend-ssr/assets/CreateSnapshotDialog-BRw1xJW1.js +214 -0
  140. package/dist/frontend-ssr/assets/DatePicker-DnXniwlZ.js +312 -0
  141. package/dist/frontend-ssr/assets/DeleteDialog-BCfZy3Zn.js +154 -0
  142. package/dist/frontend-ssr/assets/FolderDialog-Dq7I2cKZ.js +429 -0
  143. package/dist/frontend-ssr/assets/FolderNode-DRfBfpft.js +171 -0
  144. package/dist/frontend-ssr/assets/FolderTreeSelector-DZNZ2oI6.js +147 -0
  145. package/dist/frontend-ssr/assets/Icon-B0Zqppjo.js +231 -0
  146. package/dist/frontend-ssr/assets/SettingsDialog-CX8Noa8A.js +1107 -0
  147. package/dist/frontend-ssr/assets/ShareDialog-Cge49ZdJ.js +54 -0
  148. package/dist/frontend-ssr/assets/TagCreateDialog-EAChgBF-.js +264 -0
  149. package/dist/frontend-ssr/assets/api-keys-DFqX39MT.js +35 -0
  150. package/dist/frontend-ssr/assets/attachments-CWBxE3Vz.js +85 -0
  151. package/dist/frontend-ssr/assets/auth-client-x26kqY8Z.js +1286 -0
  152. package/dist/frontend-ssr/assets/camera-CdxscTw-.js +84 -0
  153. package/dist/frontend-ssr/assets/categories-AOqgcsn4.js +75 -0
  154. package/dist/frontend-ssr/assets/chevron-down-CSSNGNh_.js +80 -0
  155. package/dist/frontend-ssr/assets/chevron-right-B4p7Sk6X.js +80 -0
  156. package/dist/frontend-ssr/assets/circle-check-CI1v4vYh.js +84 -0
  157. package/dist/frontend-ssr/assets/client-DZMkDkDn.js +129 -0
  158. package/dist/frontend-ssr/assets/clipboard-CXOaoz2W.js +30 -0
  159. package/dist/frontend-ssr/assets/clock-IL-eX2di.js +84 -0
  160. package/dist/frontend-ssr/assets/context-jz1GGEUi.js +45 -0
  161. package/dist/frontend-ssr/assets/copy-CjV57nGQ.js +87 -0
  162. package/dist/frontend-ssr/assets/db-CnxeO66n.js +65 -0
  163. package/dist/frontend-ssr/assets/dialog-BOV1u6zP.js +157 -0
  164. package/dist/frontend-ssr/assets/dndzone-DMvTO_Jz.js +2114 -0
  165. package/dist/frontend-ssr/assets/document-drop-coordinator-CEaYACsC.js +109 -0
  166. package/dist/frontend-ssr/assets/documents-BnOTRdTY.js +108 -0
  167. package/dist/frontend-ssr/assets/editorExtensions-DUzwndMy.js +186 -0
  168. package/dist/frontend-ssr/assets/ellipsis-vertical-C-0hgkZn.js +555 -0
  169. package/dist/frontend-ssr/assets/floating-layer-anchor-uzw9K8qN.js +6114 -0
  170. package/dist/frontend-ssr/assets/folder-DChhG7qN.js +80 -0
  171. package/dist/frontend-ssr/assets/folders-CTfbS24J.js +127 -0
  172. package/dist/frontend-ssr/assets/identity-B3uHoDtf.js +99 -0
  173. package/dist/frontend-ssr/assets/input-DezGsU3y.js +19 -0
  174. package/dist/frontend-ssr/assets/keyboard.svelte-BgF47N3L.js +174 -0
  175. package/dist/frontend-ssr/assets/label-Bj8-TfFN.js +21 -0
  176. package/dist/frontend-ssr/assets/loader-circle-DZsrZ-er.js +80 -0
  177. package/dist/frontend-ssr/assets/markdown-CjqvGi5W.js +20 -0
  178. package/dist/frontend-ssr/assets/messages-DhXqlcJI.js +11125 -0
  179. package/dist/frontend-ssr/assets/resolve-BqHozBXl.js +32 -0
  180. package/dist/frontend-ssr/assets/rotate-ccw-BlgWwaiq.js +80 -0
  181. package/dist/frontend-ssr/assets/select-value-DngdSmLI.js +1526 -0
  182. package/dist/frontend-ssr/assets/settings-E6qSAWM2.js +64 -0
  183. package/dist/frontend-ssr/assets/share-BTBJelxA.js +30 -0
  184. package/dist/frontend-ssr/assets/subfolders-refresh-store.svelte-DAh4gT16.js +77 -0
  185. package/dist/frontend-ssr/assets/tag-GZEuGWk1.js +166 -0
  186. package/dist/frontend-ssr/assets/tag-store.svelte-DPodKj6Z.js +21 -0
  187. package/dist/frontend-ssr/assets/tags-BId2wdYd.js +49 -0
  188. package/dist/frontend-ssr/assets/textarea-Dev-qSEc.js +21 -0
  189. package/dist/frontend-ssr/assets/theme.svelte-Co0-ssaD.js +67 -0
  190. package/dist/frontend-ssr/assets/utils-DtlPPXpJ.js +9 -0
  191. package/dist/frontend-ssr/assets/utils-DvZnctjz.js +23 -0
  192. package/dist/frontend-ssr/collaboration.js +39 -0
  193. package/dist/frontend-ssr/components/category-dialog.js +2 -0
  194. package/dist/frontend-ssr/components/create-snapshot-dialog.js +2 -0
  195. package/dist/frontend-ssr/components/delete-dialog.js +2 -0
  196. package/dist/frontend-ssr/components/editor/document-editor.js +2499 -0
  197. package/dist/frontend-ssr/components/editor/document-title.js +11 -0
  198. package/dist/frontend-ssr/components/editor/docx-serializer.js +186 -0
  199. package/dist/frontend-ssr/components/editor/extensions.js +2 -0
  200. package/dist/frontend-ssr/components/editor/markdown-toggle.js +20 -0
  201. package/dist/frontend-ssr/components/editor/markdown.js +2 -0
  202. package/dist/frontend-ssr/components/folder-node.js +2 -0
  203. package/dist/frontend-ssr/components/folder-tree-selector.js +2 -0
  204. package/dist/frontend-ssr/components/save-as-dialog.js +280 -0
  205. package/dist/frontend-ssr/components/settings.js +2 -0
  206. package/dist/frontend-ssr/components/share-dialog.js +2 -0
  207. package/dist/frontend-ssr/components/sidebar.js +2033 -0
  208. package/dist/frontend-ssr/components/tag-create-dialog.js +2 -0
  209. package/dist/frontend-ssr/components/version-history.js +370 -0
  210. package/dist/frontend-ssr/dashboard.js +2542 -0
  211. package/dist/frontend-ssr/doc-tabs.js +23 -0
  212. package/dist/frontend-ssr/document-drop-coordinator.js +2 -0
  213. package/dist/frontend-ssr/extension.js +13 -0
  214. package/dist/frontend-ssr/folder-refresh.js +2 -0
  215. package/dist/frontend-ssr/i18n.js +10 -0
  216. package/dist/frontend-ssr/keyboard.js +2 -0
  217. package/dist/frontend-ssr/offline/identity.js +2 -0
  218. package/dist/frontend-ssr/search.js +332 -0
  219. package/dist/frontend-ssr/shared-document.js +273 -0
  220. package/dist/frontend-ssr/theme.js +9 -0
  221. package/dist/frontend-ssr/types.js +1 -0
  222. package/dist/frontend-ssr/utils/clipboard.js +2 -0
  223. package/dist/frontend-ssr/utils/dndzone.js +2 -0
  224. package/dist/frontend-ssr/utils.js +2 -0
  225. package/package.json +130 -1
  226. package/packages/cli/src/index.ts +1 -1
  227. package/packages/db/src/schema.ts +3 -0
  228. package/packages/mcp-server/src/index.ts +1 -1
  229. package/dist/frontend/DatePicker-BcMD49PV.js +0 -275
  230. package/dist/frontend/ShareDialog-Dzh7rV7J.js +0 -1317
  231. package/dist/frontend/client-C6QQGb0e.js +0 -2766
  232. package/dist/frontend/input-ieWIt8I7.js +0 -257
  233. package/dist/frontend/messages-CTGAsqFu.js +0 -1106
  234. package/dist/frontend/resolve-Bl6xmJl_.js +0 -2068
  235. package/dist/frontend/tag-C5xrg-bb.js +0 -53
  236. package/dist/frontend/tag-store.svelte-B3839FYq.js +0 -6152
  237. package/dist/frontend/theme.svelte-ei0QxXa8.js +0 -49
@@ -0,0 +1,6 @@
1
+ import type { WebsocketProvider } from "y-websocket";
2
+ import type * as Y from "yjs";
3
+ export interface CollaborationSession { provider: WebsocketProvider; doc: Y.Doc; destroy(): void; }
4
+ export declare function startCollaboration(documentId: string, accessToken: string, onUpdate?: (update: Uint8Array) => void): CollaborationSession;
5
+ export declare function stopCollaboration(): void;
6
+ export declare function getActiveSession(): CollaborationSession | null;
@@ -0,0 +1,182 @@
1
+ import { $ as e, E as t, G as n, I as r, J as i, K as a, Q as o, R as s, T as c, V as l, W as u, X as d, Z as f, at as p, c as m, dt as h, ft as g, g as _, i as v, it as y, lt as b, mt as ee, n as x, nt as S, ot as C, q as w, r as T, rt as E, t as D, ut as O, z as k } from "./awareness-snQ3RD9f.js";
2
+ //#region ../node_modules/.bun/lib0@0.2.117/node_modules/lib0/broadcastchannel.js
3
+ var A = /* @__PURE__ */ new Map(), j = class {
4
+ constructor(e) {
5
+ this.room = e, this.onmessage = null, this._onChange = (t) => t.key === e && this.onmessage !== null && this.onmessage({ data: s(t.newValue || "") }), a(this._onChange);
6
+ }
7
+ postMessage(e) {
8
+ w.setItem(this.room, k(r(e)));
9
+ }
10
+ close() {
11
+ n(this._onChange);
12
+ }
13
+ }, te = typeof BroadcastChannel > "u" ? j : BroadcastChannel, M = (e) => ee(A, e, () => {
14
+ let t = g(), n = new te(e);
15
+ return n.onmessage = (e) => t.forEach((t) => t(e.data, "broadcastchannel")), {
16
+ bc: n,
17
+ subs: t
18
+ };
19
+ }), N = (e, t) => (M(e).subs.add(t), t), P = (e, t) => {
20
+ let n = M(e), r = n.subs.delete(t);
21
+ return r && n.subs.size === 0 && (n.bc.close(), A.delete(e)), r;
22
+ }, F = (e, t, n = null) => {
23
+ let r = M(e);
24
+ r.bc.postMessage(t), r.subs.forEach((e) => e(t, n));
25
+ }, I = (e, n) => {
26
+ p(e, 0), C(e, t(n));
27
+ }, L = (e, t, n) => {
28
+ p(e, 1), C(e, c(t, n));
29
+ }, R = (t, n, r) => L(n, r, e(t)), z = (t, n, r, i) => {
30
+ try {
31
+ _(n, e(t), r);
32
+ } catch (e) {
33
+ i?.(e), console.error("Caught error while handling a Yjs update", e);
34
+ }
35
+ }, B = (e, t) => {
36
+ p(e, 2), C(e, t);
37
+ }, V = z, H = (e, t, n, r, i) => {
38
+ let a = o(e);
39
+ switch (a) {
40
+ case 0:
41
+ R(e, t, n);
42
+ break;
43
+ case 1:
44
+ z(e, n, r, i);
45
+ break;
46
+ case 2:
47
+ V(e, n, r, i);
48
+ break;
49
+ default: throw Error("Unknown message type");
50
+ }
51
+ return a;
52
+ }, U = (e, t, n) => {
53
+ switch (o(e)) {
54
+ case 0: n(t, f(e));
55
+ }
56
+ }, W = (e) => u(e, (e, t) => `${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"), G = [];
57
+ G[0] = (e, t, n, r, i) => {
58
+ p(e, 0);
59
+ let a = H(t, e, n.doc, n);
60
+ r && a === 1 && !n.synced && (n.synced = !0);
61
+ }, G[3] = (e, t, n, r, i) => {
62
+ p(e, 1), C(e, T(n.awareness, Array.from(n.awareness.getStates().keys())));
63
+ }, G[1] = (t, n, r, i, a) => {
64
+ x(r.awareness, e(n), r);
65
+ }, G[2] = (e, t, n, r, i) => {
66
+ U(t, n.doc, (e, t) => q(n, t));
67
+ };
68
+ var K = 3e4, q = (e, t) => console.warn(`Permission denied to access ${e.url}.\n${t}`), J = (e, t, n) => {
69
+ let r = d(t), i = S(), a = o(r), s = e.messageHandlers[a];
70
+ return s ? s(i, r, e, n, a) : console.error("Unable to compute message"), i;
71
+ }, Y = (e, t, n) => {
72
+ t === e.ws && (e.emit("connection-close", [n, e]), e.ws = null, t.close(), e.wsconnecting = !1, e.wsconnected ? (e.wsconnected = !1, e.synced = !1, v(e.awareness, Array.from(e.awareness.getStates().keys()).filter((t) => t !== e.doc.clientID), e), e.emit("status", [{ status: "disconnected" }])) : e.wsUnsuccessfulReconnects++, setTimeout(X, b(O(2, e.wsUnsuccessfulReconnects) * 100, e.maxBackoffTime), e));
73
+ }, X = (e) => {
74
+ if (e.shouldConnect && e.ws === null) {
75
+ let t = new e._WS(e.url, e.protocols);
76
+ t.binaryType = "arraybuffer", e.ws = t, e.wsconnecting = !0, e.wsconnected = !1, e.synced = !1, t.onmessage = (n) => {
77
+ e.wsLastMessageReceived = i();
78
+ let r = J(e, new Uint8Array(n.data), !0);
79
+ E(r) > 1 && t.send(y(r));
80
+ }, t.onerror = (t) => {
81
+ e.emit("connection-error", [t, e]);
82
+ }, t.onclose = (n) => {
83
+ Y(e, t, n);
84
+ }, t.onopen = () => {
85
+ e.wsLastMessageReceived = i(), e.wsconnecting = !1, e.wsconnected = !0, e.wsUnsuccessfulReconnects = 0, e.emit("status", [{ status: "connected" }]);
86
+ let n = S();
87
+ if (p(n, 0), I(n, e.doc), t.send(y(n)), e.awareness.getLocalState() !== null) {
88
+ let n = S();
89
+ p(n, 1), C(n, T(e.awareness, [e.doc.clientID])), t.send(y(n));
90
+ }
91
+ }, e.emit("status", [{ status: "connecting" }]);
92
+ }
93
+ }, Z = (e, t) => {
94
+ let n = e.ws;
95
+ e.wsconnected && n && n.readyState === n.OPEN && n.send(t), e.bcconnected && F(e.bcChannel, t, e);
96
+ }, ne = class extends h {
97
+ constructor(e, t, n, { connect: r = !0, awareness: a = new D(n), params: o = {}, protocols: s = [], WebSocketPolyfill: c = WebSocket, resyncInterval: u = -1, maxBackoffTime: d = 2500, disableBc: f = !1 } = {}) {
98
+ for (super(); e[e.length - 1] === "/";) e = e.slice(0, e.length - 1);
99
+ this.serverUrl = e, this.bcChannel = e + "/" + t, this.maxBackoffTime = d, this.params = o, this.protocols = s, this.roomname = t, this.doc = n, this._WS = c, this.awareness = a, this.wsconnected = !1, this.wsconnecting = !1, this.bcconnected = !1, this.disableBc = f, this.wsUnsuccessfulReconnects = 0, this.messageHandlers = G.slice(), this._synced = !1, this.ws = null, this.wsLastMessageReceived = 0, this.shouldConnect = r, this._resyncInterval = 0, u > 0 && (this._resyncInterval = setInterval(() => {
100
+ if (this.ws && this.ws.readyState === WebSocket.OPEN) {
101
+ let e = S();
102
+ p(e, 0), I(e, n), this.ws.send(y(e));
103
+ }
104
+ }, u)), this._bcSubscriber = (e, t) => {
105
+ if (t !== this) {
106
+ let t = J(this, new Uint8Array(e), !1);
107
+ E(t) > 1 && F(this.bcChannel, y(t), this);
108
+ }
109
+ }, this._updateHandler = (e, t) => {
110
+ if (t !== this) {
111
+ let t = S();
112
+ p(t, 0), B(t, e), Z(this, y(t));
113
+ }
114
+ }, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: e, updated: t, removed: n }, r) => {
115
+ let i = e.concat(t).concat(n), o = S();
116
+ p(o, 1), C(o, T(a, i)), Z(this, y(o));
117
+ }, this._exitHandler = () => {
118
+ v(this.awareness, [n.clientID], "app closed");
119
+ }, l && typeof process < "u" && process.on("exit", this._exitHandler), a.on("update", this._awarenessUpdateHandler), this._checkInterval = setInterval(() => {
120
+ this.wsconnected && K < i() - this.wsLastMessageReceived && Y(this, this.ws, null);
121
+ }, K / 10), r && this.connect();
122
+ }
123
+ get url() {
124
+ let e = W(this.params);
125
+ return this.serverUrl + "/" + this.roomname + (e.length === 0 ? "" : "?" + e);
126
+ }
127
+ get synced() {
128
+ return this._synced;
129
+ }
130
+ set synced(e) {
131
+ this._synced !== e && (this._synced = e, this.emit("synced", [e]), this.emit("sync", [e]));
132
+ }
133
+ destroy() {
134
+ this._resyncInterval !== 0 && clearInterval(this._resyncInterval), clearInterval(this._checkInterval), this.disconnect(), l && typeof process < "u" && process.off("exit", this._exitHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.doc.off("update", this._updateHandler), super.destroy();
135
+ }
136
+ connectBc() {
137
+ if (this.disableBc) return;
138
+ this.bcconnected ||= (N(this.bcChannel, this._bcSubscriber), !0);
139
+ let e = S();
140
+ p(e, 0), I(e, this.doc), F(this.bcChannel, y(e), this);
141
+ let t = S();
142
+ p(t, 0), L(t, this.doc), F(this.bcChannel, y(t), this);
143
+ let n = S();
144
+ p(n, 3), F(this.bcChannel, y(n), this);
145
+ let r = S();
146
+ p(r, 1), C(r, T(this.awareness, [this.doc.clientID])), F(this.bcChannel, y(r), this);
147
+ }
148
+ disconnectBc() {
149
+ let e = S();
150
+ p(e, 1), C(e, T(this.awareness, [this.doc.clientID], /* @__PURE__ */ new Map())), Z(this, y(e)), this.bcconnected &&= (P(this.bcChannel, this._bcSubscriber), !1);
151
+ }
152
+ disconnect() {
153
+ this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && Y(this, this.ws, null);
154
+ }
155
+ connect() {
156
+ this.shouldConnect = !0, !this.wsconnected && this.ws === null && (X(this), this.connectBc());
157
+ }
158
+ }, Q = null;
159
+ function re(e, t, n) {
160
+ $();
161
+ let r = new m(), i = new ne(`${window.location.protocol === "https:" ? "wss:" : "ws:"}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ""}/api/ws/collab/${e}?token=${encodeURIComponent(t)}`, e, r, {
162
+ connect: !0,
163
+ params: { token: t }
164
+ });
165
+ i.on("sync", (e) => {}), i.on("status", (e) => {}), i.on("connection-close", () => {});
166
+ let a = n;
167
+ return a && r.on("update", a), Q = {
168
+ provider: i,
169
+ doc: r,
170
+ destroy: () => {
171
+ a && r.off("update", a), i.disconnect(), i.destroy(), r.destroy();
172
+ }
173
+ }, Q;
174
+ }
175
+ function $() {
176
+ Q &&= (Q.destroy(), null);
177
+ }
178
+ function ie() {
179
+ return Q;
180
+ }
181
+ //#endregion
182
+ export { ie as getActiveSession, re as startCollaboration, $ as stopCollaboration };
@@ -0,0 +1,2 @@
1
+ import type { Component } from "svelte";
2
+ export declare const CategoryDialog: Component;
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../CategoryDialog-DphkZqIB.js";
2
+ export { e as CategoryDialog };
@@ -0,0 +1,2 @@
1
+ import type { Component } from "svelte";
2
+ export declare const CreateSnapshotDialog: Component;
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../CreateSnapshotDialog-D5vPvFTL.js";
2
+ export { e as CreateSnapshotDialog };
@@ -0,0 +1,2 @@
1
+ import type { Component } from "svelte";
2
+ export declare const DeleteDialog: Component;
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../DeleteDialog-DxYFJivN.js";
2
+ export { e as DeleteDialog };
@@ -0,0 +1,3 @@
1
+ import type { Component } from "svelte";
2
+ export interface EditorOutput { markdown: string; json: object; }
3
+ export declare const DocsmintDocumentEditorHost: Component;