@univerjs/docs 1.3.1 → 1.5.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.
package/lib/cjs/index.js CHANGED
@@ -1,11 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_protocol = require("./protocol-CvmouuxB.js");
2
3
  let _univerjs_core = require("@univerjs/core");
3
4
  let _univerjs_engine_render = require("@univerjs/engine-render");
4
5
  let rxjs = require("rxjs");
5
6
  let _univerjs_protocol = require("@univerjs/protocol");
6
7
  let _univerjs_rpc = require("@univerjs/rpc");
7
8
 
8
- //#region src/commands/operations/text-selection.operation.ts
9
+ // src/commands/operations/text-selection.operation.ts
9
10
  const SetTextSelectionsOperation = {
10
11
  id: "doc.operation.set-selections",
11
12
  type: _univerjs_core.CommandType.OPERATION,
@@ -14,67 +15,7 @@ const SetTextSelectionsOperation = {
14
15
  }
15
16
  };
16
17
 
17
- //#endregion
18
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
19
- function _typeof(o) {
20
- "@babel/helpers - typeof";
21
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
22
- return typeof o;
23
- } : function(o) {
24
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
25
- }, _typeof(o);
26
- }
27
-
28
- //#endregion
29
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
30
- function toPrimitive(t, r) {
31
- if ("object" != _typeof(t) || !t) return t;
32
- var e = t[Symbol.toPrimitive];
33
- if (void 0 !== e) {
34
- var i = e.call(t, r || "default");
35
- if ("object" != _typeof(i)) return i;
36
- throw new TypeError("@@toPrimitive must return a primitive value.");
37
- }
38
- return ("string" === r ? String : Number)(t);
39
- }
40
-
41
- //#endregion
42
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
43
- function toPropertyKey(t) {
44
- var i = toPrimitive(t, "string");
45
- return "symbol" == _typeof(i) ? i : i + "";
46
- }
47
-
48
- //#endregion
49
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
50
- function _defineProperty(e, r, t) {
51
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
52
- value: t,
53
- enumerable: !0,
54
- configurable: !0,
55
- writable: !0
56
- }) : e[r] = t, e;
57
- }
58
-
59
- //#endregion
60
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
61
- function __decorateParam(paramIndex, decorator) {
62
- return function(target, key) {
63
- decorator(target, key, paramIndex);
64
- };
65
- }
66
-
67
- //#endregion
68
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
69
- function __decorate(decorators, target, key, desc) {
70
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
71
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
72
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
73
- return c > 3 && r && Object.defineProperty(target, key, r), r;
74
- }
75
-
76
- //#endregion
77
- //#region src/services/doc-selection-manager.service.ts
18
+ // src/services/doc-selection-manager.service.ts
78
19
  /**
79
20
  * Keeps a programmatically restored collapsed caret from being promoted back
80
21
  * into a neighboring whole-entity selection by feature-specific UI.
@@ -85,12 +26,12 @@ let DocSelectionManagerService = class DocSelectionManagerService extends _unive
85
26
  super();
86
27
  this._commandService = _commandService;
87
28
  this._univerInstanceService = _univerInstanceService;
88
- _defineProperty(this, "_currentSelection", null);
89
- _defineProperty(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
90
- _defineProperty(this, "_textSelection$", new rxjs.Subject());
91
- _defineProperty(this, "textSelection$", this._textSelection$.asObservable());
92
- _defineProperty(this, "_refreshSelection$", new rxjs.BehaviorSubject(null));
93
- _defineProperty(this, "refreshSelection$", this._refreshSelection$.asObservable());
29
+ require_protocol._defineProperty(this, "_currentSelection", null);
30
+ require_protocol._defineProperty(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
31
+ require_protocol._defineProperty(this, "_textSelection$", new rxjs.Subject());
32
+ require_protocol._defineProperty(this, "textSelection$", this._textSelection$.asObservable());
33
+ require_protocol._defineProperty(this, "_refreshSelection$", new rxjs.BehaviorSubject(null));
34
+ require_protocol._defineProperty(this, "refreshSelection$", this._refreshSelection$.asObservable());
94
35
  this._listenCurrentUnit();
95
36
  }
96
37
  _listenCurrentUnit() {
@@ -250,666 +191,9 @@ let DocSelectionManagerService = class DocSelectionManagerService extends _unive
250
191
  else unitTextRange.get(subUnitId).textRanges.push(...insertParam.textRanges);
251
192
  }
252
193
  };
253
- DocSelectionManagerService = __decorate([__decorateParam(0, _univerjs_core.ICommandService), __decorateParam(1, _univerjs_core.IUniverInstanceService)], DocSelectionManagerService);
254
-
255
- //#endregion
256
- //#region src/commands/mutations/core-editing.mutation-id.ts
257
- /**
258
- * Copyright 2023-present DreamNum Co., Ltd.
259
- *
260
- * Licensed under the Apache License, Version 2.0 (the "License");
261
- * you may not use this file except in compliance with the License.
262
- * You may obtain a copy of the License at
263
- *
264
- * http://www.apache.org/licenses/LICENSE-2.0
265
- *
266
- * Unless required by applicable law or agreed to in writing, software
267
- * distributed under the License is distributed on an "AS IS" BASIS,
268
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
269
- * See the License for the specific language governing permissions and
270
- * limitations under the License.
271
- */
272
- const RICH_TEXT_EDITING_MUTATION_ID = "doc.mutation.rich-text-editing";
273
-
274
- //#endregion
275
- //#region src/services/document-layout-snapshot.ts
276
- function projectCustomBlock(block) {
277
- const { docxRawXml: _docxRawXml, docxExportTs: _docxExportTs, ...layoutBlock } = block;
278
- return layoutBlock;
279
- }
280
- function projectDocumentBody(body) {
281
- const { docxRawCustomBlocks: _docxRawCustomBlocks, docxRawBlocks: _docxRawBlocks, docxExportExcludedRanges: _docxExportExcludedRanges, payloads: _payloads, customBlocks, ...layoutBody } = body;
282
- return {
283
- ...layoutBody,
284
- ...customBlocks == null ? {} : { customBlocks: customBlocks.map(projectCustomBlock) }
285
- };
286
- }
287
- function projectHeader(header) {
288
- return {
289
- ...header,
290
- body: projectDocumentBody(header.body)
291
- };
292
- }
293
- function projectFooter(footer) {
294
- return {
295
- ...footer,
296
- body: projectDocumentBody(footer.body)
297
- };
298
- }
299
- /**
300
- * Builds the model snapshot owned by the layout Worker. Exchange-only payloads
301
- * remain in the authoritative Main model and are deliberately excluded from
302
- * the structured-clone boundary because they do not affect document geometry.
303
- */
304
- function createDocumentLayoutSnapshot(snapshot) {
305
- const { resources: _resources, body, headers, footers, footnotes, endnotes, ...layoutSnapshot } = snapshot;
306
- return {
307
- ...layoutSnapshot,
308
- ...footnotes == null ? {} : { footnotes: Object.fromEntries(Object.entries(footnotes).map(([id, note]) => [id, {
309
- ...note,
310
- body: projectDocumentBody(note.body)
311
- }])) },
312
- ...endnotes == null ? {} : { endnotes: Object.fromEntries(Object.entries(endnotes).map(([id, note]) => [id, {
313
- ...note,
314
- body: projectDocumentBody(note.body)
315
- }])) },
316
- ...body == null ? {} : { body: projectDocumentBody(body) },
317
- ...headers == null ? {} : { headers: Object.fromEntries(Object.entries(headers).map(([headerId, header]) => [headerId, projectHeader(header)])) },
318
- ...footers == null ? {} : { footers: Object.fromEntries(Object.entries(footers).map(([footerId, footer]) => [footerId, projectFooter(footer)])) }
319
- };
320
- }
321
-
322
- //#endregion
323
- //#region src/services/doc-layout-executor.service.ts
324
- var _DocLayoutExecutorService;
325
- let DocLayoutExecutorType = /* @__PURE__ */ function(DocLayoutExecutorType) {
326
- DocLayoutExecutorType["MAIN_THREAD"] = "main-thread";
327
- DocLayoutExecutorType["WORKER"] = "worker";
328
- return DocLayoutExecutorType;
329
- }({});
330
- let DocLayoutSessionStatus = /* @__PURE__ */ function(DocLayoutSessionStatus) {
331
- DocLayoutSessionStatus["ACCEPTED"] = "accepted";
332
- DocLayoutSessionStatus["NOT_FOUND"] = "not-found";
333
- DocLayoutSessionStatus["RESNAPSHOT_REQUIRED"] = "resnapshot-required";
334
- DocLayoutSessionStatus["SUPERSEDED"] = "superseded";
335
- return DocLayoutSessionStatus;
336
- }({});
337
- let DocLayoutExecutorState = /* @__PURE__ */ function(DocLayoutExecutorState) {
338
- DocLayoutExecutorState["UNREGISTERED"] = "unregistered";
339
- DocLayoutExecutorState["INITIALIZING"] = "initializing";
340
- DocLayoutExecutorState["ACTIVE"] = "active";
341
- DocLayoutExecutorState["RECOVERING"] = "recovering";
342
- DocLayoutExecutorState["FAILED"] = "failed";
343
- return DocLayoutExecutorState;
344
- }({});
345
- function areShallowRecordsEqual(left, right) {
346
- const leftRecord = left;
347
- const rightRecord = right;
348
- const leftKeys = Object.keys(leftRecord);
349
- const rightKeys = Object.keys(rightRecord);
350
- return leftKeys.length === rightKeys.length && leftKeys.every((key) => leftRecord[key] === rightRecord[key]);
351
- }
352
- function createRecordPatch(previous, current) {
353
- const upserts = {};
354
- const removals = [];
355
- for (const [key, value] of Object.entries(current)) if (previous[key] == null || !areShallowRecordsEqual(previous[key], value)) upserts[key] = value;
356
- for (const key of Object.keys(previous)) if (current[key] == null) removals.push(key);
357
- return {
358
- removals,
359
- upserts
360
- };
361
- }
362
- function getCustomRangePresentationKey$1(entry) {
363
- return JSON.stringify([entry.segmentId, entry.rangeId]);
364
- }
365
- function toCustomRangePresentationMap(entries) {
366
- return new Map(entries.map((entry) => [getCustomRangePresentationKey$1(entry), entry]));
367
- }
368
- function createCustomRangePresentationPatch(previous, current) {
369
- const upserts = [];
370
- const removals = [];
371
- for (const [key, entry] of current) {
372
- const previousEntry = previous.get(key);
373
- if (previousEntry == null || !areShallowRecordsEqual(previousEntry.presentation, entry.presentation)) upserts.push(entry);
374
- }
375
- for (const [key, entry] of previous) if (!current.has(key)) removals.push({
376
- segmentId: entry.segmentId,
377
- rangeId: entry.rangeId
378
- });
379
- return {
380
- removals,
381
- upserts
382
- };
383
- }
384
- function isRichTextEditingMutationParams(value) {
385
- return typeof value === "object" && value != null && "unitId" in value && typeof value.unitId === "string" && "actions" in value;
386
- }
387
- function collectCustomBlockViewports(dataModel, options) {
388
- var _documentStyle$pageSi, _documentStyle$pageSi2;
389
- const snapshot = dataModel.getSnapshot();
390
- const documentStyle = snapshot.documentStyle;
391
- const isModern = documentStyle.documentFlavor === _univerjs_core.DocumentFlavor.MODERN;
392
- const modernMargin = options.modernHorizontalMargin ?? _univerjs_core.MODERN_DOCUMENT_DEFAULT_MARGIN;
393
- const pageMarginLeft = isModern ? modernMargin : documentStyle.marginLeft;
394
- const pageMarginRight = isModern ? modernMargin : documentStyle.marginRight;
395
- const pageWidth = isModern ? options.modernPageWidth ?? ((_documentStyle$pageSi = documentStyle.pageSize) === null || _documentStyle$pageSi === void 0 ? void 0 : _documentStyle$pageSi.width) ?? _univerjs_core.MODERN_DOCUMENT_WIDTH[_univerjs_core.ModernDocumentWidthMode.MEDIUM] : (_documentStyle$pageSi2 = documentStyle.pageSize) === null || _documentStyle$pageSi2 === void 0 ? void 0 : _documentStyle$pageSi2.width;
396
- const viewports = {};
397
- const bodies = [
398
- snapshot.body,
399
- ...Object.values(snapshot.headers ?? {}).map((header) => header.body),
400
- ...Object.values(snapshot.footers ?? {}).map((footer) => footer.body)
401
- ];
402
- for (const customBlock of bodies.flatMap((body) => (body === null || body === void 0 ? void 0 : body.customBlocks) ?? [])) {
403
- var _snapshot$drawings;
404
- const drawing = (_snapshot$drawings = snapshot.drawings) === null || _snapshot$drawings === void 0 ? void 0 : _snapshot$drawings[customBlock.blockId];
405
- if (drawing == null) continue;
406
- const viewport = (0, _univerjs_engine_render.getDocsCustomBlockRenderViewport)(dataModel.getUnitId(), customBlock.blockId, {
407
- fallbackHeight: drawing.docTransform.size.height ?? 0,
408
- fallbackWidth: drawing.docTransform.size.width ?? 0,
409
- pageMarginLeft,
410
- pageMarginRight,
411
- pageWidth
412
- });
413
- if (viewport != null) viewports[customBlock.blockId] = { ...viewport };
414
- }
415
- return viewports;
416
- }
417
- let DocLayoutExecutorService = _DocLayoutExecutorService = class DocLayoutExecutorService extends _univerjs_core.Disposable {
418
- constructor(_univerInstanceService, _commandService, _localeService, _logService) {
419
- super();
420
- this._univerInstanceService = _univerInstanceService;
421
- this._commandService = _commandService;
422
- this._localeService = _localeService;
423
- this._logService = _logService;
424
- _defineProperty(this, "_executor", null);
425
- _defineProperty(this, "_executorReady", null);
426
- _defineProperty(this, "_recoveryFailure", null);
427
- _defineProperty(this, "_sessionEpoch", 0);
428
- _defineProperty(this, "_sessions", /* @__PURE__ */ new Map());
429
- _defineProperty(this, "_hydrationSamples", /* @__PURE__ */ new Map());
430
- _defineProperty(this, "_customRangePresentationProviders", /* @__PURE__ */ new Set());
431
- _defineProperty(this, "_executorStatus$", new rxjs.BehaviorSubject({
432
- state: "unregistered",
433
- executor: null,
434
- diagnostic: null,
435
- recoveryUnitId: null
436
- }));
437
- _defineProperty(this, "executorStatus$", this._executorStatus$.asObservable());
438
- this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(_univerjs_core.UniverInstanceType.UNIVER_DOC).subscribe(({ unit }) => this._createSessionIfEligible(unit)));
439
- this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(_univerjs_core.UniverInstanceType.UNIVER_DOC).subscribe((unit) => this._disposeSession(unit.getUnitId())));
440
- this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
441
- if (command.id !== "doc.mutation.rich-text-editing") return;
442
- const params = command.params;
443
- if (!isRichTextEditingMutationParams(params)) {
444
- this._logService.warn("[DocLayoutExecutorService]: ignored malformed document mutation parameters.");
445
- return;
446
- }
447
- this._enqueueCommittedMutation(params);
448
- }));
449
- this.disposeWithMe(this._localeService.localeChanged$.subscribe(() => {
450
- for (const unitId of this._sessions.keys()) {
451
- const dataModel = this._getEligibleModel(unitId);
452
- if (dataModel != null) this._replaceSession(dataModel).catch((error) => {
453
- this._logService.error("[DocLayoutExecutorService]: failed to refresh Worker locale.", error);
454
- });
455
- }
456
- }));
457
- }
458
- register(executor) {
459
- if (this._executor != null) throw new Error("A document layout executor is already registered.");
460
- this._executor = executor;
461
- this._recoveryFailure = null;
462
- this._executorStatus$.next({
463
- state: "initializing",
464
- executor: executor.type,
465
- diagnostic: null,
466
- recoveryUnitId: null
467
- });
468
- const executorReady = executor.initialize();
469
- this._executorReady = executorReady;
470
- executorReady.then(() => {
471
- if (this._executor === executor) this._executorStatus$.next({
472
- state: "active",
473
- executor: executor.type,
474
- diagnostic: null,
475
- recoveryUnitId: null
476
- });
477
- }).catch((error) => {
478
- if (this._executor !== executor) return;
479
- this._executor = null;
480
- this._executorReady = null;
481
- this._disposeManagedSessions();
482
- this._sessions.clear();
483
- const diagnostic = error instanceof Error ? error.message : String(error);
484
- this._executorStatus$.next({
485
- state: "failed",
486
- executor: executor.type,
487
- diagnostic,
488
- recoveryUnitId: null
489
- });
490
- this._logService.error("[DocLayoutExecutorService]: document layout executor initialization failed.", error);
491
- });
492
- for (const unit of this._univerInstanceService.getAllUnitsForType(_univerjs_core.UniverInstanceType.UNIVER_DOC)) this._createSessionIfEligible(unit);
493
- return (0, _univerjs_core.toDisposable)(() => {
494
- if (this._executor === executor) {
495
- this._executor = null;
496
- this._executorReady = null;
497
- this._disposeManagedSessions();
498
- this._sessions.clear();
499
- this._executorStatus$.next({
500
- state: "unregistered",
501
- executor: null,
502
- diagnostic: null,
503
- recoveryUnitId: null
504
- });
505
- }
506
- });
507
- }
508
- getExecutor() {
509
- return this._executor;
510
- }
511
- getExecutorStatus() {
512
- return this._executorStatus$.value;
513
- }
514
- registerCustomRangePresentationProvider(provider) {
515
- this._customRangePresentationProviders.add(provider);
516
- return (0, _univerjs_core.toDisposable)(() => this._customRangePresentationProviders.delete(provider));
517
- }
518
- async getPerformanceMetrics(unitId) {
519
- var _this$_executor;
520
- const executorMetrics = await ((_this$_executor = this._executor) === null || _this$_executor === void 0 ? void 0 : _this$_executor.getPerformanceMetrics(unitId));
521
- return {
522
- hydrationMs: [...this._hydrationSamples.get(unitId) ?? []],
523
- mutationTransferMs: [...(executorMetrics === null || executorMetrics === void 0 ? void 0 : executorMetrics.mutationTransferMs) ?? []],
524
- patchTransferMs: [...(executorMetrics === null || executorMetrics === void 0 ? void 0 : executorMetrics.patchTransferMs) ?? []],
525
- snapshotTransferMs: [...(executorMetrics === null || executorMetrics === void 0 ? void 0 : executorMetrics.snapshotTransferMs) ?? []]
526
- };
527
- }
528
- async resetPerformanceMetrics(unitId) {
529
- var _this$_executor2;
530
- this._hydrationSamples.delete(unitId);
531
- await ((_this$_executor2 = this._executor) === null || _this$_executor2 === void 0 ? void 0 : _this$_executor2.resetPerformanceMetrics(unitId));
532
- }
533
- recordHydrationDuration(unitId, durationMs) {
534
- this._appendPerformanceSample(this._hydrationSamples, unitId, durationMs);
535
- }
536
- async recoverExecutor(unitId, diagnostic) {
537
- const executor = this._requireExecutor();
538
- this._executorStatus$.next({
539
- state: "recovering",
540
- executor: executor.type,
541
- diagnostic,
542
- recoveryUnitId: unitId
543
- });
544
- for (const session of this._sessions.values()) this._markSessionDisposed(session);
545
- this._sessions.clear();
546
- this._hydrationSamples.clear();
547
- try {
548
- const executorReady = executor.recover();
549
- this._executorReady = executorReady;
550
- await executorReady;
551
- } catch (error) {
552
- if (this._executor === executor) {
553
- const recoveryDiagnostic = error instanceof Error ? error.message : String(error);
554
- this._executor = null;
555
- this._executorReady = null;
556
- this._recoveryFailure = {
557
- diagnostic: recoveryDiagnostic,
558
- unitId
559
- };
560
- this._executorStatus$.next({
561
- state: "recovering",
562
- executor: executor.type,
563
- diagnostic: recoveryDiagnostic,
564
- recoveryUnitId: unitId
565
- });
566
- }
567
- throw error;
568
- }
569
- }
570
- completeRecovery(unitId) {
571
- var _this$_recoveryFailur;
572
- const status = this._executorStatus$.value;
573
- if (status.state !== "recovering" || status.recoveryUnitId !== unitId) return;
574
- const recoveryFailure = ((_this$_recoveryFailur = this._recoveryFailure) === null || _this$_recoveryFailur === void 0 ? void 0 : _this$_recoveryFailur.unitId) === unitId ? this._recoveryFailure : null;
575
- this._recoveryFailure = null;
576
- this._executorStatus$.next({
577
- state: recoveryFailure == null ? "active" : "failed",
578
- executor: status.executor,
579
- diagnostic: (recoveryFailure === null || recoveryFailure === void 0 ? void 0 : recoveryFailure.diagnostic) ?? null,
580
- recoveryUnitId: null
581
- });
582
- }
583
- async startLayout(identity, options, budgetMs) {
584
- const { unitId } = identity;
585
- const executor = this._executor;
586
- const dataModel = this._getEligibleModel(unitId);
587
- if (executor == null || dataModel == null) return null;
588
- let session = this._sessions.get(unitId);
589
- if (session != null && session.sourceMutationRevision !== dataModel.getMutationRevision()) session.needsResnapshot = true;
590
- if (session == null || session.needsResnapshot) session = await this._replaceSession(dataModel);
591
- if (session.disposed || this._executor !== executor || this._getEligibleModel(unitId) !== dataModel) return null;
592
- let result = await this._startSynchronizedLayout(executor, session, identity, options, budgetMs);
593
- if (session.disposed || this._executor !== executor || this._getEligibleModel(unitId) !== dataModel) return null;
594
- if (result.status === "not-found" || result.status === "resnapshot-required") {
595
- session = await this._replaceSession(dataModel);
596
- result = await this._startSynchronizedLayout(executor, session, identity, options, budgetMs);
597
- }
598
- return result;
599
- }
600
- stepLayout(request) {
601
- return this._requireExecutor().stepLayout(request);
602
- }
603
- publishBacklog(request) {
604
- return this._requireExecutor().publishBacklog(request);
605
- }
606
- getLayoutPage(request) {
607
- return this._requireExecutor().getLayoutPage(request);
608
- }
609
- cancelLayout(request) {
610
- const executor = this._executor;
611
- return executor == null ? Promise.resolve() : executor.cancelLayout(request);
612
- }
613
- disposeLayoutMount(request) {
614
- const executor = this._executor;
615
- const session = this._sessions.get(request.unitId);
616
- const latestStart = session === null || session === void 0 ? void 0 : session.latestStarts.get(request.mountId);
617
- if ((latestStart === null || latestStart === void 0 ? void 0 : latestStart.mountEpoch) === request.mountEpoch && latestStart.viewportEpoch === request.viewportEpoch) {
618
- session === null || session === void 0 || session.latestStarts.delete(request.mountId);
619
- session === null || session === void 0 || session.customBlockViewportsByMount.delete(request.mountId);
620
- }
621
- return executor == null ? Promise.resolve() : executor.disposeLayoutMount(request);
622
- }
623
- dispose() {
624
- const executor = this._executor;
625
- if (executor != null) for (const [unitId, session] of this._sessions) {
626
- this._markSessionDisposed(session);
627
- executor.disposeSession({
628
- unitId,
629
- sessionEpoch: session.sessionEpoch
630
- }).catch((error) => {
631
- if (this._executor === executor) this._logService.error("[DocLayoutExecutorService]: failed to dispose a Worker session.", error);
632
- });
633
- }
634
- this._sessions.clear();
635
- this._executor = null;
636
- this._executorReady = null;
637
- this._recoveryFailure = null;
638
- this._executorStatus$.complete();
639
- this._customRangePresentationProviders.clear();
640
- super.dispose();
641
- }
642
- _createSessionIfEligible(dataModel) {
643
- if (this._executor == null || !this._isEligible(dataModel) || this._sessions.has(dataModel.getUnitId())) return;
644
- this._replaceSession(dataModel).catch((error) => {
645
- this._logService.error("[DocLayoutExecutorService]: failed to create a Worker session.", error);
646
- });
647
- }
648
- _enqueueCommittedMutation(params) {
649
- var _params$actions;
650
- const executor = this._executor;
651
- const dataModel = this._getEligibleModel(params.unitId);
652
- if (executor == null || dataModel == null) return;
653
- if (_univerjs_core.JSONX.isNoop(params.actions) || ((_params$actions = params.actions) === null || _params$actions === void 0 ? void 0 : _params$actions.length) === 0) return;
654
- const session = this._sessions.get(params.unitId);
655
- if (session == null) {
656
- this._replaceSession(dataModel).catch((error) => {
657
- this._logService.error("[DocLayoutExecutorService]: failed to snapshot a document mutation.", error);
658
- });
659
- return;
660
- }
661
- const sourceMutationRevision = dataModel.getMutationRevision();
662
- if (sourceMutationRevision !== session.sourceMutationRevision + 1) {
663
- session.needsResnapshot = true;
664
- return;
665
- }
666
- const baseRevision = session.modelRevision;
667
- const modelRevision = baseRevision + 1;
668
- session.modelRevision = modelRevision;
669
- session.sourceMutationRevision = sourceMutationRevision;
670
- session.pendingMutations.push({
671
- baseRevision,
672
- modelRevision,
673
- actions: params.actions
674
- });
675
- }
676
- async _startSynchronizedLayout(executor, session, identity, options, budgetMs) {
677
- var _session$latestStarts;
678
- const { unitId, mountId } = identity;
679
- const startId = (((_session$latestStarts = session.latestStarts.get(mountId)) === null || _session$latestStarts === void 0 ? void 0 : _session$latestStarts.startId) ?? 0) + 1;
680
- const startIdentity = {
681
- startId,
682
- mountEpoch: identity.mountEpoch,
683
- viewportEpoch: identity.viewportEpoch
684
- };
685
- session.latestStarts.set(mountId, startIdentity);
686
- const startTask = session.queue.then(async () => {
687
- if (session.disposed || this._executor !== executor) return { status: "not-found" };
688
- const currentModel = this._getEligibleModel(unitId);
689
- if (currentModel == null || currentModel.getMutationRevision() !== session.sourceMutationRevision) {
690
- session.needsResnapshot = true;
691
- return {
692
- status: "resnapshot-required",
693
- modelRevision: session.workerRevision
694
- };
695
- }
696
- if (session.latestStarts.get(mountId) !== startIdentity) return { status: "superseded" };
697
- const mutations = session.pendingMutations.slice();
698
- const projections = this._createLayoutProjectionPayload(session, identity, this._getRequiredModel(unitId), options);
699
- const request = {
700
- ...identity,
701
- metricsRevision: startId,
702
- baseRevision: session.workerRevision,
703
- modelRevision: session.modelRevision,
704
- mutations,
705
- ...projections.request,
706
- budgetMs,
707
- ...options
708
- };
709
- const result = await executor.startLayout(request);
710
- if (result.status === "accepted") {
711
- session.workerRevision = request.modelRevision;
712
- session.pendingMutations.splice(0, mutations.length);
713
- session.customBlockViewportsByMount.set(mountId, {
714
- mountEpoch: identity.mountEpoch,
715
- value: projections.customBlockViewports
716
- });
717
- session.customRangePresentations = projections.customRangePresentations;
718
- } else session.needsResnapshot = true;
719
- return result;
720
- });
721
- session.queue = startTask.then(() => void 0, (error) => {
722
- if (session.disposed || this._executor !== executor) return;
723
- session.needsResnapshot = true;
724
- this._logService.error("[DocLayoutExecutorService]: synchronized layout start failed.", error);
725
- });
726
- return startTask;
727
- }
728
- _createLayoutProjectionPayload(session, identity, dataModel, options) {
729
- const customBlockViewports = collectCustomBlockViewports(dataModel, options);
730
- const previousCustomBlockViewports = session.customBlockViewportsByMount.get(identity.mountId);
731
- const customRangePresentations = this._collectCustomRangePresentations(dataModel);
732
- const customRangePresentationMap = toCustomRangePresentationMap(customRangePresentations);
733
- const request = {};
734
- if (previousCustomBlockViewports == null || previousCustomBlockViewports.mountEpoch !== identity.mountEpoch) request.customBlockViewports = customBlockViewports;
735
- else {
736
- const patch = createRecordPatch(previousCustomBlockViewports.value, customBlockViewports);
737
- if (patch.removals.length > 0 || Object.keys(patch.upserts).length > 0) request.customBlockViewportPatch = patch;
738
- }
739
- if (session.customRangePresentations == null) request.customRangePresentations = customRangePresentations;
740
- else {
741
- const patch = createCustomRangePresentationPatch(session.customRangePresentations, customRangePresentationMap);
742
- if (patch.removals.length > 0 || patch.upserts.length > 0) request.customRangePresentationPatch = patch;
743
- }
744
- return {
745
- request,
746
- customBlockViewports,
747
- customRangePresentations: customRangePresentationMap
748
- };
749
- }
750
- async _replaceSession(dataModel) {
751
- const executor = this._requireExecutor();
752
- const unitId = dataModel.getUnitId();
753
- const previous = this._sessions.get(unitId);
754
- if (previous != null) this._markSessionDisposed(previous);
755
- const modelRevision = (previous === null || previous === void 0 ? void 0 : previous.modelRevision) ?? 0;
756
- const session = {
757
- sessionEpoch: ++this._sessionEpoch,
758
- modelRevision,
759
- sourceMutationRevision: dataModel.getMutationRevision(),
760
- workerRevision: modelRevision,
761
- pendingMutations: [],
762
- latestStarts: /* @__PURE__ */ new Map(),
763
- customBlockViewportsByMount: /* @__PURE__ */ new Map(),
764
- customRangePresentations: null,
765
- queue: Promise.resolve(),
766
- needsResnapshot: false,
767
- disposed: false,
768
- cancelPendingCreateTask: null
769
- };
770
- const createTask = this._createSessionOnNextMacroTask(executor, session, dataModel);
771
- session.queue = createTask;
772
- this._sessions.set(unitId, session);
773
- try {
774
- await createTask;
775
- } catch (error) {
776
- if (!session.disposed && this._executor === executor) {
777
- session.needsResnapshot = true;
778
- throw error;
779
- }
780
- }
781
- return session;
782
- }
783
- _disposeSession(unitId) {
784
- const session = this._sessions.get(unitId);
785
- if (session == null) return;
786
- this._markSessionDisposed(session);
787
- this._sessions.delete(unitId);
788
- this._hydrationSamples.delete(unitId);
789
- const executor = this._executor;
790
- executor === null || executor === void 0 || executor.disposeSession({
791
- unitId,
792
- sessionEpoch: session.sessionEpoch
793
- }).catch((error) => {
794
- if (this._executor === executor) this._logService.error("[DocLayoutExecutorService]: failed to dispose a Worker session.", error);
795
- });
796
- }
797
- _getEligibleModel(unitId) {
798
- const dataModel = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
799
- return dataModel != null && this._isEligible(dataModel) ? dataModel : null;
800
- }
801
- _getRequiredModel(unitId) {
802
- const dataModel = this._getEligibleModel(unitId);
803
- if (dataModel == null) throw new Error(`Eligible document model not found for Worker layout: "${unitId}".`);
804
- return dataModel;
805
- }
806
- _collectCustomRangePresentations(dataModel) {
807
- const presentations = [];
808
- const providers = Array.from(this._customRangePresentationProviders).reverse();
809
- if (providers.length === 0) return presentations;
810
- const collectSegment = (segmentId, body) => {
811
- if (body == null) return;
812
- const seenRangeIds = /* @__PURE__ */ new Set();
813
- for (const range of body.customRanges ?? []) {
814
- if (seenRangeIds.has(range.rangeId)) continue;
815
- seenRangeIds.add(range.rangeId);
816
- for (const provider of providers) {
817
- const presentation = provider(dataModel.getUnitId(), range, {
818
- segmentId,
819
- body
820
- });
821
- if (presentation != null) {
822
- presentations.push({
823
- segmentId,
824
- rangeId: range.rangeId,
825
- presentation: { ...presentation }
826
- });
827
- break;
828
- }
829
- }
830
- }
831
- };
832
- collectSegment("", dataModel.getBody());
833
- for (const [segmentId, headerModel] of dataModel.headerModelMap) collectSegment(segmentId, headerModel.getBody());
834
- for (const [segmentId, footerModel] of dataModel.footerModelMap) collectSegment(segmentId, footerModel.getBody());
835
- return presentations;
836
- }
837
- _isEligible(dataModel) {
838
- if ((0, _univerjs_core.isInternalEditorID)(dataModel.getUnitId())) return false;
839
- const flavor = dataModel.getSnapshot().documentStyle.documentFlavor;
840
- return flavor === _univerjs_core.DocumentFlavor.TRADITIONAL || flavor === _univerjs_core.DocumentFlavor.MODERN;
841
- }
842
- _requireExecutor() {
843
- if (this._executor == null) throw new Error("No document layout executor is registered.");
844
- return this._executor;
845
- }
846
- _appendPerformanceSample(target, unitId, durationMs) {
847
- const samples = target.get(unitId) ?? [];
848
- samples.push(durationMs);
849
- if (samples.length > _DocLayoutExecutorService._performanceSampleLimit) samples.splice(0, samples.length - _DocLayoutExecutorService._performanceSampleLimit);
850
- target.set(unitId, samples);
851
- }
852
- _createSessionOnNextMacroTask(executor, session, dataModel) {
853
- return new Promise((resolve, reject) => {
854
- const cancelTask = (0, _univerjs_core.requestImmediateMacroTask)(() => {
855
- session.cancelPendingCreateTask = null;
856
- const unitId = dataModel.getUnitId();
857
- if (session.disposed || this._executor !== executor || this._sessions.get(unitId) !== session) {
858
- resolve();
859
- return;
860
- }
861
- const executorReady = this._executorReady;
862
- if (executorReady == null) {
863
- resolve();
864
- return;
865
- }
866
- executorReady.then(() => {
867
- if (session.disposed || this._executor !== executor || this._sessions.get(unitId) !== session || this._getEligibleModel(unitId) !== dataModel) {
868
- resolve();
869
- return;
870
- }
871
- session.sourceMutationRevision = dataModel.getMutationRevision();
872
- session.workerRevision = session.modelRevision;
873
- session.pendingMutations.length = 0;
874
- const request = {
875
- unitId,
876
- sessionEpoch: session.sessionEpoch,
877
- snapshot: createDocumentLayoutSnapshot(dataModel.getSnapshot()),
878
- modelRevision: session.modelRevision,
879
- locale: this._localeService.getCurrentLocale(),
880
- localeData: this._localeService.getLocales(),
881
- direction: this._localeService.getDirection()
882
- };
883
- executor.createSession(request).then(resolve, reject);
884
- }, reject);
885
- });
886
- session.cancelPendingCreateTask = () => {
887
- cancelTask();
888
- session.cancelPendingCreateTask = null;
889
- resolve();
890
- };
891
- });
892
- }
893
- _markSessionDisposed(session) {
894
- var _session$cancelPendin;
895
- session.disposed = true;
896
- (_session$cancelPendin = session.cancelPendingCreateTask) === null || _session$cancelPendin === void 0 || _session$cancelPendin.call(session);
897
- session.cancelPendingCreateTask = null;
898
- }
899
- _disposeManagedSessions() {
900
- for (const session of this._sessions.values()) this._markSessionDisposed(session);
901
- }
902
- };
903
- _defineProperty(DocLayoutExecutorService, "_performanceSampleLimit", 2048);
904
- DocLayoutExecutorService = _DocLayoutExecutorService = __decorate([
905
- __decorateParam(0, _univerjs_core.IUniverInstanceService),
906
- __decorateParam(1, _univerjs_core.ICommandService),
907
- __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
908
- __decorateParam(3, _univerjs_core.ILogService)
909
- ], DocLayoutExecutorService);
194
+ DocSelectionManagerService = require_protocol.__decorate([require_protocol.__decorateParam(0, _univerjs_core.ICommandService), require_protocol.__decorateParam(1, _univerjs_core.IUniverInstanceService)], DocSelectionManagerService);
910
195
 
