@univerjs/drawing-ui 0.4.2 → 0.5.0-beta.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,820 +1,916 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { getDrawingShapeKeyByDrawingSearch, DrawingTypeEnum, ImageSourceType, IDrawingManagerService, IImageIoService, ArrangeTypeEnum } from "@univerjs/drawing";
6
- import { Group, DRAWING_OBJECT_LAYER_INDEX, Image, IRenderManagerService, getGroupState, transformObjectOutOfGroup, RENDER_CLASS_TYPE, Shape, Rect, Canvas, precisionTo, CURSOR_TYPE, Vector2, degToRad } from "@univerjs/engine-render";
7
- import { UniverInstanceType, CommandType, useDependency, ICommandService, LocaleService, Tools, debounce, Inject, Disposable, checkIfMove, toDisposable, IUniverInstanceService, Injector, Plugin, IConfigService } from "@univerjs/core";
8
- import React, { useState, forwardRef, useRef, createElement, useEffect } from "react";
9
- import { Select, Button, InputNumber, Checkbox, Dropdown, MessageType } from "@univerjs/design";
10
- import { ComponentManager, IMessageService, IDialogService } from "@univerjs/ui";
11
- import { filter, switchMap } from "rxjs";
12
- function insertGroupObject(objectParam, object, scene, drawingManagerService) {
13
- const groupParam = drawingManagerService.getDrawingByParam(objectParam);
14
- if (groupParam == null)
1
+ var On = Object.defineProperty;
2
+ var Nn = (i, t, n) => t in i ? On(i, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[t] = n;
3
+ var Q = (i, t, n) => Nn(i, typeof t != "symbol" ? t + "" : t, n);
4
+ import { getDrawingShapeKeyByDrawingSearch as G, DrawingTypeEnum as ee, ImageSourceType as Dn, IDrawingManagerService as ne, IImageIoService as an, ArrangeTypeEnum as be } from "@univerjs/drawing";
5
+ import { Group as Ce, DRAWING_OBJECT_LAYER_INDEX as Fe, Image as ke, IRenderManagerService as ue, getGroupState as En, transformObjectOutOfGroup as Tn, RENDER_CLASS_TYPE as Xe, Shape as Bn, Rect as Un, Canvas as Hn, precisionTo as Ie, CURSOR_TYPE as xe, Vector2 as We, degToRad as qe } from "@univerjs/engine-render";
6
+ import { UniverInstanceType as Me, CommandType as ve, useDependency as L, ICommandService as me, LocaleService as te, Tools as An, debounce as Pe, Inject as Ue, Disposable as He, checkIfMove as sn, toDisposable as we, IUniverInstanceService as Ke, Injector as Ln, Plugin as Vn, IConfigService as Gn } from "@univerjs/core";
7
+ import Wn, { useState as A, forwardRef as Y, useRef as on, createElement as Z, useEffect as _e } from "react";
8
+ import { Select as cn, Button as ce, InputNumber as fe, Checkbox as $n, Dropdown as kn, MessageType as Je } from "@univerjs/design";
9
+ import { ComponentManager as zn, IMessageService as Fn, IDialogService as Kn } from "@univerjs/ui";
10
+ import { filter as Yn, switchMap as Zn } from "rxjs";
11
+ function Xn(i, t, n, e) {
12
+ const r = e.getDrawingByParam(i);
13
+ if (r == null)
15
14
  return;
16
- const groupKey = getDrawingShapeKeyByDrawingSearch(objectParam), groupObject = scene.getObject(groupKey);
17
- if (groupObject && !(groupObject instanceof Group))
15
+ const s = G(i), a = n.getObject(s);
16
+ if (a && !(a instanceof Ce))
18
17
  return;
19
- if (groupObject != null) {
20
- groupObject.addObject(object);
18
+ if (a != null) {
19
+ a.addObject(t);
21
20
  return;
22
21
  }
23
- const group = new Group(groupKey);
24
- scene.addObject(group, DRAWING_OBJECT_LAYER_INDEX).attachTransformerTo(group), group.addObject(object);
25
- const { transform } = groupParam;
26
- transform && group.transformByState(
22
+ const o = new Ce(s);
23
+ n.addObject(o, Fe).attachTransformerTo(o), o.addObject(t);
24
+ const { transform: l } = r;
25
+ l && o.transformByState(
27
26
  {
28
- left: transform.left,
29
- top: transform.top,
30
- angle: transform.angle
27
+ left: l.left,
28
+ top: l.top,
29
+ angle: l.angle
31
30
  }
32
31
  );
33
32
  }
34
- __name(insertGroupObject, "insertGroupObject");
35
- function getCurrentUnitInfo(currentUniverService, propUnitId) {
36
- var _a7;
37
- const current = propUnitId ? currentUniverService.getUnit(propUnitId) : currentUniverService.getFocusedUnit();
38
- if (current == null)
33
+ function ln(i, t) {
34
+ var s;
35
+ const n = t ? i.getUnit(t) : i.getFocusedUnit();
36
+ if (n == null)
39
37
  return;
40
- const unitId = current.getUnitId();
41
- let subUnitId;
42
- return current.type === UniverInstanceType.UNIVER_SHEET ? subUnitId = (_a7 = current.getActiveSheet()) == null ? void 0 : _a7.getSheetId() : (current.type === UniverInstanceType.UNIVER_DOC || current.type === UniverInstanceType.UNIVER_SLIDE) && (subUnitId = unitId), { unitId, subUnitId, current };
38
+ const e = n.getUnitId();
39
+ let r;
40
+ return n.type === Me.UNIVER_SHEET ? r = (s = n.getActiveSheet()) == null ? void 0 : s.getSheetId() : (n.type === Me.UNIVER_DOC || n.type === Me.UNIVER_SLIDE) && (r = e), { unitId: e, subUnitId: r, current: n };
43
41
  }
44
- __name(getCurrentUnitInfo, "getCurrentUnitInfo");
45
- var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
46
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
47
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
48
- return kind && result && __defProp$5(target, key, result), result;
49
- }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a;
50
- let DrawingRenderService = (_a = class {
51
- constructor(_drawingManagerService, _imageIoService) {
52
- this._drawingManagerService = _drawingManagerService, this._imageIoService = _imageIoService;
42
+ var qn = Object.defineProperty, Jn = Object.getOwnPropertyDescriptor, Qn = (i, t, n, e) => {
43
+ for (var r = e > 1 ? void 0 : e ? Jn(t, n) : t, s = i.length - 1, a; s >= 0; s--)
44
+ (a = i[s]) && (r = (e ? a(t, n, r) : a(r)) || r);
45
+ return e && r && qn(t, n, r), r;
46
+ }, Qe = (i, t) => (n, e) => t(n, e, i);
47
+ let Oe = class {
48
+ constructor(i, t) {
49
+ this._drawingManagerService = i, this._imageIoService = t;
53
50
  }
54
51
  // eslint-disable-next-line max-lines-per-function
55
- async renderImages(imageParam, scene) {
52
+ async renderImages(i, t) {
56
53
  const {
57
- transform: singleTransform,
58
- drawingType,
59
- source,
60
- imageSourceType,
61
- srcRect,
62
- prstGeom,
63
- groupId,
64
- unitId,
65
- subUnitId,
66
- drawingId,
67
- isMultiTransform,
68
- transforms: multiTransforms
69
- } = imageParam;
70
- if (drawingType !== DrawingTypeEnum.DRAWING_IMAGE || !this._drawingManagerService.getDrawingVisible() || singleTransform == null)
54
+ transform: n,
55
+ drawingType: e,
56
+ source: r,
57
+ imageSourceType: s,
58
+ srcRect: a,
59
+ prstGeom: o,
60
+ groupId: l,
61
+ unitId: g,
62
+ subUnitId: u,
63
+ drawingId: d,
64
+ isMultiTransform: h,
65
+ transforms: f
66
+ } = i;
67
+ if (e !== ee.DRAWING_IMAGE || !this._drawingManagerService.getDrawingVisible() || n == null)
71
68
  return;
72
- const transforms = isMultiTransform && multiTransforms ? multiTransforms : [singleTransform], images = [];
73
- for (const transform of transforms) {
74
- const { left, top, width, height, angle, flipX, flipY, skewX, skewY } = transform, index = transforms.indexOf(transform), imageShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }, isMultiTransform ? index : void 0), imageShape = scene.getObject(imageShapeKey);
75
- if (imageShape != null) {
76
- imageShape.transformByState({ left, top, width, height, angle, flipX, flipY, skewX, skewY });
69
+ const v = h && f ? f : [n], w = [];
70
+ for (const p of v) {
71
+ const { left: S, top: _, width: R, height: b, angle: N, flipX: I, flipY: y, skewX: P, skewY: M } = p, D = v.indexOf(p), B = G({ unitId: g, subUnitId: u, drawingId: d }, h ? D : void 0), E = t.getObject(B);
72
+ if (E != null) {
73
+ E.transformByState({ left: S, top: _, width: R, height: b, angle: N, flipX: I, flipY: y, skewX: P, skewY: M });
77
74
  continue;
78
75
  }
79
- const orders = this._drawingManagerService.getDrawingOrder(unitId, subUnitId), zIndex = orders.indexOf(drawingId), imageConfig = { ...transform, zIndex: zIndex === -1 ? orders.length - 1 : zIndex }, imageNativeCache = this._imageIoService.getImageSourceCache(source, imageSourceType);
80
- let shouldBeCache = !1;
81
- if (imageNativeCache != null)
82
- imageConfig.image = imageNativeCache;
76
+ const re = this._drawingManagerService.getDrawingOrder(g, u), W = re.indexOf(d), q = { ...p, zIndex: W === -1 ? re.length - 1 : W }, Se = this._imageIoService.getImageSourceCache(r, s);
77
+ let ie = !1;
78
+ if (Se != null)
79
+ q.image = Se;
83
80
  else {
84
- if (imageSourceType === ImageSourceType.UUID)
81
+ if (s === Dn.UUID)
85
82
  try {
86
- imageConfig.url = await this._imageIoService.getImage(source);
87
- } catch (error) {
88
- console.error(error);
83
+ q.url = await this._imageIoService.getImage(r);
84
+ } catch (Ge) {
85
+ console.error(Ge);
89
86
  continue;
90
87
  }
91
88
  else
92
- imageConfig.url = source;
93
- shouldBeCache = !0;
89
+ q.url = r;
90
+ ie = !0;
94
91
  }
95
- if (scene.getObject(imageShapeKey))
92
+ if (t.getObject(B))
96
93
  continue;
97
- imageConfig.printable = !0;
98
- const image = new Image(imageShapeKey, imageConfig);
99
- if (shouldBeCache && this._imageIoService.addImageSourceCache(source, imageSourceType, image.getNative()), !this._drawingManagerService.getDrawingVisible())
94
+ q.printable = !0;
95
+ const k = new ke(B, q);
96
+ if (ie && this._imageIoService.addImageSourceCache(r, s, k.getNative()), !this._drawingManagerService.getDrawingVisible())
100
97
  continue;
101
- const imageObject = scene.addObject(image, DRAWING_OBJECT_LAYER_INDEX);
102
- this._drawingManagerService.getDrawingEditable() && imageObject.attachTransformerTo(image), groupId && insertGroupObject({ drawingId: groupId, unitId, subUnitId }, image, scene, this._drawingManagerService), prstGeom != null && image.setPrstGeom(prstGeom), srcRect != null && image.setSrcRect(srcRect), images.push(image);
98
+ const Ve = t.addObject(k, Fe);
99
+ this._drawingManagerService.getDrawingEditable() && Ve.attachTransformerTo(k), l && Xn({ drawingId: l, unitId: g, subUnitId: u }, k, t, this._drawingManagerService), o != null && k.setPrstGeom(o), a != null && k.setSrcRect(a), w.push(k);
103
100
  }
104
- return images;
105
- }
106
- renderDrawing(param, scene) {
107
- const drawingParam = this._drawingManagerService.getDrawingByParam(param);
108
- if (drawingParam != null)
109
- switch (drawingParam.drawingType) {
110
- case DrawingTypeEnum.DRAWING_IMAGE:
111
- return this.renderImages(drawingParam, scene);
101
+ return w;
102
+ }
103
+ renderDrawing(i, t) {
104
+ const n = this._drawingManagerService.getDrawingByParam(i);
105
+ if (n != null)
106
+ switch (n.drawingType) {
107
+ case ee.DRAWING_IMAGE:
108
+ return this.renderImages(n, t);
112
109
  }
113
110
  }
114
- }, __name(_a, "DrawingRenderService"), _a);
115
- DrawingRenderService = __decorateClass$5([
116
- __decorateParam$5(0, IDrawingManagerService),
117
- __decorateParam$5(1, IImageIoService)
118
- ], DrawingRenderService);
119
- function getUpdateParams(objects, drawingManagerService) {
120
- const params = [];
121
- return objects.forEach((object) => {
122
- const { oKey, left, top, height, width, angle } = object, searchParam = drawingManagerService.getDrawingOKey(oKey);
123
- if (searchParam == null)
124
- return params.push(null), !0;
125
- const { unitId, subUnitId, drawingId, drawingType } = searchParam, param = {
126
- unitId,
127
- subUnitId,
128
- drawingId,
129
- drawingType,
111
+ };
112
+ Oe = Qn([
113
+ Qe(0, ne),
114
+ Qe(1, an)
115
+ ], Oe);
116
+ function Ae(i, t) {
117
+ const n = [];
118
+ return i.forEach((e) => {
119
+ const { oKey: r, left: s, top: a, height: o, width: l, angle: g } = e, u = t.getDrawingOKey(r);
120
+ if (u == null)
121
+ return n.push(null), !0;
122
+ const { unitId: d, subUnitId: h, drawingId: f, drawingType: v } = u, w = {
123
+ unitId: d,
124
+ subUnitId: h,
125
+ drawingId: f,
126
+ drawingType: v,
130
127
  transform: {
131
- left,
132
- top,
133
- height,
134
- width,
135
- angle
128
+ left: s,
129
+ top: a,
130
+ height: o,
131
+ width: l,
132
+ angle: g
136
133
  }
137
134
  };
138
- drawingType === DrawingTypeEnum.DRAWING_IMAGE && (param.srcRect = object.srcRect), params.push(param);
139
- }), params;
135
+ v === ee.DRAWING_IMAGE && (w.srcRect = e.srcRect), n.push(w);
136
+ }), n;
140
137
  }
141
- __name(getUpdateParams, "getUpdateParams");
142
- function r(e) {
143
- var t, f, n = "";
144
- if (typeof e == "string" || typeof e == "number") n += e;
145
- else if (typeof e == "object") if (Array.isArray(e)) {
146
- var o = e.length;
147
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
148
- } else for (f in e) e[f] && (n && (n += " "), n += f);
149
- return n;
138
+ var mn = { exports: {} }, Le = {};
139
+ /**
140
+ * @license React
141
+ * react-jsx-runtime.production.min.js
142
+ *
143
+ * Copyright (c) Facebook, Inc. and its affiliates.
144
+ *
145
+ * This source code is licensed under the MIT license found in the
146
+ * LICENSE file in the root directory of this source tree.
147
+ */
148
+ var et = Wn, nt = Symbol.for("react.element"), tt = Symbol.for("react.fragment"), rt = Object.prototype.hasOwnProperty, it = et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, at = { key: !0, ref: !0, __self: !0, __source: !0 };
149
+ function gn(i, t, n) {
150
+ var e, r = {}, s = null, a = null;
151
+ n !== void 0 && (s = "" + n), t.key !== void 0 && (s = "" + t.key), t.ref !== void 0 && (a = t.ref);
152
+ for (e in t) rt.call(t, e) && !at.hasOwnProperty(e) && (r[e] = t[e]);
153
+ if (i && i.defaultProps) for (e in t = i.defaultProps, t) r[e] === void 0 && (r[e] = t[e]);
154
+ return { $$typeof: nt, type: i, key: s, ref: a, props: r, _owner: it.current };
150
155
  }
151
- __name(r, "r");
152
- function clsx() {
153
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
154
- return n;
156
+ Le.Fragment = tt;
157
+ Le.jsx = gn;
158
+ Le.jsxs = gn;
159
+ mn.exports = Le;
160
+ var c = mn.exports;
161
+ function un(i) {
162
+ var t, n, e = "";
163
+ if (typeof i == "string" || typeof i == "number") e += i;
164
+ else if (typeof i == "object") if (Array.isArray(i)) {
165
+ var r = i.length;
166
+ for (t = 0; t < r; t++) i[t] && (n = un(i[t])) && (e && (e += " "), e += n);
167
+ } else for (n in i) i[n] && (e && (e += " "), e += n);
168
+ return e;
155
169
  }
156
- __name(clsx, "clsx");
157
- var AlignType = /* @__PURE__ */ ((AlignType2) => (AlignType2.default = "0", AlignType2.left = "1", AlignType2.center = "2", AlignType2.right = "3", AlignType2.top = "4", AlignType2.middle = "5", AlignType2.bottom = "6", AlignType2.horizon = "7", AlignType2.vertical = "8", AlignType2))(AlignType || {});
158
- const SetDrawingAlignOperation = {
170
+ function O() {
171
+ for (var i, t, n = 0, e = "", r = arguments.length; n < r; n++) (i = arguments[n]) && (t = un(i)) && (e && (e += " "), e += t);
172
+ return e;
173
+ }
174
+ var j = /* @__PURE__ */ ((i) => (i.default = "0", i.left = "1", i.center = "2", i.right = "3", i.top = "4", i.middle = "5", i.bottom = "6", i.horizon = "7", i.vertical = "8", i))(j || {});
175
+ const Ye = {
159
176
  id: "sheet.operation.set-image-align",
160
- type: CommandType.OPERATION,
161
- handler: /* @__PURE__ */ __name((accessor, params) => !0, "handler")
162
- }, imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "univer-image-common-panel-grid", imageCommonPanelBorder = "univer-image-common-panel-border", imageCommonPanelTitle = "univer-image-common-panel-title", imageCommonPanelSubtitle = "univer-image-common-panel-subtitle", imageCommonPanelRow = "univer-image-common-panel-row", imageCommonPanelRowVertical = "univer-image-common-panel-row-vertical", imageCommonPanelColumn = "univer-image-common-panel-column", imageCommonPanelColumnCenter = "univer-image-common-panel-column-center", imageCommonPanelInline = "univer-image-common-panel-inline", imageCommonPanelSpan2 = "univer-image-common-panel-span2", imageCommonPanelSpan3 = "univer-image-common-panel-span3", imageCommonPanelInput = "univer-image-common-panel-input", styles$1 = {
163
- imageCommonPanel,
164
- imageCommonPanelGrid,
165
- imageCommonPanelBorder,
166
- imageCommonPanelTitle,
167
- imageCommonPanelSubtitle,
168
- imageCommonPanelRow,
169
- imageCommonPanelRowVertical,
170
- imageCommonPanelColumn,
171
- imageCommonPanelColumnCenter,
172
- imageCommonPanelInline,
173
- imageCommonPanelSpan2,
174
- imageCommonPanelSpan3,
175
- imageCommonPanelInput
176
- }, DrawingAlign = /* @__PURE__ */ __name((props) => {
177
- const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), { alignShow } = props, [alignValue, setAlignValue] = useState(AlignType.default), alignOptions = [
177
+ type: ve.OPERATION,
178
+ handler: (i, t) => !0
179
+ }, st = "univer-image-common-panel", ot = "univer-image-common-panel-grid", ct = "univer-image-common-panel-border", lt = "univer-image-common-panel-title", mt = "univer-image-common-panel-subtitle", gt = "univer-image-common-panel-row", ut = "univer-image-common-panel-row-vertical", dt = "univer-image-common-panel-column", ht = "univer-image-common-panel-column-center", ft = "univer-image-common-panel-inline", pt = "univer-image-common-panel-span2", Ct = "univer-image-common-panel-span3", wt = "univer-image-common-panel-input", m = {
180
+ imageCommonPanel: st,
181
+ imageCommonPanelGrid: ot,
182
+ imageCommonPanelBorder: ct,
183
+ imageCommonPanelTitle: lt,
184
+ imageCommonPanelSubtitle: mt,
185
+ imageCommonPanelRow: gt,
186
+ imageCommonPanelRowVertical: ut,
187
+ imageCommonPanelColumn: dt,
188
+ imageCommonPanelColumnCenter: ht,
189
+ imageCommonPanelInline: ft,
190
+ imageCommonPanelSpan2: pt,
191
+ imageCommonPanelSpan3: Ct,
192
+ imageCommonPanelInput: wt
193
+ }, vt = (i) => {
194
+ const t = L(me), n = L(te), { alignShow: e } = i, [r, s] = A(j.default), a = [
178
195
  {
179
- label: localeService.t("image-panel.align.default"),
180
- value: AlignType.default
196
+ label: n.t("image-panel.align.default"),
197
+ value: j.default
181
198
  },
182
199
  {
183
200
  options: [
184
201
  {
185
- label: localeService.t("image-panel.align.left"),
186
- value: AlignType.left
202
+ label: n.t("image-panel.align.left"),
203
+ value: j.left
187
204
  },
188
205
  {
189
- label: localeService.t("image-panel.align.center"),
190
- value: AlignType.center
206
+ label: n.t("image-panel.align.center"),
207
+ value: j.center
191
208
  },
192
209
  {
193
- label: localeService.t("image-panel.align.right"),
194
- value: AlignType.right
210
+ label: n.t("image-panel.align.right"),
211
+ value: j.right
195
212
  }
196
213
  ]
197
214
  },
198
215
  {
199
216
  options: [
200
217
  {
201
- label: localeService.t("image-panel.align.top"),
202
- value: AlignType.top
218
+ label: n.t("image-panel.align.top"),
219
+ value: j.top
203
220
  },
204
221
  {
205
- label: localeService.t("image-panel.align.middle"),
206
- value: AlignType.middle
222
+ label: n.t("image-panel.align.middle"),
223
+ value: j.middle
207
224
  },
208
225
  {
209
- label: localeService.t("image-panel.align.bottom"),
210
- value: AlignType.bottom
226
+ label: n.t("image-panel.align.bottom"),
227
+ value: j.bottom
211
228
  }
212
229
  ]
213
230
  },
214
231
  {
215
232
  options: [
216
233
  {
217
- label: localeService.t("image-panel.align.horizon"),
218
- value: AlignType.horizon
234
+ label: n.t("image-panel.align.horizon"),
235
+ value: j.horizon
219
236
  },
220
237
  {
221
- label: localeService.t("image-panel.align.vertical"),
222
- value: AlignType.vertical
238
+ label: n.t("image-panel.align.vertical"),
239
+ value: j.vertical
223
240
  }
224
241
  ]
225
242
  }
226
243
  ];
227
- function handleAlignChange(value) {
228
- setAlignValue(value), commandService.executeCommand(SetDrawingAlignOperation.id, {
229
- alignType: value
244
+ function o(g) {
245
+ s(g), t.executeCommand(Ye.id, {
246
+ alignType: g
230
247
  });
231
248
  }
232
- __name(handleAlignChange, "handleAlignChange");
233
- const gridDisplay = /* @__PURE__ */ __name((isShow) => isShow ? "block" : "none", "gridDisplay");
234
- return /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelGrid, styles$1.imageCommonPanelBorder), style: { display: gridDisplay(alignShow) } }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelTitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-panel.align.title")))), /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn) }, /* @__PURE__ */ React.createElement(Select, { value: alignValue, options: alignOptions, onChange: handleAlignChange }))));
235
- }, "DrawingAlign");
236
- var __assign = function() {
237
- return __assign = Object.assign || function(t) {
238
- for (var s, i = 1, n = arguments.length; i < n; i++) {
239
- s = arguments[i];
240
- for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
249
+ const l = (g) => g ? "block" : "none";
250
+ return /* @__PURE__ */ c.jsxs("div", { className: O(m.imageCommonPanelGrid, m.imageCommonPanelBorder), style: { display: l(e) }, children: [
251
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelTitle), children: /* @__PURE__ */ c.jsx("div", { children: n.t("image-panel.align.title") }) }) }),
252
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn), children: /* @__PURE__ */ c.jsx(cn, { value: r, options: a, onChange: o }) }) })
253
+ ] });
254
+ };
255
+ var $ = function() {
256
+ return $ = Object.assign || function(i) {
257
+ for (var t, n = 1, e = arguments.length; n < e; n++) {
258
+ t = arguments[n];
259
+ for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (i[r] = t[r]);
241
260
  }
242
- return t;
243
- }, __assign.apply(this, arguments);
244
- }, __rest = function(s, e) {
245
- var t = {};
246
- for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
247
- if (s != null && typeof Object.getOwnPropertySymbols == "function")
248
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
249
- e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
250
- return t;
251
- }, IconBase = forwardRef(function(props, ref) {
252
- var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
253
- return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
261
+ return i;
262
+ }, $.apply(this, arguments);
263
+ }, _t = function(i, t) {
264
+ var n = {};
265
+ for (var e in i) Object.prototype.hasOwnProperty.call(i, e) && t.indexOf(e) < 0 && (n[e] = i[e]);
266
+ if (i != null && typeof Object.getOwnPropertySymbols == "function")
267
+ for (var r = 0, e = Object.getOwnPropertySymbols(i); r < e.length; r++)
268
+ t.indexOf(e[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, e[r]) && (n[e[r]] = i[e[r]]);
269
+ return n;
270
+ }, X = Y(function(i, t) {
271
+ var n = i.icon, e = i.id, r = i.className, s = i.extend, a = _t(i, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(e, " ").concat(r || "").trim(), l = on("_".concat(It()));
272
+ return dn(n, "".concat(e), { defIds: n.defIds, idSuffix: l.current }, $({ ref: t, className: o }, a), s);
254
273
  });
255
- function render(node, id, runtimeProps, rootProps, extend) {
256
- return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
257
- return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
274
+ function dn(i, t, n, e, r) {
275
+ return Z(i.tag, $($({ key: t }, St(i, n, r)), e), (bt(i, n).children || []).map(function(s, a) {
276
+ return dn(s, "".concat(t, "-").concat(i.tag, "-").concat(a), n, void 0, r);
258
277
  }));
259
278
  }
260
- __name(render, "render");
261
- function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
262
- var attrs = __assign({}, node.attrs);
263
- extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
264
- var defIds = runtimeProps.defIds;
265
- return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a7) {
266
- var key = _a7[0], value = _a7[1];
267
- typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
268
- })), attrs;
279
+ function St(i, t, n) {
280
+ var e = $({}, i.attrs);
281
+ n != null && n.colorChannel1 && e.fill === "colorChannel1" && (e.fill = n.colorChannel1);
282
+ var r = t.defIds;
283
+ return !r || r.length === 0 || (i.tag === "use" && e["xlink:href"] && (e["xlink:href"] = e["xlink:href"] + t.idSuffix), Object.entries(e).forEach(function(s) {
284
+ var a = s[0], o = s[1];
285
+ typeof o == "string" && (e[a] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
286
+ })), e;
269
287
  }
270
- __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
271
- function replaceRuntimeIdsInDefs(node, runtimeProps) {
272
- var _a7, defIds = runtimeProps.defIds;
273
- return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a7 = node.children) === null || _a7 === void 0) && _a7.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
274
- return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
275
- }) }) : node;
288
+ function bt(i, t) {
289
+ var n, e = t.defIds;
290
+ return !e || e.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? $($({}, i), { children: i.children.map(function(r) {
291
+ return typeof r.attrs.id == "string" && e && e.indexOf(r.attrs.id) > -1 ? $($({}, r), { attrs: $($({}, r.attrs), { id: r.attrs.id + t.idSuffix }) }) : r;
292
+ }) }) : i;
276
293
  }
