@univerjs/watermark 0.4.2 → 0.5.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,14 +1,13 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { CommandType, LocaleService, Inject, ILocalStorageService, Disposable, useDependency, useObservable, IUniverInstanceService, DOCS_ZEN_EDITOR_UNIT_ID_KEY, UserManagerService, RxDisposable, Injector, ICommandService, Plugin, UniverInstanceType, IConfigService } from "@univerjs/core";
6
- import { Layer, IRenderManagerService } from "@univerjs/engine-render";
7
- import { ISidebarService, ILocalFileService, IClipboardInterfaceService, MenuItemType, RibbonStartGroup, ComponentManager, IMenuManagerService } from "@univerjs/ui";
8
- import require$$0, { forwardRef, useRef, createElement, useState, useCallback, useEffect } from "react";
9
- import { Button, InputNumber, Checkbox, Input, Select, Dropdown, ColorPicker } from "@univerjs/design";
10
- import { Subject, switchMap, of } from "rxjs";
11
- const UNIVER_WATERMARK_MENU = "UNIVER_WATERMARK_MENU", WATERMARK_PANEL = "WATERMARK_PANEL", WATERMARK_PANEL_FOOTER = "WATERMARK_PANEL_FOOTER", UNIVER_WATERMARK_STORAGE_KEY = "UNIVER_WATERMARK_STORAGE_KEY", UNIVER_WATERMARK_LAYER_INDEX = 10, WATERMARK_IMAGE_ALLOW_IMAGE_LIST = ["image/png", "image/jpeg", "image/jpg", "image/bmp"], WatermarkTextBaseConfig = {
1
+ var he = Object.defineProperty;
2
+ var ve = (e, t, a) => t in e ? he(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
+ var k = (e, t, a) => ve(e, typeof t != "symbol" ? t + "" : t, a);
4
+ import { CommandType as fe, LocaleService as R, Inject as j, ILocalStorageService as F, Disposable as ee, useDependency as x, useObservable as we, IUniverInstanceService as ke, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Se, UserManagerService as xe, RxDisposable as _e, Injector as ye, ICommandService as Ce, Plugin as Ie, UniverInstanceType as V, IConfigService as je } from "@univerjs/core";
5
+ import { Layer as Ne, IRenderManagerService as Te } from "@univerjs/engine-render";
6
+ import { ISidebarService as te, ILocalFileService as We, IClipboardInterfaceService as be, MenuItemType as Re, RibbonStartGroup as Pe, ComponentManager as Le, IMenuManagerService as Me } from "@univerjs/ui";
7
+ import Oe, { forwardRef as P, useRef as Ee, createElement as L, useState as z, useCallback as Fe, useEffect as Ae } from "react";
8
+ import { Button as Y, InputNumber as g, Checkbox as X, Input as Ue, Select as re, Dropdown as $e, ColorPicker as De } from "@univerjs/design";
9
+ import { Subject as G, switchMap as He, of as Z } from "rxjs";
10
+ const ae = "UNIVER_WATERMARK_MENU", ne = "WATERMARK_PANEL", ie = "WATERMARK_PANEL_FOOTER", S = "UNIVER_WATERMARK_STORAGE_KEY", Ye = 10, Xe = ["image/png", "image/jpeg", "image/jpg", "image/bmp"], O = {
12
11
  content: "",
13
12
  fontSize: 16,
14
13
  color: "rgb(0,0,0)",
@@ -22,7 +21,7 @@ const UNIVER_WATERMARK_MENU = "UNIVER_WATERMARK_MENU", WATERMARK_PANEL = "WATERM
22
21
  spacingY: 100,
23
22
  rotate: 0,
24
23
  opacity: 0.15
25
- }, WatermarkImageBaseConfig = {
24
+ }, se = {
26
25
  url: "",
27
26
  width: 100,
28
27
  height: 100,
@@ -35,7 +34,7 @@ const UNIVER_WATERMARK_MENU = "UNIVER_WATERMARK_MENU", WATERMARK_PANEL = "WATERM
35
34
  spacingY: 100,
36
35
  rotate: 0,
37
36
  opacity: 0.15
38
- }, WatermarkUserInfoBaseConfig = {
37
+ }, Be = {
39
38
  name: !0,
40
39
  email: !1,
41
40
  phone: !1,
@@ -52,101 +51,97 @@ const UNIVER_WATERMARK_MENU = "UNIVER_WATERMARK_MENU", WATERMARK_PANEL = "WATERM
52
51
  spacingY: 100,
53
52
  rotate: -30,
54
53
  opacity: 0.15
55
- }, OpenWatermarkPanelOperation = {
56
- type: CommandType.OPERATION,
54
+ }, K = {
55
+ type: fe.OPERATION,
57
56
  id: "univer.operation.open-watermark-panel",
58
- handler(accessor) {
59
- const sidebarService = accessor.get(ISidebarService), localeService = accessor.get(LocaleService);
60
- return sidebarService.open({
61
- header: { title: localeService.t("univer-watermark.title") },
62
- children: { label: WATERMARK_PANEL },
63
- footer: { label: WATERMARK_PANEL_FOOTER },
64
- onClose: /* @__PURE__ */ __name(() => {
65
- }, "onClose"),
57
+ handler(e) {
58
+ const t = e.get(te), a = e.get(R);
59
+ return t.open({
60
+ header: { title: a.t("univer-watermark.title") },
61
+ children: { label: ne },
62
+ footer: { label: ie },
63
+ onClose: () => {
64
+ },
66
65
  width: 330
67
66
  }), !0;
68
67
  }
69
68
  };
70
- var IWatermarkTypeEnum = /* @__PURE__ */ ((IWatermarkTypeEnum2) => (IWatermarkTypeEnum2.UserInfo = "userInfo", IWatermarkTypeEnum2.Text = "text", IWatermarkTypeEnum2.Image = "image", IWatermarkTypeEnum2))(IWatermarkTypeEnum || {}), __assign = function() {
71
- return __assign = Object.assign || function(t) {
72
- for (var s, i = 1, n2 = arguments.length; i < n2; i++) {
73
- s = arguments[i];
74
- for (var p2 in s) Object.prototype.hasOwnProperty.call(s, p2) && (t[p2] = s[p2]);
69
+ var m = /* @__PURE__ */ ((e) => (e.UserInfo = "userInfo", e.Text = "text", e.Image = "image", e))(m || {}), f = function() {
70
+ return f = Object.assign || function(e) {
71
+ for (var t, a = 1, r = arguments.length; a < r; a++) {
72
+ t = arguments[a];
73
+ for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
75
74
  }
76
- return t;
77
- }, __assign.apply(this, arguments);
78
- }, __rest = function(s, e) {
79
- var t = {};
80
- for (var p2 in s) Object.prototype.hasOwnProperty.call(s, p2) && e.indexOf(p2) < 0 && (t[p2] = s[p2]);
81
- if (s != null && typeof Object.getOwnPropertySymbols == "function")
82
- for (var i = 0, p2 = Object.getOwnPropertySymbols(s); i < p2.length; i++)
83
- e.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p2[i]) && (t[p2[i]] = s[p2[i]]);
84
- return t;
85
- }, IconBase = forwardRef(function(props, ref) {
86
- var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
87
- return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
75
+ return e;
76
+ }, f.apply(this, arguments);
77
+ }, Ke = function(e, t) {
78
+ var a = {};
79
+ for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (a[r] = e[r]);
80
+ if (e != null && typeof Object.getOwnPropertySymbols == "function")
81
+ for (var n = 0, r = Object.getOwnPropertySymbols(e); n < r.length; n++)
82
+ t.indexOf(r[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[n]) && (a[r[n]] = e[r[n]]);
83
+ return a;
84
+ }, M = P(function(e, t) {
85
+ var a = e.icon, r = e.id, n = e.className, i = e.extend, l = Ke(e, ["icon", "id", "className", "extend"]), d = "univerjs-icon univerjs-icon-".concat(r, " ").concat(n || "").trim(), u = Ee("_".concat(Ge()));
86
+ return oe(a, "".concat(r), { defIds: a.defIds, idSuffix: u.current }, f({ ref: t, className: d }, l), i);
88
87
  });
89
- function render(node, id, runtimeProps, rootProps, extend) {
90
- return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
91
- return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
88
+ function oe(e, t, a, r, n) {
89
+ return L(e.tag, f(f({ key: t }, Ve(e, a, n)), r), (ze(e, a).children || []).map(function(i, l) {
90
+ return oe(i, "".concat(t, "-").concat(e.tag, "-").concat(l), a, void 0, n);
92
91
  }));
93
92
  }
94
- __name(render, "render");
95
- function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
96
- var attrs = __assign({}, node.attrs);
97
- extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
98
- var defIds = runtimeProps.defIds;
99
- return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a5) {
100
- var key = _a5[0], value = _a5[1];
101
- typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
102
- })), attrs;
93
+ function Ve(e, t, a) {
94
+ var r = f({}, e.attrs);
95
+ a != null && a.colorChannel1 && r.fill === "colorChannel1" && (r.fill = a.colorChannel1);
96
+ var n = t.defIds;
97
+ return !n || n.length === 0 || (e.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + t.idSuffix), Object.entries(r).forEach(function(i) {
98
+ var l = i[0], d = i[1];
99
+ typeof d == "string" && (r[l] = d.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
100
+ })), r;
103
101
  }
104
- __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
105
- function replaceRuntimeIdsInDefs(node, runtimeProps) {
106
- var _a5, defIds = runtimeProps.defIds;
107
- return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a5 = node.children) === null || _a5 === void 0) && _a5.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
108
- return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
109
- }) }) : node;
102
+ function ze(e, t) {
103
+ var a, r = t.defIds;
104
+ return !r || r.length === 0 ? e : e.tag === "defs" && (!((a = e.children) === null || a === void 0) && a.length) ? f(f({}, e), { children: e.children.map(function(n) {
105
+ return typeof n.attrs.id == "string" && r && r.indexOf(n.attrs.id) > -1 ? f(f({}, n), { attrs: f(f({}, n.attrs), { id: n.attrs.id + t.idSuffix }) }) : n;
106
+ }) }) : e;
110
107
  }
111
- __name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
112
- function generateShortUuid() {
108
+ function Ge() {
113
109
  return Math.random().toString(36).substring(2, 8);
114
110
  }
115
- __name(generateShortUuid, "generateShortUuid");
116
- IconBase.displayName = "UniverIcon";
117
- var element$3 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.65791 1.30005C3.77355 1.30005 3.05664 2.01696 3.05664 2.90132V12.8588C3.05664 13.8755 3.88086 14.6998 4.89759 14.6998H9.1016C11.2233 14.6998 12.9433 12.9798 12.9433 10.8581C12.9433 9.13925 11.8145 7.68407 10.2578 7.1934C10.8806 6.56856 11.2655 5.70659 11.2655 4.75472C11.2655 2.84676 9.71883 1.30005 7.81087 1.30005H4.65791ZM4.25664 2.90132C4.25664 2.6797 4.4363 2.50005 4.65791 2.50005H7.81087C9.05609 2.50005 10.0655 3.5095 10.0655 4.75472C10.0655 5.99993 9.05609 7.00938 7.81087 7.00938H4.25664V2.90132ZM4.25664 12.8588V8.21636H9.1016C10.5606 8.21636 11.7433 9.39909 11.7433 10.8581C11.7433 12.317 10.5606 13.4998 9.1016 13.4998H4.89759C4.5436 13.4998 4.25664 13.2128 4.25664 12.8588Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, BoldSingle = forwardRef(function(props, ref) {
118
- return createElement(IconBase, Object.assign({}, props, {
111
+ M.displayName = "UniverIcon";
112
+ var Ze = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.65791 1.30005C3.77355 1.30005 3.05664 2.01696 3.05664 2.90132V12.8588C3.05664 13.8755 3.88086 14.6998 4.89759 14.6998H9.1016C11.2233 14.6998 12.9433 12.9798 12.9433 10.8581C12.9433 9.13925 11.8145 7.68407 10.2578 7.1934C10.8806 6.56856 11.2655 5.70659 11.2655 4.75472C11.2655 2.84676 9.71883 1.30005 7.81087 1.30005H4.65791ZM4.25664 2.90132C4.25664 2.6797 4.4363 2.50005 4.65791 2.50005H7.81087C9.05609 2.50005 10.0655 3.5095 10.0655 4.75472C10.0655 5.99993 9.05609 7.00938 7.81087 7.00938H4.25664V2.90132ZM4.25664 12.8588V8.21636H9.1016C10.5606 8.21636 11.7433 9.39909 11.7433 10.8581C11.7433 12.317 10.5606 13.4998 9.1016 13.4998H4.89759C4.5436 13.4998 4.25664 13.2128 4.25664 12.8588Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, le = P(function(e, t) {
113
+ return L(M, Object.assign({}, e, {
119
114
  id: "bold-single",
120
- ref,
121
- icon: element$3
115
+ ref: t,
116
+ icon: Ze
122
117
  }));
123
118
  });
124
- BoldSingle.displayName = "BoldSingle";
125
- var element$2 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_102_1198", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#DCDCDC", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_102_1198)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.68731 9.98425C5.73282 9.87144 5.77827 9.75442 5.82366 9.63323L6.3312 8.27586H9.65859L10.3523 10.1159C10.405 10.284 10.4868 10.4276 10.6023 10.5378C10.74 10.669 10.9119 10.7236 11.1014 10.714C11.3544 10.7131 11.5919 10.6379 11.6996 10.4032L11.7013 10.3992C11.7901 10.1937 11.7749 9.9634 11.6929 9.7289L8.85351 1.86337C8.79546 1.68828 8.6901 1.54881 8.54213 1.45002C8.38836 1.33863 8.1989 1.29112 7.98798 1.29112C7.78272 1.29112 7.59752 1.34014 7.4446 1.45198C7.30481 1.55223 7.20617 1.69184 7.14935 1.86343L4.324 9.70145L4.32281 9.70495C4.27002 9.86052 4.23828 10.0056 4.23828 10.1346C4.23828 10.2646 4.27116 10.3937 4.36281 10.4909C4.50256 10.6468 4.6921 10.714 4.90604 10.714C5.0369 10.714 5.15805 10.6745 5.26156 10.5916C5.3633 10.5247 5.44621 10.4332 5.51101 10.3217C5.57988 10.2177 5.63858 10.1051 5.68731 9.98425ZM6.72105 7.00152L8.00144 3.32827L9.28183 7.00152H6.72105Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "rect", attrs: { width: 11.58, height: 2.56, x: 2.21, y: 12.2, fill: "colorChannel1", rx: 1.28 } }] }] }, FontColor = forwardRef(function(props, ref) {
126
- return createElement(IconBase, Object.assign({}, props, {
119
+ le.displayName = "BoldSingle";
120
+ var qe = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_102_1198", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#DCDCDC", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_102_1198)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.68731 9.98425C5.73282 9.87144 5.77827 9.75442 5.82366 9.63323L6.3312 8.27586H9.65859L10.3523 10.1159C10.405 10.284 10.4868 10.4276 10.6023 10.5378C10.74 10.669 10.9119 10.7236 11.1014 10.714C11.3544 10.7131 11.5919 10.6379 11.6996 10.4032L11.7013 10.3992C11.7901 10.1937 11.7749 9.9634 11.6929 9.7289L8.85351 1.86337C8.79546 1.68828 8.6901 1.54881 8.54213 1.45002C8.38836 1.33863 8.1989 1.29112 7.98798 1.29112C7.78272 1.29112 7.59752 1.34014 7.4446 1.45198C7.30481 1.55223 7.20617 1.69184 7.14935 1.86343L4.324 9.70145L4.32281 9.70495C4.27002 9.86052 4.23828 10.0056 4.23828 10.1346C4.23828 10.2646 4.27116 10.3937 4.36281 10.4909C4.50256 10.6468 4.6921 10.714 4.90604 10.714C5.0369 10.714 5.15805 10.6745 5.26156 10.5916C5.3633 10.5247 5.44621 10.4332 5.51101 10.3217C5.57988 10.2177 5.63858 10.1051 5.68731 9.98425ZM6.72105 7.00152L8.00144 3.32827L9.28183 7.00152H6.72105Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "rect", attrs: { width: 11.58, height: 2.56, x: 2.21, y: 12.2, fill: "colorChannel1", rx: 1.28 } }] }] }, ce = P(function(e, t) {
121
+ return L(M, Object.assign({}, e, {
127
122
  id: "font-color",
128
- ref,
129
- icon: element$2
123
+ ref: t,
124
+ icon: qe
130
125
  }));
131
126
  });
