@cool-office/sheets-conditional-formatting 0.0.0-stage → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +49 -2
  3. package/lib/cjs/facade.js +2237 -0
  4. package/lib/cjs/index.js +3211 -0
  5. package/lib/cjs/locale/ar-SA.js +10 -0
  6. package/lib/cjs/locale/ca-ES.js +10 -0
  7. package/lib/cjs/locale/de-DE.js +10 -0
  8. package/lib/cjs/locale/en-US.js +25 -0
  9. package/lib/cjs/locale/es-ES.js +10 -0
  10. package/lib/cjs/locale/fa-IR.js +10 -0
  11. package/lib/cjs/locale/fr-FR.js +10 -0
  12. package/lib/cjs/locale/id-ID.js +10 -0
  13. package/lib/cjs/locale/it-IT.js +10 -0
  14. package/lib/cjs/locale/ja-JP.js +10 -0
  15. package/lib/cjs/locale/ko-KR.js +10 -0
  16. package/lib/cjs/locale/pl-PL.js +10 -0
  17. package/lib/cjs/locale/pt-BR.js +10 -0
  18. package/lib/cjs/locale/ru-RU.js +10 -0
  19. package/lib/cjs/locale/sk-SK.js +10 -0
  20. package/lib/cjs/locale/vi-VN.js +10 -0
  21. package/lib/cjs/locale/zh-CN.js +10 -0
  22. package/lib/cjs/locale/zh-HK.js +10 -0
  23. package/lib/cjs/locale/zh-TW.js +10 -0
  24. package/lib/es/facade.js +2236 -0
  25. package/lib/es/index.js +3116 -0
  26. package/lib/es/locale/ar-SA.js +10 -0
  27. package/lib/es/locale/ca-ES.js +10 -0
  28. package/lib/es/locale/de-DE.js +10 -0
  29. package/lib/es/locale/en-US.js +25 -0
  30. package/lib/es/locale/es-ES.js +10 -0
  31. package/lib/es/locale/fa-IR.js +10 -0
  32. package/lib/es/locale/fr-FR.js +10 -0
  33. package/lib/es/locale/id-ID.js +10 -0
  34. package/lib/es/locale/it-IT.js +10 -0
  35. package/lib/es/locale/ja-JP.js +10 -0
  36. package/lib/es/locale/ko-KR.js +10 -0
  37. package/lib/es/locale/pl-PL.js +10 -0
  38. package/lib/es/locale/pt-BR.js +10 -0
  39. package/lib/es/locale/ru-RU.js +10 -0
  40. package/lib/es/locale/sk-SK.js +10 -0
  41. package/lib/es/locale/vi-VN.js +10 -0
  42. package/lib/es/locale/zh-CN.js +10 -0
  43. package/lib/es/locale/zh-HK.js +10 -0
  44. package/lib/es/locale/zh-TW.js +10 -0
  45. package/lib/facade.js +2236 -0
  46. package/lib/index.js +3116 -0
  47. package/lib/locale/ar-SA.js +10 -0
  48. package/lib/locale/ca-ES.js +10 -0
  49. package/lib/locale/de-DE.js +10 -0
  50. package/lib/locale/en-US.js +25 -0
  51. package/lib/locale/es-ES.js +10 -0
  52. package/lib/locale/fa-IR.js +10 -0
  53. package/lib/locale/fr-FR.js +10 -0
  54. package/lib/locale/id-ID.js +10 -0
  55. package/lib/locale/it-IT.js +10 -0
  56. package/lib/locale/ja-JP.js +10 -0
  57. package/lib/locale/ko-KR.js +10 -0
  58. package/lib/locale/pl-PL.js +10 -0
  59. package/lib/locale/pt-BR.js +10 -0
  60. package/lib/locale/ru-RU.js +10 -0
  61. package/lib/locale/sk-SK.js +10 -0
  62. package/lib/locale/vi-VN.js +10 -0
  63. package/lib/locale/zh-CN.js +10 -0
  64. package/lib/locale/zh-HK.js +10 -0
  65. package/lib/locale/zh-TW.js +10 -0
  66. package/lib/types/assets/icon-map.d.ts +79 -0
  67. package/lib/types/base/const.d.ts +80 -0
  68. package/lib/types/commands/commands/add-cf.command.d.ts +24 -0
  69. package/lib/types/commands/commands/clear-range-cf.command.d.ts +24 -0
  70. package/lib/types/commands/commands/clear-worksheet-cf.command.d.ts +21 -0
  71. package/lib/types/commands/commands/delete-cf.command.d.ts +22 -0
  72. package/lib/types/commands/commands/move-cf.command.d.ts +24 -0
  73. package/lib/types/commands/commands/set-cf.command.d.ts +24 -0
  74. package/lib/types/commands/mutations/add-conditional-rule.mutation.d.ts +28 -0
  75. package/lib/types/commands/mutations/delete-conditional-rule.mutation.d.ts +23 -0
  76. package/lib/types/commands/mutations/formula-mark-dirty.mutation.d.ts +24 -0
  77. package/lib/types/commands/mutations/move-conditional-rule.mutation.d.ts +28 -0
  78. package/lib/types/commands/mutations/set-conditional-rule.mutation.d.ts +28 -0
  79. package/lib/types/config/config.d.ts +20 -0
  80. package/lib/types/facade/f-conditional-formatting-builder.d.ts +1709 -0
  81. package/lib/types/facade/f-enum.d.ts +48 -0
  82. package/lib/types/facade/f-range.d.ts +99 -0
  83. package/lib/types/facade/f-worksheet.d.ts +180 -0
  84. package/lib/types/facade/index.d.ts +21 -0
  85. package/lib/types/index.d.ts +55 -0
  86. package/lib/types/locale/ar-SA.d.ts +18 -0
  87. package/lib/types/locale/ca-ES.d.ts +18 -0
  88. package/lib/types/locale/de-DE.d.ts +18 -0
  89. package/lib/types/locale/en-US.d.ts +26 -0
  90. package/lib/types/locale/es-ES.d.ts +18 -0
  91. package/lib/types/locale/fa-IR.d.ts +18 -0
  92. package/lib/types/locale/fr-FR.d.ts +18 -0
  93. package/lib/types/locale/id-ID.d.ts +18 -0
  94. package/lib/types/locale/it-IT.d.ts +18 -0
  95. package/lib/types/locale/ja-JP.d.ts +18 -0
  96. package/lib/types/locale/ko-KR.d.ts +18 -0
  97. package/lib/types/locale/pl-PL.d.ts +18 -0
  98. package/lib/types/locale/pt-BR.d.ts +18 -0
  99. package/lib/types/locale/ru-RU.d.ts +18 -0
  100. package/lib/types/locale/sk-SK.d.ts +18 -0
  101. package/lib/types/locale/types.d.ts +18 -0
  102. package/lib/types/locale/vi-VN.d.ts +18 -0
  103. package/lib/types/locale/zh-CN.d.ts +18 -0
  104. package/lib/types/locale/zh-HK.d.ts +18 -0
  105. package/lib/types/locale/zh-TW.d.ts +18 -0
  106. package/lib/types/models/calculate-unit-v2/base-calculate-unit.d.ts +68 -0
  107. package/lib/types/models/calculate-unit-v2/color-scale-calculate-unit.d.ts +27 -0
  108. package/lib/types/models/calculate-unit-v2/data-bar-calculate-unit.d.ts +33 -0
  109. package/lib/types/models/calculate-unit-v2/highlight-cell-calculate-unit.d.ts +28 -0
  110. package/lib/types/models/calculate-unit-v2/icon-set-calculate-unit.d.ts +34 -0
  111. package/lib/types/models/calculate-unit-v2/utils.d.ts +46 -0
  112. package/lib/types/models/conditional-formatting-range-index-model.d.ts +32 -0
  113. package/lib/types/models/conditional-formatting-rule-model.d.ts +45 -0
  114. package/lib/types/models/conditional-formatting-view-model.d.ts +78 -0
  115. package/lib/types/models/icon-map.d.ts +48 -0
  116. package/lib/types/models/type.d.ts +106 -0
  117. package/lib/types/plugin.d.ts +29 -0
  118. package/lib/types/render/data-bar.render.d.ts +35 -0
  119. package/lib/types/render/icon.render.d.ts +37 -0
  120. package/lib/types/render/type.d.ts +38 -0
  121. package/lib/types/services/conditional-formatting-formula.service.d.ts +73 -0
  122. package/lib/types/services/conditional-formatting-range-transform.service.d.ts +27 -0
  123. package/lib/types/services/conditional-formatting-style-composer.service.d.ts +35 -0
  124. package/lib/types/services/conditional-formatting.service.d.ts +41 -0
  125. package/lib/types/utils/anchor.d.ts +34 -0
  126. package/lib/types/utils/create-cf-id.d.ts +16 -0
  127. package/lib/types/utils/range.d.ts +18 -0
  128. package/lib/types/utils/remove-undefined-attr.d.ts +16 -0
  129. package/lib/types/utils/type.d.ts +18 -0
  130. package/lib/umd/facade.js +1 -0
  131. package/lib/umd/index.js +1 -0
  132. package/lib/umd/locale/ar-SA.js +1 -0
  133. package/lib/umd/locale/ca-ES.js +1 -0
  134. package/lib/umd/locale/de-DE.js +1 -0
  135. package/lib/umd/locale/en-US.js +1 -0
  136. package/lib/umd/locale/es-ES.js +1 -0
  137. package/lib/umd/locale/fa-IR.js +1 -0
  138. package/lib/umd/locale/fr-FR.js +1 -0
  139. package/lib/umd/locale/id-ID.js +1 -0
  140. package/lib/umd/locale/it-IT.js +1 -0
  141. package/lib/umd/locale/ja-JP.js +1 -0
  142. package/lib/umd/locale/ko-KR.js +1 -0
  143. package/lib/umd/locale/pl-PL.js +1 -0
  144. package/lib/umd/locale/pt-BR.js +1 -0
  145. package/lib/umd/locale/ru-RU.js +1 -0
  146. package/lib/umd/locale/sk-SK.js +1 -0
  147. package/lib/umd/locale/vi-VN.js +1 -0
  148. package/lib/umd/locale/zh-CN.js +1 -0
  149. package/lib/umd/locale/zh-HK.js +1 -0
  150. package/lib/umd/locale/zh-TW.js +1 -0
  151. package/package.json +90 -3
