@univerjs/docs-drawing-ui 0.7.0-nightly.202505131607 → 0.7.0

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