132
- FontColor.displayName = "FontColor";
133
- var element$1 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M9.80385 1.40005H11.9997C12.3311 1.40005 12.5997 1.66868 12.5997 2.00005C12.5997 2.33143 12.3311 2.60005 11.9997 2.60005H10.1185L7.12251 13.4001H9.33324C9.66461 13.4001 9.93324 13.6687 9.93324 14.0001C9.93324 14.3314 9.66461 14.6001 9.33324 14.6001H6.34785C6.33847 14.6003 6.32905 14.6003 6.31962 14.6001H3.9999C3.66853 14.6001 3.3999 14.3314 3.3999 14.0001C3.3999 13.6687 3.66853 13.4001 3.9999 13.4001H5.87719L8.87322 2.60005H6.66641C6.33504 2.60005 6.06641 2.33143 6.06641 2.00005C6.06641 1.66868 6.33504 1.40005 6.66641 1.40005H9.52916C9.61698 1.37929 9.71064 1.3781 9.80385 1.40005Z" } }] }, ItalicSingle = forwardRef(function(props, ref) {
134
- return createElement(IconBase, Object.assign({}, props, {
127
+ ce.displayName = "FontColor";
128
+ var Je = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M9.80385 1.40005H11.9997C12.3311 1.40005 12.5997 1.66868 12.5997 2.00005C12.5997 2.33143 12.3311 2.60005 11.9997 2.60005H10.1185L7.12251 13.4001H9.33324C9.66461 13.4001 9.93324 13.6687 9.93324 14.0001C9.93324 14.3314 9.66461 14.6001 9.33324 14.6001H6.34785C6.33847 14.6003 6.32905 14.6003 6.31962 14.6001H3.9999C3.66853 14.6001 3.3999 14.3314 3.3999 14.0001C3.3999 13.6687 3.66853 13.4001 3.9999 13.4001H5.87719L8.87322 2.60005H6.66641C6.33504 2.60005 6.06641 2.33143 6.06641 2.00005C6.06641 1.66868 6.33504 1.40005 6.66641 1.40005H9.52916C9.61698 1.37929 9.71064 1.3781 9.80385 1.40005Z" } }] }, me = P(function(e, t) {
129
+ return L(M, Object.assign({}, e, {
135
130
  id: "italic-single",
136
- ref,
137
- icon: element$1
131
+ ref: t,
132
+ icon: Je
138
133
  }));
139
134
  });
140
- ItalicSingle.displayName = "ItalicSingle";
141
- var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.93949 12.3363L1.94048 12.3357 1.95034 12.33C1.95981 12.3245 1.97499 12.3158 1.99548 12.3043 2.0365 12.2813 2.09866 12.2474 2.17888 12.2061 2.33971 12.1234 2.57112 12.0123 2.84885 11.9012 3.41339 11.6754 4.12822 11.4664 4.81552 11.4664 5.82167 11.4664 6.71309 11.8774 7.74399 12.3643 7.7595 12.3717 7.77504 12.379 7.79061 12.3864 8.77119 12.8497 9.88765 13.3772 11.185 13.3772 12.0901 13.3772 12.9676 13.1085 13.5973 12.8566 13.9167 12.7289 14.1829 12.6011 14.3704 12.5047 14.4644 12.4564 14.5391 12.4157 14.5914 12.3864 14.6175 12.3717 14.6381 12.3599 14.6527 12.3514L14.6702 12.3412 14.6755 12.3381 14.6772 12.337 14.6782 12.3365C14.6782 12.3365 14.6784 12.3363 14.3697 11.8218L14.6782 12.3365C14.9623 12.166 15.0547 11.7973 14.8842 11.5131 14.7138 11.2291 14.3454 11.1369 14.0613 11.3071L14.06 11.3079 14.0502 11.3137C14.0407 11.3192 14.0255 11.3279 14.005 11.3394 13.964 11.3623 13.9019 11.3963 13.8216 11.4375 13.6608 11.5202 13.4294 11.6314 13.1517 11.7424 12.5871 11.9683 11.8723 12.1772 11.185 12.1772 10.1788 12.1772 9.28742 11.7663 8.25652 11.2793 8.24101 11.272 8.22547 11.2646 8.2099 11.2573 7.22931 10.7939 6.11286 10.2664 4.81552 10.2664 3.91046 10.2664 3.03292 10.5351 2.40318 10.787 2.08377 10.9148 1.81757 11.0425 1.63007 11.139 1.53613 11.1873 1.46144 11.228 1.40916 11.2573 1.383 11.2719 1.36241 11.2837 1.34778 11.2922L1.33033 11.3024 1.32504 11.3056 1.32327 11.3066 1.32233 11.3072C1.32233 11.3072 1.32209 11.3073 1.63068 11.8217L1.32233 11.3072C1.03818 11.4777.945803 11.8464 1.11629 12.1305 1.28674 12.4146 1.65536 12.5066 1.93949 12.3363zM1.93949 8.51464L1.94048 8.51406 1.95034 8.50829C1.95981 8.50279 1.97499 8.49407 1.99548 8.4826 2.0365 8.45963 2.09866 8.4257 2.17888 8.38443 2.33971 8.30172 2.57112 8.19061 2.84885 8.07952 3.41339 7.85371 4.12822 7.64473 4.81552 7.64473 5.82167 7.64473 6.71309 8.05572 7.74399 8.54267 7.7595 8.54999 7.77504 8.55733 7.79061 8.56469 8.77119 9.02803 9.88765 9.55557 11.185 9.55557 12.0901 9.55557 12.9676 9.28684 13.5973 9.03494 13.9167 8.90718 14.1829 8.77943 14.3704 8.683 14.4644 8.63469 14.5391 8.59398 14.5914 8.5647 14.6175 8.55006 14.6381 8.53825 14.6527 8.52975L14.6702 8.51954 14.6755 8.51641 14.6772 8.51535 14.6782 8.51479C14.6782 8.51479 14.6784 8.51464 14.3697 8.00015L14.6782 8.51479C14.9623 8.3443 15.0547 7.9756 14.8842 7.69145 14.7138 7.4074 14.3454 7.31523 14.0613 7.48547L14.06 7.48623 14.0502 7.492C14.0407 7.4975 14.0255 7.50622 14.005 7.5177 13.964 7.54067 13.9019 7.5746 13.8216 7.61586 13.6608 7.69857 13.4294 7.80968 13.1517 7.92077 12.5871 8.14659 11.8723 8.35557 11.185 8.35557 10.1788 8.35557 9.28742 7.94457 8.25652 7.45762 8.24101 7.4503 8.22547 7.44296 8.2099 7.4356 7.22931 6.97226 6.11286 6.44473 4.81552 6.44473 3.91046 6.44473 3.03292 6.71346 2.40318 6.96535 2.08377 7.09311 1.81757 7.22086 1.63007 7.31729 1.53613 7.3656 1.46144 7.40631 1.40916 7.43559 1.383 7.45024 1.36241 7.46205 1.34778 7.47054L1.33033 7.48075 1.32504 7.48389 1.32327 7.48494 1.32233 7.48551C1.32233 7.48551 1.32209 7.48565 1.63068 7.99997L1.32233 7.48551C1.03818 7.656.945803 8.0247 1.11629 8.30884 1.28674 8.59292 1.65536 8.68496 1.93949 8.51464zM1.93949 4.69296L1.94048 4.69238 1.95034 4.68661C1.95981 4.68111 1.97499 4.67239 1.99548 4.66092 2.0365 4.63795 2.09866 4.60402 2.17888 4.56276 2.33971 4.48004 2.57112 4.36893 2.84885 4.25784 3.41339 4.03203 4.12822 3.82305 4.81552 3.82305 5.82167 3.82305 6.71309 4.23404 7.74399 4.72099 7.7595 4.72831 7.77504 4.73566 7.79061 4.74301 8.77119 5.20635 9.88765 5.73389 11.185 5.73389 12.0901 5.73389 12.9676 5.46516 13.5973 5.21326 13.9167 5.0855 14.1829 4.95775 14.3704 4.86132 14.4644 4.81301 14.5391 4.7723 14.5914 4.74302 14.6175 4.72838 14.6381 4.71657 14.6527 4.70807L14.6702 4.69786 14.6755 4.69473 14.6772 4.69367 14.6782 4.69311C14.6782 4.69311 14.6784 4.69296 14.3697 4.17847L14.6782 4.69311C14.9623 4.52262 15.0547 4.15392 14.8842 3.86977 14.7138 3.58572 14.3454 3.49355 14.0613 3.66379L14.06 3.66455 14.0502 3.67032C14.0407 3.67582 14.0255 3.68454 14.005 3.69602 13.964 3.71899 13.9019 3.75292 13.8216 3.79418 13.6608 3.87689 13.4294 3.988 13.1517 4.09909 12.5871 4.32491 11.8723 4.53389 11.185 4.53389 10.1788 4.53389 9.28742 4.12289 8.25652 3.63594 8.24101 3.62862 8.22547 3.62128 8.2099 3.61392 7.22931 3.15058 6.11286 2.62305 4.81552 2.62305 3.91046 2.62305 3.03292 2.89178 2.40318 3.14367 2.08377 3.27143 1.81757 3.39918 1.63007 3.49561 1.53613 3.54392 1.46144 3.58463 1.40916 3.61391 1.383 3.62856 1.36241 3.64037 1.34778 3.64886L1.33033 3.65907 1.32504 3.66221 1.32327 3.66326 1.32233 3.66383C1.32233 3.66383 1.32209 3.66397 1.63068 4.17829L1.32233 3.66383C1.03818 3.83432.945803 4.20302 1.11629 4.48716 1.28674 4.77124 1.65536 4.86329 1.93949 4.69296z", fillRule: "evenodd", clipRule: "evenodd" } }] }, WatermarkSingle = forwardRef(function(props, ref) {
142
- return createElement(IconBase, Object.assign({}, props, {
135
+ me.displayName = "ItalicSingle";
136
+ var Qe = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.93949 12.3363L1.94048 12.3357 1.95034 12.33C1.95981 12.3245 1.97499 12.3158 1.99548 12.3043 2.0365 12.2813 2.09866 12.2474 2.17888 12.2061 2.33971 12.1234 2.57112 12.0123 2.84885 11.9012 3.41339 11.6754 4.12822 11.4664 4.81552 11.4664 5.82167 11.4664 6.71309 11.8774 7.74399 12.3643 7.7595 12.3717 7.77504 12.379 7.79061 12.3864 8.77119 12.8497 9.88765 13.3772 11.185 13.3772 12.0901 13.3772 12.9676 13.1085 13.5973 12.8566 13.9167 12.7289 14.1829 12.6011 14.3704 12.5047 14.4644 12.4564 14.5391 12.4157 14.5914 12.3864 14.6175 12.3717 14.6381 12.3599 14.6527 12.3514L14.6702 12.3412 14.6755 12.3381 14.6772 12.337 14.6782 12.3365C14.6782 12.3365 14.6784 12.3363 14.3697 11.8218L14.6782 12.3365C14.9623 12.166 15.0547 11.7973 14.8842 11.5131 14.7138 11.2291 14.3454 11.1369 14.0613 11.3071L14.06 11.3079 14.0502 11.3137C14.0407 11.3192 14.0255 11.3279 14.005 11.3394 13.964 11.3623 13.9019 11.3963 13.8216 11.4375 13.6608 11.5202 13.4294 11.6314 13.1517 11.7424 12.5871 11.9683 11.8723 12.1772 11.185 12.1772 10.1788 12.1772 9.28742 11.7663 8.25652 11.2793 8.24101 11.272 8.22547 11.2646 8.2099 11.2573 7.22931 10.7939 6.11286 10.2664 4.81552 10.2664 3.91046 10.2664 3.03292 10.5351 2.40318 10.787 2.08377 10.9148 1.81757 11.0425 1.63007 11.139 1.53613 11.1873 1.46144 11.228 1.40916 11.2573 1.383 11.2719 1.36241 11.2837 1.34778 11.2922L1.33033 11.3024 1.32504 11.3056 1.32327 11.3066 1.32233 11.3072C1.32233 11.3072 1.32209 11.3073 1.63068 11.8217L1.32233 11.3072C1.03818 11.4777.945803 11.8464 1.11629 12.1305 1.28674 12.4146 1.65536 12.5066 1.93949 12.3363zM1.93949 8.51464L1.94048 8.51406 1.95034 8.50829C1.95981 8.50279 1.97499 8.49407 1.99548 8.4826 2.0365 8.45963 2.09866 8.4257 2.17888 8.38443 2.33971 8.30172 2.57112 8.19061 2.84885 8.07952 3.41339 7.85371 4.12822 7.64473 4.81552 7.64473 5.82167 7.64473 6.71309 8.05572 7.74399 8.54267 7.7595 8.54999 7.77504 8.55733 7.79061 8.56469 8.77119 9.02803 9.88765 9.55557 11.185 9.55557 12.0901 9.55557 12.9676 9.28684 13.5973 9.03494 13.9167 8.90718 14.1829 8.77943 14.3704 8.683 14.4644 8.63469 14.5391 8.59398 14.5914 8.5647 14.6175 8.55006 14.6381 8.53825 14.6527 8.52975L14.6702 8.51954 14.6755 8.51641 14.6772 8.51535 14.6782 8.51479C14.6782 8.51479 14.6784 8.51464 14.3697 8.00015L14.6782 8.51479C14.9623 8.3443 15.0547 7.9756 14.8842 7.69145 14.7138 7.4074 14.3454 7.31523 14.0613 7.48547L14.06 7.48623 14.0502 7.492C14.0407 7.4975 14.0255 7.50622 14.005 7.5177 13.964 7.54067 13.9019 7.5746 13.8216 7.61586 13.6608 7.69857 13.4294 7.80968 13.1517 7.92077 12.5871 8.14659 11.8723 8.35557 11.185 8.35557 10.1788 8.35557 9.28742 7.94457 8.25652 7.45762 8.24101 7.4503 8.22547 7.44296 8.2099 7.4356 7.22931 6.97226 6.11286 6.44473 4.81552 6.44473 3.91046 6.44473 3.03292 6.71346 2.40318 6.96535 2.08377 7.09311 1.81757 7.22086 1.63007 7.31729 1.53613 7.3656 1.46144 7.40631 1.40916 7.43559 1.383 7.45024 1.36241 7.46205 1.34778 7.47054L1.33033 7.48075 1.32504 7.48389 1.32327 7.48494 1.32233 7.48551C1.32233 7.48551 1.32209 7.48565 1.63068 7.99997L1.32233 7.48551C1.03818 7.656.945803 8.0247 1.11629 8.30884 1.28674 8.59292 1.65536 8.68496 1.93949 8.51464zM1.93949 4.69296L1.94048 4.69238 1.95034 4.68661C1.95981 4.68111 1.97499 4.67239 1.99548 4.66092 2.0365 4.63795 2.09866 4.60402 2.17888 4.56276 2.33971 4.48004 2.57112 4.36893 2.84885 4.25784 3.41339 4.03203 4.12822 3.82305 4.81552 3.82305 5.82167 3.82305 6.71309 4.23404 7.74399 4.72099 7.7595 4.72831 7.77504 4.73566 7.79061 4.74301 8.77119 5.20635 9.88765 5.73389 11.185 5.73389 12.0901 5.73389 12.9676 5.46516 13.5973 5.21326 13.9167 5.0855 14.1829 4.95775 14.3704 4.86132 14.4644 4.81301 14.5391 4.7723 14.5914 4.74302 14.6175 4.72838 14.6381 4.71657 14.6527 4.70807L14.6702 4.69786 14.6755 4.69473 14.6772 4.69367 14.6782 4.69311C14.6782 4.69311 14.6784 4.69296 14.3697 4.17847L14.6782 4.69311C14.9623 4.52262 15.0547 4.15392 14.8842 3.86977 14.7138 3.58572 14.3454 3.49355 14.0613 3.66379L14.06 3.66455 14.0502 3.67032C14.0407 3.67582 14.0255 3.68454 14.005 3.69602 13.964 3.71899 13.9019 3.75292 13.8216 3.79418 13.6608 3.87689 13.4294 3.988 13.1517 4.09909 12.5871 4.32491 11.8723 4.53389 11.185 4.53389 10.1788 4.53389 9.28742 4.12289 8.25652 3.63594 8.24101 3.62862 8.22547 3.62128 8.2099 3.61392 7.22931 3.15058 6.11286 2.62305 4.81552 2.62305 3.91046 2.62305 3.03292 2.89178 2.40318 3.14367 2.08377 3.27143 1.81757 3.39918 1.63007 3.49561 1.53613 3.54392 1.46144 3.58463 1.40916 3.61391 1.383 3.62856 1.36241 3.64037 1.34778 3.64886L1.33033 3.65907 1.32504 3.66221 1.32327 3.66326 1.32233 3.66383C1.32233 3.66383 1.32209 3.66397 1.63068 4.17829L1.32233 3.66383C1.03818 3.83432.945803 4.20302 1.11629 4.48716 1.28674 4.77124 1.65536 4.86329 1.93949 4.69296z", fillRule: "evenodd", clipRule: "evenodd" } }] }, de = P(function(e, t) {
137
+ return L(M, Object.assign({}, e, {
143
138
  id: "watermark-single",
144
- ref,
145
- icon: element
139
+ ref: t,
140
+ icon: Qe
146
141
  }));
147
142
  });
148
- WatermarkSingle.displayName = "WatermarkSingle";
149
- var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
143
+ de.displayName = "WatermarkSingle";
144
+ var ue = { exports: {} }, A = {};
150
145
  /**
151
146
  * @license React
152
147
  * react-jsx-runtime.production.min.js
@@ -156,41 +151,40 @@ var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
156
151
  * This source code is licensed under the MIT license found in the
157
152
  * LICENSE file in the root directory of this source tree.
158
153
  */
159
- var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: !0, ref: !0, __self: !0, __source: !0 };
160
- function q(c, a, g) {
161
- var b, d = {}, e = null, h = null;
162
- g !== void 0 && (e = "" + g), a.key !== void 0 && (e = "" + a.key), a.ref !== void 0 && (h = a.ref);
163
- for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
164
- if (c && c.defaultProps) for (b in a = c.defaultProps, a) d[b] === void 0 && (d[b] = a[b]);
165
- return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
154
+ var et = Oe, tt = Symbol.for("react.element"), rt = Symbol.for("react.fragment"), at = Object.prototype.hasOwnProperty, nt = et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, it = { key: !0, ref: !0, __self: !0, __source: !0 };
155
+ function pe(e, t, a) {
156
+ var r, n = {}, i = null, l = null;
157
+ a !== void 0 && (i = "" + a), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (l = t.ref);
158
+ for (r in t) at.call(t, r) && !it.hasOwnProperty(r) && (n[r] = t[r]);
159
+ if (e && e.defaultProps) for (r in t = e.defaultProps, t) n[r] === void 0 && (n[r] = t[r]);
160
+ return { $$typeof: tt, type: e, key: i, ref: l, props: n, _owner: nt.current };
166
161
  }
167
- __name(q, "q");
168
- reactJsxRuntime_production_min.Fragment = l;
169
- reactJsxRuntime_production_min.jsx = q;
170
- reactJsxRuntime_production_min.jsxs = q;
171
- jsxRuntime.exports = reactJsxRuntime_production_min;
172
- var jsxRuntimeExports = jsxRuntime.exports, __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
173
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
174
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
175
- return kind && result && __defProp$3(target, key, result), result;
176
- }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a;
177
- let WatermarkService = (_a = class extends Disposable {
178
- constructor(_localStorageService) {
162
+ A.Fragment = rt;
163
+ A.jsx = pe;
164
+ A.jsxs = pe;
165
+ ue.exports = A;
166
+ var s = ue.exports, st = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, lt = (e, t, a, r) => {
167
+ for (var n = r > 1 ? void 0 : r ? ot(t, a) : t, i = e.length - 1, l; i >= 0; i--)
168
+ (l = e[i]) && (n = (r ? l(t, a, n) : l(n)) || n);
169
+ return r && n && st(t, a, n), n;
170
+ }, ct = (e, t) => (a, r) => t(a, r, e);
171
+ let T = class extends ee {
172
+ constructor(t) {
179
173
  super();
180
- __publicField(this, "_updateConfig$", new Subject());
181
- __publicField(this, "updateConfig$", this._updateConfig$.asObservable());
182
- __publicField(this, "_refresh$", new Subject());
183
- __publicField(this, "refresh$", this._refresh$.asObservable());
184
- this._localStorageService = _localStorageService;
174
+ k(this, "_updateConfig$", new G());
175
+ k(this, "updateConfig$", this._updateConfig$.asObservable());
176
+ k(this, "_refresh$", new G());
177
+ k(this, "refresh$", this._refresh$.asObservable());
178
+ this._localStorageService = t;
185
179
  }
186
180
  async getWatermarkConfig() {
187
- return await this._localStorageService.getItem(UNIVER_WATERMARK_STORAGE_KEY);
181
+ return await this._localStorageService.getItem(S);
188
182
  }
189
- updateWatermarkConfig(config) {
190
- this._localStorageService.setItem(UNIVER_WATERMARK_STORAGE_KEY, config), this._updateConfig$.next(config);
183
+ updateWatermarkConfig(t) {
184
+ this._localStorageService.setItem(S, t), this._updateConfig$.next(t);
191
185
  }
192
186
  deleteWatermarkConfig() {
193
- this._localStorageService.removeItem(UNIVER_WATERMARK_STORAGE_KEY), this._updateConfig$.next(null);
187
+ this._localStorageService.removeItem(S), this._updateConfig$.next(null);
194
188
  }
195
189
  refresh() {
196
190
  this._refresh$.next(Math.random());
@@ -198,714 +192,703 @@ let WatermarkService = (_a = class extends Disposable {
198
192
  dispose() {
199
193
  this._refresh$.complete(), this._updateConfig$.complete();
200
194
  }
201
- }, __name(_a, "WatermarkService"), _a);
202
- WatermarkService = __decorateClass$3([
203
- __decorateParam$3(0, Inject(ILocalStorageService))
204
- ], WatermarkService);
205
- const watermarkPanel = "univer-watermark-panel", watermarkPanelTypeTitle = "univer-watermark-panel-type-title", watermarkPanelTypeSelect = "univer-watermark-panel-type-select", watermarkPanelSetting = "univer-watermark-panel-setting", watermarkPanelFooter = "univer-watermark-panel-footer", watermarkPanelFooterButtonWrapper = "univer-watermark-panel-footer-button-wrapper", watermarkPanelFooterReset = "univer-watermark-panel-footer-reset", watermarkTextSetting = "univer-watermark-text-setting", watermarkTextSettingHeader = "univer-watermark-text-setting-header", watermarkTextSettingFontContent = "univer-watermark-text-setting-font-content", watermarkTextSettingFontStylePart = "univer-watermark-text-setting-font-style-part", watermarkTextSettingLayoutFontWrapper = "univer-watermark-text-setting-layout-font-wrapper", watermarkImageSetting = "univer-watermark-image-setting", watermarkInput = "univer-watermark-input", watermarkInputContent = "univer-watermark-input-content", watermarkIcon = "univer-watermark-icon", watermarkIconWrapper = "univer-watermark-icon-wrapper", watermarkIconWrapperSelect = "univer-watermark-icon-wrapper-select", watermarkColorPickerWrapper = "univer-watermark-color-picker-wrapper", styles = {
206
- watermarkPanel,
207
- watermarkPanelTypeTitle,
208
- watermarkPanelTypeSelect,
209
- watermarkPanelSetting,
210
- watermarkPanelFooter,
211
- watermarkPanelFooterButtonWrapper,
212
- watermarkPanelFooterReset,
213
- watermarkTextSetting,
214
- watermarkTextSettingHeader,
215
- watermarkTextSettingFontContent,
216
- watermarkTextSettingFontStylePart,
217
- watermarkTextSettingLayoutFontWrapper,
218
- watermarkImageSetting,
219
- watermarkInput,
220
- watermarkInputContent,
221
- watermarkIcon,
222
- watermarkIconWrapper,
223
- watermarkIconWrapperSelect,
224
- watermarkColorPickerWrapper
225
- }, WatermarkImageSetting = /* @__PURE__ */ __name(({ config, onChange }) => {
226
- const fileOpenService = useDependency(ILocalFileService), localeService = useDependency(LocaleService);
227
- if (!config) return null;
228
- const handleUpdateImageUrl = /* @__PURE__ */ __name(async () => {
229
- const files = await fileOpenService.openFile({
195
+ };
196
+ T = lt([
197
+ ct(0, j(F))
198
+ ], T);
199
+ const mt = "univer-watermark-panel", dt = "univer-watermark-panel-type-title", ut = "univer-watermark-panel-type-select", pt = "univer-watermark-panel-setting", gt = "univer-watermark-panel-footer", ht = "univer-watermark-panel-footer-button-wrapper", vt = "univer-watermark-panel-footer-reset", ft = "univer-watermark-text-setting", wt = "univer-watermark-text-setting-header", kt = "univer-watermark-text-setting-font-content", St = "univer-watermark-text-setting-font-style-part", xt = "univer-watermark-text-setting-layout-font-wrapper", _t = "univer-watermark-image-setting", yt = "univer-watermark-input", Ct = "univer-watermark-input-content", It = "univer-watermark-icon", jt = "univer-watermark-icon-wrapper", Nt = "univer-watermark-icon-wrapper-select", Tt = "univer-watermark-color-picker-wrapper", o = {
200
+ watermarkPanel: mt,
201
+ watermarkPanelTypeTitle: dt,
202
+ watermarkPanelTypeSelect: ut,
203
+ watermarkPanelSetting: pt,
204
+ watermarkPanelFooter: gt,
205
+ watermarkPanelFooterButtonWrapper: ht,
206
+ watermarkPanelFooterReset: vt,
207
+ watermarkTextSetting: ft,
208
+ watermarkTextSettingHeader: wt,
209
+ watermarkTextSettingFontContent: kt,
210
+ watermarkTextSettingFontStylePart: St,
211
+ watermarkTextSettingLayoutFontWrapper: xt,
212
+ watermarkImageSetting: _t,
213
+ watermarkInput: yt,
214
+ watermarkInputContent: Ct,
215
+ watermarkIcon: It,
216
+ watermarkIconWrapper: jt,
217
+ watermarkIconWrapperSelect: Nt,
218
+ watermarkColorPickerWrapper: Tt
219
+ }, Wt = ({ config: e, onChange: t }) => {
220
+ const a = x(We), r = x(R);
221
+ if (!e) return null;
222
+ const n = async () => {
223
+ const i = await a.openFile({
230
224
  multiple: !1,
231
- accept: WATERMARK_IMAGE_ALLOW_IMAGE_LIST.map((image) => `.${image.replace("image/", "")}`).join(",")
225
+ accept: Xe.map((p) => `.${p.replace("image/", "")}`).join(",")
232
226
  });
233
- if (files.length === 0)
227
+ if (i.length === 0)
234
228
  return !1;
235
- const file = files[0], reader = new FileReader();
236
- reader.onload = function(event) {
237
- var _a5;
238
- if ((_a5 = event.target) != null && _a5.result) {
239
- const base64String = event.target.result, img = new Image();
240
- img.onload = function() {
241
- onChange({ ...config, url: base64String, width: Math.max(20, img.width), height: Math.max(img.height, 20), originRatio: img.width / img.height });
242
- }, img.src = base64String;
229
+ const d = i[0], u = new FileReader();
230
+ u.onload = function(p) {
231
+ var c;
232
+ if ((c = p.target) != null && c.result) {
233
+ const h = p.target.result, v = new Image();
234
+ v.onload = function() {
235
+ t({ ...e, url: h, width: Math.max(20, v.width), height: Math.max(v.height, 20), originRatio: v.width / v.height });
236
+ }, v.src = h;
243
237
  }
244
- }, reader.readAsDataURL(file);
245
- }, "handleUpdateImageUrl");
246
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkImageSetting, children: [
247
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.watermarkTextSettingHeader, children: localeService.t("univer-watermark.image") }),
248
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayout, children: [
249
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: localeService.t("univer-watermark.image") }),
250
- /* @__PURE__ */ jsxRuntimeExports.jsx(
251
- Button,
238
+ }, u.readAsDataURL(d);
239
+ };
240
+ return /* @__PURE__ */ s.jsxs("div", { className: o.watermarkImageSetting, children: [
241
+ /* @__PURE__ */ s.jsx("div", { className: o.watermarkTextSettingHeader, children: r.t("univer-watermark.image") }),
242
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayout, children: [
243
+ /* @__PURE__ */ s.jsx("span", { children: r.t("univer-watermark.image") }),
244
+ /* @__PURE__ */ s.jsx(
245
+ Y,
252
246
  {
253
- onClick: handleUpdateImageUrl,
247
+ onClick: n,
254
248
  style: { marginLeft: 8 },
255
- children: config.url ? localeService.t("univer-watermark.replaceImage") : localeService.t("univer-watermark.uploadImage")
249
+ children: e.url ? r.t("univer-watermark.replaceImage") : r.t("univer-watermark.uploadImage")
256
250
  }
257
251
  ),
258
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingFontStylePart, children: [
259
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
260
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.opacity") }),
261
- /* @__PURE__ */ jsxRuntimeExports.jsx(
262
- InputNumber,
252
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingFontStylePart, children: [
253
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
254
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.opacity") }),
255
+ /* @__PURE__ */ s.jsx(
256
+ g,
263
257
  {
264
- value: config.opacity,
265
- onChange: /* @__PURE__ */ __name((val) => {
266
- val != null && onChange({ ...config, opacity: Number.parseFloat(val.toString()) });
267
- }, "onChange"),
258
+ value: e.opacity,
259
+ onChange: (i) => {
260
+ i != null && t({ ...e, opacity: Number.parseFloat(i.toString()) });
261
+ },
268
262
  max: 1,
269
263
  min: 0,
270
264
  step: 0.05,
271
- className: styles.watermarkInput
265
+ className: o.watermarkInput
272
266
  }
273
267
  )
274
268
  ] }),
275
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
276
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.keepRatio") }),
277
- /* @__PURE__ */ jsxRuntimeExports.jsx(
278
- Checkbox,
269
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
270
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.keepRatio") }),
271
+ /* @__PURE__ */ s.jsx(
272
+ X,
279
273
  {
280
- checked: config.maintainAspectRatio,
281
- onChange: /* @__PURE__ */ __name((val) => {
282
- onChange(val === !0 ? { ...config, maintainAspectRatio: val, height: Math.round(config.width / config.originRatio) } : { ...config, maintainAspectRatio: val });
283
- }, "onChange")
274
+ checked: e.maintainAspectRatio,
275
+ onChange: (i) => {
276
+ t(i === !0 ? { ...e, maintainAspectRatio: i, height: Math.round(e.width / e.originRatio) } : { ...e, maintainAspectRatio: i });
277
+ }
284
278
  }
285
279
  )
286
280
  ] })
287
281
  ] })
288
282
  ] }),
289
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.watermarkTextSettingLayout, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingFontStylePart, children: [
290
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
291
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.width") }),
292
- /* @__PURE__ */ jsxRuntimeExports.jsx(
293
- InputNumber,
283
+ /* @__PURE__ */ s.jsx("div", { className: o.watermarkTextSettingLayout, children: /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingFontStylePart, children: [
284
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
285
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.width") }),
286
+ /* @__PURE__ */ s.jsx(
287
+ g,
294
288
  {
295
- value: config.width,
296
- onChange: /* @__PURE__ */ __name((val) => {
297
- if (val != null) {
298
- const newWidth = Math.max(20, Number.parseInt(val.toString()));
299
- config.maintainAspectRatio ? onChange({ ...config, width: newWidth, height: Math.round(newWidth / config.originRatio) }) : onChange({ ...config, width: newWidth });
289
+ value: e.width,
290
+ onChange: (i) => {
291
+ if (i != null) {
292
+ const l = Math.max(20, Number.parseInt(i.toString()));
293
+ e.maintainAspectRatio ? t({ ...e, width: l, height: Math.round(l / e.originRatio) }) : t({ ...e, width: l });
300
294
  }
301
- }, "onChange"),
295
+ },
302
296
  min: 20,
303
- className: styles.watermarkInput
297
+ className: o.watermarkInput
304
298
  }
305
299
  )
306
300
  ] }),
307
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
308
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.height") }),
309
- /* @__PURE__ */ jsxRuntimeExports.jsx(
310
- InputNumber,
301
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
302
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.height") }),
303
+ /* @__PURE__ */ s.jsx(
304
+ g,
311
305
  {
312
- value: config.height,
313
- onChange: /* @__PURE__ */ __name((val) => {
314
- if (val != null) {
315
- const newHeight = Math.max(20, Number.parseInt(val.toString()));
316
- config.maintainAspectRatio ? onChange({ ...config, height: newHeight, width: Math.round(newHeight * config.originRatio) }) : onChange({ ...config, height: Number.parseInt(val.toString()) });
306
+ value: e.height,
307
+ onChange: (i) => {
308
+ if (i != null) {
309
+ const l = Math.max(20, Number.parseInt(i.toString()));
310
+ e.maintainAspectRatio ? t({ ...e, height: l, width: Math.round(l * e.originRatio) }) : t({ ...e, height: Number.parseInt(i.toString()) });
317
311
  }
318
- }, "onChange"),
312
+ },
319
313
  min: 20,
320
- className: styles.watermarkInput
314
+ className: o.watermarkInput
321
315
  }
322
316
  )
323
317
  ] })
324
318
  ] }) }),
325
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.watermarkTextSettingHeader, children: localeService.t("univer-watermark.layout") }),
326
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayout, children: [
327
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingFontStylePart, children: [
328
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
329
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.rotate") }),
330
- /* @__PURE__ */ jsxRuntimeExports.jsx(
331
- InputNumber,
319
+ /* @__PURE__ */ s.jsx("div", { className: o.watermarkTextSettingHeader, children: r.t("univer-watermark.layout") }),
320
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayout, children: [
321
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingFontStylePart, children: [
322
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
323
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.rotate") }),
324
+ /* @__PURE__ */ s.jsx(
325
+ g,
332
326
  {
333
- value: config.rotate,
334
- onChange: /* @__PURE__ */ __name((val) => {
335
- val != null && onChange({ ...config, rotate: Number.parseInt(val.toString()) });
336
- }, "onChange"),
327
+ value: e.rotate,
328
+ onChange: (i) => {
329
+ i != null && t({ ...e, rotate: Number.parseInt(i.toString()) });
330
+ },
337
331
  max: 360,
338
332
  min: -360,
339
- className: styles.watermarkInput
333
+ className: o.watermarkInput
340
334
  }
341
335
  )
342
336
  ] }),
343
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
344
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.repeat") }),
345
- /* @__PURE__ */ jsxRuntimeExports.jsx(
346
- Checkbox,
337
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
338
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.repeat") }),
339
+ /* @__PURE__ */ s.jsx(
340
+ X,
347
341
  {
348
- checked: config.repeat,
349
- onChange: /* @__PURE__ */ __name((val) => onChange({ ...config, repeat: val }), "onChange")
342
+ checked: e.repeat,
343
+ onChange: (i) => t({ ...e, repeat: i })
350
344
  }
351
345
  )
352
346
  ] })
353
347
  ] }),
