import { F as F2, H, _ as _2, j, u } from "./chunk-DS5QSAGN.js"; import { $t, Er, Hr, Sn, _s, aE as aE2, ap, dn, dt, gr, me, ni, rt as rt2, tt as tt2, ue, vi } from "./chunk-T4NNB5UY.js"; import { $o, Bn, Br, F, Fn, Gn, Hn, Jn, Js, Kn, Me, Mn, N, Oe, Oo, Pe, Pt as Pt2, Qt, Te, Tt, V, Wo, Xt, Zt as Zt2, an, ea, et, gh, gt, jn as jn2, kr, mt, ne, nt as nt2, oe, on, pt, qn, qt as qt2, sn, tt, ut, yr, zn } from "./chunk-BW43Z7N3.js"; import "./chunk-QRYBFJ3R.js"; import { Vi, rf } from "./chunk-MIOQ566M.js"; import { De, Ke, Kt, cn as cn2, jn, vr, xe } from "./chunk-AGSU7DWG.js"; import { $e, Fa, I1, Le, f1, fl, it, l1, l3, m1, n1, o3, rt } from "./chunk-POAJ2YNP.js"; import { Xw, e_, t_ } from "./chunk-GBYP4PB2.js"; import "./chunk-PZD7N4BC.js"; import { A1, Y, Yx, aS, b3, ff, i2, ie, pf } from "./chunk-2MK3Q52E.js"; import "./chunk-BSDDCPAW.js"; import { _, f } from "./chunk-23GLNZMH.js"; import { At, On, Ut, Yt, Zt, bn, ln, mn, vn, wn } from "./chunk-QG2HZMYH.js"; import { B0, BehaviorSubject, DR, Fe, Hd, Ht, IR, J0, K0, Kp, Mf, Mi, OR, Oa, Ot, Pt, Ra, SE, Sr, Subject, UE, Ve, Vn, Vr, W0, Xp, Ze, _n, aE, am, ar, cn, combineLatest, distinctUntilChanged, en, filter, fm, fs, g0, gm, kt, map, mu, nt, nu, oE, om, ot, qt, re, rr, st, su, switchMap, take, takeUntil, tr, we, wu, yR } from "./chunk-23V3HWTR.js"; import { require_react } from "./chunk-GNR2UJZM.js"; import { __toESM } from "./chunk-2LSFTFF7.js"; // node_modules/.pnpm/@univerjs+sheets-drawing-ui@0.5.5_@grpc+grpc-js@1.13.4_react-dom@18.3.1_react@18.3.1_rxjs@7.8.1_typescript@5.4.5/node_modules/@univerjs/sheets-drawing-ui/lib/es/index.js var import_react = __toESM(require_react()); var vr2 = Object.defineProperty; var Sr2 = (i, e, n) => e in i ? vr2(i, e, { enumerable: true, configurable: true, writable: true, value: n }) : i[e] = n; var J = (i, e, n) => Sr2(i, typeof e != "symbol" ? e + "" : e, n); var Hi = "sheets-drawing-ui.config"; var Cn = {}; var F3 = { id: "sheet.operation.clear-drawing-transformer", type: ar.MUTATION, handler: (i, e) => { const n = i.get(Yx); return e.forEach((t) => { var r, s; (s = (r = n.getRenderById(t)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls(); }), true; } }; var Nt = { id: "sheet.command.remove-sheet-image", type: ar.COMMAND, handler: (i, e) => { var I, S, R; const n = i.get(Pt), t = i.get(cn), r = i.get(V), s = i.get(u); if (!e) return false; const { drawings: o } = e, c = []; o.forEach((v) => { const { unitId: C } = v; c.push(C); }); const d = s.getBatchRemoveOp(o), { unitId: g, subUnitId: a, undo: l, redo: h, objects: u2 } = d, m = r.onCommandExecute({ id: Nt.id, params: e }), p = { id: H.id, params: { unitId: g, subUnitId: a, op: h, objects: u2, type: F2.REMOVE } }, f2 = { id: H.id, params: { unitId: g, subUnitId: a, op: l, objects: u2, type: F2.INSERT } }; return mu([...(I = m.preRedos) != null ? I : [], p, ...m.redos], n) ? (t.pushUndoRedo({ unitID: g, undoMutations: [ ...(S = m.preUndos) != null ? S : [], f2, ...m.undos, { id: F3.id, params: c } ], redoMutations: [ ...(R = m.preRedos) != null ? R : [], p, ...m.redos, { id: F3.id, params: c } ] }), true) : false; } }; var rr2 = "COMPONENT_SHEET_DRAWING_PANEL"; var ir = { id: "sidebar.operation.sheet-image", type: ar.COMMAND, handler: async (i, e) => { const n = i.get(rt), t = i.get(Vr), r = i.get(_n), s = i.get(Pt); if (!N(r)) return false; switch (e.value) { case "open": n.open({ header: { title: t.t("sheetImage.panel.title") }, children: { label: rr2 }, onClose: () => { s.syncExecuteCommand(ln.id, []); }, width: 360 }); break; case "close": default: n.close(); break; } return true; } }; var sr = { id: "sheet.operation.edit-sheet-image", type: ar.OPERATION, handler: (i, e) => { const n = i.get(Pt); return e == null ? false : (n.syncExecuteCommand(ln.id, [e]), n.executeCommand(ir.id, { value: "open" }), true); } }; var Kt2 = { exports: {} }; var Xe = {}; var Rn; function Xi() { if (Rn) return Xe; Rn = 1; var i = import_react.default, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), t = Object.prototype.hasOwnProperty, r = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: true, ref: true, __self: true, __source: true }; function o(c, d, g) { var a, l = {}, h = null, u2 = null; g !== void 0 && (h = "" + g), d.key !== void 0 && (h = "" + d.key), d.ref !== void 0 && (u2 = d.ref); for (a in d) t.call(d, a) && !s.hasOwnProperty(a) && (l[a] = d[a]); if (c && c.defaultProps) for (a in d = c.defaultProps, d) l[a] === void 0 && (l[a] = d[a]); return { $$typeof: e, type: c, key: h, ref: u2, props: l, _owner: r.current }; } return Xe.Fragment = n, Xe.jsx = o, Xe.jsxs = o, Xe; } var bn2; function zi() { return bn2 || (bn2 = 1, Kt2.exports = Xi()), Kt2.exports; } var G = zi(); var Ki = "univer-upload-loading"; var Ji = "univer-upload-loading-body"; var Zi = "univer-upload-loading-body-animation"; var qi = "univer-UniverCircleAnimation"; var Qi = "univer-upload-loading-body-text"; var mt2 = { uploadLoading: Ki, uploadLoadingBody: Ji, uploadLoadingBodyAnimation: Zi, univerCircleAnimation: qi, uploadLoadingBodyText: Qi }; var es = () => { const i = W0(Oa), e = W0(Vr), [n, t] = import_react.default.useState(0); return (0, import_react.useEffect)(() => { const r = i.change$.subscribe((s) => { t(s); }); return () => { r.unsubscribe(); }; }, [i]), G.jsx("div", { style: { display: n > 0 ? "block" : "none" }, className: mt2.uploadLoading, children: G.jsxs("div", { className: mt2.uploadLoadingBody, children: [ G.jsx("div", { className: mt2.uploadLoadingBodyAnimation }), G.jsx("div", { className: mt2.uploadLoadingBodyText, children: `${e.t("uploadLoading.loading")}: ${n}` }) ] }) }); }; var ts = Object.defineProperty; var ns = Object.getOwnPropertyDescriptor; var rs = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? ns(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && ts(e, n, r), r; }; var fe = (i, e) => (n, t) => e(n, t, i); var It = class extends J0 { constructor(e, n, t, r, s, o, c, d) { super(); J(this, "_initImagePopupMenu", /* @__PURE__ */ new Set()); this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = c, this._commandService = d, this._init(); } _init() { this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(Fe.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(Fe.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(Le.CONTENT, () => B0(es, this._injector)); } _dispose(e) { const n = e.getUnitId(); this._renderManagerService.removeRender(n); } _create(e) { if (!e) return; const n = e.getUnitId(); this._renderManagerService.has(n) && !this._initImagePopupMenu.has(n) && (this._popupMenuListener(n), this._initImagePopupMenu.add(n)); } _hasCropObject(e) { const n = e.getAllObjectsByOrder(); for (const t of n) if (t instanceof xe) return true; return false; } _popupMenuListener(e) { var s; const n = (s = this._renderManagerService.getRenderById(e)) == null ? void 0 : s.scene; if (!n) return; const t = n.getTransformerByCreate(); if (!t) return; let r; this.disposeWithMe( Ze( t.createControl$.subscribe(() => { if (this._contextService.setContextValue(yR, true), this._hasCropObject(n)) return; const o = t.getSelectedObjectMap(); if (o.size > 1) { r == null || r.dispose(); return; } const c = o.values().next().value; if (!c) return; const d = c.oKey, g = this._drawingManagerService.getDrawingOKey(d); if (!g) return; const { unitId: a, subUnitId: l, drawingId: h, drawingType: u2 } = g, m = g.data; if (m && m.disablePopup) return; r == null || r.dispose(); const p = this._canvasPopManagerService.getFeatureMenu(a, l, h, u2); r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(c, { componentKey: Kt, direction: "horizontal", offset: [2, 0], extraProps: { menuItems: p || this._getImageMenuItems(a, l, h, u2) } })); }) ) ), this.disposeWithMe( t.clearControl$.subscribe(() => { r == null || r.dispose(), this._contextService.setContextValue(yR, false), this._commandService.syncExecuteCommand(ln.id, []); }) ), this.disposeWithMe( this._contextService.contextChanged$.subscribe((o) => { o[yR] === false && (r == null || r.dispose()); }) ), this.disposeWithMe( t.changing$.subscribe(() => { r == null || r.dispose(); }) ); } _getImageMenuItems(e, n, t, r) { return [ { label: "image-popup.edit", index: 0, commandId: sr.id, commandParams: { unitId: e, subUnitId: n, drawingId: t }, disable: r === gm.DRAWING_DOM }, { label: "image-popup.delete", index: 1, commandId: Nt.id, commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: n, drawingId: t }] }, disable: false }, { label: "image-popup.crop", index: 2, commandId: Ke.id, commandParams: { unitId: e, subUnitId: n, drawingId: t }, disable: r === gm.DRAWING_DOM }, { label: "image-popup.reset", index: 3, commandId: jn.id, commandParams: [{ unitId: e, subUnitId: n, drawingId: t }], disable: r === gm.DRAWING_DOM } ]; } }; It = rs([ fe(0, ot(Ot)), fe(1, Ut), fe(2, ot(vi)), fe(3, Yx), fe(4, _n), fe(5, fs), fe(6, ot(f1)), fe(7, Pt) ], It); function z(i, e, n) { const { from: t, to: r, flipY: s = false, flipX: o = false, angle: c = 0, skewX: d = 0, skewY: g = 0 } = i, a = n.getCurrent(); if (a == null) return; const l = aE2( a.unitId, a.sheetId, { from: t, to: r }, n ); let { left: h, top: u2, width: m, height: p } = l; const f2 = n.getCurrentSkeleton(), w = f2.rowHeaderWidth + f2.columnTotalWidth, I = f2.columnHeaderHeight + f2.rowTotalHeight; return h + m > w && (h = w - m), u2 + p > I && (u2 = I - p), { flipY: s, flipX: o, angle: c, skewX: d, skewY: g, left: h, top: u2, width: m, height: p }; } function k(i, e) { const { left: n = 0, top: t = 0, width: r = 0, height: s = 0, flipY: o = false, flipX: c = false, angle: d = 0, skewX: g = 0, skewY: a = 0 } = i, l = e.getCellWithCoordByOffset(n, t); if (l == null) return; const h = { column: l.actualColumn, columnOffset: ie(n - l.startX, 1), row: l.actualRow, rowOffset: ie(t - l.startY, 1) }, u2 = e.getCellWithCoordByOffset(n + r, t + s); if (u2 == null) return; const m = { column: u2.actualColumn, columnOffset: ie(n + r - u2.startX, 1), row: u2.actualRow, rowOffset: ie(t + s - u2.startY, 1) }; return { flipY: o, flipX: c, angle: d, skewX: g, skewY: a, from: h, to: m }; } var is = Object.defineProperty; var ss = Object.getOwnPropertyDescriptor; var os = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? ss(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && is(e, n, r), r; }; var ft = (i, e) => (n, t) => e(n, t, i); var nn = class extends nt { constructor(i, e, n, t, r) { super(), this._context = i, this._sheetDrawingService = e, this._drawingManagerService = n, this._sheetSelectionRenderService = t, this._sheetSkeletonManagerService = r, this._init(); } _init() { this._drawingInitializeListener(); } _drawingInitializeListener() { this._sheetDrawingService.initializeNotification(this._context.unitId); const i = this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId); for (const e in i) { const n = i[e]; for (const t in n.data) { const r = n.data[t]; r.transform = z(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService); } } this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId); } }; nn = os([ ft(1, u), ft(2, Ut), ft(3, ot(dt)), ft(4, ot(me)) ], nn); function as(i) { const e = []; return i.forEach((n) => { const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: c } = t, d = pf(0, 0, r.map((l) => l.transform || {})), g = r.map((l) => { const h = l.transform || { left: 0, top: 0 }, { unitId: u2, subUnitId: m, drawingId: p } = l; return { unitId: u2, subUnitId: m, drawingId: p, transform: { ...h, left: h.left - d.left, top: h.top - d.top }, groupId: c }; }), a = { unitId: s, subUnitId: o, drawingId: c, drawingType: gm.DRAWING_GROUP, transform: d }; e.push({ parent: a, children: g }); }), e; } function cs(i) { const e = []; return i.forEach((n) => { const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: c, transform: d = { width: 0, height: 0 } } = t; if (d == null) return; const g = r.map((l) => { const { transform: h } = l, { unitId: u2, subUnitId: m, drawingId: p } = l, f2 = ff(h || {}, d, d.width || 0, d.height || 0); return { unitId: u2, subUnitId: m, drawingId: p, transform: f2, groupId: void 0 }; }), a = { unitId: s, subUnitId: o, drawingId: c, drawingType: gm.DRAWING_GROUP, transform: { left: 0, top: 0 } }; e.push({ parent: a, children: g }); }), e; } var or = { id: "sheet.command.group-sheet-image", type: ar.COMMAND, handler: (i, e) => { const n = i.get(Pt), t = i.get(cn), r = i.get(u); if (!e) return false; const s = []; e.forEach(({ parent: u2, children: m }) => { s.push(u2.unitId), m.forEach((p) => { s.push(p.unitId); }); }); const o = r.getGroupDrawingOp(e), { unitId: c, subUnitId: d, undo: g, redo: a, objects: l } = o; return n.syncExecuteCommand(H.id, { op: a, unitId: c, subUnitId: d, objects: l, type: F2.GROUP }) ? (t.pushUndoRedo({ unitID: c, undoMutations: [ { id: H.id, params: { op: g, unitId: c, subUnitId: d, objects: cs(l), type: F2.UNGROUP } }, { id: F3.id, params: s } ], redoMutations: [ { id: H.id, params: { op: a, unitId: c, subUnitId: d, objects: l, type: F2.GROUP } }, { id: F3.id, params: s } ] }), true) : false; } }; var jt = { id: "sheet.command.insert-sheet-image", type: ar.COMMAND, handler: (i, e) => { var I, S, R; const n = i.get(Pt), t = i.get(cn), r = i.get(u), s = i.get(V); if (!e) return false; const o = e.drawings, c = o.map((v) => v.unitId), d = r.getBatchAddOp(o), { unitId: g, subUnitId: a, undo: l, redo: h, objects: u2 } = d, m = s.onCommandExecute({ id: jt.id, params: e }), p = { id: H.id, params: { op: h, unitId: g, subUnitId: a, objects: u2, type: F2.INSERT } }, f2 = { id: H.id, params: { op: l, unitId: g, subUnitId: a, objects: u2, type: F2.REMOVE } }; return mu([...(I = m.preRedos) != null ? I : [], p, ...m.redos], n) ? (t.pushUndoRedo({ unitID: g, undoMutations: [ ...(S = m.preUndos) != null ? S : [], f2, ...m.undos, { id: F3.id, params: c } ], redoMutations: [ ...(R = m.preRedos) != null ? R : [], p, ...m.redos, { id: F3.id, params: c } ] }), true) : false; } }; var ar2 = { id: "sheet.command.set-drawing-arrange", type: ar.COMMAND, handler: (i, e) => { const n = i.get(Pt), t = i.get(cn); if (!e) return false; const r = i.get(u), { unitId: s, subUnitId: o, drawingIds: c, arrangeType: d } = e, g = { unitId: s, subUnitId: o, drawingIds: c }; let a; if (d === fm.forward ? a = r.getForwardDrawingsOp(g) : d === fm.backward ? a = r.getBackwardDrawingOp(g) : d === fm.front ? a = r.getFrontDrawingsOp(g) : d === fm.back && (a = r.getBackDrawingsOp(g)), a == null) return false; const { objects: l, redo: h, undo: u2 } = a; return n.syncExecuteCommand(H.id, { op: h, unitId: s, subUnitId: o, objects: l, type: F2.ARRANGE }) ? (t.pushUndoRedo({ unitID: s, undoMutations: [ { id: H.id, params: { op: u2, unitId: s, subUnitId: o, objects: l, type: F2.ARRANGE } } ], redoMutations: [ { id: H.id, params: { op: h, unitId: s, subUnitId: o, objects: l, type: F2.ARRANGE } } ] }), true) : false; } }; var Wt = { id: "sheet.command.set-sheet-image", type: ar.COMMAND, handler: (i, e) => { const n = i.get(Pt), t = i.get(cn), r = i.get(u); if (!e) return false; const { drawings: s } = e, o = r.getBatchUpdateOp(s), { unitId: c, subUnitId: d, undo: g, redo: a, objects: l } = o; return n.syncExecuteCommand(H.id, { unitId: c, subUnitId: d, op: a, objects: l, type: F2.UPDATE }) ? (t.pushUndoRedo({ unitID: c, undoMutations: [ { id: H.id, params: { unitId: c, subUnitId: d, op: g, objects: l, type: F2.UPDATE } }, { id: F3.id, params: [c] } ], redoMutations: [ { id: H.id, params: { unitId: c, subUnitId: d, op: a, objects: l, type: F2.UPDATE } }, { id: F3.id, params: [c] } ] }), true) : false; } }; var cr = { id: "sheet.command.ungroup-sheet-image", type: ar.COMMAND, handler: (i, e) => { const n = i.get(Pt), t = i.get(cn), r = i.get(u); if (!e) return false; const s = []; e.forEach(({ parent: u2, children: m }) => { s.push(u2.unitId), m.forEach((p) => { s.push(p.unitId); }); }); const o = r.getUngroupDrawingOp(e), { unitId: c, subUnitId: d, undo: g, redo: a, objects: l } = o; return n.syncExecuteCommand(H.id, { op: a, unitId: c, subUnitId: d, objects: l, type: F2.UNGROUP }) ? (t.pushUndoRedo({ unitID: c, undoMutations: [ { id: H.id, params: { op: g, unitId: c, subUnitId: d, objects: as(l), type: F2.GROUP } }, { id: F3.id, params: s } ], redoMutations: [ { id: H.id, params: { op: a, unitId: c, subUnitId: d, objects: l, type: F2.UNGROUP } }, { id: F3.id, params: s } ] }), true) : false; } }; var ds = Object.defineProperty; var ls = Object.getOwnPropertyDescriptor; var us = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? ls(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && ds(e, n, r), r; }; var te = (i, e) => (n, t) => e(n, t, i); function hs(i, e, n) { const t = n * Math.PI / 180, r = Math.abs(i * Math.cos(t)) + Math.abs(e * Math.sin(t)), s = Math.abs(i * Math.sin(t)) + Math.abs(e * Math.cos(t)); return { rotatedWidth: r, rotatedHeight: s }; } function dr(i, e, n, t, r) { var I; const { rotatedHeight: s, rotatedWidth: o } = hs(n, t, r), d = i.get(Yx).getRenderById(e.unitId); if (!d) return false; const a = (I = d.with(me).getWorksheetSkeleton(e.subUnitId)) == null ? void 0 : I.skeleton; if (a == null) return false; const l = a.getCellByIndex(e.row, e.col), h = l.mergeInfo.endX - l.mergeInfo.startX - 2, u2 = l.mergeInfo.endY - l.mergeInfo.startY - 2, m = o / s, f2 = Math.ceil(Math.min(h, u2 * m)) / o, w = !f2 || Number.isNaN(f2) ? 1e-3 : f2; return { width: n * w, height: t * w }; } var Ze2 = class extends nt { constructor(e, n, t, r, s, o, c, d, g, a, l, h, u2) { super(); J(this, "_workbookSelections"); this._context = e, this._skeletonManagerService = n, this._commandService = t, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = c, this._drawingManagerService = d, this._contextService = g, this._messageService = a, this._localeService = l, this._injector = u2, this._workbookSelections = h.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(); } async insertFloatImage() { const e = await this._fileOpenerService.openFile({ multiple: true, accept: Zt.map((t) => `.${t.replace("image/", "")}`).join(",") }), n = e.length; return n > wn ? (this._messageService.show({ type: Xw.Error, content: this._localeService.t("update-status.exceedMaxCount", String(wn)) }), false) : n === 0 ? false : (e.forEach(async (t) => await this._insertFloatImage(t)), true); } async insertCellImage() { const n = (await this._fileOpenerService.openFile({ multiple: false, accept: Zt.map((t) => `.${t.replace("image/", "")}`).join(",") }))[0]; return n ? (await this._insertCellImage(n), true) : false; } async _insertFloatImage(e) { let n; try { n = await this._imageIoService.saveImage(e); } catch (I) { const S = I.message; S === g0.ERROR_EXCEED_SIZE ? this._messageService.show({ type: Xw.Error, content: this._localeService.t("update-status.exceedMaxSize", String(Yt / (1024 * 1024))) }) : S === g0.ERROR_IMAGE_TYPE ? this._messageService.show({ type: Xw.Error, content: this._localeService.t("update-status.invalidImageType") }) : S === g0.ERROR_IMAGE && this._messageService.show({ type: Xw.Error, content: this._localeService.t("update-status.invalidImage") }); } if (n == null) return; const t = this._getUnitInfo(), { unitId: r, subUnitId: s } = t, { imageId: o, imageSourceType: c, source: d, base64Cache: g } = n, { width: a, height: l, image: h } = await vn(g || ""), { width: u2, height: m } = this._context.scene; this._imageIoService.addImageSourceCache(d, c, h); let p = 1; if (a > mn || l > On) { const I = mn / a, S = On / l; p = Math.max(I, S); } const f2 = this._getImagePosition(a * p, l * p, u2, m); if (f2 == null) return; const w = { unitId: r, subUnitId: s, drawingId: o, drawingType: gm.DRAWING_IMAGE, imageSourceType: c, source: d, transform: z(f2, this._selectionRenderService, this._skeletonManagerService), sheetTransform: f2 }; this._commandService.executeCommand(jt.id, { unitId: r, drawings: [w] }); } // eslint-disable-next-line max-lines-per-function async _insertCellImage(e) { let n; try { n = await this._imageIoService.saveImage(e); } catch (f2) { const w = f2.message; w === g0.ERROR_EXCEED_SIZE ? this._messageService.show({ type: Xw.Error, content: this._localeService.t("update-status.exceedMaxSize", String(Yt / (1024 * 1024))) }) : w === g0.ERROR_IMAGE_TYPE ? this._messageService.show({ type: Xw.Error, content: this._localeService.t("update-status.invalidImageType") }) : w === g0.ERROR_IMAGE && this._messageService.show({ type: Xw.Error, content: this._localeService.t("update-status.invalidImage") }); } if (n == null) return; const { imageId: t, imageSourceType: r, source: s, base64Cache: o } = n, { width: c, height: d, image: g } = await vn(o || ""); this._imageIoService.addImageSourceCache(s, r, g); const a = this._workbookSelections.getCurrentLastSelection(); if (!a) return false; const l = Sr("", {}), h = dr( this._injector, { unitId: this._context.unitId, subUnitId: this._context.unit.getActiveSheet().getSheetId(), row: a.primary.actualRow, col: a.primary.actualColumn }, c, d, 0 ); if (!h) return false; const u2 = { size: { width: h.width, height: h.height }, positionH: { relativeFrom: om.PAGE, posOffset: 0 }, positionV: { relativeFrom: am.PARAGRAPH, posOffset: 0 }, angle: 0 }, m = { unitId: l.getUnitId(), subUnitId: l.getUnitId(), drawingId: t, drawingType: gm.DRAWING_IMAGE, imageSourceType: r, source: s, transform: rf(u2), docTransform: u2, behindDoc: we.FALSE, title: "", description: "", layoutType: Xp.INLINE, // Insert inline drawing by default. wrapText: Kp.BOTH_SIDES, distB: 0, distL: 0, distR: 0, distT: 0 }, p = st.drawing.add({ documentDataModel: l, drawings: [m], selection: { collapsed: true, startOffset: 0, endOffset: 0 } }); return p ? (l.apply(p), this._commandService.syncExecuteCommand(on.id, { value: { [a.primary.actualRow]: { [a.primary.actualColumn]: { p: l.getSnapshot(), t: 1 } } } })) : false; } _getUnitInfo() { const e = this._context.unit, n = e.getActiveSheet(), t = e.getUnitId(), r = n.getSheetId(); return { unitId: t, subUnitId: r }; } _getImagePosition(e, n, t, r) { const s = this._workbookSelections.getCurrentSelections(); let o = { startRow: 0, endRow: 0, startColumn: 0, endColumn: 0 }; s && s.length > 0 && (o = s[s.length - 1].range); const c = ni(this._skeletonManagerService.getCurrent().skeleton, o); if (c == null) return; let { startColumn: d, startRow: g, startX: a, startY: l } = c, h = false; if (a + e > t && (a = t - e, a < 0 && (a = 0, e = t), h = true), l + n > r && (l = r - n, l < 0 && (l = 0, n = r), h = true), h) { const f2 = this._selectionRenderService.getCellWithCoordByOffset(a, l); if (f2 == null) return; a = f2.startX, l = f2.startY, d = f2.actualColumn, g = f2.actualRow; } const u2 = { column: d, columnOffset: 0, row: g, rowOffset: 0 }, m = this._selectionRenderService.getCellWithCoordByOffset(a + e, l + n); if (m == null) return; const p = { column: m.actualColumn, columnOffset: a + e - m.startX, row: m.actualRow, rowOffset: l + n - m.startY }; return { from: u2, to: p }; } _updateOrderListener() { this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((e) => { const { unitId: n, subUnitId: t, drawingIds: r, arrangeType: s } = e; this._commandService.executeCommand(ar2.id, { unitId: n, subUnitId: t, drawingIds: r, arrangeType: s }); })); } _updateImageListener() { this.disposeWithMe(this._drawingManagerService.featurePluginUpdate$.subscribe((e) => { const n = []; e.length !== 0 && (e.forEach((t) => { const { unitId: r, subUnitId: s, drawingId: o, drawingType: c, transform: d } = t; if (d == null) return; const g = this._sheetDrawingService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: o }); if (g == null || g.unitId !== this._context.unitId) return; const a = k({ ...g.transform, ...d }, this._selectionRenderService); if (a == null) return; const l = { ...t, transform: { ...g.transform, ...d, ...z(a, this._selectionRenderService, this._skeletonManagerService) }, sheetTransform: { ...a } }; n.push(l); }), n.length > 0 && this._commandService.executeCommand(Wt.id, { unitId: e[0].unitId, drawings: n })); })); } _groupDrawingListener() { this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((e) => { this._commandService.executeCommand(or.id, e); const { unitId: n, subUnitId: t, drawingId: r } = e[0].parent; this._commandService.syncExecuteCommand(ln.id, [{ unitId: n, subUnitId: t, drawingId: r }]); })), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((e) => { this._commandService.executeCommand(cr.id, e); })); } _focusDrawingListener() { this.disposeWithMe( this._drawingManagerService.focus$.subscribe((e) => { e == null || e.length === 0 ? (this._contextService.setContextValue(yR, false), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(yR, true), this._sheetDrawingService.focusDrawing(e)); }) ); } }; Ze2 = us([ te(1, ot(me)), te(2, Pt), te(3, dt), te(4, Oa), te(5, fl), te(6, u), te(7, Ut), te(8, fs), te(9, o3), te(10, ot(Vr)), te(11, ot(F)), te(12, ot(Ot)) ], Ze2); var gs = Object.defineProperty; var ms = Object.getOwnPropertyDescriptor; var fs2 = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? ms(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && gs(e, n, r), r; }; var ye = (i, e) => (n, t) => e(n, t, i); function rn(i, e, n) { var t, r, s, o; if (((r = (t = n == null ? void 0 : n.p) == null ? void 0 : t.body) == null ? void 0 : r.dataStream.length) === 3 && ((o = (s = n.p) == null ? void 0 : s.drawingsOrder) == null ? void 0 : o.length) === 1) { const c = n.p.drawings[n.p.drawingsOrder[0]], d = dr( i, { unitId: e.unitId, subUnitId: e.subUnitId, row: e.row, col: e.col }, c.docTransform.size.width, c.docTransform.size.height, c.docTransform.angle ); if (d) return c.transform.width = d.width, c.transform.height = d.height, c.docTransform.size.width = d.width, c.docTransform.size.height = d.height, c.transform.left = 0, c.transform.top = 0, c.docTransform.positionH.posOffset = 0, c.docTransform.positionV.posOffset = 0, n.p.documentStyle.pageSize.width = 1 / 0, n.p.documentStyle.pageSize.height = 1 / 0, true; } return false; } var Ct = class extends nt { constructor(i, e, n, t, r, s, o) { super(), this._commandService = i, this._sheetInterceptorService = e, this._univerInstanceService = n, this._injector = t, this._drawingManagerService = r, this._docDrawingController = s, this._editorBridgeService = o, this._initHandleResize(), this._handleInitEditor(), this._handleWriteCell(), this._initCellContentInterceptor(); } _initHandleResize() { this.disposeWithMe(this._commandService.onCommandExecuted((i) => { let e, n = []; if (i.id === nt2.id) { const t = i.params; n = t.ranges, e = N(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId }); } else if (i.id === tt.id) { const t = i.params; n = t.ranges, e = N(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId }); } else if (i.id === Oe.id) { const t = i.params; n = t.ranges, e = N(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId }); } else if (i.id === Br.id) { const t = i.params; e = N(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId }), n = t.rowsAutoHeightInfo.map((r) => ({ startRow: r.row, endRow: r.row, startColumn: 0, endColumn: 9999 })); } else if (i.id === ne.id) { const t = i.params; n = t.ranges, e = N(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId }); } else if (i.id === oe.id) { const t = i.params; n = t.ranges, e = N(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId }); } e && n.length && n.forEach((t) => { const r = tr.transformRange(t, e.worksheet); for (let s = r.startRow; s <= r.endRow; s++) for (let o = r.startColumn; o <= r.endColumn; o++) rn(this._injector, { unitId: e.unitId, subUnitId: e.subUnitId, row: s, col: o }, e.worksheet.getCellRaw(s, o)); }); })); } _handleInitEditor() { this.disposeWithMe(this._editorBridgeService.visible$.subscribe((i) => { i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(su), this._docDrawingController.loadDrawingDataForUnit(su), this._drawingManagerService.initializeNotification(su)) : this._drawingManagerService.removeDrawingDataForUnit(su); })), this.disposeWithMe(this._commandService.onCommandExecuted((i) => { i.id === Vi.id && i.params.unitId === Hd && (this._drawingManagerService.removeDrawingDataForUnit(Hd), this._docDrawingController.loadDrawingDataForUnit(Hd), this._drawingManagerService.initializeNotification(Hd)); })); } _handleWriteCell() { this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(qn, { priority: 9999, handler: (i, e, n) => (rn(this._injector, { unitId: e.unitId, subUnitId: e.subUnitId, row: e.row, col: e.col }, i), n(i)) })); } _initCellContentInterceptor() { this.disposeWithMe( this._sheetInterceptorService.intercept( et.CELL_CONTENT, { effect: Vn.Style, priority: ea.CELL_IMAGE, handler: (i, e, n) => { var t; return i != null && i.p && ((t = i.p.drawingsOrder) != null && t.length) && (i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }), n(i); } } ) ); } }; Ct = fs2([ ye(0, Pt), ye(1, ot(V)), ye(2, _n), ye(3, ot(Ot)), ye(4, Ut), ye(5, ot(_)), ye(6, ot(tt2)) ], Ct); var ps = Object.defineProperty; var ws = Object.getOwnPropertyDescriptor; var _s2 = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? ws(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && ps(e, n, r), r; }; var Dn = (i, e) => (n, t) => e(n, t, i); var Rt = class extends nt { constructor(i, e) { super(), this._autoFillService = i, this._injector = e, this._initAutoFillHooks(); } _initAutoFillHooks() { this.disposeWithMe( this._autoFillService.addHook({ id: "sheet-cell-image-autofill", onBeforeSubmit: (i, e, n, t) => { new kt(t).forValue((r, s, o) => { rn(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o); }); } }) ); } }; Rt = _s2([ Dn(0, ot(Hr)), Dn(1, ot(Ot)) ], Rt); var vs = Object.defineProperty; var Ss = Object.getOwnPropertyDescriptor; var Is = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? Ss(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && vs(e, n, r), r; }; var pt2 = (i, e) => (n, t) => e(n, t, i); var bt = class extends nt { constructor(e, n, t, r) { super(); J(this, "_isSetCursor", false); this._hoverManagerService = e, this._renderManagerService = n, this._selectionsService = t, this._drawingRenderService = r; } _initHover() { } _initImageClick() { } }; bt = Is([ pt2(0, ot(Er)), pt2(1, ot(Yx)), pt2(2, ot(F)), pt2(3, ot(De)) ], bt); var Cs = Object.defineProperty; var Rs = Object.getOwnPropertyDescriptor; var bs = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? Rs(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && Cs(e, n, r), r; }; var Jt = (i, e) => (n, t) => e(n, t, i); var Dt = class extends nt { constructor(e, n, t) { super(); J(this, "_copyInfo"); this._sheetClipboardService = e, this._renderManagerService = n, this._sheetDrawingService = t, this._initCopyPaste(); } _initCopyPaste() { this._sheetClipboardService.addClipboardHook({ id: "SHEET_IMAGE_UI_PLUGIN", onBeforeCopy: (e, n, t) => this._collect(e, n, t), onPasteCells: (e, n, t, r) => { const { copyType: s = gr.COPY, pasteType: o } = r, { range: c } = e || {}, { range: d, unitId: g, subUnitId: a } = n; return this._generateMutations(d, { copyType: s, pasteType: o, copyRange: c, unitId: g, subUnitId: a }); }, onPastePlainText: (e, n) => ({ undos: [], redos: [] }) }); } _collect(e, n, t) { var h; const r = (h = this._renderManagerService.getRenderById(e)) == null ? void 0 : h.with(me); if (!r) return; const s = r.attachRangeWithCoord(t); if (!s) return; const { startX: o, endX: c, startY: d, endY: g } = s, a = this._sheetDrawingService.getDrawingData(e, n), l = []; Object.keys(a).forEach((u2) => { const m = a[u2], { transform: p } = m; if (m.anchorType !== j.Both || !p) return; const { left: f2 = 0, top: w = 0, width: I = 0, height: S = 0 } = p, { drawingStartX: R, drawingEndX: v, drawingStartY: C, drawingEndY: _3 } = { drawingStartX: f2, drawingEndX: f2 + I, drawingStartY: w, drawingEndY: w + S }; o <= R && v <= c && d <= C && _3 <= g && l.push(m); }), l.length && (this._copyInfo = { drawings: l, unitId: e, subUnitId: n }); } // eslint-disable-next-line max-lines-per-function _generateMutations(e, n) { var x; if (!this._copyInfo) return { redos: [], undos: [] }; if ([ rt2.SPECIAL_PASTE_COL_WIDTH, rt2.SPECIAL_PASTE_VALUE, rt2.SPECIAL_PASTE_FORMAT, rt2.SPECIAL_PASTE_FORMULA ].includes(n.pasteType)) return { redos: [], undos: [] }; const { copyRange: r } = n; if (!r) return { redos: [], undos: [] }; const { drawings: s, unitId: o, subUnitId: c } = this._copyInfo, { ranges: [d, g], mapFunc: a } = _s([r, e]), { row: l, col: h } = a(d.startRow, d.startColumn), { row: u2, col: m } = a(g.startRow, g.startColumn), p = (x = this._renderManagerService.getRenderById(o)) == null ? void 0 : x.with(me); if (!p) return { redos: [], undos: [] }; const f2 = p.attachRangeWithCoord({ startRow: l, endRow: l, startColumn: h, endColumn: h }), w = p.attachRangeWithCoord({ startRow: u2, endRow: u2, startColumn: m, endColumn: m }); if (!f2 || !w) return { redos: [], undos: [] }; const I = [], S = [], R = w.startX - f2.startX, v = w.startY - f2.startY, C = u2 - l, _3 = m - h, y = n.copyType === gr.CUT, { _sheetDrawingService: M } = this; return s.forEach((U) => { const { transform: D, sheetTransform: b } = U; if (!D) return; const P = { ...U, unitId: o, subUnitId: c, drawingId: y ? U.drawingId : re.generateRandomId(), transform: { ...D, left: D.left + R, top: D.top + v }, sheetTransform: { to: { ...b.to, row: b.to.row + C, column: b.to.column + _3 }, from: { ...b.from, row: b.from.row + C, column: b.from.column + _3 } } }; if (y) { const { undo: A, redo: j2, objects: B } = M.getBatchUpdateOp([P]); I.push({ id: H.id, params: { unitId: o, subUnitId: c, type: F2.UPDATE, op: j2, objects: B } }), S.push({ id: H.id, params: { unitId: o, subUnitId: c, type: F2.UPDATE, op: A, objects: B } }); } else { const { undo: A, redo: j2, objects: B } = M.getBatchAddOp([P]); I.push({ id: H.id, params: { op: j2, unitId: o, subUnitId: c, objects: B, type: F2.INSERT } }), S.push({ id: H.id, params: { op: A, unitId: o, subUnitId: c, objects: B, type: F2.REMOVE } }); } }), { redos: I, undos: S }; } }; Dt = bs([ Jt(0, Sn), Jt(1, Yx), Jt(2, u) ], Dt); var Ds = Object.defineProperty; var Ms = Object.getOwnPropertyDescriptor; var ys = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? Ms(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && Ds(e, n, r), r; }; var ze = (i, e) => (n, t) => e(n, t, i); var Mt = class extends nt { constructor(i, e, n, t, r) { super(), this._drawingManagerService = i, this._renderManagerService = e, this._permissionService = n, this._univerInstanceService = t, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange(); } _initDrawingVisible() { const i = this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET); this.disposeWithMe( combineLatest([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => { if (!e) { this._drawingManagerService.setDrawingVisible(false); return; } e.activeSheet$.subscribe((t) => { if (!t) { this._drawingManagerService.setDrawingVisible(false); return; } const r = e.getUnitId(), s = t.getSheetId(); if (this._permissionService.composePermission([new Js(r).id, new Hn(r, s).id]).every((c) => c.value)) this._drawingManagerService.setDrawingVisible(true); else { this._drawingManagerService.setDrawingVisible(false); const c = e.getUnitId(), d = t.getSheetId(), g = this._drawingManagerService.getDrawingData(c, d), a = Object.values(g), l = this._renderManagerService.getRenderById(c), h = l == null ? void 0 : l.scene; if (h == null) return; h.getAllObjectsByOrder().forEach((m) => { m.classType === Y.IMAGE && a.some((p) => m.oKey.includes(p.drawingId)) && h.removeObject(m); }); } }); }) ); } _initDrawingEditable() { const i = this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET); this.disposeWithMe( combineLatest([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => { if (!e) { this._drawingManagerService.setDrawingEditable(false); return; } e.activeSheet$.subscribe((t) => { if (!t) { this._drawingManagerService.setDrawingEditable(false); return; } const r = e.getUnitId(), s = t.getSheetId(); if (this._permissionService.composePermission([new Me(r).id, new Te(r, s).id]).every((c) => c.value)) this._drawingManagerService.setDrawingEditable(true); else { this._drawingManagerService.setDrawingEditable(false); const c = e.getUnitId(), d = t.getSheetId(), g = this._drawingManagerService.getDrawingData(c, d), a = Object.values(g), l = this._renderManagerService.getRenderById(c), h = l == null ? void 0 : l.scene; if (h == null) return; h.getAllObjectsByOrder().forEach((m) => { m.classType === Y.IMAGE && a.some((p) => m.oKey.includes(p.drawingId)) && h.detachTransformerFrom(m); }); } }); }) ); } _initViewPermissionChange() { const i = this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET); this.disposeWithMe( combineLatest([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => { e && e.activeSheet$.subscribe((t) => { var l; if (!t) return; const r = e.getUnitId(), s = t.getSheetId(); let o = true; const c = this._renderManagerService.getRenderById(r), d = c == null ? void 0 : c.scene; if (d == null) return; const g = d.getTransformerByCreate(), a = this._permissionService.composePermission$([new Js(r).id, new Hn(r, s).id]).pipe(map((h) => h.every((u2) => u2.value))); a == null || a.pipe( filter((h) => h !== o), distinctUntilChanged() ).subscribe({ next: (h) => { o = h, this._drawingManagerService.setDrawingVisible(h); const u2 = d.getAllObjectsByOrder(), m = this._drawingManagerService.getDrawingData(r, s), p = Object.values(m); h ? this._drawingManagerService.addNotification(p) : (u2.forEach((f2) => { f2.classType === Y.IMAGE && p.some((w) => f2.oKey.includes(w.drawingId)) && d.removeObject(f2); }), g.clearSelectedObjects()); } }), (l = this._permissionService.getPermissionPoint$(new Hn(r, s).id)) == null || l.pipe( filter((h) => h.value !== o), distinctUntilChanged() ).subscribe({ complete: () => { o = true, this._drawingManagerService.setDrawingVisible(true); const h = this._drawingManagerService.getDrawingData(r, s), u2 = Object.values(h); this._drawingManagerService.addNotification(u2); } }); }); }) ); } _initEditPermissionChange() { const i = this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET); this.disposeWithMe( combineLatest([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => { e && e.activeSheet$.subscribe((t) => { var l; if (!t) return; const r = e.getUnitId(), s = t.getSheetId(); let o = true; const c = this._renderManagerService.getRenderById(r), d = c == null ? void 0 : c.scene; if (d == null) return; const g = d.getTransformerByCreate(), a = this._permissionService.composePermission$([new Me(r).id, new Te(r, s).id]).pipe(map((h) => h.every((u2) => u2.value))); a == null || a.pipe( filter((h) => h !== o), distinctUntilChanged() ).subscribe({ next: (h) => { o = h, this._drawingManagerService.setDrawingEditable(h); const u2 = d.getAllObjectsByOrder(), m = this._drawingManagerService.getDrawingData(r, s), p = Object.values(m); h ? (u2.forEach((f2) => { f2.classType === Y.IMAGE && p.some((w) => f2.oKey.includes(w.drawingId)) && d.attachTransformerTo(f2); }), this._drawingManagerService.addNotification(p)) : (u2.forEach((f2) => { f2.classType === Y.IMAGE && p.some((w) => f2.oKey.includes(w.drawingId)) && d.detachTransformerFrom(f2); }), g.clearSelectedObjects()); } }), (l = this._permissionService.getPermissionPoint$(new Te(r, s).id)) == null || l.pipe( filter((h) => h.value !== o), distinctUntilChanged() ).subscribe({ complete: () => { o = true; const h = e.getUnitId(), u2 = t.getSheetId(), m = this._drawingManagerService.getDrawingData(h, u2), p = Object.values(m), f2 = this._renderManagerService.getRenderById(h), w = f2 == null ? void 0 : f2.scene; if (w == null) return; this._drawingManagerService.setDrawingEditable(true), w.getAllObjectsByOrder().forEach((S) => { S.classType === Y.IMAGE && p.some((R) => S.oKey.includes(R.drawingId)) && w.detachTransformerFrom(S); }); } }); }); }) ); } }; Mt = ys([ ze(0, Ut), ze(1, Yx), ze(2, UE), ze(3, _n), ze(4, ot(rr)) ], Mt); var Os = Object.defineProperty; var Ts = Object.getOwnPropertyDescriptor; var Es = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? Ts(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && Os(e, n, r), r; }; var wt = (i, e) => (n, t) => e(n, t, i); var yt = class extends nt { constructor(i, e, n, t) { super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = e, this._drawingManagerService = n, this._renderManagerService = t, this._initPrinting(); } _initPrinting() { this.disposeWithMe( this._sheetPrintInterceptorService.interceptor.intercept( this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT, { handler: (i, e, n) => { const { unitId: t, scene: r, subUnitId: s } = e, o = this._drawingManagerService.getDrawingDataForUnit(t), c = o == null ? void 0 : o[s]; return c && c.order.forEach((d) => { this._drawingRenderService.renderDrawing(c.data[d], r); }), n(); } } ) ), this.disposeWithMe( this._sheetPrintInterceptorService.interceptor.intercept( this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE, { handler: (i, e, n) => { const { unitId: t, subUnitId: r } = e, s = this._renderManagerService.getRenderById(t); if (!s) return n(i); const o = s.with(me).getWorksheetSkeleton(r); if (!o) return n(i); const c = this._drawingManagerService.getDrawingDataForUnit(t), d = c == null ? void 0 : c[e.subUnitId]; if (!d) return n(i); const { scaleX: g, scaleY: a } = s.scene, l = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, h = d.order.map((u2) => d.data[u2]).filter((u2) => u2.drawingType !== gm.DRAWING_DOM); return h.length ? (h.forEach((u2) => { if (!u2.groupId && u2.transform && re.isDefine(u2.transform.left) && re.isDefine(u2.transform.top) && re.isDefine(u2.transform.width) && re.isDefine(u2.transform.height)) { const m = o.skeleton.getCellIndexByOffset(u2.transform.left, u2.transform.top, g, a, { x: 0, y: 0 }), p = o.skeleton.getCellIndexByOffset(u2.transform.left + u2.transform.width, u2.transform.top + u2.transform.height, g, a, { x: 0, y: 0 }); m.column < l.startColumn && (l.startColumn = m.column), m.row < l.startRow && (l.startRow = m.row), l.endRow < p.row && (l.endRow = p.row), l.endColumn < p.column && (l.endColumn = p.column); } }), n(l)) : n(i); } } ) ); } }; yt = Es([ wt(0, ot(ap)), wt(1, ot(De)), wt(2, Ut), wt(3, Yx) ], yt); var Ps = Object.defineProperty; var Us = Object.getOwnPropertyDescriptor; var As = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? Us(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && Ps(e, n, r), r; }; var pe = (i, e) => (n, t) => e(n, t, i); var Ns = [ mt.id, gt.id, Gn.id, zn.id, Pt2.id, Tt.id, sn.id, Bn.id, $o.id, Wo.id, Oo.id, Mn.id, kr.id, Jn.id, Kn.id, yr.id, jn2.id, Fn.id, pt.id ]; var js = [ Zt2.id, Qt.id, qt2.id, Xt.id, nt2.id, tt.id ]; var sn2 = class extends nt { constructor(i, e, n, t, r, s, o, c, d) { super(), this._context = i, this._renderManagerService = e, this._commandService = n, this._selectionRenderService = t, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService = c, this._univerInstanceService = d, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener(); } _sheetInterceptorListener() { this.disposeWithMe( this._sheetInterceptorService.interceptCommand({ getMutations: (i) => { if (!Ns.includes(i.id)) return { redos: [], undos: [] }; if (i.params == null) return { redos: [], undos: [] }; const e = i.id; if (e === mt.id) return this._moveRowInterceptor(i.params, "insert"); if ([jn2.id, Fn.id, pt.id].includes(e)) return this._moveRangeInterceptor(i.params); if (e === gt.id) return this._moveColInterceptor(i.params, "insert"); if (e === Gn.id) return this._moveRowInterceptor(i.params, "remove"); if (e === zn.id) return this._moveColInterceptor(i.params, "remove"); if (e === Pt2.id) { const { range: n } = i.params; return this._getRangeMoveUndo( n, 0 /* deleteLeft */ ); } else if (e === Tt.id) { const { range: n } = i.params; return this._getRangeMoveUndo( n, 1 /* deleteUp */ ); } else if (e === sn.id) { const { range: n } = i.params; return this._getRangeMoveUndo( n, 2 /* insertDown */ ); } else if (e === Bn.id) { const { range: n } = i.params; return this._getRangeMoveUndo( n, 3 /* insertRight */ ); } else if (e === kr.id || e === Jn.id) { const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n; return this._getDrawingUndoForRowVisible(t, r, s); } else if (e === Kn.id || e === yr.id) { const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n; return this._getDrawingUndoForColVisible(t, r, s); } else if (e === $o.id || e === Wo.id || e === Oo.id || e === Mn.id) { const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n, o = e === $o.id || e === Wo.id; return this._getDrawingUndoForRowAndColSize(t, r, s, o); } return { redos: [], undos: [] }; } }) ); } _getRangeMoveUndo(i, e) { const n = N(this._univerInstanceService); if (n == null) return { redos: [], undos: [] }; const t = n.unitId, r = n.subUnitId, s = [], o = [], c = this._sheetDrawingService.getDrawingData(t, r), d = [], g = []; if (Object.keys(c).forEach((a) => { const l = c[a], { updateDrawings: h, deleteDrawings: u2 } = this._getUpdateOrDeleteDrawings(i, e, l); d.push(...h), g.push(...u2); }), d.length === 0 && g.length === 0) return { redos: [], undos: [] }; if (d.length > 0) { const a = this._sheetDrawingService.getBatchUpdateOp(d), { undo: l, redo: h, objects: u2 } = a; s.push({ id: H.id, params: { unitId: t, subUnitId: r, op: h, objects: u2, type: F2.UPDATE } }), o.push({ id: H.id, params: { unitId: t, subUnitId: r, op: l, objects: u2, type: F2.UPDATE } }); } if (g.length > 0) { const a = this._sheetDrawingService.getBatchRemoveOp(g), l = a.undo, h = a.redo, u2 = a.objects; s.push({ id: H.id, params: { unitId: t, subUnitId: r, op: h, objects: u2, type: F2.REMOVE } }), o.push({ id: H.id, params: { unitId: t, subUnitId: r, op: l, objects: u2, type: F2.INSERT } }); } return s.push({ id: F3.id, params: [t] }), o.push({ id: F3.id, params: [t] }), { redos: s, undos: o }; } _getUpdateOrDeleteDrawings(i, e, n) { const t = [], r = [], { sheetTransform: s, anchorType: o = j.Position, transform: c, unitId: d, subUnitId: g, drawingId: a } = n, { from: l, to: h } = s, { row: u2, column: m } = l, { row: p, column: f2 } = h; if (s == null || c == null) return { updateDrawings: t, deleteDrawings: r }; const { startRow: w, endRow: I, startColumn: S, endColumn: R } = i; let v = null, C = null; if (e === 0 && u2 >= w && p <= I) if (m >= S && f2 <= R) r.push({ unitId: d, subUnitId: g, drawingId: a }); else { const _3 = this._shrinkCol(s, c, S, R, o); v = _3 == null ? void 0 : _3.newSheetTransform, C = _3 == null ? void 0 : _3.newTransform; } else if (e === 1 && m >= S && f2 <= R) if (u2 >= w && p <= I) r.push({ unitId: d, subUnitId: g, drawingId: a }); else { const _3 = this._shrinkRow(s, c, w, I, o); v = _3 == null ? void 0 : _3.newSheetTransform, C = _3 == null ? void 0 : _3.newTransform; } else if (e === 2) { const _3 = this._expandRow(s, c, w, I, o); v = _3 == null ? void 0 : _3.newSheetTransform, C = _3 == null ? void 0 : _3.newTransform; } else if (e === 3) { const _3 = this._expandCol(s, c, S, R, o); v = _3 == null ? void 0 : _3.newSheetTransform, C = _3 == null ? void 0 : _3.newTransform; } if (v != null && C != null) { const _3 = z(v, this._selectionRenderService, this._skeletonManagerService); t.push({ ...n, sheetTransform: v, transform: _3 }); } return { updateDrawings: t, deleteDrawings: r }; } _remainDrawingSize(i, e, n) { const t = k({ ...i }, this._selectionRenderService); t != null && e.push({ ...n, sheetTransform: t }); } // eslint-disable-next-line max-lines-per-function _getDrawingUndoForColVisible(i, e, n) { const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = []; if (Object.keys(t).forEach((a) => { const l = t[a], { sheetTransform: h, transform: u2, anchorType: m = j.Position } = l; if (m === j.None) this._remainDrawingSize(u2, r, l); else { const { from: p, to: f2 } = h, { row: w, column: I } = p, { row: S, column: R } = f2; for (let v = 0; v < n.length; v++) { const C = n[v], { startRow: _3, endRow: y, startColumn: M, endColumn: x } = C; if (R < M) continue; if (m === j.Position) { let b = null, P = null; if (I >= M && I <= x) { const A = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: x, startRow: p.row, endRow: f2.row }); if (A == null) return; P = { ...u2, left: A.startX }; } if (P != null && (b = k(P, this._selectionRenderService), b != null && P != null)) { r.push({ ...l, sheetTransform: b, transform: P }); break; } this._remainDrawingSize(u2, r, l); continue; } if (I >= M && R <= x) continue; let U = null, D = null; if (I >= M && I <= x) { const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: x, startRow: p.row, endRow: f2.row }); if (b == null) return; D = { ...u2, left: (b == null ? void 0 : b.startX) || 0, width: ((u2 == null ? void 0 : u2.width) || 0) - b.endX + b.startX }; } else if (R >= M && R <= x) { const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: M, endColumn: R, startRow: p.row, endRow: f2.row }); if (b == null) return; D = { ...u2, left: b.startX - ((u2 == null ? void 0 : u2.width) || 0) }; } else { const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: M, endColumn: x, startRow: p.row, endRow: f2.row }); if (b == null) return; if (D = { ...u2, width: ((u2 == null ? void 0 : u2.width) || 0) - b.endX + b.startX }, U = k(D, this._selectionRenderService), U != null && D != null) { s.push({ ...l, sheetTransform: U, transform: D }); break; } } if (D != null && (U = k(D, this._selectionRenderService)), D != null && U != null) { r.push({ ...l, sheetTransform: U, transform: D }); break; } else this._remainDrawingSize(u2, r, l); } } }), r.length === 0 && s.length === 0) return { redos: [], undos: [] }; const { redos: o, undos: c } = this._createUndoAndRedoMutation(i, e, r), d = [], g = []; if (s.length > 0) { const { redos: a, undos: l } = this._createUndoAndRedoMutation(i, e, s); d.push(...a), g.push(...l); } return { redos: o, undos: c, preRedos: d, preUndos: g }; } _createUndoAndRedoMutation(i, e, n) { const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo: r, redo: s, objects: o } = t, c = [ { id: H.id, params: { unitId: i, subUnitId: e, op: s, objects: o, type: F2.UPDATE } }, { id: F3.id, params: [i] } ], d = [ { id: H.id, params: { unitId: i, subUnitId: e, op: r, objects: o, type: F2.UPDATE } }, { id: F3.id, params: [i] } ]; return { redos: c, undos: d }; } // eslint-disable-next-line max-lines-per-function _getDrawingUndoForRowVisible(i, e, n) { const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = []; if (Object.keys(t).forEach((a) => { const l = t[a], { sheetTransform: h, transform: u2, anchorType: m = j.Position } = l; if (m === j.None) this._remainDrawingSize(u2, r, l); else { const { from: p, to: f2 } = h, { row: w, column: I } = p, { row: S, column: R } = f2; for (let v = 0; v < n.length; v++) { const C = n[v], { startRow: _3, endRow: y, startColumn: M, endColumn: x } = C; if (S < _3) continue; if (m === j.Position) { let b = null, P = null; if (w >= _3 && w <= y) { const A = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f2.column, startRow: w, endRow: y }); if (A == null) return; P = { ...u2, top: A.startY }; } if (P != null && (b = k(P, this._selectionRenderService), b != null && P != null)) { r.push({ ...l, sheetTransform: b, transform: P }); break; } this._remainDrawingSize(u2, r, l); continue; } if (w >= _3 && S <= y) continue; let U = null, D = null; if (w >= _3 && w <= y) { const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f2.column, startRow: w, endRow: y }); if (b == null) return; D = { ...u2, top: (b == null ? void 0 : b.startY) || 0, height: ((u2 == null ? void 0 : u2.height) || 0) - b.endY + b.startY }; } else if (S >= _3 && S <= y) { const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f2.column, startRow: _3, endRow: S }); if (b == null) return; D = { ...u2, top: b.startY - ((u2 == null ? void 0 : u2.height) || 0) }; } else { const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f2.column, startRow: _3, endRow: y }); if (b == null) return; if (D = { ...u2, height: ((u2 == null ? void 0 : u2.height) || 0) - b.endY + b.startY }, U = k(D, this._selectionRenderService), U != null && D != null) { s.push({ ...l, sheetTransform: U, transform: D }); break; } } if (D != null && (U = k(D, this._selectionRenderService)), D != null && U != null) { r.push({ ...l, sheetTransform: U, transform: D }); break; } else this._remainDrawingSize(u2, r, l); } } }), r.length === 0 && s.length === 0) return { redos: [], undos: [] }; const { redos: o, undos: c } = this._createUndoAndRedoMutation(i, e, r), d = [], g = []; if (s.length > 0) { const { redos: a, undos: l } = this._createUndoAndRedoMutation(i, e, s); d.push(...a), g.push(...l); } return { redos: o, undos: c, preRedos: d, preUndos: g }; } _getDrawingUndoForRowAndColSize(i, e, n, t) { const r = this._drawingManagerService.getDrawingData(i, e), s = []; return Object.keys(r).forEach((o) => { const c = r[o], { sheetTransform: d, transform: g, anchorType: a = j.Position } = c; if (a === j.None) this._remainDrawingSize(g, s, c); else { const { from: l, to: h } = d, { row: u2, column: m } = l, { row: p, column: f2 } = h; for (let w = 0; w < n.length; w++) { const I = n[w], { startRow: S, endRow: R, startColumn: v, endColumn: C } = I; if (p < S || f2 < v) continue; if (a === j.Position && (u2 <= S && p >= R || m <= v && f2 >= C)) { this._remainDrawingSize(g, s, c); continue; } const _3 = z( { ...d }, this._selectionRenderService, this._skeletonManagerService ); if (_3 != null) { s.push({ ...c, transform: _3 }); break; } } } }), s.length === 0 ? { redos: [], undos: [] } : this._createUndoAndRedoMutation(i, e, s); } _getUnitIdAndSubUnitId(i, e) { let n, t; if (e === "insert") n = i.unitId, t = i.subUnitId; else { const r = N(this._univerInstanceService); if (r == null) return; n = r.unitId, t = r.subUnitId; } return { unitId: n, subUnitId: t }; } _moveRangeInterceptor(i) { var S, R; const { toRange: e, fromRange: n } = i, t = N(this._univerInstanceService); if (!t) return { redos: [], undos: [] }; const { unitId: r, subUnitId: s } = t, o = (R = (S = this._renderManagerService.getRenderById(r)) == null ? void 0 : S.with(me)) == null ? void 0 : R.getCurrentSkeleton(); if (!o) return { redos: [], undos: [] }; const c = ni(o, n); if (!c) return { redos: [], undos: [] }; const { startX: d, endX: g, startY: a, endY: l } = c, h = this._sheetDrawingService.getDrawingData(r, s), u2 = []; Object.keys(h).forEach((v) => { const C = h[v]; if (C.anchorType !== j.Both) return; const { transform: _3 } = C; if (!_3) return; const { left: y = 0, top: M = 0, width: x = 0, height: U = 0 } = _3, { drawingStartX: D, drawingEndX: b, drawingStartY: P, drawingEndY: A } = { drawingStartX: y, drawingEndX: y + x, drawingStartY: M, drawingEndY: M + U }; d <= D && b <= g && a <= P && A <= l && u2.push(C); }); const m = [], p = [], f2 = e.startRow - n.startRow, w = e.startColumn - n.startColumn, I = u2.map((v) => { const C = v.sheetTransform, _3 = { to: { ...C.to, row: C.to.row + f2, column: C.to.column + w }, from: { ...C.from, row: C.from.row + f2, column: C.from.column + w } }, y = z(_3, this._selectionRenderService, this._skeletonManagerService); return { unitId: r, subUnitId: s, drawingId: v.drawingId, transform: y, sheetTransform: _3 }; }); if (I.length) { const v = this._sheetDrawingService.getBatchUpdateOp(I), { undo: C, redo: _3, objects: y } = v; m.push({ id: H.id, params: { unitId: r, subUnitId: s, op: _3, objects: y, type: F2.UPDATE } }), p.push({ id: H.id, params: { unitId: r, subUnitId: s, op: C, objects: y, type: F2.UPDATE } }); } return { redos: m, undos: p }; } _moveRowInterceptor(i, e) { const n = this._getUnitIdAndSubUnitId(i, e); if (n == null) return { redos: [], undos: [] }; const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startRow, c = s.endRow, d = [], g = [], a = this._sheetDrawingService.getDrawingData(t, r), l = [], h = []; if (Object.keys(a).forEach((u2) => { const m = a[u2], { sheetTransform: p, transform: f2, anchorType: w = j.Position } = m; if (p == null || f2 == null) return; let I, S; if (e === "insert") { const v = this._expandRow(p, f2, o, c, w); I = v == null ? void 0 : v.newSheetTransform, S = v == null ? void 0 : v.newTransform; } else { const { from: v, to: C } = p, { row: _3 } = v, { row: y } = C; if (w === j.Both && _3 >= o && y <= c) h.push({ unitId: t, subUnitId: r, drawingId: u2 }); else { const M = this._shrinkRow(p, f2, o, c, w); I = M == null ? void 0 : M.newSheetTransform, S = M == null ? void 0 : M.newTransform; } } if (!I || !S) return; const R = { unitId: t, subUnitId: r, drawingId: u2, transform: S, sheetTransform: I }; l.push(R); }), l.length === 0 && h.length === 0) return { redos: [], undos: [] }; if (l.length > 0) { const u2 = this._sheetDrawingService.getBatchUpdateOp(l), { undo: m, redo: p, objects: f2 } = u2; d.push({ id: H.id, params: { unitId: t, subUnitId: r, op: p, objects: f2, type: F2.UPDATE } }), g.push({ id: H.id, params: { unitId: t, subUnitId: r, op: m, objects: f2, type: F2.UPDATE } }); } if (h.length > 0) { const u2 = this._sheetDrawingService.getBatchRemoveOp(h), m = u2.undo, p = u2.redo, f2 = u2.objects; d.push({ id: H.id, params: { unitId: t, subUnitId: r, op: p, objects: f2, type: F2.REMOVE } }), g.push({ id: H.id, params: { unitId: t, subUnitId: r, op: m, objects: f2, type: F2.INSERT } }); } return d.push({ id: F3.id, params: [t] }), g.push({ id: F3.id, params: [t] }), { redos: d, undos: g }; } _moveColInterceptor(i, e) { const n = this._getUnitIdAndSubUnitId(i, e); if (n == null) return { redos: [], undos: [] }; const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startColumn, c = s.endColumn, d = [], g = [], a = this._sheetDrawingService.getDrawingData(t, r), l = [], h = []; if (Object.keys(a).forEach((u2) => { const m = a[u2], { sheetTransform: p, transform: f2, anchorType: w = j.Position } = m; if (p == null || f2 == null) return; let I, S; if (e === "insert") { const v = this._expandCol(p, f2, o, c, w); I = v == null ? void 0 : v.newSheetTransform, S = v == null ? void 0 : v.newTransform; } else { const { from: v, to: C } = p, { column: _3 } = v, { column: y } = C; if (w === j.Both && _3 >= o && y <= c) h.push({ unitId: t, subUnitId: r, drawingId: u2 }); else { const M = this._shrinkCol(p, f2, o, c, w); I = M == null ? void 0 : M.newSheetTransform, S = M == null ? void 0 : M.newTransform; } } if (!I || !S) return; const R = { unitId: t, subUnitId: r, drawingId: u2, transform: S, sheetTransform: I }; l.push(R); }), l.length === 0 && h.length === 0) return { redos: [], undos: [] }; if (l.length > 0) { const u2 = this._sheetDrawingService.getBatchUpdateOp(l), { undo: m, redo: p, objects: f2 } = u2; d.push({ id: H.id, params: { unitId: t, subUnitId: r, op: p, objects: f2, type: F2.UPDATE } }), g.push({ id: H.id, params: { unitId: t, subUnitId: r, op: m, objects: f2, type: F2.UPDATE } }); } if (h.length > 0) { const u2 = this._sheetDrawingService.getBatchRemoveOp(h), m = u2.undo, p = u2.redo, f2 = u2.objects; d.push({ id: H.id, params: { unitId: t, subUnitId: r, op: p, objects: f2, type: F2.REMOVE } }), g.push({ id: H.id, params: { unitId: t, subUnitId: r, op: m, objects: f2, type: F2.INSERT } }); } return d.push({ id: F3.id, params: [t] }), g.push({ id: F3.id, params: [t] }), { redos: d, undos: g }; } _expandCol(i, e, n, t, r = j.Position) { const s = t - n + 1, { from: o, to: c } = i, { column: d } = o, { column: g } = c; if (r === j.None) return { newSheetTransform: k({ ...e }, this._selectionRenderService), newTransform: e }; let a = null, l = null; if (d >= n) { const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: c.row }); if (h == null) return; l = { ...e, left: (e.left || 0) + h.endX - h.startX }, a = k(l, this._selectionRenderService); } else if (g >= t) if (r === j.Both) a = { from: { ...o }, to: { ...c, column: g + s } }, l = z(a, this._selectionRenderService, this._skeletonManagerService); else return { newSheetTransform: k({ ...e }, this._selectionRenderService), newTransform: e }; return a != null && l != null ? { newSheetTransform: a, newTransform: l } : null; } _shrinkCol(i, e, n, t, r = j.Position) { const s = t - n + 1, { from: o, to: c } = i, { column: d } = o, { column: g } = c; if (r === j.None) return { newSheetTransform: k({ ...e }, this._selectionRenderService), newTransform: e }; let a = null, l = null; if (d > t) a = { from: { ...o, column: d - s }, to: { ...c, column: g - s } }, l = z(a, this._selectionRenderService, this._skeletonManagerService); else { if (d >= n && g <= t) return null; if (d < n && g > t) if (r === j.Both) a = { from: { ...o }, to: { ...c, column: g - s } }, l = z(a, this._selectionRenderService, this._skeletonManagerService); else return { newSheetTransform: k({ ...e }, this._selectionRenderService), newTransform: e }; else if (d >= n && d <= t) { if (d === n) l = { ...e, left: (e.left || 0) - i.from.columnOffset }; else { const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: d - 1, startRow: o.row, endRow: c.row }); if (h == null) return; l = { ...e, left: (e.left || 0) - h.endX + h.startX - i.from.columnOffset }; } a = k(l, this._selectionRenderService); } else if (g >= n && g <= t && r === j.Both) { const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n - 1, endColumn: n - 1, startRow: o.row, endRow: c.row }); if (h == null) return; a = { from: { ...o }, to: { ...c, column: n - 1, columnOffset: h.endX - h.startX } }, l = z(a, this._selectionRenderService, this._skeletonManagerService); } } return a != null && l != null ? { newSheetTransform: a, newTransform: l } : null; } _expandRow(i, e, n, t, r = j.Position) { const s = t - n + 1, { from: o, to: c } = i, { row: d } = o, { row: g } = c; if (r === j.None) return { newSheetTransform: k({ ...e }, this._selectionRenderService), newTransform: e }; let a = null, l = null; if (d >= n) { const h = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: o.column, endColumn: c.column }); if (h == null) return; l = { ...e, top: (e.top || 0) + h.endY - h.startY }, a = k(l, this._selectionRenderService); } else if (g >= t) if (r === j.Both) a = { from: { ...o }, to: { ...c, row: g + s } }, l = z(a, this._selectionRenderService, this._skeletonManagerService); else return { newSheetTransform: k({ ...e }, this._selectionRenderService), newTransform: e }; return a != null && l != null ? { newSheetTransform: a, newTransform: l } : null; } _shrinkRow(i, e, n, t, r = j.Position) { const s = t - n + 1, { from: o, to: c } = i, { row: d } = o, { row: g } = c; if (r === j.None) return { newSheetTransform: k({ ...e }, this._selectionRenderService), newTransform: e }; let a = null, l = null; if (d > t) a = { from: { ...o, row: d - s }, to: { ...c, row: g - s } }, l = z(a, this._selectionRenderService, this._skeletonManagerService); else { if (d >= n && g <= t) return null; if (d < n && g > t) if (r === j.Both) a = { from: { ...o }, to: { ...c, row: g - s } }, l = z(a, this._selectionRenderService, this._skeletonManagerService); else return { newSheetTransform: k({ ...e }, this._selectionRenderService), newTransform: e }; else if (d >= n && d <= t) { if (d === n) l = { ...e, top: (e.top || 0) - i.from.rowOffset }; else { const h = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: d - 1, startColumn: o.column, endColumn: c.column }); if (h == null) return; l = { ...e, top: (e.top || 0) - h.endY + h.startY - i.from.rowOffset }; } a = k(l, this._selectionRenderService); } else if (g >= n && g <= t && r === j.Both) { const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: n - 1, endRow: n - 1 }); if (h == null) return; a = { from: { ...o }, to: { ...c, row: n - 1, rowOffset: h.endY - h.startY } }, l = z(a, this._selectionRenderService, this._skeletonManagerService); } } return a != null && l != null ? { newSheetTransform: a, newTransform: l } : null; } _commandListener() { this.disposeWithMe( this._commandService.onCommandExecuted((i) => { i.id === an.id && setTimeout(() => { const e = i.params, { unitId: n, subUnitId: t } = e, r = this._drawingManagerService.drawingManagerData, s = [], o = []; Object.keys(r).forEach((c) => { const d = r[c]; d != null && Object.keys(d).forEach((g) => { const a = d[g].data; a != null && Object.keys(a).forEach((l) => { if (c === n && g === t) { const h = a[l]; h.transform = z(h.sheetTransform, this._selectionRenderService, this._skeletonManagerService), s.push(a[l]); } else o.push(a[l]); }); }); }), this._drawingManagerService.removeNotification(o), this._drawingManagerService.addNotification(s); }, 0); }) ); } _sheetRefreshListener() { this.disposeWithMe( this._commandService.onCommandExecuted((i) => { js.includes(i.id) && requestIdleCallback(() => { const e = i.params, { unitId: n, subUnitId: t, ranges: r } = e; this._refreshDrawingTransform(n, t, r); }); }) ); } _refreshDrawingTransform(i, e, n) { const t = this._drawingManagerService.getDrawingData(i, e), r = []; Object.keys(t).forEach((s) => { const o = t[s], { sheetTransform: c, transform: d, anchorType: g = j.Position } = o; if (g === j.None) return true; const { from: a, to: l } = c, { row: h, column: u2 } = a, { row: m, column: p } = l; for (let f2 = 0; f2 < n.length; f2++) { const w = n[f2], { startRow: I, endRow: S, startColumn: R, endColumn: v } = w; if (en.intersects( { startRow: I, endRow: S, startColumn: R, endColumn: v }, { startRow: h, endRow: m, startColumn: u2, endColumn: p } ) || h > S || u2 > v) { const C = g === j.Position, _3 = z(c, this._selectionRenderService, this._skeletonManagerService); r.push({ ...o, transform: { ..._3, width: C ? d == null ? void 0 : d.width : _3 == null ? void 0 : _3.width, height: C ? d == null ? void 0 : d.height : _3 == null ? void 0 : _3.height } }); break; } } }), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(F3.id, [i])); } }; sn2 = As([ pe(1, Yx), pe(2, Pt), pe(3, dt), pe(4, ot(me)), pe(5, ot(V)), pe(6, u), pe(7, Ut), pe(8, _n) ], sn2); var ne2 = function() { return ne2 = Object.assign || function(i) { for (var e, n = 1, t = arguments.length; n < t; n++) { e = arguments[n]; for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (i[r] = e[r]); } return i; }, ne2.apply(this, arguments); }; var Ws = function(i, e) { var n = {}; for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]); if (i != null && typeof Object.getOwnPropertySymbols == "function") for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++) e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]); return n; }; var lr = (0, import_react.forwardRef)(function(i, e) { var n = i.icon, t = i.id, r = i.className, s = i.extend, o = Ws(i, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), d = (0, import_react.useRef)("_".concat($s())); return ur(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, ne2({ ref: e, className: c }, o), s); }); function ur(i, e, n, t, r) { return (0, import_react.createElement)(i.tag, ne2(ne2({ key: e }, xs(i, n, r)), t), (Bs(i, n).children || []).map(function(s, o) { return ur(s, "".concat(e, "-").concat(i.tag, "-").concat(o), n, void 0, r); })); } function xs(i, e, n) { var t = ne2({}, i.attrs); n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1); var r = e.defIds; return !r || r.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(s) { var o = s[0], c = s[1]; typeof c == "string" && (t[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")"))); })), t; } function Bs(i, e) { var n, t = e.defIds; return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? ne2(ne2({}, i), { children: i.children.map(function(r) { return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? ne2(ne2({}, r), { attrs: ne2(ne2({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r; }) }) : i; } function $s() { return Math.random().toString(36).substring(2, 8); } lr.displayName = "UniverIcon"; var ks = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }; var hr = (0, import_react.forwardRef)(function(i, e) { return (0, import_react.createElement)(lr, Object.assign({}, i, { id: "add-image-single", ref: e, icon: ks })); }); hr.displayName = "AddImageSingle"; var gr2 = { id: "sheet.command.delete-drawing", type: ar.COMMAND, handler: (i) => { const e = i.get(Pt), t = i.get(u).getFocusDrawings(); if (t.length === 0) return false; const r = t[0].unitId, s = t.map((o) => { const { unitId: c, subUnitId: d, drawingId: g, drawingType: a } = o; return { unitId: c, subUnitId: d, drawingId: g, drawingType: a }; }); return e.executeCommand(Nt.id, { unitId: r, drawings: s }); } }; var cn3 = { id: "sheet.command.insert-float-image", type: ar.COMMAND, handler: (i) => { var n, t; return (t = (n = i.get(Yx).getCurrentTypeOfRenderer(Fe.UNIVER_SHEET)) == null ? void 0 : n.with(Ze2).insertFloatImage()) != null ? t : false; } }; var dn2 = { id: "sheet.command.insert-cell-image", type: ar.COMMAND, handler: (i) => { var n, t; return (t = (n = i.get(Yx).getCurrentTypeOfRenderer(Fe.UNIVER_SHEET)) == null ? void 0 : n.with(Ze2).insertCellImage()) != null ? t : false; } }; var et2 = { id: "sheet.command.move-drawing", type: ar.COMMAND, handler: (i, e) => { const n = i.get(Pt), t = i.get(u), r = i.get(dt), { direction: s } = e, o = t.getFocusDrawings(); if (o.length === 0) return false; const c = o[0].unitId, d = o.map((a) => { const { transform: l } = a; if (l == null) return null; const h = { ...l }, { left: u2 = 0, top: m = 0 } = l; return s === wu.UP ? h.top = m - 1 : s === wu.DOWN ? h.top = m + 1 : s === wu.LEFT ? h.left = u2 - 1 : s === wu.RIGHT && (h.left = u2 + 1), { ...a, transform: h, sheetTransform: k(h, r) }; }).filter((a) => a != null); return n.syncExecuteCommand(Wt.id, { unitId: c, drawings: d }) ? (n.syncExecuteCommand(F3.id, [c]), true) : false; } }; var mr = "addition-and-subtraction-single"; var fr = "sheet.menu.image"; function Ls(i) { return { id: fr, type: $e.SUBITEMS, icon: mr, tooltip: "sheetImage.title", hidden$: Fa(i, Fe.UNIVER_SHEET), disabled$: ue(i, { workbookTypes: [Me], worksheetTypes: [Te], rangeTypes: [Pe] }) }; } function Fs(i) { return { id: cn3.id, title: "sheetImage.upload.float", type: $e.BUTTON, hidden$: Fa(i, Fe.UNIVER_SHEET) }; } function Gs(i) { return { id: dn2.id, title: "sheetImage.upload.cell", type: $e.BUTTON }; } var Vs = "univer-image-common-panel"; var Ys = "univer-image-common-panel-grid"; var Hs = "univer-image-common-panel-border"; var Xs = "univer-image-common-panel-title"; var zs = "univer-image-common-panel-subtitle"; var Ks = "univer-image-common-panel-row"; var Js2 = "univer-image-common-panel-row-vertical"; var Zs = "univer-image-common-panel-column"; var qs = "univer-image-common-panel-column-center"; var Qs = "univer-image-common-panel-inline"; var eo = "univer-image-common-panel-span2"; var to = "univer-image-common-panel-span3"; var no = "univer-image-common-panel-input"; var ro = "univer-sheet-image-menu"; var io = "univer-sheet-image-menu-input"; var we2 = { imageCommonPanel: Vs, imageCommonPanelGrid: Ys, imageCommonPanelBorder: Hs, imageCommonPanelTitle: Xs, imageCommonPanelSubtitle: zs, imageCommonPanelRow: Ks, imageCommonPanelRowVertical: Js2, imageCommonPanelColumn: Zs, imageCommonPanelColumnCenter: qs, imageCommonPanelInline: Qs, imageCommonPanelSpan2: eo, imageCommonPanelSpan3: to, imageCommonPanelInput: no, sheetImageMenu: ro, sheetImageMenuInput: io }; function pr(i) { var e, n, t = ""; if (typeof i == "string" || typeof i == "number") t += i; else if (typeof i == "object") if (Array.isArray(i)) { var r = i.length; for (e = 0; e < r; e++) i[e] && (n = pr(i[e])) && (t && (t += " "), t += n); } else for (n in i) i[n] && (t && (t += " "), t += n); return t; } function _t() { for (var i, e, n = 0, t = "", r = arguments.length; n < r; n++) (i = arguments[n]) && (e = pr(i)) && (t && (t += " "), t += e); return t; } var so = (i) => { var S; const e = W0(Pt), n = W0(Vr), t = W0(Ut), r = W0(Yx), { drawings: s } = i, o = s[0]; if (o == null) return; const { unitId: c } = o, d = r.getRenderById(c), g = d == null ? void 0 : d.scene; if (g == null) return; const a = g.getTransformerByCreate(), [l, h] = (0, import_react.useState)(true), u2 = (S = o.anchorType) != null ? S : j.Position, [m, p] = (0, import_react.useState)(u2); function f2(R, v) { const C = []; return R.forEach((_3) => { const { oKey: y } = _3, M = v.getDrawingOKey(y); if (M == null) return C.push(null), true; const { unitId: x, subUnitId: U, drawingId: D, drawingType: b, anchorType: P, sheetTransform: A } = M; C.push({ unitId: x, subUnitId: U, drawingId: D, anchorType: P, sheetTransform: A, drawingType: b }); }), C; } (0, import_react.useEffect)(() => { const R = a.clearControl$.subscribe((C) => { C === true && h(false); }), v = a.changeStart$.subscribe((C) => { var M; const { objects: _3 } = C, y = f2(_3, t); if (y.length === 0) h(false); else if (y.length >= 1) { h(true); const x = ((M = y[0]) == null ? void 0 : M.anchorType) || j.Position; p(x); } }); return () => { v.unsubscribe(), R.unsubscribe(); }; }, []); function w(R) { p(R); const v = t.getFocusDrawings(); if (v.length === 0) return; const C = v.map((_3) => ({ unitId: _3.unitId, subUnitId: _3.subUnitId, drawingId: _3.drawingId, anchorType: R })); e.executeCommand(Wt.id, { unitId: v[0].unitId, drawings: C }); } const I = (R) => R ? "block" : "none"; return G.jsxs("div", { className: _t(we2.imageCommonPanelGrid, we2.imageCommonPanelBorder), style: { display: I(l) }, children: [ G.jsx("div", { className: we2.imageCommonPanelRow, children: G.jsx("div", { className: _t(we2.imageCommonPanelColumn, we2.imageCommonPanelTitle), children: G.jsx("div", { children: n.t("drawing-anchor.title") }) }) }), G.jsx("div", { className: _t(we2.imageCommonPanelRow), children: G.jsx("div", { className: _t(we2.imageCommonPanelColumn), children: G.jsxs(t_, { value: m, onChange: w, direction: "vertical", children: [ G.jsx(e_, { value: j.Both, children: n.t("drawing-anchor.both") }), G.jsx(e_, { value: j.Position, children: n.t("drawing-anchor.position") }), G.jsx(e_, { value: j.None, children: n.t("drawing-anchor.none") }) ] }) }) }) ] }); }; var oo = () => { const i = W0(Ut), e = i.getFocusDrawings(), [n, t] = (0, import_react.useState)(e); return (0, import_react.useEffect)(() => { const r = i.focus$.subscribe((s) => { t(s); }); return () => { r.unsubscribe(); }; }, []), !!(n != null && n.length) && G.jsxs("div", { className: we2.imageCommonPanel, children: [ G.jsx(vr, { drawings: n }), G.jsx(so, { drawings: n }) ] }); }; var ao = { [l1.FORMULAS_INSERT]: { [fr]: { order: 3, menuItemFactory: Ls, [cn3.id]: { order: 0, menuItemFactory: Fs }, [dn2.id]: { order: 1, menuItemFactory: Gs } } } }; function tt3(i) { return !i.getContextValue(aE) && !i.getContextValue(oE) && !i.getContextValue(IR) && i.getContextValue(yR); } var co = { id: et2.id, description: "shortcut.sheet.drawing-move-down", group: "4_sheet-drawing-view", binding: I1.ARROW_DOWN, priority: 100, preconditions: tt3, staticParameters: { direction: wu.DOWN } }; var lo = { id: et2.id, description: "shortcut.sheet.drawing-move-up", group: "4_sheet-drawing-view", binding: I1.ARROW_UP, priority: 100, preconditions: tt3, staticParameters: { direction: wu.UP } }; var uo = { id: et2.id, description: "shortcut.sheet.drawing-move-left", group: "4_sheet-drawing-view", binding: I1.ARROW_LEFT, priority: 100, preconditions: tt3, staticParameters: { direction: wu.LEFT } }; var ho = { id: et2.id, description: "shortcut.sheet.drawing-move-right", group: "4_sheet-drawing-view", binding: I1.ARROW_RIGHT, priority: 100, preconditions: tt3, staticParameters: { direction: wu.RIGHT } }; var go = { id: gr2.id, description: "shortcut.sheet.drawing-delete", group: "4_sheet-drawing-view", // when focusing on any other input tag do not trigger this shortcut preconditions: tt3, binding: I1.DELETE, mac: I1.BACKSPACE }; var mo = Object.defineProperty; var fo = Object.getOwnPropertyDescriptor; var po = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? fo(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && mo(e, n, r), r; }; var vt = (i, e) => (n, t) => e(n, t, i); var Ot2 = class extends nt { constructor(i, e, n, t) { super(), this._componentManager = i, this._menuManagerService = e, this._commandService = n, this._shortcutService = t, this._init(); } _initCustomComponents() { const i = this._componentManager; this.disposeWithMe(i.register(mr, hr)), this.disposeWithMe(i.register(rr2, oo)); } _initMenus() { this._menuManagerService.mergeMenu(ao); } _initCommands() { [ cn3, dn2, jt, Nt, Wt, ir, F3, sr, or, cr, et2, gr2, ar2 ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i))); } _initShortcuts() { [ // sheet drawing shortcuts co, lo, uo, ho, go ].forEach((i) => { this.disposeWithMe(this._shortcutService.registerShortcut(i)); }); } _init() { this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts(); } }; Ot2 = po([ vt(0, ot(n1)), vt(1, m1), vt(2, Pt), vt(3, it) ], Ot2); var wo = Object.defineProperty; var _o = Object.getOwnPropertyDescriptor; var vo = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? _o(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && wo(e, n, r), r; }; var Oe2 = (i, e) => (n, t) => e(n, t, i); function So(i, e, n, t, r) { const { scaleX: s, scaleY: o } = e.getAncestorScale(), c = e.getViewport(i2.VIEW_MAIN), d = { left: true, top: true }; if (!c) return { ...i, absolute: d }; const { left: g, right: a, top: l, bottom: h } = i; let { top: u2, left: m, viewportScrollX: p, viewportScrollY: f2 } = c; const { boundsOfViewArea: w, scrollDirectionResponse: I } = r || {}; w && (re.isDefine(w.top) && (u2 = w.top), re.isDefine(w.left) && (m = w.left)), I === "HORIZONTAL" && (f2 = 0), I === "VERTICAL" && (p = 0); let S, R; g < m ? (d.left = true, S = (m + (g - m)) * s, R = Math.max( Math.min( (m + (a - m)) * s, m * s ), (a - p) * s )) : (d.left = false, S = Math.max((g - p) * s, m * s), R = Math.max((a - p) * s, m * s)); let v, C; return l < u2 ? (d.top = true, v = (u2 + (l - u2)) * o, C = Math.max( Math.min( (u2 + (a - u2)) * o, u2 * o ), (h - f2) * o )) : (d.top = false, v = Math.max((l - f2) * o, u2 * o), C = Math.max((h - f2) * o, u2 * o)), { left: S, right: R, top: v, bottom: C, absolute: d }; } var Te2 = (i, e, n, t, r) => { const { scene: s } = e, { left: o, top: c, width: d, height: g, angle: a } = i, l = { left: o, right: o + d, top: c, bottom: c + g }, h = So(l, s, n, t, r), { scaleX: u2, scaleY: m } = s.getAncestorScale(); return { startX: h.left, endX: h.right, startY: h.top, endY: h.bottom, rotate: a, width: d * u2, height: g * m, absolute: h.absolute }; }; var Tt2 = class extends nt { constructor(e, n, t, r, s, o, c) { super(); J(this, "_domLayerMap", /* @__PURE__ */ new Map()); J(this, "_domLayerInfoMap", /* @__PURE__ */ new Map()); J(this, "_transformChange$", new Subject()); J(this, "transformChange$", this._transformChange$.asObservable()); J(this, "_add$", new Subject()); J(this, "add$", this._add$.asObservable()); J(this, "_remove$", new Subject()); J(this, "remove$", this._remove$.asObservable()); J(this, "_hooks", []); this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = c, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent(); } _bindScrollEvent() { this._lifecycleService.lifecycle$.pipe(filter((e) => e === Ve.Rendered), take(1)).subscribe(() => { this._scrollUpdateListener(); }); } _ensureMap(e, n) { let t = this._domLayerMap.get(e); t || (t = /* @__PURE__ */ new Map(), this._domLayerMap.set(e, t)); let r = t.get(n); return r || (r = /* @__PURE__ */ new Map(), t.set(n, r)), r; } getFloatDomInfo(e) { return this._domLayerInfoMap.get(e); } _getSceneAndTransformerByDrawingSearch(e) { if (e == null) return; const n = this._renderManagerService.getRenderById(e), t = n == null ? void 0 : n.scene; if (n == null || t == null) return null; const r = t.getTransformerByCreate(), s = n.engine.getCanvasElement(); return { scene: t, transformer: r, renderUnit: n, canvas: s }; } _getFloatDomProps(e) { let n; return this._hooks.forEach((t) => { n = t.onGetFloatDomProps(e); }), n; } _drawingAddListener() { this.disposeWithMe( this._drawingManagerService.add$.subscribe((e) => { e.forEach((n) => { var Se, ge, ce; const { unitId: t, subUnitId: r, drawingId: s } = n, o = N(this._univerInstanceService, { unitId: t, subUnitId: r }), c = this._drawingManagerService.getDrawingByParam(n), d = this._univerInstanceService.getUnit(t, Fe.UNIVER_SHEET); if (!d) return; const g = d.getActiveSheet().getSheetId(); if (!c || !o) return; const a = (Se = this._renderManagerService.getRenderById(t)) == null ? void 0 : Se.with(me).getWorksheetSkeleton(r); if (!a) return; const { transform: l, drawingType: h, data: u2 } = c; if (h !== gm.DRAWING_DOM && h !== gm.DRAWING_CHART) return; const m = this._getSceneAndTransformerByDrawingSearch(t); if (m == null) return; const { scene: p, canvas: f2 } = m; if (l == null) return true; if (g !== r) return; const { left: w, top: I, width: S, height: R, angle: v, flipX: C, flipY: _3, skewX: y, skewY: M } = l, x = bn({ unitId: t, subUnitId: r, drawingId: s }), U = p.getObject(x); if (U != null) { U.transformByState({ left: w, top: I, width: S, height: R, angle: v, flipX: C, flipY: _3, skewX: y, skewY: M }); return; } const D = { left: w, top: I, width: S, height: R, zIndex: this._drawingManagerService.getDrawingOrder(t, r).length - 1 }, b = h === gm.DRAWING_CHART; if (b) { const $ = u2 ? u2.backgroundColor : "white"; D.fill = $, D.rotateEnabled = false, u2 && u2.border && (D.stroke = u2.border), D.paintFirst = "stroke", D.strokeWidth = 1, D.borderEnabled = false, D.radius = 8; } const P = new A1(x, D); b && P.setObjectType(b3.CHART), p.addObject(P, aS), c.allowTransform !== false && p.attachTransformerTo(P); const A = this._ensureMap(t, r), j2 = new Mi(), B = Te2(P, m.renderUnit, a.skeleton, o.worksheet), X = new BehaviorSubject(B), se = { dispose: j2, rect: P, position$: X, unitId: t, subUnitId: r }; this._canvasFloatDomService.addFloatDom({ position$: X, id: s, componentKey: c.componentKey, onPointerDown: ($) => { f2.dispatchEvent(new PointerEvent($.type, $)); }, onPointerMove: ($) => { f2.dispatchEvent(new PointerEvent($.type, $)); }, onPointerUp: ($) => { f2.dispatchEvent(new PointerEvent($.type, $)); }, onWheel: ($) => { f2.dispatchEvent(new WheelEvent($.type, $)); }, props: (ce = (ge = A.get(s)) == null ? void 0 : ge.props) != null ? ce : this._getFloatDomProps(s), data: u2, unitId: t }); const oe2 = P.onTransformChange$.subscribeEvent(() => { const $ = Te2(P, m.renderUnit, a.skeleton, o.worksheet); X.next( $ ); }); j2.add(() => { this._canvasFloatDomService.removeFloatDom(s); }), oe2 && j2.add(oe2), this._domLayerInfoMap.set(s, se), A.set(s, { ...A.get(s) }); }); }) ), this.disposeWithMe( this._drawingManagerService.remove$.subscribe((e) => { e.forEach((n) => { const { unitId: t, subUnitId: r, drawingId: s } = n, o = bn({ unitId: t, subUnitId: r, drawingId: s }), c = this._getSceneAndTransformerByDrawingSearch(t); if (c == null) return; const { transformer: d, scene: g } = c, a = g.getObject(o); a != null && a.oKey && d.clearControlByIds([a == null ? void 0 : a.oKey]); }); }) ); } _scrollUpdateListener() { const e = (n, t) => { var g; const r = this._getSceneAndTransformerByDrawingSearch(n), s = this._ensureMap(n, t), o = Array.from(s.keys()), c = N(this._univerInstanceService, { unitId: n, subUnitId: t }), d = (g = this._renderManagerService.getRenderById(n)) == null ? void 0 : g.with(me).getWorksheetSkeleton(t); !r || !c || !d || o.forEach((a) => { const l = this._domLayerInfoMap.get(a); if (l) { const h = Te2(l.rect, r.renderUnit, d.skeleton, c.worksheet, l); l.position$.next(h); } }); }; this.disposeWithMe( this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET).pipe( filter((n) => !!n), switchMap((n) => n.activeSheet$), filter((n) => !!n), map((n) => { const t = this._renderManagerService.getRenderById(n.getUnitId()); return t ? { render: t, unitId: n.getUnitId(), subUnitId: n.getSheetId() } : null; }), filter((n) => !!n), switchMap( (n) => DR(n.render.scene.getViewport(i2.VIEW_MAIN).onScrollAfter$).pipe(map(() => ({ unitId: n.unitId, subUnitId: n.subUnitId }))) ) ).subscribe(({ unitId: n, subUnitId: t }) => { e(n, t); }) ), this.disposeWithMe(this._commandService.onCommandExecuted((n) => { var t, r; if (n.id === $t.id) { const s = n.params, { unitId: o } = s; Array.from((r = (t = this._domLayerMap.get(o)) == null ? void 0 : t.keys()) != null ? r : []).forEach((d) => { e(o, d); }); } else if (n.id === ut.id) { const { unitId: s, subUnitId: o } = n.params; e(s, o); } })); } _getPosition(e, n) { var h; const { startX: t, endX: r, startY: s, endY: o } = e, c = (h = this._renderManagerService.getRenderById(n)) == null ? void 0 : h.with(dt); if (c == null) return; const d = c.getCellWithCoordByOffset(t, s); if (d == null) return; const g = { column: d.actualColumn, columnOffset: t - d.startX, row: d.actualRow, rowOffset: s - d.startY }, a = c.getCellWithCoordByOffset(r, o); if (a == null) return; const l = { column: a.actualColumn, columnOffset: r - a.startX, row: a.actualRow, rowOffset: o - a.startY }; return { from: g, to: l }; } _featureUpdateListener() { this.disposeWithMe( this._drawingManagerService.update$.subscribe((e) => { e.forEach((n) => { const t = this._drawingManagerService.getDrawingByParam(n); if (!t || t.drawingType !== gm.DRAWING_DOM && t.drawingType !== gm.DRAWING_CHART) return; const r = { ...t.transform }; this._transformChange$.next({ id: n.drawingId, value: r }); }); }) ); } _deleteListener() { this.disposeWithMe( this._drawingManagerService.remove$.subscribe((e) => { e.forEach((n) => { this._removeDom(n.drawingId); }); }) ); } updateFloatDomProps(e, n, t, r) { const s = this._domLayerInfoMap.get(t), o = this._getSceneAndTransformerByDrawingSearch(e); if (s && o) { const { scene: c } = o, d = bn({ unitId: e, subUnitId: n, drawingId: t }), g = c.getObject(d); g && g instanceof A1 && g.setProps(r); } } // CreateFloatDomCommand --> floatDomService.addFloatDomToPosition addFloatDomToPosition(e, n) { const t = N(this._univerInstanceService, { unitId: e.unitId, subUnitId: e.subUnitId }); if (!t) throw new Error("cannot find current target!"); const { unitId: r, subUnitId: s } = t, { initPosition: o, componentKey: c, data: d, allowTransform: g = true } = e, a = n != null ? n : qt(), l = this._getPosition(o, r); if (l == null) return; this._ensureMap(r, s).set(a, e); const u2 = { unitId: r, subUnitId: s, drawingId: a, drawingType: e.type || gm.DRAWING_DOM, componentKey: c, sheetTransform: l, transform: { left: o.startX, top: o.startY, width: o.endX - o.startX, height: o.endY - o.startY }, data: d, allowTransform: g }; return this._commandService.executeCommand(jt.id, { unitId: r, drawings: [u2] }), this._add$.next({ unitId: r, subUnitId: s, id: a }), { id: a, dispose: () => { this._removeDom(a, true); } }; } _removeDom(e, n = false) { const t = this._domLayerInfoMap.get(e); if (!t) return; const { unitId: r, subUnitId: s } = t; this._domLayerInfoMap.delete(e), t.dispose.dispose(); const o = this._getSceneAndTransformerByDrawingSearch(r); if (o && o.scene.removeObject(t.rect), n) { this._ensureMap(r, s).delete(e); const d = this._drawingManagerService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: e }); if (!d) return; const g = this._sheetDrawingService.getBatchRemoveOp([d]), { redo: a, objects: l } = g; this._commandService.syncExecuteCommand(H.id, { unitId: r, subUnitId: s, op: a, objects: l, type: F2.REMOVE }); } } addHook(e) { return this._hooks.push(e), { dispose: () => { const n = this._hooks.findIndex((t) => t === e); this._hooks.splice(n, 1); } }; } addFloatDomToRange(e, n, t, r) { var M, x, U, D, b, P; const s = N(this._univerInstanceService, { unitId: n.unitId, subUnitId: n.subUnitId }); if (!s) throw new Error("cannot find current target!"); const { unitId: o, subUnitId: c } = s; if (!this._getSceneAndTransformerByDrawingSearch(o)) return; const g = this._renderManagerService.getRenderById(o); if (!g) return; const a = (M = this._renderManagerService.getRenderById(o)) == null ? void 0 : M.with(me).getWorksheetSkeleton(c); if (!a) return; const { componentKey: l, data: h, allowTransform: u2 = true } = n, m = r != null ? r : qt(), { position: p } = this._createRangePositionObserver(e, g, a.skeleton), f2 = this._getPosition(p, o); if (f2 == null) return; this._ensureMap(o, c).set(m, n); const I = p.endX - p.startX, S = p.endY - p.startY, R = (x = t.width) != null ? x : I, v = (U = t.height) != null ? U : S, C = p.startX + je(t.marginX, I), _3 = p.startY + je(t.marginY, S), y = { unitId: o, subUnitId: c, drawingId: m, drawingType: n.type || gm.DRAWING_DOM, componentKey: l, sheetTransform: f2, transform: { left: C, top: _3, width: R, height: v }, data: h, allowTransform: u2 }; { const { unitId: A, subUnitId: j2, drawingId: B } = y, X = N(this._univerInstanceService, { unitId: A, subUnitId: j2 }), se = y, oe2 = this._univerInstanceService.getUnit(A, Fe.UNIVER_SHEET); if (!oe2) return; const Se = oe2.getActiveSheet().getSheetId(); if (!se || !X) return; const ge = (D = this._renderManagerService.getRenderById(A)) == null ? void 0 : D.with(me).getWorksheetSkeleton(j2); if (!ge) return; const { transform: ce, drawingType: $, data: de } = se; if ($ !== gm.DRAWING_DOM && $ !== gm.DRAWING_CHART) return; const Ue = this._getSceneAndTransformerByDrawingSearch(A); if (Ue == null) return; const { scene: le, canvas: ue2 } = Ue; if (ce == null || Se !== j2) return; const { left: Ie, top: ke, width: Le2, height: Fe2, angle: nt3, flipX: xt, flipY: Bt, skewX: $t2, skewY: kt2 } = ce, rt3 = bn({ unitId: A, subUnitId: j2, drawingId: B }), Ge = le.getObject(rt3); if (Ge != null) { Ge.transformByState({ left: Ie, top: ke, width: Le2, height: Fe2, angle: nt3, flipX: xt, flipY: Bt, skewX: $t2, skewY: kt2 }); return; } const re2 = { left: Ie, top: ke, width: Le2, height: Fe2, zIndex: this._drawingManagerService.getDrawingOrder(A, j2).length - 1 }, it2 = $ === gm.DRAWING_CHART; if (it2) { const W = de ? de.backgroundColor : "white"; re2.fill = W, re2.rotateEnabled = false, de && de.border && (re2.stroke = de.border), re2.paintFirst = "stroke", re2.strokeWidth = 1, re2.borderEnabled = false, re2.radius = 8; } const K = new A1(rt3, re2); it2 && K.setObjectType(b3.CHART), le.addObject(K, aS), se.allowTransform !== false && le.attachTransformerTo(K); const Ce = this._ensureMap(A, j2), Re = new Mi(), me2 = le.getMainViewport(), Lt = { top: me2.top, left: me2.left, bottom: me2.bottom, right: me2.right }, he = { dispose: Re, rect: K, boundsOfViewArea: Lt, // position$, unitId: A, subUnitId: j2 }, Ft = Te2(K, Ue.renderUnit, ge.skeleton, X.worksheet, he), be = new BehaviorSubject(Ft); he.position$ = be; let De2 = { position$: be, id: B, componentKey: se.componentKey, onPointerDown: () => { }, onPointerMove: () => { }, onPointerUp: () => { }, onWheel: (W) => { ue2.dispatchEvent(new WheelEvent(W.type, W)); }, props: (P = (b = Ce.get(B)) == null ? void 0 : b.props) != null ? P : this._getFloatDomProps(B), data: de, unitId: A }; n.eventPassThrough && (De2 = { ...De2, onPointerDown: (W) => { ue2.dispatchEvent(new PointerEvent(W.type, W)); }, onPointerMove: (W) => { ue2.dispatchEvent(new PointerEvent(W.type, W)); }, onPointerUp: (W) => { ue2.dispatchEvent(new PointerEvent(W.type, W)); } }), this._canvasFloatDomService.addFloatDom(De2); const Ve2 = K.onTransformChange$.subscribeEvent(() => { const W = Te2(K, Ue.renderUnit, ge.skeleton, X.worksheet, he); be.next( W ); }); Re.add(() => { this._canvasFloatDomService.removeFloatDom(B); }), Ve2 && Re.add(Ve2), this._domLayerInfoMap.set(B, he), Ce.set(B, { ...Ce.get(B) }); } return { id: m, dispose: () => { this._removeDom(m, true); } }; } addFloatDomToColumnHeader(e, n, t, r) { var x, U, D, b, P, A; const s = N(this._univerInstanceService, { unitId: n.unitId, subUnitId: n.subUnitId }); if (!s) throw new Error("cannot find current target!"); const { unitId: o, subUnitId: c } = s; if (!this._getSceneAndTransformerByDrawingSearch(o)) return; const g = this._renderManagerService.getRenderById(o); if (!g) return; const a = (x = this._renderManagerService.getRenderById(o)) == null ? void 0 : x.with(me).getWorksheetSkeleton(c); if (!a) return; const { componentKey: l, data: h, allowTransform: u2 = true } = n, m = r != null ? r : qt(), { position: p } = this._createRangePositionObserver({ startRow: 0, endRow: 0, startColumn: e, endColumn: e }, g, a.skeleton), f2 = p; f2.startY = 0; const w = this._getPosition(p, o); if (w == null) return; this._ensureMap(o, c).set(m, n); const S = p.endX - p.startX, R = p.endY - p.startY, v = (U = t.width) != null ? U : S, C = (D = t.height) != null ? D : R; let _3 = 0, y = 0; if (t.horizonOffsetAlign === "right") { const j2 = je(t.marginX, S); _3 = f2.endX - j2 - v; } else _3 = f2.startX + je(t.marginX, S); if (t.verticalOffsetAlign === "bottom") { const j2 = je(t.marginY, R); y = f2.endY - j2 - C; } else y = f2.startY + je(t.marginY, R); const M = { unitId: o, subUnitId: c, drawingId: m, drawingType: n.type || gm.DRAWING_DOM, componentKey: l, sheetTransform: w, transform: { left: _3, top: y, width: v, height: C }, data: h, allowTransform: u2 }; { const { unitId: j2, subUnitId: B, drawingId: X } = M, se = N(this._univerInstanceService, { unitId: j2, subUnitId: B }), oe2 = M, Se = this._univerInstanceService.getUnit(j2, Fe.UNIVER_SHEET); if (!Se) return; const ge = Se.getActiveSheet().getSheetId(); if (!oe2 || !se) return; const ce = (b = this._renderManagerService.getRenderById(j2)) == null ? void 0 : b.with(me).getWorksheetSkeleton(B); if (!ce) return; const { transform: $, drawingType: de, data: Ue } = oe2; if (de !== gm.DRAWING_DOM && de !== gm.DRAWING_CHART) return; const le = this._getSceneAndTransformerByDrawingSearch(j2); if (le == null) return; const { scene: ue2, canvas: Ie } = le; if ($ == null || ge !== B) return; const { left: ke, top: Le2, width: Fe2, height: nt3, angle: xt, flipX: Bt, flipY: $t2, skewX: kt2, skewY: rt3 } = $, Ge = bn({ unitId: j2, subUnitId: B, drawingId: X }), re2 = ue2.getObject(Ge); if (re2 != null) { re2.transformByState({ left: ke, top: Le2, width: Fe2, height: nt3, angle: xt, flipX: Bt, flipY: $t2, skewX: kt2, skewY: rt3 }); return; } const it2 = { left: ke, top: Le2, width: Fe2, height: nt3, zIndex: this._drawingManagerService.getDrawingOrder(j2, B).length - 1 }, K = new A1(Ge, it2); ue2.addObject(K, aS), oe2.allowTransform !== false && ue2.attachTransformerTo(K); const Ce = this._ensureMap(j2, B), Re = new Mi(), me2 = ue2.getMainViewport(), Lt = { top: 0, //viewMain.top, left: me2.left, bottom: me2.bottom, right: me2.right }, he = { dispose: Re, rect: K, // position$, unitId: j2, subUnitId: B, boundsOfViewArea: Lt, scrollDirectionResponse: "HORIZONTAL" /* HORIZONTAL */ }, Ft = Te2(K, le.renderUnit, ce.skeleton, se.worksheet, he), be = new BehaviorSubject(Ft); he.position$ = be; let De2 = { position$: be, id: X, componentKey: oe2.componentKey, onPointerDown: () => { }, onPointerMove: () => { }, onPointerUp: () => { }, onWheel: (W) => { Ie.dispatchEvent(new WheelEvent(W.type, W)); }, props: (A = (P = Ce.get(X)) == null ? void 0 : P.props) != null ? A : this._getFloatDomProps(X), data: Ue, unitId: j2 }; n.eventPassThrough && (De2 = { ...De2, onPointerDown: (W) => { Ie.dispatchEvent(new PointerEvent(W.type, W)); }, onPointerMove: (W) => { Ie.dispatchEvent(new PointerEvent(W.type, W)); }, onPointerUp: (W) => { Ie.dispatchEvent(new PointerEvent(W.type, W)); } }), this._canvasFloatDomService.addFloatDom(De2); const Ve2 = K.onTransformChange$.subscribeEvent(() => { const W = Te2(K, le.renderUnit, ce.skeleton, se.worksheet, he); be.next( W ); }); Re.add(() => { this._canvasFloatDomService.removeFloatDom(X); }), Ve2 && Re.add(Ve2), this._domLayerInfoMap.set(X, he), Ce.set(X, { ...Ce.get(X) }); } return { id: m, dispose: () => { this._removeDom(m, true); } }; } /** * Unlike _createCellPositionObserver, this accept a range not a single cell. * * @param initialRow * @param initialCol * @param currentRender * @param skeleton * @param activeViewport * @returns position of cell to canvas. */ _createRangePositionObserver(e, n, t) { let { startRow: r, startColumn: s } = e; const o = Ke2(r, s, t), c = new BehaviorSubject(o), d = Ke2(e.endRow, e.endColumn, t), g = new BehaviorSubject(d), a = () => { const f2 = Ke2(r, s, t), w = Ke2(e.endRow, e.endColumn, t); c.next(f2), g.next(w); }, l = new Mi(); l.add(n.engine.clientRect$.subscribe(() => a())), l.add(this._commandService.onCommandExecuted((f2) => { if (f2.id === Br.id && f2.params.rowsAutoHeightInfo.findIndex((I) => I.row === r) > -1) { a(); return; } (gh.indexOf(f2.id) > -1 || f2.id === dn.id || f2.id === $t.id) && a(); })); const h = (f2, w) => { r = f2, s = w, a(); }, u2 = () => ({ rotate: 0, width: d.right - o.left, height: d.bottom - o.top, absolute: { left: true, top: true }, startX: o.left, startY: o.top, endX: d.right, endY: d.bottom }), m = c.pipe( map((f2) => { const w = Ke2(e.endRow, e.endColumn, t); return console.log("service", f2.left, f2.top), { rotate: 0, width: w.right - f2.left, height: w.bottom - f2.top, absolute: { left: true, top: true }, startX: f2.left, startY: f2.top, endX: w.right, endY: w.bottom }; }) ), p = u2(); return console.log("init position", p), { position$: m, position: p, updateRowCol: h, topLeftPos$: c, rightBottomPos$: g, disposable: l }; } }; Tt2 = vo([ Oe2(0, ot(Yx)), Oe2(1, _n), Oe2(2, ot(Pt)), Oe2(3, Ut), Oe2(4, ot(l3)), Oe2(5, u), Oe2(6, ot(Ht)) ], Tt2); function Ke2(i, e, n) { const t = n.getCellWithCoordByIndex(i, e), r = t.isMergedMainCell ? t.mergeInfo : t; return { left: r.startX, right: r.endX, top: r.startY, bottom: r.endY }; } function je(i, e) { if (i === void 0) return 0; if (typeof i == "number") return i; const n = Number.parseFloat(i); return e * n / 100; } var wr = Object.defineProperty; var Io = Object.getOwnPropertyDescriptor; var Co = (i, e, n) => e in i ? wr(i, e, { enumerable: true, configurable: true, writable: true, value: n }) : i[e] = n; var Ro = (i, e, n, t) => { for (var r = t > 1 ? void 0 : t ? Io(e, n) : e, s = i.length - 1, o; s >= 0; s--) (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r); return t && r && wr(e, n, r), r; }; var Zt3 = (i, e) => (n, t) => e(n, t, i); var _r = (i, e, n) => Co(i, typeof e != "symbol" ? e + "" : e, n); var bo = "SHEET_IMAGE_UI_PLUGIN"; var Et = class extends Ra { constructor(i = Cn, e, n, t) { super(), this._config = i, this._injector = e, this._renderManagerService = n, this._configService = t; const { menu: r, ...s } = nu( {}, Cn, this._config ); r && this._configService.setConfig("menu", r, { merge: true }), this._configService.setConfig(Hi, s); } onStarting() { K0(this._injector, [ [Tt2], [Ot2], [It], [yt], [Mt], [Dt], [Ct], [bt], [Rt] ]), Mf(this._injector, [ [Tt2] ]); } onReady() { Mf(this._injector, [ [Dt] ]); } onRendered() { this._registerRenderModules(), Mf(this._injector, [ [Mt], [yt], [Ot2], [Ct], [bt], [Rt] ]); } onSteady() { this._injector.get(It); } _registerRenderModules() { [ [Ze2], [sn2], [nn] ].forEach((i) => { this.disposeWithMe(this._renderManagerService.registerRenderModule(Fe.UNIVER_SHEET, i)); }); } }; _r(Et, "type", Fe.UNIVER_SHEET); _r(Et, "pluginName", bo); Et = Ro([ OR(At, f, cn2, _2), Zt3(1, ot(Ot)), Zt3(2, Yx), Zt3(3, SE) ], Et); export { F3 as ClearSheetDrawingTransformerOperation, gr2 as DeleteDrawingsCommand, sr as EditSheetDrawingOperation, or as GroupSheetDrawingCommand, cn3 as InsertFloatImageCommand, jt as InsertSheetDrawingCommand, et2 as MoveDrawingsCommand, Nt as RemoveSheetDrawingCommand, fr as SHEETS_IMAGE_MENU_ID, ar2 as SetDrawingArrangeCommand, Wt as SetSheetDrawingCommand, Tt2 as SheetCanvasFloatDomManagerService, ir as SidebarSheetDrawingOperation, cr as UngroupSheetDrawingCommand, Et as UniverSheetsDrawingUIPlugin }; /*! Bundled license information: @univerjs/sheets-drawing-ui/lib/es/index.js: (** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) */ //# sourceMappingURL=@univerjs_sheets-drawing-ui.js.map