277
- __name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
278
- function generateShortUuid() {
294
+ function It() {
279
295
  return Math.random().toString(36).substring(2, 8);
280
296
  }
281
- __name(generateShortUuid, "generateShortUuid");
282
- IconBase.displayName = "UniverIcon";
283
- var element$8 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "colorChannel1", d: "M11.0363 12.2367V14.0367C11.0363 14.3681 11.3049 14.6367 11.6363 14.6367C11.9676 14.6367 12.2363 14.3681 12.2363 14.0367V12.2367H14.0364C14.3677 12.2367 14.6364 11.9681 14.6364 11.6367C14.6364 11.3054 14.3677 11.0367 14.0364 11.0367H12.2363V9.23672C12.2363 8.90535 11.9676 8.63672 11.6363 8.63672C11.3049 8.63672 11.0363 8.90535 11.0363 9.23672V11.0367H9.23635C8.90498 11.0367 8.63635 11.3054 8.63635 11.6367C8.63635 11.9681 8.90498 12.2367 9.23635 12.2367H11.0363Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M2.56365 1.36377C1.90091 1.36377 1.36365 1.90103 1.36365 2.56377V6.16377C1.36365 6.82651 1.90091 7.36377 2.56365 7.36377H6.16365C6.82639 7.36377 7.36365 6.82651 7.36365 6.16377V2.56377C7.36365 1.90103 6.82639 1.36377 6.16365 1.36377H2.56365zM6.16365 2.56377H2.56365L2.56365 6.16377H6.16365V2.56377zM2.56365 8.63647C1.90091 8.63647 1.36365 9.17373 1.36365 9.83647V13.4365C1.36365 14.0992 1.90091 14.6365 2.56365 14.6365H6.16365C6.82639 14.6365 7.36365 14.0992 7.36365 13.4365V9.83647C7.36365 9.17373 6.82639 8.63647 6.16365 8.63647H2.56365zM6.16365 9.83647H2.56365L2.56365 13.4365H6.16365V9.83647zM9.83635 7.36377C9.17361 7.36377 8.63635 6.82651 8.63635 6.16377V2.56377C8.63635 1.90103 9.17361 1.36377 9.83635 1.36377H13.4364C14.0991 1.36377 14.6364 1.90103 14.6364 2.56377V6.16377C14.6364 6.82651 14.0991 7.36377 13.4364 7.36377H9.83635zM9.83635 6.16377V2.56377L13.4364 2.56377V6.16377H9.83635z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Autofill = forwardRef(function(props, ref) {
284
- return createElement(IconBase, Object.assign({}, props, {
297
+ X.displayName = "UniverIcon";
298
+ var Pt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "colorChannel1", d: "M11.0363 12.2367V14.0367C11.0363 14.3681 11.3049 14.6367 11.6363 14.6367C11.9676 14.6367 12.2363 14.3681 12.2363 14.0367V12.2367H14.0364C14.3677 12.2367 14.6364 11.9681 14.6364 11.6367C14.6364 11.3054 14.3677 11.0367 14.0364 11.0367H12.2363V9.23672C12.2363 8.90535 11.9676 8.63672 11.6363 8.63672C11.3049 8.63672 11.0363 8.90535 11.0363 9.23672V11.0367H9.23635C8.90498 11.0367 8.63635 11.3054 8.63635 11.6367C8.63635 11.9681 8.90498 12.2367 9.23635 12.2367H11.0363Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M2.56365 1.36377C1.90091 1.36377 1.36365 1.90103 1.36365 2.56377V6.16377C1.36365 6.82651 1.90091 7.36377 2.56365 7.36377H6.16365C6.82639 7.36377 7.36365 6.82651 7.36365 6.16377V2.56377C7.36365 1.90103 6.82639 1.36377 6.16365 1.36377H2.56365zM6.16365 2.56377H2.56365L2.56365 6.16377H6.16365V2.56377zM2.56365 8.63647C1.90091 8.63647 1.36365 9.17373 1.36365 9.83647V13.4365C1.36365 14.0992 1.90091 14.6365 2.56365 14.6365H6.16365C6.82639 14.6365 7.36365 14.0992 7.36365 13.4365V9.83647C7.36365 9.17373 6.82639 8.63647 6.16365 8.63647H2.56365zM6.16365 9.83647H2.56365L2.56365 13.4365H6.16365V9.83647zM9.83635 7.36377C9.17361 7.36377 8.63635 6.82651 8.63635 6.16377V2.56377C8.63635 1.90103 9.17361 1.36377 9.83635 1.36377H13.4364C14.0991 1.36377 14.6364 1.90103 14.6364 2.56377V6.16377C14.6364 6.82651 14.0991 7.36377 13.4364 7.36377H9.83635zM9.83635 6.16377V2.56377L13.4364 2.56377V6.16377H9.83635z", fillRule: "evenodd", clipRule: "evenodd" } }] }, hn = Y(function(i, t) {
299
+ return Z(X, Object.assign({}, i, {
285
300
  id: "autofill",
286
- ref,
287
- icon: element$8
301
+ ref: t,
302
+ icon: Pt
288
303
  }));
289
304
  });