354
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingFontStylePart, children: [
355
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
356
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.spacingX") }),
357
- /* @__PURE__ */ jsxRuntimeExports.jsx(
358
- InputNumber,
348
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingFontStylePart, children: [
349
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
350
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.spacingX") }),
351
+ /* @__PURE__ */ s.jsx(
352
+ g,
359
353
  {
360
- value: config.spacingX,
361
- onChange: /* @__PURE__ */ __name((val) => {
362
- val != null && onChange({ ...config, spacingX: Number.parseInt(val.toString()) });
363
- }, "onChange"),
354
+ value: e.spacingX,
355
+ onChange: (i) => {
356
+ i != null && t({ ...e, spacingX: Number.parseInt(i.toString()) });
357
+ },
364
358
  min: 0,
365
- className: styles.watermarkInput
359
+ className: o.watermarkInput
366
360
  }
367
361
  )
368
362
  ] }),
369
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
370
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.spacingY") }),
371
- /* @__PURE__ */ jsxRuntimeExports.jsx(
372
- InputNumber,
363
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
364
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.spacingY") }),
365
+ /* @__PURE__ */ s.jsx(
366
+ g,
373
367
  {
374
- value: config.spacingY,
375
- onChange: /* @__PURE__ */ __name((val) => {
376
- val != null && onChange({ ...config, spacingY: Number.parseInt(val.toString()) });
377
- }, "onChange"),
368
+ value: e.spacingY,
369
+ onChange: (i) => {
370
+ i != null && t({ ...e, spacingY: Number.parseInt(i.toString()) });
371
+ },
378
372
  min: 0,
379
- className: styles.watermarkInput
373
+ className: o.watermarkInput
380
374
  }
381
375
  )
382
376
  ] })
