@univerjs-pro/collaboration-client 1.0.4 → 1.2.0

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 (102) hide show
  1. package/README.md +2 -0
  2. package/lib/cjs/facade.js +1 -1
  3. package/lib/cjs/index.js +1 -1
  4. package/lib/cjs/locale/ar-SA.js +1 -1
  5. package/lib/cjs/locale/ca-ES.js +1 -1
  6. package/lib/cjs/locale/de-DE.js +1 -1
  7. package/lib/cjs/locale/en-US.js +1 -1
  8. package/lib/cjs/locale/es-ES.js +1 -1
  9. package/lib/cjs/locale/fa-IR.js +1 -1
  10. package/lib/cjs/locale/fr-FR.js +1 -1
  11. package/lib/cjs/locale/id-ID.js +1 -1
  12. package/lib/cjs/locale/it-IT.js +1 -1
  13. package/lib/cjs/locale/ja-JP.js +1 -1
  14. package/lib/cjs/locale/ko-KR.js +1 -1
  15. package/lib/cjs/locale/pl-PL.js +1 -1
  16. package/lib/cjs/locale/pt-BR.js +1 -1
  17. package/lib/cjs/locale/ru-RU.js +1 -1
  18. package/lib/cjs/locale/sk-SK.js +1 -1
  19. package/lib/cjs/locale/vi-VN.js +1 -1
  20. package/lib/cjs/locale/zh-CN.js +1 -1
  21. package/lib/cjs/locale/zh-HK.js +1 -1
  22. package/lib/cjs/locale/zh-TW.js +1 -1
  23. package/lib/es/facade.js +1 -1
  24. package/lib/es/index.js +1 -1
  25. package/lib/es/locale/ar-SA.js +1 -1
  26. package/lib/es/locale/ca-ES.js +1 -1
  27. package/lib/es/locale/de-DE.js +1 -1
  28. package/lib/es/locale/en-US.js +1 -1
  29. package/lib/es/locale/es-ES.js +1 -1
  30. package/lib/es/locale/fa-IR.js +1 -1
  31. package/lib/es/locale/fr-FR.js +1 -1
  32. package/lib/es/locale/id-ID.js +1 -1
  33. package/lib/es/locale/it-IT.js +1 -1
  34. package/lib/es/locale/ja-JP.js +1 -1
  35. package/lib/es/locale/ko-KR.js +1 -1
  36. package/lib/es/locale/pl-PL.js +1 -1
  37. package/lib/es/locale/pt-BR.js +1 -1
  38. package/lib/es/locale/ru-RU.js +1 -1
  39. package/lib/es/locale/sk-SK.js +1 -1
  40. package/lib/es/locale/vi-VN.js +1 -1
  41. package/lib/es/locale/zh-CN.js +1 -1
  42. package/lib/es/locale/zh-HK.js +1 -1
  43. package/lib/es/locale/zh-TW.js +1 -1
  44. package/lib/facade.js +1 -1
  45. package/lib/index.js +1 -1
  46. package/lib/locale/ar-SA.js +1 -1
  47. package/lib/locale/ca-ES.js +1 -1
  48. package/lib/locale/de-DE.js +1 -1
  49. package/lib/locale/en-US.js +1 -1
  50. package/lib/locale/es-ES.js +1 -1
  51. package/lib/locale/fa-IR.js +1 -1
  52. package/lib/locale/fr-FR.js +1 -1
  53. package/lib/locale/id-ID.js +1 -1
  54. package/lib/locale/it-IT.js +1 -1
  55. package/lib/locale/ja-JP.js +1 -1
  56. package/lib/locale/ko-KR.js +1 -1
  57. package/lib/locale/pl-PL.js +1 -1
  58. package/lib/locale/pt-BR.js +1 -1
  59. package/lib/locale/ru-RU.js +1 -1
  60. package/lib/locale/sk-SK.js +1 -1
  61. package/lib/locale/vi-VN.js +1 -1
  62. package/lib/locale/zh-CN.js +1 -1
  63. package/lib/locale/zh-HK.js +1 -1
  64. package/lib/locale/zh-TW.js +1 -1
  65. package/lib/types/config/config.d.ts +19 -0
  66. package/lib/types/controllers/collaboration/changeset-submitter.d.ts +132 -0
  67. package/lib/types/controllers/collaboration/collaboration-entity.d.ts +28 -1
  68. package/lib/types/controllers/collaboration/collaboration-state.d.ts +175 -43
  69. package/lib/types/controllers/collaboration/collaboration.controller.d.ts +7 -0
  70. package/lib/types/controllers/collaboration/utils/changeset-utils.d.ts +7 -3
  71. package/lib/types/facade/f-collaboration.d.ts +20 -4
  72. package/lib/types/facade/f-event.d.ts +87 -2
  73. package/lib/types/index.d.ts +5 -3
  74. package/lib/types/services/collaboration-session/collaboration-session.d.ts +4 -8
  75. package/lib/types/services/collaboration-session/collaboration-session.service.d.ts +4 -4
  76. package/lib/types/services/collaboration-ui-event/collaboration-ui-event.d.ts +9 -0
  77. package/lib/types/services/data-loader/data-loader.service.d.ts +9 -2
  78. package/lib/types/services/local-cache/local-cache.service.d.ts +11 -6
  79. package/lib/types/services/socket/collaboration-socket.service.d.ts +10 -2
  80. package/lib/types/services/undoredo/collaborative-undoredo.service.d.ts +5 -0
  81. package/lib/umd/facade.js +1 -1
  82. package/lib/umd/index.js +1 -1
  83. package/lib/umd/locale/ar-SA.js +1 -1
  84. package/lib/umd/locale/ca-ES.js +1 -1
  85. package/lib/umd/locale/de-DE.js +1 -1
  86. package/lib/umd/locale/en-US.js +1 -1
  87. package/lib/umd/locale/es-ES.js +1 -1
  88. package/lib/umd/locale/fa-IR.js +1 -1
  89. package/lib/umd/locale/fr-FR.js +1 -1
  90. package/lib/umd/locale/id-ID.js +1 -1
  91. package/lib/umd/locale/it-IT.js +1 -1
  92. package/lib/umd/locale/ja-JP.js +1 -1
  93. package/lib/umd/locale/ko-KR.js +1 -1
  94. package/lib/umd/locale/pl-PL.js +1 -1
  95. package/lib/umd/locale/pt-BR.js +1 -1
  96. package/lib/umd/locale/ru-RU.js +1 -1
  97. package/lib/umd/locale/sk-SK.js +1 -1
  98. package/lib/umd/locale/vi-VN.js +1 -1
  99. package/lib/umd/locale/zh-CN.js +1 -1
  100. package/lib/umd/locale/zh-HK.js +1 -1
  101. package/lib/umd/locale/zh-TW.js +1 -1
  102. package/package.json +16 -16
@@ -7,8 +7,7 @@ import type { IDisposable } from '@univerjs/core';
7
7
  import type { FDocument } from '@univerjs/docs/facade';
8
8
  import type { IMember } from '@univerjs/protocol';
9
9
  import type { FWorkbook } from '@univerjs/sheets/facade';
10
- import { SnapshotService } from '@univerjs-pro/collaboration';
11
- import { CollaborationController, CollaborationStatus } from '@univerjs-pro/collaboration-client';
10
+ import { CollaborationController, CollaborationStatus, DataLoaderService } from '@univerjs-pro/collaboration-client';
12
11
  import { Injector, IUniverInstanceService } from '@univerjs/core';
13
12
  import { FBase } from '@univerjs/core/facade';
