@univerjs/sheets-drawing-ui 0.12.3 → 0.12.4

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.
Files changed (65) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +2 -2
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/en-US.js +1 -1
  5. package/lib/cjs/locale/es-ES.js +1 -1
  6. package/lib/cjs/locale/fa-IR.js +1 -1
  7. package/lib/cjs/locale/fr-FR.js +1 -1
  8. package/lib/cjs/locale/ja-JP.js +1 -1
  9. package/lib/cjs/locale/ko-KR.js +1 -1
  10. package/lib/cjs/locale/ru-RU.js +1 -1
  11. package/lib/cjs/locale/vi-VN.js +1 -1
  12. package/lib/cjs/locale/zh-CN.js +1 -1
  13. package/lib/cjs/locale/zh-TW.js +1 -1
  14. package/lib/es/facade.js +439 -395
  15. package/lib/es/index.js +1786 -1234
  16. package/lib/es/locale/ca-ES.js +15 -2
  17. package/lib/es/locale/en-US.js +13 -0
  18. package/lib/es/locale/es-ES.js +13 -0
  19. package/lib/es/locale/fa-IR.js +13 -0
  20. package/lib/es/locale/fr-FR.js +13 -0
  21. package/lib/es/locale/ja-JP.js +13 -0
  22. package/lib/es/locale/ko-KR.js +13 -0
  23. package/lib/es/locale/ru-RU.js +13 -0
  24. package/lib/es/locale/vi-VN.js +13 -0
  25. package/lib/es/locale/zh-CN.js +13 -0
  26. package/lib/es/locale/zh-TW.js +17 -4
  27. package/lib/facade.js +439 -395
  28. package/lib/index.css +1 -1
  29. package/lib/index.js +1786 -1234
  30. package/lib/locale/ca-ES.js +15 -2
  31. package/lib/locale/en-US.js +13 -0
  32. package/lib/locale/es-ES.js +13 -0
  33. package/lib/locale/fa-IR.js +13 -0
  34. package/lib/locale/fr-FR.js +13 -0
  35. package/lib/locale/ja-JP.js +13 -0
  36. package/lib/locale/ko-KR.js +13 -0
  37. package/lib/locale/ru-RU.js +13 -0
  38. package/lib/locale/vi-VN.js +13 -0
  39. package/lib/locale/zh-CN.js +13 -0
  40. package/lib/locale/zh-TW.js +17 -4
  41. package/lib/types/commands/commands/save-cell-images.command.d.ts +2 -0
  42. package/lib/types/facade/f-range.d.ts +40 -0
  43. package/lib/types/facade/f-worksheet.d.ts +29 -0
  44. package/lib/types/index.d.ts +3 -1
  45. package/lib/types/locale/en-US.d.ts +13 -0
  46. package/lib/types/services/batch-save-images.service.d.ts +148 -0
  47. package/lib/types/services/canvas-float-dom-manager.service.d.ts +2 -0
  48. package/lib/types/views/batch-save-images/BatchSaveImagesDialog.d.ts +16 -0
  49. package/lib/types/views/batch-save-images/component-name.d.ts +16 -0
  50. package/lib/types/views/batch-save-images/index.d.ts +17 -0
  51. package/lib/types/views/menu/save-images.menu.d.ts +4 -0
  52. package/lib/umd/facade.js +1 -1
  53. package/lib/umd/index.js +2 -2
  54. package/lib/umd/locale/ca-ES.js +1 -1
  55. package/lib/umd/locale/en-US.js +1 -1
  56. package/lib/umd/locale/es-ES.js +1 -1
  57. package/lib/umd/locale/fa-IR.js +1 -1
  58. package/lib/umd/locale/fr-FR.js +1 -1
  59. package/lib/umd/locale/ja-JP.js +1 -1
  60. package/lib/umd/locale/ko-KR.js +1 -1
  61. package/lib/umd/locale/ru-RU.js +1 -1
  62. package/lib/umd/locale/vi-VN.js +1 -1
  63. package/lib/umd/locale/zh-CN.js +1 -1
  64. package/lib/umd/locale/zh-TW.js +1 -1
  65. package/package.json +16 -15
