@univerjs/docs-ui 0.2.3 → 0.2.4-alpha.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/es/index.js CHANGED
@@ -1,33 +1,31 @@
1
- var fn = Object.defineProperty;
2
- var _n = (t, e, n) => e in t ? fn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var C = (t, e, n) => _n(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { FOCUSING_DOC as Ne, FOCUSING_UNIVER_EDITOR as lt, FOCUSING_COMMON_DRAWINGS as Gt, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as mn, Tools as Q, LRUMap as Sn, BaselineOffset as ae, BooleanNumber as S, ColorKit as ft, skipParseTagNames as vn, IUniverInstanceService as U, ILogService as Yt, ICommandService as O, Disposable as te, normalizeBody as Rn, toDisposable as Xt, RxDisposable as ve, Direction as X, EDITOR_ACTIVATED as Kt, LocaleService as le, CommandType as de, DocumentFlavor as On, JSONX as qe, UniverInstanceType as v, ThemeService as Zt, HorizontalAlign as Ue, OnLifecycle as Le, LifecycleStages as we, IContextService as Cn, checkForSubstrings as En, IConfigService as In, DisposableCollection as _t, Plugin as Tn, ObjectRelativeFromH as bn, ObjectRelativeFromV as Mn } from "@univerjs/core";
5
- import { IClipboardInterfaceService as dt, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as xn, HTML_CLIPBOARD_MIME_TYPE as yn, IEditorService as K, KeyCode as H, MetaKeys as Re, ILayoutService as Jt, ISidebarService as Pn, ComponentManager as qt, MenuGroup as y, MenuItemType as x, MenuPosition as P, getMenuHiddenObservable as D, FONT_FAMILY_LIST as mt, FONT_SIZE_LIST as Dn, getHeaderFooterMenuHiddenObservable as An, FontFamily as Fn, FontFamilyItem as Nn, FontSize as Un, BuiltInUIPart as Ln, IMenuService as wn, IUIPartsService as Bn, CopyCommand as $n, CutCommand as Hn, PasteCommand as Vn, SetEditorResizeOperation as jn, ICanvasPopupService as Wn, IShortcutService as kn } from "@univerjs/ui";
6
- import { createIdentifier as zn, Inject as T, Injector as Be, Optional as Gn } from "@wendellhu/redi";
7
- import { TextSelectionManagerService as ne, CutContentCommand as Qt, InnerPasteCommand as en, getDeleteSelection as Yn, DocSkeletonManagerService as w, VIEWPORT_KEY as ee, getDocObject as Xn, MoveCursorOperation as $e, MoveSelectionOperation as He, SelectAllOperation as Kn, neoGetDocObject as q, RichTextEditingMutation as ut, SetInlineFormatBoldCommand as Zn, SetTextSelectionsOperation as V, SetInlineFormatCommand as ue, SetInlineFormatItalicCommand as Jn, SetInlineFormatUnderlineCommand as qn, SetInlineFormatStrikethroughCommand as Qn, SetInlineFormatSubscriptCommand as eo, SetInlineFormatSuperscriptCommand as to, SetInlineFormatFontFamilyCommand as St, SetInlineFormatFontSizeCommand as vt, SetInlineFormatTextColorCommand as Rt, AlignLeftCommand as no, AlignOperationCommand as Ve, AlignCenterCommand as oo, AlignRightCommand as io, AlignJustifyCommand as ro, OrderListCommand as so, BulletListCommand as ao, ResetInlineFormatTextBackgroundColorCommand as co, SetInlineFormatTextBackgroundColorCommand as Qe, BreakLineCommand as lo, DeleteLeftCommand as uo, DeleteRightCommand as ho, CoverContentCommand as go, DOCS_COMPONENT_MAIN_LAYER_INDEX as Ge, DOCS_COMPONENT_HEADER_LAYER_INDEX as po, DOCS_VIEW_KEY as ie, DOCS_COMPONENT_DEFAULT_Z_INDEX as Ot, DOCS_COMPONENT_BACKGROUND_LAYER_INDEX as fo, SetDocZoomRatioCommand as _o, SetDocZoomRatioOperation as Pe, DocInterceptorService as mo } from "@univerjs/docs";
8
- import { pixelToPt as So, ptToPixel as Ct, NodePositionConvertToCursor as tn, getAnchorBounding as vo, IRenderManagerService as j, ITextSelectionRenderManager as oe, Shape as Ro, DocumentEditArea as N, PageLayoutType as De, Vector2 as nn, Rect as Ye, Path as Et, ScrollBar as et, Viewport as Oo, Layer as It, Documents as Co, DocBackground as Eo, CURSOR_TYPE as Tt, getLineBounding as Io } from "@univerjs/engine-render";
9
- import { takeUntil as se, Observable as B, combineLatest as To, fromEvent as bt, BehaviorSubject as Mt, map as bo } from "rxjs";
10
- import { useDependency as z, connectInjector as Mo } from "@wendellhu/redi/react-bindings";
11
- import xo, { useState as on, useEffect as rn } from "react";
12
- import { Checkbox as xt, InputNumber as yt, Button as yo, ColorPicker as Po } from "@univerjs/design";
13
- import Do from "clsx";
14
- function W(t) {
15
- return t.getContextValue(Ne) && t.getContextValue(lt) && !t.getContextValue(Gt);
1
+ var Sn = Object.defineProperty;
2
+ var vn = (t, e, n) => e in t ? Sn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var C = (t, e, n) => vn(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { FOCUSING_DOC as Ue, FOCUSING_UNIVER_EDITOR as dt, FOCUSING_COMMON_DRAWINGS as Xt, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as Rn, Tools as j, LRUMap as On, BaselineOffset as ae, BooleanNumber as S, ColorKit as ft, DataStreamTreeTokenType as Pe, CustomRangeType as Kt, skipParseTagNames as Cn, createIdentifier as En, Inject as E, IUniverInstanceService as w, ILogService as Zt, ICommandService as O, Disposable as Q, SliceBodyType as mt, normalizeBody as Tn, UniverInstanceType as v, toDisposable as Jt, RxDisposable as Se, Direction as K, EDITOR_ACTIVATED as qt, LocaleService as le, Injector as Le, Optional as In, useDependency as z, CommandType as de, DocumentFlavor as bn, JSONX as Qe, ThemeService as Qt, HorizontalAlign as we, OnLifecycle as Be, LifecycleStages as $e, IContextService as Mn, checkForSubstrings as yn, IConfigService as xn, isInternalEditorID as Pn, DisposableCollection as St, Plugin as Dn, ObjectRelativeFromH as An, ObjectRelativeFromV as Nn } from "@univerjs/core";
5
+ import { IClipboardInterfaceService as ut, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as Fn, HTML_CLIPBOARD_MIME_TYPE as Un, IEditorService as ee, KeyCode as H, MetaKeys as ve, ILayoutService as en, ISidebarService as Ln, ComponentManager as tn, MenuGroup as x, MenuItemType as y, MenuPosition as P, getMenuHiddenObservable as D, FONT_FAMILY_LIST as vt, FONT_SIZE_LIST as wn, getHeaderFooterMenuHiddenObservable as Bn, FontFamily as $n, FontFamilyItem as Hn, FontSize as Vn, IMenuService as jn, CopyCommand as Wn, CutCommand as kn, PasteCommand as Gn, SetEditorResizeOperation as zn, ICanvasPopupService as Yn, IShortcutService as Xn } from "@univerjs/ui";
6
+ import { TextSelectionManagerService as te, DocCustomRangeService as Kn, CutContentCommand as nn, InnerPasteCommand as on, getDeleteSelection as Zn, DocSkeletonManagerService as L, VIEWPORT_KEY as q, getDocObject as Jn, MoveCursorOperation as He, MoveSelectionOperation as Ve, SelectAllOperation as qn, neoGetDocObject as J, RichTextEditingMutation as ht, SetInlineFormatBoldCommand as Qn, SetTextSelectionsOperation as V, SetInlineFormatCommand as ue, SetInlineFormatItalicCommand as eo, SetInlineFormatUnderlineCommand as to, SetInlineFormatStrikethroughCommand as no, SetInlineFormatSubscriptCommand as oo, SetInlineFormatSuperscriptCommand as ro, SetInlineFormatFontFamilyCommand as Rt, SetInlineFormatFontSizeCommand as Ot, SetInlineFormatTextColorCommand as Ct, AlignLeftCommand as io, AlignOperationCommand as je, AlignCenterCommand as so, AlignRightCommand as ao, AlignJustifyCommand as co, OrderListCommand as lo, BulletListCommand as uo, ResetInlineFormatTextBackgroundColorCommand as ho, SetInlineFormatTextBackgroundColorCommand as et, BreakLineCommand as go, DeleteLeftCommand as po, DeleteRightCommand as _o, CoverContentCommand as fo, DOCS_COMPONENT_MAIN_LAYER_INDEX as Ye, DOCS_COMPONENT_HEADER_LAYER_INDEX as mo, DOCS_VIEW_KEY as oe, DOCS_COMPONENT_DEFAULT_Z_INDEX as Et, DOCS_COMPONENT_BACKGROUND_LAYER_INDEX as So, SetDocZoomRatioCommand as vo, SetDocZoomRatioOperation as De, DocInterceptorService as Ro } from "@univerjs/docs";
7
+ import { pixelToPt as Oo, ptToPixel as Tt, NodePositionConvertToCursor as rn, getAnchorBounding as Co, IRenderManagerService as W, ITextSelectionRenderManager as ne, Shape as Eo, DocumentEditArea as F, PageLayoutType as Ae, Vector2 as sn, Rect as Xe, Path as It, ScrollBar as tt, Viewport as To, Layer as bt, Documents as Io, DocBackground as bo, CURSOR_TYPE as Mt, getLineBounding as Mo } from "@univerjs/engine-render";
8
+ import { takeUntil as se, Observable as B, combineLatest as yo, fromEvent as yt, BehaviorSubject as xt, map as xo } from "rxjs";
9
+ import Po, { useState as an, useEffect as cn } from "react";
10
+ import { Checkbox as Pt, InputNumber as Dt, Button as Do, ColorPicker as Ao } from "@univerjs/design";
11
+ import No from "clsx";
12
+ function k(t) {
13
+ return t.getContextValue(Ue) && t.getContextValue(dt) && !t.getContextValue(Xt);
16
14
  }
17
- function Ao(t) {
18
- return t.getContextValue(Ne) && t.getContextValue(lt) && !t.getContextValue(mn) && !t.getContextValue(Gt);
15
+ function Fo(t) {
16
+ return t.getContextValue(Ue) && t.getContextValue(dt) && !t.getContextValue(Rn) && !t.getContextValue(Xt);
19
17
  }
20
- const Fo = 10, No = 6;
21
- function Uo() {
22
- return Q.generateRandomId(No);
18
+ const Uo = 10, Lo = 6;
19
+ function wo() {
20
+ return j.generateRandomId(Lo);
23
21
  }
24
- function Lo(t) {
22
+ function Bo(t) {
25
23
  const e = t.match(/data-copy-id="([^\s]+)"/);
26
24
  return e && e[1] ? e[1] : null;
27
25
  }
28
- class wo {
26
+ class $o {
29
27
  constructor() {
30
- C(this, "_cache", new Sn(Fo));
28
+ C(this, "_cache", new On(Uo));
31
29
  }
32
30
  set(e, n) {
33
31
  this._cache.set(e, n);
@@ -39,8 +37,8 @@ class wo {
39
37
  this._cache.clear();
40
38
  }
41
39
  }
42
- const Pt = new wo();
43
- function ht(t) {
40
+ const At = new $o();
41
+ function gt(t) {
44
42
  const e = t.style, n = {}, o = t.tagName.toLowerCase();
45
43
  switch (o) {
46
44
  case "b":
@@ -71,16 +69,16 @@ function ht(t) {
71
69
  break;
72
70
  }
73
71
  }
74
- for (let i = 0; i < e.length; i++) {
75
- const r = e[i], s = e.getPropertyValue(r);
76
- switch (r) {
72
+ for (let r = 0; r < e.length; r++) {
73
+ const i = e[r], s = e.getPropertyValue(i);
74
+ switch (i) {
77
75
  case "font-family": {
78
76
  n.ff = s;
79
77
  break;
80
78
  }
81
79
  case "font-size": {
82
80
  const a = Number.parseInt(s);
83
- Number.isNaN(a) || (s.endsWith("pt") ? n.fs = a : s.endsWith("px") && (n.fs = So(a)));
81
+ Number.isNaN(a) || (s.endsWith("pt") ? n.fs = a : s.endsWith("px") && (n.fs = Oo(a)));
84
82
  break;
85
83
  }
86
84
  case "font-style": {
@@ -119,11 +117,11 @@ function ht(t) {
119
117
  }
120
118
  return n;
121
119
  }
122
- function Bo(t) {
120
+ function Ho(t) {
123
121
  const e = new DOMParser(), n = `<x-univer id="univer-root">${t}</x-univer>`;
124
122
  return e.parseFromString(n, "text/html").querySelector("#univer-root");
125
123
  }
126
- function Dt(t, e) {
124
+ function Nt(t, e) {
127
125
  const n = t.tagName.toLowerCase();
128
126
  return typeof e == "string" ? n === e : Array.isArray(e) ? e.some((o) => o === n) : e(t);
129
127
  }
@@ -139,44 +137,58 @@ const Fe = class Fe {
139
137
  this._pluginList.push(e);
140
138
  }
141
139
  convert(e) {
142
- const n = Fe._pluginList.find((r) => r.checkPasteType(e)), o = Bo(e), i = {
140
+ const n = Fe._pluginList.find((i) => i.checkPasteType(e)), o = Ho(e), r = {
143
141
  dataStream: "",
144
142
  textRuns: []
145
143
  };
146
- return n && (this._styleRules = [...n.stylesRules], this._afterProcessRules = [...n.afterProcessRules]), this._styleCache.clear(), this._process(null, o == null ? void 0 : o.childNodes, i), this._styleCache.clear(), this._styleRules = [], this._afterProcessRules = [], i;
144
+ return n && (this._styleRules = [...n.stylesRules], this._afterProcessRules = [...n.afterProcessRules]), this._styleCache.clear(), this._process(null, o == null ? void 0 : o.childNodes, r), this._styleCache.clear(), this._styleRules = [], this._afterProcessRules = [], r;
147
145
  }
148
146
  _process(e, n, o) {
149
- var i, r;
150
- for (const s of n)
151
- if (s.nodeType === Node.TEXT_NODE) {
152
- if (((i = s.nodeValue) == null ? void 0 : i.trim()) === "")
147
+ var r, i, s;
148
+ for (const a of n)
149
+ if (a.nodeType === Node.TEXT_NODE) {
150
+ if (((r = a.nodeValue) == null ? void 0 : r.trim()) === "")
153
151
  continue;
154
- const a = (r = s.nodeValue) == null ? void 0 : r.replace(/[\r\n]/g, "");
155
- let c;
156
- e && this._styleCache.has(e) && (c = this._styleCache.get(e)), o.dataStream += a, c && Object.getOwnPropertyNames(c).length && o.textRuns.push({
157
- st: o.dataStream.length - a.length,
152
+ let c = (i = a.nodeValue) == null ? void 0 : i.replace(/[\r\n]/g, ""), d;
153
+ if (e && e.nodeType === Node.ELEMENT_NODE && e.tagName.toUpperCase() === "A") {
154
+ const g = j.generateRandomId();
155
+ c = `${Pe.CUSTOM_RANGE_START}${c}${Pe.CUSTOM_RANGE_END}`, o.customRanges = [
156
+ ...(s = o.customRanges) != null ? s : [],
157
+ {
158
+ startIndex: o.dataStream.length,
159
+ endIndex: o.dataStream.length + c.length - 1,
160
+ rangeId: g,
161
+ rangeType: Kt.HYPERLINK
162
+ }
163
+ ], o.payloads = {
164
+ ...o.payloads,
165
+ [g]: e.href
166
+ };
167
+ }
168
+ e && this._styleCache.has(e) && (d = this._styleCache.get(e)), o.dataStream += c, d && Object.getOwnPropertyNames(d).length && o.textRuns.push({
169
+ st: o.dataStream.length - c.length,
158
170
  ed: o.dataStream.length,
159
- ts: c
171
+ ts: d
160
172
  });
161
173
  } else {
162
- if (vn.includes(s.nodeName.toLowerCase()))
174
+ if (Cn.includes(a.nodeName.toLowerCase()))
163
175
  continue;
164
- if (s.nodeType === Node.ELEMENT_NODE) {
165
- const a = e ? this._styleCache.get(e) : {}, c = this._styleRules.find(({ filter: g }) => Dt(s, g)), d = c ? c.getStyle(s) : ht(s);
166
- this._styleCache.set(s, { ...a, ...d });
167
- const { childNodes: p } = s;
168
- this._process(s, p, o);
169
- const h = this._afterProcessRules.find(
170
- ({ filter: g }) => Dt(s, g)
176
+ if (a.nodeType === Node.ELEMENT_NODE) {
177
+ const c = e ? this._styleCache.get(e) : {}, d = this._styleRules.find(({ filter: l }) => Nt(a, l)), g = d ? d.getStyle(a) : gt(a);
178
+ this._styleCache.set(a, { ...c, ...g });
179
+ const { childNodes: h } = a;
180
+ this._process(a, h, o);
181
+ const p = this._afterProcessRules.find(
182
+ ({ filter: l }) => Nt(a, l)
171
183
  );
172
- h && h.handler(o, s);
184
+ p && p.handler(o, a);
173
185
  }
174
186
  }
175
187
  }
176
188
  };
177
189
  C(Fe, "_pluginList", []);
178
190
  let ce = Fe;
179
- const $o = {
191
+ const Vo = {
180
192
  name: "univer-doc-paste-plugin-lark",
181
193
  checkPasteType(t) {
182
194
  return /lark-record-clipboard/i.test(t);
@@ -186,7 +198,7 @@ const $o = {
186
198
  {
187
199
  filter: ["s"],
188
200
  getStyle(t) {
189
- const e = ht(t);
201
+ const e = gt(t);
190
202
  return {
191
203
  st: {
192
204
  s: S.TRUE
@@ -208,24 +220,24 @@ const $o = {
208
220
  }
209
221
  }
210
222
  ]
211
- }, Ho = $o;
212
- function sn(t) {
223
+ }, jo = Vo;
224
+ function ln(t) {
213
225
  const e = t.style, n = {};
214
226
  for (let o = 0; o < e.length; o++) {
215
- const i = e[o], r = e.getPropertyValue(i);
216
- switch (i) {
227
+ const r = e[o], i = e.getPropertyValue(r);
228
+ switch (r) {
217
229
  case "margin-top": {
218
- const s = Number.parseInt(r);
219
- n.spaceAbove = /pt/.test(r) ? Ct(s) : s;
230
+ const s = Number.parseInt(i);
231
+ n.spaceAbove = { v: /pt/.test(i) ? Tt(s) : s };
220
232
  break;
221
233
  }
222
234
  case "margin-bottom": {
223
- const s = Number.parseInt(r);
224
- n.spaceBelow = /pt/.test(r) ? Ct(s) : s;
235
+ const s = Number.parseInt(i);
236
+ n.spaceBelow = { v: /pt/.test(i) ? Tt(s) : s };
225
237
  break;
226
238
  }
227
239
  case "line-height": {
228
- const s = Number.parseFloat(r);
240
+ const s = Number.parseFloat(i);
229
241
  n.lineSpacing = s;
230
242
  break;
231
243
  }
@@ -233,7 +245,7 @@ function sn(t) {
233
245
  }
234
246
  return Object.getOwnPropertyNames(n).length ? n : null;
235
247
  }
236
- const Vo = {
248
+ const Wo = {
237
249
  name: "univer-doc-paste-plugin-word",
238
250
  checkPasteType(t) {
239
251
  return /word|mso/i.test(t);
@@ -242,7 +254,7 @@ const Vo = {
242
254
  {
243
255
  filter: ["b"],
244
256
  getStyle(t) {
245
- const e = ht(t);
257
+ const e = gt(t);
246
258
  return { bl: S.TRUE, ...e };
247
259
  }
248
260
  }
@@ -256,12 +268,12 @@ const Vo = {
256
268
  t.paragraphs == null && (t.paragraphs = []);
257
269
  const n = {
258
270
  startIndex: t.dataStream.length
259
- }, o = sn(e);
271
+ }, o = ln(e);
260
272
  o && (n.paragraphStyle = o), t.paragraphs.push(n), t.dataStream += "\r";
261
273
  }
262
274
  }
263
275
  ]
264
- }, jo = Vo, Wo = {
276
+ }, ko = Wo, Go = {
265
277
  name: "univer-doc-paste-plugin-univer",
266
278
  checkPasteType(t) {
267
279
  return /UniverNormal/i.test(t);
@@ -276,95 +288,86 @@ const Vo = {
276
288
  t.paragraphs == null && (t.paragraphs = []);
277
289
  const n = {
278
290
  startIndex: t.dataStream.length
279
- }, o = sn(e);
291
+ }, o = ln(e);
280
292
  o && (n.paragraphStyle = o), t.paragraphs.push(n), t.dataStream += "\r";
281
293
  }
282
294
  }
283
295
  ]
284
- }, ko = Wo;
285
- function At(t, e) {
286
- const { st: n, ed: o, ts: i = {} } = e, { ff: r, fs: s, it: a, bl: c, ul: d, st: p, ol: h, bg: g, cl: l, va: f } = i;
296
+ }, zo = Go;
297
+ function Ft(t, e) {
298
+ const { st: n, ed: o, ts: r = {} } = e, { ff: i, fs: s, it: a, bl: c, ul: d, st: g, ol: h, bg: p, cl: l, va: _ } = r;
287
299
  let u = t.slice(n, o);
288
- const _ = [];
289
- return a === S.TRUE && (u = `<i>${u}</i>`), f === ae.SUPERSCRIPT ? u = `<sup>${u}</sup>` : f === ae.SUBSCRIPT && (u = `<sub>${u}</sub>`), (d == null ? void 0 : d.s) === S.TRUE && (u = `<u>${u}</u>`), (p == null ? void 0 : p.s) === S.TRUE && (u = `<s>${u}</s>`), c === S.TRUE && (u = `<strong>${u}</strong>`), r && _.push(`font-family: ${r}`), l && _.push(`color: ${l.rgb}`), s && _.push(`font-size: ${s}pt`), h && _.push("text-decoration: overline"), g && _.push(`background: ${g.rgb}`), _.length ? `<span style="${_.join("; ")};">${u}</span>` : u;
300
+ const f = [];
301
+ return a === S.TRUE && (u = `<i>${u}</i>`), _ === ae.SUPERSCRIPT ? u = `<sup>${u}</sup>` : _ === ae.SUBSCRIPT && (u = `<sub>${u}</sub>`), (d == null ? void 0 : d.s) === S.TRUE && (u = `<u>${u}</u>`), (g == null ? void 0 : g.s) === S.TRUE && (u = `<s>${u}</s>`), c === S.TRUE && (u = `<strong>${u}</strong>`), i && f.push(`font-family: ${i}`), l && f.push(`color: ${l.rgb}`), s && f.push(`font-size: ${s}pt`), h && f.push("text-decoration: overline"), p && f.push(`background: ${p.rgb}`), f.length ? `<span style="${f.join("; ")};">${u}</span>` : u;
290
302
  }
291
- function Xe(t, e, n) {
292
- const { dataStream: o, textRuns: i = [] } = t;
293
- let r = e;
303
+ function Ke(t, e, n) {
304
+ const { dataStream: o, textRuns: r = [] } = t;
305
+ let i = e;
294
306
  const s = [];
295
- for (const a of i) {
307
+ for (const a of r) {
296
308
  const { st: c, ed: d } = a;
297
- Q.hasIntersectionBetweenTwoRanges(e, n, c, d) && (c > r ? (s.push(o.slice(r, c)), s.push(At(o, {
309
+ j.hasIntersectionBetweenTwoRanges(e, n, c, d) && (c > i ? (s.push(o.slice(i, c)), s.push(Ft(o, {
298
310
  ...a,
299
311
  ed: Math.min(d, n)
300
- }))) : s.push(At(o, {
312
+ }))) : s.push(Ft(o, {
301
313
  ...a,
302
- st: r,
314
+ st: i,
303
315
  ed: Math.min(d, n)
304
- }))), r = Math.max(e, Math.min(d, n));
316
+ }))), i = Math.max(e, Math.min(d, n));
305
317
  }
306
- return r !== n && s.push(o.slice(r, n)), s.join("");
318
+ return i !== n && s.push(o.slice(i, n)), s.join("");
307
319
  }
308
- function Ft(t, e = !0) {
320
+ function Ut(t, e = !0) {
309
321
  var n;
310
322
  if (e && ((n = t.paragraphs) != null && n.length)) {
311
- const { dataStream: o, paragraphs: i = [] } = t;
312
- let r = "", s = -1;
313
- for (const a of i) {
314
- const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: p, spaceBelow: h, lineSpacing: g } = d, l = [];
315
- p != null && (typeof p == "number" ? l.push(`margin-top: ${p}px`) : l.push(`margin-top: ${p.v}px`)), h != null && (typeof h == "number" ? l.push(`margin-bottom: ${h}px`) : l.push(`margin-bottom: ${h.v}px`)), g != null && l.push(`line-height: ${g}`), c > s + 1 ? r += `<p class="UniverNormal" ${l.length ? `style="${l.join("; ")};"` : ""}>${Xe(t, s + 1, c)}</p>` : r += `<p class="UniverNormal" ${l.length ? `style="${l.join("; ")};"` : ""}></p>`, s = c;
323
+ const { dataStream: o, paragraphs: r = [] } = t;
324
+ let i = "", s = -1;
325
+ for (const a of r) {
326
+ const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: g, spaceBelow: h, lineSpacing: p } = d, l = [];
327
+ g != null && (typeof g == "number" ? l.push(`margin-top: ${g}px`) : l.push(`margin-top: ${g.v}px`)), h != null && (typeof h == "number" ? l.push(`margin-bottom: ${h}px`) : l.push(`margin-bottom: ${h.v}px`)), p != null && l.push(`line-height: ${p}`), c > s + 1 ? i += `<p class="UniverNormal" ${l.length ? `style="${l.join("; ")};"` : ""}>${Ke(t, s + 1, c)}</p>` : i += `<p class="UniverNormal" ${l.length ? `style="${l.join("; ")};"` : ""}></p>`, s = c;
316
328
  }
317
- return s !== o.length && (r += Xe(t, s, o.length)), r;
329
+ return s !== o.length && (i += Ke(t, s, o.length)), i;
318
330
  } else
319
- return Xe(t, 0, t.dataStream.length);
331
+ return Ke(t, 0, t.dataStream.length);
320
332
  }
321
- class zo {
333
+ class Yo {
322
334
  convert(e) {
323
335
  if (e.length === 0)
324
336
  throw new Error("The bodyList length at least to be 1");
325
337
  if (e.length === 1)
326
- return Ft(e[0]);
338
+ return Ut(e[0]);
327
339
  let n = "";
328
340
  for (const o of e)
329
- n += '<p className="UniverNormal">', n += Ft(o, !1), n += "</p>";
341
+ n += '<p className="UniverNormal">', n += Ut(o, !1), n += "</p>";
330
342
  return n;
331
343
  }
332
344
  }
333
- var Go = Object.defineProperty, Yo = Object.getOwnPropertyDescriptor, Xo = (t, e, n, o) => {
334
- for (var i = o > 1 ? void 0 : o ? Yo(e, n) : e, r = t.length - 1, s; r >= 0; r--)
335
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
336
- return o && i && Go(e, n, i), i;
337
- }, he = (t, e) => (n, o) => e(n, o, t);
338
- ce.use(jo);
339
- ce.use(Ho);
345
+ var Xo = Object.defineProperty, Ko = Object.getOwnPropertyDescriptor, Zo = (t, e, n, o) => {
346
+ for (var r = o > 1 ? void 0 : o ? Ko(e, n) : e, i = t.length - 1, s; i >= 0; i--)
347
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
348
+ return o && r && Xo(e, n, r), r;
349
+ }, re = (t, e) => (n, o) => e(n, o, t);
340
350
  ce.use(ko);
341
- function Ko(t) {
342
- const e = t.replace(/\n/g, "\r"), n = [];
343
- for (let o = 0; o < e.length; o++)
344
- e[o] === "\r" && n.push({ startIndex: o });
345
- return {
346
- dataStream: e,
347
- paragraphs: n
348
- };
349
- }
350
- const Oe = zn("doc.clipboard-service");
351
- let tt = class extends te {
352
- constructor(e, n, o, i, r) {
351
+ ce.use(jo);
352
+ ce.use(zo);
353
+ const Re = En("doc.clipboard-service");
354
+ let nt = class extends Q {
355
+ constructor(e, n, o, r, i, s) {
353
356
  super();
354
357
  C(this, "_clipboardHooks", []);
355
358
  C(this, "_htmlToUDM", new ce());
356
- C(this, "_umdToHtml", new zo());
357
- this._univerInstanceService = e, this._logService = n, this._commandService = o, this._clipboardInterfaceService = i, this._textSelectionManagerService = r;
359
+ C(this, "_umdToHtml", new Yo());
360
+ this._univerInstanceService = e, this._logService = n, this._commandService = o, this._clipboardInterfaceService = r, this._textSelectionManagerService = i, this._docCustomRangeService = s;
358
361
  }
359
- async copy() {
360
- const e = this._getDocumentBodyInRanges();
361
- if (e.length === 0)
362
+ async copy(e = mt.copy) {
363
+ const n = this._getDocumentBodyInRanges(e);
364
+ if (n.length === 0)
362
365
  return !1;
363
366
  try {
364
- const n = this._textSelectionManagerService.getActiveRange(), o = !!(n != null && n.segmentId);
365
- this._setClipboardData(e, !o);
366
- } catch (n) {
367
- return this._logService.error("[DocClipboardService] copy failed", n), !1;
367
+ const o = this._textSelectionManagerService.getActiveRange(), r = !!(o != null && o.segmentId);
368
+ this._setClipboardData(n, !r);
369
+ } catch (o) {
370
+ return this._logService.error("[DocClipboardService] copy failed", o), !1;
368
371
  }
369
372
  return !0;
370
373
  }
@@ -380,20 +383,20 @@ let tt = class extends te {
380
383
  return this._paste(o);
381
384
  }
382
385
  async _cut() {
383
- var r;
386
+ var i;
384
387
  const {
385
388
  segmentId: e,
386
389
  endOffset: n,
387
390
  style: o
388
- } = (r = this._textSelectionManagerService.getActiveRange()) != null ? r : {}, i = this._textSelectionManagerService.getCurrentSelections();
389
- if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), n == null || i == null)
391
+ } = (i = this._textSelectionManagerService.getActiveRange()) != null ? i : {}, r = this._textSelectionManagerService.getCurrentSelections();
392
+ if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), n == null || r == null)
390
393
  return !1;
391
- this.copy();
394
+ this.copy(mt.cut);
392
395
  try {
393
396
  let s = n;
394
- for (const c of i) {
395
- const { startOffset: d, endOffset: p } = c;
396
- d == null || p == null || p <= n && (s -= p - d);
397
+ for (const c of r) {
398
+ const { startOffset: d, endOffset: g } = c;
399
+ d == null || g == null || g <= n && (s -= g - d);
397
400
  }
398
401
  const a = [
399
402
  {
@@ -402,71 +405,75 @@ let tt = class extends te {
402
405
  style: o
403
406
  }
404
407
  ];
405
- return this._commandService.executeCommand(Qt.id, { segmentId: e, textRanges: a });
408
+ return this._commandService.executeCommand(nn.id, { segmentId: e, textRanges: a });
406
409
  } catch {
407
410
  return this._logService.error("[DocClipboardController] cut content failed"), !1;
408
411
  }
409
412
  }
410
413
  async _paste(e) {
411
- let n = Rn(e);
412
- this._clipboardHooks.forEach((c) => {
413
- c.onBeforePaste && (n = c.onBeforePaste(n));
414
- });
415
- const o = this._textSelectionManagerService.getActiveRange(), { segmentId: i, endOffset: r, style: s } = o || {}, a = this._textSelectionManagerService.getCurrentSelections();
416
- if (i == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), r == null || a == null)
414
+ var d, g;
415
+ let n = Tn(e);
416
+ const o = (d = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC)) == null ? void 0 : d.getUnitId();
417
+ if (!o)
418
+ return !1;
419
+ this._clipboardHooks.forEach((h) => {
420
+ h.onBeforePaste && (n = h.onBeforePaste(n));
421
+ }), n.customRanges = (g = n.customRanges) == null ? void 0 : g.map((h) => this._docCustomRangeService.copyCustomRange(o, h));
422
+ const r = this._textSelectionManagerService.getActiveRange(), { segmentId: i, endOffset: s, style: a } = r || {}, c = this._textSelectionManagerService.getCurrentSelections();
423
+ if (i == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), s == null || c == null)
417
424
  return !1;
418
425
  try {
419
- let c = r;
420
- for (const p of a) {
421
- const { startOffset: h, endOffset: g } = p;
422
- h == null || g == null || g <= r && (c += n.dataStream.length - (g - h));
426
+ let h = s;
427
+ for (const l of c) {
428
+ const { startOffset: _, endOffset: u } = l;
429
+ _ == null || u == null || u <= s && (h += n.dataStream.length - (u - _));
423
430
  }
424
- const d = [
431
+ const p = [
425
432
  {
426
- startOffset: c,
427
- endOffset: c,
428
- style: s
433
+ startOffset: h,
434
+ endOffset: h,
435
+ style: a
429
436
  }
430
437
  ];
431
- return this._commandService.executeCommand(en.id, { body: n, segmentId: i, textRanges: d });
438
+ return this._commandService.executeCommand(on.id, { body: n, segmentId: i, textRanges: p });
432
439
  } catch {
433
440
  return this._logService.error("[DocClipboardController]", "clipboard is empty."), !1;
434
441
  }
435
442
  }
436
443
  async _setClipboardData(e, n = !0) {
437
- const o = Uo(), i = e.length > 1 ? e.map((s) => s.dataStream).join(`
444
+ const o = wo(), r = e.length > 1 ? e.map((s) => s.dataStream).join(`
438
445
  `) : e[0].dataStream;
439
- let r = this._umdToHtml.convert(e);
440
- return e.length === 1 && n && (r = r.replace(/(<[a-z]+)/, (s, a) => `${a} data-copy-id="${o}"`), Pt.set(o, e[0])), this._clipboardInterfaceService.write(i, r);
446
+ let i = this._umdToHtml.convert(e);
447
+ return e.length === 1 && n && (i = i.replace(/(<[a-z]+)/, (s, a) => `${a} data-copy-id="${o}"`), At.set(o, e[0])), this._clipboardInterfaceService.write(r, i);
441
448
  }
442
449
  addClipboardHook(e) {
443
- return this._clipboardHooks.push(e), Xt(() => {
450
+ return this._clipboardHooks.push(e), Jt(() => {
444
451
  const n = this._clipboardHooks.indexOf(e);
445
452
  n > -1 && this._clipboardHooks.splice(n, 1);
446
453
  });
447
454
  }
448
- _getDocumentBodyInRanges() {
449
- const e = this._textSelectionManagerService.getCurrentSelections(), n = this._textSelectionManagerService.getActiveRange(), o = this._univerInstanceService.getCurrentUniverDocInstance(), i = [], r = o == null ? void 0 : o.getBody();
450
- if (e == null || o == null || r == null || n == null)
455
+ _getDocumentBodyInRanges(e) {
456
+ const n = this._textSelectionManagerService.getCurrentSelections(), o = this._textSelectionManagerService.getActiveRange(), r = this._univerInstanceService.getCurrentUniverDocInstance(), i = [], s = r == null ? void 0 : r.getBody();
457
+ if (n == null || r == null || s == null || o == null)
451
458
  return i;
452
- const { segmentId: s } = n;
453
- for (const a of e) {
454
- const { startOffset: c, endOffset: d, collapsed: p } = a;
455
- if (p || c == null || d == null)
459
+ const { segmentId: a } = o;
460
+ for (const c of n) {
461
+ const { startOffset: d, endOffset: g, collapsed: h } = c;
462
+ if (h || d == null || g == null)
456
463
  continue;
457
- const h = Yn({ startOffset: c, endOffset: d, collapsed: p }, r), g = o.getSelfOrHeaderFooterModel(s).sliceBody(h.startOffset, h.endOffset);
458
- if (g != null) {
459
- if (g.customRanges) {
460
- const l = [];
461
- g.customRanges.forEach((_) => {
462
- _.startIndex === _.endIndex && l.push(_);
463
- }), g.customRanges = g.customRanges.filter((_) => l.indexOf(_) === -1);
464
- let f = "", u = 0;
465
- l.forEach((_) => {
466
- f += g.dataStream.slice(u, _.endIndex), u = _.endIndex + 1;
467
- }), f += g.dataStream.slice(u, g.dataStream.length), g.dataStream = f;
464
+ const p = Zn({ startOffset: d, endOffset: g, collapsed: h }, s), l = r.getSelfOrHeaderFooterModel(a).sliceBody(p.startOffset, p.endOffset, e);
465
+ if (l != null) {
466
+ if (l.customRanges) {
467
+ const _ = [];
468
+ l.customRanges.forEach((m) => {
469
+ m.startIndex === m.endIndex && _.push(m);
470
+ }), l.customRanges = l.customRanges.filter((m) => _.indexOf(m) === -1);
471
+ let u = "", f = 0;
472
+ _.forEach((m) => {
473
+ u += l.dataStream.slice(f, m.endIndex), f = m.endIndex + 1;
474
+ }), u += l.dataStream.slice(f, l.dataStream.length), l.dataStream = u;
468
475
  }
469
- i.push(g);
476
+ i.push(l);
470
477
  }
471
478
  }
472
479
  return i;
@@ -474,45 +481,72 @@ let tt = class extends te {
474
481
  async _generateBodyFromClipboardItems(e) {
475
482
  try {
476
483
  let n = "", o = "";
477
- for (const i of e)
478
- for (const r of i.types)
479
- r === xn ? o = await i.getType(r).then((s) => s && s.text()) : r === yn && (n = await i.getType(r).then((s) => s && s.text()));
484
+ for (const r of e)
485
+ for (const i of r.types)
486
+ i === Fn ? o = await r.getType(i).then((s) => s && s.text()) : i === Un && (n = await r.getType(i).then((s) => s && s.text()));
480
487
  return this._generateBodyFromHtmlAndText(n, o);
481
488
  } catch (n) {
482
489
  return Promise.reject(n);
483
490
  }
484
491
  }
492
+ _generateBody(e) {
493
+ const n = e.replace(/\n/g, "\r");
494
+ if (!e.includes("\r") && j.isLegalUrl(e)) {
495
+ const r = j.generateRandomId(), i = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC), s = this._docCustomRangeService.copyCustomRange(
496
+ i.getUnitId(),
497
+ {
498
+ startIndex: 0,
499
+ endIndex: n.length - 1,
500
+ rangeId: r,
501
+ rangeType: Kt.HYPERLINK,
502
+ data: e
503
+ }
504
+ );
505
+ return {
506
+ dataStream: `${Pe.CUSTOM_RANGE_START}${n}${Pe.CUSTOM_RANGE_END}`,
507
+ customRanges: [s]
508
+ };
509
+ }
510
+ const o = [];
511
+ for (let r = 0; r < n.length; r++)
512
+ n[r] === "\r" && o.push({ startIndex: r });
513
+ return {
514
+ dataStream: n,
515
+ paragraphs: o
516
+ };
517
+ }
485
518
  _generateBodyFromHtmlAndText(e, n) {
486
519
  if (!e) {
487
520
  if (n)
488
- return Ko(n);
521
+ return this._generateBody(n);
489
522
  throw new Error("[DocClipboardService] html and text cannot be both empty!");
490
523
  }
491
- const o = Lo(e);
524
+ const o = Bo(e);
492
525
  if (o) {
493
- const i = Pt.get(o);
494
- if (i)
495
- return i;
526
+ const r = At.get(o);
527
+ if (r)
528
+ return r;
496
529
  }
497
530
  return this._htmlToUDM.convert(e);
498
531
  }
499
532
  };
500
- tt = Xo([
501
- he(0, U),
502
- he(1, Yt),
503
- he(2, O),
504
- he(3, dt),
505
- he(4, T(ne))
506
- ], tt);
507
- var Zo = Object.defineProperty, Jo = Object.getOwnPropertyDescriptor, qo = (t, e, n, o) => {
508
- for (var i = o > 1 ? void 0 : o ? Jo(e, n) : e, r = t.length - 1, s; r >= 0; r--)
509
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
510
- return o && i && Zo(e, n, i), i;
511
- }, Ce = (t, e) => (n, o) => e(n, o, t);
512
- const Nt = 1.5;
513
- let nt = class extends ve {
514
- constructor(t, e, n, o, i) {
515
- super(), this._context = t, this._textSelectionManagerService = e, this._editorService = n, this._univerInstanceService = o, this._renderManagerService = i, this._init();
533
+ nt = Zo([
534
+ re(0, w),
535
+ re(1, Zt),
536
+ re(2, O),
537
+ re(3, ut),
538
+ re(4, E(te)),
539
+ re(5, E(Kn))
540
+ ], nt);
541
+ var Jo = Object.defineProperty, qo = Object.getOwnPropertyDescriptor, Qo = (t, e, n, o) => {
542
+ for (var r = o > 1 ? void 0 : o ? qo(e, n) : e, i = t.length - 1, s; i >= 0; i--)
543
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
544
+ return o && r && Jo(e, n, r), r;
545
+ }, Oe = (t, e) => (n, o) => e(n, o, t);
546
+ const Lt = 1.5;
547
+ let ot = class extends Se {
548
+ constructor(t, e, n, o, r) {
549
+ super(), this._context = t, this._textSelectionManagerService = e, this._editorService = n, this._univerInstanceService = o, this._renderManagerService = r, this._init();
516
550
  }
517
551
  _init() {
518
552
  this._textSelectionManagerService.textSelection$.pipe(se(this.dispose$)).subscribe((t) => {
@@ -524,31 +558,31 @@ let nt = class extends ve {
524
558
  }
525
559
  scrollToRange(t, e) {
526
560
  var s;
527
- const n = (s = this._renderManagerService.getRenderById(t)) == null ? void 0 : s.with(w), o = n == null ? void 0 : n.getSkeleton();
561
+ const n = (s = this._renderManagerService.getRenderById(t)) == null ? void 0 : s.with(L), o = n == null ? void 0 : n.getSkeleton();
528
562
  if (!o)
529
563
  return;
530
- const { startOffset: i } = e, r = o.findNodePositionByCharIndex(i);
531
- this.scrollToNode(t, r);
564
+ const { startOffset: r } = e, i = o.findNodePositionByCharIndex(r);
565
+ this.scrollToNode(t, i);
532
566
  }
533
567
  scrollToNode(t, e) {
534
- var k;
535
- const n = this._getDocObject(), o = (k = this._renderManagerService.getRenderById(t)) == null ? void 0 : k.with(w), i = o == null ? void 0 : o.getSkeleton();
536
- if (n == null || i == null)
568
+ var G;
569
+ const n = this._getDocObject(), o = (G = this._renderManagerService.getRenderById(t)) == null ? void 0 : G.with(L), r = o == null ? void 0 : o.getSkeleton();
570
+ if (n == null || r == null)
537
571
  return;
538
- const r = n.document.getOffsetConfig(), { docsLeft: s, docsTop: a } = r, c = new tn(r, i), { contentBoxPointGroup: d } = c.getRangePointData(e, e), { left: p, top: h, height: g } = vo(d), l = p + s, f = h + a, u = n.scene.getViewport(ee.VIEW_MAIN), _ = !!this._editorService.getEditor(t);
572
+ const i = n.document.getOffsetConfig(), { docsLeft: s, docsTop: a } = i, c = new rn(i, r), { contentBoxPointGroup: d } = c.getRangePointData(e, e), { left: g, top: h, height: p } = Co(d), l = g + s, _ = h + a, u = n.scene.getViewport(q.VIEW_MAIN), f = !!this._editorService.getEditor(t);
539
573
  if (u == null)
540
574
  return;
541
575
  const {
542
576
  left: m,
543
577
  top: R,
544
- right: b,
545
- bottom: M
578
+ right: I,
579
+ bottom: b
546
580
  } = u.getBounding().viewBound;
547
- let E = 0, A = 0;
548
- const F = _ ? 0 : 100;
549
- f < R ? E = f - R - F : f > M - g && (E = f - M + g + F), l < m ? A = l - m : l > b - Nt && (A = l - b + Nt);
550
- const G = u.transViewportScroll2ScrollValue(A, E);
551
- u.scrollBy(G);
581
+ let T = 0, A = 0;
582
+ const N = f ? 0 : 100;
583
+ _ < R ? T = _ - R - N : _ > b - p && (T = _ - b + p + N), l < m ? A = l - m : l > I - Lt && (A = l - I + Lt);
584
+ const Y = u.transViewportScroll2ScrollValue(A, T);
585
+ u.scrollBy(Y);
552
586
  }
553
587
  // Let the selection show on the current screen.
554
588
  _scrollToSelection(t) {
@@ -559,16 +593,16 @@ let nt = class extends ve {
559
593
  n && this.scrollToNode(t, o);
560
594
  }
561
595
  _getDocObject() {
562
- return Xn(this._univerInstanceService, this._renderManagerService);
596
+ return Jn(this._univerInstanceService, this._renderManagerService);
563
597
  }
564
598
  };
565
- nt = qo([
566
- Ce(1, T(ne)),
567
- Ce(2, K),
568
- Ce(3, T(U)),
569
- Ce(4, j)
570
- ], nt);
571
- const Qo = {
599
+ ot = Qo([
600
+ Oe(1, E(te)),
601
+ Oe(2, ee),
602
+ Oe(3, E(w)),
603
+ Oe(4, W)
604
+ ], ot);
605
+ const er = {
572
606
  undo: !0,
573
607
  redo: !0,
574
608
  // Undo redo
@@ -596,7 +630,7 @@ const Qo = {
596
630
  // 'Wrap mode'
597
631
  textRotateMode: !0
598
632
  // 'Text Rotation Mode'
599
- }, ei = {
633
+ }, tr = {
600
634
  outerLeft: !1,
601
635
  outerRight: !1,
602
636
  header: !0,
@@ -609,78 +643,78 @@ const Qo = {
609
643
  frozenContent: !1,
610
644
  infoBar: !0,
611
645
  toolbar: !0
612
- }, ti = {
646
+ }, nr = {
613
647
  layout: {
614
- docContainerConfig: ei,
615
- toolbarConfig: Qo
648
+ docContainerConfig: tr,
649
+ toolbarConfig: er
616
650
  }
617
- }, ni = "DocUI", oi = {
618
- id: $e.id,
651
+ }, or = "DocUI", rr = {
652
+ id: He.id,
619
653
  binding: H.ARROW_UP,
620
- preconditions: W,
654
+ preconditions: k,
621
655
  staticParameters: {
622
- direction: X.UP
656
+ direction: K.UP
623
657
  }
624
- }, ii = {
625
- id: $e.id,
658
+ }, ir = {
659
+ id: He.id,
626
660
  binding: H.ARROW_DOWN,
627
- preconditions: W,
661
+ preconditions: k,
628
662
  staticParameters: {
629
- direction: X.DOWN
663
+ direction: K.DOWN
630
664
  }
631
- }, ri = {
632
- id: $e.id,
665
+ }, sr = {
666
+ id: He.id,
633
667
  binding: H.ARROW_LEFT,
634
- preconditions: W,
668
+ preconditions: k,
635
669
  staticParameters: {
636
- direction: X.LEFT
670
+ direction: K.LEFT
637
671
  }
638
- }, si = {
639
- id: $e.id,
672
+ }, ar = {
673
+ id: He.id,
640
674
  binding: H.ARROW_RIGHT,
641
- preconditions: W,
675
+ preconditions: k,
642
676
  staticParameters: {
643
- direction: X.RIGHT
677
+ direction: K.RIGHT
644
678
  }
645
- }, ai = {
646
- id: He.id,
647
- binding: H.ARROW_UP | Re.SHIFT,
648
- preconditions: W,
679
+ }, cr = {
680
+ id: Ve.id,
681
+ binding: H.ARROW_UP | ve.SHIFT,
682
+ preconditions: k,
649
683
  staticParameters: {
650
- direction: X.UP
684
+ direction: K.UP
651
685
  }
652
- }, ci = {
653
- id: He.id,
654
- binding: H.ARROW_DOWN | Re.SHIFT,
655
- preconditions: W,
686
+ }, lr = {
687
+ id: Ve.id,
688
+ binding: H.ARROW_DOWN | ve.SHIFT,
689
+ preconditions: k,
656
690
  staticParameters: {
657
- direction: X.DOWN
691
+ direction: K.DOWN
658
692
  }
659
- }, li = {
660
- id: He.id,
661
- binding: H.ARROW_LEFT | Re.SHIFT,
662
- preconditions: W,
693
+ }, dr = {
694
+ id: Ve.id,
695
+ binding: H.ARROW_LEFT | ve.SHIFT,
696
+ preconditions: k,
663
697
  staticParameters: {
664
- direction: X.LEFT
698
+ direction: K.LEFT
665
699
  }
666
- }, di = {
667
- id: He.id,
668
- binding: H.ARROW_RIGHT | Re.SHIFT,
669
- preconditions: W,
700
+ }, ur = {
701
+ id: Ve.id,
702
+ binding: H.ARROW_RIGHT | ve.SHIFT,
703
+ preconditions: k,
670
704
  staticParameters: {
671
- direction: X.RIGHT
705
+ direction: K.RIGHT
672
706
  }
673
- }, ui = {
674
- id: Kn.id,
675
- binding: H.A | Re.CTRL_COMMAND,
676
- preconditions: (t) => t.getContextValue(lt) && (t.getContextValue(Ne) || t.getContextValue(Kt))
707
+ }, hr = {
708
+ id: qn.id,
709
+ binding: H.A | ve.CTRL_COMMAND,
710
+ preconditions: (t) => t.getContextValue(dt) && (t.getContextValue(Ue) || t.getContextValue(qt))
677
711
  };
678
- var hi = Object.defineProperty, gi = Object.getOwnPropertyDescriptor, pi = (t, e, n, o) => {
679
- for (var i = o > 1 ? void 0 : o ? gi(e, n) : e, r = t.length - 1, s; r >= 0; r--)
680
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
681
- return o && i && hi(e, n, i), i;
682
- }, Ut = (t, e) => (n, o) => e(n, o, t);
683
- let ot = class {
712
+ var gr = Object.defineProperty, pr = Object.getOwnPropertyDescriptor, _r = (t, e, n, o) => {
713
+ for (var r = o > 1 ? void 0 : o ? pr(e, n) : e, i = t.length - 1, s; i >= 0; i--)
714
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
715
+ return o && r && gr(e, n, r), r;
716
+ }, wt = (t, e) => (n, o) => e(n, o, t);
717
+ let rt = class {
684
718
  constructor(t, e, n) {
685
719
  C(this, "_docContainer");
686
720
  // 获取SheetContainer组件
@@ -719,17 +753,17 @@ let ot = class {
719
753
  return this._docContainer;
720
754
  }
721
755
  };
722
- ot = pi([
723
- Ut(1, T(le)),
724
- Ut(2, T(Be))
725
- ], ot);
726
- var fi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, mi = (t, e, n, o) => {
727
- for (var i = o > 1 ? void 0 : o ? _i(e, n) : e, r = t.length - 1, s; r >= 0; r--)
728
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
729
- return o && i && fi(e, n, i), i;
730
- }, Ee = (t, e) => (n, o) => e(n, o, t);
731
- let me = class extends ve {
732
- constructor(e, n, o, i, r) {
756
+ rt = _r([
757
+ wt(1, E(le)),
758
+ wt(2, E(Le))
759
+ ], rt);
760
+ var fr = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, Sr = (t, e, n, o) => {
761
+ for (var r = o > 1 ? void 0 : o ? mr(e, n) : e, i = t.length - 1, s; i >= 0; i--)
762
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
763
+ return o && r && fr(e, n, r), r;
764
+ }, Ce = (t, e) => (n, o) => e(n, o, t);
765
+ let fe = class extends Se {
766
+ constructor(e, n, o, r, i) {
733
767
  super();
734
768
  C(this, "_docContainerController");
735
769
  /**
@@ -742,7 +776,7 @@ let me = class extends ve {
742
776
  C(this, "changeLocale", (e) => {
743
777
  this._localeService.setLocale(e);
744
778
  });
745
- this._localeService = n, this._injector = o, this._textSelectionRenderManager = i, this._layoutService = r, this._docContainerController = this._injector.createInstance(ot, e), this._registerContainer();
779
+ this._localeService = n, this._injector = o, this._textSelectionRenderManager = r, this._layoutService = i, this._docContainerController = this._injector.createInstance(rt, e), this._registerContainer();
746
780
  }
747
781
  _registerContainer() {
748
782
  this._layoutService && this.disposeWithMe(
@@ -754,46 +788,20 @@ let me = class extends ve {
754
788
  return this._docContainerController;
755
789
  }
756
790
  };
757
- me = mi([
758
- Ee(1, T(le)),
759
- Ee(2, T(Be)),
760
- Ee(3, oe),
761
- Ee(4, Gn(Jt))
762
- ], me);
763
- const je = "UI_PLUGIN_DOCS", gt = `${je}_COLOR_PICKER_COMPONENT`, an = `${je}_FONT_FAMILY_COMPONENT`, cn = `${je}_FONT_FAMILY_ITEM_COMPONENT`, ln = `${je}_FONT_SIZE_COMPONENT`;
764
- var dn = { exports: {} }, We = {};
765
- /**
766
- * @license React
767
- * react-jsx-runtime.production.min.js
768
- *
769
- * Copyright (c) Facebook, Inc. and its affiliates.
770
- *
771
- * This source code is licensed under the MIT license found in the
772
- * LICENSE file in the root directory of this source tree.
773
- */
774
- var Si = xo, vi = Symbol.for("react.element"), Ri = Symbol.for("react.fragment"), Oi = Object.prototype.hasOwnProperty, Ci = Si.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Ei = { key: !0, ref: !0, __self: !0, __source: !0 };
775
- function un(t, e, n) {
776
- var o, i = {}, r = null, s = null;
777
- n !== void 0 && (r = "" + n), e.key !== void 0 && (r = "" + e.key), e.ref !== void 0 && (s = e.ref);
778
- for (o in e) Oi.call(e, o) && !Ei.hasOwnProperty(o) && (i[o] = e[o]);
779
- if (t && t.defaultProps) for (o in e = t.defaultProps, e) i[o] === void 0 && (i[o] = e[o]);
780
- return { $$typeof: vi, type: t, key: r, ref: s, props: i, _owner: Ci.current };
791
+ fe = Sr([
792
+ Ce(1, E(le)),
793
+ Ce(2, E(Le)),
794
+ Ce(3, ne),
795
+ Ce(4, In(en))
796
+ ], fe);
797
+ const We = "UI_PLUGIN_DOCS", pt = `${We}_COLOR_PICKER_COMPONENT`, dn = `${We}_FONT_FAMILY_COMPONENT`, un = `${We}_FONT_FAMILY_ITEM_COMPONENT`, hn = `${We}_FONT_SIZE_COMPONENT`, Bt = 18, $t = 200, Ze = 6, vr = 4;
798
+ function Rr(t, e) {
799
+ let { radius: n, width: o, height: r } = e;
800
+ n = n != null ? n : 0, o = o != null ? o : 30, r = r != null ? r : 30;
801
+ let i = 0;
802
+ i = Math.min(n, o / 2, r / 2), t.beginPath(), t.moveTo(0, 0), t.lineTo(o, 0), t.lineTo(o, r - i), t.arc(o - i, r - i, i, 0, Math.PI / 2, !1), t.lineTo(0, r), t.lineTo(0, 0), t.closePath(), e.fill && (t.save(), t.fillStyle = e.fill, e.fillRule === "evenodd" ? t.fill("evenodd") : t.fill(), t.restore());
781
803
  }
782
- We.Fragment = Ri;
783
- We.jsx = un;
784
- We.jsxs = un;
785
- dn.exports = We;
786
- var I = dn.exports;
787
- const Ii = "univer-docs-ui-canvas-background", Ti = {
788
- docsUiCanvasBackground: Ii
789
- }, bi = () => /* @__PURE__ */ I.jsx("div", { className: Ti.docsUiCanvasBackground }), Lt = 18, wt = 200, Ke = 6, Mi = 4;
790
- function xi(t, e) {
791
- let { radius: n, width: o, height: i } = e;
792
- n = n != null ? n : 0, o = o != null ? o : 30, i = i != null ? i : 30;
793
- let r = 0;
794
- r = Math.min(n, o / 2, i / 2), t.beginPath(), t.moveTo(0, 0), t.lineTo(o, 0), t.lineTo(o, i - r), t.arc(o - r, i - r, r, 0, Math.PI / 2, !1), t.lineTo(0, i), t.lineTo(0, 0), t.closePath(), e.fill && (t.save(), t.fillStyle = e.fill, e.fillRule === "evenodd" ? t.fill("evenodd") : t.fill(), t.restore());
795
- }
796
- class Ae extends Ro {
804
+ class Ne extends Eo {
797
805
  constructor(n, o) {
798
806
  super(n, o);
799
807
  C(this, "color");
@@ -801,26 +809,26 @@ class Ae extends Ro {
801
809
  this.color = o == null ? void 0 : o.color, this.text = o == null ? void 0 : o.text;
802
810
  }
803
811
  static drawWith(n, o) {
804
- const { text: i, color: r } = o;
812
+ const { text: r, color: i } = o;
805
813
  n.save(), n.font = "13px Source Han Sans CN";
806
- const s = n.measureText(i).width, a = Math.min(
807
- s + 2 * Ke,
808
- wt
814
+ const s = n.measureText(r).width, a = Math.min(
815
+ s + 2 * Ze,
816
+ $t
809
817
  );
810
- xi(n, {
811
- height: Lt,
818
+ Rr(n, {
819
+ height: Bt,
812
820
  width: a,
813
821
  radius: 4,
814
- fill: r,
822
+ fill: i,
815
823
  evented: !1
816
824
  }), n.fillStyle = "rgba(58, 96, 247, 1)";
817
- const c = Ke, d = Lt - Mi, p = wt - 2 * Ke;
818
- if (s > p) {
819
- let h = "", g = 0;
820
- for (const l of i) {
821
- const f = n.measureText(l).width;
822
- if (g + f <= p - n.measureText("...").width)
823
- h += l, g += f;
825
+ const c = Ze, d = Bt - vr, g = $t - 2 * Ze;
826
+ if (s > g) {
827
+ let h = "", p = 0;
828
+ for (const l of r) {
829
+ const _ = n.measureText(l).width;
830
+ if (p + _ <= g - n.measureText("...").width)
831
+ h += l, p += _;
824
832
  else {
825
833
  h += "...";
826
834
  break;
@@ -828,103 +836,127 @@ class Ae extends Ro {
828
836
  }
829
837
  n.fillText(h, c, d);
830
838
  } else
831
- n.fillText(i, c, d);
839
+ n.fillText(r, c, d);
832
840
  n.restore();
833
841
  }
834
842
  _draw(n) {
835
- Ae.drawWith(n, this);
843
+ Ne.drawWith(n, this);
836
844
  }
837
845
  }
838
- const hn = "COMPONENT_DOC_HEADER_FOOTER_PANEL", yi = "univer-panel", Pi = "univer-options-section", Di = "univer-options-form-item", Ai = "univer-options-input", Fi = "univer-options-margin-setting", $ = {
839
- panel: yi,
840
- optionsSection: Pi,
841
- optionsFormItem: Di,
842
- optionsInput: Ai,
843
- optionsMarginSetting: Fi
844
- }, Ni = (t) => {
845
- const e = z(le), n = z(U), o = z(j), i = z(O), r = z(oe), s = z(ne), { unitId: a } = t, [c, d] = on({}), p = (l, f) => {
846
- var F;
847
- d((G) => ({
848
- ...G,
849
- [f]: l ? S.TRUE : S.FALSE
846
+ const gn = "COMPONENT_DOC_HEADER_FOOTER_PANEL";
847
+ var pn = { exports: {} }, ke = {};
848
+ /**
849
+ * @license React
850
+ * react-jsx-runtime.production.min.js
851
+ *
852
+ * Copyright (c) Facebook, Inc. and its affiliates.
853
+ *
854
+ * This source code is licensed under the MIT license found in the
855
+ * LICENSE file in the root directory of this source tree.
856
+ */
857
+ var Or = Po, Cr = Symbol.for("react.element"), Er = Symbol.for("react.fragment"), Tr = Object.prototype.hasOwnProperty, Ir = Or.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, br = { key: !0, ref: !0, __self: !0, __source: !0 };
858
+ function _n(t, e, n) {
859
+ var o, r = {}, i = null, s = null;
860
+ n !== void 0 && (i = "" + n), e.key !== void 0 && (i = "" + e.key), e.ref !== void 0 && (s = e.ref);
861
+ for (o in e) Tr.call(e, o) && !br.hasOwnProperty(o) && (r[o] = e[o]);
862
+ if (t && t.defaultProps) for (o in e = t.defaultProps, e) r[o] === void 0 && (r[o] = e[o]);
863
+ return { $$typeof: Cr, type: t, key: i, ref: s, props: r, _owner: Ir.current };
864
+ }
865
+ ke.Fragment = Er;
866
+ ke.jsx = _n;
867
+ ke.jsxs = _n;
868
+ pn.exports = ke;
869
+ var M = pn.exports;
870
+ const Mr = "univer-panel", yr = "univer-options-section", xr = "univer-options-form-item", Pr = "univer-options-input", Dr = "univer-options-margin-setting", $ = {
871
+ panel: Mr,
872
+ optionsSection: yr,
873
+ optionsFormItem: xr,
874
+ optionsInput: Pr,
875
+ optionsMarginSetting: Dr
876
+ }, Ar = (t) => {
877
+ const e = z(le), n = z(w), o = z(W), r = z(O), i = z(ne), s = z(te), { unitId: a } = t, [c, d] = an({}), g = (l, _) => {
878
+ var N;
879
+ d((Y) => ({
880
+ ...Y,
881
+ [_]: l ? S.TRUE : S.FALSE
850
882
  }));
851
- const u = n.getUniverDocInstance(a), _ = u == null ? void 0 : u.getSnapshot().documentStyle, m = (F = o.getRenderById(a)) == null ? void 0 : F.with(w), R = m == null ? void 0 : m.getViewModel();
852
- if (_ == null || R == null)
883
+ const u = n.getUniverDocInstance(a), f = u == null ? void 0 : u.getSnapshot().documentStyle, m = (N = o.getRenderById(a)) == null ? void 0 : N.with(L), R = m == null ? void 0 : m.getViewModel();
884
+ if (f == null || R == null)
853
885
  return;
854
- const b = R.getEditArea();
855
- let M = !1;
856
- const E = r.getSegmentPage();
886
+ const I = R.getEditArea();
887
+ let b = !1;
888
+ const T = i.getSegmentPage();
857
889
  let A = !1;
858
- if (f === "useFirstPageHeaderFooter" && l === !0 && ((b === N.HEADER && !_.firstPageHeaderId || b === N.FOOTER && !_.firstPageFooterId) && (M = !0), M && E === 0 && (A = !0)), f === "evenAndOddHeaders" && l === !0 && ((b === N.HEADER && !_.evenPageHeaderId || b === N.FOOTER && !_.evenPageFooterId) && (M = !0), M && E % 2 === 1 && (A = !0)), M) {
859
- const k = Q.generateRandomId(6);
860
- A && r.setSegment(k), i.executeCommand(be, {
890
+ if (_ === "useFirstPageHeaderFooter" && l === !0 && ((I === F.HEADER && !f.firstPageHeaderId || I === F.FOOTER && !f.firstPageFooterId) && (b = !0), b && T === 0 && (A = !0)), _ === "evenAndOddHeaders" && l === !0 && ((I === F.HEADER && !f.evenPageHeaderId || I === F.FOOTER && !f.evenPageFooterId) && (b = !0), b && T % 2 === 1 && (A = !0)), b) {
891
+ const G = j.generateRandomId(6);
892
+ A && i.setSegment(G), r.executeCommand(be, {
861
893
  unitId: a,
862
- segmentId: k,
894
+ segmentId: G,
863
895
  headerFooterProps: {
864
- [f]: l ? S.TRUE : S.FALSE
896
+ [_]: l ? S.TRUE : S.FALSE
865
897
  }
866
898
  });
867
899
  } else
868
- i.executeCommand(be, {
900
+ r.executeCommand(be, {
869
901
  unitId: a,
870
902
  headerFooterProps: {
871
- [f]: l ? S.TRUE : S.FALSE
903
+ [_]: l ? S.TRUE : S.FALSE
872
904
  }
873
905
  });
874
- }, h = async (l, f) => {
906
+ }, h = async (l, _) => {
875
907
  d((u) => ({
876
908
  ...u,
877
- [f]: l
878
- })), await i.executeCommand(be, {
909
+ [_]: l
910
+ })), await r.executeCommand(be, {
879
911
  unitId: a,
880
912
  headerFooterProps: {
881
- [f]: l
913
+ [_]: l
882
914
  }
883
- }), r.removeAllTextRanges(), r.blur();
884
- }, g = () => {
915
+ }), i.removeAllTextRanges(), i.blur();
916
+ }, p = () => {
885
917
  var m, R;
886
- const l = (m = o.getRenderById(a)) == null ? void 0 : m.with(w), f = l == null ? void 0 : l.getSkeleton(), u = l == null ? void 0 : l.getViewModel(), _ = o.getRenderById(a);
887
- _ == null || u == null || f == null || (s.replaceTextRanges([]), r.setSegment(""), r.setSegmentPage(-1), u.setEditArea(N.BODY), f.calculate(), (R = _.mainComponent) == null || R.makeDirty(!0));
918
+ const l = (m = o.getRenderById(a)) == null ? void 0 : m.with(L), _ = l == null ? void 0 : l.getSkeleton(), u = l == null ? void 0 : l.getViewModel(), f = o.getRenderById(a);
919
+ f == null || u == null || _ == null || (s.replaceTextRanges([]), i.setSegment(""), i.setSegmentPage(-1), u.setEditArea(F.BODY), _.calculate(), (R = f.mainComponent) == null || R.makeDirty(!0));
888
920
  };
889
- return rn(() => {
890
- const l = n.getUniverDocInstance(a), f = l == null ? void 0 : l.getSnapshot().documentStyle;
891
- if (f) {
892
- const { marginHeader: u, marginFooter: _, useFirstPageHeaderFooter: m, evenAndOddHeaders: R } = f;
921
+ return cn(() => {
922
+ const l = n.getUniverDocInstance(a), _ = l == null ? void 0 : l.getSnapshot().documentStyle;
923
+ if (_) {
924
+ const { marginHeader: u, marginFooter: f, useFirstPageHeaderFooter: m, evenAndOddHeaders: R } = _;
893
925
  d({
894
926
  marginHeader: u,
895
- marginFooter: _,
927
+ marginFooter: f,
896
928
  useFirstPageHeaderFooter: m,
897
929
  evenAndOddHeaders: R
898
930
  });
899
931
  }
900
- }, [a]), /* @__PURE__ */ I.jsxs("div", { className: $.options, children: [
901
- /* @__PURE__ */ I.jsxs("div", { className: $.optionsSection, children: [
902
- /* @__PURE__ */ I.jsx("div", { className: $.optionsFormItem, children: /* @__PURE__ */ I.jsx(
903
- xt,
932
+ }, [a]), /* @__PURE__ */ M.jsxs("div", { className: $.options, children: [
933
+ /* @__PURE__ */ M.jsxs("div", { className: $.optionsSection, children: [
934
+ /* @__PURE__ */ M.jsx("div", { className: $.optionsFormItem, children: /* @__PURE__ */ M.jsx(
935
+ Pt,
904
936
  {
905
937
  checked: c.useFirstPageHeaderFooter === S.TRUE,
906
938
  onChange: (l) => {
907
- p(l, "useFirstPageHeaderFooter");
939
+ g(l, "useFirstPageHeaderFooter");
908
940
  },
909
941
  children: e.t("headerFooter.firstPageCheckBox")
910
942
  }
911
943
  ) }),
912
- /* @__PURE__ */ I.jsx("div", { className: $.optionsFormItem, children: /* @__PURE__ */ I.jsx(
913
- xt,
944
+ /* @__PURE__ */ M.jsx("div", { className: $.optionsFormItem, children: /* @__PURE__ */ M.jsx(
945
+ Pt,
914
946
  {
915
947
  checked: c.evenAndOddHeaders === S.TRUE,
916
948
  onChange: (l) => {
917
- p(l, "evenAndOddHeaders");
949
+ g(l, "evenAndOddHeaders");
918
950
  },
919
951
  children: e.t("headerFooter.oddEvenCheckBox")
920
952
  }
921
953
  ) })
922
954
  ] }),
923
- /* @__PURE__ */ I.jsxs("div", { className: Do($.optionsSection, $.optionsMarginSetting), children: [
924
- /* @__PURE__ */ I.jsxs("div", { className: $.optionsMarginItem, children: [
925
- /* @__PURE__ */ I.jsx("span", { children: e.t("headerFooter.headerTopMargin") }),
926
- /* @__PURE__ */ I.jsx(
927
- yt,
955
+ /* @__PURE__ */ M.jsxs("div", { className: No($.optionsSection, $.optionsMarginSetting), children: [
956
+ /* @__PURE__ */ M.jsxs("div", { className: $.optionsMarginItem, children: [
957
+ /* @__PURE__ */ M.jsx("span", { children: e.t("headerFooter.headerTopMargin") }),
958
+ /* @__PURE__ */ M.jsx(
959
+ Dt,
928
960
  {
929
961
  min: 0,
930
962
  max: 200,
@@ -937,10 +969,10 @@ const hn = "COMPONENT_DOC_HEADER_FOOTER_PANEL", yi = "univer-panel", Pi = "unive
937
969
  }
938
970
  )
939
971
  ] }),
940
- /* @__PURE__ */ I.jsxs("div", { className: $.optionsMarginItem, children: [
941
- /* @__PURE__ */ I.jsx("span", { children: e.t("headerFooter.footerBottomMargin") }),
942
- /* @__PURE__ */ I.jsx(
943
- yt,
972
+ /* @__PURE__ */ M.jsxs("div", { className: $.optionsMarginItem, children: [
973
+ /* @__PURE__ */ M.jsx("span", { children: e.t("headerFooter.footerBottomMargin") }),
974
+ /* @__PURE__ */ M.jsx(
975
+ Dt,
944
976
  {
945
977
  min: 0,
946
978
  max: 200,
@@ -954,31 +986,31 @@ const hn = "COMPONENT_DOC_HEADER_FOOTER_PANEL", yi = "univer-panel", Pi = "unive
954
986
  )
955
987
  ] })
956
988
  ] }),
957
- /* @__PURE__ */ I.jsx("div", { className: $.optionsSection, children: /* @__PURE__ */ I.jsx(yo, { onClick: g, children: e.t("headerFooter.closeHeaderFooter") }) })
989
+ /* @__PURE__ */ M.jsx("div", { className: $.optionsSection, children: /* @__PURE__ */ M.jsx(Do, { onClick: p, children: e.t("headerFooter.closeHeaderFooter") }) })
958
990
  ] });
959
- }, Ui = () => {
991
+ }, Nr = () => {
960
992
  var d;
961
- const t = z(le), e = z(j), i = z(U).getCurrentUniverDocInstance().getUnitId(), s = ((d = e.getRenderById(i)) == null ? void 0 : d.with(w)).getViewModel(), [a, c] = on(!0);
962
- return rn(() => {
963
- const p = s.getEditArea();
964
- c(p !== N.BODY);
965
- const h = s.editAreaChange$.subscribe((g) => {
966
- g != null && c(g !== N.BODY);
993
+ const t = z(le), e = z(W), r = z(w).getCurrentUniverDocInstance().getUnitId(), s = ((d = e.getRenderById(r)) == null ? void 0 : d.with(L)).getViewModel(), [a, c] = an(!0);
994
+ return cn(() => {
995
+ const g = s.getEditArea();
996
+ c(g !== F.BODY);
997
+ const h = s.editAreaChange$.subscribe((p) => {
998
+ p != null && c(p !== F.BODY);
967
999
  });
968
1000
  return () => {
969
1001
  h.unsubscribe();
970
1002
  };
971
- }, []), /* @__PURE__ */ I.jsx("div", { className: $.panel, children: a ? /* @__PURE__ */ I.jsx(Ni, { unitId: i }) : /* @__PURE__ */ I.jsx("div", { className: $.panelDisableText, children: t.t("headerFooter.disableText") }) });
972
- }, gn = {
1003
+ }, []), /* @__PURE__ */ M.jsx("div", { className: $.panel, children: a ? /* @__PURE__ */ M.jsx(Ar, { unitId: r }) : /* @__PURE__ */ M.jsx("div", { className: $.panelDisableText, children: t.t("headerFooter.disableText") }) });
1004
+ }, fn = {
973
1005
  id: "sidebar.operation.doc-header-footer-panel",
974
1006
  type: de.COMMAND,
975
1007
  handler: async (t, e) => {
976
- const n = t.get(Pn), o = t.get(le);
1008
+ const n = t.get(Ln), o = t.get(le);
977
1009
  switch (e.value) {
978
1010
  case "open":
979
1011
  n.open({
980
1012
  header: { title: o.t("headerFooter.panel") },
981
- children: { label: hn },
1013
+ children: { label: gn },
982
1014
  onClose: () => {
983
1015
  },
984
1016
  width: 400
@@ -992,54 +1024,54 @@ const hn = "COMPONENT_DOC_HEADER_FOOTER_PANEL", yi = "univer-panel", Pi = "unive
992
1024
  return !0;
993
1025
  }
994
1026
  };
995
- var Li = Object.defineProperty, wi = Object.getOwnPropertyDescriptor, Bi = (t, e, n, o) => {
996
- for (var i = o > 1 ? void 0 : o ? wi(e, n) : e, r = t.length - 1, s; r >= 0; r--)
997
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
998
- return o && i && Li(e, n, i), i;
999
- }, Y = (t, e) => (n, o) => e(n, o, t);
1000
- const Bt = "rgba(58, 96, 247, 1)", $t = "rgba(58, 96, 247, 0.08)";
1001
- var L = /* @__PURE__ */ ((t) => (t[t.FIRST_PAGE_HEADER = 0] = "FIRST_PAGE_HEADER", t[t.FIRST_PAGE_FOOTER = 1] = "FIRST_PAGE_FOOTER", t[t.DEFAULT_HEADER = 2] = "DEFAULT_HEADER", t[t.DEFAULT_FOOTER = 3] = "DEFAULT_FOOTER", t[t.EVEN_PAGE_HEADER = 4] = "EVEN_PAGE_HEADER", t[t.EVEN_PAGE_FOOTER = 5] = "EVEN_PAGE_FOOTER", t))(L || {});
1002
- function $i(t, e, n) {
1027
+ var Fr = Object.defineProperty, Ur = Object.getOwnPropertyDescriptor, Lr = (t, e, n, o) => {
1028
+ for (var r = o > 1 ? void 0 : o ? Ur(e, n) : e, i = t.length - 1, s; i >= 0; i--)
1029
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
1030
+ return o && r && Fr(e, n, r), r;
1031
+ }, X = (t, e) => (n, o) => e(n, o, t);
1032
+ const Ht = "rgba(58, 96, 247, 1)", Vt = "rgba(58, 96, 247, 0.08)";
1033
+ var U = /* @__PURE__ */ ((t) => (t[t.FIRST_PAGE_HEADER = 0] = "FIRST_PAGE_HEADER", t[t.FIRST_PAGE_FOOTER = 1] = "FIRST_PAGE_FOOTER", t[t.DEFAULT_HEADER = 2] = "DEFAULT_HEADER", t[t.DEFAULT_FOOTER = 3] = "DEFAULT_FOOTER", t[t.EVEN_PAGE_HEADER = 4] = "EVEN_PAGE_HEADER", t[t.EVEN_PAGE_FOOTER = 5] = "EVEN_PAGE_FOOTER", t))(U || {});
1034
+ function wr(t, e, n) {
1003
1035
  const { documentStyle: o } = t.getDataModel().getSnapshot(), {
1004
- defaultHeaderId: i,
1005
- defaultFooterId: r,
1036
+ defaultHeaderId: r,
1037
+ defaultFooterId: i,
1006
1038
  evenPageHeaderId: s,
1007
1039
  evenPageFooterId: a,
1008
1040
  firstPageHeaderId: c,
1009
1041
  firstPageFooterId: d,
1010
- evenAndOddHeaders: p,
1042
+ evenAndOddHeaders: g,
1011
1043
  useFirstPageHeaderFooter: h
1012
1044
  } = o;
1013
1045
  switch (e) {
1014
- case N.BODY:
1046
+ case F.BODY:
1015
1047
  return {
1016
1048
  createType: null,
1017
1049
  headerFooterId: null
1018
1050
  };
1019
- case N.HEADER:
1051
+ case F.HEADER:
1020
1052
  return h === S.TRUE && !c ? {
1021
1053
  createType: 0,
1022
1054
  headerFooterId: null
1023
- } : p === S.TRUE && n % 2 === 0 && !s ? {
1055
+ } : g === S.TRUE && n % 2 === 0 && !s ? {
1024
1056
  createType: 4,
1025
1057
  headerFooterId: null
1026
- } : i ? {
1058
+ } : r ? {
1027
1059
  createType: null,
1028
- headerFooterId: i
1060
+ headerFooterId: r
1029
1061
  } : {
1030
1062
  createType: 2,
1031
1063
  headerFooterId: null
1032
1064
  };
1033
- case N.FOOTER:
1065
+ case F.FOOTER:
1034
1066
  return h === S.TRUE && !d ? {
1035
1067
  createType: 1,
1036
1068
  headerFooterId: null
1037
- } : p === S.TRUE && n % 2 === 0 && !a ? {
1069
+ } : g === S.TRUE && n % 2 === 0 && !a ? {
1038
1070
  createType: 5,
1039
1071
  headerFooterId: null
1040
- } : r ? {
1072
+ } : i ? {
1041
1073
  createType: null,
1042
- headerFooterId: r
1074
+ headerFooterId: i
1043
1075
  } : {
1044
1076
  createType: 3,
1045
1077
  headerFooterId: null
@@ -1048,69 +1080,69 @@ function $i(t, e, n) {
1048
1080
  throw new Error(`Invalid editArea: ${e}`);
1049
1081
  }
1050
1082
  }
1051
- let it = class extends te {
1052
- constructor(e, n, o, i, r, s, a, c, d) {
1083
+ let it = class extends Q {
1084
+ constructor(e, n, o, r, i, s, a, c, d) {
1053
1085
  super();
1054
1086
  C(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
1055
- this._context = e, this._commandService = n, this._editorService = o, this._instanceSrv = i, this._renderManagerService = r, this._docSkeletonManagerService = s, this._textSelectionRenderManager = a, this._localeService = c, this._componentManager = d, this._initialize();
1087
+ this._context = e, this._commandService = n, this._editorService = o, this._instanceSrv = r, this._renderManagerService = i, this._docSkeletonManagerService = s, this._textSelectionRenderManager = a, this._localeService = c, this._componentManager = d, this._initialize();
1056
1088
  }
1057
1089
  _initialize() {
1058
- this._context.unit.getSnapshot().documentStyle.documentFlavor === On.TRADITIONAL && (this._init(), this._drawHeaderFooterLabel(), this._registerCommands(), this._initCustomComponents());
1090
+ this._context.unit.getSnapshot().documentStyle.documentFlavor === bn.TRADITIONAL && (this._init(), this._drawHeaderFooterLabel(), this._registerCommands(), this._initCustomComponents());
1059
1091
  }
1060
1092
  _registerCommands() {
1061
1093
  [
1062
- Vt,
1063
- pn,
1064
- gn
1094
+ Wt,
1095
+ mn,
1096
+ fn
1065
1097
  ].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e)));
1066
1098
  }
1067
1099
  _initCustomComponents() {
1068
1100
  const e = this._componentManager;
1069
- this.disposeWithMe(e.register(hn, Ui));
1101
+ this.disposeWithMe(e.register(gn, Nr));
1070
1102
  }
1071
1103
  _init() {
1072
- const { unitId: e } = this._context, n = q(this._context);
1104
+ const { unitId: e } = this._context, n = J(this._context);
1073
1105
  n == null || n.document == null || this._loadedMap.has(n.document) || (this._initialMain(e), this._loadedMap.add(n.document));
1074
1106
  }
1075
1107
  _initialMain(e) {
1076
- const n = q(this._context), { document: o } = n;
1077
- this.disposeWithMe(o.onDblclick$.subscribeEvent(async (i) => {
1108
+ const n = J(this._context), { document: o } = n;
1109
+ this.disposeWithMe(o.onDblclick$.subscribeEvent(async (r) => {
1078
1110
  if (this._isEditorReadOnly(e))
1079
1111
  return;
1080
- const { offsetX: r, offsetY: s } = i, {
1081
- pageLayoutType: a = De.VERTICAL,
1112
+ const { offsetX: i, offsetY: s } = r, {
1113
+ pageLayoutType: a = Ae.VERTICAL,
1082
1114
  pageMarginLeft: c,
1083
1115
  pageMarginTop: d
1084
- } = o.getOffsetConfig(), p = this._getTransformCoordForDocumentOffset(r, s);
1085
- if (p == null)
1116
+ } = o.getOffsetConfig(), g = this._getTransformCoordForDocumentOffset(i, s);
1117
+ if (g == null)
1086
1118
  return;
1087
- const h = this._docSkeletonManagerService.getViewModel(), g = this._docSkeletonManagerService.getSkeleton(), l = h.getEditArea(), { editArea: f, pageNumber: u } = g.findEditAreaByCoord(
1088
- p,
1119
+ const h = this._docSkeletonManagerService.getViewModel(), p = this._docSkeletonManagerService.getSkeleton(), l = h.getEditArea(), { editArea: _, pageNumber: u } = p.findEditAreaByCoord(
1120
+ g,
1089
1121
  a,
1090
1122
  c,
1091
1123
  d
1092
1124
  );
1093
- if (l === f)
1125
+ if (l === _)
1094
1126
  return;
1095
- h.setEditArea(f);
1096
- const { createType: _, headerFooterId: m } = $i(h, f, u);
1097
- if (f === N.BODY)
1098
- this._textSelectionRenderManager.setSegment(""), this._textSelectionRenderManager.setSegmentPage(-1), this._textSelectionRenderManager.setCursorManually(r, s);
1099
- else if (_ != null) {
1100
- const b = Q.generateRandomId(6);
1101
- this._textSelectionRenderManager.setSegment(b), this._textSelectionRenderManager.setSegmentPage(u), await this._commandService.executeCommand(Vt.id, {
1127
+ h.setEditArea(_);
1128
+ const { createType: f, headerFooterId: m } = wr(h, _, u);
1129
+ if (_ === F.BODY)
1130
+ this._textSelectionRenderManager.setSegment(""), this._textSelectionRenderManager.setSegmentPage(-1), this._textSelectionRenderManager.setCursorManually(i, s);
1131
+ else if (f != null) {
1132
+ const I = j.generateRandomId(6);
1133
+ this._textSelectionRenderManager.setSegment(I), this._textSelectionRenderManager.setSegmentPage(u), await this._commandService.executeCommand(Wt.id, {
1102
1134
  unitId: e,
1103
- createType: _,
1104
- segmentId: b
1135
+ createType: f,
1136
+ segmentId: I
1105
1137
  });
1106
- } else m != null && (this._textSelectionRenderManager.setSegment(m), this._textSelectionRenderManager.setSegmentPage(u), this._textSelectionRenderManager.setCursorManually(r, s));
1138
+ } else m != null && (this._textSelectionRenderManager.setSegment(m), this._textSelectionRenderManager.setSegmentPage(u), this._textSelectionRenderManager.setCursorManually(i, s));
1107
1139
  }));
1108
1140
  }
1109
1141
  _getTransformCoordForDocumentOffset(e, n) {
1110
- const o = q(this._context), { document: i, scene: r } = o, { documentTransform: s } = i.getOffsetConfig(), a = r.getViewports()[0];
1142
+ const o = J(this._context), { document: r, scene: i } = o, { documentTransform: s } = r.getOffsetConfig(), a = i.getViewports()[0];
1111
1143
  if (a == null)
1112
1144
  return;
1113
- const c = a.transformVector2SceneCoord(nn.FromArray([e, n]));
1145
+ const c = a.transformVector2SceneCoord(sn.FromArray([e, n]));
1114
1146
  return s.clone().invert().applyPoint(c);
1115
1147
  }
1116
1148
  // eslint-disable-next-line max-lines-per-function
@@ -1122,60 +1154,60 @@ let it = class extends te {
1122
1154
  const o = this._renderManagerService.getRenderById(n);
1123
1155
  if (this._editorService.isEditor(n) || this._instanceSrv.getUniverDocInstance(n) == null || o == null)
1124
1156
  return;
1125
- const { mainComponent: i } = o, r = i;
1157
+ const { mainComponent: r } = o, i = r;
1126
1158
  this.disposeWithMe(
1127
- Xt(
1159
+ Jt(
1128
1160
  // eslint-disable-next-line max-lines-per-function
1129
- r.pageRender$.subscribe((s) => {
1161
+ i.pageRender$.subscribe((s) => {
1130
1162
  if (this._editorService.isEditor(n))
1131
1163
  return;
1132
- const d = this._docSkeletonManagerService.getViewModel().getEditArea() === N.BODY, { page: p, pageLeft: h, pageTop: g, ctx: l } = s, { pageWidth: f, pageHeight: u, marginTop: _, marginBottom: m } = p;
1133
- if (l.save(), l.translate(h - 0.5, g - 0.5), d ? (Ye.drawWith(l, {
1164
+ const d = this._docSkeletonManagerService.getViewModel().getEditArea() === F.BODY, { page: g, pageLeft: h, pageTop: p, ctx: l } = s, { pageWidth: _, pageHeight: u, marginTop: f, marginBottom: m } = g;
1165
+ if (l.save(), l.translate(h - 0.5, p - 0.5), d ? (Xe.drawWith(l, {
1134
1166
  left: 0,
1135
1167
  top: 0,
1136
- width: f,
1137
- height: _,
1168
+ width: _,
1169
+ height: f,
1138
1170
  fill: "rgba(255, 255, 255, 0.5)"
1139
- }), l.save(), l.translate(0, u - m), Ye.drawWith(l, {
1171
+ }), l.save(), l.translate(0, u - m), Xe.drawWith(l, {
1140
1172
  left: 0,
1141
1173
  top: 0,
1142
- width: f,
1174
+ width: _,
1143
1175
  height: m,
1144
1176
  fill: "rgba(255, 255, 255, 0.5)"
1145
- }), l.restore()) : (l.save(), l.translate(0, _), Ye.drawWith(l, {
1177
+ }), l.restore()) : (l.save(), l.translate(0, f), Xe.drawWith(l, {
1146
1178
  left: 0,
1147
- top: _,
1148
- width: f,
1149
- height: u - _ - m,
1179
+ top: f,
1180
+ width: _,
1181
+ height: u - f - m,
1150
1182
  fill: "rgba(255, 255, 255, 0.5)"
1151
1183
  }), l.restore()), !d) {
1152
1184
  const R = {
1153
1185
  dataArray: [{
1154
1186
  command: "M",
1155
- points: [0, _]
1187
+ points: [0, f]
1156
1188
  }, {
1157
1189
  command: "L",
1158
- points: [f, _]
1190
+ points: [_, f]
1159
1191
  }],
1160
1192
  strokeWidth: 1,
1161
- stroke: Bt
1162
- }, b = {
1193
+ stroke: Ht
1194
+ }, I = {
1163
1195
  dataArray: [{
1164
1196
  command: "M",
1165
1197
  points: [0, u - m]
1166
1198
  }, {
1167
1199
  command: "L",
1168
- points: [f, u - m]
1200
+ points: [_, u - m]
1169
1201
  }],
1170
1202
  strokeWidth: 1,
1171
- stroke: Bt
1203
+ stroke: Ht
1172
1204
  };
1173
- Et.drawWith(l, R), Et.drawWith(l, b), l.translate(0, _ + 1), Ae.drawWith(l, {
1205
+ It.drawWith(l, R), It.drawWith(l, I), l.translate(0, f + 1), Ne.drawWith(l, {
1174
1206
  text: e.t("headerFooter.header"),
1175
- color: $t
1176
- }), l.translate(0, u - _ - m), Ae.drawWith(l, {
1207
+ color: Vt
1208
+ }), l.translate(0, u - f - m), Ne.drawWith(l, {
1177
1209
  text: e.t("headerFooter.footer"),
1178
- color: $t
1210
+ color: Vt
1179
1211
  });
1180
1212
  }
1181
1213
  l.restore();
@@ -1192,17 +1224,17 @@ let it = class extends te {
1192
1224
  return this._context.unit;
1193
1225
  }
1194
1226
  };
1195
- it = Bi([
1196
- Y(1, O),
1197
- Y(2, K),
1198
- Y(3, U),
1199
- Y(4, j),
1200
- Y(5, T(w)),
1201
- Y(6, oe),
1202
- Y(7, T(le)),
1203
- Y(8, T(qt))
1227
+ it = Lr([
1228
+ X(1, O),
1229
+ X(2, ee),
1230
+ X(3, w),
1231
+ X(4, W),
1232
+ X(5, E(L)),
1233
+ X(6, ne),
1234
+ X(7, E(le)),
1235
+ X(8, E(tn))
1204
1236
  ], it);
1205
- function Ht() {
1237
+ function jt() {
1206
1238
  return {
1207
1239
  dataStream: `\r
1208
1240
  `,
@@ -1219,9 +1251,9 @@ function Ht() {
1219
1251
  {
1220
1252
  startIndex: 0,
1221
1253
  paragraphStyle: {
1222
- spaceAbove: 0,
1254
+ spaceAbove: { v: 0 },
1223
1255
  lineSpacing: 1.5,
1224
- spaceBelow: 0
1256
+ spaceBelow: { v: 0 }
1225
1257
  }
1226
1258
  }
1227
1259
  ],
@@ -1232,108 +1264,108 @@ function Ht() {
1232
1264
  ]
1233
1265
  };
1234
1266
  }
1235
- function Ze(t, e, n, o) {
1236
- const i = qe.getInstance(), r = 6, s = t != null ? t : Q.generateRandomId(r), a = e === L.DEFAULT_HEADER || e === L.FIRST_PAGE_HEADER || e === L.EVEN_PAGE_HEADER, c = i.insertOp([a ? "headers" : "footers", s], {
1267
+ function Je(t, e, n, o) {
1268
+ const r = Qe.getInstance(), i = 6, s = t != null ? t : j.generateRandomId(i), a = e === U.DEFAULT_HEADER || e === U.FIRST_PAGE_HEADER || e === U.EVEN_PAGE_HEADER, c = r.insertOp([a ? "headers" : "footers", s], {
1237
1269
  [a ? "headerId" : "footerId"]: s,
1238
- body: Ht()
1270
+ body: jt()
1239
1271
  });
1240
1272
  o.push(c);
1241
- const d = Q.generateRandomId(r), p = i.insertOp([a ? "footers" : "headers", d], {
1273
+ const d = j.generateRandomId(i), g = r.insertOp([a ? "footers" : "headers", d], {
1242
1274
  [a ? "footers" : "headers"]: d,
1243
- body: Ht()
1275
+ body: jt()
1244
1276
  });
1245
- o.push(p);
1246
- let h = "defaultHeaderId", g = "defaultFooterId";
1277
+ o.push(g);
1278
+ let h = "defaultHeaderId", p = "defaultFooterId";
1247
1279
  switch (e) {
1248
- case L.DEFAULT_HEADER:
1249
- h = "defaultHeaderId", g = "defaultFooterId";
1280
+ case U.DEFAULT_HEADER:
1281
+ h = "defaultHeaderId", p = "defaultFooterId";
1250
1282
  break;
1251
- case L.DEFAULT_FOOTER:
1252
- h = "defaultFooterId", g = "defaultHeaderId";
1283
+ case U.DEFAULT_FOOTER:
1284
+ h = "defaultFooterId", p = "defaultHeaderId";
1253
1285
  break;
1254
- case L.FIRST_PAGE_HEADER:
1255
- h = "firstPageHeaderId", g = "firstPageFooterId";
1286
+ case U.FIRST_PAGE_HEADER:
1287
+ h = "firstPageHeaderId", p = "firstPageFooterId";
1256
1288
  break;
1257
- case L.FIRST_PAGE_FOOTER:
1258
- h = "firstPageFooterId", g = "firstPageHeaderId";
1289
+ case U.FIRST_PAGE_FOOTER:
1290
+ h = "firstPageFooterId", p = "firstPageHeaderId";
1259
1291
  break;
1260
- case L.EVEN_PAGE_HEADER:
1261
- h = "evenPageHeaderId", g = "evenPageFooterId";
1292
+ case U.EVEN_PAGE_HEADER:
1293
+ h = "evenPageHeaderId", p = "evenPageFooterId";
1262
1294
  break;
1263
- case L.EVEN_PAGE_FOOTER:
1264
- h = "evenPageFooterId", g = "evenPageHeaderId";
1295
+ case U.EVEN_PAGE_FOOTER:
1296
+ h = "evenPageFooterId", p = "evenPageHeaderId";
1265
1297
  break;
1266
1298
  default:
1267
1299
  throw new Error(`Unknown header footer type: ${e}`);
1268
1300
  }
1269
- for (const [l, f] of [[h, s], [g, d]])
1301
+ for (const [l, _] of [[h, s], [p, d]])
1270
1302
  if (n[l] != null) {
1271
- const u = i.replaceOp(["documentStyle", l], n[l], f);
1303
+ const u = r.replaceOp(["documentStyle", l], n[l], _);
1272
1304
  o.push(u);
1273
1305
  } else {
1274
- const u = i.insertOp(["documentStyle", l], f);
1306
+ const u = r.insertOp(["documentStyle", l], _);
1275
1307
  o.push(u);
1276
1308
  }
1277
1309
  return o;
1278
1310
  }
1279
- const be = "doc.command.core-header-footer", Vt = {
1311
+ const be = "doc.command.core-header-footer", Wt = {
1280
1312
  id: be,
1281
1313
  type: de.COMMAND,
1282
1314
  // eslint-disable-next-line max-lines-per-function
1283
1315
  handler: async (t, e) => {
1284
- var M;
1285
- const n = t.get(O), o = t.get(U), i = t.get(j), { unitId: r, segmentId: s, createType: a, headerFooterProps: c } = e, d = (M = i.getRenderById(r)) == null ? void 0 : M.with(w), p = o.getUniverDocInstance(r), h = d == null ? void 0 : d.getViewModel();
1286
- if (p == null || h == null)
1316
+ var b;
1317
+ const n = t.get(O), o = t.get(w), r = t.get(W), { unitId: i, segmentId: s, createType: a, headerFooterProps: c } = e, d = (b = r.getRenderById(i)) == null ? void 0 : b.with(L), g = o.getUniverDocInstance(i), h = d == null ? void 0 : d.getViewModel();
1318
+ if (g == null || h == null)
1287
1319
  return !1;
1288
- const g = h.getEditArea(), { documentStyle: l } = p.getSnapshot(), f = (c == null ? void 0 : c.marginFooter) != null || (c == null ? void 0 : c.marginHeader) != null, u = [{
1320
+ const p = h.getEditArea(), { documentStyle: l } = g.getSnapshot(), _ = (c == null ? void 0 : c.marginFooter) != null || (c == null ? void 0 : c.marginHeader) != null, u = [{
1289
1321
  startOffset: 0,
1290
1322
  endOffset: 0,
1291
1323
  collapsed: !0
1292
- }], _ = {
1293
- id: ut.id,
1324
+ }], f = {
1325
+ id: ht.id,
1294
1326
  params: {
1295
- unitId: r,
1327
+ unitId: i,
1296
1328
  actions: [],
1297
1329
  textRanges: u,
1298
1330
  debounce: !0
1299
1331
  }
1300
1332
  };
1301
- f && (_.params.noNeedSetTextRange = !0);
1302
- const m = qe.getInstance(), R = [];
1303
- return a != null && Ze(s, a, l, R), c != null && Object.keys(c).forEach((E) => {
1304
- const A = c[E], F = l[E];
1305
- if (A === F)
1333
+ _ && (f.params.noNeedSetTextRange = !0);
1334
+ const m = Qe.getInstance(), R = [];
1335
+ return a != null && Je(s, a, l, R), c != null && Object.keys(c).forEach((T) => {
1336
+ const A = c[T], N = l[T];
1337
+ if (A === N)
1306
1338
  return;
1307
- let G;
1308
- if (F === void 0 ? G = m.insertOp(["documentStyle", E], A) : G = m.replaceOp(["documentStyle", E], F, A), R.push(G), E === "useFirstPageHeaderFooter" && A === S.TRUE && !l.firstPageHeaderId) {
1309
- const k = g === N.HEADER ? L.FIRST_PAGE_HEADER : L.FIRST_PAGE_FOOTER;
1310
- Ze(s, k, l, R);
1311
- } else if (E === "evenAndOddHeaders" && A === S.TRUE && !l.evenPageHeaderId) {
1312
- const k = g === N.HEADER ? L.EVEN_PAGE_HEADER : L.EVEN_PAGE_FOOTER;
1313
- Ze(s, k, l, R);
1339
+ let Y;
1340
+ if (N === void 0 ? Y = m.insertOp(["documentStyle", T], A) : Y = m.replaceOp(["documentStyle", T], N, A), R.push(Y), T === "useFirstPageHeaderFooter" && A === S.TRUE && !l.firstPageHeaderId) {
1341
+ const G = p === F.HEADER ? U.FIRST_PAGE_HEADER : U.FIRST_PAGE_FOOTER;
1342
+ Je(s, G, l, R);
1343
+ } else if (T === "evenAndOddHeaders" && A === S.TRUE && !l.evenPageHeaderId) {
1344
+ const G = p === F.HEADER ? U.EVEN_PAGE_HEADER : U.EVEN_PAGE_FOOTER;
1345
+ Je(s, G, l, R);
1314
1346
  }
1315
- }), R.length === 0 ? !1 : (_.params.actions = R.reduce((E, A) => qe.compose(E, A), null), !!n.syncExecuteCommand(_.id, _.params));
1347
+ }), R.length === 0 ? !1 : (f.params.actions = R.reduce((T, A) => Qe.compose(T, A), null), !!n.syncExecuteCommand(f.id, f.params));
1316
1348
  }
1317
- }, pn = {
1349
+ }, mn = {
1318
1350
  id: "doc.command.open-header-footer-panel",
1319
1351
  type: de.COMMAND,
1320
- handler: async (t, e) => t.get(O).executeCommand(gn.id, { value: "open" })
1352
+ handler: async (t, e) => t.get(O).executeCommand(fn.id, { value: "open" })
1321
1353
  };
1322
- function Hi(t) {
1354
+ function Br(t) {
1323
1355
  const e = t.get(O);
1324
1356
  return {
1325
- id: Zn.id,
1326
- group: y.TOOLBAR_FORMAT,
1327
- type: x.BUTTON,
1357
+ id: Qn.id,
1358
+ group: x.TOOLBAR_FORMAT,
1359
+ type: y.BUTTON,
1328
1360
  icon: "BoldSingle",
1329
1361
  title: "Set bold",
1330
1362
  tooltip: "toolbar.bold",
1331
1363
  positions: [P.TOOLBAR_START],
1332
1364
  activated$: new B((n) => {
1333
- const o = e.onCommandExecuted((i) => {
1365
+ const o = e.onCommandExecuted((r) => {
1334
1366
  var s;
1335
- const r = i.id;
1336
- if (r === V.id || r === ue.id) {
1367
+ const i = r.id;
1368
+ if (i === V.id || i === ue.id) {
1337
1369
  const a = Z(t);
1338
1370
  if (a == null)
1339
1371
  return;
@@ -1346,21 +1378,21 @@ function Hi(t) {
1346
1378
  hidden$: D(t, v.UNIVER_DOC)
1347
1379
  };
1348
1380
  }
1349
- function Vi(t) {
1381
+ function $r(t) {
1350
1382
  const e = t.get(O);
1351
1383
  return {
1352
- id: Jn.id,
1353
- group: y.TOOLBAR_FORMAT,
1354
- type: x.BUTTON,
1384
+ id: eo.id,
1385
+ group: x.TOOLBAR_FORMAT,
1386
+ type: y.BUTTON,
1355
1387
  icon: "ItalicSingle",
1356
1388
  title: "Set italic",
1357
1389
  tooltip: "toolbar.italic",
1358
1390
  positions: [P.TOOLBAR_START],
1359
1391
  activated$: new B((n) => {
1360
- const o = e.onCommandExecuted((i) => {
1392
+ const o = e.onCommandExecuted((r) => {
1361
1393
  var s;
1362
- const r = i.id;
1363
- if (r === V.id || r === ue.id) {
1394
+ const i = r.id;
1395
+ if (i === V.id || i === ue.id) {
1364
1396
  const a = Z(t);
1365
1397
  if (a == null)
1366
1398
  return;
@@ -1373,21 +1405,21 @@ function Vi(t) {
1373
1405
  hidden$: D(t, v.UNIVER_DOC)
1374
1406
  };
1375
1407
  }
1376
- function ji(t) {
1408
+ function Hr(t) {
1377
1409
  const e = t.get(O);
1378
1410
  return {
1379
- id: qn.id,
1380
- group: y.TOOLBAR_FORMAT,
1381
- type: x.BUTTON,
1411
+ id: to.id,
1412
+ group: x.TOOLBAR_FORMAT,
1413
+ type: y.BUTTON,
1382
1414
  icon: "UnderlineSingle",
1383
1415
  title: "Set underline",
1384
1416
  tooltip: "toolbar.underline",
1385
1417
  positions: [P.TOOLBAR_START],
1386
1418
  activated$: new B((n) => {
1387
- const o = e.onCommandExecuted((i) => {
1419
+ const o = e.onCommandExecuted((r) => {
1388
1420
  var s;
1389
- const r = i.id;
1390
- if (r === V.id || r === ue.id) {
1421
+ const i = r.id;
1422
+ if (i === V.id || i === ue.id) {
1391
1423
  const a = Z(t);
1392
1424
  if (a == null)
1393
1425
  return;
@@ -1400,21 +1432,21 @@ function ji(t) {
1400
1432
  hidden$: D(t, v.UNIVER_DOC)
1401
1433
  };
1402
1434
  }
1403
- function Wi(t) {
1435
+ function Vr(t) {
1404
1436
  const e = t.get(O);
1405
1437
  return {
1406
- id: Qn.id,
1407
- group: y.TOOLBAR_FORMAT,
1408
- type: x.BUTTON,
1438
+ id: no.id,
1439
+ group: x.TOOLBAR_FORMAT,
1440
+ type: y.BUTTON,
1409
1441
  icon: "StrikethroughSingle",
1410
1442
  title: "Set strike through",
1411
1443
  tooltip: "toolbar.strikethrough",
1412
1444
  positions: [P.TOOLBAR_START],
1413
1445
  activated$: new B((n) => {
1414
- const o = e.onCommandExecuted((i) => {
1446
+ const o = e.onCommandExecuted((r) => {
1415
1447
  var s;
1416
- const r = i.id;
1417
- if (r === V.id || r === ue.id) {
1448
+ const i = r.id;
1449
+ if (i === V.id || i === ue.id) {
1418
1450
  const a = Z(t);
1419
1451
  if (a == null)
1420
1452
  return;
@@ -1427,20 +1459,20 @@ function Wi(t) {
1427
1459
  hidden$: D(t, v.UNIVER_DOC)
1428
1460
  };
1429
1461
  }
1430
- function ki(t) {
1462
+ function jr(t) {
1431
1463
  const e = t.get(O);
1432
1464
  return {
1433
- id: eo.id,
1434
- group: y.TOOLBAR_FORMAT,
1435
- type: x.BUTTON,
1465
+ id: oo.id,
1466
+ group: x.TOOLBAR_FORMAT,
1467
+ type: y.BUTTON,
1436
1468
  icon: "SubscriptSingle",
1437
1469
  tooltip: "toolbar.subscript",
1438
1470
  positions: [P.TOOLBAR_START],
1439
1471
  activated$: new B((n) => {
1440
- const o = e.onCommandExecuted((i) => {
1472
+ const o = e.onCommandExecuted((r) => {
1441
1473
  var s;
1442
- const r = i.id;
1443
- if (r === V.id || r === ue.id) {
1474
+ const i = r.id;
1475
+ if (i === V.id || i === ue.id) {
1444
1476
  const a = Z(t);
1445
1477
  if (a == null)
1446
1478
  return;
@@ -1453,20 +1485,20 @@ function ki(t) {
1453
1485
  hidden$: D(t, v.UNIVER_DOC)
1454
1486
  };
1455
1487
  }
1456
- function zi(t) {
1488
+ function Wr(t) {
1457
1489
  const e = t.get(O);
1458
1490
  return {
1459
- id: to.id,
1460
- group: y.TOOLBAR_FORMAT,
1461
- type: x.BUTTON,
1491
+ id: ro.id,
1492
+ group: x.TOOLBAR_FORMAT,
1493
+ type: y.BUTTON,
1462
1494
  icon: "SuperscriptSingle",
1463
1495
  tooltip: "toolbar.superscript",
1464
1496
  positions: [P.TOOLBAR_START],
1465
1497
  activated$: new B((n) => {
1466
- const o = e.onCommandExecuted((i) => {
1498
+ const o = e.onCommandExecuted((r) => {
1467
1499
  var s;
1468
- const r = i.id;
1469
- if (r === V.id || r === ue.id) {
1500
+ const i = r.id;
1501
+ if (i === V.id || i === ue.id) {
1470
1502
  const a = Z(t);
1471
1503
  if (a == null)
1472
1504
  return;
@@ -1479,28 +1511,28 @@ function zi(t) {
1479
1511
  hidden$: D(t, v.UNIVER_DOC)
1480
1512
  };
1481
1513
  }
1482
- function Gi(t) {
1514
+ function kr(t) {
1483
1515
  const e = t.get(O);
1484
1516
  return {
1485
- id: St.id,
1517
+ id: Rt.id,
1486
1518
  tooltip: "toolbar.font",
1487
- group: y.TOOLBAR_FORMAT,
1488
- type: x.SELECTOR,
1489
- label: an,
1519
+ group: x.TOOLBAR_FORMAT,
1520
+ type: y.SELECTOR,
1521
+ label: dn,
1490
1522
  positions: [P.TOOLBAR_START],
1491
- selections: mt.map((n) => ({
1523
+ selections: vt.map((n) => ({
1492
1524
  label: {
1493
- name: cn,
1525
+ name: un,
1494
1526
  hoverable: !0
1495
1527
  },
1496
1528
  value: n.value
1497
1529
  })),
1498
1530
  // disabled$: getCurrentSheetDisabled$(accessor),
1499
1531
  value$: new B((n) => {
1500
- const o = mt[0].value, i = e.onCommandExecuted((r) => {
1532
+ const o = vt[0].value, r = e.onCommandExecuted((i) => {
1501
1533
  var a;
1502
- const s = r.id;
1503
- if (s === V.id || s === St.id) {
1534
+ const s = i.id;
1535
+ if (s === V.id || s === Rt.id) {
1504
1536
  const c = Z(t);
1505
1537
  if (c == null)
1506
1538
  return;
@@ -1508,20 +1540,20 @@ function Gi(t) {
1508
1540
  n.next(d != null ? d : o);
1509
1541
  }
1510
1542
  });
1511
- return n.next(o), i.dispose;
1543
+ return n.next(o), r.dispose;
1512
1544
  }),
1513
1545
  hidden$: D(t, v.UNIVER_DOC)
1514
1546
  };
1515
1547
  }
1516
- function Yi(t) {
1548
+ function Gr(t) {
1517
1549
  const e = t.get(O);
1518
1550
  return {
1519
- id: vt.id,
1520
- group: y.TOOLBAR_FORMAT,
1521
- type: x.SELECTOR,
1551
+ id: Ot.id,
1552
+ group: x.TOOLBAR_FORMAT,
1553
+ type: y.SELECTOR,
1522
1554
  tooltip: "toolbar.fontSize",
1523
1555
  label: {
1524
- name: ln,
1556
+ name: hn,
1525
1557
  props: {
1526
1558
  min: 1,
1527
1559
  max: 400
@@ -1529,13 +1561,13 @@ function Yi(t) {
1529
1561
  }
1530
1562
  },
1531
1563
  positions: [P.TOOLBAR_START],
1532
- selections: Dn,
1564
+ selections: wn,
1533
1565
  // disabled$,
1534
1566
  value$: new B((n) => {
1535
- const i = e.onCommandExecuted((r) => {
1567
+ const r = e.onCommandExecuted((i) => {
1536
1568
  var a;
1537
- const s = r.id;
1538
- if (s === V.id || s === vt.id) {
1569
+ const s = i.id;
1570
+ if (s === V.id || s === Ot.id) {
1539
1571
  const c = Z(t);
1540
1572
  if (c == null)
1541
1573
  return;
@@ -1543,71 +1575,71 @@ function Yi(t) {
1543
1575
  n.next(d != null ? d : 14);
1544
1576
  }
1545
1577
  });
1546
- return n.next(14), i.dispose;
1578
+ return n.next(14), r.dispose;
1547
1579
  }),
1548
1580
  hidden$: D(t, v.UNIVER_DOC)
1549
1581
  };
1550
1582
  }
1551
- function Xi(t) {
1552
- const e = t.get(O), n = t.get(Zt);
1583
+ function zr(t) {
1584
+ const e = t.get(O), n = t.get(Qt);
1553
1585
  return {
1554
- id: Rt.id,
1586
+ id: Ct.id,
1555
1587
  icon: "FontColor",
1556
1588
  tooltip: "toolbar.textColor.main",
1557
- group: y.TOOLBAR_FORMAT,
1558
- type: x.BUTTON_SELECTOR,
1589
+ group: x.TOOLBAR_FORMAT,
1590
+ type: y.BUTTON_SELECTOR,
1559
1591
  positions: [P.TOOLBAR_START],
1560
1592
  selections: [
1561
1593
  {
1562
1594
  label: {
1563
- name: gt,
1595
+ name: pt,
1564
1596
  hoverable: !1
1565
1597
  }
1566
1598
  }
1567
1599
  ],
1568
1600
  value$: new B((o) => {
1569
- const i = n.getCurrentTheme().textColor, r = e.onCommandExecuted((s) => {
1570
- if (s.id === Rt.id) {
1601
+ const r = n.getCurrentTheme().textColor, i = e.onCommandExecuted((s) => {
1602
+ if (s.id === Ct.id) {
1571
1603
  const a = s.params.value;
1572
- o.next(a != null ? a : i);
1604
+ o.next(a != null ? a : r);
1573
1605
  }
1574
1606
  });
1575
- return o.next(i), r.dispose;
1607
+ return o.next(r), i.dispose;
1576
1608
  }),
1577
1609
  hidden$: D(t, v.UNIVER_DOC)
1578
1610
  // disabled$: getCurrentSheetDisabled$(accessor),
1579
1611
  };
1580
1612
  }
1581
- function Ki(t) {
1613
+ function Yr(t) {
1582
1614
  return {
1583
- id: pn.id,
1584
- group: y.TOOLBAR_OTHERS,
1585
- type: x.BUTTON,
1615
+ id: mn.id,
1616
+ group: x.TOOLBAR_OTHERS,
1617
+ type: y.BUTTON,
1586
1618
  icon: "FreezeRowSingle",
1587
1619
  tooltip: "toolbar.headerFooter",
1588
1620
  positions: [P.TOOLBAR_START],
1589
- hidden$: To(D(t, v.UNIVER_DOC), An(t), (e, n) => e || n)
1621
+ hidden$: yo(D(t, v.UNIVER_DOC), Bn(t), (e, n) => e || n)
1590
1622
  };
1591
1623
  }
1592
- function Zi(t) {
1624
+ function Xr(t) {
1593
1625
  const e = t.get(O);
1594
1626
  return {
1595
- id: no.id,
1596
- group: y.TOOLBAR_LAYOUT,
1597
- type: x.BUTTON,
1627
+ id: io.id,
1628
+ group: x.TOOLBAR_LAYOUT,
1629
+ type: y.BUTTON,
1598
1630
  icon: "LeftJustifyingSingle",
1599
1631
  tooltip: "toolbar.alignLeft",
1600
1632
  positions: [P.TOOLBAR_START],
1601
1633
  activated$: new B((n) => {
1602
- const o = e.onCommandExecuted((i) => {
1634
+ const o = e.onCommandExecuted((r) => {
1603
1635
  var s;
1604
- const r = i.id;
1605
- if (r === V.id || r === Ve.id) {
1606
- const a = ke(t);
1636
+ const i = r.id;
1637
+ if (i === V.id || i === je.id) {
1638
+ const a = Ge(t);
1607
1639
  if (a == null)
1608
1640
  return;
1609
1641
  const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
1610
- n.next(c === Ue.LEFT);
1642
+ n.next(c === we.LEFT);
1611
1643
  }
1612
1644
  });
1613
1645
  return n.next(!1), o.dispose;
@@ -1615,25 +1647,25 @@ function Zi(t) {
1615
1647
  hidden$: D(t, v.UNIVER_DOC)
1616
1648
  };
1617
1649
  }
1618
- function Ji(t) {
1650
+ function Kr(t) {
1619
1651
  const e = t.get(O);
1620
1652
  return {
1621
- id: oo.id,
1622
- group: y.TOOLBAR_LAYOUT,
1623
- type: x.BUTTON,
1653
+ id: so.id,
1654
+ group: x.TOOLBAR_LAYOUT,
1655
+ type: y.BUTTON,
1624
1656
  icon: "HorizontallySingle",
1625
1657
  tooltip: "toolbar.alignCenter",
1626
1658
  positions: [P.TOOLBAR_START],
1627
1659
  activated$: new B((n) => {
1628
- const o = e.onCommandExecuted((i) => {
1660
+ const o = e.onCommandExecuted((r) => {
1629
1661
  var s;
1630
- const r = i.id;
1631
- if (r === V.id || r === Ve.id) {
1632
- const a = ke(t);
1662
+ const i = r.id;
1663
+ if (i === V.id || i === je.id) {
1664
+ const a = Ge(t);
1633
1665
  if (a == null)
1634
1666
  return;
1635
1667
  const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
1636
- n.next(c === Ue.CENTER);
1668
+ n.next(c === we.CENTER);
1637
1669
  }
1638
1670
  });
1639
1671
  return n.next(!1), o.dispose;
@@ -1641,25 +1673,25 @@ function Ji(t) {
1641
1673
  hidden$: D(t, v.UNIVER_DOC)
1642
1674
  };
1643
1675
  }
1644
- function qi(t) {
1676
+ function Zr(t) {
1645
1677
  const e = t.get(O);
1646
1678
  return {
1647
- id: io.id,
1648
- group: y.TOOLBAR_LAYOUT,
1649
- type: x.BUTTON,
1679
+ id: ao.id,
1680
+ group: x.TOOLBAR_LAYOUT,
1681
+ type: y.BUTTON,
1650
1682
  icon: "RightJustifyingSingle",
1651
1683
  tooltip: "toolbar.alignRight",
1652
1684
  positions: [P.TOOLBAR_START],
1653
1685
  activated$: new B((n) => {
1654
- const o = e.onCommandExecuted((i) => {
1686
+ const o = e.onCommandExecuted((r) => {
1655
1687
  var s;
1656
- const r = i.id;
1657
- if (r === V.id || r === Ve.id) {
1658
- const a = ke(t);
1688
+ const i = r.id;
1689
+ if (i === V.id || i === je.id) {
1690
+ const a = Ge(t);
1659
1691
  if (a == null)
1660
1692
  return;
1661
1693
  const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
1662
- n.next(c === Ue.RIGHT);
1694
+ n.next(c === we.RIGHT);
1663
1695
  }
1664
1696
  });
1665
1697
  return n.next(!1), o.dispose;
@@ -1667,25 +1699,25 @@ function qi(t) {
1667
1699
  hidden$: D(t, v.UNIVER_DOC)
1668
1700
  };
1669
1701
  }
1670
- function Qi(t) {
1702
+ function Jr(t) {
1671
1703
  const e = t.get(O);
1672
1704
  return {
1673
- id: ro.id,
1674
- group: y.TOOLBAR_LAYOUT,
1675
- type: x.BUTTON,
1705
+ id: co.id,
1706
+ group: x.TOOLBAR_LAYOUT,
1707
+ type: y.BUTTON,
1676
1708
  icon: "AlignTextBothSingle",
1677
1709
  tooltip: "toolbar.alignJustify",
1678
1710
  positions: [P.TOOLBAR_START],
1679
1711
  activated$: new B((n) => {
1680
- const o = e.onCommandExecuted((i) => {
1712
+ const o = e.onCommandExecuted((r) => {
1681
1713
  var s;
1682
- const r = i.id;
1683
- if (r === V.id || r === Ve.id) {
1684
- const a = ke(t);
1714
+ const i = r.id;
1715
+ if (i === V.id || i === je.id) {
1716
+ const a = Ge(t);
1685
1717
  if (a == null)
1686
1718
  return;
1687
1719
  const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
1688
- n.next(c === Ue.JUSTIFIED);
1720
+ n.next(c === we.JUSTIFIED);
1689
1721
  }
1690
1722
  });
1691
1723
  return n.next(!1), o.dispose;
@@ -1693,258 +1725,247 @@ function Qi(t) {
1693
1725
  hidden$: D(t, v.UNIVER_DOC)
1694
1726
  };
1695
1727
  }
1696
- function er(t) {
1728
+ function qr(t) {
1697
1729
  return {
1698
- id: so.id,
1699
- group: y.TOOLBAR_LAYOUT,
1700
- type: x.BUTTON,
1730
+ id: lo.id,
1731
+ group: x.TOOLBAR_LAYOUT,
1732
+ type: y.BUTTON,
1701
1733
  icon: "OrderSingle",
1702
1734
  tooltip: "toolbar.order",
1703
1735
  positions: [P.TOOLBAR_START],
1704
1736
  hidden$: D(t, v.UNIVER_DOC)
1705
1737
  };
1706
1738
  }
1707
- function tr(t) {
1739
+ function Qr(t) {
1708
1740
  return {
1709
- id: ao.id,
1710
- group: y.TOOLBAR_LAYOUT,
1711
- type: x.BUTTON,
1741
+ id: uo.id,
1742
+ group: x.TOOLBAR_LAYOUT,
1743
+ type: y.BUTTON,
1712
1744
  icon: "UnorderSingle",
1713
1745
  tooltip: "toolbar.unorder",
1714
1746
  positions: [P.TOOLBAR_START],
1715
1747
  hidden$: D(t, v.UNIVER_DOC)
1716
1748
  };
1717
1749
  }
1718
- function nr(t) {
1750
+ function ei(t) {
1719
1751
  return {
1720
- id: co.id,
1721
- type: x.BUTTON,
1752
+ id: ho.id,
1753
+ type: y.BUTTON,
1722
1754
  title: "toolbar.resetColor",
1723
1755
  icon: "NoColor",
1724
- positions: Qe.id
1756
+ positions: et.id
1725
1757
  };
1726
1758
  }
1727
- function or(t) {
1728
- const e = t.get(O), n = t.get(Zt);
1759
+ function ti(t) {
1760
+ const e = t.get(O), n = t.get(Qt);
1729
1761
  return {
1730
- id: Qe.id,
1762
+ id: et.id,
1731
1763
  tooltip: "toolbar.fillColor.main",
1732
- group: y.TOOLBAR_FORMAT,
1733
- type: x.BUTTON_SELECTOR,
1764
+ group: x.TOOLBAR_FORMAT,
1765
+ type: y.BUTTON_SELECTOR,
1734
1766
  positions: [P.TOOLBAR_START],
1735
1767
  icon: "PaintBucket",
1736
1768
  selections: [
1737
1769
  {
1738
1770
  label: {
1739
- name: gt,
1771
+ name: pt,
1740
1772
  hoverable: !1
1741
1773
  }
1742
1774
  }
1743
1775
  ],
1744
1776
  value$: new B((o) => {
1745
- const i = n.getCurrentTheme().primaryColor, r = e.onCommandExecuted((s) => {
1746
- if (s.id === Qe.id) {
1777
+ const r = n.getCurrentTheme().primaryColor, i = e.onCommandExecuted((s) => {
1778
+ if (s.id === et.id) {
1747
1779
  const a = s.params.value;
1748
- o.next(a != null ? a : i);
1780
+ o.next(a != null ? a : r);
1749
1781
  }
1750
1782
  });
1751
- return o.next(i), r.dispose;
1783
+ return o.next(r), i.dispose;
1752
1784
  }),
1753
1785
  hidden$: D(t, v.UNIVER_DOC)
1754
1786
  };
1755
1787
  }
1756
1788
  function Z(t) {
1757
1789
  var d;
1758
- const e = t.get(U), n = t.get(ne), o = e.getCurrentUniverDocInstance(), i = n.getActiveRange();
1759
- if (o == null || i == null)
1790
+ const e = t.get(w), n = t.get(te), o = e.getCurrentUniverDocInstance(), r = n.getActiveRange();
1791
+ if (o == null || r == null)
1760
1792
  return;
1761
- const { startOffset: r, segmentId: s } = i, a = (d = o.getSelfOrHeaderFooterModel(s).getBody()) == null ? void 0 : d.textRuns;
1793
+ const { startOffset: i, segmentId: s } = r, a = (d = o.getSelfOrHeaderFooterModel(s).getBody()) == null ? void 0 : d.textRuns;
1762
1794
  if (a == null)
1763
1795
  return;
1764
1796
  let c;
1765
- for (let p = 0; p < a.length; p++) {
1766
- const h = a[p], g = a[p + 1];
1767
- if (g && g.st === g.ed && r === g.st) {
1768
- c = g;
1797
+ for (let g = 0; g < a.length; g++) {
1798
+ const h = a[g], p = a[g + 1];
1799
+ if (p && p.st === p.ed && i === p.st) {
1800
+ c = p;
1769
1801
  break;
1770
1802
  }
1771
- if (h.st <= r && r <= h.ed) {
1803
+ if (h.st <= i && i <= h.ed) {
1772
1804
  c = h;
1773
1805
  break;
1774
1806
  }
1775
1807
  }
1776
1808
  return c;
1777
1809
  }
1778
- function ke(t) {
1810
+ function Ge(t) {
1779
1811
  var d;
1780
- const e = t.get(U), n = t.get(ne), o = e.getCurrentUniverDocInstance(), i = n.getActiveRange();
1781
- if (o == null || i == null)
1812
+ const e = t.get(w), n = t.get(te), o = e.getCurrentUniverDocInstance(), r = n.getActiveRange();
1813
+ if (o == null || r == null)
1782
1814
  return;
1783
- const { startOffset: r, segmentId: s } = i, a = (d = o.getSelfOrHeaderFooterModel(s).getBody()) == null ? void 0 : d.paragraphs;
1815
+ const { startOffset: i, segmentId: s } = r, a = (d = o.getSelfOrHeaderFooterModel(s).getBody()) == null ? void 0 : d.paragraphs;
1784
1816
  if (a == null)
1785
1817
  return;
1786
1818
  let c = -1;
1787
- for (const p of a) {
1788
- const { startIndex: h } = p;
1789
- if (r > c && r <= h)
1790
- return p;
1819
+ for (const g of a) {
1820
+ const { startIndex: h } = g;
1821
+ if (i > c && i <= h)
1822
+ return g;
1791
1823
  c = h;
1792
1824
  }
1793
1825
  return null;
1794
1826
  }
1795
- var ir = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, sr = (t, e, n, o) => {
1796
- for (var i = o > 1 ? void 0 : o ? rr(e, n) : e, r = t.length - 1, s; r >= 0; r--)
1797
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
1798
- return o && i && ir(e, n, i), i;
1799
- }, J = (t, e) => (n, o) => e(n, o, t);
1800
- let Se = class extends te {
1801
- constructor(t, e, n, o, i, r, s, a) {
1802
- super(), this._config = t, this._injector = e, this._componentManager = n, this._layoutService = o, this._editorService = i, this._menuService = r, this._uiPartsService = s, this._univerInstanceService = a, this._init();
1827
+ var ni = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, ri = (t, e, n, o) => {
1828
+ for (var r = o > 1 ? void 0 : o ? oi(e, n) : e, i = t.length - 1, s; i >= 0; i--)
1829
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
1830
+ return o && r && ni(e, n, r), r;
1831
+ }, Ee = (t, e) => (n, o) => e(n, o, t);
1832
+ let me = class extends Q {
1833
+ constructor(t, e, n, o, r) {
1834
+ super(), this._config = t, this._injector = e, this._componentManager = n, this._layoutService = o, this._menuService = r, this._init();
1803
1835
  }
1804
1836
  _initCustomComponents() {
1805
1837
  const t = this._componentManager;
1806
- this.disposeWithMe(t.register(gt, Po)), this.disposeWithMe(t.register(an, Fn)), this.disposeWithMe(t.register(cn, Nn)), this.disposeWithMe(t.register(ln, Un));
1838
+ this.disposeWithMe(t.register(pt, Ao)), this.disposeWithMe(t.register(dn, $n)), this.disposeWithMe(t.register(un, Hn)), this.disposeWithMe(t.register(hn, Vn));
1807
1839
  }
1808
1840
  _initMenus() {
1809
1841
  const { menu: t = {} } = this._config;
1810
1842
  [
1811
- Hi,
1812
- Vi,
1813
- ji,
1814
- Wi,
1815
- ki,
1816
- zi,
1817
- Yi,
1818
- Gi,
1819
- Xi,
1820
- Ki,
1821
- Zi,
1822
- Ji,
1823
- qi,
1824
- Qi,
1825
- er,
1826
- tr,
1827
- nr,
1828
- or
1843
+ Br,
1844
+ $r,
1845
+ Hr,
1846
+ Vr,
1847
+ jr,
1848
+ Wr,
1849
+ Gr,
1850
+ kr,
1851
+ zr,
1852
+ Yr,
1853
+ Xr,
1854
+ Kr,
1855
+ Zr,
1856
+ Jr,
1857
+ qr,
1858
+ Qr,
1859
+ ei,
1860
+ ti
1829
1861
  ].forEach((e) => {
1830
1862
  this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e), t));
1831
1863
  });
1832
1864
  }
1833
1865
  _init() {
1834
- this._initCustomComponents(), this._initMenus(), this._initDocBackground(), this._initFocusHandler();
1835
- }
1836
- _initDocBackground() {
1837
- const t = this._univerInstanceService.getAllUnitsForType(v.UNIVER_DOC)[0].getUnitId();
1838
- if (t == null)
1839
- return;
1840
- this._editorService.isEditor(t) || this.disposeWithMe(
1841
- this._uiPartsService.registerComponent(Ln.CONTENT, () => Mo(bi, this._injector))
1842
- );
1866
+ this._initCustomComponents(), this._initMenus(), this._initFocusHandler();
1843
1867
  }
1844
1868
  _initFocusHandler() {
1845
1869
  this.disposeWithMe(
1846
1870
  this._layoutService.registerFocusHandler(v.UNIVER_DOC, () => {
1847
- this._injector.get(oe).focus();
1871
+ this._injector.get(ne).focus();
1848
1872
  })
1849
1873
  );
1850
1874
  }
1851
1875
  };
1852
- Se = sr([
1853
- Le(we.Rendered, Se),
1854
- J(1, T(Be)),
1855
- J(2, T(qt)),
1856
- J(3, Jt),
1857
- J(4, K),
1858
- J(5, wn),
1859
- J(6, Bn),
1860
- J(7, U)
1861
- ], Se);
1862
- const ar = {
1863
- id: lo.id,
1864
- preconditions: Ao,
1876
+ me = ri([
1877
+ Be($e.Rendered, me),
1878
+ Ee(1, E(Le)),
1879
+ Ee(2, E(tn)),
1880
+ Ee(3, en),
1881
+ Ee(4, jn)
1882
+ ], me);
1883
+ const ii = {
1884
+ id: go.id,
1885
+ preconditions: Fo,
1865
1886
  binding: H.ENTER
1866
- }, cr = {
1867
- id: uo.id,
1868
- preconditions: W,
1887
+ }, si = {
1888
+ id: po.id,
1889
+ preconditions: k,
1869
1890
  binding: H.BACKSPACE
1870
- }, lr = {
1871
- id: ho.id,
1872
- preconditions: W,
1891
+ }, ai = {
1892
+ id: _o.id,
1893
+ preconditions: k,
1873
1894
  binding: H.DELETE
1874
1895
  };
1875
1896
  function ze(t) {
1876
- return t.getContextValue(Ne) || t.getContextValue(Kt);
1897
+ return t.getContextValue(Ue) || t.getContextValue(qt);
1877
1898
  }
1878
- const pt = 999, dr = {
1879
- id: $n.id,
1899
+ const _t = 999, ci = {
1900
+ id: Wn.id,
1880
1901
  name: "doc.command.copy",
1881
1902
  type: de.COMMAND,
1882
1903
  multi: !0,
1883
- priority: pt,
1904
+ priority: _t,
1884
1905
  preconditions: ze,
1885
- handler: async (t) => t.get(Oe).copy()
1886
- }, ur = {
1887
- id: Hn.id,
1906
+ handler: async (t) => t.get(Re).copy()
1907
+ }, li = {
1908
+ id: kn.id,
1888
1909
  name: "doc.command.cut",
1889
1910
  type: de.COMMAND,
1890
1911
  multi: !0,
1891
- priority: pt,
1912
+ priority: _t,
1892
1913
  preconditions: ze,
1893
- handler: async (t) => t.get(Oe).cut()
1894
- }, hr = {
1895
- id: Vn.id,
1914
+ handler: async (t) => t.get(Re).cut()
1915
+ }, di = {
1916
+ id: Gn.id,
1896
1917
  name: "doc.command.paste",
1897
1918
  type: de.COMMAND,
1898
1919
  multi: !0,
1899
- priority: pt,
1920
+ priority: _t,
1900
1921
  preconditions: ze,
1901
1922
  handler: async (t) => {
1902
- const e = t.get(Oe), o = await t.get(dt).read();
1923
+ const e = t.get(Re), o = await t.get(ut).read();
1903
1924
  return o.length === 0 ? !1 : e.paste(o);
1904
1925
  }
1905
1926
  };
1906
- var gr = Object.defineProperty, pr = Object.getOwnPropertyDescriptor, fr = (t, e, n, o) => {
1907
- for (var i = o > 1 ? void 0 : o ? pr(e, n) : e, r = t.length - 1, s; r >= 0; r--)
1908
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
1909
- return o && i && gr(e, n, i), i;
1910
- }, ge = (t, e) => (n, o) => e(n, o, t);
1911
- let Me = class extends ve {
1912
- constructor(t, e, n, o, i) {
1913
- super(), this._commandService = t, this._clipboardInterfaceService = e, this._docClipboardService = n, this._textSelectionRenderManager = o, this._contextService = i, this._init();
1927
+ var ui = Object.defineProperty, hi = Object.getOwnPropertyDescriptor, gi = (t, e, n, o) => {
1928
+ for (var r = o > 1 ? void 0 : o ? hi(e, n) : e, i = t.length - 1, s; i >= 0; i--)
1929
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
1930
+ return o && r && ui(e, n, r), r;
1931
+ }, he = (t, e) => (n, o) => e(n, o, t);
1932
+ let Me = class extends Se {
1933
+ constructor(t, e, n, o, r) {
1934
+ super(), this._commandService = t, this._clipboardInterfaceService = e, this._docClipboardService = n, this._textSelectionRenderManager = o, this._contextService = r, this._init();
1914
1935
  }
1915
1936
  _init() {
1916
- [dr, ur, hr].forEach((t) => this.disposeWithMe(this._commandService.registerMultipleCommand(t))), [en, Qt].forEach((t) => this.disposeWithMe(this._commandService.registerCommand(t))), this._initLegacyPasteCommand();
1937
+ [ci, li, di].forEach((t) => this.disposeWithMe(this._commandService.registerMultipleCommand(t))), [on, nn].forEach((t) => this.disposeWithMe(this._commandService.registerCommand(t))), this._initLegacyPasteCommand();
1917
1938
  }
1918
1939
  _initLegacyPasteCommand() {
1919
1940
  var t;
1920
1941
  (t = this._textSelectionRenderManager) == null || t.onPaste$.pipe(se(this.dispose$)).subscribe((e) => {
1921
- var r, s;
1942
+ var i, s;
1922
1943
  if (!ze(this._contextService))
1923
1944
  return;
1924
1945
  e.event.preventDefault();
1925
- const n = e.event, o = (r = n.clipboardData) == null ? void 0 : r.getData("text/html"), i = (s = n.clipboardData) == null ? void 0 : s.getData("text/plain");
1926
- this._docClipboardService.legacyPaste(o, i);
1946
+ const n = e.event, o = (i = n.clipboardData) == null ? void 0 : i.getData("text/html"), r = (s = n.clipboardData) == null ? void 0 : s.getData("text/plain");
1947
+ this._docClipboardService.legacyPaste(o, r);
1927
1948
  });
1928
1949
  }
1929
1950
  };
1930
- Me = fr([
1931
- Le(we.Rendered, Me),
1932
- ge(0, O),
1933
- ge(1, dt),
1934
- ge(2, Oe),
1935
- ge(3, oe),
1936
- ge(4, Cn)
1951
+ Me = gi([
1952
+ Be($e.Rendered, Me),
1953
+ he(0, O),
1954
+ he(1, ut),
1955
+ he(2, Re),
1956
+ he(3, ne),
1957
+ he(4, Mn)
1937
1958
  ], Me);
1938
- var _r = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, Sr = (t, e, n, o) => {
1939
- for (var i = o > 1 ? void 0 : o ? mr(e, n) : e, r = t.length - 1, s; r >= 0; r--)
1940
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
1941
- return o && i && _r(e, n, i), i;
1942
- }, pe = (t, e) => (n, o) => e(n, o, t);
1943
- let xe = class extends te {
1944
- constructor(e, n, o, i, r) {
1959
+ var pi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, fi = (t, e, n, o) => {
1960
+ for (var r = o > 1 ? void 0 : o ? _i(e, n) : e, i = t.length - 1, s; i >= 0; i--)
1961
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
1962
+ return o && r && pi(e, n, r), r;
1963
+ }, ge = (t, e) => (n, o) => e(n, o, t);
1964
+ let ye = class extends Q {
1965
+ constructor(e, n, o, r, i) {
1945
1966
  super();
1946
1967
  C(this, "_initialEditors", /* @__PURE__ */ new Set());
1947
- this._univerInstanceService = e, this._editorService = n, this._commandService = o, this._textSelectionRenderManager = i, this._renderManagerService = r, this._initialize();
1968
+ this._univerInstanceService = e, this._editorService = n, this._commandService = o, this._textSelectionRenderManager = r, this._renderManagerService = i, this._initialize();
1948
1969
  }
1949
1970
  _initialize() {
1950
1971
  this.disposeWithMe(
@@ -1957,7 +1978,7 @@ let xe = class extends te {
1957
1978
  }), this._commandExecutedListener(), this._initialSetValue(), this._initialBlur(), this._initialFocus(), this._initialValueChange();
1958
1979
  }
1959
1980
  _resize(e) {
1960
- var b, M, E;
1981
+ var I, b, T;
1961
1982
  if (e == null)
1962
1983
  return;
1963
1984
  const n = this._editorService.getEditor(e);
@@ -1966,25 +1987,25 @@ let xe = class extends te {
1966
1987
  const o = this._univerInstanceService.getUniverDocInstance(e);
1967
1988
  if (!o)
1968
1989
  return;
1969
- const i = (b = this._renderManagerService.getRenderById(o.getUnitId())) == null ? void 0 : b.with(w).getSkeleton();
1970
- if (n == null || n.render == null || i == null || o == null)
1990
+ const r = (I = this._renderManagerService.getRenderById(o.getUnitId())) == null ? void 0 : I.with(L).getSkeleton();
1991
+ if (n == null || n.render == null || r == null || o == null)
1971
1992
  return;
1972
- i.calculate();
1973
- const { marginTop: r = 0, marginBottom: s = 0, marginLeft: a = 0, marginRight: c = 0 } = o.getSnapshot().documentStyle, { scene: d, mainComponent: p } = n.render;
1974
- let { actualHeight: h, actualWidth: g } = i.getActualSize();
1975
- h += r + s, g += a + c;
1976
- const { width: l, height: f } = n.getBoundingClientRect(), u = d.getViewport(ee.VIEW_MAIN);
1977
- let _ = u == null ? void 0 : u.getScrollBar();
1978
- const m = Math.max(g, l), R = Math.max(h, f);
1993
+ r.calculate();
1994
+ const { marginTop: i = 0, marginBottom: s = 0, marginLeft: a = 0, marginRight: c = 0 } = o.getSnapshot().documentStyle, { scene: d, mainComponent: g } = n.render;
1995
+ let { actualHeight: h, actualWidth: p } = r.getActualSize();
1996
+ h += i + s, p += a + c;
1997
+ const { width: l, height: _ } = n.getBoundingClientRect(), u = d.getViewport(q.VIEW_MAIN);
1998
+ let f = u == null ? void 0 : u.getScrollBar();
1999
+ const m = Math.max(p, l), R = Math.max(h, _);
1979
2000
  d.transformByState({
1980
2001
  width: m,
1981
2002
  height: R
1982
- }), p == null || p.resize(m, R), n.isSingle() ? g > l ? _ == null ? u && new et(u, { barSize: 8, enableVertical: !1 }) : u == null || u.resetCanvasSizeAndUpdateScrollBar() : (_ = null, u == null || u.scrollTo({ x: 0, y: 0 }), (E = u == null ? void 0 : u.getScrollBar()) == null || E.dispose()) : h > f ? _ == null ? u && new et(u, { enableHorizontal: !1, barSize: 8 }) : u == null || u.resetCanvasSizeAndUpdateScrollBar() : (_ = null, u == null || u.scrollTo({ x: 0, y: 0 }), (M = u == null ? void 0 : u.getScrollBar()) == null || M.dispose());
2003
+ }), g == null || g.resize(m, R), n.isSingle() ? p > l ? f == null ? u && new tt(u, { barSize: 8, enableVertical: !1 }) : u == null || u.resetCanvasSizeAndUpdateScrollBar() : (f = null, u == null || u.scrollTo({ x: 0, y: 0 }), (T = u == null ? void 0 : u.getScrollBar()) == null || T.dispose()) : h > _ ? f == null ? u && new tt(u, { enableHorizontal: !1, barSize: 8 }) : u == null || u.resetCanvasSizeAndUpdateScrollBar() : (f = null, u == null || u.scrollTo({ x: 0, y: 0 }), (b = u == null ? void 0 : u.getScrollBar()) == null || b.dispose());
1983
2004
  }
1984
2005
  _initialSetValue() {
1985
2006
  this.disposeWithMe(
1986
2007
  this._editorService.setValue$.subscribe((e) => {
1987
- this._commandService.executeCommand(go.id, {
2008
+ this._commandService.executeCommand(fo.id, {
1988
2009
  unitId: e.editorUnitId,
1989
2010
  body: e.body,
1990
2011
  segmentId: null
@@ -1999,8 +2020,8 @@ let xe = class extends te {
1999
2020
  })
2000
2021
  ), this.disposeWithMe(
2001
2022
  this._textSelectionRenderManager.onBlur$.subscribe(() => {
2002
- var i;
2003
- const e = (i = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : i.getUnitId();
2023
+ var r;
2024
+ const e = (r = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : r.getUnitId();
2004
2025
  if (e == null)
2005
2026
  return;
2006
2027
  const n = this._editorService.getEditor(e), o = this._editorService.getFocusEditor();
@@ -2021,17 +2042,17 @@ let xe = class extends te {
2021
2042
  "univer-formula-help-param"
2022
2043
  ];
2023
2044
  this.disposeWithMe(
2024
- bt(window, "mousedown").subscribe((o) => {
2025
- const r = o.target.classList[0] || "";
2026
- if (En(r, e)) {
2045
+ yt(window, "mousedown").subscribe((o) => {
2046
+ const i = o.target.classList[0] || "";
2047
+ if (yn(i, e)) {
2027
2048
  this._editorService.changeSpreadsheetFocusState(!0), o.stopPropagation();
2028
2049
  return;
2029
2050
  }
2030
2051
  this._editorService.changeSpreadsheetFocusState(!1);
2031
2052
  })
2032
2053
  ), this._univerInstanceService.getAllUnitsForType(v.UNIVER_SHEET).forEach((o) => {
2033
- const i = o.getUnitId(), r = this._renderManagerService.getRenderById(i), s = r == null ? void 0 : r.engine.getCanvas().getCanvasEle();
2034
- s != null && bt(s, "mousedown").subscribe((a) => {
2054
+ const r = o.getUnitId(), i = this._renderManagerService.getRenderById(r), s = i == null ? void 0 : i.engine.getCanvas().getCanvasEle();
2055
+ s != null && yt(s, "mousedown").subscribe((a) => {
2035
2056
  this._editorService.changeSpreadsheetFocusState(!0), a.stopPropagation();
2036
2057
  });
2037
2058
  });
@@ -2059,49 +2080,49 @@ let xe = class extends te {
2059
2080
  * Listen to document edits to refresh the size of the formula editor.
2060
2081
  */
2061
2082
  _commandExecutedListener() {
2062
- const e = [ut.id, jn.id];
2083
+ const e = [ht.id, zn.id];
2063
2084
  this.disposeWithMe(
2064
2085
  this._commandService.onCommandExecuted((n) => {
2065
2086
  if (e.includes(n.id)) {
2066
- const o = n.params, { unitId: i } = o;
2067
- if (this._editorService.isSheetEditor(i))
2087
+ const o = n.params, { unitId: r } = o;
2088
+ if (this._editorService.isSheetEditor(r))
2068
2089
  return;
2069
- this._resize(i), this._valueChange();
2090
+ this._resize(r), this._valueChange();
2070
2091
  }
2071
2092
  })
2072
2093
  );
2073
2094
  }
2074
2095
  };
2075
- xe = Sr([
2076
- Le(we.Rendered, xe),
2077
- pe(0, U),
2078
- pe(1, K),
2079
- pe(2, O),
2080
- pe(3, oe),
2081
- pe(4, j)
2082
- ], xe);
2083
- var vr = Object.defineProperty, Rr = Object.getOwnPropertyDescriptor, Or = (t, e, n, o) => {
2084
- for (var i = o > 1 ? void 0 : o ? Rr(e, n) : e, r = t.length - 1, s; r >= 0; r--)
2085
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
2086
- return o && i && vr(e, n, i), i;
2087
- }, fe = (t, e) => (n, o) => e(n, o, t);
2088
- let rt = class extends ve {
2089
- constructor(t, e, n, o, i, r) {
2090
- super(), this._context = t, this._commandService = e, this._docSkeletonManagerService = n, this._configService = o, this._editorService = i, this._renderManagerService = r, this._addNewRender(), this._initRenderRefresh(), this._initCommandListener();
2096
+ ye = fi([
2097
+ Be($e.Rendered, ye),
2098
+ ge(0, w),
2099
+ ge(1, ee),
2100
+ ge(2, O),
2101
+ ge(3, ne),
2102
+ ge(4, W)
2103
+ ], ye);
2104
+ var mi = Object.defineProperty, Si = Object.getOwnPropertyDescriptor, vi = (t, e, n, o) => {
2105
+ for (var r = o > 1 ? void 0 : o ? Si(e, n) : e, i = t.length - 1, s; i >= 0; i--)
2106
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
2107
+ return o && r && mi(e, n, r), r;
2108
+ }, pe = (t, e) => (n, o) => e(n, o, t);
2109
+ let st = class extends Se {
2110
+ constructor(t, e, n, o, r, i) {
2111
+ super(), this._context = t, this._commandService = e, this._docSkeletonManagerService = n, this._configService = o, this._editorService = r, this._renderManagerService = i, this._addNewRender(), this._initRenderRefresh(), this._initCommandListener();
2091
2112
  }
2092
2113
  reRender(t) {
2093
- var i, r;
2094
- const e = (i = this._renderManagerService.getRenderById(t)) == null ? void 0 : i.with(w), n = e == null ? void 0 : e.getSkeleton();
2114
+ var r, i;
2115
+ const e = (r = this._renderManagerService.getRenderById(t)) == null ? void 0 : r.with(L), n = e == null ? void 0 : e.getSkeleton();
2095
2116
  if (!(!n || n.getViewModel().getDataModel().getSnapshot().disabled)) {
2096
2117
  if (n.calculate(), this._editorService.isEditor(t)) {
2097
- (r = this._context.mainComponent) == null || r.makeDirty();
2118
+ (i = this._context.mainComponent) == null || i.makeDirty();
2098
2119
  return;
2099
2120
  }
2100
2121
  this._recalculateSizeBySkeleton(n);
2101
2122
  }
2102
2123
  }
2103
2124
  _addNewRender() {
2104
- const { scene: t, engine: e, unit: n } = this._context, o = new Oo(ee.VIEW_MAIN, t, {
2125
+ const { scene: t, engine: e, unit: n } = this._context, o = new To(q.VIEW_MAIN, t, {
2105
2126
  left: 0,
2106
2127
  top: 0,
2107
2128
  bottom: 0,
@@ -2114,13 +2135,13 @@ let rt = class extends ve {
2114
2135
  const c = s;
2115
2136
  if (c.ctrlKey) {
2116
2137
  const d = Math.abs(c.deltaX);
2117
- let p = d < 40 ? 0.2 : d < 80 ? 0.4 : 0.2;
2118
- p *= c.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (p /= 2), t.scaleX + p > 4 ? t.scale(4, 4) : t.scaleX + p < 0.1 ? t.scale(0.1, 0.1) : c.preventDefault();
2138
+ let g = d < 40 ? 0.2 : d < 80 ? 0.4 : 0.2;
2139
+ g *= c.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (g /= 2), t.scaleX + g > 4 ? t.scale(4, 4) : t.scaleX + g < 0.1 ? t.scale(0.1, 0.1) : c.preventDefault();
2119
2140
  } else
2120
2141
  o.onMouseWheel(c, a);
2121
- }), this._configService.getConfig("hasScroll") !== !1 && new et(o), t.addLayer(
2122
- new It(t, [], Ge),
2123
- new It(t, [], po)
2142
+ }), this._configService.getConfig("hasScroll") !== !1 && new tt(o), t.addLayer(
2143
+ new bt(t, [], Ye),
2144
+ new bt(t, [], mo)
2124
2145
  ), this._addComponent(), n.getShouldRenderLoopImmediately() && e.runRenderLoop(() => {
2125
2146
  t.render();
2126
2147
  });
@@ -2129,10 +2150,10 @@ let rt = class extends ve {
2129
2150
  const { scene: t, unit: e, components: n } = this._context, o = {
2130
2151
  pageMarginLeft: e.documentStyle.marginLeft || 0,
2131
2152
  pageMarginTop: e.documentStyle.marginTop || 0
2132
- }, i = new Co(ie.MAIN, void 0, o);
2133
- i.zIndex = Ot;
2134
- const r = new Eo(ie.BACKGROUND, void 0, o);
2135
- r.zIndex = Ot, this._context.mainComponent = i, n.set(ie.MAIN, i), n.set(ie.BACKGROUND, r), t.addObjects([i], Ge), t.addObjects([r], fo), this._editorService.getEditor(e.getUnitId()) == null && t.enableLayerCache(Ge);
2153
+ }, r = new Io(oe.MAIN, void 0, o);
2154
+ r.zIndex = Et;
2155
+ const i = new bo(oe.BACKGROUND, void 0, o);
2156
+ i.zIndex = Et, this._context.mainComponent = r, n.set(oe.MAIN, r), n.set(oe.BACKGROUND, i), t.addObjects([r], Ye), t.addObjects([i], So), this._editorService.getEditor(e.getUnitId()) == null && t.enableLayerCache(Ye);
2136
2157
  }
2137
2158
  _initRenderRefresh() {
2138
2159
  this._docSkeletonManagerService.currentSkeletonBefore$.pipe(se(this.dispose$)).subscribe((t) => {
@@ -2142,11 +2163,11 @@ let rt = class extends ve {
2142
2163
  _create(t) {
2143
2164
  if (!t)
2144
2165
  return;
2145
- const { mainComponent: e, components: n } = this._context, o = e, i = n.get(ie.BACKGROUND);
2146
- o.changeSkeleton(t), i.changeSkeleton(t), this._recalculateSizeBySkeleton(t);
2166
+ const { mainComponent: e, components: n } = this._context, o = e, r = n.get(oe.BACKGROUND);
2167
+ o.changeSkeleton(t), r.changeSkeleton(t), this._recalculateSizeBySkeleton(t);
2147
2168
  }
2148
2169
  _initCommandListener() {
2149
- const t = [ut.id];
2170
+ const t = [ht.id];
2150
2171
  this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
2151
2172
  if (t.includes(e.id)) {
2152
2173
  const n = e.params, { unitId: o } = n;
@@ -2155,33 +2176,33 @@ let rt = class extends ve {
2155
2176
  }));
2156
2177
  }
2157
2178
  _recalculateSizeBySkeleton(t) {
2158
- var p;
2159
- const { mainComponent: e, scene: n, unitId: o, components: i } = this._context, r = e, s = i.get(ie.BACKGROUND), a = (p = t.getSkeletonData()) == null ? void 0 : p.pages;
2179
+ var g;
2180
+ const { mainComponent: e, scene: n, unitId: o, components: r } = this._context, i = e, s = r.get(oe.BACKGROUND), a = (g = t.getSkeletonData()) == null ? void 0 : g.pages;
2160
2181
  if (a == null)
2161
2182
  return;
2162
2183
  let c = 0, d = 0;
2163
- for (let h = 0, g = a.length; h < g; h++) {
2164
- const l = a[h], { pageWidth: f, pageHeight: u } = l;
2165
- r.pageLayoutType === De.VERTICAL ? (d += u, d += r.pageMarginTop, h === g - 1 && (d += r.pageMarginTop), c = Math.max(c, f)) : r.pageLayoutType === De.HORIZONTAL && (c += f, h !== g - 1 && (c += r.pageMarginLeft), d = Math.max(d, u));
2184
+ for (let h = 0, p = a.length; h < p; h++) {
2185
+ const l = a[h], { pageWidth: _, pageHeight: u } = l;
2186
+ i.pageLayoutType === Ae.VERTICAL ? (d += u, d += i.pageMarginTop, h === p - 1 && (d += i.pageMarginTop), c = Math.max(c, _)) : i.pageLayoutType === Ae.HORIZONTAL && (c += _, h !== p - 1 && (c += i.pageMarginLeft), d = Math.max(d, u));
2166
2187
  }
2167
- r.resize(c, d), s.resize(c, d), this._editorService.isEditor(o) || n.resize(c, d);
2188
+ i.resize(c, d), s.resize(c, d), this._editorService.isEditor(o) || n.resize(c, d);
2168
2189
  }
2169
2190
  };
2170
- rt = Or([
2171
- fe(1, O),
2172
- fe(2, T(w)),
2173
- fe(3, In),
2174
- fe(4, K),
2175
- fe(5, j)
2176
- ], rt);
2177
- var Cr = Object.defineProperty, Er = Object.getOwnPropertyDescriptor, Ir = (t, e, n, o) => {
2178
- for (var i = o > 1 ? void 0 : o ? Er(e, n) : e, r = t.length - 1, s; r >= 0; r--)
2179
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
2180
- return o && i && Cr(e, n, i), i;
2191
+ st = vi([
2192
+ pe(1, O),
2193
+ pe(2, E(L)),
2194
+ pe(3, xn),
2195
+ pe(4, ee),
2196
+ pe(5, W)
2197
+ ], st);
2198
+ var Ri = Object.defineProperty, Oi = Object.getOwnPropertyDescriptor, Ci = (t, e, n, o) => {
2199
+ for (var r = o > 1 ? void 0 : o ? Oi(e, n) : e, i = t.length - 1, s; i >= 0; i--)
2200
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
2201
+ return o && r && Ri(e, n, r), r;
2181
2202
  }, _e = (t, e) => (n, o) => e(n, o, t);
2182
- let st = class extends te {
2183
- constructor(t, e, n, o, i, r) {
2184
- super(), this._context = t, this._docSkeletonManagerService = e, this._univerInstanceService = n, this._commandService = o, this._textSelectionManagerService = i, this._editorService = r, this._init();
2203
+ let at = class extends Q {
2204
+ constructor(t, e, n, o, r, i) {
2205
+ super(), this._context = t, this._docSkeletonManagerService = e, this._univerInstanceService = n, this._commandService = o, this._textSelectionManagerService = r, this._editorService = i, this._init();
2185
2206
  }
2186
2207
  _init() {
2187
2208
  this._initSkeletonListener(), this._initCommandExecutedListener(), this._initRenderRefresher(), setTimeout(() => this._updateViewZoom(1, !0), 20);
@@ -2194,17 +2215,17 @@ let st = class extends te {
2194
2215
  this._editorService.isEditor(e) || this.disposeWithMe(n.onMouseWheel$.subscribeEvent((o) => {
2195
2216
  if (!o.ctrlKey)
2196
2217
  return;
2197
- const i = this._univerInstanceService.getCurrentUniverDocInstance();
2198
- if (!i)
2218
+ const r = this._univerInstanceService.getCurrentUniverDocInstance();
2219
+ if (!r)
2199
2220
  return;
2200
- const r = Math.abs(o.deltaX);
2201
- let s = r < 40 ? 0.2 : r < 80 ? 0.4 : 0.2;
2221
+ const i = Math.abs(o.deltaX);
2222
+ let s = i < 40 ? 0.2 : i < 80 ? 0.4 : 0.2;
2202
2223
  s *= o.deltaY > 0 ? -1 : 1, n.scaleX < 1 && (s /= 2);
2203
- const a = i.zoomRatio;
2224
+ const a = r.zoomRatio;
2204
2225
  let c = +Number.parseFloat(`${a + s}`).toFixed(1);
2205
- c = c >= 4 ? 4 : c <= 0.1 ? 0.1 : c, this._commandService.executeCommand(_o.id, {
2226
+ c = c >= 4 ? 4 : c <= 0.1 ? 0.1 : c, this._commandService.executeCommand(vo.id, {
2206
2227
  zoomRatio: c,
2207
- unitId: i.getUnitId()
2228
+ unitId: r.getUnitId()
2208
2229
  }), o.preventDefault();
2209
2230
  }));
2210
2231
  });
@@ -2220,34 +2241,34 @@ let st = class extends te {
2220
2241
  }));
2221
2242
  }
2222
2243
  _initCommandExecutedListener() {
2223
- const t = [Pe.id];
2244
+ const t = [De.id];
2224
2245
  this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
2225
2246
  if (t.includes(e.id)) {
2226
2247
  const n = this._univerInstanceService.getCurrentUniverDocInstance();
2227
2248
  if (!n) return;
2228
- const o = e.params, { unitId: i } = o;
2229
- if (i !== n.getUnitId())
2249
+ const o = e.params, { unitId: r } = o;
2250
+ if (r !== n.getUnitId())
2230
2251
  return;
2231
- const r = n.zoomRatio || 1;
2232
- this._updateViewZoom(r);
2252
+ const i = n.zoomRatio || 1;
2253
+ this._updateViewZoom(i);
2233
2254
  }
2234
2255
  }));
2235
2256
  }
2236
2257
  _updateViewZoom(t, e = !0) {
2237
2258
  var o;
2238
- const n = q(this._context);
2259
+ const n = J(this._context);
2239
2260
  n.scene.scale(t, t), this._calculatePagePosition(n, t), e && this._textSelectionManagerService.refreshSelection(), (o = n.scene.getTransformer()) == null || o.clearSelectedObjects();
2240
2261
  }
2241
2262
  _calculatePagePosition(t, e) {
2242
- const { document: n, scene: o, docBackground: i } = t, r = o == null ? void 0 : o.getParent(), { width: s, height: a, pageMarginLeft: c, pageMarginTop: d } = n;
2243
- if (r == null || s === Number.POSITIVE_INFINITY || a === Number.POSITIVE_INFINITY)
2263
+ const { document: n, scene: o, docBackground: r } = t, i = o == null ? void 0 : o.getParent(), { width: s, height: a, pageMarginLeft: c, pageMarginTop: d } = n;
2264
+ if (i == null || s === Number.POSITIVE_INFINITY || a === Number.POSITIVE_INFINITY)
2244
2265
  return;
2245
- const { width: p, height: h } = r;
2246
- let g = 0, l = 0, f = 0, u = 0, _ = Number.POSITIVE_INFINITY;
2247
- p > (s + c * 2) * e ? (g = p / 2 - s * e / 2, g /= e, f = (p - c * 2) / e, _ = 0) : (g = c, f = s + c * 2, _ = (f - p / e) / 2), h > a ? (l = h / 2 - a / 2, u = (h - d * 2) / e) : (l = d, u = a + d * 2), o.resize(f, u + 200), n.translate(g, l), i.translate(g, l);
2248
- const m = o.getViewport(ee.VIEW_MAIN);
2249
- if (_ !== Number.POSITIVE_INFINITY && m != null) {
2250
- const R = m.transViewportScroll2ScrollValue(_, 0).x;
2266
+ const { width: g, height: h } = i;
2267
+ let p = 0, l = 0, _ = 0, u = 0, f = Number.POSITIVE_INFINITY;
2268
+ g > (s + c * 2) * e ? (p = g / 2 - s * e / 2, p /= e, _ = (g - c * 2) / e, f = 0) : (p = c, _ = s + c * 2, f = (_ - g / e) / 2), h > a ? (l = h / 2 - a / 2, u = (h - d * 2) / e) : (l = d, u = a + d * 2), o.resize(_, u + 200), n.translate(p, l), r.translate(p, l);
2269
+ const m = o.getViewport(q.VIEW_MAIN);
2270
+ if (f !== Number.POSITIVE_INFINITY && m != null) {
2271
+ const R = m.transViewportScroll2ScrollValue(f, 0).x;
2251
2272
  m.scrollTo({
2252
2273
  x: R
2253
2274
  });
@@ -2255,76 +2276,76 @@ let st = class extends te {
2255
2276
  return this;
2256
2277
  }
2257
2278
  };
2258
- st = Ir([
2259
- _e(1, T(w)),
2260
- _e(2, U),
2279
+ at = Ci([
2280
+ _e(1, E(L)),
2281
+ _e(2, w),
2261
2282
  _e(3, O),
2262
- _e(4, T(ne)),
2263
- _e(5, K)
2264
- ], st);
2265
- var Tr = Object.defineProperty, br = Object.getOwnPropertyDescriptor, Mr = (t, e, n, o) => {
2266
- for (var i = o > 1 ? void 0 : o ? br(e, n) : e, r = t.length - 1, s; r >= 0; r--)
2267
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
2268
- return o && i && Tr(e, n, i), i;
2269
- }, re = (t, e) => (n, o) => e(n, o, t);
2270
- let at = class extends te {
2271
- constructor(e, n, o, i, r, s, a) {
2283
+ _e(4, E(te)),
2284
+ _e(5, ee)
2285
+ ], at);
2286
+ var Ei = Object.defineProperty, Ti = Object.getOwnPropertyDescriptor, Ii = (t, e, n, o) => {
2287
+ for (var r = o > 1 ? void 0 : o ? Ti(e, n) : e, i = t.length - 1, s; i >= 0; i--)
2288
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
2289
+ return o && r && Ei(e, n, r), r;
2290
+ }, ie = (t, e) => (n, o) => e(n, o, t);
2291
+ let ct = class extends Q {
2292
+ constructor(e, n, o, r, i, s, a) {
2272
2293
  super();
2273
2294
  C(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
2274
- this._context = e, this._commandService = n, this._editorService = o, this._instanceSrv = i, this._textSelectionRenderManager = r, this._docSkeletonManagerService = s, this._textSelectionManagerService = a, this._initialize();
2295
+ this._context = e, this._commandService = n, this._editorService = o, this._instanceSrv = r, this._textSelectionRenderManager = i, this._docSkeletonManagerService = s, this._textSelectionManagerService = a, this._initialize();
2275
2296
  }
2276
2297
  _initialize() {
2277
2298
  this._init(), this._skeletonListener(), this._commandExecutedListener();
2278
2299
  }
2279
2300
  _init() {
2280
- const { unitId: e } = this._context, n = q(this._context);
2301
+ const { unitId: e } = this._context, n = J(this._context);
2281
2302
  n == null || n.document == null || this._loadedMap.has(n.document) || (this._initialMain(e), this._loadedMap.add(n.document));
2282
2303
  }
2283
2304
  // eslint-disable-next-line max-lines-per-function
2284
2305
  _initialMain(e) {
2285
- const n = q(this._context), { document: o, scene: i } = n;
2306
+ const n = J(this._context), { document: o, scene: r } = n;
2286
2307
  this.disposeWithMe(o.onPointerEnter$.subscribeEvent(() => {
2287
- this._isEditorReadOnly(e) || (o.cursor = Tt.TEXT);
2308
+ this._isEditorReadOnly(e) || (o.cursor = Mt.TEXT);
2288
2309
  })), this.disposeWithMe(o.onPointerLeave$.subscribeEvent(() => {
2289
- o.cursor = Tt.DEFAULT, i.resetCursor();
2290
- })), this.disposeWithMe(o.onPointerDown$.subscribeEvent((r, s) => {
2310
+ o.cursor = Mt.DEFAULT, r.resetCursor();
2311
+ })), this.disposeWithMe(o.onPointerDown$.subscribeEvent((i, s) => {
2291
2312
  if (this._isEditorReadOnly(e))
2292
2313
  return;
2293
2314
  const a = this._instanceSrv.getCurrentUnitForType(v.UNIVER_DOC);
2294
2315
  (a == null ? void 0 : a.getUnitId()) !== e && this._instanceSrv.setCurrentUnitForType(e);
2295
- const c = this._docSkeletonManagerService.getSkeleton(), { offsetX: d, offsetY: p } = r, h = this._getTransformCoordForDocumentOffset(d, p);
2316
+ const c = this._docSkeletonManagerService.getSkeleton(), { offsetX: d, offsetY: g } = i, h = this._getTransformCoordForDocumentOffset(d, g);
2296
2317
  if (h != null) {
2297
2318
  const {
2298
- pageLayoutType: g = De.VERTICAL,
2319
+ pageLayoutType: p = Ae.VERTICAL,
2299
2320
  pageMarginLeft: l,
2300
- pageMarginTop: f
2321
+ pageMarginTop: _
2301
2322
  } = o.getOffsetConfig(), { editArea: u } = c.findEditAreaByCoord(
2302
2323
  h,
2303
- g,
2324
+ p,
2304
2325
  l,
2305
- f
2306
- ), _ = this._docSkeletonManagerService.getViewModel(), m = _.getEditArea();
2307
- m !== N.BODY && u !== N.BODY && u !== m && _.setEditArea(u);
2326
+ _
2327
+ ), f = this._docSkeletonManagerService.getViewModel(), m = f.getEditArea();
2328
+ m !== F.BODY && u !== F.BODY && u !== m && f.setEditArea(u);
2308
2329
  }
2309
- if (this._textSelectionRenderManager.eventTrigger(r), this._editorService.getEditor(e)) {
2330
+ if (this._textSelectionRenderManager.eventTrigger(i), this._editorService.getEditor(e)) {
2310
2331
  this._setEditorFocus(e);
2311
- const { offsetX: g, offsetY: l } = r;
2332
+ const { offsetX: p, offsetY: l } = i;
2312
2333
  setTimeout(() => {
2313
- this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(g, l);
2334
+ this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(p, l);
2314
2335
  }, 0);
2315
2336
  }
2316
- r.button !== 2 && s.stopPropagation();
2317
- })), this.disposeWithMe(o.onDblclick$.subscribeEvent((r) => {
2318
- this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(r);
2319
- })), this.disposeWithMe(o.onTripleClick$.subscribeEvent((r) => {
2320
- this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(r);
2337
+ i.button !== 2 && s.stopPropagation();
2338
+ })), this.disposeWithMe(o.onDblclick$.subscribeEvent((i) => {
2339
+ this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(i);
2340
+ })), this.disposeWithMe(o.onTripleClick$.subscribeEvent((i) => {
2341
+ this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(i);
2321
2342
  }));
2322
2343
  }
2323
2344
  _getTransformCoordForDocumentOffset(e, n) {
2324
- const o = q(this._context), { document: i, scene: r } = o, { documentTransform: s } = i.getOffsetConfig(), a = r.getViewports()[0];
2345
+ const o = J(this._context), { document: r, scene: i } = o, { documentTransform: s } = r.getOffsetConfig(), a = i.getViewports()[0];
2325
2346
  if (a == null)
2326
2347
  return;
2327
- const c = a.transformVector2SceneCoord(nn.FromArray([e, n]));
2348
+ const c = a.transformVector2SceneCoord(sn.FromArray([e, n]));
2328
2349
  return s.clone().invert().applyPoint(c);
2329
2350
  }
2330
2351
  _isEditorReadOnly(e) {
@@ -2335,13 +2356,13 @@ let at = class extends te {
2335
2356
  this._editorService.focusStyle(e);
2336
2357
  }
2337
2358
  _commandExecutedListener() {
2338
- const e = [Pe.id];
2359
+ const e = [De.id];
2339
2360
  this.disposeWithMe(
2340
2361
  this._commandService.onCommandExecuted((n) => {
2341
2362
  var o;
2342
2363
  if (e.includes(n.id)) {
2343
- const i = n.params, { unitId: r } = i, s = (o = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : o.unitId;
2344
- if (r !== s)
2364
+ const r = n.params, { unitId: i } = r, s = (o = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : o.unitId;
2365
+ if (i !== s)
2345
2366
  return;
2346
2367
  this._textSelectionManagerService.refreshSelection();
2347
2368
  }
@@ -2353,11 +2374,11 @@ let at = class extends te {
2353
2374
  this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
2354
2375
  if (e == null)
2355
2376
  return;
2356
- const { scene: n, mainComponent: o, unitId: i } = this._context;
2377
+ const { scene: n, mainComponent: o, unitId: r } = this._context;
2357
2378
  this._textSelectionRenderManager.changeRuntime(e, n, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
2358
- unitId: i,
2379
+ unitId: r,
2359
2380
  subUnitId: ""
2360
- }), this._editorService.isEditor(i) || this._textSelectionManagerService.replaceTextRanges([
2381
+ }), Pn(r) || this._textSelectionManagerService.replaceTextRanges([
2361
2382
  {
2362
2383
  startOffset: 0,
2363
2384
  endOffset: 0
@@ -2367,21 +2388,21 @@ let at = class extends te {
2367
2388
  );
2368
2389
  }
2369
2390
  };
2370
- at = Mr([
2371
- re(1, O),
2372
- re(2, K),
2373
- re(3, U),
2374
- re(4, oe),
2375
- re(5, T(w)),
2376
- re(6, T(ne))
2377
- ], at);
2378
- var xr = Object.defineProperty, yr = Object.getOwnPropertyDescriptor, Pr = (t, e, n, o) => {
2379
- for (var i = o > 1 ? void 0 : o ? yr(e, n) : e, r = t.length - 1, s; r >= 0; r--)
2380
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
2381
- return o && i && xr(e, n, i), i;
2382
- }, Ie = (t, e) => (n, o) => e(n, o, t);
2383
- function jt(t, e) {
2384
- const n = Wt(t.left, t.top, e), o = Wt(t.right, t.bottom, e);
2391
+ ct = Ii([
2392
+ ie(1, O),
2393
+ ie(2, ee),
2394
+ ie(3, w),
2395
+ ie(4, ne),
2396
+ ie(5, E(L)),
2397
+ ie(6, E(te))
2398
+ ], ct);
2399
+ var bi = Object.defineProperty, Mi = Object.getOwnPropertyDescriptor, yi = (t, e, n, o) => {
2400
+ for (var r = o > 1 ? void 0 : o ? Mi(e, n) : e, i = t.length - 1, s; i >= 0; i--)
2401
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
2402
+ return o && r && bi(e, n, r), r;
2403
+ }, Te = (t, e) => (n, o) => e(n, o, t);
2404
+ function kt(t, e) {
2405
+ const n = Gt(t.left, t.top, e), o = Gt(t.right, t.bottom, e);
2385
2406
  return {
2386
2407
  left: n.x,
2387
2408
  top: n.y,
@@ -2389,79 +2410,79 @@ function jt(t, e) {
2389
2410
  bottom: o.y
2390
2411
  };
2391
2412
  }
2392
- function Wt(t, e, n) {
2393
- const { scaleX: o, scaleY: i } = n.getAncestorScale(), r = n.getViewport(ee.VIEW_MAIN);
2394
- if (!r)
2413
+ function Gt(t, e, n) {
2414
+ const { scaleX: o, scaleY: r } = n.getAncestorScale(), i = n.getViewport(q.VIEW_MAIN);
2415
+ if (!i)
2395
2416
  return {
2396
2417
  x: t,
2397
2418
  y: e
2398
2419
  };
2399
- const { viewportScrollX: s, viewportScrollY: a } = r, c = (t - s) * o, d = (e - a) * i;
2420
+ const { viewportScrollX: s, viewportScrollY: a } = i, c = (t - s) * o, d = (e - a) * r;
2400
2421
  return {
2401
2422
  x: c,
2402
2423
  y: d
2403
2424
  };
2404
2425
  }
2405
- let ct = class extends te {
2426
+ let lt = class extends Q {
2406
2427
  constructor(t, e, n, o) {
2407
2428
  super(), this._globalPopupManagerService = t, this._renderManagerService = e, this._univerInstanceService = n, this._commandService = o;
2408
2429
  }
2409
2430
  // #region attach to object
2410
2431
  _createObjectPositionObserver(t, e) {
2411
2432
  const n = () => {
2412
- const { scene: a, engine: c } = e, { left: d, top: p, width: h, height: g } = t, l = {
2433
+ const { scene: a, engine: c } = e, { left: d, top: g, width: h, height: p } = t, l = {
2413
2434
  left: d,
2414
2435
  right: d + h,
2415
- top: p,
2416
- bottom: p + g
2417
- }, f = jt(l, a), u = c.getCanvasElement().getBoundingClientRect().top;
2436
+ top: g,
2437
+ bottom: g + p
2438
+ }, _ = kt(l, a), u = c.getCanvasElement().getBoundingClientRect().top;
2418
2439
  return {
2419
- left: f.left,
2420
- right: f.right,
2421
- top: f.top + u,
2422
- bottom: f.bottom
2440
+ left: _.left,
2441
+ right: _.right,
2442
+ top: _.top + u,
2443
+ bottom: _.bottom + u
2423
2444
  };
2424
- }, o = n(), i = new Mt(o), r = new _t();
2425
- r.add(this._commandService.onCommandExecuted((a) => {
2426
- a.id === Pe.id && i.next(n());
2445
+ }, o = n(), r = new xt(o), i = new St();
2446
+ i.add(this._commandService.onCommandExecuted((a) => {
2447
+ a.id === De.id && r.next(n());
2427
2448
  }));
2428
- const s = e.scene.getViewport(ee.VIEW_MAIN);
2429
- return s && r.add(s.onScrollAfter$.subscribeEvent(() => {
2430
- i.next(n());
2449
+ const s = e.scene.getViewport(q.VIEW_MAIN);
2450
+ return s && i.add(s.onScrollAfter$.subscribeEvent(() => {
2451
+ r.next(n());
2431
2452
  })), {
2432
2453
  position: o,
2433
- position$: i,
2434
- disposable: r
2454
+ position$: r,
2455
+ disposable: i
2435
2456
  };
2436
2457
  }
2437
2458
  _createRangePositionObserver(t, e) {
2438
2459
  var a;
2439
2460
  const n = () => {
2440
- const { scene: c, mainComponent: d, engine: p } = e, h = e.with(w).getSkeleton(), g = h.findNodePositionByCharIndex(t.startOffset), l = h.findNodePositionByCharIndex(t.endOffset), f = d;
2441
- if (!l || !g)
2461
+ const { scene: c, mainComponent: d, engine: g } = e, h = e.with(L).getSkeleton(), p = h.findNodePositionByCharIndex(t.startOffset), l = h.findNodePositionByCharIndex(t.endOffset), _ = d;
2462
+ if (!l || !p)
2442
2463
  return;
2443
- const u = f.getOffsetConfig(), { docsLeft: _, docsTop: m } = u, R = p.getCanvasElement().getBoundingClientRect().top, b = new tn(u, h), { borderBoxPointGroup: M } = b.getRangePointData(g, l);
2444
- return Io(M).map((F) => jt(F, c)).map((F) => ({
2445
- left: F.left + _,
2446
- right: F.right + _,
2447
- top: F.top + m + R,
2448
- bottom: F.bottom + m
2464
+ const u = _.getOffsetConfig(), { docsLeft: f, docsTop: m } = u, R = g.getCanvasElement().getBoundingClientRect().top, I = new rn(u, h), { borderBoxPointGroup: b } = I.getRangePointData(p, l);
2465
+ return Mo(b).map((N) => kt(N, c)).map((N) => ({
2466
+ left: N.left + f,
2467
+ right: N.right + f,
2468
+ top: N.top + m + R,
2469
+ bottom: N.bottom + m + R
2449
2470
  }));
2450
- }, o = (a = n()) != null ? a : [], i = new Mt(o), r = new _t();
2451
- r.add(this._commandService.onCommandExecuted((c) => {
2452
- if (c.id === Pe.id) {
2471
+ }, o = (a = n()) != null ? a : [], r = new xt(o), i = new St();
2472
+ i.add(this._commandService.onCommandExecuted((c) => {
2473
+ if (c.id === De.id) {
2453
2474
  const d = n();
2454
- d && i.next(d);
2475
+ d && r.next(d);
2455
2476
  }
2456
2477
  }));
2457
- const s = e.scene.getViewport(ee.VIEW_MAIN);
2458
- return s && r.add(s.onScrollAfter$.subscribeEvent(() => {
2478
+ const s = e.scene.getViewport(q.VIEW_MAIN);
2479
+ return s && i.add(s.onScrollAfter$.subscribeEvent(() => {
2459
2480
  const c = n();
2460
- c && i.next(c);
2481
+ c && r.next(c);
2461
2482
  })), {
2462
2483
  positions: o,
2463
- positions$: i,
2464
- disposable: r
2484
+ positions$: r,
2485
+ disposable: i
2465
2486
  };
2466
2487
  }
2467
2488
  /**
@@ -2471,17 +2492,17 @@ let ct = class extends te {
2471
2492
  * @returns disposable
2472
2493
  */
2473
2494
  attachPopupToObject(t, e) {
2474
- const o = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC).getUnitId(), i = this._renderManagerService.getRenderById(o);
2475
- if (!i)
2495
+ const o = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC).getUnitId(), r = this._renderManagerService.getRenderById(o);
2496
+ if (!r)
2476
2497
  return {
2477
2498
  dispose: () => {
2478
2499
  }
2479
2500
  };
2480
- const { position: r, position$: s, disposable: a } = this._createObjectPositionObserver(t, i), c = this._globalPopupManagerService.addPopup({
2501
+ const { position: i, position$: s, disposable: a } = this._createObjectPositionObserver(t, r), c = this._globalPopupManagerService.addPopup({
2481
2502
  ...e,
2482
2503
  unitId: o,
2483
2504
  subUnitId: "default",
2484
- anchorRect: r,
2505
+ anchorRect: i,
2485
2506
  anchorRect$: s
2486
2507
  });
2487
2508
  return {
@@ -2491,41 +2512,41 @@ let ct = class extends te {
2491
2512
  };
2492
2513
  }
2493
2514
  attachPopupToRange(t, e) {
2494
- const o = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC).getUnitId(), { direction: i = "top" } = e, r = this._renderManagerService.getRenderById(o);
2495
- if (!r)
2515
+ const o = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC).getUnitId(), { direction: r = "top" } = e, i = this._renderManagerService.getRenderById(o);
2516
+ if (!i)
2496
2517
  return {
2497
2518
  dispose: () => {
2498
2519
  }
2499
2520
  };
2500
- const { positions: s, positions$: a, disposable: c } = this._createRangePositionObserver(t, r), d = a.pipe(bo((h) => i === "top" ? h[0] : h[h.length - 1])), p = this._globalPopupManagerService.addPopup({
2521
+ const { positions: s, positions$: a, disposable: c } = this._createRangePositionObserver(t, i), d = a.pipe(xo((h) => r === "top" ? h[0] : h[h.length - 1])), g = this._globalPopupManagerService.addPopup({
2501
2522
  ...e,
2502
2523
  unitId: o,
2503
2524
  subUnitId: "default",
2504
- anchorRect: i === "top" ? s[0] : s[s.length - 1],
2525
+ anchorRect: r === "top" ? s[0] : s[s.length - 1],
2505
2526
  anchorRect$: d,
2506
2527
  excludeRects: s,
2507
2528
  excludeRects$: a,
2508
- direction: i === "top" ? "top" : "bottom"
2529
+ direction: r === "top" ? "top" : "bottom"
2509
2530
  });
2510
2531
  return {
2511
2532
  dispose: () => {
2512
- this._globalPopupManagerService.removePopup(p), a.complete(), c.dispose();
2533
+ this._globalPopupManagerService.removePopup(g), a.complete(), c.dispose();
2513
2534
  }
2514
2535
  };
2515
2536
  }
2516
2537
  };
2517
- ct = Pr([
2518
- Ie(0, T(Wn)),
2519
- Ie(1, j),
2520
- Ie(2, U),
2521
- Ie(3, O)
2522
- ], ct);
2523
- var Dr = Object.defineProperty, Ar = Object.getOwnPropertyDescriptor, Fr = (t, e, n, o) => {
2524
- for (var i = o > 1 ? void 0 : o ? Ar(e, n) : e, r = t.length - 1, s; r >= 0; r--)
2525
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
2526
- return o && i && Dr(e, n, i), i;
2527
- }, kt = (t, e) => (n, o) => e(n, o, t);
2528
- let ye = class extends ve {
2538
+ lt = yi([
2539
+ Te(0, E(Yn)),
2540
+ Te(1, W),
2541
+ Te(2, w),
2542
+ Te(3, O)
2543
+ ], lt);
2544
+ var xi = Object.defineProperty, Pi = Object.getOwnPropertyDescriptor, Di = (t, e, n, o) => {
2545
+ for (var r = o > 1 ? void 0 : o ? Pi(e, n) : e, i = t.length - 1, s; i >= 0; i--)
2546
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
2547
+ return o && r && xi(e, n, r), r;
2548
+ }, zt = (t, e) => (n, o) => e(n, o, t);
2549
+ let xe = class extends Se {
2529
2550
  constructor(t, e) {
2530
2551
  super(), this._instanceSrv = t, this._renderManagerService = e, this._init();
2531
2552
  }
@@ -2544,19 +2565,19 @@ let ye = class extends ve {
2544
2565
  this._renderManagerService.removeRender(e);
2545
2566
  }
2546
2567
  };
2547
- ye = Fr([
2548
- Le(we.Ready, ye),
2549
- kt(0, U),
2550
- kt(1, j)
2551
- ], ye);
2552
- var Nr = Object.defineProperty, Ur = Object.getOwnPropertyDescriptor, Lr = (t, e, n, o) => {
2553
- for (var i = o > 1 ? void 0 : o ? Ur(e, n) : e, r = t.length - 1, s; r >= 0; r--)
2554
- (s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
2555
- return o && i && Nr(e, n, i), i;
2556
- }, Je = (t, e) => (n, o) => e(n, o, t), Te;
2557
- let zt = (Te = class extends Tn {
2568
+ xe = Di([
2569
+ Be($e.Ready, xe),
2570
+ zt(0, w),
2571
+ zt(1, W)
2572
+ ], xe);
2573
+ var Ai = Object.defineProperty, Ni = Object.getOwnPropertyDescriptor, Fi = (t, e, n, o) => {
2574
+ for (var r = o > 1 ? void 0 : o ? Ni(e, n) : e, i = t.length - 1, s; i >= 0; i--)
2575
+ (s = t[i]) && (r = (o ? s(e, n, r) : s(r)) || r);
2576
+ return o && r && Ai(e, n, r), r;
2577
+ }, qe = (t, e) => (n, o) => e(n, o, t), Ie;
2578
+ let Yt = (Ie = class extends Dn {
2558
2579
  constructor(t, e, n, o) {
2559
- super(), this._config = t, this._injector = e, this._renderManagerSrv = n, this._logService = o, this._config = Q.deepMerge({}, ti, this._config), this._initDependencies(e), this._initializeCommands();
2580
+ super(), this._config = t, this._injector = e, this._renderManagerSrv = n, this._logService = o, this._config = j.deepMerge({}, nr, this._config), this._initDependencies(e), this._initializeCommands();
2560
2581
  }
2561
2582
  onReady() {
2562
2583
  this._initRenderBasics();
@@ -2566,35 +2587,35 @@ let zt = (Te = class extends Tn {
2566
2587
  }
2567
2588
  _initializeCommands() {
2568
2589
  [
2569
- oi,
2570
- ii,
2571
- si,
2572
- ri,
2573
- ai,
2574
- ci,
2575
- li,
2576
- di,
2577
- ui,
2590
+ rr,
2591
+ ir,
2592
+ ar,
2593
+ sr,
2578
2594
  cr,
2579
2595
  lr,
2580
- ar
2596
+ dr,
2597
+ ur,
2598
+ hr,
2599
+ si,
2600
+ ai,
2601
+ ii
2581
2602
  ].forEach((t) => {
2582
- this._injector.get(kn).registerShortcut(t);
2603
+ this._injector.get(Xn).registerShortcut(t);
2583
2604
  });
2584
2605
  }
2585
2606
  _initDependencies(t) {
2586
2607
  [
2587
- [Se, { useFactory: () => this._injector.createInstance(Se, this._config) }],
2608
+ [me, { useFactory: () => this._injector.createInstance(me, this._config) }],
2588
2609
  [Me],
2589
- [xe],
2590
2610
  [ye],
2591
- [me, { useFactory: () => this._injector.createInstance(me, this._config) }],
2592
- [Oe, { useClass: tt }],
2593
- [ct]
2611
+ [xe],
2612
+ [fe, { useFactory: () => this._injector.createInstance(fe, this._config) }],
2613
+ [Re, { useClass: nt }],
2614
+ [lt]
2594
2615
  ].forEach((n) => t.add(n));
2595
2616
  }
2596
2617
  _markDocAsFocused() {
2597
- const t = this._injector.get(U), e = this._injector.get(K);
2618
+ const t = this._injector.get(w), e = this._injector.get(ee);
2598
2619
  try {
2599
2620
  const n = t.getCurrentUnitForType(v.UNIVER_DOC);
2600
2621
  if (!n) return;
@@ -2605,34 +2626,34 @@ let zt = (Te = class extends Tn {
2605
2626
  }
2606
2627
  }
2607
2628
  _initUI() {
2608
- this._injector.get(me);
2629
+ this._injector.get(fe);
2609
2630
  }
2610
2631
  _initRenderBasics() {
2611
2632
  [
2612
- [w],
2613
- [mo],
2614
- [rt],
2615
- [st]
2633
+ [L],
2634
+ [Ro],
2635
+ [st],
2636
+ [at]
2616
2637
  ].forEach((t) => {
2617
2638
  this._renderManagerSrv.registerRenderModule(v.UNIVER_DOC, t);
2618
2639
  });
2619
2640
  }
2620
2641
  _initRenderModules() {
2621
2642
  [
2622
- [nt],
2623
- [at],
2643
+ [ot],
2644
+ [ct],
2624
2645
  [it]
2625
2646
  ].forEach((t) => {
2626
2647
  this._renderManagerSrv.registerRenderModule(v.UNIVER_DOC, t);
2627
2648
  });
2628
2649
  }
2629
- }, C(Te, "pluginName", ni), C(Te, "type", v.UNIVER_DOC), Te);
2630
- zt = Lr([
2631
- Je(1, T(Be)),
2632
- Je(2, j),
2633
- Je(3, Yt)
2634
- ], zt);
2635
- function Xr(t) {
2650
+ }, C(Ie, "pluginName", or), C(Ie, "type", v.UNIVER_DOC), Ie);
2651
+ Yt = Fi([
2652
+ qe(1, E(Le)),
2653
+ qe(2, W),
2654
+ qe(3, Zt)
2655
+ ], Yt);
2656
+ function ki(t) {
2636
2657
  return {
2637
2658
  left: t.positionH.posOffset,
2638
2659
  top: t.positionV.posOffset,
@@ -2640,41 +2661,41 @@ function Xr(t) {
2640
2661
  height: t.size.height
2641
2662
  };
2642
2663
  }
2643
- function Kr(t, e = 0, n = 0) {
2664
+ function Gi(t, e = 0, n = 0) {
2644
2665
  return {
2645
2666
  size: {
2646
2667
  width: t.width,
2647
2668
  height: t.height
2648
2669
  },
2649
2670
  positionH: {
2650
- relativeFrom: bn.MARGIN,
2671
+ relativeFrom: An.MARGIN,
2651
2672
  posOffset: (t.left || 0) - e
2652
2673
  },
2653
2674
  positionV: {
2654
- relativeFrom: Mn.PAGE,
2675
+ relativeFrom: Nn.PAGE,
2655
2676
  posOffset: (t.top || 0) - n
2656
2677
  },
2657
2678
  angle: t.angle || 0
2658
2679
  };
2659
2680
  }
2660
2681
  export {
2661
- ni as DOC_UI_PLUGIN_NAME,
2662
- ei as DefaultDocContainerConfig,
2663
- ti as DefaultDocUiConfig,
2664
- Qo as DefaultToolbarConfig,
2665
- nt as DocBackScrollRenderController,
2666
- ct as DocCanvasPopManagerService,
2667
- dr as DocCopyCommand,
2668
- ur as DocCutCommand,
2669
- hr as DocPasteCommand,
2670
- rt as DocRenderController,
2671
- ye as DocsRenderService,
2672
- Oe as IDocClipboardService,
2673
- Ho as PastePluginLark,
2674
- ko as PastePluginUniver,
2675
- jo as PastePluginWord,
2676
- zt as UniverDocsUIPlugin,
2677
- Xr as docDrawingPositionToTransform,
2678
- Kr as transformToDocDrawingPosition,
2679
- W as whenDocAndEditorFocused
2682
+ or as DOC_UI_PLUGIN_NAME,
2683
+ tr as DefaultDocContainerConfig,
2684
+ nr as DefaultDocUiConfig,
2685
+ er as DefaultToolbarConfig,
2686
+ ot as DocBackScrollRenderController,
2687
+ lt as DocCanvasPopManagerService,
2688
+ ci as DocCopyCommand,
2689
+ li as DocCutCommand,
2690
+ di as DocPasteCommand,
2691
+ st as DocRenderController,
2692
+ xe as DocsRenderService,
2693
+ Re as IDocClipboardService,
2694
+ jo as PastePluginLark,
2695
+ zo as PastePluginUniver,
2696
+ ko as PastePluginWord,
2697
+ Yt as UniverDocsUIPlugin,
2698
+ ki as docDrawingPositionToTransform,
2699
+ Gi as transformToDocDrawingPosition,
2700
+ k as whenDocAndEditorFocused
2680
2701
  };