@univerjs/slides-ui 0.17.0 → 0.18.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.
Files changed (93) hide show
  1. package/lib/cjs/index.js +36 -2
  2. package/lib/cjs/locale/ca-ES.js +1 -1
  3. package/lib/cjs/locale/en-US.js +1 -1
  4. package/lib/cjs/locale/es-ES.js +1 -1
  5. package/lib/cjs/locale/fa-IR.js +1 -1
  6. package/lib/cjs/locale/fr-FR.js +1 -1
  7. package/lib/cjs/locale/ja-JP.js +1 -1
  8. package/lib/cjs/locale/ko-KR.js +1 -1
  9. package/lib/cjs/locale/ru-RU.js +1 -1
  10. package/lib/cjs/locale/sk-SK.js +1 -1
  11. package/lib/cjs/locale/vi-VN.js +1 -1
  12. package/lib/cjs/locale/zh-CN.js +1 -1
  13. package/lib/cjs/locale/zh-TW.js +1 -1
  14. package/lib/es/index.js +36 -2611
  15. package/lib/es/locale/ca-ES.js +1 -40
  16. package/lib/es/locale/en-US.js +1 -40
  17. package/lib/es/locale/es-ES.js +1 -40
  18. package/lib/es/locale/fa-IR.js +1 -40
  19. package/lib/es/locale/fr-FR.js +1 -40
  20. package/lib/es/locale/ja-JP.js +1 -40
  21. package/lib/es/locale/ko-KR.js +1 -40
  22. package/lib/es/locale/ru-RU.js +1 -40
  23. package/lib/es/locale/sk-SK.js +1 -40
  24. package/lib/es/locale/vi-VN.js +1 -40
  25. package/lib/es/locale/zh-CN.js +1 -40
  26. package/lib/es/locale/zh-TW.js +1 -40
  27. package/lib/index.css +282 -1
  28. package/lib/index.js +36 -2611
  29. package/lib/locale/ca-ES.js +1 -40
  30. package/lib/locale/en-US.js +1 -40
  31. package/lib/locale/es-ES.js +1 -40
  32. package/lib/locale/fa-IR.js +1 -40
  33. package/lib/locale/fr-FR.js +1 -40
  34. package/lib/locale/ja-JP.js +1 -40
  35. package/lib/locale/ko-KR.js +1 -40
  36. package/lib/locale/ru-RU.js +1 -40
  37. package/lib/locale/sk-SK.js +1 -40
  38. package/lib/locale/vi-VN.js +1 -40
  39. package/lib/locale/zh-CN.js +1 -40
  40. package/lib/locale/zh-TW.js +1 -40
  41. package/lib/types/commands/operations/activate.operation.d.ts +16 -1
  42. package/lib/types/commands/operations/append-slide.operation.d.ts +16 -1
  43. package/lib/types/commands/operations/delete-element.operation.d.ts +16 -1
  44. package/lib/types/commands/operations/insert-image.operation.d.ts +16 -1
  45. package/lib/types/commands/operations/insert-shape.operation.d.ts +16 -1
  46. package/lib/types/commands/operations/insert-text.operation.d.ts +16 -1
  47. package/lib/types/commands/operations/set-thumb.operation.d.ts +16 -1
  48. package/lib/types/commands/operations/text-edit.operation.d.ts +16 -1
  49. package/lib/types/commands/operations/update-element.operation.d.ts +16 -1
  50. package/lib/types/components/image-popup-menu/ImagePopupMenu.d.ts +16 -1
  51. package/lib/types/config/config.d.ts +17 -2
  52. package/lib/types/controllers/canvas-view.d.ts +23 -6
  53. package/lib/types/controllers/shortcuts/editor.shortcuts.d.ts +17 -1
  54. package/lib/types/controllers/shortcuts/utils.d.ts +16 -1
  55. package/lib/types/controllers/slide-editing.render-controller.d.ts +21 -3
  56. package/lib/types/controllers/slide-editor-bridge.render-controller.d.ts +19 -3
  57. package/lib/types/controllers/slide-ui.controller.d.ts +15 -0
  58. package/lib/types/controllers/slide.render-controller.d.ts +21 -4
  59. package/lib/types/locale/ca-ES.d.ts +16 -1
  60. package/lib/types/locale/es-ES.d.ts +16 -1
  61. package/lib/types/locale/fa-IR.d.ts +16 -1
  62. package/lib/types/locale/fr-FR.d.ts +16 -1
  63. package/lib/types/locale/ja-JP.d.ts +16 -1
  64. package/lib/types/locale/ko-KR.d.ts +16 -1
  65. package/lib/types/locale/ru-RU.d.ts +16 -1
  66. package/lib/types/locale/sk-SK.d.ts +16 -1
  67. package/lib/types/locale/vi-VN.d.ts +16 -1
  68. package/lib/types/locale/zh-CN.d.ts +16 -1
  69. package/lib/types/locale/zh-TW.d.ts +16 -1
  70. package/lib/types/menu/image.menu.d.ts +17 -2
  71. package/lib/types/menu/popup-menu.controller.d.ts +15 -0
  72. package/lib/types/menu/schema.d.ts +16 -1
  73. package/lib/types/menu/shape.menu.d.ts +17 -2
  74. package/lib/types/menu/text.menu.d.ts +17 -2
  75. package/lib/types/plugin.d.ts +16 -1
  76. package/lib/types/services/slide-editor-bridge.service.d.ts +23 -5
  77. package/lib/types/services/slide-editor-manager.service.d.ts +18 -3
  78. package/lib/types/services/slide-popup-manager.service.d.ts +21 -3
  79. package/lib/types/services/slide-render.service.d.ts +15 -0
  80. package/lib/umd/index.js +36 -2
  81. package/lib/umd/locale/ca-ES.js +1 -1
  82. package/lib/umd/locale/en-US.js +1 -1
  83. package/lib/umd/locale/es-ES.js +1 -1
  84. package/lib/umd/locale/fa-IR.js +1 -1
  85. package/lib/umd/locale/fr-FR.js +1 -1
  86. package/lib/umd/locale/ja-JP.js +1 -1
  87. package/lib/umd/locale/ko-KR.js +1 -1
  88. package/lib/umd/locale/ru-RU.js +1 -1
  89. package/lib/umd/locale/sk-SK.js +1 -1
  90. package/lib/umd/locale/vi-VN.js +1 -1
  91. package/lib/umd/locale/zh-CN.js +1 -1
  92. package/lib/umd/locale/zh-TW.js +1 -1
  93. package/package.json +14 -13