@@ -0,0 +1,3211 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let _cool_office_core = require("@cool-office/core");
3
+ let _cool_office_sheets = require("@cool-office/sheets");
4
+ let rxjs = require("rxjs");
5
+ let _cool_office_engine_formula = require("@cool-office/engine-formula");
6
+ let rxjs_operators = require("rxjs/operators");
7
+ let _cool_office_engine_render = require("@cool-office/engine-render");
8
+
9
+ //#region src/base/const.ts
10
+ const SHEET_CONDITIONAL_FORMATTING_PLUGIN = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
11
+ let CFTextOperator = /* @__PURE__ */ function(CFTextOperator) {
12
+ CFTextOperator["beginsWith"] = "beginsWith";
13
+ CFTextOperator["endsWith"] = "endsWith";
14
+ CFTextOperator["containsText"] = "containsText";
15
+ CFTextOperator["notContainsText"] = "notContainsText";
16
+ CFTextOperator["equal"] = "equal";
17
+ CFTextOperator["notEqual"] = "notEqual";
18
+ CFTextOperator["containsBlanks"] = "containsBlanks";
19
+ CFTextOperator["notContainsBlanks"] = "notContainsBlanks";
20
+ CFTextOperator["containsErrors"] = "containsErrors";
21
+ CFTextOperator["notContainsErrors"] = "notContainsErrors";
22
+ return CFTextOperator;
23
+ }({});
24
+ let CFTimePeriodOperator = /* @__PURE__ */ function(CFTimePeriodOperator) {
25
+ CFTimePeriodOperator["today"] = "today";
26
+ CFTimePeriodOperator["yesterday"] = "yesterday";
27
+ CFTimePeriodOperator["tomorrow"] = "tomorrow";
28
+ CFTimePeriodOperator["last7Days"] = "last7Days";
29
+ CFTimePeriodOperator["thisMonth"] = "thisMonth";
30
+ CFTimePeriodOperator["lastMonth"] = "lastMonth";
31
+ CFTimePeriodOperator["nextMonth"] = "nextMonth";
32
+ CFTimePeriodOperator["thisWeek"] = "thisWeek";
33
+ CFTimePeriodOperator["lastWeek"] = "lastWeek";
34
+ CFTimePeriodOperator["nextWeek"] = "nextWeek";
35
+ return CFTimePeriodOperator;
36
+ }({});
37
+ let CFNumberOperator = /* @__PURE__ */ function(CFNumberOperator) {
38
+ CFNumberOperator["greaterThan"] = "greaterThan";
39
+ CFNumberOperator["greaterThanOrEqual"] = "greaterThanOrEqual";
40
+ CFNumberOperator["lessThan"] = "lessThan";
41
+ CFNumberOperator["lessThanOrEqual"] = "lessThanOrEqual";
42
+ CFNumberOperator["notBetween"] = "notBetween";
43
+ CFNumberOperator["between"] = "between";
44
+ CFNumberOperator["equal"] = "equal";
45
+ CFNumberOperator["notEqual"] = "notEqual";
46
+ return CFNumberOperator;
47
+ }({});
48
+ let CFRuleType = /* @__PURE__ */ function(CFRuleType) {
49
+ CFRuleType["highlightCell"] = "highlightCell";
50
+ CFRuleType["dataBar"] = "dataBar";
51
+ CFRuleType["colorScale"] = "colorScale";
52
+ CFRuleType["iconSet"] = "iconSet";
53
+ return CFRuleType;
54
+ }({});
55
+ let CFSubRuleType = /* @__PURE__ */ function(CFSubRuleType) {
56
+ CFSubRuleType["uniqueValues"] = "uniqueValues";
57
+ CFSubRuleType["duplicateValues"] = "duplicateValues";
58
+ CFSubRuleType["rank"] = "rank";
59
+ CFSubRuleType["text"] = "text";
60
+ CFSubRuleType["timePeriod"] = "timePeriod";
61
+ CFSubRuleType["number"] = "number";
62
+ CFSubRuleType["average"] = "average";
63
+ CFSubRuleType["formula"] = "formula";
64
+ return CFSubRuleType;
65
+ }({});
66
+ let CFValueType = /* @__PURE__ */ function(CFValueType) {
67
+ CFValueType["num"] = "num";
68
+ CFValueType["min"] = "min";
69
+ CFValueType["max"] = "max";
70
+ CFValueType["percent"] = "percent";
71
+ CFValueType["percentile"] = "percentile";
72
+ CFValueType["formula"] = "formula";
73
+ return CFValueType;
74
+ }({});
75
+ const DEFAULT_BG_COLOR = "#fff";
76
+ const DEFAULT_FONT_COLOR = "#000000";
77
+ const createDefaultRule = () => ({
78
+ cfId: void 0,
79
+ ranges: [],
80
+ stopIfTrue: false,
81
+ rule: {
82
+ type: "highlightCell",
83
+ subType: "text",
84
+ operator: "containsText"
85
+ }
86
+ });
87
+ const createDefaultValue = (subType, operator) => {
88
+ switch (subType) {
89
+ case "text":
90
+ if ([
91
+ "beginsWith",
92
+ "containsText",
93
+ "endsWith",
94
+ "equal",
95
+ "notContainsText",
96
+ "notEqual"
97
+ ].includes(operator)) return "";
98
+ break;
99
+ case "number":
100
+ if (["between", "notBetween"].includes(operator)) return [10, 100];
101
+ return 10;
102
+ }
103
+ return "";
104
+ };
105
+ const createDefaultValueByValueType = (type, defaultValue) => {
106
+ switch (type) {
107
+ case "formula": return "=";
108
+ case "max":
109
+ case "min": return "";
110
+ case "percent":
111
+ case "percentile":
112
+ case "num": return defaultValue !== void 0 ? defaultValue : 10;
113
+ }
114
+ return "";
115
+ };
116
+
117
+ //#endregion
118
+ //#region src/utils/anchor.ts
119
+ const findIndexByAnchor = (anchor, ruleList, get) => {
120
+ if (!ruleList) return null;
121
+ const anchorIndex = ruleList.findIndex((rule) => get(rule) === anchor.id);
122
+ if (anchorIndex < 0) return null;
123
+ switch (anchor.type) {
124
+ case "after": return anchorIndex + 1;
125
+ case "before": return anchorIndex - 1;
126
+ case "self": return anchorIndex;
127
+ }
128
+ };
129
+ /**
130
+ * This function has side effects that modify the ruleList
131
+ * @param {IAnchor} start
132
+ * @param {IAnchor} end
133
+ * @param {ReturnType<ConditionalFormattingRuleModel['getSubunitRules']>} ruleList
134
+ * @return {*}
135
+ */
136
+ const moveByAnchor = (start, end, ruleList, get) => {
137
+ if (!ruleList) return null;
138
+ const startIndex = findIndexByAnchor(start, ruleList, get);
139
+ let endIndex = findIndexByAnchor(end, ruleList, get);
140
+ if (startIndex === null || endIndex === null || startIndex === endIndex) return;
141
+ const rule = ruleList.splice(startIndex, 1)[0];
142
+ if (startIndex < endIndex) endIndex = findIndexByAnchor(end, ruleList, get);
143
+ switch (end.type) {
144
+ case "before":
145
+ ruleList.splice(endIndex + 1, 0, rule);
146
+ break;
147
+ case "self":
148
+ case "after": ruleList.splice(endIndex, 0, rule);
149
+ }
150
+ };
151
+ /**
152
+ * Only [after,after] and [after,before] can support symmetric operations
153
+ */
154
+ const transformSupportSymmetryAnchor = (start, end, ruleList, get) => {
155
+ if (start.type === "after" && ["after", "before"].includes(end.type)) return [start, end];
156
+ const _start = { ...start };
157
+ const _end = { ...end };
158
+ if (_start.type !== "after") {
159
+ const index = findIndexByAnchor(_start, ruleList, get);
160
+ if (index === null) return null;
161
+ if (index - 1 < 0) {
162
+ const nextItem = ruleList[index + 1];
163
+ if (!nextItem) return null;
164
+ else {
165
+ _start.id = get(nextItem);
166
+ _start.type = "before";
167
+ }
168
+ } else {
169
+ _start.id = get(ruleList[index - 1]);
170
+ _start.type = "after";
171
+ }
172
+ }
173
+ if (!["after", "before"].includes(_end.type)) {
174
+ const index = findIndexByAnchor(_end, ruleList, get);
175
+ if (index === null) return null;
176
+ if (index === 0) _end.type = "before";
177
+ else if (index - 1 >= 0) {
178
+ _end.id = get(ruleList[index - 1]);
179
+ _end.type = "after";
180
+ } else if (index + 1 <= ruleList.length - 1) {
181
+ _end.id = get(ruleList[index + 1]);
182
+ _end.type = "before";
183
+ } else return null;
184
+ }
185
+ if (_start.id === _end.id && _start.type === _end.type) return null;
186
+ return [_start, _end];
187
+ };
188
+ const anchorUndoFactory = (start, end) => {
189
+ if (["after", "before"].includes(end.type)) {
190
+ if (start.type === "after") return [end, start];
191
+ else if (start.type === "before") return [end, {
192
+ ...start,
193
+ type: "self"
194
+ }];
195
+ }
196
+ return null;
197
+ };
198
+ const isAnchorEqual = (anchor1, anchor2) => {
199
+ return anchor1.id === anchor2.id && anchor1.type === anchor2.type;
200
+ };
201
+
202
+ //#endregion
203
+ //#region src/utils/create-cf-id.ts
204
+ /**
205
+ * Copyright 2023-present DreamNum Co., Ltd.
206
+ *
207
+ * Licensed under the Apache License, Version 2.0 (the "License");
208
+ * you may not use this file except in compliance with the License.
209
+ * You may obtain a copy of the License at
210
+ *
211
+ * http://www.apache.org/licenses/LICENSE-2.0
212
+ *
213
+ * Unless required by applicable law or agreed to in writing, software
214
+ * distributed under the License is distributed on an "AS IS" BASIS,
215
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
216
+ * See the License for the specific language governing permissions and
217
+ * limitations under the License.
218
+ */
219
+ const createCfId = () => `${(0, _cool_office_core.generateRandomId)(8)}`;
220
+
221
+ //#endregion
222
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
223
+ function _typeof(o) {
224
+ "@babel/helpers - typeof";
225
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
226
+ return typeof o;
227
+ } : function(o) {
228
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
229
+ }, _typeof(o);
230
+ }
231
+
232
+ //#endregion
233
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
234
+ function toPrimitive(t, r) {
235
+ if ("object" != _typeof(t) || !t) return t;
236
+ var e = t[Symbol.toPrimitive];
237
+ if (void 0 !== e) {
238
+ var i = e.call(t, r || "default");
239
+ if ("object" != _typeof(i)) return i;
240
+ throw new TypeError("@@toPrimitive must return a primitive value.");
241
+ }
242
+ return ("string" === r ? String : Number)(t);
243
+ }
244
+
245
+ //#endregion
246
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
247
+ function toPropertyKey(t) {
248
+ var i = toPrimitive(t, "string");
249
+ return "symbol" == _typeof(i) ? i : i + "";
250
+ }
251
+
252
+ //#endregion
253
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
254
+ function _defineProperty(e, r, t) {
255
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
256
+ value: t,
257
+ enumerable: !0,
258
+ configurable: !0,
259
+ writable: !0
260
+ }) : e[r] = t, e;
261
+ }
262
+
263
+ //#endregion
264
+ //#region src/models/conditional-formatting-rule-model.ts
265
+ var ConditionalFormattingRuleModel = class {
266
+ constructor() {
267
+ _defineProperty(this, "_model", /* @__PURE__ */ new Map());
268
+ _defineProperty(this, "_ruleChange$", new rxjs.Subject());
269
+ _defineProperty(this, "$ruleChange", this._ruleChange$.asObservable());
270
+ }
271
+ _ensureList(unitId, subUnitId) {
272
+ let list = this.getSubunitRules(unitId, subUnitId);
273
+ if (!list) {
274
+ list = [];
275
+ let unitMap = this._model.get(unitId);
276
+ if (!unitMap) {
277
+ unitMap = /* @__PURE__ */ new Map();
278
+ this._model.set(unitId, unitMap);
279
+ }
280
+ unitMap.set(subUnitId, list);
281
+ }
282
+ return list;
283
+ }
284
+ getRule(unitId, subUnitId, cfId) {
285
+ const list = this.getSubunitRules(unitId, subUnitId);
286
+ if (list) return list.find((item) => item.cfId === cfId);
287
+ return null;
288
+ }
289
+ getUnitRules(unitId) {
290
+ return this._model.get(unitId) || null;
291
+ }
292
+ getSubunitRules(unitId, subUnitId) {
293
+ var _this$_model$get;
294
+ return ((_this$_model$get = this._model.get(unitId)) === null || _this$_model$get === void 0 ? void 0 : _this$_model$get.get(subUnitId)) || null;
295
+ }
296
+ getAll() {
297
+ return this._model;
298
+ }
299
+ deleteRule(unitId, subUnitId, cfId) {
300
+ const list = this.getSubunitRules(unitId, subUnitId);
301
+ if (list) {
302
+ const index = list.findIndex((e) => e.cfId === cfId);
303
+ const rule = list[index];
304
+ if (rule) {
305
+ list.splice(index, 1);
306
+ this._ruleChange$.next({
307
+ rule,
308
+ subUnitId,
309
+ unitId,
310
+ type: "delete"
311
+ });
312
+ }
313
+ }
314
+ }
315
+ setRule(unitId, subUnitId, rule, oldCfId) {
316
+ const oldRule = this._ensureList(unitId, subUnitId).find((item) => item.cfId === oldCfId);
317
+ if (oldRule) {
318
+ const cloneRule = _cool_office_core.Tools.deepClone(oldRule);
319
+ Object.assign(oldRule, rule);
320
+ this._ruleChange$.next({
321
+ rule: oldRule,
322
+ subUnitId,
323
+ unitId,
324
+ type: "set",
325
+ oldRule: cloneRule
326
+ });
327
+ }
328
+ }
329
+ addRule(unitId, subUnitId, rule) {
330
+ const list = this._ensureList(unitId, subUnitId);
331
+ if (!list.find((item) => item.cfId === rule.cfId)) list.unshift(rule);
332
+ this._ruleChange$.next({
333
+ rule,
334
+ subUnitId,
335
+ unitId,
336
+ type: "add"
337
+ });
338
+ }
339
+ /**
340
+ * example [1,2,3,4,5,6],if you move behind 5 to 2, then cfId=5,targetId=2.
341
+ * if targetId does not exist, it defaults to top
342
+ */
343
+ moveRulePriority(unitId, subUnitId, start, end) {
344
+ const list = this._ensureList(unitId, subUnitId);
345
+ const curIndex = findIndexByAnchor(start, list, (rule) => rule.cfId);
346
+ const targetCfIndex = findIndexByAnchor(end, list, (rule) => rule.cfId);
347
+ if (targetCfIndex === null || curIndex === null || targetCfIndex === curIndex) return;
348
+ const rule = list[curIndex];
349
+ if (rule) {
350
+ moveByAnchor(start, end, list, (rule) => rule.cfId);
351
+ this._ruleChange$.next({
352
+ rule,
353
+ subUnitId,
354
+ unitId,
355
+ type: "sort"
356
+ });
357
+ }
358
+ }
359
+ createCfId(_unitId, _subUnitId) {
360
+ return createCfId();
361
+ }
362
+ deleteUnitId(unitId) {
363
+ this._model.delete(unitId);
364
+ }
365
+ };
366
+
367
+ //#endregion
368
+ //#region src/commands/mutations/move-conditional-rule.mutation.ts
369
+ const MoveConditionalRuleMutation = {
370
+ type: _cool_office_core.CommandType.MUTATION,
371
+ id: "sheet.mutation.move-conditional-rule",
372
+ handler(accessor, params) {
373
+ if (!params) return false;
374
+ const { unitId, subUnitId, start, end } = params;
375
+ accessor.get(ConditionalFormattingRuleModel).moveRulePriority(unitId, subUnitId, start, end);
376
+ return true;
377
+ }
378
+ };
379
+ const MoveConditionalRuleMutationUndoFactory = (param) => {
380
+ const { unitId, subUnitId } = param;
381
+ const undo = anchorUndoFactory(param.start, param.end);
382
+ if (!undo) return [];
383
+ const [start, end] = undo;
384
+ return [{
385
+ id: MoveConditionalRuleMutation.id,
386
+ params: {
387
+ unitId,
388
+ subUnitId,
389
+ start,
390
+ end
391
+ }
392
+ }];
393
+ };
394
+
395
+ //#endregion
396
+ //#region src/commands/mutations/delete-conditional-rule.mutation.ts
397
+ const DeleteConditionalRuleMutationUndoFactory = (accessor, param) => {
398
+ const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
399
+ const { unitId, subUnitId, cfId } = param;
400
+ const ruleList = [...conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId) || []];
401
+ const index = ruleList.findIndex((item) => item.cfId === cfId);
402
+ const beforeRule = ruleList[index - 1];
403
+ if (index > -1) {
404
+ const rule = ruleList[index];
405
+ const result = [{
406
+ id: AddConditionalRuleMutation.id,
407
+ params: {
408
+ unitId,
409
+ subUnitId,
410
+ rule: _cool_office_core.Tools.deepClone(rule)
411
+ }
412
+ }];
413
+ ruleList.splice(index, 1);
414
+ if (index !== 0) {
415
+ const firstRule = ruleList[0];
416
+ if (firstRule) {
417
+ const transformResult = transformSupportSymmetryAnchor({
418
+ id: firstRule.cfId,
419
+ type: "before"
420
+ }, {
421
+ id: beforeRule.cfId,
422
+ type: "after"
423
+ }, ruleList, (rule) => rule.cfId);
424
+ if (!transformResult) return result;
425
+ const [start, end] = transformResult;
426
+ const params = {
427
+ unitId,
428
+ subUnitId,
429
+ start,
430
+ end
431
+ };
432
+ result.push({
433
+ id: MoveConditionalRuleMutation.id,
434
+ params
435
+ });
436
+ }
437
+ }
438
+ return result;
439
+ }
440
+ return [];
441
+ };
442
+ const DeleteConditionalRuleMutation = {
443
+ type: _cool_office_core.CommandType.MUTATION,
444
+ id: "sheet.mutation.delete-conditional-rule",
445
+ handler(accessor, params) {
446
+ if (!params) return false;
447
+ const { unitId, subUnitId, cfId } = params;
448
+ accessor.get(ConditionalFormattingRuleModel).deleteRule(unitId, subUnitId, cfId);
449
+ return true;
450
+ }
451
+ };
452
+
453
+ //#endregion
454
+ //#region src/commands/mutations/add-conditional-rule.mutation.ts
455
+ const AddConditionalRuleMutationUndoFactory = (accessor, param) => {
456
+ return {
457
+ id: DeleteConditionalRuleMutation.id,
458
+ params: {
459
+ unitId: param.unitId,
460
+ subUnitId: param.subUnitId,
461
+ cfId: param.rule.cfId
462
+ }
463
+ };
464
+ };
465
+ const AddConditionalRuleMutation = {
466
+ type: _cool_office_core.CommandType.MUTATION,
467
+ id: "sheet.mutation.add-conditional-rule",
468
+ handler(accessor, params) {
469
+ if (!params) return false;
470
+ const { unitId, subUnitId, rule } = params;
471
+ accessor.get(ConditionalFormattingRuleModel).addRule(unitId, subUnitId, rule);
472
+ return true;
473
+ }
474
+ };
475
+
476
+ //#endregion
477
+ //#region src/commands/commands/add-cf.command.ts
478
+ const AddCfCommand = {
479
+ type: _cool_office_core.CommandType.COMMAND,
480
+ id: "sheet.command.add-conditional-rule",
481
+ handler(accessor, params) {
482
+ if (!params) return false;
483
+ const { rule } = params;
484
+ const undoRedoService = accessor.get(_cool_office_core.IUndoRedoService);
485
+ const commandService = accessor.get(_cool_office_core.ICommandService);
486
+ const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
487
+ const univerInstanceService = accessor.get(_cool_office_core.IUniverInstanceService);
488
+ const target = (0, _cool_office_sheets.getSheetCommandTarget)(univerInstanceService, params);
489
+ if (!target) return false;
490
+ const { unitId, subUnitId } = target;
491
+ const cfId = conditionalFormattingRuleModel.createCfId(unitId, subUnitId);
492
+ const config = {
493
+ unitId,
494
+ subUnitId,
495
+ rule: {
496
+ ...rule,
497
+ cfId: rule.cfId || cfId
498
+ }
499
+ };
500
+ const undo = AddConditionalRuleMutationUndoFactory(accessor, config);
501
+ const result = commandService.syncExecuteCommand(AddConditionalRuleMutation.id, config);
502
+ if (result) undoRedoService.pushUndoRedo({
503
+ unitID: unitId,
504
+ redoMutations: [{
505
+ id: AddConditionalRuleMutation.id,
506
+ params: config
507
+ }],
508
+ undoMutations: [undo]
509
+ });
510
+ return result;
511
+ }
512
+ };
513
+
514
+ //#endregion
515
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
516
+ function __decorateParam(paramIndex, decorator) {
517
+ return function(target, key) {
518
+ decorator(target, key, paramIndex);
519
+ };
520
+ }
521
+
522
+ //#endregion
523
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
524
+ function __decorate(decorators, target, key, desc) {
525
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
526
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
527
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
528
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
529
+ }
530
+
531
+ //#endregion
532
+ //#region src/models/conditional-formatting-range-index-model.ts
533
+ let ConditionalFormattingRangeIndexModel = class ConditionalFormattingRangeIndexModel extends _cool_office_core.Disposable {
534
+ constructor(_conditionalFormattingRuleModel) {
535
+ super();
536
+ this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
537
+ _defineProperty(this, "_rTreeManager", new _cool_office_core.RTree());
538
+ this.rebuild();
539
+ this._initRuleListener();
540
+ }
541
+ getRuleIdsByCell(unitId, subUnitId, row, col) {
542
+ return this.getRuleIdsByRanges(unitId, subUnitId, [{
543
+ startRow: row,
544
+ endRow: row,
545
+ startColumn: col,
546
+ endColumn: col
547
+ }]);
548
+ }
549
+ getRuleIdsByRanges(unitId, subUnitId, ranges) {
550
+ if (!ranges.length) return /* @__PURE__ */ new Set();
551
+ const ids = this._rTreeManager.bulkSearch(ranges.map((range) => ({
552
+ unitId,
553
+ sheetId: subUnitId,
554
+ range
555
+ })));
556
+ return new Set(Array.from(ids).map((id) => String(id)));
557
+ }
558
+ getRulesByRanges(unitId, subUnitId, ranges) {
559
+ const ids = this.getRuleIdsByRanges(unitId, subUnitId, ranges);
560
+ return (this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId) ?? []).filter((rule) => ids.has(rule.cfId));
561
+ }
562
+ dispose() {
563
+ this.clear();
564
+ super.dispose();
565
+ }
566
+ clear() {
567
+ this._rTreeManager.clear();
568
+ }
569
+ rebuild() {
570
+ this.clear();
571
+ this._conditionalFormattingRuleModel.getAll().forEach((subUnitMap, unitId) => {
572
+ subUnitMap.forEach((rules, subUnitId) => {
573
+ rules.forEach((rule) => {
574
+ this._insert(unitId, subUnitId, rule.cfId, rule.ranges);
575
+ });
576
+ });
577
+ });
578
+ }
579
+ _initRuleListener() {
580
+ this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((e) => {
581
+ const { unitId, subUnitId, rule } = e;
582
+ const { cfId, ranges } = rule;
583
+ switch (e.type) {
584
+ case "add":
585
+ this._insert(unitId, subUnitId, cfId, ranges);
586
+ break;
587
+ case "delete":
588
+ this._remove(unitId, subUnitId, cfId, ranges);
589
+ break;
590
+ case "set": {
591
+ const oldRule = e.oldRule;
592
+ this._remove(unitId, subUnitId, oldRule.cfId, oldRule.ranges);
593
+ this._insert(unitId, subUnitId, cfId, ranges);
594
+ break;
595
+ }
596
+ }
597
+ }));
598
+ }
599
+ _insert(unitId, subUnitId, cfId, ranges) {
600
+ this._rTreeManager.bulkInsert(ranges.map((range) => ({
601
+ unitId,
602
+ sheetId: subUnitId,
603
+ id: cfId,
604
+ range
605
+ })));
606
+ }
607
+ _remove(unitId, subUnitId, cfId, ranges) {
608
+ this._rTreeManager.bulkRemove(ranges.map((range) => ({
609
+ unitId,
610
+ sheetId: subUnitId,
611
+ id: cfId,
612
+ range
613
+ })));
614
+ }
615
+ };
616
+ ConditionalFormattingRangeIndexModel = __decorate([__decorateParam(0, (0, _cool_office_core.Inject)(ConditionalFormattingRuleModel))], ConditionalFormattingRangeIndexModel);
617
+
618
+ //#endregion
619
+ //#region src/services/conditional-formatting-range-transform.service.ts
620
+ var ConditionalFormattingRangeTransformService = class {
621
+ subtractRanges(sourceRanges, rangesToSubtract) {
622
+ return _cool_office_core.Rectangle.mergeRanges(_cool_office_core.Rectangle.subtractMulti(sourceRanges, rangesToSubtract));
623
+ }
624
+ addRanges(sourceRanges, rangesToAdd) {
625
+ return _cool_office_core.Rectangle.mergeRanges([...sourceRanges, ...rangesToAdd]);
626
+ }
627
+ applyRangeDelta(sourceRanges, rangesToSubtract, rangesToAdd) {
628
+ const ranges = rangesToSubtract.length ? this.subtractRanges(sourceRanges, rangesToSubtract) : sourceRanges;
629
+ return rangesToAdd.length ? this.addRanges(ranges, rangesToAdd) : ranges;
630
+ }
631
+ copyIntersectingRanges(sourceRanges, sourceRange, targetAnchor) {
632
+ const fragments = [];
633
+ sourceRanges.forEach((range) => {
634
+ const intersect = (0, _cool_office_core.getIntersectRange)(range, sourceRange);
635
+ if (!intersect) return;
636
+ fragments.push(this.translateRange(intersect, {
637
+ row: targetAnchor.row - sourceRange.startRow,
638
+ col: targetAnchor.col - sourceRange.startColumn
639
+ }));
640
+ });
641
+ return _cool_office_core.Rectangle.mergeRanges(fragments);
642
+ }
643
+ translateRange(range, offset) {
644
+ return {
645
+ startRow: range.startRow + offset.row,
646
+ endRow: range.endRow + offset.row,
647
+ startColumn: range.startColumn + offset.col,
648
+ endColumn: range.endColumn + offset.col
649
+ };
650
+ }
651
+ };
652
+
653
+ //#endregion
654
+ //#region src/commands/mutations/set-conditional-rule.mutation.ts
655
+ const SetConditionalRuleMutation = {
656
+ type: _cool_office_core.CommandType.MUTATION,
657
+ id: "sheet.mutation.set-conditional-rule",
658
+ handler(accessor, params) {
659
+ if (!params) return false;
660
+ const { unitId, subUnitId, rule } = params;
661
+ const cfId = params.cfId || params.rule.cfId;
662
+ accessor.get(ConditionalFormattingRuleModel).setRule(unitId, subUnitId, rule, cfId);
663
+ return true;
664
+ }
665
+ };
666
+ const setConditionalRuleMutationUndoFactory = (accessor, param) => {
667
+ const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
668
+ const { unitId, subUnitId } = param;
669
+ const cfId = param.cfId || param.rule.cfId;
670
+ const rule = conditionalFormattingRuleModel.getRule(unitId, subUnitId, cfId);
671
+ if (rule) return [{
672
+ id: SetConditionalRuleMutation.id,
673
+ params: {
674
+ unitId,
675
+ subUnitId,
676
+ cfId,
677
+ rule: _cool_office_core.Tools.deepClone(rule)
678
+ }
679
+ }];
680
+ return [];
681
+ };
682
+
683
+ //#endregion
684
+ //#region src/commands/commands/clear-range-cf.command.ts
685
+ const ClearRangeCfCommand = {
686
+ type: _cool_office_core.CommandType.COMMAND,
687
+ id: "sheet.command.clear-range-conditional-rule",
688
+ handler(accessor, params) {
689
+ var _selectionManagerServ;
690
+ if (!params) return false;
691
+ const conditionalFormattingRangeIndexModel = accessor.get(ConditionalFormattingRangeIndexModel);
692
+ const conditionalFormattingRangeTransformService = accessor.get(ConditionalFormattingRangeTransformService);
693
+ const univerInstanceService = accessor.get(_cool_office_core.IUniverInstanceService);
694
+ const commandService = accessor.get(_cool_office_core.ICommandService);
695
+ const undoRedoService = accessor.get(_cool_office_core.IUndoRedoService);
696
+ const selectionManagerService = accessor.get(_cool_office_sheets.SheetsSelectionsService);
697
+ const target = (0, _cool_office_sheets.getSheetCommandTarget)(univerInstanceService, params);
698
+ if (!target) return false;
699
+ const { unitId, subUnitId } = target;
700
+ const ranges = params.ranges ?? ((_selectionManagerServ = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((selection) => selection.range)) ?? [];
701
+ const allRuleList = conditionalFormattingRangeIndexModel.getRulesByRanges(unitId, subUnitId, ranges).filter((rule) => {
702
+ var _params$types;
703
+ return !((_params$types = params.types) === null || _params$types === void 0 ? void 0 : _params$types.length) || params.types.includes(rule.rule.type);
704
+ });
705
+ if (!(allRuleList === null || allRuleList === void 0 ? void 0 : allRuleList.length) || !ranges.length) return false;
706
+ const redos = [];
707
+ const undos = [];
708
+ allRuleList.forEach((oldRule) => {
709
+ const newRanges = conditionalFormattingRangeTransformService.subtractRanges(oldRule.ranges, ranges);
710
+ if (newRanges.length) {
711
+ const rule = {
712
+ ...oldRule,
713
+ ranges: newRanges
714
+ };
715
+ const params = {
716
+ unitId,
717
+ subUnitId,
718
+ rule
719
+ };
720
+ const undo = setConditionalRuleMutationUndoFactory(accessor, params);
721
+ redos.push({
722
+ id: SetConditionalRuleMutation.id,
723
+ params
724
+ });
725
+ undos.push(...undo);
726
+ } else {
727
+ const params = {
728
+ unitId,
729
+ subUnitId,
730
+ cfId: oldRule.cfId
731
+ };
732
+ const undo = DeleteConditionalRuleMutationUndoFactory(accessor, params);
733
+ redos.push({
734
+ id: DeleteConditionalRuleMutation.id,
735
+ params
736
+ });
737
+ undos.push(...undo);
738
+ }
739
+ });
740
+ const result = (0, _cool_office_core.sequenceExecute)(redos, commandService).result;
741
+ if (result) undoRedoService.pushUndoRedo({
742
+ unitID: unitId,
743
+ redoMutations: redos,
744
+ undoMutations: undos
745
+ });
746
+ return result;
747
+ }
748
+ };
749
+
750
+ //#endregion
751
+ //#region src/commands/commands/clear-worksheet-cf.command.ts
752
+ const ClearWorksheetCfCommand = {
753
+ type: _cool_office_core.CommandType.COMMAND,
754
+ id: "sheet.command.clear-worksheet-conditional-rule",
755
+ handler(accessor, params) {
756
+ const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
757
+ const univerInstanceService = accessor.get(_cool_office_core.IUniverInstanceService);
758
+ const commandService = accessor.get(_cool_office_core.ICommandService);
759
+ const undoRedoService = accessor.get(_cool_office_core.IUndoRedoService);
760
+ const target = (0, _cool_office_sheets.getSheetCommandTarget)(univerInstanceService, params);
761
+ if (!target) return false;
762
+ const { unitId, subUnitId } = target;
763
+ const ruleList = conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
764
+ if (!(ruleList === null || ruleList === void 0 ? void 0 : ruleList.length)) return false;
765
+ const configList = ruleList.map((rule) => ({
766
+ cfId: rule.cfId,
767
+ unitId,
768
+ subUnitId
769
+ }));
770
+ const redos = configList.map((config) => ({
771
+ id: DeleteConditionalRuleMutation.id,
772
+ params: config
773
+ }));
774
+ const undos = configList.map((config) => DeleteConditionalRuleMutationUndoFactory(accessor, config)[0]);
775
+ const result = (0, _cool_office_core.sequenceExecute)(redos, commandService).result;
776
+ if (result) undoRedoService.pushUndoRedo({
777
+ unitID: unitId,
778
+ redoMutations: redos,
779
+ undoMutations: undos
780
+ });
781
+ return result;
782
+ }
783
+ };
784
+
785
+ //#endregion
786
+ //#region src/commands/commands/delete-cf.command.ts
787
+ const DeleteCfCommand = {
788
+ type: _cool_office_core.CommandType.COMMAND,
789
+ id: "sheet.command.delete-conditional-rule",
790
+ handler(accessor, params) {
791
+ if (!params) return false;
792
+ const undoRedoService = accessor.get(_cool_office_core.IUndoRedoService);
793
+ const commandService = accessor.get(_cool_office_core.ICommandService);
794
+ const univerInstanceService = accessor.get(_cool_office_core.IUniverInstanceService);
795
+ const target = (0, _cool_office_sheets.getSheetCommandTarget)(univerInstanceService, params);
796
+ if (!target) return false;
797
+ const { unitId, subUnitId } = target;
798
+ const config = {
799
+ unitId,
800
+ subUnitId,
801
+ cfId: params.cfId
802
+ };
803
+ const undos = DeleteConditionalRuleMutationUndoFactory(accessor, config);
804
+ const result = commandService.syncExecuteCommand(DeleteConditionalRuleMutation.id, config);
805
+ if (result) undoRedoService.pushUndoRedo({
806
+ unitID: unitId,
807
+ undoMutations: undos,
808
+ redoMutations: [{
809
+ id: DeleteConditionalRuleMutation.id,
810
+ params: config
811
+ }]
812
+ });
813
+ return result;
814
+ }
815
+ };
816
+
817
+ //#endregion
818
+ //#region src/commands/commands/move-cf.command.ts
819
+ const MoveCfCommand = {
820
+ type: _cool_office_core.CommandType.COMMAND,
821
+ id: "sheet.command.move-conditional-rule",
822
+ handler(accessor, params) {
823
+ if (!params) return false;
824
+ const undoRedoService = accessor.get(_cool_office_core.IUndoRedoService);
825
+ const commandService = accessor.get(_cool_office_core.ICommandService);
826
+ const univerInstanceService = accessor.get(_cool_office_core.IUniverInstanceService);
827
+ const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
828
+ const target = (0, _cool_office_sheets.getSheetCommandTarget)(univerInstanceService, params);
829
+ if (!target) return false;
830
+ const { unitId, subUnitId } = target;
831
+ const anchorList = transformSupportSymmetryAnchor(params.start, params.end, conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId) || [], (rule) => rule.cfId);
832
+ if (!anchorList) return false;
833
+ const [start, end] = anchorList;
834
+ const config = {
835
+ unitId,
836
+ subUnitId,
837
+ start,
838
+ end
839
+ };
840
+ const undos = MoveConditionalRuleMutationUndoFactory(config);
841
+ const result = commandService.syncExecuteCommand(MoveConditionalRuleMutation.id, config);
842
+ if (result) undoRedoService.pushUndoRedo({
843
+ unitID: unitId,
844
+ redoMutations: [{
845
+ id: MoveConditionalRuleMutation.id,
846
+ params: config
847
+ }],
848
+ undoMutations: undos
849
+ });
850
+ return result;
851
+ }
852
+ };
853
+
854
+ //#endregion
855
+ //#region src/commands/commands/set-cf.command.ts
856
+ const SetCfCommand = {
857
+ type: _cool_office_core.CommandType.COMMAND,
858
+ id: "sheet.command.set-conditional-rule",
859
+ handler(accessor, params) {
860
+ if (!params) return false;
861
+ const undoRedoService = accessor.get(_cool_office_core.IUndoRedoService);
862
+ const commandService = accessor.get(_cool_office_core.ICommandService);
863
+ const univerInstanceService = accessor.get(_cool_office_core.IUniverInstanceService);
864
+ const target = (0, _cool_office_sheets.getSheetCommandTarget)(univerInstanceService, params);
865
+ if (!target) return false;
866
+ const { unitId, subUnitId } = target;
867
+ const config = {
868
+ unitId,
869
+ subUnitId,
870
+ rule: params.rule,
871
+ cfId: params.cfId
872
+ };
873
+ const undos = setConditionalRuleMutationUndoFactory(accessor, config);
874
+ const result = commandService.syncExecuteCommand(SetConditionalRuleMutation.id, config);
875
+ if (result) undoRedoService.pushUndoRedo({
876
+ unitID: unitId,
877
+ undoMutations: undos,
878
+ redoMutations: [{
879
+ id: SetConditionalRuleMutation.id,
880
+ params: config
881
+ }]
882
+ });
883
+ return result;
884
+ }
885
+ };
886
+
887
+ //#endregion
888
+ //#region src/utils/range.ts
889
+ function getRangeInWorksheet(range, worksheet) {
890
+ const maxRows = worksheet.getMaxRows();
891
+ const maxColumns = worksheet.getMaxColumns();
892
+ if (maxRows <= 0 || maxColumns <= 0) return null;
893
+ const effectiveRange = (0, _cool_office_core.getIntersectRange)(_cool_office_core.Range.transformRange(range, worksheet), {
894
+ startRow: 0,
895
+ endRow: maxRows - 1,
896
+ startColumn: 0,
897
+ endColumn: maxColumns - 1
898
+ });
899
+ if (!effectiveRange) return null;
900
+ return {
901
+ startRow: effectiveRange.startRow,
902
+ endRow: effectiveRange.endRow,
903
+ startColumn: effectiveRange.startColumn,
904
+ endColumn: effectiveRange.endColumn
905
+ };
906
+ }
907
+ function getRangesInWorksheet(ranges, worksheet) {
908
+ const effectiveRanges = [];
909
+ ranges.forEach((range) => {
910
+ const effectiveRange = getRangeInWorksheet(range, worksheet);
911
+ if (effectiveRange) effectiveRanges.push(effectiveRange);
912
+ });
913
+ return effectiveRanges;
914
+ }
915
+
916
+ //#endregion
917
+ //#region src/services/conditional-formatting-formula.service.ts
918
+ let ConditionalFormattingFormulaService = class ConditionalFormattingFormulaService extends _cool_office_core.Disposable {
919
+ constructor(_registerOtherFormulaService, _conditionalFormattingRuleModel, _univerInstanceService) {
920
+ super();
921
+ this._registerOtherFormulaService = _registerOtherFormulaService;
922
+ this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
923
+ this._univerInstanceService = _univerInstanceService;
924
+ _defineProperty(this, "_formulaMap", /* @__PURE__ */ new Map());
925
+ _defineProperty(this, "_result$", new rxjs.Subject());
926
+ _defineProperty(this, "result$", this._result$.asObservable());
927
+ this._initFormulaResultChange();
928
+ this._initRuleChange();
929
+ }
930
+ _initRuleChange() {
931
+ const isNeedMarkFormulaDirty = (rule) => {
932
+ switch (rule.type) {
933
+ case "colorScale": return rule.config.some((item) => item.value.type === "formula");
934
+ case "dataBar": return [rule.config.max, rule.config.min].some((item) => item.type === "formula");
935
+ case "iconSet": return rule.config.some((item) => item.value.type === "formula");
936
+ }
937
+ };
938
+ this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((option) => {
939
+ const { unitId, subUnitId, rule, oldRule } = option;
940
+ if (option.type === "delete") this._removeFormulaByCfId(unitId, subUnitId, rule.cfId);
941
+ if (option.type === "set") {
942
+ if (isNeedMarkFormulaDirty(rule.rule) || oldRule && isNeedMarkFormulaDirty(oldRule.rule)) this._removeFormulaByCfId(unitId, subUnitId, rule.cfId);
943
+ }
944
+ if (option.type === "add") this._registerRuleFormulas(unitId, subUnitId, rule);
945
+ }));
946
+ }
947
+ /**
948
+ * Register formulas for a specific rule based on its type
949
+ */
950
+ _registerRuleFormulas(unitId, subUnitId, rule) {
951
+ switch (rule.rule.type) {
952
+ case "highlightCell": if (rule.rule.subType === "formula") {
953
+ const formulaText = rule.rule.value;
954
+ if (formulaText) this.registerFormulaWithRange(unitId, subUnitId, rule.cfId, formulaText, rule.ranges);
955
+ }
956
+ }
957
+ }
958
+ _initFormulaResultChange() {
959
+ this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((results) => {
960
+ for (const unitId in results) for (const subUnitId in results[unitId]) {
961
+ const subUnitResults = results[unitId][subUnitId];
962
+ for (const formulaResult of subUnitResults) {
963
+ const formulaMapAlias = this._ensureSubunitFormulaMap(unitId, subUnitId).getValue(formulaResult.formulaId, ["formulaId"]);
964
+ if (!formulaMapAlias) continue;
965
+ const isAllFinished = this._getAllFormulaResultByCfId(unitId, subUnitId, formulaMapAlias.cfId).every((item) => {
966
+ const result = this._registerOtherFormulaService.getFormulaValueSync(unitId, subUnitId, item.formulaId);
967
+ return (result === null || result === void 0 ? void 0 : result.status) === _cool_office_engine_formula.FormulaResultStatus.SUCCESS;
968
+ });
969
+ this._result$.next({
970
+ ...formulaMapAlias,
971
+ isAllFinished
972
+ });
973
+ }
974
+ }
975
+ }));
976
+ }
977
+ _ensureSubunitFormulaMap(unitId, subUnitId) {
978
+ let unitMap = this._formulaMap.get(unitId);
979
+ if (!unitMap) {
980
+ unitMap = /* @__PURE__ */ new Map();
981
+ this._formulaMap.set(unitId, unitMap);
982
+ }
983
+ let subUnitMap = unitMap.get(subUnitId);
984
+ if (!subUnitMap) {
985
+ subUnitMap = new _cool_office_core.RefAlias([], ["formulaId", "id"]);
986
+ unitMap.set(subUnitId, subUnitMap);
987
+ }
988
+ return subUnitMap;
989
+ }
990
+ getSubUnitFormulaMap(unitId, subUnitId) {
991
+ var _this$_formulaMap$get;
992
+ return (_this$_formulaMap$get = this._formulaMap.get(unitId)) === null || _this$_formulaMap$get === void 0 ? void 0 : _this$_formulaMap$get.get(subUnitId);
993
+ }
994
+ registerFormulaWithRange(unitId, subUnitId, cfId, formulaText, ranges = [{
995
+ startRow: 0,
996
+ endRow: 0,
997
+ startColumn: 0,
998
+ endColumn: 0
999
+ }]) {
1000
+ var _this$_univerInstance;
1001
+ const formulaMap = this._ensureSubunitFormulaMap(unitId, subUnitId);
1002
+ const cfFormulaId = this.createCFormulaId(cfId, formulaText);
1003
+ if (formulaMap.getValue(cfFormulaId, ["id"])) return;
1004
+ const worksheet = (_this$_univerInstance = this._univerInstanceService.getUnit(unitId, _cool_office_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getSheetBySheetId(subUnitId);
1005
+ if (!worksheet) return;
1006
+ const effectiveRanges = getRangesInWorksheet(ranges, worksheet);
1007
+ if (!effectiveRanges.length) return;
1008
+ const sortedRanges = effectiveRanges.sort((a, b) => a.startRow !== b.startRow ? a.startRow - b.startRow : a.startColumn - b.startColumn);
1009
+ const formulaId = this._registerOtherFormulaService.registerFormulaWithRange(unitId, subUnitId, formulaText, sortedRanges, void 0, _cool_office_engine_formula.OtherFormulaBizType.CONDITIONAL_FORMATTING, cfId);
1010
+ formulaMap.addValue({
1011
+ formulaText,
1012
+ unitId,
1013
+ subUnitId,
1014
+ cfId,
1015
+ id: cfFormulaId,
1016
+ formulaId
1017
+ });
1018
+ }
1019
+ _removeFormulaByCfId(unitId, subUnitId, cfId) {
1020
+ const formulaIdList = this.deleteCache(unitId, subUnitId, cfId).map((item) => item.formulaId);
1021
+ this._registerOtherFormulaService.deleteFormula(unitId, subUnitId, formulaIdList);
1022
+ }
1023
+ getFormulaResultWithCoords(unitId, subUnitId, cfId, formulaText, row = 0, col = 0) {
1024
+ const map = this.getSubUnitFormulaMap(unitId, subUnitId);
1025
+ if (!map) return { status: _cool_office_engine_formula.FormulaResultStatus.NOT_REGISTER };
1026
+ const item = map.getValue(this.createCFormulaId(cfId, formulaText), ["id"]);
1027
+ if (!item) return { status: _cool_office_engine_formula.FormulaResultStatus.NOT_REGISTER };
1028
+ const formulaResult = this._registerOtherFormulaService.getFormulaValueSync(unitId, subUnitId, item.formulaId);
1029
+ if (!formulaResult) return { status: _cool_office_engine_formula.FormulaResultStatus.NOT_REGISTER };
1030
+ if (formulaResult.status === _cool_office_engine_formula.FormulaResultStatus.SUCCESS && formulaResult.result) {
1031
+ var _formulaResult$result;
1032
+ const cellData = (_formulaResult$result = formulaResult.result[row]) === null || _formulaResult$result === void 0 ? void 0 : _formulaResult$result[col];
1033
+ return {
1034
+ result: this._getCellValue(cellData),
1035
+ status: _cool_office_engine_formula.FormulaResultStatus.SUCCESS
1036
+ };
1037
+ }
1038
+ return { status: formulaResult.status };
1039
+ }
1040
+ getFormulaMatrix(unitId, subUnitId, cfId, formulaText) {
1041
+ const map = this.getSubUnitFormulaMap(unitId, subUnitId);
1042
+ if (!map) return { status: _cool_office_engine_formula.FormulaResultStatus.NOT_REGISTER };
1043
+ const item = map.getValue(this.createCFormulaId(cfId, formulaText), ["id"]);
1044
+ if (!item) return { status: _cool_office_engine_formula.FormulaResultStatus.NOT_REGISTER };
1045
+ const formulaResult = this._registerOtherFormulaService.getFormulaValueSync(unitId, subUnitId, item.formulaId);
1046
+ if (!formulaResult) return { status: _cool_office_engine_formula.FormulaResultStatus.NOT_REGISTER };
1047
+ if (formulaResult.status === _cool_office_engine_formula.FormulaResultStatus.SUCCESS && formulaResult.result) {
1048
+ const result = new _cool_office_core.ObjectMatrix();
1049
+ new _cool_office_core.ObjectMatrix(formulaResult.result).forValue((row, col, cellData) => {
1050
+ result.setValue(row, col, this._getCellValue(cellData));
1051
+ });
1052
+ return {
1053
+ result,
1054
+ status: _cool_office_engine_formula.FormulaResultStatus.SUCCESS
1055
+ };
1056
+ }
1057
+ return { status: formulaResult.status };
1058
+ }
1059
+ _getCellValue(cellData) {
1060
+ if (!cellData || !cellData[0] || !cellData[0][0]) return false;
1061
+ const cell = cellData[0][0];
1062
+ if ((cell === null || cell === void 0 ? void 0 : cell.t) === _cool_office_core.CellValueType.BOOLEAN) return cell.v === _cool_office_core.BooleanNumber.TRUE || cell.v === true;
1063
+ return cell === null || cell === void 0 ? void 0 : cell.v;
1064
+ }
1065
+ /**
1066
+ * If `formulaText` is not provided, then all caches related to `cfId` will be deleted.
1067
+ */
1068
+ deleteCache(unitId, subUnitId, cfId, formulaText) {
1069
+ const map = this.getSubUnitFormulaMap(unitId, subUnitId);
1070
+ if (!map) return [];
1071
+ if (formulaText) {
1072
+ const key = this.createCFormulaId(cfId, formulaText);
1073
+ map.deleteValue(key, ["id"]);
1074
+ return [];
1075
+ } else {
1076
+ const values = map.getValues().filter((v) => v.cfId === cfId);
1077
+ values.forEach((e) => {
1078
+ map.deleteValue(e.formulaId, ["formulaId"]);
1079
+ });
1080
+ return values;
1081
+ }
1082
+ }
1083
+ _getAllFormulaResultByCfId(unitId, subUnitId, cfId) {
1084
+ const map = this.getSubUnitFormulaMap(unitId, subUnitId);
1085
+ if (!map) return [];
1086
+ return map.getValues().filter((v) => v.cfId === cfId);
1087
+ }
1088
+ /**
1089
+ * A conditional formatting may have multiple formulas;if the formulas are identical,then the results will be consistent.
1090
+ */
1091
+ createCFormulaId(cfId, formulaText) {
1092
+ return `${cfId}_${formulaText}`;
1093
+ }
1094
+ };
1095
+ ConditionalFormattingFormulaService = __decorate([
1096
+ __decorateParam(0, (0, _cool_office_core.Inject)(_cool_office_engine_formula.RegisterOtherFormulaService)),
1097
+ __decorateParam(1, (0, _cool_office_core.Inject)(ConditionalFormattingRuleModel)),
1098
+ __decorateParam(2, _cool_office_core.IUniverInstanceService)
1099
+ ], ConditionalFormattingFormulaService);
1100
+
1101
+ //#endregion
1102
+ //#region src/models/calculate-unit-v2/base-calculate-unit.ts
1103
+ /**
1104
+ * Processing Main Path Calculation Logic
1105
+ */
1106
+ var BaseCalculateUnit = class {
1107
+ constructor(_context) {
1108
+ this._context = _context;
1109
+ _defineProperty(this, "_cache", void 0);
1110
+ _defineProperty(this, "_preComputingStatus$", new rxjs.BehaviorSubject("preComputingStart"));
1111
+ _defineProperty(this, "preComputingStatus$", this._preComputingStatus$.asObservable().pipe((0, rxjs_operators.distinctUntilChanged)()));
1112
+ _defineProperty(this, "_preComputingCache", void 0);
1113
+ _defineProperty(this, "_rule", void 0);
1114
+ this._cache = new _cool_office_core.LRUMap(_context.limit);
1115
+ this._rule = _context.rule;
1116
+ this._preComputingCache = null;
1117
+ this._initClearCacheListener();
1118
+ }
1119
+ setCacheLength(length) {
1120
+ this._cache.limit = length;
1121
+ }
1122
+ clearCache() {
1123
+ this._cache.clear();
1124
+ }
1125
+ resetPreComputingCache() {
1126
+ this._preComputingStatus$.next("preComputingStart");
1127
+ this._preComputingCache = null;
1128
+ }
1129
+ updateRule(rule) {
1130
+ this._rule = rule;
1131
+ this.resetPreComputingCache();
1132
+ }
1133
+ getCell(row, col) {
1134
+ const key = this._createKey(row, col);
1135
+ if (this._preComputingStatus$.getValue() === "preComputing") return this._cache.get(key);
1136
+ let preComputingResult = this.getPreComputingResult(row, col);
1137
+ if (preComputingResult === null) {
1138
+ this._preComputingStatus$.next("preComputingStart");
1139
+ this.preComputing(row, col, this._getContext());
1140
+ preComputingResult = this.getPreComputingResult(row, col);
1141
+ if (preComputingResult === null) return this._cache.get(key);
1142
+ }
1143
+ this._preComputingStatus$.next("preComputingEnd");
1144
+ if (this._cache.has(key)) return this._cache.get(key);
1145
+ const result = this.getCellResult(row, col, preComputingResult, this._getContext());
1146
+ if (result !== null) this._setCache(row, col, result);
1147
+ return result;
1148
+ }
1149
+ setPreComputingCache(v) {
1150
+ this._preComputingCache = v;
1151
+ }
1152
+ getPreComputingResult(_row, _col) {
1153
+ return this._preComputingCache;
1154
+ }
1155
+ _createKey(row, col) {
1156
+ return `${row}_${col}`;
1157
+ }
1158
+ _setCache(row, col, v) {
1159
+ const key = this._createKey(row, col);
1160
+ this._cache.set(key, v);
1161
+ }
1162
+ _getContext() {
1163
+ return {
1164
+ ...this._context,
1165
+ rule: this._rule
1166
+ };
1167
+ }
1168
+ _initClearCacheListener() {
1169
+ this.preComputingStatus$.subscribe((e) => {
1170
+ if (e === "preComputingEnd") this.clearCache();
1171
+ });
1172
+ }
1173
+ };
1174
+
1175
+ //#endregion
1176
+ //#region src/models/calculate-unit-v2/color-scale-calculate-unit.ts
1177
+ var ColorScaleCalculateUnit = class extends BaseCalculateUnit {
1178
+ preComputing(_row, _col, context) {
1179
+ const rule = context.rule;
1180
+ const worksheet = context.worksheet;
1181
+ const matrix = new _cool_office_core.ObjectMatrix();
1182
+ if (!rule.rule.config.every((item) => item.value.type === "num")) filterRange(rule.ranges, worksheet.getMaxRows() - 1, worksheet.getMaxColumns() - 1).forEach((range) => {
1183
+ _cool_office_core.Range.foreach(range, (row, col) => {
1184
+ const cell = context.getCellValue(row, col);
1185
+ const v = cell && cell.v;
1186
+ if (!isNullable(v) && (cell === null || cell === void 0 ? void 0 : cell.t) === _cool_office_core.CellValueType.NUMBER) {
1187
+ const _value = Number(v);
1188
+ !Number.isNaN(_value) && matrix.setValue(row, col, _value);
1189
+ }
1190
+ });
1191
+ });
1192
+ const _configList = [...rule.rule.config].sort((a, b) => a.index - b.index).map((config) => {
1193
+ return {
1194
+ value: getValueByType(config.value, matrix, {
1195
+ ...context,
1196
+ cfId: rule.cfId
1197
+ }),
1198
+ color: new _cool_office_core.ColorKit(config.color)
1199
+ };
1200
+ });
1201
+ if (!_configList.some((item) => (0, _cool_office_engine_render.isObject)(item.value) ? item.value.status !== _cool_office_engine_formula.FormulaResultStatus.SUCCESS : false)) {
1202
+ const colorList = _configList.map((item) => item.color).reduce((result, color, index) => {
1203
+ result.result.push({
1204
+ color,
1205
+ value: result.sortValue[index]
1206
+ });
1207
+ return result;
1208
+ }, {
1209
+ result: [],
1210
+ sortValue: _configList.map((item) => item.value.result).sort((a, b) => a - b)
1211
+ }).result;
1212
+ this.setPreComputingCache(colorList);
1213
+ this._preComputingStatus$.next("preComputingEnd");
1214
+ return;
1215
+ }
1216
+ this._preComputingStatus$.next("preComputing");
1217
+ }
1218
+ getCellResult(row, col, preComputingResult, context) {
1219
+ if (!preComputingResult) return null;
1220
+ const cell = context.getCellValue(row, col);
1221
+ if (cell.t === _cool_office_core.CellValueType.NUMBER) {
1222
+ const v = Number(cell.v);
1223
+ if (!Number.isNaN(v)) return getColorScaleFromValue(preComputingResult, v);
1224
+ }
1225
+ }
1226
+ };
1227
+
1228
+ //#endregion
1229
+ //#region src/render/data-bar.render.ts
1230
+ const dataBarUKey = "sheet-conditional-rule-data-bar";
1231
+ const defaultDataBarPositiveColor = "#ffbe38";
1232
+ const defaultDataBarNativeColor = "#abd91a";
1233
+ const defaultPlaceholderColor = "#000";
1234
+ const EXTENSION_Z_INDEX$1 = 34;
1235
+ const stringifyRange$1 = (range) => {
1236
+ const { startRow, endRow, startColumn, endColumn } = range;
1237
+ return `${startRow}-${endRow}-${startColumn}-${endColumn}`;
1238
+ };
1239
+ var DataBar = class extends _cool_office_engine_render.SheetExtension {
1240
+ constructor(..._args) {
1241
+ super(..._args);
1242
+ _defineProperty(this, "_paddingRightAndLeft", 2);
1243
+ _defineProperty(this, "_paddingTopAndBottom", 2);
1244
+ _defineProperty(this, "_renderRangeResolver", null);
1245
+ _defineProperty(this, "uKey", dataBarUKey);
1246
+ _defineProperty(this, "Z_INDEX", EXTENSION_Z_INDEX$1);
1247
+ _defineProperty(this, "_radius", 1);
1248
+ }
1249
+ setRenderRangeResolver(resolver) {
1250
+ this._renderRangeResolver = resolver;
1251
+ }
1252
+ draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges) {
1253
+ const { worksheet } = spreadsheetSkeleton;
1254
+ if (!worksheet) return false;
1255
+ const mergeCellRendered = /* @__PURE__ */ new Set();
1256
+ const sourceRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [spreadsheetSkeleton.rowColumnSegment];
1257
+ const renderRanges = this._renderRangeResolver && worksheet.getMergeData().length === 0 ? this._renderRangeResolver(worksheet.getUnitId(), worksheet.getSheetId(), sourceRanges) ?? sourceRanges : sourceRanges;
1258
+ if (!renderRanges.length) return;
1259
+ ctx.save();
1260
+ renderRanges.forEach((range) => {
1261
+ _cool_office_core.Range.foreach(range, (row, col) => {
1262
+ if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col)) return;
1263
+ const primaryWithCoord = spreadsheetSkeleton.getCellWithCoordByIndex(row, col, false);
1264
+ const { isMerged, isMergedMainCell, mergeInfo } = primaryWithCoord;
1265
+ let cellData = worksheet.getCell(row, col);
1266
+ if (isMerged) cellData = worksheet.getCell(mergeInfo.startRow, mergeInfo.startColumn);
1267
+ if (!(cellData === null || cellData === void 0 ? void 0 : cellData.dataBar)) return;
1268
+ if (!this.isRenderDiffRangesByCell(mergeInfo, diffRanges)) return;
1269
+ if (isMerged || isMergedMainCell) {
1270
+ const rangeStr = stringifyRange$1(mergeInfo);
1271
+ if (mergeCellRendered.has(rangeStr)) return;
1272
+ mergeCellRendered.add(rangeStr);
1273
+ }
1274
+ const { color, value, startPoint, isGradient } = cellData.dataBar;
1275
+ const { startX, endX, startY, endY } = isMerged || isMergedMainCell ? mergeInfo : primaryWithCoord;
1276
+ const borderWidth = endX - startX;
1277
+ const borderHeight = endY + _cool_office_engine_render.FIX_ONE_PIXEL_BLUR_OFFSET - startY;
1278
+ const width = borderWidth - this._paddingRightAndLeft * 2;
1279
+ const height = borderHeight - this._paddingTopAndBottom * 2;
1280
+ if (value > 0) {
1281
+ const dataBarWidth = Math.max(width * (1 - startPoint / 100) * value / 100, 1);
1282
+ const x0 = startX + this._paddingRightAndLeft + startPoint / 100 * width;
1283
+ const y0 = startY + this._paddingTopAndBottom;
1284
+ if (isGradient) {
1285
+ const gradient = ctx.createLinearGradient(x0, y0, x0 + dataBarWidth, y0);
1286
+ gradient.addColorStop(0, color);
1287
+ gradient.addColorStop(1, "rgb(255 255 255)");
1288
+ ctx.fillStyle = gradient;
1289
+ ctx.strokeStyle = color;
1290
+ ctx.lineWidth = 1;
1291
+ } else ctx.fillStyle = color;
1292
+ this._drawRectWithRoundedCorner(ctx, x0, y0, dataBarWidth, height, false, true, true, false);
1293
+ if (isGradient) ctx.stroke();
1294
+ } else {
1295
+ const dataBarWidth = Math.max(width * startPoint / 100 * Math.abs(value) / 100, 1);
1296
+ const x0 = startX + this._paddingRightAndLeft + startPoint / 100 * width - dataBarWidth;
1297
+ const y0 = startY + this._paddingTopAndBottom;
1298
+ if (isGradient) {
1299
+ const gradient = ctx.createLinearGradient(x0, y0, x0 + dataBarWidth, y0);
1300
+ gradient.addColorStop(0, "rgb(255 255 255)");
1301
+ gradient.addColorStop(1, color);
1302
+ ctx.fillStyle = gradient;
1303
+ ctx.strokeStyle = color;
1304
+ ctx.lineWidth = 1;
1305
+ } else ctx.fillStyle = color;
1306
+ this._drawRectWithRoundedCorner(ctx, x0, y0, dataBarWidth, height, true, false, false, true);
1307
+ if (isGradient) ctx.stroke();
1308
+ }
1309
+ });
1310
+ });
1311
+ ctx.restore();
1312
+ }
1313
+ dispose() {
1314
+ this._renderRangeResolver = null;
1315
+ super.dispose();
1316
+ }
1317
+ _drawRectWithRoundedCorner(ctx, x, y, width, height, topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius) {
1318
+ const radius = this._radius;
1319
+ if (!height || !width) return;
1320
+ ctx.beginPath();
1321
+ ctx.moveTo(x + radius, y);
1322
+ ctx.lineTo(x + width - radius, y);
1323
+ if (topRightRadius) ctx.arcTo(x + width, y, x + width, y + radius, radius);
1324
+ else ctx.lineTo(x + width, y);
1325
+ ctx.lineTo(x + width, y + height - radius);
1326
+ if (bottomRightRadius) ctx.arcTo(x + width, y + height, x + width - radius, y + height, radius);
1327
+ else ctx.lineTo(x + width, y + height);
1328
+ ctx.lineTo(x + radius, y + height);
1329
+ if (bottomLeftRadius) ctx.arcTo(x, y + height, x, y + height - radius, radius);
1330
+ else ctx.lineTo(x, y + height);
1331
+ ctx.lineTo(x, y + radius);
1332
+ if (topLeftRadius) ctx.arcTo(x, y, x + radius, y, radius);
1333
+ else ctx.lineTo(x, y);
1334
+ ctx.closePath();
1335
+ ctx.fill();
1336
+ }
1337
+ };
1338
+ _cool_office_engine_render.SpreadsheetExtensionRegistry.add(DataBar);
1339
+
1340
+ //#endregion
1341
+ //#region src/models/calculate-unit-v2/data-bar-calculate-unit.ts
1342
+ const getSafeValue = (v) => Math.max(Math.min(100, v), 0);
1343
+ const getValue$1 = (row, col, getCell) => {
1344
+ const cell = getCell(row, col);
1345
+ if (cell && cell.t === _cool_office_core.CellValueType.NUMBER) {
1346
+ const value = Number(cell.v);
1347
+ return Number.isNaN(value) ? null : value;
1348
+ }
1349
+ return null;
1350
+ };
1351
+ var DataBarCalculateUnit = class extends BaseCalculateUnit {
1352
+ preComputing(row, col, context) {
1353
+ const rule = context.rule;
1354
+ const ruleConfig = rule.rule;
1355
+ const worksheet = context.worksheet;
1356
+ const matrix = new _cool_office_core.ObjectMatrix();
1357
+ if (![rule.rule.config.max, rule.rule.config.min].every((e) => e.type === "num")) filterRange(rule.ranges, worksheet.getMaxRows() - 1, worksheet.getMaxColumns() - 1).forEach((range) => {
1358
+ _cool_office_core.Range.foreach(range, (row, col) => {
1359
+ const cell = context.getCellValue(row, col);
1360
+ const v = cell && cell.v;
1361
+ if (!isNullable(v) && (cell === null || cell === void 0 ? void 0 : cell.t) === _cool_office_core.CellValueType.NUMBER) {
1362
+ const _value = Number(v);
1363
+ !Number.isNaN(_value) && matrix.setValue(row, col, _value);
1364
+ }
1365
+ });
1366
+ });
1367
+ const _min = getValueByType(ruleConfig.config.min, matrix, {
1368
+ ...context,
1369
+ cfId: rule.cfId
1370
+ });
1371
+ const _max = getValueByType(ruleConfig.config.max, matrix, {
1372
+ ...context,
1373
+ cfId: rule.cfId
1374
+ });
1375
+ let min = 0;
1376
+ let max = 0;
1377
+ if (_min.status === _cool_office_engine_formula.FormulaResultStatus.SUCCESS) {
1378
+ const v = Number(_min.result);
1379
+ min = Number.isNaN(v) ? 0 : v;
1380
+ } else {
1381
+ this._preComputingStatus$.next("preComputing");
1382
+ return;
1383
+ }
1384
+ if (_max.status === _cool_office_engine_formula.FormulaResultStatus.SUCCESS) {
1385
+ const maxResult = Number(_max.result);
1386
+ const v = Number.isNaN(maxResult) ? 0 : maxResult;
1387
+ max = Math.max(v, min);
1388
+ min = Math.min(v, min);
1389
+ let startPoint = 50;
1390
+ if (min < 0 && max <= 0) startPoint = 100;
1391
+ else if (min < 0 && max > 0) {
1392
+ const length = Math.abs(max) + Math.abs(min);
1393
+ startPoint = Math.abs(min) / length * 100;
1394
+ } else if (min >= 0 && max > 0) startPoint = 0;
1395
+ this.setPreComputingCache({
1396
+ min,
1397
+ max,
1398
+ startPoint
1399
+ });
1400
+ this._preComputingStatus$.next("preComputingEnd");
1401
+ return;
1402
+ }
1403
+ this._preComputingStatus$.next("preComputing");
1404
+ }
1405
+ getCellResult(row, col, preComputingResult, context) {
1406
+ const { min, max, startPoint } = preComputingResult;
1407
+ const ruleConfig = context.rule.rule;
1408
+ const isShowValue = ruleConfig.isShowValue;
1409
+ const isGradient = ruleConfig.config.isGradient;
1410
+ const value = getValue$1(row, col, context.getCellValue);
1411
+ if (value === null || value < min || min === max || max < min) return;
1412
+ if (value === 0) return {
1413
+ color: defaultPlaceholderColor,
1414
+ startPoint,
1415
+ value: 0,
1416
+ isGradient,
1417
+ isShowValue
1418
+ };
1419
+ if (min < 0 && max <= 0) {
1420
+ const length = max - min;
1421
+ const v = getSafeValue((max - value) / length * 100);
1422
+ if (v === 0) return;
1423
+ return {
1424
+ color: ruleConfig.config.nativeColor || "#abd91a",
1425
+ startPoint,
1426
+ value: -v,
1427
+ isGradient,
1428
+ isShowValue
1429
+ };
1430
+ } else if (min < 0 && max > 0) {
1431
+ if (value > 0) {
1432
+ const v = getSafeValue(Math.min(value / max, 1) * 100);
1433
+ if (v === 0) return;
1434
+ return {
1435
+ color: ruleConfig.config.positiveColor || "#ffbe38",
1436
+ startPoint,
1437
+ value: v,
1438
+ isGradient,
1439
+ isShowValue
1440
+ };
1441
+ } else {
1442
+ const v = getSafeValue(Math.min(Math.abs(value) / Math.abs(min), 1) * 100);
1443
+ if (v === 0) return;
1444
+ return {
1445
+ color: ruleConfig.config.nativeColor || "#abd91a",
1446
+ startPoint,
1447
+ value: -v,
1448
+ isGradient,
1449
+ isShowValue
1450
+ };
1451
+ }
1452
+ } else if (min >= 0 && max > 0) {
1453
+ const length = max - min;
1454
+ const startPoint = 0;
1455
+ const v = getSafeValue((1 - (max - value) / length) * 100);
1456
+ if (v === 0) return;
1457
+ return {
1458
+ color: ruleConfig.config.positiveColor || "#ffbe38",
1459
+ startPoint,
1460
+ value: v,
1461
+ isGradient,
1462
+ isShowValue
1463
+ };
1464
+ }
1465
+ }
1466
+ };
1467
+
1468
+ //#endregion
1469
+ //#region src/models/calculate-unit-v2/highlight-cell-calculate-unit.ts
1470
+ const isFormulaResultMatched = (value) => value === true || value === 1 || value === "TRUE";
1471
+ const sortRangesByTopLeft = (ranges) => [...ranges].sort((a, b) => {
1472
+ if (a.startRow !== b.startRow) return a.startRow - b.startRow;
1473
+ return a.startColumn - b.startColumn;
1474
+ });
1475
+ var HighlightCellCalculateUnit = class extends BaseCalculateUnit {
1476
+ preComputing(row, col, context) {
1477
+ const ruleConfig = context.rule.rule;
1478
+ const ranges = filterRange(context.rule.ranges, context.worksheet.getMaxRows() - 1, context.worksheet.getMaxColumns() - 1);
1479
+ const getCache = () => {
1480
+ switch (ruleConfig.subType) {
1481
+ case "average": {
1482
+ let sum = 0;
1483
+ let count = 0;
1484
+ ranges.forEach((range) => {
1485
+ _cool_office_core.Range.foreach(range, (row, col) => {
1486
+ const cell = context.getCellValue(row, col);
1487
+ const v = getCellValue(cell);
1488
+ if (cell && cell.t === _cool_office_core.CellValueType.NUMBER && !isNullable(v)) {
1489
+ sum += Number(v) || 0;
1490
+ count++;
1491
+ }
1492
+ });
1493
+ });
1494
+ return {
1495
+ value: sum / count,
1496
+ type: ruleConfig.subType
1497
+ };
1498
+ }
1499
+ case "uniqueValues":
1500
+ case "duplicateValues": {
1501
+ const cacheMap = /* @__PURE__ */ new Map();
1502
+ ranges.forEach((range) => {
1503
+ _cool_office_core.Range.foreach(range, (row, col) => {
1504
+ const cell = context.getCellValue(row, col);
1505
+ const v = getCellValue(cell);
1506
+ if (!isNullable(v)) {
1507
+ const cache = cacheMap.get(v);
1508
+ if (cache) cacheMap.set(v, cache + 1);
1509
+ else cacheMap.set(v, 1);
1510
+ }
1511
+ });
1512
+ });
1513
+ return {
1514
+ value: cacheMap,
1515
+ type: ruleConfig.subType
1516
+ };
1517
+ }
1518
+ case "rank": {
1519
+ let allValue = [];
1520
+ ranges.forEach((range) => {
1521
+ _cool_office_core.Range.foreach(range, (row, col) => {
1522
+ const cell = context.getCellValue(row, col);
1523
+ const v = getCellValue(cell);
1524
+ if (cell && cell.t === _cool_office_core.CellValueType.NUMBER && !isNullable(v)) allValue.push(Number(v) || 0);
1525
+ });
1526
+ });
1527
+ allValue.sort((a, b) => b - a);
1528
+ const configRule = context.rule.rule;
1529
+ if (configRule.isPercent) {
1530
+ if (configRule.isBottom) allValue = allValue.slice().reverse();
1531
+ const threshold = _cool_office_core.Tools.clamp(configRule.value, 0, 100) / 100;
1532
+ const targetIndex = Math.floor(threshold * allValue.length);
1533
+ const safeIndex = _cool_office_core.Tools.clamp(targetIndex - 1, 0, allValue.length - 1);
1534
+ return {
1535
+ value: allValue[safeIndex],
1536
+ type: ruleConfig.subType
1537
+ };
1538
+ }
1539
+ const targetIndex = Math.floor(_cool_office_core.Tools.clamp(configRule.isBottom ? configRule.value - 1 : configRule.value, 0, allValue.length));
1540
+ if (configRule.isBottom) return {
1541
+ value: allValue[allValue.length - targetIndex - 1],
1542
+ type: ruleConfig.subType
1543
+ };
1544
+ else return {
1545
+ value: allValue[Math.max(targetIndex - 1, 0)],
1546
+ type: ruleConfig.subType
1547
+ };
1548
+ }
1549
+ case "formula": {
1550
+ const _ruleConfig = ruleConfig;
1551
+ const conditionalFormattingFormulaService = context.accessor.get(ConditionalFormattingFormulaService);
1552
+ const normalizedRanges = sortRangesByTopLeft(context.rule.ranges);
1553
+ conditionalFormattingFormulaService.registerFormulaWithRange(context.unitId, context.subUnitId, context.rule.cfId, _ruleConfig.value, normalizedRanges);
1554
+ const result = conditionalFormattingFormulaService.getFormulaMatrix(context.unitId, context.subUnitId, context.rule.cfId, _ruleConfig.value);
1555
+ if (result && result.status === _cool_office_engine_formula.FormulaResultStatus.SUCCESS) {
1556
+ this._preComputingStatus$.next("preComputingEnd");
1557
+ return {
1558
+ value: result.result,
1559
+ type: ruleConfig.subType
1560
+ };
1561
+ } else this._preComputingStatus$.next("preComputing");
1562
+ return null;
1563
+ }
1564
+ case "timePeriod": switch (ruleConfig.operator) {
1565
+ case "last7Days": {
1566
+ const today = (0, _cool_office_core.dateKit)().startOf("day");
1567
+ return {
1568
+ value: {
1569
+ start: today.subtract(6, "day").valueOf(),
1570
+ end: today.endOf("day").valueOf()
1571
+ },
1572
+ type: ruleConfig.subType
1573
+ };
1574
+ }
1575
+ case "lastMonth": {
1576
+ const month = (0, _cool_office_core.dateKit)().startOf("month").subtract(1, "month");
1577
+ return {
1578
+ value: {
1579
+ start: month.valueOf(),
1580
+ end: month.endOf("month").valueOf()
1581
+ },
1582
+ type: ruleConfig.subType
1583
+ };
1584
+ }
1585
+ case "lastWeek": return {
1586
+ value: {
1587
+ start: (0, _cool_office_core.dateKit)().startOf("week").subtract(1, "week").valueOf(),
1588
+ end: (0, _cool_office_core.dateKit)().endOf("week").subtract(1, "week").valueOf()
1589
+ },
1590
+ type: ruleConfig.subType
1591
+ };
1592
+ case "nextMonth": {
1593
+ const month = (0, _cool_office_core.dateKit)().startOf("month").add(1, "month");
1594
+ return {
1595
+ value: {
1596
+ start: month.valueOf(),
1597
+ end: month.endOf("month").valueOf()
1598
+ },
1599
+ type: ruleConfig.subType
1600
+ };
1601
+ }
1602
+ case "nextWeek": return {
1603
+ value: {
1604
+ start: (0, _cool_office_core.dateKit)().startOf("week").add(1, "week").valueOf(),
1605
+ end: (0, _cool_office_core.dateKit)().endOf("week").add(1, "week").valueOf()
1606
+ },
1607
+ type: ruleConfig.subType
1608
+ };
1609
+ case "thisMonth": return {
1610
+ value: {
1611
+ start: (0, _cool_office_core.dateKit)().startOf("month").valueOf(),
1612
+ end: (0, _cool_office_core.dateKit)().endOf("month").valueOf()
1613
+ },
1614
+ type: ruleConfig.subType
1615
+ };
1616
+ case "thisWeek": return {
1617
+ value: {
1618
+ start: (0, _cool_office_core.dateKit)().startOf("week").valueOf(),
1619
+ end: (0, _cool_office_core.dateKit)().endOf("week").valueOf()
1620
+ },
1621
+ type: ruleConfig.subType
1622
+ };
1623
+ case "today": return {
1624
+ value: {
1625
+ start: (0, _cool_office_core.dateKit)().startOf("day").valueOf(),
1626
+ end: (0, _cool_office_core.dateKit)().endOf("day").valueOf()
1627
+ },
1628
+ type: ruleConfig.subType
1629
+ };
1630
+ case "tomorrow": return {
1631
+ value: {
1632
+ start: (0, _cool_office_core.dateKit)().startOf("day").add(1, "day").valueOf(),
1633
+ end: (0, _cool_office_core.dateKit)().endOf("day").add(1, "day").valueOf()
1634
+ },
1635
+ type: ruleConfig.subType
1636
+ };
1637
+ case "yesterday": return {
1638
+ value: {
1639
+ start: (0, _cool_office_core.dateKit)().startOf("day").subtract(1, "day").valueOf(),
1640
+ end: (0, _cool_office_core.dateKit)().endOf("day").subtract(1, "day").valueOf()
1641
+ },
1642
+ type: ruleConfig.subType
1643
+ };
1644
+ }
1645
+ }
1646
+ };
1647
+ const result = getCache();
1648
+ this.setPreComputingCache(result);
1649
+ }
1650
+ getCellResult(row, col, preComputingResult, context) {
1651
+ const cellValue = context.getCellValue(row, col);
1652
+ const ruleConfig = context.rule.rule;
1653
+ const run = () => {
1654
+ switch (ruleConfig.subType) {
1655
+ case "number": {
1656
+ const subRuleConfig = ruleConfig;
1657
+ const value = cellValue === null || cellValue === void 0 ? void 0 : cellValue.v;
1658
+ if ((cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) !== _cool_office_core.CellValueType.FORCE_STRING && _cool_office_engine_formula.ERROR_TYPE_SET.has(value)) return false;
1659
+ if (value != null && ((cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) === _cool_office_core.CellValueType.BOOLEAN || (cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) !== _cool_office_core.CellValueType.NUMBER && typeof value !== "number")) return [
1660
+ "notEqual",
1661
+ "notBetween",
1662
+ "greaterThan",
1663
+ "greaterThanOrEqual"
1664
+ ].includes(subRuleConfig.operator);
1665
+ return compareWithNumber({
1666
+ operator: subRuleConfig.operator,
1667
+ value: subRuleConfig.value ?? 0
1668
+ }, Number(value ?? 0));
1669
+ }
1670
+ case "text": {
1671
+ const subRuleConfig = ruleConfig;
1672
+ const value = getCellValue(cellValue);
1673
+ const v = isNullable(value) ? "" : String(value);
1674
+ const condition = subRuleConfig.value || "";
1675
+ switch (subRuleConfig.operator) {
1676
+ case "beginsWith": return v.startsWith(condition);
1677
+ case "containsBlanks": return /^\s*$/.test(v);
1678
+ case "notContainsBlanks": return !/^\s*$/.test(v);
1679
+ case "containsErrors": return _cool_office_engine_formula.ERROR_TYPE_SET.has(v);
1680
+ case "notContainsErrors": return !_cool_office_engine_formula.ERROR_TYPE_SET.has(v);
1681
+ case "containsText": return v.indexOf(condition) > -1;
1682
+ case "notContainsText": return v.indexOf(condition) === -1;
1683
+ case "endsWith": return v.endsWith(condition);
1684
+ case "equal": return v === condition;
1685
+ case "notEqual": return v !== condition;
1686
+ default: return false;
1687
+ }
1688
+ }
1689
+ case "timePeriod": {
1690
+ const value = getCellValue(cellValue);
1691
+ if (isNullable(value) || Number.isNaN(Number(value)) || (cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) !== _cool_office_core.CellValueType.NUMBER || !preComputingResult) return;
1692
+ const v = serialTimeToTimestamp(Number(value), context.workbook.getDateSystem());
1693
+ const { start, end } = preComputingResult.value;
1694
+ return v >= start && v <= end;
1695
+ }
1696
+ case "average": {
1697
+ const value = cellValue && cellValue.v;
1698
+ const v = Number(value);
1699
+ const isNumber = (cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) === _cool_office_core.CellValueType.NUMBER;
1700
+ const subRuleConfig = ruleConfig;
1701
+ if (!isNumber) {
1702
+ if ("notEqual" === subRuleConfig.operator) return true;
1703
+ return false;
1704
+ }
1705
+ if (isNullable(value) || Number.isNaN(v) || !preComputingResult) return false;
1706
+ const average = preComputingResult.value;
1707
+ switch (subRuleConfig.operator) {
1708
+ case "greaterThan": return v > average;
1709
+ case "greaterThanOrEqual": return v >= average;
1710
+ case "lessThan": return v < average;
1711
+ case "lessThanOrEqual": return v <= average;
1712
+ case "equal": return isFloatsEqual(v, average);
1713
+ case "notEqual": return !isFloatsEqual(v, average);
1714
+ default: return false;
1715
+ }
1716
+ }
1717
+ case "rank": {
1718
+ const value = getCellValue(cellValue);
1719
+ const v = Number(value);
1720
+ if (isNullable(value) || Number.isNaN(v) || (cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) !== _cool_office_core.CellValueType.NUMBER || !preComputingResult) return false;
1721
+ const targetValue = preComputingResult.value;
1722
+ if (ruleConfig.isBottom) return v <= targetValue;
1723
+ else return v >= targetValue;
1724
+ }
1725
+ case "uniqueValues": {
1726
+ const value = getCellValue(cellValue);
1727
+ if (isNullable(value) || !preComputingResult) return false;
1728
+ return preComputingResult.value.get(value) === 1;
1729
+ }
1730
+ case "duplicateValues": {
1731
+ const value = getCellValue(cellValue);
1732
+ if (isNullable(value) || !preComputingResult) return false;
1733
+ const uniqueCacheValue = preComputingResult.value.get(value);
1734
+ return uniqueCacheValue && uniqueCacheValue !== 1;
1735
+ }
1736
+ case "formula": {
1737
+ const _ruleConfig = ruleConfig;
1738
+ const conditionalFormattingFormulaService = context.accessor.get(ConditionalFormattingFormulaService);
1739
+ const firstRange = sortRangesByTopLeft(context.rule.ranges)[0];
1740
+ const relativeRow = row - firstRange.startRow;
1741
+ const relativeCol = col - firstRange.startColumn;
1742
+ const formulaResult = conditionalFormattingFormulaService.getFormulaResultWithCoords(context.unitId, context.subUnitId, context.rule.cfId, _ruleConfig.value, relativeRow, relativeCol);
1743
+ if (formulaResult.status === _cool_office_engine_formula.FormulaResultStatus.SUCCESS && formulaResult.result !== void 0) return isFormulaResultMatched(formulaResult.result);
1744
+ const cache = preComputingResult === null || preComputingResult === void 0 ? void 0 : preComputingResult.value;
1745
+ if (cache) {
1746
+ const value = cache.getValue(relativeRow, relativeCol);
1747
+ return isFormulaResultMatched(value);
1748
+ }
1749
+ return false;
1750
+ }
1751
+ }
1752
+ };
1753
+ return !!run();
1754
+ }
1755
+ };
1756
+
1757
+ //#endregion
1758
+ //#region src/models/calculate-unit-v2/icon-set-calculate-unit.ts
1759
+ const getValue = (row, col, getCell) => {
1760
+ const cell = getCell(row, col);
1761
+ if (cell && cell.t === _cool_office_core.CellValueType.NUMBER) {
1762
+ const value = Number(cell.v);
1763
+ return Number.isNaN(value) ? null : value;
1764
+ }
1765
+ return null;
1766
+ };
1767
+ var IconSetCalculateUnit = class extends BaseCalculateUnit {
1768
+ preComputing(_row, _col, context) {
1769
+ const ruleConfig = context.rule.rule;
1770
+ const worksheet = context.worksheet;
1771
+ const matrix = new _cool_office_core.ObjectMatrix();
1772
+ if (!ruleConfig.config.every((e) => e.value.type === "num")) filterRange(context.rule.ranges, worksheet.getMaxRows() - 1, worksheet.getMaxColumns() - 1).forEach((range) => {
1773
+ _cool_office_core.Range.foreach(range, (row, col) => {
1774
+ const cell = context.getCellValue(row, col);
1775
+ const v = cell && cell.v;
1776
+ if (!isNullable(v) && (cell === null || cell === void 0 ? void 0 : cell.t) === _cool_office_core.CellValueType.NUMBER) {
1777
+ const _value = Number(v);
1778
+ !Number.isNaN(_value) && matrix.setValue(row, col, _value);
1779
+ }
1780
+ });
1781
+ });
1782
+ const splitValueResult = ruleConfig.config.map((v) => getValueByType(v.value, matrix, {
1783
+ ...context,
1784
+ cfId: context.rule.cfId
1785
+ }));
1786
+ if (!splitValueResult.some((item) => item.status !== _cool_office_engine_formula.FormulaResultStatus.SUCCESS)) {
1787
+ const splitValue = splitValueResult.map((item, index) => ({
1788
+ operator: ruleConfig.config[index].operator,
1789
+ value: Number(item.result) || 0
1790
+ })).reduce((result, cur, index, list) => {
1791
+ const item = ruleConfig.config[index];
1792
+ if (!index || index === list.length - 1) result.push({
1793
+ ...cur,
1794
+ iconId: item.iconId,
1795
+ iconType: item.iconType
1796
+ });
1797
+ else {
1798
+ const pre = list[index - 1];
1799
+ if (!compareWithNumber(pre, cur.value)) result.push({
1800
+ ...cur,
1801
+ iconId: item.iconId,
1802
+ iconType: item.iconType
1803
+ });
1804
+ }
1805
+ return result;
1806
+ }, []);
1807
+ this.setPreComputingCache(splitValue);
1808
+ this._preComputingStatus$.next("preComputingEnd");
1809
+ return;
1810
+ }
1811
+ this._preComputingStatus$.next("preComputing");
1812
+ }
1813
+ getCellResult(row, col, preComputingResult, context) {
1814
+ if (!preComputingResult) return null;
1815
+ const value = getValue(row, col, context.getCellValue);
1816
+ if (value === null) return;
1817
+ const ruleConfig = context.rule.rule;
1818
+ const isShowValue = ruleConfig.isShowValue === void 0 ? true : !!ruleConfig.isShowValue;
1819
+ for (let index = 0; index < preComputingResult.length; index++) {
1820
+ const item = preComputingResult[index];
1821
+ const start = { ...item };
1822
+ const end = { ...item };
1823
+ const { iconId, iconType } = item;
1824
+ if (index === 0) {
1825
+ if (compareWithNumber(item, value)) return {
1826
+ iconId,
1827
+ iconType,
1828
+ isShowValue
1829
+ };
1830
+ } else if (index === preComputingResult.length - 1) return {
1831
+ iconId,
1832
+ iconType,
1833
+ isShowValue
1834
+ };
1835
+ else {
1836
+ const pre = preComputingResult[index - 1];
1837
+ end.operator = getOppositeOperator(pre.operator);
1838
+ end.value = pre.value;
1839
+ if (compareWithNumber(start, value) && compareWithNumber(end, value)) return {
1840
+ iconId,
1841
+ iconType,
1842
+ isShowValue
1843
+ };
1844
+ }
1845
+ }
1846
+ }
1847
+ };
1848
+
1849
+ //#endregion
1850
+ //#region src/models/conditional-formatting-view-model.ts
1851
+ const CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH = 9e3;
1852
+ let ConditionalFormattingViewModel = class ConditionalFormattingViewModel extends _cool_office_core.Disposable {
1853
+ constructor(_injector, _conditionalFormattingRuleModel, _conditionalFormattingRangeIndexModel, _conditionalFormattingFormulaService, _univerInstanceService) {
1854
+ super();
1855
+ this._injector = _injector;
1856
+ this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
1857
+ this._conditionalFormattingRangeIndexModel = _conditionalFormattingRangeIndexModel;
1858
+ this._conditionalFormattingFormulaService = _conditionalFormattingFormulaService;
1859
+ this._univerInstanceService = _univerInstanceService;
1860
+ _defineProperty(this, "_calculateUnitManagers", /* @__PURE__ */ new Map());
1861
+ _defineProperty(this, "_cellCache", new _cool_office_core.LRUMap(CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH));
1862
+ _defineProperty(this, "_markDirty$", new rxjs.Subject());
1863
+ _defineProperty(this, "_cacheClear$", new rxjs.Subject());
1864
+ _defineProperty(this, "markDirty$", this._markDirty$.asObservable());
1865
+ _defineProperty(this, "cacheClear$", this._cacheClear$.asObservable());
1866
+ _defineProperty(this, "_markRuleDirtyAtOnce", (unitId, subUnitId, cfId, isNeedResetPreComputingCache = true) => {
1867
+ this._cellCache.clear();
1868
+ if (isNeedResetPreComputingCache) {
1869
+ const calculateUnit = this._ensureCalculateUnitManager(unitId, subUnitId).get(cfId);
1870
+ if (calculateUnit) calculateUnit.resetPreComputingCache();
1871
+ }
1872
+ this._markDirty$.next({
1873
+ unitId,
1874
+ subUnitId,
1875
+ cfId
1876
+ });
1877
+ });
1878
+ _defineProperty(this, "markRuleDirty", (() => {
1879
+ const rxItem = new rxjs.Subject();
1880
+ this.disposeWithMe(rxItem.pipe((0, rxjs_operators.bufferTime)(100), (0, rxjs_operators.filter)((e) => !!e.length), (0, rxjs_operators.map)((list) => {
1881
+ const set = /* @__PURE__ */ new Set();
1882
+ const result = [];
1883
+ list.forEach((item) => {
1884
+ const kye = `${item.unitId}_${item.subUnitId}_${item.cfId}`;
1885
+ if (set.has(kye)) {
1886
+ if (item.isNeedResetPreComputingCache) {
1887
+ const i = result.find((e) => e.cfId === item.cfId);
1888
+ i.isNeedResetPreComputingCache = true;
1889
+ }
1890
+ return;
1891
+ }
1892
+ set.add(kye);
1893
+ result.push({ ...item });
1894
+ });
1895
+ return result;
1896
+ })).subscribe((list) => {
1897
+ list.forEach((item) => {
1898
+ this._markRuleDirtyAtOnce(item.unitId, item.subUnitId, item.cfId, item.isNeedResetPreComputingCache);
1899
+ });
1900
+ }));
1901
+ return (unitId, subUnitId, cfId, isNeedResetPreComputingCache = true) => {
1902
+ rxItem.next({
1903
+ unitId,
1904
+ subUnitId,
1905
+ cfId,
1906
+ isNeedResetPreComputingCache
1907
+ });
1908
+ };
1909
+ })());
1910
+ this._initRuleListener();
1911
+ this._handleCustomFormulasSeparately();
1912
+ this._initCFFormulaListener();
1913
+ }
1914
+ _initCFFormulaListener() {
1915
+ this.disposeWithMe(this._conditionalFormattingFormulaService.result$.subscribe(({ unitId, subUnitId, cfId, isAllFinished }) => {
1916
+ if (isAllFinished) this._markRuleDirtyAtOnce(unitId, subUnitId, cfId, isAllFinished);
1917
+ }));
1918
+ }
1919
+ getCellCfs(unitId, subUnitId, row, col) {
1920
+ const key = this._createCacheKey(unitId, subUnitId, row, col);
1921
+ if (this._cellCache.has(key)) return this._cellCache.get(key);
1922
+ const result = this._getCellCfs(unitId, subUnitId, row, col);
1923
+ if (result.length) this._cellCache.set(key, result);
1924
+ return result;
1925
+ }
1926
+ _getCellCfs(unitId, subUnitId, row, col) {
1927
+ const subunitRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId) ?? [];
1928
+ const _calculateUnitManagers = this._ensureCalculateUnitManager(unitId, subUnitId);
1929
+ const list = this._conditionalFormattingRangeIndexModel.getRuleIdsByCell(unitId, subUnitId, row, col);
1930
+ const rules = subunitRules.filter((rule) => list.has(rule.cfId));
1931
+ if (!rules.length) return [];
1932
+ return rules.map((rule) => {
1933
+ const calculateUnit = _calculateUnitManagers.get(rule.cfId);
1934
+ if (!calculateUnit) return null;
1935
+ const result = calculateUnit.getCell(row, col);
1936
+ if (rule.rule.type === "highlightCell") {
1937
+ const matched = result === true;
1938
+ let style = result;
1939
+ if (result != null) style = matched ? rule.rule.style : {};
1940
+ return {
1941
+ cfId: rule.cfId,
1942
+ result: style,
1943
+ matched
1944
+ };
1945
+ }
1946
+ return {
1947
+ cfId: rule.cfId,
1948
+ result,
1949
+ matched: !!result
1950
+ };
1951
+ }).filter((e) => !!e).map((e, index) => ({
1952
+ ...e,
1953
+ priority: index
1954
+ }));
1955
+ }
1956
+ dispose() {
1957
+ this.clearCache();
1958
+ super.dispose();
1959
+ }
1960
+ clearCache() {
1961
+ this._calculateUnitManagers.clear();
1962
+ this._cellCache.clear();
1963
+ this._cacheClear$.next();
1964
+ }
1965
+ _handleCustomFormulasSeparately() {
1966
+ this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((e) => {
1967
+ if (e.type === "set") {
1968
+ const { unitId, subUnitId } = e;
1969
+ const oldRule = e.oldRule;
1970
+ if (oldRule.rule.type === "highlightCell" && oldRule.rule.subType === "formula") this._conditionalFormattingFormulaService.deleteCache(unitId, subUnitId, oldRule.cfId);
1971
+ }
1972
+ }));
1973
+ }
1974
+ _initRuleListener() {
1975
+ this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((e) => {
1976
+ const { unitId, subUnitId, rule } = e;
1977
+ const { cfId, ranges } = rule;
1978
+ const calculateUnitManager = this._ensureCalculateUnitManager(unitId, subUnitId);
1979
+ this.markRuleDirty(unitId, subUnitId, cfId);
1980
+ switch (e.type) {
1981
+ case "add": {
1982
+ const instance = this._createRuleCalculateUnitInstance(unitId, subUnitId, rule);
1983
+ if (!instance) return;
1984
+ calculateUnitManager.set(rule.cfId, instance);
1985
+ break;
1986
+ }
1987
+ case "delete":
1988
+ calculateUnitManager.delete(rule.cfId);
1989
+ break;
1990
+ case "set": {
1991
+ const oldRule = e.oldRule;
1992
+ if (oldRule.rule.type !== rule.rule.type) {
1993
+ const instance = this._createRuleCalculateUnitInstance(unitId, subUnitId, rule);
1994
+ if (!instance) return;
1995
+ calculateUnitManager.delete(oldRule.cfId);
1996
+ calculateUnitManager.set(rule.cfId, instance);
1997
+ } else {
1998
+ const instance = calculateUnitManager.get(oldRule.cfId);
1999
+ if (!instance) return;
2000
+ instance.updateRule(rule);
2001
+ }
2002
+ }
2003
+ }
2004
+ }));
2005
+ }
2006
+ _ensureCalculateUnitManager(unitId, subUnitId) {
2007
+ let unitMap = this._calculateUnitManagers.get(unitId);
2008
+ if (!unitMap) {
2009
+ unitMap = /* @__PURE__ */ new Map();
2010
+ this._calculateUnitManagers.set(unitId, unitMap);
2011
+ }
2012
+ let subUnitMap = unitMap.get(subUnitId);
2013
+ if (!subUnitMap) {
2014
+ subUnitMap = /* @__PURE__ */ new Map();
2015
+ unitMap.set(subUnitId, subUnitMap);
2016
+ }
2017
+ return subUnitMap;
2018
+ }
2019
+ _createRuleCalculateUnitInstance(unitId, subUnitId, rule) {
2020
+ const workbook = this._univerInstanceService.getUnit(unitId);
2021
+ const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
2022
+ if (!workbook || !worksheet) return;
2023
+ const context = {
2024
+ workbook,
2025
+ worksheet,
2026
+ unitId,
2027
+ subUnitId,
2028
+ accessor: this._injector,
2029
+ rule,
2030
+ limit: CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,
2031
+ getCellValue: (row, col) => worksheet.getCellRaw(row, col) || {}
2032
+ };
2033
+ switch (rule.rule.type) {
2034
+ case "colorScale": return new ColorScaleCalculateUnit(context);
2035
+ case "dataBar": return new DataBarCalculateUnit(context);
2036
+ case "highlightCell": return new HighlightCellCalculateUnit(context);
2037
+ case "iconSet": return new IconSetCalculateUnit(context);
2038
+ }
2039
+ }
2040
+ _createCacheKey(unitId, subUnitId, row, col) {
2041
+ return `${unitId}_${subUnitId}_${row}_${col}`;
2042
+ }
2043
+ setCacheLength(length = CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH) {
2044
+ if (this._cellCache.limit === length) return;
2045
+ this._cellCache.limit = length;
2046
+ this._calculateUnitManagers.forEach((subunitMap) => {
2047
+ subunitMap.forEach((unitMap) => {
2048
+ unitMap.forEach((unit) => {
2049
+ unit.setCacheLength(length);
2050
+ });
2051
+ });
2052
+ });
2053
+ }
2054
+ };
2055
+ ConditionalFormattingViewModel = __decorate([
2056
+ __decorateParam(0, (0, _cool_office_core.Inject)(_cool_office_core.Injector)),
2057
+ __decorateParam(1, (0, _cool_office_core.Inject)(ConditionalFormattingRuleModel)),
2058
+ __decorateParam(2, (0, _cool_office_core.Inject)(ConditionalFormattingRangeIndexModel)),
2059
+ __decorateParam(3, (0, _cool_office_core.Inject)(ConditionalFormattingFormulaService)),
2060
+ __decorateParam(4, _cool_office_core.IUniverInstanceService)
2061
+ ], ConditionalFormattingViewModel);
2062
+
2063
+ //#endregion
2064
+ //#region src/models/calculate-unit-v2/utils.ts
2065
+ function isFloatsEqual(a, b) {
2066
+ return Math.abs(a - b) < Number.EPSILON;
2067
+ }
2068
+ const isNullable = (v) => v === null || v === void 0 || typeof v === "string" && v.trim() === "";
2069
+ const getCellValue = (cell) => {
2070
+ var _cell$p;
2071
+ if (!cell) return null;
2072
+ if (cell.t === _cool_office_core.CellValueType.BOOLEAN) return cell.v === _cool_office_core.BooleanNumber.TRUE ? _cool_office_engine_formula.BooleanValue.TRUE : _cool_office_engine_formula.BooleanValue.FALSE;
2073
+ const v = cell.v;
2074
+ const dataStream = (_cell$p = cell.p) === null || _cell$p === void 0 || (_cell$p = _cell$p.body) === null || _cell$p === void 0 ? void 0 : _cell$p.dataStream.replace(/\r\n$/, "");
2075
+ return !isNullable(v) ? v : !isNullable(dataStream) ? dataStream : null;
2076
+ };
2077
+ const serialTimeToTimestamp = (value, dateSystem = _cool_office_core.DateSystem.Date1900) => {
2078
+ const utcDate = (0, _cool_office_core.excelSerialToDateTime)(value, dateSystem);
2079
+ if (Number.isNaN(utcDate.getTime())) return NaN;
2080
+ return new Date(utcDate.getUTCFullYear(), utcDate.getUTCMonth(), utcDate.getUTCDate(), utcDate.getUTCHours(), utcDate.getUTCMinutes(), utcDate.getUTCSeconds(), utcDate.getUTCMilliseconds()).getTime();
2081
+ };
2082
+ const getValueByType = (value, matrix, context) => {
2083
+ switch (value.type) {
2084
+ case "max": {
2085
+ let max = 0;
2086
+ matrix.forValue((row, col, value) => {
2087
+ if (value > max) max = value;
2088
+ });
2089
+ return {
2090
+ status: _cool_office_engine_formula.FormulaResultStatus.SUCCESS,
2091
+ result: max
2092
+ };
2093
+ }
2094
+ case "min": {
2095
+ let min;
2096
+ matrix.forValue((row, col, value) => {
2097
+ if (min === void 0) min = value;
2098
+ if (value < min) min = value;
2099
+ });
2100
+ return {
2101
+ status: _cool_office_engine_formula.FormulaResultStatus.SUCCESS,
2102
+ result: min
2103
+ };
2104
+ }
2105
+ case "percent": {
2106
+ let max;
2107
+ let min;
2108
+ matrix.forValue((row, col, value) => {
2109
+ if (max === void 0 || min === void 0) {
2110
+ max = value;
2111
+ min = value;
2112
+ }
2113
+ if (value > max) max = value;
2114
+ if (value < min) min = value;
2115
+ });
2116
+ const length = (max || 0) - (min || 0);
2117
+ const v = Math.max(Math.min(Number(value.value) || 0, 100), 0);
2118
+ return {
2119
+ status: _cool_office_engine_formula.FormulaResultStatus.SUCCESS,
2120
+ result: length * (v / 100) + (min || 0)
2121
+ };
2122
+ }
2123
+ case "percentile": {
2124
+ const list = matrix.toNativeArray().sort((a, b) => a - b);
2125
+ const v = Math.max(Math.min(Number(value.value) || 0, 100), 0);
2126
+ const index = (list.length - 1) * v / 100;
2127
+ const intIndex = Math.floor(index);
2128
+ const decimalIndex = index - intIndex;
2129
+ const result = list[intIndex] + (list[Math.min(intIndex + 1, list.length - 1)] - list[intIndex]) * decimalIndex;
2130
+ return {
2131
+ status: _cool_office_engine_formula.FormulaResultStatus.SUCCESS,
2132
+ result
2133
+ };
2134
+ }
2135
+ case "formula": {
2136
+ const { accessor, unitId, subUnitId, cfId } = context;
2137
+ const formulaText = String(value.value);
2138
+ const conditionalFormattingFormulaService = accessor.get(ConditionalFormattingFormulaService);
2139
+ conditionalFormattingFormulaService.registerFormulaWithRange(unitId, subUnitId, cfId, formulaText);
2140
+ return conditionalFormattingFormulaService.getFormulaResultWithCoords(unitId, subUnitId, cfId, formulaText);
2141
+ }
2142
+ case "num":
2143
+ default: {
2144
+ const v = Number(value.value);
2145
+ return {
2146
+ status: _cool_office_engine_formula.FormulaResultStatus.SUCCESS,
2147
+ result: Number.isNaN(v) ? 0 : v
2148
+ };
2149
+ }
2150
+ }
2151
+ };
2152
+ const getCacheStyleMatrix = (unitId, subUnitId, rule, context) => {
2153
+ const { accessor } = context;
2154
+ const conditionalFormattingViewModel = accessor.get(ConditionalFormattingViewModel);
2155
+ const matrix = new _cool_office_core.ObjectMatrix();
2156
+ getRangesInWorksheet(rule.ranges, context.worksheet).forEach((range) => {
2157
+ _cool_office_core.Range.foreach(range, (row, col) => {
2158
+ const cellCfItem = conditionalFormattingViewModel.getCellCfs(unitId, subUnitId, row, col);
2159
+ if (cellCfItem) {
2160
+ const item = cellCfItem.find((item) => item.cfId === rule.cfId);
2161
+ item !== null && item !== void 0 && item.result && matrix.setValue(row, col, item.result);
2162
+ }
2163
+ });
2164
+ });
2165
+ return matrix;
2166
+ };
2167
+ const compareWithNumber = (config, v) => {
2168
+ switch (config.operator) {
2169
+ case "between": {
2170
+ if (typeof config.value !== "object" || !config.value.length) return;
2171
+ const start = Math.min(...config.value);
2172
+ const end = Math.max(...config.value);
2173
+ return v >= start && v <= end;
2174
+ }
2175
+ case "notBetween": {
2176
+ if (typeof config.value !== "object" || !config.value.length) return;
2177
+ const start = Math.min(...config.value);
2178
+ const end = Math.max(...config.value);
2179
+ return !(v >= start && v <= end);
2180
+ }
2181
+ case "equal": return isFloatsEqual(config.value || 0, v);
2182
+ case "notEqual": return !isFloatsEqual(config.value || 0, v);
2183
+ case "greaterThan": return v > (config.value || 0);
2184
+ case "greaterThanOrEqual": return v >= (config.value || 0);
2185
+ case "lessThan": return v < (config.value || 0);
2186
+ case "lessThanOrEqual": return v <= (config.value || 0);
2187
+ default: return false;
2188
+ }
2189
+ };
2190
+ const getOppositeOperator = (operator) => {
2191
+ switch (operator) {
2192
+ case "greaterThan": return "lessThanOrEqual";
2193
+ case "greaterThanOrEqual": return "lessThan";
2194
+ case "lessThan": return "greaterThanOrEqual";
2195
+ case "lessThanOrEqual": return "greaterThan";
2196
+ }
2197
+ return operator;
2198
+ };
2199
+ const getColorScaleFromValue = (colorList, value) => {
2200
+ const prefixRgba = (rgb) => {
2201
+ if (rgb.a !== void 0) return rgb;
2202
+ else return {
2203
+ ...rgb,
2204
+ a: 1
2205
+ };
2206
+ };
2207
+ const index = colorList.findIndex((item) => item.value >= value);
2208
+ const preIndex = index - 1;
2209
+ if (index === 0) return colorList[0].color.toRgbString();
2210
+ else if (preIndex >= 0) {
2211
+ const minItem = colorList[preIndex];
2212
+ const maxItem = colorList[index];
2213
+ if (minItem.color.isValid && maxItem.color.isValid) {
2214
+ const minRgb = prefixRgba(minItem.color.toRgb());
2215
+ const maxRgb = prefixRgba(maxItem.color.toRgb());
2216
+ const length = maxItem.value - minItem.value;
2217
+ const v = (value - minItem.value) / length;
2218
+ const rgbResult = [
2219
+ "r",
2220
+ "g",
2221
+ "b",
2222
+ "a"
2223
+ ].reduce((obj, key) => {
2224
+ const minV = minRgb[key];
2225
+ obj[key] = (maxRgb[key] - minV) * v + minV;
2226
+ return obj;
2227
+ }, {});
2228
+ return new _cool_office_core.ColorKit(rgbResult).toRgbString();
2229
+ }
2230
+ } else return colorList[colorList.length - 1].color.toRgbString();
2231
+ };
2232
+ const filterRange = (ranges, maxRow, maxCol) => {
2233
+ return ranges.map((range) => {
2234
+ if (range.startColumn > maxCol || range.startRow > maxRow || range.endColumn < 0 || range.endRow < 0) return null;
2235
+ const _range = { ...range };
2236
+ _range.startRow = Math.max(_range.startRow, 0);
2237
+ _range.startColumn = Math.max(_range.startColumn, 0);
2238
+ _range.endRow = Math.min(_range.endRow, maxRow);
2239
+ _range.endColumn = Math.min(_range.endColumn, maxCol);
2240
+ if (_range.startRow > _range.endRow || _range.startColumn > _range.endColumn) return null;
2241
+ return _range;
2242
+ }).filter((range) => !!range);
2243
+ };
2244
+ function getMaxInFormulaResult(result) {
2245
+ let max = 0;
2246
+ new _cool_office_core.ObjectMatrix(result).forValue((row, col, value) => {
2247
+ max = Math.max(Number.isNaN(max) ? 0 : max, Number(value));
2248
+ });
2249
+ return max;
2250
+ }
2251
+
2252
+ //#endregion
2253
+ //#region src/assets/icon-map.ts
2254
+ const ICON_MAP = {
2255
+ "feedback": {
2256
+ "mistake": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%227%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3Cpath%20d%3D%22M5.69014%205.69014C5.45583%205.92445%205.45583%206.30435%205.69014%206.53867L7.15137%207.9999L5.6899%209.46137C5.45558%209.69569%205.45558%2010.0756%205.6899%2010.3099C5.92421%2010.5442%206.30411%2010.5442%206.53842%2010.3099L7.9999%208.84843L9.46137%2010.3099C9.69569%2010.5442%2010.0756%2010.5442%2010.3099%2010.3099C10.5442%2010.0756%2010.5442%209.69569%2010.3099%209.46137L8.84843%207.9999L10.3097%206.53867C10.544%206.30435%2010.544%205.92445%2010.3097%205.69014C10.0753%205.45583%209.69544%205.45583%209.46113%205.69014L7.9999%207.15137L6.53867%205.69014C6.30435%205.45583%205.92445%205.45583%205.69014%205.69014Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2257
+ "warn": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%227%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Cpath%20d%3D%22M7.4%204.4335C7.4%204.10213%207.66863%203.8335%208%203.8335C8.33137%203.8335%208.6%204.10213%208.6%204.4335V9.36683C8.6%209.6982%208.33137%209.96683%208%209.96683C7.66863%209.96683%207.4%209.6982%207.4%209.36683V4.4335Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%2211.5338%22%20r%3D%220.83333%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2258
+ "correct": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%227%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3Cpath%20d%3D%22M11.7245%205.57564C11.4901%205.34132%2011.1102%205.34132%2010.8759%205.57564L7.3002%209.15137L5.72446%207.57564C5.49014%207.34132%205.11025%207.34132%204.87593%207.57564C4.64162%207.80995%204.64162%208.18985%204.87593%208.42417L6.87593%2010.4242C7.11025%2010.6585%207.49014%2010.6585%207.72446%2010.4242L11.7245%206.42417C11.9588%206.18985%2011.9588%205.80995%2011.7245%205.57564Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A"
2259
+ },
2260
+ "star": {
2261
+ "starEmpty": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M8%201.8L9.73075%205.30631L13.6%205.86863L10.8%208.59897L11.4615%2012.4526L8%2010.632L4.53853%2012.4526L5.2%208.59897L2.4%205.86863L6.26927%205.30631L8%201.8Z%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2262
+ "starIncomplete": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M8%201.8L9.73075%205.30631L13.6%205.86863L10.8%208.59897L11.4615%2012.4526L8%2010.632L4.53853%2012.4526L5.2%208.59897L2.4%205.86863L6.26927%205.30631L8%201.8Z%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Cmask%20id%3D%22star-incomplete-mask%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%220%22%20y%3D%220%22%20width%3D%228%22%20height%3D%2216%22%3E%0A%3Crect%20width%3D%228%22%20height%3D%2216%22%20fill%3D%22white%22%2F%3E%0A%3C%2Fmask%3E%0A%3Cg%20mask%3D%22url(%23star-incomplete-mask)%22%3E%0A%3Cpath%20d%3D%22M8%201.8L9.73075%205.30631L13.6%205.86863L10.8%208.59897L11.4615%2012.4526L8%2010.632L4.53853%2012.4526L5.2%208.59897L2.4%205.86863L6.26927%205.30631L8%201.8Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",
2263
+ "starFull": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M8%201.8L9.73075%205.30631L13.6%205.86863L10.8%208.59897L11.4615%2012.4526L8%2010.632L4.53853%2012.4526L5.2%208.59897L2.4%205.86863L6.26927%205.30631L8%201.8Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A"
2264
+ },
2265
+ "progress": {
2266
+ "progress0": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.75%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2267
+ "progress25": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Cpath%20d%3D%22M8%201.5C11.5899%201.5%2014.5%204.41015%2014.5%208H8V1.5Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.75%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2268
+ "progress50": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Cpath%20d%3D%22M8%201.5C11.5899%201.5%2014.5%204.41015%2014.5%208C14.5%2011.5899%2011.5899%2014.5%208%2014.5V1.5Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.75%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2269
+ "progress75": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Cpath%20d%3D%22M8%201.5C11.5899%201.5%2014.5%204.41015%2014.5%208C14.5%2011.5899%2011.5899%2014.5%208%2014.5C4.41015%2014.5%201.5%2011.5899%201.5%208H8V1.5Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.75%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2270
+ "progress100": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.75%22%2F%3E%0A%3C%2Fsvg%3E%0A"
2271
+ },
2272
+ "signal": {
2273
+ "signal0": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%221.6%22%20y%3D%2211%22%20width%3D%221.8%22%20height%3D%223%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%225.6%22%20y%3D%228%22%20width%3D%221.8%22%20height%3D%226%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%229.6%22%20y%3D%225%22%20width%3D%221.8%22%20height%3D%229%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2213.6%22%20y%3D%222%22%20width%3D%221.8%22%20height%3D%2212%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2274
+ "signal25": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%221.6%22%20y%3D%2211%22%20width%3D%221.8%22%20height%3D%223%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%225.6%22%20y%3D%228%22%20width%3D%221.8%22%20height%3D%226%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%229.6%22%20y%3D%225%22%20width%3D%221.8%22%20height%3D%229%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2213.6%22%20y%3D%222%22%20width%3D%221.8%22%20height%3D%2212%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2275
+ "signal50": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%221.6%22%20y%3D%2211%22%20width%3D%221.8%22%20height%3D%223%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%225.6%22%20y%3D%228%22%20width%3D%221.8%22%20height%3D%226%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%229.6%22%20y%3D%225%22%20width%3D%221.8%22%20height%3D%229%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2213.6%22%20y%3D%222%22%20width%3D%221.8%22%20height%3D%2212%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2276
+ "signal75": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%221.6%22%20y%3D%2211%22%20width%3D%221.8%22%20height%3D%223%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%225.6%22%20y%3D%228%22%20width%3D%221.8%22%20height%3D%226%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%229.6%22%20y%3D%225%22%20width%3D%221.8%22%20height%3D%229%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%2213.6%22%20y%3D%222%22%20width%3D%221.8%22%20height%3D%2212%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2277
+ "signal100": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%221.6%22%20y%3D%2211%22%20width%3D%221.8%22%20height%3D%223%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%225.6%22%20y%3D%228%22%20width%3D%221.8%22%20height%3D%226%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%229.6%22%20y%3D%225%22%20width%3D%221.8%22%20height%3D%229%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%2213.6%22%20y%3D%222%22%20width%3D%221.8%22%20height%3D%2212%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A"
2278
+ },
2279
+ "feeling": {
2280
+ "guffaw": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.4%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%2F%3E%0A%3Ccircle%20cx%3D%225.75%22%20cy%3D%226.3%22%20r%3D%220.75%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Ccircle%20cx%3D%2210.25%22%20cy%3D%226.3%22%20r%3D%220.75%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M4.8%209.15C5.25%2011.25%206.5%2012.55%208%2012.55C9.5%2012.55%2010.75%2011.25%2011.2%209.15H4.8Z%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2281
+ "smile": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.4%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%2F%3E%0A%3Ccircle%20cx%3D%225.75%22%20cy%3D%226.3%22%20r%3D%220.75%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Ccircle%20cx%3D%2210.25%22%20cy%3D%226.3%22%20r%3D%220.75%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M5%209.3C5.65%2010.65%206.65%2011.35%208%2011.35C9.35%2011.35%2010.35%2010.65%2011%209.3%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2282
+ "noninductive": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.4%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%2F%3E%0A%3Crect%20x%3D%225%22%20y%3D%225.85%22%20width%3D%221.5%22%20height%3D%221.1%22%20rx%3D%220.55%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%229.5%22%20y%3D%225.85%22%20width%3D%221.5%22%20height%3D%221.1%22%20rx%3D%220.55%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M5.2%2010.4H10.8%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2283
+ "dissatisfied": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.4%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%2F%3E%0A%3Ccircle%20cx%3D%225.75%22%20cy%3D%226.3%22%20r%3D%220.75%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Ccircle%20cx%3D%2210.25%22%20cy%3D%226.3%22%20r%3D%220.75%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M5%2011C5.65%209.65%206.65%208.95%208%208.95C9.35%208.95%2010.35%209.65%2011%2011%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2284
+ "impatient": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.4%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%2F%3E%0A%3Cpath%20d%3D%22M4.9%205.4L6.7%206.15%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3Cpath%20d%3D%22M11.1%205.4L9.3%206.15%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3Ccircle%20cx%3D%225.75%22%20cy%3D%227.2%22%20r%3D%220.65%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Ccircle%20cx%3D%2210.25%22%20cy%3D%227.2%22%20r%3D%220.65%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M5%2011.25C5.7%2010.05%206.7%209.45%208%209.45C9.3%209.45%2010.3%2010.05%2011%2011.25%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A"
2285
+ },
2286
+ "arrow": {
2287
+ "down-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.90467%203.99244C8.84611%204.1338%208.84611%204.31301%208.84611%204.67143V13.716L5.92068%2010.7906C5.66724%2010.5371%205.54052%2010.4104%205.39916%2010.3519C5.21067%2010.2738%204.9989%2010.2738%204.81041%2010.3519C4.66905%2010.4104%204.54233%2010.5371%204.28889%2010.7906C4.03545%2011.044%203.90873%2011.1707%203.85018%2011.3121C3.77211%2011.5006%203.77211%2011.7124%203.85018%2011.9008C3.90873%2012.0422%204.03545%2012.1689%204.28889%2012.4224L9.03476%2017.1682C9.07839%2017.2127%209.12737%2017.2617%209.18231%2017.3166L9.18239%2017.3167L9.18241%2017.3167C9.40545%2017.5398%209.53035%2017.6647%209.65346%2017.7313C9.67085%2017.7408%209.6882%2017.7492%209.70577%2017.7564C9.89425%2017.8345%2010.106%2017.8345%2010.2945%2017.7564C10.4359%2017.6979%2010.5626%2017.5712%2010.816%2017.3177C10.8986%2017.2352%2010.9677%2017.1661%2011.0253%2017.1056L15.7095%2012.4214L15.7095%2012.4213C15.963%2012.1679%2016.0897%2012.0412%2016.1482%2011.8998C16.2263%2011.7114%2016.2263%2011.4996%2016.1482%2011.3111C16.0897%2011.1697%2015.963%2011.043%2015.7095%2010.7896C15.4561%2010.5361%2015.3294%2010.4094%2015.188%2010.3509C14.9995%2010.2728%2014.7878%2010.2728%2014.5993%2010.3509C14.4579%2010.4094%2014.3312%2010.5361%2014.0778%2010.7896L14.0777%2010.7896L11.1538%2013.7135V4.67142C11.1538%204.31301%2011.1538%204.1338%2011.0953%203.99244C11.0172%203.80395%2010.8674%203.6542%2010.6789%203.57613C10.5376%203.51758%2010.3584%203.51758%209.99996%203.51758C9.64154%203.51758%209.46233%203.51758%209.32097%203.57613C9.13249%203.6542%208.98274%203.80395%208.90467%203.99244Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2288
+ "right-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.32508%2011.7609C3.46644%2011.8194%203.64565%2011.8194%204.00407%2011.8194H13.049L10.1235%2014.745C9.87002%2014.9984%209.7433%2015.1251%209.68475%2015.2665C9.60668%2015.455%209.60668%2015.6668%209.68475%2015.8552C9.7433%2015.9966%209.87002%2016.1233%2010.1235%2016.3768C10.3769%2016.6302%2010.5036%2016.7569%2010.645%2016.8155C10.8335%2016.8935%2011.0452%2016.8935%2011.2337%2016.8155C11.3751%2016.7569%2011.5018%2016.6302%2011.7552%2016.3768L16.5105%2011.6215C16.5524%2011.5803%2016.5983%2011.5344%2016.6493%2011.4834L16.6495%2011.4831C16.8561%2011.2765%2016.9785%2011.1542%2017.0484%2011.0394C17.0648%2011.0128%2017.0782%2010.9866%2017.0893%2010.9599C17.1674%2010.7714%2017.1674%2010.5596%2017.0893%2010.3711C17.0308%2010.2298%2016.904%2010.1031%2016.6506%209.84962C16.5685%209.76752%2016.4997%209.69872%2016.4394%209.64123L11.7542%204.95601C11.5007%204.70257%2011.374%204.57585%2011.2327%204.5173C11.0442%204.43923%2010.8324%204.43923%2010.6439%204.5173C10.5026%204.57585%2010.3758%204.70257%2010.1224%204.95601L10.1224%204.95601C9.86895%205.20945%209.74223%205.33617%209.68368%205.47753C9.60561%205.66601%209.60561%205.87779%209.68368%206.06627C9.74223%206.20764%209.86895%206.33436%2010.1224%206.5878L13.0463%209.51175H4.00407C3.64565%209.51175%203.46644%209.51175%203.32508%209.5703C3.1366%209.64837%202.98685%209.79812%202.90877%209.98661C2.85022%2010.128%202.85022%2010.3072%202.85022%2010.6656C2.85022%2011.024%202.85022%2011.2032%202.90877%2011.3446C2.98685%2011.5331%203.1366%2011.6828%203.32508%2011.7609Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2289
+ "up-green": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.0936%2017.3406C11.1522%2017.1992%2011.1522%2017.02%2011.1522%2016.6616V7.61701L14.0776%2010.5424C14.3311%2010.7959%2014.4578%2010.9226%2014.5991%2010.9811C14.7876%2011.0592%2014.9994%2011.0592%2015.1879%2010.9811C15.3292%2010.9226%2015.456%2010.7959%2015.7094%2010.5424C15.9628%2010.289%2016.0896%2010.1623%2016.1481%2010.0209C16.2262%209.83243%2016.2262%209.62066%2016.1481%209.43217C16.0896%209.29081%2015.9628%209.16409%2015.7094%208.91065L10.9645%204.16576C10.9207%204.12105%2010.8714%204.07178%2010.8161%204.01648L10.8159%204.0163C10.5916%203.792%2010.4666%203.66696%2010.3428%203.60058C10.3261%203.59154%2010.3094%203.58358%2010.2925%203.57658C10.104%203.49851%209.89226%203.49851%209.70378%203.57658C9.56242%203.63514%209.4357%203.76186%209.18226%204.0153C9.09955%204.09801%209.03034%204.16722%208.97258%204.22785L4.28878%208.91166C4.03534%209.1651%203.90862%209.29182%203.85006%209.43318C3.77199%209.62166%203.77199%209.83344%203.85006%2010.0219C3.90862%2010.1633%204.03534%2010.29%204.28878%2010.5434C4.54221%2010.7969%204.66893%2010.9236%204.8103%2010.9822C4.99878%2011.0602%205.21056%2011.0602%205.39904%2010.9822C5.5404%2010.9236%205.66712%2010.7969%205.92056%2010.5434L5.92056%2010.5434L8.84449%207.61951V16.6616C8.84449%2017.02%208.84449%2017.1992%208.90305%2017.3406C8.98112%2017.5291%209.13087%2017.6788%209.31935%2017.7569C9.46072%2017.8154%209.63992%2017.8154%209.99834%2017.8154C10.3568%2017.8154%2010.536%2017.8154%2010.6773%2017.7569C10.8658%2017.6788%2011.0156%2017.5291%2011.0936%2017.3406Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2290
+ "rightAndDown-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.5062%206.72126C4.56476%206.86262%204.69148%206.98934%204.94492%207.24278L11.3404%2013.6382L7.20313%2013.6382C6.84471%2013.6382%206.66551%2013.6382%206.52414%2013.6968C6.33566%2013.7749%206.18591%2013.9246%206.10784%2014.1131C6.04928%2014.2545%206.04928%2014.4337%206.04928%2014.7921C6.04928%2015.1505%206.04928%2015.3297%206.10784%2015.4711C6.18591%2015.6596%206.33566%2015.8093%206.52414%2015.8874C6.66551%2015.9459%206.84471%2015.9459%207.20313%2015.9459L13.9194%2015.9459C13.9805%2015.9465%2014.0484%2015.9465%2014.1243%2015.9465H14.1243C14.4353%2015.9465%2014.6114%2015.9465%2014.7449%2015.9082C14.7659%2015.9023%2014.7859%2015.8954%2014.8052%2015.8874C14.9937%2015.8093%2015.1434%2015.6596%2015.2215%2015.4711C15.2801%2015.3297%2015.2801%2015.1505%2015.2801%2014.7921C15.2801%2014.6767%2015.2801%2014.5799%2015.2781%2014.497L15.2781%207.86957C15.2781%207.51115%2015.2781%207.33194%2015.2195%207.19058C15.1415%207.0021%2014.9917%206.85235%2014.8032%206.77428C14.6619%206.71572%2014.4827%206.71572%2014.1243%206.71572C13.7658%206.71572%2013.5866%206.71572%2013.4453%206.77428C13.2568%206.85235%2013.107%207.0021%2013.029%207.19058C12.9704%207.33194%2012.9704%207.51115%2012.9704%207.86957L12.9704%2012.0047L6.5767%205.61099C6.32326%205.35755%206.19654%205.23083%206.05518%205.17228C5.8667%205.09421%205.65492%205.09421%205.46644%205.17228C5.32508%205.23083%205.19836%205.35755%204.94492%205.61099C4.69148%205.86443%204.56476%205.99115%204.5062%206.13251C4.42813%206.32099%204.42813%206.53277%204.5062%206.72126Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2291
+ "rightAndUp-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.05431%2016.1597C6.19567%2016.1012%206.32239%2015.9745%206.57583%2015.721L12.9712%209.32568L12.9712%2013.4626C12.9712%2013.821%2012.9712%2014.0002%2013.0297%2014.1416C13.1078%2014.3301%2013.2576%2014.4798%2013.446%2014.5579C13.5874%2014.6164%2013.7666%2014.6164%2014.125%2014.6164C14.4834%2014.6164%2014.6626%2014.6164%2014.804%2014.5579C14.9925%2014.4798%2015.1422%2014.3301%2015.2203%2014.1416C15.2789%2014.0002%2015.2789%2013.821%2015.2789%2013.4626L15.2789%206.75233C15.2795%206.68972%2015.2795%206.62004%2015.2795%206.54182L15.2795%206.54157C15.2795%206.22585%2015.2795%206.04918%2015.2395%205.91495C15.2339%205.89605%2015.2276%205.878%2015.2203%205.86053C15.1422%205.67204%2014.9925%205.52229%2014.804%205.44422C14.6626%205.38567%2014.4834%205.38567%2014.125%205.38567L14.125%205.38567C14.0075%205.38567%2013.9093%205.38567%2013.8254%205.38773L7.20256%205.38773C6.84414%205.38773%206.66493%205.38773%206.52357%205.44628C6.33509%205.52436%206.18534%205.6741%206.10727%205.86259C6.04871%206.00395%206.04871%206.18315%206.04871%206.54156V6.54157L6.04871%206.54159C6.04871%206.9%206.04871%207.0792%206.10727%207.22056C6.18534%207.40905%206.33509%207.55879%206.52357%207.63687C6.66493%207.69542%206.84414%207.69542%207.20256%207.69542H11.3379L4.94405%2014.0892C4.69061%2014.3427%204.56389%2014.4694%204.50533%2014.6108C4.42726%2014.7992%204.42726%2015.011%204.50533%2015.1995C4.56389%2015.3409%204.69061%2015.4676%204.94405%2015.721C5.19749%2015.9745%205.32421%2016.1012%205.46557%2016.1597C5.65405%2016.2378%205.86583%2016.2378%206.05431%2016.1597Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2292
+ "down-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.90467%203.99244C8.84611%204.1338%208.84611%204.31301%208.84611%204.67143V13.716L5.92068%2010.7906C5.66724%2010.5371%205.54052%2010.4104%205.39916%2010.3519C5.21067%2010.2738%204.9989%2010.2738%204.81041%2010.3519C4.66905%2010.4104%204.54233%2010.5371%204.28889%2010.7906C4.03545%2011.044%203.90873%2011.1707%203.85018%2011.3121C3.77211%2011.5006%203.77211%2011.7124%203.85018%2011.9008C3.90873%2012.0422%204.03545%2012.1689%204.28889%2012.4224L9.03476%2017.1682C9.07839%2017.2127%209.12737%2017.2617%209.18231%2017.3166L9.18239%2017.3167L9.18241%2017.3167C9.40545%2017.5398%209.53035%2017.6647%209.65346%2017.7313C9.67085%2017.7408%209.6882%2017.7492%209.70577%2017.7564C9.89425%2017.8345%2010.106%2017.8345%2010.2945%2017.7564C10.4359%2017.6979%2010.5626%2017.5712%2010.816%2017.3177C10.8986%2017.2352%2010.9677%2017.1661%2011.0253%2017.1056L15.7095%2012.4214L15.7095%2012.4213C15.963%2012.1679%2016.0897%2012.0412%2016.1482%2011.8998C16.2263%2011.7114%2016.2263%2011.4996%2016.1482%2011.3111C16.0897%2011.1697%2015.963%2011.043%2015.7095%2010.7896C15.4561%2010.5361%2015.3294%2010.4094%2015.188%2010.3509C14.9995%2010.2728%2014.7878%2010.2728%2014.5993%2010.3509C14.4579%2010.4094%2014.3312%2010.5361%2014.0778%2010.7896L14.0777%2010.7896L11.1538%2013.7135V4.67142C11.1538%204.31301%2011.1538%204.1338%2011.0953%203.99244C11.0172%203.80395%2010.8674%203.6542%2010.6789%203.57613C10.5376%203.51758%2010.3584%203.51758%209.99996%203.51758C9.64154%203.51758%209.46233%203.51758%209.32097%203.57613C9.13249%203.6542%208.98274%203.80395%208.90467%203.99244Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2293
+ "right-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.32508%2011.7609C3.46644%2011.8194%203.64565%2011.8194%204.00407%2011.8194H13.049L10.1235%2014.745C9.87002%2014.9984%209.7433%2015.1251%209.68475%2015.2665C9.60668%2015.455%209.60668%2015.6668%209.68475%2015.8552C9.7433%2015.9966%209.87002%2016.1233%2010.1235%2016.3768C10.3769%2016.6302%2010.5036%2016.7569%2010.645%2016.8155C10.8335%2016.8935%2011.0452%2016.8935%2011.2337%2016.8155C11.3751%2016.7569%2011.5018%2016.6302%2011.7552%2016.3768L16.5105%2011.6215C16.5524%2011.5803%2016.5983%2011.5344%2016.6493%2011.4834L16.6495%2011.4831C16.8561%2011.2765%2016.9785%2011.1542%2017.0484%2011.0394C17.0648%2011.0128%2017.0782%2010.9866%2017.0893%2010.9599C17.1674%2010.7714%2017.1674%2010.5596%2017.0893%2010.3711C17.0308%2010.2298%2016.904%2010.1031%2016.6506%209.84962C16.5685%209.76752%2016.4997%209.69872%2016.4394%209.64123L11.7542%204.95601C11.5007%204.70257%2011.374%204.57585%2011.2327%204.5173C11.0442%204.43923%2010.8324%204.43923%2010.6439%204.5173C10.5026%204.57585%2010.3758%204.70257%2010.1224%204.95601L10.1224%204.95601C9.86895%205.20945%209.74223%205.33617%209.68368%205.47753C9.60561%205.66601%209.60561%205.87779%209.68368%206.06627C9.74223%206.20764%209.86895%206.33436%2010.1224%206.5878L13.0463%209.51175H4.00407C3.64565%209.51175%203.46644%209.51175%203.32508%209.5703C3.1366%209.64837%202.98685%209.79812%202.90877%209.98661C2.85022%2010.128%202.85022%2010.3072%202.85022%2010.6656C2.85022%2011.024%202.85022%2011.2032%202.90877%2011.3446C2.98685%2011.5331%203.1366%2011.6828%203.32508%2011.7609Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2294
+ "up-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.0936%2017.3406C11.1522%2017.1992%2011.1522%2017.02%2011.1522%2016.6616V7.61701L14.0776%2010.5424C14.3311%2010.7959%2014.4578%2010.9226%2014.5991%2010.9811C14.7876%2011.0592%2014.9994%2011.0592%2015.1879%2010.9811C15.3292%2010.9226%2015.456%2010.7959%2015.7094%2010.5424C15.9628%2010.289%2016.0896%2010.1623%2016.1481%2010.0209C16.2262%209.83243%2016.2262%209.62066%2016.1481%209.43217C16.0896%209.29081%2015.9628%209.16409%2015.7094%208.91065L10.9645%204.16576C10.9207%204.12105%2010.8714%204.07178%2010.8161%204.01648L10.8159%204.0163C10.5916%203.792%2010.4666%203.66696%2010.3428%203.60058C10.3261%203.59154%2010.3094%203.58358%2010.2925%203.57658C10.104%203.49851%209.89226%203.49851%209.70378%203.57658C9.56242%203.63514%209.4357%203.76186%209.18226%204.0153C9.09955%204.09801%209.03034%204.16722%208.97258%204.22785L4.28878%208.91166C4.03534%209.1651%203.90862%209.29182%203.85006%209.43318C3.77199%209.62166%203.77199%209.83344%203.85006%2010.0219C3.90862%2010.1633%204.03534%2010.29%204.28878%2010.5434C4.54221%2010.7969%204.66893%2010.9236%204.8103%2010.9822C4.99878%2011.0602%205.21056%2011.0602%205.39904%2010.9822C5.5404%2010.9236%205.66712%2010.7969%205.92056%2010.5434L5.92056%2010.5434L8.84449%207.61951V16.6616C8.84449%2017.02%208.84449%2017.1992%208.90305%2017.3406C8.98112%2017.5291%209.13087%2017.6788%209.31935%2017.7569C9.46072%2017.8154%209.63992%2017.8154%209.99834%2017.8154C10.3568%2017.8154%2010.536%2017.8154%2010.6773%2017.7569C10.8658%2017.6788%2011.0156%2017.5291%2011.0936%2017.3406Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2295
+ "rightAndDown-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.5062%206.72126C4.56476%206.86262%204.69148%206.98934%204.94492%207.24278L11.3404%2013.6382L7.20313%2013.6382C6.84471%2013.6382%206.66551%2013.6382%206.52414%2013.6968C6.33566%2013.7749%206.18591%2013.9246%206.10784%2014.1131C6.04928%2014.2545%206.04928%2014.4337%206.04928%2014.7921C6.04928%2015.1505%206.04928%2015.3297%206.10784%2015.4711C6.18591%2015.6596%206.33566%2015.8093%206.52414%2015.8874C6.66551%2015.9459%206.84471%2015.9459%207.20313%2015.9459L13.9194%2015.9459C13.9805%2015.9465%2014.0484%2015.9465%2014.1243%2015.9465H14.1243C14.4353%2015.9465%2014.6114%2015.9465%2014.7449%2015.9082C14.7659%2015.9023%2014.7859%2015.8954%2014.8052%2015.8874C14.9937%2015.8093%2015.1434%2015.6596%2015.2215%2015.4711C15.2801%2015.3297%2015.2801%2015.1505%2015.2801%2014.7921C15.2801%2014.6767%2015.2801%2014.5799%2015.2781%2014.497L15.2781%207.86957C15.2781%207.51115%2015.2781%207.33194%2015.2195%207.19058C15.1415%207.0021%2014.9917%206.85235%2014.8032%206.77428C14.6619%206.71572%2014.4827%206.71572%2014.1243%206.71572C13.7658%206.71572%2013.5866%206.71572%2013.4453%206.77428C13.2568%206.85235%2013.107%207.0021%2013.029%207.19058C12.9704%207.33194%2012.9704%207.51115%2012.9704%207.86957L12.9704%2012.0047L6.5767%205.61099C6.32326%205.35755%206.19654%205.23083%206.05518%205.17228C5.8667%205.09421%205.65492%205.09421%205.46644%205.17228C5.32508%205.23083%205.19836%205.35755%204.94492%205.61099C4.69148%205.86443%204.56476%205.99115%204.5062%206.13251C4.42813%206.32099%204.42813%206.53277%204.5062%206.72126Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2296
+ "rightAndUp-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.05431%2016.1597C6.19567%2016.1012%206.32239%2015.9745%206.57583%2015.721L12.9712%209.32568L12.9712%2013.4626C12.9712%2013.821%2012.9712%2014.0002%2013.0297%2014.1416C13.1078%2014.3301%2013.2576%2014.4798%2013.446%2014.5579C13.5874%2014.6164%2013.7666%2014.6164%2014.125%2014.6164C14.4834%2014.6164%2014.6626%2014.6164%2014.804%2014.5579C14.9925%2014.4798%2015.1422%2014.3301%2015.2203%2014.1416C15.2789%2014.0002%2015.2789%2013.821%2015.2789%2013.4626L15.2789%206.75233C15.2795%206.68972%2015.2795%206.62004%2015.2795%206.54182L15.2795%206.54157C15.2795%206.22585%2015.2795%206.04918%2015.2395%205.91495C15.2339%205.89605%2015.2276%205.878%2015.2203%205.86053C15.1422%205.67204%2014.9925%205.52229%2014.804%205.44422C14.6626%205.38567%2014.4834%205.38567%2014.125%205.38567L14.125%205.38567C14.0075%205.38567%2013.9093%205.38567%2013.8254%205.38773L7.20256%205.38773C6.84414%205.38773%206.66493%205.38773%206.52357%205.44628C6.33509%205.52436%206.18534%205.6741%206.10727%205.86259C6.04871%206.00395%206.04871%206.18315%206.04871%206.54156V6.54157L6.04871%206.54159C6.04871%206.9%206.04871%207.0792%206.10727%207.22056C6.18534%207.40905%206.33509%207.55879%206.52357%207.63687C6.66493%207.69542%206.84414%207.69542%207.20256%207.69542H11.3379L4.94405%2014.0892C4.69061%2014.3427%204.56389%2014.4694%204.50533%2014.6108C4.42726%2014.7992%204.42726%2015.011%204.50533%2015.1995C4.56389%2015.3409%204.69061%2015.4676%204.94405%2015.721C5.19749%2015.9745%205.32421%2016.1012%205.46557%2016.1597C5.65405%2016.2378%205.86583%2016.2378%206.05431%2016.1597Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A"
2297
+ },
2298
+ "shape": {
2299
+ "cross": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223%22%20y%3D%227%22%20width%3D%2210%22%20height%3D%222%22%20rx%3D%220.75%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2300
+ "up": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M7.48861%204.23829C7.75558%203.87976%208.29238%203.87976%208.55935%204.23829L12.9614%2010.1507C13.2907%2010.5929%2012.975%2011.2223%2012.4236%2011.2223H3.62432C3.07292%2011.2223%202.75722%2010.5929%203.08649%2010.1507L7.48861%204.23829Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2301
+ "down": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M8.55935%2011.7617C8.29238%2012.1202%207.75558%2012.1202%207.48861%2011.7617L3.08649%205.84931C2.75722%205.40708%203.07292%204.77771%203.62432%204.77771H12.4236C12.975%204.77771%2013.2907%205.40708%2012.9614%205.84931L8.55935%2011.7617Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2302
+ "rhomboid-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M7.57574%201.92426C7.81005%201.68995%208.18995%201.68995%208.42426%201.92426L14.0757%207.57574C14.3101%207.81005%2014.3101%208.18995%2014.0757%208.42426L8.42426%2014.0757C8.18995%2014.3101%207.81005%2014.3101%207.57574%2014.0757L1.92426%208.42426C1.68995%208.18995%201.68995%207.81005%201.92426%207.57574L7.57574%201.92426Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2303
+ "rhomboid-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M7.57574%201.92426C7.81005%201.68995%208.18995%201.68995%208.42426%201.92426L14.0757%207.57574C14.3101%207.81005%2014.3101%208.18995%2014.0757%208.42426L8.42426%2014.0757C8.18995%2014.3101%207.81005%2014.3101%207.57574%2014.0757L1.92426%208.42426C1.68995%208.18995%201.68995%207.81005%201.92426%207.57574L7.57574%201.92426Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2304
+ "roundness-greed": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2305
+ "roundness-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2306
+ "roundness-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2307
+ "roundness-pink": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%23FB9D9D%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2308
+ "roundness-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2309
+ "roundness-black": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22black%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2310
+ "triangle-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M7.35127%202.31778C7.61335%201.86074%208.27331%201.86074%208.53539%202.31778L14.0808%2011.9898C14.3423%2012.4459%2014.0131%2013.0147%2013.4877%2013.0147H2.399C1.87354%2013.0147%201.54441%2012.4459%201.80595%2011.9898L7.35127%202.31778Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2311
+ "indicate-greed": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222%22%20y%3D%222%22%20width%3D%2212%22%20height%3D%2212%22%20rx%3D%222.4%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%223.75%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2312
+ "indicate-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222%22%20y%3D%222%22%20width%3D%2212%22%20height%3D%2212%22%20rx%3D%222.4%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%223.75%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2313
+ "indicate-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222%22%20y%3D%222%22%20width%3D%2212%22%20height%3D%2212%22%20rx%3D%222.4%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%223.75%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"
2314
+ },
2315
+ "feedback2": {
2316
+ "mistake2": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M3.71274%202.86421C3.47843%202.6299%203.09853%202.6299%202.86421%202.86421C2.6299%203.09853%202.6299%203.47843%202.86421%203.71274L7.15154%208.00007L2.86421%2012.2874C2.6299%2012.5217%202.6299%2012.9016%202.86421%2013.1359C3.09853%2013.3702%203.47843%2013.3702%203.71274%2013.1359L8.00007%208.84859L12.2874%2013.1359C12.5217%2013.3702%2012.9016%2013.3702%2013.1359%2013.1359C13.3702%2012.9016%2013.3702%2012.5217%2013.1359%2012.2874L8.84859%208.00007L13.1359%203.71274C13.3702%203.47843%2013.3702%203.09853%2013.1359%202.86421C12.9016%202.6299%2012.5217%202.6299%2012.2874%202.86421L8.00007%207.15154L3.71274%202.86421Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2317
+ "warn2": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M7.25%202.5C7.25%202.08579%207.58579%201.75%208%201.75C8.41421%201.75%208.75%202.08579%208.75%202.5V10C8.75%2010.4142%208.41421%2010.75%208%2010.75C7.58579%2010.75%207.25%2010.4142%207.25%2010V2.5Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%2213.25%22%20r%3D%221%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2318
+ "correct2": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M14.1544%203.75557C14.3887%203.98988%2014.3887%204.36978%2014.1544%204.6041L6.51409%2012.2444C6.40157%2012.3569%206.24896%2012.4201%206.08983%2012.4201C5.9307%2012.4201%205.77808%2012.3569%205.66556%2012.2444L1.84541%208.42425C1.6111%208.18993%201.6111%207.81003%201.84541%207.57572C2.07973%207.34141%202.45963%207.34141%202.69394%207.57572L6.08983%2010.9716L13.3059%203.75557C13.5402%203.52126%2013.9201%203.52126%2014.1544%203.75557Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A"
2319
+ },
2320
+ "flag": {
2321
+ "flag-green": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M3.25%202.5C3.25%202.08579%203.58579%201.75%204%201.75C4.41421%201.75%204.75%202.08579%204.75%202.5V13.5C4.75%2013.9142%204.41421%2014.25%204%2014.25C3.58579%2014.25%203.25%2013.9142%203.25%2013.5V2.5Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3Cpath%20d%3D%22M4.75%203.088C6.02367%202.7469%207.00972%202.7044%207.8443%202.81465C8.70544%202.92841%209.37774%203.19906%2010.0279%203.46147L10.0668%203.47718C11.004%203.85549%2011.9397%204.21307%2013.4603%203.8373C13.8931%203.73034%2014.3125%204.05801%2014.3125%204.50387V10.1091C14.3125%2010.4232%2014.0992%2010.697%2013.7946%2010.774C11.8986%2011.2535%2010.6411%2010.7813%209.51441%2010.3265L9.47546%2010.3108C8.82531%2010.0484%208.153%209.77774%207.29186%209.66398C6.62487%209.5759%205.84983%209.58567%204.75%209.84134V3.088Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2322
+ "flag-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M3.25%202.5C3.25%202.08579%203.58579%201.75%204%201.75C4.41421%201.75%204.75%202.08579%204.75%202.5V13.5C4.75%2013.9142%204.41421%2014.25%204%2014.25C3.58579%2014.25%203.25%2013.9142%203.25%2013.5V2.5Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Cpath%20d%3D%22M4.75%203.088C6.02367%202.7469%207.00972%202.7044%207.8443%202.81465C8.70544%202.92841%209.37774%203.19906%2010.0279%203.46147L10.0668%203.47718C11.004%203.85549%2011.9397%204.21307%2013.4603%203.8373C13.8931%203.73034%2014.3125%204.05801%2014.3125%204.50387V10.1091C14.3125%2010.4232%2014.0992%2010.697%2013.7946%2010.774C11.8986%2011.2535%2010.6411%2010.7813%209.51441%2010.3265L9.47546%2010.3108C8.82531%2010.0484%208.153%209.77774%207.29186%209.66398C6.62487%209.5759%205.84983%209.58567%204.75%209.84134V3.088Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2323
+ "flag-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M3.25%202.5C3.25%202.08579%203.58579%201.75%204%201.75C4.41421%201.75%204.75%202.08579%204.75%202.5V13.5C4.75%2013.9142%204.41421%2014.25%204%2014.25C3.58579%2014.25%203.25%2013.9142%203.25%2013.5V2.5Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3Cpath%20d%3D%22M4.75%203.088C6.02367%202.7469%207.00972%202.7044%207.8443%202.81465C8.70544%202.92841%209.37774%203.19906%2010.0279%203.46147L10.0668%203.47718C11.004%203.85549%2011.9397%204.21307%2013.4603%203.8373C13.8931%203.73034%2014.3125%204.05801%2014.3125%204.50387V10.1091C14.3125%2010.4232%2014.0992%2010.697%2013.7946%2010.774C11.8986%2011.2535%2010.6411%2010.7813%209.51441%2010.3265L9.47546%2010.3108C8.82531%2010.0484%208.153%209.77774%207.29186%209.66398C6.62487%209.5759%205.84983%209.58567%204.75%209.84134V3.088Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"
2324
+ },
2325
+ "cell": {
2326
+ "cell-0": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%229%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223%22%20y%3D%223%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%229%22%20y%3D%223%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2327
+ "cell-25": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%229%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%229%22%20y%3D%223%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2328
+ "cell-50": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%229%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%229.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2329
+ "cell-75": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223.4%22%20y%3D%229.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%229%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%229.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3C%2Fsvg%3E%0A",
2330
+ "cell-100": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223.4%22%20y%3D%229.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%229.4%22%20y%3D%229.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%223.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%229.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3C%2Fsvg%3E%0A"
2331
+ }
2332
+ };
2333
+
2334
+ //#endregion
2335
+ //#region src/models/icon-map.ts
2336
+ let IIconSetType = /* @__PURE__ */ function(IIconSetType) {
2337
+ IIconSetType["threeArrows"] = "3Arrows";
2338
+ IIconSetType["threeArrowsGray"] = "3ArrowsGray";
2339
+ IIconSetType["fourArrows"] = "4Arrows";
2340
+ IIconSetType["fourArrowsGray"] = "4ArrowsGray";
2341
+ IIconSetType["fiveArrows"] = "5Arrows";
2342
+ IIconSetType["fiveArrowsGray"] = "5ArrowsGray";
2343
+ IIconSetType["threeTriangles"] = "3Triangles";
2344
+ IIconSetType["threeTrafficLights1"] = "3TrafficLights1";
2345
+ IIconSetType["threeSigns"] = "3Signs";
2346
+ IIconSetType["threeTrafficLights2"] = "3TrafficLights2";
2347
+ IIconSetType["fourRedToBlack"] = "4RedToBlack";
2348
+ IIconSetType["fourTrafficLights"] = "4TrafficLights";
2349
+ IIconSetType["threeSymbols"] = "3Symbols";
2350
+ IIconSetType["threeSymbols2"] = "3Symbols2";
2351
+ IIconSetType["threeFlags"] = "3Flags";
2352
+ IIconSetType["fourRating"] = "4Rating";
2353
+ IIconSetType["fiveRating"] = "5Rating";
2354
+ IIconSetType["fiveQuarters"] = "5Quarters";
2355
+ IIconSetType["fiveFelling"] = "_5Felling";
2356
+ IIconSetType["fiveBoxes"] = "5Boxes";
2357
+ IIconSetType["threeStars"] = "3Stars";
2358
+ IIconSetType["empty"] = "EMPTY_ICON_TYPE";
2359
+ return IIconSetType;
2360
+ }({});
2361
+ const iconGroup = [
2362
+ {
2363
+ title: "sheets-conditional-formatting.iconSet.direction",
2364
+ group: [
2365
+ {
2366
+ name: "3Arrows",
2367
+ list: [
2368
+ ICON_MAP.arrow["up-green"],
2369
+ ICON_MAP.arrow["right-gold"],
2370
+ ICON_MAP.arrow["down-red"]
2371
+ ]
2372
+ },
2373
+ {
2374
+ name: "3ArrowsGray",
2375
+ list: [
2376
+ ICON_MAP.arrow["up-gray"],
2377
+ ICON_MAP.arrow["right-gray"],
2378
+ ICON_MAP.arrow["down-gray"]
2379
+ ]
2380
+ },
2381
+ {
2382
+ name: "4Arrows",
2383
+ list: [
2384
+ ICON_MAP.arrow["up-green"],
2385
+ ICON_MAP.arrow["rightAndUp-gold"],
2386
+ ICON_MAP.arrow["rightAndDown-gold"],
2387
+ ICON_MAP.arrow["down-red"]
2388
+ ]
2389
+ },
2390
+ {
2391
+ name: "4ArrowsGray",
2392
+ list: [
2393
+ ICON_MAP.arrow["up-gray"],
2394
+ ICON_MAP.arrow["rightAndUp-gray"],
2395
+ ICON_MAP.arrow["rightAndDown-gray"],
2396
+ ICON_MAP.arrow["down-gray"]
2397
+ ]
2398
+ },
2399
+ {
2400
+ name: "5Arrows",
2401
+ list: [
2402
+ ICON_MAP.arrow["up-green"],
2403
+ ICON_MAP.arrow["rightAndUp-gold"],
2404
+ ICON_MAP.arrow["right-gold"],
2405
+ ICON_MAP.arrow["rightAndDown-gold"],
2406
+ ICON_MAP.arrow["down-red"]
2407
+ ]
2408
+ },
2409
+ {
2410
+ name: "5ArrowsGray",
2411
+ list: [
2412
+ ICON_MAP.arrow["up-gray"],
2413
+ ICON_MAP.arrow["rightAndUp-gray"],
2414
+ ICON_MAP.arrow["right-gray"],
2415
+ ICON_MAP.arrow["rightAndDown-gray"],
2416
+ ICON_MAP.arrow["down-gray"]
2417
+ ]
2418
+ },
2419
+ {
2420
+ name: "3Triangles",
2421
+ list: [
2422
+ ICON_MAP.shape.up,
2423
+ ICON_MAP.shape.cross,
2424
+ ICON_MAP.shape.down
2425
+ ]
2426
+ }
2427
+ ]
2428
+ },
2429
+ {
2430
+ title: "sheets-conditional-formatting.iconSet.shape",
2431
+ group: [
2432
+ {
2433
+ name: "3TrafficLights1",
2434
+ list: [
2435
+ ICON_MAP.shape["roundness-greed"],
2436
+ ICON_MAP.shape["roundness-gold"],
2437
+ ICON_MAP.shape["roundness-red"]
2438
+ ]
2439
+ },
2440
+ {
2441
+ name: "3Signs",
2442
+ list: [
2443
+ ICON_MAP.shape["roundness-greed"],
2444
+ ICON_MAP.shape["triangle-gold"],
2445
+ ICON_MAP.shape["rhomboid-red"]
2446
+ ]
2447
+ },
2448
+ {
2449
+ name: "3TrafficLights2",
2450
+ list: [
2451
+ ICON_MAP.shape["indicate-greed"],
2452
+ ICON_MAP.shape["indicate-gold"],
2453
+ ICON_MAP.shape["indicate-red"]
2454
+ ]
2455
+ },
2456
+ {
2457
+ name: "4RedToBlack",
2458
+ list: [
2459
+ ICON_MAP.shape["roundness-red"],
2460
+ ICON_MAP.shape["roundness-pink"],
2461
+ ICON_MAP.shape["roundness-gray"],
2462
+ ICON_MAP.shape["roundness-black"]
2463
+ ]
2464
+ },
2465
+ {
2466
+ name: "4TrafficLights",
2467
+ list: [
2468
+ ICON_MAP.shape["roundness-greed"],
2469
+ ICON_MAP.shape["roundness-gold"],
2470
+ ICON_MAP.shape["roundness-red"],
2471
+ ICON_MAP.shape["roundness-black"]
2472
+ ]
2473
+ }
2474
+ ]
2475
+ },
2476
+ {
2477
+ title: "sheets-conditional-formatting.iconSet.mark",
2478
+ group: [
2479
+ {
2480
+ name: "3Symbols",
2481
+ list: [
2482
+ ICON_MAP.feedback.correct,
2483
+ ICON_MAP.feedback.warn,
2484
+ ICON_MAP.feedback.mistake
2485
+ ]
2486
+ },
2487
+ {
2488
+ name: "3Symbols2",
2489
+ list: [
2490
+ ICON_MAP.feedback2.correct2,
2491
+ ICON_MAP.feedback2.warn2,
2492
+ ICON_MAP.feedback2.mistake2
2493
+ ]
2494
+ },
2495
+ {
2496
+ name: "3Flags",
2497
+ list: [
2498
+ ICON_MAP.flag["flag-green"],
2499
+ ICON_MAP.flag["flag-gold"],
2500
+ ICON_MAP.flag["flag-red"]
2501
+ ]
2502
+ }
2503
+ ]
2504
+ },
2505
+ {
2506
+ title: "sheets-conditional-formatting.iconSet.rank",
2507
+ group: [
2508
+ {
2509
+ name: "4Rating",
2510
+ list: [
2511
+ ICON_MAP.signal.signal25,
2512
+ ICON_MAP.signal.signal50,
2513
+ ICON_MAP.signal.signal75,
2514
+ ICON_MAP.signal.signal100
2515
+ ]
2516
+ },
2517
+ {
2518
+ name: "5Rating",
2519
+ list: [
2520
+ ICON_MAP.signal.signal0,
2521
+ ICON_MAP.signal.signal25,
2522
+ ICON_MAP.signal.signal50,
2523
+ ICON_MAP.signal.signal75,
2524
+ ICON_MAP.signal.signal100
2525
+ ]
2526
+ },
2527
+ {
2528
+ name: "5Quarters",
2529
+ list: [
2530
+ ICON_MAP.progress.progress100,
2531
+ ICON_MAP.progress.progress75,
2532
+ ICON_MAP.progress.progress50,
2533
+ ICON_MAP.progress.progress25,
2534
+ ICON_MAP.progress.progress0
2535
+ ]
2536
+ },
2537
+ {
2538
+ name: "_5Felling",
2539
+ list: [
2540
+ ICON_MAP.feeling.guffaw,
2541
+ ICON_MAP.feeling.smile,
2542
+ ICON_MAP.feeling.noninductive,
2543
+ ICON_MAP.feeling.dissatisfied,
2544
+ ICON_MAP.feeling.impatient
2545
+ ]
2546
+ },
2547
+ {
2548
+ name: "5Boxes",
2549
+ list: [
2550
+ ICON_MAP.cell["cell-100"],
2551
+ ICON_MAP.cell["cell-75"],
2552
+ ICON_MAP.cell["cell-50"],
2553
+ ICON_MAP.cell["cell-25"],
2554
+ ICON_MAP.cell["cell-0"]
2555
+ ]
2556
+ },
2557
+ {
2558
+ name: "3Stars",
2559
+ list: [
2560
+ ICON_MAP.star.starFull,
2561
+ ICON_MAP.star.starIncomplete,
2562
+ ICON_MAP.star.starEmpty
2563
+ ]
2564
+ }
2565
+ ]
2566
+ }
2567
+ ];
2568
+ const iconMap = iconGroup.reduce((result, cur) => {
2569
+ const { group } = cur;
2570
+ for (const v of group) result[v.name] = v.list;
2571
+ return result;
2572
+ }, {});
2573
+ for (const key in iconMap) {
2574
+ const v = iconMap[key];
2575
+ Object.freeze(v);
2576
+ }
2577
+
2578
+ //#endregion
2579
+ //#region package.json
2580
+ var name = "@cool-office/sheets-conditional-formatting";
2581
+ var version = "1.2.0";
2582
+
2583
+ //#endregion
2584
+ //#region src/config/config.ts
2585
+ /**
2586
+ * Copyright 2023-present DreamNum Co., Ltd.
2587
+ *
2588
+ * Licensed under the Apache License, Version 2.0 (the "License");
2589
+ * you may not use this file except in compliance with the License.
2590
+ * You may obtain a copy of the License at
2591
+ *
2592
+ * http://www.apache.org/licenses/LICENSE-2.0
2593
+ *
2594
+ * Unless required by applicable law or agreed to in writing, software
2595
+ * distributed under the License is distributed on an "AS IS" BASIS,
2596
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2597
+ * See the License for the specific language governing permissions and
2598
+ * limitations under the License.
2599
+ */
2600
+ const SHEETS_CONDITIONAL_FORMATTING_PLUGIN_CONFIG_KEY = "ssheets-conditional-formatting.config";
2601
+ const configSymbol = Symbol(SHEETS_CONDITIONAL_FORMATTING_PLUGIN_CONFIG_KEY);
2602
+ const defaultPluginConfig = {};
2603
+
2604
+ //#endregion
2605
+ //#region src/services/conditional-formatting-style-composer.service.ts
2606
+ /**
2607
+ * Copyright 2023-present DreamNum Co., Ltd.
2608
+ *
2609
+ * Licensed under the Apache License, Version 2.0 (the "License");
2610
+ * you may not use this file except in compliance with the License.
2611
+ * You may obtain a copy of the License at
2612
+ *
2613
+ * http://www.apache.org/licenses/LICENSE-2.0
2614
+ *
2615
+ * Unless required by applicable law or agreed to in writing, software
2616
+ * distributed under the License is distributed on an "AS IS" BASIS,
2617
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2618
+ * See the License for the specific language governing permissions and
2619
+ * limitations under the License.
2620
+ */
2621
+ let ConditionalFormattingStyleComposer = class ConditionalFormattingStyleComposer extends _cool_office_core.Disposable {
2622
+ constructor(_conditionalFormattingRuleModel, _conditionalFormattingViewModel) {
2623
+ super();
2624
+ this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
2625
+ this._conditionalFormattingViewModel = _conditionalFormattingViewModel;
2626
+ _defineProperty(this, "_cache", new _cool_office_core.LRUMap(CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH));
2627
+ this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(() => this._cache.clear()));
2628
+ this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.subscribe(() => this._cache.clear()));
2629
+ this.disposeWithMe(this._conditionalFormattingViewModel.cacheClear$.subscribe(() => this._cache.clear()));
2630
+ }
2631
+ dispose() {
2632
+ this._cache.clear();
2633
+ super.dispose();
2634
+ }
2635
+ composeStyle(unitId, subUnitId, row, col) {
2636
+ const cacheKey = `${unitId}_${subUnitId}_${row}_${col}`;
2637
+ if (this._cache.has(cacheKey)) return this._cache.get(cacheKey) ?? null;
2638
+ const cellCfs = this._conditionalFormattingViewModel.getCellCfs(unitId, subUnitId, row, col);
2639
+ if (!(cellCfs === null || cellCfs === void 0 ? void 0 : cellCfs.length)) {
2640
+ this._cache.set(cacheKey, null);
2641
+ return null;
2642
+ }
2643
+ const matchedRules = [];
2644
+ let stopIfTrueIndex = -1;
2645
+ for (const cacheItem of cellCfs) {
2646
+ const rule = this._conditionalFormattingRuleModel.getRule(unitId, subUnitId, cacheItem.cfId);
2647
+ if (!rule) continue;
2648
+ matchedRules.push({
2649
+ rule,
2650
+ cacheItem
2651
+ });
2652
+ if (stopIfTrueIndex === -1 && rule.stopIfTrue && cacheItem.matched) stopIfTrueIndex = matchedRules.length - 1;
2653
+ }
2654
+ if (!matchedRules.length) {
2655
+ this._cache.set(cacheKey, null);
2656
+ return null;
2657
+ }
2658
+ const effectiveRules = stopIfTrueIndex > -1 ? matchedRules.slice(0, stopIfTrueIndex + 1) : matchedRules;
2659
+ const result = {};
2660
+ for (let i = effectiveRules.length - 1; i >= 0; i--) {
2661
+ const { rule, cacheItem } = effectiveRules[i];
2662
+ this._mergeComposeResult(result, rule, cacheItem.result);
2663
+ }
2664
+ this._cache.set(cacheKey, result);
2665
+ return result;
2666
+ }
2667
+ _mergeComposeResult(result, rule, ruleResult) {
2668
+ const type = rule.rule.type;
2669
+ if (type === "highlightCell") {
2670
+ ruleResult && (0, _cool_office_core.merge)(result, { style: ruleResult });
2671
+ return;
2672
+ }
2673
+ if (type === "colorScale") {
2674
+ if (ruleResult && typeof ruleResult === "string") result.style = {
2675
+ ...result.style || {},
2676
+ bg: { rgb: ruleResult }
2677
+ };
2678
+ return;
2679
+ }
2680
+ if (type === "dataBar") {
2681
+ const ruleCache = ruleResult;
2682
+ if (ruleCache) {
2683
+ result.dataBar = ruleCache;
2684
+ result.isShowValue = ruleCache.isShowValue;
2685
+ }
2686
+ return;
2687
+ }
2688
+ if (type === "iconSet") {
2689
+ const ruleCache = ruleResult;
2690
+ if (ruleCache) {
2691
+ result.iconSet = ruleCache;
2692
+ result.isShowValue = ruleCache.isShowValue;
2693
+ }
2694
+ }
2695
+ }
2696
+ };
2697
+ ConditionalFormattingStyleComposer = __decorate([__decorateParam(0, (0, _cool_office_core.Inject)(ConditionalFormattingRuleModel)), __decorateParam(1, (0, _cool_office_core.Inject)(ConditionalFormattingViewModel))], ConditionalFormattingStyleComposer);
2698
+
2699
+ //#endregion
2700
+ //#region src/services/conditional-formatting.service.ts
2701
+ let ConditionalFormattingService = class ConditionalFormattingService extends _cool_office_core.Disposable {
2702
+ get _conditionalFormattingViewModelV2() {
2703
+ return this._injector.get(ConditionalFormattingViewModel);
2704
+ }
2705
+ constructor(_conditionalFormattingRuleModel, _conditionalFormattingRangeIndexModel, _conditionalFormattingStyleComposer, _injector, _univerInstanceService, _resourceManagerService, _sheetInterceptorService, _commandService) {
2706
+ super();
2707
+ this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
2708
+ this._conditionalFormattingRangeIndexModel = _conditionalFormattingRangeIndexModel;
2709
+ this._conditionalFormattingStyleComposer = _conditionalFormattingStyleComposer;
2710
+ this._injector = _injector;
2711
+ this._univerInstanceService = _univerInstanceService;
2712
+ this._resourceManagerService = _resourceManagerService;
2713
+ this._sheetInterceptorService = _sheetInterceptorService;
2714
+ this._commandService = _commandService;
2715
+ this._initCellChange();
2716
+ this._initSnapshot();
2717
+ this._initSheetChange();
2718
+ }
2719
+ composeStyle(unitId, subUnitId, row, col) {
2720
+ return this._conditionalFormattingStyleComposer.composeStyle(unitId, subUnitId, row, col);
2721
+ }
2722
+ _initSnapshot() {
2723
+ const toJson = (unitID) => {
2724
+ const map = this._conditionalFormattingRuleModel.getUnitRules(unitID);
2725
+ const resultMap = {};
2726
+ if (map) {
2727
+ map.forEach((v, key) => {
2728
+ resultMap[key] = v;
2729
+ });
2730
+ return JSON.stringify(resultMap);
2731
+ }
2732
+ return "";
2733
+ };
2734
+ const parseJson = (json) => {
2735
+ if (!json) return {};
2736
+ try {
2737
+ return JSON.parse(json);
2738
+ } catch {
2739
+ return {};
2740
+ }
2741
+ };
2742
+ this.disposeWithMe(this._resourceManagerService.registerPluginResource({
2743
+ pluginName: SHEET_CONDITIONAL_FORMATTING_PLUGIN,
2744
+ businesses: [_cool_office_core.UniverInstanceType.UNIVER_SHEET],
2745
+ toJson: (unitID) => toJson(unitID),
2746
+ parseJson: (json) => parseJson(json),
2747
+ onUnLoad: (unitID) => {
2748
+ this._conditionalFormattingRuleModel.deleteUnitId(unitID);
2749
+ this._conditionalFormattingRangeIndexModel.rebuild();
2750
+ if ((0, _cool_office_core.isInternalEditorID)(unitID)) return;
2751
+ this._conditionalFormattingViewModelV2.clearCache();
2752
+ },
2753
+ onLoad: (unitID, value) => {
2754
+ Object.keys(value).forEach((subunitId) => {
2755
+ [...value[subunitId]].reverse().forEach((rule) => {
2756
+ this._conditionalFormattingRuleModel.addRule(unitID, subunitId, rule);
2757
+ });
2758
+ });
2759
+ }
2760
+ }));
2761
+ }
2762
+ _initSheetChange() {
2763
+ this.disposeWithMe(this._sheetInterceptorService.interceptCommand({ getMutations: (commandInfo) => {
2764
+ if (commandInfo.id === _cool_office_sheets.RemoveSheetCommand.id) {
2765
+ const params = commandInfo.params;
2766
+ const target = (0, _cool_office_sheets.getSheetCommandTarget)(this._univerInstanceService, params);
2767
+ if (!target) return {
2768
+ redos: [],
2769
+ undos: []
2770
+ };
2771
+ const { unitId, subUnitId } = target;
2772
+ const ruleList = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
2773
+ if (!ruleList) return {
2774
+ redos: [],
2775
+ undos: []
2776
+ };
2777
+ const redos = [];
2778
+ const undos = [];
2779
+ ruleList.forEach((item) => {
2780
+ const params = {
2781
+ unitId,
2782
+ subUnitId,
2783
+ cfId: item.cfId
2784
+ };
2785
+ redos.push({
2786
+ id: DeleteConditionalRuleMutation.id,
2787
+ params
2788
+ });
2789
+ undos.push(...DeleteConditionalRuleMutationUndoFactory(this._injector, params));
2790
+ });
2791
+ return {
2792
+ redos,
2793
+ undos
2794
+ };
2795
+ } else if (commandInfo.id === _cool_office_sheets.CopySheetCommand.id) {
2796
+ const params = commandInfo.params;
2797
+ const target = (0, _cool_office_sheets.getSheetCommandTarget)(this._univerInstanceService, params);
2798
+ if (!target) return {
2799
+ redos: [],
2800
+ undos: []
2801
+ };
2802
+ const { unitId, subUnitId } = target;
2803
+ const { targetSubUnitId } = params;
2804
+ const ruleList = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
2805
+ if (!ruleList) return {
2806
+ redos: [],
2807
+ undos: []
2808
+ };
2809
+ const redos = [];
2810
+ const undos = [];
2811
+ ruleList.slice().reverse().forEach((item) => {
2812
+ const params = {
2813
+ unitId,
2814
+ subUnitId: targetSubUnitId,
2815
+ rule: {
2816
+ ...item,
2817
+ cfId: this._conditionalFormattingRuleModel.createCfId(unitId, targetSubUnitId)
2818
+ }
2819
+ };
2820
+ redos.push({
2821
+ id: AddConditionalRuleMutation.id,
2822
+ params
2823
+ });
2824
+ undos.push(AddConditionalRuleMutationUndoFactory(this._injector, params));
2825
+ });
2826
+ return {
2827
+ redos,
2828
+ undos
2829
+ };
2830
+ }
2831
+ return {
2832
+ redos: [],
2833
+ undos: []
2834
+ };
2835
+ } }));
2836
+ }
2837
+ _initCellChange() {
2838
+ this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
2839
+ const markRulesDirtyByRanges = (unitId, subUnitId, ranges) => {
2840
+ this._conditionalFormattingRangeIndexModel.getRulesByRanges(unitId, subUnitId, ranges).forEach((rule) => {
2841
+ this._conditionalFormattingViewModelV2.markRuleDirty(unitId, subUnitId, rule.cfId);
2842
+ });
2843
+ };
2844
+ switch (commandInfo.id) {
2845
+ case _cool_office_sheets.SetRangeValuesMutation.id: {
2846
+ const { subUnitId, unitId, cellValue } = commandInfo.params;
2847
+ const ranges = [];
2848
+ new _cool_office_core.ObjectMatrix(cellValue).forValue((row, col, value) => {
2849
+ if (value && Object.keys(value).some((key) => ["p", "v"].includes(key))) ranges.push({
2850
+ startRow: row,
2851
+ endRow: row,
2852
+ startColumn: col,
2853
+ endColumn: col
2854
+ });
2855
+ });
2856
+ markRulesDirtyByRanges(unitId, subUnitId, ranges);
2857
+ break;
2858
+ }
2859
+ case _cool_office_sheets.InsertColMutation.id:
2860
+ case _cool_office_sheets.RemoveColMutation.id: {
2861
+ const params = commandInfo.params;
2862
+ const target = (0, _cool_office_sheets.getSheetCommandTarget)(this._univerInstanceService, params);
2863
+ if (!target) return;
2864
+ const { worksheet, unitId, subUnitId } = target;
2865
+ const { range } = params;
2866
+ markRulesDirtyByRanges(unitId, subUnitId, [{
2867
+ ...range,
2868
+ endColumn: worksheet.getColumnCount() - 1
2869
+ }]);
2870
+ break;
2871
+ }
2872
+ case _cool_office_sheets.RemoveRowMutation.id:
2873
+ case _cool_office_sheets.InsertRowMutation.id: {
2874
+ const params = commandInfo.params;
2875
+ const target = (0, _cool_office_sheets.getSheetCommandTarget)(this._univerInstanceService, params);
2876
+ if (!target) return;
2877
+ const { worksheet, unitId, subUnitId } = target;
2878
+ const { range } = params;
2879
+ markRulesDirtyByRanges(unitId, subUnitId, [{
2880
+ ...range,
2881
+ endRow: worksheet.getRowCount() - 1
2882
+ }]);
2883
+ break;
2884
+ }
2885
+ case _cool_office_sheets.MoveRowsMutation.id: {
2886
+ const params = commandInfo.params;
2887
+ const target = (0, _cool_office_sheets.getSheetCommandTarget)(this._univerInstanceService, params);
2888
+ if (!target) return;
2889
+ const { worksheet, unitId, subUnitId } = target;
2890
+ const { sourceRange, targetRange } = params;
2891
+ markRulesDirtyByRanges(unitId, subUnitId, [{
2892
+ startRow: Math.min(sourceRange.startRow, targetRange.startRow),
2893
+ endRow: worksheet.getRowCount() - 1,
2894
+ startColumn: 0,
2895
+ endColumn: worksheet.getColumnCount() - 1
2896
+ }]);
2897
+ break;
2898
+ }
2899
+ case _cool_office_sheets.MoveColsMutation.id: {
2900
+ const params = commandInfo.params;
2901
+ const target = (0, _cool_office_sheets.getSheetCommandTarget)(this._univerInstanceService, params);
2902
+ if (!target) return;
2903
+ const { worksheet, unitId, subUnitId } = target;
2904
+ const { sourceRange, targetRange } = params;
2905
+ markRulesDirtyByRanges(unitId, subUnitId, [{
2906
+ startRow: 0,
2907
+ endRow: worksheet.getRowCount() - 1,
2908
+ startColumn: Math.min(sourceRange.startColumn, targetRange.startColumn),
2909
+ endColumn: worksheet.getColumnCount() - 1
2910
+ }]);
2911
+ break;
2912
+ }
2913
+ case _cool_office_sheets.MoveRangeMutation.id: {
2914
+ const { unitId, to, from } = commandInfo.params;
2915
+ const handleSubUnit = (value) => {
2916
+ const ranges = [];
2917
+ new _cool_office_core.ObjectMatrix(value.value).forValue((row, col) => {
2918
+ ranges.push({
2919
+ startRow: row,
2920
+ endRow: row,
2921
+ startColumn: col,
2922
+ endColumn: col
2923
+ });
2924
+ });
2925
+ markRulesDirtyByRanges(unitId, value.subUnitId, ranges);
2926
+ };
2927
+ handleSubUnit(to);
2928
+ handleSubUnit(from);
2929
+ break;
2930
+ }
2931
+ case _cool_office_sheets.ReorderRangeMutation.id: {
2932
+ const { range, unitId, subUnitId } = commandInfo.params;
2933
+ markRulesDirtyByRanges(unitId, subUnitId, [range]);
2934
+ break;
2935
+ }
2936
+ }
2937
+ }));
2938
+ }
2939
+ };
2940
+ ConditionalFormattingService = __decorate([
2941
+ __decorateParam(0, (0, _cool_office_core.Inject)(ConditionalFormattingRuleModel)),
2942
+ __decorateParam(1, (0, _cool_office_core.Inject)(ConditionalFormattingRangeIndexModel)),
2943
+ __decorateParam(2, (0, _cool_office_core.Inject)(ConditionalFormattingStyleComposer)),
2944
+ __decorateParam(3, (0, _cool_office_core.Inject)(_cool_office_core.Injector)),
2945
+ __decorateParam(4, (0, _cool_office_core.Inject)(_cool_office_core.IUniverInstanceService)),
2946
+ __decorateParam(5, (0, _cool_office_core.Inject)(_cool_office_core.IResourceManagerService)),
2947
+ __decorateParam(6, (0, _cool_office_core.Inject)(_cool_office_sheets.SheetInterceptorService)),
2948
+ __decorateParam(7, (0, _cool_office_core.Inject)(_cool_office_core.ICommandService))
2949
+ ], ConditionalFormattingService);
2950
+
2951
+ //#endregion
2952
+ //#region src/plugin.ts
2953
+ let UniverSheetsConditionalFormattingPlugin = class UniverSheetsConditionalFormattingPlugin extends _cool_office_core.Plugin {
2954
+ constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
2955
+ super();
2956
+ this._config = _config;
2957
+ this._injector = _injector;
2958
+ this._commandService = _commandService;
2959
+ this._configService = _configService;
2960
+ const { ...rest } = (0, _cool_office_core.merge)({}, defaultPluginConfig, this._config);
2961
+ this._configService.setConfig(SHEETS_CONDITIONAL_FORMATTING_PLUGIN_CONFIG_KEY, rest);
2962
+ [
2963
+ [ConditionalFormattingService],
2964
+ [ConditionalFormattingFormulaService],
2965
+ [ConditionalFormattingRangeTransformService],
2966
+ [ConditionalFormattingStyleComposer],
2967
+ [ConditionalFormattingRuleModel],
2968
+ [ConditionalFormattingRangeIndexModel],
2969
+ [ConditionalFormattingViewModel]
2970
+ ].forEach((dependency) => {
2971
+ this._injector.add(dependency);
2972
+ });
2973
+ [
2974
+ AddCfCommand,
2975
+ ClearRangeCfCommand,
2976
+ ClearWorksheetCfCommand,
2977
+ DeleteCfCommand,
2978
+ MoveCfCommand,
2979
+ SetCfCommand,
2980
+ AddConditionalRuleMutation,
2981
+ DeleteConditionalRuleMutation,
2982
+ SetConditionalRuleMutation,
2983
+ MoveConditionalRuleMutation
2984
+ ].forEach((m) => {
2985
+ this._commandService.registerCommand(m);
2986
+ });
2987
+ }
2988
+ onStarting() {
2989
+ this._injector.get(ConditionalFormattingService);
2990
+ (0, _cool_office_core.touchDependencies)(this._injector, [
2991
+ [ConditionalFormattingService],
2992
+ [ConditionalFormattingRangeIndexModel],
2993
+ [ConditionalFormattingViewModel]
2994
+ ]);
2995
+ }
2996
+ };
2997
+ _defineProperty(UniverSheetsConditionalFormattingPlugin, "pluginName", SHEET_CONDITIONAL_FORMATTING_PLUGIN);
2998
+ _defineProperty(UniverSheetsConditionalFormattingPlugin, "packageName", name);
2999
+ _defineProperty(UniverSheetsConditionalFormattingPlugin, "version", version);
3000
+ _defineProperty(UniverSheetsConditionalFormattingPlugin, "type", _cool_office_core.UniverInstanceType.UNIVER_SHEET);
3001
+ UniverSheetsConditionalFormattingPlugin = __decorate([
3002
+ (0, _cool_office_core.DependentOn)(_cool_office_engine_formula.UniverFormulaEnginePlugin, _cool_office_sheets.UniverSheetsPlugin),
3003
+ __decorateParam(1, (0, _cool_office_core.Inject)(_cool_office_core.Injector)),
3004
+ __decorateParam(2, (0, _cool_office_core.Inject)(_cool_office_core.ICommandService)),
3005
+ __decorateParam(3, _cool_office_core.IConfigService)
3006
+ ], UniverSheetsConditionalFormattingPlugin);
3007
+
3008
+ //#endregion
3009
+ //#region src/render/icon.render.ts
3010
+ const IconUKey = "sheet-conditional-rule-icon";
3011
+ const EXTENSION_Z_INDEX = 35;
3012
+ const DEFAULT_WIDTH = 15;
3013
+ const DEFAULT_PADDING = 2;
3014
+ const stringifyRange = (range) => {
3015
+ const { startRow, endRow, startColumn, endColumn } = range;
3016
+ return `${startRow}-${endRow}-${startColumn}-${endColumn}`;
3017
+ };
3018
+ var ConditionalFormattingIcon = class extends _cool_office_engine_render.SheetExtension {
3019
+ constructor() {
3020
+ super();
3021
+ _defineProperty(this, "_paddingRightAndLeft", 2);
3022
+ _defineProperty(this, "_width", 15);
3023
+ _defineProperty(this, "_imageMap", /* @__PURE__ */ new Map());
3024
+ _defineProperty(this, "_renderRangeResolver", null);
3025
+ _defineProperty(this, "uKey", IconUKey);
3026
+ _defineProperty(this, "Z_INDEX", EXTENSION_Z_INDEX);
3027
+ _defineProperty(this, "_radius", 1);
3028
+ this._init();
3029
+ }
3030
+ setRenderRangeResolver(resolver) {
3031
+ this._renderRangeResolver = resolver;
3032
+ }
3033
+ draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges) {
3034
+ const { worksheet } = spreadsheetSkeleton;
3035
+ if (!worksheet) return false;
3036
+ const mergeCellRendered = /* @__PURE__ */ new Set();
3037
+ const sourceRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [spreadsheetSkeleton.rowColumnSegment];
3038
+ const renderRanges = this._renderRangeResolver && worksheet.getMergeData().length === 0 ? this._renderRangeResolver(worksheet.getUnitId(), worksheet.getSheetId(), sourceRanges) ?? sourceRanges : sourceRanges;
3039
+ if (!renderRanges.length) return;
3040
+ ctx.save();
3041
+ renderRanges.forEach((range) => {
3042
+ _cool_office_core.Range.foreach(range, (row, col) => {
3043
+ if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col)) return;
3044
+ const primaryWithCoord = spreadsheetSkeleton.getCellWithCoordByIndex(row, col, false);
3045
+ const { isMerged, isMergedMainCell, mergeInfo } = primaryWithCoord;
3046
+ let cellData = worksheet.getCell(row, col);
3047
+ if (isMerged) cellData = worksheet.getCell(mergeInfo.startRow, mergeInfo.startColumn);
3048
+ if (!(cellData === null || cellData === void 0 ? void 0 : cellData.iconSet)) return;
3049
+ const { iconType, iconId } = cellData.iconSet;
3050
+ if (iconType === "EMPTY_ICON_TYPE") return;
3051
+ const icon = this._imageMap.get(this._createKey(iconType, iconId));
3052
+ if (!icon) return;
3053
+ if (!this.isRenderDiffRangesByCell(mergeInfo, diffRanges)) return;
3054
+ if (isMerged || isMergedMainCell) {
3055
+ const rangeStr = stringifyRange(mergeInfo);
3056
+ if (mergeCellRendered.has(rangeStr)) return;
3057
+ mergeCellRendered.add(rangeStr);
3058
+ }
3059
+ const { startX, endX, startY, endY } = isMerged || isMergedMainCell ? mergeInfo : primaryWithCoord;
3060
+ const borderWidth = endX - startX;
3061
+ const borderHeight = endY - startY;
3062
+ if (this._width > borderHeight || this._width > borderWidth + this._paddingRightAndLeft * 2) return;
3063
+ const y = (borderHeight - this._width) / 2 + startY;
3064
+ ctx.drawImage(icon, startX + this._paddingRightAndLeft, y, this._width, this._width);
3065
+ });
3066
+ });
3067
+ ctx.restore();
3068
+ }
3069
+ dispose() {
3070
+ this._renderRangeResolver = null;
3071
+ super.dispose();
3072
+ }
3073
+ _init() {
3074
+ for (const type in iconMap) iconMap[type].forEach((base64, index) => {
3075
+ const key = this._createKey(type, String(index));
3076
+ const image = new Image();
3077
+ image.onload = () => {
3078
+ this._imageMap.set(key, image);
3079
+ };
3080
+ image.src = base64;
3081
+ });
3082
+ }
3083
+ _createKey(iconType, iconIndex) {
3084
+ return `${iconType}_${iconIndex}`;
3085
+ }
3086
+ };
3087
+ _cool_office_engine_render.SpreadsheetExtensionRegistry.add(ConditionalFormattingIcon);
3088
+
3089
+ //#endregion
3090
+ //#region src/utils/remove-undefined-attr.ts
3091
+ /**
3092
+ * Copyright 2023-present DreamNum Co., Ltd.
3093
+ *
3094
+ * Licensed under the Apache License, Version 2.0 (the "License");
3095
+ * you may not use this file except in compliance with the License.
3096
+ * You may obtain a copy of the License at
3097
+ *
3098
+ * http://www.apache.org/licenses/LICENSE-2.0
3099
+ *
3100
+ * Unless required by applicable law or agreed to in writing, software
3101
+ * distributed under the License is distributed on an "AS IS" BASIS,
3102
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3103
+ * See the License for the specific language governing permissions and
3104
+ * limitations under the License.
3105
+ */
3106
+ function removeUndefinedAttr(obj) {
3107
+ if (typeof obj !== "object" || obj === null) return obj;
3108
+ const result = {};
3109
+ for (const key in obj) if (obj.hasOwnProperty(key)) {
3110
+ const value = removeUndefinedAttr(obj[key]);
3111
+ if (value !== void 0) result[key] = value;
3112
+ }
3113
+ return result;
3114
+ }
3115
+
3116
+ //#endregion
3117
+ exports.AddCfCommand = AddCfCommand;
3118
+ exports.AddConditionalRuleMutation = AddConditionalRuleMutation;
3119
+ exports.AddConditionalRuleMutationUndoFactory = AddConditionalRuleMutationUndoFactory;
3120
+ exports.CFNumberOperator = CFNumberOperator;
3121
+ exports.CFRuleType = CFRuleType;
3122
+ exports.CFSubRuleType = CFSubRuleType;
3123
+ exports.CFTextOperator = CFTextOperator;
3124
+ exports.CFTimePeriodOperator = CFTimePeriodOperator;
3125
+ exports.CFValueType = CFValueType;
3126
+ exports.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH = CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH;
3127
+ exports.ClearRangeCfCommand = ClearRangeCfCommand;
3128
+ exports.ClearWorksheetCfCommand = ClearWorksheetCfCommand;
3129
+ Object.defineProperty(exports, "ConditionalFormattingFormulaService", {
3130
+ enumerable: true,
3131
+ get: function () {
3132
+ return ConditionalFormattingFormulaService;
3133
+ }
3134
+ });
3135
+ exports.ConditionalFormattingIcon = ConditionalFormattingIcon;
3136
+ Object.defineProperty(exports, "ConditionalFormattingRangeIndexModel", {
3137
+ enumerable: true,
3138
+ get: function () {
3139
+ return ConditionalFormattingRangeIndexModel;
3140
+ }
3141
+ });
3142
+ exports.ConditionalFormattingRangeTransformService = ConditionalFormattingRangeTransformService;
3143
+ exports.ConditionalFormattingRuleModel = ConditionalFormattingRuleModel;
3144
+ Object.defineProperty(exports, "ConditionalFormattingService", {
3145
+ enumerable: true,
3146
+ get: function () {
3147
+ return ConditionalFormattingService;
3148
+ }
3149
+ });
3150
+ Object.defineProperty(exports, "ConditionalFormattingStyleComposer", {
3151
+ enumerable: true,
3152
+ get: function () {
3153
+ return ConditionalFormattingStyleComposer;
3154
+ }
3155
+ });
3156
+ Object.defineProperty(exports, "ConditionalFormattingViewModel", {
3157
+ enumerable: true,
3158
+ get: function () {
3159
+ return ConditionalFormattingViewModel;
3160
+ }
3161
+ });
3162
+ exports.DEFAULT_BG_COLOR = DEFAULT_BG_COLOR;
3163
+ exports.DEFAULT_FONT_COLOR = DEFAULT_FONT_COLOR;
3164
+ exports.DEFAULT_PADDING = DEFAULT_PADDING;
3165
+ exports.DEFAULT_WIDTH = DEFAULT_WIDTH;
3166
+ exports.DataBar = DataBar;
3167
+ exports.DeleteCfCommand = DeleteCfCommand;
3168
+ exports.DeleteConditionalRuleMutation = DeleteConditionalRuleMutation;
3169
+ exports.DeleteConditionalRuleMutationUndoFactory = DeleteConditionalRuleMutationUndoFactory;
3170
+ exports.IIconSetType = IIconSetType;
3171
+ exports.IconUKey = IconUKey;
3172
+ exports.MoveCfCommand = MoveCfCommand;
3173
+ exports.MoveConditionalRuleMutation = MoveConditionalRuleMutation;
3174
+ exports.MoveConditionalRuleMutationUndoFactory = MoveConditionalRuleMutationUndoFactory;
3175
+ exports.SHEET_CONDITIONAL_FORMATTING_PLUGIN = SHEET_CONDITIONAL_FORMATTING_PLUGIN;
3176
+ exports.SetCfCommand = SetCfCommand;
3177
+ exports.SetConditionalRuleMutation = SetConditionalRuleMutation;
3178
+ Object.defineProperty(exports, "UniverSheetsConditionalFormattingPlugin", {
3179
+ enumerable: true,
3180
+ get: function () {
3181
+ return UniverSheetsConditionalFormattingPlugin;
3182
+ }
3183
+ });
3184
+ exports.anchorUndoFactory = anchorUndoFactory;
3185
+ exports.compareWithNumber = compareWithNumber;
3186
+ exports.createCfId = createCfId;
3187
+ exports.createDefaultRule = createDefaultRule;
3188
+ exports.createDefaultValue = createDefaultValue;
3189
+ exports.createDefaultValueByValueType = createDefaultValueByValueType;
3190
+ exports.dataBarUKey = dataBarUKey;
3191
+ exports.defaultDataBarNativeColor = defaultDataBarNativeColor;
3192
+ exports.defaultDataBarPositiveColor = defaultDataBarPositiveColor;
3193
+ exports.defaultPlaceholderColor = defaultPlaceholderColor;
3194
+ exports.filterRange = filterRange;
3195
+ exports.findIndexByAnchor = findIndexByAnchor;
3196
+ exports.getCacheStyleMatrix = getCacheStyleMatrix;
3197
+ exports.getCellValue = getCellValue;
3198
+ exports.getColorScaleFromValue = getColorScaleFromValue;
3199
+ exports.getMaxInFormulaResult = getMaxInFormulaResult;
3200
+ exports.getOppositeOperator = getOppositeOperator;
3201
+ exports.getValueByType = getValueByType;
3202
+ exports.iconGroup = iconGroup;
3203
+ exports.iconMap = iconMap;
3204
+ exports.isAnchorEqual = isAnchorEqual;
3205
+ exports.isFloatsEqual = isFloatsEqual;
3206
+ exports.isNullable = isNullable;
3207
+ exports.moveByAnchor = moveByAnchor;
3208
+ exports.removeUndefinedAttr = removeUndefinedAttr;
3209
+ exports.serialTimeToTimestamp = serialTimeToTimestamp;
3210
+ exports.setConditionalRuleMutationUndoFactory = setConditionalRuleMutationUndoFactory;
3211
+ exports.transformSupportSymmetryAnchor = transformSupportSymmetryAnchor;