383
377
  ] }),
384
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingFontStylePart, children: [
385
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
386
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.startX") }),
387
- /* @__PURE__ */ jsxRuntimeExports.jsx(
388
- InputNumber,
378
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingFontStylePart, children: [
379
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
380
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.startX") }),
381
+ /* @__PURE__ */ s.jsx(
382
+ g,
389
383
  {
390
- value: config.x,
391
- onChange: /* @__PURE__ */ __name((val) => {
392
- val != null && onChange({ ...config, x: Number.parseInt(val.toString()) });
393
- }, "onChange"),
384
+ value: e.x,
385
+ onChange: (i) => {
386
+ i != null && t({ ...e, x: Number.parseInt(i.toString()) });
387
+ },
394
388
  min: 0,
395
- className: styles.watermarkInput
389
+ className: o.watermarkInput
396
390
  }
397
391
  )
398
392
  ] }),
399
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
400
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.startY") }),
401
- /* @__PURE__ */ jsxRuntimeExports.jsx(
402
- InputNumber,
393
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
394
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.startY") }),
395
+ /* @__PURE__ */ s.jsx(
396
+ g,
403
397
  {
404
- value: config.y,
405
- onChange: /* @__PURE__ */ __name((val) => {
406
- val != null && onChange({ ...config, y: Number.parseInt(val.toString()) });
407
- }, "onChange"),
398
+ value: e.y,
399
+ onChange: (i) => {
400
+ i != null && t({ ...e, y: Number.parseInt(i.toString()) });
401
+ },
408
402
  min: 0,
409
- className: styles.watermarkInput
403
+ className: o.watermarkInput
410
404
  }
411
405
  )
412
406
  ] })
