@univerjs/sheets-drawing-ui 0.5.0-nightly.202411291606 → 0.5.1

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