@univerjs/sheets-drawing-ui 0.8.2 → 0.8.3-nightly.202506271607

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/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  var yr = Object.defineProperty;
2
2
  var Er = (i, t, e) => t in i ? yr(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
3
  var ee = (i, t, e) => Er(i, typeof t != "symbol" ? t + "" : t, e);
4
- import { CommandType as J, ICommandService as G, IUndoRedoService as xe, sequenceExecute as xn, LocaleService as tt, IUniverInstanceService as Se, Inject as A, Injector as Ye, IContextService as Yn, IImageIoService as Tr, RxDisposable as Or, UniverInstanceType as F, FOCUSING_COMMON_DRAWINGS as $e, DrawingTypeEnum as B, Disposable as ne, ArrangeTypeEnum as mt, createDocumentModelWithStyle as Vt, ObjectRelativeFromV as mn, ObjectRelativeFromH as pn, WrapTextType as wn, PositionedObjectLayoutType as _n, BooleanNumber as Sn, BuildTextUtils as Ht, ImageSourceType as vn, generateRandomId as Dt, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ze, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Be, InterceptorEffectEnum as Ur, ObjectMatrix as Pr, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Ar, Tools as Re, IPermissionService as Nr, UserManagerService as kr, LifecycleService as Wr, LifecycleStages as Br, DisposableCollection as pt, fromEventSubject as jr, PRINT_CHART_COMPONENT_KEY as $r, Rectangle as Fr, Direction as _e, FOCUSING_FX_BAR_EDITOR as xr, EDITOR_ACTIVATED as Yr, FOCUSING_PANEL_EDITOR as Xr, DependentOn as Gr, IConfigService as Lr, Plugin as Vr, merge as Hr, registerDependencies as zr, touchDependencies as Ft } from "@univerjs/core";
5
- import { DocDrawingController as Kr, UniverDocsDrawingPlugin as Jr } from "@univerjs/docs-drawing";
6
- import { SetDrawingSelectedOperation as At, IDrawingManagerService as re, IImageIoService as Zr, DRAWING_IMAGE_ALLOW_IMAGE_LIST as In, DRAWING_IMAGE_COUNT_LIMIT as Cn, ImageUploadStatusType as Ue, DRAWING_IMAGE_ALLOW_SIZE as Dn, getImageSize as xt, DRAWING_IMAGE_WIDTH_LIMIT as Rn, DRAWING_IMAGE_HEIGHT_LIMIT as bn, ImageSourceType as qr, getDrawingShapeKeyByDrawingSearch as ve, UniverDrawingPlugin as Qr } from "@univerjs/drawing";
7
- import { ImageCropperObject as ei, COMPONENT_IMAGE_POPUP_MENU as ti, OpenImageCropOperation as ni, ImageResetSizeOperation as ri, DrawingRenderService as Xn, DrawingCommonPanel as ii, UniverDrawingUIPlugin as si } from "@univerjs/drawing-ui";
8
- import { IRenderManagerService as Z, CURSOR_TYPE as oi, precisionTo as wt, transformObjectOutOfGroup as ai, getGroupState as ci, getCurrentTypeOfRenderer as sn, RENDER_CLASS_TYPE as Pe, Rect as Ae, ObjectType as Mn, DRAWING_OBJECT_LAYER_INDEX as Yt, SHEET_VIEWPORT_KEY as Gn } from "@univerjs/engine-render";
9
- import { ISheetDrawingService as ie, DrawingApplyType as U, SetDrawingApplyMutation as P, SheetDrawingAnchorType as O, UniverSheetsDrawingPlugin as di } from "@univerjs/sheets-drawing";
10
- import { MessageType as pe, render as li, unmount as ui, clsx as hi, RadioGroup as gi, Radio as Xt } from "@univerjs/design";
11
- import { SheetCanvasPopManagerService as fi, HoverManagerService as mi, SheetSkeletonManagerService as V, convertPositionSheetOverGridToAbsolute as pi, ISheetSelectionRenderService as Xe, attachRangeWithCoord as Ln, IEditorBridgeService as wi, IAutoFillService as _i, EditingRenderController as Si, SetCellEditVisibleOperation as yn, PREDEFINED_HOOK_NAME as je, COPY_TYPE as Ie, discreteRangeToRange as En, virtualizeDiscreteRanges as vi, ISheetClipboardService as Ii, SetZoomRatioOperation as Tn, SetScrollOperation as Ci, SheetPrintInterceptorService as Di, getCurrentRangeDisable$ as Ri } from "@univerjs/sheets-ui";
12
- import { ISidebarService as bi, IMessageService as Vn, ILocalFileService as Mi, IDialogService as yi, IClipboardInterfaceService as Ei, CanvasFloatDomService as Ti, PrintFloatDomSingle as Oi, ComponentManager as Hn, connectInjector as Ui, useDependency as qe, getMenuHiddenObservable as on, MenuItemType as an, RibbonInsertGroup as Pi, KeyCode as Fe, IMenuManagerService as Ai, IShortcutService as Ni } from "@univerjs/ui";
13
- import { takeUntil as On, throttleTime as ki, combineLatest as _t, switchMap as we, EMPTY as fe, tap as Un, map as be, distinctUntilChanged as Pn, Subject as Gt, filter as Wi, take as Bi, BehaviorSubject as We, of as An } from "rxjs";
14
- import { SheetInterceptorService as Nt, getSheetCommandTarget as se, SheetsSelectionsService as cn, SetRangeValuesCommand as Nn, INTERCEPTOR_POINT as ji, InterceptCellContentPriority as $i, WorkbookViewPermission as kn, WorksheetViewPermission as Wn, WorkbookEditablePermission as zt, WorksheetEditPermission as Kt, SetFrozenMutation as Fi, SetWorksheetRowAutoHeightMutation as xi, COMMAND_LISTENER_SKELETON_CHANGE as Yi, InsertRowCommand as zn, InsertColCommand as Kn, RemoveRowCommand as Jn, RemoveColCommand as Zn, DeleteRangeMoveLeftCommand as qn, DeleteRangeMoveUpCommand as Qn, InsertRangeMoveDownCommand as er, InsertRangeMoveRightCommand as tr, DeltaRowHeightCommand as Jt, SetRowHeightCommand as Zt, DeltaColumnWidthCommand as nr, SetColWidthCommand as rr, SetRowHiddenCommand as ir, SetSpecificRowsVisibleCommand as sr, SetSpecificColsVisibleCommand as or, SetColHiddenCommand as ar, MoveColsCommand as cr, MoveRowsCommand as dr, MoveRangeCommand as lr, SetRowVisibleMutation as Xi, SetRowHiddenMutation as Gi, SetColVisibleMutation as Li, SetColHiddenMutation as Vi, SetWorksheetRowHeightMutation as Hi, SetWorksheetColWidthMutation as zi, SetWorksheetActiveOperation as Ki, RangeProtectionPermissionEditPoint as Ji } from "@univerjs/sheets";
15
- import { docDrawingPositionToTransform as Bn, ReplaceSnapshotCommand as Zi, InnerPasteCommand as qi } from "@univerjs/docs-ui";
4
+ import { CommandType as J, ICommandService as G, IUndoRedoService as xe, sequenceExecute as xn, DrawingTypeEnum as B, ArrangeTypeEnum as mt, Inject as A, IContextService as Yn, LocaleService as tt, Injector as Ye, Disposable as ne, createDocumentModelWithStyle as Vt, ObjectRelativeFromV as mn, ObjectRelativeFromH as pn, WrapTextType as wn, PositionedObjectLayoutType as _n, BooleanNumber as Sn, BuildTextUtils as Ht, ImageSourceType as vn, generateRandomId as Dt, FOCUSING_COMMON_DRAWINGS as $e, IUniverInstanceService as Se, UniverInstanceType as F, Direction as _e, IImageIoService as Tr, RxDisposable as Or, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ze, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Be, InterceptorEffectEnum as Ur, ObjectMatrix as Pr, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Ar, Tools as Re, IPermissionService as Nr, UserManagerService as kr, LifecycleService as Wr, LifecycleStages as Br, DisposableCollection as pt, fromEventSubject as jr, PRINT_CHART_COMPONENT_KEY as $r, Rectangle as Fr, FOCUSING_FX_BAR_EDITOR as xr, EDITOR_ACTIVATED as Yr, FOCUSING_PANEL_EDITOR as Xr, DependentOn as Gr, IConfigService as Lr, Plugin as Vr, merge as Hr, registerDependencies as zr, touchDependencies as Ft } from "@univerjs/core";
5
+ import { ISheetDrawingService as re, DrawingApplyType as U, SetDrawingApplyMutation as P, SheetDrawingAnchorType as O, UniverSheetsDrawingPlugin as Kr } from "@univerjs/sheets-drawing";
6
+ import { SheetInterceptorService as At, SheetsSelectionsService as sn, SetRangeValuesCommand as In, getSheetCommandTarget as se, INTERCEPTOR_POINT as Jr, InterceptCellContentPriority as Zr, WorkbookViewPermission as Cn, WorksheetViewPermission as Dn, WorkbookEditablePermission as zt, WorksheetEditPermission as Kt, SetFrozenMutation as qr, SetWorksheetRowAutoHeightMutation as Qr, COMMAND_LISTENER_SKELETON_CHANGE as ei, InsertRowCommand as Xn, InsertColCommand as Gn, RemoveRowCommand as Ln, RemoveColCommand as Vn, DeleteRangeMoveLeftCommand as Hn, DeleteRangeMoveUpCommand as zn, InsertRangeMoveDownCommand as Kn, InsertRangeMoveRightCommand as Jn, DeltaRowHeightCommand as Jt, SetRowHeightCommand as Zt, DeltaColumnWidthCommand as Zn, SetColWidthCommand as qn, SetRowHiddenCommand as Qn, SetSpecificRowsVisibleCommand as er, SetSpecificColsVisibleCommand as tr, SetColHiddenCommand as nr, MoveColsCommand as rr, MoveRowsCommand as ir, MoveRangeCommand as sr, SetRowVisibleMutation as ti, SetRowHiddenMutation as ni, SetColVisibleMutation as ri, SetColHiddenMutation as ii, SetWorksheetRowHeightMutation as si, SetWorksheetColWidthMutation as oi, SetWorksheetActiveOperation as ai, RangeProtectionPermissionEditPoint as ci } from "@univerjs/sheets";
7
+ import { IRenderManagerService as Z, transformObjectOutOfGroup as di, getGroupState as li, precisionTo as wt, getCurrentTypeOfRenderer as on, CURSOR_TYPE as ui, RENDER_CLASS_TYPE as Ue, Rect as Pe, ObjectType as Rn, DRAWING_OBJECT_LAYER_INDEX as xt, SHEET_VIEWPORT_KEY as or } from "@univerjs/engine-render";
8
+ import { MessageType as pe, render as hi, unmount as gi, clsx as fi, RadioGroup as mi, Radio as Yt } from "@univerjs/design";
9
+ import { docDrawingPositionToTransform as bn, ReplaceSnapshotCommand as pi, InnerPasteCommand as wi } from "@univerjs/docs-ui";
10
+ import { IImageIoService as _i, IDrawingManagerService as ie, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Mn, DRAWING_IMAGE_COUNT_LIMIT as yn, ImageUploadStatusType as Ae, DRAWING_IMAGE_ALLOW_SIZE as En, getImageSize as Xt, SetDrawingSelectedOperation as Nt, DRAWING_IMAGE_WIDTH_LIMIT as Tn, DRAWING_IMAGE_HEIGHT_LIMIT as On, ImageSourceType as Si, getDrawingShapeKeyByDrawingSearch as ve, UniverDrawingPlugin as vi } from "@univerjs/drawing";
11
+ import { convertPositionSheetOverGridToAbsolute as Ii, SheetSkeletonManagerService as V, ISheetSelectionRenderService as Xe, attachRangeWithCoord as ar, SheetCanvasPopManagerService as Ci, HoverManagerService as Di, IEditorBridgeService as Ri, IAutoFillService as bi, EditingRenderController as Mi, SetCellEditVisibleOperation as Un, PREDEFINED_HOOK_NAME as je, COPY_TYPE as Ie, discreteRangeToRange as Pn, virtualizeDiscreteRanges as yi, ISheetClipboardService as Ei, SetZoomRatioOperation as An, SetScrollOperation as Ti, SheetPrintInterceptorService as Oi, getCurrentRangeDisable$ as Ui } from "@univerjs/sheets-ui";
12
+ import { ILocalFileService as Pi, IMessageService as cr, ISidebarService as Ai, IDialogService as Ni, IClipboardInterfaceService as ki, CanvasFloatDomService as Wi, PrintFloatDomSingle as Bi, ComponentManager as dr, connectInjector as ji, useDependency as qe, getMenuHiddenObservable as an, MenuItemType as cn, RibbonInsertGroup as $i, KeyCode as Fe, IMenuManagerService as Fi, IShortcutService as xi } from "@univerjs/ui";
13
+ import { DocDrawingController as Yi, UniverDocsDrawingPlugin as Xi } from "@univerjs/docs-drawing";
14
+ import { ImageCropperObject as Gi, COMPONENT_IMAGE_POPUP_MENU as Li, OpenImageCropOperation as Vi, ImageResetSizeOperation as Hi, DrawingRenderService as lr, DrawingCommonPanel as zi, UniverDrawingUIPlugin as Ki } from "@univerjs/drawing-ui";
15
+ import { takeUntil as Nn, throttleTime as Ji, combineLatest as _t, switchMap as we, EMPTY as fe, tap as kn, map as be, distinctUntilChanged as Wn, Subject as Gt, filter as Zi, take as qi, BehaviorSubject as We, of as Bn } from "rxjs";
16
16
  import { jsx as oe, jsxs as qt } from "react/jsx-runtime";
17
17
  import { useMemo as Qi, useState as Qt, useEffect as ur } from "react";
18
- const es = "sheets-drawing-ui.config", jn = {}, Y = {
18
+ const Y = {
19
19
  id: "sheet.operation.clear-drawing-transformer",
20
20
  type: J.MUTATION,
21
21
  handler: (i, t) => {
@@ -30,7 +30,7 @@ const es = "sheets-drawing-ui.config", jn = {}, Y = {
30
30
  type: J.COMMAND,
31
31
  handler: (i, t) => {
32
32
  var v, I, R;
33
- const e = i.get(G), n = i.get(xe), r = i.get(Nt), s = i.get(ie);
33
+ const e = i.get(G), n = i.get(xe), r = i.get(At), s = i.get(re);
34
34
  if (!t) return !1;
35
35
  const { drawings: o } = t, a = [];
36
36
  o.forEach((S) => {
@@ -54,301 +54,32 @@ const es = "sheets-drawing-ui.config", jn = {}, Y = {
54
54
  ]
55
55
  }), !0) : !1;
56
56
  }
57
- }, hr = "COMPONENT_SHEET_DRAWING_PANEL", gr = {
58
- id: "sidebar.operation.sheet-image",
57
+ }, hr = {
58
+ id: "sheet.command.delete-drawing",
59
59
  type: J.COMMAND,
60
- handler: async (i, t) => {
61
- const e = i.get(bi), n = i.get(tt), r = i.get(Se), s = i.get(G);
62
- if (!se(r)) return !1;
63
- switch (t.value) {
64
- case "open":
65
- e.open({
66
- header: { title: n.t("sheetImage.panel.title") },
67
- children: { label: hr },
68
- onClose: () => {
69
- s.syncExecuteCommand(At.id, []);
70
- },
71
- width: 360
72
- });
73
- break;
74
- case "close":
75
- default:
76
- e.close();
77
- break;
78
- }
79
- return !0;
80
- }
81
- }, fr = {
82
- id: "sheet.operation.edit-sheet-image",
83
- type: J.OPERATION,
84
- handler: (i, t) => {
85
- const e = i.get(G);
86
- return t == null ? !1 : (e.syncExecuteCommand(At.id, [t]), e.executeCommand(gr.id, { value: "open" }), !0);
87
- }
88
- };
89
- var ts = Object.getOwnPropertyDescriptor, ns = (i, t, e, n) => {
90
- for (var r = n > 1 ? void 0 : n ? ts(t, e) : t, s = i.length - 1, o; s >= 0; s--)
91
- (o = i[s]) && (r = o(r) || r);
92
- return r;
93
- }, ce = (i, t) => (e, n) => t(e, n, i);
94
- let Rt = class extends Or {
95
- constructor(t, e, n, r, s, o, a, d, u, c) {
96
- super();
97
- ee(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
98
- this._injector = t, this._localeService = e, this._drawingManagerService = n, this._canvasPopManagerService = r, this._renderManagerService = s, this._univerInstanceService = o, this._messageService = a, this._contextService = d, this._ioService = u, this._commandService = c, this._init();
99
- }
100
- _init() {
101
- this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(On(this.dispose$)).subscribe((t) => this._create(t)), this._univerInstanceService.getTypeOfUnitDisposed$(F.UNIVER_SHEET).pipe(On(this.dispose$)).subscribe((t) => this._dispose(t)), this._univerInstanceService.getAllUnitsForType(F.UNIVER_SHEET).forEach((t) => this._create(t)), this._setupLoadingStatus();
102
- }
103
- _setupLoadingStatus() {
104
- const t = "image-upload-loading";
105
- let e;
106
- this.disposeWithMe(this._ioService.change$.subscribe((n) => {
107
- n > 0 && !e ? e = this._messageService.show({
108
- id: t,
109
- type: pe.Loading,
110
- content: `${this._localeService.t("uploadLoading.loading")}: ${n}`,
111
- duration: 0
112
- }) : n === 0 && (e == null || e.dispose(), e = void 0);
113
- }));
114
- }
115
- _dispose(t) {
116
- super.dispose();
117
- const e = t.getUnitId();
118
- this._renderManagerService.removeRender(e);
119
- }
120
- _create(t) {
121
- if (!t)
122
- return;
123
- const e = t.getUnitId();
124
- this._renderManagerService.has(e) && !this._initImagePopupMenu.has(e) && (this._popupMenuListener(e), this._initImagePopupMenu.add(e));
125
- }
126
- _hasCropObject(t) {
127
- const e = t.getAllObjectsByOrder();
128
- for (const n of e)
129
- if (n instanceof ei)
130
- return !0;
131
- return !1;
132
- }
133
- _popupMenuListener(t) {
134
- var s;
135
- const e = (s = this._renderManagerService.getRenderById(t)) == null ? void 0 : s.scene;
136
- if (!e)
137
- return;
138
- const n = e.getTransformerByCreate();
139
- if (!n)
140
- return;
141
- let r;
142
- this.disposeWithMe(
143
- n.createControl$.subscribe(() => {
144
- if (this._contextService.setContextValue($e, !0), this._hasCropObject(e))
145
- return;
146
- const o = n.getSelectedObjectMap();
147
- if (o.size > 1) {
148
- r == null || r.dispose();
149
- return;
150
- }
151
- const a = o.values().next().value;
152
- if (!a)
153
- return;
154
- const d = a.oKey, u = this._drawingManagerService.getDrawingOKey(d);
155
- if (!u)
156
- return;
157
- const { unitId: c, subUnitId: l, drawingId: g, drawingType: h } = u, f = u.data;
158
- if (f && f.disablePopup)
159
- return;
160
- r == null || r.dispose();
161
- const p = this._canvasPopManagerService.getFeatureMenu(c, l, g, h);
162
- r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
163
- componentKey: ti,
164
- direction: "horizontal",
165
- offset: [2, 0],
166
- extraProps: {
167
- menuItems: p || this._getImageMenuItems(c, l, g, h)
168
- }
169
- }));
170
- })
171
- ), this.disposeWithMe(
172
- n.clearControl$.subscribe(() => {
173
- r == null || r.dispose(), this._contextService.setContextValue($e, !1), this._commandService.syncExecuteCommand(At.id, []);
174
- })
175
- ), this.disposeWithMe(
176
- this._contextService.contextChanged$.subscribe((o) => {
177
- o[$e] === !1 && (r == null || r.dispose());
178
- })
179
- ), this.disposeWithMe(
180
- n.changing$.subscribe(() => {
181
- r == null || r.dispose();
182
- })
183
- );
184
- }
185
- _getImageMenuItems(t, e, n, r) {
186
- return [
187
- {
188
- label: "image-popup.edit",
189
- index: 0,
190
- commandId: fr.id,
191
- commandParams: { unitId: t, subUnitId: e, drawingId: n },
192
- disable: r === B.DRAWING_DOM
193
- },
194
- {
195
- label: "image-popup.delete",
196
- index: 1,
197
- commandId: nt.id,
198
- commandParams: { unitId: t, drawings: [{ unitId: t, subUnitId: e, drawingId: n }] },
199
- disable: !1
200
- },
201
- {
202
- label: "image-popup.crop",
203
- index: 2,
204
- commandId: ni.id,
205
- commandParams: { unitId: t, subUnitId: e, drawingId: n },
206
- disable: r === B.DRAWING_DOM
207
- },
208
- {
209
- label: "image-popup.reset",
210
- index: 3,
211
- commandId: ri.id,
212
- commandParams: [{ unitId: t, subUnitId: e, drawingId: n }],
213
- disable: r === B.DRAWING_DOM
214
- }
215
- ];
216
- }
217
- };
218
- Rt = ns([
219
- ce(0, A(Ye)),
220
- ce(1, A(tt)),
221
- ce(2, re),
222
- ce(3, A(fi)),
223
- ce(4, Z),
224
- ce(5, Se),
225
- ce(6, Vn),
226
- ce(7, Yn),
227
- ce(8, Tr),
228
- ce(9, G)
229
- ], Rt);
230
- var rs = Object.getOwnPropertyDescriptor, is = (i, t, e, n) => {
231
- for (var r = n > 1 ? void 0 : n ? rs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
232
- (o = i[s]) && (r = o(r) || r);
233
- return r;
234
- }, St = (i, t) => (e, n) => t(e, n, i);
235
- let en = class extends ne {
236
- constructor(t, e, n, r, s) {
237
- super();
238
- ee(this, "_isSetCursor", !1);
239
- this._context = t, this._hoverManagerService = e, this._selectionsService = n, this._drawingRenderService = r, this._sheetSkeletonManagerService = s, this._initHover(), this._initImageClick();
240
- }
241
- _initHover() {
242
- this.disposeWithMe(this._hoverManagerService.currentRichTextNoDistinct$.pipe(ki(33)).subscribe((t) => {
243
- var n, r;
244
- let e = [];
245
- t !== null && (e = this._selectionsService.getWorkbookSelections(this._context.unitId).getCurrentSelections()), e.length > 0 && (t == null ? void 0 : t.unitId) === this._context.unitId && (t != null && t.drawing) && e.length === 1 && ((n = e[0].primary) == null ? void 0 : n.actualRow) === t.row && ((r = e[0].primary) == null ? void 0 : r.actualColumn) === t.col ? (this._isSetCursor = !0, this._context.scene.setCursor(oi.ZOOM_IN)) : this._isSetCursor && (this._isSetCursor = !1, this._context.scene.resetCursor());
246
- }));
247
- }
248
- _initImageClick() {
249
- this.disposeWithMe(this._hoverManagerService.currentClickedCell$.subscribe((t) => {
250
- var e;
251
- if (t != null && t.drawing && this._isSetCursor) {
252
- const n = t.drawing.drawing.drawingOrigin, r = (e = this._sheetSkeletonManagerService.getCurrentSkeleton()) == null ? void 0 : e.imageCacheMap.getImage(n.imageSourceType, n.source);
253
- if (!r) return;
254
- this._drawingRenderService.previewImage("preview-cell-image", r.src, r.width, r.height), this._context.scene.resetCursor(), this._isSetCursor = !1;
255
- }
256
- }));
257
- }
258
- };
259
- en = is([
260
- St(1, A(mi)),
261
- St(2, A(cn)),
262
- St(3, A(Xn)),
263
- St(4, A(V))
264
- ], en);
265
- function z(i, t, e) {
266
- const { from: n, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: d = 0, skewY: u = 0 } = i, c = e.getCurrent();
267
- if (c == null)
268
- return;
269
- const l = pi(
270
- c.unitId,
271
- c.sheetId,
272
- { from: n, to: r },
273
- e
274
- );
275
- let { left: g, top: h, width: f, height: p } = l;
276
- const m = e.getCurrentSkeleton(), _ = m.rowHeaderWidth + m.columnTotalWidth, v = m.columnHeaderHeight + m.rowTotalHeight;
277
- return g + f > _ && (g = _ - f), h + p > v && (h = v - p), {
278
- flipY: s,
279
- flipX: o,
280
- angle: a,
281
- skewX: d,
282
- skewY: u,
283
- left: g,
284
- top: h,
285
- width: f,
286
- height: p
287
- };
288
- }
289
- function $(i, t) {
290
- const { left: e = 0, top: n = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: d = 0, skewX: u = 0, skewY: c = 0 } = i, l = t.getCellWithCoordByOffset(e, n);
291
- if (l == null)
292
- return;
293
- const g = {
294
- column: l.actualColumn,
295
- columnOffset: wt(e - l.startX, 1),
296
- row: l.actualRow,
297
- rowOffset: wt(n - l.startY, 1)
298
- }, h = t.getCellWithCoordByOffset(e + r, n + s);
299
- if (h == null)
300
- return;
301
- const f = {
302
- column: h.actualColumn,
303
- columnOffset: wt(e + r - h.startX, 1),
304
- row: h.actualRow,
305
- rowOffset: wt(n + s - h.startY, 1)
306
- };
307
- return {
308
- flipY: o,
309
- flipX: a,
310
- angle: d,
311
- skewX: u,
312
- skewY: c,
313
- from: g,
314
- to: f
315
- };
316
- }
317
- var ss = Object.getOwnPropertyDescriptor, os = (i, t, e, n) => {
318
- for (var r = n > 1 ? void 0 : n ? ss(t, e) : t, s = i.length - 1, o; s >= 0; s--)
319
- (o = i[s]) && (r = o(r) || r);
320
- return r;
321
- }, vt = (i, t) => (e, n) => t(e, n, i);
322
- let tn = class extends ne {
323
- constructor(i, t, e, n, r) {
324
- super(), this._context = i, this._sheetDrawingService = t, this._drawingManagerService = e, this._sheetSelectionRenderService = n, this._sheetSkeletonManagerService = r, this._init();
325
- }
326
- _init() {
327
- this._drawingInitializeListener();
328
- }
329
- _drawingInitializeListener() {
330
- this._sheetDrawingService.initializeNotification(this._context.unitId);
331
- const i = this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId);
332
- for (const t in i) {
333
- const e = i[t];
334
- for (const n in e.data) {
335
- const r = e.data[n];
336
- r.sheetTransform && (r.transform = z(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService));
337
- }
338
- }
339
- this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
60
+ handler: (i) => {
61
+ const t = i.get(G), n = i.get(re).getFocusDrawings();
62
+ if (n.length === 0)
63
+ return !1;
64
+ const r = n[0].unitId, s = n.map((o) => {
65
+ const { unitId: a, subUnitId: d, drawingId: u, drawingType: c } = o;
66
+ return {
67
+ unitId: a,
68
+ subUnitId: d,
69
+ drawingId: u,
70
+ drawingType: c
71
+ };
72
+ });
73
+ return t.executeCommand(nt.id, {
74
+ unitId: r,
75
+ drawings: s
76
+ });
340
77
  }
341
78
  };
342
- tn = os([
343
- vt(1, ie),
344
- vt(2, re),
345
- vt(3, A(Xe)),
346
- vt(4, A(V))
347
- ], tn);
348
- function as(i) {
79
+ function es(i) {
349
80
  const t = [];
350
81
  return i.forEach((e) => {
351
- const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = n, d = ci(0, 0, r.map((l) => l.transform || {})), u = r.map((l) => {
82
+ const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = n, d = li(0, 0, r.map((l) => l.transform || {})), u = r.map((l) => {
352
83
  const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: f, drawingId: p } = l;
353
84
  return {
354
85
  unitId: h,
@@ -374,14 +105,14 @@ function as(i) {
374
105
  });
375
106
  }), t;
376
107
  }
377
- function cs(i) {
108
+ function ts(i) {
378
109
  const t = [];
379
110
  return i.forEach((e) => {
380
111
  const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a, transform: d = { width: 0, height: 0 } } = n;
381
112
  if (d == null)
382
113
  return;
383
114
  const u = r.map((l) => {
384
- const { transform: g } = l, { unitId: h, subUnitId: f, drawingId: p } = l, m = ai(g || {}, d, d.width || 0, d.height || 0);
115
+ const { transform: g } = l, { unitId: h, subUnitId: f, drawingId: p } = l, m = di(g || {}, d, d.width || 0, d.height || 0);
385
116
  return {
386
117
  unitId: h,
387
118
  subUnitId: f,
@@ -405,11 +136,11 @@ function cs(i) {
405
136
  });
406
137
  }), t;
407
138
  }
408
- const mr = {
139
+ const gr = {
409
140
  id: "sheet.command.group-sheet-image",
410
141
  type: J.COMMAND,
411
142
  handler: (i, t) => {
412
- const e = i.get(G), n = i.get(xe), r = i.get(ie);
143
+ const e = i.get(G), n = i.get(xe), r = i.get(re);
413
144
  if (!t) return !1;
414
145
  const s = [];
415
146
  t.forEach(({ parent: h, children: f }) => {
@@ -421,7 +152,7 @@ const mr = {
421
152
  return e.syncExecuteCommand(P.id, { op: c, unitId: a, subUnitId: d, objects: l, type: U.GROUP }) ? (n.pushUndoRedo({
422
153
  unitID: a,
423
154
  undoMutations: [
424
- { id: P.id, params: { op: u, unitId: a, subUnitId: d, objects: cs(l), type: U.UNGROUP } },
155
+ { id: P.id, params: { op: u, unitId: a, subUnitId: d, objects: ts(l), type: U.UNGROUP } },
425
156
  { id: Y.id, params: s }
426
157
  ],
427
158
  redoMutations: [
@@ -430,12 +161,65 @@ const mr = {
430
161
  ]
431
162
  }), !0) : !1;
432
163
  }
433
- }, kt = {
164
+ };
165
+ function z(i, t, e) {
166
+ const { from: n, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: d = 0, skewY: u = 0 } = i, c = e.getCurrent();
167
+ if (c == null)
168
+ return;
169
+ const l = Ii(
170
+ c.unitId,
171
+ c.sheetId,
172
+ { from: n, to: r },
173
+ e
174
+ );
175
+ let { left: g, top: h, width: f, height: p } = l;
176
+ const m = e.getCurrentSkeleton(), _ = m.rowHeaderWidth + m.columnTotalWidth, v = m.columnHeaderHeight + m.rowTotalHeight;
177
+ return g + f > _ && (g = _ - f), h + p > v && (h = v - p), {
178
+ flipY: s,
179
+ flipX: o,
180
+ angle: a,
181
+ skewX: d,
182
+ skewY: u,
183
+ left: g,
184
+ top: h,
185
+ width: f,
186
+ height: p
187
+ };
188
+ }
189
+ function $(i, t) {
190
+ const { left: e = 0, top: n = 0, width: r = 0, height: s = 0, flipY: o = !1, flipX: a = !1, angle: d = 0, skewX: u = 0, skewY: c = 0 } = i, l = t.getCellWithCoordByOffset(e, n);
191
+ if (l == null)
192
+ return;
193
+ const g = {
194
+ column: l.actualColumn,
195
+ columnOffset: wt(e - l.startX, 1),
196
+ row: l.actualRow,
197
+ rowOffset: wt(n - l.startY, 1)
198
+ }, h = t.getCellWithCoordByOffset(e + r, n + s);
199
+ if (h == null)
200
+ return;
201
+ const f = {
202
+ column: h.actualColumn,
203
+ columnOffset: wt(e + r - h.startX, 1),
204
+ row: h.actualRow,
205
+ rowOffset: wt(n + s - h.startY, 1)
206
+ };
207
+ return {
208
+ flipY: o,
209
+ flipX: a,
210
+ angle: d,
211
+ skewX: u,
212
+ skewY: c,
213
+ from: g,
214
+ to: f
215
+ };
216
+ }
217
+ const kt = {
434
218
  id: "sheet.command.insert-sheet-image",
435
219
  type: J.COMMAND,
436
220
  handler: (i, t) => {
437
221
  var v, I, R;
438
- const e = i.get(G), n = i.get(xe), r = i.get(ie), s = i.get(Nt);
222
+ const e = i.get(G), n = i.get(xe), r = i.get(re), s = i.get(At);
439
223
  if (!t) return !1;
440
224
  const o = t.drawings, a = o.map((S) => S.unitId), d = r.getBatchAddOp(o), { unitId: u, subUnitId: c, undo: l, redo: g, objects: h } = d, f = s.onCommandExecute({ id: kt.id, params: t }), p = { id: P.id, params: { op: g, unitId: u, subUnitId: c, objects: h, type: U.INSERT } }, m = { id: P.id, params: { op: l, unitId: u, subUnitId: c, objects: h, type: U.REMOVE } };
441
225
  return xn([...(v = f.preRedos) != null ? v : [], p, ...f.redos], e) ? (n.pushUndoRedo({
@@ -454,13 +238,13 @@ const mr = {
454
238
  ]
455
239
  }), !0) : !1;
456
240
  }
457
- }, pr = {
241
+ }, fr = {
458
242
  id: "sheet.command.set-drawing-arrange",
459
243
  type: J.COMMAND,
460
244
  handler: (i, t) => {
461
245
  const e = i.get(G), n = i.get(xe);
462
246
  if (!t) return !1;
463
- const r = i.get(ie), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: d } = t, u = { unitId: s, subUnitId: o, drawingIds: a };
247
+ const r = i.get(re), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: d } = t, u = { unitId: s, subUnitId: o, drawingIds: a };
464
248
  let c;
465
249
  if (d === mt.forward ? c = r.getForwardDrawingsOp(u) : d === mt.backward ? c = r.getBackwardDrawingOp(u) : d === mt.front ? c = r.getFrontDrawingsOp(u) : d === mt.back && (c = r.getBackDrawingsOp(u)), c == null)
466
250
  return !1;
@@ -479,7 +263,7 @@ const mr = {
479
263
  id: "sheet.command.set-sheet-image",
480
264
  type: J.COMMAND,
481
265
  handler: (i, t) => {
482
- const e = i.get(G), n = i.get(xe), r = i.get(ie);
266
+ const e = i.get(G), n = i.get(xe), r = i.get(re);
483
267
  if (!t) return !1;
484
268
  const { drawings: s } = t, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: d, undo: u, redo: c, objects: l } = o;
485
269
  return e.syncExecuteCommand(P.id, { unitId: a, subUnitId: d, op: c, objects: l, type: U.UPDATE }) ? (n.pushUndoRedo({
@@ -494,11 +278,11 @@ const mr = {
494
278
  ]
495
279
  }), !0) : !1;
496
280
  }
497
- }, wr = {
281
+ }, mr = {
498
282
  id: "sheet.command.ungroup-sheet-image",
499
283
  type: J.COMMAND,
500
284
  handler: (i, t) => {
501
- const e = i.get(G), n = i.get(xe), r = i.get(ie);
285
+ const e = i.get(G), n = i.get(xe), r = i.get(re);
502
286
  if (!t) return !1;
503
287
  const s = [];
504
288
  t.forEach(({ parent: h, children: f }) => {
@@ -510,7 +294,7 @@ const mr = {
510
294
  return e.syncExecuteCommand(P.id, { op: c, unitId: a, subUnitId: d, objects: l, type: U.UNGROUP }) ? (n.pushUndoRedo({
511
295
  unitID: a,
512
296
  undoMutations: [
513
- { id: P.id, params: { op: u, unitId: a, subUnitId: d, objects: as(l), type: U.GROUP } },
297
+ { id: P.id, params: { op: u, unitId: a, subUnitId: d, objects: es(l), type: U.GROUP } },
514
298
  { id: Y.id, params: s }
515
299
  ],
516
300
  redoMutations: [
@@ -520,18 +304,18 @@ const mr = {
520
304
  }), !0) : !1;
521
305
  }
522
306
  };
523
- var ds = Object.getOwnPropertyDescriptor, ls = (i, t, e, n) => {
524
- for (var r = n > 1 ? void 0 : n ? ds(t, e) : t, s = i.length - 1, o; s >= 0; s--)
307
+ var ns = Object.getOwnPropertyDescriptor, rs = (i, t, e, n) => {
308
+ for (var r = n > 1 ? void 0 : n ? ns(t, e) : t, s = i.length - 1, o; s >= 0; s--)
525
309
  (o = i[s]) && (r = o(r) || r);
526
310
  return r;
527
311
  }, te = (i, t) => (e, n) => t(e, n, i);
528
- function us(i, t, e) {
312
+ function is(i, t, e) {
529
313
  const n = e * Math.PI / 180, r = Math.abs(i * Math.cos(n)) + Math.abs(t * Math.sin(n)), s = Math.abs(i * Math.sin(n)) + Math.abs(t * Math.cos(n));
530
314
  return { rotatedWidth: r, rotatedHeight: s };
531
315
  }
532
- function nn(i, t, e, n, r) {
316
+ function en(i, t, e, n, r) {
533
317
  var v;
534
- const { rotatedHeight: s, rotatedWidth: o } = us(e, n, r), d = i.get(Z).getRenderById(t.unitId);
318
+ const { rotatedHeight: s, rotatedWidth: o } = is(e, n, r), d = i.get(Z).getRenderById(t.unitId);
535
319
  if (!d)
536
320
  return !1;
537
321
  const c = (v = d.with(V).getSkeletonParam(t.subUnitId)) == null ? void 0 : v.skeleton;
@@ -552,17 +336,17 @@ let Qe = class extends ne {
552
336
  async insertFloatImage() {
553
337
  const t = await this._fileOpenerService.openFile({
554
338
  multiple: !0,
555
- accept: In.map((n) => `.${n.replace("image/", "")}`).join(",")
339
+ accept: Mn.map((n) => `.${n.replace("image/", "")}`).join(",")
556
340
  }), e = t.length;
557
- return e > Cn ? (this._messageService.show({
341
+ return e > yn ? (this._messageService.show({
558
342
  type: pe.Error,
559
- content: this._localeService.t("update-status.exceedMaxCount", String(Cn))
343
+ content: this._localeService.t("update-status.exceedMaxCount", String(yn))
560
344
  }), !1) : e === 0 ? !1 : (t.forEach(async (n) => await this.insertFloatImageByFile(n)), !0);
561
345
  }
562
346
  async insertCellImage() {
563
347
  const e = (await this._fileOpenerService.openFile({
564
348
  multiple: !1,
565
- accept: In.map((n) => `.${n.replace("image/", "")}`).join(",")
349
+ accept: Mn.map((n) => `.${n.replace("image/", "")}`).join(",")
566
350
  }))[0];
567
351
  return e ? (await this._insertCellImage(e), !0) : !1;
568
352
  }
@@ -575,24 +359,24 @@ let Qe = class extends ne {
575
359
  e = await this._imageIoService.saveImage(t);
576
360
  } catch (v) {
577
361
  const I = v.message;
578
- I === Ue.ERROR_EXCEED_SIZE ? this._messageService.show({
362
+ I === Ae.ERROR_EXCEED_SIZE ? this._messageService.show({
579
363
  type: pe.Error,
580
- content: this._localeService.t("update-status.exceedMaxSize", String(Dn / (1024 * 1024)))
581
- }) : I === Ue.ERROR_IMAGE_TYPE ? this._messageService.show({
364
+ content: this._localeService.t("update-status.exceedMaxSize", String(En / (1024 * 1024)))
365
+ }) : I === Ae.ERROR_IMAGE_TYPE ? this._messageService.show({
582
366
  type: pe.Error,
583
367
  content: this._localeService.t("update-status.invalidImageType")
584
- }) : I === Ue.ERROR_IMAGE && this._messageService.show({
368
+ }) : I === Ae.ERROR_IMAGE && this._messageService.show({
585
369
  type: pe.Error,
586
370
  content: this._localeService.t("update-status.invalidImage")
587
371
  });
588
372
  }
589
373
  if (e == null)
590
374
  return;
591
- const n = this._getUnitInfo(), { unitId: r, subUnitId: s } = n, { imageId: o, imageSourceType: a, source: d, base64Cache: u } = e, { width: c, height: l, image: g } = await xt(u || ""), { width: h, height: f } = this._context.scene;
375
+ const n = this._getUnitInfo(), { unitId: r, subUnitId: s } = n, { imageId: o, imageSourceType: a, source: d, base64Cache: u } = e, { width: c, height: l, image: g } = await Xt(u || ""), { width: h, height: f } = this._context.scene;
592
376
  this._imageIoService.addImageSourceCache(d, a, g);
593
377
  let p = 1;
594
- if (c > Rn || l > bn) {
595
- const v = Rn / c, I = bn / l;
378
+ if (c > Tn || l > On) {
379
+ const v = Tn / c, I = On / l;
596
380
  p = Math.max(v, I);
597
381
  }
598
382
  const m = this._getImagePosition(c * p, l * p, h, f);
@@ -621,27 +405,27 @@ let Qe = class extends ne {
621
405
  n = await this._imageIoService.saveImage(t);
622
406
  } catch (S) {
623
407
  const C = S.message;
624
- C === Ue.ERROR_EXCEED_SIZE ? this._messageService.show({
408
+ C === Ae.ERROR_EXCEED_SIZE ? this._messageService.show({
625
409
  type: pe.Error,
626
- content: this._localeService.t("update-status.exceedMaxSize", String(Dn / (1024 * 1024)))
627
- }) : C === Ue.ERROR_IMAGE_TYPE ? this._messageService.show({
410
+ content: this._localeService.t("update-status.exceedMaxSize", String(En / (1024 * 1024)))
411
+ }) : C === Ae.ERROR_IMAGE_TYPE ? this._messageService.show({
628
412
  type: pe.Error,
629
413
  content: this._localeService.t("update-status.invalidImageType")
630
- }) : C === Ue.ERROR_IMAGE && this._messageService.show({
414
+ }) : C === Ae.ERROR_IMAGE && this._messageService.show({
631
415
  type: pe.Error,
632
416
  content: this._localeService.t("update-status.invalidImage")
633
417
  });
634
418
  }
635
419
  if (n == null)
636
420
  return !1;
637
- const { imageId: r, imageSourceType: s, source: o, base64Cache: a } = n, { width: d, height: u, image: c } = await xt(a || "");
421
+ const { imageId: r, imageSourceType: s, source: o, base64Cache: a } = n, { width: d, height: u, image: c } = await Xt(a || "");
638
422
  this._imageIoService.addImageSourceCache(o, s, c);
639
423
  const l = this._workbookSelections.getCurrentLastSelection();
640
424
  if (!l)
641
425
  return !1;
642
426
  let g = l.primary.actualRow, h = l.primary.actualColumn;
643
427
  l.primary.isMerged && (g = l.primary.startRow, h = l.primary.startColumn);
644
- const f = Vt("", {}), p = nn(
428
+ const f = Vt("", {}), p = en(
645
429
  this._injector,
646
430
  {
647
431
  unitId: this._context.unitId,
@@ -676,7 +460,7 @@ let Qe = class extends ne {
676
460
  drawingType: B.DRAWING_IMAGE,
677
461
  imageSourceType: s,
678
462
  source: o,
679
- transform: Bn(m),
463
+ transform: bn(m),
680
464
  docTransform: m,
681
465
  behindDoc: Sn.FALSE,
682
466
  title: "",
@@ -697,7 +481,7 @@ let Qe = class extends ne {
697
481
  endOffset: 0
698
482
  }
699
483
  });
700
- return v ? (f.apply(v), this._commandService.syncExecuteCommand(Nn.id, {
484
+ return v ? (f.apply(v), this._commandService.syncExecuteCommand(In.id, {
701
485
  value: {
702
486
  [(I = e == null ? void 0 : e.row) != null ? I : g]: {
703
487
  [(R = e == null ? void 0 : e.col) != null ? R : h]: {
@@ -713,12 +497,12 @@ let Qe = class extends ne {
713
497
  // eslint-disable-next-line max-lines-per-function
714
498
  async insertCellImageByUrl(t, e) {
715
499
  var g, h;
716
- const { width: n, height: r, image: s } = await xt(t || "");
500
+ const { width: n, height: r, image: s } = await Xt(t || "");
717
501
  this._imageIoService.addImageSourceCache(t, vn.URL, s);
718
502
  const o = this._workbookSelections.getCurrentLastSelection();
719
503
  if (!o)
720
504
  return !1;
721
- const a = Vt("", {}), d = nn(
505
+ const a = Vt("", {}), d = en(
722
506
  this._injector,
723
507
  {
724
508
  unitId: this._context.unitId,
@@ -753,7 +537,7 @@ let Qe = class extends ne {
753
537
  drawingType: B.DRAWING_IMAGE,
754
538
  imageSourceType: vn.URL,
755
539
  source: t,
756
- transform: Bn(u),
540
+ transform: bn(u),
757
541
  docTransform: u,
758
542
  behindDoc: Sn.FALSE,
759
543
  title: "",
@@ -774,7 +558,7 @@ let Qe = class extends ne {
774
558
  endOffset: 0
775
559
  }
776
560
  });
777
- return l ? (a.apply(l), this._commandService.syncExecuteCommand(Nn.id, {
561
+ return l ? (a.apply(l), this._commandService.syncExecuteCommand(In.id, {
778
562
  value: {
779
563
  [(g = e == null ? void 0 : e.row) != null ? g : o.primary.actualRow]: {
780
564
  [(h = e == null ? void 0 : e.col) != null ? h : o.primary.actualColumn]: {
@@ -803,7 +587,7 @@ let Qe = class extends ne {
803
587
  endColumn: 0
804
588
  };
805
589
  s && s.length > 0 && (o = s[s.length - 1].range);
806
- const a = Ln(this._skeletonManagerService.getCurrent().skeleton, o);
590
+ const a = ar(this._skeletonManagerService.getCurrent().skeleton, o);
807
591
  if (a == null)
808
592
  return;
809
593
  let { startColumn: d, startRow: u, startX: c, startY: l } = a, g = !1;
@@ -835,7 +619,7 @@ let Qe = class extends ne {
835
619
  _updateOrderListener() {
836
620
  this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((t) => {
837
621
  const { unitId: e, subUnitId: n, drawingIds: r, arrangeType: s } = t;
838
- this._commandService.executeCommand(pr.id, {
622
+ this._commandService.executeCommand(fr.id, {
839
623
  unitId: e,
840
624
  subUnitId: n,
841
625
  drawingIds: r,
@@ -843,71 +627,364 @@ let Qe = class extends ne {
843
627
  });
844
628
  }));
845
629
  }
846
- _updateImageListener() {
847
- this.disposeWithMe(this._drawingManagerService.featurePluginUpdate$.subscribe((t) => {
848
- const e = [];
849
- t.length !== 0 && (t.forEach((n) => {
850
- const { unitId: r, subUnitId: s, drawingId: o, drawingType: a, transform: d } = n;
851
- if (d == null)
630
+ _updateImageListener() {
631
+ this.disposeWithMe(this._drawingManagerService.featurePluginUpdate$.subscribe((t) => {
632
+ const e = [];
633
+ t.length !== 0 && (t.forEach((n) => {
634
+ const { unitId: r, subUnitId: s, drawingId: o, drawingType: a, transform: d } = n;
635
+ if (d == null)
636
+ return;
637
+ const u = this._sheetDrawingService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: o });
638
+ if (u == null || u.unitId !== this._context.unitId)
639
+ return;
640
+ const c = $({ ...u.transform, ...d }, this._selectionRenderService);
641
+ if (c == null)
642
+ return;
643
+ const l = {
644
+ ...n,
645
+ transform: { ...u.transform, ...d, ...z(c, this._selectionRenderService, this._skeletonManagerService) },
646
+ sheetTransform: { ...c }
647
+ };
648
+ e.push(l);
649
+ }), e.length > 0 && this._commandService.executeCommand(Wt.id, {
650
+ unitId: t[0].unitId,
651
+ drawings: e
652
+ }));
653
+ }));
654
+ }
655
+ _groupDrawingListener() {
656
+ this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((t) => {
657
+ this._commandService.executeCommand(gr.id, t);
658
+ const { unitId: e, subUnitId: n, drawingId: r } = t[0].parent;
659
+ this._commandService.syncExecuteCommand(Nt.id, [{ unitId: e, subUnitId: n, drawingId: r }]);
660
+ })), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((t) => {
661
+ this._commandService.executeCommand(mr.id, t);
662
+ }));
663
+ }
664
+ _focusDrawingListener() {
665
+ this.disposeWithMe(
666
+ this._drawingManagerService.focus$.subscribe((t) => {
667
+ t == null || t.length === 0 ? (this._contextService.setContextValue($e, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue($e, !0), this._sheetDrawingService.focusDrawing(t));
668
+ })
669
+ );
670
+ }
671
+ };
672
+ Qe = rs([
673
+ te(1, A(V)),
674
+ te(2, G),
675
+ te(3, Xe),
676
+ te(4, _i),
677
+ te(5, Pi),
678
+ te(6, re),
679
+ te(7, ie),
680
+ te(8, Yn),
681
+ te(9, cr),
682
+ te(10, A(tt)),
683
+ te(11, A(sn)),
684
+ te(12, A(Ye))
685
+ ], Qe);
686
+ const Bt = {
687
+ id: "sheet.command.insert-float-image",
688
+ type: J.COMMAND,
689
+ handler: async (i, t) => {
690
+ var o, a;
691
+ const e = i.get(Se), n = i.get(Z), r = (o = on(
692
+ F.UNIVER_SHEET,
693
+ e,
694
+ n
695
+ )) == null ? void 0 : o.with(Qe);
696
+ if (!r)
697
+ return !1;
698
+ const s = t == null ? void 0 : t.files;
699
+ if (s) {
700
+ const d = s.map((u) => r.insertFloatImageByFile(u));
701
+ return (await Promise.all(d)).every((u) => u);
702
+ } else
703
+ return (a = r.insertFloatImage()) != null ? a : !1;
704
+ }
705
+ }, dn = {
706
+ id: "sheet.command.insert-cell-image",
707
+ type: J.COMMAND,
708
+ handler: (i) => {
709
+ var n, r;
710
+ const t = i.get(Se), e = i.get(Z);
711
+ return (r = (n = on(
712
+ F.UNIVER_SHEET,
713
+ t,
714
+ e
715
+ )) == null ? void 0 : n.with(Qe).insertCellImage()) != null ? r : !1;
716
+ }
717
+ }, rt = {
718
+ id: "sheet.command.move-drawing",
719
+ type: J.COMMAND,
720
+ handler: (i, t) => {
721
+ const e = i.get(G), n = i.get(re), r = i.get(Xe), { direction: s } = t, o = n.getFocusDrawings();
722
+ if (o.length === 0)
723
+ return !1;
724
+ const a = o[0].unitId, d = o.map((c) => {
725
+ const { transform: l } = c;
726
+ if (l == null)
727
+ return null;
728
+ const g = { ...l }, { left: h = 0, top: f = 0 } = l;
729
+ return s === _e.UP ? g.top = f - 1 : s === _e.DOWN ? g.top = f + 1 : s === _e.LEFT ? g.left = h - 1 : s === _e.RIGHT && (g.left = h + 1), {
730
+ ...c,
731
+ transform: g,
732
+ sheetTransform: $(g, r)
733
+ };
734
+ }).filter((c) => c != null);
735
+ return e.syncExecuteCommand(Wt.id, {
736
+ unitId: a,
737
+ drawings: d
738
+ }) ? (e.syncExecuteCommand(Y.id, [a]), !0) : !1;
739
+ }
740
+ }, pr = "COMPONENT_SHEET_DRAWING_PANEL", wr = {
741
+ id: "sidebar.operation.sheet-image",
742
+ type: J.COMMAND,
743
+ handler: async (i, t) => {
744
+ const e = i.get(Ai), n = i.get(tt), r = i.get(Se), s = i.get(G);
745
+ if (!se(r)) return !1;
746
+ switch (t.value) {
747
+ case "open":
748
+ e.open({
749
+ header: { title: n.t("sheetImage.panel.title") },
750
+ children: { label: pr },
751
+ onClose: () => {
752
+ s.syncExecuteCommand(Nt.id, []);
753
+ },
754
+ width: 360
755
+ });
756
+ break;
757
+ case "close":
758
+ default:
759
+ e.close();
760
+ break;
761
+ }
762
+ return !0;
763
+ }
764
+ }, _r = {
765
+ id: "sheet.operation.edit-sheet-image",
766
+ type: J.OPERATION,
767
+ handler: (i, t) => {
768
+ const e = i.get(G);
769
+ return t == null ? !1 : (e.syncExecuteCommand(Nt.id, [t]), e.executeCommand(wr.id, { value: "open" }), !0);
770
+ }
771
+ }, ss = "sheets-drawing-ui.config", jn = {};
772
+ var os = Object.getOwnPropertyDescriptor, as = (i, t, e, n) => {
773
+ for (var r = n > 1 ? void 0 : n ? os(t, e) : t, s = i.length - 1, o; s >= 0; s--)
774
+ (o = i[s]) && (r = o(r) || r);
775
+ return r;
776
+ }, ce = (i, t) => (e, n) => t(e, n, i);
777
+ let Rt = class extends Or {
778
+ constructor(t, e, n, r, s, o, a, d, u, c) {
779
+ super();
780
+ ee(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
781
+ this._injector = t, this._localeService = e, this._drawingManagerService = n, this._canvasPopManagerService = r, this._renderManagerService = s, this._univerInstanceService = o, this._messageService = a, this._contextService = d, this._ioService = u, this._commandService = c, this._init();
782
+ }
783
+ _init() {
784
+ this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(Nn(this.dispose$)).subscribe((t) => this._create(t)), this._univerInstanceService.getTypeOfUnitDisposed$(F.UNIVER_SHEET).pipe(Nn(this.dispose$)).subscribe((t) => this._dispose(t)), this._univerInstanceService.getAllUnitsForType(F.UNIVER_SHEET).forEach((t) => this._create(t)), this._setupLoadingStatus();
785
+ }
786
+ _setupLoadingStatus() {
787
+ const t = "image-upload-loading";
788
+ let e;
789
+ this.disposeWithMe(this._ioService.change$.subscribe((n) => {
790
+ n > 0 && !e ? e = this._messageService.show({
791
+ id: t,
792
+ type: pe.Loading,
793
+ content: `${this._localeService.t("uploadLoading.loading")}: ${n}`,
794
+ duration: 0
795
+ }) : n === 0 && (e == null || e.dispose(), e = void 0);
796
+ }));
797
+ }
798
+ _dispose(t) {
799
+ super.dispose();
800
+ const e = t.getUnitId();
801
+ this._renderManagerService.removeRender(e);
802
+ }
803
+ _create(t) {
804
+ if (!t)
805
+ return;
806
+ const e = t.getUnitId();
807
+ this._renderManagerService.has(e) && !this._initImagePopupMenu.has(e) && (this._popupMenuListener(e), this._initImagePopupMenu.add(e));
808
+ }
809
+ _hasCropObject(t) {
810
+ const e = t.getAllObjectsByOrder();
811
+ for (const n of e)
812
+ if (n instanceof Gi)
813
+ return !0;
814
+ return !1;
815
+ }
816
+ _popupMenuListener(t) {
817
+ var s;
818
+ const e = (s = this._renderManagerService.getRenderById(t)) == null ? void 0 : s.scene;
819
+ if (!e)
820
+ return;
821
+ const n = e.getTransformerByCreate();
822
+ if (!n)
823
+ return;
824
+ let r;
825
+ this.disposeWithMe(
826
+ n.createControl$.subscribe(() => {
827
+ if (this._contextService.setContextValue($e, !0), this._hasCropObject(e))
852
828
  return;
853
- const u = this._sheetDrawingService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: o });
854
- if (u == null || u.unitId !== this._context.unitId)
829
+ const o = n.getSelectedObjectMap();
830
+ if (o.size > 1) {
831
+ r == null || r.dispose();
855
832
  return;
856
- const c = $({ ...u.transform, ...d }, this._selectionRenderService);
857
- if (c == null)
833
+ }
834
+ const a = o.values().next().value;
835
+ if (!a)
858
836
  return;
859
- const l = {
860
- ...n,
861
- transform: { ...u.transform, ...d, ...z(c, this._selectionRenderService, this._skeletonManagerService) },
862
- sheetTransform: { ...c }
863
- };
864
- e.push(l);
865
- }), e.length > 0 && this._commandService.executeCommand(Wt.id, {
866
- unitId: t[0].unitId,
867
- drawings: e
868
- }));
837
+ const d = a.oKey, u = this._drawingManagerService.getDrawingOKey(d);
838
+ if (!u)
839
+ return;
840
+ const { unitId: c, subUnitId: l, drawingId: g, drawingType: h } = u, f = u.data;
841
+ if (f && f.disablePopup)
842
+ return;
843
+ r == null || r.dispose();
844
+ const p = this._canvasPopManagerService.getFeatureMenu(c, l, g, h);
845
+ r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
846
+ componentKey: Li,
847
+ direction: "horizontal",
848
+ offset: [2, 0],
849
+ extraProps: {
850
+ menuItems: p || this._getImageMenuItems(c, l, g, h)
851
+ }
852
+ }));
853
+ })
854
+ ), this.disposeWithMe(
855
+ n.clearControl$.subscribe(() => {
856
+ r == null || r.dispose(), this._contextService.setContextValue($e, !1), this._commandService.syncExecuteCommand(Nt.id, []);
857
+ })
858
+ ), this.disposeWithMe(
859
+ this._contextService.contextChanged$.subscribe((o) => {
860
+ o[$e] === !1 && (r == null || r.dispose());
861
+ })
862
+ ), this.disposeWithMe(
863
+ n.changing$.subscribe(() => {
864
+ r == null || r.dispose();
865
+ })
866
+ );
867
+ }
868
+ _getImageMenuItems(t, e, n, r) {
869
+ return [
870
+ {
871
+ label: "image-popup.edit",
872
+ index: 0,
873
+ commandId: _r.id,
874
+ commandParams: { unitId: t, subUnitId: e, drawingId: n },
875
+ disable: r === B.DRAWING_DOM
876
+ },
877
+ {
878
+ label: "image-popup.delete",
879
+ index: 1,
880
+ commandId: nt.id,
881
+ commandParams: { unitId: t, drawings: [{ unitId: t, subUnitId: e, drawingId: n }] },
882
+ disable: !1
883
+ },
884
+ {
885
+ label: "image-popup.crop",
886
+ index: 2,
887
+ commandId: Vi.id,
888
+ commandParams: { unitId: t, subUnitId: e, drawingId: n },
889
+ disable: r === B.DRAWING_DOM
890
+ },
891
+ {
892
+ label: "image-popup.reset",
893
+ index: 3,
894
+ commandId: Hi.id,
895
+ commandParams: [{ unitId: t, subUnitId: e, drawingId: n }],
896
+ disable: r === B.DRAWING_DOM
897
+ }
898
+ ];
899
+ }
900
+ };
901
+ Rt = as([
902
+ ce(0, A(Ye)),
903
+ ce(1, A(tt)),
904
+ ce(2, ie),
905
+ ce(3, A(Ci)),
906
+ ce(4, Z),
907
+ ce(5, Se),
908
+ ce(6, cr),
909
+ ce(7, Yn),
910
+ ce(8, Tr),
911
+ ce(9, G)
912
+ ], Rt);
913
+ var cs = Object.getOwnPropertyDescriptor, ds = (i, t, e, n) => {
914
+ for (var r = n > 1 ? void 0 : n ? cs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
915
+ (o = i[s]) && (r = o(r) || r);
916
+ return r;
917
+ }, St = (i, t) => (e, n) => t(e, n, i);
918
+ let tn = class extends ne {
919
+ constructor(t, e, n, r, s) {
920
+ super();
921
+ ee(this, "_isSetCursor", !1);
922
+ this._context = t, this._hoverManagerService = e, this._selectionsService = n, this._drawingRenderService = r, this._sheetSkeletonManagerService = s, this._initHover(), this._initImageClick();
923
+ }
924
+ _initHover() {
925
+ this.disposeWithMe(this._hoverManagerService.currentRichTextNoDistinct$.pipe(Ji(33)).subscribe((t) => {
926
+ var n, r;
927
+ let e = [];
928
+ t !== null && (e = this._selectionsService.getWorkbookSelections(this._context.unitId).getCurrentSelections()), e.length > 0 && (t == null ? void 0 : t.unitId) === this._context.unitId && (t != null && t.drawing) && e.length === 1 && ((n = e[0].primary) == null ? void 0 : n.actualRow) === t.row && ((r = e[0].primary) == null ? void 0 : r.actualColumn) === t.col ? (this._isSetCursor = !0, this._context.scene.setCursor(ui.ZOOM_IN)) : this._isSetCursor && (this._isSetCursor = !1, this._context.scene.resetCursor());
869
929
  }));
870
930
  }
871
- _groupDrawingListener() {
872
- this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((t) => {
873
- this._commandService.executeCommand(mr.id, t);
874
- const { unitId: e, subUnitId: n, drawingId: r } = t[0].parent;
875
- this._commandService.syncExecuteCommand(At.id, [{ unitId: e, subUnitId: n, drawingId: r }]);
876
- })), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((t) => {
877
- this._commandService.executeCommand(wr.id, t);
931
+ _initImageClick() {
932
+ this.disposeWithMe(this._hoverManagerService.currentClickedCell$.subscribe((t) => {
933
+ var e;
934
+ if (t != null && t.drawing && this._isSetCursor) {
935
+ const n = t.drawing.drawing.drawingOrigin, r = (e = this._sheetSkeletonManagerService.getCurrentSkeleton()) == null ? void 0 : e.imageCacheMap.getImage(n.imageSourceType, n.source);
936
+ if (!r) return;
937
+ this._drawingRenderService.previewImage("preview-cell-image", r.src, r.width, r.height), this._context.scene.resetCursor(), this._isSetCursor = !1;
938
+ }
878
939
  }));
879
940
  }
880
- _focusDrawingListener() {
881
- this.disposeWithMe(
882
- this._drawingManagerService.focus$.subscribe((t) => {
883
- t == null || t.length === 0 ? (this._contextService.setContextValue($e, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue($e, !0), this._sheetDrawingService.focusDrawing(t));
884
- })
885
- );
941
+ };
942
+ tn = ds([
943
+ St(1, A(Di)),
944
+ St(2, A(sn)),
945
+ St(3, A(lr)),
946
+ St(4, A(V))
947
+ ], tn);
948
+ var ls = Object.getOwnPropertyDescriptor, us = (i, t, e, n) => {
949
+ for (var r = n > 1 ? void 0 : n ? ls(t, e) : t, s = i.length - 1, o; s >= 0; s--)
950
+ (o = i[s]) && (r = o(r) || r);
951
+ return r;
952
+ }, vt = (i, t) => (e, n) => t(e, n, i);
953
+ let nn = class extends ne {
954
+ constructor(i, t, e, n, r) {
955
+ super(), this._context = i, this._sheetDrawingService = t, this._drawingManagerService = e, this._sheetSelectionRenderService = n, this._sheetSkeletonManagerService = r, this._init();
956
+ }
957
+ _init() {
958
+ this._drawingInitializeListener();
959
+ }
960
+ _drawingInitializeListener() {
961
+ this._sheetDrawingService.initializeNotification(this._context.unitId);
962
+ const i = this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId);
963
+ for (const t in i) {
964
+ const e = i[t];
965
+ for (const n in e.data) {
966
+ const r = e.data[n];
967
+ r.sheetTransform && (r.transform = z(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService));
968
+ }
969
+ }
970
+ this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
886
971
  }
887
972
  };
888
- Qe = ls([
889
- te(1, A(V)),
890
- te(2, G),
891
- te(3, Xe),
892
- te(4, Zr),
893
- te(5, Mi),
894
- te(6, ie),
895
- te(7, re),
896
- te(8, Yn),
897
- te(9, Vn),
898
- te(10, A(tt)),
899
- te(11, A(cn)),
900
- te(12, A(Ye))
901
- ], Qe);
973
+ nn = us([
974
+ vt(1, re),
975
+ vt(2, ie),
976
+ vt(3, A(Xe)),
977
+ vt(4, A(V))
978
+ ], nn);
902
979
  var hs = Object.getOwnPropertyDescriptor, gs = (i, t, e, n) => {
903
980
  for (var r = n > 1 ? void 0 : n ? hs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
904
981
  (o = i[s]) && (r = o(r) || r);
905
982
  return r;
906
983
  }, Ne = (i, t) => (e, n) => t(e, n, i);
907
- function _r(i, t, e) {
984
+ function Sr(i, t, e) {
908
985
  var n, r, s, o;
909
986
  if (((r = (n = e == null ? void 0 : e.p) == null ? void 0 : n.body) == null ? void 0 : r.dataStream.length) === 3 && ((o = (s = e.p) == null ? void 0 : s.drawingsOrder) == null ? void 0 : o.length) === 1) {
910
- const a = e.p.drawings[e.p.drawingsOrder[0]], d = nn(
987
+ const a = e.p.drawings[e.p.drawingsOrder[0]], d = en(
911
988
  i,
912
989
  {
913
990
  unitId: t.unitId,
@@ -932,19 +1009,19 @@ let bt = class extends ne {
932
1009
  this.disposeWithMe(this._editorBridgeService.visible$.subscribe((i) => {
933
1010
  i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(Ze), this._docDrawingController.loadDrawingDataForUnit(Ze), this._drawingManagerService.initializeNotification(Ze)) : this._drawingManagerService.removeDrawingDataForUnit(Ze);
934
1011
  })), this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
935
- i.id === Zi.id && i.params.unitId === Be && (this._drawingManagerService.removeDrawingDataForUnit(Be), this._docDrawingController.loadDrawingDataForUnit(Be), this._drawingManagerService.initializeNotification(Be));
1012
+ i.id === pi.id && i.params.unitId === Be && (this._drawingManagerService.removeDrawingDataForUnit(Be), this._docDrawingController.loadDrawingDataForUnit(Be), this._drawingManagerService.initializeNotification(Be));
936
1013
  }));
937
1014
  }
938
1015
  _initCellContentInterceptor() {
939
1016
  this.disposeWithMe(
940
1017
  this._sheetInterceptorService.intercept(
941
- ji.CELL_CONTENT,
1018
+ Jr.CELL_CONTENT,
942
1019
  {
943
1020
  effect: Ur.Style,
944
- priority: $i.CELL_IMAGE,
1021
+ priority: Zr.CELL_IMAGE,
945
1022
  handler: (i, t, e) => {
946
1023
  var n;
947
- return i != null && i.p && ((n = i.p.drawingsOrder) != null && n.length) && (i === t.rawData && (i = { ...t.rawData }), i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }, _r(this._injector, { unitId: t.unitId, subUnitId: t.subUnitId, row: t.row, col: t.col }, i)), e(i);
1024
+ return i != null && i.p && ((n = i.p.drawingsOrder) != null && n.length) && (i === t.rawData && (i = { ...t.rawData }), i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }, Sr(this._injector, { unitId: t.unitId, subUnitId: t.subUnitId, row: t.row, col: t.col }, i)), e(i);
948
1025
  }
949
1026
  }
950
1027
  )
@@ -953,11 +1030,11 @@ let bt = class extends ne {
953
1030
  };
954
1031
  bt = gs([
955
1032
  Ne(0, G),
956
- Ne(1, A(Nt)),
1033
+ Ne(1, A(At)),
957
1034
  Ne(2, A(Ye)),
958
- Ne(3, re),
959
- Ne(4, A(Kr)),
960
- Ne(5, A(wi))
1035
+ Ne(3, ie),
1036
+ Ne(4, A(Yi)),
1037
+ Ne(5, A(Ri))
961
1038
  ], bt);
962
1039
  var fs = Object.getOwnPropertyDescriptor, ms = (i, t, e, n) => {
963
1040
  for (var r = n > 1 ? void 0 : n ? fs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
@@ -974,7 +1051,7 @@ let Mt = class extends ne {
974
1051
  id: "sheet-cell-image-autofill",
975
1052
  onBeforeSubmit: (i, t, e, n) => {
976
1053
  new Pr(n).forValue((r, s, o) => {
977
- _r(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
1054
+ Sr(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
978
1055
  });
979
1056
  }
980
1057
  })
@@ -982,7 +1059,7 @@ let Mt = class extends ne {
982
1059
  }
983
1060
  };
984
1061
  Mt = ms([
985
- $n(0, A(_i)),
1062
+ $n(0, A(bi)),
986
1063
  $n(1, A(Ye))
987
1064
  ], Mt);
988
1065
  var ps = Object.getOwnPropertyDescriptor, ws = (i, t, e, n) => {
@@ -1001,7 +1078,7 @@ let yt = class extends ne {
1001
1078
  }
1002
1079
  _setCellImage(i) {
1003
1080
  var r;
1004
- const t = Vt("", {}), e = (r = sn(F.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.with(Si), n = Ht.drawing.add({
1081
+ const t = Vt("", {}), e = (r = on(F.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.with(Mi), n = Ht.drawing.add({
1005
1082
  documentDataModel: t,
1006
1083
  drawings: [i],
1007
1084
  selection: {
@@ -1016,7 +1093,7 @@ let yt = class extends ne {
1016
1093
  this.disposeWithMe(
1017
1094
  this._commandService.beforeCommandExecuted((i) => {
1018
1095
  var t, e;
1019
- if (i.id === qi.id) {
1096
+ if (i.id === wi.id) {
1020
1097
  const n = i.params, { doc: r } = n, s = this._univerInstanceService.getCurrentUnitOfType(F.UNIVER_DOC);
1021
1098
  if (s == null || !Object.keys((t = r.drawings) != null ? t : {}).length)
1022
1099
  return;
@@ -1024,12 +1101,12 @@ let yt = class extends ne {
1024
1101
  if (_s.includes(o)) {
1025
1102
  if (o !== Be) {
1026
1103
  const a = () => {
1027
- this._dialogService.close("sheet-cell-image-copy-paste"), this._commandService.syncExecuteCommand(yn.id, {
1104
+ this._dialogService.close("sheet-cell-image-copy-paste"), this._commandService.syncExecuteCommand(Un.id, {
1028
1105
  visible: !1
1029
1106
  });
1030
1107
  };
1031
1108
  ((e = s.getBody()) == null ? void 0 : e.dataStream) === `\r
1032
- ` ? (this._commandService.syncExecuteCommand(yn.id, {
1109
+ ` ? (this._commandService.syncExecuteCommand(Un.id, {
1033
1110
  visible: !1
1034
1111
  }), this._setCellImage(Object.values(r.drawings)[0])) : this._dialogService.open({
1035
1112
  id: "sheet-cell-image-copy-paste",
@@ -1060,56 +1137,24 @@ let yt = class extends ne {
1060
1137
  yt = ws([
1061
1138
  He(0, G),
1062
1139
  He(1, Se),
1063
- He(2, yi),
1140
+ He(2, Ni),
1064
1141
  He(3, Z),
1065
1142
  He(4, A(tt))
1066
1143
  ], yt);
1067
- const Bt = {
1068
- id: "sheet.command.insert-float-image",
1069
- type: J.COMMAND,
1070
- handler: async (i, t) => {
1071
- var o, a;
1072
- const e = i.get(Se), n = i.get(Z), r = (o = sn(
1073
- F.UNIVER_SHEET,
1074
- e,
1075
- n
1076
- )) == null ? void 0 : o.with(Qe);
1077
- if (!r)
1078
- return !1;
1079
- const s = t == null ? void 0 : t.files;
1080
- if (s) {
1081
- const d = s.map((u) => r.insertFloatImageByFile(u));
1082
- return (await Promise.all(d)).every((u) => u);
1083
- } else
1084
- return (a = r.insertFloatImage()) != null ? a : !1;
1085
- }
1086
- }, dn = {
1087
- id: "sheet.command.insert-cell-image",
1088
- type: J.COMMAND,
1089
- handler: (i) => {
1090
- var n, r;
1091
- const t = i.get(Se), e = i.get(Z);
1092
- return (r = (n = sn(
1093
- F.UNIVER_SHEET,
1094
- t,
1095
- e
1096
- )) == null ? void 0 : n.with(Qe).insertCellImage()) != null ? r : !1;
1097
- }
1098
- };
1099
1144
  var Ss = Object.getOwnPropertyDescriptor, vs = (i, t, e, n) => {
1100
1145
  for (var r = n > 1 ? void 0 : n ? Ss(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1101
1146
  (o = i[s]) && (r = o(r) || r);
1102
1147
  return r;
1103
1148
  }, ze = (i, t) => (e, n) => t(e, n, i);
1104
- const Sr = "image/png";
1149
+ const vr = "image/png";
1105
1150
  function Is(i) {
1106
1151
  const t = i.split(","), e = atob(t[1]), n = e.length, r = new Uint8Array(n);
1107
1152
  for (let s = 0; s < n; s++)
1108
1153
  r[s] = e.charCodeAt(s);
1109
- return new Blob([r], { type: Sr });
1154
+ return new Blob([r], { type: vr });
1110
1155
  }
1111
1156
  function Cs(i) {
1112
- const t = new ClipboardItem({ [Sr]: Is(i) });
1157
+ const t = new ClipboardItem({ [vr]: Is(i) });
1113
1158
  navigator.clipboard.write([t]).catch((e) => {
1114
1159
  console.error("Could not copy image using clipboard API: ", e);
1115
1160
  });
@@ -1156,7 +1201,7 @@ let Et = class extends ne {
1156
1201
  }
1157
1202
  setTimeout(() => {
1158
1203
  const d = Ds();
1159
- o.drawingType === B.DRAWING_IMAGE && o.imageSourceType === qr.BASE64 ? Cs(o.source) : this._clipboardInterfaceService.writeText(""), d();
1204
+ o.drawingType === B.DRAWING_IMAGE && o.imageSourceType === Si.BASE64 ? Cs(o.source) : this._clipboardInterfaceService.writeText(""), d();
1160
1205
  }, 200);
1161
1206
  const a = {
1162
1207
  unitId: o.unitId,
@@ -1231,7 +1276,7 @@ let Et = class extends ne {
1231
1276
  const { unitId: s, subUnitId: o, range: a } = r, d = this._renderManagerService.getRenderById(s), u = d == null ? void 0 : d.with(V), c = d == null ? void 0 : d.with(Xe), l = this._copyInfo;
1232
1277
  if (!u || !c)
1233
1278
  return { redos: [], undos: [] };
1234
- const { drawings: g } = l, h = En(a);
1279
+ const { drawings: g } = l, h = Pn(a);
1235
1280
  return this._generateMutations(g, {
1236
1281
  unitId: s,
1237
1282
  subUnitId: o,
@@ -1321,10 +1366,10 @@ let Et = class extends ne {
1321
1366
  const { drawings: c } = this._copyInfo;
1322
1367
  if (!a)
1323
1368
  return this._generateSingleDrawingPasteMutations({
1324
- pasteTo: { unitId: n, subUnitId: r, range: En(o) },
1369
+ pasteTo: { unitId: n, subUnitId: r, range: Pn(o) },
1325
1370
  pasteType: s
1326
1371
  }, d);
1327
- const { ranges: [l, g], mapFunc: h } = vi([a, o]), { row: f, col: p } = h(l.startRow, l.startColumn), { row: m, col: _ } = h(g.startRow, g.startColumn), v = u.attachRangeWithCoord({
1372
+ const { ranges: [l, g], mapFunc: h } = yi([a, o]), { row: f, col: p } = h(l.startRow, l.startColumn), { row: m, col: _ } = h(g.startRow, g.startColumn), v = u.attachRangeWithCoord({
1328
1373
  startRow: f,
1329
1374
  endRow: f,
1330
1375
  startColumn: p,
@@ -1369,10 +1414,10 @@ let Et = class extends ne {
1369
1414
  }
1370
1415
  };
1371
1416
  Et = vs([
1372
- ze(0, Ii),
1417
+ ze(0, Ei),
1373
1418
  ze(1, Z),
1374
- ze(2, re),
1375
- ze(3, Ei),
1419
+ ze(2, ie),
1420
+ ze(3, ki),
1376
1421
  ze(4, G)
1377
1422
  ], Et);
1378
1423
  var Rs = Object.getOwnPropertyDescriptor, bs = (i, t, e, n) => {
@@ -1389,15 +1434,15 @@ let Tt = class extends ne {
1389
1434
  this.disposeWithMe(
1390
1435
  e.pipe(
1391
1436
  we(([n, r]) => n ? n.activeSheet$.pipe(
1392
- Un((s) => {
1437
+ kn((s) => {
1393
1438
  if (!s) {
1394
1439
  this._drawingManagerService.setDrawingVisible(!1);
1395
1440
  return;
1396
1441
  }
1397
1442
  const o = n.getUnitId(), a = s.getSheetId();
1398
1443
  this._permissionService.composePermission([
1399
- new kn(o).id,
1400
- new Wn(o, a).id
1444
+ new Cn(o).id,
1445
+ new Dn(o, a).id
1401
1446
  ]).every((u) => u.value) ? this._drawingManagerService.setDrawingVisible(!0) : this._handleDrawingVisibilityFalse(n, s);
1402
1447
  })
1403
1448
  ) : (this._drawingManagerService.setDrawingVisible(!1), fe))
@@ -1410,7 +1455,7 @@ let Tt = class extends ne {
1410
1455
  if (!a)
1411
1456
  return;
1412
1457
  a.getAllObjectsByOrder().forEach((u) => {
1413
- u.classType === Pe.IMAGE && s.some((c) => u.oKey.includes(c.drawingId)) && a.removeObject(u);
1458
+ u.classType === Ue.IMAGE && s.some((c) => u.oKey.includes(c.drawingId)) && a.removeObject(u);
1414
1459
  });
1415
1460
  }
1416
1461
  _initDrawingEditable() {
@@ -1418,7 +1463,7 @@ let Tt = class extends ne {
1418
1463
  this.disposeWithMe(
1419
1464
  e.pipe(
1420
1465
  we(([n, r]) => n ? n.activeSheet$.pipe(
1421
- Un((s) => {
1466
+ kn((s) => {
1422
1467
  if (!s) {
1423
1468
  this._drawingManagerService.setDrawingEditable(!1);
1424
1469
  return;
@@ -1439,7 +1484,7 @@ let Tt = class extends ne {
1439
1484
  if (!a)
1440
1485
  return;
1441
1486
  a.getAllObjectsByOrder().forEach((u) => {
1442
- u.classType === Pe.IMAGE && s.some((c) => u.oKey.includes(c.drawingId)) && a.detachTransformerFrom(u);
1487
+ u.classType === Ue.IMAGE && s.some((c) => u.oKey.includes(c.drawingId)) && a.detachTransformerFrom(u);
1443
1488
  });
1444
1489
  }
1445
1490
  _initViewPermissionChange() {
@@ -1455,11 +1500,11 @@ let Tt = class extends ne {
1455
1500
  return fe;
1456
1501
  const u = d.getTransformerByCreate();
1457
1502
  return this._permissionService.composePermission$([
1458
- new kn(s).id,
1459
- new Wn(s, o).id
1503
+ new Cn(s).id,
1504
+ new Dn(s, o).id
1460
1505
  ]).pipe(
1461
1506
  be((l) => l.every((g) => g.value)),
1462
- Pn()
1507
+ Wn()
1463
1508
  ).pipe(
1464
1509
  be((l) => ({
1465
1510
  permission: l,
@@ -1476,7 +1521,7 @@ let Tt = class extends ne {
1476
1521
  this._drawingManagerService.setDrawingVisible(e);
1477
1522
  const a = n.getAllObjectsByOrder(), d = this._drawingManagerService.getDrawingData(s, o), u = Object.values(d);
1478
1523
  e ? this._drawingManagerService.addNotification(u) : (a.forEach((c) => {
1479
- c.classType === Pe.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.removeObject(c);
1524
+ c.classType === Ue.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.removeObject(c);
1480
1525
  }), r.clearSelectedObjects());
1481
1526
  },
1482
1527
  complete: () => {
@@ -1507,7 +1552,7 @@ let Tt = class extends ne {
1507
1552
  new Kt(s, o).id
1508
1553
  ]).pipe(
1509
1554
  be((l) => l.every((g) => g.value)),
1510
- Pn()
1555
+ Wn()
1511
1556
  ).pipe(
1512
1557
  be((l) => ({
1513
1558
  permission: l,
@@ -1524,9 +1569,9 @@ let Tt = class extends ne {
1524
1569
  this._drawingManagerService.setDrawingEditable(e);
1525
1570
  const a = n.getAllObjectsByOrder(), d = this._drawingManagerService.getDrawingData(s, o), u = Object.values(d);
1526
1571
  e ? (a.forEach((c) => {
1527
- c.classType === Pe.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.attachTransformerTo(c);
1572
+ c.classType === Ue.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.attachTransformerTo(c);
1528
1573
  }), this._drawingManagerService.addNotification(u)) : (a.forEach((c) => {
1529
- c.classType === Pe.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.detachTransformerFrom(c);
1574
+ c.classType === Ue.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.detachTransformerFrom(c);
1530
1575
  }), r.clearSelectedObjects());
1531
1576
  },
1532
1577
  complete: () => {
@@ -1541,7 +1586,7 @@ let Tt = class extends ne {
1541
1586
  return;
1542
1587
  const d = this._drawingManagerService.getDrawingData(n, s), u = Object.values(d);
1543
1588
  this._drawingManagerService.setDrawingEditable(!0), a.getAllObjectsByOrder().forEach((l) => {
1544
- l.classType === Pe.IMAGE && u.some((g) => l.oKey.includes(g.drawingId)) && a.detachTransformerFrom(l);
1589
+ l.classType === Ue.IMAGE && u.some((g) => l.oKey.includes(g.drawingId)) && a.detachTransformerFrom(l);
1545
1590
  });
1546
1591
  }
1547
1592
  })
@@ -1549,7 +1594,7 @@ let Tt = class extends ne {
1549
1594
  }
1550
1595
  };
1551
1596
  Tt = bs([
1552
- Ke(0, re),
1597
+ Ke(0, ie),
1553
1598
  Ke(1, Z),
1554
1599
  Ke(2, Nr),
1555
1600
  Ke(3, Se),
@@ -1560,8 +1605,8 @@ var Ms = Object.getOwnPropertyDescriptor, ys = (i, t, e, n) => {
1560
1605
  (o = i[s]) && (r = o(r) || r);
1561
1606
  return r;
1562
1607
  }, Ce = (i, t) => (e, n) => t(e, n, i);
1563
- function vr(i, t, e, n, r, s = !1) {
1564
- const { scaleX: o, scaleY: a } = t.getAncestorScale(), d = t.getViewport(Gn.VIEW_MAIN), u = n.getFreeze(), { startColumn: c, startRow: l, xSplit: g, ySplit: h } = u, f = {
1608
+ function Ir(i, t, e, n, r, s = !1) {
1609
+ const { scaleX: o, scaleY: a } = t.getAncestorScale(), d = t.getViewport(or.VIEW_MAIN), u = n.getFreeze(), { startColumn: c, startRow: l, xSplit: g, ySplit: h } = u, f = {
1565
1610
  left: !0,
1566
1611
  // left means the left of pic is in a viewMainLeft
1567
1612
  top: !0
@@ -1607,7 +1652,7 @@ const ge = (i, t, e, n, r) => {
1607
1652
  right: s + a,
1608
1653
  top: o,
1609
1654
  bottom: o + d
1610
- }, l = vr(c, t, e, n, r), { scaleX: g, scaleY: h } = t.getAncestorScale();
1655
+ }, l = Ir(c, t, e, n, r), { scaleX: g, scaleY: h } = t.getAncestorScale();
1611
1656
  return {
1612
1657
  startX: l.left,
1613
1658
  endX: l.right,
@@ -1635,7 +1680,7 @@ let et = class extends ne {
1635
1680
  this._renderManagerService = t, this._univerInstanceService = e, this._commandService = n, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = a, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
1636
1681
  }
1637
1682
  _bindScrollEvent() {
1638
- this._lifecycleService.lifecycle$.pipe(Wi((t) => t === Br.Rendered), Bi(1)).subscribe(() => {
1683
+ this._lifecycleService.lifecycle$.pipe(Zi((t) => t === Br.Rendered), qi(1)).subscribe(() => {
1639
1684
  this._scrollUpdateListener();
1640
1685
  });
1641
1686
  }
@@ -1697,8 +1742,8 @@ let et = class extends ne {
1697
1742
  const k = h ? h.backgroundColor : "white";
1698
1743
  M.fill = k, h && h.border && (M.stroke = h.border), M.paintFirst = "stroke", M.strokeWidth = 1, M.borderEnabled = !1, M.radius = 8;
1699
1744
  }
1700
- const N = new Ae(E, M);
1701
- b && N.setObjectType(Mn.CHART), p.addObject(N, Yt), a.allowTransform !== !1 && p.attachTransformerTo(N);
1745
+ const N = new Pe(E, M);
1746
+ b && N.setObjectType(Rn.CHART), p.addObject(N, xt), a.allowTransform !== !1 && p.attachTransformerTo(N);
1702
1747
  const x = new pt(), q = ge(N, f.renderUnit.scene, c.skeleton, o.worksheet), H = new We(q), L = {
1703
1748
  dispose: x,
1704
1749
  rect: N,
@@ -1764,14 +1809,14 @@ let et = class extends ne {
1764
1809
  };
1765
1810
  this.disposeWithMe(
1766
1811
  this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(
1767
- we((e) => e ? e.activeSheet$ : An(null)),
1812
+ we((e) => e ? e.activeSheet$ : Bn(null)),
1768
1813
  be((e) => {
1769
1814
  if (!e) return null;
1770
1815
  const n = e.getUnitId(), r = this._renderManagerService.getRenderById(n);
1771
1816
  return r ? { render: r, unitId: n, subUnitId: e.getSheetId() } : null;
1772
1817
  }),
1773
1818
  we(
1774
- (e) => e ? jr(e.render.scene.getViewport(Gn.VIEW_MAIN).onScrollAfter$).pipe(be(() => ({ unitId: e.unitId, subUnitId: e.subUnitId }))) : An(null)
1819
+ (e) => e ? jr(e.render.scene.getViewport(or.VIEW_MAIN).onScrollAfter$).pipe(be(() => ({ unitId: e.unitId, subUnitId: e.subUnitId }))) : Bn(null)
1775
1820
  )
1776
1821
  ).subscribe((e) => {
1777
1822
  if (!e) return;
@@ -1779,12 +1824,12 @@ let et = class extends ne {
1779
1824
  t(n, r);
1780
1825
  })
1781
1826
  ), this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
1782
- if (e.id === Tn.id) {
1827
+ if (e.id === An.id) {
1783
1828
  const n = e.params, { unitId: r } = n;
1784
1829
  Array.from(this._domLayerInfoMap.values()).filter((o) => o.unitId === r).map((o) => o.subUnitId).forEach((o) => {
1785
1830
  t(r, o);
1786
1831
  });
1787
- } else if (e.id === Fi.id) {
1832
+ } else if (e.id === qr.id) {
1788
1833
  const { unitId: n, subUnitId: r } = e.params;
1789
1834
  t(n, r);
1790
1835
  }
@@ -1845,7 +1890,7 @@ let et = class extends ne {
1845
1890
  const s = this._domLayerInfoMap.get(n), o = this._getSceneAndTransformerByDrawingSearch(t);
1846
1891
  if (s && o) {
1847
1892
  const { scene: a } = o, d = ve({ unitId: t, subUnitId: e, drawingId: n }), u = a.getObject(d);
1848
- u && u instanceof Ae && u.setProps(r);
1893
+ u && u instanceof Pe && u.setProps(r);
1849
1894
  }
1850
1895
  }
1851
1896
  // CreateFloatDomCommand --> floatDomService.addFloatDomToPosition
@@ -1972,8 +2017,8 @@ let et = class extends ne {
1972
2017
  const W = K ? K.backgroundColor : "white";
1973
2018
  Q.fill = W, Q.rotateEnabled = !1, K && K.border && (Q.stroke = K.border), Q.paintFirst = "stroke", Q.strokeWidth = 1, Q.borderEnabled = !1, Q.radius = 8;
1974
2019
  }
1975
- const le = new Ae(ut, Q);
1976
- Ee && le.setObjectType(Mn.CHART), ae.addObject(le, Yt), b.allowTransform !== !1 && ae.attachTransformerTo(le);
2020
+ const le = new Pe(ut, Q);
2021
+ Ee && le.setObjectType(Rn.CHART), ae.addObject(le, xt), b.allowTransform !== !1 && ae.attachTransformerTo(le);
1977
2022
  const ue = new pt(), ht = ae.getMainViewport(), { rowHeaderWidth: Te, columnHeaderHeight: Ge } = H.skeleton, gt = {
1978
2023
  top: Ge,
1979
2024
  left: Te,
@@ -2028,7 +2073,7 @@ let et = class extends ne {
2028
2073
  left: p.absolute.left,
2029
2074
  top: p.absolute.top
2030
2075
  }
2031
- }, n), Rr = ve({ unitId: D, subUnitId: E, drawingId: T }), br = new Ae(Rr, {
2076
+ }, n), Rr = ve({ unitId: D, subUnitId: E, drawingId: T }), br = new Pe(Rr, {
2032
2077
  left: ln.startX,
2033
2078
  top: ln.startY,
2034
2079
  width: (gn = n.width) != null ? gn : W.width,
@@ -2137,8 +2182,8 @@ let et = class extends ne {
2137
2182
  width: ye.width,
2138
2183
  height: ye.height,
2139
2184
  zIndex: this._drawingManagerService.getDrawingOrder(w, y).length - 1
2140
- }, de = new Ae(dt, ut);
2141
- X.addObject(de, Yt), T.allowTransform !== !1 && X.attachTransformerTo(de);
2185
+ }, de = new Pe(dt, ut);
2186
+ X.addObject(de, xt), T.allowTransform !== !1 && X.attachTransformerTo(de);
2142
2187
  const Q = new pt(), Ee = X.getMainViewport(), le = {
2143
2188
  top: 0,
2144
2189
  //viewMain.top,
@@ -2203,7 +2248,7 @@ let et = class extends ne {
2203
2248
  left: p.absolute.left,
2204
2249
  top: p.absolute.top
2205
2250
  }
2206
- }, n), Le = ve({ unitId: w, subUnitId: y, drawingId: D }), Ve = new Ae(Le, {
2251
+ }, n), Le = ve({ unitId: w, subUnitId: y, drawingId: D }), Ve = new Pe(Le, {
2207
2252
  left: Oe.startX,
2208
2253
  top: 0,
2209
2254
  width: n.width,
@@ -2244,11 +2289,11 @@ let et = class extends ne {
2244
2289
  a.next(m), u.next(_);
2245
2290
  }, l = new pt();
2246
2291
  l.add(e.engine.clientRect$.subscribe(() => c())), l.add(this._commandService.onCommandExecuted((m) => {
2247
- if (m.id === xi.id && m.params.rowsAutoHeightInfo.findIndex((v) => v.row === r) > -1) {
2292
+ if (m.id === Qr.id && m.params.rowsAutoHeightInfo.findIndex((v) => v.row === r) > -1) {
2248
2293
  c();
2249
2294
  return;
2250
2295
  }
2251
- (Yi.indexOf(m.id) > -1 || m.id === Ci.id || m.id === Tn.id) && c();
2296
+ (ei.indexOf(m.id) > -1 || m.id === Ti.id || m.id === An.id) && c();
2252
2297
  }));
2253
2298
  const g = (m, _) => {
2254
2299
  r = m, s = _, c();
@@ -2296,9 +2341,9 @@ et = ys([
2296
2341
  Ce(0, A(Z)),
2297
2342
  Ce(1, Se),
2298
2343
  Ce(2, A(G)),
2299
- Ce(3, re),
2300
- Ce(4, A(Ti)),
2301
- Ce(5, ie),
2344
+ Ce(3, ie),
2345
+ Ce(4, A(Wi)),
2346
+ Ce(5, re),
2302
2347
  Ce(6, A(Wr))
2303
2348
  ], et);
2304
2349
  function Je(i, t, e) {
@@ -2349,7 +2394,7 @@ function Ct(i, t) {
2349
2394
  }
2350
2395
  const Es = (i) => {
2351
2396
  const { floatDomInfos: t, scene: e, skeleton: n, worksheet: r } = i, s = Qi(() => t.map((o) => {
2352
- const { width: a, height: d, angle: u, left: c, top: l } = o.transform, g = vr(
2397
+ const { width: a, height: d, angle: u, left: c, top: l } = o.transform, g = Ir(
2353
2398
  {
2354
2399
  left: c != null ? c : 0,
2355
2400
  right: (c != null ? c : 0) + (a != null ? a : 0),
@@ -2388,7 +2433,7 @@ const Es = (i) => {
2388
2433
  };
2389
2434
  return [o.drawingId, m];
2390
2435
  }), [t, e, n, r]);
2391
- return /* @__PURE__ */ oe("div", { style: { position: "absolute", top: 0, left: 0 }, children: s.map(([o, a]) => /* @__PURE__ */ oe(Oi, { layer: a, id: o, position: a.position }, o)) });
2436
+ return /* @__PURE__ */ oe("div", { style: { position: "absolute", top: 0, left: 0 }, children: s.map(([o, a]) => /* @__PURE__ */ oe(Bi, { layer: a, id: o, position: a.position }, o)) });
2392
2437
  };
2393
2438
  var Ts = Object.getOwnPropertyDescriptor, Os = (i, t, e, n) => {
2394
2439
  for (var r = n > 1 ? void 0 : n ? Ts(t, e) : t, s = i.length - 1, o; s >= 0; s--)
@@ -2462,12 +2507,12 @@ let Ot = class extends ne {
2462
2507
  };
2463
2508
  }
2464
2509
  return null;
2465
- }).filter(Boolean), d = Ui(Es, this._injector);
2466
- return li(
2510
+ }).filter(Boolean), d = ji(Es, this._injector);
2511
+ return hi(
2467
2512
  /* @__PURE__ */ oe(d, { floatDomInfos: a, scene: t.scene, skeleton: t.skeleton, worksheet: t.worksheet }),
2468
2513
  t.root
2469
2514
  ), i == null || i.add(() => {
2470
- ui(t.root);
2515
+ gi(t.root);
2471
2516
  }), e(i);
2472
2517
  }
2473
2518
  }
@@ -2477,12 +2522,12 @@ let Ot = class extends ne {
2477
2522
  }
2478
2523
  };
2479
2524
  Ot = Os([
2480
- De(0, A(Di)),
2481
- De(1, A(Xn)),
2482
- De(2, re),
2525
+ De(0, A(Oi)),
2526
+ De(1, A(lr)),
2527
+ De(2, ie),
2483
2528
  De(3, Z),
2484
2529
  De(4, A(et)),
2485
- De(5, A(Hn)),
2530
+ De(5, A(dr)),
2486
2531
  De(6, A(Ye))
2487
2532
  ], Ot);
2488
2533
  var Us = Object.getOwnPropertyDescriptor, Ps = (i, t, e, n) => {
@@ -2491,32 +2536,32 @@ var Us = Object.getOwnPropertyDescriptor, Ps = (i, t, e, n) => {
2491
2536
  return r;
2492
2537
  }, me = (i, t) => (e, n) => t(e, n, i);
2493
2538
  const As = [
2539
+ Xn.id,
2540
+ Gn.id,
2541
+ Ln.id,
2542
+ Vn.id,
2543
+ Hn.id,
2494
2544
  zn.id,
2495
2545
  Kn.id,
2496
2546
  Jn.id,
2547
+ Jt.id,
2548
+ Zt.id,
2497
2549
  Zn.id,
2498
2550
  qn.id,
2499
2551
  Qn.id,
2500
2552
  er.id,
2501
2553
  tr.id,
2502
- Jt.id,
2503
- Zt.id,
2504
2554
  nr.id,
2505
2555
  rr.id,
2506
2556
  ir.id,
2507
- sr.id,
2508
- or.id,
2509
- ar.id,
2510
- cr.id,
2511
- dr.id,
2512
- lr.id
2557
+ sr.id
2513
2558
  ], Ns = [
2514
- Xi.id,
2515
- Gi.id,
2516
- Li.id,
2517
- Vi.id,
2518
- Hi.id,
2519
- zi.id
2559
+ ti.id,
2560
+ ni.id,
2561
+ ri.id,
2562
+ ii.id,
2563
+ si.id,
2564
+ oi.id
2520
2565
  ];
2521
2566
  let rn = class extends ne {
2522
2567
  constructor(i, t, e, n, r, s, o, a, d) {
@@ -2531,51 +2576,51 @@ let rn = class extends ne {
2531
2576
  if (i.params == null)
2532
2577
  return { redos: [], undos: [] };
2533
2578
  const t = i.id;
2534
- if (t === zn.id)
2579
+ if (t === Xn.id)
2535
2580
  return this._moveRowInterceptor(i.params, "insert");
2536
- if ([cr.id, dr.id, lr.id].includes(t))
2581
+ if ([rr.id, ir.id, sr.id].includes(t))
2537
2582
  return this._moveRangeInterceptor(i.params);
2538
- if (t === Kn.id)
2583
+ if (t === Gn.id)
2539
2584
  return this._moveColInterceptor(i.params, "insert");
2540
- if (t === Jn.id)
2585
+ if (t === Ln.id)
2541
2586
  return this._moveRowInterceptor(i.params, "remove");
2542
- if (t === Zn.id)
2587
+ if (t === Vn.id)
2543
2588
  return this._moveColInterceptor(i.params, "remove");
2544
- if (t === qn.id) {
2589
+ if (t === Hn.id) {
2545
2590
  const { range: e } = i.params;
2546
2591
  return this._getRangeMoveUndo(
2547
2592
  e,
2548
2593
  0
2549
2594
  /* deleteLeft */
2550
2595
  );
2551
- } else if (t === Qn.id) {
2596
+ } else if (t === zn.id) {
2552
2597
  const { range: e } = i.params;
2553
2598
  return this._getRangeMoveUndo(
2554
2599
  e,
2555
2600
  1
2556
2601
  /* deleteUp */
2557
2602
  );
2558
- } else if (t === er.id) {
2603
+ } else if (t === Kn.id) {
2559
2604
  const { range: e } = i.params;
2560
2605
  return this._getRangeMoveUndo(
2561
2606
  e,
2562
2607
  2
2563
2608
  /* insertDown */
2564
2609
  );
2565
- } else if (t === tr.id) {
2610
+ } else if (t === Jn.id) {
2566
2611
  const { range: e } = i.params;
2567
2612
  return this._getRangeMoveUndo(
2568
2613
  e,
2569
2614
  3
2570
2615
  /* insertRight */
2571
2616
  );
2572
- } else if (t === ir.id || t === sr.id) {
2617
+ } else if (t === Qn.id || t === er.id) {
2573
2618
  const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
2574
2619
  return this._getDrawingUndoForRowVisible(n, r, s);
2575
- } else if (t === or.id || t === ar.id) {
2620
+ } else if (t === tr.id || t === nr.id) {
2576
2621
  const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
2577
2622
  return this._getDrawingUndoForColVisible(n, r, s);
2578
- } else if (t === Jt.id || t === Zt.id || t === nr.id || t === rr.id) {
2623
+ } else if (t === Jt.id || t === Zt.id || t === Zn.id || t === qn.id) {
2579
2624
  const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e, o = t === Jt.id || t === Zt.id;
2580
2625
  return this._getDrawingUndoForRowAndColSize(n, r, s, o);
2581
2626
  }
@@ -2873,7 +2918,7 @@ let rn = class extends ne {
2873
2918
  const { unitId: r, subUnitId: s } = n, o = (R = (I = this._renderManagerService.getRenderById(r)) == null ? void 0 : I.with(V)) == null ? void 0 : R.getCurrentSkeleton();
2874
2919
  if (!o)
2875
2920
  return { redos: [], undos: [] };
2876
- const a = Ln(o, e);
2921
+ const a = ar(o, e);
2877
2922
  if (!a)
2878
2923
  return { redos: [], undos: [] };
2879
2924
  const { startX: d, endX: u, startY: c, endY: l } = a, g = this._sheetDrawingService.getDrawingData(r, s), h = [];
@@ -3166,7 +3211,7 @@ let rn = class extends ne {
3166
3211
  // but the skeleton changes like other render modules. These two signals are not equivalent.
3167
3212
  // As a temp solution, I subscribed to activate$ here.
3168
3213
  this._commandService.onCommandExecuted((i) => {
3169
- if (i.id === Ki.id) {
3214
+ if (i.id === ai.id) {
3170
3215
  const { unitId: t, subUnitId: e } = i.params;
3171
3216
  this._updateDrawings(t, e);
3172
3217
  }
@@ -3267,58 +3312,14 @@ rn = Ps([
3267
3312
  me(2, G),
3268
3313
  me(3, Xe),
3269
3314
  me(4, A(V)),
3270
- me(5, A(Nt)),
3271
- me(6, ie),
3272
- me(7, re),
3315
+ me(5, A(At)),
3316
+ me(6, re),
3317
+ me(7, ie),
3273
3318
  me(8, Se)
3274
3319
  ], rn);
3275
- const Ir = {
3276
- id: "sheet.command.delete-drawing",
3277
- type: J.COMMAND,
3278
- handler: (i) => {
3279
- const t = i.get(G), n = i.get(ie).getFocusDrawings();
3280
- if (n.length === 0)
3281
- return !1;
3282
- const r = n[0].unitId, s = n.map((o) => {
3283
- const { unitId: a, subUnitId: d, drawingId: u, drawingType: c } = o;
3284
- return {
3285
- unitId: a,
3286
- subUnitId: d,
3287
- drawingId: u,
3288
- drawingType: c
3289
- };
3290
- });
3291
- return t.executeCommand(nt.id, {
3292
- unitId: r,
3293
- drawings: s
3294
- });
3295
- }
3296
- }, rt = {
3297
- id: "sheet.command.move-drawing",
3298
- type: J.COMMAND,
3299
- handler: (i, t) => {
3300
- const e = i.get(G), n = i.get(ie), r = i.get(Xe), { direction: s } = t, o = n.getFocusDrawings();
3301
- if (o.length === 0)
3302
- return !1;
3303
- const a = o[0].unitId, d = o.map((c) => {
3304
- const { transform: l } = c;
3305
- if (l == null)
3306
- return null;
3307
- const g = { ...l }, { left: h = 0, top: f = 0 } = l;
3308
- return s === _e.UP ? g.top = f - 1 : s === _e.DOWN ? g.top = f + 1 : s === _e.LEFT ? g.left = h - 1 : s === _e.RIGHT && (g.left = h + 1), {
3309
- ...c,
3310
- transform: g,
3311
- sheetTransform: $(g, r)
3312
- };
3313
- }).filter((c) => c != null);
3314
- return e.syncExecuteCommand(Wt.id, {
3315
- unitId: a,
3316
- drawings: d
3317
- }) ? (e.syncExecuteCommand(Y.id, [a]), !0) : !1;
3318
- }
3319
- }, ks = (i) => {
3320
+ const ks = (i) => {
3320
3321
  var v;
3321
- const t = qe(G), e = qe(tt), n = qe(re), r = qe(Z), { drawings: s } = i, o = s[0];
3322
+ const t = qe(G), e = qe(tt), n = qe(ie), r = qe(Z), { drawings: s } = i, o = s[0];
3322
3323
  if (o == null)
3323
3324
  return;
3324
3325
  const { unitId: a } = o, d = r.getRenderById(a), u = d == null ? void 0 : d.scene;
@@ -3379,7 +3380,7 @@ const Ir = {
3379
3380
  return /* @__PURE__ */ qt(
3380
3381
  "div",
3381
3382
  {
3382
- className: hi("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
3383
+ className: fi("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
3383
3384
  "univer-hidden": !l
3384
3385
  }),
3385
3386
  children: [
@@ -3390,16 +3391,16 @@ const Ir = {
3390
3391
  children: /* @__PURE__ */ oe("div", { children: e.t("drawing-anchor.title") })
3391
3392
  }
3392
3393
  ),
3393
- /* @__PURE__ */ oe("div", { children: /* @__PURE__ */ qt(gi, { value: f, onChange: _, direction: "vertical", children: [
3394
- /* @__PURE__ */ oe(Xt, { value: O.Both, children: e.t("drawing-anchor.both") }),
3395
- /* @__PURE__ */ oe(Xt, { value: O.Position, children: e.t("drawing-anchor.position") }),
3396
- /* @__PURE__ */ oe(Xt, { value: O.None, children: e.t("drawing-anchor.none") })
3394
+ /* @__PURE__ */ oe("div", { children: /* @__PURE__ */ qt(mi, { value: f, onChange: _, direction: "vertical", children: [
3395
+ /* @__PURE__ */ oe(Yt, { value: O.Both, children: e.t("drawing-anchor.both") }),
3396
+ /* @__PURE__ */ oe(Yt, { value: O.Position, children: e.t("drawing-anchor.position") }),
3397
+ /* @__PURE__ */ oe(Yt, { value: O.None, children: e.t("drawing-anchor.none") })
3397
3398
  ] }) })
3398
3399
  ]
3399
3400
  }
3400
3401
  );
3401
3402
  }, Ws = () => {
3402
- const i = qe(re), t = i.getFocusDrawings(), [e, n] = Qt(t);
3403
+ const i = qe(ie), t = i.getFocusDrawings(), [e, n] = Qt(t);
3403
3404
  return ur(() => {
3404
3405
  const r = i.focus$.subscribe((s) => {
3405
3406
  n(s);
@@ -3408,38 +3409,38 @@ const Ir = {
3408
3409
  r.unsubscribe();
3409
3410
  };
3410
3411
  }, []), !!(e != null && e.length) && /* @__PURE__ */ qt("div", { className: "univer-text-sm", children: [
3411
- /* @__PURE__ */ oe(ii, { drawings: e }),
3412
+ /* @__PURE__ */ oe(zi, { drawings: e }),
3412
3413
  /* @__PURE__ */ oe(ks, { drawings: e })
3413
3414
  ] });
3414
3415
  }, Cr = "sheet.menu.image";
3415
3416
  function Bs(i) {
3416
3417
  return {
3417
3418
  id: Cr,
3418
- type: an.SUBITEMS,
3419
+ type: cn.SUBITEMS,
3419
3420
  icon: "AddImageIcon",
3420
3421
  tooltip: "sheetImage.title",
3421
- hidden$: on(i, F.UNIVER_SHEET),
3422
- disabled$: Ri(i, { workbookTypes: [zt], worksheetTypes: [Kt], rangeTypes: [Ji] })
3422
+ hidden$: an(i, F.UNIVER_SHEET),
3423
+ disabled$: Ui(i, { workbookTypes: [zt], worksheetTypes: [Kt], rangeTypes: [ci] })
3423
3424
  };
3424
3425
  }
3425
3426
  function js(i) {
3426
3427
  return {
3427
3428
  id: Bt.id,
3428
3429
  title: "sheetImage.upload.float",
3429
- type: an.BUTTON,
3430
- hidden$: on(i, F.UNIVER_SHEET)
3430
+ type: cn.BUTTON,
3431
+ hidden$: an(i, F.UNIVER_SHEET)
3431
3432
  };
3432
3433
  }
3433
3434
  function $s(i) {
3434
3435
  return {
3435
3436
  id: dn.id,
3436
3437
  title: "sheetImage.upload.cell",
3437
- type: an.BUTTON,
3438
- hidden$: on(i, F.UNIVER_SHEET)
3438
+ type: cn.BUTTON,
3439
+ hidden$: an(i, F.UNIVER_SHEET)
3439
3440
  };
3440
3441
  }
3441
3442
  const Fs = {
3442
- [Pi.MEDIA]: {
3443
+ [$i.MEDIA]: {
3443
3444
  [Cr]: {
3444
3445
  order: 0,
3445
3446
  menuItemFactory: Bs,
@@ -3498,7 +3499,7 @@ const xs = {
3498
3499
  direction: _e.RIGHT
3499
3500
  }
3500
3501
  }, Ls = {
3501
- id: Ir.id,
3502
+ id: hr.id,
3502
3503
  description: "shortcut.drawing-delete",
3503
3504
  group: "4_drawing-view",
3504
3505
  // when focusing on any other input tag do not trigger this shortcut
@@ -3517,7 +3518,7 @@ let Ut = class extends ne {
3517
3518
  }
3518
3519
  _initCustomComponents() {
3519
3520
  const i = this._componentManager;
3520
- this.disposeWithMe(i.register(hr, Ws));
3521
+ this.disposeWithMe(i.register(pr, Ws));
3521
3522
  }
3522
3523
  _initMenus() {
3523
3524
  this._menuManagerService.mergeMenu(Fs);
@@ -3529,14 +3530,14 @@ let Ut = class extends ne {
3529
3530
  kt,
3530
3531
  nt,
3531
3532
  Wt,
3532
- gr,
3533
+ wr,
3533
3534
  Y,
3534
- fr,
3535
+ _r,
3536
+ gr,
3535
3537
  mr,
3536
- wr,
3537
3538
  rt,
3538
- Ir,
3539
- pr
3539
+ hr,
3540
+ fr
3540
3541
  ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
3541
3542
  }
3542
3543
  _initShortcuts() {
@@ -3556,12 +3557,12 @@ let Ut = class extends ne {
3556
3557
  }
3557
3558
  };
3558
3559
  Ut = Hs([
3559
- ke(0, A(Hn)),
3560
- ke(1, Ai),
3560
+ ke(0, A(dr)),
3561
+ ke(1, Fi),
3561
3562
  ke(2, G),
3562
- ke(3, Ni),
3563
- ke(4, re),
3564
- ke(5, A(cn))
3563
+ ke(3, xi),
3564
+ ke(4, ie),
3565
+ ke(5, A(sn))
3565
3566
  ], Ut);
3566
3567
  var zs = Object.defineProperty, Ks = Object.getOwnPropertyDescriptor, Js = (i, t, e) => t in i ? zs(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, Zs = (i, t, e, n) => {
3567
3568
  for (var r = n > 1 ? void 0 : n ? Ks(t, e) : t, s = i.length - 1, o; s >= 0; s--)
@@ -3577,7 +3578,7 @@ let Pt = class extends Vr {
3577
3578
  jn,
3578
3579
  this._config
3579
3580
  );
3580
- r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(es, s);
3581
+ r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(ss, s);
3581
3582
  }
3582
3583
  onStarting() {
3583
3584
  zr(this._injector, [
@@ -3616,8 +3617,8 @@ let Pt = class extends Vr {
3616
3617
  [
3617
3618
  [Qe],
3618
3619
  [rn],
3619
- [tn],
3620
- [en]
3620
+ [nn],
3621
+ [tn]
3621
3622
  ].forEach((i) => {
3622
3623
  this.disposeWithMe(this._renderManagerService.registerRenderModule(F.UNIVER_SHEET, i));
3623
3624
  });
@@ -3626,26 +3627,26 @@ let Pt = class extends Vr {
3626
3627
  Dr(Pt, "type", F.UNIVER_SHEET);
3627
3628
  Dr(Pt, "pluginName", qs);
3628
3629
  Pt = Zs([
3629
- Gr(Qr, Jr, si, di),
3630
+ Gr(vi, Xi, Ki, Kr),
3630
3631
  Lt(1, A(Ye)),
3631
3632
  Lt(2, Z),
3632
3633
  Lt(3, Lr)
3633
3634
  ], Pt);
3634
3635
  export {
3635
3636
  Y as ClearSheetDrawingTransformerOperation,
3636
- Ir as DeleteDrawingsCommand,
3637
- fr as EditSheetDrawingOperation,
3638
- mr as GroupSheetDrawingCommand,
3637
+ hr as DeleteDrawingsCommand,
3638
+ _r as EditSheetDrawingOperation,
3639
+ gr as GroupSheetDrawingCommand,
3639
3640
  Bt as InsertFloatImageCommand,
3640
3641
  kt as InsertSheetDrawingCommand,
3641
3642
  rt as MoveDrawingsCommand,
3642
3643
  nt as RemoveSheetDrawingCommand,
3643
3644
  Cr as SHEETS_IMAGE_MENU_ID,
3644
- pr as SetDrawingArrangeCommand,
3645
+ fr as SetDrawingArrangeCommand,
3645
3646
  Wt as SetSheetDrawingCommand,
3646
3647
  et as SheetCanvasFloatDomManagerService,
3647
3648
  Qe as SheetDrawingUpdateController,
3648
- gr as SidebarSheetDrawingOperation,
3649
- wr as UngroupSheetDrawingCommand,
3649
+ wr as SidebarSheetDrawingOperation,
3650
+ mr as UngroupSheetDrawingCommand,
3650
3651
  Pt as UniverSheetsDrawingUIPlugin
3651
3652
  };