package/lib/index.js CHANGED
@@ -1,2611 +1,36 @@
1
- var an = Object.defineProperty;
2
- var ln = (i, e, t) => e in i ? an(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var S = (i, e, t) => ln(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { Inject as z, Injector as ke, IUniverInstanceService as w, RxDisposable as fe, UniverInstanceType as E, debounce as dn, getColorStyle as un, CommandType as D, PageElementType as De, merge as It, LocaleService as J, ICommandService as N, generateRandomId as ze, BasicShapes as bt, createInternalEditorID as hn, createIdentifier as Et, IContextService as _e, DocumentFlavor as gn, FOCUSING_UNIVER_EDITOR as Rt, EDITOR_ACTIVATED as Re, FORMULA_EDITOR_ACTIVATED as vn, Disposable as Ne, FOCUSING_EDITOR_STANDALONE as xt, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as Ot, DocumentDataModel as pn, HorizontalAlign as wt, VerticalAlign as xe, IUndoRedoService as fn, DisposableCollection as Ke, WrapStrategy as tt, FOCUSING_EDITOR_BUT_HIDDEN as _n, DEFAULT_EMPTY_DOCUMENT_VALUE as mn, Direction as V, toDisposable as yt, FOCUSING_COMMON_DRAWINGS as Cn, Plugin as Sn, mergeOverrideWithDependencies as nt, IConfigService as In } from "@univerjs/core";
5
- import { IRenderManagerService as K, Viewport as it, ScrollBar as Pt, getCurrentTypeOfRenderer as Le, Slide as bn, Rect as Tt, Scene as En, ObjectType as ue, FIX_ONE_PIXEL_BLUR_OFFSET as ie, DeviceInputEventType as Y, convertTextRotation as rt, fixLineWidthByScale as st, pxToNum as Rn } from "@univerjs/engine-render";
6
- import { ObjectProvider as xn, SLIDE_KEY as re } from "@univerjs/slides";
7
- import { DRAWING_IMAGE_ALLOW_IMAGE_LIST as On, IImageIoService as wn, getImageSize as yn } from "@univerjs/drawing";
8
- import { ILocalFileService as Pn, useDependency as O, ISidebarService as Mt, getMenuHiddenObservable as se, MenuItemType as oe, RibbonStartGroup as Tn, useObservable as Mn, DISABLE_AUTO_FOCUS_KEY as ot, KeyCode as y, MetaKeys as Dn, IMenuManagerService as Nn, ComponentManager as Un, IUIPartsService as Vn, IShortcutService as jn, BuiltInUIPart as ct, connectInjector as at, ILayoutService as An, ICanvasPopupService as Ln } from "@univerjs/ui";
9
- import { jsxs as R, jsx as g } from "react/jsx-runtime";
10
- import { Button as Se, clsx as k, Dropdown as Dt, ColorPicker as $n, borderTopClassName as Nt, InputNumber as de, borderClassName as ge, scrollbarClassName as Bn } from "@univerjs/design";
11
- import { useRef as Ut, createElement as H, forwardRef as Z, useState as $, useEffect as ve, useMemo as Hn, createRef as Fn, useCallback as lt } from "react";
12
- import { IEditorService as Ze, DeleteLeftCommand as Wn, DocSelectionRenderService as dt, VIEWPORT_KEY as ut, DOCS_COMPONENT_MAIN_LAYER_INDEX as kn, MoveSelectionOperation as zn, MoveCursorOperation as Kn, DOCS_VIEW_KEY as Zn } from "@univerjs/docs-ui";
13
- import { BehaviorSubject as q, Subject as Vt, filter as Gn, takeUntil as ht } from "rxjs";
14
- import { DocSelectionManagerService as Xn, DocSkeletonManagerService as gt, RichTextEditingMutation as Yn } from "@univerjs/docs";
15
- var qn = Object.getOwnPropertyDescriptor, Jn = (i, e, t, n) => {
16
- for (var r = n > 1 ? void 0 : n ? qn(e, t) : e, s = i.length - 1, o; s >= 0; s--)
17
- (o = i[s]) && (r = o(r) || r);
18
- return r;
19
- }, Ue = (i, e) => (t, n) => e(t, n, i);
20
- let pe = class extends fe {
21
- constructor(e, t, n, r) {
22
- super();
23
- S(this, "_objectProvider", null);
24
- S(this, "_refreshThumb", dn(() => {
25
- this.createThumbs();
26
- }, 300));
27
- this._renderContext = e, this._injector = t, this._univerInstanceService = n, this._renderManagerService = r, this._objectProvider = this._injector.createInstance(xn), this._addNewRender();
28
- }
29
- _addNewRender() {
30
- const { unitId: e, engine: t, scene: n } = this._renderContext, r = this._getCurrUnitModel();
31
- if (!r) return;
32
- const s = t.onTransformChange$.subscribeEvent(() => {
33
- this._scrollToCenter(), s == null || s.unsubscribe();
34
- });
35
- t.onTransformChange$.subscribeEvent(() => {
36
- setTimeout(() => {
37
- this.createThumbs();
38
- }, 300);
39
- });
40
- const o = new it(re.VIEW, n, {
41
- left: 0,
42
- top: 0,
43
- bottom: 0,
44
- right: 0,
45
- explicitViewportWidthSet: !1,
46
- explicitViewportHeightSet: !1,
47
- isWheelPreventDefaultX: !0
48
- });
49
- n.attachControl(), n.onMouseWheel$.subscribeEvent((a, u) => {
50
- const l = a;
51
- if (l.ctrlKey) {
52
- const d = Math.abs(l.deltaX);
53
- let v = d < 40 ? 0.2 : d < 80 ? 0.4 : 0.2;
54
- v *= l.deltaY > 0 ? -1 : 1, n.scaleX < 1 && (v /= 2), n.scaleX + v > 4 ? n.scale(4, 4) : n.scaleX + v < 0.1 ? n.scale(0.1, 0.1) : (l.deltaY > 0, l.preventDefault());
55
- } else
56
- o.onMouseWheel(l, u);
57
- }), n.onFileLoaded$.subscribeEvent(() => {
58
- this._refreshThumb();
59
- }), Pt.attachTo(o);
60
- const c = this._createSlide(n);
61
- this._renderContext.mainComponent = c, this._createSlidePages(r, c), this.createThumbs(), t.runRenderLoop(() => {
62
- n.render();
63
- });
64
- }
65
- _scrollToCenter() {
66
- var a;
67
- const e = (a = this._currentRender()) == null ? void 0 : a.scene, t = e == null ? void 0 : e.getViewport(re.VIEW), n = this._getCenterPositionViewPort(e);
68
- if (!t || !n) return;
69
- const { left: r, top: s } = n, { x: o, y: c } = t.transViewportScroll2ScrollValue(r, s);
70
- t.scrollToBarPos({
71
- x: o,
72
- y: c
73
- });
74
- }
75
- _currentRender() {
76
- return Le(E.UNIVER_SLIDE, this._univerInstanceService, this._renderManagerService);
77
- }
78
- /**
79
- * @param mainScene
80
- */
81
- _createSlide(e) {
82
- const t = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE), { width: n, height: r } = e, s = t.getPageSize(), { width: o = 100, height: c = 100 } = s, a = new bn(re.COMPONENT, {
83
- left: (n - o) / 2,
84
- top: (r - c) / 2,
85
- width: o,
86
- height: c,
87
- zIndex: 10
88
- });
89
- return a.enableSelectedClipElement(), e.addObject(a), a;
90
- }
91
- _addBackgroundRect(e, t) {
92
- const r = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE).getPageSize(), { width: s = 0, height: o = 0 } = r, c = new Tt("canvas", {
93
- left: 0,
94
- top: 0,
95
- width: s,
96
- height: o,
97
- strokeWidth: 1,
98
- stroke: "rgba(198,198,198,1)",
99
- fill: un(t) || "rgba(255,255,255,1)",
100
- zIndex: 0,
101
- evented: !1
102
- });
103
- e.addObject(c, 0);
104
- }
105
- _getCenterPositionViewPort(e) {
106
- if (!e) return { left: 0, top: 0 };
107
- const { width: t, height: n } = e, r = e.getEngine(), s = (r == null ? void 0 : r.width) || 0, o = (r == null ? void 0 : r.height) || 0;
108
- return {
109
- left: (t - s) / 2,
110
- top: (n - o) / 2
111
- };
112
- }
113
- _thumbSceneRender(e, t) {
114
- const n = this._renderManagerService.getRenderById(e);
115
- if (n == null)
116
- return;
117
- const { engine: r } = n;
118
- if (r == null)
119
- return;
120
- const { width: s, height: o } = t, { width: c = s, height: a = o } = r, u = r.getCanvas().getContext();
121
- t.renderToThumb(u, e, c / s, a / o);
122
- }
123
- /**
124
- * CreateScene by pages, and activate first one.
125
- * @param slideDataModel
126
- * @param slide
127
- */
128
- _createSlidePages(e, t) {
129
- const n = e.getPages(), r = e.getPageOrder();
130
- if (!(!n || !r) && r.length !== 0) {
131
- for (let s = 0, o = r.length; s < o; s++) {
132
- const c = r[s];
133
- this.createPageScene(c, n[c]), this._createThumb(c);
134
- }
135
- t.activeFirstPage();
136
- }
137
- }
138
- _createThumb(e) {
139
- this._renderManagerService.createRender(e);
140
- }
141
- /**
142
- * SlideDataModel is UnitModel
143
- */
144
- _getCurrUnitModel() {
145
- return this._renderContext.unit;
146
- }
147
- activePage(e) {
148
- let t = e;
149
- const n = this._getCurrUnitModel();
150
- let r;
151
- if (t)
152
- r = n.getPage(t);
153
- else {
154
- const a = n.getPages(), u = n.getPageOrder();
155
- if (u == null || a == null)
156
- return;
157
- r = a[u[0]], t = r.id;
158
- }
159
- const s = this._currentRender();
160
- if (r == null || s == null || s.mainComponent == null)
161
- return;
162
- const { id: o } = r, c = s.mainComponent;
163
- if (n.setActivePage(r), c != null && c.hasPage(o)) {
164
- c.changePage(o);
165
- return;
166
- }
167
- this.createPageScene(o, r);
168
- }
169
- createThumbs() {
170
- const t = this._getCurrUnitModel().getPageOrder(), n = this._currentRender();
171
- if (!(!t || !n) && t.length !== 0)
172
- for (let r = 0, s = t.length; r < s; r++) {
173
- const o = t[r];
174
- this._thumbSceneRender(o, n.mainComponent);
175
- }
176
- }
177
- /**
178
- * Create scene by page and set to _sceneMap.
179
- * @param pageId
180
- * @param page
181
- */
182
- createPageScene(e, t) {
183
- const n = this._renderContext;
184
- if (!n || !this._objectProvider)
185
- return;
186
- const { scene: r, mainComponent: s } = n, o = s, { width: c, height: a } = o, u = new En(e, o, {
187
- width: c,
188
- height: a
189
- });
190
- new it(`PageViewer_${e}`, u, {
191
- left: 0,
192
- top: 0,
193
- bottom: 0,
194
- right: 0,
195
- explicitViewportWidthSet: !1,
196
- explicitViewportHeightSet: !1
197
- }).closeClip();
198
- const { pageElements: d, pageBackgroundFill: v } = t, _ = this._objectProvider.convertToRenderObjects(d, r);
199
- if (!_ || !o) return;
200
- this._addBackgroundRect(u, v), u.addObjects(_), u.initTransformer(), _.forEach((p) => {
201
- u.attachTransformerTo(p);
202
- });
203
- const f = u.getTransformer();
204
- return f == null || f.changeEnd$.subscribe(() => {
205
- this._thumbSceneRender(e, o);
206
- }), f == null || f.clearControl$.subscribe(() => {
207
- this._thumbSceneRender(e, o);
208
- }), o.addPageScene(u), u;
209
- }
210
- /**
211
- * Get pageScene from Slide.
212
- * @param pageId
213
- * @returns {Scene, Engine, UnitModel} scene & engine & unit from renderContext
214
- */
215
- getPageRenderUnit(e) {
216
- const n = this._renderContext.mainComponent.getSubScenes().get(e), { engine: r, unit: s } = this._renderContext;
217
- return {
218
- scene: n,
219
- engine: r,
220
- unit: s
221
- };
222
- }
223
- createObjectToPage(e, t) {
224
- const { scene: n } = this.getPageRenderUnit(t);
225
- if (!n || !this._objectProvider)
226
- return;
227
- const r = this._objectProvider.convertToRenderObject(e, n);
228
- if (r)
229
- return n.addObject(r), n.attachTransformerTo(r), n.getLayer().makeDirty(), r;
230
- }
231
- setObjectActiveByPage(e, t) {
232
- const { scene: n } = this.getPageRenderUnit(t);
233
- if (!n) return;
234
- const r = n.getTransformer();
235
- r == null || r.activeAnObject(e);
236
- }
237
- removeObjectById(e, t) {
238
- const { scene: n } = this.getPageRenderUnit(t);
239
- if (!n) return;
240
- n.removeObject(e);
241
- const r = n.getTransformer();
242
- r == null || r.clearControls();
243
- }
244
- appendPage() {
245
- const e = this._getCurrUnitModel(), t = e.getBlankPage(), n = this._currentRender();
246
- if (t == null || n == null || n.mainComponent == null)
247
- return;
248
- const { id: r } = t, s = n.mainComponent, o = this.createPageScene(r, t);
249
- s && o && s.addPageScene(o), e.appendPage(t), e.setActivePage(t);
250
- }
251
- };
252
- pe = Jn([
253
- Ue(1, z(ke)),
254
- Ue(2, w),
255
- Ue(3, K)
256
- ], pe);
257
- var Qn = Object.getOwnPropertyDescriptor, ei = (i, e, t, n) => {
258
- for (var r = n > 1 ? void 0 : n ? Qn(e, t) : e, s = i.length - 1, o; s >= 0; s--)
259
- (o = i[s]) && (r = o(r) || r);
260
- return r;
261
- }, ti = (i, e) => (t, n) => e(t, n, i);
262
- let P = class extends fe {
263
- constructor(i) {
264
- super(), this._renderManagerService = i;
265
- }
266
- _getSlideRenderControllerFromRenderUnit(i) {
267
- return this._renderManagerService.getRenderById(i).with(pe);
268
- }
269
- createThumbs(i) {
270
- this._getSlideRenderControllerFromRenderUnit(i).createThumbs();
271
- }
272
- activePage(i, e) {
273
- this._getSlideRenderControllerFromRenderUnit(e).activePage(i);
274
- }
275
- getRenderUnitByPageId(i, e) {
276
- return this._getSlideRenderControllerFromRenderUnit(e).getPageRenderUnit(i);
277
- }
278
- createObjectToPage(i, e, t) {
279
- return this._getSlideRenderControllerFromRenderUnit(t).createObjectToPage(i, e);
280
- }
281
- setObjectActiveByPage(i, e, t) {
282
- return this._getSlideRenderControllerFromRenderUnit(t).setObjectActiveByPage(i, e);
283
- }
284
- removeObjectById(i, e, t) {
285
- this._getSlideRenderControllerFromRenderUnit(t).removeObjectById(i, e);
286
- }
287
- /**
288
- * append blank page
289
- */
290
- appendPage(i) {
291
- this._getSlideRenderControllerFromRenderUnit(i).appendPage();
292
- }
293
- };
294
- P = ei([
295
- ti(0, K)
296
- ], P);
297
- const jt = {
298
- id: "slide.operation.activate-slide",
299
- type: D.OPERATION,
300
- handler: (i, e) => {
301
- var u, l;
302
- const t = e.unitId, n = i.get(P), s = i.get(w).getUnit(t), o = (u = s == null ? void 0 : s.getActivePage()) == null ? void 0 : u.id;
303
- if (!o) return !1;
304
- const c = n.getRenderUnitByPageId(o, t);
305
- if (!c) return !1;
306
- const a = (l = c.scene) == null ? void 0 : l.getTransformer();
307
- return a && a.clearControls(), n.activePage(e.id, t), !0;
308
- }
309
- }, At = {
310
- id: "slide.operation.append-slide",
311
- type: D.OPERATION,
312
- handler: (i, e) => {
313
- const t = e.unitId;
314
- return i.get(w).getUnit(t) ? (i.get(P).appendPage(t), !0) : !1;
315
- }
316
- }, Lt = {
317
- id: "slide.operation.delete-element",
318
- type: D.OPERATION,
319
- handler: (i, e) => {
320
- if (!(e != null && e.id)) return !1;
321
- const t = e.unitId, r = i.get(w).getUnit(t);
322
- if (!r) return !1;
323
- const s = r.getActivePage();
324
- return delete s.pageElements[e.id], r.updatePage(s.id, s), i.get(P).removeObjectById(e.id, s.id, t), !0;
325
- }
326
- }, Ge = {
327
- id: "slide.command.insert-float-image",
328
- type: D.COMMAND,
329
- handler: async (i, e) => {
330
- var U;
331
- const t = i.get(w), n = (U = t.getCurrentUnitForType(E.UNIVER_SLIDE)) == null ? void 0 : U.getUnitId();
332
- if (!n) return !1;
333
- const s = await i.get(Pn).openFile({
334
- multiple: !0,
335
- accept: On.map((x) => `.${x.replace("image/", "")}`).join(",")
336
- });
337
- if (s.length !== 1) return !1;
338
- const c = await i.get(wn).saveImage(s[0]);
339
- if (!c) return !1;
340
- const { imageId: a, imageSourceType: u, source: l, base64Cache: d } = c, { width: v, height: _, image: f } = await yn(d || ""), p = t.getUnit(n);
341
- if (!p) return !1;
342
- const h = p.getActivePage(), m = Object.values(h.pageElements), I = m != null && m.length ? Math.max(...m.map((x) => x.zIndex)) : 20, b = {
343
- id: a,
344
- zIndex: I + 1,
345
- left: 0,
346
- top: 0,
347
- width: v,
348
- height: _,
349
- title: "",
350
- description: "",
351
- type: De.IMAGE,
352
- image: {
353
- imageProperties: {
354
- contentUrl: d,
355
- imageSourceType: u,
356
- source: l,
357
- base64Cache: d,
358
- image: f
359
- }
360
- }
361
- };
362
- h.pageElements[a] = b, p.updatePage(h.id, h);
363
- const T = i.get(P), M = T.createObjectToPage(b, h.id, n);
364
- return M && T.setObjectActiveByPage(M, h.id, n), !0;
365
- }
366
- };
367
- function F({ ref: i, ...e }) {
368
- const { icon: t, id: n, className: r, extend: s, ...o } = e, c = `univerjs-icon univerjs-icon-${n} ${r || ""}`.trim(), a = Ut(`_${ri()}`);
369
- return $t(t, `${n}`, {
370
- defIds: t.defIds,
371
- idSuffix: a.current
372
- }, {
373
- ref: i,
374
- className: c,
375
- ...o
376
- }, s);
377
- }
378
- function $t(i, e, t, n, r) {
379
- return H(i.tag, {
380
- key: e,
381
- ...ni(i, t, r),
382
- ...n
383
- }, (ii(i, t).children || []).map((s, o) => $t(s, `${e}-${i.tag}-${o}`, t, void 0, r)));
384
- }
385
- function ni(i, e, t) {
386
- const n = { ...i.attrs };
387
- t != null && t.colorChannel1 && n.fill === "colorChannel1" && (n.fill = t.colorChannel1), i.tag === "mask" && n.id && (n.id = n.id + e.idSuffix), Object.entries(n).forEach(([s, o]) => {
388
- s === "mask" && typeof o == "string" && (n[s] = o.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
389
- });
390
- const { defIds: r } = e;
391
- return !r || r.length === 0 || (i.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(([s, o]) => {
392
- typeof o == "string" && (n[s] = o.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
393
- })), n;
394
- }
395
- function ii(i, e) {
396
- var n;
397
- const { defIds: t } = e;
398
- return !t || t.length === 0 ? i : i.tag === "defs" && ((n = i.children) != null && n.length) ? {
399
- ...i,
400
- children: i.children.map((r) => typeof r.attrs.id == "string" && t && t.includes(r.attrs.id) ? {
401
- ...r,
402
- attrs: {
403
- ...r.attrs,
404
- id: r.attrs.id + e.idSuffix
405
- }
406
- } : r)
407
- } : i;
408
- }
409
- function ri() {
410
- return Math.random().toString(36).substring(2, 8);
411
- }
412
- F.displayName = "UniverIcon";
413
- const si = {
414
- tag: "svg",
415
- attrs: {
416
- xmlns: "http://www.w3.org/2000/svg",
417
- fill: "none",
418
- viewBox: "0 0 17 16",
419
- width: "1em",
420
- height: "1em"
421
- },
422
- children: [
423
- {
424
- tag: "path",
425
- attrs: {
426
- fill: "currentColor",
427
- d: "M14.0045 4.4334C14.8881 4.4334 15.6045 3.71705 15.6045 2.8334C15.6045 1.94974 14.8881 1.2334 14.0045 1.2334H3.70449C2.82084 1.2334 2.10449 1.94974 2.10449 2.8334C2.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.8334C3.30449 2.61248 3.48358 2.4334 3.70449 2.4334H14.0045C14.2254 2.4334 14.4045 2.61249 14.4045 2.8334Z",
428
- fillRule: "evenodd",
429
- clipRule: "evenodd"
430
- }
431
- },
432
- {
433
- tag: "path",
434
- attrs: {
435
- fill: "currentColor",
436
- d: "M14.1544 8.5999C15.038 8.5999 15.7544 7.88356 15.7544 6.9999C15.7544 6.11625 15.038 5.3999 14.1544 5.3999H3.85439C2.97074 5.3999 2.25439 6.11625 2.25439 6.9999C2.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.9999C3.45439 6.77899 3.63348 6.5999 3.85439 6.5999H14.1544C14.3753 6.5999 14.5544 6.77899 14.5544 6.9999Z",
437
- fillRule: "evenodd",
438
- clipRule: "evenodd"
439
- }
440
- },
441
- {
442
- tag: "path",
443
- attrs: {
444
- fill: "currentColor",
445
- d: "M8.57975 14.5902L6.58023 12.5907C6.34591 12.3564 6.34591 11.9765 6.58023 11.7421C6.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.56641C9.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.7421C11.6631 11.9765 11.6631 12.3564 11.4288 12.5907L9.42923 14.5902"
446
- }
447
- },
448
- {
449
- tag: "path",
450
- attrs: {
451
- fill: "currentColor",
452
- d: "M8.57975 14.5902C8.58121 14.5917 8.58268 14.5931 8.58416 14.5946C8.64077 14.6502 8.70566 14.6923 8.77482 14.7209C8.84557 14.7502 8.92314 14.7664 9.00449 14.7664C9.08585 14.7664 9.16342 14.7502 9.23416 14.7209C9.30332 14.6923 9.36821 14.6502 9.42482 14.5946"
453
- }
454
- }
455
- ]
456
- }, Bt = Z(function(e, t) {
457
- return H(F, Object.assign({}, e, {
458
- id: "bottom-icon",
459
- ref: t,
460
- icon: si
461
- }));
462
- });
463
- Bt.displayName = "BottomIcon";
464
- const oi = {
465
- tag: "svg",
466
- attrs: {
467
- xmlns: "http://www.w3.org/2000/svg",
468
- fill: "none",
469
- viewBox: "0 0 17 16",
470
- width: "1em",
471
- height: "1em"
472
- },
473
- children: [{
474
- tag: "g",
475
- attrs: { clipPath: "url(#graph-icon_clip0_1293_28)" },
476
- children: [{
477
- tag: "path",
478
- attrs: {
479
- fill: "currentColor",
480
- d: "M6.29541 11.1896C3.83208 10.7489 1.9624 8.59552 1.9624 6.00544C1.9624 3.09673 4.32036 0.73877 7.22907 0.73877C9.93483 0.73877 12.164 2.77918 12.4619 5.40527H13.5621C14.998 5.40527 16.1621 6.56933 16.1621 8.00527V12.6719C16.1621 14.1079 14.998 15.2719 13.5621 15.2719H8.89541C7.45947 15.2719 6.29541 14.1079 6.29541 12.6719V11.1896ZM3.1624 6.00544C3.1624 3.75947 4.98311 1.93877 7.22907 1.93877C9.27112 1.93877 10.9616 3.44388 11.2518 5.40527H8.89541C7.45947 5.40527 6.29541 6.56933 6.29541 8.00527V9.96442C4.49946 9.5425 3.1624 7.93012 3.1624 6.00544ZM7.49541 8.00527C7.49541 7.23207 8.12221 6.60527 8.89541 6.60527H13.5621C14.3353 6.60527 14.9621 7.23207 14.9621 8.00527V12.6719C14.9621 13.4451 14.3353 14.0719 13.5621 14.0719H8.89541C8.12221 14.0719 7.49541 13.4451 7.49541 12.6719V8.00527Z",
481
- fillRule: "evenodd",
482
- clipRule: "evenodd"
483
- }
484
- }]
485
- }, {
486
- tag: "defs",
487
- attrs: {},
488
- children: [{
489
- tag: "clipPath",
490
- attrs: { id: "graph-icon_clip0_1293_28" },
491
- children: [{
492
- tag: "path",
493
- attrs: {
494
- fill: "white",
495
- d: "M0 0H16V16H0z",
496
- transform: "translate(.9)"
497
- }
498
- }]
499
- }]
500
- }],
501
- defIds: ["graph-icon_clip0_1293_28"]
502
- }, Ht = Z(function(e, t) {
503
- return H(F, Object.assign({}, e, {
504
- id: "graph-icon",
505
- ref: t,
506
- icon: oi
507
- }));
508
- });
509
- Ht.displayName = "GraphIcon";
510
- const ci = {
511
- tag: "svg",
512
- attrs: {
513
- xmlns: "http://www.w3.org/2000/svg",
514
- fill: "none",
515
- viewBox: "0 0 16 16",
516
- width: "1em",
517
- height: "1em"
518
- },
519
- children: [{
520
- tag: "path",
521
- attrs: {
522
- fill: "currentColor",
523
- 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",
524
- fillRule: "evenodd",
525
- clipRule: "evenodd"
526
- }
527
- }]
528
- }, Xe = Z(function(e, t) {
529
- return H(F, Object.assign({}, e, {
530
- id: "more-down-icon",
531
- ref: t,
532
- icon: ci
533
- }));
534
- });
535
- Xe.displayName = "MoreDownIcon";
536
- const ai = {
537
- tag: "svg",
538
- attrs: {
539
- xmlns: "http://www.w3.org/2000/svg",
540
- fill: "none",
541
- viewBox: "0 0 16 16",
542
- width: "1em",
543
- height: "1em"
544
- },
545
- children: [{
546
- tag: "path",
547
- attrs: {
548
- fill: "currentColor",
549
- 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",
550
- fillRule: "evenodd",
551
- clipRule: "evenodd"
552
- }
553
- }, {
554
- tag: "path",
555
- attrs: {
556
- fill: "currentColor",
557
- 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"
558
- }
559
- }]
560
- }, Ft = Z(function(e, t) {
561
- return H(F, Object.assign({}, e, {
562
- id: "move-down-icon",
563
- ref: t,
564
- icon: ai
565
- }));
566
- });
567
- Ft.displayName = "MoveDownIcon";
568
- const li = {
569
- tag: "svg",
570
- attrs: {
571
- xmlns: "http://www.w3.org/2000/svg",
572
- fill: "none",
573
- viewBox: "0 0 16 16",
574
- width: "1em",
575
- height: "1em"
576
- },
577
- children: [{
578
- tag: "path",
579
- attrs: {
580
- fill: "currentColor",
581
- 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",
582
- fillRule: "evenodd",
583
- clipRule: "evenodd"
584
- }
585
- }, {
586
- tag: "path",
587
- attrs: {
588
- fill: "currentColor",
589
- 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"
590
- }
591
- }]
592
- }, Wt = Z(function(e, t) {
593
- return H(F, Object.assign({}, e, {
594
- id: "move-up-icon",
595
- ref: t,
596
- icon: li
597
- }));
598
- });
599
- Wt.displayName = "MoveUpIcon";
600
- const di = {
601
- tag: "svg",
602
- attrs: {
603
- xmlns: "http://www.w3.org/2000/svg",
604
- fill: "none",
605
- viewBox: "0 0 17 16",
606
- width: "1em",
607
- height: "1em"
608
- },
609
- children: [{
610
- tag: "g",
611
- attrs: {
612
- fill: "currentColor",
613
- clipPath: "url(#text-icon_clip0_1293_26)"
614
- },
615
- children: [{
616
- tag: "path",
617
- attrs: { d: "M2.22891 2.07227C1.89754 2.07227 1.62891 2.34089 1.62891 2.67227C1.62891 3.00364 1.89754 3.27227 2.22891 3.27227H6.29541V14.0056C6.29541 14.337 6.56404 14.6056 6.89541 14.6056C7.22678 14.6056 7.49541 14.337 7.49541 14.0056V3.27227H11.5622C11.8936 3.27227 12.1622 3.00364 12.1622 2.67227C12.1622 2.34089 11.8936 2.07227 11.5622 2.07227H2.22891Z" }
618
- }, {
619
- tag: "path",
620
- attrs: { d: "M10.2289 6.40552C9.89754 6.40552 9.62891 6.67415 9.62891 7.00552C9.62891 7.33689 9.89754 7.60552 10.2289 7.60552H12.2954V14.0055C12.2954 14.3369 12.564 14.6055 12.8954 14.6055C13.2268 14.6055 13.4954 14.3369 13.4954 14.0055V7.60552H15.5622C15.8936 7.60552 16.1622 7.33689 16.1622 7.00552C16.1622 6.67415 15.8936 6.40552 15.5622 6.40552H10.2289Z" }
621
- }]
622
- }, {
623
- tag: "defs",
624
- attrs: {},
625
- children: [{
626
- tag: "clipPath",
627
- attrs: { id: "text-icon_clip0_1293_26" },
628
- children: [{
629
- tag: "path",
630
- attrs: {
631
- fill: "white",
632
- d: "M0 0H16V16H0z",
633
- transform: "translate(.9)"
634
- }
635
- }]
636
- }]
637
- }],
638
- defIds: ["text-icon_clip0_1293_26"]
639
- }, kt = Z(function(e, t) {
640
- return H(F, Object.assign({}, e, {
641
- id: "text-icon",
642
- ref: t,
643
- icon: di
644
- }));
645
- });
646
- kt.displayName = "TextIcon";
647
- const ui = {
648
- tag: "svg",
649
- attrs: {
650
- xmlns: "http://www.w3.org/2000/svg",
651
- fill: "none",
652
- viewBox: "0 0 17 16",
653
- width: "1em",
654
- height: "1em"
655
- },
656
- children: [
657
- {
658
- tag: "path",
659
- attrs: {
660
- fill: "currentColor",
661
- 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"
662
- }
663
- },
664
- {
665
- tag: "path",
666
- attrs: {
667
- fill: "currentColor",
668
- 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 9C15.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 9C2.70439 9.22091 2.88348 9.4 3.1044 9.4H13.4044C13.6253 9.4 13.8044 9.22091 13.8044 9C13.8044 8.77909 13.6253 8.6 13.4044 8.6H3.10439Z",
669
- fillRule: "evenodd",
670
- clipRule: "evenodd"
671
- }
672
- },
673
- {
674
- tag: "path",
675
- attrs: {
676
- fill: "currentColor",
677
- d: "M1.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.1665C15.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.1665C2.8543 13.3874 3.03338 13.5665 3.2543 13.5665H13.5543C13.7752 13.5665 13.9543 13.3874 13.9543 13.1665C13.9543 12.9456 13.7752 12.7665 13.5543 12.7665H3.2543Z",
678
- fillRule: "evenodd",
679
- clipRule: "evenodd"
680
- }
681
- }
682
- ]
683
- }, zt = Z(function(e, t) {
684
- return H(F, Object.assign({}, e, {
685
- id: "topmost-icon",
686
- ref: t,
687
- icon: ui
688
- }));
689
- });
690
- zt.displayName = "TopmostIcon";
691
- const hi = {
692
- tag: "svg",
693
- attrs: {
694
- xmlns: "http://www.w3.org/2000/svg",
695
- fill: "none",
696
- viewBox: "0 0 16 16",
697
- width: "1em",
698
- height: "1em"
699
- },
700
- children: [
701
- {
702
- tag: "path",
703
- attrs: {
704
- fill: "colorChannel1",
705
- 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"
706
- }
707
- },
708
- {
709
- tag: "path",
710
- attrs: {
711
- fill: "currentColor",
712
- 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.56377Z",
713
- fillRule: "evenodd",
714
- clipRule: "evenodd"
715
- }
716
- },
717
- {
718
- tag: "path",
719
- attrs: {
720
- fill: "currentColor",
721
- d: "M2.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.83647Z",
722
- fillRule: "evenodd",
723
- clipRule: "evenodd"
724
- }
725
- },
726
- {
727
- tag: "path",
728
- attrs: {
729
- fill: "currentColor",
730
- d: "M9.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",
731
- fillRule: "evenodd",
732
- clipRule: "evenodd"
733
- }
734
- }
735
- ]
736
- }, Kt = Z(function(e, t) {
737
- return H(F, Object.assign({}, e, {
738
- id: "autofill-double-icon",
739
- ref: t,
740
- icon: hi
741
- }));
742
- });
743
- Kt.displayName = "AutofillDoubleIcon";
744
- const gi = {
745
- tag: "svg",
746
- attrs: {
747
- xmlns: "http://www.w3.org/2000/svg",
748
- fill: "none",
749
- viewBox: "0 0 17 16",
750
- width: "1em",
751
- height: "1em"
752
- },
753
- children: [
754
- {
755
- tag: "path",
756
- attrs: {
757
- fill: "currentColor",
758
- d: "M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z",
759
- fillRule: "evenodd",
760
- clipRule: "evenodd"
761
- }
762
- },
763
- {
764
- tag: "path",
765
- attrs: {
766
- fill: "currentColor",
767
- d: "M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z"
768
- }
769
- },
770
- {
771
- tag: "path",
772
- attrs: {
773
- fill: "colorChannel1",
774
- d: "M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"
775
- }
776
- }
777
- ]
778
- }, Zt = Z(function(e, t) {
779
- return H(F, Object.assign({}, e, {
780
- id: "paint-bucket-double-icon",
781
- ref: t,
782
- icon: gi
783
- }));
784
- });
785
- Zt.displayName = "PaintBucketDoubleIcon";
786
- const B = {
787
- id: "slide.operation.update-element",
788
- type: D.OPERATION,
789
- handler: (i, e) => {
790
- const { oKey: t, props: n } = e, r = i.get(w), s = e == null ? void 0 : e.unitId, o = r.getUnit(s);
791
- if (!o) return !1;
792
- const c = o.getActivePage();
793
- return c.pageElements[t] = It(c.pageElements[t], n), o.updatePage(c.id, c), !0;
794
- }
795
- };
796
- function vi(i) {
797
- const { pageId: e, unitId: t } = i, n = O(J), r = O(P), s = O(N), o = r.getRenderUnitByPageId(e, t), c = o == null ? void 0 : o.scene;
798
- if (!c) return null;
799
- const a = c.getTransformer();
800
- if (!a) return null;
801
- const l = a.getSelectedObjectMap().values().next().value;
802
- if (!l) return null;
803
- const d = (v) => {
804
- const _ = c.getAllObjects(), [f, p] = _.reduce(([m, I], b) => {
805
- const T = b.zIndex, M = T < m ? T : m, U = T > I ? T : I;
806
- return [M, U];
807
- }, [0, 0]);
808
- let h = l.zIndex;
809
- v === 3 ? h = f - 1 : v === 2 ? h = p + 1 : v === 0 ? h = l.zIndex + 1 : v === 1 && (h = l.zIndex - 1), l.setProps({
810
- zIndex: h
811
- }), s.executeCommand(B.id, {
812
- unitId: t,
813
- oKey: l == null ? void 0 : l.oKey,
814
- props: {
815
- zIndex: h
816
- }
817
- });
818
- };
819
- return /* @__PURE__ */ R("div", { className: "univer-relative univer-w-full", children: [
820
- /* @__PURE__ */ g("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ g(
821
- "div",
822
- {
823
- className: "univer-w-full univer-text-left univer-text-gray-600 dark:!univer-text-gray-200",
824
- children: /* @__PURE__ */ g("div", { children: n.t("image-panel.arrange.title") })
825
- }
826
- ) }),
827
- /* @__PURE__ */ R("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: [
828
- /* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(Se, { onClick: () => {
829
- d(
830
- 0
831
- /* forward */
832
- );
833
- }, children: /* @__PURE__ */ R("span", { className: "univer-flex univer-items-center univer-gap-1", children: [
834
- /* @__PURE__ */ g(Wt, {}),
835
- n.t("image-panel.arrange.forward")
836
- ] }) }) }),
837
- /* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(Se, { onClick: () => {
838
- d(
839
- 1
840
- /* backward */
841
- );
842
- }, children: /* @__PURE__ */ R("span", { className: "univer-flex univer-items-center univer-gap-1", children: [
843
- /* @__PURE__ */ g(Ft, {}),
844
- n.t("image-panel.arrange.backward")
845
- ] }) }) })
846
- ] }),
847
- /* @__PURE__ */ R("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: [
848
- /* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(Se, { onClick: () => {
849
- d(
850
- 2
851
- /* front */
852
- );
853
- }, children: /* @__PURE__ */ R("span", { className: "univer-flex univer-items-center univer-gap-1", children: [
854
- /* @__PURE__ */ g(zt, {}),
855
- n.t("image-panel.arrange.front")
856
- ] }) }) }),
857
- /* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(Se, { onClick: () => {
858
- d(
859
- 3
860
- /* back */
861
- );
862
- }, children: /* @__PURE__ */ R("span", { className: "univer-flex univer-items-center univer-gap-1", children: [
863
- /* @__PURE__ */ g(Bt, {}),
864
- n.t("image-panel.arrange.back")
865
- ] }) }) })
866
- ] })
867
- ] });
868
- }
869
- function pi(i) {
870
- var f, p;
871
- const { pageId: e, unitId: t } = i, n = O(J), r = O(P), s = O(N), o = r.getRenderUnitByPageId(e, t), c = o == null ? void 0 : o.scene;
872
- if (!c) return null;
873
- const a = c.getTransformer();
874
- if (!a) return null;
875
- const l = a.getSelectedObjectMap().values().next().value;
876
- if (!l) return null;
877
- const [d, v] = $((p = (f = l.fill) == null ? void 0 : f.toString()) != null ? p : "");
878
- function _(h) {
879
- l == null || l.setProps({
880
- fill: h
881
- }), s.executeCommand(B.id, {
882
- unitId: t,
883
- oKey: l == null ? void 0 : l.oKey,
884
- props: {
885
- shape: {
886
- shapeProperties: {
887
- shapeBackgroundFill: {
888
- rgb: h
889
- }
890
- }
891
- }
892
- }
893
- }), v(h);
894
- }
895
- return /* @__PURE__ */ g(
896
- "div",
897
- {
898
- className: k("univer-relative univer-bottom-0 univer-mt-5 univer-w-full", Nt),
899
- children: /* @__PURE__ */ R("div", { className: "univer-relative univer-w-full", children: [
900
- /* @__PURE__ */ g("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ g(
901
- "div",
902
- {
903
- className: "univer-w-full univer-text-left univer-text-gray-600 dark:!univer-text-gray-200",
904
- children: /* @__PURE__ */ g("div", { children: n.t("slide.panel.fill.title") })
905
- }
906
- ) }),
907
- /* @__PURE__ */ g("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(
908
- Dt,
909
- {
910
- overlay: /* @__PURE__ */ g("div", { className: "univer-rounded-lg univer-p-4", children: /* @__PURE__ */ g(
911
- $n,
912
- {
913
- value: "#fff",
914
- onChange: _
915
- }
916
- ) }),
917
- children: /* @__PURE__ */ R("a", { className: "univer-flex univer-cursor-pointer univer-items-center univer-gap-1", children: [
918
- /* @__PURE__ */ g(Zt, { className: "univer-fill-primary-600" }),
919
- /* @__PURE__ */ g(Xe, {})
920
- ] })
921
- }
922
- ) }) })
923
- ] })
924
- }
925
- );
926
- }
927
- function fi(i) {
928
- const { pageId: e, unitId: t } = i, n = O(J), r = O(P), s = O(N), o = r.getRenderUnitByPageId(e, t), c = o == null ? void 0 : o.scene;
929
- if (!c) return null;
930
- const a = c.getTransformer();
931
- if (!a) return null;
932
- const l = a.getSelectedObjectMap().values().next().value;
933
- if (!l) return null;
934
- const {
935
- width: d = 0,
936
- height: v = 0,
937
- left: _ = 0,
938
- top: f = 0,
939
- angle: p = 0
940
- } = l, [h, m] = $(d), [I, b] = $(v), [T, M] = $(_), [U, x] = $(f), [W, ce] = $(p), A = (C) => {
941
- const { objects: ae } = C, le = ae.values().next().value, {
942
- width: nn = 0,
943
- height: rn = 0,
944
- left: sn = 0,
945
- top: on = 0,
946
- angle: cn = 0
947
- } = le;
948
- m(nn), b(rn), M(sn), x(on), ce(cn);
949
- };
950
- ve(() => {
951
- const C = a.changeStart$.subscribe((le) => {
952
- A(le);
953
- }), ae = a.changing$.subscribe((le) => {
954
- A(le);
955
- });
956
- return () => {
957
- ae.unsubscribe(), C.unsubscribe();
958
- };
959
- }, []);
960
- function L(C) {
961
- !C || !l || (s.executeCommand(B.id, {
962
- pageId: e,
963
- oKey: l.oKey,
964
- props: {
965
- width: C
966
- }
967
- }), l == null || l.resize(C, l.height), m(C), a == null || a.refreshControls());
968
- }
969
- function Q(C) {
970
- !C || !l || (s.executeCommand(B.id, {
971
- pageId: e,
972
- oKey: l.oKey,
973
- props: {
974
- height: C
975
- }
976
- }), l == null || l.resize(l.width, C), b(C), a == null || a.refreshControls());
977
- }
978
- function ee(C) {
979
- !C || !l || (s.executeCommand(B.id, {
980
- pageId: e,
981
- oKey: l.oKey,
982
- props: {
983
- left: C
984
- }
985
- }), l == null || l.translate(C, l.top), M(C), a == null || a.refreshControls());
986
- }
987
- function me(C) {
988
- !C || !l || (s.executeCommand(B.id, {
989
- pageId: e,
990
- oKey: l.oKey,
991
- props: {
992
- right: C
993
- }
994
- }), l == null || l.translate(l.left, C), x(C), a == null || a.refreshControls());
995
- }
996
- function Ce(C) {
997
- !C || !l || (s.executeCommand(B.id, {
998
- pageId: e,
999
- oKey: l.oKey,
1000
- props: {
1001
- angle: C
1002
- }
1003
- }), l == null || l.transformByState({
1004
- angle: C
1005
- }), ce(C), a == null || a.refreshControls());
1006
- }
1007
- return /* @__PURE__ */ R(
1008
- "div",
1009
- {
1010
- className: k("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", Nt),
1011
- children: [
1012
- /* @__PURE__ */ g(
1013
- "header",
1014
- {
1015
- className: "univer-text-gray-600 dark:!univer-text-gray-200",
1016
- children: /* @__PURE__ */ g("div", { children: n.t("image-panel.transform.title") })
1017
- }
1018
- ),
1019
- /* @__PURE__ */ R(
1020
- "div",
1021
- {
1022
- className: "univer-grid univer-grid-cols-3 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
1023
- children: [
1024
- /* @__PURE__ */ R("div", { children: [
1025
- /* @__PURE__ */ g("span", { children: n.t("image-panel.transform.width") }),
1026
- /* @__PURE__ */ g(
1027
- de,
1028
- {
1029
- min: 1,
1030
- value: h,
1031
- onChange: (C) => {
1032
- L(C);
1033
- }
1034
- }
1035
- )
1036
- ] }),
1037
- /* @__PURE__ */ R("div", { children: [
1038
- /* @__PURE__ */ g("span", { children: n.t("image-panel.transform.height") }),
1039
- /* @__PURE__ */ g(
1040
- de,
1041
- {
1042
- min: 1,
1043
- value: I,
1044
- onChange: (C) => {
1045
- Q(C);
1046
- }
1047
- }
1048
- )
1049
- ] })
1050
- ]
1051
- }
1052
- ),
1053
- /* @__PURE__ */ R("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: [
1054
- /* @__PURE__ */ R("div", { children: [
1055
- /* @__PURE__ */ g("span", { children: n.t("image-panel.transform.x") }),
1056
- /* @__PURE__ */ g(de, { min: 0, precision: 1, value: T, onChange: (C) => {
1057
- ee(C);
1058
- } })
1059
- ] }),
1060
- /* @__PURE__ */ R("div", { children: [
1061
- /* @__PURE__ */ g("span", { children: n.t("image-panel.transform.y") }),
1062
- /* @__PURE__ */ g(de, { min: 0, precision: 1, value: U, onChange: (C) => {
1063
- me(C);
1064
- } })
1065
- ] }),
1066
- /* @__PURE__ */ R("div", { children: [
1067
- /* @__PURE__ */ g("span", { children: n.t("image-panel.transform.rotate") }),
1068
- /* @__PURE__ */ g(
1069
- de,
1070
- {
1071
- precision: 1,
1072
- value: W,
1073
- onChange: Ce
1074
- }
1075
- )
1076
- ] })
1077
- ] })
1078
- ]
1079
- }
1080
- );
1081
- }
1082
- const Ee = "COMPONENT_SLIDE_SIDEBAR";
1083
- function _i() {
1084
- var u, l, d;
1085
- const i = O(w), e = O(P), t = i.getCurrentUnitForType(E.UNIVER_SLIDE), n = (u = t == null ? void 0 : t.getActivePage()) == null ? void 0 : u.id, r = ((l = i.getFocusedUnit()) == null ? void 0 : l.getUnitId()) || "";
1086
- if (!n || !r) return null;
1087
- const o = (d = e.getRenderUnitByPageId(n, r).scene) == null ? void 0 : d.getTransformer();
1088
- if (!o) return null;
1089
- const a = o.getSelectedObjectMap().values().next().value;
1090
- return a ? /* @__PURE__ */ R("section", { className: "univer-p-2 univer-text-center univer-text-sm", children: [
1091
- /* @__PURE__ */ g(vi, { pageId: n, unitId: r }),
1092
- /* @__PURE__ */ g(fi, { pageId: n, unitId: r }),
1093
- a.objectType === ue.RECT && /* @__PURE__ */ g(pi, { pageId: n, unitId: r })
1094
- ] }) : null;
1095
- }
1096
- const Ye = {
1097
- id: "slide.command.insert-float-shape.rectangle",
1098
- type: D.COMMAND,
1099
- handler: async (i) => {
1100
- var r;
1101
- const e = i.get(N), n = (r = i.get(w).getFocusedUnit()) == null ? void 0 : r.getUnitId();
1102
- return e.executeCommand(Gt.id, { unitId: n });
1103
- }
1104
- }, Gt = {
1105
- id: "slide.operation.insert-float-shape.rectangle",
1106
- type: D.OPERATION,
1107
- handler: async (i, e) => {
1108
- const t = ze(6), n = i.get(w), r = e.unitId, s = n.getUnit(r);
1109
- if (!s) return !1;
1110
- const o = s.getActivePage(), c = Object.values(o.pageElements), a = c != null && c.length ? Math.max(...c.map((v) => v.zIndex)) : 20, u = {
1111
- id: t,
1112
- zIndex: a + 1,
1113
- left: 378,
1114
- top: 142,
1115
- width: 250,
1116
- height: 250,
1117
- title: t,
1118
- description: "",
1119
- type: De.SHAPE,
1120
- shape: {
1121
- shapeType: bt.Rect,
1122
- text: "",
1123
- shapeProperties: {
1124
- shapeBackgroundFill: {
1125
- rgb: "rgb(0,0,255)"
1126
- }
1127
- }
1128
- }
1129
- };
1130
- o.pageElements[t] = u, s.updatePage(o.id, o);
1131
- const l = i.get(P), d = l.createObjectToPage(u, o.id, r);
1132
- return d && l.setObjectActiveByPage(d, o.id, r), !0;
1133
- }
1134
- }, $e = {
1135
- id: "sidebar.operation.slide-shape",
1136
- type: D.COMMAND,
1137
- handler: async (i, e) => {
1138
- const { visible: t, objectType: n } = e, r = i.get(Mt), s = i.get(J);
1139
- let o = "", c = "";
1140
- return n === ue.RECT ? (o = "slide.sidebar.shape", c = Ee) : n === ue.IMAGE ? (o = "slide.sidebar.image", c = Ee) : n === ue.RICH_TEXT && (o = "slide.sidebar.text", c = Ee), t ? r.open({
1141
- header: { title: s.t(o) },
1142
- children: { label: c },
1143
- onClose: () => {
1144
- },
1145
- width: 360
1146
- }) : r.close(), !0;
1147
- }
1148
- }, qe = {
1149
- id: "slide.command.insert-float-shape.ellipse",
1150
- type: D.COMMAND,
1151
- handler: async (i) => {
1152
- var r;
1153
- const e = i.get(N), n = (r = i.get(w).getFocusedUnit()) == null ? void 0 : r.getUnitId();
1154
- return e.executeCommand(Xt.id, { unitId: n });
1155
- }
1156
- }, Xt = {
1157
- id: "slide.operation.insert-float-shape.ellipse",
1158
- type: D.OPERATION,
1159
- handler: async (i, e) => {
1160
- const t = ze(6), n = i.get(w), r = e.unitId, s = n.getUnit(r);
1161
- if (!s) return !1;
1162
- const o = s.getActivePage(), c = Object.values(o.pageElements), a = c != null && c.length ? Math.max(...c.map((v) => v.zIndex)) : 20, u = {
1163
- id: t,
1164
- zIndex: a + 1,
1165
- left: 378,
1166
- top: 142,
1167
- width: 250,
1168
- height: 250,
1169
- title: t,
1170
- description: "",
1171
- type: De.SHAPE,
1172
- shape: {
1173
- shapeType: bt.Ellipse,
1174
- text: "",
1175
- shapeProperties: {
1176
- radius: 100,
1177
- shapeBackgroundFill: {
1178
- rgb: "rgb(0,0,255)"
1179
- }
1180
- }
1181
- }
1182
- };
1183
- o.pageElements[t] = u, s.updatePage(o.id, o);
1184
- const l = i.get(P), d = l.createObjectToPage(u, o.id, r);
1185
- return d && l.setObjectActiveByPage(d, o.id, r), !0;
1186
- }
1187
- }, Je = {
1188
- id: "slide.command.add-text",
1189
- type: D.COMMAND,
1190
- handler: async (i) => {
1191
- var r;
1192
- const e = i.get(N), n = (r = i.get(w).getFocusedUnit()) == null ? void 0 : r.getUnitId();
1193
- return await e.executeCommand(Yt.id, { unitId: n });
1194
- }
1195
- }, Yt = {
1196
- id: "slide.operation.add-text",
1197
- type: D.OPERATION,
1198
- handler: async (i, e) => {
1199
- const t = e.unitId, n = ze(6), r = 220, s = 40, o = 230, c = 142, a = (e == null ? void 0 : e.text) || "A New Text", l = i.get(w).getUnit(t);
1200
- if (!l) return !1;
1201
- const d = l.getActivePage(), v = Object.values(d.pageElements), _ = v != null && v.length ? Math.max(...v.map((m) => m.zIndex)) : 21, f = {
1202
- id: n,
1203
- zIndex: _ + 1,
1204
- left: o,
1205
- top: c,
1206
- width: r,
1207
- height: s,
1208
- title: "text",
1209
- description: "",
1210
- type: De.TEXT,
1211
- richText: {
1212
- text: a,
1213
- fs: 30,
1214
- cl: {
1215
- rgb: "rgb(51, 51, 51)"
1216
- },
1217
- bl: 1
1218
- }
1219
- };
1220
- d.pageElements[n] = f, l.updatePage(d.id, d);
1221
- const p = i.get(P), h = p.createObjectToPage(f, d.id, t);
1222
- return h && p.setObjectActiveByPage(h, d.id, t), !0;
1223
- }
1224
- }, qt = {
1225
- id: "slide.operation.set-slide-page-thumb",
1226
- type: D.OPERATION,
1227
- handler: (i, e) => (i.get(P).createThumbs(e.unitId), !0)
1228
- };
1229
- function mi() {
1230
- var f, p;
1231
- const i = O(w), e = O(N), t = O(K), n = O(J), r = Ut(null), s = i.getCurrentUnitForType(E.UNIVER_SLIDE), o = s == null ? void 0 : s.getPages(), c = s == null ? void 0 : s.getPageOrder();
1232
- if (!o || !c)
1233
- return null;
1234
- const a = c.map((h) => o[h]), [u, l] = $((p = (f = s == null ? void 0 : s.getActivePage()) == null ? void 0 : f.id) != null ? p : null), d = Hn(() => a.map(() => Fn()), [a]);
1235
- ve(() => {
1236
- const h = s == null ? void 0 : s.activePage$.subscribe((m) => {
1237
- var b;
1238
- const I = (b = m == null ? void 0 : m.id) != null ? b : null;
1239
- I && l(I);
1240
- });
1241
- return () => {
1242
- h == null || h.unsubscribe();
1243
- };
1244
- }, []), ve(() => {
1245
- d.forEach((h, m) => {
1246
- var I;
1247
- if (h.current) {
1248
- const b = a[m];
1249
- (I = t.getRenderById(b.id)) == null || I.engine.setContainer(h.current);
1250
- }
1251
- }), d.length > 0 && e.syncExecuteCommand(qt.id, { unitId: s == null ? void 0 : s.getUnitId() });
1252
- }, [d, a, t, e, s]);
1253
- const v = lt((h) => {
1254
- e.syncExecuteCommand(jt.id, { id: h, unitId: s == null ? void 0 : s.getUnitId() });
1255
- }, [e, s]), _ = lt(() => {
1256
- e.syncExecuteCommand(At.id, { unitId: s == null ? void 0 : s.getUnitId() });
1257
- }, [e, s]);
1258
- return /* @__PURE__ */ g(
1259
- "aside",
1260
- {
1261
- ref: r,
1262
- className: k("univer-flex univer-h-full univer-w-64 univer-flex-col univer-overflow-y-auto univer-overflow-x-hidden", Bn),
1263
- children: /* @__PURE__ */ R("div", { className: "univer-px-4", children: [
1264
- /* @__PURE__ */ g("header", { className: "univer-flex univer-justify-center univer-pt-4", children: /* @__PURE__ */ g(
1265
- "a",
1266
- {
1267
- className: k("univer-box-border univer-block univer-h-8 univer-w-full univer-cursor-pointer univer-rounded-md univer-bg-white univer-text-center univer-text-sm univer-leading-8 univer-transition-colors", ge),
1268
- onClick: _,
1269
- children: n.t("slide.append")
1270
- }
1271
- ) }),
1272
- a.map((h, m) => /* @__PURE__ */ R(
1273
- "div",
1274
- {
1275
- className: k("univer-my-4 univer-flex univer-gap-2", {
1276
- "[&>div]:univer-border-primary-600 [&>span]:univer-text-primary-600": h.id === u
1277
- }),
1278
- onClick: () => v(h.id),
1279
- children: [
1280
- /* @__PURE__ */ g("span", { children: m + 1 }),
1281
- /* @__PURE__ */ g(
1282
- "div",
1283
- {
1284
- ref: d[m],
1285
- className: k("univer-relative univer-box-border univer-h-32 univer-w-52 univer-bg-white hover:univer-border-primary-600", ge)
1286
- }
1287
- )
1288
- ]
1289
- },
1290
- h.id
1291
- ))
1292
- ] })
1293
- }
1294
- );
1295
- }
1296
- const he = hn("SLIDE_EDITOR"), Oe = {
1297
- id: "slide.operation.edit-arrow",
1298
- type: D.OPERATION,
1299
- handler: () => !0
1300
- }, Jt = "COMPONENT_SLIDE_IMAGE_POPUP_MENU";
1301
- function Ci(i) {
1302
- var f, p;
1303
- const e = (p = (f = i.popup) == null ? void 0 : f.extraProps) == null ? void 0 : p.menuItems;
1304
- if (!e)
1305
- return null;
1306
- const t = O(N), n = O(J), [r, s] = $(!1), [o, c] = $(!1), a = () => {
1307
- c(!0);
1308
- }, u = () => {
1309
- c(!1);
1310
- }, l = (h) => {
1311
- s(h);
1312
- }, d = (h) => {
1313
- t.executeCommand(h.commandId, h.commandParams), s(!1);
1314
- }, v = r || o, _ = e.filter((h) => !h.disable);
1315
- return /* @__PURE__ */ g(
1316
- "div",
1317
- {
1318
- onMouseEnter: a,
1319
- onMouseLeave: u,
1320
- children: /* @__PURE__ */ g(
1321
- Dt,
1322
- {
1323
- align: "start",
1324
- overlay: /* @__PURE__ */ g(
1325
- "ul",
1326
- {
1327
- className: k("univer-m-0 univer-box-border univer-grid univer-list-none univer-items-center univer-gap-1 univer-rounded-lg univer-bg-white univer-p-1.5 univer-text-sm univer-shadow-lg", ge),
1328
- children: _.map((h) => /* @__PURE__ */ g(
1329
- "li",
1330
- {
1331
- className: "univer-relative univer-box-border univer-flex univer-h-8 univer-cursor-pointer univer-items-center univer-rounded univer-text-sm univer-transition-colors hover:univer-bg-gray-100",
1332
- onClick: () => d(h),
1333
- children: /* @__PURE__ */ g("span", { className: "univer-px-2 univer-py-1.5 univer-align-middle", children: n.t(h.label) })
1334
- },
1335
- h.index
1336
- ))
1337
- }
1338
- ),
1339
- open: r,
1340
- onOpenChange: l,
1341
- children: /* @__PURE__ */ R(
1342
- "div",
1343
- {
1344
- className: k("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", ge, {
1345
- "univer-bg-gray-100 dark:!univer-bg-gray-800": r,
1346
- "univer-bg-white dark:!univer-bg-gray-900": !r
1347
- }),
1348
- children: [
1349
- /* @__PURE__ */ g(
1350
- Kt,
1351
- {
1352
- className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white"
1353
- }
1354
- ),
1355
- v && /* @__PURE__ */ g(Xe, { className: "dark:!univer-text-white" })
1356
- ]
1357
- }
1358
- )
1359
- }
1360
- )
1361
- }
1362
- );
1363
- }
1364
- const Qt = "slide.menu.image";
1365
- function Si(i) {
1366
- return {
1367
- id: Qt,
1368
- type: oe.SUBITEMS,
1369
- icon: "AddImageIcon",
1370
- tooltip: "slide.image.insert.title",
1371
- hidden$: se(i, E.UNIVER_SLIDE)
1372
- };
1373
- }
1374
- function Ii(i) {
1375
- return {
1376
- id: Ge.id,
1377
- title: "slide.image.insert.float",
1378
- type: oe.BUTTON,
1379
- hidden$: se(i, E.UNIVER_SLIDE)
1380
- };
1381
- }
1382
- const en = "slide.menu.shape";
1383
- function bi(i) {
1384
- return {
1385
- id: en,
1386
- type: oe.SUBITEMS,
1387
- icon: "GraphIcon",
1388
- tooltip: "slide.shape.insert.title",
1389
- hidden$: se(i, E.UNIVER_SLIDE)
1390
- // disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
1391
- };
1392
- }
1393
- function Ei(i) {
1394
- return {
1395
- id: Ye.id,
1396
- title: "slide.shape.insert.rectangle",
1397
- type: oe.BUTTON,
1398
- hidden$: se(i, E.UNIVER_SLIDE)
1399
- };
1400
- }
1401
- function Ri(i) {
1402
- return {
1403
- id: qe.id,
1404
- title: "slide.shape.insert.ellipse",
1405
- type: oe.BUTTON,
1406
- hidden$: se(i, E.UNIVER_SLIDE)
1407
- };
1408
- }
1409
- function xi(i) {
1410
- return {
1411
- id: Je.id,
1412
- type: oe.BUTTON,
1413
- icon: "TextIcon",
1414
- tooltip: "slide.text.insert.title",
1415
- hidden$: se(i, E.UNIVER_SLIDE)
1416
- };
1417
- }
1418
- const Oi = {
1419
- [Tn.FORMAT]: {
1420
- [Je.id]: {
1421
- order: 0,
1422
- menuItemFactory: xi
1423
- },
1424
- [Qt]: {
1425
- order: 0,
1426
- menuItemFactory: Si,
1427
- [Ge.id]: {
1428
- order: 0,
1429
- menuItemFactory: Ii
1430
- }
1431
- },
1432
- [en]: {
1433
- order: 0,
1434
- menuItemFactory: bi,
1435
- [Ye.id]: {
1436
- order: 0,
1437
- menuItemFactory: Ei
1438
- },
1439
- [qe.id]: {
1440
- order: 0,
1441
- menuItemFactory: Ri
1442
- }
1443
- }
1444
- }
1445
- };
1446
- class wi {
1447
- constructor() {
1448
- S(this, "_state", null);
1449
- S(this, "_rect", null);
1450
- S(this, "_state$", new q(null));
1451
- S(this, "state$", this._state$.asObservable());
1452
- S(this, "_rect$", new q(null));
1453
- S(this, "rect$", this._rect$.asObservable());
1454
- S(this, "_focus", !1);
1455
- S(this, "_focus$", new q(this._focus));
1456
- S(this, "focus$", this._focus$.asObservable());
1457
- }
1458
- dispose() {
1459
- this._state$.complete(), this._state = null, this._rect$.complete(), this._rect = null;
1460
- }
1461
- setState(e) {
1462
- this._state = e, this._refresh(e);
1463
- }
1464
- getRect() {
1465
- return this._rect;
1466
- }
1467
- setRect(e) {
1468
- this._rect = e, this._rect$.next(e);
1469
- }
1470
- getState() {
1471
- return this._state;
1472
- }
1473
- setFocus(e = !1) {
1474
- this._focus = e, this._focus$.next(e);
1475
- }
1476
- _refresh(e) {
1477
- this._state$.next(e);
1478
- }
1479
- }
1480
- const Qe = Et(
1481
- "univer.slide-editor-manager.service"
1482
- ), we = -1e3, vt = {
1483
- width: 0,
1484
- height: 0,
1485
- top: we,
1486
- left: we
1487
- };
1488
- function yi() {
1489
- const [i, e] = $({
1490
- ...vt
1491
- }), t = O(Qe), n = O(Ze), r = O(_e), s = Mn(
1492
- () => r.subscribeContextValue$(ot),
1493
- !1,
1494
- void 0,
1495
- [r, ot]
1496
- );
1497
- return gn.UNSPECIFIED, ve(() => {
1498
- t.state$.subscribe((o) => {
1499
- if (o == null)
1500
- return;
1501
- const {
1502
- startX: c = we,
1503
- startY: a = we,
1504
- endX: u = 0,
1505
- endY: l = 0,
1506
- show: d = !1
1507
- } = o;
1508
- if (!d)
1509
- e({
1510
- ...vt
1511
- });
1512
- else {
1513
- e({
1514
- width: u - c - ie + 2,
1515
- height: l - a - ie + 2,
1516
- left: c + ie,
1517
- top: a + ie
1518
- });
1519
- const v = n.getEditor(he);
1520
- if (v == null)
1521
- return;
1522
- const { left: _, top: f, width: p, height: h } = v.getBoundingClientRect();
1523
- t.setRect({ left: _, top: f, width: p, height: h });
1524
- }
1525
- });
1526
- }, []), ve(() => {
1527
- s || t.setFocus(!0);
1528
- }, [s, i]), /* @__PURE__ */ g(
1529
- "div",
1530
- {
1531
- className: k("univer-absolute univer-z-10 univer-box-border univer-flex", ge),
1532
- style: {
1533
- left: i.left,
1534
- top: i.top,
1535
- width: i.width,
1536
- height: i.height
1537
- }
1538
- }
1539
- );
1540
- }
1541
- function Be(i) {
1542
- return i.getContextValue(Rt) && i.getContextValue(Re);
1543
- }
1544
- function Pi(i) {
1545
- return i.getContextValue(vn) && i.getContextValue(Rt);
1546
- }
1547
- const tn = [
1548
- y.ARROW_DOWN,
1549
- y.ARROW_UP,
1550
- y.ARROW_LEFT,
1551
- y.ARROW_RIGHT
1552
- ];
1553
- [y.ENTER, y.TAB, ...tn];
1554
- function Ti() {
1555
- const i = [];
1556
- for (const e of tn)
1557
- i.push({
1558
- id: Oe.id,
1559
- binding: e,
1560
- preconditions: (t) => Be(t),
1561
- staticParameters: {
1562
- visible: !1,
1563
- eventType: Y.Keyboard,
1564
- keycode: e,
1565
- isShift: !1
1566
- }
1567
- }), i.push({
1568
- id: Oe.id,
1569
- binding: e | Dn.SHIFT,
1570
- preconditions: (t) => Be(t),
1571
- staticParameters: {
1572
- visible: !1,
1573
- eventType: Y.Keyboard,
1574
- keycode: e,
1575
- isShift: !0
1576
- }
1577
- });
1578
- return i;
1579
- }
1580
- const Mi = {
1581
- id: Wn.id,
1582
- preconditions: (i) => Be(i) || Pi(i),
1583
- binding: y.BACKSPACE
1584
- };
1585
- var Di = Object.getOwnPropertyDescriptor, Ni = (i, e, t, n) => {
1586
- for (var r = n > 1 ? void 0 : n ? Di(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1587
- (o = i[s]) && (r = o(r) || r);
1588
- return r;
1589
- }, te = (i, e) => (t, n) => e(t, n, i);
1590
- let ye = class extends Ne {
1591
- constructor(i, e, t, n, r, s) {
1592
- super(), this._injector = i, this._menuManagerService = e, this._componentManager = t, this._uiPartsService = n, this._commandService = r, this._shortcutService = s, this._initCommands(), this._initCustomComponents(), this._initUIComponents(), this._initMenus(), this._initShortcuts();
1593
- }
1594
- _initMenus() {
1595
- this._menuManagerService.mergeMenu(Oi);
1596
- }
1597
- _initCustomComponents() {
1598
- const i = this._componentManager;
1599
- this.disposeWithMe(i.register("TextIcon", kt)), this.disposeWithMe(i.register("GraphIcon", Ht)), this.disposeWithMe(i.register(Jt, Ci)), this.disposeWithMe(i.register(Ee, _i));
1600
- }
1601
- _initCommands() {
1602
- [
1603
- At,
1604
- jt,
1605
- qt,
1606
- Ge,
1607
- Yt,
1608
- Je,
1609
- qe,
1610
- Xt,
1611
- Gt,
1612
- Ye,
1613
- $e,
1614
- Lt,
1615
- B,
1616
- // commands for editor
1617
- Oe
1618
- ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
1619
- }
1620
- _initUIComponents() {
1621
- this.disposeWithMe(
1622
- this._uiPartsService.registerComponent(ct.LEFT_SIDEBAR, () => at(mi, this._injector))
1623
- ), this.disposeWithMe(
1624
- this._uiPartsService.registerComponent(ct.CONTENT, () => at(yi, this._injector))
1625
- );
1626
- }
1627
- _initShortcuts() {
1628
- [
1629
- Mi,
1630
- ...Ti()
1631
- ].forEach((i) => {
1632
- this.disposeWithMe(this._shortcutService.registerShortcut(i));
1633
- });
1634
- }
1635
- };
1636
- ye = Ni([
1637
- te(0, z(ke)),
1638
- te(1, Nn),
1639
- te(2, z(Un)),
1640
- te(3, Vn),
1641
- te(4, N),
1642
- te(5, jn)
1643
- ], ye);
1644
- const Ui = "@univerjs/slides-ui", Vi = "0.17.0", pt = {
1645
- name: Ui,
1646
- version: Vi
1647
- }, ji = "slides-ui.config", ft = {};
1648
- var Ai = Object.getOwnPropertyDescriptor, Li = (i, e, t, n) => {
1649
- for (var r = n > 1 ? void 0 : n ? Ai(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1650
- (o = i[s]) && (r = o(r) || r);
1651
- return r;
1652
- }, Ve = (i, e) => (t, n) => e(t, n, i);
1653
- const et = Et("univer.slide-editor-bridge.service");
1654
- let He = class extends Ne {
1655
- constructor(e, t, n) {
1656
- super();
1657
- S(this, "_editorUnitId", he);
1658
- S(this, "_isForceKeepVisible", !1);
1659
- S(this, "_editorIsDirty", !1);
1660
- S(this, "_currentEditRectState", null);
1661
- S(this, "_currentEditRectState$", new q(null));
1662
- S(this, "currentEditRectState$", this._currentEditRectState$.asObservable());
1663
- S(this, "_visibleParam", {
1664
- visible: !1,
1665
- eventType: Y.Dblclick,
1666
- unitId: ""
1667
- });
1668
- S(this, "_visible$", new q(this._visibleParam));
1669
- S(this, "visible$", this._visible$.asObservable());
1670
- S(this, "_afterVisible$", new q(this._visibleParam));
1671
- S(this, "afterVisible$", this._afterVisible$.asObservable());
1672
- S(this, "endEditing$", new Vt());
1673
- S(this, "_currentEditRectInfo");
1674
- this._editorService = e, this._contextService = t, this._renderManagerService = n;
1675
- }
1676
- dispose() {
1677
- super.dispose();
1678
- }
1679
- getEditorRect() {
1680
- return this._currentEditRectInfo;
1681
- }
1682
- /**
1683
- * 1st part of startEditing.
1684
- * @editorInfo editorInfo
1685
- */
1686
- setEditorRect(e) {
1687
- this._currentEditRectInfo = e, this._editorService.getFocusEditor() || (this._editorService.focus(he), this._contextService.setContextValue(Re, !1), this._contextService.setContextValue(xt, !1), this._contextService.setContextValue(Ot, !1));
1688
- const t = this.getEditRectState();
1689
- this._currentEditRectState = t, this._currentEditRectState$.next(t);
1690
- }
1691
- changeVisible(e) {
1692
- this._visibleParam = e, e.visible && (this._editorIsDirty = !1), this._visible$.next(this._visibleParam), this._afterVisible$.next(this._visibleParam);
1693
- }
1694
- /**
1695
- * get info from _currentEditRectInfo
1696
- *
1697
- * invoked by slide-editing.render-controller.ts@_handleEditorVisible
1698
- * && this@setEditorRect
1699
- */
1700
- getEditRectState() {
1701
- const e = he, t = this._currentEditRectInfo, n = t.unitId, r = t.richTextObj.documentData;
1702
- r.id = e, r.documentStyle = {
1703
- ...r.documentStyle,
1704
- pageSize: { width: t.richTextObj.width, height: 1 / 0 }
1705
- };
1706
- const o = {
1707
- documentModel: new pn(r),
1708
- fontString: "document",
1709
- textRotation: { a: 0, v: 0 },
1710
- wrapStrategy: 0,
1711
- verticalAlign: xe.TOP,
1712
- horizontalAlign: wt.LEFT,
1713
- paddingData: { t: 0, b: 1, l: 2, r: 2 }
1714
- }, c = t.richTextObj.width, a = t.richTextObj.height, u = t.richTextObj.left, l = t.richTextObj.top, d = {
1715
- left: 0,
1716
- top: 0
1717
- }, v = this._renderManagerService.getRenderById(n), _ = v == null ? void 0 : v.scene, f = _ == null ? void 0 : _.getViewport(re.VIEW), p = _ == null ? void 0 : _.getObject(re.COMPONENT), h = {
1718
- x: (p == null ? void 0 : p.left) || 0,
1719
- y: (p == null ? void 0 : p.top) || 0
1720
- }, m = (f == null ? void 0 : f.viewportScrollX) || 0, I = (f == null ? void 0 : f.viewportScrollY) || 0;
1721
- return d.left = h.x - m, d.top = h.y - I, {
1722
- position: {
1723
- startX: u,
1724
- startY: l,
1725
- endX: u + c,
1726
- endY: l + a
1727
- },
1728
- scaleX: 1,
1729
- scaleY: 1,
1730
- slideCardOffset: d,
1731
- unitId: n,
1732
- editorUnitId: e,
1733
- documentLayoutObject: o
1734
- };
1735
- }
1736
- changeEditorDirty(e) {
1737
- this._editorIsDirty = e;
1738
- }
1739
- isVisible() {
1740
- return this._visibleParam.visible;
1741
- }
1742
- getEditorDirty() {
1743
- return this._editorIsDirty;
1744
- }
1745
- getCurrentEditorId() {
1746
- return this._editorUnitId;
1747
- }
1748
- /**
1749
- * @deprecated
1750
- */
1751
- genDocData(e) {
1752
- const t = this.getCurrentEditorId(), n = e.text, r = e.fs;
1753
- return {
1754
- id: t,
1755
- body: {
1756
- dataStream: `${n}\r
1757
- `,
1758
- textRuns: [{ st: 0, ed: n.length }],
1759
- paragraphs: [{
1760
- paragraphStyle: {
1761
- // no use
1762
- // textStyle: { fs: 30 },
1763
- // horizontalAlign: HorizontalAlign.CENTER,
1764
- // verticalAlign: VerticalAlign.MIDDLE,
1765
- },
1766
- startIndex: n.length + 1
1767
- }],
1768
- sectionBreaks: [{ startIndex: n.length + 2 }]
1769
- },
1770
- documentStyle: {
1771
- marginBottom: 0,
1772
- marginLeft: 0,
1773
- marginRight: 0,
1774
- marginTop: 0,
1775
- pageSize: { width: 1 / 0, height: 1 / 0 },
1776
- textStyle: { fs: r },
1777
- renderConfig: {
1778
- // horizontalAlign: HorizontalAlign.CENTER,
1779
- verticalAlign: xe.MIDDLE,
1780
- centerAngle: 0,
1781
- vertexAngle: 0,
1782
- wrapStrategy: 0
1783
- }
1784
- },
1785
- drawings: {},
1786
- drawingsOrder: [],
1787
- settings: { zoomRatio: 1 }
1788
- };
1789
- }
1790
- };
1791
- He = Li([
1792
- Ve(0, Ze),
1793
- Ve(1, _e),
1794
- Ve(2, K)
1795
- ], He);
1796
- var G = /* @__PURE__ */ ((i) => (i[i.InitialState = 0] = "InitialState", i[i.StartEditor = 1] = "StartEditor", i[i.CursorChange = 2] = "CursorChange", i))(G || {}), $i = Object.getOwnPropertyDescriptor, Bi = (i, e, t, n) => {
1797
- for (var r = n > 1 ? void 0 : n ? $i(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1798
- (o = i[s]) && (r = o(r) || r);
1799
- return r;
1800
- }, j = (i, e) => (t, n) => e(t, n, i);
1801
- const _t = -1e3, mt = 5, Hi = 2;
1802
- let Fe = class extends Ne {
1803
- constructor(e, t, n, r, s, o, c, a, u, l, d, v) {
1804
- super();
1805
- /**
1806
- * It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
1807
- */
1808
- S(this, "_cursorChange", G.InitialState);
1809
- /** If the corresponding unit is active and prepared for editing. */
1810
- S(this, "_isUnitEditing", !1);
1811
- S(this, "_d");
1812
- this._renderContext = e, this._layoutService = t, this._undoRedoService = n, this._contextService = r, this._instanceSrv = s, this._renderManagerService = o, this._editorBridgeService = c, this._cellEditorManagerService = a, this._textSelectionManagerService = u, this._commandService = l, this._localService = d, this._editorService = v, this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(E.UNIVER_SLIDE).subscribe((_) => {
1813
- _ && _.getUnitId() === this._renderContext.unitId ? this._d = this._init() : (this._disposeCurrent(), this._isUnitEditing && (this._handleEditorInvisible({
1814
- visible: !1,
1815
- eventType: Y.Keyboard,
1816
- keycode: y.ESC,
1817
- unitId: this._renderContext.unitId
1818
- }), this._isUnitEditing = !1));
1819
- })), this._initEditorVisibilityListener();
1820
- }
1821
- dispose() {
1822
- super.dispose(), this._disposeCurrent();
1823
- }
1824
- _disposeCurrent() {
1825
- var e;
1826
- (e = this._d) == null || e.dispose(), this._d = null;
1827
- }
1828
- _init() {
1829
- const e = new Ke();
1830
- return this._subscribeToCurrentCell(e), this._initialKeyboardListener(e), this._initialCursorSync(e), this._listenEditorFocus(e), this._commandExecutedListener(e), setTimeout(() => {
1831
- this._cursorStateListener(e);
1832
- }, 1e3), e;
1833
- }
1834
- _initEditorVisibilityListener() {
1835
- this.disposeWithMe(this._editorBridgeService.visible$.subscribe((e) => {
1836
- e.visible ? (this._isUnitEditing = !0, this._handleEditorVisible(e)) : this._isUnitEditing && (this._handleEditorInvisible(e), this._isUnitEditing = !1);
1837
- }));
1838
- }
1839
- _listenEditorFocus(e) {
1840
- const t = this._getEditorObject();
1841
- t && e.add(t.document.onPointerDown$.subscribeEvent(() => {
1842
- }));
1843
- }
1844
- _getEditorSkeleton(e) {
1845
- var t;
1846
- return (t = this._renderManagerService.getRenderById(e)) == null ? void 0 : t.with(gt).getSkeleton();
1847
- }
1848
- _getEditorViewModel(e) {
1849
- var t;
1850
- return (t = this._renderManagerService.getRenderById(e)) == null ? void 0 : t.with(gt).getViewModel();
1851
- }
1852
- _initialCursorSync(e) {
1853
- e.add(this._cellEditorManagerService.focus$.pipe(Gn((t) => !!t)).subscribe(() => {
1854
- var t;
1855
- (t = Le(E.UNIVER_DOC, this._instanceSrv, this._renderManagerService)) == null || t.with(dt).sync();
1856
- }));
1857
- }
1858
- /**
1859
- * Set editorUnitId to curr doc.
1860
- * @param d DisposableCollection
1861
- */
1862
- _subscribeToCurrentCell(e) {
1863
- e.add(this._editorBridgeService.currentEditRectState$.subscribe((t) => {
1864
- var d;
1865
- if (t == null || this._contextService.getContextValue(xt) || this._contextService.getContextValue(Ot))
1866
- return;
1867
- const {
1868
- position: { startX: n, endX: r },
1869
- documentLayoutObject: { textRotation: s, wrapStrategy: o, documentModel: c },
1870
- scaleX: a,
1871
- editorUnitId: u
1872
- } = t, { vertexAngle: l } = rt(s);
1873
- c.updateDocumentId(u), o === tt.WRAP && l === 0 && c.updateDocumentDataPageSize((r - n) / a), this._instanceSrv.changeDoc(u, c), this._contextService.setContextValue(_n, !0), this._textSelectionManagerService.replaceTextRanges([{
1874
- startOffset: 0,
1875
- endOffset: 0
1876
- }]), (d = Le(E.UNIVER_DOC, this._instanceSrv, this._renderManagerService)) == null || d.with(dt).activate(_t, _t);
1877
- }));
1878
- }
1879
- /**
1880
- * Set size and pos of editing area.
1881
- * @param positionFromEditRectState
1882
- * @param canvasOffset
1883
- * @param documentSkeleton
1884
- * @param documentLayoutObject
1885
- * @param scaleX
1886
- * @param scaleY
1887
- */
1888
- _fitTextSize(e, t, n, r, s = 1, o = 1) {
1889
- const { startX: c, startY: a, endX: u, endY: l } = e, d = r.documentModel;
1890
- if (d == null)
1891
- return;
1892
- const { actualWidth: v, actualHeight: _ } = this._predictingSize(
1893
- e,
1894
- t,
1895
- n,
1896
- r,
1897
- s,
1898
- o
1899
- ), { verticalAlign: f, paddingData: p, fill: h } = r;
1900
- let m = u - c, I = l - a;
1901
- if (m < v && (m = v), I < _)
1902
- I = _, d.updateDocumentDataMargin(p);
1903
- else {
1904
- let b = 0;
1905
- f === xe.MIDDLE ? b = (I - _) / 2 / o : f === xe.TOP ? b = p.t || 0 : b = (I - _) / o - (p.b || 0), b = b < (p.t || 0) ? p.t || 0 : b, d.updateDocumentDataMargin({
1906
- t: b
1907
- });
1908
- }
1909
- n.calculate(), this._editAreaProcessing(m, I, e, t, h, s, o);
1910
- }
1911
- /**
1912
- * Mainly used to pre-calculate the width of the editor,
1913
- * to determine whether it needs to be automatically widened.
1914
- */
1915
- _predictingSize(e, t, n, r, s = 1, o = 1) {
1916
- const { startX: c, endX: a } = e, { textRotation: u, wrapStrategy: l } = r, d = r.documentModel, { vertexAngle: v } = rt(u), _ = document.body.clientWidth;
1917
- if (l === tt.WRAP && v === 0) {
1918
- const { actualWidth: h, actualHeight: m } = n.getActualSize();
1919
- return {
1920
- actualWidth: h * s,
1921
- actualHeight: m * o
1922
- };
1923
- }
1924
- d == null || d.updateDocumentDataPageSize((_ - c - t.left) / s), n.calculate();
1925
- const f = n.getActualSize();
1926
- let p = a - c;
1927
- return p < f.actualWidth * s + mt * s && (p = f.actualWidth * s + mt * s), d == null || d.updateDocumentDataPageSize(p / s), d == null || d.updateDocumentRenderConfig({
1928
- horizontalAlign: wt.UNSPECIFIED,
1929
- cellValueType: void 0
1930
- }), {
1931
- actualWidth: p,
1932
- actualHeight: f.actualHeight * o
1933
- };
1934
- }
1935
- /**
1936
- * control the size of editing area
1937
- */
1938
- // eslint-disable-next-line max-lines-per-function
1939
- _editAreaProcessing(e, t, n, r, s, o = 1, c = 1) {
1940
- var C;
1941
- const a = this._getEditorObject();
1942
- if (a == null)
1943
- return;
1944
- function u(ae) {
1945
- return Number.parseInt(ae.replace("px", ""));
1946
- }
1947
- const d = this._renderContext.engine.getCanvasElement(), v = d.getBoundingClientRect(), _ = u(d.style.width), { top: f, left: p, width: h } = v, m = h / _;
1948
- let { startX: I, startY: b } = n;
1949
- I += r.left, b += r.top;
1950
- const { document: T, scene: M, engine: U } = a, x = M.getViewport(ut.VIEW_MAIN), W = document.body.clientHeight - b - r.top - Hi * 2, ce = document.body.clientWidth - I - r.left;
1951
- let A = t, L = x == null ? void 0 : x.getScrollBar();
1952
- A > W ? (A = W, L == null ? x && new Pt(x, { enableHorizontal: !1, barSize: 8 }) : x == null || x.resetCanvasSizeAndUpdateScroll()) : (L = null, (C = x == null ? void 0 : x.getScrollBar()) == null || C.dispose()), e += (L == null ? void 0 : L.barSize) || 0, e = Math.min(e, ce), I -= ie, b -= ie, this._addBackground(M, e / o, t / c, s);
1953
- const { scaleX: Q, scaleY: ee } = M.getPrecisionScale();
1954
- M.transformByState({
1955
- width: e * m / o,
1956
- height: t * m / c,
1957
- scaleX: o * m,
1958
- scaleY: c * m
1959
- }), T.resize(e / o, t / c), setTimeout(() => {
1960
- U.resizeBySize(
1961
- st(e, Q),
1962
- st(A, ee)
1963
- );
1964
- }, 0);
1965
- const me = this._layoutService.getContentElement().getBoundingClientRect(), Ce = d.getBoundingClientRect();
1966
- I = I * m + (Ce.left - me.left), b = b * m + (Ce.top - me.top), this._cellEditorManagerService.setState({
1967
- startX: I,
1968
- startY: b,
1969
- endX: e * m + I,
1970
- endY: A * m + b,
1971
- show: !0
1972
- });
1973
- }
1974
- /**
1975
- * Since the document does not support cell background color, an additional rect needs to be added.
1976
- */
1977
- _addBackground(e, t, n, r) {
1978
- const s = "_backgroundRectHelperColor_", o = e.getObject(s);
1979
- o == null && r == null || (o == null ? e.addObjects(
1980
- [
1981
- new Tt(s, {
1982
- width: t,
1983
- height: n,
1984
- fill: r,
1985
- evented: !1
1986
- })
1987
- ],
1988
- kn
1989
- ) : r == null ? o.dispose() : (o.setProps({
1990
- fill: r
1991
- }), o.transformByState({
1992
- width: t,
1993
- height: n
1994
- })));
1995
- }
1996
- /**
1997
- * Show input area, resize input area and then place input to right place.
1998
- * @TODO why do resize in show input area?
1999
- * @param param
2000
- */
2001
- // handleVisible is the 2nd part of editing.
2002
- // first part: startEditing --> _updateEditor
2003
- // 2nd part: startEditing --> changeVisible --> slide-editor-bridge.render-controller.ts@changeVisible --> _editorBridgeService.changeVisible
2004
- _handleEditorVisible(e) {
2005
- var h, m;
2006
- const { eventType: t } = e;
2007
- this._cursorChange = [Y.PointerDown, Y.Dblclick].includes(t) ? G.CursorChange : G.StartEditor;
2008
- const n = this._editorBridgeService.getEditRectState();
2009
- if (n == null)
2010
- return;
2011
- const {
2012
- position: r,
2013
- documentLayoutObject: s,
2014
- slideCardOffset: o,
2015
- scaleX: c,
2016
- scaleY: a,
2017
- editorUnitId: u,
2018
- unitId: l
2019
- } = n, d = this._getEditorObject();
2020
- if (d == null)
2021
- return;
2022
- const { scene: v } = d;
2023
- this._contextService.setContextValue(Re, !0);
2024
- const { documentModel: _ } = s, f = this._getEditorSkeleton(u);
2025
- if (!f || !_)
2026
- return;
2027
- this._fitTextSize(r, o, f, s, c, a);
2028
- const p = _.getBody().dataStream.length - 2 || 0;
2029
- (h = v.getViewport(ut.VIEW_MAIN)) == null || h.scrollToViewportPos({
2030
- viewportScrollX: Number.POSITIVE_INFINITY
2031
- }), this._textSelectionManagerService.replaceTextRanges([
2032
- {
2033
- startOffset: p,
2034
- endOffset: p
2035
- }
2036
- ]), (m = this._renderManagerService.getRenderById(l)) == null || m.scene.resetCursor();
2037
- }
2038
- _resetBodyStyle(e, t = !1) {
2039
- e.dataStream = mn, e.textRuns != null && (e.textRuns.length === 1 && !t ? (e.textRuns[0].st = 0, e.textRuns[0].ed = 1) : e.textRuns = void 0), e.paragraphs != null && (e.paragraphs.length === 1 ? e.paragraphs[0].startIndex = 0 : e.paragraphs = [
2040
- {
2041
- startIndex: 0
2042
- }
2043
- ]), e.sectionBreaks != null && (e.sectionBreaks = void 0), e.tables != null && (e.tables = void 0), e.customRanges != null && (e.customRanges = void 0), e.customBlocks != null && (e.customBlocks = void 0);
2044
- }
2045
- /**
2046
- * Should activate the editor when the user inputs text.
2047
- * @param d DisposableCollection
2048
- */
2049
- _initialKeyboardListener(e) {
2050
- }
2051
- _showEditorByKeyboard(e) {
2052
- }
2053
- _commandExecutedListener(e) {
2054
- const t = [Oe.id], n = [Yn.id];
2055
- e.add(this._commandService.onCommandExecuted((r) => {
2056
- this._editorService.getFocusId() === he && (t.includes(r.id) && this._moveCursorCmdHandler(r), n.includes(r.id) && this._editorBridgeService.isVisible() && this._editingChangedHandler());
2057
- }));
2058
- }
2059
- _moveCursorCmdHandler(e) {
2060
- const t = e.params, { keycode: n, isShift: r } = t;
2061
- n != null && this._cursorChange === G.CursorChange ? this._moveInEditor(n, r) : this._editorBridgeService.changeVisible(t);
2062
- }
2063
- _editingChangedHandler() {
2064
- const e = this._editorBridgeService.getEditorRect();
2065
- if (!e)
2066
- return;
2067
- const t = e.richTextObj;
2068
- t.refreshDocumentByDocData(), t.resizeToContentSize();
2069
- const { unitId: n } = this._renderContext;
2070
- this._handleEditorVisible({ visible: !0, eventType: 3, unitId: n });
2071
- }
2072
- _getEditorObject() {
2073
- return Fi(this._editorBridgeService.getCurrentEditorId(), this._renderManagerService);
2074
- }
2075
- async _handleEditorInvisible(e) {
2076
- const { keycode: t } = e;
2077
- if (this._cursorChange = G.InitialState, this._exitInput(e), this._editorBridgeService.getEditRectState() == null)
2078
- return;
2079
- if (this._editorBridgeService.getEditorDirty() === !1) {
2080
- this._moveCursor(t);
2081
- return;
2082
- }
2083
- this._moveCursor(t);
2084
- }
2085
- _exitInput(e) {
2086
- this._contextService.setContextValue(Re, !1), this._cellEditorManagerService.setState({
2087
- show: e.visible
2088
- });
2089
- const t = this._editorBridgeService.getCurrentEditorId();
2090
- t != null && this._undoRedoService.clearUndoRedo(t);
2091
- }
2092
- _moveCursor(e) {
2093
- if (e != null)
2094
- switch (V.LEFT, e) {
2095
- case y.ENTER:
2096
- V.DOWN;
2097
- break;
2098
- case y.TAB:
2099
- V.RIGHT;
2100
- break;
2101
- case y.ARROW_DOWN:
2102
- V.DOWN;
2103
- break;
2104
- case y.ARROW_UP:
2105
- V.UP;
2106
- break;
2107
- case y.ARROW_LEFT:
2108
- V.LEFT;
2109
- break;
2110
- case y.ARROW_RIGHT:
2111
- V.RIGHT;
2112
- break;
2113
- }
2114
- }
2115
- /**
2116
- * The user's operations follow the sequence of opening the editor and then moving the cursor.
2117
- * The logic here predicts the user's first cursor movement behavior based on this rule
2118
- */
2119
- _cursorStateListener(e) {
2120
- const t = this._getEditorObject();
2121
- if (!t)
2122
- return;
2123
- const { document: n } = t;
2124
- e.add(yt(n.onPointerDown$.subscribeEvent(() => {
2125
- this._cursorChange === G.StartEditor && (this._cursorChange = G.CursorChange);
2126
- })));
2127
- }
2128
- // TODO: @JOCS, is it necessary to move these commands MoveSelectionOperation\MoveCursorOperation to shortcut? and use multi-commands?
2129
- _moveInEditor(e, t) {
2130
- let n = V.LEFT;
2131
- e === y.ARROW_DOWN ? n = V.DOWN : e === y.ARROW_UP ? n = V.UP : e === y.ARROW_RIGHT && (n = V.RIGHT), t ? this._commandService.executeCommand(zn.id, {
2132
- direction: n
2133
- }) : this._commandService.executeCommand(Kn.id, {
2134
- direction: n
2135
- });
2136
- }
2137
- };
2138
- Fe = Bi([
2139
- j(1, An),
2140
- j(2, fn),
2141
- j(3, _e),
2142
- j(4, w),
2143
- j(5, K),
2144
- j(6, et),
2145
- j(7, Qe),
2146
- j(8, z(Xn)),
2147
- j(9, N),
2148
- j(10, z(J)),
2149
- j(11, Ze)
2150
- ], Fe);
2151
- function Fi(i, e) {
2152
- if (i == null)
2153
- return;
2154
- const t = e.getRenderById(i);
2155
- if (t == null)
2156
- return;
2157
- const { mainComponent: n, scene: r, engine: s, components: o } = t, c = n, a = o.get(Zn.BACKGROUND);
2158
- return {
2159
- document: c,
2160
- docBackground: a,
2161
- scene: r,
2162
- engine: s
2163
- };
2164
- }
2165
- var Wi = Object.getOwnPropertyDescriptor, ki = (i, e, t, n) => {
2166
- for (var r = n > 1 ? void 0 : n ? Wi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2167
- (o = i[s]) && (r = o(r) || r);
2168
- return r;
2169
- }, je = (i, e) => (t, n) => e(t, n, i);
2170
- let We = class extends fe {
2171
- constructor(e, t, n, r) {
2172
- super();
2173
- /**
2174
- * It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
2175
- */
2176
- // private _cursorChange: CursorChange = CursorChange.InitialState;
2177
- /** If the corresponding unit is active and prepared for editing. */
2178
- // private _isUnitEditing = false;
2179
- S(this, "setSlideTextEditor$", new Vt());
2180
- S(this, "_curRichText", null);
2181
- S(this, "_d");
2182
- this._renderContext = e, this._instanceSrv = t, this._commandService = n, this._editorBridgeService = r, this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(E.UNIVER_SLIDE).subscribe((s) => {
2183
- s && s.getUnitId() === this._renderContext.unitId ? this._d = this._init() : this._disposeCurrent();
2184
- }));
2185
- }
2186
- _init() {
2187
- const e = new Ke();
2188
- return this._initEventListener(e), e;
2189
- }
2190
- _disposeCurrent() {
2191
- var e;
2192
- (e = this._d) == null || e.dispose(), this._d = null;
2193
- }
2194
- _setEditorRect(e, t) {
2195
- this._curRichText = t;
2196
- const { scene: n, engine: r } = this._renderContext, s = this._renderContext.unitId, o = {
2197
- scene: n,
2198
- engine: r,
2199
- unitId: s,
2200
- pageId: e,
2201
- richTextObj: t
2202
- };
2203
- this._editorBridgeService.setEditorRect(o);
2204
- }
2205
- _initEventListener(e) {
2206
- const t = (o) => {
2207
- const c = o.getTransformer();
2208
- c && (e.add(c.clearControl$.subscribe(() => {
2209
- this.setEditorVisible(!1), this.pickOtherObjects();
2210
- })), e.add(c.createControl$.subscribe(() => {
2211
- this.setEditorVisible(!1);
2212
- })), e.add(o.onDblclick$.subscribeEvent(() => {
2213
- c.clearControls();
2214
- const u = c.getSelectedObjectMap().values().next().value;
2215
- u && (u.objectType !== ue.RICH_TEXT ? this.pickOtherObjects() : this.startEditing(o.sceneKey, u));
2216
- })), e.add(this._instanceSrv.focused$.subscribe((a) => {
2217
- this.endEditing();
2218
- })));
2219
- }, { mainComponent: n } = this._renderContext;
2220
- n.subSceneChanged$.subscribeEvent((o) => {
2221
- t(o);
2222
- });
2223
- const s = Array.from(n.getSubScenes().values());
2224
- for (let o = 0; o < s.length; o++) {
2225
- const c = s[o];
2226
- t(c);
2227
- }
2228
- }
2229
- pickOtherObjects() {
2230
- this.endEditing();
2231
- }
2232
- /**
2233
- * invoked when picking other object.
2234
- *
2235
- * save editing state to curr richText.
2236
- */
2237
- endEditing() {
2238
- var s;
2239
- if (!this._curRichText) return;
2240
- this.setEditorVisible(!1);
2241
- const e = this._curRichText;
2242
- if (!this._instanceSrv.getCurrentUnitForType(E.UNIVER_SLIDE)) return !1;
2243
- e.refreshDocumentByDocData(), e.resizeToContentSize(), this._editorBridgeService.endEditing$.next(e);
2244
- const n = {
2245
- bl: 1,
2246
- fs: e.fs,
2247
- text: e.text
2248
- }, r = (s = e.documentData.body) == null ? void 0 : s.textRuns;
2249
- if (r && r.length) {
2250
- const c = r[0].ts;
2251
- n.cl = c == null ? void 0 : c.cl;
2252
- }
2253
- this._commandService.executeCommand(B.id, {
2254
- unitId: this._renderContext.unitId,
2255
- oKey: e == null ? void 0 : e.oKey,
2256
- props: {
2257
- richText: n
2258
- }
2259
- }), this._curRichText = null;
2260
- }
2261
- /**
2262
- * TODO calling twice ????
2263
- * editingParam derives from RichText object.
2264
- *
2265
- * TODO @lumixraku need scale param
2266
- * @param target
2267
- */
2268
- startEditing(e, t) {
2269
- this._setEditorRect(e, t), this.setEditorVisible(!0);
2270
- }
2271
- setEditorVisible(e) {
2272
- var n, r;
2273
- e ? (n = this._curRichText) == null || n.hide() : (r = this._curRichText) == null || r.show();
2274
- const { unitId: t } = this._renderContext;
2275
- this._editorBridgeService.changeVisible({ visible: e, eventType: Y.PointerDown, unitId: t });
2276
- }
2277
- };
2278
- We = ki([
2279
- je(1, w),
2280
- je(2, N),
2281
- je(3, et)
2282
- ], We);
2283
- var zi = Object.getOwnPropertyDescriptor, Ki = (i, e, t, n) => {
2284
- for (var r = n > 1 ? void 0 : n ? zi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2285
- (o = i[s]) && (r = o(r) || r);
2286
- return r;
2287
- }, Ie = (i, e) => (t, n) => e(t, n, i);
2288
- function Zi(i, e) {
2289
- const t = Ct(i.left, i.top, e), n = Ct(i.right, i.bottom, e);
2290
- return {
2291
- left: t.x,
2292
- top: t.y,
2293
- right: n.x,
2294
- bottom: n.y
2295
- };
2296
- }
2297
- function Ct(i, e, t) {
2298
- const { scaleX: n, scaleY: r } = t.getAncestorScale(), s = t.getViewport(re.VIEW);
2299
- if (!s)
2300
- return {
2301
- x: i,
2302
- y: e
2303
- };
2304
- const { viewportScrollX: o, viewportScrollY: c } = s, a = (i - o) * n, u = (e - c) * r;
2305
- return {
2306
- x: a,
2307
- y: u
2308
- };
2309
- }
2310
- let Pe = class extends Ne {
2311
- constructor(i, e, t, n) {
2312
- super(), this._globalPopupManagerService = i, this._renderManagerService = e, this._univerInstanceService = t, this._commandService = n;
2313
- }
2314
- _createObjectPositionObserver(i, e) {
2315
- const n = (() => {
2316
- var A, L, Q, ee;
2317
- const { scene: o, engine: c } = e, { left: a, top: u, width: l, height: d } = i, v = (o.width - ((L = (A = e.mainComponent) == null ? void 0 : A.width) != null ? L : 0)) / 2, _ = (o.height - ((ee = (Q = e.mainComponent) == null ? void 0 : Q.height) != null ? ee : 0)) / 2, f = {
2318
- left: a,
2319
- right: a + l,
2320
- top: u,
2321
- bottom: u + d
2322
- }, p = c.getCanvasElement(), h = p.getBoundingClientRect(), m = Rn(p.style.width), { scaleX: I, scaleY: b } = o.getAncestorScale(), T = Zi(f, o), { top: M, left: U, width: x } = h, W = x / m;
2323
- return {
2324
- left: T.left * W * I + U + v,
2325
- right: T.right * W * I + U + v,
2326
- top: T.top * W * b + M + _,
2327
- bottom: T.bottom * W * b + M + _
2328
- };
2329
- })(), r = new q(n), s = new Ke();
2330
- return {
2331
- position: n,
2332
- position$: r,
2333
- disposable: s
2334
- };
2335
- }
2336
- attachPopupToObject(i, e) {
2337
- const n = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE).getUnitId(), r = this._renderManagerService.getRenderById(n);
2338
- if (!r)
2339
- return {
2340
- dispose: () => {
2341
- }
2342
- };
2343
- const { position: s, position$: o, disposable: c } = this._createObjectPositionObserver(i, r), a = this._globalPopupManagerService.addPopup({
2344
- ...e,
2345
- unitId: n,
2346
- subUnitId: "default",
2347
- anchorRect: s,
2348
- anchorRect$: o,
2349
- canvasElement: r.engine.getCanvasElement()
2350
- });
2351
- return {
2352
- dispose: () => {
2353
- this._globalPopupManagerService.removePopup(a), o.complete(), c.dispose();
2354
- }
2355
- };
2356
- }
2357
- };
2358
- Pe = Ki([
2359
- Ie(0, z(Ln)),
2360
- Ie(1, K),
2361
- Ie(2, w),
2362
- Ie(3, N)
2363
- ], Pe);
2364
- var Gi = Object.getOwnPropertyDescriptor, Xi = (i, e, t, n) => {
2365
- for (var r = n > 1 ? void 0 : n ? Gi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2366
- (o = i[s]) && (r = o(r) || r);
2367
- return r;
2368
- }, X = (i, e) => (t, n) => e(t, n, i);
2369
- let Te = class extends fe {
2370
- constructor(e, t, n, r, s, o, c) {
2371
- super();
2372
- S(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
2373
- this._canvasPopManagerService = e, this._renderManagerService = t, this._univerInstanceService = n, this._contextService = r, this._canvasView = s, this._sidebarService = o, this._commandService = c, this._init();
2374
- }
2375
- _init() {
2376
- this._univerInstanceService.getAllUnitsForType(E.UNIVER_SLIDE).forEach((e) => this._create(e));
2377
- }
2378
- _create(e) {
2379
- if (!e)
2380
- return;
2381
- const t = e.getUnitId();
2382
- this._renderManagerService.has(t) && !this._initImagePopupMenu.has(t) && (this._popupMenuListener(t), this._initImagePopupMenu.add(t));
2383
- }
2384
- _hasCropObject(e) {
2385
- }
2386
- // eslint-disable-next-line max-lines-per-function
2387
- _popupMenuListener(e) {
2388
- var r;
2389
- const t = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE), n = (r = t == null ? void 0 : t.getPages()) != null ? r : {};
2390
- Object.keys(n).forEach((s) => {
2391
- var u;
2392
- const c = (u = this._canvasView.getRenderUnitByPageId(s, e).scene) == null ? void 0 : u.getTransformer();
2393
- if (!c) return;
2394
- let a;
2395
- this.disposeWithMe(
2396
- yt(
2397
- c.createControl$.subscribe(() => {
2398
- const l = c.getSelectedObjectMap();
2399
- if (l.size > 1) {
2400
- a == null || a.dispose();
2401
- return;
2402
- }
2403
- const d = l.values().next().value;
2404
- if (!d)
2405
- return;
2406
- const v = d.oKey;
2407
- a == null || a.dispose(), a = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(d, {
2408
- componentKey: Jt,
2409
- direction: "horizontal",
2410
- offset: [2, 0],
2411
- extraProps: {
2412
- menuItems: this._getMenuItemsByObjectType(d.objectType, v, e)
2413
- }
2414
- })), this._sidebarService.visible && this._commandService.executeCommand($e.id, {
2415
- visible: !0,
2416
- objectType: d.objectType
2417
- });
2418
- })
2419
- )
2420
- ), this.disposeWithMe(
2421
- c.clearControl$.subscribe(() => {
2422
- a == null || a.dispose(), this._contextService.setContextValue(Cn, !1);
2423
- })
2424
- ), this.disposeWithMe(
2425
- c.changing$.subscribe(() => {
2426
- a == null || a.dispose();
2427
- const l = c.getSelectedObjectMap();
2428
- if (l.size > 1) {
2429
- a == null || a.dispose();
2430
- return;
2431
- }
2432
- const d = l.values().next().value;
2433
- d && this._commandService.executeCommand(B.id, {
2434
- unitId: e,
2435
- oKey: d.oKey,
2436
- props: {
2437
- width: d.width,
2438
- height: d.height,
2439
- left: d.left,
2440
- top: d.top
2441
- }
2442
- });
2443
- })
2444
- );
2445
- });
2446
- }
2447
- _getMenuItemsByObjectType(e, t, n) {
2448
- return [{
2449
- label: "slide.popup.edit",
2450
- index: 0,
2451
- commandId: $e.id,
2452
- commandParams: {
2453
- visible: !0,
2454
- objectType: e
2455
- },
2456
- disable: !1
2457
- }, {
2458
- label: "slide.popup.delete",
2459
- index: 5,
2460
- commandId: Lt.id,
2461
- commandParams: {
2462
- id: t,
2463
- unitId: n
2464
- },
2465
- disable: !1
2466
- }];
2467
- }
2468
- };
2469
- Te = Xi([
2470
- X(0, z(Pe)),
2471
- X(1, K),
2472
- X(2, w),
2473
- X(3, _e),
2474
- X(4, z(P)),
2475
- X(5, Mt),
2476
- X(6, N)
2477
- ], Te);
2478
- var Yi = Object.getOwnPropertyDescriptor, qi = (i, e, t, n) => {
2479
- for (var r = n > 1 ? void 0 : n ? Yi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2480
- (o = i[s]) && (r = o(r) || r);
2481
- return r;
2482
- }, Ae = (i, e) => (t, n) => e(t, n, i);
2483
- let Me = class extends fe {
2484
- // private _skeletonChangeMutations = new Set<string>();
2485
- constructor(i, e, t) {
2486
- super(), this._contextService = i, this._instanceSrv = e, this._renderManagerService = t, Promise.resolve().then(() => this._init());
2487
- }
2488
- _init() {
2489
- this._initSlideDataListener(), this._initContextListener();
2490
- }
2491
- _initSlideDataListener() {
2492
- this._instanceSrv.getTypeOfUnitAdded$(E.UNIVER_SLIDE).pipe(ht(this.dispose$)).subscribe((i) => {
2493
- this._createRenderer(i == null ? void 0 : i.getUnitId());
2494
- }), this._instanceSrv.getAllUnitsForType(E.UNIVER_SLIDE).forEach((i) => {
2495
- this._createRenderer(i.getUnitId());
2496
- }), this._instanceSrv.getTypeOfUnitDisposed$(E.UNIVER_SLIDE).pipe(ht(this.dispose$)).subscribe((i) => this._disposeRenderer(i));
2497
- }
2498
- _createRenderer(i) {
2499
- i == null || this._instanceSrv.getUnit(i, E.UNIVER_SLIDE) == null || this._renderManagerService.createRender(i);
2500
- }
2501
- _disposeRenderer(i) {
2502
- const e = i.getUnitId();
2503
- this._renderManagerService.removeRender(e);
2504
- }
2505
- _initContextListener() {
2506
- }
2507
- };
2508
- Me = qi([
2509
- Ae(0, _e),
2510
- Ae(1, w),
2511
- Ae(2, K)
2512
- ], Me);
2513
- var Ji = Object.getOwnPropertyDescriptor, Qi = (i, e, t, n) => {
2514
- for (var r = n > 1 ? void 0 : n ? Ji(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2515
- (o = i[s]) && (r = o(r) || r);
2516
- return r;
2517
- }, be = (i, e) => (t, n) => e(t, n, i), ne;
2518
- let St = (ne = class extends Sn {
2519
- constructor(i = ft, e, t, n, r) {
2520
- super(), this._config = i, this._injector = e, this._renderManagerService = t, this._univerInstanceService = n, this._configService = r;
2521
- const { menu: s, ...o } = It(
2522
- {},
2523
- ft,
2524
- this._config
2525
- );
2526
- s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(ji, o);
2527
- }
2528
- onStarting() {
2529
- nt([
2530
- [Me],
2531
- [et, { useClass: He }],
2532
- // used by SlideUIController --> EditorContainer
2533
- [Qe, { useClass: wi }],
2534
- [Pe]
2535
- ], this._config.override).forEach((i) => this._injector.add(i));
2536
- }
2537
- onReady() {
2538
- [
2539
- // SlideRenderService will be init in ready stage, and then calling RenderManagerService@createRender --> init all deps in this rendering register block.
2540
- [pe]
2541
- ].forEach((i) => {
2542
- this.disposeWithMe(this._renderManagerService.registerRenderModule(E.UNIVER_SLIDE, i));
2543
- }), nt([
2544
- [P],
2545
- // cannot register in _renderManagerService now.
2546
- // [ISlideEditorBridgeService, { useClass: SlideEditorBridgeService }],
2547
- // // used by SlideUIController --> EditorContainer
2548
- // [ISlideEditorManagerService, { useClass: SlideEditorManagerService }],
2549
- // SlidesUIController controller should be registered in Ready stage.
2550
- // SlidesUIController controller would add a new RenderUnit (__INTERNAL_EDITOR__DOCS_NORMAL)
2551
- [ye],
2552
- // editor service was create in renderManagerService
2553
- [pe],
2554
- [Te]
2555
- ], this._config.override).forEach((i) => {
2556
- this._injector.add(i);
2557
- }), this._injector.get(P), this._injector.get(Me);
2558
- }
2559
- onRendered() {
2560
- [
2561
- // need slideEditorBridgeService
2562
- // need TextSelectionRenderService which init by EditorContainer
2563
- [We],
2564
- [Fe]
2565
- ].forEach((i) => {
2566
- this.disposeWithMe(this._renderManagerService.registerRenderModule(E.UNIVER_SLIDE, i));
2567
- }), this._markSlideAsFocused(), this._injector.get(ye);
2568
- }
2569
- onSteady() {
2570
- this._injector.get(Te);
2571
- }
2572
- _markSlideAsFocused() {
2573
- const i = this._univerInstanceService;
2574
- try {
2575
- const e = i.getCurrentUnitForType(E.UNIVER_SLIDE);
2576
- i.focusUnit(e.getUnitId());
2577
- } catch {
2578
- }
2579
- }
2580
- }, S(ne, "pluginName", "UNIVER_SLIDES_UI_PLUGIN"), S(ne, "packageName", pt.name), S(ne, "version", pt.version), S(ne, "type", E.UNIVER_SLIDE), ne);
2581
- St = Qi([
2582
- be(1, z(ke)),
2583
- be(2, K),
2584
- be(3, w),
2585
- be(4, In)
2586
- ], St);
2587
- export {
2588
- jt as ActivateSlidePageOperation,
2589
- At as AppendSlideOperation,
2590
- P as CanvasView,
2591
- Lt as DeleteSlideElementOperation,
2592
- et as ISlideEditorBridgeService,
2593
- Ge as InsertSlideFloatImageCommand,
2594
- qe as InsertSlideShapeEllipseCommand,
2595
- Xt as InsertSlideShapeEllipseOperation,
2596
- Ye as InsertSlideShapeRectangleCommand,
2597
- Gt as InsertSlideShapeRectangleOperation,
2598
- en as SHAPE_MENU_ID,
2599
- Qt as SLIDES_IMAGE_MENU_ID,
2600
- he as SLIDE_EDITOR_ID,
2601
- qt as SetSlidePageThumbOperation,
2602
- Je as SlideAddTextCommand,
2603
- Yt as SlideAddTextOperation,
2604
- Pe as SlideCanvasPopMangerService,
2605
- yi as SlideEditorContainer,
2606
- mi as SlideSideBar,
2607
- ye as SlidesUIController,
2608
- Oi as SlidesUIMenuSchema,
2609
- St as UniverSlidesUIPlugin,
2610
- B as UpdateSlideElementOperation
2611
- };
1
+ import{BasicShapes as e,CommandType as t,DEFAULT_EMPTY_DOCUMENT_VALUE as n,Direction as r,Disposable as i,DisposableCollection as a,DocumentDataModel as o,DocumentFlavor as s,EDITOR_ACTIVATED as c,FOCUSING_COMMON_DRAWINGS as l,FOCUSING_EDITOR_BUT_HIDDEN as u,FOCUSING_EDITOR_STANDALONE as d,FOCUSING_UNIVER_EDITOR as f,FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as p,FORMULA_EDITOR_ACTIVATED as m,HorizontalAlign as h,ICommandService as g,IConfigService as _,IContextService as v,IUndoRedoService as y,IUniverInstanceService as b,Inject as x,Injector as S,LocaleService as C,PageElementType as w,Plugin as T,RxDisposable as E,UniverInstanceType as D,VerticalAlign as O,WrapStrategy as k,createIdentifier as ee,createInternalEditorID as te,debounce as ne,generateRandomId as re,getColorStyle as ie,merge as ae,mergeOverrideWithDependencies as oe,toDisposable as se}from"@univerjs/core";import{DeviceInputEventType as A,FIX_ONE_PIXEL_BLUR_OFFSET as j,IRenderManagerService as M,ObjectType as ce,Rect as le,Scene as ue,ScrollBar as de,Slide as fe,Viewport as pe,convertTextRotation as me,fixLineWidthByScale as he,getCurrentTypeOfRenderer as ge,pxToNum as _e}from"@univerjs/engine-render";import{ObjectProvider as ve,SLIDE_KEY as N}from"@univerjs/slides";import{DRAWING_IMAGE_ALLOW_IMAGE_LIST as ye,IImageIoService as be,getImageSize as xe}from"@univerjs/drawing";import{BuiltInUIPart as Se,ComponentManager as Ce,DISABLE_AUTO_FOCUS_KEY as we,ICanvasPopupService as Te,ILayoutService as Ee,ILocalFileService as De,IMenuManagerService as Oe,IShortcutService as ke,ISidebarService as Ae,IUIPartsService as je,KeyCode as P,MenuItemType as F,MetaKeys as Me,RibbonStartGroup as Ne,connectInjector as Pe,getMenuHiddenObservable as I,useDependency as L,useObservable as Fe}from"@univerjs/ui";import{Button as Ie,ColorPicker as Le,Dropdown as Re,InputNumber as ze,borderClassName as Be,borderTopClassName as Ve,clsx as R,scrollbarClassName as He}from"@univerjs/design";import{AutofillDoubleIcon as Ue,BottomIcon as We,GraphIcon as Ge,MoreDownIcon as Ke,MoveDownIcon as qe,MoveUpIcon as Je,PaintBucketDoubleIcon as Ye,TextIcon as Xe,TopmostIcon as Ze}from"@univerjs/icons";import{jsx as z,jsxs as B}from"react/jsx-runtime";import{createRef as Qe,useCallback as $e,useEffect as V,useMemo as et,useRef as tt,useState as H}from"react";import{DOCS_COMPONENT_MAIN_LAYER_INDEX as nt,DOCS_VIEW_KEY as rt,DeleteLeftCommand as it,DocSelectionRenderService as at,IEditorService as ot,MoveCursorOperation as st,MoveSelectionOperation as ct,VIEWPORT_KEY as lt}from"@univerjs/docs-ui";import{BehaviorSubject as U,Subject as ut,filter as dt,takeUntil as ft}from"rxjs";import{DocSelectionManagerService as pt,DocSkeletonManagerService as mt,RichTextEditingMutation as ht}from"@univerjs/docs";function W(e){"@babel/helpers - typeof";return W=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},W(e)}function gt(e,t){if(W(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(W(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function _t(e){var t=gt(e,`string`);return W(t)==`symbol`?t:t+``}function G(e,t,n){return(t=_t(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(e,t){return function(n,r){t(n,r,e)}}function q(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let vt=class extends E{constructor(e,t,n,r){super(),this._renderContext=e,this._injector=t,this._univerInstanceService=n,this._renderManagerService=r,G(this,`_objectProvider`,null),G(this,`_refreshThumb`,ne(()=>{this.createThumbs()},300)),this._objectProvider=this._injector.createInstance(ve),this._addNewRender()}_addNewRender(){let{unitId:e,engine:t,scene:n}=this._renderContext,r=this._getCurrUnitModel();if(!r)return;let i=t.onTransformChange$.subscribeEvent(()=>{this._scrollToCenter(),i==null||i.unsubscribe()});t.onTransformChange$.subscribeEvent(()=>{setTimeout(()=>{this.createThumbs()},300)});let a=new pe(N.VIEW,n,{left:0,top:0,bottom:0,right:0,explicitViewportWidthSet:!1,explicitViewportHeightSet:!1,isWheelPreventDefaultX:!0});n.attachControl(),n.onMouseWheel$.subscribeEvent((e,t)=>{let r=e;if(r.ctrlKey){let e=Math.abs(r.deltaX),t=e<40?.2:e<80?.4:.2;t*=r.deltaY>0?-1:1,n.scaleX<1&&(t/=2),n.scaleX+t>4?n.scale(4,4):n.scaleX+t<.1?n.scale(.1,.1):(r.deltaY,r.preventDefault())}else a.onMouseWheel(r,t)}),n.onFileLoaded$.subscribeEvent(()=>{this._refreshThumb()}),de.attachTo(a);let o=this._createSlide(n);this._renderContext.mainComponent=o,this._createSlidePages(r,o),this.createThumbs(),t.runRenderLoop(()=>{n.render()})}_scrollToCenter(){var e;let t=(e=this._currentRender())==null?void 0:e.scene,n=t==null?void 0:t.getViewport(N.VIEW),r=this._getCenterPositionViewPort(t);if(!n||!r)return;let{left:i,top:a}=r,{x:o,y:s}=n.transViewportScroll2ScrollValue(i,a);n.scrollToBarPos({x:o,y:s})}_currentRender(){return ge(D.UNIVER_SLIDE,this._univerInstanceService,this._renderManagerService)}_createSlide(e){let t=this._univerInstanceService.getCurrentUnitForType(D.UNIVER_SLIDE),{width:n,height:r}=e,{width:i=100,height:a=100}=t.getPageSize(),o=new fe(N.COMPONENT,{left:(n-i)/2,top:(r-a)/2,width:i,height:a,zIndex:10});return o.enableSelectedClipElement(),e.addObject(o),o}_addBackgroundRect(e,t){let{width:n=0,height:r=0}=this._univerInstanceService.getCurrentUnitForType(D.UNIVER_SLIDE).getPageSize(),i=new le(`canvas`,{left:0,top:0,width:n,height:r,strokeWidth:1,stroke:`rgba(198,198,198,1)`,fill:ie(t)||`rgba(255,255,255,1)`,zIndex:0,evented:!1});e.addObject(i,0)}_getCenterPositionViewPort(e){if(!e)return{left:0,top:0};let{width:t,height:n}=e,r=e.getEngine(),i=(r==null?void 0:r.width)||0,a=(r==null?void 0:r.height)||0;return{left:(t-i)/2,top:(n-a)/2}}_thumbSceneRender(e,t){let n=this._renderManagerService.getRenderById(e);if(n==null)return;let{engine:r}=n;if(r==null)return;let{width:i,height:a}=t,{width:o=i,height:s=a}=r,c=r.getCanvas().getContext();t.renderToThumb(c,e,o/i,s/a)}_createSlidePages(e,t){let n=e.getPages(),r=e.getPageOrder();if(!(!n||!r)&&r.length!==0){for(let e=0,t=r.length;e<t;e++){let t=r[e];this.createPageScene(t,n[t]),this._createThumb(t)}t.activeFirstPage()}}_createThumb(e){this._renderManagerService.createRender(e)}_getCurrUnitModel(){return this._renderContext.unit}activePage(e){let t=e,n=this._getCurrUnitModel(),r;if(t)r=n.getPage(t);else{let e=n.getPages(),i=n.getPageOrder();if(i==null||e==null)return;r=e[i[0]],t=r.id}let i=this._currentRender();if(r==null||i==null||i.mainComponent==null)return;let{id:a}=r,o=i.mainComponent;if(n.setActivePage(r),o!=null&&o.hasPage(a)){o.changePage(a);return}this.createPageScene(a,r)}createThumbs(){let e=this._getCurrUnitModel().getPageOrder(),t=this._currentRender();if(!(!e||!t)&&e.length!==0)for(let n=0,r=e.length;n<r;n++){let r=e[n];this._thumbSceneRender(r,t.mainComponent)}}createPageScene(e,t){let n=this._renderContext;if(!n||!this._objectProvider)return;let{scene:r,mainComponent:i}=n,a=i,{width:o,height:s}=a,c=new ue(e,a,{width:o,height:s});new pe(`PageViewer_${e}`,c,{left:0,top:0,bottom:0,right:0,explicitViewportWidthSet:!1,explicitViewportHeightSet:!1}).closeClip();let{pageElements:l,pageBackgroundFill:u}=t,d=this._objectProvider.convertToRenderObjects(l,r);if(!d||!a)return;this._addBackgroundRect(c,u),c.addObjects(d),c.initTransformer(),d.forEach(e=>{c.attachTransformerTo(e)});let f=c.getTransformer();return f==null||f.changeEnd$.subscribe(()=>{this._thumbSceneRender(e,a)}),f==null||f.clearControl$.subscribe(()=>{this._thumbSceneRender(e,a)}),a.addPageScene(c),c}getPageRenderUnit(e){let t=this._renderContext.mainComponent.getSubScenes().get(e),{engine:n,unit:r}=this._renderContext;return{scene:t,engine:n,unit:r}}createObjectToPage(e,t){let{scene:n}=this.getPageRenderUnit(t);if(!n||!this._objectProvider)return;let r=this._objectProvider.convertToRenderObject(e,n);if(r)return n.addObject(r),n.attachTransformerTo(r),n.getLayer().makeDirty(),r}setObjectActiveByPage(e,t){let{scene:n}=this.getPageRenderUnit(t);if(!n)return;let r=n.getTransformer();r==null||r.activeAnObject(e)}removeObjectById(e,t){let{scene:n}=this.getPageRenderUnit(t);if(!n)return;n.removeObject(e);let r=n.getTransformer();r==null||r.clearControls()}appendPage(){let e=this._getCurrUnitModel(),t=e.getBlankPage(),n=this._currentRender();if(t==null||n==null||n.mainComponent==null)return;let{id:r}=t,i=n.mainComponent,a=this.createPageScene(r,t);i&&a&&i.addPageScene(a),e.appendPage(t),e.setActivePage(t)}};vt=q([K(1,x(S)),K(2,b),K(3,M)],vt);let J=class extends E{constructor(e){super(),this._renderManagerService=e}_getSlideRenderControllerFromRenderUnit(e){return this._renderManagerService.getRenderById(e).with(vt)}createThumbs(e){this._getSlideRenderControllerFromRenderUnit(e).createThumbs()}activePage(e,t){this._getSlideRenderControllerFromRenderUnit(t).activePage(e)}getRenderUnitByPageId(e,t){return this._getSlideRenderControllerFromRenderUnit(t).getPageRenderUnit(e)}createObjectToPage(e,t,n){return this._getSlideRenderControllerFromRenderUnit(n).createObjectToPage(e,t)}setObjectActiveByPage(e,t,n){return this._getSlideRenderControllerFromRenderUnit(n).setObjectActiveByPage(e,t)}removeObjectById(e,t,n){this._getSlideRenderControllerFromRenderUnit(n).removeObjectById(e,t)}appendPage(e){this._getSlideRenderControllerFromRenderUnit(e).appendPage()}};J=q([K(0,M)],J);const yt={id:`slide.operation.activate-slide`,type:t.OPERATION,handler:(e,t)=>{var n,r;let i=t.unitId,a=e.get(J),o=e.get(b).getUnit(i),s=o==null||(n=o.getActivePage())==null?void 0:n.id;if(!s)return!1;let c=a.getRenderUnitByPageId(s,i);if(!c)return!1;let l=(r=c.scene)==null?void 0:r.getTransformer();return l&&l.clearControls(),a.activePage(t.id,i),!0}},bt={id:`slide.operation.append-slide`,type:t.OPERATION,handler:(e,t)=>{let n=t.unitId;return e.get(b).getUnit(n)?(e.get(J).appendPage(n),!0):!1}},xt={id:`slide.operation.delete-element`,type:t.OPERATION,handler:(e,t)=>{if(!(t!=null&&t.id))return!1;let n=t.unitId,r=e.get(b).getUnit(n);if(!r)return!1;let i=r.getActivePage();return delete i.pageElements[t.id],r.updatePage(i.id,i),e.get(J).removeObjectById(t.id,i.id,n),!0}},St={id:`slide.command.insert-float-image`,type:t.COMMAND,handler:async(e,t)=>{var n;let r=e.get(b),i=(n=r.getCurrentUnitForType(D.UNIVER_SLIDE))==null?void 0:n.getUnitId();if(!i)return!1;let a=await e.get(De).openFile({multiple:!0,accept:ye.map(e=>`.${e.replace(`image/`,``)}`).join(`,`)});if(a.length!==1)return!1;let o=await e.get(be).saveImage(a[0]);if(!o)return!1;let{imageId:s,imageSourceType:c,source:l,base64Cache:u}=o,{width:d,height:f,image:p}=await xe(u||``),m=r.getUnit(i);if(!m)return!1;let h=m.getActivePage(),g=Object.values(h.pageElements),_={id:s,zIndex:(g!=null&&g.length?Math.max(...g.map(e=>e.zIndex)):20)+1,left:0,top:0,width:d,height:f,title:``,description:``,type:w.IMAGE,image:{imageProperties:{contentUrl:u,imageSourceType:c,source:l,base64Cache:u,image:p}}};h.pageElements[s]=_,m.updatePage(h.id,h);let v=e.get(J),y=v.createObjectToPage(_,h.id,i);return y&&v.setObjectActiveByPage(y,h.id,i),!0}},Y={id:`slide.operation.update-element`,type:t.OPERATION,handler:(e,t)=>{let{oKey:n,props:r}=t,i=e.get(b),a=t==null?void 0:t.unitId,o=i.getUnit(a);if(!o)return!1;let s=o.getActivePage();return s.pageElements[n]=ae(s.pageElements[n],r),o.updatePage(s.id,s),!0}};var X=function(e){return e[e.forward=0]=`forward`,e[e.backward=1]=`backward`,e[e.front=2]=`front`,e[e.back=3]=`back`,e}(X||{});function Ct(e){let{pageId:t,unitId:n}=e,r=L(C),i=L(J),a=L(g),o=i.getRenderUnitByPageId(t,n),s=o==null?void 0:o.scene;if(!s)return null;let c=s.getTransformer();if(!c)return null;let l=c.getSelectedObjectMap().values().next().value;if(!l)return null;let u=e=>{let[t,r]=s.getAllObjects().reduce(([e,t],n)=>{let r=n.zIndex;return[r<e?r:e,r>t?r:t]},[0,0]),i=l.zIndex;e===X.back?i=t-1:e===X.front?i=r+1:e===X.forward?i=l.zIndex+1:e===X.backward&&(i=l.zIndex-1),l.setProps({zIndex:i}),a.executeCommand(Y.id,{unitId:n,oKey:l==null?void 0:l.oKey,props:{zIndex:i}})};return B(`div`,{className:`univer-relative univer-w-full`,children:[z(`div`,{className:`univer-relative univer-mt-2.5 univer-flex univer-h-full`,children:z(`div`,{className:`
2
+ univer-w-full univer-text-left univer-text-gray-600
3
+ dark:!univer-text-gray-200
4
+ `,children:z(`div`,{children:r.t(`image-panel.arrange.title`)})})}),B(`div`,{className:`univer-relative univer-mt-2.5 univer-flex univer-h-full`,children:[z(`div`,{className:`univer-w-1/2`,children:z(Ie,{onClick:()=>{u(X.forward)},children:B(`span`,{className:`univer-flex univer-items-center univer-gap-1`,children:[z(Je,{}),r.t(`image-panel.arrange.forward`)]})})}),z(`div`,{className:`univer-w-1/2`,children:z(Ie,{onClick:()=>{u(X.backward)},children:B(`span`,{className:`univer-flex univer-items-center univer-gap-1`,children:[z(qe,{}),r.t(`image-panel.arrange.backward`)]})})})]}),B(`div`,{className:`univer-relative univer-mt-2.5 univer-flex univer-h-full`,children:[z(`div`,{className:`univer-w-1/2`,children:z(Ie,{onClick:()=>{u(X.front)},children:B(`span`,{className:`univer-flex univer-items-center univer-gap-1`,children:[z(Ze,{}),r.t(`image-panel.arrange.front`)]})})}),z(`div`,{className:`univer-w-1/2`,children:z(Ie,{onClick:()=>{u(X.back)},children:B(`span`,{className:`univer-flex univer-items-center univer-gap-1`,children:[z(We,{}),r.t(`image-panel.arrange.back`)]})})})]})]})}function wt(e){var t,n;let{pageId:r,unitId:i}=e,a=L(C),o=L(J),s=L(g),c=o.getRenderUnitByPageId(r,i),l=c==null?void 0:c.scene;if(!l)return null;let u=l.getTransformer();if(!u)return null;let d=u.getSelectedObjectMap().values().next().value;if(!d)return null;let[f,p]=H((t=(n=d.fill)==null?void 0:n.toString())==null?``:t);function m(e){d==null||d.setProps({fill:e}),s.executeCommand(Y.id,{unitId:i,oKey:d==null?void 0:d.oKey,props:{shape:{shapeProperties:{shapeBackgroundFill:{rgb:e}}}}}),p(e)}return z(`div`,{className:R(`univer-relative univer-bottom-0 univer-mt-5 univer-w-full`,Ve),children:B(`div`,{className:`univer-relative univer-w-full`,children:[z(`div`,{className:`univer-relative univer-mt-2.5 univer-flex univer-h-full`,children:z(`div`,{className:`
5
+ univer-w-full univer-text-left univer-text-gray-600
6
+ dark:!univer-text-gray-200
7
+ `,children:z(`div`,{children:a.t(`slide.panel.fill.title`)})})}),z(`div`,{className:`univer-relative univer-mt-2.5 univer-flex univer-h-full`,children:z(`div`,{className:`univer-w-1/2`,children:z(Re,{overlay:z(`div`,{className:`univer-rounded-lg univer-p-4`,children:z(Le,{value:`#fff`,onChange:m})}),children:B(`a`,{className:`univer-flex univer-cursor-pointer univer-items-center univer-gap-1`,children:[z(Ye,{className:`univer-fill-primary-600`}),z(Ke,{})]})})})})]})})}function Tt(e){let{pageId:t,unitId:n}=e,r=L(C),i=L(J),a=L(g),o=i.getRenderUnitByPageId(t,n),s=o==null?void 0:o.scene;if(!s)return null;let c=s.getTransformer();if(!c)return null;let l=c.getSelectedObjectMap().values().next().value;if(!l)return null;let{width:u=0,height:d=0,left:f=0,top:p=0,angle:m=0}=l,[h,_]=H(u),[v,y]=H(d),[b,x]=H(f),[S,w]=H(p),[T,E]=H(m),D=e=>{let{objects:t}=e,{width:n=0,height:r=0,left:i=0,top:a=0,angle:o=0}=t.values().next().value;_(n),y(r),x(i),w(a),E(o)};V(()=>{let e=c.changeStart$.subscribe(e=>{D(e)}),t=c.changing$.subscribe(e=>{D(e)});return()=>{t.unsubscribe(),e.unsubscribe()}},[]);function O(e){!e||!l||(a.executeCommand(Y.id,{pageId:t,oKey:l.oKey,props:{width:e}}),l==null||l.resize(e,l.height),_(e),c==null||c.refreshControls())}function k(e){!e||!l||(a.executeCommand(Y.id,{pageId:t,oKey:l.oKey,props:{height:e}}),l==null||l.resize(l.width,e),y(e),c==null||c.refreshControls())}function ee(e){!e||!l||(a.executeCommand(Y.id,{pageId:t,oKey:l.oKey,props:{left:e}}),l==null||l.translate(e,l.top),x(e),c==null||c.refreshControls())}function te(e){!e||!l||(a.executeCommand(Y.id,{pageId:t,oKey:l.oKey,props:{right:e}}),l==null||l.translate(l.left,e),w(e),c==null||c.refreshControls())}function ne(e){!e||!l||(a.executeCommand(Y.id,{pageId:t,oKey:l.oKey,props:{angle:e}}),l==null||l.transformByState({angle:e}),E(e),c==null||c.refreshControls())}return B(`div`,{className:R(`univer-grid univer-gap-2 univer-py-2 univer-text-gray-400`,Ve),children:[z(`header`,{className:`
8
+ univer-text-gray-600
9
+ dark:!univer-text-gray-200
10
+ `,children:z(`div`,{children:r.t(`image-panel.transform.title`)})}),B(`div`,{className:`
11
+ univer-grid univer-grid-cols-3 univer-gap-2
12
+ [&>div]:univer-grid [&>div]:univer-gap-2
13
+ `,children:[B(`div`,{children:[z(`span`,{children:r.t(`image-panel.transform.width`)}),z(ze,{min:1,value:h,onChange:e=>{O(e)}})]}),B(`div`,{children:[z(`span`,{children:r.t(`image-panel.transform.height`)}),z(ze,{min:1,value:v,onChange:e=>{k(e)}})]})]}),B(`div`,{className:`univer-relative univer-mt-2.5 univer-flex univer-h-full`,children:[B(`div`,{children:[z(`span`,{children:r.t(`image-panel.transform.x`)}),z(ze,{min:0,precision:1,value:b,onChange:e=>{ee(e)}})]}),B(`div`,{children:[z(`span`,{children:r.t(`image-panel.transform.y`)}),z(ze,{min:0,precision:1,value:S,onChange:e=>{te(e)}})]}),B(`div`,{children:[z(`span`,{children:r.t(`image-panel.transform.rotate`)}),z(ze,{precision:1,value:T,onChange:ne})]})]})]})}const Et=`COMPONENT_SLIDE_SIDEBAR`;function Dt(){var e,t,n;let r=L(b),i=L(J),a=r.getCurrentUnitForType(D.UNIVER_SLIDE),o=a==null||(e=a.getActivePage())==null?void 0:e.id,s=((t=r.getFocusedUnit())==null?void 0:t.getUnitId())||``;if(!o||!s)return null;let c=(n=i.getRenderUnitByPageId(o,s).scene)==null?void 0:n.getTransformer();if(!c)return null;let l=c.getSelectedObjectMap().values().next().value;return l?B(`section`,{className:`univer-p-2 univer-text-center univer-text-sm`,children:[z(Ct,{pageId:o,unitId:s}),z(Tt,{pageId:o,unitId:s}),l.objectType===ce.RECT&&z(wt,{pageId:o,unitId:s})]}):null}const Ot={id:`slide.command.insert-float-shape.rectangle`,type:t.COMMAND,handler:async e=>{var t;let n=e.get(g),r=(t=e.get(b).getFocusedUnit())==null?void 0:t.getUnitId();return n.executeCommand(kt.id,{unitId:r})}},kt={id:`slide.operation.insert-float-shape.rectangle`,type:t.OPERATION,handler:async(t,n)=>{let r=re(6),i=t.get(b),a=n.unitId,o=i.getUnit(a);if(!o)return!1;let s=o.getActivePage(),c=Object.values(s.pageElements),l={id:r,zIndex:(c!=null&&c.length?Math.max(...c.map(e=>e.zIndex)):20)+1,left:378,top:142,width:250,height:250,title:r,description:``,type:w.SHAPE,shape:{shapeType:e.Rect,text:``,shapeProperties:{shapeBackgroundFill:{rgb:`rgb(0,0,255)`}}}};s.pageElements[r]=l,o.updatePage(s.id,s);let u=t.get(J),d=u.createObjectToPage(l,s.id,a);return d&&u.setObjectActiveByPage(d,s.id,a),!0}},At={id:`sidebar.operation.slide-shape`,type:t.COMMAND,handler:async(e,t)=>{let{visible:n,objectType:r}=t,i=e.get(Ae),a=e.get(C),o=``,s=``;return r===ce.RECT?(o=`slide.sidebar.shape`,s=Et):r===ce.IMAGE?(o=`slide.sidebar.image`,s=Et):r===ce.RICH_TEXT&&(o=`slide.sidebar.text`,s=Et),n?i.open({header:{title:a.t(o)},children:{label:s},onClose:()=>{},width:360}):i.close(),!0}},jt={id:`slide.command.insert-float-shape.ellipse`,type:t.COMMAND,handler:async e=>{var t;let n=e.get(g),r=(t=e.get(b).getFocusedUnit())==null?void 0:t.getUnitId();return n.executeCommand(Mt.id,{unitId:r})}},Mt={id:`slide.operation.insert-float-shape.ellipse`,type:t.OPERATION,handler:async(t,n)=>{let r=re(6),i=t.get(b),a=n.unitId,o=i.getUnit(a);if(!o)return!1;let s=o.getActivePage(),c=Object.values(s.pageElements),l={id:r,zIndex:(c!=null&&c.length?Math.max(...c.map(e=>e.zIndex)):20)+1,left:378,top:142,width:250,height:250,title:r,description:``,type:w.SHAPE,shape:{shapeType:e.Ellipse,text:``,shapeProperties:{radius:100,shapeBackgroundFill:{rgb:`rgb(0,0,255)`}}}};s.pageElements[r]=l,o.updatePage(s.id,s);let u=t.get(J),d=u.createObjectToPage(l,s.id,a);return d&&u.setObjectActiveByPage(d,s.id,a),!0}},Nt={id:`slide.command.add-text`,type:t.COMMAND,handler:async e=>{var t;let n=e.get(g),r=(t=e.get(b).getFocusedUnit())==null?void 0:t.getUnitId();return await n.executeCommand(Pt.id,{unitId:r})}},Pt={id:`slide.operation.add-text`,type:t.OPERATION,handler:async(e,t)=>{let n=t.unitId,r=re(6),i=(t==null?void 0:t.text)||`A New Text`,a=e.get(b).getUnit(n);if(!a)return!1;let o=a.getActivePage(),s=Object.values(o.pageElements),c={id:r,zIndex:(s!=null&&s.length?Math.max(...s.map(e=>e.zIndex)):21)+1,left:230,top:142,width:220,height:40,title:`text`,description:``,type:w.TEXT,richText:{text:i,fs:30,cl:{rgb:`rgb(51, 51, 51)`},bl:1}};o.pageElements[r]=c,a.updatePage(o.id,o);let l=e.get(J),u=l.createObjectToPage(c,o.id,n);return u&&l.setObjectActiveByPage(u,o.id,n),!0}},Ft={id:`slide.operation.set-slide-page-thumb`,type:t.OPERATION,handler:(e,t)=>(e.get(J).createThumbs(t.unitId),!0)};function It(){var e,t;let n=L(b),r=L(g),i=L(M),a=L(C),o=tt(null),s=n.getCurrentUnitForType(D.UNIVER_SLIDE),c=s==null?void 0:s.getPages(),l=s==null?void 0:s.getPageOrder();if(!c||!l)return null;let u=l.map(e=>c[e]),[d,f]=H((e=s==null||(t=s.getActivePage())==null?void 0:t.id)==null?null:e),p=et(()=>u.map(()=>Qe()),[u]);V(()=>{let e=s==null?void 0:s.activePage$.subscribe(e=>{var t;let n=(t=e==null?void 0:e.id)==null?null:t;n&&f(n)});return()=>{e==null||e.unsubscribe()}},[]),V(()=>{p.forEach((e,t)=>{if(e.current){var n;let r=u[t];(n=i.getRenderById(r.id))==null||n.engine.setContainer(e.current)}}),p.length>0&&r.syncExecuteCommand(Ft.id,{unitId:s==null?void 0:s.getUnitId()})},[p,u,i,r,s]);let m=$e(e=>{r.syncExecuteCommand(yt.id,{id:e,unitId:s==null?void 0:s.getUnitId()})},[r,s]),h=$e(()=>{r.syncExecuteCommand(bt.id,{unitId:s==null?void 0:s.getUnitId()})},[r,s]);return z(`aside`,{ref:o,className:R(`
14
+ univer-flex univer-h-full univer-w-64 univer-flex-col univer-overflow-y-auto univer-overflow-x-hidden
15
+ `,He),children:B(`div`,{className:`univer-px-4`,children:[z(`header`,{className:`univer-flex univer-justify-center univer-pt-4`,children:z(`a`,{className:R(`
16
+ univer-box-border univer-block univer-h-8 univer-w-full univer-cursor-pointer
17
+ univer-rounded-md univer-bg-white univer-text-center univer-text-sm univer-leading-8
18
+ univer-transition-colors
19
+ `,Be),onClick:h,children:a.t(`slide.append`)})}),u.map((e,t)=>B(`div`,{className:R(`univer-my-4 univer-flex univer-gap-2`,{"[&>div]:univer-border-primary-600 [&>span]:univer-text-primary-600":e.id===d}),onClick:()=>m(e.id),children:[z(`span`,{children:t+1}),z(`div`,{ref:p[t],className:R(`
20
+ univer-relative univer-box-border univer-h-32 univer-w-52 univer-bg-white
21
+ hover:univer-border-primary-600
22
+ `,Be)})]},e.id))]})})}const Z=te(`SLIDE_EDITOR`),Lt={id:`slide.operation.edit-arrow`,type:t.OPERATION,handler:()=>!0},Rt=`COMPONENT_SLIDE_IMAGE_POPUP_MENU`;function zt(e){var t;let n=(t=e.popup)==null||(t=t.extraProps)==null?void 0:t.menuItems;if(!n)return null;let r=L(g),i=L(C),[a,o]=H(!1),[s,c]=H(!1),l=()=>{c(!0)},u=()=>{c(!1)},d=e=>{o(e)},f=e=>{r.executeCommand(e.commandId,e.commandParams),o(!1)},p=a||s,m=n.filter(e=>!e.disable);return z(`div`,{onMouseEnter:l,onMouseLeave:u,children:z(Re,{align:`start`,overlay:z(`ul`,{className:R(`
23
+ univer-m-0 univer-box-border univer-grid univer-list-none univer-items-center univer-gap-1
24
+ univer-rounded-lg univer-bg-white univer-p-1.5 univer-text-sm univer-shadow-lg
25
+ `,Be),children:m.map(e=>z(`li`,{className:`
26
+ univer-relative univer-box-border univer-flex univer-h-8 univer-cursor-pointer
27
+ univer-items-center univer-rounded univer-text-sm univer-transition-colors
28
+ hover:univer-bg-gray-100
29
+ `,onClick:()=>f(e),children:z(`span`,{className:`univer-px-2 univer-py-1.5 univer-align-middle`,children:i.t(e.label)})},e.index))}),open:a,onOpenChange:d,children:B(`div`,{className:R(`
30
+ univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1
31
+ hover:univer-bg-gray-100
32
+ dark:hover:!univer-bg-gray-800
33
+ `,Be,{"univer-bg-gray-100 dark:!univer-bg-gray-800":a,"univer-bg-white dark:!univer-bg-gray-900":!a}),children:[z(Ue,{className:`
34
+ univer-fill-primary-600 univer-text-gray-900
35
+ dark:!univer-text-white
36
+ `}),p&&z(Ke,{className:`dark:!univer-text-white`})]})})})}const Bt=`slide.menu.image`;function Vt(e){return{id:Bt,type:F.SUBITEMS,icon:`AddImageIcon`,tooltip:`slide.image.insert.title`,hidden$:I(e,D.UNIVER_SLIDE)}}function Ht(e){return{id:St.id,title:`slide.image.insert.float`,type:F.BUTTON,hidden$:I(e,D.UNIVER_SLIDE)}}const Ut=`slide.menu.shape`;function Wt(e){return{id:Ut,type:F.SUBITEMS,icon:`GraphIcon`,tooltip:`slide.shape.insert.title`,hidden$:I(e,D.UNIVER_SLIDE)}}function Gt(e){return{id:Ot.id,title:`slide.shape.insert.rectangle`,type:F.BUTTON,hidden$:I(e,D.UNIVER_SLIDE)}}function Kt(e){return{id:jt.id,title:`slide.shape.insert.ellipse`,type:F.BUTTON,hidden$:I(e,D.UNIVER_SLIDE)}}function qt(e){return{id:Nt.id,type:F.BUTTON,icon:`TextIcon`,tooltip:`slide.text.insert.title`,hidden$:I(e,D.UNIVER_SLIDE)}}const Jt={[Ne.FORMAT]:{[Nt.id]:{order:0,menuItemFactory:qt},[Bt]:{order:0,menuItemFactory:Vt,[St.id]:{order:0,menuItemFactory:Ht}},[Ut]:{order:0,menuItemFactory:Wt,[Ot.id]:{order:0,menuItemFactory:Gt},[jt.id]:{order:0,menuItemFactory:Kt}}}};var Yt=class{constructor(){G(this,`_state`,null),G(this,`_rect`,null),G(this,`_state$`,new U(null)),G(this,`state$`,this._state$.asObservable()),G(this,`_rect$`,new U(null)),G(this,`rect$`,this._rect$.asObservable()),G(this,`_focus`,!1),G(this,`_focus$`,new U(this._focus)),G(this,`focus$`,this._focus$.asObservable())}dispose(){this._state$.complete(),this._state=null,this._rect$.complete(),this._rect=null}setState(e){this._state=e,this._refresh(e)}getRect(){return this._rect}setRect(e){this._rect=e,this._rect$.next(e)}getState(){return this._state}setFocus(e=!1){this._focus=e,this._focus$.next(e)}_refresh(e){this._state$.next(e)}};const Xt=ee(`univer.slide-editor-manager.service`),Zt=-1e3,Qt={width:0,height:0,top:Zt,left:Zt};function $t(){let[e,t]=H({...Qt}),r=L(Xt),i=L(ot),a=L(v),o=Fe(()=>a.subscribeContextValue$(we),!1,void 0,[a,we]);return`${n}`,s.UNSPECIFIED,V(()=>{r.state$.subscribe(e=>{if(e==null)return;let{startX:n=Zt,startY:a=Zt,endX:o=0,endY:s=0,show:c=!1}=e;if(!c)t({...Qt});else{t({width:o-n-j+2,height:s-a-j+2,left:n+j,top:a+j});let e=i.getEditor(Z);if(e==null)return;let{left:c,top:l,width:u,height:d}=e.getBoundingClientRect();r.setRect({left:c,top:l,width:u,height:d})}})},[]),V(()=>{o||r.setFocus(!0)},[o,e]),z(`div`,{className:R(`univer-absolute univer-z-10 univer-box-border univer-flex`,Be),style:{left:e.left,top:e.top,width:e.width,height:e.height}})}function en(e){return e.getContextValue(f)&&e.getContextValue(c)}function tn(e){return e.getContextValue(m)&&e.getContextValue(f)}const nn=[P.ARROW_DOWN,P.ARROW_UP,P.ARROW_LEFT,P.ARROW_RIGHT];[P.ENTER,P.TAB,...nn];function rn(){let e=[];for(let t of nn)e.push({id:Lt.id,binding:t,preconditions:e=>en(e),staticParameters:{visible:!1,eventType:A.Keyboard,keycode:t,isShift:!1}}),e.push({id:Lt.id,binding:t|Me.SHIFT,preconditions:e=>en(e),staticParameters:{visible:!1,eventType:A.Keyboard,keycode:t,isShift:!0}});return e}const an={id:it.id,preconditions:e=>en(e)||tn(e),binding:P.BACKSPACE};let on=class extends i{constructor(e,t,n,r,i,a){super(),this._injector=e,this._menuManagerService=t,this._componentManager=n,this._uiPartsService=r,this._commandService=i,this._shortcutService=a,this._initCommands(),this._initCustomComponents(),this._initUIComponents(),this._initMenus(),this._initShortcuts()}_initMenus(){this._menuManagerService.mergeMenu(Jt)}_initCustomComponents(){let e=this._componentManager;this.disposeWithMe(e.register(`TextIcon`,Xe)),this.disposeWithMe(e.register(`GraphIcon`,Ge)),this.disposeWithMe(e.register(Rt,zt)),this.disposeWithMe(e.register(Et,Dt))}_initCommands(){[bt,yt,Ft,St,Pt,Nt,jt,Mt,kt,Ot,At,xt,Y,Lt].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_initUIComponents(){this.disposeWithMe(this._uiPartsService.registerComponent(Se.LEFT_SIDEBAR,()=>Pe(It,this._injector))),this.disposeWithMe(this._uiPartsService.registerComponent(Se.CONTENT,()=>Pe($t,this._injector)))}_initShortcuts(){[an,...rn()].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};on=q([K(0,x(S)),K(1,Oe),K(2,x(Ce)),K(3,je),K(4,g),K(5,ke)],on);var sn=`@univerjs/slides-ui`,cn=`0.18.0`;const ln=`slides-ui.config`;Symbol(ln);const un={},dn=ee(`univer.slide-editor-bridge.service`);let fn=class extends i{constructor(e,t,n){super(),this._editorService=e,this._contextService=t,this._renderManagerService=n,G(this,`_editorUnitId`,Z),G(this,`_isForceKeepVisible`,!1),G(this,`_editorIsDirty`,!1),G(this,`_currentEditRectState`,null),G(this,`_currentEditRectState$`,new U(null)),G(this,`currentEditRectState$`,this._currentEditRectState$.asObservable()),G(this,`_visibleParam`,{visible:!1,eventType:A.Dblclick,unitId:``}),G(this,`_visible$`,new U(this._visibleParam)),G(this,`visible$`,this._visible$.asObservable()),G(this,`_afterVisible$`,new U(this._visibleParam)),G(this,`afterVisible$`,this._afterVisible$.asObservable()),G(this,`endEditing$`,new ut),G(this,`_currentEditRectInfo`,void 0)}dispose(){super.dispose()}getEditorRect(){return this._currentEditRectInfo}setEditorRect(e){this._currentEditRectInfo=e,this._editorService.getFocusEditor()||(this._editorService.focus(Z),this._contextService.setContextValue(c,!1),this._contextService.setContextValue(d,!1),this._contextService.setContextValue(p,!1));let t=this.getEditRectState();this._currentEditRectState=t,this._currentEditRectState$.next(t)}changeVisible(e){this._visibleParam=e,e.visible&&(this._editorIsDirty=!1),this._visible$.next(this._visibleParam),this._afterVisible$.next(this._visibleParam)}getEditRectState(){let e=Z,t=this._currentEditRectInfo,n=t.unitId,r=t.richTextObj.documentData;r.id=e,r.documentStyle={...r.documentStyle,pageSize:{width:t.richTextObj.width,height:1/0}};let i={documentModel:new o(r),fontString:`document`,textRotation:{a:0,v:0},wrapStrategy:0,verticalAlign:O.TOP,horizontalAlign:h.LEFT,paddingData:{t:0,b:1,l:2,r:2}},a=t.richTextObj.width,s=t.richTextObj.height,c=t.richTextObj.left,l=t.richTextObj.top,u={left:0,top:0},d=this._renderManagerService.getRenderById(n),f=d==null?void 0:d.scene,p=f==null?void 0:f.getViewport(N.VIEW),m=f==null?void 0:f.getObject(N.COMPONENT),g={x:(m==null?void 0:m.left)||0,y:(m==null?void 0:m.top)||0},_=(p==null?void 0:p.viewportScrollX)||0,v=(p==null?void 0:p.viewportScrollY)||0;return u.left=g.x-_,u.top=g.y-v,{position:{startX:c,startY:l,endX:c+a,endY:l+s},scaleX:1,scaleY:1,slideCardOffset:u,unitId:n,editorUnitId:e,documentLayoutObject:i}}changeEditorDirty(e){this._editorIsDirty=e}isVisible(){return this._visibleParam.visible}getEditorDirty(){return this._editorIsDirty}getCurrentEditorId(){return this._editorUnitId}genDocData(e){let t=this.getCurrentEditorId(),n=e.text,r=e.fs;return{id:t,body:{dataStream:`${n}\r\n`,textRuns:[{st:0,ed:n.length}],paragraphs:[{paragraphStyle:{},startIndex:n.length+1}],sectionBreaks:[{startIndex:n.length+2}]},documentStyle:{marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,pageSize:{width:1/0,height:1/0},textStyle:{fs:r},renderConfig:{verticalAlign:O.MIDDLE,centerAngle:0,vertexAngle:0,wrapStrategy:0}},drawings:{},drawingsOrder:[],settings:{zoomRatio:1}}}};fn=q([K(0,ot),K(1,v),K(2,M)],fn);let Q=function(e){return e[e.InitialState=0]=`InitialState`,e[e.StartEditor=1]=`StartEditor`,e[e.CursorChange=2]=`CursorChange`,e}({});const pn=-1e3;let mn=class extends i{constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(),this._renderContext=e,this._layoutService=t,this._undoRedoService=n,this._contextService=r,this._instanceSrv=i,this._renderManagerService=a,this._editorBridgeService=o,this._cellEditorManagerService=s,this._textSelectionManagerService=c,this._commandService=l,this._localService=u,this._editorService=d,G(this,`_cursorChange`,Q.InitialState),G(this,`_isUnitEditing`,!1),G(this,`_d`,void 0),this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(D.UNIVER_SLIDE).subscribe(e=>{e&&e.getUnitId()===this._renderContext.unitId?this._d=this._init():(this._disposeCurrent(),this._isUnitEditing&&(this._handleEditorInvisible({visible:!1,eventType:A.Keyboard,keycode:P.ESC,unitId:this._renderContext.unitId}),this._isUnitEditing=!1))})),this._initEditorVisibilityListener()}dispose(){super.dispose(),this._disposeCurrent()}_disposeCurrent(){var e;(e=this._d)==null||e.dispose(),this._d=null}_init(){let e=new a;return this._subscribeToCurrentCell(e),this._initialKeyboardListener(e),this._initialCursorSync(e),this._listenEditorFocus(e),this._commandExecutedListener(e),setTimeout(()=>{this._cursorStateListener(e)},1e3),e}_initEditorVisibilityListener(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(e=>{e.visible?(this._isUnitEditing=!0,this._handleEditorVisible(e)):this._isUnitEditing&&(this._handleEditorInvisible(e),this._isUnitEditing=!1)}))}_listenEditorFocus(e){let t=this._getEditorObject();t&&e.add(t.document.onPointerDown$.subscribeEvent(()=>{}))}_getEditorSkeleton(e){var t;return(t=this._renderManagerService.getRenderById(e))==null?void 0:t.with(mt).getSkeleton()}_getEditorViewModel(e){var t;return(t=this._renderManagerService.getRenderById(e))==null?void 0:t.with(mt).getViewModel()}_initialCursorSync(e){e.add(this._cellEditorManagerService.focus$.pipe(dt(e=>!!e)).subscribe(()=>{var e;(e=ge(D.UNIVER_DOC,this._instanceSrv,this._renderManagerService))==null||e.with(at).sync()}))}_subscribeToCurrentCell(e){e.add(this._editorBridgeService.currentEditRectState$.subscribe(e=>{var t;if(e==null||this._contextService.getContextValue(d)||this._contextService.getContextValue(p))return;let{position:{startX:n,endX:r},documentLayoutObject:{textRotation:i,wrapStrategy:a,documentModel:o},scaleX:s,editorUnitId:c}=e,{vertexAngle:l}=me(i);o.updateDocumentId(c),a===k.WRAP&&l===0&&o.updateDocumentDataPageSize((r-n)/s),this._instanceSrv.changeDoc(c,o),this._contextService.setContextValue(u,!0),this._textSelectionManagerService.replaceTextRanges([{startOffset:0,endOffset:0}]),(t=ge(D.UNIVER_DOC,this._instanceSrv,this._renderManagerService))==null||t.with(at).activate(pn,pn)}))}_fitTextSize(e,t,n,r,i=1,a=1){let{startX:o,startY:s,endX:c,endY:l}=e,u=r.documentModel;if(u==null)return;let{actualWidth:d,actualHeight:f}=this._predictingSize(e,t,n,r,i,a),{verticalAlign:p,paddingData:m,fill:h}=r,g=c-o,_=l-s;if(g<d&&(g=d),_<f)_=f,u.updateDocumentDataMargin(m);else{let e=0;e=p===O.MIDDLE?(_-f)/2/a:p===O.TOP?m.t||0:(_-f)/a-(m.b||0),e=e<(m.t||0)?m.t||0:e,u.updateDocumentDataMargin({t:e})}n.calculate(),this._editAreaProcessing(g,_,e,t,h,i,a)}_predictingSize(e,t,n,r,i=1,a=1){let{startX:o,endX:s}=e,{textRotation:c,wrapStrategy:l}=r,u=r.documentModel,{vertexAngle:d}=me(c),f=document.body.clientWidth;if(l===k.WRAP&&d===0){let{actualWidth:e,actualHeight:t}=n.getActualSize();return{actualWidth:e*i,actualHeight:t*a}}u==null||u.updateDocumentDataPageSize((f-o-t.left)/i),n.calculate();let p=n.getActualSize(),m=s-o;return m<p.actualWidth*i+5*i&&(m=p.actualWidth*i+5*i),u==null||u.updateDocumentDataPageSize(m/i),u==null||u.updateDocumentRenderConfig({horizontalAlign:h.UNSPECIFIED,cellValueType:void 0}),{actualWidth:m,actualHeight:p.actualHeight*a}}_editAreaProcessing(e,t,n,r,i,a=1,o=1){let s=this._getEditorObject();if(s==null)return;function c(e){return Number.parseInt(e.replace(`px`,``))}let l=this._renderContext.engine.getCanvasElement(),u=l.getBoundingClientRect(),d=c(l.style.width),{top:f,left:p,width:m}=u,h=m/d,{startX:g,startY:_}=n;g+=r.left,_+=r.top;let{document:v,scene:y,engine:b}=s,x=y.getViewport(lt.VIEW_MAIN),S=document.body.clientHeight-_-r.top-4,C=document.body.clientWidth-g-r.left,w=t,T=x==null?void 0:x.getScrollBar();if(w>S)w=S,T==null?x&&new de(x,{enableHorizontal:!1,barSize:8}):x==null||x.resetCanvasSizeAndUpdateScroll();else{var E;T=null,x==null||(E=x.getScrollBar())==null||E.dispose()}e+=(T==null?void 0:T.barSize)||0,e=Math.min(e,C),g-=j,_-=j,this._addBackground(y,e/a,t/o,i);let{scaleX:D,scaleY:O}=y.getPrecisionScale();y.transformByState({width:e*h/a,height:t*h/o,scaleX:a*h,scaleY:o*h}),v.resize(e/a,t/o),setTimeout(()=>{b.resizeBySize(he(e,D),he(w,O))},0);let k=this._layoutService.getContentElement().getBoundingClientRect(),ee=l.getBoundingClientRect();g=g*h+(ee.left-k.left),_=_*h+(ee.top-k.top),this._cellEditorManagerService.setState({startX:g,startY:_,endX:e*h+g,endY:w*h+_,show:!0})}_addBackground(e,t,n,r){let i=`_backgroundRectHelperColor_`,a=e.getObject(i);a==null&&r==null||(a==null?e.addObjects([new le(i,{width:t,height:n,fill:r,evented:!1})],nt):r==null?a.dispose():(a.setProps({fill:r}),a.transformByState({width:t,height:n})))}_handleEditorVisible(e){var t,n;let{eventType:r}=e;this._cursorChange=[A.PointerDown,A.Dblclick].includes(r)?Q.CursorChange:Q.StartEditor;let i=this._editorBridgeService.getEditRectState();if(i==null)return;let{position:a,documentLayoutObject:o,slideCardOffset:s,scaleX:l,scaleY:u,editorUnitId:d,unitId:f}=i,p=this._getEditorObject();if(p==null)return;let{scene:m}=p;this._contextService.setContextValue(c,!0);let{documentModel:h}=o,g=this._getEditorSkeleton(d);if(!g||!h)return;this._fitTextSize(a,s,g,o,l,u);let _=h.getBody().dataStream.length-2||0;(t=m.getViewport(lt.VIEW_MAIN))==null||t.scrollToViewportPos({viewportScrollX:1/0}),this._textSelectionManagerService.replaceTextRanges([{startOffset:_,endOffset:_}]),(n=this._renderManagerService.getRenderById(f))==null||n.scene.resetCursor()}_resetBodyStyle(e,t=!1){e.dataStream=n,e.textRuns!=null&&(e.textRuns.length===1&&!t?(e.textRuns[0].st=0,e.textRuns[0].ed=1):e.textRuns=void 0),e.paragraphs!=null&&(e.paragraphs.length===1?e.paragraphs[0].startIndex=0:e.paragraphs=[{startIndex:0}]),e.sectionBreaks!=null&&(e.sectionBreaks=void 0),e.tables!=null&&(e.tables=void 0),e.customRanges!=null&&(e.customRanges=void 0),e.customBlocks!=null&&(e.customBlocks=void 0)}_initialKeyboardListener(e){}_showEditorByKeyboard(e){}_commandExecutedListener(e){let t=[Lt.id],n=[ht.id];e.add(this._commandService.onCommandExecuted(e=>{this._editorService.getFocusId()===Z&&(t.includes(e.id)&&this._moveCursorCmdHandler(e),n.includes(e.id)&&this._editorBridgeService.isVisible()&&this._editingChangedHandler())}))}_moveCursorCmdHandler(e){let t=e.params,{keycode:n,isShift:r}=t;n!=null&&this._cursorChange===Q.CursorChange?this._moveInEditor(n,r):this._editorBridgeService.changeVisible(t)}_editingChangedHandler(){let e=this._editorBridgeService.getEditorRect();if(!e)return;let t=e.richTextObj;t.refreshDocumentByDocData(),t.resizeToContentSize();let{unitId:n}=this._renderContext;this._handleEditorVisible({visible:!0,eventType:3,unitId:n})}_getEditorObject(){return hn(this._editorBridgeService.getCurrentEditorId(),this._renderManagerService)}async _handleEditorInvisible(e){let{keycode:t}=e;if(this._cursorChange=Q.InitialState,this._exitInput(e),this._editorBridgeService.getEditRectState()!=null){if(this._editorBridgeService.getEditorDirty()===!1){this._moveCursor(t);return}this._moveCursor(t)}}_exitInput(e){this._contextService.setContextValue(c,!1),this._cellEditorManagerService.setState({show:e.visible});let t=this._editorBridgeService.getCurrentEditorId();t!=null&&this._undoRedoService.clearUndoRedo(t)}_moveCursor(e){if(e!=null)switch(r.LEFT,e){case P.ENTER:r.DOWN;break;case P.TAB:r.RIGHT;break;case P.ARROW_DOWN:r.DOWN;break;case P.ARROW_UP:r.UP;break;case P.ARROW_LEFT:r.LEFT;break;case P.ARROW_RIGHT:r.RIGHT;break}}_cursorStateListener(e){let t=this._getEditorObject();if(!t)return;let{document:n}=t;e.add(se(n.onPointerDown$.subscribeEvent(()=>{this._cursorChange===Q.StartEditor&&(this._cursorChange=Q.CursorChange)})))}_moveInEditor(e,t){let n=r.LEFT;e===P.ARROW_DOWN?n=r.DOWN:e===P.ARROW_UP?n=r.UP:e===P.ARROW_RIGHT&&(n=r.RIGHT),t?this._commandService.executeCommand(ct.id,{direction:n}):this._commandService.executeCommand(st.id,{direction:n})}};mn=q([K(1,Ee),K(2,y),K(3,v),K(4,b),K(5,M),K(6,dn),K(7,Xt),K(8,x(pt)),K(9,g),K(10,x(C)),K(11,ot)],mn);function hn(e,t){if(e==null)return;let n=t.getRenderById(e);if(n==null)return;let{mainComponent:r,scene:i,engine:a,components:o}=n;return{document:r,docBackground:o.get(rt.BACKGROUND),scene:i,engine:a}}let gn=class extends E{constructor(e,t,n,r){super(),this._renderContext=e,this._instanceSrv=t,this._commandService=n,this._editorBridgeService=r,G(this,`setSlideTextEditor$`,new ut),G(this,`_curRichText`,null),G(this,`_d`,void 0),this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(D.UNIVER_SLIDE).subscribe(e=>{e&&e.getUnitId()===this._renderContext.unitId?this._d=this._init():this._disposeCurrent()}))}_init(){let e=new a;return this._initEventListener(e),e}_disposeCurrent(){var e;(e=this._d)==null||e.dispose(),this._d=null}_setEditorRect(e,t){this._curRichText=t;let{scene:n,engine:r}=this._renderContext,i={scene:n,engine:r,unitId:this._renderContext.unitId,pageId:e,richTextObj:t};this._editorBridgeService.setEditorRect(i)}_initEventListener(e){let t=t=>{let n=t.getTransformer();n&&(e.add(n.clearControl$.subscribe(()=>{this.setEditorVisible(!1),this.pickOtherObjects()})),e.add(n.createControl$.subscribe(()=>{this.setEditorVisible(!1)})),e.add(t.onDblclick$.subscribeEvent(()=>{n.clearControls();let e=n.getSelectedObjectMap().values().next().value;e&&(e.objectType===ce.RICH_TEXT?this.startEditing(t.sceneKey,e):this.pickOtherObjects())})),e.add(this._instanceSrv.focused$.subscribe(e=>{this.endEditing()})))},{mainComponent:n}=this._renderContext;n.subSceneChanged$.subscribeEvent(e=>{t(e)});let r=Array.from(n.getSubScenes().values());for(let e=0;e<r.length;e++){let n=r[e];t(n)}}pickOtherObjects(){this.endEditing()}endEditing(){var e;if(!this._curRichText)return;this.setEditorVisible(!1);let t=this._curRichText;if(!this._instanceSrv.getCurrentUnitForType(D.UNIVER_SLIDE))return!1;t.refreshDocumentByDocData(),t.resizeToContentSize(),this._editorBridgeService.endEditing$.next(t);let n={bl:1,fs:t.fs,text:t.text},r=(e=t.documentData.body)==null?void 0:e.textRuns;if(r&&r.length){let e=r[0].ts;n.cl=e==null?void 0:e.cl}this._commandService.executeCommand(Y.id,{unitId:this._renderContext.unitId,oKey:t==null?void 0:t.oKey,props:{richText:n}}),this._curRichText=null}startEditing(e,t){this._setEditorRect(e,t),this.setEditorVisible(!0)}setEditorVisible(e){if(e){var t;(t=this._curRichText)==null||t.hide()}else{var n;(n=this._curRichText)==null||n.show()}let{unitId:r}=this._renderContext;this._editorBridgeService.changeVisible({visible:e,eventType:A.PointerDown,unitId:r})}};gn=q([K(1,b),K(2,g),K(3,dn)],gn);function _n(e,t){let n=vn(e.left,e.top,t),r=vn(e.right,e.bottom,t);return{left:n.x,top:n.y,right:r.x,bottom:r.y}}function vn(e,t,n){let{scaleX:r,scaleY:i}=n.getAncestorScale(),a=n.getViewport(N.VIEW);if(!a)return{x:e,y:t};let{viewportScrollX:o,viewportScrollY:s}=a;return{x:(e-o)*r,y:(t-s)*i}}let yn=class extends i{constructor(e,t,n,r){super(),this._globalPopupManagerService=e,this._renderManagerService=t,this._univerInstanceService=n,this._commandService=r}_createObjectPositionObserver(e,t){let n=(()=>{var n,r,i,a;let{scene:o,engine:s}=t,{left:c,top:l,width:u,height:d}=e,f=(o.width-((n=(r=t.mainComponent)==null?void 0:r.width)==null?0:n))/2,p=(o.height-((i=(a=t.mainComponent)==null?void 0:a.height)==null?0:i))/2,m={left:c,right:c+u,top:l,bottom:l+d},h=s.getCanvasElement(),g=h.getBoundingClientRect(),_=_e(h.style.width),{scaleX:v,scaleY:y}=o.getAncestorScale(),b=_n(m,o),{top:x,left:S,width:C}=g,w=C/_;return{left:b.left*w*v+S+f,right:b.right*w*v+S+f,top:b.top*w*y+x+p,bottom:b.bottom*w*y+x+p}})();return{position:n,position$:new U(n),disposable:new a}}attachPopupToObject(e,t){let n=this._univerInstanceService.getCurrentUnitForType(D.UNIVER_SLIDE).getUnitId(),r=this._renderManagerService.getRenderById(n);if(!r)return{dispose:()=>{}};let{position:i,position$:a,disposable:o}=this._createObjectPositionObserver(e,r),s=this._globalPopupManagerService.addPopup({...t,unitId:n,subUnitId:`default`,anchorRect:i,anchorRect$:a,canvasElement:r.engine.getCanvasElement()});return{dispose:()=>{this._globalPopupManagerService.removePopup(s),a.complete(),o.dispose()}}}};yn=q([K(0,x(Te)),K(1,M),K(2,b),K(3,g)],yn);let bn=class extends E{constructor(e,t,n,r,i,a,o){super(),this._canvasPopManagerService=e,this._renderManagerService=t,this._univerInstanceService=n,this._contextService=r,this._canvasView=i,this._sidebarService=a,this._commandService=o,G(this,`_initImagePopupMenu`,new Set),this._init()}_init(){this._univerInstanceService.getAllUnitsForType(D.UNIVER_SLIDE).forEach(e=>this._create(e))}_create(e){if(!e)return;let t=e.getUnitId();this._renderManagerService.has(t)&&!this._initImagePopupMenu.has(t)&&(this._popupMenuListener(t),this._initImagePopupMenu.add(t))}_hasCropObject(e){}_popupMenuListener(e){var t;let n=this._univerInstanceService.getCurrentUnitForType(D.UNIVER_SLIDE),r=(t=n==null?void 0:n.getPages())==null?{}:t;Object.keys(r).forEach(t=>{var n;let r=(n=this._canvasView.getRenderUnitByPageId(t,e).scene)==null?void 0:n.getTransformer();if(!r)return;let i;this.disposeWithMe(se(r.createControl$.subscribe(()=>{let t=r.getSelectedObjectMap();if(t.size>1){i==null||i.dispose();return}let n=t.values().next().value;if(!n)return;let a=n.oKey;i==null||i.dispose(),i=this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(n,{componentKey:Rt,direction:`horizontal`,offset:[2,0],extraProps:{menuItems:this._getMenuItemsByObjectType(n.objectType,a,e)}})),this._sidebarService.visible&&this._commandService.executeCommand(At.id,{visible:!0,objectType:n.objectType})}))),this.disposeWithMe(r.clearControl$.subscribe(()=>{i==null||i.dispose(),this._contextService.setContextValue(l,!1)})),this.disposeWithMe(r.changing$.subscribe(()=>{i==null||i.dispose();let t=r.getSelectedObjectMap();if(t.size>1){i==null||i.dispose();return}let n=t.values().next().value;n&&this._commandService.executeCommand(Y.id,{unitId:e,oKey:n.oKey,props:{width:n.width,height:n.height,left:n.left,top:n.top}})}))})}_getMenuItemsByObjectType(e,t,n){return[{label:`slide.popup.edit`,index:0,commandId:At.id,commandParams:{visible:!0,objectType:e},disable:!1},{label:`slide.popup.delete`,index:5,commandId:xt.id,commandParams:{id:t,unitId:n},disable:!1}]}};bn=q([K(0,x(yn)),K(1,M),K(2,b),K(3,v),K(4,x(J)),K(5,Ae),K(6,g)],bn);let xn=class extends E{constructor(e,t,n){super(),this._contextService=e,this._instanceSrv=t,this._renderManagerService=n,Promise.resolve().then(()=>this._init())}_init(){this._initSlideDataListener(),this._initContextListener()}_initSlideDataListener(){this._instanceSrv.getTypeOfUnitAdded$(D.UNIVER_SLIDE).pipe(ft(this.dispose$)).subscribe(e=>{this._createRenderer(e==null?void 0:e.getUnitId())}),this._instanceSrv.getAllUnitsForType(D.UNIVER_SLIDE).forEach(e=>{this._createRenderer(e.getUnitId())}),this._instanceSrv.getTypeOfUnitDisposed$(D.UNIVER_SLIDE).pipe(ft(this.dispose$)).subscribe(e=>this._disposeRenderer(e))}_createRenderer(e){e!=null&&this._instanceSrv.getUnit(e,D.UNIVER_SLIDE)!=null&&this._renderManagerService.createRender(e)}_disposeRenderer(e){let t=e.getUnitId();this._renderManagerService.removeRender(t)}_initContextListener(){}};xn=q([K(0,v),K(1,b),K(2,M)],xn);let $=class extends T{constructor(e=un,t,n,r,i){super(),this._config=e,this._injector=t,this._renderManagerService=n,this._univerInstanceService=r,this._configService=i;let{menu:a,...o}=ae({},un,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(ln,o)}onStarting(){oe([[xn],[dn,{useClass:fn}],[Xt,{useClass:Yt}],[yn]],this._config.override).forEach(e=>this._injector.add(e))}onReady(){[[vt]].forEach(e=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(D.UNIVER_SLIDE,e))}),oe([[J],[on],[vt],[bn]],this._config.override).forEach(e=>{this._injector.add(e)}),this._injector.get(J),this._injector.get(xn)}onRendered(){[[gn],[mn]].forEach(e=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(D.UNIVER_SLIDE,e))}),this._markSlideAsFocused(),this._injector.get(on)}onSteady(){this._injector.get(bn)}_markSlideAsFocused(){let e=this._univerInstanceService;try{let t=e.getCurrentUnitForType(D.UNIVER_SLIDE);e.focusUnit(t.getUnitId())}catch{}}};G($,`pluginName`,`UNIVER_SLIDES_UI_PLUGIN`),G($,`packageName`,sn),G($,`version`,cn),G($,`type`,D.UNIVER_SLIDE),$=q([K(1,x(S)),K(2,M),K(3,b),K(4,_)],$);export{yt as ActivateSlidePageOperation,bt as AppendSlideOperation,J as CanvasView,xt as DeleteSlideElementOperation,dn as ISlideEditorBridgeService,St as InsertSlideFloatImageCommand,jt as InsertSlideShapeEllipseCommand,Mt as InsertSlideShapeEllipseOperation,Ot as InsertSlideShapeRectangleCommand,kt as InsertSlideShapeRectangleOperation,Ut as SHAPE_MENU_ID,Bt as SLIDES_IMAGE_MENU_ID,Z as SLIDE_EDITOR_ID,Ft as SetSlidePageThumbOperation,Nt as SlideAddTextCommand,Pt as SlideAddTextOperation,yn as SlideCanvasPopMangerService,$t as SlideEditorContainer,It as SlideSideBar,on as SlidesUIController,Jt as SlidesUIMenuSchema,$ as UniverSlidesUIPlugin,Y as UpdateSlideElementOperation};