@univerjs/sheets-drawing-ui 0.6.1 → 0.6.2-nightly.202503031606

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,155 +1,155 @@
1
- var Er = Object.defineProperty;
2
- var Or = (i, n, t) => n in i ? Er(i, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[n] = t;
3
- var Q = (i, n, t) => Or(i, typeof n != "symbol" ? n + "" : n, t);
4
- import { CommandType as te, ICommandService as G, IUndoRedoService as Ye, sequenceExecute as kn, LocaleService as $t, IUniverInstanceService as Ge, Inject as N, Injector as tt, IContextService as Bn, RxDisposable as Ur, UniverInstanceType as F, toDisposable as Pr, FOCUSING_COMMON_DRAWINGS as Le, DrawingTypeEnum as L, Disposable as le, ArrangeTypeEnum as mt, createDocumentModelWithStyle as Ar, ObjectRelativeFromV as Nr, ObjectRelativeFromH as kr, WrapTextType as Br, PositionedObjectLayoutType as Wr, BooleanNumber as jr, BuildTextUtils as $r, Range as xr, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as pt, DOCS_ZEN_EDITOR_UNIT_ID_KEY as wt, InterceptorEffectEnum as Lr, ObjectMatrix as Fr, Tools as ye, IPermissionService as Yr, UserManagerService as Gr, Rectangle as Xr, Direction as Ie, FOCUSING_FX_BAR_EDITOR as Vr, EDITOR_ACTIVATED as Hr, FOCUSING_PANEL_EDITOR as zr, LifecycleService as Kr, LifecycleStages as Zr, DisposableCollection as _t, fromEventSubject as Jr, generateRandomId as Ht, DependentOn as qr, IConfigService as Qr, Plugin as ei, merge as ti, registerDependencies as ni, touchDependencies as zt } from "@univerjs/core";
5
- import { DocDrawingController as ri, UniverDocsDrawingPlugin as ii } from "@univerjs/docs-drawing";
6
- import { SetDrawingSelectedOperation as xt, IImageIoService as Wn, IDrawingManagerService as oe, DRAWING_IMAGE_ALLOW_IMAGE_LIST as wn, DRAWING_IMAGE_COUNT_LIMIT as _n, ImageUploadStatusType as Be, DRAWING_IMAGE_ALLOW_SIZE as vn, getImageSize as Sn, DRAWING_IMAGE_WIDTH_LIMIT as In, DRAWING_IMAGE_HEIGHT_LIMIT as Cn, ImageSourceType as si, getDrawingShapeKeyByDrawingSearch as Ce, UniverDrawingPlugin as oi } from "@univerjs/drawing";
7
- import { ImageCropperObject as ai, COMPONENT_IMAGE_POPUP_MENU as ci, OpenImageCropOperation as di, ImageResetSizeOperation as li, DrawingRenderService as jn, DrawingCommonPanel as ui, UniverDrawingUIPlugin as hi } from "@univerjs/drawing-ui";
8
- import { IRenderManagerService as ne, precisionTo as vt, transformObjectOutOfGroup as gi, getGroupState as fi, RENDER_CLASS_TYPE as We, Rect as je, ObjectType as bn, DRAWING_OBJECT_LAYER_INDEX as Kt, SHEET_VIEWPORT_KEY as $n } from "@univerjs/engine-render";
9
- import { ISheetDrawingService as ae, DrawingApplyType as P, SetDrawingApplyMutation as A, SheetDrawingAnchorType as U, UniverSheetsDrawingPlugin as mi } from "@univerjs/sheets-drawing";
10
- import { SheetCanvasPopManagerService as pi, convertPositionSheetOverGridToAbsolute as wi, ISheetSelectionRenderService as Xe, SheetSkeletonManagerService as V, attachRangeWithCoord as xn, IEditorBridgeService as _i, IAutoFillService as vi, HoverManagerService as Si, PREDEFINED_HOOK_NAME as xe, COPY_TYPE as be, discreteRangeToRange as Rn, virtualizeDiscreteRanges as Ii, ISheetClipboardService as Ci, SheetPrintInterceptorService as bi, getCurrentRangeDisable$ as Ri, SetZoomRatioOperation as Dn, SetScrollOperation as Di } from "@univerjs/sheets-ui";
11
- import { ISidebarService as Mi, useDependency as Te, IUIPartsService as yi, BuiltInUIPart as Ti, connectInjector as Ei, ILocalFileService as Oi, IMessageService as Ui, IClipboardInterfaceService as Pi, MenuItemType as cn, getMenuHiddenObservable as Ln, RibbonStartGroup as Ai, KeyCode as Fe, ComponentManager as Ni, IMenuManagerService as ki, IShortcutService as Bi, CanvasFloatDomService as Wi } from "@univerjs/ui";
12
- import { takeUntil as Mn, combineLatest as St, switchMap as Se, EMPTY as pe, tap as yn, map as Ee, distinctUntilChanged as Tn, Subject as Zt, filter as ji, take as $i, BehaviorSubject as Ze, of as En } from "rxjs";
13
- import { SheetInterceptorService as Lt, getSheetCommandTarget as H, SheetsSelectionsService as dn, SetRangeValuesCommand as xi, SetWorksheetRowHeightMutation as Fn, SetWorksheetColWidthMutation as Yn, SetWorksheetRowIsAutoHeightMutation as Li, SetWorksheetRowAutoHeightMutation as Gn, AddWorksheetMergeMutation as Fi, RemoveWorksheetMergeMutation as Yi, AFTER_CELL_EDIT as Gi, INTERCEPTOR_POINT as Xi, InterceptCellContentPriority as Vi, WorkbookViewPermission as On, WorksheetViewPermission as Un, WorkbookEditablePermission as Qt, WorksheetEditPermission as en, InsertRowCommand as Xn, InsertColCommand as Vn, RemoveRowCommand as Hn, RemoveColCommand as zn, DeleteRangeMoveLeftCommand as Kn, DeleteRangeMoveUpCommand as Zn, InsertRangeMoveDownCommand as Jn, InsertRangeMoveRightCommand as qn, DeltaRowHeightCommand as tn, SetRowHeightCommand as nn, DeltaColumnWidthCommand as Qn, SetColWidthCommand as er, SetRowHiddenCommand as tr, SetSpecificRowsVisibleCommand as nr, SetSpecificColsVisibleCommand as rr, SetColHiddenCommand as ir, MoveColsCommand as sr, MoveRowsCommand as or, MoveRangeCommand as ar, SetRowVisibleMutation as Hi, SetRowHiddenMutation as zi, SetColVisibleMutation as Ki, SetColHiddenMutation as Zi, SetWorksheetActiveOperation as Ji, RangeProtectionPermissionEditPoint as qi, SetFrozenMutation as Qi, COMMAND_LISTENER_SKELETON_CHANGE as es } from "@univerjs/sheets";
1
+ var $r = Object.defineProperty;
2
+ var xr = (i, n, e) => n in i ? $r(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
+ var Q = (i, n, e) => xr(i, typeof n != "symbol" ? n + "" : n, e);
4
+ import { CommandType as te, ICommandService as G, IUndoRedoService as Ge, sequenceExecute as Hn, LocaleService as xt, IUniverInstanceService as Ce, Inject as N, Injector as tt, IContextService as zn, RxDisposable as Lr, UniverInstanceType as F, toDisposable as Fr, FOCUSING_COMMON_DRAWINGS as Fe, DrawingTypeEnum as x, Disposable as le, ArrangeTypeEnum as mt, createDocumentModelWithStyle as Sn, ObjectRelativeFromV as In, ObjectRelativeFromH as Cn, WrapTextType as bn, PositionedObjectLayoutType as Dn, BooleanNumber as Rn, BuildTextUtils as Mn, ImageSourceType as yn, generateRandomId as Et, Range as Yr, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as pt, DOCS_ZEN_EDITOR_UNIT_ID_KEY as wt, InterceptorEffectEnum as Gr, ObjectMatrix as Xr, Tools as Ee, IPermissionService as Vr, UserManagerService as Hr, Rectangle as zr, Direction as Ie, FOCUSING_FX_BAR_EDITOR as Kr, EDITOR_ACTIVATED as Zr, FOCUSING_PANEL_EDITOR as Jr, LifecycleService as qr, LifecycleStages as Qr, DisposableCollection as _t, fromEventSubject as ei, DependentOn as ti, IConfigService as ni, Plugin as ri, merge as ii, registerDependencies as si, touchDependencies as zt } from "@univerjs/core";
5
+ import { DocDrawingController as oi, UniverDocsDrawingPlugin as ai } from "@univerjs/docs-drawing";
6
+ import { SetDrawingSelectedOperation as Lt, IImageIoService as Kn, IDrawingManagerService as oe, DRAWING_IMAGE_ALLOW_IMAGE_LIST as En, DRAWING_IMAGE_COUNT_LIMIT as Tn, ImageUploadStatusType as We, DRAWING_IMAGE_ALLOW_SIZE as On, getImageSize as Kt, DRAWING_IMAGE_WIDTH_LIMIT as Un, DRAWING_IMAGE_HEIGHT_LIMIT as Pn, ImageSourceType as ci, getDrawingShapeKeyByDrawingSearch as be, UniverDrawingPlugin as di } from "@univerjs/drawing";
7
+ import { ImageCropperObject as li, COMPONENT_IMAGE_POPUP_MENU as ui, OpenImageCropOperation as hi, ImageResetSizeOperation as gi, DrawingRenderService as Zn, DrawingCommonPanel as fi, UniverDrawingUIPlugin as mi } from "@univerjs/drawing-ui";
8
+ import { IRenderManagerService as ne, precisionTo as vt, transformObjectOutOfGroup as pi, getGroupState as wi, DeviceInputEventType as _i, getCurrentTypeOfRenderer as Jn, RENDER_CLASS_TYPE as je, Rect as $e, ObjectType as An, DRAWING_OBJECT_LAYER_INDEX as Zt, SHEET_VIEWPORT_KEY as qn } from "@univerjs/engine-render";
9
+ import { ISheetDrawingService as ae, DrawingApplyType as P, SetDrawingApplyMutation as A, SheetDrawingAnchorType as U, UniverSheetsDrawingPlugin as vi } from "@univerjs/sheets-drawing";
10
+ import { SheetCanvasPopManagerService as Si, convertPositionSheetOverGridToAbsolute as Ii, ISheetSelectionRenderService as Xe, SheetSkeletonManagerService as V, attachRangeWithCoord as Qn, IEditorBridgeService as Ci, SetCellEditVisibleOperation as bi, IAutoFillService as Di, HoverManagerService as Ri, PREDEFINED_HOOK_NAME as Le, COPY_TYPE as De, discreteRangeToRange as Nn, virtualizeDiscreteRanges as Mi, ISheetClipboardService as yi, SheetPrintInterceptorService as Ei, getCurrentRangeDisable$ as Ti, SetZoomRatioOperation as kn, SetScrollOperation as Oi } from "@univerjs/sheets-ui";
11
+ import { ISidebarService as Ui, useDependency as Te, IUIPartsService as Pi, BuiltInUIPart as Ai, connectInjector as Ni, ILocalFileService as ki, IMessageService as Bi, IClipboardInterfaceService as Wi, getMenuHiddenObservable as ln, MenuItemType as un, RibbonStartGroup as ji, KeyCode as Ye, ComponentManager as $i, IMenuManagerService as xi, IShortcutService as Li, CanvasFloatDomService as Fi } from "@univerjs/ui";
12
+ import { takeUntil as Bn, combineLatest as St, switchMap as Se, EMPTY as pe, tap as Wn, map as Oe, distinctUntilChanged as jn, Subject as Jt, filter as Yi, take as Gi, BehaviorSubject as Ze, of as $n } from "rxjs";
13
+ import { SheetInterceptorService as Ft, getSheetCommandTarget as H, SheetsSelectionsService as hn, SetRangeValuesCommand as xn, SetWorksheetRowHeightMutation as er, SetWorksheetColWidthMutation as tr, SetWorksheetRowIsAutoHeightMutation as Xi, SetWorksheetRowAutoHeightMutation as nr, AddWorksheetMergeMutation as Vi, RemoveWorksheetMergeMutation as Hi, AFTER_CELL_EDIT as zi, INTERCEPTOR_POINT as Ki, InterceptCellContentPriority as Zi, WorkbookViewPermission as Ln, WorksheetViewPermission as Fn, WorkbookEditablePermission as en, WorksheetEditPermission as tn, InsertRowCommand as rr, InsertColCommand as ir, RemoveRowCommand as sr, RemoveColCommand as or, DeleteRangeMoveLeftCommand as ar, DeleteRangeMoveUpCommand as cr, InsertRangeMoveDownCommand as dr, InsertRangeMoveRightCommand as lr, DeltaRowHeightCommand as nn, SetRowHeightCommand as rn, DeltaColumnWidthCommand as ur, SetColWidthCommand as hr, SetRowHiddenCommand as gr, SetSpecificRowsVisibleCommand as fr, SetSpecificColsVisibleCommand as mr, SetColHiddenCommand as pr, MoveColsCommand as wr, MoveRowsCommand as _r, MoveRangeCommand as vr, SetRowVisibleMutation as Ji, SetRowHiddenMutation as qi, SetColVisibleMutation as Qi, SetColHiddenMutation as es, SetWorksheetActiveOperation as ts, RangeProtectionPermissionEditPoint as ns, SetFrozenMutation as rs, COMMAND_LISTENER_SKELETON_CHANGE as is } from "@univerjs/sheets";
14
14
  import { jsx as ee, jsxs as Tt } from "react/jsx-runtime";
15
- import ts, { useEffect as ln, forwardRef as cr, useRef as ns, createElement as dr, useState as rn } from "react";
16
- import { docDrawingPositionToTransform as rs, ReplaceSnapshotCommand as is } from "@univerjs/docs-ui";
17
- import { MessageType as Re, RadioGroup as ss, Radio as Jt } from "@univerjs/design";
18
- const os = "sheets-drawing-ui.config", Pn = {}, x = {
15
+ import ss, { useEffect as gn, forwardRef as Sr, useRef as os, createElement as Ir, useState as sn } from "react";
16
+ import { docDrawingPositionToTransform as Yn, ReplaceSnapshotCommand as as } from "@univerjs/docs-ui";
17
+ import { MessageType as Re, clsx as It, RadioGroup as cs, Radio as qt } from "@univerjs/design";
18
+ const ds = "sheets-drawing-ui.config", Gn = {}, L = {
19
19
  id: "sheet.operation.clear-drawing-transformer",
20
20
  type: te.MUTATION,
21
21
  handler: (i, n) => {
22
- const t = i.get(ne);
23
- return n.forEach((e) => {
22
+ const e = i.get(ne);
23
+ return n.forEach((t) => {
24
24
  var r, s;
25
- (s = (r = t.getRenderById(e)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
25
+ (s = (r = e.getRenderById(t)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
26
26
  }), !0;
27
27
  }
28
28
  }, nt = {
29
29
  id: "sheet.command.remove-sheet-image",
30
30
  type: te.COMMAND,
31
31
  handler: (i, n) => {
32
- var S, C, D;
33
- const t = i.get(G), e = i.get(Ye), r = i.get(Lt), s = i.get(ae);
32
+ var S, C, b;
33
+ const e = i.get(G), t = i.get(Ge), r = i.get(Ft), s = i.get(ae);
34
34
  if (!n) return !1;
35
35
  const { drawings: o } = n, a = [];
36
36
  o.forEach((v) => {
37
- const { unitId: b } = v;
38
- a.push(b);
37
+ const { unitId: D } = v;
38
+ a.push(D);
39
39
  });
40
- const c = s.getBatchRemoveOp(o), { unitId: u, subUnitId: d, undo: l, redo: g, objects: h } = c, f = r.onCommandExecute({ id: nt.id, params: n }), p = { id: A.id, params: { unitId: u, subUnitId: d, op: g, objects: h, type: P.REMOVE } }, m = { id: A.id, params: { unitId: u, subUnitId: d, op: l, objects: h, type: P.INSERT } };
41
- return kn([...(S = f.preRedos) != null ? S : [], p, ...f.redos], t) ? (e.pushUndoRedo({
40
+ const c = s.getBatchRemoveOp(o), { unitId: u, subUnitId: l, undo: d, redo: g, objects: h } = c, f = r.onCommandExecute({ id: nt.id, params: n }), p = { id: A.id, params: { unitId: u, subUnitId: l, op: g, objects: h, type: P.REMOVE } }, m = { id: A.id, params: { unitId: u, subUnitId: l, op: d, objects: h, type: P.INSERT } };
41
+ return Hn([...(S = f.preRedos) != null ? S : [], p, ...f.redos], e) ? (t.pushUndoRedo({
42
42
  unitID: u,
43
43
  undoMutations: [
44
44
  ...(C = f.preUndos) != null ? C : [],
45
45
  m,
46
46
  ...f.undos,
47
- { id: x.id, params: a }
47
+ { id: L.id, params: a }
48
48
  ],
49
49
  redoMutations: [
50
- ...(D = f.preRedos) != null ? D : [],
50
+ ...(b = f.preRedos) != null ? b : [],
51
51
  p,
52
52
  ...f.redos,
53
- { id: x.id, params: a }
53
+ { id: L.id, params: a }
54
54
  ]
55
55
  }), !0) : !1;
56
56
  }
57
- }, lr = "COMPONENT_SHEET_DRAWING_PANEL", ur = {
57
+ }, Cr = "COMPONENT_SHEET_DRAWING_PANEL", br = {
58
58
  id: "sidebar.operation.sheet-image",
59
59
  type: te.COMMAND,
60
60
  handler: async (i, n) => {
61
- const t = i.get(Mi), e = i.get($t), r = i.get(Ge), s = i.get(G);
61
+ const e = i.get(Ui), t = i.get(xt), r = i.get(Ce), s = i.get(G);
62
62
  if (!H(r)) return !1;
63
63
  switch (n.value) {
64
64
  case "open":
65
- t.open({
66
- header: { title: e.t("sheetImage.panel.title") },
67
- children: { label: lr },
65
+ e.open({
66
+ header: { title: t.t("sheetImage.panel.title") },
67
+ children: { label: Cr },
68
68
  onClose: () => {
69
- s.syncExecuteCommand(xt.id, []);
69
+ s.syncExecuteCommand(Lt.id, []);
70
70
  },
71
71
  width: 360
72
72
  });
73
73
  break;
74
74
  case "close":
75
75
  default:
76
- t.close();
76
+ e.close();
77
77
  break;
78
78
  }
79
79
  return !0;
80
80
  }
81
- }, hr = {
81
+ }, Dr = {
82
82
  id: "sheet.operation.edit-sheet-image",
83
83
  type: te.OPERATION,
84
84
  handler: (i, n) => {
85
- const t = i.get(G);
86
- return n == null ? !1 : (t.syncExecuteCommand(xt.id, [n]), t.executeCommand(ur.id, { value: "open" }), !0);
87
- }
88
- }, as = "univer-upload-loading", cs = "univer-upload-loading-body", ds = "univer-upload-loading-body-animation", ls = "univer-upload-loading-body-text", It = {
89
- uploadLoading: as,
90
- uploadLoadingBody: cs,
91
- uploadLoadingBodyAnimation: ds,
92
- uploadLoadingBodyText: ls
93
- }, us = () => {
94
- const i = Te(Wn), n = Te($t), [t, e] = ts.useState(0);
95
- return ln(() => {
85
+ const e = i.get(G);
86
+ return n == null ? !1 : (e.syncExecuteCommand(Lt.id, [n]), e.executeCommand(br.id, { value: "open" }), !0);
87
+ }
88
+ }, ls = "univer-upload-loading", us = "univer-upload-loading-body", hs = "univer-upload-loading-body-animation", gs = "univer-upload-loading-body-text", Ct = {
89
+ uploadLoading: ls,
90
+ uploadLoadingBody: us,
91
+ uploadLoadingBodyAnimation: hs,
92
+ uploadLoadingBodyText: gs
93
+ }, fs = () => {
94
+ const i = Te(Kn), n = Te(xt), [e, t] = ss.useState(0);
95
+ return gn(() => {
96
96
  const r = i.change$.subscribe((s) => {
97
- e(s);
97
+ t(s);
98
98
  });
99
99
  return () => {
100
100
  r.unsubscribe();
101
101
  };
102
- }, [i]), /* @__PURE__ */ ee("div", { style: { display: t > 0 ? "block" : "none" }, className: It.uploadLoading, children: /* @__PURE__ */ Tt("div", { className: It.uploadLoadingBody, children: [
103
- /* @__PURE__ */ ee("div", { className: It.uploadLoadingBodyAnimation }),
104
- /* @__PURE__ */ ee("div", { className: It.uploadLoadingBodyText, children: `${n.t("uploadLoading.loading")}: ${t}` })
102
+ }, [i]), /* @__PURE__ */ ee("div", { style: { display: e > 0 ? "block" : "none" }, className: Ct.uploadLoading, children: /* @__PURE__ */ Tt("div", { className: Ct.uploadLoadingBody, children: [
103
+ /* @__PURE__ */ ee("div", { className: Ct.uploadLoadingBodyAnimation }),
104
+ /* @__PURE__ */ ee("div", { className: Ct.uploadLoadingBodyText, children: `${n.t("uploadLoading.loading")}: ${e}` })
105
105
  ] }) });
106
106
  };
107
- var hs = Object.getOwnPropertyDescriptor, gs = (i, n, t, e) => {
108
- for (var r = e > 1 ? void 0 : e ? hs(n, t) : n, s = i.length - 1, o; s >= 0; s--)
107
+ var ms = Object.getOwnPropertyDescriptor, ps = (i, n, e, t) => {
108
+ for (var r = t > 1 ? void 0 : t ? ms(n, e) : n, s = i.length - 1, o; s >= 0; s--)
109
109
  (o = i[s]) && (r = o(r) || r);
110
110
  return r;
111
- }, we = (i, n) => (t, e) => n(t, e, i);
112
- let Et = class extends Ur {
113
- constructor(n, t, e, r, s, o, a, c) {
111
+ }, we = (i, n) => (e, t) => n(e, t, i);
112
+ let Ot = class extends Lr {
113
+ constructor(n, e, t, r, s, o, a, c) {
114
114
  super();
115
115
  Q(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
116
- this._injector = n, this._drawingManagerService = t, this._canvasPopManagerService = e, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = a, this._commandService = c, this._init();
116
+ this._injector = n, this._drawingManagerService = e, this._canvasPopManagerService = t, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = a, this._commandService = c, this._init();
117
117
  }
118
118
  _init() {
119
- this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(Mn(this.dispose$)).subscribe((n) => this._create(n)), this._univerInstanceService.getTypeOfUnitDisposed$(F.UNIVER_SHEET).pipe(Mn(this.dispose$)).subscribe((n) => this._dispose(n)), this._univerInstanceService.getAllUnitsForType(F.UNIVER_SHEET).forEach((n) => this._create(n)), this._uiPartsService.registerComponent(Ti.CONTENT, () => Ei(us, this._injector));
119
+ this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(Bn(this.dispose$)).subscribe((n) => this._create(n)), this._univerInstanceService.getTypeOfUnitDisposed$(F.UNIVER_SHEET).pipe(Bn(this.dispose$)).subscribe((n) => this._dispose(n)), this._univerInstanceService.getAllUnitsForType(F.UNIVER_SHEET).forEach((n) => this._create(n)), this._uiPartsService.registerComponent(Ai.CONTENT, () => Ni(fs, this._injector));
120
120
  }
121
121
  _dispose(n) {
122
- const t = n.getUnitId();
123
- this._renderManagerService.removeRender(t);
122
+ const e = n.getUnitId();
123
+ this._renderManagerService.removeRender(e);
124
124
  }
125
125
  _create(n) {
126
126
  if (!n)
127
127
  return;
128
- const t = n.getUnitId();
129
- this._renderManagerService.has(t) && !this._initImagePopupMenu.has(t) && (this._popupMenuListener(t), this._initImagePopupMenu.add(t));
128
+ const e = n.getUnitId();
129
+ this._renderManagerService.has(e) && !this._initImagePopupMenu.has(e) && (this._popupMenuListener(e), this._initImagePopupMenu.add(e));
130
130
  }
131
131
  _hasCropObject(n) {
132
- const t = n.getAllObjectsByOrder();
133
- for (const e of t)
134
- if (e instanceof ai)
132
+ const e = n.getAllObjectsByOrder();
133
+ for (const t of e)
134
+ if (t instanceof li)
135
135
  return !0;
136
136
  return !1;
137
137
  }
138
138
  _popupMenuListener(n) {
139
139
  var s;
140
- const t = (s = this._renderManagerService.getRenderById(n)) == null ? void 0 : s.scene;
141
- if (!t)
142
- return;
143
- const e = t.getTransformerByCreate();
140
+ const e = (s = this._renderManagerService.getRenderById(n)) == null ? void 0 : s.scene;
144
141
  if (!e)
145
142
  return;
143
+ const t = e.getTransformerByCreate();
144
+ if (!t)
145
+ return;
146
146
  let r;
147
147
  this.disposeWithMe(
148
- Pr(
149
- e.createControl$.subscribe(() => {
150
- if (this._contextService.setContextValue(Le, !0), this._hasCropObject(t))
148
+ Fr(
149
+ t.createControl$.subscribe(() => {
150
+ if (this._contextService.setContextValue(Fe, !0), this._hasCropObject(e))
151
151
  return;
152
- const o = e.getSelectedObjectMap();
152
+ const o = t.getSelectedObjectMap();
153
153
  if (o.size > 1) {
154
154
  r == null || r.dispose();
155
155
  return;
@@ -160,90 +160,90 @@ let Et = class extends Ur {
160
160
  const c = a.oKey, u = this._drawingManagerService.getDrawingOKey(c);
161
161
  if (!u)
162
162
  return;
163
- const { unitId: d, subUnitId: l, drawingId: g, drawingType: h } = u, f = u.data;
163
+ const { unitId: l, subUnitId: d, drawingId: g, drawingType: h } = u, f = u.data;
164
164
  if (f && f.disablePopup)
165
165
  return;
166
166
  r == null || r.dispose();
167
- const p = this._canvasPopManagerService.getFeatureMenu(d, l, g, h);
167
+ const p = this._canvasPopManagerService.getFeatureMenu(l, d, g, h);
168
168
  r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
169
- componentKey: ci,
169
+ componentKey: ui,
170
170
  direction: "horizontal",
171
171
  offset: [2, 0],
172
172
  extraProps: {
173
- menuItems: p || this._getImageMenuItems(d, l, g, h)
173
+ menuItems: p || this._getImageMenuItems(l, d, g, h)
174
174
  }
175
175
  }));
176
176
  })
177
177
  )
178
178
  ), this.disposeWithMe(
179
- e.clearControl$.subscribe(() => {
180
- r == null || r.dispose(), this._contextService.setContextValue(Le, !1), this._commandService.syncExecuteCommand(xt.id, []);
179
+ t.clearControl$.subscribe(() => {
180
+ r == null || r.dispose(), this._contextService.setContextValue(Fe, !1), this._commandService.syncExecuteCommand(Lt.id, []);
181
181
  })
182
182
  ), this.disposeWithMe(
183
183
  this._contextService.contextChanged$.subscribe((o) => {
184
- o[Le] === !1 && (r == null || r.dispose());
184
+ o[Fe] === !1 && (r == null || r.dispose());
185
185
  })
186
186
  ), this.disposeWithMe(
187
- e.changing$.subscribe(() => {
187
+ t.changing$.subscribe(() => {
188
188
  r == null || r.dispose();
189
189
  })
190
190
  );
191
191
  }
192
- _getImageMenuItems(n, t, e, r) {
192
+ _getImageMenuItems(n, e, t, r) {
193
193
  return [
194
194
  {
195
195
  label: "image-popup.edit",
196
196
  index: 0,
197
- commandId: hr.id,
198
- commandParams: { unitId: n, subUnitId: t, drawingId: e },
199
- disable: r === L.DRAWING_DOM
197
+ commandId: Dr.id,
198
+ commandParams: { unitId: n, subUnitId: e, drawingId: t },
199
+ disable: r === x.DRAWING_DOM
200
200
  },
201
201
  {
202
202
  label: "image-popup.delete",
203
203
  index: 1,
204
204
  commandId: nt.id,
205
- commandParams: { unitId: n, drawings: [{ unitId: n, subUnitId: t, drawingId: e }] },
205
+ commandParams: { unitId: n, drawings: [{ unitId: n, subUnitId: e, drawingId: t }] },
206
206
  disable: !1
207
207
  },
208
208
  {
209
209
  label: "image-popup.crop",
210
210
  index: 2,
211
- commandId: di.id,
212
- commandParams: { unitId: n, subUnitId: t, drawingId: e },
213
- disable: r === L.DRAWING_DOM
211
+ commandId: hi.id,
212
+ commandParams: { unitId: n, subUnitId: e, drawingId: t },
213
+ disable: r === x.DRAWING_DOM
214
214
  },
215
215
  {
216
216
  label: "image-popup.reset",
217
217
  index: 3,
218
- commandId: li.id,
219
- commandParams: [{ unitId: n, subUnitId: t, drawingId: e }],
220
- disable: r === L.DRAWING_DOM
218
+ commandId: gi.id,
219
+ commandParams: [{ unitId: n, subUnitId: e, drawingId: t }],
220
+ disable: r === x.DRAWING_DOM
221
221
  }
222
222
  ];
223
223
  }
224
224
  };
225
- Et = gs([
225
+ Ot = ps([
226
226
  we(0, N(tt)),
227
227
  we(1, oe),
228
- we(2, N(pi)),
228
+ we(2, N(Si)),
229
229
  we(3, ne),
230
- we(4, Ge),
231
- we(5, Bn),
232
- we(6, N(yi)),
230
+ we(4, Ce),
231
+ we(5, zn),
232
+ we(6, N(Pi)),
233
233
  we(7, G)
234
- ], Et);
235
- function z(i, n, t) {
236
- const { from: e, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: c = 0, skewY: u = 0 } = i, d = t.getCurrent();
237
- if (d == null)
234
+ ], Ot);
235
+ function z(i, n, e) {
236
+ const { from: t, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: c = 0, skewY: u = 0 } = i, l = e.getCurrent();
237
+ if (l == null)
238
238
  return;
239
- const l = wi(
240
- d.unitId,
241
- d.sheetId,
242
- { from: e, to: r },
243
- t
239
+ const d = Ii(
240
+ l.unitId,
241
+ l.sheetId,
242
+ { from: t, to: r },
243
+ e
244
244
  );
245
- let { left: g, top: h, width: f, height: p } = l;
246
- const m = t.getCurrentSkeleton(), w = m.rowHeaderWidth + m.columnTotalWidth, S = m.columnHeaderHeight + m.rowTotalHeight;
245
+ let { left: g, top: h, width: f, height: p } = d;
246
+ const m = e.getCurrentSkeleton(), w = m.rowHeaderWidth + m.columnTotalWidth, S = m.columnHeaderHeight + m.rowTotalHeight;
247
247
  return g + f > w && (g = w - f), h + p > S && (h = S - p), {
248
248
  flipY: s,
249
249
  flipX: o,
@@ -257,41 +257,41 @@ function z(i, n, t) {
257
257
  };
258
258
  }
259
259
  function $(i, n) {
260
- const { left: t = 0, top: e = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: c = 0, skewX: u = 0, skewY: d = 0 } = i, l = n.getCellWithCoordByOffset(t, e);
261
- if (l == null)
260
+ const { left: e = 0, top: t = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: c = 0, skewX: u = 0, skewY: l = 0 } = i, d = n.getCellWithCoordByOffset(e, t);
261
+ if (d == null)
262
262
  return;
263
263
  const g = {
264
- column: l.actualColumn,
265
- columnOffset: vt(t - l.startX, 1),
266
- row: l.actualRow,
267
- rowOffset: vt(e - l.startY, 1)
268
- }, h = n.getCellWithCoordByOffset(t + r, e + s);
264
+ column: d.actualColumn,
265
+ columnOffset: vt(e - d.startX, 1),
266
+ row: d.actualRow,
267
+ rowOffset: vt(t - d.startY, 1)
268
+ }, h = n.getCellWithCoordByOffset(e + r, t + s);
269
269
  if (h == null)
270
270
  return;
271
271
  const f = {
272
272
  column: h.actualColumn,
273
- columnOffset: vt(t + r - h.startX, 1),
273
+ columnOffset: vt(e + r - h.startX, 1),
274
274
  row: h.actualRow,
275
- rowOffset: vt(e + s - h.startY, 1)
275
+ rowOffset: vt(t + s - h.startY, 1)
276
276
  };
277
277
  return {
278
278
  flipY: o,
279
279
  flipX: a,
280
280
  angle: c,
281
281
  skewX: u,
282
- skewY: d,
282
+ skewY: l,
283
283
  from: g,
284
284
  to: f
285
285
  };
286
286
  }
287
- var fs = Object.getOwnPropertyDescriptor, ms = (i, n, t, e) => {
288
- for (var r = e > 1 ? void 0 : e ? fs(n, t) : n, s = i.length - 1, o; s >= 0; s--)
287
+ var ws = Object.getOwnPropertyDescriptor, _s = (i, n, e, t) => {
288
+ for (var r = t > 1 ? void 0 : t ? ws(n, e) : n, s = i.length - 1, o; s >= 0; s--)
289
289
  (o = i[s]) && (r = o(r) || r);
290
290
  return r;
291
- }, Ct = (i, n) => (t, e) => n(t, e, i);
292
- let sn = class extends le {
293
- constructor(i, n, t, e, r) {
294
- super(), this._context = i, this._sheetDrawingService = n, this._drawingManagerService = t, this._sheetSelectionRenderService = e, this._sheetSkeletonManagerService = r, this._init();
291
+ }, bt = (i, n) => (e, t) => n(e, t, i);
292
+ let on = class extends le {
293
+ constructor(i, n, e, t, r) {
294
+ super(), this._context = i, this._sheetDrawingService = n, this._drawingManagerService = e, this._sheetSelectionRenderService = t, this._sheetSkeletonManagerService = r, this._init();
295
295
  }
296
296
  _init() {
297
297
  this._drawingInitializeListener();
@@ -300,26 +300,26 @@ let sn = class extends le {
300
300
  this._sheetDrawingService.initializeNotification(this._context.unitId);
301
301
  const i = this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId);
302
302
  for (const n in i) {
303
- const t = i[n];
304
- for (const e in t.data) {
305
- const r = t.data[e];
303
+ const e = i[n];
304
+ for (const t in e.data) {
305
+ const r = e.data[t];
306
306
  r.transform = z(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService);
307
307
  }
308
308
  }
309
309
  this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
310
310
  }
311
311
  };
312
- sn = ms([
313
- Ct(1, ae),
314
- Ct(2, oe),
315
- Ct(3, N(Xe)),
316
- Ct(4, N(V))
317
- ], sn);
318
- function ps(i) {
312
+ on = _s([
313
+ bt(1, ae),
314
+ bt(2, oe),
315
+ bt(3, N(Xe)),
316
+ bt(4, N(V))
317
+ ], on);
318
+ function vs(i) {
319
319
  const n = [];
320
- return i.forEach((t) => {
321
- const { parent: e, children: r } = t, { unitId: s, subUnitId: o, drawingId: a } = e, c = fi(0, 0, r.map((l) => l.transform || {})), u = r.map((l) => {
322
- const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: f, drawingId: p } = l;
320
+ return i.forEach((e) => {
321
+ const { parent: t, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = t, c = wi(0, 0, r.map((d) => d.transform || {})), u = r.map((d) => {
322
+ const g = d.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: f, drawingId: p } = d;
323
323
  return {
324
324
  unitId: h,
325
325
  subUnitId: f,
@@ -331,27 +331,27 @@ function ps(i) {
331
331
  },
332
332
  groupId: a
333
333
  };
334
- }), d = {
334
+ }), l = {
335
335
  unitId: s,
336
336
  subUnitId: o,
337
337
  drawingId: a,
338
- drawingType: L.DRAWING_GROUP,
338
+ drawingType: x.DRAWING_GROUP,
339
339
  transform: c
340
340
  };
341
341
  n.push({
342
- parent: d,
342
+ parent: l,
343
343
  children: u
344
344
  });
345
345
  }), n;
346
346
  }
347
- function ws(i) {
347
+ function Ss(i) {
348
348
  const n = [];
349
- return i.forEach((t) => {
350
- const { parent: e, children: r } = t, { unitId: s, subUnitId: o, drawingId: a, transform: c = { width: 0, height: 0 } } = e;
349
+ return i.forEach((e) => {
350
+ const { parent: t, children: r } = e, { unitId: s, subUnitId: o, drawingId: a, transform: c = { width: 0, height: 0 } } = t;
351
351
  if (c == null)
352
352
  return;
353
- const u = r.map((l) => {
354
- const { transform: g } = l, { unitId: h, subUnitId: f, drawingId: p } = l, m = gi(g || {}, c, c.width || 0, c.height || 0);
353
+ const u = r.map((d) => {
354
+ const { transform: g } = d, { unitId: h, subUnitId: f, drawingId: p } = d, m = pi(g || {}, c, c.width || 0, c.height || 0);
355
355
  return {
356
356
  unitId: h,
357
357
  subUnitId: f,
@@ -359,27 +359,27 @@ function ws(i) {
359
359
  transform: m,
360
360
  groupId: void 0
361
361
  };
362
- }), d = {
362
+ }), l = {
363
363
  unitId: s,
364
364
  subUnitId: o,
365
365
  drawingId: a,
366
- drawingType: L.DRAWING_GROUP,
366
+ drawingType: x.DRAWING_GROUP,
367
367
  transform: {
368
368
  left: 0,
369
369
  top: 0
370
370
  }
371
371
  };
372
372
  n.push({
373
- parent: d,
373
+ parent: l,
374
374
  children: u
375
375
  });
376
376
  }), n;
377
377
  }
378
- const gr = {
378
+ const Rr = {
379
379
  id: "sheet.command.group-sheet-image",
380
380
  type: te.COMMAND,
381
381
  handler: (i, n) => {
382
- const t = i.get(G), e = i.get(Ye), r = i.get(ae);
382
+ const e = i.get(G), t = i.get(Ge), r = i.get(ae);
383
383
  if (!n) return !1;
384
384
  const s = [];
385
385
  n.forEach(({ parent: h, children: f }) => {
@@ -387,88 +387,88 @@ const gr = {
387
387
  s.push(p.unitId);
388
388
  });
389
389
  });
390
- const o = r.getGroupDrawingOp(n), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = o;
391
- return t.syncExecuteCommand(A.id, { op: d, unitId: a, subUnitId: c, objects: l, type: P.GROUP }) ? (e.pushUndoRedo({
390
+ const o = r.getGroupDrawingOp(n), { unitId: a, subUnitId: c, undo: u, redo: l, objects: d } = o;
391
+ return e.syncExecuteCommand(A.id, { op: l, unitId: a, subUnitId: c, objects: d, type: P.GROUP }) ? (t.pushUndoRedo({
392
392
  unitID: a,
393
393
  undoMutations: [
394
- { id: A.id, params: { op: u, unitId: a, subUnitId: c, objects: ws(l), type: P.UNGROUP } },
395
- { id: x.id, params: s }
394
+ { id: A.id, params: { op: u, unitId: a, subUnitId: c, objects: Ss(d), type: P.UNGROUP } },
395
+ { id: L.id, params: s }
396
396
  ],
397
397
  redoMutations: [
398
- { id: A.id, params: { op: d, unitId: a, subUnitId: c, objects: l, type: P.GROUP } },
399
- { id: x.id, params: s }
398
+ { id: A.id, params: { op: l, unitId: a, subUnitId: c, objects: d, type: P.GROUP } },
399
+ { id: L.id, params: s }
400
400
  ]
401
401
  }), !0) : !1;
402
402
  }
403
- }, Ft = {
403
+ }, Yt = {
404
404
  id: "sheet.command.insert-sheet-image",
405
405
  type: te.COMMAND,
406
406
  handler: (i, n) => {
407
- var S, C, D;
408
- const t = i.get(G), e = i.get(Ye), r = i.get(ae), s = i.get(Lt);
407
+ var S, C, b;
408
+ const e = i.get(G), t = i.get(Ge), r = i.get(ae), s = i.get(Ft);
409
409
  if (!n) return !1;
410
- const o = n.drawings, a = o.map((v) => v.unitId), c = r.getBatchAddOp(o), { unitId: u, subUnitId: d, undo: l, redo: g, objects: h } = c, f = s.onCommandExecute({ id: Ft.id, params: n }), p = { id: A.id, params: { op: g, unitId: u, subUnitId: d, objects: h, type: P.INSERT } }, m = { id: A.id, params: { op: l, unitId: u, subUnitId: d, objects: h, type: P.REMOVE } };
411
- return kn([...(S = f.preRedos) != null ? S : [], p, ...f.redos], t) ? (e.pushUndoRedo({
410
+ const o = n.drawings, a = o.map((v) => v.unitId), c = r.getBatchAddOp(o), { unitId: u, subUnitId: l, undo: d, redo: g, objects: h } = c, f = s.onCommandExecute({ id: Yt.id, params: n }), p = { id: A.id, params: { op: g, unitId: u, subUnitId: l, objects: h, type: P.INSERT } }, m = { id: A.id, params: { op: d, unitId: u, subUnitId: l, objects: h, type: P.REMOVE } };
411
+ return Hn([...(S = f.preRedos) != null ? S : [], p, ...f.redos], e) ? (t.pushUndoRedo({
412
412
  unitID: u,
413
413
  undoMutations: [
414
414
  ...(C = f.preUndos) != null ? C : [],
415
415
  m,
416
416
  ...f.undos,
417
- { id: x.id, params: a }
417
+ { id: L.id, params: a }
418
418
  ],
419
419
  redoMutations: [
420
- ...(D = f.preRedos) != null ? D : [],
420
+ ...(b = f.preRedos) != null ? b : [],
421
421
  p,
422
422
  ...f.redos,
423
- { id: x.id, params: a }
423
+ { id: L.id, params: a }
424
424
  ]
425
425
  }), !0) : !1;
426
426
  }
427
- }, fr = {
427
+ }, Mr = {
428
428
  id: "sheet.command.set-drawing-arrange",
429
429
  type: te.COMMAND,
430
430
  handler: (i, n) => {
431
- const t = i.get(G), e = i.get(Ye);
431
+ const e = i.get(G), t = i.get(Ge);
432
432
  if (!n) return !1;
433
433
  const r = i.get(ae), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: c } = n, u = { unitId: s, subUnitId: o, drawingIds: a };
434
- let d;
435
- if (c === mt.forward ? d = r.getForwardDrawingsOp(u) : c === mt.backward ? d = r.getBackwardDrawingOp(u) : c === mt.front ? d = r.getFrontDrawingsOp(u) : c === mt.back && (d = r.getBackDrawingsOp(u)), d == null)
434
+ let l;
435
+ if (c === mt.forward ? l = r.getForwardDrawingsOp(u) : c === mt.backward ? l = r.getBackwardDrawingOp(u) : c === mt.front ? l = r.getFrontDrawingsOp(u) : c === mt.back && (l = r.getBackDrawingsOp(u)), l == null)
436
436
  return !1;
437
- const { objects: l, redo: g, undo: h } = d;
438
- return t.syncExecuteCommand(A.id, { op: g, unitId: s, subUnitId: o, objects: l, type: P.ARRANGE }) ? (e.pushUndoRedo({
437
+ const { objects: d, redo: g, undo: h } = l;
438
+ return e.syncExecuteCommand(A.id, { op: g, unitId: s, subUnitId: o, objects: d, type: P.ARRANGE }) ? (t.pushUndoRedo({
439
439
  unitID: s,
440
440
  undoMutations: [
441
- { id: A.id, params: { op: h, unitId: s, subUnitId: o, objects: l, type: P.ARRANGE } }
441
+ { id: A.id, params: { op: h, unitId: s, subUnitId: o, objects: d, type: P.ARRANGE } }
442
442
  ],
443
443
  redoMutations: [
444
- { id: A.id, params: { op: g, unitId: s, subUnitId: o, objects: l, type: P.ARRANGE } }
444
+ { id: A.id, params: { op: g, unitId: s, subUnitId: o, objects: d, type: P.ARRANGE } }
445
445
  ]
446
446
  }), !0) : !1;
447
447
  }
448
- }, Yt = {
448
+ }, Gt = {
449
449
  id: "sheet.command.set-sheet-image",
450
450
  type: te.COMMAND,
451
451
  handler: (i, n) => {
452
- const t = i.get(G), e = i.get(Ye), r = i.get(ae);
452
+ const e = i.get(G), t = i.get(Ge), r = i.get(ae);
453
453
  if (!n) return !1;
454
- const { drawings: s } = n, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = o;
455
- return t.syncExecuteCommand(A.id, { unitId: a, subUnitId: c, op: d, objects: l, type: P.UPDATE }) ? (e.pushUndoRedo({
454
+ const { drawings: s } = n, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: c, undo: u, redo: l, objects: d } = o;
455
+ return e.syncExecuteCommand(A.id, { unitId: a, subUnitId: c, op: l, objects: d, type: P.UPDATE }) ? (t.pushUndoRedo({
456
456
  unitID: a,
457
457
  undoMutations: [
458
- { id: A.id, params: { unitId: a, subUnitId: c, op: u, objects: l, type: P.UPDATE } },
459
- { id: x.id, params: [a] }
458
+ { id: A.id, params: { unitId: a, subUnitId: c, op: u, objects: d, type: P.UPDATE } },
459
+ { id: L.id, params: [a] }
460
460
  ],
461
461
  redoMutations: [
462
- { id: A.id, params: { unitId: a, subUnitId: c, op: d, objects: l, type: P.UPDATE } },
463
- { id: x.id, params: [a] }
462
+ { id: A.id, params: { unitId: a, subUnitId: c, op: l, objects: d, type: P.UPDATE } },
463
+ { id: L.id, params: [a] }
464
464
  ]
465
465
  }), !0) : !1;
466
466
  }
467
- }, mr = {
467
+ }, yr = {
468
468
  id: "sheet.command.ungroup-sheet-image",
469
469
  type: te.COMMAND,
470
470
  handler: (i, n) => {
471
- const t = i.get(G), e = i.get(Ye), r = i.get(ae);
471
+ const e = i.get(G), t = i.get(Ge), r = i.get(ae);
472
472
  if (!n) return !1;
473
473
  const s = [];
474
474
  n.forEach(({ parent: h, children: f }) => {
@@ -476,136 +476,140 @@ const gr = {
476
476
  s.push(p.unitId);
477
477
  });
478
478
  });
479
- const o = r.getUngroupDrawingOp(n), { unitId: a, subUnitId: c, undo: u, redo: d, objects: l } = o;
480
- return t.syncExecuteCommand(A.id, { op: d, unitId: a, subUnitId: c, objects: l, type: P.UNGROUP }) ? (e.pushUndoRedo({
479
+ const o = r.getUngroupDrawingOp(n), { unitId: a, subUnitId: c, undo: u, redo: l, objects: d } = o;
480
+ return e.syncExecuteCommand(A.id, { op: l, unitId: a, subUnitId: c, objects: d, type: P.UNGROUP }) ? (t.pushUndoRedo({
481
481
  unitID: a,
482
482
  undoMutations: [
483
- { id: A.id, params: { op: u, unitId: a, subUnitId: c, objects: ps(l), type: P.GROUP } },
484
- { id: x.id, params: s }
483
+ { id: A.id, params: { op: u, unitId: a, subUnitId: c, objects: vs(d), type: P.GROUP } },
484
+ { id: L.id, params: s }
485
485
  ],
486
486
  redoMutations: [
487
- { id: A.id, params: { op: d, unitId: a, subUnitId: c, objects: l, type: P.UNGROUP } },
488
- { id: x.id, params: s }
487
+ { id: A.id, params: { op: l, unitId: a, subUnitId: c, objects: d, type: P.UNGROUP } },
488
+ { id: L.id, params: s }
489
489
  ]
490
490
  }), !0) : !1;
491
491
  }
492
492
  };
493
- var _s = Object.getOwnPropertyDescriptor, vs = (i, n, t, e) => {
494
- for (var r = e > 1 ? void 0 : e ? _s(n, t) : n, s = i.length - 1, o; s >= 0; s--)
493
+ var Is = Object.getOwnPropertyDescriptor, Cs = (i, n, e, t) => {
494
+ for (var r = t > 1 ? void 0 : t ? Is(n, e) : n, s = i.length - 1, o; s >= 0; s--)
495
495
  (o = i[s]) && (r = o(r) || r);
496
496
  return r;
497
- }, ie = (i, n) => (t, e) => n(t, e, i);
498
- function Ss(i, n, t) {
499
- const e = t * Math.PI / 180, r = Math.abs(i * Math.cos(e)) + Math.abs(n * Math.sin(e)), s = Math.abs(i * Math.sin(e)) + Math.abs(n * Math.cos(e));
497
+ }, ie = (i, n) => (e, t) => n(e, t, i);
498
+ function bs(i, n, e) {
499
+ const t = e * Math.PI / 180, r = Math.abs(i * Math.cos(t)) + Math.abs(n * Math.sin(t)), s = Math.abs(i * Math.sin(t)) + Math.abs(n * Math.cos(t));
500
500
  return { rotatedWidth: r, rotatedHeight: s };
501
501
  }
502
- function pr(i, n, t, e, r) {
502
+ function an(i, n, e, t, r) {
503
503
  var S;
504
- const { rotatedHeight: s, rotatedWidth: o } = Ss(t, e, r), c = i.get(ne).getRenderById(n.unitId);
504
+ const { rotatedHeight: s, rotatedWidth: o } = bs(e, t, r), c = i.get(ne).getRenderById(n.unitId);
505
505
  if (!c)
506
506
  return !1;
507
- const d = (S = c.with(V).getSkeletonParam(n.subUnitId)) == null ? void 0 : S.skeleton;
508
- if (d == null)
507
+ const l = (S = c.with(V).getSkeletonParam(n.subUnitId)) == null ? void 0 : S.skeleton;
508
+ if (l == null)
509
509
  return !1;
510
- const l = d.getCellByIndex(n.row, n.col), g = l.mergeInfo.endX - l.mergeInfo.startX - 2, h = l.mergeInfo.endY - l.mergeInfo.startY - 2, f = o / s, m = Math.ceil(Math.min(g, h * f)) / o, w = !m || Number.isNaN(m) ? 1e-3 : m;
510
+ const d = l.getCellByIndex(n.row, n.col), g = d.mergeInfo.endX - d.mergeInfo.startX - 2, h = d.mergeInfo.endY - d.mergeInfo.startY - 2, f = o / s, m = Math.ceil(Math.min(g, h * f)) / o, w = !m || Number.isNaN(m) ? 1e-3 : m;
511
511
  return {
512
- width: t * w,
513
- height: e * w
512
+ width: e * w,
513
+ height: t * w
514
514
  };
515
515
  }
516
516
  let et = class extends le {
517
- constructor(n, t, e, r, s, o, a, c, u, d, l, g, h) {
517
+ constructor(n, e, t, r, s, o, a, c, u, l, d, g, h) {
518
518
  super();
519
519
  Q(this, "_workbookSelections");
520
- this._context = n, this._skeletonManagerService = t, this._commandService = e, 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._workbookSelections = g.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
520
+ this._context = n, this._skeletonManagerService = e, this._commandService = t, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = a, this._drawingManagerService = c, this._contextService = u, this._messageService = l, this._localeService = d, this._injector = h, this._workbookSelections = g.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
521
521
  }
522
522
  async insertFloatImage() {
523
523
  const n = await this._fileOpenerService.openFile({
524
524
  multiple: !0,
525
- accept: wn.map((e) => `.${e.replace("image/", "")}`).join(",")
526
- }), t = n.length;
527
- return t > _n ? (this._messageService.show({
525
+ accept: En.map((t) => `.${t.replace("image/", "")}`).join(",")
526
+ }), e = n.length;
527
+ return e > Tn ? (this._messageService.show({
528
528
  type: Re.Error,
529
- content: this._localeService.t("update-status.exceedMaxCount", String(_n))
530
- }), !1) : t === 0 ? !1 : (n.forEach(async (e) => await this.insertFloatImageByFile(e)), !0);
529
+ content: this._localeService.t("update-status.exceedMaxCount", String(Tn))
530
+ }), !1) : e === 0 ? !1 : (n.forEach(async (t) => await this.insertFloatImageByFile(t)), !0);
531
531
  }
532
532
  async insertCellImage() {
533
- const t = (await this._fileOpenerService.openFile({
533
+ const e = (await this._fileOpenerService.openFile({
534
534
  multiple: !1,
535
- accept: wn.map((e) => `.${e.replace("image/", "")}`).join(",")
535
+ accept: En.map((t) => `.${t.replace("image/", "")}`).join(",")
536
536
  }))[0];
537
- return t ? (await this._insertCellImage(t), !0) : !1;
537
+ return e ? (await this._insertCellImage(e), !0) : !1;
538
+ }
539
+ insertCellImageByFile(n, e) {
540
+ return this._insertCellImage(n, e);
538
541
  }
539
542
  async insertFloatImageByFile(n) {
540
- let t;
543
+ let e;
541
544
  try {
542
- t = await this._imageIoService.saveImage(n);
545
+ e = await this._imageIoService.saveImage(n);
543
546
  } catch (S) {
544
547
  const C = S.message;
545
- C === Be.ERROR_EXCEED_SIZE ? this._messageService.show({
548
+ C === We.ERROR_EXCEED_SIZE ? this._messageService.show({
546
549
  type: Re.Error,
547
- content: this._localeService.t("update-status.exceedMaxSize", String(vn / (1024 * 1024)))
548
- }) : C === Be.ERROR_IMAGE_TYPE ? this._messageService.show({
550
+ content: this._localeService.t("update-status.exceedMaxSize", String(On / (1024 * 1024)))
551
+ }) : C === We.ERROR_IMAGE_TYPE ? this._messageService.show({
549
552
  type: Re.Error,
550
553
  content: this._localeService.t("update-status.invalidImageType")
551
- }) : C === Be.ERROR_IMAGE && this._messageService.show({
554
+ }) : C === We.ERROR_IMAGE && this._messageService.show({
552
555
  type: Re.Error,
553
556
  content: this._localeService.t("update-status.invalidImage")
554
557
  });
555
558
  }
556
- if (t == null)
559
+ if (e == null)
557
560
  return;
558
- const e = this._getUnitInfo(), { unitId: r, subUnitId: s } = e, { imageId: o, imageSourceType: a, source: c, base64Cache: u } = t, { width: d, height: l, image: g } = await Sn(u || ""), { width: h, height: f } = this._context.scene;
561
+ const t = this._getUnitInfo(), { unitId: r, subUnitId: s } = t, { imageId: o, imageSourceType: a, source: c, base64Cache: u } = e, { width: l, height: d, image: g } = await Kt(u || ""), { width: h, height: f } = this._context.scene;
559
562
  this._imageIoService.addImageSourceCache(c, a, g);
560
563
  let p = 1;
561
- if (d > In || l > Cn) {
562
- const S = In / d, C = Cn / l;
564
+ if (l > Un || d > Pn) {
565
+ const S = Un / l, C = Pn / d;
563
566
  p = Math.max(S, C);
564
567
  }
565
- const m = this._getImagePosition(d * p, l * p, h, f);
568
+ const m = this._getImagePosition(l * p, d * p, h, f);
566
569
  if (m == null)
567
570
  return;
568
571
  const w = {
569
572
  unitId: r,
570
573
  subUnitId: s,
571
574
  drawingId: o,
572
- drawingType: L.DRAWING_IMAGE,
575
+ drawingType: x.DRAWING_IMAGE,
573
576
  imageSourceType: a,
574
577
  source: c,
575
578
  transform: z(m, this._selectionRenderService, this._skeletonManagerService),
576
579
  sheetTransform: m
577
580
  };
578
- return this._commandService.executeCommand(Ft.id, {
581
+ return this._commandService.executeCommand(Yt.id, {
579
582
  unitId: r,
580
583
  drawings: [w]
581
584
  });
582
585
  }
583
586
  // eslint-disable-next-line max-lines-per-function
584
- async _insertCellImage(n) {
587
+ async _insertCellImage(n, e) {
588
+ var w, S;
585
589
  let t;
586
590
  try {
587
591
  t = await this._imageIoService.saveImage(n);
588
- } catch (m) {
589
- const w = m.message;
590
- w === Be.ERROR_EXCEED_SIZE ? this._messageService.show({
592
+ } catch (C) {
593
+ const b = C.message;
594
+ b === We.ERROR_EXCEED_SIZE ? this._messageService.show({
591
595
  type: Re.Error,
592
- content: this._localeService.t("update-status.exceedMaxSize", String(vn / (1024 * 1024)))
593
- }) : w === Be.ERROR_IMAGE_TYPE ? this._messageService.show({
596
+ content: this._localeService.t("update-status.exceedMaxSize", String(On / (1024 * 1024)))
597
+ }) : b === We.ERROR_IMAGE_TYPE ? this._messageService.show({
594
598
  type: Re.Error,
595
599
  content: this._localeService.t("update-status.invalidImageType")
596
- }) : w === Be.ERROR_IMAGE && this._messageService.show({
600
+ }) : b === We.ERROR_IMAGE && this._messageService.show({
597
601
  type: Re.Error,
598
602
  content: this._localeService.t("update-status.invalidImage")
599
603
  });
600
604
  }
601
605
  if (t == null)
602
- return;
603
- const { imageId: e, imageSourceType: r, source: s, base64Cache: o } = t, { width: a, height: c, image: u } = await Sn(o || "");
604
- this._imageIoService.addImageSourceCache(s, r, u);
606
+ return !1;
607
+ const { imageId: r, imageSourceType: s, source: o, base64Cache: a } = t, { width: c, height: u, image: l } = await Kt(a || "");
608
+ this._imageIoService.addImageSourceCache(o, s, l);
605
609
  const d = this._workbookSelections.getCurrentLastSelection();
606
610
  if (!d)
607
611
  return !1;
608
- const l = Ar("", {}), g = pr(
612
+ const g = Sn("", {}), h = an(
609
613
  this._injector,
610
614
  {
611
615
  unitId: this._context.unitId,
@@ -613,73 +617,152 @@ let et = class extends le {
613
617
  row: d.primary.actualRow,
614
618
  col: d.primary.actualColumn
615
619
  },
616
- a,
617
620
  c,
621
+ u,
618
622
  0
619
623
  );
620
- if (!g)
624
+ if (!h)
621
625
  return !1;
622
- const h = {
626
+ const f = {
623
627
  size: {
624
- width: g.width,
625
- height: g.height
628
+ width: h.width,
629
+ height: h.height
626
630
  },
627
631
  positionH: {
628
- relativeFrom: kr.PAGE,
632
+ relativeFrom: Cn.PAGE,
629
633
  posOffset: 0
630
634
  },
631
635
  positionV: {
632
- relativeFrom: Nr.PARAGRAPH,
636
+ relativeFrom: In.PARAGRAPH,
633
637
  posOffset: 0
634
638
  },
635
639
  angle: 0
636
- }, f = {
637
- unitId: l.getUnitId(),
638
- subUnitId: l.getUnitId(),
639
- drawingId: e,
640
- drawingType: L.DRAWING_IMAGE,
641
- imageSourceType: r,
642
- source: s,
643
- transform: rs(h),
644
- docTransform: h,
645
- behindDoc: jr.FALSE,
640
+ }, p = {
641
+ unitId: g.getUnitId(),
642
+ subUnitId: g.getUnitId(),
643
+ drawingId: r,
644
+ drawingType: x.DRAWING_IMAGE,
645
+ imageSourceType: s,
646
+ source: o,
647
+ transform: Yn(f),
648
+ docTransform: f,
649
+ behindDoc: Rn.FALSE,
646
650
  title: "",
647
651
  description: "",
648
- layoutType: Wr.INLINE,
652
+ layoutType: Dn.INLINE,
649
653
  // Insert inline drawing by default.
650
- wrapText: Br.BOTH_SIDES,
654
+ wrapText: bn.BOTH_SIDES,
651
655
  distB: 0,
652
656
  distL: 0,
653
657
  distR: 0,
654
658
  distT: 0
655
- }, p = $r.drawing.add({
656
- documentDataModel: l,
657
- drawings: [f],
659
+ }, m = Mn.drawing.add({
660
+ documentDataModel: g,
661
+ drawings: [p],
658
662
  selection: {
659
663
  collapsed: !0,
660
664
  startOffset: 0,
661
665
  endOffset: 0
662
666
  }
663
667
  });
664
- return p ? (l.apply(p), this._commandService.syncExecuteCommand(xi.id, {
668
+ return m ? (g.apply(m), this._commandService.syncExecuteCommand(xn.id, {
665
669
  value: {
666
- [d.primary.actualRow]: {
667
- [d.primary.actualColumn]: {
668
- p: l.getSnapshot(),
670
+ [(w = e == null ? void 0 : e.row) != null ? w : d.primary.actualRow]: {
671
+ [(S = e == null ? void 0 : e.col) != null ? S : d.primary.actualColumn]: {
672
+ p: g.getSnapshot(),
669
673
  t: 1
670
674
  }
671
675
  }
676
+ },
677
+ unitId: e == null ? void 0 : e.unitId,
678
+ subUnitId: e == null ? void 0 : e.subUnitId
679
+ })) : !1;
680
+ }
681
+ // eslint-disable-next-line max-lines-per-function
682
+ async insertCellImageByUrl(n, e) {
683
+ var g, h;
684
+ const { width: t, height: r, image: s } = await Kt(n || "");
685
+ this._imageIoService.addImageSourceCache(n, yn.URL, s);
686
+ const o = this._workbookSelections.getCurrentLastSelection();
687
+ if (!o)
688
+ return !1;
689
+ const a = Sn("", {}), c = an(
690
+ this._injector,
691
+ {
692
+ unitId: this._context.unitId,
693
+ subUnitId: this._context.unit.getActiveSheet().getSheetId(),
694
+ row: o.primary.actualRow,
695
+ col: o.primary.actualColumn
696
+ },
697
+ t,
698
+ r,
699
+ 0
700
+ );
701
+ if (!c)
702
+ return !1;
703
+ const u = {
704
+ size: {
705
+ width: c.width,
706
+ height: c.height
707
+ },
708
+ positionH: {
709
+ relativeFrom: Cn.PAGE,
710
+ posOffset: 0
711
+ },
712
+ positionV: {
713
+ relativeFrom: In.PARAGRAPH,
714
+ posOffset: 0
715
+ },
716
+ angle: 0
717
+ }, l = {
718
+ unitId: a.getUnitId(),
719
+ subUnitId: a.getUnitId(),
720
+ drawingId: Et(),
721
+ drawingType: x.DRAWING_IMAGE,
722
+ imageSourceType: yn.URL,
723
+ source: n,
724
+ transform: Yn(u),
725
+ docTransform: u,
726
+ behindDoc: Rn.FALSE,
727
+ title: "",
728
+ description: "",
729
+ layoutType: Dn.INLINE,
730
+ // Insert inline drawing by default.
731
+ wrapText: bn.BOTH_SIDES,
732
+ distB: 0,
733
+ distL: 0,
734
+ distR: 0,
735
+ distT: 0
736
+ }, d = Mn.drawing.add({
737
+ documentDataModel: a,
738
+ drawings: [l],
739
+ selection: {
740
+ collapsed: !0,
741
+ startOffset: 0,
742
+ endOffset: 0
672
743
  }
744
+ });
745
+ return d ? (a.apply(d), this._commandService.syncExecuteCommand(xn.id, {
746
+ value: {
747
+ [(g = e == null ? void 0 : e.row) != null ? g : o.primary.actualRow]: {
748
+ [(h = e == null ? void 0 : e.col) != null ? h : o.primary.actualColumn]: {
749
+ p: a.getSnapshot(),
750
+ t: 1
751
+ }
752
+ }
753
+ },
754
+ unitId: e == null ? void 0 : e.unitId,
755
+ subUnitId: e == null ? void 0 : e.subUnitId
673
756
  })) : !1;
674
757
  }
675
758
  _getUnitInfo() {
676
- const n = this._context.unit, t = n.getActiveSheet(), e = n.getUnitId(), r = t.getSheetId();
759
+ const n = this._context.unit, e = n.getActiveSheet(), t = n.getUnitId(), r = e.getSheetId();
677
760
  return {
678
- unitId: e,
761
+ unitId: t,
679
762
  subUnitId: r
680
763
  };
681
764
  }
682
- _getImagePosition(n, t, e, r) {
765
+ _getImagePosition(n, e, t, r) {
683
766
  const s = this._workbookSelections.getCurrentSelections();
684
767
  let o = {
685
768
  startRow: 0,
@@ -688,29 +771,29 @@ let et = class extends le {
688
771
  endColumn: 0
689
772
  };
690
773
  s && s.length > 0 && (o = s[s.length - 1].range);
691
- const a = xn(this._skeletonManagerService.getCurrent().skeleton, o);
774
+ const a = Qn(this._skeletonManagerService.getCurrent().skeleton, o);
692
775
  if (a == null)
693
776
  return;
694
- let { startColumn: c, startRow: u, startX: d, startY: l } = a, g = !1;
695
- if (d + n > e && (d = e - n, d < 0 && (d = 0, n = e), g = !0), l + t > r && (l = r - t, l < 0 && (l = 0, t = r), g = !0), g) {
696
- const m = this._selectionRenderService.getCellWithCoordByOffset(d, l);
777
+ let { startColumn: c, startRow: u, startX: l, startY: d } = a, g = !1;
778
+ if (l + n > t && (l = t - n, l < 0 && (l = 0, n = t), g = !0), d + e > r && (d = r - e, d < 0 && (d = 0, e = r), g = !0), g) {
779
+ const m = this._selectionRenderService.getCellWithCoordByOffset(l, d);
697
780
  if (m == null)
698
781
  return;
699
- d = m.startX, l = m.startY, c = m.actualColumn, u = m.actualRow;
782
+ l = m.startX, d = m.startY, c = m.actualColumn, u = m.actualRow;
700
783
  }
701
784
  const h = {
702
785
  column: c,
703
786
  columnOffset: 0,
704
787
  row: u,
705
788
  rowOffset: 0
706
- }, f = this._selectionRenderService.getCellWithCoordByOffset(d + n, l + t);
789
+ }, f = this._selectionRenderService.getCellWithCoordByOffset(l + n, d + e);
707
790
  if (f == null)
708
791
  return;
709
792
  const p = {
710
793
  column: f.actualColumn,
711
- columnOffset: d + n - f.startX,
794
+ columnOffset: l + n - f.startX,
712
795
  row: f.actualRow,
713
- rowOffset: l + t - f.startY
796
+ rowOffset: d + e - f.startY
714
797
  };
715
798
  return {
716
799
  from: h,
@@ -719,10 +802,10 @@ let et = class extends le {
719
802
  }
720
803
  _updateOrderListener() {
721
804
  this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((n) => {
722
- const { unitId: t, subUnitId: e, drawingIds: r, arrangeType: s } = n;
723
- this._commandService.executeCommand(fr.id, {
724
- unitId: t,
725
- subUnitId: e,
805
+ const { unitId: e, subUnitId: t, drawingIds: r, arrangeType: s } = n;
806
+ this._commandService.executeCommand(Mr.id, {
807
+ unitId: e,
808
+ subUnitId: t,
726
809
  drawingIds: r,
727
810
  arrangeType: s
728
811
  });
@@ -730,69 +813,69 @@ let et = class extends le {
730
813
  }
731
814
  _updateImageListener() {
732
815
  this.disposeWithMe(this._drawingManagerService.featurePluginUpdate$.subscribe((n) => {
733
- const t = [];
734
- n.length !== 0 && (n.forEach((e) => {
735
- const { unitId: r, subUnitId: s, drawingId: o, drawingType: a, transform: c } = e;
816
+ const e = [];
817
+ n.length !== 0 && (n.forEach((t) => {
818
+ const { unitId: r, subUnitId: s, drawingId: o, drawingType: a, transform: c } = t;
736
819
  if (c == null)
737
820
  return;
738
821
  const u = this._sheetDrawingService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: o });
739
822
  if (u == null || u.unitId !== this._context.unitId)
740
823
  return;
741
- const d = $({ ...u.transform, ...c }, this._selectionRenderService);
742
- if (d == null)
824
+ const l = $({ ...u.transform, ...c }, this._selectionRenderService);
825
+ if (l == null)
743
826
  return;
744
- const l = {
745
- ...e,
746
- transform: { ...u.transform, ...c, ...z(d, this._selectionRenderService, this._skeletonManagerService) },
747
- sheetTransform: { ...d }
827
+ const d = {
828
+ ...t,
829
+ transform: { ...u.transform, ...c, ...z(l, this._selectionRenderService, this._skeletonManagerService) },
830
+ sheetTransform: { ...l }
748
831
  };
749
- t.push(l);
750
- }), t.length > 0 && this._commandService.executeCommand(Yt.id, {
832
+ e.push(d);
833
+ }), e.length > 0 && this._commandService.executeCommand(Gt.id, {
751
834
  unitId: n[0].unitId,
752
- drawings: t
835
+ drawings: e
753
836
  }));
754
837
  }));
755
838
  }
756
839
  _groupDrawingListener() {
757
840
  this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((n) => {
758
- this._commandService.executeCommand(gr.id, n);
759
- const { unitId: t, subUnitId: e, drawingId: r } = n[0].parent;
760
- this._commandService.syncExecuteCommand(xt.id, [{ unitId: t, subUnitId: e, drawingId: r }]);
841
+ this._commandService.executeCommand(Rr.id, n);
842
+ const { unitId: e, subUnitId: t, drawingId: r } = n[0].parent;
843
+ this._commandService.syncExecuteCommand(Lt.id, [{ unitId: e, subUnitId: t, drawingId: r }]);
761
844
  })), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((n) => {
762
- this._commandService.executeCommand(mr.id, n);
845
+ this._commandService.executeCommand(yr.id, n);
763
846
  }));
764
847
  }
765
848
  _focusDrawingListener() {
766
849
  this.disposeWithMe(
767
850
  this._drawingManagerService.focus$.subscribe((n) => {
768
- n == null || n.length === 0 ? (this._contextService.setContextValue(Le, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(Le, !0), this._sheetDrawingService.focusDrawing(n));
851
+ n == null || n.length === 0 ? (this._contextService.setContextValue(Fe, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(Fe, !0), this._sheetDrawingService.focusDrawing(n));
769
852
  })
770
853
  );
771
854
  }
772
855
  };
773
- et = vs([
856
+ et = Cs([
774
857
  ie(1, N(V)),
775
858
  ie(2, G),
776
859
  ie(3, Xe),
777
- ie(4, Wn),
778
- ie(5, Oi),
860
+ ie(4, Kn),
861
+ ie(5, ki),
779
862
  ie(6, ae),
780
863
  ie(7, oe),
781
- ie(8, Bn),
782
- ie(9, Ui),
783
- ie(10, N($t)),
784
- ie(11, N(dn)),
864
+ ie(8, zn),
865
+ ie(9, Bi),
866
+ ie(10, N(xt)),
867
+ ie(11, N(hn)),
785
868
  ie(12, N(tt))
786
869
  ], et);
787
- var Is = Object.getOwnPropertyDescriptor, Cs = (i, n, t, e) => {
788
- for (var r = e > 1 ? void 0 : e ? Is(n, t) : n, s = i.length - 1, o; s >= 0; s--)
870
+ var Ds = Object.getOwnPropertyDescriptor, Rs = (i, n, e, t) => {
871
+ for (var r = t > 1 ? void 0 : t ? Ds(n, e) : n, s = i.length - 1, o; s >= 0; s--)
789
872
  (o = i[s]) && (r = o(r) || r);
790
873
  return r;
791
- }, De = (i, n) => (t, e) => n(t, e, i);
792
- function on(i, n, t) {
793
- var e, r, s, o;
794
- if (((r = (e = t == null ? void 0 : t.p) == null ? void 0 : e.body) == null ? void 0 : r.dataStream.length) === 3 && ((o = (s = t.p) == null ? void 0 : s.drawingsOrder) == null ? void 0 : o.length) === 1) {
795
- const a = t.p.drawings[t.p.drawingsOrder[0]], c = pr(
874
+ }, Me = (i, n) => (e, t) => n(e, t, i);
875
+ function cn(i, n, e) {
876
+ var t, r, s, o;
877
+ if (((r = (t = e == null ? void 0 : e.p) == null ? void 0 : t.body) == null ? void 0 : r.dataStream.length) === 3 && ((o = (s = e.p) == null ? void 0 : s.drawingsOrder) == null ? void 0 : o.length) === 1) {
878
+ const a = e.p.drawings[e.p.drawingsOrder[0]], c = an(
796
879
  i,
797
880
  {
798
881
  unitId: n.unitId,
@@ -805,46 +888,59 @@ function on(i, n, t) {
805
888
  a.docTransform.angle
806
889
  );
807
890
  if (c)
808
- return a.transform.width = c.width, a.transform.height = c.height, a.docTransform.size.width = c.width, a.docTransform.size.height = c.height, a.transform.left = 0, a.transform.top = 0, a.docTransform.positionH.posOffset = 0, a.docTransform.positionV.posOffset = 0, t.p.documentStyle.pageSize.width = 1 / 0, t.p.documentStyle.pageSize.height = 1 / 0, !0;
891
+ return a.transform.width = c.width, a.transform.height = c.height, a.docTransform.size.width = c.width, a.docTransform.size.height = c.height, a.transform.left = 0, a.transform.top = 0, a.docTransform.positionH.posOffset = 0, a.docTransform.positionV.posOffset = 0, e.p.documentStyle.pageSize.width = 1 / 0, e.p.documentStyle.pageSize.height = 1 / 0, !0;
809
892
  }
810
893
  return !1;
811
894
  }
812
- let Ot = class extends le {
813
- constructor(i, n, t, e, r, s, o) {
814
- super(), this._commandService = i, this._sheetInterceptorService = n, this._univerInstanceService = t, this._injector = e, this._drawingManagerService = r, this._docDrawingController = s, this._editorBridgeService = o, this._initHandleResize(), this._handleInitEditor(), this._handleWriteCell(), this._initCellContentInterceptor();
895
+ let Ut = class extends le {
896
+ constructor(i, n, e, t, r, s, o) {
897
+ super(), this._commandService = i, this._sheetInterceptorService = n, this._univerInstanceService = e, this._injector = t, this._drawingManagerService = r, this._docDrawingController = s, this._editorBridgeService = o, this._initHandleResize(), this._handleInitEditor(), this._handleWriteCell(), this._initCellContentInterceptor(), this._initDisableEdit();
898
+ }
899
+ _initDisableEdit() {
900
+ this.disposeWithMe(this._commandService.beforeCommandExecuted((i) => {
901
+ var n, e, t;
902
+ if (i.id === bi.id) {
903
+ const r = i.params, { visible: s, eventType: o } = r;
904
+ if (s && o === _i.Dblclick) {
905
+ const a = this._editorBridgeService.getEditCellState();
906
+ if (((t = (e = (n = a == null ? void 0 : a.documentLayoutObject.documentModel) == null ? void 0 : n.getDrawingsOrder()) == null ? void 0 : e.length) != null ? t : 0) > 0)
907
+ throw new Error("Can not edit when there are drawings.");
908
+ }
909
+ }
910
+ }));
815
911
  }
816
912
  _initHandleResize() {
817
913
  this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
818
- let n, t = [];
819
- if (i.id === Fn.id) {
820
- const e = i.params;
821
- t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
822
- } else if (i.id === Yn.id) {
823
- const e = i.params;
824
- t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
825
- } else if (i.id === Li.id) {
826
- const e = i.params;
827
- t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
828
- } else if (i.id === Gn.id) {
829
- const e = i.params;
830
- n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId }), t = e.rowsAutoHeightInfo.map((r) => ({
914
+ let n, e = [];
915
+ if (i.id === er.id) {
916
+ const t = i.params;
917
+ e = t.ranges, n = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
918
+ } else if (i.id === tr.id) {
919
+ const t = i.params;
920
+ e = t.ranges, n = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
921
+ } else if (i.id === Xi.id) {
922
+ const t = i.params;
923
+ e = t.ranges, n = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
924
+ } else if (i.id === nr.id) {
925
+ const t = i.params;
926
+ n = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId }), e = t.rowsAutoHeightInfo.map((r) => ({
831
927
  startRow: r.row,
832
928
  endRow: r.row,
833
929
  startColumn: 0,
834
930
  endColumn: 9999
835
931
  }));
836
- } else if (i.id === Fi.id) {
837
- const e = i.params;
838
- t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
839
- } else if (i.id === Yi.id) {
840
- const e = i.params;
841
- t = e.ranges, n = H(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId });
932
+ } else if (i.id === Vi.id) {
933
+ const t = i.params;
934
+ e = t.ranges, n = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
935
+ } else if (i.id === Hi.id) {
936
+ const t = i.params;
937
+ e = t.ranges, n = H(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
842
938
  }
843
- n && t.length && t.forEach((e) => {
844
- const r = xr.transformRange(e, n.worksheet);
939
+ n && e.length && e.forEach((t) => {
940
+ const r = Yr.transformRange(t, n.worksheet);
845
941
  for (let s = r.startRow; s <= r.endRow; s++)
846
942
  for (let o = r.startColumn; o <= r.endColumn; o++)
847
- on(this._injector, { unitId: n.unitId, subUnitId: n.subUnitId, row: s, col: o }, n.worksheet.getCellRaw(s, o));
943
+ cn(this._injector, { unitId: n.unitId, subUnitId: n.subUnitId, row: s, col: o }, n.worksheet.getCellRaw(s, o));
848
944
  });
849
945
  }));
850
946
  }
@@ -852,46 +948,46 @@ let Ot = class extends le {
852
948
  this.disposeWithMe(this._editorBridgeService.visible$.subscribe((i) => {
853
949
  i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(pt), this._docDrawingController.loadDrawingDataForUnit(pt), this._drawingManagerService.initializeNotification(pt)) : this._drawingManagerService.removeDrawingDataForUnit(pt);
854
950
  })), this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
855
- i.id === is.id && i.params.unitId === wt && (this._drawingManagerService.removeDrawingDataForUnit(wt), this._docDrawingController.loadDrawingDataForUnit(wt), this._drawingManagerService.initializeNotification(wt));
951
+ i.id === as.id && i.params.unitId === wt && (this._drawingManagerService.removeDrawingDataForUnit(wt), this._docDrawingController.loadDrawingDataForUnit(wt), this._drawingManagerService.initializeNotification(wt));
856
952
  }));
857
953
  }
858
954
  _handleWriteCell() {
859
- this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(Gi, {
955
+ this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(zi, {
860
956
  priority: 9999,
861
- handler: (i, n, t) => (on(this._injector, { unitId: n.unitId, subUnitId: n.subUnitId, row: n.row, col: n.col }, i), t(i))
957
+ handler: (i, n, e) => (cn(this._injector, { unitId: n.unitId, subUnitId: n.subUnitId, row: n.row, col: n.col }, i), e(i))
862
958
  }));
863
959
  }
864
960
  _initCellContentInterceptor() {
865
961
  this.disposeWithMe(
866
962
  this._sheetInterceptorService.intercept(
867
- Xi.CELL_CONTENT,
963
+ Ki.CELL_CONTENT,
868
964
  {
869
- effect: Lr.Style,
870
- priority: Vi.CELL_IMAGE,
871
- handler: (i, n, t) => {
872
- var e;
873
- return i != null && i.p && ((e = i.p.drawingsOrder) != null && e.length) && (i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }), t(i);
965
+ effect: Gr.Style,
966
+ priority: Zi.CELL_IMAGE,
967
+ handler: (i, n, e) => {
968
+ var t;
969
+ return i != null && i.p && ((t = i.p.drawingsOrder) != null && t.length) && (i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }), e(i);
874
970
  }
875
971
  }
876
972
  )
877
973
  );
878
974
  }
879
975
  };
880
- Ot = Cs([
881
- De(0, G),
882
- De(1, N(Lt)),
883
- De(2, Ge),
884
- De(3, N(tt)),
885
- De(4, oe),
886
- De(5, N(ri)),
887
- De(6, N(_i))
888
- ], Ot);
889
- var bs = Object.getOwnPropertyDescriptor, Rs = (i, n, t, e) => {
890
- for (var r = e > 1 ? void 0 : e ? bs(n, t) : n, s = i.length - 1, o; s >= 0; s--)
976
+ Ut = Rs([
977
+ Me(0, G),
978
+ Me(1, N(Ft)),
979
+ Me(2, Ce),
980
+ Me(3, N(tt)),
981
+ Me(4, oe),
982
+ Me(5, N(oi)),
983
+ Me(6, N(Ci))
984
+ ], Ut);
985
+ var Ms = Object.getOwnPropertyDescriptor, ys = (i, n, e, t) => {
986
+ for (var r = t > 1 ? void 0 : t ? Ms(n, e) : n, s = i.length - 1, o; s >= 0; s--)
891
987
  (o = i[s]) && (r = o(r) || r);
892
988
  return r;
893
- }, An = (i, n) => (t, e) => n(t, e, i);
894
- let Ut = class extends le {
989
+ }, Xn = (i, n) => (e, t) => n(e, t, i);
990
+ let Pt = class extends le {
895
991
  constructor(i, n) {
896
992
  super(), this._autoFillService = i, this._injector = n, this._initAutoFillHooks();
897
993
  }
@@ -899,103 +995,112 @@ let Ut = class extends le {
899
995
  this.disposeWithMe(
900
996
  this._autoFillService.addHook({
901
997
  id: "sheet-cell-image-autofill",
902
- onBeforeSubmit: (i, n, t, e) => {
903
- new Fr(e).forValue((r, s, o) => {
904
- on(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
998
+ onBeforeSubmit: (i, n, e, t) => {
999
+ new Xr(t).forValue((r, s, o) => {
1000
+ cn(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
905
1001
  });
906
1002
  }
907
1003
  })
908
1004
  );
909
1005
  }
910
1006
  };
911
- Ut = Rs([
912
- An(0, N(vi)),
913
- An(1, N(tt))
914
- ], Ut);
915
- var Ds = Object.getOwnPropertyDescriptor, Ms = (i, n, t, e) => {
916
- for (var r = e > 1 ? void 0 : e ? Ds(n, t) : n, s = i.length - 1, o; s >= 0; s--)
1007
+ Pt = ys([
1008
+ Xn(0, N(Di)),
1009
+ Xn(1, N(tt))
1010
+ ], Pt);
1011
+ var Es = Object.getOwnPropertyDescriptor, Ts = (i, n, e, t) => {
1012
+ for (var r = t > 1 ? void 0 : t ? Es(n, e) : n, s = i.length - 1, o; s >= 0; s--)
917
1013
  (o = i[s]) && (r = o(r) || r);
918
1014
  return r;
919
- }, bt = (i, n) => (t, e) => n(t, e, i);
920
- let Pt = class extends le {
921
- constructor(n, t, e, r) {
1015
+ }, Dt = (i, n) => (e, t) => n(e, t, i);
1016
+ let At = class extends le {
1017
+ constructor(n, e, t, r) {
922
1018
  super();
923
1019
  Q(this, "_isSetCursor", !1);
924
- this._hoverManagerService = n, this._renderManagerService = t, this._selectionsService = e, this._drawingRenderService = r;
1020
+ this._hoverManagerService = n, this._renderManagerService = e, this._selectionsService = t, this._drawingRenderService = r;
925
1021
  }
926
1022
  _initHover() {
927
1023
  }
928
1024
  _initImageClick() {
929
1025
  }
930
1026
  };
931
- Pt = Ms([
932
- bt(0, N(Si)),
933
- bt(1, N(ne)),
934
- bt(2, N(dn)),
935
- bt(3, N(jn))
936
- ], Pt);
937
- const Gt = {
1027
+ At = Ts([
1028
+ Dt(0, N(Ri)),
1029
+ Dt(1, N(ne)),
1030
+ Dt(2, N(hn)),
1031
+ Dt(3, N(Zn))
1032
+ ], At);
1033
+ const Xt = {
938
1034
  id: "sheet.command.insert-float-image",
939
1035
  type: te.COMMAND,
940
1036
  handler: async (i, n) => {
941
- var s, o;
942
- const e = (s = i.get(ne).getCurrentTypeOfRenderer(F.UNIVER_SHEET)) == null ? void 0 : s.with(et);
943
- if (!e)
1037
+ var o, a;
1038
+ const e = i.get(Ce), t = i.get(ne), r = (o = Jn(
1039
+ F.UNIVER_SHEET,
1040
+ e,
1041
+ t
1042
+ )) == null ? void 0 : o.with(et);
1043
+ if (!r)
944
1044
  return !1;
945
- const r = n == null ? void 0 : n.files;
946
- if (r) {
947
- const a = r.map((c) => e.insertFloatImageByFile(c));
948
- return (await Promise.all(a)).every((c) => c);
1045
+ const s = n == null ? void 0 : n.files;
1046
+ if (s) {
1047
+ const c = s.map((u) => r.insertFloatImageByFile(u));
1048
+ return (await Promise.all(c)).every((u) => u);
949
1049
  } else
950
- return (o = e.insertFloatImage()) != null ? o : !1;
1050
+ return (a = r.insertFloatImage()) != null ? a : !1;
951
1051
  }
952
- }, un = {
1052
+ }, fn = {
953
1053
  id: "sheet.command.insert-cell-image",
954
1054
  type: te.COMMAND,
955
1055
  handler: (i) => {
956
- var t, e;
957
- return (e = (t = i.get(ne).getCurrentTypeOfRenderer(F.UNIVER_SHEET)) == null ? void 0 : t.with(et).insertCellImage()) != null ? e : !1;
1056
+ var t, r;
1057
+ const n = i.get(Ce), e = i.get(ne);
1058
+ return (r = (t = Jn(
1059
+ F.UNIVER_SHEET,
1060
+ n,
1061
+ e
1062
+ )) == null ? void 0 : t.with(et).insertCellImage()) != null ? r : !1;
958
1063
  }
959
1064
  };
960
- var ys = Object.getOwnPropertyDescriptor, Ts = (i, n, t, e) => {
961
- for (var r = e > 1 ? void 0 : e ? ys(n, t) : n, s = i.length - 1, o; s >= 0; s--)
1065
+ var Os = Object.getOwnPropertyDescriptor, Us = (i, n, e, t) => {
1066
+ for (var r = t > 1 ? void 0 : t ? Os(n, e) : n, s = i.length - 1, o; s >= 0; s--)
962
1067
  (o = i[s]) && (r = o(r) || r);
963
1068
  return r;
964
- }, Je = (i, n) => (t, e) => n(t, e, i);
965
- const wr = "image/png";
966
- function Es(i) {
967
- const n = i.split(","), t = atob(n[1]), e = t.length, r = new Uint8Array(e);
968
- for (let s = 0; s < e; s++)
969
- r[s] = t.charCodeAt(s);
970
- return new Blob([r], { type: wr });
1069
+ }, Je = (i, n) => (e, t) => n(e, t, i);
1070
+ const Er = "image/png";
1071
+ function Ps(i) {
1072
+ const n = i.split(","), e = atob(n[1]), t = e.length, r = new Uint8Array(t);
1073
+ for (let s = 0; s < t; s++)
1074
+ r[s] = e.charCodeAt(s);
1075
+ return new Blob([r], { type: Er });
971
1076
  }
972
- function Os(i) {
973
- const n = new ClipboardItem({ [wr]: Es(i) });
974
- navigator.clipboard.write([n]).catch((t) => {
975
- console.error("Could not copy image using clipboard API: ", t);
1077
+ function As(i) {
1078
+ const n = new ClipboardItem({ [Er]: Ps(i) });
1079
+ navigator.clipboard.write([n]).catch((e) => {
1080
+ console.error("Could not copy image using clipboard API: ", e);
976
1081
  });
977
1082
  }
978
- function Us() {
1083
+ function Ns() {
979
1084
  function i() {
980
- const e = document.createElement("input");
981
- return e.style.position = "absolute", e.style.height = "1px", e.style.width = "1px", e.style.opacity = "0", e;
1085
+ const t = document.createElement("input");
1086
+ return t.style.position = "absolute", t.style.height = "1px", t.style.width = "1px", t.style.opacity = "0", t;
982
1087
  }
983
- const n = document.activeElement, t = i();
984
- return document.body.appendChild(t), t.focus(), () => {
985
- t.blur(), document.body.removeChild(t), n instanceof HTMLElement && n.focus();
1088
+ const n = document.activeElement, e = i();
1089
+ return document.body.appendChild(e), e.focus(), () => {
1090
+ e.blur(), document.body.removeChild(e), n instanceof HTMLElement && n.focus();
986
1091
  };
987
1092
  }
988
- const Nn = [
989
- xe.SPECIAL_PASTE_COL_WIDTH,
990
- xe.SPECIAL_PASTE_VALUE,
991
- xe.SPECIAL_PASTE_FORMAT,
992
- xe.SPECIAL_PASTE_FORMULA
1093
+ const Vn = [
1094
+ Le.SPECIAL_PASTE_COL_WIDTH,
1095
+ Le.SPECIAL_PASTE_VALUE,
1096
+ Le.SPECIAL_PASTE_FORMAT,
1097
+ Le.SPECIAL_PASTE_FORMULA
993
1098
  ];
994
- let At = class extends le {
995
- constructor(n, t, e, r, s) {
1099
+ let Nt = class extends le {
1100
+ constructor(n, e, t, r, s) {
996
1101
  super();
997
1102
  Q(this, "_copyInfo");
998
- this._sheetClipboardService = n, this._renderManagerService = t, this._drawingService = e, this._clipboardInterfaceService = r, this._commandService = s, this._initCopyPaste();
1103
+ this._sheetClipboardService = n, this._renderManagerService = e, this._drawingService = t, this._clipboardInterfaceService = r, this._commandService = s, this._initCopyPaste();
999
1104
  }
1000
1105
  get _focusedDrawings() {
1001
1106
  return this._drawingService.getFocusDrawings();
@@ -1004,11 +1109,11 @@ let At = class extends le {
1004
1109
  _initCopyPaste() {
1005
1110
  this._sheetClipboardService.addClipboardHook({
1006
1111
  id: "SHEET_IMAGE_UI_PLUGIN",
1007
- onBeforeCopy: (n, t, e, r) => {
1112
+ onBeforeCopy: (n, e, t, r) => {
1008
1113
  const s = this._focusedDrawings;
1009
1114
  if (s.length > 0) {
1010
1115
  const [o] = s;
1011
- if (r === be.CUT) {
1116
+ if (r === De.CUT) {
1012
1117
  const c = {
1013
1118
  unitId: n,
1014
1119
  drawings: [o]
@@ -1016,8 +1121,8 @@ let At = class extends le {
1016
1121
  this._commandService.executeCommand(nt.id, c);
1017
1122
  }
1018
1123
  setTimeout(() => {
1019
- const c = Us();
1020
- o.drawingType === L.DRAWING_IMAGE && o.imageSourceType === si.BASE64 ? Os(o.source) : this._clipboardInterfaceService.writeText(""), c();
1124
+ const c = Ns();
1125
+ o.drawingType === x.DRAWING_IMAGE && o.imageSourceType === ci.BASE64 ? As(o.source) : this._clipboardInterfaceService.writeText(""), c();
1021
1126
  }, 200);
1022
1127
  const a = {
1023
1128
  unitId: o.unitId,
@@ -1026,30 +1131,30 @@ let At = class extends le {
1026
1131
  };
1027
1132
  this._copyInfo = a;
1028
1133
  } else {
1029
- const o = this._createDrawingsCopyInfoByRange(n, t, e);
1134
+ const o = this._createDrawingsCopyInfoByRange(n, e, t);
1030
1135
  this._copyInfo = o;
1031
1136
  }
1032
1137
  },
1033
- onPasteCells: (n, t, e, r) => {
1138
+ onPasteCells: (n, e, t, r) => {
1034
1139
  if (!this._copyInfo)
1035
1140
  return { redos: [], undos: [] };
1036
- const { copyType: s = be.COPY, pasteType: o } = r, { range: a } = n || {}, { range: c, unitId: u, subUnitId: d } = t;
1037
- return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: d, pasteRange: c }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: o }, be.COPY);
1141
+ const { copyType: s = De.COPY, pasteType: o } = r, { range: a } = n || {}, { range: c, unitId: u, subUnitId: l } = e;
1142
+ return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: l, pasteRange: c }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo: e, pasteType: o }, De.COPY);
1038
1143
  },
1039
- onPastePlainText: (n, t) => ({ undos: [], redos: [] }),
1040
- onPasteUnrecognized: (n) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: n, pasteType: xe.DEFAULT_PASTE }, be.COPY) : { undos: [], redos: [] },
1041
- onPasteFiles: (n, t) => {
1144
+ onPastePlainText: (n, e) => ({ undos: [], redos: [] }),
1145
+ onPasteUnrecognized: (n) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: n, pasteType: Le.DEFAULT_PASTE }, De.COPY) : { undos: [], redos: [] },
1146
+ onPasteFiles: (n, e) => {
1042
1147
  if (this._copyInfo)
1043
- return this._generateSingleDrawingPasteMutations({ pasteTo: n, pasteType: xe.DEFAULT_PASTE }, be.COPY);
1148
+ return this._generateSingleDrawingPasteMutations({ pasteTo: n, pasteType: Le.DEFAULT_PASTE }, De.COPY);
1044
1149
  {
1045
- const e = t.filter((r) => r.type.includes("image"));
1046
- if (e.length)
1150
+ const t = e.filter((r) => r.type.includes("image"));
1151
+ if (t.length)
1047
1152
  return {
1048
1153
  undos: [],
1049
1154
  redos: [
1050
1155
  {
1051
- id: Gt.id,
1052
- params: { files: e }
1156
+ id: Xt.id,
1157
+ params: { files: t }
1053
1158
  }
1054
1159
  ]
1055
1160
  };
@@ -1058,45 +1163,45 @@ let At = class extends le {
1058
1163
  }
1059
1164
  });
1060
1165
  }
1061
- _createDrawingsCopyInfoByRange(n, t, e) {
1166
+ _createDrawingsCopyInfoByRange(n, e, t) {
1062
1167
  var g;
1063
1168
  const r = (g = this._renderManagerService.getRenderById(n)) == null ? void 0 : g.with(V);
1064
1169
  if (!r) return;
1065
- const s = r.attachRangeWithCoord(e);
1170
+ const s = r.attachRangeWithCoord(t);
1066
1171
  if (!s)
1067
1172
  return;
1068
- const { startX: o, endX: a, startY: c, endY: u } = s, d = this._drawingService.getDrawingData(n, t), l = this._focusedDrawings.slice();
1069
- if (Object.keys(d).forEach((h) => {
1070
- const f = d[h], { transform: p } = f;
1173
+ const { startX: o, endX: a, startY: c, endY: u } = s, l = this._drawingService.getDrawingData(n, e), d = this._focusedDrawings.slice();
1174
+ if (Object.keys(l).forEach((h) => {
1175
+ const f = l[h], { transform: p } = f;
1071
1176
  if (f.anchorType !== U.Both || !p)
1072
1177
  return;
1073
- const { left: m = 0, top: w = 0, width: S = 0, height: C = 0 } = p, { drawingStartX: D, drawingEndX: v, drawingStartY: b, drawingEndY: _ } = {
1178
+ const { left: m = 0, top: w = 0, width: S = 0, height: C = 0 } = p, { drawingStartX: b, drawingEndX: v, drawingStartY: D, drawingEndY: _ } = {
1074
1179
  drawingStartX: m,
1075
1180
  drawingEndX: m + S,
1076
1181
  drawingStartY: w,
1077
1182
  drawingEndY: w + C
1078
1183
  };
1079
- o <= D && v <= a && c <= b && _ <= u && l.push(f);
1080
- }), l.length)
1184
+ o <= b && v <= a && c <= D && _ <= u && d.push(f);
1185
+ }), d.length)
1081
1186
  return {
1082
- copyRange: e,
1083
- drawings: l,
1187
+ copyRange: t,
1188
+ drawings: d,
1084
1189
  unitId: n,
1085
- subUnitId: t
1190
+ subUnitId: e
1086
1191
  };
1087
1192
  }
1088
- _generateSingleDrawingPasteMutations(n, t) {
1089
- const { pasteType: e, pasteTo: r } = n;
1090
- if (Nn.includes(e))
1193
+ _generateSingleDrawingPasteMutations(n, e) {
1194
+ const { pasteType: t, pasteTo: r } = n;
1195
+ if (Vn.includes(t))
1091
1196
  return { redos: [], undos: [] };
1092
- const { unitId: s, subUnitId: o, range: a } = r, c = this._renderManagerService.getRenderById(s), u = c == null ? void 0 : c.with(V), d = c == null ? void 0 : c.with(Xe), l = this._copyInfo;
1093
- if (!u || !d)
1197
+ const { unitId: s, subUnitId: o, range: a } = r, c = this._renderManagerService.getRenderById(s), u = c == null ? void 0 : c.with(V), l = c == null ? void 0 : c.with(Xe), d = this._copyInfo;
1198
+ if (!u || !l)
1094
1199
  return { redos: [], undos: [] };
1095
- const { drawings: g } = l, h = Rn(a);
1200
+ const { drawings: g } = d, h = Nn(a);
1096
1201
  return this._generateMutations(g, {
1097
1202
  unitId: s,
1098
1203
  subUnitId: o,
1099
- isCut: t === be.CUT,
1204
+ isCut: e === De.CUT,
1100
1205
  getTransform: (f, p) => {
1101
1206
  var S;
1102
1207
  const m = u.attachRangeWithCoord({
@@ -1111,27 +1216,27 @@ let At = class extends le {
1111
1216
  };
1112
1217
  return {
1113
1218
  transform: w,
1114
- sheetTransform: (S = $(w, d)) != null ? S : p
1219
+ sheetTransform: (S = $(w, l)) != null ? S : p
1115
1220
  };
1116
1221
  }
1117
1222
  });
1118
1223
  }
1119
- _generateMutations(n, t) {
1224
+ _generateMutations(n, e) {
1120
1225
  const {
1121
- unitId: e,
1226
+ unitId: t,
1122
1227
  subUnitId: r,
1123
1228
  getTransform: s,
1124
1229
  isCut: o
1125
- } = t, a = [], c = [], { _drawingService: u } = this;
1126
- return n.forEach((d) => {
1127
- const { transform: l, sheetTransform: g } = d;
1128
- if (!l)
1230
+ } = e, a = [], c = [], { _drawingService: u } = this;
1231
+ return n.forEach((l) => {
1232
+ const { transform: d, sheetTransform: g } = l;
1233
+ if (!d)
1129
1234
  return;
1130
- const h = s(l, g), f = {
1131
- ...d,
1132
- unitId: e,
1235
+ const h = s(d, g), f = {
1236
+ ...l,
1237
+ unitId: t,
1133
1238
  subUnitId: r,
1134
- drawingId: o ? d.drawingId : ye.generateRandomId(),
1239
+ drawingId: o ? l.drawingId : Ee.generateRandomId(),
1135
1240
  transform: h.transform,
1136
1241
  sheetTransform: h.sheetTransform
1137
1242
  };
@@ -1140,7 +1245,7 @@ let At = class extends le {
1140
1245
  a.push({
1141
1246
  id: A.id,
1142
1247
  params: {
1143
- unitId: e,
1248
+ unitId: t,
1144
1249
  subUnitId: r,
1145
1250
  type: P.UPDATE,
1146
1251
  op: m,
@@ -1149,7 +1254,7 @@ let At = class extends le {
1149
1254
  }), c.push({
1150
1255
  id: A.id,
1151
1256
  params: {
1152
- unitId: e,
1257
+ unitId: t,
1153
1258
  subUnitId: r,
1154
1259
  type: P.UPDATE,
1155
1260
  op: p,
@@ -1158,34 +1263,34 @@ let At = class extends le {
1158
1263
  });
1159
1264
  } else {
1160
1265
  const { undo: p, redo: m, objects: w } = u.getBatchAddOp([f]);
1161
- a.push({ id: A.id, params: { op: m, unitId: e, subUnitId: r, objects: w, type: P.INSERT } }), c.push({ id: A.id, params: { op: p, unitId: e, subUnitId: r, objects: w, type: P.REMOVE } });
1266
+ a.push({ id: A.id, params: { op: m, unitId: t, subUnitId: r, objects: w, type: P.INSERT } }), c.push({ id: A.id, params: { op: p, unitId: t, subUnitId: r, objects: w, type: P.REMOVE } });
1162
1267
  }
1163
1268
  }), { redos: a, undos: c };
1164
1269
  }
1165
1270
  // eslint-disable-next-line max-lines-per-function
1166
- _generateRangeDrawingsPasteMutations(n, t) {
1167
- var E;
1271
+ _generateRangeDrawingsPasteMutations(n, e) {
1272
+ var T;
1168
1273
  const {
1169
- unitId: e,
1274
+ unitId: t,
1170
1275
  subUnitId: r,
1171
1276
  pasteType: s,
1172
1277
  pasteRange: o
1173
1278
  } = n, {
1174
1279
  copyRange: a,
1175
1280
  copyType: c
1176
- } = t;
1177
- if (Nn.includes(s))
1281
+ } = e;
1282
+ if (Vn.includes(s))
1178
1283
  return { redos: [], undos: [] };
1179
- const u = (E = this._renderManagerService.getRenderById(e)) == null ? void 0 : E.with(V);
1284
+ const u = (T = this._renderManagerService.getRenderById(t)) == null ? void 0 : T.with(V);
1180
1285
  if (!u || !this._copyInfo)
1181
1286
  return { redos: [], undos: [] };
1182
- const { drawings: d } = this._copyInfo;
1287
+ const { drawings: l } = this._copyInfo;
1183
1288
  if (!a)
1184
1289
  return this._generateSingleDrawingPasteMutations({
1185
- pasteTo: { unitId: e, subUnitId: r, range: Rn(o) },
1290
+ pasteTo: { unitId: t, subUnitId: r, range: Nn(o) },
1186
1291
  pasteType: s
1187
1292
  }, c);
1188
- const { ranges: [l, g], mapFunc: h } = Ii([a, o]), { row: f, col: p } = h(l.startRow, l.startColumn), { row: m, col: w } = h(g.startRow, g.startColumn), S = u.attachRangeWithCoord({
1293
+ const { ranges: [d, g], mapFunc: h } = Mi([a, o]), { row: f, col: p } = h(d.startRow, d.startColumn), { row: m, col: w } = h(g.startRow, g.startColumn), S = u.attachRangeWithCoord({
1189
1294
  startRow: f,
1190
1295
  endRow: f,
1191
1296
  startColumn: p,
@@ -1198,68 +1303,68 @@ let At = class extends le {
1198
1303
  });
1199
1304
  if (!S || !C || !this._copyInfo)
1200
1305
  return { redos: [], undos: [] };
1201
- const D = C.startX - S.startX, v = C.startY - S.startY, b = m - f, _ = w - p;
1202
- return this._generateMutations(d, {
1203
- unitId: e,
1306
+ const b = C.startX - S.startX, v = C.startY - S.startY, D = m - f, _ = w - p;
1307
+ return this._generateMutations(l, {
1308
+ unitId: t,
1204
1309
  subUnitId: r,
1205
1310
  getTransform: (M, y) => {
1206
- var T, I;
1311
+ var E, I;
1207
1312
  return {
1208
1313
  transform: {
1209
1314
  ...M,
1210
- left: ((T = M == null ? void 0 : M.left) != null ? T : 0) + D,
1315
+ left: ((E = M == null ? void 0 : M.left) != null ? E : 0) + b,
1211
1316
  top: ((I = M == null ? void 0 : M.top) != null ? I : 0) + v
1212
1317
  },
1213
1318
  sheetTransform: {
1214
1319
  ...y,
1215
1320
  to: {
1216
1321
  ...y.to,
1217
- row: y.to.row + b,
1322
+ row: y.to.row + D,
1218
1323
  column: y.to.column + _
1219
1324
  },
1220
1325
  from: {
1221
1326
  ...y.from,
1222
- row: y.from.row + b,
1327
+ row: y.from.row + D,
1223
1328
  column: y.from.column + _
1224
1329
  }
1225
1330
  }
1226
1331
  };
1227
1332
  },
1228
- isCut: c === be.CUT
1333
+ isCut: c === De.CUT
1229
1334
  });
1230
1335
  }
1231
1336
  };
1232
- At = Ts([
1233
- Je(0, Ci),
1337
+ Nt = Us([
1338
+ Je(0, yi),
1234
1339
  Je(1, ne),
1235
1340
  Je(2, oe),
1236
- Je(3, Pi),
1341
+ Je(3, Wi),
1237
1342
  Je(4, G)
1238
- ], At);
1239
- var Ps = Object.getOwnPropertyDescriptor, As = (i, n, t, e) => {
1240
- for (var r = e > 1 ? void 0 : e ? Ps(n, t) : n, s = i.length - 1, o; s >= 0; s--)
1343
+ ], Nt);
1344
+ var ks = Object.getOwnPropertyDescriptor, Bs = (i, n, e, t) => {
1345
+ for (var r = t > 1 ? void 0 : t ? ks(n, e) : n, s = i.length - 1, o; s >= 0; s--)
1241
1346
  (o = i[s]) && (r = o(r) || r);
1242
1347
  return r;
1243
- }, qe = (i, n) => (t, e) => n(t, e, i);
1244
- let Nt = class extends le {
1245
- constructor(i, n, t, e, r) {
1246
- super(), this._drawingManagerService = i, this._renderManagerService = n, this._permissionService = t, this._univerInstanceService = e, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
1348
+ }, qe = (i, n) => (e, t) => n(e, t, i);
1349
+ let kt = class extends le {
1350
+ constructor(i, n, e, t, r) {
1351
+ super(), this._drawingManagerService = i, this._renderManagerService = n, this._permissionService = e, this._univerInstanceService = t, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
1247
1352
  }
1248
1353
  _initDrawingVisible() {
1249
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$, t = St([i, n]);
1354
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$, e = St([i, n]);
1250
1355
  this.disposeWithMe(
1251
- t.pipe(
1252
- Se(([e, r]) => e ? e.activeSheet$.pipe(
1253
- yn((s) => {
1356
+ e.pipe(
1357
+ Se(([t, r]) => t ? t.activeSheet$.pipe(
1358
+ Wn((s) => {
1254
1359
  if (!s) {
1255
1360
  this._drawingManagerService.setDrawingVisible(!1);
1256
1361
  return;
1257
1362
  }
1258
- const o = e.getUnitId(), a = s.getSheetId();
1363
+ const o = t.getUnitId(), a = s.getSheetId();
1259
1364
  this._permissionService.composePermission([
1260
- new On(o).id,
1261
- new Un(o, a).id
1262
- ]).every((u) => u.value) ? this._drawingManagerService.setDrawingVisible(!0) : this._handleDrawingVisibilityFalse(e, s);
1365
+ new Ln(o).id,
1366
+ new Fn(o, a).id
1367
+ ]).every((u) => u.value) ? this._drawingManagerService.setDrawingVisible(!0) : this._handleDrawingVisibilityFalse(t, s);
1263
1368
  })
1264
1369
  ) : (this._drawingManagerService.setDrawingVisible(!1), pe))
1265
1370
  ).subscribe()
@@ -1267,28 +1372,28 @@ let Nt = class extends le {
1267
1372
  }
1268
1373
  _handleDrawingVisibilityFalse(i, n) {
1269
1374
  this._drawingManagerService.setDrawingVisible(!1);
1270
- const t = i.getUnitId(), e = n.getSheetId(), r = this._drawingManagerService.getDrawingData(t, e), s = Object.values(r), o = this._renderManagerService.getRenderById(t), a = o == null ? void 0 : o.scene;
1375
+ const e = i.getUnitId(), t = n.getSheetId(), r = this._drawingManagerService.getDrawingData(e, t), s = Object.values(r), o = this._renderManagerService.getRenderById(e), a = o == null ? void 0 : o.scene;
1271
1376
  if (!a)
1272
1377
  return;
1273
1378
  a.getAllObjectsByOrder().forEach((u) => {
1274
- u.classType === We.IMAGE && s.some((d) => u.oKey.includes(d.drawingId)) && a.removeObject(u);
1379
+ u.classType === je.IMAGE && s.some((l) => u.oKey.includes(l.drawingId)) && a.removeObject(u);
1275
1380
  });
1276
1381
  }
1277
1382
  _initDrawingEditable() {
1278
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$, t = St([i, n]);
1383
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$, e = St([i, n]);
1279
1384
  this.disposeWithMe(
1280
- t.pipe(
1281
- Se(([e, r]) => e ? e.activeSheet$.pipe(
1282
- yn((s) => {
1385
+ e.pipe(
1386
+ Se(([t, r]) => t ? t.activeSheet$.pipe(
1387
+ Wn((s) => {
1283
1388
  if (!s) {
1284
1389
  this._drawingManagerService.setDrawingEditable(!1);
1285
1390
  return;
1286
1391
  }
1287
- const o = e.getUnitId(), a = s.getSheetId();
1392
+ const o = t.getUnitId(), a = s.getSheetId();
1288
1393
  this._permissionService.composePermission([
1289
- new Qt(o).id,
1290
- new en(o, a).id
1291
- ]).every((u) => u.value) ? this._drawingManagerService.setDrawingEditable(!0) : this._handleDrawingEditableFalse(e, s);
1394
+ new en(o).id,
1395
+ new tn(o, a).id
1396
+ ]).every((u) => u.value) ? this._drawingManagerService.setDrawingEditable(!0) : this._handleDrawingEditableFalse(t, s);
1292
1397
  })
1293
1398
  ) : (this._drawingManagerService.setDrawingEditable(!1), pe))
1294
1399
  ).subscribe()
@@ -1296,34 +1401,34 @@ let Nt = class extends le {
1296
1401
  }
1297
1402
  _handleDrawingEditableFalse(i, n) {
1298
1403
  this._drawingManagerService.setDrawingEditable(!1);
1299
- const t = i.getUnitId(), e = n.getSheetId(), r = this._drawingManagerService.getDrawingData(t, e), s = Object.values(r), o = this._renderManagerService.getRenderById(t), a = o == null ? void 0 : o.scene;
1404
+ const e = i.getUnitId(), t = n.getSheetId(), r = this._drawingManagerService.getDrawingData(e, t), s = Object.values(r), o = this._renderManagerService.getRenderById(e), a = o == null ? void 0 : o.scene;
1300
1405
  if (!a)
1301
1406
  return;
1302
1407
  a.getAllObjectsByOrder().forEach((u) => {
1303
- u.classType === We.IMAGE && s.some((d) => u.oKey.includes(d.drawingId)) && a.detachTransformerFrom(u);
1408
+ u.classType === je.IMAGE && s.some((l) => u.oKey.includes(l.drawingId)) && a.detachTransformerFrom(u);
1304
1409
  });
1305
1410
  }
1306
1411
  _initViewPermissionChange() {
1307
1412
  const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$;
1308
1413
  this.disposeWithMe(
1309
1414
  St([i, n]).pipe(
1310
- Se(([t, e]) => t ? t.activeSheet$.pipe(
1415
+ Se(([e, t]) => e ? e.activeSheet$.pipe(
1311
1416
  Se((r) => {
1312
1417
  if (!r)
1313
1418
  return pe;
1314
- const s = t.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), c = a == null ? void 0 : a.scene;
1419
+ const s = e.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), c = a == null ? void 0 : a.scene;
1315
1420
  if (!c)
1316
1421
  return pe;
1317
1422
  const u = c.getTransformerByCreate();
1318
1423
  return this._permissionService.composePermission$([
1319
- new On(s).id,
1320
- new Un(s, o).id
1424
+ new Ln(s).id,
1425
+ new Fn(s, o).id
1321
1426
  ]).pipe(
1322
- Ee((l) => l.every((g) => g.value)),
1323
- Tn()
1427
+ Oe((d) => d.every((g) => g.value)),
1428
+ jn()
1324
1429
  ).pipe(
1325
- Ee((l) => ({
1326
- permission: l,
1430
+ Oe((d) => ({
1431
+ permission: d,
1327
1432
  scene: c,
1328
1433
  transformer: u,
1329
1434
  unitId: s,
@@ -1333,16 +1438,16 @@ let Nt = class extends le {
1333
1438
  })
1334
1439
  ) : pe)
1335
1440
  ).subscribe({
1336
- next: ({ permission: t, scene: e, transformer: r, unitId: s, subUnitId: o }) => {
1337
- this._drawingManagerService.setDrawingVisible(t);
1338
- const a = e.getAllObjectsByOrder(), c = this._drawingManagerService.getDrawingData(s, o), u = Object.values(c);
1339
- t ? this._drawingManagerService.addNotification(u) : (a.forEach((d) => {
1340
- d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) && e.removeObject(d);
1441
+ next: ({ permission: e, scene: t, transformer: r, unitId: s, subUnitId: o }) => {
1442
+ this._drawingManagerService.setDrawingVisible(e);
1443
+ const a = t.getAllObjectsByOrder(), c = this._drawingManagerService.getDrawingData(s, o), u = Object.values(c);
1444
+ e ? this._drawingManagerService.addNotification(u) : (a.forEach((l) => {
1445
+ l.classType === je.IMAGE && u.some((d) => l.oKey.includes(d.drawingId)) && t.removeObject(l);
1341
1446
  }), r.clearSelectedObjects());
1342
1447
  },
1343
1448
  complete: () => {
1344
1449
  this._drawingManagerService.setDrawingVisible(!0);
1345
- const t = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET), e = t == null ? void 0 : t.getActiveSheet(), r = t == null ? void 0 : t.getUnitId(), s = e == null ? void 0 : e.getSheetId();
1450
+ const e = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET), t = e == null ? void 0 : e.getActiveSheet(), r = e == null ? void 0 : e.getUnitId(), s = t == null ? void 0 : t.getSheetId();
1346
1451
  if (!r || !s)
1347
1452
  return;
1348
1453
  const o = this._drawingManagerService.getDrawingData(r, s), a = Object.values(o);
@@ -1355,23 +1460,23 @@ let Nt = class extends le {
1355
1460
  const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), n = this._userManagerService.currentUser$;
1356
1461
  this.disposeWithMe(
1357
1462
  St([i, n]).pipe(
1358
- Se(([t, e]) => t ? t.activeSheet$.pipe(
1463
+ Se(([e, t]) => e ? e.activeSheet$.pipe(
1359
1464
  Se((r) => {
1360
1465
  if (!r)
1361
1466
  return pe;
1362
- const s = t.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), c = a == null ? void 0 : a.scene;
1467
+ const s = e.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), c = a == null ? void 0 : a.scene;
1363
1468
  if (!c)
1364
1469
  return pe;
1365
1470
  const u = c.getTransformerByCreate();
1366
1471
  return this._permissionService.composePermission$([
1367
- new Qt(s).id,
1368
- new en(s, o).id
1472
+ new en(s).id,
1473
+ new tn(s, o).id
1369
1474
  ]).pipe(
1370
- Ee((l) => l.every((g) => g.value)),
1371
- Tn()
1475
+ Oe((d) => d.every((g) => g.value)),
1476
+ jn()
1372
1477
  ).pipe(
1373
- Ee((l) => ({
1374
- permission: l,
1478
+ Oe((d) => ({
1479
+ permission: d,
1375
1480
  scene: c,
1376
1481
  transformer: u,
1377
1482
  unitId: s,
@@ -1381,60 +1486,60 @@ let Nt = class extends le {
1381
1486
  })
1382
1487
  ) : pe)
1383
1488
  ).subscribe({
1384
- next: ({ permission: t, scene: e, transformer: r, unitId: s, subUnitId: o }) => {
1385
- this._drawingManagerService.setDrawingEditable(t);
1386
- const a = e.getAllObjectsByOrder(), c = this._drawingManagerService.getDrawingData(s, o), u = Object.values(c);
1387
- t ? (a.forEach((d) => {
1388
- d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) && e.attachTransformerTo(d);
1389
- }), this._drawingManagerService.addNotification(u)) : (a.forEach((d) => {
1390
- d.classType === We.IMAGE && u.some((l) => d.oKey.includes(l.drawingId)) && e.detachTransformerFrom(d);
1489
+ next: ({ permission: e, scene: t, transformer: r, unitId: s, subUnitId: o }) => {
1490
+ this._drawingManagerService.setDrawingEditable(e);
1491
+ const a = t.getAllObjectsByOrder(), c = this._drawingManagerService.getDrawingData(s, o), u = Object.values(c);
1492
+ e ? (a.forEach((l) => {
1493
+ l.classType === je.IMAGE && u.some((d) => l.oKey.includes(d.drawingId)) && t.attachTransformerTo(l);
1494
+ }), this._drawingManagerService.addNotification(u)) : (a.forEach((l) => {
1495
+ l.classType === je.IMAGE && u.some((d) => l.oKey.includes(d.drawingId)) && t.detachTransformerFrom(l);
1391
1496
  }), r.clearSelectedObjects());
1392
1497
  },
1393
1498
  complete: () => {
1394
- const t = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET);
1395
- if (!t)
1499
+ const e = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET);
1500
+ if (!e)
1396
1501
  return;
1397
- const e = t.getUnitId(), r = t.getActiveSheet();
1502
+ const t = e.getUnitId(), r = e.getActiveSheet();
1398
1503
  if (!r)
1399
1504
  return;
1400
- const s = r.getSheetId(), o = this._renderManagerService.getRenderById(e), a = o == null ? void 0 : o.scene;
1505
+ const s = r.getSheetId(), o = this._renderManagerService.getRenderById(t), a = o == null ? void 0 : o.scene;
1401
1506
  if (!a)
1402
1507
  return;
1403
- const c = this._drawingManagerService.getDrawingData(e, s), u = Object.values(c);
1404
- this._drawingManagerService.setDrawingEditable(!0), a.getAllObjectsByOrder().forEach((l) => {
1405
- l.classType === We.IMAGE && u.some((g) => l.oKey.includes(g.drawingId)) && a.detachTransformerFrom(l);
1508
+ const c = this._drawingManagerService.getDrawingData(t, s), u = Object.values(c);
1509
+ this._drawingManagerService.setDrawingEditable(!0), a.getAllObjectsByOrder().forEach((d) => {
1510
+ d.classType === je.IMAGE && u.some((g) => d.oKey.includes(g.drawingId)) && a.detachTransformerFrom(d);
1406
1511
  });
1407
1512
  }
1408
1513
  })
1409
1514
  );
1410
1515
  }
1411
1516
  };
1412
- Nt = As([
1517
+ kt = Bs([
1413
1518
  qe(0, oe),
1414
1519
  qe(1, ne),
1415
- qe(2, Yr),
1416
- qe(3, Ge),
1417
- qe(4, N(Gr))
1418
- ], Nt);
1419
- var Ns = Object.getOwnPropertyDescriptor, ks = (i, n, t, e) => {
1420
- for (var r = e > 1 ? void 0 : e ? Ns(n, t) : n, s = i.length - 1, o; s >= 0; s--)
1520
+ qe(2, Vr),
1521
+ qe(3, Ce),
1522
+ qe(4, N(Hr))
1523
+ ], kt);
1524
+ var Ws = Object.getOwnPropertyDescriptor, js = (i, n, e, t) => {
1525
+ for (var r = t > 1 ? void 0 : t ? Ws(n, e) : n, s = i.length - 1, o; s >= 0; s--)
1421
1526
  (o = i[s]) && (r = o(r) || r);
1422
1527
  return r;
1423
- }, Rt = (i, n) => (t, e) => n(t, e, i);
1424
- let kt = class extends le {
1425
- constructor(i, n, t, e) {
1426
- super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = n, this._drawingManagerService = t, this._renderManagerService = e, this._initPrinting();
1528
+ }, Rt = (i, n) => (e, t) => n(e, t, i);
1529
+ let Bt = class extends le {
1530
+ constructor(i, n, e, t) {
1531
+ super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = n, this._drawingManagerService = e, this._renderManagerService = t, this._initPrinting();
1427
1532
  }
1428
1533
  _initPrinting() {
1429
1534
  this.disposeWithMe(
1430
1535
  this._sheetPrintInterceptorService.interceptor.intercept(
1431
1536
  this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
1432
1537
  {
1433
- handler: (i, n, t) => {
1434
- const { unitId: e, scene: r, subUnitId: s } = n, o = this._drawingManagerService.getDrawingDataForUnit(e), a = o == null ? void 0 : o[s];
1538
+ handler: (i, n, e) => {
1539
+ const { unitId: t, scene: r, subUnitId: s } = n, o = this._drawingManagerService.getDrawingDataForUnit(t), a = o == null ? void 0 : o[s];
1435
1540
  return a && a.order.forEach((c) => {
1436
1541
  this._drawingRenderService.renderDrawing(a.data[c], r);
1437
- }), t();
1542
+ }), e();
1438
1543
  }
1439
1544
  }
1440
1545
  )
@@ -1442,128 +1547,128 @@ let kt = class extends le {
1442
1547
  this._sheetPrintInterceptorService.interceptor.intercept(
1443
1548
  this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE,
1444
1549
  {
1445
- handler: (i, n, t) => {
1446
- const { unitId: e, subUnitId: r } = n, s = this._renderManagerService.getRenderById(e);
1550
+ handler: (i, n, e) => {
1551
+ const { unitId: t, subUnitId: r } = n, s = this._renderManagerService.getRenderById(t);
1447
1552
  if (!s)
1448
- return t(i);
1553
+ return e(i);
1449
1554
  const o = s.with(V).getSkeletonParam(r);
1450
1555
  if (!o)
1451
- return t(i);
1452
- const a = this._drawingManagerService.getDrawingDataForUnit(e), c = a == null ? void 0 : a[n.subUnitId];
1556
+ return e(i);
1557
+ const a = this._drawingManagerService.getDrawingDataForUnit(t), c = a == null ? void 0 : a[n.subUnitId];
1453
1558
  if (!c)
1454
- return t(i);
1455
- 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]).filter((h) => h.drawingType !== L.DRAWING_DOM);
1559
+ return e(i);
1560
+ const { scaleX: u, scaleY: l } = s.scene, d = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, g = c.order.map((h) => c.data[h]).filter((h) => h.drawingType !== x.DRAWING_DOM);
1456
1561
  return g.length ? (g.forEach((h) => {
1457
- if (!h.groupId && h.transform && ye.isDefine(h.transform.left) && ye.isDefine(h.transform.top) && ye.isDefine(h.transform.width) && ye.isDefine(h.transform.height)) {
1458
- const f = o.skeleton.getCellIndexByOffset(h.transform.left, h.transform.top, u, d, { x: 0, y: 0 }), p = o.skeleton.getCellIndexByOffset(h.transform.left + h.transform.width, h.transform.top + h.transform.height, u, d, { x: 0, y: 0 });
1459
- f.column < l.startColumn && (l.startColumn = f.column), f.row < l.startRow && (l.startRow = f.row), l.endRow < p.row && (l.endRow = p.row), l.endColumn < p.column && (l.endColumn = p.column);
1562
+ if (!h.groupId && h.transform && Ee.isDefine(h.transform.left) && Ee.isDefine(h.transform.top) && Ee.isDefine(h.transform.width) && Ee.isDefine(h.transform.height)) {
1563
+ const f = o.skeleton.getCellIndexByOffset(h.transform.left, h.transform.top, u, l, { x: 0, y: 0 }), p = o.skeleton.getCellIndexByOffset(h.transform.left + h.transform.width, h.transform.top + h.transform.height, u, l, { x: 0, y: 0 });
1564
+ f.column < d.startColumn && (d.startColumn = f.column), f.row < d.startRow && (d.startRow = f.row), d.endRow < p.row && (d.endRow = p.row), d.endColumn < p.column && (d.endColumn = p.column);
1460
1565
  }
1461
- }), t(l)) : t(i);
1566
+ }), e(d)) : e(i);
1462
1567
  }
1463
1568
  }
1464
1569
  )
1465
1570
  );
1466
1571
  }
1467
1572
  };
1468
- kt = ks([
1469
- Rt(0, N(bi)),
1470
- Rt(1, N(jn)),
1573
+ Bt = js([
1574
+ Rt(0, N(Ei)),
1575
+ Rt(1, N(Zn)),
1471
1576
  Rt(2, oe),
1472
1577
  Rt(3, ne)
1473
- ], kt);
1474
- var Bs = Object.getOwnPropertyDescriptor, Ws = (i, n, t, e) => {
1475
- for (var r = e > 1 ? void 0 : e ? Bs(n, t) : n, s = i.length - 1, o; s >= 0; s--)
1578
+ ], Bt);
1579
+ var $s = Object.getOwnPropertyDescriptor, xs = (i, n, e, t) => {
1580
+ for (var r = t > 1 ? void 0 : t ? $s(n, e) : n, s = i.length - 1, o; s >= 0; s--)
1476
1581
  (o = i[s]) && (r = o(r) || r);
1477
1582
  return r;
1478
- }, _e = (i, n) => (t, e) => n(t, e, i);
1479
- const js = [
1480
- Xn.id,
1481
- Vn.id,
1482
- Hn.id,
1483
- zn.id,
1484
- Kn.id,
1485
- Zn.id,
1486
- Jn.id,
1487
- qn.id,
1488
- tn.id,
1489
- nn.id,
1490
- Qn.id,
1491
- er.id,
1492
- tr.id,
1493
- nr.id,
1583
+ }, _e = (i, n) => (e, t) => n(e, t, i);
1584
+ const Ls = [
1494
1585
  rr.id,
1495
1586
  ir.id,
1496
1587
  sr.id,
1497
1588
  or.id,
1498
- ar.id
1499
- ], $s = [
1500
- Hi.id,
1501
- zi.id,
1502
- Ki.id,
1503
- Zi.id,
1504
- Fn.id,
1505
- Yn.id
1589
+ ar.id,
1590
+ cr.id,
1591
+ dr.id,
1592
+ lr.id,
1593
+ nn.id,
1594
+ rn.id,
1595
+ ur.id,
1596
+ hr.id,
1597
+ gr.id,
1598
+ fr.id,
1599
+ mr.id,
1600
+ pr.id,
1601
+ wr.id,
1602
+ _r.id,
1603
+ vr.id
1604
+ ], Fs = [
1605
+ Ji.id,
1606
+ qi.id,
1607
+ Qi.id,
1608
+ es.id,
1609
+ er.id,
1610
+ tr.id
1506
1611
  ];
1507
- let an = class extends le {
1508
- constructor(i, n, t, e, r, s, o, a, c) {
1509
- super(), this._context = i, this._renderManagerService = n, this._commandService = t, this._selectionRenderService = e, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService = a, this._univerInstanceService = c, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
1612
+ let dn = class extends le {
1613
+ constructor(i, n, e, t, r, s, o, a, c) {
1614
+ super(), this._context = i, this._renderManagerService = n, this._commandService = e, this._selectionRenderService = t, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService = a, this._univerInstanceService = c, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
1510
1615
  }
1511
1616
  _sheetInterceptorListener() {
1512
1617
  this.disposeWithMe(
1513
1618
  this._sheetInterceptorService.interceptCommand({
1514
1619
  getMutations: (i) => {
1515
- if (!js.includes(i.id))
1620
+ if (!Ls.includes(i.id))
1516
1621
  return { redos: [], undos: [] };
1517
1622
  if (i.params == null)
1518
1623
  return { redos: [], undos: [] };
1519
1624
  const n = i.id;
1520
- if (n === Xn.id)
1625
+ if (n === rr.id)
1521
1626
  return this._moveRowInterceptor(i.params, "insert");
1522
- if ([sr.id, or.id, ar.id].includes(n))
1627
+ if ([wr.id, _r.id, vr.id].includes(n))
1523
1628
  return this._moveRangeInterceptor(i.params);
1524
- if (n === Vn.id)
1629
+ if (n === ir.id)
1525
1630
  return this._moveColInterceptor(i.params, "insert");
1526
- if (n === Hn.id)
1631
+ if (n === sr.id)
1527
1632
  return this._moveRowInterceptor(i.params, "remove");
1528
- if (n === zn.id)
1633
+ if (n === or.id)
1529
1634
  return this._moveColInterceptor(i.params, "remove");
1530
- if (n === Kn.id) {
1531
- const { range: t } = i.params;
1635
+ if (n === ar.id) {
1636
+ const { range: e } = i.params;
1532
1637
  return this._getRangeMoveUndo(
1533
- t,
1638
+ e,
1534
1639
  0
1535
1640
  /* deleteLeft */
1536
1641
  );
1537
- } else if (n === Zn.id) {
1538
- const { range: t } = i.params;
1642
+ } else if (n === cr.id) {
1643
+ const { range: e } = i.params;
1539
1644
  return this._getRangeMoveUndo(
1540
- t,
1645
+ e,
1541
1646
  1
1542
1647
  /* deleteUp */
1543
1648
  );
1544
- } else if (n === Jn.id) {
1545
- const { range: t } = i.params;
1649
+ } else if (n === dr.id) {
1650
+ const { range: e } = i.params;
1546
1651
  return this._getRangeMoveUndo(
1547
- t,
1652
+ e,
1548
1653
  2
1549
1654
  /* insertDown */
1550
1655
  );
1551
- } else if (n === qn.id) {
1552
- const { range: t } = i.params;
1656
+ } else if (n === lr.id) {
1657
+ const { range: e } = i.params;
1553
1658
  return this._getRangeMoveUndo(
1554
- t,
1659
+ e,
1555
1660
  3
1556
1661
  /* insertRight */
1557
1662
  );
1558
- } else if (n === tr.id || n === nr.id) {
1559
- const t = i.params, { unitId: e, subUnitId: r, ranges: s } = t;
1560
- return this._getDrawingUndoForRowVisible(e, r, s);
1561
- } else if (n === rr.id || n === ir.id) {
1562
- const t = i.params, { unitId: e, subUnitId: r, ranges: s } = t;
1563
- return this._getDrawingUndoForColVisible(e, r, s);
1564
- } else if (n === tn.id || n === nn.id || n === Qn.id || n === er.id) {
1565
- const t = i.params, { unitId: e, subUnitId: r, ranges: s } = t, o = n === tn.id || n === nn.id;
1566
- return this._getDrawingUndoForRowAndColSize(e, r, s, o);
1663
+ } else if (n === gr.id || n === fr.id) {
1664
+ const e = i.params, { unitId: t, subUnitId: r, ranges: s } = e;
1665
+ return this._getDrawingUndoForRowVisible(t, r, s);
1666
+ } else if (n === mr.id || n === pr.id) {
1667
+ const e = i.params, { unitId: t, subUnitId: r, ranges: s } = e;
1668
+ return this._getDrawingUndoForColVisible(t, r, s);
1669
+ } else if (n === nn.id || n === rn.id || n === ur.id || n === hr.id) {
1670
+ const e = i.params, { unitId: t, subUnitId: r, ranges: s } = e, o = n === nn.id || n === rn.id;
1671
+ return this._getDrawingUndoForRowAndColSize(t, r, s, o);
1567
1672
  }
1568
1673
  return { redos: [], undos: [] };
1569
1674
  }
@@ -1571,83 +1676,83 @@ let an = class extends le {
1571
1676
  );
1572
1677
  }
1573
1678
  _getRangeMoveUndo(i, n) {
1574
- const t = H(this._univerInstanceService);
1575
- if (t == null)
1679
+ const e = H(this._univerInstanceService);
1680
+ if (e == null)
1576
1681
  return { redos: [], undos: [] };
1577
- const e = t.unitId, r = t.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(e, r), c = [], u = [];
1578
- if (Object.keys(a).forEach((d) => {
1579
- const l = a[d], { updateDrawings: g, deleteDrawings: h } = this._getUpdateOrDeleteDrawings(i, n, l);
1682
+ const t = e.unitId, r = e.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(t, r), c = [], u = [];
1683
+ if (Object.keys(a).forEach((l) => {
1684
+ const d = a[l], { updateDrawings: g, deleteDrawings: h } = this._getUpdateOrDeleteDrawings(i, n, d);
1580
1685
  c.push(...g), u.push(...h);
1581
1686
  }), c.length === 0 && u.length === 0)
1582
1687
  return { redos: [], undos: [] };
1583
1688
  if (c.length > 0) {
1584
- const d = this._sheetDrawingService.getBatchUpdateOp(c), { undo: l, redo: g, objects: h } = d;
1585
- s.push({ id: A.id, params: { unitId: e, subUnitId: r, op: g, objects: h, type: P.UPDATE } }), o.push({ id: A.id, params: { unitId: e, subUnitId: r, op: l, objects: h, type: P.UPDATE } });
1689
+ const l = this._sheetDrawingService.getBatchUpdateOp(c), { undo: d, redo: g, objects: h } = l;
1690
+ s.push({ id: A.id, params: { unitId: t, subUnitId: r, op: g, objects: h, type: P.UPDATE } }), o.push({ id: A.id, params: { unitId: t, subUnitId: r, op: d, objects: h, type: P.UPDATE } });
1586
1691
  }
1587
1692
  if (u.length > 0) {
1588
- const d = this._sheetDrawingService.getBatchRemoveOp(u), l = d.undo, g = d.redo, h = d.objects;
1589
- s.push({ id: A.id, params: { unitId: e, subUnitId: r, op: g, objects: h, type: P.REMOVE } }), o.push({ id: A.id, params: { unitId: e, subUnitId: r, op: l, objects: h, type: P.INSERT } });
1693
+ const l = this._sheetDrawingService.getBatchRemoveOp(u), d = l.undo, g = l.redo, h = l.objects;
1694
+ s.push({ id: A.id, params: { unitId: t, subUnitId: r, op: g, objects: h, type: P.REMOVE } }), o.push({ id: A.id, params: { unitId: t, subUnitId: r, op: d, objects: h, type: P.INSERT } });
1590
1695
  }
1591
- return s.push({ id: x.id, params: [e] }), o.push({ id: x.id, params: [e] }), {
1696
+ return s.push({ id: L.id, params: [t] }), o.push({ id: L.id, params: [t] }), {
1592
1697
  redos: s,
1593
1698
  undos: o
1594
1699
  };
1595
1700
  }
1596
- _getUpdateOrDeleteDrawings(i, n, t) {
1597
- const e = [], r = [], { sheetTransform: s, anchorType: o = U.Position, transform: a, unitId: c, subUnitId: u, drawingId: d } = t, { from: l, to: g } = s, { row: h, column: f } = l, { row: p, column: m } = g;
1701
+ _getUpdateOrDeleteDrawings(i, n, e) {
1702
+ const t = [], r = [], { sheetTransform: s, anchorType: o = U.Position, transform: a, unitId: c, subUnitId: u, drawingId: l } = e, { from: d, to: g } = s, { row: h, column: f } = d, { row: p, column: m } = g;
1598
1703
  if (s == null || a == null)
1599
1704
  return {
1600
- updateDrawings: e,
1705
+ updateDrawings: t,
1601
1706
  deleteDrawings: r
1602
1707
  };
1603
- const { startRow: w, endRow: S, startColumn: C, endColumn: D } = i;
1604
- let v = null, b = null;
1708
+ const { startRow: w, endRow: S, startColumn: C, endColumn: b } = i;
1709
+ let v = null, D = null;
1605
1710
  if (n === 0 && h >= w && p <= S)
1606
- if (f >= C && m <= D)
1607
- r.push({ unitId: c, subUnitId: u, drawingId: d });
1711
+ if (f >= C && m <= b)
1712
+ r.push({ unitId: c, subUnitId: u, drawingId: l });
1608
1713
  else {
1609
- const _ = this._shrinkCol(s, a, C, D, o);
1610
- v = _ == null ? void 0 : _.newSheetTransform, b = _ == null ? void 0 : _.newTransform;
1714
+ const _ = this._shrinkCol(s, a, C, b, o);
1715
+ v = _ == null ? void 0 : _.newSheetTransform, D = _ == null ? void 0 : _.newTransform;
1611
1716
  }
1612
- else if (n === 1 && f >= C && m <= D)
1717
+ else if (n === 1 && f >= C && m <= b)
1613
1718
  if (h >= w && p <= S)
1614
- r.push({ unitId: c, subUnitId: u, drawingId: d });
1719
+ r.push({ unitId: c, subUnitId: u, drawingId: l });
1615
1720
  else {
1616
1721
  const _ = this._shrinkRow(s, a, w, S, o);
1617
- v = _ == null ? void 0 : _.newSheetTransform, b = _ == null ? void 0 : _.newTransform;
1722
+ v = _ == null ? void 0 : _.newSheetTransform, D = _ == null ? void 0 : _.newTransform;
1618
1723
  }
1619
1724
  else if (n === 2) {
1620
1725
  const _ = this._expandRow(s, a, w, S, o);
1621
- v = _ == null ? void 0 : _.newSheetTransform, b = _ == null ? void 0 : _.newTransform;
1726
+ v = _ == null ? void 0 : _.newSheetTransform, D = _ == null ? void 0 : _.newTransform;
1622
1727
  } else if (n === 3) {
1623
- const _ = this._expandCol(s, a, C, D, o);
1624
- v = _ == null ? void 0 : _.newSheetTransform, b = _ == null ? void 0 : _.newTransform;
1728
+ const _ = this._expandCol(s, a, C, b, o);
1729
+ v = _ == null ? void 0 : _.newSheetTransform, D = _ == null ? void 0 : _.newTransform;
1625
1730
  }
1626
- if (v != null && b != null) {
1731
+ if (v != null && D != null) {
1627
1732
  const _ = z(v, this._selectionRenderService, this._skeletonManagerService);
1628
- e.push({ ...t, sheetTransform: v, transform: _ });
1733
+ t.push({ ...e, sheetTransform: v, transform: _ });
1629
1734
  }
1630
- return { updateDrawings: e, deleteDrawings: r };
1735
+ return { updateDrawings: t, deleteDrawings: r };
1631
1736
  }
1632
- _remainDrawingSize(i, n, t) {
1633
- const e = $({ ...i }, this._selectionRenderService);
1634
- e != null && n.push({
1635
- ...t,
1636
- sheetTransform: e
1737
+ _remainDrawingSize(i, n, e) {
1738
+ const t = $({ ...i }, this._selectionRenderService);
1739
+ t != null && n.push({
1740
+ ...e,
1741
+ sheetTransform: t
1637
1742
  });
1638
1743
  }
1639
1744
  // eslint-disable-next-line max-lines-per-function
1640
- _getDrawingUndoForColVisible(i, n, t) {
1641
- const e = this._drawingManagerService.getDrawingData(i, n), r = [], s = [];
1642
- if (Object.keys(e).forEach((d) => {
1643
- const l = e[d], { sheetTransform: g, transform: h, anchorType: f = U.Position } = l;
1745
+ _getDrawingUndoForColVisible(i, n, e) {
1746
+ const t = this._drawingManagerService.getDrawingData(i, n), r = [], s = [];
1747
+ if (Object.keys(t).forEach((l) => {
1748
+ const d = t[l], { sheetTransform: g, transform: h, anchorType: f = U.Position } = d;
1644
1749
  if (f === U.None)
1645
- this._remainDrawingSize(h, r, l);
1750
+ this._remainDrawingSize(h, r, d);
1646
1751
  else {
1647
- const { from: p, to: m } = g, { row: w, column: S } = p, { row: C, column: D } = m;
1648
- for (let v = 0; v < t.length; v++) {
1649
- const b = t[v], { startRow: _, endRow: E, startColumn: M, endColumn: y } = b;
1650
- if (D < M)
1752
+ const { from: p, to: m } = g, { row: w, column: S } = p, { row: C, column: b } = m;
1753
+ for (let v = 0; v < e.length; v++) {
1754
+ const D = e[v], { startRow: _, endRow: T, startColumn: M, endColumn: y } = D;
1755
+ if (b < M)
1651
1756
  continue;
1652
1757
  if (f === U.Position) {
1653
1758
  let R = null, O = null;
@@ -1658,15 +1763,15 @@ let an = class extends le {
1658
1763
  O = { ...h, left: B.startX };
1659
1764
  }
1660
1765
  if (O != null && (R = $(O, this._selectionRenderService), R != null && O != null)) {
1661
- r.push({ ...l, sheetTransform: R, transform: O });
1766
+ r.push({ ...d, sheetTransform: R, transform: O });
1662
1767
  break;
1663
1768
  }
1664
- this._remainDrawingSize(h, r, l);
1769
+ this._remainDrawingSize(h, r, d);
1665
1770
  continue;
1666
1771
  }
1667
- if (S >= M && D <= y)
1772
+ if (S >= M && b <= y)
1668
1773
  continue;
1669
- let T = null, I = null;
1774
+ let E = null, I = null;
1670
1775
  if (S >= M && S <= y) {
1671
1776
  const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: y, startRow: p.row, endRow: m.row });
1672
1777
  if (R == null)
@@ -1676,8 +1781,8 @@ let an = class extends le {
1676
1781
  left: (R == null ? void 0 : R.startX) || 0,
1677
1782
  width: ((h == null ? void 0 : h.width) || 0) - R.endX + R.startX
1678
1783
  };
1679
- } else if (D >= M && D <= y) {
1680
- const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: M, endColumn: D, startRow: p.row, endRow: m.row });
1784
+ } else if (b >= M && b <= y) {
1785
+ const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: M, endColumn: b, startRow: p.row, endRow: m.row });
1681
1786
  if (R == null)
1682
1787
  return;
1683
1788
  I = {
@@ -1691,24 +1796,24 @@ let an = class extends le {
1691
1796
  if (I = {
1692
1797
  ...h,
1693
1798
  width: ((h == null ? void 0 : h.width) || 0) - R.endX + R.startX
1694
- }, T = $(I, this._selectionRenderService), T != null && I != null) {
1695
- s.push({ ...l, sheetTransform: T, transform: I });
1799
+ }, E = $(I, this._selectionRenderService), E != null && I != null) {
1800
+ s.push({ ...d, sheetTransform: E, transform: I });
1696
1801
  break;
1697
1802
  }
1698
1803
  }
1699
- if (I != null && (T = $(I, this._selectionRenderService)), I != null && T != null) {
1700
- r.push({ ...l, sheetTransform: T, transform: I });
1804
+ if (I != null && (E = $(I, this._selectionRenderService)), I != null && E != null) {
1805
+ r.push({ ...d, sheetTransform: E, transform: I });
1701
1806
  break;
1702
1807
  } else
1703
- this._remainDrawingSize(h, r, l);
1808
+ this._remainDrawingSize(h, r, d);
1704
1809
  }
1705
1810
  }
1706
1811
  }), r.length === 0 && s.length === 0)
1707
1812
  return { redos: [], undos: [] };
1708
1813
  const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, n, r), c = [], u = [];
1709
1814
  if (s.length > 0) {
1710
- const { redos: d, undos: l } = this._createUndoAndRedoMutation(i, n, s);
1711
- c.push(...d), u.push(...l);
1815
+ const { redos: l, undos: d } = this._createUndoAndRedoMutation(i, n, s);
1816
+ c.push(...l), u.push(...d);
1712
1817
  }
1713
1818
  return {
1714
1819
  redos: o,
@@ -1717,13 +1822,13 @@ let an = class extends le {
1717
1822
  preUndos: u
1718
1823
  };
1719
1824
  }
1720
- _createUndoAndRedoMutation(i, n, t) {
1721
- const e = this._sheetDrawingService.getBatchUpdateOp(t), { undo: r, redo: s, objects: o } = e, a = [
1825
+ _createUndoAndRedoMutation(i, n, e) {
1826
+ const t = this._sheetDrawingService.getBatchUpdateOp(e), { undo: r, redo: s, objects: o } = t, a = [
1722
1827
  { id: A.id, params: { unitId: i, subUnitId: n, op: s, objects: o, type: P.UPDATE } },
1723
- { id: x.id, params: [i] }
1828
+ { id: L.id, params: [i] }
1724
1829
  ], c = [
1725
1830
  { id: A.id, params: { unitId: i, subUnitId: n, op: r, objects: o, type: P.UPDATE } },
1726
- { id: x.id, params: [i] }
1831
+ { id: L.id, params: [i] }
1727
1832
  ];
1728
1833
  return {
1729
1834
  redos: a,
@@ -1731,38 +1836,38 @@ let an = class extends le {
1731
1836
  };
1732
1837
  }
1733
1838
  // eslint-disable-next-line max-lines-per-function
1734
- _getDrawingUndoForRowVisible(i, n, t) {
1735
- const e = this._drawingManagerService.getDrawingData(i, n), r = [], s = [];
1736
- if (Object.keys(e).forEach((d) => {
1737
- const l = e[d], { sheetTransform: g, transform: h, anchorType: f = U.Position } = l;
1839
+ _getDrawingUndoForRowVisible(i, n, e) {
1840
+ const t = this._drawingManagerService.getDrawingData(i, n), r = [], s = [];
1841
+ if (Object.keys(t).forEach((l) => {
1842
+ const d = t[l], { sheetTransform: g, transform: h, anchorType: f = U.Position } = d;
1738
1843
  if (f === U.None)
1739
- this._remainDrawingSize(h, r, l);
1844
+ this._remainDrawingSize(h, r, d);
1740
1845
  else {
1741
- const { from: p, to: m } = g, { row: w, column: S } = p, { row: C, column: D } = m;
1742
- for (let v = 0; v < t.length; v++) {
1743
- const b = t[v], { startRow: _, endRow: E, startColumn: M, endColumn: y } = b;
1846
+ const { from: p, to: m } = g, { row: w, column: S } = p, { row: C, column: b } = m;
1847
+ for (let v = 0; v < e.length; v++) {
1848
+ const D = e[v], { startRow: _, endRow: T, startColumn: M, endColumn: y } = D;
1744
1849
  if (C < _)
1745
1850
  continue;
1746
1851
  if (f === U.Position) {
1747
1852
  let R = null, O = null;
1748
- if (w >= _ && w <= E) {
1749
- const B = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: w, endRow: E });
1853
+ if (w >= _ && w <= T) {
1854
+ const B = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: w, endRow: T });
1750
1855
  if (B == null)
1751
1856
  return;
1752
1857
  O = { ...h, top: B.startY };
1753
1858
  }
1754
1859
  if (O != null && (R = $(O, this._selectionRenderService), R != null && O != null)) {
1755
- r.push({ ...l, sheetTransform: R, transform: O });
1860
+ r.push({ ...d, sheetTransform: R, transform: O });
1756
1861
  break;
1757
1862
  }
1758
- this._remainDrawingSize(h, r, l);
1863
+ this._remainDrawingSize(h, r, d);
1759
1864
  continue;
1760
1865
  }
1761
- if (w >= _ && C <= E)
1866
+ if (w >= _ && C <= T)
1762
1867
  continue;
1763
- let T = null, I = null;
1764
- if (w >= _ && w <= E) {
1765
- const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: w, endRow: E });
1868
+ let E = null, I = null;
1869
+ if (w >= _ && w <= T) {
1870
+ const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: w, endRow: T });
1766
1871
  if (R == null)
1767
1872
  return;
1768
1873
  I = {
@@ -1770,7 +1875,7 @@ let an = class extends le {
1770
1875
  top: (R == null ? void 0 : R.startY) || 0,
1771
1876
  height: ((h == null ? void 0 : h.height) || 0) - R.endY + R.startY
1772
1877
  };
1773
- } else if (C >= _ && C <= E) {
1878
+ } else if (C >= _ && C <= T) {
1774
1879
  const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: _, endRow: C });
1775
1880
  if (R == null)
1776
1881
  return;
@@ -1779,30 +1884,30 @@ let an = class extends le {
1779
1884
  top: R.startY - ((h == null ? void 0 : h.height) || 0)
1780
1885
  };
1781
1886
  } else {
1782
- const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: _, endRow: E });
1887
+ const R = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: _, endRow: T });
1783
1888
  if (R == null)
1784
1889
  return;
1785
1890
  if (I = {
1786
1891
  ...h,
1787
1892
  height: ((h == null ? void 0 : h.height) || 0) - R.endY + R.startY
1788
- }, T = $(I, this._selectionRenderService), T != null && I != null) {
1789
- s.push({ ...l, sheetTransform: T, transform: I });
1893
+ }, E = $(I, this._selectionRenderService), E != null && I != null) {
1894
+ s.push({ ...d, sheetTransform: E, transform: I });
1790
1895
  break;
1791
1896
  }
1792
1897
  }
1793
- if (I != null && (T = $(I, this._selectionRenderService)), I != null && T != null) {
1794
- r.push({ ...l, sheetTransform: T, transform: I });
1898
+ if (I != null && (E = $(I, this._selectionRenderService)), I != null && E != null) {
1899
+ r.push({ ...d, sheetTransform: E, transform: I });
1795
1900
  break;
1796
1901
  } else
1797
- this._remainDrawingSize(h, r, l);
1902
+ this._remainDrawingSize(h, r, d);
1798
1903
  }
1799
1904
  }
1800
1905
  }), r.length === 0 && s.length === 0)
1801
1906
  return { redos: [], undos: [] };
1802
1907
  const { redos: o, undos: a } = this._createUndoAndRedoMutation(i, n, r), c = [], u = [];
1803
1908
  if (s.length > 0) {
1804
- const { redos: d, undos: l } = this._createUndoAndRedoMutation(i, n, s);
1805
- c.push(...d), u.push(...l);
1909
+ const { redos: l, undos: d } = this._createUndoAndRedoMutation(i, n, s);
1910
+ c.push(...l), u.push(...d);
1806
1911
  }
1807
1912
  return {
1808
1913
  redos: o,
@@ -1811,27 +1916,23 @@ let an = class extends le {
1811
1916
  preUndos: u
1812
1917
  };
1813
1918
  }
1814
- _getDrawingUndoForRowAndColSize(i, n, t, e) {
1919
+ _getDrawingUndoForRowAndColSize(i, n, e, t) {
1815
1920
  const r = this._drawingManagerService.getDrawingData(i, n), s = [];
1816
1921
  return Object.keys(r).forEach((o) => {
1817
- const a = r[o], { sheetTransform: c, transform: u, anchorType: d = U.Position } = a;
1818
- if (d === U.None)
1922
+ const a = r[o], { sheetTransform: c, transform: u, anchorType: l = U.Position } = a;
1923
+ if (l === U.None)
1819
1924
  this._remainDrawingSize(u, s, a);
1820
1925
  else {
1821
- const { from: l, to: g } = c, { row: h, column: f } = l, { row: p, column: m } = g;
1822
- for (let w = 0; w < t.length; w++) {
1823
- const S = t[w], { startRow: C, endRow: D, startColumn: v, endColumn: b } = S;
1926
+ const { from: d, to: g } = c, { row: h, column: f } = d, { row: p, column: m } = g;
1927
+ for (let w = 0; w < e.length; w++) {
1928
+ const S = e[w], { startRow: C, endRow: b, startColumn: v, endColumn: D } = S;
1824
1929
  if (p < C || m < v)
1825
1930
  continue;
1826
- if (d === U.Position && (h <= C && p >= D || f <= v && m >= b)) {
1931
+ if (l === U.Position && (h <= C && p >= b || f <= v && m >= D)) {
1827
1932
  this._remainDrawingSize(u, s, a);
1828
1933
  continue;
1829
1934
  }
1830
- const _ = z(
1831
- { ...c },
1832
- this._selectionRenderService,
1833
- this._skeletonManagerService
1834
- );
1935
+ const _ = z({ ...c }, this._selectionRenderService, this._skeletonManagerService);
1835
1936
  if (_ != null) {
1836
1937
  s.push({
1837
1938
  ...a,
@@ -1844,70 +1945,70 @@ let an = class extends le {
1844
1945
  }), s.length === 0 ? { redos: [], undos: [] } : this._createUndoAndRedoMutation(i, n, s);
1845
1946
  }
1846
1947
  _getUnitIdAndSubUnitId(i, n) {
1847
- let t, e;
1948
+ let e, t;
1848
1949
  if (n === "insert")
1849
- t = i.unitId, e = i.subUnitId;
1950
+ e = i.unitId, t = i.subUnitId;
1850
1951
  else {
1851
1952
  const r = H(this._univerInstanceService);
1852
1953
  if (r == null)
1853
1954
  return;
1854
- t = r.unitId, e = r.subUnitId;
1955
+ e = r.unitId, t = r.subUnitId;
1855
1956
  }
1856
- return { unitId: t, subUnitId: e };
1957
+ return { unitId: e, subUnitId: t };
1857
1958
  }
1858
1959
  _moveRangeInterceptor(i) {
1859
- var C, D;
1860
- const { toRange: n, fromRange: t } = i, e = H(this._univerInstanceService);
1861
- if (!e)
1960
+ var C, b;
1961
+ const { toRange: n, fromRange: e } = i, t = H(this._univerInstanceService);
1962
+ if (!t)
1862
1963
  return { redos: [], undos: [] };
1863
- const { unitId: r, subUnitId: s } = e, o = (D = (C = this._renderManagerService.getRenderById(r)) == null ? void 0 : C.with(V)) == null ? void 0 : D.getCurrentSkeleton();
1964
+ const { unitId: r, subUnitId: s } = t, o = (b = (C = this._renderManagerService.getRenderById(r)) == null ? void 0 : C.with(V)) == null ? void 0 : b.getCurrentSkeleton();
1864
1965
  if (!o)
1865
1966
  return { redos: [], undos: [] };
1866
- const a = xn(o, t);
1967
+ const a = Qn(o, e);
1867
1968
  if (!a)
1868
1969
  return { redos: [], undos: [] };
1869
- const { startX: c, endX: u, startY: d, endY: l } = a, g = this._sheetDrawingService.getDrawingData(r, s), h = [];
1970
+ const { startX: c, endX: u, startY: l, endY: d } = a, g = this._sheetDrawingService.getDrawingData(r, s), h = [];
1870
1971
  Object.keys(g).forEach((v) => {
1871
- const b = g[v];
1872
- if (b.anchorType !== U.Both)
1972
+ const D = g[v];
1973
+ if (D.anchorType !== U.Both)
1873
1974
  return;
1874
- const { transform: _ } = b;
1975
+ const { transform: _ } = D;
1875
1976
  if (!_)
1876
1977
  return;
1877
- const { left: E = 0, top: M = 0, width: y = 0, height: T = 0 } = _, { drawingStartX: I, drawingEndX: R, drawingStartY: O, drawingEndY: B } = {
1878
- drawingStartX: E,
1879
- drawingEndX: E + y,
1978
+ const { left: T = 0, top: M = 0, width: y = 0, height: E = 0 } = _, { drawingStartX: I, drawingEndX: R, drawingStartY: O, drawingEndY: B } = {
1979
+ drawingStartX: T,
1980
+ drawingEndX: T + y,
1880
1981
  drawingStartY: M,
1881
- drawingEndY: M + T
1982
+ drawingEndY: M + E
1882
1983
  };
1883
- c <= I && R <= u && d <= O && B <= l && h.push(b);
1984
+ c <= I && R <= u && l <= O && B <= d && h.push(D);
1884
1985
  });
1885
- const f = [], p = [], m = n.startRow - t.startRow, w = n.startColumn - t.startColumn, S = h.map((v) => {
1886
- const b = v.sheetTransform, _ = {
1887
- to: { ...b.to, row: b.to.row + m, column: b.to.column + w },
1888
- from: { ...b.from, row: b.from.row + m, column: b.from.column + w }
1889
- }, E = z(_, this._selectionRenderService, this._skeletonManagerService);
1986
+ const f = [], p = [], m = n.startRow - e.startRow, w = n.startColumn - e.startColumn, S = h.map((v) => {
1987
+ const D = v.sheetTransform, _ = {
1988
+ to: { ...D.to, row: D.to.row + m, column: D.to.column + w },
1989
+ from: { ...D.from, row: D.from.row + m, column: D.from.column + w }
1990
+ }, T = z(_, this._selectionRenderService, this._skeletonManagerService);
1890
1991
  return {
1891
1992
  unitId: r,
1892
1993
  subUnitId: s,
1893
1994
  drawingId: v.drawingId,
1894
- transform: E,
1995
+ transform: T,
1895
1996
  sheetTransform: _
1896
1997
  };
1897
1998
  });
1898
1999
  if (S.length) {
1899
- const v = this._sheetDrawingService.getBatchUpdateOp(S), { undo: b, redo: _, objects: E } = v;
1900
- f.push({ id: A.id, params: { unitId: r, subUnitId: s, op: _, objects: E, type: P.UPDATE } }), p.push({ id: A.id, params: { unitId: r, subUnitId: s, op: b, objects: E, type: P.UPDATE } });
2000
+ const v = this._sheetDrawingService.getBatchUpdateOp(S), { undo: D, redo: _, objects: T } = v;
2001
+ f.push({ id: A.id, params: { unitId: r, subUnitId: s, op: _, objects: T, type: P.UPDATE } }), p.push({ id: A.id, params: { unitId: r, subUnitId: s, op: D, objects: T, type: P.UPDATE } });
1901
2002
  }
1902
2003
  return { redos: f, undos: p };
1903
2004
  }
1904
2005
  _moveRowInterceptor(i, n) {
1905
- const t = this._getUnitIdAndSubUnitId(i, n);
1906
- if (t == null)
2006
+ const e = this._getUnitIdAndSubUnitId(i, n);
2007
+ if (e == null)
1907
2008
  return { redos: [], undos: [] };
1908
- const { unitId: e, subUnitId: r } = t, { range: s } = i, o = s.startRow, a = s.endRow, c = [], u = [], d = this._sheetDrawingService.getDrawingData(e, r), l = [], g = [];
1909
- if (Object.keys(d).forEach((h) => {
1910
- const f = d[h], { sheetTransform: p, transform: m, anchorType: w = U.Position } = f;
2009
+ const { unitId: t, subUnitId: r } = e, { range: s } = i, o = s.startRow, a = s.endRow, c = [], u = [], l = this._sheetDrawingService.getDrawingData(t, r), d = [], g = [];
2010
+ if (Object.keys(l).forEach((h) => {
2011
+ const f = l[h], { sheetTransform: p, transform: m, anchorType: w = U.Position } = f;
1911
2012
  if (p == null || m == null)
1912
2013
  return;
1913
2014
  let S, C;
@@ -1915,9 +2016,9 @@ let an = class extends le {
1915
2016
  const v = this._expandRow(p, m, o, a, w);
1916
2017
  S = v == null ? void 0 : v.newSheetTransform, C = v == null ? void 0 : v.newTransform;
1917
2018
  } else {
1918
- const { from: v, to: b } = p, { row: _ } = v, { row: E } = b;
1919
- if (w === U.Both && _ >= o && E <= a)
1920
- g.push({ unitId: e, subUnitId: r, drawingId: h });
2019
+ const { from: v, to: D } = p, { row: _ } = v, { row: T } = D;
2020
+ if (w === U.Both && _ >= o && T <= a)
2021
+ g.push({ unitId: t, subUnitId: r, drawingId: h });
1921
2022
  else {
1922
2023
  const M = this._shrinkRow(p, m, o, a, w);
1923
2024
  S = M == null ? void 0 : M.newSheetTransform, C = M == null ? void 0 : M.newTransform;
@@ -1925,30 +2026,30 @@ let an = class extends le {
1925
2026
  }
1926
2027
  if (!S || !C)
1927
2028
  return;
1928
- const D = { unitId: e, subUnitId: r, drawingId: h, transform: C, sheetTransform: S };
1929
- l.push(D);
1930
- }), l.length === 0 && g.length === 0)
2029
+ const b = { unitId: t, subUnitId: r, drawingId: h, transform: C, sheetTransform: S };
2030
+ d.push(b);
2031
+ }), d.length === 0 && g.length === 0)
1931
2032
  return { redos: [], undos: [] };
1932
- if (l.length > 0) {
1933
- const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: p, objects: m } = h;
1934
- c.push({ id: A.id, params: { unitId: e, subUnitId: r, op: p, objects: m, type: P.UPDATE } }), u.push({ id: A.id, params: { unitId: e, subUnitId: r, op: f, objects: m, type: P.UPDATE } });
2033
+ if (d.length > 0) {
2034
+ const h = this._sheetDrawingService.getBatchUpdateOp(d), { undo: f, redo: p, objects: m } = h;
2035
+ c.push({ id: A.id, params: { unitId: t, subUnitId: r, op: p, objects: m, type: P.UPDATE } }), u.push({ id: A.id, params: { unitId: t, subUnitId: r, op: f, objects: m, type: P.UPDATE } });
1935
2036
  }
1936
2037
  if (g.length > 0) {
1937
2038
  const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, p = h.redo, m = h.objects;
1938
- c.push({ id: A.id, params: { unitId: e, subUnitId: r, op: p, objects: m, type: P.REMOVE } }), u.push({ id: A.id, params: { unitId: e, subUnitId: r, op: f, objects: m, type: P.INSERT } });
2039
+ c.push({ id: A.id, params: { unitId: t, subUnitId: r, op: p, objects: m, type: P.REMOVE } }), u.push({ id: A.id, params: { unitId: t, subUnitId: r, op: f, objects: m, type: P.INSERT } });
1939
2040
  }
1940
- return c.push({ id: x.id, params: [e] }), u.push({ id: x.id, params: [e] }), {
2041
+ return c.push({ id: L.id, params: [t] }), u.push({ id: L.id, params: [t] }), {
1941
2042
  redos: c,
1942
2043
  undos: u
1943
2044
  };
1944
2045
  }
1945
2046
  _moveColInterceptor(i, n) {
1946
- const t = this._getUnitIdAndSubUnitId(i, n);
1947
- if (t == null)
2047
+ const e = this._getUnitIdAndSubUnitId(i, n);
2048
+ if (e == null)
1948
2049
  return { redos: [], undos: [] };
1949
- const { unitId: e, subUnitId: r } = t, { range: s } = i, o = s.startColumn, a = s.endColumn, c = [], u = [], d = this._sheetDrawingService.getDrawingData(e, r), l = [], g = [];
1950
- if (Object.keys(d).forEach((h) => {
1951
- const f = d[h], { sheetTransform: p, transform: m, anchorType: w = U.Position } = f;
2050
+ const { unitId: t, subUnitId: r } = e, { range: s } = i, o = s.startColumn, a = s.endColumn, c = [], u = [], l = this._sheetDrawingService.getDrawingData(t, r), d = [], g = [];
2051
+ if (Object.keys(l).forEach((h) => {
2052
+ const f = l[h], { sheetTransform: p, transform: m, anchorType: w = U.Position } = f;
1952
2053
  if (p == null || m == null)
1953
2054
  return;
1954
2055
  let S, C;
@@ -1956,9 +2057,9 @@ let an = class extends le {
1956
2057
  const v = this._expandCol(p, m, o, a, w);
1957
2058
  S = v == null ? void 0 : v.newSheetTransform, C = v == null ? void 0 : v.newTransform;
1958
2059
  } else {
1959
- const { from: v, to: b } = p, { column: _ } = v, { column: E } = b;
1960
- if (w === U.Both && _ >= o && E <= a)
1961
- g.push({ unitId: e, subUnitId: r, drawingId: h });
2060
+ const { from: v, to: D } = p, { column: _ } = v, { column: T } = D;
2061
+ if (w === U.Both && _ >= o && T <= a)
2062
+ g.push({ unitId: t, subUnitId: r, drawingId: h });
1962
2063
  else {
1963
2064
  const M = this._shrinkCol(p, m, o, a, w);
1964
2065
  S = M == null ? void 0 : M.newSheetTransform, C = M == null ? void 0 : M.newTransform;
@@ -1966,188 +2067,188 @@ let an = class extends le {
1966
2067
  }
1967
2068
  if (!S || !C)
1968
2069
  return;
1969
- const D = { unitId: e, subUnitId: r, drawingId: h, transform: C, sheetTransform: S };
1970
- l.push(D);
1971
- }), l.length === 0 && g.length === 0)
2070
+ const b = { unitId: t, subUnitId: r, drawingId: h, transform: C, sheetTransform: S };
2071
+ d.push(b);
2072
+ }), d.length === 0 && g.length === 0)
1972
2073
  return { redos: [], undos: [] };
1973
- if (l.length > 0) {
1974
- const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: p, objects: m } = h;
1975
- c.push({ id: A.id, params: { unitId: e, subUnitId: r, op: p, objects: m, type: P.UPDATE } }), u.push({ id: A.id, params: { unitId: e, subUnitId: r, op: f, objects: m, type: P.UPDATE } });
2074
+ if (d.length > 0) {
2075
+ const h = this._sheetDrawingService.getBatchUpdateOp(d), { undo: f, redo: p, objects: m } = h;
2076
+ c.push({ id: A.id, params: { unitId: t, subUnitId: r, op: p, objects: m, type: P.UPDATE } }), u.push({ id: A.id, params: { unitId: t, subUnitId: r, op: f, objects: m, type: P.UPDATE } });
1976
2077
  }
1977
2078
  if (g.length > 0) {
1978
2079
  const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, p = h.redo, m = h.objects;
1979
- c.push({ id: A.id, params: { unitId: e, subUnitId: r, op: p, objects: m, type: P.REMOVE } }), u.push({ id: A.id, params: { unitId: e, subUnitId: r, op: f, objects: m, type: P.INSERT } });
2080
+ c.push({ id: A.id, params: { unitId: t, subUnitId: r, op: p, objects: m, type: P.REMOVE } }), u.push({ id: A.id, params: { unitId: t, subUnitId: r, op: f, objects: m, type: P.INSERT } });
1980
2081
  }
1981
- return c.push({ id: x.id, params: [e] }), u.push({ id: x.id, params: [e] }), { redos: c, undos: u };
2082
+ return c.push({ id: L.id, params: [t] }), u.push({ id: L.id, params: [t] }), { redos: c, undos: u };
1982
2083
  }
1983
- _expandCol(i, n, t, e, r = U.Position) {
1984
- const s = e - t + 1, { from: o, to: a } = i, { column: c } = o, { column: u } = a;
2084
+ _expandCol(i, n, e, t, r = U.Position) {
2085
+ const s = t - e + 1, { from: o, to: a } = i, { column: c } = o, { column: u } = a;
1985
2086
  if (r === U.None)
1986
2087
  return {
1987
2088
  newSheetTransform: $({ ...n }, this._selectionRenderService),
1988
2089
  newTransform: n
1989
2090
  };
1990
- let d = null, l = null;
1991
- if (c >= t) {
1992
- const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: t, endColumn: e, startRow: o.row, endRow: a.row });
2091
+ let l = null, d = null;
2092
+ if (c >= e) {
2093
+ const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: e, endColumn: t, startRow: o.row, endRow: a.row });
1993
2094
  if (g == null)
1994
2095
  return;
1995
- l = { ...n, left: (n.left || 0) + g.endX - g.startX }, d = $(l, this._selectionRenderService);
1996
- } else if (u >= e)
2096
+ d = { ...n, left: (n.left || 0) + g.endX - g.startX }, l = $(d, this._selectionRenderService);
2097
+ } else if (u >= t)
1997
2098
  if (r === U.Both)
1998
- d = {
2099
+ l = {
1999
2100
  from: { ...o },
2000
2101
  to: { ...a, column: u + s }
2001
- }, l = z(d, this._selectionRenderService, this._skeletonManagerService);
2102
+ }, d = z(l, this._selectionRenderService, this._skeletonManagerService);
2002
2103
  else
2003
2104
  return {
2004
2105
  newSheetTransform: $({ ...n }, this._selectionRenderService),
2005
2106
  newTransform: n
2006
2107
  };
2007
- return d != null && l != null ? {
2008
- newSheetTransform: d,
2009
- newTransform: l
2108
+ return l != null && d != null ? {
2109
+ newSheetTransform: l,
2110
+ newTransform: d
2010
2111
  } : null;
2011
2112
  }
2012
- _shrinkCol(i, n, t, e, r = U.Position) {
2013
- const s = e - t + 1, { from: o, to: a } = i, { column: c } = o, { column: u } = a;
2113
+ _shrinkCol(i, n, e, t, r = U.Position) {
2114
+ const s = t - e + 1, { from: o, to: a } = i, { column: c } = o, { column: u } = a;
2014
2115
  if (r === U.None)
2015
2116
  return {
2016
2117
  newSheetTransform: $({ ...n }, this._selectionRenderService),
2017
2118
  newTransform: n
2018
2119
  };
2019
- let d = null, l = null;
2020
- if (c > e)
2021
- d = {
2120
+ let l = null, d = null;
2121
+ if (c > t)
2122
+ l = {
2022
2123
  from: { ...o, column: c - s },
2023
2124
  to: { ...a, column: u - s }
2024
- }, l = z(d, this._selectionRenderService, this._skeletonManagerService);
2125
+ }, d = z(l, this._selectionRenderService, this._skeletonManagerService);
2025
2126
  else {
2026
- if (c >= t && u <= e)
2127
+ if (c >= e && u <= t)
2027
2128
  return null;
2028
- if (c < t && u > e)
2129
+ if (c < e && u > t)
2029
2130
  if (r === U.Both)
2030
- d = {
2131
+ l = {
2031
2132
  from: { ...o },
2032
2133
  to: { ...a, column: u - s }
2033
- }, l = z(d, this._selectionRenderService, this._skeletonManagerService);
2134
+ }, d = z(l, this._selectionRenderService, this._skeletonManagerService);
2034
2135
  else
2035
2136
  return {
2036
2137
  newSheetTransform: $({ ...n }, this._selectionRenderService),
2037
2138
  newTransform: n
2038
2139
  };
2039
- else if (c >= t && c <= e) {
2040
- if (c === t)
2041
- l = { ...n, left: (n.left || 0) - i.from.columnOffset };
2140
+ else if (c >= e && c <= t) {
2141
+ if (c === e)
2142
+ d = { ...n, left: (n.left || 0) - i.from.columnOffset };
2042
2143
  else {
2043
- const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: t, endColumn: c - 1, startRow: o.row, endRow: a.row });
2144
+ const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: e, endColumn: c - 1, startRow: o.row, endRow: a.row });
2044
2145
  if (g == null)
2045
2146
  return;
2046
- l = { ...n, left: (n.left || 0) - g.endX + g.startX - i.from.columnOffset };
2147
+ d = { ...n, left: (n.left || 0) - g.endX + g.startX - i.from.columnOffset };
2047
2148
  }
2048
- d = $(l, this._selectionRenderService);
2049
- } else if (u >= t && u <= e && r === U.Both) {
2149
+ l = $(d, this._selectionRenderService);
2150
+ } else if (u >= e && u <= t && r === U.Both) {
2050
2151
  const g = this._skeletonManagerService.attachRangeWithCoord({
2051
- startColumn: t - 1,
2052
- endColumn: t - 1,
2152
+ startColumn: e - 1,
2153
+ endColumn: e - 1,
2053
2154
  startRow: o.row,
2054
2155
  endRow: a.row
2055
2156
  });
2056
2157
  if (g == null)
2057
2158
  return;
2058
- d = {
2159
+ l = {
2059
2160
  from: { ...o },
2060
- to: { ...a, column: t - 1, columnOffset: g.endX - g.startX }
2061
- }, l = z(d, this._selectionRenderService, this._skeletonManagerService);
2161
+ to: { ...a, column: e - 1, columnOffset: g.endX - g.startX }
2162
+ }, d = z(l, this._selectionRenderService, this._skeletonManagerService);
2062
2163
  }
2063
2164
  }
2064
- return d != null && l != null ? {
2065
- newSheetTransform: d,
2066
- newTransform: l
2165
+ return l != null && d != null ? {
2166
+ newSheetTransform: l,
2167
+ newTransform: d
2067
2168
  } : null;
2068
2169
  }
2069
- _expandRow(i, n, t, e, r = U.Position) {
2070
- const s = e - t + 1, { from: o, to: a } = i, { row: c } = o, { row: u } = a;
2170
+ _expandRow(i, n, e, t, r = U.Position) {
2171
+ const s = t - e + 1, { from: o, to: a } = i, { row: c } = o, { row: u } = a;
2071
2172
  if (r === U.None)
2072
2173
  return {
2073
2174
  newSheetTransform: $({ ...n }, this._selectionRenderService),
2074
2175
  newTransform: n
2075
2176
  };
2076
- let d = null, l = null;
2077
- if (c >= t) {
2078
- const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: t, endRow: e, startColumn: o.column, endColumn: a.column });
2177
+ let l = null, d = null;
2178
+ if (c >= e) {
2179
+ const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: e, endRow: t, startColumn: o.column, endColumn: a.column });
2079
2180
  if (g == null)
2080
2181
  return;
2081
- l = { ...n, top: (n.top || 0) + g.endY - g.startY }, d = $(l, this._selectionRenderService);
2082
- } else if (u >= e)
2182
+ d = { ...n, top: (n.top || 0) + g.endY - g.startY }, l = $(d, this._selectionRenderService);
2183
+ } else if (u >= t)
2083
2184
  if (r === U.Both)
2084
- d = {
2185
+ l = {
2085
2186
  from: { ...o },
2086
2187
  to: {
2087
2188
  ...a,
2088
2189
  row: u + s
2089
2190
  }
2090
- }, l = z(d, this._selectionRenderService, this._skeletonManagerService);
2191
+ }, d = z(l, this._selectionRenderService, this._skeletonManagerService);
2091
2192
  else
2092
2193
  return {
2093
2194
  newSheetTransform: $({ ...n }, this._selectionRenderService),
2094
2195
  newTransform: n
2095
2196
  };
2096
- return d != null && l != null ? {
2097
- newSheetTransform: d,
2098
- newTransform: l
2197
+ return l != null && d != null ? {
2198
+ newSheetTransform: l,
2199
+ newTransform: d
2099
2200
  } : null;
2100
2201
  }
2101
- _shrinkRow(i, n, t, e, r = U.Position) {
2102
- const s = e - t + 1, { from: o, to: a } = i, { row: c } = o, { row: u } = a;
2202
+ _shrinkRow(i, n, e, t, r = U.Position) {
2203
+ const s = t - e + 1, { from: o, to: a } = i, { row: c } = o, { row: u } = a;
2103
2204
  if (r === U.None)
2104
2205
  return {
2105
2206
  newSheetTransform: $({ ...n }, this._selectionRenderService),
2106
2207
  newTransform: n
2107
2208
  };
2108
- let d = null, l = null;
2109
- if (c > e)
2110
- d = {
2209
+ let l = null, d = null;
2210
+ if (c > t)
2211
+ l = {
2111
2212
  from: { ...o, row: c - s },
2112
2213
  to: { ...a, row: u - s }
2113
- }, l = z(d, this._selectionRenderService, this._skeletonManagerService);
2214
+ }, d = z(l, this._selectionRenderService, this._skeletonManagerService);
2114
2215
  else {
2115
- if (c >= t && u <= e)
2216
+ if (c >= e && u <= t)
2116
2217
  return null;
2117
- if (c < t && u > e)
2218
+ if (c < e && u > t)
2118
2219
  if (r === U.Both)
2119
- d = {
2220
+ l = {
2120
2221
  from: { ...o },
2121
2222
  to: { ...a, row: u - s }
2122
- }, l = z(d, this._selectionRenderService, this._skeletonManagerService);
2223
+ }, d = z(l, this._selectionRenderService, this._skeletonManagerService);
2123
2224
  else
2124
2225
  return {
2125
2226
  newSheetTransform: $({ ...n }, this._selectionRenderService),
2126
2227
  newTransform: n
2127
2228
  };
2128
- else if (c >= t && c <= e) {
2129
- if (c === t)
2130
- l = { ...n, top: (n.top || 0) - i.from.rowOffset };
2229
+ else if (c >= e && c <= t) {
2230
+ if (c === e)
2231
+ d = { ...n, top: (n.top || 0) - i.from.rowOffset };
2131
2232
  else {
2132
- const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: t, endRow: c - 1, startColumn: o.column, endColumn: a.column });
2233
+ const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: e, endRow: c - 1, startColumn: o.column, endColumn: a.column });
2133
2234
  if (g == null)
2134
2235
  return;
2135
- l = { ...n, top: (n.top || 0) - g.endY + g.startY - i.from.rowOffset };
2236
+ d = { ...n, top: (n.top || 0) - g.endY + g.startY - i.from.rowOffset };
2136
2237
  }
2137
- d = $(l, this._selectionRenderService);
2138
- } else if (u >= t && u <= e && r === U.Both) {
2139
- const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: t - 1, endRow: t - 1 });
2238
+ l = $(d, this._selectionRenderService);
2239
+ } else if (u >= e && u <= t && r === U.Both) {
2240
+ const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: e - 1, endRow: e - 1 });
2140
2241
  if (g == null)
2141
2242
  return;
2142
- d = {
2243
+ l = {
2143
2244
  from: { ...o },
2144
- to: { ...a, row: t - 1, rowOffset: g.endY - g.startY }
2145
- }, l = z(d, this._selectionRenderService, this._skeletonManagerService);
2245
+ to: { ...a, row: e - 1, rowOffset: g.endY - g.startY }
2246
+ }, d = z(l, this._selectionRenderService, this._skeletonManagerService);
2146
2247
  }
2147
2248
  }
2148
- return d != null && l != null ? {
2149
- newSheetTransform: d,
2150
- newTransform: l
2249
+ return l != null && d != null ? {
2250
+ newSheetTransform: l,
2251
+ newTransform: d
2151
2252
  } : null;
2152
2253
  }
2153
2254
  _commandListener() {
@@ -2156,78 +2257,78 @@ let an = class extends le {
2156
2257
  // but the skeleton changes like other render modules. These two signals are not equivalent.
2157
2258
  // As a temp solution, I subscribed to activate$ here.
2158
2259
  this._commandService.onCommandExecuted((i) => {
2159
- if (i.id === Ji.id) {
2160
- const { unitId: n, subUnitId: t } = i.params;
2161
- this._updateDrawings(n, t);
2260
+ if (i.id === ts.id) {
2261
+ const { unitId: n, subUnitId: e } = i.params;
2262
+ this._updateDrawings(n, e);
2162
2263
  }
2163
2264
  })
2164
2265
  ), this.disposeWithMe(
2165
2266
  this._context.activated$.subscribe((i) => {
2166
- const { unit: n, unitId: t } = this._context;
2267
+ const { unit: n, unitId: e } = this._context;
2167
2268
  if (i) {
2168
- const e = n.getActiveSheet().getSheetId();
2169
- this._updateDrawings(t, e);
2269
+ const t = n.getActiveSheet().getSheetId();
2270
+ this._updateDrawings(e, t);
2170
2271
  } else
2171
- this._clearDrawings(t);
2272
+ this._clearDrawings(e);
2172
2273
  })
2173
2274
  );
2174
2275
  }
2175
2276
  _clearDrawings(i) {
2176
2277
  setTimeout(() => {
2177
- const n = this._drawingManagerService.drawingManagerData, t = [];
2178
- Object.keys(n).forEach((e) => {
2179
- const r = n[e];
2278
+ const n = this._drawingManagerService.drawingManagerData, e = [];
2279
+ Object.keys(n).forEach((t) => {
2280
+ const r = n[t];
2180
2281
  r != null && Object.keys(r).forEach((s) => {
2181
2282
  const o = r[s].data;
2182
2283
  o != null && Object.keys(o).forEach((a) => {
2183
- e === i && t.push(o[a]);
2284
+ t === i && e.push(o[a]);
2184
2285
  });
2185
2286
  });
2186
- }), this._drawingManagerService.removeNotification(t);
2287
+ }), this._drawingManagerService.removeNotification(e);
2187
2288
  });
2188
2289
  }
2189
2290
  _updateDrawings(i, n) {
2190
2291
  setTimeout(() => {
2191
- const t = this._drawingManagerService.drawingManagerData, e = [], r = [];
2192
- Object.keys(t).forEach((s) => {
2193
- const o = t[s];
2292
+ const e = this._drawingManagerService.drawingManagerData, t = [], r = [];
2293
+ Object.keys(e).forEach((s) => {
2294
+ const o = e[s];
2194
2295
  o != null && Object.keys(o).forEach((a) => {
2195
2296
  const c = o[a].data;
2196
2297
  c != null && Object.keys(c).forEach((u) => {
2197
2298
  if (s === i && a === n) {
2198
- const d = c[u];
2199
- d.transform = z(d.sheetTransform, this._selectionRenderService, this._skeletonManagerService), e.push(c[u]);
2299
+ const l = c[u];
2300
+ l.transform = z(l.sheetTransform, this._selectionRenderService, this._skeletonManagerService), t.push(c[u]);
2200
2301
  } else
2201
2302
  r.push(c[u]);
2202
2303
  });
2203
2304
  });
2204
- }), this._drawingManagerService.removeNotification(r), this._drawingManagerService.addNotification(e);
2305
+ }), this._drawingManagerService.removeNotification(r), this._drawingManagerService.addNotification(t);
2205
2306
  }, 0);
2206
2307
  }
2207
2308
  _sheetRefreshListener() {
2208
2309
  this.disposeWithMe(
2209
2310
  this._commandService.onCommandExecuted((i) => {
2210
- $s.includes(i.id) && requestIdleCallback(() => {
2211
- const n = i.params, { unitId: t, subUnitId: e, ranges: r } = n;
2212
- this._refreshDrawingTransform(t, e, r);
2311
+ Fs.includes(i.id) && requestIdleCallback(() => {
2312
+ const n = i.params, { unitId: e, subUnitId: t, ranges: r } = n;
2313
+ this._refreshDrawingTransform(e, t, r);
2213
2314
  });
2214
2315
  })
2215
2316
  );
2216
2317
  }
2217
- _refreshDrawingTransform(i, n, t) {
2218
- const e = this._drawingManagerService.getDrawingData(i, n), r = [];
2219
- Object.keys(e).forEach((s) => {
2220
- const o = e[s], { sheetTransform: a, transform: c, anchorType: u = U.Position } = o;
2318
+ _refreshDrawingTransform(i, n, e) {
2319
+ const t = this._drawingManagerService.getDrawingData(i, n), r = [];
2320
+ Object.keys(t).forEach((s) => {
2321
+ const o = t[s], { sheetTransform: a, transform: c, anchorType: u = U.Position } = o;
2221
2322
  if (u === U.None)
2222
2323
  return !0;
2223
- const { from: d, to: l } = a, { row: g, column: h } = d, { row: f, column: p } = l;
2224
- for (let m = 0; m < t.length; m++) {
2225
- const w = t[m], { startRow: S, endRow: C, startColumn: D, endColumn: v } = w;
2226
- if (Xr.intersects(
2324
+ const { from: l, to: d } = a, { row: g, column: h } = l, { row: f, column: p } = d;
2325
+ for (let m = 0; m < e.length; m++) {
2326
+ const w = e[m], { startRow: S, endRow: C, startColumn: b, endColumn: v } = w;
2327
+ if (zr.intersects(
2227
2328
  {
2228
2329
  startRow: S,
2229
2330
  endRow: C,
2230
- startColumn: D,
2331
+ startColumn: b,
2231
2332
  endColumn: v
2232
2333
  },
2233
2334
  {
@@ -2237,99 +2338,99 @@ let an = class extends le {
2237
2338
  endColumn: p
2238
2339
  }
2239
2340
  ) || g > C || h > v) {
2240
- const b = u === U.Position, _ = z(a, this._selectionRenderService, this._skeletonManagerService);
2341
+ const D = u === U.Position, _ = z(a, this._selectionRenderService, this._skeletonManagerService);
2241
2342
  r.push({
2242
2343
  ...o,
2243
2344
  transform: {
2244
2345
  ..._,
2245
- width: b ? c == null ? void 0 : c.width : _ == null ? void 0 : _.width,
2246
- height: b ? c == null ? void 0 : c.height : _ == null ? void 0 : _.height
2346
+ width: D ? c == null ? void 0 : c.width : _ == null ? void 0 : _.width,
2347
+ height: D ? c == null ? void 0 : c.height : _ == null ? void 0 : _.height
2247
2348
  }
2248
2349
  });
2249
2350
  break;
2250
2351
  }
2251
2352
  }
2252
- }), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(x.id, [i]));
2353
+ }), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(L.id, [i]));
2253
2354
  }
2254
2355
  };
2255
- an = Ws([
2356
+ dn = xs([
2256
2357
  _e(1, ne),
2257
2358
  _e(2, G),
2258
2359
  _e(3, Xe),
2259
2360
  _e(4, N(V)),
2260
- _e(5, N(Lt)),
2361
+ _e(5, N(Ft)),
2261
2362
  _e(6, ae),
2262
2363
  _e(7, oe),
2263
- _e(8, Ge)
2264
- ], an);
2364
+ _e(8, Ce)
2365
+ ], dn);
2265
2366
  var se = function() {
2266
2367
  return se = Object.assign || function(i) {
2267
- for (var n, t = 1, e = arguments.length; t < e; t++) {
2268
- n = arguments[t];
2368
+ for (var n, e = 1, t = arguments.length; e < t; e++) {
2369
+ n = arguments[e];
2269
2370
  for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (i[r] = n[r]);
2270
2371
  }
2271
2372
  return i;
2272
2373
  }, se.apply(this, arguments);
2273
- }, xs = function(i, n) {
2274
- var t = {};
2275
- for (var e in i) Object.prototype.hasOwnProperty.call(i, e) && n.indexOf(e) < 0 && (t[e] = i[e]);
2374
+ }, Ys = function(i, n) {
2375
+ var e = {};
2376
+ for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && n.indexOf(t) < 0 && (e[t] = i[t]);
2276
2377
  if (i != null && typeof Object.getOwnPropertySymbols == "function")
2277
- for (var r = 0, e = Object.getOwnPropertySymbols(i); r < e.length; r++)
2278
- n.indexOf(e[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, e[r]) && (t[e[r]] = i[e[r]]);
2279
- return t;
2280
- }, _r = cr(function(i, n) {
2281
- var t = i.icon, e = i.id, r = i.className, s = i.extend, o = xs(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(e, " ").concat(r || "").trim(), c = ns("_".concat(Ys()));
2282
- return vr(t, "".concat(e), { defIds: t.defIds, idSuffix: c.current }, se({ ref: n, className: a }, o), s);
2378
+ for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
2379
+ n.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (e[t[r]] = i[t[r]]);
2380
+ return e;
2381
+ }, Tr = Sr(function(i, n) {
2382
+ var e = i.icon, t = i.id, r = i.className, s = i.extend, o = Ys(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), c = os("_".concat(Vs()));
2383
+ return Or(e, "".concat(t), { defIds: e.defIds, idSuffix: c.current }, se({ ref: n, className: a }, o), s);
2283
2384
  });
2284
- function vr(i, n, t, e, r) {
2285
- return dr(i.tag, se(se({ key: n }, Ls(i, t, r)), e), (Fs(i, t).children || []).map(function(s, o) {
2286
- return vr(s, "".concat(n, "-").concat(i.tag, "-").concat(o), t, void 0, r);
2385
+ function Or(i, n, e, t, r) {
2386
+ return Ir(i.tag, se(se({ key: n }, Gs(i, e, r)), t), (Xs(i, e).children || []).map(function(s, o) {
2387
+ return Or(s, "".concat(n, "-").concat(i.tag, "-").concat(o), e, void 0, r);
2287
2388
  }));
2288
2389
  }
2289
- function Ls(i, n, t) {
2290
- var e = se({}, i.attrs);
2291
- t != null && t.colorChannel1 && e.fill === "colorChannel1" && (e.fill = t.colorChannel1), i.tag === "mask" && e.id && (e.id = e.id + n.idSuffix), Object.entries(e).forEach(function(s) {
2390
+ function Gs(i, n, e) {
2391
+ var t = se({}, i.attrs);
2392
+ e != null && e.colorChannel1 && t.fill === "colorChannel1" && (t.fill = e.colorChannel1), i.tag === "mask" && t.id && (t.id = t.id + n.idSuffix), Object.entries(t).forEach(function(s) {
2292
2393
  var o = s[0], a = s[1];
2293
- o === "mask" && typeof a == "string" && (e[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
2394
+ o === "mask" && typeof a == "string" && (t[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
2294
2395
  });
2295
2396
  var r = n.defIds;
2296
- return !r || r.length === 0 || (i.tag === "use" && e["xlink:href"] && (e["xlink:href"] = e["xlink:href"] + n.idSuffix), Object.entries(e).forEach(function(s) {
2397
+ return !r || r.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + n.idSuffix), Object.entries(t).forEach(function(s) {
2297
2398
  var o = s[0], a = s[1];
2298
- typeof a == "string" && (e[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
2299
- })), e;
2399
+ typeof a == "string" && (t[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
2400
+ })), t;
2300
2401
  }
2301
- function Fs(i, n) {
2302
- var t, e = n.defIds;
2303
- return !e || e.length === 0 ? i : i.tag === "defs" && (!((t = i.children) === null || t === void 0) && t.length) ? se(se({}, i), { children: i.children.map(function(r) {
2304
- return typeof r.attrs.id == "string" && e && e.indexOf(r.attrs.id) > -1 ? se(se({}, r), { attrs: se(se({}, r.attrs), { id: r.attrs.id + n.idSuffix }) }) : r;
2402
+ function Xs(i, n) {
2403
+ var e, t = n.defIds;
2404
+ return !t || t.length === 0 ? i : i.tag === "defs" && (!((e = i.children) === null || e === void 0) && e.length) ? se(se({}, i), { children: i.children.map(function(r) {
2405
+ return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? se(se({}, r), { attrs: se(se({}, r.attrs), { id: r.attrs.id + n.idSuffix }) }) : r;
2305
2406
  }) }) : i;
2306
2407
  }
2307
- function Ys() {
2408
+ function Vs() {
2308
2409
  return Math.random().toString(36).substring(2, 8);
2309
2410
  }
2310
- _r.displayName = "UniverIcon";
2311
- var Gs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, Sr = cr(function(i, n) {
2312
- return dr(_r, Object.assign({}, i, {
2411
+ Tr.displayName = "UniverIcon";
2412
+ var Hs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, Ur = Sr(function(i, n) {
2413
+ return Ir(Tr, Object.assign({}, i, {
2313
2414
  id: "add-image-single",
2314
2415
  ref: n,
2315
- icon: Gs
2416
+ icon: Hs
2316
2417
  }));
2317
2418
  });
2318
- Sr.displayName = "AddImageSingle";
2319
- const Ir = {
2419
+ Ur.displayName = "AddImageSingle";
2420
+ const Pr = {
2320
2421
  id: "sheet.command.delete-drawing",
2321
2422
  type: te.COMMAND,
2322
2423
  handler: (i) => {
2323
- const n = i.get(G), e = i.get(ae).getFocusDrawings();
2324
- if (e.length === 0)
2424
+ const n = i.get(G), t = i.get(ae).getFocusDrawings();
2425
+ if (t.length === 0)
2325
2426
  return !1;
2326
- const r = e[0].unitId, s = e.map((o) => {
2327
- const { unitId: a, subUnitId: c, drawingId: u, drawingType: d } = o;
2427
+ const r = t[0].unitId, s = t.map((o) => {
2428
+ const { unitId: a, subUnitId: c, drawingId: u, drawingType: l } = o;
2328
2429
  return {
2329
2430
  unitId: a,
2330
2431
  subUnitId: c,
2331
2432
  drawingId: u,
2332
- drawingType: d
2433
+ drawingType: l
2333
2434
  };
2334
2435
  });
2335
2436
  return n.executeCommand(nt.id, {
@@ -2341,263 +2442,250 @@ const Ir = {
2341
2442
  id: "sheet.command.move-drawing",
2342
2443
  type: te.COMMAND,
2343
2444
  handler: (i, n) => {
2344
- const t = i.get(G), e = i.get(ae), r = i.get(Xe), { direction: s } = n, o = e.getFocusDrawings();
2445
+ const e = i.get(G), t = i.get(ae), r = i.get(Xe), { direction: s } = n, o = t.getFocusDrawings();
2345
2446
  if (o.length === 0)
2346
2447
  return !1;
2347
- const a = o[0].unitId, c = o.map((d) => {
2348
- const { transform: l } = d;
2349
- if (l == null)
2448
+ const a = o[0].unitId, c = o.map((l) => {
2449
+ const { transform: d } = l;
2450
+ if (d == null)
2350
2451
  return null;
2351
- const g = { ...l }, { left: h = 0, top: f = 0 } = l;
2452
+ const g = { ...d }, { left: h = 0, top: f = 0 } = d;
2352
2453
  return s === Ie.UP ? g.top = f - 1 : s === Ie.DOWN ? g.top = f + 1 : s === Ie.LEFT ? g.left = h - 1 : s === Ie.RIGHT && (g.left = h + 1), {
2353
- ...d,
2454
+ ...l,
2354
2455
  transform: g,
2355
2456
  sheetTransform: $(g, r)
2356
2457
  };
2357
- }).filter((d) => d != null);
2358
- return t.syncExecuteCommand(Yt.id, {
2458
+ }).filter((l) => l != null);
2459
+ return e.syncExecuteCommand(Gt.id, {
2359
2460
  unitId: a,
2360
2461
  drawings: c
2361
- }) ? (t.syncExecuteCommand(x.id, [a]), !0) : !1;
2462
+ }) ? (e.syncExecuteCommand(L.id, [a]), !0) : !1;
2362
2463
  }
2363
- }, Cr = "addition-and-subtraction-single", br = "sheet.menu.image";
2364
- function Xs(i) {
2464
+ }, Ar = "addition-and-subtraction-single", Nr = "sheet.menu.image";
2465
+ function zs(i) {
2365
2466
  return {
2366
- id: br,
2367
- type: cn.SUBITEMS,
2368
- icon: Cr,
2467
+ id: Nr,
2468
+ type: un.SUBITEMS,
2469
+ icon: Ar,
2369
2470
  tooltip: "sheetImage.title",
2370
- hidden$: Ln(i, F.UNIVER_SHEET),
2371
- disabled$: Ri(i, { workbookTypes: [Qt], worksheetTypes: [en], rangeTypes: [qi] })
2471
+ hidden$: ln(i, F.UNIVER_SHEET),
2472
+ disabled$: Ti(i, { workbookTypes: [en], worksheetTypes: [tn], rangeTypes: [ns] })
2372
2473
  };
2373
2474
  }
2374
- function Vs(i) {
2475
+ function Ks(i) {
2375
2476
  return {
2376
- id: Gt.id,
2477
+ id: Xt.id,
2377
2478
  title: "sheetImage.upload.float",
2378
- type: cn.BUTTON,
2379
- hidden$: Ln(i, F.UNIVER_SHEET)
2479
+ type: un.BUTTON,
2480
+ hidden$: ln(i, F.UNIVER_SHEET)
2380
2481
  };
2381
2482
  }
2382
- function Hs(i) {
2483
+ function Zs(i) {
2383
2484
  return {
2384
- id: un.id,
2485
+ id: fn.id,
2385
2486
  title: "sheetImage.upload.cell",
2386
- type: cn.BUTTON
2487
+ type: un.BUTTON,
2488
+ hidden$: ln(i, F.UNIVER_SHEET)
2387
2489
  };
2388
2490
  }
2389
- const zs = "univer-image-common-panel", Ks = "univer-image-common-panel-grid", Zs = "univer-image-common-panel-border", Js = "univer-image-common-panel-title", qs = "univer-image-common-panel-row", Qs = "univer-image-common-panel-column", ve = {
2390
- imageCommonPanel: zs,
2391
- imageCommonPanelGrid: Ks,
2392
- imageCommonPanelBorder: Zs,
2393
- imageCommonPanelTitle: Js,
2394
- imageCommonPanelRow: qs,
2395
- imageCommonPanelColumn: Qs
2396
- };
2397
- function Rr(i) {
2398
- var n, t, e = "";
2399
- if (typeof i == "string" || typeof i == "number") e += i;
2400
- else if (typeof i == "object") if (Array.isArray(i)) {
2401
- var r = i.length;
2402
- for (n = 0; n < r; n++) i[n] && (t = Rr(i[n])) && (e && (e += " "), e += t);
2403
- } else for (t in i) i[t] && (e && (e += " "), e += t);
2404
- return e;
2405
- }
2406
- function Dt() {
2407
- for (var i, n, t = 0, e = "", r = arguments.length; t < r; t++) (i = arguments[t]) && (n = Rr(i)) && (e && (e += " "), e += n);
2408
- return e;
2409
- }
2410
- const eo = (i) => {
2491
+ const Js = "univer-image-common-panel", qs = "univer-image-common-panel-grid", Qs = "univer-image-common-panel-border", eo = "univer-image-common-panel-title", to = "univer-image-common-panel-row", no = "univer-image-common-panel-column", ve = {
2492
+ imageCommonPanel: Js,
2493
+ imageCommonPanelGrid: qs,
2494
+ imageCommonPanelBorder: Qs,
2495
+ imageCommonPanelTitle: eo,
2496
+ imageCommonPanelRow: to,
2497
+ imageCommonPanelColumn: no
2498
+ }, ro = (i) => {
2411
2499
  var C;
2412
- const n = Te(G), t = Te($t), e = Te(oe), r = Te(ne), { drawings: s } = i, o = s[0];
2500
+ const n = Te(G), e = Te(xt), t = Te(oe), r = Te(ne), { drawings: s } = i, o = s[0];
2413
2501
  if (o == null)
2414
2502
  return;
2415
2503
  const { unitId: a } = o, c = r.getRenderById(a), u = c == null ? void 0 : c.scene;
2416
2504
  if (u == null)
2417
2505
  return;
2418
- const d = u.getTransformerByCreate(), [l, g] = rn(!0), h = (C = o.anchorType) != null ? C : U.Position, [f, p] = rn(h);
2419
- function m(D, v) {
2420
- const b = [];
2421
- return D.forEach((_) => {
2422
- const { oKey: E } = _, M = v.getDrawingOKey(E);
2506
+ const l = u.getTransformerByCreate(), [d, g] = sn(!0), h = (C = o.anchorType) != null ? C : U.Position, [f, p] = sn(h);
2507
+ function m(b, v) {
2508
+ const D = [];
2509
+ return b.forEach((_) => {
2510
+ const { oKey: T } = _, M = v.getDrawingOKey(T);
2423
2511
  if (M == null)
2424
- return b.push(null), !0;
2425
- const { unitId: y, subUnitId: T, drawingId: I, drawingType: R, anchorType: O, sheetTransform: B } = M;
2426
- b.push({
2512
+ return D.push(null), !0;
2513
+ const { unitId: y, subUnitId: E, drawingId: I, drawingType: R, anchorType: O, sheetTransform: B } = M;
2514
+ D.push({
2427
2515
  unitId: y,
2428
- subUnitId: T,
2516
+ subUnitId: E,
2429
2517
  drawingId: I,
2430
2518
  anchorType: O,
2431
2519
  sheetTransform: B,
2432
2520
  drawingType: R
2433
2521
  });
2434
- }), b;
2522
+ }), D;
2435
2523
  }
2436
- ln(() => {
2437
- const D = d.clearControl$.subscribe((b) => {
2438
- b === !0 && g(!1);
2439
- }), v = d.changeStart$.subscribe((b) => {
2524
+ gn(() => {
2525
+ const b = l.clearControl$.subscribe((D) => {
2526
+ D === !0 && g(!1);
2527
+ }), v = l.changeStart$.subscribe((D) => {
2440
2528
  var M;
2441
- const { objects: _ } = b, E = m(_, e);
2442
- if (E.length === 0)
2529
+ const { objects: _ } = D, T = m(_, t);
2530
+ if (T.length === 0)
2443
2531
  g(!1);
2444
- else if (E.length >= 1) {
2532
+ else if (T.length >= 1) {
2445
2533
  g(!0);
2446
- const y = ((M = E[0]) == null ? void 0 : M.anchorType) || U.Position;
2534
+ const y = ((M = T[0]) == null ? void 0 : M.anchorType) || U.Position;
2447
2535
  p(y);
2448
2536
  }
2449
2537
  });
2450
2538
  return () => {
2451
- v.unsubscribe(), D.unsubscribe();
2539
+ v.unsubscribe(), b.unsubscribe();
2452
2540
  };
2453
2541
  }, []);
2454
- function w(D) {
2455
- p(D);
2456
- const v = e.getFocusDrawings();
2542
+ function w(b) {
2543
+ p(b);
2544
+ const v = t.getFocusDrawings();
2457
2545
  if (v.length === 0)
2458
2546
  return;
2459
- const b = v.map((_) => ({
2547
+ const D = v.map((_) => ({
2460
2548
  unitId: _.unitId,
2461
2549
  subUnitId: _.subUnitId,
2462
2550
  drawingId: _.drawingId,
2463
- anchorType: D
2551
+ anchorType: b
2464
2552
  }));
2465
- n.executeCommand(Yt.id, {
2553
+ n.executeCommand(Gt.id, {
2466
2554
  unitId: v[0].unitId,
2467
- drawings: b
2555
+ drawings: D
2468
2556
  });
2469
2557
  }
2470
- const S = (D) => D ? "block" : "none";
2471
- return /* @__PURE__ */ Tt("div", { className: Dt(ve.imageCommonPanelGrid, ve.imageCommonPanelBorder), style: { display: S(l) }, children: [
2472
- /* @__PURE__ */ ee("div", { className: ve.imageCommonPanelRow, children: /* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelColumn, ve.imageCommonPanelTitle), children: /* @__PURE__ */ ee("div", { children: t.t("drawing-anchor.title") }) }) }),
2473
- /* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelRow), children: /* @__PURE__ */ ee("div", { className: Dt(ve.imageCommonPanelColumn), children: /* @__PURE__ */ Tt(ss, { value: f, onChange: w, direction: "vertical", children: [
2474
- /* @__PURE__ */ ee(Jt, { value: U.Both, children: t.t("drawing-anchor.both") }),
2475
- /* @__PURE__ */ ee(Jt, { value: U.Position, children: t.t("drawing-anchor.position") }),
2476
- /* @__PURE__ */ ee(Jt, { value: U.None, children: t.t("drawing-anchor.none") })
2558
+ const S = (b) => b ? "block" : "none";
2559
+ return /* @__PURE__ */ Tt("div", { className: It(ve.imageCommonPanelGrid, ve.imageCommonPanelBorder), style: { display: S(d) }, children: [
2560
+ /* @__PURE__ */ ee("div", { className: ve.imageCommonPanelRow, children: /* @__PURE__ */ ee("div", { className: It(ve.imageCommonPanelColumn, ve.imageCommonPanelTitle), children: /* @__PURE__ */ ee("div", { children: e.t("drawing-anchor.title") }) }) }),
2561
+ /* @__PURE__ */ ee("div", { className: It(ve.imageCommonPanelRow), children: /* @__PURE__ */ ee("div", { className: It(ve.imageCommonPanelColumn), children: /* @__PURE__ */ Tt(cs, { value: f, onChange: w, direction: "vertical", children: [
2562
+ /* @__PURE__ */ ee(qt, { value: U.Both, children: e.t("drawing-anchor.both") }),
2563
+ /* @__PURE__ */ ee(qt, { value: U.Position, children: e.t("drawing-anchor.position") }),
2564
+ /* @__PURE__ */ ee(qt, { value: U.None, children: e.t("drawing-anchor.none") })
2477
2565
  ] }) }) })
2478
2566
  ] });
2479
- }, to = () => {
2480
- const i = Te(oe), n = i.getFocusDrawings(), [t, e] = rn(n);
2481
- return ln(() => {
2567
+ }, io = () => {
2568
+ const i = Te(oe), n = i.getFocusDrawings(), [e, t] = sn(n);
2569
+ return gn(() => {
2482
2570
  const r = i.focus$.subscribe((s) => {
2483
- e(s);
2571
+ t(s);
2484
2572
  });
2485
2573
  return () => {
2486
2574
  r.unsubscribe();
2487
2575
  };
2488
- }, []), !!(t != null && t.length) && /* @__PURE__ */ Tt("div", { className: ve.imageCommonPanel, children: [
2489
- /* @__PURE__ */ ee(ui, { drawings: t }),
2490
- /* @__PURE__ */ ee(eo, { drawings: t })
2576
+ }, []), !!(e != null && e.length) && /* @__PURE__ */ Tt("div", { className: ve.imageCommonPanel, children: [
2577
+ /* @__PURE__ */ ee(fi, { drawings: e }),
2578
+ /* @__PURE__ */ ee(ro, { drawings: e })
2491
2579
  ] });
2492
- }, no = {
2493
- [Ai.FORMULAS_INSERT]: {
2494
- [br]: {
2580
+ }, so = {
2581
+ [ji.FORMULAS_INSERT]: {
2582
+ [Nr]: {
2495
2583
  order: 3,
2496
- menuItemFactory: Xs,
2497
- [Gt.id]: {
2584
+ menuItemFactory: zs,
2585
+ [Xt.id]: {
2498
2586
  order: 0,
2499
- menuItemFactory: Vs
2587
+ menuItemFactory: Ks
2500
2588
  },
2501
- [un.id]: {
2589
+ [fn.id]: {
2502
2590
  order: 1,
2503
- menuItemFactory: Hs
2591
+ menuItemFactory: Zs
2504
2592
  }
2505
2593
  }
2506
2594
  }
2507
2595
  };
2508
2596
  function it(i) {
2509
- return !i.getContextValue(Vr) && !i.getContextValue(Hr) && !i.getContextValue(zr) && i.getContextValue(Le);
2597
+ return !i.getContextValue(Kr) && !i.getContextValue(Zr) && !i.getContextValue(Jr) && i.getContextValue(Fe);
2510
2598
  }
2511
- const ro = {
2599
+ const oo = {
2512
2600
  id: rt.id,
2513
2601
  description: "shortcut.sheet.drawing-move-down",
2514
2602
  group: "4_sheet-drawing-view",
2515
- binding: Fe.ARROW_DOWN,
2603
+ binding: Ye.ARROW_DOWN,
2516
2604
  priority: 100,
2517
2605
  preconditions: it,
2518
2606
  staticParameters: {
2519
2607
  direction: Ie.DOWN
2520
2608
  }
2521
- }, io = {
2609
+ }, ao = {
2522
2610
  id: rt.id,
2523
2611
  description: "shortcut.sheet.drawing-move-up",
2524
2612
  group: "4_sheet-drawing-view",
2525
- binding: Fe.ARROW_UP,
2613
+ binding: Ye.ARROW_UP,
2526
2614
  priority: 100,
2527
2615
  preconditions: it,
2528
2616
  staticParameters: {
2529
2617
  direction: Ie.UP
2530
2618
  }
2531
- }, so = {
2619
+ }, co = {
2532
2620
  id: rt.id,
2533
2621
  description: "shortcut.sheet.drawing-move-left",
2534
2622
  group: "4_sheet-drawing-view",
2535
- binding: Fe.ARROW_LEFT,
2623
+ binding: Ye.ARROW_LEFT,
2536
2624
  priority: 100,
2537
2625
  preconditions: it,
2538
2626
  staticParameters: {
2539
2627
  direction: Ie.LEFT
2540
2628
  }
2541
- }, oo = {
2629
+ }, lo = {
2542
2630
  id: rt.id,
2543
2631
  description: "shortcut.sheet.drawing-move-right",
2544
2632
  group: "4_sheet-drawing-view",
2545
- binding: Fe.ARROW_RIGHT,
2633
+ binding: Ye.ARROW_RIGHT,
2546
2634
  priority: 100,
2547
2635
  preconditions: it,
2548
2636
  staticParameters: {
2549
2637
  direction: Ie.RIGHT
2550
2638
  }
2551
- }, ao = {
2552
- id: Ir.id,
2639
+ }, uo = {
2640
+ id: Pr.id,
2553
2641
  description: "shortcut.sheet.drawing-delete",
2554
2642
  group: "4_sheet-drawing-view",
2555
2643
  // when focusing on any other input tag do not trigger this shortcut
2556
2644
  preconditions: it,
2557
- binding: Fe.DELETE,
2558
- mac: Fe.BACKSPACE
2645
+ binding: Ye.DELETE,
2646
+ mac: Ye.BACKSPACE
2559
2647
  };
2560
- var co = Object.getOwnPropertyDescriptor, lo = (i, n, t, e) => {
2561
- for (var r = e > 1 ? void 0 : e ? co(n, t) : n, s = i.length - 1, o; s >= 0; s--)
2648
+ var ho = Object.getOwnPropertyDescriptor, go = (i, n, e, t) => {
2649
+ for (var r = t > 1 ? void 0 : t ? ho(n, e) : n, s = i.length - 1, o; s >= 0; s--)
2562
2650
  (o = i[s]) && (r = o(r) || r);
2563
2651
  return r;
2564
- }, $e = (i, n) => (t, e) => n(t, e, i);
2565
- let Bt = class extends le {
2566
- constructor(i, n, t, e, r, s) {
2567
- super(), this._componentManager = i, this._menuManagerService = n, this._commandService = t, this._shortcutService = e, this._drawingManagerService = r, this._sheetsSelectionsService = s, this._init();
2652
+ }, xe = (i, n) => (e, t) => n(e, t, i);
2653
+ let Wt = class extends le {
2654
+ constructor(i, n, e, t, r, s) {
2655
+ super(), this._componentManager = i, this._menuManagerService = n, this._commandService = e, this._shortcutService = t, this._drawingManagerService = r, this._sheetsSelectionsService = s, this._init();
2568
2656
  }
2569
2657
  _initCustomComponents() {
2570
2658
  const i = this._componentManager;
2571
- this.disposeWithMe(i.register(Cr, Sr)), this.disposeWithMe(i.register(lr, to));
2659
+ this.disposeWithMe(i.register(Ar, Ur)), this.disposeWithMe(i.register(Cr, io));
2572
2660
  }
2573
2661
  _initMenus() {
2574
- this._menuManagerService.mergeMenu(no);
2662
+ this._menuManagerService.mergeMenu(so);
2575
2663
  }
2576
2664
  _initCommands() {
2577
2665
  [
2578
- Gt,
2579
- un,
2580
- Ft,
2581
- nt,
2666
+ Xt,
2667
+ fn,
2582
2668
  Yt,
2583
- ur,
2584
- x,
2585
- hr,
2586
- gr,
2587
- mr,
2669
+ nt,
2670
+ Gt,
2671
+ br,
2672
+ L,
2673
+ Dr,
2674
+ Rr,
2675
+ yr,
2588
2676
  rt,
2589
- Ir,
2590
- fr
2677
+ Pr,
2678
+ Mr
2591
2679
  ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
2592
2680
  }
2593
2681
  _initShortcuts() {
2594
2682
  [
2595
2683
  // sheet drawing shortcuts
2596
- ro,
2597
- io,
2598
- so,
2599
2684
  oo,
2600
- ao
2685
+ ao,
2686
+ co,
2687
+ lo,
2688
+ uo
2601
2689
  ].forEach((i) => {
2602
2690
  this.disposeWithMe(this._shortcutService.registerShortcut(i));
2603
2691
  });
@@ -2606,21 +2694,21 @@ let Bt = class extends le {
2606
2694
  this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
2607
2695
  }
2608
2696
  };
2609
- Bt = lo([
2610
- $e(0, N(Ni)),
2611
- $e(1, ki),
2612
- $e(2, G),
2613
- $e(3, Bi),
2614
- $e(4, oe),
2615
- $e(5, N(dn))
2616
- ], Bt);
2617
- var uo = Object.getOwnPropertyDescriptor, ho = (i, n, t, e) => {
2618
- for (var r = e > 1 ? void 0 : e ? uo(n, t) : n, s = i.length - 1, o; s >= 0; s--)
2697
+ Wt = go([
2698
+ xe(0, N($i)),
2699
+ xe(1, xi),
2700
+ xe(2, G),
2701
+ xe(3, Li),
2702
+ xe(4, oe),
2703
+ xe(5, N(hn))
2704
+ ], Wt);
2705
+ var fo = Object.getOwnPropertyDescriptor, mo = (i, n, e, t) => {
2706
+ for (var r = t > 1 ? void 0 : t ? fo(n, e) : n, s = i.length - 1, o; s >= 0; s--)
2619
2707
  (o = i[s]) && (r = o(r) || r);
2620
2708
  return r;
2621
- }, Me = (i, n) => (t, e) => n(t, e, i);
2622
- function go(i, n, t, e, r) {
2623
- const { scaleX: s, scaleY: o } = n.getAncestorScale(), a = n.getViewport($n.VIEW_MAIN), c = e.getFreeze(), { startColumn: u, startRow: d, xSplit: l, ySplit: g } = c, h = {
2709
+ }, ye = (i, n) => (e, t) => n(e, t, i);
2710
+ function po(i, n, e, t, r) {
2711
+ const { scaleX: s, scaleY: o } = n.getAncestorScale(), a = n.getViewport(qn.VIEW_MAIN), c = t.getFreeze(), { startColumn: u, startRow: l, xSplit: d, ySplit: g } = c, h = {
2624
2712
  left: !0,
2625
2713
  // left means the left of pic is in a viewMainLeft
2626
2714
  top: !0
@@ -2631,19 +2719,19 @@ function go(i, n, t, e, r) {
2631
2719
  absolute: h
2632
2720
  };
2633
2721
  const { left: f, right: p, top: m, bottom: w } = i;
2634
- let { top: S, left: C, viewportScrollX: D, viewportScrollY: v } = a;
2635
- const { boundsOfViewArea: b, scrollDirectionResponse: _ } = r || {}, { rowHeaderWidth: E, columnHeaderHeight: M } = t, y = {
2722
+ let { top: S, left: C, viewportScrollX: b, viewportScrollY: v } = a;
2723
+ const { boundsOfViewArea: D, scrollDirectionResponse: _ } = r || {}, { rowHeaderWidth: T, columnHeaderHeight: M } = e, y = {
2636
2724
  top: M,
2637
- left: E
2725
+ left: T
2638
2726
  };
2639
- b && (ye.isDefine(y.top) && (y.top = b.top), ye.isDefine(y.left) && (y.left = b.left)), _ === "HORIZONTAL" && (v = 0), _ === "VERTICAL" && (D = 0);
2640
- let T = 0, I = 0;
2641
- const R = t.rowStartY(d - g) + M, O = t.colStartX(u - l) + E, B = t.rowStartY(d) + M, K = t.colStartX(u) + E;
2642
- if (l === 0)
2643
- h.left = !1, T = (f - D) * s, I = (p - D) * s;
2727
+ D && (Ee.isDefine(y.top) && (y.top = D.top), Ee.isDefine(y.left) && (y.left = D.left)), _ === "HORIZONTAL" && (v = 0), _ === "VERTICAL" && (b = 0);
2728
+ let E = 0, I = 0;
2729
+ const R = e.rowStartY(l - g) + M, O = e.colStartX(u - d) + T, B = e.rowStartY(l) + M, K = e.colStartX(u) + T;
2730
+ if (d === 0)
2731
+ h.left = !1, E = (f - b) * s, I = (p - b) * s;
2644
2732
  else {
2645
- const X = f - (O - E), J = p - (O - E);
2646
- p < K ? (T = X * s, I = J * s) : f <= K && p >= K ? (T = X * s, I = Math.max(C, (p - D) * s)) : f > K && (h.left = !1, T = Math.max((f - D) * s, C), I = Math.max((p - D) * s, C));
2733
+ const X = f - (O - T), J = p - (O - T);
2734
+ p < K ? (E = X * s, I = J * s) : f <= K && p >= K ? (E = X * s, I = Math.max(C, (p - b) * s)) : f > K && (h.left = !1, E = Math.max((f - b) * s, C), I = Math.max((p - b) * s, C));
2647
2735
  }
2648
2736
  let Z = 0, Y = 0;
2649
2737
  if (g === 0)
@@ -2652,34 +2740,34 @@ function go(i, n, t, e, r) {
2652
2740
  const X = m - (R - M), J = w - (R - M);
2653
2741
  w < B ? (Z = X * o, Y = J * o) : m <= B && w >= B ? (Z = X * o, Y = Math.max(S, (w - v) * o)) : m > B && (h.top = !1, Z = Math.max((m - v) * o, S), Y = Math.max((w - v) * o, S));
2654
2742
  }
2655
- return T = Math.max(T, y.left), Z = Math.max(Z, y.top), I = Math.max(I, y.left), Y = Math.max(Y, y.top), {
2656
- left: T,
2743
+ return E = Math.max(E, y.left), Z = Math.max(Z, y.top), I = Math.max(I, y.left), Y = Math.max(Y, y.top), {
2744
+ left: E,
2657
2745
  right: I,
2658
2746
  top: Z,
2659
2747
  bottom: Y,
2660
2748
  absolute: h
2661
2749
  };
2662
2750
  }
2663
- const fe = (i, n, t, e, r) => {
2664
- const { scene: s } = n, { left: o, top: a, width: c, height: u, angle: d } = i, l = {
2751
+ const fe = (i, n, e, t, r) => {
2752
+ const { scene: s } = n, { left: o, top: a, width: c, height: u, angle: l } = i, d = {
2665
2753
  left: o,
2666
2754
  right: o + c,
2667
2755
  top: a,
2668
2756
  bottom: a + u
2669
- }, g = go(l, s, t, e, r), { scaleX: h, scaleY: f } = s.getAncestorScale();
2757
+ }, g = po(d, s, e, t, r), { scaleX: h, scaleY: f } = s.getAncestorScale();
2670
2758
  return {
2671
2759
  startX: g.left,
2672
2760
  endX: g.right,
2673
2761
  startY: g.top,
2674
2762
  endY: g.bottom,
2675
- rotate: d,
2763
+ rotate: l,
2676
2764
  width: c * h,
2677
2765
  height: u * f,
2678
2766
  absolute: g.absolute
2679
2767
  };
2680
2768
  };
2681
- let Wt = class extends le {
2682
- constructor(n, t, e, r, s, o, a) {
2769
+ let jt = class extends le {
2770
+ constructor(n, e, t, r, s, o, a) {
2683
2771
  super();
2684
2772
  /**
2685
2773
  * for update dom container position when scrolling and zoom
@@ -2689,17 +2777,17 @@ let Wt = class extends le {
2689
2777
  * for update dom container position when scrolling and zoom
2690
2778
  */
2691
2779
  Q(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
2692
- Q(this, "_transformChange$", new Zt());
2780
+ Q(this, "_transformChange$", new Jt());
2693
2781
  Q(this, "transformChange$", this._transformChange$.asObservable());
2694
- Q(this, "_add$", new Zt());
2782
+ Q(this, "_add$", new Jt());
2695
2783
  Q(this, "add$", this._add$.asObservable());
2696
- Q(this, "_remove$", new Zt());
2784
+ Q(this, "_remove$", new Jt());
2697
2785
  Q(this, "remove$", this._remove$.asObservable());
2698
2786
  Q(this, "_hooks", []);
2699
- this._renderManagerService = n, this._univerInstanceService = t, this._commandService = e, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = a, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
2787
+ this._renderManagerService = n, this._univerInstanceService = e, this._commandService = t, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = a, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
2700
2788
  }
2701
2789
  _bindScrollEvent() {
2702
- this._lifecycleService.lifecycle$.pipe(ji((n) => n === Zr.Rendered), $i(1)).subscribe(() => {
2790
+ this._lifecycleService.lifecycle$.pipe(Yi((n) => n === Qr.Rendered), Gi(1)).subscribe(() => {
2703
2791
  this._scrollUpdateListener();
2704
2792
  });
2705
2793
  }
@@ -2708,11 +2796,11 @@ let Wt = class extends le {
2708
2796
  * @param unitId
2709
2797
  * @param subUnitId
2710
2798
  */
2711
- _ensureMap(n, t) {
2712
- let e = this._domLayerMap.get(n);
2713
- e || (e = /* @__PURE__ */ new Map(), this._domLayerMap.set(n, e));
2714
- let r = e.get(t);
2715
- return r || (r = /* @__PURE__ */ new Map(), e.set(t, r)), r;
2799
+ _ensureMap(n, e) {
2800
+ let t = this._domLayerMap.get(n);
2801
+ t || (t = /* @__PURE__ */ new Map(), this._domLayerMap.set(n, t));
2802
+ let r = t.get(e);
2803
+ return r || (r = /* @__PURE__ */ new Map(), t.set(e, r)), r;
2716
2804
  }
2717
2805
  getFloatDomInfo(n) {
2718
2806
  return this._domLayerInfoMap.get(n);
@@ -2720,66 +2808,66 @@ let Wt = class extends le {
2720
2808
  _getSceneAndTransformerByDrawingSearch(n) {
2721
2809
  if (n == null)
2722
2810
  return;
2723
- const t = this._renderManagerService.getRenderById(n), e = t == null ? void 0 : t.scene;
2724
- if (t == null || e == null)
2811
+ const e = this._renderManagerService.getRenderById(n), t = e == null ? void 0 : e.scene;
2812
+ if (e == null || t == null)
2725
2813
  return null;
2726
- const r = e.getTransformerByCreate(), s = t.engine.getCanvasElement();
2727
- return { scene: e, transformer: r, renderUnit: t, canvas: s };
2814
+ const r = t.getTransformerByCreate(), s = e.engine.getCanvasElement();
2815
+ return { scene: t, transformer: r, renderUnit: e, canvas: s };
2728
2816
  }
2729
2817
  _getFloatDomProps(n) {
2730
- let t;
2731
- return this._hooks.forEach((e) => {
2732
- t = e.onGetFloatDomProps(n);
2733
- }), t;
2818
+ let e;
2819
+ return this._hooks.forEach((t) => {
2820
+ e = t.onGetFloatDomProps(n);
2821
+ }), e;
2734
2822
  }
2735
2823
  _drawingAddListener() {
2736
2824
  this.disposeWithMe(
2737
2825
  this._drawingManagerService.add$.subscribe((n) => {
2738
- n.forEach((t) => {
2826
+ n.forEach((e) => {
2739
2827
  var J, ce, q;
2740
- const { unitId: e, subUnitId: r, drawingId: s } = t, o = H(this._univerInstanceService, { unitId: e, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(t), c = this._univerInstanceService.getUnit(e, F.UNIVER_SHEET);
2828
+ const { unitId: t, subUnitId: r, drawingId: s } = e, o = H(this._univerInstanceService, { unitId: t, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(e), c = this._univerInstanceService.getUnit(t, F.UNIVER_SHEET);
2741
2829
  if (!c)
2742
2830
  return;
2743
2831
  const u = c.getActiveSheet().getSheetId();
2744
2832
  if (!a || !o)
2745
2833
  return;
2746
- const d = (J = this._renderManagerService.getRenderById(e)) == null ? void 0 : J.with(V).getSkeletonParam(r);
2747
- if (!d)
2834
+ const l = (J = this._renderManagerService.getRenderById(t)) == null ? void 0 : J.with(V).getSkeletonParam(r);
2835
+ if (!l)
2748
2836
  return;
2749
- const { transform: l, drawingType: g, data: h } = a;
2750
- if (g !== L.DRAWING_DOM && g !== L.DRAWING_CHART)
2837
+ const { transform: d, drawingType: g, data: h } = a;
2838
+ if (g !== x.DRAWING_DOM && g !== x.DRAWING_CHART)
2751
2839
  return;
2752
- const f = this._getSceneAndTransformerByDrawingSearch(e);
2840
+ const f = this._getSceneAndTransformerByDrawingSearch(t);
2753
2841
  if (f == null)
2754
2842
  return;
2755
2843
  const { scene: p, canvas: m } = f;
2756
- if (l == null)
2844
+ if (d == null)
2757
2845
  return !0;
2758
2846
  if (u !== r)
2759
2847
  return;
2760
- const { left: w, top: S, width: C, height: D, angle: v, flipX: b, flipY: _, skewX: E, skewY: M } = l, y = Ce({ unitId: e, subUnitId: r, drawingId: s }), T = p.getObject(y);
2761
- if (T != null) {
2762
- T.transformByState({ left: w, top: S, width: C, height: D, angle: v, flipX: b, flipY: _, skewX: E, skewY: M });
2848
+ const { left: w, top: S, width: C, height: b, angle: v, flipX: D, flipY: _, skewX: T, skewY: M } = d, y = be({ unitId: t, subUnitId: r, drawingId: s }), E = p.getObject(y);
2849
+ if (E != null) {
2850
+ E.transformByState({ left: w, top: S, width: C, height: b, angle: v, flipX: D, flipY: _, skewX: T, skewY: M });
2763
2851
  return;
2764
2852
  }
2765
2853
  const I = {
2766
2854
  left: w,
2767
2855
  top: S,
2768
2856
  width: C,
2769
- height: D,
2770
- zIndex: this._drawingManagerService.getDrawingOrder(e, r).length - 1
2771
- }, R = g === L.DRAWING_CHART;
2857
+ height: b,
2858
+ zIndex: this._drawingManagerService.getDrawingOrder(t, r).length - 1
2859
+ }, R = g === x.DRAWING_CHART;
2772
2860
  if (R) {
2773
2861
  const W = h ? h.backgroundColor : "white";
2774
2862
  I.fill = W, I.rotateEnabled = !1, h && h.border && (I.stroke = h.border), I.paintFirst = "stroke", I.strokeWidth = 1, I.borderEnabled = !1, I.radius = 8;
2775
2863
  }
2776
- const O = new je(y, I);
2777
- R && O.setObjectType(bn.CHART), p.addObject(O, Kt), a.allowTransform !== !1 && p.attachTransformerTo(O);
2778
- const B = this._ensureMap(e, r), K = new _t(), Z = fe(O, f.renderUnit, d.skeleton, o.worksheet), Y = new Ze(Z), me = {
2864
+ const O = new $e(y, I);
2865
+ R && O.setObjectType(An.CHART), p.addObject(O, Zt), a.allowTransform !== !1 && p.attachTransformerTo(O);
2866
+ const B = this._ensureMap(t, r), K = new _t(), Z = fe(O, f.renderUnit, l.skeleton, o.worksheet), Y = new Ze(Z), me = {
2779
2867
  dispose: K,
2780
2868
  rect: O,
2781
2869
  position$: Y,
2782
- unitId: e,
2870
+ unitId: t,
2783
2871
  subUnitId: r
2784
2872
  };
2785
2873
  this._canvasFloatDomService.addFloatDom({
@@ -2800,10 +2888,10 @@ let Wt = class extends le {
2800
2888
  },
2801
2889
  props: (q = (ce = B.get(s)) == null ? void 0 : ce.props) != null ? q : this._getFloatDomProps(s),
2802
2890
  data: h,
2803
- unitId: e
2891
+ unitId: t
2804
2892
  });
2805
2893
  const X = O.onTransformChange$.subscribeEvent(() => {
2806
- const W = fe(O, f.renderUnit, d.skeleton, o.worksheet);
2894
+ const W = fe(O, f.renderUnit, l.skeleton, o.worksheet);
2807
2895
  Y.next(
2808
2896
  W
2809
2897
  );
@@ -2817,95 +2905,95 @@ let Wt = class extends le {
2817
2905
  })
2818
2906
  ), this.disposeWithMe(
2819
2907
  this._drawingManagerService.remove$.subscribe((n) => {
2820
- n.forEach((t) => {
2821
- const { unitId: e, subUnitId: r, drawingId: s } = t, o = Ce({ unitId: e, subUnitId: r, drawingId: s }), a = this._getSceneAndTransformerByDrawingSearch(e);
2908
+ n.forEach((e) => {
2909
+ const { unitId: t, subUnitId: r, drawingId: s } = e, o = be({ unitId: t, subUnitId: r, drawingId: s }), a = this._getSceneAndTransformerByDrawingSearch(t);
2822
2910
  if (a == null)
2823
2911
  return;
2824
- const { transformer: c, scene: u } = a, d = u.getObject(o);
2825
- d != null && d.oKey && c.clearControlByIds([d == null ? void 0 : d.oKey]);
2912
+ const { transformer: c, scene: u } = a, l = u.getObject(o);
2913
+ l != null && l.oKey && c.clearControlByIds([l == null ? void 0 : l.oKey]);
2826
2914
  });
2827
2915
  })
2828
2916
  );
2829
2917
  }
2830
2918
  _scrollUpdateListener() {
2831
- const n = (t, e) => {
2919
+ const n = (e, t) => {
2832
2920
  var u;
2833
- const r = this._getSceneAndTransformerByDrawingSearch(t), s = this._ensureMap(t, e), o = Array.from(s.keys()), a = H(this._univerInstanceService, { unitId: t, subUnitId: e }), c = (u = this._renderManagerService.getRenderById(t)) == null ? void 0 : u.with(V).getSkeletonParam(e);
2834
- !r || !a || !c || o.forEach((d) => {
2835
- const l = this._domLayerInfoMap.get(d);
2836
- if (l) {
2837
- const g = fe(l.rect, r.renderUnit, c.skeleton, a.worksheet, l);
2838
- l.position$.next(g);
2921
+ const r = this._getSceneAndTransformerByDrawingSearch(e), s = this._ensureMap(e, t), o = Array.from(s.keys()), a = H(this._univerInstanceService, { unitId: e, subUnitId: t }), c = (u = this._renderManagerService.getRenderById(e)) == null ? void 0 : u.with(V).getSkeletonParam(t);
2922
+ !r || !a || !c || o.forEach((l) => {
2923
+ const d = this._domLayerInfoMap.get(l);
2924
+ if (d) {
2925
+ const g = fe(d.rect, r.renderUnit, c.skeleton, a.worksheet, d);
2926
+ d.position$.next(g);
2839
2927
  }
2840
2928
  });
2841
2929
  };
2842
2930
  this.disposeWithMe(
2843
2931
  this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(
2844
- Se((t) => t ? t.activeSheet$ : En(null)),
2845
- Ee((t) => {
2846
- if (!t) return null;
2847
- const e = t.getUnitId(), r = this._renderManagerService.getRenderById(e);
2848
- return r ? { render: r, unitId: e, subUnitId: t.getSheetId() } : null;
2932
+ Se((e) => e ? e.activeSheet$ : $n(null)),
2933
+ Oe((e) => {
2934
+ if (!e) return null;
2935
+ const t = e.getUnitId(), r = this._renderManagerService.getRenderById(t);
2936
+ return r ? { render: r, unitId: t, subUnitId: e.getSheetId() } : null;
2849
2937
  }),
2850
2938
  Se(
2851
- (t) => t ? Jr(t.render.scene.getViewport($n.VIEW_MAIN).onScrollAfter$).pipe(Ee(() => ({ unitId: t.unitId, subUnitId: t.subUnitId }))) : En(null)
2939
+ (e) => e ? ei(e.render.scene.getViewport(qn.VIEW_MAIN).onScrollAfter$).pipe(Oe(() => ({ unitId: e.unitId, subUnitId: e.subUnitId }))) : $n(null)
2852
2940
  )
2853
- ).subscribe((t) => {
2854
- if (!t) return;
2855
- const { unitId: e, subUnitId: r } = t;
2856
- n(e, r);
2941
+ ).subscribe((e) => {
2942
+ if (!e) return;
2943
+ const { unitId: t, subUnitId: r } = e;
2944
+ n(t, r);
2857
2945
  })
2858
- ), this.disposeWithMe(this._commandService.onCommandExecuted((t) => {
2859
- var e, r;
2860
- if (t.id === Dn.id) {
2861
- const s = t.params, { unitId: o } = s;
2862
- Array.from((r = (e = this._domLayerMap.get(o)) == null ? void 0 : e.keys()) != null ? r : []).forEach((c) => {
2946
+ ), this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
2947
+ var t, r;
2948
+ if (e.id === kn.id) {
2949
+ const s = e.params, { unitId: o } = s;
2950
+ Array.from((r = (t = this._domLayerMap.get(o)) == null ? void 0 : t.keys()) != null ? r : []).forEach((c) => {
2863
2951
  n(o, c);
2864
2952
  });
2865
- } else if (t.id === Qi.id) {
2866
- const { unitId: s, subUnitId: o } = t.params;
2953
+ } else if (e.id === rs.id) {
2954
+ const { unitId: s, subUnitId: o } = e.params;
2867
2955
  n(s, o);
2868
2956
  }
2869
2957
  }));
2870
2958
  }
2871
- _getPosition(n, t) {
2959
+ _getPosition(n, e) {
2872
2960
  var g;
2873
- const { startX: e, endX: r, startY: s, endY: o } = n, a = (g = this._renderManagerService.getRenderById(t)) == null ? void 0 : g.with(Xe);
2961
+ const { startX: t, endX: r, startY: s, endY: o } = n, a = (g = this._renderManagerService.getRenderById(e)) == null ? void 0 : g.with(Xe);
2874
2962
  if (a == null)
2875
2963
  return;
2876
- const c = a.getCellWithCoordByOffset(e, s);
2964
+ const c = a.getCellWithCoordByOffset(t, s);
2877
2965
  if (c == null)
2878
2966
  return;
2879
2967
  const u = {
2880
2968
  column: c.actualColumn,
2881
- columnOffset: e - c.startX,
2969
+ columnOffset: t - c.startX,
2882
2970
  row: c.actualRow,
2883
2971
  rowOffset: s - c.startY
2884
- }, d = a.getCellWithCoordByOffset(r, o);
2885
- if (d == null)
2972
+ }, l = a.getCellWithCoordByOffset(r, o);
2973
+ if (l == null)
2886
2974
  return;
2887
- const l = {
2888
- column: d.actualColumn,
2889
- columnOffset: r - d.startX,
2890
- row: d.actualRow,
2891
- rowOffset: o - d.startY
2975
+ const d = {
2976
+ column: l.actualColumn,
2977
+ columnOffset: r - l.startX,
2978
+ row: l.actualRow,
2979
+ rowOffset: o - l.startY
2892
2980
  };
2893
2981
  return {
2894
2982
  from: u,
2895
- to: l
2983
+ to: d
2896
2984
  };
2897
2985
  }
2898
2986
  _featureUpdateListener() {
2899
2987
  this.disposeWithMe(
2900
2988
  this._drawingManagerService.update$.subscribe((n) => {
2901
- n.forEach((t) => {
2902
- const e = this._drawingManagerService.getDrawingByParam(t);
2903
- if (!e || e.drawingType !== L.DRAWING_DOM && e.drawingType !== L.DRAWING_CHART)
2989
+ n.forEach((e) => {
2990
+ const t = this._drawingManagerService.getDrawingByParam(e);
2991
+ if (!t || t.drawingType !== x.DRAWING_DOM && t.drawingType !== x.DRAWING_CHART)
2904
2992
  return;
2905
2993
  const r = {
2906
- ...e.transform
2994
+ ...t.transform
2907
2995
  };
2908
- this._transformChange$.next({ id: t.drawingId, value: r });
2996
+ this._transformChange$.next({ id: e.drawingId, value: r });
2909
2997
  });
2910
2998
  })
2911
2999
  );
@@ -2913,38 +3001,38 @@ let Wt = class extends le {
2913
3001
  _deleteListener() {
2914
3002
  this.disposeWithMe(
2915
3003
  this._drawingManagerService.remove$.subscribe((n) => {
2916
- n.forEach((t) => {
2917
- this._removeDom(t.drawingId);
3004
+ n.forEach((e) => {
3005
+ this._removeDom(e.drawingId);
2918
3006
  });
2919
3007
  })
2920
3008
  );
2921
3009
  }
2922
- updateFloatDomProps(n, t, e, r) {
2923
- const s = this._domLayerInfoMap.get(e), o = this._getSceneAndTransformerByDrawingSearch(n);
3010
+ updateFloatDomProps(n, e, t, r) {
3011
+ const s = this._domLayerInfoMap.get(t), o = this._getSceneAndTransformerByDrawingSearch(n);
2924
3012
  if (s && o) {
2925
- const { scene: a } = o, c = Ce({ unitId: n, subUnitId: t, drawingId: e }), u = a.getObject(c);
2926
- u && u instanceof je && u.setProps(r);
3013
+ const { scene: a } = o, c = be({ unitId: n, subUnitId: e, drawingId: t }), u = a.getObject(c);
3014
+ u && u instanceof $e && u.setProps(r);
2927
3015
  }
2928
3016
  }
2929
3017
  // CreateFloatDomCommand --> floatDomService.addFloatDomToPosition
2930
- addFloatDomToPosition(n, t) {
2931
- const e = H(this._univerInstanceService, {
3018
+ addFloatDomToPosition(n, e) {
3019
+ const t = H(this._univerInstanceService, {
2932
3020
  unitId: n.unitId,
2933
3021
  subUnitId: n.subUnitId
2934
3022
  });
2935
- if (!e)
3023
+ if (!t)
2936
3024
  throw new Error("cannot find current target!");
2937
- const { unitId: r, subUnitId: s } = e, { initPosition: o, componentKey: a, data: c, allowTransform: u = !0 } = n, d = t != null ? t : Ht(), l = this._getPosition(o, r);
2938
- if (l == null)
3025
+ const { unitId: r, subUnitId: s } = t, { initPosition: o, componentKey: a, data: c, allowTransform: u = !0 } = n, l = e != null ? e : Et(), d = this._getPosition(o, r);
3026
+ if (d == null)
2939
3027
  return;
2940
- this._ensureMap(r, s).set(d, n);
3028
+ this._ensureMap(r, s).set(l, n);
2941
3029
  const h = {
2942
3030
  unitId: r,
2943
3031
  subUnitId: s,
2944
- drawingId: d,
2945
- drawingType: n.type || L.DRAWING_DOM,
3032
+ drawingId: l,
3033
+ drawingType: n.type || x.DRAWING_DOM,
2946
3034
  componentKey: a,
2947
- sheetTransform: l,
3035
+ sheetTransform: d,
2948
3036
  transform: {
2949
3037
  left: o.startX,
2950
3038
  top: o.startY,
@@ -2954,46 +3042,46 @@ let Wt = class extends le {
2954
3042
  data: c,
2955
3043
  allowTransform: u
2956
3044
  };
2957
- return this._commandService.executeCommand(Ft.id, {
3045
+ return this._commandService.executeCommand(Yt.id, {
2958
3046
  unitId: r,
2959
3047
  drawings: [h]
2960
- }), this._add$.next({ unitId: r, subUnitId: s, id: d }), {
2961
- id: d,
3048
+ }), this._add$.next({ unitId: r, subUnitId: s, id: l }), {
3049
+ id: l,
2962
3050
  dispose: () => {
2963
- this._removeDom(d, !0);
3051
+ this._removeDom(l, !0);
2964
3052
  }
2965
3053
  };
2966
3054
  }
2967
- _removeDom(n, t = !1) {
2968
- const e = this._domLayerInfoMap.get(n);
2969
- if (!e)
3055
+ _removeDom(n, e = !1) {
3056
+ const t = this._domLayerInfoMap.get(n);
3057
+ if (!t)
2970
3058
  return;
2971
- const { unitId: r, subUnitId: s } = e;
2972
- this._domLayerInfoMap.delete(n), e.dispose.dispose();
3059
+ const { unitId: r, subUnitId: s } = t;
3060
+ this._domLayerInfoMap.delete(n), t.dispose.dispose();
2973
3061
  const o = this._getSceneAndTransformerByDrawingSearch(r);
2974
- if (o && o.scene.removeObject(e.rect), t) {
3062
+ if (o && o.scene.removeObject(t.rect), e) {
2975
3063
  this._ensureMap(r, s).delete(n);
2976
3064
  const c = this._drawingManagerService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: n });
2977
3065
  if (!c)
2978
3066
  return;
2979
- const u = this._sheetDrawingService.getBatchRemoveOp([c]), { redo: d, objects: l } = u;
2980
- this._commandService.syncExecuteCommand(A.id, { unitId: r, subUnitId: s, op: d, objects: l, type: P.REMOVE });
3067
+ const u = this._sheetDrawingService.getBatchRemoveOp([c]), { redo: l, objects: d } = u;
3068
+ this._commandService.syncExecuteCommand(A.id, { unitId: r, subUnitId: s, op: l, objects: d, type: P.REMOVE });
2981
3069
  }
2982
3070
  }
2983
3071
  addHook(n) {
2984
3072
  return this._hooks.push(n), {
2985
3073
  dispose: () => {
2986
- const t = this._hooks.findIndex((e) => e === n);
2987
- this._hooks.splice(t, 1);
3074
+ const e = this._hooks.findIndex((t) => t === n);
3075
+ this._hooks.splice(e, 1);
2988
3076
  }
2989
3077
  };
2990
3078
  }
2991
3079
  // eslint-disable-next-line max-lines-per-function, complexity
2992
- addFloatDomToRange(n, t, e, r) {
2993
- var _, E, M, y, T;
3080
+ addFloatDomToRange(n, e, t, r) {
3081
+ var _, T, M, y, E;
2994
3082
  const s = H(this._univerInstanceService, {
2995
- unitId: t.unitId,
2996
- subUnitId: t.subUnitId
3083
+ unitId: e.unitId,
3084
+ subUnitId: e.subUnitId
2997
3085
  });
2998
3086
  if (!s)
2999
3087
  throw new Error("cannot find current target!");
@@ -3001,18 +3089,18 @@ let Wt = class extends le {
3001
3089
  if (!c) return;
3002
3090
  const u = this._renderManagerService.getRenderById(o);
3003
3091
  if (!u) return;
3004
- const d = (_ = this._renderManagerService.getRenderById(o)) == null ? void 0 : _.with(V).getWorksheetSkeleton(a);
3005
- if (!d) return;
3006
- const { componentKey: l, data: g, allowTransform: h = !0 } = t, f = r != null ? r : Ht(), { position: p, position$: m } = this._createRangePositionObserver(n, u, d.skeleton);
3092
+ const l = (_ = this._renderManagerService.getRenderById(o)) == null ? void 0 : _.with(V).getWorksheetSkeleton(a);
3093
+ if (!l) return;
3094
+ const { componentKey: d, data: g, allowTransform: h = !0 } = e, f = r != null ? r : Et(), { position: p, position$: m } = this._createRangePositionObserver(n, u, l.skeleton);
3007
3095
  if (this._getPosition(p, o) == null)
3008
3096
  return;
3009
- this._ensureMap(o, a).set(f, t);
3010
- const C = c.scene, { scaleX: D } = C.getAncestorScale(), v = Mt(p, e, D), b = {
3097
+ this._ensureMap(o, a).set(f, e);
3098
+ const C = c.scene, { scaleX: b } = C.getAncestorScale(), v = Mt(p, t, b), D = {
3011
3099
  unitId: o,
3012
3100
  subUnitId: a,
3013
3101
  drawingId: f,
3014
- drawingType: t.type || L.DRAWING_DOM,
3015
- componentKey: l,
3102
+ drawingType: e.type || x.DRAWING_DOM,
3103
+ componentKey: d,
3016
3104
  transform: {
3017
3105
  left: v.startX,
3018
3106
  top: v.startY,
@@ -3023,30 +3111,30 @@ let Wt = class extends le {
3023
3111
  allowTransform: h
3024
3112
  };
3025
3113
  {
3026
- const { unitId: I, subUnitId: R, drawingId: O } = b, B = H(this._univerInstanceService, { unitId: I, subUnitId: R }), K = b, Z = this._univerInstanceService.getUnit(I, F.UNIVER_SHEET);
3114
+ const { unitId: I, subUnitId: R, drawingId: O } = D, B = H(this._univerInstanceService, { unitId: I, subUnitId: R }), K = D, Z = this._univerInstanceService.getUnit(I, F.UNIVER_SHEET);
3027
3115
  if (!Z)
3028
3116
  return;
3029
3117
  const Y = Z.getActiveSheet().getSheetId();
3030
3118
  if (!K || !B)
3031
3119
  return;
3032
- const me = (E = this._renderManagerService.getRenderById(I)) == null ? void 0 : E.with(V);
3120
+ const me = (T = this._renderManagerService.getRenderById(I)) == null ? void 0 : T.with(V);
3033
3121
  if (!me)
3034
3122
  return;
3035
3123
  const X = me.getWorksheetSkeleton(R);
3036
3124
  if (!X)
3037
3125
  return;
3038
3126
  const { transform: J, drawingType: ce, data: q } = K;
3039
- if (ce !== L.DRAWING_DOM && ce !== L.DRAWING_CHART)
3127
+ if (ce !== x.DRAWING_DOM && ce !== x.DRAWING_CHART)
3040
3128
  return;
3041
3129
  const W = this._getSceneAndTransformerByDrawingSearch(I);
3042
3130
  if (W == null)
3043
3131
  return;
3044
- const { scene: Oe, canvas: Ue } = W;
3132
+ const { scene: Ue, canvas: Pe } = W;
3045
3133
  if (J == null || Y !== R)
3046
3134
  return;
3047
- const { left: st, top: ot, width: at, height: ct, angle: Xt, flipX: Vt, flipY: dt, skewX: lt, skewY: Pe } = J, ut = Ce({ unitId: I, subUnitId: R, drawingId: O }), ue = Oe.getObject(ut);
3135
+ const { left: st, top: ot, width: at, height: ct, angle: Vt, flipX: Ht, flipY: dt, skewX: lt, skewY: Ae } = J, ut = be({ unitId: I, subUnitId: R, drawingId: O }), ue = Ue.getObject(ut);
3048
3136
  if (ue != null) {
3049
- ue.transformByState({ left: st, top: ot, width: at, height: ct, angle: Xt, flipX: Vt, flipY: dt, skewX: lt, skewY: Pe });
3137
+ ue.transformByState({ left: st, top: ot, width: at, height: ct, angle: Vt, flipX: Ht, flipY: dt, skewX: lt, skewY: Ae });
3050
3138
  return;
3051
3139
  }
3052
3140
  const re = {
@@ -3056,29 +3144,29 @@ let Wt = class extends le {
3056
3144
  width: at,
3057
3145
  height: ct,
3058
3146
  zIndex: this._drawingManagerService.getDrawingOrder(I, R).length - 1
3059
- }, Ae = ce === L.DRAWING_CHART;
3060
- if (Ae) {
3147
+ }, Ne = ce === x.DRAWING_CHART;
3148
+ if (Ne) {
3061
3149
  const k = q ? q.backgroundColor : "white";
3062
3150
  re.fill = k, re.rotateEnabled = !1, q && q.border && (re.stroke = q.border), re.paintFirst = "stroke", re.strokeWidth = 1, re.borderEnabled = !1, re.radius = 8;
3063
3151
  }
3064
- const de = new je(ut, re);
3065
- Ae && de.setObjectType(bn.CHART), Oe.addObject(de, Kt), K.allowTransform !== !1 && Oe.attachTransformerTo(de);
3066
- const Ve = this._ensureMap(I, R), he = new _t(), ht = Oe.getMainViewport(), { rowHeaderWidth: Ne, columnHeaderHeight: He } = X.skeleton, gt = {
3152
+ const de = new $e(ut, re);
3153
+ Ne && de.setObjectType(An.CHART), Ue.addObject(de, Zt), K.allowTransform !== !1 && Ue.attachTransformerTo(de);
3154
+ const Ve = this._ensureMap(I, R), he = new _t(), ht = Ue.getMainViewport(), { rowHeaderWidth: ke, columnHeaderHeight: He } = X.skeleton, gt = {
3067
3155
  top: He,
3068
- left: Ne,
3156
+ left: ke,
3069
3157
  bottom: ht.bottom,
3070
3158
  right: ht.right
3071
3159
  }, ge = {
3072
3160
  dispose: he,
3073
3161
  rect: de,
3074
3162
  boundsOfViewArea: gt,
3075
- domAnchor: e,
3163
+ domAnchor: t,
3076
3164
  unitId: I,
3077
3165
  subUnitId: R
3078
- }, j = fe(de, W.renderUnit, X.skeleton, B.worksheet, ge), ke = new Ze(j);
3079
- ge.position$ = ke;
3166
+ }, j = fe(de, W.renderUnit, X.skeleton, B.worksheet, ge), Be = new Ze(j);
3167
+ ge.position$ = Be;
3080
3168
  let ze = {
3081
- position$: ke,
3169
+ position$: Be,
3082
3170
  id: O,
3083
3171
  componentKey: K.componentKey,
3084
3172
  onPointerDown: () => {
@@ -3088,52 +3176,52 @@ let Wt = class extends le {
3088
3176
  onPointerUp: () => {
3089
3177
  },
3090
3178
  onWheel: (k) => {
3091
- Ue.dispatchEvent(new WheelEvent(k.type, k));
3179
+ Pe.dispatchEvent(new WheelEvent(k.type, k));
3092
3180
  },
3093
3181
  props: (y = (M = Ve.get(O)) == null ? void 0 : M.props) != null ? y : this._getFloatDomProps(O),
3094
3182
  data: q,
3095
3183
  unitId: I
3096
3184
  };
3097
- t.eventPassThrough && (ze = {
3185
+ e.eventPassThrough && (ze = {
3098
3186
  ...ze,
3099
3187
  onPointerDown: (k) => {
3100
- Ue.dispatchEvent(new PointerEvent(k.type, k));
3188
+ Pe.dispatchEvent(new PointerEvent(k.type, k));
3101
3189
  },
3102
3190
  onPointerMove: (k) => {
3103
- Ue.dispatchEvent(new PointerEvent(k.type, k));
3191
+ Pe.dispatchEvent(new PointerEvent(k.type, k));
3104
3192
  },
3105
3193
  onPointerUp: (k) => {
3106
- Ue.dispatchEvent(new PointerEvent(k.type, k));
3194
+ Pe.dispatchEvent(new PointerEvent(k.type, k));
3107
3195
  }
3108
3196
  }), this._canvasFloatDomService.addFloatDom(ze), this.disposeWithMe(m.subscribe((k) => {
3109
- var gn, fn, mn, pn;
3110
- const hn = Mt({
3197
+ var pn, wn, _n, vn;
3198
+ const mn = Mt({
3111
3199
  startX: k.startX,
3112
3200
  startY: k.startY,
3113
3201
  endX: k.endX,
3114
3202
  endY: k.endY,
3115
- width: (gn = e.width) != null ? gn : k.width,
3116
- height: (fn = e.height) != null ? fn : k.height,
3203
+ width: (pn = t.width) != null ? pn : k.width,
3204
+ height: (wn = t.height) != null ? wn : k.height,
3117
3205
  absolute: {
3118
3206
  left: p.absolute.left,
3119
3207
  top: p.absolute.top
3120
3208
  }
3121
- }, e), Mr = Ce({ unitId: I, subUnitId: R, drawingId: O }), yr = new je(Mr, {
3122
- left: hn.startX,
3123
- top: hn.startY,
3124
- width: (mn = e.width) != null ? mn : k.width,
3125
- height: (pn = e.height) != null ? pn : k.height,
3209
+ }, t), Br = be({ unitId: I, subUnitId: R, drawingId: O }), Wr = new $e(Br, {
3210
+ left: mn.startX,
3211
+ top: mn.startY,
3212
+ width: (_n = t.width) != null ? _n : k.width,
3213
+ height: (vn = t.height) != null ? vn : k.height,
3126
3214
  zIndex: this._drawingManagerService.getDrawingOrder(I, R).length - 1
3127
- }), Tr = fe(yr, W.renderUnit, X.skeleton, B.worksheet, ge);
3128
- ke.next(Tr);
3215
+ }), jr = fe(Wr, W.renderUnit, X.skeleton, B.worksheet, ge);
3216
+ Be.next(jr);
3129
3217
  }));
3130
- const Ke = (T = this._renderManagerService.getRenderById(I)) == null ? void 0 : T.with(V);
3218
+ const Ke = (E = this._renderManagerService.getRenderById(I)) == null ? void 0 : E.with(V);
3131
3219
  Ke == null || Ke.currentSkeleton$.subscribe((k) => {
3132
3220
  k && X.sheetId !== k.sheetId && this._removeDom(f, !0);
3133
3221
  });
3134
3222
  const ft = de.onTransformChange$.subscribeEvent(() => {
3135
3223
  const k = fe(de, W.renderUnit, X.skeleton, B.worksheet, ge);
3136
- ke.next(
3224
+ Be.next(
3137
3225
  k
3138
3226
  );
3139
3227
  });
@@ -3150,11 +3238,11 @@ let Wt = class extends le {
3150
3238
  }
3151
3239
  };
3152
3240
  }
3153
- addFloatDomToColumnHeader(n, t, e, r) {
3154
- var v, b, _, E, M;
3241
+ addFloatDomToColumnHeader(n, e, t, r) {
3242
+ var v, D, _, T, M;
3155
3243
  const s = H(this._univerInstanceService, {
3156
- unitId: t.unitId,
3157
- subUnitId: t.subUnitId
3244
+ unitId: e.unitId,
3245
+ subUnitId: e.subUnitId
3158
3246
  });
3159
3247
  if (!s)
3160
3248
  throw new Error("cannot find current target!");
@@ -3162,23 +3250,23 @@ let Wt = class extends le {
3162
3250
  if (!this._getSceneAndTransformerByDrawingSearch(o)) return;
3163
3251
  const u = this._renderManagerService.getRenderById(o);
3164
3252
  if (!u) return;
3165
- const d = (v = this._renderManagerService.getRenderById(o)) == null ? void 0 : v.with(V).getWorksheetSkeleton(a);
3166
- if (!d) return;
3167
- const { componentKey: l, data: g, allowTransform: h = !0 } = t, f = r != null ? r : Ht(), { position: p, position$: m } = this._createRangePositionObserver({
3253
+ const l = (v = this._renderManagerService.getRenderById(o)) == null ? void 0 : v.with(V).getWorksheetSkeleton(a);
3254
+ if (!l) return;
3255
+ const { componentKey: d, data: g, allowTransform: h = !0 } = e, f = r != null ? r : Et(), { position: p, position$: m } = this._createRangePositionObserver({
3168
3256
  startRow: 0,
3169
3257
  endRow: 0,
3170
3258
  startColumn: n,
3171
3259
  endColumn: n
3172
- }, u, d.skeleton), w = p;
3260
+ }, u, l.skeleton), w = p;
3173
3261
  if (w.startY = 0, this._getPosition(p, o) == null)
3174
3262
  return;
3175
- this._ensureMap(o, a).set(f, t);
3176
- const D = {
3263
+ this._ensureMap(o, a).set(f, e);
3264
+ const b = {
3177
3265
  unitId: o,
3178
3266
  subUnitId: a,
3179
3267
  drawingId: f,
3180
- drawingType: t.type || L.DRAWING_DOM,
3181
- componentKey: l,
3268
+ drawingType: e.type || x.DRAWING_DOM,
3269
+ componentKey: d,
3182
3270
  transform: {
3183
3271
  left: w.startX,
3184
3272
  top: w.startY,
@@ -3189,68 +3277,68 @@ let Wt = class extends le {
3189
3277
  allowTransform: h
3190
3278
  };
3191
3279
  {
3192
- const { unitId: y, subUnitId: T, drawingId: I } = D, R = H(this._univerInstanceService, { unitId: y, subUnitId: T }), O = D, B = this._univerInstanceService.getUnit(y, F.UNIVER_SHEET);
3280
+ const { unitId: y, subUnitId: E, drawingId: I } = b, R = H(this._univerInstanceService, { unitId: y, subUnitId: E }), O = b, B = this._univerInstanceService.getUnit(y, F.UNIVER_SHEET);
3193
3281
  if (!B)
3194
3282
  return;
3195
3283
  const K = B.getActiveSheet().getSheetId();
3196
3284
  if (!O || !R)
3197
3285
  return;
3198
- const Z = (b = this._renderManagerService.getRenderById(y)) == null ? void 0 : b.with(V);
3286
+ const Z = (D = this._renderManagerService.getRenderById(y)) == null ? void 0 : D.with(V);
3199
3287
  if (!Z)
3200
3288
  return;
3201
- const Y = Z.getWorksheetSkeleton(T);
3289
+ const Y = Z.getWorksheetSkeleton(E);
3202
3290
  if (!Y)
3203
3291
  return;
3204
3292
  const { transform: me, data: X } = O, J = this._getSceneAndTransformerByDrawingSearch(y);
3205
3293
  if (J == null)
3206
3294
  return;
3207
3295
  const { scene: ce, canvas: q } = J;
3208
- if (me == null || K !== T)
3296
+ if (me == null || K !== E)
3209
3297
  return;
3210
- const { left: W, top: Oe, width: Ue, height: st, angle: ot, flipX: at, flipY: ct, skewX: Xt, skewY: Vt } = me, dt = Ce({ unitId: y, subUnitId: T, drawingId: I }), lt = ce.getObject(dt);
3298
+ const { left: W, top: Ue, width: Pe, height: st, angle: ot, flipX: at, flipY: ct, skewX: Vt, skewY: Ht } = me, dt = be({ unitId: y, subUnitId: E, drawingId: I }), lt = ce.getObject(dt);
3211
3299
  if (lt != null) {
3212
- lt.transformByState({ left: W, top: Oe, width: Ue, height: st, angle: ot, flipX: at, flipY: ct, skewX: Xt, skewY: Vt });
3300
+ lt.transformByState({ left: W, top: Ue, width: Pe, height: st, angle: ot, flipX: at, flipY: ct, skewX: Vt, skewY: Ht });
3213
3301
  return;
3214
3302
  }
3215
- const Pe = Mt({
3303
+ const Ae = Mt({
3216
3304
  startX: w.startX,
3217
3305
  startY: 0,
3218
3306
  endX: p.endX,
3219
3307
  endY: p.endY,
3220
- width: e.width,
3221
- height: e.height,
3308
+ width: t.width,
3309
+ height: t.height,
3222
3310
  absolute: {
3223
3311
  left: p.absolute.left,
3224
3312
  top: p.absolute.top
3225
3313
  }
3226
- }, e), ut = {
3227
- left: Pe.startX,
3228
- top: Pe.startY,
3229
- width: Pe.width,
3230
- height: Pe.height,
3231
- zIndex: this._drawingManagerService.getDrawingOrder(y, T).length - 1
3232
- }, ue = new je(dt, ut);
3233
- ce.addObject(ue, Kt), O.allowTransform !== !1 && ce.attachTransformerTo(ue);
3234
- const re = this._ensureMap(y, T), Ae = new _t(), de = ce.getMainViewport(), Ve = {
3314
+ }, t), ut = {
3315
+ left: Ae.startX,
3316
+ top: Ae.startY,
3317
+ width: Ae.width,
3318
+ height: Ae.height,
3319
+ zIndex: this._drawingManagerService.getDrawingOrder(y, E).length - 1
3320
+ }, ue = new $e(dt, ut);
3321
+ ce.addObject(ue, Zt), O.allowTransform !== !1 && ce.attachTransformerTo(ue);
3322
+ const re = this._ensureMap(y, E), Ne = new _t(), de = ce.getMainViewport(), Ve = {
3235
3323
  top: 0,
3236
3324
  //viewMain.top,
3237
3325
  left: de.left,
3238
3326
  bottom: de.bottom,
3239
3327
  right: de.right
3240
3328
  }, he = {
3241
- dispose: Ae,
3329
+ dispose: Ne,
3242
3330
  rect: ue,
3243
3331
  // position$,
3244
3332
  unitId: y,
3245
- subUnitId: T,
3333
+ subUnitId: E,
3246
3334
  boundsOfViewArea: Ve,
3247
- domAnchor: e,
3335
+ domAnchor: t,
3248
3336
  scrollDirectionResponse: "HORIZONTAL"
3249
3337
  /* HORIZONTAL */
3250
- }, ht = fe(ue, J.renderUnit, Y.skeleton, R.worksheet, he), Ne = new Ze(ht);
3251
- he.position$ = Ne;
3338
+ }, ht = fe(ue, J.renderUnit, Y.skeleton, R.worksheet, he), ke = new Ze(ht);
3339
+ he.position$ = ke;
3252
3340
  let He = {
3253
- position$: Ne,
3341
+ position$: ke,
3254
3342
  id: I,
3255
3343
  componentKey: O.componentKey,
3256
3344
  onPointerDown: () => {
@@ -3262,11 +3350,11 @@ let Wt = class extends le {
3262
3350
  onWheel: (j) => {
3263
3351
  q.dispatchEvent(new WheelEvent(j.type, j));
3264
3352
  },
3265
- props: (E = (_ = re.get(I)) == null ? void 0 : _.props) != null ? E : this._getFloatDomProps(I),
3353
+ props: (T = (_ = re.get(I)) == null ? void 0 : _.props) != null ? T : this._getFloatDomProps(I),
3266
3354
  data: X,
3267
3355
  unitId: y
3268
3356
  };
3269
- t.eventPassThrough && (He = {
3357
+ e.eventPassThrough && (He = {
3270
3358
  ...He,
3271
3359
  onPointerDown: (j) => {
3272
3360
  q.dispatchEvent(new PointerEvent(j.type, j));
@@ -3280,37 +3368,37 @@ let Wt = class extends le {
3280
3368
  }), this._canvasFloatDomService.addFloatDom(He);
3281
3369
  const gt = ue.onTransformChange$.subscribeEvent(() => {
3282
3370
  const j = fe(ue, J.renderUnit, Y.skeleton, R.worksheet, he);
3283
- Ne.next(
3371
+ ke.next(
3284
3372
  j
3285
3373
  );
3286
3374
  });
3287
3375
  this.disposeWithMe(m.subscribe((j) => {
3288
- const ke = Mt({
3376
+ const Be = Mt({
3289
3377
  startX: j.startX,
3290
3378
  startY: 0,
3291
3379
  endX: j.endX,
3292
3380
  endY: j.endY,
3293
- width: e.width,
3294
- height: e.height,
3381
+ width: t.width,
3382
+ height: t.height,
3295
3383
  absolute: {
3296
3384
  left: p.absolute.left,
3297
3385
  top: p.absolute.top
3298
3386
  }
3299
- }, e), ze = Ce({ unitId: y, subUnitId: T, drawingId: I }), Ke = new je(ze, {
3300
- left: ke.startX,
3387
+ }, t), ze = be({ unitId: y, subUnitId: E, drawingId: I }), Ke = new $e(ze, {
3388
+ left: Be.startX,
3301
3389
  top: 0,
3302
- width: e.width,
3303
- height: e.height,
3304
- zIndex: this._drawingManagerService.getDrawingOrder(y, T).length - 1
3390
+ width: t.width,
3391
+ height: t.height,
3392
+ zIndex: this._drawingManagerService.getDrawingOrder(y, E).length - 1
3305
3393
  }), ft = fe(Ke, J.renderUnit, Y.skeleton, R.worksheet, he);
3306
- Ne.next(ft);
3394
+ ke.next(ft);
3307
3395
  }));
3308
3396
  const ge = (M = this._renderManagerService.getRenderById(y)) == null ? void 0 : M.with(V);
3309
3397
  ge == null || ge.currentSkeleton$.subscribe((j) => {
3310
- j && d.sheetId !== j.sheetId && this._removeDom(f, !0);
3311
- }), Ae.add(() => {
3398
+ j && l.sheetId !== j.sheetId && this._removeDom(f, !0);
3399
+ }), Ne.add(() => {
3312
3400
  this._canvasFloatDomService.removeFloatDom(I);
3313
- }), gt && Ae.add(gt), this._domLayerInfoMap.set(I, he), re.set(I, {
3401
+ }), gt && Ne.add(gt), this._domLayerInfoMap.set(I, he), re.set(I, {
3314
3402
  ...re.get(I)
3315
3403
  });
3316
3404
  }
@@ -3331,21 +3419,21 @@ let Wt = class extends le {
3331
3419
  * @param activeViewport
3332
3420
  * @returns position of cell to canvas.
3333
3421
  */
3334
- _createRangePositionObserver(n, t, e) {
3422
+ _createRangePositionObserver(n, e, t) {
3335
3423
  let { startRow: r, startColumn: s } = n;
3336
- const o = Qe(r, s, e), a = new Ze(o), c = Qe(n.endRow, n.endColumn, e), u = new Ze(c), d = () => {
3337
- const m = Qe(r, s, e), w = Qe(n.endRow, n.endColumn, e);
3424
+ const o = Qe(r, s, t), a = new Ze(o), c = Qe(n.endRow, n.endColumn, t), u = new Ze(c), l = () => {
3425
+ const m = Qe(r, s, t), w = Qe(n.endRow, n.endColumn, t);
3338
3426
  a.next(m), u.next(w);
3339
- }, l = new _t();
3340
- l.add(t.engine.clientRect$.subscribe(() => d())), l.add(this._commandService.onCommandExecuted((m) => {
3341
- if (m.id === Gn.id && m.params.rowsAutoHeightInfo.findIndex((S) => S.row === r) > -1) {
3342
- d();
3427
+ }, d = new _t();
3428
+ d.add(e.engine.clientRect$.subscribe(() => l())), d.add(this._commandService.onCommandExecuted((m) => {
3429
+ if (m.id === nr.id && m.params.rowsAutoHeightInfo.findIndex((S) => S.row === r) > -1) {
3430
+ l();
3343
3431
  return;
3344
3432
  }
3345
- (es.indexOf(m.id) > -1 || m.id === Di.id || m.id === Dn.id) && d();
3433
+ (is.indexOf(m.id) > -1 || m.id === Oi.id || m.id === kn.id) && l();
3346
3434
  }));
3347
3435
  const g = (m, w) => {
3348
- r = m, s = w, d();
3436
+ r = m, s = w, l();
3349
3437
  }, h = () => ({
3350
3438
  rotate: 0,
3351
3439
  width: c.right - o.left,
@@ -3359,8 +3447,8 @@ let Wt = class extends le {
3359
3447
  endX: c.right,
3360
3448
  endY: c.bottom
3361
3449
  }), f = a.pipe(
3362
- Ee((m) => {
3363
- const w = Qe(n.endRow, n.endColumn, e);
3450
+ Oe((m) => {
3451
+ const w = Qe(n.endRow, n.endColumn, t);
3364
3452
  return {
3365
3453
  rotate: 0,
3366
3454
  width: w.right - m.left,
@@ -3382,21 +3470,21 @@ let Wt = class extends le {
3382
3470
  updateRowCol: g,
3383
3471
  topLeftPos$: a,
3384
3472
  rightBottomPos$: u,
3385
- disposable: l
3473
+ disposable: d
3386
3474
  };
3387
3475
  }
3388
3476
  };
3389
- Wt = ho([
3390
- Me(0, N(ne)),
3391
- Me(1, Ge),
3392
- Me(2, N(G)),
3393
- Me(3, oe),
3394
- Me(4, N(Wi)),
3395
- Me(5, ae),
3396
- Me(6, N(Kr))
3397
- ], Wt);
3398
- function Qe(i, n, t) {
3399
- const e = t.getCellWithCoordByIndex(i, n), r = e.isMergedMainCell ? e.mergeInfo : e;
3477
+ jt = mo([
3478
+ ye(0, N(ne)),
3479
+ ye(1, Ce),
3480
+ ye(2, N(G)),
3481
+ ye(3, oe),
3482
+ ye(4, N(Fi)),
3483
+ ye(5, ae),
3484
+ ye(6, N(qr))
3485
+ ], jt);
3486
+ function Qe(i, n, e) {
3487
+ const t = e.getCellWithCoordByIndex(i, n), r = t.isMergedMainCell ? t.mergeInfo : t;
3400
3488
  return {
3401
3489
  left: r.startX,
3402
3490
  right: r.endX,
@@ -3404,20 +3492,20 @@ function Qe(i, n, t) {
3404
3492
  bottom: r.endY
3405
3493
  };
3406
3494
  }
3407
- function Mt(i, n, t) {
3408
- var u, d;
3409
- t = t != null ? t : 1;
3410
- const e = i.endX - i.startX, r = i.endY - i.startY, s = (u = n == null ? void 0 : n.width) != null ? u : e, o = (d = n == null ? void 0 : n.height) != null ? d : r;
3495
+ function Mt(i, n, e) {
3496
+ var u, l;
3497
+ e = e != null ? e : 1;
3498
+ const t = i.endX - i.startX, r = i.endY - i.startY, s = (u = n == null ? void 0 : n.width) != null ? u : t, o = (l = n == null ? void 0 : n.height) != null ? l : r;
3411
3499
  let a = 0, c = 0;
3412
3500
  if (n) {
3413
3501
  if (n.horizonOffsetAlign === "right") {
3414
- const l = yt(n.marginX, e * t);
3415
- a = i.endX - l - s;
3502
+ const d = yt(n.marginX, t * e);
3503
+ a = i.endX - d - s;
3416
3504
  } else
3417
- a = i.startX + yt(n.marginX, e);
3505
+ a = i.startX + yt(n.marginX, t);
3418
3506
  if (n.verticalOffsetAlign === "bottom") {
3419
- const l = yt(n.marginY, r * t);
3420
- c = i.endY - l - o;
3507
+ const d = yt(n.marginY, r * e);
3508
+ c = i.endY - d - o;
3421
3509
  } else
3422
3510
  c = i.startY + yt(n.marginY, r);
3423
3511
  }
@@ -3438,90 +3526,91 @@ function Mt(i, n, t) {
3438
3526
  function yt(i, n) {
3439
3527
  if (i === void 0) return 0;
3440
3528
  if (typeof i == "number") return i;
3441
- const t = Number.parseFloat(i);
3442
- return n * t / 100;
3529
+ const e = Number.parseFloat(i);
3530
+ return n * e / 100;
3443
3531
  }
3444
- var fo = Object.defineProperty, mo = Object.getOwnPropertyDescriptor, po = (i, n, t) => n in i ? fo(i, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[n] = t, wo = (i, n, t, e) => {
3445
- for (var r = e > 1 ? void 0 : e ? mo(n, t) : n, s = i.length - 1, o; s >= 0; s--)
3532
+ var wo = Object.defineProperty, _o = Object.getOwnPropertyDescriptor, vo = (i, n, e) => n in i ? wo(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e, So = (i, n, e, t) => {
3533
+ for (var r = t > 1 ? void 0 : t ? _o(n, e) : n, s = i.length - 1, o; s >= 0; s--)
3446
3534
  (o = i[s]) && (r = o(r) || r);
3447
3535
  return r;
3448
- }, qt = (i, n) => (t, e) => n(t, e, i), Dr = (i, n, t) => po(i, typeof n != "symbol" ? n + "" : n, t);
3449
- const _o = "SHEET_IMAGE_UI_PLUGIN";
3450
- let jt = class extends ei {
3451
- constructor(i = Pn, n, t, e) {
3452
- super(), this._config = i, this._injector = n, this._renderManagerService = t, this._configService = e;
3453
- const { menu: r, ...s } = ti(
3536
+ }, Qt = (i, n) => (e, t) => n(e, t, i), kr = (i, n, e) => vo(i, typeof n != "symbol" ? n + "" : n, e);
3537
+ const Io = "SHEET_IMAGE_UI_PLUGIN";
3538
+ let $t = class extends ri {
3539
+ constructor(i = Gn, n, e, t) {
3540
+ super(), this._config = i, this._injector = n, this._renderManagerService = e, this._configService = t;
3541
+ const { menu: r, ...s } = ii(
3454
3542
  {},
3455
- Pn,
3543
+ Gn,
3456
3544
  this._config
3457
3545
  );
3458
- r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(os, s);
3546
+ r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(ds, s);
3459
3547
  }
3460
3548
  onStarting() {
3461
- ni(this._injector, [
3549
+ si(this._injector, [
3550
+ [jt],
3462
3551
  [Wt],
3552
+ [Ot],
3463
3553
  [Bt],
3464
- [Et],
3465
3554
  [kt],
3466
3555
  [Nt],
3556
+ [Ut],
3467
3557
  [At],
3468
- [Ot],
3469
- [Pt],
3470
- [Ut]
3558
+ [Pt]
3471
3559
  ]), zt(this._injector, [
3472
- [Wt]
3560
+ [jt]
3473
3561
  ]);
3474
3562
  }
3475
3563
  onReady() {
3476
3564
  zt(this._injector, [
3477
- [At]
3565
+ [Nt]
3478
3566
  ]);
3479
3567
  }
3480
3568
  onRendered() {
3481
3569
  this._registerRenderModules(), zt(this._injector, [
3482
- [Nt],
3483
3570
  [kt],
3484
3571
  [Bt],
3485
- [Ot],
3486
- [Pt],
3487
- [Ut]
3572
+ [Wt],
3573
+ [Ut],
3574
+ [At],
3575
+ [Pt]
3488
3576
  ]);
3489
3577
  }
3490
3578
  onSteady() {
3491
- this._injector.get(Et);
3579
+ this._injector.get(Ot);
3492
3580
  }
3493
3581
  _registerRenderModules() {
3494
3582
  [
3495
3583
  [et],
3496
- [an],
3497
- [sn]
3584
+ [dn],
3585
+ [on]
3498
3586
  ].forEach((i) => {
3499
3587
  this.disposeWithMe(this._renderManagerService.registerRenderModule(F.UNIVER_SHEET, i));
3500
3588
  });
3501
3589
  }
3502
3590
  };
3503
- Dr(jt, "type", F.UNIVER_SHEET);
3504
- Dr(jt, "pluginName", _o);
3505
- jt = wo([
3506
- qr(oi, ii, hi, mi),
3507
- qt(1, N(tt)),
3508
- qt(2, ne),
3509
- qt(3, Qr)
3510
- ], jt);
3591
+ kr($t, "type", F.UNIVER_SHEET);
3592
+ kr($t, "pluginName", Io);
3593
+ $t = So([
3594
+ ti(di, ai, mi, vi),
3595
+ Qt(1, N(tt)),
3596
+ Qt(2, ne),
3597
+ Qt(3, ni)
3598
+ ], $t);
3511
3599
  export {
3512
- x as ClearSheetDrawingTransformerOperation,
3513
- Ir as DeleteDrawingsCommand,
3514
- hr as EditSheetDrawingOperation,
3515
- gr as GroupSheetDrawingCommand,
3516
- Gt as InsertFloatImageCommand,
3517
- Ft as InsertSheetDrawingCommand,
3600
+ L as ClearSheetDrawingTransformerOperation,
3601
+ Pr as DeleteDrawingsCommand,
3602
+ Dr as EditSheetDrawingOperation,
3603
+ Rr as GroupSheetDrawingCommand,
3604
+ Xt as InsertFloatImageCommand,
3605
+ Yt as InsertSheetDrawingCommand,
3518
3606
  rt as MoveDrawingsCommand,
3519
3607
  nt as RemoveSheetDrawingCommand,
3520
- br as SHEETS_IMAGE_MENU_ID,
3521
- fr as SetDrawingArrangeCommand,
3522
- Yt as SetSheetDrawingCommand,
3523
- Wt as SheetCanvasFloatDomManagerService,
3524
- ur as SidebarSheetDrawingOperation,
3525
- mr as UngroupSheetDrawingCommand,
3526
- jt as UniverSheetsDrawingUIPlugin
3608
+ Nr as SHEETS_IMAGE_MENU_ID,
3609
+ Mr as SetDrawingArrangeCommand,
3610
+ Gt as SetSheetDrawingCommand,
3611
+ jt as SheetCanvasFloatDomManagerService,
3612
+ et as SheetDrawingUpdateController,
3613
+ br as SidebarSheetDrawingOperation,
3614
+ yr as UngroupSheetDrawingCommand,
3615
+ $t as UniverSheetsDrawingUIPlugin
3527
3616
  };