@univerjs/sheets-conditional-formatting 0.4.2 → 0.5.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,16 +1,15 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { Tools, Inject, Injector, ObjectMatrix, Range, CommandType, ICommandService, Disposable, toDisposable, RefAlias, CellValueType, BooleanNumber, ColorKit, Rectangle, createInterceptorKey, IUniverInstanceService, IResourceManagerService, InterceptorManager, UniverInstanceType, Plugin, IConfigService } from "@univerjs/core";
6
- import { Subject, Observable } from "rxjs";
7
- import { bufferTime, filter, map } from "rxjs/operators";
8
- import { SheetInterceptorService, RemoveSheetCommand, ReorderRangeMutation, MoveRangeMutation, MoveColsMutation, MoveRowsMutation, InsertRowMutation, RemoveRowMutation, RemoveColMutation, InsertColMutation, SetRangeValuesMutation } from "@univerjs/sheets";
9
- import { isObject, SpreadsheetExtensionRegistry, SheetExtension, FIX_ONE_PIXEL_BLUR_OFFSET } from "@univerjs/engine-render";
10
- import { IActiveDirtyManagerService, SetFormulaCalculationResultMutation, SetOtherFormulaMutation, RemoveOtherFormulaMutation, BooleanValue, LexerTreeBuilder, sequenceNodeType, deserializeRangeWithSheet, serializeRange, generateStringWithSequence, ERROR_TYPE_SET } from "@univerjs/engine-formula";
11
- const SHEET_CONDITIONAL_FORMATTING_PLUGIN = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
12
- var CFTextOperator = /* @__PURE__ */ ((CFTextOperator2) => (CFTextOperator2.beginsWith = "beginsWith", CFTextOperator2.endsWith = "endsWith", CFTextOperator2.containsText = "containsText", CFTextOperator2.notContainsText = "notContainsText", CFTextOperator2.equal = "equal", CFTextOperator2.notEqual = "notEqual", CFTextOperator2.containsBlanks = "containsBlanks", CFTextOperator2.notContainsBlanks = "notContainsBlanks", CFTextOperator2.containsErrors = "containsErrors", CFTextOperator2.notContainsErrors = "notContainsErrors", CFTextOperator2))(CFTextOperator || {}), CFTimePeriodOperator = /* @__PURE__ */ ((CFTimePeriodOperator2) => (CFTimePeriodOperator2.today = "today", CFTimePeriodOperator2.yesterday = "yesterday", CFTimePeriodOperator2.tomorrow = "tomorrow", CFTimePeriodOperator2.last7Days = "last7Days", CFTimePeriodOperator2.thisMonth = "thisMonth", CFTimePeriodOperator2.lastMonth = "lastMonth", CFTimePeriodOperator2.nextMonth = "nextMonth", CFTimePeriodOperator2.thisWeek = "thisWeek", CFTimePeriodOperator2.lastWeek = "lastWeek", CFTimePeriodOperator2.nextWeek = "nextWeek", CFTimePeriodOperator2))(CFTimePeriodOperator || {}), CFNumberOperator = /* @__PURE__ */ ((CFNumberOperator2) => (CFNumberOperator2.greaterThan = "greaterThan", CFNumberOperator2.greaterThanOrEqual = "greaterThanOrEqual", CFNumberOperator2.lessThan = "lessThan", CFNumberOperator2.lessThanOrEqual = "lessThanOrEqual", CFNumberOperator2.notBetween = "notBetween", CFNumberOperator2.between = "between", CFNumberOperator2.equal = "equal", CFNumberOperator2.notEqual = "notEqual", CFNumberOperator2))(CFNumberOperator || {}), CFRuleType = /* @__PURE__ */ ((CFRuleType2) => (CFRuleType2.highlightCell = "highlightCell", CFRuleType2.dataBar = "dataBar", CFRuleType2.colorScale = "colorScale", CFRuleType2.iconSet = "iconSet", CFRuleType2))(CFRuleType || {}), CFSubRuleType = /* @__PURE__ */ ((CFSubRuleType2) => (CFSubRuleType2.uniqueValues = "uniqueValues", CFSubRuleType2.duplicateValues = "duplicateValues", CFSubRuleType2.rank = "rank", CFSubRuleType2.text = "text", CFSubRuleType2.timePeriod = "timePeriod", CFSubRuleType2.number = "number", CFSubRuleType2.average = "average", CFSubRuleType2.formula = "formula", CFSubRuleType2))(CFSubRuleType || {}), CFValueType = /* @__PURE__ */ ((CFValueType2) => (CFValueType2.num = "num", CFValueType2.min = "min", CFValueType2.max = "max", CFValueType2.percent = "percent", CFValueType2.percentile = "percentile", CFValueType2.formula = "formula", CFValueType2))(CFValueType || {});
13
- const DEFAULT_BG_COLOR = "#fff", DEFAULT_FONT_COLOR = "#000000", createDefaultRule = /* @__PURE__ */ __name(() => ({
1
+ var t0 = Object.defineProperty;
2
+ var e0 = (s, n, e) => n in s ? t0(s, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[n] = e;
3
+ var S = (s, n, e) => e0(s, typeof n != "symbol" ? n + "" : n, e);
4
+ import { Tools as D2, Inject as T, Injector as S2, ObjectMatrix as j, Range as q, CommandType as E2, ICommandService as O2, Disposable as q2, toDisposable as n0, RefAlias as i0, CellValueType as J, BooleanNumber as j2, ColorKit as H2, createInterceptorKey as s0, IUniverInstanceService as r0, IResourceManagerService as a0, InterceptorManager as o0, UniverInstanceType as b2, Rectangle as g2, Plugin as l0, IConfigService as c0 } from "@univerjs/core";
5
+ import { Subject as _2, Observable as u0 } from "rxjs";
6
+ import { bufferTime as Y2, filter as $2, map as h0 } from "rxjs/operators";
7
+ import { SheetInterceptorService as d0, RemoveSheetCommand as g0, ReorderRangeMutation as f0, MoveRangeMutation as D0, MoveColsMutation as C0, MoveRowsMutation as m0, InsertRowMutation as w0, RemoveRowMutation as F0, RemoveColMutation as v0, InsertColMutation as E0, SetRangeValuesMutation as p0 } from "@univerjs/sheets";
8
+ import { isObject as A0, SpreadsheetExtensionRegistry as G2, SheetExtension as X2, FIX_ONE_PIXEL_BLUR_OFFSET as x0 } from "@univerjs/engine-render";
9
+ import { IActiveDirtyManagerService as _0, SetFormulaCalculationResultMutation as M0, SetOtherFormulaMutation as y0, RemoveOtherFormulaMutation as R0, BooleanValue as U2, ERROR_TYPE_SET as T2 } from "@univerjs/engine-formula";
10
+ const K2 = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
11
+ var X = /* @__PURE__ */ ((s) => (s.beginsWith = "beginsWith", s.endsWith = "endsWith", s.containsText = "containsText", s.notContainsText = "notContainsText", s.equal = "equal", s.notEqual = "notEqual", s.containsBlanks = "containsBlanks", s.notContainsBlanks = "notContainsBlanks", s.containsErrors = "containsErrors", s.notContainsErrors = "notContainsErrors", s))(X || {}), K = /* @__PURE__ */ ((s) => (s.today = "today", s.yesterday = "yesterday", s.tomorrow = "tomorrow", s.last7Days = "last7Days", s.thisMonth = "thisMonth", s.lastMonth = "lastMonth", s.nextMonth = "nextMonth", s.thisWeek = "thisWeek", s.lastWeek = "lastWeek", s.nextWeek = "nextWeek", s))(K || {}), B = /* @__PURE__ */ ((s) => (s.greaterThan = "greaterThan", s.greaterThanOrEqual = "greaterThanOrEqual", s.lessThan = "lessThan", s.lessThanOrEqual = "lessThanOrEqual", s.notBetween = "notBetween", s.between = "between", s.equal = "equal", s.notEqual = "notEqual", s))(B || {}), H = /* @__PURE__ */ ((s) => (s.highlightCell = "highlightCell", s.dataBar = "dataBar", s.colorScale = "colorScale", s.iconSet = "iconSet", s))(H || {}), V = /* @__PURE__ */ ((s) => (s.uniqueValues = "uniqueValues", s.duplicateValues = "duplicateValues", s.rank = "rank", s.text = "text", s.timePeriod = "timePeriod", s.number = "number", s.average = "average", s.formula = "formula", s))(V || {}), e2 = /* @__PURE__ */ ((s) => (s.num = "num", s.min = "min", s.max = "max", s.percent = "percent", s.percentile = "percentile", s.formula = "formula", s))(e2 || {});
12
+ const U1 = "#fff", T1 = "#000000", W1 = () => ({
14
13
  cfId: void 0,
15
14
  ranges: [],
16
15
  stopIfTrue: !1,
@@ -20,8 +19,8 @@ const DEFAULT_BG_COLOR = "#fff", DEFAULT_FONT_COLOR = "#000000", createDefaultRu
20
19
  operator: "containsText"
21
20
  /* containsText */
22
21
  }
23
- }), "createDefaultRule"), createDefaultValue = /* @__PURE__ */ __name((subType, operator) => {
24
- switch (subType) {
22
+ }), P1 = (s, n) => {
23
+ switch (s) {
25
24
  case "text": {
26
25
  if ([
27
26
  "beginsWith",
@@ -31,7 +30,7 @@ const DEFAULT_BG_COLOR = "#fff", DEFAULT_FONT_COLOR = "#000000", createDefaultRu
31
30
  "notContainsText",
32
31
  "notEqual"
33
32
  /* notEqual */
34
- ].includes(operator))
33
+ ].includes(n))
35
34
  return "";
36
35
  break;
37
36
  }
@@ -40,11 +39,11 @@ const DEFAULT_BG_COLOR = "#fff", DEFAULT_FONT_COLOR = "#000000", createDefaultRu
40
39
  "between",
41
40
  "notBetween"
42
41
  /* notBetween */
43
- ].includes(operator) ? [10, 100] : 10;
42
+ ].includes(n) ? [10, 100] : 10;
44
43
  }
45
44
  return "";
