@univerjs/docs-drawing-ui 0.6.4-nightly.202503111607 → 0.6.5-nightly.202503121607

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,27 +1,27 @@
1
- var Ct = Object.defineProperty;
2
- var Dt = (i, e, n) => e in i ? Ct(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
3
- var Ce = (i, e, n) => Dt(i, typeof e != "symbol" ? e + "" : e, n);
4
- import { Disposable as Xe, BlockType as Ot, UndoCommand as Tt, RedoCommand as Pt, JSONX as q, IUniverInstanceService as K, ICommandService as z, PositionedObjectLayoutType as H, CommandType as Y, BooleanNumber as oe, ObjectRelativeFromH as ne, ObjectRelativeFromV as V, Tools as ye, TextX as vn, TextXActionType as Q, toDisposable as Le, throttle as Tn, COLORS as yt, MemoryCursor as bt, IUndoRedoService as Vn, BuildTextUtils as Mt, ArrangeTypeEnum as Ze, Inject as ve, IContextService as jn, LocaleService as ln, WrapTextType as $e, DrawingTypeEnum as Rt, FOCUSING_COMMON_DRAWINGS as tn, UniverInstanceType as be, Direction as fe, DocumentFlavor as fn, DOCS_ZEN_EDITOR_UNIT_ID_KEY as In, FOCUSING_UNIVER_EDITOR as Nt, RxDisposable as Et, SHEET_EDITOR_UNITS as At, LifecycleService as xt, fromEventSubject as Lt, LifecycleStages as Pn, DependentOn as Bt, Injector as Ut, IConfigService as kt, Plugin as Ft, merge as Ht } from "@univerjs/core";
5
- import { IDocDrawingService as Be, UniverDocsDrawingPlugin as Wt } from "@univerjs/docs-drawing";
6
- import { IDrawingManagerService as Ie, IImageIoService as Gt, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Vt, DRAWING_IMAGE_COUNT_LIMIT as yn, ImageUploadStatusType as hn, DRAWING_IMAGE_ALLOW_SIZE as jt, getImageSize as $t, getDrawingShapeKeyByDrawingSearch as zt, DRAWING_IMAGE_WIDTH_LIMIT as bn, DRAWING_IMAGE_HEIGHT_LIMIT as Mn, UniverDrawingPlugin as qt } from "@univerjs/drawing";
7
- import { DrawingCommonPanel as Xt, ImageCropperObject as Kt, COMPONENT_IMAGE_POPUP_MENU as Yt, OpenImageCropOperation as Zt, ImageResetSizeOperation as Qt, UniverDrawingUIPlugin as Jt } from "@univerjs/drawing-ui";
8
- import { IRenderManagerService as ee, DocumentEditArea as Fe, Liquid as $n, PageLayoutType as Rn, DocumentSkeletonPageType as Nn, Vector2 as ei, Rect as ni, getColor as ti, getCurrentTypeOfRenderer as ii, TRANSFORM_CHANGE_OBSERVABLE_TYPE as ri } from "@univerjs/engine-render";
9
- import { IMessageService as oi, ILocalFileService as si, ISidebarService as ai, useDependency as we, getMenuHiddenObservable as zn, MenuItemType as qn, RibbonStartGroup as ci, KeyCode as He, ComponentManager as di, IMenuManagerService as li, IShortcutService as gi, UniverUIPlugin as mi } from "@univerjs/ui";
10
- import { RichTextEditingMutation as J, DocSkeletonManagerService as se, DocSelectionManagerService as _n } from "@univerjs/docs";
11
- import { DocSelectionRenderService as Me, getRichTextEditPath as ze, NodePositionConvertToCursor as En, getOneTextSelectionRange as An, getAnchorBounding as ui, TEXT_RANGE_LAYER_INDEX as fi, getDocObject as hi, getCustomBlockIdsInSelections as pi, docDrawingPositionToTransform as wi, DocCanvasPopManagerService as vi, IEditorService as Ii, SetDocZoomRatioOperation as _i } from "@univerjs/docs-ui";
12
- import { BehaviorSubject as Si, debounceTime as Xn, Observable as Ci, takeUntil as xn, filter as Ln } from "rxjs";
13
- import { MessageType as Bn, clsx as j, InputNumber as ke, Select as Un, Checkbox as Di, RadioGroup as kn, Radio as Pe } from "@univerjs/design";
14
- import { jsxs as X, jsx as f } from "react/jsx-runtime";
15
- import { forwardRef as Kn, useRef as Oi, createElement as Yn, useState as re, useEffect as Sn } from "react";
16
- const Ti = "docs-drawing-ui.config", Fn = {};
17
- var Pi = Object.getOwnPropertyDescriptor, yi = (i, e, n, t) => {
18
- for (var r = t > 1 ? void 0 : t ? Pi(e, n) : e, o = i.length - 1, s; o >= 0; o--)
1
+ var At = Object.defineProperty;
2
+ var xt = (i, e, n) => e in i ? At(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
3
+ var _e = (i, e, n) => xt(i, typeof e != "symbol" ? e + "" : e, n);
4
+ import { Disposable as Ge, BlockType as Lt, UndoCommand as Ut, RedoCommand as Bt, JSONX as X, IUniverInstanceService as q, ICommandService as $, PositionedObjectLayoutType as W, CommandType as Y, BooleanNumber as se, ObjectRelativeFromH as ee, ObjectRelativeFromV as H, Tools as Me, TextX as Sn, TextXActionType as Q, toDisposable as Oe, throttle as Rn, COLORS as kt, MemoryCursor as Ft, IUndoRedoService as Yn, BuildTextUtils as Wt, ArrangeTypeEnum as Qe, Inject as pe, IContextService as Zn, LocaleService as mn, WrapTextType as Xe, DrawingTypeEnum as Dn, FOCUSING_COMMON_DRAWINGS as rn, UniverInstanceType as Se, Direction as fe, DocumentFlavor as pn, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Cn, FOCUSING_UNIVER_EDITOR as Ht, DisposableCollection as Gt, fromEventSubject as Qn, generateRandomId as Vt, RxDisposable as jt, SHEET_EDITOR_UNITS as $t, LifecycleService as zt, LifecycleStages as En, DependentOn as Xt, Injector as qt, IConfigService as Kt, Plugin as Yt, merge as Zt } from "@univerjs/core";
5
+ import { IDocDrawingService as Ue, UniverDocsDrawingPlugin as Qt } from "@univerjs/docs-drawing";
6
+ import { IDrawingManagerService as Ie, IImageIoService as Jt, DRAWING_IMAGE_ALLOW_IMAGE_LIST as ei, DRAWING_IMAGE_COUNT_LIMIT as Nn, ImageUploadStatusType as wn, DRAWING_IMAGE_ALLOW_SIZE as ni, getImageSize as ti, getDrawingShapeKeyByDrawingSearch as ii, DRAWING_IMAGE_WIDTH_LIMIT as An, DRAWING_IMAGE_HEIGHT_LIMIT as xn, UniverDrawingPlugin as ri } from "@univerjs/drawing";
7
+ import { DrawingCommonPanel as oi, DrawingRenderService as si, ImageCropperObject as ai, COMPONENT_IMAGE_POPUP_MENU as ci, OpenImageCropOperation as di, ImageResetSizeOperation as li, UniverDrawingUIPlugin as gi } from "@univerjs/drawing-ui";
8
+ import { IRenderManagerService as J, DocumentEditArea as We, Liquid as Jn, PageLayoutType as Ln, DocumentSkeletonPageType as Un, Vector2 as mi, Rect as ui, getColor as fi, getCurrentTypeOfRenderer as hi, CURSOR_TYPE as Bn, TRANSFORM_CHANGE_OBSERVABLE_TYPE as pi } from "@univerjs/engine-render";
9
+ import { IMessageService as wi, ILocalFileService as vi, ISidebarService as Ii, useDependency as ve, getMenuHiddenObservable as et, MenuItemType as nt, RibbonStartGroup as _i, KeyCode as He, ComponentManager as Si, IMenuManagerService as Di, IShortcutService as Ci, CanvasFloatDomService as Oi, UniverUIPlugin as Ti } from "@univerjs/ui";
10
+ import { RichTextEditingMutation as ne, DocSkeletonManagerService as te, DocSelectionManagerService as On } from "@univerjs/docs";
11
+ import { DocSelectionRenderService as Re, getRichTextEditPath as qe, NodePositionConvertToCursor as kn, getOneTextSelectionRange as Fn, getAnchorBounding as yi, TEXT_RANGE_LAYER_INDEX as Pi, getDocObject as bi, getCustomBlockIdsInSelections as Mi, docDrawingPositionToTransform as tt, VIEWPORT_KEY as it, SetDocZoomRatioOperation as rt, DocCanvasPopManagerService as Ri, IEditorService as Ei } from "@univerjs/docs-ui";
12
+ import { BehaviorSubject as ot, debounceTime as st, Observable as Ni, map as Wn, switchMap as Ai, of as xi, takeUntil as Hn, filter as Gn } from "rxjs";
13
+ import { MessageType as Vn, clsx as j, InputNumber as Fe, Select as jn, Checkbox as Li, RadioGroup as $n, Radio as be } from "@univerjs/design";
14
+ import { jsxs as K, jsx as w } from "react/jsx-runtime";
15
+ import { forwardRef as at, useRef as Ui, createElement as ct, useState as oe, useEffect as Tn } from "react";
16
+ const Bi = "docs-drawing-ui.config", zn = {};
17
+ var ki = Object.getOwnPropertyDescriptor, Fi = (i, e, n, t) => {
18
+ for (var r = t > 1 ? void 0 : t ? ki(e, n) : e, o = i.length - 1, s; o >= 0; o--)
19
19
  (s = i[o]) && (r = s(r) || r);
20
20
  return r;
21
- }, Ve = (i, e) => (n, t) => e(n, t, i);
22
- function bi(i) {
21
+ }, $e = (i, e) => (n, t) => e(n, t, i);
22
+ function Wi(i) {
23
23
  var t, r, o, s;
24
- if (q.isNoop(i) || !Array.isArray(i))
24
+ if (X.isNoop(i) || !Array.isArray(i))
25
25
  return null;
26
26
  const e = i.find((a) => Array.isArray(a) && (a == null ? void 0 : a[0]) === "drawings");
27
27
  if (e == null || !Array.isArray(e) || e.length < 3 || typeof e[1] == "string" && typeof e[2] != "object" || Array.isArray(e[1]) && typeof e[1][1] != "object")
@@ -42,7 +42,7 @@ function bi(i) {
42
42
  });
43
43
  return n;
44
44
  }
45
- function Mi(i) {
45
+ function Hi(i) {
46
46
  if (!Array.isArray(i) || i.length < 3 || i[0] !== "drawingsOrder")
47
47
  return [];
48
48
  const e = [];
@@ -57,7 +57,7 @@ function Mi(i) {
57
57
  }
58
58
  return e;
59
59
  }
60
- let rn = class extends Xe {
60
+ let on = class extends Ge {
61
61
  constructor(i, e, n, t, r) {
62
62
  super(), this._univerInstanceService = i, this._commandService = e, this._drawingManagerService = n, this._docDrawingService = t, this._renderManagerService = r, this._initialize();
63
63
  }
@@ -68,26 +68,26 @@ let rn = class extends Xe {
68
68
  this.disposeWithMe(
69
69
  this._commandService.beforeCommandExecuted((i) => {
70
70
  var a, d;
71
- if (i.id !== J.id)
71
+ if (i.id !== ne.id)
72
72
  return;
73
- const e = i.params, { unitId: n, actions: t } = e, r = this._univerInstanceService.getUniverDocInstance(n), o = (d = (a = r == null ? void 0 : r.getBody()) == null ? void 0 : a.customBlocks) != null ? d : [], s = bi(t);
73
+ const e = i.params, { unitId: n, actions: t } = e, r = this._univerInstanceService.getUniverDocInstance(n), o = (d = (a = r == null ? void 0 : r.getBody()) == null ? void 0 : a.customBlocks) != null ? d : [], s = Wi(t);
74
74
  if (s != null)
75
75
  for (const { type: c, drawingId: l, drawing: m } of s) {
76
- const g = o.find((p) => p.blockId === l);
77
- (g == null ? void 0 : g.blockType) !== Ot.CUSTOM && (c === "add" ? this._addDrawings(n, [m]) : this._removeDrawings(n, [l]));
76
+ const g = o.find((f) => f.blockId === l);
77
+ (g == null ? void 0 : g.blockType) !== Lt.CUSTOM && (c === "add" ? this._addDrawings(n, [m]) : this._removeDrawings(n, [l]));
78
78
  }
79
79
  })
80
80
  ), this.disposeWithMe(
81
81
  this._commandService.onCommandExecuted((i) => {
82
- if (i.id !== J.id)
82
+ if (i.id !== ne.id)
83
83
  return;
84
84
  const e = i.params, { unitId: n, actions: t } = e;
85
- Mi(t).length > 0 && this._updateDrawingsOrder(n);
85
+ Hi(t).length > 0 && this._updateDrawingsOrder(n);
86
86
  })
87
87
  ), this.disposeWithMe(
88
88
  this._commandService.onCommandExecuted((i) => {
89
89
  var s;
90
- if (i.id !== Tt.id && i.id !== Pt.id)
90
+ if (i.id !== Ut.id && i.id !== Bt.id)
91
91
  return;
92
92
  const e = (s = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : s.getUnitId(), n = this._drawingManagerService.getFocusDrawings();
93
93
  if (e == null || n.length === 0)
@@ -128,36 +128,36 @@ let rn = class extends Xe {
128
128
  t.orderNotification(o), r.orderNotification(o);
129
129
  }
130
130
  };
131
- rn = yi([
132
- Ve(0, K),
133
- Ve(1, z),
134
- Ve(2, Ie),
135
- Ve(3, Be),
136
- Ve(4, ee)
137
- ], rn);
138
- class gn {
131
+ on = Fi([
132
+ $e(0, q),
133
+ $e(1, $),
134
+ $e(2, Ie),
135
+ $e(3, Ue),
136
+ $e(4, J)
137
+ ], on);
138
+ class un {
139
139
  constructor() {
140
- Ce(this, "_refreshDrawings$", new Si(null));
141
- Ce(this, "refreshDrawings$", this._refreshDrawings$.asObservable());
140
+ _e(this, "_refreshDrawings$", new ot(null));
141
+ _e(this, "refreshDrawings$", this._refreshDrawings$.asObservable());
142
142
  }
143
143
  refreshDrawings(e) {
144
144
  this._refreshDrawings$.next(e);
145
145
  }
146
146
  }
147
147
  var ue = /* @__PURE__ */ ((i) => (i.INLINE = "inline", i.BEHIND_TEXT = "behindText", i.IN_FRONT_OF_TEXT = "inFrontOfText", i.WRAP_SQUARE = "wrapSquare", i.WRAP_TOP_AND_BOTTOM = "wrapTopAndBottom", i))(ue || {});
148
- const Ri = {
149
- inline: H.INLINE,
150
- wrapSquare: H.WRAP_SQUARE,
151
- wrapTopAndBottom: H.WRAP_TOP_AND_BOTTOM,
152
- inFrontOfText: H.WRAP_NONE,
153
- behindText: H.WRAP_NONE
148
+ const Gi = {
149
+ inline: W.INLINE,
150
+ wrapSquare: W.WRAP_SQUARE,
151
+ wrapTopAndBottom: W.WRAP_TOP_AND_BOTTOM,
152
+ inFrontOfText: W.WRAP_NONE,
153
+ behindText: W.WRAP_NONE
154
154
  };
155
- function Zn(i, e, n, t, r, o, s) {
156
- var p, h;
157
- const a = new vn(), d = q.getInstance(), c = [], l = o.getSelfOrHeaderFooterModel(e).getBody(), m = o.getSelfOrHeaderFooterModel(i).getBody();
155
+ function dt(i, e, n, t, r, o, s) {
156
+ var f, u;
157
+ const a = new Sn(), d = X.getInstance(), c = [], l = o.getSelfOrHeaderFooterModel(e).getBody(), m = o.getSelfOrHeaderFooterModel(i).getBody();
158
158
  if (l == null || m == null)
159
159
  return;
160
- const g = (h = (p = l.customBlocks) == null ? void 0 : p.find((v) => v.blockId === r)) == null ? void 0 : h.startIndex;
160
+ const g = (u = (f = l.customBlocks) == null ? void 0 : f.find((h) => h.blockId === r)) == null ? void 0 : u.startIndex;
161
161
  if (g != null) {
162
162
  if (t = Math.min(m.dataStream.length - 2, t), i === e) {
163
163
  if (t < g ? (t > 0 && a.push({
@@ -199,8 +199,8 @@ function Zn(i, e, n, t, r, o, s) {
199
199
  },
200
200
  len: 1
201
201
  })), t !== g) {
202
- const v = ze(o, e), w = d.editOp(a.serialize(), v);
203
- c.push(w);
202
+ const h = qe(o, e), v = d.editOp(a.serialize(), h);
203
+ c.push(v);
204
204
  }
205
205
  } else {
206
206
  g > 0 && a.push({
@@ -210,8 +210,8 @@ function Zn(i, e, n, t, r, o, s) {
210
210
  t: Q.DELETE,
211
211
  len: 1
212
212
  });
213
- let v = ze(o, e), w = d.editOp(a.serialize(), v);
214
- c.push(w), a.empty(), t > 0 && a.push({
213
+ let h = qe(o, e), v = d.editOp(a.serialize(), h);
214
+ c.push(v), a.empty(), t > 0 && a.push({
215
215
  t: Q.RETAIN,
216
216
  len: t
217
217
  }), a.push({
@@ -224,54 +224,54 @@ function Zn(i, e, n, t, r, o, s) {
224
224
  }]
225
225
  },
226
226
  len: 1
227
- }), v = ze(o, i), w = d.editOp(a.serialize(), v), c.push(w), s.setSegment(i), s.setSegmentPage(n);
227
+ }), h = qe(o, i), v = d.editOp(a.serialize(), h), c.push(v), s.setSegment(i), s.setSegmentPage(n);
228
228
  }
229
229
  return c;
230
230
  }
231
231
  }
232
- const Qn = {
232
+ const lt = {
233
233
  id: "doc.command.update-doc-drawing-wrapping-style",
234
234
  type: Y.COMMAND,
235
235
  // eslint-disable-next-line max-lines-per-function, complexity
236
236
  handler: (i, e) => {
237
- var E, U;
237
+ var N, B;
238
238
  if (e == null)
239
239
  return !1;
240
- const { drawings: n, wrappingStyle: t, unitId: r } = e, o = i.get(z), s = i.get(K), d = i.get(ee).getRenderById(r), c = d == null ? void 0 : d.with(se).getSkeleton().getSkeletonData(), l = d == null ? void 0 : d.with(se).getViewModel(), m = d == null ? void 0 : d.scene, g = s.getCurrentUniverDocInstance();
240
+ const { drawings: n, wrappingStyle: t, unitId: r } = e, o = i.get($), s = i.get(q), d = i.get(J).getRenderById(r), c = d == null ? void 0 : d.with(te).getSkeleton().getSkeletonData(), l = d == null ? void 0 : d.with(te).getViewModel(), m = d == null ? void 0 : d.scene, g = s.getCurrentUniverDocInstance();
241
241
  if (g == null || c == null || m == null || l == null)
242
242
  return !1;
243
- const p = l.getEditArea(), h = m.getTransformerByCreate(), { pages: v, skeHeaders: w, skeFooters: S } = c, O = q.getInstance(), D = [], { drawings: T = {} } = g.getSnapshot();
244
- for (const N of n) {
245
- const { drawingId: I } = N, L = T[I].layoutType, W = Ri[t];
246
- if (L !== W) {
247
- const C = O.replaceOp(["drawings", I, "layoutType"], L, W);
248
- D.push(C);
243
+ const f = l.getEditArea(), u = m.getTransformerByCreate(), { pages: h, skeHeaders: v, skeFooters: I } = c, O = X.getInstance(), C = [], { drawings: T = {} } = g.getSnapshot();
244
+ for (const E of n) {
245
+ const { drawingId: _ } = E, L = T[_].layoutType, G = Gi[t];
246
+ if (L !== G) {
247
+ const D = O.replaceOp(["drawings", _, "layoutType"], L, G);
248
+ C.push(D);
249
249
  }
250
250
  if (t === "behindText" || t === "inFrontOfText") {
251
- const C = T[I].behindDoc, R = t === "behindText" ? oe.TRUE : oe.FALSE;
252
- if (C !== R) {
253
- const P = O.replaceOp(["drawings", I, "behindDoc"], C, R);
254
- D.push(P);
251
+ const D = T[_].behindDoc, R = t === "behindText" ? se.TRUE : se.FALSE;
252
+ if (D !== R) {
253
+ const y = O.replaceOp(["drawings", _, "behindDoc"], D, R);
254
+ C.push(y);
255
255
  }
256
256
  }
257
257
  if (t === "inline")
258
258
  continue;
259
- let x = null, G = 0, _ = 0;
260
- for (const C of v) {
261
- const { headerId: R, footerId: P, marginTop: B, marginLeft: k, marginBottom: b, pageWidth: A, pageHeight: $ } = C;
262
- switch (p) {
263
- case Fe.HEADER: {
264
- const F = (E = w.get(R)) == null ? void 0 : E.get(A);
265
- F != null && F.skeDrawings.has(I) && (x = F.skeDrawings.get(I), G = F.marginTop, _ = k);
259
+ let x = null, V = 0, S = 0;
260
+ for (const D of h) {
261
+ const { headerId: R, footerId: y, marginTop: U, marginLeft: k, marginBottom: b, pageWidth: A, pageHeight: z } = D;
262
+ switch (f) {
263
+ case We.HEADER: {
264
+ const F = (N = v.get(R)) == null ? void 0 : N.get(A);
265
+ F != null && F.skeDrawings.has(_) && (x = F.skeDrawings.get(_), V = F.marginTop, S = k);
266
266
  break;
267
267
  }
268
- case Fe.FOOTER: {
269
- const F = (U = S.get(P)) == null ? void 0 : U.get(A);
270
- F != null && F.skeDrawings.has(I) && (x = F.skeDrawings.get(I), G = $ - b + F.marginTop, _ = k);
268
+ case We.FOOTER: {
269
+ const F = (B = I.get(y)) == null ? void 0 : B.get(A);
270
+ F != null && F.skeDrawings.has(_) && (x = F.skeDrawings.get(_), V = z - b + F.marginTop, S = k);
271
271
  break;
272
272
  }
273
- case Fe.BODY: {
274
- C.skeDrawings.has(I) && (x = C.skeDrawings.get(I), G = B, _ = k);
273
+ case We.BODY: {
274
+ D.skeDrawings.has(_) && (x = D.skeDrawings.get(_), V = U, S = k);
275
275
  break;
276
276
  }
277
277
  }
@@ -279,121 +279,121 @@ const Qn = {
279
279
  break;
280
280
  }
281
281
  if (x != null) {
282
- const { aTop: C, aLeft: R } = x, P = T[I].docTransform.positionH;
283
- let B = R;
284
- P.relativeFrom === ne.MARGIN ? B -= _ : P.relativeFrom === ne.COLUMN && (B -= x.columnLeft);
282
+ const { aTop: D, aLeft: R } = x, y = T[_].docTransform.positionH;
283
+ let U = R;
284
+ y.relativeFrom === ee.MARGIN ? U -= S : y.relativeFrom === ee.COLUMN && (U -= x.columnLeft);
285
285
  const k = {
286
- relativeFrom: P.relativeFrom,
287
- posOffset: B
286
+ relativeFrom: y.relativeFrom,
287
+ posOffset: U
288
288
  };
289
- if (P.posOffset !== k.posOffset) {
290
- const F = O.replaceOp(["drawings", I, "docTransform", "positionH"], P, k);
291
- D.push(F);
289
+ if (y.posOffset !== k.posOffset) {
290
+ const F = O.replaceOp(["drawings", _, "docTransform", "positionH"], y, k);
291
+ C.push(F);
292
292
  }
293
- const b = T[I].docTransform.positionV;
294
- let A = C;
295
- b.relativeFrom === V.PAGE ? A += G : b.relativeFrom === V.LINE ? A -= x.lineTop : b.relativeFrom === V.PARAGRAPH && (A -= x.blockAnchorTop);
296
- const $ = {
293
+ const b = T[_].docTransform.positionV;
294
+ let A = D;
295
+ b.relativeFrom === H.PAGE ? A += V : b.relativeFrom === H.LINE ? A -= x.lineTop : b.relativeFrom === H.PARAGRAPH && (A -= x.blockAnchorTop);
296
+ const z = {
297
297
  relativeFrom: b.relativeFrom,
298
298
  posOffset: A
299
299
  };
300
- if (b.posOffset !== $.posOffset) {
301
- const F = O.replaceOp(["drawings", I, "docTransform", "positionV"], b, $);
302
- D.push(F);
300
+ if (b.posOffset !== z.posOffset) {
301
+ const F = O.replaceOp(["drawings", _, "docTransform", "positionV"], b, z);
302
+ C.push(F);
303
303
  }
304
304
  }
305
305
  }
306
306
  const M = {
307
- id: J.id,
307
+ id: ne.id,
308
308
  params: {
309
309
  unitId: r,
310
310
  actions: [],
311
311
  textRanges: null
312
312
  }
313
313
  };
314
- M.params.actions = D.reduce((N, I) => q.compose(N, I), null);
315
- const y = o.syncExecuteCommand(M.id, M.params);
316
- return h.refreshControls(), !!y;
314
+ M.params.actions = C.reduce((E, _) => X.compose(E, _), null);
315
+ const P = o.syncExecuteCommand(M.id, M.params);
316
+ return u.refreshControls(), !!P;
317
317
  }
318
- }, Jn = {
318
+ }, gt = {
319
319
  id: "doc.command.update-doc-drawing-distance",
320
320
  type: Y.COMMAND,
321
321
  handler: (i, e) => {
322
322
  if (e == null)
323
323
  return !1;
324
- const n = i.get(z), r = i.get(K).getCurrentUniverDocInstance();
324
+ const n = i.get($), r = i.get(q).getCurrentUniverDocInstance();
325
325
  if (r == null)
326
326
  return !1;
327
- const { drawings: o, dist: s, unitId: a } = e, d = q.getInstance(), c = [], { drawings: l = {} } = r.getSnapshot();
328
- for (const p of o) {
329
- const { drawingId: h } = p;
330
- for (const [v, w] of Object.entries(s)) {
331
- const S = l[h][v];
332
- if (S !== w) {
333
- const O = d.replaceOp(["drawings", h, v], S, w);
327
+ const { drawings: o, dist: s, unitId: a } = e, d = X.getInstance(), c = [], { drawings: l = {} } = r.getSnapshot();
328
+ for (const f of o) {
329
+ const { drawingId: u } = f;
330
+ for (const [h, v] of Object.entries(s)) {
331
+ const I = l[u][h];
332
+ if (I !== v) {
333
+ const O = d.replaceOp(["drawings", u, h], I, v);
334
334
  c.push(O);
335
335
  }
336
336
  }
337
337
  }
338
338
  const m = {
339
- id: J.id,
339
+ id: ne.id,
340
340
  params: {
341
341
  unitId: a,
342
342
  actions: [],
343
343
  textRanges: null
344
344
  }
345
345
  };
346
- return m.params.actions = c.reduce((p, h) => q.compose(p, h), null), !!n.syncExecuteCommand(m.id, m.params);
346
+ return m.params.actions = c.reduce((f, u) => X.compose(f, u), null), !!n.syncExecuteCommand(m.id, m.params);
347
347
  }
348
- }, et = {
348
+ }, mt = {
349
349
  id: "doc.command.update-doc-drawing-wrap-text",
350
350
  type: Y.COMMAND,
351
351
  handler: (i, e) => {
352
352
  if (e == null)
353
353
  return !1;
354
- const n = i.get(z), r = i.get(K).getCurrentUniverDocInstance();
354
+ const n = i.get($), r = i.get(q).getCurrentUniverDocInstance();
355
355
  if (r == null)
356
356
  return !1;
357
- const { drawings: o, wrapText: s, unitId: a } = e, d = q.getInstance(), c = [], { drawings: l = {} } = r.getSnapshot();
358
- for (const p of o) {
359
- const { drawingId: h } = p, v = l[h].wrapText;
360
- if (v !== s) {
361
- const w = d.replaceOp(["drawings", h, "wrapText"], v, s);
362
- c.push(w);
357
+ const { drawings: o, wrapText: s, unitId: a } = e, d = X.getInstance(), c = [], { drawings: l = {} } = r.getSnapshot();
358
+ for (const f of o) {
359
+ const { drawingId: u } = f, h = l[u].wrapText;
360
+ if (h !== s) {
361
+ const v = d.replaceOp(["drawings", u, "wrapText"], h, s);
362
+ c.push(v);
363
363
  }
364
364
  }
365
365
  const m = {
366
- id: J.id,
366
+ id: ne.id,
367
367
  params: {
368
368
  unitId: a,
369
369
  actions: [],
370
370
  textRanges: null
371
371
  }
372
372
  };
373
- return m.params.actions = c.reduce((p, h) => q.compose(p, h), null), !!n.syncExecuteCommand(m.id, m.params);
373
+ return m.params.actions = c.reduce((f, u) => X.compose(f, u), null), !!n.syncExecuteCommand(m.id, m.params);
374
374
  }
375
- }, qe = {
375
+ }, Ke = {
376
376
  id: "doc.command.update-drawing-doc-transform",
377
377
  type: Y.COMMAND,
378
378
  handler: (i, e) => {
379
379
  if (e == null)
380
380
  return !1;
381
- const n = i.get(z), t = i.get(K), o = i.get(ee).getRenderById(e.unitId), s = o == null ? void 0 : o.scene;
381
+ const n = i.get($), t = i.get(q), o = i.get(J).getRenderById(e.unitId), s = o == null ? void 0 : o.scene;
382
382
  if (s == null)
383
383
  return !1;
384
384
  const a = s.getTransformerByCreate(), d = t.getCurrentUniverDocInstance();
385
385
  if (d == null)
386
386
  return !1;
387
- const { drawings: c, unitId: l } = e, m = q.getInstance(), g = [], { drawings: p = {} } = d.getSnapshot();
388
- for (const w of c) {
389
- const { drawingId: S, key: O, value: D } = w, T = p[S].docTransform[O];
390
- if (!ye.diffValue(T, D)) {
391
- const M = m.replaceOp(["drawings", S, "docTransform", O], T, D);
387
+ const { drawings: c, unitId: l } = e, m = X.getInstance(), g = [], { drawings: f = {} } = d.getSnapshot();
388
+ for (const v of c) {
389
+ const { drawingId: I, key: O, value: C } = v, T = f[I].docTransform[O];
390
+ if (!Me.diffValue(T, C)) {
391
+ const M = m.replaceOp(["drawings", I, "docTransform", O], T, C);
392
392
  g.push(M);
393
393
  }
394
394
  }
395
- const h = {
396
- id: J.id,
395
+ const u = {
396
+ id: ne.id,
397
397
  params: {
398
398
  unitId: l,
399
399
  actions: [],
@@ -401,95 +401,95 @@ const Qn = {
401
401
  debounce: !0
402
402
  }
403
403
  };
404
- h.params.actions = g.reduce((w, S) => q.compose(w, S), null);
405
- const v = n.syncExecuteCommand(h.id, h.params);
406
- return a.refreshControls(), !!v;
404
+ u.params.actions = g.reduce((v, I) => X.compose(v, I), null);
405
+ const h = n.syncExecuteCommand(u.id, u.params);
406
+ return a.refreshControls(), !!h;
407
407
  }
408
- }, nt = {
408
+ }, ut = {
409
409
  id: "doc.command.move-inline-drawing",
410
410
  type: Y.COMMAND,
411
411
  handler: (i, e) => {
412
- var U, N;
412
+ var B, E;
413
413
  if (e == null)
414
414
  return !1;
415
- const n = i.get(ee), t = (U = n.getRenderById(e.unitId)) == null ? void 0 : U.with(Me), r = i.get(gn), o = n.getRenderById(e.unitId), s = o == null ? void 0 : o.scene, a = o == null ? void 0 : o.with(se).getSkeleton();
415
+ const n = i.get(J), t = (B = n.getRenderById(e.unitId)) == null ? void 0 : B.with(Re), r = i.get(un), o = n.getRenderById(e.unitId), s = o == null ? void 0 : o.scene, a = o == null ? void 0 : o.with(te).getSkeleton();
416
416
  if (s == null || t == null)
417
417
  return !1;
418
- const d = s.getTransformerByCreate(), c = i.get(z), m = i.get(K).getCurrentUniverDocInstance();
418
+ const d = s.getTransformerByCreate(), c = i.get($), m = i.get(q).getCurrentUniverDocInstance();
419
419
  if (m == null)
420
420
  return !1;
421
- const { drawing: g, unitId: p, offset: h, segmentId: v, segmentPage: w, needRefreshDrawings: S } = e;
422
- if (S)
421
+ const { drawing: g, unitId: f, offset: u, segmentId: h, segmentPage: v, needRefreshDrawings: I } = e;
422
+ if (I)
423
423
  return r.refreshDrawings(a), d.refreshControls(), !0;
424
- const O = [], { drawingId: D } = g, T = (N = t.getSegment()) != null ? N : "", M = Zn(
425
- v,
426
- T,
427
- w,
424
+ const O = [], { drawingId: C } = g, T = (E = t.getSegment()) != null ? E : "", M = dt(
428
425
  h,
429
- D,
426
+ T,
427
+ v,
428
+ u,
429
+ C,
430
430
  m,
431
431
  t
432
432
  );
433
433
  if (M == null || M.length === 0)
434
434
  return r.refreshDrawings(a), d.refreshControls(), !1;
435
435
  O.push(...M);
436
- const y = {
437
- id: J.id,
436
+ const P = {
437
+ id: ne.id,
438
438
  params: {
439
- unitId: p,
439
+ unitId: f,
440
440
  actions: [],
441
441
  textRanges: null
442
442
  }
443
443
  };
444
- y.params.actions = O.reduce((I, L) => q.compose(I, L), null);
445
- const E = c.syncExecuteCommand(y.id, y.params);
446
- return d.refreshControls(), !!E;
444
+ P.params.actions = O.reduce((_, L) => X.compose(_, L), null);
445
+ const N = c.syncExecuteCommand(P.id, P.params);
446
+ return d.refreshControls(), !!N;
447
447
  }
448
- }, tt = {
448
+ }, ft = {
449
449
  id: "doc.command.transform-non-inline-drawing",
450
450
  type: Y.COMMAND,
451
451
  // eslint-disable-next-line max-lines-per-function
452
452
  handler: (i, e) => {
453
- var x, G;
453
+ var x, V;
454
454
  if (e == null)
455
455
  return !1;
456
- const n = i.get(ee), t = (x = n.getRenderById(e.unitId)) == null ? void 0 : x.with(Me), r = n.getRenderById(e.unitId), o = r == null ? void 0 : r.scene;
456
+ const n = i.get(J), t = (x = n.getRenderById(e.unitId)) == null ? void 0 : x.with(Re), r = n.getRenderById(e.unitId), o = r == null ? void 0 : r.scene;
457
457
  if (o == null || t == null)
458
458
  return !1;
459
- const s = o.getTransformerByCreate(), a = i.get(z), c = i.get(K).getCurrentUniverDocInstance();
459
+ const s = o.getTransformerByCreate(), a = i.get($), c = i.get(q).getCurrentUniverDocInstance();
460
460
  if (c == null)
461
461
  return !1;
462
- const { drawing: l, unitId: m, offset: g, docTransform: p, segmentId: h, segmentPage: v } = e, w = [], { drawingId: S } = l, O = (G = t.getSegment()) != null ? G : "", D = Zn(
463
- h,
462
+ const { drawing: l, unitId: m, offset: g, docTransform: f, segmentId: u, segmentPage: h } = e, v = [], { drawingId: I } = l, O = (V = t.getSegment()) != null ? V : "", C = dt(
463
+ u,
464
464
  O,
465
- v,
465
+ h,
466
466
  g,
467
- S,
467
+ I,
468
468
  c,
469
469
  t
470
470
  );
471
- if (D == null)
471
+ if (C == null)
472
472
  return !1;
473
- D.length > 0 && w.push(...D);
474
- const T = q.getInstance(), { drawings: M = {} } = c.getSnapshot(), y = M[S].docTransform, { positionH: E, positionV: U, size: N, angle: I } = y;
475
- if (!ye.diffValue(E, p.positionH)) {
476
- const _ = T.replaceOp(["drawings", S, "docTransform", "positionH"], E, p.positionH);
477
- w.push(_);
473
+ C.length > 0 && v.push(...C);
474
+ const T = X.getInstance(), { drawings: M = {} } = c.getSnapshot(), P = M[I].docTransform, { positionH: N, positionV: B, size: E, angle: _ } = P;
475
+ if (!Me.diffValue(N, f.positionH)) {
476
+ const S = T.replaceOp(["drawings", I, "docTransform", "positionH"], N, f.positionH);
477
+ v.push(S);
478
478
  }
479
- if (!ye.diffValue(U, p.positionV)) {
480
- const _ = T.replaceOp(["drawings", S, "docTransform", "positionV"], U, p.positionV);
481
- w.push(_);
479
+ if (!Me.diffValue(B, f.positionV)) {
480
+ const S = T.replaceOp(["drawings", I, "docTransform", "positionV"], B, f.positionV);
481
+ v.push(S);
482
482
  }
483
- if (!ye.diffValue(N, p.size)) {
484
- const _ = T.replaceOp(["drawings", S, "docTransform", "size"], N, p.size);
485
- w.push(_);
483
+ if (!Me.diffValue(E, f.size)) {
484
+ const S = T.replaceOp(["drawings", I, "docTransform", "size"], E, f.size);
485
+ v.push(S);
486
486
  }
487
- if (!ye.diffValue(I, p.angle)) {
488
- const _ = T.replaceOp(["drawings", S, "docTransform", "angle"], I, p.angle);
489
- w.push(_);
487
+ if (!Me.diffValue(_, f.angle)) {
488
+ const S = T.replaceOp(["drawings", I, "docTransform", "angle"], _, f.angle);
489
+ v.push(S);
490
490
  }
491
491
  const L = {
492
- id: J.id,
492
+ id: ne.id,
493
493
  params: {
494
494
  unitId: m,
495
495
  actions: [],
@@ -497,29 +497,29 @@ const Qn = {
497
497
  debounce: !0
498
498
  }
499
499
  };
500
- L.params.actions = w.reduce((_, C) => q.compose(_, C), null);
501
- const W = a.syncExecuteCommand(L.id, L.params);
502
- return s.refreshControls(), !!W;
500
+ L.params.actions = v.reduce((S, D) => X.compose(S, D), null);
501
+ const G = a.syncExecuteCommand(L.id, L.params);
502
+ return s.refreshControls(), !!G;
503
503
  }
504
504
  };
505
- var Ni = Object.getOwnPropertyDescriptor, Ei = (i, e, n, t) => {
506
- for (var r = t > 1 ? void 0 : t ? Ni(e, n) : e, o = i.length - 1, s; o >= 0; o--)
505
+ var Vi = Object.getOwnPropertyDescriptor, ji = (i, e, n, t) => {
506
+ for (var r = t > 1 ? void 0 : t ? Vi(e, n) : e, o = i.length - 1, s; o >= 0; o--)
507
507
  (s = i[o]) && (r = s(r) || r);
508
508
  return r;
509
- }, Qe = (i, e) => (n, t) => e(n, t, i);
510
- const Ai = "__InlineDrawingAnchor__";
511
- function Hn(i) {
509
+ }, Je = (i, e) => (n, t) => e(n, t, i);
510
+ const $i = "__InlineDrawingAnchor__";
511
+ function Xn(i) {
512
512
  const { path: e } = i;
513
513
  return e.some((n) => n === "cells");
514
514
  }
515
- let on = class extends Xe {
515
+ let sn = class extends Ge {
516
516
  constructor(e, n, t, r) {
517
517
  super();
518
- Ce(this, "_liquid", new $n());
519
- Ce(this, "_listenerOnImageMap", /* @__PURE__ */ new Set());
518
+ _e(this, "_liquid", new Jn());
519
+ _e(this, "_listenerOnImageMap", /* @__PURE__ */ new Set());
520
520
  // Use to cache the drawings is under transforming or scaling.
521
- Ce(this, "_transformerCache", /* @__PURE__ */ new Map());
522
- Ce(this, "_anchorShape");
521
+ _e(this, "_transformerCache", /* @__PURE__ */ new Map());
522
+ _e(this, "_anchorShape");
523
523
  this._commandService = e, this._univerInstanceService = n, this._drawingManagerService = t, this._renderManagerService = r, this._init();
524
524
  }
525
525
  _init() {
@@ -544,45 +544,50 @@ let on = class extends Xe {
544
544
  if (n == null)
545
545
  return;
546
546
  this.disposeWithMe(
547
- Le(
547
+ Oe(
548
548
  n.changeStart$.subscribe((o) => {
549
549
  var a;
550
550
  this._transformerCache.clear();
551
551
  const { objects: s } = o;
552
552
  for (const d of s.values()) {
553
- const { oKey: c, width: l, height: m, left: g, top: p, angle: h } = d, v = this._drawingManagerService.getDrawingOKey(c);
554
- if (v == null)
553
+ const { oKey: c, width: l, height: m, left: g, top: f, angle: u } = d, h = this._drawingManagerService.getDrawingOKey(c);
554
+ if (h == null)
555
555
  continue;
556
- const w = this._univerInstanceService.getUniverDocInstance(v.unitId), S = (a = w == null ? void 0 : w.getSnapshot().drawings) == null ? void 0 : a[v.drawingId];
557
- (S == null ? void 0 : S.layoutType) === H.INLINE && d.setOpacity(0.2), S != null && this._transformerCache.set(v.drawingId, {
558
- drawing: S,
559
- top: p,
556
+ const v = this._univerInstanceService.getUniverDocInstance(h.unitId), I = (a = v == null ? void 0 : v.getSnapshot().drawings) == null ? void 0 : a[h.drawingId];
557
+ if ((I == null ? void 0 : I.layoutType) === W.INLINE)
558
+ try {
559
+ d.setOpacity(0.2);
560
+ } catch {
561
+ }
562
+ I != null && this._transformerCache.set(h.drawingId, {
563
+ drawing: I,
564
+ top: f,
560
565
  left: g,
561
566
  width: l,
562
567
  height: m,
563
- angle: h
568
+ angle: u
564
569
  });
565
570
  }
566
571
  })
567
572
  )
568
573
  );
569
- const t = Tn(this._updateMultipleDrawingDocTransform.bind(this), 50);
570
- Tn(this._nonInlineDrawingTransform.bind(this), 50), this.disposeWithMe(
571
- Le(
574
+ const t = Rn(this._updateMultipleDrawingDocTransform.bind(this), 50);
575
+ Rn(this._nonInlineDrawingTransform.bind(this), 50), this.disposeWithMe(
576
+ Oe(
572
577
  n.changing$.subscribe((o) => {
573
578
  const { objects: s, offsetX: a, offsetY: d } = o;
574
579
  if (s.size > 1)
575
580
  t(s);
576
581
  else if (s.size === 1) {
577
- const c = this._transformerCache.values().next().value, l = s.values().next().value, { width: m, height: g, top: p, left: h, angle: v } = l;
578
- if (c && m === c.width && g === c.height && p === c.top && h === c.left && v === c.angle)
582
+ const c = this._transformerCache.values().next().value, l = s.values().next().value, { width: m, height: g, top: f, left: u, angle: h } = l;
583
+ if (c && m === c.width && g === c.height && f === c.top && u === c.left && h === c.angle)
579
584
  return;
580
- c && (c.drawing.layoutType, H.INLINE), c && c.drawing.layoutType === H.INLINE && a != null && d != null && this._updateInlineDrawingAnchor(c.drawing, a, d);
585
+ c && (c.drawing.layoutType, W.INLINE), c && c.drawing.layoutType === W.INLINE && a != null && d != null && this._updateInlineDrawingAnchor(c.drawing, a, d);
581
586
  }
582
587
  })
583
588
  )
584
589
  ), this.disposeWithMe(
585
- Le(
590
+ Oe(
586
591
  // eslint-disable-next-line complexity
587
592
  n.changeEnd$.subscribe((o) => {
588
593
  const { objects: s, offsetX: a, offsetY: d } = o;
@@ -591,15 +596,19 @@ let on = class extends Xe {
591
596
  if (l == null)
592
597
  continue;
593
598
  const m = this._transformerCache.get(l == null ? void 0 : l.drawingId);
594
- (m == null ? void 0 : m.drawing.layoutType) === H.INLINE && c.setOpacity(1);
599
+ if ((m == null ? void 0 : m.drawing.layoutType) === W.INLINE)
600
+ try {
601
+ c.setOpacity(1);
602
+ } catch {
603
+ }
595
604
  }
596
605
  if (this._anchorShape && this._anchorShape.hide(), s.size > 1)
597
606
  this._updateMultipleDrawingDocTransform(s);
598
607
  else if (s.size === 1) {
599
- const c = this._transformerCache.values().next().value, l = s.values().next().value, { width: m, height: g, top: p, left: h, angle: v } = l;
600
- if (c && m === c.width && g === c.height && p === c.top && h === c.left && v === c.angle)
608
+ const c = this._transformerCache.values().next().value, l = s.values().next().value, { width: m, height: g, top: f, left: u, angle: h } = l;
609
+ if (c && m === c.width && g === c.height && f === c.top && u === c.left && h === c.angle)
601
610
  return;
602
- c && c.drawing.layoutType === H.INLINE ? m !== c.width || g !== c.height || v !== c.angle ? this._updateDrawingSize(c, l) : a != null && d != null && this._moveInlineDrawing(c.drawing, a, d) : c && this._nonInlineDrawingTransform(c.drawing, l);
611
+ c && c.drawing.layoutType === W.INLINE ? m !== c.width || g !== c.height || h !== c.angle ? this._updateDrawingSize(c, l) : a != null && d != null && this._moveInlineDrawing(c.drawing, a, d) : c && this._nonInlineDrawingTransform(c.drawing, l);
603
612
  }
604
613
  this._transformerCache.clear();
605
614
  })
@@ -619,41 +628,41 @@ let on = class extends Xe {
619
628
  if (g == null)
620
629
  continue;
621
630
  t == null && (t = g.unitId), r == null && (r = g.subUnitId);
622
- const p = this._transformerCache.get(g.drawingId);
623
- if (p == null)
631
+ const f = this._transformerCache.get(g.drawingId);
632
+ if (f == null)
624
633
  continue;
625
- const { drawing: h, top: v, left: w, width: S, height: O, angle: D } = p, { width: T, height: M } = this._getPageContentSize(h);
626
- if (l = Math.min(l, T), m = Math.min(m, M), (S !== l || O !== m) && n.push({
634
+ const { drawing: u, top: h, left: v, width: I, height: O, angle: C } = f, { width: T, height: M } = this._getPageContentSize(u);
635
+ if (l = Math.min(l, T), m = Math.min(m, M), (I !== l || O !== m) && n.push({
627
636
  drawingId: g.drawingId,
628
637
  key: "size",
629
638
  value: {
630
639
  width: l,
631
640
  height: m
632
641
  }
633
- }), D !== c && n.push({
642
+ }), C !== c && n.push({
634
643
  drawingId: g.drawingId,
635
644
  key: "angle",
636
645
  value: c
637
- }), v !== d || w !== a) {
638
- const y = d - v, E = a - w;
639
- y !== 0 && n.push({
646
+ }), h !== d || v !== a) {
647
+ const P = d - h, N = a - v;
648
+ P !== 0 && n.push({
640
649
  drawingId: g.drawingId,
641
650
  key: "positionV",
642
651
  value: {
643
- relativeFrom: h.docTransform.positionV.relativeFrom,
644
- posOffset: h.docTransform.positionV.posOffset + y
652
+ relativeFrom: u.docTransform.positionV.relativeFrom,
653
+ posOffset: u.docTransform.positionV.posOffset + P
645
654
  }
646
- }), E !== 0 && n.push({
655
+ }), N !== 0 && n.push({
647
656
  drawingId: g.drawingId,
648
657
  key: "positionH",
649
658
  value: {
650
- relativeFrom: h.docTransform.positionH.relativeFrom,
651
- posOffset: h.docTransform.positionH.posOffset + E
659
+ relativeFrom: u.docTransform.positionH.relativeFrom,
660
+ posOffset: u.docTransform.positionH.posOffset + N
652
661
  }
653
662
  });
654
663
  }
655
664
  }
656
- n.length > 0 && t && r && this._commandService.executeCommand(qe.id, {
665
+ n.length > 0 && t && r && this._commandService.executeCommand(Ke.id, {
657
666
  unitId: t,
658
667
  subUnitId: r,
659
668
  drawings: n
@@ -674,104 +683,104 @@ let on = class extends Xe {
674
683
  r != null && this._createOrUpdateInlineAnchor(e.unitId, r);
675
684
  }
676
685
  _getInlineDrawingAnchor(e, n, t) {
677
- var x, G;
678
- const r = this._renderManagerService.getRenderById(e.unitId), o = r == null ? void 0 : r.with(se).getSkeleton();
686
+ var x, V;
687
+ const r = this._renderManagerService.getRenderById(e.unitId), o = r == null ? void 0 : r.with(te).getSkeleton();
679
688
  if (r == null)
680
689
  return;
681
690
  const { mainComponent: s, scene: a } = r, d = s, c = a.getViewports()[0], {
682
- pageLayoutType: l = Rn.VERTICAL,
691
+ pageLayoutType: l = Ln.VERTICAL,
683
692
  pageMarginLeft: m,
684
693
  pageMarginTop: g
685
694
  } = d.getOffsetConfig();
686
- let p = null, h = !1, v = -1, w = "";
687
- const S = 0.5, O = this._getTransformCoordForDocumentOffset(d, c, n, t);
695
+ let f = null, u = !1, h = -1, v = "";
696
+ const I = 0.5, O = this._getTransformCoordForDocumentOffset(d, c, n, t);
688
697
  if (O == null)
689
698
  return;
690
- const D = (x = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : x.with(Me);
691
- if (D == null)
699
+ const C = (x = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : x.with(Re);
700
+ if (C == null)
692
701
  return;
693
702
  const T = o == null ? void 0 : o.findNodeByCoord(O, l, m, g, {
694
703
  strict: !1,
695
- segmentId: D.getSegment(),
696
- segmentPage: D.getSegmentPage()
704
+ segmentId: C.getSegment(),
705
+ segmentPage: C.getSegmentPage()
697
706
  });
698
707
  if (T) {
699
- const { node: _, ratioX: C, segmentPage: R, segmentId: P } = T;
700
- h = C < S, p = _, v = R, w = P;
708
+ const { node: S, ratioX: D, segmentPage: R, segmentId: y } = T;
709
+ u = D < I, f = S, h = R, v = y;
701
710
  }
702
- if (p == null)
711
+ if (f == null)
703
712
  return;
704
- const M = o == null ? void 0 : o.findPositionByGlyph(p, v), y = this._getDocObject();
705
- if (M == null || o == null || y == null || Hn(M))
713
+ const M = o == null ? void 0 : o.findPositionByGlyph(f, h), P = this._getDocObject();
714
+ if (M == null || o == null || P == null || Xn(M))
706
715
  return;
707
- const E = {
716
+ const N = {
708
717
  ...M,
709
- isBack: h
710
- }, U = y.document.getOffsetConfig(), N = new En(U, o), { cursorList: I, contentBoxPointGroup: L } = N.getRangePointData(E, E), { startOffset: W } = (G = An(I)) != null ? G : {};
711
- if (W != null)
712
- return { offset: W, contentBoxPointGroup: L, segmentId: w, segmentPage: v };
718
+ isBack: u
719
+ }, B = P.document.getOffsetConfig(), E = new kn(B, o), { cursorList: _, contentBoxPointGroup: L } = E.getRangePointData(N, N), { startOffset: G } = (V = Fn(_)) != null ? V : {};
720
+ if (G != null)
721
+ return { offset: G, contentBoxPointGroup: L, segmentId: v, segmentPage: h };
713
722
  }
714
723
  // eslint-disable-next-line max-lines-per-function, complexity
715
724
  _getDrawingAnchor(e, n) {
716
- var _e, Se, de, De, Oe, Ne, Ee, Te, le, ge, Ae;
717
- const t = this._renderManagerService.getRenderById(e.unitId), r = t == null ? void 0 : t.with(se).getSkeleton(), o = r == null ? void 0 : r.getSkeletonData();
725
+ var De, Ce, de, Te, ye, Ne, Ae, Pe, le, ge, xe;
726
+ const t = this._renderManagerService.getRenderById(e.unitId), r = t == null ? void 0 : t.with(te).getSkeleton(), o = r == null ? void 0 : r.getSkeletonData();
718
727
  if (o == null || t == null)
719
728
  return;
720
- const { pages: s, skeHeaders: a, skeFooters: d } = o, { mainComponent: c, scene: l } = t, m = c, g = l.getViewports()[0], { pageLayoutType: p = Rn.VERTICAL, pageMarginLeft: h, pageMarginTop: v, docsLeft: w, docsTop: S } = m.getOffsetConfig(), { left: O, top: D, angle: T } = n;
721
- let { width: M, height: y } = n;
722
- const { positionV: E, positionH: U } = e.docTransform, { width: N, height: I } = this._getPageContentSize(e);
723
- M = Math.min(M, N), y = Math.min(y, I);
724
- let L = null, W = "", x = -1;
725
- const G = !1, _ = {
729
+ const { pages: s, skeHeaders: a, skeFooters: d } = o, { mainComponent: c, scene: l } = t, m = c, g = l.getViewports()[0], { pageLayoutType: f = Ln.VERTICAL, pageMarginLeft: u, pageMarginTop: h, docsLeft: v, docsTop: I } = m.getOffsetConfig(), { left: O, top: C, angle: T } = n;
730
+ let { width: M, height: P } = n;
731
+ const { positionV: N, positionH: B } = e.docTransform, { width: E, height: _ } = this._getPageContentSize(e);
732
+ M = Math.min(M, E), P = Math.min(P, _);
733
+ let L = null, G = "", x = -1;
734
+ const V = !1, S = {
726
735
  ...e.docTransform,
727
736
  size: {
728
737
  width: M,
729
- height: y
738
+ height: P
730
739
  },
731
740
  angle: T
732
- }, { x: C, y: R } = l.getViewportScrollXY(g), P = this._getTransformCoordForDocumentOffset(m, g, O - C, D - R);
733
- if (P == null)
741
+ }, { x: D, y: R } = l.getViewportScrollXY(g), y = this._getTransformCoordForDocumentOffset(m, g, O - D, C - R);
742
+ if (y == null)
734
743
  return;
735
- const B = (_e = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : _e.with(Me);
736
- if (B == null)
744
+ const U = (De = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : De.with(Re);
745
+ if (U == null)
737
746
  return;
738
- const k = r == null ? void 0 : r.findNodeByCoord(P, p, h, v, {
747
+ const k = r == null ? void 0 : r.findNodeByCoord(y, f, u, h, {
739
748
  strict: !1,
740
- segmentId: B.getSegment(),
741
- segmentPage: B.getSegmentPage()
749
+ segmentId: U.getSegment(),
750
+ segmentPage: U.getSegmentPage()
742
751
  });
743
752
  if (k) {
744
- const { node: pe, segmentPage: mn, segmentId: un } = k;
745
- L = pe, x = mn, W = un;
753
+ const { node: we, segmentPage: fn, segmentId: hn } = k;
754
+ L = we, x = fn, G = hn;
746
755
  }
747
756
  if (L == null)
748
757
  return;
749
- const b = (Se = L.parent) == null ? void 0 : Se.parent, A = b == null ? void 0 : b.parent, $ = (de = A == null ? void 0 : A.lines.find((pe) => pe.paragraphIndex === (b == null ? void 0 : b.paragraphIndex) && pe.paragraphStart)) != null ? de : A == null ? void 0 : A.lines[0], F = (De = A == null ? void 0 : A.parent) == null ? void 0 : De.parent;
750
- if (b == null || A == null || $ == null || F == null)
758
+ const b = (Ce = L.parent) == null ? void 0 : Ce.parent, A = b == null ? void 0 : b.parent, z = (de = A == null ? void 0 : A.lines.find((we) => we.paragraphIndex === (b == null ? void 0 : b.paragraphIndex) && we.paragraphStart)) != null ? de : A == null ? void 0 : A.lines[0], F = (Te = A == null ? void 0 : A.parent) == null ? void 0 : Te.parent;
759
+ if (b == null || A == null || z == null || F == null)
751
760
  return;
752
761
  this._liquid.reset();
753
762
  const Z = F.type;
754
- for (const pe of s) {
755
- const { headerId: mn, footerId: un, pageHeight: It, pageWidth: Dn, marginLeft: On, marginBottom: _t } = pe, St = s.indexOf(pe);
756
- if (x > -1 && St === x) {
763
+ for (const we of s) {
764
+ const { headerId: fn, footerId: hn, pageHeight: Rt, pageWidth: bn, marginLeft: Mn, marginBottom: Et } = we, Nt = s.indexOf(we);
765
+ if (x > -1 && Nt === x) {
757
766
  switch (Z) {
758
- case Nn.HEADER: {
759
- const Ge = (Oe = a.get(mn)) == null ? void 0 : Oe.get(Dn);
760
- if (Ge)
767
+ case Un.HEADER: {
768
+ const je = (ye = a.get(fn)) == null ? void 0 : ye.get(bn);
769
+ if (je)
761
770
  this._liquid.translatePagePadding({
762
- marginTop: Ge.marginTop,
763
- marginLeft: On
771
+ marginTop: je.marginTop,
772
+ marginLeft: Mn
764
773
  });
765
774
  else
766
775
  throw new Error("header skeleton not found");
767
776
  break;
768
777
  }
769
- case Nn.FOOTER: {
770
- const Ge = (Ne = d.get(un)) == null ? void 0 : Ne.get(Dn);
771
- if (Ge)
778
+ case Un.FOOTER: {
779
+ const je = (Ne = d.get(hn)) == null ? void 0 : Ne.get(bn);
780
+ if (je)
772
781
  this._liquid.translatePagePadding({
773
- marginTop: It - _t + Ge.marginTop,
774
- marginLeft: On
782
+ marginTop: Rt - Et + je.marginTop,
783
+ marginLeft: Mn
775
784
  });
776
785
  else
777
786
  throw new Error("footer skeleton not found");
@@ -780,58 +789,58 @@ let on = class extends Xe {
780
789
  }
781
790
  break;
782
791
  }
783
- if (this._liquid.translatePagePadding(pe), pe === F)
792
+ if (this._liquid.translatePagePadding(we), we === F)
784
793
  break;
785
- this._liquid.restorePagePadding(pe), this._liquid.translatePage(pe, p, h, v);
794
+ this._liquid.restorePagePadding(we), this._liquid.translatePage(we, f, u, h);
786
795
  }
787
- switch (E.relativeFrom === V.LINE ? L = b.divides[0].glyphGroup[0] : L = (ge = (le = (Te = (Ee = $.divides) == null ? void 0 : Ee[0]) == null ? void 0 : Te.glyphGroup) == null ? void 0 : le[0]) != null ? ge : L, _.positionH = {
788
- relativeFrom: U.relativeFrom,
789
- posOffset: O - this._liquid.x - w
790
- }, U.relativeFrom) {
791
- case ne.MARGIN: {
792
- _.positionH.posOffset = O - this._liquid.x - w - F.marginLeft;
796
+ switch (N.relativeFrom === H.LINE ? L = b.divides[0].glyphGroup[0] : L = (ge = (le = (Pe = (Ae = z.divides) == null ? void 0 : Ae[0]) == null ? void 0 : Pe.glyphGroup) == null ? void 0 : le[0]) != null ? ge : L, S.positionH = {
797
+ relativeFrom: B.relativeFrom,
798
+ posOffset: O - this._liquid.x - v
799
+ }, B.relativeFrom) {
800
+ case ee.MARGIN: {
801
+ S.positionH.posOffset = O - this._liquid.x - v - F.marginLeft;
793
802
  break;
794
803
  }
795
- case ne.COLUMN: {
796
- _.positionH.posOffset = O - this._liquid.x - w - A.left;
804
+ case ee.COLUMN: {
805
+ S.positionH.posOffset = O - this._liquid.x - v - A.left;
797
806
  break;
798
807
  }
799
808
  }
800
- switch (_.positionV = {
801
- relativeFrom: E.relativeFrom,
802
- posOffset: D - this._liquid.y - S
803
- }, E.relativeFrom) {
804
- case V.PAGE: {
805
- _.positionV.posOffset = D - this._liquid.y - S - F.marginTop;
809
+ switch (S.positionV = {
810
+ relativeFrom: N.relativeFrom,
811
+ posOffset: C - this._liquid.y - I
812
+ }, N.relativeFrom) {
813
+ case H.PAGE: {
814
+ S.positionV.posOffset = C - this._liquid.y - I - F.marginTop;
806
815
  break;
807
816
  }
808
- case V.LINE: {
809
- _.positionV.posOffset = D - this._liquid.y - S - b.top;
817
+ case H.LINE: {
818
+ S.positionV.posOffset = C - this._liquid.y - I - b.top;
810
819
  break;
811
820
  }
812
- case V.PARAGRAPH: {
813
- _.positionV.posOffset = D - this._liquid.y - S - $.top;
821
+ case H.PARAGRAPH: {
822
+ S.positionV.posOffset = C - this._liquid.y - I - z.top;
814
823
  break;
815
824
  }
816
825
  }
817
826
  if (L == null)
818
827
  return;
819
- const ae = r == null ? void 0 : r.findPositionByGlyph(L, x), Ue = this._getDocObject();
820
- if (ae == null || r == null || Ue == null || Hn(ae))
828
+ const ae = r == null ? void 0 : r.findPositionByGlyph(L, x), Be = this._getDocObject();
829
+ if (ae == null || r == null || Be == null || Xn(ae))
821
830
  return;
822
- const Re = {
831
+ const Ee = {
823
832
  ...ae,
824
- isBack: G
825
- }, We = Ue.document.getOffsetConfig(), ce = new En(We, r), { cursorList: te } = ce.getRangePointData(Re, Re), { startOffset: ie } = (Ae = An(te)) != null ? Ae : {};
826
- if (ie != null)
827
- return { offset: ie, docTransform: _, segmentId: W, segmentPage: x };
833
+ isBack: V
834
+ }, Ve = Be.document.getOffsetConfig(), ce = new kn(Ve, r), { cursorList: ie } = ce.getRangePointData(Ee, Ee), { startOffset: re } = (xe = Fn(ie)) != null ? xe : {};
835
+ if (re != null)
836
+ return { offset: re, docTransform: S, segmentId: G, segmentPage: x };
828
837
  }
829
838
  // Update drawing when use transformer to resize it.
830
839
  _updateDrawingSize(e, n) {
831
840
  const t = [], { drawing: r, width: o, height: s, angle: a } = e, { unitId: d, subUnitId: c } = r;
832
841
  let { width: l, height: m, angle: g } = n;
833
- const { width: p, height: h } = this._getPageContentSize(r);
834
- l = Math.min(p, l), m = Math.min(h, m), (l !== o || m !== s) && t.push({
842
+ const { width: f, height: u } = this._getPageContentSize(r);
843
+ l = Math.min(f, l), m = Math.min(u, m), (l !== o || m !== s) && t.push({
835
844
  drawingId: r.drawingId,
836
845
  key: "size",
837
846
  value: {
@@ -842,7 +851,7 @@ let on = class extends Xe {
842
851
  drawingId: r.drawingId,
843
852
  key: "angle",
844
853
  value: g
845
- }), t.length > 0 && d && c && this._commandService.executeCommand(qe.id, {
854
+ }), t.length > 0 && d && c && this._commandService.executeCommand(Ke.id, {
846
855
  unitId: d,
847
856
  subUnitId: c,
848
857
  drawings: t
@@ -851,7 +860,7 @@ let on = class extends Xe {
851
860
  // Update inline drawing when use transformer to move it.
852
861
  _moveInlineDrawing(e, n, t) {
853
862
  const r = this._getInlineDrawingAnchor(e, n, t), { offset: o, segmentId: s, segmentPage: a } = r != null ? r : {};
854
- return this._commandService.executeCommand(nt.id, {
863
+ return this._commandService.executeCommand(ut.id, {
855
864
  unitId: e.unitId,
856
865
  subUnitId: e.unitId,
857
866
  drawing: e,
@@ -864,7 +873,7 @@ let on = class extends Xe {
864
873
  // Limit the drawing to the page area, mainly in the vertical direction,
865
874
  // and the upper and lower limits cannot exceed the page margin area.
866
875
  _limitDrawingInPage(e, n) {
867
- const t = this._renderManagerService.getRenderById(e.unitId), { left: r, top: o, width: s, height: a, angle: d } = n, c = t == null ? void 0 : t.with(se).getSkeleton(), l = c == null ? void 0 : c.getSkeletonData(), { pages: m } = l != null ? l : {};
876
+ const t = this._renderManagerService.getRenderById(e.unitId), { left: r, top: o, width: s, height: a, angle: d } = n, c = t == null ? void 0 : t.with(te).getSkeleton(), l = c == null ? void 0 : c.getSkeletonData(), { pages: m } = l != null ? l : {};
868
877
  if (l == null || t == null || m == null)
869
878
  return {
870
879
  left: r,
@@ -873,23 +882,23 @@ let on = class extends Xe {
873
882
  height: a,
874
883
  angle: d
875
884
  };
876
- const { mainComponent: g } = t, p = g, { top: h, pageLayoutType: v, pageMarginLeft: w, pageMarginTop: S } = p;
885
+ const { mainComponent: g } = t, f = g, { top: u, pageLayoutType: h, pageMarginLeft: v, pageMarginTop: I } = f;
877
886
  let O = o;
878
887
  this._liquid.reset();
879
- for (const D of m) {
880
- const { marginBottom: T, pageHeight: M } = D, y = m.indexOf(D), E = m[y + 1];
881
- if (E == null)
888
+ for (const C of m) {
889
+ const { marginBottom: T, pageHeight: M } = C, P = m.indexOf(C), N = m[P + 1];
890
+ if (N == null)
882
891
  continue;
883
- if (ye.hasIntersectionBetweenTwoRanges(
892
+ if (Me.hasIntersectionBetweenTwoRanges(
884
893
  o,
885
894
  o + a,
886
- this._liquid.y + h + M - T,
887
- this._liquid.y + h + M + S + E.marginTop
895
+ this._liquid.y + u + M - T,
896
+ this._liquid.y + u + M + I + N.marginTop
888
897
  )) {
889
- const N = o + a / 2, I = this._liquid.y + h + M + S / 2;
890
- N < I ? O = Math.min(o, this._liquid.y + h + M - T - a) : O = Math.max(o, this._liquid.y + h + M + S + E.marginTop);
898
+ const E = o + a / 2, _ = this._liquid.y + u + M + I / 2;
899
+ E < _ ? O = Math.min(o, this._liquid.y + u + M - T - a) : O = Math.max(o, this._liquid.y + u + M + I + N.marginTop);
891
900
  }
892
- this._liquid.translatePage(D, v, w, S);
901
+ this._liquid.translatePage(C, h, v, I);
893
902
  }
894
903
  return {
895
904
  left: r,
@@ -900,11 +909,11 @@ let on = class extends Xe {
900
909
  };
901
910
  }
902
911
  _nonInlineDrawingTransform(e, n, t = !1) {
903
- const r = e.isMultiTransform === oe.TRUE ? n : this._limitDrawingInPage(e, n);
912
+ const r = e.isMultiTransform === se.TRUE ? n : this._limitDrawingInPage(e, n);
904
913
  if (t && r.top !== n.top)
905
914
  return;
906
915
  const o = this._getDrawingAnchor(e, r), { offset: s, docTransform: a, segmentId: d, segmentPage: c } = o != null ? o : {};
907
- return s == null || a == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId, n]])) : this._commandService.executeCommand(tt.id, {
916
+ return s == null || a == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId, n]])) : this._commandService.executeCommand(ft.id, {
908
917
  unitId: e.unitId,
909
918
  subUnitId: e.unitId,
910
919
  drawing: e,
@@ -924,7 +933,7 @@ let on = class extends Xe {
924
933
  return { scene: t, transformer: r };
925
934
  }
926
935
  _getTransformCoordForDocumentOffset(e, n, t, r) {
927
- const { documentTransform: o } = e.getOffsetConfig(), s = n.transformVector2SceneCoord(ei.FromArray([t, r]));
936
+ const { documentTransform: o } = e.getOffsetConfig(), s = n.transformVector2SceneCoord(mi.FromArray([t, r]));
928
937
  if (s)
929
938
  return o.clone().invert().applyPoint(s);
930
939
  }
@@ -935,26 +944,26 @@ let on = class extends Xe {
935
944
  const { mainComponent: r, scene: o } = t, s = r, {
936
945
  docsLeft: a,
937
946
  docsTop: d
938
- } = s.getOffsetConfig(), c = ui(n), { left: l, top: m, height: g } = c, p = l + a, h = m + d;
947
+ } = s.getOffsetConfig(), c = yi(n), { left: l, top: m, height: g } = c, f = l + a, u = m + d;
939
948
  if (this._anchorShape) {
940
- this._anchorShape.transformByState({ left: p, top: h, height: g }), this._anchorShape.show();
949
+ this._anchorShape.transformByState({ left: f, top: u, height: g }), this._anchorShape.show();
941
950
  return;
942
951
  }
943
- const v = 6, w = new ni(Ai + ye.generateRandomId(v), {
944
- left: p,
945
- top: h,
952
+ const h = 6, v = new ui($i + Me.generateRandomId(h), {
953
+ left: f,
954
+ top: u,
946
955
  height: g,
947
956
  strokeWidth: 2,
948
- stroke: ti(yt.darkGray, 1),
957
+ stroke: fi(kt.darkGray, 1),
949
958
  evented: !1
950
959
  });
951
- this._anchorShape = w, o.addObject(w, fi);
960
+ this._anchorShape = v, o.addObject(v, Pi);
952
961
  }
953
962
  _getDocObject() {
954
- return hi(this._univerInstanceService, this._renderManagerService);
963
+ return bi(this._univerInstanceService, this._renderManagerService);
955
964
  }
956
965
  _getPageContentSize(e) {
957
- const n = this._renderManagerService.getRenderById(e.unitId), t = n == null ? void 0 : n.with(se).getSkeleton(), r = 500, o = 500, s = t == null ? void 0 : t.getSkeletonData();
966
+ const n = this._renderManagerService.getRenderById(e.unitId), t = n == null ? void 0 : n.with(te).getSkeleton(), r = 500, o = 500, s = t == null ? void 0 : t.getSkeletonData();
958
967
  if (s == null || n == null)
959
968
  return {
960
969
  width: r,
@@ -970,10 +979,10 @@ let on = class extends Xe {
970
979
  }
971
980
  }
972
981
  if (d) {
973
- const { pageWidth: c, pageHeight: l, marginLeft: m, marginBottom: g, marginRight: p, marginTop: h } = d;
982
+ const { pageWidth: c, pageHeight: l, marginLeft: m, marginBottom: g, marginRight: f, marginTop: u } = d;
974
983
  return {
975
- width: Math.max(r, c - m - p),
976
- height: Math.max(o, l - h - g)
984
+ width: Math.max(r, c - m - f),
985
+ height: Math.max(o, l - u - g)
977
986
  };
978
987
  } else
979
988
  return {
@@ -982,12 +991,12 @@ let on = class extends Xe {
982
991
  };
983
992
  }
984
993
  };
985
- on = Ei([
986
- Qe(0, z),
987
- Qe(1, K),
988
- Qe(2, Ie),
989
- Qe(3, ee)
990
- ], on);
994
+ sn = ji([
995
+ Je(0, $),
996
+ Je(1, q),
997
+ Je(2, Ie),
998
+ Je(3, J)
999
+ ], sn);
991
1000
  var he = function() {
992
1001
  return he = Object.assign || function(i) {
993
1002
  for (var e, n = 1, t = arguments.length; n < t; n++) {
@@ -996,23 +1005,23 @@ var he = function() {
996
1005
  }
997
1006
  return i;
998
1007
  }, he.apply(this, arguments);
999
- }, xi = function(i, e) {
1008
+ }, zi = function(i, e) {
1000
1009
  var n = {};
1001
1010
  for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]);
1002
1011
  if (i != null && typeof Object.getOwnPropertySymbols == "function")
1003
1012
  for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
1004
1013
  e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
1005
1014
  return n;
1006
- }, it = Kn(function(i, e) {
1007
- var n = i.icon, t = i.id, r = i.className, o = i.extend, s = xi(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), d = Oi("_".concat(Ui()));
1008
- return rt(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, he({ ref: e, className: a }, s), o);
1015
+ }, ht = at(function(i, e) {
1016
+ var n = i.icon, t = i.id, r = i.className, o = i.extend, s = zi(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), d = Ui("_".concat(Ki()));
1017
+ return pt(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, he({ ref: e, className: a }, s), o);
1009
1018
  });
1010
- function rt(i, e, n, t, r) {
1011
- return Yn(i.tag, he(he({ key: e }, Li(i, n, r)), t), (Bi(i, n).children || []).map(function(o, s) {
1012
- return rt(o, "".concat(e, "-").concat(i.tag, "-").concat(s), n, void 0, r);
1019
+ function pt(i, e, n, t, r) {
1020
+ return ct(i.tag, he(he({ key: e }, Xi(i, n, r)), t), (qi(i, n).children || []).map(function(o, s) {
1021
+ return pt(o, "".concat(e, "-").concat(i.tag, "-").concat(s), n, void 0, r);
1013
1022
  }));
1014
1023
  }
1015
- function Li(i, e, n) {
1024
+ function Xi(i, e, n) {
1016
1025
  var t = he({}, i.attrs);
1017
1026
  n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1), i.tag === "mask" && t.id && (t.id = t.id + e.idSuffix), Object.entries(t).forEach(function(o) {
1018
1027
  var s = o[0], a = o[1];
@@ -1024,71 +1033,71 @@ function Li(i, e, n) {
1024
1033
  typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
1025
1034
  })), t;
1026
1035
  }
1027
- function Bi(i, e) {
1036
+ function qi(i, e) {
1028
1037
  var n, t = e.defIds;
1029
1038
  return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? he(he({}, i), { children: i.children.map(function(r) {
1030
1039
  return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? he(he({}, r), { attrs: he(he({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
1031
1040
  }) }) : i;
1032
1041
  }
1033
- function Ui() {
1042
+ function Ki() {
1034
1043
  return Math.random().toString(36).substring(2, 8);
1035
1044
  }
1036
- it.displayName = "UniverIcon";
1037
- var ki = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, ot = Kn(function(i, e) {
1038
- return Yn(it, Object.assign({}, i, {
1045
+ ht.displayName = "UniverIcon";
1046
+ var Yi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, wt = at(function(i, e) {
1047
+ return ct(ht, Object.assign({}, i, {
1039
1048
  id: "add-image-single",
1040
1049
  ref: e,
1041
- icon: ki
1050
+ icon: Yi
1042
1051
  }));
1043
1052
  });
1044
- ot.displayName = "AddImageSingle";
1045
- const Cn = {
1053
+ wt.displayName = "AddImageSingle";
1054
+ const yn = {
1046
1055
  id: "doc.command.remove-doc-image",
1047
1056
  type: Y.COMMAND,
1048
1057
  // eslint-disable-next-line max-lines-per-function
1049
1058
  handler: (i, e) => {
1050
- var M, y, E, U;
1051
- const n = i.get(z), t = i.get(K), r = i.get(ee), o = t.getCurrentUniverDocInstance();
1059
+ var M, P, N, B;
1060
+ const n = i.get($), t = i.get(q), r = i.get(J), o = t.getCurrentUniverDocInstance();
1052
1061
  if (e == null || o == null)
1053
1062
  return !1;
1054
- const s = r.getRenderById(e.unitId).with(Me), { drawings: a } = e, d = (M = s.getSegment()) != null ? M : "", c = new vn(), l = q.getInstance(), m = (E = (y = o.getSelfOrHeaderFooterModel(d).getBody()) == null ? void 0 : y.customBlocks) != null ? E : [], g = a.map((N) => m.find((I) => I.blockId === N.drawingId)).filter((N) => !!N).sort((N, I) => N.startIndex > I.startIndex ? 1 : -1), p = a[0].unitId, h = new bt();
1055
- h.reset();
1056
- const v = g[0].startIndex, w = [
1063
+ const s = r.getRenderById(e.unitId).with(Re), { drawings: a } = e, d = (M = s.getSegment()) != null ? M : "", c = new Sn(), l = X.getInstance(), m = (N = (P = o.getSelfOrHeaderFooterModel(d).getBody()) == null ? void 0 : P.customBlocks) != null ? N : [], g = a.map((E) => m.find((_) => _.blockId === E.drawingId)).filter((E) => !!E).sort((E, _) => E.startIndex > _.startIndex ? 1 : -1), f = a[0].unitId, u = new Ft();
1064
+ u.reset();
1065
+ const h = g[0].startIndex, v = [
1057
1066
  {
1058
- startOffset: v,
1059
- endOffset: v
1067
+ startOffset: h,
1068
+ endOffset: h
1060
1069
  }
1061
- ], S = {
1062
- id: J.id,
1070
+ ], I = {
1071
+ id: ne.id,
1063
1072
  params: {
1064
- unitId: p,
1073
+ unitId: f,
1065
1074
  actions: [],
1066
- textRanges: w
1075
+ textRanges: v
1067
1076
  }
1068
1077
  }, O = [];
1069
- for (const N of g) {
1070
- const { startIndex: I } = N;
1071
- I > h.cursor && c.push({
1078
+ for (const E of g) {
1079
+ const { startIndex: _ } = E;
1080
+ _ > u.cursor && c.push({
1072
1081
  t: Q.RETAIN,
1073
- len: I - h.cursor
1082
+ len: _ - u.cursor
1074
1083
  }), c.push({
1075
1084
  t: Q.DELETE,
1076
1085
  len: 1
1077
- }), h.moveCursorTo(I + 1);
1086
+ }), u.moveCursorTo(_ + 1);
1078
1087
  }
1079
- const D = ze(o, d);
1080
- O.push(l.editOp(c.serialize(), D));
1081
- for (const N of g) {
1082
- const { blockId: I } = N, L = ((U = o.getDrawings()) != null ? U : {})[I], x = o.getDrawingsOrder().indexOf(I), G = l.removeOp(["drawings", I], L), _ = l.removeOp(["drawingsOrder", x], I);
1083
- O.push(G), O.push(_);
1088
+ const C = qe(o, d);
1089
+ O.push(l.editOp(c.serialize(), C));
1090
+ for (const E of g) {
1091
+ const { blockId: _ } = E, L = ((B = o.getDrawings()) != null ? B : {})[_], x = o.getDrawingsOrder().indexOf(_), V = l.removeOp(["drawings", _], L), S = l.removeOp(["drawingsOrder", x], _);
1092
+ O.push(V), O.push(S);
1084
1093
  }
1085
- return S.params.actions = O.reduce((N, I) => q.compose(N, I), null), !!n.syncExecuteCommand(S.id, S.params);
1094
+ return I.params.actions = O.reduce((E, _) => X.compose(E, _), null), !!n.syncExecuteCommand(I.id, I.params);
1086
1095
  }
1087
- }, st = {
1096
+ }, vt = {
1088
1097
  id: "doc.command.delete-drawing",
1089
1098
  type: Y.COMMAND,
1090
1099
  handler: (i) => {
1091
- const e = i.get(z), t = i.get(Be).getFocusDrawings();
1100
+ const e = i.get($), t = i.get(Ue).getFocusDrawings();
1092
1101
  if (t.length === 0)
1093
1102
  return !1;
1094
1103
  const { unitId: r } = t[0], o = t.map((s) => {
@@ -1100,17 +1109,17 @@ const Cn = {
1100
1109
  drawingType: l
1101
1110
  };
1102
1111
  });
1103
- return e.executeCommand(Cn.id, {
1112
+ return e.executeCommand(yn.id, {
1104
1113
  unitId: r,
1105
1114
  drawings: o
1106
1115
  });
1107
1116
  }
1108
- }, at = {
1117
+ }, It = {
1109
1118
  id: "doc.command.group-doc-image",
1110
1119
  type: Y.COMMAND,
1111
1120
  handler: (i, e) => {
1112
- i.get(z), i.get(Vn);
1113
- const n = i.get(Be);
1121
+ i.get($), i.get(Yn);
1122
+ const n = i.get(Ue);
1114
1123
  if (!e) return !1;
1115
1124
  const t = [];
1116
1125
  e.forEach(({ parent: l, children: m }) => {
@@ -1121,100 +1130,100 @@ const Cn = {
1121
1130
  const r = n.getGroupDrawingOp(e), { unitId: o, subUnitId: s, undo: a, redo: d, objects: c } = r;
1122
1131
  return !1;
1123
1132
  }
1124
- }, ct = {
1133
+ }, Pn = {
1125
1134
  id: "doc.command.insert-doc-image",
1126
1135
  type: Y.COMMAND,
1127
1136
  // eslint-disable-next-line max-lines-per-function
1128
1137
  handler: (i, e) => {
1129
- var y, E, U, N;
1138
+ var P, N, B, E;
1130
1139
  if (e == null)
1131
1140
  return !1;
1132
- const n = i.get(z), t = i.get(_n), r = i.get(K), o = t.getActiveTextRange(), s = r.getCurrentUniverDocInstance();
1141
+ const n = i.get($), t = i.get(On), r = i.get(q), o = t.getActiveTextRange(), s = r.getCurrentUniverDocInstance();
1133
1142
  if (o == null || s == null)
1134
1143
  return !1;
1135
1144
  const a = s.getUnitId(), { drawings: d } = e, { collapsed: c, startOffset: l, segmentId: m } = o, g = s.getSelfOrHeaderFooterModel(m).getBody();
1136
1145
  if (g == null)
1137
1146
  return !1;
1138
- const p = new vn(), h = q.getInstance(), v = [], w = (E = (y = s.getSnapshot().drawingsOrder) == null ? void 0 : y.length) != null ? E : 0;
1139
- let S = 0;
1147
+ const f = new Sn(), u = X.getInstance(), h = [], v = (N = (P = s.getSnapshot().drawingsOrder) == null ? void 0 : P.length) != null ? N : 0;
1148
+ let I = 0;
1140
1149
  if (c)
1141
- l > 0 && p.push({
1150
+ l > 0 && f.push({
1142
1151
  t: Q.RETAIN,
1143
1152
  len: l
1144
1153
  });
1145
1154
  else {
1146
- const I = Mt.selection.delete([o], g, 0, null, !1);
1147
- p.push(...I);
1148
- const L = pi(g, [o]), W = (U = s.getDrawings()) != null ? U : {}, x = (N = s.getDrawingsOrder()) != null ? N : [], G = L.sort((_, C) => x.indexOf(_) > x.indexOf(C) ? -1 : x.indexOf(_) < x.indexOf(C) ? 1 : 0);
1149
- if (G.length > 0)
1150
- for (const _ of G) {
1151
- const C = W[_], R = x.indexOf(_);
1152
- if (C == null || R < 0)
1155
+ const _ = Wt.selection.delete([o], g, 0, null, !1);
1156
+ f.push(..._);
1157
+ const L = Mi(g, [o]), G = (B = s.getDrawings()) != null ? B : {}, x = (E = s.getDrawingsOrder()) != null ? E : [], V = L.sort((S, D) => x.indexOf(S) > x.indexOf(D) ? -1 : x.indexOf(S) < x.indexOf(D) ? 1 : 0);
1158
+ if (V.length > 0)
1159
+ for (const S of V) {
1160
+ const D = G[S], R = x.indexOf(S);
1161
+ if (D == null || R < 0)
1153
1162
  continue;
1154
- const P = h.removeOp(["drawings", _], C), B = h.removeOp(["drawingsOrder", R], _);
1155
- v.push(P), v.push(B), S++;
1163
+ const y = u.removeOp(["drawings", S], D), U = u.removeOp(["drawingsOrder", R], S);
1164
+ h.push(y), h.push(U), I++;
1156
1165
  }
1157
1166
  }
1158
- p.push({
1167
+ f.push({
1159
1168
  t: Q.INSERT,
1160
1169
  body: {
1161
1170
  dataStream: "\b".repeat(d.length),
1162
- customBlocks: d.map((I, L) => ({
1171
+ customBlocks: d.map((_, L) => ({
1163
1172
  startIndex: L,
1164
- blockId: I.drawingId
1173
+ blockId: _.drawingId
1165
1174
  }))
1166
1175
  },
1167
1176
  len: d.length
1168
1177
  });
1169
- const O = ze(s, m), D = h.editOp(p.serialize(), O);
1170
- v.push(D);
1171
- for (const I of d) {
1172
- const { drawingId: L } = I, W = h.insertOp(["drawings", L], I), x = h.insertOp(["drawingsOrder", w - S], L);
1173
- v.push(W), v.push(x);
1178
+ const O = qe(s, m), C = u.editOp(f.serialize(), O);
1179
+ h.push(C);
1180
+ for (const _ of d) {
1181
+ const { drawingId: L } = _, G = u.insertOp(["drawings", L], _), x = u.insertOp(["drawingsOrder", v - I], L);
1182
+ h.push(G), h.push(x);
1174
1183
  }
1175
1184
  const T = {
1176
- id: J.id,
1185
+ id: ne.id,
1177
1186
  params: {
1178
1187
  unitId: a,
1179
1188
  actions: [],
1180
1189
  textRanges: []
1181
1190
  }
1182
1191
  };
1183
- return T.params.actions = v.reduce((I, L) => q.compose(I, L), null), !!n.syncExecuteCommand(T.id, T.params);
1192
+ return T.params.actions = h.reduce((_, L) => X.compose(_, L), null), !!n.syncExecuteCommand(T.id, T.params);
1184
1193
  }
1185
- }, dt = {
1194
+ }, _t = {
1186
1195
  id: "doc.command.set-drawing-arrange",
1187
1196
  type: Y.COMMAND,
1188
1197
  handler: (i, e) => {
1189
- const n = i.get(z), t = i.get(Be);
1198
+ const n = i.get($), t = i.get(Ue);
1190
1199
  if (e == null)
1191
1200
  return !1;
1192
1201
  const { unitId: r, subUnitId: o, drawingIds: s, arrangeType: a } = e, d = { unitId: r, subUnitId: o, drawingIds: s };
1193
1202
  let c;
1194
- if (a === Ze.forward ? c = t.getForwardDrawingsOp(d) : a === Ze.backward ? c = t.getBackwardDrawingOp(d) : a === Ze.front ? c = t.getFrontDrawingsOp(d) : a === Ze.back && (c = t.getBackDrawingsOp(d)), c == null)
1203
+ if (a === Qe.forward ? c = t.getForwardDrawingsOp(d) : a === Qe.backward ? c = t.getBackwardDrawingOp(d) : a === Qe.front ? c = t.getFrontDrawingsOp(d) : a === Qe.back && (c = t.getBackDrawingsOp(d)), c == null)
1195
1204
  return !1;
1196
1205
  const { redo: l } = c;
1197
1206
  if (l == null)
1198
1207
  return !1;
1199
1208
  const m = [];
1200
- let g = ye.deepClone(l);
1209
+ let g = Me.deepClone(l);
1201
1210
  g = g.slice(3), g.unshift("drawingsOrder"), m.push(g);
1202
- const p = {
1203
- id: J.id,
1211
+ const f = {
1212
+ id: ne.id,
1204
1213
  params: {
1205
1214
  unitId: r,
1206
1215
  actions: [],
1207
1216
  textRanges: null
1208
1217
  }
1209
1218
  };
1210
- return p.params.actions = m.reduce((v, w) => q.compose(v, w), null), !!n.syncExecuteCommand(p.id, p.params);
1219
+ return f.params.actions = m.reduce((h, v) => X.compose(h, v), null), !!n.syncExecuteCommand(f.id, f.params);
1211
1220
  }
1212
- }, lt = {
1221
+ }, St = {
1213
1222
  id: "doc.command.ungroup-doc-image",
1214
1223
  type: Y.COMMAND,
1215
1224
  handler: (i, e) => {
1216
- i.get(z), i.get(Vn);
1217
- const n = i.get(Be);
1225
+ i.get($), i.get(Yn);
1226
+ const n = i.get(Ue);
1218
1227
  if (!e) return !1;
1219
1228
  const t = [];
1220
1229
  e.forEach(({ parent: l, children: m }) => {
@@ -1226,23 +1235,23 @@ const Cn = {
1226
1235
  return !1;
1227
1236
  }
1228
1237
  };
1229
- var Fi = Object.getOwnPropertyDescriptor, Hi = (i, e, n, t) => {
1230
- for (var r = t > 1 ? void 0 : t ? Fi(e, n) : e, o = i.length - 1, s; o >= 0; o--)
1238
+ var Zi = Object.getOwnPropertyDescriptor, Qi = (i, e, n, t) => {
1239
+ for (var r = t > 1 ? void 0 : t ? Zi(e, n) : e, o = i.length - 1, s; o >= 0; o--)
1231
1240
  (s = i[o]) && (r = s(r) || r);
1232
1241
  return r;
1233
1242
  }, me = (i, e) => (n, t) => e(n, t, i);
1234
- let sn = class extends Xe {
1243
+ let an = class extends Ge {
1235
1244
  constructor(i, e, n, t, r, o, s, a, d, c, l, m, g) {
1236
1245
  super(), this._context = i, this._commandService = e, this._docSelectionManagerService = n, this._renderManagerSrv = t, this._imageIoService = r, this._docDrawingService = o, this._drawingManagerService = s, this._contextService = a, this._messageService = d, this._localeService = c, this._docSelectionRenderService = l, this._docRefreshDrawingsService = m, this._fileOpenerService = g, this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._transformDrawingListener(), this._editAreaChangeListener();
1237
1246
  }
1238
1247
  async insertDocImage() {
1239
1248
  const i = await this._fileOpenerService.openFile({
1240
1249
  multiple: !0,
1241
- accept: Vt.map((n) => `.${n.replace("image/", "")}`).join(",")
1250
+ accept: ei.map((n) => `.${n.replace("image/", "")}`).join(",")
1242
1251
  }), e = i.length;
1243
- return e > yn ? (this._messageService.show({
1244
- type: Bn.Error,
1245
- content: this._localeService.t("update-status.exceedMaxCount", String(yn))
1252
+ return e > Nn ? (this._messageService.show({
1253
+ type: Vn.Error,
1254
+ content: this._localeService.t("update-status.exceedMaxCount", String(Nn))
1246
1255
  }), !1) : e === 0 ? !1 : (await this._insertFloatImages(i), !0);
1247
1256
  }
1248
1257
  // eslint-disable-next-line max-lines-per-function
@@ -1254,18 +1263,18 @@ let sn = class extends Xe {
1254
1263
  const o = r.message;
1255
1264
  let s = "";
1256
1265
  switch (o) {
1257
- case hn.ERROR_EXCEED_SIZE:
1258
- s = this._localeService.t("update-status.exceedMaxSize", String(jt / (1024 * 1024)));
1266
+ case wn.ERROR_EXCEED_SIZE:
1267
+ s = this._localeService.t("update-status.exceedMaxSize", String(ni / (1024 * 1024)));
1259
1268
  break;
1260
- case hn.ERROR_IMAGE_TYPE:
1269
+ case wn.ERROR_IMAGE_TYPE:
1261
1270
  s = this._localeService.t("update-status.invalidImageType");
1262
1271
  break;
1263
- case hn.ERROR_IMAGE:
1272
+ case wn.ERROR_IMAGE:
1264
1273
  s = this._localeService.t("update-status.invalidImage");
1265
1274
  break;
1266
1275
  }
1267
1276
  this._messageService.show({
1268
- type: Bn.Error,
1277
+ type: Vn.Error,
1269
1278
  content: s
1270
1279
  });
1271
1280
  }
@@ -1275,47 +1284,47 @@ let sn = class extends Xe {
1275
1284
  for (const r of e) {
1276
1285
  if (r == null)
1277
1286
  continue;
1278
- const { imageId: o, imageSourceType: s, source: a, base64Cache: d } = r, { width: c, height: l, image: m } = await $t(d || "");
1287
+ const { imageId: o, imageSourceType: s, source: a, base64Cache: d } = r, { width: c, height: l, image: m } = await ti(d || "");
1279
1288
  this._imageIoService.addImageSourceCache(o, s, m);
1280
1289
  let g = 1;
1281
- if (c > bn || l > Mn) {
1282
- const w = bn / c, S = Mn / l;
1283
- g = Math.min(w, S);
1290
+ if (c > An || l > xn) {
1291
+ const v = An / c, I = xn / l;
1292
+ g = Math.min(v, I);
1284
1293
  }
1285
- const p = this._getImagePosition(c * g, l * g);
1286
- if (p == null)
1294
+ const f = this._getImagePosition(c * g, l * g);
1295
+ if (f == null)
1287
1296
  return;
1288
- const h = {
1297
+ const u = {
1289
1298
  unitId: n,
1290
1299
  subUnitId: n,
1291
1300
  drawingId: o,
1292
- drawingType: Rt.DRAWING_IMAGE,
1301
+ drawingType: Dn.DRAWING_IMAGE,
1293
1302
  imageSourceType: s,
1294
1303
  source: a,
1295
- transform: wi(p),
1296
- docTransform: p,
1297
- behindDoc: oe.FALSE,
1304
+ transform: tt(f),
1305
+ docTransform: f,
1306
+ behindDoc: se.FALSE,
1298
1307
  title: "",
1299
1308
  description: "",
1300
- layoutType: H.INLINE,
1309
+ layoutType: W.INLINE,
1301
1310
  // Insert inline drawing by default.
1302
- wrapText: $e.BOTH_SIDES,
1311
+ wrapText: Xe.BOTH_SIDES,
1303
1312
  distB: 0,
1304
1313
  distL: 0,
1305
1314
  distR: 0,
1306
1315
  distT: 0
1307
1316
  };
1308
- this._isInsertInHeaderFooter() && (h.isMultiTransform = oe.TRUE, h.transforms = h.transform ? [h.transform] : null), t.push(h);
1317
+ this._isInsertInHeaderFooter() && (u.isMultiTransform = se.TRUE, u.transforms = u.transform ? [u.transform] : null), t.push(u);
1309
1318
  }
1310
- this._commandService.executeCommand(ct.id, {
1319
+ this._commandService.executeCommand(Pn.id, {
1311
1320
  unitId: n,
1312
1321
  drawings: t
1313
1322
  });
1314
1323
  }
1315
1324
  _isInsertInHeaderFooter() {
1316
1325
  var t;
1317
- const { unitId: i } = this._context, e = (t = this._renderManagerSrv.getRenderById(i)) == null ? void 0 : t.with(se).getViewModel(), n = e == null ? void 0 : e.getEditArea();
1318
- return n === Fe.HEADER || n === Fe.FOOTER;
1326
+ const { unitId: i } = this._context, e = (t = this._renderManagerSrv.getRenderById(i)) == null ? void 0 : t.with(te).getViewModel(), n = e == null ? void 0 : e.getEditArea();
1327
+ return n === We.HEADER || n === We.FOOTER;
1319
1328
  }
1320
1329
  _getImagePosition(i, e) {
1321
1330
  const n = this._docSelectionRenderService.getActiveTextRange(), t = (n == null ? void 0 : n.getAbsolutePosition()) || {
@@ -1327,11 +1336,11 @@ let sn = class extends Xe {
1327
1336
  height: e
1328
1337
  },
1329
1338
  positionH: {
1330
- relativeFrom: ne.PAGE,
1339
+ relativeFrom: ee.PAGE,
1331
1340
  posOffset: t.left
1332
1341
  },
1333
1342
  positionV: {
1334
- relativeFrom: V.PARAGRAPH,
1343
+ relativeFrom: H.PARAGRAPH,
1335
1344
  posOffset: 0
1336
1345
  },
1337
1346
  angle: 0
@@ -1340,7 +1349,7 @@ let sn = class extends Xe {
1340
1349
  _updateOrderListener() {
1341
1350
  this._drawingManagerService.featurePluginOrderUpdate$.subscribe((i) => {
1342
1351
  const { unitId: e, subUnitId: n, drawingIds: t, arrangeType: r } = i;
1343
- this._commandService.executeCommand(dt.id, {
1352
+ this._commandService.executeCommand(_t.id, {
1344
1353
  unitId: e,
1345
1354
  subUnitId: n,
1346
1355
  drawingIds: t,
@@ -1350,9 +1359,9 @@ let sn = class extends Xe {
1350
1359
  }
1351
1360
  _groupDrawingListener() {
1352
1361
  this._drawingManagerService.featurePluginGroupUpdate$.subscribe((i) => {
1353
- this._commandService.executeCommand(at.id, i);
1362
+ this._commandService.executeCommand(It.id, i);
1354
1363
  }), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((i) => {
1355
- this._commandService.executeCommand(lt.id, i);
1364
+ this._commandService.executeCommand(St.id, i);
1356
1365
  });
1357
1366
  }
1358
1367
  _getCurrentSceneAndTransformer() {
@@ -1365,7 +1374,7 @@ let sn = class extends Xe {
1365
1374
  _transformDrawingListener() {
1366
1375
  const i = this._getCurrentSceneAndTransformer();
1367
1376
  if (i && i.transformer)
1368
- this.disposeWithMe(i.transformer.changeEnd$.pipe(Xn(30)).subscribe((e) => {
1377
+ this.disposeWithMe(i.transformer.changeEnd$.pipe(st(30)).subscribe((e) => {
1369
1378
  this._docSelectionManagerService.refreshSelection();
1370
1379
  }));
1371
1380
  else
@@ -1377,12 +1386,12 @@ let sn = class extends Xe {
1377
1386
  var r;
1378
1387
  const { transformer: e, docsLeft: n, docsTop: t } = (r = this._getCurrentSceneAndTransformer()) != null ? r : {};
1379
1388
  if (i == null || i.length === 0)
1380
- this._contextService.setContextValue(tn, !1), this._docDrawingService.focusDrawing([]), e && e.resetProps({
1389
+ this._contextService.setContextValue(rn, !1), this._docDrawingService.focusDrawing([]), e && e.resetProps({
1381
1390
  zeroTop: 0,
1382
1391
  zeroLeft: 0
1383
1392
  });
1384
1393
  else {
1385
- this._contextService.setContextValue(tn, !0), this._docDrawingService.focusDrawing(i), this._setDrawingSelections(i);
1394
+ this._contextService.setContextValue(rn, !0), this._docDrawingService.focusDrawing(i), this._setDrawingSelections(i);
1386
1395
  const o = this._docSelectionRenderService.getSegment(), s = this._findSegmentIdByDrawingId(i[0].drawingId);
1387
1396
  o !== s && this._docSelectionRenderService.setSegment(s), e && e.resetProps({
1388
1397
  zeroTop: t,
@@ -1408,20 +1417,32 @@ let sn = class extends Xe {
1408
1417
  // Update drawings edit status and opacity. You can not edit header footer images when you are editing body. and vice verse.
1409
1418
  _updateDrawingsEditStatus() {
1410
1419
  var a;
1411
- const { unit: i, scene: e, unitId: n } = this._context, t = (a = this._renderManagerSrv.getRenderById(n)) == null ? void 0 : a.with(se).getViewModel();
1420
+ const { unit: i, scene: e, unitId: n } = this._context, t = (a = this._renderManagerSrv.getRenderById(n)) == null ? void 0 : a.with(te).getViewModel();
1412
1421
  if (t == null || i == null)
1413
1422
  return;
1414
- const r = i.getSnapshot(), { drawings: o = {} } = r, s = t.getEditArea() === Fe.BODY;
1423
+ const r = i.getSnapshot(), { drawings: o = {} } = r, s = t.getEditArea() === We.BODY;
1415
1424
  for (const d of Object.keys(o)) {
1416
- const c = o[d], l = zt({ unitId: n, drawingId: c.drawingId, subUnitId: n }), m = e.fuzzyMathObjects(l, !0);
1425
+ const c = o[d], l = ii({ unitId: n, drawingId: c.drawingId, subUnitId: n }), m = e.fuzzyMathObjects(l, !0);
1417
1426
  if (m.length)
1418
- for (const g of m)
1419
- e.detachTransformerFrom(g), g.setOpacity(0.5), (s && c.isMultiTransform !== oe.TRUE || !s && c.isMultiTransform === oe.TRUE) && (e.attachTransformerTo(g), g.setOpacity(1));
1427
+ for (const g of m) {
1428
+ e.detachTransformerFrom(g);
1429
+ try {
1430
+ g.setOpacity(0.5);
1431
+ } catch {
1432
+ }
1433
+ if (s && c.isMultiTransform !== se.TRUE || !s && c.isMultiTransform === se.TRUE) {
1434
+ c.allowTransform !== !1 && e.attachTransformerTo(g);
1435
+ try {
1436
+ g.setOpacity(1);
1437
+ } catch {
1438
+ }
1439
+ }
1440
+ }
1420
1441
  }
1421
1442
  }
1422
1443
  _editAreaChangeListener() {
1423
1444
  var n;
1424
- const { unitId: i } = this._context, e = (n = this._renderManagerSrv.getRenderById(i)) == null ? void 0 : n.with(se).getViewModel();
1445
+ const { unitId: i } = this._context, e = (n = this._renderManagerSrv.getRenderById(i)) == null ? void 0 : n.with(te).getViewModel();
1425
1446
  e != null && (this._updateDrawingsEditStatus(), this.disposeWithMe(
1426
1447
  e.editAreaChange$.subscribe(() => {
1427
1448
  this._updateDrawingsEditStatus();
@@ -1432,7 +1453,7 @@ let sn = class extends Xe {
1432
1453
  });
1433
1454
  }), this.disposeWithMe(
1434
1455
  this._commandService.onCommandExecuted(async (t) => {
1435
- t.id === J.id && queueMicrotask(() => {
1456
+ t.id === ne.id && queueMicrotask(() => {
1436
1457
  this._updateDrawingsEditStatus();
1437
1458
  });
1438
1459
  })
@@ -1447,79 +1468,79 @@ let sn = class extends Xe {
1447
1468
  this._docSelectionManagerService.replaceDocRanges(t);
1448
1469
  }
1449
1470
  };
1450
- sn = Hi([
1451
- me(1, z),
1452
- me(2, ve(_n)),
1453
- me(3, ee),
1454
- me(4, Gt),
1455
- me(5, Be),
1471
+ an = Qi([
1472
+ me(1, $),
1473
+ me(2, pe(On)),
1474
+ me(3, J),
1475
+ me(4, Jt),
1476
+ me(5, Ue),
1456
1477
  me(6, Ie),
1457
- me(7, jn),
1458
- me(8, oi),
1459
- me(9, ve(ln)),
1460
- me(10, ve(Me)),
1461
- me(11, ve(gn)),
1462
- me(12, si)
1463
- ], sn);
1464
- const gt = {
1478
+ me(7, Zn),
1479
+ me(8, wi),
1480
+ me(9, pe(mn)),
1481
+ me(10, pe(Re)),
1482
+ me(11, pe(un)),
1483
+ me(12, vi)
1484
+ ], an);
1485
+ const Dt = {
1465
1486
  id: "doc.command.insert-float-image",
1466
1487
  type: Y.COMMAND,
1467
1488
  handler: (i) => {
1468
1489
  var t, r;
1469
- const e = i.get(K), n = i.get(ee);
1470
- return (r = (t = ii(be.UNIVER_DOC, e, n)) == null ? void 0 : t.with(sn).insertDocImage()) != null ? r : !1;
1490
+ const e = i.get(q), n = i.get(J);
1491
+ return (r = (t = hi(Se.UNIVER_DOC, e, n)) == null ? void 0 : t.with(an).insertDocImage()) != null ? r : !1;
1471
1492
  }
1472
- }, Ke = {
1493
+ }, Ye = {
1473
1494
  id: "doc.command.move-drawing",
1474
1495
  type: Y.COMMAND,
1475
1496
  handler: (i, e) => {
1476
- const n = i.get(z), t = i.get(Be), r = i.get(K), o = i.get(ee), { direction: s } = e, a = t.getFocusDrawings();
1497
+ const n = i.get($), t = i.get(Ue), r = i.get(q), o = i.get(J), { direction: s } = e, a = t.getFocusDrawings();
1477
1498
  if (a.length === 0)
1478
1499
  return !1;
1479
1500
  const d = a[0].unitId, c = o.getRenderById(d), l = c == null ? void 0 : c.scene;
1480
1501
  if (l == null)
1481
1502
  return !1;
1482
- const m = l.getTransformerByCreate(), g = r.getUniverDocInstance(d), p = a.map((v) => {
1483
- var y, E, U, N, I;
1484
- const { drawingId: w } = v, S = (y = g == null ? void 0 : g.getSnapshot().drawings) == null ? void 0 : y[w];
1485
- if (S == null || S.layoutType === H.INLINE)
1503
+ const m = l.getTransformerByCreate(), g = r.getUniverDocInstance(d), f = a.map((h) => {
1504
+ var P, N, B, E, _;
1505
+ const { drawingId: v } = h, I = (P = g == null ? void 0 : g.getSnapshot().drawings) == null ? void 0 : P[v];
1506
+ if (I == null || I.layoutType === W.INLINE)
1486
1507
  return null;
1487
- const { positionH: O, positionV: D } = S.docTransform, T = { ...O }, M = { ...D };
1488
- return s === fe.UP ? M.posOffset = ((E = M.posOffset) != null ? E : 0) - 2 : s === fe.DOWN ? M.posOffset = ((U = M.posOffset) != null ? U : 0) + 2 : s === fe.LEFT ? T.posOffset = ((N = T.posOffset) != null ? N : 0) - 2 : s === fe.RIGHT && (T.posOffset = ((I = T.posOffset) != null ? I : 0) + 2), {
1489
- drawingId: w,
1508
+ const { positionH: O, positionV: C } = I.docTransform, T = { ...O }, M = { ...C };
1509
+ return s === fe.UP ? M.posOffset = ((N = M.posOffset) != null ? N : 0) - 2 : s === fe.DOWN ? M.posOffset = ((B = M.posOffset) != null ? B : 0) + 2 : s === fe.LEFT ? T.posOffset = ((E = T.posOffset) != null ? E : 0) - 2 : s === fe.RIGHT && (T.posOffset = ((_ = T.posOffset) != null ? _ : 0) + 2), {
1510
+ drawingId: v,
1490
1511
  key: s === fe.UP || s === fe.DOWN ? "positionV" : "positionH",
1491
1512
  value: s === fe.UP || s === fe.DOWN ? M : T
1492
1513
  };
1493
- }).filter((v) => v != null);
1494
- if (p.length === 0)
1514
+ }).filter((h) => h != null);
1515
+ if (f.length === 0)
1495
1516
  return !1;
1496
- const h = n.syncExecuteCommand(qe.id, {
1517
+ const u = n.syncExecuteCommand(Ke.id, {
1497
1518
  unitId: d,
1498
1519
  subUnitId: d,
1499
- drawings: p
1520
+ drawings: f
1500
1521
  });
1501
- return m.refreshControls(), !!h;
1522
+ return m.refreshControls(), !!u;
1502
1523
  }
1503
- }, Wi = {
1524
+ }, Ji = {
1504
1525
  id: "doc.operation.clear-drawing-transformer",
1505
1526
  type: Y.MUTATION,
1506
1527
  handler: (i, e) => {
1507
- const n = i.get(ee);
1528
+ const n = i.get(J);
1508
1529
  return e.forEach((t) => {
1509
1530
  var r, o;
1510
1531
  (o = (r = n.getRenderById(t)) == null ? void 0 : r.scene.getTransformer()) == null || o.debounceRefreshControls();
1511
1532
  }), !0;
1512
1533
  }
1513
- }, mt = "COMPONENT_DOC_DRAWING_PANEL", ut = {
1534
+ }, Ct = "COMPONENT_DOC_DRAWING_PANEL", Ot = {
1514
1535
  id: "sidebar.operation.doc-image",
1515
1536
  type: Y.COMMAND,
1516
1537
  handler: async (i, e) => {
1517
- const n = i.get(ai), t = i.get(ln), r = i.get(Ie);
1538
+ const n = i.get(Ii), t = i.get(mn), r = i.get(Ie);
1518
1539
  switch (e.value) {
1519
1540
  case "open":
1520
1541
  n.open({
1521
1542
  header: { title: t.t("docImage.panel.title") },
1522
- children: { label: mt },
1543
+ children: { label: Ct },
1523
1544
  onClose: () => {
1524
1545
  r.focusDrawing(null);
1525
1546
  },
@@ -1533,492 +1554,492 @@ const gt = {
1533
1554
  }
1534
1555
  return !0;
1535
1556
  }
1536
- }, ft = {
1557
+ }, Tt = {
1537
1558
  id: "doc.operation.edit-doc-image",
1538
1559
  type: Y.OPERATION,
1539
1560
  handler: (i, e) => {
1540
- const n = i.get(Ie), t = i.get(z);
1541
- return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(ut.id, { value: "open" }), !0);
1542
- }
1543
- }, Gi = "univer-image-common-panel", Vi = "univer-image-common-panel-grid", ji = "univer-image-common-panel-border", $i = "univer-image-common-panel-title", zi = "univer-image-common-panel-subtitle", qi = "univer-image-common-panel-row", Xi = "univer-image-common-panel-column", Ki = "univer-image-common-panel-span2", Yi = "univer-image-common-panel-input", u = {
1544
- imageCommonPanel: Gi,
1545
- imageCommonPanelGrid: Vi,
1546
- imageCommonPanelBorder: ji,
1547
- imageCommonPanelTitle: $i,
1548
- imageCommonPanelSubtitle: zi,
1549
- imageCommonPanelRow: qi,
1550
- imageCommonPanelColumn: Xi,
1551
- imageCommonPanelSpan2: Ki,
1552
- imageCommonPanelInput: Yi
1553
- }, Wn = -1e3, Gn = 1e3, Zi = (i) => {
1554
- const e = we(z), n = we(ln), t = we(Ie), r = we(ee), o = we(K), { drawings: s } = i, a = s[0];
1561
+ const n = i.get(Ie), t = i.get($);
1562
+ return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(Ot.id, { value: "open" }), !0);
1563
+ }
1564
+ }, er = "univer-image-common-panel", nr = "univer-image-common-panel-grid", tr = "univer-image-common-panel-border", ir = "univer-image-common-panel-title", rr = "univer-image-common-panel-subtitle", or = "univer-image-common-panel-row", sr = "univer-image-common-panel-column", ar = "univer-image-common-panel-span2", cr = "univer-image-common-panel-input", p = {
1565
+ imageCommonPanel: er,
1566
+ imageCommonPanelGrid: nr,
1567
+ imageCommonPanelBorder: tr,
1568
+ imageCommonPanelTitle: ir,
1569
+ imageCommonPanelSubtitle: rr,
1570
+ imageCommonPanelRow: or,
1571
+ imageCommonPanelColumn: sr,
1572
+ imageCommonPanelSpan2: ar,
1573
+ imageCommonPanelInput: cr
1574
+ }, qn = -1e3, Kn = 1e3, dr = (i) => {
1575
+ const e = ve($), n = ve(mn), t = ve(Ie), r = ve(J), o = ve(q), { drawings: s } = i, a = s[0];
1555
1576
  if (a == null)
1556
1577
  return;
1557
1578
  const { unitId: d } = a, c = o.getUniverDocInstance(d), l = c == null ? void 0 : c.getSnapshot().documentStyle.documentFlavor, m = r.getRenderById(d), g = m == null ? void 0 : m.scene;
1558
1579
  if (g == null)
1559
1580
  return;
1560
- const p = g.getTransformerByCreate(), h = [{
1581
+ const f = g.getTransformerByCreate(), u = [{
1561
1582
  label: n.t("image-position.column"),
1562
- value: String(ne.COLUMN)
1583
+ value: String(ee.COLUMN)
1563
1584
  }, {
1564
1585
  label: n.t("image-position.page"),
1565
- value: String(ne.PAGE)
1586
+ value: String(ee.PAGE)
1566
1587
  }, {
1567
1588
  label: n.t("image-position.margin"),
1568
- value: String(ne.MARGIN)
1569
- }], v = [{
1589
+ value: String(ee.MARGIN)
1590
+ }], h = [{
1570
1591
  label: n.t("image-position.line"),
1571
- value: String(V.LINE),
1572
- disabled: l === fn.MODERN
1592
+ value: String(H.LINE),
1593
+ disabled: l === pn.MODERN
1573
1594
  }, {
1574
1595
  label: n.t("image-position.page"),
1575
- value: String(V.PAGE),
1576
- disabled: l === fn.MODERN
1596
+ value: String(H.PAGE),
1597
+ disabled: l === pn.MODERN
1577
1598
  }, {
1578
1599
  label: n.t("image-position.margin"),
1579
- value: String(V.MARGIN),
1580
- disabled: l === fn.MODERN
1600
+ value: String(H.MARGIN),
1601
+ disabled: l === pn.MODERN
1581
1602
  }, {
1582
1603
  label: n.t("image-position.paragraph"),
1583
- value: String(V.PARAGRAPH)
1584
- }], [w, S] = re(!0), [O, D] = re({
1585
- relativeFrom: ne.PAGE,
1604
+ value: String(H.PARAGRAPH)
1605
+ }], [v, I] = oe(!0), [O, C] = oe({
1606
+ relativeFrom: ee.PAGE,
1586
1607
  posOffset: 0
1587
- }), [T, M] = re({
1588
- relativeFrom: V.PAGE,
1608
+ }), [T, M] = oe({
1609
+ relativeFrom: H.PAGE,
1589
1610
  posOffset: 0
1590
- }), [y, E] = re(!0), [U, N] = re(!0);
1591
- function I(C, R) {
1611
+ }), [P, N] = oe(!0), [B, E] = oe(!0);
1612
+ function _(D, R) {
1592
1613
  var b;
1593
- C === "positionH" ? D(R) : M(R);
1594
- const P = t.getFocusDrawings();
1595
- if (P.length === 0)
1614
+ D === "positionH" ? C(R) : M(R);
1615
+ const y = t.getFocusDrawings();
1616
+ if (y.length === 0)
1596
1617
  return;
1597
- const B = P.map((A) => ({
1618
+ const U = y.map((A) => ({
1598
1619
  unitId: A.unitId,
1599
1620
  subUnitId: A.subUnitId,
1600
1621
  drawingId: A.drawingId
1601
1622
  }));
1602
- e.executeCommand(qe.id, {
1603
- unitId: P[0].unitId,
1604
- subUnitId: P[0].unitId,
1605
- drawings: B.map((A) => ({
1623
+ e.executeCommand(Ke.id, {
1624
+ unitId: y[0].unitId,
1625
+ subUnitId: y[0].unitId,
1626
+ drawings: U.map((A) => ({
1606
1627
  drawingId: A.drawingId,
1607
- key: C,
1628
+ key: D,
1608
1629
  value: R
1609
1630
  }))
1610
1631
  });
1611
- const k = (b = r.getRenderById(d)) == null ? void 0 : b.with(Me);
1612
- k && k.blur(), p.refreshControls();
1632
+ const k = (b = r.getRenderById(d)) == null ? void 0 : b.with(Re);
1633
+ k && k.blur(), f.refreshControls();
1613
1634
  }
1614
- function L(C) {
1615
- var ie, _e, Se;
1616
- const R = O.relativeFrom, P = O.posOffset, B = Number(C);
1617
- if (R === B)
1635
+ function L(D) {
1636
+ var re, De, Ce;
1637
+ const R = O.relativeFrom, y = O.posOffset, U = Number(D);
1638
+ if (R === U)
1618
1639
  return;
1619
1640
  const k = t.getFocusDrawings();
1620
1641
  if (k.length === 0)
1621
1642
  return;
1622
1643
  const b = k[0].drawingId, A = k[0].unitId;
1623
- let $ = null, F = 0;
1624
- const Z = (ie = r.getRenderById(A)) == null ? void 0 : ie.with(se).getSkeleton(), ae = Z == null ? void 0 : Z.getSkeletonData();
1644
+ let z = null, F = 0;
1645
+ const Z = (re = r.getRenderById(A)) == null ? void 0 : re.with(te).getSkeleton(), ae = Z == null ? void 0 : Z.getSkeletonData();
1625
1646
  if (ae == null)
1626
1647
  return;
1627
- const { pages: Ue, skeHeaders: Re, skeFooters: We } = ae;
1628
- for (const de of Ue) {
1629
- const { marginLeft: De, skeDrawings: Oe, headerId: Ne, footerId: Ee, pageWidth: Te } = de;
1630
- if (Oe.has(b)) {
1631
- $ = Oe.get(b), F = De;
1648
+ const { pages: Be, skeHeaders: Ee, skeFooters: Ve } = ae;
1649
+ for (const de of Be) {
1650
+ const { marginLeft: Te, skeDrawings: ye, headerId: Ne, footerId: Ae, pageWidth: Pe } = de;
1651
+ if (ye.has(b)) {
1652
+ z = ye.get(b), F = Te;
1632
1653
  break;
1633
1654
  }
1634
- const le = (_e = Re.get(Ne)) == null ? void 0 : _e.get(Te);
1655
+ const le = (De = Ee.get(Ne)) == null ? void 0 : De.get(Pe);
1635
1656
  if (le != null && le.skeDrawings.has(b)) {
1636
- $ = le == null ? void 0 : le.skeDrawings.get(b), F = De;
1657
+ z = le == null ? void 0 : le.skeDrawings.get(b), F = Te;
1637
1658
  break;
1638
1659
  }
1639
- const ge = (Se = We.get(Ee)) == null ? void 0 : Se.get(Te);
1660
+ const ge = (Ce = Ve.get(Ae)) == null ? void 0 : Ce.get(Pe);
1640
1661
  if (ge != null && ge.skeDrawings.has(b)) {
1641
- $ = ge == null ? void 0 : ge.skeDrawings.get(b), F = De;
1662
+ z = ge == null ? void 0 : ge.skeDrawings.get(b), F = Te;
1642
1663
  break;
1643
1664
  }
1644
1665
  }
1645
- if ($ == null)
1666
+ if (z == null)
1646
1667
  return;
1647
1668
  let ce = 0;
1648
- R === ne.COLUMN ? ce -= $.columnLeft : R === ne.MARGIN && (ce -= F), B === ne.COLUMN ? ce += $.columnLeft : B === ne.MARGIN ? ce += F : ne.PAGE;
1649
- const te = {
1650
- relativeFrom: B,
1651
- posOffset: (P != null ? P : 0) - ce
1669
+ R === ee.COLUMN ? ce -= z.columnLeft : R === ee.MARGIN && (ce -= F), U === ee.COLUMN ? ce += z.columnLeft : U === ee.MARGIN ? ce += F : ee.PAGE;
1670
+ const ie = {
1671
+ relativeFrom: U,
1672
+ posOffset: (y != null ? y : 0) - ce
1652
1673
  };
1653
- I("positionH", te);
1674
+ _("positionH", ie);
1654
1675
  }
1655
- function W(C) {
1656
- var Oe, Ne, Ee, Te, le, ge;
1657
- const R = T.relativeFrom, P = T.posOffset, B = Number(C);
1658
- if (R === B)
1676
+ function G(D) {
1677
+ var ye, Ne, Ae, Pe, le, ge;
1678
+ const R = T.relativeFrom, y = T.posOffset, U = Number(D);
1679
+ if (R === U)
1659
1680
  return;
1660
1681
  const k = t.getFocusDrawings();
1661
1682
  if (k.length === 0)
1662
1683
  return;
1663
- const { drawingId: b, unitId: A } = k[0], $ = o.getUniverDocInstance(A), F = (Oe = r.getRenderById(A)) == null ? void 0 : Oe.with(se).getSkeleton(), Z = (Ne = r.getRenderById(A)) == null ? void 0 : Ne.with(Me), ae = Z == null ? void 0 : Z.getSegment(), Ue = Z == null ? void 0 : Z.getSegmentPage(), Re = (Te = (Ee = $ == null ? void 0 : $.getSelfOrHeaderFooterModel(ae).getBody()) == null ? void 0 : Ee.customBlocks) == null ? void 0 : Te.find((Ae) => Ae.blockId === b);
1664
- if (Re == null || F == null || Z == null)
1684
+ const { drawingId: b, unitId: A } = k[0], z = o.getUniverDocInstance(A), F = (ye = r.getRenderById(A)) == null ? void 0 : ye.with(te).getSkeleton(), Z = (Ne = r.getRenderById(A)) == null ? void 0 : Ne.with(Re), ae = Z == null ? void 0 : Z.getSegment(), Be = Z == null ? void 0 : Z.getSegmentPage(), Ee = (Pe = (Ae = z == null ? void 0 : z.getSelfOrHeaderFooterModel(ae).getBody()) == null ? void 0 : Ae.customBlocks) == null ? void 0 : Pe.find((xe) => xe.blockId === b);
1685
+ if (Ee == null || F == null || Z == null)
1665
1686
  return;
1666
- const { startIndex: We } = Re, ce = F.findNodeByCharIndex(We, ae, Ue), te = (le = ce == null ? void 0 : ce.parent) == null ? void 0 : le.parent, ie = te == null ? void 0 : te.parent, _e = ie == null ? void 0 : ie.lines.find((Ae) => Ae.paragraphIndex === (te == null ? void 0 : te.paragraphIndex) && Ae.paragraphStart), Se = (ge = ie == null ? void 0 : ie.parent) == null ? void 0 : ge.parent;
1667
- if (ce == null || te == null || _e == null || ie == null || Se == null)
1687
+ const { startIndex: Ve } = Ee, ce = F.findNodeByCharIndex(Ve, ae, Be), ie = (le = ce == null ? void 0 : ce.parent) == null ? void 0 : le.parent, re = ie == null ? void 0 : ie.parent, De = re == null ? void 0 : re.lines.find((xe) => xe.paragraphIndex === (ie == null ? void 0 : ie.paragraphIndex) && xe.paragraphStart), Ce = (ge = re == null ? void 0 : re.parent) == null ? void 0 : ge.parent;
1688
+ if (ce == null || ie == null || De == null || re == null || Ce == null)
1668
1689
  return;
1669
1690
  let de = 0;
1670
- R === V.PARAGRAPH ? de -= _e.top : R === V.LINE ? de -= te.top : R === V.PAGE && (de += Se.marginTop), B === V.PARAGRAPH ? de += _e.top : B === V.LINE ? de += te.top : B === V.PAGE && (de -= Se.marginTop);
1671
- const De = {
1672
- relativeFrom: B,
1673
- posOffset: (P != null ? P : 0) - de
1691
+ R === H.PARAGRAPH ? de -= De.top : R === H.LINE ? de -= ie.top : R === H.PAGE && (de += Ce.marginTop), U === H.PARAGRAPH ? de += De.top : U === H.LINE ? de += ie.top : U === H.PAGE && (de -= Ce.marginTop);
1692
+ const Te = {
1693
+ relativeFrom: U,
1694
+ posOffset: (y != null ? y : 0) - de
1674
1695
  };
1675
- I("positionV", De);
1696
+ _("positionV", Te);
1676
1697
  }
1677
- function x(C) {
1698
+ function x(D) {
1678
1699
  var A;
1679
- const R = c == null ? void 0 : c.getSnapshot(), P = (A = R == null ? void 0 : R.drawings) == null ? void 0 : A[C.drawingId];
1680
- if (P == null)
1700
+ const R = c == null ? void 0 : c.getSnapshot(), y = (A = R == null ? void 0 : R.drawings) == null ? void 0 : A[D.drawingId];
1701
+ if (y == null)
1681
1702
  return;
1682
- const { layoutType: B } = P, {
1703
+ const { layoutType: U } = y, {
1683
1704
  positionH: k,
1684
1705
  positionV: b
1685
- } = P.docTransform;
1686
- D(k), M(b), S(B === H.INLINE), E(b.relativeFrom === V.PARAGRAPH || b.relativeFrom === V.LINE);
1706
+ } = y.docTransform;
1707
+ C(k), M(b), I(U === W.INLINE), N(b.relativeFrom === H.PARAGRAPH || b.relativeFrom === H.LINE);
1687
1708
  }
1688
- function G() {
1689
- const C = t.getFocusDrawings();
1690
- C.length !== 0 && x(C[0]);
1709
+ function V() {
1710
+ const D = t.getFocusDrawings();
1711
+ D.length !== 0 && x(D[0]);
1691
1712
  }
1692
- function _(C) {
1693
- E(C), W(String(C ? V.PARAGRAPH : V.PAGE));
1713
+ function S(D) {
1714
+ N(D), G(String(D ? H.PARAGRAPH : H.PAGE));
1694
1715
  }
1695
- return Sn(() => {
1696
- G();
1697
- const C = t.focus$.subscribe((P) => {
1698
- if (P.length === 0) {
1699
- N(!1);
1716
+ return Tn(() => {
1717
+ V();
1718
+ const D = t.focus$.subscribe((y) => {
1719
+ if (y.length === 0) {
1720
+ E(!1);
1700
1721
  return;
1701
1722
  }
1702
- N(!0), x(P[0]);
1703
- }), R = e.onCommandExecuted(async (P) => {
1704
- P.id === J.id && G();
1723
+ E(!0), x(y[0]);
1724
+ }), R = e.onCommandExecuted(async (y) => {
1725
+ y.id === ne.id && V();
1705
1726
  });
1706
1727
  return () => {
1707
- C.unsubscribe(), R.dispose();
1728
+ D.unsubscribe(), R.dispose();
1708
1729
  };
1709
- }, []), /* @__PURE__ */ X("div", { className: j(u.imageCommonPanelGrid, u.imageCommonPanelBorder), style: { display: U ? "block" : "none" }, children: [
1710
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelTitle), children: /* @__PURE__ */ f("div", { children: n.t("image-position.title") }) }) }),
1711
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSubtitle), children: /* @__PURE__ */ f("div", { children: n.t("image-position.horizontal") }) }) }),
1712
- /* @__PURE__ */ X("div", { className: u.imageCommonPanelRow, children: [
1713
- /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSpan2), children: /* @__PURE__ */ X("label", { children: [
1714
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: n.t("image-position.absolutePosition") }) }),
1715
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: /* @__PURE__ */ f(
1716
- ke,
1730
+ }, []), /* @__PURE__ */ K("div", { className: j(p.imageCommonPanelGrid, p.imageCommonPanelBorder), style: { display: B ? "block" : "none" }, children: [
1731
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelTitle), children: /* @__PURE__ */ w("div", { children: n.t("image-position.title") }) }) }),
1732
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSubtitle), children: /* @__PURE__ */ w("div", { children: n.t("image-position.horizontal") }) }) }),
1733
+ /* @__PURE__ */ K("div", { className: p.imageCommonPanelRow, children: [
1734
+ /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
1735
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: n.t("image-position.absolutePosition") }) }),
1736
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: /* @__PURE__ */ w(
1737
+ Fe,
1717
1738
  {
1718
- min: Wn,
1719
- max: Gn,
1739
+ min: qn,
1740
+ max: Kn,
1720
1741
  precision: 1,
1721
- disabled: w,
1742
+ disabled: v,
1722
1743
  value: O.posOffset,
1723
- onChange: (C) => {
1724
- I("positionH", {
1744
+ onChange: (D) => {
1745
+ _("positionH", {
1725
1746
  relativeFrom: O.relativeFrom,
1726
- posOffset: C
1747
+ posOffset: D
1727
1748
  });
1728
1749
  },
1729
- className: u.imageCommonPanelInput
1750
+ className: p.imageCommonPanelInput
1730
1751
  }
1731
1752
  ) }) })
1732
1753
  ] }) }),
1733
- /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSpan2), children: /* @__PURE__ */ X("label", { children: [
1734
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: n.t("image-position.toTheRightOf") }) }),
1735
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: /* @__PURE__ */ f(
1736
- Un,
1754
+ /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
1755
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: n.t("image-position.toTheRightOf") }) }),
1756
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: /* @__PURE__ */ w(
1757
+ jn,
1737
1758
  {
1738
1759
  value: String(O.relativeFrom),
1739
- disabled: w,
1740
- options: h,
1760
+ disabled: v,
1761
+ options: u,
1741
1762
  onChange: L
1742
1763
  }
1743
1764
  ) }) })
1744
1765
  ] }) })
1745
1766
  ] }),
1746
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSubtitle), children: /* @__PURE__ */ f("div", { children: n.t("image-position.vertical") }) }) }),
1747
- /* @__PURE__ */ X("div", { className: u.imageCommonPanelRow, children: [
1748
- /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSpan2), children: /* @__PURE__ */ X("label", { children: [
1749
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: n.t("image-position.absolutePosition") }) }),
1750
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: /* @__PURE__ */ f(
1751
- ke,
1767
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSubtitle), children: /* @__PURE__ */ w("div", { children: n.t("image-position.vertical") }) }) }),
1768
+ /* @__PURE__ */ K("div", { className: p.imageCommonPanelRow, children: [
1769
+ /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
1770
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: n.t("image-position.absolutePosition") }) }),
1771
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: /* @__PURE__ */ w(
1772
+ Fe,
1752
1773
  {
1753
- min: Wn,
1754
- max: Gn,
1774
+ min: qn,
1775
+ max: Kn,
1755
1776
  precision: 1,
1756
- disabled: w,
1777
+ disabled: v,
1757
1778
  value: T.posOffset,
1758
- onChange: (C) => {
1759
- I("positionV", {
1779
+ onChange: (D) => {
1780
+ _("positionV", {
1760
1781
  relativeFrom: T.relativeFrom,
1761
- posOffset: C
1782
+ posOffset: D
1762
1783
  });
1763
1784
  },
1764
- className: u.imageCommonPanelInput
1785
+ className: p.imageCommonPanelInput
1765
1786
  }
1766
1787
  ) }) })
1767
1788
  ] }) }),
1768
- /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSpan2), children: /* @__PURE__ */ X("label", { children: [
1769
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: n.t("image-position.bellow") }) }),
1770
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: /* @__PURE__ */ f(
1771
- Un,
1789
+ /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
1790
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: n.t("image-position.bellow") }) }),
1791
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: /* @__PURE__ */ w(
1792
+ jn,
1772
1793
  {
1773
- disabled: w,
1794
+ disabled: v,
1774
1795
  value: String(T.relativeFrom),
1775
- options: v,
1776
- onChange: W
1796
+ options: h,
1797
+ onChange: G
1777
1798
  }
1778
1799
  ) }) })
1779
1800
  ] }) })
1780
1801
  ] }),
1781
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSubtitle), children: /* @__PURE__ */ f("div", { children: n.t("image-position.options") }) }) }),
1782
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, style: { marginBottom: "50px" }, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: /* @__PURE__ */ f(Di, { disabled: w, checked: y, onChange: _, children: n.t("image-position.moveObjectWithText") }) }) })
1802
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSubtitle), children: /* @__PURE__ */ w("div", { children: n.t("image-position.options") }) }) }),
1803
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, style: { marginBottom: "50px" }, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: /* @__PURE__ */ w(Li, { disabled: v, checked: P, onChange: S, children: n.t("image-position.moveObjectWithText") }) }) })
1783
1804
  ] });
1784
- }, Je = 0, en = 100, Qi = (i) => {
1785
- const e = we(z), n = we(ln), t = we(Ie), r = we(ee), o = we(K), { drawings: s } = i, a = s[0];
1805
+ }, en = 0, nn = 100, lr = (i) => {
1806
+ const e = ve($), n = ve(mn), t = ve(Ie), r = ve(J), o = ve(q), { drawings: s } = i, a = s[0];
1786
1807
  if (a == null)
1787
1808
  return null;
1788
1809
  const { unitId: d } = a, c = o.getUniverDocInstance(d), l = r.getRenderById(d);
1789
1810
  if ((l == null ? void 0 : l.scene) == null)
1790
1811
  return null;
1791
- const [g, p] = re(!0), [h, v] = re(!0), [w, S] = re(!0), [O, D] = re(ue.INLINE), [T, M] = re(""), [y, E] = re({
1812
+ const [g, f] = oe(!0), [u, h] = oe(!0), [v, I] = oe(!0), [O, C] = oe(ue.INLINE), [T, M] = oe(""), [P, N] = oe({
1792
1813
  distT: 0,
1793
1814
  distL: 0,
1794
1815
  distB: 0,
1795
1816
  distR: 0
1796
- }), [U, N] = re(!0);
1797
- function I(_) {
1798
- D(_);
1799
- const C = t.getFocusDrawings();
1800
- if (C.length === 0)
1817
+ }), [B, E] = oe(!0);
1818
+ function _(S) {
1819
+ C(S);
1820
+ const D = t.getFocusDrawings();
1821
+ if (D.length === 0)
1801
1822
  return;
1802
- const { unitId: R, subUnitId: P } = C[0], B = C.map(({ unitId: k, subUnitId: b, drawingId: A }) => ({
1823
+ const { unitId: R, subUnitId: y } = D[0], U = D.map(({ unitId: k, subUnitId: b, drawingId: A }) => ({
1803
1824
  unitId: k,
1804
1825
  subUnitId: b,
1805
1826
  drawingId: A
1806
1827
  }));
1807
- e.executeCommand(Qn.id, {
1828
+ e.executeCommand(lt.id, {
1808
1829
  unitId: R,
1809
- subUnitId: P,
1810
- drawings: B,
1811
- wrappingStyle: _
1830
+ subUnitId: y,
1831
+ drawings: U,
1832
+ wrappingStyle: S
1812
1833
  });
1813
1834
  }
1814
- function L(_) {
1815
- M(_);
1816
- const C = t.getFocusDrawings();
1817
- if (C.length === 0)
1835
+ function L(S) {
1836
+ M(S);
1837
+ const D = t.getFocusDrawings();
1838
+ if (D.length === 0)
1818
1839
  return;
1819
- const R = C.map((P) => ({
1820
- unitId: P.unitId,
1821
- subUnitId: P.subUnitId,
1822
- drawingId: P.drawingId
1840
+ const R = D.map((y) => ({
1841
+ unitId: y.unitId,
1842
+ subUnitId: y.subUnitId,
1843
+ drawingId: y.drawingId
1823
1844
  }));
1824
- e.executeCommand(et.id, {
1825
- unitId: C[0].unitId,
1826
- subUnitId: C[0].unitId,
1845
+ e.executeCommand(mt.id, {
1846
+ unitId: D[0].unitId,
1847
+ subUnitId: D[0].unitId,
1827
1848
  drawings: R,
1828
- wrapText: _
1849
+ wrapText: S
1829
1850
  });
1830
1851
  }
1831
- function W(_, C) {
1832
- if (_ == null)
1852
+ function G(S, D) {
1853
+ if (S == null)
1833
1854
  return;
1834
- const R = { ...y, [C]: _ };
1835
- E(R);
1836
- const P = t.getFocusDrawings();
1837
- if (P.length === 0)
1855
+ const R = { ...P, [D]: S };
1856
+ N(R);
1857
+ const y = t.getFocusDrawings();
1858
+ if (y.length === 0)
1838
1859
  return;
1839
- const B = P.map((k) => ({
1860
+ const U = y.map((k) => ({
1840
1861
  unitId: k.unitId,
1841
1862
  subUnitId: k.subUnitId,
1842
1863
  drawingId: k.drawingId
1843
1864
  }));
1844
- e.executeCommand(Jn.id, {
1845
- unitId: P[0].unitId,
1846
- subUnitId: P[0].unitId,
1847
- drawings: B,
1865
+ e.executeCommand(gt.id, {
1866
+ unitId: y[0].unitId,
1867
+ subUnitId: y[0].unitId,
1868
+ drawings: U,
1848
1869
  dist: {
1849
- [C]: _
1870
+ [D]: S
1850
1871
  }
1851
1872
  });
1852
1873
  }
1853
1874
  function x() {
1854
- const _ = t.getFocusDrawings();
1855
- _.length !== 0 && G(_[0]);
1875
+ const S = t.getFocusDrawings();
1876
+ S.length !== 0 && V(S[0]);
1856
1877
  }
1857
- function G(_) {
1878
+ function V(S) {
1858
1879
  var Z, ae;
1859
- const C = (ae = (Z = c == null ? void 0 : c.getSnapshot()) == null ? void 0 : Z.drawings) == null ? void 0 : ae[_.drawingId];
1860
- if (C == null)
1880
+ const D = (ae = (Z = c == null ? void 0 : c.getSnapshot()) == null ? void 0 : Z.drawings) == null ? void 0 : ae[S.drawingId];
1881
+ if (D == null)
1861
1882
  return;
1862
1883
  const {
1863
1884
  distT: R = 0,
1864
- distL: P = 0,
1865
- distB: B = 0,
1885
+ distL: y = 0,
1886
+ distB: U = 0,
1866
1887
  distR: k = 0,
1867
- layoutType: b = H.INLINE,
1868
- behindDoc: A = oe.FALSE,
1869
- wrapText: $ = $e.BOTH_SIDES
1870
- } = C;
1871
- if (E({
1888
+ layoutType: b = W.INLINE,
1889
+ behindDoc: A = se.FALSE,
1890
+ wrapText: z = Xe.BOTH_SIDES
1891
+ } = D;
1892
+ if (N({
1872
1893
  distT: R,
1873
- distL: P,
1874
- distB: B,
1894
+ distL: y,
1895
+ distB: U,
1875
1896
  distR: k
1876
- }), M($), p(b !== H.WRAP_SQUARE), b === H.WRAP_NONE || b === H.INLINE ? v(!0) : v(!1), b === H.WRAP_NONE || b === H.INLINE || b === H.WRAP_TOP_AND_BOTTOM ? S(!0) : S(!1), b === H.WRAP_NONE)
1877
- A === oe.TRUE ? D(ue.BEHIND_TEXT) : D(ue.IN_FRONT_OF_TEXT);
1897
+ }), M(z), f(b !== W.WRAP_SQUARE), b === W.WRAP_NONE || b === W.INLINE ? h(!0) : h(!1), b === W.WRAP_NONE || b === W.INLINE || b === W.WRAP_TOP_AND_BOTTOM ? I(!0) : I(!1), b === W.WRAP_NONE)
1898
+ A === se.TRUE ? C(ue.BEHIND_TEXT) : C(ue.IN_FRONT_OF_TEXT);
1878
1899
  else
1879
1900
  switch (b) {
1880
- case H.INLINE:
1881
- D(ue.INLINE);
1901
+ case W.INLINE:
1902
+ C(ue.INLINE);
1882
1903
  break;
1883
- case H.WRAP_SQUARE:
1884
- D(ue.WRAP_SQUARE);
1904
+ case W.WRAP_SQUARE:
1905
+ C(ue.WRAP_SQUARE);
1885
1906
  break;
1886
- case H.WRAP_TOP_AND_BOTTOM:
1887
- D(ue.WRAP_TOP_AND_BOTTOM);
1907
+ case W.WRAP_TOP_AND_BOTTOM:
1908
+ C(ue.WRAP_TOP_AND_BOTTOM);
1888
1909
  break;
1889
1910
  default:
1890
1911
  throw new Error(`Unsupported layout type: ${b}`);
1891
1912
  }
1892
1913
  }
1893
- return Sn(() => {
1914
+ return Tn(() => {
1894
1915
  x();
1895
- const _ = t.focus$.subscribe((R) => {
1916
+ const S = t.focus$.subscribe((R) => {
1896
1917
  if (R.length === 0) {
1897
- N(!1);
1918
+ E(!1);
1898
1919
  return;
1899
1920
  }
1900
- N(!0), G(R[0]);
1901
- }), C = e.onCommandExecuted(async (R) => {
1902
- R.id === J.id && x();
1921
+ E(!0), V(R[0]);
1922
+ }), D = e.onCommandExecuted(async (R) => {
1923
+ R.id === ne.id && x();
1903
1924
  });
1904
1925
  return () => {
1905
- _.unsubscribe(), C.dispose();
1926
+ S.unsubscribe(), D.dispose();
1906
1927
  };
1907
- }, []), /* @__PURE__ */ X("div", { className: j(u.imageCommonPanelGrid, u.imageCommonPanelBorder), style: { display: U ? "block" : "none" }, children: [
1908
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelTitle), children: /* @__PURE__ */ f("div", { children: n.t("image-text-wrap.title") }) }) }),
1909
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSubtitle), children: /* @__PURE__ */ f("div", { children: n.t("image-text-wrap.wrappingStyle") }) }) }),
1910
- /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelRow), children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn), children: /* @__PURE__ */ X(kn, { value: O, onChange: I, direction: "vertical", children: [
1911
- /* @__PURE__ */ f(Pe, { value: ue.INLINE, children: n.t("image-text-wrap.inline") }),
1912
- /* @__PURE__ */ f(Pe, { value: ue.WRAP_SQUARE, children: n.t("image-text-wrap.square") }),
1913
- /* @__PURE__ */ f(Pe, { value: ue.WRAP_TOP_AND_BOTTOM, children: n.t("image-text-wrap.topAndBottom") }),
1914
- /* @__PURE__ */ f(Pe, { value: ue.BEHIND_TEXT, children: n.t("image-text-wrap.behindText") }),
1915
- /* @__PURE__ */ f(Pe, { value: ue.IN_FRONT_OF_TEXT, children: n.t("image-text-wrap.inFrontText") })
1928
+ }, []), /* @__PURE__ */ K("div", { className: j(p.imageCommonPanelGrid, p.imageCommonPanelBorder), style: { display: B ? "block" : "none" }, children: [
1929
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelTitle), children: /* @__PURE__ */ w("div", { children: n.t("image-text-wrap.title") }) }) }),
1930
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSubtitle), children: /* @__PURE__ */ w("div", { children: n.t("image-text-wrap.wrappingStyle") }) }) }),
1931
+ /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelRow), children: /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn), children: /* @__PURE__ */ K($n, { value: O, onChange: _, direction: "vertical", children: [
1932
+ /* @__PURE__ */ w(be, { value: ue.INLINE, children: n.t("image-text-wrap.inline") }),
1933
+ /* @__PURE__ */ w(be, { value: ue.WRAP_SQUARE, children: n.t("image-text-wrap.square") }),
1934
+ /* @__PURE__ */ w(be, { value: ue.WRAP_TOP_AND_BOTTOM, children: n.t("image-text-wrap.topAndBottom") }),
1935
+ /* @__PURE__ */ w(be, { value: ue.BEHIND_TEXT, children: n.t("image-text-wrap.behindText") }),
1936
+ /* @__PURE__ */ w(be, { value: ue.IN_FRONT_OF_TEXT, children: n.t("image-text-wrap.inFrontText") })
1916
1937
  ] }) }) }),
1917
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSubtitle), children: /* @__PURE__ */ f("div", { children: n.t("image-text-wrap.wrapText") }) }) }),
1918
- /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelRow), children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn), children: /* @__PURE__ */ X(kn, { disabled: g, value: T, onChange: L, direction: "horizontal", children: [
1919
- /* @__PURE__ */ f(Pe, { value: $e.BOTH_SIDES, children: n.t("image-text-wrap.bothSide") }),
1920
- /* @__PURE__ */ f(Pe, { value: $e.LEFT, children: n.t("image-text-wrap.leftOnly") }),
1921
- /* @__PURE__ */ f(Pe, { value: $e.RIGHT, children: n.t("image-text-wrap.rightOnly") })
1938
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSubtitle), children: /* @__PURE__ */ w("div", { children: n.t("image-text-wrap.wrapText") }) }) }),
1939
+ /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelRow), children: /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn), children: /* @__PURE__ */ K($n, { disabled: g, value: T, onChange: L, direction: "horizontal", children: [
1940
+ /* @__PURE__ */ w(be, { value: Xe.BOTH_SIDES, children: n.t("image-text-wrap.bothSide") }),
1941
+ /* @__PURE__ */ w(be, { value: Xe.LEFT, children: n.t("image-text-wrap.leftOnly") }),
1942
+ /* @__PURE__ */ w(be, { value: Xe.RIGHT, children: n.t("image-text-wrap.rightOnly") })
1922
1943
  ] }) }) }),
1923
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSubtitle), children: /* @__PURE__ */ f("div", { children: n.t("image-text-wrap.distanceFromText") }) }) }),
1924
- /* @__PURE__ */ X("div", { className: u.imageCommonPanelRow, children: [
1925
- /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSpan2), children: /* @__PURE__ */ X("label", { children: [
1926
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: n.t("image-text-wrap.top") }) }),
1927
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: /* @__PURE__ */ f(
1928
- ke,
1944
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSubtitle), children: /* @__PURE__ */ w("div", { children: n.t("image-text-wrap.distanceFromText") }) }) }),
1945
+ /* @__PURE__ */ K("div", { className: p.imageCommonPanelRow, children: [
1946
+ /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
1947
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: n.t("image-text-wrap.top") }) }),
1948
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: /* @__PURE__ */ w(
1949
+ Fe,
1929
1950
  {
1930
- min: Je,
1931
- max: en,
1932
- disabled: h,
1951
+ min: en,
1952
+ max: nn,
1953
+ disabled: u,
1933
1954
  precision: 1,
1934
- value: y.distT,
1935
- onChange: (_) => {
1936
- W(_, "distT");
1955
+ value: P.distT,
1956
+ onChange: (S) => {
1957
+ G(S, "distT");
1937
1958
  },
1938
- className: u.imageCommonPanelInput
1959
+ className: p.imageCommonPanelInput
1939
1960
  }
1940
1961
  ) }) })
1941
1962
  ] }) }),
1942
- /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSpan2), children: /* @__PURE__ */ X("label", { children: [
1943
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: n.t("image-text-wrap.left") }) }),
1944
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: /* @__PURE__ */ f(
1945
- ke,
1963
+ /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
1964
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: n.t("image-text-wrap.left") }) }),
1965
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: /* @__PURE__ */ w(
1966
+ Fe,
1946
1967
  {
1947
- min: Je,
1948
- max: en,
1949
- disabled: w,
1968
+ min: en,
1969
+ max: nn,
1970
+ disabled: v,
1950
1971
  precision: 1,
1951
- value: y.distL,
1952
- onChange: (_) => {
1953
- W(_, "distL");
1972
+ value: P.distL,
1973
+ onChange: (S) => {
1974
+ G(S, "distL");
1954
1975
  },
1955
- className: u.imageCommonPanelInput
1976
+ className: p.imageCommonPanelInput
1956
1977
  }
1957
1978
  ) }) })
1958
1979
  ] }) })
1959
1980
  ] }),
1960
- /* @__PURE__ */ X("div", { className: u.imageCommonPanelRow, children: [
1961
- /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSpan2), children: /* @__PURE__ */ X("label", { children: [
1962
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: n.t("image-text-wrap.bottom") }) }),
1963
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: /* @__PURE__ */ f(
1964
- ke,
1981
+ /* @__PURE__ */ K("div", { className: p.imageCommonPanelRow, children: [
1982
+ /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
1983
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: n.t("image-text-wrap.bottom") }) }),
1984
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: /* @__PURE__ */ w(
1985
+ Fe,
1965
1986
  {
1966
- min: Je,
1967
- max: en,
1968
- disabled: h,
1987
+ min: en,
1988
+ max: nn,
1989
+ disabled: u,
1969
1990
  precision: 1,
1970
- value: y.distB,
1971
- onChange: (_) => {
1972
- W(_, "distB");
1991
+ value: P.distB,
1992
+ onChange: (S) => {
1993
+ G(S, "distB");
1973
1994
  },
1974
- className: u.imageCommonPanelInput
1995
+ className: p.imageCommonPanelInput
1975
1996
  }
1976
1997
  ) }) })
1977
1998
  ] }) }),
1978
- /* @__PURE__ */ f("div", { className: j(u.imageCommonPanelColumn, u.imageCommonPanelSpan2), children: /* @__PURE__ */ X("label", { children: [
1979
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: n.t("image-text-wrap.right") }) }),
1980
- /* @__PURE__ */ f("div", { className: u.imageCommonPanelRow, children: /* @__PURE__ */ f("div", { className: u.imageCommonPanelColumn, children: /* @__PURE__ */ f(
1981
- ke,
1999
+ /* @__PURE__ */ w("div", { className: j(p.imageCommonPanelColumn, p.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
2000
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: n.t("image-text-wrap.right") }) }),
2001
+ /* @__PURE__ */ w("div", { className: p.imageCommonPanelRow, children: /* @__PURE__ */ w("div", { className: p.imageCommonPanelColumn, children: /* @__PURE__ */ w(
2002
+ Fe,
1982
2003
  {
1983
- min: Je,
1984
- max: en,
1985
- disabled: w,
2004
+ min: en,
2005
+ max: nn,
2006
+ disabled: v,
1986
2007
  precision: 1,
1987
- value: y.distR,
1988
- onChange: (_) => {
1989
- W(_, "distR");
2008
+ value: P.distR,
2009
+ onChange: (S) => {
2010
+ G(S, "distR");
1990
2011
  },
1991
- className: u.imageCommonPanelInput
2012
+ className: p.imageCommonPanelInput
1992
2013
  }
1993
2014
  ) }) })
1994
2015
  ] }) })
1995
2016
  ] })
1996
2017
  ] });
1997
- }, Ji = () => {
1998
- const i = we(Ie), e = i.getFocusDrawings(), [n, t] = re(e);
1999
- return Sn(() => {
2018
+ }, gr = () => {
2019
+ const i = ve(Ie), e = i.getFocusDrawings(), [n, t] = oe(e);
2020
+ return Tn(() => {
2000
2021
  const r = i.focus$.subscribe((o) => {
2001
2022
  t(o);
2002
2023
  });
2003
2024
  return () => {
2004
2025
  r.unsubscribe();
2005
2026
  };
2006
- }, []), !!(n != null && n.length) && /* @__PURE__ */ X("div", { className: u.imageCommonPanel, children: [
2007
- /* @__PURE__ */ f(Xt, { drawings: n, hasAlign: !1, hasCropper: !1, hasGroup: !1, hasTransform: !1 }),
2008
- /* @__PURE__ */ f(Qi, { drawings: n }),
2009
- /* @__PURE__ */ f(Zi, { drawings: n })
2027
+ }, []), !!(n != null && n.length) && /* @__PURE__ */ K("div", { className: p.imageCommonPanel, children: [
2028
+ /* @__PURE__ */ w(oi, { drawings: n, hasAlign: !1, hasCropper: !1, hasGroup: !1, hasTransform: !1 }),
2029
+ /* @__PURE__ */ w(lr, { drawings: n }),
2030
+ /* @__PURE__ */ w(dr, { drawings: n })
2010
2031
  ] });
2011
- }, ht = "addition-and-subtraction-single", pt = "doc.menu.image", wt = gt.id, er = (i) => {
2012
- const e = i.get(_n), n = i.get(K);
2013
- return new Ci((t) => {
2032
+ }, yt = "addition-and-subtraction-single", Pt = "doc.menu.image", bt = Dt.id, mr = (i) => {
2033
+ const e = i.get(On), n = i.get(q);
2034
+ return new Ni((t) => {
2014
2035
  const r = e.textSelection$.subscribe(() => {
2015
2036
  var s;
2016
2037
  const o = e.getActiveTextRange();
2017
2038
  if (o) {
2018
2039
  const { segmentId: a, startOffset: d, endOffset: c } = o, l = n.getCurrentUniverDocInstance(), m = (s = l == null ? void 0 : l.getSelfOrHeaderFooterModel(a).getBody()) == null ? void 0 : s.tables;
2019
2040
  if (m && m.length && m.some((g) => {
2020
- const { startIndex: p, endIndex: h } = g;
2021
- return d >= p && d < h || c >= p && c < h;
2041
+ const { startIndex: f, endIndex: u } = g;
2042
+ return d >= f && d < u || c >= f && c < u;
2022
2043
  })) {
2023
2044
  t.next(!0);
2024
2045
  return;
@@ -2032,133 +2053,133 @@ const gt = {
2032
2053
  return () => r.unsubscribe();
2033
2054
  });
2034
2055
  };
2035
- function nr(i) {
2056
+ function ur(i) {
2036
2057
  return {
2037
- id: pt,
2038
- type: qn.SUBITEMS,
2039
- icon: ht,
2058
+ id: Pt,
2059
+ type: nt.SUBITEMS,
2060
+ icon: yt,
2040
2061
  tooltip: "docImage.title",
2041
- disabled$: er(i),
2042
- hidden$: zn(i, be.UNIVER_DOC, void 0, In)
2062
+ disabled$: mr(i),
2063
+ hidden$: et(i, Se.UNIVER_DOC, void 0, Cn)
2043
2064
  };
2044
2065
  }
2045
- function tr(i) {
2066
+ function fr(i) {
2046
2067
  return {
2047
- id: wt,
2068
+ id: bt,
2048
2069
  title: "docImage.upload.float",
2049
- type: qn.BUTTON,
2050
- hidden$: zn(i, be.UNIVER_DOC, void 0, In)
2070
+ type: nt.BUTTON,
2071
+ hidden$: et(i, Se.UNIVER_DOC, void 0, Cn)
2051
2072
  };
2052
2073
  }
2053
- const ir = {
2054
- [ci.LAYOUT]: {
2055
- [pt]: {
2074
+ const hr = {
2075
+ [_i.LAYOUT]: {
2076
+ [Pt]: {
2056
2077
  order: 0,
2057
- menuItemFactory: nr,
2058
- [wt]: {
2078
+ menuItemFactory: ur,
2079
+ [bt]: {
2059
2080
  order: 0,
2060
- menuItemFactory: tr
2081
+ menuItemFactory: fr
2061
2082
  }
2062
2083
  }
2063
2084
  }
2064
2085
  };
2065
- function Ye(i) {
2066
- return i.getContextValue(Nt) && i.getContextValue(tn);
2086
+ function Ze(i) {
2087
+ return i.getContextValue(Ht) && i.getContextValue(rn);
2067
2088
  }
2068
- const rr = {
2069
- id: Ke.id,
2089
+ const pr = {
2090
+ id: Ye.id,
2070
2091
  description: "shortcut.doc.drawing-move-down",
2071
2092
  group: "4_doc-drawing-view",
2072
2093
  binding: He.ARROW_DOWN,
2073
2094
  priority: 100,
2074
- preconditions: Ye,
2095
+ preconditions: Ze,
2075
2096
  staticParameters: {
2076
2097
  direction: fe.DOWN
2077
2098
  }
2078
- }, or = {
2079
- id: Ke.id,
2099
+ }, wr = {
2100
+ id: Ye.id,
2080
2101
  description: "shortcut.doc.drawing-move-up",
2081
2102
  group: "4_doc-drawing-view",
2082
2103
  binding: He.ARROW_UP,
2083
2104
  priority: 100,
2084
- preconditions: Ye,
2105
+ preconditions: Ze,
2085
2106
  staticParameters: {
2086
2107
  direction: fe.UP
2087
2108
  }
2088
- }, sr = {
2089
- id: Ke.id,
2109
+ }, vr = {
2110
+ id: Ye.id,
2090
2111
  description: "shortcut.doc.drawing-move-left",
2091
2112
  group: "4_doc-drawing-view",
2092
2113
  binding: He.ARROW_LEFT,
2093
2114
  priority: 100,
2094
- preconditions: Ye,
2115
+ preconditions: Ze,
2095
2116
  staticParameters: {
2096
2117
  direction: fe.LEFT
2097
2118
  }
2098
- }, ar = {
2099
- id: Ke.id,
2119
+ }, Ir = {
2120
+ id: Ye.id,
2100
2121
  description: "shortcut.doc.drawing-move-right",
2101
2122
  group: "4_doc-drawing-view",
2102
2123
  binding: He.ARROW_RIGHT,
2103
2124
  priority: 100,
2104
- preconditions: Ye,
2125
+ preconditions: Ze,
2105
2126
  staticParameters: {
2106
2127
  direction: fe.RIGHT
2107
2128
  }
2108
- }, cr = {
2109
- id: st.id,
2129
+ }, _r = {
2130
+ id: vt.id,
2110
2131
  description: "shortcut.doc.drawing-delete",
2111
2132
  group: "4_doc-drawing-view",
2112
2133
  // when focusing on any other input tag do not trigger this shortcut
2113
- preconditions: Ye,
2134
+ preconditions: Ze,
2114
2135
  binding: He.DELETE,
2115
2136
  mac: He.BACKSPACE
2116
2137
  };
2117
- var dr = Object.getOwnPropertyDescriptor, lr = (i, e, n, t) => {
2118
- for (var r = t > 1 ? void 0 : t ? dr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2138
+ var Sr = Object.getOwnPropertyDescriptor, Dr = (i, e, n, t) => {
2139
+ for (var r = t > 1 ? void 0 : t ? Sr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2119
2140
  (s = i[o]) && (r = s(r) || r);
2120
2141
  return r;
2121
- }, nn = (i, e) => (n, t) => e(n, t, i);
2122
- let an = class extends Xe {
2142
+ }, tn = (i, e) => (n, t) => e(n, t, i);
2143
+ let cn = class extends Ge {
2123
2144
  constructor(i, e, n, t) {
2124
2145
  super(), this._componentManager = i, this._menuManagerService = e, this._commandService = n, this._shortcutService = t, this._init();
2125
2146
  }
2126
2147
  _initCustomComponents() {
2127
2148
  const i = this._componentManager;
2128
- this.disposeWithMe(i.register(ht, ot)), this.disposeWithMe(i.register(mt, Ji));
2149
+ this.disposeWithMe(i.register(yt, wt)), this.disposeWithMe(i.register(Ct, gr));
2129
2150
  }
2130
2151
  _initMenus() {
2131
- this._menuManagerService.mergeMenu(ir);
2152
+ this._menuManagerService.mergeMenu(hr);
2132
2153
  }
2133
2154
  _initCommands() {
2134
2155
  [
2156
+ Dt,
2157
+ Pn,
2158
+ lt,
2135
2159
  gt,
2136
- ct,
2137
- Qn,
2138
- Jn,
2139
- et,
2140
- qe,
2141
- nt,
2142
- tt,
2143
- Cn,
2160
+ mt,
2161
+ Ke,
2144
2162
  ut,
2145
- Wi,
2146
2163
  ft,
2147
- at,
2148
- lt,
2149
- Ke,
2150
- st,
2151
- dt
2164
+ yn,
2165
+ Ot,
2166
+ Ji,
2167
+ Tt,
2168
+ It,
2169
+ St,
2170
+ Ye,
2171
+ vt,
2172
+ _t
2152
2173
  ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
2153
2174
  }
2154
2175
  _initShortcuts() {
2155
2176
  [
2156
2177
  // sheet drawing shortcuts
2157
- rr,
2158
- or,
2159
- sr,
2160
- ar,
2161
- cr
2178
+ pr,
2179
+ wr,
2180
+ vr,
2181
+ Ir,
2182
+ _r
2162
2183
  ].forEach((i) => {
2163
2184
  this.disposeWithMe(this._shortcutService.registerShortcut(i));
2164
2185
  });
@@ -2167,25 +2188,235 @@ let an = class extends Xe {
2167
2188
  this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
2168
2189
  }
2169
2190
  };
2170
- an = lr([
2171
- nn(0, ve(di)),
2172
- nn(1, li),
2173
- nn(2, z),
2174
- nn(3, gi)
2175
- ], an);
2176
- var gr = Object.getOwnPropertyDescriptor, mr = (i, e, n, t) => {
2177
- for (var r = t > 1 ? void 0 : t ? gr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2191
+ cn = Dr([
2192
+ tn(0, pe(Si)),
2193
+ tn(1, Di),
2194
+ tn(2, $),
2195
+ tn(3, Ci)
2196
+ ], cn);
2197
+ var Cr = Object.getOwnPropertyDescriptor, Or = (i, e, n, t) => {
2198
+ for (var r = t > 1 ? void 0 : t ? Cr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2178
2199
  (s = i[o]) && (r = s(r) || r);
2179
2200
  return r;
2180
- }, je = (i, e) => (n, t) => e(n, t, i);
2181
- let cn = class extends Et {
2201
+ }, ke = (i, e) => (n, t) => e(n, t, i);
2202
+ function vn(i, e) {
2203
+ const { top: n, left: t, width: r, height: o, angle: s, opacity: a } = i, d = e.scene, c = d.getViewport(it.VIEW_MAIN), { viewportScrollX: l, viewportScrollY: m } = c, { scaleX: g, scaleY: f } = d.getAncestorScale();
2204
+ return {
2205
+ startX: (t - l) * g,
2206
+ startY: (n - m) * f,
2207
+ endX: (t + r - l) * g,
2208
+ endY: (n + o - m) * f,
2209
+ width: r,
2210
+ height: o,
2211
+ rotate: s,
2212
+ absolute: {
2213
+ left: !1,
2214
+ top: !1
2215
+ },
2216
+ opacity: a != null ? a : 1
2217
+ };
2218
+ }
2219
+ let dn = class extends Ge {
2220
+ constructor(e, n, t, r, o, s) {
2221
+ super();
2222
+ _e(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
2223
+ this._renderManagerService = e, this._drawingManagerService = n, this._drawingRenderService = t, this._canvasFloatDomService = r, this._univerInstanceService = o, this._commandService = s, this._initialize();
2224
+ }
2225
+ dispose() {
2226
+ super.dispose();
2227
+ }
2228
+ _initialize() {
2229
+ this._drawingAddRemoveListener(), this._initScrollAndZoomEvent();
2230
+ }
2231
+ _getSceneAndTransformerByDrawingSearch(e) {
2232
+ if (e == null)
2233
+ return;
2234
+ const n = this._renderManagerService.getRenderById(e);
2235
+ if (n == null)
2236
+ return null;
2237
+ const t = n.scene, r = t.getTransformerByCreate();
2238
+ return { scene: t, transformer: r, renderUnit: n, canvas: n.engine.getCanvasElement() };
2239
+ }
2240
+ _drawingAddRemoveListener() {
2241
+ this.disposeWithMe(
2242
+ this._drawingManagerService.add$.subscribe((e) => {
2243
+ this._insertRects(e);
2244
+ })
2245
+ ), this.disposeWithMe(
2246
+ this._drawingManagerService.remove$.subscribe((e) => {
2247
+ e.forEach((n) => {
2248
+ this._removeDom(n.drawingId);
2249
+ });
2250
+ })
2251
+ );
2252
+ }
2253
+ _insertRects(e) {
2254
+ e.forEach(async (n) => {
2255
+ const { unitId: t } = n, r = this._getSceneAndTransformerByDrawingSearch(t);
2256
+ if (r == null)
2257
+ return;
2258
+ const o = this._drawingManagerService.getDrawingByParam(n);
2259
+ if (o == null)
2260
+ return;
2261
+ const s = await this._drawingRenderService.renderFloatDom(o, r.scene);
2262
+ if (!(s == null || s.length === 0))
2263
+ for (const a of s) {
2264
+ this._addHoverForRect(a);
2265
+ const d = new Gt(), c = vn(a, r.renderUnit), l = new ot(c), m = r.canvas, g = o.data, f = {
2266
+ dispose: d,
2267
+ rect: a,
2268
+ position$: l,
2269
+ unitId: t
2270
+ };
2271
+ this._canvasFloatDomService.addFloatDom({
2272
+ position$: l,
2273
+ id: o.drawingId,
2274
+ componentKey: o.componentKey,
2275
+ onPointerDown: (h) => {
2276
+ m.dispatchEvent(new PointerEvent(h.type, h));
2277
+ },
2278
+ onPointerMove: (h) => {
2279
+ m.dispatchEvent(new PointerEvent(h.type, h));
2280
+ },
2281
+ onPointerUp: (h) => {
2282
+ m.dispatchEvent(new PointerEvent(h.type, h));
2283
+ },
2284
+ onWheel: (h) => {
2285
+ m.dispatchEvent(new WheelEvent(h.type, h));
2286
+ },
2287
+ data: g,
2288
+ unitId: t
2289
+ });
2290
+ const u = a.onTransformChange$.subscribeEvent(() => {
2291
+ const h = vn(a, r.renderUnit);
2292
+ l.next(
2293
+ h
2294
+ );
2295
+ });
2296
+ d.add(() => {
2297
+ this._canvasFloatDomService.removeFloatDom(o.drawingId);
2298
+ }), u && d.add(u), this._domLayerInfoMap.set(o.drawingId, f);
2299
+ }
2300
+ });
2301
+ }
2302
+ _addHoverForRect(e) {
2303
+ this.disposeWithMe(
2304
+ Oe(
2305
+ e.onPointerEnter$.subscribeEvent(() => {
2306
+ e.cursor = Bn.GRAB;
2307
+ })
2308
+ )
2309
+ ), this.disposeWithMe(
2310
+ Oe(
2311
+ e.onPointerLeave$.subscribeEvent(() => {
2312
+ e.cursor = Bn.DEFAULT;
2313
+ })
2314
+ )
2315
+ );
2316
+ }
2317
+ _removeDom(e) {
2318
+ const n = this._domLayerInfoMap.get(e);
2319
+ if (!n)
2320
+ return;
2321
+ const { unitId: t } = n;
2322
+ this._domLayerInfoMap.delete(e), n.dispose.dispose();
2323
+ const r = this._getSceneAndTransformerByDrawingSearch(t);
2324
+ r && r.scene.removeObject(n.rect);
2325
+ }
2326
+ _initScrollAndZoomEvent() {
2327
+ const e = (n) => {
2328
+ const t = this._getSceneAndTransformerByDrawingSearch(n);
2329
+ t && this._domLayerInfoMap.forEach((r) => {
2330
+ if (r.unitId !== n) return;
2331
+ const o = vn(r.rect, t.renderUnit);
2332
+ r.position$.next(o);
2333
+ });
2334
+ };
2335
+ this.disposeWithMe(
2336
+ this._univerInstanceService.getCurrentTypeOfUnit$(Se.UNIVER_DOC).pipe(
2337
+ Wn((n) => {
2338
+ if (!n) return null;
2339
+ const t = n.getUnitId(), r = this._renderManagerService.getRenderById(t);
2340
+ return r ? { render: r, unitId: t } : null;
2341
+ }),
2342
+ Ai(
2343
+ (n) => n ? Qn(n.render.scene.getViewport(it.VIEW_MAIN).onScrollAfter$).pipe(Wn(() => ({ unitId: n.unitId }))) : xi(null)
2344
+ )
2345
+ ).subscribe((n) => {
2346
+ if (!n) return;
2347
+ const { unitId: t } = n;
2348
+ e(t);
2349
+ })
2350
+ ), this.disposeWithMe(this._commandService.onCommandExecuted((n) => {
2351
+ if (n.id === rt.id) {
2352
+ const t = n.params, { unitId: r } = t;
2353
+ e(r);
2354
+ }
2355
+ }));
2356
+ }
2357
+ insertFloatDom(e, n) {
2358
+ var h, v, I;
2359
+ const t = this._univerInstanceService.getCurrentUnitOfType(Se.UNIVER_DOC);
2360
+ if (!t) return !1;
2361
+ const r = this._getSceneAndTransformerByDrawingSearch(t.getUnitId());
2362
+ if (!r) return !1;
2363
+ const a = (h = r.renderUnit.with(te).getSkeleton().getSkeletonData()) == null ? void 0 : h.pages[0];
2364
+ if (!a) return !1;
2365
+ const { pageWidth: d, marginLeft: c, marginRight: l } = a, m = d - c - l, g = {
2366
+ size: {
2367
+ width: (v = n.width) != null ? v : m,
2368
+ height: n.height
2369
+ },
2370
+ positionH: {
2371
+ relativeFrom: ee.PAGE,
2372
+ posOffset: 0
2373
+ },
2374
+ positionV: {
2375
+ relativeFrom: H.PAGE,
2376
+ posOffset: 0
2377
+ },
2378
+ angle: 0
2379
+ }, f = (I = n.drawingId) != null ? I : Vt(), u = {
2380
+ unitId: t.getUnitId(),
2381
+ drawings: [
2382
+ {
2383
+ drawingId: f,
2384
+ drawingType: Dn.DRAWING_DOM,
2385
+ subUnitId: t.getUnitId(),
2386
+ unitId: t.getUnitId(),
2387
+ ...e,
2388
+ title: "",
2389
+ description: "",
2390
+ docTransform: g,
2391
+ layoutType: W.INLINE,
2392
+ transform: tt(g)
2393
+ }
2394
+ ]
2395
+ };
2396
+ return this._commandService.syncExecuteCommand(Pn.id, u), f;
2397
+ }
2398
+ };
2399
+ dn = Or([
2400
+ ke(0, J),
2401
+ ke(1, Ie),
2402
+ ke(2, pe(si)),
2403
+ ke(3, pe(Oi)),
2404
+ ke(4, q),
2405
+ ke(5, $)
2406
+ ], dn);
2407
+ var Tr = Object.getOwnPropertyDescriptor, yr = (i, e, n, t) => {
2408
+ for (var r = t > 1 ? void 0 : t ? Tr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2409
+ (s = i[o]) && (r = s(r) || r);
2410
+ return r;
2411
+ }, ze = (i, e) => (n, t) => e(n, t, i);
2412
+ let ln = class extends jt {
2182
2413
  constructor(e, n, t, r, o) {
2183
2414
  super();
2184
- Ce(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
2415
+ _e(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
2185
2416
  this._drawingManagerService = e, this._canvasPopManagerService = n, this._renderManagerService = t, this._univerInstanceService = r, this._contextService = o, this._init();
2186
2417
  }
2187
2418
  _init() {
2188
- this._univerInstanceService.getCurrentTypeOfUnit$(be.UNIVER_DOC).pipe(xn(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(be.UNIVER_DOC).pipe(xn(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(be.UNIVER_DOC).forEach((e) => this._create(e));
2419
+ this._univerInstanceService.getCurrentTypeOfUnit$(Se.UNIVER_DOC).pipe(Hn(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(Se.UNIVER_DOC).pipe(Hn(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(Se.UNIVER_DOC).forEach((e) => this._create(e));
2189
2420
  }
2190
2421
  _dispose(e) {
2191
2422
  const n = e.getUnitId();
@@ -2200,7 +2431,7 @@ let cn = class extends Et {
2200
2431
  _hasCropObject(e) {
2201
2432
  const n = e.getAllObjects();
2202
2433
  for (const t of n)
2203
- if (t instanceof Kt)
2434
+ if (t instanceof ai)
2204
2435
  return !0;
2205
2436
  return !1;
2206
2437
  }
@@ -2215,12 +2446,12 @@ let cn = class extends Et {
2215
2446
  return;
2216
2447
  const r = [];
2217
2448
  this.disposeWithMe(
2218
- Le(
2449
+ Oe(
2219
2450
  t.createControl$.subscribe(() => {
2220
2451
  if (this._hasCropObject(n))
2221
2452
  return;
2222
2453
  const s = t.getSelectedObjectMap();
2223
- if (r.forEach((w) => w.dispose()), r.length = 0, s.size > 1)
2454
+ if (r.forEach((I) => I.dispose()), r.length = 0, s.size > 1)
2224
2455
  return;
2225
2456
  const a = s.values().next().value;
2226
2457
  if (!a)
@@ -2228,19 +2459,19 @@ let cn = class extends Et {
2228
2459
  const d = a.oKey, c = this._drawingManagerService.getDrawingOKey(d);
2229
2460
  if (!c)
2230
2461
  return;
2231
- const { unitId: l, subUnitId: m, drawingId: g } = c, p = this._canvasPopManagerService.attachPopupToObject(
2462
+ const { unitId: l, subUnitId: m, drawingId: g, drawingType: f } = c, u = this._canvasPopManagerService.attachPopupToObject(
2232
2463
  a,
2233
2464
  {
2234
- componentKey: Yt,
2465
+ componentKey: ci,
2235
2466
  direction: "horizontal",
2236
2467
  offset: [2, 0],
2237
2468
  extraProps: {
2238
- menuItems: this._getImageMenuItems(l, m, g)
2469
+ menuItems: this._getImageMenuItems(l, m, g, f)
2239
2470
  }
2240
2471
  },
2241
2472
  l
2242
2473
  );
2243
- r.push(this.disposeWithMe(p)), !this._drawingManagerService.getFocusDrawings().find((w) => w.unitId === l && w.subUnitId === m && w.drawingId === g) && this._drawingManagerService.focusDrawing([{
2474
+ r.push(this.disposeWithMe(u)), !this._drawingManagerService.getFocusDrawings().find((I) => I.unitId === l && I.subUnitId === m && I.drawingId === g) && this._drawingManagerService.focusDrawing([{
2244
2475
  unitId: l,
2245
2476
  subUnitId: m,
2246
2477
  drawingId: g
@@ -2248,45 +2479,45 @@ let cn = class extends Et {
2248
2479
  })
2249
2480
  )
2250
2481
  ), this.disposeWithMe(
2251
- Le(
2482
+ Oe(
2252
2483
  t.clearControl$.subscribe(() => {
2253
- r.forEach((s) => s.dispose()), r.length = 0, this._contextService.setContextValue(tn, !1), this._drawingManagerService.focusDrawing(null);
2484
+ r.forEach((s) => s.dispose()), r.length = 0, this._contextService.setContextValue(rn, !1), this._drawingManagerService.focusDrawing(null);
2254
2485
  })
2255
2486
  )
2256
2487
  ), this.disposeWithMe(
2257
- Le(
2488
+ Oe(
2258
2489
  t.changing$.subscribe(() => {
2259
2490
  r.forEach((s) => s.dispose()), r.length = 0;
2260
2491
  })
2261
2492
  )
2262
2493
  ), this.disposeWithMe(
2263
- Le(
2494
+ Oe(
2264
2495
  t.changeStart$.subscribe(() => {
2265
2496
  r.forEach((s) => s.dispose()), r.length = 0;
2266
2497
  })
2267
2498
  )
2268
2499
  );
2269
2500
  }
2270
- _getImageMenuItems(e, n, t) {
2501
+ _getImageMenuItems(e, n, t, r) {
2271
2502
  return [
2272
2503
  {
2273
2504
  label: "image-popup.edit",
2274
2505
  index: 0,
2275
- commandId: ft.id,
2506
+ commandId: Tt.id,
2276
2507
  commandParams: { unitId: e, subUnitId: n, drawingId: t },
2277
- disable: !!At.includes(e)
2508
+ disable: !!$t.includes(e) || r === Dn.DRAWING_DOM
2278
2509
  },
2279
2510
  {
2280
2511
  label: "image-popup.delete",
2281
2512
  index: 1,
2282
- commandId: Cn.id,
2513
+ commandId: yn.id,
2283
2514
  commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: n, drawingId: t }] },
2284
2515
  disable: !1
2285
2516
  },
2286
2517
  {
2287
2518
  label: "image-popup.crop",
2288
2519
  index: 2,
2289
- commandId: Zt.id,
2520
+ commandId: di.id,
2290
2521
  commandParams: { unitId: e, subUnitId: n, drawingId: t },
2291
2522
  disable: !0
2292
2523
  // TODO: @JOCS, feature is not ready.
@@ -2294,7 +2525,7 @@ let cn = class extends Et {
2294
2525
  {
2295
2526
  label: "image-popup.reset",
2296
2527
  index: 3,
2297
- commandId: Qt.id,
2528
+ commandId: li.id,
2298
2529
  commandParams: [{ unitId: e, subUnitId: n, drawingId: t }],
2299
2530
  disable: !0
2300
2531
  // TODO: @JOCS, feature is not ready.
@@ -2302,22 +2533,22 @@ let cn = class extends Et {
2302
2533
  ];
2303
2534
  }
2304
2535
  };
2305
- cn = mr([
2306
- je(0, Ie),
2307
- je(1, ve(vi)),
2308
- je(2, ee),
2309
- je(3, K),
2310
- je(4, jn)
2311
- ], cn);
2312
- var ur = Object.getOwnPropertyDescriptor, fr = (i, e, n, t) => {
2313
- for (var r = t > 1 ? void 0 : t ? ur(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2536
+ ln = yr([
2537
+ ze(0, Ie),
2538
+ ze(1, pe(Ri)),
2539
+ ze(2, J),
2540
+ ze(3, q),
2541
+ ze(4, Zn)
2542
+ ], ln);
2543
+ var Pr = Object.getOwnPropertyDescriptor, br = (i, e, n, t) => {
2544
+ for (var r = t > 1 ? void 0 : t ? Pr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2314
2545
  (s = i[o]) && (r = s(r) || r);
2315
2546
  return r;
2316
- }, xe = (i, e) => (n, t) => e(n, t, i);
2317
- let wn = class extends Xe {
2547
+ }, Le = (i, e) => (n, t) => e(n, t, i);
2548
+ let _n = class extends Ge {
2318
2549
  constructor(e, n, t, r, o, s, a, d) {
2319
2550
  super();
2320
- Ce(this, "_liquid", new $n());
2551
+ _e(this, "_liquid", new Jn());
2321
2552
  this._context = e, this._docSkeletonManagerService = n, this._commandService = t, this._editorService = r, this._drawingManagerService = o, this._docRefreshDrawingsService = s, this._univerInstanceService = a, this._lifecycleService = d, this._initialize(), this._commandExecutedListener();
2322
2553
  }
2323
2554
  _initialize() {
@@ -2331,7 +2562,7 @@ let wn = class extends Xe {
2331
2562
  });
2332
2563
  }
2333
2564
  _commandExecutedListener() {
2334
- const e = [J.id, _i.id];
2565
+ const e = [ne.id, rt.id];
2335
2566
  this.disposeWithMe(
2336
2567
  this._commandService.onCommandExecuted((n) => {
2337
2568
  if (e.includes(n.id)) {
@@ -2341,7 +2572,7 @@ let wn = class extends Xe {
2341
2572
  const a = this._docSkeletonManagerService.getSkeleton();
2342
2573
  if (a == null)
2343
2574
  return;
2344
- if (this._editorService.isEditor(o) && o !== In) {
2575
+ if (this._editorService.isEditor(o) && o !== Cn) {
2345
2576
  s == null || s.makeDirty();
2346
2577
  return;
2347
2578
  }
@@ -2352,9 +2583,9 @@ let wn = class extends Xe {
2352
2583
  }
2353
2584
  _initResize() {
2354
2585
  this.disposeWithMe(
2355
- Lt(this._context.engine.onTransformChange$).pipe(
2356
- Ln((e) => e.type === ri.resize),
2357
- Xn(16)
2586
+ Qn(this._context.engine.onTransformChange$).pipe(
2587
+ Gn((e) => e.type === pi.resize),
2588
+ st(16)
2358
2589
  ).subscribe(() => {
2359
2590
  var t;
2360
2591
  const e = this._docSkeletonManagerService.getSkeleton(), { scene: n } = this._context;
@@ -2363,42 +2594,42 @@ let wn = class extends Xe {
2363
2594
  );
2364
2595
  }
2365
2596
  _refreshDrawing(e) {
2366
- var O, D;
2597
+ var O, C;
2367
2598
  const n = e == null ? void 0 : e.getSkeletonData(), { mainComponent: t, unitId: r } = this._context, o = t;
2368
2599
  if (!n)
2369
2600
  return;
2370
- const { left: s, top: a, pageLayoutType: d, pageMarginLeft: c, pageMarginTop: l } = o, { pages: m, skeHeaders: g, skeFooters: p } = n, h = {};
2601
+ const { left: s, top: a, pageLayoutType: d, pageMarginLeft: c, pageMarginTop: l } = o, { pages: m, skeHeaders: g, skeFooters: f } = n, u = {};
2371
2602
  this._liquid.reset();
2372
2603
  for (let T = 0, M = m.length; T < M; T++) {
2373
- const y = m[T], { headerId: E, footerId: U, pageWidth: N } = y;
2374
- if (E) {
2375
- const I = (O = g.get(E)) == null ? void 0 : O.get(N);
2376
- I && this._calculateDrawingPosition(
2604
+ const P = m[T], { headerId: N, footerId: B, pageWidth: E } = P;
2605
+ if (N) {
2606
+ const _ = (O = g.get(N)) == null ? void 0 : O.get(E);
2607
+ _ && this._calculateDrawingPosition(
2377
2608
  r,
2378
- I,
2609
+ _,
2379
2610
  s,
2380
2611
  a,
2381
- h,
2382
- I.marginTop,
2383
- y.marginLeft
2612
+ u,
2613
+ _.marginTop,
2614
+ P.marginLeft
2384
2615
  );
2385
2616
  }
2386
- if (U) {
2387
- const I = (D = p.get(U)) == null ? void 0 : D.get(N);
2388
- I && this._calculateDrawingPosition(
2617
+ if (B) {
2618
+ const _ = (C = f.get(B)) == null ? void 0 : C.get(E);
2619
+ _ && this._calculateDrawingPosition(
2389
2620
  r,
2390
- I,
2621
+ _,
2391
2622
  s,
2392
2623
  a,
2393
- h,
2394
- y.pageHeight - y.marginBottom + I.marginTop,
2395
- y.marginLeft
2624
+ u,
2625
+ P.pageHeight - P.marginBottom + _.marginTop,
2626
+ P.marginLeft
2396
2627
  );
2397
2628
  }
2398
- this._calculateDrawingPosition(r, y, s, a, h, y.marginTop, y.marginLeft), this._liquid.translatePage(y, d, c, l);
2629
+ this._calculateDrawingPosition(r, P, s, a, u, P.marginTop, P.marginLeft), this._liquid.translatePage(P, d, c, l);
2399
2630
  }
2400
- const v = Object.values(h), w = v.filter((T) => !T.isMultiTransform), S = v.filter((T) => T.isMultiTransform);
2401
- w.length > 0 && this._drawingManagerService.refreshTransform(w), this._handleMultiDrawingsTransform(S);
2631
+ const h = Object.values(u), v = h.filter((T) => !T.isMultiTransform), I = h.filter((T) => T.isMultiTransform);
2632
+ v.length > 0 && this._drawingManagerService.refreshTransform(v), this._handleMultiDrawingsTransform(I);
2402
2633
  }
2403
2634
  _handleMultiDrawingsTransform(e) {
2404
2635
  const { scene: n, unitId: t } = this._context, r = n.getTransformerByCreate();
@@ -2406,7 +2637,7 @@ let wn = class extends Xe {
2406
2637
  const c = this._drawingManagerService.getDrawingByParam(d);
2407
2638
  c != null && (c.transform = d.transform, c.transforms = d.transforms, c.isMultiTransform = d.isMultiTransform);
2408
2639
  });
2409
- const s = [...r.getSelectedObjectMap().keys()], a = Object.values(this._drawingManagerService.getDrawingData(t, t)).filter((d) => d.isMultiTransform === oe.TRUE);
2640
+ const s = [...r.getSelectedObjectMap().keys()], a = Object.values(this._drawingManagerService.getDrawingData(t, t)).filter((d) => d.isMultiTransform === se.TRUE);
2410
2641
  this._drawingManagerService.removeNotification(a), e.length > 0 && this._drawingManagerService.addNotification(e);
2411
2642
  for (const d of s) {
2412
2643
  const c = n.getObject(d);
@@ -2419,22 +2650,22 @@ let wn = class extends Xe {
2419
2650
  marginTop: s,
2420
2651
  marginLeft: a
2421
2652
  }), d.forEach((c) => {
2422
- const { aLeft: l, aTop: m, height: g, width: p, angle: h, drawingId: v, drawingOrigin: w } = c, S = w.layoutType === H.WRAP_NONE && w.behindDoc === oe.TRUE, { isMultiTransform: O = oe.FALSE } = w, D = {
2653
+ const { aLeft: l, aTop: m, height: g, width: f, angle: u, drawingId: h, drawingOrigin: v } = c, I = v.layoutType === W.WRAP_NONE && v.behindDoc === se.TRUE, { isMultiTransform: O = se.FALSE } = v, C = {
2423
2654
  left: l + t + this._liquid.x,
2424
2655
  top: m + r + this._liquid.y,
2425
- width: p,
2656
+ width: f,
2426
2657
  height: g,
2427
- angle: h
2658
+ angle: u
2428
2659
  };
2429
- o[v] == null ? o[v] = {
2660
+ o[h] == null ? o[h] = {
2430
2661
  unitId: e,
2431
2662
  subUnitId: e,
2432
- drawingId: v,
2433
- behindText: S,
2434
- transform: D,
2435
- transforms: [D],
2663
+ drawingId: h,
2664
+ behindText: I,
2665
+ transform: C,
2666
+ transforms: [C],
2436
2667
  isMultiTransform: O
2437
- } : O === oe.TRUE && o[v].transforms.push(D);
2668
+ } : O === se.TRUE && o[h].transforms.push(C);
2438
2669
  }), this._liquid.restorePagePadding({
2439
2670
  marginTop: s,
2440
2671
  marginLeft: a
@@ -2445,75 +2676,77 @@ let wn = class extends Xe {
2445
2676
  const n = this._docSkeletonManagerService.getSkeleton();
2446
2677
  n != null && (this._refreshDrawing(n), this._drawingManagerService.initializeNotification(this._context.unitId));
2447
2678
  };
2448
- this._lifecycleService.stage === Pn.Steady ? setTimeout(() => {
2679
+ this._lifecycleService.stage === En.Steady ? setTimeout(() => {
2449
2680
  e();
2450
- }, 1e3) : this._lifecycleService.lifecycle$.pipe(Ln((n) => n === Pn.Steady)).subscribe(e);
2681
+ }, 1e3) : this._lifecycleService.lifecycle$.pipe(Gn((n) => n === En.Steady)).subscribe(e);
2451
2682
  }
2452
2683
  };
2453
- wn = fr([
2454
- xe(1, ve(se)),
2455
- xe(2, z),
2456
- xe(3, Ii),
2457
- xe(4, Ie),
2458
- xe(5, ve(gn)),
2459
- xe(6, K),
2460
- xe(7, ve(xt))
2461
- ], wn);
2462
- var hr = Object.defineProperty, pr = Object.getOwnPropertyDescriptor, wr = (i, e, n) => e in i ? hr(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, vr = (i, e, n, t) => {
2463
- for (var r = t > 1 ? void 0 : t ? pr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2684
+ _n = br([
2685
+ Le(1, pe(te)),
2686
+ Le(2, $),
2687
+ Le(3, Ei),
2688
+ Le(4, Ie),
2689
+ Le(5, pe(un)),
2690
+ Le(6, q),
2691
+ Le(7, pe(zt))
2692
+ ], _n);
2693
+ var Mr = Object.defineProperty, Rr = Object.getOwnPropertyDescriptor, Er = (i, e, n) => e in i ? Mr(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, Nr = (i, e, n, t) => {
2694
+ for (var r = t > 1 ? void 0 : t ? Rr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2464
2695
  (s = i[o]) && (r = s(r) || r);
2465
2696
  return r;
2466
- }, pn = (i, e) => (n, t) => e(n, t, i), vt = (i, e, n) => wr(i, typeof e != "symbol" ? e + "" : e, n);
2467
- const Ir = "DOC_DRAWING_UI_PLUGIN";
2468
- let dn = class extends Ft {
2469
- constructor(i = Fn, e, n, t) {
2697
+ }, In = (i, e) => (n, t) => e(n, t, i), Mt = (i, e, n) => Er(i, typeof e != "symbol" ? e + "" : e, n);
2698
+ const Ar = "DOC_DRAWING_UI_PLUGIN";
2699
+ let gn = class extends Yt {
2700
+ constructor(i = zn, e, n, t) {
2470
2701
  super(), this._config = i, this._injector = e, this._renderManagerSrv = n, this._configService = t;
2471
- const { ...r } = Ht(
2702
+ const { ...r } = Zt(
2472
2703
  {},
2473
- Fn,
2704
+ zn,
2474
2705
  this._config
2475
2706
  );
2476
- this._configService.setConfig(Ti, r);
2707
+ this._configService.setConfig(Bi, r);
2477
2708
  }
2478
2709
  onStarting() {
2479
2710
  [
2480
- [an],
2481
2711
  [cn],
2712
+ [ln],
2713
+ [sn],
2482
2714
  [on],
2483
- [rn],
2484
- [gn]
2715
+ [un],
2716
+ [dn]
2485
2717
  ].forEach((e) => this._injector.add(e));
2486
2718
  }
2487
2719
  onReady() {
2488
2720
  [
2489
- [sn],
2490
- [wn]
2491
- ].forEach((i) => this._renderManagerSrv.registerRenderModule(be.UNIVER_DOC, i)), this._injector.get(rn), this._injector.get(an), this._injector.get(on);
2721
+ [an],
2722
+ [_n]
2723
+ ].forEach((i) => this._renderManagerSrv.registerRenderModule(Se.UNIVER_DOC, i)), this._injector.get(on), this._injector.get(cn), this._injector.get(sn);
2492
2724
  }
2493
2725
  onRendered() {
2494
- this._injector.get(cn);
2726
+ this._injector.get(ln), this._injector.get(dn);
2495
2727
  }
2496
2728
  };
2497
- vt(dn, "type", be.UNIVER_DOC);
2498
- vt(dn, "pluginName", Ir);
2499
- dn = vr([
2500
- Bt(Jt, qt, Wt, mi),
2501
- pn(1, ve(Ut)),
2502
- pn(2, ee),
2503
- pn(3, kt)
2504
- ], dn);
2729
+ Mt(gn, "type", Se.UNIVER_DOC);
2730
+ Mt(gn, "pluginName", Ar);
2731
+ gn = Nr([
2732
+ Xt(gi, ri, Qt, Ti),
2733
+ In(1, pe(qt)),
2734
+ In(2, J),
2735
+ In(3, Kt)
2736
+ ], gn);
2505
2737
  export {
2506
- Wi as ClearDocDrawingTransformerOperation,
2507
- pt as DOCS_IMAGE_MENU_ID,
2508
- st as DeleteDocDrawingsCommand,
2509
- ft as EditDocDrawingOperation,
2510
- at as GroupDocDrawingCommand,
2511
- ct as InsertDocDrawingCommand,
2512
- gt as InsertDocImageCommand,
2513
- Ke as MoveDocDrawingsCommand,
2514
- Cn as RemoveDocDrawingCommand,
2515
- dt as SetDocDrawingArrangeCommand,
2516
- ut as SidebarDocDrawingOperation,
2517
- lt as UngroupDocDrawingCommand,
2518
- dn as UniverDocsDrawingUIPlugin
2738
+ Ji as ClearDocDrawingTransformerOperation,
2739
+ Pt as DOCS_IMAGE_MENU_ID,
2740
+ vt as DeleteDocDrawingsCommand,
2741
+ dn as DocFloatDomController,
2742
+ Tt as EditDocDrawingOperation,
2743
+ It as GroupDocDrawingCommand,
2744
+ Pn as InsertDocDrawingCommand,
2745
+ Dt as InsertDocImageCommand,
2746
+ Ye as MoveDocDrawingsCommand,
2747
+ yn as RemoveDocDrawingCommand,
2748
+ _t as SetDocDrawingArrangeCommand,
2749
+ Ot as SidebarDocDrawingOperation,
2750
+ St as UngroupDocDrawingCommand,
2751
+ gn as UniverDocsDrawingUIPlugin
2519
2752
  };