290
- Autofill.displayName = "Autofill";
291
- var element$7 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.0045 4.4334C14.8881 4.4334 15.6045 3.71705 15.6045 2.8334 15.6045 1.94974 14.8881 1.2334 14.0045 1.2334H3.70449C2.82084 1.2334 2.10449 1.94974 2.10449 2.8334 2.10449 3.71705 2.82084 4.4334 3.70449 4.4334H14.0045zM14.4045 2.8334C14.4045 3.05431 14.2254 3.2334 14.0045 3.2334H3.70449C3.48358 3.2334 3.30449 3.05431 3.30449 2.8334 3.30449 2.61248 3.48358 2.4334 3.70449 2.4334H14.0045C14.2254 2.4334 14.4045 2.61249 14.4045 2.8334zM14.1544 8.5999C15.038 8.5999 15.7544 7.88356 15.7544 6.9999 15.7544 6.11625 15.038 5.3999 14.1544 5.3999H3.85439C2.97074 5.3999 2.25439 6.11625 2.25439 6.9999 2.25439 7.88356 2.97074 8.5999 3.85439 8.5999H14.1544zM14.5544 6.9999C14.5544 7.22082 14.3753 7.3999 14.1544 7.3999H3.85439C3.63348 7.3999 3.45439 7.22082 3.45439 6.9999 3.45439 6.77899 3.63348 6.5999 3.85439 6.5999H14.1544C14.3753 6.5999 14.5544 6.77899 14.5544 6.9999z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M8.57975 14.5902L6.58023 12.5907C6.34591 12.3564 6.34591 11.9765 6.58023 11.7421 6.81454 11.5078 7.19444 11.5078 7.42876 11.7421L8.40449 12.7179V10.1664C8.40449 9.83504 8.67312 9.56641 9.00449 9.56641 9.33586 9.56641 9.60449 9.83504 9.60449 10.1664V12.7179L10.5802 11.7421C10.8145 11.5078 11.1944 11.5078 11.4288 11.7421 11.6631 11.9765 11.6631 12.3564 11.4288 12.5907L9.42923 14.5902M8.57975 14.5902C8.58121 14.5917 8.58268 14.5931 8.58416 14.5946 8.64077 14.6502 8.70566 14.6923 8.77482 14.7209 8.84557 14.7502 8.92314 14.7664 9.00449 14.7664 9.08585 14.7664 9.16342 14.7502 9.23416 14.7209 9.30332 14.6923 9.36821 14.6502 9.42482 14.5946" } }] }, BottomSingle = forwardRef(function(props, ref) {
292
- return createElement(IconBase, Object.assign({}, props, {
305
+ hn.displayName = "Autofill";
306
+ var yt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.0045 4.4334C14.8881 4.4334 15.6045 3.71705 15.6045 2.8334 15.6045 1.94974 14.8881 1.2334 14.0045 1.2334H3.70449C2.82084 1.2334 2.10449 1.94974 2.10449 2.8334 2.10449 3.71705 2.82084 4.4334 3.70449 4.4334H14.0045zM14.4045 2.8334C14.4045 3.05431 14.2254 3.2334 14.0045 3.2334H3.70449C3.48358 3.2334 3.30449 3.05431 3.30449 2.8334 3.30449 2.61248 3.48358 2.4334 3.70449 2.4334H14.0045C14.2254 2.4334 14.4045 2.61249 14.4045 2.8334zM14.1544 8.5999C15.038 8.5999 15.7544 7.88356 15.7544 6.9999 15.7544 6.11625 15.038 5.3999 14.1544 5.3999H3.85439C2.97074 5.3999 2.25439 6.11625 2.25439 6.9999 2.25439 7.88356 2.97074 8.5999 3.85439 8.5999H14.1544zM14.5544 6.9999C14.5544 7.22082 14.3753 7.3999 14.1544 7.3999H3.85439C3.63348 7.3999 3.45439 7.22082 3.45439 6.9999 3.45439 6.77899 3.63348 6.5999 3.85439 6.5999H14.1544C14.3753 6.5999 14.5544 6.77899 14.5544 6.9999z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M8.57975 14.5902L6.58023 12.5907C6.34591 12.3564 6.34591 11.9765 6.58023 11.7421 6.81454 11.5078 7.19444 11.5078 7.42876 11.7421L8.40449 12.7179V10.1664C8.40449 9.83504 8.67312 9.56641 9.00449 9.56641 9.33586 9.56641 9.60449 9.83504 9.60449 10.1664V12.7179L10.5802 11.7421C10.8145 11.5078 11.1944 11.5078 11.4288 11.7421 11.6631 11.9765 11.6631 12.3564 11.4288 12.5907L9.42923 14.5902M8.57975 14.5902C8.58121 14.5917 8.58268 14.5931 8.58416 14.5946 8.64077 14.6502 8.70566 14.6923 8.77482 14.7209 8.84557 14.7502 8.92314 14.7664 9.00449 14.7664 9.08585 14.7664 9.16342 14.7502 9.23416 14.7209 9.30332 14.6923 9.36821 14.6502 9.42482 14.5946" } }] }, fn = Y(function(i, t) {
307
+ return Z(X, Object.assign({}, i, {
293
308
  id: "bottom-single",
294
- ref,
295
- icon: element$7
309
+ ref: t,
310
+ icon: yt
296
311
  }));
297
312
  });
298
- BottomSingle.displayName = "BottomSingle";
299
- var element$6 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.97705 7.51296C5.97705 7.18159 6.24568 6.91296 6.57705 6.91296H8.48632C8.81769 6.91296 9.08632 7.18159 9.08632 7.51296 9.08632 7.84433 8.81769 8.11296 8.48632 8.11296H6.57705C6.24568 8.11296 5.97705 7.84433 5.97705 7.51296zM6.57705 9.41028C6.24568 9.41028 5.97705 9.67891 5.97705 10.0103 5.97705 10.3416 6.24568 10.6103 6.57705 10.6103H10.8199C11.1512 10.6103 11.4199 10.3416 11.4199 10.0103 11.4199 9.67891 11.1512 9.41028 10.8199 9.41028H6.57705z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M3.51074 2.37063C3.51074 1.48697 4.22709 0.77063 5.11074 0.77063H9.80318L9.81294 0.770708C9.97168 0.768161 10.1311 0.82824 10.2511 0.95055L14.4317 5.21408C14.5165 5.30049 14.5697 5.406 14.5917 5.51645C14.6041 5.5644 14.6106 5.61467 14.6106 5.66648V11.6406C14.6106 12.5243 13.8943 13.2406 13.0106 13.2406H5.11074C4.22709 13.2406 3.51074 12.5243 3.51074 11.6406V2.37063ZM10.4032 4.66648V2.81964L12.6063 5.06648H10.8032C10.5823 5.06648 10.4032 4.88739 10.4032 4.66648ZM5.11074 1.97063C4.88983 1.97063 4.71074 2.14972 4.71074 2.37063V11.6406C4.71074 11.8615 4.88983 12.0406 5.11074 12.0406H13.0106C13.2316 12.0406 13.4106 11.8615 13.4106 11.6406V6.26648H10.8032C9.91953 6.26648 9.20318 5.55013 9.20318 4.66648V1.97063H5.11074Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M2.58916 6.6741C2.58916 6.34273 2.32053 6.0741 1.98916 6.0741C1.65779 6.0741 1.38916 6.34273 1.38916 6.6741V12.6294C1.38916 14.0653 2.55322 15.2294 3.98916 15.2294H9.41408C9.74545 15.2294 10.0141 14.9607 10.0141 14.6294C10.0141 14.298 9.74545 14.0294 9.41408 14.0294H3.98916C3.21596 14.0294 2.58916 13.4026 2.58916 12.6294V6.6741Z" } }] }, CreateCopySingle = forwardRef(function(props, ref) {
300
- return createElement(IconBase, Object.assign({}, props, {
313
+ fn.displayName = "BottomSingle";
314
+ var jt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.97705 7.51296C5.97705 7.18159 6.24568 6.91296 6.57705 6.91296H8.48632C8.81769 6.91296 9.08632 7.18159 9.08632 7.51296 9.08632 7.84433 8.81769 8.11296 8.48632 8.11296H6.57705C6.24568 8.11296 5.97705 7.84433 5.97705 7.51296zM6.57705 9.41028C6.24568 9.41028 5.97705 9.67891 5.97705 10.0103 5.97705 10.3416 6.24568 10.6103 6.57705 10.6103H10.8199C11.1512 10.6103 11.4199 10.3416 11.4199 10.0103 11.4199 9.67891 11.1512 9.41028 10.8199 9.41028H6.57705z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M3.51074 2.37063C3.51074 1.48697 4.22709 0.77063 5.11074 0.77063H9.80318L9.81294 0.770708C9.97168 0.768161 10.1311 0.82824 10.2511 0.95055L14.4317 5.21408C14.5165 5.30049 14.5697 5.406 14.5917 5.51645C14.6041 5.5644 14.6106 5.61467 14.6106 5.66648V11.6406C14.6106 12.5243 13.8943 13.2406 13.0106 13.2406H5.11074C4.22709 13.2406 3.51074 12.5243 3.51074 11.6406V2.37063ZM10.4032 4.66648V2.81964L12.6063 5.06648H10.8032C10.5823 5.06648 10.4032 4.88739 10.4032 4.66648ZM5.11074 1.97063C4.88983 1.97063 4.71074 2.14972 4.71074 2.37063V11.6406C4.71074 11.8615 4.88983 12.0406 5.11074 12.0406H13.0106C13.2316 12.0406 13.4106 11.8615 13.4106 11.6406V6.26648H10.8032C9.91953 6.26648 9.20318 5.55013 9.20318 4.66648V1.97063H5.11074Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M2.58916 6.6741C2.58916 6.34273 2.32053 6.0741 1.98916 6.0741C1.65779 6.0741 1.38916 6.34273 1.38916 6.6741V12.6294C1.38916 14.0653 2.55322 15.2294 3.98916 15.2294H9.41408C9.74545 15.2294 10.0141 14.9607 10.0141 14.6294C10.0141 14.298 9.74545 14.0294 9.41408 14.0294H3.98916C3.21596 14.0294 2.58916 13.4026 2.58916 12.6294V6.6741Z" } }] }, pn = Y(function(i, t) {
315
+ return Z(X, Object.assign({}, i, {
301
316
  id: "create-copy-single",
302
- ref,
303
- icon: element$6
317
+ ref: t,
318
+ icon: jt
304
319
  }));
305
320
  });
306
- CreateCopySingle.displayName = "CreateCopySingle";
307
- var element$5 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.38125 1.16211C6.49759 1.16211 5.78125 1.87845 5.78125 2.76211V5.6377H2.87783C1.99418 5.6377 1.27783 6.35404 1.27783 7.2377V13.2377C1.27783 14.1214 1.99418 14.8377 2.87783 14.8377H8.87783C9.76149 14.8377 10.4778 14.1214 10.4778 13.2377V10.3621H13.3813C14.2649 10.3621 14.9813 9.64577 14.9813 8.76211V2.76211C14.9813 1.87845 14.2649 1.16211 13.3813 1.16211H7.38125ZM10.4778 9.16211H13.3813C13.6022 9.16211 13.7812 8.98302 13.7812 8.76211V2.76211C13.7812 2.5412 13.6022 2.36211 13.3813 2.36211H7.38125C7.16034 2.36211 6.98125 2.5412 6.98125 2.76211V5.6377H8.87783C9.76149 5.6377 10.4778 6.35404 10.4778 7.2377V9.16211ZM6.98125 6.8377H8.87783C9.09875 6.8377 9.27783 7.01678 9.27783 7.2377V9.16211H7.38125C7.16034 9.16211 6.98125 8.98302 6.98125 8.76211V6.8377ZM5.78125 6.8377V8.76211C5.78125 9.64577 6.49759 10.3621 7.38125 10.3621H9.27783V13.2377C9.27783 13.4586 9.09875 13.6377 8.87783 13.6377H2.87783C2.65692 13.6377 2.47783 13.4586 2.47783 13.2377V7.2377C2.47783 7.01678 2.65692 6.8377 2.87783 6.8377H5.78125Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, GroupSingle = forwardRef(function(props, ref) {
308
- return createElement(IconBase, Object.assign({}, props, {
321
+ pn.displayName = "CreateCopySingle";
322
+ var Rt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.38125 1.16211C6.49759 1.16211 5.78125 1.87845 5.78125 2.76211V5.6377H2.87783C1.99418 5.6377 1.27783 6.35404 1.27783 7.2377V13.2377C1.27783 14.1214 1.99418 14.8377 2.87783 14.8377H8.87783C9.76149 14.8377 10.4778 14.1214 10.4778 13.2377V10.3621H13.3813C14.2649 10.3621 14.9813 9.64577 14.9813 8.76211V2.76211C14.9813 1.87845 14.2649 1.16211 13.3813 1.16211H7.38125ZM10.4778 9.16211H13.3813C13.6022 9.16211 13.7812 8.98302 13.7812 8.76211V2.76211C13.7812 2.5412 13.6022 2.36211 13.3813 2.36211H7.38125C7.16034 2.36211 6.98125 2.5412 6.98125 2.76211V5.6377H8.87783C9.76149 5.6377 10.4778 6.35404 10.4778 7.2377V9.16211ZM6.98125 6.8377H8.87783C9.09875 6.8377 9.27783 7.01678 9.27783 7.2377V9.16211H7.38125C7.16034 9.16211 6.98125 8.98302 6.98125 8.76211V6.8377ZM5.78125 6.8377V8.76211C5.78125 9.64577 6.49759 10.3621 7.38125 10.3621H9.27783V13.2377C9.27783 13.4586 9.09875 13.6377 8.87783 13.6377H2.87783C2.65692 13.6377 2.47783 13.4586 2.47783 13.2377V7.2377C2.47783 7.01678 2.65692 6.8377 2.87783 6.8377H5.78125Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Cn = Y(function(i, t) {
323
+ return Z(X, Object.assign({}, i, {
309
324
  id: "group-single",
310
- ref,
311
- icon: element$5
325
+ ref: t,
326
+ icon: Rt
312
327
  }));
313
328
  });
314
- GroupSingle.displayName = "GroupSingle";
315
- var element$4 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, MoreDownSingle = forwardRef(function(props, ref) {
316
- return createElement(IconBase, Object.assign({}, props, {
329
+ Cn.displayName = "GroupSingle";
330
+ var Mt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, wn = Y(function(i, t) {
331
+ return Z(X, Object.assign({}, i, {
317
332
  id: "more-down-single",
318
- ref,
319
- icon: element$4
333
+ ref: t,
334
+ icon: Mt
320
335
  }));
321
336
  });
322
- MoreDownSingle.displayName = "MoreDownSingle";
323
- var element$3 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.25 2.96401C1.25 3.84767 1.96634 4.56401 2.85 4.56401H13.15C14.0337 4.56401 14.75 3.84767 14.75 2.96401C14.75 2.08036 14.0337 1.36401 13.15 1.36401H2.85C1.96635 1.36401 1.25 2.08036 1.25 2.96401ZM2.85 3.36401C2.62909 3.36401 2.45 3.18493 2.45 2.96401C2.45 2.7431 2.62909 2.56401 2.85 2.56401H13.15C13.3709 2.56401 13.55 2.7431 13.55 2.96401C13.55 3.18493 13.3709 3.36401 13.15 3.36401H2.85Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.57564 11.6118C5.80995 11.3774 6.18985 11.3774 6.42417 11.6118L7.3999 12.5875V6.36951C7.3999 6.03814 7.66853 5.76951 7.9999 5.76951C8.33127 5.76951 8.5999 6.03814 8.5999 6.36951V12.5875L9.57564 11.6118C9.80995 11.3774 10.1899 11.3774 10.4242 11.6118C10.6585 11.8461 10.6585 12.226 10.4242 12.4603L8.4324 14.452C8.32324 14.5655 8.16982 14.6362 7.9999 14.6362C7.82998 14.6362 7.67655 14.5655 7.56739 14.452L5.57564 12.4603C5.34132 12.226 5.34132 11.8461 5.57564 11.6118Z" } }] }, MoveDownSingle = forwardRef(function(props, ref) {
324
- return createElement(IconBase, Object.assign({}, props, {
337
+ wn.displayName = "MoreDownSingle";
338
+ var xt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.25 2.96401C1.25 3.84767 1.96634 4.56401 2.85 4.56401H13.15C14.0337 4.56401 14.75 3.84767 14.75 2.96401C14.75 2.08036 14.0337 1.36401 13.15 1.36401H2.85C1.96635 1.36401 1.25 2.08036 1.25 2.96401ZM2.85 3.36401C2.62909 3.36401 2.45 3.18493 2.45 2.96401C2.45 2.7431 2.62909 2.56401 2.85 2.56401H13.15C13.3709 2.56401 13.55 2.7431 13.55 2.96401C13.55 3.18493 13.3709 3.36401 13.15 3.36401H2.85Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.57564 11.6118C5.80995 11.3774 6.18985 11.3774 6.42417 11.6118L7.3999 12.5875V6.36951C7.3999 6.03814 7.66853 5.76951 7.9999 5.76951C8.33127 5.76951 8.5999 6.03814 8.5999 6.36951V12.5875L9.57564 11.6118C9.80995 11.3774 10.1899 11.3774 10.4242 11.6118C10.6585 11.8461 10.6585 12.226 10.4242 12.4603L8.4324 14.452C8.32324 14.5655 8.16982 14.6362 7.9999 14.6362C7.82998 14.6362 7.67655 14.5655 7.56739 14.452L5.57564 12.4603C5.34132 12.226 5.34132 11.8461 5.57564 11.6118Z" } }] }, vn = Y(function(i, t) {
339
+ return Z(X, Object.assign({}, i, {
325
340
  id: "move-down-single",
326
- ref,
327
- icon: element$3
341
+ ref: t,
342
+ icon: xt
328
343
  }));
329
344
  });
330
- MoveDownSingle.displayName = "MoveDownSingle";
331
- var element$2 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.25 13.036C1.25 12.1523 1.96634 11.436 2.85 11.436H13.15C14.0337 11.436 14.75 12.1523 14.75 13.036C14.75 13.9196 14.0337 14.636 13.15 14.636H2.85C1.96635 14.636 1.25 13.9196 1.25 13.036ZM2.85 12.636C2.62909 12.636 2.45 12.8151 2.45 13.036C2.45 13.2569 2.62909 13.436 2.85 13.436H13.15C13.3709 13.436 13.55 13.2569 13.55 13.036C13.55 12.8151 13.3709 12.636 13.15 12.636H2.85Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.57564 4.38825C5.80995 4.62256 6.18985 4.62256 6.42417 4.38825L7.3999 3.41251V9.63049C7.3999 9.96186 7.66853 10.2305 7.9999 10.2305C8.33127 10.2305 8.5999 9.96186 8.5999 9.63049V3.41251L9.57564 4.38825C9.80995 4.62256 10.1899 4.62256 10.4242 4.38825C10.6585 4.15393 10.6585 3.77403 10.4242 3.53972L8.4324 1.54796C8.32324 1.43445 8.16982 1.36382 7.9999 1.36382C7.82998 1.36382 7.67655 1.43446 7.56739 1.54797L5.57564 3.53972C5.34132 3.77403 5.34132 4.15393 5.57564 4.38825Z" } }] }, MoveUpSingle = forwardRef(function(props, ref) {
332
- return createElement(IconBase, Object.assign({}, props, {
345
+ vn.displayName = "MoveDownSingle";
346
+ var Ot = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.25 13.036C1.25 12.1523 1.96634 11.436 2.85 11.436H13.15C14.0337 11.436 14.75 12.1523 14.75 13.036C14.75 13.9196 14.0337 14.636 13.15 14.636H2.85C1.96635 14.636 1.25 13.9196 1.25 13.036ZM2.85 12.636C2.62909 12.636 2.45 12.8151 2.45 13.036C2.45 13.2569 2.62909 13.436 2.85 13.436H13.15C13.3709 13.436 13.55 13.2569 13.55 13.036C13.55 12.8151 13.3709 12.636 13.15 12.636H2.85Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.57564 4.38825C5.80995 4.62256 6.18985 4.62256 6.42417 4.38825L7.3999 3.41251V9.63049C7.3999 9.96186 7.66853 10.2305 7.9999 10.2305C8.33127 10.2305 8.5999 9.96186 8.5999 9.63049V3.41251L9.57564 4.38825C9.80995 4.62256 10.1899 4.62256 10.4242 4.38825C10.6585 4.15393 10.6585 3.77403 10.4242 3.53972L8.4324 1.54796C8.32324 1.43445 8.16982 1.36382 7.9999 1.36382C7.82998 1.36382 7.67655 1.43446 7.56739 1.54797L5.57564 3.53972C5.34132 3.77403 5.34132 4.15393 5.57564 4.38825Z" } }] }, _n = Y(function(i, t) {
347
+ return Z(X, Object.assign({}, i, {
333
348
  id: "move-up-single",
334
- ref,
335
- icon: element$2
349
+ ref: t,
350
+ icon: Ot
336
351
  }));
337
352
  });
338
- MoveUpSingle.displayName = "MoveUpSingle";
339
- var element$1 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.82994 1.40913C7.88746 1.35161 7.95376 1.30821 8.02453 1.27893C8.09527 1.24959 8.17285 1.2334 8.2542 1.2334C8.33555 1.2334 8.41313 1.24959 8.48387 1.27893C8.55464 1.30821 8.62094 1.35161 8.67846 1.40913L10.6785 3.40913C10.9128 3.64345 10.9128 4.02335 10.6785 4.25766C10.4441 4.49198 10.0642 4.49198 9.82994 4.25766L8.8542 3.28193V5.8334C8.8542 6.16477 8.58557 6.4334 8.2542 6.4334C7.92283 6.4334 7.6542 6.16477 7.6542 5.8334V3.28193L6.67846 4.25766C6.44415 4.49198 6.06425 4.49198 5.82994 4.25766C5.59562 4.02335 5.59562 3.64345 5.82994 3.40913L7.82994 1.40913Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.50439 9C1.50439 8.11634 2.22074 7.4 3.10439 7.4H13.4044C14.288 7.4 15.0044 8.11634 15.0044 9 15.0044 9.88366 14.2881 10.6 13.4044 10.6H3.1044C2.22074 10.6 1.50439 9.88366 1.50439 9zM3.10439 8.6C2.88348 8.6 2.70439 8.77909 2.70439 9 2.70439 9.22091 2.88348 9.4 3.1044 9.4H13.4044C13.6253 9.4 13.8044 9.22091 13.8044 9 13.8044 8.77909 13.6253 8.6 13.4044 8.6H3.10439zM1.6543 13.1665C1.6543 12.2828 2.37064 11.5665 3.2543 11.5665H13.5543C14.438 11.5665 15.1543 12.2828 15.1543 13.1665 15.1543 14.0502 14.438 14.7665 13.5543 14.7665H3.2543C2.37064 14.7665 1.6543 14.0502 1.6543 13.1665zM3.2543 12.7665C3.03338 12.7665 2.8543 12.9456 2.8543 13.1665 2.8543 13.3874 3.03338 13.5665 3.2543 13.5665H13.5543C13.7752 13.5665 13.9543 13.3874 13.9543 13.1665 13.9543 12.9456 13.7752 12.7665 13.5543 12.7665H3.2543z", fillRule: "evenodd", clipRule: "evenodd" } }] }, TopmostSingle = forwardRef(function(props, ref) {
340
- return createElement(IconBase, Object.assign({}, props, {
353
+ _n.displayName = "MoveUpSingle";
354
+ var Nt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.82994 1.40913C7.88746 1.35161 7.95376 1.30821 8.02453 1.27893C8.09527 1.24959 8.17285 1.2334 8.2542 1.2334C8.33555 1.2334 8.41313 1.24959 8.48387 1.27893C8.55464 1.30821 8.62094 1.35161 8.67846 1.40913L10.6785 3.40913C10.9128 3.64345 10.9128 4.02335 10.6785 4.25766C10.4441 4.49198 10.0642 4.49198 9.82994 4.25766L8.8542 3.28193V5.8334C8.8542 6.16477 8.58557 6.4334 8.2542 6.4334C7.92283 6.4334 7.6542 6.16477 7.6542 5.8334V3.28193L6.67846 4.25766C6.44415 4.49198 6.06425 4.49198 5.82994 4.25766C5.59562 4.02335 5.59562 3.64345 5.82994 3.40913L7.82994 1.40913Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.50439 9C1.50439 8.11634 2.22074 7.4 3.10439 7.4H13.4044C14.288 7.4 15.0044 8.11634 15.0044 9 15.0044 9.88366 14.2881 10.6 13.4044 10.6H3.1044C2.22074 10.6 1.50439 9.88366 1.50439 9zM3.10439 8.6C2.88348 8.6 2.70439 8.77909 2.70439 9 2.70439 9.22091 2.88348 9.4 3.1044 9.4H13.4044C13.6253 9.4 13.8044 9.22091 13.8044 9 13.8044 8.77909 13.6253 8.6 13.4044 8.6H3.10439zM1.6543 13.1665C1.6543 12.2828 2.37064 11.5665 3.2543 11.5665H13.5543C14.438 11.5665 15.1543 12.2828 15.1543 13.1665 15.1543 14.0502 14.438 14.7665 13.5543 14.7665H3.2543C2.37064 14.7665 1.6543 14.0502 1.6543 13.1665zM3.2543 12.7665C3.03338 12.7665 2.8543 12.9456 2.8543 13.1665 2.8543 13.3874 3.03338 13.5665 3.2543 13.5665H13.5543C13.7752 13.5665 13.9543 13.3874 13.9543 13.1665 13.9543 12.9456 13.7752 12.7665 13.5543 12.7665H3.2543z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Sn = Y(function(i, t) {
355
+ return Z(X, Object.assign({}, i, {
341
356
  id: "topmost-single",
342
- ref,
343
- icon: element$1
357
+ ref: t,
358
+ icon: Nt
344
359
  }));
345
360
  });
346
- TopmostSingle.displayName = "TopmostSingle";
347
- var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.46855 2.83731C7.46855 2.61639 7.64764 2.4373 7.86855 2.4373H13.8603C14.0812 2.4373 14.2603 2.61639 14.2603 2.8373V9.5049C14.2603 9.72581 14.0812 9.90489 13.8603 9.90489H12.866C12.5346 9.90489 12.266 10.1735 12.266 10.5049C12.266 10.8363 12.5346 11.1049 12.866 11.1049H13.8603C14.7439 11.1049 15.4603 10.3886 15.4603 9.5049V2.8373C15.4603 1.95365 14.7439 1.2373 13.8603 1.2373H7.86855C6.9849 1.2373 6.26855 1.95365 6.26855 2.83731V3.48688C6.26855 3.81825 6.53718 4.08688 6.86855 4.08688C7.19993 4.08688 7.46855 3.81825 7.46855 3.48688V2.83731Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M3.19888 5.56299C2.31522 5.56299 1.59888 6.27933 1.59888 7.16299V13.163C1.59888 14.0466 2.31522 14.763 3.19888 14.763H9.19888C10.0825 14.763 10.7989 14.0466 10.7989 13.163V7.16299C10.7989 6.27933 10.0825 5.56299 9.19888 5.56299H3.19888ZM2.79888 7.16299C2.79888 6.94207 2.97796 6.76299 3.19888 6.76299H9.19888C9.41979 6.76299 9.59888 6.94207 9.59888 7.16299V13.163C9.59888 13.3839 9.41979 13.563 9.19888 13.563H3.19888C2.97796 13.563 2.79888 13.3839 2.79888 13.163V7.16299Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, UngroupSingle = forwardRef(function(props, ref) {
348
- return createElement(IconBase, Object.assign({}, props, {
361
+ Sn.displayName = "TopmostSingle";
362
+ var Dt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.46855 2.83731C7.46855 2.61639 7.64764 2.4373 7.86855 2.4373H13.8603C14.0812 2.4373 14.2603 2.61639 14.2603 2.8373V9.5049C14.2603 9.72581 14.0812 9.90489 13.8603 9.90489H12.866C12.5346 9.90489 12.266 10.1735 12.266 10.5049C12.266 10.8363 12.5346 11.1049 12.866 11.1049H13.8603C14.7439 11.1049 15.4603 10.3886 15.4603 9.5049V2.8373C15.4603 1.95365 14.7439 1.2373 13.8603 1.2373H7.86855C6.9849 1.2373 6.26855 1.95365 6.26855 2.83731V3.48688C6.26855 3.81825 6.53718 4.08688 6.86855 4.08688C7.19993 4.08688 7.46855 3.81825 7.46855 3.48688V2.83731Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M3.19888 5.56299C2.31522 5.56299 1.59888 6.27933 1.59888 7.16299V13.163C1.59888 14.0466 2.31522 14.763 3.19888 14.763H9.19888C10.0825 14.763 10.7989 14.0466 10.7989 13.163V7.16299C10.7989 6.27933 10.0825 5.56299 9.19888 5.56299H3.19888ZM2.79888 7.16299C2.79888 6.94207 2.97796 6.76299 3.19888 6.76299H9.19888C9.41979 6.76299 9.59888 6.94207 9.59888 7.16299V13.163C9.59888 13.3839 9.41979 13.563 9.19888 13.563H3.19888C2.97796 13.563 2.79888 13.3839 2.79888 13.163V7.16299Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, bn = Y(function(i, t) {
363
+ return Z(X, Object.assign({}, i, {
349
364
  id: "ungroup-single",
350
- ref,
351
- icon: element
365
+ ref: t,
366
+ icon: Dt
352
367
  }));
353
368
  });
354
- UngroupSingle.displayName = "UngroupSingle";
355
- const DrawingArrange = /* @__PURE__ */ __name((props) => {
356
- const { arrangeShow, drawings: focusDrawings } = props, localeService = useDependency(LocaleService), drawingManagerService = useDependency(IDrawingManagerService), gridDisplay = /* @__PURE__ */ __name((isShow) => isShow ? "block" : "none", "gridDisplay"), [drawings, setDrawings] = useState(focusDrawings);
357
- useEffect(() => {
358
- const focusDispose = drawingManagerService.focus$.subscribe((drawings2) => {
359
- setDrawings(drawings2);
369
+ bn.displayName = "UngroupSingle";
370
+ const Et = (i) => {
371
+ const { arrangeShow: t, drawings: n } = i, e = L(te), r = L(ne), s = (g) => g ? "block" : "none", [a, o] = A(n);
372
+ _e(() => {
373
+ const g = r.focus$.subscribe((u) => {
374
+ o(u);
360
375
  });
361
376
  return () => {
362
- focusDispose.unsubscribe();
377
+ g.unsubscribe();
363
378
  };
364
379
  }, []);
365
- const onArrangeBtnClick = /* @__PURE__ */ __name((arrangeType) => {
366
- const unitId = drawings[0].unitId, subUnitId = drawings[0].subUnitId, drawingIds = drawings.map((drawing) => drawing.drawingId);
367
- drawingManagerService.featurePluginOrderUpdateNotification({ unitId, subUnitId, drawingIds, arrangeType });
368
- }, "onArrangeBtnClick");
369
- return /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelGrid, style: { display: gridDisplay(arrangeShow) } }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelTitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-panel.arrange.title")))), /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
370
- onArrangeBtnClick(ArrangeTypeEnum.forward);
371
- }, "onClick") }, /* @__PURE__ */ React.createElement("span", { className: styles$1.imageCommonPanelInline }, /* @__PURE__ */ React.createElement(MoveUpSingle, null), localeService.t("image-panel.arrange.forward")))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
372
- onArrangeBtnClick(ArrangeTypeEnum.backward);
373
- }, "onClick") }, /* @__PURE__ */ React.createElement("span", { className: styles$1.imageCommonPanelInline }, /* @__PURE__ */ React.createElement(MoveDownSingle, null), localeService.t("image-panel.arrange.backward"))))), /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
374
- onArrangeBtnClick(ArrangeTypeEnum.front);
375
- }, "onClick") }, /* @__PURE__ */ React.createElement("span", { className: styles$1.imageCommonPanelInline }, /* @__PURE__ */ React.createElement(TopmostSingle, null), localeService.t("image-panel.arrange.front")))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
376
- onArrangeBtnClick(ArrangeTypeEnum.back);
377
- }, "onClick") }, /* @__PURE__ */ React.createElement("span", { className: styles$1.imageCommonPanelInline }, /* @__PURE__ */ React.createElement(BottomSingle, null), localeService.t("image-panel.arrange.back"))))));
378
- }, "DrawingArrange"), DrawingGroup = /* @__PURE__ */ __name((props) => {
379
- const localeService = useDependency(LocaleService), renderManagerService = useDependency(IRenderManagerService), drawingManagerService = useDependency(IDrawingManagerService), { hasGroup, drawings } = props, [groupShow, setGroupShow] = useState(!1), [groupBtnShow, setGroupBtnShow] = useState(!0), [ungroupBtnShow, setUngroupBtnShow] = useState(!0), gridDisplay = /* @__PURE__ */ __name((isShow) => isShow ? "block" : "none", "gridDisplay"), onGroupBtnClick = /* @__PURE__ */ __name(() => {
380
- const focusDrawings = drawingManagerService.getFocusDrawings(), { unitId, subUnitId } = focusDrawings[0], groupId = Tools.generateRandomId(10), groupTransform = getGroupState(0, 0, focusDrawings.map((o) => o.transform || {})), groupParam = {
381
- unitId,
382
- subUnitId,
383
- drawingId: groupId,
384
- drawingType: DrawingTypeEnum.DRAWING_GROUP,
385
- transform: groupTransform
386
- }, children = focusDrawings.map((drawing) => {
387
- const transform = drawing.transform || { left: 0, top: 0 }, { unitId: unitId2, subUnitId: subUnitId2, drawingId } = drawing;
380
+ const l = (g) => {
381
+ const u = a[0].unitId, d = a[0].subUnitId, h = a.map((f) => f.drawingId);
382
+ r.featurePluginOrderUpdateNotification({ unitId: u, subUnitId: d, drawingIds: h, arrangeType: g });
383
+ };
384
+ return /* @__PURE__ */ c.jsxs("div", { className: m.imageCommonPanelGrid, style: { display: s(t) }, children: [
385
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelTitle), children: /* @__PURE__ */ c.jsx("div", { children: e.t("image-panel.arrange.title") }) }) }),
386
+ /* @__PURE__ */ c.jsxs("div", { className: m.imageCommonPanelRow, children: [
387
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan2), children: /* @__PURE__ */ c.jsx(ce, { size: "small", onClick: () => {
388
+ l(be.forward);
389
+ }, children: /* @__PURE__ */ c.jsxs("span", { className: m.imageCommonPanelInline, children: [
390
+ /* @__PURE__ */ c.jsx(_n, {}),
391
+ e.t("image-panel.arrange.forward")
392
+ ] }) }) }),
393
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan2), children: /* @__PURE__ */ c.jsx(ce, { size: "small", onClick: () => {
394
+ l(be.backward);
395
+ }, children: /* @__PURE__ */ c.jsxs("span", { className: m.imageCommonPanelInline, children: [
396
+ /* @__PURE__ */ c.jsx(vn, {}),
397
+ e.t("image-panel.arrange.backward")
398
+ ] }) }) })
399
+ ] }),
400
+ /* @__PURE__ */ c.jsxs("div", { className: m.imageCommonPanelRow, children: [
401
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan2), children: /* @__PURE__ */ c.jsx(ce, { size: "small", onClick: () => {
402
+ l(be.front);
403
+ }, children: /* @__PURE__ */ c.jsxs("span", { className: m.imageCommonPanelInline, children: [
404
+ /* @__PURE__ */ c.jsx(Sn, {}),
405
+ e.t("image-panel.arrange.front")
406
+ ] }) }) }),
407
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan2), children: /* @__PURE__ */ c.jsx(ce, { size: "small", onClick: () => {
408
+ l(be.back);
409
+ }, children: /* @__PURE__ */ c.jsxs("span", { className: m.imageCommonPanelInline, children: [
410
+ /* @__PURE__ */ c.jsx(fn, {}),
411
+ e.t("image-panel.arrange.back")
412
+ ] }) }) })
413
+ ] })
414
+ ] });
415
+ }, Tt = (i) => {
416
+ const t = L(te), n = L(ue), e = L(ne), { hasGroup: r, drawings: s } = i, [a, o] = A(!1), [l, g] = A(!0), [u, d] = A(!0), h = (p) => p ? "block" : "none", f = () => {
417
+ const p = e.getFocusDrawings(), { unitId: S, subUnitId: _ } = p[0], R = An.generateRandomId(10), b = En(0, 0, p.map((y) => y.transform || {})), N = {
418
+ unitId: S,
419
+ subUnitId: _,
420
+ drawingId: R,
421
+ drawingType: ee.DRAWING_GROUP,
422
+ transform: b
423
+ }, I = p.map((y) => {
424
+ const P = y.transform || { left: 0, top: 0 }, { unitId: M, subUnitId: D, drawingId: B } = y;
388
425
  return {
389
- unitId: unitId2,
390
- subUnitId: subUnitId2,
391
- drawingId,
426
+ unitId: M,
427
+ subUnitId: D,
428
+ drawingId: B,
392
429
  transform: {
393
- ...transform,
394
- left: transform.left - groupTransform.left,
395
- top: transform.top - groupTransform.top
430
+ ...P,
431
+ left: P.left - b.left,
432
+ top: P.top - b.top
396
433
  },
397
- groupId
434
+ groupId: R
398
435
  };
399
436
  });
400
- drawingManagerService.featurePluginGroupUpdateNotification([{
401
- parent: groupParam,
402
- children
437
+ e.featurePluginGroupUpdateNotification([{
438
+ parent: N,
439
+ children: I
403
440
  }]);
404
- }, "onGroupBtnClick"), ungroup = /* @__PURE__ */ __name((param) => {
405
- if (param.drawingType !== DrawingTypeEnum.DRAWING_GROUP)
441
+ }, v = (p) => {
442
+ if (p.drawingType !== ee.DRAWING_GROUP)
406
443
  return;
407
- const { unitId, subUnitId, drawingId, transform: groupTransform = { width: 0, height: 0 } } = param;
408
- if (groupTransform == null)
444
+ const { unitId: S, subUnitId: _, drawingId: R, transform: b = { width: 0, height: 0 } } = p;
445
+ if (b == null)
409
446
  return;
410
- const objects = drawingManagerService.getDrawingsByGroup({ unitId, subUnitId, drawingId });
411
- if (objects.length === 0)
447
+ const N = e.getDrawingsByGroup({ unitId: S, subUnitId: _, drawingId: R });
448
+ if (N.length === 0)
412
449
  return;
413
- const children = objects.map((object) => {
414
- const { transform } = object, { unitId: unitId2, subUnitId: subUnitId2, drawingId: drawingId2 } = object, newTransform = transformObjectOutOfGroup(transform || {}, groupTransform, groupTransform.width || 0, groupTransform.height || 0);
450
+ const I = N.map((y) => {
451
+ const { transform: P } = y, { unitId: M, subUnitId: D, drawingId: B } = y, E = Tn(P || {}, b, b.width || 0, b.height || 0);
415
452
  return {
416
- unitId: unitId2,
417
- subUnitId: subUnitId2,
418
- drawingId: drawingId2,
453
+ unitId: M,
454
+ subUnitId: D,
455
+ drawingId: B,
419
456
  transform: {
420
- ...transform,
421
- ...newTransform
457
+ ...P,
458
+ ...E
422
459
  },
423
460
  groupId: void 0
424
461
  };
425
462
  });
426
463
  return {
427
- parent: param,
428
- children
464
+ parent: p,
465
+ children: I
429
466
  };
430
- }, "ungroup"), onUngroupBtnClick = /* @__PURE__ */ __name(() => {
431
- const params = drawingManagerService.getFocusDrawings().map(
432
- (drawing) => ungroup(drawing)
433
- ).filter((o) => o != null);
434
- params.length !== 0 && drawingManagerService.featurePluginUngroupUpdateNotification(params);
435
- }, "onUngroupBtnClick");
436
- return useEffect(() => {
437
- const drawingParam = drawings[0];
438
- if (drawingParam == null)
467
+ }, w = () => {
468
+ const S = e.getFocusDrawings().map(
469
+ (_) => v(_)
470
+ ).filter((_) => _ != null);
471
+ S.length !== 0 && e.featurePluginUngroupUpdateNotification(S);
472
+ };
473
+ return _e(() => {
474
+ const p = s[0];
475
+ if (p == null)
439
476
  return;
440
- const { unitId } = drawingParam, renderObject = renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
441
- if (scene == null)
477
+ const { unitId: S } = p, _ = n.getRenderById(S), R = _ == null ? void 0 : _.scene;
478
+ if (R == null)
442
479
  return;
443
- const transformer = scene.getTransformerByCreate(), onClearControlObserver = transformer.clearControl$.subscribe((changeSelf) => {
444
- changeSelf === !0 && setGroupShow(!1);
445
- }), onChangeStartObserver = transformer.changeStart$.subscribe((state) => {
446
- const { objects } = state, params = getUpdateParams(objects, drawingManagerService), groupParams = params.filter((o) => (o == null ? void 0 : o.drawingType) === DrawingTypeEnum.DRAWING_GROUP);
447
- let groupBtnShow2 = !1, ungroupBtnShow2 = !1;
448
- params.length > 1 && (groupBtnShow2 = !0), groupParams.length > 0 && (ungroupBtnShow2 = !0), setGroupShow(groupBtnShow2 || ungroupBtnShow2), setGroupBtnShow(groupBtnShow2), setUngroupBtnShow(ungroupBtnShow2);
480
+ const b = R.getTransformerByCreate(), N = b.clearControl$.subscribe((y) => {
481
+ y === !0 && o(!1);
482
+ }), I = b.changeStart$.subscribe((y) => {
483
+ const { objects: P } = y, M = Ae(P, e), D = M.filter((W) => (W == null ? void 0 : W.drawingType) === ee.DRAWING_GROUP);
484
+ let B = !1, E = !1;
485
+ M.length > 1 && (B = !0), D.length > 0 && (E = !0), o(B || E), g(B), d(E);
449
486
  });
450
487
  return () => {
451
- onChangeStartObserver.unsubscribe(), onClearControlObserver.unsubscribe();
488
+ I.unsubscribe(), N.unsubscribe();
452
489
  };
453
- }, []), /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelGrid, styles$1.imageCommonPanelBorder), style: { display: gridDisplay(hasGroup === !0 ? groupShow : !1) } }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelTitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-panel.group.title")))), /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan2, styles$1.imageCommonPanelColumnCenter) }, /* @__PURE__ */ React.createElement(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
454
- onGroupBtnClick();
455
- }, "onClick"), style: { display: gridDisplay(groupBtnShow) } }, /* @__PURE__ */ React.createElement("span", { className: styles$1.imageCommonPanelInline }, /* @__PURE__ */ React.createElement(GroupSingle, null), localeService.t("image-panel.group.group")))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan2, styles$1.imageCommonPanelColumnCenter) }, /* @__PURE__ */ React.createElement(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
456
- onUngroupBtnClick();
457
- }, "onClick"), style: { display: gridDisplay(ungroupBtnShow) } }, /* @__PURE__ */ React.createElement("span", { className: styles$1.imageCommonPanelInline }, /* @__PURE__ */ React.createElement(UngroupSingle, null), localeService.t("image-panel.group.unGroup"))))));
458
- }, "DrawingGroup"), MIN_DRAWING_WIDTH_LIMIT = 20, MIN_DRAWING_HEIGHT_LIMIT = 20, RANGE_DRAWING_ROTATION_LIMIT = [-3600, 3600], INPUT_DEBOUNCE_TIME = 300, DrawingTransform = /* @__PURE__ */ __name((props) => {
459
- var _a7;
460
- const localeService = useDependency(LocaleService), drawingManagerService = useDependency(IDrawingManagerService), renderManagerService = useDependency(IRenderManagerService), { drawings, transformShow } = props, drawingParam = drawings[0];
461
- if (drawingParam == null)
490
+ }, []), /* @__PURE__ */ c.jsxs("div", { className: O(m.imageCommonPanelGrid, m.imageCommonPanelBorder), style: { display: h(r === !0 ? a : !1) }, children: [
491
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelTitle), children: /* @__PURE__ */ c.jsx("div", { children: t.t("image-panel.group.title") }) }) }),
492
+ /* @__PURE__ */ c.jsxs("div", { className: m.imageCommonPanelRow, children: [
493
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan2, m.imageCommonPanelColumnCenter), children: /* @__PURE__ */ c.jsx(ce, { size: "small", onClick: () => {
494
+ f();
495
+ }, style: { display: h(l) }, children: /* @__PURE__ */ c.jsxs("span", { className: m.imageCommonPanelInline, children: [
496
+ /* @__PURE__ */ c.jsx(Cn, {}),
497
+ t.t("image-panel.group.group")
498
+ ] }) }) }),
499
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan2, m.imageCommonPanelColumnCenter), children: /* @__PURE__ */ c.jsx(ce, { size: "small", onClick: () => {
500
+ w();
501
+ }, style: { display: h(u) }, children: /* @__PURE__ */ c.jsxs("span", { className: m.imageCommonPanelInline, children: [
502
+ /* @__PURE__ */ c.jsx(bn, {}),
503
+ t.t("image-panel.group.unGroup")
504
+ ] }) }) })
505
+ ] })
506
+ ] });
507
+ }, se = 20, Bt = 20, Ut = [-3600, 3600], ye = 300, Ht = (i) => {
508
+ var Ze;
509
+ const t = L(te), n = L(ne), e = L(ue), { drawings: r, transformShow: s } = i, a = r[0];
510
+ if (a == null)
462
511
  return;
463
- const transform = drawingParam.transform;
464
- if (transform == null)
512
+ const o = a.transform;
513
+ if (o == null)
465
514
  return;
466
- const { unitId, subUnitId, drawingId, drawingType } = drawingParam, renderObject = renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
467
- if (scene == null)
515
+ const { unitId: l, subUnitId: g, drawingId: u, drawingType: d } = a, h = e.getRenderById(l), f = h == null ? void 0 : h.scene;
516
+ if (f == null)
468
517
  return;
469
- const topScene = (_a7 = scene.getEngine()) == null ? void 0 : _a7.activeScene;
470
- if (topScene == null)
518
+ const v = (Ze = f.getEngine()) == null ? void 0 : Ze.activeScene;
519
+ if (v == null)
471
520
  return;
472
- const transformer = scene.getTransformerByCreate(), {
473
- width: originWidth = 0,
474
- height: originHeight = 0,
475
- left: originX = 0,
476
- top: originY = 0,
477
- angle: originRotation = 0
478
- } = transform, [width, setWidth] = useState(originWidth), [height, setHeight] = useState(originHeight), [xPosition, setXPosition] = useState(originX), [yPosition, setYPosition] = useState(originY), [rotation, setRotation] = useState(originRotation), [lockRatio, setLockRatio] = useState(transformer.keepRatio), checkMoveBoundary = /* @__PURE__ */ __name((left, top, width2, height2) => {
479
- const { width: topSceneWidth, height: topSceneHeight } = topScene, { ancestorLeft, ancestorTop } = scene;
480
- let limitLeft = left, limitTop = top, limitWidth = width2, limitHeight = height2;
481
- return left + ancestorLeft < 0 && (limitLeft = -ancestorLeft), top + ancestorTop < 0 && (limitTop = -ancestorTop), limitWidth = topSceneWidth - limitLeft - ancestorLeft, limitWidth < MIN_DRAWING_WIDTH_LIMIT && (limitWidth = MIN_DRAWING_WIDTH_LIMIT), limitHeight = topSceneHeight - limitTop - ancestorTop, limitHeight < MIN_DRAWING_WIDTH_LIMIT && (limitHeight = MIN_DRAWING_WIDTH_LIMIT), left + limitWidth + ancestorLeft > topSceneWidth && (limitLeft = topSceneWidth - width2 - ancestorLeft), top + limitHeight + ancestorTop > topSceneHeight && (limitTop = topSceneHeight - height2 - ancestorTop), {
482
- limitLeft,
483
- limitTop,
484
- limitWidth,
485
- limitHeight
521
+ const w = f.getTransformerByCreate(), {
522
+ width: p = 0,
523
+ height: S = 0,
524
+ left: _ = 0,
525
+ top: R = 0,
526
+ angle: b = 0
527
+ } = o, [N, I] = A(p), [y, P] = A(S), [M, D] = A(_), [B, E] = A(R), [re, W] = A(b), [q, Se] = A(w.keepRatio), ie = (C, x, H, V) => {
528
+ const { width: U, height: J } = v, { ancestorLeft: z, ancestorTop: F } = f;
529
+ let K = C, ae = x, de = H, he = V;
530
+ return C + z < 0 && (K = -z), x + F < 0 && (ae = -F), de = U - K - z, de < se && (de = se), he = J - ae - F, he < se && (he = se), C + de + z > U && (K = U - H - z), x + he + F > J && (ae = J - V - F), {
531
+ limitLeft: K,
532
+ limitTop: ae,
533
+ limitWidth: de,
534
+ limitHeight: he
486
535
  };
487
- }, "checkMoveBoundary"), changeObs = /* @__PURE__ */ __name((state) => {
488
- const { objects } = state, params = getUpdateParams(objects, drawingManagerService);
489
- if (params.length !== 1)
536
+ }, k = (C) => {
537
+ const { objects: x } = C, H = Ae(x, n);
538
+ if (H.length !== 1)
490
539
  return;
491
- const drawingParam2 = params[0];
492
- if (drawingParam2 == null)
540
+ const V = H[0];
541
+ if (V == null)
493
542
  return;
494
- const { transform: transform2 } = drawingParam2;
495
- if (transform2 == null)
543
+ const { transform: U } = V;
544
+ if (U == null)
496
545
  return;
497
546
  const {
498
- width: originWidth2,
499
- height: originHeight2,
500
- left: originX2,
501
- top: originY2,
502
- angle: originRotation2
503
- } = transform2;
504
- originWidth2 != null && setWidth(originWidth2), originHeight2 != null && setHeight(originHeight2), originX2 != null && setXPosition(originX2), originY2 != null && setYPosition(originY2), originRotation2 != null && setRotation(originRotation2);
505
- }, "changeObs");
506
- useEffect(() => {
507
- const subscriptions = [
508
- transformer.changeStart$.subscribe((state) => {
509
- changeObs(state);
547
+ width: J,
548
+ height: z,
549
+ left: F,
550
+ top: K,
551
+ angle: ae
552
+ } = U;
553
+ J != null && I(J), z != null && P(z), F != null && D(F), K != null && E(K), ae != null && W(ae);
554
+ };
555
+ _e(() => {
556
+ const C = [
557
+ w.changeStart$.subscribe((x) => {
558
+ k(x);
510
559
  }),
511
- transformer.changing$.subscribe((state) => {
512
- changeObs(state);
560
+ w.changing$.subscribe((x) => {
561
+ k(x);
513
562
  }),
514
- transformer.changeEnd$.subscribe((state) => {
515
- changeObs(state);
563
+ w.changeEnd$.subscribe((x) => {
564
+ k(x);
516
565
  }),
517
- drawingManagerService.focus$.subscribe((drawings2) => {
518
- if (drawings2.length !== 1)
566
+ n.focus$.subscribe((x) => {
567
+ if (x.length !== 1)
519
568
  return;
520
- const drawingParam2 = drawingManagerService.getDrawingByParam(drawings2[0]);
521
- if (drawingParam2 == null)
569
+ const H = n.getDrawingByParam(x[0]);
570
+ if (H == null)
522
571
  return;
523
- const transform2 = drawingParam2.transform;
524
- if (transform2 == null)
572
+ const V = H.transform;
573
+ if (V == null)
525
574
  return;
526
575
  const {
527
- width: originWidth2,
528
- height: originHeight2,
529
- left: originX2,
530
- top: originY2,
531
- angle: originRotation2
532
- } = transform2;
533
- originWidth2 != null && setWidth(originWidth2), originHeight2 != null && setHeight(originHeight2), originX2 != null && setXPosition(originX2), originY2 != null && setYPosition(originY2), originRotation2 != null && setRotation(originRotation2);
576
+ width: U,
577
+ height: J,
578
+ left: z,
579
+ top: F,
580
+ angle: K
581
+ } = V;
582
+ U != null && I(U), J != null && P(J), z != null && D(z), F != null && E(F), K != null && W(K);
534
583
  })
535
584
  ];
536
585
  return () => {
537
- subscriptions.forEach((sub) => sub.unsubscribe());
586
+ C.forEach((x) => x.unsubscribe());
538
587
  };
539
588
  }, []);
540
- const handleWidthChange = debounce((val) => {
541
- if (val == null)
589
+ const Ve = Pe((C) => {
590
+ if (C == null)
542
591
  return;
543
- val = Math.max(val, MIN_DRAWING_WIDTH_LIMIT);
544
- const { limitWidth, limitHeight } = checkMoveBoundary(xPosition, yPosition, val, height);
545
- val = Math.min(val, limitWidth);
546
- const updateParam = { unitId, subUnitId, drawingId, drawingType, transform: { width: val } };
547
- if (lockRatio) {
548
- let heightFix = val / width * height;
549
- if (heightFix = Math.max(heightFix, MIN_DRAWING_HEIGHT_LIMIT), heightFix > limitHeight)
592
+ C = Math.max(C, se);
593
+ const { limitWidth: x, limitHeight: H } = ie(M, B, C, y);
594
+ C = Math.min(C, x);
595
+ const V = { unitId: l, subUnitId: g, drawingId: u, drawingType: d, transform: { width: C } };
596
+ if (q) {
597
+ let U = C / N * y;
598
+ if (U = Math.max(U, Bt), U > H)
550
599
  return;
551
- setHeight(heightFix), updateParam.transform.height = heightFix;
600
+ P(U), V.transform.height = U;
552
601
  }
553
- setWidth(val), drawingManagerService.featurePluginUpdateNotification([updateParam]), transformer.refreshControls().changeNotification();
554
- }, INPUT_DEBOUNCE_TIME), handleHeightChange = debounce((val) => {
555
- if (val == null)
602
+ I(C), n.featurePluginUpdateNotification([V]), w.refreshControls().changeNotification();
603
+ }, ye), Ge = Pe((C) => {
604
+ if (C == null)
556
605
  return;
557
- val = Math.max(val, MIN_DRAWING_WIDTH_LIMIT);
558
- const { limitHeight, limitWidth } = checkMoveBoundary(xPosition, yPosition, width, val);
559
- val = Math.min(val, limitHeight);
560
- const updateParam = { unitId, subUnitId, drawingId, drawingType, transform: { height: val } };
561
- if (lockRatio) {
562
- let widthFix = val / height * width;
563
- if (widthFix = Math.max(widthFix, MIN_DRAWING_WIDTH_LIMIT), widthFix > limitWidth)
606
+ C = Math.max(C, se);
607
+ const { limitHeight: x, limitWidth: H } = ie(M, B, N, C);
608
+ C = Math.min(C, x);
609
+ const V = { unitId: l, subUnitId: g, drawingId: u, drawingType: d, transform: { height: C } };
610
+ if (q) {
611
+ let U = C / y * N;
612
+ if (U = Math.max(U, se), U > H)
564
613
  return;
565
- setWidth(widthFix), updateParam.transform.width = widthFix;
614
+ I(U), V.transform.width = U;
566
615
  }
567
- setHeight(val), drawingManagerService.featurePluginUpdateNotification([updateParam]), transformer.refreshControls().changeNotification();
568
- }, INPUT_DEBOUNCE_TIME), handleXChange = debounce((val) => {
569
- if (val == null)
616
+ P(C), n.featurePluginUpdateNotification([V]), w.refreshControls().changeNotification();
617
+ }, ye), yn = Pe((C) => {
618
+ if (C == null)
570
619
  return;
571
- const { limitLeft } = checkMoveBoundary(val, yPosition, width, height);
572
- val = limitLeft;
573
- const updateParam = { unitId, subUnitId, drawingId, drawingType, transform: { left: val } };
574
- setXPosition(val), drawingManagerService.featurePluginUpdateNotification([updateParam]), transformer.refreshControls().changeNotification();
575
- }, INPUT_DEBOUNCE_TIME), handleYChange = debounce((val) => {
576
- if (val == null)
620
+ const { limitLeft: x } = ie(C, B, N, y);
621
+ C = x;
622
+ const H = { unitId: l, subUnitId: g, drawingId: u, drawingType: d, transform: { left: C } };
623
+ D(C), n.featurePluginUpdateNotification([H]), w.refreshControls().changeNotification();
624
+ }, ye), jn = Pe((C) => {
625
+ if (C == null)
577
626
  return;
578
- const { limitTop } = checkMoveBoundary(xPosition, val, width, height);
579
- val = limitTop;
580
- const updateParam = { unitId, subUnitId, drawingId, drawingType, transform: { top: val } };
581
- setYPosition(val), drawingManagerService.featurePluginUpdateNotification([updateParam]), transformer.refreshControls().changeNotification();
582
- }, INPUT_DEBOUNCE_TIME), handleRotationChange = /* @__PURE__ */ __name((val) => {
583
- if (val == null)
627
+ const { limitTop: x } = ie(M, C, N, y);
628
+ C = x;
629
+ const H = { unitId: l, subUnitId: g, drawingId: u, drawingType: d, transform: { top: C } };
630
+ E(C), n.featurePluginUpdateNotification([H]), w.refreshControls().changeNotification();
631
+ }, ye), Rn = (C) => {
632
+ if (C == null)
584
633
  return;
585
- const [min, max] = RANGE_DRAWING_ROTATION_LIMIT;
586
- val < min && (val = min), val > max && (val = max);
587
- const updateParam = { unitId, subUnitId, drawingId, drawingType, transform: { angle: val } };
588
- setRotation(val), drawingManagerService.featurePluginUpdateNotification([updateParam]), transformer.refreshControls().changeNotification();
589
- }, "handleRotationChange"), handleLockRatioChange = /* @__PURE__ */ __name((val) => {
590
- setLockRatio(val), transformer.keepRatio = val;
591
- }, "handleLockRatioChange"), gridDisplay = /* @__PURE__ */ __name((isShow) => isShow ? "block" : "none", "gridDisplay");
592
- return /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelGrid, styles$1.imageCommonPanelBorder), style: { display: gridDisplay(transformShow) } }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelTitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-panel.transform.title")))), /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan3) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelColumn }, localeService.t("image-panel.transform.width"))), /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(InputNumber, { precision: 1, value: width, onChange: /* @__PURE__ */ __name((val) => {
593
- handleWidthChange(val);
594
- }, "onChange"), className: styles$1.imageCommonPanelInput }))))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan3) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelColumn }, localeService.t("image-panel.transform.height"))), /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(InputNumber, { precision: 1, value: height, onChange: /* @__PURE__ */ __name((val) => {
595
- handleHeightChange(val);
596
- }, "onChange"), className: styles$1.imageCommonPanelInput }))))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan3) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelColumn }, localeService.t("image-panel.transform.lock"))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelRow, styles$1.imageCommonPanelRowVertical) }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(Checkbox, { checked: lockRatio, onChange: handleLockRatioChange })))))), /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan3) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelColumn }, localeService.t("image-panel.transform.x"))), /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(InputNumber, { precision: 1, value: xPosition, onChange: /* @__PURE__ */ __name((val) => {
597
- handleXChange(val);
598
- }, "onChange"), className: styles$1.imageCommonPanelInput }))))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan3) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelColumn }, localeService.t("image-panel.transform.y"))), /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(InputNumber, { precision: 1, value: yPosition, onChange: /* @__PURE__ */ __name((val) => {
599
- handleYChange(val);
600
- }, "onChange"), className: styles$1.imageCommonPanelInput }))))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan3) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelColumn }, localeService.t("image-panel.transform.rotate"))), /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(InputNumber, { precision: 1, value: rotation, onChange: handleRotationChange, className: styles$1.imageCommonPanelInput })))))));
601
- }, "DrawingTransform"), OpenImageCropOperation = {
634
+ const [x, H] = Ut;
635
+ C < x && (C = x), C > H && (C = H);
636
+ const V = { unitId: l, subUnitId: g, drawingId: u, drawingType: d, transform: { angle: C } };
637
+ W(C), n.featurePluginUpdateNotification([V]), w.refreshControls().changeNotification();
638
+ }, Mn = (C) => {
639
+ Se(C), w.keepRatio = C;
640
+ }, xn = (C) => C ? "block" : "none";
641
+ return /* @__PURE__ */ c.jsxs("div", { className: O(m.imageCommonPanelGrid, m.imageCommonPanelBorder), style: { display: xn(s) }, children: [
642
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelTitle), children: /* @__PURE__ */ c.jsx("div", { children: t.t("image-panel.transform.title") }) }) }),
643
+ /* @__PURE__ */ c.jsxs("div", { className: m.imageCommonPanelRow, children: [
644
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan3), children: /* @__PURE__ */ c.jsxs("label", { children: [
645
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelColumn, children: t.t("image-panel.transform.width") }) }),
646
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelColumn, children: /* @__PURE__ */ c.jsx(fe, { precision: 1, value: N, onChange: (C) => {
647
+ Ve(C);
648
+ }, className: m.imageCommonPanelInput }) }) })
649
+ ] }) }),
650
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan3), children: /* @__PURE__ */ c.jsxs("label", { children: [
651
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelColumn, children: t.t("image-panel.transform.height") }) }),
652
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelColumn, children: /* @__PURE__ */ c.jsx(fe, { precision: 1, value: y, onChange: (C) => {
653
+ Ge(C);
654
+ }, className: m.imageCommonPanelInput }) }) })
655
+ ] }) }),
656
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan3), children: /* @__PURE__ */ c.jsxs("label", { children: [
657
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelColumn, children: t.t("image-panel.transform.lock") }) }),
658
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelRow, m.imageCommonPanelRowVertical), children: /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelColumn, children: /* @__PURE__ */ c.jsx($n, { checked: q, onChange: Mn }) }) })
659
+ ] }) })
660
+ ] }),
661
+ /* @__PURE__ */ c.jsxs("div", { className: m.imageCommonPanelRow, children: [
662
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan3), children: /* @__PURE__ */ c.jsxs("label", { children: [
663
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelColumn, children: t.t("image-panel.transform.x") }) }),
664
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelColumn, children: /* @__PURE__ */ c.jsx(fe, { precision: 1, value: M, onChange: (C) => {
665
+ yn(C);
666
+ }, className: m.imageCommonPanelInput }) }) })
667
+ ] }) }),
668
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan3), children: /* @__PURE__ */ c.jsxs("label", { children: [
669
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelColumn, children: t.t("image-panel.transform.y") }) }),
670
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelColumn, children: /* @__PURE__ */ c.jsx(fe, { precision: 1, value: B, onChange: (C) => {
671
+ jn(C);
672
+ }, className: m.imageCommonPanelInput }) }) })
673
+ ] }) }),
674
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan3), children: /* @__PURE__ */ c.jsxs("label", { children: [
675
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelColumn, children: t.t("image-panel.transform.rotate") }) }),
676
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelColumn, children: /* @__PURE__ */ c.jsx(fe, { precision: 1, value: re, onChange: Rn, className: m.imageCommonPanelInput }) }) })
677
+ ] }) })
678
+ ] })
679
+ ] });
680
+ }, ze = {
602
681
  id: "sheet.operation.open-image-crop",
603
- type: CommandType.OPERATION,
604
- handler: /* @__PURE__ */ __name((accessor, params) => !0, "handler")
605
- }, CloseImageCropOperation = {
682
+ type: ve.OPERATION,
683
+ handler: (i, t) => !0
684
+ }, le = {
606
685
  id: "sheet.operation.close-image-crop",
607
- type: CommandType.OPERATION,
608
- handler: /* @__PURE__ */ __name((accessor, params) => !0, "handler")
686
+ type: ve.OPERATION,
687
+ handler: (i, t) => !0
609
688
  };