46
- }, "createDefaultValue"), createDefaultValueByValueType = /* @__PURE__ */ __name((type, defaultValue) => {
47
- switch (type) {
45
+ }, Z1 = (s, n) => {
46
+ switch (s) {
48
47
  case "formula":
49
48
  return "=";
50
49
  case "max":
@@ -53,294 +52,292 @@ const DEFAULT_BG_COLOR = "#fff", DEFAULT_FONT_COLOR = "#000000", createDefaultRu
53
52
  case "percent":
54
53
  case "percentile":
55
54
  case "num":
56
- return defaultValue !== void 0 ? defaultValue : 10;
55
+ return n !== void 0 ? n : 10;
57
56
  }
58
57
  return "";
59
- }, "createDefaultValueByValueType"), createCfId = /* @__PURE__ */ __name(() => `${Tools.generateRandomId(8)}`, "createCfId"), findIndexByAnchor = /* @__PURE__ */ __name((anchor, ruleList, get) => {
60
- if (!ruleList)
58
+ }, S0 = () => `${D2.generateRandomId(8)}`, u2 = (s, n, e) => {
59
+ if (!n)
61
60
  return null;
62
- const anchorIndex = ruleList.findIndex((rule) => get(rule) === anchor.id);
63
- if (anchorIndex < 0)
61
+ const t = n.findIndex((i) => e(i) === s.id);
62
+ if (t < 0)
64
63
  return null;
65
- switch (anchor.type) {
64
+ switch (s.type) {
66
65
  case "after":
67
- return anchorIndex + 1;
66
+ return t + 1;
68
67
  case "before":
69
- return anchorIndex - 1;
68
+ return t - 1;
70
69
  case "self":
71
- return anchorIndex;
70
+ return t;
72
71
  }
73
- }, "findIndexByAnchor"), moveByAnchor = /* @__PURE__ */ __name((start, end, ruleList, get) => {
74
- if (!ruleList)
72
+ }, b0 = (s, n, e, t) => {
73
+ if (!e)
75
74
  return null;
76
- const startIndex = findIndexByAnchor(start, ruleList, get);
77
- let endIndex = findIndexByAnchor(end, ruleList, get);
78
- if (startIndex === null || endIndex === null || startIndex === endIndex)
75
+ const i = u2(s, e, t);
76
+ let r = u2(n, e, t);
77
+ if (i === null || r === null || i === r)
79
78
  return;
80
- const rule = ruleList.splice(startIndex, 1)[0];
81
- switch (startIndex < endIndex && (endIndex = findIndexByAnchor(end, ruleList, get)), end.type) {
79
+ const a = e.splice(i, 1)[0];
80
+ switch (i < r && (r = u2(n, e, t)), n.type) {
82
81
  case "before": {
83
- ruleList.splice(endIndex + 1, 0, rule);
82
+ e.splice(r + 1, 0, a);
84
83
  break;
85
84
  }
86
85
  case "self":
87
86
  case "after": {
88
- ruleList.splice(endIndex, 0, rule);
87
+ e.splice(r, 0, a);
89
88
  break;
90
89
  }
91
90
  }
92
- }, "moveByAnchor"), transformSupportSymmetryAnchor = /* @__PURE__ */ __name((start, end, ruleList, get) => {
93
- if (start.type === "after" && ["after", "before"].includes(end.type))
94
- return [start, end];
95
- const _start = { ...start }, _end = { ...end };
96
- if (_start.type !== "after") {
97
- const index = findIndexByAnchor(_start, ruleList, get);
98
- if (index === null)
91
+ }, I0 = (s, n, e, t) => {
92
+ if (s.type === "after" && ["after", "before"].includes(n.type))
93
+ return [s, n];
94
+ const i = { ...s }, r = { ...n };
95
+ if (i.type !== "after") {
96
+ const a = u2(i, e, t);
97
+ if (a === null)
99
98
  return null;
100
- if (index - 1 < 0) {
101
- const nextItem = ruleList[index + 1];
102
- if (nextItem)
103
- _start.id = get(nextItem), _start.type = "before";
99
+ if (a - 1 < 0) {
100
+ const o = e[a + 1];
101
+ if (o)
102
+ i.id = t(o), i.type = "before";
104
103
  else
105
104
  return null;
106
105
  } else {
107
- const id = get(ruleList[index - 1]);
108
- _start.id = id, _start.type = "after";
106
+ const o = t(e[a - 1]);
107
+ i.id = o, i.type = "after";
109
108
  }
110
109
  }
111
- if (!["after", "before"].includes(_end.type)) {
112
- const index = findIndexByAnchor(_end, ruleList, get);
113
- if (index === null)
110
+ if (!["after", "before"].includes(r.type)) {
111
+ const a = u2(r, e, t);
112
+ if (a === null)
114
113
  return null;
115
- if (index === 0)
116
- _end.type = "before";
117
- else if (index - 1 >= 0) {
118
- const id = get(ruleList[index - 1]);
119
- _end.id = id, _end.type = "after";
120
- } else if (index + 1 <= ruleList.length - 1) {
121
- const id = get(ruleList[index + 1]);
122
- _end.id = id, _end.type = "before";
114
+ if (a === 0)
115
+ r.type = "before";
116
+ else if (a - 1 >= 0) {
117
+ const o = t(e[a - 1]);
118
+ r.id = o, r.type = "after";
119
+ } else if (a + 1 <= e.length - 1) {
120
+ const o = t(e[a + 1]);
121
+ r.id = o, r.type = "before";
123
122
  } else
124
123
  return null;
125
124
  }
126
- return _start.id === _end.id && _start.type === _end.type ? null : [_start, _end];
127
- }, "transformSupportSymmetryAnchor"), anchorUndoFactory = /* @__PURE__ */ __name((start, end) => {
128
- if (["after", "before"].includes(end.type)) {
129
- if (start.type === "after")
130
- return [end, start];
131
- if (start.type === "before")
132
- return [end, { ...start, type: "self" }];
125
+ return i.id === r.id && i.type === r.type ? null : [i, r];
126
+ }, L0 = (s, n) => {
127
+ if (["after", "before"].includes(n.type)) {
128
+ if (s.type === "after")
129
+ return [n, s];
130
+ if (s.type === "before")
131
+ return [n, { ...s, type: "self" }];
133
132
  }
134
133
  return null;
135
- }, "anchorUndoFactory"), isAnchorEqual = /* @__PURE__ */ __name((anchor1, anchor2) => anchor1.id === anchor2.id && anchor1.type === anchor2.type, "isAnchorEqual");
136
- var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
137
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
138
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
139
- return kind && result && __defProp$3(target, key, result), result;
140
- }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a;
141
- let ConditionalFormattingRuleModel = (_a = class {
142
- constructor(_injector) {
134
+ }, q1 = (s, n) => s.id === n.id && s.type === n.type;
135
+ var B0 = Object.defineProperty, k0 = Object.getOwnPropertyDescriptor, $0 = (s, n, e, t) => {
136
+ for (var i = t > 1 ? void 0 : t ? k0(n, e) : n, r = s.length - 1, a; r >= 0; r--)
137
+ (a = s[r]) && (i = (t ? a(n, e, i) : a(i)) || i);
138
+ return t && i && B0(n, e, i), i;
139
+ }, O0 = (s, n) => (e, t) => n(e, t, s);
140
+ let Q = class {
141
+ constructor(s) {
143
142
  // Map<unitID ,<sheetId ,IConditionFormattingRule[]>>
144
- __publicField(this, "_model", /* @__PURE__ */ new Map());
145
- __publicField(this, "_ruleChange$", new Subject());
146
- __publicField(this, "$ruleChange", this._ruleChange$.asObservable().pipe(
147
- bufferTime(16),
148
- filter((list) => !!list.length),
143
+ S(this, "_model", /* @__PURE__ */ new Map());
144
+ S(this, "_ruleChange$", new _2());
145
+ S(this, "$ruleChange", this._ruleChange$.asObservable().pipe(
146
+ Y2(16),
147
+ $2((s) => !!s.length),
149
148
  // Operations for aggregated conditional formatting
150
149
  // Adding and then deleting the same conditional format for multiple times will not result in any changes being propagated externally
151
150
  // When multiple settings are applied to the same conditional format, only the last setting will be propagated externally.
152
- (source) => new Observable((observer) => {
153
- source.subscribe({
154
- next: /* @__PURE__ */ __name((ruleList) => {
155
- const createKey = /* @__PURE__ */ __name((item) => `${item.unitId}_${item.subUnitId}_${item.rule.cfId}`, "createKey"), handleCreateAndDelete = /* @__PURE__ */ __name((list) => {
156
- const createIndex = list.findIndex((rule) => rule.type === "add"), deleteIndex = list.findIndex((rule) => rule.type === "delete");
157
- createIndex !== -1 && deleteIndex !== -1 && deleteIndex > createIndex && list.splice(createIndex, deleteIndex - createIndex + 1);
158
- }, "handleCreateAndDelete"), result = ruleList.reduce((a, b, index) => {
159
- const key = createKey(b);
160
- return a[key] || (a[key] = []), a[key].push({ ...b, _index: index }), a;
151
+ (s) => new u0((n) => {
152
+ s.subscribe({
153
+ next: (e) => {
154
+ const t = (o) => `${o.unitId}_${o.subUnitId}_${o.rule.cfId}`, i = (o) => {
155
+ const l = o.findIndex((h) => h.type === "add"), c = o.findIndex((h) => h.type === "delete");
156
+ l !== -1 && c !== -1 && c > l && o.splice(l, c - l + 1);
157
+ }, r = e.reduce((o, l, c) => {
158
+ const h = t(l);
159
+ return o[h] || (o[h] = []), o[h].push({ ...l, _index: c }), o;
161
160
  }, {});
162
- for (const key in result) {
163
- const list = result[key];
164
- list.length >= 2 && handleCreateAndDelete(list);
161
+ for (const o in r) {
162
+ const l = r[o];
163
+ l.length >= 2 && i(l);
165
164
  }
166
- Object.keys(result).reduce((a, key) => {
167
- const list = result[key];
168
- return a.push(...list), a;
169
- }, []).sort((a, b) => a._index - b._index).map((item) => item).forEach((item) => {
170
- observer.next(item);
165
+ Object.keys(r).reduce((o, l) => {
166
+ const c = r[l];
167
+ return o.push(...c), o;
168
+ }, []).sort((o, l) => o._index - l._index).map((o) => o).forEach((o) => {
169
+ n.next(o);
171
170
  });
172
- }, "next"),
173
- error: /* @__PURE__ */ __name((err) => observer.error(err), "error"),
174
- complete: /* @__PURE__ */ __name(() => observer.complete(), "complete")
171
+ },
172
+ error: (e) => n.error(e),
173
+ complete: () => n.complete()
175
174
  });
176
175
  })
177
176
  ));
178
- this._injector = _injector;
179
- }
180
- _ensureList(unitId, subUnitId) {
181
- let list = this.getSubunitRules(unitId, subUnitId);
182
- if (!list) {
183
- list = [];
184
- let unitMap = this._model.get(unitId);
185
- unitMap || (unitMap = /* @__PURE__ */ new Map(), this._model.set(unitId, unitMap)), unitMap.set(subUnitId, list);
177
+ this._injector = s;
178
+ }
179
+ _ensureList(s, n) {
180
+ let e = this.getSubunitRules(s, n);
181
+ if (!e) {
182
+ e = [];
183
+ let t = this._model.get(s);
184
+ t || (t = /* @__PURE__ */ new Map(), this._model.set(s, t)), t.set(n, e);
186
185
  }
187
- return list;
186
+ return e;
188
187
  }
189
- getRule(unitId, subUnitId, cfId) {
190
- const list = this.getSubunitRules(unitId, subUnitId);
191
- return list ? list.find((item) => item.cfId === cfId) : null;
188
+ getRule(s, n, e) {
189
+ const t = this.getSubunitRules(s, n);
190
+ return t ? t.find((i) => i.cfId === e) : null;
192
191
  }
193
- getUnitRules(unitId) {
194
- return this._model.get(unitId) || null;
192
+ getUnitRules(s) {
193
+ return this._model.get(s) || null;
195
194
  }
196
- getSubunitRules(unitId, subUnitId) {
197
- var _a5;
198
- return ((_a5 = this._model.get(unitId)) == null ? void 0 : _a5.get(subUnitId)) || null;
195
+ getSubunitRules(s, n) {
196
+ var t;
197
+ return ((t = this._model.get(s)) == null ? void 0 : t.get(n)) || null;
199
198
  }
200
- deleteRule(unitId, subUnitId, cfId) {
201
- const list = this.getSubunitRules(unitId, subUnitId);
202
- if (list) {
203
- const index = list.findIndex((e) => e.cfId === cfId), rule = list[index];
204
- rule && (list.splice(index, 1), this._ruleChange$.next({ rule, subUnitId, unitId, type: "delete" }));
199
+ deleteRule(s, n, e) {
200
+ const t = this.getSubunitRules(s, n);
201
+ if (t) {
202
+ const i = t.findIndex((a) => a.cfId === e), r = t[i];
203
+ r && (t.splice(i, 1), this._ruleChange$.next({ rule: r, subUnitId: n, unitId: s, type: "delete" }));
205
204
  }
206
205
  }
207
- setRule(unitId, subUnitId, rule, oldCfId) {
208
- const oldRule = this._ensureList(unitId, subUnitId).find((item) => item.cfId === oldCfId);
209
- if (oldRule) {
210
- const cloneRule = Tools.deepClone(oldRule);
211
- Object.assign(oldRule, rule), this._ruleChange$.next({ rule: oldRule, subUnitId, unitId, type: "set", oldRule: cloneRule });
206
+ setRule(s, n, e, t) {
207
+ const r = this._ensureList(s, n).find((a) => a.cfId === t);
208
+ if (r) {
209
+ const a = D2.deepClone(r);
210
+ Object.assign(r, e), this._ruleChange$.next({ rule: r, subUnitId: n, unitId: s, type: "set", oldRule: a });
212
211
  }
213
212
  }
214
- addRule(unitId, subUnitId, rule) {
215
- const list = this._ensureList(unitId, subUnitId);
216
- list.find((item2) => item2.cfId === rule.cfId) || list.unshift(rule), this._ruleChange$.next({ rule, subUnitId, unitId, type: "add" });
213
+ addRule(s, n, e) {
214
+ const t = this._ensureList(s, n);
215
+ t.find((r) => r.cfId === e.cfId) || t.unshift(e), this._ruleChange$.next({ rule: e, subUnitId: n, unitId: s, type: "add" });
217
216
  }
218
217
  /**
219
218
  * example [1,2,3,4,5,6],if you move behind 5 to 2, then cfId=5,targetId=2.
220
219
  * if targetId does not exist, it defaults to top
221
220
  */
222
- moveRulePriority(unitId, subUnitId, start, end) {
223
- const list = this._ensureList(unitId, subUnitId), curIndex = findIndexByAnchor(start, list, (rule2) => rule2.cfId), targetCfIndex = findIndexByAnchor(end, list, (rule2) => rule2.cfId);
224
- if (targetCfIndex === null || curIndex === null || targetCfIndex === curIndex)
221
+ moveRulePriority(s, n, e, t) {
222
+ const i = this._ensureList(s, n), r = u2(e, i, (l) => l.cfId), a = u2(t, i, (l) => l.cfId);
223
+ if (a === null || r === null || a === r)
225
224
  return;
226
- const rule = list[curIndex];
227
- rule && (moveByAnchor(start, end, list, (rule2) => rule2.cfId), this._ruleChange$.next({ rule, subUnitId, unitId, type: "sort" }));
225
+ const o = i[r];
226
+ o && (b0(e, t, i, (l) => l.cfId), this._ruleChange$.next({ rule: o, subUnitId: n, unitId: s, type: "sort" }));
228
227
  }
229
- createCfId(_unitId, _subUnitId) {
230
- return createCfId();
228
+ createCfId(s, n) {
229
+ return S0();
231
230
  }
232
- deleteUnitId(unitId) {
233
- this._model.delete(unitId);
231
+ deleteUnitId(s) {
232
+ this._model.delete(s);
234
233
  }
235
- }, __name(_a, "ConditionalFormattingRuleModel"), _a);
236
- ConditionalFormattingRuleModel = __decorateClass$3([
237
- __decorateParam$3(0, Inject(Injector))
238
- ], ConditionalFormattingRuleModel);
239
- const _ConditionalFormattingViewModel = class _ConditionalFormattingViewModel {
234
+ };
235
+ Q = $0([
236
+ O0(0, T(S2))
237
+ ], Q);
238
+ class I2 {
240
239
  constructor() {
241
240
  // Map<unitID ,<sheetId ,ObjectMatrix>>
242
- __publicField(this, "_model", /* @__PURE__ */ new Map());
243
- __publicField(this, "_markDirty$", new Subject());
244
- __publicField(this, "markDirty$", this._markDirty$.asObservable());
245
- }
246
- _ensureMatrix(unitId, subUnitId) {
247
- let _matrix = this.getMatrix(unitId, subUnitId);
248
- if (!_matrix) {
249
- _matrix = new ObjectMatrix();
250
- let unitModel = this._model.get(unitId);
251
- unitModel || (unitModel = /* @__PURE__ */ new Map(), this._model.set(unitId, unitModel)), unitModel.set(subUnitId, _matrix);
241
+ S(this, "_model", /* @__PURE__ */ new Map());
242
+ S(this, "_markDirty$", new _2());
243
+ S(this, "markDirty$", this._markDirty$.asObservable());
244
+ }
245
+ _ensureMatrix(n, e) {
246
+ let t = this.getMatrix(n, e);
247
+ if (!t) {
248
+ t = new j();
249
+ let i = this._model.get(n);
250
+ i || (i = /* @__PURE__ */ new Map(), this._model.set(n, i)), i.set(e, t);
252
251
  }
253
- return _matrix;
254
- }
255
- getMatrix(unitId, subUnitId) {
256
- var _a5;
257
- return (_a5 = this._model.get(unitId)) == null ? void 0 : _a5.get(subUnitId);
258
- }
259
- getCellCf(unitId, subUnitId, row, col, matrix) {
260
- const _matrix = matrix != null ? matrix : this.getMatrix(unitId, subUnitId);
261
- return _matrix ? _matrix.getValue(row, col) : null;
262
- }
263
- setCellCfRuleCache(unitId, subUnitId, row, col, cfId, value) {
264
- const cell2 = this._ensureMatrix(unitId, subUnitId).getValue(row, col), item = cell2 == null ? void 0 : cell2.cfList.find((e) => e.cfId === cfId);
265
- item && (item.ruleCache = value, item.isDirty = !1);
266
- }
267
- deleteCellCf(unitId, subUnitId, row, col, cfId, matrix) {
268
- const _matrix = matrix != null ? matrix : this.getMatrix(unitId, subUnitId);
269
- if (_matrix) {
270
- const cellItem = _matrix.getValue(row, col);
271
- if (cellItem) {
272
- const cfList = cellItem.cfList, index = cfList.findIndex((item) => item.cfId === cfId);
273
- index > -1 && cfList.splice(index, 1), cfList.length || _matrix.realDeleteValue(row, col);
252
+ return t;
253
+ }
254
+ getMatrix(n, e) {
255
+ var t;
256
+ return (t = this._model.get(n)) == null ? void 0 : t.get(e);
257
+ }
258
+ getCellCf(n, e, t, i, r) {
259
+ const a = r != null ? r : this.getMatrix(n, e);
260
+ return a ? a.getValue(t, i) : null;
261
+ }
262
+ setCellCfRuleCache(n, e, t, i, r, a) {
263
+ const l = this._ensureMatrix(n, e).getValue(t, i), c = l == null ? void 0 : l.cfList.find((h) => h.cfId === r);
264
+ c && (c.ruleCache = a, c.isDirty = !1);
265
+ }
266
+ deleteCellCf(n, e, t, i, r, a) {
267
+ const o = a != null ? a : this.getMatrix(n, e);
268
+ if (o) {
269
+ const l = o.getValue(t, i);
270
+ if (l) {
271
+ const c = l.cfList, h = c.findIndex((u) => u.cfId === r);
272
+ h > -1 && c.splice(h, 1), c.length || o.realDeleteValue(t, i);
274
273
  }
275
274
  }
276
275
  }
277
- pushCellCf(unitId, subUnitId, row, col, cfId) {
278
- const _matrix = this._ensureMatrix(unitId, subUnitId);
279
- let cellValue = _matrix.getValue(row, col);
280
- if (!cellValue)
281
- cellValue = { cfList: [{ cfId, isDirty: !0 }] };
276
+ pushCellCf(n, e, t, i, r) {
277
+ const a = this._ensureMatrix(n, e);
278
+ let o = a.getValue(t, i);
279
+ if (!o)
280
+ o = { cfList: [{ cfId: r, isDirty: !0 }] };
282
281
  else {
283
- const cfIdList = cellValue.cfList;
284
- if (cfIdList.findIndex((item) => item.cfId === cfId) > -1)
282
+ const l = o.cfList;
283
+ if (l.findIndex((h) => h.cfId === r) > -1)
285
284
  return;
286
- cfIdList.push({ cfId, isDirty: !0 });
285
+ l.push({ cfId: r, isDirty: !0 });
287
286
  }
288
- _matrix.setValue(row, col, cellValue);
289
- }
290
- sortCellCf(unitId, subUnitId, row, col, cfPriorityMap) {
291
- const cell2 = this.getCellCf(unitId, subUnitId, row, col);
292
- if (cell2) {
293
- const sortResult = cell2.cfList.map((cf) => {
294
- const priority = cfPriorityMap.get(cf.cfId);
295
- return priority === void 0 ? null : { ...cf, priority };
296
- }).filter((item) => !!item).sort((a, b) => a.priority - b.priority);
297
- cell2.cfList = sortResult;
287
+ a.setValue(t, i, o);
288
+ }
289
+ sortCellCf(n, e, t, i, r) {
290
+ const a = this.getCellCf(n, e, t, i);
291
+ if (a) {
292
+ const o = a.cfList.map((l) => {
293
+ const c = r.get(l.cfId);
294
+ return c === void 0 ? null : { ...l, priority: c };
295
+ }).filter((l) => !!l).sort((l, c) => l.priority - c.priority);
296
+ a.cfList = o;
298
297
  }
299
298
  }
300
- markRuleDirty(unitId, subUnitId, rule, row, col) {
301
- const handleCell = /* @__PURE__ */ __name((row2, col2) => {
302
- const cell2 = this.getCellCf(unitId, subUnitId, row2, col2);
303
- if (cell2) {
304
- const ruleItem = cell2.cfList.find((item) => item.cfId === rule.cfId);
305
- ruleItem && (ruleItem.isDirty = !0);
299
+ markRuleDirty(n, e, t, i, r) {
300
+ const a = (o, l) => {
301
+ const c = this.getCellCf(n, e, o, l);
302
+ if (c) {
303
+ const h = c.cfList.find((u) => u.cfId === t.cfId);
304
+ h && (h.isDirty = !0);
306
305
  }
307
- }, "handleCell");
308
- row !== void 0 && col !== void 0 ? (handleCell(row, col), this._markDirty$.next({ rule, unitId, subUnitId })) : (rule.ranges.forEach((range) => {
309
- Range.foreach(range, (row2, col2) => {
310
- handleCell(row2, col2);
306
+ };
307
+ i !== void 0 && r !== void 0 ? (a(i, r), this._markDirty$.next({ rule: t, unitId: n, subUnitId: e })) : (t.ranges.forEach((o) => {
308
+ q.foreach(o, (l, c) => {
309
+ a(l, c);
311
310
  });
312
- }), this._markDirty$.next({ rule, unitId, subUnitId }));
311
+ }), this._markDirty$.next({ rule: t, unitId: n, subUnitId: e }));
313
312
  }
314
- };
315
- __name(_ConditionalFormattingViewModel, "ConditionalFormattingViewModel");
316
- let ConditionalFormattingViewModel = _ConditionalFormattingViewModel;
317
- const feedback = {
313
+ }
314
+ const V0 = {
318
315
  mistake: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%227.03704%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.87359%206.87332C6.6146%207.13231%206.6146%207.55221%206.87359%207.8112L9.062%209.99961L6.87356%2012.188C6.61457%2012.447%206.61457%2012.8669%206.87356%2013.1259C7.13255%2013.3849%207.55245%2013.3849%207.81144%2013.1259L9.99987%2010.9375L12.1882%2013.1258C12.4472%2013.3848%2012.8671%2013.3848%2013.1261%2013.1258C13.3851%2012.8669%2013.3851%2012.447%2013.1261%2012.188L10.9378%209.99961L13.1261%207.81127C13.3851%207.55228%2013.3851%207.13238%2013.1261%206.87339C12.8671%206.61441%2012.4472%206.61441%2012.1882%206.87339L9.99987%209.06173L7.81147%206.87332C7.55248%206.61433%207.13257%206.61433%206.87359%206.87332Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",
319
316
  warn: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%227.03704%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Cpath%20d%3D%22M9.16817%206.67735C9.16646%206.61745%209.1656%206.5875%209.16653%206.56236C9.18103%206.16817%209.49136%205.84883%209.88497%205.82306C9.91008%205.82141%209.94004%205.82141%209.99996%205.82141V5.82141C10.0599%205.82141%2010.0899%205.82141%2010.115%205.82306C10.5086%205.84883%2010.8189%206.16817%2010.8334%206.56236C10.8343%206.5875%2010.8335%206.61745%2010.8318%206.67735L10.7043%2011.131C10.6934%2011.5121%2010.3812%2011.8154%209.99995%2011.8154V11.8154C9.61866%2011.8154%209.30655%2011.5121%209.29564%2011.131L9.16817%206.67735Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3Crect%20x%3D%229.31488%22%20y%3D%2212.8086%22%20width%3D%221.37006%22%20height%3D%221.37006%22%20rx%3D%220.685032%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",
320
317
  correct: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M17.037%2010C17.037%2013.8865%2013.8864%2017.0371%209.99999%2017.0371C6.11354%2017.0371%202.96295%2013.8865%202.96295%2010C2.96295%206.1136%206.11354%202.96301%209.99999%202.96301C13.8864%202.96301%2017.037%206.1136%2017.037%2010Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3Cpath%20d%3D%22M13.9239%207.17477C13.6638%206.91472%2013.2422%206.91472%2012.9821%207.17477L8.74433%2011.4126L7.01786%209.6861C6.75781%209.42606%206.33619%209.42606%206.07614%209.6861C5.81609%209.94615%205.81609%2010.3678%206.07614%2010.6278L8.27349%2012.8252C8.53354%2013.0852%208.95516%2013.0852%209.21521%2012.8252L9.2195%2012.8209L13.9239%208.1165C14.1839%207.85645%2014.1839%207.43482%2013.9239%207.17477Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A"
321
- }, star = {
318
+ }, N0 = {
322
319
  starEmpty: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.8451%207.0699%2012.2165%207.33978%2012.6421%207.36863L16.2362%207.61233C16.5693%207.63492%2016.7048%208.05202%2016.4486%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.215%2011.2859%2013.319%2011.6996L14.1979%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6418%2015.5971L10.5908%2013.6817C10.2296%2013.4549%209.77045%2013.4549%209.40924%2013.6817L6.35828%2015.5971C6.07553%2015.7746%205.72072%2015.5168%205.80217%2015.1931L6.68105%2011.6996C6.7851%2011.2859%206.64322%2010.8493%206.31592%2010.5758L3.55145%208.26607C3.29525%208.05202%203.43078%207.63492%203.76386%207.61233L7.358%207.36863C7.78352%207.33978%208.15498%207.0699%208.31391%206.67412L9.65633%203.3312C9.78074%203.0214%2010.2193%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23fff%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A",
323
320
  starIncomplete: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20clip-path%3D%22url(%23clip0_613_177)%22%3E%0A%3Cmask%20id%3D%22mask0_613_177%22%20style%3D%22mask-type%3Aalpha%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%2210%22%20y%3D%220%22%20width%3D%2210%22%20height%3D%2220%22%3E%0A%3Crect%20x%3D%2210.3704%22%20y%3D%220.37037%22%20width%3D%229.25926%22%20height%3D%2219.2593%22%20fill%3D%22%23C4C4C4%22%20stroke%3D%22%23F7D564%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fmask%3E%0A%3Cg%20mask%3D%22url(%23mask0_613_177)%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.845%207.0699%2012.2165%207.33978%2012.642%207.36863L16.2361%207.61233C16.5692%207.63492%2016.7047%208.05202%2016.4485%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.2149%2011.2859%2013.3189%2011.6996L14.1978%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6417%2015.5971L10.5908%2013.6817C10.2295%2013.4549%209.77039%2013.4549%209.40918%2013.6817L6.35822%2015.5971C6.07547%2015.7746%205.72066%2015.5168%205.80211%2015.1931L6.68098%2011.6996C6.78504%2011.2859%206.64316%2010.8493%206.31586%2010.5758L3.55139%208.26607C3.29519%208.05202%203.43072%207.63492%203.7638%207.61233L7.35793%207.36863C7.78346%207.33978%208.15491%207.0699%208.31385%206.67412L9.65627%203.3312C9.78068%203.0214%2010.2192%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23fff%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fg%3E%0A%3Cmask%20id%3D%22mask1_613_177%22%20style%3D%22mask-type%3Aalpha%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%220%22%20y%3D%220%22%20width%3D%2210%22%20height%3D%2220%22%3E%0A%3Crect%20width%3D%2210%22%20height%3D%2220%22%20fill%3D%22%23C4C4C4%22%2F%3E%0A%3C%2Fmask%3E%0A%3Cg%20mask%3D%22url(%23mask1_613_177)%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.845%207.0699%2012.2165%207.33978%2012.642%207.36863L16.2361%207.61233C16.5692%207.63492%2016.7047%208.05202%2016.4485%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.2149%2011.2859%2013.3189%2011.6996L14.1978%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6417%2015.5971L10.5908%2013.6817C10.2295%2013.4549%209.77039%2013.4549%209.40918%2013.6817L6.35822%2015.5971C6.07547%2015.7746%205.72066%2015.5168%205.80211%2015.1931L6.68098%2011.6996C6.78504%2011.2859%206.64316%2010.8493%206.31586%2010.5758L3.55139%208.26607C3.29519%208.05202%203.43072%207.63492%203.7638%207.61233L7.35793%207.36863C7.78346%207.33978%208.15491%207.0699%208.31385%206.67412L9.65627%203.3312C9.78068%203.0214%2010.2192%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fg%3E%0A%3Cdefs%3E%0A%3CclipPath%20id%3D%22clip0_613_177%22%3E%0A%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%2F%3E%0A%3C%2FclipPath%3E%0A%3C%2Fdefs%3E%0A%3C%2Fsvg%3E%0A",
324
321
  starFull: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.8451%207.0699%2012.2165%207.33978%2012.6421%207.36863L16.2362%207.61233C16.5693%207.63492%2016.7048%208.05202%2016.4486%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.215%2011.2859%2013.319%2011.6996L14.1979%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6418%2015.5971L10.5908%2013.6817C10.2296%2013.4549%209.77045%2013.4549%209.40924%2013.6817L6.35828%2015.5971C6.07553%2015.7746%205.72072%2015.5168%205.80217%2015.1931L6.68105%2011.6996C6.7851%2011.2859%206.64322%2010.8493%206.31592%2010.5758L3.55145%208.26607C3.29525%208.05202%203.43078%207.63492%203.76386%207.61233L7.358%207.36863C7.78352%207.33978%208.15498%207.0699%208.31391%206.67412L9.65633%203.3312C9.78074%203.0214%2010.2193%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A"
325
- }, progress = {
322
+ }, U0 = {
326
323
  progress0: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A",
327
324
  progress25: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M16.2963%209.99991C16.2963%209.17307%2016.1335%208.35432%2015.8171%207.59042C15.5006%206.82652%2015.0369%206.13242%2014.4522%205.54776C13.8675%204.96309%2013.1734%204.49931%2012.4095%204.18289C11.6456%203.86647%2010.8269%203.70361%2010%203.70361L10%209.99991H16.2963Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A",
328
325
  progress50: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M10%2016.2962C11.6699%2016.2962%2013.2714%2015.6328%2014.4522%2014.4521C15.633%2013.2713%2016.2963%2011.6698%2016.2963%209.99991C16.2963%208.33003%2015.633%206.72854%2014.4522%205.54776C13.2714%204.36697%2011.6699%203.70361%2010%203.70361L10%209.99991L10%2016.2962Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A",
329
326
  progress75: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M3.70374%209.99991C3.70374%2011.2452%204.07301%2012.4625%204.76485%2013.4979C5.4567%2014.5334%206.44005%2015.3404%207.59054%2015.8169C8.74104%2016.2935%2010.007%2016.4182%2011.2284%2016.1752C12.4497%2015.9323%2013.5716%2015.3326%2014.4522%2014.4521C15.3327%2013.5715%2015.9324%2012.4496%2016.1753%2011.2283C16.4183%2010.0069%2016.2936%208.74092%2015.8171%207.59042C15.3405%206.43992%2014.5335%205.45658%2013.4981%204.76473C12.4626%204.07288%2011.2453%203.70361%2010%203.70361L10%209.99991L3.70374%209.99991Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A",
330
327
  progress100: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99991%22%20r%3D%226.2963%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A"
331
- }, signal = {
328
+ }, T0 = {
332
329
  signal0: "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%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
333
330
  signal25: "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%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A",
334
331
  signal50: "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%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A",
335
332
  signal75: "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%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A",
336
333
  signal100: "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%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93933%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70447%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A"
337
- }, feeling = {
334
+ }, W0 = {
338
335
  guffaw: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M16.887%2010C16.887%2013.8037%2013.8036%2016.8871%209.99999%2016.8871C6.19638%2016.8871%203.11295%2013.8037%203.11295%2010C3.11295%206.19644%206.19638%203.11301%209.99999%203.11301C13.8036%203.11301%2016.887%206.19644%2016.887%2010Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M12.5355%2013.5821C13.0482%2013.1841%2013.3951%2012.6107%2013.5405%2012.0327C13.5934%2011.8226%2013.5051%2011.6349%2013.3518%2011.5331C13.2036%2011.4346%2013.0031%2011.4203%2012.8265%2011.5131C11.0615%2012.4407%208.94609%2012.4427%207.1828%2011.513C7.00629%2011.4199%206.80602%2011.4343%206.65798%2011.5329C6.50518%2011.6346%206.41701%2011.8217%206.46844%2012.0312C6.61029%2012.609%206.95079%2013.1833%207.46449%2013.5821C8.14361%2014.1093%209.05608%2014.3999%2010%2014.3999C10.9439%2014.3999%2011.8564%2014.1093%2012.5355%2013.5821Z%22%20fill%3D%22white%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.4%22%2F%3E%0A%3C%2Fsvg%3E%0A",
339
336
  smile: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2011.8518C7.03705%2011.8518%207.77779%2013.7037%2010%2013.7037C12.2222%2013.7037%2012.963%2011.8518%2012.963%2011.8518%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",
340
337
  noninductive: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.9259%22%20width%3D%221.48148%22%20height%3D%221.11111%22%20rx%3D%220.555556%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.9259%22%20width%3D%221.48148%22%20height%3D%221.11111%22%20rx%3D%220.555556%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2012.5927C7.03705%2012.5927%208.14816%2012.5927%2010.3704%2012.5927C12.5926%2012.5927%2012.963%2012.5927%2012.963%2012.5927%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",
341
338
  dissatisfied: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2013.7037C7.03705%2013.7037%207.77779%2011.8519%2010%2011.8519C12.2222%2011.8519%2012.963%2013.7037%2012.963%2013.7037%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",
342
339
  impatient: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.47573%2011.731C6.96306%2012.129%206.61613%2012.7024%206.47071%2013.2804C6.41784%2013.4905%206.50617%2013.6782%206.65942%2013.78C6.80761%2013.8785%207.00813%2013.8928%207.18477%2013.8C8.9498%2012.8724%2011.0652%2012.8704%2012.8285%2013.8002C13.005%2013.8932%2013.2052%2013.8788%2013.3533%2013.7802C13.5061%2013.6785%2013.5942%2013.4914%2013.5428%2013.2819C13.401%2012.7041%2013.0605%2012.1298%2012.5468%2011.731C11.8676%2011.2038%2010.9552%2010.9132%2010.0112%2010.9132C9.06732%2010.9132%208.15485%2011.2038%207.47573%2011.731Z%22%20fill%3D%22white%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.4%22%2F%3E%0A%3C%2Fsvg%3E%0A"
343
- }, arrow = {
340
+ }, P0 = {
344
341
  "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",
345
342
  "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",
346
343
  "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",
@@ -351,7 +348,7 @@ const feedback = {
351
348
  "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",
352
349
  "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",
353
350
  "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"
354
- }, shape = {
351
+ }, Z0 = {
355
352
  cross: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223.70374%22%20y%3D%228.14795%22%20width%3D%2212.5926%22%20height%3D%223.7037%22%20rx%3D%220.740741%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
356
353
  up: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M9.44533%205.81157C9.74012%205.47858%2010.2598%205.47858%2010.5546%205.81157L16.2868%2012.2867C16.71%2012.7647%2016.3706%2013.5184%2015.7322%2013.5184H4.26776C3.62933%2013.5184%203.28995%2012.7647%203.71313%2012.2867L9.44533%205.81157Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
357
354
  down: "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.5547%2014.1884C10.2599%2014.5214%209.74019%2014.5214%209.4454%2014.1884L3.71321%207.71335C3.29002%207.23532%203.6294%206.48161%204.26784%206.48161L15.7322%206.48161C16.3707%206.48161%2016.7101%207.23532%2016.2869%207.71335L10.5547%2014.1884Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",
@@ -367,42 +364,42 @@ const feedback = {
367
364
  "indicate-greed": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
368
365
  "indicate-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
369
366
  "indicate-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"
370
- }, feedback2 = {
367
+ }, q0 = {
371
368
  mistake2: "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.12194%206.33702C4.1805%206.47839%204.30722%206.6051%204.56066%206.85854L8.36822%2010.6661L4.56062%2014.4737C4.30718%2014.7272%204.18046%2014.8539%204.12191%2014.9952C4.04384%2015.1837%204.04384%2015.3955%204.12191%2015.584C4.18046%2015.7253%204.30718%2015.8521%204.56062%2016.1055C4.81406%2016.3589%204.94078%2016.4857%205.08214%2016.5442C5.27062%2016.6223%205.4824%2016.6223%205.67089%2016.5442C5.81225%2016.4857%205.93897%2016.3589%206.19241%2016.1055L10%2012.2979L13.8074%2016.1053C14.0609%2016.3588%2014.1876%2016.4855%2014.329%2016.544C14.5174%2016.6221%2014.7292%2016.6221%2014.9177%2016.544C15.0591%2016.4855%2015.1858%2016.3588%2015.4392%2016.1053L15.4392%2016.1053C15.6927%2015.8519%2015.8194%2015.7252%2015.8779%2015.5838C15.956%2015.3953%2015.956%2015.1835%2015.8779%2014.9951C15.8194%2014.8537%2015.6927%2014.727%2015.4392%2014.4735L15.4392%2014.4735L11.6318%2010.6661L15.4392%206.85872C15.6926%206.60528%2015.8193%206.47856%2015.8779%206.3372C15.956%206.14871%2015.956%205.93694%2015.8779%205.74845C15.8193%205.60709%2015.6926%205.48037%2015.4392%205.22693C15.1857%204.97349%2015.059%204.84677%2014.9177%204.78822C14.7292%204.71015%2014.5174%204.71015%2014.3289%204.78822C14.1876%204.84677%2014.0608%204.97349%2013.8074%205.22693L10%209.03433L6.19244%205.22676C5.939%204.97332%205.81228%204.8466%205.67092%204.78805C5.48244%204.70997%205.27066%204.70997%205.08218%204.78805C4.94082%204.8466%204.8141%204.97332%204.56066%205.22676L4.56066%205.22676C4.30722%205.4802%204.1805%205.60692%204.12194%205.74828C4.04387%205.93676%204.04387%206.14854%204.12194%206.33702Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",
372
369
  warn2: "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%20d%3D%22M8.49778%205.00963C8.48513%204.56774%208.47881%204.3468%208.56086%204.17746C8.63301%204.02856%208.75124%203.90689%208.89802%203.83052C9.06494%203.74365%209.28597%203.74365%209.72805%203.74365H10.272C10.714%203.74365%2010.9351%203.74365%2011.102%203.83052C11.2488%203.9069%2011.367%204.02856%2011.4392%204.17746C11.5212%204.3468%2011.5149%204.56775%2011.5022%205.00964L11.2644%2013.3173C11.2524%2013.737%2011.2464%2013.9468%2011.1609%2014.1065C11.0857%2014.2471%2010.9687%2014.3609%2010.826%2014.432C10.6639%2014.5129%2010.454%2014.5129%2010.0342%2014.5129H9.96582C9.54601%2014.5129%209.33611%2014.5129%209.17397%2014.432C9.0313%2014.3609%208.91426%2014.2471%208.83904%2014.1065C8.75357%2013.9468%208.74756%2013.737%208.73555%2013.3173L8.49778%205.00963Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Crect%20x%3D%228.76917%22%20y%3D%2215.2817%22%20width%3D%222.46154%22%20height%3D%222.46154%22%20rx%3D%220.769231%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
373
370
  correct2: "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%3Cg%20clip-path%3D%22url(%23clip0_613_248)%22%3E%0A%3Cpath%20d%3D%22M15.689%205.69723C15.5476%205.75578%2015.4209%205.8825%2015.1675%206.13594L7.82436%2013.4791L4.83279%2010.4875C4.57935%2010.2341%204.45263%2010.1073%204.31127%2010.0488C4.12278%209.97071%203.91101%209.97071%203.72252%2010.0488C3.58116%2010.1073%203.45444%2010.2341%203.201%2010.4875C2.94756%2010.7409%202.82084%2010.8676%202.76229%2011.009C2.68422%2011.1975%202.68422%2011.4093%202.76229%2011.5978C2.82084%2011.7391%202.94756%2011.8658%203.201%2012.1193L7.0085%2015.9268C7.26194%2016.1802%207.38866%2016.3069%207.53002%2016.3655C7.7185%2016.4436%207.93028%2016.4436%208.11876%2016.3655C8.26013%2016.3069%208.38685%2016.1802%208.64028%2015.9268C8.66387%2015.9032%208.68636%2015.8807%208.7078%2015.8592L16.7993%207.76772C17.0527%207.51428%2017.1794%207.38756%2017.238%207.2462C17.3161%207.05772%2017.3161%206.84594%2017.238%206.65746C17.1794%206.5161%2017.0527%206.38938%2016.7993%206.13594C16.5458%205.8825%2016.4191%205.75578%2016.2777%205.69723C16.0893%205.61915%2015.8775%205.61915%2015.689%205.69723Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fg%3E%0A%3Cdefs%3E%0A%3CclipPath%20id%3D%22clip0_613_248%22%3E%0A%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%20transform%3D%22translate(0%200.666504)%22%2F%3E%0A%3C%2FclipPath%3E%0A%3C%2Fdefs%3E%0A%3C%2Fsvg%3E%0A"
374
- }, flag = {
371
+ }, j0 = {
375
372
  "flag-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%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
376
373
  "flag-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%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
377
374
  "flag-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%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"
378
- }, cell = {
375
+ }, H0 = {
379
376
  "cell-0": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
380
377
  "cell-25": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
381
378
  "cell-50": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
382
379
  "cell-75": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
383
380
  "cell-100": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A"
384
- }, ICON_MAP = {
385
- feedback,
386
- star,
387
- progress,
388
- signal,
389
- feeling,
390
- arrow,
391
- shape,
392
- feedback2,
393
- flag,
394
- cell
395
- }, iconGroup = [
381
+ }, C = {
382
+ feedback: V0,
383
+ star: N0,
384
+ progress: U0,
385
+ signal: T0,
386
+ feeling: W0,
387
+ arrow: P0,
388
+ shape: Z0,
389
+ feedback2: q0,
390
+ flag: j0,
391
+ cell: H0
392
+ }, Y0 = [
396
393
  {
397
394
  title: "sheet.cf.iconSet.direction",
398
395
  group: [
399
- { name: "3Arrows", list: [ICON_MAP.arrow["up-green"], ICON_MAP.arrow["right-gold"], ICON_MAP.arrow["down-red"]] },
400
- { name: "3ArrowsGray", list: [ICON_MAP.arrow["up-gray"], ICON_MAP.arrow["right-gray"], ICON_MAP.arrow["down-gray"]] },
401
- { name: "4Arrows", list: [ICON_MAP.arrow["up-green"], ICON_MAP.arrow["rightAndUp-gold"], ICON_MAP.arrow["rightAndDown-gold"], ICON_MAP.arrow["down-red"]] },
402
- { name: "4ArrowsGray", list: [ICON_MAP.arrow["up-gray"], ICON_MAP.arrow["rightAndUp-gray"], ICON_MAP.arrow["rightAndDown-gray"], ICON_MAP.arrow["down-gray"]] },
403
- { name: "5Arrows", list: [ICON_MAP.arrow["up-green"], ICON_MAP.arrow["rightAndUp-gold"], ICON_MAP.arrow["right-gold"], ICON_MAP.arrow["rightAndDown-gold"], ICON_MAP.arrow["down-red"]] },
404
- { name: "5ArrowsGray", list: [ICON_MAP.arrow["up-gray"], ICON_MAP.arrow["rightAndUp-gray"], ICON_MAP.arrow["right-gray"], ICON_MAP.arrow["rightAndDown-gray"], ICON_MAP.arrow["down-gray"]] },
405
- { name: "3Triangles", list: [ICON_MAP.shape.up, ICON_MAP.shape.cross, ICON_MAP.shape.down] }
396
+ { name: "3Arrows", list: [C.arrow["up-green"], C.arrow["right-gold"], C.arrow["down-red"]] },
397
+ { name: "3ArrowsGray", list: [C.arrow["up-gray"], C.arrow["right-gray"], C.arrow["down-gray"]] },
398
+ { name: "4Arrows", list: [C.arrow["up-green"], C.arrow["rightAndUp-gold"], C.arrow["rightAndDown-gold"], C.arrow["down-red"]] },
399
+ { name: "4ArrowsGray", list: [C.arrow["up-gray"], C.arrow["rightAndUp-gray"], C.arrow["rightAndDown-gray"], C.arrow["down-gray"]] },
400
+ { name: "5Arrows", list: [C.arrow["up-green"], C.arrow["rightAndUp-gold"], C.arrow["right-gold"], C.arrow["rightAndDown-gold"], C.arrow["down-red"]] },
401
+ { name: "5ArrowsGray", list: [C.arrow["up-gray"], C.arrow["rightAndUp-gray"], C.arrow["right-gray"], C.arrow["rightAndDown-gray"], C.arrow["down-gray"]] },
402
+ { name: "3Triangles", list: [C.shape.up, C.shape.cross, C.shape.down] }
406
403
  ]
407
404
  },
408
405
  {
@@ -410,20 +407,20 @@ const feedback = {
410
407
  group: [
411
408
  {
412
409
  name: "3TrafficLights1",
413
- list: [ICON_MAP.shape["roundness-greed"], ICON_MAP.shape["roundness-gold"], ICON_MAP.shape["roundness-red"]]
410
+ list: [C.shape["roundness-greed"], C.shape["roundness-gold"], C.shape["roundness-red"]]
414
411
  },
415
412
  {
416
413
  name: "3Signs",
417
- list: [ICON_MAP.shape["roundness-greed"], ICON_MAP.shape["triangle-gold"], ICON_MAP.shape["rhomboid-red"]]
414
+ list: [C.shape["roundness-greed"], C.shape["triangle-gold"], C.shape["rhomboid-red"]]
418
415
  },
419
- { name: "3TrafficLights2", list: [ICON_MAP.shape["indicate-greed"], ICON_MAP.shape["indicate-gold"], ICON_MAP.shape["indicate-red"]] },
416
+ { name: "3TrafficLights2", list: [C.shape["indicate-greed"], C.shape["indicate-gold"], C.shape["indicate-red"]] },
420
417
  {
421
418
  name: "4RedToBlack",
422
- list: [ICON_MAP.shape["roundness-red"], ICON_MAP.shape["roundness-pink"], ICON_MAP.shape["roundness-gray"], ICON_MAP.shape["roundness-black"]]
419
+ list: [C.shape["roundness-red"], C.shape["roundness-pink"], C.shape["roundness-gray"], C.shape["roundness-black"]]
423
420
  },
424
421
  {
425
422
  name: "4TrafficLights",
426
- list: [ICON_MAP.shape["roundness-greed"], ICON_MAP.shape["roundness-gold"], ICON_MAP.shape["roundness-red"], ICON_MAP.shape["roundness-black"]]
423
+ list: [C.shape["roundness-greed"], C.shape["roundness-gold"], C.shape["roundness-red"], C.shape["roundness-black"]]
427
424
  }
428
425
  ]
429
426
  },
@@ -432,15 +429,15 @@ const feedback = {
432
429
  group: [
433
430
  {
434
431
  name: "3Symbols",
435
- list: [ICON_MAP.feedback.correct, ICON_MAP.feedback.warn, ICON_MAP.feedback.mistake]
432
+ list: [C.feedback.correct, C.feedback.warn, C.feedback.mistake]
436
433
  },
437
434
  {
438
435
  name: "3Symbols2",
439
- list: [ICON_MAP.feedback2.correct2, ICON_MAP.feedback2.warn2, ICON_MAP.feedback2.mistake2]
436
+ list: [C.feedback2.correct2, C.feedback2.warn2, C.feedback2.mistake2]
440
437
  },
441
438
  {
442
439
  name: "3Flags",
443
- list: [ICON_MAP.flag["flag-green"], ICON_MAP.flag["flag-gold"], ICON_MAP.flag["flag-red"]]
440
+ list: [C.flag["flag-green"], C.flag["flag-gold"], C.flag["flag-red"]]
444
441
  }
445
442
  ]
446
443
  },
@@ -449,282 +446,299 @@ const feedback = {
449
446
  group: [
450
447
  {
451
448
  name: "4Rating",
452
- list: [ICON_MAP.signal.signal25, ICON_MAP.signal.signal50, ICON_MAP.signal.signal75, ICON_MAP.signal.signal100]
449
+ list: [C.signal.signal25, C.signal.signal50, C.signal.signal75, C.signal.signal100]
453
450
  },
454
451
  {
455
452
  name: "5Rating",
456
- list: [ICON_MAP.signal.signal0, ICON_MAP.signal.signal25, ICON_MAP.signal.signal50, ICON_MAP.signal.signal75, ICON_MAP.signal.signal100]
453
+ list: [C.signal.signal0, C.signal.signal25, C.signal.signal50, C.signal.signal75, C.signal.signal100]
457
454
  },
458
455
  {
459
456
  name: "5Quarters",
460
- list: [ICON_MAP.progress.progress100, ICON_MAP.progress.progress75, ICON_MAP.progress.progress50, ICON_MAP.progress.progress25, ICON_MAP.progress.progress0]
457
+ list: [C.progress.progress100, C.progress.progress75, C.progress.progress50, C.progress.progress25, C.progress.progress0]
461
458
  },
462
459
  {
463
460
  name: "_5Felling",
464
- list: [ICON_MAP.feeling.guffaw, ICON_MAP.feeling.smile, ICON_MAP.feeling.noninductive, ICON_MAP.feeling.dissatisfied, ICON_MAP.feeling.impatient]
461
+ list: [C.feeling.guffaw, C.feeling.smile, C.feeling.noninductive, C.feeling.dissatisfied, C.feeling.impatient]
465
462
  },
466
463
  {
467
464
  name: "5Boxes",
468
- list: [ICON_MAP.cell["cell-100"], ICON_MAP.cell["cell-75"], ICON_MAP.cell["cell-50"], ICON_MAP.cell["cell-25"], ICON_MAP.cell["cell-0"]]
465
+ list: [C.cell["cell-100"], C.cell["cell-75"], C.cell["cell-50"], C.cell["cell-25"], C.cell["cell-0"]]
469
466
  },
470
467
  {
471
468
  name: "3Stars",
472
- list: [ICON_MAP.star.starFull, ICON_MAP.star.starIncomplete, ICON_MAP.star.starEmpty]
469
+ list: [C.star.starFull, C.star.starIncomplete, C.star.starEmpty]
473
470
  }
474
471
  ]
475
472
  }
476
- ], iconMap = iconGroup.reduce((result, cur) => {
477
- const { group } = cur;
478
- for (const v of group)
479
- result[v.name] = v.list;
480
- return result;
473
+ ], M2 = Y0.reduce((s, n) => {
474
+ const { group: e } = n;
475
+ for (const t of e)
476
+ s[t.name] = t.list;
477
+ return s;
481
478
  }, {});
482
- for (const key in iconMap) {
483
- const v = iconMap[key];
484
- Object.freeze(v);
479
+ for (const s in M2) {
480
+ const n = M2[s];
481
+ Object.freeze(n);
485
482
  }
486
- const EMPTY_ICON_TYPE = "EMPTY_ICON_TYPE", MoveConditionalRuleMutation = {
487
- type: CommandType.MUTATION,
483
+ const G0 = "EMPTY_ICON_TYPE", V2 = {
484
+ type: E2.MUTATION,
488
485
  id: "sheet.mutation.move-conditional-rule",
489
- handler(accessor, params) {
490
- if (!params)
486
+ handler(s, n) {
487
+ if (!n)
491
488
  return !1;
492
- const { unitId, subUnitId, start, end } = params;
493
- return accessor.get(ConditionalFormattingRuleModel).moveRulePriority(unitId, subUnitId, start, end), !0;
489
+ const { unitId: e, subUnitId: t, start: i, end: r } = n;
490
+ return s.get(Q).moveRulePriority(e, t, i, r), !0;
494
491
  }
495
- }, MoveConditionalRuleMutationUndoFactory = /* @__PURE__ */ __name((param) => {
496
- const { unitId, subUnitId } = param, undo = anchorUndoFactory(param.start, param.end);
497
- if (!undo)
492
+ }, j1 = (s) => {
493
+ const { unitId: n, subUnitId: e } = s, t = L0(s.start, s.end);
494
+ if (!t)
498
495
  return [];
499
- const [start, end] = undo;
496
+ const [i, r] = t;
500
497
  return [
501
498
  {
502
- id: MoveConditionalRuleMutation.id,
503
- params: { unitId, subUnitId, start, end }
499
+ id: V2.id,
500
+ params: { unitId: n, subUnitId: e, start: i, end: r }
504
501
  }
505
502
  ];
506
- }, "MoveConditionalRuleMutationUndoFactory"), DeleteConditionalRuleMutationUndoFactory = /* @__PURE__ */ __name((accessor, param) => {
507
- const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel), { unitId, subUnitId, cfId } = param, ruleList = [...conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId) || []], index = ruleList.findIndex((item) => item.cfId === cfId), beforeRule = ruleList[index - 1];
508
- if (index > -1) {
509
- const rule = ruleList[index], result = [{
510
- id: AddConditionalRuleMutation.id,
511
- params: { unitId, subUnitId, rule: Tools.deepClone(rule) }
503
+ }, X0 = (s, n) => {
504
+ const e = s.get(Q), { unitId: t, subUnitId: i, cfId: r } = n, a = [...e.getSubunitRules(t, i) || []], o = a.findIndex((c) => c.cfId === r), l = a[o - 1];
505
+ if (o > -1) {
506
+ const c = a[o], h = [{
507
+ id: J2.id,
508
+ params: { unitId: t, subUnitId: i, rule: D2.deepClone(c) }
512
509
  }];
513
- if (ruleList.splice(index, 1), index !== 0) {
514
- const firstRule = ruleList[0];
515
- if (firstRule) {
516
- const transformResult = transformSupportSymmetryAnchor({ id: firstRule.cfId, type: "before" }, { id: beforeRule.cfId, type: "after" }, ruleList, (rule2) => rule2.cfId);
517
- if (!transformResult)
518
- return result;
519
- const [start, end] = transformResult, params = {
520
- unitId,
521
- subUnitId,
522
- start,
523
- end
510
+ if (a.splice(o, 1), o !== 0) {
511
+ const u = a[0];
512
+ if (u) {
513
+ const f = I0({ id: u.cfId, type: "before" }, { id: l.cfId, type: "after" }, a, (m) => m.cfId);
514
+ if (!f)
515
+ return h;
516
+ const [d, g] = f, D = {
517
+ unitId: t,
518
+ subUnitId: i,
519
+ start: d,
520
+ end: g
524
521
  };
525
- result.push({ id: MoveConditionalRuleMutation.id, params });
522
+ h.push({ id: V2.id, params: D });
526
523
  }
527
524
  }
528
- return result;
525
+ return h;
529
526
  }
530
527
  return [];
531
- }, "DeleteConditionalRuleMutationUndoFactory"), DeleteConditionalRuleMutation = {
532
- type: CommandType.MUTATION,
528
+ }, N2 = {
529
+ type: E2.MUTATION,
533
530
  id: "sheet.mutation.delete-conditional-rule",
534
- handler(accessor, params) {
535
- if (!params)
531
+ handler(s, n) {
532
+ if (!n)
536
533
  return !1;
537
- const { unitId, subUnitId, cfId } = params;
538
- return accessor.get(ConditionalFormattingRuleModel).deleteRule(unitId, subUnitId, cfId), !0;
534
+ const { unitId: e, subUnitId: t, cfId: i } = n;
535
+ return s.get(Q).deleteRule(e, t, i), !0;
539
536
  }
540
- }, AddConditionalRuleMutationUndoFactory = /* @__PURE__ */ __name((accessor, param) => ({ id: DeleteConditionalRuleMutation.id, params: { unitId: param.unitId, subUnitId: param.subUnitId, cfId: param.rule.cfId } }), "AddConditionalRuleMutationUndoFactory"), AddConditionalRuleMutation = {
541
- type: CommandType.MUTATION,
537
+ }, H1 = (s, n) => ({ id: N2.id, params: { unitId: n.unitId, subUnitId: n.subUnitId, cfId: n.rule.cfId } }), J2 = {
538
+ type: E2.MUTATION,
542
539
  id: "sheet.mutation.add-conditional-rule",
543
- handler(accessor, params) {
544
- if (!params)
540
+ handler(s, n) {
541
+ if (!n)
545
542
  return !1;
546
- const { unitId, subUnitId, rule } = params;
547
- return accessor.get(ConditionalFormattingRuleModel).addRule(unitId, subUnitId, rule), !0;
543
+ const { unitId: e, subUnitId: t, rule: i } = n;
544
+ return s.get(Q).addRule(e, t, i), !0;
548
545
  }
549
- }, ConditionalFormattingFormulaMarkDirty = {
550
- type: CommandType.MUTATION,
546
+ }, x2 = {
547
+ type: E2.MUTATION,
551
548
  id: "sheet.mutation.conditional-formatting-formula-mark-dirty",
552
549
  handler() {
553
550
  return !0;
554
551
  }
555
- }, SetConditionalRuleMutation = {
556
- type: CommandType.MUTATION,
552
+ }, z2 = {
553
+ type: E2.MUTATION,
557
554
  id: "sheet.mutation.set-conditional-rule",
558
- handler(accessor, params) {
559
- if (!params)
555
+ handler(s, n) {
556
+ if (!n)
560
557
  return !1;
561
- const { unitId, subUnitId, rule } = params, cfId = params.cfId || params.rule.cfId;
562
- return accessor.get(ConditionalFormattingRuleModel).setRule(unitId, subUnitId, rule, cfId), !0;
558
+ const { unitId: e, subUnitId: t, rule: i } = n, r = n.cfId || n.rule.cfId;
559
+ return s.get(Q).setRule(e, t, i, r), !0;
563
560
  }
564
- }, setConditionalRuleMutationUndoFactory = /* @__PURE__ */ __name((accessor, param) => {
565
- const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel), { unitId, subUnitId } = param, cfId = param.cfId || param.rule.cfId, rule = conditionalFormattingRuleModel.getRule(unitId, subUnitId, cfId);
566
- return rule ? [
561
+ }, Y1 = (s, n) => {
562
+ const e = s.get(Q), { unitId: t, subUnitId: i } = n, r = n.cfId || n.rule.cfId, a = e.getRule(t, i, r);
563
+ return a ? [
567
564
  {
568
- id: SetConditionalRuleMutation.id,
565
+ id: z2.id,
569
566
  params: {
570
- unitId,
571
- subUnitId,
572
- cfId,
573
- rule: Tools.deepClone(rule)
567
+ unitId: t,
568
+ subUnitId: i,
569
+ cfId: r,
570
+ rule: D2.deepClone(a)
574
571
  }
575
572
  }
576
573
  ] : [];
577
- }, "setConditionalRuleMutationUndoFactory"), PLUGIN_CONFIG_KEY = "ssheets-conditional-formatting.config", defaultPluginConfig = {};
578
- var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
579
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
580
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
581
- return kind && result && __defProp$2(target, key, result), result;
582
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), FormulaResultStatus = /* @__PURE__ */ ((FormulaResultStatus2) => (FormulaResultStatus2[FormulaResultStatus2.NOT_REGISTER = 1] = "NOT_REGISTER", FormulaResultStatus2[FormulaResultStatus2.SUCCESS = 2] = "SUCCESS", FormulaResultStatus2[FormulaResultStatus2.WAIT = 3] = "WAIT", FormulaResultStatus2[FormulaResultStatus2.ERROR = 4] = "ERROR", FormulaResultStatus2))(FormulaResultStatus || {});
583
- const getResultFromFormula = /* @__PURE__ */ __name((formulaResult) => {
584
- const v = formulaResult && formulaResult[0] && formulaResult[0][0];
585
- return (v == null ? void 0 : v.t) === CellValueType.BOOLEAN ? v.v === BooleanNumber.TRUE || v.v === !0 : v ? v.v : !1;
586
- }, "getResultFromFormula");
587
- var _a2;
588
- let ConditionalFormattingFormulaService = (_a2 = class extends Disposable {
589
- constructor(_commandService, _injector, _activeDirtyManagerService, _conditionalFormattingViewModel, _conditionalFormattingRuleModel) {
574
+ }, K0 = "ssheets-conditional-formatting.config", J0 = {};
575
+ var z0 = Object.defineProperty, Q0 = Object.getOwnPropertyDescriptor, t1 = (s, n, e, t) => {
576
+ for (var i = t > 1 ? void 0 : t ? Q0(n, e) : n, r = s.length - 1, a; r >= 0; r--)
577
+ (a = s[r]) && (i = (t ? a(n, e, i) : a(i)) || i);
578
+ return t && i && z0(n, e, i), i;
579
+ }, w2 = (s, n) => (e, t) => n(e, t, s), Z = /* @__PURE__ */ ((s) => (s[s.NOT_REGISTER = 1] = "NOT_REGISTER", s[s.SUCCESS = 2] = "SUCCESS", s[s.WAIT = 3] = "WAIT", s[s.ERROR = 4] = "ERROR", s))(Z || {});
580
+ const e1 = (s) => {
581
+ const n = s && s[0] && s[0][0];
582
+ return (n == null ? void 0 : n.t) === J.BOOLEAN ? n.v === j2.TRUE || n.v === !0 : n ? n.v : !1;
583
+ };
584
+ let n2 = class extends q2 {
585
+ constructor(n, e, t, i, r) {
590
586
  super();
591
- __publicField(this, "_formulaMap", /* @__PURE__ */ new Map());
592
- __publicField(this, "_cache", /* @__PURE__ */ new Map());
593
- __publicField(this, "_formulaChange$", new Subject());
594
- __publicField(this, "formulaChange$", this._formulaChange$.asObservable());
595
- this._commandService = _commandService, this._injector = _injector, this._activeDirtyManagerService = _activeDirtyManagerService, this._conditionalFormattingViewModel = _conditionalFormattingViewModel, this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel, this._initFormulaCalculationResultChange(), this._initRuleChange(), this._initCache(), this.disposeWithMe(toDisposable(() => {
587
+ // Cache Formula ID and formula mapping.
588
+ S(this, "_formulaMap", /* @__PURE__ */ new Map());
589
+ // Cache style results, style replacement needs to wait until the formula has been calculated, then replace.
590
+ S(this, "_cache", /* @__PURE__ */ new Map());
591
+ this._commandService = n, this._injector = e, this._activeDirtyManagerService = t, this._conditionalFormattingViewModel = i, this._conditionalFormattingRuleModel = r, this._initFormulaCalculationResultChange(), this._initRuleChange(), this._initCache(), this.disposeWithMe(n0(() => {
596
592
  this._cache.clear(), this._formulaMap.clear();
597
593
  }));
598
594
  }
599
- dispose() {
600
- this._formulaChange$.complete();
601
- }
602
595
  _initCache() {
603
- const _conditionalFormattingService = this._injector.get(ConditionalFormattingService);
604
- this.disposeWithMe(_conditionalFormattingService.ruleComputeStatus$.subscribe((option) => {
605
- const { unitId, subUnitId, status, result, cfId } = option;
606
- status === "end" && result && this._ensureCacheMap(unitId, subUnitId).set(cfId, result);
607
- })), this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((option) => {
608
- if (option.type === "delete") {
609
- const { unitId, subUnitId, rule } = option;
610
- this._deleteCache(unitId, subUnitId, rule.cfId);
596
+ const n = this._injector.get(v2);
597
+ this.disposeWithMe(n.ruleComputeStatus$.subscribe((e) => {
598
+ const { unitId: t, subUnitId: i, status: r, result: a, cfId: o } = e;
599
+ r === "end" && a && this._ensureCacheMap(t, i).set(o, a);
600
+ })), this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((e) => {
601
+ if (e.type === "delete") {
602
+ const { unitId: t, subUnitId: i, rule: r } = e;
603
+ this._deleteCache(t, i, r.cfId);
611
604
  }
612
605
  }));
613
606
  }
614
607
  _initRuleChange() {
615
- this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((option) => {
616
- const { unitId, subUnitId, rule } = option;
617
- option.type === "delete" && this._removeFormulaByCfId(unitId, subUnitId, rule.cfId);
608
+ const n = (e) => {
609
+ switch (e.type) {
610
+ case H.colorScale:
611
+ return e.config.some((t) => t.value.type === e2.formula);
612
+ case H.highlightCell:
613
+ return e.subType === V.formula;
614
+ case H.dataBar:
615
+ return [e.config.max, e.config.min].some((t) => t.type === e2.formula);
616
+ case H.iconSet:
617
+ return e.config.some((t) => t.value.type === e2.formula);
618
+ }
619
+ };
620
+ this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((e) => {
621
+ const { unitId: t, subUnitId: i, rule: r, oldRule: a } = e;
622
+ e.type === "delete" && this._removeFormulaByCfId(t, i, r.cfId), e.type === "set" && (n(r.rule) || a && n(a.rule)) && this._removeFormulaByCfId(t, i, r.cfId);
618
623
  }));
619
624
  }
620
625
  _initFormulaCalculationResultChange() {
621
- this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
622
- if (commandInfo.id === SetFormulaCalculationResultMutation.id) {
623
- const params = commandInfo.params;
624
- for (const unitId in params.unitOtherData)
625
- for (const subUnitId in params.unitOtherData[unitId]) {
626
- const map2 = this.getSubUnitFormulaMap(unitId, subUnitId);
627
- if (!map2)
628
- continue;
629
- const cfIdSet = /* @__PURE__ */ new Set();
630
- for (const formulaId in params.unitOtherData[unitId][subUnitId]) {
631
- const item = map2.getValue(formulaId, ["formulaId"]);
632
- if (item) {
633
- const value = getResultFromFormula(params.unitOtherData[unitId][subUnitId][formulaId]);
634
- item.result = value, item.status = 2, cfIdSet.add(item.cfId);
635
- }
626
+ this.disposeWithMe(this._commandService.onCommandExecuted((n) => {
627
+ if (n.id === M0.id) {
628
+ const e = n.params;
629
+ for (const t in e.unitOtherData)
630
+ for (const i in e.unitOtherData[t]) {
631
+ const r = /* @__PURE__ */ new Set();
632
+ for (const a in e.unitOtherData[t][i]) {
633
+ const o = new j(e.unitOtherData[t][i][a]), l = this._ensureSubunitFormulaMap(t, i).getValue(a, ["formulaId"]);
634
+ if (!l)
635
+ continue;
636
+ const c = l.ranges;
637
+ if (!c)
638
+ continue;
639
+ const h = l.result, u = c[0].startRow, f = c[0].startColumn;
640
+ o.forValue((d, g, D) => {
641
+ h.setValue(u + d, f + g, e1(D));
642
+ }), l.status = 2, r.add(l.cfId);
636
643
  }
637
- for (const cfId of cfIdSet) {
638
- const rule = this._conditionalFormattingRuleModel.getRule(unitId, subUnitId, cfId);
639
- rule && this._conditionalFormattingViewModel.markRuleDirty(unitId, subUnitId, rule);
644
+ for (const a of r) {
645
+ const o = this._conditionalFormattingRuleModel.getRule(t, i, a);
646
+ o && this._conditionalFormattingViewModel.markRuleDirty(t, i, o);
640
647
  }
641
648
  }
642
649
  }
643
650
  })), this._activeDirtyManagerService.register(
644
- ConditionalFormattingFormulaMarkDirty.id,
651
+ x2.id,
645
652
  {
646
- commandId: ConditionalFormattingFormulaMarkDirty.id,
647
- getDirtyData(commandInfo) {
653
+ commandId: x2.id,
654
+ getDirtyData(n) {
648
655
  return {
649
- dirtyUnitOtherFormulaMap: commandInfo.params
656
+ dirtyUnitOtherFormulaMap: n.params
650
657
  };
651
658
  }
652
659
  }
653
- ), this.formulaChange$.pipe(bufferTime(16), filter((list) => !!list.length), map((list) => list.reduce((result, cur) => {
654
- const { unitId, subUnitId, formulaId, formulaText } = cur;
655
- return result[unitId] || (result[unitId] = {}), result[unitId][subUnitId] || (result[unitId][subUnitId] = {}), result[unitId][subUnitId][formulaId] = { f: formulaText }, result;
656
- }, {}))).subscribe((result) => {
657
- for (const unitId in result)
658
- for (const subUnitId in result[unitId]) {
659
- const value = result[unitId][subUnitId], config = { unitId, subUnitId, formulaMap: value };
660
- this._commandService.executeCommand(SetOtherFormulaMutation.id, config).then(() => {
661
- this._commandService.executeCommand(
662
- ConditionalFormattingFormulaMarkDirty.id,
663
- { [unitId]: { [subUnitId]: value } }
664
- );
665
- });
666
- }
667
- });
660
+ );
668
661
  }
669
- _ensureSubunitFormulaMap(unitId, subUnitId) {
670
- let unitMap = this._formulaMap.get(unitId);
671
- unitMap || (unitMap = /* @__PURE__ */ new Map(), this._formulaMap.set(unitId, unitMap));
672
- let subUnitMap = unitMap.get(subUnitId);
673
- return subUnitMap || (subUnitMap = new RefAlias([], ["formulaId", "formulaText"]), unitMap.set(subUnitId, subUnitMap)), subUnitMap;
674
- }
675
- _ensureCacheMap(unitId, subUnitId) {
676
- let unitMap = this._cache.get(unitId);
677
- unitMap || (unitMap = /* @__PURE__ */ new Map(), this._cache.set(unitId, unitMap));
678
- let subUnitMap = unitMap.get(subUnitId);
679
- return subUnitMap || (subUnitMap = /* @__PURE__ */ new Map(), unitMap.set(subUnitId, subUnitMap)), subUnitMap;
680
- }
681
- _deleteCache(unitId, subUnitId, cfId) {
682
- const unitCache = this._cache.get(unitId);
683
- if (unitCache) {
684
- const subUnitCache = unitCache.get(subUnitId);
685
- subUnitCache && (cfId ? subUnitCache.delete(cfId) : subUnitCache.clear());
662
+ _ensureSubunitFormulaMap(n, e) {
663
+ let t = this._formulaMap.get(n);
664
+ t || (t = /* @__PURE__ */ new Map(), this._formulaMap.set(n, t));
665
+ let i = t.get(e);
666
+ return i || (i = new i0([], ["formulaId", "id"]), t.set(e, i)), i;
667
+ }
668
+ _ensureCacheMap(n, e) {
669
+ let t = this._cache.get(n);
670
+ t || (t = /* @__PURE__ */ new Map(), this._cache.set(n, t));
671
+ let i = t.get(e);
672
+ return i || (i = /* @__PURE__ */ new Map(), t.set(e, i)), i;
673
+ }
674
+ _deleteCache(n, e, t) {
675
+ const i = this._cache.get(n);
676
+ if (i) {
677
+ const r = i.get(e);
678
+ r && (t ? r.delete(t) : r.clear());
686
679
  }
687
680
  }
688
- getCache(unitId, subUnitId, cfId) {
689
- return this._ensureCacheMap(unitId, subUnitId).get(cfId);
681
+ getCache(n, e, t) {
682
+ return this._ensureCacheMap(n, e).get(t);
690
683
  }
691
- getSubUnitFormulaMap(unitId, subUnitId) {
692
- var _a5;
693
- return (_a5 = this._formulaMap.get(unitId)) == null ? void 0 : _a5.get(subUnitId);
684
+ getSubUnitFormulaMap(n, e) {
685
+ var t;
686
+ return (t = this._formulaMap.get(n)) == null ? void 0 : t.get(e);
694
687
  }
695
- registerFormula(unitId, subUnitId, cfId, formulaText) {
696
- const subUnitFormulaMap = this._ensureSubunitFormulaMap(unitId, subUnitId), formulaItem = subUnitFormulaMap.getValue(formulaText, ["formulaText"]);
697
- if (formulaItem) {
698
- subUnitFormulaMap.getValues().some((item) => item.cfId === cfId) || formulaItem.count++;
688
+ registerFormulaWithRange(n, e, t, i, r = [{ startRow: 0, endRow: 0, startColumn: 0, endColumn: 0 }]) {
689
+ const a = this._ensureSubunitFormulaMap(n, e);
690
+ if (a.getValue(this.createCFormulaId(t, i), ["id"]))
699
691
  return;
700
- }
701
- const formulaId = this._createFormulaId(unitId, subUnitId);
702
- subUnitFormulaMap.addValue({ formulaId, formulaText, cfId, status: 3, count: 1 }), this._formulaChange$.next({ unitId, cfId, subUnitId, formulaText, formulaId });
703
- }
704
- _removeFormulaByCfId(unitId, subUnitId, cfId) {
705
- const subUnitFormulaMap = this._ensureSubunitFormulaMap(unitId, subUnitId), reduceCount = /* @__PURE__ */ __name((formulaText) => {
706
- const formulaItem = subUnitFormulaMap.getValue(formulaText, ["formulaText"]);
707
- formulaItem && (formulaItem.count--, formulaItem.count <= 0 && subUnitFormulaMap.deleteValue(formulaText));
708
- }, "reduceCount"), values = subUnitFormulaMap.getValues().filter((item) => item.cfId === cfId);
709
- values.forEach((item) => {
710
- reduceCount(item.formulaText);
692
+ const o = this._createFormulaId(n, e);
693
+ a.addValue({
694
+ formulaText: i,
695
+ cfId: t,
696
+ id: this.createCFormulaId(t, i),
697
+ ranges: r,
698
+ formulaId: o,
699
+ status: 3,
700
+ result: new j()
701
+ });
702
+ const l = {
703
+ unitId: n,
704
+ subUnitId: e,
705
+ formulaMap: {
706
+ [o]: {
707
+ f: i,
708
+ ranges: r
709
+ }
710
+ }
711
+ };
712
+ this._commandService.executeCommand(y0.id, l).then(() => {
713
+ this._commandService.executeCommand(
714
+ x2.id,
715
+ { [n]: { [e]: { [o]: !0 } } }
716
+ );
717
+ });
718
+ }
719
+ _removeFormulaByCfId(n, e, t) {
720
+ const i = this._ensureSubunitFormulaMap(n, e);
721
+ i.deleteValue(t);
722
+ const r = i.getValues().filter((o) => o.cfId === t);
723
+ r.forEach((o) => {
724
+ i.deleteValue(o.id, ["id"]);
711
725
  });
712
- const formulaIdList = values.map((item) => item.formulaId);
713
- this._commandService.executeCommand(RemoveOtherFormulaMutation.id, { unitId, subUnitId, formulaIdList });
726
+ const a = r.map((o) => o.formulaId);
727
+ this._commandService.executeCommand(R0.id, { unitId: n, subUnitId: e, formulaIdList: a });
714
728
  }
715
- getFormulaResult(unitId, subUnitId, formulaText) {
716
- const map2 = this.getSubUnitFormulaMap(unitId, subUnitId);
717
- if (!map2)
729
+ getFormulaResult(n, e, t, i, r = 0, a = 0) {
730
+ const o = this.getSubUnitFormulaMap(n, e);
731
+ if (!o)
718
732
  return {
719
733
  status: 1
720
734
  /* NOT_REGISTER */
721
735
  };
722
- const item = map2.getValue(formulaText, ["formulaText"]);
723
- return item ? item.status === 2 ? {
724
- result: item.result,
736
+ const l = o.getValue(this.createCFormulaId(t, i), ["id"]);
737
+ return l ? l.status === 2 && l.result ? {
738
+ result: l.result.getValue(r, a),
725
739
  status: 2
726
740
  /* SUCCESS */
727
- } : item.status === 3 ? {
741
+ } : l.status === 3 ? {
728
742
  status: 3
729
743
  /* WAIT */
730
744
  } : {
@@ -735,1150 +749,1136 @@ let ConditionalFormattingFormulaService = (_a2 = class extends Disposable {
735
749
  /* NOT_REGISTER */
736
750
  };
737
751
  }
738
- _createFormulaId(unitId, subUnitId) {
739
- return `sheet.cf_${unitId}_${subUnitId}_${Tools.generateRandomId(8)}`;
740
- }
741
- }, __name(_a2, "ConditionalFormattingFormulaService"), _a2);
742
- ConditionalFormattingFormulaService = __decorateClass$2([
743
- __decorateParam$2(0, Inject(ICommandService)),
744
- __decorateParam$2(1, Inject(Injector)),
745
- __decorateParam$2(2, Inject(IActiveDirtyManagerService)),
746
- __decorateParam$2(3, Inject(ConditionalFormattingViewModel)),
747
- __decorateParam$2(4, Inject(ConditionalFormattingRuleModel))
748
- ], ConditionalFormattingFormulaService);
749
- var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
750
- function getDefaultExportFromCjs(x) {
751
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
752
+ _createFormulaId(n, e) {
753
+ return `sheet.cf_${n}_${e}_${D2.generateRandomId(8)}`;
754
+ }
755
+ createCFormulaId(n, e) {
756
+ return `${n}_${e}`;
757
+ }
758
+ };
759
+ n2 = t1([
760
+ w2(0, T(O2)),
761
+ w2(1, T(S2)),
762
+ w2(2, T(_0)),
763
+ w2(3, T(I2)),
764
+ w2(4, T(Q))
765
+ ], n2);
766
+ var n1 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
767
+ function i1(s) {
768
+ return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
752
769
  }
753
- __name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
754
- var dayjs_min = { exports: {} };
755
- (function(module, exports) {
756
- (function(t, e) {
757
- module.exports = e();
758
- })(commonjsGlobal, function() {
759
- var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: /* @__PURE__ */ __name(function(t2) {
760
- var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
761
- return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
762
- }, "ordinal") }, m = /* @__PURE__ */ __name(function(t2, e2, n2) {
763
- var r2 = String(t2);
764
- return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
765
- }, "m"), v = { s: m, z: /* @__PURE__ */ __name(function(t2) {
766
- var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
767
- return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
768
- }, "z"), m: /* @__PURE__ */ __name(function t2(e2, n2) {
769
- if (e2.date() < n2.date()) return -t2(n2, e2);
770
- var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
771
- return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
772
- }, "t"), a: /* @__PURE__ */ __name(function(t2) {
773
- return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
774
- }, "a"), p: /* @__PURE__ */ __name(function(t2) {
775
- return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
776
- }, "p"), u: /* @__PURE__ */ __name(function(t2) {
777
- return t2 === void 0;
778
- }, "u") }, g = "en", D = {};
779
- D[g] = M;
780
- var p = "$isDayjsObject", S = /* @__PURE__ */ __name(function(t2) {
781
- return t2 instanceof _ || !(!t2 || !t2[p]);
782
- }, "S"), w = /* @__PURE__ */ __name(function t2(e2, n2, r2) {
783
- var i2;
784
- if (!e2) return g;
785
- if (typeof e2 == "string") {
786
- var s2 = e2.toLowerCase();
787
- D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
788
- var u2 = e2.split("-");
789
- if (!i2 && u2.length > 1) return t2(u2[0]);
770
+ var Q2 = { exports: {} };
771
+ (function(s, n) {
772
+ (function(e, t) {
773
+ s.exports = t();
774
+ })(n1, function() {
775
+ var e = 1e3, t = 6e4, i = 36e5, r = "millisecond", a = "second", o = "minute", l = "hour", c = "day", h = "week", u = "month", f = "quarter", d = "year", g = "date", D = "Invalid Date", m = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, F = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, y = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(A) {
776
+ var E = ["th", "st", "nd", "rd"], w = A % 100;
777
+ return "[" + A + (E[(w - 20) % 10] || E[w] || E[0]) + "]";
778
+ } }, R = function(A, E, w) {
779
+ var p = String(A);
780
+ return !p || p.length >= E ? A : "" + Array(E + 1 - p.length).join(w) + A;
781
+ }, L = { s: R, z: function(A) {
782
+ var E = -A.utcOffset(), w = Math.abs(E), p = Math.floor(w / 60), v = w % 60;
783
+ return (E <= 0 ? "+" : "-") + R(p, 2, "0") + ":" + R(v, 2, "0");
784
+ }, m: function A(E, w) {
785
+ if (E.date() < w.date()) return -A(w, E);
786
+ var p = 12 * (w.year() - E.year()) + (w.month() - E.month()), v = E.clone().add(p, u), x = w - v < 0, _ = E.clone().add(p + (x ? -1 : 1), u);
787
+ return +(-(p + (w - v) / (x ? v - _ : _ - v)) || 0);
788
+ }, a: function(A) {
789
+ return A < 0 ? Math.ceil(A) || 0 : Math.floor(A);
790
+ }, p: function(A) {
791
+ return { M: u, y: d, w: h, d: c, D: g, h: l, m: o, s: a, ms: r, Q: f }[A] || String(A || "").toLowerCase().replace(/s$/, "");
792
+ }, u: function(A) {
793
+ return A === void 0;
794
+ } }, W = "en", U = {};
795
+ U[W] = y;
796
+ var h2 = "$isDayjsObject", i2 = function(A) {
797
+ return A instanceof Y || !(!A || !A[h2]);
798
+ }, a2 = function A(E, w, p) {
799
+ var v;
800
+ if (!E) return W;
801
+ if (typeof E == "string") {
802
+ var x = E.toLowerCase();
803
+ U[x] && (v = x), w && (U[x] = w, v = x);
804
+ var _ = E.split("-");
805
+ if (!v && _.length > 1) return A(_[0]);
790
806
  } else {
791
- var a2 = e2.name;
792
- D[a2] = e2, i2 = a2;
807
+ var b = E.name;
808
+ U[b] = E, v = b;
793
809
  }
794
- return !r2 && i2 && (g = i2), i2 || !r2 && g;
795
- }, "t"), O = /* @__PURE__ */ __name(function(t2, e2) {
796
- if (S(t2)) return t2.clone();
797
- var n2 = typeof e2 == "object" ? e2 : {};
798
- return n2.date = t2, n2.args = arguments, new _(n2);
799
- }, "O"), b = v;
800
- b.l = w, b.i = S, b.w = function(t2, e2) {
801
- return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
810
+ return !p && v && (W = v), v || !p && W;
811
+ }, I = function(A, E) {
812
+ if (i2(A)) return A.clone();
813
+ var w = typeof E == "object" ? E : {};
814
+ return w.date = A, w.args = arguments, new Y(w);
815
+ }, M = L;
816
+ M.l = a2, M.i = i2, M.w = function(A, E) {
817
+ return I(A, { locale: E.$L, utc: E.$u, x: E.$x, $offset: E.$offset });
802
818
  };
803
- var _ = function() {
804
- function M2(t2) {
805
- this.$L = w(t2.locale, null, !0), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = !0;
819
+ var Y = function() {
820
+ function A(w) {
821
+ this.$L = a2(w.locale, null, !0), this.parse(w), this.$x = this.$x || w.x || {}, this[h2] = !0;
806
822
  }
807
- __name(M2, "M");
808
- var m2 = M2.prototype;
809
- return m2.parse = function(t2) {
810
- this.$d = function(t3) {
811
- var e2 = t3.date, n2 = t3.utc;
812
- if (e2 === null) return /* @__PURE__ */ new Date(NaN);
813
- if (b.u(e2)) return /* @__PURE__ */ new Date();
814
- if (e2 instanceof Date) return new Date(e2);
815
- if (typeof e2 == "string" && !/Z$/i.test(e2)) {
816
- var r2 = e2.match($);
817
- if (r2) {
818
- var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
819
- return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
823
+ var E = A.prototype;
824
+ return E.parse = function(w) {
825
+ this.$d = function(p) {
826
+ var v = p.date, x = p.utc;
827
+ if (v === null) return /* @__PURE__ */ new Date(NaN);
828
+ if (M.u(v)) return /* @__PURE__ */ new Date();
829
+ if (v instanceof Date) return new Date(v);
830
+ if (typeof v == "string" && !/Z$/i.test(v)) {
831
+ var _ = v.match(m);
832
+ if (_) {
833
+ var b = _[2] - 1 || 0, k = (_[7] || "0").substring(0, 3);
834
+ return x ? new Date(Date.UTC(_[1], b, _[3] || 1, _[4] || 0, _[5] || 0, _[6] || 0, k)) : new Date(_[1], b, _[3] || 1, _[4] || 0, _[5] || 0, _[6] || 0, k);
820
835
  }
821
836
  }
822
- return new Date(e2);
823
- }(t2), this.init();
824
- }, m2.init = function() {
825
- var t2 = this.$d;
826
- this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
827
- }, m2.$utils = function() {
828
- return b;
829
- }, m2.isValid = function() {
830
- return this.$d.toString() !== l;
831
- }, m2.isSame = function(t2, e2) {
832
- var n2 = O(t2);
833
- return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
834
- }, m2.isAfter = function(t2, e2) {
835
- return O(t2) < this.startOf(e2);
836
- }, m2.isBefore = function(t2, e2) {
837
- return this.endOf(e2) < O(t2);
838
- }, m2.$g = function(t2, e2, n2) {
839
- return b.u(t2) ? this[e2] : this.set(n2, t2);
840
- }, m2.unix = function() {
837
+ return new Date(v);
838
+ }(w), this.init();
839
+ }, E.init = function() {
840
+ var w = this.$d;
841
+ this.$y = w.getFullYear(), this.$M = w.getMonth(), this.$D = w.getDate(), this.$W = w.getDay(), this.$H = w.getHours(), this.$m = w.getMinutes(), this.$s = w.getSeconds(), this.$ms = w.getMilliseconds();
842
+ }, E.$utils = function() {
843
+ return M;
844
+ }, E.isValid = function() {
845
+ return this.$d.toString() !== D;
846
+ }, E.isSame = function(w, p) {
847
+ var v = I(w);
848
+ return this.startOf(p) <= v && v <= this.endOf(p);
849
+ }, E.isAfter = function(w, p) {
850
+ return I(w) < this.startOf(p);
851
+ }, E.isBefore = function(w, p) {
852
+ return this.endOf(p) < I(w);
853
+ }, E.$g = function(w, p, v) {
854
+ return M.u(w) ? this[p] : this.set(v, w);
855
+ }, E.unix = function() {
841
856
  return Math.floor(this.valueOf() / 1e3);
842
- }, m2.valueOf = function() {
857
+ }, E.valueOf = function() {
843
858
  return this.$d.getTime();
844
- }, m2.startOf = function(t2, e2) {
845
- var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = /* @__PURE__ */ __name(function(t3, e3) {
846
- var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
847
- return r2 ? i2 : i2.endOf(a);
848
- }, "l"), $2 = /* @__PURE__ */ __name(function(t3, e3) {
849
- return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
850
- }, "$"), y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
851
- switch (f2) {
859
+ }, E.startOf = function(w, p) {
860
+ var v = this, x = !!M.u(p) || p, _ = M.p(w), b = function(l2, P) {
861
+ var s2 = M.w(v.$u ? Date.UTC(v.$y, P, l2) : new Date(v.$y, P, l2), v);
862
+ return x ? s2 : s2.endOf(c);
863
+ }, k = function(l2, P) {
864
+ return M.w(v.toDate()[l2].apply(v.toDate("s"), (x ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(P)), v);
865
+ }, O = this.$W, N = this.$M, G = this.$D, d2 = "set" + (this.$u ? "UTC" : "");
866
+ switch (_) {
867
+ case d:
868
+ return x ? b(1, 0) : b(31, 11);
869
+ case u:
870
+ return x ? b(1, N) : b(0, N + 1);
852
871
  case h:
853
- return r2 ? l2(1, 0) : l2(31, 11);
872
+ var o2 = this.$locale().weekStart || 0, C2 = (O < o2 ? O + 7 : O) - o2;
873
+ return b(x ? G - C2 : G + (6 - C2), N);
854
874
  case c:
855
- return r2 ? l2(1, M3) : l2(0, M3 + 1);
875
+ case g:
876
+ return k(d2 + "Hours", 0);
877
+ case l:
878
+ return k(d2 + "Minutes", 1);
856
879
  case o:
857
- var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
858
- return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
880
+ return k(d2 + "Seconds", 2);
859
881
  case a:
860
- case d:
861
- return $2(v2 + "Hours", 0);
862
- case u:
863
- return $2(v2 + "Minutes", 1);
864
- case s:
865
- return $2(v2 + "Seconds", 2);
866
- case i:
867
- return $2(v2 + "Milliseconds", 3);
882
+ return k(d2 + "Milliseconds", 3);
868
883
  default:
869
884
  return this.clone();
870
885
  }
871
- }, m2.endOf = function(t2) {
872
- return this.startOf(t2, !1);
873
- }, m2.$set = function(t2, e2) {
874
- var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
875
- if (o2 === c || o2 === h) {
876
- var y2 = this.clone().set(d, 1);
877
- y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
878
- } else l2 && this.$d[l2]($2);
886
+ }, E.endOf = function(w) {
887
+ return this.startOf(w, !1);
888
+ }, E.$set = function(w, p) {
889
+ var v, x = M.p(w), _ = "set" + (this.$u ? "UTC" : ""), b = (v = {}, v[c] = _ + "Date", v[g] = _ + "Date", v[u] = _ + "Month", v[d] = _ + "FullYear", v[l] = _ + "Hours", v[o] = _ + "Minutes", v[a] = _ + "Seconds", v[r] = _ + "Milliseconds", v)[x], k = x === c ? this.$D + (p - this.$W) : p;
890
+ if (x === u || x === d) {
891
+ var O = this.clone().set(g, 1);
892
+ O.$d[b](k), O.init(), this.$d = O.set(g, Math.min(this.$D, O.daysInMonth())).$d;
893
+ } else b && this.$d[b](k);
879
894
  return this.init(), this;
880
- }, m2.set = function(t2, e2) {
881
- return this.clone().$set(t2, e2);
882
- }, m2.get = function(t2) {
883
- return this[b.p(t2)]();
884
- }, m2.add = function(r2, f2) {
885
- var d2, l2 = this;
886
- r2 = Number(r2);
887
- var $2 = b.p(f2), y2 = /* @__PURE__ */ __name(function(t2) {
888
- var e2 = O(l2);
889
- return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
890
- }, "y");
891
- if ($2 === c) return this.set(c, this.$M + r2);
892
- if ($2 === h) return this.set(h, this.$y + r2);
893
- if ($2 === a) return y2(1);
894
- if ($2 === o) return y2(7);
895
- var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
896
- return b.w(m3, this);
897
- }, m2.subtract = function(t2, e2) {
898
- return this.add(-1 * t2, e2);
899
- }, m2.format = function(t2) {
900
- var e2 = this, n2 = this.$locale();
901
- if (!this.isValid()) return n2.invalidDate || l;
902
- var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = /* @__PURE__ */ __name(function(t3, n3, i3, s3) {
903
- return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
904
- }, "h"), d2 = /* @__PURE__ */ __name(function(t3) {
905
- return b.s(s2 % 12 || 12, t3, "0");
906
- }, "d"), $2 = f2 || function(t3, e3, n3) {
907
- var r3 = t3 < 12 ? "AM" : "PM";
908
- return n3 ? r3.toLowerCase() : r3;
895
+ }, E.set = function(w, p) {
896
+ return this.clone().$set(w, p);
897
+ }, E.get = function(w) {
898
+ return this[M.p(w)]();
899
+ }, E.add = function(w, p) {
900
+ var v, x = this;
901
+ w = Number(w);
902
+ var _ = M.p(p), b = function(N) {
903
+ var G = I(x);
904
+ return M.w(G.date(G.date() + Math.round(N * w)), x);
905
+ };
906
+ if (_ === u) return this.set(u, this.$M + w);
907
+ if (_ === d) return this.set(d, this.$y + w);
908
+ if (_ === c) return b(1);
909
+ if (_ === h) return b(7);
910
+ var k = (v = {}, v[o] = t, v[l] = i, v[a] = e, v)[_] || 1, O = this.$d.getTime() + w * k;
911
+ return M.w(O, this);
912
+ }, E.subtract = function(w, p) {
913
+ return this.add(-1 * w, p);
914
+ }, E.format = function(w) {
915
+ var p = this, v = this.$locale();
916
+ if (!this.isValid()) return v.invalidDate || D;
917
+ var x = w || "YYYY-MM-DDTHH:mm:ssZ", _ = M.z(this), b = this.$H, k = this.$m, O = this.$M, N = v.weekdays, G = v.months, d2 = v.meridiem, o2 = function(P, s2, m2, p2) {
918
+ return P && (P[s2] || P(p, x)) || m2[s2].slice(0, p2);
919
+ }, C2 = function(P) {
920
+ return M.s(b % 12 || 12, P, "0");
921
+ }, l2 = d2 || function(P, s2, m2) {
922
+ var p2 = P < 12 ? "AM" : "PM";
923
+ return m2 ? p2.toLowerCase() : p2;
909
924
  };
910
- return r2.replace(y, function(t3, r3) {
911
- return r3 || function(t4) {
912
- switch (t4) {
925
+ return x.replace(F, function(P, s2) {
926
+ return s2 || function(m2) {
927
+ switch (m2) {
913
928
  case "YY":
914
- return String(e2.$y).slice(-2);
929
+ return String(p.$y).slice(-2);
915
930
  case "YYYY":
916
- return b.s(e2.$y, 4, "0");
931
+ return M.s(p.$y, 4, "0");
917
932
  case "M":
918
- return a2 + 1;
933
+ return O + 1;
919
934
  case "MM":
920
- return b.s(a2 + 1, 2, "0");
935
+ return M.s(O + 1, 2, "0");
921
936
  case "MMM":
922
- return h2(n2.monthsShort, a2, c2, 3);
937
+ return o2(v.monthsShort, O, G, 3);
923
938
  case "MMMM":
924
- return h2(c2, a2);
939
+ return o2(G, O);
925
940
  case "D":
926
- return e2.$D;
941
+ return p.$D;
927
942
  case "DD":
928
- return b.s(e2.$D, 2, "0");
943
+ return M.s(p.$D, 2, "0");
929
944
  case "d":
930
- return String(e2.$W);
945
+ return String(p.$W);
931
946
  case "dd":
932
- return h2(n2.weekdaysMin, e2.$W, o2, 2);
947
+ return o2(v.weekdaysMin, p.$W, N, 2);
933
948
  case "ddd":
934
- return h2(n2.weekdaysShort, e2.$W, o2, 3);
949
+ return o2(v.weekdaysShort, p.$W, N, 3);
935
950
  case "dddd":
936
- return o2[e2.$W];
951
+ return N[p.$W];
937
952
  case "H":
938
- return String(s2);
953
+ return String(b);
939
954
  case "HH":
940
- return b.s(s2, 2, "0");
955
+ return M.s(b, 2, "0");
941
956
  case "h":
942
- return d2(1);
957
+ return C2(1);
943
958
  case "hh":
944
- return d2(2);
959
+ return C2(2);
945
960
  case "a":
946
- return $2(s2, u2, !0);
961
+ return l2(b, k, !0);
947
962
  case "A":
948
- return $2(s2, u2, !1);
963
+ return l2(b, k, !1);
949
964
  case "m":
950
- return String(u2);
965
+ return String(k);
951
966
  case "mm":
952
- return b.s(u2, 2, "0");
967
+ return M.s(k, 2, "0");
953
968
  case "s":
954
- return String(e2.$s);
969
+ return String(p.$s);
955
970
  case "ss":
956
- return b.s(e2.$s, 2, "0");
971
+ return M.s(p.$s, 2, "0");
957
972
  case "SSS":
958
- return b.s(e2.$ms, 3, "0");
973
+ return M.s(p.$ms, 3, "0");
959
974
  case "Z":
960
- return i2;
975
+ return _;
961
976
  }
962
977
  return null;
963
- }(t3) || i2.replace(":", "");
978
+ }(P) || _.replace(":", "");
964
979
  });
965
- }, m2.utcOffset = function() {
980
+ }, E.utcOffset = function() {
966
981
  return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
967
- }, m2.diff = function(r2, d2, l2) {
968
- var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = /* @__PURE__ */ __name(function() {
969
- return b.m(y2, m3);
970
- }, "D");
971
- switch (M3) {
972
- case h:
973
- $2 = D2() / 12;
982
+ }, E.diff = function(w, p, v) {
983
+ var x, _ = this, b = M.p(p), k = I(w), O = (k.utcOffset() - this.utcOffset()) * t, N = this - k, G = function() {
984
+ return M.m(_, k);
985
+ };
986
+ switch (b) {
987
+ case d:
988
+ x = G() / 12;
974
989
  break;
975
- case c:
976
- $2 = D2();
990
+ case u:
991
+ x = G();
977
992
  break;
978
993
  case f:
979
- $2 = D2() / 3;
994
+ x = G() / 3;
980
995
  break;
981
- case o:
982
- $2 = (g2 - v2) / 6048e5;
996
+ case h:
997
+ x = (N - O) / 6048e5;
983
998
  break;
984
- case a:
985
- $2 = (g2 - v2) / 864e5;
999
+ case c:
1000
+ x = (N - O) / 864e5;
986
1001
  break;
987
- case u:
988
- $2 = g2 / n;
1002
+ case l:
1003
+ x = N / i;
989
1004
  break;
990
- case s:
991
- $2 = g2 / e;
1005
+ case o:
1006
+ x = N / t;
992
1007
  break;
993
- case i:
994
- $2 = g2 / t;
1008
+ case a:
1009
+ x = N / e;
995
1010
  break;
996
1011
  default:
997
- $2 = g2;
1012
+ x = N;
998
1013
  }
999
- return l2 ? $2 : b.a($2);
1000
- }, m2.daysInMonth = function() {
1001
- return this.endOf(c).$D;
1002
- }, m2.$locale = function() {
1003
- return D[this.$L];
1004
- }, m2.locale = function(t2, e2) {
1005
- if (!t2) return this.$L;
1006
- var n2 = this.clone(), r2 = w(t2, e2, !0);
1007
- return r2 && (n2.$L = r2), n2;
1008
- }, m2.clone = function() {
1009
- return b.w(this.$d, this);
1010
- }, m2.toDate = function() {
1014
+ return v ? x : M.a(x);
1015
+ }, E.daysInMonth = function() {
1016
+ return this.endOf(u).$D;
1017
+ }, E.$locale = function() {
1018
+ return U[this.$L];
1019
+ }, E.locale = function(w, p) {
1020
+ if (!w) return this.$L;
1021
+ var v = this.clone(), x = a2(w, p, !0);
1022
+ return x && (v.$L = x), v;
1023
+ }, E.clone = function() {
1024
+ return M.w(this.$d, this);
1025
+ }, E.toDate = function() {
1011
1026
  return new Date(this.valueOf());
1012
- }, m2.toJSON = function() {
1027
+ }, E.toJSON = function() {
1013
1028
  return this.isValid() ? this.toISOString() : null;
1014
- }, m2.toISOString = function() {
1029
+ }, E.toISOString = function() {
1015
1030
  return this.$d.toISOString();
1016
- }, m2.toString = function() {
1031
+ }, E.toString = function() {
1017
1032
  return this.$d.toUTCString();
1018
- }, M2;
1019
- }(), k = _.prototype;
1020
- return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
1021
- k[t2[1]] = function(e2) {
1022
- return this.$g(e2, t2[0], t2[1]);
1033
+ }, A;
1034
+ }(), t2 = Y.prototype;
1035
+ return I.prototype = t2, [["$ms", r], ["$s", a], ["$m", o], ["$H", l], ["$W", c], ["$M", u], ["$y", d], ["$D", g]].forEach(function(A) {
1036
+ t2[A[1]] = function(E) {
1037
+ return this.$g(E, A[0], A[1]);
1023
1038
  };
1024
- }), O.extend = function(t2, e2) {
1025
- return t2.$i || (t2(e2, _, O), t2.$i = !0), O;
1026
- }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
1027
- return O(1e3 * t2);
1028
- }, O.en = D[g], O.Ls = D, O.p = {}, O;
1039
+ }), I.extend = function(A, E) {
1040
+ return A.$i || (A(E, Y, I), A.$i = !0), I;
1041
+ }, I.locale = a2, I.isDayjs = i2, I.unix = function(A) {
1042
+ return I(1e3 * A);
1043
+ }, I.en = U[W], I.Ls = U, I.p = {}, I;
1029
1044
  });
1030
- })(dayjs_min);
1031
- var dayjs_minExports = dayjs_min.exports;
1032
- const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
1033
- function isFloatsEqual(a, b) {
1034
- return Math.abs(a - b) < Number.EPSILON;
1045
+ })(Q2);
1046
+ var s1 = Q2.exports;
1047
+ const $ = /* @__PURE__ */ i1(s1);
1048
+ function y2(s, n) {
1049
+ return Math.abs(s - n) < Number.EPSILON;
1035
1050
  }
1036
- __name(isFloatsEqual, "isFloatsEqual");
1037
- const isNullable = /* @__PURE__ */ __name((v) => [void 0, null].includes(v), "isNullable"), getCellValue = /* @__PURE__ */ __name((cell2) => {
1038
- var _a5, _b;
1039
- if (!cell2)
1051
+ const z = (s) => [void 0, null].includes(s), r2 = (s) => {
1052
+ var t, i;
1053
+ if (!s)
1040
1054
  return null;
1041
- if (cell2.t === CellValueType.BOOLEAN)
1042
- return cell2.v === BooleanNumber.TRUE ? BooleanValue.TRUE : BooleanValue.FALSE;
1043
- const v = cell2.v, dataStream = (_b = (_a5 = cell2.p) == null ? void 0 : _a5.body) == null ? void 0 : _b.dataStream.replace(/\r\n$/, "");
1044
- return isNullable(v) ? isNullable(dataStream) ? null : dataStream : v;
1045
- }, "getCellValue"), DAY_SIZE = 86400;
1046
- function toYMD_1900(ord, leap1900 = !0) {
1047
- if (leap1900 && ord >= 0) {
1048
- if (ord === 0)
1055
+ if (s.t === J.BOOLEAN)
1056
+ return s.v === j2.TRUE ? U2.TRUE : U2.FALSE;
1057
+ const n = s.v, e = (i = (t = s.p) == null ? void 0 : t.body) == null ? void 0 : i.dataStream.replace(/\r\n$/, "");
1058
+ return z(n) ? z(e) ? null : e : n;
1059
+ }, B2 = 86400;
1060
+ function r1(s, n = !0) {
1061
+ if (n && s >= 0) {
1062
+ if (s === 0)
1049
1063
  return [1900, 1, 0];
1050
- if (ord === 60)
1064
+ if (s === 60)
1051
1065
  return [1900, 2, 29];
1052
- if (ord < 60)
1053
- return [1900, ord < 32 ? 1 : 2, (ord - 1) % 31 + 1];
1054
- }
1055
- let l = ord + 68569 + 2415019;
1056
- const n = Math.floor(4 * l / 146097);
1057
- l = l - Math.floor((146097 * n + 3) / 4);
1058
- const i = Math.floor(4e3 * (l + 1) / 1461001);
1059
- l = l - Math.floor(1461 * i / 4) + 31;
1060
- const j = Math.floor(80 * l / 2447), nDay = l - Math.floor(2447 * j / 80);
1061
- l = Math.floor(j / 11);
1062
- const nMonth = j + 2 - 12 * l;
1063
- return [100 * (n - 49) + i + l | 0, nMonth | 0, nDay | 0];
1066
+ if (s < 60)
1067
+ return [1900, s < 32 ? 1 : 2, (s - 1) % 31 + 1];
1068
+ }
1069
+ let e = s + 68569 + 2415019;
1070
+ const t = Math.floor(4 * e / 146097);
1071
+ e = e - Math.floor((146097 * t + 3) / 4);
1072
+ const i = Math.floor(4e3 * (e + 1) / 1461001);
1073
+ e = e - Math.floor(1461 * i / 4) + 31;
1074
+ const r = Math.floor(80 * e / 2447), a = e - Math.floor(2447 * r / 80);
1075
+ e = Math.floor(r / 11);
1076
+ const o = r + 2 - 12 * e;
1077
+ return [100 * (t - 49) + i + e | 0, o | 0, a | 0];
1064
1078
  }
1065
- __name(toYMD_1900, "toYMD_1900");
1066
- const serialTimeToTimestamp = /* @__PURE__ */ __name((value) => {
1067
- let date = value | 0;
1068
- const t = DAY_SIZE * (value - date);
1069
- let time = Math.floor(t);
1070
- t - time > 0.9999 && (time += 1, time === DAY_SIZE && (time = 0, date += 1));
1071
- const x = time < 0 ? DAY_SIZE + time : time, [y, m, d] = toYMD_1900(value, !0), hh = Math.floor(x / 60 / 60) % 60, mm = Math.floor(x / 60) % 60, ss = Math.floor(x) % 60;
1072
- return dayjs(`${y}/${m}/${d} ${hh}:${mm}:${ss}`).valueOf();
1073
- }, "serialTimeToTimestamp"), getValueByType = /* @__PURE__ */ __name((value, matrix, context) => {
1074
- switch (value.type) {
1075
- case CFValueType.max: {
1076
- let max = 0;
1077
- return matrix.forValue((row, col, value2) => {
1078
- value2 > max && (max = value2);
1079
+ const a1 = (s) => {
1080
+ let n = s | 0;
1081
+ const e = B2 * (s - n);
1082
+ let t = Math.floor(e);
1083
+ e - t > 0.9999 && (t += 1, t === B2 && (t = 0, n += 1));
1084
+ const i = t < 0 ? B2 + t : t, [r, a, o] = r1(s, !0), l = Math.floor(i / 60 / 60) % 60, c = Math.floor(i / 60) % 60, h = Math.floor(i) % 60;
1085
+ return $(`${r}/${a}/${o} ${l}:${c}:${h}`).valueOf();
1086
+ }, R2 = (s, n, e) => {
1087
+ switch (s.type) {
1088
+ case e2.max: {
1089
+ let t = 0;
1090
+ return n.forValue((i, r, a) => {
1091
+ a > t && (t = a);
1079
1092
  }), {
1080
- status: FormulaResultStatus.SUCCESS,
1081
- result: max
1093
+ status: Z.SUCCESS,
1094
+ result: t
1082
1095
  };
1083
1096
  }
1084
- case CFValueType.min: {
1085
- let min;
1086
- return matrix.forValue((row, col, value2) => {
1087
- min === void 0 && (min = value2), value2 < min && (min = value2);
1097
+ case e2.min: {
1098
+ let t;
1099
+ return n.forValue((i, r, a) => {
1100
+ t === void 0 && (t = a), a < t && (t = a);
1088
1101
  }), {
1089
- status: FormulaResultStatus.SUCCESS,
1090
- result: min
1102
+ status: Z.SUCCESS,
1103
+ result: t
1091
1104
  };
1092
1105
  }
1093
- case CFValueType.percent: {
1094
- let max, min;
1095
- matrix.forValue((row, col, value2) => {
1096
- (max === void 0 || min === void 0) && (max = value2, min = value2), value2 > max && (max = value2), value2 < min && (min = value2);
1106
+ case e2.percent: {
1107
+ let t, i;
1108
+ n.forValue((o, l, c) => {
1109
+ (t === void 0 || i === void 0) && (t = c, i = c), c > t && (t = c), c < i && (i = c);
1097
1110
  });
1098
- const length = (max || 0) - (min || 0), v = Math.max(Math.min(Number(value.value) || 0, 100), 0);
1111
+ const r = (t || 0) - (i || 0), a = Math.max(Math.min(Number(s.value) || 0, 100), 0);
1099
1112
  return {
1100
- status: FormulaResultStatus.SUCCESS,
1101
- result: length * (v / 100) + (min || 0)
1113
+ status: Z.SUCCESS,
1114
+ result: r * (a / 100) + (i || 0)
1102
1115
  };
1103
1116
  }
1104
- case CFValueType.percentile: {
1105
- const list = matrix.toNativeArray().sort((a, b) => a - b), v = Math.max(Math.min(Number(value.value) || 0, 100), 0), index = (list.length - 1) * v / 100, intIndex = Math.floor(index), decimalIndex = index - intIndex, result = list[intIndex] + (list[Math.min(intIndex + 1, list.length - 1)] - list[intIndex]) * decimalIndex;
1117
+ case e2.percentile: {
1118
+ const t = n.toNativeArray().sort((c, h) => c - h), i = Math.max(Math.min(Number(s.value) || 0, 100), 0), r = (t.length - 1) * i / 100, a = Math.floor(r), o = r - a, l = t[a] + (t[Math.min(a + 1, t.length - 1)] - t[a]) * o;
1106
1119
  return {
1107
- status: FormulaResultStatus.SUCCESS,
1108
- result
1120
+ status: Z.SUCCESS,
1121
+ result: l
1109
1122
  };
1110
1123
  }
1111
- case CFValueType.formula: {
1112
- const { accessor, unitId, subUnitId, cfId } = context, formulaText = String(value.value), conditionalFormattingFormulaService = accessor.get(ConditionalFormattingFormulaService);
1113
- return conditionalFormattingFormulaService.registerFormula(unitId, subUnitId, cfId, formulaText), conditionalFormattingFormulaService.getFormulaResult(unitId, subUnitId, formulaText);
1124
+ case e2.formula: {
1125
+ const { accessor: t, unitId: i, subUnitId: r, cfId: a } = e, o = String(s.value), l = t.get(n2);
1126
+ return l.registerFormulaWithRange(i, r, a, o), l.getFormulaResult(i, r, a, o);
1114
1127
  }
1115
- case CFValueType.num: {
1116
- const v = Number(value.value);
1128
+ case e2.num: {
1129
+ const t = Number(s.value);
1117
1130
  return {
1118
- status: FormulaResultStatus.SUCCESS,
1119
- result: Number.isNaN(v) ? 0 : v
1131
+ status: Z.SUCCESS,
1132
+ result: Number.isNaN(t) ? 0 : t
1120
1133
  };
1121
1134
  }
1122
1135
  }
1123
- }, "getValueByType"), getCacheStyleMatrix = /* @__PURE__ */ __name((unitId, subUnitId, rule, context) => {
1124
- const { accessor } = context, conditionalFormattingViewModel = accessor.get(ConditionalFormattingViewModel), matrix = new ObjectMatrix();
1125
- return rule.ranges.forEach((range) => {
1126
- Range.foreach(range, (row, col) => {
1127
- const cellCfItem = conditionalFormattingViewModel.getCellCf(unitId, subUnitId, row, col);
1128
- if (cellCfItem) {
1129
- const item = cellCfItem.cfList.find((item2) => item2.cfId === rule.cfId);
1130
- item != null && item.ruleCache && matrix.setValue(row, col, item.ruleCache);
1136
+ }, G1 = (s, n, e, t) => {
1137
+ const { accessor: i } = t, r = i.get(I2), a = new j();
1138
+ return e.ranges.forEach((o) => {
1139
+ q.foreach(o, (l, c) => {
1140
+ const h = r.getCellCf(s, n, l, c);
1141
+ if (h) {
1142
+ const u = h.cfList.find((f) => f.cfId === e.cfId);
1143
+ u != null && u.ruleCache && a.setValue(l, c, u.ruleCache);
1131
1144
  }
1132
1145
  });
1133
- }), matrix;
1134
- }, "getCacheStyleMatrix"), compareWithNumber = /* @__PURE__ */ __name((config, v) => {
1135
- switch (config.operator) {
1136
- case CFNumberOperator.between: {
1137
- if (typeof config.value != "object" || !config.value.length)
1146
+ }), a;
1147
+ }, F2 = (s, n) => {
1148
+ switch (s.operator) {
1149
+ case B.between: {
1150
+ if (typeof s.value != "object" || !s.value.length)
1138
1151
  return;
1139
- const start = Math.min(...config.value), end = Math.max(...config.value);
1140
- return v >= start && v <= end;
1152
+ const e = Math.min(...s.value), t = Math.max(...s.value);
1153
+ return n >= e && n <= t;
1141
1154
  }
1142
- case CFNumberOperator.notBetween: {
1143
- if (typeof config.value != "object" || !config.value.length)
1155
+ case B.notBetween: {
1156
+ if (typeof s.value != "object" || !s.value.length)
1144
1157
  return;
1145
- const start = Math.min(...config.value), end = Math.max(...config.value);
1146
- return !(v >= start && v <= end);
1158
+ const e = Math.min(...s.value), t = Math.max(...s.value);
1159
+ return !(n >= e && n <= t);
1147
1160
  }
1148
- case CFNumberOperator.equal: {
1149
- const condition = config.value || 0;
1150
- return isFloatsEqual(condition, v);
1161
+ case B.equal: {
1162
+ const e = s.value || 0;
1163
+ return y2(e, n);
1151
1164
  }
1152
- case CFNumberOperator.notEqual: {
1153
- const condition = config.value || 0;
1154
- return !isFloatsEqual(condition, v);
1165
+ case B.notEqual: {
1166
+ const e = s.value || 0;
1167
+ return !y2(e, n);
1155
1168
  }
1156
- case CFNumberOperator.greaterThan: {
1157
- const condition = config.value || 0;
1158
- return v > condition;
1169
+ case B.greaterThan: {
1170
+ const e = s.value || 0;
1171
+ return n > e;
1159
1172
  }
1160
- case CFNumberOperator.greaterThanOrEqual: {
1161
- const condition = config.value || 0;
1162
- return v >= condition;
1173
+ case B.greaterThanOrEqual: {
1174
+ const e = s.value || 0;
1175
+ return n >= e;
1163
1176
  }
1164
- case CFNumberOperator.lessThan: {
1165
- const condition = config.value || 0;
1166
- return v < condition;
1177
+ case B.lessThan: {
1178
+ const e = s.value || 0;
1179
+ return n < e;
1167
1180
  }
1168
- case CFNumberOperator.lessThanOrEqual: {
1169
- const condition = config.value || 0;
1170
- return v <= condition;
1181
+ case B.lessThanOrEqual: {
1182
+ const e = s.value || 0;
1183
+ return n <= e;
1171
1184
  }
1172
1185
  default:
1173
1186
  return !1;
1174
1187
  }
1175
- }, "compareWithNumber"), getOppositeOperator = /* @__PURE__ */ __name((operator) => {
1176
- switch (operator) {
1177
- case CFNumberOperator.greaterThan:
1178
- return CFNumberOperator.lessThanOrEqual;
1179
- case CFNumberOperator.greaterThanOrEqual:
1180
- return CFNumberOperator.lessThan;
1181
- case CFNumberOperator.lessThan:
1182
- return CFNumberOperator.greaterThanOrEqual;
1183
- case CFNumberOperator.lessThanOrEqual:
1184
- return CFNumberOperator.greaterThan;
1185
- }
1186
- return operator;
1187
- }, "getOppositeOperator"), getColorScaleFromValue = /* @__PURE__ */ __name((colorList, value) => {
1188
- const prefixRgba = /* @__PURE__ */ __name((rgb) => rgb.a !== void 0 ? rgb : { ...rgb, a: 1 }, "prefixRgba"), index = colorList.findIndex((item) => item.value >= value), preIndex = index - 1;
1189
- if (index === 0)
1190
- return colorList[0].color.toRgbString();
1191
- if (preIndex >= 0) {
1192
- const minItem = colorList[preIndex], maxItem = colorList[index];
1193
- if (minItem.color.isValid && maxItem.color.isValid) {
1194
- const minRgb = prefixRgba(minItem.color.toRgb()), maxRgb = prefixRgba(maxItem.color.toRgb()), length = maxItem.value - minItem.value, v = (value - minItem.value) / length, rgbResult = ["r", "g", "b", "a"].reduce((obj, key) => {
1195
- const minV = minRgb[key];
1196
- return obj[key] = (maxRgb[key] - minV) * v + minV, obj;
1188
+ }, o1 = (s) => {
1189
+ switch (s) {
1190
+ case B.greaterThan:
1191
+ return B.lessThanOrEqual;
1192
+ case B.greaterThanOrEqual:
1193
+ return B.lessThan;
1194
+ case B.lessThan:
1195
+ return B.greaterThanOrEqual;
1196
+ case B.lessThanOrEqual:
1197
+ return B.greaterThan;
1198
+ }
1199
+ return s;
1200
+ }, l1 = (s, n) => {
1201
+ const e = (r) => r.a !== void 0 ? r : { ...r, a: 1 }, t = s.findIndex((r) => r.value >= n), i = t - 1;
1202
+ if (t === 0)
1203
+ return s[0].color.toRgbString();
1204
+ if (i >= 0) {
1205
+ const r = s[i], a = s[t];
1206
+ if (r.color.isValid && a.color.isValid) {
1207
+ const o = e(r.color.toRgb()), l = e(a.color.toRgb()), c = a.value - r.value, h = (n - r.value) / c, u = ["r", "g", "b", "a"].reduce((d, g) => {
1208
+ const D = o[g];
1209
+ return d[g] = (l[g] - D) * h + D, d;
1197
1210
  }, {});
1198
- return new ColorKit(rgbResult).toRgbString();
1211
+ return new H2(u).toRgbString();
1199
1212
  }
1200
1213
  } else
1201
- return colorList[colorList.length - 1].color.toRgbString();
1202
- }, "getColorScaleFromValue"), filterRange = /* @__PURE__ */ __name((ranges, maxRow, maxCol) => ranges.map((range) => {
1203
- if (range.startColumn > maxCol || range.startRow > maxRow)
1214
+ return s[s.length - 1].color.toRgbString();
1215
+ }, L2 = (s, n, e) => s.map((t) => {
1216
+ if (t.startColumn > e || t.startRow > n)
1204
1217
  return null;
1205
- const _range = { ...range };
1206
- return _range.endRow = Math.min(_range.endRow, maxRow), _range.endColumn = Math.min(_range.endColumn, maxCol), _range;
1207
- }).filter((range) => !!range), "filterRange"), emptyStyle = "", colorScaleCellCalculateUnit = {
1208
- type: CFRuleType.colorScale,
1209
- handle: /* @__PURE__ */ __name(async (rule, context) => {
1210
- var _a5;
1211
- const ruleConfig = rule.rule, conditionalFormattingFormulaService = context.accessor.get(ConditionalFormattingFormulaService), { worksheet } = context, matrix = new ObjectMatrix(), ranges = filterRange(rule.ranges, worksheet.getMaxRows() - 1, worksheet.getMaxColumns() - 1);
1212
- ranges.forEach((range) => {
1213
- Range.foreach(range, (row, col) => {
1214
- const cell2 = worksheet == null ? void 0 : worksheet.getCellRaw(row, col), v = cell2 && cell2.v;
1215
- if (!isNullable(v) && (cell2 == null ? void 0 : cell2.t) === CellValueType.NUMBER) {
1216
- const _value = Number(v);
1217
- !Number.isNaN(_value) && matrix.setValue(row, col, _value);
1218
+ const i = { ...t };
1219
+ return i.endRow = Math.min(i.endRow, n), i.endColumn = Math.min(i.endColumn, e), i;
1220
+ }).filter((t) => !!t);
1221
+ function X1(s) {
1222
+ let n = 0;
1223
+ return new j(s).forValue((e, t, i) => {
1224
+ n = Math.max(Number.isNaN(n) ? 0 : n, Number(i));
1225
+ }), n;
1226
+ }
1227
+ const c1 = "", u1 = {
1228
+ type: H.colorScale,
1229
+ handle: async (s, n) => {
1230
+ var u;
1231
+ const e = s.rule, t = n.accessor.get(n2), { worksheet: i } = n, r = new j(), a = L2(s.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1);
1232
+ a.forEach((f) => {
1233
+ q.foreach(f, (d, g) => {
1234
+ const D = i == null ? void 0 : i.getCellRaw(d, g), m = D && D.v;
1235
+ if (!z(m) && (D == null ? void 0 : D.t) === J.NUMBER) {
1236
+ const F = Number(m);
1237
+ !Number.isNaN(F) && r.setValue(d, g, F);
1218
1238
  }
1219
1239
  });
1220
1240
  });
1221
- const computeResult = new ObjectMatrix();
1222
- ranges.forEach((range) => {
1223
- Range.foreach(range, (row, col) => {
1224
- computeResult.setValue(row, col, emptyStyle);
1241
+ const o = new j();
1242
+ a.forEach((f) => {
1243
+ q.foreach(f, (d, g) => {
1244
+ o.setValue(d, g, c1);
1225
1245
  });
1226
1246
  });
1227
- const _configList = [...ruleConfig.config].sort((a, b) => a.index - b.index).map((config) => ({
1228
- value: getValueByType(config.value, matrix, { ...context, cfId: rule.cfId }),
1229
- color: new ColorKit(config.color)
1247
+ const l = [...e.config].sort((f, d) => f.index - d.index).map((f) => ({
1248
+ value: R2(f.value, r, { ...n, cfId: s.cfId }),
1249
+ color: new H2(f.color)
1230
1250
  }));
1231
- if (_configList.some((item) => isObject(item.value) ? item.value.status !== FormulaResultStatus.SUCCESS : !1))
1232
- return (_a5 = conditionalFormattingFormulaService.getCache(context.unitId, context.subUnitId, rule.cfId)) != null ? _a5 : computeResult;
1233
- const colorList = _configList.map((item) => item.color).reduce((result, color, index) => (result.result.push({ color, value: result.sortValue[index] }), result), {
1251
+ if (l.some((f) => A0(f.value) ? f.value.status !== Z.SUCCESS : !1))
1252
+ return (u = t.getCache(n.unitId, n.subUnitId, s.cfId)) != null ? u : o;
1253
+ const h = l.map((f) => f.color).reduce((f, d, g) => (f.result.push({ color: d, value: f.sortValue[g] }), f), {
1234
1254
  result: [],
1235
- sortValue: _configList.map((item) => item.value.result).sort((a, b) => a - b)
1255
+ sortValue: l.map((f) => f.value.result).sort((f, d) => f - d)
1236
1256
  }).result;
1237
- return colorList.length <= 1 || matrix.forValue((row, col, value) => {
1238
- const color = getColorScaleFromValue(colorList, value);
1239
- color && computeResult.setValue(row, col, color);
1240
- }), computeResult;
1241
- }, "handle")
1242
- }, dataBarUKey = "sheet-conditional-rule-data-bar", defaultDataBarPositiveColor = "#ffbe38", defaultDataBarNativeColor = "#abd91a", EXTENSION_Z_INDEX$1 = 34, _DataBar = class _DataBar extends SheetExtension {
1257
+ return h.length <= 1 || r.forValue((f, d, g) => {
1258
+ const D = l1(h, g);
1259
+ D && o.setValue(f, d, D);
1260
+ }), o;
1261
+ }
1262
+ }, h1 = "sheet-conditional-rule-data-bar", W2 = "#ffbe38", P2 = "#abd91a", d1 = 34;
1263
+ class g1 extends X2 {
1243
1264
  constructor() {
1244
1265
  super(...arguments);
1245
- __publicField(this, "_paddingRightAndLeft", 2);
1246
- __publicField(this, "_paddingTopAndBottom", 2);
1247
- __publicField(this, "uKey", dataBarUKey);
1248
- __publicField(this, "Z_INDEX", EXTENSION_Z_INDEX$1);
1249
- __publicField(this, "_radius", 1);
1266
+ S(this, "_paddingRightAndLeft", 2);
1267
+ S(this, "_paddingTopAndBottom", 2);
1268
+ S(this, "uKey", h1);
1269
+ S(this, "Z_INDEX", d1);
1270
+ S(this, "_radius", 1);
1250
1271
  }
1251
1272
  // eslint-disable-next-line max-lines-per-function
1252
- draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges) {
1253
- const { worksheet } = spreadsheetSkeleton;
1254
- if (!worksheet)
1273
+ draw(e, t, i, r) {
1274
+ const { worksheet: a } = i;
1275
+ if (!a)
1255
1276
  return !1;
1256
- ctx.save(), Range.foreach(spreadsheetSkeleton.rowColumnSegment, (row, col) => {
1257
- if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col))
1277
+ e.save(), q.foreach(i.rowColumnSegment, (o, l) => {
1278
+ if (!a.getRowVisible(o) || !a.getColVisible(l))
1258
1279
  return;
1259
- const cellData = worksheet.getCell(row, col);
1260
- if (cellData && cellData.dataBar) {
1261
- const { color, value, startPoint, isGradient } = cellData.dataBar, cellInfo = spreadsheetSkeleton.getCellByIndexWithNoHeader(row, col);
1262
- let { isMerged, isMergedMainCell, mergeInfo, startY, endY, startX, endX } = cellInfo;
1263
- if (isMerged || (isMergedMainCell && (startY = mergeInfo.startY, endY = mergeInfo.endY, startX = mergeInfo.startX, endX = mergeInfo.endX), !this.isRenderDiffRangesByCell(mergeInfo, diffRanges)))
1280
+ const c = a.getCell(o, l);
1281
+ if (c && c.dataBar) {
1282
+ const { color: h, value: u, startPoint: f, isGradient: d } = c.dataBar, g = i.getCellByIndexWithNoHeader(o, l);
1283
+ let { isMerged: D, isMergedMainCell: m, mergeInfo: F, startY: y, endY: R, startX: L, endX: W } = g;
1284
+ if (D || (m && (y = F.startY, R = F.endY, L = F.startX, W = F.endX), !this.isRenderDiffRangesByCell(F, r)))
1264
1285
  return;
1265
- const borderWidth = endX - startX, borderHeight = endY + FIX_ONE_PIXEL_BLUR_OFFSET - startY, width = borderWidth - this._paddingRightAndLeft * 2, height = borderHeight - this._paddingTopAndBottom * 2;
1266
- if (value > 0) {
1267
- const dataBarWidth = Math.max(width * (1 - startPoint / 100) * value / 100, 1), x0 = startX + this._paddingRightAndLeft + startPoint / 100 * width, y0 = startY + this._paddingTopAndBottom;
1268
- if (isGradient) {
1269
- const gradient = ctx.createLinearGradient(x0, y0, x0 + dataBarWidth, y0);
1270
- gradient.addColorStop(0, color), gradient.addColorStop(1, "rgb(255 255 255)"), ctx.fillStyle = gradient, ctx.strokeStyle = color, ctx.lineWidth = 1;
1286
+ const U = W - L, h2 = R + x0 - y, i2 = U - this._paddingRightAndLeft * 2, a2 = h2 - this._paddingTopAndBottom * 2;
1287
+ if (u > 0) {
1288
+ const I = Math.max(i2 * (1 - f / 100) * u / 100, 1), M = L + this._paddingRightAndLeft + f / 100 * i2, Y = y + this._paddingTopAndBottom;
1289
+ if (d) {
1290
+ const t2 = e.createLinearGradient(M, Y, M + I, Y);
1291
+ t2.addColorStop(0, h), t2.addColorStop(1, "rgb(255 255 255)"), e.fillStyle = t2, e.strokeStyle = h, e.lineWidth = 1;
1271
1292
  } else
1272
- ctx.fillStyle = color;
1273
- this._drawRectWithRoundedCorner(ctx, x0, y0, dataBarWidth, height, !1, !0, !0, !1), isGradient && ctx.stroke();
1293
+ e.fillStyle = h;
1294
+ this._drawRectWithRoundedCorner(e, M, Y, I, a2, !1, !0, !0, !1), d && e.stroke();
1274
1295
  } else {
1275
- const dataBarWidth = Math.max(width * startPoint / 100 * Math.abs(value) / 100, 1), x0 = startX + this._paddingRightAndLeft + startPoint / 100 * width - dataBarWidth, y0 = startY + this._paddingTopAndBottom;
1276
- if (isGradient) {
1277
- const gradient = ctx.createLinearGradient(x0, y0, x0 + dataBarWidth, y0);
1278
- gradient.addColorStop(0, "rgb(255 255 255)"), gradient.addColorStop(1, color), ctx.fillStyle = gradient, ctx.strokeStyle = color, ctx.lineWidth = 1;
1296
+ const I = Math.max(i2 * f / 100 * Math.abs(u) / 100, 1), M = L + this._paddingRightAndLeft + f / 100 * i2 - I, Y = y + this._paddingTopAndBottom;
1297
+ if (d) {
1298
+ const t2 = e.createLinearGradient(M, Y, M + I, Y);
1299
+ t2.addColorStop(0, "rgb(255 255 255)"), t2.addColorStop(1, h), e.fillStyle = t2, e.strokeStyle = h, e.lineWidth = 1;
1279
1300
  } else
1280
- ctx.fillStyle = color;
1281
- this._drawRectWithRoundedCorner(ctx, x0, y0, dataBarWidth, height, !0, !1, !1, !0), isGradient && ctx.stroke();
1301
+ e.fillStyle = h;
1302
+ this._drawRectWithRoundedCorner(e, M, Y, I, a2, !0, !1, !1, !0), d && e.stroke();
1282
1303
  }
1283
1304
  }
1284
- }), ctx.restore();
1305
+ }), e.restore();
1285
1306
  }
1286
- _drawRectWithRoundedCorner(ctx, x, y, width, height, topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius) {
1287
- const radius = this._radius;
1288
- !height || !width || (ctx.beginPath(), ctx.moveTo(x + radius, y), ctx.lineTo(x + width - radius, y), topRightRadius ? ctx.arcTo(x + width, y, x + width, y + radius, radius) : ctx.lineTo(x + width, y), ctx.lineTo(x + width, y + height - radius), bottomRightRadius ? ctx.arcTo(x + width, y + height, x + width - radius, y + height, radius) : ctx.lineTo(x + width, y + height), ctx.lineTo(x + radius, y + height), bottomLeftRadius ? ctx.arcTo(x, y + height, x, y + height - radius, radius) : ctx.lineTo(x, y + height), ctx.lineTo(x, y + radius), topLeftRadius ? ctx.arcTo(x, y, x + radius, y, radius) : ctx.lineTo(x, y), ctx.closePath(), ctx.fill());
1307
+ _drawRectWithRoundedCorner(e, t, i, r, a, o, l, c, h) {
1308
+ const u = this._radius;
1309
+ !a || !r || (e.beginPath(), e.moveTo(t + u, i), e.lineTo(t + r - u, i), l ? e.arcTo(t + r, i, t + r, i + u, u) : e.lineTo(t + r, i), e.lineTo(t + r, i + a - u), c ? e.arcTo(t + r, i + a, t + r - u, i + a, u) : e.lineTo(t + r, i + a), e.lineTo(t + u, i + a), h ? e.arcTo(t, i + a, t, i + a - u, u) : e.lineTo(t, i + a), e.lineTo(t, i + u), o ? e.arcTo(t, i, t + u, i, u) : e.lineTo(t, i), e.closePath(), e.fill());
1289
1310
  }
1290
- };
1291
- __name(_DataBar, "DataBar");
1292
- let DataBar = _DataBar;
1293
- SpreadsheetExtensionRegistry.add(DataBar);
1294
- const EMPTY_STYLE = {};
1295
- Object.freeze(EMPTY_STYLE);
1296
- const dataBarCellCalculateUnit = {
1297
- type: CFRuleType.dataBar,
1311
+ }
1312
+ G2.add(g1);
1313
+ const f2 = {};
1314
+ Object.freeze(f2);
1315
+ const f1 = {
1316
+ type: H.dataBar,
1298
1317
  // eslint-disable-next-line max-lines-per-function
1299
- handle: /* @__PURE__ */ __name(async (rule, context) => {
1300
- const ruleConfig = rule.rule, conditionalFormattingFormulaService = context.accessor.get(ConditionalFormattingFormulaService), { worksheet } = context, matrix = new ObjectMatrix(), ranges = filterRange(rule.ranges, worksheet.getMaxRows() - 1, worksheet.getMaxColumns() - 1);
1301
- ranges.forEach((range) => {
1302
- Range.foreach(range, (row, col) => {
1303
- const cell2 = worksheet == null ? void 0 : worksheet.getCellRaw(row, col), v = cell2 && cell2.v;
1304
- if (!isNullable(v) && (cell2 == null ? void 0 : cell2.t) === CellValueType.NUMBER) {
1305
- const _value = Number(v);
1306
- !Number.isNaN(_value) && matrix.setValue(row, col, _value);
1318
+ handle: async (s, n) => {
1319
+ const e = s.rule, t = n.accessor.get(n2), { worksheet: i } = n, r = new j(), a = L2(s.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1);
1320
+ a.forEach((D) => {
1321
+ q.foreach(D, (m, F) => {
1322
+ const y = i == null ? void 0 : i.getCellRaw(m, F), R = y && y.v;
1323
+ if (!z(R) && (y == null ? void 0 : y.t) === J.NUMBER) {
1324
+ const L = Number(R);
1325
+ !Number.isNaN(L) && r.setValue(m, F, L);
1307
1326
  }
1308
1327
  });
1309
1328
  });
1310
- const computeResult = new ObjectMatrix();
1311
- ranges.forEach((range) => {
1312
- Range.foreach(range, (row, col) => {
1313
- computeResult.setValue(row, col, EMPTY_STYLE);
1329
+ const o = new j();
1330
+ a.forEach((D) => {
1331
+ q.foreach(D, (m, F) => {
1332
+ o.setValue(m, F, f2);
1314
1333
  });
1315
1334
  });
1316
- const _min = getValueByType(ruleConfig.config.min, matrix, { ...context, cfId: rule.cfId }), _max = getValueByType(ruleConfig.config.max, matrix, { ...context, cfId: rule.cfId });
1317
- let min = 0, max = 0;
1318
- if (_min.status === FormulaResultStatus.WAIT)
1319
- return conditionalFormattingFormulaService.getCache(context.unitId, context.subUnitId, rule.cfId) || computeResult;
1320
- if (_min.status === FormulaResultStatus.SUCCESS) {
1321
- const v = Number(_min.result);
1322
- min = Number.isNaN(v) ? 0 : v;
1335
+ const l = R2(e.config.min, r, { ...n, cfId: s.cfId }), c = R2(e.config.max, r, { ...n, cfId: s.cfId });
1336
+ let h = 0, u = 0;
1337
+ if (l.status === Z.WAIT)
1338
+ return t.getCache(n.unitId, n.subUnitId, s.cfId) || o;
1339
+ if (l.status === Z.SUCCESS) {
1340
+ const D = Number(l.result);
1341
+ h = Number.isNaN(D) ? 0 : D;
1323
1342
  } else
1324
- return computeResult;
1325
- if (_max.status === FormulaResultStatus.WAIT)
1326
- return conditionalFormattingFormulaService.getCache(context.unitId, context.subUnitId, rule.cfId) || computeResult;
1327
- if (_max.status === FormulaResultStatus.SUCCESS) {
1328
- const v = Number.isNaN(Number(_max.result)) ? 0 : Number(_max.result);
1329
- max = Math.max(v, min), min = Math.min(v, min);
1343
+ return o;
1344
+ if (c.status === Z.WAIT)
1345
+ return t.getCache(n.unitId, n.subUnitId, s.cfId) || o;
1346
+ if (c.status === Z.SUCCESS) {
1347
+ const D = Number(c.result), m = Number.isNaN(D) ? 0 : D;
1348
+ u = Math.max(m, h), h = Math.min(m, h);
1330
1349
  } else
1331
- return computeResult;
1332
- const isGradient = ruleConfig.config.isGradient, isShowValue = ruleConfig.isShowValue, getSafeValue = /* @__PURE__ */ __name((v) => Math.max(Math.min(100, v), 0), "getSafeValue");
1333
- if (!(min === max || max < min)) {
1334
- if (min < 0 && max <= 0) {
1335
- const length = max - min, startPoint = 100;
1336
- matrix.forValue((row, col, value) => {
1337
- if (value > max)
1350
+ return o;
1351
+ const f = e.config.isGradient, d = e.isShowValue, g = (D) => Math.max(Math.min(100, D), 0);
1352
+ if (!(h === u || u < h)) {
1353
+ if (h < 0 && u <= 0) {
1354
+ const D = u - h, m = 100;
1355
+ r.forValue((F, y, R) => {
1356
+ if (R > u)
1338
1357
  return;
1339
- const v = getSafeValue((max - value) / length * 100);
1340
- computeResult.setValue(row, col, { color: ruleConfig.config.nativeColor || defaultDataBarNativeColor, startPoint, value: -v, isGradient, isShowValue });
1358
+ const L = g((u - R) / D * 100);
1359
+ o.setValue(F, y, { color: e.config.nativeColor || P2, startPoint: m, value: -L, isGradient: f, isShowValue: d });
1341
1360
  });
1342
- } else if (min < 0 && max > 0) {
1343
- const length = Math.abs(max) + Math.abs(min), startPoint = Math.abs(min) / length * 100;
1344
- matrix.forValue((row, col, value) => {
1345
- if (value)
1346
- if (value > 0) {
1347
- const v = getSafeValue(Math.min(value / max, 1) * 100);
1348
- computeResult.setValue(row, col, { color: ruleConfig.config.positiveColor, startPoint, value: v, isGradient, isShowValue });
1361
+ } else if (h < 0 && u > 0) {
1362
+ const D = Math.abs(u) + Math.abs(h), m = Math.abs(h) / D * 100;
1363
+ r.forValue((F, y, R) => {
1364
+ if (R)
1365
+ if (R > 0) {
1366
+ const L = g(Math.min(R / u, 1) * 100);
1367
+ o.setValue(F, y, { color: e.config.positiveColor || W2, startPoint: m, value: L, isGradient: f, isShowValue: d });
1349
1368
  } else {
1350
- const v = getSafeValue(Math.min(Math.abs(value) / Math.abs(min), 1) * 100);
1351
- computeResult.setValue(row, col, { color: ruleConfig.config.nativeColor || defaultDataBarNativeColor, startPoint, value: -v, isGradient, isShowValue });
1369
+ const L = g(Math.min(Math.abs(R) / Math.abs(h), 1) * 100);
1370
+ o.setValue(F, y, { color: e.config.nativeColor || P2, startPoint: m, value: -L, isGradient: f, isShowValue: d });
1352
1371
  }
1353
1372
  });
1354
- } else if (min >= 0 && max > 0) {
1355
- const length = max - min, startPoint = 0;
1356
- matrix.forValue((row, col, value) => {
1357
- if (value < min)
1373
+ } else if (h >= 0 && u > 0) {
1374
+ const D = u - h, m = 0;
1375
+ r.forValue((F, y, R) => {
1376
+ if (R < h)
1358
1377
  return;
1359
- const v = getSafeValue((1 - (max - value) / length) * 100);
1360
- computeResult.setValue(row, col, { color: ruleConfig.config.positiveColor || defaultDataBarPositiveColor, startPoint, value: v, isGradient, isShowValue });
1378
+ const L = g((1 - (u - R) / D) * 100);
1379
+ o.setValue(F, y, { color: e.config.positiveColor || W2, startPoint: m, value: L, isGradient: f, isShowValue: d });
1361
1380
  });
1362
1381
  }
1363
1382
  }
1364
- return computeResult;
1365
- }, "handle")
1366
- }, highlightCellCalculateUnit = {
1367
- type: CFRuleType.highlightCell,
1368
- handle: /* @__PURE__ */ __name(async (rule, context) => {
1369
- const ruleConfig = rule.rule, { worksheet } = context, ranges = filterRange(rule.ranges, worksheet.getMaxRows() - 1, worksheet.getMaxColumns() - 1), cache = (/* @__PURE__ */ __name(() => {
1370
- switch (ruleConfig.subType) {
1371
- case CFSubRuleType.average: {
1372
- let sum = 0, count = 0;
1373
- return ranges.forEach((range) => {
1374
- Range.foreach(range, (row, col) => {
1375
- const cell2 = worksheet == null ? void 0 : worksheet.getCellRaw(row, col), v = getCellValue(cell2 || void 0);
1376
- cell2 && cell2.t === CellValueType.NUMBER && v !== void 0 && (sum += Number(v) || 0, count++);
1383
+ return o;
1384
+ }
1385
+ }, D1 = {
1386
+ type: H.highlightCell,
1387
+ handle: async (s, n) => {
1388
+ const e = s.rule, { worksheet: t, unitId: i, subUnitId: r } = n, a = L2(s.ranges, t.getMaxRows() - 1, t.getMaxColumns() - 1), l = (() => {
1389
+ switch (e.subType) {
1390
+ case V.average: {
1391
+ let u = 0, f = 0;
1392
+ return a.forEach((d) => {
1393
+ q.foreach(d, (g, D) => {
1394
+ const m = t == null ? void 0 : t.getCellRaw(g, D), F = r2(m || void 0);
1395
+ m && m.t === J.NUMBER && F !== void 0 && (u += Number(F) || 0, f++);
1377
1396
  });
1378
- }), { average: sum / count };
1397
+ }), { average: u / f };
1379
1398
  }
1380
- case CFSubRuleType.uniqueValues:
1381
- case CFSubRuleType.duplicateValues: {
1382
- const cacheMap = /* @__PURE__ */ new Map();
1383
- return ranges.forEach((range) => {
1384
- Range.foreach(range, (row, col) => {
1385
- const cell2 = worksheet == null ? void 0 : worksheet.getCellRaw(row, col), v = getCellValue(cell2 || void 0);
1386
- if (v !== void 0) {
1387
- const cache2 = cacheMap.get(v);
1388
- cache2 ? cacheMap.set(v, cache2 + 1) : cacheMap.set(v, 1);
1399
+ case V.uniqueValues:
1400
+ case V.duplicateValues: {
1401
+ const u = /* @__PURE__ */ new Map();
1402
+ return a.forEach((f) => {
1403
+ q.foreach(f, (d, g) => {
1404
+ const D = t == null ? void 0 : t.getCellRaw(d, g), m = r2(D || void 0);
1405
+ if (m !== void 0) {
1406
+ const F = u.get(m);
1407
+ F ? u.set(m, F + 1) : u.set(m, 1);
1389
1408
  }
1390
1409
  });
1391
- }), { count: cacheMap };
1410
+ }), { count: u };
1392
1411
  }
1393
- case CFSubRuleType.rank: {
1394
- const allValue = [];
1395
- ranges.forEach((range) => {
1396
- Range.foreach(range, (row, col) => {
1397
- const cell2 = worksheet == null ? void 0 : worksheet.getCellRaw(row, col), v = getCellValue(cell2 || void 0);
1398
- cell2 && cell2.t === CellValueType.NUMBER && v !== void 0 && allValue.push(Number(v) || 0);
1412
+ case V.rank: {
1413
+ const u = [];
1414
+ a.forEach((g) => {
1415
+ q.foreach(g, (D, m) => {
1416
+ const F = t == null ? void 0 : t.getCellRaw(D, m), y = r2(F || void 0);
1417
+ F && F.t === J.NUMBER && y !== void 0 && u.push(Number(y) || 0);
1399
1418
  });
1400
- }), allValue.sort((a, b) => b - a);
1401
- const configRule = rule.rule, targetIndex = configRule.isPercent ? Math.floor(Math.max(Math.min(configRule.value, 100), 0) / 100 * allValue.length) : Math.floor(Math.max(Math.min(configRule.isBottom ? configRule.value - 1 : configRule.value, allValue.length), 0));
1402
- return configRule.isBottom ? { rank: allValue[allValue.length - targetIndex - 1] } : { rank: allValue[Math.max(targetIndex - 1, 0)] };
1419
+ }), u.sort((g, D) => D - g);
1420
+ const f = s.rule, d = f.isPercent ? Math.floor(Math.max(Math.min(f.value, 100), 0) / 100 * u.length) : Math.floor(Math.max(Math.min(f.isBottom ? f.value - 1 : f.value, u.length), 0));
1421
+ return f.isBottom ? { rank: u[u.length - d - 1] } : { rank: u[Math.max(d - 1, 0)] };
1403
1422
  }
1404
- case CFSubRuleType.formula: {
1405
- const subRuleConfig = ruleConfig, lexerTreeBuilder = context.accessor.get(LexerTreeBuilder), formulaString = subRuleConfig.value, sequenceNodes = lexerTreeBuilder.sequenceNodesBuilder(formulaString);
1406
- return sequenceNodes ? { sequenceNodes } : {
1407
- sequenceNodes: null
1408
- };
1423
+ case V.formula: {
1424
+ const u = e;
1425
+ n.accessor.get(n2).registerFormulaWithRange(n.unitId, n.subUnitId, s.cfId, u.value, s.ranges);
1426
+ break;
1409
1427
  }
1410
- case CFSubRuleType.timePeriod:
1411
- switch (ruleConfig.operator) {
1412
- case CFTimePeriodOperator.last7Days:
1428
+ case V.timePeriod:
1429
+ switch (e.operator) {
1430
+ case K.last7Days:
1413
1431
  return {
1414
1432
  timePeriod: {
1415
- start: dayjs().subtract(7, "day").valueOf(),
1416
- end: dayjs().valueOf()
1433
+ start: $().subtract(7, "day").valueOf(),
1434
+ end: $().valueOf()
1417
1435
  }
1418
1436
  };
1419
- case CFTimePeriodOperator.lastMonth:
1437
+ case K.lastMonth:
1420
1438
  return {
1421
1439
  timePeriod: {
1422
- start: dayjs().startOf("month").subtract(1, "month").valueOf(),
1423
- end: dayjs().endOf("month").subtract(1, "month").valueOf()
1440
+ start: $().startOf("month").subtract(1, "month").valueOf(),
1441
+ end: $().endOf("month").subtract(1, "month").valueOf()
1424
1442
  }
1425
1443
  };
1426
- case CFTimePeriodOperator.lastWeek:
1444
+ case K.lastWeek:
1427
1445
  return {
1428
1446
  timePeriod: {
1429
- start: dayjs().startOf("week").subtract(1, "week").valueOf(),
1430
- end: dayjs().endOf("week").subtract(1, "week").valueOf()
1447
+ start: $().startOf("week").subtract(1, "week").valueOf(),
1448
+ end: $().endOf("week").subtract(1, "week").valueOf()
1431
1449
  }
1432
1450
  };
1433
- case CFTimePeriodOperator.nextMonth:
1451
+ case K.nextMonth:
1434
1452
  return {
1435
1453
  timePeriod: {
1436
- start: dayjs().startOf("month").add(1, "month").valueOf(),
1437
- end: dayjs().endOf("month").add(1, "month").valueOf()
1454
+ start: $().startOf("month").add(1, "month").valueOf(),
1455
+ end: $().endOf("month").add(1, "month").valueOf()
1438
1456
  }
1439
1457
  };
1440
- case CFTimePeriodOperator.nextWeek:
1458
+ case K.nextWeek:
1441
1459
  return {
1442
1460
  timePeriod: {
1443
- start: dayjs().startOf("week").add(1, "week").valueOf(),
1444
- end: dayjs().endOf("week").add(1, "week").valueOf()
1461
+ start: $().startOf("week").add(1, "week").valueOf(),
1462
+ end: $().endOf("week").add(1, "week").valueOf()
1445
1463
  }
1446
1464
  };
1447
- case CFTimePeriodOperator.thisMonth:
1465
+ case K.thisMonth:
1448
1466
  return {
1449
1467
  timePeriod: {
1450
- start: dayjs().startOf("month").valueOf(),
1451
- end: dayjs().endOf("month").valueOf()
1468
+ start: $().startOf("month").valueOf(),
1469
+ end: $().endOf("month").valueOf()
1452
1470
  }
1453
1471
  };
1454
- case CFTimePeriodOperator.thisWeek:
1472
+ case K.thisWeek:
1455
1473
  return {
1456
1474
  timePeriod: {
1457
- start: dayjs().startOf("week").valueOf(),
1458
- end: dayjs().endOf("week").valueOf()
1475
+ start: $().startOf("week").valueOf(),
1476
+ end: $().endOf("week").valueOf()
1459
1477
  }
1460
1478
  };
1461
- case CFTimePeriodOperator.today:
1479
+ case K.today:
1462
1480
  return {
1463
1481
  timePeriod: {
1464
- start: dayjs().startOf("day").valueOf(),
1465
- end: dayjs().endOf("day").valueOf()
1482
+ start: $().startOf("day").valueOf(),
1483
+ end: $().endOf("day").valueOf()
1466
1484
  }
1467
1485
  };
1468
- case CFTimePeriodOperator.tomorrow:
1486
+ case K.tomorrow:
1469
1487
  return {
1470
1488
  timePeriod: {
1471
- start: dayjs().startOf("day").add(1, "day").valueOf(),
1472
- end: dayjs().endOf("day").add(1, "day").valueOf()
1489
+ start: $().startOf("day").add(1, "day").valueOf(),
1490
+ end: $().endOf("day").add(1, "day").valueOf()
1473
1491
  }
1474
1492
  };
1475
- case CFTimePeriodOperator.yesterday:
1493
+ case K.yesterday:
1476
1494
  return {
1477
1495
  timePeriod: {
1478
- start: dayjs().startOf("day").subtract(1, "day").valueOf(),
1479
- end: dayjs().endOf("day").subtract(1, "day").valueOf()
1496
+ start: $().startOf("day").subtract(1, "day").valueOf(),
1497
+ end: $().endOf("day").subtract(1, "day").valueOf()
1480
1498
  }
1481
1499
  };
1482
1500
  }
1483
1501
  }
1484
- }, "getCache"))(), check = /* @__PURE__ */ __name((row, col) => {
1485
- const cellValue = worksheet == null ? void 0 : worksheet.getCellRaw(row, col);
1486
- switch (ruleConfig.subType) {
1487
- case CFSubRuleType.number: {
1488
- const v = cellValue && Number(cellValue.v);
1489
- if (isNullable(v) || Number.isNaN(v) || (cellValue == null ? void 0 : cellValue.t) !== CellValueType.NUMBER)
1502
+ })(), c = (u, f) => {
1503
+ const d = t == null ? void 0 : t.getCellRaw(u, f);
1504
+ switch (e.subType) {
1505
+ case V.number: {
1506
+ const g = d && Number(d.v);
1507
+ if (z(g) || Number.isNaN(g) || (d == null ? void 0 : d.t) !== J.NUMBER)
1490
1508
  return !1;
1491
- const subRuleConfig = ruleConfig;
1492
- return compareWithNumber({ operator: subRuleConfig.operator, value: subRuleConfig.value || 0 }, v || 0);
1509
+ const D = e;
1510
+ return F2({ operator: D.operator, value: D.value || 0 }, g || 0);
1493
1511
  }
1494
- case CFSubRuleType.text: {
1495
- const subRuleConfig = ruleConfig, value = getCellValue(cellValue), v = value === null ? "" : String(value), condition = subRuleConfig.value || "";
1496
- switch (subRuleConfig.operator) {
1497
- case CFTextOperator.beginsWith:
1498
- return v.startsWith(condition);
1499
- case CFTextOperator.containsBlanks:
1500
- return /^\s*$/.test(v);
1501
- case CFTextOperator.notContainsBlanks:
1502
- return !/^\s*$/.test(v);
1503
- case CFTextOperator.containsErrors:
1504
- return ERROR_TYPE_SET.has(v);
1505
- case CFTextOperator.notContainsErrors:
1506
- return !ERROR_TYPE_SET.has(v);
1507
- case CFTextOperator.containsText:
1508
- return v.indexOf(condition) > -1;
1509
- case CFTextOperator.notContainsText:
1510
- return v.indexOf(condition) === -1;
1511
- case CFTextOperator.endsWith:
1512
- return v.endsWith(condition);
1513
- case CFTextOperator.equal:
1514
- return v === condition;
1515
- case CFTextOperator.notEqual:
1516
- return v !== condition;
1512
+ case V.text: {
1513
+ const g = e, D = r2(d), m = D === null ? "" : String(D), F = g.value || "";
1514
+ switch (g.operator) {
1515
+ case X.beginsWith:
1516
+ return m.startsWith(F);
1517
+ case X.containsBlanks:
1518
+ return /^\s*$/.test(m);
1519
+ case X.notContainsBlanks:
1520
+ return !/^\s*$/.test(m);
1521
+ case X.containsErrors:
1522
+ return T2.has(m);
1523
+ case X.notContainsErrors:
1524
+ return !T2.has(m);
1525
+ case X.containsText:
1526
+ return m.indexOf(F) > -1;
1527
+ case X.notContainsText:
1528
+ return m.indexOf(F) === -1;
1529
+ case X.endsWith:
1530
+ return m.endsWith(F);
1531
+ case X.equal:
1532
+ return m === F;
1533
+ case X.notEqual:
1534
+ return m !== F;
1517
1535
  default:
1518
1536
  return !1;
1519
1537
  }
1520
1538
  }
1521
- case CFSubRuleType.timePeriod: {
1522
- const value = getCellValue(cellValue);
1523
- if (isNullable(value) || Number.isNaN(Number(value)) || (cellValue == null ? void 0 : cellValue.t) !== CellValueType.NUMBER)
1539
+ case V.timePeriod: {
1540
+ const g = r2(d);
1541
+ if (z(g) || Number.isNaN(Number(g)) || (d == null ? void 0 : d.t) !== J.NUMBER)
1524
1542
  return !1;
1525
- const v = serialTimeToTimestamp(Number(value)), { start, end } = cache.timePeriod;
1526
- return v >= start && v <= end;
1543
+ const D = a1(Number(g)), { start: m, end: F } = l.timePeriod;
1544
+ return D >= m && D <= F;
1527
1545
  }
1528
- case CFSubRuleType.average: {
1529
- const value = cellValue && cellValue.v, v = Number(value);
1530
- if (isNullable(value) || Number.isNaN(v) || (cellValue == null ? void 0 : cellValue.t) !== CellValueType.NUMBER)
1546
+ case V.average: {
1547
+ const g = d && d.v, D = Number(g);
1548
+ if (z(g) || Number.isNaN(D) || (d == null ? void 0 : d.t) !== J.NUMBER)
1531
1549
  return !1;
1532
- const subRuleConfig = ruleConfig, average = cache == null ? void 0 : cache.average;
1533
- switch (subRuleConfig.operator) {
1534
- case CFNumberOperator.greaterThan:
1535
- return v > average;
1536
- case CFNumberOperator.greaterThanOrEqual:
1537
- return v >= average;
1538
- case CFNumberOperator.lessThan:
1539
- return v < average;
1540
- case CFNumberOperator.lessThanOrEqual:
1541
- return v <= average;
1542
- case CFNumberOperator.equal:
1543
- return isFloatsEqual(v, average);
1544
- case CFNumberOperator.notEqual:
1545
- return !isFloatsEqual(v, average);
1550
+ const m = e, F = l == null ? void 0 : l.average;
1551
+ switch (m.operator) {
1552
+ case B.greaterThan:
1553
+ return D > F;
1554
+ case B.greaterThanOrEqual:
1555
+ return D >= F;
1556
+ case B.lessThan:
1557
+ return D < F;
1558
+ case B.lessThanOrEqual:
1559
+ return D <= F;
1560
+ case B.equal:
1561
+ return y2(D, F);
1562
+ case B.notEqual:
1563
+ return !y2(D, F);
1546
1564
  default:
1547
1565
  return !1;
1548
1566
  }
1549
1567
  }
1550
- case CFSubRuleType.rank: {
1551
- const value = getCellValue(cellValue), v = Number(value);
1552
- if (isNullable(value) || Number.isNaN(v) || (cellValue == null ? void 0 : cellValue.t) !== CellValueType.NUMBER)
1568
+ case V.rank: {
1569
+ const g = r2(d), D = Number(g);
1570
+ if (z(g) || Number.isNaN(D) || (d == null ? void 0 : d.t) !== J.NUMBER)
1553
1571
  return !1;
1554
- const targetValue = cache.rank;
1555
- return ruleConfig.isBottom ? v <= targetValue : v >= targetValue;
1572
+ const m = l.rank;
1573
+ return e.isBottom ? D <= m : D >= m;
1556
1574
  }
1557
- case CFSubRuleType.uniqueValues: {
1558
- const value = getCellValue(cellValue);
1559
- return isNullable(value) ? !1 : cache.count.get(value) === 1;
1575
+ case V.uniqueValues: {
1576
+ const g = r2(d);
1577
+ return z(g) ? !1 : l.count.get(g) === 1;
1560
1578
  }
1561
- case CFSubRuleType.duplicateValues: {
1562
- const value = getCellValue(cellValue);
1563
- return isNullable(value) ? !1 : cache.count.get(value) !== 1;
1579
+ case V.duplicateValues: {
1580
+ const g = r2(d);
1581
+ return z(g) ? !1 : l.count.get(g) !== 1;
1564
1582
  }
1565
- case CFSubRuleType.formula: {
1566
- if (!(cache != null && cache.sequenceNodes))
1567
- return !1;
1568
- const { unitId, subUnitId } = context, conditionalFormattingFormulaService = context.accessor.get(ConditionalFormattingFormulaService), getRangeFromCell = /* @__PURE__ */ __name((row2, col2) => ({ startRow: row2, endRow: row2, startColumn: col2, endColumn: col2 }), "getRangeFromCell"), originRange = getRangeFromCell(rule.ranges[0].startRow, rule.ranges[0].startColumn), sequenceNodes = Tools.deepClone(cache.sequenceNodes), transformSequenceNodes = Array.isArray(sequenceNodes) ? sequenceNodes.map((node) => {
1569
- if (typeof node == "object" && node.nodeType === sequenceNodeType.REFERENCE) {
1570
- const gridRangeName = deserializeRangeWithSheet(node.token), relativeRange = Rectangle.getRelativeRange(gridRangeName.range, originRange), newRange = Rectangle.getPositionRange(relativeRange, getRangeFromCell(row, col), gridRangeName.range), newToken = serializeRange(newRange);
1571
- return {
1572
- ...node,
1573
- token: newToken
1574
- };
1575
- }
1576
- return node;
1577
- }) : sequenceNodes;
1578
- let formulaString = transformSequenceNodes && generateStringWithSequence(transformSequenceNodes);
1579
- if (formulaString) {
1580
- formulaString = `=${formulaString}`, conditionalFormattingFormulaService.registerFormula(unitId, subUnitId, rule.cfId, formulaString);
1581
- const formulaItem = conditionalFormattingFormulaService.getFormulaResult(unitId, subUnitId, formulaString);
1582
- if (formulaItem && formulaItem.status === FormulaResultStatus.SUCCESS)
1583
- return formulaItem.result === !0;
1584
- {
1585
- const cache2 = conditionalFormattingFormulaService.getCache(unitId, subUnitId, rule.cfId), style = cache2 == null ? void 0 : cache2.getValue(row, col);
1586
- return style && style !== EMPTY_STYLE;
1587
- }
1588
- }
1589
- return !1;
1583
+ case V.formula: {
1584
+ const g = e, m = n.accessor.get(n2).getFormulaResult(i, r, s.cfId, g.value, u, f);
1585
+ return m && m.status === Z.SUCCESS ? m.result === !0 : !1;
1590
1586
  }
1591
1587
  }
1592
- }, "check"), computeResult = new ObjectMatrix();
1593
- return ranges.forEach((range) => {
1594
- Range.foreach(range, (row, col) => {
1595
- check(row, col) ? computeResult.setValue(row, col, ruleConfig.style) : computeResult.setValue(row, col, EMPTY_STYLE);
1588
+ }, h = new j();
1589
+ if (e.subType === V.formula) {
1590
+ const u = e, f = n.accessor.get(n2), d = f.getSubUnitFormulaMap(i, r), g = d == null ? void 0 : d.getValue(f.createCFormulaId(s.cfId, u.value), ["id"]);
1591
+ if (!g || g.status !== Z.SUCCESS)
1592
+ return f.getCache(i, r, s.cfId) || h;
1593
+ }
1594
+ return a.forEach((u) => {
1595
+ q.foreach(u, (f, d) => {
1596
+ c(f, d) ? h.setValue(f, d, e.style) : h.setValue(f, d, f2);
1596
1597
  });
1597
- }), computeResult;
1598
- }, "handle")
1599
- }, iconSetCalculateUnit = {
1600
- type: CFRuleType.iconSet,
1601
- handle: /* @__PURE__ */ __name(async (rule, context) => {
1602
- var _a5;
1603
- const ruleConfig = rule.rule, conditionalFormattingFormulaService = context.accessor.get(ConditionalFormattingFormulaService), { worksheet } = context, matrix = new ObjectMatrix(), ranges = filterRange(rule.ranges, worksheet.getMaxRows() - 1, worksheet.getMaxColumns() - 1);
1604
- ranges.forEach((range) => {
1605
- Range.foreach(range, (row, col) => {
1606
- const cell2 = worksheet == null ? void 0 : worksheet.getCellRaw(row, col), v = cell2 && cell2.v;
1607
- if (!isNullable(v) && (cell2 == null ? void 0 : cell2.t) === CellValueType.NUMBER) {
1608
- const _value = Number(v);
1609
- !Number.isNaN(_value) && matrix.setValue(row, col, _value);
1598
+ }), h;
1599
+ }
1600
+ }, C1 = {
1601
+ type: H.iconSet,
1602
+ handle: async (s, n) => {
1603
+ var f;
1604
+ const e = s.rule, t = n.accessor.get(n2), { worksheet: i } = n, r = new j(), a = L2(s.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1);
1605
+ a.forEach((d) => {
1606
+ q.foreach(d, (g, D) => {
1607
+ const m = i == null ? void 0 : i.getCellRaw(g, D), F = m && m.v;
1608
+ if (!z(F) && (m == null ? void 0 : m.t) === J.NUMBER) {
1609
+ const y = Number(F);
1610
+ !Number.isNaN(y) && r.setValue(g, D, y);
1610
1611
  }
1611
1612
  });
1612
1613
  });
1613
- const computeResult = new ObjectMatrix();
1614
- ranges.forEach((range) => {
1615
- Range.foreach(range, (row, col) => {
1616
- computeResult.setValue(row, col, EMPTY_STYLE);
1614
+ const o = new j();
1615
+ a.forEach((d) => {
1616
+ q.foreach(d, (g, D) => {
1617
+ o.setValue(g, D, f2);
1617
1618
  });
1618
1619
  });
1619
- const splitValueResult = ruleConfig.config.map((v) => getValueByType(v.value, matrix, { ...context, cfId: rule.cfId }));
1620
- if (splitValueResult.some((item) => item.status !== FormulaResultStatus.SUCCESS))
1621
- return (_a5 = conditionalFormattingFormulaService.getCache(context.unitId, context.subUnitId, rule.cfId)) != null ? _a5 : computeResult;
1622
- const splitValue = splitValueResult.map((item, index) => ({
1623
- operator: ruleConfig.config[index].operator,
1624
- value: Number(item.result) || 0
1625
- })).reduce((result, cur, index, list) => {
1626
- const item = ruleConfig.config[index];
1627
- if (!index || index === list.length - 1)
1628
- result.push({ ...cur, iconId: item.iconId, iconType: item.iconType });
1620
+ const l = e.config.map((d) => R2(d.value, r, { ...n, cfId: s.cfId }));
1621
+ if (l.some((d) => d.status !== Z.SUCCESS))
1622
+ return (f = t.getCache(n.unitId, n.subUnitId, s.cfId)) != null ? f : o;
1623
+ const h = l.map((d, g) => ({
1624
+ operator: e.config[g].operator,
1625
+ value: Number(d.result) || 0
1626
+ })).reduce((d, g, D, m) => {
1627
+ const F = e.config[D];
1628
+ if (!D || D === m.length - 1)
1629
+ d.push({ ...g, iconId: F.iconId, iconType: F.iconType });
1629
1630
  else {
1630
- const pre = list[index - 1];
1631
- compareWithNumber(pre, cur.value) || result.push({ ...cur, iconId: item.iconId, iconType: item.iconType });
1631
+ const y = m[D - 1];
1632
+ F2(y, g.value) || d.push({ ...g, iconId: F.iconId, iconType: F.iconType });
1632
1633
  }
1633
- return result;
1634
- }, []), isShowValue = ruleConfig.isShowValue === void 0 ? !0 : !!ruleConfig.isShowValue;
1635
- return matrix.forValue((row, col, value) => {
1636
- for (let index = 0; index < splitValue.length; index++) {
1637
- const item = splitValue[index], start = { ...item }, end = { ...item }, { iconId, iconType } = item;
1638
- if (index === 0) {
1639
- if (compareWithNumber(item, value)) {
1640
- computeResult.setValue(row, col, { iconId, iconType, isShowValue });
1634
+ return d;
1635
+ }, []), u = e.isShowValue === void 0 ? !0 : !!e.isShowValue;
1636
+ return r.forValue((d, g, D) => {
1637
+ for (let m = 0; m < h.length; m++) {
1638
+ const F = h[m], y = { ...F }, R = { ...F }, { iconId: L, iconType: W } = F;
1639
+ if (m === 0) {
1640
+ if (F2(F, D)) {
1641
+ o.setValue(d, g, { iconId: L, iconType: W, isShowValue: u });
1641
1642
  return;
1642
1643
  }
1643
- } else if (index === splitValue.length - 1) {
1644
- computeResult.setValue(row, col, { iconId, iconType, isShowValue });
1644
+ } else if (m === h.length - 1) {
1645
+ o.setValue(d, g, { iconId: L, iconType: W, isShowValue: u });
1645
1646
  return;
1646
1647
  } else {
1647
- const pre = splitValue[index - 1];
1648
- if (end.operator = getOppositeOperator(pre.operator), end.value = pre.value, compareWithNumber(start, value) && compareWithNumber(end, value)) {
1649
- computeResult.setValue(row, col, { iconId, iconType, isShowValue });
1648
+ const U = h[m - 1];
1649
+ if (R.operator = o1(U.operator), R.value = U.value, F2(y, D) && F2(R, D)) {
1650
+ o.setValue(d, g, { iconId: L, iconType: W, isShowValue: u });
1650
1651
  return;
1651
1652
  }
1652
1653
  }
1653
1654
  }
1654
- }), computeResult;
1655
- }, "handle")
1655
+ }), o;
1656
+ }
1656
1657
  };
1657
- var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1658
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1659
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1660
- return kind && result && __defProp$1(target, key, result), result;
1661
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
1662
- const beforeUpdateRuleResult = createInterceptorKey("conditional-formatting-before-update-rule-result");
1663
- var _a3;
1664
- let ConditionalFormattingService = (_a3 = class extends Disposable {
1665
- constructor(_conditionalFormattingRuleModel, _injector, _conditionalFormattingViewModel, _univerInstanceService, _resourceManagerService, _sheetInterceptorService, _commandService) {
1658
+ var m1 = Object.defineProperty, w1 = Object.getOwnPropertyDescriptor, F1 = (s, n, e, t) => {
1659
+ for (var i = t > 1 ? void 0 : t ? w1(n, e) : n, r = s.length - 1, a; r >= 0; r--)
1660
+ (a = s[r]) && (i = (t ? a(n, e, i) : a(i)) || i);
1661
+ return t && i && m1(n, e, i), i;
1662
+ }, c2 = (s, n) => (e, t) => n(e, t, s);
1663
+ const v1 = s0("conditional-formatting-before-update-rule-result");
1664
+ let v2 = class extends q2 {
1665
+ constructor(n, e, t, i, r, a, o) {
1666
1666
  super();
1667
1667
  // <unitId,<subUnitId,<cfId,IComputeCache>>>
1668
- __publicField(this, "_ruleCacheMap", /* @__PURE__ */ new Map());
1669
- __publicField(this, "_calculateUnit$", new Subject());
1670
- __publicField(this, "_ruleComputeStatus$", new Subject());
1671
- __publicField(this, "ruleComputeStatus$", this._ruleComputeStatus$.asObservable());
1672
- __publicField(this, "interceptorManager", new InterceptorManager({ beforeUpdateRuleResult }));
1673
- __publicField(this, "_calculationUnitMap", /* @__PURE__ */ new Map());
1674
- this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel, this._injector = _injector, this._conditionalFormattingViewModel = _conditionalFormattingViewModel, this._univerInstanceService = _univerInstanceService, this._resourceManagerService = _resourceManagerService, this._sheetInterceptorService = _sheetInterceptorService, this._commandService = _commandService, this._initCellChange(), this._initCacheManager(), this._initRemoteCalculate(), this._initSnapshot(), this._initSheetChange(), this._registerCalculationUnit(dataBarCellCalculateUnit), this._registerCalculationUnit(colorScaleCellCalculateUnit), this._registerCalculationUnit(highlightCellCalculateUnit), this._registerCalculationUnit(iconSetCalculateUnit), this._calculateUnit$.pipe(bufferTime(100), filter((list) => !!list.length), map((list) => {
1675
- const createKey = /* @__PURE__ */ __name((config) => `${config.unitId}_${config.subUnitId}_${config.rule.cfId}`, "createKey");
1676
- return list.reduce((a, b) => {
1677
- const key = createKey(b);
1678
- return a.map[key] || (a.map[key] = b, a.list.push(b)), a;
1668
+ S(this, "_ruleCacheMap", /* @__PURE__ */ new Map());
1669
+ S(this, "_calculateUnit$", new _2());
1670
+ S(this, "_ruleComputeStatus$", new _2());
1671
+ S(this, "ruleComputeStatus$", this._ruleComputeStatus$.asObservable());
1672
+ S(this, "interceptorManager", new o0({ beforeUpdateRuleResult: v1 }));
1673
+ S(this, "_calculationUnitMap", /* @__PURE__ */ new Map());
1674
+ this._conditionalFormattingRuleModel = n, this._injector = e, this._conditionalFormattingViewModel = t, this._univerInstanceService = i, this._resourceManagerService = r, this._sheetInterceptorService = a, this._commandService = o, this._initCellChange(), this._initCacheManager(), this._initRemoteCalculate(), this._initSnapshot(), this._initSheetChange(), this._registerCalculationUnit(f1), this._registerCalculationUnit(u1), this._registerCalculationUnit(D1), this._registerCalculationUnit(C1), this._calculateUnit$.pipe(Y2(100), $2((l) => !!l.length), h0((l) => {
1675
+ const c = (u) => `${u.unitId}_${u.subUnitId}_${u.rule.cfId}`;
1676
+ return l.reduce((u, f) => {
1677
+ const d = c(f);
1678
+ return u.map[d] || (u.map[d] = f, u.list.push(f)), u;
1679
1679
  }, {
1680
1680
  map: {},
1681
1681
  list: []
1682
1682
  }).list;
1683
- })).subscribe((configList) => {
1684
- configList.forEach((config) => {
1685
- this._handleCalculateUnit(config.unitId, config.subUnitId, config.rule);
1683
+ })).subscribe((l) => {
1684
+ l.forEach((c) => {
1685
+ this._handleCalculateUnit(c.unitId, c.subUnitId, c.rule);
1686
1686
  });
1687
1687
  }), this.disposeWithMe(() => {
1688
1688
  this.interceptorManager.dispose();
1689
1689
  });
1690
1690
  }
1691
- composeStyle(unitId, subUnitId, row, col) {
1692
- const cell2 = this._conditionalFormattingViewModel.getCellCf(unitId, subUnitId, row, col);
1693
- if (cell2) {
1694
- const ruleList = cell2.cfList.map((item) => this._conditionalFormattingRuleModel.getRule(unitId, subUnitId, item.cfId)).filter((rule) => !!rule).reverse(), endIndex = ruleList.findIndex((rule) => rule == null ? void 0 : rule.stopIfTrue);
1695
- return endIndex > -1 && ruleList.splice(endIndex + 1), ruleList.reduce((pre, rule) => {
1696
- var _a5;
1697
- const type = rule.rule.type, ruleCacheItem = cell2.cfList.find((cache) => cache.cfId === rule.cfId);
1698
- if (ruleCacheItem != null && ruleCacheItem.isDirty && this._calculateUnit$.next({ unitId, subUnitId, rule }), type === CFRuleType.highlightCell)
1699
- ruleCacheItem.ruleCache && Tools.deepMerge(pre, { style: ruleCacheItem.ruleCache });
1700
- else if (type === CFRuleType.colorScale) {
1701
- const ruleCache = ruleCacheItem == null ? void 0 : ruleCacheItem.ruleCache;
1702
- ruleCache && typeof ruleCache == "string" && (pre.style = { ...(_a5 = pre.style) != null ? _a5 : {}, bg: { rgb: ruleCache } });
1703
- } else if (type === CFRuleType.dataBar) {
1704
- const ruleCache = ruleCacheItem == null ? void 0 : ruleCacheItem.ruleCache;
1705
- ruleCache && ruleCache !== EMPTY_STYLE && (pre.dataBar = ruleCache, pre.isShowValue = ruleCache.isShowValue);
1706
- } else if (type === CFRuleType.iconSet) {
1707
- const ruleCache = ruleCacheItem == null ? void 0 : ruleCacheItem.ruleCache;
1708
- ruleCache && ruleCache !== EMPTY_STYLE && (pre.iconSet = ruleCache, pre.isShowValue = ruleCache.isShowValue);
1691
+ composeStyle(n, e, t, i) {
1692
+ const r = this._conditionalFormattingViewModel.getCellCf(n, e, t, i);
1693
+ if (r) {
1694
+ const a = r.cfList.map((c) => this._conditionalFormattingRuleModel.getRule(n, e, c.cfId)).filter((c) => !!c).reverse(), o = a.findIndex((c) => c == null ? void 0 : c.stopIfTrue);
1695
+ return o > -1 && a.splice(o + 1), a.reduce((c, h) => {
1696
+ var d;
1697
+ const u = h.rule.type, f = r.cfList.find((g) => g.cfId === h.cfId);
1698
+ if (f != null && f.isDirty && this._calculateUnit$.next({ unitId: n, subUnitId: e, rule: h }), u === H.highlightCell)
1699
+ f.ruleCache && D2.deepMerge(c, { style: f.ruleCache });
1700
+ else if (u === H.colorScale) {
1701
+ const g = f == null ? void 0 : f.ruleCache;
1702
+ g && typeof g == "string" && (c.style = { ...(d = c.style) != null ? d : {}, bg: { rgb: g } });
1703
+ } else if (u === H.dataBar) {
1704
+ const g = f == null ? void 0 : f.ruleCache;
1705
+ g && g !== f2 && (c.dataBar = g, c.isShowValue = g.isShowValue);
1706
+ } else if (u === H.iconSet) {
1707
+ const g = f == null ? void 0 : f.ruleCache;
1708
+ g && g !== f2 && (c.iconSet = g, c.isShowValue = g.isShowValue);
1709
1709
  }
1710
- return pre;
1710
+ return c;
1711
1711
  }, {});
1712
1712
  }
1713
1713
  return null;
1714
1714
  }
1715
1715
  _initSnapshot() {
1716
- const toJson = /* @__PURE__ */ __name((unitID) => {
1717
- const map2 = this._conditionalFormattingRuleModel.getUnitRules(unitID), resultMap = {};
1718
- return map2 ? (map2.forEach((v, key) => {
1719
- resultMap[key] = v;
1720
- }), JSON.stringify(resultMap)) : "";
1721
- }, "toJson"), parseJson = /* @__PURE__ */ __name((json) => {
1722
- if (!json)
1716
+ const n = (t) => {
1717
+ const i = this._conditionalFormattingRuleModel.getUnitRules(t), r = {};
1718
+ return i ? (i.forEach((a, o) => {
1719
+ r[o] = a;
1720
+ }), JSON.stringify(r)) : "";
1721
+ }, e = (t) => {
1722
+ if (!t)
1723
1723
  return {};
1724
1724
  try {
1725
- return JSON.parse(json);
1725
+ return JSON.parse(t);
1726
1726
  } catch {
1727
1727
  return {};
1728
1728
  }
1729
- }, "parseJson");
1729
+ };
1730
1730
  this.disposeWithMe(
1731
1731
  this._resourceManagerService.registerPluginResource({
1732
- pluginName: SHEET_CONDITIONAL_FORMATTING_PLUGIN,
1733
- businesses: [UniverInstanceType.UNIVER_SHEET],
1734
- toJson: /* @__PURE__ */ __name((unitID) => toJson(unitID), "toJson"),
1735
- parseJson: /* @__PURE__ */ __name((json) => parseJson(json), "parseJson"),
1736
- onUnLoad: /* @__PURE__ */ __name((unitID) => {
1737
- this._conditionalFormattingRuleModel.deleteUnitId(unitID);
1738
- }, "onUnLoad"),
1739
- onLoad: /* @__PURE__ */ __name((unitID, value) => {
1740
- Object.keys(value).forEach((subunitId) => {
1741
- [...value[subunitId]].reverse().forEach((rule) => {
1742
- this._conditionalFormattingRuleModel.addRule(unitID, subunitId, rule);
1732
+ pluginName: K2,
1733
+ businesses: [b2.UNIVER_SHEET],
1734
+ toJson: (t) => n(t),
1735
+ parseJson: (t) => e(t),
1736
+ onUnLoad: (t) => {
1737
+ this._conditionalFormattingRuleModel.deleteUnitId(t);
1738
+ },
1739
+ onLoad: (t, i) => {
1740
+ Object.keys(i).forEach((r) => {
1741
+ [...i[r]].reverse().forEach((o) => {
1742
+ this._conditionalFormattingRuleModel.addRule(t, r, o);
1743
1743
  });
1744
1744
  });
1745
- }, "onLoad")
1745
+ }
1746
1746
  })
1747
1747
  );
1748
1748
  }
1749
1749
  _initSheetChange() {
1750
1750
  this.disposeWithMe(
1751
1751
  this._sheetInterceptorService.interceptCommand({
1752
- getMutations: /* @__PURE__ */ __name((commandInfo) => {
1753
- if (commandInfo.id === RemoveSheetCommand.id) {
1754
- const params = commandInfo.params, unitId = params.unitId || getUnitId(this._univerInstanceService), subUnitId = params.subUnitId || getSubUnitId(this._univerInstanceService);
1755
- if (!subUnitId)
1752
+ getMutations: (n) => {
1753
+ if (n.id === g0.id) {
1754
+ const e = n.params, t = e.unitId || E1(this._univerInstanceService), i = e.subUnitId || p1(this._univerInstanceService);
1755
+ if (!i)
1756
1756
  return { redos: [], undos: [] };
1757
- const ruleList = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
1758
- if (!ruleList)
1757
+ const r = this._conditionalFormattingRuleModel.getSubunitRules(t, i);
1758
+ if (!r)
1759
1759
  return { redos: [], undos: [] };
1760
- const redos = [], undos = [];
1761
- return ruleList.forEach((item) => {
1762
- const params2 = {
1763
- unitId,
1764
- subUnitId,
1765
- cfId: item.cfId
1760
+ const a = [], o = [];
1761
+ return r.forEach((l) => {
1762
+ const c = {
1763
+ unitId: t,
1764
+ subUnitId: i,
1765
+ cfId: l.cfId
1766
1766
  };
1767
- redos.push({
1768
- id: DeleteConditionalRuleMutation.id,
1769
- params: params2
1770
- }), undos.push(...DeleteConditionalRuleMutationUndoFactory(this._injector, params2));
1767
+ a.push({
1768
+ id: N2.id,
1769
+ params: c
1770
+ }), o.push(...X0(this._injector, c));
1771
1771
  }), {
1772
- redos,
1773
- undos
1772
+ redos: a,
1773
+ undos: o
1774
1774
  };
1775
1775
  }
1776
1776
  return { redos: [], undos: [] };
1777
- }, "getMutations")
1777
+ }
1778
1778
  })
1779
1779
  );
1780
1780
  }
1781
- _registerCalculationUnit(unit) {
1782
- this._calculationUnitMap.set(unit.type, unit);
1781
+ _registerCalculationUnit(n) {
1782
+ this._calculationUnitMap.set(n.type, n);
1783
1783
  }
1784
- _getComputedCache(unitId, subUnitId, cfId) {
1785
- var _a5, _b;
1786
- return (_b = (_a5 = this._ruleCacheMap.get(unitId)) == null ? void 0 : _a5.get(subUnitId)) == null ? void 0 : _b.get(cfId);
1784
+ _getComputedCache(n, e, t) {
1785
+ var i, r;
1786
+ return (r = (i = this._ruleCacheMap.get(n)) == null ? void 0 : i.get(e)) == null ? void 0 : r.get(t);
1787
1787
  }
1788
- _setComputedCache(unitId, subUnitId, cfId, value) {
1789
- let unitMap = this._ruleCacheMap.get(unitId);
1790
- unitMap || (unitMap = /* @__PURE__ */ new Map(), this._ruleCacheMap.set(unitId, unitMap));
1791
- let subUnitMap = unitMap.get(subUnitId);
1792
- subUnitMap || (subUnitMap = /* @__PURE__ */ new Map(), unitMap.set(subUnitId, subUnitMap)), subUnitMap.set(cfId, value);
1788
+ _setComputedCache(n, e, t, i) {
1789
+ let r = this._ruleCacheMap.get(n);
1790
+ r || (r = /* @__PURE__ */ new Map(), this._ruleCacheMap.set(n, r));
1791
+ let a = r.get(e);
1792
+ a || (a = /* @__PURE__ */ new Map(), r.set(e, a)), a.set(t, i);
1793
1793
  }
1794
- _deleteComputeCache(unitId, subUnitId, cfId) {
1795
- const unitCache = this._ruleCacheMap.get(unitId), subUnitCache = unitCache == null ? void 0 : unitCache.get(subUnitId);
1796
- subUnitCache && (subUnitCache.delete(cfId), subUnitCache.size || unitCache == null || unitCache.delete(subUnitId));
1794
+ _deleteComputeCache(n, e, t) {
1795
+ const i = this._ruleCacheMap.get(n), r = i == null ? void 0 : i.get(e);
1796
+ r && (r.delete(t), r.size || i == null || i.delete(e));
1797
1797
  }
1798
1798
  _initCacheManager() {
1799
- this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.subscribe((item) => {
1800
- this._deleteComputeCache(item.unitId, item.subUnitId, item.rule.cfId);
1801
- })), this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(filter((item) => item.type !== "sort")).subscribe((item) => {
1802
- const { unitId, subUnitId, rule } = item;
1803
- this._deleteComputeCache(unitId, subUnitId, rule.cfId);
1799
+ this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.subscribe((n) => {
1800
+ this._deleteComputeCache(n.unitId, n.subUnitId, n.rule.cfId);
1801
+ })), this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe($2((n) => n.type !== "sort")).subscribe((n) => {
1802
+ const { unitId: e, subUnitId: t, rule: i } = n;
1803
+ this._deleteComputeCache(e, t, i.cfId);
1804
1804
  }));
1805
1805
  }
1806
1806
  _initCellChange() {
1807
1807
  this.disposeWithMe(
1808
- this._commandService.onCommandExecuted((commandInfo) => {
1809
- const collectRule = /* @__PURE__ */ __name((unitId, subUnitId, cellData) => {
1810
- const ruleIds = /* @__PURE__ */ new Set();
1811
- return cellData.forEach(([row, col]) => {
1812
- const ruleItem = this._conditionalFormattingViewModel.getCellCf(unitId, subUnitId, row, col);
1813
- ruleItem == null || ruleItem.cfList.forEach((item) => ruleIds.add(item.cfId));
1814
- }), [...ruleIds].map((cfId) => this._conditionalFormattingRuleModel.getRule(unitId, subUnitId, cfId)).filter((rule) => !!rule);
1815
- }, "collectRule");
1816
- switch (commandInfo.id) {
1817
- case SetRangeValuesMutation.id: {
1818
- const params = commandInfo.params, { subUnitId, unitId, cellValue } = params, cellMatrix = [];
1819
- new ObjectMatrix(cellValue).forValue((row, col, value) => {
1820
- value && Object.keys(value).some((key) => ["p", "v"].includes(key)) && cellMatrix.push([row, col]);
1821
- }), collectRule(unitId, subUnitId, cellMatrix).forEach((rule) => {
1822
- this._conditionalFormattingViewModel.markRuleDirty(unitId, subUnitId, rule), this._deleteComputeCache(unitId, subUnitId, rule.cfId);
1808
+ this._commandService.onCommandExecuted((n) => {
1809
+ const e = (t, i, r) => {
1810
+ const a = /* @__PURE__ */ new Set();
1811
+ return r.forEach(([o, l]) => {
1812
+ const c = this._conditionalFormattingViewModel.getCellCf(t, i, o, l);
1813
+ c == null || c.cfList.forEach((h) => a.add(h.cfId));
1814
+ }), [...a].map((o) => this._conditionalFormattingRuleModel.getRule(t, i, o)).filter((o) => !!o);
1815
+ };
1816
+ switch (n.id) {
1817
+ case p0.id: {
1818
+ const t = n.params, { subUnitId: i, unitId: r, cellValue: a } = t, o = [];
1819
+ new j(a).forValue((c, h, u) => {
1820
+ u && Object.keys(u).some((d) => ["p", "v"].includes(d)) && o.push([c, h]);
1821
+ }), e(r, i, o).forEach((c) => {
1822
+ this._conditionalFormattingViewModel.markRuleDirty(r, i, c), this._deleteComputeCache(r, i, c.cfId);
1823
1823
  });
1824
1824
  break;
1825
1825
  }
1826
- case InsertColMutation.id:
1827
- case RemoveColMutation.id: {
1828
- const { range, unitId, subUnitId } = commandInfo.params, allRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId), effectRange = { ...range, endColumn: Number.MAX_SAFE_INTEGER };
1829
- allRules && allRules.filter((rule) => rule.ranges.some((ruleRange) => Rectangle.intersects(ruleRange, effectRange))).forEach((rule) => {
1830
- this._conditionalFormattingViewModel.markRuleDirty(unitId, subUnitId, rule), this._deleteComputeCache(unitId, subUnitId, rule.cfId);
1826
+ case E0.id:
1827
+ case v0.id: {
1828
+ const { range: t, unitId: i, subUnitId: r } = n.params, a = this._conditionalFormattingRuleModel.getSubunitRules(i, r), o = { ...t, endColumn: Number.MAX_SAFE_INTEGER };
1829
+ a && a.filter((c) => c.ranges.some((h) => g2.intersects(h, o))).forEach((c) => {
1830
+ this._conditionalFormattingViewModel.markRuleDirty(i, r, c), this._deleteComputeCache(i, r, c.cfId);
1831
1831
  });
1832
1832
  break;
1833
1833
  }
1834
- case RemoveRowMutation.id:
1835
- case InsertRowMutation.id: {
1836
- const { range, unitId, subUnitId } = commandInfo.params, allRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId), effectRange = { ...range, endRow: Number.MAX_SAFE_INTEGER };
1837
- allRules && allRules.filter((rule) => rule.ranges.some((ruleRange) => Rectangle.intersects(ruleRange, effectRange))).forEach((rule) => {
1838
- this._conditionalFormattingViewModel.markRuleDirty(unitId, subUnitId, rule), this._deleteComputeCache(unitId, subUnitId, rule.cfId);
1834
+ case F0.id:
1835
+ case w0.id: {
1836
+ const { range: t, unitId: i, subUnitId: r } = n.params, a = this._conditionalFormattingRuleModel.getSubunitRules(i, r), o = { ...t, endRow: Number.MAX_SAFE_INTEGER };
1837
+ a && a.filter((c) => c.ranges.some((h) => g2.intersects(h, o))).forEach((c) => {
1838
+ this._conditionalFormattingViewModel.markRuleDirty(i, r, c), this._deleteComputeCache(i, r, c.cfId);
1839
1839
  });
1840
1840
  break;
1841
1841
  }
1842
- case MoveRowsMutation.id: {
1843
- const { sourceRange, targetRange, unitId, subUnitId } = commandInfo.params, allRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId), effectRange = {
1844
- startRow: Math.min(sourceRange.startRow, targetRange.startRow),
1842
+ case m0.id: {
1843
+ const { sourceRange: t, targetRange: i, unitId: r, subUnitId: a } = n.params, o = this._conditionalFormattingRuleModel.getSubunitRules(r, a), l = {
1844
+ startRow: Math.min(t.startRow, i.startRow),
1845
1845
  endRow: Number.MAX_SAFE_INTEGER,
1846
1846
  startColumn: 0,
1847
1847
  endColumn: Number.MAX_SAFE_INTEGER
1848
1848
  };
1849
- allRules && allRules.filter((rule) => rule.ranges.some((ruleRange) => Rectangle.intersects(ruleRange, effectRange))).forEach((rule) => {
1850
- this._conditionalFormattingViewModel.markRuleDirty(unitId, subUnitId, rule), this._deleteComputeCache(unitId, subUnitId, rule.cfId);
1849
+ o && o.filter((h) => h.ranges.some((u) => g2.intersects(u, l))).forEach((h) => {
1850
+ this._conditionalFormattingViewModel.markRuleDirty(r, a, h), this._deleteComputeCache(r, a, h.cfId);
1851
1851
  });
1852
1852
  break;
1853
1853
  }
1854
- case MoveColsMutation.id: {
1855
- const { sourceRange, targetRange, unitId, subUnitId } = commandInfo.params, allRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId), effectRange = {
1854
+ case C0.id: {
1855
+ const { sourceRange: t, targetRange: i, unitId: r, subUnitId: a } = n.params, o = this._conditionalFormattingRuleModel.getSubunitRules(r, a), l = {
1856
1856
  startRow: 0,
1857
1857
  endRow: Number.MAX_SAFE_INTEGER,
1858
- startColumn: Math.min(sourceRange.startColumn, targetRange.startColumn),
1858
+ startColumn: Math.min(t.startColumn, i.startColumn),
1859
1859
  endColumn: Number.MAX_SAFE_INTEGER
1860
1860
  };
1861
- allRules && allRules.filter((rule) => rule.ranges.some((ruleRange) => Rectangle.intersects(ruleRange, effectRange))).forEach((rule) => {
1862
- this._conditionalFormattingViewModel.markRuleDirty(unitId, subUnitId, rule), this._deleteComputeCache(unitId, subUnitId, rule.cfId);
1861
+ o && o.filter((h) => h.ranges.some((u) => g2.intersects(u, l))).forEach((h) => {
1862
+ this._conditionalFormattingViewModel.markRuleDirty(r, a, h), this._deleteComputeCache(r, a, h.cfId);
1863
1863
  });
1864
1864
  break;
1865
1865
  }
1866
- case MoveRangeMutation.id: {
1867
- const { unitId, to, from } = commandInfo.params, handleSubUnit = /* @__PURE__ */ __name((value) => {
1868
- const cellMatrix = [];
1869
- new ObjectMatrix(value.value).forValue((row, col) => {
1870
- cellMatrix.push([row, col]);
1871
- }), collectRule(unitId, value.subUnitId, cellMatrix).forEach((rule) => {
1872
- this._conditionalFormattingViewModel.markRuleDirty(unitId, value.subUnitId, rule), this._deleteComputeCache(unitId, value.subUnitId, rule.cfId);
1866
+ case D0.id: {
1867
+ const { unitId: t, to: i, from: r } = n.params, a = (o) => {
1868
+ const l = [];
1869
+ new j(o.value).forValue((h, u) => {
1870
+ l.push([h, u]);
1871
+ }), e(t, o.subUnitId, l).forEach((h) => {
1872
+ this._conditionalFormattingViewModel.markRuleDirty(t, o.subUnitId, h), this._deleteComputeCache(t, o.subUnitId, h.cfId);
1873
1873
  });
1874
- }, "handleSubUnit");
1875
- handleSubUnit(to), handleSubUnit(from);
1874
+ };
1875
+ a(i), a(r);
1876
1876
  break;
1877
1877
  }
1878
- case ReorderRangeMutation.id: {
1879
- const { range, unitId, subUnitId } = commandInfo.params, allRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
1880
- allRules && allRules.filter((rule) => rule.ranges.some((ruleRange) => Rectangle.intersects(ruleRange, range))).forEach((rule) => {
1881
- this._conditionalFormattingViewModel.markRuleDirty(unitId, subUnitId, rule), this._deleteComputeCache(unitId, subUnitId, rule.cfId);
1878
+ case f0.id: {
1879
+ const { range: t, unitId: i, subUnitId: r } = n.params, a = this._conditionalFormattingRuleModel.getSubunitRules(i, r);
1880
+ a && a.filter((l) => l.ranges.some((c) => g2.intersects(c, t))).forEach((l) => {
1881
+ this._conditionalFormattingViewModel.markRuleDirty(i, r, l), this._deleteComputeCache(i, r, l.cfId);
1882
1882
  });
1883
1883
  break;
1884
1884
  }
@@ -1887,204 +1887,203 @@ let ConditionalFormattingService = (_a3 = class extends Disposable {
1887
1887
  );
1888
1888
  }
1889
1889
  _initRemoteCalculate() {
1890
- this.disposeWithMe(this._ruleComputeStatus$.subscribe(({ status, subUnitId, unitId, cfId, result }) => {
1891
- const cache = this._getComputedCache(unitId, subUnitId, cfId) || {};
1892
- cache.status = status, this._setComputedCache(unitId, subUnitId, cfId, cache), status === "end" && result && (this.interceptorManager.fetchThroughInterceptors(this.interceptorManager.getInterceptPoints().beforeUpdateRuleResult)({
1893
- subUnitId,
1894
- unitId,
1895
- cfId
1896
- }, void 0), result.forValue((row, col, value) => {
1897
- this._conditionalFormattingViewModel.setCellCfRuleCache(unitId, subUnitId, row, col, cfId, value);
1890
+ this.disposeWithMe(this._ruleComputeStatus$.subscribe(({ status: n, subUnitId: e, unitId: t, cfId: i, result: r }) => {
1891
+ const a = this._getComputedCache(t, e, i) || {};
1892
+ a.status = n, this._setComputedCache(t, e, i, a), n === "end" && r && (this.interceptorManager.fetchThroughInterceptors(this.interceptorManager.getInterceptPoints().beforeUpdateRuleResult)({
1893
+ subUnitId: e,
1894
+ unitId: t,
1895
+ cfId: i
1896
+ }, void 0), r.forValue((o, l, c) => {
1897
+ this._conditionalFormattingViewModel.setCellCfRuleCache(t, e, o, l, i, c);
1898
1898
  }));
1899
1899
  }));
1900
1900
  }
1901
- async _handleCalculateUnit(unitId, subUnitId, rule) {
1902
- if (!this._conditionalFormattingRuleModel.getRule(unitId, subUnitId, rule.cfId))
1901
+ async _handleCalculateUnit(n, e, t) {
1902
+ if (!this._conditionalFormattingRuleModel.getRule(n, e, t.cfId))
1903
1903
  return;
1904
- const workbook = this._univerInstanceService.getUnit(unitId), worksheet = workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId);
1905
- let cache = this._getComputedCache(unitId, subUnitId, rule.cfId);
1906
- if (cache && ["computing", "end"].includes(cache.status))
1904
+ const i = this._univerInstanceService.getUnit(n), r = i == null ? void 0 : i.getSheetBySheetId(e);
1905
+ let a = this._getComputedCache(n, e, t.cfId);
1906
+ if (a && ["computing", "end"].includes(a.status))
1907
1907
  return;
1908
- cache || (cache = { status: "computing" }, this._setComputedCache(unitId, subUnitId, rule.cfId, cache));
1909
- const unit = this._calculationUnitMap.get(rule.rule.type);
1910
- if (!unit || !worksheet)
1908
+ a || (a = { status: "computing" }, this._setComputedCache(n, e, t.cfId, a));
1909
+ const o = this._calculationUnitMap.get(t.rule.type);
1910
+ if (!o || !r)
1911
1911
  return;
1912
- const context = { unitId, subUnitId, accessor: this._injector, workbook, worksheet }, result = await unit.handle(rule, context);
1913
- this._ruleComputeStatus$.next({ status: "end", unitId, subUnitId, cfId: rule.cfId, result });
1914
- }
1915
- }, __name(_a3, "ConditionalFormattingService"), _a3);
1916
- ConditionalFormattingService = __decorateClass$1([
1917
- __decorateParam$1(0, Inject(ConditionalFormattingRuleModel)),
1918
- __decorateParam$1(1, Inject(Injector)),
1919
- __decorateParam$1(2, Inject(ConditionalFormattingViewModel)),
1920
- __decorateParam$1(3, Inject(IUniverInstanceService)),
1921
- __decorateParam$1(4, Inject(IResourceManagerService)),
1922
- __decorateParam$1(5, Inject(SheetInterceptorService)),
1923
- __decorateParam$1(6, Inject(ICommandService))
1924
- ], ConditionalFormattingService);
1925
- const getUnitId = /* @__PURE__ */ __name((u) => u.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), "getUnitId"), getSubUnitId = /* @__PURE__ */ __name((u) => {
1926
- var _a5;
1927
- return (_a5 = u.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : _a5.getSheetId();
1928
- }, "getSubUnitId");
1929
- var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1930
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1931
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1932
- return kind && result && __defProp2(target, key, result), result;
1933
- }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), _a4;
1934
- let UniverSheetsConditionalFormattingPlugin = (_a4 = class extends Plugin {
1935
- constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
1936
- super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._configService = _configService;
1937
- const { ...rest } = this._config;
1938
- this._configService.setConfig(PLUGIN_CONFIG_KEY, rest), [
1939
- [ConditionalFormattingService],
1940
- [ConditionalFormattingFormulaService],
1941
- [ConditionalFormattingRuleModel],
1942
- [ConditionalFormattingViewModel]
1943
- ].forEach((dependency) => {
1944
- this._injector.add(dependency);
1912
+ const l = { unitId: n, subUnitId: e, accessor: this._injector, workbook: i, worksheet: r }, c = await o.handle(t, l);
1913
+ this._ruleComputeStatus$.next({ status: "end", unitId: n, subUnitId: e, cfId: t.cfId, result: c });
1914
+ }
1915
+ };
1916
+ v2 = F1([
1917
+ c2(0, T(Q)),
1918
+ c2(1, T(S2)),
1919
+ c2(2, T(I2)),
1920
+ c2(3, T(r0)),
1921
+ c2(4, T(a0)),
1922
+ c2(5, T(d0)),
1923
+ c2(6, T(O2))
1924
+ ], v2);
1925
+ const E1 = (s) => s.getCurrentUnitForType(b2.UNIVER_SHEET).getUnitId(), p1 = (s) => {
1926
+ var n;
1927
+ return (n = s.getCurrentUnitForType(b2.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : n.getSheetId();
1928
+ };
1929
+ var A1 = Object.defineProperty, x1 = Object.getOwnPropertyDescriptor, _1 = (s, n, e, t) => {
1930
+ for (var i = t > 1 ? void 0 : t ? x1(n, e) : n, r = s.length - 1, a; r >= 0; r--)
1931
+ (a = s[r]) && (i = (t ? a(n, e, i) : a(i)) || i);
1932
+ return t && i && A1(n, e, i), i;
1933
+ }, k2 = (s, n) => (e, t) => n(e, t, s), A2;
1934
+ let Z2 = (A2 = class extends l0 {
1935
+ constructor(s = J0, n, e, t) {
1936
+ super(), this._config = s, this._injector = n, this._commandService = e, this._configService = t;
1937
+ const { ...i } = this._config;
1938
+ this._configService.setConfig(K0, i), [
1939
+ [v2],
1940
+ [n2],
1941
+ [Q],
1942
+ [I2]
1943
+ ].forEach((r) => {
1944
+ this._injector.add(r);
1945
1945
  }), [
1946
- AddConditionalRuleMutation,
1947
- DeleteConditionalRuleMutation,
1948
- SetConditionalRuleMutation,
1949
- MoveConditionalRuleMutation,
1950
- ConditionalFormattingFormulaMarkDirty
1951
- ].forEach((m) => {
1952
- this._commandService.registerCommand(m);
1946
+ J2,
1947
+ N2,
1948
+ z2,
1949
+ V2,
1950
+ x2
1951
+ ].forEach((r) => {
1952
+ this._commandService.registerCommand(r);
1953
1953
  });
1954
1954
  }
1955
1955
  onStarting() {
1956
- this._injector.get(ConditionalFormattingService);
1957
- }
1958
- }, __name(_a4, "UniverSheetsConditionalFormattingPlugin"), __publicField(_a4, "pluginName", SHEET_CONDITIONAL_FORMATTING_PLUGIN), __publicField(_a4, "type", UniverInstanceType.UNIVER_SHEET), _a4);
1959
- UniverSheetsConditionalFormattingPlugin = __decorateClass([
1960
- __decorateParam(1, Inject(Injector)),
1961
- __decorateParam(2, Inject(ICommandService)),
1962
- __decorateParam(3, IConfigService)
1963
- ], UniverSheetsConditionalFormattingPlugin);
1964
- const IconUKey = "sheet-conditional-rule-icon", EXTENSION_Z_INDEX = 35, DEFAULT_WIDTH = 15, DEFAULT_PADDING = 2, _ConditionalFormattingIcon = class _ConditionalFormattingIcon extends SheetExtension {
1956
+ this._injector.get(v2);
1957
+ }
1958
+ }, S(A2, "pluginName", K2), S(A2, "type", b2.UNIVER_SHEET), A2);
1959
+ Z2 = _1([
1960
+ k2(1, T(S2)),
1961
+ k2(2, T(O2)),
1962
+ k2(3, c0)
1963
+ ], Z2);
1964
+ const M1 = "sheet-conditional-rule-icon", y1 = 35, R1 = 15, S1 = 2;
1965
+ class b1 extends X2 {
1965
1966
  constructor() {
1966
1967
  super();
1967
- __publicField(this, "_paddingRightAndLeft", DEFAULT_PADDING);
1968
- __publicField(this, "_width", DEFAULT_WIDTH);
1969
- __publicField(this, "_imageMap", /* @__PURE__ */ new Map());
1970
- __publicField(this, "uKey", IconUKey);
1971
- __publicField(this, "Z_INDEX", EXTENSION_Z_INDEX);
1972
- __publicField(this, "_radius", 1);
1968
+ S(this, "_paddingRightAndLeft", S1);
1969
+ S(this, "_width", R1);
1970
+ S(this, "_imageMap", /* @__PURE__ */ new Map());
1971
+ S(this, "uKey", M1);
1972
+ S(this, "Z_INDEX", y1);
1973
+ S(this, "_radius", 1);
1973
1974
  this._init();
1974
1975
  }
1975
- draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges) {
1976
- const { worksheet } = spreadsheetSkeleton;
1977
- if (!worksheet)
1976
+ draw(e, t, i, r) {
1977
+ const { worksheet: a } = i;
1978
+ if (!a)
1978
1979
  return !1;
1979
- ctx.save(), Range.foreach(spreadsheetSkeleton.rowColumnSegment, (row, col) => {
1980
- if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col))
1980
+ e.save(), q.foreach(i.rowColumnSegment, (o, l) => {
1981
+ if (!a.getRowVisible(o) || !a.getColVisible(l))
1981
1982
  return;
1982
- const cellData = worksheet.getCell(row, col);
1983
- if (cellData != null && cellData.iconSet) {
1984
- const { iconType, iconId } = cellData.iconSet;
1985
- if (iconType === EMPTY_ICON_TYPE)
1983
+ const c = a.getCell(o, l);
1984
+ if (c != null && c.iconSet) {
1985
+ const { iconType: h, iconId: u } = c.iconSet;
1986
+ if (h === G0)
1986
1987
  return;
1987
- const icon = this._imageMap.get(this._createKey(iconType, iconId));
1988
- if (!icon)
1988
+ const f = this._imageMap.get(this._createKey(h, u));
1989
+ if (!f)
1989
1990
  return;
1990
- const cellInfo = spreadsheetSkeleton.getCellByIndexWithNoHeader(row, col);
1991
- let { isMerged, isMergedMainCell, mergeInfo, startY, endY, startX, endX } = cellInfo;
1992
- if (isMerged || (isMergedMainCell && (startY = mergeInfo.startY, endY = mergeInfo.endY, startX = mergeInfo.startX, endX = mergeInfo.endX), !this.isRenderDiffRangesByCell(mergeInfo, diffRanges)))
1991
+ const d = i.getCellByIndexWithNoHeader(o, l);
1992
+ let { isMerged: g, isMergedMainCell: D, mergeInfo: m, startY: F, endY: y, startX: R, endX: L } = d;
1993
+ if (g || (D && (F = m.startY, y = m.endY, R = m.startX, L = m.endX), !this.isRenderDiffRangesByCell(m, r)))
1993
1994
  return;
1994
- const borderWidth = endX - startX, borderHeight = endY - startY;
1995
- if (this._width > borderHeight || this._width > borderWidth + this._paddingRightAndLeft * 2)
1995
+ const W = L - R, U = y - F;
1996
+ if (this._width > U || this._width > W + this._paddingRightAndLeft * 2)
1996
1997
  return;
1997
- const y = (borderHeight - this._width) / 2 + startY;
1998
- ctx.drawImage(icon, startX + this._paddingRightAndLeft, y, this._width, this._width);
1998
+ const h2 = (U - this._width) / 2 + F;
1999
+ e.drawImage(f, R + this._paddingRightAndLeft, h2, this._width, this._width);
1999
2000
  }
2000
- }), ctx.restore();
2001
+ }), e.restore();
2001
2002
  }
2002
2003
  _init() {
2003
- for (const type in iconMap)
2004
- iconMap[type].forEach((base64, index) => {
2005
- const key = this._createKey(type, String(index)), image = new Image();
2006
- image.onload = () => {
2007
- this._imageMap.set(key, image);
2008
- }, image.src = base64;
2004
+ for (const e in M2)
2005
+ M2[e].forEach((i, r) => {
2006
+ const a = this._createKey(e, String(r)), o = new Image();
2007
+ o.onload = () => {
2008
+ this._imageMap.set(a, o);
2009
+ }, o.src = i;
2009
2010
  });
2010
2011
  }
2011
- _createKey(iconType, iconIndex) {
2012
- return `${iconType}_${iconIndex}`;
2012
+ _createKey(e, t) {
2013
+ return `${e}_${t}`;
2013
2014
  }
2014
- };
2015
- __name(_ConditionalFormattingIcon, "ConditionalFormattingIcon");
2016
- let ConditionalFormattingIcon = _ConditionalFormattingIcon;
2017
- SpreadsheetExtensionRegistry.add(ConditionalFormattingIcon);
2018
- const isRangesEqual = /* @__PURE__ */ __name((oldRanges, ranges) => ranges.length === oldRanges.length && !oldRanges.some((oldRange) => ranges.some((range) => !Rectangle.equals(range, oldRange))), "isRangesEqual");
2019
- function removeUndefinedAttr(obj) {
2020
- if (typeof obj != "object" || obj === null)
2021
- return obj;
2022
- const result = {};
2023
- for (const key in obj)
2024
- if (obj.hasOwnProperty(key)) {
2025
- const value = removeUndefinedAttr(obj[key]);
2026
- value !== void 0 && (result[key] = value);
2015
+ }
2016
+ G2.add(b1);
2017
+ const K1 = (s, n) => n.length === s.length && !s.some((e) => n.some((t) => !g2.equals(t, e)));
2018
+ function I1(s) {
2019
+ if (typeof s != "object" || s === null)
2020
+ return s;
2021
+ const n = {};
2022
+ for (const e in s)
2023
+ if (s.hasOwnProperty(e)) {
2024
+ const t = I1(s[e]);
2025
+ t !== void 0 && (n[e] = t);
2027
2026
  }
2028
- return result;
2027
+ return n;
2029
2028
  }
2030
- __name(removeUndefinedAttr, "removeUndefinedAttr");
2031
2029
  export {
2032
- AddConditionalRuleMutation,
2033
- AddConditionalRuleMutationUndoFactory,
2034
- CFNumberOperator,
2035
- CFRuleType,
2036
- CFSubRuleType,
2037
- CFTextOperator,
2038
- CFTimePeriodOperator,
2039
- CFValueType,
2040
- ConditionalFormattingFormulaMarkDirty,
2041
- ConditionalFormattingFormulaService,
2042
- ConditionalFormattingIcon,
2043
- ConditionalFormattingRuleModel,
2044
- ConditionalFormattingService,
2045
- ConditionalFormattingViewModel,
2046
- DEFAULT_BG_COLOR,
2047
- DEFAULT_FONT_COLOR,
2048
- DEFAULT_PADDING,
2049
- DEFAULT_WIDTH,
2050
- DataBar,
2051
- DeleteConditionalRuleMutation,
2052
- DeleteConditionalRuleMutationUndoFactory,
2053
- EMPTY_ICON_TYPE,
2054
- EMPTY_STYLE,
2055
- FormulaResultStatus,
2056
- IconUKey,
2057
- MoveConditionalRuleMutation,
2058
- MoveConditionalRuleMutationUndoFactory,
2059
- SHEET_CONDITIONAL_FORMATTING_PLUGIN,
2060
- SetConditionalRuleMutation,
2061
- UniverSheetsConditionalFormattingPlugin,
2062
- anchorUndoFactory,
2063
- compareWithNumber,
2064
- createCfId,
2065
- createDefaultRule,
2066
- createDefaultValue,
2067
- createDefaultValueByValueType,
2068
- dataBarUKey,
2069
- defaultDataBarNativeColor,
2070
- defaultDataBarPositiveColor,
2071
- filterRange,
2072
- findIndexByAnchor,
2073
- getCacheStyleMatrix,
2074
- getCellValue,
2075
- getColorScaleFromValue,
2076
- getOppositeOperator,
2077
- getValueByType,
2078
- iconGroup,
2079
- iconMap,
2080
- isAnchorEqual,
2081
- isFloatsEqual,
2082
- isNullable,
2083
- isRangesEqual,
2084
- moveByAnchor,
2085
- removeUndefinedAttr,
2086
- serialTimeToTimestamp,
2087
- setConditionalRuleMutationUndoFactory,
2088
- toYMD_1900,
2089
- transformSupportSymmetryAnchor
2030
+ J2 as AddConditionalRuleMutation,
2031
+ H1 as AddConditionalRuleMutationUndoFactory,
2032
+ B as CFNumberOperator,
2033
+ H as CFRuleType,
2034
+ V as CFSubRuleType,
2035
+ X as CFTextOperator,
2036
+ K as CFTimePeriodOperator,
2037
+ e2 as CFValueType,
2038
+ x2 as ConditionalFormattingFormulaMarkDirty,
2039
+ n2 as ConditionalFormattingFormulaService,
2040
+ b1 as ConditionalFormattingIcon,
2041
+ Q as ConditionalFormattingRuleModel,
2042
+ v2 as ConditionalFormattingService,
2043
+ I2 as ConditionalFormattingViewModel,
2044
+ U1 as DEFAULT_BG_COLOR,
2045
+ T1 as DEFAULT_FONT_COLOR,
2046
+ S1 as DEFAULT_PADDING,
2047
+ R1 as DEFAULT_WIDTH,
2048
+ g1 as DataBar,
2049
+ N2 as DeleteConditionalRuleMutation,
2050
+ X0 as DeleteConditionalRuleMutationUndoFactory,
2051
+ G0 as EMPTY_ICON_TYPE,
2052
+ f2 as EMPTY_STYLE,
2053
+ Z as FormulaResultStatus,
2054
+ M1 as IconUKey,
2055
+ V2 as MoveConditionalRuleMutation,
2056
+ j1 as MoveConditionalRuleMutationUndoFactory,
2057
+ K2 as SHEET_CONDITIONAL_FORMATTING_PLUGIN,
2058
+ z2 as SetConditionalRuleMutation,
2059
+ Z2 as UniverSheetsConditionalFormattingPlugin,
2060
+ L0 as anchorUndoFactory,
2061
+ F2 as compareWithNumber,
2062
+ S0 as createCfId,
2063
+ W1 as createDefaultRule,
2064
+ P1 as createDefaultValue,
2065
+ Z1 as createDefaultValueByValueType,
2066
+ h1 as dataBarUKey,
2067
+ P2 as defaultDataBarNativeColor,
2068
+ W2 as defaultDataBarPositiveColor,
2069
+ L2 as filterRange,
2070
+ u2 as findIndexByAnchor,
2071
+ G1 as getCacheStyleMatrix,
2072
+ r2 as getCellValue,
2073
+ l1 as getColorScaleFromValue,
2074
+ X1 as getMaxInFormulaResult,
2075
+ o1 as getOppositeOperator,
2076
+ R2 as getValueByType,
2077
+ Y0 as iconGroup,
2078
+ M2 as iconMap,
2079
+ q1 as isAnchorEqual,
2080
+ y2 as isFloatsEqual,
2081
+ z as isNullable,
2082
+ K1 as isRangesEqual,
2083
+ b0 as moveByAnchor,
2084
+ I1 as removeUndefinedAttr,
2085
+ a1 as serialTimeToTimestamp,
2086
+ Y1 as setConditionalRuleMutationUndoFactory,
2087
+ r1 as toYMD_1900,
2088
+ I0 as transformSupportSymmetryAnchor
2090
2089
  };