413
407
  ] })
414
408
  ] })
415
409
  ] });
416
- }, "WatermarkImageSetting");
417
- function r(e) {
418
- var t, f2, n2 = "";
419
- if (typeof e == "string" || typeof e == "number") n2 += e;
410
+ };
411
+ function ge(e) {
412
+ var t, a, r = "";
413
+ if (typeof e == "string" || typeof e == "number") r += e;
420
414
  else if (typeof e == "object") if (Array.isArray(e)) {
421
- var o = e.length;
422
- for (t = 0; t < o; t++) e[t] && (f2 = r(e[t])) && (n2 && (n2 += " "), n2 += f2);
423
- } else for (f2 in e) e[f2] && (n2 && (n2 += " "), n2 += f2);
424
- return n2;
415
+ var n = e.length;
416
+ for (t = 0; t < n; t++) e[t] && (a = ge(e[t])) && (r && (r += " "), r += a);
417
+ } else for (a in e) e[a] && (r && (r += " "), r += a);
418
+ return r;
425
419
  }
426
- __name(r, "r");
427
- function clsx() {
428
- for (var e, t, f2 = 0, n2 = "", o = arguments.length; f2 < o; f2++) (e = arguments[f2]) && (t = r(e)) && (n2 && (n2 += " "), n2 += t);
429
- return n2;
420
+ function q() {
421
+ for (var e, t, a = 0, r = "", n = arguments.length; a < n; a++) (e = arguments[a]) && (t = ge(e)) && (r && (r += " "), r += t);
422
+ return r;
430
423
  }
431
- __name(clsx, "clsx");
432
- const WatermarkTextSetting = /* @__PURE__ */ __name((props) => {
433
- var _a5;
434
- const { config, onChange } = props, localeService = useDependency(LocaleService);
435
- return config ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSetting, children: [
436
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.watermarkTextSettingHeader, children: localeService.t("univer-watermark.style") }),
437
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingFontContent, children: [
438
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.content") }),
439
- /* @__PURE__ */ jsxRuntimeExports.jsx(
440
- Input,
424
+ const bt = (e) => {
425
+ var n;
426
+ const { config: t, onChange: a } = e, r = x(R);
427
+ return t ? /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSetting, children: [
428
+ /* @__PURE__ */ s.jsx("div", { className: o.watermarkTextSettingHeader, children: r.t("univer-watermark.style") }),
429
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingFontContent, children: [
430
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.content") }),
431
+ /* @__PURE__ */ s.jsx(
432
+ Ue,
441
433
  {
442
- value: config.content,
443
- onChange: /* @__PURE__ */ __name((val) => onChange({ ...config, content: val }), "onChange"),
444
- className: styles.watermarkInputContent,
445
- placeholder: localeService.t("univer-watermark.textPlaceholder")
434
+ value: t.content,
435
+ onChange: (i) => a({ ...t, content: i }),
436
+ className: o.watermarkInputContent,
437
+ placeholder: r.t("univer-watermark.textPlaceholder")
446
438
  }
447
439
  )
448
440
  ] }),
449
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingFontStyle, children: [
450
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingFontStylePart, children: [
451
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
452
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.fontSize") }),
453
- /* @__PURE__ */ jsxRuntimeExports.jsx(
454
- InputNumber,
441
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingFontStyle, children: [
442
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingFontStylePart, children: [
443
+ /* @__PURE__ */ s.jsxs("div", { children: [
444
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.fontSize") }),
445
+ /* @__PURE__ */ s.jsx(
446
+ g,
455
447
  {
456
- value: config.fontSize,
457
- onChange: /* @__PURE__ */ __name((val) => {
458
- val != null && onChange({ ...config, fontSize: Number.parseInt(val.toString()) });
459
- }, "onChange"),
448
+ value: t.fontSize,
449
+ onChange: (i) => {
450
+ i != null && a({ ...t, fontSize: Number.parseInt(i.toString()) });
451
+ },
460
452
  max: 72,
461
453
  min: 12,
462
- className: styles.watermarkInput
454
+ className: o.watermarkInput
463
455
  }
464
456
  )
465
457
  ] }),
466
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { margin: "0 8px" }, children: [
467
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.direction") }),
468
- /* @__PURE__ */ jsxRuntimeExports.jsx(
469
- Select,
458
+ /* @__PURE__ */ s.jsxs("div", { style: { margin: "0 8px" }, children: [
459
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.direction") }),
460
+ /* @__PURE__ */ s.jsx(
461
+ re,
470
462
  {
471
- value: config.direction,
472
- onChange: /* @__PURE__ */ __name((v) => onChange({ ...config, direction: v }), "onChange"),
463
+ value: t.direction,
464
+ onChange: (i) => a({ ...t, direction: i }),
473
465
  options: [
474
- { label: localeService.t("univer-watermark.ltr"), value: "ltr" },
475
- { label: localeService.t("univer-watermark.rtl"), value: "rtl" }
466
+ { label: r.t("univer-watermark.ltr"), value: "ltr" },
467
+ { label: r.t("univer-watermark.rtl"), value: "rtl" }
476
468
  ]
477
469
  }
478
470
  )
479
471
  ] }),
480
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
481
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.opacity") }),
482
- /* @__PURE__ */ jsxRuntimeExports.jsx(
483
- InputNumber,
472
+ /* @__PURE__ */ s.jsxs("div", { children: [
473
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.opacity") }),
474
+ /* @__PURE__ */ s.jsx(
475
+ g,
484
476
  {
485
- value: config.opacity,
486
- onChange: /* @__PURE__ */ __name((val) => {
487
- val != null && onChange({ ...config, opacity: Number.parseFloat(val.toString()) });
488
- }, "onChange"),
477
+ value: t.opacity,
478
+ onChange: (i) => {
479
+ i != null && a({ ...t, opacity: Number.parseFloat(i.toString()) });
480
+ },
489
481
  max: 1,
490
482
  min: 0,
491
483
  step: 0.05,
492
- className: styles.watermarkInput
484
+ className: o.watermarkInput
493
485
  }
494
486
  )
495
487
  ] })
496
488
  ] }),
497
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingFontStylePart, children: [
498
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.watermarkIconWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
499
- Dropdown,
489
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingFontStylePart, children: [
490
+ /* @__PURE__ */ s.jsx("div", { className: o.watermarkIconWrapper, children: /* @__PURE__ */ s.jsx(
491
+ $e,
500
492
  {
501
- overlay: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.watermarkColorPickerWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, { color: config.color, onChange: /* @__PURE__ */ __name((val) => onChange({ ...config, color: val }), "onChange") }) }),
502
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(FontColor, { className: styles.watermarkIcon, extend: { colorChannel1: (_a5 = config.color) != null ? _a5 : "rgb(var(--primary-color))" } })
493
+ overlay: /* @__PURE__ */ s.jsx("div", { className: o.watermarkColorPickerWrapper, children: /* @__PURE__ */ s.jsx(De, { color: t.color, onChange: (i) => a({ ...t, color: i }) }) }),
494
+ children: /* @__PURE__ */ s.jsx(ce, { className: o.watermarkIcon, extend: { colorChannel1: (n = t.color) != null ? n : "rgb(var(--primary-color))" } })
503
495
  }
504
496
  ) }),
505
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles.watermarkIconWrapper, { [styles.watermarkIconWrapperSelect]: config.bold }), onClick: /* @__PURE__ */ __name(() => {
506
- onChange({ ...config, bold: !config.bold });
507
- }, "onClick"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(BoldSingle, { className: styles.watermarkIcon }) }),
508
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles.watermarkIconWrapper, { [styles.watermarkIconWrapperSelect]: config.italic }), onClick: /* @__PURE__ */ __name(() => {
509
- onChange({ ...config, italic: !config.italic });
510
- }, "onClick"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ItalicSingle, { className: styles.watermarkIcon }) })
497
+ /* @__PURE__ */ s.jsx("div", { className: q(o.watermarkIconWrapper, { [o.watermarkIconWrapperSelect]: t.bold }), onClick: () => {
498
+ a({ ...t, bold: !t.bold });
499
+ }, children: /* @__PURE__ */ s.jsx(le, { className: o.watermarkIcon }) }),
500
+ /* @__PURE__ */ s.jsx("div", { className: q(o.watermarkIconWrapper, { [o.watermarkIconWrapperSelect]: t.italic }), onClick: () => {
501
+ a({ ...t, italic: !t.italic });
502
+ }, children: /* @__PURE__ */ s.jsx(me, { className: o.watermarkIcon }) })
511
503
  ] })
512
504
  ] }),
