@univerjs/docs-drawing-ui 0.10.10 → 0.10.11

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/index.js CHANGED
@@ -1,28 +1,28 @@
1
1
  var Pn = Object.defineProperty;
2
- var xn = (i, e, t) => e in i ? Pn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var ve = (i, e, t) => xn(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { CommandType as q, ICommandService as j, IUniverInstanceService as z, TextX as _t, JSONX as $, MemoryCursor as Nn, TextXActionType as Y, IUndoRedoService as Kt, BuildTextUtils as Un, ArrangeTypeEnum as Ze, Tools as Pe, Inject as Z, IContextService as Yt, LocaleService as lt, Disposable as Ne, WrapTextType as ze, PositionedObjectLayoutType as k, BooleanNumber as oe, DrawingTypeEnum as xe, ObjectRelativeFromV as W, ObjectRelativeFromH as J, FOCUSING_COMMON_DRAWINGS as nt, UniverInstanceType as we, Direction as he, DisposableCollection as Ln, toDisposable as Se, fromEventSubject as Zt, generateRandomId as Qt, DocumentFlavor as pt, DOCS_ZEN_EDITOR_UNIT_ID_KEY as St, FOCUSING_UNIVER_EDITOR as Bn, UndoCommand as Fn, RedoCommand as kn, Injector as Jt, DOC_DRAWING_PRINTING_COMPONENT_KEY as Wn, throttle as Et, COLORS as Gn, RxDisposable as Hn, LifecycleService as jn, LifecycleStages as Rt, DependentOn as Vn, IConfigService as $n, Plugin as zn, merge as Xn } from "@univerjs/core";
5
- import { IDocDrawingService as Ue, UniverDocsDrawingPlugin as qn } from "@univerjs/docs-drawing";
2
+ var xn = (r, e, t) => e in r ? Pn(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var me = (r, e, t) => xn(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { CommandType as q, ICommandService as j, IUniverInstanceService as z, TextX as _t, JSONX as $, MemoryCursor as Nn, TextXActionType as Y, IUndoRedoService as Kt, BuildTextUtils as Un, ArrangeTypeEnum as Ze, Tools as Ae, Inject as Z, IContextService as Yt, LocaleService as lt, Disposable as xe, WrapTextType as $e, PositionedObjectLayoutType as k, BooleanNumber as se, DrawingTypeEnum as Pe, ObjectRelativeFromV as W, ObjectRelativeFromH as J, FOCUSING_COMMON_DRAWINGS as nt, UniverInstanceType as ve, Direction as he, DisposableCollection as Ln, toDisposable as ze, fromEventSubject as Zt, generateRandomId as Qt, DocumentFlavor as pt, DOCS_ZEN_EDITOR_UNIT_ID_KEY as St, FOCUSING_UNIVER_EDITOR as Bn, UndoCommand as Fn, RedoCommand as kn, Injector as Jt, DOC_DRAWING_PRINTING_COMPONENT_KEY as Wn, throttle as Et, COLORS as Gn, RxDisposable as Hn, LifecycleService as jn, LifecycleStages as Rt, DependentOn as Vn, IConfigService as $n, Plugin as zn, merge as Xn } from "@univerjs/core";
5
+ import { IDocDrawingService as Ne, UniverDocsDrawingPlugin as qn } from "@univerjs/docs-drawing";
6
6
  import { RichTextEditingMutation as ee, DocSelectionManagerService as Dt, DocSkeletonManagerService as te } from "@univerjs/docs";
7
- import { DocSelectionRenderService as Me, getRichTextEditPath as Xe, getCustomBlockIdsInSelections as Kn, docDrawingPositionToTransform as en, VIEWPORT_KEY as tn, SetDocZoomRatioOperation as nn, DocPrintInterceptorService as Yn, NodePositionConvertToCursor as At, getOneTextSelectionRange as Pt, getAnchorBounding as Zn, TEXT_RANGE_LAYER_INDEX as Qn, getDocObject as Jn, DocCanvasPopManagerService as er, IEditorService as tr } from "@univerjs/docs-ui";
8
- import { IRenderManagerService as Q, DocumentEditArea as ke, getCurrentTypeOfRenderer as nr, CURSOR_TYPE as xt, Liquid as rn, PageLayoutType as Nt, DocumentSkeletonPageType as Ut, Vector2 as rr, Rect as ir, getColor as or, TRANSFORM_CHANGE_OBSERVABLE_TYPE as sr } from "@univerjs/engine-render";
9
- import { MessageType as Lt, clsx as on, InputNumber as Fe, Select as Bt, Checkbox as ar, RadioGroup as Ft, Radio as ye, render as cr, unmount as dr } from "@univerjs/design";
10
- import { IImageIoService as gr, IDrawingManagerService as fe, DRAWING_IMAGE_ALLOW_IMAGE_LIST as lr, DRAWING_IMAGE_COUNT_LIMIT as kt, ImageUploadStatusType as mt, DRAWING_IMAGE_ALLOW_SIZE as ur, getImageSize as hr, getDrawingShapeKeyByDrawingSearch as fr, DRAWING_IMAGE_WIDTH_LIMIT as Wt, DRAWING_IMAGE_HEIGHT_LIMIT as Gt, UniverDrawingPlugin as pr } from "@univerjs/drawing";
11
- import { IMessageService as mr, ILocalFileService as wr, ISidebarService as vr, CanvasFloatDomService as Ir, useDependency as me, getMenuHiddenObservable as sn, MenuItemType as an, RibbonInsertGroup as _r, KeyCode as We, ComponentManager as cn, IMenuManagerService as Sr, IShortcutService as Dr, PrintFloatDomSingle as Or, connectInjector as Tr, UniverUIPlugin as yr } from "@univerjs/ui";
12
- import { BehaviorSubject as Ot, debounceTime as dn, map as Ht, switchMap as Mr, of as br, Observable as Cr, takeUntil as jt, filter as Vt } from "rxjs";
13
- import { DrawingRenderService as gn, DrawingCommonPanel as Er, ImageCropperObject as Rr, COMPONENT_IMAGE_POPUP_MENU as Ar, OpenImageCropOperation as Pr, ImageResetSizeOperation as xr, UniverDrawingUIPlugin as Nr } from "@univerjs/drawing-ui";
14
- import { jsxs as X, jsx as y } from "react/jsx-runtime";
15
- import { useState as ie, useEffect as Tt, useMemo as Ur } from "react";
16
- const yt = {
7
+ import { DocSelectionRenderService as Me, getRichTextEditPath as Xe, getCustomBlockIdsInSelections as Kn, docDrawingPositionToTransform as en, VIEWPORT_KEY as tn, SetDocZoomRatioOperation as nn, DocPrintInterceptorService as Yn, NodePositionConvertToCursor as At, getOneTextSelectionRange as Pt, getAnchorBounding as Zn, TEXT_RANGE_LAYER_INDEX as Qn, getDocObject as Jn, DocCanvasPopManagerService as ei, IEditorService as ti } from "@univerjs/docs-ui";
8
+ import { IRenderManagerService as Q, DocumentEditArea as Fe, getCurrentTypeOfRenderer as ni, CURSOR_TYPE as xt, Liquid as rn, PageLayoutType as Nt, DocumentSkeletonPageType as Ut, Vector2 as ii, Rect as ri, getColor as si, TRANSFORM_CHANGE_OBSERVABLE_TYPE as oi } from "@univerjs/engine-render";
9
+ import { MessageType as Lt, clsx as sn, InputNumber as Be, Select as Bt, Checkbox as ai, RadioGroup as Ft, Radio as Te, render as ci, unmount as di } from "@univerjs/design";
10
+ import { IImageIoService as gi, IDrawingManagerService as fe, DRAWING_IMAGE_ALLOW_IMAGE_LIST as li, DRAWING_IMAGE_COUNT_LIMIT as kt, ImageUploadStatusType as mt, DRAWING_IMAGE_ALLOW_SIZE as ui, getImageSize as hi, getDrawingShapeKeyByDrawingSearch as fi, DRAWING_IMAGE_WIDTH_LIMIT as Wt, DRAWING_IMAGE_HEIGHT_LIMIT as Gt, UniverDrawingPlugin as pi } from "@univerjs/drawing";
11
+ import { IMessageService as mi, ILocalFileService as wi, ISidebarService as vi, CanvasFloatDomService as Ii, useDependency as we, getMenuHiddenObservable as on, MenuItemType as an, RibbonInsertGroup as _i, KeyCode as ke, ComponentManager as cn, IMenuManagerService as Si, IShortcutService as Di, PrintFloatDomSingle as Oi, connectInjector as Ti, UniverUIPlugin as Mi } from "@univerjs/ui";
12
+ import { BehaviorSubject as Ot, debounceTime as dn, map as Ht, switchMap as yi, of as bi, Observable as Ci, takeUntil as jt, filter as Vt } from "rxjs";
13
+ import { DrawingRenderService as gn, DrawingCommonPanel as Ei, ImageCropperObject as Ri, COMPONENT_IMAGE_POPUP_MENU as Ai, OpenImageCropOperation as Pi, ImageResetSizeOperation as xi, UniverDrawingUIPlugin as Ni } from "@univerjs/drawing-ui";
14
+ import { jsxs as X, jsx as M } from "react/jsx-runtime";
15
+ import { useState as re, useEffect as Tt, useMemo as Ui } from "react";
16
+ const Mt = {
17
17
  id: "doc.command.remove-doc-image",
18
18
  type: q.COMMAND,
19
19
  // eslint-disable-next-line max-lines-per-function
20
- handler: (i, e) => {
21
- var C, M, A, L;
22
- const t = i.get(j), n = i.get(z), r = i.get(Q), o = n.getCurrentUniverDocInstance();
23
- if (e == null || o == null)
20
+ handler: (r, e) => {
21
+ var C, y, A, L;
22
+ const t = r.get(j), n = r.get(z), i = r.get(Q), s = n.getCurrentUniverDocInstance();
23
+ if (e == null || s == null)
24
24
  return !1;
25
- const s = r.getRenderById(e.unitId).with(Me), { drawings: c } = e, d = (C = s.getSegment()) != null ? C : "", a = new _t(), g = $.getInstance(), u = (A = (M = o.getSelfOrHeaderFooterModel(d).getBody()) == null ? void 0 : M.customBlocks) != null ? A : [], l = c.map((R) => u.find((v) => v.blockId === R.drawingId)).filter((R) => !!R).sort((R, v) => R.startIndex > v.startIndex ? 1 : -1), f = c[0].unitId, h = new Nn();
25
+ const o = i.getRenderById(e.unitId).with(Me), { drawings: c } = e, d = (C = o.getSegment()) != null ? C : "", a = new _t(), g = $.getInstance(), u = (A = (y = s.getSelfOrHeaderFooterModel(d).getBody()) == null ? void 0 : y.customBlocks) != null ? A : [], l = c.map((R) => u.find((v) => v.blockId === R.drawingId)).filter((R) => !!R).sort((R, v) => R.startIndex > v.startIndex ? 1 : -1), f = c[0].unitId, h = new Nn();
26
26
  h.reset();
27
27
  const m = l[0].startIndex, p = [
28
28
  {
@@ -47,10 +47,10 @@ const yt = {
47
47
  len: 1
48
48
  }), h.moveCursorTo(v + 1);
49
49
  }
50
- const S = Xe(o, d);
50
+ const S = Xe(s, d);
51
51
  D.push(g.editOp(a.serialize(), S));
52
52
  for (const R of l) {
53
- const { blockId: v } = R, N = ((L = o.getDrawings()) != null ? L : {})[v], x = o.getDrawingsOrder().indexOf(v), H = g.removeOp(["drawings", v], N), I = g.removeOp(["drawingsOrder", x], v);
53
+ const { blockId: v } = R, N = ((L = s.getDrawings()) != null ? L : {})[v], x = s.getDrawingsOrder().indexOf(v), H = g.removeOp(["drawings", v], N), I = g.removeOp(["drawingsOrder", x], v);
54
54
  D.push(H), D.push(I);
55
55
  }
56
56
  return w.params.actions = D.reduce((R, v) => $.compose(R, v), null), !!t.syncExecuteCommand(w.id, w.params);
@@ -58,12 +58,12 @@ const yt = {
58
58
  }, ln = {
59
59
  id: "doc.command.delete-drawing",
60
60
  type: q.COMMAND,
61
- handler: (i) => {
62
- const e = i.get(j), n = i.get(Ue).getFocusDrawings();
61
+ handler: (r) => {
62
+ const e = r.get(j), n = r.get(Ne).getFocusDrawings();
63
63
  if (n.length === 0)
64
64
  return !1;
65
- const { unitId: r } = n[0], o = n.map((s) => {
66
- const { unitId: c, subUnitId: d, drawingId: a, drawingType: g } = s;
65
+ const { unitId: i } = n[0], s = n.map((o) => {
66
+ const { unitId: c, subUnitId: d, drawingId: a, drawingType: g } = o;
67
67
  return {
68
68
  unitId: c,
69
69
  subUnitId: d,
@@ -71,17 +71,17 @@ const yt = {
71
71
  drawingType: g
72
72
  };
73
73
  });
74
- return e.executeCommand(yt.id, {
75
- unitId: r,
76
- drawings: o
74
+ return e.executeCommand(Mt.id, {
75
+ unitId: i,
76
+ drawings: s
77
77
  });
78
78
  }
79
79
  }, un = {
80
80
  id: "doc.command.group-doc-image",
81
81
  type: q.COMMAND,
82
- handler: (i, e) => {
83
- i.get(j), i.get(Kt);
84
- const t = i.get(Ue);
82
+ handler: (r, e) => {
83
+ r.get(j), r.get(Kt);
84
+ const t = r.get(Ne);
85
85
  if (!e) return !1;
86
86
  const n = [];
87
87
  e.forEach(({ parent: g, children: u }) => {
@@ -89,24 +89,24 @@ const yt = {
89
89
  n.push(l.unitId);
90
90
  });
91
91
  });
92
- const r = t.getGroupDrawingOp(e), { unitId: o, subUnitId: s, undo: c, redo: d, objects: a } = r;
92
+ const i = t.getGroupDrawingOp(e), { unitId: s, subUnitId: o, undo: c, redo: d, objects: a } = i;
93
93
  return !1;
94
94
  }
95
- }, Mt = {
95
+ }, yt = {
96
96
  id: "doc.command.insert-doc-image",
97
97
  type: q.COMMAND,
98
98
  // eslint-disable-next-line max-lines-per-function
99
- handler: (i, e) => {
100
- var M, A, L, R;
99
+ handler: (r, e) => {
100
+ var y, A, L, R;
101
101
  if (e == null)
102
102
  return !1;
103
- const t = i.get(j), n = i.get(Dt), r = i.get(z), o = n.getActiveTextRange(), s = r.getCurrentUniverDocInstance();
104
- if (o == null || s == null)
103
+ const t = r.get(j), n = r.get(Dt), i = r.get(z), s = n.getActiveTextRange(), o = i.getCurrentUniverDocInstance();
104
+ if (s == null || o == null)
105
105
  return !1;
106
- const c = s.getUnitId(), { drawings: d } = e, { collapsed: a, startOffset: g, segmentId: u } = o, l = s.getSelfOrHeaderFooterModel(u).getBody();
106
+ const c = o.getUnitId(), { drawings: d } = e, { collapsed: a, startOffset: g, segmentId: u } = s, l = o.getSelfOrHeaderFooterModel(u).getBody();
107
107
  if (l == null)
108
108
  return !1;
109
- const f = new _t(), h = $.getInstance(), m = [], p = (A = (M = s.getSnapshot().drawingsOrder) == null ? void 0 : M.length) != null ? A : 0;
109
+ const f = new _t(), h = $.getInstance(), m = [], p = (A = (y = o.getSnapshot().drawingsOrder) == null ? void 0 : y.length) != null ? A : 0;
110
110
  let w = 0;
111
111
  if (a)
112
112
  g > 0 && f.push({
@@ -114,9 +114,9 @@ const yt = {
114
114
  len: g
115
115
  });
116
116
  else {
117
- const v = Un.selection.delete([o], l, 0, null, !1);
117
+ const v = Un.selection.delete([s], l, 0, null, !1);
118
118
  f.push(...v);
119
- const N = Kn(l, [o]), G = (L = s.getDrawings()) != null ? L : {}, x = (R = s.getDrawingsOrder()) != null ? R : [], H = N.sort((I, _) => x.indexOf(I) > x.indexOf(_) ? -1 : x.indexOf(I) < x.indexOf(_) ? 1 : 0);
119
+ const N = Kn(l, [s]), G = (L = o.getDrawings()) != null ? L : {}, x = (R = o.getDrawingsOrder()) != null ? R : [], H = N.sort((I, _) => x.indexOf(I) > x.indexOf(_) ? -1 : x.indexOf(I) < x.indexOf(_) ? 1 : 0);
120
120
  if (H.length > 0)
121
121
  for (const I of H) {
122
122
  const _ = G[I], E = x.indexOf(I);
@@ -137,7 +137,7 @@ const yt = {
137
137
  },
138
138
  len: d.length
139
139
  });
140
- const D = Xe(s, u), S = h.editOp(f.serialize(), D);
140
+ const D = Xe(o, u), S = h.editOp(f.serialize(), D);
141
141
  m.push(S);
142
142
  for (const v of d) {
143
143
  const { drawingId: N } = v, G = h.insertOp(["drawings", N], v), x = h.insertOp(["drawingsOrder", p - w], N);
@@ -156,11 +156,11 @@ const yt = {
156
156
  }, hn = {
157
157
  id: "doc.command.set-drawing-arrange",
158
158
  type: q.COMMAND,
159
- handler: (i, e) => {
160
- const t = i.get(j), n = i.get(Ue);
159
+ handler: (r, e) => {
160
+ const t = r.get(j), n = r.get(Ne);
161
161
  if (e == null)
162
162
  return !1;
163
- const { unitId: r, subUnitId: o, drawingIds: s, arrangeType: c } = e, d = { unitId: r, subUnitId: o, drawingIds: s };
163
+ const { unitId: i, subUnitId: s, drawingIds: o, arrangeType: c } = e, d = { unitId: i, subUnitId: s, drawingIds: o };
164
164
  let a;
165
165
  if (c === Ze.forward ? a = n.getForwardDrawingsOp(d) : c === Ze.backward ? a = n.getBackwardDrawingOp(d) : c === Ze.front ? a = n.getFrontDrawingsOp(d) : c === Ze.back && (a = n.getBackDrawingsOp(d)), a == null)
166
166
  return !1;
@@ -168,12 +168,12 @@ const yt = {
168
168
  if (g == null)
169
169
  return !1;
170
170
  const u = [];
171
- let l = Pe.deepClone(g);
171
+ let l = Ae.deepClone(g);
172
172
  l = l.slice(3), l.unshift("drawingsOrder"), u.push(l);
173
173
  const f = {
174
174
  id: ee.id,
175
175
  params: {
176
- unitId: r,
176
+ unitId: i,
177
177
  actions: [],
178
178
  textRanges: null
179
179
  }
@@ -183,9 +183,9 @@ const yt = {
183
183
  }, fn = {
184
184
  id: "doc.command.ungroup-doc-image",
185
185
  type: q.COMMAND,
186
- handler: (i, e) => {
187
- i.get(j), i.get(Kt);
188
- const t = i.get(Ue);
186
+ handler: (r, e) => {
187
+ r.get(j), r.get(Kt);
188
+ const t = r.get(Ne);
189
189
  if (!e) return !1;
190
190
  const n = [];
191
191
  e.forEach(({ parent: g, children: u }) => {
@@ -193,70 +193,73 @@ const yt = {
193
193
  n.push(l.unitId);
194
194
  });
195
195
  });
196
- const r = t.getUngroupDrawingOp(e), { unitId: o, subUnitId: s, undo: c, redo: d, objects: a } = r;
196
+ const i = t.getUngroupDrawingOp(e), { unitId: s, subUnitId: o, undo: c, redo: d, objects: a } = i;
197
197
  return !1;
198
198
  }
199
199
  };
200
200
  class ut {
201
201
  constructor() {
202
- ve(this, "_refreshDrawings$", new Ot(null));
203
- ve(this, "refreshDrawings$", this._refreshDrawings$.asObservable());
202
+ me(this, "_refreshDrawings$", new Ot(null));
203
+ me(this, "refreshDrawings$", this._refreshDrawings$.asObservable());
204
204
  }
205
205
  refreshDrawings(e) {
206
206
  this._refreshDrawings$.next(e);
207
207
  }
208
208
  }
209
- var Lr = Object.getOwnPropertyDescriptor, Br = (i, e, t, n) => {
210
- for (var r = n > 1 ? void 0 : n ? Lr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
211
- (s = i[o]) && (r = s(r) || r);
212
- return r;
213
- }, le = (i, e) => (t, n) => e(t, n, i);
214
- let rt = class extends Ne {
215
- constructor(i, e, t, n, r, o, s, c, d, a, g, u, l) {
216
- super(), this._context = i, this._commandService = e, this._docSelectionManagerService = t, this._renderManagerSrv = n, this._imageIoService = r, this._docDrawingService = o, this._drawingManagerService = s, this._contextService = c, this._messageService = d, this._localeService = a, this._docSelectionRenderService = g, this._docRefreshDrawingsService = u, this._fileOpenerService = l, this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._transformDrawingListener(), this._editAreaChangeListener();
209
+ var Li = Object.getOwnPropertyDescriptor, Bi = (r, e, t, n) => {
210
+ for (var i = n > 1 ? void 0 : n ? Li(e, t) : e, s = r.length - 1, o; s >= 0; s--)
211
+ (o = r[s]) && (i = o(i) || i);
212
+ return i;
213
+ }, le = (r, e) => (t, n) => e(t, n, r);
214
+ let it = class extends xe {
215
+ constructor(r, e, t, n, i, s, o, c, d, a, g, u, l) {
216
+ super(), this._context = r, this._commandService = e, this._docSelectionManagerService = t, this._renderManagerSrv = n, this._imageIoService = i, this._docDrawingService = s, this._drawingManagerService = o, this._contextService = c, this._messageService = d, this._localeService = a, this._docSelectionRenderService = g, this._docRefreshDrawingsService = u, this._fileOpenerService = l, this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._transformDrawingListener(), this._editAreaChangeListener();
217
+ }
218
+ dispose() {
219
+ super.dispose(), delete this._context;
217
220
  }
218
221
  async insertDocImage() {
219
- const i = await this._fileOpenerService.openFile({
222
+ const r = await this._fileOpenerService.openFile({
220
223
  multiple: !0,
221
- accept: lr.map((t) => `.${t.replace("image/", "")}`).join(",")
222
- }), e = i.length;
224
+ accept: li.map((t) => `.${t.replace("image/", "")}`).join(",")
225
+ }), e = r.length;
223
226
  return e > kt ? (this._messageService.show({
224
227
  type: Lt.Error,
225
228
  content: this._localeService.t("update-status.exceedMaxCount", String(kt))
226
- }), !1) : e === 0 ? !1 : (await this._insertFloatImages(i), !0);
229
+ }), !1) : e === 0 ? !1 : (await this._insertFloatImages(r), !0);
227
230
  }
228
231
  // eslint-disable-next-line max-lines-per-function
229
- async _insertFloatImages(i) {
232
+ async _insertFloatImages(r) {
230
233
  let e = [];
231
234
  try {
232
- e = await Promise.all(i.map((r) => this._imageIoService.saveImage(r)));
233
- } catch (r) {
234
- const o = r.message;
235
- let s = "";
236
- switch (o) {
235
+ e = await Promise.all(r.map((i) => this._imageIoService.saveImage(i)));
236
+ } catch (i) {
237
+ const s = i.message;
238
+ let o = "";
239
+ switch (s) {
237
240
  case mt.ERROR_EXCEED_SIZE:
238
- s = this._localeService.t("update-status.exceedMaxSize", String(ur / (1024 * 1024)));
241
+ o = this._localeService.t("update-status.exceedMaxSize", String(ui / (1024 * 1024)));
239
242
  break;
240
243
  case mt.ERROR_IMAGE_TYPE:
241
- s = this._localeService.t("update-status.invalidImageType");
244
+ o = this._localeService.t("update-status.invalidImageType");
242
245
  break;
243
246
  case mt.ERROR_IMAGE:
244
- s = this._localeService.t("update-status.invalidImage");
247
+ o = this._localeService.t("update-status.invalidImage");
245
248
  break;
246
249
  }
247
250
  this._messageService.show({
248
251
  type: Lt.Error,
249
- content: s
252
+ content: o
250
253
  });
251
254
  }
252
255
  if (e.length === 0)
253
256
  return;
254
257
  const { unitId: t } = this._context, n = [];
255
- for (const r of e) {
256
- if (r == null)
258
+ for (const i of e) {
259
+ if (i == null)
257
260
  continue;
258
- const { imageId: o, imageSourceType: s, source: c, base64Cache: d } = r, { width: a, height: g, image: u } = await hr(d || "");
259
- this._imageIoService.addImageSourceCache(o, s, u);
261
+ const { imageId: s, imageSourceType: o, source: c, base64Cache: d } = i, { width: a, height: g, image: u } = await hi(d || "");
262
+ this._imageIoService.addImageSourceCache(s, o, u);
260
263
  let l = 1;
261
264
  if (a > Wt || g > Gt) {
262
265
  const p = Wt / a, w = Gt / g;
@@ -268,42 +271,42 @@ let rt = class extends Ne {
268
271
  const h = {
269
272
  unitId: t,
270
273
  subUnitId: t,
271
- drawingId: o,
272
- drawingType: xe.DRAWING_IMAGE,
273
- imageSourceType: s,
274
+ drawingId: s,
275
+ drawingType: Pe.DRAWING_IMAGE,
276
+ imageSourceType: o,
274
277
  source: c,
275
278
  transform: en(f),
276
279
  docTransform: f,
277
- behindDoc: oe.FALSE,
280
+ behindDoc: se.FALSE,
278
281
  title: "",
279
282
  description: "",
280
283
  layoutType: k.INLINE,
281
284
  // Insert inline drawing by default.
282
- wrapText: ze.BOTH_SIDES,
285
+ wrapText: $e.BOTH_SIDES,
283
286
  distB: 0,
284
287
  distL: 0,
285
288
  distR: 0,
286
289
  distT: 0
287
290
  };
288
- this._isInsertInHeaderFooter() && (h.isMultiTransform = oe.TRUE, h.transforms = h.transform ? [h.transform] : null), n.push(h);
291
+ this._isInsertInHeaderFooter() && (h.isMultiTransform = se.TRUE, h.transforms = h.transform ? [h.transform] : null), n.push(h);
289
292
  }
290
- this._commandService.executeCommand(Mt.id, {
293
+ this._commandService.executeCommand(yt.id, {
291
294
  unitId: t,
292
295
  drawings: n
293
296
  });
294
297
  }
295
298
  _isInsertInHeaderFooter() {
296
299
  var n;
297
- const { unitId: i } = this._context, e = (n = this._renderManagerSrv.getRenderById(i)) == null ? void 0 : n.with(te).getViewModel(), t = e == null ? void 0 : e.getEditArea();
298
- return t === ke.HEADER || t === ke.FOOTER;
300
+ const { unitId: r } = this._context, e = (n = this._renderManagerSrv.getRenderById(r)) == null ? void 0 : n.with(te).getViewModel(), t = e == null ? void 0 : e.getEditArea();
301
+ return t === Fe.HEADER || t === Fe.FOOTER;
299
302
  }
300
- _getImagePosition(i, e) {
303
+ _getImagePosition(r, e) {
301
304
  const t = this._docSelectionRenderService.getActiveTextRange(), n = (t == null ? void 0 : t.getAbsolutePosition()) || {
302
305
  left: 0
303
306
  };
304
307
  return {
305
308
  size: {
306
- width: i,
309
+ width: r,
307
310
  height: e
308
311
  },
309
312
  positionH: {
@@ -318,34 +321,40 @@ let rt = class extends Ne {
318
321
  };
319
322
  }
320
323
  _updateOrderListener() {
321
- this._drawingManagerService.featurePluginOrderUpdate$.subscribe((i) => {
322
- const { unitId: e, subUnitId: t, drawingIds: n, arrangeType: r } = i;
323
- this._commandService.executeCommand(hn.id, {
324
- unitId: e,
325
- subUnitId: t,
326
- drawingIds: n,
327
- arrangeType: r
328
- });
329
- });
324
+ this.disposeWithMe(
325
+ this._drawingManagerService.featurePluginOrderUpdate$.subscribe((r) => {
326
+ const { unitId: e, subUnitId: t, drawingIds: n, arrangeType: i } = r;
327
+ this._commandService.executeCommand(hn.id, {
328
+ unitId: e,
329
+ subUnitId: t,
330
+ drawingIds: n,
331
+ arrangeType: i
332
+ });
333
+ })
334
+ );
330
335
  }
331
336
  _groupDrawingListener() {
332
- this._drawingManagerService.featurePluginGroupUpdate$.subscribe((i) => {
333
- this._commandService.executeCommand(un.id, i);
334
- }), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((i) => {
335
- this._commandService.executeCommand(fn.id, i);
336
- });
337
+ this.disposeWithMe(
338
+ this._drawingManagerService.featurePluginGroupUpdate$.subscribe((r) => {
339
+ this._commandService.executeCommand(un.id, r);
340
+ })
341
+ ), this.disposeWithMe(
342
+ this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((r) => {
343
+ this._commandService.executeCommand(fn.id, r);
344
+ })
345
+ );
337
346
  }
338
347
  _getCurrentSceneAndTransformer() {
339
- const { scene: i, mainComponent: e } = this._context;
340
- if (i == null || e == null)
348
+ const { scene: r, mainComponent: e } = this._context;
349
+ if (r == null || e == null)
341
350
  return;
342
- const t = i.getTransformerByCreate(), { docsLeft: n, docsTop: r } = e.getOffsetConfig();
343
- return { scene: i, transformer: t, docsLeft: n, docsTop: r };
351
+ const t = r.getTransformerByCreate(), { docsLeft: n, docsTop: i } = e.getOffsetConfig();
352
+ return { scene: r, transformer: t, docsLeft: n, docsTop: i };
344
353
  }
345
354
  _transformDrawingListener() {
346
- const i = this._getCurrentSceneAndTransformer();
347
- if (i && i.transformer)
348
- this.disposeWithMe(i.transformer.changeEnd$.pipe(dn(30)).subscribe((e) => {
355
+ const r = this._getCurrentSceneAndTransformer();
356
+ if (r && r.transformer)
357
+ this.disposeWithMe(r.transformer.changeEnd$.pipe(dn(30)).subscribe((e) => {
349
358
  this._docSelectionManagerService.refreshSelection();
350
359
  }));
351
360
  else
@@ -353,18 +362,18 @@ let rt = class extends Ne {
353
362
  }
354
363
  _focusDrawingListener() {
355
364
  this.disposeWithMe(
356
- this._drawingManagerService.focus$.subscribe((i) => {
357
- var r;
358
- const { transformer: e, docsLeft: t, docsTop: n } = (r = this._getCurrentSceneAndTransformer()) != null ? r : {};
359
- if (i == null || i.length === 0)
365
+ this._drawingManagerService.focus$.subscribe((r) => {
366
+ var i;
367
+ const { transformer: e, docsLeft: t, docsTop: n } = (i = this._getCurrentSceneAndTransformer()) != null ? i : {};
368
+ if (r == null || r.length === 0)
360
369
  this._contextService.setContextValue(nt, !1), this._docDrawingService.focusDrawing([]), e && e.resetProps({
361
370
  zeroTop: 0,
362
371
  zeroLeft: 0
363
372
  });
364
373
  else {
365
- this._contextService.setContextValue(nt, !0), this._docDrawingService.focusDrawing(i), this._setDrawingSelections(i);
366
- const o = this._docSelectionRenderService.getSegment(), s = this._findSegmentIdByDrawingId(i[0].drawingId);
367
- o !== s && this._docSelectionRenderService.setSegment(s), e && e.resetProps({
374
+ this._contextService.setContextValue(nt, !0), this._docDrawingService.focusDrawing(r), this._setDrawingSelections(r);
375
+ const s = this._docSelectionRenderService.getSegment(), o = this._findSegmentIdByDrawingId(r[0].drawingId);
376
+ s !== o && this._docSelectionRenderService.setSegment(o), e && e.resetProps({
368
377
  zeroTop: n,
369
378
  zeroLeft: t
370
379
  });
@@ -372,28 +381,28 @@ let rt = class extends Ne {
372
381
  })
373
382
  );
374
383
  }
375
- _findSegmentIdByDrawingId(i) {
376
- var s, c, d;
377
- const { unit: e } = this._context, { body: t, headers: n = {}, footers: r = {} } = e.getSnapshot();
378
- if (((s = t == null ? void 0 : t.customBlocks) != null ? s : []).some((a) => a.blockId === i))
384
+ _findSegmentIdByDrawingId(r) {
385
+ var o, c, d;
386
+ const { unit: e } = this._context, { body: t, headers: n = {}, footers: i = {} } = e.getSnapshot();
387
+ if (((o = t == null ? void 0 : t.customBlocks) != null ? o : []).some((a) => a.blockId === r))
379
388
  return "";
380
389
  for (const a of Object.keys(n))
381
- if ((c = n[a].body.customBlocks) != null && c.some((g) => g.blockId === i))
390
+ if ((c = n[a].body.customBlocks) != null && c.some((g) => g.blockId === r))
382
391
  return a;
383
- for (const a of Object.keys(r))
384
- if ((d = r[a].body.customBlocks) != null && d.some((g) => g.blockId === i))
392
+ for (const a of Object.keys(i))
393
+ if ((d = i[a].body.customBlocks) != null && d.some((g) => g.blockId === r))
385
394
  return a;
386
395
  return "";
387
396
  }
388
397
  // Update drawings edit status and opacity. You can not edit header footer images when you are editing body. and vice verse.
389
398
  _updateDrawingsEditStatus() {
390
399
  var c;
391
- const { unit: i, scene: e, unitId: t } = this._context, n = (c = this._renderManagerSrv.getRenderById(t)) == null ? void 0 : c.with(te).getViewModel();
392
- if (n == null || i == null)
400
+ const { unit: r, scene: e, unitId: t } = this._context, n = (c = this._renderManagerSrv.getRenderById(t)) == null ? void 0 : c.with(te).getViewModel();
401
+ if (n == null || r == null)
393
402
  return;
394
- const r = i.getSnapshot(), { drawings: o = {} } = r, s = n.getEditArea() === ke.BODY;
395
- for (const d of Object.keys(o)) {
396
- const a = o[d], g = fr({ unitId: t, drawingId: a.drawingId, subUnitId: t }), u = e.fuzzyMathObjects(g, !0);
403
+ const i = r.getSnapshot(), { drawings: s = {} } = i, o = n.getEditArea() === Fe.BODY;
404
+ for (const d of Object.keys(s)) {
405
+ const a = s[d], g = fi({ unitId: t, drawingId: a.drawingId, subUnitId: t }), u = e.fuzzyMathObjects(g, !0);
397
406
  if (u.length)
398
407
  for (const l of u) {
399
408
  e.detachTransformerFrom(l);
@@ -401,7 +410,7 @@ let rt = class extends Ne {
401
410
  l.setOpacity(0.5);
402
411
  } catch {
403
412
  }
404
- if (s && a.isMultiTransform !== oe.TRUE || !s && a.isMultiTransform === oe.TRUE) {
413
+ if (o && a.isMultiTransform !== se.TRUE || !o && a.isMultiTransform === se.TRUE) {
405
414
  a.allowTransform !== !1 && e.attachTransformerTo(l);
406
415
  try {
407
416
  l.setOpacity(1);
@@ -413,16 +422,18 @@ let rt = class extends Ne {
413
422
  }
414
423
  _editAreaChangeListener() {
415
424
  var t;
416
- const { unitId: i } = this._context, e = (t = this._renderManagerSrv.getRenderById(i)) == null ? void 0 : t.with(te).getViewModel();
425
+ const { unitId: r } = this._context, e = (t = this._renderManagerSrv.getRenderById(r)) == null ? void 0 : t.with(te).getViewModel();
417
426
  e != null && (this._updateDrawingsEditStatus(), this.disposeWithMe(
418
427
  e.editAreaChange$.subscribe(() => {
419
428
  this._updateDrawingsEditStatus();
420
429
  })
421
- ), this._docRefreshDrawingsService.refreshDrawings$.subscribe((n) => {
422
- n != null && queueMicrotask(() => {
423
- this._updateDrawingsEditStatus();
424
- });
425
- }), this.disposeWithMe(
430
+ ), this.disposeWithMe(
431
+ this._docRefreshDrawingsService.refreshDrawings$.subscribe((n) => {
432
+ n != null && queueMicrotask(() => {
433
+ this._updateDrawingsEditStatus();
434
+ });
435
+ })
436
+ ), this.disposeWithMe(
426
437
  this._commandService.onCommandExecuted(async (n) => {
427
438
  n.id === ee.id && queueMicrotask(() => {
428
439
  this._updateDrawingsEditStatus();
@@ -430,54 +441,54 @@ let rt = class extends Ne {
430
441
  })
431
442
  ));
432
443
  }
433
- _setDrawingSelections(i) {
434
- var r, o;
435
- const { unit: e } = this._context, t = (o = (r = e.getSnapshot().body) == null ? void 0 : r.customBlocks) != null ? o : [], n = i.map((s) => {
436
- const c = s.drawingId, d = t.find((a) => a.blockId === c);
444
+ _setDrawingSelections(r) {
445
+ var i, s;
446
+ const { unit: e } = this._context, t = (s = (i = e.getSnapshot().body) == null ? void 0 : i.customBlocks) != null ? s : [], n = r.map((o) => {
447
+ const c = o.drawingId, d = t.find((a) => a.blockId === c);
437
448
  return d ? d.startIndex : null;
438
- }).filter((s) => s !== null).map((s) => ({ startOffset: s, endOffset: s + 1 }));
449
+ }).filter((o) => o !== null).map((o) => ({ startOffset: o, endOffset: o + 1 }));
439
450
  this._docSelectionManagerService.replaceDocRanges(n);
440
451
  }
441
452
  };
442
- rt = Br([
453
+ it = Bi([
443
454
  le(1, j),
444
455
  le(2, Z(Dt)),
445
456
  le(3, Q),
446
- le(4, gr),
447
- le(5, Ue),
457
+ le(4, gi),
458
+ le(5, Ne),
448
459
  le(6, fe),
449
460
  le(7, Yt),
450
- le(8, mr),
461
+ le(8, mi),
451
462
  le(9, Z(lt)),
452
463
  le(10, Z(Me)),
453
464
  le(11, Z(ut)),
454
- le(12, wr)
455
- ], rt);
465
+ le(12, wi)
466
+ ], it);
456
467
  const pn = {
457
468
  id: "doc.command.insert-float-image",
458
469
  type: q.COMMAND,
459
- handler: (i) => {
460
- var n, r;
461
- const e = i.get(z), t = i.get(Q);
462
- return (r = (n = nr(we.UNIVER_DOC, e, t)) == null ? void 0 : n.with(rt).insertDocImage()) != null ? r : !1;
470
+ handler: (r) => {
471
+ var n, i;
472
+ const e = r.get(z), t = r.get(Q);
473
+ return (i = (n = ni(ve.UNIVER_DOC, e, t)) == null ? void 0 : n.with(it).insertDocImage()) != null ? i : !1;
463
474
  }
464
475
  };
465
- var ue = /* @__PURE__ */ ((i) => (i.INLINE = "inline", i.BEHIND_TEXT = "behindText", i.IN_FRONT_OF_TEXT = "inFrontOfText", i.WRAP_SQUARE = "wrapSquare", i.WRAP_TOP_AND_BOTTOM = "wrapTopAndBottom", i))(ue || {});
466
- const Fr = {
476
+ var ue = /* @__PURE__ */ ((r) => (r.INLINE = "inline", r.BEHIND_TEXT = "behindText", r.IN_FRONT_OF_TEXT = "inFrontOfText", r.WRAP_SQUARE = "wrapSquare", r.WRAP_TOP_AND_BOTTOM = "wrapTopAndBottom", r))(ue || {});
477
+ const Fi = {
467
478
  inline: k.INLINE,
468
479
  wrapSquare: k.WRAP_SQUARE,
469
480
  wrapTopAndBottom: k.WRAP_TOP_AND_BOTTOM,
470
481
  inFrontOfText: k.WRAP_NONE,
471
482
  behindText: k.WRAP_NONE
472
483
  };
473
- function mn(i, e, t, n, r, o, s) {
484
+ function mn(r, e, t, n, i, s, o) {
474
485
  var f, h;
475
- const c = new _t(), d = $.getInstance(), a = [], g = o.getSelfOrHeaderFooterModel(e).getBody(), u = o.getSelfOrHeaderFooterModel(i).getBody();
486
+ const c = new _t(), d = $.getInstance(), a = [], g = s.getSelfOrHeaderFooterModel(e).getBody(), u = s.getSelfOrHeaderFooterModel(r).getBody();
476
487
  if (g == null || u == null)
477
488
  return;
478
- const l = (h = (f = g.customBlocks) == null ? void 0 : f.find((m) => m.blockId === r)) == null ? void 0 : h.startIndex;
489
+ const l = (h = (f = g.customBlocks) == null ? void 0 : f.find((m) => m.blockId === i)) == null ? void 0 : h.startIndex;
479
490
  if (l != null) {
480
- if (n = Math.min(u.dataStream.length - 2, n), i === e) {
491
+ if (n = Math.min(u.dataStream.length - 2, n), r === e) {
481
492
  if (n < l ? (n > 0 && c.push({
482
493
  t: Y.RETAIN,
483
494
  len: n
@@ -487,7 +498,7 @@ function mn(i, e, t, n, r, o, s) {
487
498
  dataStream: "\b",
488
499
  customBlocks: [{
489
500
  startIndex: 0,
490
- blockId: r
501
+ blockId: i
491
502
  }]
492
503
  },
493
504
  len: 1
@@ -512,12 +523,12 @@ function mn(i, e, t, n, r, o, s) {
512
523
  dataStream: "\b",
513
524
  customBlocks: [{
514
525
  startIndex: 0,
515
- blockId: r
526
+ blockId: i
516
527
  }]
517
528
  },
518
529
  len: 1
519
530
  })), n !== l) {
520
- const m = Xe(o, e), p = d.editOp(c.serialize(), m);
531
+ const m = Xe(s, e), p = d.editOp(c.serialize(), m);
521
532
  a.push(p);
522
533
  }
523
534
  } else {
@@ -528,7 +539,7 @@ function mn(i, e, t, n, r, o, s) {
528
539
  t: Y.DELETE,
529
540
  len: 1
530
541
  });
531
- let m = Xe(o, e), p = d.editOp(c.serialize(), m);
542
+ let m = Xe(s, e), p = d.editOp(c.serialize(), m);
532
543
  a.push(p), c.empty(), n > 0 && c.push({
533
544
  t: Y.RETAIN,
534
545
  len: n
@@ -538,11 +549,11 @@ function mn(i, e, t, n, r, o, s) {
538
549
  dataStream: "\b",
539
550
  customBlocks: [{
540
551
  startIndex: 0,
541
- blockId: r
552
+ blockId: i
542
553
  }]
543
554
  },
544
555
  len: 1
545
- }), m = Xe(o, i), p = d.editOp(c.serialize(), m), a.push(p), s.setSegment(i), s.setSegmentPage(t);
556
+ }), m = Xe(s, r), p = d.editOp(c.serialize(), m), a.push(p), o.setSegment(r), o.setSegmentPage(t);
546
557
  }
547
558
  return a;
548
559
  }
@@ -551,22 +562,22 @@ const wn = {
551
562
  id: "doc.command.update-doc-drawing-wrapping-style",
552
563
  type: q.COMMAND,
553
564
  // eslint-disable-next-line max-lines-per-function, complexity
554
- handler: (i, e) => {
565
+ handler: (r, e) => {
555
566
  var A, L;
556
567
  if (e == null)
557
568
  return !1;
558
- const { drawings: t, wrappingStyle: n, unitId: r } = e, o = i.get(j), s = i.get(z), d = i.get(Q).getRenderById(r), a = d == null ? void 0 : d.with(te).getSkeleton().getSkeletonData(), g = d == null ? void 0 : d.with(te).getViewModel(), u = d == null ? void 0 : d.scene, l = s.getCurrentUniverDocInstance();
569
+ const { drawings: t, wrappingStyle: n, unitId: i } = e, s = r.get(j), o = r.get(z), d = r.get(Q).getRenderById(i), a = d == null ? void 0 : d.with(te).getSkeleton().getSkeletonData(), g = d == null ? void 0 : d.with(te).getViewModel(), u = d == null ? void 0 : d.scene, l = o.getCurrentUniverDocInstance();
559
570
  if (l == null || a == null || u == null || g == null)
560
571
  return !1;
561
572
  const f = g.getEditArea(), h = u.getTransformerByCreate(), { pages: m, skeHeaders: p, skeFooters: w } = a, D = $.getInstance(), S = [], { drawings: O = {} } = l.getSnapshot();
562
573
  for (const R of t) {
563
- const { drawingId: v } = R, N = O[v].layoutType, G = Fr[n];
574
+ const { drawingId: v } = R, N = O[v].layoutType, G = Fi[n];
564
575
  if (N !== G) {
565
576
  const _ = D.replaceOp(["drawings", v, "layoutType"], N, G);
566
577
  S.push(_);
567
578
  }
568
579
  if (n === "behindText" || n === "inFrontOfText") {
569
- const _ = O[v].behindDoc, E = n === "behindText" ? oe.TRUE : oe.FALSE;
580
+ const _ = O[v].behindDoc, E = n === "behindText" ? se.TRUE : se.FALSE;
570
581
  if (_ !== E) {
571
582
  const T = D.replaceOp(["drawings", v, "behindDoc"], _, E);
572
583
  S.push(T);
@@ -578,17 +589,17 @@ const wn = {
578
589
  for (const _ of m) {
579
590
  const { headerId: E, footerId: T, marginTop: U, marginLeft: B, marginBottom: b, pageWidth: P, pageHeight: V } = _;
580
591
  switch (f) {
581
- case ke.HEADER: {
592
+ case Fe.HEADER: {
582
593
  const F = (A = p.get(E)) == null ? void 0 : A.get(P);
583
594
  F != null && F.skeDrawings.has(v) && (x = F.skeDrawings.get(v), H = F.marginTop, I = B);
584
595
  break;
585
596
  }
586
- case ke.FOOTER: {
597
+ case Fe.FOOTER: {
587
598
  const F = (L = w.get(T)) == null ? void 0 : L.get(P);
588
599
  F != null && F.skeDrawings.has(v) && (x = F.skeDrawings.get(v), H = V - b + F.marginTop, I = B);
589
600
  break;
590
601
  }
591
- case ke.BODY: {
602
+ case Fe.BODY: {
592
603
  _.skeDrawings.has(v) && (x = _.skeDrawings.get(v), H = U, I = B);
593
604
  break;
594
605
  }
@@ -624,28 +635,28 @@ const wn = {
624
635
  const C = {
625
636
  id: ee.id,
626
637
  params: {
627
- unitId: r,
638
+ unitId: i,
628
639
  actions: [],
629
640
  textRanges: null
630
641
  }
631
642
  };
632
643
  C.params.actions = S.reduce((R, v) => $.compose(R, v), null);
633
- const M = o.syncExecuteCommand(C.id, C.params);
634
- return h.refreshControls(), !!M;
644
+ const y = s.syncExecuteCommand(C.id, C.params);
645
+ return h.refreshControls(), !!y;
635
646
  }
636
647
  }, vn = {
637
648
  id: "doc.command.update-doc-drawing-distance",
638
649
  type: q.COMMAND,
639
- handler: (i, e) => {
650
+ handler: (r, e) => {
640
651
  if (e == null)
641
652
  return !1;
642
- const t = i.get(j), r = i.get(z).getCurrentUniverDocInstance();
643
- if (r == null)
653
+ const t = r.get(j), i = r.get(z).getCurrentUniverDocInstance();
654
+ if (i == null)
644
655
  return !1;
645
- const { drawings: o, dist: s, unitId: c } = e, d = $.getInstance(), a = [], { drawings: g = {} } = r.getSnapshot();
646
- for (const f of o) {
656
+ const { drawings: s, dist: o, unitId: c } = e, d = $.getInstance(), a = [], { drawings: g = {} } = i.getSnapshot();
657
+ for (const f of s) {
647
658
  const { drawingId: h } = f;
648
- for (const [m, p] of Object.entries(s)) {
659
+ for (const [m, p] of Object.entries(o)) {
649
660
  const w = g[h][m];
650
661
  if (w !== p) {
651
662
  const D = d.replaceOp(["drawings", h, m], w, p);
@@ -666,17 +677,17 @@ const wn = {
666
677
  }, In = {
667
678
  id: "doc.command.update-doc-drawing-wrap-text",
668
679
  type: q.COMMAND,
669
- handler: (i, e) => {
680
+ handler: (r, e) => {
670
681
  if (e == null)
671
682
  return !1;
672
- const t = i.get(j), r = i.get(z).getCurrentUniverDocInstance();
673
- if (r == null)
683
+ const t = r.get(j), i = r.get(z).getCurrentUniverDocInstance();
684
+ if (i == null)
674
685
  return !1;
675
- const { drawings: o, wrapText: s, unitId: c } = e, d = $.getInstance(), a = [], { drawings: g = {} } = r.getSnapshot();
676
- for (const f of o) {
686
+ const { drawings: s, wrapText: o, unitId: c } = e, d = $.getInstance(), a = [], { drawings: g = {} } = i.getSnapshot();
687
+ for (const f of s) {
677
688
  const { drawingId: h } = f, m = g[h].wrapText;
678
- if (m !== s) {
679
- const p = d.replaceOp(["drawings", h, "wrapText"], m, s);
689
+ if (m !== o) {
690
+ const p = d.replaceOp(["drawings", h, "wrapText"], m, o);
680
691
  a.push(p);
681
692
  }
682
693
  }
@@ -693,19 +704,19 @@ const wn = {
693
704
  }, qe = {
694
705
  id: "doc.command.update-drawing-doc-transform",
695
706
  type: q.COMMAND,
696
- handler: (i, e) => {
707
+ handler: (r, e) => {
697
708
  if (e == null)
698
709
  return !1;
699
- const t = i.get(j), n = i.get(z), o = i.get(Q).getRenderById(e.unitId), s = o == null ? void 0 : o.scene;
700
- if (s == null)
710
+ const t = r.get(j), n = r.get(z), s = r.get(Q).getRenderById(e.unitId), o = s == null ? void 0 : s.scene;
711
+ if (o == null)
701
712
  return !1;
702
- const c = s.getTransformerByCreate(), d = n.getCurrentUniverDocInstance();
713
+ const c = o.getTransformerByCreate(), d = n.getCurrentUniverDocInstance();
703
714
  if (d == null)
704
715
  return !1;
705
716
  const { drawings: a, unitId: g } = e, u = $.getInstance(), l = [], { drawings: f = {} } = d.getSnapshot();
706
717
  for (const p of a) {
707
718
  const { drawingId: w, key: D, value: S } = p, O = f[w].docTransform[D];
708
- if (!Pe.diffValue(O, S)) {
719
+ if (!Ae.diffValue(O, S)) {
709
720
  const C = u.replaceOp(["drawings", w, "docTransform", D], O, S);
710
721
  l.push(C);
711
722
  }
@@ -726,19 +737,19 @@ const wn = {
726
737
  }, _n = {
727
738
  id: "doc.command.move-inline-drawing",
728
739
  type: q.COMMAND,
729
- handler: (i, e) => {
740
+ handler: (r, e) => {
730
741
  var L, R;
731
742
  if (e == null)
732
743
  return !1;
733
- const t = i.get(Q), n = (L = t.getRenderById(e.unitId)) == null ? void 0 : L.with(Me), r = i.get(ut), o = t.getRenderById(e.unitId), s = o == null ? void 0 : o.scene, c = o == null ? void 0 : o.with(te).getSkeleton();
734
- if (s == null || n == null)
744
+ const t = r.get(Q), n = (L = t.getRenderById(e.unitId)) == null ? void 0 : L.with(Me), i = r.get(ut), s = t.getRenderById(e.unitId), o = s == null ? void 0 : s.scene, c = s == null ? void 0 : s.with(te).getSkeleton();
745
+ if (o == null || n == null)
735
746
  return !1;
736
- const d = s.getTransformerByCreate(), a = i.get(j), u = i.get(z).getCurrentUniverDocInstance();
747
+ const d = o.getTransformerByCreate(), a = r.get(j), u = r.get(z).getCurrentUniverDocInstance();
737
748
  if (u == null)
738
749
  return !1;
739
750
  const { drawing: l, unitId: f, offset: h, segmentId: m, segmentPage: p, needRefreshDrawings: w } = e;
740
751
  if (w)
741
- return r.refreshDrawings(c), d.refreshControls(), !0;
752
+ return i.refreshDrawings(c), d.refreshControls(), !0;
742
753
  const D = [], { drawingId: S } = l, O = (R = n.getSegment()) != null ? R : "", C = mn(
743
754
  m,
744
755
  O,
@@ -749,9 +760,9 @@ const wn = {
749
760
  n
750
761
  );
751
762
  if (C == null || C.length === 0)
752
- return r.refreshDrawings(c), d.refreshControls(), !1;
763
+ return i.refreshDrawings(c), d.refreshControls(), !1;
753
764
  D.push(...C);
754
- const M = {
765
+ const y = {
755
766
  id: ee.id,
756
767
  params: {
757
768
  unitId: f,
@@ -759,22 +770,22 @@ const wn = {
759
770
  textRanges: null
760
771
  }
761
772
  };
762
- M.params.actions = D.reduce((v, N) => $.compose(v, N), null);
763
- const A = a.syncExecuteCommand(M.id, M.params);
773
+ y.params.actions = D.reduce((v, N) => $.compose(v, N), null);
774
+ const A = a.syncExecuteCommand(y.id, y.params);
764
775
  return d.refreshControls(), !!A;
765
776
  }
766
777
  }, Sn = {
767
778
  id: "doc.command.transform-non-inline-drawing",
768
779
  type: q.COMMAND,
769
780
  // eslint-disable-next-line max-lines-per-function
770
- handler: (i, e) => {
781
+ handler: (r, e) => {
771
782
  var x, H;
772
783
  if (e == null)
773
784
  return !1;
774
- const t = i.get(Q), n = (x = t.getRenderById(e.unitId)) == null ? void 0 : x.with(Me), r = t.getRenderById(e.unitId), o = r == null ? void 0 : r.scene;
775
- if (o == null || n == null)
785
+ const t = r.get(Q), n = (x = t.getRenderById(e.unitId)) == null ? void 0 : x.with(Me), i = t.getRenderById(e.unitId), s = i == null ? void 0 : i.scene;
786
+ if (s == null || n == null)
776
787
  return !1;
777
- const s = o.getTransformerByCreate(), c = i.get(j), a = i.get(z).getCurrentUniverDocInstance();
788
+ const o = s.getTransformerByCreate(), c = r.get(j), a = r.get(z).getCurrentUniverDocInstance();
778
789
  if (a == null)
779
790
  return !1;
780
791
  const { drawing: g, unitId: u, offset: l, docTransform: f, segmentId: h, segmentPage: m } = e, p = [], { drawingId: w } = g, D = (H = n.getSegment()) != null ? H : "", S = mn(
@@ -789,20 +800,20 @@ const wn = {
789
800
  if (S == null)
790
801
  return !1;
791
802
  S.length > 0 && p.push(...S);
792
- const O = $.getInstance(), { drawings: C = {} } = a.getSnapshot(), M = C[w].docTransform, { positionH: A, positionV: L, size: R, angle: v } = M;
793
- if (!Pe.diffValue(A, f.positionH)) {
803
+ const O = $.getInstance(), { drawings: C = {} } = a.getSnapshot(), y = C[w].docTransform, { positionH: A, positionV: L, size: R, angle: v } = y;
804
+ if (!Ae.diffValue(A, f.positionH)) {
794
805
  const I = O.replaceOp(["drawings", w, "docTransform", "positionH"], A, f.positionH);
795
806
  p.push(I);
796
807
  }
797
- if (!Pe.diffValue(L, f.positionV)) {
808
+ if (!Ae.diffValue(L, f.positionV)) {
798
809
  const I = O.replaceOp(["drawings", w, "docTransform", "positionV"], L, f.positionV);
799
810
  p.push(I);
800
811
  }
801
- if (!Pe.diffValue(R, f.size)) {
812
+ if (!Ae.diffValue(R, f.size)) {
802
813
  const I = O.replaceOp(["drawings", w, "docTransform", "size"], R, f.size);
803
814
  p.push(I);
804
815
  }
805
- if (!Pe.diffValue(v, f.angle)) {
816
+ if (!Ae.diffValue(v, f.angle)) {
806
817
  const I = O.replaceOp(["drawings", w, "docTransform", "angle"], v, f.angle);
807
818
  p.push(I);
808
819
  }
@@ -817,28 +828,28 @@ const wn = {
817
828
  };
818
829
  N.params.actions = p.reduce((I, _) => $.compose(I, _), null);
819
830
  const G = c.syncExecuteCommand(N.id, N.params);
820
- return s.refreshControls(), !!G;
831
+ return o.refreshControls(), !!G;
821
832
  }
822
833
  }, Ke = {
823
834
  id: "doc.command.move-drawing",
824
835
  type: q.COMMAND,
825
- handler: (i, e) => {
826
- const t = i.get(j), n = i.get(Ue), r = i.get(z), o = i.get(Q), { direction: s } = e, c = n.getFocusDrawings();
836
+ handler: (r, e) => {
837
+ const t = r.get(j), n = r.get(Ne), i = r.get(z), s = r.get(Q), { direction: o } = e, c = n.getFocusDrawings();
827
838
  if (c.length === 0)
828
839
  return !1;
829
- const d = c[0].unitId, a = o.getRenderById(d), g = a == null ? void 0 : a.scene;
840
+ const d = c[0].unitId, a = s.getRenderById(d), g = a == null ? void 0 : a.scene;
830
841
  if (g == null)
831
842
  return !1;
832
- const u = g.getTransformerByCreate(), l = r.getUniverDocInstance(d), f = c.map((m) => {
833
- var M, A, L, R, v;
834
- const { drawingId: p } = m, w = (M = l == null ? void 0 : l.getSnapshot().drawings) == null ? void 0 : M[p];
843
+ const u = g.getTransformerByCreate(), l = i.getUniverDocInstance(d), f = c.map((m) => {
844
+ var y, A, L, R, v;
845
+ const { drawingId: p } = m, w = (y = l == null ? void 0 : l.getSnapshot().drawings) == null ? void 0 : y[p];
835
846
  if (w == null || w.layoutType === k.INLINE)
836
847
  return null;
837
848
  const { positionH: D, positionV: S } = w.docTransform, O = { ...D }, C = { ...S };
838
- return s === he.UP ? C.posOffset = ((A = C.posOffset) != null ? A : 0) - 2 : s === he.DOWN ? C.posOffset = ((L = C.posOffset) != null ? L : 0) + 2 : s === he.LEFT ? O.posOffset = ((R = O.posOffset) != null ? R : 0) - 2 : s === he.RIGHT && (O.posOffset = ((v = O.posOffset) != null ? v : 0) + 2), {
849
+ return o === he.UP ? C.posOffset = ((A = C.posOffset) != null ? A : 0) - 2 : o === he.DOWN ? C.posOffset = ((L = C.posOffset) != null ? L : 0) + 2 : o === he.LEFT ? O.posOffset = ((R = O.posOffset) != null ? R : 0) - 2 : o === he.RIGHT && (O.posOffset = ((v = O.posOffset) != null ? v : 0) + 2), {
839
850
  drawingId: p,
840
- key: s === he.UP || s === he.DOWN ? "positionV" : "positionH",
841
- value: s === he.UP || s === he.DOWN ? C : O
851
+ key: o === he.UP || o === he.DOWN ? "positionV" : "positionH",
852
+ value: o === he.UP || o === he.DOWN ? C : O
842
853
  };
843
854
  }).filter((m) => m != null);
844
855
  if (f.length === 0)
@@ -850,28 +861,28 @@ const wn = {
850
861
  });
851
862
  return u.refreshControls(), !!h;
852
863
  }
853
- }, kr = {
864
+ }, ki = {
854
865
  id: "doc.operation.clear-drawing-transformer",
855
866
  type: q.MUTATION,
856
- handler: (i, e) => {
857
- const t = i.get(Q);
867
+ handler: (r, e) => {
868
+ const t = r.get(Q);
858
869
  return e.forEach((n) => {
859
- var r, o;
860
- (o = (r = t.getRenderById(n)) == null ? void 0 : r.scene.getTransformer()) == null || o.debounceRefreshControls();
870
+ var i, s;
871
+ (s = (i = t.getRenderById(n)) == null ? void 0 : i.scene.getTransformer()) == null || s.debounceRefreshControls();
861
872
  }), !0;
862
873
  }
863
874
  }, Dn = "COMPONENT_DOC_DRAWING_PANEL", On = {
864
875
  id: "sidebar.operation.doc-image",
865
876
  type: q.COMMAND,
866
- handler: async (i, e) => {
867
- const t = i.get(vr), n = i.get(lt), r = i.get(fe);
877
+ handler: async (r, e) => {
878
+ const t = r.get(vi), n = r.get(lt), i = r.get(fe);
868
879
  switch (e.value) {
869
880
  case "open":
870
881
  t.open({
871
882
  header: { title: n.t("docImage.panel.title") },
872
883
  children: { label: Dn },
873
884
  onClose: () => {
874
- r.focusDrawing(null);
885
+ i.focusDrawing(null);
875
886
  },
876
887
  width: 360
877
888
  });
@@ -886,23 +897,23 @@ const wn = {
886
897
  }, Tn = {
887
898
  id: "doc.operation.edit-doc-image",
888
899
  type: q.OPERATION,
889
- handler: (i, e) => {
890
- const t = i.get(fe), n = i.get(j);
900
+ handler: (r, e) => {
901
+ const t = r.get(fe), n = r.get(j);
891
902
  return e == null ? !1 : (t.focusDrawing([e]), n.executeCommand(On.id, { value: "open" }), !0);
892
903
  }
893
904
  };
894
- var Wr = Object.getOwnPropertyDescriptor, Gr = (i, e, t, n) => {
895
- for (var r = n > 1 ? void 0 : n ? Wr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
896
- (s = i[o]) && (r = s(r) || r);
897
- return r;
898
- }, Be = (i, e) => (t, n) => e(t, n, i);
899
- function yn(i, e, t = 1, n = 0) {
900
- const { top: r, left: o, bottom: s, right: c } = i, d = c - o, a = s - r, g = e.getViewport(tn.VIEW_MAIN), { viewportScrollX: u, viewportScrollY: l } = g, { scaleX: f, scaleY: h } = e.getAncestorScale();
905
+ var Wi = Object.getOwnPropertyDescriptor, Gi = (r, e, t, n) => {
906
+ for (var i = n > 1 ? void 0 : n ? Wi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
907
+ (o = r[s]) && (i = o(i) || i);
908
+ return i;
909
+ }, Le = (r, e) => (t, n) => e(t, n, r);
910
+ function Mn(r, e, t = 1, n = 0) {
911
+ const { top: i, left: s, bottom: o, right: c } = r, d = c - s, a = o - i, g = e.getViewport(tn.VIEW_MAIN), { viewportScrollX: u, viewportScrollY: l } = g, { scaleX: f, scaleY: h } = e.getAncestorScale();
901
912
  return {
902
- startX: (o - u) * f,
903
- startY: (r - l) * h,
904
- endX: (o + d - u) * f,
905
- endY: (r + a - l) * h,
913
+ startX: (s - u) * f,
914
+ startY: (i - l) * h,
915
+ endX: (s + d - u) * f,
916
+ endY: (i + a - l) * h,
906
917
  width: d * f,
907
918
  height: a * h,
908
919
  rotate: n,
@@ -913,15 +924,15 @@ function yn(i, e, t = 1, n = 0) {
913
924
  opacity: t != null ? t : 1
914
925
  };
915
926
  }
916
- function wt(i, e) {
917
- const { top: t, left: n, width: r, height: o, angle: s, opacity: c } = i;
918
- return yn({ top: t, left: n, bottom: t + o, right: n + r }, e.scene, c, s);
927
+ function wt(r, e) {
928
+ const { top: t, left: n, width: i, height: s, angle: o, opacity: c } = r;
929
+ return Mn({ top: t, left: n, bottom: t + s, right: n + i }, e.scene, c, o);
919
930
  }
920
- let it = class extends Ne {
921
- constructor(e, t, n, r, o, s) {
931
+ let rt = class extends xe {
932
+ constructor(e, t, n, i, s, o) {
922
933
  super();
923
- ve(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
924
- this._renderManagerService = e, this._drawingManagerService = t, this._drawingRenderService = n, this._canvasFloatDomService = r, this._univerInstanceService = o, this._commandService = s, this._initialize();
934
+ me(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
935
+ this._renderManagerService = e, this._drawingManagerService = t, this._drawingRenderService = n, this._canvasFloatDomService = i, this._univerInstanceService = s, this._commandService = o, this._initialize();
925
936
  }
926
937
  dispose() {
927
938
  super.dispose();
@@ -935,8 +946,8 @@ let it = class extends Ne {
935
946
  const t = this._renderManagerService.getRenderById(e);
936
947
  if (t == null)
937
948
  return null;
938
- const n = t.scene, r = n.getTransformerByCreate();
939
- return { scene: n, transformer: r, renderUnit: t, canvas: t.engine.getCanvasElement() };
949
+ const n = t.scene, i = n.getTransformerByCreate();
950
+ return { scene: n, transformer: i, renderUnit: t, canvas: t.engine.getCanvasElement() };
940
951
  }
941
952
  _drawingAddRemoveListener() {
942
953
  this.disposeWithMe(
@@ -954,19 +965,19 @@ let it = class extends Ne {
954
965
  _insertRects(e) {
955
966
  e.forEach(async (t) => {
956
967
  const { unitId: n } = t;
957
- if (!this._univerInstanceService.getUnit(n, we.UNIVER_DOC))
968
+ if (!this._univerInstanceService.getUnit(n, ve.UNIVER_DOC))
958
969
  return;
959
- const o = this._getSceneAndTransformerByDrawingSearch(n);
960
- if (o == null)
961
- return;
962
- const s = this._drawingManagerService.getDrawingByParam(t);
970
+ const s = this._getSceneAndTransformerByDrawingSearch(n);
963
971
  if (s == null)
964
972
  return;
965
- const c = await this._drawingRenderService.renderFloatDom(s, o.scene);
973
+ const o = this._drawingManagerService.getDrawingByParam(t);
974
+ if (o == null)
975
+ return;
976
+ const c = await this._drawingRenderService.renderFloatDom(o, s.scene);
966
977
  if (!(c == null || c.length === 0))
967
978
  for (const d of c) {
968
979
  this._addHoverForRect(d);
969
- const a = new Ln(), g = wt(d, o.renderUnit), u = new Ot(g), l = o.canvas, f = s.data, h = {
980
+ const a = new Ln(), g = wt(d, s.renderUnit), u = new Ot(g), l = s.canvas, f = o.data, h = {
970
981
  dispose: a,
971
982
  rect: d,
972
983
  position$: u,
@@ -974,8 +985,8 @@ let it = class extends Ne {
974
985
  };
975
986
  this._canvasFloatDomService.addFloatDom({
976
987
  position$: u,
977
- id: s.drawingId,
978
- componentKey: s.componentKey,
988
+ id: o.drawingId,
989
+ componentKey: o.componentKey,
979
990
  onPointerDown: (p) => {
980
991
  l.dispatchEvent(new PointerEvent(p.type, p));
981
992
  },
@@ -992,26 +1003,26 @@ let it = class extends Ne {
992
1003
  unitId: n
993
1004
  });
994
1005
  const m = d.onTransformChange$.subscribeEvent(() => {
995
- const p = wt(d, o.renderUnit);
1006
+ const p = wt(d, s.renderUnit);
996
1007
  u.next(
997
1008
  p
998
1009
  );
999
1010
  });
1000
1011
  a.add(() => {
1001
- this._canvasFloatDomService.removeFloatDom(s.drawingId);
1002
- }), m && a.add(m), this._domLayerInfoMap.set(s.drawingId, h);
1012
+ this._canvasFloatDomService.removeFloatDom(o.drawingId);
1013
+ }), m && a.add(m), this._domLayerInfoMap.set(o.drawingId, h);
1003
1014
  }
1004
1015
  });
1005
1016
  }
1006
1017
  _addHoverForRect(e) {
1007
1018
  this.disposeWithMe(
1008
- Se(
1019
+ ze(
1009
1020
  e.onPointerEnter$.subscribeEvent(() => {
1010
1021
  e.cursor = xt.GRAB;
1011
1022
  })
1012
1023
  )
1013
1024
  ), this.disposeWithMe(
1014
- Se(
1025
+ ze(
1015
1026
  e.onPointerLeave$.subscribeEvent(() => {
1016
1027
  e.cursor = xt.DEFAULT;
1017
1028
  })
@@ -1024,27 +1035,27 @@ let it = class extends Ne {
1024
1035
  return;
1025
1036
  const { unitId: n } = t;
1026
1037
  this._domLayerInfoMap.delete(e), t.dispose.dispose();
1027
- const r = this._getSceneAndTransformerByDrawingSearch(n);
1028
- r && r.scene.removeObject(t.rect);
1038
+ const i = this._getSceneAndTransformerByDrawingSearch(n);
1039
+ i && i.scene.removeObject(t.rect);
1029
1040
  }
1030
1041
  _initScrollAndZoomEvent() {
1031
1042
  const e = (t) => {
1032
1043
  const n = this._getSceneAndTransformerByDrawingSearch(t);
1033
- n && this._domLayerInfoMap.forEach((r) => {
1034
- if (r.unitId !== t) return;
1035
- const o = wt(r.rect, n.renderUnit);
1036
- r.position$.next(o);
1044
+ n && this._domLayerInfoMap.forEach((i) => {
1045
+ if (i.unitId !== t) return;
1046
+ const s = wt(i.rect, n.renderUnit);
1047
+ i.position$.next(s);
1037
1048
  });
1038
1049
  };
1039
1050
  this.disposeWithMe(
1040
- this._univerInstanceService.getCurrentTypeOfUnit$(we.UNIVER_DOC).pipe(
1051
+ this._univerInstanceService.getCurrentTypeOfUnit$(ve.UNIVER_DOC).pipe(
1041
1052
  Ht((t) => {
1042
1053
  if (!t) return null;
1043
- const n = t.getUnitId(), r = this._renderManagerService.getRenderById(n);
1044
- return r ? { render: r, unitId: n } : null;
1054
+ const n = t.getUnitId(), i = this._renderManagerService.getRenderById(n);
1055
+ return i ? { render: i, unitId: n } : null;
1045
1056
  }),
1046
- Mr(
1047
- (t) => t ? Zt(t.render.scene.getViewport(tn.VIEW_MAIN).onScrollAfter$).pipe(Ht(() => ({ unitId: t.unitId }))) : br(null)
1057
+ yi(
1058
+ (t) => t ? Zt(t.render.scene.getViewport(tn.VIEW_MAIN).onScrollAfter$).pipe(Ht(() => ({ unitId: t.unitId }))) : bi(null)
1048
1059
  )
1049
1060
  ).subscribe((t) => {
1050
1061
  if (!t) return;
@@ -1053,18 +1064,18 @@ let it = class extends Ne {
1053
1064
  })
1054
1065
  ), this.disposeWithMe(this._commandService.onCommandExecuted((t) => {
1055
1066
  if (t.id === nn.id) {
1056
- const n = t.params, { unitId: r } = n;
1057
- e(r);
1067
+ const n = t.params, { unitId: i } = n;
1068
+ e(i);
1058
1069
  }
1059
1070
  }));
1060
1071
  }
1061
1072
  insertFloatDom(e, t) {
1062
1073
  var m, p, w;
1063
- const n = this._univerInstanceService.getCurrentUnitOfType(we.UNIVER_DOC);
1074
+ const n = this._univerInstanceService.getCurrentUnitOfType(ve.UNIVER_DOC);
1064
1075
  if (!n) return !1;
1065
- const r = this._getSceneAndTransformerByDrawingSearch(n.getUnitId());
1066
- if (!r) return !1;
1067
- const c = (m = r.renderUnit.with(te).getSkeleton().getSkeletonData()) == null ? void 0 : m.pages[0];
1076
+ const i = this._getSceneAndTransformerByDrawingSearch(n.getUnitId());
1077
+ if (!i) return !1;
1078
+ const c = (m = i.renderUnit.with(te).getSkeleton().getSkeletonData()) == null ? void 0 : m.pages[0];
1068
1079
  if (!c) return !1;
1069
1080
  const { pageWidth: d, marginLeft: a, marginRight: g } = c, u = d - a - g, l = {
1070
1081
  size: {
@@ -1085,7 +1096,7 @@ let it = class extends Ne {
1085
1096
  drawings: [
1086
1097
  {
1087
1098
  drawingId: f,
1088
- drawingType: xe.DRAWING_DOM,
1099
+ drawingType: Pe.DRAWING_DOM,
1089
1100
  subUnitId: n.getUnitId(),
1090
1101
  unitId: n.getUnitId(),
1091
1102
  ...e,
@@ -1097,22 +1108,22 @@ let it = class extends Ne {
1097
1108
  }
1098
1109
  ]
1099
1110
  };
1100
- return this._commandService.syncExecuteCommand(Mt.id, h), f;
1111
+ return this._commandService.syncExecuteCommand(yt.id, h), f;
1101
1112
  }
1102
1113
  };
1103
- it = Gr([
1104
- Be(0, Q),
1105
- Be(1, fe),
1106
- Be(2, Z(gn)),
1107
- Be(3, Z(Ir)),
1108
- Be(4, z),
1109
- Be(5, j)
1110
- ], it);
1111
- const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1112
- const e = me(j), t = me(lt), n = me(fe), r = me(Q), o = me(z), { drawings: s } = i, c = s[0];
1114
+ rt = Gi([
1115
+ Le(0, Q),
1116
+ Le(1, fe),
1117
+ Le(2, Z(gn)),
1118
+ Le(3, Z(Ii)),
1119
+ Le(4, z),
1120
+ Le(5, j)
1121
+ ], rt);
1122
+ const Hi = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, ji = (r) => {
1123
+ const e = we(j), t = we(lt), n = we(fe), i = we(Q), s = we(z), { drawings: o } = r, c = o[0];
1113
1124
  if (c == null)
1114
1125
  return;
1115
- const { unitId: d } = c, a = o.getUniverDocInstance(d), g = a == null ? void 0 : a.getSnapshot().documentStyle.documentFlavor, u = r.getRenderById(d), l = u == null ? void 0 : u.scene;
1126
+ const { unitId: d } = c, a = s.getUniverDocInstance(d), g = a == null ? void 0 : a.getSnapshot().documentStyle.documentFlavor, u = i.getRenderById(d), l = u == null ? void 0 : u.scene;
1116
1127
  if (l == null)
1117
1128
  return;
1118
1129
  const f = l.getTransformerByCreate(), h = [{
@@ -1139,13 +1150,13 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1139
1150
  }, {
1140
1151
  label: t.t("image-position.paragraph"),
1141
1152
  value: String(W.PARAGRAPH)
1142
- }], [p, w] = ie(!0), [D, S] = ie({
1153
+ }], [p, w] = re(!0), [D, S] = re({
1143
1154
  relativeFrom: J.PAGE,
1144
1155
  posOffset: 0
1145
- }), [O, C] = ie({
1156
+ }), [O, C] = re({
1146
1157
  relativeFrom: W.PAGE,
1147
1158
  posOffset: 0
1148
- }), [M, A] = ie(!0), [L, R] = ie(!0);
1159
+ }), [y, A] = re(!0), [L, R] = re(!0);
1149
1160
  function v(_, E) {
1150
1161
  var b;
1151
1162
  _ === "positionH" ? S(E) : C(E);
@@ -1166,11 +1177,11 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1166
1177
  value: E
1167
1178
  }))
1168
1179
  });
1169
- const B = (b = r.getRenderById(d)) == null ? void 0 : b.with(Me);
1180
+ const B = (b = i.getRenderById(d)) == null ? void 0 : b.with(Me);
1170
1181
  B && B.blur(), f.refreshControls();
1171
1182
  }
1172
1183
  function N(_) {
1173
- var re, Ie, _e;
1184
+ var ie, Ie, _e;
1174
1185
  const E = D.relativeFrom, T = D.posOffset, U = Number(_);
1175
1186
  if (E === U)
1176
1187
  return;
@@ -1179,24 +1190,24 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1179
1190
  return;
1180
1191
  const b = B[0].drawingId, P = B[0].unitId;
1181
1192
  let V = null, F = 0;
1182
- const K = (re = r.getRenderById(P)) == null ? void 0 : re.with(te).getSkeleton(), se = K == null ? void 0 : K.getSkeletonData();
1183
- if (se == null)
1193
+ const K = (ie = i.getRenderById(P)) == null ? void 0 : ie.with(te).getSkeleton(), oe = K == null ? void 0 : K.getSkeletonData();
1194
+ if (oe == null)
1184
1195
  return;
1185
- const { pages: Le, skeHeaders: be, skeFooters: Ge } = se;
1186
- for (const ce of Le) {
1187
- const { marginLeft: De, skeDrawings: Oe, headerId: Ce, footerId: Ee, pageWidth: Te } = ce;
1188
- if (Oe.has(b)) {
1189
- V = Oe.get(b), F = De;
1196
+ const { pages: Ue, skeHeaders: ye, skeFooters: We } = oe;
1197
+ for (const ce of Ue) {
1198
+ const { marginLeft: Se, skeDrawings: De, headerId: be, footerId: Ce, pageWidth: Oe } = ce;
1199
+ if (De.has(b)) {
1200
+ V = De.get(b), F = Se;
1190
1201
  break;
1191
1202
  }
1192
- const de = (Ie = be.get(Ce)) == null ? void 0 : Ie.get(Te);
1203
+ const de = (Ie = ye.get(be)) == null ? void 0 : Ie.get(Oe);
1193
1204
  if (de != null && de.skeDrawings.has(b)) {
1194
- V = de == null ? void 0 : de.skeDrawings.get(b), F = De;
1205
+ V = de == null ? void 0 : de.skeDrawings.get(b), F = Se;
1195
1206
  break;
1196
1207
  }
1197
- const ge = (_e = Ge.get(Ee)) == null ? void 0 : _e.get(Te);
1208
+ const ge = (_e = We.get(Ce)) == null ? void 0 : _e.get(Oe);
1198
1209
  if (ge != null && ge.skeDrawings.has(b)) {
1199
- V = ge == null ? void 0 : ge.skeDrawings.get(b), F = De;
1210
+ V = ge == null ? void 0 : ge.skeDrawings.get(b), F = Se;
1200
1211
  break;
1201
1212
  }
1202
1213
  }
@@ -1211,26 +1222,26 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1211
1222
  v("positionH", ne);
1212
1223
  }
1213
1224
  function G(_) {
1214
- var Oe, Ce, Ee, Te, de, ge;
1225
+ var De, be, Ce, Oe, de, ge;
1215
1226
  const E = O.relativeFrom, T = O.posOffset, U = Number(_);
1216
1227
  if (E === U)
1217
1228
  return;
1218
1229
  const B = n.getFocusDrawings();
1219
1230
  if (B.length === 0)
1220
1231
  return;
1221
- const { drawingId: b, unitId: P } = B[0], V = o.getUniverDocInstance(P), F = (Oe = r.getRenderById(P)) == null ? void 0 : Oe.with(te).getSkeleton(), K = (Ce = r.getRenderById(P)) == null ? void 0 : Ce.with(Me), se = K == null ? void 0 : K.getSegment(), Le = K == null ? void 0 : K.getSegmentPage(), be = (Te = (Ee = V == null ? void 0 : V.getSelfOrHeaderFooterModel(se).getBody()) == null ? void 0 : Ee.customBlocks) == null ? void 0 : Te.find((Re) => Re.blockId === b);
1222
- if (be == null || F == null || K == null)
1232
+ const { drawingId: b, unitId: P } = B[0], V = s.getUniverDocInstance(P), F = (De = i.getRenderById(P)) == null ? void 0 : De.with(te).getSkeleton(), K = (be = i.getRenderById(P)) == null ? void 0 : be.with(Me), oe = K == null ? void 0 : K.getSegment(), Ue = K == null ? void 0 : K.getSegmentPage(), ye = (Oe = (Ce = V == null ? void 0 : V.getSelfOrHeaderFooterModel(oe).getBody()) == null ? void 0 : Ce.customBlocks) == null ? void 0 : Oe.find((Ee) => Ee.blockId === b);
1233
+ if (ye == null || F == null || K == null)
1223
1234
  return;
1224
- const { startIndex: Ge } = be, ae = F.findNodeByCharIndex(Ge, se, Le), ne = (de = ae == null ? void 0 : ae.parent) == null ? void 0 : de.parent, re = ne == null ? void 0 : ne.parent, Ie = re == null ? void 0 : re.lines.find((Re) => Re.paragraphIndex === (ne == null ? void 0 : ne.paragraphIndex) && Re.paragraphStart), _e = (ge = re == null ? void 0 : re.parent) == null ? void 0 : ge.parent;
1225
- if (ae == null || ne == null || Ie == null || re == null || _e == null)
1235
+ const { startIndex: We } = ye, ae = F.findNodeByCharIndex(We, oe, Ue), ne = (de = ae == null ? void 0 : ae.parent) == null ? void 0 : de.parent, ie = ne == null ? void 0 : ne.parent, Ie = ie == null ? void 0 : ie.lines.find((Ee) => Ee.paragraphIndex === (ne == null ? void 0 : ne.paragraphIndex) && Ee.paragraphStart), _e = (ge = ie == null ? void 0 : ie.parent) == null ? void 0 : ge.parent;
1236
+ if (ae == null || ne == null || Ie == null || ie == null || _e == null)
1226
1237
  return;
1227
1238
  let ce = 0;
1228
1239
  E === W.PARAGRAPH ? ce -= Ie.top : E === W.LINE ? ce -= ne.top : E === W.PAGE && (ce += _e.marginTop), U === W.PARAGRAPH ? ce += Ie.top : U === W.LINE ? ce += ne.top : U === W.PAGE && (ce -= _e.marginTop);
1229
- const De = {
1240
+ const Se = {
1230
1241
  relativeFrom: U,
1231
1242
  posOffset: (T != null ? T : 0) - ce
1232
1243
  };
1233
- v("positionV", De);
1244
+ v("positionV", Se);
1234
1245
  }
1235
1246
  function x(_) {
1236
1247
  var P;
@@ -1267,22 +1278,22 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1267
1278
  }, []), /* @__PURE__ */ X(
1268
1279
  "div",
1269
1280
  {
1270
- className: on("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
1281
+ className: sn("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
1271
1282
  "univer-hidden": !L
1272
1283
  }),
1273
1284
  children: [
1274
- /* @__PURE__ */ y(
1285
+ /* @__PURE__ */ M(
1275
1286
  "header",
1276
1287
  {
1277
1288
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1278
- children: /* @__PURE__ */ y("div", { children: t.t("image-position.title") })
1289
+ children: /* @__PURE__ */ M("div", { children: t.t("image-position.title") })
1279
1290
  }
1280
1291
  ),
1281
- /* @__PURE__ */ y(
1292
+ /* @__PURE__ */ M(
1282
1293
  "div",
1283
1294
  {
1284
1295
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1285
- children: /* @__PURE__ */ y("div", { children: t.t("image-position.horizontal") })
1296
+ children: /* @__PURE__ */ M("div", { children: t.t("image-position.horizontal") })
1286
1297
  }
1287
1298
  ),
1288
1299
  /* @__PURE__ */ X(
@@ -1291,9 +1302,9 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1291
1302
  className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
1292
1303
  children: [
1293
1304
  /* @__PURE__ */ X("div", { children: [
1294
- /* @__PURE__ */ y("span", { children: t.t("image-position.absolutePosition") }),
1295
- /* @__PURE__ */ y(
1296
- Fe,
1305
+ /* @__PURE__ */ M("span", { children: t.t("image-position.absolutePosition") }),
1306
+ /* @__PURE__ */ M(
1307
+ Be,
1297
1308
  {
1298
1309
  min: zt,
1299
1310
  max: Xt,
@@ -1310,8 +1321,8 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1310
1321
  )
1311
1322
  ] }),
1312
1323
  /* @__PURE__ */ X("div", { children: [
1313
- /* @__PURE__ */ y("span", { children: t.t("image-position.toTheRightOf") }),
1314
- /* @__PURE__ */ y(
1324
+ /* @__PURE__ */ M("span", { children: t.t("image-position.toTheRightOf") }),
1325
+ /* @__PURE__ */ M(
1315
1326
  Bt,
1316
1327
  {
1317
1328
  value: String(D.relativeFrom),
@@ -1324,11 +1335,11 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1324
1335
  ]
1325
1336
  }
1326
1337
  ),
1327
- /* @__PURE__ */ y(
1338
+ /* @__PURE__ */ M(
1328
1339
  "div",
1329
1340
  {
1330
1341
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1331
- children: /* @__PURE__ */ y("div", { children: t.t("image-position.vertical") })
1342
+ children: /* @__PURE__ */ M("div", { children: t.t("image-position.vertical") })
1332
1343
  }
1333
1344
  ),
1334
1345
  /* @__PURE__ */ X(
@@ -1337,9 +1348,9 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1337
1348
  className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
1338
1349
  children: [
1339
1350
  /* @__PURE__ */ X("div", { children: [
1340
- /* @__PURE__ */ y("span", { children: t.t("image-position.absolutePosition") }),
1341
- /* @__PURE__ */ y(
1342
- Fe,
1351
+ /* @__PURE__ */ M("span", { children: t.t("image-position.absolutePosition") }),
1352
+ /* @__PURE__ */ M(
1353
+ Be,
1343
1354
  {
1344
1355
  min: zt,
1345
1356
  max: Xt,
@@ -1356,8 +1367,8 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1356
1367
  )
1357
1368
  ] }),
1358
1369
  /* @__PURE__ */ X("div", { children: [
1359
- /* @__PURE__ */ y("span", { children: t.t("image-position.bellow") }),
1360
- /* @__PURE__ */ y(
1370
+ /* @__PURE__ */ M("span", { children: t.t("image-position.bellow") }),
1371
+ /* @__PURE__ */ M(
1361
1372
  Bt,
1362
1373
  {
1363
1374
  disabled: p,
@@ -1370,18 +1381,18 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1370
1381
  ]
1371
1382
  }
1372
1383
  ),
1373
- /* @__PURE__ */ y(
1384
+ /* @__PURE__ */ M(
1374
1385
  "div",
1375
1386
  {
1376
1387
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1377
- children: /* @__PURE__ */ y("div", { children: t.t("image-position.options") })
1388
+ children: /* @__PURE__ */ M("div", { children: t.t("image-position.options") })
1378
1389
  }
1379
1390
  ),
1380
- /* @__PURE__ */ y("div", { children: /* @__PURE__ */ y(
1381
- ar,
1391
+ /* @__PURE__ */ M("div", { children: /* @__PURE__ */ M(
1392
+ ai,
1382
1393
  {
1383
1394
  disabled: p,
1384
- checked: M,
1395
+ checked: y,
1385
1396
  onChange: I,
1386
1397
  children: t.t("image-position.moveObjectWithText")
1387
1398
  }
@@ -1389,19 +1400,19 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1389
1400
  ]
1390
1401
  }
1391
1402
  );
1392
- }, Qe = 0, Je = 100, Vr = (i) => {
1393
- const e = me(j), t = me(lt), n = me(fe), r = me(Q), o = me(z), { drawings: s } = i, c = s[0];
1403
+ }, Qe = 0, Je = 100, Vi = (r) => {
1404
+ const e = we(j), t = we(lt), n = we(fe), i = we(Q), s = we(z), { drawings: o } = r, c = o[0];
1394
1405
  if (c == null)
1395
1406
  return null;
1396
- const { unitId: d } = c, a = o.getUniverDocInstance(d), g = r.getRenderById(d);
1407
+ const { unitId: d } = c, a = s.getUniverDocInstance(d), g = i.getRenderById(d);
1397
1408
  if ((g == null ? void 0 : g.scene) == null)
1398
1409
  return null;
1399
- const [l, f] = ie(!0), [h, m] = ie(!0), [p, w] = ie(!0), [D, S] = ie(ue.INLINE), [O, C] = ie(""), [M, A] = ie({
1410
+ const [l, f] = re(!0), [h, m] = re(!0), [p, w] = re(!0), [D, S] = re(ue.INLINE), [O, C] = re(""), [y, A] = re({
1400
1411
  distT: 0,
1401
1412
  distL: 0,
1402
1413
  distB: 0,
1403
1414
  distR: 0
1404
- }), [L, R] = ie(!0);
1415
+ }), [L, R] = re(!0);
1405
1416
  function v(I) {
1406
1417
  S(I);
1407
1418
  const _ = n.getFocusDrawings();
@@ -1439,7 +1450,7 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1439
1450
  function G(I, _) {
1440
1451
  if (I == null)
1441
1452
  return;
1442
- const E = { ...M, [_]: I };
1453
+ const E = { ...y, [_]: I };
1443
1454
  A(E);
1444
1455
  const T = n.getFocusDrawings();
1445
1456
  if (T.length === 0)
@@ -1463,8 +1474,8 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1463
1474
  I.length !== 0 && H(I[0]);
1464
1475
  }
1465
1476
  function H(I) {
1466
- var K, se;
1467
- const _ = (se = (K = a == null ? void 0 : a.getSnapshot()) == null ? void 0 : K.drawings) == null ? void 0 : se[I.drawingId];
1477
+ var K, oe;
1478
+ const _ = (oe = (K = a == null ? void 0 : a.getSnapshot()) == null ? void 0 : K.drawings) == null ? void 0 : oe[I.drawingId];
1468
1479
  if (_ == null)
1469
1480
  return;
1470
1481
  const {
@@ -1473,8 +1484,8 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1473
1484
  distB: U = 0,
1474
1485
  distR: B = 0,
1475
1486
  layoutType: b = k.INLINE,
1476
- behindDoc: P = oe.FALSE,
1477
- wrapText: V = ze.BOTH_SIDES
1487
+ behindDoc: P = se.FALSE,
1488
+ wrapText: V = $e.BOTH_SIDES
1478
1489
  } = _;
1479
1490
  if (A({
1480
1491
  distT: E,
@@ -1482,7 +1493,7 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1482
1493
  distB: U,
1483
1494
  distR: B
1484
1495
  }), C(V), f(b !== k.WRAP_SQUARE), b === k.WRAP_NONE || b === k.INLINE ? m(!0) : m(!1), b === k.WRAP_NONE || b === k.INLINE || b === k.WRAP_TOP_AND_BOTTOM ? w(!0) : w(!1), b === k.WRAP_NONE)
1485
- P === oe.TRUE ? S(ue.BEHIND_TEXT) : S(ue.IN_FRONT_OF_TEXT);
1496
+ P === se.TRUE ? S(ue.BEHIND_TEXT) : S(ue.IN_FRONT_OF_TEXT);
1486
1497
  else
1487
1498
  switch (b) {
1488
1499
  case k.INLINE:
@@ -1515,48 +1526,48 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1515
1526
  }, []), /* @__PURE__ */ X(
1516
1527
  "div",
1517
1528
  {
1518
- className: on("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
1529
+ className: sn("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
1519
1530
  "univer-hidden": !L
1520
1531
  }),
1521
1532
  children: [
1522
- /* @__PURE__ */ y(
1533
+ /* @__PURE__ */ M(
1523
1534
  "header",
1524
1535
  {
1525
1536
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1526
- children: /* @__PURE__ */ y("div", { children: t.t("image-text-wrap.title") })
1537
+ children: /* @__PURE__ */ M("div", { children: t.t("image-text-wrap.title") })
1527
1538
  }
1528
1539
  ),
1529
- /* @__PURE__ */ y(
1540
+ /* @__PURE__ */ M(
1530
1541
  "div",
1531
1542
  {
1532
1543
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1533
- children: /* @__PURE__ */ y("div", { children: t.t("image-text-wrap.wrappingStyle") })
1544
+ children: /* @__PURE__ */ M("div", { children: t.t("image-text-wrap.wrappingStyle") })
1534
1545
  }
1535
1546
  ),
1536
- /* @__PURE__ */ y("div", { children: /* @__PURE__ */ X(Ft, { value: D, onChange: v, direction: "vertical", children: [
1537
- /* @__PURE__ */ y(ye, { value: ue.INLINE, children: t.t("image-text-wrap.inline") }),
1538
- /* @__PURE__ */ y(ye, { value: ue.WRAP_SQUARE, children: t.t("image-text-wrap.square") }),
1539
- /* @__PURE__ */ y(ye, { value: ue.WRAP_TOP_AND_BOTTOM, children: t.t("image-text-wrap.topAndBottom") }),
1540
- /* @__PURE__ */ y(ye, { value: ue.BEHIND_TEXT, children: t.t("image-text-wrap.behindText") }),
1541
- /* @__PURE__ */ y(ye, { value: ue.IN_FRONT_OF_TEXT, children: t.t("image-text-wrap.inFrontText") })
1547
+ /* @__PURE__ */ M("div", { children: /* @__PURE__ */ X(Ft, { value: D, onChange: v, direction: "vertical", children: [
1548
+ /* @__PURE__ */ M(Te, { value: ue.INLINE, children: t.t("image-text-wrap.inline") }),
1549
+ /* @__PURE__ */ M(Te, { value: ue.WRAP_SQUARE, children: t.t("image-text-wrap.square") }),
1550
+ /* @__PURE__ */ M(Te, { value: ue.WRAP_TOP_AND_BOTTOM, children: t.t("image-text-wrap.topAndBottom") }),
1551
+ /* @__PURE__ */ M(Te, { value: ue.BEHIND_TEXT, children: t.t("image-text-wrap.behindText") }),
1552
+ /* @__PURE__ */ M(Te, { value: ue.IN_FRONT_OF_TEXT, children: t.t("image-text-wrap.inFrontText") })
1542
1553
  ] }) }),
1543
- /* @__PURE__ */ y(
1554
+ /* @__PURE__ */ M(
1544
1555
  "div",
1545
1556
  {
1546
1557
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1547
- children: /* @__PURE__ */ y("div", { children: t.t("image-text-wrap.wrapText") })
1558
+ children: /* @__PURE__ */ M("div", { children: t.t("image-text-wrap.wrapText") })
1548
1559
  }
1549
1560
  ),
1550
- /* @__PURE__ */ y("div", { children: /* @__PURE__ */ X(Ft, { disabled: l, value: O, onChange: N, direction: "horizontal", children: [
1551
- /* @__PURE__ */ y(ye, { value: ze.BOTH_SIDES, children: t.t("image-text-wrap.bothSide") }),
1552
- /* @__PURE__ */ y(ye, { value: ze.LEFT, children: t.t("image-text-wrap.leftOnly") }),
1553
- /* @__PURE__ */ y(ye, { value: ze.RIGHT, children: t.t("image-text-wrap.rightOnly") })
1561
+ /* @__PURE__ */ M("div", { children: /* @__PURE__ */ X(Ft, { disabled: l, value: O, onChange: N, direction: "horizontal", children: [
1562
+ /* @__PURE__ */ M(Te, { value: $e.BOTH_SIDES, children: t.t("image-text-wrap.bothSide") }),
1563
+ /* @__PURE__ */ M(Te, { value: $e.LEFT, children: t.t("image-text-wrap.leftOnly") }),
1564
+ /* @__PURE__ */ M(Te, { value: $e.RIGHT, children: t.t("image-text-wrap.rightOnly") })
1554
1565
  ] }) }),
1555
- /* @__PURE__ */ y(
1566
+ /* @__PURE__ */ M(
1556
1567
  "div",
1557
1568
  {
1558
1569
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
1559
- children: /* @__PURE__ */ y("div", { children: t.t("image-text-wrap.distanceFromText") })
1570
+ children: /* @__PURE__ */ M("div", { children: t.t("image-text-wrap.distanceFromText") })
1560
1571
  }
1561
1572
  ),
1562
1573
  /* @__PURE__ */ X(
@@ -1565,15 +1576,15 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1565
1576
  className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
1566
1577
  children: [
1567
1578
  /* @__PURE__ */ X("div", { children: [
1568
- /* @__PURE__ */ y("span", { children: t.t("image-text-wrap.top") }),
1569
- /* @__PURE__ */ y(
1570
- Fe,
1579
+ /* @__PURE__ */ M("span", { children: t.t("image-text-wrap.top") }),
1580
+ /* @__PURE__ */ M(
1581
+ Be,
1571
1582
  {
1572
1583
  min: Qe,
1573
1584
  max: Je,
1574
1585
  disabled: h,
1575
1586
  precision: 1,
1576
- value: M.distT,
1587
+ value: y.distT,
1577
1588
  onChange: (I) => {
1578
1589
  G(I, "distT");
1579
1590
  }
@@ -1581,15 +1592,15 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1581
1592
  )
1582
1593
  ] }),
1583
1594
  /* @__PURE__ */ X("div", { children: [
1584
- /* @__PURE__ */ y("span", { children: t.t("image-text-wrap.left") }),
1585
- /* @__PURE__ */ y(
1586
- Fe,
1595
+ /* @__PURE__ */ M("span", { children: t.t("image-text-wrap.left") }),
1596
+ /* @__PURE__ */ M(
1597
+ Be,
1587
1598
  {
1588
1599
  min: Qe,
1589
1600
  max: Je,
1590
1601
  disabled: p,
1591
1602
  precision: 1,
1592
- value: M.distL,
1603
+ value: y.distL,
1593
1604
  onChange: (I) => {
1594
1605
  G(I, "distL");
1595
1606
  }
@@ -1605,15 +1616,15 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1605
1616
  className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
1606
1617
  children: [
1607
1618
  /* @__PURE__ */ X("div", { children: [
1608
- /* @__PURE__ */ y("span", { children: t.t("image-text-wrap.bottom") }),
1609
- /* @__PURE__ */ y(
1610
- Fe,
1619
+ /* @__PURE__ */ M("span", { children: t.t("image-text-wrap.bottom") }),
1620
+ /* @__PURE__ */ M(
1621
+ Be,
1611
1622
  {
1612
1623
  min: Qe,
1613
1624
  max: Je,
1614
1625
  disabled: h,
1615
1626
  precision: 1,
1616
- value: M.distB,
1627
+ value: y.distB,
1617
1628
  onChange: (I) => {
1618
1629
  G(I, "distB");
1619
1630
  }
@@ -1621,15 +1632,15 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1621
1632
  )
1622
1633
  ] }),
1623
1634
  /* @__PURE__ */ X("div", { children: [
1624
- /* @__PURE__ */ y("span", { children: t.t("image-text-wrap.right") }),
1625
- /* @__PURE__ */ y(
1626
- Fe,
1635
+ /* @__PURE__ */ M("span", { children: t.t("image-text-wrap.right") }),
1636
+ /* @__PURE__ */ M(
1637
+ Be,
1627
1638
  {
1628
1639
  min: Qe,
1629
1640
  max: Je,
1630
1641
  disabled: p,
1631
1642
  precision: 1,
1632
- value: M.distR,
1643
+ value: y.distR,
1633
1644
  onChange: (I) => {
1634
1645
  G(I, "distR");
1635
1646
  }
@@ -1642,28 +1653,28 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1642
1653
  ]
1643
1654
  }
1644
1655
  );
1645
- }, $r = () => {
1646
- const i = me(fe), e = i.getFocusDrawings(), [t, n] = ie(e);
1656
+ }, $i = () => {
1657
+ const r = we(fe), e = r.getFocusDrawings(), [t, n] = re(e);
1647
1658
  return Tt(() => {
1648
- const r = i.focus$.subscribe((o) => {
1649
- n(o);
1659
+ const i = r.focus$.subscribe((s) => {
1660
+ n(s);
1650
1661
  });
1651
1662
  return () => {
1652
- r.unsubscribe();
1663
+ i.unsubscribe();
1653
1664
  };
1654
1665
  }, []), !!(t != null && t.length) && /* @__PURE__ */ X("div", { className: "univer-text-sm", children: [
1655
- /* @__PURE__ */ y(Er, { drawings: t, hasAlign: !1, hasCropper: !1, hasGroup: !1, hasTransform: !1 }),
1656
- /* @__PURE__ */ y(Vr, { drawings: t }),
1657
- /* @__PURE__ */ y(jr, { drawings: t })
1666
+ /* @__PURE__ */ M(Ei, { drawings: t, hasAlign: !1, hasCropper: !1, hasGroup: !1, hasTransform: !1 }),
1667
+ /* @__PURE__ */ M(Vi, { drawings: t }),
1668
+ /* @__PURE__ */ M(ji, { drawings: t })
1658
1669
  ] });
1659
- }, Mn = "doc.menu.image", bn = pn.id, zr = (i) => {
1660
- const e = i.get(Dt), t = i.get(z);
1661
- return new Cr((n) => {
1662
- const r = e.textSelection$.subscribe(() => {
1663
- var s;
1664
- const o = e.getActiveTextRange();
1665
- if (o) {
1666
- const { segmentId: c, startOffset: d, endOffset: a } = o, g = t.getCurrentUniverDocInstance(), u = (s = g == null ? void 0 : g.getSelfOrHeaderFooterModel(c).getBody()) == null ? void 0 : s.tables;
1670
+ }, yn = "doc.menu.image", bn = pn.id, zi = (r) => {
1671
+ const e = r.get(Dt), t = r.get(z);
1672
+ return new Ci((n) => {
1673
+ const i = e.textSelection$.subscribe(() => {
1674
+ var o;
1675
+ const s = e.getActiveTextRange();
1676
+ if (s) {
1677
+ const { segmentId: c, startOffset: d, endOffset: a } = s, g = t.getCurrentUniverDocInstance(), u = (o = g == null ? void 0 : g.getSelfOrHeaderFooterModel(c).getBody()) == null ? void 0 : o.tables;
1667
1678
  if (u && u.length && u.some((l) => {
1668
1679
  const { startIndex: f, endIndex: h } = l;
1669
1680
  return d >= f && d < h || a >= f && a < h;
@@ -1677,160 +1688,160 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
1677
1688
  }
1678
1689
  n.next(!1);
1679
1690
  });
1680
- return () => r.unsubscribe();
1691
+ return () => i.unsubscribe();
1681
1692
  });
1682
1693
  };
1683
- function Xr(i) {
1694
+ function Xi(r) {
1684
1695
  return {
1685
- id: Mn,
1696
+ id: yn,
1686
1697
  type: an.SUBITEMS,
1687
1698
  icon: "AddImageIcon",
1688
1699
  tooltip: "docImage.title",
1689
- disabled$: zr(i),
1690
- hidden$: sn(i, we.UNIVER_DOC, void 0, St)
1700
+ disabled$: zi(r),
1701
+ hidden$: on(r, ve.UNIVER_DOC, void 0, St)
1691
1702
  };
1692
1703
  }
1693
- function qr(i) {
1704
+ function qi(r) {
1694
1705
  return {
1695
1706
  id: bn,
1696
1707
  title: "docImage.upload.float",
1697
1708
  type: an.BUTTON,
1698
- hidden$: sn(i, we.UNIVER_DOC, void 0, St)
1709
+ hidden$: on(r, ve.UNIVER_DOC, void 0, St)
1699
1710
  };
1700
1711
  }
1701
- const Kr = {
1702
- [_r.MEDIA]: {
1703
- [Mn]: {
1712
+ const Ki = {
1713
+ [_i.MEDIA]: {
1714
+ [yn]: {
1704
1715
  order: 0,
1705
- menuItemFactory: Xr,
1716
+ menuItemFactory: Xi,
1706
1717
  [bn]: {
1707
1718
  order: 0,
1708
- menuItemFactory: qr
1719
+ menuItemFactory: qi
1709
1720
  }
1710
1721
  }
1711
1722
  }
1712
1723
  };
1713
- function Ye(i) {
1714
- return i.getContextValue(Bn) && i.getContextValue(nt);
1724
+ function Ye(r) {
1725
+ return r.getContextValue(Bn) && r.getContextValue(nt);
1715
1726
  }
1716
- const Yr = {
1727
+ const Yi = {
1717
1728
  id: Ke.id,
1718
1729
  description: "shortcut.drawing-move-down",
1719
1730
  group: "4_drawing-view",
1720
- binding: We.ARROW_DOWN,
1731
+ binding: ke.ARROW_DOWN,
1721
1732
  priority: 100,
1722
1733
  preconditions: Ye,
1723
1734
  staticParameters: {
1724
1735
  direction: he.DOWN
1725
1736
  }
1726
- }, Zr = {
1737
+ }, Zi = {
1727
1738
  id: Ke.id,
1728
1739
  description: "shortcut.drawing-move-up",
1729
1740
  group: "4_drawing-view",
1730
- binding: We.ARROW_UP,
1741
+ binding: ke.ARROW_UP,
1731
1742
  priority: 100,
1732
1743
  preconditions: Ye,
1733
1744
  staticParameters: {
1734
1745
  direction: he.UP
1735
1746
  }
1736
- }, Qr = {
1747
+ }, Qi = {
1737
1748
  id: Ke.id,
1738
1749
  description: "shortcut.drawing-move-left",
1739
1750
  group: "4_drawing-view",
1740
- binding: We.ARROW_LEFT,
1751
+ binding: ke.ARROW_LEFT,
1741
1752
  priority: 100,
1742
1753
  preconditions: Ye,
1743
1754
  staticParameters: {
1744
1755
  direction: he.LEFT
1745
1756
  }
1746
- }, Jr = {
1757
+ }, Ji = {
1747
1758
  id: Ke.id,
1748
1759
  description: "shortcut.drawing-move-right",
1749
1760
  group: "4_drawing-view",
1750
- binding: We.ARROW_RIGHT,
1761
+ binding: ke.ARROW_RIGHT,
1751
1762
  priority: 100,
1752
1763
  preconditions: Ye,
1753
1764
  staticParameters: {
1754
1765
  direction: he.RIGHT
1755
1766
  }
1756
- }, ei = {
1767
+ }, er = {
1757
1768
  id: ln.id,
1758
1769
  description: "shortcut.drawing-delete",
1759
1770
  group: "4_drawing-view",
1760
1771
  // when focusing on any other input tag do not trigger this shortcut
1761
1772
  preconditions: Ye,
1762
- binding: We.DELETE,
1763
- mac: We.BACKSPACE
1773
+ binding: ke.DELETE,
1774
+ mac: ke.BACKSPACE
1764
1775
  };
1765
- var ti = Object.getOwnPropertyDescriptor, ni = (i, e, t, n) => {
1766
- for (var r = n > 1 ? void 0 : n ? ti(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1767
- (s = i[o]) && (r = s(r) || r);
1768
- return r;
1769
- }, et = (i, e) => (t, n) => e(t, n, i);
1770
- let ot = class extends Ne {
1771
- constructor(i, e, t, n) {
1772
- super(), this._componentManager = i, this._menuManagerService = e, this._commandService = t, this._shortcutService = n, this._init();
1776
+ var tr = Object.getOwnPropertyDescriptor, nr = (r, e, t, n) => {
1777
+ for (var i = n > 1 ? void 0 : n ? tr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1778
+ (o = r[s]) && (i = o(i) || i);
1779
+ return i;
1780
+ }, et = (r, e) => (t, n) => e(t, n, r);
1781
+ let st = class extends xe {
1782
+ constructor(r, e, t, n) {
1783
+ super(), this._componentManager = r, this._menuManagerService = e, this._commandService = t, this._shortcutService = n, this._init();
1773
1784
  }
1774
1785
  _initCustomComponents() {
1775
- const i = this._componentManager;
1776
- this.disposeWithMe(i.register(Dn, $r));
1786
+ const r = this._componentManager;
1787
+ this.disposeWithMe(r.register(Dn, $i));
1777
1788
  }
1778
1789
  _initMenus() {
1779
- this._menuManagerService.mergeMenu(Kr);
1790
+ this._menuManagerService.mergeMenu(Ki);
1780
1791
  }
1781
1792
  _initCommands() {
1782
1793
  [
1783
1794
  pn,
1784
- Mt,
1795
+ yt,
1785
1796
  wn,
1786
1797
  vn,
1787
1798
  In,
1788
1799
  qe,
1789
1800
  _n,
1790
1801
  Sn,
1791
- yt,
1802
+ Mt,
1792
1803
  On,
1793
- kr,
1804
+ ki,
1794
1805
  Tn,
1795
1806
  un,
1796
1807
  fn,
1797
1808
  Ke,
1798
1809
  ln,
1799
1810
  hn
1800
- ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
1811
+ ].forEach((r) => this.disposeWithMe(this._commandService.registerCommand(r)));
1801
1812
  }
1802
1813
  _initShortcuts() {
1803
1814
  [
1804
1815
  // sheet drawing shortcuts
1805
- Yr,
1806
- Zr,
1807
- Qr,
1808
- Jr,
1809
- ei
1810
- ].forEach((i) => {
1811
- this.disposeWithMe(this._shortcutService.registerShortcut(i));
1816
+ Yi,
1817
+ Zi,
1818
+ Qi,
1819
+ Ji,
1820
+ er
1821
+ ].forEach((r) => {
1822
+ this.disposeWithMe(this._shortcutService.registerShortcut(r));
1812
1823
  });
1813
1824
  }
1814
1825
  _init() {
1815
1826
  this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
1816
1827
  }
1817
1828
  };
1818
- ot = ni([
1829
+ st = nr([
1819
1830
  et(0, Z(cn)),
1820
- et(1, Sr),
1831
+ et(1, Si),
1821
1832
  et(2, j),
1822
- et(3, Dr)
1823
- ], ot);
1824
- var ri = Object.getOwnPropertyDescriptor, ii = (i, e, t, n) => {
1825
- for (var r = n > 1 ? void 0 : n ? ri(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1826
- (s = i[o]) && (r = s(r) || r);
1827
- return r;
1828
- }, je = (i, e) => (t, n) => e(t, n, i);
1829
- function oi(i) {
1830
- var n, r, o, s;
1831
- if ($.isNoop(i) || !Array.isArray(i))
1833
+ et(3, Di)
1834
+ ], st);
1835
+ var ir = Object.getOwnPropertyDescriptor, rr = (r, e, t, n) => {
1836
+ for (var i = n > 1 ? void 0 : n ? ir(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1837
+ (o = r[s]) && (i = o(i) || i);
1838
+ return i;
1839
+ }, He = (r, e) => (t, n) => e(t, n, r);
1840
+ function sr(r) {
1841
+ var n, i, s, o;
1842
+ if ($.isNoop(r) || !Array.isArray(r))
1832
1843
  return null;
1833
- const e = i.find((c) => Array.isArray(c) && (c == null ? void 0 : c[0]) === "drawings");
1844
+ const e = r.find((c) => Array.isArray(c) && (c == null ? void 0 : c[0]) === "drawings");
1834
1845
  if (e == null || !Array.isArray(e) || e.length < 3 || typeof e[1] == "string" && typeof e[2] != "object" || Array.isArray(e[1]) && typeof e[1][1] != "object")
1835
1846
  return null;
1836
1847
  const t = [];
@@ -1839,22 +1850,22 @@ function oi(i) {
1839
1850
  Array.isArray(c) && t.push({
1840
1851
  type: (n = c == null ? void 0 : c[1]) != null && n.i ? "add" : "remove",
1841
1852
  drawingId: c == null ? void 0 : c[0],
1842
- drawing: (r = c == null ? void 0 : c[1]) == null ? void 0 : r.i
1853
+ drawing: (i = c == null ? void 0 : c[1]) == null ? void 0 : i.i
1843
1854
  });
1844
1855
  else
1845
1856
  t.push({
1846
- type: (o = e[2]) != null && o.i ? "add" : "remove",
1857
+ type: (s = e[2]) != null && s.i ? "add" : "remove",
1847
1858
  drawingId: e[1],
1848
- drawing: (s = e[2]) == null ? void 0 : s.i
1859
+ drawing: (o = e[2]) == null ? void 0 : o.i
1849
1860
  });
1850
1861
  return t;
1851
1862
  }
1852
- function si(i) {
1853
- if (!Array.isArray(i) || i.length < 3 || i[0] !== "drawingsOrder")
1863
+ function or(r) {
1864
+ if (!Array.isArray(r) || r.length < 3 || r[0] !== "drawingsOrder")
1854
1865
  return [];
1855
1866
  const e = [];
1856
- for (let t = 1; t < i.length; t++) {
1857
- const n = i[t];
1867
+ for (let t = 1; t < r.length; t++) {
1868
+ const n = r[t];
1858
1869
  if (Array.isArray(n) && typeof n[0] == "number" && typeof n[1] == "object")
1859
1870
  e.push(n[0]);
1860
1871
  else {
@@ -1864,84 +1875,84 @@ function si(i) {
1864
1875
  }
1865
1876
  return e;
1866
1877
  }
1867
- let st = class extends Ne {
1868
- constructor(i, e, t, n, r) {
1869
- super(), this._univerInstanceService = i, this._commandService = e, this._drawingManagerService = t, this._docDrawingService = n, this._renderManagerService = r, this._initialize();
1878
+ let ot = class extends xe {
1879
+ constructor(r, e, t, n, i) {
1880
+ super(), this._univerInstanceService = r, this._commandService = e, this._drawingManagerService = t, this._docDrawingService = n, this._renderManagerService = i, this._initialize();
1870
1881
  }
1871
1882
  _initialize() {
1872
1883
  this._commandExecutedListener();
1873
1884
  }
1874
1885
  _commandExecutedListener() {
1875
1886
  this.disposeWithMe(
1876
- this._commandService.beforeCommandExecuted((i) => {
1877
- if (i.id !== ee.id)
1887
+ this._commandService.beforeCommandExecuted((r) => {
1888
+ if (r.id !== ee.id)
1878
1889
  return;
1879
- const e = i.params, { unitId: t, actions: n } = e, r = oi(n);
1880
- if (r != null)
1881
- for (const { type: o, drawingId: s, drawing: c } of r)
1882
- o === "add" ? this._addDrawings(t, [c]) : this._removeDrawings(t, [s]);
1890
+ const e = r.params, { unitId: t, actions: n } = e, i = sr(n);
1891
+ if (i != null)
1892
+ for (const { type: s, drawingId: o, drawing: c } of i)
1893
+ s === "add" ? this._addDrawings(t, [c]) : this._removeDrawings(t, [o]);
1883
1894
  })
1884
1895
  ), this.disposeWithMe(
1885
- this._commandService.onCommandExecuted((i) => {
1886
- if (i.id !== ee.id)
1896
+ this._commandService.onCommandExecuted((r) => {
1897
+ if (r.id !== ee.id)
1887
1898
  return;
1888
- const e = i.params, { unitId: t, actions: n } = e;
1889
- si(n).length > 0 && this._updateDrawingsOrder(t);
1899
+ const e = r.params, { unitId: t, actions: n } = e;
1900
+ or(n).length > 0 && this._updateDrawingsOrder(t);
1890
1901
  })
1891
1902
  ), this.disposeWithMe(
1892
- this._commandService.onCommandExecuted((i) => {
1893
- var s;
1894
- if (i.id !== Fn.id && i.id !== kn.id)
1903
+ this._commandService.onCommandExecuted((r) => {
1904
+ var o;
1905
+ if (r.id !== Fn.id && r.id !== kn.id)
1895
1906
  return;
1896
- const e = (s = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : s.getUnitId(), t = this._drawingManagerService.getFocusDrawings();
1907
+ const e = (o = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : o.getUnitId(), t = this._drawingManagerService.getFocusDrawings();
1897
1908
  if (e == null || t.length === 0)
1898
1909
  return;
1899
- const n = this._renderManagerService.getRenderById(e), r = n == null ? void 0 : n.scene;
1900
- if (r == null)
1910
+ const n = this._renderManagerService.getRenderById(e), i = n == null ? void 0 : n.scene;
1911
+ if (i == null)
1901
1912
  return !1;
1902
- r.getTransformerByCreate().refreshControls();
1913
+ i.getTransformerByCreate().refreshControls();
1903
1914
  })
1904
1915
  );
1905
1916
  }
1906
- _addDrawings(i, e) {
1907
- const t = this._drawingManagerService, n = this._docDrawingService, r = this._docDrawingService.getBatchAddOp(e), { subUnitId: o, redo: s, objects: c } = r;
1908
- t.applyJson1(i, o, s), n.applyJson1(i, o, s), t.addNotification(c), n.addNotification(c);
1917
+ _addDrawings(r, e) {
1918
+ const t = this._drawingManagerService, n = this._docDrawingService, i = this._docDrawingService.getBatchAddOp(e), { subUnitId: s, redo: o, objects: c } = i;
1919
+ t.applyJson1(r, s, o), n.applyJson1(r, s, o), t.addNotification(c), n.addNotification(c);
1909
1920
  }
1910
- _removeDrawings(i, e) {
1911
- const t = this._drawingManagerService, n = this._docDrawingService, r = this._docDrawingService.getBatchRemoveOp(e.map((d) => ({
1912
- unitId: i,
1913
- subUnitId: i,
1921
+ _removeDrawings(r, e) {
1922
+ const t = this._drawingManagerService, n = this._docDrawingService, i = this._docDrawingService.getBatchRemoveOp(e.map((d) => ({
1923
+ unitId: r,
1924
+ subUnitId: r,
1914
1925
  drawingId: d
1915
- }))), { subUnitId: o, redo: s, objects: c } = r;
1916
- t.applyJson1(i, o, s), n.applyJson1(i, o, s), t.removeNotification(c), n.removeNotification(c);
1926
+ }))), { subUnitId: s, redo: o, objects: c } = i;
1927
+ t.applyJson1(r, s, o), n.applyJson1(r, s, o), t.removeNotification(c), n.removeNotification(c);
1917
1928
  }
1918
- _updateDrawingsOrder(i) {
1919
- const e = this._univerInstanceService.getUniverDocInstance(i);
1929
+ _updateDrawingsOrder(r) {
1930
+ const e = this._univerInstanceService.getUniverDocInstance(r);
1920
1931
  if (e == null)
1921
1932
  return;
1922
1933
  const t = e.getSnapshot().drawingsOrder;
1923
1934
  if (t == null)
1924
1935
  return;
1925
- const n = this._drawingManagerService, r = this._docDrawingService;
1926
- n.setDrawingOrder(i, i, t), r.setDrawingOrder(i, i, t);
1927
- const o = {
1928
- unitId: i,
1929
- subUnitId: i,
1936
+ const n = this._drawingManagerService, i = this._docDrawingService;
1937
+ n.setDrawingOrder(r, r, t), i.setDrawingOrder(r, r, t);
1938
+ const s = {
1939
+ unitId: r,
1940
+ subUnitId: r,
1930
1941
  drawingIds: t
1931
1942
  };
1932
- n.orderNotification(o), r.orderNotification(o);
1943
+ n.orderNotification(s), i.orderNotification(s);
1933
1944
  }
1934
1945
  };
1935
- st = ii([
1936
- je(0, z),
1937
- je(1, j),
1938
- je(2, fe),
1939
- je(3, Ue),
1940
- je(4, Q)
1941
- ], st);
1942
- const ai = (i) => {
1943
- const { floatDomInfos: e, scene: t, offset: n, bound: r } = i, o = r.right - r.left, s = r.bottom - r.top, c = Ur(() => e.map((d) => {
1944
- const { width: a = 0, height: g = 0, left: u = 0, top: l = 0 } = d.transform, h = yn(
1946
+ ot = rr([
1947
+ He(0, z),
1948
+ He(1, j),
1949
+ He(2, fe),
1950
+ He(3, Ne),
1951
+ He(4, Q)
1952
+ ], ot);
1953
+ const ar = (r) => {
1954
+ const { floatDomInfos: e, scene: t, offset: n, bound: i } = r, s = i.right - i.left, o = i.bottom - i.top, c = Ui(() => e.map((d) => {
1955
+ const { width: a = 0, height: g = 0, left: u = 0, top: l = 0 } = d.transform, h = Mn(
1945
1956
  {
1946
1957
  left: u,
1947
1958
  right: u + a,
@@ -1966,28 +1977,28 @@ const ai = (i) => {
1966
1977
  data: d.data
1967
1978
  };
1968
1979
  return [d.drawingId, m];
1969
- }).filter(([d, a]) => !(a.position.endX < 0 || a.position.endY < 0 || a.position.startX > o || a.position.startY > s)), [e, t, n, o, s]);
1970
- return /* @__PURE__ */ y("div", { className: "univer-absolute univer-left-0 univer-top-0", children: c.map(([d, a]) => /* @__PURE__ */ y(Or, { layer: a, id: d, position: a.position }, d)) });
1980
+ }).filter(([d, a]) => !(a.position.endX < 0 || a.position.endY < 0 || a.position.startX > s || a.position.startY > o)), [e, t, n, s, o]);
1981
+ return /* @__PURE__ */ M("div", { className: "univer-absolute univer-left-0 univer-top-0", children: c.map(([d, a]) => /* @__PURE__ */ M(Oi, { layer: a, id: d, position: a.position }, d)) });
1971
1982
  };
1972
- var ci = Object.getOwnPropertyDescriptor, di = (i, e, t, n) => {
1973
- for (var r = n > 1 ? void 0 : n ? ci(e, t) : e, o = i.length - 1, s; o >= 0; o--)
1974
- (s = i[o]) && (r = s(r) || r);
1975
- return r;
1976
- }, Ve = (i, e) => (t, n) => e(t, n, i);
1977
- let at = class extends Ne {
1978
- constructor(i, e, t, n, r) {
1979
- super(), this._docPrintInterceptorService = i, this._drawingRenderService = e, this._drawingManagerService = t, this._componetManager = n, this._injector = r, this._initPrinting(), this._initPrintingDom();
1983
+ var cr = Object.getOwnPropertyDescriptor, dr = (r, e, t, n) => {
1984
+ for (var i = n > 1 ? void 0 : n ? cr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1985
+ (o = r[s]) && (i = o(i) || i);
1986
+ return i;
1987
+ }, je = (r, e) => (t, n) => e(t, n, r);
1988
+ let at = class extends xe {
1989
+ constructor(r, e, t, n, i) {
1990
+ super(), this._docPrintInterceptorService = r, this._drawingRenderService = e, this._drawingManagerService = t, this._componetManager = n, this._injector = i, this._initPrinting(), this._initPrintingDom();
1980
1991
  }
1981
1992
  _initPrinting() {
1982
1993
  this.disposeWithMe(
1983
1994
  this._docPrintInterceptorService.interceptor.intercept(
1984
1995
  this._docPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
1985
1996
  {
1986
- handler: (i, e, t) => {
1987
- const { unitId: n, scene: r } = e, o = this._drawingManagerService.getDrawingDataForUnit(n), s = o == null ? void 0 : o[n];
1988
- return s && s.order.forEach((c) => {
1989
- const d = s.data[c];
1990
- d.drawingType !== xe.DRAWING_CHART && d.drawingType !== xe.DRAWING_DOM && this._drawingRenderService.renderDrawing(d, r);
1997
+ handler: (r, e, t) => {
1998
+ const { unitId: n, scene: i } = e, s = this._drawingManagerService.getDrawingDataForUnit(n), o = s == null ? void 0 : s[n];
1999
+ return o && o.order.forEach((c) => {
2000
+ const d = o.data[c];
2001
+ d.drawingType !== Pe.DRAWING_CHART && d.drawingType !== Pe.DRAWING_DOM && this._drawingRenderService.renderDrawing(d, i);
1991
2002
  }), t();
1992
2003
  }
1993
2004
  }
@@ -1999,17 +2010,17 @@ let at = class extends Ne {
1999
2010
  this._docPrintInterceptorService.interceptor.intercept(
2000
2011
  this._docPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_DOM_COLLECT,
2001
2012
  {
2002
- handler: (i, e, t) => {
2003
- const { unitId: n } = e, r = this._drawingManagerService.getDrawingDataForUnit(n), o = r == null ? void 0 : r[n];
2004
- if (o) {
2005
- const s = o.order.map((d) => {
2006
- const a = o.data[d];
2007
- if (a.drawingType === xe.DRAWING_CHART)
2013
+ handler: (r, e, t) => {
2014
+ const { unitId: n } = e, i = this._drawingManagerService.getDrawingDataForUnit(n), s = i == null ? void 0 : i[n];
2015
+ if (s) {
2016
+ const o = s.order.map((d) => {
2017
+ const a = s.data[d];
2018
+ if (a.drawingType === Pe.DRAWING_CHART)
2008
2019
  return {
2009
2020
  ...a,
2010
2021
  componentKey: this._componetManager.get(Wn)
2011
2022
  };
2012
- if (a.drawingType === xe.DRAWING_DOM) {
2023
+ if (a.drawingType === Pe.DRAWING_DOM) {
2013
2024
  const g = this._docPrintInterceptorService.getPrintComponent(a.componentKey);
2014
2025
  return {
2015
2026
  ...a,
@@ -2017,13 +2028,13 @@ let at = class extends Ne {
2017
2028
  };
2018
2029
  }
2019
2030
  return null;
2020
- }).filter(Boolean), c = Tr(ai, this._injector);
2021
- return cr(
2022
- /* @__PURE__ */ y(
2031
+ }).filter(Boolean), c = Ti(ar, this._injector);
2032
+ return ci(
2033
+ /* @__PURE__ */ M(
2023
2034
  c,
2024
2035
  {
2025
2036
  unitId: n,
2026
- floatDomInfos: s,
2037
+ floatDomInfos: o,
2027
2038
  scene: e.scene,
2028
2039
  skeleton: e.skeleton,
2029
2040
  offset: e.offset,
@@ -2031,9 +2042,9 @@ let at = class extends Ne {
2031
2042
  }
2032
2043
  ),
2033
2044
  e.root
2034
- ), i == null || i.add(() => {
2035
- dr(e.root);
2036
- }), t(i);
2045
+ ), r == null || r.add(() => {
2046
+ di(e.root);
2047
+ }), t(r);
2037
2048
  }
2038
2049
  }
2039
2050
  }
@@ -2041,32 +2052,32 @@ let at = class extends Ne {
2041
2052
  );
2042
2053
  }
2043
2054
  };
2044
- at = di([
2045
- Ve(0, Z(Yn)),
2046
- Ve(1, Z(gn)),
2047
- Ve(2, fe),
2048
- Ve(3, Z(cn)),
2049
- Ve(4, Z(Jt))
2055
+ at = dr([
2056
+ je(0, Z(Yn)),
2057
+ je(1, Z(gn)),
2058
+ je(2, fe),
2059
+ je(3, Z(cn)),
2060
+ je(4, Z(Jt))
2050
2061
  ], at);
2051
- var gi = Object.getOwnPropertyDescriptor, li = (i, e, t, n) => {
2052
- for (var r = n > 1 ? void 0 : n ? gi(e, t) : e, o = i.length - 1, s; o >= 0; o--)
2053
- (s = i[o]) && (r = s(r) || r);
2054
- return r;
2055
- }, tt = (i, e) => (t, n) => e(t, n, i);
2056
- const ui = "__InlineDrawingAnchor__";
2057
- function qt(i) {
2058
- const { path: e } = i;
2062
+ var gr = Object.getOwnPropertyDescriptor, lr = (r, e, t, n) => {
2063
+ for (var i = n > 1 ? void 0 : n ? gr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
2064
+ (o = r[s]) && (i = o(i) || i);
2065
+ return i;
2066
+ }, tt = (r, e) => (t, n) => e(t, n, r);
2067
+ const ur = "__InlineDrawingAnchor__";
2068
+ function qt(r) {
2069
+ const { path: e } = r;
2059
2070
  return e.some((t) => t === "cells");
2060
2071
  }
2061
- let ct = class extends Ne {
2062
- constructor(e, t, n, r) {
2072
+ let ct = class extends xe {
2073
+ constructor(e, t, n, i) {
2063
2074
  super();
2064
- ve(this, "_liquid", new rn());
2065
- ve(this, "_listenerOnImageMap", /* @__PURE__ */ new Set());
2075
+ me(this, "_liquid", new rn());
2076
+ me(this, "_listenerOnImageMap", /* @__PURE__ */ new Set());
2066
2077
  // Use to cache the drawings is under transforming or scaling.
2067
- ve(this, "_transformerCache", /* @__PURE__ */ new Map());
2068
- ve(this, "_anchorShape");
2069
- this._commandService = e, this._univerInstanceService = t, this._drawingManagerService = n, this._renderManagerService = r, this._init();
2078
+ me(this, "_transformerCache", /* @__PURE__ */ new Map());
2079
+ me(this, "_anchorShape");
2080
+ this._commandService = e, this._univerInstanceService = t, this._drawingManagerService = n, this._renderManagerService = i, this._init();
2070
2081
  }
2071
2082
  _init() {
2072
2083
  this._listenDrawingFocus();
@@ -2085,17 +2096,17 @@ let ct = class extends Ne {
2085
2096
  // Only handle one drawing transformer change.
2086
2097
  // eslint-disable-next-line max-lines-per-function
2087
2098
  _listenTransformerChange(e) {
2088
- var r;
2089
- const t = (r = this._getSceneAndTransformerByDrawingSearch(e)) == null ? void 0 : r.transformer;
2099
+ var i;
2100
+ const t = (i = this._getSceneAndTransformerByDrawingSearch(e)) == null ? void 0 : i.transformer;
2090
2101
  if (t == null)
2091
2102
  return;
2092
2103
  this.disposeWithMe(
2093
- Se(
2094
- t.changeStart$.subscribe((o) => {
2104
+ ze(
2105
+ t.changeStart$.subscribe((s) => {
2095
2106
  var c;
2096
2107
  this._transformerCache.clear();
2097
- const { objects: s } = o;
2098
- for (const d of s.values()) {
2108
+ const { objects: o } = s;
2109
+ for (const d of o.values()) {
2099
2110
  const { oKey: a, width: g, height: u, left: l, top: f, angle: h } = d, m = this._drawingManagerService.getDrawingOKey(a);
2100
2111
  if (m == null)
2101
2112
  continue;
@@ -2119,13 +2130,13 @@ let ct = class extends Ne {
2119
2130
  );
2120
2131
  const n = Et(this._updateMultipleDrawingDocTransform.bind(this), 50);
2121
2132
  Et(this._nonInlineDrawingTransform.bind(this), 50), this.disposeWithMe(
2122
- Se(
2123
- t.changing$.subscribe((o) => {
2124
- const { objects: s, offsetX: c, offsetY: d } = o;
2125
- if (s.size > 1)
2126
- n(s);
2127
- else if (s.size === 1) {
2128
- const a = this._transformerCache.values().next().value, g = s.values().next().value, { width: u, height: l, top: f, left: h, angle: m } = g;
2133
+ ze(
2134
+ t.changing$.subscribe((s) => {
2135
+ const { objects: o, offsetX: c, offsetY: d } = s;
2136
+ if (o.size > 1)
2137
+ n(o);
2138
+ else if (o.size === 1) {
2139
+ const a = this._transformerCache.values().next().value, g = o.values().next().value, { width: u, height: l, top: f, left: h, angle: m } = g;
2129
2140
  if (a && u === a.width && l === a.height && f === a.top && h === a.left && m === a.angle)
2130
2141
  return;
2131
2142
  a && (a.drawing.layoutType, k.INLINE), a && a.drawing.layoutType === k.INLINE && c != null && d != null && this._updateInlineDrawingAnchor(a.drawing, c, d);
@@ -2133,11 +2144,11 @@ let ct = class extends Ne {
2133
2144
  })
2134
2145
  )
2135
2146
  ), this.disposeWithMe(
2136
- Se(
2147
+ ze(
2137
2148
  // eslint-disable-next-line complexity
2138
- t.changeEnd$.subscribe((o) => {
2139
- const { objects: s, offsetX: c, offsetY: d } = o;
2140
- for (const a of s.values()) {
2149
+ t.changeEnd$.subscribe((s) => {
2150
+ const { objects: o, offsetX: c, offsetY: d } = s;
2151
+ for (const a of o.values()) {
2141
2152
  const g = this._drawingManagerService.getDrawingOKey(a.oKey);
2142
2153
  if (g == null)
2143
2154
  continue;
@@ -2148,10 +2159,10 @@ let ct = class extends Ne {
2148
2159
  } catch {
2149
2160
  }
2150
2161
  }
2151
- if (this._anchorShape && this._anchorShape.hide(), s.size > 1)
2152
- this._updateMultipleDrawingDocTransform(s);
2153
- else if (s.size === 1) {
2154
- const a = this._transformerCache.values().next().value, g = s.values().next().value, { width: u, height: l, top: f, left: h, angle: m } = g;
2162
+ if (this._anchorShape && this._anchorShape.hide(), o.size > 1)
2163
+ this._updateMultipleDrawingDocTransform(o);
2164
+ else if (o.size === 1) {
2165
+ const a = this._transformerCache.values().next().value, g = o.values().next().value, { width: u, height: l, top: f, left: h, angle: m } = g;
2155
2166
  if (a && u === a.width && l === a.height && f === a.top && h === a.left && m === a.angle)
2156
2167
  return;
2157
2168
  a && a.drawing.layoutType === k.INLINE ? u !== a.width || l !== a.height || m !== a.angle ? this._updateDrawingSize(a, g) : c != null && d != null && this._moveInlineDrawing(a.drawing, c, d) : a && this._nonInlineDrawingTransform(a.drawing, g);
@@ -2166,14 +2177,14 @@ let ct = class extends Ne {
2166
2177
  if (e.size < 1)
2167
2178
  return;
2168
2179
  const t = [];
2169
- let n, r;
2170
- for (const o of e.values()) {
2171
- const { oKey: s, left: c, top: d, angle: a } = o;
2172
- let { width: g, height: u } = o;
2173
- const l = this._drawingManagerService.getDrawingOKey(s);
2180
+ let n, i;
2181
+ for (const s of e.values()) {
2182
+ const { oKey: o, left: c, top: d, angle: a } = s;
2183
+ let { width: g, height: u } = s;
2184
+ const l = this._drawingManagerService.getDrawingOKey(o);
2174
2185
  if (l == null)
2175
2186
  continue;
2176
- n == null && (n = l.unitId), r == null && (r = l.subUnitId);
2187
+ n == null && (n = l.unitId), i == null && (i = l.subUnitId);
2177
2188
  const f = this._transformerCache.get(l.drawingId);
2178
2189
  if (f == null)
2179
2190
  continue;
@@ -2190,13 +2201,13 @@ let ct = class extends Ne {
2190
2201
  key: "angle",
2191
2202
  value: a
2192
2203
  }), m !== d || p !== c) {
2193
- const M = d - m, A = c - p;
2194
- M !== 0 && t.push({
2204
+ const y = d - m, A = c - p;
2205
+ y !== 0 && t.push({
2195
2206
  drawingId: l.drawingId,
2196
2207
  key: "positionV",
2197
2208
  value: {
2198
2209
  relativeFrom: h.docTransform.positionV.relativeFrom,
2199
- posOffset: h.docTransform.positionV.posOffset + M
2210
+ posOffset: h.docTransform.positionV.posOffset + y
2200
2211
  }
2201
2212
  }), A !== 0 && t.push({
2202
2213
  drawingId: l.drawingId,
@@ -2208,9 +2219,9 @@ let ct = class extends Ne {
2208
2219
  });
2209
2220
  }
2210
2221
  }
2211
- t.length > 0 && n && r && this._commandService.executeCommand(qe.id, {
2222
+ t.length > 0 && n && i && this._commandService.executeCommand(qe.id, {
2212
2223
  unitId: n,
2213
- subUnitId: r,
2224
+ subUnitId: i,
2214
2225
  drawings: t
2215
2226
  });
2216
2227
  }
@@ -2222,18 +2233,18 @@ let ct = class extends Ne {
2222
2233
  this._getDrawingAnchor(t.drawing, n);
2223
2234
  }
2224
2235
  _updateInlineDrawingAnchor(e, t, n) {
2225
- var o;
2236
+ var s;
2226
2237
  if (this._transformerCache.size !== 1)
2227
2238
  return;
2228
- const { contentBoxPointGroup: r } = (o = this._getInlineDrawingAnchor(e, t, n)) != null ? o : {};
2229
- r != null && this._createOrUpdateInlineAnchor(e.unitId, r);
2239
+ const { contentBoxPointGroup: i } = (s = this._getInlineDrawingAnchor(e, t, n)) != null ? s : {};
2240
+ i != null && this._createOrUpdateInlineAnchor(e.unitId, i);
2230
2241
  }
2231
2242
  _getInlineDrawingAnchor(e, t, n) {
2232
2243
  var x, H;
2233
- const r = this._renderManagerService.getRenderById(e.unitId), o = r == null ? void 0 : r.with(te).getSkeleton();
2234
- if (r == null)
2244
+ const i = this._renderManagerService.getRenderById(e.unitId), s = i == null ? void 0 : i.with(te).getSkeleton();
2245
+ if (i == null)
2235
2246
  return;
2236
- const { mainComponent: s, scene: c } = r, d = s, a = c.getViewports()[0], {
2247
+ const { mainComponent: o, scene: c } = i, d = o, a = c.getViewports()[0], {
2237
2248
  pageLayoutType: g = Nt.VERTICAL,
2238
2249
  pageMarginLeft: u,
2239
2250
  pageMarginTop: l
@@ -2245,7 +2256,7 @@ let ct = class extends Ne {
2245
2256
  const S = (x = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : x.with(Me);
2246
2257
  if (S == null)
2247
2258
  return;
2248
- const O = o == null ? void 0 : o.findNodeByCoord(D, g, u, l, {
2259
+ const O = s == null ? void 0 : s.findNodeByCoord(D, g, u, l, {
2249
2260
  strict: !1,
2250
2261
  segmentId: S.getSegment(),
2251
2262
  segmentPage: S.getSegmentPage()
@@ -2256,32 +2267,32 @@ let ct = class extends Ne {
2256
2267
  }
2257
2268
  if (f == null)
2258
2269
  return;
2259
- const C = o == null ? void 0 : o.findPositionByGlyph(f, m), M = this._getDocObject();
2260
- if (C == null || o == null || M == null || qt(C))
2270
+ const C = s == null ? void 0 : s.findPositionByGlyph(f, m), y = this._getDocObject();
2271
+ if (C == null || s == null || y == null || qt(C))
2261
2272
  return;
2262
2273
  const A = {
2263
2274
  ...C,
2264
2275
  isBack: h
2265
- }, L = M.document.getOffsetConfig(), R = new At(L, o), { cursorList: v, contentBoxPointGroup: N } = R.getRangePointData(A, A), { startOffset: G } = (H = Pt(v)) != null ? H : {};
2276
+ }, L = y.document.getOffsetConfig(), R = new At(L, s), { cursorList: v, contentBoxPointGroup: N } = R.getRangePointData(A, A), { startOffset: G } = (H = Pt(v)) != null ? H : {};
2266
2277
  if (G != null)
2267
2278
  return { offset: G, contentBoxPointGroup: N, segmentId: p, segmentPage: m };
2268
2279
  }
2269
2280
  // eslint-disable-next-line max-lines-per-function, complexity
2270
2281
  _getDrawingAnchor(e, t) {
2271
- var Ie, _e, ce, De, Oe, Ce, Ee, Te, de, ge, Re;
2272
- const n = this._renderManagerService.getRenderById(e.unitId), r = n == null ? void 0 : n.with(te).getSkeleton(), o = r == null ? void 0 : r.getSkeletonData();
2273
- if (o == null || n == null)
2282
+ var Ie, _e, ce, Se, De, be, Ce, Oe, de, ge, Ee;
2283
+ const n = this._renderManagerService.getRenderById(e.unitId), i = n == null ? void 0 : n.with(te).getSkeleton(), s = i == null ? void 0 : i.getSkeletonData();
2284
+ if (s == null || n == null)
2274
2285
  return;
2275
- const { pages: s, skeHeaders: c, skeFooters: d } = o, { mainComponent: a, scene: g } = n, u = a, l = g.getViewports()[0], { pageLayoutType: f = Nt.VERTICAL, pageMarginLeft: h, pageMarginTop: m, docsLeft: p, docsTop: w } = u.getOffsetConfig(), { left: D, top: S, angle: O } = t;
2276
- let { width: C, height: M } = t;
2286
+ const { pages: o, skeHeaders: c, skeFooters: d } = s, { mainComponent: a, scene: g } = n, u = a, l = g.getViewports()[0], { pageLayoutType: f = Nt.VERTICAL, pageMarginLeft: h, pageMarginTop: m, docsLeft: p, docsTop: w } = u.getOffsetConfig(), { left: D, top: S, angle: O } = t;
2287
+ let { width: C, height: y } = t;
2277
2288
  const { positionV: A, positionH: L } = e.docTransform, { width: R, height: v } = this._getPageContentSize(e);
2278
- C = Math.min(C, R), M = Math.min(M, v);
2289
+ C = Math.min(C, R), y = Math.min(y, v);
2279
2290
  let N = null, G = "", x = -1;
2280
2291
  const H = !1, I = {
2281
2292
  ...e.docTransform,
2282
2293
  size: {
2283
2294
  width: C,
2284
- height: M
2295
+ height: y
2285
2296
  },
2286
2297
  angle: O
2287
2298
  }, { x: _, y: E } = g.getViewportScrollXY(l), T = this._getTransformCoordForDocumentOffset(u, l, D - _, S - E);
@@ -2290,7 +2301,7 @@ let ct = class extends Ne {
2290
2301
  const U = (Ie = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : Ie.with(Me);
2291
2302
  if (U == null)
2292
2303
  return;
2293
- const B = r == null ? void 0 : r.findNodeByCoord(T, f, h, m, {
2304
+ const B = i == null ? void 0 : i.findNodeByCoord(T, f, h, m, {
2294
2305
  strict: !1,
2295
2306
  segmentId: U.getSegment(),
2296
2307
  segmentPage: U.getSegmentPage()
@@ -2301,20 +2312,20 @@ let ct = class extends Ne {
2301
2312
  }
2302
2313
  if (N == null)
2303
2314
  return;
2304
- const b = (_e = N.parent) == null ? void 0 : _e.parent, P = b == null ? void 0 : b.parent, V = (ce = P == null ? void 0 : P.lines.find((pe) => pe.paragraphIndex === (b == null ? void 0 : b.paragraphIndex) && pe.paragraphStart)) != null ? ce : P == null ? void 0 : P.lines[0], F = (De = P == null ? void 0 : P.parent) == null ? void 0 : De.parent;
2315
+ const b = (_e = N.parent) == null ? void 0 : _e.parent, P = b == null ? void 0 : b.parent, V = (ce = P == null ? void 0 : P.lines.find((pe) => pe.paragraphIndex === (b == null ? void 0 : b.paragraphIndex) && pe.paragraphStart)) != null ? ce : P == null ? void 0 : P.lines[0], F = (Se = P == null ? void 0 : P.parent) == null ? void 0 : Se.parent;
2305
2316
  if (b == null || P == null || V == null || F == null)
2306
2317
  return;
2307
2318
  this._liquid.reset();
2308
2319
  const K = F.type;
2309
- for (const pe of s) {
2310
- const { headerId: ht, footerId: ft, pageHeight: En, pageWidth: bt, marginLeft: Ct, marginBottom: Rn } = pe, An = s.indexOf(pe);
2320
+ for (const pe of o) {
2321
+ const { headerId: ht, footerId: ft, pageHeight: En, pageWidth: bt, marginLeft: Ct, marginBottom: Rn } = pe, An = o.indexOf(pe);
2311
2322
  if (x > -1 && An === x) {
2312
2323
  switch (K) {
2313
2324
  case Ut.HEADER: {
2314
- const He = (Oe = c.get(ht)) == null ? void 0 : Oe.get(bt);
2315
- if (He)
2325
+ const Ge = (De = c.get(ht)) == null ? void 0 : De.get(bt);
2326
+ if (Ge)
2316
2327
  this._liquid.translatePagePadding({
2317
- marginTop: He.marginTop,
2328
+ marginTop: Ge.marginTop,
2318
2329
  marginLeft: Ct
2319
2330
  });
2320
2331
  else
@@ -2322,10 +2333,10 @@ let ct = class extends Ne {
2322
2333
  break;
2323
2334
  }
2324
2335
  case Ut.FOOTER: {
2325
- const He = (Ce = d.get(ft)) == null ? void 0 : Ce.get(bt);
2326
- if (He)
2336
+ const Ge = (be = d.get(ft)) == null ? void 0 : be.get(bt);
2337
+ if (Ge)
2327
2338
  this._liquid.translatePagePadding({
2328
- marginTop: En - Rn + He.marginTop,
2339
+ marginTop: En - Rn + Ge.marginTop,
2329
2340
  marginLeft: Ct
2330
2341
  });
2331
2342
  else
@@ -2339,7 +2350,7 @@ let ct = class extends Ne {
2339
2350
  break;
2340
2351
  this._liquid.restorePagePadding(pe), this._liquid.translatePage(pe, f, h, m);
2341
2352
  }
2342
- switch (A.relativeFrom === W.LINE ? N = b.divides[0].glyphGroup[0] : N = (ge = (de = (Te = (Ee = V.divides) == null ? void 0 : Ee[0]) == null ? void 0 : Te.glyphGroup) == null ? void 0 : de[0]) != null ? ge : N, I.positionH = {
2353
+ switch (A.relativeFrom === W.LINE ? N = b.divides[0].glyphGroup[0] : N = (ge = (de = (Oe = (Ce = V.divides) == null ? void 0 : Ce[0]) == null ? void 0 : Oe.glyphGroup) == null ? void 0 : de[0]) != null ? ge : N, I.positionH = {
2343
2354
  relativeFrom: L.relativeFrom,
2344
2355
  posOffset: D - this._liquid.x - p
2345
2356
  }, L.relativeFrom) {
@@ -2371,30 +2382,30 @@ let ct = class extends Ne {
2371
2382
  }
2372
2383
  if (N == null)
2373
2384
  return;
2374
- const se = r == null ? void 0 : r.findPositionByGlyph(N, x), Le = this._getDocObject();
2375
- if (se == null || r == null || Le == null || qt(se))
2385
+ const oe = i == null ? void 0 : i.findPositionByGlyph(N, x), Ue = this._getDocObject();
2386
+ if (oe == null || i == null || Ue == null || qt(oe))
2376
2387
  return;
2377
- const be = {
2378
- ...se,
2388
+ const ye = {
2389
+ ...oe,
2379
2390
  isBack: H
2380
- }, Ge = Le.document.getOffsetConfig(), ae = new At(Ge, r), { cursorList: ne } = ae.getRangePointData(be, be), { startOffset: re } = (Re = Pt(ne)) != null ? Re : {};
2381
- if (re != null)
2382
- return { offset: re, docTransform: I, segmentId: G, segmentPage: x };
2391
+ }, We = Ue.document.getOffsetConfig(), ae = new At(We, i), { cursorList: ne } = ae.getRangePointData(ye, ye), { startOffset: ie } = (Ee = Pt(ne)) != null ? Ee : {};
2392
+ if (ie != null)
2393
+ return { offset: ie, docTransform: I, segmentId: G, segmentPage: x };
2383
2394
  }
2384
2395
  // Update drawing when use transformer to resize it.
2385
2396
  _updateDrawingSize(e, t) {
2386
- const n = [], { drawing: r, width: o, height: s, angle: c } = e, { unitId: d, subUnitId: a } = r;
2397
+ const n = [], { drawing: i, width: s, height: o, angle: c } = e, { unitId: d, subUnitId: a } = i;
2387
2398
  let { width: g, height: u, angle: l } = t;
2388
- const { width: f, height: h } = this._getPageContentSize(r);
2389
- g = Math.min(f, g), u = Math.min(h, u), (g !== o || u !== s) && n.push({
2390
- drawingId: r.drawingId,
2399
+ const { width: f, height: h } = this._getPageContentSize(i);
2400
+ g = Math.min(f, g), u = Math.min(h, u), (g !== s || u !== o) && n.push({
2401
+ drawingId: i.drawingId,
2391
2402
  key: "size",
2392
2403
  value: {
2393
2404
  width: g,
2394
2405
  height: u
2395
2406
  }
2396
2407
  }), l !== c && n.push({
2397
- drawingId: r.drawingId,
2408
+ drawingId: i.drawingId,
2398
2409
  key: "angle",
2399
2410
  value: l
2400
2411
  }), n.length > 0 && d && a && this._commandService.executeCommand(qe.id, {
@@ -2405,65 +2416,65 @@ let ct = class extends Ne {
2405
2416
  }
2406
2417
  // Update inline drawing when use transformer to move it.
2407
2418
  _moveInlineDrawing(e, t, n) {
2408
- const r = this._getInlineDrawingAnchor(e, t, n), { offset: o, segmentId: s, segmentPage: c } = r != null ? r : {};
2419
+ const i = this._getInlineDrawingAnchor(e, t, n), { offset: s, segmentId: o, segmentPage: c } = i != null ? i : {};
2409
2420
  return this._commandService.executeCommand(_n.id, {
2410
2421
  unitId: e.unitId,
2411
2422
  subUnitId: e.unitId,
2412
2423
  drawing: e,
2413
- offset: o,
2414
- segmentId: s,
2424
+ offset: s,
2425
+ segmentId: o,
2415
2426
  segmentPage: c,
2416
- needRefreshDrawings: o == null
2427
+ needRefreshDrawings: s == null
2417
2428
  });
2418
2429
  }
2419
2430
  // Limit the drawing to the page area, mainly in the vertical direction,
2420
2431
  // and the upper and lower limits cannot exceed the page margin area.
2421
2432
  _limitDrawingInPage(e, t) {
2422
- const n = this._renderManagerService.getRenderById(e.unitId), { left: r, top: o, width: s, height: c, angle: d } = t, a = n == null ? void 0 : n.with(te).getSkeleton(), g = a == null ? void 0 : a.getSkeletonData(), { pages: u } = g != null ? g : {};
2433
+ const n = this._renderManagerService.getRenderById(e.unitId), { left: i, top: s, width: o, height: c, angle: d } = t, a = n == null ? void 0 : n.with(te).getSkeleton(), g = a == null ? void 0 : a.getSkeletonData(), { pages: u } = g != null ? g : {};
2423
2434
  if (g == null || n == null || u == null)
2424
2435
  return {
2425
- left: r,
2426
- top: o,
2427
- width: s,
2436
+ left: i,
2437
+ top: s,
2438
+ width: o,
2428
2439
  height: c,
2429
2440
  angle: d
2430
2441
  };
2431
2442
  const { mainComponent: l } = n, f = l, { top: h, pageLayoutType: m, pageMarginLeft: p, pageMarginTop: w } = f;
2432
- let D = o;
2443
+ let D = s;
2433
2444
  this._liquid.reset();
2434
2445
  for (const S of u) {
2435
- const { marginBottom: O, pageHeight: C } = S, M = u.indexOf(S), A = u[M + 1];
2446
+ const { marginBottom: O, pageHeight: C } = S, y = u.indexOf(S), A = u[y + 1];
2436
2447
  if (A == null)
2437
2448
  continue;
2438
- if (Pe.hasIntersectionBetweenTwoRanges(
2439
- o,
2440
- o + c,
2449
+ if (Ae.hasIntersectionBetweenTwoRanges(
2450
+ s,
2451
+ s + c,
2441
2452
  this._liquid.y + h + C - O,
2442
2453
  this._liquid.y + h + C + w + A.marginTop
2443
2454
  )) {
2444
- const R = o + c / 2, v = this._liquid.y + h + C + w / 2;
2445
- R < v ? D = Math.min(o, this._liquid.y + h + C - O - c) : D = Math.max(o, this._liquid.y + h + C + w + A.marginTop);
2455
+ const R = s + c / 2, v = this._liquid.y + h + C + w / 2;
2456
+ R < v ? D = Math.min(s, this._liquid.y + h + C - O - c) : D = Math.max(s, this._liquid.y + h + C + w + A.marginTop);
2446
2457
  }
2447
2458
  this._liquid.translatePage(S, m, p, w);
2448
2459
  }
2449
2460
  return {
2450
- left: r,
2461
+ left: i,
2451
2462
  top: D,
2452
- width: s,
2463
+ width: o,
2453
2464
  height: c,
2454
2465
  angle: d
2455
2466
  };
2456
2467
  }
2457
2468
  _nonInlineDrawingTransform(e, t, n = !1) {
2458
- const r = e.isMultiTransform === oe.TRUE ? t : this._limitDrawingInPage(e, t);
2459
- if (n && r.top !== t.top)
2469
+ const i = e.isMultiTransform === se.TRUE ? t : this._limitDrawingInPage(e, t);
2470
+ if (n && i.top !== t.top)
2460
2471
  return;
2461
- const o = this._getDrawingAnchor(e, r), { offset: s, docTransform: c, segmentId: d, segmentPage: a } = o != null ? o : {};
2462
- return s == null || c == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId, t]])) : this._commandService.executeCommand(Sn.id, {
2472
+ const s = this._getDrawingAnchor(e, i), { offset: o, docTransform: c, segmentId: d, segmentPage: a } = s != null ? s : {};
2473
+ return o == null || c == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId, t]])) : this._commandService.executeCommand(Sn.id, {
2463
2474
  unitId: e.unitId,
2464
2475
  subUnitId: e.unitId,
2465
2476
  drawing: e,
2466
- offset: s,
2477
+ offset: o,
2467
2478
  docTransform: c,
2468
2479
  segmentId: d,
2469
2480
  segmentPage: a
@@ -2475,47 +2486,47 @@ let ct = class extends Ne {
2475
2486
  const t = this._renderManagerService.getRenderById(e), n = t == null ? void 0 : t.scene;
2476
2487
  if (n == null)
2477
2488
  return;
2478
- const r = n.getTransformerByCreate();
2479
- return { scene: n, transformer: r };
2489
+ const i = n.getTransformerByCreate();
2490
+ return { scene: n, transformer: i };
2480
2491
  }
2481
- _getTransformCoordForDocumentOffset(e, t, n, r) {
2482
- const { documentTransform: o } = e.getOffsetConfig(), s = t.transformVector2SceneCoord(rr.FromArray([n, r]));
2483
- if (s)
2484
- return o.clone().invert().applyPoint(s);
2492
+ _getTransformCoordForDocumentOffset(e, t, n, i) {
2493
+ const { documentTransform: s } = e.getOffsetConfig(), o = t.transformVector2SceneCoord(ii.FromArray([n, i]));
2494
+ if (o)
2495
+ return s.clone().invert().applyPoint(o);
2485
2496
  }
2486
2497
  _createOrUpdateInlineAnchor(e, t) {
2487
2498
  const n = this._renderManagerService.getRenderById(e);
2488
2499
  if (n == null)
2489
2500
  return;
2490
- const { mainComponent: r, scene: o } = n, s = r, {
2501
+ const { mainComponent: i, scene: s } = n, o = i, {
2491
2502
  docsLeft: c,
2492
2503
  docsTop: d
2493
- } = s.getOffsetConfig(), a = Zn(t), { left: g, top: u, height: l } = a, f = g + c, h = u + d;
2504
+ } = o.getOffsetConfig(), a = Zn(t), { left: g, top: u, height: l } = a, f = g + c, h = u + d;
2494
2505
  if (this._anchorShape) {
2495
2506
  this._anchorShape.transformByState({ left: f, top: h, height: l }), this._anchorShape.show();
2496
2507
  return;
2497
2508
  }
2498
- const m = 6, p = new ir(ui + Qt(m), {
2509
+ const m = 6, p = new ri(ur + Qt(m), {
2499
2510
  left: f,
2500
2511
  top: h,
2501
2512
  height: l,
2502
2513
  strokeWidth: 2,
2503
- stroke: or(Gn.darkGray, 1),
2514
+ stroke: si(Gn.darkGray, 1),
2504
2515
  evented: !1
2505
2516
  });
2506
- this._anchorShape = p, o.addObject(p, Qn);
2517
+ this._anchorShape = p, s.addObject(p, Qn);
2507
2518
  }
2508
2519
  _getDocObject() {
2509
2520
  return Jn(this._univerInstanceService, this._renderManagerService);
2510
2521
  }
2511
2522
  _getPageContentSize(e) {
2512
- const t = this._renderManagerService.getRenderById(e.unitId), n = t == null ? void 0 : t.with(te).getSkeleton(), r = 500, o = 500, s = n == null ? void 0 : n.getSkeletonData();
2513
- if (s == null || t == null)
2523
+ const t = this._renderManagerService.getRenderById(e.unitId), n = t == null ? void 0 : t.with(te).getSkeleton(), i = 500, s = 500, o = n == null ? void 0 : n.getSkeletonData();
2524
+ if (o == null || t == null)
2514
2525
  return {
2515
- width: r,
2516
- height: o
2526
+ width: i,
2527
+ height: s
2517
2528
  };
2518
- const { pages: c } = s;
2529
+ const { pages: c } = o;
2519
2530
  let d = null;
2520
2531
  for (const a of c) {
2521
2532
  const { skeDrawings: g } = a;
@@ -2527,39 +2538,44 @@ let ct = class extends Ne {
2527
2538
  if (d) {
2528
2539
  const { pageWidth: a, pageHeight: g, marginLeft: u, marginBottom: l, marginRight: f, marginTop: h } = d;
2529
2540
  return {
2530
- width: Math.max(r, a - u - f),
2531
- height: Math.max(o, g - h - l)
2541
+ width: Math.max(i, a - u - f),
2542
+ height: Math.max(s, g - h - l)
2532
2543
  };
2533
2544
  } else
2534
2545
  return {
2535
- width: r,
2536
- height: o
2546
+ width: i,
2547
+ height: s
2537
2548
  };
2538
2549
  }
2539
2550
  };
2540
- ct = li([
2551
+ ct = lr([
2541
2552
  tt(0, j),
2542
2553
  tt(1, z),
2543
2554
  tt(2, fe),
2544
2555
  tt(3, Q)
2545
2556
  ], ct);
2546
- var hi = Object.getOwnPropertyDescriptor, fi = (i, e, t, n) => {
2547
- for (var r = n > 1 ? void 0 : n ? hi(e, t) : e, o = i.length - 1, s; o >= 0; o--)
2548
- (s = i[o]) && (r = s(r) || r);
2549
- return r;
2550
- }, $e = (i, e) => (t, n) => e(t, n, i);
2557
+ var hr = Object.getOwnPropertyDescriptor, fr = (r, e, t, n) => {
2558
+ for (var i = n > 1 ? void 0 : n ? hr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
2559
+ (o = r[s]) && (i = o(i) || i);
2560
+ return i;
2561
+ }, Ve = (r, e) => (t, n) => e(t, n, r);
2551
2562
  let dt = class extends Hn {
2552
- constructor(e, t, n, r, o) {
2563
+ constructor(e, t, n, i, s) {
2553
2564
  super();
2554
- ve(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
2555
- this._drawingManagerService = e, this._canvasPopManagerService = t, this._renderManagerService = n, this._univerInstanceService = r, this._contextService = o, this._init();
2565
+ me(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
2566
+ me(this, "_disposePopups", []);
2567
+ this._drawingManagerService = e, this._canvasPopManagerService = t, this._renderManagerService = n, this._univerInstanceService = i, this._contextService = s, this._init();
2556
2568
  }
2557
2569
  _init() {
2558
- this._univerInstanceService.getCurrentTypeOfUnit$(we.UNIVER_DOC).pipe(jt(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(we.UNIVER_DOC).pipe(jt(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(we.UNIVER_DOC).forEach((e) => this._create(e));
2570
+ this.disposeWithMe(
2571
+ this._univerInstanceService.getCurrentTypeOfUnit$(ve.UNIVER_DOC).pipe(jt(this.dispose$)).subscribe((e) => this._create(e))
2572
+ ), this.disposeWithMe(
2573
+ this._univerInstanceService.getTypeOfUnitDisposed$(ve.UNIVER_DOC).pipe(jt(this.dispose$)).subscribe((e) => this._dispose(e))
2574
+ ), this._univerInstanceService.getAllUnitsForType(ve.UNIVER_DOC).forEach((e) => this._create(e));
2559
2575
  }
2560
2576
  _dispose(e) {
2561
2577
  const t = e.getUnitId();
2562
- this._renderManagerService.removeRender(t);
2578
+ this._disposePopups.length && (this._disposePopups.forEach((n) => n.dispose()), this._disposePopups.length = 0), this._renderManagerService.removeRender(t);
2563
2579
  }
2564
2580
  _create(e) {
2565
2581
  if (!e)
@@ -2570,38 +2586,38 @@ let dt = class extends Hn {
2570
2586
  _hasCropObject(e) {
2571
2587
  const t = e.getAllObjects();
2572
2588
  for (const n of t)
2573
- if (n instanceof Rr)
2589
+ if (n instanceof Ri)
2574
2590
  return !0;
2575
2591
  return !1;
2576
2592
  }
2577
2593
  // eslint-disable-next-line max-lines-per-function
2578
2594
  _popupMenuListener(e) {
2579
- var o;
2580
- const t = (o = this._renderManagerService.getRenderById(e)) == null ? void 0 : o.scene;
2595
+ var s;
2596
+ const t = (s = this._renderManagerService.getRenderById(e)) == null ? void 0 : s.scene;
2581
2597
  if (!t)
2582
2598
  return;
2583
2599
  const n = t.getTransformerByCreate();
2584
2600
  if (!n)
2585
2601
  return;
2586
- const r = [];
2602
+ const i = this._disposePopups;
2587
2603
  this.disposeWithMe(
2588
- Se(
2589
- n.createControl$.subscribe(() => {
2604
+ n.createControl$.subscribe(
2605
+ () => {
2590
2606
  if (this._hasCropObject(t))
2591
2607
  return;
2592
- const s = n.getSelectedObjectMap();
2593
- if (r.forEach((w) => w.dispose()), r.length = 0, s.size > 1)
2608
+ const o = n.getSelectedObjectMap();
2609
+ if (i.forEach((w) => w.dispose()), i.length = 0, o.size > 1)
2594
2610
  return;
2595
- const c = s.values().next().value;
2611
+ const c = o.values().next().value;
2596
2612
  if (!c)
2597
2613
  return;
2598
2614
  const d = c.oKey, a = this._drawingManagerService.getDrawingOKey(d);
2599
- if (!a || a.drawingType === xe.DRAWING_DOM)
2615
+ if (!a || a.drawingType === Pe.DRAWING_DOM)
2600
2616
  return;
2601
2617
  const { unitId: g, subUnitId: u, drawingId: l, drawingType: f } = a, h = this._canvasPopManagerService.attachPopupToObject(
2602
2618
  c,
2603
2619
  {
2604
- componentKey: Ar,
2620
+ componentKey: Ai,
2605
2621
  direction: "horizontal",
2606
2622
  offset: [2, 0],
2607
2623
  extraProps: {
@@ -2610,34 +2626,32 @@ let dt = class extends Hn {
2610
2626
  },
2611
2627
  g
2612
2628
  );
2613
- r.push(this.disposeWithMe(h)), !this._drawingManagerService.getFocusDrawings().find((w) => w.unitId === g && w.subUnitId === u && w.drawingId === l) && this._drawingManagerService.focusDrawing([{
2629
+ i.push(this.disposeWithMe(h)), !this._drawingManagerService.getFocusDrawings().find((w) => w.unitId === g && w.subUnitId === u && w.drawingId === l) && this._drawingManagerService.focusDrawing([{
2614
2630
  unitId: g,
2615
2631
  subUnitId: u,
2616
2632
  drawingId: l
2617
2633
  }]);
2618
- })
2634
+ }
2619
2635
  )
2620
2636
  ), this.disposeWithMe(
2621
- Se(
2622
- n.clearControl$.subscribe(() => {
2623
- r.forEach((s) => s.dispose()), r.length = 0, this._contextService.setContextValue(nt, !1), this._drawingManagerService.focusDrawing(null);
2624
- })
2637
+ n.clearControl$.subscribe(
2638
+ () => {
2639
+ i.forEach((o) => o.dispose()), i.length = 0, this._contextService.setContextValue(nt, !1), this._drawingManagerService.focusDrawing(null);
2640
+ }
2625
2641
  )
2626
2642
  ), this.disposeWithMe(
2627
- Se(
2628
- n.changing$.subscribe(() => {
2629
- r.forEach((s) => s.dispose()), r.length = 0;
2630
- })
2643
+ n.changing$.subscribe(
2644
+ () => {
2645
+ i.forEach((o) => o.dispose()), i.length = 0;
2646
+ }
2631
2647
  )
2632
2648
  ), this.disposeWithMe(
2633
- Se(
2634
- n.changeStart$.subscribe(() => {
2635
- r.forEach((s) => s.dispose()), r.length = 0;
2636
- })
2637
- )
2649
+ n.changeStart$.subscribe(() => {
2650
+ i.forEach((o) => o.dispose()), i.length = 0;
2651
+ })
2638
2652
  );
2639
2653
  }
2640
- _getImageMenuItems(e, t, n, r) {
2654
+ _getImageMenuItems(e, t, n, i) {
2641
2655
  return [
2642
2656
  {
2643
2657
  label: "image-popup.edit",
@@ -2650,14 +2664,14 @@ let dt = class extends Hn {
2650
2664
  {
2651
2665
  label: "image-popup.delete",
2652
2666
  index: 1,
2653
- commandId: yt.id,
2667
+ commandId: Mt.id,
2654
2668
  commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: t, drawingId: n }] },
2655
2669
  disable: !1
2656
2670
  },
2657
2671
  {
2658
2672
  label: "image-popup.crop",
2659
2673
  index: 2,
2660
- commandId: Pr.id,
2674
+ commandId: Pi.id,
2661
2675
  commandParams: { unitId: e, subUnitId: t, drawingId: n },
2662
2676
  disable: !0
2663
2677
  // TODO: @JOCS, feature is not ready.
@@ -2665,7 +2679,7 @@ let dt = class extends Hn {
2665
2679
  {
2666
2680
  label: "image-popup.reset",
2667
2681
  index: 3,
2668
- commandId: xr.id,
2682
+ commandId: xi.id,
2669
2683
  commandParams: [{ unitId: e, subUnitId: t, drawingId: n }],
2670
2684
  disable: !0
2671
2685
  // TODO: @JOCS, feature is not ready.
@@ -2673,47 +2687,51 @@ let dt = class extends Hn {
2673
2687
  ];
2674
2688
  }
2675
2689
  };
2676
- dt = fi([
2677
- $e(0, fe),
2678
- $e(1, Z(er)),
2679
- $e(2, Q),
2680
- $e(3, z),
2681
- $e(4, Yt)
2690
+ dt = fr([
2691
+ Ve(0, fe),
2692
+ Ve(1, Z(ei)),
2693
+ Ve(2, Q),
2694
+ Ve(3, z),
2695
+ Ve(4, Yt)
2682
2696
  ], dt);
2683
- var pi = Object.getOwnPropertyDescriptor, mi = (i, e, t, n) => {
2684
- for (var r = n > 1 ? void 0 : n ? pi(e, t) : e, o = i.length - 1, s; o >= 0; o--)
2685
- (s = i[o]) && (r = s(r) || r);
2686
- return r;
2687
- }, Ae = (i, e) => (t, n) => e(t, n, i);
2688
- let It = class extends Ne {
2689
- constructor(e, t, n, r, o, s, c, d) {
2697
+ var pr = Object.getOwnPropertyDescriptor, mr = (r, e, t, n) => {
2698
+ for (var i = n > 1 ? void 0 : n ? pr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
2699
+ (o = r[s]) && (i = o(i) || i);
2700
+ return i;
2701
+ }, Re = (r, e) => (t, n) => e(t, n, r);
2702
+ let It = class extends xe {
2703
+ constructor(e, t, n, i, s, o, c, d) {
2690
2704
  super();
2691
- ve(this, "_liquid", new rn());
2692
- this._context = e, this._docSkeletonManagerService = t, this._commandService = n, this._editorService = r, this._drawingManagerService = o, this._docRefreshDrawingsService = s, this._univerInstanceService = c, this._lifecycleService = d, this._initialize(), this._commandExecutedListener();
2705
+ me(this, "_liquid", new rn());
2706
+ this._context = e, this._docSkeletonManagerService = t, this._commandService = n, this._editorService = i, this._drawingManagerService = s, this._docRefreshDrawingsService = o, this._univerInstanceService = c, this._lifecycleService = d, this._initialize(), this._commandExecutedListener();
2693
2707
  }
2694
2708
  _initialize() {
2695
2709
  this._initialRenderRefresh(), this._drawingInitializeListener(), this._initResize();
2696
2710
  }
2697
2711
  _initialRenderRefresh() {
2698
- this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
2699
- e != null && this._refreshDrawing(e);
2700
- }), this._docRefreshDrawingsService.refreshDrawings$.subscribe((e) => {
2701
- e != null && this._refreshDrawing(e);
2702
- });
2712
+ this.disposeWithMe(
2713
+ this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
2714
+ e != null && this._refreshDrawing(e);
2715
+ })
2716
+ ), this.disposeWithMe(
2717
+ this._docRefreshDrawingsService.refreshDrawings$.subscribe((e) => {
2718
+ e != null && this._refreshDrawing(e);
2719
+ })
2720
+ );
2703
2721
  }
2704
2722
  _commandExecutedListener() {
2705
2723
  const e = [ee.id, nn.id];
2706
2724
  this.disposeWithMe(
2707
2725
  this._commandService.onCommandExecuted((t) => {
2708
2726
  if (e.includes(t.id)) {
2709
- const n = t.params, { unitId: r } = n, { unitId: o, mainComponent: s } = this._context;
2710
- if (r !== o)
2727
+ const n = t.params, { unitId: i } = n, { unitId: s, mainComponent: o } = this._context;
2728
+ if (i !== s)
2711
2729
  return;
2712
2730
  const c = this._docSkeletonManagerService.getSkeleton();
2713
2731
  if (c == null)
2714
2732
  return;
2715
- if (this._editorService.isEditor(o) && o !== St) {
2716
- s == null || s.makeDirty();
2733
+ if (this._editorService.isEditor(s) && s !== St) {
2734
+ o == null || o.makeDirty();
2717
2735
  return;
2718
2736
  }
2719
2737
  this._refreshDrawing(c);
@@ -2724,7 +2742,7 @@ let It = class extends Ne {
2724
2742
  _initResize() {
2725
2743
  this.disposeWithMe(
2726
2744
  Zt(this._context.engine.onTransformChange$).pipe(
2727
- Vt((e) => e.type === sr.resize),
2745
+ Vt((e) => e.type === oi.resize),
2728
2746
  dn(16)
2729
2747
  ).subscribe(() => {
2730
2748
  var n;
@@ -2735,69 +2753,69 @@ let It = class extends Ne {
2735
2753
  }
2736
2754
  _refreshDrawing(e) {
2737
2755
  var D, S;
2738
- const t = e == null ? void 0 : e.getSkeletonData(), { mainComponent: n, unitId: r } = this._context, o = n;
2756
+ const t = e == null ? void 0 : e.getSkeletonData(), { mainComponent: n, unitId: i } = this._context, s = n;
2739
2757
  if (!t)
2740
2758
  return;
2741
- const { left: s, top: c, pageLayoutType: d, pageMarginLeft: a, pageMarginTop: g } = o, { pages: u, skeHeaders: l, skeFooters: f } = t, h = {};
2759
+ const { left: o, top: c, pageLayoutType: d, pageMarginLeft: a, pageMarginTop: g } = s, { pages: u, skeHeaders: l, skeFooters: f } = t, h = {};
2742
2760
  this._liquid.reset();
2743
2761
  for (let O = 0, C = u.length; O < C; O++) {
2744
- const M = u[O], { headerId: A, footerId: L, pageWidth: R } = M;
2762
+ const y = u[O], { headerId: A, footerId: L, pageWidth: R } = y;
2745
2763
  if (A) {
2746
2764
  const v = (D = l.get(A)) == null ? void 0 : D.get(R);
2747
2765
  v && this._calculateDrawingPosition(
2748
- r,
2766
+ i,
2749
2767
  v,
2750
- s,
2768
+ o,
2751
2769
  c,
2752
2770
  h,
2753
2771
  v.marginTop,
2754
- M.marginLeft
2772
+ y.marginLeft
2755
2773
  );
2756
2774
  }
2757
2775
  if (L) {
2758
2776
  const v = (S = f.get(L)) == null ? void 0 : S.get(R);
2759
2777
  v && this._calculateDrawingPosition(
2760
- r,
2778
+ i,
2761
2779
  v,
2762
- s,
2780
+ o,
2763
2781
  c,
2764
2782
  h,
2765
- M.pageHeight - M.marginBottom + v.marginTop,
2766
- M.marginLeft
2783
+ y.pageHeight - y.marginBottom + v.marginTop,
2784
+ y.marginLeft
2767
2785
  );
2768
2786
  }
2769
- this._calculateDrawingPosition(r, M, s, c, h, M.marginTop, M.marginLeft), this._liquid.translatePage(M, d, a, g);
2787
+ this._calculateDrawingPosition(i, y, o, c, h, y.marginTop, y.marginLeft), this._liquid.translatePage(y, d, a, g);
2770
2788
  }
2771
2789
  const m = Object.values(h), p = m.filter((O) => !O.isMultiTransform), w = m.filter((O) => O.isMultiTransform);
2772
2790
  p.length > 0 && this._drawingManagerService.refreshTransform(p), this._handleMultiDrawingsTransform(w);
2773
2791
  }
2774
2792
  _handleMultiDrawingsTransform(e) {
2775
- const { scene: t, unitId: n } = this._context, r = t.getTransformerByCreate();
2793
+ const { scene: t, unitId: n } = this._context, i = t.getTransformerByCreate();
2776
2794
  e.forEach((d) => {
2777
2795
  const a = this._drawingManagerService.getDrawingByParam(d);
2778
2796
  a != null && (a.transform = d.transform, a.transforms = d.transforms, a.isMultiTransform = d.isMultiTransform);
2779
2797
  });
2780
- const s = [...r.getSelectedObjectMap().keys()], c = Object.values(this._drawingManagerService.getDrawingData(n, n)).filter((d) => d.isMultiTransform === oe.TRUE);
2798
+ const o = [...i.getSelectedObjectMap().keys()], c = Object.values(this._drawingManagerService.getDrawingData(n, n)).filter((d) => d.isMultiTransform === se.TRUE);
2781
2799
  this._drawingManagerService.removeNotification(c), e.length > 0 && this._drawingManagerService.addNotification(e);
2782
- for (const d of s) {
2800
+ for (const d of o) {
2783
2801
  const a = t.getObject(d);
2784
- a && r.setSelectedControl(a);
2802
+ a && i.setSelectedControl(a);
2785
2803
  }
2786
2804
  }
2787
- _calculateDrawingPosition(e, t, n, r, o, s, c) {
2805
+ _calculateDrawingPosition(e, t, n, i, s, o, c) {
2788
2806
  const { skeDrawings: d } = t;
2789
2807
  this._liquid.translatePagePadding({
2790
- marginTop: s,
2808
+ marginTop: o,
2791
2809
  marginLeft: c
2792
2810
  }), d.forEach((a) => {
2793
- const { aLeft: g, aTop: u, height: l, width: f, angle: h, drawingId: m, drawingOrigin: p } = a, w = p.layoutType === k.WRAP_NONE && p.behindDoc === oe.TRUE, { isMultiTransform: D = oe.FALSE } = p, S = {
2811
+ const { aLeft: g, aTop: u, height: l, width: f, angle: h, drawingId: m, drawingOrigin: p } = a, w = p.layoutType === k.WRAP_NONE && p.behindDoc === se.TRUE, { isMultiTransform: D = se.FALSE } = p, S = {
2794
2812
  left: g + n + this._liquid.x,
2795
- top: u + r + this._liquid.y,
2813
+ top: u + i + this._liquid.y,
2796
2814
  width: f,
2797
2815
  height: l,
2798
2816
  angle: h
2799
2817
  };
2800
- o[m] == null ? o[m] = {
2818
+ s[m] == null ? s[m] = {
2801
2819
  unitId: e,
2802
2820
  subUnitId: e,
2803
2821
  drawingId: m,
@@ -2805,9 +2823,9 @@ let It = class extends Ne {
2805
2823
  transform: S,
2806
2824
  transforms: [S],
2807
2825
  isMultiTransform: D
2808
- } : D === oe.TRUE && o[m].transforms.push(S);
2826
+ } : D === se.TRUE && s[m].transforms.push(S);
2809
2827
  }), this._liquid.restorePagePadding({
2810
- marginTop: s,
2828
+ marginTop: o,
2811
2829
  marginLeft: c
2812
2830
  });
2813
2831
  }
@@ -2816,74 +2834,74 @@ let It = class extends Ne {
2816
2834
  const t = this._docSkeletonManagerService.getSkeleton();
2817
2835
  t != null && (this._refreshDrawing(t), this._drawingManagerService.initializeNotification(this._context.unitId));
2818
2836
  };
2819
- this._lifecycleService.stage >= Rt.Rendered ? this._docSkeletonManagerService.getSkeleton() ? e() : setTimeout(e, 500) : this._lifecycleService.lifecycle$.pipe(Vt((t) => t === Rt.Rendered)).subscribe(e);
2837
+ this._lifecycleService.stage >= Rt.Rendered ? this._docSkeletonManagerService.getSkeleton() ? e() : setTimeout(e, 500) : this.disposeWithMe(this._lifecycleService.lifecycle$.pipe(Vt((t) => t === Rt.Rendered)).subscribe(e));
2820
2838
  }
2821
2839
  };
2822
- It = mi([
2823
- Ae(1, Z(te)),
2824
- Ae(2, j),
2825
- Ae(3, tr),
2826
- Ae(4, fe),
2827
- Ae(5, Z(ut)),
2828
- Ae(6, z),
2829
- Ae(7, Z(jn))
2840
+ It = mr([
2841
+ Re(1, Z(te)),
2842
+ Re(2, j),
2843
+ Re(3, ti),
2844
+ Re(4, fe),
2845
+ Re(5, Z(ut)),
2846
+ Re(6, z),
2847
+ Re(7, Z(jn))
2830
2848
  ], It);
2831
- var wi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, Ii = (i, e, t) => e in i ? wi(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, _i = (i, e, t, n) => {
2832
- for (var r = n > 1 ? void 0 : n ? vi(e, t) : e, o = i.length - 1, s; o >= 0; o--)
2833
- (s = i[o]) && (r = s(r) || r);
2834
- return r;
2835
- }, vt = (i, e) => (t, n) => e(t, n, i), Cn = (i, e, t) => Ii(i, typeof e != "symbol" ? e + "" : e, t);
2836
- const Si = "DOC_DRAWING_UI_PLUGIN";
2849
+ var wr = Object.defineProperty, vr = Object.getOwnPropertyDescriptor, Ir = (r, e, t) => e in r ? wr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, _r = (r, e, t, n) => {
2850
+ for (var i = n > 1 ? void 0 : n ? vr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
2851
+ (o = r[s]) && (i = o(i) || i);
2852
+ return i;
2853
+ }, vt = (r, e) => (t, n) => e(t, n, r), Cn = (r, e, t) => Ir(r, typeof e != "symbol" ? e + "" : e, t);
2854
+ const Sr = "DOC_DRAWING_UI_PLUGIN";
2837
2855
  let gt = class extends zn {
2838
- constructor(i = $t, e, t, n) {
2839
- super(), this._config = i, this._injector = e, this._renderManagerSrv = t, this._configService = n;
2840
- const { ...r } = Xn(
2856
+ constructor(r = $t, e, t, n) {
2857
+ super(), this._config = r, this._injector = e, this._renderManagerSrv = t, this._configService = n;
2858
+ const { ...i } = Xn(
2841
2859
  {},
2842
2860
  $t,
2843
2861
  this._config
2844
2862
  );
2845
- this._configService.setConfig(Hr, r);
2863
+ this._configService.setConfig(Hi, i);
2846
2864
  }
2847
2865
  onStarting() {
2848
2866
  [
2849
- [ot],
2867
+ [st],
2850
2868
  [dt],
2851
2869
  [ct],
2852
- [st],
2870
+ [ot],
2853
2871
  [ut],
2854
- [it],
2872
+ [rt],
2855
2873
  [at]
2856
2874
  ].forEach((e) => this._injector.add(e));
2857
2875
  }
2858
2876
  onReady() {
2859
2877
  [
2860
- [rt],
2878
+ [it],
2861
2879
  [It]
2862
- ].forEach((i) => this._renderManagerSrv.registerRenderModule(we.UNIVER_DOC, i)), this._injector.get(st), this._injector.get(ot), this._injector.get(ct), this._injector.get(at);
2880
+ ].forEach((r) => this._renderManagerSrv.registerRenderModule(ve.UNIVER_DOC, r)), this._injector.get(ot), this._injector.get(st), this._injector.get(ct), this._injector.get(at);
2863
2881
  }
2864
2882
  onRendered() {
2865
- this._injector.get(dt), this._injector.get(it);
2883
+ this._injector.get(dt), this._injector.get(rt);
2866
2884
  }
2867
2885
  };
2868
- Cn(gt, "type", we.UNIVER_DOC);
2869
- Cn(gt, "pluginName", Si);
2870
- gt = _i([
2871
- Vn(Nr, pr, qn, yr),
2886
+ Cn(gt, "type", ve.UNIVER_DOC);
2887
+ Cn(gt, "pluginName", Sr);
2888
+ gt = _r([
2889
+ Vn(Ni, pi, qn, Mi),
2872
2890
  vt(1, Z(Jt)),
2873
2891
  vt(2, Q),
2874
2892
  vt(3, $n)
2875
2893
  ], gt);
2876
2894
  export {
2877
- kr as ClearDocDrawingTransformerOperation,
2878
- Mn as DOCS_IMAGE_MENU_ID,
2895
+ ki as ClearDocDrawingTransformerOperation,
2896
+ yn as DOCS_IMAGE_MENU_ID,
2879
2897
  ln as DeleteDocDrawingsCommand,
2880
- it as DocFloatDomController,
2898
+ rt as DocFloatDomController,
2881
2899
  Tn as EditDocDrawingOperation,
2882
2900
  un as GroupDocDrawingCommand,
2883
- Mt as InsertDocDrawingCommand,
2901
+ yt as InsertDocDrawingCommand,
2884
2902
  pn as InsertDocImageCommand,
2885
2903
  Ke as MoveDocDrawingsCommand,
2886
- yt as RemoveDocDrawingCommand,
2904
+ Mt as RemoveDocDrawingCommand,
2887
2905
  hn as SetDocDrawingArrangeCommand,
2888
2906
  On as SidebarDocDrawingOperation,
2889
2907
  fn as UngroupDocDrawingCommand,