@univerjs/sheets-drawing-ui 0.1.14 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,69 +1,67 @@
1
- var Wt = Object.defineProperty;
2
- var Bt = (r, e, n) => e in r ? Wt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
- var H = (r, e, n) => (Bt(r, typeof e != "symbol" ? e + "" : e, n), n);
4
- import { CommandType as $, ICommandService as B, IUndoRedoService as ie, LocaleService as de, IUniverInstanceService as ue, RxDisposable as Gt, UniverInstanceType as ee, toDisposable as Ae, FOCUSING_COMMON_DRAWINGS as le, OnLifecycle as me, LifecycleStages as he, IContextService as tt, Disposable as ge, Direction as K, FOCUSING_FORMULA_EDITOR as xt, EDITOR_ACTIVATED as $t, Rectangle as Ft, DrawingTypeEnum as Ne, DisposableCollection as Vt, Tools as ne, Plugin as Yt, DependentOn as Xt } from "@univerjs/core";
5
- import { Inject as W, Injector as Ve } from "@wendellhu/redi";
6
- import { ImageCropperObject as Ht, COMPONENT_IMAGE_POPUP_MENU as kt, OpenImageCropOperation as zt, ImageResetSizeOperation as Kt, DrawingCommonPanel as Jt, DrawingRenderService as Zt, UniverDrawingUIPlugin as qt } from "@univerjs/drawing-ui";
7
- import { ISheetDrawingService as Y, SetDrawingApplyMutation as b, DrawingApplyType as P, SheetDrawingAnchorType as O, UniverSheetsDrawingPlugin as Qt } from "@univerjs/sheets-drawing";
8
- import { IDrawingManagerService as k, IImageIoService as nt, ArrangeTypeEnum as we, DrawingTypeEnum as ye, DRAWING_IMAGE_COUNT_LIMIT as ze, ImageUploadStatusType as Le, DRAWING_IMAGE_ALLOW_SIZE as en, getImageSize as tn, DRAWING_IMAGE_WIDTH_LIMIT as Ke, DRAWING_IMAGE_HEIGHT_LIMIT as Je, DRAWING_IMAGE_ALLOW_IMAGE_LIST as nn, getDrawingShapeKeyByDrawingSearch as rn, UniverDrawingPlugin as on } from "@univerjs/drawing";
9
- import { IRenderManagerService as se, getGroupState as sn, transformObjectOutOfGroup as an, precisionTo as J, Rect as cn, DRAWING_OBJECT_LAYER_INDEX as ln } from "@univerjs/engine-render";
10
- import { SheetCanvasPopManagerService as dn, ISelectionRenderService as Te, getCurrentRangeDisable$ as un, SheetSkeletonManagerService as Be, SetScrollOperation as mn, SetZoomRatioOperation as hn, VIEWPORT_KEY as gn, SheetPrintInterceptorService as fn } from "@univerjs/sheets-ui";
11
- import { takeUntil as Ze, Subject as qe, BehaviorSubject as pn } from "rxjs";
12
- import { ISidebarService as wn, BuiltInUIPart as _n, IUIPartsService as vn, IMessageService as Sn, MenuItemType as rt, MenuPosition as Cn, MenuGroup as Rn, getMenuHiddenObservable as ot, KeyCode as oe, ComponentManager as In, IMenuService as Dn, IShortcutService as Mn, CanvasFloatDomService as On } from "@univerjs/ui";
13
- import { useDependency as Z, connectInjector as bn } from "@wendellhu/redi/react-bindings";
14
- import { getSheetCommandTarget as re, SelectionManagerService as Pn, WorkbookEditablePermission as yn, WorksheetEditPermission as Tn, RangeProtectionPermissionEditPoint as En, InsertRowCommand as it, InsertColCommand as st, RemoveRowCommand as at, RemoveColCommand as ct, DeleteRangeMoveLeftCommand as lt, DeleteRangeMoveUpCommand as dt, InsertRangeMoveDownCommand as ut, InsertRangeMoveRightCommand as mt, DeltaRowHeightCommand as Ge, SetRowHeightCommand as xe, DeltaColumnWidthCommand as ht, SetColWidthCommand as gt, SetRowHiddenCommand as ft, SetSpecificRowsVisibleCommand as pt, SetSpecificColsVisibleCommand as wt, SetColHiddenCommand as _t, SetRowVisibleMutation as Un, SetRowHiddenMutation as An, SetColVisibleMutation as Nn, SetColHiddenMutation as Ln, SetWorksheetRowHeightMutation as jn, SetWorksheetColWidthMutation as Wn, SetWorksheetActiveOperation as Bn, SheetInterceptorService as Gn, SetFrozenMutation as xn } from "@univerjs/sheets";
15
- import L, { useEffect as Ye, forwardRef as vt, useRef as St, createElement as Ct, useState as $e } from "react";
16
- import { MessageType as _e, RadioGroup as $n, Radio as je } from "@univerjs/design";
17
- import ve from "clsx";
18
- const N = {
1
+ var Jt = Object.defineProperty;
2
+ var Zt = (r, e, n) => e in r ? Jt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
+ var K = (r, e, n) => Zt(r, typeof e != "symbol" ? e + "" : e, n);
4
+ import { CommandType as G, ICommandService as W, IUndoRedoService as ae, LocaleService as pe, IUniverInstanceService as ce, RxDisposable as qt, UniverInstanceType as Y, toDisposable as Ve, FOCUSING_COMMON_DRAWINGS as fe, OnLifecycle as de, LifecycleStages as le, IContextService as ht, Disposable as ue, Direction as J, FOCUSING_FORMULA_EDITOR as Qt, EDITOR_ACTIVATED as en, Rectangle as tn, DrawingTypeEnum as Ge, DisposableCollection as nn, Tools as ie, UserManagerService as rn, IPermissionService as sn, Plugin as on, DependentOn as an } from "@univerjs/core";
5
+ import { Inject as B, Injector as qe } from "@wendellhu/redi";
6
+ import { ImageCropperObject as cn, COMPONENT_IMAGE_POPUP_MENU as dn, OpenImageCropOperation as ln, ImageResetSizeOperation as un, DrawingCommonPanel as mn, DrawingRenderService as gn, UniverDrawingUIPlugin as hn } from "@univerjs/drawing-ui";
7
+ import { ISheetDrawingService as X, SetDrawingApplyMutation as O, DrawingApplyType as P, SheetDrawingAnchorType as b, UniverSheetsDrawingPlugin as fn } from "@univerjs/sheets-drawing";
8
+ import { IDrawingManagerService as H, IImageIoService as ft, ArrangeTypeEnum as ve, DrawingTypeEnum as Le, DRAWING_IMAGE_COUNT_LIMIT as st, ImageUploadStatusType as xe, DRAWING_IMAGE_ALLOW_SIZE as pn, getImageSize as wn, DRAWING_IMAGE_WIDTH_LIMIT as ot, DRAWING_IMAGE_HEIGHT_LIMIT as at, DRAWING_IMAGE_ALLOW_IMAGE_LIST as _n, getDrawingShapeKeyByDrawingSearch as vn, UniverDrawingPlugin as Sn } from "@univerjs/drawing";
9
+ import { IRenderManagerService as te, getGroupState as Cn, transformObjectOutOfGroup as In, precisionTo as Z, Rect as Rn, DRAWING_OBJECT_LAYER_INDEX as Dn, SHEET_VIEWPORT_KEY as Mn, RENDER_CLASS_TYPE as ne } from "@univerjs/engine-render";
10
+ import { SheetCanvasPopManagerService as bn, ISelectionRenderService as Be, getCurrentRangeDisable$ as On, SheetSkeletonManagerService as He, SetScrollOperation as Pn, SetZoomRatioOperation as En, SheetPrintInterceptorService as yn } from "@univerjs/sheets-ui";
11
+ import { takeUntil as ct, Subject as dt, BehaviorSubject as Tn, combineLatest as Se, map as lt, filter as Ce, distinctUntilChanged as Ie } from "rxjs";
12
+ import { ISidebarService as Un, BuiltInUIPart as An, IUIPartsService as Nn, IMessageService as jn, MenuItemType as pt, MenuPosition as Ln, MenuGroup as Bn, getMenuHiddenObservable as wt, KeyCode as oe, ComponentManager as Wn, IMenuService as $n, IShortcutService as Vn, CanvasFloatDomService as Gn } from "@univerjs/ui";
13
+ import { useDependency as q, connectInjector as xn } from "@wendellhu/redi/react-bindings";
14
+ import { getSheetCommandTarget as se, SelectionManagerService as Fn, WorkbookEditablePermission as ze, WorksheetEditPermission as Oe, RangeProtectionPermissionEditPoint as Yn, InsertRowCommand as _t, InsertColCommand as vt, RemoveRowCommand as St, RemoveColCommand as Ct, DeleteRangeMoveLeftCommand as It, DeleteRangeMoveUpCommand as Rt, InsertRangeMoveDownCommand as Dt, InsertRangeMoveRightCommand as Mt, DeltaRowHeightCommand as Ke, SetRowHeightCommand as ke, DeltaColumnWidthCommand as bt, SetColWidthCommand as Ot, SetRowHiddenCommand as Pt, SetSpecificRowsVisibleCommand as Et, SetSpecificColsVisibleCommand as yt, SetColHiddenCommand as Tt, SetRowVisibleMutation as Xn, SetRowHiddenMutation as Hn, SetColVisibleMutation as zn, SetColHiddenMutation as Kn, SetWorksheetRowHeightMutation as kn, SetWorksheetColWidthMutation as Jn, SetWorksheetActiveOperation as Zn, SheetInterceptorService as qn, SetFrozenMutation as Qn, WorkbookViewPermission as ut, WorksheetViewPermission as Fe } from "@univerjs/sheets";
15
+ import L, { useEffect as Qe, forwardRef as Ut, useRef as At, createElement as Nt, useState as Je } from "react";
16
+ import { MessageType as Re, RadioGroup as er, Radio as Ye } from "@univerjs/design";
17
+ import De from "clsx";
18
+ const j = {
19
19
  id: "sheet.operation.clear-drawing-transformer",
20
- type: $.MUTATION,
20
+ type: G.MUTATION,
21
21
  handler: (r, e) => {
22
- const n = r.get(se);
22
+ const n = r.get(te);
23
23
  return e.forEach((t) => {
24
- var o, i;
25
- (i = (o = n.getRenderById(t)) == null ? void 0 : o.scene.getTransformer()) == null || i.debounceRefreshControls();
24
+ var i, s;
25
+ (s = (i = n.getRenderById(t)) == null ? void 0 : i.scene.getTransformer()) == null || s.debounceRefreshControls();
26
26
  }), !0;
27
27
  }
28
- }, Xe = {
28
+ }, et = {
29
29
  id: "sheet.command.remove-sheet-image",
30
- type: $.COMMAND,
30
+ type: G.COMMAND,
31
31
  handler: (r, e) => {
32
- const n = r.get(B), t = r.get(ie), o = r.get(Y);
33
- if (!e)
34
- return !1;
35
- const { drawings: i } = e, s = [];
36
- i.forEach((f) => {
37
- const { unitId: g } = f;
38
- s.push(g);
32
+ const n = r.get(W), t = r.get(ae), i = r.get(X);
33
+ if (!e) return !1;
34
+ const { drawings: s } = e, o = [];
35
+ s.forEach((f) => {
36
+ const { unitId: h } = f;
37
+ o.push(h);
39
38
  });
40
- const a = o.getBatchRemoveOp(i), { unitId: c, subUnitId: u, undo: d, redo: l, objects: h } = a;
41
- return n.syncExecuteCommand(b.id, { unitId: c, subUnitId: u, op: l, objects: h, type: P.REMOVE }) ? (t.pushUndoRedo({
39
+ const a = i.getBatchRemoveOp(s), { unitId: c, subUnitId: g, undo: l, redo: d, objects: m } = a;
40
+ return n.syncExecuteCommand(O.id, { unitId: c, subUnitId: g, op: d, objects: m, type: P.REMOVE }) ? (t.pushUndoRedo({
42
41
  unitID: c,
43
42
  undoMutations: [
44
- { id: b.id, params: { unitId: c, subUnitId: u, op: d, objects: h, type: P.INSERT } },
45
- { id: N.id, params: s }
43
+ { id: O.id, params: { unitId: c, subUnitId: g, op: l, objects: m, type: P.INSERT } },
44
+ { id: j.id, params: o }
46
45
  ],
47
46
  redoMutations: [
48
- { id: b.id, params: { unitId: c, subUnitId: u, op: l, objects: h, type: P.REMOVE } },
49
- { id: N.id, params: s }
47
+ { id: O.id, params: { unitId: c, subUnitId: g, op: d, objects: m, type: P.REMOVE } },
48
+ { id: j.id, params: o }
50
49
  ]
51
50
  }), !0) : !1;
52
51
  }
53
- }, Rt = "COMPONENT_SHEET_DRAWING_PANEL", It = {
52
+ }, jt = "COMPONENT_SHEET_DRAWING_PANEL", Lt = {
54
53
  id: "sidebar.operation.sheet-image",
55
- type: $.COMMAND,
54
+ type: G.COMMAND,
56
55
  handler: async (r, e) => {
57
- const n = r.get(wn), t = r.get(de), o = r.get(ue), i = r.get(k);
58
- if (!re(o))
59
- return !1;
56
+ const n = r.get(Un), t = r.get(pe), i = r.get(ce), s = r.get(H);
57
+ if (!se(i)) return !1;
60
58
  switch (e.value) {
61
59
  case "open":
62
60
  n.open({
63
61
  header: { title: t.t("sheetImage.panel.title") },
64
- children: { label: Rt },
62
+ children: { label: jt },
65
63
  onClose: () => {
66
- i.focusDrawing(null);
64
+ s.focusDrawing(null);
67
65
  },
68
66
  width: 360
69
67
  });
@@ -75,43 +73,43 @@ const N = {
75
73
  }
76
74
  return !0;
77
75
  }
78
- }, Dt = {
76
+ }, Bt = {
79
77
  id: "sheet.operation.edit-sheet-image",
80
- type: $.OPERATION,
78
+ type: G.OPERATION,
81
79
  handler: (r, e) => {
82
- const n = r.get(k), t = r.get(B);
83
- return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(It.id, { value: "open" }), !0);
84
- }
85
- }, Fn = "univer-upload-loading", Vn = "univer-upload-loading-body", Yn = "univer-upload-loading-body-animation", Xn = "univer-UniverCircleAnimation", Hn = "univer-upload-loading-body-text", Se = {
86
- uploadLoading: Fn,
87
- uploadLoadingBody: Vn,
88
- uploadLoadingBodyAnimation: Yn,
89
- univerCircleAnimation: Xn,
90
- uploadLoadingBodyText: Hn
91
- }, kn = () => {
92
- const r = Z(nt), e = Z(de), [n, t] = L.useState(0);
93
- return Ye(() => {
94
- const o = r.change$.subscribe((i) => {
95
- t(i);
80
+ const n = r.get(H), t = r.get(W);
81
+ return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(Lt.id, { value: "open" }), !0);
82
+ }
83
+ }, tr = "univer-upload-loading", nr = "univer-upload-loading-body", rr = "univer-upload-loading-body-animation", ir = "univer-UniverCircleAnimation", sr = "univer-upload-loading-body-text", Me = {
84
+ uploadLoading: tr,
85
+ uploadLoadingBody: nr,
86
+ uploadLoadingBodyAnimation: rr,
87
+ univerCircleAnimation: ir,
88
+ uploadLoadingBodyText: sr
89
+ }, or = () => {
90
+ const r = q(ft), e = q(pe), [n, t] = L.useState(0);
91
+ return Qe(() => {
92
+ const i = r.change$.subscribe((s) => {
93
+ t(s);
96
94
  });
97
95
  return () => {
98
- o.unsubscribe();
96
+ i.unsubscribe();
99
97
  };
100
- }, [r]), /* @__PURE__ */ L.createElement("div", { style: { display: n > 0 ? "block" : "none" }, className: Se.uploadLoading }, /* @__PURE__ */ L.createElement("div", { className: Se.uploadLoadingBody }, /* @__PURE__ */ L.createElement("div", { className: Se.uploadLoadingBodyAnimation }), /* @__PURE__ */ L.createElement("div", { className: Se.uploadLoadingBodyText }, `${e.t("uploadLoading.loading")}: ${n}`)));
98
+ }, [r]), /* @__PURE__ */ L.createElement("div", { style: { display: n > 0 ? "block" : "none" }, className: Me.uploadLoading }, /* @__PURE__ */ L.createElement("div", { className: Me.uploadLoadingBody }, /* @__PURE__ */ L.createElement("div", { className: Me.uploadLoadingBodyAnimation }), /* @__PURE__ */ L.createElement("div", { className: Me.uploadLoadingBodyText }, `${e.t("uploadLoading.loading")}: ${n}`)));
101
99
  };
102
- var zn = Object.defineProperty, Kn = Object.getOwnPropertyDescriptor, Jn = (r, e, n, t) => {
103
- for (var o = t > 1 ? void 0 : t ? Kn(e, n) : e, i = r.length - 1, s; i >= 0; i--)
104
- (s = r[i]) && (o = (t ? s(e, n, o) : s(o)) || o);
105
- return t && o && zn(e, n, o), o;
106
- }, q = (r, e) => (n, t) => e(n, t, r);
107
- let Re = class extends Gt {
108
- constructor(e, n, t, o, i, s, a) {
100
+ var ar = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, dr = (r, e, n, t) => {
101
+ for (var i = t > 1 ? void 0 : t ? cr(e, n) : e, s = r.length - 1, o; s >= 0; s--)
102
+ (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
103
+ return t && i && ar(e, n, i), i;
104
+ }, Q = (r, e) => (n, t) => e(n, t, r);
105
+ let Pe = class extends qt {
106
+ constructor(e, n, t, i, s, o, a) {
109
107
  super();
110
- H(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
111
- this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = o, this._univerInstanceService = i, this._contextService = s, this._uiPartsService = a, this._init();
108
+ K(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
109
+ this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = i, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = a, this._init();
112
110
  }
113
111
  _init() {
114
- this._univerInstanceService.getCurrentTypeOfUnit$(ee.UNIVER_SHEET).pipe(Ze(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(ee.UNIVER_SHEET).pipe(Ze(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(ee.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(_n.CONTENT, () => bn(kn, this._injector));
112
+ this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET).pipe(ct(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(Y.UNIVER_SHEET).pipe(ct(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(Y.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(An.CONTENT, () => xn(or, this._injector));
115
113
  }
116
114
  _dispose(e) {
117
115
  const n = e.getUnitId();
@@ -126,60 +124,60 @@ let Re = class extends Gt {
126
124
  _hasCropObject(e) {
127
125
  const n = e.getAllObjects();
128
126
  for (const t of n)
129
- if (t instanceof Ht)
127
+ if (t instanceof cn)
130
128
  return !0;
131
129
  return !1;
132
130
  }
133
131
  _popupMenuListener(e) {
134
- var i;
135
- const n = (i = this._renderManagerService.getRenderById(e)) == null ? void 0 : i.scene;
132
+ var s;
133
+ const n = (s = this._renderManagerService.getRenderById(e)) == null ? void 0 : s.scene;
136
134
  if (!n)
137
135
  return;
138
136
  const t = n.getTransformerByCreate();
139
137
  if (!t)
140
138
  return;
141
- const o = [];
139
+ const i = [];
142
140
  this.disposeWithMe(
143
- Ae(
141
+ Ve(
144
142
  t.onCreateControlObservable.add(() => {
145
- if (this._contextService.setContextValue(le, !0), this._hasCropObject(n))
143
+ if (this._contextService.setContextValue(fe, !0), this._hasCropObject(n))
146
144
  return;
147
- const s = t.getSelectedObjectMap();
148
- if (s.size > 1) {
149
- o.forEach((m) => m.dispose());
145
+ const o = t.getSelectedObjectMap();
146
+ if (o.size > 1) {
147
+ i.forEach((u) => u.dispose());
150
148
  return;
151
149
  }
152
- const a = s.values().next().value;
150
+ const a = o.values().next().value;
153
151
  if (!a)
154
152
  return;
155
- const c = a.oKey, u = this._drawingManagerService.getDrawingOKey(c);
156
- if (!u)
153
+ const c = a.oKey, g = this._drawingManagerService.getDrawingOKey(c);
154
+ if (!g)
157
155
  return;
158
- const { unitId: d, subUnitId: l, drawingId: h } = u;
159
- o.push(this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
160
- componentKey: kt,
156
+ const { unitId: l, subUnitId: d, drawingId: m } = g;
157
+ i.push(this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
158
+ componentKey: dn,
161
159
  direction: "horizontal",
162
160
  offset: [2, 0],
163
161
  extraProps: {
164
- menuItems: this._getImageMenuItems(d, l, h)
162
+ menuItems: this._getImageMenuItems(l, d, m)
165
163
  }
166
164
  }))), this._drawingManagerService.focusDrawing([{
167
- unitId: d,
168
- subUnitId: l,
169
- drawingId: h
165
+ unitId: l,
166
+ subUnitId: d,
167
+ drawingId: m
170
168
  }]);
171
169
  })
172
170
  )
173
171
  ), this.disposeWithMe(
174
- Ae(
172
+ Ve(
175
173
  t.onClearControlObservable.add(() => {
176
- o.forEach((s) => s.dispose()), this._contextService.setContextValue(le, !1), this._drawingManagerService.focusDrawing(null);
174
+ i.forEach((o) => o.dispose()), this._contextService.setContextValue(fe, !1), this._drawingManagerService.focusDrawing(null);
177
175
  })
178
176
  )
179
177
  ), this.disposeWithMe(
180
- Ae(
178
+ Ve(
181
179
  t.onChangingObservable.add(() => {
182
- o.forEach((s) => s.dispose());
180
+ i.forEach((o) => o.dispose());
183
181
  })
184
182
  )
185
183
  );
@@ -189,285 +187,280 @@ let Re = class extends Gt {
189
187
  {
190
188
  label: "image-popup.edit",
191
189
  index: 0,
192
- commandId: Dt.id,
190
+ commandId: Bt.id,
193
191
  commandParams: { unitId: e, subUnitId: n, drawingId: t },
194
192
  disable: !1
195
193
  },
196
194
  {
197
195
  label: "image-popup.delete",
198
196
  index: 1,
199
- commandId: Xe.id,
197
+ commandId: et.id,
200
198
  commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: n, drawingId: t }] },
201
199
  disable: !1
202
200
  },
203
201
  {
204
202
  label: "image-popup.crop",
205
203
  index: 2,
206
- commandId: zt.id,
204
+ commandId: ln.id,
207
205
  commandParams: { unitId: e, subUnitId: n, drawingId: t },
208
206
  disable: !1
209
207
  },
210
208
  {
211
209
  label: "image-popup.reset",
212
210
  index: 3,
213
- commandId: Kt.id,
211
+ commandId: un.id,
214
212
  commandParams: [{ unitId: e, subUnitId: n, drawingId: t }],
215
213
  disable: !1
216
214
  }
217
215
  ];
218
216
  }
219
217
  };
220
- Re = Jn([
221
- me(he.Steady, Re),
222
- q(0, W(Ve)),
223
- q(1, k),
224
- q(2, W(dn)),
225
- q(3, se),
226
- q(4, ue),
227
- q(5, tt),
228
- q(6, W(vn))
229
- ], Re);
230
- const Ee = {
218
+ Pe = dr([
219
+ de(le.Steady, Pe),
220
+ Q(0, B(qe)),
221
+ Q(1, H),
222
+ Q(2, B(bn)),
223
+ Q(3, te),
224
+ Q(4, ce),
225
+ Q(5, ht),
226
+ Q(6, B(Nn))
227
+ ], Pe);
228
+ const We = {
231
229
  id: "sheet.operation.insert-float-image",
232
- type: $.OPERATION,
230
+ type: G.OPERATION,
233
231
  handler: (r, e) => !0
234
- }, Oe = {
232
+ }, Ae = {
235
233
  id: "sheet.operation.insert-cell-image",
236
- type: $.OPERATION,
234
+ type: G.OPERATION,
237
235
  handler: (r, e) => !0
238
- }, He = {
236
+ }, tt = {
239
237
  id: "sheet.command.insert-sheet-image",
240
- type: $.COMMAND,
238
+ type: G.COMMAND,
241
239
  handler: (r, e) => {
242
- const n = r.get(B), t = r.get(ie), o = r.get(Y);
243
- if (!e)
244
- return !1;
245
- const i = e.drawings, s = i.map((f) => f.unitId), a = o.getBatchAddOp(i), { unitId: c, subUnitId: u, undo: d, redo: l, objects: h } = a;
246
- return n.syncExecuteCommand(b.id, { op: l, unitId: c, subUnitId: u, objects: h, type: P.INSERT }) ? (t.pushUndoRedo({
240
+ const n = r.get(W), t = r.get(ae), i = r.get(X);
241
+ if (!e) return !1;
242
+ const s = e.drawings, o = s.map((f) => f.unitId), a = i.getBatchAddOp(s), { unitId: c, subUnitId: g, undo: l, redo: d, objects: m } = a;
243
+ return n.syncExecuteCommand(O.id, { op: d, unitId: c, subUnitId: g, objects: m, type: P.INSERT }) ? (t.pushUndoRedo({
247
244
  unitID: c,
248
245
  undoMutations: [
249
- { id: b.id, params: { op: d, unitId: c, subUnitId: u, objects: h, type: P.REMOVE } },
250
- { id: N.id, params: s }
246
+ { id: O.id, params: { op: l, unitId: c, subUnitId: g, objects: m, type: P.REMOVE } },
247
+ { id: j.id, params: o }
251
248
  ],
252
249
  redoMutations: [
253
- { id: b.id, params: { op: l, unitId: c, subUnitId: u, objects: h, type: P.INSERT } },
254
- { id: N.id, params: s }
250
+ { id: O.id, params: { op: d, unitId: c, subUnitId: g, objects: m, type: P.INSERT } },
251
+ { id: j.id, params: o }
255
252
  ]
256
253
  }), !0) : !1;
257
254
  }
258
- }, Ue = {
255
+ }, $e = {
259
256
  id: "sheet.command.set-sheet-image",
260
- type: $.COMMAND,
257
+ type: G.COMMAND,
261
258
  handler: (r, e) => {
262
- const n = r.get(B), t = r.get(ie), o = r.get(Y);
263
- if (!e)
264
- return !1;
265
- const { drawings: i } = e, s = o.getBatchUpdateOp(i), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = s;
266
- return n.syncExecuteCommand(b.id, { unitId: a, subUnitId: c, op: d, objects: l, type: P.UPDATE }) ? (t.pushUndoRedo({
259
+ const n = r.get(W), t = r.get(ae), i = r.get(X);
260
+ if (!e) return !1;
261
+ const { drawings: s } = e, o = i.getBatchUpdateOp(s), { unitId: a, subUnitId: c, undo: g, redo: l, objects: d } = o;
262
+ return n.syncExecuteCommand(O.id, { unitId: a, subUnitId: c, op: l, objects: d, type: P.UPDATE }) ? (t.pushUndoRedo({
267
263
  unitID: a,
268
264
  undoMutations: [
269
- { id: b.id, params: { unitId: a, subUnitId: c, op: u, objects: l, type: P.UPDATE } },
270
- { id: N.id, params: [a] }
265
+ { id: O.id, params: { unitId: a, subUnitId: c, op: g, objects: d, type: P.UPDATE } },
266
+ { id: j.id, params: [a] }
271
267
  ],
272
268
  redoMutations: [
273
- { id: b.id, params: { unitId: a, subUnitId: c, op: d, objects: l, type: P.UPDATE } },
274
- { id: N.id, params: [a] }
269
+ { id: O.id, params: { unitId: a, subUnitId: c, op: l, objects: d, type: P.UPDATE } },
270
+ { id: j.id, params: [a] }
275
271
  ]
276
272
  }), !0) : !1;
277
273
  }
278
- }, Mt = {
274
+ }, Wt = {
279
275
  id: "sheet.command.set-drawing-arrange",
280
- type: $.COMMAND,
276
+ type: G.COMMAND,
281
277
  handler: (r, e) => {
282
- const n = r.get(B), t = r.get(ie);
283
- if (!e)
284
- return !1;
285
- const o = r.get(Y), { unitId: i, subUnitId: s, drawingIds: a, arrangeType: c } = e, u = { unitId: i, subUnitId: s, drawingIds: a };
286
- let d;
287
- if (c === we.forward ? d = o.getForwardDrawingsOp(u) : c === we.backward ? d = o.getBackwardDrawingOp(u) : c === we.front ? d = o.getFrontDrawingsOp(u) : c === we.back && (d = o.getBackDrawingsOp(u)), d == null)
278
+ const n = r.get(W), t = r.get(ae);
279
+ if (!e) return !1;
280
+ const i = r.get(X), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: c } = e, g = { unitId: s, subUnitId: o, drawingIds: a };
281
+ let l;
282
+ if (c === ve.forward ? l = i.getForwardDrawingsOp(g) : c === ve.backward ? l = i.getBackwardDrawingOp(g) : c === ve.front ? l = i.getFrontDrawingsOp(g) : c === ve.back && (l = i.getBackDrawingsOp(g)), l == null)
288
283
  return !1;
289
- const { objects: l, redo: h, undo: m } = d;
290
- return n.syncExecuteCommand(b.id, { op: h, unitId: i, subUnitId: s, objects: l, type: P.ARRANGE }) ? (t.pushUndoRedo({
291
- unitID: i,
284
+ const { objects: d, redo: m, undo: u } = l;
285
+ return n.syncExecuteCommand(O.id, { op: m, unitId: s, subUnitId: o, objects: d, type: P.ARRANGE }) ? (t.pushUndoRedo({
286
+ unitID: s,
292
287
  undoMutations: [
293
- { id: b.id, params: { op: m, unitId: i, subUnitId: s, objects: l, type: P.ARRANGE } }
288
+ { id: O.id, params: { op: u, unitId: s, subUnitId: o, objects: d, type: P.ARRANGE } }
294
289
  ],
295
290
  redoMutations: [
296
- { id: b.id, params: { op: h, unitId: i, subUnitId: s, objects: l, type: P.ARRANGE } }
291
+ { id: O.id, params: { op: m, unitId: s, subUnitId: o, objects: d, type: P.ARRANGE } }
297
292
  ]
298
293
  }), !0) : !1;
299
294
  }
300
295
  };
301
- function Zn(r) {
296
+ function lr(r) {
302
297
  const e = [];
303
298
  return r.forEach((n) => {
304
- const { parent: t, children: o } = n, { unitId: i, subUnitId: s, drawingId: a } = t, c = sn(0, 0, o.map((l) => l.transform || {})), u = o.map((l) => {
305
- const h = l.transform || { left: 0, top: 0 }, { unitId: m, subUnitId: f, drawingId: g } = l;
299
+ const { parent: t, children: i } = n, { unitId: s, subUnitId: o, drawingId: a } = t, c = Cn(0, 0, i.map((d) => d.transform || {})), g = i.map((d) => {
300
+ const m = d.transform || { left: 0, top: 0 }, { unitId: u, subUnitId: f, drawingId: h } = d;
306
301
  return {
307
- unitId: m,
302
+ unitId: u,
308
303
  subUnitId: f,
309
- drawingId: g,
304
+ drawingId: h,
310
305
  transform: {
311
- ...h,
312
- left: h.left - c.left,
313
- top: h.top - c.top
306
+ ...m,
307
+ left: m.left - c.left,
308
+ top: m.top - c.top
314
309
  },
315
310
  groupId: a
316
311
  };
317
- }), d = {
318
- unitId: i,
319
- subUnitId: s,
312
+ }), l = {
313
+ unitId: s,
314
+ subUnitId: o,
320
315
  drawingId: a,
321
- drawingType: ye.DRAWING_GROUP,
316
+ drawingType: Le.DRAWING_GROUP,
322
317
  transform: c
323
318
  };
324
319
  e.push({
325
- parent: d,
326
- children: u
320
+ parent: l,
321
+ children: g
327
322
  });
328
323
  }), e;
329
324
  }
330
- function qn(r) {
325
+ function ur(r) {
331
326
  const e = [];
332
327
  return r.forEach((n) => {
333
- const { parent: t, children: o } = n, { unitId: i, subUnitId: s, drawingId: a, transform: c = { width: 0, height: 0 } } = t;
328
+ const { parent: t, children: i } = n, { unitId: s, subUnitId: o, drawingId: a, transform: c = { width: 0, height: 0 } } = t;
334
329
  if (c == null)
335
330
  return;
336
- const u = o.map((l) => {
337
- const { transform: h } = l, { unitId: m, subUnitId: f, drawingId: g } = l, _ = an(h || {}, c, c.width || 0, c.height || 0);
331
+ const g = i.map((d) => {
332
+ const { transform: m } = d, { unitId: u, subUnitId: f, drawingId: h } = d, p = In(m || {}, c, c.width || 0, c.height || 0);
338
333
  return {
339
- unitId: m,
334
+ unitId: u,
340
335
  subUnitId: f,
341
- drawingId: g,
342
- transform: _,
336
+ drawingId: h,
337
+ transform: p,
343
338
  groupId: void 0
344
339
  };
345
- }), d = {
346
- unitId: i,
347
- subUnitId: s,
340
+ }), l = {
341
+ unitId: s,
342
+ subUnitId: o,
348
343
  drawingId: a,
349
- drawingType: ye.DRAWING_GROUP,
344
+ drawingType: Le.DRAWING_GROUP,
350
345
  transform: {
351
346
  left: 0,
352
347
  top: 0
353
348
  }
354
349
  };
355
350
  e.push({
356
- parent: d,
357
- children: u
351
+ parent: l,
352
+ children: g
358
353
  });
359
354
  }), e;
360
355
  }
361
- const Ot = {
356
+ const $t = {
362
357
  id: "sheet.command.group-sheet-image",
363
- type: $.COMMAND,
358
+ type: G.COMMAND,
364
359
  handler: (r, e) => {
365
- const n = r.get(B), t = r.get(ie), o = r.get(Y);
366
- if (!e)
367
- return !1;
368
- const i = [];
369
- e.forEach(({ parent: m, children: f }) => {
370
- i.push(m.unitId), f.forEach((g) => {
371
- i.push(g.unitId);
360
+ const n = r.get(W), t = r.get(ae), i = r.get(X);
361
+ if (!e) return !1;
362
+ const s = [];
363
+ e.forEach(({ parent: u, children: f }) => {
364
+ s.push(u.unitId), f.forEach((h) => {
365
+ s.push(h.unitId);
372
366
  });
373
367
  });
374
- const s = o.getGroupDrawingOp(e), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = s;
375
- return n.syncExecuteCommand(b.id, { op: d, unitId: a, subUnitId: c, objects: l, type: P.GROUP }) ? (t.pushUndoRedo({
368
+ const o = i.getGroupDrawingOp(e), { unitId: a, subUnitId: c, undo: g, redo: l, objects: d } = o;
369
+ return n.syncExecuteCommand(O.id, { op: l, unitId: a, subUnitId: c, objects: d, type: P.GROUP }) ? (t.pushUndoRedo({
376
370
  unitID: a,
377
371
  undoMutations: [
378
- { id: b.id, params: { op: u, unitId: a, subUnitId: c, objects: qn(l), type: P.UNGROUP } },
379
- { id: N.id, params: i }
372
+ { id: O.id, params: { op: g, unitId: a, subUnitId: c, objects: ur(d), type: P.UNGROUP } },
373
+ { id: j.id, params: s }
380
374
  ],
381
375
  redoMutations: [
382
- { id: b.id, params: { op: d, unitId: a, subUnitId: c, objects: l, type: P.GROUP } },
383
- { id: N.id, params: i }
376
+ { id: O.id, params: { op: l, unitId: a, subUnitId: c, objects: d, type: P.GROUP } },
377
+ { id: j.id, params: s }
384
378
  ]
385
379
  }), !0) : !1;
386
380
  }
387
- }, bt = {
381
+ }, Vt = {
388
382
  id: "sheet.command.ungroup-sheet-image",
389
- type: $.COMMAND,
383
+ type: G.COMMAND,
390
384
  handler: (r, e) => {
391
- const n = r.get(B), t = r.get(ie), o = r.get(Y);
392
- if (!e)
393
- return !1;
394
- const i = [];
395
- e.forEach(({ parent: m, children: f }) => {
396
- i.push(m.unitId), f.forEach((g) => {
397
- i.push(g.unitId);
385
+ const n = r.get(W), t = r.get(ae), i = r.get(X);
386
+ if (!e) return !1;
387
+ const s = [];
388
+ e.forEach(({ parent: u, children: f }) => {
389
+ s.push(u.unitId), f.forEach((h) => {
390
+ s.push(h.unitId);
398
391
  });
399
392
  });
400
- const s = o.getUngroupDrawingOp(e), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = s;
401
- return n.syncExecuteCommand(b.id, { op: d, unitId: a, subUnitId: c, objects: l, type: P.UNGROUP }) ? (t.pushUndoRedo({
393
+ const o = i.getUngroupDrawingOp(e), { unitId: a, subUnitId: c, undo: g, redo: l, objects: d } = o;
394
+ return n.syncExecuteCommand(O.id, { op: l, unitId: a, subUnitId: c, objects: d, type: P.UNGROUP }) ? (t.pushUndoRedo({
402
395
  unitID: a,
403
396
  undoMutations: [
404
- { id: b.id, params: { op: u, unitId: a, subUnitId: c, objects: Zn(l), type: P.GROUP } },
405
- { id: N.id, params: i }
397
+ { id: O.id, params: { op: g, unitId: a, subUnitId: c, objects: lr(d), type: P.GROUP } },
398
+ { id: j.id, params: s }
406
399
  ],
407
400
  redoMutations: [
408
- { id: b.id, params: { op: d, unitId: a, subUnitId: c, objects: l, type: P.UNGROUP } },
409
- { id: N.id, params: i }
401
+ { id: O.id, params: { op: l, unitId: a, subUnitId: c, objects: d, type: P.UNGROUP } },
402
+ { id: j.id, params: s }
410
403
  ]
411
404
  }), !0) : !1;
412
405
  }
413
406
  };
414
- function x(r, e) {
415
- const { from: n, to: t } = r, { column: o, columnOffset: i, row: s, rowOffset: a } = n, { column: c, columnOffset: u, row: d, rowOffset: l } = t, h = e.attachRangeWithCoord({
416
- startColumn: o,
417
- endColumn: o,
418
- startRow: s,
419
- endRow: s
407
+ function V(r, e) {
408
+ const { from: n, to: t } = r, { column: i, columnOffset: s, row: o, rowOffset: a } = n, { column: c, columnOffset: g, row: l, rowOffset: d } = t, m = e.attachRangeWithCoord({
409
+ startColumn: i,
410
+ endColumn: i,
411
+ startRow: o,
412
+ endRow: o
420
413
  });
421
- if (h == null)
414
+ if (m == null)
422
415
  return;
423
- const m = e.attachRangeWithCoord({
416
+ const u = e.attachRangeWithCoord({
424
417
  startColumn: c,
425
418
  endColumn: c,
426
- startRow: d,
427
- endRow: d
419
+ startRow: l,
420
+ endRow: l
428
421
  });
429
- if (m == null)
422
+ if (u == null)
430
423
  return;
431
- const { startX: f, startY: g } = h, { startX: _, startY: I } = m, C = J(f + i, 1), v = J(g + a, 1);
432
- let R = J(_ + u - C, 1), w = J(I + l - v, 1);
433
- return h.startX === m.endX && (R = 0), h.startY === m.endY && (w = 0), {
434
- left: C,
424
+ const { startX: f, startY: h } = m, { startX: p, startY: S } = u, I = Z(f + s, 1), v = Z(h + a, 1);
425
+ let C = Z(p + g - I, 1), _ = Z(S + d - v, 1);
426
+ return m.startX === u.endX && (C = 0), m.startY === u.endY && (_ = 0), {
427
+ left: I,
435
428
  top: v,
436
- width: R,
437
- height: w
429
+ width: C,
430
+ height: _
438
431
  };
439
432
  }
440
- function A(r, e) {
441
- const { left: n = 0, top: t = 0, width: o = 0, height: i = 0 } = r, s = e.getSelectionCellByPosition(n, t);
442
- if (s == null)
433
+ function N(r, e) {
434
+ const { left: n = 0, top: t = 0, width: i = 0, height: s = 0 } = r, o = e.getSelectionCellByPosition(n, t);
435
+ if (o == null)
443
436
  return;
444
437
  const a = {
445
- column: s.actualColumn,
446
- columnOffset: J(n - s.startX, 1),
447
- row: s.actualRow,
448
- rowOffset: J(t - s.startY, 1)
449
- }, c = e.getSelectionCellByPosition(n + o, t + i);
438
+ column: o.actualColumn,
439
+ columnOffset: Z(n - o.startX, 1),
440
+ row: o.actualRow,
441
+ rowOffset: Z(t - o.startY, 1)
442
+ }, c = e.getSelectionCellByPosition(n + i, t + s);
450
443
  if (c == null)
451
444
  return;
452
- const u = {
445
+ const g = {
453
446
  column: c.actualColumn,
454
- columnOffset: J(n + o - c.startX, 1),
447
+ columnOffset: Z(n + i - c.startX, 1),
455
448
  row: c.actualRow,
456
- rowOffset: J(t + i - c.startY, 1)
449
+ rowOffset: Z(t + s - c.startY, 1)
457
450
  };
458
451
  return {
459
452
  from: a,
460
- to: u
453
+ to: g
461
454
  };
462
455
  }
463
- var Qn = Object.defineProperty, er = Object.getOwnPropertyDescriptor, tr = (r, e, n, t) => {
464
- for (var o = t > 1 ? void 0 : t ? er(e, n) : e, i = r.length - 1, s; i >= 0; i--)
465
- (s = r[i]) && (o = (t ? s(e, n, o) : s(o)) || o);
466
- return t && o && Qn(e, n, o), o;
467
- }, V = (r, e) => (n, t) => e(n, t, r);
468
- let Ie = class extends ge {
469
- constructor(r, e, n, t, o, i, s, a, c, u, d) {
470
- super(), this._commandService = r, this._univerInstanceService = e, this._selectionManagerService = n, this._selectionRenderService = t, this._imageIoService = o, this._sheetDrawingService = i, this._drawingManagerService = s, this._contextService = a, this._messageService = c, this._localeService = u, this._renderManagerService = d, this._init();
456
+ var mr = Object.defineProperty, gr = Object.getOwnPropertyDescriptor, hr = (r, e, n, t) => {
457
+ for (var i = t > 1 ? void 0 : t ? gr(e, n) : e, s = r.length - 1, o; s >= 0; s--)
458
+ (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
459
+ return t && i && mr(e, n, i), i;
460
+ }, F = (r, e) => (n, t) => e(n, t, r);
461
+ let Ee = class extends ue {
462
+ constructor(r, e, n, t, i, s, o, a, c, g, l) {
463
+ super(), this._commandService = r, this._univerInstanceService = e, this._selectionManagerService = n, this._selectionRenderService = t, this._imageIoService = i, this._sheetDrawingService = s, this._drawingManagerService = o, this._contextService = a, this._messageService = c, this._localeService = g, this._renderManagerService = l, this._init();
471
464
  }
472
465
  _init() {
473
466
  this._initCommandListeners(), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
@@ -478,19 +471,19 @@ let Ie = class extends ge {
478
471
  _initCommandListeners() {
479
472
  this.disposeWithMe(
480
473
  this._commandService.onCommandExecuted(async (r) => {
481
- if (r.id === Oe.id || r.id === Ee.id) {
474
+ if (r.id === Ae.id || r.id === We.id) {
482
475
  const e = r.params;
483
476
  if (e.files == null)
484
477
  return;
485
478
  const n = e.files.length;
486
- if (n > ze) {
479
+ if (n > st) {
487
480
  this._messageService.show({
488
- type: _e.Error,
489
- content: this._localeService.t("update-status.exceedMaxCount", String(ze))
481
+ type: Re.Error,
482
+ content: this._localeService.t("update-status.exceedMaxCount", String(st))
490
483
  });
491
484
  return;
492
485
  }
493
- this._imageIoService.setWaitCount(n), r.id === Oe.id ? e.files.forEach(async (t) => {
486
+ this._imageIoService.setWaitCount(n), r.id === Ae.id ? e.files.forEach(async (t) => {
494
487
  await this._insertCellImage(t);
495
488
  }) : e.files.forEach(async (t) => {
496
489
  await this._insertFloatImage(t);
@@ -505,16 +498,16 @@ let Ie = class extends ge {
505
498
  let e;
506
499
  try {
507
500
  e = await this._imageIoService.saveImage(r);
508
- } catch (C) {
509
- const v = C.message;
510
- v === Le.ERROR_EXCEED_SIZE ? this._messageService.show({
511
- type: _e.Error,
512
- content: this._localeService.t("update-status.exceedMaxSize", String(en / (1024 * 1024)))
513
- }) : v === Le.ERROR_IMAGE_TYPE ? this._messageService.show({
514
- type: _e.Error,
501
+ } catch (I) {
502
+ const v = I.message;
503
+ v === xe.ERROR_EXCEED_SIZE ? this._messageService.show({
504
+ type: Re.Error,
505
+ content: this._localeService.t("update-status.exceedMaxSize", String(pn / (1024 * 1024)))
506
+ }) : v === xe.ERROR_IMAGE_TYPE ? this._messageService.show({
507
+ type: Re.Error,
515
508
  content: this._localeService.t("update-status.invalidImageType")
516
- }) : v === Le.ERROR_IMAGE && this._messageService.show({
517
- type: _e.Error,
509
+ }) : v === xe.ERROR_IMAGE && this._messageService.show({
510
+ type: Re.Error,
518
511
  content: this._localeService.t("update-status.invalidImage")
519
512
  });
520
513
  }
@@ -523,36 +516,36 @@ let Ie = class extends ge {
523
516
  const n = this._getUnitInfo();
524
517
  if (n == null)
525
518
  return;
526
- const { unitId: t, subUnitId: o } = n, { imageId: i, imageSourceType: s, source: a, base64Cache: c } = e, { width: u, height: d, image: l } = await tn(c || ""), h = this._renderManagerService.getRenderById(t);
527
- if (h == null)
519
+ const { unitId: t, subUnitId: i } = n, { imageId: s, imageSourceType: o, source: a, base64Cache: c } = e, { width: g, height: l, image: d } = await wn(c || ""), m = this._renderManagerService.getRenderById(t);
520
+ if (m == null)
528
521
  return;
529
- const { width: m, height: f } = h.scene;
530
- this._imageIoService.addImageSourceCache(a, s, l);
531
- let g = 1;
532
- if (u > Ke || d > Je) {
533
- const C = Ke / u, v = Je / d;
534
- g = Math.max(C, v);
522
+ const { width: u, height: f } = m.scene;
523
+ this._imageIoService.addImageSourceCache(a, o, d);
524
+ let h = 1;
525
+ if (g > ot || l > at) {
526
+ const I = ot / g, v = at / l;
527
+ h = Math.max(I, v);
535
528
  }
536
- const _ = this._getImagePosition(u * g, d * g, m, f);
537
- if (_ == null)
529
+ const p = this._getImagePosition(g * h, l * h, u, f);
530
+ if (p == null)
538
531
  return;
539
- const I = {
532
+ const S = {
540
533
  unitId: t,
541
- subUnitId: o,
542
- drawingId: i,
543
- drawingType: ye.DRAWING_IMAGE,
544
- imageSourceType: s,
534
+ subUnitId: i,
535
+ drawingId: s,
536
+ drawingType: Le.DRAWING_IMAGE,
537
+ imageSourceType: o,
545
538
  source: a,
546
- transform: x(_, this._selectionRenderService),
547
- sheetTransform: _
539
+ transform: V(p, this._selectionRenderService),
540
+ sheetTransform: p
548
541
  };
549
- this._commandService.executeCommand(He.id, {
542
+ this._commandService.executeCommand(tt.id, {
550
543
  unitId: t,
551
- drawings: [I]
544
+ drawings: [S]
552
545
  });
553
546
  }
554
547
  _getUnitInfo() {
555
- const r = this._univerInstanceService.getCurrentUnitForType(ee.UNIVER_SHEET);
548
+ const r = this._univerInstanceService.getCurrentUnitForType(Y.UNIVER_SHEET);
556
549
  if (r == null)
557
550
  return;
558
551
  const e = r.getActiveSheet();
@@ -565,51 +558,51 @@ let Ie = class extends ge {
565
558
  };
566
559
  }
567
560
  _getImagePosition(r, e, n, t) {
568
- const o = this._selectionManagerService.getSelections();
569
- let i = {
561
+ const i = this._selectionManagerService.getSelections();
562
+ let s = {
570
563
  startRow: 0,
571
564
  endRow: 0,
572
565
  startColumn: 0,
573
566
  endColumn: 0
574
567
  };
575
- o && o.length > 0 && (i = o[o.length - 1].range);
576
- const s = this._selectionRenderService.attachRangeWithCoord(i);
577
- if (s == null)
568
+ i && i.length > 0 && (s = i[i.length - 1].range);
569
+ const o = this._selectionRenderService.attachRangeWithCoord(s);
570
+ if (o == null)
578
571
  return;
579
- let { startColumn: a, startRow: c, startX: u, startY: d } = s, l = !1;
580
- if (u + r > n && (u = n - r, u < 0 && (u = 0, r = n), l = !0), d + e > t && (d = t - e, d < 0 && (d = 0, e = t), l = !0), l) {
581
- const g = this._selectionRenderService.getSelectionCellByPosition(u, d);
582
- if (g == null)
572
+ let { startColumn: a, startRow: c, startX: g, startY: l } = o, d = !1;
573
+ if (g + r > n && (g = n - r, g < 0 && (g = 0, r = n), d = !0), l + e > t && (l = t - e, l < 0 && (l = 0, e = t), d = !0), d) {
574
+ const h = this._selectionRenderService.getSelectionCellByPosition(g, l);
575
+ if (h == null)
583
576
  return;
584
- u = g.startX, d = g.startY, a = g.actualColumn, c = g.actualRow;
577
+ g = h.startX, l = h.startY, a = h.actualColumn, c = h.actualRow;
585
578
  }
586
- const h = {
579
+ const m = {
587
580
  column: a,
588
581
  columnOffset: 0,
589
582
  row: c,
590
583
  rowOffset: 0
591
- }, m = this._selectionRenderService.getSelectionCellByPosition(u + r, d + e);
592
- if (m == null)
584
+ }, u = this._selectionRenderService.getSelectionCellByPosition(g + r, l + e);
585
+ if (u == null)
593
586
  return;
594
587
  const f = {
595
- column: m.actualColumn,
596
- columnOffset: u + r - m.startX,
597
- row: m.actualRow,
598
- rowOffset: d + e - m.startY
588
+ column: u.actualColumn,
589
+ columnOffset: g + r - u.startX,
590
+ row: u.actualRow,
591
+ rowOffset: l + e - u.startY
599
592
  };
600
593
  return {
601
- from: h,
594
+ from: m,
602
595
  to: f
603
596
  };
604
597
  }
605
598
  _updateOrderListener() {
606
599
  this._drawingManagerService.featurePluginOrderUpdate$.subscribe((r) => {
607
- const { unitId: e, subUnitId: n, drawingIds: t, arrangeType: o } = r;
608
- this._commandService.executeCommand(Mt.id, {
600
+ const { unitId: e, subUnitId: n, drawingIds: t, arrangeType: i } = r;
601
+ this._commandService.executeCommand(Wt.id, {
609
602
  unitId: e,
610
603
  subUnitId: n,
611
604
  drawingIds: t,
612
- arrangeType: o
605
+ arrangeType: i
613
606
  });
614
607
  });
615
608
  }
@@ -617,22 +610,22 @@ let Ie = class extends ge {
617
610
  this._drawingManagerService.featurePluginUpdate$.subscribe((r) => {
618
611
  const e = [];
619
612
  r.length !== 0 && (r.forEach((n) => {
620
- const { unitId: t, subUnitId: o, drawingId: i, drawingType: s, transform: a } = n;
613
+ const { unitId: t, subUnitId: i, drawingId: s, drawingType: o, transform: a } = n;
621
614
  if (a == null)
622
615
  return;
623
- const c = this._sheetDrawingService.getDrawingByParam({ unitId: t, subUnitId: o, drawingId: i });
616
+ const c = this._sheetDrawingService.getDrawingByParam({ unitId: t, subUnitId: i, drawingId: s });
624
617
  if (c == null)
625
618
  return;
626
- const u = A({ ...c.transform, ...a }, this._selectionRenderService);
627
- if (u == null)
619
+ const g = N({ ...c.transform, ...a }, this._selectionRenderService);
620
+ if (g == null)
628
621
  return;
629
- const d = {
622
+ const l = {
630
623
  ...n,
631
- transform: { ...c.transform, ...a, ...x(u, this._selectionRenderService) },
632
- sheetTransform: { ...u }
624
+ transform: { ...c.transform, ...a, ...V(g, this._selectionRenderService) },
625
+ sheetTransform: { ...g }
633
626
  };
634
- e.push(d);
635
- }), e.length > 0 && this._commandService.executeCommand(Ue.id, {
627
+ e.push(l);
628
+ }), e.length > 0 && this._commandService.executeCommand($e.id, {
636
629
  unitId: r[0].unitId,
637
630
  drawings: e
638
631
  }));
@@ -640,349 +633,347 @@ let Ie = class extends ge {
640
633
  }
641
634
  _groupDrawingListener() {
642
635
  this._drawingManagerService.featurePluginGroupUpdate$.subscribe((r) => {
643
- this._commandService.executeCommand(Ot.id, r);
636
+ this._commandService.executeCommand($t.id, r);
644
637
  const { unitId: e, subUnitId: n, drawingId: t } = r[0].parent;
645
638
  this._drawingManagerService.focusDrawing([{ unitId: e, subUnitId: n, drawingId: t }]);
646
639
  }), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((r) => {
647
- this._commandService.executeCommand(bt.id, r);
640
+ this._commandService.executeCommand(Vt.id, r);
648
641
  });
649
642
  }
650
643
  _focusDrawingListener() {
651
644
  this.disposeWithMe(
652
645
  this._drawingManagerService.focus$.subscribe((r) => {
653
- r == null || r.length === 0 ? (this._contextService.setContextValue(le, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(le, !0), this._sheetDrawingService.focusDrawing(r));
646
+ r == null || r.length === 0 ? (this._contextService.setContextValue(fe, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(fe, !0), this._sheetDrawingService.focusDrawing(r));
654
647
  })
655
648
  );
656
649
  }
657
650
  };
658
- Ie = tr([
659
- me(he.Rendered, Ie),
660
- V(0, B),
661
- V(1, ue),
662
- V(2, W(Pn)),
663
- V(3, Te),
664
- V(4, nt),
665
- V(5, Y),
666
- V(6, k),
667
- V(7, tt),
668
- V(8, Sn),
669
- V(9, W(de)),
670
- V(10, se)
671
- ], Ie);
672
- var F = function() {
673
- return F = Object.assign || function(r) {
651
+ Ee = hr([
652
+ de(le.Rendered, Ee),
653
+ F(0, W),
654
+ F(1, ce),
655
+ F(2, B(Fn)),
656
+ F(3, Be),
657
+ F(4, ft),
658
+ F(5, X),
659
+ F(6, H),
660
+ F(7, ht),
661
+ F(8, jn),
662
+ F(9, B(pe)),
663
+ F(10, te)
664
+ ], Ee);
665
+ var x = function() {
666
+ return x = Object.assign || function(r) {
674
667
  for (var e, n = 1, t = arguments.length; n < t; n++) {
675
668
  e = arguments[n];
676
- for (var o in e)
677
- Object.prototype.hasOwnProperty.call(e, o) && (r[o] = e[o]);
669
+ for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (r[i] = e[i]);
678
670
  }
679
671
  return r;
680
- }, F.apply(this, arguments);
681
- }, nr = function(r, e) {
672
+ }, x.apply(this, arguments);
673
+ }, fr = function(r, e) {
682
674
  var n = {};
683
- for (var t in r)
684
- Object.prototype.hasOwnProperty.call(r, t) && e.indexOf(t) < 0 && (n[t] = r[t]);
675
+ for (var t in r) Object.prototype.hasOwnProperty.call(r, t) && e.indexOf(t) < 0 && (n[t] = r[t]);
685
676
  if (r != null && typeof Object.getOwnPropertySymbols == "function")
686
- for (var o = 0, t = Object.getOwnPropertySymbols(r); o < t.length; o++)
687
- e.indexOf(t[o]) < 0 && Object.prototype.propertyIsEnumerable.call(r, t[o]) && (n[t[o]] = r[t[o]]);
677
+ for (var i = 0, t = Object.getOwnPropertySymbols(r); i < t.length; i++)
678
+ e.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(r, t[i]) && (n[t[i]] = r[t[i]]);
688
679
  return n;
689
- }, Pt = vt(function(r, e) {
690
- var n = r.icon, t = r.id, o = r.className, i = r.extend, s = nr(r, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(o || "").trim(), c = St("_".concat(ir()));
691
- return yt(n, "".concat(t), { defIds: n.defIds, idSuffix: c.current }, F({ ref: e, className: a }, s), i);
680
+ }, Gt = Ut(function(r, e) {
681
+ var n = r.icon, t = r.id, i = r.className, s = r.extend, o = fr(r, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(i || "").trim(), c = At("_".concat(_r()));
682
+ return xt(n, "".concat(t), { defIds: n.defIds, idSuffix: c.current }, x({ ref: e, className: a }, o), s);
692
683
  });
693
- function yt(r, e, n, t, o) {
694
- return Ct(r.tag, F(F({ key: e }, rr(r, n, o)), t), (or(r, n).children || []).map(function(i, s) {
695
- return yt(i, "".concat(e, "-").concat(r.tag, "-").concat(s), n, void 0, o);
684
+ function xt(r, e, n, t, i) {
685
+ return Nt(r.tag, x(x({ key: e }, pr(r, n, i)), t), (wr(r, n).children || []).map(function(s, o) {
686
+ return xt(s, "".concat(e, "-").concat(r.tag, "-").concat(o), n, void 0, i);
696
687
  }));
697
688
  }
698
- function rr(r, e, n) {
699
- var t = F({}, r.attrs);
689
+ function pr(r, e, n) {
690
+ var t = x({}, r.attrs);
700
691
  n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
701
- var o = e.defIds;
702
- return !o || o.length === 0 || (r.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(i) {
703
- var s = i[0], a = i[1];
704
- typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
692
+ var i = e.defIds;
693
+ return !i || i.length === 0 || (r.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(s) {
694
+ var o = s[0], a = s[1];
695
+ typeof a == "string" && (t[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
705
696
  })), t;
706
697
  }
707
- function or(r, e) {
698
+ function wr(r, e) {
708
699
  var n, t = e.defIds;
709
- return !t || t.length === 0 ? r : r.tag === "defs" && (!((n = r.children) === null || n === void 0) && n.length) ? F(F({}, r), { children: r.children.map(function(o) {
710
- return typeof o.attrs.id == "string" && t && t.indexOf(o.attrs.id) > -1 ? F(F({}, o), { attrs: F(F({}, o.attrs), { id: o.attrs.id + e.idSuffix }) }) : o;
700
+ return !t || t.length === 0 ? r : r.tag === "defs" && (!((n = r.children) === null || n === void 0) && n.length) ? x(x({}, r), { children: r.children.map(function(i) {
701
+ return typeof i.attrs.id == "string" && t && t.indexOf(i.attrs.id) > -1 ? x(x({}, i), { attrs: x(x({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
711
702
  }) }) : r;
712
703
  }
713
- function ir() {
704
+ function _r() {
714
705
  return Math.random().toString(36).substring(2, 8);
715
706
  }
716
- Pt.displayName = "UniverIcon";
717
- var sr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, Tt = vt(function(r, e) {
718
- return Ct(Pt, Object.assign({}, r, {
707
+ Gt.displayName = "UniverIcon";
708
+ var vr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, Ft = Ut(function(r, e) {
709
+ return Nt(Gt, Object.assign({}, r, {
719
710
  id: "add-image-single",
720
711
  ref: e,
721
- icon: sr
712
+ icon: vr
722
713
  }));
723
714
  });
724
- Tt.displayName = "AddImageSingle";
725
- const ar = "univer-upload-file-menu", cr = "univer-upload-file-menu-input", Qe = {
726
- uploadFileMenu: ar,
727
- uploadFileMenuInput: cr
728
- }, Et = "COMPONENT_UPLOAD_FILE_MENU";
729
- var be = /* @__PURE__ */ ((r) => (r[r.cellImage = 0] = "cellImage", r[r.floatImage = 1] = "floatImage", r))(be || {});
730
- const lr = (r) => {
731
- const { type: e } = r, n = Z(B), t = St(null), o = () => {
715
+ Ft.displayName = "AddImageSingle";
716
+ const Sr = "univer-upload-file-menu", Cr = "univer-upload-file-menu-input", mt = {
717
+ uploadFileMenu: Sr,
718
+ uploadFileMenuInput: Cr
719
+ }, Yt = "COMPONENT_UPLOAD_FILE_MENU";
720
+ var Ne = /* @__PURE__ */ ((r) => (r[r.cellImage = 0] = "cellImage", r[r.floatImage = 1] = "floatImage", r))(Ne || {});
721
+ const Ir = (r) => {
722
+ const { type: e } = r, n = q(W), t = At(null), i = () => {
732
723
  var a;
733
724
  (a = t.current) == null || a.click();
734
- }, i = nn.map((a) => `.${a.replace("image/", "")}`).join(","), s = (a) => {
725
+ }, s = _n.map((a) => `.${a.replace("image/", "")}`).join(","), o = (a) => {
735
726
  const c = a.target.files;
736
727
  if (c == null)
737
728
  return;
738
- const u = Array.from(c);
739
- e === be.floatImage ? n.executeCommand(Ee.id, { files: u }) : e === be.cellImage && n.executeCommand(Oe.id, { files: u }), t.current && (t.current.value = "");
729
+ const g = Array.from(c);
730
+ e === Ne.floatImage ? n.executeCommand(We.id, { files: g }) : e === Ne.cellImage && n.executeCommand(Ae.id, { files: g }), t.current && (t.current.value = "");
740
731
  };
741
- return /* @__PURE__ */ L.createElement("div", { onClick: o, className: Qe.uploadFileMenu }, /* @__PURE__ */ L.createElement(
732
+ return /* @__PURE__ */ L.createElement("div", { onClick: i, className: mt.uploadFileMenu }, /* @__PURE__ */ L.createElement(
742
733
  "input",
743
734
  {
744
735
  type: "file",
745
- className: Qe.uploadFileMenuInput,
736
+ className: mt.uploadFileMenuInput,
746
737
  ref: t,
747
- onChange: s,
748
- accept: i,
738
+ onChange: o,
739
+ accept: s,
749
740
  multiple: !0
750
741
  }
751
742
  ));
752
- }, Ut = "addition-and-subtraction-single", At = "sheet.menu.image";
753
- function dr(r) {
743
+ }, Xt = "addition-and-subtraction-single", Ht = "sheet.menu.image";
744
+ function Rr(r) {
754
745
  return {
755
- id: At,
756
- type: rt.SUBITEMS,
757
- positions: [Cn.TOOLBAR_START],
758
- group: Rn.TOOLBAR_FORMULAS_INSERT,
759
- icon: Ut,
746
+ id: Ht,
747
+ type: pt.SUBITEMS,
748
+ positions: [Ln.TOOLBAR_START],
749
+ group: Bn.TOOLBAR_FORMULAS_INSERT,
750
+ icon: Xt,
760
751
  tooltip: "sheetImage.title",
761
- hidden$: ot(r, ee.UNIVER_SHEET),
762
- disabled$: un(r, { workbookTypes: [yn], worksheetTypes: [Tn], rangeTypes: [En] })
752
+ hidden$: wt(r, Y.UNIVER_SHEET),
753
+ disabled$: On(r, { workbookTypes: [ze], worksheetTypes: [Oe], rangeTypes: [Yn] })
763
754
  };
764
755
  }
765
- function ur(r) {
756
+ function Dr(r) {
766
757
  return {
767
- id: Ee.id,
758
+ id: We.id,
768
759
  title: "sheetImage.upload.float",
769
- type: rt.SELECTOR,
760
+ type: pt.SELECTOR,
770
761
  label: {
771
- name: Et,
762
+ name: Yt,
772
763
  props: {
773
- type: be.floatImage
764
+ type: Ne.floatImage
774
765
  }
775
766
  },
776
- positions: [At],
777
- hidden$: ot(r, ee.UNIVER_SHEET)
767
+ positions: [Ht],
768
+ hidden$: wt(r, Y.UNIVER_SHEET)
778
769
  };
779
770
  }
780
- const mr = "univer-image-common-panel", hr = "univer-image-common-panel-grid", gr = "univer-image-common-panel-border", fr = "univer-image-common-panel-title", pr = "univer-image-common-panel-row", wr = "univer-image-common-panel-row-vertical", _r = "univer-image-common-panel-column", vr = "univer-image-common-panel-column-center", Sr = "univer-image-common-panel-inline", Cr = "univer-image-common-panel-span2", Rr = "univer-image-common-panel-span3", Ir = "univer-image-common-panel-input", Dr = "univer-sheet-image-menu", Mr = "univer-sheet-image-menu-input", z = {
781
- imageCommonPanel: mr,
782
- imageCommonPanelGrid: hr,
783
- imageCommonPanelBorder: gr,
784
- imageCommonPanelTitle: fr,
785
- imageCommonPanelRow: pr,
786
- imageCommonPanelRowVertical: wr,
787
- imageCommonPanelColumn: _r,
788
- imageCommonPanelColumnCenter: vr,
789
- imageCommonPanelInline: Sr,
790
- imageCommonPanelSpan2: Cr,
791
- imageCommonPanelSpan3: Rr,
792
- imageCommonPanelInput: Ir,
793
- sheetImageMenu: Dr,
794
- sheetImageMenuInput: Mr
795
- }, Or = (r) => {
771
+ const Mr = "univer-image-common-panel", br = "univer-image-common-panel-grid", Or = "univer-image-common-panel-border", Pr = "univer-image-common-panel-title", Er = "univer-image-common-panel-row", yr = "univer-image-common-panel-row-vertical", Tr = "univer-image-common-panel-column", Ur = "univer-image-common-panel-column-center", Ar = "univer-image-common-panel-inline", Nr = "univer-image-common-panel-span2", jr = "univer-image-common-panel-span3", Lr = "univer-image-common-panel-input", Br = "univer-sheet-image-menu", Wr = "univer-sheet-image-menu-input", k = {
772
+ imageCommonPanel: Mr,
773
+ imageCommonPanelGrid: br,
774
+ imageCommonPanelBorder: Or,
775
+ imageCommonPanelTitle: Pr,
776
+ imageCommonPanelRow: Er,
777
+ imageCommonPanelRowVertical: yr,
778
+ imageCommonPanelColumn: Tr,
779
+ imageCommonPanelColumnCenter: Ur,
780
+ imageCommonPanelInline: Ar,
781
+ imageCommonPanelSpan2: Nr,
782
+ imageCommonPanelSpan3: jr,
783
+ imageCommonPanelInput: Lr,
784
+ sheetImageMenu: Br,
785
+ sheetImageMenuInput: Wr
786
+ }, $r = (r) => {
796
787
  var v;
797
- const e = Z(B), n = Z(de), t = Z(k), o = Z(se), { drawings: i } = r, s = i[0];
798
- if (s == null)
788
+ const e = q(W), n = q(pe), t = q(H), i = q(te), { drawings: s } = r, o = s[0];
789
+ if (o == null)
799
790
  return;
800
- const { unitId: a } = s, c = o.getRenderById(a), u = c == null ? void 0 : c.scene;
801
- if (u == null)
791
+ const { unitId: a } = o, c = i.getRenderById(a), g = c == null ? void 0 : c.scene;
792
+ if (g == null)
802
793
  return;
803
- const d = u.getTransformerByCreate(), [l, h] = $e(!0), m = (v = s.anchorType) != null ? v : O.Position, [f, g] = $e(m);
804
- function _(R, w) {
794
+ const l = g.getTransformerByCreate(), [d, m] = Je(!0), u = (v = o.anchorType) != null ? v : b.Position, [f, h] = Je(u);
795
+ function p(C, _) {
805
796
  const M = [];
806
- return R.forEach((p) => {
807
- const { oKey: T } = p, D = w.getDrawingOKey(T);
797
+ return C.forEach((w) => {
798
+ const { oKey: y } = w, D = _.getDrawingOKey(y);
808
799
  if (D == null)
809
800
  return M.push(null), !0;
810
- const { unitId: E, subUnitId: U, drawingId: y, drawingType: S, anchorType: j, sheetTransform: X } = D;
801
+ const { unitId: T, subUnitId: U, drawingId: E, drawingType: R, anchorType: A, sheetTransform: z } = D;
811
802
  M.push({
812
- unitId: E,
803
+ unitId: T,
813
804
  subUnitId: U,
814
- drawingId: y,
815
- anchorType: j,
816
- sheetTransform: X,
817
- drawingType: S
805
+ drawingId: E,
806
+ anchorType: A,
807
+ sheetTransform: z,
808
+ drawingType: R
818
809
  });
819
810
  }), M;
820
811
  }
821
- Ye(() => {
822
- const R = d.onClearControlObservable.add((M) => {
823
- M === !0 && h(!1);
824
- }), w = d.onChangeStartObservable.add((M) => {
812
+ Qe(() => {
813
+ const C = l.onClearControlObservable.add((M) => {
814
+ M === !0 && m(!1);
815
+ }), _ = l.onChangeStartObservable.add((M) => {
825
816
  var D;
826
- const { objects: p } = M, T = _(p, t);
827
- if (T.length === 0)
828
- h(!1);
829
- else if (T.length >= 1) {
830
- h(!0);
831
- const E = ((D = T[0]) == null ? void 0 : D.anchorType) || O.Position;
832
- g(E);
817
+ const { objects: w } = M, y = p(w, t);
818
+ if (y.length === 0)
819
+ m(!1);
820
+ else if (y.length >= 1) {
821
+ m(!0);
822
+ const T = ((D = y[0]) == null ? void 0 : D.anchorType) || b.Position;
823
+ h(T);
833
824
  }
834
825
  });
835
826
  return () => {
836
- w == null || w.dispose(), R == null || R.dispose();
827
+ _ == null || _.dispose(), C == null || C.dispose();
837
828
  };
838
829
  }, []);
839
- function I(R) {
840
- g(R);
841
- const w = t.getFocusDrawings();
842
- if (w.length === 0)
830
+ function S(C) {
831
+ h(C);
832
+ const _ = t.getFocusDrawings();
833
+ if (_.length === 0)
843
834
  return;
844
- const M = w.map((p) => ({
845
- unitId: p.unitId,
846
- subUnitId: p.subUnitId,
847
- drawingId: p.drawingId,
848
- anchorType: R
835
+ const M = _.map((w) => ({
836
+ unitId: w.unitId,
837
+ subUnitId: w.subUnitId,
838
+ drawingId: w.drawingId,
839
+ anchorType: C
849
840
  }));
850
- e.executeCommand(Ue.id, {
851
- unitId: w[0].unitId,
841
+ e.executeCommand($e.id, {
842
+ unitId: _[0].unitId,
852
843
  drawings: M
853
844
  });
854
845
  }
855
- const C = (R) => R ? "block" : "none";
856
- return /* @__PURE__ */ L.createElement("div", { className: ve(z.imageCommonPanelGrid, z.imageCommonPanelBorder), style: { display: C(l) } }, /* @__PURE__ */ L.createElement("div", { className: z.imageCommonPanelRow }, /* @__PURE__ */ L.createElement("div", { className: ve(z.imageCommonPanelColumn, z.imageCommonPanelTitle) }, /* @__PURE__ */ L.createElement("div", null, n.t("drawing-anchor.title")))), /* @__PURE__ */ L.createElement("div", { className: ve(z.imageCommonPanelRow) }, /* @__PURE__ */ L.createElement("div", { className: ve(z.imageCommonPanelColumn) }, /* @__PURE__ */ L.createElement($n, { value: f, onChange: I, direction: "vertical" }, /* @__PURE__ */ L.createElement(je, { value: O.Both }, n.t("drawing-anchor.both")), /* @__PURE__ */ L.createElement(je, { value: O.Position }, n.t("drawing-anchor.position")), /* @__PURE__ */ L.createElement(je, { value: O.None }, n.t("drawing-anchor.none"))))));
857
- }, br = () => {
858
- const r = Z(k), e = r.getFocusDrawings();
846
+ const I = (C) => C ? "block" : "none";
847
+ return /* @__PURE__ */ L.createElement("div", { className: De(k.imageCommonPanelGrid, k.imageCommonPanelBorder), style: { display: I(d) } }, /* @__PURE__ */ L.createElement("div", { className: k.imageCommonPanelRow }, /* @__PURE__ */ L.createElement("div", { className: De(k.imageCommonPanelColumn, k.imageCommonPanelTitle) }, /* @__PURE__ */ L.createElement("div", null, n.t("drawing-anchor.title")))), /* @__PURE__ */ L.createElement("div", { className: De(k.imageCommonPanelRow) }, /* @__PURE__ */ L.createElement("div", { className: De(k.imageCommonPanelColumn) }, /* @__PURE__ */ L.createElement(er, { value: f, onChange: S, direction: "vertical" }, /* @__PURE__ */ L.createElement(Ye, { value: b.Both }, n.t("drawing-anchor.both")), /* @__PURE__ */ L.createElement(Ye, { value: b.Position }, n.t("drawing-anchor.position")), /* @__PURE__ */ L.createElement(Ye, { value: b.None }, n.t("drawing-anchor.none"))))));
848
+ }, Vr = () => {
849
+ const r = q(H), e = r.getFocusDrawings();
859
850
  if (e == null || e.length === 0)
860
851
  return;
861
- const [n, t] = $e(e);
862
- return Ye(() => {
863
- const o = r.focus$.subscribe((i) => {
864
- t(i);
852
+ const [n, t] = Je(e);
853
+ return Qe(() => {
854
+ const i = r.focus$.subscribe((s) => {
855
+ t(s);
865
856
  });
866
857
  return () => {
867
- o.unsubscribe();
858
+ i.unsubscribe();
868
859
  };
869
- }, []), /* @__PURE__ */ L.createElement("div", { className: z.imageCommonPanel }, /* @__PURE__ */ L.createElement(Jt, { drawings: n }), /* @__PURE__ */ L.createElement(Or, { drawings: n }));
870
- }, fe = {
860
+ }, []), /* @__PURE__ */ L.createElement("div", { className: k.imageCommonPanel }, /* @__PURE__ */ L.createElement(mn, { drawings: n }), /* @__PURE__ */ L.createElement($r, { drawings: n }));
861
+ }, we = {
871
862
  id: "sheet.command.move-drawing",
872
- type: $.COMMAND,
863
+ type: G.COMMAND,
873
864
  handler: (r, e) => {
874
- const n = r.get(B), t = r.get(Y), o = r.get(Te), { direction: i } = e, s = t.getFocusDrawings();
875
- if (s.length === 0)
865
+ const n = r.get(W), t = r.get(X), i = r.get(Be), { direction: s } = e, o = t.getFocusDrawings();
866
+ if (o.length === 0)
876
867
  return !1;
877
- const a = s[0].unitId, c = s.map((d) => {
878
- const { transform: l } = d;
879
- if (l == null)
868
+ const a = o[0].unitId, c = o.map((l) => {
869
+ const { transform: d } = l;
870
+ if (d == null)
880
871
  return null;
881
- const h = { ...l }, { left: m = 0, top: f = 0 } = l;
882
- return i === K.UP ? h.top = f - 1 : i === K.DOWN ? h.top = f + 1 : i === K.LEFT ? h.left = m - 1 : i === K.RIGHT && (h.left = m + 1), {
883
- ...d,
884
- transform: h,
885
- sheetTransform: A(h, o)
872
+ const m = { ...d }, { left: u = 0, top: f = 0 } = d;
873
+ return s === J.UP ? m.top = f - 1 : s === J.DOWN ? m.top = f + 1 : s === J.LEFT ? m.left = u - 1 : s === J.RIGHT && (m.left = u + 1), {
874
+ ...l,
875
+ transform: m,
876
+ sheetTransform: N(m, i)
886
877
  };
887
- }).filter((d) => d != null);
888
- return n.syncExecuteCommand(Ue.id, {
878
+ }).filter((l) => l != null);
879
+ return n.syncExecuteCommand($e.id, {
889
880
  unitId: a,
890
881
  drawings: c
891
- }) ? (n.syncExecuteCommand(N.id, [a]), !0) : !1;
882
+ }) ? (n.syncExecuteCommand(j.id, [a]), !0) : !1;
892
883
  }
893
- }, Nt = {
884
+ }, zt = {
894
885
  id: "sheet.command.delete-drawing",
895
- type: $.COMMAND,
886
+ type: G.COMMAND,
896
887
  handler: (r) => {
897
- const e = r.get(B), t = r.get(Y).getFocusDrawings();
888
+ const e = r.get(W), t = r.get(X).getFocusDrawings();
898
889
  if (t.length === 0)
899
890
  return !1;
900
- const o = t[0].unitId, i = t.map((s) => {
901
- const { unitId: a, subUnitId: c, drawingId: u, drawingType: d } = s;
891
+ const i = t[0].unitId, s = t.map((o) => {
892
+ const { unitId: a, subUnitId: c, drawingId: g, drawingType: l } = o;
902
893
  return {
903
894
  unitId: a,
904
895
  subUnitId: c,
905
- drawingId: u,
906
- drawingType: d
896
+ drawingId: g,
897
+ drawingType: l
907
898
  };
908
899
  });
909
- return e.executeCommand(Xe.id, {
910
- unitId: o,
911
- drawings: i
900
+ return e.executeCommand(et.id, {
901
+ unitId: i,
902
+ drawings: s
912
903
  });
913
904
  }
914
905
  };
915
- function pe(r) {
916
- return !r.getContextValue(xt) && !r.getContextValue($t) && r.getContextValue(le);
906
+ function _e(r) {
907
+ return !r.getContextValue(Qt) && !r.getContextValue(en) && r.getContextValue(fe);
917
908
  }
918
- const Pr = {
919
- id: fe.id,
909
+ const Gr = {
910
+ id: we.id,
920
911
  description: "shortcut.sheet.drawing-move-down",
921
912
  group: "4_sheet-drawing-view",
922
913
  binding: oe.ARROW_DOWN,
923
914
  priority: 100,
924
- preconditions: pe,
915
+ preconditions: _e,
925
916
  staticParameters: {
926
- direction: K.DOWN
917
+ direction: J.DOWN
927
918
  }
928
- }, yr = {
929
- id: fe.id,
919
+ }, xr = {
920
+ id: we.id,
930
921
  description: "shortcut.sheet.drawing-move-up",
931
922
  group: "4_sheet-drawing-view",
932
923
  binding: oe.ARROW_UP,
933
924
  priority: 100,
934
- preconditions: pe,
925
+ preconditions: _e,
935
926
  staticParameters: {
936
- direction: K.UP
927
+ direction: J.UP
937
928
  }
938
- }, Tr = {
939
- id: fe.id,
929
+ }, Fr = {
930
+ id: we.id,
940
931
  description: "shortcut.sheet.drawing-move-left",
941
932
  group: "4_sheet-drawing-view",
942
933
  binding: oe.ARROW_LEFT,
943
934
  priority: 100,
944
- preconditions: pe,
935
+ preconditions: _e,
945
936
  staticParameters: {
946
- direction: K.LEFT
937
+ direction: J.LEFT
947
938
  }
948
- }, Er = {
949
- id: fe.id,
939
+ }, Yr = {
940
+ id: we.id,
950
941
  description: "shortcut.sheet.drawing-move-right",
951
942
  group: "4_sheet-drawing-view",
952
943
  binding: oe.ARROW_RIGHT,
953
944
  priority: 100,
954
- preconditions: pe,
945
+ preconditions: _e,
955
946
  staticParameters: {
956
- direction: K.RIGHT
947
+ direction: J.RIGHT
957
948
  }
958
- }, Ur = {
959
- id: Nt.id,
949
+ }, Xr = {
950
+ id: zt.id,
960
951
  description: "shortcut.sheet.drawing-delete",
961
952
  group: "4_sheet-drawing-view",
962
953
  // when focusing on any other input tag do not trigger this shortcut
963
- preconditions: pe,
954
+ preconditions: _e,
964
955
  binding: oe.DELETE,
965
956
  mac: oe.BACKSPACE
966
957
  };
967
- var Ar = Object.defineProperty, Nr = Object.getOwnPropertyDescriptor, Lr = (r, e, n, t) => {
968
- for (var o = t > 1 ? void 0 : t ? Nr(e, n) : e, i = r.length - 1, s; i >= 0; i--)
969
- (s = r[i]) && (o = (t ? s(e, n, o) : s(o)) || o);
970
- return t && o && Ar(e, n, o), o;
971
- }, ae = (r, e) => (n, t) => e(n, t, r);
972
- const jr = {};
973
- let ce = class extends ge {
974
- constructor(r, e, n, t, o, i) {
975
- super(), this._config = r, this._injector = e, this._componentManager = n, this._menuService = t, this._commandService = o, this._shortcutService = i, this._init();
958
+ var Hr = Object.defineProperty, zr = Object.getOwnPropertyDescriptor, Kr = (r, e, n, t) => {
959
+ for (var i = t > 1 ? void 0 : t ? zr(e, n) : e, s = r.length - 1, o; s >= 0; s--)
960
+ (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
961
+ return t && i && Hr(e, n, i), i;
962
+ }, me = (r, e) => (n, t) => e(n, t, r);
963
+ const kr = {};
964
+ let he = class extends ue {
965
+ constructor(r, e, n, t, i, s) {
966
+ super(), this._config = r, this._injector = e, this._componentManager = n, this._menuService = t, this._commandService = i, this._shortcutService = s, this._init();
976
967
  }
977
968
  _initCustomComponents() {
978
969
  const r = this._componentManager;
979
- this.disposeWithMe(r.register(Ut, Tt)), this.disposeWithMe(r.register(Et, lr)), this.disposeWithMe(r.register(Rt, br));
970
+ this.disposeWithMe(r.register(Xt, Ft)), this.disposeWithMe(r.register(Yt, Ir)), this.disposeWithMe(r.register(jt, Vr));
980
971
  }
981
972
  _initMenus() {
982
973
  const { menu: r = {} } = this._config;
983
974
  [
984
- dr,
985
- ur
975
+ Rr,
976
+ Dr
986
977
  // UploadCellImageMenuFactory,
987
978
  ].forEach((e) => {
988
979
  this._menuService.addMenuItem(e(this._injector), r);
@@ -990,29 +981,29 @@ let ce = class extends ge {
990
981
  }
991
982
  _initCommands() {
992
983
  [
993
- Ee,
994
- Oe,
995
- He,
996
- Xe,
997
- Ue,
998
- It,
999
- N,
1000
- Dt,
1001
- Ot,
1002
- bt,
1003
- fe,
1004
- Nt,
1005
- Mt
984
+ We,
985
+ Ae,
986
+ tt,
987
+ et,
988
+ $e,
989
+ Lt,
990
+ j,
991
+ Bt,
992
+ $t,
993
+ Vt,
994
+ we,
995
+ zt,
996
+ Wt
1006
997
  ].forEach((r) => this.disposeWithMe(this._commandService.registerCommand(r)));
1007
998
  }
1008
999
  _initShortcuts() {
1009
1000
  [
1010
1001
  // sheet drawing shortcuts
1011
- Pr,
1012
- yr,
1013
- Tr,
1014
- Er,
1015
- Ur
1002
+ Gr,
1003
+ xr,
1004
+ Fr,
1005
+ Yr,
1006
+ Xr
1016
1007
  ].forEach((r) => {
1017
1008
  this.disposeWithMe(this._shortcutService.registerShortcut(r));
1018
1009
  });
@@ -1021,47 +1012,47 @@ let ce = class extends ge {
1021
1012
  this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
1022
1013
  }
1023
1014
  };
1024
- ce = Lr([
1025
- me(he.Rendered, ce),
1026
- ae(1, W(Ve)),
1027
- ae(2, W(In)),
1028
- ae(3, Dn),
1029
- ae(4, B),
1030
- ae(5, Mn)
1031
- ], ce);
1032
- var Wr = Object.defineProperty, Br = Object.getOwnPropertyDescriptor, Gr = (r, e, n, t) => {
1033
- for (var o = t > 1 ? void 0 : t ? Br(e, n) : e, i = r.length - 1, s; i >= 0; i--)
1034
- (s = r[i]) && (o = (t ? s(e, n, o) : s(o)) || o);
1035
- return t && o && Wr(e, n, o), o;
1036
- }, te = (r, e) => (n, t) => e(n, t, r);
1037
- const xr = [
1038
- it.id,
1039
- st.id,
1040
- at.id,
1041
- ct.id,
1042
- lt.id,
1043
- dt.id,
1044
- ut.id,
1045
- mt.id,
1046
- Ge.id,
1047
- xe.id,
1048
- ht.id,
1049
- gt.id,
1050
- ft.id,
1051
- pt.id,
1052
- wt.id,
1053
- _t.id
1054
- ], $r = [
1055
- Un.id,
1056
- An.id,
1057
- Nn.id,
1058
- Ln.id,
1059
- jn.id,
1060
- Wn.id
1015
+ he = Kr([
1016
+ de(le.Rendered, he),
1017
+ me(1, B(qe)),
1018
+ me(2, B(Wn)),
1019
+ me(3, $n),
1020
+ me(4, W),
1021
+ me(5, Vn)
1022
+ ], he);
1023
+ var Jr = Object.defineProperty, Zr = Object.getOwnPropertyDescriptor, qr = (r, e, n, t) => {
1024
+ for (var i = t > 1 ? void 0 : t ? Zr(e, n) : e, s = r.length - 1, o; s >= 0; s--)
1025
+ (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
1026
+ return t && i && Jr(e, n, i), i;
1027
+ }, re = (r, e) => (n, t) => e(n, t, r);
1028
+ const Qr = [
1029
+ _t.id,
1030
+ vt.id,
1031
+ St.id,
1032
+ Ct.id,
1033
+ It.id,
1034
+ Rt.id,
1035
+ Dt.id,
1036
+ Mt.id,
1037
+ Ke.id,
1038
+ ke.id,
1039
+ bt.id,
1040
+ Ot.id,
1041
+ Pt.id,
1042
+ Et.id,
1043
+ yt.id,
1044
+ Tt.id
1045
+ ], ei = [
1046
+ Xn.id,
1047
+ Hn.id,
1048
+ zn.id,
1049
+ Kn.id,
1050
+ kn.id,
1051
+ Jn.id
1061
1052
  ];
1062
- let De = class extends ge {
1063
- constructor(r, e, n, t, o, i) {
1064
- super(), this._commandService = r, this._sheetInterceptorService = e, this._sheetDrawingService = n, this._drawingManagerService = t, this._selectionRenderService = o, this._univerInstanceService = i, this._init();
1053
+ let ye = class extends ue {
1054
+ constructor(r, e, n, t, i, s) {
1055
+ super(), this._commandService = r, this._sheetInterceptorService = e, this._sheetDrawingService = n, this._drawingManagerService = t, this._selectionRenderService = i, this._univerInstanceService = s, this._init();
1065
1056
  }
1066
1057
  _init() {
1067
1058
  this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
@@ -1070,56 +1061,56 @@ let De = class extends ge {
1070
1061
  this.disposeWithMe(
1071
1062
  this._sheetInterceptorService.interceptCommand({
1072
1063
  getMutations: (r) => {
1073
- if (!xr.includes(r.id))
1064
+ if (!Qr.includes(r.id))
1074
1065
  return { redos: [], undos: [] };
1075
1066
  if (r.params == null)
1076
1067
  return { redos: [], undos: [] };
1077
1068
  const e = r.id;
1078
- if (e === it.id)
1069
+ if (e === _t.id)
1079
1070
  return this._moveRowInterceptor(r.params, "insert");
1080
- if (e === st.id)
1071
+ if (e === vt.id)
1081
1072
  return this._moveColInterceptor(r.params, "insert");
1082
- if (e === at.id)
1073
+ if (e === St.id)
1083
1074
  return this._moveRowInterceptor(r.params, "remove");
1084
- if (e === ct.id)
1075
+ if (e === Ct.id)
1085
1076
  return this._moveColInterceptor(r.params, "remove");
1086
- if (e === lt.id) {
1077
+ if (e === It.id) {
1087
1078
  const { range: n } = r.params;
1088
1079
  return this._getRangeMoveUndo(
1089
1080
  n,
1090
1081
  0
1091
1082
  /* deleteLeft */
1092
1083
  );
1093
- } else if (e === dt.id) {
1084
+ } else if (e === Rt.id) {
1094
1085
  const { range: n } = r.params;
1095
1086
  return this._getRangeMoveUndo(
1096
1087
  n,
1097
1088
  1
1098
1089
  /* deleteUp */
1099
1090
  );
1100
- } else if (e === ut.id) {
1091
+ } else if (e === Dt.id) {
1101
1092
  const { range: n } = r.params;
1102
1093
  return this._getRangeMoveUndo(
1103
1094
  n,
1104
1095
  2
1105
1096
  /* insertDown */
1106
1097
  );
1107
- } else if (e === mt.id) {
1098
+ } else if (e === Mt.id) {
1108
1099
  const { range: n } = r.params;
1109
1100
  return this._getRangeMoveUndo(
1110
1101
  n,
1111
1102
  3
1112
1103
  /* insertRight */
1113
1104
  );
1114
- } else if (e === ft.id || e === pt.id) {
1115
- const n = r.params, { unitId: t, subUnitId: o, ranges: i } = n;
1116
- return this._getDrawingUndoForRowVisible(t, o, i);
1117
- } else if (e === wt.id || e === _t.id) {
1118
- const n = r.params, { unitId: t, subUnitId: o, ranges: i } = n;
1119
- return this._getDrawingUndoForColVisible(t, o, i);
1120
- } else if (e === Ge.id || e === xe.id || e === ht.id || e === gt.id) {
1121
- const n = r.params, { unitId: t, subUnitId: o, ranges: i } = n, s = e === Ge.id || e === xe.id;
1122
- return this._getDrawingUndoForRowAndColSize(t, o, i, s);
1105
+ } else if (e === Pt.id || e === Et.id) {
1106
+ const n = r.params, { unitId: t, subUnitId: i, ranges: s } = n;
1107
+ return this._getDrawingUndoForRowVisible(t, i, s);
1108
+ } else if (e === yt.id || e === Tt.id) {
1109
+ const n = r.params, { unitId: t, subUnitId: i, ranges: s } = n;
1110
+ return this._getDrawingUndoForColVisible(t, i, s);
1111
+ } else if (e === Ke.id || e === ke.id || e === bt.id || e === Ot.id) {
1112
+ const n = r.params, { unitId: t, subUnitId: i, ranges: s } = n, o = e === Ke.id || e === ke.id;
1113
+ return this._getDrawingUndoForRowAndColSize(t, i, s, o);
1123
1114
  }
1124
1115
  return { redos: [], undos: [] };
1125
1116
  }
@@ -1127,66 +1118,66 @@ let De = class extends ge {
1127
1118
  );
1128
1119
  }
1129
1120
  _getRangeMoveUndo(r, e) {
1130
- const n = re(this._univerInstanceService);
1121
+ const n = se(this._univerInstanceService);
1131
1122
  if (n == null)
1132
1123
  return { redos: [], undos: [] };
1133
- const t = n.unitId, o = n.subUnitId, i = [], s = [], a = this._sheetDrawingService.getDrawingData(t, o), c = [], u = [];
1134
- if (Object.keys(a).forEach((d) => {
1135
- const l = a[d], { updateDrawings: h, deleteDrawings: m } = this._getUpdateOrDeleteDrawings(r, e, l);
1136
- c.push(...h), u.push(...m);
1137
- }), c.length === 0 && u.length === 0)
1124
+ const t = n.unitId, i = n.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(t, i), c = [], g = [];
1125
+ if (Object.keys(a).forEach((l) => {
1126
+ const d = a[l], { updateDrawings: m, deleteDrawings: u } = this._getUpdateOrDeleteDrawings(r, e, d);
1127
+ c.push(...m), g.push(...u);
1128
+ }), c.length === 0 && g.length === 0)
1138
1129
  return { redos: [], undos: [] };
1139
1130
  if (c.length > 0) {
1140
- const d = this._sheetDrawingService.getBatchUpdateOp(c), { undo: l, redo: h, objects: m } = d;
1141
- i.push({ id: b.id, params: { unitId: t, subUnitId: o, op: h, objects: m, type: P.UPDATE } }), s.push({ id: b.id, params: { unitId: t, subUnitId: o, op: l, objects: m, type: P.UPDATE } });
1131
+ const l = this._sheetDrawingService.getBatchUpdateOp(c), { undo: d, redo: m, objects: u } = l;
1132
+ s.push({ id: O.id, params: { unitId: t, subUnitId: i, op: m, objects: u, type: P.UPDATE } }), o.push({ id: O.id, params: { unitId: t, subUnitId: i, op: d, objects: u, type: P.UPDATE } });
1142
1133
  }
1143
- if (u.length > 0) {
1144
- const d = this._sheetDrawingService.getBatchRemoveOp(u), l = d.undo, h = d.redo, m = d.objects;
1145
- i.push({ id: b.id, params: { unitId: t, subUnitId: o, op: h, objects: m, type: P.REMOVE } }), s.push({ id: b.id, params: { unitId: t, subUnitId: o, op: l, objects: m, type: P.INSERT } });
1134
+ if (g.length > 0) {
1135
+ const l = this._sheetDrawingService.getBatchRemoveOp(g), d = l.undo, m = l.redo, u = l.objects;
1136
+ s.push({ id: O.id, params: { unitId: t, subUnitId: i, op: m, objects: u, type: P.REMOVE } }), o.push({ id: O.id, params: { unitId: t, subUnitId: i, op: d, objects: u, type: P.INSERT } });
1146
1137
  }
1147
- return i.push({ id: N.id, params: [t] }), s.push({ id: N.id, params: [t] }), {
1148
- redos: i,
1149
- undos: s
1138
+ return s.push({ id: j.id, params: [t] }), o.push({ id: j.id, params: [t] }), {
1139
+ redos: s,
1140
+ undos: o
1150
1141
  };
1151
1142
  }
1152
1143
  _getUpdateOrDeleteDrawings(r, e, n) {
1153
- const t = [], o = [], { sheetTransform: i, anchorType: s = O.Position, transform: a, unitId: c, subUnitId: u, drawingId: d } = n, { from: l, to: h } = i, { row: m, column: f } = l, { row: g, column: _ } = h;
1154
- if (i == null || a == null)
1144
+ const t = [], i = [], { sheetTransform: s, anchorType: o = b.Position, transform: a, unitId: c, subUnitId: g, drawingId: l } = n, { from: d, to: m } = s, { row: u, column: f } = d, { row: h, column: p } = m;
1145
+ if (s == null || a == null)
1155
1146
  return {
1156
1147
  updateDrawings: t,
1157
- deleteDrawings: o
1148
+ deleteDrawings: i
1158
1149
  };
1159
- const { startRow: I, endRow: C, startColumn: v, endColumn: R } = r;
1160
- let w = null, M = null;
1161
- if (e === 0 && m >= I && g <= C)
1162
- if (f >= v && _ <= R)
1163
- o.push({ unitId: c, subUnitId: u, drawingId: d });
1150
+ const { startRow: S, endRow: I, startColumn: v, endColumn: C } = r;
1151
+ let _ = null, M = null;
1152
+ if (e === 0 && u >= S && h <= I)
1153
+ if (f >= v && p <= C)
1154
+ i.push({ unitId: c, subUnitId: g, drawingId: l });
1164
1155
  else {
1165
- const p = this._shrinkCol(i, a, v, R, s);
1166
- w = p == null ? void 0 : p.newSheetTransform, M = p == null ? void 0 : p.newTransform;
1156
+ const w = this._shrinkCol(s, a, v, C, o);
1157
+ _ = w == null ? void 0 : w.newSheetTransform, M = w == null ? void 0 : w.newTransform;
1167
1158
  }
1168
- else if (e === 1 && f >= v && _ <= R)
1169
- if (m >= I && g <= C)
1170
- o.push({ unitId: c, subUnitId: u, drawingId: d });
1159
+ else if (e === 1 && f >= v && p <= C)
1160
+ if (u >= S && h <= I)
1161
+ i.push({ unitId: c, subUnitId: g, drawingId: l });
1171
1162
  else {
1172
- const p = this._shrinkRow(i, a, I, C, s);
1173
- w = p == null ? void 0 : p.newSheetTransform, M = p == null ? void 0 : p.newTransform;
1163
+ const w = this._shrinkRow(s, a, S, I, o);
1164
+ _ = w == null ? void 0 : w.newSheetTransform, M = w == null ? void 0 : w.newTransform;
1174
1165
  }
1175
1166
  else if (e === 2) {
1176
- const p = this._expandRow(i, a, I, C, s);
1177
- w = p == null ? void 0 : p.newSheetTransform, M = p == null ? void 0 : p.newTransform;
1167
+ const w = this._expandRow(s, a, S, I, o);
1168
+ _ = w == null ? void 0 : w.newSheetTransform, M = w == null ? void 0 : w.newTransform;
1178
1169
  } else if (e === 3) {
1179
- const p = this._expandCol(i, a, v, R, s);
1180
- w = p == null ? void 0 : p.newSheetTransform, M = p == null ? void 0 : p.newTransform;
1170
+ const w = this._expandCol(s, a, v, C, o);
1171
+ _ = w == null ? void 0 : w.newSheetTransform, M = w == null ? void 0 : w.newTransform;
1181
1172
  }
1182
- if (w != null && M != null) {
1183
- const p = x(w, this._selectionRenderService);
1184
- t.push({ ...n, sheetTransform: w, transform: p });
1173
+ if (_ != null && M != null) {
1174
+ const w = V(_, this._selectionRenderService);
1175
+ t.push({ ...n, sheetTransform: _, transform: w });
1185
1176
  }
1186
- return { updateDrawings: t, deleteDrawings: o };
1177
+ return { updateDrawings: t, deleteDrawings: i };
1187
1178
  }
1188
1179
  _remainDrawingSize(r, e, n) {
1189
- const t = A({ ...r }, this._selectionRenderService);
1180
+ const t = N({ ...r }, this._selectionRenderService);
1190
1181
  t != null && e.push({
1191
1182
  ...n,
1192
1183
  sheetTransform: t
@@ -1194,92 +1185,92 @@ let De = class extends ge {
1194
1185
  }
1195
1186
  // eslint-disable-next-line max-lines-per-function
1196
1187
  _getDrawingUndoForColVisible(r, e, n) {
1197
- const t = this._drawingManagerService.getDrawingData(r, e), o = [], i = [];
1198
- if (Object.keys(t).forEach((d) => {
1199
- const l = t[d], { sheetTransform: h, transform: m, anchorType: f = O.Position } = l;
1200
- if (f === O.None)
1201
- this._remainDrawingSize(m, o, l);
1188
+ const t = this._drawingManagerService.getDrawingData(r, e), i = [], s = [];
1189
+ if (Object.keys(t).forEach((l) => {
1190
+ const d = t[l], { sheetTransform: m, transform: u, anchorType: f = b.Position } = d;
1191
+ if (f === b.None)
1192
+ this._remainDrawingSize(u, i, d);
1202
1193
  else {
1203
- const { from: g, to: _ } = h, { row: I, column: C } = g, { row: v, column: R } = _;
1204
- for (let w = 0; w < n.length; w++) {
1205
- const M = n[w], { startRow: p, endRow: T, startColumn: D, endColumn: E } = M;
1206
- if (R < D)
1194
+ const { from: h, to: p } = m, { row: S, column: I } = h, { row: v, column: C } = p;
1195
+ for (let _ = 0; _ < n.length; _++) {
1196
+ const M = n[_], { startRow: w, endRow: y, startColumn: D, endColumn: T } = M;
1197
+ if (C < D)
1207
1198
  continue;
1208
- if (f === O.Position) {
1209
- let S = null, j = null;
1210
- if (C >= D && C <= E) {
1211
- const X = this._selectionRenderService.attachRangeWithCoord({ startColumn: C, endColumn: E, startRow: g.row, endRow: _.row });
1212
- if (X == null)
1199
+ if (f === b.Position) {
1200
+ let R = null, A = null;
1201
+ if (I >= D && I <= T) {
1202
+ const z = this._selectionRenderService.attachRangeWithCoord({ startColumn: I, endColumn: T, startRow: h.row, endRow: p.row });
1203
+ if (z == null)
1213
1204
  return;
1214
- j = { ...m, left: X.startX };
1205
+ A = { ...u, left: z.startX };
1215
1206
  }
1216
- if (j != null && (S = A(j, this._selectionRenderService), S != null && j != null)) {
1217
- o.push({ ...l, sheetTransform: S, transform: j });
1207
+ if (A != null && (R = N(A, this._selectionRenderService), R != null && A != null)) {
1208
+ i.push({ ...d, sheetTransform: R, transform: A });
1218
1209
  break;
1219
1210
  }
1220
- this._remainDrawingSize(m, o, l);
1211
+ this._remainDrawingSize(u, i, d);
1221
1212
  continue;
1222
1213
  }
1223
- if (C >= D && R <= E)
1214
+ if (I >= D && C <= T)
1224
1215
  continue;
1225
- let U = null, y = null;
1226
- if (C >= D && C <= E) {
1227
- const S = this._selectionRenderService.attachRangeWithCoord({ startColumn: C, endColumn: E, startRow: g.row, endRow: _.row });
1228
- if (S == null)
1216
+ let U = null, E = null;
1217
+ if (I >= D && I <= T) {
1218
+ const R = this._selectionRenderService.attachRangeWithCoord({ startColumn: I, endColumn: T, startRow: h.row, endRow: p.row });
1219
+ if (R == null)
1229
1220
  return;
1230
- y = {
1231
- ...m,
1232
- left: (S == null ? void 0 : S.startX) || 0,
1233
- width: ((m == null ? void 0 : m.width) || 0) - S.endX + S.startX
1221
+ E = {
1222
+ ...u,
1223
+ left: (R == null ? void 0 : R.startX) || 0,
1224
+ width: ((u == null ? void 0 : u.width) || 0) - R.endX + R.startX
1234
1225
  };
1235
- } else if (R >= D && R <= E) {
1236
- const S = this._selectionRenderService.attachRangeWithCoord({ startColumn: D, endColumn: R, startRow: g.row, endRow: _.row });
1237
- if (S == null)
1226
+ } else if (C >= D && C <= T) {
1227
+ const R = this._selectionRenderService.attachRangeWithCoord({ startColumn: D, endColumn: C, startRow: h.row, endRow: p.row });
1228
+ if (R == null)
1238
1229
  return;
1239
- y = {
1240
- ...m,
1241
- left: S.startX - ((m == null ? void 0 : m.width) || 0)
1230
+ E = {
1231
+ ...u,
1232
+ left: R.startX - ((u == null ? void 0 : u.width) || 0)
1242
1233
  };
1243
1234
  } else {
1244
- const S = this._selectionRenderService.attachRangeWithCoord({ startColumn: D, endColumn: E, startRow: g.row, endRow: _.row });
1245
- if (S == null)
1235
+ const R = this._selectionRenderService.attachRangeWithCoord({ startColumn: D, endColumn: T, startRow: h.row, endRow: p.row });
1236
+ if (R == null)
1246
1237
  return;
1247
- if (y = {
1248
- ...m,
1249
- width: ((m == null ? void 0 : m.width) || 0) - S.endX + S.startX
1250
- }, U = A(y, this._selectionRenderService), U != null && y != null) {
1251
- i.push({ ...l, sheetTransform: U, transform: y });
1238
+ if (E = {
1239
+ ...u,
1240
+ width: ((u == null ? void 0 : u.width) || 0) - R.endX + R.startX
1241
+ }, U = N(E, this._selectionRenderService), U != null && E != null) {
1242
+ s.push({ ...d, sheetTransform: U, transform: E });
1252
1243
  break;
1253
1244
  }
1254
1245
  }
1255
- if (y != null && (U = A(y, this._selectionRenderService)), y != null && U != null) {
1256
- o.push({ ...l, sheetTransform: U, transform: y });
1246
+ if (E != null && (U = N(E, this._selectionRenderService)), E != null && U != null) {
1247
+ i.push({ ...d, sheetTransform: U, transform: E });
1257
1248
  break;
1258
1249
  } else
1259
- this._remainDrawingSize(m, o, l);
1250
+ this._remainDrawingSize(u, i, d);
1260
1251
  }
1261
1252
  }
1262
- }), o.length === 0 && i.length === 0)
1253
+ }), i.length === 0 && s.length === 0)
1263
1254
  return { redos: [], undos: [] };
1264
- const { redos: s, undos: a } = this._createUndoAndRedoMutation(r, e, o), c = [], u = [];
1265
- if (i.length > 0) {
1266
- const { redos: d, undos: l } = this._createUndoAndRedoMutation(r, e, i);
1267
- c.push(...d), u.push(...l);
1255
+ const { redos: o, undos: a } = this._createUndoAndRedoMutation(r, e, i), c = [], g = [];
1256
+ if (s.length > 0) {
1257
+ const { redos: l, undos: d } = this._createUndoAndRedoMutation(r, e, s);
1258
+ c.push(...l), g.push(...d);
1268
1259
  }
1269
1260
  return {
1270
- redos: s,
1261
+ redos: o,
1271
1262
  undos: a,
1272
1263
  preRedos: c,
1273
- preUndos: u
1264
+ preUndos: g
1274
1265
  };
1275
1266
  }
1276
1267
  _createUndoAndRedoMutation(r, e, n) {
1277
- const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo: o, redo: i, objects: s } = t, a = [
1278
- { id: b.id, params: { unitId: r, subUnitId: e, op: i, objects: s, type: P.UPDATE } },
1279
- { id: N.id, params: [r] }
1268
+ const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo: i, redo: s, objects: o } = t, a = [
1269
+ { id: O.id, params: { unitId: r, subUnitId: e, op: s, objects: o, type: P.UPDATE } },
1270
+ { id: j.id, params: [r] }
1280
1271
  ], c = [
1281
- { id: b.id, params: { unitId: r, subUnitId: e, op: o, objects: s, type: P.UPDATE } },
1282
- { id: N.id, params: [r] }
1272
+ { id: O.id, params: { unitId: r, subUnitId: e, op: i, objects: o, type: P.UPDATE } },
1273
+ { id: j.id, params: [r] }
1283
1274
  ];
1284
1275
  return {
1285
1276
  redos: a,
@@ -1288,122 +1279,122 @@ let De = class extends ge {
1288
1279
  }
1289
1280
  // eslint-disable-next-line max-lines-per-function
1290
1281
  _getDrawingUndoForRowVisible(r, e, n) {
1291
- const t = this._drawingManagerService.getDrawingData(r, e), o = [], i = [];
1292
- if (Object.keys(t).forEach((d) => {
1293
- const l = t[d], { sheetTransform: h, transform: m, anchorType: f = O.Position } = l;
1294
- if (f === O.None)
1295
- this._remainDrawingSize(m, o, l);
1282
+ const t = this._drawingManagerService.getDrawingData(r, e), i = [], s = [];
1283
+ if (Object.keys(t).forEach((l) => {
1284
+ const d = t[l], { sheetTransform: m, transform: u, anchorType: f = b.Position } = d;
1285
+ if (f === b.None)
1286
+ this._remainDrawingSize(u, i, d);
1296
1287
  else {
1297
- const { from: g, to: _ } = h, { row: I, column: C } = g, { row: v, column: R } = _;
1298
- for (let w = 0; w < n.length; w++) {
1299
- const M = n[w], { startRow: p, endRow: T, startColumn: D, endColumn: E } = M;
1300
- if (v < p)
1288
+ const { from: h, to: p } = m, { row: S, column: I } = h, { row: v, column: C } = p;
1289
+ for (let _ = 0; _ < n.length; _++) {
1290
+ const M = n[_], { startRow: w, endRow: y, startColumn: D, endColumn: T } = M;
1291
+ if (v < w)
1301
1292
  continue;
1302
- if (f === O.Position) {
1303
- let S = null, j = null;
1304
- if (I >= p && I <= T) {
1305
- const X = this._selectionRenderService.attachRangeWithCoord({ startColumn: g.column, endColumn: _.column, startRow: I, endRow: T });
1306
- if (X == null)
1293
+ if (f === b.Position) {
1294
+ let R = null, A = null;
1295
+ if (S >= w && S <= y) {
1296
+ const z = this._selectionRenderService.attachRangeWithCoord({ startColumn: h.column, endColumn: p.column, startRow: S, endRow: y });
1297
+ if (z == null)
1307
1298
  return;
1308
- j = { ...m, top: X.startY };
1299
+ A = { ...u, top: z.startY };
1309
1300
  }
1310
- if (j != null && (S = A(j, this._selectionRenderService), S != null && j != null)) {
1311
- o.push({ ...l, sheetTransform: S, transform: j });
1301
+ if (A != null && (R = N(A, this._selectionRenderService), R != null && A != null)) {
1302
+ i.push({ ...d, sheetTransform: R, transform: A });
1312
1303
  break;
1313
1304
  }
1314
- this._remainDrawingSize(m, o, l);
1305
+ this._remainDrawingSize(u, i, d);
1315
1306
  continue;
1316
1307
  }
1317
- if (I >= p && v <= T)
1308
+ if (S >= w && v <= y)
1318
1309
  continue;
1319
- let U = null, y = null;
1320
- if (I >= p && I <= T) {
1321
- const S = this._selectionRenderService.attachRangeWithCoord({ startColumn: g.column, endColumn: _.column, startRow: I, endRow: T });
1322
- if (S == null)
1310
+ let U = null, E = null;
1311
+ if (S >= w && S <= y) {
1312
+ const R = this._selectionRenderService.attachRangeWithCoord({ startColumn: h.column, endColumn: p.column, startRow: S, endRow: y });
1313
+ if (R == null)
1323
1314
  return;
1324
- y = {
1325
- ...m,
1326
- top: (S == null ? void 0 : S.startY) || 0,
1327
- height: ((m == null ? void 0 : m.height) || 0) - S.endY + S.startY
1315
+ E = {
1316
+ ...u,
1317
+ top: (R == null ? void 0 : R.startY) || 0,
1318
+ height: ((u == null ? void 0 : u.height) || 0) - R.endY + R.startY
1328
1319
  };
1329
- } else if (v >= p && v <= T) {
1330
- const S = this._selectionRenderService.attachRangeWithCoord({ startColumn: g.column, endColumn: _.column, startRow: p, endRow: v });
1331
- if (S == null)
1320
+ } else if (v >= w && v <= y) {
1321
+ const R = this._selectionRenderService.attachRangeWithCoord({ startColumn: h.column, endColumn: p.column, startRow: w, endRow: v });
1322
+ if (R == null)
1332
1323
  return;
1333
- y = {
1334
- ...m,
1335
- top: S.startY - ((m == null ? void 0 : m.height) || 0)
1324
+ E = {
1325
+ ...u,
1326
+ top: R.startY - ((u == null ? void 0 : u.height) || 0)
1336
1327
  };
1337
1328
  } else {
1338
- const S = this._selectionRenderService.attachRangeWithCoord({ startColumn: g.column, endColumn: _.column, startRow: p, endRow: T });
1339
- if (S == null)
1329
+ const R = this._selectionRenderService.attachRangeWithCoord({ startColumn: h.column, endColumn: p.column, startRow: w, endRow: y });
1330
+ if (R == null)
1340
1331
  return;
1341
- if (y = {
1342
- ...m,
1343
- height: ((m == null ? void 0 : m.height) || 0) - S.endY + S.startY
1344
- }, U = A(y, this._selectionRenderService), U != null && y != null) {
1345
- i.push({ ...l, sheetTransform: U, transform: y });
1332
+ if (E = {
1333
+ ...u,
1334
+ height: ((u == null ? void 0 : u.height) || 0) - R.endY + R.startY
1335
+ }, U = N(E, this._selectionRenderService), U != null && E != null) {
1336
+ s.push({ ...d, sheetTransform: U, transform: E });
1346
1337
  break;
1347
1338
  }
1348
1339
  }
1349
- if (y != null && (U = A(y, this._selectionRenderService)), y != null && U != null) {
1350
- o.push({ ...l, sheetTransform: U, transform: y });
1340
+ if (E != null && (U = N(E, this._selectionRenderService)), E != null && U != null) {
1341
+ i.push({ ...d, sheetTransform: U, transform: E });
1351
1342
  break;
1352
1343
  } else
1353
- this._remainDrawingSize(m, o, l);
1344
+ this._remainDrawingSize(u, i, d);
1354
1345
  }
1355
1346
  }
1356
- }), o.length === 0 && i.length === 0)
1347
+ }), i.length === 0 && s.length === 0)
1357
1348
  return { redos: [], undos: [] };
1358
- const { redos: s, undos: a } = this._createUndoAndRedoMutation(r, e, o), c = [], u = [];
1359
- if (i.length > 0) {
1360
- const { redos: d, undos: l } = this._createUndoAndRedoMutation(r, e, i);
1361
- c.push(...d), u.push(...l);
1349
+ const { redos: o, undos: a } = this._createUndoAndRedoMutation(r, e, i), c = [], g = [];
1350
+ if (s.length > 0) {
1351
+ const { redos: l, undos: d } = this._createUndoAndRedoMutation(r, e, s);
1352
+ c.push(...l), g.push(...d);
1362
1353
  }
1363
1354
  return {
1364
- redos: s,
1355
+ redos: o,
1365
1356
  undos: a,
1366
1357
  preRedos: c,
1367
- preUndos: u
1358
+ preUndos: g
1368
1359
  };
1369
1360
  }
1370
1361
  _getDrawingUndoForRowAndColSize(r, e, n, t) {
1371
- const o = this._drawingManagerService.getDrawingData(r, e), i = [];
1372
- return Object.keys(o).forEach((s) => {
1373
- const a = o[s], { sheetTransform: c, transform: u, anchorType: d = O.Position } = a;
1374
- if (d === O.None)
1375
- this._remainDrawingSize(u, i, a);
1362
+ const i = this._drawingManagerService.getDrawingData(r, e), s = [];
1363
+ return Object.keys(i).forEach((o) => {
1364
+ const a = i[o], { sheetTransform: c, transform: g, anchorType: l = b.Position } = a;
1365
+ if (l === b.None)
1366
+ this._remainDrawingSize(g, s, a);
1376
1367
  else {
1377
- const { from: l, to: h } = c, { row: m, column: f } = l, { row: g, column: _ } = h;
1378
- for (let I = 0; I < n.length; I++) {
1379
- const C = n[I], { startRow: v, endRow: R, startColumn: w, endColumn: M } = C;
1380
- if (g < v || _ < w)
1368
+ const { from: d, to: m } = c, { row: u, column: f } = d, { row: h, column: p } = m;
1369
+ for (let S = 0; S < n.length; S++) {
1370
+ const I = n[S], { startRow: v, endRow: C, startColumn: _, endColumn: M } = I;
1371
+ if (h < v || p < _)
1381
1372
  continue;
1382
- if (d === O.Position && (m <= v && g >= R || f <= w && _ >= M)) {
1383
- this._remainDrawingSize(u, i, a);
1373
+ if (l === b.Position && (u <= v && h >= C || f <= _ && p >= M)) {
1374
+ this._remainDrawingSize(g, s, a);
1384
1375
  continue;
1385
1376
  }
1386
- const p = x({ ...c }, this._selectionRenderService);
1387
- if (p != null) {
1388
- i.push({
1377
+ const w = V({ ...c }, this._selectionRenderService);
1378
+ if (w != null) {
1379
+ s.push({
1389
1380
  ...a,
1390
- transform: p
1381
+ transform: w
1391
1382
  });
1392
1383
  break;
1393
1384
  }
1394
1385
  }
1395
1386
  }
1396
- }), i.length === 0 ? { redos: [], undos: [] } : this._createUndoAndRedoMutation(r, e, i);
1387
+ }), s.length === 0 ? { redos: [], undos: [] } : this._createUndoAndRedoMutation(r, e, s);
1397
1388
  }
1398
1389
  _getUnitIdAndSubUnitId(r, e) {
1399
1390
  let n, t;
1400
1391
  if (e === "insert")
1401
1392
  n = r.unitId, t = r.subUnitId;
1402
1393
  else {
1403
- const o = re(this._univerInstanceService);
1404
- if (o == null)
1394
+ const i = se(this._univerInstanceService);
1395
+ if (i == null)
1405
1396
  return;
1406
- n = o.unitId, t = o.subUnitId;
1397
+ n = i.unitId, t = i.subUnitId;
1407
1398
  }
1408
1399
  return { unitId: n, subUnitId: t };
1409
1400
  }
@@ -1411,265 +1402,265 @@ let De = class extends ge {
1411
1402
  const n = this._getUnitIdAndSubUnitId(r, e);
1412
1403
  if (n == null)
1413
1404
  return { redos: [], undos: [] };
1414
- const { unitId: t, subUnitId: o } = n, { range: i } = r, s = i.startRow, a = i.endRow, c = [], u = [], d = this._sheetDrawingService.getDrawingData(t, o), l = [], h = [];
1415
- if (Object.keys(d).forEach((m) => {
1416
- const f = d[m], { sheetTransform: g, transform: _, anchorType: I = O.Position } = f;
1417
- if (g == null || _ == null)
1405
+ const { unitId: t, subUnitId: i } = n, { range: s } = r, o = s.startRow, a = s.endRow, c = [], g = [], l = this._sheetDrawingService.getDrawingData(t, i), d = [], m = [];
1406
+ if (Object.keys(l).forEach((u) => {
1407
+ const f = l[u], { sheetTransform: h, transform: p, anchorType: S = b.Position } = f;
1408
+ if (h == null || p == null)
1418
1409
  return;
1419
- let C, v;
1410
+ let I, v;
1420
1411
  if (e === "insert") {
1421
- const w = this._expandRow(g, _, s, a, I);
1422
- C = w == null ? void 0 : w.newSheetTransform, v = w == null ? void 0 : w.newTransform;
1412
+ const _ = this._expandRow(h, p, o, a, S);
1413
+ I = _ == null ? void 0 : _.newSheetTransform, v = _ == null ? void 0 : _.newTransform;
1423
1414
  } else {
1424
- const { from: w, to: M } = g, { row: p } = w, { row: T } = M;
1425
- if (p >= s && T <= a)
1426
- h.push({ unitId: t, subUnitId: o, drawingId: m });
1415
+ const { from: _, to: M } = h, { row: w } = _, { row: y } = M;
1416
+ if (w >= o && y <= a)
1417
+ m.push({ unitId: t, subUnitId: i, drawingId: u });
1427
1418
  else {
1428
- const D = this._shrinkRow(g, _, s, a, I);
1429
- C = D == null ? void 0 : D.newSheetTransform, v = D == null ? void 0 : D.newTransform;
1419
+ const D = this._shrinkRow(h, p, o, a, S);
1420
+ I = D == null ? void 0 : D.newSheetTransform, v = D == null ? void 0 : D.newTransform;
1430
1421
  }
1431
1422
  }
1432
- if (!C || !v)
1423
+ if (!I || !v)
1433
1424
  return;
1434
- const R = { unitId: t, subUnitId: o, drawingId: m, transform: v, sheetTransform: C };
1435
- l.push(R);
1436
- }), l.length === 0 && h.length === 0)
1425
+ const C = { unitId: t, subUnitId: i, drawingId: u, transform: v, sheetTransform: I };
1426
+ d.push(C);
1427
+ }), d.length === 0 && m.length === 0)
1437
1428
  return { redos: [], undos: [] };
1438
- if (l.length > 0) {
1439
- const m = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: g, objects: _ } = m;
1440
- c.push({ id: b.id, params: { unitId: t, subUnitId: o, op: g, objects: _, type: P.UPDATE } }), u.push({ id: b.id, params: { unitId: t, subUnitId: o, op: f, objects: _, type: P.UPDATE } });
1429
+ if (d.length > 0) {
1430
+ const u = this._sheetDrawingService.getBatchUpdateOp(d), { undo: f, redo: h, objects: p } = u;
1431
+ c.push({ id: O.id, params: { unitId: t, subUnitId: i, op: h, objects: p, type: P.UPDATE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: i, op: f, objects: p, type: P.UPDATE } });
1441
1432
  }
1442
- if (h.length > 0) {
1443
- const m = this._sheetDrawingService.getBatchRemoveOp(h), f = m.undo, g = m.redo, _ = m.objects;
1444
- c.push({ id: b.id, params: { unitId: t, subUnitId: o, op: g, objects: _, type: P.REMOVE } }), u.push({ id: b.id, params: { unitId: t, subUnitId: o, op: f, objects: _, type: P.INSERT } });
1433
+ if (m.length > 0) {
1434
+ const u = this._sheetDrawingService.getBatchRemoveOp(m), f = u.undo, h = u.redo, p = u.objects;
1435
+ c.push({ id: O.id, params: { unitId: t, subUnitId: i, op: h, objects: p, type: P.REMOVE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: i, op: f, objects: p, type: P.INSERT } });
1445
1436
  }
1446
- return c.push({ id: N.id, params: [t] }), u.push({ id: N.id, params: [t] }), {
1437
+ return c.push({ id: j.id, params: [t] }), g.push({ id: j.id, params: [t] }), {
1447
1438
  redos: c,
1448
- undos: u
1439
+ undos: g
1449
1440
  };
1450
1441
  }
1451
1442
  _moveColInterceptor(r, e) {
1452
1443
  const n = this._getUnitIdAndSubUnitId(r, e);
1453
1444
  if (n == null)
1454
1445
  return { redos: [], undos: [] };
1455
- const { unitId: t, subUnitId: o } = n, { range: i } = r, s = i.startColumn, a = i.endColumn, c = [], u = [], d = this._sheetDrawingService.getDrawingData(t, o), l = [], h = [];
1456
- if (Object.keys(d).forEach((m) => {
1457
- const f = d[m], { sheetTransform: g, transform: _, anchorType: I = O.Position } = f;
1458
- if (g == null || _ == null)
1446
+ const { unitId: t, subUnitId: i } = n, { range: s } = r, o = s.startColumn, a = s.endColumn, c = [], g = [], l = this._sheetDrawingService.getDrawingData(t, i), d = [], m = [];
1447
+ if (Object.keys(l).forEach((u) => {
1448
+ const f = l[u], { sheetTransform: h, transform: p, anchorType: S = b.Position } = f;
1449
+ if (h == null || p == null)
1459
1450
  return;
1460
- let C, v;
1451
+ let I, v;
1461
1452
  if (e === "insert") {
1462
- const w = this._expandCol(g, _, s, a, I);
1463
- C = w == null ? void 0 : w.newSheetTransform, v = w == null ? void 0 : w.newTransform;
1453
+ const _ = this._expandCol(h, p, o, a, S);
1454
+ I = _ == null ? void 0 : _.newSheetTransform, v = _ == null ? void 0 : _.newTransform;
1464
1455
  } else {
1465
- const { from: w, to: M } = g, { column: p } = w, { column: T } = M;
1466
- if (p >= s && T <= a)
1467
- h.push({ unitId: t, subUnitId: o, drawingId: m });
1456
+ const { from: _, to: M } = h, { column: w } = _, { column: y } = M;
1457
+ if (w >= o && y <= a)
1458
+ m.push({ unitId: t, subUnitId: i, drawingId: u });
1468
1459
  else {
1469
- const D = this._shrinkCol(g, _, s, a, I);
1470
- C = D == null ? void 0 : D.newSheetTransform, v = D == null ? void 0 : D.newTransform;
1460
+ const D = this._shrinkCol(h, p, o, a, S);
1461
+ I = D == null ? void 0 : D.newSheetTransform, v = D == null ? void 0 : D.newTransform;
1471
1462
  }
1472
1463
  }
1473
- if (!C || !v)
1464
+ if (!I || !v)
1474
1465
  return;
1475
- const R = { unitId: t, subUnitId: o, drawingId: m, transform: v, sheetTransform: C };
1476
- l.push(R);
1477
- }), l.length === 0 && h.length === 0)
1466
+ const C = { unitId: t, subUnitId: i, drawingId: u, transform: v, sheetTransform: I };
1467
+ d.push(C);
1468
+ }), d.length === 0 && m.length === 0)
1478
1469
  return { redos: [], undos: [] };
1479
- if (l.length > 0) {
1480
- const m = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: g, objects: _ } = m;
1481
- c.push({ id: b.id, params: { unitId: t, subUnitId: o, op: g, objects: _, type: P.UPDATE } }), u.push({ id: b.id, params: { unitId: t, subUnitId: o, op: f, objects: _, type: P.UPDATE } });
1470
+ if (d.length > 0) {
1471
+ const u = this._sheetDrawingService.getBatchUpdateOp(d), { undo: f, redo: h, objects: p } = u;
1472
+ c.push({ id: O.id, params: { unitId: t, subUnitId: i, op: h, objects: p, type: P.UPDATE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: i, op: f, objects: p, type: P.UPDATE } });
1482
1473
  }
1483
- if (h.length > 0) {
1484
- const m = this._sheetDrawingService.getBatchRemoveOp(h), f = m.undo, g = m.redo, _ = m.objects;
1485
- c.push({ id: b.id, params: { unitId: t, subUnitId: o, op: g, objects: _, type: P.REMOVE } }), u.push({ id: b.id, params: { unitId: t, subUnitId: o, op: f, objects: _, type: P.INSERT } });
1474
+ if (m.length > 0) {
1475
+ const u = this._sheetDrawingService.getBatchRemoveOp(m), f = u.undo, h = u.redo, p = u.objects;
1476
+ c.push({ id: O.id, params: { unitId: t, subUnitId: i, op: h, objects: p, type: P.REMOVE } }), g.push({ id: O.id, params: { unitId: t, subUnitId: i, op: f, objects: p, type: P.INSERT } });
1486
1477
  }
1487
- return c.push({ id: N.id, params: [t] }), u.push({ id: N.id, params: [t] }), { redos: c, undos: u };
1478
+ return c.push({ id: j.id, params: [t] }), g.push({ id: j.id, params: [t] }), { redos: c, undos: g };
1488
1479
  }
1489
- _expandCol(r, e, n, t, o = O.Position) {
1490
- const i = t - n + 1, { from: s, to: a } = r, { column: c } = s, { column: u } = a;
1491
- if (o === O.None)
1480
+ _expandCol(r, e, n, t, i = b.Position) {
1481
+ const s = t - n + 1, { from: o, to: a } = r, { column: c } = o, { column: g } = a;
1482
+ if (i === b.None)
1492
1483
  return {
1493
- newSheetTransform: A({ ...e }, this._selectionRenderService),
1484
+ newSheetTransform: N({ ...e }, this._selectionRenderService),
1494
1485
  newTransform: e
1495
1486
  };
1496
- let d = null, l = null;
1487
+ let l = null, d = null;
1497
1488
  if (c >= n) {
1498
- const h = this._selectionRenderService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: s.row, endRow: a.row });
1499
- if (h == null)
1489
+ const m = this._selectionRenderService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: a.row });
1490
+ if (m == null)
1500
1491
  return;
1501
- l = { ...e, left: (e.left || 0) + h.endX - h.startX }, d = A(l, this._selectionRenderService);
1502
- } else if (u >= t)
1503
- if (o === O.Both)
1504
- d = {
1505
- from: { ...s },
1506
- to: { ...a, column: u + i }
1507
- }, l = x(d, this._selectionRenderService);
1492
+ d = { ...e, left: (e.left || 0) + m.endX - m.startX }, l = N(d, this._selectionRenderService);
1493
+ } else if (g >= t)
1494
+ if (i === b.Both)
1495
+ l = {
1496
+ from: { ...o },
1497
+ to: { ...a, column: g + s }
1498
+ }, d = V(l, this._selectionRenderService);
1508
1499
  else
1509
1500
  return {
1510
- newSheetTransform: A({ ...e }, this._selectionRenderService),
1501
+ newSheetTransform: N({ ...e }, this._selectionRenderService),
1511
1502
  newTransform: e
1512
1503
  };
1513
- return d != null && l != null ? {
1514
- newSheetTransform: d,
1515
- newTransform: l
1504
+ return l != null && d != null ? {
1505
+ newSheetTransform: l,
1506
+ newTransform: d
1516
1507
  } : null;
1517
1508
  }
1518
- _shrinkCol(r, e, n, t, o = O.Position) {
1519
- const i = t - n + 1, { from: s, to: a } = r, { column: c } = s, { column: u } = a;
1520
- if (o === O.None)
1509
+ _shrinkCol(r, e, n, t, i = b.Position) {
1510
+ const s = t - n + 1, { from: o, to: a } = r, { column: c } = o, { column: g } = a;
1511
+ if (i === b.None)
1521
1512
  return {
1522
- newSheetTransform: A({ ...e }, this._selectionRenderService),
1513
+ newSheetTransform: N({ ...e }, this._selectionRenderService),
1523
1514
  newTransform: e
1524
1515
  };
1525
- let d = null, l = null;
1516
+ let l = null, d = null;
1526
1517
  if (c > t)
1527
- d = {
1528
- from: { ...s, column: c - i },
1529
- to: { ...a, column: u - i }
1530
- }, l = x(d, this._selectionRenderService);
1518
+ l = {
1519
+ from: { ...o, column: c - s },
1520
+ to: { ...a, column: g - s }
1521
+ }, d = V(l, this._selectionRenderService);
1531
1522
  else {
1532
- if (c >= n && u <= t)
1523
+ if (c >= n && g <= t)
1533
1524
  return null;
1534
- if (c < n && u > t)
1535
- if (o === O.Both)
1536
- d = {
1537
- from: { ...s },
1538
- to: { ...a, column: u - i }
1539
- }, l = x(d, this._selectionRenderService);
1525
+ if (c < n && g > t)
1526
+ if (i === b.Both)
1527
+ l = {
1528
+ from: { ...o },
1529
+ to: { ...a, column: g - s }
1530
+ }, d = V(l, this._selectionRenderService);
1540
1531
  else
1541
1532
  return {
1542
- newSheetTransform: A({ ...e }, this._selectionRenderService),
1533
+ newSheetTransform: N({ ...e }, this._selectionRenderService),
1543
1534
  newTransform: e
1544
1535
  };
1545
1536
  else if (c >= n && c <= t) {
1546
1537
  if (c === n)
1547
- l = { ...e, left: (e.left || 0) - r.from.columnOffset };
1538
+ d = { ...e, left: (e.left || 0) - r.from.columnOffset };
1548
1539
  else {
1549
- const h = this._selectionRenderService.attachRangeWithCoord({ startColumn: n, endColumn: c - 1, startRow: s.row, endRow: a.row });
1550
- if (h == null)
1540
+ const m = this._selectionRenderService.attachRangeWithCoord({ startColumn: n, endColumn: c - 1, startRow: o.row, endRow: a.row });
1541
+ if (m == null)
1551
1542
  return;
1552
- l = { ...e, left: (e.left || 0) - h.endX + h.startX - r.from.columnOffset };
1543
+ d = { ...e, left: (e.left || 0) - m.endX + m.startX - r.from.columnOffset };
1553
1544
  }
1554
- d = A(l, this._selectionRenderService);
1555
- } else if (u >= n && u <= t && o === O.Both) {
1556
- const h = this._selectionRenderService.attachRangeWithCoord({
1545
+ l = N(d, this._selectionRenderService);
1546
+ } else if (g >= n && g <= t && i === b.Both) {
1547
+ const m = this._selectionRenderService.attachRangeWithCoord({
1557
1548
  startColumn: n - 1,
1558
1549
  endColumn: n - 1,
1559
- startRow: s.row,
1550
+ startRow: o.row,
1560
1551
  endRow: a.row
1561
1552
  });
1562
- if (h == null)
1553
+ if (m == null)
1563
1554
  return;
1564
- d = {
1565
- from: { ...s },
1566
- to: { ...a, column: n - 1, columnOffset: h.endX - h.startX }
1567
- }, l = x(d, this._selectionRenderService);
1555
+ l = {
1556
+ from: { ...o },
1557
+ to: { ...a, column: n - 1, columnOffset: m.endX - m.startX }
1558
+ }, d = V(l, this._selectionRenderService);
1568
1559
  }
1569
1560
  }
1570
- return d != null && l != null ? {
1571
- newSheetTransform: d,
1572
- newTransform: l
1561
+ return l != null && d != null ? {
1562
+ newSheetTransform: l,
1563
+ newTransform: d
1573
1564
  } : null;
1574
1565
  }
1575
- _expandRow(r, e, n, t, o = O.Position) {
1576
- const i = t - n + 1, { from: s, to: a } = r, { row: c } = s, { row: u } = a;
1577
- if (o === O.None)
1566
+ _expandRow(r, e, n, t, i = b.Position) {
1567
+ const s = t - n + 1, { from: o, to: a } = r, { row: c } = o, { row: g } = a;
1568
+ if (i === b.None)
1578
1569
  return {
1579
- newSheetTransform: A({ ...e }, this._selectionRenderService),
1570
+ newSheetTransform: N({ ...e }, this._selectionRenderService),
1580
1571
  newTransform: e
1581
1572
  };
1582
- let d = null, l = null;
1573
+ let l = null, d = null;
1583
1574
  if (c >= n) {
1584
- const h = this._selectionRenderService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: s.column, endColumn: a.column });
1585
- if (h == null)
1575
+ const m = this._selectionRenderService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: o.column, endColumn: a.column });
1576
+ if (m == null)
1586
1577
  return;
1587
- l = { ...e, top: (e.top || 0) + h.endY - h.startY }, d = A(l, this._selectionRenderService);
1588
- } else if (u >= t)
1589
- if (o === O.Both)
1590
- d = {
1591
- from: { ...s },
1578
+ d = { ...e, top: (e.top || 0) + m.endY - m.startY }, l = N(d, this._selectionRenderService);
1579
+ } else if (g >= t)
1580
+ if (i === b.Both)
1581
+ l = {
1582
+ from: { ...o },
1592
1583
  to: {
1593
1584
  ...a,
1594
- row: u + i
1585
+ row: g + s
1595
1586
  }
1596
- }, l = x(d, this._selectionRenderService);
1587
+ }, d = V(l, this._selectionRenderService);
1597
1588
  else
1598
1589
  return {
1599
- newSheetTransform: A({ ...e }, this._selectionRenderService),
1590
+ newSheetTransform: N({ ...e }, this._selectionRenderService),
1600
1591
  newTransform: e
1601
1592
  };
1602
- return d != null && l != null ? {
1603
- newSheetTransform: d,
1604
- newTransform: l
1593
+ return l != null && d != null ? {
1594
+ newSheetTransform: l,
1595
+ newTransform: d
1605
1596
  } : null;
1606
1597
  }
1607
- _shrinkRow(r, e, n, t, o = O.Position) {
1608
- const i = t - n + 1, { from: s, to: a } = r, { row: c } = s, { row: u } = a;
1609
- if (o === O.None)
1598
+ _shrinkRow(r, e, n, t, i = b.Position) {
1599
+ const s = t - n + 1, { from: o, to: a } = r, { row: c } = o, { row: g } = a;
1600
+ if (i === b.None)
1610
1601
  return {
1611
- newSheetTransform: A({ ...e }, this._selectionRenderService),
1602
+ newSheetTransform: N({ ...e }, this._selectionRenderService),
1612
1603
  newTransform: e
1613
1604
  };
1614
- let d = null, l = null;
1605
+ let l = null, d = null;
1615
1606
  if (c > t)
1616
- d = {
1617
- from: { ...s, row: c - i },
1618
- to: { ...a, row: u - i }
1619
- }, l = x(d, this._selectionRenderService);
1607
+ l = {
1608
+ from: { ...o, row: c - s },
1609
+ to: { ...a, row: g - s }
1610
+ }, d = V(l, this._selectionRenderService);
1620
1611
  else {
1621
- if (c >= n && u <= t)
1612
+ if (c >= n && g <= t)
1622
1613
  return null;
1623
- if (c < n && u > t)
1624
- if (o === O.Both)
1625
- d = {
1626
- from: { ...s },
1627
- to: { ...a, row: u - i }
1628
- }, l = x(d, this._selectionRenderService);
1614
+ if (c < n && g > t)
1615
+ if (i === b.Both)
1616
+ l = {
1617
+ from: { ...o },
1618
+ to: { ...a, row: g - s }
1619
+ }, d = V(l, this._selectionRenderService);
1629
1620
  else
1630
1621
  return {
1631
- newSheetTransform: A({ ...e }, this._selectionRenderService),
1622
+ newSheetTransform: N({ ...e }, this._selectionRenderService),
1632
1623
  newTransform: e
1633
1624
  };
1634
1625
  else if (c >= n && c <= t) {
1635
1626
  if (c === n)
1636
- l = { ...e, top: (e.top || 0) - r.from.rowOffset };
1627
+ d = { ...e, top: (e.top || 0) - r.from.rowOffset };
1637
1628
  else {
1638
- const h = this._selectionRenderService.attachRangeWithCoord({ startRow: n, endRow: c - 1, startColumn: s.column, endColumn: a.column });
1639
- if (h == null)
1629
+ const m = this._selectionRenderService.attachRangeWithCoord({ startRow: n, endRow: c - 1, startColumn: o.column, endColumn: a.column });
1630
+ if (m == null)
1640
1631
  return;
1641
- l = { ...e, top: (e.top || 0) - h.endY + h.startY - r.from.rowOffset };
1632
+ d = { ...e, top: (e.top || 0) - m.endY + m.startY - r.from.rowOffset };
1642
1633
  }
1643
- d = A(l, this._selectionRenderService);
1644
- } else if (u >= n && u <= t && o === O.Both) {
1645
- const h = this._selectionRenderService.attachRangeWithCoord({ startColumn: s.column, endColumn: s.column, startRow: n - 1, endRow: n - 1 });
1646
- if (h == null)
1634
+ l = N(d, this._selectionRenderService);
1635
+ } else if (g >= n && g <= t && i === b.Both) {
1636
+ const m = this._selectionRenderService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: n - 1, endRow: n - 1 });
1637
+ if (m == null)
1647
1638
  return;
1648
- d = {
1649
- from: { ...s },
1650
- to: { ...a, row: n - 1, rowOffset: h.endY - h.startY }
1651
- }, l = x(d, this._selectionRenderService);
1639
+ l = {
1640
+ from: { ...o },
1641
+ to: { ...a, row: n - 1, rowOffset: m.endY - m.startY }
1642
+ }, d = V(l, this._selectionRenderService);
1652
1643
  }
1653
1644
  }
1654
- return d != null && l != null ? {
1655
- newSheetTransform: d,
1656
- newTransform: l
1645
+ return l != null && d != null ? {
1646
+ newSheetTransform: l,
1647
+ newTransform: d
1657
1648
  } : null;
1658
1649
  }
1659
1650
  _commandListener() {
1660
1651
  this.disposeWithMe(
1661
1652
  this._commandService.onCommandExecuted((r) => {
1662
- if (r.id === Bn.id) {
1663
- const e = r.params, { unitId: n, subUnitId: t } = e, o = this._drawingManagerService.drawingManagerData, i = [], s = [];
1664
- Object.keys(o).forEach((a) => {
1665
- const c = o[a];
1666
- Object.keys(c).forEach((u) => {
1667
- const d = c[u].data;
1668
- d != null && Object.keys(d).forEach((l) => {
1669
- a === n && u === t ? i.push(d[l]) : s.push(d[l]);
1653
+ if (r.id === Zn.id) {
1654
+ const e = r.params, { unitId: n, subUnitId: t } = e, i = this._drawingManagerService.drawingManagerData, s = [], o = [];
1655
+ Object.keys(i).forEach((a) => {
1656
+ const c = i[a];
1657
+ Object.keys(c).forEach((g) => {
1658
+ const l = c[g].data;
1659
+ l != null && Object.keys(l).forEach((d) => {
1660
+ a === n && g === t ? s.push(l[d]) : o.push(l[d]);
1670
1661
  });
1671
1662
  });
1672
- }), this._drawingManagerService.removeNotification(s), this._drawingManagerService.addNotification(i);
1663
+ }), this._drawingManagerService.removeNotification(o), this._drawingManagerService.addNotification(s);
1673
1664
  }
1674
1665
  })
1675
1666
  );
@@ -1677,128 +1668,128 @@ let De = class extends ge {
1677
1668
  _sheetRefreshListener() {
1678
1669
  this.disposeWithMe(
1679
1670
  this._commandService.onCommandExecuted((r) => {
1680
- $r.includes(r.id) && requestIdleCallback(() => {
1681
- const e = r.params, { unitId: n, subUnitId: t, ranges: o } = e;
1682
- this._refreshDrawingTransform(n, t, o);
1671
+ ei.includes(r.id) && requestIdleCallback(() => {
1672
+ const e = r.params, { unitId: n, subUnitId: t, ranges: i } = e;
1673
+ this._refreshDrawingTransform(n, t, i);
1683
1674
  });
1684
1675
  })
1685
1676
  );
1686
1677
  }
1687
1678
  _refreshDrawingTransform(r, e, n) {
1688
- const t = this._drawingManagerService.getDrawingData(r, e), o = [];
1689
- Object.keys(t).forEach((i) => {
1690
- const s = t[i], { sheetTransform: a, anchorType: c = O.Position } = s;
1691
- if (c === O.None)
1679
+ const t = this._drawingManagerService.getDrawingData(r, e), i = [];
1680
+ Object.keys(t).forEach((s) => {
1681
+ const o = t[s], { sheetTransform: a, anchorType: c = b.Position } = o;
1682
+ if (c === b.None)
1692
1683
  return !0;
1693
- const { from: u, to: d } = a, { row: l, column: h } = u, { row: m, column: f } = d;
1694
- for (let g = 0; g < n.length; g++) {
1695
- const _ = n[g], { startRow: I, endRow: C, startColumn: v, endColumn: R } = _;
1696
- if (Ft.intersects(
1684
+ const { from: g, to: l } = a, { row: d, column: m } = g, { row: u, column: f } = l;
1685
+ for (let h = 0; h < n.length; h++) {
1686
+ const p = n[h], { startRow: S, endRow: I, startColumn: v, endColumn: C } = p;
1687
+ if (tn.intersects(
1697
1688
  {
1698
- startRow: I,
1699
- endRow: C,
1689
+ startRow: S,
1690
+ endRow: I,
1700
1691
  startColumn: v,
1701
- endColumn: R
1692
+ endColumn: C
1702
1693
  },
1703
1694
  {
1704
- startRow: l,
1705
- endRow: m,
1706
- startColumn: h,
1695
+ startRow: d,
1696
+ endRow: u,
1697
+ startColumn: m,
1707
1698
  endColumn: f
1708
1699
  }
1709
- ) || l > C || h > R) {
1710
- o.push({
1711
- ...s,
1712
- transform: x(a, this._selectionRenderService)
1700
+ ) || d > I || m > C) {
1701
+ i.push({
1702
+ ...o,
1703
+ transform: V(a, this._selectionRenderService)
1713
1704
  });
1714
1705
  break;
1715
1706
  }
1716
1707
  }
1717
- }), o.length !== 0 && (this._drawingManagerService.refreshTransform(o), this._commandService.syncExecuteCommand(N.id, [r]));
1708
+ }), i.length !== 0 && (this._drawingManagerService.refreshTransform(i), this._commandService.syncExecuteCommand(j.id, [r]));
1718
1709
  }
1719
1710
  };
1720
- De = Gr([
1721
- me(he.Rendered, De),
1722
- te(0, B),
1723
- te(1, W(Gn)),
1724
- te(2, Y),
1725
- te(3, k),
1726
- te(4, Te),
1727
- te(5, ue)
1728
- ], De);
1729
- var Fr = Object.defineProperty, Vr = Object.getOwnPropertyDescriptor, Yr = (r, e, n, t) => {
1730
- for (var o = t > 1 ? void 0 : t ? Vr(e, n) : e, i = r.length - 1, s; i >= 0; i--)
1731
- (s = r[i]) && (o = (t ? s(e, n, o) : s(o)) || o);
1732
- return t && o && Fr(e, n, o), o;
1733
- }, Q = (r, e) => (n, t) => e(n, t, r);
1734
- function Xr(r, e, n, t) {
1735
- const { scaleX: o, scaleY: i } = e.getAncestorScale(), s = e.getViewport(gn.VIEW_MAIN), a = {
1711
+ ye = qr([
1712
+ de(le.Rendered, ye),
1713
+ re(0, W),
1714
+ re(1, B(qn)),
1715
+ re(2, X),
1716
+ re(3, H),
1717
+ re(4, Be),
1718
+ re(5, ce)
1719
+ ], ye);
1720
+ var ti = Object.defineProperty, ni = Object.getOwnPropertyDescriptor, ri = (r, e, n, t) => {
1721
+ for (var i = t > 1 ? void 0 : t ? ni(e, n) : e, s = r.length - 1, o; s >= 0; s--)
1722
+ (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
1723
+ return t && i && ti(e, n, i), i;
1724
+ }, ee = (r, e) => (n, t) => e(n, t, r);
1725
+ function ii(r, e, n, t) {
1726
+ const { scaleX: i, scaleY: s } = e.getAncestorScale(), o = e.getViewport(Mn.VIEW_MAIN), a = {
1736
1727
  left: !0,
1737
1728
  top: !0
1738
1729
  };
1739
- if (!s)
1730
+ if (!o)
1740
1731
  return {
1741
1732
  ...r,
1742
1733
  absolute: a
1743
1734
  };
1744
- const { left: c, right: u, top: d, bottom: l } = r, h = t.getFreeze(), { startColumn: m, startRow: f, xSplit: g, ySplit: _ } = h, I = n.getNoMergeCellPositionByIndexWithNoHeader(f - _, m - g), C = n.getNoMergeCellPositionByIndexWithNoHeader(f, m), { rowHeaderWidth: v, columnHeaderHeight: R } = n, w = C.startX - I.startX, M = C.startY - I.startY, { top: p, left: T, viewportScrollX: D, viewportScrollY: E } = s;
1745
- let U, y;
1746
- c < T ? (a.left = !0, U = (w + v + (c - T)) * o, y = Math.max(
1735
+ const { left: c, right: g, top: l, bottom: d } = r, m = t.getFreeze(), { startColumn: u, startRow: f, xSplit: h, ySplit: p } = m, S = n.getNoMergeCellPositionByIndexWithNoHeader(f - p, u - h), I = n.getNoMergeCellPositionByIndexWithNoHeader(f, u), { rowHeaderWidth: v, columnHeaderHeight: C } = n, _ = I.startX - S.startX, M = I.startY - S.startY, { top: w, left: y, viewportScrollX: D, viewportScrollY: T } = o;
1736
+ let U, E;
1737
+ c < y ? (a.left = !0, U = (_ + v + (c - y)) * i, E = Math.max(
1747
1738
  Math.min(
1748
- (w + v + (u - T)) * o,
1749
- (w + v) * o
1739
+ (_ + v + (g - y)) * i,
1740
+ (_ + v) * i
1750
1741
  ),
1751
- (u - D) * o
1752
- )) : (a.left = !1, U = Math.max((c - D) * o, (w + v) * o), y = Math.max((u - D) * o, (w + v) * o));
1753
- let S, j;
1754
- return d < p ? (a.top = !0, S = (M + R + (d - p)) * i, j = Math.max(
1742
+ (g - D) * i
1743
+ )) : (a.left = !1, U = Math.max((c - D) * i, (_ + v) * i), E = Math.max((g - D) * i, (_ + v) * i));
1744
+ let R, A;
1745
+ return l < w ? (a.top = !0, R = (M + C + (l - w)) * s, A = Math.max(
1755
1746
  Math.min(
1756
- (M + R + (u - p)) * i,
1757
- (M + R) * i
1747
+ (M + C + (g - w)) * s,
1748
+ (M + C) * s
1758
1749
  ),
1759
- (l - E) * i
1760
- )) : (a.top = !1, S = Math.max((d - E) * i, (M + R) * i), j = Math.max((l - E) * i, (M + R) * i)), {
1750
+ (d - T) * s
1751
+ )) : (a.top = !1, R = Math.max((l - T) * s, (M + C) * s), A = Math.max((d - T) * s, (M + C) * s)), {
1761
1752
  left: U,
1762
- right: y,
1763
- top: S,
1764
- bottom: j,
1753
+ right: E,
1754
+ top: R,
1755
+ bottom: A,
1765
1756
  absolute: a
1766
1757
  };
1767
1758
  }
1768
- const We = (r, e, n, t) => {
1769
- const { scene: o } = e, { left: i, top: s, width: a, height: c, angle: u } = r, d = {
1770
- left: i,
1771
- right: i + a,
1772
- top: s,
1773
- bottom: s + c
1774
- }, l = Xr(d, o, n, t);
1759
+ const Xe = (r, e, n, t) => {
1760
+ const { scene: i } = e, { left: s, top: o, width: a, height: c, angle: g } = r, l = {
1761
+ left: s,
1762
+ right: s + a,
1763
+ top: o,
1764
+ bottom: o + c
1765
+ }, d = ii(l, i, n, t);
1775
1766
  return {
1776
- startX: l.left,
1777
- endX: l.right,
1778
- startY: l.top,
1779
- endY: l.bottom,
1780
- rotate: u,
1767
+ startX: d.left,
1768
+ endX: d.right,
1769
+ startY: d.top,
1770
+ endY: d.bottom,
1771
+ rotate: g,
1781
1772
  width: a,
1782
1773
  height: c,
1783
- absolute: l.absolute
1774
+ absolute: d.absolute
1784
1775
  };
1785
1776
  };
1786
- let Fe = class extends ge {
1787
- constructor(e, n, t, o, i, s, a) {
1777
+ let Ze = class extends ue {
1778
+ constructor(e, n, t, i, s, o, a) {
1788
1779
  super();
1789
- H(this, "_domLayerMap", /* @__PURE__ */ new Map());
1790
- H(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
1791
- H(this, "_transformChange$", new qe());
1792
- H(this, "transformChange$", this._transformChange$.asObservable());
1793
- H(this, "_remove$", new qe());
1794
- H(this, "remove$", this._remove$.asObservable());
1795
- this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = o, this._selectionRenderService = i, this._canvasFloatDomService = s, this._sheetDrawingService = a, this._drawingAddListener(), this._scrollUpdateListener(), this._featureUpdateListener(), this._deleteListener();
1780
+ K(this, "_domLayerMap", /* @__PURE__ */ new Map());
1781
+ K(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
1782
+ K(this, "_transformChange$", new dt());
1783
+ K(this, "transformChange$", this._transformChange$.asObservable());
1784
+ K(this, "_remove$", new dt());
1785
+ K(this, "remove$", this._remove$.asObservable());
1786
+ this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = i, this._selectionRenderService = s, this._canvasFloatDomService = o, this._sheetDrawingService = a, this._drawingAddListener(), this._scrollUpdateListener(), this._featureUpdateListener(), this._deleteListener();
1796
1787
  }
1797
1788
  _ensureMap(e, n) {
1798
1789
  let t = this._domLayerMap.get(e);
1799
1790
  t || (t = /* @__PURE__ */ new Map(), this._domLayerMap.set(e, t));
1800
- let o = t.get(n);
1801
- return o || (o = /* @__PURE__ */ new Map(), t.set(n, o)), o;
1791
+ let i = t.get(n);
1792
+ return i || (i = /* @__PURE__ */ new Map(), t.set(n, i)), i;
1802
1793
  }
1803
1794
  _getSceneAndTransformerByDrawingSearch(e) {
1804
1795
  if (e == null)
@@ -1806,8 +1797,8 @@ let Fe = class extends ge {
1806
1797
  const n = this._renderManagerService.getRenderById(e), t = n == null ? void 0 : n.scene;
1807
1798
  if (n == null || t == null)
1808
1799
  return null;
1809
- const o = t.getTransformerByCreate(), i = n.engine.getCanvasElement();
1810
- return { scene: t, transformer: o, renderObject: n, canvas: i };
1800
+ const i = t.getTransformerByCreate(), s = n.engine.getCanvasElement();
1801
+ return { scene: t, transformer: i, renderObject: n, canvas: s };
1811
1802
  }
1812
1803
  // eslint-disable-next-line max-lines-per-function
1813
1804
  _drawingAddListener() {
@@ -1815,118 +1806,119 @@ let Fe = class extends ge {
1815
1806
  // eslint-disable-next-line max-lines-per-function
1816
1807
  this._drawingManagerService.add$.subscribe((e) => {
1817
1808
  e.forEach((n) => {
1818
- var ke;
1819
- const { unitId: t, subUnitId: o, drawingId: i } = n, s = re(this._univerInstanceService, { unitId: t, subUnitId: o }), a = this._drawingManagerService.getDrawingByParam(n), c = (ke = this._renderManagerService.getRenderById(t)) == null ? void 0 : ke.with(Be).getUnitSkeleton(t, o);
1820
- if (a == null || s == null || c == null)
1809
+ var rt, it;
1810
+ const { unitId: t, subUnitId: i, drawingId: s } = n, o = se(this._univerInstanceService, { unitId: t, subUnitId: i }), a = this._drawingManagerService.getDrawingByParam(n), c = (rt = this._renderManagerService.getRenderById(t)) == null ? void 0 : rt.with(He).getUnitSkeleton(t, i);
1811
+ if (a == null || o == null || c == null)
1821
1812
  return;
1822
- const { transform: u, drawingType: d } = a;
1823
- if (d !== Ne.DRAWING_DOM)
1813
+ const { transform: g, drawingType: l } = a;
1814
+ if (l !== Ge.DRAWING_DOM)
1824
1815
  return;
1825
- const l = this._getSceneAndTransformerByDrawingSearch(t);
1826
- if (l == null)
1816
+ const d = this._getSceneAndTransformerByDrawingSearch(t);
1817
+ if (d == null)
1827
1818
  return;
1828
- const { scene: h, canvas: m } = l;
1829
- if (u == null)
1819
+ const { scene: m, canvas: u } = d;
1820
+ if (g == null)
1830
1821
  return !0;
1831
- const { left: f, top: g, width: _, height: I, angle: C, flipX: v, flipY: R, skewX: w, skewY: M } = u, p = rn({ unitId: t, subUnitId: o, drawingId: i }), T = h.getObject(p);
1832
- if (T != null) {
1833
- T.transformByState({ left: f, top: g, width: _, height: I, angle: C, flipX: v, flipY: R, skewX: w, skewY: M });
1822
+ const { left: f, top: h, width: p, height: S, angle: I, flipX: v, flipY: C, skewX: _, skewY: M } = g, w = vn({ unitId: t, subUnitId: i, drawingId: s }), y = m.getObject(w);
1823
+ if (y != null) {
1824
+ y.transformByState({ left: f, top: h, width: p, height: S, angle: I, flipX: v, flipY: C, skewX: _, skewY: M });
1834
1825
  return;
1835
1826
  }
1836
1827
  const D = {
1837
1828
  left: f,
1838
- top: g,
1839
- width: _,
1840
- height: I,
1841
- zIndex: this._drawingManagerService.getDrawingOrder(t, o).length - 1
1842
- }, E = new cn(p, D);
1843
- h.addObject(E, ln).attachTransformerTo(E);
1844
- const U = new Vt(), y = We(E, l.renderObject, c.skeleton, s.worksheet), S = new pn(y), j = {
1845
- dispose: U,
1846
- rect: E,
1847
- position$: S,
1829
+ top: h,
1830
+ width: p,
1831
+ height: S,
1832
+ zIndex: this._drawingManagerService.getDrawingOrder(t, i).length - 1
1833
+ }, T = new Rn(w, D);
1834
+ m.addObject(T, Dn).attachTransformerTo(T);
1835
+ const U = this._ensureMap(t, i), E = new nn(), R = Xe(T, d.renderObject, c.skeleton, o.worksheet), A = new Tn(R), z = {
1836
+ dispose: E,
1837
+ rect: T,
1838
+ position$: A,
1848
1839
  unitId: t,
1849
- subUnitId: o
1840
+ subUnitId: i
1850
1841
  };
1851
1842
  this._canvasFloatDomService.addFloatDom({
1852
- position$: S,
1853
- id: i,
1843
+ position$: A,
1844
+ id: s,
1854
1845
  componentKey: a.componentKey,
1855
- onPointerDown: (G) => {
1856
- m.dispatchEvent(new PointerEvent(G.type, G));
1846
+ onPointerDown: ($) => {
1847
+ u.dispatchEvent(new PointerEvent($.type, $));
1857
1848
  },
1858
- onPointerMove: (G) => {
1859
- m.dispatchEvent(new PointerEvent(G.type, G));
1849
+ onPointerMove: ($) => {
1850
+ u.dispatchEvent(new PointerEvent($.type, $));
1860
1851
  },
1861
- onPointerUp: (G) => {
1862
- m.dispatchEvent(new PointerEvent(G.type, G));
1852
+ onPointerUp: ($) => {
1853
+ u.dispatchEvent(new PointerEvent($.type, $));
1863
1854
  },
1864
- onWheel: (G) => {
1865
- m.dispatchEvent(new WheelEvent(G.type, G));
1866
- }
1855
+ onWheel: ($) => {
1856
+ u.dispatchEvent(new WheelEvent($.type, $));
1857
+ },
1858
+ props: (it = U.get(s)) == null ? void 0 : it.props
1867
1859
  });
1868
- const X = E.onTransformChangeObservable.add(() => {
1869
- const G = We(E, l.renderObject, c.skeleton, s.worksheet);
1870
- S.next(
1871
- G
1860
+ const nt = T.onTransformChangeObservable.add(() => {
1861
+ const $ = Xe(T, d.renderObject, c.skeleton, o.worksheet);
1862
+ A.next(
1863
+ $
1872
1864
  );
1873
1865
  });
1874
- U.add(() => {
1875
- this._canvasFloatDomService.removeFloatDom(i);
1876
- }), X && U.add(X), this._domLayerInfoMap.set(i, j);
1866
+ E.add(() => {
1867
+ this._canvasFloatDomService.removeFloatDom(s);
1868
+ }), nt && E.add(nt), this._domLayerInfoMap.set(s, z);
1877
1869
  });
1878
1870
  })
1879
1871
  );
1880
1872
  }
1881
1873
  _scrollUpdateListener() {
1882
1874
  this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
1883
- var t, o;
1884
- const n = (i, s) => {
1885
- var h;
1886
- const a = this._getSceneAndTransformerByDrawingSearch(i), c = this._ensureMap(i, s), u = Array.from(c.keys()), d = re(this._univerInstanceService, { unitId: i, subUnitId: s }), l = (h = this._renderManagerService.getRenderById(i)) == null ? void 0 : h.with(Be).getUnitSkeleton(i, s);
1887
- !a || !d || !l || u.forEach((m) => {
1888
- const f = this._domLayerInfoMap.get(m);
1875
+ var t, i;
1876
+ const n = (s, o) => {
1877
+ var m;
1878
+ const a = this._getSceneAndTransformerByDrawingSearch(s), c = this._ensureMap(s, o), g = Array.from(c.keys()), l = se(this._univerInstanceService, { unitId: s, subUnitId: o }), d = (m = this._renderManagerService.getRenderById(s)) == null ? void 0 : m.with(He).getUnitSkeleton(s, o);
1879
+ !a || !l || !d || g.forEach((u) => {
1880
+ const f = this._domLayerInfoMap.get(u);
1889
1881
  if (f) {
1890
- const g = We(f.rect, a.renderObject, l.skeleton, d.worksheet);
1891
- f.position$.next(g);
1882
+ const h = Xe(f.rect, a.renderObject, d.skeleton, l.worksheet);
1883
+ f.position$.next(h);
1892
1884
  }
1893
1885
  });
1894
1886
  };
1895
- if (e.id === mn.id) {
1896
- const i = e.params, { unitId: s, sheetId: a } = i;
1897
- n(s, a);
1898
- } else if (e.id === hn.id) {
1899
- const i = e.params, { unitId: s } = i;
1900
- Array.from((o = (t = this._domLayerMap.get(s)) == null ? void 0 : t.keys()) != null ? o : []).forEach((c) => {
1901
- n(s, c);
1887
+ if (e.id === Pn.id) {
1888
+ const s = e.params, { unitId: o, sheetId: a } = s;
1889
+ n(o, a);
1890
+ } else if (e.id === En.id) {
1891
+ const s = e.params, { unitId: o } = s;
1892
+ Array.from((i = (t = this._domLayerMap.get(o)) == null ? void 0 : t.keys()) != null ? i : []).forEach((c) => {
1893
+ n(o, c);
1902
1894
  });
1903
- } else if (e.id === xn.id) {
1904
- const { unitId: i, subUnitId: s } = e.params;
1905
- n(i, s);
1895
+ } else if (e.id === Qn.id) {
1896
+ const { unitId: s, subUnitId: o } = e.params;
1897
+ n(s, o);
1906
1898
  }
1907
1899
  }));
1908
1900
  }
1909
1901
  _getPosition(e) {
1910
- const { startX: n, endX: t, startY: o, endY: i } = e, s = this._selectionRenderService.getSelectionCellByPosition(n, o);
1911
- if (s == null)
1902
+ const { startX: n, endX: t, startY: i, endY: s } = e, o = this._selectionRenderService.getSelectionCellByPosition(n, i);
1903
+ if (o == null)
1912
1904
  return;
1913
1905
  const a = {
1914
- column: s.actualColumn,
1915
- columnOffset: n - s.startX,
1916
- row: s.actualRow,
1917
- rowOffset: o - s.startY
1918
- }, c = this._selectionRenderService.getSelectionCellByPosition(t, i);
1906
+ column: o.actualColumn,
1907
+ columnOffset: n - o.startX,
1908
+ row: o.actualRow,
1909
+ rowOffset: i - o.startY
1910
+ }, c = this._selectionRenderService.getSelectionCellByPosition(t, s);
1919
1911
  if (c == null)
1920
1912
  return;
1921
- const u = {
1913
+ const g = {
1922
1914
  column: c.actualColumn,
1923
1915
  columnOffset: t - c.startX,
1924
1916
  row: c.actualRow,
1925
- rowOffset: i - c.startY
1917
+ rowOffset: s - c.startY
1926
1918
  };
1927
1919
  return {
1928
1920
  from: a,
1929
- to: u
1921
+ to: g
1930
1922
  };
1931
1923
  }
1932
1924
  _featureUpdateListener() {
@@ -1934,12 +1926,12 @@ let Fe = class extends ge {
1934
1926
  this._drawingManagerService.update$.subscribe((e) => {
1935
1927
  e.forEach((n) => {
1936
1928
  const t = this._drawingManagerService.getDrawingByParam(n);
1937
- if (!t || t.drawingType !== Ne.DRAWING_DOM)
1929
+ if (!t || t.drawingType !== Ge.DRAWING_DOM)
1938
1930
  return;
1939
- const o = {
1931
+ const i = {
1940
1932
  ...t.transform
1941
1933
  };
1942
- this._transformChange$.next({ id: n.drawingId, value: o });
1934
+ this._transformChange$.next({ id: n.drawingId, value: i });
1943
1935
  });
1944
1936
  })
1945
1937
  );
@@ -1954,33 +1946,34 @@ let Fe = class extends ge {
1954
1946
  );
1955
1947
  }
1956
1948
  addFloatDomToPosition(e) {
1957
- const n = re(this._univerInstanceService, {
1949
+ const n = se(this._univerInstanceService, {
1958
1950
  unitId: e.unitId,
1959
1951
  subUnitId: e.subUnitId
1960
1952
  });
1961
1953
  if (!n)
1962
1954
  throw new Error("cannot find current target!");
1963
- const { unitId: t, subUnitId: o } = n, { initPosition: i, componentKey: s } = e, a = ne.generateRandomId(), c = this._getPosition(i);
1955
+ const { unitId: t, subUnitId: i } = n, { initPosition: s, componentKey: o } = e, a = ie.generateRandomId(), c = this._getPosition(s);
1964
1956
  if (c == null)
1965
1957
  return;
1966
- const u = {
1958
+ this._ensureMap(t, i).set(a, e);
1959
+ const l = {
1967
1960
  unitId: t,
1968
- subUnitId: o,
1961
+ subUnitId: i,
1969
1962
  drawingId: a,
1970
- drawingType: Ne.DRAWING_DOM,
1971
- componentKey: s,
1963
+ drawingType: Ge.DRAWING_DOM,
1964
+ componentKey: o,
1972
1965
  sheetTransform: c,
1973
1966
  transform: {
1974
- left: i.startX,
1975
- top: i.startY,
1976
- width: i.endX - i.startX,
1977
- height: i.endY - i.startY
1967
+ left: s.startX,
1968
+ top: s.startY,
1969
+ width: s.endX - s.startX,
1970
+ height: s.endY - s.startY
1978
1971
  }
1979
1972
  };
1980
- return this._commandService.executeCommand(He.id, {
1973
+ return this._commandService.executeCommand(tt.id, {
1981
1974
  unitId: t,
1982
- drawings: [u]
1983
- }), this._ensureMap(t, o).set(a, e), {
1975
+ drawings: [l]
1976
+ }), {
1984
1977
  id: a,
1985
1978
  dispose: () => {
1986
1979
  this._removeDom(a, !0);
@@ -1991,33 +1984,34 @@ let Fe = class extends ge {
1991
1984
  const t = this._domLayerInfoMap.get(e);
1992
1985
  if (!t)
1993
1986
  return;
1994
- const { unitId: o, subUnitId: i } = t, s = this._ensureMap(o, i);
1995
- this._domLayerInfoMap.delete(e), s.delete(e), t.dispose.dispose();
1996
- const a = this._getSceneAndTransformerByDrawingSearch(o);
1997
- if (a && a.scene.removeObject(t.rect), n) {
1998
- const c = this._drawingManagerService.getDrawingByParam({ unitId: o, subUnitId: i, drawingId: e });
1987
+ const { unitId: i, subUnitId: s } = t;
1988
+ this._domLayerInfoMap.delete(e), t.dispose.dispose();
1989
+ const o = this._getSceneAndTransformerByDrawingSearch(i);
1990
+ if (o && o.scene.removeObject(t.rect), n) {
1991
+ this._ensureMap(i, s).delete(e);
1992
+ const c = this._drawingManagerService.getDrawingByParam({ unitId: i, subUnitId: s, drawingId: e });
1999
1993
  if (!c)
2000
1994
  return;
2001
- const u = this._sheetDrawingService.getBatchRemoveOp([c]), { redo: d, objects: l } = u;
2002
- this._commandService.syncExecuteCommand(b.id, { unitId: o, subUnitId: i, op: d, objects: l, type: P.REMOVE });
1995
+ const g = this._sheetDrawingService.getBatchRemoveOp([c]), { redo: l, objects: d } = g;
1996
+ this._commandService.syncExecuteCommand(O.id, { unitId: i, subUnitId: s, op: l, objects: d, type: P.REMOVE });
2003
1997
  }
2004
1998
  }
2005
1999
  };
2006
- Fe = Yr([
2007
- Q(0, W(se)),
2008
- Q(1, ue),
2009
- Q(2, W(B)),
2010
- Q(3, k),
2011
- Q(4, Te),
2012
- Q(5, W(On)),
2013
- Q(6, Y)
2014
- ], Fe);
2015
- var Hr = Object.defineProperty, kr = Object.getOwnPropertyDescriptor, zr = (r, e, n, t) => {
2016
- for (var o = t > 1 ? void 0 : t ? kr(e, n) : e, i = r.length - 1, s; i >= 0; i--)
2017
- (s = r[i]) && (o = (t ? s(e, n, o) : s(o)) || o);
2018
- return t && o && Hr(e, n, o), o;
2019
- }, Ce = (r, e) => (n, t) => e(n, t, r);
2020
- let Me = class extends ge {
2000
+ Ze = ri([
2001
+ ee(0, B(te)),
2002
+ ee(1, ce),
2003
+ ee(2, B(W)),
2004
+ ee(3, H),
2005
+ ee(4, Be),
2006
+ ee(5, B(Gn)),
2007
+ ee(6, X)
2008
+ ], Ze);
2009
+ var si = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, ai = (r, e, n, t) => {
2010
+ for (var i = t > 1 ? void 0 : t ? oi(e, n) : e, s = r.length - 1, o; s >= 0; s--)
2011
+ (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
2012
+ return t && i && si(e, n, i), i;
2013
+ }, be = (r, e) => (n, t) => e(n, t, r);
2014
+ let Te = class extends ue {
2021
2015
  constructor(r, e, n, t) {
2022
2016
  super(), this._sheetPrintInterceptorService = r, this._drawingRenderService = e, this._drawingManagerService = n, this._renderManagerService = t, this._initPrinting();
2023
2017
  }
@@ -2027,9 +2021,9 @@ let Me = class extends ge {
2027
2021
  this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
2028
2022
  {
2029
2023
  handler: (r, e, n) => {
2030
- const { unitId: t, scene: o, subUnitId: i } = e, s = this._drawingManagerService.getDrawingDataForUnit(t), a = s == null ? void 0 : s[i];
2024
+ const { unitId: t, scene: i, subUnitId: s } = e, o = this._drawingManagerService.getDrawingDataForUnit(t), a = o == null ? void 0 : o[s];
2031
2025
  return a && a.order.forEach((c) => {
2032
- this._drawingRenderService.renderDrawing(a.data[c], o);
2026
+ this._drawingRenderService.renderDrawing(a.data[c], i);
2033
2027
  }), n();
2034
2028
  }
2035
2029
  }
@@ -2039,46 +2033,206 @@ let Me = class extends ge {
2039
2033
  this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE,
2040
2034
  {
2041
2035
  handler: (r, e, n) => {
2042
- const { unitId: t, subUnitId: o } = e, i = this._renderManagerService.getRenderById(t);
2043
- if (!i)
2044
- return n(r);
2045
- const s = i.with(Be).getUnitSkeleton(t, o);
2036
+ const { unitId: t, subUnitId: i } = e, s = this._renderManagerService.getRenderById(t);
2046
2037
  if (!s)
2047
2038
  return n(r);
2039
+ const o = s.with(He).getUnitSkeleton(t, i);
2040
+ if (!o)
2041
+ return n(r);
2048
2042
  const a = this._drawingManagerService.getDrawingDataForUnit(t), c = a == null ? void 0 : a[e.subUnitId];
2049
2043
  if (!c)
2050
2044
  return n(r);
2051
- const { scaleX: u, scaleY: d } = i.scene, l = r ? { ...r } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, h = c.order.map((m) => c.data[m]).filter((m) => m.drawingType !== ye.DRAWING_DOM);
2052
- return h.length ? (h.forEach((m) => {
2053
- if (!m.groupId && m.transform && ne.isDefine(m.transform.left) && ne.isDefine(m.transform.top) && ne.isDefine(m.transform.width) && ne.isDefine(m.transform.height)) {
2054
- const f = s.skeleton.getCellPositionByOffset(m.transform.left, m.transform.top, u, d, { x: 0, y: 0 }), g = s.skeleton.getCellPositionByOffset(m.transform.left + m.transform.width, m.transform.top + m.transform.height, u, d, { x: 0, y: 0 });
2055
- f.column < l.startColumn && (l.startColumn = f.column), f.row < l.startRow && (l.startRow = f.row), l.endRow < g.row && (l.endRow = g.row), l.endColumn < g.column && (l.endColumn = g.column);
2045
+ const { scaleX: g, scaleY: l } = s.scene, d = r ? { ...r } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, m = c.order.map((u) => c.data[u]).filter((u) => u.drawingType !== Le.DRAWING_DOM);
2046
+ return m.length ? (m.forEach((u) => {
2047
+ if (!u.groupId && u.transform && ie.isDefine(u.transform.left) && ie.isDefine(u.transform.top) && ie.isDefine(u.transform.width) && ie.isDefine(u.transform.height)) {
2048
+ const f = o.skeleton.getCellPositionByOffset(u.transform.left, u.transform.top, g, l, { x: 0, y: 0 }), h = o.skeleton.getCellPositionByOffset(u.transform.left + u.transform.width, u.transform.top + u.transform.height, g, l, { x: 0, y: 0 });
2049
+ f.column < d.startColumn && (d.startColumn = f.column), f.row < d.startRow && (d.startRow = f.row), d.endRow < h.row && (d.endRow = h.row), d.endColumn < h.column && (d.endColumn = h.column);
2056
2050
  }
2057
- }), n(l)) : n(r);
2051
+ }), n(d)) : n(r);
2058
2052
  }
2059
2053
  }
2060
2054
  )
2061
2055
  );
2062
2056
  }
2063
2057
  };
2064
- Me = zr([
2065
- me(he.Rendered, Me),
2066
- Ce(0, W(fn)),
2067
- Ce(1, W(Zt)),
2068
- Ce(2, k),
2069
- Ce(3, se)
2070
- ], Me);
2071
- var Lt = Object.defineProperty, Kr = Object.getOwnPropertyDescriptor, Jr = (r, e, n) => e in r ? Lt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n, Zr = (r, e, n, t) => {
2072
- for (var o = t > 1 ? void 0 : t ? Kr(e, n) : e, i = r.length - 1, s; i >= 0; i--)
2073
- (s = r[i]) && (o = (t ? s(e, n, o) : s(o)) || o);
2074
- return t && o && Lt(e, n, o), o;
2075
- }, et = (r, e) => (n, t) => e(n, t, r), jt = (r, e, n) => (Jr(r, typeof e != "symbol" ? e + "" : e, n), n);
2076
- const qr = "SHEET_IMAGE_UI_PLUGIN";
2077
- let Pe = class extends Yt {
2058
+ Te = ai([
2059
+ de(le.Rendered, Te),
2060
+ be(0, B(yn)),
2061
+ be(1, B(gn)),
2062
+ be(2, H),
2063
+ be(3, te)
2064
+ ], Te);
2065
+ var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, li = (r, e, n, t) => {
2066
+ for (var i = t > 1 ? void 0 : t ? di(e, n) : e, s = r.length - 1, o; s >= 0; s--)
2067
+ (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
2068
+ return t && i && ci(e, n, i), i;
2069
+ }, ge = (r, e) => (n, t) => e(n, t, r);
2070
+ let Ue = class extends ue {
2071
+ constructor(r, e, n, t, i) {
2072
+ super(), this._drawingManagerService = r, this._renderManagerService = e, this._permissionService = n, this._univerInstanceService = t, this._userManagerService = i, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
2073
+ }
2074
+ _initDrawingVisible() {
2075
+ const r = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
2076
+ this.disposeWithMe(
2077
+ Se([r, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
2078
+ if (!e) {
2079
+ this._drawingManagerService.setDrawingVisible(!1);
2080
+ return;
2081
+ }
2082
+ e.activeSheet$.subscribe((t) => {
2083
+ if (!t) {
2084
+ this._drawingManagerService.setDrawingVisible(!1);
2085
+ return;
2086
+ }
2087
+ const i = e.getUnitId(), s = t.getSheetId();
2088
+ if (this._permissionService.composePermission([new ut(i).id, new Fe(i, s).id]).every((a) => a.value))
2089
+ this._drawingManagerService.setDrawingVisible(!0);
2090
+ else {
2091
+ this._drawingManagerService.setDrawingVisible(!1);
2092
+ const a = e.getUnitId(), c = t.getSheetId(), g = this._drawingManagerService.getDrawingData(a, c), l = Object.values(g), d = this._renderManagerService.getRenderById(a), m = d == null ? void 0 : d.scene;
2093
+ if (m == null)
2094
+ return;
2095
+ m.getAllObjects().forEach((f) => {
2096
+ f.classType === ne.IMAGE && l.some((h) => f.oKey.includes(h.drawingId)) && m.removeObject(f);
2097
+ });
2098
+ }
2099
+ });
2100
+ })
2101
+ );
2102
+ }
2103
+ _initDrawingEditable() {
2104
+ const r = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
2105
+ this.disposeWithMe(
2106
+ Se([r, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
2107
+ if (!e) {
2108
+ this._drawingManagerService.setDrawingEditable(!1);
2109
+ return;
2110
+ }
2111
+ e.activeSheet$.subscribe((t) => {
2112
+ if (!t) {
2113
+ this._drawingManagerService.setDrawingEditable(!1);
2114
+ return;
2115
+ }
2116
+ const i = e.getUnitId(), s = t.getSheetId();
2117
+ if (this._permissionService.composePermission([new ze(i).id, new Oe(i, s).id]).every((a) => a.value))
2118
+ this._drawingManagerService.setDrawingEditable(!0);
2119
+ else {
2120
+ this._drawingManagerService.setDrawingEditable(!1);
2121
+ const a = e.getUnitId(), c = t.getSheetId(), g = this._drawingManagerService.getDrawingData(a, c), l = Object.values(g), d = this._renderManagerService.getRenderById(a), m = d == null ? void 0 : d.scene;
2122
+ if (m == null)
2123
+ return;
2124
+ m.getAllObjects().forEach((f) => {
2125
+ f.classType === ne.IMAGE && l.some((h) => f.oKey.includes(h.drawingId)) && m.detachTransformerFrom(f);
2126
+ });
2127
+ }
2128
+ });
2129
+ })
2130
+ );
2131
+ }
2132
+ _initViewPermissionChange() {
2133
+ const r = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
2134
+ this.disposeWithMe(
2135
+ Se([r, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
2136
+ e && e.activeSheet$.subscribe((t) => {
2137
+ var d;
2138
+ if (!t)
2139
+ return;
2140
+ const i = e.getUnitId(), s = t.getSheetId();
2141
+ let o = !0;
2142
+ const a = this._renderManagerService.getRenderById(i), c = a == null ? void 0 : a.scene;
2143
+ if (c == null)
2144
+ return;
2145
+ const g = c.getTransformerByCreate(), l = this._permissionService.composePermission$([new ut(i).id, new Fe(i, s).id]).pipe(lt((m) => m.every((u) => u.value)));
2146
+ l == null || l.pipe(
2147
+ Ce((m) => m !== o),
2148
+ Ie()
2149
+ ).subscribe({
2150
+ next: (m) => {
2151
+ o = m, this._drawingManagerService.setDrawingVisible(m);
2152
+ const u = c.getAllObjects(), f = this._drawingManagerService.getDrawingData(i, s), h = Object.values(f);
2153
+ m ? this._drawingManagerService.addNotification(h) : (u.forEach((p) => {
2154
+ p.classType === ne.IMAGE && h.some((S) => p.oKey.includes(S.drawingId)) && c.removeObject(p);
2155
+ }), g.clearSelectedObjects());
2156
+ }
2157
+ }), (d = this._permissionService.getPermissionPoint$(new Fe(i, s).id)) == null || d.pipe(
2158
+ Ce((m) => m.value !== o),
2159
+ Ie()
2160
+ ).subscribe({
2161
+ complete: () => {
2162
+ o = !0, this._drawingManagerService.setDrawingVisible(!0);
2163
+ const m = this._drawingManagerService.getDrawingData(i, s), u = Object.values(m);
2164
+ this._drawingManagerService.addNotification(u);
2165
+ }
2166
+ });
2167
+ });
2168
+ })
2169
+ );
2170
+ }
2171
+ _initEditPermissionChange() {
2172
+ const r = this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET);
2173
+ this.disposeWithMe(
2174
+ Se([r, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
2175
+ e && e.activeSheet$.subscribe((t) => {
2176
+ var d;
2177
+ if (!t)
2178
+ return;
2179
+ const i = e.getUnitId(), s = t.getSheetId();
2180
+ let o = !0;
2181
+ const a = this._renderManagerService.getRenderById(i), c = a == null ? void 0 : a.scene;
2182
+ if (c == null)
2183
+ return;
2184
+ const g = c.getTransformerByCreate(), l = this._permissionService.composePermission$([new ze(i).id, new Oe(i, s).id]).pipe(lt((m) => m.every((u) => u.value)));
2185
+ l == null || l.pipe(
2186
+ Ce((m) => m !== o),
2187
+ Ie()
2188
+ ).subscribe({
2189
+ next: (m) => {
2190
+ o = m, this._drawingManagerService.setDrawingEditable(m);
2191
+ const u = c.getAllObjects(), f = this._drawingManagerService.getDrawingData(i, s), h = Object.values(f);
2192
+ m ? (u.forEach((p) => {
2193
+ p.classType === ne.IMAGE && h.some((S) => p.oKey.includes(S.drawingId)) && c.attachTransformerTo(p);
2194
+ }), this._drawingManagerService.addNotification(h)) : (u.forEach((p) => {
2195
+ p.classType === ne.IMAGE && h.some((S) => p.oKey.includes(S.drawingId)) && c.detachTransformerFrom(p);
2196
+ }), g.clearSelectedObjects());
2197
+ }
2198
+ }), (d = this._permissionService.getPermissionPoint$(new Oe(i, s).id)) == null || d.pipe(
2199
+ Ce((m) => m.value !== o),
2200
+ Ie()
2201
+ ).subscribe({
2202
+ complete: () => {
2203
+ o = !0;
2204
+ const m = e.getUnitId(), u = t.getSheetId(), f = this._drawingManagerService.getDrawingData(m, u), h = Object.values(f), p = this._renderManagerService.getRenderById(m), S = p == null ? void 0 : p.scene;
2205
+ if (S == null)
2206
+ return;
2207
+ this._drawingManagerService.setDrawingEditable(!0), S.getAllObjects().forEach((v) => {
2208
+ v.classType === ne.IMAGE && h.some((C) => v.oKey.includes(C.drawingId)) && S.detachTransformerFrom(v);
2209
+ });
2210
+ }
2211
+ });
2212
+ });
2213
+ })
2214
+ );
2215
+ }
2216
+ };
2217
+ Ue = li([
2218
+ de(le.Rendered, Ue),
2219
+ ge(0, H),
2220
+ ge(1, te),
2221
+ ge(2, sn),
2222
+ ge(3, ce),
2223
+ ge(4, B(rn))
2224
+ ], Ue);
2225
+ var Kt = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, mi = (r, e, n) => e in r ? Kt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n, gi = (r, e, n, t) => {
2226
+ for (var i = t > 1 ? void 0 : t ? ui(e, n) : e, s = r.length - 1, o; s >= 0; s--)
2227
+ (o = r[s]) && (i = (t ? o(e, n, i) : o(i)) || i);
2228
+ return t && i && Kt(e, n, i), i;
2229
+ }, gt = (r, e) => (n, t) => e(n, t, r), kt = (r, e, n) => mi(r, typeof e != "symbol" ? e + "" : e, n);
2230
+ const hi = "SHEET_IMAGE_UI_PLUGIN";
2231
+ let je = class extends on {
2078
2232
  constructor(e = {}, n, t) {
2079
2233
  super();
2080
- H(this, "_pluginConfig");
2081
- this._injector = n, this._localeService = t, this._pluginConfig = ne.deepMerge({}, jr, e);
2234
+ K(this, "_pluginConfig");
2235
+ this._injector = n, this._localeService = t, this._pluginConfig = ie.deepMerge({}, kr, e);
2082
2236
  }
2083
2237
  onStarting(e) {
2084
2238
  super.onStarting(e), this._initDependencies(e);
@@ -2086,29 +2240,30 @@ let Pe = class extends Yt {
2086
2240
  _initDependencies(e) {
2087
2241
  [
2088
2242
  // services
2089
- [Fe],
2243
+ [Ze],
2090
2244
  // controllers
2091
2245
  [
2092
- ce,
2246
+ he,
2093
2247
  {
2094
- useFactory: () => this._injector.createInstance(ce, this._pluginConfig)
2248
+ useFactory: () => this._injector.createInstance(he, this._pluginConfig)
2095
2249
  }
2096
2250
  ],
2097
- [Ie],
2098
- [Re],
2099
- [De],
2100
- [Me]
2251
+ [Ee],
2252
+ [Pe],
2253
+ [ye],
2254
+ [Te],
2255
+ [Ue]
2101
2256
  ].forEach((t) => e.add(t));
2102
2257
  }
2103
2258
  };
2104
- jt(Pe, "type", ee.UNIVER_SHEET);
2105
- jt(Pe, "pluginName", qr);
2106
- Pe = Zr([
2107
- Xt(on, qt, Qt),
2108
- et(1, W(Ve)),
2109
- et(2, W(de))
2110
- ], Pe);
2259
+ kt(je, "type", Y.UNIVER_SHEET);
2260
+ kt(je, "pluginName", hi);
2261
+ je = gi([
2262
+ an(Sn, hn, fn),
2263
+ gt(1, B(qe)),
2264
+ gt(2, B(pe))
2265
+ ], je);
2111
2266
  export {
2112
- Fe as SheetCanvasFloatDomManagerService,
2113
- Pe as UniverSheetsDrawingUIPlugin
2267
+ Ze as SheetCanvasFloatDomManagerService,
2268
+ je as UniverSheetsDrawingUIPlugin
2114
2269
  };