513
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.watermarkTextSettingHeader, children: localeService.t("univer-watermark.layout") }),
514
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayout, children: [
515
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingFontStylePart, children: [
516
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
517
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.rotate") }),
518
- /* @__PURE__ */ jsxRuntimeExports.jsx(
519
- InputNumber,
505
+ /* @__PURE__ */ s.jsx("div", { className: o.watermarkTextSettingHeader, children: r.t("univer-watermark.layout") }),
506
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayout, children: [
507
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingFontStylePart, children: [
508
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
509
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.rotate") }),
510
+ /* @__PURE__ */ s.jsx(
511
+ g,
520
512
  {
521
- value: config.rotate,
522
- onChange: /* @__PURE__ */ __name((val) => {
523
- val != null && onChange({ ...config, rotate: Number.parseInt(val.toString()) });
524
- }, "onChange"),
513
+ value: t.rotate,
514
+ onChange: (i) => {
515
+ i != null && a({ ...t, rotate: Number.parseInt(i.toString()) });
516
+ },
525
517
  max: 360,
526
518
  min: -360,
527
- className: styles.watermarkInput
519
+ className: o.watermarkInput
528
520
  }
529
521
  )
530
522
  ] }),
531
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
532
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.repeat") }),
533
- /* @__PURE__ */ jsxRuntimeExports.jsx(
534
- Checkbox,
523
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
524
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.repeat") }),
525
+ /* @__PURE__ */ s.jsx(
526
+ X,
535
527
  {
536
- checked: config.repeat,
537
- onChange: /* @__PURE__ */ __name((val) => onChange({ ...config, repeat: val }), "onChange")
528
+ checked: t.repeat,
529
+ onChange: (i) => a({ ...t, repeat: i })
538
530
  }
539
531
  )
540
532
  ] })
541
533
  ] }),
542
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingFontStylePart, children: [
543
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
544
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.spacingX") }),
545
- /* @__PURE__ */ jsxRuntimeExports.jsx(
546
- InputNumber,
534
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingFontStylePart, children: [
535
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
536
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.spacingX") }),
537
+ /* @__PURE__ */ s.jsx(
538
+ g,
547
539
  {
548
- value: config.spacingX,
549
- onChange: /* @__PURE__ */ __name((val) => {
550
- val != null && onChange({ ...config, spacingX: Number.parseInt(val.toString()) });
551
- }, "onChange"),
540
+ value: t.spacingX,
541
+ onChange: (i) => {
542
+ i != null && a({ ...t, spacingX: Number.parseInt(i.toString()) });
543
+ },
552
544
  min: 0,
553
- className: styles.watermarkInput
545
+ className: o.watermarkInput
554
546
  }
555
547
  )
556
548
  ] }),
557
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
558
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.spacingY") }),
559
- /* @__PURE__ */ jsxRuntimeExports.jsx(
560
- InputNumber,
549
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
550
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.spacingY") }),
551
+ /* @__PURE__ */ s.jsx(
552
+ g,
561
553
  {
562
- value: config.spacingY,
563
- onChange: /* @__PURE__ */ __name((val) => {
564
- val != null && onChange({ ...config, spacingY: Number.parseInt(val.toString()) });
565
- }, "onChange"),
554
+ value: t.spacingY,
555
+ onChange: (i) => {
556
+ i != null && a({ ...t, spacingY: Number.parseInt(i.toString()) });
557
+ },
566
558
  min: 0,
567
- className: styles.watermarkInput
559
+ className: o.watermarkInput
568
560
  }
569
561
  )
570
562
  ] })
571
563
  ] }),
572
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingFontStylePart, children: [
573
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
574
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.startX") }),
575
- /* @__PURE__ */ jsxRuntimeExports.jsx(
576
- InputNumber,
564
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingFontStylePart, children: [
565
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
566
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.startX") }),
567
+ /* @__PURE__ */ s.jsx(
568
+ g,
577
569
  {
578
- value: config.x,
579
- onChange: /* @__PURE__ */ __name((val) => {
580
- val != null && onChange({ ...config, x: Number.parseInt(val.toString()) });
581
- }, "onChange"),
570
+ value: t.x,
571
+ onChange: (i) => {
572
+ i != null && a({ ...t, x: Number.parseInt(i.toString()) });
573
+ },
582
574
  min: 0,
583
- className: styles.watermarkInput
575
+ className: o.watermarkInput
584
576
  }
585
577
  )
586
578
  ] }),
587
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkTextSettingLayoutFontWrapper, children: [
588
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("univer-watermark.startY") }),
589
- /* @__PURE__ */ jsxRuntimeExports.jsx(
590
- InputNumber,
579
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkTextSettingLayoutFontWrapper, children: [
580
+ /* @__PURE__ */ s.jsx("div", { children: r.t("univer-watermark.startY") }),
581
+ /* @__PURE__ */ s.jsx(
582
+ g,
591
583
  {
592
- value: config.y,
593
- onChange: /* @__PURE__ */ __name((val) => {
594
- val != null && onChange({ ...config, y: Number.parseInt(val.toString()) });
595
- }, "onChange"),
584
+ value: t.y,
585
+ onChange: (i) => {
586
+ i != null && a({ ...t, y: Number.parseInt(i.toString()) });
587
+ },
596
588
  min: 0,
597
- className: styles.watermarkInput
589
+ className: o.watermarkInput
598
590
  }
599
591
  )
600
592
  ] })
601
593
  ] })
602
594
  ] })
603
595
  ] }) : null;