911
- //#endregion
912
- //#region src/services/doc-skeleton-manager.service.ts
196
+ // src/services/doc-skeleton-manager.service.ts
913
197
  let DocSkeletonManagerService = class DocSkeletonManagerService extends _univerjs_core.RxDisposable {
914
198
  constructor(_context, _localeService, _univerInstanceService, _docLayoutExecutorService, _configService) {
915
199
  super();
@@ -918,14 +202,14 @@ let DocSkeletonManagerService = class DocSkeletonManagerService extends _univerj
918
202
  this._univerInstanceService = _univerInstanceService;
919
203
  this._docLayoutExecutorService = _docLayoutExecutorService;
920
204
  this._configService = _configService;
921
- _defineProperty(this, "_skeleton", void 0);
922
- _defineProperty(this, "_docViewModel", void 0);
923
- _defineProperty(this, "_currentSkeleton$", new rxjs.BehaviorSubject(null));
924
- _defineProperty(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
925
- _defineProperty(this, "_currentSkeletonBefore$", new rxjs.BehaviorSubject(null));
926
- _defineProperty(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
927
- _defineProperty(this, "_currentViewModel$", new rxjs.BehaviorSubject(null));
928
- _defineProperty(this, "currentViewModel$", this._currentViewModel$.asObservable());
205
+ require_protocol._defineProperty(this, "_skeleton", void 0);
206
+ require_protocol._defineProperty(this, "_docViewModel", void 0);
207
+ require_protocol._defineProperty(this, "_currentSkeleton$", new rxjs.BehaviorSubject(null));
208
+ require_protocol._defineProperty(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
209
+ require_protocol._defineProperty(this, "_currentSkeletonBefore$", new rxjs.BehaviorSubject(null));
210
+ require_protocol._defineProperty(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
211
+ require_protocol._defineProperty(this, "_currentViewModel$", new rxjs.BehaviorSubject(null));
212
+ require_protocol._defineProperty(this, "currentViewModel$", this._currentViewModel$.asObservable());
929
213
  this._init();
930
214
  this._univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_DOC).pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe((documentModel) => {
931
215
  if (documentModel && documentModel.getUnitId() === this._context.unitId) this._update(documentModel);
@@ -981,23 +265,22 @@ let DocSkeletonManagerService = class DocSkeletonManagerService extends _univerj
981
265
  return _univerjs_engine_render.DocumentSkeleton.create(documentViewModel, this._localeService, { lineGap: isSheetEditor ? this._configService.getConfig(_univerjs_core.SHEET_TEXT_LINE_GAP) : void 0 });
982
266
  }
983
267
  _buildDocViewModel(documentDataModel) {
984
- return new _univerjs_engine_render.DocumentViewModel(documentDataModel);
268
+ return this._context.unitId === _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY || this._context.unitId === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY ? new _univerjs_engine_render.SheetCellDocumentViewModel(documentDataModel) : new _univerjs_engine_render.DocumentViewModel(documentDataModel);
985
269
  }
986
270
  };
987
- DocSkeletonManagerService = __decorate([
988
- __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
989
- __decorateParam(2, _univerjs_core.IUniverInstanceService),
990
- __decorateParam(3, (0, _univerjs_core.Inject)(DocLayoutExecutorService)),
991
- __decorateParam(4, _univerjs_core.IConfigService)
271
+ DocSkeletonManagerService = require_protocol.__decorate([
272
+ require_protocol.__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
273
+ require_protocol.__decorateParam(2, _univerjs_core.IUniverInstanceService),
274
+ require_protocol.__decorateParam(3, (0, _univerjs_core.Inject)(require_protocol.DocLayoutExecutorService)),
275
+ require_protocol.__decorateParam(4, _univerjs_core.IConfigService)
992
276
  ], DocSkeletonManagerService);
993
277
 
994
- //#endregion
995
- //#region src/services/doc-state-emit.service.ts
278
+ // src/services/doc-state-emit.service.ts
996
279
  var DocStateEmitService = class extends _univerjs_core.RxDisposable {
997
280
  constructor() {
998
281
  super();
999
- _defineProperty(this, "_docStateChangeParams$", new rxjs.BehaviorSubject(null));
1000
- _defineProperty(this, "docStateChangeParams$", this._docStateChangeParams$.asObservable());
282
+ require_protocol._defineProperty(this, "_docStateChangeParams$", new rxjs.BehaviorSubject(null));
283
+ require_protocol._defineProperty(this, "docStateChangeParams$", this._docStateChangeParams$.asObservable());
1001
284
  }
1002
285
  emitStateChangeInfo(params) {
1003
286
  this._docStateChangeParams$.next(params);
@@ -1008,8 +291,7 @@ var DocStateEmitService = class extends _univerjs_core.RxDisposable {
1008
291
  }
1009
292
  };
1010
293
 
1011
- //#endregion
1012
- //#region src/commands/mutations/doc-structure-mutation-validation.ts
294
+ // src/commands/mutations/doc-structure-mutation-validation.ts
1013
295
  const STRUCTURAL_BODY_FIELDS = [
1014
296
  "paragraphs",
1015
297
  "sectionBreaks",
@@ -1052,7 +334,7 @@ const NON_STRUCTURAL_ROOT_FIELDS = /* @__PURE__ */ new Set([
1052
334
  "tableSource",
1053
335
  "title"
1054
336
  ]);
1055
- function isRecord$3(value) {
337
+ function isRecord$2(value) {
1056
338
  return typeof value === "object" && value != null && !Array.isArray(value);
1057
339
  }
1058
340
  function containsStructuralToken(dataStream) {
@@ -1060,7 +342,7 @@ function containsStructuralToken(dataStream) {
1060
342
  return false;
1061
343
  }
1062
344
  function isStructurePreservingBody(value) {
1063
- if (!isRecord$3(value)) return false;
345
+ if (!isRecord$2(value)) return false;
1064
346
  const dataStream = value.dataStream;
1065
347
  if (dataStream != null && (typeof dataStream !== "string" || containsStructuralToken(dataStream))) return false;
1066
348
  return STRUCTURAL_BODY_FIELDS.every((field) => {
@@ -1071,7 +353,7 @@ function isStructurePreservingBody(value) {
1071
353
  function isStructurePreservingTextXEdit(value) {
1072
354
  if (!Array.isArray(value)) return false;
1073
355
  return value.every((action) => {
1074
- if (!isRecord$3(action) || typeof action.len !== "number" || !Number.isFinite(action.len)) return false;
356
+ if (!isRecord$2(action) || typeof action.len !== "number" || !Number.isFinite(action.len)) return false;
1075
357
  if (action.t === _univerjs_core.TextXActionType.DELETE) return true;
1076
358
  if (action.t === _univerjs_core.TextXActionType.INSERT) return isStructurePreservingBody(action.body);
1077
359
  return action.t === _univerjs_core.TextXActionType.RETAIN && (action.body == null || isStructurePreservingBody(action.body));
@@ -1246,9 +528,9 @@ function validateDocStructureMutation(documentDataModel, segmentId, actions, und
1246
528
  const path = cursor.getPath();
1247
529
  if (path[0] === "notes" && (path.length <= 2 || path[2] !== "body") || path.includes("customRanges")) changesFootnoteStructure = true;
1248
530
  if (component.et === _univerjs_core.TextX.id && Array.isArray(component.e)) for (const action of component.e) {
1249
- if (isRecord$3(action) && Array.isArray(action.rangeUpdates) && action.rangeUpdates.some((update) => isRecord$3(update) && isRecord$3(update.range) && (update.range.rangeType === _univerjs_core.CustomRangeType.FOOTNOTE || update.range.rangeType === _univerjs_core.CustomRangeType.ENDNOTE))) changesFootnoteStructure = true;
1250
- const ranges = isRecord$3(action) && isRecord$3(action.body) ? action.body.customRanges : void 0;
1251
- if (Array.isArray(ranges) && ranges.some((range) => isRecord$3(range) && (range.rangeType === _univerjs_core.CustomRangeType.FOOTNOTE || range.rangeType === _univerjs_core.CustomRangeType.ENDNOTE))) changesFootnoteStructure = true;
531
+ if (isRecord$2(action) && Array.isArray(action.rangeUpdates) && action.rangeUpdates.some((update) => isRecord$2(update) && isRecord$2(update.range) && (update.range.rangeType === _univerjs_core.CustomRangeType.FOOTNOTE || update.range.rangeType === _univerjs_core.CustomRangeType.ENDNOTE))) changesFootnoteStructure = true;
532
+ const ranges = isRecord$2(action) && isRecord$2(action.body) ? action.body.customRanges : void 0;
533
+ if (Array.isArray(ranges) && ranges.some((range) => isRecord$2(range) && (range.rangeType === _univerjs_core.CustomRangeType.FOOTNOTE || range.rangeType === _univerjs_core.CustomRangeType.ENDNOTE))) changesFootnoteStructure = true;
1252
534
  }
1253
535
  });
1254
536
  if (changesFootnoteStructure) {
@@ -1258,8 +540,7 @@ function validateDocStructureMutation(documentDataModel, segmentId, actions, und
1258
540
  return preservesStructure && !changesFootnoteStructure;
1259
541
  }
1260
542
 
1261
- //#endregion
1262
- //#region src/commands/mutations/core-editing.mutation.ts
543
+ // src/commands/mutations/core-editing.mutation.ts
1263
544
  let DocHistoryAction = /* @__PURE__ */ function(DocHistoryAction) {
1264
545
  DocHistoryAction["DeleteChart"] = "delete-chart";
1265
546
  DocHistoryAction["DeleteDivider"] = "delete-divider";
@@ -1394,7 +675,8 @@ function scheduleDocumentSelectionUpdate(selectionManager, params, isSync) {
1394
675
  }, selectionTarget);
1395
676
  const updatedSelection = selectionManager.getSelectionInfo(selectionTarget);
1396
677
  queueMicrotask(() => {
1397
- if (selectionManager.getSelectionInfo(selectionTarget) !== updatedSelection) return;
678
+ var _selectionManager$__g;
679
+ if (((_selectionManager$__g = selectionManager.__getCurrentSelection()) === null || _selectionManager$__g === void 0 ? void 0 : _selectionManager$__g.unitId) !== unitId || selectionManager.getSelectionInfo(selectionTarget) !== updatedSelection) return;
1398
680
  selectionManager.replaceDocRanges(logicalTextRanges, selectionTarget, isEditing, params.options);
1399
681
  });
1400
682
  }
@@ -1403,7 +685,7 @@ function scheduleDocumentSelectionUpdate(selectionManager, params, isSync) {
1403
685
  * send to undo redo service (will be used by the triggering command).
1404
686
  */
1405
687
  const RichTextEditingMutation = {
1406
- id: RICH_TEXT_EDITING_MUTATION_ID,
688
+ id: require_protocol.RICH_TEXT_EDITING_MUTATION_ID,
1407
689
  type: _univerjs_core.CommandType.MUTATION,
1408
690
  handler: (accessor, params, options) => {
1409
691
  var _renderManagerService;
@@ -1449,7 +731,7 @@ const RichTextEditingMutation = {
1449
731
  resetDocumentViewModel(documentViewModel, documentDataModel, segmentId, appliedActions, preservesStructure);
1450
732
  scheduleDocumentSelectionUpdate(docSelectionManagerService, params, isSync);
1451
733
  const changeState = {
1452
- commandId: RICH_TEXT_EDITING_MUTATION_ID,
734
+ commandId: require_protocol.RICH_TEXT_EDITING_MUTATION_ID,
1453
735
  unitId,
1454
736
  segmentId,
1455
737
  trigger,
@@ -1483,8 +765,7 @@ const RichTextEditingMutation = {
1483
765
  }
1484
766
  };
1485
767
 
1486
- //#endregion
1487
- //#region src/commands/commands/core-editing.command.ts
768
+ // src/commands/commands/core-editing.command.ts
1488
769
  /**
1489
770
  * The command to insert text. The changed range could be non-collapsed, mainly use in line break and normal input.
1490
771
  */
@@ -1640,8 +921,7 @@ const UpdateTextCommand = {
1640
921
  }
1641
922
  };
1642
923
 
1643
- //#endregion
1644
- //#region src/commands/commands/create-header-footer.command.ts
924
+ // src/commands/commands/create-header-footer.command.ts
1645
925
  let HeaderFooterType = /* @__PURE__ */ function(HeaderFooterType) {
1646
926
  HeaderFooterType[HeaderFooterType["FIRST_PAGE_HEADER"] = 0] = "FIRST_PAGE_HEADER";
1647
927
  HeaderFooterType[HeaderFooterType["FIRST_PAGE_FOOTER"] = 1] = "FIRST_PAGE_FOOTER";
@@ -1784,8 +1064,7 @@ const CreateHeaderFooterCommand = {
1784
1064
  }
1785
1065
  };
1786
1066
 
1787
- //#endregion
1788
- //#region src/commands/commands/set-document-default-paragraph-style.command.ts
1067
+ // src/commands/commands/set-document-default-paragraph-style.command.ts
1789
1068
  const SetDocumentDefaultParagraphStyleCommand = {
1790
1069
  id: "doc.command.set-default-paragraph-style",
1791
1070
  type: _univerjs_core.CommandType.COMMAND,
@@ -1828,8 +1107,7 @@ const SetDocumentDefaultParagraphStyleCommand = {
1828
1107
  }
1829
1108
  };
1830
1109
 
1831
- //#endregion
1832
- //#region src/commands/mutations/docs-rename.mutation.ts
1110
+ // src/commands/mutations/docs-rename.mutation.ts
1833
1111
  const DocsRenameMutation = {
1834
1112
  id: "doc.mutation.rename-doc",
1835
1113
  type: _univerjs_core.CommandType.MUTATION,
@@ -1841,8 +1119,7 @@ const DocsRenameMutation = {
1841
1119
  }
1842
1120
  };
1843
1121
 
1844
- //#endregion
1845
- //#region src/commands/commands/set-document-name.command.ts
1122
+ // src/commands/commands/set-document-name.command.ts
1846
1123
  const SetDocumentNameCommand = {
1847
1124
  id: "doc.command.set-name",
1848
1125
  type: _univerjs_core.CommandType.COMMAND,
@@ -1875,123 +1152,114 @@ const SetDocumentNameCommand = {
1875
1152
  }
1876
1153
  };
1877
1154
 
1878
- //#endregion
1879
- //#region src/services/permission/permission-point/document/comment.ts
1155
+ // src/services/permission/permission-point/document/comment.ts
1880
1156
  var DocumentCommentPermission = class {
1881
1157
  constructor(unitId) {
1882
1158
  this.unitId = unitId;
1883
- _defineProperty(this, "type", _univerjs_protocol.UnitObject.Document);
1884
- _defineProperty(this, "subType", _univerjs_protocol.UnitAction.Comment);
1885
- _defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1886
- _defineProperty(this, "id", void 0);
1887
- _defineProperty(this, "value", true);
1159
+ require_protocol._defineProperty(this, "type", _univerjs_protocol.UnitObject.Document);
1160
+ require_protocol._defineProperty(this, "subType", _univerjs_protocol.UnitAction.Comment);
1161
+ require_protocol._defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1162
+ require_protocol._defineProperty(this, "id", void 0);
1163
+ require_protocol._defineProperty(this, "value", true);
1888
1164
  this.id = `${this.type}.${this.subType}_${unitId}`;
1889
1165
  }
1890
1166
  };
1891
1167
 
1892
- //#endregion
1893
- //#region src/services/permission/permission-point/document/copy.ts
1168
+ // src/services/permission/permission-point/document/copy.ts
1894
1169
  var DocumentCopyPermission = class {
1895
1170
  constructor(unitId) {
1896
1171
  this.unitId = unitId;
1897
- _defineProperty(this, "type", _univerjs_protocol.UnitObject.Document);
1898
- _defineProperty(this, "subType", _univerjs_protocol.UnitAction.Copy);
1899
- _defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1900
- _defineProperty(this, "id", void 0);
1901
- _defineProperty(this, "value", true);
1172
+ require_protocol._defineProperty(this, "type", _univerjs_protocol.UnitObject.Document);
1173
+ require_protocol._defineProperty(this, "subType", _univerjs_protocol.UnitAction.Copy);
1174
+ require_protocol._defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1175
+ require_protocol._defineProperty(this, "id", void 0);
1176
+ require_protocol._defineProperty(this, "value", true);
1902
1177
  this.id = `${this.type}.${this.subType}_${unitId}`;
1903
1178
  }
1904
1179
  };
1905
1180
 
1906
- //#endregion
1907
- //#region src/services/permission/permission-point/document/editable.ts
1181
+ // src/services/permission/permission-point/document/editable.ts
1908
1182
  var DocumentEditablePermission = class {
1909
1183
  constructor(unitId) {
1910
1184
  this.unitId = unitId;
1911
- _defineProperty(this, "type", _univerjs_protocol.UnitObject.Document);
1912
- _defineProperty(this, "subType", _univerjs_protocol.UnitAction.Edit);
1913
- _defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1914
- _defineProperty(this, "id", void 0);
1915
- _defineProperty(this, "value", true);
1185
+ require_protocol._defineProperty(this, "type", _univerjs_protocol.UnitObject.Document);
1186
+ require_protocol._defineProperty(this, "subType", _univerjs_protocol.UnitAction.Edit);
1187
+ require_protocol._defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1188
+ require_protocol._defineProperty(this, "id", void 0);
1189
+ require_protocol._defineProperty(this, "value", true);
1916
1190
  this.id = `${this.type}.${this.subType}_${unitId}`;
1917
1191
  }
1918
1192
  };
1919
1193
 
1920
- //#endregion
1921
- //#region src/services/permission/permission-point/document/export.ts
1194
+ // src/services/permission/permission-point/document/export.ts
1922
1195
  var DocumentExportPermission = class {
1923
1196
  constructor(unitId) {
1924
1197
  this.unitId = unitId;
1925
- _defineProperty(this, "type", _univerjs_protocol.UnitObject.Document);
1926
- _defineProperty(this, "subType", _univerjs_protocol.UnitAction.Export);
1927
- _defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1928
- _defineProperty(this, "id", void 0);
1929
- _defineProperty(this, "value", true);
1198
+ require_protocol._defineProperty(this, "type", _univerjs_protocol.UnitObject.Document);
1199
+ require_protocol._defineProperty(this, "subType", _univerjs_protocol.UnitAction.Export);
1200
+ require_protocol._defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1201
+ require_protocol._defineProperty(this, "id", void 0);
1202
+ require_protocol._defineProperty(this, "value", true);
1930
1203
  this.id = `${this.type}.${this.subType}_${unitId}`;
1931
1204
  }
1932
1205
  };
1933
1206
 
1934
- //#endregion
1935
- //#region src/services/permission/permission-point/document/print.ts
1207
+ // src/services/permission/permission-point/document/print.ts
1936
1208
  var DocumentPrintPermission = class {
1937
1209
  constructor(unitId) {
1938
1210
  this.unitId = unitId;
1939
- _defineProperty(this, "type", _univerjs_protocol.UnitObject.Document);
1940
- _defineProperty(this, "subType", _univerjs_protocol.UnitAction.Print);
1941
- _defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1942
- _defineProperty(this, "id", void 0);
1943
- _defineProperty(this, "value", true);
1211
+ require_protocol._defineProperty(this, "type", _univerjs_protocol.UnitObject.Document);
1212
+ require_protocol._defineProperty(this, "subType", _univerjs_protocol.UnitAction.Print);
1213
+ require_protocol._defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1214
+ require_protocol._defineProperty(this, "id", void 0);
1215
+ require_protocol._defineProperty(this, "value", true);
1944
1216
  this.id = `${this.type}.${this.subType}_${unitId}`;
1945
1217
  }
1946
1218
  };
1947
1219
 
1948
- //#endregion
1949
- //#region src/services/permission/permission-point/entity/edit.ts
1220
+ // src/services/permission/permission-point/entity/edit.ts
1950
1221
  var DocumentEntityEditPermission = class {
1951
1222
  constructor(unitId, objectId) {
1952
1223
  this.unitId = unitId;
1953
1224
  this.objectId = objectId;
1954
- _defineProperty(this, "type", _univerjs_protocol.UnitObject.DocumentEntity);
1955
- _defineProperty(this, "subType", _univerjs_protocol.UnitAction.Edit);
1956
- _defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1957
- _defineProperty(this, "id", void 0);
1958
- _defineProperty(this, "value", true);
1225
+ require_protocol._defineProperty(this, "type", _univerjs_protocol.UnitObject.DocumentEntity);
1226
+ require_protocol._defineProperty(this, "subType", _univerjs_protocol.UnitAction.Edit);
1227
+ require_protocol._defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1228
+ require_protocol._defineProperty(this, "id", void 0);
1229
+ require_protocol._defineProperty(this, "value", true);
1959
1230
  this.id = `${this.type}.${this.subType}_${unitId}_${objectId}`;
1960
1231
  }
1961
1232
  };
1962
1233
 
1963
- //#endregion
1964
- //#region src/services/permission/permission-point/paragraph/edit.ts
1234
+ // src/services/permission/permission-point/paragraph/edit.ts
1965
1235
  var DocumentParagraphEditPermission = class {
1966
1236
  constructor(unitId, objectId) {
1967
1237
  this.unitId = unitId;
1968
1238
  this.objectId = objectId;
1969
- _defineProperty(this, "type", _univerjs_protocol.UnitObject.DocumentParagraph);
1970
- _defineProperty(this, "subType", _univerjs_protocol.UnitAction.Edit);
1971
- _defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1972
- _defineProperty(this, "id", void 0);
1973
- _defineProperty(this, "value", true);
1239
+ require_protocol._defineProperty(this, "type", _univerjs_protocol.UnitObject.DocumentParagraph);
1240
+ require_protocol._defineProperty(this, "subType", _univerjs_protocol.UnitAction.Edit);
1241
+ require_protocol._defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1242
+ require_protocol._defineProperty(this, "id", void 0);
1243
+ require_protocol._defineProperty(this, "value", true);
1974
1244
  this.id = `${this.type}.${this.subType}_${unitId}_${objectId}`;
1975
1245
  }
1976
1246
  };
1977
1247
 
1978
- //#endregion
1979
- //#region src/services/permission/permission-point/section/edit.ts
1248
+ // src/services/permission/permission-point/section/edit.ts
1980
1249
  var DocumentSectionEditPermission = class {
1981
1250
  constructor(unitId, objectId) {
1982
1251
  this.unitId = unitId;
1983
1252
  this.objectId = objectId;
1984
- _defineProperty(this, "type", _univerjs_protocol.UnitObject.DocumentSection);
1985
- _defineProperty(this, "subType", _univerjs_protocol.UnitAction.Edit);
1986
- _defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1987
- _defineProperty(this, "id", void 0);
1988
- _defineProperty(this, "value", true);
1253
+ require_protocol._defineProperty(this, "type", _univerjs_protocol.UnitObject.DocumentSection);
1254
+ require_protocol._defineProperty(this, "subType", _univerjs_protocol.UnitAction.Edit);
1255
+ require_protocol._defineProperty(this, "status", _univerjs_core.PermissionStatus.INIT);
1256
+ require_protocol._defineProperty(this, "id", void 0);
1257
+ require_protocol._defineProperty(this, "value", true);
1989
1258
  this.id = `${this.type}.${this.subType}_${unitId}_${objectId}`;
1990
1259
  }
1991
1260
  };
1992
1261
 
1993
- //#endregion
1994
- //#region src/services/permission/document-permission.ts
1262
+ // src/services/permission/document-permission.ts
1995
1263
  const DOCUMENT_UNIT_PERMISSION_ACTIONS = [
1996
1264
  _univerjs_protocol.UnitAction.Edit,
1997
1265
  _univerjs_protocol.UnitAction.Copy,
@@ -2054,8 +1322,7 @@ function canEditDocumentTargets(permissionService, unitId, objectIds) {
2054
1322
  return true;
2055
1323
  }
2056
1324
 
2057
- //#endregion
2058
- //#region src/commands/commands/set-document-permission.command.ts
1325
+ // src/commands/commands/set-document-permission.command.ts
2059
1326
  const SetDocumentPermissionCommand = {
2060
1327
  type: _univerjs_core.CommandType.COMMAND,
2061
1328
  id: "doc.command.set-permission",
@@ -2081,8 +1348,7 @@ const SetDocumentPermissionCommand = {
2081
1348
  }
2082
1349
  };
2083
1350
 
2084
- //#endregion
2085
- //#region src/commands/commands/set-document-permissions.command.ts
1351
+ // src/commands/commands/set-document-permissions.command.ts
2086
1352
  const SetDocumentPermissionsCommand = {
2087
1353
  type: _univerjs_core.CommandType.COMMAND,
2088
1354
  id: "doc.command.set-permissions",
@@ -2104,8 +1370,7 @@ const SetDocumentPermissionsCommand = {
2104
1370
  }
2105
1371
  };
2106
1372
 
2107
- //#endregion
2108
- //#region src/utils/sections.ts
1373
+ // src/utils/sections.ts
2109
1374
  /** Returns document-level section breaks, excluding table-cell and modern-column sentinels. */
2110
1375
  function getTopLevelSectionBreaks(body) {
2111
1376
  const sectionBreakByIndex = new Map((body.sectionBreaks ?? []).map((sectionBreak) => [sectionBreak.startIndex, sectionBreak]));
@@ -2126,8 +1391,7 @@ function getTopLevelSectionBreaks(body) {
2126
1391
  return result;
2127
1392
  }
2128
1393
 
2129
- //#endregion
2130
- //#region src/services/permission/document-permission-resolver.ts
1394
+ // src/services/permission/document-permission-resolver.ts
2131
1395
  const HEADER_FOOTER_REFERENCE_KEYS = [
2132
1396
  "defaultHeaderId",
2133
1397
  "defaultFooterId",
@@ -2315,18 +1579,18 @@ function getDrawingIdsFromActions(actions) {
2315
1579
  });
2316
1580
  return;
2317
1581
  }
2318
- if (!isRecord$2(value)) return;
1582
+ if (!isRecord$1(value)) return;
2319
1583
  Object.values(value).forEach(visit);
2320
1584
  };
2321
1585
  visit(actions);
2322
1586
  return [...result];
2323
1587
  }
2324
1588
  function isTextXAction(value) {
2325
- if (!isRecord$2(value) || typeof value.len !== "number") return false;
2326
- if (value.t === _univerjs_core.TextXActionType.INSERT) return isRecord$2(value.body);
1589
+ if (!isRecord$1(value) || typeof value.len !== "number") return false;
1590
+ if (value.t === _univerjs_core.TextXActionType.INSERT) return isRecord$1(value.body);
2327
1591
  return value.t === _univerjs_core.TextXActionType.RETAIN || value.t === _univerjs_core.TextXActionType.DELETE;
2328
1592
  }
2329
- function isRecord$2(value) {
1593
+ function isRecord$1(value) {
2330
1594
  return typeof value === "object" && value !== null && !Array.isArray(value);
2331
1595
  }
2332
1596
  function getDocumentEntityParentPermissionObjectIds(documentDataModel, segmentId, entityType, entityId) {
@@ -2390,8 +1654,7 @@ function getHeaderFooterOwnerSectionIds(documentDataModel, segmentId, sections =
2390
1654
  return [...result];
2391
1655
  }
2392
1656
 
2393
- //#endregion
2394
- //#region src/commands/commands/set-heading-collapsed.command.ts
1657
+ // src/commands/commands/set-heading-collapsed.command.ts
2395
1658
  const SetHeadingCollapsedCommand = {
2396
1659
  id: "doc.command.set-heading-collapsed",
2397
1660
  type: _univerjs_core.CommandType.COMMAND,
@@ -2459,8 +1722,7 @@ const SetHeadingCollapsedCommand = {
2459
1722
  }
2460
1723
  };
2461
1724
 
2462
- //#endregion
2463
- //#region src/commands/commands/set-section-header-footer-link.command.ts
1725
+ // src/commands/commands/set-section-header-footer-link.command.ts
2464
1726
  const SetSectionHeaderFooterLinkCommand = {
2465
1727
  id: "doc.command.set-section-header-footer-link",
2466
1728
  type: _univerjs_core.CommandType.COMMAND,
@@ -2554,8 +1816,7 @@ function buildUnlinkActions(context, kind, requestedSegmentId) {
2554
1816
  ], segmentId)];
2555
1817
  }
2556
1818
 
2557
- //#endregion
2558
- //#region src/commands/commands/update-document-paragraph-style.command.ts
1819
+ // src/commands/commands/update-document-paragraph-style.command.ts
2559
1820
  function isValidParams(params) {
2560
1821
  return Boolean((params === null || params === void 0 ? void 0 : params.unitId) && params.paragraphId && Number.isInteger(params.startOffset) && Number.isInteger(params.endOffset) && params.startOffset >= 0 && params.endOffset >= params.startOffset && params.style && Object.keys(params.style).length > 0);
2561
1822
  }
@@ -2653,8 +1914,7 @@ const UpdateDocumentParagraphStyleCommand = {
2653
1914
  }
2654
1915
  };
2655
1916
 
2656
- //#endregion
2657
- //#region src/utils/section-columns.ts
1917
+ // src/utils/section-columns.ts
2658
1918
  function resolveSectionValue(sectionValue, documentValue, fallback) {
2659
1919
  return sectionValue ?? documentValue ?? fallback;
2660
1920
  }
@@ -2722,8 +1982,7 @@ function createSectionColumnProperties(documentStyle, section, columnCount, gap,
2722
1982
  }));
2723
1983
  }
2724
1984
 
2725
- //#endregion
2726
- //#region src/commands/commands/update-document-section.command.ts
1985
+ // src/commands/commands/update-document-section.command.ts
2727
1986
  const UpdateDocumentSectionCommand = {
2728
1987
  id: "doc.command.update-section",
2729
1988
  type: _univerjs_core.CommandType.COMMAND,
@@ -2925,8 +2184,7 @@ function executeSectionTextX(commandService, documentDataModel, textX, trigger)
2925
2184
  }));
2926
2185
  }
2927
2186
 
2928
- //#endregion
2929
- //#region src/services/permission/document-permission-rule.model.ts
2187
+ // src/services/permission/document-permission-rule.model.ts
2930
2188
  /**
2931
2189
  * Copyright 2023-present DreamNum Co., Ltd.
2932
2190
  *
@@ -2951,10 +2209,9 @@ let DocumentPermissionRuleModel = class DocumentPermissionRuleModel extends _uni
2951
2209
  ]);
2952
2210
  }
2953
2211
  };
2954
- DocumentPermissionRuleModel = __decorate([__decorateParam(0, _univerjs_core.IResourceManagerService)], DocumentPermissionRuleModel);
2212
+ DocumentPermissionRuleModel = require_protocol.__decorate([require_protocol.__decorateParam(0, _univerjs_core.IResourceManagerService)], DocumentPermissionRuleModel);
2955
2213
 
2956
- //#endregion
2957
- //#region src/commands/mutations/set-document-permission-rule.mutation.ts
2214
+ // src/commands/mutations/set-document-permission-rule.mutation.ts
2958
2215
  const SetDocumentPermissionRuleMutation = {
2959
2216
  id: "doc.mutation.set-permission-rule",
2960
2217
  type: _univerjs_core.CommandType.MUTATION,
@@ -2964,8 +2221,7 @@ const SetDocumentPermissionRuleMutation = {
2964
2221
  }
2965
2222
  };
2966
2223
 
2967
- //#endregion
2968
- //#region src/commands/mutations/set-document-permission-rules.mutation.ts
2224
+ // src/commands/mutations/set-document-permission-rules.mutation.ts
2969
2225
  const SetDocumentPermissionRulesMutation = {
2970
2226
  id: "doc.mutation.set-permission-rules",
2971
2227
  type: _univerjs_core.CommandType.MUTATION,
@@ -2975,8 +2231,7 @@ const SetDocumentPermissionRulesMutation = {
2975
2231
  }
2976
2232
  };
2977
2233
 
2978
- //#endregion
2979
- //#region src/embed-host-anchor.ts
2234
+ // src/embed-host-anchor.ts
2980
2235
  const EMBED_DOCS_CUSTOM_BLOCK_DEFAULT_COMPONENT_KEY = "UniverEmbedDocsCustomBlock";
2981
2236
  const DEFAULT_CUSTOM_BLOCK_SIZE = {
2982
2237
  width: 720,
@@ -3133,34 +2388,7 @@ function composeActions(actions) {
3133
2388
  }, []);
3134
2389
  }
3135
2390
 
3136
- //#endregion
3137
- //#region package.json
3138
- var name = "@univerjs/docs";
3139
- var version = "1.3.1";
3140
-
3141
- //#endregion
3142
- //#region src/config/config.ts
3143
- /**
3144
- * Copyright 2023-present DreamNum Co., Ltd.
3145
- *
3146
- * Licensed under the Apache License, Version 2.0 (the "License");
3147
- * you may not use this file except in compliance with the License.
3148
- * You may obtain a copy of the License at
3149
- *
3150
- * http://www.apache.org/licenses/LICENSE-2.0
3151
- *
3152
- * Unless required by applicable law or agreed to in writing, software
3153
- * distributed under the License is distributed on an "AS IS" BASIS,
3154
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3155
- * See the License for the specific language governing permissions and
3156
- * limitations under the License.
3157
- */
3158
- const DOCS_PLUGIN_CONFIG_KEY = "docs.config";
3159
- const configSymbol$1 = Symbol(DOCS_PLUGIN_CONFIG_KEY);
3160
- const defaultPluginConfig = {};
3161
-
3162
- //#endregion
3163
- //#region src/controllers/custom-range.controller.ts
2391
+ // src/controllers/custom-range.controller.ts
3164
2392
  let DocCustomRangeController = class DocCustomRangeController extends _univerjs_core.Disposable {
3165
2393
  constructor(_commandService, _textSelectionManagerService, _univerInstanceService) {
3166
2394
  super();
@@ -3208,14 +2436,13 @@ let DocCustomRangeController = class DocCustomRangeController extends _univerjs_
3208
2436
  }));
3209
2437
  }
3210
2438
  };
3211
- DocCustomRangeController = __decorate([
3212
- __decorateParam(0, _univerjs_core.ICommandService),
3213
- __decorateParam(1, (0, _univerjs_core.Inject)(DocSelectionManagerService)),
3214
- __decorateParam(2, _univerjs_core.IUniverInstanceService)
2439
+ DocCustomRangeController = require_protocol.__decorate([
2440
+ require_protocol.__decorateParam(0, _univerjs_core.ICommandService),
2441
+ require_protocol.__decorateParam(1, (0, _univerjs_core.Inject)(DocSelectionManagerService)),
2442
+ require_protocol.__decorateParam(2, _univerjs_core.IUniverInstanceService)
3215
2443
  ], DocCustomRangeController);
3216
2444
 
3217
- //#endregion
3218
- //#region src/controllers/doc-permission.controller.ts
2445
+ // src/controllers/doc-permission.controller.ts
3219
2446
  const NON_EDIT_DOCUMENT_COMMAND_IDS = /* @__PURE__ */ new Set([
3220
2447
  SetDocumentPermissionCommand.id,
3221
2448
  SetDocumentPermissionsCommand.id,
@@ -3289,11 +2516,11 @@ let DocPermissionController = class DocPermissionController extends _univerjs_co
3289
2516
  return isDocumentEditCommand(commandInfo.id) || isDocumentDataMutation(commandInfo) ? [] : null;
3290
2517
  }
3291
2518
  };
3292
- DocPermissionController = __decorate([
3293
- __decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
3294
- __decorateParam(1, _univerjs_core.ICommandService),
3295
- __decorateParam(2, _univerjs_core.IPermissionService),
3296
- __decorateParam(3, _univerjs_core.IUniverInstanceService)
2519
+ DocPermissionController = require_protocol.__decorate([
2520
+ require_protocol.__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
2521
+ require_protocol.__decorateParam(1, _univerjs_core.ICommandService),
2522
+ require_protocol.__decorateParam(2, _univerjs_core.IPermissionService),
2523
+ require_protocol.__decorateParam(3, _univerjs_core.IUniverInstanceService)
3297
2524
  ], DocPermissionController);
3298
2525
  function isDocumentEditCommand(id) {
3299
2526
  if (NON_EDIT_DOCUMENT_COMMAND_IDS.has(id)) return false;
@@ -3305,12 +2532,12 @@ function isDocumentDataMutation(commandInfo) {
3305
2532
  return id.startsWith("doc.mutation.") || id.startsWith("docs.mutation.") || /^docs-[^.]+\.mutation\./.test(id);
3306
2533
  }
3307
2534
  function isDerivedDocumentMutation(commandInfo) {
3308
- const params = isRecord$1(commandInfo.params) ? commandInfo.params : void 0;
2535
+ const params = isRecord(commandInfo.params) ? commandInfo.params : void 0;
3309
2536
  return DERIVED_DOCUMENT_MUTATION_IDS.has(commandInfo.id) || commandInfo.id === "doc.mutation.update-shape-data" && !!(params === null || params === void 0 ? void 0 : params.formulaLastValueGuard);
3310
2537
  }
3311
2538
  function resolveEntityTargets(documentDataModel, commandInfo) {
3312
2539
  const params = commandInfo.params;
3313
- if (!isRecord$1(params)) return [];
2540
+ if (!isRecord(params)) return [];
3314
2541
  const result = /* @__PURE__ */ new Set();
3315
2542
  const add = (segmentId, entityType, entityId) => {
3316
2543
  result.add(getDocumentEntityPermissionObjectId(segmentId, entityType, entityId));
@@ -3349,14 +2576,14 @@ function collectEntityReferences(value) {
3349
2576
  candidate.forEach((item) => visit(item, singularKey));
3350
2577
  return;
3351
2578
  }
3352
- if (!isRecord$1(candidate)) return;
2579
+ if (!isRecord(candidate)) return;
3353
2580
  Object.entries(candidate).forEach(([childKey, child]) => visit(child, childKey));
3354
2581
  };
3355
2582
  visit(value);
3356
2583
  return [...result.values()];
3357
2584
  }
3358
2585
  function getUnitId(commandInfo, options) {
3359
- const params = isRecord$1(commandInfo.params) ? commandInfo.params : void 0;
2586
+ const params = isRecord(commandInfo.params) ? commandInfo.params : void 0;
3360
2587
  return typeof (params === null || params === void 0 ? void 0 : params.unitId) === "string" ? params.unitId : typeof (options === null || options === void 0 ? void 0 : options.unitId) === "string" ? options.unitId : void 0;
3361
2588
  }
3362
2589
  function getDocumentUnitAction(commandId) {
@@ -3413,17 +2640,16 @@ function resolveSectionTargets(documentDataModel, commandInfo) {
3413
2640
  }
3414
2641
  return null;
3415
2642
  }
3416
- function isRecord$1(value) {
2643
+ function isRecord(value) {
3417
2644
  return typeof value === "object" && value !== null && !Array.isArray(value);
3418
2645
  }
3419
2646
 
3420
- //#endregion
3421
- //#region src/services/doc-block-move-validator.service.ts
2647
+ // src/services/doc-block-move-validator.service.ts
3422
2648
  var DocBlockMoveValidatorService = class extends _univerjs_core.Disposable {
3423
2649
  constructor(..._args) {
3424
2650
  super(..._args);
3425
- _defineProperty(this, "_validators", []);
3426
- _defineProperty(this, "_transformers", []);
2651
+ require_protocol._defineProperty(this, "_validators", []);
2652
+ require_protocol._defineProperty(this, "_transformers", []);
3427
2653
  }
3428
2654
  registerValidator(validator) {
3429
2655
  this._validators.push(validator);
@@ -3444,8 +2670,7 @@ var DocBlockMoveValidatorService = class extends _univerjs_core.Disposable {
3444
2670
  }
3445
2671
  };
3446
2672
 
3447
- //#endregion
3448
- //#region src/services/doc-content-insert.service.ts
2673
+ // src/services/doc-content-insert.service.ts
3449
2674
  /**
3450
2675
  * Copyright 2023-present DreamNum Co., Ltd.
3451
2676
  *
@@ -3464,7 +2689,7 @@ var DocBlockMoveValidatorService = class extends _univerjs_core.Disposable {
3464
2689
  var DocContentInsertService = class extends _univerjs_core.Disposable {
3465
2690
  constructor(..._args) {
3466
2691
  super(..._args);
3467
- _defineProperty(this, "_range", null);
2692
+ require_protocol._defineProperty(this, "_range", null);
3468
2693
  }
3469
2694
  setInsertRange(range) {
3470
2695
  this._range = range;
@@ -3481,8 +2706,7 @@ var DocContentInsertService = class extends _univerjs_core.Disposable {
3481
2706
  }
3482
2707
  };
3483
2708
 
3484
- //#endregion
3485
- //#region src/services/doc-state-change-manager.service.ts
2709
+ // src/services/doc-state-change-manager.service.ts
3486
2710
  const DEBOUNCE_DELAY = 300;
3487
2711
  const IDocStateChangeInterceptorService = (0, _univerjs_core.createIdentifier)("doc.state-change-interceptor-service");
3488
2712
  let DocStateChangeManagerService = class DocStateChangeManagerService extends _univerjs_core.RxDisposable {
@@ -3493,12 +2717,12 @@ let DocStateChangeManagerService = class DocStateChangeManagerService extends _u
3493
2717
  this._univerInstanceService = _univerInstanceService;
3494
2718
  this._docStateEmitService = _docStateEmitService;
3495
2719
  this._docStateChangeInterceptorService = _docStateChangeInterceptorService;
3496
- _defineProperty(this, "_docStateChange$", new rxjs.BehaviorSubject(null));
3497
- _defineProperty(this, "docStateChange$", this._docStateChange$.asObservable());
3498
- _defineProperty(this, "_historyStateCache", /* @__PURE__ */ new Map());
3499
- _defineProperty(this, "_changeStateCache", /* @__PURE__ */ new Map());
3500
- _defineProperty(this, "_historyTimer", null);
3501
- _defineProperty(this, "_changeStateCacheTimer", null);
2720
+ require_protocol._defineProperty(this, "_docStateChange$", new rxjs.BehaviorSubject(null));
2721
+ require_protocol._defineProperty(this, "docStateChange$", this._docStateChange$.asObservable());
2722
+ require_protocol._defineProperty(this, "_historyStateCache", /* @__PURE__ */ new Map());
2723
+ require_protocol._defineProperty(this, "_changeStateCache", /* @__PURE__ */ new Map());
2724
+ require_protocol._defineProperty(this, "_historyTimer", null);
2725
+ require_protocol._defineProperty(this, "_changeStateCacheTimer", null);
3502
2726
  this._initialize();
3503
2727
  this._listenDocStateChange();
3504
2728
  }
@@ -3661,16 +2885,15 @@ let DocStateChangeManagerService = class DocStateChangeManagerService extends _u
3661
2885
  this._docStateChange$.next(changeState);
3662
2886
  }
3663
2887
  };
3664
- DocStateChangeManagerService = __decorate([
3665
- __decorateParam(0, (0, _univerjs_core.Optional)(_univerjs_core.IUndoRedoService)),
3666
- __decorateParam(1, _univerjs_core.ICommandService),
3667
- __decorateParam(2, _univerjs_core.IUniverInstanceService),
3668
- __decorateParam(3, (0, _univerjs_core.Inject)(DocStateEmitService)),
3669
- __decorateParam(4, (0, _univerjs_core.Optional)(IDocStateChangeInterceptorService))
2888
+ DocStateChangeManagerService = require_protocol.__decorate([
2889
+ require_protocol.__decorateParam(0, (0, _univerjs_core.Optional)(_univerjs_core.IUndoRedoService)),
2890
+ require_protocol.__decorateParam(1, _univerjs_core.ICommandService),
2891
+ require_protocol.__decorateParam(2, _univerjs_core.IUniverInstanceService),
2892
+ require_protocol.__decorateParam(3, (0, _univerjs_core.Inject)(DocStateEmitService)),
2893
+ require_protocol.__decorateParam(4, (0, _univerjs_core.Optional)(IDocStateChangeInterceptorService))
3670
2894
  ], DocStateChangeManagerService);
3671
2895
 
3672
- //#endregion
3673
- //#region src/services/doc-text-resolver.service.ts
2896
+ // src/services/doc-text-resolver.service.ts
3674
2897
  /**
3675
2898
  * Builds a consumer-facing text projection while retaining a mapping back to
3676
2899
  * the native document offsets.
@@ -3682,9 +2905,9 @@ DocStateChangeManagerService = __decorate([
3682
2905
  var DocTextResolverService = class extends _univerjs_core.Disposable {
3683
2906
  constructor(..._args) {
3684
2907
  super(..._args);
3685
- _defineProperty(this, "_resolvers", /* @__PURE__ */ new Set());
3686
- _defineProperty(this, "_textChanged$", new rxjs.Subject());
3687
- _defineProperty(this, "textChanged$", this._textChanged$.asObservable());
2908
+ require_protocol._defineProperty(this, "_resolvers", /* @__PURE__ */ new Set());
2909
+ require_protocol._defineProperty(this, "_textChanged$", new rxjs.Subject());
2910
+ require_protocol._defineProperty(this, "textChanged$", this._textChanged$.asObservable());
3688
2911
  }
3689
2912
  register(resolver) {
3690
2913
  this._resolvers.add(resolver);
@@ -3742,16 +2965,15 @@ var DocTextResolverService = class extends _univerjs_core.Disposable {
3742
2965
  }
3743
2966
  };
3744
2967
 
3745
- //#endregion
3746
- //#region src/plugin.ts
2968
+ // src/plugin.ts
3747
2969
  let UniverDocsPlugin = class UniverDocsPlugin extends _univerjs_core.Plugin {
3748
- constructor(_config = defaultPluginConfig, _injector, _configService) {
2970
+ constructor(_config = require_protocol.defaultPluginConfig, _injector, _configService) {
3749
2971
  super();
3750
2972
  this._config = _config;
3751
2973
  this._injector = _injector;
3752
2974
  this._configService = _configService;
3753
- const { ...rest } = (0, _univerjs_core.merge)({}, defaultPluginConfig, this._config);
3754
- this._configService.setConfig(DOCS_PLUGIN_CONFIG_KEY, rest);
2975
+ const { ...rest } = (0, _univerjs_core.merge)({}, require_protocol.defaultPluginConfig, this._config);
2976
+ this._configService.setConfig(require_protocol.DOCS_PLUGIN_CONFIG_KEY, rest);
3755
2977
  }
3756
2978
  onStarting() {
3757
2979
  this._injector.add([DocumentPermissionRuleModel]);
@@ -3811,7 +3033,7 @@ let UniverDocsPlugin = class UniverDocsPlugin extends _univerjs_core.Plugin {
3811
3033
  [DocStateChangeManagerService],
3812
3034
  [DocBlockMoveValidatorService],
3813
3035
  [DocContentInsertService],
3814
- [DocLayoutExecutorService],
3036
+ [require_protocol.DocLayoutExecutorService],
3815
3037
  [DocTextResolverService],
3816
3038
  [DocCustomRangeController],
3817
3039
  [DocPermissionController]
@@ -3823,13 +3045,12 @@ let UniverDocsPlugin = class UniverDocsPlugin extends _univerjs_core.Plugin {
3823
3045
  this._injector.get(DocPermissionController);
3824
3046
  }
3825
3047
  };
3826
- _defineProperty(UniverDocsPlugin, "pluginName", "DOCS_PLUGIN");
3827
- _defineProperty(UniverDocsPlugin, "packageName", name);
3828
- _defineProperty(UniverDocsPlugin, "version", version);
3829
- UniverDocsPlugin = __decorate([__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(2, _univerjs_core.IConfigService)], UniverDocsPlugin);
3048
+ require_protocol._defineProperty(UniverDocsPlugin, "pluginName", "DOCS_PLUGIN");
3049
+ require_protocol._defineProperty(UniverDocsPlugin, "packageName", require_protocol.name);
3050
+ require_protocol._defineProperty(UniverDocsPlugin, "version", require_protocol.version);
3051
+ UniverDocsPlugin = require_protocol.__decorate([require_protocol.__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), require_protocol.__decorateParam(2, _univerjs_core.IConfigService)], UniverDocsPlugin);
3830
3052
 
3831
- //#endregion
3832
- //#region src/layout-worker/config/config.ts
3053
+ // src/layout-worker/config/config.ts
3833
3054
  /**
3834
3055
  * Copyright 2023-present DreamNum Co., Ltd.
3835
3056
  *
@@ -3850,8 +3071,7 @@ const configSymbol = Symbol(DOCS_LAYOUT_WORKER_PLUGIN_CONFIG_KEY);
3850
3071
  const DEFAULT_DOCS_LAYOUT_WORKER_REQUEST_TIMEOUT_MS = 15e3;
3851
3072
  const defaultPluginDocsLayoutWorkerConfig = { requestTimeoutMs: DEFAULT_DOCS_LAYOUT_WORKER_REQUEST_TIMEOUT_MS };
3852
3073
 
3853
- //#endregion
3854
- //#region src/layout-worker/document-font-metrics.ts
3074
+ // src/layout-worker/document-font-metrics.ts
3855
3075
  /**
3856
3076
  * Copyright 2023-present DreamNum Co., Ltd.
3857
3077
  *
@@ -3897,459 +3117,7 @@ function measureDocumentFontFamilies(families) {
3897
3117
  return _univerjs_engine_render.FontCache.getNormalLineHeightCache();
3898
3118
  }
3899
3119
 
3900
- //#endregion
3901
- //#region src/layout-worker/font-loader.ts
3902
- /** Owns the same explicitly supplied font faces in the rendering and layout realms. */
3903
- var DocsLayoutFontLoader = class extends _univerjs_core.Disposable {
3904
- constructor(..._args) {
3905
- super(..._args);
3906
- _defineProperty(this, "_loading", null);
3907
- _defineProperty(this, "_fontSet", void 0);
3908
- _defineProperty(this, "_faces", []);
3909
- }
3910
- load(fonts) {
3911
- this._loading ??= this._load(fonts);
3912
- return this._loading;
3913
- }
3914
- dispose() {
3915
- for (const face of this._faces) {
3916
- var _this$_fontSet;
3917
- (_this$_fontSet = this._fontSet) === null || _this$_fontSet === void 0 || _this$_fontSet.delete(face);
3918
- }
3919
- if (this._faces.length > 0) _univerjs_engine_render.FontCache.invalidateMetrics(() => true);
3920
- this._faces = [];
3921
- this._fontSet = void 0;
3922
- super.dispose();
3923
- }
3924
- async _load(fonts) {
3925
- this.ensureNotDisposed();
3926
- if (fonts.length === 0) return;
3927
- const fontSet = typeof document === "undefined" ? globalThis.fonts : document.fonts;
3928
- if (typeof FontFace === "undefined" || fontSet == null) throw new Error("Document layout requires FontFace support to load the configured fonts.");
3929
- try {
3930
- const faces = fonts.map(({ family, source, descriptors }) => {
3931
- if (!family.trim() || (typeof source === "string" ? !source.trim() : source.byteLength === 0)) throw new TypeError("Document layout font family and source must not be empty.");
3932
- return new FontFace(family, source, descriptors);
3933
- });
3934
- await Promise.all(faces.map((face) => face.load()));
3935
- this.ensureNotDisposed();
3936
- this._fontSet = fontSet;
3937
- this._faces = faces;
3938
- for (const face of faces) fontSet.add(face);
3939
- _univerjs_engine_render.FontCache.invalidateMetrics(() => true);
3940
- } catch (error) {
3941
- this.dispose();
3942
- throw error;
3943
- }
3944
- }
3945
- };
3946
-
3947
- //#endregion
3948
- //#region src/layout-worker/performance-tracker.ts
3949
- const PERFORMANCE_SAMPLE_LIMIT = 2048;
3950
- function isRecord(value) {
3951
- return typeof value === "object" && value != null;
3952
- }
3953
- function getRequest(message) {
3954
- if (!isRecord(message) || typeof message.method !== "string" || !Array.isArray(message.args)) return null;
3955
- const request = message.args[0];
3956
- return isRecord(request) ? {
3957
- method: message.method,
3958
- request
3959
- } : null;
3960
- }
3961
- function getPublicationResult(message) {
3962
- if (!isRecord(message) || !isRecord(message.data)) return null;
3963
- const result = message.data;
3964
- if (isRecord(result.step)) return result.step;
3965
- return result;
3966
- }
3967
- function createTransferMetrics() {
3968
- return {
3969
- mutationTransferMs: [],
3970
- patchTransferMs: [],
3971
- snapshotTransferMs: []
3972
- };
3973
- }
3974
- var DocsLayoutWorkerPerformanceTracker = class {
3975
- constructor() {
3976
- _defineProperty(this, "_metrics", /* @__PURE__ */ new Map());
3977
- }
3978
- recordRequest(message, durationMs) {
3979
- const requestInfo = getRequest(message);
3980
- const unitId = requestInfo === null || requestInfo === void 0 ? void 0 : requestInfo.request.unitId;
3981
- if (requestInfo == null || typeof unitId !== "string") return;
3982
- if (requestInfo.method === "createSession") {
3983
- this._append(unitId, "snapshotTransferMs", durationMs);
3984
- return;
3985
- }
3986
- if (requestInfo.method === "startLayout" && Array.isArray(requestInfo.request.mutations) && requestInfo.request.mutations.length > 0) this._append(unitId, "mutationTransferMs", durationMs);
3987
- }
3988
- recordResponse(message, durationMs) {
3989
- const result = getPublicationResult(message);
3990
- if (result == null || typeof result.unitId !== "string" || result.publication == null) return;
3991
- this._append(result.unitId, "patchTransferMs", durationMs);
3992
- }
3993
- getMetrics(unitId) {
3994
- const metrics = this._metrics.get(unitId) ?? createTransferMetrics();
3995
- return {
3996
- mutationTransferMs: [...metrics.mutationTransferMs],
3997
- patchTransferMs: [...metrics.patchTransferMs],
3998
- snapshotTransferMs: [...metrics.snapshotTransferMs]
3999
- };
4000
- }
4001
- reset(unitId) {
4002
- this._metrics.delete(unitId);
4003
- }
4004
- resetAll() {
4005
- this._metrics.clear();
4006
- }
4007
- _append(unitId, metric, durationMs) {
4008
- const metrics = this._metrics.get(unitId) ?? createTransferMetrics();
4009
- const samples = metrics[metric];
4010
- samples.push(durationMs);
4011
- if (samples.length > PERFORMANCE_SAMPLE_LIMIT) samples.splice(0, samples.length - PERFORMANCE_SAMPLE_LIMIT);
4012
- this._metrics.set(unitId, metrics);
4013
- }
4014
- };
4015
-
4016
- //#endregion
4017
- //#region src/layout-worker/protocol.ts
4018
- const DOCS_LAYOUT_WORKER_CHANNEL = "univer.docs-layout-worker";
4019
-
4020
- //#endregion
4021
- //#region src/layout-worker/worker.ts
4022
- const FONT_PROBE_CONTENT = "Univer 文档 Worker 0123456789";
4023
- const FONT_PROBE_STYLE = "16px Arial";
4024
- const WORKER_LAYOUT_INTERRUPT_INTERVAL = 8;
4025
- function yieldForWorkerMessage() {
4026
- return new Promise((resolve) => {
4027
- (0, _univerjs_core.requestImmediateMacroTask)(() => resolve());
4028
- });
4029
- }
4030
- function createDocsLayoutWorkerMessageProtocol$1(performanceTracker) {
4031
- return {
4032
- send(message) {
4033
- const startedAt = _univerjs_core.Tools.now();
4034
- postMessage(message);
4035
- performanceTracker.recordResponse(message, _univerjs_core.Tools.now() - startedAt);
4036
- },
4037
- onMessage: new rxjs.Observable((subscriber) => {
4038
- const handler = (event) => subscriber.next(event.data);
4039
- addEventListener("message", handler);
4040
- return () => removeEventListener("message", handler);
4041
- }).pipe((0, rxjs.shareReplay)({
4042
- bufferSize: 1,
4043
- refCount: true
4044
- }))
4045
- };
4046
- }
4047
- function getCustomRangePresentationKey(entry) {
4048
- return JSON.stringify([entry.segmentId, entry.rangeId]);
4049
- }
4050
- function applyRecordPatch(target, patch) {
4051
- if (patch == null) return;
4052
- for (const key of patch.removals) delete target[key];
4053
- Object.assign(target, patch.upserts);
4054
- }
4055
- var DocsLayoutWorkerRuntime = class {
4056
- constructor(_performanceTracker = new DocsLayoutWorkerPerformanceTracker()) {
4057
- this._performanceTracker = _performanceTracker;
4058
- _defineProperty(this, "_sessions", /* @__PURE__ */ new Map());
4059
- _defineProperty(this, "_fontLoader", new DocsLayoutFontLoader());
4060
- _defineProperty(this, "type", "worker");
4061
- }
4062
- initialize(fontFaces = []) {
4063
- return this._fontLoader.load(fontFaces);
4064
- }
4065
- async getCapabilities() {
4066
- const metrics = _univerjs_engine_render.FontCache.getMeasureText(FONT_PROBE_CONTENT, FONT_PROBE_STYLE);
4067
- return {
4068
- protocolVersion: 5,
4069
- executor: "worker",
4070
- offscreenCanvas: typeof OffscreenCanvas !== "undefined",
4071
- structuredClone: typeof structuredClone === "function",
4072
- fontProbe: {
4073
- content: FONT_PROBE_CONTENT,
4074
- font: FONT_PROBE_STYLE,
4075
- width: metrics.width,
4076
- actualBoundingBoxAscent: metrics.actualBoundingBoxAscent,
4077
- actualBoundingBoxDescent: metrics.actualBoundingBoxDescent
4078
- }
4079
- };
4080
- }
4081
- async recover() {
4082
- for (const session of this._sessions.values()) for (const mount of session.layoutSessions.values()) mount.layoutSession.dispose();
4083
- this._sessions.clear();
4084
- }
4085
- async createSession(request) {
4086
- if (typeof OffscreenCanvas === "undefined") throw new Error("Document layout Worker requires OffscreenCanvas text measurement support.");
4087
- const currentSession = this._sessions.get(request.unitId);
4088
- if (currentSession != null && request.sessionEpoch < currentSession.sessionEpoch) return;
4089
- this._disposeSession(request.unitId);
4090
- _univerjs_engine_render.FontCache.setNormalLineHeightCache(request.normalFontLineHeights ?? {});
4091
- const dataModel = new _univerjs_core.DocumentDataModel(request.snapshot);
4092
- const localeService = new _univerjs_core.LocaleService();
4093
- if (request.localeData != null) localeService.load({ [request.locale]: request.localeData });
4094
- localeService.setLocale(request.locale);
4095
- localeService.setDirection(request.direction);
4096
- this._sessions.set(request.unitId, {
4097
- sessionEpoch: request.sessionEpoch,
4098
- dataModel,
4099
- layoutSessions: /* @__PURE__ */ new Map(),
4100
- localeService,
4101
- modelRevision: request.modelRevision,
4102
- customRangePresentations: /* @__PURE__ */ new Map()
4103
- });
4104
- }
4105
- async startLayout(request) {
4106
- const session = this._sessions.get(request.unitId);
4107
- if (session == null) return { status: "not-found" };
4108
- if (session.modelRevision !== request.baseRevision) return {
4109
- status: "resnapshot-required",
4110
- modelRevision: session.modelRevision
4111
- };
4112
- if (!this._applyMutations(session, request)) return {
4113
- status: "resnapshot-required",
4114
- modelRevision: session.modelRevision
4115
- };
4116
- _univerjs_engine_render.FontCache.setNormalLineHeightCache(request.normalFontLineHeights ?? {});
4117
- this._updateCustomRangePresentations(session, request);
4118
- this._applyCustomRangePresentations(session.dataModel, Array.from(session.customRangePresentations.values()));
4119
- let mount = session.layoutSessions.get(request.mountId);
4120
- if (mount != null && (request.mountEpoch < mount.mountEpoch || request.mountEpoch === mount.mountEpoch && request.viewportEpoch < mount.viewportEpoch)) return { status: "superseded" };
4121
- if (mount != null && request.mountEpoch > mount.mountEpoch) {
4122
- mount.layoutSession.dispose();
4123
- session.layoutSessions.delete(request.mountId);
4124
- mount = void 0;
4125
- }
4126
- if (mount == null) {
4127
- const customBlockViewports = { ...request.customBlockViewports };
4128
- applyRecordPatch(customBlockViewports, request.customBlockViewportPatch);
4129
- mount = {
4130
- mountId: request.mountId,
4131
- layoutSession: new _univerjs_engine_render.DocumentLayoutSession(session.dataModel, session.localeService),
4132
- customBlockViewports,
4133
- metricsRevision: request.metricsRevision,
4134
- mountEpoch: request.mountEpoch,
4135
- viewportEpoch: request.viewportEpoch,
4136
- activeGeneration: null,
4137
- cancelledGeneration: null
4138
- };
4139
- session.layoutSessions.set(request.mountId, mount);
4140
- } else {
4141
- if (request.customBlockViewports != null) mount.customBlockViewports = { ...request.customBlockViewports };
4142
- applyRecordPatch(mount.customBlockViewports, request.customBlockViewportPatch);
4143
- mount.metricsRevision = request.metricsRevision;
4144
- mount.viewportEpoch = request.viewportEpoch;
4145
- }
4146
- const generation = mount.layoutSession.start({
4147
- waitForHyphenationPatterns: true,
4148
- reason: request.reason,
4149
- anchor: request.anchor,
4150
- priorityAnchor: request.priorityAnchor,
4151
- invalidation: request.invalidation,
4152
- modernPageWidth: request.modernPageWidth,
4153
- modernHorizontalMargin: request.modernHorizontalMargin
4154
- });
4155
- mount.activeGeneration = generation;
4156
- mount.cancelledGeneration = null;
4157
- return {
4158
- status: "accepted",
4159
- step: await this._runLayoutStep(session, mount, generation, request.budgetMs)
4160
- };
4161
- }
4162
- _applyMutations(session, request) {
4163
- for (const mutation of request.mutations) {
4164
- if (mutation.baseRevision !== session.modelRevision || mutation.modelRevision !== mutation.baseRevision + 1) return false;
4165
- session.dataModel.apply(mutation.actions);
4166
- session.modelRevision = mutation.modelRevision;
4167
- }
4168
- if (session.modelRevision !== request.modelRevision) return false;
4169
- if (request.mutations.length > 0) for (const mount of session.layoutSessions.values()) {
4170
- mount.activeGeneration = null;
4171
- mount.cancelledGeneration = null;
4172
- mount.layoutSession.resetDataModel(session.dataModel);
4173
- }
4174
- return true;
4175
- }
4176
- _applyCustomRangePresentations(dataModel, presentations) {
4177
- const rangeMaps = /* @__PURE__ */ new Map();
4178
- const segmentModels = [
4179
- ["", dataModel],
4180
- ...dataModel.headerModelMap,
4181
- ...dataModel.footerModelMap
4182
- ];
4183
- for (const [segmentId, segmentModel] of segmentModels) {
4184
- var _segmentModel$getBody;
4185
- const rangeMap = /* @__PURE__ */ new Map();
4186
- for (const range of ((_segmentModel$getBody = segmentModel.getBody()) === null || _segmentModel$getBody === void 0 ? void 0 : _segmentModel$getBody.customRanges) ?? []) {
4187
- const workerRange = range;
4188
- delete workerRange.active;
4189
- delete workerRange.glyphAscentEm;
4190
- delete workerRange.glyphDescentEm;
4191
- delete workerRange.glyphWidthEm;
4192
- delete workerRange.show;
4193
- if (!rangeMap.has(range.rangeId)) rangeMap.set(range.rangeId, workerRange);
4194
- }
4195
- rangeMaps.set(segmentId, rangeMap);
4196
- }
4197
- for (const { segmentId, rangeId, presentation } of presentations ?? []) {
4198
- const rangeMap = rangeMaps.get(segmentId);
4199
- const range = rangeMap === null || rangeMap === void 0 ? void 0 : rangeMap.get(rangeId);
4200
- if (range != null) {
4201
- Object.assign(range, presentation);
4202
- rangeMap === null || rangeMap === void 0 || rangeMap.delete(rangeId);
4203
- }
4204
- }
4205
- }
4206
- _updateCustomRangePresentations(session, request) {
4207
- var _request$customRangeP, _request$customRangeP2;
4208
- if (request.customRangePresentations != null) {
4209
- session.customRangePresentations.clear();
4210
- for (const entry of request.customRangePresentations) {
4211
- const key = getCustomRangePresentationKey(entry);
4212
- if (!session.customRangePresentations.has(key)) session.customRangePresentations.set(key, entry);
4213
- }
4214
- }
4215
- for (const removal of ((_request$customRangeP = request.customRangePresentationPatch) === null || _request$customRangeP === void 0 ? void 0 : _request$customRangeP.removals) ?? []) session.customRangePresentations.delete(getCustomRangePresentationKey(removal));
4216
- for (const entry of ((_request$customRangeP2 = request.customRangePresentationPatch) === null || _request$customRangeP2 === void 0 ? void 0 : _request$customRangeP2.upserts) ?? []) session.customRangePresentations.set(getCustomRangePresentationKey(entry), entry);
4217
- }
4218
- async stepLayout(request) {
4219
- const session = this._getSession(request.unitId);
4220
- const mount = this._getLayoutMount(session, request);
4221
- return await this._runLayoutStep(session, mount, request.generation, request.budgetMs);
4222
- }
4223
- async publishBacklog(request) {
4224
- const session = this._getSession(request.unitId);
4225
- const mount = this._getLayoutMount(session, request);
4226
- return this._runWithCustomBlockViewports(session, mount, () => ({
4227
- ...mount.layoutSession.publishBacklog(request.generation),
4228
- unitId: request.unitId,
4229
- mountId: request.mountId,
4230
- mountEpoch: mount.mountEpoch,
4231
- viewportEpoch: mount.viewportEpoch,
4232
- modelRevision: session.modelRevision,
4233
- metricsRevision: mount.metricsRevision
4234
- }));
4235
- }
4236
- async getLayoutPage(request) {
4237
- const session = this._getSession(request.unitId);
4238
- const mount = this._getLayoutMount(session, request);
4239
- return {
4240
- ...request,
4241
- modelRevision: session.modelRevision,
4242
- metricsRevision: mount.metricsRevision,
4243
- page: mount.layoutSession.getPage(request.pageIndex)
4244
- };
4245
- }
4246
- async cancelLayout(request) {
4247
- var _this$_sessions$get;
4248
- const mount = (_this$_sessions$get = this._sessions.get(request.unitId)) === null || _this$_sessions$get === void 0 ? void 0 : _this$_sessions$get.layoutSessions.get(request.mountId);
4249
- if ((mount === null || mount === void 0 ? void 0 : mount.mountEpoch) === request.mountEpoch && mount.viewportEpoch === request.viewportEpoch) {
4250
- if (request.generation == null || request.generation === mount.activeGeneration) mount.cancelledGeneration = request.generation ?? mount.activeGeneration;
4251
- mount.layoutSession.cancel(request.generation);
4252
- }
4253
- }
4254
- async getPerformanceMetrics(unitId) {
4255
- return this._performanceTracker.getMetrics(unitId);
4256
- }
4257
- async resetPerformanceMetrics(unitId) {
4258
- this._performanceTracker.reset(unitId);
4259
- }
4260
- async disposeLayoutMount(request) {
4261
- const session = this._sessions.get(request.unitId);
4262
- const mount = session === null || session === void 0 ? void 0 : session.layoutSessions.get(request.mountId);
4263
- if (session == null || mount == null || mount.mountEpoch !== request.mountEpoch || mount.viewportEpoch !== request.viewportEpoch) return;
4264
- session.layoutSessions.delete(request.mountId);
4265
- mount.activeGeneration = null;
4266
- mount.layoutSession.dispose();
4267
- }
4268
- async disposeSession(request) {
4269
- const session = this._sessions.get(request.unitId);
4270
- if ((session === null || session === void 0 ? void 0 : session.sessionEpoch) !== request.sessionEpoch) return;
4271
- this._disposeSession(request.unitId);
4272
- this._performanceTracker.reset(request.unitId);
4273
- }
4274
- dispose() {
4275
- this._fontLoader.dispose();
4276
- for (const unitId of this._sessions.keys()) this._disposeSession(unitId);
4277
- this._performanceTracker.resetAll();
4278
- }
4279
- _getSession(unitId) {
4280
- const session = this._sessions.get(unitId);
4281
- if (session == null) throw new Error(`Document layout Worker session not found for unit "${unitId}".`);
4282
- return session;
4283
- }
4284
- _getLayoutMount(session, request) {
4285
- const mount = session.layoutSessions.get(request.mountId);
4286
- if (mount == null) throw new Error(`Document layout Worker mount not found: "${request.mountId}".`);
4287
- if (mount.mountEpoch !== request.mountEpoch || mount.viewportEpoch !== request.viewportEpoch) throw new Error(`Document layout Worker rejected a stale mount publication: "${request.mountId}".`);
4288
- return mount;
4289
- }
4290
- async _runLayoutStep(session, mount, generation, budgetMs) {
4291
- const result = this._runWithCustomBlockViewports(session, mount, () => ({
4292
- ...mount.layoutSession.step(generation, budgetMs, WORKER_LAYOUT_INTERRUPT_INTERVAL),
4293
- unitId: session.dataModel.getUnitId(),
4294
- mountId: mount.mountId,
4295
- mountEpoch: mount.mountEpoch,
4296
- viewportEpoch: mount.viewportEpoch,
4297
- modelRevision: session.modelRevision,
4298
- metricsRevision: mount.metricsRevision
4299
- }));
4300
- await yieldForWorkerMessage();
4301
- if (mount.activeGeneration === generation && mount.cancelledGeneration !== generation) return result;
4302
- return this._runWithCustomBlockViewports(session, mount, () => ({
4303
- ...mount.layoutSession.step(generation, 0, 1),
4304
- unitId: session.dataModel.getUnitId(),
4305
- mountId: mount.mountId,
4306
- mountEpoch: mount.mountEpoch,
4307
- viewportEpoch: mount.viewportEpoch,
4308
- modelRevision: session.modelRevision,
4309
- metricsRevision: mount.metricsRevision
4310
- }));
4311
- }
4312
- _runWithCustomBlockViewports(session, mount, run) {
4313
- const unregister = (0, _univerjs_engine_render.setDocsCustomBlockRenderViewportProvider)((unitId, blockId) => unitId === session.dataModel.getUnitId() ? mount.customBlockViewports[blockId] : null);
4314
- try {
4315
- return run();
4316
- } finally {
4317
- unregister();
4318
- }
4319
- }
4320
- _disposeSession(unitId) {
4321
- const session = this._sessions.get(unitId);
4322
- if (session == null) return;
4323
- this._sessions.delete(unitId);
4324
- for (const mount of session.layoutSessions.values()) {
4325
- mount.activeGeneration = null;
4326
- mount.layoutSession.dispose();
4327
- }
4328
- session.layoutSessions.clear();
4329
- session.dataModel.dispose();
4330
- session.localeService.dispose();
4331
- }
4332
- };
4333
- var DocsLayoutWorkerChannelService = class extends _univerjs_rpc.ChannelService {
4334
- constructor(protocol, _runtime) {
4335
- super(protocol);
4336
- this._runtime = _runtime;
4337
- }
4338
- dispose() {
4339
- this._runtime.dispose();
4340
- super.dispose();
4341
- }
4342
- };
4343
- function startDocsLayoutWorker() {
4344
- const performanceTracker = new DocsLayoutWorkerPerformanceTracker();
4345
- const runtime = new DocsLayoutWorkerRuntime(performanceTracker);
4346
- const channelService = new DocsLayoutWorkerChannelService(createDocsLayoutWorkerMessageProtocol$1(performanceTracker), runtime);
4347
- channelService.registerChannel(DOCS_LAYOUT_WORKER_CHANNEL, (0, _univerjs_rpc.fromModule)(runtime));
4348
- return channelService;
4349
- }
4350
-
4351
- //#endregion
4352
- //#region src/layout-worker/index.ts
3120
+ // src/layout-worker/index.ts
4353
3121
  const FONT_METRICS_TOLERANCE = 1;
4354
3122
  var DocsLayoutWorkerCapabilityError = class extends Error {
4355
3123
  constructor(message) {
@@ -4380,15 +3148,15 @@ var DocsLayoutWorkerClientService = class extends _univerjs_core.Disposable {
4380
3148
  this._workerFactory = _workerFactory;
4381
3149
  this._requestTimeoutMs = _requestTimeoutMs;
4382
3150
  this._fontFaces = _fontFaces;
4383
- _defineProperty(this, "type", "worker");
4384
- _defineProperty(this, "_worker", null);
4385
- _defineProperty(this, "_channelService", null);
4386
- _defineProperty(this, "_runtime", null);
4387
- _defineProperty(this, "_initialization", void 0);
4388
- _defineProperty(this, "_initialized", false);
4389
- _defineProperty(this, "_performanceTracker", new DocsLayoutWorkerPerformanceTracker());
4390
- _defineProperty(this, "_fontFamilies", /* @__PURE__ */ new Map());
4391
- _defineProperty(this, "_fontLoader", new DocsLayoutFontLoader());
3151
+ require_protocol._defineProperty(this, "type", "worker");
3152
+ require_protocol._defineProperty(this, "_worker", null);
3153
+ require_protocol._defineProperty(this, "_channelService", null);
3154
+ require_protocol._defineProperty(this, "_runtime", null);
3155
+ require_protocol._defineProperty(this, "_initialization", void 0);
3156
+ require_protocol._defineProperty(this, "_initialized", false);
3157
+ require_protocol._defineProperty(this, "_performanceTracker", new require_protocol.DocsLayoutWorkerPerformanceTracker());
3158
+ require_protocol._defineProperty(this, "_fontFamilies", /* @__PURE__ */ new Map());
3159
+ require_protocol._defineProperty(this, "_fontLoader", new require_protocol.DocsLayoutFontLoader());
4392
3160
  this.disposeWithMe(this._fontLoader);
4393
3161
  this._initialization = this._replaceRuntime();
4394
3162
  }
@@ -4482,7 +3250,7 @@ var DocsLayoutWorkerClientService = class extends _univerjs_core.Disposable {
4482
3250
  const channelService = new _univerjs_rpc.ChannelService(createDocsLayoutWorkerMessageProtocol(worker, this._performanceTracker));
4483
3251
  this._worker = worker;
4484
3252
  this._channelService = channelService;
4485
- this._runtime = (0, _univerjs_rpc.toModule)(channelService.requestChannel(DOCS_LAYOUT_WORKER_CHANNEL));
3253
+ this._runtime = (0, _univerjs_rpc.toModule)(channelService.requestChannel(require_protocol.DOCS_LAYOUT_WORKER_CHANNEL));
4486
3254
  try {
4487
3255
  await this._withTimeout(this._runtime.initialize(this._fontFaces), "load Worker fonts");
4488
3256
  await this._withTimeout(this._verifyCapabilities(), "verify capabilities");
@@ -4551,18 +3319,17 @@ let UniverDocsLayoutWorkerPlugin = class UniverDocsLayoutWorkerPlugin extends _u
4551
3319
  this.disposeWithMe(this._layoutExecutorService.register(client));
4552
3320
  }
4553
3321
  };
4554
- _defineProperty(UniverDocsLayoutWorkerPlugin, "pluginName", "DOCS_LAYOUT_WORKER_PLUGIN");
4555
- _defineProperty(UniverDocsLayoutWorkerPlugin, "packageName", name);
4556
- _defineProperty(UniverDocsLayoutWorkerPlugin, "version", version);
4557
- UniverDocsLayoutWorkerPlugin = __decorate([
3322
+ require_protocol._defineProperty(UniverDocsLayoutWorkerPlugin, "pluginName", "DOCS_LAYOUT_WORKER_PLUGIN");
3323
+ require_protocol._defineProperty(UniverDocsLayoutWorkerPlugin, "packageName", require_protocol.name);
3324
+ require_protocol._defineProperty(UniverDocsLayoutWorkerPlugin, "version", require_protocol.version);
3325
+ UniverDocsLayoutWorkerPlugin = require_protocol.__decorate([
4558
3326
  (0, _univerjs_core.DependentOn)(UniverDocsPlugin),
4559
- __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
4560
- __decorateParam(2, (0, _univerjs_core.Inject)(DocLayoutExecutorService)),
4561
- __decorateParam(3, _univerjs_core.IConfigService)
3327
+ require_protocol.__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
3328
+ require_protocol.__decorateParam(2, (0, _univerjs_core.Inject)(require_protocol.DocLayoutExecutorService)),
3329
+ require_protocol.__decorateParam(3, _univerjs_core.IConfigService)
4562
3330
  ], UniverDocsLayoutWorkerPlugin);
4563
3331
 
4564
- //#endregion
4565
- //#region src/services/doc-interceptor/interceptor-const.ts
3332
+ // src/services/doc-interceptor/interceptor-const.ts
4566
3333
  const CUSTOM_RANGE = (0, _univerjs_core.createInterceptorKey)("CUSTOM_RANGE");
4567
3334
  const CUSTOM_DECORATION = (0, _univerjs_core.createInterceptorKey)("CUSTOM_DECORATION");
4568
3335
  const DOC_INTERCEPTOR_POINT = {
@@ -4570,14 +3337,13 @@ const DOC_INTERCEPTOR_POINT = {
4570
3337
  CUSTOM_DECORATION
4571
3338
  };
4572
3339
 
4573
- //#endregion
4574
- //#region src/services/doc-interceptor/doc-interceptor.service.ts
3340
+ // src/services/doc-interceptor/doc-interceptor.service.ts
4575
3341
  let DocInterceptorService = class DocInterceptorService extends _univerjs_core.Disposable {
4576
3342
  constructor(_context, _docSkeletonManagerService) {
4577
3343
  super();
4578
3344
  this._context = _context;
4579
3345
  this._docSkeletonManagerService = _docSkeletonManagerService;
4580
- _defineProperty(this, "_interceptorsByName", /* @__PURE__ */ new Map());
3346
+ require_protocol._defineProperty(this, "_interceptorsByName", /* @__PURE__ */ new Map());
4581
3347
  const viewModel = this._docSkeletonManagerService.getViewModel();
4582
3348
  const unitId = viewModel.getDataModel().getUnitId();
4583
3349
  if (unitId === _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY || unitId === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) return;
@@ -4633,10 +3399,9 @@ let DocInterceptorService = class DocInterceptorService extends _univerjs_core.D
4633
3399
  return disposableCollection;
4634
3400
  }
4635
3401
  };
4636
- DocInterceptorService = __decorate([__decorateParam(1, (0, _univerjs_core.Inject)(DocSkeletonManagerService))], DocInterceptorService);
3402
+ DocInterceptorService = require_protocol.__decorate([require_protocol.__decorateParam(1, (0, _univerjs_core.Inject)(DocSkeletonManagerService))], DocInterceptorService);
4637
3403
 
4638
- //#endregion
4639
- //#region src/utils/custom-range-factory.ts
3404
+ // src/utils/custom-range-factory.ts
4640
3405
  function addCustomRangeFactory(accessor, param, body) {
4641
3406
  const { unitId, segmentId } = param;
4642
3407
  const documentDataModel = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(unitId);
@@ -4726,8 +3491,7 @@ function deleteCustomRangeFactory(accessor, params) {
4726
3491
  return doMutation;
4727
3492
  }
4728
3493
 
4729
- //#endregion
4730
- //#region src/utils/paragraphs.ts
3494
+ // src/utils/paragraphs.ts
4731
3495
  /** Builds paragraph metadata for inserted paragraph tokens, including horizontal-rule borders. */
4732
3496
  function generateParagraphs(dataStream, prevParagraph, borderBottom, existingParagraphIds = []) {
4733
3497
  const paragraphs = [];
@@ -4755,8 +3519,7 @@ function generateParagraphs(dataStream, prevParagraph, borderBottom, existingPar
4755
3519
  return paragraphs;
4756
3520
  }
4757
3521
 
4758
- //#endregion
4759
- //#region src/utils/replace-selection-factory.ts
3522
+ // src/utils/replace-selection-factory.ts
4760
3523
  function replaceSelectionFactory(accessor, params) {
4761
3524
  var _params$selection, _docDataModel$getSelf;
4762
3525
  const { unitId, body: insertBody, doc } = params;
@@ -4797,8 +3560,7 @@ function replaceSelectionFactory(accessor, params) {
4797
3560
  return doMutation;
4798
3561
  }
4799
3562
 
4800
- //#endregion
4801
- //#region src/utils/transform-position.ts
3563
+ // src/utils/transform-position.ts
4802
3564
  function buildDocTransform(width, height, position) {
4803
3565
  return {
4804
3566
  size: {
@@ -4846,8 +3608,7 @@ function transformToDocDrawingPosition(transform, marginLeft = 0, marginTop = 0)
4846
3608
  };
4847
3609
  }
4848
3610
 
4849
- //#endregion
4850
- //#region src/utils/util.ts
3611
+ // src/utils/util.ts
4851
3612
  function consumeContentInsertRange(accessor, unitId) {
4852
3613
  try {
4853
3614
  return accessor.get(DocContentInsertService).consumeInsertRange(unitId);
@@ -4879,7 +3640,6 @@ function normalizeTextRange(textRange) {
4879
3640
  };
4880
3641
  }
4881
3642
 
4882
- //#endregion
4883
3643
  exports.CreateHeaderFooterCommand = CreateHeaderFooterCommand;
4884
3644
  exports.DOCUMENT_UNIT_PERMISSION_ACTIONS = DOCUMENT_UNIT_PERMISSION_ACTIONS;
4885
3645
  exports.DOC_INTERCEPTOR_POINT = DOC_INTERCEPTOR_POINT;
@@ -4898,12 +3658,12 @@ Object.defineProperty(exports, "DocInterceptorService", {
4898
3658
  Object.defineProperty(exports, "DocLayoutExecutorService", {
4899
3659
  enumerable: true,
4900
3660
  get: function () {
4901
- return DocLayoutExecutorService;
3661
+ return require_protocol.DocLayoutExecutorService;
4902
3662
  }
4903
3663
  });
4904
- exports.DocLayoutExecutorState = DocLayoutExecutorState;
4905
- exports.DocLayoutExecutorType = DocLayoutExecutorType;
4906
- exports.DocLayoutSessionStatus = DocLayoutSessionStatus;
3664
+ exports.DocLayoutExecutorState = require_protocol.DocLayoutExecutorState;
3665
+ exports.DocLayoutExecutorType = require_protocol.DocLayoutExecutorType;
3666
+ exports.DocLayoutSessionStatus = require_protocol.DocLayoutSessionStatus;
4907
3667
  Object.defineProperty(exports, "DocSelectionManagerService", {
4908
3668
  enumerable: true,
4909
3669
  get: function () {
@@ -4993,6 +3753,5 @@ exports.replaceSelectionFactory = replaceSelectionFactory;
4993
3753
  exports.resolveDocsCustomBlockSize = resolveDocsCustomBlockSize;
4994
3754
  exports.setDocumentPermissionValue = setDocumentPermissionValue;
4995
3755
  exports.shouldUseInlineTextSelectionForDocsCustomBlockDrawing = shouldUseInlineTextSelectionForDocsCustomBlockDrawing;
4996
- exports.startDocsLayoutWorker = startDocsLayoutWorker;
4997
3756
  exports.transformDocumentTextRanges = transformDocumentTextRanges;
4998
3757
  exports.transformToDocDrawingPosition = transformToDocDrawingPosition;