@univerjs/docs-drawing-ui 0.6.7-experimental.20250328-21e0bec → 0.6.7-experimental.20250329-4e66087

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,25 +1,25 @@
1
1
  var At = Object.defineProperty;
2
2
  var xt = (i, e, n) => e in i ? At(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
3
3
  var Se = (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 Dn, 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 un, WrapTextType as Xe, DrawingTypeEnum as rn, FOCUSING_COMMON_DRAWINGS as on, UniverInstanceType as Ie, Direction as fe, DocumentFlavor as wn, 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 _e, IImageIoService as Jt, DRAWING_IMAGE_ALLOW_IMAGE_LIST as ei, DRAWING_IMAGE_COUNT_LIMIT as Nn, ImageUploadStatusType as vn, 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";
4
+ import { Disposable as Ge, UndoCommand as Lt, RedoCommand as Ut, 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 be, TextX as Dn, TextXActionType as Q, toDisposable as Oe, throttle as Rn, COLORS as Bt, MemoryCursor as Ft, IUndoRedoService as Yn, BuildTextUtils as kt, ArrangeTypeEnum as Qe, Inject as pe, IContextService as Zn, LocaleService as un, WrapTextType as Xe, DrawingTypeEnum as rn, FOCUSING_COMMON_DRAWINGS as on, UniverInstanceType as Ie, Direction as he, DocumentFlavor as wn, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Cn, FOCUSING_UNIVER_EDITOR as Wt, DisposableCollection as Ht, fromEventSubject as Qn, generateRandomId as Gt, RxDisposable as Vt, SHEET_EDITOR_UNITS as jt, LifecycleService as $t, LifecycleStages as En, DependentOn as zt, Injector as Xt, IConfigService as qt, Plugin as Kt, merge as Yt } from "@univerjs/core";
5
+ import { IDocDrawingService as Ue, UniverDocsDrawingPlugin as Zt } from "@univerjs/docs-drawing";
6
+ import { IDrawingManagerService as _e, IImageIoService as Qt, DRAWING_IMAGE_ALLOW_IMAGE_LIST as Jt, DRAWING_IMAGE_COUNT_LIMIT as Nn, ImageUploadStatusType as vn, DRAWING_IMAGE_ALLOW_SIZE as ei, getImageSize as ni, getDrawingShapeKeyByDrawingSearch as ti, DRAWING_IMAGE_WIDTH_LIMIT as An, DRAWING_IMAGE_HEIGHT_LIMIT as xn, UniverDrawingPlugin as ii } from "@univerjs/drawing";
7
+ import { DrawingCommonPanel as ri, DrawingRenderService as oi, ImageCropperObject as si, COMPONENT_IMAGE_POPUP_MENU as ai, OpenImageCropOperation as ci, ImageResetSizeOperation as di, UniverDrawingUIPlugin as li } from "@univerjs/drawing-ui";
8
+ import { IRenderManagerService as J, DocumentEditArea as We, Liquid as Jn, PageLayoutType as Ln, DocumentSkeletonPageType as Un, Vector2 as gi, Rect as mi, getColor as ui, getCurrentTypeOfRenderer as hi, CURSOR_TYPE as Bn, TRANSFORM_CHANGE_OBSERVABLE_TYPE as fi } from "@univerjs/engine-render";
9
+ import { IMessageService as pi, ILocalFileService as wi, ISidebarService as vi, useDependency as ve, getMenuHiddenObservable as et, MenuItemType as nt, RibbonStartGroup as Ii, KeyCode as He, ComponentManager as _i, IMenuManagerService as Si, IShortcutService as Di, CanvasFloatDomService as Ci, UniverUIPlugin as Oi } from "@univerjs/ui";
10
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";
11
+ import { DocSelectionRenderService as Re, getRichTextEditPath as qe, NodePositionConvertToCursor as Fn, getOneTextSelectionRange as kn, getAnchorBounding as Ti, TEXT_RANGE_LAYER_INDEX as yi, getDocObject as Pi, getCustomBlockIdsInSelections as Mi, docDrawingPositionToTransform as tt, VIEWPORT_KEY as it, SetDocZoomRatioOperation as rt, DocCanvasPopManagerService as bi, IEditorService as Ri } from "@univerjs/docs-ui";
12
+ import { BehaviorSubject as ot, debounceTime as st, Observable as Ei, map as Wn, switchMap as Ni, of as Ai, takeUntil as Hn, filter as Gn } from "rxjs";
13
+ import { MessageType as Vn, clsx as j, InputNumber as ke, Select as jn, Checkbox as xi, RadioGroup as $n, Radio as Me } from "@univerjs/design";
14
14
  import { jsxs as K, jsx as p } 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--)
15
+ import { forwardRef as at, useRef as Li, createElement as ct, useState as oe, useEffect as Tn } from "react";
16
+ const Ui = "docs-drawing-ui.config", zn = {};
17
+ var Bi = Object.getOwnPropertyDescriptor, Fi = (i, e, n, t) => {
18
+ for (var r = t > 1 ? void 0 : t ? Bi(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
21
  }, $e = (i, e) => (n, t) => e(n, t, i);
22
- function Wi(i) {
22
+ function ki(i) {
23
23
  var t, r, o, s;
24
24
  if (X.isNoop(i) || !Array.isArray(i))
25
25
  return null;
@@ -42,7 +42,7 @@ function Wi(i) {
42
42
  });
43
43
  return n;
44
44
  }
45
- function Hi(i) {
45
+ function Wi(i) {
46
46
  if (!Array.isArray(i) || i.length < 3 || i[0] !== "drawingsOrder")
47
47
  return [];
48
48
  const e = [];
@@ -67,27 +67,24 @@ let sn = class extends Ge {
67
67
  _commandExecutedListener() {
68
68
  this.disposeWithMe(
69
69
  this._commandService.beforeCommandExecuted((i) => {
70
- var a, d;
71
70
  if (i.id !== ne.id)
72
71
  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 = Wi(t);
74
- if (s != null)
75
- for (const { type: c, drawingId: g, drawing: m } of s) {
76
- const l = o.find((f) => f.blockId === g);
77
- (l == null ? void 0 : l.blockType) !== Lt.CUSTOM && (c === "add" ? this._addDrawings(n, [m]) : this._removeDrawings(n, [g]));
78
- }
72
+ const e = i.params, { unitId: n, actions: t } = e, r = ki(t);
73
+ if (r != null)
74
+ for (const { type: o, drawingId: s, drawing: a } of r)
75
+ o === "add" ? this._addDrawings(n, [a]) : this._removeDrawings(n, [s]);
79
76
  })
80
77
  ), this.disposeWithMe(
81
78
  this._commandService.onCommandExecuted((i) => {
82
79
  if (i.id !== ne.id)
83
80
  return;
84
81
  const e = i.params, { unitId: n, actions: t } = e;
85
- Hi(t).length > 0 && this._updateDrawingsOrder(n);
82
+ Wi(t).length > 0 && this._updateDrawingsOrder(n);
86
83
  })
87
84
  ), this.disposeWithMe(
88
85
  this._commandService.onCommandExecuted((i) => {
89
86
  var s;
90
- if (i.id !== Ut.id && i.id !== Bt.id)
87
+ if (i.id !== Lt.id && i.id !== Ut.id)
91
88
  return;
92
89
  const e = (s = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : s.getUnitId(), n = this._drawingManagerService.getFocusDrawings();
93
90
  if (e == null || n.length === 0)
@@ -135,7 +132,7 @@ sn = Fi([
135
132
  $e(3, Ue),
136
133
  $e(4, J)
137
134
  ], sn);
138
- class fn {
135
+ class hn {
139
136
  constructor() {
140
137
  Se(this, "_refreshDrawings$", new ot(null));
141
138
  Se(this, "refreshDrawings$", this._refreshDrawings$.asObservable());
@@ -145,7 +142,7 @@ class fn {
145
142
  }
146
143
  }
147
144
  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 Gi = {
145
+ const Hi = {
149
146
  inline: W.INLINE,
150
147
  wrapSquare: W.WRAP_SQUARE,
151
148
  wrapTopAndBottom: W.WRAP_TOP_AND_BOTTOM,
@@ -154,13 +151,13 @@ const Gi = {
154
151
  };
155
152
  function dt(i, e, n, t, r, o, s) {
156
153
  var f, u;
157
- const a = new Dn(), d = X.getInstance(), c = [], g = o.getSelfOrHeaderFooterModel(e).getBody(), m = o.getSelfOrHeaderFooterModel(i).getBody();
158
- if (g == null || m == null)
154
+ const a = new Dn(), d = X.getInstance(), c = [], l = o.getSelfOrHeaderFooterModel(e).getBody(), m = o.getSelfOrHeaderFooterModel(i).getBody();
155
+ if (l == null || m == null)
159
156
  return;
160
- const l = (u = (f = g.customBlocks) == null ? void 0 : f.find((v) => v.blockId === r)) == null ? void 0 : u.startIndex;
161
- if (l != null) {
157
+ const g = (u = (f = l.customBlocks) == null ? void 0 : f.find((v) => v.blockId === r)) == null ? void 0 : u.startIndex;
158
+ if (g != null) {
162
159
  if (t = Math.min(m.dataStream.length - 2, t), i === e) {
163
- if (t < l ? (t > 0 && a.push({
160
+ if (t < g ? (t > 0 && a.push({
164
161
  t: Q.RETAIN,
165
162
  len: t
166
163
  }), a.push({
@@ -175,19 +172,19 @@ function dt(i, e, n, t, r, o, s) {
175
172
  len: 1
176
173
  }), a.push({
177
174
  t: Q.RETAIN,
178
- len: l - t
175
+ len: g - t
179
176
  }), a.push({
180
177
  t: Q.DELETE,
181
178
  len: 1
182
- })) : (l > 0 && a.push({
179
+ })) : (g > 0 && a.push({
183
180
  t: Q.RETAIN,
184
- len: l
181
+ len: g
185
182
  }), a.push({
186
183
  t: Q.DELETE,
187
184
  len: 1
188
- }), t - l - 1 > 0 && a.push({
185
+ }), t - g - 1 > 0 && a.push({
189
186
  t: Q.RETAIN,
190
- len: t - l - 1
187
+ len: t - g - 1
191
188
  }), a.push({
192
189
  t: Q.INSERT,
193
190
  body: {
@@ -198,14 +195,14 @@ function dt(i, e, n, t, r, o, s) {
198
195
  }]
199
196
  },
200
197
  len: 1
201
- })), t !== l) {
198
+ })), t !== g) {
202
199
  const v = qe(o, e), w = d.editOp(a.serialize(), v);
203
200
  c.push(w);
204
201
  }
205
202
  } else {
206
- l > 0 && a.push({
203
+ g > 0 && a.push({
207
204
  t: Q.RETAIN,
208
- len: l
205
+ len: g
209
206
  }), a.push({
210
207
  t: Q.DELETE,
211
208
  len: 1
@@ -237,12 +234,12 @@ const lt = {
237
234
  var N, B;
238
235
  if (e == null)
239
236
  return !1;
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(), g = d == null ? void 0 : d.with(te).getViewModel(), m = d == null ? void 0 : d.scene, l = s.getCurrentUniverDocInstance();
241
- if (l == null || c == null || m == null || g == null)
237
+ 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();
238
+ if (g == null || c == null || m == null || l == null)
242
239
  return !1;
243
- const f = g.getEditArea(), u = m.getTransformerByCreate(), { pages: v, skeHeaders: w, skeFooters: I } = c, O = X.getInstance(), C = [], { drawings: T = {} } = l.getSnapshot();
240
+ const f = l.getEditArea(), u = m.getTransformerByCreate(), { pages: v, skeHeaders: w, skeFooters: I } = c, O = X.getInstance(), C = [], { drawings: T = {} } = g.getSnapshot();
244
241
  for (const E of n) {
245
- const { drawingId: _ } = E, L = T[_].layoutType, G = Gi[t];
242
+ const { drawingId: _ } = E, L = T[_].layoutType, G = Hi[t];
246
243
  if (L !== G) {
247
244
  const D = O.replaceOp(["drawings", _, "layoutType"], L, G);
248
245
  C.push(D);
@@ -258,20 +255,20 @@ const lt = {
258
255
  continue;
259
256
  let x = null, V = 0, S = 0;
260
257
  for (const D of v) {
261
- const { headerId: R, footerId: y, marginTop: U, marginLeft: k, marginBottom: b, pageWidth: A, pageHeight: z } = D;
258
+ const { headerId: R, footerId: y, marginTop: U, marginLeft: F, marginBottom: M, pageWidth: A, pageHeight: z } = D;
262
259
  switch (f) {
263
260
  case We.HEADER: {
264
- const F = (N = w.get(R)) == null ? void 0 : N.get(A);
265
- F != null && F.skeDrawings.has(_) && (x = F.skeDrawings.get(_), V = F.marginTop, S = k);
261
+ const k = (N = w.get(R)) == null ? void 0 : N.get(A);
262
+ k != null && k.skeDrawings.has(_) && (x = k.skeDrawings.get(_), V = k.marginTop, S = F);
266
263
  break;
267
264
  }
268
265
  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);
266
+ const k = (B = I.get(y)) == null ? void 0 : B.get(A);
267
+ k != null && k.skeDrawings.has(_) && (x = k.skeDrawings.get(_), V = z - M + k.marginTop, S = F);
271
268
  break;
272
269
  }
273
270
  case We.BODY: {
274
- D.skeDrawings.has(_) && (x = D.skeDrawings.get(_), V = U, S = k);
271
+ D.skeDrawings.has(_) && (x = D.skeDrawings.get(_), V = U, S = F);
275
272
  break;
276
273
  }
277
274
  }
@@ -282,28 +279,28 @@ const lt = {
282
279
  const { aTop: D, aLeft: R } = x, y = T[_].docTransform.positionH;
283
280
  let U = R;
284
281
  y.relativeFrom === ee.MARGIN ? U -= S : y.relativeFrom === ee.COLUMN && (U -= x.columnLeft);
285
- const k = {
282
+ const F = {
286
283
  relativeFrom: y.relativeFrom,
287
284
  posOffset: U
288
285
  };
289
- if (y.posOffset !== k.posOffset) {
290
- const F = O.replaceOp(["drawings", _, "docTransform", "positionH"], y, k);
291
- C.push(F);
286
+ if (y.posOffset !== F.posOffset) {
287
+ const k = O.replaceOp(["drawings", _, "docTransform", "positionH"], y, F);
288
+ C.push(k);
292
289
  }
293
- const b = T[_].docTransform.positionV;
290
+ const M = T[_].docTransform.positionV;
294
291
  let A = D;
295
- b.relativeFrom === H.PAGE ? A += V : b.relativeFrom === H.LINE ? A -= x.lineTop : b.relativeFrom === H.PARAGRAPH && (A -= x.blockAnchorTop);
292
+ M.relativeFrom === H.PAGE ? A += V : M.relativeFrom === H.LINE ? A -= x.lineTop : M.relativeFrom === H.PARAGRAPH && (A -= x.blockAnchorTop);
296
293
  const z = {
297
- relativeFrom: b.relativeFrom,
294
+ relativeFrom: M.relativeFrom,
298
295
  posOffset: A
299
296
  };
300
- if (b.posOffset !== z.posOffset) {
301
- const F = O.replaceOp(["drawings", _, "docTransform", "positionV"], b, z);
302
- C.push(F);
297
+ if (M.posOffset !== z.posOffset) {
298
+ const k = O.replaceOp(["drawings", _, "docTransform", "positionV"], M, z);
299
+ C.push(k);
303
300
  }
304
301
  }
305
302
  }
306
- const M = {
303
+ const b = {
307
304
  id: ne.id,
308
305
  params: {
309
306
  unitId: r,
@@ -311,8 +308,8 @@ const lt = {
311
308
  textRanges: null
312
309
  }
313
310
  };
314
- M.params.actions = C.reduce((E, _) => X.compose(E, _), null);
315
- const P = o.syncExecuteCommand(M.id, M.params);
311
+ b.params.actions = C.reduce((E, _) => X.compose(E, _), null);
312
+ const P = o.syncExecuteCommand(b.id, b.params);
316
313
  return u.refreshControls(), !!P;
317
314
  }
318
315
  }, gt = {
@@ -324,11 +321,11 @@ const lt = {
324
321
  const n = i.get($), r = i.get(q).getCurrentUniverDocInstance();
325
322
  if (r == null)
326
323
  return !1;
327
- const { drawings: o, dist: s, unitId: a } = e, d = X.getInstance(), c = [], { drawings: g = {} } = r.getSnapshot();
324
+ const { drawings: o, dist: s, unitId: a } = e, d = X.getInstance(), c = [], { drawings: l = {} } = r.getSnapshot();
328
325
  for (const f of o) {
329
326
  const { drawingId: u } = f;
330
327
  for (const [v, w] of Object.entries(s)) {
331
- const I = g[u][v];
328
+ const I = l[u][v];
332
329
  if (I !== w) {
333
330
  const O = d.replaceOp(["drawings", u, v], I, w);
334
331
  c.push(O);
@@ -354,9 +351,9 @@ const lt = {
354
351
  const n = i.get($), r = i.get(q).getCurrentUniverDocInstance();
355
352
  if (r == null)
356
353
  return !1;
357
- const { drawings: o, wrapText: s, unitId: a } = e, d = X.getInstance(), c = [], { drawings: g = {} } = r.getSnapshot();
354
+ const { drawings: o, wrapText: s, unitId: a } = e, d = X.getInstance(), c = [], { drawings: l = {} } = r.getSnapshot();
358
355
  for (const f of o) {
359
- const { drawingId: u } = f, v = g[u].wrapText;
356
+ const { drawingId: u } = f, v = l[u].wrapText;
360
357
  if (v !== s) {
361
358
  const w = d.replaceOp(["drawings", u, "wrapText"], v, s);
362
359
  c.push(w);
@@ -384,24 +381,24 @@ const lt = {
384
381
  const a = s.getTransformerByCreate(), d = t.getCurrentUniverDocInstance();
385
382
  if (d == null)
386
383
  return !1;
387
- const { drawings: c, unitId: g } = e, m = X.getInstance(), l = [], { drawings: f = {} } = d.getSnapshot();
384
+ const { drawings: c, unitId: l } = e, m = X.getInstance(), g = [], { drawings: f = {} } = d.getSnapshot();
388
385
  for (const w of c) {
389
386
  const { drawingId: I, key: O, value: C } = w, T = f[I].docTransform[O];
390
- if (!Me.diffValue(T, C)) {
391
- const M = m.replaceOp(["drawings", I, "docTransform", O], T, C);
392
- l.push(M);
387
+ if (!be.diffValue(T, C)) {
388
+ const b = m.replaceOp(["drawings", I, "docTransform", O], T, C);
389
+ g.push(b);
393
390
  }
394
391
  }
395
392
  const u = {
396
393
  id: ne.id,
397
394
  params: {
398
- unitId: g,
395
+ unitId: l,
399
396
  actions: [],
400
397
  textRanges: null,
401
398
  debounce: !0
402
399
  }
403
400
  };
404
- u.params.actions = l.reduce((w, I) => X.compose(w, I), null);
401
+ u.params.actions = g.reduce((w, I) => X.compose(w, I), null);
405
402
  const v = n.syncExecuteCommand(u.id, u.params);
406
403
  return a.refreshControls(), !!v;
407
404
  }
@@ -412,16 +409,16 @@ const lt = {
412
409
  var B, E;
413
410
  if (e == null)
414
411
  return !1;
415
- const n = i.get(J), t = (B = n.getRenderById(e.unitId)) == null ? void 0 : B.with(Re), r = i.get(fn), o = n.getRenderById(e.unitId), s = o == null ? void 0 : o.scene, a = o == null ? void 0 : o.with(te).getSkeleton();
412
+ const n = i.get(J), t = (B = n.getRenderById(e.unitId)) == null ? void 0 : B.with(Re), r = i.get(hn), o = n.getRenderById(e.unitId), s = o == null ? void 0 : o.scene, a = o == null ? void 0 : o.with(te).getSkeleton();
416
413
  if (s == null || t == null)
417
414
  return !1;
418
415
  const d = s.getTransformerByCreate(), c = i.get($), m = i.get(q).getCurrentUniverDocInstance();
419
416
  if (m == null)
420
417
  return !1;
421
- const { drawing: l, unitId: f, offset: u, segmentId: v, segmentPage: w, needRefreshDrawings: I } = e;
418
+ const { drawing: g, unitId: f, offset: u, segmentId: v, segmentPage: w, needRefreshDrawings: I } = e;
422
419
  if (I)
423
420
  return r.refreshDrawings(a), d.refreshControls(), !0;
424
- const O = [], { drawingId: C } = l, T = (E = t.getSegment()) != null ? E : "", M = dt(
421
+ const O = [], { drawingId: C } = g, T = (E = t.getSegment()) != null ? E : "", b = dt(
425
422
  v,
426
423
  T,
427
424
  w,
@@ -430,9 +427,9 @@ const lt = {
430
427
  m,
431
428
  t
432
429
  );
433
- if (M == null || M.length === 0)
430
+ if (b == null || b.length === 0)
434
431
  return r.refreshDrawings(a), d.refreshControls(), !1;
435
- O.push(...M);
432
+ O.push(...b);
436
433
  const P = {
437
434
  id: ne.id,
438
435
  params: {
@@ -445,7 +442,7 @@ const lt = {
445
442
  const N = c.syncExecuteCommand(P.id, P.params);
446
443
  return d.refreshControls(), !!N;
447
444
  }
448
- }, ft = {
445
+ }, ht = {
449
446
  id: "doc.command.transform-non-inline-drawing",
450
447
  type: Y.COMMAND,
451
448
  // eslint-disable-next-line max-lines-per-function
@@ -459,11 +456,11 @@ const lt = {
459
456
  const s = o.getTransformerByCreate(), a = i.get($), c = i.get(q).getCurrentUniverDocInstance();
460
457
  if (c == null)
461
458
  return !1;
462
- const { drawing: g, unitId: m, offset: l, docTransform: f, segmentId: u, segmentPage: v } = e, w = [], { drawingId: I } = g, O = (V = t.getSegment()) != null ? V : "", C = dt(
459
+ const { drawing: l, unitId: m, offset: g, docTransform: f, segmentId: u, segmentPage: v } = e, w = [], { drawingId: I } = l, O = (V = t.getSegment()) != null ? V : "", C = dt(
463
460
  u,
464
461
  O,
465
462
  v,
466
- l,
463
+ g,
467
464
  I,
468
465
  c,
469
466
  t
@@ -471,20 +468,20 @@ const lt = {
471
468
  if (C == null)
472
469
  return !1;
473
470
  C.length > 0 && w.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)) {
471
+ const T = X.getInstance(), { drawings: b = {} } = c.getSnapshot(), P = b[I].docTransform, { positionH: N, positionV: B, size: E, angle: _ } = P;
472
+ if (!be.diffValue(N, f.positionH)) {
476
473
  const S = T.replaceOp(["drawings", I, "docTransform", "positionH"], N, f.positionH);
477
474
  w.push(S);
478
475
  }
479
- if (!Me.diffValue(B, f.positionV)) {
476
+ if (!be.diffValue(B, f.positionV)) {
480
477
  const S = T.replaceOp(["drawings", I, "docTransform", "positionV"], B, f.positionV);
481
478
  w.push(S);
482
479
  }
483
- if (!Me.diffValue(E, f.size)) {
480
+ if (!be.diffValue(E, f.size)) {
484
481
  const S = T.replaceOp(["drawings", I, "docTransform", "size"], E, f.size);
485
482
  w.push(S);
486
483
  }
487
- if (!Me.diffValue(_, f.angle)) {
484
+ if (!be.diffValue(_, f.angle)) {
488
485
  const S = T.replaceOp(["drawings", I, "docTransform", "angle"], _, f.angle);
489
486
  w.push(S);
490
487
  }
@@ -502,12 +499,12 @@ const lt = {
502
499
  return s.refreshControls(), !!G;
503
500
  }
504
501
  };
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--)
502
+ var Gi = Object.getOwnPropertyDescriptor, Vi = (i, e, n, t) => {
503
+ for (var r = t > 1 ? void 0 : t ? Gi(e, n) : e, o = i.length - 1, s; o >= 0; o--)
507
504
  (s = i[o]) && (r = s(r) || r);
508
505
  return r;
509
506
  }, Je = (i, e) => (n, t) => e(n, t, i);
510
- const $i = "__InlineDrawingAnchor__";
507
+ const ji = "__InlineDrawingAnchor__";
511
508
  function Xn(i) {
512
509
  const { path: e } = i;
513
510
  return e.some((n) => n === "cells");
@@ -550,7 +547,7 @@ let an = class extends Ge {
550
547
  this._transformerCache.clear();
551
548
  const { objects: s } = o;
552
549
  for (const d of s.values()) {
553
- const { oKey: c, width: g, height: m, left: l, top: f, angle: u } = d, v = this._drawingManagerService.getDrawingOKey(c);
550
+ const { oKey: c, width: l, height: m, left: g, top: f, angle: u } = d, v = this._drawingManagerService.getDrawingOKey(c);
554
551
  if (v == null)
555
552
  continue;
556
553
  const w = this._univerInstanceService.getUniverDocInstance(v.unitId), I = (a = w == null ? void 0 : w.getSnapshot().drawings) == null ? void 0 : a[v.drawingId];
@@ -562,8 +559,8 @@ let an = class extends Ge {
562
559
  I != null && this._transformerCache.set(v.drawingId, {
563
560
  drawing: I,
564
561
  top: f,
565
- left: l,
566
- width: g,
562
+ left: g,
563
+ width: l,
567
564
  height: m,
568
565
  angle: u
569
566
  });
@@ -579,8 +576,8 @@ let an = class extends Ge {
579
576
  if (s.size > 1)
580
577
  t(s);
581
578
  else if (s.size === 1) {
582
- const c = this._transformerCache.values().next().value, g = s.values().next().value, { width: m, height: l, top: f, left: u, angle: v } = g;
583
- if (c && m === c.width && l === c.height && f === c.top && u === c.left && v === c.angle)
579
+ const c = this._transformerCache.values().next().value, l = s.values().next().value, { width: m, height: g, top: f, left: u, angle: v } = l;
580
+ if (c && m === c.width && g === c.height && f === c.top && u === c.left && v === c.angle)
584
581
  return;
585
582
  c && (c.drawing.layoutType, W.INLINE), c && c.drawing.layoutType === W.INLINE && a != null && d != null && this._updateInlineDrawingAnchor(c.drawing, a, d);
586
583
  }
@@ -592,10 +589,10 @@ let an = class extends Ge {
592
589
  n.changeEnd$.subscribe((o) => {
593
590
  const { objects: s, offsetX: a, offsetY: d } = o;
594
591
  for (const c of s.values()) {
595
- const g = this._drawingManagerService.getDrawingOKey(c.oKey);
596
- if (g == null)
592
+ const l = this._drawingManagerService.getDrawingOKey(c.oKey);
593
+ if (l == null)
597
594
  continue;
598
- const m = this._transformerCache.get(g == null ? void 0 : g.drawingId);
595
+ const m = this._transformerCache.get(l == null ? void 0 : l.drawingId);
599
596
  if ((m == null ? void 0 : m.drawing.layoutType) === W.INLINE)
600
597
  try {
601
598
  c.setOpacity(1);
@@ -605,10 +602,10 @@ let an = class extends Ge {
605
602
  if (this._anchorShape && this._anchorShape.hide(), s.size > 1)
606
603
  this._updateMultipleDrawingDocTransform(s);
607
604
  else if (s.size === 1) {
608
- const c = this._transformerCache.values().next().value, g = s.values().next().value, { width: m, height: l, top: f, left: u, angle: v } = g;
609
- if (c && m === c.width && l === c.height && f === c.top && u === c.left && v === c.angle)
605
+ const c = this._transformerCache.values().next().value, l = s.values().next().value, { width: m, height: g, top: f, left: u, angle: v } = l;
606
+ if (c && m === c.width && g === c.height && f === c.top && u === c.left && v === c.angle)
610
607
  return;
611
- c && c.drawing.layoutType === W.INLINE ? m !== c.width || l !== c.height || v !== c.angle ? this._updateDrawingSize(c, g) : a != null && d != null && this._moveInlineDrawing(c.drawing, a, d) : c && this._nonInlineDrawingTransform(c.drawing, g);
608
+ c && c.drawing.layoutType === W.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);
612
609
  }
613
610
  this._transformerCache.clear();
614
611
  })
@@ -623,37 +620,37 @@ let an = class extends Ge {
623
620
  let t, r;
624
621
  for (const o of e.values()) {
625
622
  const { oKey: s, left: a, top: d, angle: c } = o;
626
- let { width: g, height: m } = o;
627
- const l = this._drawingManagerService.getDrawingOKey(s);
628
- if (l == null)
623
+ let { width: l, height: m } = o;
624
+ const g = this._drawingManagerService.getDrawingOKey(s);
625
+ if (g == null)
629
626
  continue;
630
- t == null && (t = l.unitId), r == null && (r = l.subUnitId);
631
- const f = this._transformerCache.get(l.drawingId);
627
+ t == null && (t = g.unitId), r == null && (r = g.subUnitId);
628
+ const f = this._transformerCache.get(g.drawingId);
632
629
  if (f == null)
633
630
  continue;
634
- const { drawing: u, top: v, left: w, width: I, height: O, angle: C } = f, { width: T, height: M } = this._getPageContentSize(u);
635
- if (g = Math.min(g, T), m = Math.min(m, M), (I !== g || O !== m) && n.push({
636
- drawingId: l.drawingId,
631
+ const { drawing: u, top: v, left: w, width: I, height: O, angle: C } = f, { width: T, height: b } = this._getPageContentSize(u);
632
+ if (l = Math.min(l, T), m = Math.min(m, b), (I !== l || O !== m) && n.push({
633
+ drawingId: g.drawingId,
637
634
  key: "size",
638
635
  value: {
639
- width: g,
636
+ width: l,
640
637
  height: m
641
638
  }
642
639
  }), C !== c && n.push({
643
- drawingId: l.drawingId,
640
+ drawingId: g.drawingId,
644
641
  key: "angle",
645
642
  value: c
646
643
  }), v !== d || w !== a) {
647
644
  const P = d - v, N = a - w;
648
645
  P !== 0 && n.push({
649
- drawingId: l.drawingId,
646
+ drawingId: g.drawingId,
650
647
  key: "positionV",
651
648
  value: {
652
649
  relativeFrom: u.docTransform.positionV.relativeFrom,
653
650
  posOffset: u.docTransform.positionV.posOffset + P
654
651
  }
655
652
  }), N !== 0 && n.push({
656
- drawingId: l.drawingId,
653
+ drawingId: g.drawingId,
657
654
  key: "positionH",
658
655
  value: {
659
656
  relativeFrom: u.docTransform.positionH.relativeFrom,
@@ -688,9 +685,9 @@ let an = class extends Ge {
688
685
  if (r == null)
689
686
  return;
690
687
  const { mainComponent: s, scene: a } = r, d = s, c = a.getViewports()[0], {
691
- pageLayoutType: g = Ln.VERTICAL,
688
+ pageLayoutType: l = Ln.VERTICAL,
692
689
  pageMarginLeft: m,
693
- pageMarginTop: l
690
+ pageMarginTop: g
694
691
  } = d.getOffsetConfig();
695
692
  let f = null, u = !1, v = -1, w = "";
696
693
  const I = 0.5, O = this._getTransformCoordForDocumentOffset(d, c, n, t);
@@ -699,7 +696,7 @@ let an = class extends Ge {
699
696
  const C = (x = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : x.with(Re);
700
697
  if (C == null)
701
698
  return;
702
- const T = o == null ? void 0 : o.findNodeByCoord(O, g, m, l, {
699
+ const T = o == null ? void 0 : o.findNodeByCoord(O, l, m, g, {
703
700
  strict: !1,
704
701
  segmentId: C.getSegment(),
705
702
  segmentPage: C.getSegmentPage()
@@ -710,13 +707,13 @@ let an = class extends Ge {
710
707
  }
711
708
  if (f == null)
712
709
  return;
713
- const M = o == null ? void 0 : o.findPositionByGlyph(f, v), P = this._getDocObject();
714
- if (M == null || o == null || P == null || Xn(M))
710
+ const b = o == null ? void 0 : o.findPositionByGlyph(f, v), P = this._getDocObject();
711
+ if (b == null || o == null || P == null || Xn(b))
715
712
  return;
716
713
  const N = {
717
- ...M,
714
+ ...b,
718
715
  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 : {};
716
+ }, B = P.document.getOffsetConfig(), E = new Fn(B, o), { cursorList: _, contentBoxPointGroup: L } = E.getRangePointData(N, N), { startOffset: G } = (V = kn(_)) != null ? V : {};
720
717
  if (G != null)
721
718
  return { offset: G, contentBoxPointGroup: L, segmentId: w, segmentPage: v };
722
719
  }
@@ -726,61 +723,61 @@ let an = class extends Ge {
726
723
  const t = this._renderManagerService.getRenderById(e.unitId), r = t == null ? void 0 : t.with(te).getSkeleton(), o = r == null ? void 0 : r.getSkeletonData();
727
724
  if (o == null || t == null)
728
725
  return;
729
- const { pages: s, skeHeaders: a, skeFooters: d } = o, { mainComponent: c, scene: g } = t, m = c, l = g.getViewports()[0], { pageLayoutType: f = Ln.VERTICAL, pageMarginLeft: u, pageMarginTop: v, docsLeft: w, docsTop: I } = m.getOffsetConfig(), { left: O, top: C, angle: T } = n;
730
- let { width: M, height: P } = n;
726
+ 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: v, docsLeft: w, docsTop: I } = m.getOffsetConfig(), { left: O, top: C, angle: T } = n;
727
+ let { width: b, height: P } = n;
731
728
  const { positionV: N, positionH: B } = e.docTransform, { width: E, height: _ } = this._getPageContentSize(e);
732
- M = Math.min(M, E), P = Math.min(P, _);
729
+ b = Math.min(b, E), P = Math.min(P, _);
733
730
  let L = null, G = "", x = -1;
734
731
  const V = !1, S = {
735
732
  ...e.docTransform,
736
733
  size: {
737
- width: M,
734
+ width: b,
738
735
  height: P
739
736
  },
740
737
  angle: T
741
- }, { x: D, y: R } = g.getViewportScrollXY(l), y = this._getTransformCoordForDocumentOffset(m, l, O - D, C - R);
738
+ }, { x: D, y: R } = l.getViewportScrollXY(g), y = this._getTransformCoordForDocumentOffset(m, g, O - D, C - R);
742
739
  if (y == null)
743
740
  return;
744
741
  const U = (De = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : De.with(Re);
745
742
  if (U == null)
746
743
  return;
747
- const k = r == null ? void 0 : r.findNodeByCoord(y, f, u, v, {
744
+ const F = r == null ? void 0 : r.findNodeByCoord(y, f, u, v, {
748
745
  strict: !1,
749
746
  segmentId: U.getSegment(),
750
747
  segmentPage: U.getSegmentPage()
751
748
  });
752
- if (k) {
753
- const { node: we, segmentPage: hn, segmentId: pn } = k;
754
- L = we, x = hn, G = pn;
749
+ if (F) {
750
+ const { node: we, segmentPage: fn, segmentId: pn } = F;
751
+ L = we, x = fn, G = pn;
755
752
  }
756
753
  if (L == null)
757
754
  return;
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)
755
+ const M = (Ce = L.parent) == null ? void 0 : Ce.parent, A = M == null ? void 0 : M.parent, z = (de = A == null ? void 0 : A.lines.find((we) => we.paragraphIndex === (M == null ? void 0 : M.paragraphIndex) && we.paragraphStart)) != null ? de : A == null ? void 0 : A.lines[0], k = (Te = A == null ? void 0 : A.parent) == null ? void 0 : Te.parent;
756
+ if (M == null || A == null || z == null || k == null)
760
757
  return;
761
758
  this._liquid.reset();
762
- const Z = F.type;
759
+ const Z = k.type;
763
760
  for (const we of s) {
764
- const { headerId: hn, footerId: pn, pageHeight: Rt, pageWidth: bn, marginLeft: Mn, marginBottom: Et } = we, Nt = s.indexOf(we);
761
+ const { headerId: fn, footerId: pn, pageHeight: Rt, pageWidth: Mn, marginLeft: bn, marginBottom: Et } = we, Nt = s.indexOf(we);
765
762
  if (x > -1 && Nt === x) {
766
763
  switch (Z) {
767
764
  case Un.HEADER: {
768
- const je = (ye = a.get(hn)) == null ? void 0 : ye.get(bn);
765
+ const je = (ye = a.get(fn)) == null ? void 0 : ye.get(Mn);
769
766
  if (je)
770
767
  this._liquid.translatePagePadding({
771
768
  marginTop: je.marginTop,
772
- marginLeft: Mn
769
+ marginLeft: bn
773
770
  });
774
771
  else
775
772
  throw new Error("header skeleton not found");
776
773
  break;
777
774
  }
778
775
  case Un.FOOTER: {
779
- const je = (Ne = d.get(pn)) == null ? void 0 : Ne.get(bn);
776
+ const je = (Ne = d.get(pn)) == null ? void 0 : Ne.get(Mn);
780
777
  if (je)
781
778
  this._liquid.translatePagePadding({
782
779
  marginTop: Rt - Et + je.marginTop,
783
- marginLeft: Mn
780
+ marginLeft: bn
784
781
  });
785
782
  else
786
783
  throw new Error("footer skeleton not found");
@@ -789,16 +786,16 @@ let an = class extends Ge {
789
786
  }
790
787
  break;
791
788
  }
792
- if (this._liquid.translatePagePadding(we), we === F)
789
+ if (this._liquid.translatePagePadding(we), we === k)
793
790
  break;
794
791
  this._liquid.restorePagePadding(we), this._liquid.translatePage(we, f, u, v);
795
792
  }
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 = {
793
+ switch (N.relativeFrom === H.LINE ? L = M.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
794
  relativeFrom: B.relativeFrom,
798
795
  posOffset: O - this._liquid.x - w
799
796
  }, B.relativeFrom) {
800
797
  case ee.MARGIN: {
801
- S.positionH.posOffset = O - this._liquid.x - w - F.marginLeft;
798
+ S.positionH.posOffset = O - this._liquid.x - w - k.marginLeft;
802
799
  break;
803
800
  }
804
801
  case ee.COLUMN: {
@@ -811,11 +808,11 @@ let an = class extends Ge {
811
808
  posOffset: C - this._liquid.y - I
812
809
  }, N.relativeFrom) {
813
810
  case H.PAGE: {
814
- S.positionV.posOffset = C - this._liquid.y - I - F.marginTop;
811
+ S.positionV.posOffset = C - this._liquid.y - I - k.marginTop;
815
812
  break;
816
813
  }
817
814
  case H.LINE: {
818
- S.positionV.posOffset = C - this._liquid.y - I - b.top;
815
+ S.positionV.posOffset = C - this._liquid.y - I - M.top;
819
816
  break;
820
817
  }
821
818
  case H.PARAGRAPH: {
@@ -831,26 +828,26 @@ let an = class extends Ge {
831
828
  const Ee = {
832
829
  ...ae,
833
830
  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 : {};
831
+ }, Ve = Be.document.getOffsetConfig(), ce = new Fn(Ve, r), { cursorList: ie } = ce.getRangePointData(Ee, Ee), { startOffset: re } = (xe = kn(ie)) != null ? xe : {};
835
832
  if (re != null)
836
833
  return { offset: re, docTransform: S, segmentId: G, segmentPage: x };
837
834
  }
838
835
  // Update drawing when use transformer to resize it.
839
836
  _updateDrawingSize(e, n) {
840
837
  const t = [], { drawing: r, width: o, height: s, angle: a } = e, { unitId: d, subUnitId: c } = r;
841
- let { width: g, height: m, angle: l } = n;
838
+ let { width: l, height: m, angle: g } = n;
842
839
  const { width: f, height: u } = this._getPageContentSize(r);
843
- g = Math.min(f, g), m = Math.min(u, m), (g !== o || m !== s) && t.push({
840
+ l = Math.min(f, l), m = Math.min(u, m), (l !== o || m !== s) && t.push({
844
841
  drawingId: r.drawingId,
845
842
  key: "size",
846
843
  value: {
847
- width: g,
844
+ width: l,
848
845
  height: m
849
846
  }
850
- }), l !== a && t.push({
847
+ }), g !== a && t.push({
851
848
  drawingId: r.drawingId,
852
849
  key: "angle",
853
- value: l
850
+ value: g
854
851
  }), t.length > 0 && d && c && this._commandService.executeCommand(Ke.id, {
855
852
  unitId: d,
856
853
  subUnitId: c,
@@ -873,8 +870,8 @@ let an = class extends Ge {
873
870
  // Limit the drawing to the page area, mainly in the vertical direction,
874
871
  // and the upper and lower limits cannot exceed the page margin area.
875
872
  _limitDrawingInPage(e, n) {
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(), g = c == null ? void 0 : c.getSkeletonData(), { pages: m } = g != null ? g : {};
877
- if (g == null || t == null || m == null)
873
+ 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 : {};
874
+ if (l == null || t == null || m == null)
878
875
  return {
879
876
  left: r,
880
877
  top: o,
@@ -882,21 +879,21 @@ let an = class extends Ge {
882
879
  height: a,
883
880
  angle: d
884
881
  };
885
- const { mainComponent: l } = t, f = l, { top: u, pageLayoutType: v, pageMarginLeft: w, pageMarginTop: I } = f;
882
+ const { mainComponent: g } = t, f = g, { top: u, pageLayoutType: v, pageMarginLeft: w, pageMarginTop: I } = f;
886
883
  let O = o;
887
884
  this._liquid.reset();
888
885
  for (const C of m) {
889
- const { marginBottom: T, pageHeight: M } = C, P = m.indexOf(C), N = m[P + 1];
886
+ const { marginBottom: T, pageHeight: b } = C, P = m.indexOf(C), N = m[P + 1];
890
887
  if (N == null)
891
888
  continue;
892
- if (Me.hasIntersectionBetweenTwoRanges(
889
+ if (be.hasIntersectionBetweenTwoRanges(
893
890
  o,
894
891
  o + a,
895
- this._liquid.y + u + M - T,
896
- this._liquid.y + u + M + I + N.marginTop
892
+ this._liquid.y + u + b - T,
893
+ this._liquid.y + u + b + I + N.marginTop
897
894
  )) {
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);
895
+ const E = o + a / 2, _ = this._liquid.y + u + b + I / 2;
896
+ E < _ ? O = Math.min(o, this._liquid.y + u + b - T - a) : O = Math.max(o, this._liquid.y + u + b + I + N.marginTop);
900
897
  }
901
898
  this._liquid.translatePage(C, v, w, I);
902
899
  }
@@ -913,7 +910,7 @@ let an = class extends Ge {
913
910
  if (t && r.top !== n.top)
914
911
  return;
915
912
  const o = this._getDrawingAnchor(e, r), { offset: s, docTransform: a, segmentId: d, segmentPage: c } = o != null ? o : {};
916
- return s == null || a == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId, n]])) : this._commandService.executeCommand(ft.id, {
913
+ return s == null || a == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId, n]])) : this._commandService.executeCommand(ht.id, {
917
914
  unitId: e.unitId,
918
915
  subUnitId: e.unitId,
919
916
  drawing: e,
@@ -933,7 +930,7 @@ let an = class extends Ge {
933
930
  return { scene: t, transformer: r };
934
931
  }
935
932
  _getTransformCoordForDocumentOffset(e, n, t, r) {
936
- const { documentTransform: o } = e.getOffsetConfig(), s = n.transformVector2SceneCoord(mi.FromArray([t, r]));
933
+ const { documentTransform: o } = e.getOffsetConfig(), s = n.transformVector2SceneCoord(gi.FromArray([t, r]));
937
934
  if (s)
938
935
  return o.clone().invert().applyPoint(s);
939
936
  }
@@ -944,23 +941,23 @@ let an = class extends Ge {
944
941
  const { mainComponent: r, scene: o } = t, s = r, {
945
942
  docsLeft: a,
946
943
  docsTop: d
947
- } = s.getOffsetConfig(), c = yi(n), { left: g, top: m, height: l } = c, f = g + a, u = m + d;
944
+ } = s.getOffsetConfig(), c = Ti(n), { left: l, top: m, height: g } = c, f = l + a, u = m + d;
948
945
  if (this._anchorShape) {
949
- this._anchorShape.transformByState({ left: f, top: u, height: l }), this._anchorShape.show();
946
+ this._anchorShape.transformByState({ left: f, top: u, height: g }), this._anchorShape.show();
950
947
  return;
951
948
  }
952
- const v = 6, w = new ui($i + Me.generateRandomId(v), {
949
+ const v = 6, w = new mi(ji + be.generateRandomId(v), {
953
950
  left: f,
954
951
  top: u,
955
- height: l,
952
+ height: g,
956
953
  strokeWidth: 2,
957
- stroke: fi(kt.darkGray, 1),
954
+ stroke: ui(Bt.darkGray, 1),
958
955
  evented: !1
959
956
  });
960
- this._anchorShape = w, o.addObject(w, Pi);
957
+ this._anchorShape = w, o.addObject(w, yi);
961
958
  }
962
959
  _getDocObject() {
963
- return bi(this._univerInstanceService, this._renderManagerService);
960
+ return Pi(this._univerInstanceService, this._renderManagerService);
964
961
  }
965
962
  _getPageContentSize(e) {
966
963
  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();
@@ -972,17 +969,17 @@ let an = class extends Ge {
972
969
  const { pages: a } = s;
973
970
  let d = null;
974
971
  for (const c of a) {
975
- const { skeDrawings: g } = c;
976
- if (g.has(e.drawingId)) {
972
+ const { skeDrawings: l } = c;
973
+ if (l.has(e.drawingId)) {
977
974
  d = c;
978
975
  break;
979
976
  }
980
977
  }
981
978
  if (d) {
982
- const { pageWidth: c, pageHeight: g, marginLeft: m, marginBottom: l, marginRight: f, marginTop: u } = d;
979
+ const { pageWidth: c, pageHeight: l, marginLeft: m, marginBottom: g, marginRight: f, marginTop: u } = d;
983
980
  return {
984
981
  width: Math.max(r, c - m - f),
985
- height: Math.max(o, g - u - l)
982
+ height: Math.max(o, l - u - g)
986
983
  };
987
984
  } else
988
985
  return {
@@ -991,38 +988,38 @@ let an = class extends Ge {
991
988
  };
992
989
  }
993
990
  };
994
- an = ji([
991
+ an = Vi([
995
992
  Je(0, $),
996
993
  Je(1, q),
997
994
  Je(2, _e),
998
995
  Je(3, J)
999
996
  ], an);
1000
- var he = function() {
1001
- return he = Object.assign || function(i) {
997
+ var fe = function() {
998
+ return fe = Object.assign || function(i) {
1002
999
  for (var e, n = 1, t = arguments.length; n < t; n++) {
1003
1000
  e = arguments[n];
1004
1001
  for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (i[r] = e[r]);
1005
1002
  }
1006
1003
  return i;
1007
- }, he.apply(this, arguments);
1008
- }, zi = function(i, e) {
1004
+ }, fe.apply(this, arguments);
1005
+ }, $i = function(i, e) {
1009
1006
  var n = {};
1010
1007
  for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]);
1011
1008
  if (i != null && typeof Object.getOwnPropertySymbols == "function")
1012
1009
  for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
1013
1010
  e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
1014
1011
  return n;
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);
1012
+ }, ft = at(function(i, e) {
1013
+ var n = i.icon, t = i.id, r = i.className, o = i.extend, s = $i(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), d = Li("_".concat(qi()));
1014
+ return pt(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, fe({ ref: e, className: a }, s), o);
1018
1015
  });
1019
1016
  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) {
1017
+ return ct(i.tag, fe(fe({ key: e }, zi(i, n, r)), t), (Xi(i, n).children || []).map(function(o, s) {
1021
1018
  return pt(o, "".concat(e, "-").concat(i.tag, "-").concat(s), n, void 0, r);
1022
1019
  }));
1023
1020
  }
1024
- function Xi(i, e, n) {
1025
- var t = he({}, i.attrs);
1021
+ function zi(i, e, n) {
1022
+ var t = fe({}, i.attrs);
1026
1023
  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) {
1027
1024
  var s = o[0], a = o[1];
1028
1025
  s === "mask" && typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
@@ -1033,21 +1030,21 @@ function Xi(i, e, n) {
1033
1030
  typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
1034
1031
  })), t;
1035
1032
  }
1036
- function qi(i, e) {
1033
+ function Xi(i, e) {
1037
1034
  var n, t = e.defIds;
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) {
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;
1035
+ return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? fe(fe({}, i), { children: i.children.map(function(r) {
1036
+ return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? fe(fe({}, r), { attrs: fe(fe({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
1040
1037
  }) }) : i;
1041
1038
  }
1042
- function Ki() {
1039
+ function qi() {
1043
1040
  return Math.random().toString(36).substring(2, 8);
1044
1041
  }
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, {
1042
+ ft.displayName = "UniverIcon";
1043
+ 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" } }] }, wt = at(function(i, e) {
1044
+ return ct(ft, Object.assign({}, i, {
1048
1045
  id: "add-image-single",
1049
1046
  ref: e,
1050
- icon: Yi
1047
+ icon: Ki
1051
1048
  }));
1052
1049
  });
1053
1050
  wt.displayName = "AddImageSingle";
@@ -1056,13 +1053,13 @@ const yn = {
1056
1053
  type: Y.COMMAND,
1057
1054
  // eslint-disable-next-line max-lines-per-function
1058
1055
  handler: (i, e) => {
1059
- var M, P, N, B;
1056
+ var b, P, N, B;
1060
1057
  const n = i.get($), t = i.get(q), r = i.get(J), o = t.getCurrentUniverDocInstance();
1061
1058
  if (e == null || o == null)
1062
1059
  return !1;
1063
- const s = r.getRenderById(e.unitId).with(Re), { drawings: a } = e, d = (M = s.getSegment()) != null ? M : "", c = new Dn(), g = X.getInstance(), m = (N = (P = o.getSelfOrHeaderFooterModel(d).getBody()) == null ? void 0 : P.customBlocks) != null ? N : [], l = 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();
1060
+ const s = r.getRenderById(e.unitId).with(Re), { drawings: a } = e, d = (b = s.getSegment()) != null ? b : "", c = new Dn(), 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
1061
  u.reset();
1065
- const v = l[0].startIndex, w = [
1062
+ const v = g[0].startIndex, w = [
1066
1063
  {
1067
1064
  startOffset: v,
1068
1065
  endOffset: v
@@ -1075,7 +1072,7 @@ const yn = {
1075
1072
  textRanges: w
1076
1073
  }
1077
1074
  }, O = [];
1078
- for (const E of l) {
1075
+ for (const E of g) {
1079
1076
  const { startIndex: _ } = E;
1080
1077
  _ > u.cursor && c.push({
1081
1078
  t: Q.RETAIN,
@@ -1086,9 +1083,9 @@ const yn = {
1086
1083
  }), u.moveCursorTo(_ + 1);
1087
1084
  }
1088
1085
  const C = qe(o, d);
1089
- O.push(g.editOp(c.serialize(), C));
1090
- for (const E of l) {
1091
- const { blockId: _ } = E, L = ((B = o.getDrawings()) != null ? B : {})[_], x = o.getDrawingsOrder().indexOf(_), V = g.removeOp(["drawings", _], L), S = g.removeOp(["drawingsOrder", x], _);
1086
+ O.push(l.editOp(c.serialize(), C));
1087
+ for (const E of g) {
1088
+ const { blockId: _ } = E, L = ((B = o.getDrawings()) != null ? B : {})[_], x = o.getDrawingsOrder().indexOf(_), V = l.removeOp(["drawings", _], L), S = l.removeOp(["drawingsOrder", x], _);
1092
1089
  O.push(V), O.push(S);
1093
1090
  }
1094
1091
  return I.params.actions = O.reduce((E, _) => X.compose(E, _), null), !!n.syncExecuteCommand(I.id, I.params);
@@ -1101,12 +1098,12 @@ const yn = {
1101
1098
  if (t.length === 0)
1102
1099
  return !1;
1103
1100
  const { unitId: r } = t[0], o = t.map((s) => {
1104
- const { unitId: a, subUnitId: d, drawingId: c, drawingType: g } = s;
1101
+ const { unitId: a, subUnitId: d, drawingId: c, drawingType: l } = s;
1105
1102
  return {
1106
1103
  unitId: a,
1107
1104
  subUnitId: d,
1108
1105
  drawingId: c,
1109
- drawingType: g
1106
+ drawingType: l
1110
1107
  };
1111
1108
  });
1112
1109
  return e.executeCommand(yn.id, {
@@ -1122,9 +1119,9 @@ const yn = {
1122
1119
  const n = i.get(Ue);
1123
1120
  if (!e) return !1;
1124
1121
  const t = [];
1125
- e.forEach(({ parent: g, children: m }) => {
1126
- t.push(g.unitId), m.forEach((l) => {
1127
- t.push(l.unitId);
1122
+ e.forEach(({ parent: l, children: m }) => {
1123
+ t.push(l.unitId), m.forEach((g) => {
1124
+ t.push(g.unitId);
1128
1125
  });
1129
1126
  });
1130
1127
  const r = n.getGroupDrawingOp(e), { unitId: o, subUnitId: s, undo: a, redo: d, objects: c } = r;
@@ -1141,20 +1138,20 @@ const yn = {
1141
1138
  const n = i.get($), t = i.get(On), r = i.get(q), o = t.getActiveTextRange(), s = r.getCurrentUniverDocInstance();
1142
1139
  if (o == null || s == null)
1143
1140
  return !1;
1144
- const a = s.getUnitId(), { drawings: d } = e, { collapsed: c, startOffset: g, segmentId: m } = o, l = s.getSelfOrHeaderFooterModel(m).getBody();
1145
- if (l == null)
1141
+ const a = s.getUnitId(), { drawings: d } = e, { collapsed: c, startOffset: l, segmentId: m } = o, g = s.getSelfOrHeaderFooterModel(m).getBody();
1142
+ if (g == null)
1146
1143
  return !1;
1147
1144
  const f = new Dn(), u = X.getInstance(), v = [], w = (N = (P = s.getSnapshot().drawingsOrder) == null ? void 0 : P.length) != null ? N : 0;
1148
1145
  let I = 0;
1149
1146
  if (c)
1150
- g > 0 && f.push({
1147
+ l > 0 && f.push({
1151
1148
  t: Q.RETAIN,
1152
- len: g
1149
+ len: l
1153
1150
  });
1154
1151
  else {
1155
- const _ = Wt.selection.delete([o], l, 0, null, !1);
1152
+ const _ = kt.selection.delete([o], g, 0, null, !1);
1156
1153
  f.push(..._);
1157
- const L = Mi(l, [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);
1154
+ 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
1155
  if (V.length > 0)
1159
1156
  for (const S of V) {
1160
1157
  const D = G[S], R = x.indexOf(S);
@@ -1202,12 +1199,12 @@ const yn = {
1202
1199
  let c;
1203
1200
  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)
1204
1201
  return !1;
1205
- const { redo: g } = c;
1206
- if (g == null)
1202
+ const { redo: l } = c;
1203
+ if (l == null)
1207
1204
  return !1;
1208
1205
  const m = [];
1209
- let l = Me.deepClone(g);
1210
- l = l.slice(3), l.unshift("drawingsOrder"), m.push(l);
1206
+ let g = be.deepClone(l);
1207
+ g = g.slice(3), g.unshift("drawingsOrder"), m.push(g);
1211
1208
  const f = {
1212
1209
  id: ne.id,
1213
1210
  params: {
@@ -1226,28 +1223,28 @@ const yn = {
1226
1223
  const n = i.get(Ue);
1227
1224
  if (!e) return !1;
1228
1225
  const t = [];
1229
- e.forEach(({ parent: g, children: m }) => {
1230
- t.push(g.unitId), m.forEach((l) => {
1231
- t.push(l.unitId);
1226
+ e.forEach(({ parent: l, children: m }) => {
1227
+ t.push(l.unitId), m.forEach((g) => {
1228
+ t.push(g.unitId);
1232
1229
  });
1233
1230
  });
1234
1231
  const r = n.getUngroupDrawingOp(e), { unitId: o, subUnitId: s, undo: a, redo: d, objects: c } = r;
1235
1232
  return !1;
1236
1233
  }
1237
1234
  };
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--)
1235
+ var Yi = Object.getOwnPropertyDescriptor, Zi = (i, e, n, t) => {
1236
+ for (var r = t > 1 ? void 0 : t ? Yi(e, n) : e, o = i.length - 1, s; o >= 0; o--)
1240
1237
  (s = i[o]) && (r = s(r) || r);
1241
1238
  return r;
1242
1239
  }, me = (i, e) => (n, t) => e(n, t, i);
1243
1240
  let cn = class extends Ge {
1244
- constructor(i, e, n, t, r, o, s, a, d, c, g, m, l) {
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 = g, this._docRefreshDrawingsService = m, this._fileOpenerService = l, this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._transformDrawingListener(), this._editAreaChangeListener();
1241
+ constructor(i, e, n, t, r, o, s, a, d, c, l, m, g) {
1242
+ 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();
1246
1243
  }
1247
1244
  async insertDocImage() {
1248
1245
  const i = await this._fileOpenerService.openFile({
1249
1246
  multiple: !0,
1250
- accept: ei.map((n) => `.${n.replace("image/", "")}`).join(",")
1247
+ accept: Jt.map((n) => `.${n.replace("image/", "")}`).join(",")
1251
1248
  }), e = i.length;
1252
1249
  return e > Nn ? (this._messageService.show({
1253
1250
  type: Vn.Error,
@@ -1264,7 +1261,7 @@ let cn = class extends Ge {
1264
1261
  let s = "";
1265
1262
  switch (o) {
1266
1263
  case vn.ERROR_EXCEED_SIZE:
1267
- s = this._localeService.t("update-status.exceedMaxSize", String(ni / (1024 * 1024)));
1264
+ s = this._localeService.t("update-status.exceedMaxSize", String(ei / (1024 * 1024)));
1268
1265
  break;
1269
1266
  case vn.ERROR_IMAGE_TYPE:
1270
1267
  s = this._localeService.t("update-status.invalidImageType");
@@ -1284,14 +1281,14 @@ let cn = class extends Ge {
1284
1281
  for (const r of e) {
1285
1282
  if (r == null)
1286
1283
  continue;
1287
- const { imageId: o, imageSourceType: s, source: a, base64Cache: d } = r, { width: c, height: g, image: m } = await ti(d || "");
1284
+ const { imageId: o, imageSourceType: s, source: a, base64Cache: d } = r, { width: c, height: l, image: m } = await ni(d || "");
1288
1285
  this._imageIoService.addImageSourceCache(o, s, m);
1289
- let l = 1;
1290
- if (c > An || g > xn) {
1291
- const w = An / c, I = xn / g;
1292
- l = Math.min(w, I);
1286
+ let g = 1;
1287
+ if (c > An || l > xn) {
1288
+ const w = An / c, I = xn / l;
1289
+ g = Math.min(w, I);
1293
1290
  }
1294
- const f = this._getImagePosition(c * l, g * l);
1291
+ const f = this._getImagePosition(c * g, l * g);
1295
1292
  if (f == null)
1296
1293
  return;
1297
1294
  const u = {
@@ -1407,10 +1404,10 @@ let cn = class extends Ge {
1407
1404
  if (((s = n == null ? void 0 : n.customBlocks) != null ? s : []).some((c) => c.blockId === i))
1408
1405
  return "";
1409
1406
  for (const c of Object.keys(t))
1410
- if ((a = t[c].body.customBlocks) != null && a.some((g) => g.blockId === i))
1407
+ if ((a = t[c].body.customBlocks) != null && a.some((l) => l.blockId === i))
1411
1408
  return c;
1412
1409
  for (const c of Object.keys(r))
1413
- if ((d = r[c].body.customBlocks) != null && d.some((g) => g.blockId === i))
1410
+ if ((d = r[c].body.customBlocks) != null && d.some((l) => l.blockId === i))
1414
1411
  return c;
1415
1412
  return "";
1416
1413
  }
@@ -1422,18 +1419,18 @@ let cn = class extends Ge {
1422
1419
  return;
1423
1420
  const r = i.getSnapshot(), { drawings: o = {} } = r, s = t.getEditArea() === We.BODY;
1424
1421
  for (const d of Object.keys(o)) {
1425
- const c = o[d], g = ii({ unitId: n, drawingId: c.drawingId, subUnitId: n }), m = e.fuzzyMathObjects(g, !0);
1422
+ const c = o[d], l = ti({ unitId: n, drawingId: c.drawingId, subUnitId: n }), m = e.fuzzyMathObjects(l, !0);
1426
1423
  if (m.length)
1427
- for (const l of m) {
1428
- e.detachTransformerFrom(l);
1424
+ for (const g of m) {
1425
+ e.detachTransformerFrom(g);
1429
1426
  try {
1430
- l.setOpacity(0.5);
1427
+ g.setOpacity(0.5);
1431
1428
  } catch {
1432
1429
  }
1433
1430
  if (s && c.isMultiTransform !== se.TRUE || !s && c.isMultiTransform === se.TRUE) {
1434
- c.allowTransform !== !1 && e.attachTransformerTo(l);
1431
+ c.allowTransform !== !1 && e.attachTransformerTo(g);
1435
1432
  try {
1436
- l.setOpacity(1);
1433
+ g.setOpacity(1);
1437
1434
  } catch {
1438
1435
  }
1439
1436
  }
@@ -1468,19 +1465,19 @@ let cn = class extends Ge {
1468
1465
  this._docSelectionManagerService.replaceDocRanges(t);
1469
1466
  }
1470
1467
  };
1471
- cn = Qi([
1468
+ cn = Zi([
1472
1469
  me(1, $),
1473
1470
  me(2, pe(On)),
1474
1471
  me(3, J),
1475
- me(4, Jt),
1472
+ me(4, Qt),
1476
1473
  me(5, Ue),
1477
1474
  me(6, _e),
1478
1475
  me(7, Zn),
1479
- me(8, wi),
1476
+ me(8, pi),
1480
1477
  me(9, pe(un)),
1481
1478
  me(10, pe(Re)),
1482
- me(11, pe(fn)),
1483
- me(12, vi)
1479
+ me(11, pe(hn)),
1480
+ me(12, wi)
1484
1481
  ], cn);
1485
1482
  const Dt = {
1486
1483
  id: "doc.command.insert-float-image",
@@ -1497,19 +1494,19 @@ const Dt = {
1497
1494
  const n = i.get($), t = i.get(Ue), r = i.get(q), o = i.get(J), { direction: s } = e, a = t.getFocusDrawings();
1498
1495
  if (a.length === 0)
1499
1496
  return !1;
1500
- const d = a[0].unitId, c = o.getRenderById(d), g = c == null ? void 0 : c.scene;
1501
- if (g == null)
1497
+ const d = a[0].unitId, c = o.getRenderById(d), l = c == null ? void 0 : c.scene;
1498
+ if (l == null)
1502
1499
  return !1;
1503
- const m = g.getTransformerByCreate(), l = r.getUniverDocInstance(d), f = a.map((v) => {
1500
+ const m = l.getTransformerByCreate(), g = r.getUniverDocInstance(d), f = a.map((v) => {
1504
1501
  var P, N, B, E, _;
1505
- const { drawingId: w } = v, I = (P = l == null ? void 0 : l.getSnapshot().drawings) == null ? void 0 : P[w];
1502
+ const { drawingId: w } = v, I = (P = g == null ? void 0 : g.getSnapshot().drawings) == null ? void 0 : P[w];
1506
1503
  if (I == null || I.layoutType === W.INLINE)
1507
1504
  return null;
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), {
1505
+ const { positionH: O, positionV: C } = I.docTransform, T = { ...O }, b = { ...C };
1506
+ return s === he.UP ? b.posOffset = ((N = b.posOffset) != null ? N : 0) - 2 : s === he.DOWN ? b.posOffset = ((B = b.posOffset) != null ? B : 0) + 2 : s === he.LEFT ? T.posOffset = ((E = T.posOffset) != null ? E : 0) - 2 : s === he.RIGHT && (T.posOffset = ((_ = T.posOffset) != null ? _ : 0) + 2), {
1510
1507
  drawingId: w,
1511
- key: s === fe.UP || s === fe.DOWN ? "positionV" : "positionH",
1512
- value: s === fe.UP || s === fe.DOWN ? M : T
1508
+ key: s === he.UP || s === he.DOWN ? "positionV" : "positionH",
1509
+ value: s === he.UP || s === he.DOWN ? b : T
1513
1510
  };
1514
1511
  }).filter((v) => v != null);
1515
1512
  if (f.length === 0)
@@ -1521,7 +1518,7 @@ const Dt = {
1521
1518
  });
1522
1519
  return m.refreshControls(), !!u;
1523
1520
  }
1524
- }, Ji = {
1521
+ }, Qi = {
1525
1522
  id: "doc.operation.clear-drawing-transformer",
1526
1523
  type: Y.MUTATION,
1527
1524
  handler: (i, e) => {
@@ -1535,7 +1532,7 @@ const Dt = {
1535
1532
  id: "sidebar.operation.doc-image",
1536
1533
  type: Y.COMMAND,
1537
1534
  handler: async (i, e) => {
1538
- const n = i.get(Ii), t = i.get(un), r = i.get(_e);
1535
+ const n = i.get(vi), t = i.get(un), r = i.get(_e);
1539
1536
  switch (e.value) {
1540
1537
  case "open":
1541
1538
  n.open({
@@ -1561,24 +1558,24 @@ const Dt = {
1561
1558
  const n = i.get(_e), t = i.get($);
1562
1559
  return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(Ot.id, { value: "open" }), !0);
1563
1560
  }
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", h = {
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) => {
1561
+ }, Ji = "univer-image-common-panel", er = "univer-image-common-panel-grid", nr = "univer-image-common-panel-border", tr = "univer-image-common-panel-title", ir = "univer-image-common-panel-subtitle", rr = "univer-image-common-panel-row", or = "univer-image-common-panel-column", sr = "univer-image-common-panel-span2", ar = "univer-image-common-panel-input", h = {
1562
+ imageCommonPanel: Ji,
1563
+ imageCommonPanelGrid: er,
1564
+ imageCommonPanelBorder: nr,
1565
+ imageCommonPanelTitle: tr,
1566
+ imageCommonPanelSubtitle: ir,
1567
+ imageCommonPanelRow: rr,
1568
+ imageCommonPanelColumn: or,
1569
+ imageCommonPanelSpan2: sr,
1570
+ imageCommonPanelInput: ar
1571
+ }, qn = -1e3, Kn = 1e3, cr = (i) => {
1575
1572
  const e = ve($), n = ve(un), t = ve(_e), r = ve(J), o = ve(q), { drawings: s } = i, a = s[0];
1576
1573
  if (a == null)
1577
1574
  return;
1578
- const { unitId: d } = a, c = o.getUniverDocInstance(d), g = c == null ? void 0 : c.getSnapshot().documentStyle.documentFlavor, m = r.getRenderById(d), l = m == null ? void 0 : m.scene;
1579
- if (l == null)
1575
+ 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;
1576
+ if (g == null)
1580
1577
  return;
1581
- const f = l.getTransformerByCreate(), u = [{
1578
+ const f = g.getTransformerByCreate(), u = [{
1582
1579
  label: n.t("image-position.column"),
1583
1580
  value: String(ee.COLUMN)
1584
1581
  }, {
@@ -1590,28 +1587,28 @@ const Dt = {
1590
1587
  }], v = [{
1591
1588
  label: n.t("image-position.line"),
1592
1589
  value: String(H.LINE),
1593
- disabled: g === wn.MODERN
1590
+ disabled: l === wn.MODERN
1594
1591
  }, {
1595
1592
  label: n.t("image-position.page"),
1596
1593
  value: String(H.PAGE),
1597
- disabled: g === wn.MODERN
1594
+ disabled: l === wn.MODERN
1598
1595
  }, {
1599
1596
  label: n.t("image-position.margin"),
1600
1597
  value: String(H.MARGIN),
1601
- disabled: g === wn.MODERN
1598
+ disabled: l === wn.MODERN
1602
1599
  }, {
1603
1600
  label: n.t("image-position.paragraph"),
1604
1601
  value: String(H.PARAGRAPH)
1605
1602
  }], [w, I] = oe(!0), [O, C] = oe({
1606
1603
  relativeFrom: ee.PAGE,
1607
1604
  posOffset: 0
1608
- }), [T, M] = oe({
1605
+ }), [T, b] = oe({
1609
1606
  relativeFrom: H.PAGE,
1610
1607
  posOffset: 0
1611
1608
  }), [P, N] = oe(!0), [B, E] = oe(!0);
1612
1609
  function _(D, R) {
1613
- var b;
1614
- D === "positionH" ? C(R) : M(R);
1610
+ var M;
1611
+ D === "positionH" ? C(R) : b(R);
1615
1612
  const y = t.getFocusDrawings();
1616
1613
  if (y.length === 0)
1617
1614
  return;
@@ -1629,44 +1626,44 @@ const Dt = {
1629
1626
  value: R
1630
1627
  }))
1631
1628
  });
1632
- const k = (b = r.getRenderById(d)) == null ? void 0 : b.with(Re);
1633
- k && k.blur(), f.refreshControls();
1629
+ const F = (M = r.getRenderById(d)) == null ? void 0 : M.with(Re);
1630
+ F && F.blur(), f.refreshControls();
1634
1631
  }
1635
1632
  function L(D) {
1636
1633
  var re, De, Ce;
1637
1634
  const R = O.relativeFrom, y = O.posOffset, U = Number(D);
1638
1635
  if (R === U)
1639
1636
  return;
1640
- const k = t.getFocusDrawings();
1641
- if (k.length === 0)
1637
+ const F = t.getFocusDrawings();
1638
+ if (F.length === 0)
1642
1639
  return;
1643
- const b = k[0].drawingId, A = k[0].unitId;
1644
- let z = null, F = 0;
1640
+ const M = F[0].drawingId, A = F[0].unitId;
1641
+ let z = null, k = 0;
1645
1642
  const Z = (re = r.getRenderById(A)) == null ? void 0 : re.with(te).getSkeleton(), ae = Z == null ? void 0 : Z.getSkeletonData();
1646
1643
  if (ae == null)
1647
1644
  return;
1648
1645
  const { pages: Be, skeHeaders: Ee, skeFooters: Ve } = ae;
1649
1646
  for (const de of Be) {
1650
1647
  const { marginLeft: Te, skeDrawings: ye, headerId: Ne, footerId: Ae, pageWidth: Pe } = de;
1651
- if (ye.has(b)) {
1652
- z = ye.get(b), F = Te;
1648
+ if (ye.has(M)) {
1649
+ z = ye.get(M), k = Te;
1653
1650
  break;
1654
1651
  }
1655
1652
  const le = (De = Ee.get(Ne)) == null ? void 0 : De.get(Pe);
1656
- if (le != null && le.skeDrawings.has(b)) {
1657
- z = le == null ? void 0 : le.skeDrawings.get(b), F = Te;
1653
+ if (le != null && le.skeDrawings.has(M)) {
1654
+ z = le == null ? void 0 : le.skeDrawings.get(M), k = Te;
1658
1655
  break;
1659
1656
  }
1660
1657
  const ge = (Ce = Ve.get(Ae)) == null ? void 0 : Ce.get(Pe);
1661
- if (ge != null && ge.skeDrawings.has(b)) {
1662
- z = ge == null ? void 0 : ge.skeDrawings.get(b), F = Te;
1658
+ if (ge != null && ge.skeDrawings.has(M)) {
1659
+ z = ge == null ? void 0 : ge.skeDrawings.get(M), k = Te;
1663
1660
  break;
1664
1661
  }
1665
1662
  }
1666
1663
  if (z == null)
1667
1664
  return;
1668
1665
  let ce = 0;
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;
1666
+ R === ee.COLUMN ? ce -= z.columnLeft : R === ee.MARGIN && (ce -= k), U === ee.COLUMN ? ce += z.columnLeft : U === ee.MARGIN ? ce += k : ee.PAGE;
1670
1667
  const ie = {
1671
1668
  relativeFrom: U,
1672
1669
  posOffset: (y != null ? y : 0) - ce
@@ -1678,13 +1675,13 @@ const Dt = {
1678
1675
  const R = T.relativeFrom, y = T.posOffset, U = Number(D);
1679
1676
  if (R === U)
1680
1677
  return;
1681
- const k = t.getFocusDrawings();
1682
- if (k.length === 0)
1678
+ const F = t.getFocusDrawings();
1679
+ if (F.length === 0)
1683
1680
  return;
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)
1681
+ const { drawingId: M, unitId: A } = F[0], z = o.getUniverDocInstance(A), k = (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 === M);
1682
+ if (Ee == null || k == null || Z == null)
1686
1683
  return;
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;
1684
+ const { startIndex: Ve } = Ee, ce = k.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
1685
  if (ce == null || ie == null || De == null || re == null || Ce == null)
1689
1686
  return;
1690
1687
  let de = 0;
@@ -1701,10 +1698,10 @@ const Dt = {
1701
1698
  if (y == null)
1702
1699
  return;
1703
1700
  const { layoutType: U } = y, {
1704
- positionH: k,
1705
- positionV: b
1701
+ positionH: F,
1702
+ positionV: M
1706
1703
  } = y.docTransform;
1707
- C(k), M(b), I(U === W.INLINE), N(b.relativeFrom === H.PARAGRAPH || b.relativeFrom === H.LINE);
1704
+ C(F), b(M), I(U === W.INLINE), N(M.relativeFrom === H.PARAGRAPH || M.relativeFrom === H.LINE);
1708
1705
  }
1709
1706
  function V() {
1710
1707
  const D = t.getFocusDrawings();
@@ -1734,7 +1731,7 @@ const Dt = {
1734
1731
  /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn, h.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
1735
1732
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: n.t("image-position.absolutePosition") }) }),
1736
1733
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: /* @__PURE__ */ p(
1737
- Fe,
1734
+ ke,
1738
1735
  {
1739
1736
  min: qn,
1740
1737
  max: Kn,
@@ -1769,7 +1766,7 @@ const Dt = {
1769
1766
  /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn, h.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
1770
1767
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: n.t("image-position.absolutePosition") }) }),
1771
1768
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: /* @__PURE__ */ p(
1772
- Fe,
1769
+ ke,
1773
1770
  {
1774
1771
  min: qn,
1775
1772
  max: Kn,
@@ -1800,16 +1797,16 @@ const Dt = {
1800
1797
  ] }) })
1801
1798
  ] }),
1802
1799
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn, h.imageCommonPanelSubtitle), children: /* @__PURE__ */ p("div", { children: n.t("image-position.options") }) }) }),
1803
- /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, style: { marginBottom: "50px" }, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: /* @__PURE__ */ p(Li, { disabled: w, checked: P, onChange: S, children: n.t("image-position.moveObjectWithText") }) }) })
1800
+ /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, style: { marginBottom: "50px" }, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: /* @__PURE__ */ p(xi, { disabled: w, checked: P, onChange: S, children: n.t("image-position.moveObjectWithText") }) }) })
1804
1801
  ] });
1805
- }, en = 0, nn = 100, lr = (i) => {
1802
+ }, en = 0, nn = 100, dr = (i) => {
1806
1803
  const e = ve($), n = ve(un), t = ve(_e), r = ve(J), o = ve(q), { drawings: s } = i, a = s[0];
1807
1804
  if (a == null)
1808
1805
  return null;
1809
- const { unitId: d } = a, c = o.getUniverDocInstance(d), g = r.getRenderById(d);
1810
- if ((g == null ? void 0 : g.scene) == null)
1806
+ const { unitId: d } = a, c = o.getUniverDocInstance(d), l = r.getRenderById(d);
1807
+ if ((l == null ? void 0 : l.scene) == null)
1811
1808
  return null;
1812
- const [l, f] = oe(!0), [u, v] = oe(!0), [w, I] = oe(!0), [O, C] = oe(ue.INLINE), [T, M] = oe(""), [P, N] = oe({
1809
+ const [g, f] = oe(!0), [u, v] = oe(!0), [w, I] = oe(!0), [O, C] = oe(ue.INLINE), [T, b] = oe(""), [P, N] = oe({
1813
1810
  distT: 0,
1814
1811
  distL: 0,
1815
1812
  distB: 0,
@@ -1820,9 +1817,9 @@ const Dt = {
1820
1817
  const D = t.getFocusDrawings();
1821
1818
  if (D.length === 0)
1822
1819
  return;
1823
- const { unitId: R, subUnitId: y } = D[0], U = D.map(({ unitId: k, subUnitId: b, drawingId: A }) => ({
1824
- unitId: k,
1825
- subUnitId: b,
1820
+ const { unitId: R, subUnitId: y } = D[0], U = D.map(({ unitId: F, subUnitId: M, drawingId: A }) => ({
1821
+ unitId: F,
1822
+ subUnitId: M,
1826
1823
  drawingId: A
1827
1824
  }));
1828
1825
  e.executeCommand(lt.id, {
@@ -1833,7 +1830,7 @@ const Dt = {
1833
1830
  });
1834
1831
  }
1835
1832
  function L(S) {
1836
- M(S);
1833
+ b(S);
1837
1834
  const D = t.getFocusDrawings();
1838
1835
  if (D.length === 0)
1839
1836
  return;
@@ -1857,10 +1854,10 @@ const Dt = {
1857
1854
  const y = t.getFocusDrawings();
1858
1855
  if (y.length === 0)
1859
1856
  return;
1860
- const U = y.map((k) => ({
1861
- unitId: k.unitId,
1862
- subUnitId: k.subUnitId,
1863
- drawingId: k.drawingId
1857
+ const U = y.map((F) => ({
1858
+ unitId: F.unitId,
1859
+ subUnitId: F.subUnitId,
1860
+ drawingId: F.drawingId
1864
1861
  }));
1865
1862
  e.executeCommand(gt.id, {
1866
1863
  unitId: y[0].unitId,
@@ -1884,8 +1881,8 @@ const Dt = {
1884
1881
  distT: R = 0,
1885
1882
  distL: y = 0,
1886
1883
  distB: U = 0,
1887
- distR: k = 0,
1888
- layoutType: b = W.INLINE,
1884
+ distR: F = 0,
1885
+ layoutType: M = W.INLINE,
1889
1886
  behindDoc: A = se.FALSE,
1890
1887
  wrapText: z = Xe.BOTH_SIDES
1891
1888
  } = D;
@@ -1893,11 +1890,11 @@ const Dt = {
1893
1890
  distT: R,
1894
1891
  distL: y,
1895
1892
  distB: U,
1896
- distR: k
1897
- }), M(z), f(b !== W.WRAP_SQUARE), b === W.WRAP_NONE || b === W.INLINE ? v(!0) : v(!1), b === W.WRAP_NONE || b === W.INLINE || b === W.WRAP_TOP_AND_BOTTOM ? I(!0) : I(!1), b === W.WRAP_NONE)
1893
+ distR: F
1894
+ }), b(z), f(M !== W.WRAP_SQUARE), M === W.WRAP_NONE || M === W.INLINE ? v(!0) : v(!1), M === W.WRAP_NONE || M === W.INLINE || M === W.WRAP_TOP_AND_BOTTOM ? I(!0) : I(!1), M === W.WRAP_NONE)
1898
1895
  A === se.TRUE ? C(ue.BEHIND_TEXT) : C(ue.IN_FRONT_OF_TEXT);
1899
1896
  else
1900
- switch (b) {
1897
+ switch (M) {
1901
1898
  case W.INLINE:
1902
1899
  C(ue.INLINE);
1903
1900
  break;
@@ -1908,7 +1905,7 @@ const Dt = {
1908
1905
  C(ue.WRAP_TOP_AND_BOTTOM);
1909
1906
  break;
1910
1907
  default:
1911
- throw new Error(`Unsupported layout type: ${b}`);
1908
+ throw new Error(`Unsupported layout type: ${M}`);
1912
1909
  }
1913
1910
  }
1914
1911
  return Tn(() => {
@@ -1929,24 +1926,24 @@ const Dt = {
1929
1926
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn, h.imageCommonPanelTitle), children: /* @__PURE__ */ p("div", { children: n.t("image-text-wrap.title") }) }) }),
1930
1927
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn, h.imageCommonPanelSubtitle), children: /* @__PURE__ */ p("div", { children: n.t("image-text-wrap.wrappingStyle") }) }) }),
1931
1928
  /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelRow), children: /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn), children: /* @__PURE__ */ K($n, { value: O, onChange: _, direction: "vertical", children: [
1932
- /* @__PURE__ */ p(be, { value: ue.INLINE, children: n.t("image-text-wrap.inline") }),
1933
- /* @__PURE__ */ p(be, { value: ue.WRAP_SQUARE, children: n.t("image-text-wrap.square") }),
1934
- /* @__PURE__ */ p(be, { value: ue.WRAP_TOP_AND_BOTTOM, children: n.t("image-text-wrap.topAndBottom") }),
1935
- /* @__PURE__ */ p(be, { value: ue.BEHIND_TEXT, children: n.t("image-text-wrap.behindText") }),
1936
- /* @__PURE__ */ p(be, { value: ue.IN_FRONT_OF_TEXT, children: n.t("image-text-wrap.inFrontText") })
1929
+ /* @__PURE__ */ p(Me, { value: ue.INLINE, children: n.t("image-text-wrap.inline") }),
1930
+ /* @__PURE__ */ p(Me, { value: ue.WRAP_SQUARE, children: n.t("image-text-wrap.square") }),
1931
+ /* @__PURE__ */ p(Me, { value: ue.WRAP_TOP_AND_BOTTOM, children: n.t("image-text-wrap.topAndBottom") }),
1932
+ /* @__PURE__ */ p(Me, { value: ue.BEHIND_TEXT, children: n.t("image-text-wrap.behindText") }),
1933
+ /* @__PURE__ */ p(Me, { value: ue.IN_FRONT_OF_TEXT, children: n.t("image-text-wrap.inFrontText") })
1937
1934
  ] }) }) }),
1938
1935
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn, h.imageCommonPanelSubtitle), children: /* @__PURE__ */ p("div", { children: n.t("image-text-wrap.wrapText") }) }) }),
1939
- /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelRow), children: /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn), children: /* @__PURE__ */ K($n, { disabled: l, value: T, onChange: L, direction: "horizontal", children: [
1940
- /* @__PURE__ */ p(be, { value: Xe.BOTH_SIDES, children: n.t("image-text-wrap.bothSide") }),
1941
- /* @__PURE__ */ p(be, { value: Xe.LEFT, children: n.t("image-text-wrap.leftOnly") }),
1942
- /* @__PURE__ */ p(be, { value: Xe.RIGHT, children: n.t("image-text-wrap.rightOnly") })
1936
+ /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelRow), children: /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn), children: /* @__PURE__ */ K($n, { disabled: g, value: T, onChange: L, direction: "horizontal", children: [
1937
+ /* @__PURE__ */ p(Me, { value: Xe.BOTH_SIDES, children: n.t("image-text-wrap.bothSide") }),
1938
+ /* @__PURE__ */ p(Me, { value: Xe.LEFT, children: n.t("image-text-wrap.leftOnly") }),
1939
+ /* @__PURE__ */ p(Me, { value: Xe.RIGHT, children: n.t("image-text-wrap.rightOnly") })
1943
1940
  ] }) }) }),
1944
1941
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn, h.imageCommonPanelSubtitle), children: /* @__PURE__ */ p("div", { children: n.t("image-text-wrap.distanceFromText") }) }) }),
1945
1942
  /* @__PURE__ */ K("div", { className: h.imageCommonPanelRow, children: [
1946
1943
  /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn, h.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
1947
1944
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: n.t("image-text-wrap.top") }) }),
1948
1945
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: /* @__PURE__ */ p(
1949
- Fe,
1946
+ ke,
1950
1947
  {
1951
1948
  min: en,
1952
1949
  max: nn,
@@ -1963,7 +1960,7 @@ const Dt = {
1963
1960
  /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn, h.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
1964
1961
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: n.t("image-text-wrap.left") }) }),
1965
1962
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: /* @__PURE__ */ p(
1966
- Fe,
1963
+ ke,
1967
1964
  {
1968
1965
  min: en,
1969
1966
  max: nn,
@@ -1982,7 +1979,7 @@ const Dt = {
1982
1979
  /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn, h.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
1983
1980
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: n.t("image-text-wrap.bottom") }) }),
1984
1981
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: /* @__PURE__ */ p(
1985
- Fe,
1982
+ ke,
1986
1983
  {
1987
1984
  min: en,
1988
1985
  max: nn,
@@ -1999,7 +1996,7 @@ const Dt = {
1999
1996
  /* @__PURE__ */ p("div", { className: j(h.imageCommonPanelColumn, h.imageCommonPanelSpan2), children: /* @__PURE__ */ K("label", { children: [
2000
1997
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: n.t("image-text-wrap.right") }) }),
2001
1998
  /* @__PURE__ */ p("div", { className: h.imageCommonPanelRow, children: /* @__PURE__ */ p("div", { className: h.imageCommonPanelColumn, children: /* @__PURE__ */ p(
2002
- Fe,
1999
+ ke,
2003
2000
  {
2004
2001
  min: en,
2005
2002
  max: nn,
@@ -2015,7 +2012,7 @@ const Dt = {
2015
2012
  ] }) })
2016
2013
  ] })
2017
2014
  ] });
2018
- }, gr = () => {
2015
+ }, lr = () => {
2019
2016
  const i = ve(_e), e = i.getFocusDrawings(), [n, t] = oe(e);
2020
2017
  return Tn(() => {
2021
2018
  const r = i.focus$.subscribe((o) => {
@@ -2025,20 +2022,20 @@ const Dt = {
2025
2022
  r.unsubscribe();
2026
2023
  };
2027
2024
  }, []), !!(n != null && n.length) && /* @__PURE__ */ K("div", { className: h.imageCommonPanel, children: [
2028
- /* @__PURE__ */ p(oi, { drawings: n, hasAlign: !1, hasCropper: !1, hasGroup: !1, hasTransform: !1 }),
2029
- /* @__PURE__ */ p(lr, { drawings: n }),
2030
- /* @__PURE__ */ p(dr, { drawings: n })
2025
+ /* @__PURE__ */ p(ri, { drawings: n, hasAlign: !1, hasCropper: !1, hasGroup: !1, hasTransform: !1 }),
2026
+ /* @__PURE__ */ p(dr, { drawings: n }),
2027
+ /* @__PURE__ */ p(cr, { drawings: n })
2031
2028
  ] });
2032
- }, yt = "addition-and-subtraction-single", Pt = "doc.menu.image", bt = Dt.id, mr = (i) => {
2029
+ }, yt = "addition-and-subtraction-single", Pt = "doc.menu.image", Mt = Dt.id, gr = (i) => {
2033
2030
  const e = i.get(On), n = i.get(q);
2034
- return new Ni((t) => {
2031
+ return new Ei((t) => {
2035
2032
  const r = e.textSelection$.subscribe(() => {
2036
2033
  var s;
2037
2034
  const o = e.getActiveTextRange();
2038
2035
  if (o) {
2039
- const { segmentId: a, startOffset: d, endOffset: c } = o, g = n.getCurrentUniverDocInstance(), m = (s = g == null ? void 0 : g.getSelfOrHeaderFooterModel(a).getBody()) == null ? void 0 : s.tables;
2040
- if (m && m.length && m.some((l) => {
2041
- const { startIndex: f, endIndex: u } = l;
2036
+ 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;
2037
+ if (m && m.length && m.some((g) => {
2038
+ const { startIndex: f, endIndex: u } = g;
2042
2039
  return d >= f && d < u || c >= f && c < u;
2043
2040
  })) {
2044
2041
  t.next(!0);
@@ -2053,40 +2050,40 @@ const Dt = {
2053
2050
  return () => r.unsubscribe();
2054
2051
  });
2055
2052
  };
2056
- function ur(i) {
2053
+ function mr(i) {
2057
2054
  return {
2058
2055
  id: Pt,
2059
2056
  type: nt.SUBITEMS,
2060
2057
  icon: yt,
2061
2058
  tooltip: "docImage.title",
2062
- disabled$: mr(i),
2059
+ disabled$: gr(i),
2063
2060
  hidden$: et(i, Ie.UNIVER_DOC, void 0, Cn)
2064
2061
  };
2065
2062
  }
2066
- function fr(i) {
2063
+ function ur(i) {
2067
2064
  return {
2068
- id: bt,
2065
+ id: Mt,
2069
2066
  title: "docImage.upload.float",
2070
2067
  type: nt.BUTTON,
2071
2068
  hidden$: et(i, Ie.UNIVER_DOC, void 0, Cn)
2072
2069
  };
2073
2070
  }
2074
2071
  const hr = {
2075
- [_i.LAYOUT]: {
2072
+ [Ii.LAYOUT]: {
2076
2073
  [Pt]: {
2077
2074
  order: 0,
2078
- menuItemFactory: ur,
2079
- [bt]: {
2075
+ menuItemFactory: mr,
2076
+ [Mt]: {
2080
2077
  order: 0,
2081
- menuItemFactory: fr
2078
+ menuItemFactory: ur
2082
2079
  }
2083
2080
  }
2084
2081
  }
2085
2082
  };
2086
2083
  function Ze(i) {
2087
- return i.getContextValue(Ht) && i.getContextValue(on);
2084
+ return i.getContextValue(Wt) && i.getContextValue(on);
2088
2085
  }
2089
- const pr = {
2086
+ const fr = {
2090
2087
  id: Ye.id,
2091
2088
  description: "shortcut.doc.drawing-move-down",
2092
2089
  group: "4_doc-drawing-view",
@@ -2094,9 +2091,9 @@ const pr = {
2094
2091
  priority: 100,
2095
2092
  preconditions: Ze,
2096
2093
  staticParameters: {
2097
- direction: fe.DOWN
2094
+ direction: he.DOWN
2098
2095
  }
2099
- }, wr = {
2096
+ }, pr = {
2100
2097
  id: Ye.id,
2101
2098
  description: "shortcut.doc.drawing-move-up",
2102
2099
  group: "4_doc-drawing-view",
@@ -2104,9 +2101,9 @@ const pr = {
2104
2101
  priority: 100,
2105
2102
  preconditions: Ze,
2106
2103
  staticParameters: {
2107
- direction: fe.UP
2104
+ direction: he.UP
2108
2105
  }
2109
- }, vr = {
2106
+ }, wr = {
2110
2107
  id: Ye.id,
2111
2108
  description: "shortcut.doc.drawing-move-left",
2112
2109
  group: "4_doc-drawing-view",
@@ -2114,9 +2111,9 @@ const pr = {
2114
2111
  priority: 100,
2115
2112
  preconditions: Ze,
2116
2113
  staticParameters: {
2117
- direction: fe.LEFT
2114
+ direction: he.LEFT
2118
2115
  }
2119
- }, Ir = {
2116
+ }, vr = {
2120
2117
  id: Ye.id,
2121
2118
  description: "shortcut.doc.drawing-move-right",
2122
2119
  group: "4_doc-drawing-view",
@@ -2124,9 +2121,9 @@ const pr = {
2124
2121
  priority: 100,
2125
2122
  preconditions: Ze,
2126
2123
  staticParameters: {
2127
- direction: fe.RIGHT
2124
+ direction: he.RIGHT
2128
2125
  }
2129
- }, _r = {
2126
+ }, Ir = {
2130
2127
  id: vt.id,
2131
2128
  description: "shortcut.doc.drawing-delete",
2132
2129
  group: "4_doc-drawing-view",
@@ -2135,8 +2132,8 @@ const pr = {
2135
2132
  binding: He.DELETE,
2136
2133
  mac: He.BACKSPACE
2137
2134
  };
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--)
2135
+ var _r = Object.getOwnPropertyDescriptor, Sr = (i, e, n, t) => {
2136
+ for (var r = t > 1 ? void 0 : t ? _r(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2140
2137
  (s = i[o]) && (r = s(r) || r);
2141
2138
  return r;
2142
2139
  }, tn = (i, e) => (n, t) => e(n, t, i);
@@ -2146,7 +2143,7 @@ let dn = class extends Ge {
2146
2143
  }
2147
2144
  _initCustomComponents() {
2148
2145
  const i = this._componentManager;
2149
- this.disposeWithMe(i.register(yt, wt)), this.disposeWithMe(i.register(Ct, gr));
2146
+ this.disposeWithMe(i.register(yt, wt)), this.disposeWithMe(i.register(Ct, lr));
2150
2147
  }
2151
2148
  _initMenus() {
2152
2149
  this._menuManagerService.mergeMenu(hr);
@@ -2160,10 +2157,10 @@ let dn = class extends Ge {
2160
2157
  mt,
2161
2158
  Ke,
2162
2159
  ut,
2163
- ft,
2160
+ ht,
2164
2161
  yn,
2165
2162
  Ot,
2166
- Ji,
2163
+ Qi,
2167
2164
  Tt,
2168
2165
  It,
2169
2166
  St,
@@ -2175,11 +2172,11 @@ let dn = class extends Ge {
2175
2172
  _initShortcuts() {
2176
2173
  [
2177
2174
  // sheet drawing shortcuts
2175
+ fr,
2178
2176
  pr,
2179
2177
  wr,
2180
2178
  vr,
2181
- Ir,
2182
- _r
2179
+ Ir
2183
2180
  ].forEach((i) => {
2184
2181
  this.disposeWithMe(this._shortcutService.registerShortcut(i));
2185
2182
  });
@@ -2188,23 +2185,23 @@ let dn = class extends Ge {
2188
2185
  this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
2189
2186
  }
2190
2187
  };
2191
- dn = Dr([
2192
- tn(0, pe(Si)),
2193
- tn(1, Di),
2188
+ dn = Sr([
2189
+ tn(0, pe(_i)),
2190
+ tn(1, Si),
2194
2191
  tn(2, $),
2195
- tn(3, Ci)
2192
+ tn(3, Di)
2196
2193
  ], dn);
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--)
2194
+ var Dr = Object.getOwnPropertyDescriptor, Cr = (i, e, n, t) => {
2195
+ for (var r = t > 1 ? void 0 : t ? Dr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2199
2196
  (s = i[o]) && (r = s(r) || r);
2200
2197
  return r;
2201
- }, ke = (i, e) => (n, t) => e(n, t, i);
2198
+ }, Fe = (i, e) => (n, t) => e(n, t, i);
2202
2199
  function In(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: g, viewportScrollY: m } = c, { scaleX: l, scaleY: f } = d.getAncestorScale();
2200
+ 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
2201
  return {
2205
- startX: (t - g) * l,
2202
+ startX: (t - l) * g,
2206
2203
  startY: (n - m) * f,
2207
- endX: (t + r - g) * l,
2204
+ endX: (t + r - l) * g,
2208
2205
  endY: (n + o - m) * f,
2209
2206
  width: r,
2210
2207
  height: o,
@@ -2265,7 +2262,7 @@ let ln = class extends Ge {
2265
2262
  if (!(a == null || a.length === 0))
2266
2263
  for (const d of a) {
2267
2264
  this._addHoverForRect(d);
2268
- const c = new Gt(), g = In(d, o.renderUnit), m = new ot(g), l = o.canvas, f = s.data, u = {
2265
+ const c = new Ht(), l = In(d, o.renderUnit), m = new ot(l), g = o.canvas, f = s.data, u = {
2269
2266
  dispose: c,
2270
2267
  rect: d,
2271
2268
  position$: m,
@@ -2276,16 +2273,16 @@ let ln = class extends Ge {
2276
2273
  id: s.drawingId,
2277
2274
  componentKey: s.componentKey,
2278
2275
  onPointerDown: (w) => {
2279
- l.dispatchEvent(new PointerEvent(w.type, w));
2276
+ g.dispatchEvent(new PointerEvent(w.type, w));
2280
2277
  },
2281
2278
  onPointerMove: (w) => {
2282
- l.dispatchEvent(new PointerEvent(w.type, w));
2279
+ g.dispatchEvent(new PointerEvent(w.type, w));
2283
2280
  },
2284
2281
  onPointerUp: (w) => {
2285
- l.dispatchEvent(new PointerEvent(w.type, w));
2282
+ g.dispatchEvent(new PointerEvent(w.type, w));
2286
2283
  },
2287
2284
  onWheel: (w) => {
2288
- l.dispatchEvent(new WheelEvent(w.type, w));
2285
+ g.dispatchEvent(new WheelEvent(w.type, w));
2289
2286
  },
2290
2287
  data: f,
2291
2288
  unitId: t
@@ -2342,8 +2339,8 @@ let ln = class extends Ge {
2342
2339
  const t = n.getUnitId(), r = this._renderManagerService.getRenderById(t);
2343
2340
  return r ? { render: r, unitId: t } : null;
2344
2341
  }),
2345
- Ai(
2346
- (n) => n ? Qn(n.render.scene.getViewport(it.VIEW_MAIN).onScrollAfter$).pipe(Wn(() => ({ unitId: n.unitId }))) : xi(null)
2342
+ Ni(
2343
+ (n) => n ? Qn(n.render.scene.getViewport(it.VIEW_MAIN).onScrollAfter$).pipe(Wn(() => ({ unitId: n.unitId }))) : Ai(null)
2347
2344
  )
2348
2345
  ).subscribe((n) => {
2349
2346
  if (!n) return;
@@ -2365,7 +2362,7 @@ let ln = class extends Ge {
2365
2362
  if (!r) return !1;
2366
2363
  const a = (v = r.renderUnit.with(te).getSkeleton().getSkeletonData()) == null ? void 0 : v.pages[0];
2367
2364
  if (!a) return !1;
2368
- const { pageWidth: d, marginLeft: c, marginRight: g } = a, m = d - c - g, l = {
2365
+ const { pageWidth: d, marginLeft: c, marginRight: l } = a, m = d - c - l, g = {
2369
2366
  size: {
2370
2367
  width: (w = n.width) != null ? w : m,
2371
2368
  height: n.height
@@ -2379,7 +2376,7 @@ let ln = class extends Ge {
2379
2376
  posOffset: 0
2380
2377
  },
2381
2378
  angle: 0
2382
- }, f = (I = n.drawingId) != null ? I : Vt(), u = {
2379
+ }, f = (I = n.drawingId) != null ? I : Gt(), u = {
2383
2380
  unitId: t.getUnitId(),
2384
2381
  drawings: [
2385
2382
  {
@@ -2390,29 +2387,29 @@ let ln = class extends Ge {
2390
2387
  ...e,
2391
2388
  title: "",
2392
2389
  description: "",
2393
- docTransform: l,
2390
+ docTransform: g,
2394
2391
  layoutType: W.INLINE,
2395
- transform: tt(l)
2392
+ transform: tt(g)
2396
2393
  }
2397
2394
  ]
2398
2395
  };
2399
2396
  return this._commandService.syncExecuteCommand(Pn.id, u), f;
2400
2397
  }
2401
2398
  };
2402
- ln = Or([
2403
- ke(0, J),
2404
- ke(1, _e),
2405
- ke(2, pe(si)),
2406
- ke(3, pe(Oi)),
2407
- ke(4, q),
2408
- ke(5, $)
2399
+ ln = Cr([
2400
+ Fe(0, J),
2401
+ Fe(1, _e),
2402
+ Fe(2, pe(oi)),
2403
+ Fe(3, pe(Ci)),
2404
+ Fe(4, q),
2405
+ Fe(5, $)
2409
2406
  ], ln);
2410
- var Tr = Object.getOwnPropertyDescriptor, yr = (i, e, n, t) => {
2411
- for (var r = t > 1 ? void 0 : t ? Tr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2407
+ var Or = Object.getOwnPropertyDescriptor, Tr = (i, e, n, t) => {
2408
+ for (var r = t > 1 ? void 0 : t ? Or(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2412
2409
  (s = i[o]) && (r = s(r) || r);
2413
2410
  return r;
2414
2411
  }, ze = (i, e) => (n, t) => e(n, t, i);
2415
- let gn = class extends jt {
2412
+ let gn = class extends Vt {
2416
2413
  constructor(e, n, t, r, o) {
2417
2414
  super();
2418
2415
  Se(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
@@ -2434,7 +2431,7 @@ let gn = class extends jt {
2434
2431
  _hasCropObject(e) {
2435
2432
  const n = e.getAllObjects();
2436
2433
  for (const t of n)
2437
- if (t instanceof ai)
2434
+ if (t instanceof si)
2438
2435
  return !0;
2439
2436
  return !1;
2440
2437
  }
@@ -2462,22 +2459,22 @@ let gn = class extends jt {
2462
2459
  const d = a.oKey, c = this._drawingManagerService.getDrawingOKey(d);
2463
2460
  if (!c || c.drawingType === rn.DRAWING_DOM)
2464
2461
  return;
2465
- const { unitId: g, subUnitId: m, drawingId: l, drawingType: f } = c, u = this._canvasPopManagerService.attachPopupToObject(
2462
+ const { unitId: l, subUnitId: m, drawingId: g, drawingType: f } = c, u = this._canvasPopManagerService.attachPopupToObject(
2466
2463
  a,
2467
2464
  {
2468
- componentKey: ci,
2465
+ componentKey: ai,
2469
2466
  direction: "horizontal",
2470
2467
  offset: [2, 0],
2471
2468
  extraProps: {
2472
- menuItems: this._getImageMenuItems(g, m, l, f)
2469
+ menuItems: this._getImageMenuItems(l, m, g, f)
2473
2470
  }
2474
2471
  },
2475
- g
2472
+ l
2476
2473
  );
2477
- r.push(this.disposeWithMe(u)), !this._drawingManagerService.getFocusDrawings().find((I) => I.unitId === g && I.subUnitId === m && I.drawingId === l) && this._drawingManagerService.focusDrawing([{
2478
- unitId: g,
2474
+ r.push(this.disposeWithMe(u)), !this._drawingManagerService.getFocusDrawings().find((I) => I.unitId === l && I.subUnitId === m && I.drawingId === g) && this._drawingManagerService.focusDrawing([{
2475
+ unitId: l,
2479
2476
  subUnitId: m,
2480
- drawingId: l
2477
+ drawingId: g
2481
2478
  }]);
2482
2479
  })
2483
2480
  )
@@ -2508,7 +2505,7 @@ let gn = class extends jt {
2508
2505
  index: 0,
2509
2506
  commandId: Tt.id,
2510
2507
  commandParams: { unitId: e, subUnitId: n, drawingId: t },
2511
- disable: !!$t.includes(e) || r === rn.DRAWING_DOM
2508
+ disable: !!jt.includes(e) || r === rn.DRAWING_DOM
2512
2509
  },
2513
2510
  {
2514
2511
  label: "image-popup.delete",
@@ -2520,7 +2517,7 @@ let gn = class extends jt {
2520
2517
  {
2521
2518
  label: "image-popup.crop",
2522
2519
  index: 2,
2523
- commandId: di.id,
2520
+ commandId: ci.id,
2524
2521
  commandParams: { unitId: e, subUnitId: n, drawingId: t },
2525
2522
  disable: !0
2526
2523
  // TODO: @JOCS, feature is not ready.
@@ -2528,7 +2525,7 @@ let gn = class extends jt {
2528
2525
  {
2529
2526
  label: "image-popup.reset",
2530
2527
  index: 3,
2531
- commandId: li.id,
2528
+ commandId: di.id,
2532
2529
  commandParams: [{ unitId: e, subUnitId: n, drawingId: t }],
2533
2530
  disable: !0
2534
2531
  // TODO: @JOCS, feature is not ready.
@@ -2536,15 +2533,15 @@ let gn = class extends jt {
2536
2533
  ];
2537
2534
  }
2538
2535
  };
2539
- gn = yr([
2536
+ gn = Tr([
2540
2537
  ze(0, _e),
2541
- ze(1, pe(Ri)),
2538
+ ze(1, pe(bi)),
2542
2539
  ze(2, J),
2543
2540
  ze(3, q),
2544
2541
  ze(4, Zn)
2545
2542
  ], gn);
2546
- var Pr = Object.getOwnPropertyDescriptor, br = (i, e, n, t) => {
2547
- for (var r = t > 1 ? void 0 : t ? Pr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2543
+ var yr = Object.getOwnPropertyDescriptor, Pr = (i, e, n, t) => {
2544
+ for (var r = t > 1 ? void 0 : t ? yr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2548
2545
  (s = i[o]) && (r = s(r) || r);
2549
2546
  return r;
2550
2547
  }, Le = (i, e) => (n, t) => e(n, t, i);
@@ -2587,7 +2584,7 @@ let Sn = class extends Ge {
2587
2584
  _initResize() {
2588
2585
  this.disposeWithMe(
2589
2586
  Qn(this._context.engine.onTransformChange$).pipe(
2590
- Gn((e) => e.type === pi.resize),
2587
+ Gn((e) => e.type === fi.resize),
2591
2588
  st(16)
2592
2589
  ).subscribe(() => {
2593
2590
  var t;
@@ -2601,12 +2598,12 @@ let Sn = class extends Ge {
2601
2598
  const n = e == null ? void 0 : e.getSkeletonData(), { mainComponent: t, unitId: r } = this._context, o = t;
2602
2599
  if (!n)
2603
2600
  return;
2604
- const { left: s, top: a, pageLayoutType: d, pageMarginLeft: c, pageMarginTop: g } = o, { pages: m, skeHeaders: l, skeFooters: f } = n, u = {};
2601
+ const { left: s, top: a, pageLayoutType: d, pageMarginLeft: c, pageMarginTop: l } = o, { pages: m, skeHeaders: g, skeFooters: f } = n, u = {};
2605
2602
  this._liquid.reset();
2606
- for (let T = 0, M = m.length; T < M; T++) {
2603
+ for (let T = 0, b = m.length; T < b; T++) {
2607
2604
  const P = m[T], { headerId: N, footerId: B, pageWidth: E } = P;
2608
2605
  if (N) {
2609
- const _ = (O = l.get(N)) == null ? void 0 : O.get(E);
2606
+ const _ = (O = g.get(N)) == null ? void 0 : O.get(E);
2610
2607
  _ && this._calculateDrawingPosition(
2611
2608
  r,
2612
2609
  _,
@@ -2629,7 +2626,7 @@ let Sn = class extends Ge {
2629
2626
  P.marginLeft
2630
2627
  );
2631
2628
  }
2632
- this._calculateDrawingPosition(r, P, s, a, u, P.marginTop, P.marginLeft), this._liquid.translatePage(P, d, c, g);
2629
+ this._calculateDrawingPosition(r, P, s, a, u, P.marginTop, P.marginLeft), this._liquid.translatePage(P, d, c, l);
2633
2630
  }
2634
2631
  const v = Object.values(u), w = v.filter((T) => !T.isMultiTransform), I = v.filter((T) => T.isMultiTransform);
2635
2632
  w.length > 0 && this._drawingManagerService.refreshTransform(w), this._handleMultiDrawingsTransform(I);
@@ -2653,11 +2650,11 @@ let Sn = class extends Ge {
2653
2650
  marginTop: s,
2654
2651
  marginLeft: a
2655
2652
  }), d.forEach((c) => {
2656
- const { aLeft: g, aTop: m, height: l, width: f, angle: u, drawingId: v, drawingOrigin: w } = c, I = w.layoutType === W.WRAP_NONE && w.behindDoc === se.TRUE, { isMultiTransform: O = se.FALSE } = w, C = {
2657
- left: g + t + this._liquid.x,
2653
+ const { aLeft: l, aTop: m, height: g, width: f, angle: u, drawingId: v, drawingOrigin: w } = c, I = w.layoutType === W.WRAP_NONE && w.behindDoc === se.TRUE, { isMultiTransform: O = se.FALSE } = w, C = {
2654
+ left: l + t + this._liquid.x,
2658
2655
  top: m + r + this._liquid.y,
2659
2656
  width: f,
2660
- height: l,
2657
+ height: g,
2661
2658
  angle: u
2662
2659
  };
2663
2660
  o[v] == null ? o[v] = {
@@ -2684,30 +2681,30 @@ let Sn = class extends Ge {
2684
2681
  }, 1e3) : this._lifecycleService.lifecycle$.pipe(Gn((n) => n === En.Steady)).subscribe(e);
2685
2682
  }
2686
2683
  };
2687
- Sn = br([
2684
+ Sn = Pr([
2688
2685
  Le(1, pe(te)),
2689
2686
  Le(2, $),
2690
- Le(3, Ei),
2687
+ Le(3, Ri),
2691
2688
  Le(4, _e),
2692
- Le(5, pe(fn)),
2689
+ Le(5, pe(hn)),
2693
2690
  Le(6, q),
2694
- Le(7, pe(zt))
2691
+ Le(7, pe($t))
2695
2692
  ], Sn);
2696
- 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) => {
2697
- for (var r = t > 1 ? void 0 : t ? Rr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2693
+ var Mr = Object.defineProperty, br = Object.getOwnPropertyDescriptor, Rr = (i, e, n) => e in i ? Mr(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, Er = (i, e, n, t) => {
2694
+ for (var r = t > 1 ? void 0 : t ? br(e, n) : e, o = i.length - 1, s; o >= 0; o--)
2698
2695
  (s = i[o]) && (r = s(r) || r);
2699
2696
  return r;
2700
- }, _n = (i, e) => (n, t) => e(n, t, i), Mt = (i, e, n) => Er(i, typeof e != "symbol" ? e + "" : e, n);
2701
- const Ar = "DOC_DRAWING_UI_PLUGIN";
2702
- let mn = class extends Yt {
2697
+ }, _n = (i, e) => (n, t) => e(n, t, i), bt = (i, e, n) => Rr(i, typeof e != "symbol" ? e + "" : e, n);
2698
+ const Nr = "DOC_DRAWING_UI_PLUGIN";
2699
+ let mn = class extends Kt {
2703
2700
  constructor(i = zn, e, n, t) {
2704
2701
  super(), this._config = i, this._injector = e, this._renderManagerSrv = n, this._configService = t;
2705
- const { ...r } = Zt(
2702
+ const { ...r } = Yt(
2706
2703
  {},
2707
2704
  zn,
2708
2705
  this._config
2709
2706
  );
2710
- this._configService.setConfig(Bi, r);
2707
+ this._configService.setConfig(Ui, r);
2711
2708
  }
2712
2709
  onStarting() {
2713
2710
  [
@@ -2715,7 +2712,7 @@ let mn = class extends Yt {
2715
2712
  [gn],
2716
2713
  [an],
2717
2714
  [sn],
2718
- [fn],
2715
+ [hn],
2719
2716
  [ln]
2720
2717
  ].forEach((e) => this._injector.add(e));
2721
2718
  }
@@ -2729,16 +2726,16 @@ let mn = class extends Yt {
2729
2726
  this._injector.get(gn), this._injector.get(ln);
2730
2727
  }
2731
2728
  };
2732
- Mt(mn, "type", Ie.UNIVER_DOC);
2733
- Mt(mn, "pluginName", Ar);
2734
- mn = Nr([
2735
- Xt(gi, ri, Qt, Ti),
2736
- _n(1, pe(qt)),
2729
+ bt(mn, "type", Ie.UNIVER_DOC);
2730
+ bt(mn, "pluginName", Nr);
2731
+ mn = Er([
2732
+ zt(li, ii, Zt, Oi),
2733
+ _n(1, pe(Xt)),
2737
2734
  _n(2, J),
2738
- _n(3, Kt)
2735
+ _n(3, qt)
2739
2736
  ], mn);
2740
2737
  export {
2741
- Ji as ClearDocDrawingTransformerOperation,
2738
+ Qi as ClearDocDrawingTransformerOperation,
2742
2739
  Pt as DOCS_IMAGE_MENU_ID,
2743
2740
  vt as DeleteDocDrawingsCommand,
2744
2741
  ln as DocFloatDomController,