604
- }, "WatermarkTextSetting"), WatermarkPanel = /* @__PURE__ */ __name(() => {
605
- const [watermarkType, setWatermarkType] = useState(IWatermarkTypeEnum.Text), [config, setConfig] = useState(), watermarkService = useDependency(WatermarkService), localStorageService = useDependency(ILocalStorageService), _refresh = useObservable(watermarkService.refresh$), localeService = useDependency(LocaleService);
606
- function handleConfigChange(config2, type) {
607
- setConfig(config2), watermarkService.updateWatermarkConfig({ type: type != null ? type : watermarkType, config: config2 });
596
+ }, Rt = () => {
597
+ const [e, t] = z(m.Text), [a, r] = z(), n = x(T), i = x(F), l = we(n.refresh$), d = x(R);
598
+ function u(c, h) {
599
+ r(c), n.updateWatermarkConfig({ type: h != null ? h : e, config: c });
608
600
  }
609
- __name(handleConfigChange, "handleConfigChange");
610
- const getWatermarkConfig = useCallback(async () => {
611
- const watermarkConfig = await localStorageService.getItem(UNIVER_WATERMARK_STORAGE_KEY);
612
- watermarkConfig ? (setWatermarkType(watermarkConfig.type), setConfig(watermarkConfig.config)) : setConfig({ text: WatermarkTextBaseConfig });
601
+ const p = Fe(async () => {
602
+ const c = await i.getItem(S);
603
+ c ? (t(c.type), r(c.config)) : r({ text: O });
613
604
  }, []);
614
- return useEffect(() => {
615
- getWatermarkConfig();
616
- }, [_refresh, getWatermarkConfig]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkPanel, children: [
617
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.watermarkPanelTypeTitle, children: localeService.t("univer-watermark.type") }),
618
- /* @__PURE__ */ jsxRuntimeExports.jsx(
619
- Select,
605
+ return Ae(() => {
606
+ p();
607
+ }, [l, p]), /* @__PURE__ */ s.jsxs("div", { className: o.watermarkPanel, children: [
608
+ /* @__PURE__ */ s.jsx("div", { className: o.watermarkPanelTypeTitle, children: d.t("univer-watermark.type") }),
609
+ /* @__PURE__ */ s.jsx(
610
+ re,
620
611
  {
621
- value: watermarkType,
622
- onChange: /* @__PURE__ */ __name((v) => {
623
- setWatermarkType(v), v === IWatermarkTypeEnum.Text ? handleConfigChange({ text: WatermarkTextBaseConfig }, IWatermarkTypeEnum.Text) : v === IWatermarkTypeEnum.Image && handleConfigChange({ image: WatermarkImageBaseConfig }, IWatermarkTypeEnum.Image);
624
- }, "onChange"),
612
+ value: e,
613
+ onChange: (c) => {
614
+ t(c), c === m.Text ? u({ text: O }, m.Text) : c === m.Image && u({ image: se }, m.Image);
615
+ },
625
616
  options: [
626
- { label: localeService.t("univer-watermark.text"), value: IWatermarkTypeEnum.Text },
627
- { label: localeService.t("univer-watermark.image"), value: IWatermarkTypeEnum.Image }
617
+ { label: d.t("univer-watermark.text"), value: m.Text },
618
+ { label: d.t("univer-watermark.image"), value: m.Image }
628
619
  ],
629
- className: styles.watermarkPanelTypeSelect
620
+ className: o.watermarkPanelTypeSelect
630
621
  }
631
622
  ),
632
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkPanelSetting, children: [
633
- watermarkType === IWatermarkTypeEnum.Text && /* @__PURE__ */ jsxRuntimeExports.jsx(WatermarkTextSetting, { config: config == null ? void 0 : config.text, onChange: /* @__PURE__ */ __name((v) => handleConfigChange({ text: v }), "onChange") }),
634
- watermarkType === IWatermarkTypeEnum.Image && /* @__PURE__ */ jsxRuntimeExports.jsx(WatermarkImageSetting, { config: config == null ? void 0 : config.image, onChange: /* @__PURE__ */ __name((v) => handleConfigChange({ image: v }), "onChange") })
623
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkPanelSetting, children: [
624
+ e === m.Text && /* @__PURE__ */ s.jsx(bt, { config: a == null ? void 0 : a.text, onChange: (c) => u({ text: c }) }),
625
+ e === m.Image && /* @__PURE__ */ s.jsx(Wt, { config: a == null ? void 0 : a.image, onChange: (c) => u({ image: c }) })
635
626
  ] })
636
627
  ] });
637
- }, "WatermarkPanel"), WatermarkPanelFooter = /* @__PURE__ */ __name(() => {
638
- const sidebarService = useDependency(ISidebarService), watermarkService = useDependency(WatermarkService), localeService = useDependency(LocaleService), clipboardService = useDependency(IClipboardInterfaceService);
639
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkPanelFooter, children: [
640
- /* @__PURE__ */ jsxRuntimeExports.jsx(
628
+ }, Pt = () => {
629
+ const e = x(te), t = x(T), a = x(R), r = x(be);
630
+ return /* @__PURE__ */ s.jsxs("div", { className: o.watermarkPanelFooter, children: [
631
+ /* @__PURE__ */ s.jsx(
641
632
  "div",
642
633
  {
643
- className: styles.watermarkPanelFooterReset,
644
- onClick: /* @__PURE__ */ __name(() => {
645
- watermarkService.updateWatermarkConfig({
646
- type: IWatermarkTypeEnum.Text,
647
- config: { text: WatermarkTextBaseConfig }
648
- }), watermarkService.refresh();
649
- }, "onClick"),
650
- children: localeService.t("univer-watermark.cancel")
634
+ className: o.watermarkPanelFooterReset,
635
+ onClick: () => {
636
+ t.updateWatermarkConfig({
637
+ type: m.Text,
638
+ config: { text: O }
639
+ }), t.refresh();
640
+ },
641
+ children: a.t("univer-watermark.cancel")
651
642
  }
652
643
  ),
653
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.watermarkPanelFooterButtonWrapper, children: [
654
- /* @__PURE__ */ jsxRuntimeExports.jsx(
655
- Button,
644
+ /* @__PURE__ */ s.jsxs("div", { className: o.watermarkPanelFooterButtonWrapper, children: [
645
+ /* @__PURE__ */ s.jsx(
646
+ Y,
656
647
  {
657
648
  style: { marginRight: 8 },
658
- onClick: /* @__PURE__ */ __name(async () => {
659
- const watermarkConfig = await watermarkService.getWatermarkConfig();
660
- let config;
661
- (watermarkConfig == null ? void 0 : watermarkConfig.type) === IWatermarkTypeEnum.Text ? config = watermarkConfig.config.text : (watermarkConfig == null ? void 0 : watermarkConfig.type) === IWatermarkTypeEnum.Image && (config = watermarkConfig.config.image), clipboardService.writeText(JSON.stringify(config));
662
- }, "onClick"),
663
- children: localeService.t("univer-watermark.copy")
649
+ onClick: async () => {
650
+ const n = await t.getWatermarkConfig();
651
+ let i;
652
+ (n == null ? void 0 : n.type) === m.Text ? i = n.config.text : (n == null ? void 0 : n.type) === m.Image && (i = n.config.image), r.writeText(JSON.stringify(i));
653
+ },
654
+ children: a.t("univer-watermark.copy")
664
655
  }
665
656
  ),
666
- /* @__PURE__ */ jsxRuntimeExports.jsx(
667
- Button,
657
+ /* @__PURE__ */ s.jsx(
658
+ Y,
668
659
  {
669
- onClick: /* @__PURE__ */ __name(async () => {
670
- var _a5, _b;
671
- const watermarkConfig = await watermarkService.getWatermarkConfig();
672
- ((watermarkConfig == null ? void 0 : watermarkConfig.type) === IWatermarkTypeEnum.Text && !((_a5 = watermarkConfig.config.text) != null && _a5.content) || (watermarkConfig == null ? void 0 : watermarkConfig.type) === IWatermarkTypeEnum.Image && !((_b = watermarkConfig.config.image) != null && _b.url)) && watermarkService.deleteWatermarkConfig(), sidebarService.close();
673
- }, "onClick"),
674
- children: localeService.t("univer-watermark.close")
660
+ onClick: async () => {
661
+ var i, l;
662
+ const n = await t.getWatermarkConfig();
663
+ ((n == null ? void 0 : n.type) === m.Text && !((i = n.config.text) != null && i.content) || (n == null ? void 0 : n.type) === m.Image && !((l = n.config.image) != null && l.url)) && t.deleteWatermarkConfig(), e.close();
664
+ },
665
+ children: a.t("univer-watermark.close")
675
666
  }
676
667
  )
677
668
  ] })
678
669
  ] });
679
- }, "WatermarkPanelFooter");
680
- function WatermarkMenuItemFactory(accessor) {
670
+ };
671
+ function Lt(e) {
681
672
  return {
682
- id: OpenWatermarkPanelOperation.id,
673
+ id: K.id,
683
674
  title: "univer-watermark.title",
684
675
  tooltip: "univer-watermark.title",
685
- icon: UNIVER_WATERMARK_MENU,
686
- type: MenuItemType.BUTTON,
687
- hidden$: getWatermarkMenuHiddenObservable(accessor)
676
+ icon: ae,
677
+ type: Re.BUTTON,
678
+ hidden$: Mt(e)
688
679
  };
689
680
  }
690
- __name(WatermarkMenuItemFactory, "WatermarkMenuItemFactory");
691
- function getWatermarkMenuHiddenObservable(accessor) {
692
- return accessor.get(IUniverInstanceService).focused$.pipe(
693
- switchMap((id) => id === DOCS_ZEN_EDITOR_UNIT_ID_KEY ? of(!0) : of(!1))
681
+ function Mt(e) {
682
+ return e.get(ke).focused$.pipe(
683
+ He((a) => a === Se ? Z(!0) : Z(!1))
694
684
  );
695
685
  }
696
- __name(getWatermarkMenuHiddenObservable, "getWatermarkMenuHiddenObservable");
697
- const menuSchema = {
698
- [RibbonStartGroup.OTHERS]: {
699
- [OpenWatermarkPanelOperation.id]: {
686
+ const Ot = {
687
+ [Pe.OTHERS]: {
688
+ [K.id]: {
700
689
  order: 0,
701
- menuItemFactory: WatermarkMenuItemFactory
690
+ menuItemFactory: Lt
702
691
  }
703
692
  }
704
693
  };
705
- var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
706
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
707
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
708
- return kind && result && __defProp$2(target, key, result), result;
709
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a2;
710
- let UniverWatermarkMenuController = (_a2 = class extends Disposable {
711
- constructor(_menuManagerService, _componentManager) {
712
- super(), this._menuManagerService = _menuManagerService, this._componentManager = _componentManager, this._initMenu(), this._initComponents();
694
+ var Et = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, At = (e, t, a, r) => {
695
+ for (var n = r > 1 ? void 0 : r ? Ft(t, a) : t, i = e.length - 1, l; i >= 0; i--)
696
+ (l = e[i]) && (n = (r ? l(t, a, n) : l(n)) || n);
697
+ return r && n && Et(t, a, n), n;
698
+ }, J = (e, t) => (a, r) => t(a, r, e);
699
+ let E = class extends ee {
700
+ constructor(e, t) {
701
+ super(), this._menuManagerService = e, this._componentManager = t, this._initMenu(), this._initComponents();
713
702
  }
714
703
  _initComponents() {
715
704
  [
716
- [UNIVER_WATERMARK_MENU, WatermarkSingle],
717
- [WATERMARK_PANEL, WatermarkPanel],
718
- [WATERMARK_PANEL_FOOTER, WatermarkPanelFooter]
719
- ].forEach(([key, component]) => {
720
- this.disposeWithMe(this._componentManager.register(key, component));
705
+ [ae, de],
706
+ [ne, Rt],
707
+ [ie, Pt]
708
+ ].forEach(([e, t]) => {
709
+ this.disposeWithMe(this._componentManager.register(e, t));
721
710
  });
722
711
  }
723
712
  _initMenu() {
724
- this._menuManagerService.mergeMenu(menuSchema);
713
+ this._menuManagerService.mergeMenu(Ot);
725
714
  }
726
- }, __name(_a2, "UniverWatermarkMenuController"), _a2);
727
- UniverWatermarkMenuController = __decorateClass$2([
728
- __decorateParam$2(0, IMenuManagerService),
729
- __decorateParam$2(1, Inject(ComponentManager))
730
- ], UniverWatermarkMenuController);
731
- function renderWatermark(ctx, config, image, userInfo) {
732
- const type = config.type, watermarkConfig = config.config;
733
- type === IWatermarkTypeEnum.UserInfo && watermarkConfig.userInfo ? renderUserInfoWatermark(ctx, watermarkConfig.userInfo, userInfo) : type === IWatermarkTypeEnum.Image && watermarkConfig.image ? renderImageWatermark(ctx, watermarkConfig.image, image) : type === IWatermarkTypeEnum.Text && watermarkConfig.text && renderTextWatermark(ctx, watermarkConfig.text);
715
+ };
716
+ E = At([
717
+ J(0, Me),
718
+ J(1, j(Le))
719
+ ], E);
720
+ function Ut(e, t, a, r) {
721
+ const n = t.type, i = t.config;
722
+ n === m.UserInfo && i.userInfo ? $t(e, i.userInfo, r) : n === m.Image && i.image ? Ht(e, i.image, a) : n === m.Text && i.text && Dt(e, i.text);
734
723
  }
735
- __name(renderWatermark, "renderWatermark");
736
- function renderUserInfoWatermark(ctx, config, userInfo) {
737
- const { x, y, repeat, spacingX, spacingY, rotate, opacity, name, fontSize, color, bold, italic, direction } = config;
738
- if (!userInfo)
724
+ function $t(e, t, a) {
725
+ const { x: r, y: n, repeat: i, spacingX: l, spacingY: d, rotate: u, opacity: p, name: c, fontSize: h, color: v, bold: W, italic: N, direction: w } = t;
726
+ if (!a)
739
727
  return;
740
- let watermarkContent = "";
741
- if (name && (watermarkContent += `${userInfo.name} `), !watermarkContent)
728
+ let _ = "";
729
+ if (c && (_ += `${a.name} `), !_)
742
730
  return;
743
- ctx.save(), ctx.globalAlpha = opacity, ctx.direction = direction;
744
- let fontStyle = "";
745
- if (italic && (fontStyle += "italic "), bold && (fontStyle += "bold "), fontStyle += `${fontSize}px Arial`, ctx.font = fontStyle, ctx.fillStyle = color, repeat) {
746
- const canvasWidth = ctx.canvas.width, canvasHeight = ctx.canvas.height;
747
- for (let posY = y; posY < canvasHeight; posY += fontSize + spacingY)
748
- for (let posX = x; posX < canvasWidth; posX += ctx.measureText(watermarkContent).width + spacingX)
749
- ctx.save(), ctx.translate(posX, posY), ctx.rotate(Math.PI / 180 * rotate), ctx.fillText(watermarkContent, 0, 0), ctx.restore();
731
+ e.save(), e.globalAlpha = p, e.direction = w;
732
+ let I = "";
733
+ if (N && (I += "italic "), W && (I += "bold "), I += `${h}px Arial`, e.font = I, e.fillStyle = v, i) {
734
+ const y = e.canvas.width, C = e.canvas.height;
735
+ for (let U = n; U < C; U += h + d)
736
+ for (let $ = r; $ < y; $ += e.measureText(_).width + l)
737
+ e.save(), e.translate($, U), e.rotate(Math.PI / 180 * u), e.fillText(_, 0, 0), e.restore();
750
738
  } else
751
- ctx.save(), ctx.translate(x, y), ctx.rotate(Math.PI / 180 * rotate), ctx.fillText(watermarkContent, 0, 0), ctx.restore();
752
- ctx.restore();
739
+ e.save(), e.translate(r, n), e.rotate(Math.PI / 180 * u), e.fillText(_, 0, 0), e.restore();
740
+ e.restore();
753
741
  }
754
- __name(renderUserInfoWatermark, "renderUserInfoWatermark");
755
- function renderTextWatermark(ctx, config) {
756
- const { x, y, repeat, spacingX, spacingY, rotate, opacity, content, fontSize, color, bold, italic, direction } = config;
757
- ctx.save(), ctx.globalAlpha = opacity, ctx.direction = direction;
758
- let fontStyle = "";
759
- if (italic && (fontStyle += "italic "), bold && (fontStyle += "bold "), fontStyle += `${fontSize}px Arial`, ctx.font = fontStyle, ctx.fillStyle = color, content)
760
- if (repeat) {
761
- const canvasWidth = ctx.canvas.width, canvasHeight = ctx.canvas.height;
762
- for (let posY = y; posY < canvasHeight; posY += fontSize + spacingY)
763
- for (let posX = x; posX < canvasWidth; posX += ctx.measureText(content).width + spacingX)
764
- ctx.save(), ctx.translate(posX, posY), ctx.rotate(Math.PI / 180 * rotate), ctx.fillText(content, 0, 0), ctx.restore();
742
+ function Dt(e, t) {
743
+ const { x: a, y: r, repeat: n, spacingX: i, spacingY: l, rotate: d, opacity: u, content: p, fontSize: c, color: h, bold: v, italic: W, direction: N } = t;
744
+ e.save(), e.globalAlpha = u, e.direction = N;
745
+ let w = "";
746
+ if (W && (w += "italic "), v && (w += "bold "), w += `${c}px Arial`, e.font = w, e.fillStyle = h, p)
747
+ if (n) {
748
+ const _ = e.canvas.width, I = e.canvas.height;
749
+ for (let y = r; y < I; y += c + l)
750
+ for (let C = a; C < _; C += e.measureText(p).width + i)
751
+ e.save(), e.translate(C, y), e.rotate(Math.PI / 180 * d), e.fillText(p, 0, 0), e.restore();
765
752
  } else
766
- ctx.save(), ctx.translate(x, y), ctx.rotate(Math.PI / 180 * rotate), ctx.fillText(content, 0, 0), ctx.restore();
767
- ctx.restore();
753
+ e.save(), e.translate(a, r), e.rotate(Math.PI / 180 * d), e.fillText(p, 0, 0), e.restore();
754
+ e.restore();
768
755
  }
769
- __name(renderTextWatermark, "renderTextWatermark");
770
- function renderImageWatermark(ctx, config, image) {
771
- const { x, y, repeat, spacingX, spacingY, rotate, opacity, width, height, maintainAspectRatio, originRatio } = config;
772
- if (!(image != null && image.complete))
756
+ function Ht(e, t, a) {
757
+ const { x: r, y: n, repeat: i, spacingX: l, spacingY: d, rotate: u, opacity: p, width: c, height: h, maintainAspectRatio: v, originRatio: W } = t;
758
+ if (!(a != null && a.complete))
773
759
  return;
774
- ctx.save(), ctx.globalAlpha = opacity;
775
- const actualWidth = width, actualHeight = maintainAspectRatio ? width / originRatio : height;
776
- if (repeat) {
777
- const canvasWidth = ctx.canvas.width, canvasHeight = ctx.canvas.height;
778
- for (let posY = y; posY < canvasHeight; posY += actualHeight + spacingY)
779
- for (let posX = x; posX < canvasWidth; posX += actualWidth + spacingX)
780
- ctx.save(), ctx.translate(posX, posY), ctx.rotate(Math.PI / 180 * rotate), ctx.drawImage(image, 0, 0, actualWidth, actualHeight), ctx.restore();
760
+ e.save(), e.globalAlpha = p;
761
+ const N = c, w = v ? c / W : h;
762
+ if (i) {
763
+ const _ = e.canvas.width, I = e.canvas.height;
764
+ for (let y = n; y < I; y += w + d)
765
+ for (let C = r; C < _; C += N + l)
766
+ e.save(), e.translate(C, y), e.rotate(Math.PI / 180 * u), e.drawImage(a, 0, 0, N, w), e.restore();
781
767
  } else
782
- ctx.save(), ctx.translate(x, y), ctx.rotate(Math.PI / 180 * rotate), ctx.drawImage(image, 0, 0, actualWidth, actualHeight), ctx.restore();
783
- ctx.restore();
768
+ e.save(), e.translate(r, n), e.rotate(Math.PI / 180 * u), e.drawImage(a, 0, 0, N, w), e.restore();
769
+ e.restore();
784
770
  }
785
- __name(renderImageWatermark, "renderImageWatermark");
786
- const _WatermarkLayer = class _WatermarkLayer extends Layer {
771
+ class Yt extends Ne {
787
772
  constructor() {
788
773
  super(...arguments);
789
- __publicField(this, "_config");
790
- __publicField(this, "_image");
791
- __publicField(this, "_user");
774
+ k(this, "_config");
775
+ k(this, "_image");
776
+ k(this, "_user");
792
777
  }
793
- render(ctx, isMaxLayer = !1) {
794
- var _a5;
795
- super.render(ctx, isMaxLayer);
796
- const mainCtx = ctx || ((_a5 = this.scene.getEngine()) == null ? void 0 : _a5.getCanvas().getContext());
797
- return mainCtx && mainCtx.getId() && this._renderWatermark(mainCtx), this;
778
+ render(a, r = !1) {
779
+ var i;
780
+ super.render(a, r);
781
+ const n = a || ((i = this.scene.getEngine()) == null ? void 0 : i.getCanvas().getContext());
782
+ return n && n.getId() && this._renderWatermark(n), this;
798
783
  }
799
- updateConfig(config, user) {
800
- var _a5;
801
- this._config = config, ((_a5 = this._config) == null ? void 0 : _a5.type) === IWatermarkTypeEnum.Image && this._config.config.image && (this._image = new Image(), this._image.src = this._config.config.image.url), user && (this._user = user);
784
+ updateConfig(a, r) {
785
+ var n;
786
+ this._config = a, ((n = this._config) == null ? void 0 : n.type) === m.Image && this._config.config.image && (this._image = new Image(), this._image.src = this._config.config.image.url), r && (this._user = r);
802
787
  }
803
- _renderWatermark(ctx) {
804
- this._config && renderWatermark(ctx, this._config, this._image, this._user);
788
+ _renderWatermark(a) {
789
+ this._config && Ut(a, this._config, this._image, this._user);
805
790
  }
806
- };
807
- __name(_WatermarkLayer, "WatermarkLayer");
808
- let WatermarkLayer = _WatermarkLayer;
809
- var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
810
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
811
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
812
- return kind && result && __defProp$1(target, key, result), result;
813
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a3;
814
- let WatermarkRenderController = (_a3 = class extends RxDisposable {
815
- constructor(_context, _watermarkService, _localStorageService, _userManagerService) {
791
+ }
792
+ var Xt = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, Kt = (e, t, a, r) => {
793
+ for (var n = r > 1 ? void 0 : r ? Bt(t, a) : t, i = e.length - 1, l; i >= 0; i--)
794
+ (l = e[i]) && (n = (r ? l(t, a, n) : l(n)) || n);
795
+ return r && n && Xt(t, a, n), n;
796
+ }, D = (e, t) => (a, r) => t(a, r, e);
797
+ let B = class extends _e {
798
+ constructor(t, a, r, n) {
816
799
  super();
817
- __publicField(this, "_watermarkLayer");
818
- this._context = _context, this._watermarkService = _watermarkService, this._localStorageService = _localStorageService, this._userManagerService = _userManagerService, this._watermarkLayer = new WatermarkLayer(_context.scene, [], UNIVER_WATERMARK_LAYER_INDEX), this._initAddRender(), this._initWatermarkUpdate(), this._initWatermarkConfig();
800
+ k(this, "_watermarkLayer");
801
+ this._context = t, this._watermarkService = a, this._localStorageService = r, this._userManagerService = n, this._watermarkLayer = new Yt(t.scene, [], Ye), this._initAddRender(), this._initWatermarkUpdate(), this._initWatermarkConfig();
819
802
  }
820
803
  _initAddRender() {
821
- const { scene } = this._context;
822
- scene.addLayer(this._watermarkLayer);
804
+ const { scene: t } = this._context;
805
+ t.addLayer(this._watermarkLayer);
823
806
  }
824
807
  async _initWatermarkConfig() {
825
- var _a5;
826
- const config = await this._localStorageService.getItem(UNIVER_WATERMARK_STORAGE_KEY);
827
- config && (this._watermarkService.updateWatermarkConfig(config), (_a5 = this._context.mainComponent) == null || _a5.makeDirty());
808
+ var a;
809
+ const t = await this._localStorageService.getItem(S);
810
+ t && (this._watermarkService.updateWatermarkConfig(t), (a = this._context.mainComponent) == null || a.makeDirty());
828
811
  }
829
812
  _initWatermarkUpdate() {
830
813
  this.disposeWithMe(
831
- this._watermarkService.updateConfig$.subscribe((_config) => {
832
- var _a5, _b;
833
- if (!_config) {
834
- this._watermarkLayer.updateConfig(), (_a5 = this._context.mainComponent) == null || _a5.makeDirty();
814
+ this._watermarkService.updateConfig$.subscribe((t) => {
815
+ var a, r;
816
+ if (!t) {
817
+ this._watermarkLayer.updateConfig(), (a = this._context.mainComponent) == null || a.makeDirty();
835
818
  return;
836
819
  }
837
- _config.type === IWatermarkTypeEnum.UserInfo ? this._watermarkLayer.updateConfig(_config, this._userManagerService.getCurrentUser()) : this._watermarkLayer.updateConfig(_config), (_b = this._context.mainComponent) == null || _b.makeDirty();
820
+ t.type === m.UserInfo ? this._watermarkLayer.updateConfig(t, this._userManagerService.getCurrentUser()) : this._watermarkLayer.updateConfig(t), (r = this._context.mainComponent) == null || r.makeDirty();
838
821
  })
839
822
  );
840
823
  }
841
- }, __name(_a3, "WatermarkRenderController"), _a3);
842
- WatermarkRenderController = __decorateClass$1([
843
- __decorateParam$1(1, Inject(WatermarkService)),
844
- __decorateParam$1(2, Inject(ILocalStorageService)),
845
- __decorateParam$1(3, Inject(UserManagerService))
846
- ], WatermarkRenderController);
847
- var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
848
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
849
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
850
- return kind && result && __defProp2(target, key, result), result;
851
- }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
852
- const PLUGIN_NAME = "UNIVER_WATERMARK_PLUGIN";
853
- var _a4;
854
- let UniverWatermarkPlugin = (_a4 = class extends Plugin {
855
- constructor(_config = {}, _injector, _configService, _commandService, _renderManagerSrv, _localStorageService) {
856
- super(), this._config = _config, this._injector = _injector, this._configService = _configService, this._commandService = _commandService, this._renderManagerSrv = _renderManagerSrv, this._localStorageService = _localStorageService;
857
- const { menu } = this._config;
858
- menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._initWatermarkStorage(), this._initDependencies(), this._initRegisterCommand();
824
+ };
825
+ B = Kt([
826
+ D(1, j(T)),
827
+ D(2, j(F)),
828
+ D(3, j(xe))
829
+ ], B);
830
+ var Vt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, Gt = (e, t, a, r) => {
831
+ for (var n = r > 1 ? void 0 : r ? zt(t, a) : t, i = e.length - 1, l; i >= 0; i--)
832
+ (l = e[i]) && (n = (r ? l(t, a, n) : l(n)) || n);
833
+ return r && n && Vt(t, a, n), n;
834
+ }, b = (e, t) => (a, r) => t(a, r, e);
835
+ const Zt = "UNIVER_WATERMARK_PLUGIN";
836
+ var H;
837
+ let Q = (H = class extends Ie {
838
+ constructor(e = {}, t, a, r, n, i) {
839
+ super(), this._config = e, this._injector = t, this._configService = a, this._commandService = r, this._renderManagerSrv = n, this._localStorageService = i;
840
+ const { menu: l } = this._config;
841
+ l && this._configService.setConfig("menu", l, { merge: !0 }), this._initWatermarkStorage(), this._initDependencies(), this._initRegisterCommand();
859
842
  }
860
843
  async _initWatermarkStorage() {
861
- const { menu, ...rest } = this._config;
862
- if (rest.userWatermarkSettings)
863
- this._localStorageService.setItem(UNIVER_WATERMARK_STORAGE_KEY, { type: IWatermarkTypeEnum.UserInfo, config: { userInfo: { ...WatermarkUserInfoBaseConfig, ...rest.userWatermarkSettings } } });
864
- else if (rest.textWatermarkSettings)
865
- this._localStorageService.setItem(UNIVER_WATERMARK_STORAGE_KEY, { type: IWatermarkTypeEnum.Text, config: { text: { ...WatermarkTextBaseConfig, ...rest.textWatermarkSettings } } });
866
- else if (rest.imageWatermarkSettings)
867
- this._localStorageService.setItem(UNIVER_WATERMARK_STORAGE_KEY, { type: IWatermarkTypeEnum.Image, config: { image: { ...WatermarkImageBaseConfig, ...rest.imageWatermarkSettings } } });
844
+ const { menu: e, ...t } = this._config;
845
+ if (t.userWatermarkSettings)
846
+ this._localStorageService.setItem(S, { type: m.UserInfo, config: { userInfo: { ...Be, ...t.userWatermarkSettings } } });
847
+ else if (t.textWatermarkSettings)
848
+ this._localStorageService.setItem(S, { type: m.Text, config: { text: { ...O, ...t.textWatermarkSettings } } });
849
+ else if (t.imageWatermarkSettings)
850
+ this._localStorageService.setItem(S, { type: m.Image, config: { image: { ...se, ...t.imageWatermarkSettings } } });
868
851
  else {
869
- const config = await this._localStorageService.getItem(UNIVER_WATERMARK_STORAGE_KEY);
870
- (config == null ? void 0 : config.type) === IWatermarkTypeEnum.UserInfo && this._localStorageService.removeItem(UNIVER_WATERMARK_STORAGE_KEY);
852
+ const a = await this._localStorageService.getItem(S);
853
+ (a == null ? void 0 : a.type) === m.UserInfo && this._localStorageService.removeItem(S);
871
854
  }
872
855
  }
873
856
  _initDependencies() {
874
- [[WatermarkService], [UniverWatermarkMenuController]].forEach((d) => {
875
- this._injector.add(d);
857
+ [[T], [E]].forEach((e) => {
858
+ this._injector.add(e);
876
859
  });
877
860
  }
878
861
  _initRegisterCommand() {
879
862
  [
880
- OpenWatermarkPanelOperation
881
- ].forEach((m2) => this._commandService.registerCommand(m2));
863
+ K
864
+ ].forEach((e) => this._commandService.registerCommand(e));
882
865
  }
883
866
  onRendered() {
884
- const injector = this._injector;
885
- injector.get(WatermarkService);
886
- const { userWatermarkSettings, textWatermarkSettings, imageWatermarkSettings, showMenu = !0 } = this._config;
887
- !(userWatermarkSettings || textWatermarkSettings || imageWatermarkSettings) && showMenu && injector.get(UniverWatermarkMenuController), this._initRenderDependencies();
867
+ const e = this._injector;
868
+ e.get(T);
869
+ const { userWatermarkSettings: t, textWatermarkSettings: a, imageWatermarkSettings: r, showMenu: n = !0 } = this._config;
870
+ !(t || a || r) && n && e.get(E), this._initRenderDependencies();
888
871
  }
889
872
  _initRenderDependencies() {
890
873
  [
891
- [WatermarkRenderController]
892
- ].forEach((d) => {
893
- this._renderManagerSrv.registerRenderModule(UniverInstanceType.UNIVER_SHEET, d), this._renderManagerSrv.registerRenderModule(UniverInstanceType.UNIVER_DOC, d);
874
+ [B]
875
+ ].forEach((e) => {
876
+ this._renderManagerSrv.registerRenderModule(V.UNIVER_SHEET, e), this._renderManagerSrv.registerRenderModule(V.UNIVER_DOC, e);
894
877
  });
895
878
  }
896
- }, __name(_a4, "UniverWatermarkPlugin"), __publicField(_a4, "pluginName", PLUGIN_NAME), _a4);
897
- UniverWatermarkPlugin = __decorateClass([
898
- __decorateParam(1, Inject(Injector)),
899
- __decorateParam(2, IConfigService),
900
- __decorateParam(3, Inject(ICommandService)),
901
- __decorateParam(4, IRenderManagerService),
902
- __decorateParam(5, Inject(ILocalStorageService))
903
- ], UniverWatermarkPlugin);
879
+ }, k(H, "pluginName", Zt), H);
880
+ Q = Gt([
881
+ b(1, j(ye)),
882
+ b(2, je),
883
+ b(3, j(Ce)),
884
+ b(4, Te),
885
+ b(5, j(F))
886
+ ], Q);
904
887
  export {
905
- IWatermarkTypeEnum,
906
- UniverWatermarkPlugin,
907
- WatermarkImageBaseConfig,
908
- WatermarkService,
909
- WatermarkTextBaseConfig,
910
- WatermarkUserInfoBaseConfig
888
+ m as IWatermarkTypeEnum,
889
+ Q as UniverWatermarkPlugin,
890
+ se as WatermarkImageBaseConfig,
891
+ T as WatermarkService,
892
+ O as WatermarkTextBaseConfig,
893
+ Be as WatermarkUserInfoBaseConfig
911
894
  };