610
- var CropType = /* @__PURE__ */ ((CropType2) => (CropType2.FREE = "0", CropType2.R1_1 = "1", CropType2.R16_9 = "2", CropType2.R9_16 = "3", CropType2.R5_4 = "4", CropType2.R4_5 = "5", CropType2.R4_3 = "6", CropType2.R3_4 = "7", CropType2.R3_2 = "8", CropType2.R2_3 = "9", CropType2))(CropType || {});
611
- const AutoImageCropOperation = {
689
+ var T = /* @__PURE__ */ ((i) => (i.FREE = "0", i.R1_1 = "1", i.R16_9 = "2", i.R9_16 = "3", i.R5_4 = "4", i.R4_5 = "5", i.R4_3 = "6", i.R3_4 = "7", i.R3_2 = "8", i.R2_3 = "9", i))(T || {});
690
+ const Ne = {
612
691
  id: "sheet.operation.Auto-image-crop",
613
- type: CommandType.OPERATION,
614
- handler: /* @__PURE__ */ __name((accessor, params) => !0, "handler")
615
- }, ImageCropper = /* @__PURE__ */ __name((props) => {
616
- const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), { drawings, cropperShow } = props;
617
- if (drawings[0] == null)
692
+ type: ve.OPERATION,
693
+ handler: (i, t) => !0
694
+ }, At = (i) => {
695
+ const t = L(me), n = L(te), { drawings: e, cropperShow: r } = i;
696
+ if (e[0] == null)
618
697
  return;
619
- const [cropValue, setCropValue] = useState(CropType.FREE), cropStateRef = useRef(!1), cropOptions = [
698
+ const [a, o] = A(T.FREE), l = on(!1), g = [
620
699
  {
621
- label: localeService.t("image-panel.crop.mode"),
622
- value: CropType.FREE
700
+ label: n.t("image-panel.crop.mode"),
701
+ value: T.FREE
623
702
  },
624
703
  {
625
704
  label: "1:1",
626
- value: CropType.R1_1
705
+ value: T.R1_1
627
706
  },
628
707
  {
629
708
  label: "16:9",
630
- value: CropType.R16_9
709
+ value: T.R16_9
631
710
  },
632
711
  {
633
712
  label: "9:16",
634
- value: CropType.R9_16
713
+ value: T.R9_16
635
714
  },
636
715
  {
637
716
  label: "5:4",
638
- value: CropType.R5_4
717
+ value: T.R5_4
639
718
  },
640
719
  {
641
720
  label: "4:5",
642
- value: CropType.R4_5
721
+ value: T.R4_5
643
722
  },
644
723
  {
645
724
  label: "4:3",
646
- value: CropType.R4_3
725
+ value: T.R4_3
647
726
  },
648
727
  {
649
728
  label: "3:4",
650
- value: CropType.R3_4
729
+ value: T.R3_4
651
730
  },
652
731
  {
653
732
  label: "3:2",
654
- value: CropType.R3_2
733
+ value: T.R3_2
655
734
  },
656
735
  {
657
736
  label: "2:3",
658
- value: CropType.R2_3
737
+ value: T.R2_3
659
738
  }
660
739
  ];
661
- useEffect(() => {
662
- const onChangeStartObserver = commandService.onCommandExecuted((command) => {
663
- if (command.id === CloseImageCropOperation.id) {
664
- const params = command.params;
665
- params != null && params.isAuto || (cropStateRef.current = !1);
740
+ _e(() => {
741
+ const f = t.onCommandExecuted((v) => {
742
+ if (v.id === le.id) {
743
+ const w = v.params;
744
+ w != null && w.isAuto || (l.current = !1);
666
745
  }
667
746
  });
668
747
  return () => {
669
- onChangeStartObserver == null || onChangeStartObserver.dispose();
748
+ f == null || f.dispose();
670
749
  };
671
750
  }, []);
672
- function handleCropChange(value) {
673
- setCropValue(value), cropStateRef.current && commandService.executeCommand(AutoImageCropOperation.id, {
674
- cropType: value
751
+ function u(f) {
752
+ o(f), l.current && t.executeCommand(Ne.id, {
753
+ cropType: f
675
754
  });
676
755
  }
677
- __name(handleCropChange, "handleCropChange");
678
- const gridDisplay = /* @__PURE__ */ __name((isShow) => isShow ? "block" : "none", "gridDisplay"), onCropperBtnClick = /* @__PURE__ */ __name((val) => {
679
- commandService.executeCommand(AutoImageCropOperation.id, {
680
- cropType: val
681
- }), cropStateRef.current = !0;
682
- }, "onCropperBtnClick");
683
- return /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelGrid, styles$1.imageCommonPanelBorder), style: { display: gridDisplay(cropperShow) } }, /* @__PURE__ */ React.createElement("div", { className: styles$1.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelTitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-panel.crop.title")))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelRow, styles$1.imageCommonPanelRowVertical) }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
684
- onCropperBtnClick(cropValue);
685
- }, "onClick") }, /* @__PURE__ */ React.createElement("span", { className: styles$1.imageCommonPanelInline }, /* @__PURE__ */ React.createElement(CreateCopySingle, null), localeService.t("image-panel.crop.start")))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles$1.imageCommonPanelColumn, styles$1.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement(Select, { value: cropValue, options: cropOptions, onChange: handleCropChange }))));
686
- }, "ImageCropper"), DrawingCommonPanel = /* @__PURE__ */ __name((props) => {
687
- const drawingManagerService = useDependency(IDrawingManagerService), renderManagerService = useDependency(IRenderManagerService), localeService = useDependency(LocaleService), { drawings, hasArrange = !0, hasTransform = !0, hasAlign = !0, hasCropper = !0, hasGroup = !0 } = props, drawingParam = drawings[0];
688
- if (drawingParam == null)
756
+ const d = (f) => f ? "block" : "none", h = (f) => {
757
+ t.executeCommand(Ne.id, {
758
+ cropType: f
759
+ }), l.current = !0;
760
+ };
761
+ return /* @__PURE__ */ c.jsxs("div", { className: O(m.imageCommonPanelGrid, m.imageCommonPanelBorder), style: { display: d(r) }, children: [
762
+ /* @__PURE__ */ c.jsx("div", { className: m.imageCommonPanelRow, children: /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelTitle), children: /* @__PURE__ */ c.jsx("div", { children: n.t("image-panel.crop.title") }) }) }),
763
+ /* @__PURE__ */ c.jsxs("div", { className: O(m.imageCommonPanelRow, m.imageCommonPanelRowVertical), children: [
764
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan2), children: /* @__PURE__ */ c.jsx(ce, { size: "small", onClick: () => {
765
+ h(a);
766
+ }, children: /* @__PURE__ */ c.jsxs("span", { className: m.imageCommonPanelInline, children: [
767
+ /* @__PURE__ */ c.jsx(pn, {}),
768
+ n.t("image-panel.crop.start")
769
+ ] }) }) }),
770
+ /* @__PURE__ */ c.jsx("div", { className: O(m.imageCommonPanelColumn, m.imageCommonPanelSpan2), children: /* @__PURE__ */ c.jsx(cn, { value: a, options: g, onChange: u }) })
771
+ ] })
772
+ ] });
773
+ }, Sr = (i) => {
774
+ const t = L(ne), n = L(ue), e = L(te), { drawings: r, hasArrange: s = !0, hasTransform: a = !0, hasAlign: o = !0, hasCropper: l = !0, hasGroup: g = !0 } = i, u = r[0];
775
+ if (u == null)
689
776
  return;
690
- const { unitId } = drawingParam, renderObject = renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
691
- if (scene == null)
777
+ const { unitId: d } = u, h = n.getRenderById(d), f = h == null ? void 0 : h.scene;
778
+ if (f == null)
692
779
  return;
693
- const transformer = scene.getTransformerByCreate(), [arrangeShow, setArrangeShow] = useState(!0), [transformShow, setTransformShow] = useState(!0), [alignShow, setAlignShow] = useState(!1), [cropperShow, setCropperShow] = useState(!0), [nullShow, setNullShow] = useState(!1);
694
- return useEffect(() => {
695
- const clearControlSub = transformer.clearControl$.subscribe((changeSelf) => {
696
- changeSelf === !0 && (setArrangeShow(!1), setTransformShow(!1), setAlignShow(!1), setCropperShow(!1), setNullShow(!0));
697
- }), changeStartSub = transformer.changeStart$.subscribe((state) => {
698
- const { objects } = state, params = getUpdateParams(objects, drawingManagerService);
699
- params.length === 0 ? (setArrangeShow(!1), setTransformShow(!1), setAlignShow(!1), setCropperShow(!1), setNullShow(!0)) : params.length === 1 ? (setArrangeShow(!0), setTransformShow(!0), setAlignShow(!1), setCropperShow(!0), setNullShow(!1)) : (setArrangeShow(!0), setTransformShow(!1), setAlignShow(!0), setCropperShow(!1), setNullShow(!1));
700
- }), focusSub = drawingManagerService.focus$.subscribe((drawings2) => {
701
- drawings2.length === 0 ? (setArrangeShow(!1), setTransformShow(!1), setAlignShow(!1), setCropperShow(!1), setNullShow(!0)) : drawings2.length === 1 ? (setArrangeShow(!0), setTransformShow(!0), setAlignShow(!1), setCropperShow(!0), setNullShow(!1)) : (setArrangeShow(!0), setTransformShow(!1), setAlignShow(!0), setCropperShow(!1), setNullShow(!1));
780
+ const v = f.getTransformerByCreate(), [w, p] = A(!0), [S, _] = A(!0), [R, b] = A(!1), [N, I] = A(!0), [y, P] = A(!1);
781
+ return _e(() => {
782
+ const M = v.clearControl$.subscribe((E) => {
783
+ E === !0 && (p(!1), _(!1), b(!1), I(!1), P(!0));
784
+ }), D = v.changeStart$.subscribe((E) => {
785
+ const { objects: re } = E, W = Ae(re, t);
786
+ W.length === 0 ? (p(!1), _(!1), b(!1), I(!1), P(!0)) : W.length === 1 ? (p(!0), _(!0), b(!1), I(!0), P(!1)) : (p(!0), _(!1), b(!0), I(!1), P(!1));
787
+ }), B = t.focus$.subscribe((E) => {
788
+ E.length === 0 ? (p(!1), _(!1), b(!1), I(!1), P(!0)) : E.length === 1 ? (p(!0), _(!0), b(!1), I(!0), P(!1)) : (p(!0), _(!1), b(!0), I(!1), P(!1));
702
789
  });
703
790
  return () => {
704
- changeStartSub.unsubscribe(), clearControlSub.unsubscribe(), focusSub.unsubscribe();
791
+ D.unsubscribe(), M.unsubscribe(), B.unsubscribe();
705
792
  };
706
- }, []), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { style: { display: nullShow === !0 ? "block" : "none", height: "100%" } }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", top: "50%", marginTop: "-100px" } }, /* @__PURE__ */ React.createElement("span", null, localeService.t("image-panel.null")))), /* @__PURE__ */ React.createElement(DrawingArrange, { arrangeShow: hasArrange === !0 ? arrangeShow : !1, drawings }), /* @__PURE__ */ React.createElement(DrawingTransform, { transformShow: hasTransform === !0 ? transformShow : !1, drawings }), /* @__PURE__ */ React.createElement(DrawingAlign, { alignShow: hasAlign === !0 ? alignShow : !1, drawings }), /* @__PURE__ */ React.createElement(ImageCropper, { cropperShow: hasCropper === !0 ? cropperShow : !1, drawings }), /* @__PURE__ */ React.createElement(DrawingGroup, { hasGroup, drawings }));
707
- }, "DrawingCommonPanel"), imagePopupMenu = "univer-image-popup-menu", imagePopupMenuItem = "univer-image-popup-menu-item", imagePopupMenuItemIcon = "univer-image-popup-menu-item-icon", imagePopupMenuItemTitle = "univer-image-popup-menu-item-title", imagePopupMenuItemHide = "univer-image-popup-menu-item-hide", btnContainer = "univer-btn-container", btnContainerExpand = "univer-btn-container-expand", styles = {
708
- imagePopupMenu,
709
- imagePopupMenuItem,
710
- imagePopupMenuItemIcon,
711
- imagePopupMenuItemTitle,
712
- imagePopupMenuItemHide,
713
- btnContainer,
714
- btnContainerExpand
715
- }, ImagePopupMenu = /* @__PURE__ */ __name((props) => {
716
- var _a7, _b;
717
- const menuItems = (_b = (_a7 = props.popup) == null ? void 0 : _a7.extraProps) == null ? void 0 : _b.menuItems;
718
- if (!menuItems)
793
+ }, []), /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
794
+ /* @__PURE__ */ c.jsx("div", { style: { display: y === !0 ? "block" : "none", height: "100%" }, children: /* @__PURE__ */ c.jsx("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", top: "50%", marginTop: "-100px" }, children: /* @__PURE__ */ c.jsx("span", { children: e.t("image-panel.null") }) }) }),
795
+ /* @__PURE__ */ c.jsx(Et, { arrangeShow: s === !0 ? w : !1, drawings: r }),
796
+ /* @__PURE__ */ c.jsx(Ht, { transformShow: a === !0 ? S : !1, drawings: r }),
797
+ /* @__PURE__ */ c.jsx(vt, { alignShow: o === !0 ? R : !1, drawings: r }),
798
+ /* @__PURE__ */ c.jsx(At, { cropperShow: l === !0 ? N : !1, drawings: r }),
799
+ /* @__PURE__ */ c.jsx(Tt, { hasGroup: g, drawings: r })
800
+ ] });
801
+ }, Lt = "univer-image-popup-menu", Vt = "univer-image-popup-menu-item", Gt = "univer-image-popup-menu-item-icon", Wt = "univer-image-popup-menu-item-title", $t = "univer-image-popup-menu-item-hide", kt = "univer-btn-container", zt = "univer-btn-container-expand", pe = {
802
+ imagePopupMenu: Lt,
803
+ imagePopupMenuItem: Vt,
804
+ imagePopupMenuItemIcon: Gt,
805
+ imagePopupMenuItemTitle: Wt,
806
+ imagePopupMenuItemHide: $t,
807
+ btnContainer: kt,
808
+ btnContainerExpand: zt
809
+ }, Ft = (i) => {
810
+ var v, w;
811
+ const t = (w = (v = i.popup) == null ? void 0 : v.extraProps) == null ? void 0 : w.menuItems;
812
+ if (!t)
719
813
  return null;
720
- const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), [visible, setVisible] = useState(!1), [isHovered, setHovered] = useState(!1), handleMouseEnter = /* @__PURE__ */ __name(() => {
721
- setHovered(!0);
722
- }, "handleMouseEnter"), handleMouseLeave = /* @__PURE__ */ __name(() => {
723
- setHovered(!1);
724
- }, "handleMouseLeave"), onVisibleChange = /* @__PURE__ */ __name((visible2) => {
725
- setVisible(visible2);
726
- }, "onVisibleChange"), handleClick = /* @__PURE__ */ __name((item) => {
727
- commandService.executeCommand(item.commandId, item.commandParams), setVisible(!1);
728
- }, "handleClick"), showMore = visible || isHovered, availableMenu = menuItems.filter((item) => !item.disable);
729
- return /* @__PURE__ */ React.createElement(
814
+ const n = L(me), e = L(te), [r, s] = A(!1), [a, o] = A(!1), l = () => {
815
+ o(!0);
816
+ }, g = () => {
817
+ o(!1);
818
+ }, u = (p) => {
819
+ s(p);
820
+ }, d = (p) => {
821
+ n.executeCommand(p.commandId, p.commandParams), s(!1);
822
+ }, h = r || a, f = t.filter((p) => !p.disable);
823
+ return /* @__PURE__ */ c.jsx(
730
824
  "div",
731
825
  {
732
- onMouseEnter: handleMouseEnter,
733
- onMouseLeave: handleMouseLeave
734
- },
735
- /* @__PURE__ */ React.createElement(
736
- Dropdown,
737
- {
738
- placement: "bottomLeft",
739
- trigger: ["click"],
740
- overlay: /* @__PURE__ */ React.createElement("ul", { className: styles.imagePopupMenu }, availableMenu.map((item) => /* @__PURE__ */ React.createElement(
741
- "li",
742
- {
743
- key: item.index,
744
- onClick: /* @__PURE__ */ __name(() => handleClick(item), "onClick"),
745
- className: styles.imagePopupMenuItem
746
- },
747
- /* @__PURE__ */ React.createElement("span", { className: styles.imagePopupMenuItemTitle }, localeService.t(item.label))
748
- ))),
749
- visible,
750
- onVisibleChange
751
- },
752
- /* @__PURE__ */ React.createElement(
753
- "div",
826
+ onMouseEnter: l,
827
+ onMouseLeave: g,
828
+ children: /* @__PURE__ */ c.jsx(
829
+ kn,
754
830
  {
755
- className: clsx(styles.btnContainer, {
756
- [styles.btnContainerExpand]: visible
757
- })
758
- },
759
- /* @__PURE__ */ React.createElement(
760
- Autofill,
761
- {
762
- style: { color: "#35322B" },
763
- extend: { colorChannel1: "rgb(var(--green-700, #409f11))" }
764
- }
765
- ),
766
- showMore && /* @__PURE__ */ React.createElement(MoreDownSingle, { style: { color: "#CCCCCC", fontSize: "8px", marginLeft: "8px" } })
831
+ placement: "bottomLeft",
832
+ trigger: ["click"],
833
+ overlay: /* @__PURE__ */ c.jsx("ul", { className: pe.imagePopupMenu, children: f.map((p) => /* @__PURE__ */ c.jsx(
834
+ "li",
835
+ {
836
+ onClick: () => d(p),
837
+ className: pe.imagePopupMenuItem,
838
+ children: /* @__PURE__ */ c.jsx("span", { className: pe.imagePopupMenuItemTitle, children: e.t(p.label) })
839
+ },
840
+ p.index
841
+ )) }),
842
+ visible: r,
843
+ onVisibleChange: u,
844
+ children: /* @__PURE__ */ c.jsxs(
845
+ "div",
846
+ {
847
+ className: O(pe.btnContainer, {
848
+ [pe.btnContainerExpand]: r
849
+ }),
850
+ children: [
851
+ /* @__PURE__ */ c.jsx(
852
+ hn,
853
+ {
854
+ style: { color: "#35322B" },
855
+ extend: { colorChannel1: "rgb(var(--green-700, #409f11))" }
856
+ }
857
+ ),
858
+ h && /* @__PURE__ */ c.jsx(wn, { style: { color: "#CCCCCC", fontSize: "8px", marginLeft: "8px" } })
859
+ ]
860
+ }
861
+ )
862
+ }
767
863
  )
768
- )
864
+ }
769
865
  );