14
13
  export interface ICollaborationFlushOptions {
@@ -27,7 +26,7 @@ export declare class FCollaboration extends FBase {
27
26
  private readonly _handler;
28
27
  protected readonly _injector: Injector;
29
28
  protected readonly _univerInstanceService: IUniverInstanceService;
30
- protected readonly _snapshotService: SnapshotService;
29
+ protected readonly _dataLoaderService: DataLoaderService;
31
30
  protected readonly _collaborationController: CollaborationController;
32
31
  constructor(_handler: {
33
32
  getWorkbook: (id: string) => FWorkbook | null;
@@ -36,7 +35,7 @@ export declare class FCollaboration extends FBase {
36
35
  getBase: (id: string) => FBaseFacade | null;
37
36
  getBoard: (id: string) => FBoard | null;
38
37
  getPdf: (id: string) => FPdf | null;
39
- }, _injector: Injector, _univerInstanceService: IUniverInstanceService, _snapshotService: SnapshotService, _collaborationController: CollaborationController);
38
+ }, _injector: Injector, _univerInstanceService: IUniverInstanceService, _dataLoaderService: DataLoaderService, _collaborationController: CollaborationController);
40
39
  /**
41
40
  * Load a Univer Sheet from the server with a unit ID.
42
41
  * @param {string} unitId ID of the Univer Sheet that you would like to load.
@@ -161,6 +160,23 @@ export declare class FCollaboration extends FBase {
161
160
  * ```
162
161
  */
163
162
  getCollaborationStatus(unitId?: string): CollaborationStatus;
163
+ /**
164
+ * Whether a unit has local edits that the server has not acknowledged yet, including edits that are
165
+ * waiting to be sent, sent and awaiting acknowledgement, or cached while offline.
166
+ *
167
+ * @param {string} [unitId] Optional unit ID. If omitted, uses the focused unit.
168
+ * @returns {boolean} `true` when there are unacknowledged local edits.
169
+ *
170
+ * @example
171
+ * ```typescript
172
+ * window.addEventListener('beforeunload', (event) => {
173
+ * if (univerAPI.getCollaboration().hasWritePending()) {
174
+ * event.preventDefault();
175
+ * }
176
+ * });
177
+ * ```
178
+ */
179
+ hasWritePending(unitId?: string): boolean;
164
180
  /**
165
181
  * Wait until all currently queued collaboration changes for a unit are synchronized.
166
182
  *
@@ -1,5 +1,33 @@
1
- import type { CollaborationStatus } from '@univerjs-pro/collaboration-client';
1
+ import type { ChangesetResendReason, CollaborationStatus, ConflictReason, IRemoteRevertInfo, IUnitCacheData } from '@univerjs-pro/collaboration-client';
2
2
  import type { IEventBase } from '@univerjs/core/facade';
3
+ /**
4
+ * Fired once when a unit enters `CollaborationStatus.CONFLICT`, after its offline cache has been cleared. Carries the
5
+ * reason and the local edits the server has not acknowledged.
6
+ */
7
+ export interface ICollaborationConflictEventParams extends IEventBase {
8
+ /** The unit ID that entered the conflict status */
9
+ unitId: string;
10
+ /**
11
+ * - `transform_failed`: a remote changeset could not be transformed against the local edits
12
+ * - `apply_failed`: a remote changeset was transformed but one of its mutations failed to execute
13
+ * - `changeset_rejected`: the server rejected the local changeset
14
+ * - `permission_rejected`: the server rejected the local changeset for lack of permission
15
+ * - `remote_revert`: another collaborator reverted the unit to a historical revision
16
+ */
17
+ reason: ConflictReason;
18
+ /** The error message, when the conflict was caused by an error */
19
+ message?: string;
20
+ /** The revert that caused the conflict, when `reason` is `remote_revert` */
21
+ revert?: IRemoteRevertInfo;
22
+ /**
23
+ * The local edits the server has not acknowledged, in the format of the offline cache, or `null` when there
24
+ * are none. Not available after this event. `awaitingChangeset` has been sent; whether the server applied it is
25
+ * unknown.
26
+ */
27
+ localChanges: IUnitCacheData | null;
28
+ /** Whether the offline cache of the unit was cleared. When `false`, a page reload replays the cached edits. */
29
+ cacheCleared: boolean;
30
+ }
3
31
  /**
4
32
  * Event triggered when collaboration status changes for a unit
5
33
  */
@@ -9,10 +37,36 @@ export interface ICollaborationStatusChangedEventParams extends IEventBase {
9
37
  */
10
38
  unitId: string;
11
39
  /**
12
- * The new collaboration status
40
+ * The new collaboration status. When it is `CONFLICT`, the `CollaborationConflict` event follows with the reason
41
+ * and the unacknowledged local edits.
13
42
  */
14
43
  status: CollaborationStatus;
15
44
  }
45
+ /**
46
+ * Event triggered every time a changeset is sent to the server again because it was not acknowledged.
47
+ * The first send of a changeset does not trigger it.
48
+ */
49
+ export interface ICollaborationChangesetResendEventParams extends IEventBase {
50
+ /** The unit ID whose changeset was resent */
51
+ unitId: string;
52
+ /** The request ID of the changeset within the current editing session */
53
+ reqId: number;
54
+ /**
55
+ * Why the changeset was resent:
56
+ * - `ack_timeout`: no acknowledgement arrived in time
57
+ * - `should_retry`: the server asked for the changeset to be resent
58
+ * - `reconnect`: the connection was restored or the changeset was restored from the local cache
59
+ */
60
+ reason: ChangesetResendReason;
61
+ /** How many times the changeset has been resent, counting this one */
62
+ attempt: number;
63
+ /** Milliseconds since the changeset was first sent */
64
+ elapsedMs: number;
65
+ /** Local mutations the server has not acknowledged yet, including those not sent yet */
66
+ unsyncedMutationCount: number;
67
+ /** Milliseconds until the next resend if the server stays silent */
68
+ nextDelayMs: number;
69
+ }
16
70
  /**
17
71
  * Collaboration event name mixin interface
18
72
  * @ignore
@@ -34,6 +88,35 @@ export interface IFCollaborationEventNameMixin {
34
88
  * ```
35
89
  */
36
90
  readonly CollaborationStatusChanged: 'CollaborationStatusChanged';
91
+ /**
92
+ * Event triggered once per conflict, after the unit's offline cache was cleared: the reason and the local edits
93
+ * the server has not acknowledged
94
+ * @see {@link ICollaborationConflictEventParams}
95
+ * @example
96
+ * ```typescript
97
+ * univerAPI.addEvent(univerAPI.Event.CollaborationConflict, (event) => {
98
+ * const { unitId, reason, localChanges, cacheCleared } = event;
99
+ * if (localChanges) saveSomewhere(unitId, localChanges);
100
+ * if (reason === 'permission_rejected') return showNoPermission(unitId);
101
+ * if (cacheCleared) window.location.reload();
102
+ * });
103
+ * ```
104
+ */
105
+ readonly CollaborationConflict: 'CollaborationConflict';
106
+ /**
107
+ * Event triggered every time a changeset is resent because the server did not acknowledge it
108
+ * @see {@link ICollaborationChangesetResendEventParams}
109
+ * @example
110
+ * ```typescript
111
+ * univerAPI.addEvent(univerAPI.Event.CollaborationChangesetResend, (event) => {
112
+ * const { unitId, reason, attempt, unsyncedMutationCount, elapsedMs } = event;
113
+ * if (reason === 'ack_timeout' && attempt >= 2) {
114
+ * console.warn(`${unsyncedMutationCount} unsaved mutations of ${unitId} for ${Math.round(elapsedMs / 1000)}s`);
115
+ * }
116
+ * });
117
+ * ```
118
+ */
119
+ readonly CollaborationChangesetResend: 'CollaborationChangesetResend';
37
120
  }
38
121
  /**
39
122
  * Collaboration event parameter configuration
@@ -41,6 +124,8 @@ export interface IFCollaborationEventNameMixin {
41
124
  */
42
125
  export interface ICollaborationEventParamConfig {
43
126
  CollaborationStatusChanged: ICollaborationStatusChangedEventParams;
127
+ CollaborationConflict: ICollaborationConflictEventParams;
128
+ CollaborationChangesetResend: ICollaborationChangesetResendEventParams;
44
129
  }
