@univerjs/sheets-drawing-ui 0.5.5 → 0.6.0-alpha.0

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