@univerjs/sheets-numfmt 0.3.0-alpha.0 → 0.3.0-nightly.202410101606

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,1544 +1 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key2] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
- var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 != "symbol" ? key2 + "" : key2, value);
5
- import { numfmt, LocaleType, OnLifecycle, LifecycleStages, Inject, ThemeService, ICommandService, LocaleService, Disposable, ObjectMatrix, InterceptorEffectEnum, CellValueType, Range, UniverInstanceType, IUniverInstanceService, CommandType, IUndoRedoService, sequenceExecute, createIdentifier, runOnLifecycle, ILocalStorageService, useDependency, toDisposable, DisposableCollection, Injector, Optional, useInjector, DependentOn, Plugin, IConfigService } from "@univerjs/core";
6
- import { SheetInterceptorService, INumfmtService, INTERCEPTOR_POINT, InterceptCellContentPriority, SetNumfmtMutation, SetRangeValuesMutation, getSheetCommandTarget, transformCellsToRange, rangeMerge, factorySetNumfmtUndoMutation, RemoveNumfmtMutation, factoryRemoveNumfmtUndoMutation, SheetsSelectionsService, SetRangeValuesCommand, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellStylePermission, RangeProtectionPermissionEditPoint, UniverSheetsPlugin } from "@univerjs/sheets";
7
- import { SheetSkeletonManagerService, IEditorBridgeService, getCurrentRangeDisable$, deriveStateFromActiveSheet$, UniverSheetsUIPlugin } from "@univerjs/sheets-ui";
8
- import { switchMap, of, skip, BehaviorSubject, Observable, combineLatest, merge } from "rxjs";
9
- import { IRenderManagerService } from "@univerjs/engine-render";
10
- import { ComponentManager, ISidebarService, ILayoutService, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, IMenuManagerService } from "@univerjs/ui";
11
- import { map, switchMap as switchMap$1, tap, debounceTime } from "rxjs/operators";
12
- import require$$0, { createContext, useState, useEffect, useRef, useContext, useMemo, forwardRef, createElement } from "react";
13
- import { InputNumber, Select, SelectList, Input, Button } from "@univerjs/design";
14
- import { DEFAULT_TEXT_FORMAT } from "@univerjs/engine-numfmt";
15
- const currencySymbols = [
16
- "$",
17
- "£",
18
- "¥",
19
- "¤",
20
- "֏",
21
- "؋",
22
- "৳",
23
- "฿",
24
- // '៛',
25
- "₡",
26
- "₦",
27
- "₩",
28
- "₪",
29
- "₫",
30
- "€",
31
- "₭",
32
- "₮",
33
- "₱",
34
- "₲",
35
- "₴",
36
- "₸",
37
- "₹",
38
- "₺",
39
- "₼",
40
- "₽",
41
- "₾",
42
- "₿"
43
- ], countryCurrencyMap = {
44
- US: "$",
45
- // United States Dollar
46
- CA: "C$",
47
- // Canadian Dollar
48
- GB: "£",
49
- // British Pound Sterling
50
- JP: "¥",
51
- // Japanese Yen
52
- IN: "₹",
53
- // Indian Rupee
54
- AU: "A$",
55
- // Australian Dollar
56
- CN: "¥",
57
- // Chinese Yuan
58
- KR: "₩",
59
- // South Korean Won
60
- RU: "₽",
61
- // Russian Ruble
62
- // Euro countries
63
- AT: "€",
64
- BE: "€",
65
- CY: "€",
66
- EE: "€",
67
- FI: "€",
68
- FR: "€",
69
- DE: "€",
70
- GR: "€",
71
- IE: "€",
72
- IT: "€",
73
- LV: "€",
74
- LT: "€",
75
- LU: "€",
76
- MT: "€",
77
- NL: "€",
78
- PT: "€",
79
- SK: "€",
80
- SI: "€",
81
- ES: "€"
82
- // Add more mappings as needed
83
- }, SHEET_NUMFMT_PLUGIN = "SHEET_NUMFMT_PLUGIN", getPatternType = /* @__PURE__ */ __name((pattern) => numfmt.getInfo(pattern).type || "unknown", "getPatternType"), getPatternPreview = /* @__PURE__ */ __name((pattern, value, _locale) => {
84
- const info = numfmt.getInfo(pattern), locale = _locale === LocaleType.ZH_CN ? "zh-CN" : "en", negInfo = info._partitions[1], result = numfmt.format(pattern, value, { locale, throws: !1 });
85
- return value < 0 ? {
86
- result,
87
- color: negInfo.color
88
- } : {
89
- result
90
- };
91
- }, "getPatternPreview"), getPatternPreviewIgnoreGeneral = /* @__PURE__ */ __name((pattern, value, _locale) => pattern === "General" ? {
92
- result: String(value)
93
- } : getPatternPreview(pattern, value, _locale), "getPatternPreviewIgnoreGeneral");
94
- var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key2, kind) => {
95
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key2) : target, i = decorators.length - 1, decorator; i >= 0; i--)
96
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key2, result) : decorator(result)) || result);
97
- return kind && result && __defProp$7(target, key2, result), result;
98
- }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key2) => decorator(target, key2, index), "__decorateParam$7"), _a;
99
- let SheetsNumfmtCellContentController = (_a = class extends Disposable {
100
- constructor(_instanceService, _sheetInterceptorService, _themeService, _commandService, _numfmtService, _localeService) {
101
- super(), this._instanceService = _instanceService, this._sheetInterceptorService = _sheetInterceptorService, this._themeService = _themeService, this._commandService = _commandService, this._numfmtService = _numfmtService, this._localeService = _localeService, this._initInterceptorCellContent();
102
- }
103
- // eslint-disable-next-line max-lines-per-function
104
- _initInterceptorCellContent() {
105
- const renderCache = new ObjectMatrix();
106
- this.disposeWithMe(this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {
107
- effect: InterceptorEffectEnum.Value | InterceptorEffectEnum.Style,
108
- handler: /* @__PURE__ */ __name((cell, location, next) => {
109
- const unitId = location.unitId, sheetId = location.subUnitId;
110
- let numfmtValue;
111
- const originCellValue = cell;
112
- if (!originCellValue || originCellValue.t !== CellValueType.NUMBER || originCellValue.v == null || Number.isNaN(originCellValue.v))
113
- return next(cell);
114
- if (cell != null && cell.s) {
115
- const style = location.workbook.getStyles().get(cell.s);
116
- style != null && style.n && (numfmtValue = style.n);
117
- }
118
- if (numfmtValue || (numfmtValue = this._numfmtService.getValue(unitId, sheetId, location.row, location.col)), !numfmtValue)
119
- return next(cell);
120
- let numfmtRes = "";
121
- const cache = renderCache.getValue(location.row, location.col);
122
- if (cache && cache.parameters === `${originCellValue.v}_${numfmtValue.pattern}`)
123
- return next({ ...cell, ...cache.result });
124
- const info = getPatternPreviewIgnoreGeneral(numfmtValue.pattern, Number(originCellValue.v), this._localeService.getCurrentLocale());
125
- if (numfmtRes = info.result, !numfmtRes)
126
- return next(cell);
127
- const res = { v: numfmtRes };
128
- if (info.color) {
129
- const color = this._themeService.getCurrentTheme()[`${info.color}500`];
130
- color && (res.interceptorStyle = { cl: { rgb: color } });
131
- }
132
- return renderCache.setValue(location.row, location.col, {
133
- result: res,
134
- parameters: `${originCellValue.v}_${numfmtValue.pattern}`
135
- }), next({ ...cell, ...res });
136
- }, "handler"),
137
- priority: InterceptCellContentPriority.NUMFMT
138
- })), this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
139
- if (commandInfo.id === SetNumfmtMutation.id) {
140
- const params = commandInfo.params;
141
- Object.keys(params.values).forEach((key2) => {
142
- params.values[key2].ranges.forEach((range) => {
143
- Range.foreach(range, (row, col) => {
144
- renderCache.realDeleteValue(row, col);
145
- });
146
- });
147
- });
148
- } else if (commandInfo.id === SetRangeValuesMutation.id) {
149
- const params = commandInfo.params;
150
- new ObjectMatrix(params.cellValue).forValue((row, col) => {
151
- renderCache.realDeleteValue(row, col);
152
- });
153
- }
154
- })), this.disposeWithMe(
155
- this._instanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(
156
- switchMap((workbook) => {
157
- var _a9;
158
- return (_a9 = workbook == null ? void 0 : workbook.activeSheet$) != null ? _a9 : of(null);
159
- }),
160
- skip(1)
161
- ).subscribe(() => renderCache.reset())
162
- );
163
- }
164
- }, __name(_a, "SheetsNumfmtCellContentController"), _a);
165
- SheetsNumfmtCellContentController = __decorateClass$7([
166
- OnLifecycle(LifecycleStages.Rendered, SheetsNumfmtCellContentController),
167
- __decorateParam$7(0, IUniverInstanceService),
168
- __decorateParam$7(1, Inject(SheetInterceptorService)),
169
- __decorateParam$7(2, Inject(ThemeService)),
170
- __decorateParam$7(3, Inject(ICommandService)),
171
- __decorateParam$7(4, Inject(INumfmtService)),
172
- __decorateParam$7(5, Inject(LocaleService))
173
- ], SheetsNumfmtCellContentController);
174
- const getDecimalFromPattern = /* @__PURE__ */ __name((pattern, defaultValue = 0) => {
175
- var _a9;
176
- return pattern && (_a9 = numfmt.getInfo(pattern).maxDecimals) != null ? _a9 : defaultValue;
177
- }, "getDecimalFromPattern"), isPatternEqualWithoutDecimal = /* @__PURE__ */ __name((patternA, patternB) => {
178
- if (patternA && !patternB || !patternA && patternB)
179
- return !1;
180
- const getString = /* @__PURE__ */ __name((tokens) => tokens.reduce(
181
- (pre, cur) => {
182
- if (pre.isEnd)
183
- return pre;
184
- const str = cur.value || cur.num;
185
- return cur.type === "point" ? (pre.isEnd = !0, pre) : { ...pre, result: pre.result + str };
186
- },
187
- { isEnd: !1, result: "" }
188
- ).result, "getString"), partitionsA = numfmt.getInfo(patternA)._partitions, partitionsB = numfmt.getInfo(patternB)._partitions, A1 = getString(partitionsA[0].tokens), B1 = getString(partitionsB[0].tokens), A2 = getString(partitionsA[1].tokens), B2 = getString(partitionsB[1].tokens);
189
- return A1 === B1 && A2 === B2 && partitionsA[1].color === partitionsB[1].color;
190
- }, "isPatternEqualWithoutDecimal"), getDecimalString = /* @__PURE__ */ __name((length) => new Array(Math.min(Math.max(0, Number(length)), 30)).fill(0).join(""), "getDecimalString"), setPatternDecimal = /* @__PURE__ */ __name((patterns, decimalLength) => patterns.split(";").map((pattern) => /\.0?/.test(pattern) ? pattern.replace(
191
- /\.0*/g,
192
- `${decimalLength > 0 ? "." : ""}${getDecimalString(Number(decimalLength || 0))}`
193
- ) : /0([^0]?)|0$/.test(pattern) ? pattern.replace(
194
- /0([^0]+)|0$/,
195
- `0${decimalLength > 0 ? "." : ""}${getDecimalString(Number(decimalLength || 0))}$1`
196
- ) : pattern).join(";"), "setPatternDecimal"), isPatternHasDecimal = /* @__PURE__ */ __name((pattern) => /\.0?/.test(pattern) || /0([^0]?)|0$/.test(pattern), "isPatternHasDecimal"), SetNumfmtCommand = {
197
- id: "sheet.command.numfmt.set.numfmt",
198
- type: CommandType.COMMAND,
199
- handler: /* @__PURE__ */ __name((accessor, params) => {
200
- if (!params)
201
- return !1;
202
- const commandService = accessor.get(ICommandService), univerInstanceService = accessor.get(IUniverInstanceService), undoRedoService = accessor.get(IUndoRedoService), target = getSheetCommandTarget(univerInstanceService, params);
203
- if (!target) return !1;
204
- const { unitId, subUnitId } = target, setCells = params.values.filter((value) => !!value.pattern), removeCells = params.values.filter((value) => !value.pattern), setRedos = transformCellsToRange(unitId, subUnitId, setCells), removeRedos = {
205
- unitId,
206
- subUnitId,
207
- ranges: removeCells.map((cell) => ({
208
- startColumn: cell.col,
209
- startRow: cell.row,
210
- endColumn: cell.col,
211
- endRow: cell.row
212
- }))
213
- }, redos = [], undos = [];
214
- if (setCells.length) {
215
- Object.keys(setRedos.values).forEach((key2) => {
216
- const v = setRedos.values[key2];
217
- v.ranges = rangeMerge(v.ranges);
218
- }), redos.push({
219
- id: SetNumfmtMutation.id,
220
- params: setRedos
221
- });
222
- const undo = factorySetNumfmtUndoMutation(accessor, setRedos);
223
- undos.push(...undo);
224
- }
225
- if (removeCells.length) {
226
- removeRedos.ranges = rangeMerge(removeRedos.ranges), redos.push({
227
- id: RemoveNumfmtMutation.id,
228
- params: removeRedos
229
- });
230
- const undo = factoryRemoveNumfmtUndoMutation(accessor, removeRedos);
231
- undos.push(...undo);
232
- }
233
- const result = sequenceExecute(redos, commandService).result;
234
- return result && undoRedoService.pushUndoRedo({
235
- unitID: unitId,
236
- undoMutations: undos,
237
- redoMutations: redos
238
- }), result;
239
- }, "handler")
240
- }, AddDecimalCommand = {
241
- id: "sheet.command.numfmt.add.decimal.command",
242
- type: CommandType.COMMAND,
243
- handler: /* @__PURE__ */ __name(async (accessor) => {
244
- const commandService = accessor.get(ICommandService), selectionManagerService = accessor.get(SheetsSelectionsService), numfmtService = accessor.get(INumfmtService), univerInstanceService = accessor.get(IUniverInstanceService), selections = selectionManagerService.getCurrentSelections();
245
- if (!selections || !selections.length)
246
- return !1;
247
- const target = getSheetCommandTarget(univerInstanceService);
248
- if (!target) return !1;
249
- const { unitId, subUnitId } = target;
250
- let maxDecimals = 0;
251
- selections.forEach((selection) => {
252
- Range.foreach(selection.range, (row, col) => {
253
- const numfmtValue = numfmtService.getValue(unitId, subUnitId, row, col);
254
- if (!numfmtValue) {
255
- const cell = target.worksheet.getCellRaw(row, col);
256
- if (!maxDecimals && cell && cell.t === CellValueType.NUMBER && cell.v) {
257
- const regResult = /\.(\d*)$/.exec(String(cell.v));
258
- if (regResult) {
259
- const length = regResult[1].length;
260
- if (!length)
261
- return;
262
- maxDecimals = Math.max(maxDecimals, length);
263
- }
264
- }
265
- return;
266
- }
267
- const decimals2 = getDecimalFromPattern(numfmtValue.pattern);
268
- maxDecimals = decimals2 > maxDecimals ? decimals2 : maxDecimals;
269
- });
270
- });
271
- const decimals = maxDecimals + 1, defaultPattern = setPatternDecimal(`0${decimals > 0 ? ".0" : ""}`, decimals), values = [];
272
- return selections.forEach((selection) => {
273
- Range.foreach(selection.range, (row, col) => {
274
- const numfmtValue = numfmtService.getValue(unitId, subUnitId, row, col);
275
- if (!numfmtValue)
276
- values.push({
277
- row,
278
- col,
279
- pattern: defaultPattern
280
- });
281
- else {
282
- const decimals2 = getDecimalFromPattern(numfmtValue.pattern), pattern = setPatternDecimal(numfmtValue.pattern, decimals2 + 1);
283
- pattern !== numfmtValue.pattern && values.push({
284
- row,
285
- col,
286
- pattern
287
- });
288
- }
289
- });
290
- }), values.length ? await commandService.executeCommand(SetNumfmtCommand.id, { values }) : !1;
291
- }, "handler")
292
- }, DATEFMTLISG = [
293
- {
294
- label: "1930-08-05",
295
- suffix: "yyyy-MM-dd"
296
- },
297
- {
298
- label: "1930/08/05",
299
- suffix: "yyyy/MM/dd"
300
- },
301
- {
302
- label: "1930年08月05日",
303
- suffix: 'yyyy"年"MM"月"dd"日"'
304
- },
305
- {
306
- label: "08-05",
307
- suffix: "MM-dd"
308
- },
309
- {
310
- label: "8月5日",
311
- suffix: 'M"月"d"日"'
312
- },
313
- {
314
- label: "13:30:30",
315
- suffix: "h:mm:ss"
316
- },
317
- {
318
- label: "13:30",
319
- suffix: "h:mm"
320
- },
321
- {
322
- label: "下午01:30",
323
- suffix: "A/P hh:mm"
324
- },
325
- {
326
- label: "下午1:30",
327
- suffix: "A/P h:mm"
328
- },
329
- {
330
- label: "下午1:30:30",
331
- suffix: "A/P h:mm:ss"
332
- },
333
- {
334
- label: "08-05 下午 01:30",
335
- suffix: "MM-dd A/P hh:mm"
336
- }
337
- ], NUMBERFORMAT = [
338
- {
339
- label: "(1,235)",
340
- suffix: "#,##0_);(#,##0)"
341
- },
342
- {
343
- label: "(1,235) ",
344
- suffix: "#,##0_);[Red](#,##0)",
345
- color: "red"
346
- },
347
- {
348
- label: "1,234.56",
349
- suffix: "#,##0.00_);#,##0.00"
350
- },
351
- {
352
- label: "1,234.56",
353
- suffix: "#,##0.00_);[Red]#,##0.00",
354
- color: "red"
355
- },
356
- {
357
- label: "-1,234.56",
358
- suffix: "#,##0.00_);-#,##0.00"
359
- },
360
- {
361
- label: "-1,234.56",
362
- suffix: "#,##0.00_);[Red]-#,##0.00",
363
- color: "red"
364
- }
365
- ], CURRENCYFORMAT = [
366
- {
367
- label: /* @__PURE__ */ __name((suffix) => `${suffix}1,235`, "label"),
368
- suffix: /* @__PURE__ */ __name((suffix) => `"${suffix}"#,##0.00_);"${suffix}"#,##0.00`, "suffix")
369
- },
370
- {
371
- label: /* @__PURE__ */ __name((suffix) => `${suffix}1,235`, "label"),
372
- suffix: /* @__PURE__ */ __name((suffix) => `"${suffix}"#,##0.00_);[Red]"${suffix}"#,##0.00`, "suffix"),
373
- color: "red"
374
- },
375
- {
376
- label: /* @__PURE__ */ __name((suffix) => `(${suffix}1,235)`, "label"),
377
- suffix: /* @__PURE__ */ __name((suffix) => `"${suffix}"#,##0.00_);("${suffix}"#,##0.00)`, "suffix")
378
- },
379
- {
380
- label: /* @__PURE__ */ __name((suffix) => `(${suffix}1,235)`, "label"),
381
- suffix: /* @__PURE__ */ __name((suffix) => `"${suffix}"#,##0.00_);[Red]("${suffix}"#,##0.00)`, "suffix"),
382
- color: "red"
383
- },
384
- {
385
- label: /* @__PURE__ */ __name((suffix) => `-${suffix}1,235`, "label"),
386
- suffix: /* @__PURE__ */ __name((suffix) => `"${suffix}"#,##0.00_);-"${suffix}"#,##0.00`, "suffix")
387
- },
388
- {
389
- label: /* @__PURE__ */ __name((suffix) => `-${suffix}1,235`, "label"),
390
- suffix: /* @__PURE__ */ __name((suffix) => `"${suffix}"#,##0.00_);[Red]-"${suffix}"#,##0.00`, "suffix"),
391
- color: "red"
392
- }
393
- ], _MenuCurrencyService = class _MenuCurrencyService {
394
- constructor() {
395
- __publicField(this, "_currencySymbol$", new BehaviorSubject("US"));
396
- __publicField(this, "currencySymbol$", this._currencySymbol$.asObservable());
397
- }
398
- /**
399
- * Set the currency symbol by setting the country code.
400
- */
401
- setCurrencySymbolByCountryCode(symbol) {
402
- this._currencySymbol$.next(symbol);
403
- }
404
- getCurrencySymbol() {
405
- return this._currencySymbol$.getValue();
406
- }
407
- };
408
- __name(_MenuCurrencyService, "MenuCurrencyService");
409
- let MenuCurrencyService = _MenuCurrencyService;
410
- const SetCurrencyCommand = {
411
- id: "sheet.command.numfmt.set.currency",
412
- type: CommandType.COMMAND,
413
- handler: /* @__PURE__ */ __name(async (accessor) => {
414
- const commandService = accessor.get(ICommandService), selectionManagerService = accessor.get(SheetsSelectionsService), menuCurrencyService = accessor.get(MenuCurrencyService), symbol = countryCurrencyMap[menuCurrencyService.getCurrencySymbol()] || "$", selections = selectionManagerService.getCurrentSelections();
415
- if (!selections || !selections.length)
416
- return !1;
417
- const values = [], suffix = CURRENCYFORMAT[4].suffix(symbol);
418
- return selections.forEach((selection) => {
419
- Range.foreach(selection.range, (row, col) => {
420
- values.push({ row, col, pattern: suffix, type: "currency" });
421
- });
422
- }), await commandService.executeCommand(SetNumfmtCommand.id, { values });
423
- }, "handler")
424
- }, SetPercentCommand = {
425
- id: "sheet.command.numfmt.set.percent",
426
- type: CommandType.COMMAND,
427
- handler: /* @__PURE__ */ __name(async (accessor) => {
428
- const commandService = accessor.get(ICommandService), selections = accessor.get(SheetsSelectionsService).getCurrentSelections();
429
- if (!selections || !selections.length)
430
- return !1;
431
- const values = [], suffix = "0%";
432
- return selections.forEach((selection) => {
433
- Range.foreach(selection.range, (row, col) => {
434
- values.push({ row, col, pattern: suffix, type: "percent" });
435
- });
436
- }), await commandService.executeCommand(SetNumfmtCommand.id, { values });
437
- }, "handler")
438
- }, SubtractDecimalCommand = {
439
- id: "sheet.command.numfmt.subtract.decimal.command",
440
- type: CommandType.COMMAND,
441
- handler: /* @__PURE__ */ __name(async (accessor) => {
442
- const commandService = accessor.get(ICommandService), selectionManagerService = accessor.get(SheetsSelectionsService), numfmtService = accessor.get(INumfmtService), univerInstanceService = accessor.get(IUniverInstanceService), selections = selectionManagerService.getCurrentSelections();
443
- if (!selections || !selections.length)
444
- return !1;
445
- const target = getSheetCommandTarget(univerInstanceService);
446
- if (!target) return !1;
447
- const { unitId, subUnitId } = target;
448
- let maxDecimals = 0;
449
- selections.forEach((selection) => {
450
- Range.foreach(selection.range, (row, col) => {
451
- const numfmtValue = numfmtService.getValue(unitId, subUnitId, row, col);
452
- if (!numfmtValue) {
453
- const cell = target.worksheet.getCellRaw(row, col);
454
- if (!maxDecimals && cell && cell.t === CellValueType.NUMBER && cell.v) {
455
- const regResult = /\.(\d*)$/.exec(String(cell.v));
456
- if (regResult) {
457
- const length = regResult[1].length;
458
- if (!length)
459
- return;
460
- maxDecimals = Math.max(maxDecimals, length);
461
- }
462
- }
463
- return;
464
- }
465
- const decimals2 = getDecimalFromPattern(numfmtValue.pattern);
466
- maxDecimals = decimals2 > maxDecimals ? decimals2 : maxDecimals;
467
- });
468
- });
469
- const decimals = maxDecimals - 1, defaultPattern = setPatternDecimal(`0${decimals > 0 ? ".0" : "."}`, decimals), values = [];
470
- return selections.forEach((selection) => {
471
- Range.foreach(selection.range, (row, col) => {
472
- const numfmtValue = numfmtService.getValue(unitId, subUnitId, row, col);
473
- if (!numfmtValue)
474
- values.push({
475
- row,
476
- col,
477
- pattern: defaultPattern
478
- });
479
- else {
480
- const decimals2 = getDecimalFromPattern(numfmtValue.pattern);
481
- values.push({
482
- row,
483
- col,
484
- pattern: setPatternDecimal(numfmtValue.pattern, decimals2 - 1)
485
- });
486
- }
487
- });
488
- }), await commandService.executeCommand(SetNumfmtCommand.id, { values });
489
- }, "handler")
490
- }, CloseNumfmtPanelOperator = {
491
- id: "sheet.operation.close.numfmt.panel",
492
- type: CommandType.OPERATION,
493
- handler: /* @__PURE__ */ __name(() => (
494
- // do nothing,just notify panel is closed
495
- !0
496
- ), "handler")
497
- }, INumfmtController = createIdentifier("INumfmtController");
498
- runOnLifecycle(LifecycleStages.Rendered, INumfmtController);
499
- const OpenNumfmtPanelOperator = {
500
- id: "sheet.operation.open.numfmt.panel",
501
- type: CommandType.OPERATION,
502
- handler: /* @__PURE__ */ __name((accessor) => (accessor.get(INumfmtController).openPanel(), !0), "handler")
503
- };
504
- var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
505
- /**
506
- * @license React
507
- * react-jsx-runtime.production.min.js
508
- *
509
- * Copyright (c) Facebook, Inc. and its affiliates.
510
- *
511
- * This source code is licensed under the MIT license found in the
512
- * LICENSE file in the root directory of this source tree.
513
- */
514
- var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: !0, ref: !0, __self: !0, __source: !0 };
515
- function q(c, a, g) {
516
- var b, d = {}, e = null, h = null;
517
- g !== void 0 && (e = "" + g), a.key !== void 0 && (e = "" + a.key), a.ref !== void 0 && (h = a.ref);
518
- for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
519
- if (c && c.defaultProps) for (b in a = c.defaultProps, a) d[b] === void 0 && (d[b] = a[b]);
520
- return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
521
- }
522
- __name(q, "q");
523
- reactJsxRuntime_production_min.Fragment = l;
524
- reactJsxRuntime_production_min.jsx = q;
525
- reactJsxRuntime_production_min.jsxs = q;
526
- jsxRuntime.exports = reactJsxRuntime_production_min;
527
- var jsxRuntimeExports = jsxRuntime.exports;
528
- const UserHabitCurrencyContext = createContext([]);
529
- var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key2, kind) => {
530
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key2) : target, i = decorators.length - 1, decorator; i >= 0; i--)
531
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key2, result) : decorator(result)) || result);
532
- return kind && result && __defProp$6(target, key2, result), result;
533
- }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key2) => decorator(target, key2, index), "__decorateParam$6"), _a2;
534
- let UserHabitController = (_a2 = class {
535
- constructor(_localStorageService) {
536
- this._localStorageService = _localStorageService;
537
- }
538
- _getKey(habit) {
539
- return `userHabitController_${habit}`;
540
- }
541
- async addHabit(habit, initValue) {
542
- const key2 = this._getKey(habit);
543
- return this._localStorageService.getItem(key2).then((item) => {
544
- item || this._localStorageService.setItem(key2, initValue);
545
- });
546
- }
547
- markHabit(habit, value) {
548
- const key2 = this._getKey(habit);
549
- this._localStorageService.getItem(key2).then((list) => {
550
- if (list) {
551
- const index = list.findIndex((item) => item === value);
552
- index > -1 && list.splice(index, 1), list.unshift(value), this._localStorageService.setItem(key2, list);
553
- }
554
- });
555
- }
556
- async getHabit(habit, sortList) {
557
- const key2 = this._getKey(habit), result = await this._localStorageService.getItem(key2);
558
- if (sortList && result) {
559
- const priority = result.map((item, index, arr) => {
560
- const length = arr.length;
561
- return {
562
- value: item,
563
- priority: length - index
564
- };
565
- });
566
- return sortList.sort((a, b) => {
567
- var _a9, _b;
568
- const ap = ((_a9 = priority.find((item) => item.value === a)) == null ? void 0 : _a9.priority) || -1;
569
- return (((_b = priority.find((item) => item.value === b)) == null ? void 0 : _b.priority) || -1) - ap;
570
- });
571
- }
572
- return result || [];
573
- }
574
- deleteHabit(habit) {
575
- this._localStorageService.removeItem(habit);
576
- }
577
- }, __name(_a2, "UserHabitController"), _a2);
578
- UserHabitController = __decorateClass$6([
579
- __decorateParam$6(0, Inject(ILocalStorageService))
580
- ], UserHabitController);
581
- const key$1 = "numfmtCurrency", useCurrencyOptions = /* @__PURE__ */ __name((onOptionChange) => {
582
- const userHabitController = useDependency(UserHabitController), [options, optionsSet] = useState(currencySymbols);
583
- return useEffect(() => {
584
- userHabitController.addHabit("numfmtCurrency", []).then(() => {
585
- userHabitController.getHabit(key$1, [...currencySymbols]).then((list) => {
586
- optionsSet(list), onOptionChange && onOptionChange(list);
587
- });
588
- });
589
- }, []), { userHabitCurrency: options, mark: /* @__PURE__ */ __name((v) => {
590
- userHabitController.markHabit(key$1, v);
591
- }, "mark") };
592
- }, "useCurrencyOptions"), useNextTick = /* @__PURE__ */ __name(() => {
593
- const effectList = useRef([]), [value, dispatch] = useState({});
594
- return useEffect(() => {
595
- effectList.current.forEach((fn) => {
596
- fn();
597
- }), effectList.current = [];
598
- }, [value]), /* @__PURE__ */ __name((fn) => {
599
- effectList.current.push(fn), dispatch({});
600
- }, "nextTick");
601
- }, "useNextTick"), getCurrencyType = /* @__PURE__ */ __name((pattern) => currencySymbols.find((code) => pattern.includes(code)), "getCurrencyType"), isAccountingPanel = /* @__PURE__ */ __name((pattern) => !!getCurrencyType(pattern) && pattern.startsWith("_("), "isAccountingPanel"), AccountingPanel = /* @__PURE__ */ __name((props) => {
602
- const [decimal, decimalSet] = useState(() => getDecimalFromPattern(props.defaultPattern || "", 2)), userHabitCurrency = useContext(UserHabitCurrencyContext), [suffix, suffixSet] = useState(() => getCurrencyType(props.defaultPattern) || userHabitCurrency[0]), options = useMemo(() => userHabitCurrency.map((key2) => ({ label: key2, value: key2 })), []), t = useDependency(LocaleService).t;
603
- props.action.current = () => setPatternDecimal(`_("${suffix}"* #,##0${decimal > 0 ? ".0" : ""}_)`, decimal);
604
- const onSelect = /* @__PURE__ */ __name((v) => {
605
- suffixSet(v), props.onChange(setPatternDecimal(`_("${v}"* #,##0${decimal > 0 ? ".0" : ""}_)`, decimal));
606
- }, "onSelect"), onDecimalChange = /* @__PURE__ */ __name((v) => {
607
- const decimal2 = v || 0;
608
- decimalSet(decimal2), props.onChange(setPatternDecimal(`_("${suffix}"* #,##0${decimal2 > 0 ? ".0" : ""}_)`, decimal2));
609
- }, "onDecimalChange");
610
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
611
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "m-t-16 options ", children: [
612
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "option", children: [
613
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: t("sheet.numfmt.decimalLength") }),
614
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InputNumber, { value: decimal, max: 20, min: 0, onChange: onDecimalChange }) })
615
- ] }),
616
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "option", children: [
617
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: t("sheet.numfmt.currencyType") }),
618
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select, { onChange: onSelect, options, value: suffix }) })
619
- ] })
620
- ] }),
621
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "describe m-t-14", children: t("sheet.numfmt.accountingDes") })
622
- ] });
623
- }, "AccountingPanel"), getCurrencyFormatOptions = /* @__PURE__ */ __name((suffix) => CURRENCYFORMAT.map((item) => ({
624
- label: item.label(suffix),
625
- value: item.suffix(suffix),
626
- color: item.color
627
- })), "getCurrencyFormatOptions"), getDateFormatOptions = /* @__PURE__ */ __name(() => DATEFMTLISG.map((item) => ({ label: item.label, value: item.suffix })), "getDateFormatOptions"), getNumberFormatOptions = /* @__PURE__ */ __name(() => NUMBERFORMAT.map((item) => ({ label: item.label, value: item.suffix, color: item.color })), "getNumberFormatOptions"), isCurrencyPanel = /* @__PURE__ */ __name((pattern) => !!getCurrencyType(pattern) && !pattern.startsWith("_("), "isCurrencyPanel"), CurrencyPanel = /* @__PURE__ */ __name((props) => {
628
- const t = useDependency(LocaleService).t, userHabitCurrency = useContext(UserHabitCurrencyContext), [suffix, suffixSet] = useState(() => getCurrencyType(props.defaultPattern) || userHabitCurrency[0]), [decimal, decimalSet] = useState(() => getDecimalFromPattern(props.defaultPattern || "", 2)), [pattern, patternSet] = useState(() => {
629
- var _a9;
630
- const negativeOptions2 = getCurrencyFormatOptions(suffix);
631
- return ((_a9 = negativeOptions2.find((item) => isPatternEqualWithoutDecimal(item.value, props.defaultPattern))) == null ? void 0 : _a9.value) || negativeOptions2[0].value;
632
- }), negativeOptions = useMemo(() => getCurrencyFormatOptions(suffix), [suffix]), options = useMemo(() => userHabitCurrency.map((key2) => ({ label: key2, value: key2 })), [userHabitCurrency]);
633
- props.action.current = () => setPatternDecimal(pattern, decimal);
634
- const onSelect = /* @__PURE__ */ __name((value) => {
635
- if (value === void 0)
636
- return;
637
- suffixSet(value);
638
- const pattern2 = getCurrencyFormatOptions(value)[0].value;
639
- patternSet(pattern2), props.onChange(setPatternDecimal(pattern2, decimal));
640
- }, "onSelect"), onChange = /* @__PURE__ */ __name((value) => {
641
- value !== void 0 && (patternSet(value), props.onChange(setPatternDecimal(value, decimal)));
642
- }, "onChange"), onDecimalChange = /* @__PURE__ */ __name((v) => {
643
- decimalSet(v || 0), props.onChange(setPatternDecimal(pattern, v || 0));
644
- }, "onDecimalChange");
645
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
646
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "m-t-16 options ", children: [
647
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "option", children: [
648
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: t("sheet.numfmt.decimalLength") }),
649
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-t-8 w-120", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InputNumber, { value: decimal, max: 20, min: 0, onChange: onDecimalChange }) })
650
- ] }),
651
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "option", children: [
652
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: t("sheet.numfmt.currencyType") }),
653
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-t-8 w-140", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select, { onChange: onSelect, options, value: suffix }) })
654
- ] })
655
- ] }),
656
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-t-16 label", children: t("sheet.numfmt.negType") }),
657
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectList, { onChange, options: negativeOptions, value: pattern }) }),
658
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "describe m-t-14", children: t("sheet.numfmt.currencyDes") })
659
- ] });
660
- }, "CurrencyPanel");
661
- var __assign = function() {
662
- return __assign = Object.assign || function(t) {
663
- for (var s, i = 1, n2 = arguments.length; i < n2; i++) {
664
- s = arguments[i];
665
- for (var p2 in s) Object.prototype.hasOwnProperty.call(s, p2) && (t[p2] = s[p2]);
666
- }
667
- return t;
668
- }, __assign.apply(this, arguments);
669
- }, __rest = function(s, e) {
670
- var t = {};
671
- for (var p2 in s) Object.prototype.hasOwnProperty.call(s, p2) && e.indexOf(p2) < 0 && (t[p2] = s[p2]);
672
- if (s != null && typeof Object.getOwnPropertySymbols == "function")
673
- for (var i = 0, p2 = Object.getOwnPropertySymbols(s); i < p2.length; i++)
674
- e.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p2[i]) && (t[p2[i]] = s[p2[i]]);
675
- return t;
676
- }, IconBase = forwardRef(function(props, ref) {
677
- var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
678
- return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
679
- });
680
- function render(node, id, runtimeProps, rootProps, extend) {
681
- return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
682
- return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
683
- }));
684
- }
685
- __name(render, "render");
686
- function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
687
- var attrs = __assign({}, node.attrs);
688
- extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
689
- var defIds = runtimeProps.defIds;
690
- return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a9) {
691
- var key2 = _a9[0], value = _a9[1];
692
- typeof value == "string" && (attrs[key2] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
693
- })), attrs;
694
- }
695
- __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
696
- function replaceRuntimeIdsInDefs(node, runtimeProps) {
697
- var _a9, defIds = runtimeProps.defIds;
698
- return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a9 = node.children) === null || _a9 === void 0) && _a9.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
699
- return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
700
- }) }) : node;
701
- }
702
- __name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
703
- function generateShortUuid() {
704
- return Math.random().toString(36).substring(2, 8);
705
- }
706
- __name(generateShortUuid, "generateShortUuid");
707
- IconBase.displayName = "UniverIcon";
708
- var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, CheckMarkSingle = forwardRef(function(props, ref) {
709
- return createElement(IconBase, Object.assign({}, props, {
710
- id: "check-mark-single",
711
- ref,
712
- icon: element
713
- }));
714
- });
715
- CheckMarkSingle.displayName = "CheckMarkSingle";
716
- const customFormatTitle = "univer-custom-format-title", customFormatInput = "univer-custom-format-input", customFormatHistoryList = "univer-custom-format-history-list", customFormatHistoryListItem = "univer-custom-format-history-list-item", customFormatHistoryListItemIconWrap = "univer-custom-format-history-list-item-icon-wrap", customFormatDes = "univer-custom-format-des", styles = {
717
- customFormatTitle,
718
- customFormatInput,
719
- customFormatHistoryList,
720
- customFormatHistoryListItem,
721
- customFormatHistoryListItemIconWrap,
722
- customFormatDes
723
- }, key = "customFormat", historyPatternKey = "numfmt_custom_pattern";
724
- function CustomFormat(props) {
725
- const { defaultPattern, action, onChange } = props, userHabitController = useDependency(UserHabitController), localStorageService = useDependency(ILocalStorageService), localeService = useDependency(LocaleService), [pattern, patternSet] = useState(defaultPattern);
726
- action.current = () => (userHabitController.markHabit(key, pattern), localStorageService.getItem(historyPatternKey).then((list = []) => {
727
- const _list = [.../* @__PURE__ */ new Set([pattern, ...list || []])].splice(0, 10).filter((e) => !!e);
728
- localStorageService.setItem(historyPatternKey, _list);
729
- }), pattern);
730
- const [options, optionsSet] = useState([]);
731
- useEffect(() => {
732
- localStorageService.getItem(historyPatternKey).then((historyList) => {
733
- const list = [
734
- ...CURRENCYFORMAT.map((item) => item.suffix("$")),
735
- ...DATEFMTLISG.map((item) => item.suffix),
736
- ...NUMBERFORMAT.map((item) => item.suffix)
737
- ];
738
- list.push(...historyList || []), userHabitController.addHabit(key, []).finally(() => {
739
- userHabitController.getHabit(key, list).then((list2) => {
740
- optionsSet([...new Set(list2)]);
741
- });
742
- });
743
- });
744
- }, []);
745
- const handleClick = /* @__PURE__ */ __name((p2) => {
746
- patternSet(p2), onChange(p2);
747
- }, "handleClick"), handleBlur = /* @__PURE__ */ __name(() => {
748
- onChange(pattern);
749
- }, "handleBlur");
750
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.customFormat, children: [
751
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.customFormatTitle, children: localeService.t("sheet.numfmt.customFormat") }),
752
- /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: localeService.t("sheet.numfmt.customFormat"), onBlur: handleBlur, value: pattern, onChange: patternSet, className: styles.customFormatInput }),
753
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.customFormatHistoryList, children: options.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { onClick: /* @__PURE__ */ __name(() => handleClick(p2), "onClick"), className: styles.customFormatHistoryListItem, children: [
754
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.customFormatHistoryListItemIconWrap, children: pattern === p2 && /* @__PURE__ */ jsxRuntimeExports.jsx(CheckMarkSingle, {}) }),
755
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: p2 })
756
- ] }, p2)) }),
757
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.customFormatDes, children: localeService.t("sheet.numfmt.customFormatDes") })
758
- ] });
759
- }
760
- __name(CustomFormat, "CustomFormat");
761
- const isDatePanel = /* @__PURE__ */ __name((pattern) => {
762
- const info = numfmt.getInfo(pattern);
763
- return getDateFormatOptions().map((item) => item.value).includes(pattern) || ["date", "datetime", "time"].includes(info.type);
764
- }, "isDatePanel"), DatePanel = /* @__PURE__ */ __name((props) => {
765
- const options = useMemo(getDateFormatOptions, []), t = useDependency(LocaleService).t, [suffix, suffixSet] = useState(() => {
766
- if (props.defaultPattern) {
767
- const item = options.find((item2) => item2.value === props.defaultPattern);
768
- if (item)
769
- return item.value;
770
- }
771
- return options[0].value;
772
- });
773
- props.action.current = () => suffix;
774
- const onChange = /* @__PURE__ */ __name((v) => {
775
- v !== void 0 && (suffixSet(v), props.onChange(v));
776
- }, "onChange");
777
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
778
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-t-16 label", children: t("sheet.numfmt.dateType") }),
779
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectList, { value: suffix, options, onChange }) }),
780
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "describe m-t-14", children: t("sheet.numfmt.dateDes") })
781
- ] });
782
- }, "DatePanel"), isGeneralPanel = /* @__PURE__ */ __name((pattern) => !pattern, "isGeneralPanel"), GeneralPanel = /* @__PURE__ */ __name((props) => {
783
- const t = useDependency(LocaleService).t;
784
- return props.action.current = () => "", /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "describe m-t-14", children: t("sheet.numfmt.generalDes") }) });
785
- }, "GeneralPanel"), isThousandthPercentilePanel = /* @__PURE__ */ __name((pattern) => getNumberFormatOptions().some((item) => isPatternEqualWithoutDecimal(item.value, pattern)), "isThousandthPercentilePanel"), ThousandthPercentilePanel = /* @__PURE__ */ __name((props) => {
786
- const localeService = useDependency(LocaleService), options = useMemo(getNumberFormatOptions, []), [decimal, decimalSet] = useState(() => getDecimalFromPattern(props.defaultPattern || "", 0)), [suffix, suffixSet] = useState(() => {
787
- const item = options.find((item2) => isPatternEqualWithoutDecimal(item2.value, props.defaultPattern || ""));
788
- return (item == null ? void 0 : item.value) || options[0].value;
789
- }), pattern = useMemo(() => setPatternDecimal(suffix, Number(decimal || 0)), [suffix, decimal]), isInputDisable = useMemo(() => !isPatternHasDecimal(suffix), [suffix]), handleDecimalChange = /* @__PURE__ */ __name((decimal2) => {
790
- decimalSet(decimal2 || 0), props.onChange(setPatternDecimal(suffix, Number(decimal2 || 0)));
791
- }, "handleDecimalChange"), handleClick = /* @__PURE__ */ __name((v) => {
792
- v !== void 0 && (decimalSet(getDecimalFromPattern(v, 0)), suffixSet(v), props.onChange(v));
793
- }, "handleClick");
794
- return props.action.current = () => pattern, /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
795
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-t-16 label", children: localeService.t("sheet.numfmt.decimalLength") }),
796
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
797
- InputNumber,
798
- {
799
- disabled: isInputDisable,
800
- value: decimal,
801
- max: 20,
802
- min: 0,
803
- onChange: handleDecimalChange
804
- }
805
- ) }),
806
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "m-t-16 label", children: [
807
- " ",
808
- localeService.t("sheet.numfmt.negType")
809
- ] }),
810
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectList, { onChange: handleClick, options, value: suffix }) }),
811
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "describe m-t-14", children: localeService.t("sheet.numfmt.thousandthPercentileDes") })
812
- ] });
813
- }, "ThousandthPercentilePanel"), SheetNumfmtPanel = /* @__PURE__ */ __name((props) => {
814
- const { defaultValue, defaultPattern, row, col } = props.value, localeService = useDependency(LocaleService), getCurrentPattern = useRef(() => ""), t = localeService.t, nextTick = useNextTick(), typeOptions = useMemo(
815
- () => [
816
- { label: "sheet.numfmt.general", component: GeneralPanel },
817
- { label: "sheet.numfmt.accounting", component: AccountingPanel },
818
- { label: "sheet.numfmt.currency", component: CurrencyPanel },
819
- { label: "sheet.numfmt.date", component: DatePanel },
820
- { label: "sheet.numfmt.thousandthPercentile", component: ThousandthPercentilePanel },
821
- { label: "sheet.numfmt.customFormat", component: CustomFormat }
822
- ].map((item) => ({ ...item, label: t(item.label) })),
823
- []
824
- ), [type, typeSet] = useState(findDefaultType), [key2, keySet] = useState(() => `${row}_${col}`), { mark, userHabitCurrency } = useCurrencyOptions(() => keySet(`${row}_${col}_userCurrency'`)), BusinessComponent = useMemo(() => {
825
- var _a9;
826
- return (_a9 = typeOptions.find((item) => item.label === type)) == null ? void 0 : _a9.component;
827
- }, [type]);
828
- function findDefaultType() {
829
- return [isGeneralPanel, isAccountingPanel, isCurrencyPanel, isDatePanel, isThousandthPercentilePanel].reduce((pre, curFn, index) => pre || (curFn(defaultPattern) ? typeOptions[index].label : ""), "") || typeOptions[0].label;
830
- }
831
- __name(findDefaultType, "findDefaultType");
832
- const selectOptions = typeOptions.map((option) => ({
833
- label: option.label,
834
- value: option.label
835
- })), handleSelect = /* @__PURE__ */ __name((value) => {
836
- typeSet(value), nextTick(() => props.onChange({ type: "change", value: getCurrentPattern.current() || "" }));
837
- }, "handleSelect"), handleChange = /* @__PURE__ */ __name((v) => {
838
- props.onChange({ type: "change", value: v });
839
- }, "handleChange"), handleConfirm = /* @__PURE__ */ __name(() => {
840
- const pattern = getCurrentPattern.current() || "", currency = getCurrencyType(pattern);
841
- currency && mark(currency), props.onChange({ type: "confirm", value: pattern });
842
- }, "handleConfirm"), handleCancel = /* @__PURE__ */ __name(() => {
843
- props.onChange({ type: "cancel", value: "" });
844
- }, "handleCancel"), subProps = {
845
- onChange: handleChange,
846
- defaultValue,
847
- defaultPattern,
848
- action: getCurrentPattern
849
- };
850
- return useEffect(() => {
851
- typeSet(findDefaultType()), keySet(`${row}_${col}`);
852
- }, [row, col]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "numfmt-panel p-b-20", children: [
853
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
854
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label m-t-14", children: t("sheet.numfmt.numfmtType") }),
855
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-t-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select, { onChange: handleSelect, options: selectOptions, value: type, style: { width: "100%" } }) }),
856
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: BusinessComponent && /* @__PURE__ */ jsxRuntimeExports.jsx(UserHabitCurrencyContext.Provider, { value: userHabitCurrency, children: /* @__PURE__ */ createElement(BusinessComponent, { ...subProps, key: key2 }) }) })
857
- ] }),
858
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "btn-list m-t-14 m-b-20", children: [
859
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", onClick: handleCancel, className: "m-r-12", children: t("sheet.numfmt.cancel") }),
860
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "primary", size: "small", onClick: handleConfirm, children: t("sheet.numfmt.confirm") })
861
- ] })
862
- ] });
863
- }, "SheetNumfmtPanel");
864
- var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key2, kind) => {
865
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key2) : target, i = decorators.length - 1, decorator; i >= 0; i--)
866
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key2, result) : decorator(result)) || result);
867
- return kind && result && __defProp$5(target, key2, result), result;
868
- }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key2) => decorator(target, key2, index), "__decorateParam$5"), _a3;
869
- let NumfmtController = (_a3 = class extends Disposable {
870
- constructor(_sheetInterceptorService, _themeService, _univerInstanceService, _commandService, _selectionManagerService, _renderManagerService, _numfmtService, _componentManager, _sidebarService, _localeService) {
871
- super();
872
- /**
873
- * If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
874
- * @private
875
- * @type {(string | null)}
876
- * @memberof NumfmtController
877
- */
878
- __publicField(this, "_previewPattern", "");
879
- __publicField(this, "_sidebarDisposable", null);
880
- this._sheetInterceptorService = _sheetInterceptorService, this._themeService = _themeService, this._univerInstanceService = _univerInstanceService, this._commandService = _commandService, this._selectionManagerService = _selectionManagerService, this._renderManagerService = _renderManagerService, this._numfmtService = _numfmtService, this._componentManager = _componentManager, this._sidebarService = _sidebarService, this._localeService = _localeService, this._initRealTimeRenderingInterceptor(), this._initPanel(), this._initCommands(), this._initCloseListener(), this._commandExecutedListener();
881
- }
882
- openPanel() {
883
- var _a9;
884
- const sidebarService = this._sidebarService, selectionManagerService = this._selectionManagerService, commandService = this._commandService, univerInstanceService = this._univerInstanceService, numfmtService = this._numfmtService, localeService = this._localeService, range = (((_a9 = selectionManagerService.getCurrentSelections()) == null ? void 0 : _a9.map((s) => s.range)) || [])[0];
885
- if (!range)
886
- return !1;
887
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), sheet = workbook.getActiveSheet();
888
- if (!sheet)
889
- return !1;
890
- const cellValue = sheet.getCellRaw(range.startRow, range.startColumn), numfmtValue = numfmtService.getValue(
891
- workbook.getUnitId(),
892
- sheet.getSheetId(),
893
- range.startRow,
894
- range.startColumn
895
- );
896
- let pattern = "";
897
- numfmtValue && (pattern = numfmtValue.pattern);
898
- const defaultValue = (cellValue == null ? void 0 : cellValue.t) === CellValueType.NUMBER ? cellValue.v : 12345678, props = {
899
- onChange: /* @__PURE__ */ __name((config) => {
900
- var _a10;
901
- if (config.type === "change")
902
- this._previewPattern = config.value, this._forceUpdate();
903
- else if (config.type === "confirm") {
904
- const selections2 = ((_a10 = selectionManagerService.getCurrentSelections()) == null ? void 0 : _a10.map((s) => s.range)) || [], params = { values: [] }, patternType = getPatternType(config.value);
905
- selections2.forEach((rangeInfo) => {
906
- Range.foreach(rangeInfo, (row, col) => {
907
- params.values.push({
908
- row,
909
- col,
910
- pattern: config.value,
911
- type: patternType
912
- });
913
- });
914
- }), commandService.executeCommand(SetNumfmtCommand.id, params), sidebarService.close();
915
- } else config.type === "cancel" && sidebarService.close();
916
- }, "onChange"),
917
- value: { defaultPattern: pattern, defaultValue, row: range.startRow, col: range.startColumn }
918
- };
919
- return this._sidebarDisposable = sidebarService.open({
920
- header: { title: localeService.t("sheet.numfmt.title") },
921
- children: {
922
- label: SHEET_NUMFMT_PLUGIN,
923
- ...props
924
- // need passthrough to react props.
925
- },
926
- onClose: /* @__PURE__ */ __name(() => {
927
- this._forceUpdate(), commandService.executeCommand(CloseNumfmtPanelOperator.id);
928
- }, "onClose")
929
- }), !0;
930
- }
931
- _forceUpdate(unitId) {
932
- var _a9;
933
- const renderUnit = this._renderManagerService.getRenderById(
934
- unitId != null ? unitId : this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId()
935
- );
936
- renderUnit == null || renderUnit.with(SheetSkeletonManagerService).reCalculate(), (_a9 = renderUnit == null ? void 0 : renderUnit.mainComponent) == null || _a9.makeDirty();
937
- }
938
- _initCommands() {
939
- [
940
- AddDecimalCommand,
941
- SubtractDecimalCommand,
942
- SetCurrencyCommand,
943
- SetPercentCommand,
944
- OpenNumfmtPanelOperator,
945
- CloseNumfmtPanelOperator,
946
- SetNumfmtCommand
947
- ].forEach((config) => {
948
- this.disposeWithMe(this._commandService.registerCommand(config));
949
- });
950
- }
951
- _initPanel() {
952
- this._componentManager.register(SHEET_NUMFMT_PLUGIN, SheetNumfmtPanel);
953
- }
954
- _initRealTimeRenderingInterceptor() {
955
- const isPanelOpenObserver = new Observable((subscriber) => {
956
- this._commandService.onCommandExecuted((commandInfo) => {
957
- commandInfo.id === OpenNumfmtPanelOperator.id && subscriber.next(!0), commandInfo.id === CloseNumfmtPanelOperator.id && subscriber.next(!1);
958
- });
959
- }), combineOpenAndSelection$ = combineLatest([
960
- isPanelOpenObserver,
961
- this._selectionManagerService.selectionMoveEnd$.pipe(
962
- map((selectionInfos) => selectionInfos ? selectionInfos.map((selectionInfo) => selectionInfo.range) : [])
963
- )
964
- ]);
965
- this.disposeWithMe(
966
- toDisposable(
967
- combineOpenAndSelection$.pipe(
968
- switchMap$1(
969
- ([isOpen, selectionRanges]) => new Observable((subscribe) => {
970
- const disposableCollection = new DisposableCollection();
971
- return isOpen && selectionRanges.length && subscribe.next({ selectionRanges, disposableCollection }), () => {
972
- disposableCollection.dispose();
973
- };
974
- })
975
- ),
976
- tap(() => {
977
- this._previewPattern = null;
978
- })
979
- ).subscribe(({ disposableCollection, selectionRanges }) => {
980
- var _a9, _b;
981
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
982
- this.openPanel(), disposableCollection.add(
983
- this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {
984
- priority: 99,
985
- effect: InterceptorEffectEnum.Value | InterceptorEffectEnum.Style,
986
- handler: /* @__PURE__ */ __name((cell, location, next) => {
987
- const { row, col } = location, defaultValue = next(cell) || {};
988
- if (selectionRanges.find(
989
- (range) => range.startColumn <= col && range.endColumn >= col && range.startRow <= row && range.endRow >= row
990
- )) {
991
- const rawValue = location.worksheet.getCellRaw(row, col), value = rawValue == null ? void 0 : rawValue.v, type = rawValue == null ? void 0 : rawValue.t;
992
- if (value == null || type !== CellValueType.NUMBER || this._previewPattern === null)
993
- return defaultValue;
994
- const info = getPatternPreviewIgnoreGeneral(this._previewPattern, value, this._localeService.getCurrentLocale());
995
- if (info.color) {
996
- const color = this._themeService.getCurrentTheme()[`${info.color}500`];
997
- return {
998
- ...defaultValue,
999
- v: info.result,
1000
- t: CellValueType.STRING,
1001
- s: { cl: { rgb: color } }
1002
- };
1003
- }
1004
- return {
1005
- ...defaultValue,
1006
- v: info.result,
1007
- t: CellValueType.STRING
1008
- };
1009
- }
1010
- return defaultValue;
1011
- }, "handler")
1012
- })
1013
- ), (_b = (_a9 = this._renderManagerService.getRenderById(workbook.getUnitId())) == null ? void 0 : _a9.mainComponent) == null || _b.makeDirty();
1014
- })
1015
- )
1016
- );
1017
- }
1018
- _commandExecutedListener() {
1019
- const commandList = [RemoveNumfmtMutation.id, SetNumfmtMutation.id];
1020
- this.disposeWithMe(
1021
- new Observable((subscribe) => {
1022
- const disposable = this._commandService.onCommandExecuted((command) => {
1023
- if (commandList.includes(command.id)) {
1024
- const params = command.params;
1025
- subscribe.next(params.unitId);
1026
- }
1027
- });
1028
- return () => disposable.dispose();
1029
- }).pipe(debounceTime(16)).subscribe((unitId) => this._forceUpdate(unitId))
1030
- );
1031
- }
1032
- _initCloseListener() {
1033
- this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).subscribe((unit) => {
1034
- var _a9;
1035
- unit || ((_a9 = this._sidebarDisposable) == null || _a9.dispose(), this._sidebarDisposable = null);
1036
- });
1037
- }
1038
- }, __name(_a3, "NumfmtController"), _a3);
1039
- NumfmtController = __decorateClass$5([
1040
- OnLifecycle(LifecycleStages.Rendered, NumfmtController),
1041
- __decorateParam$5(0, Inject(SheetInterceptorService)),
1042
- __decorateParam$5(1, Inject(ThemeService)),
1043
- __decorateParam$5(2, IUniverInstanceService),
1044
- __decorateParam$5(3, ICommandService),
1045
- __decorateParam$5(4, Inject(SheetsSelectionsService)),
1046
- __decorateParam$5(5, IRenderManagerService),
1047
- __decorateParam$5(6, INumfmtService),
1048
- __decorateParam$5(7, Inject(ComponentManager)),
1049
- __decorateParam$5(8, ISidebarService),
1050
- __decorateParam$5(9, Inject(LocaleService))
1051
- ], NumfmtController);
1052
- var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key2, kind) => {
1053
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key2) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1054
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key2, result) : decorator(result)) || result);
1055
- return kind && result && __defProp$4(target, key2, result), result;
1056
- }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key2) => decorator(target, key2, index), "__decorateParam$4");
1057
- const createCollectEffectMutation = /* @__PURE__ */ __name(() => {
1058
- let list = [];
1059
- return {
1060
- add: /* @__PURE__ */ __name((unitId, subUnitId, row, col, value) => list.push({ unitId, subUnitId, row, col, value }), "add"),
1061
- getEffects: /* @__PURE__ */ __name(() => list, "getEffects"),
1062
- clean: /* @__PURE__ */ __name(() => {
1063
- list = [];
1064
- }, "clean")
1065
- };
1066
- }, "createCollectEffectMutation");
1067
- var _a4;
1068
- let NumfmtEditorController = (_a4 = class extends Disposable {
1069
- constructor(_sheetInterceptorService, _numfmtService, _univerInstanceService, _injector, _editorBridgeService) {
1070
- super();
1071
- // collect effect mutations when edit end and push this to commands stack in next commands progress
1072
- __publicField(this, "_collectEffectMutation", createCollectEffectMutation());
1073
- this._sheetInterceptorService = _sheetInterceptorService, this._numfmtService = _numfmtService, this._univerInstanceService = _univerInstanceService, this._injector = _injector, this._editorBridgeService = _editorBridgeService, this._initInterceptorEditorStart(), this._initInterceptorEditorEnd(), this._initInterceptorCommands();
1074
- }
1075
- _initInterceptorEditorStart() {
1076
- this._editorBridgeService && this.disposeWithMe(
1077
- toDisposable(
1078
- this._editorBridgeService.interceptor.intercept(
1079
- this._editorBridgeService.interceptor.getInterceptPoints().BEFORE_CELL_EDIT,
1080
- {
1081
- handler: /* @__PURE__ */ __name((value, context, next) => {
1082
- const row = context.row, col = context.col, numfmtCell = this._numfmtService.getValue(
1083
- context.unitId,
1084
- context.subUnitId,
1085
- row,
1086
- col
1087
- );
1088
- if (numfmtCell)
1089
- switch (getPatternType(numfmtCell.pattern)) {
1090
- case "scientific":
1091
- case "currency":
1092
- case "grouped":
1093
- case "number":
1094
- return context.worksheet.getCellRaw(row, col);
1095
- case "percent":
1096
- case "date":
1097
- case "time":
1098
- case "datetime":
1099
- default:
1100
- return next && next(value);
1101
- }
1102
- return next(value);
1103
- }, "handler")
1104
- }
1105
- )
1106
- )
1107
- );
1108
- }
1109
- /**
1110
- * Process the values after edit
1111
- * @private
1112
- * @memberof NumfmtService
1113
- */
1114
- _initInterceptorEditorEnd() {
1115
- this._editorBridgeService && this.disposeWithMe(
1116
- toDisposable(
1117
- this._editorBridgeService.interceptor.intercept(
1118
- this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,
1119
- {
1120
- handler: /* @__PURE__ */ __name((value, context, next) => {
1121
- var _a9;
1122
- this._collectEffectMutation.clean();
1123
- const currentNumfmtValue = this._numfmtService.getValue(
1124
- context.unitId,
1125
- context.subUnitId,
1126
- context.row,
1127
- context.col
1128
- ), currentNumfmtType = (_a9 = currentNumfmtValue && getPatternType(currentNumfmtValue.pattern)) != null ? _a9 : "", clean = /* @__PURE__ */ __name(() => {
1129
- currentNumfmtValue && this._collectEffectMutation.add(
1130
- context.unitId,
1131
- context.subUnitId,
1132
- context.row,
1133
- context.col,
1134
- null
1135
- );
1136
- }, "clean");
1137
- if (!(value != null && value.v))
1138
- return next(value);
1139
- const content = String(value.v), numfmtInfo = numfmt.parseDate(content) || numfmt.parseTime(content) || numfmt.parseNumber(content);
1140
- if (numfmtInfo) {
1141
- if (numfmtInfo.z) {
1142
- const v = Number(numfmtInfo.v);
1143
- return this._collectEffectMutation.add(
1144
- context.unitId,
1145
- context.subUnitId,
1146
- context.row,
1147
- context.col,
1148
- {
1149
- pattern: numfmtInfo.z
1150
- }
1151
- ), { ...value, v, t: CellValueType.NUMBER };
1152
- }
1153
- } else (["date", "time", "datetime", "percent"].includes(currentNumfmtType) || !isNumeric(content)) && clean();
1154
- return next(value);
1155
- }, "handler")
1156
- }
1157
- )
1158
- )
1159
- );
1160
- }
1161
- _initInterceptorCommands() {
1162
- const self = this;
1163
- this.disposeWithMe(
1164
- this._sheetInterceptorService.interceptCommand({
1165
- getMutations(command) {
1166
- var _a9;
1167
- switch (command.id) {
1168
- case SetRangeValuesCommand.id: {
1169
- const workbook = self._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), unitId = workbook.getUnitId(), subUnitId = (_a9 = workbook.getActiveSheet()) == null ? void 0 : _a9.getSheetId();
1170
- if (!subUnitId)
1171
- return {
1172
- redos: [],
1173
- undos: []
1174
- };
1175
- const list = self._collectEffectMutation.getEffects();
1176
- if (self._collectEffectMutation.clean(), !list.length)
1177
- return {
1178
- redos: [],
1179
- undos: []
1180
- };
1181
- const cells = list.filter((item) => {
1182
- var _a10;
1183
- return !!((_a10 = item.value) != null && _a10.pattern);
1184
- }).map((item) => ({
1185
- row: item.row,
1186
- col: item.col,
1187
- pattern: item.value.pattern
1188
- })), removeCells = list.filter((item) => {
1189
- var _a10;
1190
- return !((_a10 = item.value) != null && _a10.pattern);
1191
- }).map((item) => ({
1192
- startRow: item.row,
1193
- endColumn: item.col,
1194
- startColumn: item.col,
1195
- endRow: item.row
1196
- })), redos = [], undos = [];
1197
- if (cells.length) {
1198
- const redo = {
1199
- id: SetNumfmtMutation.id,
1200
- params: transformCellsToRange(unitId, subUnitId, cells)
1201
- };
1202
- redos.push(redo), undos.push(...factorySetNumfmtUndoMutation(self._injector, redo.params));
1203
- }
1204
- if (removeCells.length) {
1205
- const redo = {
1206
- id: RemoveNumfmtMutation.id,
1207
- params: {
1208
- unitId,
1209
- subUnitId,
1210
- ranges: removeCells
1211
- }
1212
- };
1213
- redos.push(redo), undos.push(...factoryRemoveNumfmtUndoMutation(self._injector, redo.params));
1214
- }
1215
- return {
1216
- redos,
1217
- undos: undos.reverse()
1218
- };
1219
- }
1220
- }
1221
- return {
1222
- redos: [],
1223
- undos: []
1224
- };
1225
- }
1226
- })
1227
- );
1228
- }
1229
- }, __name(_a4, "NumfmtEditorController"), _a4);
1230
- NumfmtEditorController = __decorateClass$4([
1231
- OnLifecycle(LifecycleStages.Rendered, NumfmtEditorController),
1232
- __decorateParam$4(0, Inject(SheetInterceptorService)),
1233
- __decorateParam$4(1, Inject(INumfmtService)),
1234
- __decorateParam$4(2, Inject(IUniverInstanceService)),
1235
- __decorateParam$4(3, Inject(Injector)),
1236
- __decorateParam$4(4, Optional(IEditorBridgeService))
1237
- ], NumfmtEditorController);
1238
- function isNumeric(str) {
1239
- return /^-?\d+(\.\d+)?$/.test(str);
1240
- }
1241
- __name(isNumeric, "isNumeric");
1242
- var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key2, kind) => {
1243
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key2) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1244
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key2, result) : decorator(result)) || result);
1245
- return kind && result && __defProp$3(target, key2, result), result;
1246
- }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key2) => decorator(target, key2, index), "__decorateParam$3"), _a5;
1247
- let NumfmtI18nController = (_a5 = class extends Disposable {
1248
- constructor(_localeService) {
1249
- super(), this._localeService = _localeService;
1250
- }
1251
- }, __name(_a5, "NumfmtI18nController"), _a5);
1252
- NumfmtI18nController = __decorateClass$3([
1253
- OnLifecycle(LifecycleStages.Rendered, NumfmtI18nController),
1254
- __decorateParam$3(0, Inject(LocaleService))
1255
- ], NumfmtI18nController);
1256
- const MENU_OPTIONS = [
1257
- {
1258
- label: "sheet.numfmt.general",
1259
- pattern: null
1260
- },
1261
- {
1262
- label: "sheet.numfmt.text",
1263
- pattern: DEFAULT_TEXT_FORMAT
1264
- },
1265
- "|",
1266
- {
1267
- label: "sheet.numfmt.number",
1268
- pattern: "0"
1269
- },
1270
- "|",
1271
- {
1272
- label: "sheet.numfmt.accounting",
1273
- pattern: '"¥" #,##0.00_);[Red]("¥"#,##0.00)'
1274
- },
1275
- {
1276
- label: "sheet.numfmt.financialValue",
1277
- pattern: "#,##0.00;[Red]#,##0.00"
1278
- },
1279
- {
1280
- label: "sheet.numfmt.currency",
1281
- pattern: '"¥"#,##0.00_);[Red]("¥"#,##0.00)'
1282
- },
1283
- {
1284
- label: "sheet.numfmt.roundingCurrency",
1285
- pattern: '"¥"#,##0;[Red]"¥"#,##0'
1286
- },
1287
- "|",
1288
- {
1289
- label: "sheet.numfmt.date",
1290
- pattern: "yyyy-mm-dd;@"
1291
- },
1292
- {
1293
- label: "sheet.numfmt.time",
1294
- pattern: 'am/pm h":"mm":"ss'
1295
- },
1296
- {
1297
- label: "sheet.numfmt.dateTime",
1298
- pattern: "yyyy-m-d am/pm h:mm"
1299
- },
1300
- {
1301
- label: "sheet.numfmt.timeDuration",
1302
- pattern: "h:mm:ss"
1303
- },
1304
- "|",
1305
- {
1306
- label: "sheet.numfmt.moreFmt",
1307
- pattern: ""
1308
- }
1309
- ], MORE_NUMFMT_TYPE_KEY = "sheet.numfmt.moreNumfmtType", OPTIONS_KEY = "sheet.numfmt.moreNumfmtType.options", MoreNumfmtType = /* @__PURE__ */ __name((props) => {
1310
- var _a9;
1311
- const localeService = useDependency(LocaleService), value = (_a9 = props.value) != null ? _a9 : localeService.t("sheet.numfmt.general");
1312
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "more-numfmt-type", children: value });
1313
- }, "MoreNumfmtType"), Options = /* @__PURE__ */ __name(() => {
1314
- const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), layoutService = useDependency(ILayoutService);
1315
- useInjector();
1316
- const selectionManagerService = useDependency(SheetsSelectionsService), setNumfmt = /* @__PURE__ */ __name((pattern) => {
1317
- const selection = selectionManagerService.getCurrentLastSelection();
1318
- if (!selection)
1319
- return;
1320
- const range = selection.range, values = [];
1321
- Range.foreach(range, (row, col) => {
1322
- pattern ? values.push({ row, col, pattern, type: getPatternType(pattern) }) : values.push({ row, col });
1323
- }), commandService.executeCommand(SetNumfmtCommand.id, { values }), layoutService.focus();
1324
- }, "setNumfmt"), handleOnclick = /* @__PURE__ */ __name((index) => {
1325
- if (index === 0)
1326
- setNumfmt(null);
1327
- else if (index === MENU_OPTIONS.length - 1)
1328
- commandService.executeCommand(OpenNumfmtPanelOperator.id);
1329
- else {
1330
- const item = MENU_OPTIONS[index];
1331
- item.pattern && setNumfmt(item.pattern);
1332
- }
1333
- }, "handleOnclick"), defaultValue = 1220;
1334
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "more-numfmt-type-options", children: MENU_OPTIONS.map((item, index) => item === "|" ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "line m-t-4", onClick: /* @__PURE__ */ __name((e) => e.stopPropagation(), "onClick") }, index) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
1335
- "div",
1336
- {
1337
- className: "option-item m-t-4",
1338
- onClick: /* @__PURE__ */ __name(() => {
1339
- handleOnclick(index);
1340
- }, "onClick"),
1341
- children: [
1342
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t(item.label) }),
1343
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-l-26", children: item.pattern ? getPatternPreview(item.pattern || "", defaultValue, localeService.getCurrentLocale()).result : "" })
1344
- ]
1345
- },
1346
- index
1347
- )) });
1348
- }, "Options"), CurrencyMenuItem = /* @__PURE__ */ __name((accessor) => ({
1349
- icon: new Observable((subscribe) => {
1350
- const menuCurrencyService = accessor.get(MenuCurrencyService);
1351
- function getIconKey(symbol2) {
1352
- return {
1353
- [countryCurrencyMap.US]: "DollarSingle",
1354
- [countryCurrencyMap.RU]: "RoubleSingle",
1355
- [countryCurrencyMap.CN]: "RmbSingle",
1356
- [countryCurrencyMap.AT]: "EuroSingle"
1357
- }[symbol2] || "DollarSingle";
1358
- }
1359
- __name(getIconKey, "getIconKey");
1360
- const symbol = countryCurrencyMap[menuCurrencyService.getCurrencySymbol()] || "$";
1361
- return subscribe.next(getIconKey(symbol)), menuCurrencyService.currencySymbol$.subscribe((code) => {
1362
- const symbol2 = countryCurrencyMap[code] || "$";
1363
- subscribe.next(getIconKey(symbol2));
1364
- });
1365
- }),
1366
- id: SetCurrencyCommand.id,
1367
- title: "sheet.numfmt.currency",
1368
- tooltip: "sheet.numfmt.currency",
1369
- type: MenuItemType.BUTTON,
1370
- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1371
- disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission, WorksheetSetCellStylePermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
1372
- }), "CurrencyMenuItem"), AddDecimalMenuItem = /* @__PURE__ */ __name((accessor) => ({
1373
- icon: "AddDigitsSingle",
1374
- id: AddDecimalCommand.id,
1375
- title: "sheet.numfmt.addDecimal",
1376
- tooltip: "sheet.numfmt.addDecimal",
1377
- type: MenuItemType.BUTTON,
1378
- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1379
- disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission, WorksheetSetCellStylePermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
1380
- }), "AddDecimalMenuItem"), SubtractDecimalMenuItem = /* @__PURE__ */ __name((accessor) => ({
1381
- icon: "ReduceDigitsSingle",
1382
- id: SubtractDecimalCommand.id,
1383
- title: "sheet.numfmt.subtractDecimal",
1384
- tooltip: "sheet.numfmt.subtractDecimal",
1385
- type: MenuItemType.BUTTON,
1386
- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1387
- disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission, WorksheetSetCellStylePermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
1388
- }), "SubtractDecimalMenuItem"), PercentMenuItem = /* @__PURE__ */ __name((accessor) => ({
1389
- icon: "PercentSingle",
1390
- id: SetPercentCommand.id,
1391
- title: "sheet.numfmt.percent",
1392
- tooltip: "sheet.numfmt.percent",
1393
- type: MenuItemType.BUTTON,
1394
- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1395
- disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission, WorksheetSetCellStylePermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
1396
- }), "PercentMenuItem"), FactoryOtherMenuItem = /* @__PURE__ */ __name((accessor) => {
1397
- const univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService), localeService = accessor.get(LocaleService), selectionManagerService = accessor.get(SheetsSelectionsService), value$ = deriveStateFromActiveSheet$(univerInstanceService, "", ({ workbook, worksheet }) => new Observable(
1398
- (subscribe) => merge(
1399
- selectionManagerService.selectionMoveEnd$,
1400
- new Observable((commandSubscribe) => {
1401
- const commandList = [RemoveNumfmtMutation.id, SetNumfmtMutation.id], disposable = commandService.onCommandExecuted((commandInfo) => {
1402
- commandList.includes(commandInfo.id) && commandSubscribe.next(null);
1403
- });
1404
- return () => disposable.dispose();
1405
- })
1406
- ).subscribe(() => {
1407
- var _a9, _b;
1408
- const selections = selectionManagerService.getCurrentSelections();
1409
- if (selections && selections[0]) {
1410
- const range = selections[0].range, row = range.startRow, col = range.startColumn, numfmtValue = (_b = workbook.getStyles().get((_a9 = worksheet.getCell(row, col)) == null ? void 0 : _a9.s)) == null ? void 0 : _b.n, pattern = numfmtValue == null ? void 0 : numfmtValue.pattern;
1411
- let value = localeService.t("sheet.numfmt.general");
1412
- if (pattern) {
1413
- const item = MENU_OPTIONS.filter((item2) => typeof item2 == "object" && item2.pattern).find(
1414
- (item2) => isPatternEqualWithoutDecimal(pattern, item2.pattern)
1415
- );
1416
- item && typeof item == "object" && item.pattern ? value = localeService.t(item.label) : value = localeService.t("sheet.numfmt.moreFmt");
1417
- }
1418
- subscribe.next(value);
1419
- }
1420
- })
1421
- ));
1422
- return {
1423
- label: MORE_NUMFMT_TYPE_KEY,
1424
- id: OpenNumfmtPanelOperator.id,
1425
- tooltip: "sheet.numfmt.title",
1426
- type: MenuItemType.SELECTOR,
1427
- selections: [
1428
- {
1429
- label: {
1430
- name: OPTIONS_KEY,
1431
- hoverable: !1
1432
- }
1433
- }
1434
- ],
1435
- value$,
1436
- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1437
- disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetSetCellStylePermission, WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
1438
- };
1439
- }, "FactoryOtherMenuItem"), menuSchema = {
1440
- [RibbonStartGroup.FORMULAS_INSERT]: {
1441
- [SetCurrencyCommand.id]: {
1442
- order: 4,
1443
- menuItemFactory: CurrencyMenuItem
1444
- },
1445
- [AddDecimalCommand.id]: {
1446
- order: 5,
1447
- menuItemFactory: AddDecimalMenuItem
1448
- },
1449
- [SubtractDecimalCommand.id]: {
1450
- order: 6,
1451
- menuItemFactory: SubtractDecimalMenuItem
1452
- },
1453
- [SetPercentCommand.id]: {
1454
- order: 7,
1455
- menuItemFactory: PercentMenuItem
1456
- },
1457
- [OpenNumfmtPanelOperator.id]: {
1458
- order: 8,
1459
- menuItemFactory: FactoryOtherMenuItem
1460
- }
1461
- }
1462
- };
1463
- var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key2, kind) => {
1464
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key2) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1465
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key2, result) : decorator(result)) || result);
1466
- return kind && result && __defProp$2(target, key2, result), result;
1467
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key2) => decorator(target, key2, index), "__decorateParam$2"), _a6;
1468
- let NumfmtMenuController = (_a6 = class extends Disposable {
1469
- constructor(_injector, _componentManager, _menuManagerService) {
1470
- super(), this._injector = _injector, this._componentManager = _componentManager, this._menuManagerService = _menuManagerService, this._initMenu();
1471
- }
1472
- _initMenu() {
1473
- this._menuManagerService.mergeMenu(menuSchema), this.disposeWithMe(this._componentManager.register(MORE_NUMFMT_TYPE_KEY, MoreNumfmtType)), this.disposeWithMe(this._componentManager.register(OPTIONS_KEY, Options));
1474
- }
1475
- }, __name(_a6, "NumfmtMenuController"), _a6);
1476
- NumfmtMenuController = __decorateClass$2([
1477
- OnLifecycle(LifecycleStages.Rendered, NumfmtMenuController),
1478
- __decorateParam$2(0, Inject(Injector)),
1479
- __decorateParam$2(1, Inject(ComponentManager)),
1480
- __decorateParam$2(2, IMenuManagerService)
1481
- ], NumfmtMenuController);
1482
- var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key2, kind) => {
1483
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key2) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1484
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key2, result) : decorator(result)) || result);
1485
- return kind && result && __defProp$1(target, key2, result), result;
1486
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key2) => decorator(target, key2, index), "__decorateParam$1"), _a7;
1487
- let NumfmtCurrencyController = (_a7 = class extends Disposable {
1488
- constructor(_injector) {
1489
- super();
1490
- __publicField(this, "_currencySymbol$", new BehaviorSubject("US"));
1491
- __publicField(this, "currencySymbol$", this._currencySymbol$.asObservable());
1492
- this._injector = _injector;
1493
- }
1494
- /**
1495
- * Set the currency symbol by setting the country code.
1496
- */
1497
- setCurrencySymbolByCountryCode(symbol) {
1498
- this._currencySymbol$.next(symbol);
1499
- }
1500
- getCurrencySymbol() {
1501
- return this._currencySymbol$.getValue();
1502
- }
1503
- }, __name(_a7, "NumfmtCurrencyController"), _a7);
1504
- NumfmtCurrencyController = __decorateClass$1([
1505
- OnLifecycle(LifecycleStages.Rendered, NumfmtCurrencyController),
1506
- __decorateParam$1(0, Inject(Injector))
1507
- ], NumfmtCurrencyController);
1508
- const PLUGIN_CONFIG_KEY = "sheets-numfmt.config", defaultPluginConfig = {};
1509
- var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key2, value) => key2 in obj ? __defProp2(obj, key2, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key2] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key2, kind) => {
1510
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key2) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1511
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key2, result) : decorator(result)) || result);
1512
- return kind && result && __defProp2(target, key2, result), result;
1513
- }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key2) => decorator(target, key2, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key2, value) => __defNormalProp2(obj, typeof key2 != "symbol" ? key2 + "" : key2, value), "__publicField"), _a8;
1514
- let UniverSheetsNumfmtPlugin = (_a8 = class extends Plugin {
1515
- constructor(_config = defaultPluginConfig, _injector, _configService) {
1516
- super(), this._config = _config, this._injector = _injector, this._configService = _configService;
1517
- const { menu, ...rest } = this._config;
1518
- menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
1519
- }
1520
- onStarting() {
1521
- this._injector.add([INumfmtController, { useClass: NumfmtController, lazy: !1 }]), this._injector.add([NumfmtEditorController]), this._injector.add([UserHabitController]), this._injector.add([SheetsNumfmtCellContentController]), this._injector.add([NumfmtI18nController]), this._injector.add([MenuCurrencyService]), this._injector.add([NumfmtCurrencyController]), this._injector.add([NumfmtMenuController]);
1522
- }
1523
- }, __name(_a8, "UniverSheetsNumfmtPlugin"), _a8);
1524
- __publicField2(UniverSheetsNumfmtPlugin, "pluginName", SHEET_NUMFMT_PLUGIN);
1525
- __publicField2(UniverSheetsNumfmtPlugin, "type", UniverInstanceType.UNIVER_SHEET);
1526
- UniverSheetsNumfmtPlugin = __decorateClass([
1527
- DependentOn(UniverSheetsPlugin, UniverSheetsUIPlugin),
1528
- __decorateParam(1, Inject(Injector)),
1529
- __decorateParam(2, IConfigService)
1530
- ], UniverSheetsNumfmtPlugin);
1531
- export {
1532
- AddDecimalCommand,
1533
- CloseNumfmtPanelOperator,
1534
- MenuCurrencyService,
1535
- OpenNumfmtPanelOperator,
1536
- SetCurrencyCommand,
1537
- SetNumfmtCommand,
1538
- SetPercentCommand,
1539
- SubtractDecimalCommand,
1540
- UniverSheetsNumfmtPlugin,
1541
- countryCurrencyMap,
1542
- getPatternPreview,
1543
- getPatternType
1544
- };
1
+ const _0x186784=_0x5013;(function(_0x54f9af,_0x21e6ac){const _0x49d33a=_0x5013,_0x5cbfac=_0x54f9af();while(!![]){try{const _0x170ac6=-parseInt(_0x49d33a(0x1a7))/0x1+-parseInt(_0x49d33a(0x2c5))/0x2*(-parseInt(_0x49d33a(0x298))/0x3)+-parseInt(_0x49d33a(0x255))/0x4+-parseInt(_0x49d33a(0x24f))/0x5*(-parseInt(_0x49d33a(0x225))/0x6)+parseInt(_0x49d33a(0x1b2))/0x7+-parseInt(_0x49d33a(0x27b))/0x8*(parseInt(_0x49d33a(0x1ef))/0x9)+-parseInt(_0x49d33a(0x20a))/0xa;if(_0x170ac6===_0x21e6ac)break;else _0x5cbfac['push'](_0x5cbfac['shift']());}catch(_0xf77d9a){_0x5cbfac['push'](_0x5cbfac['shift']());}}}(_0x54b4,0x2f37b));var __defProp=Object[_0x186784(0x257)],__defNormalProp=(_0x8be1b1,_0x57c772,_0x3bd159)=>_0x57c772 in _0x8be1b1?__defProp(_0x8be1b1,_0x57c772,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x3bd159}):_0x8be1b1[_0x57c772]=_0x3bd159,__name=(_0x19501c,_0x262485)=>__defProp(_0x19501c,_0x186784(0x29e),{'value':_0x262485,'configurable':!0x0}),__publicField=(_0x17afe8,_0x188a75,_0x1a2506)=>__defNormalProp(_0x17afe8,typeof _0x188a75!='symbol'?_0x188a75+'':_0x188a75,_0x1a2506);import{numfmt,LocaleType,Inject,ThemeService,ICommandService,LocaleService,IUniverInstanceService,Disposable,ObjectMatrix,InterceptorEffectEnum,CellValueType,Range,UniverInstanceType,CommandType,IUndoRedoService,sequenceExecute,createIdentifier,ILocalStorageService,useDependency,toDisposable,DisposableCollection,Injector,Optional,useInjector,DependentOn,Plugin,IConfigService}from'@univerjs/core';import{SheetInterceptorService,INumfmtService,INTERCEPTOR_POINT,InterceptCellContentPriority,SetNumfmtMutation,SetRangeValuesMutation,getSheetCommandTarget,transformCellsToRange,rangeMerge,factorySetNumfmtUndoMutation,RemoveNumfmtMutation,factoryRemoveNumfmtUndoMutation,SheetsSelectionsService,SetRangeValuesCommand,WorkbookEditablePermission,WorksheetEditPermission,WorksheetSetCellStylePermission,RangeProtectionPermissionEditPoint,UniverSheetsPlugin}from'@univerjs/sheets';import{SheetSkeletonManagerService,IEditorBridgeService,getCurrentRangeDisable$,deriveStateFromActiveSheet$,UniverSheetsUIPlugin}from'@univerjs/sheets-ui';import{switchMap,of,skip,BehaviorSubject,Observable,combineLatest,merge}from'rxjs';import{IRenderManagerService}from'@univerjs/engine-render';import{ComponentManager,ISidebarService,ILayoutService,MenuItemType,getMenuHiddenObservable,RibbonStartGroup,IMenuManagerService}from'@univerjs/ui';import{map,switchMap as _0x7a9c40,tap,debounceTime}from'rxjs/operators';import _0x147f91,{createContext,useState,useEffect,useRef,useContext,useMemo,forwardRef,createElement}from'react';import{InputNumber,Select,SelectList,Input,Button}from'@univerjs/design';import{DEFAULT_TEXT_FORMAT}from'@univerjs/engine-numfmt';const currencySymbols=['$','£','¥','¤','֏','؋','৳','฿','₡','₦','₩','₪','₫','€','₭','₮','₱','₲','₴','₸','₹','₺','₼','₽','₾','₿'],countryCurrencyMap={'US':'$','CA':'C$','GB':'£','JP':'¥','IN':'₹','AU':'A$','CN':'¥','KR':'₩','RU':'₽','AT':'€','BE':'€','CY':'€','EE':'€','FI':'€','FR':'€','DE':'€','GR':'€','IE':'€','IT':'€','LV':'€','LT':'€','LU':'€','MT':'€','NL':'€','PT':'€','SK':'€','SI':'€','ES':'€'},SHEET_NUMFMT_PLUGIN='SHEET_NUMFMT_PLUGIN',PLUGIN_CONFIG_KEY=_0x186784(0x1ed),defaultPluginConfig={},getPatternType=__name(_0x508a5a=>numfmt[_0x186784(0x238)](_0x508a5a)[_0x186784(0x2e2)]||_0x186784(0x237),_0x186784(0x288)),getPatternPreview=__name((_0x3dce67,_0x6fe133,_0x4e5427)=>{const _0x1d7316=_0x186784,_0x5e7065=numfmt[_0x1d7316(0x238)](_0x3dce67),_0x50cb36=_0x4e5427===LocaleType[_0x1d7316(0x230)]?_0x1d7316(0x286):'en',_0x58d560=_0x5e7065[_0x1d7316(0x24c)][0x1],_0x4273c9=numfmt[_0x1d7316(0x1be)](_0x3dce67,_0x6fe133,{'locale':_0x50cb36,'throws':!0x1});return _0x6fe133<0x0?{'result':_0x4273c9,'color':_0x58d560['color']}:{'result':_0x4273c9};},_0x186784(0x2c0)),getPatternPreviewIgnoreGeneral=__name((_0x56b71d,_0x2c4bd9,_0x3d95ea)=>_0x56b71d===_0x186784(0x2c1)?{'result':String(_0x2c4bd9)}:getPatternPreview(_0x56b71d,_0x2c4bd9,_0x3d95ea),_0x186784(0x235));var __defProp$5=Object[_0x186784(0x257)],__getOwnPropDesc$5=Object['getOwnPropertyDescriptor'],__decorateClass$5=__name((_0x4c0dc0,_0x35a7f1,_0x491191,_0x27688a)=>{const _0x4de74e=_0x186784;for(var _0x103691=_0x27688a>0x1?void 0x0:_0x27688a?__getOwnPropDesc$5(_0x35a7f1,_0x491191):_0x35a7f1,_0x474414=_0x4c0dc0[_0x4de74e(0x2d7)]-0x1,_0x102259;_0x474414>=0x0;_0x474414--)(_0x102259=_0x4c0dc0[_0x474414])&&(_0x103691=(_0x27688a?_0x102259(_0x35a7f1,_0x491191,_0x103691):_0x102259(_0x103691))||_0x103691);return _0x27688a&&_0x103691&&__defProp$5(_0x35a7f1,_0x491191,_0x103691),_0x103691;},_0x186784(0x200)),__decorateParam$5=__name((_0x2f578d,_0x148873)=>(_0x52b8b2,_0x3d11bf)=>_0x148873(_0x52b8b2,_0x3d11bf,_0x2f578d),'__decorateParam$5'),_a;let SheetsNumfmtCellContentController=(_a=class extends Disposable{constructor(_0x474757,_0x42a386,_0x1b1399,_0x592aa1,_0x3b4335,_0x5d2ddb){const _0x75c774=_0x186784;super(),this[_0x75c774(0x1a9)]=_0x474757,this[_0x75c774(0x21c)]=_0x42a386,this[_0x75c774(0x1fa)]=_0x1b1399,this[_0x75c774(0x24d)]=_0x592aa1,this[_0x75c774(0x22c)]=_0x3b4335,this[_0x75c774(0x2a8)]=_0x5d2ddb,this[_0x75c774(0x26e)]();}[_0x186784(0x26e)](){const _0x56ffeb=_0x186784,_0x519374=new ObjectMatrix();this[_0x56ffeb(0x1a3)](this['_sheetInterceptorService'][_0x56ffeb(0x2de)](INTERCEPTOR_POINT['CELL_CONTENT'],{'effect':InterceptorEffectEnum[_0x56ffeb(0x2aa)]|InterceptorEffectEnum[_0x56ffeb(0x1a8)],'handler':__name((_0x2bf686,_0x21c18d,_0x4a6196)=>{const _0x40f8f8=_0x56ffeb,_0x470493=_0x21c18d['unitId'],_0x27b171=_0x21c18d[_0x40f8f8(0x269)];let _0x1e3eab;const _0x580bab=_0x2bf686;if(!_0x580bab||_0x580bab['t']!==CellValueType['NUMBER']||_0x580bab['v']==null||Number[_0x40f8f8(0x227)](_0x580bab['v']))return _0x4a6196(_0x2bf686);if(_0x2bf686!=null&&_0x2bf686['s']){const _0x1bfea4=_0x21c18d[_0x40f8f8(0x263)][_0x40f8f8(0x1bd)]()[_0x40f8f8(0x2ff)](_0x2bf686['s']);_0x1bfea4!=null&&_0x1bfea4['n']&&(_0x1e3eab=_0x1bfea4['n']);}if(_0x1e3eab||(_0x1e3eab=this[_0x40f8f8(0x22c)][_0x40f8f8(0x301)](_0x470493,_0x27b171,_0x21c18d[_0x40f8f8(0x1d5)],_0x21c18d[_0x40f8f8(0x32d)])),!_0x1e3eab)return _0x4a6196(_0x2bf686);let _0x4e1143='';const _0x90b3c4=_0x519374['getValue'](_0x21c18d[_0x40f8f8(0x1d5)],_0x21c18d[_0x40f8f8(0x32d)]);if(_0x90b3c4&&_0x90b3c4[_0x40f8f8(0x307)]===_0x580bab['v']+'_'+_0x1e3eab[_0x40f8f8(0x26f)])return _0x4a6196({..._0x2bf686,..._0x90b3c4['result']});const _0xace5dc=getPatternPreviewIgnoreGeneral(_0x1e3eab[_0x40f8f8(0x26f)],Number(_0x580bab['v']),this[_0x40f8f8(0x2a8)][_0x40f8f8(0x2d4)]());if(_0x4e1143=_0xace5dc['result'],!_0x4e1143)return _0x4a6196(_0x2bf686);const _0x409637={'v':_0x4e1143};if(_0xace5dc[_0x40f8f8(0x1de)]){const _0x125460=this[_0x40f8f8(0x1fa)][_0x40f8f8(0x2a5)]()[_0xace5dc[_0x40f8f8(0x1de)]+_0x40f8f8(0x1b3)];_0x125460&&(_0x409637['interceptorStyle']={'cl':{'rgb':_0x125460}});}return _0x519374[_0x40f8f8(0x31e)](_0x21c18d[_0x40f8f8(0x1d5)],_0x21c18d[_0x40f8f8(0x32d)],{'result':_0x409637,'parameters':_0x580bab['v']+'_'+_0x1e3eab[_0x40f8f8(0x26f)]}),_0x4a6196({..._0x2bf686,..._0x409637});},_0x56ffeb(0x2e3)),'priority':InterceptCellContentPriority[_0x56ffeb(0x312)]})),this[_0x56ffeb(0x1a3)](this[_0x56ffeb(0x24d)][_0x56ffeb(0x1b9)](_0x24ee54=>{const _0x2691a4=_0x56ffeb;if(_0x24ee54['id']===SetNumfmtMutation['id']){const _0x337292=_0x24ee54[_0x2691a4(0x249)];Object['keys'](_0x337292[_0x2691a4(0x29d)])[_0x2691a4(0x324)](_0x263376=>{const _0x12a64d=_0x2691a4;_0x337292[_0x12a64d(0x29d)][_0x263376][_0x12a64d(0x2c4)][_0x12a64d(0x324)](_0x30f215=>{const _0x39f9ab=_0x12a64d;Range[_0x39f9ab(0x1c1)](_0x30f215,(_0x369225,_0x4507a9)=>{const _0x27edd2=_0x39f9ab;_0x519374[_0x27edd2(0x1ba)](_0x369225,_0x4507a9);});});});}else{if(_0x24ee54['id']===SetRangeValuesMutation['id']){const _0x73bb9a=_0x24ee54['params'];new ObjectMatrix(_0x73bb9a[_0x2691a4(0x233)])[_0x2691a4(0x2a1)]((_0x39ad95,_0x27831f)=>{const _0x30b63f=_0x2691a4;_0x519374[_0x30b63f(0x1ba)](_0x39ad95,_0x27831f);});}}})),this[_0x56ffeb(0x1a3)](this[_0x56ffeb(0x1a9)][_0x56ffeb(0x2d1)](UniverInstanceType[_0x56ffeb(0x1b5)])[_0x56ffeb(0x1c9)](switchMap(_0x285bf4=>{const _0x9534ed=_0x56ffeb;var _0x3c2995;return(_0x3c2995=_0x285bf4==null?void 0x0:_0x285bf4[_0x9534ed(0x2ba)])!=null?_0x3c2995:of(null);}),skip(0x1))['subscribe'](()=>_0x519374[_0x56ffeb(0x1f3)]()));}},__name(_a,_0x186784(0x1bf)),_a);SheetsNumfmtCellContentController=__decorateClass$5([__decorateParam$5(0x0,IUniverInstanceService),__decorateParam$5(0x1,Inject(SheetInterceptorService)),__decorateParam$5(0x2,Inject(ThemeService)),__decorateParam$5(0x3,Inject(ICommandService)),__decorateParam$5(0x4,Inject(INumfmtService)),__decorateParam$5(0x5,Inject(LocaleService))],SheetsNumfmtCellContentController);const getDecimalFromPattern=__name((_0x521d1f,_0x1f2a93=0x0)=>{const _0x10306d=_0x186784;var _0x3f6459;return _0x521d1f&&(_0x3f6459=numfmt[_0x10306d(0x238)](_0x521d1f)['maxDecimals'])!=null?_0x3f6459:_0x1f2a93;},_0x186784(0x22e)),isPatternEqualWithoutDecimal=__name((_0x578614,_0x57c6b9)=>{const _0x1bf39a=_0x186784;if(_0x578614&&!_0x57c6b9||!_0x578614&&_0x57c6b9)return!0x1;const _0x2279bc=__name(_0x4ecf01=>_0x4ecf01[_0x1bf39a(0x2a0)]((_0xcb8c7a,_0x11736f)=>{const _0x34ef4a=_0x1bf39a;if(_0xcb8c7a['isEnd'])return _0xcb8c7a;const _0x17a5b7=_0x11736f[_0x34ef4a(0x32b)]||_0x11736f[_0x34ef4a(0x1e4)];return _0x11736f[_0x34ef4a(0x2e2)]===_0x34ef4a(0x262)?(_0xcb8c7a[_0x34ef4a(0x2ee)]=!0x0,_0xcb8c7a):{..._0xcb8c7a,'result':_0xcb8c7a[_0x34ef4a(0x1f7)]+_0x17a5b7};},{'isEnd':!0x1,'result':''})[_0x1bf39a(0x1f7)],'getString'),_0x40765f=numfmt[_0x1bf39a(0x238)](_0x578614)[_0x1bf39a(0x24c)],_0x53bcc8=numfmt[_0x1bf39a(0x238)](_0x57c6b9)[_0x1bf39a(0x24c)],_0x29ba34=_0x2279bc(_0x40765f[0x0]['tokens']),_0x4ee3c6=_0x2279bc(_0x53bcc8[0x0][_0x1bf39a(0x1cf)]),_0x1ccea0=_0x2279bc(_0x40765f[0x1][_0x1bf39a(0x1cf)]),_0x4adcbf=_0x2279bc(_0x53bcc8[0x1][_0x1bf39a(0x1cf)]);return _0x29ba34===_0x4ee3c6&&_0x1ccea0===_0x4adcbf&&_0x40765f[0x1][_0x1bf39a(0x1de)]===_0x53bcc8[0x1][_0x1bf39a(0x1de)];},_0x186784(0x216)),getDecimalString=__name(_0x416584=>new Array(Math[_0x186784(0x1db)](Math[_0x186784(0x279)](0x0,Number(_0x416584)),0x1e))['fill'](0x0)[_0x186784(0x1aa)](''),'getDecimalString'),setPatternDecimal=__name((_0x3925ec,_0x56aab1)=>_0x3925ec[_0x186784(0x28a)](';')[_0x186784(0x25b)](_0x1b41be=>/\.0?/[_0x186784(0x1cd)](_0x1b41be)?_0x1b41be[_0x186784(0x276)](/\.0*/g,''+(_0x56aab1>0x0?'.':'')+getDecimalString(Number(_0x56aab1||0x0))):/0([^0]?)|0$/[_0x186784(0x1cd)](_0x1b41be)?_0x1b41be[_0x186784(0x276)](/0([^0]+)|0$/,'0'+(_0x56aab1>0x0?'.':'')+getDecimalString(Number(_0x56aab1||0x0))+'$1'):_0x1b41be)['join'](';'),_0x186784(0x2af)),isPatternHasDecimal=__name(_0x74c3d3=>/\.0?/['test'](_0x74c3d3)||/0([^0]?)|0$/[_0x186784(0x1cd)](_0x74c3d3),_0x186784(0x236)),SetNumfmtCommand={'id':'sheet.command.numfmt.set.numfmt','type':CommandType[_0x186784(0x30c)],'handler':__name((_0x2dbb94,_0x3e65f6)=>{const _0x2f28ca=_0x186784;if(!_0x3e65f6)return!0x1;const _0x5de264=_0x2dbb94['get'](ICommandService),_0x34b846=_0x2dbb94[_0x2f28ca(0x2ff)](IUniverInstanceService),_0x5d68e9=_0x2dbb94[_0x2f28ca(0x2ff)](IUndoRedoService),_0x2782f9=getSheetCommandTarget(_0x34b846,_0x3e65f6);if(!_0x2782f9)return!0x1;const {unitId:_0x44a088,subUnitId:_0x5b3e34}=_0x2782f9,_0x448b40=_0x3e65f6[_0x2f28ca(0x29d)][_0x2f28ca(0x317)](_0x4114fb=>!!_0x4114fb[_0x2f28ca(0x26f)]),_0x180ca7=_0x3e65f6['values'][_0x2f28ca(0x317)](_0x2a7699=>!_0x2a7699[_0x2f28ca(0x26f)]),_0x136e2b=transformCellsToRange(_0x44a088,_0x5b3e34,_0x448b40),_0x1af79b={'unitId':_0x44a088,'subUnitId':_0x5b3e34,'ranges':_0x180ca7[_0x2f28ca(0x25b)](_0x9252dc=>({'startColumn':_0x9252dc[_0x2f28ca(0x32d)],'startRow':_0x9252dc['row'],'endColumn':_0x9252dc[_0x2f28ca(0x32d)],'endRow':_0x9252dc[_0x2f28ca(0x1d5)]}))},_0x3132b6=[],_0x32f591=[];if(_0x448b40[_0x2f28ca(0x2d7)]){Object[_0x2f28ca(0x19d)](_0x136e2b[_0x2f28ca(0x29d)])[_0x2f28ca(0x324)](_0x42efa9=>{const _0x3e28a5=_0x2f28ca,_0x257d23=_0x136e2b['values'][_0x42efa9];_0x257d23['ranges']=rangeMerge(_0x257d23[_0x3e28a5(0x2c4)]);}),_0x3132b6[_0x2f28ca(0x1f0)]({'id':SetNumfmtMutation['id'],'params':_0x136e2b});const _0x2959b3=factorySetNumfmtUndoMutation(_0x2dbb94,_0x136e2b);_0x32f591[_0x2f28ca(0x1f0)](..._0x2959b3);}if(_0x180ca7[_0x2f28ca(0x2d7)]){_0x1af79b['ranges']=rangeMerge(_0x1af79b[_0x2f28ca(0x2c4)]),_0x3132b6['push']({'id':RemoveNumfmtMutation['id'],'params':_0x1af79b});const _0x533416=factoryRemoveNumfmtUndoMutation(_0x2dbb94,_0x1af79b);_0x32f591['push'](..._0x533416);}const _0x54f80c=sequenceExecute(_0x3132b6,_0x5de264)[_0x2f28ca(0x1f7)];return _0x54f80c&&_0x5d68e9['pushUndoRedo']({'unitID':_0x44a088,'undoMutations':_0x32f591,'redoMutations':_0x3132b6}),_0x54f80c;},_0x186784(0x2e3))},AddDecimalCommand={'id':_0x186784(0x32f),'type':CommandType[_0x186784(0x30c)],'handler':__name(async _0x1c2a3f=>{const _0x1e70bf=_0x186784,_0x2e6313=_0x1c2a3f[_0x1e70bf(0x2ff)](ICommandService),_0x3ac539=_0x1c2a3f['get'](SheetsSelectionsService),_0x3be9f5=_0x1c2a3f['get'](INumfmtService),_0x59209c=_0x1c2a3f['get'](IUniverInstanceService),_0x534e5a=_0x3ac539[_0x1e70bf(0x1c0)]();if(!_0x534e5a||!_0x534e5a[_0x1e70bf(0x2d7)])return!0x1;const _0x300ab9=getSheetCommandTarget(_0x59209c);if(!_0x300ab9)return!0x1;const {unitId:_0x32ea2b,subUnitId:_0x34a243}=_0x300ab9;let _0x1a3d8f=0x0;_0x534e5a[_0x1e70bf(0x324)](_0x57f019=>{const _0x2e471d=_0x1e70bf;Range[_0x2e471d(0x1c1)](_0x57f019[_0x2e471d(0x320)],(_0x24a73f,_0x2f7ea1)=>{const _0x3f3793=_0x2e471d,_0x83961c=_0x3be9f5[_0x3f3793(0x301)](_0x32ea2b,_0x34a243,_0x24a73f,_0x2f7ea1);if(!_0x83961c){const _0x3ce303=_0x300ab9[_0x3f3793(0x234)]['getCellRaw'](_0x24a73f,_0x2f7ea1);if(!_0x1a3d8f&&_0x3ce303&&_0x3ce303['t']===CellValueType[_0x3f3793(0x19c)]&&_0x3ce303['v']){const _0x1eda2e=/\.(\d*)$/['exec'](String(_0x3ce303['v']));if(_0x1eda2e){const _0x9c82fc=_0x1eda2e[0x1][_0x3f3793(0x2d7)];if(!_0x9c82fc)return;_0x1a3d8f=Math[_0x3f3793(0x279)](_0x1a3d8f,_0x9c82fc);}}return;}const _0x509081=getDecimalFromPattern(_0x83961c[_0x3f3793(0x26f)]);_0x1a3d8f=_0x509081>_0x1a3d8f?_0x509081:_0x1a3d8f;});});const _0x4b9bfc=_0x1a3d8f+0x1,_0x322e5a=setPatternDecimal('0'+(_0x4b9bfc>0x0?'.0':''),_0x4b9bfc),_0x7aa461=[];return _0x534e5a['forEach'](_0x8ebe6e=>{const _0x4ba813=_0x1e70bf;Range[_0x4ba813(0x1c1)](_0x8ebe6e[_0x4ba813(0x320)],(_0x131c56,_0x458eaf)=>{const _0x2cafd9=_0x4ba813,_0x58601e=_0x3be9f5['getValue'](_0x32ea2b,_0x34a243,_0x131c56,_0x458eaf);if(!_0x58601e)_0x7aa461[_0x2cafd9(0x1f0)]({'row':_0x131c56,'col':_0x458eaf,'pattern':_0x322e5a});else{const _0x1ae339=getDecimalFromPattern(_0x58601e[_0x2cafd9(0x26f)]),_0x587052=setPatternDecimal(_0x58601e[_0x2cafd9(0x26f)],_0x1ae339+0x1);_0x587052!==_0x58601e['pattern']&&_0x7aa461[_0x2cafd9(0x1f0)]({'row':_0x131c56,'col':_0x458eaf,'pattern':_0x587052});}});}),_0x7aa461[_0x1e70bf(0x2d7)]?await _0x2e6313[_0x1e70bf(0x23a)](SetNumfmtCommand['id'],{'values':_0x7aa461}):!0x1;},_0x186784(0x2e3))},DATEFMTLISG=[{'label':_0x186784(0x28b),'suffix':_0x186784(0x203)},{'label':_0x186784(0x26d),'suffix':_0x186784(0x2b4)},{'label':_0x186784(0x20f),'suffix':_0x186784(0x197)},{'label':_0x186784(0x1f6),'suffix':'MM-dd'},{'label':_0x186784(0x1c4),'suffix':_0x186784(0x2d9)},{'label':_0x186784(0x1e8),'suffix':_0x186784(0x245)},{'label':'13:30','suffix':_0x186784(0x1df)},{'label':_0x186784(0x2a9),'suffix':_0x186784(0x259)},{'label':_0x186784(0x26c),'suffix':_0x186784(0x260)},{'label':_0x186784(0x271),'suffix':_0x186784(0x304)},{'label':'08-05\x20下午\x2001:30','suffix':'MM-dd\x20A/P\x20hh:mm'}],NUMBERFORMAT=[{'label':_0x186784(0x28e),'suffix':_0x186784(0x1bb)},{'label':_0x186784(0x2e4),'suffix':'#,##0_);[Red](#,##0)','color':_0x186784(0x27c)},{'label':'1,234.56','suffix':_0x186784(0x253)},{'label':'1,234.56','suffix':_0x186784(0x1d1),'color':_0x186784(0x27c)},{'label':_0x186784(0x1af),'suffix':_0x186784(0x32e)},{'label':_0x186784(0x1af),'suffix':_0x186784(0x1e2),'color':'red'}],CURRENCYFORMAT=[{'label':__name(_0x347fa0=>_0x347fa0+_0x186784(0x2bb),_0x186784(0x211)),'suffix':__name(_0x17ddae=>'\x22'+_0x17ddae+_0x186784(0x261)+_0x17ddae+_0x186784(0x1e3),_0x186784(0x1e1))},{'label':__name(_0x3f612a=>_0x3f612a+_0x186784(0x2bb),_0x186784(0x211)),'suffix':__name(_0x115537=>'\x22'+_0x115537+_0x186784(0x195)+_0x115537+_0x186784(0x1e3),_0x186784(0x1e1)),'color':'red'},{'label':__name(_0xb69ee2=>'('+_0xb69ee2+_0x186784(0x22d),_0x186784(0x211)),'suffix':__name(_0x2584fb=>'\x22'+_0x2584fb+_0x186784(0x27d)+_0x2584fb+_0x186784(0x19e),_0x186784(0x1e1))},{'label':__name(_0x5f5304=>'('+_0x5f5304+'1,235)',_0x186784(0x211)),'suffix':__name(_0xf038db=>'\x22'+_0xf038db+_0x186784(0x29c)+_0xf038db+'\x22#,##0.00)',_0x186784(0x1e1)),'color':_0x186784(0x27c)},{'label':__name(_0x1d7718=>'-'+_0x1d7718+'1,235',_0x186784(0x211)),'suffix':__name(_0x13e539=>'\x22'+_0x13e539+_0x186784(0x232)+_0x13e539+'\x22#,##0.00',_0x186784(0x1e1))},{'label':__name(_0x169e2d=>'-'+_0x169e2d+_0x186784(0x2bb),_0x186784(0x211)),'suffix':__name(_0x2853a5=>'\x22'+_0x2853a5+_0x186784(0x26b)+_0x2853a5+_0x186784(0x1e3),_0x186784(0x1e1)),'color':_0x186784(0x27c)}],_MenuCurrencyService=class _MenuCurrencyService{constructor(){const _0xb72793=_0x186784;__publicField(this,_0xb72793(0x327),new BehaviorSubject('US')),__publicField(this,_0xb72793(0x242),this[_0xb72793(0x327)][_0xb72793(0x25a)]());}['setCurrencySymbolByCountryCode'](_0x1a94df){const _0x531d4a=_0x186784;this[_0x531d4a(0x327)][_0x531d4a(0x1a4)](_0x1a94df);}['getCurrencySymbol'](){const _0x55fce5=_0x186784;return this[_0x55fce5(0x327)][_0x55fce5(0x301)]();}};__name(_MenuCurrencyService,_0x186784(0x30a));let MenuCurrencyService=_MenuCurrencyService;function _0x5013(_0x5abfc1,_0x180c50){const _0x54b445=_0x54b4();return _0x5013=function(_0x501341,_0x1f79be){_0x501341=_0x501341-0x195;let _0x2004c9=_0x54b445[_0x501341];return _0x2004c9;},_0x5013(_0x5abfc1,_0x180c50);}const SetCurrencyCommand={'id':_0x186784(0x239),'type':CommandType[_0x186784(0x30c)],'handler':__name(async _0x550079=>{const _0x14e468=_0x186784,_0x123257=_0x550079[_0x14e468(0x2ff)](ICommandService),_0x56008c=_0x550079[_0x14e468(0x2ff)](SheetsSelectionsService),_0x49612b=_0x550079['get'](MenuCurrencyService),_0x8a634a=countryCurrencyMap[_0x49612b[_0x14e468(0x2a3)]()]||'$',_0xc280d6=_0x56008c[_0x14e468(0x1c0)]();if(!_0xc280d6||!_0xc280d6['length'])return!0x1;const _0x20e666=[],_0xe97f4a=CURRENCYFORMAT[0x4][_0x14e468(0x1e1)](_0x8a634a);return _0xc280d6['forEach'](_0x5d0340=>{const _0x1b3896=_0x14e468;Range['foreach'](_0x5d0340[_0x1b3896(0x320)],(_0x1af7ff,_0x1a921d)=>{const _0x3559c8=_0x1b3896;_0x20e666[_0x3559c8(0x1f0)]({'row':_0x1af7ff,'col':_0x1a921d,'pattern':_0xe97f4a,'type':'currency'});});}),await _0x123257[_0x14e468(0x23a)](SetNumfmtCommand['id'],{'values':_0x20e666});},_0x186784(0x2e3))},SetPercentCommand={'id':'sheet.command.numfmt.set.percent','type':CommandType[_0x186784(0x30c)],'handler':__name(async _0xc5220f=>{const _0x38ebea=_0x186784,_0x45ea2b=_0xc5220f[_0x38ebea(0x2ff)](ICommandService),_0x5bec96=_0xc5220f['get'](SheetsSelectionsService)[_0x38ebea(0x1c0)]();if(!_0x5bec96||!_0x5bec96[_0x38ebea(0x2d7)])return!0x1;const _0x4b7c09=[],_0x191a72='0%';return _0x5bec96[_0x38ebea(0x324)](_0x56aa31=>{const _0x47b30a=_0x38ebea;Range[_0x47b30a(0x1c1)](_0x56aa31[_0x47b30a(0x320)],(_0x2ed67c,_0x58018e)=>{const _0x36bfc0=_0x47b30a;_0x4b7c09[_0x36bfc0(0x1f0)]({'row':_0x2ed67c,'col':_0x58018e,'pattern':_0x191a72,'type':_0x36bfc0(0x278)});});}),await _0x45ea2b['executeCommand'](SetNumfmtCommand['id'],{'values':_0x4b7c09});},_0x186784(0x2e3))},SubtractDecimalCommand={'id':_0x186784(0x1ad),'type':CommandType[_0x186784(0x30c)],'handler':__name(async _0x2cd86f=>{const _0xb836c7=_0x186784,_0x4cd23b=_0x2cd86f[_0xb836c7(0x2ff)](ICommandService),_0x5e268f=_0x2cd86f[_0xb836c7(0x2ff)](SheetsSelectionsService),_0x36faaa=_0x2cd86f['get'](INumfmtService),_0x3e4de1=_0x2cd86f['get'](IUniverInstanceService),_0x53a867=_0x5e268f[_0xb836c7(0x1c0)]();if(!_0x53a867||!_0x53a867[_0xb836c7(0x2d7)])return!0x1;const _0x3c3284=getSheetCommandTarget(_0x3e4de1);if(!_0x3c3284)return!0x1;const {unitId:_0x4d43e9,subUnitId:_0x11cec0}=_0x3c3284;let _0x4cd26b=0x0;_0x53a867[_0xb836c7(0x324)](_0x3d9d66=>{const _0x458397=_0xb836c7;Range[_0x458397(0x1c1)](_0x3d9d66['range'],(_0x117366,_0x3e4769)=>{const _0x3d005d=_0x458397,_0x28d34d=_0x36faaa[_0x3d005d(0x301)](_0x4d43e9,_0x11cec0,_0x117366,_0x3e4769);if(!_0x28d34d){const _0x45003a=_0x3c3284['worksheet']['getCellRaw'](_0x117366,_0x3e4769);if(!_0x4cd26b&&_0x45003a&&_0x45003a['t']===CellValueType[_0x3d005d(0x19c)]&&_0x45003a['v']){const _0x4ba914=/\.(\d*)$/['exec'](String(_0x45003a['v']));if(_0x4ba914){const _0x2edcd1=_0x4ba914[0x1][_0x3d005d(0x2d7)];if(!_0x2edcd1)return;_0x4cd26b=Math[_0x3d005d(0x279)](_0x4cd26b,_0x2edcd1);}}return;}const _0x4f7c06=getDecimalFromPattern(_0x28d34d[_0x3d005d(0x26f)]);_0x4cd26b=_0x4f7c06>_0x4cd26b?_0x4f7c06:_0x4cd26b;});});const _0x4e7eed=_0x4cd26b-0x1,_0x19335b=setPatternDecimal('0'+(_0x4e7eed>0x0?'.0':'.'),_0x4e7eed),_0x2ffe7c=[];return _0x53a867[_0xb836c7(0x324)](_0x3f1355=>{const _0x52612a=_0xb836c7;Range['foreach'](_0x3f1355[_0x52612a(0x320)],(_0x4475c2,_0x5edf82)=>{const _0x1772a5=_0x52612a,_0x54fdd3=_0x36faaa[_0x1772a5(0x301)](_0x4d43e9,_0x11cec0,_0x4475c2,_0x5edf82);if(!_0x54fdd3)_0x2ffe7c[_0x1772a5(0x1f0)]({'row':_0x4475c2,'col':_0x5edf82,'pattern':_0x19335b});else{const _0x45ca68=getDecimalFromPattern(_0x54fdd3[_0x1772a5(0x26f)]);_0x2ffe7c[_0x1772a5(0x1f0)]({'row':_0x4475c2,'col':_0x5edf82,'pattern':setPatternDecimal(_0x54fdd3['pattern'],_0x45ca68-0x1)});}});}),await _0x4cd23b['executeCommand'](SetNumfmtCommand['id'],{'values':_0x2ffe7c});},_0x186784(0x2e3))},CloseNumfmtPanelOperator={'id':_0x186784(0x2f2),'type':CommandType['OPERATION'],'handler':__name(()=>!0x0,_0x186784(0x2e3))},INumfmtController=createIdentifier(_0x186784(0x2fb)),OpenNumfmtPanelOperator={'id':'sheet.operation.open.numfmt.panel','type':CommandType[_0x186784(0x1f5)],'handler':__name(_0x2859f6=>(_0x2859f6[_0x186784(0x2ff)](INumfmtController)['openPanel'](),!0x0),_0x186784(0x2e3))};var jsxRuntime={'exports':{}},reactJsxRuntime_production_min={},f=_0x147f91,k=Symbol['for'](_0x186784(0x2b0)),l=Symbol[_0x186784(0x204)](_0x186784(0x2da)),m=Object[_0x186784(0x2e8)][_0x186784(0x208)],n=f[_0x186784(0x2f6)]['ReactCurrentOwner'],p={'key':!0x0,'ref':!0x0,'__self':!0x0,'__source':!0x0};function q(_0x21ce3a,_0x472af4,_0x1a41e2){const _0x3572d6=_0x186784;var _0x2aed73,_0x5b55ba={},_0x225fb3=null,_0x9d0301=null;_0x1a41e2!==void 0x0&&(_0x225fb3=''+_0x1a41e2),_0x472af4['key']!==void 0x0&&(_0x225fb3=''+_0x472af4[_0x3572d6(0x258)]),_0x472af4[_0x3572d6(0x330)]!==void 0x0&&(_0x9d0301=_0x472af4[_0x3572d6(0x330)]);for(_0x2aed73 in _0x472af4)m[_0x3572d6(0x1dc)](_0x472af4,_0x2aed73)&&!p[_0x3572d6(0x208)](_0x2aed73)&&(_0x5b55ba[_0x2aed73]=_0x472af4[_0x2aed73]);if(_0x21ce3a&&_0x21ce3a[_0x3572d6(0x2f4)]){for(_0x2aed73 in(_0x472af4=_0x21ce3a[_0x3572d6(0x2f4)],_0x472af4))_0x5b55ba[_0x2aed73]===void 0x0&&(_0x5b55ba[_0x2aed73]=_0x472af4[_0x2aed73]);}return{'$$typeof':k,'type':_0x21ce3a,'key':_0x225fb3,'ref':_0x9d0301,'props':_0x5b55ba,'_owner':n[_0x3572d6(0x23b)]};}__name(q,'q'),reactJsxRuntime_production_min[_0x186784(0x2c7)]=l,reactJsxRuntime_production_min[_0x186784(0x202)]=q,reactJsxRuntime_production_min[_0x186784(0x2bd)]=q,jsxRuntime[_0x186784(0x206)]=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime[_0x186784(0x206)];const UserHabitCurrencyContext=createContext([]);var __defProp$4=Object[_0x186784(0x257)],__getOwnPropDesc$4=Object[_0x186784(0x283)],__decorateClass$4=__name((_0xa1cca6,_0x405db6,_0x24519b,_0x1b926f)=>{const _0x3e9293=_0x186784;for(var _0x48177e=_0x1b926f>0x1?void 0x0:_0x1b926f?__getOwnPropDesc$4(_0x405db6,_0x24519b):_0x405db6,_0x1505b5=_0xa1cca6[_0x3e9293(0x2d7)]-0x1,_0x179851;_0x1505b5>=0x0;_0x1505b5--)(_0x179851=_0xa1cca6[_0x1505b5])&&(_0x48177e=(_0x1b926f?_0x179851(_0x405db6,_0x24519b,_0x48177e):_0x179851(_0x48177e))||_0x48177e);return _0x1b926f&&_0x48177e&&__defProp$4(_0x405db6,_0x24519b,_0x48177e),_0x48177e;},_0x186784(0x326)),__decorateParam$4=__name((_0x3ca53c,_0x4a9b62)=>(_0x58ea53,_0x342671)=>_0x4a9b62(_0x58ea53,_0x342671,_0x3ca53c),_0x186784(0x25f)),_a2;let UserHabitController=(_a2=class{constructor(_0x3dc281){const _0x2f615e=_0x186784;this[_0x2f615e(0x1e5)]=_0x3dc281;}[_0x186784(0x1fb)](_0x313df9){const _0x2b1e40=_0x186784;return _0x2b1e40(0x21d)+_0x313df9;}async[_0x186784(0x210)](_0x27e940,_0x594d7d){const _0x59487d=_0x186784,_0x5d8158=this[_0x59487d(0x1fb)](_0x27e940);return this[_0x59487d(0x1e5)][_0x59487d(0x229)](_0x5d8158)[_0x59487d(0x31a)](_0x3a1dd1=>{const _0x1a9465=_0x59487d;_0x3a1dd1||this[_0x1a9465(0x1e5)][_0x1a9465(0x30e)](_0x5d8158,_0x594d7d);});}[_0x186784(0x205)](_0x432172,_0x53d428){const _0x28f4cc=_0x186784,_0x36eb8a=this[_0x28f4cc(0x1fb)](_0x432172);this['_localStorageService'][_0x28f4cc(0x229)](_0x36eb8a)[_0x28f4cc(0x31a)](_0x600b59=>{const _0x1a34cd=_0x28f4cc;if(_0x600b59){const _0x22993d=_0x600b59[_0x1a34cd(0x2b5)](_0x247984=>_0x247984===_0x53d428);_0x22993d>-0x1&&_0x600b59['splice'](_0x22993d,0x1),_0x600b59['unshift'](_0x53d428),this[_0x1a34cd(0x1e5)]['setItem'](_0x36eb8a,_0x600b59);}});}async['getHabit'](_0x2aadd7,_0xa6d230){const _0x28e113=_0x186784,_0x289a3e=this[_0x28e113(0x1fb)](_0x2aadd7),_0x3bc35f=await this[_0x28e113(0x1e5)][_0x28e113(0x229)](_0x289a3e);if(_0xa6d230&&_0x3bc35f){const _0x52a3e4=_0x3bc35f[_0x28e113(0x25b)]((_0x1e1aa3,_0x404f84,_0x2e4f95)=>{const _0xeb20b=_0x28e113,_0xe466c9=_0x2e4f95[_0xeb20b(0x2d7)];return{'value':_0x1e1aa3,'priority':_0xe466c9-_0x404f84};});return _0xa6d230[_0x28e113(0x1cb)]((_0x35fc64,_0x175e3d)=>{const _0x4be0f1=_0x28e113;var _0x2623ad,_0x393283;const _0x58897a=((_0x2623ad=_0x52a3e4[_0x4be0f1(0x1ce)](_0x995d37=>_0x995d37[_0x4be0f1(0x32b)]===_0x35fc64))==null?void 0x0:_0x2623ad[_0x4be0f1(0x31d)])||-0x1;return(((_0x393283=_0x52a3e4['find'](_0x24e034=>_0x24e034[_0x4be0f1(0x32b)]===_0x175e3d))==null?void 0x0:_0x393283[_0x4be0f1(0x31d)])||-0x1)-_0x58897a;});}return _0x3bc35f||[];}['deleteHabit'](_0x3cfa75){const _0x3dba23=_0x186784;this[_0x3dba23(0x1e5)][_0x3dba23(0x1ea)](_0x3cfa75);}},__name(_a2,_0x186784(0x1ec)),_a2);UserHabitController=__decorateClass$4([__decorateParam$4(0x0,Inject(ILocalStorageService))],UserHabitController);const key$1=_0x186784(0x32a),useCurrencyOptions=__name(_0x4663df=>{const _0x41a44a=_0x186784,_0x1747db=useDependency(UserHabitController),[_0x1c556f,_0x5a29a2]=useState(currencySymbols);return useEffect(()=>{const _0x40fd1e=_0x5013;_0x1747db['addHabit'](_0x40fd1e(0x32a),[])['then'](()=>{_0x1747db['getHabit'](key$1,[...currencySymbols])['then'](_0x1f2cf6=>{_0x5a29a2(_0x1f2cf6),_0x4663df&&_0x4663df(_0x1f2cf6);});});},[]),{'userHabitCurrency':_0x1c556f,'mark':__name(_0x13a555=>{const _0x36a22b=_0x5013;_0x1747db[_0x36a22b(0x205)](key$1,_0x13a555);},_0x41a44a(0x22a))};},_0x186784(0x297)),useNextTick=__name(()=>{const _0x3906b5=useRef([]),[_0x4b3d53,_0x3a1ac7]=useState({});return useEffect(()=>{const _0xe0a037=_0x5013;_0x3906b5['current']['forEach'](_0x3297ac=>{_0x3297ac();}),_0x3906b5[_0xe0a037(0x23b)]=[];},[_0x4b3d53]),__name(_0x1996e6=>{const _0xdb02b8=_0x5013;_0x3906b5[_0xdb02b8(0x23b)][_0xdb02b8(0x1f0)](_0x1996e6),_0x3a1ac7({});},'nextTick');},'useNextTick'),getCurrencyType=__name(_0x5930a4=>currencySymbols[_0x186784(0x1ce)](_0x2f38d3=>_0x5930a4[_0x186784(0x1ff)](_0x2f38d3)),_0x186784(0x2cd)),isAccountingPanel=__name(_0x1fca22=>!!getCurrencyType(_0x1fca22)&&_0x1fca22[_0x186784(0x274)]('_('),_0x186784(0x201)),AccountingPanel=__name(_0x5eca38=>{const _0x39ceb9=_0x186784,[_0x396082,_0x279cbd]=useState(()=>getDecimalFromPattern(_0x5eca38[_0x39ceb9(0x252)]||'',0x2)),_0x387509=useContext(UserHabitCurrencyContext),[_0x5d75a5,_0x476527]=useState(()=>getCurrencyType(_0x5eca38[_0x39ceb9(0x252)])||_0x387509[0x0]),_0x3be6fe=useMemo(()=>_0x387509[_0x39ceb9(0x25b)](_0x3b5551=>({'label':_0x3b5551,'value':_0x3b5551})),[]),_0x30370c=useDependency(LocaleService)['t'];_0x5eca38[_0x39ceb9(0x1c8)][_0x39ceb9(0x23b)]=()=>setPatternDecimal(_0x39ceb9(0x1f1)+_0x5d75a5+_0x39ceb9(0x2bc)+(_0x396082>0x0?'.0':'')+'_)',_0x396082);const _0x3bdd41=__name(_0x20a47a=>{const _0x1efbb8=_0x39ceb9;_0x476527(_0x20a47a),_0x5eca38['onChange'](setPatternDecimal(_0x1efbb8(0x1f1)+_0x20a47a+_0x1efbb8(0x2bc)+(_0x396082>0x0?'.0':'')+'_)',_0x396082));},_0x39ceb9(0x1d8)),_0x1430a2=__name(_0x2eb76c=>{const _0xe1e3f5=_0x39ceb9,_0x35412f=_0x2eb76c||0x0;_0x279cbd(_0x35412f),_0x5eca38[_0xe1e3f5(0x244)](setPatternDecimal(_0xe1e3f5(0x1f1)+_0x5d75a5+'\x22*\x20#,##0'+(_0x35412f>0x0?'.0':'')+'_)',_0x35412f));},_0x39ceb9(0x280));return jsxRuntimeExports[_0x39ceb9(0x2bd)](_0x39ceb9(0x2fa),{'children':[jsxRuntimeExports[_0x39ceb9(0x2bd)](_0x39ceb9(0x2fa),{'className':'m-t-16\x20options\x20','children':[jsxRuntimeExports[_0x39ceb9(0x2bd)](_0x39ceb9(0x2fa),{'className':'option','children':[jsxRuntimeExports[_0x39ceb9(0x202)](_0x39ceb9(0x2fa),{'className':_0x39ceb9(0x211),'children':_0x30370c(_0x39ceb9(0x29f))}),jsxRuntimeExports['jsx']('div',{'className':_0x39ceb9(0x2d5),'children':jsxRuntimeExports[_0x39ceb9(0x202)](InputNumber,{'value':_0x396082,'max':0x14,'min':0x0,'onChange':_0x1430a2})})]}),jsxRuntimeExports[_0x39ceb9(0x2bd)](_0x39ceb9(0x2fa),{'className':_0x39ceb9(0x2c3),'children':[jsxRuntimeExports[_0x39ceb9(0x202)]('div',{'className':'label','children':_0x30370c(_0x39ceb9(0x250))}),jsxRuntimeExports[_0x39ceb9(0x202)](_0x39ceb9(0x2fa),{'className':'m-t-8\x20w-140','children':jsxRuntimeExports[_0x39ceb9(0x202)](Select,{'onChange':_0x3bdd41,'options':_0x3be6fe,'value':_0x5d75a5})})]})]}),jsxRuntimeExports[_0x39ceb9(0x202)](_0x39ceb9(0x2fa),{'className':_0x39ceb9(0x21e),'children':_0x30370c(_0x39ceb9(0x2ac))})]});},_0x186784(0x243)),getCurrencyFormatOptions=__name(_0x289864=>CURRENCYFORMAT['map'](_0x3687b5=>({'label':_0x3687b5[_0x186784(0x211)](_0x289864),'value':_0x3687b5[_0x186784(0x1e1)](_0x289864),'color':_0x3687b5[_0x186784(0x1de)]})),_0x186784(0x24e)),getDateFormatOptions=__name(()=>DATEFMTLISG[_0x186784(0x25b)](_0x187498=>({'label':_0x187498['label'],'value':_0x187498['suffix']})),'getDateFormatOptions'),getNumberFormatOptions=__name(()=>NUMBERFORMAT['map'](_0x1c3a61=>({'label':_0x1c3a61[_0x186784(0x211)],'value':_0x1c3a61['suffix'],'color':_0x1c3a61[_0x186784(0x1de)]})),_0x186784(0x23d)),isCurrencyPanel=__name(_0x45ff36=>!!getCurrencyType(_0x45ff36)&&!_0x45ff36[_0x186784(0x274)]('_('),_0x186784(0x331)),CurrencyPanel=__name(_0x104146=>{const _0x580804=_0x186784,_0x280a8a=useDependency(LocaleService)['t'],_0x432cdb=useContext(UserHabitCurrencyContext),[_0x5ce219,_0x313b8a]=useState(()=>getCurrencyType(_0x104146[_0x580804(0x252)])||_0x432cdb[0x0]),[_0x434c39,_0xdb1e95]=useState(()=>getDecimalFromPattern(_0x104146[_0x580804(0x252)]||'',0x2)),[_0x377c00,_0x2c3167]=useState(()=>{const _0x2da27d=_0x580804;var _0x20e11e;const _0x55c096=getCurrencyFormatOptions(_0x5ce219);return((_0x20e11e=_0x55c096[_0x2da27d(0x1ce)](_0x1b2b95=>isPatternEqualWithoutDecimal(_0x1b2b95[_0x2da27d(0x32b)],_0x104146['defaultPattern'])))==null?void 0x0:_0x20e11e[_0x2da27d(0x32b)])||_0x55c096[0x0]['value'];}),_0x54a4c5=useMemo(()=>getCurrencyFormatOptions(_0x5ce219),[_0x5ce219]),_0x50687c=useMemo(()=>_0x432cdb['map'](_0x147de8=>({'label':_0x147de8,'value':_0x147de8})),[_0x432cdb]);_0x104146[_0x580804(0x1c8)][_0x580804(0x23b)]=()=>setPatternDecimal(_0x377c00,_0x434c39);const _0x320b95=__name(_0x5bced9=>{const _0x28cc25=_0x580804;if(_0x5bced9===void 0x0)return;_0x313b8a(_0x5bced9);const _0x265097=getCurrencyFormatOptions(_0x5bced9)[0x0][_0x28cc25(0x32b)];_0x2c3167(_0x265097),_0x104146[_0x28cc25(0x244)](setPatternDecimal(_0x265097,_0x434c39));},_0x580804(0x1d8)),_0x56a7dd=__name(_0x1ec496=>{const _0x4c8bcf=_0x580804;_0x1ec496!==void 0x0&&(_0x2c3167(_0x1ec496),_0x104146[_0x4c8bcf(0x244)](setPatternDecimal(_0x1ec496,_0x434c39)));},_0x580804(0x244)),_0x239d7e=__name(_0x404a7d=>{const _0xc8cfe2=_0x580804;_0xdb1e95(_0x404a7d||0x0),_0x104146[_0xc8cfe2(0x244)](setPatternDecimal(_0x377c00,_0x404a7d||0x0));},'onDecimalChange');return jsxRuntimeExports['jsxs']('div',{'children':[jsxRuntimeExports[_0x580804(0x2bd)]('div',{'className':'m-t-16\x20options\x20','children':[jsxRuntimeExports[_0x580804(0x2bd)](_0x580804(0x2fa),{'className':'option','children':[jsxRuntimeExports[_0x580804(0x202)](_0x580804(0x2fa),{'className':_0x580804(0x211),'children':_0x280a8a(_0x580804(0x29f))}),jsxRuntimeExports[_0x580804(0x202)]('div',{'className':_0x580804(0x2d5),'children':jsxRuntimeExports['jsx'](InputNumber,{'value':_0x434c39,'max':0x14,'min':0x0,'onChange':_0x239d7e})})]}),jsxRuntimeExports['jsxs'](_0x580804(0x2fa),{'className':_0x580804(0x2c3),'children':[jsxRuntimeExports['jsx'](_0x580804(0x2fa),{'className':_0x580804(0x211),'children':_0x280a8a(_0x580804(0x250))}),jsxRuntimeExports[_0x580804(0x202)]('div',{'className':'m-t-8\x20w-140','children':jsxRuntimeExports['jsx'](Select,{'onChange':_0x320b95,'options':_0x50687c,'value':_0x5ce219})})]})]}),jsxRuntimeExports[_0x580804(0x202)](_0x580804(0x2fa),{'className':_0x580804(0x2f1),'children':_0x280a8a('sheet.numfmt.negType')}),jsxRuntimeExports[_0x580804(0x202)]('div',{'className':'m-t-8','children':jsxRuntimeExports['jsx'](SelectList,{'onChange':_0x56a7dd,'options':_0x54a4c5,'value':_0x377c00})}),jsxRuntimeExports[_0x580804(0x202)](_0x580804(0x2fa),{'className':'describe\x20m-t-14','children':_0x280a8a(_0x580804(0x1e7))})]});},'CurrencyPanel');var __assign=function(){const _0x30c503=_0x186784;return __assign=Object[_0x30c503(0x1b8)]||function(_0x15bb79){const _0x814d92=_0x30c503;for(var _0x385726,_0x2e8d7e=0x1,_0x589b71=arguments[_0x814d92(0x2d7)];_0x2e8d7e<_0x589b71;_0x2e8d7e++){_0x385726=arguments[_0x2e8d7e];for(var _0x1bef69 in _0x385726)Object['prototype'][_0x814d92(0x208)][_0x814d92(0x1dc)](_0x385726,_0x1bef69)&&(_0x15bb79[_0x1bef69]=_0x385726[_0x1bef69]);}return _0x15bb79;},__assign[_0x30c503(0x2be)](this,arguments);},__rest=function(_0x10936f,_0x4d0655){const _0x3f163d=_0x186784;var _0x256777={};for(var _0xab7fb2 in _0x10936f)Object['prototype']['hasOwnProperty'][_0x3f163d(0x1dc)](_0x10936f,_0xab7fb2)&&_0x4d0655['indexOf'](_0xab7fb2)<0x0&&(_0x256777[_0xab7fb2]=_0x10936f[_0xab7fb2]);if(_0x10936f!=null&&typeof Object[_0x3f163d(0x1dd)]==_0x3f163d(0x2cc)){for(var _0x520f30=0x0,_0xab7fb2=Object[_0x3f163d(0x1dd)](_0x10936f);_0x520f30<_0xab7fb2[_0x3f163d(0x2d7)];_0x520f30++)_0x4d0655[_0x3f163d(0x2b6)](_0xab7fb2[_0x520f30])<0x0&&Object[_0x3f163d(0x2e8)]['propertyIsEnumerable'][_0x3f163d(0x1dc)](_0x10936f,_0xab7fb2[_0x520f30])&&(_0x256777[_0xab7fb2[_0x520f30]]=_0x10936f[_0xab7fb2[_0x520f30]]);}return _0x256777;},IconBase=forwardRef(function(_0x4bbe99,_0x16916f){const _0x7a7616=_0x186784;var _0x4a20ce=_0x4bbe99['icon'],_0x3cce49=_0x4bbe99['id'],_0x424dbd=_0x4bbe99[_0x7a7616(0x28f)],_0x2c9297=_0x4bbe99[_0x7a7616(0x1d2)],_0x28ee81=__rest(_0x4bbe99,[_0x7a7616(0x1c7),'id',_0x7a7616(0x28f),'extend']),_0xf99298=_0x7a7616(0x19b)[_0x7a7616(0x22b)](_0x3cce49,'\x20')['concat'](_0x424dbd||'')['trim'](),_0x163e18=useRef('_'[_0x7a7616(0x22b)](generateShortUuid()));return render(_0x4a20ce,''[_0x7a7616(0x22b)](_0x3cce49),{'defIds':_0x4a20ce['defIds'],'idSuffix':_0x163e18['current']},__assign({'ref':_0x16916f,'className':_0xf99298},_0x28ee81),_0x2c9297);});function render(_0x277b68,_0x208ef9,_0x56e200,_0x47e5e7,_0x41bbb4){const _0x4f9182=_0x186784;return createElement(_0x277b68[_0x4f9182(0x2c2)],__assign(__assign({'key':_0x208ef9},replaceRuntimeIdsAndExtInAttrs(_0x277b68,_0x56e200,_0x41bbb4)),_0x47e5e7),(replaceRuntimeIdsInDefs(_0x277b68,_0x56e200)[_0x4f9182(0x1d9)]||[])[_0x4f9182(0x25b)](function(_0x32a3db,_0x5c2af8){const _0x4cc1a3=_0x4f9182;return render(_0x32a3db,''[_0x4cc1a3(0x22b)](_0x208ef9,'-')[_0x4cc1a3(0x22b)](_0x277b68[_0x4cc1a3(0x2c2)],'-')['concat'](_0x5c2af8),_0x56e200,void 0x0,_0x41bbb4);}));}__name(render,'render');function replaceRuntimeIdsAndExtInAttrs(_0x39cf80,_0xfb9c1f,_0x5b8b05){const _0x495418=_0x186784;var _0x9b7d9f=__assign({},_0x39cf80[_0x495418(0x293)]);_0x5b8b05!=null&&_0x5b8b05[_0x495418(0x2f9)]&&_0x9b7d9f[_0x495418(0x2e5)]==='colorChannel1'&&(_0x9b7d9f[_0x495418(0x2e5)]=_0x5b8b05['colorChannel1']);var _0x2c699a=_0xfb9c1f['defIds'];return!_0x2c699a||_0x2c699a[_0x495418(0x2d7)]===0x0||(_0x39cf80[_0x495418(0x2c2)]==='use'&&_0x9b7d9f[_0x495418(0x1a2)]&&(_0x9b7d9f[_0x495418(0x1a2)]=_0x9b7d9f['xlink:href']+_0xfb9c1f[_0x495418(0x1ae)]),Object[_0x495418(0x241)](_0x9b7d9f)[_0x495418(0x324)](function(_0x5908fb){const _0x123287=_0x495418;var _0x3df021=_0x5908fb[0x0],_0x493d73=_0x5908fb[0x1];typeof _0x493d73==_0x123287(0x2a7)&&(_0x9b7d9f[_0x3df021]=_0x493d73[_0x123287(0x276)](/url\(#(.*)\)/,_0x123287(0x1c3)[_0x123287(0x22b)](_0xfb9c1f[_0x123287(0x1ae)],')')));})),_0x9b7d9f;}__name(replaceRuntimeIdsAndExtInAttrs,_0x186784(0x308));function replaceRuntimeIdsInDefs(_0x12f14d,_0xe2281d){const _0x52feff=_0x186784;var _0x1e2f6e,_0x4cd2de=_0xe2281d[_0x52feff(0x2cf)];return!_0x4cd2de||_0x4cd2de['length']===0x0?_0x12f14d:_0x12f14d[_0x52feff(0x2c2)]===_0x52feff(0x19a)&&(!((_0x1e2f6e=_0x12f14d[_0x52feff(0x1d9)])===null||_0x1e2f6e===void 0x0)&&_0x1e2f6e['length'])?__assign(__assign({},_0x12f14d),{'children':_0x12f14d[_0x52feff(0x1d9)][_0x52feff(0x25b)](function(_0x186366){const _0x49d263=_0x52feff;return typeof _0x186366[_0x49d263(0x293)]['id']==_0x49d263(0x2a7)&&_0x4cd2de&&_0x4cd2de[_0x49d263(0x2b6)](_0x186366[_0x49d263(0x293)]['id'])>-0x1?__assign(__assign({},_0x186366),{'attrs':__assign(__assign({},_0x186366['attrs']),{'id':_0x186366[_0x49d263(0x293)]['id']+_0xe2281d[_0x49d263(0x1ae)]})}):_0x186366;})}):_0x12f14d;}__name(replaceRuntimeIdsInDefs,_0x186784(0x277));function generateShortUuid(){const _0x38cf99=_0x186784;return Math[_0x38cf99(0x23e)]()[_0x38cf99(0x2e0)](0x24)[_0x38cf99(0x323)](0x2,0x8);}__name(generateShortUuid,'generateShortUuid'),IconBase[_0x186784(0x25e)]=_0x186784(0x2d6);var element={'tag':_0x186784(0x223),'attrs':{'fill':_0x186784(0x319),'viewBox':'0\x200\x2016\x2016','width':_0x186784(0x1b7),'height':_0x186784(0x1b7)},'children':[{'tag':'path','attrs':{'fill':_0x186784(0x292),'d':_0x186784(0x318),'fillRule':_0x186784(0x30d),'clipRule':_0x186784(0x30d)}}]},CheckMarkSingle=forwardRef(function(_0x10ab75,_0x3f6ee2){const _0x6d19dd=_0x186784;return createElement(IconBase,Object[_0x6d19dd(0x1b8)]({},_0x10ab75,{'id':_0x6d19dd(0x1ac),'ref':_0x3f6ee2,'icon':element}));});function _0x54b4(){const _0x418226=['\x22*\x20#,##0','jsxs','apply','object','getPatternPreview','General','tag','option','ranges','2yRmoQY','reCalculate','Fragment','STRING','SheetNumfmtPanel','time','more-numfmt-type','function','getCurrencyType','_commandExecutedListener','defIds','univer-custom-format-input','getCurrentTypeOfUnit$','sheet.numfmt.generalDes','sheet.numfmt.accounting','getCurrentLocale','m-t-8\x20w-120','UniverIcon','length','handleSelect','M\x22月\x22d\x22日\x22','react.fragment','span','_initInterceptorEditorEnd','change','intercept','subscribe','toString','_initInterceptorEditorStart','type','handler','(1,235)\x20','fill','_componentManager','_initCommands','prototype','sheet.numfmt.cancel','sheet.numfmt.dateType','with','setCurrencySymbolByCountryCode','FactoryOtherMenuItem','isEnd','_univerInstanceService','sheet.numfmt.customFormatDes','m-t-16\x20label','sheet.operation.close.numfmt.panel','_previewPattern','defaultProps','handleBlur','__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED','ThousandthPercentilePanel','getIconKey','colorChannel1','div','INumfmtController','getActiveSheet','_sidebarService','focus','get','scientific','getValue','add','numfmt-panel\x20p-b-20','A/P\x20h:mm:ss','sheet.numfmt.dateDes','clean','parameters','replaceRuntimeIdsAndExtInAttrs','primary','MenuCurrencyService','sheet.numfmt.thousandthPercentile','COMMAND','evenodd','setItem','m-t-8','sheet.numfmt.addDecimal','DollarSingle','NUMFMT','_initInterceptorCommands','__decorateParam','setNumfmt','customFormat','filter','M14.1544\x203.75557C14.3887\x203.98988\x2014.3887\x204.36978\x2014.1544\x204.6041L6.51409\x2012.2444C6.40157\x2012.3569\x206.24896\x2012.4201\x206.08983\x2012.4201C5.9307\x2012.4201\x205.77808\x2012.3569\x205.66556\x2012.2444L1.84541\x208.42425C1.6111\x208.18993\x201.6111\x207.81003\x201.84541\x207.57572C2.07973\x207.34141\x202.45963\x207.34141\x202.69394\x207.57572L6.08983\x2010.9716L13.3059\x203.75557C13.5402\x203.52126\x2013.9201\x203.52126\x2014.1544\x203.75557Z','none','then','CurrencyMenuItem','customFormatDes','priority','setValue','customFormatHistoryListItem','range','sheet.numfmt.date','CELL_CONTENT','substring','forEach','dispose','__decorateClass$4','_currencySymbol$','isDatePanel','AddDigitsSingle','numfmtCurrency','value','sheet.numfmt.subtractDecimal','col','#,##0.00_);-#,##0.00','sheet.command.numfmt.add.decimal.command','ref','isCurrencyPanel','\x22#,##0.00_);[Red]\x22','_selectionManagerService','yyyy\x22年\x22MM\x22月\x22dd\x22日\x22','MoreNumfmtType','component','defs','univerjs-icon\x20univerjs-icon-','NUMBER','keys','\x22#,##0.00)','_userCurrency\x27','register','onRendered','xlink:href','disposeWithMe','next','SELECTOR','getRenderById','1006ahsQre','Style','_instanceService','join','getInterceptPoints','check-mark-single','sheet.command.numfmt.subtract.decimal.command','idSuffix','-1,234.56','__decorateClass','yyyy-m-d\x20am/pm\x20h:mm','1850772eGLHlQ','500','small','UNIVER_SHEET','interceptor','1em','assign','onCommandExecuted','realDeleteValue','#,##0_);(#,##0)','registerCommand','getStyles','format','SheetsNumfmtCellContentController','getCurrentSelections','foreach','ReduceDigitsSingle','url(#$1','8月5日','_menuManagerService','customFormatHistoryList','icon','action','pipe','_initRealTimeRenderingInterceptor','sort','numfmt_custom_pattern','test','find','tokens','handleChange','#,##0.00_);[Red]#,##0.00','extend','setConfig','sheet.numfmt.timeDuration','row','_sidebarDisposable','stopPropagation','onSelect','children','sheet.numfmt.financialValue','min','call','getOwnPropertySymbols','color','h:mm','isThousandthPercentilePanel','suffix','#,##0.00_);[Red]-#,##0.00','\x22#,##0.00','num','_localStorageService','cancel','sheet.numfmt.currencyDes','13:30:30','datetime','removeItem','openPanel','UserHabitController','sheets-numfmt.config','NumfmtCurrencyController','21249kGKOoy','push','_(\x22','RoubleSingle','reset','sheet.numfmt.customFormat','OPERATION','08-05','result','more-numfmt-type-options','grouped','_themeService','_getKey','FORMULAS_INSERT','getEffects','sheet.numfmt.general','includes','__decorateClass$5','isAccountingPanel','jsx','yyyy-MM-dd','for','markHabit','exports','PercentSingle','hasOwnProperty','makeDirty','617730sNHREu','univer-custom-format-des','btn-list\x20m-t-14\x20m-b-20','startRow','customFormatTitle','1930年08月05日','addHabit','label','date','startColumn','finally','symbol','isPatternEqualWithoutDecimal','getUnitId','sheet.numfmt.time','sheet.numfmt.negType','_forceUpdate','BUTTON','_sheetInterceptorService','userHabitController_','describe\x20m-t-14','BEFORE_CELL_EDIT','__decorateClass$3','handleClick','NumfmtController','svg','univer-custom-format-history-list-item','6XUWYZP','parseTime','isNaN','_collectEffectMutation','getItem','mark','concat','_numfmtService','1,235)','getDecimalFromPattern','sheet.numfmt.numfmtType','ZH_CN','__decorateClass$1','\x22#,##0.00_);-\x22','cellValue','worksheet','getPatternPreviewIgnoreGeneral','isPatternHasDecimal','unknown','getInfo','sheet.command.numfmt.set.currency','executeCommand','current','createCollectEffectMutation','getNumberFormatOptions','random','mainComponent','sheet.numfmt.moreFmt','entries','currencySymbol$','AccountingPanel','onChange','h:mm:ss','number','_config','_initPanel','params','sheet.numfmt.number','onClick','_partitions','_commandService','getCurrencyFormatOptions','774580sCqiJn','sheet.numfmt.currencyType','_renderManagerService','defaultPattern','#,##0.00_);#,##0.00','GeneralPanel','616236zdlwiR','close','defineProperty','key','A/P\x20hh:mm','asObservable','map','_configService','sheet.numfmt.confirm','displayName','__decorateParam$4','A/P\x20h:mm','\x22#,##0.00_);\x22','point','workbook','_editorBridgeService','\x22¥\x22#,##0.00_);[Red](\x22¥\x22#,##0.00)','Provider','sheet.numfmt.currency','__decorateParam$1','subUnitId','splice','\x22#,##0.00_);[Red]-\x22','下午1:30','1930/08/05','_initInterceptorCellContent','pattern','handleOnclick','下午1:30:30','reverse','Options','startsWith','customFormatHistoryListItemIconWrap','replace','replaceRuntimeIdsInDefs','percent','max','customFormatInput','736ONVzjY','red','\x22#,##0.00_);(\x22','getCellRaw','unitId','onDecimalChange','sheet.numfmt.percent','sheet.numfmt.dateTime','getOwnPropertyDescriptor','confirm','AFTER_CELL_EDIT','zh-CN','selectionMoveEnd$','getPatternType','RmbSingle','split','1930-08-05','_initMenu','__decorateParam$2','(1,235)','className','__decorateClass$2','sheet.numfmt.title','currentColor','attrs','line\x20m-t-4','interceptCommand','\x22¥\x22\x20#,##0.00_);[Red](\x22¥\x22#,##0.00)','useCurrencyOptions','624423aJPZkl','pluginName','_initCloseListener','m-r-12','\x22#,##0.00_);[Red](\x22','values','name','sheet.numfmt.decimalLength','reduce','forValue','some','getCurrencySymbol','__publicField','getCurrentTheme','parseDate','string','_localeService','下午01:30','Value','AddDecimalMenuItem','sheet.numfmt.accountingDes','getCurrentUnitForType','100%','setPatternDecimal','react.element','getCell','label\x20m-t-14','_injector','yyyy/MM/dd','findIndex','indexOf','NumfmtEditorController','onClose','SubtractDecimalMenuItem','activeSheet$','1,235'];_0x54b4=function(){return _0x418226;};return _0x54b4();}CheckMarkSingle[_0x186784(0x25e)]='CheckMarkSingle';const customFormatTitle='univer-custom-format-title',customFormatInput=_0x186784(0x2d0),customFormatHistoryList='univer-custom-format-history-list',customFormatHistoryListItem=_0x186784(0x224),customFormatHistoryListItemIconWrap='univer-custom-format-history-list-item-icon-wrap',customFormatDes=_0x186784(0x20b),styles={'customFormatTitle':customFormatTitle,'customFormatInput':customFormatInput,'customFormatHistoryList':customFormatHistoryList,'customFormatHistoryListItem':customFormatHistoryListItem,'customFormatHistoryListItemIconWrap':customFormatHistoryListItemIconWrap,'customFormatDes':customFormatDes},key=_0x186784(0x316),historyPatternKey=_0x186784(0x1cc);function CustomFormat(_0x4c3e4e){const _0x22f857=_0x186784,{defaultPattern:_0x451c69,action:_0x2cee67,onChange:_0x4ae4c0}=_0x4c3e4e,_0x528715=useDependency(UserHabitController),_0x2c212e=useDependency(ILocalStorageService),_0x556bc4=useDependency(LocaleService),[_0x599291,_0x594693]=useState(_0x451c69);_0x2cee67['current']=()=>(_0x528715['markHabit'](key,_0x599291),_0x2c212e[_0x22f857(0x229)](historyPatternKey)['then']((_0x20cf58=[])=>{const _0x4f5284=_0x22f857,_0x2615d3=[...new Set([_0x599291,..._0x20cf58||[]])][_0x4f5284(0x26a)](0x0,0xa)[_0x4f5284(0x317)](_0x42e05e=>!!_0x42e05e);_0x2c212e['setItem'](historyPatternKey,_0x2615d3);}),_0x599291);const [_0x246ed6,_0x3fa5a8]=useState([]);useEffect(()=>{const _0x4e8d63=_0x22f857;_0x2c212e[_0x4e8d63(0x229)](historyPatternKey)['then'](_0xee473e=>{const _0x234dc0=_0x4e8d63,_0x4b599d=[...CURRENCYFORMAT[_0x234dc0(0x25b)](_0x9bad58=>_0x9bad58[_0x234dc0(0x1e1)]('$')),...DATEFMTLISG['map'](_0x29f9ca=>_0x29f9ca['suffix']),...NUMBERFORMAT[_0x234dc0(0x25b)](_0x589e1b=>_0x589e1b['suffix'])];_0x4b599d['push'](..._0xee473e||[]),_0x528715[_0x234dc0(0x210)](key,[])[_0x234dc0(0x214)](()=>{const _0x2b6a57=_0x234dc0;_0x528715['getHabit'](key,_0x4b599d)[_0x2b6a57(0x31a)](_0x412f9d=>{_0x3fa5a8([...new Set(_0x412f9d)]);});});});},[]);const _0x34e68f=__name(_0x10fd44=>{_0x594693(_0x10fd44),_0x4ae4c0(_0x10fd44);},_0x22f857(0x221)),_0x37c931=__name(()=>{_0x4ae4c0(_0x599291);},_0x22f857(0x2f5));return jsxRuntimeExports[_0x22f857(0x2bd)]('div',{'className':styles[_0x22f857(0x316)],'children':[jsxRuntimeExports[_0x22f857(0x202)]('div',{'className':styles[_0x22f857(0x20e)],'children':_0x556bc4['t'](_0x22f857(0x1f4))}),jsxRuntimeExports[_0x22f857(0x202)](Input,{'placeholder':_0x556bc4['t'](_0x22f857(0x1f4)),'onBlur':_0x37c931,'value':_0x599291,'onChange':_0x594693,'className':styles[_0x22f857(0x27a)]}),jsxRuntimeExports[_0x22f857(0x202)](_0x22f857(0x2fa),{'className':styles[_0x22f857(0x1c6)],'children':_0x246ed6[_0x22f857(0x25b)](_0x2727e9=>jsxRuntimeExports[_0x22f857(0x2bd)](_0x22f857(0x2fa),{'onClick':__name(()=>_0x34e68f(_0x2727e9),_0x22f857(0x24b)),'className':styles[_0x22f857(0x31f)],'children':[jsxRuntimeExports[_0x22f857(0x202)](_0x22f857(0x2fa),{'className':styles[_0x22f857(0x275)],'children':_0x599291===_0x2727e9&&jsxRuntimeExports[_0x22f857(0x202)](CheckMarkSingle,{})}),jsxRuntimeExports[_0x22f857(0x202)](_0x22f857(0x2fa),{'children':_0x2727e9})]},_0x2727e9))}),jsxRuntimeExports[_0x22f857(0x202)](_0x22f857(0x2fa),{'className':styles[_0x22f857(0x31c)],'children':_0x556bc4['t'](_0x22f857(0x2f0))})]});}__name(CustomFormat,'CustomFormat');const isDatePanel=__name(_0x408c12=>{const _0x4b7ff6=_0x186784,_0x19633d=numfmt[_0x4b7ff6(0x238)](_0x408c12);return getDateFormatOptions()[_0x4b7ff6(0x25b)](_0xf4f5cc=>_0xf4f5cc['value'])[_0x4b7ff6(0x1ff)](_0x408c12)||['date',_0x4b7ff6(0x1e9),_0x4b7ff6(0x2ca)][_0x4b7ff6(0x1ff)](_0x19633d[_0x4b7ff6(0x2e2)]);},_0x186784(0x328)),DatePanel=__name(_0x3c7a3c=>{const _0x5e3205=_0x186784,_0x541cd9=useMemo(getDateFormatOptions,[]),_0x28d998=useDependency(LocaleService)['t'],[_0x21b940,_0x57d431]=useState(()=>{const _0x5470d7=_0x5013;if(_0x3c7a3c[_0x5470d7(0x252)]){const _0x53cbfe=_0x541cd9[_0x5470d7(0x1ce)](_0x28f018=>_0x28f018['value']===_0x3c7a3c[_0x5470d7(0x252)]);if(_0x53cbfe)return _0x53cbfe[_0x5470d7(0x32b)];}return _0x541cd9[0x0][_0x5470d7(0x32b)];});_0x3c7a3c[_0x5e3205(0x1c8)]['current']=()=>_0x21b940;const _0x4dfeaa=__name(_0x32ff6a=>{const _0x419008=_0x5e3205;_0x32ff6a!==void 0x0&&(_0x57d431(_0x32ff6a),_0x3c7a3c[_0x419008(0x244)](_0x32ff6a));},'onChange');return jsxRuntimeExports[_0x5e3205(0x2bd)](_0x5e3205(0x2fa),{'children':[jsxRuntimeExports[_0x5e3205(0x202)](_0x5e3205(0x2fa),{'className':'m-t-16\x20label','children':_0x28d998(_0x5e3205(0x2ea))}),jsxRuntimeExports[_0x5e3205(0x202)](_0x5e3205(0x2fa),{'className':_0x5e3205(0x30f),'children':jsxRuntimeExports[_0x5e3205(0x202)](SelectList,{'value':_0x21b940,'options':_0x541cd9,'onChange':_0x4dfeaa})}),jsxRuntimeExports[_0x5e3205(0x202)](_0x5e3205(0x2fa),{'className':'describe\x20m-t-14','children':_0x28d998(_0x5e3205(0x305))})]});},'DatePanel'),isGeneralPanel=__name(_0x143eb0=>!_0x143eb0,'isGeneralPanel'),GeneralPanel=__name(_0x31e0ce=>{const _0x29965a=_0x186784,_0x4b353d=useDependency(LocaleService)['t'];return _0x31e0ce[_0x29965a(0x1c8)][_0x29965a(0x23b)]=()=>'',jsxRuntimeExports[_0x29965a(0x202)]('div',{'children':jsxRuntimeExports['jsx'](_0x29965a(0x2fa),{'className':'describe\x20m-t-14','children':_0x4b353d(_0x29965a(0x2d2))})});},_0x186784(0x254)),isThousandthPercentilePanel=__name(_0x23516b=>getNumberFormatOptions()[_0x186784(0x2a2)](_0x570e9a=>isPatternEqualWithoutDecimal(_0x570e9a[_0x186784(0x32b)],_0x23516b)),_0x186784(0x1e0)),ThousandthPercentilePanel=__name(_0x4267aa=>{const _0x1fcd9f=_0x186784,_0x2ddba9=useDependency(LocaleService),_0x440853=useMemo(getNumberFormatOptions,[]),[_0x1e62b2,_0x5019fb]=useState(()=>getDecimalFromPattern(_0x4267aa[_0x1fcd9f(0x252)]||'',0x0)),[_0x406bae,_0x512cb8]=useState(()=>{const _0x16ad1e=_0x1fcd9f,_0x3c4876=_0x440853[_0x16ad1e(0x1ce)](_0x432c4f=>isPatternEqualWithoutDecimal(_0x432c4f[_0x16ad1e(0x32b)],_0x4267aa[_0x16ad1e(0x252)]||''));return(_0x3c4876==null?void 0x0:_0x3c4876[_0x16ad1e(0x32b)])||_0x440853[0x0]['value'];}),_0x1f1b96=useMemo(()=>setPatternDecimal(_0x406bae,Number(_0x1e62b2||0x0)),[_0x406bae,_0x1e62b2]),_0x2f7fd2=useMemo(()=>!isPatternHasDecimal(_0x406bae),[_0x406bae]),_0x57fb61=__name(_0x3fc992=>{const _0x3021b6=_0x1fcd9f;_0x5019fb(_0x3fc992||0x0),_0x4267aa[_0x3021b6(0x244)](setPatternDecimal(_0x406bae,Number(_0x3fc992||0x0)));},'handleDecimalChange'),_0x5599bd=__name(_0x4d7004=>{const _0x42747c=_0x1fcd9f;_0x4d7004!==void 0x0&&(_0x5019fb(getDecimalFromPattern(_0x4d7004,0x0)),_0x512cb8(_0x4d7004),_0x4267aa[_0x42747c(0x244)](_0x4d7004));},'handleClick');return _0x4267aa[_0x1fcd9f(0x1c8)]['current']=()=>_0x1f1b96,jsxRuntimeExports[_0x1fcd9f(0x2bd)]('div',{'children':[jsxRuntimeExports[_0x1fcd9f(0x202)](_0x1fcd9f(0x2fa),{'className':_0x1fcd9f(0x2f1),'children':_0x2ddba9['t'](_0x1fcd9f(0x29f))}),jsxRuntimeExports[_0x1fcd9f(0x202)](_0x1fcd9f(0x2fa),{'className':_0x1fcd9f(0x30f),'children':jsxRuntimeExports[_0x1fcd9f(0x202)](InputNumber,{'disabled':_0x2f7fd2,'value':_0x1e62b2,'max':0x14,'min':0x0,'onChange':_0x57fb61})}),jsxRuntimeExports[_0x1fcd9f(0x2bd)](_0x1fcd9f(0x2fa),{'className':_0x1fcd9f(0x2f1),'children':['\x20',_0x2ddba9['t'](_0x1fcd9f(0x219))]}),jsxRuntimeExports[_0x1fcd9f(0x202)](_0x1fcd9f(0x2fa),{'className':_0x1fcd9f(0x30f),'children':jsxRuntimeExports[_0x1fcd9f(0x202)](SelectList,{'onChange':_0x5599bd,'options':_0x440853,'value':_0x406bae})}),jsxRuntimeExports[_0x1fcd9f(0x202)](_0x1fcd9f(0x2fa),{'className':_0x1fcd9f(0x21e),'children':_0x2ddba9['t']('sheet.numfmt.thousandthPercentileDes')})]});},_0x186784(0x2f7)),SheetNumfmtPanel=__name(_0x1941d0=>{const _0x424f19=_0x186784,{defaultValue:_0x3e116b,defaultPattern:_0x410bf8,row:_0x12e9ff,col:_0x2e5565}=_0x1941d0[_0x424f19(0x32b)],_0xd569d=useDependency(LocaleService),_0x480dd5=useRef(()=>''),_0x1c7886=_0xd569d['t'],_0x5cc61b=useNextTick(),_0xbe7827=useMemo(()=>[{'label':_0x424f19(0x1fe),'component':GeneralPanel},{'label':_0x424f19(0x2d3),'component':AccountingPanel},{'label':_0x424f19(0x267),'component':CurrencyPanel},{'label':_0x424f19(0x321),'component':DatePanel},{'label':_0x424f19(0x30b),'component':ThousandthPercentilePanel},{'label':'sheet.numfmt.customFormat','component':CustomFormat}][_0x424f19(0x25b)](_0x391fdb=>({..._0x391fdb,'label':_0x1c7886(_0x391fdb[_0x424f19(0x211)])})),[]),[_0x46570e,_0x7858e1]=useState(_0x3b01e4),[_0x2f3bcf,_0x26c334]=useState(()=>_0x12e9ff+'_'+_0x2e5565),{mark:_0x434820,userHabitCurrency:_0xcf1719}=useCurrencyOptions(()=>_0x26c334(_0x12e9ff+'_'+_0x2e5565+_0x424f19(0x19f))),_0x1a82cb=useMemo(()=>{const _0x519695=_0x424f19;var _0x4cae6e;return(_0x4cae6e=_0xbe7827[_0x519695(0x1ce)](_0x313e92=>_0x313e92[_0x519695(0x211)]===_0x46570e))==null?void 0x0:_0x4cae6e[_0x519695(0x199)];},[_0x46570e]);function _0x3b01e4(){const _0x209605=_0x424f19;return[isGeneralPanel,isAccountingPanel,isCurrencyPanel,isDatePanel,isThousandthPercentilePanel]['reduce']((_0x28a697,_0x1d66a1,_0x23fd3a)=>_0x28a697||(_0x1d66a1(_0x410bf8)?_0xbe7827[_0x23fd3a]['label']:''),'')||_0xbe7827[0x0][_0x209605(0x211)];}__name(_0x3b01e4,'findDefaultType');const _0x558b46=_0xbe7827[_0x424f19(0x25b)](_0x23100f=>({'label':_0x23100f[_0x424f19(0x211)],'value':_0x23100f[_0x424f19(0x211)]})),_0x516516=__name(_0xd1b0bb=>{const _0x1e1e2a=_0x424f19;_0x7858e1(_0xd1b0bb),_0x5cc61b(()=>_0x1941d0['onChange']({'type':_0x1e1e2a(0x2dd),'value':_0x480dd5[_0x1e1e2a(0x23b)]()||''}));},_0x424f19(0x2d8)),_0x3f96cd=__name(_0x21778c=>{const _0x38f59a=_0x424f19;_0x1941d0[_0x38f59a(0x244)]({'type':_0x38f59a(0x2dd),'value':_0x21778c});},_0x424f19(0x1d0)),_0x2d710c=__name(()=>{const _0x497af8=_0x424f19,_0x364520=_0x480dd5[_0x497af8(0x23b)]()||'',_0x3d60f4=getCurrencyType(_0x364520);_0x3d60f4&&_0x434820(_0x3d60f4),_0x1941d0['onChange']({'type':_0x497af8(0x284),'value':_0x364520});},'handleConfirm'),_0x21788f=__name(()=>{const _0x2dfb7a=_0x424f19;_0x1941d0[_0x2dfb7a(0x244)]({'type':_0x2dfb7a(0x1e6),'value':''});},'handleCancel'),_0xab3c09={'onChange':_0x3f96cd,'defaultValue':_0x3e116b,'defaultPattern':_0x410bf8,'action':_0x480dd5};return useEffect(()=>{_0x7858e1(_0x3b01e4()),_0x26c334(_0x12e9ff+'_'+_0x2e5565);},[_0x12e9ff,_0x2e5565]),jsxRuntimeExports[_0x424f19(0x2bd)]('div',{'className':_0x424f19(0x303),'children':[jsxRuntimeExports['jsxs']('div',{'children':[jsxRuntimeExports[_0x424f19(0x202)](_0x424f19(0x2fa),{'className':_0x424f19(0x2b2),'children':_0x1c7886(_0x424f19(0x22f))}),jsxRuntimeExports[_0x424f19(0x202)](_0x424f19(0x2fa),{'className':_0x424f19(0x30f),'children':jsxRuntimeExports['jsx'](Select,{'onChange':_0x516516,'options':_0x558b46,'value':_0x46570e,'style':{'width':_0x424f19(0x2ae)}})}),jsxRuntimeExports[_0x424f19(0x202)](_0x424f19(0x2fa),{'children':_0x1a82cb&&jsxRuntimeExports['jsx'](UserHabitCurrencyContext[_0x424f19(0x266)],{'value':_0xcf1719,'children':createElement(_0x1a82cb,{..._0xab3c09,'key':_0x2f3bcf})})})]}),jsxRuntimeExports[_0x424f19(0x2bd)]('div',{'className':_0x424f19(0x20c),'children':[jsxRuntimeExports['jsx'](Button,{'size':_0x424f19(0x1b4),'onClick':_0x21788f,'className':_0x424f19(0x29b),'children':_0x1c7886(_0x424f19(0x2e9))}),jsxRuntimeExports['jsx'](Button,{'type':_0x424f19(0x309),'size':_0x424f19(0x1b4),'onClick':_0x2d710c,'children':_0x1c7886(_0x424f19(0x25d))})]})]});},_0x186784(0x2c9));var __defProp$3=Object['defineProperty'],__getOwnPropDesc$3=Object[_0x186784(0x283)],__decorateClass$3=__name((_0x2806a1,_0x477930,_0x4d6a30,_0x1387b4)=>{const _0x443cd7=_0x186784;for(var _0x54ac39=_0x1387b4>0x1?void 0x0:_0x1387b4?__getOwnPropDesc$3(_0x477930,_0x4d6a30):_0x477930,_0x548073=_0x2806a1[_0x443cd7(0x2d7)]-0x1,_0x211bb3;_0x548073>=0x0;_0x548073--)(_0x211bb3=_0x2806a1[_0x548073])&&(_0x54ac39=(_0x1387b4?_0x211bb3(_0x477930,_0x4d6a30,_0x54ac39):_0x211bb3(_0x54ac39))||_0x54ac39);return _0x1387b4&&_0x54ac39&&__defProp$3(_0x477930,_0x4d6a30,_0x54ac39),_0x54ac39;},_0x186784(0x220)),__decorateParam$3=__name((_0x2dd937,_0x24344c)=>(_0x9abd9a,_0x2f19a9)=>_0x24344c(_0x9abd9a,_0x2f19a9,_0x2dd937),'__decorateParam$3'),_a3;let NumfmtController=(_a3=class extends Disposable{constructor(_0x70824c,_0x5b0f7e,_0x4cf86b,_0x506b13,_0x11dbb5,_0x4ce023,_0x5dd6ad,_0x17bc94,_0x38ff33,_0x584a3f){const _0x2fe6c8=_0x186784;super(),__publicField(this,_0x2fe6c8(0x2f3),''),__publicField(this,_0x2fe6c8(0x1d6),null),(this[_0x2fe6c8(0x21c)]=_0x70824c,this[_0x2fe6c8(0x1fa)]=_0x5b0f7e,this[_0x2fe6c8(0x2ef)]=_0x4cf86b,this['_commandService']=_0x506b13,this[_0x2fe6c8(0x196)]=_0x11dbb5,this['_renderManagerService']=_0x4ce023,this[_0x2fe6c8(0x22c)]=_0x5dd6ad,this[_0x2fe6c8(0x2e6)]=_0x17bc94,this[_0x2fe6c8(0x2fd)]=_0x38ff33,this[_0x2fe6c8(0x2a8)]=_0x584a3f,this[_0x2fe6c8(0x1ca)](),this[_0x2fe6c8(0x248)](),this['_initCommands'](),this[_0x2fe6c8(0x29a)](),this[_0x2fe6c8(0x2ce)]());}[_0x186784(0x1eb)](){const _0x2093e0=_0x186784;var _0x272712;const _0x442984=this[_0x2093e0(0x2fd)],_0x469bf0=this[_0x2093e0(0x196)],_0xafc431=this[_0x2093e0(0x24d)],_0x35c968=this[_0x2093e0(0x2ef)],_0x4be88f=this['_numfmtService'],_0x50091a=this[_0x2093e0(0x2a8)],_0x435ebc=(((_0x272712=_0x469bf0[_0x2093e0(0x1c0)]())==null?void 0x0:_0x272712[_0x2093e0(0x25b)](_0x3720d7=>_0x3720d7[_0x2093e0(0x320)]))||[])[0x0];if(!_0x435ebc)return!0x1;const _0x221c72=_0x35c968['getCurrentUnitForType'](UniverInstanceType[_0x2093e0(0x1b5)]),_0x1ebd89=_0x221c72[_0x2093e0(0x2fc)]();if(!_0x1ebd89)return!0x1;const _0x523c17=_0x1ebd89[_0x2093e0(0x27e)](_0x435ebc[_0x2093e0(0x20d)],_0x435ebc[_0x2093e0(0x213)]),_0x14202d=_0x4be88f[_0x2093e0(0x301)](_0x221c72[_0x2093e0(0x217)](),_0x1ebd89['getSheetId'](),_0x435ebc['startRow'],_0x435ebc[_0x2093e0(0x213)]);let _0x3a6027='';_0x14202d&&(_0x3a6027=_0x14202d['pattern']);const _0x30bbc5=(_0x523c17==null?void 0x0:_0x523c17['t'])===CellValueType[_0x2093e0(0x19c)]?_0x523c17['v']:0xbc614e,_0xe45550={'onChange':__name(_0x4dd690=>{const _0x4f970f=_0x2093e0;var _0x25ea09;if(_0x4dd690[_0x4f970f(0x2e2)]===_0x4f970f(0x2dd))this['_previewPattern']=_0x4dd690[_0x4f970f(0x32b)],this[_0x4f970f(0x21a)]();else{if(_0x4dd690[_0x4f970f(0x2e2)]===_0x4f970f(0x284)){const _0x4e6478=((_0x25ea09=_0x469bf0[_0x4f970f(0x1c0)]())==null?void 0x0:_0x25ea09[_0x4f970f(0x25b)](_0xe0d755=>_0xe0d755[_0x4f970f(0x320)]))||[],_0x5b606d={'values':[]},_0x18f267=getPatternType(_0x4dd690['value']);_0x4e6478[_0x4f970f(0x324)](_0x126f2b=>{const _0x779b62=_0x4f970f;Range[_0x779b62(0x1c1)](_0x126f2b,(_0xbf66c1,_0x5e2000)=>{const _0x46cd28=_0x779b62;_0x5b606d[_0x46cd28(0x29d)][_0x46cd28(0x1f0)]({'row':_0xbf66c1,'col':_0x5e2000,'pattern':_0x4dd690[_0x46cd28(0x32b)],'type':_0x18f267});});}),_0xafc431['executeCommand'](SetNumfmtCommand['id'],_0x5b606d),_0x442984['close']();}else _0x4dd690[_0x4f970f(0x2e2)]===_0x4f970f(0x1e6)&&_0x442984[_0x4f970f(0x256)]();}},_0x2093e0(0x244)),'value':{'defaultPattern':_0x3a6027,'defaultValue':_0x30bbc5,'row':_0x435ebc['startRow'],'col':_0x435ebc[_0x2093e0(0x213)]}};return this[_0x2093e0(0x1d6)]=_0x442984['open']({'header':{'title':_0x50091a['t']('sheet.numfmt.title')},'children':{'label':SHEET_NUMFMT_PLUGIN,..._0xe45550},'onClose':__name(()=>{const _0x373cec=_0x2093e0;this[_0x373cec(0x21a)](),_0xafc431[_0x373cec(0x23a)](CloseNumfmtPanelOperator['id']);},_0x2093e0(0x2b8))}),!0x0;}[_0x186784(0x21a)](_0x46cd99){const _0x3fe7a5=_0x186784;var _0x4e2179;const _0x433cef=this[_0x3fe7a5(0x251)][_0x3fe7a5(0x1a6)](_0x46cd99!=null?_0x46cd99:this['_univerInstanceService']['getCurrentUnitForType'](UniverInstanceType['UNIVER_SHEET'])[_0x3fe7a5(0x217)]());_0x433cef==null||_0x433cef[_0x3fe7a5(0x2eb)](SheetSkeletonManagerService)[_0x3fe7a5(0x2c6)](),(_0x4e2179=_0x433cef==null?void 0x0:_0x433cef['mainComponent'])==null||_0x4e2179[_0x3fe7a5(0x209)]();}[_0x186784(0x2e7)](){const _0x4aeeff=_0x186784;[AddDecimalCommand,SubtractDecimalCommand,SetCurrencyCommand,SetPercentCommand,OpenNumfmtPanelOperator,CloseNumfmtPanelOperator,SetNumfmtCommand][_0x4aeeff(0x324)](_0x321923=>{const _0x11505a=_0x4aeeff;this[_0x11505a(0x1a3)](this['_commandService'][_0x11505a(0x1bc)](_0x321923));});}[_0x186784(0x248)](){const _0x101929=_0x186784;this[_0x101929(0x2e6)][_0x101929(0x1a0)](SHEET_NUMFMT_PLUGIN,SheetNumfmtPanel);}[_0x186784(0x1ca)](){const _0x2e11db=_0x186784,_0x52a37b=new Observable(_0x102f3d=>{const _0x10e94c=_0x5013;this[_0x10e94c(0x24d)][_0x10e94c(0x1b9)](_0x5b0fad=>{const _0x2114e3=_0x10e94c;_0x5b0fad['id']===OpenNumfmtPanelOperator['id']&&_0x102f3d[_0x2114e3(0x1a4)](!0x0),_0x5b0fad['id']===CloseNumfmtPanelOperator['id']&&_0x102f3d[_0x2114e3(0x1a4)](!0x1);});}),_0x6015b1=combineLatest([_0x52a37b,this[_0x2e11db(0x196)][_0x2e11db(0x287)][_0x2e11db(0x1c9)](map(_0x728ae4=>_0x728ae4?_0x728ae4[_0x2e11db(0x25b)](_0x2b15b5=>_0x2b15b5[_0x2e11db(0x320)]):[]))]);this[_0x2e11db(0x1a3)](toDisposable(_0x6015b1[_0x2e11db(0x1c9)](_0x7a9c40(([_0x1d0612,_0x7a83eb])=>new Observable(_0x442866=>{const _0x272540=_0x2e11db,_0x493962=new DisposableCollection();return _0x1d0612&&_0x7a83eb['length']&&_0x442866[_0x272540(0x1a4)]({'selectionRanges':_0x7a83eb,'disposableCollection':_0x493962}),()=>{_0x493962['dispose']();};})),tap(()=>{const _0x246cb0=_0x2e11db;this[_0x246cb0(0x2f3)]=null;}))[_0x2e11db(0x2df)](({disposableCollection:_0x30cf5e,selectionRanges:_0x1b261f})=>{const _0xbfb1fc=_0x2e11db;var _0x1f13b2,_0x1da6d6;const _0x220001=this[_0xbfb1fc(0x2ef)][_0xbfb1fc(0x2ad)](UniverInstanceType[_0xbfb1fc(0x1b5)]);this[_0xbfb1fc(0x1eb)](),_0x30cf5e[_0xbfb1fc(0x302)](this[_0xbfb1fc(0x21c)][_0xbfb1fc(0x2de)](INTERCEPTOR_POINT[_0xbfb1fc(0x322)],{'priority':0x63,'effect':InterceptorEffectEnum[_0xbfb1fc(0x2aa)]|InterceptorEffectEnum[_0xbfb1fc(0x1a8)],'handler':__name((_0x493fae,_0x46acbf,_0x5f47af)=>{const _0x4c4ca2=_0xbfb1fc,{row:_0x5853dc,col:_0x315498}=_0x46acbf,_0x4dd863=_0x5f47af(_0x493fae)||{};if(_0x1b261f[_0x4c4ca2(0x1ce)](_0x41fc8f=>_0x41fc8f[_0x4c4ca2(0x213)]<=_0x315498&&_0x41fc8f['endColumn']>=_0x315498&&_0x41fc8f['startRow']<=_0x5853dc&&_0x41fc8f['endRow']>=_0x5853dc)){const _0x2fe06c=_0x46acbf[_0x4c4ca2(0x234)][_0x4c4ca2(0x27e)](_0x5853dc,_0x315498),_0x584361=_0x2fe06c==null?void 0x0:_0x2fe06c['v'],_0x5409f4=_0x2fe06c==null?void 0x0:_0x2fe06c['t'];if(_0x584361==null||_0x5409f4!==CellValueType[_0x4c4ca2(0x19c)]||this[_0x4c4ca2(0x2f3)]===null)return _0x4dd863;const _0x4ee08a=getPatternPreviewIgnoreGeneral(this[_0x4c4ca2(0x2f3)],_0x584361,this['_localeService']['getCurrentLocale']());if(_0x4ee08a[_0x4c4ca2(0x1de)]){const _0x3b88ae=this[_0x4c4ca2(0x1fa)][_0x4c4ca2(0x2a5)]()[_0x4ee08a['color']+_0x4c4ca2(0x1b3)];return{..._0x4dd863,'v':_0x4ee08a[_0x4c4ca2(0x1f7)],'t':CellValueType[_0x4c4ca2(0x2c8)],'s':{'cl':{'rgb':_0x3b88ae}}};}return{..._0x4dd863,'v':_0x4ee08a[_0x4c4ca2(0x1f7)],'t':CellValueType['STRING']};}return _0x4dd863;},'handler')})),(_0x1da6d6=(_0x1f13b2=this[_0xbfb1fc(0x251)][_0xbfb1fc(0x1a6)](_0x220001[_0xbfb1fc(0x217)]()))==null?void 0x0:_0x1f13b2[_0xbfb1fc(0x23f)])==null||_0x1da6d6['makeDirty']();})));}[_0x186784(0x2ce)](){const _0x350043=_0x186784,_0x911f8a=[RemoveNumfmtMutation['id'],SetNumfmtMutation['id']];this['disposeWithMe'](new Observable(_0x714a9c=>{const _0x56373b=_0x5013,_0x46a1d5=this[_0x56373b(0x24d)][_0x56373b(0x1b9)](_0x438033=>{const _0x3eac60=_0x56373b;if(_0x911f8a[_0x3eac60(0x1ff)](_0x438033['id'])){const _0x36b26e=_0x438033[_0x3eac60(0x249)];_0x714a9c[_0x3eac60(0x1a4)](_0x36b26e[_0x3eac60(0x27f)]);}});return()=>_0x46a1d5[_0x56373b(0x325)]();})[_0x350043(0x1c9)](debounceTime(0x10))[_0x350043(0x2df)](_0x5cb3fe=>this['_forceUpdate'](_0x5cb3fe)));}[_0x186784(0x29a)](){const _0x54f955=_0x186784;this[_0x54f955(0x2ef)]['getCurrentTypeOfUnit$'](UniverInstanceType['UNIVER_SHEET'])['subscribe'](_0x3fc815=>{const _0x4786b4=_0x54f955;var _0x26f8d9;_0x3fc815||((_0x26f8d9=this[_0x4786b4(0x1d6)])==null||_0x26f8d9[_0x4786b4(0x325)](),this['_sidebarDisposable']=null);});}},__name(_a3,_0x186784(0x222)),_a3);NumfmtController=__decorateClass$3([__decorateParam$3(0x0,Inject(SheetInterceptorService)),__decorateParam$3(0x1,Inject(ThemeService)),__decorateParam$3(0x2,IUniverInstanceService),__decorateParam$3(0x3,ICommandService),__decorateParam$3(0x4,Inject(SheetsSelectionsService)),__decorateParam$3(0x5,IRenderManagerService),__decorateParam$3(0x6,INumfmtService),__decorateParam$3(0x7,Inject(ComponentManager)),__decorateParam$3(0x8,ISidebarService),__decorateParam$3(0x9,Inject(LocaleService))],NumfmtController);const _NumfmtCurrencyController=class _NumfmtCurrencyController extends Disposable{constructor(){const _0x110cce=_0x186784;super(...arguments),__publicField(this,'_currencySymbol$',new BehaviorSubject('US')),__publicField(this,_0x110cce(0x242),this[_0x110cce(0x327)][_0x110cce(0x25a)]());}[_0x186784(0x2ec)](_0xd315ce){const _0x160573=_0x186784;this[_0x160573(0x327)][_0x160573(0x1a4)](_0xd315ce);}['getCurrencySymbol'](){const _0xeae86e=_0x186784;return this[_0xeae86e(0x327)]['getValue']();}};__name(_NumfmtCurrencyController,_0x186784(0x1ee));let NumfmtCurrencyController=_NumfmtCurrencyController;var __defProp$2=Object[_0x186784(0x257)],__getOwnPropDesc$2=Object['getOwnPropertyDescriptor'],__decorateClass$2=__name((_0x1b218c,_0x4d1cac,_0x1c2275,_0x2a8f56)=>{const _0xdf2d24=_0x186784;for(var _0x51ad23=_0x2a8f56>0x1?void 0x0:_0x2a8f56?__getOwnPropDesc$2(_0x4d1cac,_0x1c2275):_0x4d1cac,_0x31f54d=_0x1b218c[_0xdf2d24(0x2d7)]-0x1,_0x48a024;_0x31f54d>=0x0;_0x31f54d--)(_0x48a024=_0x1b218c[_0x31f54d])&&(_0x51ad23=(_0x2a8f56?_0x48a024(_0x4d1cac,_0x1c2275,_0x51ad23):_0x48a024(_0x51ad23))||_0x51ad23);return _0x2a8f56&&_0x51ad23&&__defProp$2(_0x4d1cac,_0x1c2275,_0x51ad23),_0x51ad23;},_0x186784(0x290)),__decorateParam$2=__name((_0x5a12f6,_0x336151)=>(_0x1a4a31,_0x571333)=>_0x336151(_0x1a4a31,_0x571333,_0x5a12f6),_0x186784(0x28d));const createCollectEffectMutation=__name(()=>{const _0x6b3935=_0x186784;let _0x4d581d=[];return{'add':__name((_0x3b9cbf,_0x56ce66,_0x54bfe3,_0x4ad8dc,_0x5b90ac)=>_0x4d581d[_0x6b3935(0x1f0)]({'unitId':_0x3b9cbf,'subUnitId':_0x56ce66,'row':_0x54bfe3,'col':_0x4ad8dc,'value':_0x5b90ac}),'add'),'getEffects':__name(()=>_0x4d581d,_0x6b3935(0x1fd)),'clean':__name(()=>{_0x4d581d=[];},'clean')};},_0x186784(0x23c));var _a4;let NumfmtEditorController=(_a4=class extends Disposable{constructor(_0x1f916a,_0x12ce02,_0x575abf,_0x451893,_0x27ea50){const _0x460314=_0x186784;super(),__publicField(this,'_collectEffectMutation',createCollectEffectMutation()),(this[_0x460314(0x21c)]=_0x1f916a,this[_0x460314(0x22c)]=_0x12ce02,this['_univerInstanceService']=_0x575abf,this[_0x460314(0x2b3)]=_0x451893,this[_0x460314(0x264)]=_0x27ea50,this[_0x460314(0x2e1)](),this['_initInterceptorEditorEnd'](),this[_0x460314(0x313)]());}['_initInterceptorEditorStart'](){const _0x43d4da=_0x186784;this['_editorBridgeService']&&this['disposeWithMe'](toDisposable(this[_0x43d4da(0x264)][_0x43d4da(0x1b6)][_0x43d4da(0x2de)](this[_0x43d4da(0x264)][_0x43d4da(0x1b6)][_0x43d4da(0x1ab)]()[_0x43d4da(0x21f)],{'handler':__name((_0x4278a1,_0x2663f5,_0x3ed61f)=>{const _0x30f408=_0x43d4da,_0x484fe3=_0x2663f5[_0x30f408(0x1d5)],_0x6b404a=_0x2663f5[_0x30f408(0x32d)],_0x2e3ca0=this[_0x30f408(0x22c)][_0x30f408(0x301)](_0x2663f5['unitId'],_0x2663f5['subUnitId'],_0x484fe3,_0x6b404a);if(_0x2e3ca0)switch(getPatternType(_0x2e3ca0[_0x30f408(0x26f)])){case _0x30f408(0x300):case'currency':case _0x30f408(0x1f9):case _0x30f408(0x246):return _0x2663f5[_0x30f408(0x234)]['getCellRaw'](_0x484fe3,_0x6b404a);case _0x30f408(0x278):case _0x30f408(0x212):case _0x30f408(0x2ca):case _0x30f408(0x1e9):default:return _0x3ed61f&&_0x3ed61f(_0x4278a1);}return _0x3ed61f(_0x4278a1);},_0x43d4da(0x2e3))})));}[_0x186784(0x2dc)](){const _0x271c56=_0x186784;this['_editorBridgeService']&&this[_0x271c56(0x1a3)](toDisposable(this[_0x271c56(0x264)]['interceptor'][_0x271c56(0x2de)](this[_0x271c56(0x264)][_0x271c56(0x1b6)][_0x271c56(0x1ab)]()[_0x271c56(0x285)],{'handler':__name((_0x2b3d4c,_0x571cc6,_0x4be2af)=>{const _0x257d00=_0x271c56;var _0x408f97;this[_0x257d00(0x228)]['clean']();const _0x5b2167=this[_0x257d00(0x22c)][_0x257d00(0x301)](_0x571cc6['unitId'],_0x571cc6[_0x257d00(0x269)],_0x571cc6[_0x257d00(0x1d5)],_0x571cc6[_0x257d00(0x32d)]),_0x55f8df=(_0x408f97=_0x5b2167&&getPatternType(_0x5b2167['pattern']))!=null?_0x408f97:'',_0x4bdbb4=__name(()=>{const _0xc423b6=_0x257d00;_0x5b2167&&this['_collectEffectMutation'][_0xc423b6(0x302)](_0x571cc6[_0xc423b6(0x27f)],_0x571cc6['subUnitId'],_0x571cc6[_0xc423b6(0x1d5)],_0x571cc6[_0xc423b6(0x32d)],null);},_0x257d00(0x306));if(!(_0x2b3d4c!=null&&_0x2b3d4c['v']))return _0x4be2af(_0x2b3d4c);const _0x1d12ad=String(_0x2b3d4c['v']),_0x5c18d0=numfmt[_0x257d00(0x2a6)](_0x1d12ad)||numfmt[_0x257d00(0x226)](_0x1d12ad)||numfmt['parseNumber'](_0x1d12ad);if(_0x5c18d0){if(_0x5c18d0['z']){const _0x385871=Number(_0x5c18d0['v']);return this[_0x257d00(0x228)][_0x257d00(0x302)](_0x571cc6[_0x257d00(0x27f)],_0x571cc6[_0x257d00(0x269)],_0x571cc6[_0x257d00(0x1d5)],_0x571cc6['col'],{'pattern':_0x5c18d0['z']}),{..._0x2b3d4c,'v':_0x385871,'t':CellValueType['NUMBER']};}}else(['date',_0x257d00(0x2ca),_0x257d00(0x1e9),'percent'][_0x257d00(0x1ff)](_0x55f8df)||!isNumeric(_0x1d12ad))&&_0x4bdbb4();return _0x4be2af(_0x2b3d4c);},_0x271c56(0x2e3))})));}['_initInterceptorCommands'](){const _0x550307=_0x186784,_0x395309=this;this[_0x550307(0x1a3)](this['_sheetInterceptorService'][_0x550307(0x295)]({'getMutations'(_0x24db15){const _0x240c94=_0x550307;var _0x441f39;switch(_0x24db15['id']){case SetRangeValuesCommand['id']:{const _0x345266=_0x395309[_0x240c94(0x2ef)][_0x240c94(0x2ad)](UniverInstanceType['UNIVER_SHEET']),_0x4fb20d=_0x345266[_0x240c94(0x217)](),_0x520cb3=(_0x441f39=_0x345266[_0x240c94(0x2fc)]())==null?void 0x0:_0x441f39['getSheetId']();if(!_0x520cb3)return{'redos':[],'undos':[]};const _0x54fcc2=_0x395309[_0x240c94(0x228)]['getEffects']();if(_0x395309[_0x240c94(0x228)][_0x240c94(0x306)](),!_0x54fcc2['length'])return{'redos':[],'undos':[]};const _0x69f613=_0x54fcc2[_0x240c94(0x317)](_0x40f18a=>{const _0x1772be=_0x240c94;var _0xcc4324;return!!((_0xcc4324=_0x40f18a[_0x1772be(0x32b)])!=null&&_0xcc4324[_0x1772be(0x26f)]);})[_0x240c94(0x25b)](_0x5972b2=>({'row':_0x5972b2['row'],'col':_0x5972b2[_0x240c94(0x32d)],'pattern':_0x5972b2[_0x240c94(0x32b)][_0x240c94(0x26f)]})),_0x5e49d7=_0x54fcc2[_0x240c94(0x317)](_0x35b70a=>{const _0x1e0527=_0x240c94;var _0x380206;return!((_0x380206=_0x35b70a[_0x1e0527(0x32b)])!=null&&_0x380206[_0x1e0527(0x26f)]);})[_0x240c94(0x25b)](_0x484201=>({'startRow':_0x484201[_0x240c94(0x1d5)],'endColumn':_0x484201[_0x240c94(0x32d)],'startColumn':_0x484201[_0x240c94(0x32d)],'endRow':_0x484201[_0x240c94(0x1d5)]})),_0x498b51=[],_0x3f7fd1=[];if(_0x69f613['length']){const _0x5a0212={'id':SetNumfmtMutation['id'],'params':transformCellsToRange(_0x4fb20d,_0x520cb3,_0x69f613)};_0x498b51[_0x240c94(0x1f0)](_0x5a0212),_0x3f7fd1['push'](...factorySetNumfmtUndoMutation(_0x395309[_0x240c94(0x2b3)],_0x5a0212[_0x240c94(0x249)]));}if(_0x5e49d7[_0x240c94(0x2d7)]){const _0x1c9b21={'id':RemoveNumfmtMutation['id'],'params':{'unitId':_0x4fb20d,'subUnitId':_0x520cb3,'ranges':_0x5e49d7}};_0x498b51['push'](_0x1c9b21),_0x3f7fd1[_0x240c94(0x1f0)](...factoryRemoveNumfmtUndoMutation(_0x395309[_0x240c94(0x2b3)],_0x1c9b21[_0x240c94(0x249)]));}return{'redos':_0x498b51,'undos':_0x3f7fd1[_0x240c94(0x272)]()};}}return{'redos':[],'undos':[]};}}));}},__name(_a4,_0x186784(0x2b7)),_a4);NumfmtEditorController=__decorateClass$2([__decorateParam$2(0x0,Inject(SheetInterceptorService)),__decorateParam$2(0x1,Inject(INumfmtService)),__decorateParam$2(0x2,Inject(IUniverInstanceService)),__decorateParam$2(0x3,Inject(Injector)),__decorateParam$2(0x4,Optional(IEditorBridgeService))],NumfmtEditorController);function isNumeric(_0x642771){const _0x4cd1ad=_0x186784;return/^-?\d+(\.\d+)?$/[_0x4cd1ad(0x1cd)](_0x642771);}__name(isNumeric,'isNumeric');const MENU_OPTIONS=[{'label':'sheet.numfmt.general','pattern':null},{'label':'sheet.numfmt.text','pattern':DEFAULT_TEXT_FORMAT},'|',{'label':_0x186784(0x24a),'pattern':'0'},'|',{'label':_0x186784(0x2d3),'pattern':_0x186784(0x296)},{'label':_0x186784(0x1da),'pattern':'#,##0.00;[Red]#,##0.00'},{'label':_0x186784(0x267),'pattern':_0x186784(0x265)},{'label':'sheet.numfmt.roundingCurrency','pattern':'\x22¥\x22#,##0;[Red]\x22¥\x22#,##0'},'|',{'label':_0x186784(0x321),'pattern':'yyyy-mm-dd;@'},{'label':_0x186784(0x218),'pattern':'am/pm\x20h\x22:\x22mm\x22:\x22ss'},{'label':_0x186784(0x282),'pattern':_0x186784(0x1b1)},{'label':_0x186784(0x1d4),'pattern':_0x186784(0x245)},'|',{'label':_0x186784(0x240),'pattern':''}],MORE_NUMFMT_TYPE_KEY='sheet.numfmt.moreNumfmtType',OPTIONS_KEY='sheet.numfmt.moreNumfmtType.options',MoreNumfmtType=__name(_0x309276=>{const _0x508cad=_0x186784;var _0x389099;const _0x3d6177=useDependency(LocaleService),_0xa18b2b=(_0x389099=_0x309276[_0x508cad(0x32b)])!=null?_0x389099:_0x3d6177['t'](_0x508cad(0x1fe));return jsxRuntimeExports[_0x508cad(0x202)](_0x508cad(0x2db),{'className':_0x508cad(0x2cb),'children':_0xa18b2b});},_0x186784(0x198)),Options=__name(()=>{const _0x202da0=_0x186784,_0xac6d5e=useDependency(ICommandService),_0xc6f05d=useDependency(LocaleService),_0xd5593a=useDependency(ILayoutService);useInjector();const _0x222dde=useDependency(SheetsSelectionsService),_0x274053=__name(_0x1a56e4=>{const _0x199e9a=_0x5013,_0x12b1f0=_0x222dde['getCurrentLastSelection']();if(!_0x12b1f0)return;const _0x16a34d=_0x12b1f0[_0x199e9a(0x320)],_0x4ddc75=[];Range[_0x199e9a(0x1c1)](_0x16a34d,(_0x1048ac,_0x2b9e59)=>{const _0x26c141=_0x199e9a;_0x1a56e4?_0x4ddc75[_0x26c141(0x1f0)]({'row':_0x1048ac,'col':_0x2b9e59,'pattern':_0x1a56e4,'type':getPatternType(_0x1a56e4)}):_0x4ddc75[_0x26c141(0x1f0)]({'row':_0x1048ac,'col':_0x2b9e59});}),_0xac6d5e[_0x199e9a(0x23a)](SetNumfmtCommand['id'],{'values':_0x4ddc75}),_0xd5593a[_0x199e9a(0x2fe)]();},_0x202da0(0x315)),_0x3b8d0f=__name(_0x3ef3bb=>{const _0x4c62dd=_0x202da0;if(_0x3ef3bb===0x0)_0x274053(null);else{if(_0x3ef3bb===MENU_OPTIONS[_0x4c62dd(0x2d7)]-0x1)_0xac6d5e['executeCommand'](OpenNumfmtPanelOperator['id']);else{const _0x58ea4b=MENU_OPTIONS[_0x3ef3bb];_0x58ea4b['pattern']&&_0x274053(_0x58ea4b[_0x4c62dd(0x26f)]);}}},_0x202da0(0x270)),_0x736d96=0x4c4;return jsxRuntimeExports[_0x202da0(0x202)]('div',{'className':_0x202da0(0x1f8),'children':MENU_OPTIONS[_0x202da0(0x25b)]((_0x5b4832,_0x2c23fa)=>_0x5b4832==='|'?jsxRuntimeExports[_0x202da0(0x202)](_0x202da0(0x2fa),{'className':_0x202da0(0x294),'onClick':__name(_0x31edd7=>_0x31edd7[_0x202da0(0x1d7)](),'onClick')},_0x2c23fa):jsxRuntimeExports[_0x202da0(0x2bd)](_0x202da0(0x2fa),{'className':'option-item\x20m-t-4','onClick':__name(()=>{_0x3b8d0f(_0x2c23fa);},'onClick'),'children':[jsxRuntimeExports[_0x202da0(0x202)]('div',{'children':_0xc6f05d['t'](_0x5b4832['label'])}),jsxRuntimeExports[_0x202da0(0x202)](_0x202da0(0x2fa),{'className':'m-l-26','children':_0x5b4832['pattern']?getPatternPreview(_0x5b4832[_0x202da0(0x26f)]||'',_0x736d96,_0xc6f05d[_0x202da0(0x2d4)]())['result']:''})]},_0x2c23fa))});},_0x186784(0x273)),CurrencyMenuItem=__name(_0x7816fb=>({'icon':new Observable(_0x4f8371=>{const _0x452c24=_0x186784,_0x35857a=_0x7816fb[_0x452c24(0x2ff)](MenuCurrencyService);function _0x54b06d(_0x3d55f8){const _0x54d460=_0x452c24;return{[countryCurrencyMap['US']]:_0x54d460(0x311),[countryCurrencyMap['RU']]:_0x54d460(0x1f2),[countryCurrencyMap['CN']]:_0x54d460(0x289),[countryCurrencyMap['AT']]:'EuroSingle'}[_0x3d55f8]||_0x54d460(0x311);}__name(_0x54b06d,_0x452c24(0x2f8));const _0x3c0073=countryCurrencyMap[_0x35857a[_0x452c24(0x2a3)]()]||'$';return _0x4f8371['next'](_0x54b06d(_0x3c0073)),_0x35857a['currencySymbol$'][_0x452c24(0x2df)](_0x4c9734=>{const _0x3865e8=_0x452c24,_0x41efbf=countryCurrencyMap[_0x4c9734]||'$';_0x4f8371[_0x3865e8(0x1a4)](_0x54b06d(_0x41efbf));});}),'id':SetCurrencyCommand['id'],'title':_0x186784(0x267),'tooltip':_0x186784(0x267),'type':MenuItemType['BUTTON'],'hidden$':getMenuHiddenObservable(_0x7816fb,UniverInstanceType['UNIVER_SHEET']),'disabled$':getCurrentRangeDisable$(_0x7816fb,{'workbookTypes':[WorkbookEditablePermission],'worksheetTypes':[WorksheetEditPermission,WorksheetSetCellStylePermission],'rangeTypes':[RangeProtectionPermissionEditPoint]})}),_0x186784(0x31b)),AddDecimalMenuItem=__name(_0x2be9de=>({'icon':_0x186784(0x329),'id':AddDecimalCommand['id'],'title':_0x186784(0x310),'tooltip':_0x186784(0x310),'type':MenuItemType[_0x186784(0x21b)],'hidden$':getMenuHiddenObservable(_0x2be9de,UniverInstanceType['UNIVER_SHEET']),'disabled$':getCurrentRangeDisable$(_0x2be9de,{'workbookTypes':[WorkbookEditablePermission],'worksheetTypes':[WorksheetEditPermission,WorksheetSetCellStylePermission],'rangeTypes':[RangeProtectionPermissionEditPoint]})}),_0x186784(0x2ab)),SubtractDecimalMenuItem=__name(_0x4e1671=>({'icon':_0x186784(0x1c2),'id':SubtractDecimalCommand['id'],'title':'sheet.numfmt.subtractDecimal','tooltip':_0x186784(0x32c),'type':MenuItemType[_0x186784(0x21b)],'hidden$':getMenuHiddenObservable(_0x4e1671,UniverInstanceType['UNIVER_SHEET']),'disabled$':getCurrentRangeDisable$(_0x4e1671,{'workbookTypes':[WorkbookEditablePermission],'worksheetTypes':[WorksheetEditPermission,WorksheetSetCellStylePermission],'rangeTypes':[RangeProtectionPermissionEditPoint]})}),_0x186784(0x2b9)),PercentMenuItem=__name(_0x320092=>({'icon':_0x186784(0x207),'id':SetPercentCommand['id'],'title':_0x186784(0x281),'tooltip':_0x186784(0x281),'type':MenuItemType[_0x186784(0x21b)],'hidden$':getMenuHiddenObservable(_0x320092,UniverInstanceType[_0x186784(0x1b5)]),'disabled$':getCurrentRangeDisable$(_0x320092,{'workbookTypes':[WorkbookEditablePermission],'worksheetTypes':[WorksheetEditPermission,WorksheetSetCellStylePermission],'rangeTypes':[RangeProtectionPermissionEditPoint]})}),'PercentMenuItem'),FactoryOtherMenuItem=__name(_0x4169ed=>{const _0xef4c20=_0x186784,_0x5038ce=_0x4169ed['get'](IUniverInstanceService),_0x49aa45=_0x4169ed[_0xef4c20(0x2ff)](ICommandService),_0x7b7b29=_0x4169ed['get'](LocaleService),_0x444310=_0x4169ed[_0xef4c20(0x2ff)](SheetsSelectionsService),_0x9a7728=deriveStateFromActiveSheet$(_0x5038ce,'',({workbook:_0x3181ae,worksheet:_0x40bc09})=>new Observable(_0x40055f=>merge(_0x444310[_0xef4c20(0x287)],new Observable(_0x17a451=>{const _0x4ddbf8=_0xef4c20,_0x125c61=[RemoveNumfmtMutation['id'],SetNumfmtMutation['id']],_0x26af37=_0x49aa45[_0x4ddbf8(0x1b9)](_0x51b572=>{const _0x36fec4=_0x4ddbf8;_0x125c61['includes'](_0x51b572['id'])&&_0x17a451[_0x36fec4(0x1a4)](null);});return()=>_0x26af37[_0x4ddbf8(0x325)]();}))['subscribe'](()=>{const _0x3f9add=_0xef4c20;var _0x8b9917,_0x4b816c;const _0x478811=_0x444310[_0x3f9add(0x1c0)]();if(_0x478811&&_0x478811[0x0]){const _0x38664c=_0x478811[0x0][_0x3f9add(0x320)],_0x153d0d=_0x38664c[_0x3f9add(0x20d)],_0x3c1fdc=_0x38664c[_0x3f9add(0x213)],_0x550908=(_0x4b816c=_0x3181ae[_0x3f9add(0x1bd)]()[_0x3f9add(0x2ff)]((_0x8b9917=_0x40bc09[_0x3f9add(0x2b1)](_0x153d0d,_0x3c1fdc))==null?void 0x0:_0x8b9917['s']))==null?void 0x0:_0x4b816c['n'],_0x57f805=_0x550908==null?void 0x0:_0x550908[_0x3f9add(0x26f)];let _0x37894b=_0x7b7b29['t'](_0x3f9add(0x1fe));if(_0x57f805){const _0x53c8ff=MENU_OPTIONS['filter'](_0x19e91d=>typeof _0x19e91d==_0x3f9add(0x2bf)&&_0x19e91d[_0x3f9add(0x26f)])[_0x3f9add(0x1ce)](_0x40329d=>isPatternEqualWithoutDecimal(_0x57f805,_0x40329d[_0x3f9add(0x26f)]));_0x53c8ff&&typeof _0x53c8ff==_0x3f9add(0x2bf)&&_0x53c8ff[_0x3f9add(0x26f)]?_0x37894b=_0x7b7b29['t'](_0x53c8ff[_0x3f9add(0x211)]):_0x37894b=_0x7b7b29['t'](_0x3f9add(0x240));}_0x40055f[_0x3f9add(0x1a4)](_0x37894b);}})));return{'label':MORE_NUMFMT_TYPE_KEY,'id':OpenNumfmtPanelOperator['id'],'tooltip':_0xef4c20(0x291),'type':MenuItemType[_0xef4c20(0x1a5)],'selections':[{'label':{'name':OPTIONS_KEY,'hoverable':!0x1}}],'value$':_0x9a7728,'hidden$':getMenuHiddenObservable(_0x4169ed,UniverInstanceType['UNIVER_SHEET']),'disabled$':getCurrentRangeDisable$(_0x4169ed,{'workbookTypes':[WorkbookEditablePermission],'worksheetTypes':[WorksheetSetCellStylePermission,WorksheetEditPermission],'rangeTypes':[RangeProtectionPermissionEditPoint]})};},_0x186784(0x2ed)),menuSchema={[RibbonStartGroup[_0x186784(0x1fc)]]:{[SetCurrencyCommand['id']]:{'order':0x4,'menuItemFactory':CurrencyMenuItem},[AddDecimalCommand['id']]:{'order':0x5,'menuItemFactory':AddDecimalMenuItem},[SubtractDecimalCommand['id']]:{'order':0x6,'menuItemFactory':SubtractDecimalMenuItem},[SetPercentCommand['id']]:{'order':0x7,'menuItemFactory':PercentMenuItem},[OpenNumfmtPanelOperator['id']]:{'order':0x8,'menuItemFactory':FactoryOtherMenuItem}}};var __defProp$1=Object[_0x186784(0x257)],__getOwnPropDesc$1=Object[_0x186784(0x283)],__decorateClass$1=__name((_0x496b79,_0x157d8c,_0x4171a2,_0xec0ae)=>{const _0x5bf0e9=_0x186784;for(var _0x329fd=_0xec0ae>0x1?void 0x0:_0xec0ae?__getOwnPropDesc$1(_0x157d8c,_0x4171a2):_0x157d8c,_0x46a1cd=_0x496b79[_0x5bf0e9(0x2d7)]-0x1,_0x50f4ee;_0x46a1cd>=0x0;_0x46a1cd--)(_0x50f4ee=_0x496b79[_0x46a1cd])&&(_0x329fd=(_0xec0ae?_0x50f4ee(_0x157d8c,_0x4171a2,_0x329fd):_0x50f4ee(_0x329fd))||_0x329fd);return _0xec0ae&&_0x329fd&&__defProp$1(_0x157d8c,_0x4171a2,_0x329fd),_0x329fd;},_0x186784(0x231)),__decorateParam$1=__name((_0x36085a,_0x28009c)=>(_0x7a143a,_0x255b9a)=>_0x28009c(_0x7a143a,_0x255b9a,_0x36085a),_0x186784(0x268)),_a5;let NumfmtMenuController=(_a5=class extends Disposable{constructor(_0x218f49,_0xb1075d){const _0x253869=_0x186784;super(),this['_componentManager']=_0x218f49,this[_0x253869(0x1c5)]=_0xb1075d,this[_0x253869(0x28c)]();}['_initMenu'](){const _0x16c749=_0x186784;this[_0x16c749(0x1c5)]['mergeMenu'](menuSchema),this['disposeWithMe'](this[_0x16c749(0x2e6)][_0x16c749(0x1a0)](MORE_NUMFMT_TYPE_KEY,MoreNumfmtType)),this['disposeWithMe'](this[_0x16c749(0x2e6)]['register'](OPTIONS_KEY,Options));}},__name(_a5,'NumfmtMenuController'),_a5);NumfmtMenuController=__decorateClass$1([__decorateParam$1(0x0,Inject(ComponentManager)),__decorateParam$1(0x1,IMenuManagerService)],NumfmtMenuController);var __defProp2=Object[_0x186784(0x257)],__getOwnPropDesc=Object[_0x186784(0x283)],__defNormalProp2=__name((_0x1cc554,_0x27931f,_0x48a398)=>_0x27931f in _0x1cc554?__defProp2(_0x1cc554,_0x27931f,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x48a398}):_0x1cc554[_0x27931f]=_0x48a398,'__defNormalProp'),__decorateClass=__name((_0x6133fe,_0x1b431e,_0x16b992,_0x3efc78)=>{const _0x43366a=_0x186784;for(var _0x5657b9=_0x3efc78>0x1?void 0x0:_0x3efc78?__getOwnPropDesc(_0x1b431e,_0x16b992):_0x1b431e,_0x4cc2eb=_0x6133fe[_0x43366a(0x2d7)]-0x1,_0x1d1182;_0x4cc2eb>=0x0;_0x4cc2eb--)(_0x1d1182=_0x6133fe[_0x4cc2eb])&&(_0x5657b9=(_0x3efc78?_0x1d1182(_0x1b431e,_0x16b992,_0x5657b9):_0x1d1182(_0x5657b9))||_0x5657b9);return _0x3efc78&&_0x5657b9&&__defProp2(_0x1b431e,_0x16b992,_0x5657b9),_0x5657b9;},_0x186784(0x1b0)),__decorateParam=__name((_0x3d455c,_0x313e1b)=>(_0x2f4c8b,_0x409621)=>_0x313e1b(_0x2f4c8b,_0x409621,_0x3d455c),_0x186784(0x314)),__publicField2=__name((_0x55cf23,_0x2aafae,_0xb0f927)=>__defNormalProp2(_0x55cf23,typeof _0x2aafae!=_0x186784(0x215)?_0x2aafae+'':_0x2aafae,_0xb0f927),_0x186784(0x2a4)),_a6;let UniverSheetsNumfmtPlugin=(_a6=class extends Plugin{constructor(_0x545555=defaultPluginConfig,_0x3105bb,_0xb9ded5){const _0x56a3ca=_0x186784;super(),this[_0x56a3ca(0x247)]=_0x545555,this[_0x56a3ca(0x2b3)]=_0x3105bb,this[_0x56a3ca(0x25c)]=_0xb9ded5;const {menu:_0x22d673,..._0xa932f9}=this['_config'];_0x22d673&&this[_0x56a3ca(0x25c)][_0x56a3ca(0x1d3)]('menu',_0x22d673,{'merge':!0x0}),this[_0x56a3ca(0x25c)][_0x56a3ca(0x1d3)](PLUGIN_CONFIG_KEY,_0xa932f9);}['onStarting'](){const _0x1d8d9f=_0x186784;this[_0x1d8d9f(0x2b3)][_0x1d8d9f(0x302)]([INumfmtController,{'useClass':NumfmtController,'lazy':!0x1}]),this[_0x1d8d9f(0x2b3)]['add']([NumfmtEditorController]),this[_0x1d8d9f(0x2b3)][_0x1d8d9f(0x302)]([UserHabitController]),this[_0x1d8d9f(0x2b3)][_0x1d8d9f(0x302)]([SheetsNumfmtCellContentController]),this[_0x1d8d9f(0x2b3)][_0x1d8d9f(0x302)]([MenuCurrencyService]),this[_0x1d8d9f(0x2b3)][_0x1d8d9f(0x302)]([NumfmtCurrencyController]),this[_0x1d8d9f(0x2b3)][_0x1d8d9f(0x302)]([NumfmtMenuController]);}[_0x186784(0x1a1)](){const _0x5b4581=_0x186784;this['_injector']['get'](INumfmtController),this[_0x5b4581(0x2b3)][_0x5b4581(0x2ff)](SheetsNumfmtCellContentController),this[_0x5b4581(0x2b3)][_0x5b4581(0x2ff)](NumfmtCurrencyController),this[_0x5b4581(0x2b3)][_0x5b4581(0x2ff)](NumfmtEditorController),this[_0x5b4581(0x2b3)]['get'](NumfmtMenuController);}},__name(_a6,'UniverSheetsNumfmtPlugin'),_a6);__publicField2(UniverSheetsNumfmtPlugin,_0x186784(0x299),SHEET_NUMFMT_PLUGIN),__publicField2(UniverSheetsNumfmtPlugin,_0x186784(0x2e2),UniverInstanceType[_0x186784(0x1b5)]),UniverSheetsNumfmtPlugin=__decorateClass([DependentOn(UniverSheetsPlugin,UniverSheetsUIPlugin),__decorateParam(0x1,Inject(Injector)),__decorateParam(0x2,IConfigService)],UniverSheetsNumfmtPlugin);export{AddDecimalCommand,CloseNumfmtPanelOperator,MenuCurrencyService,OpenNumfmtPanelOperator,SetCurrencyCommand,SetNumfmtCommand,SetPercentCommand,SubtractDecimalCommand,UniverSheetsNumfmtPlugin,countryCurrencyMap,getPatternPreview,getPatternType};