770
- }, "ImagePopupMenu"), COMPONENT_IMAGE_POPUP_MENU = "COMPONENT_IMAGE_POPUP_MENU", PLUGIN_CONFIG_KEY = "drawing-ui.config", defaultPluginConfig = {}, ImageResetSizeOperation = {
866
+ }, Kt = "COMPONENT_IMAGE_POPUP_MENU", Yt = "drawing-ui.config", Zt = {}, In = {
771
867
  id: "sheet.operation.image-reset-size",
772
- type: CommandType.OPERATION,
773
- handler: /* @__PURE__ */ __name((accessor, params) => !0, "handler")
774
- }, COMPONENT_IMAGE_VIEWER = "COMPONENT_IMAGE_VIEWER", ImageViewer = /* @__PURE__ */ __name((props) => {
775
- const { src } = props;
776
- return src ? /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("img", { src, alt: "Univer Image Viewer", style: { width: "100%", height: "100%", position: "relative" } })) : null;
777
- }, "ImageViewer");
778
- var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
779
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
780
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
781
- return kind && result && __defProp$4(target, key, result), result;
782
- }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a2;
783
- let DrawingUIController = (_a2 = class extends Disposable {
784
- constructor(_componentManager, _commandService) {
785
- super(), this._componentManager = _componentManager, this._commandService = _commandService, this._init();
868
+ type: ve.OPERATION,
869
+ handler: (i, t) => !0
870
+ }, Pn = "COMPONENT_IMAGE_VIEWER", Xt = (i) => {
871
+ const { src: t } = i;
872
+ return t ? /* @__PURE__ */ c.jsx("div", { children: /* @__PURE__ */ c.jsx("img", { src: t, alt: "Univer Image Viewer", style: { width: "100%", height: "100%", position: "relative" } }) }) : null;
873
+ };
874
+ var qt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, Qt = (i, t, n, e) => {
875
+ for (var r = e > 1 ? void 0 : e ? Jt(t, n) : t, s = i.length - 1, a; s >= 0; s--)
876
+ (a = i[s]) && (r = (e ? a(t, n, r) : a(r)) || r);
877
+ return e && r && qt(t, n, r), r;
878
+ }, en = (i, t) => (n, e) => t(n, e, i);
879
+ let De = class extends He {
880
+ constructor(i, t) {
881
+ super(), this._componentManager = i, this._commandService = t, this._init();
786
882
  }
787
883
  _initCustomComponents() {
788
- const componentManager = this._componentManager;
789
- this.disposeWithMe(componentManager.register(COMPONENT_IMAGE_POPUP_MENU, ImagePopupMenu)), this.disposeWithMe(componentManager.register(COMPONENT_IMAGE_VIEWER, ImageViewer));
884
+ const i = this._componentManager;
885
+ this.disposeWithMe(i.register(Kt, Ft)), this.disposeWithMe(i.register(Pn, Xt));
790
886
  }
791
887
  _initCommands() {
792
888
  [
793
- OpenImageCropOperation,
794
- CloseImageCropOperation,
795
- ImageResetSizeOperation,
796
- SetDrawingAlignOperation,
797
- AutoImageCropOperation
798
- ].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
889
+ ze,
890
+ le,
891
+ In,
892
+ Ye,
893
+ Ne
894
+ ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
799
895
  }
800
896
  _init() {
801
897
  this._initCommands(), this._initCustomComponents();
802
898
  }
803
- }, __name(_a2, "DrawingUIController"), _a2);
804
- DrawingUIController = __decorateClass$4([
805
- __decorateParam$4(0, Inject(ComponentManager)),
806
- __decorateParam$4(1, ICommandService)
807
- ], DrawingUIController);
808
- var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
809
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
810
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
811
- return kind && result && __defProp$3(target, key, result), result;
812
- }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a3;
813
- let DrawingUpdateController = (_a3 = class extends Disposable {
814
- constructor(_currentUniverService, _commandService, _renderManagerService, _drawingManagerService) {
899
+ };
900
+ De = Qt([
901
+ en(0, Ue(zn)),
902
+ en(1, me)
903
+ ], De);
904
+ var er = Object.defineProperty, nr = Object.getOwnPropertyDescriptor, tr = (i, t, n, e) => {
905
+ for (var r = e > 1 ? void 0 : e ? nr(t, n) : t, s = i.length - 1, a; s >= 0; s--)
906
+ (a = i[s]) && (r = (e ? a(t, n, r) : a(r)) || r);
907
+ return e && r && er(t, n, r), r;
908
+ }, je = (i, t) => (n, e) => t(n, e, i);
909
+ let Ee = class extends He {
910
+ constructor(t, n, e, r) {
815
911
  super();
816
- __publicField(this, "_sceneListenerOnDrawingMap", /* @__PURE__ */ new WeakSet());
817
- this._currentUniverService = _currentUniverService, this._commandService = _commandService, this._renderManagerService = _renderManagerService, this._drawingManagerService = _drawingManagerService, this._initialize();
912
+ Q(this, "_sceneListenerOnDrawingMap", /* @__PURE__ */ new WeakSet());
913
+ this._currentUniverService = t, this._commandService = n, this._renderManagerService = e, this._drawingManagerService = r, this._initialize();
818
914
  }
819
915
  dispose() {
820
916
  super.dispose();
@@ -823,39 +919,39 @@ let DrawingUpdateController = (_a3 = class extends Disposable {
823
919
  this._recoveryImages(), this._drawingAddListener(), this._drawingRemoveListener(), this._drawingUpdateListener(), this._commandExecutedListener(), this._drawingArrangeListener(), this._drawingGroupListener(), this._drawingRefreshListener(), this._drawingVisibleListener();
824
920
  }
825
921
  _recoveryImages() {
826
- const drawingList = this._drawingManagerService.drawingManagerData, info = getCurrentUnitInfo(this._currentUniverService);
827
- if (info == null)
922
+ const t = this._drawingManagerService.drawingManagerData, n = ln(this._currentUniverService);
923
+ if (n == null)
828
924
  return;
829
- const { unitId: currentUnitId, subUnitId: currentSubUnitId } = info;
830
- Object.keys(drawingList).forEach((unitId) => {
831
- Object.keys(drawingList[unitId]).forEach((subUnitId) => {
832
- const drawingMap = drawingList[unitId][subUnitId].data;
833
- drawingMap == null || unitId !== currentUnitId || subUnitId !== currentSubUnitId || Object.keys(drawingMap).forEach((drawingId) => {
834
- drawingMap[drawingId] && this._insertDrawing([{ unitId, subUnitId, drawingId }]);
925
+ const { unitId: e, subUnitId: r } = n;
926
+ Object.keys(t).forEach((s) => {
927
+ Object.keys(t[s]).forEach((a) => {
928
+ const o = t[s][a].data;
929
+ o == null || s !== e || a !== r || Object.keys(o).forEach((l) => {
930
+ o[l] && this._insertDrawing([{ unitId: s, subUnitId: a, drawingId: l }]);
835
931
  });
836
932
  });
837
933
  });
838
934
  }
839
935
  _commandExecutedListener() {
840
936
  this.disposeWithMe(
841
- this._commandService.onCommandExecuted((command) => {
842
- if (command.id === SetDrawingAlignOperation.id) {
843
- const params = command.params;
844
- if (params == null)
937
+ this._commandService.onCommandExecuted((t) => {
938
+ if (t.id === Ye.id) {
939
+ const n = t.params;
940
+ if (n == null)
845
941
  return;
846
- this._drawingAlign(params);
942
+ this._drawingAlign(n);
847
943
  }
848
944
  })
849
945
  );
850
946
  }
851
947
  _drawingGroupListener() {
852
948
  this.disposeWithMe(
853
- this._drawingManagerService.group$.subscribe((params) => {
854
- this._groupDrawings(params);
949
+ this._drawingManagerService.group$.subscribe((t) => {
950
+ this._groupDrawings(t);
855
951
  })
856
952
  ), this.disposeWithMe(
857
- this._drawingManagerService.ungroup$.subscribe((params) => {
858
- this._ungroupDrawings(params);
953
+ this._drawingManagerService.ungroup$.subscribe((t) => {
954
+ this._ungroupDrawings(t);
859
955
  })
860
956
  );
861
957
  }
@@ -879,38 +975,38 @@ let DrawingUpdateController = (_a3 = class extends Disposable {
879
975
  // break;
880
976
  // }
881
977
  // }
882
- _getSceneAndTransformerByDrawingSearch(unitId) {
883
- if (unitId == null)
978
+ _getSceneAndTransformerByDrawingSearch(t) {
979
+ if (t == null)
884
980
  return;
885
- const renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
886
- if (scene == null)
981
+ const n = this._renderManagerService.getRenderById(t), e = n == null ? void 0 : n.scene;
982
+ if (e == null)
887
983
  return null;
888
- const transformer = scene.getTransformerByCreate();
889
- return { scene, transformer };
984
+ const r = e.getTransformerByCreate();
985
+ return { scene: e, transformer: r };
890
986
  }
891
- _groupDrawings(drawings) {
892
- drawings.forEach((drawing) => {
893
- this._groupDrawing(drawing);
987
+ _groupDrawings(t) {
988
+ t.forEach((n) => {
989
+ this._groupDrawing(n);
894
990
  });
895
991
  }
896
- _groupDrawing(params) {
897
- const { parent, children } = params, { unitId, subUnitId, drawingId } = parent, renderObject = this._getSceneAndTransformerByDrawingSearch(parent.unitId);
898
- if (renderObject == null)
992
+ _groupDrawing(t) {
993
+ const { parent: n, children: e } = t, { unitId: r, subUnitId: s, drawingId: a } = n, o = this._getSceneAndTransformerByDrawingSearch(n.unitId);
994
+ if (o == null)
899
995
  return;
900
- const { scene, transformer } = renderObject;
901
- this._commandService.syncExecuteCommand(CloseImageCropOperation.id);
902
- const objects = [];
903
- if (children.forEach((drawing) => {
904
- const drawingShapeKey = getDrawingShapeKeyByDrawingSearch(drawing), object = scene.getObjectIncludeInGroup(drawingShapeKey);
905
- if (object == null || objects.includes(object))
996
+ const { scene: l, transformer: g } = o;
997
+ this._commandService.syncExecuteCommand(le.id);
998
+ const u = [];
999
+ if (e.forEach((f) => {
1000
+ const v = G(f), w = l.getObjectIncludeInGroup(v);
1001
+ if (w == null || u.includes(w))
906
1002
  return;
907
- objects.push(object);
908
- const { transform } = drawing;
909
- transform != null && (object.classType === RENDER_CLASS_TYPE.GROUP ? object.transformByState({ left: transform.left, top: transform.top }) : object.transformByState(transform));
910
- }), objects.length === 0)
1003
+ u.push(w);
1004
+ const { transform: p } = f;
1005
+ p != null && (w.classType === Xe.GROUP ? w.transformByState({ left: p.left, top: p.top }) : w.transformByState(p));
1006
+ }), u.length === 0)
911
1007
  return;
912
- const groupKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), group = new Group(groupKey);
913
- scene.addObject(group, DRAWING_OBJECT_LAYER_INDEX).attachTransformerTo(group), group.addObjects(...objects), parent.transform && group.transformByState({ left: parent.transform.left, top: parent.transform.top }), transformer.clearSelectedObjects(), transformer.setSelectedControl(group);
1008
+ const d = G({ unitId: r, subUnitId: s, drawingId: a }), h = new Ce(d);
1009
+ l.addObject(h, Fe).attachTransformerTo(h), h.addObjects(...u), n.transform && h.transformByState({ left: n.transform.left, top: n.transform.top }), g.clearSelectedObjects(), g.setSelectedControl(h);
914
1010
  }
915
1011
  // private _regroupDrawings(drawings: IDrawingSearch[]) {
916
1012
  // const renderObject = this._getSceneAndTransformerByDrawingSearch(drawings[0].unitId);
@@ -946,127 +1042,127 @@ let DrawingUpdateController = (_a3 = class extends Disposable {
946
1042
  // transformer.clearSelectedObjects();
947
1043
  // transformer.setSelectedControl(firstGroup);
948
1044
  // }
949
- _ungroupDrawings(drawings) {
950
- drawings.forEach((drawing) => {
951
- this._ungroupDrawing(drawing);
1045
+ _ungroupDrawings(t) {
1046
+ t.forEach((n) => {
1047
+ this._ungroupDrawing(n);
952
1048
  });
953
1049
  }
954
- _ungroupDrawing(drawing) {
955
- const { parent, children } = drawing, renderObject = this._getSceneAndTransformerByDrawingSearch(parent.unitId);
956
- if (renderObject == null)
1050
+ _ungroupDrawing(t) {
1051
+ const { parent: n, children: e } = t, r = this._getSceneAndTransformerByDrawingSearch(n.unitId);
1052
+ if (r == null)
957
1053
  return;
958
- const { scene, transformer } = renderObject;
959
- children.forEach((drawing2) => {
960
- const drawingKey = getDrawingShapeKeyByDrawingSearch(drawing2), object = scene.getObjectIncludeInGroup(drawingKey);
961
- if (object == null)
1054
+ const { scene: s, transformer: a } = r;
1055
+ e.forEach((d) => {
1056
+ const h = G(d), f = s.getObjectIncludeInGroup(h);
1057
+ if (f == null)
962
1058
  return !0;
963
- if (object == null)
1059
+ if (f == null)
964
1060
  return;
965
- const { transform } = drawing2;
966
- transform != null && (object.classType === RENDER_CLASS_TYPE.GROUP ? object.transformByState({ left: transform.left, top: transform.top }) : object.transformByState(transform));
1061
+ const { transform: v } = d;
1062
+ v != null && (f.classType === Xe.GROUP ? f.transformByState({ left: v.left, top: v.top }) : f.transformByState(v));
967
1063
  });
968
- const groupKey = getDrawingShapeKeyByDrawingSearch(parent), group = scene.getObject(groupKey), { width, height } = group;
969
- group.getObjects().forEach((object) => {
970
- group.removeSelfObjectAndTransform(object.oKey, width, height);
971
- }), group.dispose(), transformer.clearSelectedObjects();
972
- }
973
- _drawingAlign(params) {
974
- const { alignType } = params, drawings = this._drawingManagerService.getFocusDrawings();
975
- if (alignType === AlignType.default)
1064
+ const o = G(n), l = s.getObject(o), { width: g, height: u } = l;
1065
+ l.getObjects().forEach((d) => {
1066
+ l.removeSelfObjectAndTransform(d.oKey, g, u);
1067
+ }), l.dispose(), a.clearSelectedObjects();
1068
+ }
1069
+ _drawingAlign(t) {
1070
+ const { alignType: n } = t, e = this._drawingManagerService.getFocusDrawings();
1071
+ if (n === j.default)
976
1072
  return;
977
- const drawingTransformCaches = [];
978
- let minLeft = Number.POSITIVE_INFINITY, minTop = Number.POSITIVE_INFINITY, maxRight = Number.NEGATIVE_INFINITY, maxBottom = Number.NEGATIVE_INFINITY, drawingCount = 0;
979
- drawings.forEach((drawing) => {
980
- const { unitId, subUnitId, drawingId, drawingType } = drawing, drawingParam = this._drawingManagerService.getDrawingByParam({ unitId, subUnitId, drawingId });
981
- if (drawingParam == null || drawingParam.transform == null)
1073
+ const r = [];
1074
+ let s = Number.POSITIVE_INFINITY, a = Number.POSITIVE_INFINITY, o = Number.NEGATIVE_INFINITY, l = Number.NEGATIVE_INFINITY, g = 0;
1075
+ e.forEach((u) => {
1076
+ const { unitId: d, subUnitId: h, drawingId: f, drawingType: v } = u, w = this._drawingManagerService.getDrawingByParam({ unitId: d, subUnitId: h, drawingId: f });
1077
+ if (w == null || w.transform == null)
982
1078
  return;
983
- drawingTransformCaches.push({
984
- unitId,
985
- subUnitId,
986
- drawingId,
987
- drawingType,
988
- transform: drawingParam.transform
1079
+ r.push({
1080
+ unitId: d,
1081
+ subUnitId: h,
1082
+ drawingId: f,
1083
+ drawingType: v,
1084
+ transform: w.transform
989
1085
  });
990
- const { left = 0, top = 0, width = 0, height = 0 } = drawingParam.transform;
991
- minLeft = Math.min(minLeft, left), minTop = Math.min(minTop, top), maxRight = Math.max(maxRight, left + width), maxBottom = Math.max(maxBottom, top + height), drawingCount++;
992
- }), drawingCount !== 0 && (this._sortDrawingTransform(drawingTransformCaches, alignType), this._applyAlignType(drawingTransformCaches, alignType, minLeft, minTop, maxRight, maxBottom, drawingCount));
1086
+ const { left: p = 0, top: S = 0, width: _ = 0, height: R = 0 } = w.transform;
1087
+ s = Math.min(s, p), a = Math.min(a, S), o = Math.max(o, p + _), l = Math.max(l, S + R), g++;
1088
+ }), g !== 0 && (this._sortDrawingTransform(r, n), this._applyAlignType(r, n, s, a, o, l, g));
993
1089
  }
994
- _applyAlignType(drawingTransformCaches, alignType, minLeft, minTop, maxRight, maxBottom, drawingCount) {
995
- const averageHorizon = Math.round((maxRight - minLeft) / drawingCount * 10) / 10, averageVertical = Math.round((maxBottom - minTop) / drawingCount * 10) / 10, updateParams = [], renderObject = this._getSceneAndTransformerByDrawingSearch(drawingTransformCaches[0].unitId);
996
- if (renderObject == null)
1090
+ _applyAlignType(t, n, e, r, s, a, o) {
1091
+ const l = Math.round((s - e) / o * 10) / 10, g = Math.round((a - r) / o * 10) / 10, u = [], d = this._getSceneAndTransformerByDrawingSearch(t[0].unitId);
1092
+ if (d == null)
997
1093
  return;
998
- const { scene, transformer } = renderObject;
999
- drawingTransformCaches.forEach((drawingTransformCache, index) => {
1000
- const { unitId, subUnitId, drawingId, transform, drawingType } = drawingTransformCache, { left = 0, top = 0, width = 0, height = 0 } = transform;
1001
- let newLeft = left, newTop = top;
1002
- switch (alignType) {
1003
- case AlignType.left:
1004
- newLeft = minLeft;
1094
+ const { scene: h, transformer: f } = d;
1095
+ t.forEach((v, w) => {
1096
+ const { unitId: p, subUnitId: S, drawingId: _, transform: R, drawingType: b } = v, { left: N = 0, top: I = 0, width: y = 0, height: P = 0 } = R;
1097
+ let M = N, D = I;
1098
+ switch (n) {
1099
+ case j.left:
1100
+ M = e;
1005
1101
  break;
1006
- case AlignType.center:
1007
- newLeft = minLeft + (maxRight - minLeft) / 2 - width / 2;
1102
+ case j.center:
1103
+ M = e + (s - e) / 2 - y / 2;
1008
1104
  break;
1009
- case AlignType.right:
1010
- newLeft = maxRight - width;
1105
+ case j.right:
1106
+ M = s - y;
1011
1107
  break;
1012
- case AlignType.top:
1013
- newTop = minTop;
1108
+ case j.top:
1109
+ D = r;
1014
1110
  break;
1015
- case AlignType.middle:
1016
- newTop = minTop + (maxBottom - minTop) / 2 - height / 2;
1111
+ case j.middle:
1112
+ D = r + (a - r) / 2 - P / 2;
1017
1113
  break;
1018
- case AlignType.bottom:
1019
- newTop = maxBottom - height;
1114
+ case j.bottom:
1115
+ D = a - P;
1020
1116
  break;
1021
- case AlignType.horizon:
1022
- newLeft = minLeft + averageHorizon * index;
1117
+ case j.horizon:
1118
+ M = e + l * w;
1023
1119
  break;
1024
- case AlignType.vertical:
1025
- newTop = minTop + averageVertical * index;
1120
+ case j.vertical:
1121
+ D = r + g * w;
1026
1122
  break;
1027
1123
  }
1028
- (newLeft !== left || newTop !== top) && updateParams.push({
1029
- unitId,
1030
- subUnitId,
1031
- drawingId,
1032
- drawingType,
1124
+ (M !== N || D !== I) && u.push({
1125
+ unitId: p,
1126
+ subUnitId: S,
1127
+ drawingId: _,
1128
+ drawingType: b,
1033
1129
  transform: {
1034
- left: newLeft,
1035
- top: newTop
1130
+ left: M,
1131
+ top: D
1036
1132
  }
1037
1133
  });
1038
- }), this._drawingManagerService.featurePluginUpdateNotification(updateParams), transformer.refreshControls().changeNotification();
1039
- }
1040
- _sortDrawingTransform(drawingTransformCaches, alignType) {
1041
- drawingTransformCaches.sort((a, b) => {
1042
- const aTransform = a.transform, bTransform = b.transform, {
1043
- left: aLeft = 0,
1044
- top: aTop = 0,
1045
- width: aWidth = 0,
1046
- height: aHeight = 0
1047
- } = aTransform, {
1048
- left: bLeft = 0,
1049
- top: bTop = 0,
1050
- width: bWidth = 0,
1051
- height: bHeight = 0
1052
- } = bTransform;
1053
- switch (alignType) {
1054
- case AlignType.left:
1055
- return aLeft - bLeft;
1056
- case AlignType.center:
1057
- return aLeft + aWidth / 2 - (bLeft + bWidth / 2);
1058
- case AlignType.right:
1059
- return aLeft + aWidth - (bLeft + bWidth);
1060
- case AlignType.top:
1061
- return aTop - bTop;
1062
- case AlignType.middle:
1063
- return aTop + aHeight / 2 - (bTop + bHeight / 2);
1064
- case AlignType.bottom:
1065
- return aTop + aHeight - (bTop + bHeight);
1066
- case AlignType.horizon:
1067
- return aLeft + aWidth / 2 - (bLeft + bWidth / 2);
1068
- case AlignType.vertical:
1069
- return aTop + aHeight / 2 - (bTop + bHeight / 2);
1134
+ }), this._drawingManagerService.featurePluginUpdateNotification(u), f.refreshControls().changeNotification();
1135
+ }
1136
+ _sortDrawingTransform(t, n) {
1137
+ t.sort((e, r) => {
1138
+ const s = e.transform, a = r.transform, {
1139
+ left: o = 0,
1140
+ top: l = 0,
1141
+ width: g = 0,
1142
+ height: u = 0
1143
+ } = s, {
1144
+ left: d = 0,
1145
+ top: h = 0,
1146
+ width: f = 0,
1147
+ height: v = 0
1148
+ } = a;
1149
+ switch (n) {
1150
+ case j.left:
1151
+ return o - d;
1152
+ case j.center:
1153
+ return o + g / 2 - (d + f / 2);
1154
+ case j.right:
1155
+ return o + g - (d + f);
1156
+ case j.top:
1157
+ return l - h;
1158
+ case j.middle:
1159
+ return l + u / 2 - (h + v / 2);
1160
+ case j.bottom:
1161
+ return l + u - (h + v);
1162
+ case j.horizon:
1163
+ return o + g / 2 - (d + f / 2);
1164
+ case j.vertical:
1165
+ return l + u / 2 - (h + v / 2);
1070
1166
  default:
1071
1167
  return 0;
1072
1168
  }
@@ -1074,60 +1170,60 @@ let DrawingUpdateController = (_a3 = class extends Disposable {
1074
1170
  }
1075
1171
  _drawingArrangeListener() {
1076
1172
  this.disposeWithMe(
1077
- this._drawingManagerService.order$.subscribe((params) => {
1078
- this._drawingArrange(params);
1173
+ this._drawingManagerService.order$.subscribe((t) => {
1174
+ this._drawingArrange(t);
1079
1175
  })
1080
1176
  );
1081
1177
  }
1082
- _drawingArrange(params) {
1083
- const { unitId, subUnitId, drawingIds } = params, renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
1084
- if (renderObject == null)
1178
+ _drawingArrange(t) {
1179
+ const { unitId: n, subUnitId: e, drawingIds: r } = t, s = this._getSceneAndTransformerByDrawingSearch(n);
1180
+ if (s == null)
1085
1181
  return;
1086
- const { scene } = renderObject;
1087
- drawingIds.forEach((drawingId) => {
1088
- const oKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), drawingShapes = scene.fuzzyMathObjects(oKey, !0);
1089
- if (drawingShapes == null || drawingShapes.length === 0)
1182
+ const { scene: a } = s;
1183
+ r.forEach((o) => {
1184
+ const l = G({ unitId: n, subUnitId: e, drawingId: o }), g = a.fuzzyMathObjects(l, !0);
1185
+ if (g == null || g.length === 0)
1090
1186
  return;
1091
- const index = this._drawingManagerService.getDrawingOrder(unitId, subUnitId).indexOf(drawingId);
1092
- for (const shape of drawingShapes)
1093
- shape.setProps({ zIndex: index }), shape.makeDirty();
1187
+ const u = this._drawingManagerService.getDrawingOrder(n, e).indexOf(o);
1188
+ for (const d of g)
1189
+ d.setProps({ zIndex: u }), d.makeDirty();
1094
1190
  });
1095
1191
  }
1096
1192
  _drawingAddListener() {
1097
1193
  this.disposeWithMe(
1098
- this._drawingManagerService.add$.subscribe((params) => {
1099
- this._insertDrawing(params);
1194
+ this._drawingManagerService.add$.subscribe((t) => {
1195
+ this._insertDrawing(t);
1100
1196
  })
1101
1197
  );
1102
1198
  }
1103
- _insertDrawing(params) {
1104
- const sceneList = [];
1105
- params.forEach((param) => {
1106
- const { unitId } = param;
1107
- if (this._drawingManagerService.getDrawingByParam(param) == null)
1199
+ _insertDrawing(t) {
1200
+ const n = [];
1201
+ t.forEach((e) => {
1202
+ const { unitId: r } = e;
1203
+ if (this._drawingManagerService.getDrawingByParam(e) == null)
1108
1204
  return;
1109
- const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
1110
- if (renderObject == null)
1205
+ const a = this._getSceneAndTransformerByDrawingSearch(r);
1206
+ if (a == null)
1111
1207
  return;
1112
- const { scene } = renderObject;
1113
- sceneList.includes(scene) || sceneList.push(scene);
1114
- }), sceneList.forEach((scene) => {
1115
- this._sceneListenerOnDrawingMap.has(scene) || (this._addListenerOnDrawing(scene), this._sceneListenerOnDrawingMap.add(scene));
1208
+ const { scene: o } = a;
1209
+ n.includes(o) || n.push(o);
1210
+ }), n.forEach((e) => {
1211
+ this._sceneListenerOnDrawingMap.has(e) || (this._addListenerOnDrawing(e), this._sceneListenerOnDrawingMap.add(e));
1116
1212
  });
1117
1213
  }
1118
1214
  _drawingRemoveListener() {
1119
1215
  this.disposeWithMe(
1120
- this._drawingManagerService.remove$.subscribe((params) => {
1121
- params.forEach((param) => {
1122
- var _a7;
1123
- const { unitId, subUnitId, drawingId } = param, renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
1124
- if (renderObject == null)
1216
+ this._drawingManagerService.remove$.subscribe((t) => {
1217
+ t.forEach((n) => {
1218
+ var u;
1219
+ const { unitId: e, subUnitId: r, drawingId: s } = n, a = this._getSceneAndTransformerByDrawingSearch(e);
1220
+ if (a == null)
1125
1221
  return;
1126
- const { scene } = renderObject, drawingShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), drawingShapes = scene.fuzzyMathObjects(drawingShapeKey, !0);
1127
- if (drawingShapes.length > 0) {
1128
- for (const drawingShape of drawingShapes)
1129
- drawingShape.dispose();
1130
- (_a7 = scene.getTransformer()) == null || _a7.clearSelectedObjects();
1222
+ const { scene: o } = a, l = G({ unitId: e, subUnitId: r, drawingId: s }), g = o.fuzzyMathObjects(l, !0);
1223
+ if (g.length > 0) {
1224
+ for (const d of g)
1225
+ d.dispose();
1226
+ (u = o.getTransformer()) == null || u.clearSelectedObjects();
1131
1227
  }
1132
1228
  });
1133
1229
  })
@@ -1135,75 +1231,75 @@ let DrawingUpdateController = (_a3 = class extends Disposable {
1135
1231
  }
1136
1232
  _drawingUpdateListener() {
1137
1233
  this.disposeWithMe(
1138
- this._drawingManagerService.update$.subscribe((params) => {
1139
- params.forEach((param) => {
1140
- const { unitId, subUnitId, drawingId } = param, drawingParam = this._drawingManagerService.getDrawingByParam(param);
1141
- if (drawingParam == null)
1234
+ this._drawingManagerService.update$.subscribe((t) => {
1235
+ t.forEach((n) => {
1236
+ const { unitId: e, subUnitId: r, drawingId: s } = n, a = this._drawingManagerService.getDrawingByParam(n);
1237
+ if (a == null)
1142
1238
  return;
1143
- const { transform, drawingType } = drawingParam, renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
1144
- if (renderObject == null)
1239
+ const { transform: o, drawingType: l } = a, g = this._getSceneAndTransformerByDrawingSearch(e);
1240
+ if (g == null)
1145
1241
  return;
1146
- const { scene, transformer } = renderObject;
1147
- if (transform == null)
1242
+ const { scene: u, transformer: d } = g;
1243
+ if (o == null)
1148
1244
  return !0;
1149
- const { left = 0, top = 0, width = 0, height = 0, angle = 0, flipX = !1, flipY = !1, skewX = 0, skewY = 0 } = transform, drawingShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), drawingShape = scene.getObject(drawingShapeKey);
1150
- if (drawingShape == null)
1245
+ const { left: h = 0, top: f = 0, width: v = 0, height: w = 0, angle: p = 0, flipX: S = !1, flipY: _ = !1, skewX: R = 0, skewY: b = 0 } = o, N = G({ unitId: e, subUnitId: r, drawingId: s }), I = u.getObject(N);
1246
+ if (I == null)
1151
1247
  return !0;
1152
- drawingShape.transformByState({ left, top, width, height, angle, flipX, flipY, skewX, skewY });
1248
+ I.transformByState({ left: h, top: f, width: v, height: w, angle: p, flipX: S, flipY: _, skewX: R, skewY: b });
1153
1249
  });
1154
1250
  })
1155
1251
  );
1156
1252
  }
1157
1253
  _drawingRefreshListener() {
1158
1254
  this.disposeWithMe(
1159
- this._drawingManagerService.refreshTransform$.subscribe((params) => {
1160
- params.forEach((param) => {
1161
- const { unitId, subUnitId, drawingId } = param, renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
1162
- if (renderObject == null)
1255
+ this._drawingManagerService.refreshTransform$.subscribe((t) => {
1256
+ t.forEach((n) => {
1257
+ const { unitId: e, subUnitId: r, drawingId: s } = n, a = this._getSceneAndTransformerByDrawingSearch(e);
1258
+ if (a == null)
1163
1259
  return;
1164
- const drawingParam = this._drawingManagerService.getDrawingByParam(param);
1165
- if (drawingParam == null)
1260
+ const o = this._drawingManagerService.getDrawingByParam(n);
1261
+ if (o == null)
1166
1262
  return;
1167
- const { transform } = drawingParam, { scene } = renderObject, drawingShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), drawingShape = scene.getObject(drawingShapeKey);
1168
- if (drawingShape == null || transform == null)
1263
+ const { transform: l } = o, { scene: g } = a, u = G({ unitId: e, subUnitId: r, drawingId: s }), d = g.getObject(u);
1264
+ if (d == null || l == null)
1169
1265
  return !0;
1170
1266
  const {
1171
- left = 0,
1172
- top = 0,
1173
- width = 0,
1174
- height = 0,
1175
- angle = 0,
1176
- flipX = !1,
1177
- flipY = !1,
1178
- skewX = 0,
1179
- skewY = 0
1180
- } = transform;
1181
- drawingShape.transformByState({ left, top, width, height, angle, flipX, flipY, skewX, skewY });
1267
+ left: h = 0,
1268
+ top: f = 0,
1269
+ width: v = 0,
1270
+ height: w = 0,
1271
+ angle: p = 0,
1272
+ flipX: S = !1,
1273
+ flipY: _ = !1,
1274
+ skewX: R = 0,
1275
+ skewY: b = 0
1276
+ } = l;
1277
+ d.transformByState({ left: h, top: f, width: v, height: w, angle: p, flipX: S, flipY: _, skewX: R, skewY: b });
1182
1278
  });
1183
1279
  })
1184
1280
  );
1185
1281
  }
1186
1282
  _drawingVisibleListener() {
1187
1283
  this.disposeWithMe(
1188
- this._drawingManagerService.visible$.subscribe((params) => {
1189
- params.forEach((param) => {
1190
- const { unitId, subUnitId, drawingId, visible } = param, renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
1191
- if (renderObject == null)
1284
+ this._drawingManagerService.visible$.subscribe((t) => {
1285
+ t.forEach((n) => {
1286
+ const { unitId: e, subUnitId: r, drawingId: s, visible: a } = n, o = this._getSceneAndTransformerByDrawingSearch(e);
1287
+ if (o == null)
1192
1288
  return;
1193
- const { scene } = renderObject, drawingShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), drawingShape = scene.getObject(drawingShapeKey);
1194
- if (drawingShape == null)
1289
+ const { scene: l } = o, g = G({ unitId: e, subUnitId: r, drawingId: s }), u = l.getObject(g);
1290
+ if (u == null)
1195
1291
  return !0;
1196
- visible ? drawingShape.show() : drawingShape.hide();
1292
+ a ? u.show() : u.hide();
1197
1293
  });
1198
1294
  })
1199
1295
  );
1200
1296
  }
1201
- _filterUpdateParams(params, startTransforms) {
1202
- return params.filter((param, index) => {
1203
- if (param == null)
1297
+ _filterUpdateParams(t, n) {
1298
+ return t.filter((e, r) => {
1299
+ if (e == null)
1204
1300
  return !1;
1205
- const { transform } = param;
1206
- return checkIfMove(transform, startTransforms == null ? void 0 : startTransforms[index]);
1301
+ const { transform: s } = e;
1302
+ return sn(s, n == null ? void 0 : n[r]);
1207
1303
  });
1208
1304
  }
1209
1305
  // group?.getObjects().forEach((o) => {
@@ -1213,420 +1309,417 @@ let DrawingUpdateController = (_a3 = class extends Disposable {
1213
1309
  // drawings.push({ unitId, subUnitId, drawingId });
1214
1310
  // }
1215
1311
  // });
1216
- _addListenerOnDrawing(scene) {
1217
- const transformer = scene.getTransformerByCreate();
1218
- let startTransforms = null;
1312
+ _addListenerOnDrawing(t) {
1313
+ const n = t.getTransformerByCreate();
1314
+ let e = null;
1219
1315
  this.disposeWithMe(
1220
- toDisposable(
1221
- transformer.changeStart$.subscribe((state) => {
1222
- const { objects } = state, objectArray = Array.from(objects.values()), drawings = [];
1223
- startTransforms = objectArray.map((object) => {
1224
- const { left, top, height, width, angle, oKey, isInGroup } = object, drawing = this._drawingManagerService.getDrawingOKey(oKey);
1225
- if (isInGroup || object instanceof Group) {
1226
- let group = object.ancestorGroup;
1227
- if (group == null && object instanceof Group && (group = object), group == null)
1316
+ we(
1317
+ n.changeStart$.subscribe((r) => {
1318
+ const { objects: s } = r, a = Array.from(s.values()), o = [];
1319
+ e = a.map((l) => {
1320
+ const { left: g, top: u, height: d, width: h, angle: f, oKey: v, isInGroup: w } = l, p = this._drawingManagerService.getDrawingOKey(v);
1321
+ if (w || l instanceof Ce) {
1322
+ let S = l.ancestorGroup;
1323
+ if (S == null && l instanceof Ce && (S = l), S == null)
1228
1324
  return null;
1229
- const groupDrawing = this._drawingManagerService.getDrawingOKey(group.oKey);
1230
- if (groupDrawing) {
1231
- const { unitId, subUnitId, drawingId } = groupDrawing;
1232
- drawings.push({ unitId, subUnitId, drawingId });
1233
- const { left: left2, top: top2, height: height2, width: width2, angle: angle2 } = group;
1234
- return { left: left2, top: top2, height: height2, width: width2, angle: angle2 };
1325
+ const _ = this._drawingManagerService.getDrawingOKey(S.oKey);
1326
+ if (_) {
1327
+ const { unitId: R, subUnitId: b, drawingId: N } = _;
1328
+ o.push({ unitId: R, subUnitId: b, drawingId: N });
1329
+ const { left: I, top: y, height: P, width: M, angle: D } = S;
1330
+ return { left: I, top: y, height: P, width: M, angle: D };
1235
1331
  }
1236
- } else if (drawing != null) {
1237
- const { unitId, subUnitId, drawingId } = drawing;
1238
- return drawings.push({ unitId, subUnitId, drawingId }), { left, top, height, width, angle };
1332
+ } else if (p != null) {
1333
+ const { unitId: S, subUnitId: _, drawingId: R } = p;
1334
+ return o.push({ unitId: S, subUnitId: _, drawingId: R }), { left: g, top: u, height: d, width: h, angle: f };
1239
1335
  }
1240
1336
  return null;
1241
- }).filter((transform) => transform != null), drawings.length > 0 ? this._drawingManagerService.focusDrawing(drawings) : this._drawingManagerService.focusDrawing(null);
1337
+ }).filter((l) => l != null), o.length > 0 ? this._drawingManagerService.focusDrawing(o) : this._drawingManagerService.focusDrawing(null);
1242
1338
  })
1243
1339
  )
1244
1340
  ), this.disposeWithMe(
1245
- toDisposable(
1246
- transformer.changeEnd$.subscribe((state) => {
1247
- const { objects } = state, params = this._filterUpdateParams(getUpdateParams(objects, this._drawingManagerService), startTransforms);
1248
- params.length > 0 && this._drawingManagerService.featurePluginUpdateNotification(params);
1341
+ we(
1342
+ n.changeEnd$.subscribe((r) => {
1343
+ const { objects: s } = r, a = this._filterUpdateParams(Ae(s, this._drawingManagerService), e);
1344
+ a.length > 0 && this._drawingManagerService.featurePluginUpdateNotification(a);
1249
1345
  })
1250
1346
  )
1251
1347
  );
1252
1348
  }
1253
- }, __name(_a3, "DrawingUpdateController"), _a3);
1254
- DrawingUpdateController = __decorateClass$3([
1255
- __decorateParam$3(0, IUniverInstanceService),
1256
- __decorateParam$3(1, ICommandService),
1257
- __decorateParam$3(2, IRenderManagerService),
1258
- __decorateParam$3(3, IDrawingManagerService)
1259
- ], DrawingUpdateController);
1260
- const _ImageCropperObject = class _ImageCropperObject extends Shape {
1261
- constructor(key, props) {
1262
- props == null && (props = {}), props.transformerConfig = {
1349
+ };
1350
+ Ee = tr([
1351
+ je(0, Ke),
1352
+ je(1, me),
1353
+ je(2, ue),
1354
+ je(3, ne)
1355
+ ], Ee);
1356
+ class Re extends Bn {
1357
+ constructor(n, e) {
1358
+ e == null && (e = {}), e.transformerConfig = {
1263
1359
  keepRatio: !1,
1264
1360
  isCropper: !0,
1265
1361
  anchorFill: "rgb(0, 0, 0)",
1266
1362
  anchorStroke: "rgb(255, 255, 255)",
1267
1363
  anchorSize: 24
1268
1364
  };
1269
- super(key, props);
1270
- __publicField(this, "_srcRect");
1271
- __publicField(this, "_prstGeom");
1272
- __publicField(this, "_applyTransform");
1273
- __publicField(this, "_dragPadding", 8);
1274
- __publicField(this, "_cacheCanvas");
1275
- props != null && props.srcRect && (this._srcRect = props.srcRect), props != null && props.prstGeom && (this._prstGeom = props.prstGeom), props != null && props.applyTransform && (this._applyTransform = props.applyTransform), props != null && props.dragPadding && (this._dragPadding = props.dragPadding), this._applyProps();
1365
+ super(n, e);
1366
+ Q(this, "_srcRect");
1367
+ Q(this, "_prstGeom");
1368
+ Q(this, "_applyTransform");
1369
+ Q(this, "_dragPadding", 8);
1370
+ Q(this, "_cacheCanvas");
1371
+ e != null && e.srcRect && (this._srcRect = e.srcRect), e != null && e.prstGeom && (this._prstGeom = e.prstGeom), e != null && e.applyTransform && (this._applyTransform = e.applyTransform), e != null && e.dragPadding && (this._dragPadding = e.dragPadding), this._applyProps();
1276
1372
  }
1277
- refreshSrcRect(value, transform) {
1278
- this._srcRect = value, this._applyTransform = transform, this._applyProps();
1373
+ refreshSrcRect(n, e) {
1374
+ this._srcRect = n, this._applyTransform = e, this._applyProps();
1279
1375
  }
1280
1376
  get srcRect() {
1281
1377
  return this._srcRect;
1282
1378
  }
1283
1379
  dispose() {
1284
- var _a7;
1285
- super.dispose(), (_a7 = this._cacheCanvas) == null || _a7.dispose(), this._srcRect = null;
1286
- }
1287
- isHit(coord) {
1288
- const oCoord = this.getInverseCoord(coord);
1289
- return oCoord.x >= -this.strokeWidth / 2 && oCoord.x <= this.width + this.strokeWidth / 2 && oCoord.y >= -this.strokeWidth / 2 && oCoord.y <= this.height + this.strokeWidth / 2 && !this._inSurround(oCoord);
1290
- }
1291
- _inSurround(oCoord) {
1292
- const padding = this._dragPadding;
1293
- return oCoord.x >= padding - this.strokeWidth / 2 && oCoord.x <= this.width + this.strokeWidth / 2 - padding && oCoord.y >= padding - this.strokeWidth / 2 && oCoord.y <= this.height + this.strokeWidth / 2 - padding;
1294
- }
1295
- render(mainCtx, bounds) {
1296
- return this.visible ? (mainCtx.save(), this._draw(mainCtx), mainCtx.restore(), this.makeDirty(!1), this) : (this.makeDirty(!1), this);
1297
- }
1298
- _draw(ctx) {
1299
- var _a7, _b;
1300
- const engine = this.getScene().getEngine(), { width: engineWidth, height: engineHeight } = engine;
1301
- this._initialCacheCanvas(), (_a7 = this._cacheCanvas) == null || _a7.clear();
1302
- const cacheCtx = (_b = this._cacheCanvas) == null ? void 0 : _b.getContext();
1303
- cacheCtx != null && (cacheCtx.save(), Rect.drawWith(cacheCtx, {
1380
+ var n;
1381
+ super.dispose(), (n = this._cacheCanvas) == null || n.dispose(), this._srcRect = null;
1382
+ }
1383
+ isHit(n) {
1384
+ const e = this.getInverseCoord(n);
1385
+ return e.x >= -this.strokeWidth / 2 && e.x <= this.width + this.strokeWidth / 2 && e.y >= -this.strokeWidth / 2 && e.y <= this.height + this.strokeWidth / 2 && !this._inSurround(e);
1386
+ }
1387
+ _inSurround(n) {
1388
+ const e = this._dragPadding;
1389
+ return n.x >= e - this.strokeWidth / 2 && n.x <= this.width + this.strokeWidth / 2 - e && n.y >= e - this.strokeWidth / 2 && n.y <= this.height + this.strokeWidth / 2 - e;
1390
+ }
1391
+ render(n, e) {
1392
+ return this.visible ? (n.save(), this._draw(n), n.restore(), this.makeDirty(!1), this) : (this.makeDirty(!1), this);
1393
+ }
1394
+ _draw(n) {
1395
+ var l, g;
1396
+ const r = this.getScene().getEngine(), { width: s, height: a } = r;
1397
+ this._initialCacheCanvas(), (l = this._cacheCanvas) == null || l.clear();
1398
+ const o = (g = this._cacheCanvas) == null ? void 0 : g.getContext();
1399
+ o != null && (o.save(), Un.drawWith(o, {
1304
1400
  left: 0,
1305
1401
  top: 0,
1306
- width: engineWidth,
1307
- height: engineHeight,
1402
+ width: s,
1403
+ height: a,
1308
1404
  fill: "rgba(0, 0, 0, 0.5)"
1309
- }), cacheCtx.setTransform(ctx.getTransform()), this._clipForApplyObject(cacheCtx), this._applyCache(ctx), cacheCtx.restore());
1405
+ }), o.setTransform(n.getTransform()), this._clipForApplyObject(o), this._applyCache(n), o.restore());
1310
1406
  }
1311
- _clipForApplyObject(cacheCtx) {
1312
- let objectType = 0;
1313
- if (this._prstGeom != null && (objectType = 1), cacheCtx.globalCompositeOperation = "destination-out", cacheCtx.beginPath(), objectType === 0) {
1314
- const m = this.transform.getMatrix();
1315
- cacheCtx.transform(m[0], m[1], m[2], m[3], m[4], m[5]), cacheCtx.rect(0, 0, this.width, this.height), cacheCtx.fill();
1407
+ _clipForApplyObject(n) {
1408
+ let e = 0;
1409
+ if (this._prstGeom != null && (e = 1), n.globalCompositeOperation = "destination-out", n.beginPath(), e === 0) {
1410
+ const r = this.transform.getMatrix();
1411
+ n.transform(r[0], r[1], r[2], r[3], r[4], r[5]), n.rect(0, 0, this.width, this.height), n.fill();
1316
1412
  }
1317
1413
  }
1318
1414
  _applyProps() {
1319
1415
  if (this._applyTransform == null)
1320
1416
  return;
1321
- let cropLeft = 0, cropTop = 0, cropRight = 0, cropBottom = 0;
1322
- const { left: applyLeft = 0, top: applyTop = 0, width: applyWidth = 0, height: applyHeight = 0, angle } = this._applyTransform;
1417
+ let n = 0, e = 0, r = 0, s = 0;
1418
+ const { left: a = 0, top: o = 0, width: l = 0, height: g = 0, angle: u } = this._applyTransform;
1323
1419
  if (this._srcRect != null) {
1324
- const { left: left2 = 0, top: top2 = 0, right = 0, bottom = 0 } = this._srcRect;
1325
- cropLeft = left2, cropTop = top2, cropRight = right, cropBottom = bottom;
1420
+ const { left: f = 0, top: v = 0, right: w = 0, bottom: p = 0 } = this._srcRect;
1421
+ n = f, e = v, r = w, s = p;
1326
1422
  }
1327
- const left = applyLeft + cropLeft, top = applyTop + cropTop;
1423
+ const d = a + n, h = o + e;
1328
1424
  this.transformByState({
1329
- left,
1330
- top,
1331
- width: applyLeft + applyWidth - cropRight - left,
1332
- height: applyTop + applyHeight - cropBottom - top,
1333
- angle
1425
+ left: d,
1426
+ top: h,
1427
+ width: a + l - r - d,
1428
+ height: o + g - s - h,
1429
+ angle: u
1334
1430
  });
1335
1431
  }
1336
- _applyCache(ctx) {
1337
- if (!ctx || this._cacheCanvas == null)
1432
+ _applyCache(n) {
1433
+ if (!n || this._cacheCanvas == null)
1338
1434
  return;
1339
- const cacheCtx = this._cacheCanvas.getContext();
1340
- cacheCtx.save(), ctx.save(), ctx.setTransform(1, 0, 0, 1, 0, 0), cacheCtx.setTransform(1, 0, 0, 1, 0, 0), ctx.drawImage(this._cacheCanvas.getCanvasEle(), 0, 0), ctx.restore(), cacheCtx.restore();
1435
+ const e = this._cacheCanvas.getContext();
1436
+ e.save(), n.save(), n.setTransform(1, 0, 0, 1, 0, 0), e.setTransform(1, 0, 0, 1, 0, 0), n.drawImage(this._cacheCanvas.getCanvasEle(), 0, 0), n.restore(), e.restore();
1341
1437
  }
1342
1438
  _initialCacheCanvas() {
1343
1439
  if (this._cacheCanvas != null)
1344
1440
  return;
1345
- const scene = this.getScene();
1346
- if (scene == null) return;
1347
- this._cacheCanvas = new Canvas();
1348
- const engine = scene.getEngine();
1349
- this._cacheCanvas.setSize(engine.width, engine.height), engine.onTransformChange$.subscribeEvent(() => {
1350
- var _a7;
1351
- (_a7 = this._cacheCanvas) == null || _a7.setSize(engine.width, engine.height), this.makeDirty(!0);
1441
+ const n = this.getScene();
1442
+ if (n == null) return;
1443
+ this._cacheCanvas = new Hn();
1444
+ const e = n.getEngine();
1445
+ this._cacheCanvas.setSize(e.width, e.height), e.onTransformChange$.subscribeEvent(() => {
1446
+ var r;
1447
+ (r = this._cacheCanvas) == null || r.setSize(e.width, e.height), this.makeDirty(!0);
1352
1448
  });
1353
1449
  }
1354
- };
1355
- __name(_ImageCropperObject, "ImageCropperObject");
1356
- let ImageCropperObject = _ImageCropperObject;
1357
- var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1358
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1359
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1360
- return kind && result && __defProp$2(target, key, result), result;
1361
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a4;
1362
- let ImageCropperController = (_a4 = class extends Disposable {
1363
- constructor(_commandService, _drawingManagerService, _renderManagerService, _univerInstanceService, _messageService, _localeService) {
1450
+ }
1451
+ var rr = Object.defineProperty, ir = Object.getOwnPropertyDescriptor, ar = (i, t, n, e) => {
1452
+ for (var r = e > 1 ? void 0 : e ? ir(t, n) : t, s = i.length - 1, a; s >= 0; s--)
1453
+ (a = i[s]) && (r = (e ? a(t, n, r) : a(r)) || r);
1454
+ return e && r && rr(t, n, r), r;
1455
+ }, ge = (i, t) => (n, e) => t(n, e, i);
1456
+ let Te = class extends He {
1457
+ constructor(t, n, e, r, s, a) {
1364
1458
  super();
1365
- __publicField(this, "_sceneListenerOnImageMap", /* @__PURE__ */ new WeakSet());
1366
- this._commandService = _commandService, this._drawingManagerService = _drawingManagerService, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._messageService = _messageService, this._localeService = _localeService, this._init();
1459
+ Q(this, "_sceneListenerOnImageMap", /* @__PURE__ */ new WeakSet());
1460
+ this._commandService = t, this._drawingManagerService = n, this._renderManagerService = e, this._univerInstanceService = r, this._messageService = s, this._localeService = a, this._init();
1367
1461
  }
1368
1462
  _init() {
1369
1463
  this._initOpenCrop(), this._initCloseCrop(), this._initAutoCrop();
1370
1464
  }
1371
1465
  _initAutoCrop() {
1372
1466
  this.disposeWithMe(
1373
- this._commandService.onCommandExecuted((command) => {
1374
- if (command.id !== AutoImageCropOperation.id)
1467
+ this._commandService.onCommandExecuted((t) => {
1468
+ if (t.id !== Ne.id)
1375
1469
  return;
1376
- const params = command.params;
1377
- if (params == null)
1470
+ const n = t.params;
1471
+ if (n == null)
1378
1472
  return;
1379
- const { cropType } = params, drawingParams = this._drawingManagerService.getFocusDrawings();
1380
- if (drawingParams.length !== 1)
1473
+ const { cropType: e } = n, r = this._drawingManagerService.getFocusDrawings();
1474
+ if (r.length !== 1)
1381
1475
  return;
1382
- const drawingParam = drawingParams[0], { unitId, subUnitId, drawingId } = drawingParam, renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
1383
- if (scene == null)
1476
+ const s = r[0], { unitId: a, subUnitId: o, drawingId: l } = s, g = this._renderManagerService.getRenderById(a), u = g == null ? void 0 : g.scene;
1477
+ if (u == null)
1384
1478
  return !0;
1385
- this._searchCropObject(scene) != null && this._commandService.syncExecuteCommand(CloseImageCropOperation.id, { isAuto: !0 });
1386
- const imageShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), imageShape = scene.getObject(imageShapeKey);
1387
- if (!(imageShape instanceof Image)) {
1479
+ this._searchCropObject(u) != null && this._commandService.syncExecuteCommand(le.id, { isAuto: !0 });
1480
+ const h = G({ unitId: a, subUnitId: o, drawingId: l }), f = u.getObject(h);
1481
+ if (!(f instanceof ke)) {
1388
1482
  this._messageService.show({
1389
- type: MessageType.Error,
1483
+ type: Je.Error,
1390
1484
  content: this._localeService.t("image-cropper.error")
1391
1485
  });
1392
1486
  return;
1393
1487
  }
1394
- imageShape != null && (this._updateCropperObject(cropType, imageShape), this._commandService.executeCommand(OpenImageCropOperation.id, { unitId, subUnitId, drawingId }));
1488
+ f != null && (this._updateCropperObject(e, f), this._commandService.executeCommand(ze.id, { unitId: a, subUnitId: o, drawingId: l }));
1395
1489
  })
1396
1490
  );
1397
1491
  }
1398
- _calculateSrcRectByRatio(left, top, width, height, numerator, denominator) {
1399
- const srcRatio = width / height, ratio = numerator / denominator;
1400
- let newWidth = width, newHeight = height;
1401
- srcRatio > ratio ? newWidth = height * ratio : newHeight = width / ratio;
1402
- const newLeft = (width - newWidth) / 2, newTop = (height - newHeight) / 2;
1492
+ _calculateSrcRectByRatio(t, n, e, r, s, a) {
1493
+ const o = e / r, l = s / a;
1494
+ let g = e, u = r;
1495
+ o > l ? g = r * l : u = e / l;
1496
+ const d = (e - g) / 2, h = (r - u) / 2;
1403
1497
  return {
1404
- left: precisionTo(newLeft, 1),
1405
- top: precisionTo(newTop, 1),
1406
- right: precisionTo(width - (newLeft + newWidth), 1),
1407
- bottom: precisionTo(height - (newTop + newHeight), 1)
1498
+ left: Ie(d, 1),
1499
+ top: Ie(h, 1),
1500
+ right: Ie(e - (d + g), 1),
1501
+ bottom: Ie(r - (h + u), 1)
1408
1502
  };
1409
1503
  }
1410
- _updateCropperObject(cropType, imageShape) {
1411
- const { left, top, width, height } = imageShape.calculateTransformWithSrcRect();
1412
- let newSrcRect;
1413
- switch (cropType) {
1414
- case CropType.R1_1:
1415
- newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 1, 1);
1504
+ _updateCropperObject(t, n) {
1505
+ const { left: e, top: r, width: s, height: a } = n.calculateTransformWithSrcRect();
1506
+ let o;
1507
+ switch (t) {
1508
+ case T.R1_1:
1509
+ o = this._calculateSrcRectByRatio(e, r, s, a, 1, 1);
1416
1510
  break;
1417
- case CropType.R16_9:
1418
- newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 16, 9);
1511
+ case T.R16_9:
1512
+ o = this._calculateSrcRectByRatio(e, r, s, a, 16, 9);
1419
1513
  break;
1420
- case CropType.R9_16:
1421
- newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 9, 16);
1514
+ case T.R9_16:
1515
+ o = this._calculateSrcRectByRatio(e, r, s, a, 9, 16);
1422
1516
  break;
1423
- case CropType.R5_4:
1424
- newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 5, 4);
1517
+ case T.R5_4:
1518
+ o = this._calculateSrcRectByRatio(e, r, s, a, 5, 4);
1425
1519
  break;
1426
- case CropType.R4_5:
1427
- newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 4, 5);
1520
+ case T.R4_5:
1521
+ o = this._calculateSrcRectByRatio(e, r, s, a, 4, 5);
1428
1522
  break;
1429
- case CropType.R4_3:
1430
- newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 4, 3);
1523
+ case T.R4_3:
1524
+ o = this._calculateSrcRectByRatio(e, r, s, a, 4, 3);
1431
1525
  break;
1432
- case CropType.R3_4:
1433
- newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 3, 4);
1526
+ case T.R3_4:
1527
+ o = this._calculateSrcRectByRatio(e, r, s, a, 3, 4);
1434
1528
  break;
1435
- case CropType.R3_2:
1436
- newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 3, 2);
1529
+ case T.R3_2:
1530
+ o = this._calculateSrcRectByRatio(e, r, s, a, 3, 2);
1437
1531
  break;
1438
- case CropType.R2_3:
1439
- newSrcRect = this._calculateSrcRectByRatio(left, top, width, height, 2, 3);
1532
+ case T.R2_3:
1533
+ o = this._calculateSrcRectByRatio(e, r, s, a, 2, 3);
1440
1534
  break;
1441
- case CropType.FREE:
1535
+ case T.FREE:
1442
1536
  }
1443
- if (newSrcRect == null)
1537
+ if (o == null)
1444
1538
  return;
1445
- imageShape.setSrcRect(newSrcRect);
1446
- const { left: newLeft = 0, top: newTop = 0, bottom: newBottom = 0, right: newRight = 0 } = newSrcRect;
1447
- imageShape.transformByStateCloseCropper({
1448
- left: left + newLeft,
1449
- top: top + newTop,
1450
- width: width - newRight - newLeft,
1451
- height: height - newBottom - newTop
1539
+ n.setSrcRect(o);
1540
+ const { left: l = 0, top: g = 0, bottom: u = 0, right: d = 0 } = o;
1541
+ n.transformByStateCloseCropper({
1542
+ left: e + l,
1543
+ top: r + g,
1544
+ width: s - d - l,
1545
+ height: a - u - g
1452
1546
  });
1453
1547
  }
1454
1548
  _initOpenCrop() {
1455
1549
  this.disposeWithMe(
1456
- this._commandService.onCommandExecuted((command) => {
1457
- if (command.id !== OpenImageCropOperation.id)
1550
+ this._commandService.onCommandExecuted((t) => {
1551
+ if (t.id !== ze.id)
1458
1552
  return;
1459
- const params = command.params;
1460
- if (params == null)
1553
+ const n = t.params;
1554
+ if (n == null)
1461
1555
  return;
1462
- const { unitId, subUnitId, drawingId } = params, renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
1463
- if (scene == null)
1556
+ const { unitId: e, subUnitId: r, drawingId: s } = n, a = this._renderManagerService.getRenderById(e), o = a == null ? void 0 : a.scene;
1557
+ if (o == null)
1464
1558
  return !0;
1465
- if (this._sceneListenerOnImageMap.has(scene) || (this._addListenerOnImage(scene), this._sceneListenerOnImageMap.add(scene)), this._drawingManagerService.getDrawingByParam({ unitId, subUnitId, drawingId }) == null)
1559
+ if (this._sceneListenerOnImageMap.has(o) || (this._addListenerOnImage(o), this._sceneListenerOnImageMap.add(o)), this._drawingManagerService.getDrawingByParam({ unitId: e, subUnitId: r, drawingId: s }) == null)
1466
1560
  return;
1467
- const imageShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), imageShape = scene.getObject(imageShapeKey);
1468
- if (imageShape == null)
1561
+ const g = G({ unitId: e, subUnitId: r, drawingId: s }), u = o.getObject(g);
1562
+ if (u == null)
1469
1563
  return;
1470
- if (!(imageShape instanceof Image)) {
1564
+ if (!(u instanceof ke)) {
1471
1565
  this._messageService.show({
1472
- type: MessageType.Error,
1566
+ type: Je.Error,
1473
1567
  content: this._localeService.t("image-cropper.error")
1474
1568
  });
1475
1569
  return;
1476
1570
  }
1477
- const transformer = scene.getTransformer();
1478
- transformer == null || transformer.clearControls();
1479
- const imageCropperObject = new ImageCropperObject(`${imageShapeKey}-crop`, {
1480
- srcRect: imageShape.srcRect,
1481
- prstGeom: imageShape.prstGeom,
1482
- applyTransform: imageShape.calculateTransformWithSrcRect()
1571
+ const d = o.getTransformer();
1572
+ d == null || d.clearControls();
1573
+ const h = new Re(`${g}-crop`, {
1574
+ srcRect: u.srcRect,
1575
+ prstGeom: u.prstGeom,
1576
+ applyTransform: u.calculateTransformWithSrcRect()
1483
1577
  });
1484
- scene.addObject(imageCropperObject, imageShape.getLayerIndex() + 1).attachTransformerTo(imageCropperObject), transformer == null || transformer.createControlForCopper(imageCropperObject), this._addHoverForImageCopper(imageCropperObject), imageShape.openRenderByCropper(), transformer == null || transformer.refreshControls(), imageCropperObject.makeDirty(!0), this._drawingManagerService.focusDrawing([{ unitId, subUnitId, drawingId }]);
1578
+ o.addObject(h, u.getLayerIndex() + 1).attachTransformerTo(h), d == null || d.createControlForCopper(h), this._addHoverForImageCopper(h), u.openRenderByCropper(), d == null || d.refreshControls(), h.makeDirty(!0), this._drawingManagerService.focusDrawing([{ unitId: e, subUnitId: r, drawingId: s }]);
1485
1579
  })
1486
1580
  );
1487
1581
  }
1488
- _searchCropObject(scene) {
1489
- const objects = scene.getAllObjectsByOrder();
1490
- for (const object of objects)
1491
- if (object instanceof ImageCropperObject)
1492
- return object;
1582
+ _searchCropObject(t) {
1583
+ const n = t.getAllObjectsByOrder();
1584
+ for (const e of n)
1585
+ if (e instanceof Re)
1586
+ return e;
1493
1587
  }
1494
1588
  _initCloseCrop() {
1495
1589
  this.disposeWithMe(
1496
- this._commandService.onCommandExecuted((command) => {
1497
- if (command.id !== CloseImageCropOperation.id)
1590
+ this._commandService.onCommandExecuted((n) => {
1591
+ if (n.id !== le.id)
1498
1592
  return;
1499
- const currentUnit = this._univerInstanceService.getFocusedUnit();
1500
- if (currentUnit == null)
1593
+ const e = this._univerInstanceService.getFocusedUnit();
1594
+ if (e == null)
1501
1595
  return;
1502
- const unitId = currentUnit.getUnitId(), renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
1503
- if (scene == null)
1596
+ const r = e.getUnitId(), s = this._renderManagerService.getRenderById(r), a = s == null ? void 0 : s.scene;
1597
+ if (a == null)
1504
1598
  return !0;
1505
- const imageCropperObject = this._searchCropObject(scene);
1506
- if (imageCropperObject == null)
1599
+ const o = this._searchCropObject(a);
1600
+ if (o == null)
1507
1601
  return;
1508
- const imageShape = this._getApplyObjectByCropObject(imageCropperObject);
1509
- if (imageShape == null)
1602
+ const l = this._getApplyObjectByCropObject(o);
1603
+ if (l == null)
1510
1604
  return;
1511
- const transformer = scene.getTransformerByCreate();
1512
- transformer.detachFrom(imageCropperObject), transformer.clearCopperControl();
1513
- const srcRect = this._getSrcRectByTransformState(imageShape, imageCropperObject), drawingParam = this._drawingManagerService.getDrawingOKey(imageShape.oKey);
1514
- if (drawingParam != null) {
1515
- const { left, top, height, width } = imageCropperObject;
1605
+ const g = a.getTransformerByCreate();
1606
+ g.detachFrom(o), g.clearCopperControl();
1607
+ const u = this._getSrcRectByTransformState(l, o), d = this._drawingManagerService.getDrawingOKey(l.oKey);
1608
+ if (d != null) {
1609
+ const { left: h, top: f, height: v, width: w } = o;
1516
1610
  this._drawingManagerService.featurePluginUpdateNotification([{
1517
- ...drawingParam,
1611
+ ...d,
1518
1612
  transform: {
1519
- ...drawingParam.transform,
1520
- left,
1521
- top,
1522
- height,
1523
- width
1613
+ ...d.transform,
1614
+ left: h,
1615
+ top: f,
1616
+ height: v,
1617
+ width: w
1524
1618
  },
1525
- srcRect: srcRect.srcRectAngle
1619
+ srcRect: u.srcRectAngle
1526
1620
  }]);
1527
1621
  }
1528
- imageShape.setSrcRect({ ...srcRect.srcRectAngle }), imageShape.closeRenderByCropper(), imageShape.makeDirty(!0), imageCropperObject == null || imageCropperObject.dispose();
1622
+ l.setSrcRect({ ...u.srcRectAngle }), l.closeRenderByCropper(), l.makeDirty(!0), o == null || o.dispose();
1529
1623
  })
1530
1624
  );
1531
- const sheetUnit = this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(
1532
- filter((workbook) => !!workbook),
1533
- switchMap((workbook) => workbook.activeSheet$)
1625
+ const t = this._univerInstanceService.getCurrentTypeOfUnit$(Me.UNIVER_SHEET).pipe(
1626
+ Yn((n) => !!n),
1627
+ Zn((n) => n.activeSheet$)
1534
1628
  );
1535
- this.disposeWithMe(sheetUnit.subscribe(() => {
1536
- this._commandService.syncExecuteCommand(CloseImageCropOperation.id);
1629
+ this.disposeWithMe(t.subscribe(() => {
1630
+ this._commandService.syncExecuteCommand(le.id);
1537
1631
  }));
1538
1632
  }
1539
- _getApplyObjectByCropObject(cropObject) {
1540
- const cropOKey = cropObject.oKey, applyOKey = cropOKey.slice(0, cropOKey.length - 5), scene = cropObject.getScene();
1541
- if (!scene) return null;
1542
- const applyObject = scene.getObject(applyOKey);
1543
- return applyObject == null ? null : applyObject;
1633
+ _getApplyObjectByCropObject(t) {
1634
+ const n = t.oKey, e = n.slice(0, n.length - 5), r = t.getScene();
1635
+ if (!r) return null;
1636
+ const s = r.getObject(e);
1637
+ return s == null ? null : s;
1544
1638
  }
1545
- _addListenerOnImage(scene) {
1546
- const transformer = scene.getTransformerByCreate();
1547
- let startTransform = null;
1639
+ _addListenerOnImage(t) {
1640
+ const n = t.getTransformerByCreate();
1641
+ let e = null;
1548
1642
  this.disposeWithMe(
1549
- transformer.changeStart$.subscribe((state) => {
1550
- const { objects } = state, cropObject = objects.values().next().value;
1551
- if (cropObject == null || !(cropObject instanceof ImageCropperObject))
1643
+ n.changeStart$.subscribe((r) => {
1644
+ const { objects: s } = r, a = s.values().next().value;
1645
+ if (a == null || !(a instanceof Re))
1552
1646
  return;
1553
- const { left, top, height, width, angle } = cropObject;
1554
- startTransform = { left, top, height, width, angle }, transformer.clearCopperControl();
1647
+ const { left: o, top: l, height: g, width: u, angle: d } = a;
1648
+ e = { left: o, top: l, height: g, width: u, angle: d }, n.clearCopperControl();
1555
1649
  })
1556
1650
  ), this.disposeWithMe(
1557
- transformer.changeEnd$.subscribe((state) => {
1558
- const { objects } = state, cropObject = objects.values().next().value;
1559
- if (cropObject == null || !(cropObject instanceof ImageCropperObject))
1651
+ n.changeEnd$.subscribe((r) => {
1652
+ const { objects: s } = r, a = s.values().next().value;
1653
+ if (a == null || !(a instanceof Re))
1560
1654
  return;
1561
- const { left, top, height, width, angle } = cropObject;
1562
- if (!checkIfMove({ left, top, height, width, angle }, startTransform))
1655
+ const { left: o, top: l, height: g, width: u, angle: d } = a;
1656
+ if (!sn({ left: o, top: l, height: g, width: u, angle: d }, e))
1563
1657
  return;
1564
- const applyObject = this._getApplyObjectByCropObject(cropObject);
1565
- if (applyObject == null)
1658
+ const h = this._getApplyObjectByCropObject(a);
1659
+ if (h == null)
1566
1660
  return;
1567
- const srcRect = this._getSrcRectByTransformState(applyObject, cropObject);
1568
- cropObject.refreshSrcRect(srcRect.srcRect, applyObject.getState()), transformer.createControlForCopper(cropObject);
1661
+ const f = this._getSrcRectByTransformState(h, a);
1662
+ a.refreshSrcRect(f.srcRect, h.getState()), n.createControlForCopper(a);
1569
1663
  })
1570
- ), this._endCropListener(scene);
1664
+ ), this._endCropListener(t);
1571
1665
  }
1572
- _addHoverForImageCopper(o) {
1666
+ _addHoverForImageCopper(t) {
1573
1667
  this.disposeWithMe(
1574
- o.onPointerEnter$.subscribeEvent(() => {
1575
- o.cursor = CURSOR_TYPE.MOVE;
1668
+ t.onPointerEnter$.subscribeEvent(() => {
1669
+ t.cursor = xe.MOVE;
1576
1670
  })
1577
1671
  ), this.disposeWithMe(
1578
- o.onPointerLeave$.subscribeEvent(() => {
1579
- o.cursor = CURSOR_TYPE.DEFAULT;
1672
+ t.onPointerLeave$.subscribeEvent(() => {
1673
+ t.cursor = xe.DEFAULT;
1580
1674
  })
1581
1675
  );
1582
1676
  }
1583
- _endCropListener(scene) {
1584
- const transformer = scene.getTransformerByCreate();
1677
+ _endCropListener(t) {
1678
+ const n = t.getTransformerByCreate();
1585
1679
  this.disposeWithMe(
1586
- transformer.clearControl$.subscribe((changeSelf) => {
1587
- changeSelf === !0 && this._commandService.syncExecuteCommand(CloseImageCropOperation.id);
1680
+ n.clearControl$.subscribe((e) => {
1681
+ e === !0 && this._commandService.syncExecuteCommand(le.id);
1588
1682
  })
1589
1683
  );
1590
1684
  }
1591
- _getSrcRectByTransformState(applyObject, imageCropperObject) {
1592
- const { left, top, height, width, strokeWidth, angle: copperAngle } = imageCropperObject, { left: applyLeft, top: applyTop, width: applyWidth, height: applyHeight, angle: applyAngle, strokeWidth: applyStrokeWidth } = applyObject, newLeft = left - applyLeft, newTop = top - applyTop, srcRect = {
1593
- left: newLeft,
1594
- top: newTop,
1595
- right: applyWidth - newLeft - width,
1596
- bottom: applyHeight - newTop - height
1597
- }, srcRectAngle = { ...srcRect };
1598
- if (applyAngle !== 0) {
1599
- const cx = left + width / 2, cy = top + height / 2, centerPoint = new Vector2(cx, cy), newCx = applyWidth / 2 + applyLeft, newCy = applyHeight / 2 + applyTop, newCenterPoint = new Vector2(newCx, newCy), vertexPoint = new Vector2(applyLeft, applyTop);
1600
- vertexPoint.rotateByPoint(degToRad(applyAngle), newCenterPoint);
1601
- const applyFinalPoint = vertexPoint.clone();
1602
- applyFinalPoint.rotateByPoint(degToRad(-applyAngle), centerPoint);
1603
- const newAngleLeft = left - applyFinalPoint.x, newAngleTop = top - applyFinalPoint.y;
1604
- srcRectAngle.left = newAngleLeft, srcRectAngle.top = newAngleTop, srcRectAngle.right = applyWidth - newAngleLeft - width, srcRectAngle.bottom = applyHeight - newAngleTop - height;
1685
+ _getSrcRectByTransformState(t, n) {
1686
+ const { left: e, top: r, height: s, width: a, strokeWidth: o, angle: l } = n, { left: g, top: u, width: d, height: h, angle: f, strokeWidth: v } = t, w = e - g, p = r - u, S = {
1687
+ left: w,
1688
+ top: p,
1689
+ right: d - w - a,
1690
+ bottom: h - p - s
1691
+ }, _ = { ...S };
1692
+ if (f !== 0) {
1693
+ const R = e + a / 2, b = r + s / 2, N = new We(R, b), I = d / 2 + g, y = h / 2 + u, P = new We(I, y), M = new We(g, u);
1694
+ M.rotateByPoint(qe(f), P);
1695
+ const D = M.clone();
1696
+ D.rotateByPoint(qe(-f), N);
1697
+ const B = e - D.x, E = r - D.y;
1698
+ _.left = B, _.top = E, _.right = d - B - a, _.bottom = h - E - s;
1605
1699
  }
1606
1700
  return {
1607
- srcRect,
1608
- srcRectAngle
1701
+ srcRect: S,
1702
+ srcRectAngle: _
1609
1703
  };
1610
1704
  }
1611
- }, __name(_a4, "ImageCropperController"), _a4);
1612
- ImageCropperController = __decorateClass$2([
1613
- __decorateParam$2(0, ICommandService),
1614
- __decorateParam$2(1, IDrawingManagerService),
1615
- __decorateParam$2(2, IRenderManagerService),
1616
- __decorateParam$2(3, IUniverInstanceService),
1617
- __decorateParam$2(4, IMessageService),
1618
- __decorateParam$2(5, Inject(LocaleService))
1619
- ], ImageCropperController);
1620
- var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1621
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1622
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1623
- return kind && result && __defProp$1(target, key, result), result;
1624
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
1625
- const IMAGE_VIEWER_DROPDOWN_PADDING = 50;
1626
- var _a5;
1627
- let ImageUpdateController = (_a5 = class extends Disposable {
1628
- constructor(_commandService, _renderManagerService, _drawingManagerService, _dialogService, _imageIoService, _currentUniverService, _drawingRenderService) {
1629
- super(), this._commandService = _commandService, this._renderManagerService = _renderManagerService, this._drawingManagerService = _drawingManagerService, this._dialogService = _dialogService, this._imageIoService = _imageIoService, this._currentUniverService = _currentUniverService, this._drawingRenderService = _drawingRenderService, this._initialize();
1705
+ };
1706
+ Te = ar([
1707
+ ge(0, me),
1708
+ ge(1, ne),
1709
+ ge(2, ue),
1710
+ ge(3, Ke),
1711
+ ge(4, Fn),
1712
+ ge(5, Ue(te))
1713
+ ], Te);
1714
+ var sr = Object.defineProperty, or = Object.getOwnPropertyDescriptor, cr = (i, t, n, e) => {
1715
+ for (var r = e > 1 ? void 0 : e ? or(t, n) : t, s = i.length - 1, a; s >= 0; s--)
1716
+ (a = i[s]) && (r = (e ? a(t, n, r) : a(r)) || r);
1717
+ return e && r && sr(t, n, r), r;
1718
+ }, oe = (i, t) => (n, e) => t(n, e, i);
1719
+ const nn = 50;
1720
+ let Be = class extends He {
1721
+ constructor(i, t, n, e, r, s, a) {
1722
+ super(), this._commandService = i, this._renderManagerService = t, this._drawingManagerService = n, this._dialogService = e, this._imageIoService = r, this._currentUniverService = s, this._drawingRenderService = a, this._initialize();
1630
1723
  }
1631
1724
  dispose() {
1632
1725
  super.dispose();
@@ -1636,212 +1729,212 @@ let ImageUpdateController = (_a5 = class extends Disposable {
1636
1729
  }
1637
1730
  _commandExecutedListener() {
1638
1731
  this.disposeWithMe(
1639
- this._commandService.onCommandExecuted((command) => {
1640
- if (command.id === ImageResetSizeOperation.id) {
1641
- const params = command.params;
1642
- if (params == null)
1732
+ this._commandService.onCommandExecuted((i) => {
1733
+ if (i.id === In.id) {
1734
+ const t = i.params;
1735
+ if (t == null)
1643
1736
  return;
1644
- this._resetImageSize(params);
1737
+ this._resetImageSize(t);
1645
1738
  }
1646
1739
  })
1647
1740
  );
1648
1741
  }
1649
- _getSceneAndTransformerByDrawingSearch(unitId) {
1650
- if (unitId == null)
1742
+ _getSceneAndTransformerByDrawingSearch(i) {
1743
+ if (i == null)
1651
1744
  return;
1652
- const renderObject = this._renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
1653
- if (scene == null)
1745
+ const t = this._renderManagerService.getRenderById(i), n = t == null ? void 0 : t.scene;
1746
+ if (n == null)
1654
1747
  return null;
1655
- const transformer = scene.getTransformerByCreate();
1656
- return { scene, transformer };
1657
- }
1658
- _resetImageSize(params) {
1659
- const updateParams = [], sceneList = [];
1660
- params.forEach((param) => {
1661
- const { unitId, subUnitId, drawingId } = param, renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
1662
- if (renderObject == null)
1748
+ const e = n.getTransformerByCreate();
1749
+ return { scene: n, transformer: e };
1750
+ }
1751
+ _resetImageSize(i) {
1752
+ const t = [], n = [];
1753
+ i.forEach((e) => {
1754
+ const { unitId: r, subUnitId: s, drawingId: a } = e, o = this._getSceneAndTransformerByDrawingSearch(r);
1755
+ if (o == null)
1663
1756
  return;
1664
- const { scene } = renderObject, imageShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), imageShape = scene.getObject(imageShapeKey);
1665
- if (imageShape == null)
1757
+ const { scene: l } = o, g = G({ unitId: r, subUnitId: s, drawingId: a }), u = l.getObject(g);
1758
+ if (u == null)
1666
1759
  return !0;
1667
- const imageData = this._drawingManagerService.getDrawingByParam(param);
1668
- if (imageData == null)
1760
+ const d = this._drawingManagerService.getDrawingByParam(e);
1761
+ if (d == null)
1669
1762
  return !0;
1670
- if (imageData.drawingType !== DrawingTypeEnum.DRAWING_IMAGE)
1763
+ if (d.drawingType !== ee.DRAWING_IMAGE)
1671
1764
  return;
1672
- imageShape.resetSize();
1673
- const { width, height } = imageShape.getNativeSize();
1674
- sceneList.includes(scene) === !1 && sceneList.push(scene), updateParams.push({
1675
- ...imageData,
1765
+ u.resetSize();
1766
+ const { width: h, height: f } = u.getNativeSize();
1767
+ n.includes(l) === !1 && n.push(l), t.push({
1768
+ ...d,
1676
1769
  transform: {
1677
- ...imageData.transform,
1678
- height,
1679
- width,
1770
+ ...d.transform,
1771
+ height: f,
1772
+ width: h,
1680
1773
  angle: 0
1681
1774
  },
1682
1775
  srcRect: null,
1683
1776
  prstGeom: null
1684
1777
  });
1685
- }), this._drawingManagerService.featurePluginUpdateNotification(updateParams), sceneList.forEach((scene) => {
1686
- scene.getTransformerByCreate().refreshControls().changeNotification();
1687
- }), this._drawingManagerService.focusDrawing(params);
1778
+ }), this._drawingManagerService.featurePluginUpdateNotification(t), n.forEach((e) => {
1779
+ e.getTransformerByCreate().refreshControls().changeNotification();
1780
+ }), this._drawingManagerService.focusDrawing(i);
1688
1781
  }
1689
1782
  _drawingAddListener() {
1690
1783
  this.disposeWithMe(
1691
- this._drawingManagerService.add$.subscribe((params) => {
1692
- this._insertImages(params);
1784
+ this._drawingManagerService.add$.subscribe((i) => {
1785
+ this._insertImages(i);
1693
1786
  })
1694
1787
  );
1695
1788
  }
1696
- _insertImages(params) {
1697
- params.forEach(async (param) => {
1698
- var _a7;
1699
- const { unitId, subUnitId, drawingId } = param, renderObject = this._getSceneAndTransformerByDrawingSearch(unitId), currentSubUnitId = (_a7 = getCurrentUnitInfo(this._currentUniverService, unitId)) == null ? void 0 : _a7.subUnitId;
1700
- if (renderObject == null || currentSubUnitId !== subUnitId)
1789
+ _insertImages(i) {
1790
+ i.forEach(async (t) => {
1791
+ var g;
1792
+ const { unitId: n, subUnitId: e, drawingId: r } = t, s = this._getSceneAndTransformerByDrawingSearch(n), a = (g = ln(this._currentUniverService, n)) == null ? void 0 : g.subUnitId;
1793
+ if (s == null || a !== e)
1701
1794
  return;
1702
- const imageParam = this._drawingManagerService.getDrawingByParam(param);
1703
- if (imageParam == null)
1795
+ const o = this._drawingManagerService.getDrawingByParam(t);
1796
+ if (o == null)
1704
1797
  return;
1705
- const images = await this._drawingRenderService.renderImages(imageParam, renderObject.scene);
1706
- if (!(images == null || images.length === 0))
1707
- for (const image of images)
1708
- this._addHoverForImage(image), this._addDialogForImage(image);
1798
+ const l = await this._drawingRenderService.renderImages(o, s.scene);
1799
+ if (!(l == null || l.length === 0))
1800
+ for (const u of l)
1801
+ this._addHoverForImage(u), this._addDialogForImage(u);
1709
1802
  });
1710
1803
  }
1711
1804
  _imageUpdateListener() {
1712
1805
  this.disposeWithMe(
1713
- this._drawingManagerService.update$.subscribe((params) => {
1714
- params.forEach((param) => {
1715
- const { unitId, subUnitId, drawingId } = param, drawingParam = this._drawingManagerService.getDrawingByParam(param);
1716
- if (drawingParam == null)
1806
+ this._drawingManagerService.update$.subscribe((i) => {
1807
+ i.forEach((t) => {
1808
+ const { unitId: n, subUnitId: e, drawingId: r } = t, s = this._drawingManagerService.getDrawingByParam(t);
1809
+ if (s == null)
1717
1810
  return;
1718
- const { transform, drawingType, srcRect, prstGeom, source, imageSourceType } = drawingParam;
1719
- if (drawingType !== DrawingTypeEnum.DRAWING_IMAGE)
1811
+ const { transform: a, drawingType: o, srcRect: l, prstGeom: g, source: u, imageSourceType: d } = s;
1812
+ if (o !== ee.DRAWING_IMAGE)
1720
1813
  return;
1721
- const renderObject = this._getSceneAndTransformerByDrawingSearch(unitId);
1722
- if (renderObject == null)
1814
+ const h = this._getSceneAndTransformerByDrawingSearch(n);
1815
+ if (h == null)
1723
1816
  return;
1724
- const { scene, transformer } = renderObject;
1725
- if (transform == null)
1817
+ const { scene: f, transformer: v } = h;
1818
+ if (a == null)
1726
1819
  return !0;
1727
- const drawingShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }), imageShape = scene.getObject(drawingShapeKey);
1728
- if (imageShape == null)
1820
+ const w = G({ unitId: n, subUnitId: e, drawingId: r }), p = f.getObject(w);
1821
+ if (p == null)
1729
1822
  return !0;
1730
- imageShape.setSrcRect(srcRect), imageShape.setPrstGeom(prstGeom);
1823
+ p.setSrcRect(l), p.setPrstGeom(g);
1731
1824
  });
1732
1825
  })
1733
1826
  );
1734
1827
  }
1735
- _addHoverForImage(o) {
1828
+ _addHoverForImage(i) {
1736
1829
  this.disposeWithMe(
1737
- toDisposable(
1738
- o.onPointerEnter$.subscribeEvent(() => {
1739
- o.cursor = CURSOR_TYPE.GRAB;
1830
+ we(
1831
+ i.onPointerEnter$.subscribeEvent(() => {
1832
+ i.cursor = xe.GRAB;
1740
1833
  })
1741
1834
  )
1742
1835
  ), this.disposeWithMe(
1743
- toDisposable(
1744
- o.onPointerLeave$.subscribeEvent(() => {
1745
- o.cursor = CURSOR_TYPE.DEFAULT;
1836
+ we(
1837
+ i.onPointerLeave$.subscribeEvent(() => {
1838
+ i.cursor = xe.DEFAULT;
1746
1839
  })
1747
1840
  )
1748
1841
  );
1749
1842
  }
1750
- _addDialogForImage(o) {
1843
+ _addDialogForImage(i) {
1751
1844
  this.disposeWithMe(
1752
- toDisposable(
1753
- o.onDblclick$.subscribeEvent(() => {
1754
- var _a7;
1755
- const dialogId = `${o.oKey}-viewer-dialog`, nativeSize = o.getNativeSize(), screenWidth = window.innerWidth - IMAGE_VIEWER_DROPDOWN_PADDING, screenHeight = window.innerHeight - IMAGE_VIEWER_DROPDOWN_PADDING, adjustSize = this._adjustImageSize(nativeSize.width, nativeSize.height, screenWidth, screenHeight), dialog = this._dialogService.open({
1756
- width: adjustSize.width,
1757
- id: dialogId,
1845
+ we(
1846
+ i.onDblclick$.subscribeEvent(() => {
1847
+ var o;
1848
+ const t = `${i.oKey}-viewer-dialog`, n = i.getNativeSize(), e = window.innerWidth - nn, r = window.innerHeight - nn, s = this._adjustImageSize(n.width, n.height, e, r), a = this._dialogService.open({
1849
+ width: s.width,
1850
+ id: t,
1758
1851
  style: { margin: "0", top: "50%", left: "50%", transform: "translate(-50%, -50%)" },
1759
1852
  children: {
1760
1853
  label: {
1761
- name: COMPONENT_IMAGE_VIEWER,
1854
+ name: Pn,
1762
1855
  props: {
1763
- src: (_a7 = o.getNative()) == null ? void 0 : _a7.src,
1764
- width: adjustSize.width,
1765
- height: adjustSize.height
1856
+ src: (o = i.getNative()) == null ? void 0 : o.src,
1857
+ width: s.width,
1858
+ height: s.height
1766
1859
  }
1767
1860
  }
1768
1861
  },
1769
1862
  destroyOnClose: !0,
1770
1863
  draggable: !1,
1771
- onClose: /* @__PURE__ */ __name(() => {
1772
- this._dialogService.close(dialogId), dialog.dispose();
1773
- }, "onClose")
1864
+ onClose: () => {
1865
+ this._dialogService.close(t), a.dispose();
1866
+ }
1774
1867
  });
1775
1868
  })
1776
1869
  )
1777
1870
  );
1778
1871
  }
1779
- _adjustImageSize(nativeWidth, nativeHeight, screenWidth, screenHeight) {
1780
- if (nativeWidth <= screenWidth && nativeHeight <= screenHeight)
1872
+ _adjustImageSize(i, t, n, e) {
1873
+ if (i <= n && t <= e)
1781
1874
  return {
1782
- width: nativeWidth,
1783
- height: nativeHeight
1875
+ width: i,
1876
+ height: t
1784
1877
  };
1785
- const widthRatio = screenWidth / nativeWidth, heightRatio = screenHeight / nativeHeight, scale = Math.min(widthRatio, heightRatio);
1878
+ const r = n / i, s = e / t, a = Math.min(r, s);
1786
1879
  return {
1787
- width: Math.floor(nativeWidth * scale),
1788
- height: Math.floor(nativeHeight * scale)
1880
+ width: Math.floor(i * a),
1881
+ height: Math.floor(t * a)
1789
1882
  };
1790
1883
  }
1791
- }, __name(_a5, "ImageUpdateController"), _a5);
1792
- ImageUpdateController = __decorateClass$1([
1793
- __decorateParam$1(0, ICommandService),
1794
- __decorateParam$1(1, IRenderManagerService),
1795
- __decorateParam$1(2, IDrawingManagerService),
1796
- __decorateParam$1(3, IDialogService),
1797
- __decorateParam$1(4, IImageIoService),
1798
- __decorateParam$1(5, IUniverInstanceService),
1799
- __decorateParam$1(6, Inject(DrawingRenderService))
1800
- ], ImageUpdateController);
1801
- var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1802
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1803
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1804
- return kind && result && __defProp2(target, key, result), result;
1805
- }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
1806
- const PLUGIN_NAME = "UNIVER_DRAWING_UI_PLUGIN";
1807
- var _a6;
1808
- let UniverDrawingUIPlugin = (_a6 = class extends Plugin {
1809
- constructor(_config = defaultPluginConfig, _injector, _configService) {
1810
- super(), this._config = _config, this._injector = _injector, this._configService = _configService;
1811
- const { menu, ...rest } = this._config;
1812
- menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
1884
+ };
1885
+ Be = cr([
1886
+ oe(0, me),
1887
+ oe(1, ue),
1888
+ oe(2, ne),
1889
+ oe(3, Kn),
1890
+ oe(4, an),
1891
+ oe(5, Ke),
1892
+ oe(6, Ue(Oe))
1893
+ ], Be);
1894
+ var lr = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, gr = (i, t, n, e) => {
1895
+ for (var r = e > 1 ? void 0 : e ? mr(t, n) : t, s = i.length - 1, a; s >= 0; s--)
1896
+ (a = i[s]) && (r = (e ? a(t, n, r) : a(r)) || r);
1897
+ return e && r && lr(t, n, r), r;
1898
+ }, tn = (i, t) => (n, e) => t(n, e, i);
1899
+ const ur = "UNIVER_DRAWING_UI_PLUGIN";
1900
+ var $e;
1901
+ let rn = ($e = class extends Vn {
1902
+ constructor(i = Zt, t, n) {
1903
+ super(), this._config = i, this._injector = t, this._configService = n;
1904
+ const { menu: e, ...r } = this._config;
1905
+ e && this._configService.setConfig("menu", e, { merge: !0 }), this._configService.setConfig(Yt, r);
1813
1906
  }
1814
1907
  onStarting() {
1815
1908
  this._initDependencies();
1816
1909
  }
1817
1910
  onRendered() {
1818
- this._injector.get(DrawingUpdateController), this._injector.get(DrawingUIController), this._injector.get(ImageCropperController), this._injector.get(ImageUpdateController);
1911
+ this._injector.get(Ee), this._injector.get(De), this._injector.get(Te), this._injector.get(Be);
1819
1912
  }
1820
1913
  _initDependencies() {
1821
1914
  [
1822
- [DrawingRenderService],
1823
- [DrawingUpdateController],
1824
- [DrawingUIController],
1825
- [ImageCropperController],
1826
- [ImageUpdateController]
1827
- ].forEach((dependency) => this._injector.add(dependency));
1828
- }
1829
- }, __name(_a6, "UniverDrawingUIPlugin"), __publicField(_a6, "pluginName", PLUGIN_NAME), _a6);
1830
- UniverDrawingUIPlugin = __decorateClass([
1831
- __decorateParam(1, Inject(Injector)),
1832
- __decorateParam(2, IConfigService)
1833
- ], UniverDrawingUIPlugin);
1915
+ [Oe],
1916
+ [Ee],
1917
+ [De],
1918
+ [Te],
1919
+ [Be]
1920
+ ].forEach((t) => this._injector.add(t));
1921
+ }
1922
+ }, Q($e, "pluginName", ur), $e);
1923
+ rn = gr([
1924
+ tn(1, Ue(Ln)),
1925
+ tn(2, Gn)
1926
+ ], rn);
1834
1927
  export {
1835
- AutoImageCropOperation,
1836
- COMPONENT_IMAGE_POPUP_MENU,
1837
- CloseImageCropOperation,
1838
- DrawingCommonPanel,
1839
- DrawingRenderService,
1840
- ImageCropperObject,
1841
- ImagePopupMenu,
1842
- ImageResetSizeOperation,
1843
- OpenImageCropOperation,
1844
- SetDrawingAlignOperation,
1845
- UniverDrawingUIPlugin,
1846
- getUpdateParams
1928
+ Ne as AutoImageCropOperation,
1929
+ Kt as COMPONENT_IMAGE_POPUP_MENU,
1930
+ le as CloseImageCropOperation,
1931
+ Sr as DrawingCommonPanel,
1932
+ Oe as DrawingRenderService,
1933
+ Re as ImageCropperObject,
1934
+ Ft as ImagePopupMenu,
1935
+ In as ImageResetSizeOperation,
1936
+ ze as OpenImageCropOperation,
1937
+ Ye as SetDrawingAlignOperation,
1938
+ rn as UniverDrawingUIPlugin,
1939
+ Ae as getUpdateParams
1847
1940
  };