45
130
  declare module '@univerjs/core/facade' {
46
131
  interface FEventName extends IFCollaborationEventNameMixin {
@@ -2,10 +2,12 @@ export { DEFAULT_WS_SESSION_TICKET_URL, HEARTBEAT_INTERVAL_KEY, HEARTBEAT_TIMEOU
2
2
  export { DEFAULT_COLLAB_WEB_SOCKET_URL, DEFAULT_REMOTE_UNISCRIPT_EXECUTION_ENDPOINT, REMOTE_UNISCRIPT_EXECUTION_ENDPOINT_KEY, } from './config/config';
3
3
  export type { IUniverCollaborationClientConfig } from './config/config';
4
4
  export { COLLABORATION_CLIENT_PLUGIN_CONFIG_KEY } from './config/config';
5
+ export { ChangesetSubmitter, DEFAULT_ACK_TIMEOUT, MAX_ACK_TIMEOUT } from './controllers/collaboration/changeset-submitter';
6
+ export type { ChangesetResendReason, IChangesetResendEvent, IChangesetSubmitterOptions, IChangesetSubmitterSource, SendChangeset } from './controllers/collaboration/changeset-submitter';
5
7
  export { BaseCollaborationEntity, BoardCollaborationEntity, CollaborationEntity, DocCollaborationEntity, PdfCollaborationEntity, SheetCollaborationEntity, SlideCollaborationEntity, } from './controllers/collaboration/collaboration-entity';
6
- export type { IDocCollaborationEntityCallback } from './controllers/collaboration/collaboration-entity';
8
+ export type { ICollaborationConflictEvent, IDocCollaborationEntityCallback } from './controllers/collaboration/collaboration-entity';
7
9
  export { AwaitingState, AwaitingWithPendingState, CollaborationStatus, ConflictState, FetchingMissState, OfflineState, PendingState, SyncedState, } from './controllers/collaboration/collaboration-state';
8
- export type { ISelectionTransformTransaction } from './controllers/collaboration/collaboration-state';
10
+ export type { ConflictReason, IConflictInfo, IRemoteRevertInfo, ISelectionTransformTransaction, } from './controllers/collaboration/collaboration-state';
9
11
  export { CollaborationController } from './controllers/collaboration/collaboration.controller';
10
12
  export { UniverCollaborationClientPlugin } from './plugin';
11
13
  export { CollaborationAttachmentIoService, IAttachmentIoService, } from './services/attachment-remote/attachment-io.service';
@@ -27,7 +29,7 @@ export { INetworkConditionService } from './services/network-condition/network-c
27
29
  export { SheetTransformSelectionsService } from './services/range-selection/sheet-transform-selections.service';
28
30
  export { ISingleActiveUnitService, UnitStatus } from './services/single-active-unit/single-active-unit.service';
29
31
  export { SnapshotServerOverHTTPService } from './services/snapshot-server/snapshot-server.service';
30
- export type { ICollaborationSocket } from './services/socket/collaboration-socket.service';
32
+ export type { ICollaborationSendOptions, ICollaborationSocket } from './services/socket/collaboration-socket.service';
31
33
  export { CollaborationSocketService, ICollaborationSocketService, } from './services/socket/collaboration-socket.service';
32
34
  export { deserializeToCombResponse, serializeCombRequest } from './services/socket/serialize';
33
35
  export { CollaborativeUndoRedoService } from './services/undoredo/collaborative-undoredo.service';
@@ -1,9 +1,9 @@
1
1
  import type { ICollaborationEvent } from '@univerjs-pro/collaboration';
2
2
  import type { IDisposable, Nullable } from '@univerjs/core';
3
3
  import type { Observable } from 'rxjs';
4
- import type { ICollaborationSocket } from '../socket/collaboration-socket.service';
4
+ import type { ICollaborationSendOptions, ICollaborationSocket } from '../socket/collaboration-socket.service';
5
5
  import type { ICollaborationSessionIdentity } from './collaboration-client-adapter';
6
- import { IConfigService, ILogService, RxDisposable } from '@univerjs/core';
6
+ import { ILogService, RxDisposable } from '@univerjs/core';
7
7
  import { ITelemetryService } from '@univerjs/telemetry';
8
8
  import { CollaborationUIEventService } from '../collaboration-ui-event/collaboration-ui-event';
9
9
  import { CommentService } from '../comment/comment.service';
@@ -29,7 +29,6 @@ export declare const FailedReason: {
29
29
  export declare class CollaborationSession extends RxDisposable implements IDisposable {
30
30
  private readonly _identity;
31
31
  private readonly _logService;
32
- private readonly _configService;
33
32
  private readonly _memberService;
34
33
  private readonly _commentService;
35
34
  private readonly _collaborationUIEventService;
@@ -41,7 +40,7 @@ export declare class CollaborationSession extends RxDisposable implements IDispo
41
40
  readonly event$: Observable<ICollaborationEvent>;
42
41
  private _socket;
43
42
  private _socketMessageSubscription;
44
- constructor(_identity: ICollaborationSessionIdentity, socket$: Observable<Nullable<ICollaborationSocket>>, _logService: ILogService, _configService: IConfigService, _memberService: MemberService, _commentService: CommentService, _collaborationUIEventService: CollaborationUIEventService, _telemetryService?: ITelemetryService | undefined);
43
+ constructor(_identity: ICollaborationSessionIdentity, socket$: Observable<Nullable<ICollaborationSocket>>, _logService: ILogService, _memberService: MemberService, _commentService: CommentService, _collaborationUIEventService: CollaborationUIEventService, _telemetryService?: ITelemetryService | undefined);
45
44
  getMemberID(): string | null;
46
45
  dispose(): void;
47
46
  close(): void;
@@ -54,10 +53,7 @@ export declare class CollaborationSession extends RxDisposable implements IDispo
54
53
  /**
55
54
  * Send event to the collaboration server.
56
55
  */
57
- send(event: ICollaborationEvent, _unitID: string): Promise<void>;
58
- private _collaborationTimeoutTimer;
59
- private _scheduleCollaborationTimeoutTimer;
60
- private _clearCollaborationTimeoutTimer;
56
+ send(event: ICollaborationEvent, _unitID: string, options?: ICollaborationSendOptions): Promise<void>;
61
57
  private _shouldReportTelemetry;
62
58
  private _telemetryInfo;
63
59
  private _startTelemetryCollaborationNewChangeset;
@@ -1,9 +1,8 @@
1
1
  import type { Nullable, UniverInstanceType } from '@univerjs/core';
2
+ import { Disposable, IConfigService, ILogService, Injector } from '@univerjs/core';
2
3
  import type { ICollaborationSocket } from '../socket/collaboration-socket.service';
3
4
  import type { ICollaborationClientAdapter } from './collaboration-client-adapter';
4
- import { Disposable, IConfigService, ILogService, Injector } from '@univerjs/core';
5
5
  import { CollaborationUIEventService } from '../collaboration-ui-event/collaboration-ui-event';
6
- import { INetworkConditionService } from '../network-condition/network-condition.service';
7
6
  import { ICollaborationSocketService } from '../socket/collaboration-socket.service';
8
7
  import { CollaborationSession, SessionStatus } from './collaboration-session';
9
8
  /**
@@ -17,18 +16,18 @@ export declare class CollaborationSessionService extends Disposable {
17
16
  private readonly _socketService;
18
17
  private readonly _collaborationUIEventService;
19
18
  private readonly _adapter;
20
- private readonly _networkConditionService?;
21
19
  private _sessions;
22
20
  private _pendingSessions;
23
21
  private _sessionChannels;
24
22
  private _socketChannels;
23
+ private _networkConditionService?;
25
24
  /**
26
25
  * Socket for collaboration sessions on the default endpoint.
27
26
  */
28
27
  readonly socket$: import("rxjs").Observable<Nullable<ICollaborationSocket>>;
29
28
  private _status$;
30
29
  status$: import("rxjs").Observable<SessionStatus>;
31
- constructor(_injector: Injector, _logService: ILogService, _configService: IConfigService, _socketService: ICollaborationSocketService, _collaborationUIEventService: CollaborationUIEventService, _adapter: ICollaborationClientAdapter, _networkConditionService?: INetworkConditionService | undefined);
30
+ constructor(_injector: Injector, _logService: ILogService, _configService: IConfigService, _socketService: ICollaborationSocketService, _collaborationUIEventService: CollaborationUIEventService, _adapter: ICollaborationClientAdapter);
32
31
  private _listenToNetworkCondition;
33
32
  dispose(): void;
34
33
  /**
@@ -66,6 +65,7 @@ export declare class CollaborationSessionService extends Disposable {
66
65
  private _onMessage;
67
66
  private _hasSessionsForEndpoint;
68
67
  private _getSocketChannel;
68
+ private _clearHandshakeTimer;
69
69
  private _rescheduleHeartbeat;
70
70
  private _sendHeartbeat;
71
71
  private _waitForHeartbeatResponse;
@@ -2,17 +2,26 @@ export interface ICollaborationUIEvent {
2
2
  id: CollaborationUIEventId;
3
3
  data?: string;
4
4
  unitID?: string;
5
+ userId?: string;
5
6
  }
6
7
  export declare enum CollaborationUIEventId {
7
8
  OTHER_CLIENT_EDITING = "OTHER_CLIENT_EDITING",
9
+ /** @deprecated No longer emitted. Use `CollaborationEntity.conflict$` or the `CollaborationConflict` facade event. */
8
10
  PERMISSION_DENIED = "PERMISSION_DENIED",
11
+ /** A unit entered the conflict state; `unitID` is set. */
9
12
  CONFLICT_PROCESSING = "CONFLICT_PROCESSING",
13
+ /** Clearing the offline cache of a conflicted unit failed; `unitID` and `userId` are set. */
10
14
  CONFLICT_CACHE_CLEAR_FAILED = "CONFLICT_CACHE_CLEAR_FAILED",
15
+ /** @deprecated No longer emitted. Use `CollaborationEntity.conflict$` or the `CollaborationConflict` facade event. */
11
16
  CONFLICT = "CONFLICT",
12
17
  CLOSE_ROOM = "CLOSE_ROOM",
13
18
  JOIN_ROOM_FAILED = "JOIN_ROOM_FAILED",
14
19
  SOCKET_FAILED_RETRY = "SOCKET_FAILED_RETRY",
15
20
  SOCKET_FAILED = "SOCKET_FAILED",
21
+ /**
22
+ * @deprecated No longer emitted. Unacknowledged changesets are resent automatically; subscribe to
23
+ * `CollaborationEntity.changesetResend$` (or the `CollaborationChangesetResend` facade event) instead.
24
+ */
16
25
  SUBMIT_CHANGESET_TIMEOUT = "SUBMIT_CHANGESET_TIMEOUT"
17
26
  }
18
27
  export declare class CollaborationUIEventService {
@@ -1,3 +1,4 @@
1
+ import type { ILogContext } from '@univerjs-pro/collaboration';
1
2
  import type { UnitModel } from '@univerjs/core';
2
3
  import { SnapshotService } from '@univerjs-pro/collaboration';
3
4
  import { ILogService, RxDisposable, UniverInstanceType } from '@univerjs/core';
@@ -20,6 +21,12 @@ export declare class DataLoaderService extends RxDisposable {
20
21
  readonly unitLoaded$: import("rxjs").Observable<UnitModel<object, UniverInstanceType>>;
21
22
  constructor(_logService: ILogService, _snapshotService: SnapshotService, _localCacheService?: ILocalCacheService | undefined);
22
23
  dispose(): void;
23
- loadUnitOfRevision(unitId: string, type: UniverInstanceType, rev: number, subUnitId?: string): Promise<UnitModel | null>;
24
- loadUnit(unitId: string, type: UniverInstanceType, subUnitId?: string): Promise<UnitModel | null>;
24
+ loadUnitOfRevision(unitId: string, type: UniverInstanceType, rev: number, subUnitId?: string, context?: ILogContext): Promise<UnitModel | null>;
25
+ /**
26
+ * Load a unit from the server. Edits cached locally are replayed on the revision they were cached on, so the
27
+ * snapshot of that revision is loaded when there are any.
28
+ */
29
+ loadUnit(unitId: string, type: UniverInstanceType, subUnitId?: string, context?: ILogContext): Promise<UnitModel | null>;
30
+ private _loadUnit;
31
+ private _loadSnapshot;
25
32
  }
@@ -2,21 +2,26 @@ import type { IChangeset } from '@univerjs-pro/collaboration';
2
2
  import type { IMutationInfo, Nullable, UniverInstanceType } from '@univerjs/core';
3
3
  export interface IUnitCacheData {
4
4
  unitID: string;
5
+ userId?: string | null;
5
6
  type: UniverInstanceType;
6
7
  rev: number;
7
8
  awaitingChangeset: Nullable<IChangeset>;
8
9
  mutations: IMutationInfo[];
9
10
  }
11
+ /**
12
+ * Omit userId to use the current UserManagerService user. An explicit empty string
13
+ * or null targets document-only data, including retries after an account change.
14
+ */
10
15
  export interface ILocalCacheService {
11
- loadOfflineData(unitID: string): Promise<Nullable<IUnitCacheData>>;
12
- saveOfflineData(unitID: string, data: IUnitCacheData): Promise<boolean>;
13
- backupOfflineData?(unitID: string, reason: string): Promise<void>;
14
- clearOfflineData(unitID: string): Promise<void>;
15
- updateOfflineData(unitID: string, type: UniverInstanceType, awaitingChangeset: Nullable<IChangeset>, pendingMutations: IMutationInfo[]): void;
16
+ loadOfflineData(unitID: string, userId?: string | null): Promise<Nullable<IUnitCacheData>>;
17
+ saveOfflineData(unitID: string, data: IUnitCacheData, userId?: string | null): Promise<boolean>;
18
+ backupOfflineData?(unitID: string, reason: string, userId?: string | null): Promise<void>;
19
+ clearOfflineData(unitID: string, userId?: string | null): Promise<void>;
20
+ updateOfflineData(unitID: string, type: UniverInstanceType, awaitingChangeset: Nullable<IChangeset>, pendingMutations: IMutationInfo[], userId?: string | null): void;
16
21
  disableLocalCache(): void;
17
22
  enableLocalCache(): void;
18
23
  exhaustSavingTask(): Promise<void>;
19
24
  saveTaskMap: Map<string, number>;
20
25
  }
21
26
  export declare const ILocalCacheService: import("@wendellhu/redi").IdentifierDecorator<ILocalCacheService>;
22
- export declare function getLocalCacheKey(unitID: string): string;
27
+ export declare function getLocalCacheKey(unitID: string, userId?: string | null): string;
@@ -10,10 +10,18 @@ import { HTTPService } from '@univerjs/network';
10
10
  * A special wrapper around of the original {@link ISocket} implementation to
11
11
  * for collaboration.
12
12
  */
13
+ export interface ICollaborationSendOptions {
14
+ /** How long the server may take to answer the request, in milliseconds. Only used for submitted changesets. */
15
+ timeout?: number;
16
+ }
13
17
  export interface ICollaborationSocket extends Pick<ISocket, 'open$' | 'error$' | 'close$'> {
14
18
  memberID: string;
15
19
  message$: Observable<ICombResponseEvent>;
16
- send: (event: ICombRequestEvent) => void;
20
+ /**
21
+ * Send an event to the server. For a submitted changeset the returned promise resolves when the server
22
+ * answered the HTTP request and rejects when the request failed or timed out; other events return nothing.
23
+ */
24
+ send: (event: ICombRequestEvent, options?: ICollaborationSendOptions) => void | Promise<void>;
17
25
  close: () => void;
18
26
  }
19
27
  /**
@@ -39,6 +47,6 @@ export declare abstract class CollaborationSocketService extends Disposable impl
39
47
  * @param URL The URL of the remote server.
40
48
  */
41
49
  protected _doCreateSocket(URL: string): Nullable<ICollaborationSocket>;
42
- protected _submitChangeset(socket: ICollaborationSocket, event: ISubmitChangesetEvent): Promise<void>;
50
+ protected _submitChangeset(socket: ICollaborationSocket, event: ISubmitChangesetEvent, timeoutMs: number): Promise<void>;
43
51
  protected _fetchMissChangesets(event: IFetchingMissEvent): Promise<IChangeset[]>;
44
52
  }
@@ -18,4 +18,9 @@ export declare class CollaborativeUndoRedoService extends LocalUndoRedoService i
18
18
  private _substituteUndoStack;
19
19
  private _substituteRedoStack;
20
20
  private _transformStack;
21
+ private _transformHistoryMutations;
22
+ private _rebaseParagraphHistory;
23
+ private _rebaseUnchangedAttributes;
24
+ private _invertDocumentHistory;
25
+ private _filterTableActions;
21
26
  }
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(_0x4e80fc,_0x1b7b1f){const _0x43c43f=_0x1419,_0x450b27=_0x4e80fc();while(!![]){try{const _0x465c4e=-parseInt(_0x43c43f(0x1b7))/0x1*(-parseInt(_0x43c43f(0x1a0))/0x2)+parseInt(_0x43c43f(0x19b))/0x3*(-parseInt(_0x43c43f(0x1cc))/0x4)+parseInt(_0x43c43f(0x19c))/0x5*(-parseInt(_0x43c43f(0x1ba))/0x6)+parseInt(_0x43c43f(0x1aa))/0x7*(-parseInt(_0x43c43f(0x1a4))/0x8)+-parseInt(_0x43c43f(0x1f7))/0x9*(-parseInt(_0x43c43f(0x19d))/0xa)+-parseInt(_0x43c43f(0x1fa))/0xb*(parseInt(_0x43c43f(0x1f0))/0xc)+parseInt(_0x43c43f(0x1e8))/0xd;if(_0x465c4e===_0x1b7b1f)break;else _0x450b27['push'](_0x450b27['shift']());}catch(_0x27517c){_0x450b27['push'](_0x450b27['shift']());}}}(_0x4eec,0x29f44),function(_0x1a7dd0,_0x1c1280){const _0x1c0fca=_0x1419;typeof exports=='object'&&typeof module<'u'?_0x1c1280(exports,require('@univerjs-pro/collaboration-client'),require('@univerjs/core/facade'),require('@univerjs/core'),require('@univerjs-pro/collaboration'),require('rxjs')):typeof define==_0x1c0fca(0x1ed)&&define['amd']?define([_0x1c0fca(0x1cb),_0x1c0fca(0x1a2),'@univerjs/core/facade','@univerjs/core',_0x1c0fca(0x1f4),_0x1c0fca(0x1c3)],_0x1c1280):(_0x1a7dd0=typeof globalThis<'u'?globalThis:_0x1a7dd0||self,_0x1c1280(_0x1a7dd0[_0x1c0fca(0x1af)]={},_0x1a7dd0[_0x1c0fca(0x1b8)],_0x1a7dd0[_0x1c0fca(0x1d4)],_0x1a7dd0['UniverCore'],_0x1a7dd0['UniverProCollaboration'],_0x1a7dd0[_0x1c0fca(0x1c3)]));}(this,function(_0x3d29b0,_0x116e2b,_0x575807,_0x3584e7,_0x272123,_0x149dce){const _0x3e3892=_0x1419;Object[_0x3e3892(0x1bb)](_0x3d29b0,Symbol[_0x3e3892(0x1f8)],{'value':_0x3e3892(0x1f1)});var _0x9c26f0=class extends _0x575807[_0x3e3892(0x1dc)]{get[_0x3e3892(0x1bc)](){const _0x195271=_0x3e3892;return _0x116e2b[_0x195271(0x1bc)];}};_0x575807['FEnum'][_0x3e3892(0x1c5)](_0x9c26f0);var _0x588efa=class extends _0x575807['FEventName']{get['CollaborationStatusChanged'](){const _0x4e6e3d=_0x3e3892;return _0x4e6e3d(0x1e5);}};_0x575807[_0x3e3892(0x19e)]['extend'](_0x588efa);function _0x4e33b1(_0x4da079,_0x3f390e){return function(_0x5a056f,_0x24b931){_0x3f390e(_0x5a056f,_0x24b931,_0x4da079);};}function _0x4246bc(_0x3f1e0b,_0x53ca09,_0x198e8f,_0x1a92f3){const _0x267330=_0x3e3892;var _0x184eba=arguments[_0x267330(0x1ec)],_0x5405d4=_0x184eba<0x3?_0x53ca09:_0x1a92f3===null?_0x1a92f3=Object[_0x267330(0x1c4)](_0x53ca09,_0x198e8f):_0x1a92f3,_0x25539d;if(typeof Reflect=='object'&&typeof Reflect[_0x267330(0x1ae)]==_0x267330(0x1ed))_0x5405d4=Reflect[_0x267330(0x1ae)](_0x3f1e0b,_0x53ca09,_0x198e8f,_0x1a92f3);else{for(var _0x13f7c1=_0x3f1e0b['length']-0x1;_0x13f7c1>=0x0;_0x13f7c1--)(_0x25539d=_0x3f1e0b[_0x13f7c1])&&(_0x5405d4=(_0x184eba<0x3?_0x25539d(_0x5405d4):_0x184eba>0x3?_0x25539d(_0x53ca09,_0x198e8f,_0x5405d4):_0x25539d(_0x53ca09,_0x198e8f))||_0x5405d4);}return _0x184eba>0x3&&_0x5405d4&&Object[_0x267330(0x1bb)](_0x53ca09,_0x198e8f,_0x5405d4),_0x5405d4;}let _0x27b724=class extends _0x575807['FBase']{constructor(_0x3f18fd,_0x53ad63,_0x1be216,_0xf87e78,_0x2e43fa){const _0xe36972=_0x3e3892;super(),this[_0xe36972(0x1da)]=_0x3f18fd,this['_injector']=_0x53ad63,this[_0xe36972(0x1a8)]=_0x1be216,this[_0xe36972(0x1b6)]=_0xf87e78,this[_0xe36972(0x1d1)]=_0x2e43fa;}async[_0x3e3892(0x1c2)](_0x6651ba,_0xb5fc2b){const _0x2ebbfb=_0x3e3892;return await this[_0x2ebbfb(0x1b6)][_0x2ebbfb(0x1d2)](_0x6651ba,0x0,_0xb5fc2b)?(await this[_0x2ebbfb(0x1d1)][_0x2ebbfb(0x1b2)](_0x6651ba),this[_0x2ebbfb(0x1da)][_0x2ebbfb(0x1a5)](_0x6651ba)):null;}async['loadDocAsync'](_0x56f975,_0x2b4eaa){const _0x22afa1=_0x3e3892;return await this['_snapshotService']['loadDoc'](_0x56f975,0x0,_0x2b4eaa)?(await this[_0x22afa1(0x1d1)][_0x22afa1(0x1b2)](_0x56f975),this[_0x22afa1(0x1da)]['getDocument'](_0x56f975)):null;}async['loadBaseAsync'](_0x9fa446,_0x24980d){const _0x279011=_0x3e3892;return await this[_0x279011(0x1b6)][_0x279011(0x1c6)](_0x9fa446,0x0,_0x24980d)?(await this[_0x279011(0x1d1)]['readyForCollab'](_0x9fa446),this['_handler']['getBase'](_0x9fa446)):null;}async[_0x3e3892(0x1e4)](_0x216a23,_0x28b6a8){const _0x1db230=_0x3e3892;return await this[_0x1db230(0x1b6)][_0x1db230(0x1b3)](_0x216a23,0x0,_0x28b6a8)?(await this[_0x1db230(0x1d1)][_0x1db230(0x1b2)](_0x216a23),this[_0x1db230(0x1da)][_0x1db230(0x1e7)](_0x216a23)):null;}async['loadBoardAsync'](_0x517cb6,_0x258034){const _0x1c7fee=_0x3e3892;return await this[_0x1c7fee(0x1b6)]['loadBoard'](_0x517cb6,0x0,_0x258034)?(await this[_0x1c7fee(0x1d1)]['readyForCollab'](_0x517cb6),this[_0x1c7fee(0x1da)]['getBoard'](_0x517cb6)):null;}async[_0x3e3892(0x1d8)](_0x501482,_0x149f2d){const _0x44376b=_0x3e3892;return await this[_0x44376b(0x1b6)][_0x44376b(0x1bd)](_0x501482,0x0,_0x149f2d)?(await this['_collaborationController'][_0x44376b(0x1b2)](_0x501482),this[_0x44376b(0x1da)][_0x44376b(0x1a9)](_0x501482)):null;}[_0x3e3892(0x1b1)](_0x2d84c8,_0x32936c){const _0x363935=_0x3e3892;let _0x57537f=this['_injector']['get'](_0x116e2b['MemberService'])[_0x363935(0x1b4)](_0x2d84c8)[_0x363935(0x1df)]((0x0,_0x149dce[_0x363935(0x1c1)])(_0x5ee84f=>_0x5ee84f[_0x363935(0x1a1)]))[_0x363935(0x1bf)](_0x2f58ad=>_0x32936c(Array['from'](_0x2f58ad[_0x363935(0x1fc)]())));return(0x0,_0x3584e7[_0x363935(0x1ca)])(_0x57537f);}[_0x3e3892(0x1e0)](_0x314b95){const _0x599885=_0x3e3892;let _0x141848=this[_0x599885(0x1ef)](_0x314b95);if(!_0x141848)return _0x116e2b[_0x599885(0x1bc)]['NOT_COLLAB'];let _0x1691e2=this[_0x599885(0x1d1)][_0x599885(0x1e3)](_0x141848);return(_0x1691e2==null?void 0x0:_0x1691e2[_0x599885(0x1d9)][_0x599885(0x19f)])??_0x116e2b['CollaborationStatus'][_0x599885(0x1b0)];}['flush'](_0x148a81,_0x140621={}){const _0x19e428=_0x3e3892;let _0x194981=this['_resolveUnitId'](_0x148a81);if(!_0x194981)return Promise[_0x19e428(0x1ce)](Error(_0x19e428(0x1fb)));let _0x539173=this[_0x19e428(0x1d1)]['getCollabEntity'](_0x194981);if(!_0x539173)return Promise[_0x19e428(0x1ce)](Error(_0x19e428(0x1f6)+_0x194981+_0x19e428(0x1dd)));let _0x73fff4=_0x539173[_0x19e428(0x1d9)]['status'];if(_0x73fff4===_0x116e2b[_0x19e428(0x1bc)]['SYNCED'])return Promise[_0x19e428(0x1ea)]();let _0x521360=_0x3eb8ed(_0x194981,_0x73fff4);if(_0x521360)return Promise[_0x19e428(0x1ce)](_0x521360);let _0x3eff41=_0x140621['timeout']??0x7530;return new Promise((_0x345ba3,_0x117ef4)=>{const _0x50e6fb=_0x19e428;let _0x43b999=!0x1,_0x17c2c9=null,_0x5bd5a8=setTimeout(()=>{const _0x603c3d=_0x1419;_0x43b999=!0x0,_0x17c2c9==null||_0x17c2c9[_0x603c3d(0x1e9)](),_0x117ef4(Error(_0x603c3d(0x1c7)+_0x194981+_0x603c3d(0x1e1)+_0x3eff41+_0x603c3d(0x1a6)));},_0x3eff41),_0x565b9b=()=>{const _0x114e6f=_0x1419;_0x43b999=!0x0,clearTimeout(_0x5bd5a8),_0x17c2c9==null||_0x17c2c9[_0x114e6f(0x1e9)]();};_0x17c2c9=_0x539173['status$'][_0x50e6fb(0x1bf)](_0x3d8a32=>{const _0x4e6b2d=_0x50e6fb;if(_0x43b999)return;if(_0x3d8a32===_0x116e2b['CollaborationStatus'][_0x4e6b2d(0x1e2)]){_0x565b9b(),_0x345ba3();return;}let _0x5e9aae=_0x3eb8ed(_0x194981,_0x3d8a32);_0x5e9aae&&(_0x565b9b(),_0x117ef4(_0x5e9aae));});});}[_0x3e3892(0x1ef)](_0x96fc0c){const _0x584653=_0x3e3892;var _0x205a60;return _0x96fc0c||((_0x205a60=this['_univerInstanceService'][_0x584653(0x1c0)]())==null?void 0x0:_0x205a60['getUnitId']());}};_0x27b724=_0x4246bc([_0x4e33b1(0x1,(0x0,_0x3584e7[_0x3e3892(0x1e6)])(_0x3584e7[_0x3e3892(0x1ee)])),_0x4e33b1(0x2,_0x3584e7[_0x3e3892(0x1c9)]),_0x4e33b1(0x3,(0x0,_0x3584e7[_0x3e3892(0x1e6)])(_0x272123['SnapshotService'])),_0x4e33b1(0x4,(0x0,_0x3584e7[_0x3e3892(0x1e6)])(_0x116e2b[_0x3e3892(0x1d5)]))],_0x27b724);function _0x3eb8ed(_0x1ed197,_0x1e3014){const _0x1f1409=_0x3e3892;return _0x1e3014===_0x116e2b['CollaborationStatus'][_0x1f1409(0x1ad)]||_0x1e3014===_0x116e2b['CollaborationStatus'][_0x1f1409(0x1b0)]?Error(_0x1f1409(0x1b5)+_0x1ed197+'\x22\x20while\x20collaboration\x20status\x20is\x20'+_0x1e3014+'.'):null;}var _0x234dd3=class extends _0x575807[_0x3e3892(0x1d0)]{[_0x3e3892(0x1d3)](_0x23cb11){const _0x3939b9=_0x3e3892;let _0x5cca81=_0x23cb11[_0x3939b9(0x1cd)](_0x116e2b[_0x3939b9(0x1d5)]);this[_0x3939b9(0x1d6)](this[_0x3939b9(0x1c8)](this[_0x3939b9(0x1a3)][_0x3939b9(0x1e5)],()=>{const _0x4f084d=_0x3939b9;let _0x36c070=new _0x3584e7['DisposableCollection'](),_0x144aa6=_0x5cca81[_0x4f084d(0x1b9)][_0x4f084d(0x1bf)](_0x451ff5=>{const _0x35a6b5=_0x4f084d;let _0x4427b9=_0x451ff5[_0x35a6b5(0x1de)]['subscribe'](_0x579df4=>{const _0x169f7a=_0x35a6b5;let _0x278fb1={'unitId':_0x451ff5[_0x169f7a(0x1cf)],'status':_0x579df4};this['fireEvent'](this[_0x169f7a(0x1a3)][_0x169f7a(0x1e5)],_0x278fb1);});_0x36c070[_0x35a6b5(0x1eb)]((0x0,_0x3584e7['toDisposable'])(_0x4427b9));});return _0x36c070[_0x4f084d(0x1eb)]((0x0,_0x3584e7[_0x4f084d(0x1ca)])(_0x144aa6)),_0x36c070;}));}[_0x3e3892(0x1f5)](){const _0x3154bd=_0x3e3892;return this[_0x3154bd(0x1a7)][_0x3154bd(0x1f3)](_0x27b724,{'getWorkbook':_0xc8181e=>this['getWorkbook'](_0xc8181e),'getDocument':_0x57d9f7=>this[_0x3154bd(0x1ac)](_0x57d9f7),'getPresentation':_0x472739=>this[_0x3154bd(0x1e7)](_0x472739),'getBase':_0x18668d=>this[_0x3154bd(0x1f2)](_0x18668d),'getBoard':_0x46537=>this[_0x3154bd(0x1db)](_0x46537),'getPdf':_0x2f1be6=>this[_0x3154bd(0x1a9)](_0x2f1be6)});}[_0x3e3892(0x1f9)](_0x31f6d4,_0x457ad9,_0x2a3a3a){const _0x4f5c67=_0x3e3892;return this['_injector']['get'](_0x116e2b[_0x4f5c67(0x1ab)])[_0x4f5c67(0x1fd)](_0x31f6d4,_0x457ad9,_0x2a3a3a);}[_0x3e3892(0x1be)](_0x26653d,_0x4d2050,_0x3b6c7c){const _0x4d3559=_0x3e3892;return this[_0x4d3559(0x1a7)][_0x4d3559(0x1cd)](_0x116e2b[_0x4d3559(0x1ab)])['loadUnitOfRevision'](_0x26653d,_0x4d2050,_0x3b6c7c);}};_0x575807[_0x3e3892(0x1d0)][_0x3e3892(0x1c5)](_0x234dd3),Object['defineProperty'](_0x3d29b0,_0x3e3892(0x1d7),{'enumerable':!0x0,'get':function(){return _0x27b724;}});}));function _0x1419(_0x48810a,_0x4192bc){_0x48810a=_0x48810a-0x19b;const _0x4eec19=_0x4eec();let _0x1419cd=_0x4eec19[_0x48810a];return _0x1419cd;}function _0x4eec(){const _0x478ae7=['1636665jVHpfW','10HPRniX','FEventName','status','250WCikJb','members$','@univerjs-pro/collaboration-client','Event','874312GnpSeG','getWorkbook','ms.','_injector','_univerInstanceService','getPdf','21BpGIvc','DataLoaderService','getDocument','CONFLICT','decorate','UniverProCollaborationClientFacade','NOT_COLLAB','subscribeCollaborators','readyForCollab','loadSlide','waitForRoom$','[FCollaboration]:\x20Cannot\x20flush\x20unit\x20\x22','_snapshotService','560bomgPw','UniverProCollaborationClient','entityInit$','6CmgSTq','defineProperty','CollaborationStatus','loadPdf','loadServerUnitOfRevision','subscribe','getFocusedUnit','switchMap','loadSheetAsync','rxjs','getOwnPropertyDescriptor','extend','loadBase','[FCollaboration]:\x20Timed\x20out\x20flushing\x20unit\x20\x22','registerEventHandler','IUniverInstanceService','toDisposable','exports','18476SqUkQi','get','reject','unitID','FUniver','_collaborationController','loadSheet','_initialize','UniverCoreFacade','CollaborationController','disposeWithMe','FCollaboration','loadPdfAsync','state','_handler','getBoard','FEnum','\x22\x20is\x20not\x20in\x20collaboration\x20mode.','status$','pipe','getCollaborationStatus','\x22\x20after\x20','SYNCED','getCollabEntity','loadSlideAsync','CollaborationStatusChanged','Inject','getPresentation','12132367PrhwvN','unsubscribe','resolve','add','length','function','Injector','_resolveUnitId','76044BNLFKZ','Module','getBase','createInstance','@univerjs-pro/collaboration','getCollaboration','[FCollaboration]:\x20Unit\x20\x22','1263951zmmMTy','toStringTag','loadServerUnit','253CZHpgZ','[FCollaboration]:\x20Cannot\x20flush\x20because\x20no\x20unit\x20is\x20focused\x20or\x20specified.','values','loadUnit','111tsAAZn'];_0x4eec=function(){return _0x478ae7;};return _0x4eec();}
1
+ function _0x1cd3(_0x16583b,_0x2b71db){_0x16583b=_0x16583b-0x65;const _0x1bc693=_0x1bc6();let _0x1cd3c4=_0x1bc693[_0x16583b];return _0x1cd3c4;}(function(_0x4e89f7,_0x16e981){const _0x20bd6f=_0x1cd3,_0x2e6630=_0x4e89f7();while(!![]){try{const _0x477958=parseInt(_0x20bd6f(0x73))/0x1*(parseInt(_0x20bd6f(0xd0))/0x2)+-parseInt(_0x20bd6f(0x8b))/0x3*(parseInt(_0x20bd6f(0x78))/0x4)+-parseInt(_0x20bd6f(0x6f))/0x5+parseInt(_0x20bd6f(0x99))/0x6*(parseInt(_0x20bd6f(0xdf))/0x7)+parseInt(_0x20bd6f(0xba))/0x8*(parseInt(_0x20bd6f(0x79))/0x9)+-parseInt(_0x20bd6f(0xab))/0xa*(-parseInt(_0x20bd6f(0x8d))/0xb)+-parseInt(_0x20bd6f(0xc6))/0xc;if(_0x477958===_0x16e981)break;else _0x2e6630['push'](_0x2e6630['shift']());}catch(_0x498982){_0x2e6630['push'](_0x2e6630['shift']());}}}(_0x1bc6,0x982c0),function(_0x22f909,_0x389c51){const _0x5d88df=_0x1cd3;typeof exports==_0x5d88df(0x67)&&typeof module<'u'?_0x389c51(exports,require('@univerjs-pro/collaboration-client'),require('@univerjs/core/facade'),require('@univerjs/core'),require('rxjs')):typeof define==_0x5d88df(0xa5)&&define[_0x5d88df(0x9a)]?define([_0x5d88df(0x93),_0x5d88df(0xd4),_0x5d88df(0x83),'@univerjs/core',_0x5d88df(0xcf)],_0x389c51):(_0x22f909=typeof globalThis<'u'?globalThis:_0x22f909||self,_0x389c51(_0x22f909['UniverProCollaborationClientFacade']={},_0x22f909[_0x5d88df(0xb8)],_0x22f909[_0x5d88df(0xa6)],_0x22f909['UniverCore'],_0x22f909['rxjs']));}(this,function(_0x5f2bc9,_0x42eff0,_0x2db56a,_0x18b349,_0x4a3183){const _0xbf0c54=_0x1cd3;Object[_0xbf0c54(0x69)](_0x5f2bc9,Symbol[_0xbf0c54(0xda)],{'value':_0xbf0c54(0x6b)});var _0x4c8507=class extends _0x2db56a[_0xbf0c54(0xa3)]{get[_0xbf0c54(0x88)](){const _0x1fbc73=_0xbf0c54;return _0x42eff0[_0x1fbc73(0x88)];}};_0x2db56a[_0xbf0c54(0xa3)]['extend'](_0x4c8507);var _0x47cade=class extends _0x2db56a[_0xbf0c54(0xe0)]{get[_0xbf0c54(0xbe)](){return'CollaborationStatusChanged';}get[_0xbf0c54(0x7a)](){const _0x489fb5=_0xbf0c54;return _0x489fb5(0x7a);}get[_0xbf0c54(0xdb)](){const _0x49a8b8=_0xbf0c54;return _0x49a8b8(0xdb);}};_0x2db56a['FEventName'][_0xbf0c54(0xb2)](_0x47cade);function _0x2c160c(_0x12f4a0,_0x2062df){return function(_0x4a01ce,_0x25bbec){_0x2062df(_0x4a01ce,_0x25bbec,_0x12f4a0);};}function _0x3cb5b7(_0x599f43,_0x37696e,_0x290715,_0xaa97a5){const _0x461421=_0xbf0c54;var _0x2f5340=arguments[_0x461421(0xad)],_0x497a9d=_0x2f5340<0x3?_0x37696e:_0xaa97a5===null?_0xaa97a5=Object[_0x461421(0x77)](_0x37696e,_0x290715):_0xaa97a5,_0x38203a;if(typeof Reflect==_0x461421(0x67)&&typeof Reflect[_0x461421(0xc3)]=='function')_0x497a9d=Reflect['decorate'](_0x599f43,_0x37696e,_0x290715,_0xaa97a5);else{for(var _0x44e7d5=_0x599f43[_0x461421(0xad)]-0x1;_0x44e7d5>=0x0;_0x44e7d5--)(_0x38203a=_0x599f43[_0x44e7d5])&&(_0x497a9d=(_0x2f5340<0x3?_0x38203a(_0x497a9d):_0x2f5340>0x3?_0x38203a(_0x37696e,_0x290715,_0x497a9d):_0x38203a(_0x37696e,_0x290715))||_0x497a9d);}return _0x2f5340>0x3&&_0x497a9d&&Object[_0x461421(0x69)](_0x37696e,_0x290715,_0x497a9d),_0x497a9d;}let _0x50f853=class extends _0x2db56a[_0xbf0c54(0x91)]{constructor(_0x1be74d,_0x446077,_0x5be445,_0x54678f,_0x3a19ea){const _0x389786=_0xbf0c54;super(),this[_0x389786(0xb0)]=_0x1be74d,this[_0x389786(0x7f)]=_0x446077,this[_0x389786(0xac)]=_0x5be445,this[_0x389786(0xdd)]=_0x54678f,this[_0x389786(0xae)]=_0x3a19ea;}async[_0xbf0c54(0x87)](_0x4548be,_0x5a71b5){const _0x1e7d9a=_0xbf0c54;return await this[_0x1e7d9a(0xdd)]['loadUnit'](_0x4548be,_0x18b349[_0x1e7d9a(0xa7)][_0x1e7d9a(0xbb)],void 0x0,_0x5a71b5)?(await this[_0x1e7d9a(0xae)][_0x1e7d9a(0xd5)](_0x4548be),this[_0x1e7d9a(0xb0)][_0x1e7d9a(0x65)](_0x4548be)):null;}async[_0xbf0c54(0x6d)](_0x418fbe,_0x3c4e94){const _0x11a14b=_0xbf0c54;return await this[_0x11a14b(0xdd)][_0x11a14b(0x75)](_0x418fbe,_0x18b349[_0x11a14b(0xa7)][_0x11a14b(0x74)],void 0x0,_0x3c4e94)?(await this[_0x11a14b(0xae)][_0x11a14b(0xd5)](_0x418fbe),this[_0x11a14b(0xb0)]['getDocument'](_0x418fbe)):null;}async['loadBaseAsync'](_0x2fa50f,_0x432baf){const _0x5989ae=_0xbf0c54;return await this[_0x5989ae(0xdd)][_0x5989ae(0x75)](_0x2fa50f,_0x18b349[_0x5989ae(0xa7)][_0x5989ae(0xdc)],void 0x0,_0x432baf)?(await this['_collaborationController'][_0x5989ae(0xd5)](_0x2fa50f),this['_handler']['getBase'](_0x2fa50f)):null;}async['loadSlideAsync'](_0x13ccc2,_0x2215ad){const _0x525567=_0xbf0c54;return await this['_dataLoaderService'][_0x525567(0x75)](_0x13ccc2,_0x18b349[_0x525567(0xa7)][_0x525567(0xc5)],void 0x0,_0x2215ad)?(await this['_collaborationController'][_0x525567(0xd5)](_0x13ccc2),this['_handler'][_0x525567(0xc1)](_0x13ccc2)):null;}async[_0xbf0c54(0xc4)](_0x367ab3,_0x20d1a9){const _0x308b89=_0xbf0c54;return await this['_dataLoaderService'][_0x308b89(0x75)](_0x367ab3,_0x18b349[_0x308b89(0xa7)][_0x308b89(0x96)],void 0x0,_0x20d1a9)?(await this[_0x308b89(0xae)][_0x308b89(0xd5)](_0x367ab3),this[_0x308b89(0xb0)][_0x308b89(0xd8)](_0x367ab3)):null;}async[_0xbf0c54(0x94)](_0x100cb0,_0x3a57cd){const _0x13d134=_0xbf0c54;return await this[_0x13d134(0xdd)][_0x13d134(0x75)](_0x100cb0,_0x18b349[_0x13d134(0xa7)][_0x13d134(0xa0)],void 0x0,_0x3a57cd)?(await this[_0x13d134(0xae)]['readyForCollab'](_0x100cb0),this[_0x13d134(0xb0)]['getPdf'](_0x100cb0)):null;}[_0xbf0c54(0xce)](_0x21851d,_0x256b85){const _0x7b915b=_0xbf0c54;let _0x2e88e2=this[_0x7b915b(0x7f)][_0x7b915b(0xbc)](_0x42eff0[_0x7b915b(0x76)])[_0x7b915b(0xb9)](_0x21851d)['pipe']((0x0,_0x4a3183[_0x7b915b(0x6c)])(_0x50a3bd=>_0x50a3bd[_0x7b915b(0x82)]))['subscribe'](_0x309c00=>_0x256b85(Array[_0x7b915b(0x81)](_0x309c00[_0x7b915b(0xc7)]())));return(0x0,_0x18b349['toDisposable'])(_0x2e88e2);}[_0xbf0c54(0x98)](_0x1276c5){const _0x2363d8=_0xbf0c54;let _0x52ef64=this['_resolveUnitId'](_0x1276c5);if(!_0x52ef64)return _0x42eff0[_0x2363d8(0x88)][_0x2363d8(0x7d)];let _0x672b1d=this[_0x2363d8(0xae)][_0x2363d8(0x68)](_0x52ef64);return(_0x672b1d==null?void 0x0:_0x672b1d[_0x2363d8(0xb3)][_0x2363d8(0xa8)])??_0x42eff0[_0x2363d8(0x88)][_0x2363d8(0x7d)];}[_0xbf0c54(0x90)](_0x1d1219){const _0x1c3044=_0xbf0c54;let _0x52896b=this[_0x1c3044(0x6e)](_0x1d1219);return _0x52896b?this[_0x1c3044(0xae)][_0x1c3044(0x90)](_0x52896b):!0x1;}[_0xbf0c54(0xb4)](_0x148086,_0x53edc8={}){const _0x283abf=_0xbf0c54;let _0x341759=this[_0x283abf(0x6e)](_0x148086);if(!_0x341759)return Promise['reject'](Error('[FCollaboration]:\x20Cannot\x20flush\x20because\x20no\x20unit\x20is\x20focused\x20or\x20specified.'));let _0xa2ff1c=this[_0x283abf(0xae)][_0x283abf(0x68)](_0x341759);if(!_0xa2ff1c)return Promise[_0x283abf(0x66)](Error(_0x283abf(0xbf)+_0x341759+_0x283abf(0x85)));let _0x43bf95=_0xa2ff1c[_0x283abf(0xb3)][_0x283abf(0xa8)];if(_0x43bf95===_0x42eff0['CollaborationStatus'][_0x283abf(0xaa)])return Promise[_0x283abf(0x6a)]();let _0x1cef8e=_0x5acb6a(_0x341759,_0x43bf95);if(_0x1cef8e)return Promise[_0x283abf(0x66)](_0x1cef8e);let _0x2571a7=_0x53edc8[_0x283abf(0x9b)]??0x7530;return new Promise((_0x5caa5c,_0x5ac876)=>{const _0x52aac8=_0x283abf;let _0x2d6aeb=!0x1,_0x9d6ad3=null,_0x35136a=setTimeout(()=>{const _0x2a8065=_0x1cd3;_0x2d6aeb=!0x0,_0x9d6ad3==null||_0x9d6ad3[_0x2a8065(0x70)](),_0x5ac876(Error(_0x2a8065(0xd7)+_0x341759+_0x2a8065(0xa4)+_0x2571a7+_0x2a8065(0xd9)));},_0x2571a7),_0x4825a7=()=>{const _0x53baac=_0x1cd3;_0x2d6aeb=!0x0,clearTimeout(_0x35136a),_0x9d6ad3==null||_0x9d6ad3[_0x53baac(0x70)]();};_0x9d6ad3=_0xa2ff1c[_0x52aac8(0xc2)][_0x52aac8(0x9c)](_0x51c83f=>{const _0x240191=_0x52aac8;if(_0x2d6aeb)return;if(_0x51c83f===_0x42eff0[_0x240191(0x88)][_0x240191(0xaa)]){_0x4825a7(),_0x5caa5c();return;}let _0x488a4a=_0x5acb6a(_0x341759,_0x51c83f);_0x488a4a&&(_0x4825a7(),_0x5ac876(_0x488a4a));});});}['_resolveUnitId'](_0x294c0b){const _0x58d32f=_0xbf0c54;var _0x29bb68;return _0x294c0b||((_0x29bb68=this['_univerInstanceService']['getFocusedUnit']())==null?void 0x0:_0x29bb68[_0x58d32f(0x95)]());}};_0x50f853=_0x3cb5b7([_0x2c160c(0x1,(0x0,_0x18b349[_0xbf0c54(0x8e)])(_0x18b349[_0xbf0c54(0x7b)])),_0x2c160c(0x2,_0x18b349[_0xbf0c54(0xd6)]),_0x2c160c(0x3,(0x0,_0x18b349[_0xbf0c54(0x8e)])(_0x42eff0[_0xbf0c54(0x84)])),_0x2c160c(0x4,(0x0,_0x18b349[_0xbf0c54(0x8e)])(_0x42eff0[_0xbf0c54(0xb5)]))],_0x50f853);function _0x5acb6a(_0x40a592,_0x2b60ba){const _0x3395c4=_0xbf0c54;return _0x2b60ba===_0x42eff0[_0x3395c4(0x88)][_0x3395c4(0x80)]||_0x2b60ba===_0x42eff0['CollaborationStatus']['NOT_COLLAB']?Error(_0x3395c4(0xcd)+_0x40a592+_0x3395c4(0xcc)+_0x2b60ba+'.'):null;}var _0x2951a7=class extends _0x2db56a[_0xbf0c54(0x9f)]{[_0xbf0c54(0xa2)](_0x172df4){const _0x8ba8e4=_0xbf0c54;let _0x29e1fc=_0x172df4[_0x8ba8e4(0xbc)](_0x42eff0[_0x8ba8e4(0xb5)]);this[_0x8ba8e4(0xd1)](this[_0x8ba8e4(0xd2)](this[_0x8ba8e4(0x92)][_0x8ba8e4(0xbe)],()=>{const _0x5f07ed=_0x8ba8e4;let _0x2a82b1=new _0x18b349[(_0x5f07ed(0x8a))](),_0x446831=_0xfe9e90=>{const _0x210b1e=_0x5f07ed;let _0x389563=_0xfe9e90['status$'][_0x210b1e(0xb6)]((0x0,_0x4a3183[_0x210b1e(0x72)])())[_0x210b1e(0x9c)](_0x400e3d=>{const _0x319a7e=_0x210b1e;let _0x407517={'unitId':_0xfe9e90[_0x319a7e(0x86)],'status':_0x400e3d};this[_0x319a7e(0xb7)](this['Event']['CollaborationStatusChanged'],_0x407517);});_0x2a82b1[_0x210b1e(0x8f)]((0x0,_0x18b349[_0x210b1e(0x9e)])(_0x389563));};return _0x29e1fc[_0x5f07ed(0xa9)]()[_0x5f07ed(0xc8)](_0x446831),_0x2a82b1[_0x5f07ed(0x8f)]((0x0,_0x18b349[_0x5f07ed(0x9e)])(_0x29e1fc[_0x5f07ed(0x71)][_0x5f07ed(0x9c)](_0x446831))),_0x2a82b1;})),this[_0x8ba8e4(0xd1)](this[_0x8ba8e4(0xd2)](this[_0x8ba8e4(0x92)]['CollaborationConflict'],()=>{const _0x309c20=_0x8ba8e4;let _0x5d2ab2=new _0x18b349[(_0x309c20(0x8a))](),_0x11451b=_0x1232d0=>{const _0x22a571=_0x309c20;let _0x3c2e74=_0x1232d0[_0x22a571(0xde)]['subscribe'](_0x1ece67=>{const _0x3b9987=_0x22a571;let _0xcf0d31={'unitId':_0x1ece67[_0x3b9987(0x86)],'reason':_0x1ece67[_0x3b9987(0xb1)],'message':_0x1ece67[_0x3b9987(0x89)],'revert':_0x1ece67[_0x3b9987(0x7e)],'localChanges':_0x1ece67[_0x3b9987(0x7c)],'cacheCleared':_0x1ece67[_0x3b9987(0x8c)]};this[_0x3b9987(0xb7)](this['Event'][_0x3b9987(0x7a)],_0xcf0d31);});_0x5d2ab2[_0x22a571(0x8f)]((0x0,_0x18b349[_0x22a571(0x9e)])(_0x3c2e74));};return _0x29e1fc['getCollabEntities']()[_0x309c20(0xc8)](_0x11451b),_0x5d2ab2[_0x309c20(0x8f)]((0x0,_0x18b349[_0x309c20(0x9e)])(_0x29e1fc['entityInit$'][_0x309c20(0x9c)](_0x11451b))),_0x5d2ab2;})),this[_0x8ba8e4(0xd1)](this['registerEventHandler'](this[_0x8ba8e4(0x92)][_0x8ba8e4(0xdb)],()=>{const _0x1c81e0=_0x8ba8e4;let _0x526a33=new _0x18b349[(_0x1c81e0(0x8a))](),_0x41dded=_0x5d4ec4=>{const _0x327270=_0x1c81e0;let _0x143aaa=_0x5d4ec4['changesetResend$'][_0x327270(0x9c)](_0x221acc=>{const _0x4f1018=_0x327270;let _0x196f86={'unitId':_0x221acc['unitID'],'reqId':_0x221acc[_0x4f1018(0xc9)],'reason':_0x221acc[_0x4f1018(0xb1)],'attempt':_0x221acc[_0x4f1018(0xa1)],'elapsedMs':_0x221acc['elapsedMs'],'unsyncedMutationCount':_0x221acc[_0x4f1018(0xca)],'nextDelayMs':_0x221acc['nextDelayMs']};this['fireEvent'](this[_0x4f1018(0x92)][_0x4f1018(0xdb)],_0x196f86);});_0x526a33[_0x327270(0x8f)]((0x0,_0x18b349[_0x327270(0x9e)])(_0x143aaa));};return _0x29e1fc[_0x1c81e0(0xa9)]()[_0x1c81e0(0xc8)](_0x41dded),_0x526a33['add']((0x0,_0x18b349[_0x1c81e0(0x9e)])(_0x29e1fc['entityInit$'][_0x1c81e0(0x9c)](_0x41dded))),_0x526a33;}));}[_0xbf0c54(0xaf)](){const _0x1a6519=_0xbf0c54;return this[_0x1a6519(0x7f)][_0x1a6519(0xcb)](_0x50f853,{'getWorkbook':_0x12db00=>this[_0x1a6519(0x65)](_0x12db00),'getDocument':_0x215e1f=>this[_0x1a6519(0xbd)](_0x215e1f),'getPresentation':_0x2f2c58=>this[_0x1a6519(0xc1)](_0x2f2c58),'getBase':_0x1105ce=>this[_0x1a6519(0xd3)](_0x1105ce),'getBoard':_0x7b3951=>this[_0x1a6519(0xd8)](_0x7b3951),'getPdf':_0x1f63e5=>this[_0x1a6519(0x97)](_0x1f63e5)});}['loadServerUnit'](_0x14964f,_0x36643a,_0x4afa86){const _0x20e976=_0xbf0c54;return this['_injector'][_0x20e976(0xbc)](_0x42eff0[_0x20e976(0x84)])['loadUnit'](_0x14964f,_0x36643a,_0x4afa86);}[_0xbf0c54(0xc0)](_0x1c0013,_0x360a1b,_0x264fdb){const _0x4d337e=_0xbf0c54;return this[_0x4d337e(0x7f)][_0x4d337e(0xbc)](_0x42eff0[_0x4d337e(0x84)])['loadUnitOfRevision'](_0x1c0013,_0x360a1b,_0x264fdb);}};_0x2db56a['FUniver'][_0xbf0c54(0xb2)](_0x2951a7),Object['defineProperty'](_0x5f2bc9,_0xbf0c54(0x9d),{'enumerable':!0x0,'get':function(){return _0x50f853;}});}));function _0x1bc6(){const _0x3b85df=['121122CDbaGd','CollaborationConflict','Injector','localChanges','NOT_COLLAB','revert','_injector','CONFLICT','from','members$','@univerjs/core/facade','DataLoaderService','\x22\x20is\x20not\x20in\x20collaboration\x20mode.','unitID','loadSheetAsync','CollaborationStatus','message','DisposableCollection','1795485BrBjjo','cacheCleared','6280087AOdVlM','Inject','add','hasWritePending','FBase','Event','exports','loadPdfAsync','getUnitId','UNIVER_BOARD','getPdf','getCollaborationStatus','6VEwyOb','amd','timeout','subscribe','FCollaboration','toDisposable','FUniver','UNIVER_PDF','attempt','_initialize','FEnum','\x22\x20after\x20','function','UniverCoreFacade','UniverInstanceType','status','getCollabEntities','SYNCED','20bDKAda','_univerInstanceService','length','_collaborationController','getCollaboration','_handler','reason','extend','state','flush','CollaborationController','pipe','fireEvent','UniverProCollaborationClient','waitForRoom$','688eUwJXi','UNIVER_SHEET','get','getDocument','CollaborationStatusChanged','[FCollaboration]:\x20Unit\x20\x22','loadServerUnitOfRevision','getPresentation','status$','decorate','loadBoardAsync','UNIVER_SLIDE','13422876MRdLhK','values','forEach','reqId','unsyncedMutationCount','createInstance','\x22\x20while\x20collaboration\x20status\x20is\x20','[FCollaboration]:\x20Cannot\x20flush\x20unit\x20\x22','subscribeCollaborators','rxjs','1024pziyCm','disposeWithMe','registerEventHandler','getBase','@univerjs-pro/collaboration-client','readyForCollab','IUniverInstanceService','[FCollaboration]:\x20Timed\x20out\x20flushing\x20unit\x20\x22','getBoard','ms.','toStringTag','CollaborationChangesetResend','UNIVER_BASE','_dataLoaderService','conflict$','5726147tLtEWs','FEventName','getWorkbook','reject','object','getCollabEntity','defineProperty','resolve','Module','switchMap','loadDocAsync','_resolveUnitId','3904875bPnnOL','unsubscribe','entityInit$','distinctUntilChanged','8JOvtgF','UNIVER_DOC','loadUnit','MemberService','getOwnPropertyDescriptor','4sKbVIP'];_0x1bc6=function(){return _0x3b85df;};return _0x1bc6();}