package/lib/es/index.js CHANGED
@@ -1,33 +1,33 @@
1
- var yr = Object.defineProperty;
2
- var Tr = (i, t, e) => t in i ? yr(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var ee = (i, t, e) => Tr(i, typeof t != "symbol" ? t + "" : t, e);
4
- import { precisionTo as pt, IRenderManagerService as J, transformObjectOutOfGroup as Er, getGroupState as Or, getCurrentTypeOfRenderer as sn, CURSOR_TYPE as Ur, RENDER_CLASS_TYPE as Oe, Rect as Ue, ObjectType as mn, DRAWING_OBJECT_LAYER_INDEX as Ft, SHEET_VIEWPORT_KEY as xn } from "@univerjs/engine-render";
5
- import { convertPositionSheetOverGridToAbsolute as Pr, SheetSkeletonManagerService as V, ISheetSelectionRenderService as xe, attachRangeWithCoord as Yn, SheetCanvasPopManagerService as Ar, HoverManagerService as Nr, IEditorBridgeService as kr, IAutoFillService as Wr, EditingRenderController as Br, SetCellEditVisibleOperation as pn, PREDEFINED_HOOK_NAME as We, COPY_TYPE as ve, discreteRangeToRange as wn, virtualizeDiscreteRanges as jr, ISheetClipboardService as $r, SetZoomRatioOperation as _n, SetScrollOperation as Fr, SheetPrintInterceptorService as xr, getCurrentRangeDisable$ as Yr } from "@univerjs/sheets-ui";
6
- import { CommandType as Z, ICommandService as X, IUndoRedoService as Ye, sequenceExecute as Gn, DrawingTypeEnum as B, ArrangeTypeEnum as wt, Inject as A, IContextService as Xn, LocaleService as nt, Injector as Ge, Disposable as ne, createDocumentModelWithStyle as Vt, ObjectRelativeFromV as Sn, ObjectRelativeFromH as vn, WrapTextType as In, PositionedObjectLayoutType as Cn, BooleanNumber as Dn, BuildTextUtils as Ht, ImageSourceType as Rn, generateRandomId as Qe, FOCUSING_COMMON_DRAWINGS as $e, IUniverInstanceService as Se, UniverInstanceType as F, Direction as _e, IImageIoService as Gr, RxDisposable as Xr, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ze, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Be, InterceptorEffectEnum as Lr, ObjectMatrix as Vr, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Hr, IPermissionService as zr, UserManagerService as Kr, LifecycleService as Jr, LifecycleStages as Zr, DisposableCollection as _t, fromEventSubject as qr, Tools as je, PRINT_CHART_COMPONENT_KEY as Qr, Rectangle as ei, FOCUSING_FX_BAR_EDITOR as ti, EDITOR_ACTIVATED as ni, FOCUSING_PANEL_EDITOR as ri, DependentOn as ii, IConfigService as si, Plugin as oi, merge as ai, registerDependencies as ci, touchDependencies as xt } from "@univerjs/core";
7
- import { ISheetDrawingService as re, DrawingApplyType as U, SetDrawingApplyMutation as P, SheetDrawingAnchorType as O, UniverSheetsDrawingPlugin as di } from "@univerjs/sheets-drawing";
8
- import { SheetInterceptorService as At, SheetsSelectionsService as on, SetRangeValuesCommand as bn, getSheetCommandTarget as se, INTERCEPTOR_POINT as li, InterceptCellContentPriority as ui, WorkbookViewPermission as Mn, WorksheetViewPermission as yn, WorkbookEditablePermission as zt, WorksheetEditPermission as Kt, SetFrozenMutation as hi, SetWorksheetRowAutoHeightMutation as gi, COMMAND_LISTENER_SKELETON_CHANGE as fi, InsertRowCommand as Ln, InsertColCommand as Vn, RemoveRowCommand as Hn, RemoveColCommand as zn, DeleteRangeMoveLeftCommand as Kn, DeleteRangeMoveUpCommand as Jn, InsertRangeMoveDownCommand as Zn, InsertRangeMoveRightCommand as qn, DeltaRowHeightCommand as Jt, SetRowHeightCommand as Zt, DeltaColumnWidthCommand as Qn, SetColWidthCommand as er, SetRowHiddenCommand as tr, SetSpecificRowsVisibleCommand as nr, SetSpecificColsVisibleCommand as rr, SetColHiddenCommand as ir, MoveColsCommand as sr, MoveRowsCommand as or, MoveRangeCommand as ar, SetRowVisibleMutation as mi, SetRowHiddenMutation as pi, SetColVisibleMutation as wi, SetColHiddenMutation as _i, SetWorksheetRowHeightMutation as Si, SetWorksheetColWidthMutation as vi, SetWorksheetActiveOperation as Ii, RangeProtectionPermissionEditPoint as Ci } from "@univerjs/sheets";
9
- import { MessageType as pe, render as Di, unmount as Ri, clsx as bi, RadioGroup as Mi, Radio as Yt } from "@univerjs/design";
10
- import { docDrawingPositionToTransform as Tn, ReplaceSnapshotCommand as yi, InnerPasteCommand as Ti } from "@univerjs/docs-ui";
11
- import { IImageIoService as Ei, IDrawingManagerService as ie, DRAWING_IMAGE_ALLOW_IMAGE_LIST as En, DRAWING_IMAGE_COUNT_LIMIT as On, ImageUploadStatusType as Pe, DRAWING_IMAGE_ALLOW_SIZE as Un, getImageSize as Gt, SetDrawingSelectedOperation as Nt, DRAWING_IMAGE_WIDTH_LIMIT as Pn, DRAWING_IMAGE_HEIGHT_LIMIT as An, ImageSourceType as Oi, getDrawingShapeKeyByDrawingSearch as Ie, UniverDrawingPlugin as Ui } from "@univerjs/drawing";
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 Gi } from "@univerjs/docs-drawing";
14
- import { ImageCropperObject as Xi, 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 St, switchMap as we, EMPTY as fe, tap as kn, map as Re, distinctUntilChanged as Wn, Subject as Xt, filter as Zi, take as qi, BehaviorSubject as ke, of as Bn } from "rxjs";
16
- import { jsx as oe, jsxs as qt } from "react/jsx-runtime";
17
- import { useMemo as Qi, useState as Qt, useEffect as ur } from "react";
18
- function z(i, t, e) {
1
+ var Qr = Object.defineProperty;
2
+ var ei = (i, t, e) => t in i ? Qr(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var re = (i, t, e) => ei(i, typeof t != "symbol" ? t + "" : t, e);
4
+ import { precisionTo as bt, IRenderManagerService as Q, transformObjectOutOfGroup as ti, getGroupState as ni, getCurrentTypeOfRenderer as Dn, CURSOR_TYPE as ri, RENDER_CLASS_TYPE as $e, Rect as ke, ObjectType as An, DRAWING_OBJECT_LAYER_INDEX as qt, SHEET_VIEWPORT_KEY as cr } from "@univerjs/engine-render";
5
+ import { convertPositionSheetOverGridToAbsolute as ii, SheetSkeletonManagerService as X, ISheetSelectionRenderService as Ze, attachRangeWithCoord as dr, SheetCanvasPopManagerService as si, HoverManagerService as oi, IEditorBridgeService as ai, IAutoFillService as ci, EditingRenderController as di, SetCellEditVisibleOperation as Nn, PREDEFINED_HOOK_NAME as Le, COPY_TYPE as Re, discreteRangeToRange as $n, virtualizeDiscreteRanges as li, ISheetClipboardService as ui, SetZoomRatioOperation as kn, SetScrollOperation as hi, SheetPrintInterceptorService as gi, useHighlightRange as fi, getCurrentRangeDisable$ as mi } from "@univerjs/sheets-ui";
6
+ import { CommandType as q, ICommandService as Y, IUndoRedoService as Je, sequenceExecute as lr, DrawingTypeEnum as x, ArrangeTypeEnum as Mt, Inject as A, IContextService as ur, LocaleService as Te, Injector as qe, Disposable as ee, createDocumentModelWithStyle as un, ObjectRelativeFromV as xn, ObjectRelativeFromH as Wn, WrapTextType as Bn, PositionedObjectLayoutType as jn, BooleanNumber as Fn, BuildTextUtils as hn, ImageSourceType as Ce, generateRandomId as Ve, FOCUSING_COMMON_DRAWINGS as Ge, IUniverInstanceService as de, UniverInstanceType as $, Direction as ve, createIdentifier as pi, IImageIoService as hr, RxDisposable as wi, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as ot, DOCS_ZEN_EDITOR_UNIT_ID_KEY as He, InterceptorEffectEnum as _i, ObjectMatrix as Si, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as vi, IPermissionService as Ii, UserManagerService as Ci, LifecycleService as Ri, LifecycleStages as Di, DisposableCollection as yt, fromEventSubject as bi, Tools as Ye, PRINT_CHART_COMPONENT_KEY as Mi, Rectangle as yi, FOCUSING_FX_BAR_EDITOR as Ei, EDITOR_ACTIVATED as Ti, FOCUSING_PANEL_EDITOR as Oi, DependentOn as Ui, IConfigService as Pi, Plugin as Ai, merge as Ni, registerDependencies as $i, touchDependencies as Qt } from "@univerjs/core";
7
+ import { ISheetDrawingService as se, DrawingApplyType as U, SetDrawingApplyMutation as P, SheetDrawingAnchorType as O, UniverSheetsDrawingPlugin as ki } from "@univerjs/sheets-drawing";
8
+ import { SheetInterceptorService as Vt, SheetsSelectionsService as ut, SetRangeValuesCommand as Ln, getSheetCommandTarget as ae, INTERCEPTOR_POINT as xi, InterceptCellContentPriority as Wi, WorkbookViewPermission as Vn, WorksheetViewPermission as Hn, WorkbookEditablePermission as gn, WorksheetEditPermission as fn, SetFrozenMutation as Bi, SetSelectionsOperation as ji, SetWorksheetRowAutoHeightMutation as Fi, COMMAND_LISTENER_SKELETON_CHANGE as Li, InsertRowCommand as gr, InsertColCommand as fr, RemoveRowCommand as mr, RemoveColCommand as pr, DeleteRangeMoveLeftCommand as wr, DeleteRangeMoveUpCommand as _r, InsertRangeMoveDownCommand as Sr, InsertRangeMoveRightCommand as vr, DeltaRowHeightCommand as mn, SetRowHeightCommand as pn, DeltaColumnWidthCommand as Ir, SetColWidthCommand as Cr, SetRowHiddenCommand as Rr, SetSpecificRowsVisibleCommand as Dr, SetSpecificColsVisibleCommand as br, SetColHiddenCommand as Mr, MoveColsCommand as yr, MoveRowsCommand as Er, MoveRangeCommand as Tr, SetRowVisibleMutation as Vi, SetRowHiddenMutation as Hi, SetColVisibleMutation as Yi, SetColHiddenMutation as Gi, SetWorksheetRowHeightMutation as Xi, SetWorksheetColWidthMutation as zi, SetWorksheetActiveOperation as Ki, RangeProtectionPermissionEditPoint as Zi } from "@univerjs/sheets";
9
+ import { MessageType as Se, render as Ji, unmount as qi, FormLayout as en, CheckboxGroup as Qi, Checkbox as Yn, Select as es, Button as Gn, clsx as ts, RadioGroup as ns, Radio as tn } from "@univerjs/design";
10
+ import { docDrawingPositionToTransform as Xn, ReplaceSnapshotCommand as rs, InnerPasteCommand as is } from "@univerjs/docs-ui";
11
+ import { IImageIoService as ss, IDrawingManagerService as oe, DRAWING_IMAGE_ALLOW_IMAGE_LIST as zn, DRAWING_IMAGE_COUNT_LIMIT as Kn, ImageUploadStatusType as xe, DRAWING_IMAGE_ALLOW_SIZE as Zn, getImageSize as nn, SetDrawingSelectedOperation as Ht, DRAWING_IMAGE_WIDTH_LIMIT as Jn, DRAWING_IMAGE_HEIGHT_LIMIT as qn, ImageSourceType as os, getDrawingShapeKeyByDrawingSearch as De, UniverDrawingPlugin as as } from "@univerjs/drawing";
12
+ import { ILocalFileService as cs, IMessageService as Or, IDialogService as bn, ISidebarService as ds, IClipboardInterfaceService as ls, CanvasFloatDomService as us, PrintFloatDomSingle as hs, ComponentManager as Ur, connectInjector as gs, useDependency as Ie, getMenuHiddenObservable as Yt, MenuItemType as Gt, ContextMenuPosition as rn, ContextMenuGroup as sn, RibbonInsertGroup as fs, KeyCode as Ke, IMenuManagerService as ms, IShortcutService as ps } from "@univerjs/ui";
13
+ import { DocDrawingController as ws, UniverDocsDrawingPlugin as _s } from "@univerjs/docs-drawing";
14
+ import { ImageCropperObject as Ss, COMPONENT_IMAGE_POPUP_MENU as vs, OpenImageCropOperation as Is, ImageResetSizeOperation as Cs, DrawingRenderService as Pr, DrawingCommonPanel as Rs, UniverDrawingUIPlugin as Ds } from "@univerjs/drawing-ui";
15
+ import { takeUntil as Qn, throttleTime as bs, combineLatest as at, switchMap as me, EMPTY as we, tap as er, map as pe, distinctUntilChanged as tr, Subject as on, filter as Ms, take as ys, BehaviorSubject as je, of as wn } from "rxjs";
16
+ import { jsx as L, jsxs as Xe } from "react/jsx-runtime";
17
+ import { useMemo as Fe, useRef as Es, createElement as Ar, forwardRef as Ts, useState as Ee, useCallback as Et, useEffect as Nr } from "react";
18
+ function Z(i, t, e) {
19
19
  const { from: n, to: r, flipY: s = !1, flipX: o = !1, angle: a = 0, skewX: d = 0, skewY: u = 0 } = i, c = e.getCurrent();
20
20
  if (c == null)
21
21
  return;
22
- const l = Pr(
22
+ const l = ii(
23
23
  c.unitId,
24
24
  c.sheetId,
25
25
  { from: n, to: r },
26
26
  e
27
27
  );
28
- let { left: g, top: h, width: f, height: p } = l;
29
- const m = e.getCurrentSkeleton(), _ = m.rowHeaderWidth + m.columnTotalWidth, v = m.columnHeaderHeight + m.rowTotalHeight;
30
- return g + f > _ && (g = _ - f), h + p > v && (h = v - p), {
28
+ let { left: g, top: h, width: f, height: m } = l;
29
+ const p = e.getCurrentSkeleton(), w = p.rowHeaderWidth + p.columnTotalWidth, S = p.columnHeaderHeight + p.rowTotalHeight;
30
+ return g + f > w && (g = w - f), h + m > S && (h = S - m), {
31
31
  flipY: s,
32
32
  flipX: o,
33
33
  angle: a,
@@ -36,26 +36,26 @@ function z(i, t, e) {
36
36
  left: g,
37
37
  top: h,
38
38
  width: f,
39
- height: p
39
+ height: m
40
40
  };
41
41
  }
42
- function $(i, t) {
42
+ function j(i, t) {
43
43
  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);
44
44
  if (l == null)
45
45
  return;
46
46
  const g = {
47
47
  column: l.actualColumn,
48
- columnOffset: pt(e - l.startX, 1),
48
+ columnOffset: bt(e - l.startX, 1),
49
49
  row: l.actualRow,
50
- rowOffset: pt(n - l.startY, 1)
50
+ rowOffset: bt(n - l.startY, 1)
51
51
  }, h = t.getCellWithCoordByOffset(e + r, n + s);
52
52
  if (h == null)
53
53
  return;
54
54
  const f = {
55
55
  column: h.actualColumn,
56
- columnOffset: pt(e + r - h.startX, 1),
56
+ columnOffset: bt(e + r - h.startX, 1),
57
57
  row: h.actualRow,
58
- rowOffset: pt(n + s - h.startY, 1)
58
+ rowOffset: bt(n + s - h.startY, 1)
59
59
  };
60
60
  return {
61
61
  flipY: o,
@@ -67,50 +67,50 @@ function $(i, t) {
67
67
  to: f
68
68
  };
69
69
  }
70
- const Y = {
70
+ const V = {
71
71
  id: "sheet.operation.clear-drawing-transformer",
72
- type: Z.MUTATION,
72
+ type: q.MUTATION,
73
73
  handler: (i, t) => {
74
- const e = i.get(J);
74
+ const e = i.get(Q);
75
75
  return t.forEach((n) => {
76
76
  var r, s;
77
77
  (s = (r = e.getRenderById(n)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
78
78
  }), !0;
79
79
  }
80
- }, rt = {
80
+ }, ht = {
81
81
  id: "sheet.command.remove-sheet-image",
82
- type: Z.COMMAND,
82
+ type: q.COMMAND,
83
83
  handler: (i, t) => {
84
- var v, I, R;
85
- const e = i.get(X), n = i.get(Ye), r = i.get(At), s = i.get(re);
84
+ var S, I, D;
85
+ const e = i.get(Y), n = i.get(Je), r = i.get(Vt), s = i.get(se);
86
86
  if (!t) return !1;
87
87
  const { drawings: o } = t, a = [];
88
- o.forEach((S) => {
89
- const { unitId: C } = S;
88
+ o.forEach((v) => {
89
+ const { unitId: C } = v;
90
90
  a.push(C);
91
91
  });
92
- const d = s.getBatchRemoveOp(o), { unitId: u, subUnitId: c, undo: l, redo: g, objects: h } = d, f = r.onCommandExecute({ id: rt.id, params: t }), p = { id: P.id, params: { unitId: u, subUnitId: c, op: g, objects: h, type: U.REMOVE } }, m = { id: P.id, params: { unitId: u, subUnitId: c, op: l, objects: h, type: U.INSERT } };
93
- return Gn([...(v = f.preRedos) != null ? v : [], p, ...f.redos], e) ? (n.pushUndoRedo({
92
+ const d = s.getBatchRemoveOp(o), { unitId: u, subUnitId: c, undo: l, redo: g, objects: h } = d, f = r.onCommandExecute({ id: ht.id, params: t }), m = { id: P.id, params: { unitId: u, subUnitId: c, op: g, objects: h, type: U.REMOVE } }, p = { id: P.id, params: { unitId: u, subUnitId: c, op: l, objects: h, type: U.INSERT } };
93
+ return lr([...(S = f.preRedos) != null ? S : [], m, ...f.redos], e) ? (n.pushUndoRedo({
94
94
  unitID: u,
95
95
  undoMutations: [
96
96
  ...(I = f.preUndos) != null ? I : [],
97
- m,
97
+ p,
98
98
  ...f.undos,
99
- { id: Y.id, params: a }
99
+ { id: V.id, params: a }
100
100
  ],
101
101
  redoMutations: [
102
- ...(R = f.preRedos) != null ? R : [],
103
- p,
102
+ ...(D = f.preRedos) != null ? D : [],
103
+ m,
104
104
  ...f.redos,
105
- { id: Y.id, params: a }
105
+ { id: V.id, params: a }
106
106
  ]
107
107
  }), !0) : !1;
108
108
  }
109
- }, hr = {
109
+ }, $r = {
110
110
  id: "sheet.command.delete-drawing",
111
- type: Z.COMMAND,
111
+ type: q.COMMAND,
112
112
  handler: (i) => {
113
- const t = i.get(X), n = i.get(re).getFocusDrawings();
113
+ const t = i.get(Y), n = i.get(se).getFocusDrawings();
114
114
  if (n.length === 0)
115
115
  return !1;
116
116
  const r = n[0].unitId, s = n.map((o) => {
@@ -122,21 +122,21 @@ const Y = {
122
122
  drawingType: c
123
123
  };
124
124
  });
125
- return t.executeCommand(rt.id, {
125
+ return t.executeCommand(ht.id, {
126
126
  unitId: r,
127
127
  drawings: s
128
128
  });
129
129
  }
130
130
  };
131
- function es(i) {
131
+ function Os(i) {
132
132
  const t = [];
133
133
  return i.forEach((e) => {
134
- const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = n, d = Or(0, 0, r.map((l) => l.transform || {})), u = r.map((l) => {
135
- const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: f, drawingId: p } = l;
134
+ const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a } = n, d = ni(0, 0, r.map((l) => l.transform || {})), u = r.map((l) => {
135
+ const g = l.transform || { left: 0, top: 0 }, { unitId: h, subUnitId: f, drawingId: m } = l;
136
136
  return {
137
137
  unitId: h,
138
138
  subUnitId: f,
139
- drawingId: p,
139
+ drawingId: m,
140
140
  transform: {
141
141
  ...g,
142
142
  left: g.left - d.left,
@@ -148,7 +148,7 @@ function es(i) {
148
148
  unitId: s,
149
149
  subUnitId: o,
150
150
  drawingId: a,
151
- drawingType: B.DRAWING_GROUP,
151
+ drawingType: x.DRAWING_GROUP,
152
152
  transform: d
153
153
  };
154
154
  t.push({
@@ -157,26 +157,26 @@ function es(i) {
157
157
  });
158
158
  }), t;
159
159
  }
160
- function ts(i) {
160
+ function Us(i) {
161
161
  const t = [];
162
162
  return i.forEach((e) => {
163
163
  const { parent: n, children: r } = e, { unitId: s, subUnitId: o, drawingId: a, transform: d = { width: 0, height: 0 } } = n;
164
164
  if (d == null)
165
165
  return;
166
166
  const u = r.map((l) => {
167
- const { transform: g } = l, { unitId: h, subUnitId: f, drawingId: p } = l, m = Er(g || {}, d, d.width || 0, d.height || 0);
167
+ const { transform: g } = l, { unitId: h, subUnitId: f, drawingId: m } = l, p = ti(g || {}, d, d.width || 0, d.height || 0);
168
168
  return {
169
169
  unitId: h,
170
170
  subUnitId: f,
171
- drawingId: p,
172
- transform: m,
171
+ drawingId: m,
172
+ transform: p,
173
173
  groupId: void 0
174
174
  };
175
175
  }), c = {
176
176
  unitId: s,
177
177
  subUnitId: o,
178
178
  drawingId: a,
179
- drawingType: B.DRAWING_GROUP,
179
+ drawingType: x.DRAWING_GROUP,
180
180
  transform: {
181
181
  left: 0,
182
182
  top: 0
@@ -188,64 +188,64 @@ function ts(i) {
188
188
  });
189
189
  }), t;
190
190
  }
191
- const gr = {
191
+ const kr = {
192
192
  id: "sheet.command.group-sheet-image",
193
- type: Z.COMMAND,
193
+ type: q.COMMAND,
194
194
  handler: (i, t) => {
195
- const e = i.get(X), n = i.get(Ye), r = i.get(re);
195
+ const e = i.get(Y), n = i.get(Je), r = i.get(se);
196
196
  if (!t) return !1;
197
197
  const s = [];
198
198
  t.forEach(({ parent: h, children: f }) => {
199
- s.push(h.unitId), f.forEach((p) => {
200
- s.push(p.unitId);
199
+ s.push(h.unitId), f.forEach((m) => {
200
+ s.push(m.unitId);
201
201
  });
202
202
  });
203
203
  const o = r.getGroupDrawingOp(t), { unitId: a, subUnitId: d, undo: u, redo: c, objects: l } = o;
204
204
  return e.syncExecuteCommand(P.id, { op: c, unitId: a, subUnitId: d, objects: l, type: U.GROUP }) ? (n.pushUndoRedo({
205
205
  unitID: a,
206
206
  undoMutations: [
207
- { id: P.id, params: { op: u, unitId: a, subUnitId: d, objects: ts(l), type: U.UNGROUP } },
208
- { id: Y.id, params: s }
207
+ { id: P.id, params: { op: u, unitId: a, subUnitId: d, objects: Us(l), type: U.UNGROUP } },
208
+ { id: V.id, params: s }
209
209
  ],
210
210
  redoMutations: [
211
211
  { id: P.id, params: { op: c, unitId: a, subUnitId: d, objects: l, type: U.GROUP } },
212
- { id: Y.id, params: s }
212
+ { id: V.id, params: s }
213
213
  ]
214
214
  }), !0) : !1;
215
215
  }
216
- }, kt = {
216
+ }, Xt = {
217
217
  id: "sheet.command.insert-sheet-image",
218
- type: Z.COMMAND,
218
+ type: q.COMMAND,
219
219
  handler: (i, t) => {
220
- var v, I, R;
221
- const e = i.get(X), n = i.get(Ye), r = i.get(re), s = i.get(At);
220
+ var S, I, D;
221
+ const e = i.get(Y), n = i.get(Je), r = i.get(se), s = i.get(Vt);
222
222
  if (!t) return !1;
223
- 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 } };
224
- return Gn([...(v = f.preRedos) != null ? v : [], p, ...f.redos], e) ? (n.pushUndoRedo({
223
+ const o = t.drawings, a = o.map((v) => v.unitId), d = r.getBatchAddOp(o), { unitId: u, subUnitId: c, undo: l, redo: g, objects: h } = d, f = s.onCommandExecute({ id: Xt.id, params: t }), m = { id: P.id, params: { op: g, unitId: u, subUnitId: c, objects: h, type: U.INSERT } }, p = { id: P.id, params: { op: l, unitId: u, subUnitId: c, objects: h, type: U.REMOVE } };
224
+ return lr([...(S = f.preRedos) != null ? S : [], m, ...f.redos], e) ? (n.pushUndoRedo({
225
225
  unitID: u,
226
226
  undoMutations: [
227
227
  ...(I = f.preUndos) != null ? I : [],
228
- m,
228
+ p,
229
229
  ...f.undos,
230
- { id: Y.id, params: a }
230
+ { id: V.id, params: a }
231
231
  ],
232
232
  redoMutations: [
233
- ...(R = f.preRedos) != null ? R : [],
234
- p,
233
+ ...(D = f.preRedos) != null ? D : [],
234
+ m,
235
235
  ...f.redos,
236
- { id: Y.id, params: a }
236
+ { id: V.id, params: a }
237
237
  ]
238
238
  }), !0) : !1;
239
239
  }
240
- }, fr = {
240
+ }, xr = {
241
241
  id: "sheet.command.set-drawing-arrange",
242
- type: Z.COMMAND,
242
+ type: q.COMMAND,
243
243
  handler: (i, t) => {
244
- const e = i.get(X), n = i.get(Ye);
244
+ const e = i.get(Y), n = i.get(Je);
245
245
  if (!t) return !1;
246
- const r = i.get(re), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: d } = t, u = { unitId: s, subUnitId: o, drawingIds: a };
246
+ const r = i.get(se), { unitId: s, subUnitId: o, drawingIds: a, arrangeType: d } = t, u = { unitId: s, subUnitId: o, drawingIds: a };
247
247
  let c;
248
- if (d === wt.forward ? c = r.getForwardDrawingsOp(u) : d === wt.backward ? c = r.getBackwardDrawingOp(u) : d === wt.front ? c = r.getFrontDrawingsOp(u) : d === wt.back && (c = r.getBackDrawingsOp(u)), c == null)
248
+ 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)
249
249
  return !1;
250
250
  const { objects: l, redo: g, undo: h } = c;
251
251
  return e.syncExecuteCommand(P.id, { op: g, unitId: s, subUnitId: o, objects: l, type: U.ARRANGE }) ? (n.pushUndoRedo({
@@ -258,94 +258,94 @@ const gr = {
258
258
  ]
259
259
  }), !0) : !1;
260
260
  }
261
- }, Wt = {
261
+ }, zt = {
262
262
  id: "sheet.command.set-sheet-image",
263
- type: Z.COMMAND,
263
+ type: q.COMMAND,
264
264
  handler: (i, t) => {
265
- const e = i.get(X), n = i.get(Ye), r = i.get(re);
265
+ const e = i.get(Y), n = i.get(Je), r = i.get(se);
266
266
  if (!t) return !1;
267
267
  const { drawings: s } = t, o = r.getBatchUpdateOp(s), { unitId: a, subUnitId: d, undo: u, redo: c, objects: l } = o;
268
268
  return e.syncExecuteCommand(P.id, { unitId: a, subUnitId: d, op: c, objects: l, type: U.UPDATE }) ? (n.pushUndoRedo({
269
269
  unitID: a,
270
270
  undoMutations: [
271
271
  { id: P.id, params: { unitId: a, subUnitId: d, op: u, objects: l, type: U.UPDATE } },
272
- { id: Y.id, params: [a] }
272
+ { id: V.id, params: [a] }
273
273
  ],
274
274
  redoMutations: [
275
275
  { id: P.id, params: { unitId: a, subUnitId: d, op: c, objects: l, type: U.UPDATE } },
276
- { id: Y.id, params: [a] }
276
+ { id: V.id, params: [a] }
277
277
  ]
278
278
  }), !0) : !1;
279
279
  }
280
- }, mr = {
280
+ }, Wr = {
281
281
  id: "sheet.command.ungroup-sheet-image",
282
- type: Z.COMMAND,
282
+ type: q.COMMAND,
283
283
  handler: (i, t) => {
284
- const e = i.get(X), n = i.get(Ye), r = i.get(re);
284
+ const e = i.get(Y), n = i.get(Je), r = i.get(se);
285
285
  if (!t) return !1;
286
286
  const s = [];
287
287
  t.forEach(({ parent: h, children: f }) => {
288
- s.push(h.unitId), f.forEach((p) => {
289
- s.push(p.unitId);
288
+ s.push(h.unitId), f.forEach((m) => {
289
+ s.push(m.unitId);
290
290
  });
291
291
  });
292
292
  const o = r.getUngroupDrawingOp(t), { unitId: a, subUnitId: d, undo: u, redo: c, objects: l } = o;
293
293
  return e.syncExecuteCommand(P.id, { op: c, unitId: a, subUnitId: d, objects: l, type: U.UNGROUP }) ? (n.pushUndoRedo({
294
294
  unitID: a,
295
295
  undoMutations: [
296
- { id: P.id, params: { op: u, unitId: a, subUnitId: d, objects: es(l), type: U.GROUP } },
297
- { id: Y.id, params: s }
296
+ { id: P.id, params: { op: u, unitId: a, subUnitId: d, objects: Os(l), type: U.GROUP } },
297
+ { id: V.id, params: s }
298
298
  ],
299
299
  redoMutations: [
300
300
  { id: P.id, params: { op: c, unitId: a, subUnitId: d, objects: l, type: U.UNGROUP } },
301
- { id: Y.id, params: s }
301
+ { id: V.id, params: s }
302
302
  ]
303
303
  }), !0) : !1;
304
304
  }
305
305
  };
306
- var ns = Object.getOwnPropertyDescriptor, rs = (i, t, e, n) => {
307
- for (var r = n > 1 ? void 0 : n ? ns(t, e) : t, s = i.length - 1, o; s >= 0; s--)
306
+ var Ps = Object.getOwnPropertyDescriptor, As = (i, t, e, n) => {
307
+ for (var r = n > 1 ? void 0 : n ? Ps(t, e) : t, s = i.length - 1, o; s >= 0; s--)
308
308
  (o = i[s]) && (r = o(r) || r);
309
309
  return r;
310
- }, te = (i, t) => (e, n) => t(e, n, i);
311
- function is(i, t, e) {
310
+ }, ie = (i, t) => (e, n) => t(e, n, i);
311
+ function Ns(i, t, e) {
312
312
  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));
313
313
  return { rotatedWidth: r, rotatedHeight: s };
314
314
  }
315
- function en(i, t, e, n, r) {
316
- var v;
317
- const { rotatedHeight: s, rotatedWidth: o } = is(e, n, r), d = i.get(J).getRenderById(t.unitId);
315
+ function _n(i, t, e, n, r) {
316
+ var S;
317
+ const { rotatedHeight: s, rotatedWidth: o } = Ns(e, n, r), d = i.get(Q).getRenderById(t.unitId);
318
318
  if (!d)
319
319
  return !1;
320
- const c = (v = d.with(V).getSkeletonParam(t.subUnitId)) == null ? void 0 : v.skeleton;
320
+ const c = (S = d.with(X).getSkeletonParam(t.subUnitId)) == null ? void 0 : S.skeleton;
321
321
  if (c == null)
322
322
  return !1;
323
- const l = c.getCellByIndex(t.row, t.col), g = l.mergeInfo.endX - l.mergeInfo.startX - 2, h = l.mergeInfo.endY - l.mergeInfo.startY - 2, f = o / s, m = Math.ceil(Math.min(g, h * f)) / o, _ = !m || Number.isNaN(m) ? 1e-3 : m;
323
+ const l = c.getCellByIndex(t.row, t.col), g = l.mergeInfo.endX - l.mergeInfo.startX - 2, h = l.mergeInfo.endY - l.mergeInfo.startY - 2, f = o / s, p = Math.ceil(Math.min(g, h * f)) / o, w = !p || Number.isNaN(p) ? 1e-3 : p;
324
324
  return {
325
- width: e * _,
326
- height: n * _
325
+ width: e * w,
326
+ height: n * w
327
327
  };
328
328
  }
329
- let et = class extends ne {
329
+ let dt = class extends ee {
330
330
  constructor(t, e, n, r, s, o, a, d, u, c, l, g, h) {
331
331
  super();
332
- ee(this, "_workbookSelections");
332
+ re(this, "_workbookSelections");
333
333
  this._context = t, this._skeletonManagerService = e, this._commandService = n, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = a, this._drawingManagerService = d, this._contextService = u, this._messageService = c, this._localeService = l, this._injector = h, this._workbookSelections = g.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
334
334
  }
335
335
  async insertFloatImage() {
336
336
  const t = await this._fileOpenerService.openFile({
337
337
  multiple: !0,
338
- accept: En.map((n) => `.${n.replace("image/", "")}`).join(",")
338
+ accept: zn.map((n) => `.${n.replace("image/", "")}`).join(",")
339
339
  }), e = t.length;
340
- return e > On ? (this._messageService.show({
341
- type: pe.Error,
342
- content: this._localeService.t("update-status.exceedMaxCount", String(On))
340
+ return e > Kn ? (this._messageService.show({
341
+ type: Se.Error,
342
+ content: this._localeService.t("update-status.exceedMaxCount", String(Kn))
343
343
  }), !1) : e === 0 ? !1 : (t.forEach(async (n) => await this.insertFloatImageByFile(n)), !0);
344
344
  }
345
345
  async insertCellImage() {
346
346
  const e = (await this._fileOpenerService.openFile({
347
347
  multiple: !1,
348
- accept: En.map((n) => `.${n.replace("image/", "")}`).join(",")
348
+ accept: zn.map((n) => `.${n.replace("image/", "")}`).join(",")
349
349
  }))[0];
350
350
  return e ? (await this._insertCellImage(e), !0) : !1;
351
351
  }
@@ -356,75 +356,75 @@ let et = class extends ne {
356
356
  let e;
357
357
  try {
358
358
  e = await this._imageIoService.saveImage(t);
359
- } catch (v) {
360
- const I = v.message;
361
- I === Pe.ERROR_EXCEED_SIZE ? this._messageService.show({
362
- type: pe.Error,
363
- content: this._localeService.t("update-status.exceedMaxSize", String(Un / (1024 * 1024)))
364
- }) : I === Pe.ERROR_IMAGE_TYPE ? this._messageService.show({
365
- type: pe.Error,
359
+ } catch (S) {
360
+ const I = S.message;
361
+ I === xe.ERROR_EXCEED_SIZE ? this._messageService.show({
362
+ type: Se.Error,
363
+ content: this._localeService.t("update-status.exceedMaxSize", String(Zn / (1024 * 1024)))
364
+ }) : I === xe.ERROR_IMAGE_TYPE ? this._messageService.show({
365
+ type: Se.Error,
366
366
  content: this._localeService.t("update-status.invalidImageType")
367
- }) : I === Pe.ERROR_IMAGE && this._messageService.show({
368
- type: pe.Error,
367
+ }) : I === xe.ERROR_IMAGE && this._messageService.show({
368
+ type: Se.Error,
369
369
  content: this._localeService.t("update-status.invalidImage")
370
370
  });
371
371
  }
372
372
  if (e == null)
373
373
  return;
374
- 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 Gt(u || ""), { width: h, height: f } = this._context.scene;
374
+ 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 nn(u || ""), { width: h, height: f } = this._context.scene;
375
375
  this._imageIoService.addImageSourceCache(d, a, g);
376
- let p = 1;
377
- if (c > Pn || l > An) {
378
- const v = Pn / c, I = An / l;
379
- p = Math.max(v, I);
376
+ let m = 1;
377
+ if (c > Jn || l > qn) {
378
+ const S = Jn / c, I = qn / l;
379
+ m = Math.max(S, I);
380
380
  }
381
- const m = this._getImagePosition(c * p, l * p, h, f);
382
- if (m == null)
381
+ const p = this._getImagePosition(c * m, l * m, h, f);
382
+ if (p == null)
383
383
  return;
384
- const _ = {
384
+ const w = {
385
385
  unitId: r,
386
386
  subUnitId: s,
387
387
  drawingId: o,
388
- drawingType: B.DRAWING_IMAGE,
388
+ drawingType: x.DRAWING_IMAGE,
389
389
  imageSourceType: a,
390
390
  source: d,
391
- transform: z(m, this._selectionRenderService, this._skeletonManagerService),
392
- sheetTransform: m
391
+ transform: Z(p, this._selectionRenderService, this._skeletonManagerService),
392
+ sheetTransform: p
393
393
  };
394
- return this._commandService.executeCommand(kt.id, {
394
+ return this._commandService.executeCommand(Xt.id, {
395
395
  unitId: r,
396
- drawings: [_]
396
+ drawings: [w]
397
397
  });
398
398
  }
399
399
  // eslint-disable-next-line max-lines-per-function
400
400
  async _insertCellImage(t, e) {
401
- var I, R;
401
+ var I, D;
402
402
  let n;
403
403
  try {
404
404
  n = await this._imageIoService.saveImage(t);
405
- } catch (S) {
406
- const C = S.message;
407
- C === Pe.ERROR_EXCEED_SIZE ? this._messageService.show({
408
- type: pe.Error,
409
- content: this._localeService.t("update-status.exceedMaxSize", String(Un / (1024 * 1024)))
410
- }) : C === Pe.ERROR_IMAGE_TYPE ? this._messageService.show({
411
- type: pe.Error,
405
+ } catch (v) {
406
+ const C = v.message;
407
+ C === xe.ERROR_EXCEED_SIZE ? this._messageService.show({
408
+ type: Se.Error,
409
+ content: this._localeService.t("update-status.exceedMaxSize", String(Zn / (1024 * 1024)))
410
+ }) : C === xe.ERROR_IMAGE_TYPE ? this._messageService.show({
411
+ type: Se.Error,
412
412
  content: this._localeService.t("update-status.invalidImageType")
413
- }) : C === Pe.ERROR_IMAGE && this._messageService.show({
414
- type: pe.Error,
413
+ }) : C === xe.ERROR_IMAGE && this._messageService.show({
414
+ type: Se.Error,
415
415
  content: this._localeService.t("update-status.invalidImage")
416
416
  });
417
417
  }
418
418
  if (n == null)
419
419
  return !1;
420
- const { imageId: r, imageSourceType: s, source: o, base64Cache: a } = n, { width: d, height: u, image: c } = await Gt(a || "");
420
+ const { imageId: r, imageSourceType: s, source: o, base64Cache: a } = n, { width: d, height: u, image: c } = await nn(a || "");
421
421
  this._imageIoService.addImageSourceCache(o, s, c);
422
422
  const l = this._workbookSelections.getCurrentLastSelection();
423
423
  if (!l)
424
424
  return !1;
425
425
  let g = l.primary.actualRow, h = l.primary.actualColumn;
426
426
  l.primary.isMerged && (g = l.primary.startRow, h = l.primary.startColumn);
427
- const f = Vt("", {}), p = en(
427
+ const f = un("", {}), m = _n(
428
428
  this._injector,
429
429
  {
430
430
  unitId: this._context.unitId,
@@ -436,54 +436,54 @@ let et = class extends ne {
436
436
  u,
437
437
  0
438
438
  );
439
- if (!p)
439
+ if (!m)
440
440
  return !1;
441
- const m = {
441
+ const p = {
442
442
  size: {
443
- width: p.width,
444
- height: p.height
443
+ width: m.width,
444
+ height: m.height
445
445
  },
446
446
  positionH: {
447
- relativeFrom: vn.PAGE,
447
+ relativeFrom: Wn.PAGE,
448
448
  posOffset: 0
449
449
  },
450
450
  positionV: {
451
- relativeFrom: Sn.PARAGRAPH,
451
+ relativeFrom: xn.PARAGRAPH,
452
452
  posOffset: 0
453
453
  },
454
454
  angle: 0
455
- }, _ = {
455
+ }, w = {
456
456
  unitId: f.getUnitId(),
457
457
  subUnitId: f.getUnitId(),
458
458
  drawingId: r,
459
- drawingType: B.DRAWING_IMAGE,
459
+ drawingType: x.DRAWING_IMAGE,
460
460
  imageSourceType: s,
461
461
  source: o,
462
- transform: Tn(m),
463
- docTransform: m,
464
- behindDoc: Dn.FALSE,
462
+ transform: Xn(p),
463
+ docTransform: p,
464
+ behindDoc: Fn.FALSE,
465
465
  title: "",
466
466
  description: "",
467
- layoutType: Cn.INLINE,
467
+ layoutType: jn.INLINE,
468
468
  // Insert inline drawing by default.
469
- wrapText: In.BOTH_SIDES,
469
+ wrapText: Bn.BOTH_SIDES,
470
470
  distB: 0,
471
471
  distL: 0,
472
472
  distR: 0,
473
473
  distT: 0
474
- }, v = Ht.drawing.add({
474
+ }, S = hn.drawing.add({
475
475
  documentDataModel: f,
476
- drawings: [_],
476
+ drawings: [w],
477
477
  selection: {
478
478
  collapsed: !0,
479
479
  startOffset: 0,
480
480
  endOffset: 0
481
481
  }
482
482
  });
483
- return v ? (f.apply(v), this._commandService.syncExecuteCommand(bn.id, {
483
+ return S ? (f.apply(S), this._commandService.syncExecuteCommand(Ln.id, {
484
484
  value: {
485
485
  [(I = e == null ? void 0 : e.row) != null ? I : g]: {
486
- [(R = e == null ? void 0 : e.col) != null ? R : h]: {
486
+ [(D = e == null ? void 0 : e.col) != null ? D : h]: {
487
487
  p: f.getSnapshot(),
488
488
  t: 1
489
489
  }
@@ -496,12 +496,12 @@ let et = class extends ne {
496
496
  // eslint-disable-next-line max-lines-per-function
497
497
  async insertCellImageByUrl(t, e) {
498
498
  var g, h;
499
- const { width: n, height: r, image: s } = await Gt(t || "");
500
- this._imageIoService.addImageSourceCache(t, Rn.URL, s);
499
+ const { width: n, height: r, image: s } = await nn(t || "");
500
+ this._imageIoService.addImageSourceCache(t, Ce.URL, s);
501
501
  const o = this._workbookSelections.getCurrentLastSelection();
502
502
  if (!o)
503
503
  return !1;
504
- const a = Vt("", {}), d = en(
504
+ const a = un("", {}), d = _n(
505
505
  this._injector,
506
506
  {
507
507
  unitId: this._context.unitId,
@@ -521,34 +521,34 @@ let et = class extends ne {
521
521
  height: d.height
522
522
  },
523
523
  positionH: {
524
- relativeFrom: vn.PAGE,
524
+ relativeFrom: Wn.PAGE,
525
525
  posOffset: 0
526
526
  },
527
527
  positionV: {
528
- relativeFrom: Sn.PARAGRAPH,
528
+ relativeFrom: xn.PARAGRAPH,
529
529
  posOffset: 0
530
530
  },
531
531
  angle: 0
532
532
  }, c = {
533
533
  unitId: a.getUnitId(),
534
534
  subUnitId: a.getUnitId(),
535
- drawingId: Qe(),
536
- drawingType: B.DRAWING_IMAGE,
537
- imageSourceType: Rn.URL,
535
+ drawingId: Ve(),
536
+ drawingType: x.DRAWING_IMAGE,
537
+ imageSourceType: Ce.URL,
538
538
  source: t,
539
- transform: Tn(u),
539
+ transform: Xn(u),
540
540
  docTransform: u,
541
- behindDoc: Dn.FALSE,
541
+ behindDoc: Fn.FALSE,
542
542
  title: "",
543
543
  description: "",
544
- layoutType: Cn.INLINE,
544
+ layoutType: jn.INLINE,
545
545
  // Insert inline drawing by default.
546
- wrapText: In.BOTH_SIDES,
546
+ wrapText: Bn.BOTH_SIDES,
547
547
  distB: 0,
548
548
  distL: 0,
549
549
  distR: 0,
550
550
  distT: 0
551
- }, l = Ht.drawing.add({
551
+ }, l = hn.drawing.add({
552
552
  documentDataModel: a,
553
553
  drawings: [c],
554
554
  selection: {
@@ -557,7 +557,7 @@ let et = class extends ne {
557
557
  endOffset: 0
558
558
  }
559
559
  });
560
- return l ? (a.apply(l), this._commandService.syncExecuteCommand(bn.id, {
560
+ return l ? (a.apply(l), this._commandService.syncExecuteCommand(Ln.id, {
561
561
  value: {
562
562
  [(g = e == null ? void 0 : e.row) != null ? g : o.primary.actualRow]: {
563
563
  [(h = e == null ? void 0 : e.col) != null ? h : o.primary.actualColumn]: {
@@ -586,15 +586,15 @@ let et = class extends ne {
586
586
  endColumn: 0
587
587
  };
588
588
  s && s.length > 0 && (o = s[s.length - 1].range);
589
- const a = Yn(this._skeletonManagerService.getCurrent().skeleton, o);
589
+ const a = dr(this._skeletonManagerService.getCurrent().skeleton, o);
590
590
  if (a == null)
591
591
  return;
592
592
  let { startColumn: d, startRow: u, startX: c, startY: l } = a, g = !1;
593
593
  if (c + t > n && (c = n - t, c < 0 && (c = 0, t = n), g = !0), l + e > r && (l = r - e, l < 0 && (l = 0, e = r), g = !0), g) {
594
- const m = this._selectionRenderService.getCellWithCoordByOffset(c, l);
595
- if (m == null)
594
+ const p = this._selectionRenderService.getCellWithCoordByOffset(c, l);
595
+ if (p == null)
596
596
  return;
597
- c = m.startX, l = m.startY, d = m.actualColumn, u = m.actualRow;
597
+ c = p.startX, l = p.startY, d = p.actualColumn, u = p.actualRow;
598
598
  }
599
599
  const h = {
600
600
  column: d,
@@ -604,7 +604,7 @@ let et = class extends ne {
604
604
  }, f = this._selectionRenderService.getCellWithCoordByOffset(c + t, l + e);
605
605
  if (f == null)
606
606
  return;
607
- const p = {
607
+ const m = {
608
608
  column: f.actualColumn,
609
609
  columnOffset: c + t - f.startX,
610
610
  row: f.actualRow,
@@ -612,13 +612,13 @@ let et = class extends ne {
612
612
  };
613
613
  return {
614
614
  from: h,
615
- to: p
615
+ to: m
616
616
  };
617
617
  }
618
618
  _updateOrderListener() {
619
619
  this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((t) => {
620
620
  const { unitId: e, subUnitId: n, drawingIds: r, arrangeType: s } = t;
621
- this._commandService.executeCommand(fr.id, {
621
+ this._commandService.executeCommand(xr.id, {
622
622
  unitId: e,
623
623
  subUnitId: n,
624
624
  drawingIds: r,
@@ -636,16 +636,16 @@ let et = class extends ne {
636
636
  const u = this._sheetDrawingService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: o });
637
637
  if (u == null || u.unitId !== this._context.unitId)
638
638
  return;
639
- const c = $({ ...u.transform, ...d }, this._selectionRenderService);
639
+ const c = j({ ...u.transform, ...d }, this._selectionRenderService);
640
640
  if (c == null)
641
641
  return;
642
642
  const l = {
643
643
  ...n,
644
- transform: { ...u.transform, ...d, ...z(c, this._selectionRenderService, this._skeletonManagerService) },
644
+ transform: { ...u.transform, ...d, ...Z(c, this._selectionRenderService, this._skeletonManagerService) },
645
645
  sheetTransform: { ...c }
646
646
  };
647
647
  e.push(l);
648
- }), e.length > 0 && this._commandService.executeCommand(Wt.id, {
648
+ }), e.length > 0 && this._commandService.executeCommand(zt.id, {
649
649
  unitId: t[0].unitId,
650
650
  drawings: e
651
651
  }));
@@ -653,45 +653,45 @@ let et = class extends ne {
653
653
  }
654
654
  _groupDrawingListener() {
655
655
  this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((t) => {
656
- this._commandService.executeCommand(gr.id, t);
656
+ this._commandService.executeCommand(kr.id, t);
657
657
  const { unitId: e, subUnitId: n, drawingId: r } = t[0].parent;
658
- this._commandService.syncExecuteCommand(Nt.id, [{ unitId: e, subUnitId: n, drawingId: r }]);
658
+ this._commandService.syncExecuteCommand(Ht.id, [{ unitId: e, subUnitId: n, drawingId: r }]);
659
659
  })), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((t) => {
660
- this._commandService.executeCommand(mr.id, t);
660
+ this._commandService.executeCommand(Wr.id, t);
661
661
  }));
662
662
  }
663
663
  _focusDrawingListener() {
664
664
  this.disposeWithMe(
665
665
  this._drawingManagerService.focus$.subscribe((t) => {
666
- t == null || t.length === 0 ? (this._contextService.setContextValue($e, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue($e, !0), this._sheetDrawingService.focusDrawing(t));
666
+ t == null || t.length === 0 ? (this._contextService.setContextValue(Ge, !1), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(Ge, !0), this._sheetDrawingService.focusDrawing(t));
667
667
  })
668
668
  );
669
669
  }
670
670
  };
671
- et = rs([
672
- te(1, A(V)),
673
- te(2, X),
674
- te(3, xe),
675
- te(4, Ei),
676
- te(5, Pi),
677
- te(6, re),
678
- te(7, ie),
679
- te(8, Xn),
680
- te(9, cr),
681
- te(10, A(nt)),
682
- te(11, A(on)),
683
- te(12, A(Ge))
684
- ], et);
685
- const Bt = {
671
+ dt = As([
672
+ ie(1, A(X)),
673
+ ie(2, Y),
674
+ ie(3, Ze),
675
+ ie(4, ss),
676
+ ie(5, cs),
677
+ ie(6, se),
678
+ ie(7, oe),
679
+ ie(8, ur),
680
+ ie(9, Or),
681
+ ie(10, A(Te)),
682
+ ie(11, A(ut)),
683
+ ie(12, A(qe))
684
+ ], dt);
685
+ const Kt = {
686
686
  id: "sheet.command.insert-float-image",
687
- type: Z.COMMAND,
687
+ type: q.COMMAND,
688
688
  handler: async (i, t) => {
689
689
  var o, a;
690
- const e = i.get(Se), n = i.get(J), r = (o = sn(
691
- F.UNIVER_SHEET,
690
+ const e = i.get(de), n = i.get(Q), r = (o = Dn(
691
+ $.UNIVER_SHEET,
692
692
  e,
693
693
  n
694
- )) == null ? void 0 : o.with(et);
694
+ )) == null ? void 0 : o.with(dt);
695
695
  if (!r)
696
696
  return !1;
697
697
  const s = t == null ? void 0 : t.files;
@@ -701,23 +701,23 @@ const Bt = {
701
701
  } else
702
702
  return (a = r.insertFloatImage()) != null ? a : !1;
703
703
  }
704
- }, dn = {
704
+ }, Mn = {
705
705
  id: "sheet.command.insert-cell-image",
706
- type: Z.COMMAND,
706
+ type: q.COMMAND,
707
707
  handler: (i) => {
708
708
  var n, r;
709
- const t = i.get(Se), e = i.get(J);
710
- return (r = (n = sn(
711
- F.UNIVER_SHEET,
709
+ const t = i.get(de), e = i.get(Q);
710
+ return (r = (n = Dn(
711
+ $.UNIVER_SHEET,
712
712
  t,
713
713
  e
714
- )) == null ? void 0 : n.with(et).insertCellImage()) != null ? r : !1;
714
+ )) == null ? void 0 : n.with(dt).insertCellImage()) != null ? r : !1;
715
715
  }
716
- }, it = {
716
+ }, gt = {
717
717
  id: "sheet.command.move-drawing",
718
- type: Z.COMMAND,
718
+ type: q.COMMAND,
719
719
  handler: (i, t) => {
720
- const e = i.get(X), n = i.get(re), r = i.get(xe), { direction: s } = t, o = n.getFocusDrawings();
720
+ const e = i.get(Y), n = i.get(se), r = i.get(Ze), { direction: s } = t, o = n.getFocusDrawings();
721
721
  if (o.length === 0)
722
722
  return !1;
723
723
  const a = o[0].unitId, d = o.map((c) => {
@@ -725,30 +725,345 @@ const Bt = {
725
725
  if (l == null)
726
726
  return null;
727
727
  const g = { ...l }, { left: h = 0, top: f = 0 } = l;
728
- 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), {
728
+ return s === ve.UP ? g.top = f - 1 : s === ve.DOWN ? g.top = f + 1 : s === ve.LEFT ? g.left = h - 1 : s === ve.RIGHT && (g.left = h + 1), {
729
729
  ...c,
730
730
  transform: g,
731
- sheetTransform: $(g, r)
731
+ sheetTransform: j(g, r)
732
732
  };
733
733
  }).filter((c) => c != null);
734
- return e.syncExecuteCommand(Wt.id, {
734
+ return e.syncExecuteCommand(zt.id, {
735
735
  unitId: a,
736
736
  drawings: d
737
- }) ? (e.syncExecuteCommand(Y.id, [a]), !0) : !1;
737
+ }) ? (e.syncExecuteCommand(V.id, [a]), !0) : !1;
738
+ }
739
+ };
740
+ var $s = Object.getOwnPropertyDescriptor, ks = (i, t, e, n) => {
741
+ for (var r = n > 1 ? void 0 : n ? $s(t, e) : t, s = i.length - 1, o; s >= 0; s--)
742
+ (o = i[s]) && (r = o(r) || r);
743
+ return r;
744
+ }, an = (i, t) => (e, n) => t(e, n, i), ye = /* @__PURE__ */ ((i) => (i.CELL_ADDRESS = "cellAddress", i.COLUMN_VALUE = "columnValue", i))(ye || {});
745
+ const yn = pi("sheets-drawing-ui.batch-save-images.service");
746
+ function Sn(i) {
747
+ let t = "", e = i;
748
+ for (; e >= 0; )
749
+ t = String.fromCharCode(e % 26 + 65) + t, e = Math.floor(e / 26) - 1;
750
+ return t;
751
+ }
752
+ function At(i, t) {
753
+ return `${Sn(t)}${i + 1}`;
754
+ }
755
+ function xs(i) {
756
+ const t = At(i.startRow, i.startColumn), e = At(i.endRow, i.endColumn);
757
+ return t === e ? t : `${t}:${e}`;
758
+ }
759
+ function nr(i) {
760
+ var t, e, n, r;
761
+ return !!((e = (t = i == null ? void 0 : i.p) == null ? void 0 : t.drawingsOrder) != null && e.length && ((r = (n = i == null ? void 0 : i.p) == null ? void 0 : n.drawingsOrder) == null ? void 0 : r.length) > 0);
762
+ }
763
+ function rr(i) {
764
+ var n, r, s;
765
+ if (!((r = (n = i.p) == null ? void 0 : n.drawingsOrder) != null && r.length) || !((s = i.p) != null && s.drawings))
766
+ return null;
767
+ const t = i.p.drawingsOrder[0], e = i.p.drawings[t];
768
+ return !e || !("source" in e) || !("imageSourceType" in e) ? null : e;
769
+ }
770
+ function cn(i, t) {
771
+ if (t === Ce.BASE64) {
772
+ const e = i.match(/^data:image\/(\w+);/);
773
+ if (e)
774
+ return e[1] === "jpeg" ? "jpg" : e[1];
775
+ }
776
+ if (t === Ce.URL) {
777
+ const e = i.match(/\.(\w+)(?:\?|$)/);
778
+ if (e)
779
+ return e[1].toLowerCase();
780
+ }
781
+ return "png";
782
+ }
783
+ async function ir(i, t) {
784
+ if (t === Ce.BASE64)
785
+ return (await fetch(i)).blob();
786
+ if (t === Ce.URL)
787
+ return (await fetch(i)).blob();
788
+ throw new Error("UUID image type requires additional handling");
789
+ }
790
+ let vn = class extends ee {
791
+ constructor(i, t, e) {
792
+ super(), this._univerInstanceService = i, this._selectionService = t, this._imageIoService = e;
793
+ }
794
+ getCellImagesInSelection() {
795
+ const i = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
796
+ if (!i) return [];
797
+ const t = i.getActiveSheet();
798
+ if (!t) return [];
799
+ const e = this._selectionService.getCurrentSelections();
800
+ if (!e || e.length === 0) return [];
801
+ const n = t.getCellMatrix(), r = [];
802
+ for (const s of e) {
803
+ const { startRow: o, endRow: a, startColumn: d, endColumn: u } = s.range;
804
+ for (let c = o; c <= a; c++)
805
+ for (let l = d; l <= u; l++) {
806
+ const g = n.getValue(c, l);
807
+ if (nr(g)) {
808
+ const h = rr(g);
809
+ h && r.push({
810
+ row: c,
811
+ col: l,
812
+ cellAddress: At(c, l),
813
+ source: h.source,
814
+ imageSourceType: h.imageSourceType,
815
+ imageId: h.drawingId
816
+ });
817
+ }
818
+ }
819
+ }
820
+ return r;
821
+ }
822
+ getCellImagesFromRanges(i, t, e) {
823
+ const n = this._univerInstanceService.getUnit(i, $.UNIVER_SHEET);
824
+ if (!n) return [];
825
+ const r = n.getSheetBySheetId(t);
826
+ if (!r) return [];
827
+ const s = r.getCellMatrix(), o = [];
828
+ for (const a of e) {
829
+ const { startRow: d, endRow: u, startColumn: c, endColumn: l } = a;
830
+ for (let g = d; g <= u; g++)
831
+ for (let h = c; h <= l; h++) {
832
+ const f = s.getValue(g, h);
833
+ if (nr(f)) {
834
+ const m = rr(f);
835
+ m && o.push({
836
+ row: g,
837
+ col: h,
838
+ cellAddress: At(g, h),
839
+ source: m.source,
840
+ imageSourceType: m.imageSourceType,
841
+ imageId: m.drawingId
842
+ });
843
+ }
844
+ }
845
+ }
846
+ return o;
847
+ }
848
+ getDataColumns() {
849
+ var l, g, h, f;
850
+ const i = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
851
+ if (!i) return [];
852
+ const t = i.getActiveSheet();
853
+ if (!t) return [];
854
+ const e = this._selectionService.getCurrentSelections();
855
+ if (!e || e.length === 0) return [];
856
+ const n = t.getCellMatrix(), r = n.getDataRange();
857
+ let s = 1 / 0, o = -1 / 0;
858
+ const a = /* @__PURE__ */ new Set();
859
+ for (const m of e) {
860
+ s = Math.min(s, m.range.startRow), o = Math.max(o, m.range.endRow);
861
+ for (let p = m.range.startColumn; p <= m.range.endColumn; p++)
862
+ a.add(p);
863
+ }
864
+ const d = /* @__PURE__ */ new Set();
865
+ for (let m = r.startColumn; m <= r.endColumn; m++)
866
+ if (!a.has(m))
867
+ for (let p = s; p <= o; p++) {
868
+ const w = n.getValue(p, m);
869
+ if (w && (((l = w.v) == null ? void 0 : l.toString()) || ((f = (h = (g = w.p) == null ? void 0 : g.body) == null ? void 0 : h.dataStream) == null ? void 0 : f.trim()) || "")) {
870
+ d.add(m);
871
+ break;
872
+ }
873
+ }
874
+ const u = [], c = Array.from(d).sort((m, p) => m - p);
875
+ for (const m of c)
876
+ u.push({
877
+ index: m,
878
+ label: Sn(m)
879
+ });
880
+ return u;
881
+ }
882
+ getDataColumnsForRanges(i, t, e) {
883
+ var h, f, m, p;
884
+ const n = this._univerInstanceService.getUnit(i, $.UNIVER_SHEET);
885
+ if (!n) return [];
886
+ const r = n.getSheetBySheetId(t);
887
+ if (!r) return [];
888
+ const s = r.getCellMatrix(), o = s.getDataRange();
889
+ let a = 1 / 0, d = -1 / 0;
890
+ const u = /* @__PURE__ */ new Set();
891
+ for (const w of e) {
892
+ a = Math.min(a, w.startRow), d = Math.max(d, w.endRow);
893
+ for (let S = w.startColumn; S <= w.endColumn; S++)
894
+ u.add(S);
895
+ }
896
+ const c = /* @__PURE__ */ new Set();
897
+ for (let w = o.startColumn; w <= o.endColumn; w++)
898
+ if (!u.has(w))
899
+ for (let S = a; S <= d; S++) {
900
+ const I = s.getValue(S, w);
901
+ if (I && (((h = I.v) == null ? void 0 : h.toString()) || ((p = (m = (f = I.p) == null ? void 0 : f.body) == null ? void 0 : m.dataStream) == null ? void 0 : p.trim()) || "")) {
902
+ c.add(w);
903
+ break;
904
+ }
905
+ }
906
+ const l = [], g = Array.from(c).sort((w, S) => w - S);
907
+ for (const w of g)
908
+ l.push({
909
+ index: w,
910
+ label: Sn(w)
911
+ });
912
+ return l;
913
+ }
914
+ getSelectionRangeNotation() {
915
+ const i = this._selectionService.getCurrentSelections();
916
+ return !i || i.length === 0 ? "" : i.map((t) => xs(t.range)).join(", ");
917
+ }
918
+ getSelectionRowRange() {
919
+ const i = this._selectionService.getCurrentSelections();
920
+ if (!i || i.length === 0) return null;
921
+ let t = 1 / 0, e = -1 / 0;
922
+ for (const n of i)
923
+ t = Math.min(t, n.range.startRow), e = Math.max(e, n.range.endRow);
924
+ return { startRow: t, endRow: e };
738
925
  }
739
- }, pr = "COMPONENT_SHEET_DRAWING_PANEL", wr = {
926
+ getSelectionColumnIndices() {
927
+ const i = this._selectionService.getCurrentSelections();
928
+ if (!i || i.length === 0) return /* @__PURE__ */ new Set();
929
+ const t = /* @__PURE__ */ new Set();
930
+ for (const e of i)
931
+ for (let n = e.range.startColumn; n <= e.range.endColumn; n++)
932
+ t.add(n);
933
+ return t;
934
+ }
935
+ generateFileName(i, t) {
936
+ var s, o, a, d;
937
+ const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET), n = cn(i.source, i.imageSourceType), r = [];
938
+ for (const u of t.fileNameParts)
939
+ if (u === "cellAddress")
940
+ r.push(i.cellAddress);
941
+ else if (u === "columnValue" && t.columnIndex !== void 0) {
942
+ const c = e == null ? void 0 : e.getActiveSheet();
943
+ if (c) {
944
+ const g = c.getCellMatrix().getValue(i.row, t.columnIndex);
945
+ if (g) {
946
+ const h = ((s = g.v) == null ? void 0 : s.toString()) || ((d = (a = (o = g.p) == null ? void 0 : o.body) == null ? void 0 : a.dataStream) == null ? void 0 : d.trim()) || "";
947
+ if (h) {
948
+ const f = h.replace(/[<>:"/\\|?*]/g, "_").trim();
949
+ f && r.push(f);
950
+ }
951
+ }
952
+ }
953
+ }
954
+ return r.length === 0 ? `${i.cellAddress}.${n}` : `${r.join("_")}.${n}`;
955
+ }
956
+ generateFileNameWithContext(i, t, e, n) {
957
+ var a, d, u, c;
958
+ const r = this._univerInstanceService.getUnit(e, $.UNIVER_SHEET), s = cn(i.source, i.imageSourceType), o = [];
959
+ for (const l of t.fileNameParts)
960
+ if (l === "cellAddress")
961
+ o.push(i.cellAddress);
962
+ else if (l === "columnValue" && t.columnIndex !== void 0) {
963
+ const g = r == null ? void 0 : r.getSheetBySheetId(n);
964
+ if (g) {
965
+ const f = g.getCellMatrix().getValue(i.row, t.columnIndex);
966
+ if (f) {
967
+ const m = ((a = f.v) == null ? void 0 : a.toString()) || ((c = (u = (d = f.p) == null ? void 0 : d.body) == null ? void 0 : u.dataStream) == null ? void 0 : c.trim()) || "";
968
+ if (m) {
969
+ const p = m.replace(/[<>:"/\\|?*]/g, "_").trim();
970
+ p && o.push(p);
971
+ }
972
+ }
973
+ }
974
+ }
975
+ return o.length === 0 ? `${i.cellAddress}.${s}` : `${o.join("_")}.${s}`;
976
+ }
977
+ async saveImages(i, t) {
978
+ var r;
979
+ const e = await window.showDirectoryPicker({ mode: "readwrite" }), n = /* @__PURE__ */ new Map();
980
+ for (const s of i) {
981
+ let o = this.generateFileName(s, t);
982
+ const a = o.replace(/\.\w+$/, ""), d = ((r = o.match(/\.\w+$/)) == null ? void 0 : r[0]) || ".png", u = n.get(a) || 0;
983
+ u > 0 && (o = `${a}_${u}${d}`), n.set(a, u + 1);
984
+ try {
985
+ const c = await this._getImageBlob(s), g = await (await e.getFileHandle(o, { create: !0 })).createWritable();
986
+ await g.write(c), await g.close();
987
+ } catch (c) {
988
+ throw console.error(`Failed to save image ${o}:`, c), c;
989
+ }
990
+ }
991
+ }
992
+ async saveImagesWithContext(i, t, e, n) {
993
+ var o;
994
+ const r = await window.showDirectoryPicker({ mode: "readwrite" }), s = /* @__PURE__ */ new Map();
995
+ for (const a of i) {
996
+ let d = this.generateFileNameWithContext(a, t, e, n);
997
+ const u = d.replace(/\.\w+$/, ""), c = ((o = d.match(/\.\w+$/)) == null ? void 0 : o[0]) || ".png", l = s.get(u) || 0;
998
+ l > 0 && (d = `${u}_${l}${c}`), s.set(u, l + 1);
999
+ try {
1000
+ const g = await this._getImageBlob(a), f = await (await r.getFileHandle(d, { create: !0 })).createWritable();
1001
+ await f.write(g), await f.close();
1002
+ } catch (g) {
1003
+ throw console.error(`Failed to save image ${d}:`, g), g;
1004
+ }
1005
+ }
1006
+ }
1007
+ async downloadSingleImage(i) {
1008
+ const t = cn(i.source, i.imageSourceType), e = `${i.cellAddress}.${t}`;
1009
+ try {
1010
+ const n = await this._getImageBlob(i), r = URL.createObjectURL(n), s = document.createElement("a");
1011
+ s.href = r, s.download = e, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(r);
1012
+ } catch (n) {
1013
+ throw console.error(`Failed to download image ${e}:`, n), n;
1014
+ }
1015
+ }
1016
+ async _getImageBlob(i) {
1017
+ if (i.imageSourceType === Ce.UUID) {
1018
+ const t = await this._imageIoService.getImage(i.source);
1019
+ return ir(t, Ce.URL);
1020
+ }
1021
+ return ir(i.source, i.imageSourceType);
1022
+ }
1023
+ };
1024
+ vn = ks([
1025
+ an(0, de),
1026
+ an(1, A(ut)),
1027
+ an(2, hr)
1028
+ ], vn);
1029
+ const ze = "sheet.dialog.batch-save-images", ct = {
1030
+ id: "sheet.command.save-cell-images",
1031
+ type: q.COMMAND,
1032
+ handler: async (i) => {
1033
+ const t = i.get(bn), e = i.get(yn), n = e.getCellImagesInSelection();
1034
+ if (n.length === 1)
1035
+ try {
1036
+ return await e.downloadSingleImage(n[0]), !0;
1037
+ } catch (a) {
1038
+ return console.error("Failed to download image:", a), !1;
1039
+ }
1040
+ const r = i.get(Te), s = e.getSelectionRangeNotation(), o = `${r.t("sheetImage.save.title")} (${s})`;
1041
+ return t.open({
1042
+ id: ze,
1043
+ draggable: !0,
1044
+ width: 360,
1045
+ title: { title: o },
1046
+ children: {
1047
+ label: ze
1048
+ },
1049
+ destroyOnClose: !0,
1050
+ preservePositionOnDestroy: !0,
1051
+ onClose: () => t.close(ze)
1052
+ }), !0;
1053
+ }
1054
+ }, Br = "COMPONENT_SHEET_DRAWING_PANEL", jr = {
740
1055
  id: "sidebar.operation.sheet-image",
741
- type: Z.COMMAND,
1056
+ type: q.COMMAND,
742
1057
  handler: async (i, t) => {
743
- const e = i.get(Ai), n = i.get(nt), r = i.get(Se), s = i.get(X);
744
- if (!se(r)) return !1;
1058
+ const e = i.get(ds), n = i.get(Te), r = i.get(de), s = i.get(Y);
1059
+ if (!ae(r)) return !1;
745
1060
  switch (t.value) {
746
1061
  case "open":
747
1062
  e.open({
748
1063
  header: { title: n.t("sheetImage.panel.title") },
749
- children: { label: pr },
1064
+ children: { label: Br },
750
1065
  onClose: () => {
751
- s.syncExecuteCommand(Nt.id, []);
1066
+ s.syncExecuteCommand(Ht.id, []);
752
1067
  },
753
1068
  width: 360
754
1069
  });
@@ -760,27 +1075,27 @@ const Bt = {
760
1075
  }
761
1076
  return !0;
762
1077
  }
763
- }, _r = {
1078
+ }, Fr = {
764
1079
  id: "sheet.operation.edit-sheet-image",
765
- type: Z.OPERATION,
1080
+ type: q.OPERATION,
766
1081
  handler: (i, t) => {
767
- const e = i.get(X);
768
- return t == null ? !1 : (e.syncExecuteCommand(Nt.id, [t]), e.executeCommand(wr.id, { value: "open" }), !0);
1082
+ const e = i.get(Y);
1083
+ return t == null ? !1 : (e.syncExecuteCommand(Ht.id, [t]), e.executeCommand(jr.id, { value: "open" }), !0);
769
1084
  }
770
- }, ss = "sheets-drawing-ui.config", jn = {};
771
- var os = Object.getOwnPropertyDescriptor, as = (i, t, e, n) => {
772
- for (var r = n > 1 ? void 0 : n ? os(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1085
+ }, Ws = "sheets-drawing-ui.config", sr = {};
1086
+ var Bs = Object.getOwnPropertyDescriptor, js = (i, t, e, n) => {
1087
+ for (var r = n > 1 ? void 0 : n ? Bs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
773
1088
  (o = i[s]) && (r = o(r) || r);
774
1089
  return r;
775
1090
  }, ce = (i, t) => (e, n) => t(e, n, i);
776
- let Rt = class extends Xr {
1091
+ let Nt = class extends wi {
777
1092
  constructor(t, e, n, r, s, o, a, d, u, c) {
778
1093
  super();
779
- ee(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
1094
+ re(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
780
1095
  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();
781
1096
  }
782
1097
  _init() {
783
- 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();
1098
+ this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET).pipe(Qn(this.dispose$)).subscribe((t) => this._create(t)), this._univerInstanceService.getTypeOfUnitDisposed$($.UNIVER_SHEET).pipe(Qn(this.dispose$)).subscribe((t) => this._dispose(t)), this._univerInstanceService.getAllUnitsForType($.UNIVER_SHEET).forEach((t) => this._create(t)), this._setupLoadingStatus();
784
1099
  }
785
1100
  _setupLoadingStatus() {
786
1101
  const t = "image-upload-loading";
@@ -788,7 +1103,7 @@ let Rt = class extends Xr {
788
1103
  this.disposeWithMe(this._ioService.change$.subscribe((n) => {
789
1104
  n > 0 && !e ? e = this._messageService.show({
790
1105
  id: t,
791
- type: pe.Loading,
1106
+ type: Se.Loading,
792
1107
  content: `${this._localeService.t("uploadLoading.loading")}: ${n}`,
793
1108
  duration: 0
794
1109
  }) : n === 0 && (e == null || e.dispose(), e = void 0);
@@ -808,7 +1123,7 @@ let Rt = class extends Xr {
808
1123
  _hasCropObject(t) {
809
1124
  const e = t.getAllObjectsByOrder();
810
1125
  for (const n of e)
811
- if (n instanceof Xi)
1126
+ if (n instanceof Ss)
812
1127
  return !0;
813
1128
  return !1;
814
1129
  }
@@ -823,7 +1138,7 @@ let Rt = class extends Xr {
823
1138
  let r;
824
1139
  this.disposeWithMe(
825
1140
  n.createControl$.subscribe(() => {
826
- if (this._contextService.setContextValue($e, !0), this._hasCropObject(e))
1141
+ if (this._contextService.setContextValue(Ge, !0), this._hasCropObject(e))
827
1142
  return;
828
1143
  const o = n.getSelectedObjectMap();
829
1144
  if (o.size > 1) {
@@ -840,23 +1155,23 @@ let Rt = class extends Xr {
840
1155
  if (f && f.disablePopup)
841
1156
  return;
842
1157
  r == null || r.dispose();
843
- const p = this._canvasPopManagerService.getFeatureMenu(c, l, g, h);
1158
+ const m = this._canvasPopManagerService.getFeatureMenu(c, l, g, h);
844
1159
  r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(a, {
845
- componentKey: Li,
1160
+ componentKey: vs,
846
1161
  direction: "horizontal",
847
1162
  offset: [2, 0],
848
1163
  extraProps: {
849
- menuItems: p || this._getImageMenuItems(c, l, g, h)
1164
+ menuItems: m || this._getImageMenuItems(c, l, g, h)
850
1165
  }
851
1166
  }));
852
1167
  })
853
1168
  ), this.disposeWithMe(
854
1169
  n.clearControl$.subscribe(() => {
855
- r == null || r.dispose(), this._contextService.setContextValue($e, !1), this._commandService.syncExecuteCommand(Nt.id, []);
1170
+ r == null || r.dispose(), this._contextService.setContextValue(Ge, !1), this._commandService.syncExecuteCommand(Ht.id, []);
856
1171
  })
857
1172
  ), this.disposeWithMe(
858
1173
  this._contextService.contextChanged$.subscribe((o) => {
859
- o[$e] === !1 && (r == null || r.dispose());
1174
+ o[Ge] === !1 && (r == null || r.dispose());
860
1175
  })
861
1176
  ), this.disposeWithMe(
862
1177
  n.changing$.subscribe(() => {
@@ -869,62 +1184,62 @@ let Rt = class extends Xr {
869
1184
  {
870
1185
  label: "image-popup.edit",
871
1186
  index: 0,
872
- commandId: _r.id,
1187
+ commandId: Fr.id,
873
1188
  commandParams: { unitId: t, subUnitId: e, drawingId: n },
874
- disable: r === B.DRAWING_DOM
1189
+ disable: r === x.DRAWING_DOM
875
1190
  },
876
1191
  {
877
1192
  label: "image-popup.delete",
878
1193
  index: 1,
879
- commandId: rt.id,
1194
+ commandId: ht.id,
880
1195
  commandParams: { unitId: t, drawings: [{ unitId: t, subUnitId: e, drawingId: n }] },
881
1196
  disable: !1
882
1197
  },
883
1198
  {
884
1199
  label: "image-popup.crop",
885
1200
  index: 2,
886
- commandId: Vi.id,
1201
+ commandId: Is.id,
887
1202
  commandParams: { unitId: t, subUnitId: e, drawingId: n },
888
- disable: r === B.DRAWING_DOM
1203
+ disable: r === x.DRAWING_DOM
889
1204
  },
890
1205
  {
891
1206
  label: "image-popup.reset",
892
1207
  index: 3,
893
- commandId: Hi.id,
1208
+ commandId: Cs.id,
894
1209
  commandParams: [{ unitId: t, subUnitId: e, drawingId: n }],
895
- disable: r === B.DRAWING_DOM
1210
+ disable: r === x.DRAWING_DOM
896
1211
  }
897
1212
  ];
898
1213
  }
899
1214
  };
900
- Rt = as([
901
- ce(0, A(Ge)),
902
- ce(1, A(nt)),
903
- ce(2, ie),
904
- ce(3, A(Ar)),
905
- ce(4, J),
906
- ce(5, Se),
907
- ce(6, cr),
908
- ce(7, Xn),
909
- ce(8, Gr),
910
- ce(9, X)
911
- ], Rt);
912
- var cs = Object.getOwnPropertyDescriptor, ds = (i, t, e, n) => {
913
- for (var r = n > 1 ? void 0 : n ? cs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1215
+ Nt = js([
1216
+ ce(0, A(qe)),
1217
+ ce(1, A(Te)),
1218
+ ce(2, oe),
1219
+ ce(3, A(si)),
1220
+ ce(4, Q),
1221
+ ce(5, de),
1222
+ ce(6, Or),
1223
+ ce(7, ur),
1224
+ ce(8, hr),
1225
+ ce(9, Y)
1226
+ ], Nt);
1227
+ var Fs = Object.getOwnPropertyDescriptor, Ls = (i, t, e, n) => {
1228
+ for (var r = n > 1 ? void 0 : n ? Fs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
914
1229
  (o = i[s]) && (r = o(r) || r);
915
1230
  return r;
916
- }, vt = (i, t) => (e, n) => t(e, n, i);
917
- let tn = class extends ne {
1231
+ }, Tt = (i, t) => (e, n) => t(e, n, i);
1232
+ let In = class extends ee {
918
1233
  constructor(t, e, n, r, s) {
919
1234
  super();
920
- ee(this, "_isSetCursor", !1);
1235
+ re(this, "_isSetCursor", !1);
921
1236
  this._context = t, this._hoverManagerService = e, this._selectionsService = n, this._drawingRenderService = r, this._sheetSkeletonManagerService = s, this._initHover(), this._initImageClick();
922
1237
  }
923
1238
  _initHover() {
924
- this.disposeWithMe(this._hoverManagerService.currentRichTextNoDistinct$.pipe(Ji(33)).subscribe((t) => {
1239
+ this.disposeWithMe(this._hoverManagerService.currentRichTextNoDistinct$.pipe(bs(33)).subscribe((t) => {
925
1240
  var n, r;
926
1241
  let e = [];
927
- 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(Ur.ZOOM_IN)) : this._isSetCursor && (this._isSetCursor = !1, this._context.scene.resetCursor());
1242
+ t !== null && (e = this._selectionsService.getWorkbookSelections(this._context.unitId).getCurrentSelections()), e.length > 0 && (t == null ? void 0 : t.unitId) === this._context.unitId && (t != null && t.drawing) && e.length === 1 && ((n = e[0].primary) == null ? void 0 : n.actualRow) === t.row && ((r = e[0].primary) == null ? void 0 : r.actualColumn) === t.col ? (this._isSetCursor = !0, this._context.scene.setCursor(ri.ZOOM_IN)) : this._isSetCursor && (this._isSetCursor = !1, this._context.scene.resetCursor());
928
1243
  }));
929
1244
  }
930
1245
  _initImageClick() {
@@ -938,18 +1253,18 @@ let tn = class extends ne {
938
1253
  }));
939
1254
  }
940
1255
  };
941
- tn = ds([
942
- vt(1, A(Nr)),
943
- vt(2, A(on)),
944
- vt(3, A(lr)),
945
- vt(4, A(V))
946
- ], tn);
947
- var ls = Object.getOwnPropertyDescriptor, us = (i, t, e, n) => {
948
- for (var r = n > 1 ? void 0 : n ? ls(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1256
+ In = Ls([
1257
+ Tt(1, A(oi)),
1258
+ Tt(2, A(ut)),
1259
+ Tt(3, A(Pr)),
1260
+ Tt(4, A(X))
1261
+ ], In);
1262
+ var Vs = Object.getOwnPropertyDescriptor, Hs = (i, t, e, n) => {
1263
+ for (var r = n > 1 ? void 0 : n ? Vs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
949
1264
  (o = i[s]) && (r = o(r) || r);
950
1265
  return r;
951
- }, It = (i, t) => (e, n) => t(e, n, i);
952
- let nn = class extends ne {
1266
+ }, Ot = (i, t) => (e, n) => t(e, n, i);
1267
+ let Cn = class extends ee {
953
1268
  constructor(i, t, e, n, r) {
954
1269
  super(), this._context = i, this._sheetDrawingService = t, this._drawingManagerService = e, this._sheetSelectionRenderService = n, this._sheetSkeletonManagerService = r, this._init();
955
1270
  }
@@ -963,27 +1278,27 @@ let nn = class extends ne {
963
1278
  const e = i[t];
964
1279
  for (const n in e.data) {
965
1280
  const r = e.data[n];
966
- r.sheetTransform && (r.transform = z(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService));
1281
+ r.sheetTransform && (r.transform = Z(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService));
967
1282
  }
968
1283
  }
969
1284
  this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
970
1285
  }
971
1286
  };
972
- nn = us([
973
- It(1, re),
974
- It(2, ie),
975
- It(3, A(xe)),
976
- It(4, A(V))
977
- ], nn);
978
- var hs = Object.getOwnPropertyDescriptor, gs = (i, t, e, n) => {
979
- for (var r = n > 1 ? void 0 : n ? hs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1287
+ Cn = Hs([
1288
+ Ot(1, se),
1289
+ Ot(2, oe),
1290
+ Ot(3, A(Ze)),
1291
+ Ot(4, A(X))
1292
+ ], Cn);
1293
+ var Ys = Object.getOwnPropertyDescriptor, Gs = (i, t, e, n) => {
1294
+ for (var r = n > 1 ? void 0 : n ? Ys(t, e) : t, s = i.length - 1, o; s >= 0; s--)
980
1295
  (o = i[s]) && (r = o(r) || r);
981
1296
  return r;
982
- }, Ae = (i, t) => (e, n) => t(e, n, i);
983
- function Sr(i, t, e) {
1297
+ }, We = (i, t) => (e, n) => t(e, n, i);
1298
+ function Lr(i, t, e) {
984
1299
  var n, r, s, o;
985
1300
  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) {
986
- const a = e.p.drawings[e.p.drawingsOrder[0]], d = en(
1301
+ const a = e.p.drawings[e.p.drawingsOrder[0]], d = _n(
987
1302
  i,
988
1303
  {
989
1304
  unitId: t.unitId,
@@ -1000,47 +1315,47 @@ function Sr(i, t, e) {
1000
1315
  }
1001
1316
  return !1;
1002
1317
  }
1003
- let bt = class extends ne {
1318
+ let $t = class extends ee {
1004
1319
  constructor(i, t, e, n, r, s) {
1005
1320
  super(), this._commandService = i, this._sheetInterceptorService = t, this._injector = e, this._drawingManagerService = n, this._docDrawingController = r, this._editorBridgeService = s, this._handleInitEditor(), this._initCellContentInterceptor();
1006
1321
  }
1007
1322
  _handleInitEditor() {
1008
1323
  this.disposeWithMe(this._editorBridgeService.visible$.subscribe((i) => {
1009
- i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(Ze), this._docDrawingController.loadDrawingDataForUnit(Ze), this._drawingManagerService.initializeNotification(Ze)) : this._drawingManagerService.removeDrawingDataForUnit(Ze);
1324
+ i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(ot), this._docDrawingController.loadDrawingDataForUnit(ot), this._drawingManagerService.initializeNotification(ot)) : this._drawingManagerService.removeDrawingDataForUnit(ot);
1010
1325
  })), this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
1011
- i.id === yi.id && i.params.unitId === Be && (this._drawingManagerService.removeDrawingDataForUnit(Be), this._docDrawingController.loadDrawingDataForUnit(Be), this._drawingManagerService.initializeNotification(Be));
1326
+ i.id === rs.id && i.params.unitId === He && (this._drawingManagerService.removeDrawingDataForUnit(He), this._docDrawingController.loadDrawingDataForUnit(He), this._drawingManagerService.initializeNotification(He));
1012
1327
  }));
1013
1328
  }
1014
1329
  _initCellContentInterceptor() {
1015
1330
  this.disposeWithMe(
1016
1331
  this._sheetInterceptorService.intercept(
1017
- li.CELL_CONTENT,
1332
+ xi.CELL_CONTENT,
1018
1333
  {
1019
- effect: Lr.Style,
1020
- priority: ui.CELL_IMAGE,
1334
+ effect: _i.Style,
1335
+ priority: Wi.CELL_IMAGE,
1021
1336
  handler: (i, t, e) => {
1022
1337
  var n;
1023
- 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);
1338
+ 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 }, Lr(this._injector, { unitId: t.unitId, subUnitId: t.subUnitId, row: t.row, col: t.col }, i)), e(i);
1024
1339
  }
1025
1340
  }
1026
1341
  )
1027
1342
  );
1028
1343
  }
1029
1344
  };
1030
- bt = gs([
1031
- Ae(0, X),
1032
- Ae(1, A(At)),
1033
- Ae(2, A(Ge)),
1034
- Ae(3, ie),
1035
- Ae(4, A(Yi)),
1036
- Ae(5, A(kr))
1037
- ], bt);
1038
- var fs = Object.getOwnPropertyDescriptor, ms = (i, t, e, n) => {
1039
- for (var r = n > 1 ? void 0 : n ? fs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1345
+ $t = Gs([
1346
+ We(0, Y),
1347
+ We(1, A(Vt)),
1348
+ We(2, A(qe)),
1349
+ We(3, oe),
1350
+ We(4, A(ws)),
1351
+ We(5, A(ai))
1352
+ ], $t);
1353
+ var Xs = Object.getOwnPropertyDescriptor, zs = (i, t, e, n) => {
1354
+ for (var r = n > 1 ? void 0 : n ? Xs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1040
1355
  (o = i[s]) && (r = o(r) || r);
1041
1356
  return r;
1042
- }, $n = (i, t) => (e, n) => t(e, n, i);
1043
- let Mt = class extends ne {
1357
+ }, or = (i, t) => (e, n) => t(e, n, i);
1358
+ let kt = class extends ee {
1044
1359
  constructor(i, t) {
1045
1360
  super(), this._autoFillService = i, this._injector = t, this._initAutoFillHooks();
1046
1361
  }
@@ -1049,35 +1364,35 @@ let Mt = class extends ne {
1049
1364
  this._autoFillService.addHook({
1050
1365
  id: "sheet-cell-image-autofill",
1051
1366
  onBeforeSubmit: (i, t, e, n) => {
1052
- new Vr(n).forValue((r, s, o) => {
1053
- Sr(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
1367
+ new Si(n).forValue((r, s, o) => {
1368
+ Lr(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
1054
1369
  });
1055
1370
  }
1056
1371
  })
1057
1372
  );
1058
1373
  }
1059
1374
  };
1060
- Mt = ms([
1061
- $n(0, A(Wr)),
1062
- $n(1, A(Ge))
1063
- ], Mt);
1064
- var ps = Object.getOwnPropertyDescriptor, ws = (i, t, e, n) => {
1065
- for (var r = n > 1 ? void 0 : n ? ps(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1375
+ kt = zs([
1376
+ or(0, A(ci)),
1377
+ or(1, A(qe))
1378
+ ], kt);
1379
+ var Ks = Object.getOwnPropertyDescriptor, Zs = (i, t, e, n) => {
1380
+ for (var r = n > 1 ? void 0 : n ? Ks(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1066
1381
  (o = i[s]) && (r = o(r) || r);
1067
1382
  return r;
1068
- }, He = (i, t) => (e, n) => t(e, n, i);
1069
- const _s = [
1070
- Ze,
1071
- Hr,
1072
- Be
1383
+ }, nt = (i, t) => (e, n) => t(e, n, i);
1384
+ const Js = [
1385
+ ot,
1386
+ vi,
1387
+ He
1073
1388
  ];
1074
- let yt = class extends ne {
1389
+ let xt = class extends ee {
1075
1390
  constructor(i, t, e, n, r) {
1076
1391
  super(), this._commandService = i, this._univerInstanceService = t, this._dialogService = e, this._renderManagerService = n, this._localeService = r, this._initDocImageCopyPasteHooks();
1077
1392
  }
1078
1393
  _setCellImage(i) {
1079
1394
  var r;
1080
- const t = Vt("", {}), e = (r = sn(F.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.with(Br), n = Ht.drawing.add({
1395
+ const t = un("", {}), e = (r = Dn($.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService)) == null ? void 0 : r.with(di), n = hn.drawing.add({
1081
1396
  documentDataModel: t,
1082
1397
  drawings: [i],
1083
1398
  selection: {
@@ -1092,20 +1407,20 @@ let yt = class extends ne {
1092
1407
  this.disposeWithMe(
1093
1408
  this._commandService.beforeCommandExecuted((i) => {
1094
1409
  var t, e;
1095
- if (i.id === Ti.id) {
1096
- const n = i.params, { doc: r } = n, s = this._univerInstanceService.getCurrentUnitOfType(F.UNIVER_DOC);
1410
+ if (i.id === is.id) {
1411
+ const n = i.params, { doc: r } = n, s = this._univerInstanceService.getCurrentUnitOfType($.UNIVER_DOC);
1097
1412
  if (s == null || !Object.keys((t = r.drawings) != null ? t : {}).length)
1098
1413
  return;
1099
1414
  const o = s.getUnitId();
1100
- if (_s.includes(o)) {
1101
- if (o !== Be) {
1415
+ if (Js.includes(o)) {
1416
+ if (o !== He) {
1102
1417
  const a = () => {
1103
- this._dialogService.close("sheet-cell-image-copy-paste"), this._commandService.syncExecuteCommand(pn.id, {
1418
+ this._dialogService.close("sheet-cell-image-copy-paste"), this._commandService.syncExecuteCommand(Nn.id, {
1104
1419
  visible: !1
1105
1420
  });
1106
1421
  };
1107
1422
  ((e = s.getBody()) == null ? void 0 : e.dataStream) === `\r
1108
- ` ? (this._commandService.syncExecuteCommand(pn.id, {
1423
+ ` ? (this._commandService.syncExecuteCommand(Nn.id, {
1109
1424
  visible: !1
1110
1425
  }), this._setCellImage(Object.values(r.drawings)[0])) : this._dialogService.open({
1111
1426
  id: "sheet-cell-image-copy-paste",
@@ -1133,32 +1448,32 @@ let yt = class extends ne {
1133
1448
  );
1134
1449
  }
1135
1450
  };
1136
- yt = ws([
1137
- He(0, X),
1138
- He(1, Se),
1139
- He(2, Ni),
1140
- He(3, J),
1141
- He(4, A(nt))
1142
- ], yt);
1143
- var Ss = Object.getOwnPropertyDescriptor, vs = (i, t, e, n) => {
1144
- for (var r = n > 1 ? void 0 : n ? Ss(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1451
+ xt = Zs([
1452
+ nt(0, Y),
1453
+ nt(1, de),
1454
+ nt(2, bn),
1455
+ nt(3, Q),
1456
+ nt(4, A(Te))
1457
+ ], xt);
1458
+ var qs = Object.getOwnPropertyDescriptor, Qs = (i, t, e, n) => {
1459
+ for (var r = n > 1 ? void 0 : n ? qs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1145
1460
  (o = i[s]) && (r = o(r) || r);
1146
1461
  return r;
1147
- }, ze = (i, t) => (e, n) => t(e, n, i);
1148
- const vr = "image/png";
1149
- function Is(i) {
1462
+ }, rt = (i, t) => (e, n) => t(e, n, i);
1463
+ const Vr = "image/png";
1464
+ function eo(i) {
1150
1465
  const t = i.split(","), e = atob(t[1]), n = e.length, r = new Uint8Array(n);
1151
1466
  for (let s = 0; s < n; s++)
1152
1467
  r[s] = e.charCodeAt(s);
1153
- return new Blob([r], { type: vr });
1468
+ return new Blob([r], { type: Vr });
1154
1469
  }
1155
- function Cs(i) {
1156
- const t = new ClipboardItem({ [vr]: Is(i) });
1470
+ function to(i) {
1471
+ const t = new ClipboardItem({ [Vr]: eo(i) });
1157
1472
  navigator.clipboard.write([t]).catch((e) => {
1158
1473
  console.error("Could not copy image using clipboard API: ", e);
1159
1474
  });
1160
1475
  }
1161
- function Ds() {
1476
+ function no() {
1162
1477
  function i() {
1163
1478
  const n = document.createElement("input");
1164
1479
  return n.style.position = "absolute", n.style.height = "1px", n.style.width = "1px", n.style.opacity = "0", n;
@@ -1168,16 +1483,16 @@ function Ds() {
1168
1483
  e.blur(), document.body.removeChild(e), t instanceof HTMLElement && t.focus();
1169
1484
  };
1170
1485
  }
1171
- const Fn = [
1172
- We.SPECIAL_PASTE_COL_WIDTH,
1173
- We.SPECIAL_PASTE_VALUE,
1174
- We.SPECIAL_PASTE_FORMAT,
1175
- We.SPECIAL_PASTE_FORMULA
1486
+ const ar = [
1487
+ Le.SPECIAL_PASTE_COL_WIDTH,
1488
+ Le.SPECIAL_PASTE_VALUE,
1489
+ Le.SPECIAL_PASTE_FORMAT,
1490
+ Le.SPECIAL_PASTE_FORMULA
1176
1491
  ];
1177
- let Tt = class extends ne {
1492
+ let Wt = class extends ee {
1178
1493
  constructor(t, e, n, r, s) {
1179
1494
  super();
1180
- ee(this, "_copyInfo");
1495
+ re(this, "_copyInfo");
1181
1496
  this._sheetClipboardService = t, this._renderManagerService = e, this._drawingService = n, this._clipboardInterfaceService = r, this._commandService = s, this._initCopyPaste();
1182
1497
  }
1183
1498
  get _focusedDrawings() {
@@ -1192,18 +1507,18 @@ let Tt = class extends ne {
1192
1507
  const s = this._focusedDrawings;
1193
1508
  if (s.length > 0) {
1194
1509
  const [o] = s;
1195
- if (o.drawingType !== B.DRAWING_IMAGE)
1510
+ if (o.drawingType !== x.DRAWING_IMAGE)
1196
1511
  return;
1197
- if (r === ve.CUT) {
1512
+ if (r === Re.CUT) {
1198
1513
  const d = {
1199
1514
  unitId: t,
1200
1515
  drawings: [o]
1201
1516
  };
1202
- this._commandService.executeCommand(rt.id, d);
1517
+ this._commandService.executeCommand(ht.id, d);
1203
1518
  }
1204
1519
  setTimeout(() => {
1205
- const d = Ds();
1206
- o.drawingType === B.DRAWING_IMAGE && o.imageSourceType === Oi.BASE64 ? Cs(o.source) : this._clipboardInterfaceService.writeText(""), d();
1520
+ const d = no();
1521
+ o.drawingType === x.DRAWING_IMAGE && o.imageSourceType === os.BASE64 ? to(o.source) : this._clipboardInterfaceService.writeText(""), d();
1207
1522
  }, 200);
1208
1523
  const a = {
1209
1524
  unitId: o.unitId,
@@ -1219,14 +1534,14 @@ let Tt = class extends ne {
1219
1534
  onPasteCells: (t, e, n, r) => {
1220
1535
  if (!this._copyInfo)
1221
1536
  return { redos: [], undos: [] };
1222
- const { copyType: s = ve.COPY, pasteType: o } = r, { range: a } = t || {}, { range: d, unitId: u, subUnitId: c } = e;
1223
- return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: c, pasteRange: d }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo: e, pasteType: o }, ve.COPY);
1537
+ const { copyType: s = Re.COPY, pasteType: o } = r, { range: a } = t || {}, { range: d, unitId: u, subUnitId: c } = e;
1538
+ return this._copyInfo.copyRange ? this._generateRangeDrawingsPasteMutations({ pasteType: o, unitId: u, subUnitId: c, pasteRange: d }, { copyRange: a, copyType: s }) : this._generateSingleDrawingPasteMutations({ pasteTo: e, pasteType: o }, Re.COPY);
1224
1539
  },
1225
1540
  onPastePlainText: (t, e) => ({ undos: [], redos: [] }),
1226
- onPasteUnrecognized: (t) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: We.DEFAULT_PASTE }, ve.COPY) : { undos: [], redos: [] },
1541
+ onPasteUnrecognized: (t) => this._copyInfo ? this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: Le.DEFAULT_PASTE }, Re.COPY) : { undos: [], redos: [] },
1227
1542
  onPasteFiles: (t, e) => {
1228
1543
  if (this._copyInfo)
1229
- return this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: We.DEFAULT_PASTE }, ve.COPY);
1544
+ return this._generateSingleDrawingPasteMutations({ pasteTo: t, pasteType: Le.DEFAULT_PASTE }, Re.COPY);
1230
1545
  {
1231
1546
  const n = e.filter((r) => r.type.includes("image"));
1232
1547
  if (n.length)
@@ -1234,7 +1549,7 @@ let Tt = class extends ne {
1234
1549
  undos: [],
1235
1550
  redos: [
1236
1551
  {
1237
- id: Bt.id,
1552
+ id: Kt.id,
1238
1553
  params: { files: n }
1239
1554
  }
1240
1555
  ]
@@ -1246,7 +1561,7 @@ let Tt = class extends ne {
1246
1561
  }
1247
1562
  _createDrawingsCopyInfoByRange(t, e, n) {
1248
1563
  var g;
1249
- const r = (g = this._renderManagerService.getRenderById(t)) == null ? void 0 : g.with(V);
1564
+ const r = (g = this._renderManagerService.getRenderById(t)) == null ? void 0 : g.with(X);
1250
1565
  if (!r) return;
1251
1566
  const s = r.attachRangeWithCoord(n);
1252
1567
  if (!s)
@@ -1254,18 +1569,18 @@ let Tt = class extends ne {
1254
1569
  const { startX: o, endX: a, startY: d, endY: u } = s, c = this._drawingService.getDrawingData(t, e), l = this._focusedDrawings.slice();
1255
1570
  if (Object.keys(c).forEach((h) => {
1256
1571
  const f = c[h];
1257
- if (f.drawingType !== B.DRAWING_IMAGE)
1572
+ if (f.drawingType !== x.DRAWING_IMAGE)
1258
1573
  return;
1259
- const { transform: p } = f;
1260
- if (f.anchorType !== O.Both || !p)
1574
+ const { transform: m } = f;
1575
+ if (f.anchorType !== O.Both || !m)
1261
1576
  return;
1262
- const { left: m = 0, top: _ = 0, width: v = 0, height: I = 0 } = p, { drawingStartX: R, drawingEndX: S, drawingStartY: C, drawingEndY: w } = {
1263
- drawingStartX: m,
1264
- drawingEndX: m + v,
1265
- drawingStartY: _,
1266
- drawingEndY: _ + I
1577
+ const { left: p = 0, top: w = 0, width: S = 0, height: I = 0 } = m, { drawingStartX: D, drawingEndX: v, drawingStartY: C, drawingEndY: _ } = {
1578
+ drawingStartX: p,
1579
+ drawingEndX: p + S,
1580
+ drawingStartY: w,
1581
+ drawingEndY: w + I
1267
1582
  };
1268
- o <= R && S <= a && d <= C && w <= u && l.push(f);
1583
+ o <= D && v <= a && d <= C && _ <= u && l.push(f);
1269
1584
  }), l.length)
1270
1585
  return {
1271
1586
  copyRange: n,
@@ -1276,31 +1591,31 @@ let Tt = class extends ne {
1276
1591
  }
1277
1592
  _generateSingleDrawingPasteMutations(t, e) {
1278
1593
  const { pasteType: n, pasteTo: r } = t;
1279
- if (Fn.includes(n))
1594
+ if (ar.includes(n))
1280
1595
  return { redos: [], undos: [] };
1281
- 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;
1596
+ const { unitId: s, subUnitId: o, range: a } = r, d = this._renderManagerService.getRenderById(s), u = d == null ? void 0 : d.with(X), c = d == null ? void 0 : d.with(Ze), l = this._copyInfo;
1282
1597
  if (!u || !c)
1283
1598
  return { redos: [], undos: [] };
1284
- const { drawings: g } = l, h = wn(a);
1599
+ const { drawings: g } = l, h = $n(a);
1285
1600
  return this._generateMutations(g, {
1286
1601
  unitId: s,
1287
1602
  subUnitId: o,
1288
- isCut: e === ve.CUT,
1289
- getTransform: (f, p) => {
1290
- var v;
1291
- const m = u.attachRangeWithCoord({
1603
+ isCut: e === Re.CUT,
1604
+ getTransform: (f, m) => {
1605
+ var S;
1606
+ const p = u.attachRangeWithCoord({
1292
1607
  startRow: h.startRow,
1293
1608
  endRow: h.endRow,
1294
1609
  startColumn: h.startColumn,
1295
1610
  endColumn: h.endColumn
1296
- }), _ = {
1611
+ }), w = {
1297
1612
  ...f,
1298
- left: m == null ? void 0 : m.startX,
1299
- top: m == null ? void 0 : m.startY
1613
+ left: p == null ? void 0 : p.startX,
1614
+ top: p == null ? void 0 : p.startY
1300
1615
  };
1301
1616
  return {
1302
- transform: _,
1303
- sheetTransform: (v = $(_, c)) != null ? v : p
1617
+ transform: w,
1618
+ sheetTransform: (S = j(w, c)) != null ? S : m
1304
1619
  };
1305
1620
  }
1306
1621
  });
@@ -1320,20 +1635,20 @@ let Tt = class extends ne {
1320
1635
  ...c,
1321
1636
  unitId: n,
1322
1637
  subUnitId: r,
1323
- drawingId: o ? c.drawingId : Qe(),
1638
+ drawingId: o ? c.drawingId : Ve(),
1324
1639
  transform: h.transform,
1325
1640
  sheetTransform: h.sheetTransform
1326
1641
  };
1327
1642
  if (o) {
1328
- const { undo: p, redo: m, objects: _ } = u.getBatchUpdateOp([f]);
1643
+ const { undo: m, redo: p, objects: w } = u.getBatchUpdateOp([f]);
1329
1644
  a.push({
1330
1645
  id: P.id,
1331
1646
  params: {
1332
1647
  unitId: n,
1333
1648
  subUnitId: r,
1334
1649
  type: U.UPDATE,
1335
- op: m,
1336
- objects: _
1650
+ op: p,
1651
+ objects: w
1337
1652
  }
1338
1653
  }), d.push({
1339
1654
  id: P.id,
@@ -1341,13 +1656,13 @@ let Tt = class extends ne {
1341
1656
  unitId: n,
1342
1657
  subUnitId: r,
1343
1658
  type: U.UPDATE,
1344
- op: p,
1345
- objects: _
1659
+ op: m,
1660
+ objects: w
1346
1661
  }
1347
1662
  });
1348
1663
  } else {
1349
- const { undo: p, redo: m, objects: _ } = u.getBatchAddOp([f]);
1350
- a.push({ id: P.id, params: { op: m, unitId: n, subUnitId: r, objects: _, type: U.INSERT } }), d.push({ id: P.id, params: { op: p, unitId: n, subUnitId: r, objects: _, type: U.REMOVE } });
1664
+ const { undo: m, redo: p, objects: w } = u.getBatchAddOp([f]);
1665
+ a.push({ id: P.id, params: { op: p, unitId: n, subUnitId: r, objects: w, type: U.INSERT } }), d.push({ id: P.id, params: { op: m, unitId: n, subUnitId: r, objects: w, type: U.REMOVE } });
1351
1666
  }
1352
1667
  }), { redos: a, undos: d };
1353
1668
  }
@@ -1363,94 +1678,94 @@ let Tt = class extends ne {
1363
1678
  copyRange: a,
1364
1679
  copyType: d
1365
1680
  } = e;
1366
- if (Fn.includes(s))
1681
+ if (ar.includes(s))
1367
1682
  return { redos: [], undos: [] };
1368
- const u = (y = this._renderManagerService.getRenderById(n)) == null ? void 0 : y.with(V);
1683
+ const u = (y = this._renderManagerService.getRenderById(n)) == null ? void 0 : y.with(X);
1369
1684
  if (!u || !this._copyInfo)
1370
1685
  return { redos: [], undos: [] };
1371
1686
  const { drawings: c } = this._copyInfo;
1372
1687
  if (!a)
1373
1688
  return this._generateSingleDrawingPasteMutations({
1374
- pasteTo: { unitId: n, subUnitId: r, range: wn(o) },
1689
+ pasteTo: { unitId: n, subUnitId: r, range: $n(o) },
1375
1690
  pasteType: s
1376
1691
  }, d);
1377
- const { ranges: [l, g], mapFunc: h } = jr([a, o]), { row: f, col: p } = h(l.startRow, l.startColumn), { row: m, col: _ } = h(g.startRow, g.startColumn), v = u.attachRangeWithCoord({
1692
+ const { ranges: [l, g], mapFunc: h } = li([a, o]), { row: f, col: m } = h(l.startRow, l.startColumn), { row: p, col: w } = h(g.startRow, g.startColumn), S = u.attachRangeWithCoord({
1378
1693
  startRow: f,
1379
1694
  endRow: f,
1380
- startColumn: p,
1381
- endColumn: p
1695
+ startColumn: m,
1696
+ endColumn: m
1382
1697
  }), I = u.attachRangeWithCoord({
1383
- startRow: m,
1384
- endRow: m,
1385
- startColumn: _,
1386
- endColumn: _
1698
+ startRow: p,
1699
+ endRow: p,
1700
+ startColumn: w,
1701
+ endColumn: w
1387
1702
  });
1388
- if (!v || !I || !this._copyInfo)
1703
+ if (!S || !I || !this._copyInfo)
1389
1704
  return { redos: [], undos: [] };
1390
- const R = I.startX - v.startX, S = I.startY - v.startY, C = m - f, w = _ - p;
1705
+ const D = I.startX - S.startX, v = I.startY - S.startY, C = p - f, _ = w - m;
1391
1706
  return this._generateMutations(c, {
1392
1707
  unitId: n,
1393
1708
  subUnitId: r,
1394
- getTransform: (D, T) => {
1395
- var E, M;
1709
+ getTransform: (R, E) => {
1710
+ var T, M;
1396
1711
  return {
1397
1712
  transform: {
1398
- ...D,
1399
- left: ((E = D == null ? void 0 : D.left) != null ? E : 0) + R,
1400
- top: ((M = D == null ? void 0 : D.top) != null ? M : 0) + S
1713
+ ...R,
1714
+ left: ((T = R == null ? void 0 : R.left) != null ? T : 0) + D,
1715
+ top: ((M = R == null ? void 0 : R.top) != null ? M : 0) + v
1401
1716
  },
1402
1717
  sheetTransform: {
1403
- ...T,
1718
+ ...E,
1404
1719
  to: {
1405
- ...T.to,
1406
- row: T.to.row + C,
1407
- column: T.to.column + w
1720
+ ...E.to,
1721
+ row: E.to.row + C,
1722
+ column: E.to.column + _
1408
1723
  },
1409
1724
  from: {
1410
- ...T.from,
1411
- row: T.from.row + C,
1412
- column: T.from.column + w
1725
+ ...E.from,
1726
+ row: E.from.row + C,
1727
+ column: E.from.column + _
1413
1728
  }
1414
1729
  }
1415
1730
  };
1416
1731
  },
1417
- isCut: d === ve.CUT
1732
+ isCut: d === Re.CUT
1418
1733
  });
1419
1734
  }
1420
1735
  };
1421
- Tt = vs([
1422
- ze(0, $r),
1423
- ze(1, J),
1424
- ze(2, ie),
1425
- ze(3, ki),
1426
- ze(4, X)
1427
- ], Tt);
1428
- var Rs = Object.getOwnPropertyDescriptor, bs = (i, t, e, n) => {
1429
- for (var r = n > 1 ? void 0 : n ? Rs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1736
+ Wt = Qs([
1737
+ rt(0, ui),
1738
+ rt(1, Q),
1739
+ rt(2, oe),
1740
+ rt(3, ls),
1741
+ rt(4, Y)
1742
+ ], Wt);
1743
+ var ro = Object.getOwnPropertyDescriptor, io = (i, t, e, n) => {
1744
+ for (var r = n > 1 ? void 0 : n ? ro(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1430
1745
  (o = i[s]) && (r = o(r) || r);
1431
1746
  return r;
1432
- }, Ke = (i, t) => (e, n) => t(e, n, i);
1433
- let Et = class extends ne {
1747
+ }, it = (i, t) => (e, n) => t(e, n, i);
1748
+ let Bt = class extends ee {
1434
1749
  constructor(i, t, e, n, r) {
1435
1750
  super(), this._drawingManagerService = i, this._renderManagerService = t, this._permissionService = e, this._univerInstanceService = n, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
1436
1751
  }
1437
1752
  _initDrawingVisible() {
1438
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), t = this._userManagerService.currentUser$, e = St([i, t]);
1753
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET), t = this._userManagerService.currentUser$, e = at([i, t]);
1439
1754
  this.disposeWithMe(
1440
1755
  e.pipe(
1441
- we(([n, r]) => n ? n.activeSheet$.pipe(
1442
- kn((s) => {
1756
+ me(([n, r]) => n ? n.activeSheet$.pipe(
1757
+ er((s) => {
1443
1758
  if (!s) {
1444
1759
  this._drawingManagerService.setDrawingVisible(!1);
1445
1760
  return;
1446
1761
  }
1447
1762
  const o = n.getUnitId(), a = s.getSheetId();
1448
1763
  this._permissionService.composePermission([
1449
- new Mn(o).id,
1450
- new yn(o, a).id
1764
+ new Vn(o).id,
1765
+ new Hn(o, a).id
1451
1766
  ]).every((u) => u.value) ? this._drawingManagerService.setDrawingVisible(!0) : this._handleDrawingVisibilityFalse(n, s);
1452
1767
  })
1453
- ) : (this._drawingManagerService.setDrawingVisible(!1), fe))
1768
+ ) : (this._drawingManagerService.setDrawingVisible(!1), we))
1454
1769
  ).subscribe()
1455
1770
  );
1456
1771
  }
@@ -1460,26 +1775,26 @@ let Et = class extends ne {
1460
1775
  if (!a)
1461
1776
  return;
1462
1777
  a.getAllObjectsByOrder().forEach((u) => {
1463
- u.classType === Oe.IMAGE && s.some((c) => u.oKey.includes(c.drawingId)) && a.removeObject(u);
1778
+ u.classType === $e.IMAGE && s.some((c) => u.oKey.includes(c.drawingId)) && a.removeObject(u);
1464
1779
  });
1465
1780
  }
1466
1781
  _initDrawingEditable() {
1467
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), t = this._userManagerService.currentUser$, e = St([i, t]);
1782
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET), t = this._userManagerService.currentUser$, e = at([i, t]);
1468
1783
  this.disposeWithMe(
1469
1784
  e.pipe(
1470
- we(([n, r]) => n ? n.activeSheet$.pipe(
1471
- kn((s) => {
1785
+ me(([n, r]) => n ? n.activeSheet$.pipe(
1786
+ er((s) => {
1472
1787
  if (!s) {
1473
1788
  this._drawingManagerService.setDrawingEditable(!1);
1474
1789
  return;
1475
1790
  }
1476
1791
  const o = n.getUnitId(), a = s.getSheetId();
1477
1792
  this._permissionService.composePermission([
1478
- new zt(o).id,
1479
- new Kt(o, a).id
1793
+ new gn(o).id,
1794
+ new fn(o, a).id
1480
1795
  ]).every((u) => u.value) ? this._drawingManagerService.setDrawingEditable(!0) : this._handleDrawingEditableFalse(n, s);
1481
1796
  })
1482
- ) : (this._drawingManagerService.setDrawingEditable(!1), fe))
1797
+ ) : (this._drawingManagerService.setDrawingEditable(!1), we))
1483
1798
  ).subscribe()
1484
1799
  );
1485
1800
  }
@@ -1489,29 +1804,29 @@ let Et = class extends ne {
1489
1804
  if (!a)
1490
1805
  return;
1491
1806
  a.getAllObjectsByOrder().forEach((u) => {
1492
- u.classType === Oe.IMAGE && s.some((c) => u.oKey.includes(c.drawingId)) && a.detachTransformerFrom(u);
1807
+ u.classType === $e.IMAGE && s.some((c) => u.oKey.includes(c.drawingId)) && a.detachTransformerFrom(u);
1493
1808
  });
1494
1809
  }
1495
1810
  _initViewPermissionChange() {
1496
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), t = this._userManagerService.currentUser$;
1811
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET), t = this._userManagerService.currentUser$;
1497
1812
  this.disposeWithMe(
1498
- St([i, t]).pipe(
1499
- we(([e, n]) => e ? e.activeSheet$.pipe(
1500
- we((r) => {
1813
+ at([i, t]).pipe(
1814
+ me(([e, n]) => e ? e.activeSheet$.pipe(
1815
+ me((r) => {
1501
1816
  if (!r)
1502
- return fe;
1817
+ return we;
1503
1818
  const s = e.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), d = a == null ? void 0 : a.scene;
1504
1819
  if (!d)
1505
- return fe;
1820
+ return we;
1506
1821
  const u = d.getTransformerByCreate();
1507
1822
  return this._permissionService.composePermission$([
1508
- new Mn(s).id,
1509
- new yn(s, o).id
1823
+ new Vn(s).id,
1824
+ new Hn(s, o).id
1510
1825
  ]).pipe(
1511
- Re((l) => l.every((g) => g.value)),
1512
- Wn()
1826
+ pe((l) => l.every((g) => g.value)),
1827
+ tr()
1513
1828
  ).pipe(
1514
- Re((l) => ({
1829
+ pe((l) => ({
1515
1830
  permission: l,
1516
1831
  scene: d,
1517
1832
  transformer: u,
@@ -1520,18 +1835,18 @@ let Et = class extends ne {
1520
1835
  }))
1521
1836
  );
1522
1837
  })
1523
- ) : fe)
1838
+ ) : we)
1524
1839
  ).subscribe({
1525
1840
  next: ({ permission: e, scene: n, transformer: r, unitId: s, subUnitId: o }) => {
1526
1841
  this._drawingManagerService.setDrawingVisible(e);
1527
1842
  const a = n.getAllObjectsByOrder(), d = this._drawingManagerService.getDrawingData(s, o), u = Object.values(d);
1528
1843
  e ? this._drawingManagerService.addNotification(u) : (a.forEach((c) => {
1529
- c.classType === Oe.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.removeObject(c);
1844
+ c.classType === $e.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.removeObject(c);
1530
1845
  }), r.clearSelectedObjects());
1531
1846
  },
1532
1847
  complete: () => {
1533
1848
  this._drawingManagerService.setDrawingVisible(!0);
1534
- const e = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET), n = e == null ? void 0 : e.getActiveSheet(), r = e == null ? void 0 : e.getUnitId(), s = n == null ? void 0 : n.getSheetId();
1849
+ const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET), n = e == null ? void 0 : e.getActiveSheet(), r = e == null ? void 0 : e.getUnitId(), s = n == null ? void 0 : n.getSheetId();
1535
1850
  if (!r || !s)
1536
1851
  return;
1537
1852
  const o = this._drawingManagerService.getDrawingData(r, s), a = Object.values(o);
@@ -1541,25 +1856,25 @@ let Et = class extends ne {
1541
1856
  );
1542
1857
  }
1543
1858
  _initEditPermissionChange() {
1544
- const i = this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET), t = this._userManagerService.currentUser$;
1859
+ const i = this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET), t = this._userManagerService.currentUser$;
1545
1860
  this.disposeWithMe(
1546
- St([i, t]).pipe(
1547
- we(([e, n]) => e ? e.activeSheet$.pipe(
1548
- we((r) => {
1861
+ at([i, t]).pipe(
1862
+ me(([e, n]) => e ? e.activeSheet$.pipe(
1863
+ me((r) => {
1549
1864
  if (!r)
1550
- return fe;
1865
+ return we;
1551
1866
  const s = e.getUnitId(), o = r.getSheetId(), a = this._renderManagerService.getRenderById(s), d = a == null ? void 0 : a.scene;
1552
1867
  if (!d)
1553
- return fe;
1868
+ return we;
1554
1869
  const u = d.getTransformerByCreate();
1555
1870
  return this._permissionService.composePermission$([
1556
- new zt(s).id,
1557
- new Kt(s, o).id
1871
+ new gn(s).id,
1872
+ new fn(s, o).id
1558
1873
  ]).pipe(
1559
- Re((l) => l.every((g) => g.value)),
1560
- Wn()
1874
+ pe((l) => l.every((g) => g.value)),
1875
+ tr()
1561
1876
  ).pipe(
1562
- Re((l) => ({
1877
+ pe((l) => ({
1563
1878
  permission: l,
1564
1879
  scene: d,
1565
1880
  transformer: u,
@@ -1568,19 +1883,19 @@ let Et = class extends ne {
1568
1883
  }))
1569
1884
  );
1570
1885
  })
1571
- ) : fe)
1886
+ ) : we)
1572
1887
  ).subscribe({
1573
1888
  next: ({ permission: e, scene: n, transformer: r, unitId: s, subUnitId: o }) => {
1574
1889
  this._drawingManagerService.setDrawingEditable(e);
1575
1890
  const a = n.getAllObjectsByOrder(), d = this._drawingManagerService.getDrawingData(s, o), u = Object.values(d);
1576
1891
  e ? (a.forEach((c) => {
1577
- c.classType === Oe.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.attachTransformerTo(c);
1892
+ c.classType === $e.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.attachTransformerTo(c);
1578
1893
  }), this._drawingManagerService.addNotification(u)) : (a.forEach((c) => {
1579
- c.classType === Oe.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.detachTransformerFrom(c);
1894
+ c.classType === $e.IMAGE && u.some((l) => c.oKey.includes(l.drawingId)) && n.detachTransformerFrom(c);
1580
1895
  }), r.clearSelectedObjects());
1581
1896
  },
1582
1897
  complete: () => {
1583
- const e = this._univerInstanceService.getCurrentUnitForType(F.UNIVER_SHEET);
1898
+ const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
1584
1899
  if (!e)
1585
1900
  return;
1586
1901
  const n = e.getUnitId(), r = e.getActiveSheet();
@@ -1591,27 +1906,28 @@ let Et = class extends ne {
1591
1906
  return;
1592
1907
  const d = this._drawingManagerService.getDrawingData(n, s), u = Object.values(d);
1593
1908
  this._drawingManagerService.setDrawingEditable(!0), a.getAllObjectsByOrder().forEach((l) => {
1594
- l.classType === Oe.IMAGE && u.some((g) => l.oKey.includes(g.drawingId)) && a.detachTransformerFrom(l);
1909
+ l.classType === $e.IMAGE && u.some((g) => l.oKey.includes(g.drawingId)) && a.detachTransformerFrom(l);
1595
1910
  });
1596
1911
  }
1597
1912
  })
1598
1913
  );
1599
1914
  }
1600
1915
  };
1601
- Et = bs([
1602
- Ke(0, ie),
1603
- Ke(1, J),
1604
- Ke(2, zr),
1605
- Ke(3, Se),
1606
- Ke(4, A(Kr))
1607
- ], Et);
1608
- var Ms = Object.getOwnPropertyDescriptor, ys = (i, t, e, n) => {
1609
- for (var r = n > 1 ? void 0 : n ? Ms(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1916
+ Bt = io([
1917
+ it(0, oe),
1918
+ it(1, Q),
1919
+ it(2, Ii),
1920
+ it(3, de),
1921
+ it(4, A(Ci))
1922
+ ], Bt);
1923
+ var so = Object.getOwnPropertyDescriptor, oo = (i, t, e, n) => {
1924
+ for (var r = n > 1 ? void 0 : n ? so(t, e) : t, s = i.length - 1, o; s >= 0; s--)
1610
1925
  (o = i[s]) && (r = o(r) || r);
1611
1926
  return r;
1612
- }, Ce = (i, t) => (e, n) => t(e, n, i);
1613
- function Ir(i, t, e, n, r, s = !1) {
1614
- const { scaleX: o, scaleY: a } = t.getAncestorScale(), d = t.getViewport(xn.VIEW_MAIN), u = n.getFreeze(), { startColumn: c, startRow: l, xSplit: g, ySplit: h } = u, f = {
1927
+ }, be = (i, t) => (e, n) => t(e, n, i);
1928
+ const ao = "univer-sheet-float-dom-";
1929
+ function Hr(i, t, e, n, r, s = !1) {
1930
+ const { scaleX: o, scaleY: a } = t.getAncestorScale(), d = t.getViewport(cr.VIEW_MAIN), u = n.getFreeze(), { startColumn: c, startRow: l, xSplit: g, ySplit: h } = u, f = {
1615
1931
  left: !0,
1616
1932
  // left means the left of pic is in a viewMainLeft
1617
1933
  top: !0
@@ -1621,43 +1937,43 @@ function Ir(i, t, e, n, r, s = !1) {
1621
1937
  ...i,
1622
1938
  absolute: f
1623
1939
  };
1624
- const { left: p, right: m, top: _, bottom: v } = i;
1625
- let { top: I, left: R, viewportScrollX: S, viewportScrollY: C } = d;
1626
- const { boundsOfViewArea: w, scrollDirectionResponse: y } = r || {}, { rowHeaderWidth: D, columnHeaderHeight: T } = e, E = {
1627
- top: s ? 0 : T,
1628
- left: s ? 0 : D
1940
+ const { left: m, right: p, top: w, bottom: S } = i;
1941
+ let { top: I, left: D, viewportScrollX: v, viewportScrollY: C } = d;
1942
+ const { boundsOfViewArea: _, scrollDirectionResponse: y } = r || {}, { rowHeaderWidth: R, columnHeaderHeight: E } = e, T = {
1943
+ top: s ? 0 : E,
1944
+ left: s ? 0 : R
1629
1945
  };
1630
- w && (je.isDefine(E.top) && (E.top = w.top), je.isDefine(E.left) && (E.left = w.left)), y === "HORIZONTAL" && (C = 0), y === "VERTICAL" && (S = 0);
1946
+ _ && (Ye.isDefine(T.top) && (T.top = _.top), Ye.isDefine(T.left) && (T.left = _.left)), y === "HORIZONTAL" && (C = 0), y === "VERTICAL" && (v = 0);
1631
1947
  let M = 0, b = 0;
1632
- const N = e.rowStartY(l - h) + T, x = e.colStartX(c - g) + D, q = e.rowStartY(l) + T, H = e.colStartX(c) + D;
1948
+ const N = e.rowStartY(l - h) + E, F = e.colStartX(c - g) + R, te = e.rowStartY(l) + E, z = e.colStartX(c) + R;
1633
1949
  if (g === 0)
1634
- f.left = !1, M = (p - S) * o, b = (m - S) * o;
1950
+ f.left = !1, M = (m - v) * o, b = (p - v) * o;
1635
1951
  else {
1636
- const k = p - (x - D), ae = m - (x - D);
1637
- m < H ? (M = k * o, b = ae * o) : p <= H && m >= H ? (M = k * o, b = Math.max(R, (m - S) * o)) : p > H && (f.left = !1, M = Math.max((p - S) * o, R), b = Math.max((m - S) * o, R));
1952
+ const K = m - (F - R), W = p - (F - R);
1953
+ p < z ? (M = K * o, b = W * o) : m <= z && p >= z ? (M = K * o, b = Math.max(D, (p - v) * o)) : m > z && (f.left = !1, M = Math.max((m - v) * o, D), b = Math.max((p - v) * o, D));
1638
1954
  }
1639
- let L = 0, G = 0;
1955
+ let H = 0, G = 0;
1640
1956
  if (h === 0)
1641
- f.top = !1, L = (_ - C) * a, G = (v - C) * a;
1957
+ f.top = !1, H = (w - C) * a, G = (S - C) * a;
1642
1958
  else {
1643
- const k = _ - (N - T), ae = v - (N - T);
1644
- v < q ? (L = k * a, G = ae * a) : _ <= q && v >= q ? (L = k * a, G = Math.max(I, (v - C) * a)) : _ > q && (f.top = !1, L = Math.max((_ - C) * a, I), G = Math.max((v - C) * a, I));
1959
+ const K = w - (N - E), W = S - (N - E);
1960
+ S < te ? (H = K * a, G = W * a) : w <= te && S >= te ? (H = K * a, G = Math.max(I, (S - C) * a)) : w > te && (f.top = !1, H = Math.max((w - C) * a, I), G = Math.max((S - C) * a, I));
1645
1961
  }
1646
- return M = Math.max(M, E.left), L = Math.max(L, E.top), b = Math.max(b, E.left), G = Math.max(G, E.top), {
1962
+ return M = Math.max(M, T.left), H = Math.max(H, T.top), b = Math.max(b, T.left), G = Math.max(G, T.top), {
1647
1963
  left: M,
1648
1964
  right: b,
1649
- top: L,
1965
+ top: H,
1650
1966
  bottom: G,
1651
1967
  absolute: f
1652
1968
  };
1653
1969
  }
1654
- const ge = (i, t, e, n, r) => {
1970
+ const fe = (i, t, e, n, r) => {
1655
1971
  const { left: s, top: o, width: a, height: d, angle: u } = i, c = {
1656
1972
  left: s,
1657
1973
  right: s + a,
1658
1974
  top: o,
1659
1975
  bottom: o + d
1660
- }, l = Ir(c, t, e, n, r), { scaleX: g, scaleY: h } = t.getAncestorScale();
1976
+ }, l = Hr(c, t, e, n, r), { scaleX: g, scaleY: h } = t.getAncestorScale();
1661
1977
  return {
1662
1978
  startX: l.left,
1663
1979
  endX: l.right,
@@ -1669,23 +1985,23 @@ const ge = (i, t, e, n, r) => {
1669
1985
  absolute: l.absolute
1670
1986
  };
1671
1987
  };
1672
- let tt = class extends ne {
1988
+ let lt = class extends ee {
1673
1989
  constructor(t, e, n, r, s, o, a) {
1674
1990
  super();
1675
1991
  /**
1676
1992
  * for update dom container position when scrolling and zoom
1677
1993
  */
1678
- ee(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
1679
- ee(this, "_transformChange$", new Xt());
1680
- ee(this, "transformChange$", this._transformChange$.asObservable());
1681
- ee(this, "_add$", new Xt());
1682
- ee(this, "add$", this._add$.asObservable());
1683
- ee(this, "_remove$", new Xt());
1684
- ee(this, "remove$", this._remove$.asObservable());
1994
+ re(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
1995
+ re(this, "_transformChange$", new on());
1996
+ re(this, "transformChange$", this._transformChange$.asObservable());
1997
+ re(this, "_add$", new on());
1998
+ re(this, "add$", this._add$.asObservable());
1999
+ re(this, "_remove$", new on());
2000
+ re(this, "remove$", this._remove$.asObservable());
1685
2001
  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();
1686
2002
  }
1687
2003
  _bindScrollEvent() {
1688
- this._lifecycleService.lifecycle$.pipe(Zi((t) => t === Zr.Rendered), qi(1)).subscribe(() => {
2004
+ this._lifecycleService.lifecycle$.pipe(Ms((t) => t === Di.Rendered), ys(1)).subscribe(() => {
1689
2005
  this._scrollUpdateListener();
1690
2006
  });
1691
2007
  }
@@ -1711,87 +2027,89 @@ let tt = class extends ne {
1711
2027
  this._drawingManagerService.add$.subscribe((t) => {
1712
2028
  t.forEach((e) => {
1713
2029
  var K;
1714
- const { unitId: n, subUnitId: r, drawingId: s } = e, o = se(this._univerInstanceService, { unitId: n, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(e), d = this._univerInstanceService.getUnit(n, F.UNIVER_SHEET);
2030
+ const { unitId: n, subUnitId: r, drawingId: s } = e, o = ae(this._univerInstanceService, { unitId: n, subUnitId: r }), a = this._drawingManagerService.getDrawingByParam(e), d = this._univerInstanceService.getUnit(n, $.UNIVER_SHEET);
1715
2031
  if (!d)
1716
2032
  return;
1717
2033
  const u = d.getActiveSheet().getSheetId();
1718
2034
  if (!a || !o)
1719
2035
  return;
1720
- const c = (K = this._renderManagerService.getRenderById(n)) == null ? void 0 : K.with(V).getSkeletonParam(r);
2036
+ const c = (K = this._renderManagerService.getRenderById(n)) == null ? void 0 : K.with(X).getSkeletonParam(r);
1721
2037
  if (!c)
1722
2038
  return;
1723
2039
  const { transform: l, drawingType: g, data: h } = a;
1724
- if (g !== B.DRAWING_DOM && g !== B.DRAWING_CHART)
2040
+ if (g !== x.DRAWING_DOM && g !== x.DRAWING_CHART)
1725
2041
  return;
1726
2042
  const f = this._getSceneAndTransformerByDrawingSearch(n);
1727
2043
  if (f == null)
1728
2044
  return;
1729
- const { scene: p, canvas: m } = f;
2045
+ const { scene: m, canvas: p } = f;
1730
2046
  if (l == null)
1731
2047
  return !0;
1732
2048
  if (u !== r)
1733
2049
  return;
1734
- const { left: _, top: v, width: I, height: R, angle: S, flipX: C, flipY: w, skewX: y, skewY: D } = l, T = Ie({ unitId: n, subUnitId: r, drawingId: s }), E = p.getObject(T);
1735
- if (E != null) {
1736
- E.transformByState({ left: _, top: v, width: I, height: R, angle: S, flipX: C, flipY: w, skewX: y, skewY: D });
2050
+ const { left: w, top: S, width: I, height: D, angle: v, flipX: C, flipY: _, skewX: y, skewY: R } = l, E = De({ unitId: n, subUnitId: r, drawingId: s }), T = m.getObject(E);
2051
+ if (T != null) {
2052
+ T.transformByState({ left: w, top: S, width: I, height: D, angle: v, flipX: C, flipY: _, skewX: y, skewY: R });
1737
2053
  return;
1738
2054
  }
1739
2055
  const M = {
1740
- left: _,
1741
- top: v,
2056
+ left: w,
2057
+ top: S,
1742
2058
  width: I,
1743
- height: R,
2059
+ height: D,
1744
2060
  zIndex: this._drawingManagerService.getDrawingOrder(n, r).length - 1
1745
- }, b = g === B.DRAWING_CHART;
2061
+ }, b = g === x.DRAWING_CHART;
1746
2062
  if (M.rotateEnabled = !1, b) {
1747
- const k = h ? h.backgroundColor : "white";
1748
- M.fill = k, h && h.border && (M.stroke = h.border), M.paintFirst = "stroke", M.strokeWidth = 1, M.borderEnabled = !1, M.radius = 8;
2063
+ const W = h ? h.backgroundColor : "white";
2064
+ M.fill = W, h && h.border && (M.stroke = h.border), M.paintFirst = "stroke", M.strokeWidth = 1, M.borderEnabled = !1, M.radius = 8;
1749
2065
  }
1750
- const N = new Ue(T, M);
1751
- b && N.setObjectType(mn.CHART), p.addObject(N, Ft), a.allowTransform !== !1 && p.attachTransformerTo(N);
1752
- const x = new _t(), q = ge(N, f.renderUnit.scene, c.skeleton, o.worksheet), H = new ke(q), L = {
1753
- dispose: x,
2066
+ const N = new ke(E, M);
2067
+ b && N.setObjectType(An.CHART), m.addObject(N, qt), a.allowTransform !== !1 && m.attachTransformerTo(N);
2068
+ const F = new yt(), te = fe(N, f.renderUnit.scene, c.skeleton, o.worksheet), z = new je(te), H = `${ao}${Ve(6)}`, G = {
2069
+ dispose: F,
1754
2070
  rect: N,
1755
- position$: H,
2071
+ position$: z,
1756
2072
  unitId: n,
1757
2073
  subUnitId: r,
1758
- id: s
2074
+ id: s,
2075
+ domId: H
1759
2076
  };
1760
2077
  this._canvasFloatDomService.addFloatDom({
1761
- position$: H,
2078
+ position$: z,
1762
2079
  id: s,
2080
+ domId: H,
1763
2081
  componentKey: a.componentKey,
1764
- onPointerDown: (k) => {
1765
- m.dispatchEvent(new PointerEvent(k.type, k));
2082
+ onPointerDown: (W) => {
2083
+ p.dispatchEvent(new PointerEvent(W.type, W));
1766
2084
  },
1767
- onPointerMove: (k) => {
1768
- m.dispatchEvent(new PointerEvent(k.type, k));
2085
+ onPointerMove: (W) => {
2086
+ p.dispatchEvent(new PointerEvent(W.type, W));
1769
2087
  },
1770
- onPointerUp: (k) => {
1771
- m.dispatchEvent(new PointerEvent(k.type, k));
2088
+ onPointerUp: (W) => {
2089
+ p.dispatchEvent(new PointerEvent(W.type, W));
1772
2090
  },
1773
- onWheel: (k) => {
1774
- m.dispatchEvent(new WheelEvent(k.type, k));
2091
+ onWheel: (W) => {
2092
+ p.dispatchEvent(new WheelEvent(W.type, W));
1775
2093
  },
1776
2094
  data: h,
1777
2095
  unitId: n
1778
2096
  });
1779
- const G = N.onTransformChange$.subscribeEvent(() => {
1780
- const k = ge(N, f.renderUnit.scene, c.skeleton, o.worksheet);
1781
- H.next(
1782
- k
2097
+ const J = N.onTransformChange$.subscribeEvent(() => {
2098
+ const W = fe(N, f.renderUnit.scene, c.skeleton, o.worksheet);
2099
+ z.next(
2100
+ W
1783
2101
  );
1784
2102
  });
1785
- x.add(() => {
2103
+ F.add(() => {
1786
2104
  this._canvasFloatDomService.removeFloatDom(s);
1787
- }), G && x.add(G), this._domLayerInfoMap.set(s, L);
2105
+ }), J && F.add(J), this._domLayerInfoMap.set(s, G);
1788
2106
  });
1789
2107
  })
1790
2108
  ), this.disposeWithMe(
1791
2109
  this._drawingManagerService.remove$.subscribe((t) => {
1792
2110
  t.forEach((e) => {
1793
2111
  var l;
1794
- const { unitId: n, subUnitId: r, drawingId: s } = e, o = Ie({ unitId: n, subUnitId: r, drawingId: s }), a = this._getSceneAndTransformerByDrawingSearch(n);
2112
+ const { unitId: n, subUnitId: r, drawingId: s } = e, o = De({ unitId: n, subUnitId: r, drawingId: s }), a = this._getSceneAndTransformerByDrawingSearch(n);
1795
2113
  if (a == null)
1796
2114
  return;
1797
2115
  const { transformer: d, scene: u } = a, c = u.getObject(o);
@@ -1803,25 +2121,25 @@ let tt = class extends ne {
1803
2121
  _scrollUpdateListener() {
1804
2122
  const t = (e, n) => {
1805
2123
  var d;
1806
- const r = this._getSceneAndTransformerByDrawingSearch(e), s = Array.from(this._domLayerInfoMap.keys()).map((u) => ({ id: u, ...this._domLayerInfoMap.get(u) })).filter((u) => u.subUnitId === n && u.unitId === e).map((u) => u.id), o = se(this._univerInstanceService, { unitId: e, subUnitId: n }), a = (d = this._renderManagerService.getRenderById(e)) == null ? void 0 : d.with(V).getSkeletonParam(n);
2124
+ const r = this._getSceneAndTransformerByDrawingSearch(e), s = Array.from(this._domLayerInfoMap.keys()).map((u) => ({ id: u, ...this._domLayerInfoMap.get(u) })).filter((u) => u.subUnitId === n && u.unitId === e).map((u) => u.id), o = ae(this._univerInstanceService, { unitId: e, subUnitId: n }), a = (d = this._renderManagerService.getRenderById(e)) == null ? void 0 : d.with(X).getSkeletonParam(n);
1807
2125
  !r || !o || !a || s.forEach((u) => {
1808
2126
  const c = this._domLayerInfoMap.get(u);
1809
2127
  if (c) {
1810
- const l = ge(c.rect, r.renderUnit.scene, a.skeleton, o.worksheet, c);
2128
+ const l = fe(c.rect, r.renderUnit.scene, a.skeleton, o.worksheet, c);
1811
2129
  c.position$.next(l);
1812
2130
  }
1813
2131
  });
1814
2132
  };
1815
2133
  this.disposeWithMe(
1816
- this._univerInstanceService.getCurrentTypeOfUnit$(F.UNIVER_SHEET).pipe(
1817
- we((e) => e ? e.activeSheet$ : Bn(null)),
1818
- Re((e) => {
2134
+ this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET).pipe(
2135
+ me((e) => e ? e.activeSheet$ : wn(null)),
2136
+ pe((e) => {
1819
2137
  if (!e) return null;
1820
2138
  const n = e.getUnitId(), r = this._renderManagerService.getRenderById(n);
1821
2139
  return r ? { render: r, unitId: n, subUnitId: e.getSheetId() } : null;
1822
2140
  }),
1823
- we(
1824
- (e) => e ? qr(e.render.scene.getViewport(xn.VIEW_MAIN).onScrollAfter$).pipe(Re(() => ({ unitId: e.unitId, subUnitId: e.subUnitId }))) : Bn(null)
2141
+ me(
2142
+ (e) => e ? bi(e.render.scene.getViewport(cr.VIEW_MAIN).onScrollAfter$).pipe(pe(() => ({ unitId: e.unitId, subUnitId: e.subUnitId }))) : wn(null)
1825
2143
  )
1826
2144
  ).subscribe((e) => {
1827
2145
  if (!e) return;
@@ -1829,12 +2147,15 @@ let tt = class extends ne {
1829
2147
  t(n, r);
1830
2148
  })
1831
2149
  ), this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
1832
- if (e.id === _n.id) {
2150
+ if (e.id === kn.id) {
1833
2151
  const n = e.params, { unitId: r } = n;
1834
2152
  Array.from(this._domLayerInfoMap.values()).filter((o) => o.unitId === r).map((o) => o.subUnitId).forEach((o) => {
1835
2153
  t(r, o);
1836
2154
  });
1837
- } else if (e.id === hi.id) {
2155
+ } else if (e.id === Bi.id) {
2156
+ const { unitId: n, subUnitId: r } = e.params;
2157
+ t(n, r);
2158
+ } else if (e.id === ji.id) {
1838
2159
  const { unitId: n, subUnitId: r } = e.params;
1839
2160
  t(n, r);
1840
2161
  }
@@ -1843,13 +2164,13 @@ let tt = class extends ne {
1843
2164
  updateFloatDomProps(t, e, n, r) {
1844
2165
  const s = this._domLayerInfoMap.get(n), o = this._getSceneAndTransformerByDrawingSearch(t);
1845
2166
  if (s && o) {
1846
- const { scene: a } = o, d = Ie({ unitId: t, subUnitId: e, drawingId: n }), u = a.getObject(d);
1847
- u && u instanceof Ue && u.setProps(r);
2167
+ const { scene: a } = o, d = De({ unitId: t, subUnitId: e, drawingId: n }), u = a.getObject(d);
2168
+ u && u instanceof ke && u.setProps(r);
1848
2169
  }
1849
2170
  }
1850
2171
  _getPosition(t, e) {
1851
2172
  var g;
1852
- const { startX: n, endX: r, startY: s, endY: o } = t, a = (g = this._renderManagerService.getRenderById(e)) == null ? void 0 : g.with(xe);
2173
+ const { startX: n, endX: r, startY: s, endY: o } = t, a = (g = this._renderManagerService.getRenderById(e)) == null ? void 0 : g.with(Ze);
1853
2174
  if (a == null)
1854
2175
  return;
1855
2176
  const d = a.getCellWithCoordByOffset(n, s);
@@ -1879,7 +2200,7 @@ let tt = class extends ne {
1879
2200
  this._drawingManagerService.update$.subscribe((t) => {
1880
2201
  t.forEach((e) => {
1881
2202
  const n = this._drawingManagerService.getDrawingByParam(e);
1882
- if (!n || n.drawingType !== B.DRAWING_DOM && n.drawingType !== B.DRAWING_CHART)
2203
+ if (!n || n.drawingType !== x.DRAWING_DOM && n.drawingType !== x.DRAWING_CHART)
1883
2204
  return;
1884
2205
  const r = {
1885
2206
  ...n.transform
@@ -1888,7 +2209,7 @@ let tt = class extends ne {
1888
2209
  ...n
1889
2210
  });
1890
2211
  const s = this._getSceneAndTransformerByDrawingSearch(e.unitId);
1891
- if (s && n.drawingType !== B.DRAWING_CHART) {
2212
+ if (s && n.drawingType !== x.DRAWING_CHART) {
1892
2213
  const { scene: o } = s, a = this._domLayerInfoMap.get(e.drawingId);
1893
2214
  a != null && a.rect && (n.allowTransform === !1 ? o.detachTransformerFrom(a.rect) : o.attachTransformerTo(a.rect));
1894
2215
  }
@@ -1907,20 +2228,20 @@ let tt = class extends ne {
1907
2228
  }
1908
2229
  // CreateFloatDomCommand --> floatDomService.addFloatDomToPosition
1909
2230
  addFloatDomToPosition(t, e) {
1910
- const n = se(this._univerInstanceService, {
2231
+ const n = ae(this._univerInstanceService, {
1911
2232
  unitId: t.unitId,
1912
2233
  subUnitId: t.subUnitId
1913
2234
  });
1914
2235
  if (!n)
1915
2236
  throw new Error("cannot find current target!");
1916
- const { unitId: r, subUnitId: s } = n, { initPosition: o, componentKey: a, data: d, allowTransform: u = !0 } = t, c = e != null ? e : Qe(), l = this._getPosition(o, r);
2237
+ const { unitId: r, subUnitId: s } = n, { initPosition: o, componentKey: a, data: d, allowTransform: u = !0 } = t, c = e != null ? e : Ve(), l = this._getPosition(o, r);
1917
2238
  if (l == null)
1918
2239
  return;
1919
2240
  const g = {
1920
2241
  unitId: r,
1921
2242
  subUnitId: s,
1922
2243
  drawingId: c,
1923
- drawingType: t.type || B.DRAWING_DOM,
2244
+ drawingType: t.type || x.DRAWING_DOM,
1924
2245
  componentKey: a,
1925
2246
  sheetTransform: l,
1926
2247
  transform: {
@@ -1932,7 +2253,7 @@ let tt = class extends ne {
1932
2253
  data: d,
1933
2254
  allowTransform: u
1934
2255
  };
1935
- return this._commandService.executeCommand(kt.id, {
2256
+ return this._commandService.executeCommand(Xt.id, {
1936
2257
  unitId: r,
1937
2258
  drawings: [g]
1938
2259
  }), this._add$.next({ unitId: r, subUnitId: s, id: c }), {
@@ -1959,8 +2280,8 @@ let tt = class extends ne {
1959
2280
  }
1960
2281
  // eslint-disable-next-line max-lines-per-function, complexity
1961
2282
  addFloatDomToRange(t, e, n, r) {
1962
- var C, w, y;
1963
- const s = se(this._univerInstanceService, {
2283
+ var C, _, y;
2284
+ const s = ae(this._univerInstanceService, {
1964
2285
  unitId: e.unitId,
1965
2286
  subUnitId: e.subUnitId
1966
2287
  });
@@ -1970,84 +2291,84 @@ let tt = class extends ne {
1970
2291
  if (!d) return;
1971
2292
  const u = this._renderManagerService.getRenderById(o);
1972
2293
  if (!u) return;
1973
- const c = (C = this._renderManagerService.getRenderById(o)) == null ? void 0 : C.with(V).getWorksheetSkeleton(a);
2294
+ const c = (C = this._renderManagerService.getRenderById(o)) == null ? void 0 : C.with(X).getWorksheetSkeleton(a);
1974
2295
  if (!c) return;
1975
- const { componentKey: l, data: g, allowTransform: h = !0 } = e, f = r != null ? r : Qe(), { position: p, position$: m } = this._createRangePositionObserver(t, u, c.skeleton);
1976
- if (this._getPosition(p, o) == null)
2296
+ const { componentKey: l, data: g, allowTransform: h = !0 } = e, f = r != null ? r : Ve(), { position: m, position$: p } = this._createRangePositionObserver(t, u, c.skeleton);
2297
+ if (this._getPosition(m, o) == null)
1977
2298
  return;
1978
- const v = d.scene, { scaleX: I } = v.getAncestorScale(), R = Ct(p, n, I), S = {
2299
+ const S = d.scene, { scaleX: I } = S.getAncestorScale(), D = Ut(m, n, I), v = {
1979
2300
  unitId: o,
1980
2301
  subUnitId: a,
1981
2302
  drawingId: f,
1982
- drawingType: e.type || B.DRAWING_DOM,
2303
+ drawingType: e.type || x.DRAWING_DOM,
1983
2304
  componentKey: l,
1984
2305
  transform: {
1985
- left: R.startX,
1986
- top: R.startY,
1987
- width: R.width,
1988
- height: R.height
2306
+ left: D.startX,
2307
+ top: D.startY,
2308
+ width: D.width,
2309
+ height: D.height
1989
2310
  },
1990
2311
  data: g,
1991
2312
  allowTransform: h
1992
2313
  };
1993
2314
  {
1994
- const { unitId: D, subUnitId: T, drawingId: E } = S, M = se(this._univerInstanceService, { unitId: D, subUnitId: T }), b = S, N = this._univerInstanceService.getUnit(D, F.UNIVER_SHEET);
2315
+ const { unitId: R, subUnitId: E, drawingId: T } = v, M = ae(this._univerInstanceService, { unitId: R, subUnitId: E }), b = v, N = this._univerInstanceService.getUnit(R, $.UNIVER_SHEET);
1995
2316
  if (!N)
1996
2317
  return;
1997
- const x = N.getActiveSheet().getSheetId();
2318
+ const F = N.getActiveSheet().getSheetId();
1998
2319
  if (!b || !M)
1999
2320
  return;
2000
- const q = (w = this._renderManagerService.getRenderById(D)) == null ? void 0 : w.with(V);
2001
- if (!q)
2321
+ const te = (_ = this._renderManagerService.getRenderById(R)) == null ? void 0 : _.with(X);
2322
+ if (!te)
2002
2323
  return;
2003
- const H = q.getWorksheetSkeleton(T);
2004
- if (!H)
2324
+ const z = te.getWorksheetSkeleton(E);
2325
+ if (!z)
2005
2326
  return;
2006
- const { transform: L, drawingType: G, data: K } = b;
2007
- if (G !== B.DRAWING_DOM && G !== B.DRAWING_CHART)
2327
+ const { transform: H, drawingType: G, data: J } = b;
2328
+ if (G !== x.DRAWING_DOM && G !== x.DRAWING_CHART)
2008
2329
  return;
2009
- const k = this._getSceneAndTransformerByDrawingSearch(D);
2010
- if (k == null)
2330
+ const K = this._getSceneAndTransformerByDrawingSearch(R);
2331
+ if (K == null)
2011
2332
  return;
2012
- const { scene: ae, canvas: be } = k;
2013
- if (L == null || x !== T)
2333
+ const { scene: W, canvas: Oe } = K;
2334
+ if (H == null || F !== E)
2014
2335
  return;
2015
- const { left: ot, top: at, width: ct, height: dt, angle: jt, flipX: $t, flipY: lt, skewX: ut, skewY: Me } = L, ht = Ie({ unitId: D, subUnitId: T, drawingId: E }), de = ae.getObject(ht);
2016
- if (de != null) {
2017
- de.transformByState({ left: ot, top: at, width: ct, height: dt, angle: jt, flipX: $t, flipY: lt, skewX: ut, skewY: Me });
2336
+ const { left: mt, top: pt, width: wt, height: _t, angle: Zt, flipX: Jt, flipY: St, skewX: vt, skewY: Ue } = H, It = De({ unitId: R, subUnitId: E, drawingId: T }), le = W.getObject(It);
2337
+ if (le != null) {
2338
+ le.transformByState({ left: mt, top: pt, width: wt, height: _t, angle: Zt, flipX: Jt, flipY: St, skewX: vt, skewY: Ue });
2018
2339
  return;
2019
2340
  }
2020
- const Q = {
2021
- left: ot,
2341
+ const ne = {
2342
+ left: mt,
2022
2343
  // from floatDomParam.transform
2023
- top: at,
2024
- width: ct,
2025
- height: dt,
2026
- zIndex: this._drawingManagerService.getDrawingOrder(D, T).length - 1
2027
- }, ye = G === B.DRAWING_CHART;
2028
- if (ye) {
2029
- const W = K ? K.backgroundColor : "white";
2030
- 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;
2344
+ top: pt,
2345
+ width: wt,
2346
+ height: _t,
2347
+ zIndex: this._drawingManagerService.getDrawingOrder(R, E).length - 1
2348
+ }, Pe = G === x.DRAWING_CHART;
2349
+ if (Pe) {
2350
+ const k = J ? J.backgroundColor : "white";
2351
+ ne.fill = k, ne.rotateEnabled = !1, J && J.border && (ne.stroke = J.border), ne.paintFirst = "stroke", ne.strokeWidth = 1, ne.borderEnabled = !1, ne.radius = 8;
2031
2352
  }
2032
- const le = new Ue(ht, Q);
2033
- ye && le.setObjectType(mn.CHART), ae.addObject(le, Ft), b.allowTransform !== !1 && ae.attachTransformerTo(le);
2034
- const ue = new _t(), gt = ae.getMainViewport(), { rowHeaderWidth: Te, columnHeaderHeight: Xe } = H.skeleton, ft = {
2035
- top: Xe,
2036
- left: Te,
2037
- bottom: gt.bottom,
2038
- right: gt.right
2039
- }, he = {
2040
- dispose: ue,
2041
- rect: le,
2042
- boundsOfViewArea: ft,
2353
+ const ue = new ke(It, ne);
2354
+ Pe && ue.setObjectType(An.CHART), W.addObject(ue, qt), b.allowTransform !== !1 && W.attachTransformerTo(ue);
2355
+ const he = new yt(), Ct = W.getMainViewport(), { rowHeaderWidth: Ae, columnHeaderHeight: Qe } = z.skeleton, Rt = {
2356
+ top: Qe,
2357
+ left: Ae,
2358
+ bottom: Ct.bottom,
2359
+ right: Ct.right
2360
+ }, ge = {
2361
+ dispose: he,
2362
+ rect: ue,
2363
+ boundsOfViewArea: Rt,
2043
2364
  domAnchor: n,
2044
- unitId: D,
2045
- subUnitId: T
2046
- }, j = ge(le, k.renderUnit.scene, H.skeleton, M.worksheet, he), Ee = new ke(j);
2047
- he.position$ = Ee;
2048
- let Le = {
2049
- position$: Ee,
2050
- id: E,
2365
+ unitId: R,
2366
+ subUnitId: E
2367
+ }, B = fe(ue, K.renderUnit.scene, z.skeleton, M.worksheet, ge), Ne = new je(B);
2368
+ ge.position$ = Ne;
2369
+ let et = {
2370
+ position$: Ne,
2371
+ id: T,
2051
2372
  componentKey: b.componentKey,
2052
2373
  onPointerDown: () => {
2053
2374
  },
@@ -2055,58 +2376,58 @@ let tt = class extends ne {
2055
2376
  },
2056
2377
  onPointerUp: () => {
2057
2378
  },
2058
- onWheel: (W) => {
2059
- be.dispatchEvent(new WheelEvent(W.type, W));
2379
+ onWheel: (k) => {
2380
+ Oe.dispatchEvent(new WheelEvent(k.type, k));
2060
2381
  },
2061
- data: K,
2062
- unitId: D
2382
+ data: J,
2383
+ unitId: R
2063
2384
  };
2064
- e.eventPassThrough && (Le = {
2065
- ...Le,
2066
- onPointerDown: (W) => {
2067
- be.dispatchEvent(new PointerEvent(W.type, W));
2385
+ e.eventPassThrough && (et = {
2386
+ ...et,
2387
+ onPointerDown: (k) => {
2388
+ Oe.dispatchEvent(new PointerEvent(k.type, k));
2068
2389
  },
2069
- onPointerMove: (W) => {
2070
- be.dispatchEvent(new PointerEvent(W.type, W));
2390
+ onPointerMove: (k) => {
2391
+ Oe.dispatchEvent(new PointerEvent(k.type, k));
2071
2392
  },
2072
- onPointerUp: (W) => {
2073
- be.dispatchEvent(new PointerEvent(W.type, W));
2393
+ onPointerUp: (k) => {
2394
+ Oe.dispatchEvent(new PointerEvent(k.type, k));
2074
2395
  }
2075
- }), this._canvasFloatDomService.addFloatDom(Le), this.disposeWithMe(m.subscribe((W) => {
2076
- var un, hn, gn, fn;
2077
- const ln = Ct({
2078
- startX: W.startX,
2079
- startY: W.startY,
2080
- endX: W.endX,
2081
- endY: W.endY,
2082
- width: (un = n.width) != null ? un : W.width,
2083
- height: (hn = n.height) != null ? hn : W.height,
2396
+ }), this._canvasFloatDomService.addFloatDom(et), this.disposeWithMe(p.subscribe((k) => {
2397
+ var Tn, On, Un, Pn;
2398
+ const En = Ut({
2399
+ startX: k.startX,
2400
+ startY: k.startY,
2401
+ endX: k.endX,
2402
+ endY: k.endY,
2403
+ width: (Tn = n.width) != null ? Tn : k.width,
2404
+ height: (On = n.height) != null ? On : k.height,
2084
2405
  absolute: {
2085
- left: p.absolute.left,
2086
- top: p.absolute.top
2406
+ left: m.absolute.left,
2407
+ top: m.absolute.top
2087
2408
  }
2088
- }, n), Rr = Ie({ unitId: D, subUnitId: T, drawingId: E }), br = new Ue(Rr, {
2089
- left: ln.startX,
2090
- top: ln.startY,
2091
- width: (gn = n.width) != null ? gn : W.width,
2092
- height: (fn = n.height) != null ? fn : W.height,
2093
- zIndex: this._drawingManagerService.getDrawingOrder(D, T).length - 1
2094
- }), Mr = ge(br, k.renderUnit.scene, H.skeleton, M.worksheet, he);
2095
- Ee.next(Mr);
2409
+ }, n), Zr = De({ unitId: R, subUnitId: E, drawingId: T }), Jr = new ke(Zr, {
2410
+ left: En.startX,
2411
+ top: En.startY,
2412
+ width: (Un = n.width) != null ? Un : k.width,
2413
+ height: (Pn = n.height) != null ? Pn : k.height,
2414
+ zIndex: this._drawingManagerService.getDrawingOrder(R, E).length - 1
2415
+ }), qr = fe(Jr, K.renderUnit.scene, z.skeleton, M.worksheet, ge);
2416
+ Ne.next(qr);
2096
2417
  }));
2097
- const Ve = (y = this._renderManagerService.getRenderById(D)) == null ? void 0 : y.with(V);
2098
- Ve == null || Ve.currentSkeleton$.subscribe((W) => {
2099
- W && H.sheetId !== W.sheetId && this._removeDom(f, !0);
2418
+ const tt = (y = this._renderManagerService.getRenderById(R)) == null ? void 0 : y.with(X);
2419
+ tt == null || tt.currentSkeleton$.subscribe((k) => {
2420
+ k && z.sheetId !== k.sheetId && this._removeDom(f, !0);
2100
2421
  });
2101
- const mt = le.onTransformChange$.subscribeEvent(() => {
2102
- const W = ge(le, k.renderUnit.scene, H.skeleton, M.worksheet, he);
2103
- Ee.next(
2104
- W
2422
+ const Dt = ue.onTransformChange$.subscribeEvent(() => {
2423
+ const k = fe(ue, K.renderUnit.scene, z.skeleton, M.worksheet, ge);
2424
+ Ne.next(
2425
+ k
2105
2426
  );
2106
2427
  });
2107
- ue.add(() => {
2108
- this._canvasFloatDomService.removeFloatDom(E);
2109
- }), mt && ue.add(mt), this._domLayerInfoMap.set(E, he);
2428
+ he.add(() => {
2429
+ this._canvasFloatDomService.removeFloatDom(T);
2430
+ }), Dt && he.add(Dt), this._domLayerInfoMap.set(T, ge);
2110
2431
  }
2111
2432
  return {
2112
2433
  id: f,
@@ -2117,8 +2438,8 @@ let tt = class extends ne {
2117
2438
  }
2118
2439
  // eslint-disable-next-line max-lines-per-function, complexity
2119
2440
  addFloatDomToColumnHeader(t, e, n, r) {
2120
- var R, S, C;
2121
- const s = se(this._univerInstanceService, {
2441
+ var D, v, C;
2442
+ const s = ae(this._univerInstanceService, {
2122
2443
  unitId: e.unitId,
2123
2444
  subUnitId: e.subUnitId
2124
2445
  });
@@ -2128,153 +2449,153 @@ let tt = class extends ne {
2128
2449
  if (!this._getSceneAndTransformerByDrawingSearch(o)) return;
2129
2450
  const u = this._renderManagerService.getRenderById(o);
2130
2451
  if (!u) return;
2131
- const c = (R = this._renderManagerService.getRenderById(o)) == null ? void 0 : R.with(V).getWorksheetSkeleton(a);
2452
+ const c = (D = this._renderManagerService.getRenderById(o)) == null ? void 0 : D.with(X).getWorksheetSkeleton(a);
2132
2453
  if (!c) return;
2133
- const { componentKey: l, data: g, allowTransform: h = !0 } = e, f = r != null ? r : Qe(), { position: p, position$: m } = this._createRangePositionObserver({
2454
+ const { componentKey: l, data: g, allowTransform: h = !0 } = e, f = r != null ? r : Ve(), { position: m, position$: p } = this._createRangePositionObserver({
2134
2455
  startRow: 0,
2135
2456
  endRow: 0,
2136
2457
  startColumn: t,
2137
2458
  endColumn: t
2138
- }, u, c.skeleton), _ = p;
2139
- if (_.startY = 0, this._getPosition(p, o) == null)
2459
+ }, u, c.skeleton), w = m;
2460
+ if (w.startY = 0, this._getPosition(m, o) == null)
2140
2461
  return;
2141
2462
  const I = {
2142
2463
  unitId: o,
2143
2464
  subUnitId: a,
2144
2465
  drawingId: f,
2145
- drawingType: e.type || B.DRAWING_DOM,
2466
+ drawingType: e.type || x.DRAWING_DOM,
2146
2467
  componentKey: l,
2147
2468
  transform: {
2148
- left: _.startX,
2149
- top: _.startY,
2150
- width: _.width,
2151
- height: _.height
2469
+ left: w.startX,
2470
+ top: w.startY,
2471
+ width: w.width,
2472
+ height: w.height
2152
2473
  },
2153
2474
  data: g,
2154
2475
  allowTransform: h
2155
2476
  };
2156
2477
  {
2157
- const { unitId: w, subUnitId: y, drawingId: D } = I, T = se(this._univerInstanceService, { unitId: w, subUnitId: y }), E = I, M = this._univerInstanceService.getUnit(w, F.UNIVER_SHEET);
2478
+ const { unitId: _, subUnitId: y, drawingId: R } = I, E = ae(this._univerInstanceService, { unitId: _, subUnitId: y }), T = I, M = this._univerInstanceService.getUnit(_, $.UNIVER_SHEET);
2158
2479
  if (!M)
2159
2480
  return;
2160
2481
  const b = M.getActiveSheet().getSheetId();
2161
- if (!E || !T)
2482
+ if (!T || !E)
2162
2483
  return;
2163
- const N = (S = this._renderManagerService.getRenderById(w)) == null ? void 0 : S.with(V);
2484
+ const N = (v = this._renderManagerService.getRenderById(_)) == null ? void 0 : v.with(X);
2164
2485
  if (!N)
2165
2486
  return;
2166
- const x = N.getWorksheetSkeleton(y);
2167
- if (!x)
2487
+ const F = N.getWorksheetSkeleton(y);
2488
+ if (!F)
2168
2489
  return;
2169
- const { transform: q, data: H } = E, L = this._getSceneAndTransformerByDrawingSearch(w);
2170
- if (L == null)
2490
+ const { transform: te, data: z } = T, H = this._getSceneAndTransformerByDrawingSearch(_);
2491
+ if (H == null)
2171
2492
  return;
2172
- const { scene: G, canvas: K } = L;
2173
- if (q == null || b !== y)
2493
+ const { scene: G, canvas: J } = H;
2494
+ if (te == null || b !== y)
2174
2495
  return;
2175
- const { left: k, top: ae, width: be, height: ot, angle: at, flipX: ct, flipY: dt, skewX: jt, skewY: $t } = q, lt = Ie({ unitId: w, subUnitId: y, drawingId: D }), ut = G.getObject(lt);
2176
- if (ut != null) {
2177
- ut.transformByState({ left: k, top: ae, width: be, height: ot, angle: at, flipX: ct, flipY: dt, skewX: jt, skewY: $t });
2496
+ const { left: K, top: W, width: Oe, height: mt, angle: pt, flipX: wt, flipY: _t, skewX: Zt, skewY: Jt } = te, St = De({ unitId: _, subUnitId: y, drawingId: R }), vt = G.getObject(St);
2497
+ if (vt != null) {
2498
+ vt.transformByState({ left: K, top: W, width: Oe, height: mt, angle: pt, flipX: wt, flipY: _t, skewX: Zt, skewY: Jt });
2178
2499
  return;
2179
2500
  }
2180
- const Me = Ct({
2181
- startX: _.startX,
2501
+ const Ue = Ut({
2502
+ startX: w.startX,
2182
2503
  startY: 0,
2183
- endX: p.endX,
2184
- endY: p.endY,
2504
+ endX: m.endX,
2505
+ endY: m.endY,
2185
2506
  width: n.width,
2186
2507
  height: n.height,
2187
2508
  absolute: {
2188
- left: p.absolute.left,
2189
- top: p.absolute.top
2509
+ left: m.absolute.left,
2510
+ top: m.absolute.top
2190
2511
  }
2191
- }, n), ht = {
2192
- left: Me.startX,
2193
- top: Me.startY,
2194
- width: Me.width,
2195
- height: Me.height,
2196
- zIndex: this._drawingManagerService.getDrawingOrder(w, y).length - 1
2197
- }, de = new Ue(lt, ht);
2198
- G.addObject(de, Ft), E.allowTransform !== !1 && G.attachTransformerTo(de);
2199
- const Q = new _t(), ye = G.getMainViewport(), le = {
2512
+ }, n), It = {
2513
+ left: Ue.startX,
2514
+ top: Ue.startY,
2515
+ width: Ue.width,
2516
+ height: Ue.height,
2517
+ zIndex: this._drawingManagerService.getDrawingOrder(_, y).length - 1
2518
+ }, le = new ke(St, It);
2519
+ G.addObject(le, qt), T.allowTransform !== !1 && G.attachTransformerTo(le);
2520
+ const ne = new yt(), Pe = G.getMainViewport(), ue = {
2200
2521
  top: 0,
2201
2522
  //viewMain.top,
2202
- left: ye.left,
2203
- bottom: ye.bottom,
2204
- right: ye.right
2205
- }, ue = {
2206
- dispose: Q,
2207
- rect: de,
2523
+ left: Pe.left,
2524
+ bottom: Pe.bottom,
2525
+ right: Pe.right
2526
+ }, he = {
2527
+ dispose: ne,
2528
+ rect: le,
2208
2529
  // position$,
2209
- unitId: w,
2530
+ unitId: _,
2210
2531
  subUnitId: y,
2211
- boundsOfViewArea: le,
2532
+ boundsOfViewArea: ue,
2212
2533
  domAnchor: n,
2213
2534
  scrollDirectionResponse: "HORIZONTAL"
2214
2535
  /* HORIZONTAL */
2215
- }, gt = ge(de, L.renderUnit.scene, x.skeleton, T.worksheet, ue), Te = new ke(gt);
2216
- ue.position$ = Te;
2217
- let Xe = {
2218
- position$: Te,
2219
- id: D,
2220
- componentKey: E.componentKey,
2536
+ }, Ct = fe(le, H.renderUnit.scene, F.skeleton, E.worksheet, he), Ae = new je(Ct);
2537
+ he.position$ = Ae;
2538
+ let Qe = {
2539
+ position$: Ae,
2540
+ id: R,
2541
+ componentKey: T.componentKey,
2221
2542
  onPointerDown: () => {
2222
2543
  },
2223
2544
  onPointerMove: () => {
2224
2545
  },
2225
2546
  onPointerUp: () => {
2226
2547
  },
2227
- onWheel: (j) => {
2228
- K.dispatchEvent(new WheelEvent(j.type, j));
2548
+ onWheel: (B) => {
2549
+ J.dispatchEvent(new WheelEvent(B.type, B));
2229
2550
  },
2230
- data: H,
2231
- unitId: w
2551
+ data: z,
2552
+ unitId: _
2232
2553
  };
2233
- e.eventPassThrough && (Xe = {
2234
- ...Xe,
2235
- onPointerDown: (j) => {
2236
- K.dispatchEvent(new PointerEvent(j.type, j));
2554
+ e.eventPassThrough && (Qe = {
2555
+ ...Qe,
2556
+ onPointerDown: (B) => {
2557
+ J.dispatchEvent(new PointerEvent(B.type, B));
2237
2558
  },
2238
- onPointerMove: (j) => {
2239
- K.dispatchEvent(new PointerEvent(j.type, j));
2559
+ onPointerMove: (B) => {
2560
+ J.dispatchEvent(new PointerEvent(B.type, B));
2240
2561
  },
2241
- onPointerUp: (j) => {
2242
- K.dispatchEvent(new PointerEvent(j.type, j));
2562
+ onPointerUp: (B) => {
2563
+ J.dispatchEvent(new PointerEvent(B.type, B));
2243
2564
  }
2244
- }), this._canvasFloatDomService.addFloatDom(Xe);
2245
- const ft = de.onTransformChange$.subscribeEvent(() => {
2246
- const j = ge(de, L.renderUnit.scene, x.skeleton, T.worksheet, ue);
2247
- Te.next(
2248
- j
2565
+ }), this._canvasFloatDomService.addFloatDom(Qe);
2566
+ const Rt = le.onTransformChange$.subscribeEvent(() => {
2567
+ const B = fe(le, H.renderUnit.scene, F.skeleton, E.worksheet, he);
2568
+ Ae.next(
2569
+ B
2249
2570
  );
2250
2571
  });
2251
- this.disposeWithMe(m.subscribe((j) => {
2252
- const Ee = Ct({
2253
- startX: j.startX,
2572
+ this.disposeWithMe(p.subscribe((B) => {
2573
+ const Ne = Ut({
2574
+ startX: B.startX,
2254
2575
  startY: 0,
2255
- endX: j.endX,
2256
- endY: j.endY,
2576
+ endX: B.endX,
2577
+ endY: B.endY,
2257
2578
  width: n.width,
2258
2579
  height: n.height,
2259
2580
  absolute: {
2260
- left: p.absolute.left,
2261
- top: p.absolute.top
2581
+ left: m.absolute.left,
2582
+ top: m.absolute.top
2262
2583
  }
2263
- }, n), Le = Ie({ unitId: w, subUnitId: y, drawingId: D }), Ve = new Ue(Le, {
2264
- left: Ee.startX,
2584
+ }, n), et = De({ unitId: _, subUnitId: y, drawingId: R }), tt = new ke(et, {
2585
+ left: Ne.startX,
2265
2586
  top: 0,
2266
2587
  width: n.width,
2267
2588
  height: n.height,
2268
- zIndex: this._drawingManagerService.getDrawingOrder(w, y).length - 1
2269
- }), mt = ge(Ve, L.renderUnit.scene, x.skeleton, T.worksheet, ue);
2270
- Te.next(mt);
2589
+ zIndex: this._drawingManagerService.getDrawingOrder(_, y).length - 1
2590
+ }), Dt = fe(tt, H.renderUnit.scene, F.skeleton, E.worksheet, he);
2591
+ Ae.next(Dt);
2271
2592
  }));
2272
- const he = (C = this._renderManagerService.getRenderById(w)) == null ? void 0 : C.with(V);
2273
- he == null || he.currentSkeleton$.subscribe((j) => {
2274
- j && c.sheetId !== j.sheetId && this._removeDom(f, !0);
2275
- }), Q.add(() => {
2276
- this._canvasFloatDomService.removeFloatDom(D);
2277
- }), ft && Q.add(ft), this._domLayerInfoMap.set(D, ue);
2593
+ const ge = (C = this._renderManagerService.getRenderById(_)) == null ? void 0 : C.with(X);
2594
+ ge == null || ge.currentSkeleton$.subscribe((B) => {
2595
+ B && c.sheetId !== B.sheetId && this._removeDom(f, !0);
2596
+ }), ne.add(() => {
2597
+ this._canvasFloatDomService.removeFloatDom(R);
2598
+ }), Rt && ne.add(Rt), this._domLayerInfoMap.set(R, he);
2278
2599
  }
2279
2600
  return {
2280
2601
  id: f,
@@ -2296,19 +2617,19 @@ let tt = class extends ne {
2296
2617
  // eslint-disable-next-line max-lines-per-function
2297
2618
  _createRangePositionObserver(t, e, n) {
2298
2619
  let { startRow: r, startColumn: s } = t;
2299
- const o = Je(r, s, n), a = new ke(o), d = Je(t.endRow, t.endColumn, n), u = new ke(d), c = () => {
2300
- const m = Je(r, s, n), _ = Je(t.endRow, t.endColumn, n);
2301
- a.next(m), u.next(_);
2302
- }, l = new _t();
2303
- l.add(e.engine.clientRect$.subscribe(() => c())), l.add(this._commandService.onCommandExecuted((m) => {
2304
- if (m.id === gi.id && m.params.rowsAutoHeightInfo.findIndex((v) => v.row === r) > -1) {
2620
+ const o = st(r, s, n), a = new je(o), d = st(t.endRow, t.endColumn, n), u = new je(d), c = () => {
2621
+ const p = st(r, s, n), w = st(t.endRow, t.endColumn, n);
2622
+ a.next(p), u.next(w);
2623
+ }, l = new yt();
2624
+ l.add(e.engine.clientRect$.subscribe(() => c())), l.add(this._commandService.onCommandExecuted((p) => {
2625
+ if (p.id === Fi.id && p.params.rowsAutoHeightInfo.findIndex((S) => S.row === r) > -1) {
2305
2626
  c();
2306
2627
  return;
2307
2628
  }
2308
- (fi.indexOf(m.id) > -1 || m.id === Fr.id || m.id === _n.id) && c();
2629
+ (Li.indexOf(p.id) > -1 || p.id === hi.id || p.id === kn.id) && c();
2309
2630
  }));
2310
- const g = (m, _) => {
2311
- r = m, s = _, c();
2631
+ const g = (p, w) => {
2632
+ r = p, s = w, c();
2312
2633
  }, h = () => ({
2313
2634
  rotate: 0,
2314
2635
  width: d.right - o.left,
@@ -2322,26 +2643,26 @@ let tt = class extends ne {
2322
2643
  endX: d.right,
2323
2644
  endY: d.bottom
2324
2645
  }), f = a.pipe(
2325
- Re((m) => {
2326
- const _ = Je(t.endRow, t.endColumn, n);
2646
+ pe((p) => {
2647
+ const w = st(t.endRow, t.endColumn, n);
2327
2648
  return {
2328
2649
  rotate: 0,
2329
- width: _.right - m.left,
2330
- height: _.bottom - m.top,
2650
+ width: w.right - p.left,
2651
+ height: w.bottom - p.top,
2331
2652
  absolute: {
2332
2653
  left: !0,
2333
2654
  top: !0
2334
2655
  },
2335
- startX: m.left,
2336
- startY: m.top,
2337
- endX: _.right,
2338
- endY: _.bottom
2656
+ startX: p.left,
2657
+ startY: p.top,
2658
+ endX: w.right,
2659
+ endY: w.bottom
2339
2660
  };
2340
2661
  })
2341
- ), p = h();
2662
+ ), m = h();
2342
2663
  return {
2343
2664
  position$: f,
2344
- position: p,
2665
+ position: m,
2345
2666
  updateRowCol: g,
2346
2667
  topLeftPos$: a,
2347
2668
  rightBottomPos$: u,
@@ -2349,16 +2670,16 @@ let tt = class extends ne {
2349
2670
  };
2350
2671
  }
2351
2672
  };
2352
- tt = ys([
2353
- Ce(0, A(J)),
2354
- Ce(1, Se),
2355
- Ce(2, A(X)),
2356
- Ce(3, ie),
2357
- Ce(4, A(Wi)),
2358
- Ce(5, re),
2359
- Ce(6, A(Jr))
2360
- ], tt);
2361
- function Je(i, t, e) {
2673
+ lt = oo([
2674
+ be(0, A(Q)),
2675
+ be(1, de),
2676
+ be(2, A(Y)),
2677
+ be(3, oe),
2678
+ be(4, A(us)),
2679
+ be(5, se),
2680
+ be(6, A(Ri))
2681
+ ], lt);
2682
+ function st(i, t, e) {
2362
2683
  const n = e.getCellWithCoordByIndex(i, t), r = n.isMergedMainCell ? n.mergeInfo : n;
2363
2684
  return {
2364
2685
  left: r.startX,
@@ -2367,22 +2688,22 @@ function Je(i, t, e) {
2367
2688
  bottom: r.endY
2368
2689
  };
2369
2690
  }
2370
- function Ct(i, t, e) {
2691
+ function Ut(i, t, e) {
2371
2692
  var u, c;
2372
2693
  e = e != null ? e : 1;
2373
2694
  const n = i.endX - i.startX, r = i.endY - i.startY, s = (u = t == null ? void 0 : t.width) != null ? u : n, o = (c = t == null ? void 0 : t.height) != null ? c : r;
2374
2695
  let a = 0, d = 0;
2375
2696
  if (t) {
2376
2697
  if (t.horizonOffsetAlign === "right") {
2377
- const l = Dt(t.marginX, n * e);
2698
+ const l = Pt(t.marginX, n * e);
2378
2699
  a = i.endX - l - s;
2379
2700
  } else
2380
- a = i.startX + Dt(t.marginX, n);
2701
+ a = i.startX + Pt(t.marginX, n);
2381
2702
  if (t.verticalOffsetAlign === "bottom") {
2382
- const l = Dt(t.marginY, r * e);
2703
+ const l = Pt(t.marginY, r * e);
2383
2704
  d = i.endY - l - o;
2384
2705
  } else
2385
- d = i.startY + Dt(t.marginY, r);
2706
+ d = i.startY + Pt(t.marginY, r);
2386
2707
  }
2387
2708
  return {
2388
2709
  rotate: 0,
@@ -2398,15 +2719,15 @@ function Ct(i, t, e) {
2398
2719
  }
2399
2720
  };
2400
2721
  }
2401
- function Dt(i, t) {
2722
+ function Pt(i, t) {
2402
2723
  if (i === void 0) return 0;
2403
2724
  if (typeof i == "number") return i;
2404
2725
  const e = Number.parseFloat(i);
2405
2726
  return t * e / 100;
2406
2727
  }
2407
- const Ts = (i) => {
2408
- const { floatDomInfos: t, scene: e, skeleton: n, worksheet: r } = i, s = Qi(() => t.map((o) => {
2409
- const { width: a, height: d, angle: u, left: c, top: l } = o.transform, g = Ir(
2728
+ const co = (i) => {
2729
+ const { floatDomInfos: t, scene: e, skeleton: n, worksheet: r } = i, s = Fe(() => t.map((o) => {
2730
+ const { width: a, height: d, angle: u, left: c, top: l } = o.transform, g = Hr(
2410
2731
  {
2411
2732
  left: c != null ? c : 0,
2412
2733
  right: (c != null ? c : 0) + (a != null ? a : 0),
@@ -2418,7 +2739,7 @@ const Ts = (i) => {
2418
2739
  r,
2419
2740
  void 0,
2420
2741
  !0
2421
- ), { scaleX: h, scaleY: f } = e.getAncestorScale(), p = {
2742
+ ), { scaleX: h, scaleY: f } = e.getAncestorScale(), m = {
2422
2743
  startX: g.left,
2423
2744
  endX: g.right,
2424
2745
  startY: g.top,
@@ -2427,9 +2748,9 @@ const Ts = (i) => {
2427
2748
  width: a * h,
2428
2749
  height: d * f,
2429
2750
  absolute: g.absolute
2430
- }, m = {
2431
- position$: new ke(p),
2432
- position: p,
2751
+ }, p = {
2752
+ position$: new je(m),
2753
+ position: m,
2433
2754
  id: o.drawingId,
2434
2755
  componentKey: o.componentKey,
2435
2756
  onPointerMove: () => {
@@ -2443,16 +2764,16 @@ const Ts = (i) => {
2443
2764
  unitId: o.unitId,
2444
2765
  data: o.data
2445
2766
  };
2446
- return [o.drawingId, m];
2767
+ return [o.drawingId, p];
2447
2768
  }), [t, e, n, r]);
2448
- 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)) });
2769
+ return /* @__PURE__ */ L("div", { style: { position: "absolute", top: 0, left: 0 }, children: s.map(([o, a]) => /* @__PURE__ */ L(hs, { layer: a, id: o, position: a.position }, o)) });
2449
2770
  };
2450
- var Es = Object.getOwnPropertyDescriptor, Os = (i, t, e, n) => {
2451
- for (var r = n > 1 ? void 0 : n ? Es(t, e) : t, s = i.length - 1, o; s >= 0; s--)
2771
+ var lo = Object.getOwnPropertyDescriptor, uo = (i, t, e, n) => {
2772
+ for (var r = n > 1 ? void 0 : n ? lo(t, e) : t, s = i.length - 1, o; s >= 0; s--)
2452
2773
  (o = i[s]) && (r = o(r) || r);
2453
2774
  return r;
2454
- }, De = (i, t) => (e, n) => t(e, n, i);
2455
- let Ot = class extends ne {
2775
+ }, Me = (i, t) => (e, n) => t(e, n, i);
2776
+ let jt = class extends ee {
2456
2777
  constructor(i, t, e, n, r, s, o) {
2457
2778
  super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = t, this._drawingManagerService = e, this._renderManagerService = n, this._canvasFloatDomManagerService = r, this._componetManager = s, this._injector = o, this._initPrinting(), this._initPrintingDom();
2458
2779
  }
@@ -2465,7 +2786,7 @@ let Ot = class extends ne {
2465
2786
  const { unitId: n, scene: r, subUnitId: s } = t, o = this._drawingManagerService.getDrawingDataForUnit(n), a = o == null ? void 0 : o[s];
2466
2787
  return a && a.order.forEach((d) => {
2467
2788
  const u = a.data[d];
2468
- u.drawingType !== B.DRAWING_CHART && u.drawingType !== B.DRAWING_DOM && this._drawingRenderService.renderDrawing(u, r);
2789
+ u.drawingType !== x.DRAWING_CHART && u.drawingType !== x.DRAWING_DOM && this._drawingRenderService.renderDrawing(u, r);
2469
2790
  }), e();
2470
2791
  }
2471
2792
  }
@@ -2478,7 +2799,7 @@ let Ot = class extends ne {
2478
2799
  const { unitId: n, subUnitId: r } = t, s = this._renderManagerService.getRenderById(n);
2479
2800
  if (!s)
2480
2801
  return e(i);
2481
- const o = s.with(V).getSkeletonParam(r);
2802
+ const o = s.with(X).getSkeletonParam(r);
2482
2803
  if (!o)
2483
2804
  return e(i);
2484
2805
  const a = this._drawingManagerService.getDrawingDataForUnit(n), d = a == null ? void 0 : a[t.subUnitId];
@@ -2486,9 +2807,9 @@ let Ot = class extends ne {
2486
2807
  return e(i);
2487
2808
  const { scaleX: u, scaleY: c } = s.scene, l = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, g = d.order.map((h) => d.data[h]);
2488
2809
  return g.length ? (g.forEach((h) => {
2489
- if (!h.groupId && h.transform && je.isDefine(h.transform.left) && je.isDefine(h.transform.top) && je.isDefine(h.transform.width) && je.isDefine(h.transform.height)) {
2490
- const f = o.skeleton.getCellIndexByOffset(h.transform.left, h.transform.top, u, c, { x: 0, y: 0 }), p = o.skeleton.getCellIndexByOffset(h.transform.left + h.transform.width, h.transform.top + h.transform.height, u, c, { x: 0, y: 0 });
2491
- f.column < l.startColumn && (l.startColumn = f.column), f.row < l.startRow && (l.startRow = f.row), l.endRow < p.row && (l.endRow = p.row), l.endColumn < p.column && (l.endColumn = p.column);
2810
+ if (!h.groupId && h.transform && Ye.isDefine(h.transform.left) && Ye.isDefine(h.transform.top) && Ye.isDefine(h.transform.width) && Ye.isDefine(h.transform.height)) {
2811
+ const f = o.skeleton.getCellIndexByOffset(h.transform.left, h.transform.top, u, c, { x: 0, y: 0 }), m = o.skeleton.getCellIndexByOffset(h.transform.left + h.transform.width, h.transform.top + h.transform.height, u, c, { x: 0, y: 0 });
2812
+ f.column < l.startColumn && (l.startColumn = f.column), f.row < l.startRow && (l.startRow = f.row), l.endRow < m.row && (l.endRow = m.row), l.endColumn < m.column && (l.endColumn = m.column);
2492
2813
  }
2493
2814
  }), e(l)) : e(i);
2494
2815
  }
@@ -2506,12 +2827,12 @@ let Ot = class extends ne {
2506
2827
  if (o) {
2507
2828
  const a = o.order.map((u) => {
2508
2829
  const c = o.data[u];
2509
- if (c.drawingType === B.DRAWING_CHART)
2830
+ if (c.drawingType === x.DRAWING_CHART)
2510
2831
  return {
2511
2832
  ...c,
2512
- componentKey: this._componetManager.get(Qr)
2833
+ componentKey: this._componetManager.get(Mi)
2513
2834
  };
2514
- if (c.drawingType === B.DRAWING_DOM) {
2835
+ if (c.drawingType === x.DRAWING_DOM) {
2515
2836
  const l = this._sheetPrintInterceptorService.getPrintComponent(c.componentKey);
2516
2837
  return {
2517
2838
  ...c,
@@ -2519,12 +2840,12 @@ let Ot = class extends ne {
2519
2840
  };
2520
2841
  }
2521
2842
  return null;
2522
- }).filter(Boolean), d = ji(Ts, this._injector);
2523
- return Di(
2524
- /* @__PURE__ */ oe(d, { floatDomInfos: a, scene: t.scene, skeleton: t.skeleton, worksheet: t.worksheet }),
2843
+ }).filter(Boolean), d = gs(co, this._injector);
2844
+ return Ji(
2845
+ /* @__PURE__ */ L(d, { floatDomInfos: a, scene: t.scene, skeleton: t.skeleton, worksheet: t.worksheet }),
2525
2846
  t.root
2526
2847
  ), i == null || i.add(() => {
2527
- Ri(t.root);
2848
+ qi(t.root);
2528
2849
  }), e(i);
2529
2850
  }
2530
2851
  }
@@ -2533,49 +2854,49 @@ let Ot = class extends ne {
2533
2854
  );
2534
2855
  }
2535
2856
  };
2536
- Ot = Os([
2537
- De(0, A(xr)),
2538
- De(1, A(lr)),
2539
- De(2, ie),
2540
- De(3, J),
2541
- De(4, A(tt)),
2542
- De(5, A(dr)),
2543
- De(6, A(Ge))
2544
- ], Ot);
2545
- var Us = Object.getOwnPropertyDescriptor, Ps = (i, t, e, n) => {
2546
- for (var r = n > 1 ? void 0 : n ? Us(t, e) : t, s = i.length - 1, o; s >= 0; s--)
2857
+ jt = uo([
2858
+ Me(0, A(gi)),
2859
+ Me(1, A(Pr)),
2860
+ Me(2, oe),
2861
+ Me(3, Q),
2862
+ Me(4, A(lt)),
2863
+ Me(5, A(Ur)),
2864
+ Me(6, A(qe))
2865
+ ], jt);
2866
+ var ho = Object.getOwnPropertyDescriptor, go = (i, t, e, n) => {
2867
+ for (var r = n > 1 ? void 0 : n ? ho(t, e) : t, s = i.length - 1, o; s >= 0; s--)
2547
2868
  (o = i[s]) && (r = o(r) || r);
2548
2869
  return r;
2549
- }, me = (i, t) => (e, n) => t(e, n, i);
2550
- const As = [
2551
- Ln.id,
2552
- Vn.id,
2553
- Hn.id,
2554
- zn.id,
2555
- Kn.id,
2556
- Jn.id,
2557
- Zn.id,
2558
- qn.id,
2559
- Jt.id,
2560
- Zt.id,
2561
- Qn.id,
2562
- er.id,
2563
- tr.id,
2564
- nr.id,
2565
- rr.id,
2566
- ir.id,
2567
- sr.id,
2568
- or.id,
2569
- ar.id
2570
- ], Ns = [
2571
- mi.id,
2572
- pi.id,
2573
- wi.id,
2574
- _i.id,
2575
- Si.id,
2576
- vi.id
2870
+ }, _e = (i, t) => (e, n) => t(e, n, i);
2871
+ const fo = [
2872
+ gr.id,
2873
+ fr.id,
2874
+ mr.id,
2875
+ pr.id,
2876
+ wr.id,
2877
+ _r.id,
2878
+ Sr.id,
2879
+ vr.id,
2880
+ mn.id,
2881
+ pn.id,
2882
+ Ir.id,
2883
+ Cr.id,
2884
+ Rr.id,
2885
+ Dr.id,
2886
+ br.id,
2887
+ Mr.id,
2888
+ yr.id,
2889
+ Er.id,
2890
+ Tr.id
2891
+ ], mo = [
2892
+ Vi.id,
2893
+ Hi.id,
2894
+ Yi.id,
2895
+ Gi.id,
2896
+ Xi.id,
2897
+ zi.id
2577
2898
  ];
2578
- let rn = class extends ne {
2899
+ let Rn = class extends ee {
2579
2900
  constructor(i, t, e, n, r, s, o, a, d) {
2580
2901
  super(), this._context = i, this._renderManagerService = t, this._commandService = e, this._selectionRenderService = n, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService = a, this._univerInstanceService = d, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
2581
2902
  }
@@ -2584,57 +2905,57 @@ let rn = class extends ne {
2584
2905
  this._sheetInterceptorService.interceptAfterCommand({
2585
2906
  /* eslint-disable-next-line complexity */
2586
2907
  getMutations: (i) => {
2587
- if (!As.includes(i.id))
2908
+ if (!fo.includes(i.id))
2588
2909
  return { redos: [], undos: [] };
2589
2910
  if (i.params == null)
2590
2911
  return { redos: [], undos: [] };
2591
2912
  const t = i.id;
2592
- if (t === Ln.id)
2913
+ if (t === gr.id)
2593
2914
  return this._moveRowInterceptor(i.params, "insert");
2594
- if ([sr.id, or.id, ar.id].includes(t))
2915
+ if ([yr.id, Er.id, Tr.id].includes(t))
2595
2916
  return this._moveRangeInterceptor(i.params);
2596
- if (t === Vn.id)
2917
+ if (t === fr.id)
2597
2918
  return this._moveColInterceptor(i.params, "insert");
2598
- if (t === Hn.id)
2919
+ if (t === mr.id)
2599
2920
  return this._moveRowInterceptor(i.params, "remove");
2600
- if (t === zn.id)
2921
+ if (t === pr.id)
2601
2922
  return this._moveColInterceptor(i.params, "remove");
2602
- if (t === Kn.id) {
2923
+ if (t === wr.id) {
2603
2924
  const { range: e } = i.params;
2604
2925
  return this._getRangeMoveUndo(
2605
2926
  e,
2606
2927
  0
2607
2928
  /* deleteLeft */
2608
2929
  );
2609
- } else if (t === Jn.id) {
2930
+ } else if (t === _r.id) {
2610
2931
  const { range: e } = i.params;
2611
2932
  return this._getRangeMoveUndo(
2612
2933
  e,
2613
2934
  1
2614
2935
  /* deleteUp */
2615
2936
  );
2616
- } else if (t === Zn.id) {
2937
+ } else if (t === Sr.id) {
2617
2938
  const { range: e } = i.params;
2618
2939
  return this._getRangeMoveUndo(
2619
2940
  e,
2620
2941
  2
2621
2942
  /* insertDown */
2622
2943
  );
2623
- } else if (t === qn.id) {
2944
+ } else if (t === vr.id) {
2624
2945
  const { range: e } = i.params;
2625
2946
  return this._getRangeMoveUndo(
2626
2947
  e,
2627
2948
  3
2628
2949
  /* insertRight */
2629
2950
  );
2630
- } else if (t === tr.id || t === nr.id) {
2951
+ } else if (t === Rr.id || t === Dr.id) {
2631
2952
  const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
2632
2953
  return this._getDrawingUndoForRowVisible(n, r, s);
2633
- } else if (t === rr.id || t === ir.id) {
2954
+ } else if (t === br.id || t === Mr.id) {
2634
2955
  const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e;
2635
2956
  return this._getDrawingUndoForColVisible(n, r, s);
2636
- } else if (t === Jt.id || t === Zt.id || t === Qn.id || t === er.id) {
2637
- const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e, o = t === Jt.id || t === Zt.id;
2957
+ } else if (t === mn.id || t === pn.id || t === Ir.id || t === Cr.id) {
2958
+ const e = i.params, { unitId: n, subUnitId: r, ranges: s } = e, o = t === mn.id || t === pn.id;
2638
2959
  return this._getDrawingUndoForRowAndColSize(n, r, s, o);
2639
2960
  }
2640
2961
  return { redos: [], undos: [] };
@@ -2643,7 +2964,7 @@ let rn = class extends ne {
2643
2964
  );
2644
2965
  }
2645
2966
  _getRangeMoveUndo(i, t) {
2646
- const e = se(this._univerInstanceService);
2967
+ const e = ae(this._univerInstanceService);
2647
2968
  if (e == null)
2648
2969
  return { redos: [], undos: [] };
2649
2970
  const n = e.unitId, r = e.subUnitId, s = [], o = [], a = this._sheetDrawingService.getDrawingData(n, r), d = [], u = [];
@@ -2660,49 +2981,49 @@ let rn = class extends ne {
2660
2981
  const c = this._sheetDrawingService.getBatchRemoveOp(u), l = c.undo, g = c.redo, h = c.objects;
2661
2982
  s.push({ id: P.id, params: { unitId: n, subUnitId: r, op: g, objects: h, type: U.REMOVE } }), o.push({ id: P.id, params: { unitId: n, subUnitId: r, op: l, objects: h, type: U.INSERT } });
2662
2983
  }
2663
- return s.push({ id: Y.id, params: [n] }), o.push({ id: Y.id, params: [n] }), {
2984
+ return s.push({ id: V.id, params: [n] }), o.push({ id: V.id, params: [n] }), {
2664
2985
  redos: s,
2665
2986
  undos: o
2666
2987
  };
2667
2988
  }
2668
2989
  _getUpdateOrDeleteDrawings(i, t, e) {
2669
- const n = [], r = [], { sheetTransform: s, anchorType: o = O.Position, transform: a, unitId: d, subUnitId: u, drawingId: c } = e, { from: l, to: g } = s, { row: h, column: f } = l, { row: p, column: m } = g;
2990
+ const n = [], r = [], { sheetTransform: s, anchorType: o = O.Position, transform: a, unitId: d, subUnitId: u, drawingId: c } = e, { from: l, to: g } = s, { row: h, column: f } = l, { row: m, column: p } = g;
2670
2991
  if (s == null || a == null)
2671
2992
  return {
2672
2993
  updateDrawings: n,
2673
2994
  deleteDrawings: r
2674
2995
  };
2675
- const { startRow: _, endRow: v, startColumn: I, endColumn: R } = i;
2676
- let S = null, C = null;
2677
- if (t === 0 && h >= _ && p <= v)
2678
- if (f >= I && m <= R)
2996
+ const { startRow: w, endRow: S, startColumn: I, endColumn: D } = i;
2997
+ let v = null, C = null;
2998
+ if (t === 0 && h >= w && m <= S)
2999
+ if (f >= I && p <= D)
2679
3000
  r.push({ unitId: d, subUnitId: u, drawingId: c });
2680
3001
  else {
2681
- const w = this._shrinkCol(s, a, I, R, o);
2682
- S = w == null ? void 0 : w.newSheetTransform, C = w == null ? void 0 : w.newTransform;
3002
+ const _ = this._shrinkCol(s, a, I, D, o);
3003
+ v = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
2683
3004
  }
2684
- else if (t === 1 && f >= I && m <= R)
2685
- if (h >= _ && p <= v)
3005
+ else if (t === 1 && f >= I && p <= D)
3006
+ if (h >= w && m <= S)
2686
3007
  r.push({ unitId: d, subUnitId: u, drawingId: c });
2687
3008
  else {
2688
- const w = this._shrinkRow(s, a, _, v, o);
2689
- S = w == null ? void 0 : w.newSheetTransform, C = w == null ? void 0 : w.newTransform;
3009
+ const _ = this._shrinkRow(s, a, w, S, o);
3010
+ v = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
2690
3011
  }
2691
3012
  else if (t === 2) {
2692
- const w = this._expandRow(s, a, _, v, o);
2693
- S = w == null ? void 0 : w.newSheetTransform, C = w == null ? void 0 : w.newTransform;
3013
+ const _ = this._expandRow(s, a, w, S, o);
3014
+ v = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
2694
3015
  } else if (t === 3) {
2695
- const w = this._expandCol(s, a, I, R, o);
2696
- S = w == null ? void 0 : w.newSheetTransform, C = w == null ? void 0 : w.newTransform;
3016
+ const _ = this._expandCol(s, a, I, D, o);
3017
+ v = _ == null ? void 0 : _.newSheetTransform, C = _ == null ? void 0 : _.newTransform;
2697
3018
  }
2698
- if (S != null && C != null) {
2699
- const w = z(S, this._selectionRenderService, this._skeletonManagerService);
2700
- n.push({ ...e, sheetTransform: S, transform: w });
3019
+ if (v != null && C != null) {
3020
+ const _ = Z(v, this._selectionRenderService, this._skeletonManagerService);
3021
+ n.push({ ...e, sheetTransform: v, transform: _ });
2701
3022
  }
2702
3023
  return { updateDrawings: n, deleteDrawings: r };
2703
3024
  }
2704
3025
  _remainDrawingSize(i, t, e) {
2705
- const n = $({ ...i }, this._selectionRenderService);
3026
+ const n = j({ ...i }, this._selectionRenderService);
2706
3027
  n != null && t.push({
2707
3028
  ...e,
2708
3029
  sheetTransform: n
@@ -2716,31 +3037,31 @@ let rn = class extends ne {
2716
3037
  if (f === O.None)
2717
3038
  this._remainDrawingSize(h, r, l);
2718
3039
  else {
2719
- const { from: p, to: m } = g, { row: _, column: v } = p, { row: I, column: R } = m;
2720
- for (let S = 0; S < e.length; S++) {
2721
- const C = e[S], { startRow: w, endRow: y, startColumn: D, endColumn: T } = C;
2722
- if (R < D)
3040
+ const { from: m, to: p } = g, { row: w, column: S } = m, { row: I, column: D } = p;
3041
+ for (let v = 0; v < e.length; v++) {
3042
+ const C = e[v], { startRow: _, endRow: y, startColumn: R, endColumn: E } = C;
3043
+ if (D < R)
2723
3044
  continue;
2724
3045
  if (f === O.Position) {
2725
3046
  let b = null, N = null;
2726
- if (v >= D && v <= T) {
2727
- const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: v, endColumn: T, startRow: p.row, endRow: m.row });
2728
- if (x == null)
3047
+ if (S >= R && S <= E) {
3048
+ const F = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: E, startRow: m.row, endRow: p.row });
3049
+ if (F == null)
2729
3050
  return;
2730
- N = { ...h, left: x.startX };
3051
+ N = { ...h, left: F.startX };
2731
3052
  }
2732
- if (N != null && (b = $(N, this._selectionRenderService), b != null && N != null)) {
3053
+ if (N != null && (b = j(N, this._selectionRenderService), b != null && N != null)) {
2733
3054
  r.push({ ...l, sheetTransform: b, transform: N });
2734
3055
  break;
2735
3056
  }
2736
3057
  this._remainDrawingSize(h, r, l);
2737
3058
  continue;
2738
3059
  }
2739
- if (v >= D && R <= T)
3060
+ if (S >= R && D <= E)
2740
3061
  continue;
2741
- let E = null, M = null;
2742
- if (v >= D && v <= T) {
2743
- const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: v, endColumn: T, startRow: p.row, endRow: m.row });
3062
+ let T = null, M = null;
3063
+ if (S >= R && S <= E) {
3064
+ const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: S, endColumn: E, startRow: m.row, endRow: p.row });
2744
3065
  if (b == null)
2745
3066
  return;
2746
3067
  M = {
@@ -2748,8 +3069,8 @@ let rn = class extends ne {
2748
3069
  left: (b == null ? void 0 : b.startX) || 0,
2749
3070
  width: ((h == null ? void 0 : h.width) || 0) - b.endX + b.startX
2750
3071
  };
2751
- } else if (R >= D && R <= T) {
2752
- const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: D, endColumn: R, startRow: p.row, endRow: m.row });
3072
+ } else if (D >= R && D <= E) {
3073
+ const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: R, endColumn: D, startRow: m.row, endRow: p.row });
2753
3074
  if (b == null)
2754
3075
  return;
2755
3076
  M = {
@@ -2757,19 +3078,19 @@ let rn = class extends ne {
2757
3078
  left: b.startX - ((h == null ? void 0 : h.width) || 0)
2758
3079
  };
2759
3080
  } else {
2760
- const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: D, endColumn: T, startRow: p.row, endRow: m.row });
3081
+ const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: R, endColumn: E, startRow: m.row, endRow: p.row });
2761
3082
  if (b == null)
2762
3083
  return;
2763
3084
  if (M = {
2764
3085
  ...h,
2765
3086
  width: ((h == null ? void 0 : h.width) || 0) - b.endX + b.startX
2766
- }, E = $(M, this._selectionRenderService), E != null && M != null) {
2767
- s.push({ ...l, sheetTransform: E, transform: M });
3087
+ }, T = j(M, this._selectionRenderService), T != null && M != null) {
3088
+ s.push({ ...l, sheetTransform: T, transform: M });
2768
3089
  break;
2769
3090
  }
2770
3091
  }
2771
- if (M != null && (E = $(M, this._selectionRenderService)), M != null && E != null) {
2772
- r.push({ ...l, sheetTransform: E, transform: M });
3092
+ if (M != null && (T = j(M, this._selectionRenderService)), M != null && T != null) {
3093
+ r.push({ ...l, sheetTransform: T, transform: M });
2773
3094
  break;
2774
3095
  } else
2775
3096
  this._remainDrawingSize(h, r, l);
@@ -2792,10 +3113,10 @@ let rn = class extends ne {
2792
3113
  _createUndoAndRedoMutation(i, t, e) {
2793
3114
  const n = this._sheetDrawingService.getBatchUpdateOp(e), { undo: r, redo: s, objects: o } = n, a = [
2794
3115
  { id: P.id, params: { unitId: i, subUnitId: t, op: s, objects: o, type: U.UPDATE } },
2795
- { id: Y.id, params: [i] }
3116
+ { id: V.id, params: [i] }
2796
3117
  ], d = [
2797
3118
  { id: P.id, params: { unitId: i, subUnitId: t, op: r, objects: o, type: U.UPDATE } },
2798
- { id: Y.id, params: [i] }
3119
+ { id: V.id, params: [i] }
2799
3120
  ];
2800
3121
  return {
2801
3122
  redos: a,
@@ -2810,31 +3131,31 @@ let rn = class extends ne {
2810
3131
  if (f === O.None)
2811
3132
  this._remainDrawingSize(h, r, l);
2812
3133
  else {
2813
- const { from: p, to: m } = g, { row: _, column: v } = p, { row: I, column: R } = m;
2814
- for (let S = 0; S < e.length; S++) {
2815
- const C = e[S], { startRow: w, endRow: y, startColumn: D, endColumn: T } = C;
2816
- if (I < w)
3134
+ const { from: m, to: p } = g, { row: w, column: S } = m, { row: I, column: D } = p;
3135
+ for (let v = 0; v < e.length; v++) {
3136
+ const C = e[v], { startRow: _, endRow: y, startColumn: R, endColumn: E } = C;
3137
+ if (I < _)
2817
3138
  continue;
2818
3139
  if (f === O.Position) {
2819
3140
  let b = null, N = null;
2820
- if (_ >= w && _ <= y) {
2821
- const x = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: _, endRow: y });
2822
- if (x == null)
3141
+ if (w >= _ && w <= y) {
3142
+ const F = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: w, endRow: y });
3143
+ if (F == null)
2823
3144
  return;
2824
- N = { ...h, top: x.startY };
3145
+ N = { ...h, top: F.startY };
2825
3146
  }
2826
- if (N != null && (b = $(N, this._selectionRenderService), b != null && N != null)) {
3147
+ if (N != null && (b = j(N, this._selectionRenderService), b != null && N != null)) {
2827
3148
  r.push({ ...l, sheetTransform: b, transform: N });
2828
3149
  break;
2829
3150
  }
2830
3151
  this._remainDrawingSize(h, r, l);
2831
3152
  continue;
2832
3153
  }
2833
- if (_ >= w && I <= y)
3154
+ if (w >= _ && I <= y)
2834
3155
  continue;
2835
- let E = null, M = null;
2836
- if (_ >= w && _ <= y) {
2837
- const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: _, endRow: y });
3156
+ let T = null, M = null;
3157
+ if (w >= _ && w <= y) {
3158
+ const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: w, endRow: y });
2838
3159
  if (b == null)
2839
3160
  return;
2840
3161
  M = {
@@ -2842,8 +3163,8 @@ let rn = class extends ne {
2842
3163
  top: (b == null ? void 0 : b.startY) || 0,
2843
3164
  height: ((h == null ? void 0 : h.height) || 0) - b.endY + b.startY
2844
3165
  };
2845
- } else if (I >= w && I <= y) {
2846
- const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: w, endRow: I });
3166
+ } else if (I >= _ && I <= y) {
3167
+ const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: _, endRow: I });
2847
3168
  if (b == null)
2848
3169
  return;
2849
3170
  M = {
@@ -2851,19 +3172,19 @@ let rn = class extends ne {
2851
3172
  top: b.startY - ((h == null ? void 0 : h.height) || 0)
2852
3173
  };
2853
3174
  } else {
2854
- const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: m.column, startRow: w, endRow: y });
3175
+ const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: m.column, endColumn: p.column, startRow: _, endRow: y });
2855
3176
  if (b == null)
2856
3177
  return;
2857
3178
  if (M = {
2858
3179
  ...h,
2859
3180
  height: ((h == null ? void 0 : h.height) || 0) - b.endY + b.startY
2860
- }, E = $(M, this._selectionRenderService), E != null && M != null) {
2861
- s.push({ ...l, sheetTransform: E, transform: M });
3181
+ }, T = j(M, this._selectionRenderService), T != null && M != null) {
3182
+ s.push({ ...l, sheetTransform: T, transform: M });
2862
3183
  break;
2863
3184
  }
2864
3185
  }
2865
- if (M != null && (E = $(M, this._selectionRenderService)), M != null && E != null) {
2866
- r.push({ ...l, sheetTransform: E, transform: M });
3186
+ if (M != null && (T = j(M, this._selectionRenderService)), M != null && T != null) {
3187
+ r.push({ ...l, sheetTransform: T, transform: M });
2867
3188
  break;
2868
3189
  } else
2869
3190
  this._remainDrawingSize(h, r, l);
@@ -2890,20 +3211,20 @@ let rn = class extends ne {
2890
3211
  if (c === O.None)
2891
3212
  this._remainDrawingSize(u, s, a);
2892
3213
  else {
2893
- const { from: l, to: g } = d, { row: h, column: f } = l, { row: p, column: m } = g;
2894
- for (let _ = 0; _ < e.length; _++) {
2895
- const v = e[_], { startRow: I, endRow: R, startColumn: S, endColumn: C } = v;
2896
- if (p < I || m < S)
3214
+ const { from: l, to: g } = d, { row: h, column: f } = l, { row: m, column: p } = g;
3215
+ for (let w = 0; w < e.length; w++) {
3216
+ const S = e[w], { startRow: I, endRow: D, startColumn: v, endColumn: C } = S;
3217
+ if (m < I || p < v)
2897
3218
  continue;
2898
- if (c === O.Position && (h <= I && p >= R || f <= S && m >= C)) {
3219
+ if (c === O.Position && (h <= I && m >= D || f <= v && p >= C)) {
2899
3220
  this._remainDrawingSize(u, s, a);
2900
3221
  continue;
2901
3222
  }
2902
- const w = z({ ...d }, this._selectionRenderService, this._skeletonManagerService);
2903
- if (w != null) {
3223
+ const _ = Z({ ...d }, this._selectionRenderService, this._skeletonManagerService);
3224
+ if (_ != null) {
2904
3225
  s.push({
2905
3226
  ...a,
2906
- transform: w
3227
+ transform: _
2907
3228
  });
2908
3229
  break;
2909
3230
  }
@@ -2916,7 +3237,7 @@ let rn = class extends ne {
2916
3237
  if (t === "insert")
2917
3238
  e = i.unitId, n = i.subUnitId;
2918
3239
  else {
2919
- const r = se(this._univerInstanceService);
3240
+ const r = ae(this._univerInstanceService);
2920
3241
  if (r == null)
2921
3242
  return;
2922
3243
  e = r.unitId, n = r.subUnitId;
@@ -2924,50 +3245,50 @@ let rn = class extends ne {
2924
3245
  return { unitId: e, subUnitId: n };
2925
3246
  }
2926
3247
  _moveRangeInterceptor(i) {
2927
- var I, R;
2928
- const { toRange: t, fromRange: e } = i, n = se(this._univerInstanceService);
3248
+ var I, D;
3249
+ const { toRange: t, fromRange: e } = i, n = ae(this._univerInstanceService);
2929
3250
  if (!n)
2930
3251
  return { redos: [], undos: [] };
2931
- const { unitId: r, subUnitId: s } = n, o = (R = (I = this._renderManagerService.getRenderById(r)) == null ? void 0 : I.with(V)) == null ? void 0 : R.getCurrentSkeleton();
3252
+ const { unitId: r, subUnitId: s } = n, o = (D = (I = this._renderManagerService.getRenderById(r)) == null ? void 0 : I.with(X)) == null ? void 0 : D.getCurrentSkeleton();
2932
3253
  if (!o)
2933
3254
  return { redos: [], undos: [] };
2934
- const a = Yn(o, e);
3255
+ const a = dr(o, e);
2935
3256
  if (!a)
2936
3257
  return { redos: [], undos: [] };
2937
3258
  const { startX: d, endX: u, startY: c, endY: l } = a, g = this._sheetDrawingService.getDrawingData(r, s), h = [];
2938
- Object.keys(g).forEach((S) => {
2939
- const C = g[S];
3259
+ Object.keys(g).forEach((v) => {
3260
+ const C = g[v];
2940
3261
  if (C.anchorType !== O.Both)
2941
3262
  return;
2942
- const { transform: w } = C;
2943
- if (!w)
3263
+ const { transform: _ } = C;
3264
+ if (!_)
2944
3265
  return;
2945
- const { left: y = 0, top: D = 0, width: T = 0, height: E = 0 } = w, { drawingStartX: M, drawingEndX: b, drawingStartY: N, drawingEndY: x } = {
3266
+ const { left: y = 0, top: R = 0, width: E = 0, height: T = 0 } = _, { drawingStartX: M, drawingEndX: b, drawingStartY: N, drawingEndY: F } = {
2946
3267
  drawingStartX: y,
2947
- drawingEndX: y + T,
2948
- drawingStartY: D,
2949
- drawingEndY: D + E
3268
+ drawingEndX: y + E,
3269
+ drawingStartY: R,
3270
+ drawingEndY: R + T
2950
3271
  };
2951
- d <= M && b <= u && c <= N && x <= l && h.push(C);
3272
+ d <= M && b <= u && c <= N && F <= l && h.push(C);
2952
3273
  });
2953
- const f = [], p = [], m = t.startRow - e.startRow, _ = t.startColumn - e.startColumn, v = h.map((S) => {
2954
- const C = S.sheetTransform, w = {
2955
- to: { ...C.to, row: C.to.row + m, column: C.to.column + _ },
2956
- from: { ...C.from, row: C.from.row + m, column: C.from.column + _ }
2957
- }, y = z(w, this._selectionRenderService, this._skeletonManagerService);
3274
+ const f = [], m = [], p = t.startRow - e.startRow, w = t.startColumn - e.startColumn, S = h.map((v) => {
3275
+ const C = v.sheetTransform, _ = {
3276
+ to: { ...C.to, row: C.to.row + p, column: C.to.column + w },
3277
+ from: { ...C.from, row: C.from.row + p, column: C.from.column + w }
3278
+ }, y = Z(_, this._selectionRenderService, this._skeletonManagerService);
2958
3279
  return {
2959
3280
  unitId: r,
2960
3281
  subUnitId: s,
2961
- drawingId: S.drawingId,
3282
+ drawingId: v.drawingId,
2962
3283
  transform: y,
2963
- sheetTransform: w
3284
+ sheetTransform: _
2964
3285
  };
2965
3286
  });
2966
- if (v.length) {
2967
- const S = this._sheetDrawingService.getBatchUpdateOp(v), { undo: C, redo: w, objects: y } = S;
2968
- f.push({ id: P.id, params: { unitId: r, subUnitId: s, op: w, objects: y, type: U.UPDATE } }), p.push({ id: P.id, params: { unitId: r, subUnitId: s, op: C, objects: y, type: U.UPDATE } });
3287
+ if (S.length) {
3288
+ const v = this._sheetDrawingService.getBatchUpdateOp(S), { undo: C, redo: _, objects: y } = v;
3289
+ f.push({ id: P.id, params: { unitId: r, subUnitId: s, op: _, objects: y, type: U.UPDATE } }), m.push({ id: P.id, params: { unitId: r, subUnitId: s, op: C, objects: y, type: U.UPDATE } });
2969
3290
  }
2970
- return { redos: f, undos: p };
3291
+ return { redos: f, undos: m };
2971
3292
  }
2972
3293
  _moveRowInterceptor(i, t) {
2973
3294
  const e = this._getUnitIdAndSubUnitId(i, t);
@@ -2975,37 +3296,37 @@ let rn = class extends ne {
2975
3296
  return { redos: [], undos: [] };
2976
3297
  const { unitId: n, subUnitId: r } = e, { range: s } = i, o = s.startRow, a = s.endRow, d = [], u = [], c = this._sheetDrawingService.getDrawingData(n, r), l = [], g = [];
2977
3298
  if (Object.keys(c).forEach((h) => {
2978
- const f = c[h], { sheetTransform: p, transform: m, anchorType: _ = O.Position } = f;
2979
- if (p == null || m == null)
3299
+ const f = c[h], { sheetTransform: m, transform: p, anchorType: w = O.Position } = f;
3300
+ if (m == null || p == null)
2980
3301
  return;
2981
- let v, I;
3302
+ let S, I;
2982
3303
  if (t === "insert") {
2983
- const S = this._expandRow(p, m, o, a, _);
2984
- v = S == null ? void 0 : S.newSheetTransform, I = S == null ? void 0 : S.newTransform;
3304
+ const v = this._expandRow(m, p, o, a, w);
3305
+ S = v == null ? void 0 : v.newSheetTransform, I = v == null ? void 0 : v.newTransform;
2985
3306
  } else {
2986
- const { from: S, to: C } = p, { row: w } = S, { row: y } = C;
2987
- if (_ === O.Both && w >= o && y <= a)
3307
+ const { from: v, to: C } = m, { row: _ } = v, { row: y } = C;
3308
+ if (w === O.Both && _ >= o && y <= a)
2988
3309
  g.push({ unitId: n, subUnitId: r, drawingId: h });
2989
3310
  else {
2990
- const D = this._shrinkRow(p, m, o, a, _);
2991
- v = D == null ? void 0 : D.newSheetTransform, I = D == null ? void 0 : D.newTransform;
3311
+ const R = this._shrinkRow(m, p, o, a, w);
3312
+ S = R == null ? void 0 : R.newSheetTransform, I = R == null ? void 0 : R.newTransform;
2992
3313
  }
2993
3314
  }
2994
- if (!v || !I)
3315
+ if (!S || !I)
2995
3316
  return;
2996
- const R = { unitId: n, subUnitId: r, drawingId: h, transform: I, sheetTransform: v };
2997
- l.push(R);
3317
+ const D = { unitId: n, subUnitId: r, drawingId: h, transform: I, sheetTransform: S };
3318
+ l.push(D);
2998
3319
  }), l.length === 0 && g.length === 0)
2999
3320
  return { redos: [], undos: [] };
3000
3321
  if (l.length > 0) {
3001
- const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: p, objects: m } = h;
3002
- d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: p, objects: m, type: U.UPDATE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: f, objects: m, type: U.UPDATE } });
3322
+ const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: m, objects: p } = h;
3323
+ d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: U.UPDATE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: U.UPDATE } });
3003
3324
  }
3004
3325
  if (g.length > 0) {
3005
- const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, p = h.redo, m = h.objects;
3006
- d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: p, objects: m, type: U.REMOVE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: f, objects: m, type: U.INSERT } });
3326
+ const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, m = h.redo, p = h.objects;
3327
+ d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: U.REMOVE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: U.INSERT } });
3007
3328
  }
3008
- return d.push({ id: Y.id, params: [n] }), u.push({ id: Y.id, params: [n] }), {
3329
+ return d.push({ id: V.id, params: [n] }), u.push({ id: V.id, params: [n] }), {
3009
3330
  redos: d,
3010
3331
  undos: u
3011
3332
  };
@@ -3016,43 +3337,43 @@ let rn = class extends ne {
3016
3337
  return { redos: [], undos: [] };
3017
3338
  const { unitId: n, subUnitId: r } = e, { range: s } = i, o = s.startColumn, a = s.endColumn, d = [], u = [], c = this._sheetDrawingService.getDrawingData(n, r), l = [], g = [];
3018
3339
  if (Object.keys(c).forEach((h) => {
3019
- const f = c[h], { sheetTransform: p, transform: m, anchorType: _ = O.Position } = f;
3020
- if (p == null || m == null)
3340
+ const f = c[h], { sheetTransform: m, transform: p, anchorType: w = O.Position } = f;
3341
+ if (m == null || p == null)
3021
3342
  return;
3022
- let v, I;
3343
+ let S, I;
3023
3344
  if (t === "insert") {
3024
- const S = this._expandCol(p, m, o, a, _);
3025
- v = S == null ? void 0 : S.newSheetTransform, I = S == null ? void 0 : S.newTransform;
3345
+ const v = this._expandCol(m, p, o, a, w);
3346
+ S = v == null ? void 0 : v.newSheetTransform, I = v == null ? void 0 : v.newTransform;
3026
3347
  } else {
3027
- const { from: S, to: C } = p, { column: w } = S, { column: y } = C;
3028
- if (_ === O.Both && w >= o && y <= a)
3348
+ const { from: v, to: C } = m, { column: _ } = v, { column: y } = C;
3349
+ if (w === O.Both && _ >= o && y <= a)
3029
3350
  g.push({ unitId: n, subUnitId: r, drawingId: h });
3030
3351
  else {
3031
- const D = this._shrinkCol(p, m, o, a, _);
3032
- v = D == null ? void 0 : D.newSheetTransform, I = D == null ? void 0 : D.newTransform;
3352
+ const R = this._shrinkCol(m, p, o, a, w);
3353
+ S = R == null ? void 0 : R.newSheetTransform, I = R == null ? void 0 : R.newTransform;
3033
3354
  }
3034
3355
  }
3035
- if (!v || !I)
3356
+ if (!S || !I)
3036
3357
  return;
3037
- const R = { unitId: n, subUnitId: r, drawingId: h, transform: I, sheetTransform: v };
3038
- l.push(R);
3358
+ const D = { unitId: n, subUnitId: r, drawingId: h, transform: I, sheetTransform: S };
3359
+ l.push(D);
3039
3360
  }), l.length === 0 && g.length === 0)
3040
3361
  return { redos: [], undos: [] };
3041
3362
  if (l.length > 0) {
3042
- const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: p, objects: m } = h;
3043
- d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: p, objects: m, type: U.UPDATE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: f, objects: m, type: U.UPDATE } });
3363
+ const h = this._sheetDrawingService.getBatchUpdateOp(l), { undo: f, redo: m, objects: p } = h;
3364
+ d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: U.UPDATE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: U.UPDATE } });
3044
3365
  }
3045
3366
  if (g.length > 0) {
3046
- const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, p = h.redo, m = h.objects;
3047
- d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: p, objects: m, type: U.REMOVE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: f, objects: m, type: U.INSERT } });
3367
+ const h = this._sheetDrawingService.getBatchRemoveOp(g), f = h.undo, m = h.redo, p = h.objects;
3368
+ d.push({ id: P.id, params: { unitId: n, subUnitId: r, op: m, objects: p, type: U.REMOVE } }), u.push({ id: P.id, params: { unitId: n, subUnitId: r, op: f, objects: p, type: U.INSERT } });
3048
3369
  }
3049
- return d.push({ id: Y.id, params: [n] }), u.push({ id: Y.id, params: [n] }), { redos: d, undos: u };
3370
+ return d.push({ id: V.id, params: [n] }), u.push({ id: V.id, params: [n] }), { redos: d, undos: u };
3050
3371
  }
3051
3372
  _expandCol(i, t, e, n, r = O.Position) {
3052
3373
  const s = n - e + 1, { from: o, to: a } = i, { column: d } = o, { column: u } = a;
3053
3374
  if (r === O.None)
3054
3375
  return {
3055
- newSheetTransform: $({ ...t }, this._selectionRenderService),
3376
+ newSheetTransform: j({ ...t }, this._selectionRenderService),
3056
3377
  newTransform: t
3057
3378
  };
3058
3379
  let c = null, l = null;
@@ -3060,16 +3381,16 @@ let rn = class extends ne {
3060
3381
  const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: e, endColumn: n, startRow: o.row, endRow: a.row });
3061
3382
  if (g == null)
3062
3383
  return;
3063
- l = { ...t, left: (t.left || 0) + g.endX - g.startX }, c = $(l, this._selectionRenderService);
3384
+ l = { ...t, left: (t.left || 0) + g.endX - g.startX }, c = j(l, this._selectionRenderService);
3064
3385
  } else if (u >= n)
3065
3386
  if (r === O.Both)
3066
3387
  c = {
3067
3388
  from: { ...o },
3068
3389
  to: { ...a, column: u + s }
3069
- }, l = z(c, this._selectionRenderService, this._skeletonManagerService);
3390
+ }, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
3070
3391
  else
3071
3392
  return {
3072
- newSheetTransform: $({ ...t }, this._selectionRenderService),
3393
+ newSheetTransform: j({ ...t }, this._selectionRenderService),
3073
3394
  newTransform: t
3074
3395
  };
3075
3396
  return c != null && l != null ? {
@@ -3081,7 +3402,7 @@ let rn = class extends ne {
3081
3402
  const s = n - e + 1, { from: o, to: a } = i, { column: d } = o, { column: u } = a;
3082
3403
  if (r === O.None)
3083
3404
  return {
3084
- newSheetTransform: $({ ...t }, this._selectionRenderService),
3405
+ newSheetTransform: j({ ...t }, this._selectionRenderService),
3085
3406
  newTransform: t
3086
3407
  };
3087
3408
  let c = null, l = null;
@@ -3089,7 +3410,7 @@ let rn = class extends ne {
3089
3410
  c = {
3090
3411
  from: { ...o, column: d - s },
3091
3412
  to: { ...a, column: u - s }
3092
- }, l = z(c, this._selectionRenderService, this._skeletonManagerService);
3413
+ }, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
3093
3414
  else {
3094
3415
  if (d >= e && u <= n)
3095
3416
  return null;
@@ -3098,10 +3419,10 @@ let rn = class extends ne {
3098
3419
  c = {
3099
3420
  from: { ...o },
3100
3421
  to: { ...a, column: u - s }
3101
- }, l = z(c, this._selectionRenderService, this._skeletonManagerService);
3422
+ }, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
3102
3423
  else
3103
3424
  return {
3104
- newSheetTransform: $({ ...t }, this._selectionRenderService),
3425
+ newSheetTransform: j({ ...t }, this._selectionRenderService),
3105
3426
  newTransform: t
3106
3427
  };
3107
3428
  else if (d >= e && d <= n) {
@@ -3113,7 +3434,7 @@ let rn = class extends ne {
3113
3434
  return;
3114
3435
  l = { ...t, left: (t.left || 0) - g.endX + g.startX - i.from.columnOffset };
3115
3436
  }
3116
- c = $(l, this._selectionRenderService);
3437
+ c = j(l, this._selectionRenderService);
3117
3438
  } else if (u >= e && u <= n && r === O.Both) {
3118
3439
  const g = this._skeletonManagerService.attachRangeWithCoord({
3119
3440
  startColumn: e - 1,
@@ -3126,7 +3447,7 @@ let rn = class extends ne {
3126
3447
  c = {
3127
3448
  from: { ...o },
3128
3449
  to: { ...a, column: e - 1, columnOffset: g.endX - g.startX }
3129
- }, l = z(c, this._selectionRenderService, this._skeletonManagerService);
3450
+ }, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
3130
3451
  }
3131
3452
  }
3132
3453
  return c != null && l != null ? {
@@ -3138,7 +3459,7 @@ let rn = class extends ne {
3138
3459
  const s = n - e + 1, { from: o, to: a } = i, { row: d } = o, { row: u } = a;
3139
3460
  if (r === O.None)
3140
3461
  return {
3141
- newSheetTransform: $({ ...t }, this._selectionRenderService),
3462
+ newSheetTransform: j({ ...t }, this._selectionRenderService),
3142
3463
  newTransform: t
3143
3464
  };
3144
3465
  let c = null, l = null;
@@ -3146,7 +3467,7 @@ let rn = class extends ne {
3146
3467
  const g = this._skeletonManagerService.attachRangeWithCoord({ startRow: e, endRow: n, startColumn: o.column, endColumn: a.column });
3147
3468
  if (g == null)
3148
3469
  return;
3149
- l = { ...t, top: (t.top || 0) + g.endY - g.startY }, c = $(l, this._selectionRenderService);
3470
+ l = { ...t, top: (t.top || 0) + g.endY - g.startY }, c = j(l, this._selectionRenderService);
3150
3471
  } else if (u >= n)
3151
3472
  if (r === O.Both)
3152
3473
  c = {
@@ -3155,10 +3476,10 @@ let rn = class extends ne {
3155
3476
  ...a,
3156
3477
  row: u + s
3157
3478
  }
3158
- }, l = z(c, this._selectionRenderService, this._skeletonManagerService);
3479
+ }, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
3159
3480
  else
3160
3481
  return {
3161
- newSheetTransform: $({ ...t }, this._selectionRenderService),
3482
+ newSheetTransform: j({ ...t }, this._selectionRenderService),
3162
3483
  newTransform: t
3163
3484
  };
3164
3485
  return c != null && l != null ? {
@@ -3170,7 +3491,7 @@ let rn = class extends ne {
3170
3491
  const s = n - e + 1, { from: o, to: a } = i, { row: d } = o, { row: u } = a;
3171
3492
  if (r === O.None)
3172
3493
  return {
3173
- newSheetTransform: $({ ...t }, this._selectionRenderService),
3494
+ newSheetTransform: j({ ...t }, this._selectionRenderService),
3174
3495
  newTransform: t
3175
3496
  };
3176
3497
  let c = null, l = null;
@@ -3178,7 +3499,7 @@ let rn = class extends ne {
3178
3499
  c = {
3179
3500
  from: { ...o, row: d - s },
3180
3501
  to: { ...a, row: u - s }
3181
- }, l = z(c, this._selectionRenderService, this._skeletonManagerService);
3502
+ }, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
3182
3503
  else {
3183
3504
  if (d >= e && u <= n)
3184
3505
  return null;
@@ -3187,10 +3508,10 @@ let rn = class extends ne {
3187
3508
  c = {
3188
3509
  from: { ...o },
3189
3510
  to: { ...a, row: u - s }
3190
- }, l = z(c, this._selectionRenderService, this._skeletonManagerService);
3511
+ }, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
3191
3512
  else
3192
3513
  return {
3193
- newSheetTransform: $({ ...t }, this._selectionRenderService),
3514
+ newSheetTransform: j({ ...t }, this._selectionRenderService),
3194
3515
  newTransform: t
3195
3516
  };
3196
3517
  else if (d >= e && d <= n) {
@@ -3202,7 +3523,7 @@ let rn = class extends ne {
3202
3523
  return;
3203
3524
  l = { ...t, top: (t.top || 0) - g.endY + g.startY - i.from.rowOffset };
3204
3525
  }
3205
- c = $(l, this._selectionRenderService);
3526
+ c = j(l, this._selectionRenderService);
3206
3527
  } else if (u >= e && u <= n && r === O.Both) {
3207
3528
  const g = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: e - 1, endRow: e - 1 });
3208
3529
  if (g == null)
@@ -3210,7 +3531,7 @@ let rn = class extends ne {
3210
3531
  c = {
3211
3532
  from: { ...o },
3212
3533
  to: { ...a, row: e - 1, rowOffset: g.endY - g.startY }
3213
- }, l = z(c, this._selectionRenderService, this._skeletonManagerService);
3534
+ }, l = Z(c, this._selectionRenderService, this._skeletonManagerService);
3214
3535
  }
3215
3536
  }
3216
3537
  return c != null && l != null ? {
@@ -3224,7 +3545,7 @@ let rn = class extends ne {
3224
3545
  // but the skeleton changes like other render modules. These two signals are not equivalent.
3225
3546
  // As a temp solution, I subscribed to activate$ here.
3226
3547
  this._commandService.onCommandExecuted((i) => {
3227
- if (i.id === Ii.id) {
3548
+ if (i.id === Ki.id) {
3228
3549
  const { unitId: t, subUnitId: e } = i.params;
3229
3550
  this._updateDrawings(t, e);
3230
3551
  }
@@ -3264,7 +3585,7 @@ let rn = class extends ne {
3264
3585
  d != null && Object.keys(d).forEach((u) => {
3265
3586
  if (s === i && a === t) {
3266
3587
  const c = d[u];
3267
- c.transform = z(c.sheetTransform, this._selectionRenderService, this._skeletonManagerService), n.push(d[u]);
3588
+ c.transform = Z(c.sheetTransform, this._selectionRenderService, this._skeletonManagerService), n.push(d[u]);
3268
3589
  } else
3269
3590
  r.push(d[u]);
3270
3591
  });
@@ -3275,7 +3596,7 @@ let rn = class extends ne {
3275
3596
  _sheetRefreshListener() {
3276
3597
  this.disposeWithMe(
3277
3598
  this._commandService.onCommandExecuted((i) => {
3278
- Ns.includes(i.id) && requestIdleCallback(() => {
3599
+ mo.includes(i.id) && requestIdleCallback(() => {
3279
3600
  const t = i.params, { unitId: e, subUnitId: n, ranges: r } = t;
3280
3601
  this._refreshDrawingTransform(e, n, r);
3281
3602
  });
@@ -3288,279 +3609,504 @@ let rn = class extends ne {
3288
3609
  const o = n[s], { sheetTransform: a, transform: d, anchorType: u = O.Position } = o;
3289
3610
  if (u === O.None)
3290
3611
  return !0;
3291
- const { from: c, to: l } = a, { row: g, column: h } = c, { row: f, column: p } = l;
3292
- for (let m = 0; m < e.length; m++) {
3293
- const _ = e[m], { startRow: v, endRow: I, startColumn: R, endColumn: S } = _;
3294
- if (ei.intersects(
3612
+ const { from: c, to: l } = a, { row: g, column: h } = c, { row: f, column: m } = l;
3613
+ for (let p = 0; p < e.length; p++) {
3614
+ const w = e[p], { startRow: S, endRow: I, startColumn: D, endColumn: v } = w;
3615
+ if (yi.intersects(
3295
3616
  {
3296
- startRow: v,
3617
+ startRow: S,
3297
3618
  endRow: I,
3298
- startColumn: R,
3299
- endColumn: S
3619
+ startColumn: D,
3620
+ endColumn: v
3300
3621
  },
3301
3622
  {
3302
3623
  startRow: g,
3303
3624
  endRow: f,
3304
3625
  startColumn: h,
3305
- endColumn: p
3626
+ endColumn: m
3306
3627
  }
3307
- ) || g > I || h > S) {
3308
- const C = u === O.Position, w = z(a, this._selectionRenderService, this._skeletonManagerService);
3628
+ ) || g > I || h > v) {
3629
+ const C = u === O.Position, _ = Z(a, this._selectionRenderService, this._skeletonManagerService);
3309
3630
  r.push({
3310
3631
  ...o,
3311
3632
  transform: {
3312
- ...w,
3313
- width: C ? d == null ? void 0 : d.width : w == null ? void 0 : w.width,
3314
- height: C ? d == null ? void 0 : d.height : w == null ? void 0 : w.height
3633
+ ..._,
3634
+ width: C ? d == null ? void 0 : d.width : _ == null ? void 0 : _.width,
3635
+ height: C ? d == null ? void 0 : d.height : _ == null ? void 0 : _.height
3315
3636
  }
3316
3637
  });
3317
3638
  break;
3318
3639
  }
3319
3640
  }
3320
- }), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(Y.id, [i]));
3641
+ }), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(V.id, [i]));
3321
3642
  }
3322
3643
  };
3323
- rn = Ps([
3324
- me(1, J),
3325
- me(2, X),
3326
- me(3, xe),
3327
- me(4, A(V)),
3328
- me(5, A(At)),
3329
- me(6, re),
3330
- me(7, ie),
3331
- me(8, Se)
3332
- ], rn);
3333
- const ks = (i) => {
3334
- var v;
3335
- const t = qe(X), e = qe(nt), n = qe(ie), r = qe(J), { drawings: s } = i, o = s[0];
3644
+ Rn = go([
3645
+ _e(1, Q),
3646
+ _e(2, Y),
3647
+ _e(3, Ze),
3648
+ _e(4, A(X)),
3649
+ _e(5, A(Vt)),
3650
+ _e(6, se),
3651
+ _e(7, oe),
3652
+ _e(8, de)
3653
+ ], Rn);
3654
+ function Yr({ ref: i, ...t }) {
3655
+ const { icon: e, id: n, className: r, extend: s, ...o } = t, a = `univerjs-icon univerjs-icon-${n} ${r || ""}`.trim(), d = Es(`_${_o()}`);
3656
+ return Gr(e, `${n}`, {
3657
+ defIds: e.defIds,
3658
+ idSuffix: d.current
3659
+ }, {
3660
+ ref: i,
3661
+ className: a,
3662
+ ...o
3663
+ }, s);
3664
+ }
3665
+ function Gr(i, t, e, n, r) {
3666
+ return Ar(i.tag, {
3667
+ key: t,
3668
+ ...po(i, e, r),
3669
+ ...n
3670
+ }, (wo(i, e).children || []).map((s, o) => Gr(s, `${t}-${i.tag}-${o}`, e, void 0, r)));
3671
+ }
3672
+ function po(i, t, e) {
3673
+ const n = { ...i.attrs };
3674
+ e != null && e.colorChannel1 && n.fill === "colorChannel1" && (n.fill = e.colorChannel1), i.tag === "mask" && n.id && (n.id = n.id + t.idSuffix), Object.entries(n).forEach(([s, o]) => {
3675
+ s === "mask" && typeof o == "string" && (n[s] = o.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
3676
+ });
3677
+ const { defIds: r } = t;
3678
+ return !r || r.length === 0 || (i.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(([s, o]) => {
3679
+ typeof o == "string" && (n[s] = o.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
3680
+ })), n;
3681
+ }
3682
+ function wo(i, t) {
3683
+ var n;
3684
+ const { defIds: e } = t;
3685
+ return !e || e.length === 0 ? i : i.tag === "defs" && ((n = i.children) != null && n.length) ? {
3686
+ ...i,
3687
+ children: i.children.map((r) => typeof r.attrs.id == "string" && e && e.includes(r.attrs.id) ? {
3688
+ ...r,
3689
+ attrs: {
3690
+ ...r.attrs,
3691
+ id: r.attrs.id + t.idSuffix
3692
+ }
3693
+ } : r)
3694
+ } : i;
3695
+ }
3696
+ function _o() {
3697
+ return Math.random().toString(36).substring(2, 8);
3698
+ }
3699
+ Yr.displayName = "UniverIcon";
3700
+ const So = {
3701
+ tag: "svg",
3702
+ attrs: {
3703
+ xmlns: "http://www.w3.org/2000/svg",
3704
+ fill: "none",
3705
+ viewBox: "0 0 17 16",
3706
+ width: "1em",
3707
+ height: "1em"
3708
+ },
3709
+ children: [{
3710
+ tag: "path",
3711
+ attrs: {
3712
+ fill: "currentColor",
3713
+ d: "M2.35381 3.65517C2.35381 2.88198 2.98061 2.25518 3.75381 2.25518H8.10381C8.43518 2.25518 8.70381 1.98655 8.70381 1.65518C8.70381 1.3238 8.43518 1.05518 8.10381 1.05518H3.75381C2.31787 1.05518 1.15381 2.21923 1.15381 3.65517V12.3552C1.15381 13.7911 2.31787 14.9552 3.75381 14.9552H12.4538C13.8897 14.9552 15.0538 13.7911 15.0538 12.3552V8.00518C15.0538 7.6738 14.7852 7.40518 14.4538 7.40518C14.1224 7.40518 13.8538 7.6738 13.8538 8.00518V9.24469L12.3428 8.11143C11.8294 7.72642 11.1111 7.77744 10.6573 8.23119L9.11281 9.77567L6.84342 7.83047C6.34812 7.40592 5.61375 7.41815 5.13289 7.85896L2.35381 10.4064V3.65517ZM2.35381 12.0343V12.3552C2.35381 13.1284 2.98061 13.7552 3.75381 13.7552H12.4538C13.227 13.7552 13.8538 13.1284 13.8538 12.3552V10.7447L11.6228 9.07144C11.5871 9.04469 11.5373 9.04827 11.5058 9.07971L10.0266 10.5589L11.2057 11.5696C11.4573 11.7853 11.4865 12.164 11.2708 12.4156C11.0552 12.6672 10.6764 12.6964 10.4248 12.4807L6.06245 8.74157C6.02809 8.71212 5.97713 8.71296 5.94377 8.74353L2.35381 12.0343Z",
3714
+ fillRule: "evenodd",
3715
+ clipRule: "evenodd"
3716
+ }
3717
+ }, {
3718
+ tag: "path",
3719
+ attrs: {
3720
+ fill: "currentColor",
3721
+ d: "M10.3911 3.84419C10.6254 3.60988 11.0053 3.60988 11.2396 3.84419L11.8818 4.48643V1.93496C11.8818 1.60359 12.1505 1.33496 12.4818 1.33496C12.8132 1.33496 13.0818 1.60359 13.0818 1.93496V4.48676L13.7244 3.84419C13.9587 3.60988 14.3386 3.60988 14.5729 3.84419C14.8072 4.07851 14.8072 4.45841 14.5729 4.69272L12.9063 6.35939C12.6719 6.5937 12.292 6.5937 12.0577 6.35939L10.3911 4.69272C10.1568 4.45841 10.1568 4.07851 10.3911 3.84419Z"
3722
+ }
3723
+ }]
3724
+ }, Xr = Ts(function(t, e) {
3725
+ return Ar(Yr, Object.assign({}, t, {
3726
+ id: "download-image-icon",
3727
+ ref: e,
3728
+ icon: So
3729
+ }));
3730
+ });
3731
+ Xr.displayName = "DownloadImageIcon";
3732
+ function vo() {
3733
+ const i = Ie(Te), t = Ie(bn), e = Ie(yn), [n, r] = Ee([ye.CELL_ADDRESS]), [s, o] = Ee(!1), [a, d] = Ee(null), u = Fe(() => e.getCellImagesInSelection(), [e]), c = Fe(() => e.getDataColumns(), [e]), l = Fe(() => e.getSelectionRowRange(), [e]), g = c.length > 0, h = Fe(() => c.map((C) => ({
3734
+ label: C.label,
3735
+ value: String(C.index)
3736
+ })), [c]), [f, m] = Ee(
3737
+ () => h.length > 0 ? h[0].value : "0"
3738
+ ), p = Fe(() => {
3739
+ if (!n.includes(ye.COLUMN_VALUE) || !l)
3740
+ return [];
3741
+ const _ = Number(f);
3742
+ return [{
3743
+ startRow: l.startRow,
3744
+ endRow: l.endRow,
3745
+ startColumn: _,
3746
+ endColumn: _
3747
+ }];
3748
+ }, [n, f, l]);
3749
+ fi(p);
3750
+ const w = Et((C) => {
3751
+ C.length !== 0 && r(C);
3752
+ }, []), S = Et((C) => {
3753
+ m(String(C));
3754
+ }, []), I = Et(() => {
3755
+ t.close(ze);
3756
+ }, [t]), D = Et(async () => {
3757
+ if (u.length !== 0) {
3758
+ o(!0), d(null);
3759
+ try {
3760
+ await e.saveImages(u, {
3761
+ fileNameParts: n,
3762
+ columnIndex: n.includes(ye.COLUMN_VALUE) ? Number(f) : void 0
3763
+ }), t.close(ze);
3764
+ } catch (C) {
3765
+ console.error("Failed to save images:", C), d(i.t("sheetImage.save.error"));
3766
+ } finally {
3767
+ o(!1);
3768
+ }
3769
+ }
3770
+ }, [e, u, n, f, t, i]), v = n.includes(ye.COLUMN_VALUE);
3771
+ return /* @__PURE__ */ Xe("div", { className: "univer-flex univer-flex-col", children: [
3772
+ /* @__PURE__ */ L(en, { label: i.t("sheetImage.save.imageCount"), children: /* @__PURE__ */ L("div", { className: "univer-text-sm univer-text-gray-600", children: u.length }) }),
3773
+ /* @__PURE__ */ L(en, { label: i.t("sheetImage.save.fileNameConfig"), children: /* @__PURE__ */ Xe(Qi, { value: n, onChange: w, direction: "vertical", children: [
3774
+ /* @__PURE__ */ L(Yn, { value: ye.CELL_ADDRESS, disabled: !g, children: i.t("sheetImage.save.useRowCol") }),
3775
+ g && /* @__PURE__ */ L(Yn, { value: ye.COLUMN_VALUE, children: i.t("sheetImage.save.useColumnValue") })
3776
+ ] }) }),
3777
+ v && /* @__PURE__ */ L(en, { label: i.t("sheetImage.save.selectColumn"), children: /* @__PURE__ */ L(
3778
+ es,
3779
+ {
3780
+ value: f,
3781
+ options: h,
3782
+ onChange: S
3783
+ }
3784
+ ) }),
3785
+ a && /* @__PURE__ */ L("div", { className: "univer-text-xs univer-text-red-500", children: a }),
3786
+ /* @__PURE__ */ Xe(
3787
+ "div",
3788
+ {
3789
+ className: "univer-flex univer-justify-end univer-gap-2 univer-border-t univer-border-gray-200 univer-pt-3",
3790
+ children: [
3791
+ /* @__PURE__ */ L(Gn, { onClick: I, disabled: s, children: i.t("sheetImage.save.cancel") }),
3792
+ /* @__PURE__ */ L(
3793
+ Gn,
3794
+ {
3795
+ variant: "primary",
3796
+ onClick: D,
3797
+ disabled: s || u.length === 0,
3798
+ children: s ? i.t("sheetImage.save.saving") : i.t("sheetImage.save.confirm")
3799
+ }
3800
+ )
3801
+ ]
3802
+ }
3803
+ )
3804
+ ] });
3805
+ }
3806
+ const Io = (i) => {
3807
+ var S;
3808
+ const t = Ie(Y), e = Ie(Te), n = Ie(oe), r = Ie(Q), { drawings: s } = i, o = s[0];
3336
3809
  if (o == null)
3337
3810
  return;
3338
3811
  const { unitId: a } = o, d = r.getRenderById(a), u = d == null ? void 0 : d.scene;
3339
3812
  if (u == null)
3340
3813
  return;
3341
- const c = u.getTransformerByCreate(), [l, g] = Qt(!0), h = (v = o.anchorType) != null ? v : O.Position, [f, p] = Qt(h);
3342
- function m(I, R) {
3343
- const S = [];
3814
+ const c = u.getTransformerByCreate(), [l, g] = Ee(!0), h = (S = o.anchorType) != null ? S : O.Position, [f, m] = Ee(h);
3815
+ function p(I, D) {
3816
+ const v = [];
3344
3817
  return I.forEach((C) => {
3345
- const { oKey: w } = C, y = R.getDrawingOKey(w);
3818
+ const { oKey: _ } = C, y = D.getDrawingOKey(_);
3346
3819
  if (y == null)
3347
- return S.push(null), !0;
3348
- const { unitId: D, subUnitId: T, drawingId: E, drawingType: M, anchorType: b, sheetTransform: N } = y;
3349
- S.push({
3350
- unitId: D,
3351
- subUnitId: T,
3352
- drawingId: E,
3820
+ return v.push(null), !0;
3821
+ const { unitId: R, subUnitId: E, drawingId: T, drawingType: M, anchorType: b, sheetTransform: N } = y;
3822
+ v.push({
3823
+ unitId: R,
3824
+ subUnitId: E,
3825
+ drawingId: T,
3353
3826
  anchorType: b,
3354
3827
  sheetTransform: N,
3355
3828
  drawingType: M
3356
3829
  });
3357
- }), S;
3830
+ }), v;
3358
3831
  }
3359
- ur(() => {
3360
- const I = c.clearControl$.subscribe((S) => {
3361
- S === !0 && g(!1);
3362
- }), R = c.changeStart$.subscribe((S) => {
3832
+ Nr(() => {
3833
+ const I = c.clearControl$.subscribe((v) => {
3834
+ v === !0 && g(!1);
3835
+ }), D = c.changeStart$.subscribe((v) => {
3363
3836
  var y;
3364
- const { objects: C } = S, w = m(C, n);
3365
- if (w.length === 0)
3837
+ const { objects: C } = v, _ = p(C, n);
3838
+ if (_.length === 0)
3366
3839
  g(!1);
3367
- else if (w.length >= 1) {
3840
+ else if (_.length >= 1) {
3368
3841
  g(!0);
3369
- const D = ((y = w[0]) == null ? void 0 : y.anchorType) || O.Position;
3370
- p(D);
3842
+ const R = ((y = _[0]) == null ? void 0 : y.anchorType) || O.Position;
3843
+ m(R);
3371
3844
  }
3372
3845
  });
3373
3846
  return () => {
3374
- R.unsubscribe(), I.unsubscribe();
3847
+ D.unsubscribe(), I.unsubscribe();
3375
3848
  };
3376
3849
  }, []);
3377
- function _(I) {
3378
- p(I);
3379
- const R = n.getFocusDrawings();
3380
- if (R.length === 0)
3850
+ function w(I) {
3851
+ m(I);
3852
+ const D = n.getFocusDrawings();
3853
+ if (D.length === 0)
3381
3854
  return;
3382
- const S = R.map((C) => ({
3855
+ const v = D.map((C) => ({
3383
3856
  unitId: C.unitId,
3384
3857
  subUnitId: C.subUnitId,
3385
3858
  drawingId: C.drawingId,
3386
3859
  anchorType: I
3387
3860
  }));
3388
- t.executeCommand(Wt.id, {
3389
- unitId: R[0].unitId,
3390
- drawings: S
3861
+ t.executeCommand(zt.id, {
3862
+ unitId: D[0].unitId,
3863
+ drawings: v
3391
3864
  });
3392
3865
  }
3393
- return /* @__PURE__ */ qt(
3866
+ return /* @__PURE__ */ Xe(
3394
3867
  "div",
3395
3868
  {
3396
- className: bi("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
3869
+ className: ts("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
3397
3870
  "univer-hidden": !l
3398
3871
  }),
3399
3872
  children: [
3400
- /* @__PURE__ */ oe(
3873
+ /* @__PURE__ */ L(
3401
3874
  "header",
3402
3875
  {
3403
3876
  className: "univer-text-gray-600 dark:!univer-text-gray-200",
3404
- children: /* @__PURE__ */ oe("div", { children: e.t("drawing-anchor.title") })
3877
+ children: /* @__PURE__ */ L("div", { children: e.t("drawing-anchor.title") })
3405
3878
  }
3406
3879
  ),
3407
- /* @__PURE__ */ oe("div", { children: /* @__PURE__ */ qt(Mi, { value: f, onChange: _, direction: "vertical", children: [
3408
- /* @__PURE__ */ oe(Yt, { value: O.Both, children: e.t("drawing-anchor.both") }),
3409
- /* @__PURE__ */ oe(Yt, { value: O.Position, children: e.t("drawing-anchor.position") }),
3410
- /* @__PURE__ */ oe(Yt, { value: O.None, children: e.t("drawing-anchor.none") })
3880
+ /* @__PURE__ */ L("div", { children: /* @__PURE__ */ Xe(ns, { value: f, onChange: w, direction: "vertical", children: [
3881
+ /* @__PURE__ */ L(tn, { value: O.Both, children: e.t("drawing-anchor.both") }),
3882
+ /* @__PURE__ */ L(tn, { value: O.Position, children: e.t("drawing-anchor.position") }),
3883
+ /* @__PURE__ */ L(tn, { value: O.None, children: e.t("drawing-anchor.none") })
3411
3884
  ] }) })
3412
3885
  ]
3413
3886
  }
3414
3887
  );
3415
- }, Ws = () => {
3416
- const i = qe(ie), t = i.getFocusDrawings(), [e, n] = Qt(t);
3417
- return ur(() => {
3888
+ }, Co = () => {
3889
+ const i = Ie(oe), t = i.getFocusDrawings(), [e, n] = Ee(t);
3890
+ return Nr(() => {
3418
3891
  const r = i.focus$.subscribe((s) => {
3419
3892
  n(s);
3420
3893
  });
3421
3894
  return () => {
3422
3895
  r.unsubscribe();
3423
3896
  };
3424
- }, []), !!(e != null && e.length) && /* @__PURE__ */ qt("div", { className: "univer-text-sm", children: [
3425
- /* @__PURE__ */ oe(zi, { drawings: e }),
3426
- /* @__PURE__ */ oe(ks, { drawings: e })
3897
+ }, []), !!(e != null && e.length) && /* @__PURE__ */ Xe("div", { className: "univer-text-sm", children: [
3898
+ /* @__PURE__ */ L(Rs, { drawings: e }),
3899
+ /* @__PURE__ */ L(Io, { drawings: e })
3427
3900
  ] });
3428
- }, Cr = "sheet.menu.image";
3429
- function Bs(i) {
3901
+ }, zr = "sheet.menu.image";
3902
+ function Ro(i) {
3430
3903
  return {
3431
- id: Cr,
3432
- type: cn.SUBITEMS,
3904
+ id: zr,
3905
+ type: Gt.SUBITEMS,
3433
3906
  icon: "AddImageIcon",
3434
3907
  tooltip: "sheetImage.title",
3435
- hidden$: an(i, F.UNIVER_SHEET),
3436
- disabled$: Yr(i, { workbookTypes: [zt], worksheetTypes: [Kt], rangeTypes: [Ci] })
3908
+ hidden$: Yt(i, $.UNIVER_SHEET),
3909
+ disabled$: mi(i, { workbookTypes: [gn], worksheetTypes: [fn], rangeTypes: [Zi] })
3437
3910
  };
3438
3911
  }
3439
- function js(i) {
3912
+ function Do(i) {
3440
3913
  return {
3441
- id: Bt.id,
3914
+ id: Kt.id,
3442
3915
  title: "sheetImage.upload.float",
3443
- type: cn.BUTTON,
3444
- hidden$: an(i, F.UNIVER_SHEET)
3916
+ type: Gt.BUTTON,
3917
+ hidden$: Yt(i, $.UNIVER_SHEET)
3445
3918
  };
3446
3919
  }
3447
- function $s(i) {
3920
+ function bo(i) {
3448
3921
  return {
3449
- id: dn.id,
3922
+ id: Mn.id,
3450
3923
  title: "sheetImage.upload.cell",
3451
- type: cn.BUTTON,
3452
- hidden$: an(i, F.UNIVER_SHEET)
3924
+ type: Gt.BUTTON,
3925
+ hidden$: Yt(i, $.UNIVER_SHEET)
3926
+ };
3927
+ }
3928
+ function Mo(i) {
3929
+ var t, e, n, r;
3930
+ return !!((e = (t = i == null ? void 0 : i.p) == null ? void 0 : t.drawingsOrder) != null && e.length && ((r = (n = i == null ? void 0 : i.p) == null ? void 0 : n.drawingsOrder) == null ? void 0 : r.length) > 0);
3931
+ }
3932
+ function yo(i, t) {
3933
+ const e = i.getActiveSheet();
3934
+ if (!e) return !1;
3935
+ const n = e.getCellMatrix(), { startRow: r, endRow: s, startColumn: o, endColumn: a } = t;
3936
+ for (let d = r; d <= s; d++)
3937
+ for (let u = o; u <= a; u++) {
3938
+ const c = n.getValue(d, u);
3939
+ if (Mo(c))
3940
+ return !0;
3941
+ }
3942
+ return !1;
3943
+ }
3944
+ function Eo() {
3945
+ return "showDirectoryPicker" in window;
3946
+ }
3947
+ function dn(i) {
3948
+ const t = i.get(de), e = i.get(ut), n = at([
3949
+ Yt(i, $.UNIVER_SHEET),
3950
+ t.getCurrentTypeOfUnit$($.UNIVER_SHEET).pipe(
3951
+ me((r) => r ? e.selectionMoveEnd$.pipe(
3952
+ pe(() => {
3953
+ if (!Eo())
3954
+ return !0;
3955
+ const s = e.getCurrentSelections();
3956
+ if (!s || s.length === 0)
3957
+ return !0;
3958
+ for (const o of s)
3959
+ if (yo(r, o.range))
3960
+ return !1;
3961
+ return !0;
3962
+ })
3963
+ ) : wn(!0))
3964
+ )
3965
+ ]).pipe(
3966
+ pe(([r, s]) => r || s)
3967
+ );
3968
+ return {
3969
+ id: ct.id,
3970
+ type: Gt.BUTTON,
3971
+ icon: "DownloadImageIcon",
3972
+ title: "sheetImage.save.menuLabel",
3973
+ hidden$: n
3453
3974
  };
3454
3975
  }
3455
- const Fs = {
3456
- [$i.MEDIA]: {
3457
- [Cr]: {
3976
+ const To = {
3977
+ [fs.MEDIA]: {
3978
+ [zr]: {
3458
3979
  order: 0,
3459
- menuItemFactory: Bs,
3460
- [Bt.id]: {
3980
+ menuItemFactory: Ro,
3981
+ [Kt.id]: {
3461
3982
  order: 0,
3462
- menuItemFactory: js
3983
+ menuItemFactory: Do
3463
3984
  },
3464
- [dn.id]: {
3985
+ [Mn.id]: {
3465
3986
  order: 1,
3466
- menuItemFactory: $s
3987
+ menuItemFactory: bo
3988
+ }
3989
+ }
3990
+ },
3991
+ [rn.MAIN_AREA]: {
3992
+ [sn.OTHERS]: {
3993
+ [ct.id]: {
3994
+ order: 10,
3995
+ menuItemFactory: dn
3996
+ }
3997
+ }
3998
+ },
3999
+ [rn.COL_HEADER]: {
4000
+ [sn.OTHERS]: {
4001
+ [ct.id]: {
4002
+ order: 10,
4003
+ menuItemFactory: dn
4004
+ }
4005
+ }
4006
+ },
4007
+ [rn.ROW_HEADER]: {
4008
+ [sn.OTHERS]: {
4009
+ [ct.id]: {
4010
+ order: 10,
4011
+ menuItemFactory: dn
3467
4012
  }
3468
4013
  }
3469
4014
  }
3470
4015
  };
3471
- function st(i) {
3472
- return !i.getContextValue(ti) && !i.getContextValue(ni) && !i.getContextValue(ri) && i.getContextValue($e);
4016
+ function ft(i) {
4017
+ return !i.getContextValue(Ei) && !i.getContextValue(Ti) && !i.getContextValue(Oi) && i.getContextValue(Ge);
3473
4018
  }
3474
- const xs = {
3475
- id: it.id,
4019
+ const Oo = {
4020
+ id: gt.id,
3476
4021
  description: "shortcut.drawing-move-down",
3477
4022
  group: "4_drawing-view",
3478
- binding: Fe.ARROW_DOWN,
4023
+ binding: Ke.ARROW_DOWN,
3479
4024
  priority: 100,
3480
- preconditions: st,
4025
+ preconditions: ft,
3481
4026
  staticParameters: {
3482
- direction: _e.DOWN
4027
+ direction: ve.DOWN
3483
4028
  }
3484
- }, Ys = {
3485
- id: it.id,
4029
+ }, Uo = {
4030
+ id: gt.id,
3486
4031
  description: "shortcut.drawing-move-up",
3487
4032
  group: "4_drawing-view",
3488
- binding: Fe.ARROW_UP,
4033
+ binding: Ke.ARROW_UP,
3489
4034
  priority: 100,
3490
- preconditions: st,
4035
+ preconditions: ft,
3491
4036
  staticParameters: {
3492
- direction: _e.UP
4037
+ direction: ve.UP
3493
4038
  }
3494
- }, Gs = {
3495
- id: it.id,
4039
+ }, Po = {
4040
+ id: gt.id,
3496
4041
  description: "shortcut.drawing-move-left",
3497
4042
  group: "4_drawing-view",
3498
- binding: Fe.ARROW_LEFT,
4043
+ binding: Ke.ARROW_LEFT,
3499
4044
  priority: 100,
3500
- preconditions: st,
4045
+ preconditions: ft,
3501
4046
  staticParameters: {
3502
- direction: _e.LEFT
4047
+ direction: ve.LEFT
3503
4048
  }
3504
- }, Xs = {
3505
- id: it.id,
4049
+ }, Ao = {
4050
+ id: gt.id,
3506
4051
  description: "shortcut.drawing-move-right",
3507
4052
  group: "4_drawing-view",
3508
- binding: Fe.ARROW_RIGHT,
4053
+ binding: Ke.ARROW_RIGHT,
3509
4054
  priority: 100,
3510
- preconditions: st,
4055
+ preconditions: ft,
3511
4056
  staticParameters: {
3512
- direction: _e.RIGHT
4057
+ direction: ve.RIGHT
3513
4058
  }
3514
- }, Ls = {
3515
- id: hr.id,
4059
+ }, No = {
4060
+ id: $r.id,
3516
4061
  description: "shortcut.drawing-delete",
3517
4062
  group: "4_drawing-view",
3518
4063
  // when focusing on any other input tag do not trigger this shortcut
3519
- preconditions: st,
3520
- binding: Fe.DELETE,
3521
- mac: Fe.BACKSPACE
4064
+ preconditions: ft,
4065
+ binding: Ke.DELETE,
4066
+ mac: Ke.BACKSPACE
3522
4067
  };
3523
- var Vs = Object.getOwnPropertyDescriptor, Hs = (i, t, e, n) => {
3524
- for (var r = n > 1 ? void 0 : n ? Vs(t, e) : t, s = i.length - 1, o; s >= 0; s--)
4068
+ var $o = Object.getOwnPropertyDescriptor, ko = (i, t, e, n) => {
4069
+ for (var r = n > 1 ? void 0 : n ? $o(t, e) : t, s = i.length - 1, o; s >= 0; s--)
3525
4070
  (o = i[s]) && (r = o(r) || r);
3526
4071
  return r;
3527
- }, Ne = (i, t) => (e, n) => t(e, n, i);
3528
- let Ut = class extends ne {
4072
+ }, Be = (i, t) => (e, n) => t(e, n, i);
4073
+ let Ft = class extends ee {
3529
4074
  constructor(i, t, e, n, r, s) {
3530
4075
  super(), this._componentManager = i, this._menuManagerService = t, this._commandService = e, this._shortcutService = n, this._drawingManagerService = r, this._sheetsSelectionsService = s, this._init();
3531
4076
  }
3532
4077
  _initCustomComponents() {
3533
4078
  const i = this._componentManager;
3534
- this.disposeWithMe(i.register(pr, Ws));
4079
+ this.disposeWithMe(i.register(Br, Co)), this.disposeWithMe(i.register(ze, vo)), this.disposeWithMe(i.register("DownloadImageIcon", Xr));
3535
4080
  }
3536
4081
  _initMenus() {
3537
- this._menuManagerService.mergeMenu(Fs);
4082
+ this._menuManagerService.mergeMenu(To);
3538
4083
  }
3539
4084
  _initCommands() {
3540
4085
  [
3541
- Bt,
3542
- dn,
3543
- kt,
3544
- rt,
3545
- Wt,
3546
- wr,
3547
- Y,
3548
- _r,
3549
- gr,
3550
- mr,
3551
- it,
3552
- hr,
3553
- fr
4086
+ Kt,
4087
+ Mn,
4088
+ Xt,
4089
+ ht,
4090
+ zt,
4091
+ jr,
4092
+ V,
4093
+ Fr,
4094
+ kr,
4095
+ Wr,
4096
+ gt,
4097
+ $r,
4098
+ xr,
4099
+ ct
3554
4100
  ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
3555
4101
  }
3556
4102
  _initShortcuts() {
3557
4103
  [
3558
4104
  // sheet drawing shortcuts
3559
- xs,
3560
- Ys,
3561
- Gs,
3562
- Xs,
3563
- Ls
4105
+ Oo,
4106
+ Uo,
4107
+ Po,
4108
+ Ao,
4109
+ No
3564
4110
  ].forEach((i) => {
3565
4111
  this.disposeWithMe(this._shortcutService.registerShortcut(i));
3566
4112
  });
@@ -3569,100 +4115,106 @@ let Ut = class extends ne {
3569
4115
  this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
3570
4116
  }
3571
4117
  };
3572
- Ut = Hs([
3573
- Ne(0, A(dr)),
3574
- Ne(1, Fi),
3575
- Ne(2, X),
3576
- Ne(3, xi),
3577
- Ne(4, ie),
3578
- Ne(5, A(on))
3579
- ], Ut);
3580
- 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) => {
3581
- for (var r = n > 1 ? void 0 : n ? Ks(t, e) : t, s = i.length - 1, o; s >= 0; s--)
4118
+ Ft = ko([
4119
+ Be(0, A(Ur)),
4120
+ Be(1, ms),
4121
+ Be(2, Y),
4122
+ Be(3, ps),
4123
+ Be(4, oe),
4124
+ Be(5, A(ut))
4125
+ ], Ft);
4126
+ var xo = Object.defineProperty, Wo = Object.getOwnPropertyDescriptor, Bo = (i, t, e) => t in i ? xo(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, jo = (i, t, e, n) => {
4127
+ for (var r = n > 1 ? void 0 : n ? Wo(t, e) : t, s = i.length - 1, o; s >= 0; s--)
3582
4128
  (o = i[s]) && (r = o(r) || r);
3583
4129
  return r;
3584
- }, Lt = (i, t) => (e, n) => t(e, n, i), Dr = (i, t, e) => Js(i, typeof t != "symbol" ? t + "" : t, e);
3585
- const qs = "SHEET_IMAGE_UI_PLUGIN";
3586
- let Pt = class extends oi {
3587
- constructor(i = jn, t, e, n) {
4130
+ }, ln = (i, t) => (e, n) => t(e, n, i), Kr = (i, t, e) => Bo(i, typeof t != "symbol" ? t + "" : t, e);
4131
+ const Fo = "SHEET_IMAGE_UI_PLUGIN";
4132
+ let Lt = class extends Ai {
4133
+ constructor(i = sr, t, e, n) {
3588
4134
  super(), this._config = i, this._injector = t, this._renderManagerService = e, this._configService = n;
3589
- const { menu: r, ...s } = ai(
4135
+ const { menu: r, ...s } = Ni(
3590
4136
  {},
3591
- jn,
4137
+ sr,
3592
4138
  this._config
3593
4139
  );
3594
- r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(ss, s);
4140
+ r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Ws, s);
3595
4141
  }
3596
4142
  onStarting() {
3597
- ci(this._injector, [
3598
- [tt],
3599
- [Ut],
3600
- [Rt],
3601
- [Ot],
3602
- [Et],
3603
- [Tt],
3604
- [bt],
3605
- [Mt],
3606
- [yt]
3607
- ]), xt(this._injector, [
3608
- [tt]
4143
+ $i(this._injector, [
4144
+ [lt],
4145
+ [Ft],
4146
+ [Nt],
4147
+ [jt],
4148
+ [Bt],
4149
+ [Wt],
4150
+ [$t],
4151
+ [kt],
4152
+ [xt],
4153
+ [yn, { useClass: vn }]
4154
+ ]), Qt(this._injector, [
4155
+ [lt]
3609
4156
  ]);
3610
4157
  }
3611
4158
  onReady() {
3612
- xt(this._injector, [
3613
- [Tt],
3614
- [yt]
4159
+ Qt(this._injector, [
4160
+ [Wt],
4161
+ [xt]
3615
4162
  ]);
3616
4163
  }
3617
4164
  onRendered() {
3618
- this._registerRenderModules(), xt(this._injector, [
3619
- [Et],
3620
- [Ot],
3621
- [Ut],
3622
- [bt],
3623
- [Mt]
4165
+ this._registerRenderModules(), Qt(this._injector, [
4166
+ [Bt],
4167
+ [jt],
4168
+ [Ft],
4169
+ [$t],
4170
+ [kt]
3624
4171
  ]);
3625
4172
  }
3626
4173
  onSteady() {
3627
- this._injector.get(Rt);
4174
+ this._injector.get(Nt);
3628
4175
  }
3629
4176
  _registerRenderModules() {
3630
4177
  [
3631
- [et],
3632
- [rn],
3633
- [nn],
3634
- [tn]
4178
+ [dt],
4179
+ [Rn],
4180
+ [Cn],
4181
+ [In]
3635
4182
  ].forEach((i) => {
3636
- this.disposeWithMe(this._renderManagerService.registerRenderModule(F.UNIVER_SHEET, i));
4183
+ this.disposeWithMe(this._renderManagerService.registerRenderModule($.UNIVER_SHEET, i));
3637
4184
  });
3638
4185
  }
3639
4186
  };
3640
- Dr(Pt, "type", F.UNIVER_SHEET);
3641
- Dr(Pt, "pluginName", qs);
3642
- Pt = Zs([
3643
- ii(Ui, Gi, Ki, di),
3644
- Lt(1, A(Ge)),
3645
- Lt(2, J),
3646
- Lt(3, si)
3647
- ], Pt);
4187
+ Kr(Lt, "type", $.UNIVER_SHEET);
4188
+ Kr(Lt, "pluginName", Fo);
4189
+ Lt = jo([
4190
+ Ui(as, _s, Ds, ki),
4191
+ ln(1, A(qe)),
4192
+ ln(2, Q),
4193
+ ln(3, Pi)
4194
+ ], Lt);
3648
4195
  export {
3649
- Y as ClearSheetDrawingTransformerOperation,
3650
- hr as DeleteDrawingsCommand,
3651
- _r as EditSheetDrawingOperation,
3652
- gr as GroupSheetDrawingCommand,
3653
- Bt as InsertFloatImageCommand,
3654
- kt as InsertSheetDrawingCommand,
3655
- it as MoveDrawingsCommand,
3656
- rt as RemoveSheetDrawingCommand,
3657
- Cr as SHEETS_IMAGE_MENU_ID,
3658
- fr as SetDrawingArrangeCommand,
3659
- Wt as SetSheetDrawingCommand,
3660
- tt as SheetCanvasFloatDomManagerService,
3661
- et as SheetDrawingUpdateController,
3662
- wr as SidebarSheetDrawingOperation,
3663
- mr as UngroupSheetDrawingCommand,
3664
- Pt as UniverSheetsDrawingUIPlugin,
3665
- ge as calcSheetFloatDomPosition,
3666
- z as drawingPositionToTransform,
3667
- $ as transformToDrawingPosition
4196
+ vn as BatchSaveImagesService,
4197
+ V as ClearSheetDrawingTransformerOperation,
4198
+ $r as DeleteDrawingsCommand,
4199
+ Fr as EditSheetDrawingOperation,
4200
+ ye as FileNamePart,
4201
+ kr as GroupSheetDrawingCommand,
4202
+ yn as IBatchSaveImagesService,
4203
+ Kt as InsertFloatImageCommand,
4204
+ Xt as InsertSheetDrawingCommand,
4205
+ gt as MoveDrawingsCommand,
4206
+ ht as RemoveSheetDrawingCommand,
4207
+ zr as SHEETS_IMAGE_MENU_ID,
4208
+ ao as SHEET_FLOAT_DOM_PREFIX,
4209
+ ct as SaveCellImagesCommand,
4210
+ xr as SetDrawingArrangeCommand,
4211
+ zt as SetSheetDrawingCommand,
4212
+ lt as SheetCanvasFloatDomManagerService,
4213
+ dt as SheetDrawingUpdateController,
4214
+ jr as SidebarSheetDrawingOperation,
4215
+ Wr as UngroupSheetDrawingCommand,
4216
+ Lt as UniverSheetsDrawingUIPlugin,
4217
+ fe as calcSheetFloatDomPosition,
4218
+ Z as drawingPositionToTransform,
4219
+ j as transformToDrawingPosition
3668
4220
  };