@univerjs/sheets-drawing-ui 0.16.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,33 +1,33 @@
1
- var qr = Object.defineProperty;
2
- var Qr = (i, t, e) => t in i ? qr(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var ae = (i, t, e) => Qr(i, typeof t != "symbol" ? t + "" : t, e);
4
- import { precisionTo as Et, IRenderManagerService as ee, transformObjectOutOfGroup as ei, getGroupState as ti, getCurrentTypeOfRenderer as yn, CURSOR_TYPE as ni, RENDER_CLASS_TYPE as He, Rect as Ge, ObjectType as kn, DRAWING_OBJECT_LAYER_INDEX as tn, SHEET_VIEWPORT_KEY as lr } from "@univerjs/engine-render";
5
- import { convertPositionSheetOverGridToAbsolute as ri, SheetSkeletonManagerService as Z, ISheetSelectionRenderService as Oe, attachRangeWithCoord as ur, SheetCanvasPopManagerService as ii, HoverManagerService as si, IEditorBridgeService as oi, EditingRenderController as ai, SetCellEditVisibleOperation as $n, PREDEFINED_HOOK_NAME_PASTE as Je, COPY_TYPE as Pe, virtualizeDiscreteRanges as ci, ISheetClipboardService as di, SetZoomRatioOperation as Bn, SetScrollOperation as li, SheetPrintInterceptorService as ui, useHighlightRange as hi, getCurrentRangeDisable$ as gi } from "@univerjs/sheets-ui";
6
- import { CommandType as te, ICommandService as K, IUndoRedoService as $e, sequenceExecute as zt, DrawingTypeEnum as $, ArrangeTypeEnum as Ot, Inject as N, IContextService as hr, LocaleService as Be, Injector as it, IURLImageService as gr, Disposable as re, createDocumentModelWithStyle as gn, ObjectRelativeFromV as Wn, ObjectRelativeFromH as jn, WrapTextType as Fn, PositionedObjectLayoutType as Ln, BooleanNumber as Hn, BuildTextUtils as mn, ImageSourceType as Ce, generateRandomId as Ze, FOCUSING_COMMON_DRAWINGS as et, IUniverInstanceService as he, UniverInstanceType as B, Direction as Te, createIdentifier as mi, IImageIoService as mr, RxDisposable as fi, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as ht, DOCS_ZEN_EDITOR_UNIT_ID_KEY as qe, InterceptorEffectEnum as pi, ObjectMatrix as wi, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Si, IPermissionService as _i, UserManagerService as vi, LifecycleService as Ii, LifecycleStages as Ci, DisposableCollection as Ut, fromEventSubject as Ri, Tools as Qe, PRINT_CHART_COMPONENT_KEY as Di, Rectangle as bi, FOCUSING_SHEET as Mi, FOCUSING_FX_BAR_EDITOR as yi, FOCUSING_PANEL_EDITOR as Ti, FOCUSING_SHAPE_TEXT_EDITOR as Ei, DependentOn as Oi, IConfigService as Ui, Plugin as Pi, merge as Ai, registerDependencies as Ni, touchDependencies as nn } from "@univerjs/core";
7
- import { ISheetDrawingService as ie, DrawingApplyType as P, SetDrawingApplyMutation as A, SheetDrawingAnchorType as U, UniverSheetsDrawingPlugin as xi } from "@univerjs/sheets-drawing";
8
- import { SheetInterceptorService as wt, SheetsSelectionsService as St, SetRangeValuesCommand as Gn, getSheetCommandTarget as ce, INTERCEPTOR_POINT as ki, InterceptCellContentPriority as $i, IAutoFillService as Bi, discreteRangeToRange as Vn, WorkbookViewPermission as Yn, WorksheetViewPermission as Xn, WorkbookEditablePermission as fn, WorksheetEditPermission as pn, SetFrozenMutation as Wi, SetSelectionsOperation as ji, SetWorksheetRowAutoHeightMutation as fr, COMMAND_LISTENER_SKELETON_CHANGE as Fi, InsertRowCommand as pr, InsertColCommand as wr, RemoveRowCommand as Sr, RemoveColCommand as _r, DeleteRangeMoveLeftCommand as vr, DeleteRangeMoveUpCommand as Ir, InsertRangeMoveDownCommand as Cr, InsertRangeMoveRightCommand as Rr, DeltaRowHeightCommand as wn, SetRowHeightCommand as Sn, DeltaColumnWidthCommand as Dr, SetColWidthCommand as br, SetRowHiddenCommand as Mr, SetSpecificRowsVisibleCommand as yr, SetSpecificColsVisibleCommand as Tr, SetColHiddenCommand as Er, MoveColsCommand as Or, MoveRowsCommand as Ur, MoveRangeCommand as Pr, SetRowVisibleMutation as Li, SetRowHiddenMutation as Hi, SetColVisibleMutation as Gi, SetColHiddenMutation as Vi, SetWorksheetRowHeightMutation as Yi, SetWorksheetRowIsAutoHeightMutation as Xi, SetWorksheetColWidthMutation as zi, SetWorksheetActiveOperation as Ki, RangeProtectionPermissionEditPoint as Ji } from "@univerjs/sheets";
9
- import { MessageType as Me, render as Zi, unmount as qi, FormLayout as rn, CheckboxGroup as Qi, Checkbox as zn, Select as es, Button as Kn, clsx as ts, RadioGroup as ns, Radio as sn } from "@univerjs/design";
10
- import { docDrawingPositionToTransform as Jn, ReplaceSnapshotCommand as rs, InnerPasteCommand as is } from "@univerjs/docs-ui";
11
- import { IImageIoService as ss, IDrawingManagerService as de, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Zn, DRAWING_IMAGE_COUNT_LIMIT as qn, ImageUploadStatusType as Ve, DRAWING_IMAGE_ALLOW_SIZE as Qn, getImageSize as on, SetDrawingSelectedOperation as Kt, DRAWING_IMAGE_WIDTH_LIMIT as er, DRAWING_IMAGE_HEIGHT_LIMIT as tr, getDrawingShapeKeyByDrawingSearch as ye, ImageSourceType as os, UniverDrawingPlugin as as } from "@univerjs/drawing";
12
- import { ILocalFileService as cs, IMessageService as Ar, IDialogService as Tn, ISidebarService as ds, IClipboardInterfaceService as ls, CanvasFloatDomService as us, PrintFloatDomSingle as hs, ComponentManager as Nr, connectInjector as gs, useDependency as Ee, getMenuHiddenObservable as Jt, MenuItemType as Zt, ContextMenuPosition as an, ContextMenuGroup as cn, RibbonInsertGroup as ms, KeyCode as rt, IMenuManagerService as fs, IShortcutService as ps } from "@univerjs/ui";
13
- import { DocDrawingController as ws, UniverDocsDrawingPlugin as Ss } from "@univerjs/docs-drawing";
14
- import { ImageCropperObject as _s, COMPONENT_IMAGE_POPUP_MENU as vs, OpenImageCropOperation as Is, ImageResetSizeOperation as Cs, DrawingRenderService as xr, DrawingCommonPanel as Rs, UniverDrawingUIPlugin as Ds } from "@univerjs/drawing-ui";
15
- import { throttleTime as bs, combineLatest as gt, switchMap as ve, EMPTY as De, tap as nr, map as Ie, distinctUntilChanged as rr, Subject as dn, filter as Ms, take as ys, BehaviorSubject as ze, of as _n } from "rxjs";
1
+ var Qr = Object.defineProperty;
2
+ var ei = (i, t, e) => t in i ? Qr(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var ae = (i, t, e) => ei(i, typeof t != "symbol" ? t + "" : t, e);
4
+ import { precisionTo as Ot, IRenderManagerService as ee, transformObjectOutOfGroup as ti, getGroupState as ni, getCurrentTypeOfRenderer as Tn, CURSOR_TYPE as ri, RENDER_CLASS_TYPE as He, Rect as Ve, ObjectType as Bn, DRAWING_OBJECT_LAYER_INDEX as nn, SHEET_VIEWPORT_KEY as ur } from "@univerjs/engine-render";
5
+ import { convertPositionSheetOverGridToAbsolute as ii, SheetSkeletonManagerService as Z, ISheetSelectionRenderService as Oe, attachRangeWithCoord as hr, getCurrentRangeDisable$ as si, HoverManagerService as oi, IEditorBridgeService as ai, EditingRenderController as ci, SetCellEditVisibleOperation as $n, PREDEFINED_HOOK_NAME_PASTE as Je, COPY_TYPE as Pe, virtualizeDiscreteRanges as di, ISheetClipboardService as li, SetZoomRatioOperation as Wn, SetScrollOperation as ui, SheetPrintInterceptorService as hi, useHighlightRange as gi, SheetCanvasPopManagerService as fi } from "@univerjs/sheets-ui";
6
+ import { CommandType as te, ICommandService as K, IUndoRedoService as Be, sequenceExecute as zt, DrawingTypeEnum as B, ArrangeTypeEnum as Ut, Inject as N, IContextService as gr, LocaleService as $e, Injector as st, IURLImageService as fr, Disposable as re, createDocumentModelWithStyle as fn, ObjectRelativeFromV as jn, ObjectRelativeFromH as Fn, WrapTextType as Ln, PositionedObjectLayoutType as Hn, BooleanNumber as Vn, BuildTextUtils as mn, ImageSourceType as Ce, generateRandomId as Ze, FOCUSING_COMMON_DRAWINGS as et, IUniverInstanceService as he, UniverInstanceType as $, Direction as Te, createIdentifier as mi, IImageIoService as mr, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as gt, DOCS_ZEN_EDITOR_UNIT_ID_KEY as qe, InterceptorEffectEnum as pi, ObjectMatrix as wi, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Si, IPermissionService as _i, UserManagerService as vi, LifecycleService as Ii, LifecycleStages as Ci, DisposableCollection as Pt, fromEventSubject as Ri, Tools as Qe, PRINT_CHART_COMPONENT_KEY as Di, Rectangle as bi, FOCUSING_SHEET as Mi, FOCUSING_FX_BAR_EDITOR as yi, FOCUSING_PANEL_EDITOR as Ti, FOCUSING_SHAPE_TEXT_EDITOR as Ei, RxDisposable as Oi, DependentOn as Ui, IConfigService as Pi, Plugin as Ai, merge as Ni, registerDependencies as xi, touchDependencies as rn } from "@univerjs/core";
7
+ import { ISheetDrawingService as ie, DrawingApplyType as P, SetDrawingApplyMutation as A, SheetDrawingAnchorType as U, UniverSheetsDrawingPlugin as ki } from "@univerjs/sheets-drawing";
8
+ import { SheetInterceptorService as St, SheetsSelectionsService as _t, SetRangeValuesCommand as Gn, getSheetCommandTarget as ce, RangeProtectionPermissionEditPoint as Bi, WorksheetEditPermission as pn, WorkbookEditablePermission as wn, INTERCEPTOR_POINT as $i, InterceptCellContentPriority as Wi, IAutoFillService as ji, discreteRangeToRange as Yn, WorkbookViewPermission as Xn, WorksheetViewPermission as zn, SetFrozenMutation as Fi, SetSelectionsOperation as Li, SetWorksheetRowAutoHeightMutation as pr, COMMAND_LISTENER_SKELETON_CHANGE as Hi, InsertRowCommand as wr, InsertColCommand as Sr, RemoveRowCommand as _r, RemoveColCommand as vr, DeleteRangeMoveLeftCommand as Ir, DeleteRangeMoveUpCommand as Cr, InsertRangeMoveDownCommand as Rr, InsertRangeMoveRightCommand as Dr, DeltaRowHeightCommand as Sn, SetRowHeightCommand as _n, DeltaColumnWidthCommand as br, SetColWidthCommand as Mr, SetRowHiddenCommand as yr, SetSpecificRowsVisibleCommand as Tr, SetSpecificColsVisibleCommand as Er, SetColHiddenCommand as Or, MoveColsCommand as Ur, MoveRowsCommand as Pr, MoveRangeCommand as Ar, SetRowVisibleMutation as Vi, SetRowHiddenMutation as Gi, SetColVisibleMutation as Yi, SetColHiddenMutation as Xi, SetWorksheetRowHeightMutation as zi, SetWorksheetRowIsAutoHeightMutation as Ki, SetWorksheetColWidthMutation as Ji, SetWorksheetActiveOperation as Zi } from "@univerjs/sheets";
9
+ import { MessageType as Me, render as qi, unmount as Qi, FormLayout as sn, CheckboxGroup as es, Checkbox as Kn, Select as ts, Button as Jn, clsx as ns, RadioGroup as rs, Radio as on } from "@univerjs/design";
10
+ import { docDrawingPositionToTransform as Zn, ReplaceSnapshotCommand as is, InnerPasteCommand as ss } from "@univerjs/docs-ui";
11
+ import { IImageIoService as os, IDrawingManagerService as de, DRAWING_IMAGE_ALLOW_IMAGE_LIST as qn, DRAWING_IMAGE_COUNT_LIMIT as Qn, ImageUploadStatusType as Ge, DRAWING_IMAGE_ALLOW_SIZE as er, getImageSize as an, SetDrawingSelectedOperation as Kt, DRAWING_IMAGE_WIDTH_LIMIT as tr, DRAWING_IMAGE_HEIGHT_LIMIT as nr, ImageSourceType as as, getDrawingShapeKeyByDrawingSearch as ye, UniverDrawingPlugin as cs } from "@univerjs/drawing";
12
+ import { ILocalFileService as ds, IMessageService as Nr, IDialogService as En, ISidebarService as ls, getMenuHiddenObservable as Jt, MenuItemType as Zt, IClipboardInterfaceService as us, CanvasFloatDomService as hs, PrintFloatDomSingle as gs, ComponentManager as xr, connectInjector as fs, ContextMenuPosition as cn, ContextMenuGroup as dn, RibbonInsertGroup as ms, useDependency as Ee, KeyCode as rt, IMenuManagerService as ps, IShortcutService as ws } from "@univerjs/ui";
13
+ import { DocDrawingController as Ss, UniverDocsDrawingPlugin as _s } from "@univerjs/docs-drawing";
14
+ import { DrawingRenderService as kr, DrawingCommonPanel as vs, ImageCropperObject as Is, COMPONENT_IMAGE_POPUP_MENU as Cs, OpenImageCropOperation as Rs, ImageResetSizeOperation as Ds, UniverDrawingUIPlugin as bs } from "@univerjs/drawing-ui";
15
+ import { throttleTime as Ms, combineLatest as ft, switchMap as ve, EMPTY as De, tap as rr, map as Ie, distinctUntilChanged as ir, Subject as ln, filter as ys, take as Ts, BehaviorSubject as ze, of as vn } from "rxjs";
16
16
  import { jsx as X, jsxs as tt } from "react/jsx-runtime";
17
- import { useMemo as Ke, useState as ke, useCallback as Pt, useEffect as kr } from "react";
17
+ import { useMemo as Ke, useState as ke, useCallback as At, useEffect as Br } from "react";
18
18
  function Q(i, t, e) {
19
19
  const { from: n, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: c = 0, skewY: u = 0 } = i, d = e.getCurrent();
20
20
  if (d == null)
21
21
  return;
22
- const l = ri(
22
+ const l = ii(
23
23
  d.unitId,
24
24
  d.sheetId,
25
25
  { from: n, to: r },
26
26
  e
27
27
  );
28
- let { left: g, top: h, width: m, height: f } = l;
28
+ let { left: g, top: h, width: f, height: m } = l;
29
29
  const p = e.getCurrentSkeleton(), S = p.rowHeaderWidth + p.columnTotalWidth, _ = p.columnHeaderHeight + p.rowTotalHeight;
30
- return g + m > S && (g = S - m), h + f > _ && (h = _ - f), {
30
+ return g + f > S && (g = S - f), h + m > _ && (h = _ - m), {
31
31
  flipY: s,
32
32
  flipX: o,
33
33
  angle: a,
@@ -35,8 +35,8 @@ function Q(i, t, e) {
35
35
  skewY: u,
36
36
  left: g,
37
37
  top: h,
38
- width: m,
39
- height: f
38
+ width: f,
39
+ height: m
40
40
  };
41
41
  }
42
42
  function j(i, t) {
@@ -45,17 +45,17 @@ function j(i, t) {
45
45
  return;
46
46
  const g = {
47
47
  column: l.actualColumn,
48
- columnOffset: Et(e - l.startX, 1),
48
+ columnOffset: Ot(e - l.startX, 1),
49
49
  row: l.actualRow,
50
- rowOffset: Et(n - l.startY, 1)
50
+ rowOffset: Ot(n - l.startY, 1)
51
51
  }, h = t.getCellWithCoordByOffset(e + r, n + s);
52
52
  if (h == null)
53
53
  return;
54
- const m = {
54
+ const f = {
55
55
  column: h.actualColumn,
56
- columnOffset: Et(e + r - h.startX, 1),
56
+ columnOffset: Ot(e + r - h.startX, 1),
57
57
  row: h.actualRow,
58
- rowOffset: Et(n + s - h.startY, 1)
58
+ rowOffset: Ot(n + s - h.startY, 1)
59
59
  };
60
60
  return {
61
61
  flipY: o,
@@ -64,7 +64,7 @@ function j(i, t) {
64
64
  skewX: u,
65
65
  skewY: d,
66
66
  from: g,
67
- to: m
67
+ to: f
68
68
  };
69
69
  }
70
70
  function F(i, t) {
@@ -90,31 +90,31 @@ const L = {
90
90
  (s = (r = e.getRenderById(n)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
91
91
  }), !0;
92
92
  }
93
- }, _t = {
93
+ }, vt = {
94
94
  id: "sheet.command.remove-sheet-image",
95
95
  type: te.COMMAND,
96
96
  handler: (i, t) => {
97
97
  var _, R, M;
98
- const e = i.get(K), n = i.get($e), r = i.get(wt), s = i.get(ie);
98
+ const e = i.get(K), n = i.get(Be), r = i.get(St), s = i.get(ie);
99
99
  if (!t) return !1;
100
100
  const { drawings: o } = t, a = [];
101
101
  o.forEach((I) => {
102
102
  const { unitId: v } = I;
103
103
  a.push(v);
104
104
  });
105
- const c = s.getBatchRemoveOp(o), { unitId: u, subUnitId: d, undo: l, redo: g, objects: h } = c, m = r.onCommandExecute({ id: _t.id, params: t }), f = { id: A.id, params: { unitId: u, subUnitId: d, op: g, objects: h, type: P.REMOVE } }, p = { id: A.id, params: { unitId: u, subUnitId: d, op: l, objects: h, type: P.INSERT } };
106
- return zt([...(_ = m.preRedos) != null ? _ : [], f, ...m.redos], e) ? (n.pushUndoRedo({
105
+ const c = s.getBatchRemoveOp(o), { unitId: u, subUnitId: d, undo: l, redo: g, objects: h } = c, f = r.onCommandExecute({ id: vt.id, params: t }), m = { id: A.id, params: { unitId: u, subUnitId: d, op: g, objects: h, type: P.REMOVE } }, p = { id: A.id, params: { unitId: u, subUnitId: d, op: l, objects: h, type: P.INSERT } };
106
+ return zt([...(_ = f.preRedos) != null ? _ : [], m, ...f.redos], e) ? (n.pushUndoRedo({
107
107
  unitID: u,
108
108
  undoMutations: [
109
- ...(R = m.preUndos) != null ? R : [],
109
+ ...(R = f.preUndos) != null ? R : [],
110
110
  p,
111
- ...m.undos,
111
+ ...f.undos,
112
112
  { id: L.id, params: a }
113
113
  ],
114
114
  redoMutations: [
115
- ...(M = m.preRedos) != null ? M : [],
116
- f,
117
- ...m.redos,
115
+ ...(M = f.preRedos) != null ? M : [],
116
+ m,
117
+ ...f.redos,
118
118
  { id: L.id, params: a }
119
119
  ]
120
120
  }), !0) : !1;
@@ -135,25 +135,25 @@ const L = {
135
135
  drawingType: d
136
136
  };
137
137
  });
138
- return t.executeCommand(_t.id, {
138
+ return t.executeCommand(vt.id, {
139
139
  unitId: r,
140
140
  drawings: s
141
141
  });
142
142
  }
143
143
  };
144
- function Ts(i) {
144
+ function Es(i) {
145
145
  const t = [];
146
146
  return i.forEach((e) => {
147
- const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = n, c = ti(0, 0, r.map((l) => l.transform || {})), u = r.map((l) => {
148
- const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: m, drawingId: f } = l;
147
+ const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = n, c = ni(0, 0, r.map((l) => l.transform || {})), u = r.map((l) => {
148
+ const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: f, drawingId: m } = l;
149
149
  return {
150
150
  unitId: h,
151
- subUnitId: m,
152
- drawingId: f,
151
+ subUnitId: f,
152
+ drawingId: m,
153
153
  transform: {
154
154
  ...g,
155
- left: g.left - c.left,
156
- top: g.top - c.top
155
+ left: g.left,
156
+ top: g.top
157
157
  },
158
158
  groupId: a
159
159
  };
@@ -161,7 +161,8 @@ function Ts(i) {
161
161
  unitId: s,
162
162
  subUnitId: o,
163
163
  drawingId: a,
164
- drawingType: $.DRAWING_GROUP,
164
+ drawingType: B.DRAWING_GROUP,
165
+ groupBaseBound: { ...n.groupBaseBound },
165
166
  transform: c
166
167
  };
167
168
  t.push({
@@ -170,18 +171,18 @@ function Ts(i) {
170
171
  });
171
172
  }), t;
172
173
  }
173
- function Es(i) {
174
+ function Os(i) {
174
175
  const t = [];
175
176
  return i.forEach((e) => {
176
177
  const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a, transform: c = { width: 0, height: 0 } } = n;
177
178
  if (c == null)
178
179
  return;
179
180
  const u = r.map((l) => {
180
- const { transform: g } = l, { unitId: h, subUnitId: m, drawingId: f } = l, p = ei(g || {}, c, c.width || 0, c.height || 0);
181
+ const { transform: g } = l, { unitId: h, subUnitId: f, drawingId: m } = l, p = ti(g || {}, c, c.width || 0, c.height || 0, n.groupBaseBound);
181
182
  return {
182
183
  unitId: h,
183
- subUnitId: m,
184
- drawingId: f,
184
+ subUnitId: f,
185
+ drawingId: m,
185
186
  transform: p,
186
187
  groupId: void 0
187
188
  };
@@ -189,7 +190,7 @@ function Es(i) {
189
190
  unitId: s,
190
191
  subUnitId: o,
191
192
  drawingId: a,
192
- drawingType: $.DRAWING_GROUP,
193
+ drawingType: B.DRAWING_GROUP,
193
194
  transform: {
194
195
  left: 0,
195
196
  top: 0
@@ -201,23 +202,23 @@ function Es(i) {
201
202
  });
202
203
  }), t;
203
204
  }
204
- const Br = {
205
+ const Wr = {
205
206
  id: "sheet.command.group-sheet-image",
206
207
  type: te.COMMAND,
207
208
  handler: (i, t) => {
208
- const e = i.get(K), n = i.get($e), r = i.get(ie);
209
+ const e = i.get(K), n = i.get(Be), r = i.get(ie);
209
210
  if (!t) return !1;
210
211
  const s = [];
211
- t.forEach(({ parent: h, children: m }) => {
212
- s.push(h.unitId), m.forEach((f) => {
213
- s.push(f.unitId);
212
+ t.forEach(({ parent: h, children: f }) => {
213
+ s.push(h.unitId), f.forEach((m) => {
214
+ s.push(m.unitId);
214
215
  });
215
216
  });
216
217
  const o = r.getGroupDrawingOp(t), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = o;
217
218
  return e.syncExecuteCommand(A.id, { op: d, unitId: a, subUnitId: c, objects: l, type: P.GROUP }) ? (n.pushUndoRedo({
218
219
  unitID: a,
219
220
  undoMutations: [
220
- { id: A.id, params: { op: u, unitId: a, subUnitId: c, objects: Es(l), type: P.UNGROUP } },
221
+ { id: A.id, params: { op: u, unitId: a, subUnitId: c, objects: Os(l), type: P.UNGROUP } },
221
222
  { id: L.id, params: s }
222
223
  ],
223
224
  redoMutations: [
@@ -231,34 +232,34 @@ const Br = {
231
232
  type: te.COMMAND,
232
233
  handler: (i, t) => {
233
234
  var _, R, M;
234
- const e = i.get(K), n = i.get($e), r = i.get(ie), s = i.get(wt);
235
+ const e = i.get(K), n = i.get(Be), r = i.get(ie), s = i.get(St);
235
236
  if (!t) return !1;
236
- const o = t.drawings, a = o.map((I) => I.unitId), c = r.getBatchAddOp(o), { unitId: u, subUnitId: d, undo: l, redo: g, objects: h } = c, m = s.onCommandExecute({ id: qt.id, params: t }), f = { id: A.id, params: { op: g, unitId: u, subUnitId: d, objects: h, type: P.INSERT } }, p = { id: A.id, params: { op: l, unitId: u, subUnitId: d, objects: h, type: P.REMOVE } };
237
- return zt([...(_ = m.preRedos) != null ? _ : [], f, ...m.redos], e) ? (n.pushUndoRedo({
237
+ const o = t.drawings, a = o.map((I) => I.unitId), c = r.getBatchAddOp(o), { unitId: u, subUnitId: d, undo: l, redo: g, objects: h } = c, f = s.onCommandExecute({ id: qt.id, params: t }), m = { id: A.id, params: { op: g, unitId: u, subUnitId: d, objects: h, type: P.INSERT } }, p = { id: A.id, params: { op: l, unitId: u, subUnitId: d, objects: h, type: P.REMOVE } };
238
+ return zt([...(_ = f.preRedos) != null ? _ : [], m, ...f.redos], e) ? (n.pushUndoRedo({
238
239
  unitID: u,
239
240
  undoMutations: [
240
- ...(R = m.preUndos) != null ? R : [],
241
+ ...(R = f.preUndos) != null ? R : [],
241
242
  p,
242
- ...m.undos,
243
+ ...f.undos,
243
244
  { id: L.id, params: a }
244
245
  ],
245
246
  redoMutations: [
246
- ...(M = m.preRedos) != null ? M : [],
247
- f,
248
- ...m.redos,
247
+ ...(M = f.preRedos) != null ? M : [],
248
+ m,
249
+ ...f.redos,
249
250
  { id: L.id, params: a }
250
251
  ]
251
252
  }), !0) : !1;
252
253
  }
253
- }, Wr = {
254
+ }, jr = {
254
255
  id: "sheet.command.set-drawing-arrange",
255
256
  type: te.COMMAND,
256
257
  handler: (i, t) => {
257
- const e = i.get(K), n = i.get($e);
258
+ const e = i.get(K), n = i.get(Be);
258
259
  if (!t) return !1;
259
260
  const r = i.get(ie), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: c } = t, u = { unitId: s, subUnitId: o, drawingIds: a };
260
261
  let d;
261
- if (c === Ot.forward ? d = r.getForwardDrawingsOp(u) : c === Ot.backward ? d = r.getBackwardDrawingOp(u) : c === Ot.front ? d = r.getFrontDrawingsOp(u) : c === Ot.back && (d = r.getBackDrawingsOp(u)), d == null)
262
+ if (c === Ut.forward ? d = r.getForwardDrawingsOp(u) : c === Ut.backward ? d = r.getBackwardDrawingOp(u) : c === Ut.front ? d = r.getFrontDrawingsOp(u) : c === Ut.back && (d = r.getBackDrawingsOp(u)), d == null)
262
263
  return !1;
263
264
  const { objects: l, redo: g, undo: h } = d;
264
265
  return e.syncExecuteCommand(A.id, { op: g, unitId: s, subUnitId: o, objects: l, type: P.ARRANGE }) ? (n.pushUndoRedo({
@@ -271,47 +272,47 @@ const Br = {
271
272
  ]
272
273
  }), !0) : !1;
273
274
  }
274
- }, vt = {
275
+ }, It = {
275
276
  id: "sheet.command.set-sheet-image",
276
277
  type: te.COMMAND,
277
278
  handler: (i, t) => {
278
279
  var S, _;
279
- const e = i.get(K), n = i.get($e), r = i.get(ie), s = i.get(wt);
280
+ const e = i.get(K), n = i.get(Be), r = i.get(ie), s = i.get(St);
280
281
  if (!t) return !1;
281
- const { drawings: o } = t, a = r.getBatchUpdateOp(o), { unitId: c, subUnitId: u, undo: d, redo: l, objects: g } = a, h = s.onCommandExecute({ id: vt.id, params: t }), m = [
282
+ const { drawings: o } = t, a = r.getBatchUpdateOp(o), { unitId: c, subUnitId: u, undo: d, redo: l, objects: g } = a, h = s.onCommandExecute({ id: It.id, params: t }), f = [
282
283
  ...(S = h.preRedos) != null ? S : [],
283
284
  { id: A.id, params: { unitId: c, subUnitId: u, op: l, objects: g, type: P.UPDATE } },
284
285
  ...h.redos,
285
286
  { id: L.id, params: [c] }
286
- ], f = [
287
+ ], m = [
287
288
  ...(_ = h.preUndos) != null ? _ : [],
288
289
  { id: A.id, params: { unitId: c, subUnitId: u, op: d, objects: g, type: P.UPDATE } },
289
290
  ...h.undos,
290
291
  { id: L.id, params: [c] }
291
292
  ];
292
- return zt(m, e) ? (n.pushUndoRedo({
293
+ return zt(f, e) ? (n.pushUndoRedo({
293
294
  unitID: c,
294
- undoMutations: f,
295
- redoMutations: m
295
+ undoMutations: m,
296
+ redoMutations: f
296
297
  }), !0) : !1;
297
298
  }
298
- }, jr = {
299
+ }, Fr = {
299
300
  id: "sheet.command.ungroup-sheet-image",
300
301
  type: te.COMMAND,
301
302
  handler: (i, t) => {
302
- const e = i.get(K), n = i.get($e), r = i.get(ie);
303
+ const e = i.get(K), n = i.get(Be), r = i.get(ie);
303
304
  if (!t) return !1;
304
305
  const s = [];
305
- t.forEach(({ parent: h, children: m }) => {
306
- s.push(h.unitId), m.forEach((f) => {
307
- s.push(f.unitId);
306
+ t.forEach(({ parent: h, children: f }) => {
307
+ s.push(h.unitId), f.forEach((m) => {
308
+ s.push(m.unitId);
308
309
  });
309
310
  });
310
311
  const o = r.getUngroupDrawingOp(t), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = o;
311
312
  return e.syncExecuteCommand(A.id, { op: d, unitId: a, subUnitId: c, objects: l, type: P.UNGROUP }) ? (n.pushUndoRedo({
312
313
  unitID: a,
313
314
  undoMutations: [
314
- { id: A.id, params: { op: u, unitId: a, subUnitId: c, objects: Ts(l), type: P.GROUP } },
315
+ { id: A.id, params: { op: u, unitId: a, subUnitId: c, objects: Es(l), type: P.GROUP } },
315
316
  { id: L.id, params: s }
316
317
  ],
317
318
  redoMutations: [
@@ -321,49 +322,49 @@ const Br = {
321
322
  }), !0) : !1;
322
323
  }
323
324
  };
324
- var Os = Object.getOwnPropertyDescriptor, Us = (i, t, e, n) => {
325
- for (var r = n > 1 ? void 0 : n ? Os(t, e) : t, s = i.length - 1, o; s >= 0; s--)
325
+ var Us = Object.getOwnPropertyDescriptor, Ps = (i, t, e, n) => {
326
+ for (var r = n > 1 ? void 0 : n ? Us(t, e) : t, s = i.length - 1, o; s >= 0; s--)
326
327
  (o = i[s]) && (r = o(r) || r);
327
328
  return r;
328
329
  }, ne = (i, t) => (e, n) => t(e, n, i);
329
- function Ps(i, t, e) {
330
+ function As(i, t, e) {
330
331
  const n = e * Math.PI / 180, r = Math.abs(i * Math.cos(n)) + Math.abs(t * Math.sin(n)), s = Math.abs(i * Math.sin(n)) + Math.abs(t * Math.cos(n));
331
332
  return { rotatedWidth: r, rotatedHeight: s };
332
333
  }
333
- function vn(i, t, e, n, r) {
334
+ function In(i, t, e, n, r) {
334
335
  var _;
335
- const { rotatedHeight: s, rotatedWidth: o } = Ps(e, n, r), c = i.get(ee).getRenderById(t.unitId);
336
+ const { rotatedHeight: s, rotatedWidth: o } = As(e, n, r), c = i.get(ee).getRenderById(t.unitId);
336
337
  if (!c)
337
338
  return !1;
338
339
  const d = (_ = c.with(Z).getSkeletonParam(t.subUnitId)) == null ? void 0 : _.skeleton;
339
340
  if (d == null)
340
341
  return !1;
341
- const l = d.getCellByIndex(t.row, t.col), g = l.mergeInfo.endX - l.mergeInfo.startX - 2, h = l.mergeInfo.endY - l.mergeInfo.startY - 2, m = o / s, p = Math.ceil(Math.min(g, h * m)) / o, S = !p || Number.isNaN(p) ? 1e-3 : p;
342
+ const l = d.getCellByIndex(t.row, t.col), g = l.mergeInfo.endX - l.mergeInfo.startX - 2, h = l.mergeInfo.endY - l.mergeInfo.startY - 2, f = o / s, p = Math.ceil(Math.min(g, h * f)) / o, S = !p || Number.isNaN(p) ? 1e-3 : p;
342
343
  return {
343
344
  width: e * S,
344
345
  height: n * S
345
346
  };
346
347
  }
347
- let ft = class extends re {
348
- constructor(t, e, n, r, s, o, a, c, u, d, l, g, h, m) {
348
+ let pt = class extends re {
349
+ constructor(t, e, n, r, s, o, a, c, u, d, l, g, h, f) {
349
350
  super();
350
351
  ae(this, "_workbookSelections");
351
- this._context = t, this._skeletonManagerService = e, this._commandService = n, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = a, this._drawingManagerService = c, this._contextService = u, this._messageService = d, this._localeService = l, this._injector = h, this._urlImageService = m, this._workbookSelections = g.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
352
+ this._context = t, this._skeletonManagerService = e, this._commandService = n, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = a, this._drawingManagerService = c, this._contextService = u, this._messageService = d, this._localeService = l, this._injector = h, this._urlImageService = f, this._workbookSelections = g.getWorkbookSelections(this._context.unitId), this._updateDrawingListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
352
353
  }
353
354
  async insertFloatImage() {
354
355
  const t = await this._fileOpenerService.openFile({
355
356
  multiple: !0,
356
- accept: Zn.map((n) => `.${n.replace("image/", "")}`).join(",")
357
+ accept: qn.map((n) => `.${n.replace("image/", "")}`).join(",")
357
358
  }), e = t.length;
358
- return e > qn ? (this._messageService.show({
359
+ return e > Qn ? (this._messageService.show({
359
360
  type: Me.Error,
360
- content: this._localeService.t("update-status.exceedMaxCount", String(qn))
361
+ content: this._localeService.t("update-status.exceedMaxCount", String(Qn))
361
362
  }), !1) : e === 0 ? !1 : (t.forEach(async (n) => await this.insertFloatImageByFile(n)), !0);
362
363
  }
363
364
  async insertCellImage() {
364
365
  const e = (await this._fileOpenerService.openFile({
365
366
  multiple: !1,
366
- accept: Zn.map((n) => `.${n.replace("image/", "")}`).join(",")
367
+ accept: qn.map((n) => `.${n.replace("image/", "")}`).join(",")
367
368
  }))[0];
368
369
  return e ? (await this._insertCellImage(e), !0) : !1;
369
370
  }
@@ -377,34 +378,34 @@ let ft = class extends re {
377
378
  e = await this._imageIoService.saveImage(t);
378
379
  } catch (M) {
379
380
  const I = M.message;
380
- I === Ve.ERROR_EXCEED_SIZE ? this._messageService.show({
381
+ I === Ge.ERROR_EXCEED_SIZE ? this._messageService.show({
381
382
  type: Me.Error,
382
- content: this._localeService.t("update-status.exceedMaxSize", String(Qn / (1024 * 1024)))
383
- }) : I === Ve.ERROR_IMAGE_TYPE ? this._messageService.show({
383
+ content: this._localeService.t("update-status.exceedMaxSize", String(er / (1024 * 1024)))
384
+ }) : I === Ge.ERROR_IMAGE_TYPE ? this._messageService.show({
384
385
  type: Me.Error,
385
386
  content: this._localeService.t("update-status.invalidImageType")
386
- }) : I === Ve.ERROR_IMAGE && this._messageService.show({
387
+ }) : I === Ge.ERROR_IMAGE && this._messageService.show({
387
388
  type: Me.Error,
388
389
  content: this._localeService.t("update-status.invalidImage")
389
390
  });
390
391
  }
391
392
  if (e == null)
392
393
  return;
393
- const n = this._getUnitInfo(), { unitId: r, subUnitId: s } = n, { imageId: o, imageSourceType: a, source: c, base64Cache: u } = e, { width: d, height: l, image: g } = await on(u || ""), { width: h, height: m } = this._context.scene;
394
+ const n = this._getUnitInfo(), { unitId: r, subUnitId: s } = n, { imageId: o, imageSourceType: a, source: c, base64Cache: u } = e, { width: d, height: l, image: g } = await an(u || ""), { width: h, height: f } = this._context.scene;
394
395
  this._imageIoService.addImageSourceCache(c, a, g);
395
- let f = 1;
396
- if (d > er || l > tr) {
397
- const M = er / d, I = tr / l;
398
- f = Math.max(M, I);
396
+ let m = 1;
397
+ if (d > tr || l > nr) {
398
+ const M = tr / d, I = nr / l;
399
+ m = Math.max(M, I);
399
400
  }
400
- const p = this._getImagePosition(d * f, l * f, h, m);
401
+ const p = this._getImagePosition(d * m, l * m, h, f);
401
402
  if (p == null)
402
403
  return;
403
404
  const S = Q(p, this._selectionRenderService, this._skeletonManagerService), _ = {
404
405
  unitId: r,
405
406
  subUnitId: s,
406
407
  drawingId: o,
407
- drawingType: $.DRAWING_IMAGE,
408
+ drawingType: B.DRAWING_IMAGE,
408
409
  imageSourceType: a,
409
410
  source: c,
410
411
  transform: S,
@@ -424,27 +425,27 @@ let ft = class extends re {
424
425
  n = await this._imageIoService.saveImage(t);
425
426
  } catch (I) {
426
427
  const v = I.message;
427
- v === Ve.ERROR_EXCEED_SIZE ? this._messageService.show({
428
+ v === Ge.ERROR_EXCEED_SIZE ? this._messageService.show({
428
429
  type: Me.Error,
429
- content: this._localeService.t("update-status.exceedMaxSize", String(Qn / (1024 * 1024)))
430
- }) : v === Ve.ERROR_IMAGE_TYPE ? this._messageService.show({
430
+ content: this._localeService.t("update-status.exceedMaxSize", String(er / (1024 * 1024)))
431
+ }) : v === Ge.ERROR_IMAGE_TYPE ? this._messageService.show({
431
432
  type: Me.Error,
432
433
  content: this._localeService.t("update-status.invalidImageType")
433
- }) : v === Ve.ERROR_IMAGE && this._messageService.show({
434
+ }) : v === Ge.ERROR_IMAGE && this._messageService.show({
434
435
  type: Me.Error,
435
436
  content: this._localeService.t("update-status.invalidImage")
436
437
  });
437
438
  }
438
439
  if (n == null)
439
440
  return !1;
440
- const { imageId: r, imageSourceType: s, source: o, base64Cache: a } = n, { width: c, height: u, image: d } = await on(a || "");
441
+ const { imageId: r, imageSourceType: s, source: o, base64Cache: a } = n, { width: c, height: u, image: d } = await an(a || "");
441
442
  this._imageIoService.addImageSourceCache(o, s, d);
442
443
  const l = this._workbookSelections.getCurrentLastSelection();
443
444
  if (!l)
444
445
  return !1;
445
446
  let g = l.primary.actualRow, h = l.primary.actualColumn;
446
447
  l.primary.isMerged && (g = l.primary.startRow, h = l.primary.startColumn);
447
- const m = gn("", {}), f = vn(
448
+ const f = fn("", {}), m = In(
448
449
  this._injector,
449
450
  {
450
451
  unitId: this._context.unitId,
@@ -456,43 +457,43 @@ let ft = class extends re {
456
457
  u,
457
458
  0
458
459
  );
459
- if (!f)
460
+ if (!m)
460
461
  return !1;
461
462
  const p = {
462
463
  size: {
463
- width: f.width,
464
- height: f.height
464
+ width: m.width,
465
+ height: m.height
465
466
  },
466
467
  positionH: {
467
- relativeFrom: jn.PAGE,
468
+ relativeFrom: Fn.PAGE,
468
469
  posOffset: 0
469
470
  },
470
471
  positionV: {
471
- relativeFrom: Wn.PARAGRAPH,
472
+ relativeFrom: jn.PARAGRAPH,
472
473
  posOffset: 0
473
474
  },
474
475
  angle: 0
475
476
  }, S = {
476
- unitId: m.getUnitId(),
477
- subUnitId: m.getUnitId(),
477
+ unitId: f.getUnitId(),
478
+ subUnitId: f.getUnitId(),
478
479
  drawingId: r,
479
- drawingType: $.DRAWING_IMAGE,
480
+ drawingType: B.DRAWING_IMAGE,
480
481
  imageSourceType: s,
481
482
  source: o,
482
- transform: Jn(p),
483
+ transform: Zn(p),
483
484
  docTransform: p,
484
- behindDoc: Hn.FALSE,
485
+ behindDoc: Vn.FALSE,
485
486
  title: "",
486
487
  description: "",
487
- layoutType: Ln.INLINE,
488
+ layoutType: Hn.INLINE,
488
489
  // Insert inline drawing by default.
489
- wrapText: Fn.BOTH_SIDES,
490
+ wrapText: Ln.BOTH_SIDES,
490
491
  distB: 0,
491
492
  distL: 0,
492
493
  distR: 0,
493
494
  distT: 0
494
495
  }, _ = mn.drawing.add({
495
- documentDataModel: m,
496
+ documentDataModel: f,
496
497
  drawings: [S],
497
498
  selection: {
498
499
  collapsed: !0,
@@ -500,11 +501,11 @@ let ft = class extends re {
500
501
  endOffset: 0
501
502
  }
502
503
  });
503
- return _ ? (m.apply(_), this._commandService.syncExecuteCommand(Gn.id, {
504
+ return _ ? (f.apply(_), this._commandService.syncExecuteCommand(Gn.id, {
504
505
  value: {
505
506
  [(R = e == null ? void 0 : e.row) != null ? R : g]: {
506
507
  [(M = e == null ? void 0 : e.col) != null ? M : h]: {
507
- p: m.getSnapshot(),
508
+ p: f.getSnapshot(),
508
509
  t: 1
509
510
  }
510
511
  }
@@ -515,19 +516,19 @@ let ft = class extends re {
515
516
  }
516
517
  // eslint-disable-next-line max-lines-per-function
517
518
  async insertCellImageByUrl(t, e) {
518
- var h, m;
519
+ var h, f;
519
520
  let n = t;
520
521
  try {
521
522
  n = await this._urlImageService.getImage(t);
522
- } catch (f) {
523
- console.error(`Failed to get image from URLImageService: ${t}`, f);
523
+ } catch (m) {
524
+ console.error(`Failed to get image from URLImageService: ${t}`, m);
524
525
  }
525
- const { width: r, height: s, image: o } = await on(n || "");
526
+ const { width: r, height: s, image: o } = await an(n || "");
526
527
  this._imageIoService.addImageSourceCache(t, Ce.URL, o);
527
528
  const a = this._workbookSelections.getCurrentLastSelection();
528
529
  if (!a)
529
530
  return !1;
530
- const c = gn("", {}), u = vn(
531
+ const c = fn("", {}), u = In(
531
532
  this._injector,
532
533
  {
533
534
  unitId: this._context.unitId,
@@ -547,11 +548,11 @@ let ft = class extends re {
547
548
  height: u.height
548
549
  },
549
550
  positionH: {
550
- relativeFrom: jn.PAGE,
551
+ relativeFrom: Fn.PAGE,
551
552
  posOffset: 0
552
553
  },
553
554
  positionV: {
554
- relativeFrom: Wn.PARAGRAPH,
555
+ relativeFrom: jn.PARAGRAPH,
555
556
  posOffset: 0
556
557
  },
557
558
  angle: 0
@@ -559,17 +560,17 @@ let ft = class extends re {
559
560
  unitId: c.getUnitId(),
560
561
  subUnitId: c.getUnitId(),
561
562
  drawingId: Ze(),
562
- drawingType: $.DRAWING_IMAGE,
563
+ drawingType: B.DRAWING_IMAGE,
563
564
  imageSourceType: Ce.URL,
564
565
  source: t,
565
- transform: Jn(d),
566
+ transform: Zn(d),
566
567
  docTransform: d,
567
- behindDoc: Hn.FALSE,
568
+ behindDoc: Vn.FALSE,
568
569
  title: "",
569
570
  description: "",
570
- layoutType: Ln.INLINE,
571
+ layoutType: Hn.INLINE,
571
572
  // Insert inline drawing by default.
572
- wrapText: Fn.BOTH_SIDES,
573
+ wrapText: Ln.BOTH_SIDES,
573
574
  distB: 0,
574
575
  distL: 0,
575
576
  distR: 0,
@@ -586,7 +587,7 @@ let ft = class extends re {
586
587
  return g ? (c.apply(g), this._commandService.syncExecuteCommand(Gn.id, {
587
588
  value: {
588
589
  [(h = e == null ? void 0 : e.row) != null ? h : a.primary.actualRow]: {
589
- [(m = e == null ? void 0 : e.col) != null ? m : a.primary.actualColumn]: {
590
+ [(f = e == null ? void 0 : e.col) != null ? f : a.primary.actualColumn]: {
590
591
  p: c.getSnapshot(),
591
592
  t: 1
592
593
  }
@@ -612,7 +613,7 @@ let ft = class extends re {
612
613
  endColumn: 0
613
614
  };
614
615
  s && s.length > 0 && (o = s[s.length - 1].range);
615
- const a = ur(this._skeletonManagerService.getCurrent().skeleton, o);
616
+ const a = hr(this._skeletonManagerService.getCurrent().skeleton, o);
616
617
  if (a == null)
617
618
  return;
618
619
  let { startColumn: c, startRow: u, startX: d, startY: l } = a, g = !1;
@@ -627,24 +628,24 @@ let ft = class extends re {
627
628
  columnOffset: 0,
628
629
  row: u,
629
630
  rowOffset: 0
630
- }, m = this._selectionRenderService.getCellWithCoordByOffset(d + t, l + e);
631
- if (m == null)
631
+ }, f = this._selectionRenderService.getCellWithCoordByOffset(d + t, l + e);
632
+ if (f == null)
632
633
  return;
633
- const f = {
634
- column: m.actualColumn,
635
- columnOffset: d + t - m.startX,
636
- row: m.actualRow,
637
- rowOffset: l + e - m.startY
634
+ const m = {
635
+ column: f.actualColumn,
636
+ columnOffset: d + t - f.startX,
637
+ row: f.actualRow,
638
+ rowOffset: l + e - f.startY
638
639
  };
639
640
  return {
640
641
  from: h,
641
- to: f
642
+ to: m
642
643
  };
643
644
  }
644
645
  _updateOrderListener() {
645
646
  this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((t) => {
646
647
  const { unitId: e, subUnitId: n, drawingIds: r, arrangeType: s } = t;
647
- this._commandService.executeCommand(Wr.id, {
648
+ this._commandService.executeCommand(jr.id, {
648
649
  unitId: e,
649
650
  subUnitId: n,
650
651
  drawingIds: r,
@@ -652,7 +653,7 @@ let ft = class extends re {
652
653
  });
653
654
  }));
654
655
  }
655
- _updateImageListener() {
656
+ _updateDrawingListener() {
656
657
  this.disposeWithMe(this._drawingManagerService.featurePluginUpdate$.subscribe((t) => {
657
658
  const e = [];
658
659
  t.length !== 0 && (t.forEach((n) => {
@@ -672,29 +673,30 @@ let ft = class extends re {
672
673
  axisAlignSheetTransform: { ...l }
673
674
  };
674
675
  e.push(g);
675
- }), e.length > 0 && this._commandService.executeCommand(vt.id, {
676
+ }), e.length > 0 && this._commandService.executeCommand(It.id, {
676
677
  unitId: t[0].unitId,
677
678
  drawings: e
678
679
  }));
679
680
  }));
680
681
  }
681
- _getSheetTransformByParam(t) {
682
- const { unitId: e, subUnitId: n, drawingId: r, transform: s } = t;
683
- if (s == null)
682
+ _getSheetTransformByParam(t, e) {
683
+ const { unitId: n, subUnitId: r, drawingId: s, transform: o } = t;
684
+ if (o == null)
684
685
  return null;
685
- const o = this._sheetDrawingService.getDrawingByParam({ unitId: e, subUnitId: n, drawingId: r });
686
- if (o == null || o.unitId !== this._context.unitId)
686
+ const a = this._sheetDrawingService.getDrawingByParam({ unitId: n, subUnitId: r, drawingId: s });
687
+ let c = a == null ? void 0 : a.transform;
688
+ if (e && (c = {}), !e && (a == null || a.unitId !== this._context.unitId))
687
689
  return null;
688
- const a = j({ ...o.transform, ...s }, this._selectionRenderService), c = F({ ...o.transform, ...s }, this._selectionRenderService);
689
- return a == null || c == null ? null : { sheetTransform: a, axisAlignSheetTransform: c };
690
+ const u = j({ ...c, ...o }, this._selectionRenderService), d = F({ ...c, ...o }, this._selectionRenderService);
691
+ return u == null || d == null ? null : { sheetTransform: u, axisAlignSheetTransform: d };
690
692
  }
691
693
  _groupDrawingListener() {
692
694
  this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((t) => {
693
695
  const e = [];
694
696
  for (const n of t) {
695
- const r = this._getSheetTransformByParam(n.parent), s = [];
697
+ const r = this._getSheetTransformByParam(n.parent, !0), s = [];
696
698
  for (const a of n.children) {
697
- const c = this._getSheetTransformByParam(a);
699
+ const c = this._getSheetTransformByParam(a, !1);
698
700
  c != null && s.push({
699
701
  ...a,
700
702
  sheetTransform: c.sheetTransform,
@@ -702,13 +704,13 @@ let ft = class extends re {
702
704
  });
703
705
  }
704
706
  const o = {
705
- parent: { ...n.parent, sheetTransform: r },
707
+ parent: { ...n.parent, sheetTransform: r == null ? void 0 : r.sheetTransform, axisAlignSheetTransform: r == null ? void 0 : r.axisAlignSheetTransform },
706
708
  children: s
707
709
  };
708
710
  e.push(o);
709
711
  }
710
712
  if (e.length > 0) {
711
- this._commandService.executeCommand(Br.id, e);
713
+ this._commandService.executeCommand(Wr.id, e);
712
714
  const { unitId: n, subUnitId: r, drawingId: s } = t[0].parent;
713
715
  this._commandService.syncExecuteCommand(Kt.id, [{ unitId: n, subUnitId: r, drawingId: s }]);
714
716
  }
@@ -717,10 +719,11 @@ let ft = class extends re {
717
719
  for (const n of t) {
718
720
  const { children: r } = n, s = [];
719
721
  for (const o of r) {
720
- const a = this._getSheetTransformByParam(o);
722
+ const a = this._getSheetTransformByParam(o, !1);
721
723
  a != null && s.push({
722
724
  ...o,
723
- sheetTransform: a
725
+ sheetTransform: a.sheetTransform,
726
+ axisAlignSheetTransform: a.axisAlignSheetTransform
724
727
  });
725
728
  }
726
729
  e.push({
@@ -728,7 +731,7 @@ let ft = class extends re {
728
731
  children: s
729
732
  });
730
733
  }
731
- this._commandService.executeCommand(jr.id, e);
734
+ this._commandService.executeCommand(Fr.id, e);
732
735
  }));
733
736
  }
734
737
  _focusDrawingListener() {
@@ -739,31 +742,31 @@ let ft = class extends re {
739
742
  );
740
743
  }
741
744
  };
742
- ft = Us([
745
+ pt = Ps([
743
746
  ne(1, N(Z)),
744
747
  ne(2, K),
745
748
  ne(3, Oe),
746
- ne(4, ss),
747
- ne(5, cs),
749
+ ne(4, os),
750
+ ne(5, ds),
748
751
  ne(6, ie),
749
752
  ne(7, de),
750
- ne(8, hr),
751
- ne(9, Ar),
752
- ne(10, N(Be)),
753
- ne(11, N(St)),
754
- ne(12, N(it)),
755
- ne(13, gr)
756
- ], ft);
753
+ ne(8, gr),
754
+ ne(9, Nr),
755
+ ne(10, N($e)),
756
+ ne(11, N(_t)),
757
+ ne(12, N(st)),
758
+ ne(13, fr)
759
+ ], pt);
757
760
  const Qt = {
758
761
  id: "sheet.command.insert-float-image",
759
762
  type: te.COMMAND,
760
763
  handler: async (i, t) => {
761
764
  var o, a;
762
- const e = i.get(he), n = i.get(ee), r = (o = yn(
763
- B.UNIVER_SHEET,
765
+ const e = i.get(he), n = i.get(ee), r = (o = Tn(
766
+ $.UNIVER_SHEET,
764
767
  e,
765
768
  n
766
- )) == null ? void 0 : o.with(ft);
769
+ )) == null ? void 0 : o.with(pt);
767
770
  if (!r)
768
771
  return !1;
769
772
  const s = t == null ? void 0 : t.files;
@@ -773,19 +776,19 @@ const Qt = {
773
776
  } else
774
777
  return (a = r.insertFloatImage()) != null ? a : !1;
775
778
  }
776
- }, En = {
779
+ }, On = {
777
780
  id: "sheet.command.insert-cell-image",
778
781
  type: te.COMMAND,
779
782
  handler: (i) => {
780
783
  var n, r;
781
784
  const t = i.get(he), e = i.get(ee);
782
- return (r = (n = yn(
783
- B.UNIVER_SHEET,
785
+ return (r = (n = Tn(
786
+ $.UNIVER_SHEET,
784
787
  t,
785
788
  e
786
- )) == null ? void 0 : n.with(ft).insertCellImage()) != null ? r : !1;
789
+ )) == null ? void 0 : n.with(pt).insertCellImage()) != null ? r : !1;
787
790
  }
788
- }, It = {
791
+ }, Ct = {
789
792
  id: "sheet.command.move-drawing",
790
793
  type: te.COMMAND,
791
794
  handler: (i, t) => {
@@ -796,51 +799,51 @@ const Qt = {
796
799
  const { transform: l } = d;
797
800
  if (l == null)
798
801
  return null;
799
- const g = { ...l }, { left: h = 0, top: m = 0 } = l;
800
- return s === Te.UP ? g.top = m - 1 : s === Te.DOWN ? g.top = m + 1 : s === Te.LEFT ? g.left = h - 1 : s === Te.RIGHT && (g.left = h + 1), {
802
+ const g = { ...l }, { left: h = 0, top: f = 0 } = l;
803
+ return s === Te.UP ? g.top = f - 1 : s === Te.DOWN ? g.top = f + 1 : s === Te.LEFT ? g.left = h - 1 : s === Te.RIGHT && (g.left = h + 1), {
801
804
  ...d,
802
805
  transform: g,
803
806
  sheetTransform: j(g, r),
804
807
  axisAlignSheetTransform: F(g, r)
805
808
  };
806
809
  }).filter((d) => d != null);
807
- return e.syncExecuteCommand(vt.id, {
810
+ return e.syncExecuteCommand(It.id, {
808
811
  unitId: a,
809
812
  drawings: c
810
813
  }) ? (e.syncExecuteCommand(L.id, [a]), !0) : !1;
811
814
  }
812
815
  };
813
- var As = Object.getOwnPropertyDescriptor, Ns = (i, t, e, n) => {
814
- for (var r = n > 1 ? void 0 : n ? As(t, e) : t, s = i.length - 1, o; s >= 0; s--)
816
+ var Ns = Object.getOwnPropertyDescriptor, xs = (i, t, e, n) => {
817
+ for (var r = n > 1 ? void 0 : n ? Ns(t, e) : t, s = i.length - 1, o; s >= 0; s--)
815
818
  (o = i[s]) && (r = o(r) || r);
816
819
  return r;
817
- }, At = (i, t) => (e, n) => t(e, n, i), xe = /* @__PURE__ */ ((i) => (i.CELL_ADDRESS = "cellAddress", i.COLUMN_VALUE = "columnValue", i))(xe || {});
818
- const On = mi("sheets-drawing-ui.batch-save-images.service");
819
- function In(i) {
820
+ }, Nt = (i, t) => (e, n) => t(e, n, i), xe = /* @__PURE__ */ ((i) => (i.CELL_ADDRESS = "cellAddress", i.COLUMN_VALUE = "columnValue", i))(xe || {});
821
+ const Un = mi("sheets-drawing-ui.batch-save-images.service");
822
+ function Cn(i) {
820
823
  let t = "", e = i;
821
824
  for (; e >= 0; )
822
825
  t = String.fromCharCode(e % 26 + 65) + t, e = Math.floor(e / 26) - 1;
823
826
  return t;
824
827
  }
825
- function Bt(i, t) {
826
- return `${In(t)}${i + 1}`;
828
+ function Wt(i, t) {
829
+ return `${Cn(t)}${i + 1}`;
827
830
  }
828
- function xs(i) {
829
- const t = Bt(i.startRow, i.startColumn), e = Bt(i.endRow, i.endColumn);
831
+ function ks(i) {
832
+ const t = Wt(i.startRow, i.startColumn), e = Wt(i.endRow, i.endColumn);
830
833
  return t === e ? t : `${t}:${e}`;
831
834
  }
832
- function ir(i) {
835
+ function sr(i) {
833
836
  var t, e, n, r;
834
837
  return !!((e = (t = i == null ? void 0 : i.p) == null ? void 0 : t.drawingsOrder) != null && e.length && ((r = (n = i == null ? void 0 : i.p) == null ? void 0 : n.drawingsOrder) == null ? void 0 : r.length) > 0);
835
838
  }
836
- function sr(i) {
839
+ function or(i) {
837
840
  var n, r, s;
838
841
  if (!((r = (n = i.p) == null ? void 0 : n.drawingsOrder) != null && r.length) || !((s = i.p) != null && s.drawings))
839
842
  return null;
840
843
  const t = i.p.drawingsOrder[0], e = i.p.drawings[t];
841
844
  return !e || !("source" in e) || !("imageSourceType" in e) ? null : e;
842
845
  }
843
- function ln(i, t) {
846
+ function un(i, t) {
844
847
  if (t === Ce.BASE64) {
845
848
  const e = i.match(/^data:image\/(\w+);/);
846
849
  if (e)
@@ -853,14 +856,14 @@ function ln(i, t) {
853
856
  }
854
857
  return "png";
855
858
  }
856
- async function or(i, t) {
859
+ async function ar(i, t) {
857
860
  if (t === Ce.BASE64)
858
861
  return (await fetch(i)).blob();
859
862
  if (t === Ce.URL)
860
863
  return (await fetch(i)).blob();
861
864
  throw new Error("UUID image type requires additional handling");
862
865
  }
863
- let Cn = class extends re {
866
+ let Rn = class extends re {
864
867
  constructor(i, t, e, n) {
865
868
  super(), this._univerInstanceService = i, this._selectionService = t, this._imageIoService = e, this._urlImageService = n;
866
869
  }
@@ -871,7 +874,7 @@ let Cn = class extends re {
871
874
  return this._urlImageService.registerURLImageDownloader(i);
872
875
  }
873
876
  getCellImagesInSelection() {
874
- const i = this._univerInstanceService.getCurrentUnitForType(B.UNIVER_SHEET);
877
+ const i = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
875
878
  if (!i) return [];
876
879
  const t = i.getActiveSheet();
877
880
  if (!t) return [];
@@ -883,12 +886,12 @@ let Cn = class extends re {
883
886
  for (let d = o; d <= a; d++)
884
887
  for (let l = c; l <= u; l++) {
885
888
  const g = n.getValue(d, l);
886
- if (ir(g)) {
887
- const h = sr(g);
889
+ if (sr(g)) {
890
+ const h = or(g);
888
891
  h && r.push({
889
892
  row: d,
890
893
  col: l,
891
- cellAddress: Bt(d, l),
894
+ cellAddress: Wt(d, l),
892
895
  source: h.source,
893
896
  imageSourceType: h.imageSourceType,
894
897
  imageId: h.drawingId
@@ -899,7 +902,7 @@ let Cn = class extends re {
899
902
  return r;
900
903
  }
901
904
  getCellImagesFromRanges(i, t, e) {
902
- const n = this._univerInstanceService.getUnit(i, B.UNIVER_SHEET);
905
+ const n = this._univerInstanceService.getUnit(i, $.UNIVER_SHEET);
903
906
  if (!n) return [];
904
907
  const r = n.getSheetBySheetId(t);
905
908
  if (!r) return [];
@@ -908,16 +911,16 @@ let Cn = class extends re {
908
911
  const { startRow: c, endRow: u, startColumn: d, endColumn: l } = a;
909
912
  for (let g = c; g <= u; g++)
910
913
  for (let h = d; h <= l; h++) {
911
- const m = s.getValue(g, h);
912
- if (ir(m)) {
913
- const f = sr(m);
914
- f && o.push({
914
+ const f = s.getValue(g, h);
915
+ if (sr(f)) {
916
+ const m = or(f);
917
+ m && o.push({
915
918
  row: g,
916
919
  col: h,
917
- cellAddress: Bt(g, h),
918
- source: f.source,
919
- imageSourceType: f.imageSourceType,
920
- imageId: f.drawingId
920
+ cellAddress: Wt(g, h),
921
+ source: m.source,
922
+ imageSourceType: m.imageSourceType,
923
+ imageId: m.drawingId
921
924
  });
922
925
  }
923
926
  }
@@ -925,8 +928,8 @@ let Cn = class extends re {
925
928
  return o;
926
929
  }
927
930
  getDataColumns() {
928
- var l, g, h, m;
929
- const i = this._univerInstanceService.getCurrentUnitForType(B.UNIVER_SHEET);
931
+ var l, g, h, f;
932
+ const i = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
930
933
  if (!i) return [];
931
934
  const t = i.getActiveSheet();
932
935
  if (!t) return [];
@@ -935,32 +938,32 @@ let Cn = class extends re {
935
938
  const n = t.getCellMatrix(), r = n.getDataRange();
936
939
  let s = 1 / 0, o = -1 / 0;
937
940
  const a = /* @__PURE__ */ new Set();
938
- for (const f of e) {
939
- s = Math.min(s, f.range.startRow), o = Math.max(o, f.range.endRow);
940
- for (let p = f.range.startColumn; p <= f.range.endColumn; p++)
941
+ for (const m of e) {
942
+ s = Math.min(s, m.range.startRow), o = Math.max(o, m.range.endRow);
943
+ for (let p = m.range.startColumn; p <= m.range.endColumn; p++)
941
944
  a.add(p);
942
945
  }
943
946
  const c = /* @__PURE__ */ new Set();
944
- for (let f = r.startColumn; f <= r.endColumn; f++)
945
- if (!a.has(f))
947
+ for (let m = r.startColumn; m <= r.endColumn; m++)
948
+ if (!a.has(m))
946
949
  for (let p = s; p <= o; p++) {
947
- const S = n.getValue(p, f);
948
- if (S && (((l = S.v) == null ? void 0 : l.toString()) || ((m = (h = (g = S.p) == null ? void 0 : g.body) == null ? void 0 : h.dataStream) == null ? void 0 : m.trim()) || "")) {
949
- c.add(f);
950
+ const S = n.getValue(p, m);
951
+ if (S && (((l = S.v) == null ? void 0 : l.toString()) || ((f = (h = (g = S.p) == null ? void 0 : g.body) == null ? void 0 : h.dataStream) == null ? void 0 : f.trim()) || "")) {
952
+ c.add(m);
950
953
  break;
951
954
  }
952
955
  }
953
- const u = [], d = Array.from(c).sort((f, p) => f - p);
954
- for (const f of d)
956
+ const u = [], d = Array.from(c).sort((m, p) => m - p);
957
+ for (const m of d)
955
958
  u.push({
956
- index: f,
957
- label: In(f)
959
+ index: m,
960
+ label: Cn(m)
958
961
  });
959
962
  return u;
960
963
  }
961
964
  getDataColumnsForRanges(i, t, e) {
962
- var h, m, f, p;
963
- const n = this._univerInstanceService.getUnit(i, B.UNIVER_SHEET);
965
+ var h, f, m, p;
966
+ const n = this._univerInstanceService.getUnit(i, $.UNIVER_SHEET);
964
967
  if (!n) return [];
965
968
  const r = n.getSheetBySheetId(t);
966
969
  if (!r) return [];
@@ -977,7 +980,7 @@ let Cn = class extends re {
977
980
  if (!u.has(S))
978
981
  for (let _ = a; _ <= c; _++) {
979
982
  const R = s.getValue(_, S);
980
- if (R && (((h = R.v) == null ? void 0 : h.toString()) || ((p = (f = (m = R.p) == null ? void 0 : m.body) == null ? void 0 : f.dataStream) == null ? void 0 : p.trim()) || "")) {
983
+ if (R && (((h = R.v) == null ? void 0 : h.toString()) || ((p = (m = (f = R.p) == null ? void 0 : f.body) == null ? void 0 : m.dataStream) == null ? void 0 : p.trim()) || "")) {
981
984
  d.add(S);
982
985
  break;
983
986
  }
@@ -986,13 +989,13 @@ let Cn = class extends re {
986
989
  for (const S of g)
987
990
  l.push({
988
991
  index: S,
989
- label: In(S)
992
+ label: Cn(S)
990
993
  });
991
994
  return l;
992
995
  }
993
996
  getSelectionRangeNotation() {
994
997
  const i = this._selectionService.getCurrentSelections();
995
- return !i || i.length === 0 ? "" : i.map((t) => xs(t.range)).join(", ");
998
+ return !i || i.length === 0 ? "" : i.map((t) => ks(t.range)).join(", ");
996
999
  }
997
1000
  getSelectionRowRange() {
998
1001
  const i = this._selectionService.getCurrentSelections();
@@ -1013,7 +1016,7 @@ let Cn = class extends re {
1013
1016
  }
1014
1017
  generateFileName(i, t) {
1015
1018
  var s, o, a, c;
1016
- const e = this._univerInstanceService.getCurrentUnitForType(B.UNIVER_SHEET), n = ln(i.source, i.imageSourceType), r = [];
1019
+ const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET), n = un(i.source, i.imageSourceType), r = [];
1017
1020
  for (const u of t.fileNameParts)
1018
1021
  if (u === "cellAddress")
1019
1022
  r.push(i.cellAddress);
@@ -1024,8 +1027,8 @@ let Cn = class extends re {
1024
1027
  if (g) {
1025
1028
  const h = ((s = g.v) == null ? void 0 : s.toString()) || ((c = (a = (o = g.p) == null ? void 0 : o.body) == null ? void 0 : a.dataStream) == null ? void 0 : c.trim()) || "";
1026
1029
  if (h) {
1027
- const m = h.replace(/[<>:"/\\|?*]/g, "_").trim();
1028
- m && r.push(m);
1030
+ const f = h.replace(/[<>:"/\\|?*]/g, "_").trim();
1031
+ f && r.push(f);
1029
1032
  }
1030
1033
  }
1031
1034
  }
@@ -1034,18 +1037,18 @@ let Cn = class extends re {
1034
1037
  }
1035
1038
  generateFileNameWithContext(i, t, e, n) {
1036
1039
  var a, c, u, d;
1037
- const r = this._univerInstanceService.getUnit(e, B.UNIVER_SHEET), s = ln(i.source, i.imageSourceType), o = [];
1040
+ const r = this._univerInstanceService.getUnit(e, $.UNIVER_SHEET), s = un(i.source, i.imageSourceType), o = [];
1038
1041
  for (const l of t.fileNameParts)
1039
1042
  if (l === "cellAddress")
1040
1043
  o.push(i.cellAddress);
1041
1044
  else if (l === "columnValue" && t.columnIndex !== void 0) {
1042
1045
  const g = r == null ? void 0 : r.getSheetBySheetId(n);
1043
1046
  if (g) {
1044
- const m = g.getCellMatrix().getValue(i.row, t.columnIndex);
1045
- if (m) {
1046
- const f = ((a = m.v) == null ? void 0 : a.toString()) || ((d = (u = (c = m.p) == null ? void 0 : c.body) == null ? void 0 : u.dataStream) == null ? void 0 : d.trim()) || "";
1047
- if (f) {
1048
- const p = f.replace(/[<>:"/\\|?*]/g, "_").trim();
1047
+ const f = g.getCellMatrix().getValue(i.row, t.columnIndex);
1048
+ if (f) {
1049
+ const m = ((a = f.v) == null ? void 0 : a.toString()) || ((d = (u = (c = f.p) == null ? void 0 : c.body) == null ? void 0 : u.dataStream) == null ? void 0 : d.trim()) || "";
1050
+ if (m) {
1051
+ const p = m.replace(/[<>:"/\\|?*]/g, "_").trim();
1049
1052
  p && o.push(p);
1050
1053
  }
1051
1054
  }
@@ -1076,15 +1079,15 @@ let Cn = class extends re {
1076
1079
  const u = c.replace(/\.\w+$/, ""), d = ((o = c.match(/\.\w+$/)) == null ? void 0 : o[0]) || ".png", l = s.get(u) || 0;
1077
1080
  l > 0 && (c = `${u}_${l}${d}`), s.set(u, l + 1);
1078
1081
  try {
1079
- const g = await this._getImageBlob(a), m = await (await r.getFileHandle(c, { create: !0 })).createWritable();
1080
- await m.write(g), await m.close();
1082
+ const g = await this._getImageBlob(a), f = await (await r.getFileHandle(c, { create: !0 })).createWritable();
1083
+ await f.write(g), await f.close();
1081
1084
  } catch (g) {
1082
1085
  throw console.error(`Failed to save image ${c}:`, g), g;
1083
1086
  }
1084
1087
  }
1085
1088
  }
1086
1089
  async downloadSingleImage(i) {
1087
- const t = ln(i.source, i.imageSourceType), e = `${i.cellAddress}.${t}`;
1090
+ const t = un(i.source, i.imageSourceType), e = `${i.cellAddress}.${t}`;
1088
1091
  try {
1089
1092
  const n = await this._getImageBlob(i), r = URL.createObjectURL(n), s = document.createElement("a");
1090
1093
  s.href = r, s.download = e, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(r);
@@ -1095,29 +1098,29 @@ let Cn = class extends re {
1095
1098
  async _getImageBlob(i) {
1096
1099
  if (i.imageSourceType === Ce.UUID) {
1097
1100
  const t = await this._imageIoService.getImage(i.source);
1098
- return or(t, Ce.URL);
1101
+ return ar(t, Ce.URL);
1099
1102
  }
1100
- return i.imageSourceType === Ce.URL ? this._urlImageService.downloadImage(i.source) : or(i.source, i.imageSourceType);
1103
+ return i.imageSourceType === Ce.URL ? this._urlImageService.downloadImage(i.source) : ar(i.source, i.imageSourceType);
1101
1104
  }
1102
1105
  };
1103
- Cn = Ns([
1104
- At(0, he),
1105
- At(1, N(St)),
1106
- At(2, mr),
1107
- At(3, gr)
1108
- ], Cn);
1106
+ Rn = xs([
1107
+ Nt(0, he),
1108
+ Nt(1, N(_t)),
1109
+ Nt(2, mr),
1110
+ Nt(3, fr)
1111
+ ], Rn);
1109
1112
  const nt = "sheet.dialog.batch-save-images", mt = {
1110
1113
  id: "sheet.command.save-cell-images",
1111
1114
  type: te.COMMAND,
1112
1115
  handler: async (i) => {
1113
- const t = i.get(Tn), e = i.get(On), n = e.getCellImagesInSelection();
1116
+ const t = i.get(En), e = i.get(Un), n = e.getCellImagesInSelection();
1114
1117
  if (n.length === 1)
1115
1118
  try {
1116
1119
  return await e.downloadSingleImage(n[0]), !0;
1117
1120
  } catch (a) {
1118
1121
  return console.error("Failed to download image:", a), !1;
1119
1122
  }
1120
- const r = i.get(Be), s = e.getSelectionRangeNotation(), o = `${r.t("sheetImage.save.title")} (${s})`;
1123
+ const r = i.get($e), s = e.getSelectionRangeNotation(), o = `${r.t("sheetImage.save.title")} (${s})`;
1121
1124
  return t.open({
1122
1125
  id: nt,
1123
1126
  draggable: !0,
@@ -1131,262 +1134,63 @@ const nt = "sheet.dialog.batch-save-images", mt = {
1131
1134
  onClose: () => t.close(nt)
1132
1135
  }), !0;
1133
1136
  }
1134
- }, Fr = "COMPONENT_SHEET_DRAWING_PANEL", Lr = {
1137
+ }, Lr = "COMPONENT_SHEET_DRAWING_PANEL", Hr = {
1135
1138
  id: "sidebar.operation.sheet-image",
1136
1139
  type: te.COMMAND,
1137
1140
  handler: async (i, t) => {
1138
- const e = i.get(ds), n = i.get(Be), r = i.get(he), s = i.get(K);
1141
+ const e = i.get(ls), n = i.get($e), r = i.get(he), s = i.get(K);
1139
1142
  return ce(r) ? (t.value === "open" ? e.open({
1140
1143
  header: { title: n.t("sheetImage.panel.title") },
1141
- children: { label: Fr },
1144
+ children: { label: Lr },
1142
1145
  onClose: () => {
1143
1146
  s.syncExecuteCommand(Kt.id, []);
1144
1147
  },
1145
1148
  width: 360
1146
1149
  }) : e.close(), !0) : !1;
1147
1150
  }
1148
- }, Hr = {
1151
+ }, Vr = {
1149
1152
  id: "sheet.operation.edit-sheet-image",
1150
1153
  type: te.OPERATION,
1151
1154
  handler: (i, t) => {
1152
1155
  const e = i.get(K);
1153
- return t == null ? !1 : (e.syncExecuteCommand(Kt.id, [t]), e.executeCommand(Lr.id, { value: "open" }), !0);
1154
- }
1155
- }, ks = "sheets-drawing-ui.config", ar = {}, Rn = {
1156
- id: "sheet.command.toggle-flip-drawings",
1157
- type: te.COMMAND,
1158
- // eslint-disable-next-line max-lines-per-function, complexity
1159
- handler: (i, t) => {
1160
- const e = i.get(K), n = i.get($e), r = i.get(ie), s = i.get(ee);
1161
- if (!t) return !1;
1162
- const { drawings: o } = t, a = t.flipH, c = t.flipV, u = [], d = [];
1163
- for (const M of o) {
1164
- const { unitId: I, subUnitId: v, drawingId: C } = M;
1165
- u.push(I);
1166
- const D = r.getDrawingData(I, v), T = D == null ? void 0 : D[C];
1167
- if (!T)
1168
- continue;
1169
- const b = { ...T.transform };
1170
- a && (b.flipX = !b.flipX), c && (b.flipY = !b.flipY);
1171
- const E = s.getRenderById(I), w = E == null ? void 0 : E.with(Oe);
1172
- if (!w)
1173
- continue;
1174
- const y = j(b, w), O = F(b, w), x = {
1175
- unitId: I,
1176
- subUnitId: v,
1177
- drawingType: T.drawingType,
1178
- drawingId: C,
1179
- transform: b,
1180
- sheetTransform: y,
1181
- axisAlignSheetTransform: O
1182
- };
1183
- if (T.drawingType === $.DRAWING_IMAGE) {
1184
- const z = $s(i, I);
1185
- if (z) {
1186
- const G = ye({ unitId: I, subUnitId: v, drawingId: C }), V = z.getObject(G);
1187
- if (V) {
1188
- const J = V.srcRect;
1189
- if (J) {
1190
- let Y;
1191
- const { left: k = 0, top: se = 0, right: ge = 0, bottom: me = 0 } = J;
1192
- if (a) {
1193
- const le = k + (ge - k) / 2, Re = le - (ge - k) / 2, Ue = le + (ge - k) / 2;
1194
- Y = {
1195
- left: Re,
1196
- top: se,
1197
- right: Ue,
1198
- bottom: me
1199
- };
1200
- }
1201
- if (c) {
1202
- const le = se + (me - se) / 2, Re = le - (me - se) / 2, Ue = le + (me - se) / 2;
1203
- Y = {
1204
- left: k,
1205
- top: Re,
1206
- right: ge,
1207
- bottom: Ue
1208
- };
1209
- }
1210
- Y && (x.srcRect = Y);
1211
- }
1212
- }
1213
- }
1214
- }
1215
- d.push(x);
1216
- }
1217
- if (d.length === 0) return !1;
1218
- const l = r.getBatchUpdateOp(d), { unitId: g, subUnitId: h, undo: m, redo: f, objects: p } = l, S = { id: A.id, params: { unitId: g, subUnitId: h, op: f, objects: p, type: P.UPDATE } }, _ = { id: A.id, params: { unitId: g, subUnitId: h, op: m, objects: p, type: P.UPDATE } };
1219
- return zt([S], e) ? (n.pushUndoRedo({
1220
- unitID: g,
1221
- undoMutations: [_, { id: L.id, params: u }],
1222
- redoMutations: [S, { id: L.id, params: u }]
1223
- }), !0) : !1;
1156
+ return t == null ? !1 : (e.syncExecuteCommand(Kt.id, [t]), e.executeCommand(Hr.id, { value: "open" }), !0);
1224
1157
  }
1225
- };
1226
- function $s(i, t) {
1227
- const n = i.get(ee).getRenderById(t);
1228
- return n ? n.scene : null;
1158
+ }, Gr = "sheet.menu.image";
1159
+ function Bs(i) {
1160
+ return {
1161
+ id: Gr,
1162
+ type: Zt.SUBITEMS,
1163
+ icon: "AddImageIcon",
1164
+ tooltip: "sheetImage.title",
1165
+ hidden$: Jt(i, $.UNIVER_SHEET),
1166
+ disabled$: si(i, { workbookTypes: [wn], worksheetTypes: [pn], rangeTypes: [Bi] })
1167
+ };
1229
1168
  }
1230
- var Bs = Object.getOwnPropertyDescriptor, Ws = (i, t, e, n) => {
1231
- for (var r = n > 1 ? void 0 : n ? Bs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1232
- (o = i[s]) && (r = o(r) || r);
1233
- return r;
1234
- }, ue = (i, t) => (e, n) => t(e, n, i);
1235
- let Wt = class extends fi {
1236
- constructor(t, e, n, r, s, o, a, c, u, d) {
1237
- super();
1238
- ae(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
1239
- this._injector = t, this._localeService = e, this._drawingManagerService = n, this._canvasPopManagerService = r, this._renderManagerService = s, this._univerInstanceService = o, this._messageService = a, this._contextService = c, this._ioService = u, this._commandService = d, this._init();
1240
- }
1241
- _init() {
1242
- this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET).subscribe((t) => this._create(t)), this._univerInstanceService.getTypeOfUnitDisposed$(B.UNIVER_SHEET).subscribe((t) => this._dispose(t)), this._univerInstanceService.getAllUnitsForType(B.UNIVER_SHEET).forEach((t) => this._create(t)), this._setupLoadingStatus();
1243
- }
1244
- _setupLoadingStatus() {
1245
- const t = "image-upload-loading";
1246
- let e;
1247
- this.disposeWithMe(this._ioService.change$.subscribe((n) => {
1248
- n > 0 && !e ? e = this._messageService.show({
1249
- id: t,
1250
- type: Me.Loading,
1251
- content: `${this._localeService.t("uploadLoading.loading")}: ${n}`,
1252
- duration: 0
1253
- }) : n === 0 && (e == null || e.dispose(), e = void 0);
1254
- }));
1255
- }
1256
- _dispose(t) {
1257
- super.dispose();
1258
- const e = t.getUnitId();
1259
- this._renderManagerService.removeRender(e), this._initImagePopupMenu.delete(e);
1260
- }
1261
- _create(t) {
1262
- if (!t)
1263
- return;
1264
- const e = t.getUnitId();
1265
- this._renderManagerService.has(e) && !this._initImagePopupMenu.has(e) && (this._popupMenuListener(e), this._initImagePopupMenu.add(e));
1266
- }
1267
- _hasCropObject(t) {
1268
- const e = t.getAllObjectsByOrder();
1269
- for (const n of e)
1270
- if (n instanceof _s)
1271
- return !0;
1272
- return !1;
1273
- }
1274
- _popupMenuListener(t) {
1275
- var s;
1276
- const e = (s = this._renderManagerService.getRenderById(t)) == null ? void 0 : s.scene;
1277
- if (!e)
1278
- return;
1279
- const n = e.getTransformerByCreate();
1280
- if (!n)
1281
- return;
1282
- let r;
1283
- this.disposeWithMe(
1284
- n.createControl$.subscribe(() => {
1285
- if (this._contextService.setContextValue(et, !0), this._hasCropObject(e))
1286
- return;
1287
- const o = n.getSelectedObjectMap();
1288
- if (o.size > 1) {
1289
- r == null || r.dispose();
1290
- return;
1291
- }
1292
- const a = o.values().next().value;
1293
- if (!a)
1294
- return;
1295
- const c = a.oKey, u = this._drawingManagerService.getDrawingOKey(c);
1296
- if (!u)
1297
- return;
1298
- const { unitId: d, subUnitId: l, drawingId: g, drawingType: h } = u, m = u.data;
1299
- if (m && m.disablePopup)
1300
- return;
1301
- r == null || r.dispose();
1302
- const f = this._canvasPopManagerService.getFeatureMenu(d, l, g, h);
1303
- r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
1304
- componentKey: vs,
1305
- direction: "horizontal",
1306
- offset: [2, 0],
1307
- extraProps: {
1308
- menuItems: f || this._getImageMenuItems(d, l, g, h)
1309
- }
1310
- }));
1311
- })
1312
- ), this.disposeWithMe(
1313
- n.clearControl$.subscribe(() => {
1314
- r == null || r.dispose(), this._contextService.setContextValue(et, !1), this._commandService.syncExecuteCommand(Kt.id, []);
1315
- })
1316
- ), this.disposeWithMe(
1317
- this._contextService.contextChanged$.subscribe((o) => {
1318
- o[et] === !1 && (r == null || r.dispose());
1319
- })
1320
- ), this.disposeWithMe(
1321
- n.changing$.subscribe(() => {
1322
- r == null || r.dispose();
1323
- })
1324
- );
1325
- }
1326
- _getImageMenuItems(t, e, n, r) {
1327
- return [
1328
- {
1329
- label: "image-popup.edit",
1330
- index: 0,
1331
- commandId: Hr.id,
1332
- commandParams: { unitId: t, subUnitId: e, drawingId: n },
1333
- disable: r === $.DRAWING_DOM
1334
- },
1335
- {
1336
- label: "image-popup.delete",
1337
- index: 1,
1338
- commandId: _t.id,
1339
- commandParams: { unitId: t, drawings: [{ unitId: t, subUnitId: e, drawingId: n }] },
1340
- disable: !1
1341
- },
1342
- {
1343
- label: "image-popup.crop",
1344
- index: 2,
1345
- commandId: Is.id,
1346
- commandParams: { unitId: t, subUnitId: e, drawingId: n },
1347
- disable: r === $.DRAWING_DOM
1348
- },
1349
- {
1350
- label: "image-popup.flipH",
1351
- index: 2,
1352
- commandId: Rn.id,
1353
- commandParams: { unitId: t, flipH: !0, drawings: [{ unitId: t, subUnitId: e, drawingId: n }] },
1354
- disable: r === $.DRAWING_DOM
1355
- },
1356
- {
1357
- label: "image-popup.flipV",
1358
- index: 2,
1359
- commandId: Rn.id,
1360
- commandParams: { unitId: t, flipV: !0, drawings: [{ unitId: t, subUnitId: e, drawingId: n }] },
1361
- disable: r === $.DRAWING_DOM
1362
- },
1363
- {
1364
- label: "image-popup.reset",
1365
- index: 3,
1366
- commandId: Cs.id,
1367
- commandParams: [{ unitId: t, subUnitId: e, drawingId: n }],
1368
- disable: r === $.DRAWING_DOM
1369
- }
1370
- ];
1371
- }
1372
- };
1373
- Wt = Ws([
1374
- ue(0, N(it)),
1375
- ue(1, N(Be)),
1376
- ue(2, de),
1377
- ue(3, N(ii)),
1378
- ue(4, ee),
1379
- ue(5, he),
1380
- ue(6, Ar),
1381
- ue(7, hr),
1382
- ue(8, mr),
1383
- ue(9, K)
1384
- ], Wt);
1385
- var js = Object.getOwnPropertyDescriptor, Fs = (i, t, e, n) => {
1386
- for (var r = n > 1 ? void 0 : n ? js(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1169
+ function $s(i) {
1170
+ return {
1171
+ id: Qt.id,
1172
+ title: "sheetImage.upload.float",
1173
+ type: Zt.BUTTON,
1174
+ hidden$: Jt(i, $.UNIVER_SHEET)
1175
+ };
1176
+ }
1177
+ function Ws(i) {
1178
+ return {
1179
+ id: On.id,
1180
+ title: "sheetImage.upload.cell",
1181
+ type: Zt.BUTTON,
1182
+ hidden$: Jt(i, $.UNIVER_SHEET)
1183
+ };
1184
+ }
1185
+ const js = "@univerjs/sheets-drawing-ui", Fs = "0.17.0", Yr = {
1186
+ name: js,
1187
+ version: Fs
1188
+ }, Ls = "sheets-drawing-ui.config", cr = {};
1189
+ var Hs = Object.getOwnPropertyDescriptor, Vs = (i, t, e, n) => {
1190
+ for (var r = n > 1 ? void 0 : n ? Hs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1387
1191
  (o = i[s]) && (r = o(r) || r);
1388
1192
  return r;
1389
- }, Nt = (i, t) => (e, n) => t(e, n, i);
1193
+ }, xt = (i, t) => (e, n) => t(e, n, i);
1390
1194
  let Dn = class extends re {
1391
1195
  constructor(t, e, n, r, s) {
1392
1196
  super();
@@ -1394,10 +1198,10 @@ let Dn = class extends re {
1394
1198
  this._context = t, this._hoverManagerService = e, this._selectionsService = n, this._drawingRenderService = r, this._sheetSkeletonManagerService = s, this._initHover(), this._initImageClick();
1395
1199
  }
1396
1200
  _initHover() {
1397
- this.disposeWithMe(this._hoverManagerService.currentRichTextNoDistinct$.pipe(bs(33)).subscribe((t) => {
1201
+ this.disposeWithMe(this._hoverManagerService.currentRichTextNoDistinct$.pipe(Ms(33)).subscribe((t) => {
1398
1202
  var n, r;
1399
1203
  let e = [];
1400
- t !== null && (e = this._selectionsService.getWorkbookSelections(this._context.unitId).getCurrentSelections()), e.length > 0 && (t == null ? void 0 : t.unitId) === this._context.unitId && (t != null && t.drawing) && e.length === 1 && ((n = e[0].primary) == null ? void 0 : n.actualRow) === t.row && ((r = e[0].primary) == null ? void 0 : r.actualColumn) === t.col ? (this._isSetCursor = !0, this._context.scene.setCursor(ni.ZOOM_IN)) : this._isSetCursor && (this._isSetCursor = !1, this._context.scene.resetCursor());
1204
+ t !== null && (e = this._selectionsService.getWorkbookSelections(this._context.unitId).getCurrentSelections()), e.length > 0 && (t == null ? void 0 : t.unitId) === this._context.unitId && (t != null && t.drawing) && e.length === 1 && ((n = e[0].primary) == null ? void 0 : n.actualRow) === t.row && ((r = e[0].primary) == null ? void 0 : r.actualColumn) === t.col ? (this._isSetCursor = !0, this._context.scene.setCursor(ri.ZOOM_IN)) : this._isSetCursor && (this._isSetCursor = !1, this._context.scene.resetCursor());
1401
1205
  }));
1402
1206
  }
1403
1207
  _initImageClick() {
@@ -1411,17 +1215,17 @@ let Dn = class extends re {
1411
1215
  }));
1412
1216
  }
1413
1217
  };
1414
- Dn = Fs([
1415
- Nt(1, N(si)),
1416
- Nt(2, N(St)),
1417
- Nt(3, N(xr)),
1418
- Nt(4, N(Z))
1218
+ Dn = Vs([
1219
+ xt(1, N(oi)),
1220
+ xt(2, N(_t)),
1221
+ xt(3, N(kr)),
1222
+ xt(4, N(Z))
1419
1223
  ], Dn);
1420
- var Ls = Object.getOwnPropertyDescriptor, Hs = (i, t, e, n) => {
1421
- for (var r = n > 1 ? void 0 : n ? Ls(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1224
+ var Gs = Object.getOwnPropertyDescriptor, Ys = (i, t, e, n) => {
1225
+ for (var r = n > 1 ? void 0 : n ? Gs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1422
1226
  (o = i[s]) && (r = o(r) || r);
1423
1227
  return r;
1424
- }, xt = (i, t) => (e, n) => t(e, n, i);
1228
+ }, kt = (i, t) => (e, n) => t(e, n, i);
1425
1229
  let bn = class extends re {
1426
1230
  constructor(i, t, e, n, r) {
1427
1231
  super(), this._context = i, this._sheetDrawingService = t, this._drawingManagerService = e, this._sheetSelectionRenderService = n, this._sheetSkeletonManagerService = r, this._init();
@@ -1442,21 +1246,21 @@ let bn = class extends re {
1442
1246
  this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
1443
1247
  }
1444
1248
  };
1445
- bn = Hs([
1446
- xt(1, ie),
1447
- xt(2, de),
1448
- xt(3, N(Oe)),
1449
- xt(4, N(Z))
1249
+ bn = Ys([
1250
+ kt(1, ie),
1251
+ kt(2, de),
1252
+ kt(3, N(Oe)),
1253
+ kt(4, N(Z))
1450
1254
  ], bn);
1451
- var Gs = Object.getOwnPropertyDescriptor, Vs = (i, t, e, n) => {
1452
- for (var r = n > 1 ? void 0 : n ? Gs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1255
+ var Xs = Object.getOwnPropertyDescriptor, zs = (i, t, e, n) => {
1256
+ for (var r = n > 1 ? void 0 : n ? Xs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1453
1257
  (o = i[s]) && (r = o(r) || r);
1454
1258
  return r;
1455
1259
  }, Ye = (i, t) => (e, n) => t(e, n, i);
1456
- function Gr(i, t, e) {
1260
+ function Xr(i, t, e) {
1457
1261
  var n, r, s, o;
1458
1262
  if (((r = (n = e == null ? void 0 : e.p) == null ? void 0 : n.body) == null ? void 0 : r.dataStream.length) === 3 && ((o = (s = e.p) == null ? void 0 : s.drawingsOrder) == null ? void 0 : o.length) === 1) {
1459
- const a = e.p.drawings[e.p.drawingsOrder[0]], c = vn(
1263
+ const a = e.p.drawings[e.p.drawingsOrder[0]], c = In(
1460
1264
  i,
1461
1265
  {
1462
1266
  unitId: t.unitId,
@@ -1479,40 +1283,40 @@ let jt = class extends re {
1479
1283
  }
1480
1284
  _handleInitEditor() {
1481
1285
  this.disposeWithMe(this._editorBridgeService.visible$.subscribe((i) => {
1482
- i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(ht), this._docDrawingController.loadDrawingDataForUnit(ht), this._drawingManagerService.initializeNotification(ht)) : this._drawingManagerService.removeDrawingDataForUnit(ht);
1286
+ i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(gt), this._docDrawingController.loadDrawingDataForUnit(gt), this._drawingManagerService.initializeNotification(gt)) : this._drawingManagerService.removeDrawingDataForUnit(gt);
1483
1287
  })), this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
1484
- i.id === rs.id && i.params.unitId === qe && (this._drawingManagerService.removeDrawingDataForUnit(qe), this._docDrawingController.loadDrawingDataForUnit(qe), this._drawingManagerService.initializeNotification(qe));
1288
+ i.id === is.id && i.params.unitId === qe && (this._drawingManagerService.removeDrawingDataForUnit(qe), this._docDrawingController.loadDrawingDataForUnit(qe), this._drawingManagerService.initializeNotification(qe));
1485
1289
  }));
1486
1290
  }
1487
1291
  _initCellContentInterceptor() {
1488
1292
  this.disposeWithMe(
1489
1293
  this._sheetInterceptorService.intercept(
1490
- ki.CELL_CONTENT,
1294
+ $i.CELL_CONTENT,
1491
1295
  {
1492
1296
  effect: pi.Style,
1493
- priority: $i.CELL_IMAGE,
1297
+ priority: Wi.CELL_IMAGE,
1494
1298
  handler: (i, t, e) => {
1495
1299
  var n;
1496
- return i != null && i.p && ((n = i.p.drawingsOrder) != null && n.length) && (i === t.rawData && (i = { ...t.rawData }), i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }, Gr(this._injector, { unitId: t.unitId, subUnitId: t.subUnitId, row: t.row, col: t.col }, i)), e(i);
1300
+ return i != null && i.p && ((n = i.p.drawingsOrder) != null && n.length) && (i === t.rawData && (i = { ...t.rawData }), i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }, Xr(this._injector, { unitId: t.unitId, subUnitId: t.subUnitId, row: t.row, col: t.col }, i)), e(i);
1497
1301
  }
1498
1302
  }
1499
1303
  )
1500
1304
  );
1501
1305
  }
1502
1306
  };
1503
- jt = Vs([
1307
+ jt = zs([
1504
1308
  Ye(0, K),
1505
- Ye(1, N(wt)),
1506
- Ye(2, N(it)),
1309
+ Ye(1, N(St)),
1310
+ Ye(2, N(st)),
1507
1311
  Ye(3, de),
1508
- Ye(4, N(ws)),
1509
- Ye(5, N(oi))
1312
+ Ye(4, N(Ss)),
1313
+ Ye(5, N(ai))
1510
1314
  ], jt);
1511
- var Ys = Object.getOwnPropertyDescriptor, Xs = (i, t, e, n) => {
1512
- for (var r = n > 1 ? void 0 : n ? Ys(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1315
+ var Ks = Object.getOwnPropertyDescriptor, Js = (i, t, e, n) => {
1316
+ for (var r = n > 1 ? void 0 : n ? Ks(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1513
1317
  (o = i[s]) && (r = o(r) || r);
1514
1318
  return r;
1515
- }, cr = (i, t) => (e, n) => t(e, n, i);
1319
+ }, dr = (i, t) => (e, n) => t(e, n, i);
1516
1320
  let Ft = class extends re {
1517
1321
  constructor(i, t) {
1518
1322
  super(), this._autoFillService = i, this._injector = t, this._initAutoFillHooks();
@@ -1523,24 +1327,24 @@ let Ft = class extends re {
1523
1327
  id: "sheet-cell-image-autofill",
1524
1328
  onBeforeSubmit: (i, t, e, n) => {
1525
1329
  new wi(n).forValue((r, s, o) => {
1526
- Gr(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
1330
+ Xr(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
1527
1331
  });
1528
1332
  }
1529
1333
  })
1530
1334
  );
1531
1335
  }
1532
1336
  };
1533
- Ft = Xs([
1534
- cr(0, N(Bi)),
1535
- cr(1, N(it))
1337
+ Ft = Js([
1338
+ dr(0, N(ji)),
1339
+ dr(1, N(st))
1536
1340
  ], Ft);
1537
- var zs = Object.getOwnPropertyDescriptor, Ks = (i, t, e, n) => {
1538
- for (var r = n > 1 ? void 0 : n ? zs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1341
+ var Zs = Object.getOwnPropertyDescriptor, qs = (i, t, e, n) => {
1342
+ for (var r = n > 1 ? void 0 : n ? Zs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1539
1343
  (o = i[s]) && (r = o(r) || r);
1540
1344
  return r;
1541
- }, ct = (i, t) => (e, n) => t(e, n, i);
1542
- const Js = [
1543
- ht,
1345
+ }, dt = (i, t) => (e, n) => t(e, n, i);
1346
+ const Qs = [
1347
+ gt,
1544
1348
  Si,
1545
1349
  qe
1546
1350
  ];
@@ -1550,7 +1354,7 @@ let Lt = class extends re {
1550
1354
  }
1551
1355
  _setCellImage(i) {
1552
1356
  var r;
1553
- const t = gn("", {}), e = (r = yn(B.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.with(ai), n = mn.drawing.add({
1357
+ const t = fn("", {}), e = (r = Tn($.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.with(ci), n = mn.drawing.add({
1554
1358
  documentDataModel: t,
1555
1359
  drawings: [i],
1556
1360
  selection: {
@@ -1565,12 +1369,12 @@ let Lt = class extends re {
1565
1369
  this.disposeWithMe(
1566
1370
  this._commandService.beforeCommandExecuted((i) => {
1567
1371
  var t, e;
1568
- if (i.id === is.id) {
1569
- const n = i.params, { doc: r } = n, s = this._univerInstanceService.getCurrentUnitOfType(B.UNIVER_DOC);
1372
+ if (i.id === ss.id) {
1373
+ const n = i.params, { doc: r } = n, s = this._univerInstanceService.getCurrentUnitOfType($.UNIVER_DOC);
1570
1374
  if (s == null || !Object.keys((t = r.drawings) != null ? t : {}).length)
1571
1375
  return;
1572
1376
  const o = s.getUnitId();
1573
- if (Js.includes(o)) {
1377
+ if (Qs.includes(o)) {
1574
1378
  if (o !== qe) {
1575
1379
  const a = () => {
1576
1380
  this._dialogService.close("sheet-cell-image-copy-paste"), this._commandService.syncExecuteCommand($n.id, {
@@ -1606,32 +1410,32 @@ let Lt = class extends re {
1606
1410
  );
1607
1411
  }
1608
1412
  };
1609
- Lt = Ks([
1610
- ct(0, K),
1611
- ct(1, he),
1612
- ct(2, Tn),
1613
- ct(3, ee),
1614
- ct(4, N(Be))
1413
+ Lt = qs([
1414
+ dt(0, K),
1415
+ dt(1, he),
1416
+ dt(2, En),
1417
+ dt(3, ee),
1418
+ dt(4, N($e))
1615
1419
  ], Lt);
1616
- var Zs = Object.getOwnPropertyDescriptor, qs = (i, t, e, n) => {
1617
- for (var r = n > 1 ? void 0 : n ? Zs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1420
+ var eo = Object.getOwnPropertyDescriptor, to = (i, t, e, n) => {
1421
+ for (var r = n > 1 ? void 0 : n ? eo(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1618
1422
  (o = i[s]) && (r = o(r) || r);
1619
1423
  return r;
1620
- }, dt = (i, t) => (e, n) => t(e, n, i);
1621
- const Vr = "image/png";
1622
- function Qs(i) {
1424
+ }, lt = (i, t) => (e, n) => t(e, n, i);
1425
+ const zr = "image/png";
1426
+ function no(i) {
1623
1427
  const t = i.split(","), e = atob(t[1]), n = e.length, r = new Uint8Array(n);
1624
1428
  for (let s = 0; s < n; s++)
1625
1429
  r[s] = e.charCodeAt(s);
1626
- return new Blob([r], { type: Vr });
1430
+ return new Blob([r], { type: zr });
1627
1431
  }
1628
- function eo(i) {
1629
- const t = new ClipboardItem({ [Vr]: Qs(i) });
1432
+ function ro(i) {
1433
+ const t = new ClipboardItem({ [zr]: no(i) });
1630
1434
  navigator.clipboard.write([t]).catch((e) => {
1631
1435
  console.error("Could not copy image using clipboard API: ", e);
1632
1436
  });
1633
1437
  }
1634
- function to() {
1438
+ function io() {
1635
1439
  function i() {
1636
1440
  const n = document.createElement("input");
1637
1441
  return n.style.position = "absolute", n.style.height = "1px", n.style.width = "1px", n.style.opacity = "0", n;
@@ -1641,7 +1445,7 @@ function to() {
1641
1445
  e.blur(), document.body.removeChild(e), t instanceof HTMLElement && t.focus();
1642
1446
  };
1643
1447
  }
1644
- const dr = [
1448
+ const lr = [
1645
1449
  Je.SPECIAL_PASTE_COL_WIDTH,
1646
1450
  Je.SPECIAL_PASTE_VALUE,
1647
1451
  Je.SPECIAL_PASTE_FORMAT,
@@ -1665,18 +1469,18 @@ let Ht = class extends re {
1665
1469
  const s = this._focusedDrawings;
1666
1470
  if (s.length > 0) {
1667
1471
  const [o] = s;
1668
- if (o.drawingType !== $.DRAWING_IMAGE)
1472
+ if (o.drawingType !== B.DRAWING_IMAGE)
1669
1473
  return;
1670
1474
  if (r === Pe.CUT) {
1671
1475
  const c = {
1672
1476
  unitId: t,
1673
1477
  drawings: [o]
1674
1478
  };
1675
- this._commandService.executeCommand(_t.id, c);
1479
+ this._commandService.executeCommand(vt.id, c);
1676
1480
  }
1677
1481
  setTimeout(() => {
1678
- const c = to();
1679
- o.drawingType === $.DRAWING_IMAGE && o.imageSourceType === os.BASE64 ? eo(o.source) : this._clipboardInterfaceService.writeText(""), c();
1482
+ const c = io();
1483
+ o.drawingType === B.DRAWING_IMAGE && o.imageSourceType === as.BASE64 ? ro(o.source) : this._clipboardInterfaceService.writeText(""), c();
1680
1484
  }, 200);
1681
1485
  const a = {
1682
1486
  unitId: o.unitId,
@@ -1726,19 +1530,19 @@ let Ht = class extends re {
1726
1530
  return;
1727
1531
  const { startX: o, endX: a, startY: c, endY: u } = s, d = this._drawingService.getDrawingData(t, e), l = this._focusedDrawings.slice();
1728
1532
  if (Object.keys(d).forEach((h) => {
1729
- const m = d[h];
1730
- if (m.drawingType !== $.DRAWING_IMAGE)
1533
+ const f = d[h];
1534
+ if (f.drawingType !== B.DRAWING_IMAGE)
1731
1535
  return;
1732
- const { transform: f } = m;
1733
- if (m.anchorType !== U.Both || !f)
1536
+ const { transform: m } = f;
1537
+ if (f.anchorType !== U.Both || !m)
1734
1538
  return;
1735
- const { left: p = 0, top: S = 0, width: _ = 0, height: R = 0 } = f, { drawingStartX: M, drawingEndX: I, drawingStartY: v, drawingEndY: C } = {
1539
+ const { left: p = 0, top: S = 0, width: _ = 0, height: R = 0 } = m, { drawingStartX: M, drawingEndX: I, drawingStartY: v, drawingEndY: C } = {
1736
1540
  drawingStartX: p,
1737
1541
  drawingEndX: p + _,
1738
1542
  drawingStartY: S,
1739
1543
  drawingEndY: S + R
1740
1544
  };
1741
- o <= M && I <= a && c <= v && C <= u && l.push(m);
1545
+ o <= M && I <= a && c <= v && C <= u && l.push(f);
1742
1546
  }), l.length)
1743
1547
  return {
1744
1548
  copyRange: n,
@@ -1749,17 +1553,17 @@ let Ht = class extends re {
1749
1553
  }
1750
1554
  _generateSingleDrawingPasteMutations(t, e) {
1751
1555
  const { pasteType: n, pasteTo: r } = t;
1752
- if (dr.includes(n))
1556
+ if (lr.includes(n))
1753
1557
  return { redos: [], undos: [] };
1754
1558
  const { unitId: s, subUnitId: o, range: a } = r, c = this._renderManagerService.getRenderById(s), u = c == null ? void 0 : c.with(Z), d = c == null ? void 0 : c.with(Oe), l = this._copyInfo;
1755
1559
  if (!u || !d)
1756
1560
  return { redos: [], undos: [] };
1757
- const { drawings: g } = l, h = Vn(a);
1561
+ const { drawings: g } = l, h = Yn(a);
1758
1562
  return this._generateMutations(g, {
1759
1563
  unitId: s,
1760
1564
  subUnitId: o,
1761
1565
  isCut: e === Pe.CUT,
1762
- getTransform: (m, f) => {
1566
+ getTransform: (f, m) => {
1763
1567
  var _, R;
1764
1568
  const p = u.attachRangeWithCoord({
1765
1569
  startRow: h.startRow,
@@ -1767,14 +1571,14 @@ let Ht = class extends re {
1767
1571
  startColumn: h.startColumn,
1768
1572
  endColumn: h.endColumn
1769
1573
  }), S = {
1770
- ...m,
1574
+ ...f,
1771
1575
  left: p == null ? void 0 : p.startX,
1772
1576
  top: p == null ? void 0 : p.startY
1773
1577
  };
1774
1578
  return {
1775
1579
  transform: S,
1776
- sheetTransform: (_ = j(S, d)) != null ? _ : f,
1777
- axisAlignSheetTransform: (R = F(S, d)) != null ? R : f
1580
+ sheetTransform: (_ = j(S, d)) != null ? _ : m,
1581
+ axisAlignSheetTransform: (R = F(S, d)) != null ? R : m
1778
1582
  };
1779
1583
  }
1780
1584
  });
@@ -1790,7 +1594,7 @@ let Ht = class extends re {
1790
1594
  const { transform: l, sheetTransform: g } = d;
1791
1595
  if (!l)
1792
1596
  return;
1793
- const h = s(l, g), m = {
1597
+ const h = s(l, g), f = {
1794
1598
  ...d,
1795
1599
  unitId: n,
1796
1600
  subUnitId: r,
@@ -1800,7 +1604,7 @@ let Ht = class extends re {
1800
1604
  axisAlignSheetTransform: h.axisAlignSheetTransform
1801
1605
  };
1802
1606
  if (o) {
1803
- const { undo: f, redo: p, objects: S } = u.getBatchUpdateOp([m]);
1607
+ const { undo: m, redo: p, objects: S } = u.getBatchUpdateOp([f]);
1804
1608
  a.push({
1805
1609
  id: A.id,
1806
1610
  params: {
@@ -1816,13 +1620,13 @@ let Ht = class extends re {
1816
1620
  unitId: n,
1817
1621
  subUnitId: r,
1818
1622
  type: P.UPDATE,
1819
- op: f,
1623
+ op: m,
1820
1624
  objects: S
1821
1625
  }
1822
1626
  });
1823
1627
  } else {
1824
- const { undo: f, redo: p, objects: S } = u.getBatchAddOp([m]);
1825
- a.push({ id: A.id, params: { op: p, unitId: n, subUnitId: r, objects: S, type: P.INSERT } }), c.push({ id: A.id, params: { op: f, unitId: n, subUnitId: r, objects: S, type: P.REMOVE } });
1628
+ const { undo: m, redo: p, objects: S } = u.getBatchAddOp([f]);
1629
+ a.push({ id: A.id, params: { op: p, unitId: n, subUnitId: r, objects: S, type: P.INSERT } }), c.push({ id: A.id, params: { op: m, unitId: n, subUnitId: r, objects: S, type: P.REMOVE } });
1826
1630
  }
1827
1631
  }), { redos: a, undos: c };
1828
1632
  }
@@ -1838,7 +1642,7 @@ let Ht = class extends re {
1838
1642
  copyRange: a,
1839
1643
  copyType: c
1840
1644
  } = e;
1841
- if (dr.includes(s))
1645
+ if (lr.includes(s))
1842
1646
  return { redos: [], undos: [] };
1843
1647
  const u = (D = this._renderManagerService.getRenderById(n)) == null ? void 0 : D.with(Z);
1844
1648
  if (!u || !this._copyInfo)
@@ -1846,14 +1650,14 @@ let Ht = class extends re {
1846
1650
  const { drawings: d } = this._copyInfo;
1847
1651
  if (!a)
1848
1652
  return this._generateSingleDrawingPasteMutations({
1849
- pasteTo: { unitId: n, subUnitId: r, range: Vn(o) },
1653
+ pasteTo: { unitId: n, subUnitId: r, range: Yn(o) },
1850
1654
  pasteType: s
1851
1655
  }, c);
1852
- const { ranges: [l, g], mapFunc: h } = ci([a, o]), { row: m, col: f } = h(l.startRow, l.startColumn), { row: p, col: S } = h(g.startRow, g.startColumn), _ = u.attachRangeWithCoord({
1853
- startRow: m,
1854
- endRow: m,
1855
- startColumn: f,
1856
- endColumn: f
1656
+ const { ranges: [l, g], mapFunc: h } = di([a, o]), { row: f, col: m } = h(l.startRow, l.startColumn), { row: p, col: S } = h(g.startRow, g.startColumn), _ = u.attachRangeWithCoord({
1657
+ startRow: f,
1658
+ endRow: f,
1659
+ startColumn: m,
1660
+ endColumn: m
1857
1661
  }), R = u.attachRangeWithCoord({
1858
1662
  startRow: p,
1859
1663
  endRow: p,
@@ -1862,7 +1666,7 @@ let Ht = class extends re {
1862
1666
  });
1863
1667
  if (!_ || !R || !this._copyInfo)
1864
1668
  return { redos: [], undos: [] };
1865
- const M = R.startX - _.startX, I = R.startY - _.startY, v = p - m, C = S - f;
1669
+ const M = R.startX - _.startX, I = R.startY - _.startY, v = p - f, C = S - m;
1866
1670
  return this._generateMutations(d, {
1867
1671
  unitId: n,
1868
1672
  subUnitId: r,
@@ -1923,36 +1727,36 @@ let Ht = class extends re {
1923
1727
  });
1924
1728
  }
1925
1729
  };
1926
- Ht = qs([
1927
- dt(0, di),
1928
- dt(1, ee),
1929
- dt(2, de),
1930
- dt(3, ls),
1931
- dt(4, K)
1730
+ Ht = to([
1731
+ lt(0, li),
1732
+ lt(1, ee),
1733
+ lt(2, de),
1734
+ lt(3, us),
1735
+ lt(4, K)
1932
1736
  ], Ht);
1933
- var no = Object.getOwnPropertyDescriptor, ro = (i, t, e, n) => {
1934
- for (var r = n > 1 ? void 0 : n ? no(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1737
+ var so = Object.getOwnPropertyDescriptor, oo = (i, t, e, n) => {
1738
+ for (var r = n > 1 ? void 0 : n ? so(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1935
1739
  (o = i[s]) && (r = o(r) || r);
1936
1740
  return r;
1937
- }, lt = (i, t) => (e, n) => t(e, n, i);
1938
- let Gt = class extends re {
1741
+ }, ut = (i, t) => (e, n) => t(e, n, i);
1742
+ let Vt = class extends re {
1939
1743
  constructor(i, t, e, n, r) {
1940
1744
  super(), this._drawingManagerService = i, this._renderManagerService = t, this._permissionService = e, this._univerInstanceService = n, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
1941
1745
  }
1942
1746
  _initDrawingVisible() {
1943
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET), t = this._userManagerService.currentUser$, e = gt([i, t]);
1747
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET), t = this._userManagerService.currentUser$, e = ft([i, t]);
1944
1748
  this.disposeWithMe(
1945
1749
  e.pipe(
1946
1750
  ve(([n, r]) => n ? n.activeSheet$.pipe(
1947
- nr((s) => {
1751
+ rr((s) => {
1948
1752
  if (!s) {
1949
1753
  this._drawingManagerService.setDrawingVisible(!1);
1950
1754
  return;
1951
1755
  }
1952
1756
  const o = n.getUnitId(), a = s.getSheetId();
1953
1757
  this._permissionService.composePermission([
1954
- new Yn(o).id,
1955
- new Xn(o, a).id
1758
+ new Xn(o).id,
1759
+ new zn(o, a).id
1956
1760
  ]).every((u) => u.value) ? this._drawingManagerService.setDrawingVisible(!0) : this._handleDrawingVisibilityFalse(n, s);
1957
1761
  })
1958
1762
  ) : (this._drawingManagerService.setDrawingVisible(!1), De))
@@ -1969,18 +1773,18 @@ let Gt = class extends re {
1969
1773
  });
1970
1774
  }
1971
1775
  _initDrawingEditable() {
1972
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET), t = this._userManagerService.currentUser$, e = gt([i, t]);
1776
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET), t = this._userManagerService.currentUser$, e = ft([i, t]);
1973
1777
  this.disposeWithMe(
1974
1778
  e.pipe(
1975
1779
  ve(([n, r]) => n ? n.activeSheet$.pipe(
1976
- nr((s) => {
1780
+ rr((s) => {
1977
1781
  if (!s) {
1978
1782
  this._drawingManagerService.setDrawingEditable(!1);
1979
1783
  return;
1980
1784
  }
1981
1785
  const o = n.getUnitId(), a = s.getSheetId();
1982
1786
  this._permissionService.composePermission([
1983
- new fn(o).id,
1787
+ new wn(o).id,
1984
1788
  new pn(o, a).id
1985
1789
  ]).every((u) => u.value) ? this._drawingManagerService.setDrawingEditable(!0) : this._handleDrawingEditableFalse(n, s);
1986
1790
  })
@@ -1998,9 +1802,9 @@ let Gt = class extends re {
1998
1802
  });
1999
1803
  }
2000
1804
  _initViewPermissionChange() {
2001
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET), t = this._userManagerService.currentUser$;
1805
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET), t = this._userManagerService.currentUser$;
2002
1806
  this.disposeWithMe(
2003
- gt([i, t]).pipe(
1807
+ ft([i, t]).pipe(
2004
1808
  ve(([e, n]) => e ? e.activeSheet$.pipe(
2005
1809
  ve((r) => {
2006
1810
  if (!r)
@@ -2010,11 +1814,11 @@ let Gt = class extends re {
2010
1814
  return De;
2011
1815
  const u = c.getTransformerByCreate();
2012
1816
  return this._permissionService.composePermission$([
2013
- new Yn(s).id,
2014
- new Xn(s, o).id
1817
+ new Xn(s).id,
1818
+ new zn(s, o).id
2015
1819
  ]).pipe(
2016
1820
  Ie((l) => l.every((g) => g.value)),
2017
- rr()
1821
+ ir()
2018
1822
  ).pipe(
2019
1823
  Ie((l) => ({
2020
1824
  permission: l,
@@ -2036,7 +1840,7 @@ let Gt = class extends re {
2036
1840
  },
2037
1841
  complete: () => {
2038
1842
  this._drawingManagerService.setDrawingVisible(!0);
2039
- const e = this._univerInstanceService.getCurrentUnitForType(B.UNIVER_SHEET), n = e == null ? void 0 : e.getActiveSheet(), r = e == null ? void 0 : e.getUnitId(), s = n == null ? void 0 : n.getSheetId();
1843
+ const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET), n = e == null ? void 0 : e.getActiveSheet(), r = e == null ? void 0 : e.getUnitId(), s = n == null ? void 0 : n.getSheetId();
2040
1844
  if (!r || !s)
2041
1845
  return;
2042
1846
  const o = this._drawingManagerService.getDrawingData(r, s), a = Object.values(o);
@@ -2046,9 +1850,9 @@ let Gt = class extends re {
2046
1850
  );
2047
1851
  }
2048
1852
  _initEditPermissionChange() {
2049
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET), t = this._userManagerService.currentUser$;
1853
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET), t = this._userManagerService.currentUser$;
2050
1854
  this.disposeWithMe(
2051
- gt([i, t]).pipe(
1855
+ ft([i, t]).pipe(
2052
1856
  ve(([e, n]) => e ? e.activeSheet$.pipe(
2053
1857
  ve((r) => {
2054
1858
  if (!r)
@@ -2058,11 +1862,11 @@ let Gt = class extends re {
2058
1862
  return De;
2059
1863
  const u = c.getTransformerByCreate();
2060
1864
  return this._permissionService.composePermission$([
2061
- new fn(s).id,
1865
+ new wn(s).id,
2062
1866
  new pn(s, o).id
2063
1867
  ]).pipe(
2064
1868
  Ie((l) => l.every((g) => g.value)),
2065
- rr()
1869
+ ir()
2066
1870
  ).pipe(
2067
1871
  Ie((l) => ({
2068
1872
  permission: l,
@@ -2085,7 +1889,7 @@ let Gt = class extends re {
2085
1889
  }), r.clearSelectedObjects());
2086
1890
  },
2087
1891
  complete: () => {
2088
- const e = this._univerInstanceService.getCurrentUnitForType(B.UNIVER_SHEET);
1892
+ const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
2089
1893
  if (!e)
2090
1894
  return;
2091
1895
  const n = e.getUnitId(), r = e.getActiveSheet();
@@ -2103,21 +1907,21 @@ let Gt = class extends re {
2103
1907
  );
2104
1908
  }
2105
1909
  };
2106
- Gt = ro([
2107
- lt(0, de),
2108
- lt(1, ee),
2109
- lt(2, _i),
2110
- lt(3, he),
2111
- lt(4, N(vi))
2112
- ], Gt);
2113
- var io = Object.getOwnPropertyDescriptor, so = (i, t, e, n) => {
2114
- for (var r = n > 1 ? void 0 : n ? io(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1910
+ Vt = oo([
1911
+ ut(0, de),
1912
+ ut(1, ee),
1913
+ ut(2, _i),
1914
+ ut(3, he),
1915
+ ut(4, N(vi))
1916
+ ], Vt);
1917
+ var ao = Object.getOwnPropertyDescriptor, co = (i, t, e, n) => {
1918
+ for (var r = n > 1 ? void 0 : n ? ao(t, e) : t, s = i.length - 1, o; s >= 0; s--)
2115
1919
  (o = i[s]) && (r = o(r) || r);
2116
1920
  return r;
2117
1921
  }, Ae = (i, t) => (e, n) => t(e, n, i);
2118
- const oo = "univer-sheet-float-dom-";
2119
- function Yr(i, t, e, n, r, s = !1) {
2120
- const { scaleX: o, scaleY: a } = t.getAncestorScale(), c = t.getViewport(lr.VIEW_MAIN), u = n.getFreeze(), { startColumn: d, startRow: l, xSplit: g, ySplit: h } = u, m = {
1922
+ const lo = "univer-sheet-float-dom-";
1923
+ function Kr(i, t, e, n, r, s = !1) {
1924
+ const { scaleX: o, scaleY: a } = t.getAncestorScale(), c = t.getViewport(ur.VIEW_MAIN), u = n.getFreeze(), { startColumn: d, startRow: l, xSplit: g, ySplit: h } = u, f = {
2121
1925
  left: !0,
2122
1926
  // left means the left of pic is in a viewMainLeft
2123
1927
  top: !0
@@ -2125,9 +1929,9 @@ function Yr(i, t, e, n, r, s = !1) {
2125
1929
  if (!c)
2126
1930
  return {
2127
1931
  ...i,
2128
- absolute: m
1932
+ absolute: f
2129
1933
  };
2130
- const { left: f, right: p, top: S, bottom: _ } = i;
1934
+ const { left: m, right: p, top: S, bottom: _ } = i;
2131
1935
  let { top: R, left: M, viewportScrollX: I, viewportScrollY: v } = c;
2132
1936
  const { boundsOfViewArea: C, scrollDirectionResponse: D } = r || {}, { rowHeaderWidth: T, columnHeaderHeight: b } = e, E = {
2133
1937
  top: s ? 0 : b,
@@ -2137,24 +1941,24 @@ function Yr(i, t, e, n, r, s = !1) {
2137
1941
  let w = 0, y = 0;
2138
1942
  const O = e.rowStartY(l - h) + b, x = e.colStartX(d - g) + T, q = e.rowStartY(l) + b, z = e.colStartX(d) + T;
2139
1943
  if (g === 0)
2140
- m.left = !1, w = (f - I) * o, y = (p - I) * o;
1944
+ f.left = !1, w = (m - I) * o, y = (p - I) * o;
2141
1945
  else {
2142
- const Y = f - (x - T), k = p - (x - T);
2143
- p < z ? (w = Y * o, y = k * o) : f <= z && p >= z ? (w = Y * o, y = Math.max(M, (p - I) * o)) : f > z && (m.left = !1, w = Math.max((f - I) * o, M), y = Math.max((p - I) * o, M));
1946
+ const Y = m - (x - T), k = p - (x - T);
1947
+ p < z ? (w = Y * o, y = k * o) : m <= z && p >= z ? (w = Y * o, y = Math.max(M, (p - I) * o)) : m > z && (f.left = !1, w = Math.max((m - I) * o, M), y = Math.max((p - I) * o, M));
2144
1948
  }
2145
- let G = 0, V = 0;
1949
+ let V = 0, G = 0;
2146
1950
  if (h === 0)
2147
- m.top = !1, G = (S - v) * a, V = (_ - v) * a;
1951
+ f.top = !1, V = (S - v) * a, G = (_ - v) * a;
2148
1952
  else {
2149
1953
  const Y = S - (O - b), k = _ - (O - b);
2150
- _ < q ? (G = Y * a, V = k * a) : S <= q && _ >= q ? (G = Y * a, V = Math.max(R, (_ - v) * a)) : S > q && (m.top = !1, G = Math.max((S - v) * a, R), V = Math.max((_ - v) * a, R));
1954
+ _ < q ? (V = Y * a, G = k * a) : S <= q && _ >= q ? (V = Y * a, G = Math.max(R, (_ - v) * a)) : S > q && (f.top = !1, V = Math.max((S - v) * a, R), G = Math.max((_ - v) * a, R));
2151
1955
  }
2152
- return w = Math.max(w, E.left), G = Math.max(G, E.top), y = Math.max(y, E.left), V = Math.max(V, E.top), {
1956
+ return w = Math.max(w, E.left), V = Math.max(V, E.top), y = Math.max(y, E.left), G = Math.max(G, E.top), {
2153
1957
  left: w,
2154
1958
  right: y,
2155
- top: G,
2156
- bottom: V,
2157
- absolute: m
1959
+ top: V,
1960
+ bottom: G,
1961
+ absolute: f
2158
1962
  };
2159
1963
  }
2160
1964
  const _e = (i, t, e, n, r) => {
@@ -2163,7 +1967,7 @@ const _e = (i, t, e, n, r) => {
2163
1967
  right: s + a,
2164
1968
  top: o,
2165
1969
  bottom: o + c
2166
- }, l = Yr(d, t, e, n, r), { scaleX: g, scaleY: h } = t.getAncestorScale();
1970
+ }, l = Kr(d, t, e, n, r), { scaleX: g, scaleY: h } = t.getAncestorScale();
2167
1971
  return {
2168
1972
  startX: l.left,
2169
1973
  endX: l.right,
@@ -2175,23 +1979,23 @@ const _e = (i, t, e, n, r) => {
2175
1979
  absolute: l.absolute
2176
1980
  };
2177
1981
  };
2178
- let pt = class extends re {
1982
+ let wt = class extends re {
2179
1983
  constructor(t, e, n, r, s, o, a) {
2180
1984
  super();
2181
1985
  /**
2182
1986
  * for update dom container position when scrolling and zoom
2183
1987
  */
2184
1988
  ae(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
2185
- ae(this, "_transformChange$", new dn());
1989
+ ae(this, "_transformChange$", new ln());
2186
1990
  ae(this, "transformChange$", this._transformChange$.asObservable());
2187
- ae(this, "_add$", new dn());
1991
+ ae(this, "_add$", new ln());
2188
1992
  ae(this, "add$", this._add$.asObservable());
2189
- ae(this, "_remove$", new dn());
1993
+ ae(this, "_remove$", new ln());
2190
1994
  ae(this, "remove$", this._remove$.asObservable());
2191
1995
  this._renderManagerService = t, this._univerInstanceService = e, this._commandService = n, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = a, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
2192
1996
  }
2193
1997
  _bindScrollEvent() {
2194
- this._lifecycleService.lifecycle$.pipe(Ms((t) => t === Ci.Rendered), ys(1)).subscribe(() => {
1998
+ this._lifecycleService.lifecycle$.pipe(ys((t) => t === Ci.Rendered), Ts(1)).subscribe(() => {
2195
1999
  this._scrollUpdateListener();
2196
2000
  });
2197
2001
  }
@@ -2217,7 +2021,7 @@ let pt = class extends re {
2217
2021
  this._drawingManagerService.add$.subscribe((t) => {
2218
2022
  t.forEach((e) => {
2219
2023
  var Y;
2220
- const { unitId: n, subUnitId: r, drawingId: s } = e, o = ce(this._univerInstanceService, { unitId: n, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(e), c = this._univerInstanceService.getUnit(n, B.UNIVER_SHEET);
2024
+ const { unitId: n, subUnitId: r, drawingId: s } = e, o = ce(this._univerInstanceService, { unitId: n, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(e), c = this._univerInstanceService.getUnit(n, $.UNIVER_SHEET);
2221
2025
  if (!c)
2222
2026
  return;
2223
2027
  const u = c.getActiveSheet().getSheetId();
@@ -2227,17 +2031,17 @@ let pt = class extends re {
2227
2031
  if (!d)
2228
2032
  return;
2229
2033
  const { transform: l, drawingType: g, data: h } = a;
2230
- if (g !== $.DRAWING_DOM && g !== $.DRAWING_CHART)
2034
+ if (g !== B.DRAWING_DOM && g !== B.DRAWING_CHART)
2231
2035
  return;
2232
- const m = this._getSceneAndTransformerByDrawingSearch(n);
2233
- if (m == null)
2036
+ const f = this._getSceneAndTransformerByDrawingSearch(n);
2037
+ if (f == null)
2234
2038
  return;
2235
- const { scene: f, canvas: p } = m;
2039
+ const { scene: m, canvas: p } = f;
2236
2040
  if (l == null)
2237
2041
  return !0;
2238
2042
  if (u !== r)
2239
2043
  return;
2240
- const { left: S, top: _, width: R, height: M, angle: I, flipX: v, flipY: C, skewX: D, skewY: T } = l, b = ye({ unitId: n, subUnitId: r, drawingId: s }), E = f.getObject(b);
2044
+ const { left: S, top: _, width: R, height: M, angle: I, flipX: v, flipY: C, skewX: D, skewY: T } = l, b = ye({ unitId: n, subUnitId: r, drawingId: s }), E = m.getObject(b);
2241
2045
  if (E != null) {
2242
2046
  E.transformByState({ left: S, top: _, width: R, height: M, angle: I, flipX: v, flipY: C, skewX: D, skewY: T });
2243
2047
  return;
@@ -2248,26 +2052,26 @@ let pt = class extends re {
2248
2052
  width: R,
2249
2053
  height: M,
2250
2054
  zIndex: this._drawingManagerService.getDrawingOrder(n, r).length - 1
2251
- }, y = g === $.DRAWING_CHART;
2055
+ }, y = g === B.DRAWING_CHART;
2252
2056
  if (w.rotateEnabled = !1, y) {
2253
2057
  const k = h ? h.backgroundColor : "white";
2254
2058
  w.fill = k, h && h.border && (w.stroke = h.border), w.paintFirst = "stroke", w.strokeWidth = 1, w.borderEnabled = !1, w.radius = 8;
2255
2059
  }
2256
- const O = new Ge(b, w);
2257
- y && O.setObjectType(kn.CHART), f.addObject(O, tn), a.allowTransform !== !1 && f.attachTransformerTo(O);
2258
- const x = new Ut(), q = _e(O, m.renderUnit.scene, d.skeleton, o.worksheet), z = new ze(q), G = `${oo}${Ze(6)}`, V = {
2060
+ const O = new Ve(b, w);
2061
+ y && O.setObjectType(Bn.CHART), m.addObject(O, nn), a.allowTransform !== !1 && m.attachTransformerTo(O);
2062
+ const x = new Pt(), q = _e(O, f.renderUnit.scene, d.skeleton, o.worksheet), z = new ze(q), V = `${lo}${Ze(6)}`, G = {
2259
2063
  dispose: x,
2260
2064
  rect: O,
2261
2065
  position$: z,
2262
2066
  unitId: n,
2263
2067
  subUnitId: r,
2264
2068
  id: s,
2265
- domId: G
2069
+ domId: V
2266
2070
  };
2267
2071
  this._canvasFloatDomService.addFloatDom({
2268
2072
  position$: z,
2269
2073
  id: s,
2270
- domId: G,
2074
+ domId: V,
2271
2075
  componentKey: a.componentKey,
2272
2076
  onPointerDown: (k) => {
2273
2077
  p.dispatchEvent(new PointerEvent(k.type, k));
@@ -2285,14 +2089,14 @@ let pt = class extends re {
2285
2089
  unitId: n
2286
2090
  });
2287
2091
  const J = O.onTransformChange$.subscribeEvent(() => {
2288
- const k = _e(O, m.renderUnit.scene, d.skeleton, o.worksheet);
2092
+ const k = _e(O, f.renderUnit.scene, d.skeleton, o.worksheet);
2289
2093
  z.next(
2290
2094
  k
2291
2095
  );
2292
2096
  });
2293
2097
  x.add(() => {
2294
2098
  this._canvasFloatDomService.removeFloatDom(s);
2295
- }), J && x.add(J), this._domLayerInfoMap.set(s, V);
2099
+ }), J && x.add(J), this._domLayerInfoMap.set(s, G);
2296
2100
  });
2297
2101
  })
2298
2102
  ), this.disposeWithMe(
@@ -2321,15 +2125,15 @@ let pt = class extends re {
2321
2125
  });
2322
2126
  };
2323
2127
  this.disposeWithMe(
2324
- this._univerInstanceService.getCurrentTypeOfUnit$(B.UNIVER_SHEET).pipe(
2325
- ve((e) => e ? e.activeSheet$ : _n(null)),
2128
+ this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET).pipe(
2129
+ ve((e) => e ? e.activeSheet$ : vn(null)),
2326
2130
  Ie((e) => {
2327
2131
  if (!e) return null;
2328
2132
  const n = e.getUnitId(), r = this._renderManagerService.getRenderById(n);
2329
2133
  return r ? { render: r, unitId: n, subUnitId: e.getSheetId() } : null;
2330
2134
  }),
2331
2135
  ve(
2332
- (e) => e ? Ri(e.render.scene.getViewport(lr.VIEW_MAIN).onScrollAfter$).pipe(Ie(() => ({ unitId: e.unitId, subUnitId: e.subUnitId }))) : _n(null)
2136
+ (e) => e ? Ri(e.render.scene.getViewport(ur.VIEW_MAIN).onScrollAfter$).pipe(Ie(() => ({ unitId: e.unitId, subUnitId: e.subUnitId }))) : vn(null)
2333
2137
  )
2334
2138
  ).subscribe((e) => {
2335
2139
  if (!e) return;
@@ -2337,15 +2141,15 @@ let pt = class extends re {
2337
2141
  t(n, r);
2338
2142
  })
2339
2143
  ), this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
2340
- if (e.id === Bn.id) {
2144
+ if (e.id === Wn.id) {
2341
2145
  const n = e.params, { unitId: r } = n;
2342
2146
  Array.from(this._domLayerInfoMap.values()).filter((o) => o.unitId === r).map((o) => o.subUnitId).forEach((o) => {
2343
2147
  t(r, o);
2344
2148
  });
2345
- } else if (e.id === Wi.id) {
2149
+ } else if (e.id === Fi.id) {
2346
2150
  const { unitId: n, subUnitId: r } = e.params;
2347
2151
  t(n, r);
2348
- } else if (e.id === ji.id) {
2152
+ } else if (e.id === Li.id) {
2349
2153
  const { unitId: n, subUnitId: r } = e.params;
2350
2154
  t(n, r);
2351
2155
  }
@@ -2355,7 +2159,7 @@ let pt = class extends re {
2355
2159
  const s = this._domLayerInfoMap.get(n), o = this._getSceneAndTransformerByDrawingSearch(t);
2356
2160
  if (s && o) {
2357
2161
  const { scene: a } = o, c = ye({ unitId: t, subUnitId: e, drawingId: n }), u = a.getObject(c);
2358
- u && u instanceof Ge && u.setProps(r);
2162
+ u && u instanceof Ve && u.setProps(r);
2359
2163
  }
2360
2164
  }
2361
2165
  _getPosition(t, e) {
@@ -2390,7 +2194,7 @@ let pt = class extends re {
2390
2194
  this._drawingManagerService.update$.subscribe((t) => {
2391
2195
  t.forEach((e) => {
2392
2196
  const n = this._drawingManagerService.getDrawingByParam(e);
2393
- if (!n || n.drawingType !== $.DRAWING_DOM && n.drawingType !== $.DRAWING_CHART)
2197
+ if (!n || n.drawingType !== B.DRAWING_DOM && n.drawingType !== B.DRAWING_CHART)
2394
2198
  return;
2395
2199
  const r = {
2396
2200
  ...n.transform
@@ -2399,7 +2203,7 @@ let pt = class extends re {
2399
2203
  ...n
2400
2204
  });
2401
2205
  const s = this._getSceneAndTransformerByDrawingSearch(e.unitId);
2402
- if (s && n.drawingType !== $.DRAWING_CHART) {
2206
+ if (s && n.drawingType !== B.DRAWING_CHART) {
2403
2207
  const { scene: o } = s, a = this._domLayerInfoMap.get(e.drawingId);
2404
2208
  a != null && a.rect && (n.allowTransform === !1 ? o.detachTransformerFrom(a.rect) : o.attachTransformerTo(a.rect));
2405
2209
  }
@@ -2431,7 +2235,7 @@ let pt = class extends re {
2431
2235
  unitId: r,
2432
2236
  subUnitId: s,
2433
2237
  drawingId: d,
2434
- drawingType: t.type || $.DRAWING_DOM,
2238
+ drawingType: t.type || B.DRAWING_DOM,
2435
2239
  componentKey: a,
2436
2240
  sheetTransform: l,
2437
2241
  transform: {
@@ -2484,14 +2288,14 @@ let pt = class extends re {
2484
2288
  if (!u) return;
2485
2289
  const d = (v = this._renderManagerService.getRenderById(o)) == null ? void 0 : v.with(Z).getWorksheetSkeleton(a);
2486
2290
  if (!d) return;
2487
- const { componentKey: l, data: g, allowTransform: h = !0 } = e, m = r != null ? r : Ze(), { position: f, position$: p } = this._createRangePositionObserver(t, u, d.skeleton);
2488
- if (this._getPosition(f, o) == null)
2291
+ const { componentKey: l, data: g, allowTransform: h = !0 } = e, f = r != null ? r : Ze(), { position: m, position$: p } = this._createRangePositionObserver(t, u, d.skeleton);
2292
+ if (this._getPosition(m, o) == null)
2489
2293
  return;
2490
- const _ = c.scene, { scaleX: R } = _.getAncestorScale(), M = kt(f, n, R), I = {
2294
+ const _ = c.scene, { scaleX: R } = _.getAncestorScale(), M = Bt(m, n, R), I = {
2491
2295
  unitId: o,
2492
2296
  subUnitId: a,
2493
- drawingId: m,
2494
- drawingType: e.type || $.DRAWING_DOM,
2297
+ drawingId: f,
2298
+ drawingType: e.type || B.DRAWING_DOM,
2495
2299
  componentKey: l,
2496
2300
  transform: {
2497
2301
  left: M.startX,
@@ -2503,7 +2307,7 @@ let pt = class extends re {
2503
2307
  allowTransform: h
2504
2308
  };
2505
2309
  {
2506
- const { unitId: T, subUnitId: b, drawingId: E } = I, w = ce(this._univerInstanceService, { unitId: T, subUnitId: b }), y = I, O = this._univerInstanceService.getUnit(T, B.UNIVER_SHEET);
2310
+ const { unitId: T, subUnitId: b, drawingId: E } = I, w = ce(this._univerInstanceService, { unitId: T, subUnitId: b }), y = I, O = this._univerInstanceService.getUnit(T, $.UNIVER_SHEET);
2507
2311
  if (!O)
2508
2312
  return;
2509
2313
  const x = O.getActiveSheet().getSheetId();
@@ -2515,49 +2319,49 @@ let pt = class extends re {
2515
2319
  const z = q.getWorksheetSkeleton(b);
2516
2320
  if (!z)
2517
2321
  return;
2518
- const { transform: G, drawingType: V, data: J } = y;
2519
- if (V !== $.DRAWING_DOM && V !== $.DRAWING_CHART)
2322
+ const { transform: V, drawingType: G, data: J } = y;
2323
+ if (G !== B.DRAWING_DOM && G !== B.DRAWING_CHART)
2520
2324
  return;
2521
2325
  const Y = this._getSceneAndTransformerByDrawingSearch(T);
2522
2326
  if (Y == null)
2523
2327
  return;
2524
2328
  const { scene: k, canvas: se } = Y;
2525
- if (G == null || x !== b)
2329
+ if (V == null || x !== b)
2526
2330
  return;
2527
- const { left: ge, top: me, width: le, height: Re, angle: Ue, flipX: en, flipY: Rt, skewX: Dt, skewY: We } = G, bt = ye({ unitId: T, subUnitId: b, drawingId: E }), fe = k.getObject(bt);
2528
- if (fe != null) {
2529
- fe.transformByState({ left: ge, top: me, width: le, height: Re, angle: Ue, flipX: en, flipY: Rt, skewX: Dt, skewY: We });
2331
+ const { left: ge, top: fe, width: le, height: Re, angle: Ue, flipX: tn, flipY: Dt, skewX: bt, skewY: We } = V, Mt = ye({ unitId: T, subUnitId: b, drawingId: E }), me = k.getObject(Mt);
2332
+ if (me != null) {
2333
+ me.transformByState({ left: ge, top: fe, width: le, height: Re, angle: Ue, flipX: tn, flipY: Dt, skewX: bt, skewY: We });
2530
2334
  return;
2531
2335
  }
2532
2336
  const oe = {
2533
2337
  left: ge,
2534
2338
  // from floatDomParam.transform
2535
- top: me,
2339
+ top: fe,
2536
2340
  width: le,
2537
2341
  height: Re,
2538
2342
  zIndex: this._drawingManagerService.getDrawingOrder(T, b).length - 1
2539
- }, je = V === $.DRAWING_CHART;
2343
+ }, je = G === B.DRAWING_CHART;
2540
2344
  if (je) {
2541
2345
  const W = J ? J.backgroundColor : "white";
2542
2346
  oe.fill = W, oe.rotateEnabled = !1, J && J.border && (oe.stroke = J.border), oe.paintFirst = "stroke", oe.strokeWidth = 1, oe.borderEnabled = !1, oe.radius = 8;
2543
2347
  }
2544
- const pe = new Ge(bt, oe);
2545
- je && pe.setObjectType(kn.CHART), k.addObject(pe, tn), y.allowTransform !== !1 && k.attachTransformerTo(pe);
2546
- const we = new Ut(), Mt = k.getMainViewport(), { rowHeaderWidth: Fe, columnHeaderHeight: st } = z.skeleton, yt = {
2547
- top: st,
2348
+ const pe = new Ve(Mt, oe);
2349
+ je && pe.setObjectType(Bn.CHART), k.addObject(pe, nn), y.allowTransform !== !1 && k.attachTransformerTo(pe);
2350
+ const we = new Pt(), yt = k.getMainViewport(), { rowHeaderWidth: Fe, columnHeaderHeight: ot } = z.skeleton, Tt = {
2351
+ top: ot,
2548
2352
  left: Fe,
2549
- bottom: Mt.bottom,
2550
- right: Mt.right
2353
+ bottom: yt.bottom,
2354
+ right: yt.right
2551
2355
  }, Se = {
2552
2356
  dispose: we,
2553
2357
  rect: pe,
2554
- boundsOfViewArea: yt,
2358
+ boundsOfViewArea: Tt,
2555
2359
  domAnchor: n,
2556
2360
  unitId: T,
2557
2361
  subUnitId: b
2558
2362
  }, H = _e(pe, Y.renderUnit.scene, z.skeleton, w.worksheet, Se), Le = new ze(H);
2559
2363
  Se.position$ = Le;
2560
- let ot = {
2364
+ let at = {
2561
2365
  position$: Le,
2562
2366
  id: E,
2563
2367
  componentKey: y.componentKey,
@@ -2573,8 +2377,8 @@ let pt = class extends re {
2573
2377
  data: J,
2574
2378
  unitId: T
2575
2379
  };
2576
- e.eventPassThrough && (ot = {
2577
- ...ot,
2380
+ e.eventPassThrough && (at = {
2381
+ ...at,
2578
2382
  onPointerDown: (W) => {
2579
2383
  se.dispatchEvent(new PointerEvent(W.type, W));
2580
2384
  },
@@ -2584,33 +2388,33 @@ let pt = class extends re {
2584
2388
  onPointerUp: (W) => {
2585
2389
  se.dispatchEvent(new PointerEvent(W.type, W));
2586
2390
  }
2587
- }), this._canvasFloatDomService.addFloatDom(ot), this.disposeWithMe(p.subscribe((W) => {
2588
- var Pn, An, Nn, xn;
2589
- const Un = kt({
2391
+ }), this._canvasFloatDomService.addFloatDom(at), this.disposeWithMe(p.subscribe((W) => {
2392
+ var An, Nn, xn, kn;
2393
+ const Pn = Bt({
2590
2394
  startX: W.startX,
2591
2395
  startY: W.startY,
2592
2396
  endX: W.endX,
2593
2397
  endY: W.endY,
2594
- width: (Pn = n.width) != null ? Pn : W.width,
2595
- height: (An = n.height) != null ? An : W.height,
2398
+ width: (An = n.width) != null ? An : W.width,
2399
+ height: (Nn = n.height) != null ? Nn : W.height,
2596
2400
  absolute: {
2597
- left: f.absolute.left,
2598
- top: f.absolute.top
2401
+ left: m.absolute.left,
2402
+ top: m.absolute.top
2599
2403
  }
2600
- }, n), Kr = ye({ unitId: T, subUnitId: b, drawingId: E }), Jr = new Ge(Kr, {
2601
- left: Un.startX,
2602
- top: Un.startY,
2603
- width: (Nn = n.width) != null ? Nn : W.width,
2604
- height: (xn = n.height) != null ? xn : W.height,
2404
+ }, n), Jr = ye({ unitId: T, subUnitId: b, drawingId: E }), Zr = new Ve(Jr, {
2405
+ left: Pn.startX,
2406
+ top: Pn.startY,
2407
+ width: (xn = n.width) != null ? xn : W.width,
2408
+ height: (kn = n.height) != null ? kn : W.height,
2605
2409
  zIndex: this._drawingManagerService.getDrawingOrder(T, b).length - 1
2606
- }), Zr = _e(Jr, Y.renderUnit.scene, z.skeleton, w.worksheet, Se);
2607
- Le.next(Zr);
2410
+ }), qr = _e(Zr, Y.renderUnit.scene, z.skeleton, w.worksheet, Se);
2411
+ Le.next(qr);
2608
2412
  }));
2609
- const at = (D = this._renderManagerService.getRenderById(T)) == null ? void 0 : D.with(Z);
2610
- at == null || at.currentSkeleton$.subscribe((W) => {
2611
- W && z.sheetId !== W.sheetId && this._removeDom(m, !0);
2413
+ const ct = (D = this._renderManagerService.getRenderById(T)) == null ? void 0 : D.with(Z);
2414
+ ct == null || ct.currentSkeleton$.subscribe((W) => {
2415
+ W && z.sheetId !== W.sheetId && this._removeDom(f, !0);
2612
2416
  });
2613
- const Tt = pe.onTransformChange$.subscribeEvent(() => {
2417
+ const Et = pe.onTransformChange$.subscribeEvent(() => {
2614
2418
  const W = _e(pe, Y.renderUnit.scene, z.skeleton, w.worksheet, Se);
2615
2419
  Le.next(
2616
2420
  W
@@ -2618,12 +2422,12 @@ let pt = class extends re {
2618
2422
  });
2619
2423
  we.add(() => {
2620
2424
  this._canvasFloatDomService.removeFloatDom(E);
2621
- }), Tt && we.add(Tt), this._domLayerInfoMap.set(E, Se);
2425
+ }), Et && we.add(Et), this._domLayerInfoMap.set(E, Se);
2622
2426
  }
2623
2427
  return {
2624
- id: m,
2428
+ id: f,
2625
2429
  dispose: () => {
2626
- this._removeDom(m, !0);
2430
+ this._removeDom(f, !0);
2627
2431
  }
2628
2432
  };
2629
2433
  }
@@ -2642,19 +2446,19 @@ let pt = class extends re {
2642
2446
  if (!u) return;
2643
2447
  const d = (M = this._renderManagerService.getRenderById(o)) == null ? void 0 : M.with(Z).getWorksheetSkeleton(a);
2644
2448
  if (!d) return;
2645
- const { componentKey: l, data: g, allowTransform: h = !0 } = e, m = r != null ? r : Ze(), { position: f, position$: p } = this._createRangePositionObserver({
2449
+ const { componentKey: l, data: g, allowTransform: h = !0 } = e, f = r != null ? r : Ze(), { position: m, position$: p } = this._createRangePositionObserver({
2646
2450
  startRow: 0,
2647
2451
  endRow: 0,
2648
2452
  startColumn: t,
2649
2453
  endColumn: t
2650
- }, u, d.skeleton), S = f;
2651
- if (S.startY = 0, this._getPosition(f, o) == null)
2454
+ }, u, d.skeleton), S = m;
2455
+ if (S.startY = 0, this._getPosition(m, o) == null)
2652
2456
  return;
2653
2457
  const R = {
2654
2458
  unitId: o,
2655
2459
  subUnitId: a,
2656
- drawingId: m,
2657
- drawingType: e.type || $.DRAWING_DOM,
2460
+ drawingId: f,
2461
+ drawingType: e.type || B.DRAWING_DOM,
2658
2462
  componentKey: l,
2659
2463
  transform: {
2660
2464
  left: S.startX,
@@ -2666,7 +2470,7 @@ let pt = class extends re {
2666
2470
  allowTransform: h
2667
2471
  };
2668
2472
  {
2669
- const { unitId: C, subUnitId: D, drawingId: T } = R, b = ce(this._univerInstanceService, { unitId: C, subUnitId: D }), E = R, w = this._univerInstanceService.getUnit(C, B.UNIVER_SHEET);
2473
+ const { unitId: C, subUnitId: D, drawingId: T } = R, b = ce(this._univerInstanceService, { unitId: C, subUnitId: D }), E = R, w = this._univerInstanceService.getUnit(C, $.UNIVER_SHEET);
2670
2474
  if (!w)
2671
2475
  return;
2672
2476
  const y = w.getActiveSheet().getSheetId();
@@ -2678,37 +2482,37 @@ let pt = class extends re {
2678
2482
  const x = O.getWorksheetSkeleton(D);
2679
2483
  if (!x)
2680
2484
  return;
2681
- const { transform: q, data: z } = E, G = this._getSceneAndTransformerByDrawingSearch(C);
2682
- if (G == null)
2485
+ const { transform: q, data: z } = E, V = this._getSceneAndTransformerByDrawingSearch(C);
2486
+ if (V == null)
2683
2487
  return;
2684
- const { scene: V, canvas: J } = G;
2488
+ const { scene: G, canvas: J } = V;
2685
2489
  if (q == null || y !== D)
2686
2490
  return;
2687
- const { left: Y, top: k, width: se, height: ge, angle: me, flipX: le, flipY: Re, skewX: Ue, skewY: en } = q, Rt = ye({ unitId: C, subUnitId: D, drawingId: T }), Dt = V.getObject(Rt);
2688
- if (Dt != null) {
2689
- Dt.transformByState({ left: Y, top: k, width: se, height: ge, angle: me, flipX: le, flipY: Re, skewX: Ue, skewY: en });
2491
+ const { left: Y, top: k, width: se, height: ge, angle: fe, flipX: le, flipY: Re, skewX: Ue, skewY: tn } = q, Dt = ye({ unitId: C, subUnitId: D, drawingId: T }), bt = G.getObject(Dt);
2492
+ if (bt != null) {
2493
+ bt.transformByState({ left: Y, top: k, width: se, height: ge, angle: fe, flipX: le, flipY: Re, skewX: Ue, skewY: tn });
2690
2494
  return;
2691
2495
  }
2692
- const We = kt({
2496
+ const We = Bt({
2693
2497
  startX: S.startX,
2694
2498
  startY: 0,
2695
- endX: f.endX,
2696
- endY: f.endY,
2499
+ endX: m.endX,
2500
+ endY: m.endY,
2697
2501
  width: n.width,
2698
2502
  height: n.height,
2699
2503
  absolute: {
2700
- left: f.absolute.left,
2701
- top: f.absolute.top
2504
+ left: m.absolute.left,
2505
+ top: m.absolute.top
2702
2506
  }
2703
- }, n), bt = {
2507
+ }, n), Mt = {
2704
2508
  left: We.startX,
2705
2509
  top: We.startY,
2706
2510
  width: We.width,
2707
2511
  height: We.height,
2708
2512
  zIndex: this._drawingManagerService.getDrawingOrder(C, D).length - 1
2709
- }, fe = new Ge(Rt, bt);
2710
- V.addObject(fe, tn), E.allowTransform !== !1 && V.attachTransformerTo(fe);
2711
- const oe = new Ut(), je = V.getMainViewport(), pe = {
2513
+ }, me = new Ve(Dt, Mt);
2514
+ G.addObject(me, nn), E.allowTransform !== !1 && G.attachTransformerTo(me);
2515
+ const oe = new Pt(), je = G.getMainViewport(), pe = {
2712
2516
  top: 0,
2713
2517
  //viewMain.top,
2714
2518
  left: je.left,
@@ -2716,7 +2520,7 @@ let pt = class extends re {
2716
2520
  right: je.right
2717
2521
  }, we = {
2718
2522
  dispose: oe,
2719
- rect: fe,
2523
+ rect: me,
2720
2524
  // position$,
2721
2525
  unitId: C,
2722
2526
  subUnitId: D,
@@ -2724,9 +2528,9 @@ let pt = class extends re {
2724
2528
  domAnchor: n,
2725
2529
  scrollDirectionResponse: "HORIZONTAL"
2726
2530
  /* HORIZONTAL */
2727
- }, Mt = _e(fe, G.renderUnit.scene, x.skeleton, b.worksheet, we), Fe = new ze(Mt);
2531
+ }, yt = _e(me, V.renderUnit.scene, x.skeleton, b.worksheet, we), Fe = new ze(yt);
2728
2532
  we.position$ = Fe;
2729
- let st = {
2533
+ let ot = {
2730
2534
  position$: Fe,
2731
2535
  id: T,
2732
2536
  componentKey: E.componentKey,
@@ -2742,8 +2546,8 @@ let pt = class extends re {
2742
2546
  data: z,
2743
2547
  unitId: C
2744
2548
  };
2745
- e.eventPassThrough && (st = {
2746
- ...st,
2549
+ e.eventPassThrough && (ot = {
2550
+ ...ot,
2747
2551
  onPointerDown: (H) => {
2748
2552
  J.dispatchEvent(new PointerEvent(H.type, H));
2749
2553
  },
@@ -2753,15 +2557,15 @@ let pt = class extends re {
2753
2557
  onPointerUp: (H) => {
2754
2558
  J.dispatchEvent(new PointerEvent(H.type, H));
2755
2559
  }
2756
- }), this._canvasFloatDomService.addFloatDom(st);
2757
- const yt = fe.onTransformChange$.subscribeEvent(() => {
2758
- const H = _e(fe, G.renderUnit.scene, x.skeleton, b.worksheet, we);
2560
+ }), this._canvasFloatDomService.addFloatDom(ot);
2561
+ const Tt = me.onTransformChange$.subscribeEvent(() => {
2562
+ const H = _e(me, V.renderUnit.scene, x.skeleton, b.worksheet, we);
2759
2563
  Fe.next(
2760
2564
  H
2761
2565
  );
2762
2566
  });
2763
2567
  this.disposeWithMe(p.subscribe((H) => {
2764
- const Le = kt({
2568
+ const Le = Bt({
2765
2569
  startX: H.startX,
2766
2570
  startY: 0,
2767
2571
  endX: H.endX,
@@ -2769,29 +2573,29 @@ let pt = class extends re {
2769
2573
  width: n.width,
2770
2574
  height: n.height,
2771
2575
  absolute: {
2772
- left: f.absolute.left,
2773
- top: f.absolute.top
2576
+ left: m.absolute.left,
2577
+ top: m.absolute.top
2774
2578
  }
2775
- }, n), ot = ye({ unitId: C, subUnitId: D, drawingId: T }), at = new Ge(ot, {
2579
+ }, n), at = ye({ unitId: C, subUnitId: D, drawingId: T }), ct = new Ve(at, {
2776
2580
  left: Le.startX,
2777
2581
  top: 0,
2778
2582
  width: n.width,
2779
2583
  height: n.height,
2780
2584
  zIndex: this._drawingManagerService.getDrawingOrder(C, D).length - 1
2781
- }), Tt = _e(at, G.renderUnit.scene, x.skeleton, b.worksheet, we);
2782
- Fe.next(Tt);
2585
+ }), Et = _e(ct, V.renderUnit.scene, x.skeleton, b.worksheet, we);
2586
+ Fe.next(Et);
2783
2587
  }));
2784
2588
  const Se = (v = this._renderManagerService.getRenderById(C)) == null ? void 0 : v.with(Z);
2785
2589
  Se == null || Se.currentSkeleton$.subscribe((H) => {
2786
- H && d.sheetId !== H.sheetId && this._removeDom(m, !0);
2590
+ H && d.sheetId !== H.sheetId && this._removeDom(f, !0);
2787
2591
  }), oe.add(() => {
2788
2592
  this._canvasFloatDomService.removeFloatDom(T);
2789
- }), yt && oe.add(yt), this._domLayerInfoMap.set(T, we);
2593
+ }), Tt && oe.add(Tt), this._domLayerInfoMap.set(T, we);
2790
2594
  }
2791
2595
  return {
2792
- id: m,
2596
+ id: f,
2793
2597
  dispose: () => {
2794
- this._removeDom(m, !0);
2598
+ this._removeDom(f, !0);
2795
2599
  }
2796
2600
  };
2797
2601
  }
@@ -2808,16 +2612,16 @@ let pt = class extends re {
2808
2612
  // eslint-disable-next-line max-lines-per-function
2809
2613
  _createRangePositionObserver(t, e, n) {
2810
2614
  let { startRow: r, startColumn: s } = t;
2811
- const o = ut(r, s, n), a = new ze(o), c = ut(t.endRow, t.endColumn, n), u = new ze(c), d = () => {
2812
- const p = ut(r, s, n), S = ut(t.endRow, t.endColumn, n);
2615
+ const o = ht(r, s, n), a = new ze(o), c = ht(t.endRow, t.endColumn, n), u = new ze(c), d = () => {
2616
+ const p = ht(r, s, n), S = ht(t.endRow, t.endColumn, n);
2813
2617
  a.next(p), u.next(S);
2814
- }, l = new Ut();
2618
+ }, l = new Pt();
2815
2619
  l.add(e.engine.clientRect$.subscribe(() => d())), l.add(this._commandService.onCommandExecuted((p) => {
2816
- if (p.id === fr.id && p.params.rowsAutoHeightInfo.findIndex((_) => _.row === r) > -1) {
2620
+ if (p.id === pr.id && p.params.rowsAutoHeightInfo.findIndex((_) => _.row === r) > -1) {
2817
2621
  d();
2818
2622
  return;
2819
2623
  }
2820
- (Fi.indexOf(p.id) > -1 || p.id === li.id || p.id === Bn.id) && d();
2624
+ (Hi.indexOf(p.id) > -1 || p.id === ui.id || p.id === Wn.id) && d();
2821
2625
  }));
2822
2626
  const g = (p, S) => {
2823
2627
  r = p, s = S, d();
@@ -2833,9 +2637,9 @@ let pt = class extends re {
2833
2637
  startY: o.top,
2834
2638
  endX: c.right,
2835
2639
  endY: c.bottom
2836
- }), m = a.pipe(
2640
+ }), f = a.pipe(
2837
2641
  Ie((p) => {
2838
- const S = ut(t.endRow, t.endColumn, n);
2642
+ const S = ht(t.endRow, t.endColumn, n);
2839
2643
  return {
2840
2644
  rotate: 0,
2841
2645
  width: S.right - p.left,
@@ -2850,10 +2654,10 @@ let pt = class extends re {
2850
2654
  endY: S.bottom
2851
2655
  };
2852
2656
  })
2853
- ), f = h();
2657
+ ), m = h();
2854
2658
  return {
2855
- position$: m,
2856
- position: f,
2659
+ position$: f,
2660
+ position: m,
2857
2661
  updateRowCol: g,
2858
2662
  topLeftPos$: a,
2859
2663
  rightBottomPos$: u,
@@ -2861,16 +2665,16 @@ let pt = class extends re {
2861
2665
  };
2862
2666
  }
2863
2667
  };
2864
- pt = so([
2668
+ wt = co([
2865
2669
  Ae(0, N(ee)),
2866
2670
  Ae(1, he),
2867
2671
  Ae(2, N(K)),
2868
2672
  Ae(3, de),
2869
- Ae(4, N(us)),
2673
+ Ae(4, N(hs)),
2870
2674
  Ae(5, ie),
2871
2675
  Ae(6, N(Ii))
2872
- ], pt);
2873
- function ut(i, t, e) {
2676
+ ], wt);
2677
+ function ht(i, t, e) {
2874
2678
  const n = e.getCellWithCoordByIndex(i, t), r = n.isMergedMainCell ? n.mergeInfo : n;
2875
2679
  return {
2876
2680
  left: r.startX,
@@ -2879,7 +2683,7 @@ function ut(i, t, e) {
2879
2683
  bottom: r.endY
2880
2684
  };
2881
2685
  }
2882
- function kt(i, t, e) {
2686
+ function Bt(i, t, e) {
2883
2687
  var u, d;
2884
2688
  e = e != null ? e : 1;
2885
2689
  const n = i.endX - i.startX, r = i.endY - i.startY, s = (u = t == null ? void 0 : t.width) != null ? u : n, o = (d = t == null ? void 0 : t.height) != null ? d : r;
@@ -2916,9 +2720,9 @@ function $t(i, t) {
2916
2720
  const e = Number.parseFloat(i);
2917
2721
  return t * e / 100;
2918
2722
  }
2919
- const ao = (i) => {
2723
+ const uo = (i) => {
2920
2724
  const { floatDomInfos: t, scene: e, skeleton: n, worksheet: r } = i, s = Ke(() => t.map((o) => {
2921
- const { width: a, height: c, angle: u, left: d, top: l } = o.transform, g = Yr(
2725
+ const { width: a, height: c, angle: u, left: d, top: l } = o.transform, g = Kr(
2922
2726
  {
2923
2727
  left: d != null ? d : 0,
2924
2728
  right: (d != null ? d : 0) + (a != null ? a : 0),
@@ -2930,18 +2734,18 @@ const ao = (i) => {
2930
2734
  r,
2931
2735
  void 0,
2932
2736
  !0
2933
- ), { scaleX: h, scaleY: m } = e.getAncestorScale(), f = {
2737
+ ), { scaleX: h, scaleY: f } = e.getAncestorScale(), m = {
2934
2738
  startX: g.left,
2935
2739
  endX: g.right,
2936
2740
  startY: g.top,
2937
2741
  endY: g.bottom,
2938
2742
  rotate: u,
2939
2743
  width: a * h,
2940
- height: c * m,
2744
+ height: c * f,
2941
2745
  absolute: g.absolute
2942
2746
  }, p = {
2943
- position$: new ze(f),
2944
- position: f,
2747
+ position$: new ze(m),
2748
+ position: m,
2945
2749
  id: o.drawingId,
2946
2750
  componentKey: o.componentKey,
2947
2751
  onPointerMove: () => {
@@ -2957,14 +2761,14 @@ const ao = (i) => {
2957
2761
  };
2958
2762
  return [o.drawingId, p];
2959
2763
  }), [t, e, n, r]);
2960
- return /* @__PURE__ */ X("div", { style: { position: "absolute", top: 0, left: 0 }, children: s.map(([o, a]) => /* @__PURE__ */ X(hs, { layer: a, id: o, position: a.position }, o)) });
2764
+ return /* @__PURE__ */ X("div", { style: { position: "absolute", top: 0, left: 0 }, children: s.map(([o, a]) => /* @__PURE__ */ X(gs, { layer: a, id: o, position: a.position }, o)) });
2961
2765
  };
2962
- var co = Object.getOwnPropertyDescriptor, lo = (i, t, e, n) => {
2963
- for (var r = n > 1 ? void 0 : n ? co(t, e) : t, s = i.length - 1, o; s >= 0; s--)
2766
+ var ho = Object.getOwnPropertyDescriptor, go = (i, t, e, n) => {
2767
+ for (var r = n > 1 ? void 0 : n ? ho(t, e) : t, s = i.length - 1, o; s >= 0; s--)
2964
2768
  (o = i[s]) && (r = o(r) || r);
2965
2769
  return r;
2966
2770
  }, Ne = (i, t) => (e, n) => t(e, n, i);
2967
- let Vt = class extends re {
2771
+ let Gt = class extends re {
2968
2772
  constructor(i, t, e, n, r, s, o) {
2969
2773
  super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = t, this._drawingManagerService = e, this._renderManagerService = n, this._canvasFloatDomManagerService = r, this._componetManager = s, this._injector = o, this._initPrinting(), this._initPrintingDom();
2970
2774
  }
@@ -2977,7 +2781,7 @@ let Vt = class extends re {
2977
2781
  const { unitId: n, scene: r, subUnitId: s } = t, o = this._drawingManagerService.getDrawingDataForUnit(n), a = o == null ? void 0 : o[s];
2978
2782
  return a && a.order.forEach((c) => {
2979
2783
  const u = a.data[c];
2980
- u.drawingType !== $.DRAWING_CHART && u.drawingType !== $.DRAWING_DOM && this._drawingRenderService.renderDrawing(u, r);
2784
+ u.drawingType !== B.DRAWING_CHART && u.drawingType !== B.DRAWING_DOM && this._drawingRenderService.renderDrawing(u, r);
2981
2785
  }), e();
2982
2786
  }
2983
2787
  }
@@ -2999,8 +2803,8 @@ let Vt = class extends re {
2999
2803
  const { scaleX: u, scaleY: d } = s.scene, l = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, g = c.order.map((h) => c.data[h]);
3000
2804
  return g.length ? (g.forEach((h) => {
3001
2805
  if (!h.groupId && h.transform && Qe.isDefine(h.transform.left) && Qe.isDefine(h.transform.top) && Qe.isDefine(h.transform.width) && Qe.isDefine(h.transform.height)) {
3002
- const m = o.skeleton.getCellIndexByOffset(h.transform.left, h.transform.top, u, d, { x: 0, y: 0 }), f = o.skeleton.getCellIndexByOffset(h.transform.left + h.transform.width, h.transform.top + h.transform.height, u, d, { x: 0, y: 0 });
3003
- m.column < l.startColumn && (l.startColumn = m.column), m.row < l.startRow && (l.startRow = m.row), l.endRow < f.row && (l.endRow = f.row), l.endColumn < f.column && (l.endColumn = f.column);
2806
+ const f = o.skeleton.getCellIndexByOffset(h.transform.left, h.transform.top, u, d, { x: 0, y: 0 }), m = o.skeleton.getCellIndexByOffset(h.transform.left + h.transform.width, h.transform.top + h.transform.height, u, d, { x: 0, y: 0 });
2807
+ f.column < l.startColumn && (l.startColumn = f.column), f.row < l.startRow && (l.startRow = f.row), l.endRow < m.row && (l.endRow = m.row), l.endColumn < m.column && (l.endColumn = m.column);
3004
2808
  }
3005
2809
  }), e(l)) : e(i);
3006
2810
  }
@@ -3018,12 +2822,12 @@ let Vt = class extends re {
3018
2822
  if (o) {
3019
2823
  const a = o.order.map((u) => {
3020
2824
  const d = o.data[u];
3021
- if (d.drawingType === $.DRAWING_CHART)
2825
+ if (d.drawingType === B.DRAWING_CHART)
3022
2826
  return {
3023
2827
  ...d,
3024
2828
  componentKey: this._componetManager.get(Di)
3025
2829
  };
3026
- if (d.drawingType === $.DRAWING_DOM) {
2830
+ if (d.drawingType === B.DRAWING_DOM) {
3027
2831
  const l = this._sheetPrintInterceptorService.getPrintComponent(d.componentKey);
3028
2832
  return {
3029
2833
  ...d,
@@ -3031,12 +2835,12 @@ let Vt = class extends re {
3031
2835
  };
3032
2836
  }
3033
2837
  return null;
3034
- }).filter(Boolean), c = gs(ao, this._injector);
3035
- return Zi(
2838
+ }).filter(Boolean), c = fs(uo, this._injector);
2839
+ return qi(
3036
2840
  /* @__PURE__ */ X(c, { floatDomInfos: a, scene: t.scene, skeleton: t.skeleton, worksheet: t.worksheet }),
3037
2841
  t.root
3038
2842
  ), i == null || i.add(() => {
3039
- qi(t.root);
2843
+ Qi(t.root);
3040
2844
  }), e(i);
3041
2845
  }
3042
2846
  }
@@ -3045,22 +2849,21 @@ let Vt = class extends re {
3045
2849
  );
3046
2850
  }
3047
2851
  };
3048
- Vt = lo([
3049
- Ne(0, N(ui)),
3050
- Ne(1, N(xr)),
2852
+ Gt = go([
2853
+ Ne(0, N(hi)),
2854
+ Ne(1, N(kr)),
3051
2855
  Ne(2, de),
3052
2856
  Ne(3, ee),
3053
- Ne(4, N(pt)),
3054
- Ne(5, N(Nr)),
3055
- Ne(6, N(it))
3056
- ], Vt);
3057
- var uo = Object.getOwnPropertyDescriptor, ho = (i, t, e, n) => {
3058
- for (var r = n > 1 ? void 0 : n ? uo(t, e) : t, s = i.length - 1, o; s >= 0; s--)
2857
+ Ne(4, N(wt)),
2858
+ Ne(5, N(xr)),
2859
+ Ne(6, N(st))
2860
+ ], Gt);
2861
+ var fo = Object.getOwnPropertyDescriptor, mo = (i, t, e, n) => {
2862
+ for (var r = n > 1 ? void 0 : n ? fo(t, e) : t, s = i.length - 1, o; s >= 0; s--)
3059
2863
  (o = i[s]) && (r = o(r) || r);
3060
2864
  return r;
3061
2865
  }, be = (i, t) => (e, n) => t(e, n, i);
3062
- const go = [
3063
- pr.id,
2866
+ const po = [
3064
2867
  wr.id,
3065
2868
  Sr.id,
3066
2869
  _r.id,
@@ -3068,9 +2871,9 @@ const go = [
3068
2871
  Ir.id,
3069
2872
  Cr.id,
3070
2873
  Rr.id,
3071
- wn.id,
3072
- Sn.id,
3073
2874
  Dr.id,
2875
+ Sn.id,
2876
+ _n.id,
3074
2877
  br.id,
3075
2878
  Mr.id,
3076
2879
  yr.id,
@@ -3078,16 +2881,17 @@ const go = [
3078
2881
  Er.id,
3079
2882
  Or.id,
3080
2883
  Ur.id,
3081
- Pr.id
3082
- ], mo = [
3083
- Li.id,
3084
- Hi.id,
3085
- Gi.id,
2884
+ Pr.id,
2885
+ Ar.id
2886
+ ], wo = [
3086
2887
  Vi.id,
2888
+ Gi.id,
3087
2889
  Yi.id,
3088
- fr.id,
3089
2890
  Xi.id,
3090
- zi.id
2891
+ zi.id,
2892
+ pr.id,
2893
+ Ki.id,
2894
+ Ji.id
3091
2895
  ];
3092
2896
  let Mn = class extends re {
3093
2897
  constructor(i, t, e, n, r, s, o, a, c) {
@@ -3098,57 +2902,57 @@ let Mn = class extends re {
3098
2902
  this._sheetInterceptorService.interceptAfterCommand({
3099
2903
  /* eslint-disable-next-line complexity */
3100
2904
  getMutations: (i) => {
3101
- if (!go.includes(i.id))
2905
+ if (!po.includes(i.id))
3102
2906
  return { redos: [], undos: [] };
3103
2907
  if (i.params == null)
3104
2908
  return { redos: [], undos: [] };
3105
2909
  const t = i.id;
3106
- if (t === pr.id)
2910
+ if (t === wr.id)
3107
2911
  return this._moveRowInterceptor(i.params, "insert");
3108
- if ([Or.id, Ur.id, Pr.id].includes(t))
2912
+ if ([Ur.id, Pr.id, Ar.id].includes(t))
3109
2913
  return this._moveRangeInterceptor(i.params);
3110
- if (t === wr.id)
3111
- return this._moveColInterceptor(i.params, "insert");
3112
2914
  if (t === Sr.id)
3113
- return this._moveRowInterceptor(i.params, "remove");
2915
+ return this._moveColInterceptor(i.params, "insert");
3114
2916
  if (t === _r.id)
2917
+ return this._moveRowInterceptor(i.params, "remove");
2918
+ if (t === vr.id)
3115
2919
  return this._moveColInterceptor(i.params, "remove");
3116
- if (t === vr.id) {
2920
+ if (t === Ir.id) {
3117
2921
  const { range: e } = i.params;
3118
2922
  return this._getRangeMoveUndo(
3119
2923
  e,
3120
2924
  0
3121
2925
  /* deleteLeft */
3122
2926
  );
3123
- } else if (t === Ir.id) {
2927
+ } else if (t === Cr.id) {
3124
2928
  const { range: e } = i.params;
3125
2929
  return this._getRangeMoveUndo(
3126
2930
  e,
3127
2931
  1
3128
2932
  /* deleteUp */
3129
2933
  );
3130
- } else if (t === Cr.id) {
2934
+ } else if (t === Rr.id) {
3131
2935
  const { range: e } = i.params;
3132
2936
  return this._getRangeMoveUndo(
3133
2937
  e,
3134
2938
  2
3135
2939
  /* insertDown */
3136
2940
  );
3137
- } else if (t === Rr.id) {
2941
+ } else if (t === Dr.id) {
3138
2942
  const { range: e } = i.params;
3139
2943
  return this._getRangeMoveUndo(
3140
2944
  e,
3141
2945
  3
3142
2946
  /* insertRight */
3143
2947
  );
3144
- } else if (t === Mr.id || t === yr.id) {
2948
+ } else if (t === yr.id || t === Tr.id) {
3145
2949
  const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
3146
2950
  return this._getDrawingUndoForRowVisible(n, r, s);
3147
- } else if (t === Tr.id || t === Er.id) {
2951
+ } else if (t === Er.id || t === Or.id) {
3148
2952
  const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
3149
2953
  return this._getDrawingUndoForColVisible(n, r, s);
3150
- } else if (t === wn.id || t === Sn.id || t === Dr.id || t === br.id) {
3151
- const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e, o = t === wn.id || t === Sn.id;
2954
+ } else if (t === Sn.id || t === _n.id || t === br.id || t === Mr.id) {
2955
+ const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e, o = t === Sn.id || t === _n.id;
3152
2956
  return this._getDrawingUndoForRowAndColSize(n, r, s, o);
3153
2957
  }
3154
2958
  return { redos: [], undos: [] };
@@ -3181,7 +2985,7 @@ let Mn = class extends re {
3181
2985
  }
3182
2986
  _getUpdateOrDeleteDrawings(i, t, e) {
3183
2987
  var D, T, b, E;
3184
- const n = [], r = [], { sheetTransform: s, anchorType: o = U.Position, transform: a, unitId: c, subUnitId: u, drawingId: d } = e, { from: l, to: g } = s, { row: h, column: m } = l, { row: f, column: p } = g;
2988
+ const n = [], r = [], { sheetTransform: s, anchorType: o = U.Position, transform: a, unitId: c, subUnitId: u, drawingId: d } = e, { from: l, to: g } = s, { row: h, column: f } = l, { row: m, column: p } = g;
3185
2989
  if (s == null || a == null)
3186
2990
  return {
3187
2991
  updateDrawings: n,
@@ -3189,15 +2993,15 @@ let Mn = class extends re {
3189
2993
  };
3190
2994
  const { startRow: S, endRow: _, startColumn: R, endColumn: M } = i;
3191
2995
  let I = null, v = null, C;
3192
- if (t === 0 && h >= S && f <= _)
3193
- if (m >= R && p <= M)
2996
+ if (t === 0 && h >= S && m <= _)
2997
+ if (f >= R && p <= M)
3194
2998
  r.push({ unitId: c, subUnitId: u, drawingId: d });
3195
2999
  else {
3196
3000
  const w = this._shrinkCol(s, a, R, M, o);
3197
3001
  I = w == null ? void 0 : w.newSheetTransform, v = w == null ? void 0 : w.newTransform, C = (D = w == null ? void 0 : w.axisAlignSheetTransform) != null ? D : void 0;
3198
3002
  }
3199
- else if (t === 1 && m >= R && p <= M)
3200
- if (h >= S && f <= _)
3003
+ else if (t === 1 && f >= R && p <= M)
3004
+ if (h >= S && m <= _)
3201
3005
  r.push({ unitId: c, subUnitId: u, drawingId: d });
3202
3006
  else {
3203
3007
  const w = this._shrinkRow(s, a, S, _, o);
@@ -3231,19 +3035,19 @@ let Mn = class extends re {
3231
3035
  _getDrawingUndoForColVisible(i, t, e) {
3232
3036
  const n = this._drawingManagerService.getDrawingData(i, t), r = [], s = [];
3233
3037
  if (Object.keys(n).forEach((d) => {
3234
- const l = n[d], { sheetTransform: g, transform: h, anchorType: m = U.Position } = l;
3235
- if (m === U.None)
3038
+ const l = n[d], { sheetTransform: g, transform: h, anchorType: f = U.Position } = l;
3039
+ if (f === U.None)
3236
3040
  this._remainDrawingSize(h, r, l);
3237
3041
  else {
3238
- const { from: f, to: p } = g, { row: S, column: _ } = f, { row: R, column: M } = p;
3042
+ const { from: m, to: p } = g, { row: S, column: _ } = m, { row: R, column: M } = p;
3239
3043
  for (let I = 0; I < e.length; I++) {
3240
3044
  const v = e[I], { startRow: C, endRow: D, startColumn: T, endColumn: b } = v;
3241
3045
  if (M < T)
3242
3046
  continue;
3243
- if (m === U.Position) {
3047
+ if (f === U.Position) {
3244
3048
  let y = null, O = null;
3245
3049
  if (_ >= T && _ <= b) {
3246
- const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: _, endColumn: b, startRow: f.row, endRow: p.row });
3050
+ const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: _, endColumn: b, startRow: m.row, endRow: p.row });
3247
3051
  if (x == null)
3248
3052
  return;
3249
3053
  O = { ...h, left: x.startX };
@@ -3263,7 +3067,7 @@ let Mn = class extends re {
3263
3067
  continue;
3264
3068
  let E = null, w = null;
3265
3069
  if (_ >= T && _ <= b) {
3266
- const y = this._skeletonManagerService.attachRangeWithCoord({ startColumn: _, endColumn: b, startRow: f.row, endRow: p.row });
3070
+ const y = this._skeletonManagerService.attachRangeWithCoord({ startColumn: _, endColumn: b, startRow: m.row, endRow: p.row });
3267
3071
  if (y == null)
3268
3072
  return;
3269
3073
  w = {
@@ -3272,7 +3076,7 @@ let Mn = class extends re {
3272
3076
  width: ((h == null ? void 0 : h.width) || 0) - y.endX + y.startX
3273
3077
  };
3274
3078
  } else if (M >= T && M <= b) {
3275
- const y = this._skeletonManagerService.attachRangeWithCoord({ startColumn: T, endColumn: M, startRow: f.row, endRow: p.row });
3079
+ const y = this._skeletonManagerService.attachRangeWithCoord({ startColumn: T, endColumn: M, startRow: m.row, endRow: p.row });
3276
3080
  if (y == null)
3277
3081
  return;
3278
3082
  w = {
@@ -3280,7 +3084,7 @@ let Mn = class extends re {
3280
3084
  left: y.startX - ((h == null ? void 0 : h.width) || 0)
3281
3085
  };
3282
3086
  } else {
3283
- const y = this._skeletonManagerService.attachRangeWithCoord({ startColumn: T, endColumn: b, startRow: f.row, endRow: p.row });
3087
+ const y = this._skeletonManagerService.attachRangeWithCoord({ startColumn: T, endColumn: b, startRow: m.row, endRow: p.row });
3284
3088
  if (y == null)
3285
3089
  return;
3286
3090
  if (w = {
@@ -3331,19 +3135,19 @@ let Mn = class extends re {
3331
3135
  _getDrawingUndoForRowVisible(i, t, e) {
3332
3136
  const n = this._drawingManagerService.getDrawingData(i, t), r = [], s = [];
3333
3137
  if (Object.keys(n).forEach((d) => {
3334
- const l = n[d], { sheetTransform: g, transform: h, anchorType: m = U.Position } = l;
3335
- if (m === U.None)
3138
+ const l = n[d], { sheetTransform: g, transform: h, anchorType: f = U.Position } = l;
3139
+ if (f === U.None)
3336
3140
  this._remainDrawingSize(h, r, l);
3337
3141
  else {
3338
- const { from: f, to: p } = g, { row: S, column: _ } = f, { row: R, column: M } = p;
3142
+ const { from: m, to: p } = g, { row: S, column: _ } = m, { row: R, column: M } = p;
3339
3143
  for (let I = 0; I < e.length; I++) {
3340
3144
  const v = e[I], { startRow: C, endRow: D, startColumn: T, endColumn: b } = v;
3341
3145
  if (R < C)
3342
3146
  continue;
3343
- if (m === U.Position) {
3147
+ if (f === U.Position) {
3344
3148
  let y = null, O = null;
3345
3149
  if (S >= C && S <= D) {
3346
- const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: S, endRow: D });
3150
+ const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: S, endRow: D });
3347
3151
  if (x == null)
3348
3152
  return;
3349
3153
  O = { ...h, top: x.startY };
@@ -3363,7 +3167,7 @@ let Mn = class extends re {
3363
3167
  continue;
3364
3168
  let E = null, w = null;
3365
3169
  if (S >= C && S <= D) {
3366
- const y = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: S, endRow: D });
3170
+ const y = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: S, endRow: D });
3367
3171
  if (y == null)
3368
3172
  return;
3369
3173
  w = {
@@ -3372,7 +3176,7 @@ let Mn = class extends re {
3372
3176
  height: ((h == null ? void 0 : h.height) || 0) - y.endY + y.startY
3373
3177
  };
3374
3178
  } else if (R >= C && R <= D) {
3375
- const y = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: C, endRow: R });
3179
+ const y = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: C, endRow: R });
3376
3180
  if (y == null)
3377
3181
  return;
3378
3182
  w = {
@@ -3380,7 +3184,7 @@ let Mn = class extends re {
3380
3184
  top: y.startY - ((h == null ? void 0 : h.height) || 0)
3381
3185
  };
3382
3186
  } else {
3383
- const y = this._skeletonManagerService.attachRangeWithCoord({ startColumn: f.column, endColumn: p.column, startRow: C, endRow: D });
3187
+ const y = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: C, endRow: D });
3384
3188
  if (y == null)
3385
3189
  return;
3386
3190
  if (w = {
@@ -3421,12 +3225,12 @@ let Mn = class extends re {
3421
3225
  if (d === U.None)
3422
3226
  this._remainDrawingSize(u, s, a);
3423
3227
  else {
3424
- const { from: l, to: g } = c, { row: h, column: m } = l, { row: f, column: p } = g;
3228
+ const { from: l, to: g } = c, { row: h, column: f } = l, { row: m, column: p } = g;
3425
3229
  for (let S = 0; S < e.length; S++) {
3426
3230
  const _ = e[S], { startRow: R, endRow: M, startColumn: I, endColumn: v } = _;
3427
- if (f < R || p < I)
3231
+ if (m < R || p < I)
3428
3232
  continue;
3429
- if (d === U.Position && (h <= R && f >= M || m <= I && p >= v)) {
3233
+ if (d === U.Position && (h <= R && m >= M || f <= I && p >= v)) {
3430
3234
  this._remainDrawingSize(u, s, a);
3431
3235
  continue;
3432
3236
  }
@@ -3462,7 +3266,7 @@ let Mn = class extends re {
3462
3266
  const { unitId: r, subUnitId: s } = n, o = (M = (R = this._renderManagerService.getRenderById(r)) == null ? void 0 : R.with(Z)) == null ? void 0 : M.getCurrentSkeleton();
3463
3267
  if (!o)
3464
3268
  return { redos: [], undos: [] };
3465
- const a = ur(o, e);
3269
+ const a = hr(o, e);
3466
3270
  if (!a)
3467
3271
  return { redos: [], undos: [] };
3468
3272
  const { startX: c, endX: u, startY: d, endY: l } = a, g = this._sheetDrawingService.getDrawingData(r, s), h = [];
@@ -3481,7 +3285,7 @@ let Mn = class extends re {
3481
3285
  };
3482
3286
  c <= w && y <= u && d <= O && x <= l && h.push(v);
3483
3287
  });
3484
- const m = [], f = [], p = t.startRow - e.startRow, S = t.startColumn - e.startColumn, _ = h.map((I) => {
3288
+ const f = [], m = [], p = t.startRow - e.startRow, S = t.startColumn - e.startColumn, _ = h.map((I) => {
3485
3289
  const v = I.sheetTransform, C = {
3486
3290
  to: { ...v.to, row: v.to.row + p, column: v.to.column + S },
3487
3291
  from: { ...v.from, row: v.from.row + p, column: v.from.column + S }
@@ -3496,9 +3300,9 @@ let Mn = class extends re {
3496
3300
  });
3497
3301
  if (_.length) {
3498
3302
  const I = this._sheetDrawingService.getBatchUpdateOp(_), { undo: v, redo: C, objects: D } = I;
3499
- m.push({ id: A.id, params: { unitId: r, subUnitId: s, op: C, objects: D, type: P.UPDATE } }), f.push({ id: A.id, params: { unitId: r, subUnitId: s, op: v, objects: D, type: P.UPDATE } });
3303
+ f.push({ id: A.id, params: { unitId: r, subUnitId: s, op: C, objects: D, type: P.UPDATE } }), m.push({ id: A.id, params: { unitId: r, subUnitId: s, op: v, objects: D, type: P.UPDATE } });
3500
3304
  }
3501
- return { redos: m, undos: f };
3305
+ return { redos: f, undos: m };
3502
3306
  }
3503
3307
  _moveRowInterceptor(i, t) {
3504
3308
  const e = this._getUnitIdAndSubUnitId(i, t);
@@ -3507,19 +3311,19 @@ let Mn = class extends re {
3507
3311
  const { unitId: n, subUnitId: r } = e, { range: s } = i, o = s.startRow, a = s.endRow, c = [], u = [], d = this._sheetDrawingService.getDrawingData(n, r), l = [], g = [];
3508
3312
  if (Object.keys(d).forEach((h) => {
3509
3313
  var v, C;
3510
- const m = d[h], { sheetTransform: f, transform: p, anchorType: S = U.Position } = m;
3511
- if (f == null || p == null)
3314
+ const f = d[h], { sheetTransform: m, transform: p, anchorType: S = U.Position } = f;
3315
+ if (m == null || p == null)
3512
3316
  return;
3513
3317
  let _, R, M;
3514
3318
  if (t === "insert") {
3515
- const D = this._expandRow(f, p, o, a, S);
3319
+ const D = this._expandRow(m, p, o, a, S);
3516
3320
  _ = D == null ? void 0 : D.newSheetTransform, R = D == null ? void 0 : D.newTransform, M = (v = D == null ? void 0 : D.axisAlignSheetTransform) != null ? v : void 0;
3517
3321
  } else {
3518
- const { from: D, to: T } = f, { row: b } = D, { row: E } = T;
3322
+ const { from: D, to: T } = m, { row: b } = D, { row: E } = T;
3519
3323
  if (S === U.Both && b >= o && E <= a)
3520
3324
  g.push({ unitId: n, subUnitId: r, drawingId: h });
3521
3325
  else {
3522
- const w = this._shrinkRow(f, p, o, a, S);
3326
+ const w = this._shrinkRow(m, p, o, a, S);
3523
3327
  _ = w == null ? void 0 : w.newSheetTransform, R = w == null ? void 0 : w.newTransform, M = (C = w == null ? void 0 : w.axisAlignSheetTransform) != null ? C : void 0;
3524
3328
  }
3525
3329
  }
@@ -3530,12 +3334,12 @@ let Mn = class extends re {
3530
3334
  }), l.length === 0 && g.length === 0)
3531
3335
  return { redos: [], undos: [] };
3532
3336
  if (l.length > 0) {
3533
- const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: m, redo: f, objects: p } = h;
3534
- c.push({ id: A.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: P.UPDATE } }), u.push({ id: A.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: P.UPDATE } });
3337
+ const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: m, objects: p } = h;
3338
+ c.push({ id: A.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: P.UPDATE } }), u.push({ id: A.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: P.UPDATE } });
3535
3339
  }
3536
3340
  if (g.length > 0) {
3537
- const h = this._sheetDrawingService.getBatchRemoveOp(g), m = h.undo, f = h.redo, p = h.objects;
3538
- c.push({ id: A.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: P.REMOVE } }), u.push({ id: A.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: P.INSERT } });
3341
+ const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, m = h.redo, p = h.objects;
3342
+ c.push({ id: A.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: P.REMOVE } }), u.push({ id: A.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: P.INSERT } });
3539
3343
  }
3540
3344
  return c.push({ id: L.id, params: [n] }), u.push({ id: L.id, params: [n] }), {
3541
3345
  redos: c,
@@ -3549,19 +3353,19 @@ let Mn = class extends re {
3549
3353
  const { unitId: n, subUnitId: r } = e, { range: s } = i, o = s.startColumn, a = s.endColumn, c = [], u = [], d = this._sheetDrawingService.getDrawingData(n, r), l = [], g = [];
3550
3354
  if (Object.keys(d).forEach((h) => {
3551
3355
  var v, C;
3552
- const m = d[h], { sheetTransform: f, transform: p, anchorType: S = U.Position } = m;
3553
- if (f == null || p == null)
3356
+ const f = d[h], { sheetTransform: m, transform: p, anchorType: S = U.Position } = f;
3357
+ if (m == null || p == null)
3554
3358
  return;
3555
3359
  let _, R, M;
3556
3360
  if (t === "insert") {
3557
- const D = this._expandCol(f, p, o, a, S);
3361
+ const D = this._expandCol(m, p, o, a, S);
3558
3362
  _ = D == null ? void 0 : D.newSheetTransform, R = D == null ? void 0 : D.newTransform, M = (v = D == null ? void 0 : D.axisAlignSheetTransform) != null ? v : void 0;
3559
3363
  } else {
3560
- const { from: D, to: T } = f, { column: b } = D, { column: E } = T;
3364
+ const { from: D, to: T } = m, { column: b } = D, { column: E } = T;
3561
3365
  if (S === U.Both && b >= o && E <= a)
3562
3366
  g.push({ unitId: n, subUnitId: r, drawingId: h });
3563
3367
  else {
3564
- const w = this._shrinkCol(f, p, o, a, S);
3368
+ const w = this._shrinkCol(m, p, o, a, S);
3565
3369
  _ = w == null ? void 0 : w.newSheetTransform, R = w == null ? void 0 : w.newTransform, M = (C = w == null ? void 0 : w.axisAlignSheetTransform) != null ? C : void 0;
3566
3370
  }
3567
3371
  }
@@ -3572,12 +3376,12 @@ let Mn = class extends re {
3572
3376
  }), l.length === 0 && g.length === 0)
3573
3377
  return { redos: [], undos: [] };
3574
3378
  if (l.length > 0) {
3575
- const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: m, redo: f, objects: p } = h;
3576
- c.push({ id: A.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: P.UPDATE } }), u.push({ id: A.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: P.UPDATE } });
3379
+ const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: m, objects: p } = h;
3380
+ c.push({ id: A.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: P.UPDATE } }), u.push({ id: A.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: P.UPDATE } });
3577
3381
  }
3578
3382
  if (g.length > 0) {
3579
- const h = this._sheetDrawingService.getBatchRemoveOp(g), m = h.undo, f = h.redo, p = h.objects;
3580
- c.push({ id: A.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: P.REMOVE } }), u.push({ id: A.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: P.INSERT } });
3383
+ const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, m = h.redo, p = h.objects;
3384
+ c.push({ id: A.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: P.REMOVE } }), u.push({ id: A.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: P.INSERT } });
3581
3385
  }
3582
3386
  return c.push({ id: L.id, params: [n] }), u.push({ id: L.id, params: [n] }), { redos: c, undos: u };
3583
3387
  }
@@ -3769,7 +3573,7 @@ let Mn = class extends re {
3769
3573
  // but the skeleton changes like other render modules. These two signals are not equivalent.
3770
3574
  // As a temp solution, I subscribed to activate$ here.
3771
3575
  this._commandService.onCommandExecuted((i) => {
3772
- if (i.id === Ki.id) {
3576
+ if (i.id === Zi.id) {
3773
3577
  const { unitId: t, subUnitId: e } = i.params;
3774
3578
  this._updateDrawings(t, e);
3775
3579
  }
@@ -3809,7 +3613,7 @@ let Mn = class extends re {
3809
3613
  c != null && Object.keys(c).forEach((u) => {
3810
3614
  if (s === i && a === t) {
3811
3615
  const d = c[u];
3812
- d.transform = Q(d.sheetTransform, this._selectionRenderService, this._skeletonManagerService), n.push(c[u]);
3616
+ d.sheetTransform && (d.transform = Q(d.sheetTransform, this._selectionRenderService, this._skeletonManagerService)), n.push(c[u]);
3813
3617
  } else
3814
3618
  r.push(c[u]);
3815
3619
  });
@@ -3820,7 +3624,7 @@ let Mn = class extends re {
3820
3624
  _sheetRefreshListener() {
3821
3625
  this.disposeWithMe(
3822
3626
  this._commandService.onCommandExecuted((i) => {
3823
- mo.includes(i.id) && requestIdleCallback(() => {
3627
+ wo.includes(i.id) && requestIdleCallback(() => {
3824
3628
  const t = i.params, e = ce(this._univerInstanceService, t);
3825
3629
  if (!e) return;
3826
3630
  const { unitId: n, subUnitId: r, worksheet: s } = e;
@@ -3841,7 +3645,7 @@ let Mn = class extends re {
3841
3645
  const o = n[s], { sheetTransform: a, transform: c, anchorType: u = U.Position } = o;
3842
3646
  if (u === U.None)
3843
3647
  return !0;
3844
- const { from: d, to: l } = a, { row: g, column: h } = d, { row: m, column: f } = l;
3648
+ const { from: d, to: l } = a, { row: g, column: h } = d, { row: f, column: m } = l;
3845
3649
  for (let p = 0; p < e.length; p++) {
3846
3650
  const S = e[p], { startRow: _, endRow: R, startColumn: M, endColumn: I } = S;
3847
3651
  if (bi.intersects(
@@ -3853,9 +3657,9 @@ let Mn = class extends re {
3853
3657
  },
3854
3658
  {
3855
3659
  startRow: g,
3856
- endRow: m,
3660
+ endRow: f,
3857
3661
  startColumn: h,
3858
- endColumn: f
3662
+ endColumn: m
3859
3663
  }
3860
3664
  ) || g > R || h > I) {
3861
3665
  const v = u === U.Position, C = Q(a, this._selectionRenderService, this._skeletonManagerService);
@@ -3873,47 +3677,210 @@ let Mn = class extends re {
3873
3677
  }), r.length !== 0 && (this._sheetDrawingService.refreshTransform(r), this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(L.id, [i]));
3874
3678
  }
3875
3679
  };
3876
- Mn = ho([
3680
+ Mn = mo([
3877
3681
  be(1, ee),
3878
3682
  be(2, K),
3879
3683
  be(3, Oe),
3880
3684
  be(4, N(Z)),
3881
- be(5, N(wt)),
3685
+ be(5, N(St)),
3882
3686
  be(6, ie),
3883
3687
  be(7, de),
3884
3688
  be(8, he)
3885
3689
  ], Mn);
3886
- function fo() {
3887
- const i = Ee(Be), t = Ee(Tn), e = Ee(On), [n, r] = ke([xe.CELL_ADDRESS]), [s, o] = ke(!1), [a, c] = ke(null), u = Ke(() => e.getCellImagesInSelection(), [e]), d = Ke(() => e.getDataColumns(), [e]), l = Ke(() => e.getSelectionRowRange(), [e]), g = d.length > 0, h = Ke(() => d.map((v) => ({
3690
+ const yn = {
3691
+ id: "sheet.command.toggle-flip-drawings",
3692
+ type: te.COMMAND,
3693
+ // eslint-disable-next-line max-lines-per-function, complexity
3694
+ handler: (i, t) => {
3695
+ const e = i.get(K), n = i.get(Be), r = i.get(ie), s = i.get(ee);
3696
+ if (!t) return !1;
3697
+ const { drawings: o } = t, a = t.flipH, c = t.flipV, u = [], d = [];
3698
+ for (const M of o) {
3699
+ const { unitId: I, subUnitId: v, drawingId: C } = M;
3700
+ u.push(I);
3701
+ const D = r.getDrawingData(I, v), T = D == null ? void 0 : D[C];
3702
+ if (!T)
3703
+ continue;
3704
+ const b = { ...T.transform };
3705
+ a && (b.flipX = !b.flipX), c && (b.flipY = !b.flipY);
3706
+ const E = s.getRenderById(I), w = E == null ? void 0 : E.with(Oe);
3707
+ if (!w)
3708
+ continue;
3709
+ const y = j(b, w), O = F(b, w), x = {
3710
+ unitId: I,
3711
+ subUnitId: v,
3712
+ drawingType: T.drawingType,
3713
+ drawingId: C,
3714
+ transform: b,
3715
+ sheetTransform: y,
3716
+ axisAlignSheetTransform: O
3717
+ };
3718
+ if (T.drawingType === B.DRAWING_IMAGE) {
3719
+ const z = So(i, I);
3720
+ if (z) {
3721
+ const V = ye({ unitId: I, subUnitId: v, drawingId: C }), G = z.getObject(V);
3722
+ if (G) {
3723
+ const J = G.srcRect;
3724
+ if (J) {
3725
+ let Y;
3726
+ const { left: k = 0, top: se = 0, right: ge = 0, bottom: fe = 0 } = J;
3727
+ if (a) {
3728
+ const le = k + (ge - k) / 2, Re = le - (ge - k) / 2, Ue = le + (ge - k) / 2;
3729
+ Y = {
3730
+ left: Re,
3731
+ top: se,
3732
+ right: Ue,
3733
+ bottom: fe
3734
+ };
3735
+ }
3736
+ if (c) {
3737
+ const le = se + (fe - se) / 2, Re = le - (fe - se) / 2, Ue = le + (fe - se) / 2;
3738
+ Y = {
3739
+ left: k,
3740
+ top: Re,
3741
+ right: ge,
3742
+ bottom: Ue
3743
+ };
3744
+ }
3745
+ Y && (x.srcRect = Y);
3746
+ }
3747
+ }
3748
+ }
3749
+ }
3750
+ d.push(x);
3751
+ }
3752
+ if (d.length === 0) return !1;
3753
+ const l = r.getBatchUpdateOp(d), { unitId: g, subUnitId: h, undo: f, redo: m, objects: p } = l, S = { id: A.id, params: { unitId: g, subUnitId: h, op: m, objects: p, type: P.UPDATE } }, _ = { id: A.id, params: { unitId: g, subUnitId: h, op: f, objects: p, type: P.UPDATE } };
3754
+ return zt([S], e) ? (n.pushUndoRedo({
3755
+ unitID: g,
3756
+ undoMutations: [_, { id: L.id, params: u }],
3757
+ redoMutations: [S, { id: L.id, params: u }]
3758
+ }), !0) : !1;
3759
+ }
3760
+ };
3761
+ function So(i, t) {
3762
+ const n = i.get(ee).getRenderById(t);
3763
+ return n ? n.scene : null;
3764
+ }
3765
+ function _o(i) {
3766
+ var t, e, n, r;
3767
+ return !!((e = (t = i == null ? void 0 : i.p) == null ? void 0 : t.drawingsOrder) != null && e.length && ((r = (n = i == null ? void 0 : i.p) == null ? void 0 : n.drawingsOrder) == null ? void 0 : r.length) > 0);
3768
+ }
3769
+ function vo(i, t) {
3770
+ const e = i.getActiveSheet();
3771
+ if (!e) return !1;
3772
+ const n = e.getCellMatrix(), { startRow: r, endRow: s, startColumn: o, endColumn: a } = t;
3773
+ for (let c = r; c <= s; c++)
3774
+ for (let u = o; u <= a; u++) {
3775
+ const d = n.getValue(c, u);
3776
+ if (_o(d))
3777
+ return !0;
3778
+ }
3779
+ return !1;
3780
+ }
3781
+ function Io() {
3782
+ return "showDirectoryPicker" in window;
3783
+ }
3784
+ function hn(i) {
3785
+ const t = i.get(he), e = i.get(_t), n = ft([
3786
+ Jt(i, $.UNIVER_SHEET),
3787
+ t.getCurrentTypeOfUnit$($.UNIVER_SHEET).pipe(
3788
+ ve((r) => r ? e.selectionMoveEnd$.pipe(
3789
+ Ie(() => {
3790
+ if (!Io())
3791
+ return !0;
3792
+ const s = e.getCurrentSelections();
3793
+ if (!s || s.length === 0)
3794
+ return !0;
3795
+ for (const o of s)
3796
+ if (vo(r, o.range))
3797
+ return !1;
3798
+ return !0;
3799
+ })
3800
+ ) : vn(!0))
3801
+ )
3802
+ ]).pipe(
3803
+ Ie(([r, s]) => r || s)
3804
+ );
3805
+ return {
3806
+ id: mt.id,
3807
+ type: Zt.BUTTON,
3808
+ icon: "DownloadImageIcon",
3809
+ title: "sheetImage.save.menuLabel",
3810
+ hidden$: n
3811
+ };
3812
+ }
3813
+ const Co = {
3814
+ [ms.MEDIA]: {
3815
+ [Gr]: {
3816
+ order: 0,
3817
+ menuItemFactory: Bs,
3818
+ [Qt.id]: {
3819
+ order: 0,
3820
+ menuItemFactory: $s
3821
+ },
3822
+ [On.id]: {
3823
+ order: 1,
3824
+ menuItemFactory: Ws
3825
+ }
3826
+ }
3827
+ },
3828
+ [cn.MAIN_AREA]: {
3829
+ [dn.OTHERS]: {
3830
+ [mt.id]: {
3831
+ order: 10,
3832
+ menuItemFactory: hn
3833
+ }
3834
+ }
3835
+ },
3836
+ [cn.COL_HEADER]: {
3837
+ [dn.OTHERS]: {
3838
+ [mt.id]: {
3839
+ order: 10,
3840
+ menuItemFactory: hn
3841
+ }
3842
+ }
3843
+ },
3844
+ [cn.ROW_HEADER]: {
3845
+ [dn.OTHERS]: {
3846
+ [mt.id]: {
3847
+ order: 10,
3848
+ menuItemFactory: hn
3849
+ }
3850
+ }
3851
+ }
3852
+ };
3853
+ function Ro() {
3854
+ const i = Ee($e), t = Ee(En), e = Ee(Un), [n, r] = ke([xe.CELL_ADDRESS]), [s, o] = ke(!1), [a, c] = ke(null), u = Ke(() => e.getCellImagesInSelection(), [e]), d = Ke(() => e.getDataColumns(), [e]), l = Ke(() => e.getSelectionRowRange(), [e]), g = d.length > 0, h = Ke(() => d.map((v) => ({
3888
3855
  label: v.label,
3889
3856
  value: String(v.index)
3890
- })), [d]), [m, f] = ke(
3857
+ })), [d]), [f, m] = ke(
3891
3858
  () => h.length > 0 ? h[0].value : "0"
3892
3859
  ), p = Ke(() => {
3893
3860
  if (!n.includes(xe.COLUMN_VALUE) || !l)
3894
3861
  return [];
3895
- const C = Number(m);
3862
+ const C = Number(f);
3896
3863
  return [{
3897
3864
  startRow: l.startRow,
3898
3865
  endRow: l.endRow,
3899
3866
  startColumn: C,
3900
3867
  endColumn: C
3901
3868
  }];
3902
- }, [n, m, l]);
3903
- hi(p);
3904
- const S = Pt((v) => {
3869
+ }, [n, f, l]);
3870
+ gi(p);
3871
+ const S = At((v) => {
3905
3872
  v.length !== 0 && r(v);
3906
- }, []), _ = Pt((v) => {
3907
- f(String(v));
3908
- }, []), R = Pt(() => {
3873
+ }, []), _ = At((v) => {
3874
+ m(String(v));
3875
+ }, []), R = At(() => {
3909
3876
  t.close(nt);
3910
- }, [t]), M = Pt(async () => {
3877
+ }, [t]), M = At(async () => {
3911
3878
  if (u.length !== 0) {
3912
3879
  o(!0), c(null);
3913
3880
  try {
3914
3881
  await e.saveImages(u, {
3915
3882
  fileNameParts: n,
3916
- columnIndex: n.includes(xe.COLUMN_VALUE) ? Number(m) : void 0
3883
+ columnIndex: n.includes(xe.COLUMN_VALUE) ? Number(f) : void 0
3917
3884
  }), t.close(nt);
3918
3885
  } catch (v) {
3919
3886
  console.error("Failed to save images:", v), c(i.t("sheetImage.save.error"));
@@ -3921,17 +3888,17 @@ function fo() {
3921
3888
  o(!1);
3922
3889
  }
3923
3890
  }
3924
- }, [e, u, n, m, t, i]), I = n.includes(xe.COLUMN_VALUE);
3891
+ }, [e, u, n, f, t, i]), I = n.includes(xe.COLUMN_VALUE);
3925
3892
  return /* @__PURE__ */ tt("div", { className: "univer-flex univer-flex-col", children: [
3926
- /* @__PURE__ */ X(rn, { label: i.t("sheetImage.save.imageCount"), children: /* @__PURE__ */ X("div", { className: "univer-text-sm univer-text-gray-600", children: u.length }) }),
3927
- /* @__PURE__ */ X(rn, { label: i.t("sheetImage.save.fileNameConfig"), children: /* @__PURE__ */ tt(Qi, { value: n, onChange: S, direction: "vertical", children: [
3928
- /* @__PURE__ */ X(zn, { value: xe.CELL_ADDRESS, disabled: !g, children: i.t("sheetImage.save.useRowCol") }),
3929
- g && /* @__PURE__ */ X(zn, { value: xe.COLUMN_VALUE, children: i.t("sheetImage.save.useColumnValue") })
3893
+ /* @__PURE__ */ X(sn, { label: i.t("sheetImage.save.imageCount"), children: /* @__PURE__ */ X("div", { className: "univer-text-sm univer-text-gray-600", children: u.length }) }),
3894
+ /* @__PURE__ */ X(sn, { label: i.t("sheetImage.save.fileNameConfig"), children: /* @__PURE__ */ tt(es, { value: n, onChange: S, direction: "vertical", children: [
3895
+ /* @__PURE__ */ X(Kn, { value: xe.CELL_ADDRESS, disabled: !g, children: i.t("sheetImage.save.useRowCol") }),
3896
+ g && /* @__PURE__ */ X(Kn, { value: xe.COLUMN_VALUE, children: i.t("sheetImage.save.useColumnValue") })
3930
3897
  ] }) }),
3931
- I && /* @__PURE__ */ X(rn, { label: i.t("sheetImage.save.selectColumn"), children: /* @__PURE__ */ X(
3932
- es,
3898
+ I && /* @__PURE__ */ X(sn, { label: i.t("sheetImage.save.selectColumn"), children: /* @__PURE__ */ X(
3899
+ ts,
3933
3900
  {
3934
- value: m,
3901
+ value: f,
3935
3902
  options: h,
3936
3903
  onChange: _
3937
3904
  }
@@ -3942,9 +3909,9 @@ function fo() {
3942
3909
  {
3943
3910
  className: "univer-flex univer-justify-end univer-gap-2 univer-border-t univer-border-gray-200 univer-pt-3",
3944
3911
  children: [
3945
- /* @__PURE__ */ X(Kn, { onClick: R, disabled: s, children: i.t("sheetImage.save.cancel") }),
3912
+ /* @__PURE__ */ X(Jn, { onClick: R, disabled: s, children: i.t("sheetImage.save.cancel") }),
3946
3913
  /* @__PURE__ */ X(
3947
- Kn,
3914
+ Jn,
3948
3915
  {
3949
3916
  variant: "primary",
3950
3917
  onClick: M,
@@ -3957,15 +3924,15 @@ function fo() {
3957
3924
  )
3958
3925
  ] });
3959
3926
  }
3960
- const po = (i) => {
3927
+ const Do = (i) => {
3961
3928
  var _;
3962
- const t = Ee(K), e = Ee(Be), n = Ee(de), r = Ee(ee), { drawings: s } = i, o = s[0];
3929
+ const t = Ee(K), e = Ee($e), n = Ee(de), r = Ee(ee), { drawings: s } = i, o = s[0];
3963
3930
  if (o == null)
3964
3931
  return;
3965
3932
  const { unitId: a } = o, c = r.getRenderById(a), u = c == null ? void 0 : c.scene;
3966
3933
  if (u == null)
3967
3934
  return;
3968
- const d = u.getTransformerByCreate(), [l, g] = ke(!0), h = (_ = o.anchorType) != null ? _ : U.Position, [m, f] = ke(h);
3935
+ const d = u.getTransformerByCreate(), [l, g] = ke(!0), h = (_ = o.anchorType) != null ? _ : U.Position, [f, m] = ke(h);
3969
3936
  function p(R, M) {
3970
3937
  const I = [];
3971
3938
  return R.forEach((v) => {
@@ -3984,7 +3951,7 @@ const po = (i) => {
3984
3951
  });
3985
3952
  }), I;
3986
3953
  }
3987
- kr(() => {
3954
+ Br(() => {
3988
3955
  const R = d.clearControl$.subscribe((I) => {
3989
3956
  I === !0 && g(!1);
3990
3957
  }), M = d.changeStart$.subscribe((I) => {
@@ -3995,7 +3962,7 @@ const po = (i) => {
3995
3962
  else if (C.length >= 1) {
3996
3963
  g(!0);
3997
3964
  const T = ((D = C[0]) == null ? void 0 : D.anchorType) || U.Position;
3998
- f(T);
3965
+ m(T);
3999
3966
  }
4000
3967
  });
4001
3968
  return () => {
@@ -4003,7 +3970,7 @@ const po = (i) => {
4003
3970
  };
4004
3971
  }, []);
4005
3972
  function S(R) {
4006
- f(R);
3973
+ m(R);
4007
3974
  const M = n.getFocusDrawings();
4008
3975
  if (M.length === 0)
4009
3976
  return;
@@ -4013,7 +3980,7 @@ const po = (i) => {
4013
3980
  drawingId: v.drawingId,
4014
3981
  anchorType: R
4015
3982
  }));
4016
- t.executeCommand(vt.id, {
3983
+ t.executeCommand(It.id, {
4017
3984
  unitId: M[0].unitId,
4018
3985
  drawings: I
4019
3986
  });
@@ -4021,7 +3988,7 @@ const po = (i) => {
4021
3988
  return /* @__PURE__ */ tt(
4022
3989
  "div",
4023
3990
  {
4024
- className: ts("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
3991
+ className: ns("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
4025
3992
  "univer-hidden": !l
4026
3993
  }),
4027
3994
  children: [
@@ -4032,17 +3999,17 @@ const po = (i) => {
4032
3999
  children: /* @__PURE__ */ X("div", { children: e.t("drawing-anchor.title") })
4033
4000
  }
4034
4001
  ),
4035
- /* @__PURE__ */ X("div", { children: /* @__PURE__ */ tt(ns, { value: m, onChange: S, direction: "vertical", children: [
4036
- /* @__PURE__ */ X(sn, { value: U.Both, children: e.t("drawing-anchor.both") }),
4037
- /* @__PURE__ */ X(sn, { value: U.Position, children: e.t("drawing-anchor.position") }),
4038
- /* @__PURE__ */ X(sn, { value: U.None, children: e.t("drawing-anchor.none") })
4002
+ /* @__PURE__ */ X("div", { children: /* @__PURE__ */ tt(rs, { value: f, onChange: S, direction: "vertical", children: [
4003
+ /* @__PURE__ */ X(on, { value: U.Both, children: e.t("drawing-anchor.both") }),
4004
+ /* @__PURE__ */ X(on, { value: U.Position, children: e.t("drawing-anchor.position") }),
4005
+ /* @__PURE__ */ X(on, { value: U.None, children: e.t("drawing-anchor.none") })
4039
4006
  ] }) })
4040
4007
  ]
4041
4008
  }
4042
4009
  );
4043
- }, wo = () => {
4010
+ }, bo = () => {
4044
4011
  const i = Ee(de), t = i.getFocusDrawings(), [e, n] = ke(t);
4045
- return kr(() => {
4012
+ return Br(() => {
4046
4013
  const r = i.focus$.subscribe((s) => {
4047
4014
  n(s);
4048
4015
  });
@@ -4050,179 +4017,65 @@ const po = (i) => {
4050
4017
  r.unsubscribe();
4051
4018
  };
4052
4019
  }, []), !!(e != null && e.length) && /* @__PURE__ */ tt("div", { className: "univer-text-sm", children: [
4053
- /* @__PURE__ */ X(Rs, { drawings: e }),
4054
- /* @__PURE__ */ X(po, { drawings: e })
4020
+ /* @__PURE__ */ X(vs, { drawings: e }),
4021
+ /* @__PURE__ */ X(Do, { drawings: e })
4055
4022
  ] });
4056
- }, Xr = "sheet.menu.image";
4057
- function So(i) {
4058
- return {
4059
- id: Xr,
4060
- type: Zt.SUBITEMS,
4061
- icon: "AddImageIcon",
4062
- tooltip: "sheetImage.title",
4063
- hidden$: Jt(i, B.UNIVER_SHEET),
4064
- disabled$: gi(i, { workbookTypes: [fn], worksheetTypes: [pn], rangeTypes: [Ji] })
4065
- };
4066
- }
4067
- function _o(i) {
4068
- return {
4069
- id: Qt.id,
4070
- title: "sheetImage.upload.float",
4071
- type: Zt.BUTTON,
4072
- hidden$: Jt(i, B.UNIVER_SHEET)
4073
- };
4074
- }
4075
- function vo(i) {
4076
- return {
4077
- id: En.id,
4078
- title: "sheetImage.upload.cell",
4079
- type: Zt.BUTTON,
4080
- hidden$: Jt(i, B.UNIVER_SHEET)
4081
- };
4082
- }
4083
- function Io(i) {
4084
- var t, e, n, r;
4085
- return !!((e = (t = i == null ? void 0 : i.p) == null ? void 0 : t.drawingsOrder) != null && e.length && ((r = (n = i == null ? void 0 : i.p) == null ? void 0 : n.drawingsOrder) == null ? void 0 : r.length) > 0);
4086
- }
4087
- function Co(i, t) {
4088
- const e = i.getActiveSheet();
4089
- if (!e) return !1;
4090
- const n = e.getCellMatrix(), { startRow: r, endRow: s, startColumn: o, endColumn: a } = t;
4091
- for (let c = r; c <= s; c++)
4092
- for (let u = o; u <= a; u++) {
4093
- const d = n.getValue(c, u);
4094
- if (Io(d))
4095
- return !0;
4096
- }
4097
- return !1;
4098
- }
4099
- function Ro() {
4100
- return "showDirectoryPicker" in window;
4101
- }
4102
- function un(i) {
4103
- const t = i.get(he), e = i.get(St), n = gt([
4104
- Jt(i, B.UNIVER_SHEET),
4105
- t.getCurrentTypeOfUnit$(B.UNIVER_SHEET).pipe(
4106
- ve((r) => r ? e.selectionMoveEnd$.pipe(
4107
- Ie(() => {
4108
- if (!Ro())
4109
- return !0;
4110
- const s = e.getCurrentSelections();
4111
- if (!s || s.length === 0)
4112
- return !0;
4113
- for (const o of s)
4114
- if (Co(r, o.range))
4115
- return !1;
4116
- return !0;
4117
- })
4118
- ) : _n(!0))
4119
- )
4120
- ]).pipe(
4121
- Ie(([r, s]) => r || s)
4122
- );
4123
- return {
4124
- id: mt.id,
4125
- type: Zt.BUTTON,
4126
- icon: "DownloadImageIcon",
4127
- title: "sheetImage.save.menuLabel",
4128
- hidden$: n
4129
- };
4130
- }
4131
- const Do = {
4132
- [ms.MEDIA]: {
4133
- [Xr]: {
4134
- order: 0,
4135
- menuItemFactory: So,
4136
- [Qt.id]: {
4137
- order: 0,
4138
- menuItemFactory: _o
4139
- },
4140
- [En.id]: {
4141
- order: 1,
4142
- menuItemFactory: vo
4143
- }
4144
- }
4145
- },
4146
- [an.MAIN_AREA]: {
4147
- [cn.OTHERS]: {
4148
- [mt.id]: {
4149
- order: 10,
4150
- menuItemFactory: un
4151
- }
4152
- }
4153
- },
4154
- [an.COL_HEADER]: {
4155
- [cn.OTHERS]: {
4156
- [mt.id]: {
4157
- order: 10,
4158
- menuItemFactory: un
4159
- }
4160
- }
4161
- },
4162
- [an.ROW_HEADER]: {
4163
- [cn.OTHERS]: {
4164
- [mt.id]: {
4165
- order: 10,
4166
- menuItemFactory: un
4167
- }
4168
- }
4169
- }
4170
4023
  };
4171
- function Ct(i) {
4024
+ function Rt(i) {
4172
4025
  return i.getContextValue(Mi) && !i.getContextValue(yi) && !i.getContextValue(Ti) && i.getContextValue(et) && !i.getContextValue(Ei);
4173
4026
  }
4174
- const bo = {
4175
- id: It.id,
4027
+ const Mo = {
4028
+ id: Ct.id,
4176
4029
  description: "shortcut.drawing-move-down",
4177
4030
  group: "4_drawing-view",
4178
4031
  binding: rt.ARROW_DOWN,
4179
4032
  priority: 100,
4180
- preconditions: Ct,
4033
+ preconditions: Rt,
4181
4034
  staticParameters: {
4182
4035
  direction: Te.DOWN
4183
4036
  }
4184
- }, Mo = {
4185
- id: It.id,
4037
+ }, yo = {
4038
+ id: Ct.id,
4186
4039
  description: "shortcut.drawing-move-up",
4187
4040
  group: "4_drawing-view",
4188
4041
  binding: rt.ARROW_UP,
4189
4042
  priority: 100,
4190
- preconditions: Ct,
4043
+ preconditions: Rt,
4191
4044
  staticParameters: {
4192
4045
  direction: Te.UP
4193
4046
  }
4194
- }, yo = {
4195
- id: It.id,
4047
+ }, To = {
4048
+ id: Ct.id,
4196
4049
  description: "shortcut.drawing-move-left",
4197
4050
  group: "4_drawing-view",
4198
4051
  binding: rt.ARROW_LEFT,
4199
4052
  priority: 100,
4200
- preconditions: Ct,
4053
+ preconditions: Rt,
4201
4054
  staticParameters: {
4202
4055
  direction: Te.LEFT
4203
4056
  }
4204
- }, To = {
4205
- id: It.id,
4057
+ }, Eo = {
4058
+ id: Ct.id,
4206
4059
  description: "shortcut.drawing-move-right",
4207
4060
  group: "4_drawing-view",
4208
4061
  binding: rt.ARROW_RIGHT,
4209
4062
  priority: 100,
4210
- preconditions: Ct,
4063
+ preconditions: Rt,
4211
4064
  staticParameters: {
4212
4065
  direction: Te.RIGHT
4213
4066
  }
4214
- }, Eo = {
4067
+ }, Oo = {
4215
4068
  id: $r.id,
4216
4069
  description: "shortcut.drawing-delete",
4217
4070
  group: "4_drawing-view",
4218
4071
  priority: 100,
4219
4072
  // when focusing on any other input tag do not trigger this shortcut
4220
- preconditions: Ct,
4073
+ preconditions: Rt,
4221
4074
  binding: rt.DELETE,
4222
4075
  mac: rt.BACKSPACE
4223
4076
  };
4224
- var Oo = Object.getOwnPropertyDescriptor, Uo = (i, t, e, n) => {
4225
- for (var r = n > 1 ? void 0 : n ? Oo(t, e) : t, s = i.length - 1, o; s >= 0; s--)
4077
+ var Uo = Object.getOwnPropertyDescriptor, Po = (i, t, e, n) => {
4078
+ for (var r = n > 1 ? void 0 : n ? Uo(t, e) : t, s = i.length - 1, o; s >= 0; s--)
4226
4079
  (o = i[s]) && (r = o(r) || r);
4227
4080
  return r;
4228
4081
  }, Xe = (i, t) => (e, n) => t(e, n, i);
@@ -4232,38 +4085,38 @@ let Yt = class extends re {
4232
4085
  }
4233
4086
  _initCustomComponents() {
4234
4087
  const i = this._componentManager;
4235
- this.disposeWithMe(i.register(Fr, wo)), this.disposeWithMe(i.register(nt, fo));
4088
+ this.disposeWithMe(i.register(Lr, bo)), this.disposeWithMe(i.register(nt, Ro));
4236
4089
  }
4237
4090
  _initMenus() {
4238
- this._menuManagerService.mergeMenu(Do);
4091
+ this._menuManagerService.mergeMenu(Co);
4239
4092
  }
4240
4093
  _initCommands() {
4241
4094
  [
4242
4095
  Qt,
4243
- En,
4096
+ On,
4244
4097
  qt,
4245
- _t,
4246
4098
  vt,
4247
- Lr,
4248
- L,
4249
- Hr,
4250
- Br,
4251
- jr,
4252
4099
  It,
4253
- $r,
4100
+ Hr,
4101
+ L,
4102
+ Vr,
4254
4103
  Wr,
4104
+ Fr,
4105
+ Ct,
4106
+ $r,
4107
+ jr,
4255
4108
  mt,
4256
- Rn
4109
+ yn
4257
4110
  ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
4258
4111
  }
4259
4112
  _initShortcuts() {
4260
4113
  [
4261
4114
  // sheet drawing shortcuts
4262
- bo,
4263
4115
  Mo,
4264
4116
  yo,
4265
4117
  To,
4266
- Eo
4118
+ Eo,
4119
+ Oo
4267
4120
  ].forEach((i) => {
4268
4121
  this.disposeWithMe(this._shortcutService.registerShortcut(i));
4269
4122
  });
@@ -4272,106 +4125,262 @@ let Yt = class extends re {
4272
4125
  this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
4273
4126
  }
4274
4127
  };
4275
- Yt = Uo([
4276
- Xe(0, N(Nr)),
4277
- Xe(1, fs),
4128
+ Yt = Po([
4129
+ Xe(0, N(xr)),
4130
+ Xe(1, ps),
4278
4131
  Xe(2, K),
4279
- Xe(3, ps),
4132
+ Xe(3, ws),
4280
4133
  Xe(4, de),
4281
- Xe(5, N(St))
4134
+ Xe(5, N(_t))
4282
4135
  ], Yt);
4283
- var Po = Object.defineProperty, Ao = Object.getOwnPropertyDescriptor, No = (i, t, e) => t in i ? Po(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, xo = (i, t, e, n) => {
4136
+ var Ao = Object.getOwnPropertyDescriptor, No = (i, t, e, n) => {
4284
4137
  for (var r = n > 1 ? void 0 : n ? Ao(t, e) : t, s = i.length - 1, o; s >= 0; s--)
4285
4138
  (o = i[s]) && (r = o(r) || r);
4286
4139
  return r;
4287
- }, hn = (i, t) => (e, n) => t(e, n, i), zr = (i, t, e) => No(i, typeof t != "symbol" ? t + "" : t, e);
4288
- const ko = "SHEET_IMAGE_UI_PLUGIN";
4289
- let Xt = class extends Pi {
4290
- constructor(i = ar, t, e, n) {
4140
+ }, ue = (i, t) => (e, n) => t(e, n, i);
4141
+ let Xt = class extends Oi {
4142
+ constructor(t, e, n, r, s, o, a, c, u, d) {
4143
+ super();
4144
+ ae(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
4145
+ this._injector = t, this._localeService = e, this._drawingManagerService = n, this._canvasPopManagerService = r, this._renderManagerService = s, this._univerInstanceService = o, this._messageService = a, this._contextService = c, this._ioService = u, this._commandService = d, this._init();
4146
+ }
4147
+ _init() {
4148
+ this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET).subscribe((t) => this._create(t)), this._univerInstanceService.getTypeOfUnitDisposed$($.UNIVER_SHEET).subscribe((t) => this._dispose(t)), this._univerInstanceService.getAllUnitsForType($.UNIVER_SHEET).forEach((t) => this._create(t)), this._setupLoadingStatus();
4149
+ }
4150
+ _setupLoadingStatus() {
4151
+ const t = "image-upload-loading";
4152
+ let e;
4153
+ this.disposeWithMe(this._ioService.change$.subscribe((n) => {
4154
+ n > 0 && !e ? e = this._messageService.show({
4155
+ id: t,
4156
+ type: Me.Loading,
4157
+ content: `${this._localeService.t("uploadLoading.loading")}: ${n}`,
4158
+ duration: 0
4159
+ }) : n === 0 && (e == null || e.dispose(), e = void 0);
4160
+ }));
4161
+ }
4162
+ _dispose(t) {
4163
+ super.dispose();
4164
+ const e = t.getUnitId();
4165
+ this._renderManagerService.removeRender(e), this._initImagePopupMenu.delete(e);
4166
+ }
4167
+ _create(t) {
4168
+ if (!t)
4169
+ return;
4170
+ const e = t.getUnitId();
4171
+ this._renderManagerService.has(e) && !this._initImagePopupMenu.has(e) && (this._popupMenuListener(e), this._initImagePopupMenu.add(e));
4172
+ }
4173
+ _hasCropObject(t) {
4174
+ const e = t.getAllObjectsByOrder();
4175
+ for (const n of e)
4176
+ if (n instanceof Is)
4177
+ return !0;
4178
+ return !1;
4179
+ }
4180
+ _popupMenuListener(t) {
4181
+ var s;
4182
+ const e = (s = this._renderManagerService.getRenderById(t)) == null ? void 0 : s.scene;
4183
+ if (!e)
4184
+ return;
4185
+ const n = e.getTransformerByCreate();
4186
+ if (!n)
4187
+ return;
4188
+ let r;
4189
+ this.disposeWithMe(
4190
+ n.createControl$.subscribe(() => {
4191
+ if (this._contextService.setContextValue(et, !0), this._hasCropObject(e))
4192
+ return;
4193
+ const o = n.getSelectedObjectMap();
4194
+ if (o.size > 1) {
4195
+ r == null || r.dispose();
4196
+ return;
4197
+ }
4198
+ const a = o.values().next().value;
4199
+ if (!a)
4200
+ return;
4201
+ const c = a.oKey, u = this._drawingManagerService.getDrawingOKey(c);
4202
+ if (!u)
4203
+ return;
4204
+ const { unitId: d, subUnitId: l, drawingId: g, drawingType: h } = u, f = u.data;
4205
+ if (f && f.disablePopup)
4206
+ return;
4207
+ r == null || r.dispose();
4208
+ const m = this._canvasPopManagerService.getFeatureMenu(d, l, g, h);
4209
+ r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
4210
+ componentKey: Cs,
4211
+ direction: "horizontal",
4212
+ offset: [2, 0],
4213
+ extraProps: {
4214
+ menuItems: m || this._getImageMenuItems(d, l, g, h)
4215
+ }
4216
+ }));
4217
+ })
4218
+ ), this.disposeWithMe(
4219
+ n.clearControl$.subscribe(() => {
4220
+ r == null || r.dispose(), this._contextService.setContextValue(et, !1), this._commandService.syncExecuteCommand(Kt.id, []);
4221
+ })
4222
+ ), this.disposeWithMe(
4223
+ this._contextService.contextChanged$.subscribe((o) => {
4224
+ o[et] === !1 && (r == null || r.dispose());
4225
+ })
4226
+ ), this.disposeWithMe(
4227
+ n.changing$.subscribe(() => {
4228
+ r == null || r.dispose();
4229
+ })
4230
+ );
4231
+ }
4232
+ _getImageMenuItems(t, e, n, r) {
4233
+ return [
4234
+ {
4235
+ label: "image-popup.edit",
4236
+ index: 0,
4237
+ commandId: Vr.id,
4238
+ commandParams: { unitId: t, subUnitId: e, drawingId: n },
4239
+ disable: r === B.DRAWING_DOM
4240
+ },
4241
+ {
4242
+ label: "image-popup.delete",
4243
+ index: 1,
4244
+ commandId: vt.id,
4245
+ commandParams: { unitId: t, drawings: [{ unitId: t, subUnitId: e, drawingId: n }] },
4246
+ disable: !1
4247
+ },
4248
+ {
4249
+ label: "image-popup.crop",
4250
+ index: 2,
4251
+ commandId: Rs.id,
4252
+ commandParams: { unitId: t, subUnitId: e, drawingId: n },
4253
+ disable: r === B.DRAWING_DOM
4254
+ },
4255
+ {
4256
+ label: "image-popup.flipH",
4257
+ index: 2,
4258
+ commandId: yn.id,
4259
+ commandParams: { unitId: t, flipH: !0, drawings: [{ unitId: t, subUnitId: e, drawingId: n }] },
4260
+ disable: r === B.DRAWING_DOM
4261
+ },
4262
+ {
4263
+ label: "image-popup.flipV",
4264
+ index: 2,
4265
+ commandId: yn.id,
4266
+ commandParams: { unitId: t, flipV: !0, drawings: [{ unitId: t, subUnitId: e, drawingId: n }] },
4267
+ disable: r === B.DRAWING_DOM
4268
+ },
4269
+ {
4270
+ label: "image-popup.reset",
4271
+ index: 3,
4272
+ commandId: Ds.id,
4273
+ commandParams: [{ unitId: t, subUnitId: e, drawingId: n }],
4274
+ disable: r === B.DRAWING_DOM
4275
+ }
4276
+ ];
4277
+ }
4278
+ };
4279
+ Xt = No([
4280
+ ue(0, N(st)),
4281
+ ue(1, N($e)),
4282
+ ue(2, de),
4283
+ ue(3, N(fi)),
4284
+ ue(4, ee),
4285
+ ue(5, he),
4286
+ ue(6, Nr),
4287
+ ue(7, gr),
4288
+ ue(8, mr),
4289
+ ue(9, K)
4290
+ ], Xt);
4291
+ var xo = Object.defineProperty, ko = Object.getOwnPropertyDescriptor, Bo = (i, t, e) => t in i ? xo(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, $o = (i, t, e, n) => {
4292
+ for (var r = n > 1 ? void 0 : n ? ko(t, e) : t, s = i.length - 1, o; s >= 0; s--)
4293
+ (o = i[s]) && (r = o(r) || r);
4294
+ return r;
4295
+ }, gn = (i, t) => (e, n) => t(e, n, i), en = (i, t, e) => Bo(i, typeof t != "symbol" ? t + "" : t, e);
4296
+ let it = class extends Ai {
4297
+ constructor(i = cr, t, e, n) {
4291
4298
  super(), this._config = i, this._injector = t, this._renderManagerService = e, this._configService = n;
4292
- const { menu: r, ...s } = Ai(
4299
+ const { menu: r, ...s } = Ni(
4293
4300
  {},
4294
- ar,
4301
+ cr,
4295
4302
  this._config
4296
4303
  );
4297
- r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(ks, s);
4304
+ r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Ls, s);
4298
4305
  }
4299
4306
  onStarting() {
4300
- Ni(this._injector, [
4301
- [pt],
4307
+ xi(this._injector, [
4308
+ [wt],
4302
4309
  [Yt],
4303
- [Wt],
4304
- [Vt],
4310
+ [Xt],
4305
4311
  [Gt],
4312
+ [Vt],
4306
4313
  [Ht],
4307
4314
  [jt],
4308
4315
  [Ft],
4309
4316
  [Lt],
4310
- [On, { useClass: Cn }]
4311
- ]), nn(this._injector, [
4312
- [pt]
4317
+ [Un, { useClass: Rn }]
4318
+ ]), rn(this._injector, [
4319
+ [wt]
4313
4320
  ]);
4314
4321
  }
4315
4322
  onReady() {
4316
- nn(this._injector, [
4323
+ rn(this._injector, [
4317
4324
  [Ht],
4318
4325
  [Lt]
4319
4326
  ]);
4320
4327
  }
4321
4328
  onRendered() {
4322
- this._registerRenderModules(), nn(this._injector, [
4323
- [Gt],
4329
+ this._registerRenderModules(), rn(this._injector, [
4324
4330
  [Vt],
4331
+ [Gt],
4325
4332
  [Yt],
4326
4333
  [jt],
4327
4334
  [Ft]
4328
4335
  ]);
4329
4336
  }
4330
4337
  onSteady() {
4331
- this._injector.get(Wt);
4338
+ this._injector.get(Xt);
4332
4339
  }
4333
4340
  _registerRenderModules() {
4334
4341
  [
4335
- [ft],
4342
+ [pt],
4336
4343
  [Mn],
4337
4344
  [bn],
4338
4345
  [Dn]
4339
4346
  ].forEach((i) => {
4340
- this.disposeWithMe(this._renderManagerService.registerRenderModule(B.UNIVER_SHEET, i));
4347
+ this.disposeWithMe(this._renderManagerService.registerRenderModule($.UNIVER_SHEET, i));
4341
4348
  });
4342
4349
  }
4343
4350
  };
4344
- zr(Xt, "type", B.UNIVER_SHEET);
4345
- zr(Xt, "pluginName", ko);
4346
- Xt = xo([
4347
- Oi(as, Ss, Ds, xi),
4348
- hn(1, N(it)),
4349
- hn(2, ee),
4350
- hn(3, Ui)
4351
- ], Xt);
4351
+ en(it, "type", $.UNIVER_SHEET);
4352
+ en(it, "pluginName", "SHEET_IMAGE_UI_PLUGIN");
4353
+ en(it, "packageName", Yr.name);
4354
+ en(it, "version", Yr.version);
4355
+ it = $o([
4356
+ Ui(cs, _s, bs, ki),
4357
+ gn(1, N(st)),
4358
+ gn(2, ee),
4359
+ gn(3, Pi)
4360
+ ], it);
4352
4361
  export {
4353
- Cn as BatchSaveImagesService,
4362
+ Rn as BatchSaveImagesService,
4354
4363
  L as ClearSheetDrawingTransformerOperation,
4355
4364
  $r as DeleteDrawingsCommand,
4356
- Hr as EditSheetDrawingOperation,
4365
+ Vr as EditSheetDrawingOperation,
4357
4366
  xe as FileNamePart,
4358
- Br as GroupSheetDrawingCommand,
4359
- On as IBatchSaveImagesService,
4367
+ Wr as GroupSheetDrawingCommand,
4368
+ Un as IBatchSaveImagesService,
4360
4369
  Qt as InsertFloatImageCommand,
4361
4370
  qt as InsertSheetDrawingCommand,
4362
- It as MoveDrawingsCommand,
4363
- _t as RemoveSheetDrawingCommand,
4364
- Xr as SHEETS_IMAGE_MENU_ID,
4365
- oo as SHEET_FLOAT_DOM_PREFIX,
4371
+ Ct as MoveDrawingsCommand,
4372
+ vt as RemoveSheetDrawingCommand,
4373
+ Gr as SHEETS_IMAGE_MENU_ID,
4374
+ lo as SHEET_FLOAT_DOM_PREFIX,
4366
4375
  mt as SaveCellImagesCommand,
4367
- Wr as SetDrawingArrangeCommand,
4368
- vt as SetSheetDrawingCommand,
4369
- pt as SheetCanvasFloatDomManagerService,
4370
- po as SheetDrawingAnchor,
4371
- ft as SheetDrawingUpdateController,
4372
- Lr as SidebarSheetDrawingOperation,
4373
- jr as UngroupSheetDrawingCommand,
4374
- Xt as UniverSheetsDrawingUIPlugin,
4376
+ jr as SetDrawingArrangeCommand,
4377
+ It as SetSheetDrawingCommand,
4378
+ wt as SheetCanvasFloatDomManagerService,
4379
+ Do as SheetDrawingAnchor,
4380
+ pt as SheetDrawingUpdateController,
4381
+ Hr as SidebarSheetDrawingOperation,
4382
+ Fr as UngroupSheetDrawingCommand,
4383
+ it as UniverSheetsDrawingUIPlugin,
4375
4384
  _e as calcSheetFloatDomPosition,
4376
4385
  Q as drawingPositionToTransform,
4377
4386
  F as transformToAxisAlignPosition,