@univerjs/core 1.0.0-alpha.3 → 1.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/lib/cjs/index.js +3899 -92
  2. package/lib/es/index.js +3902 -93
  3. package/lib/index.js +3902 -93
  4. package/lib/types/docs/data-model/index.d.ts +2 -1
  5. package/lib/types/docs/data-model/rich-text-builder.d.ts +186 -0
  6. package/lib/types/docs/data-model/text-x/build-utils/drawings.d.ts +2 -2
  7. package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +1 -0
  8. package/lib/types/shared/numfmt/api.d.ts +82 -0
  9. package/lib/types/shared/numfmt/clamp.d.ts +16 -0
  10. package/lib/types/shared/numfmt/code-to-locale.d.ts +16 -0
  11. package/lib/types/shared/numfmt/constants.d.ts +68 -0
  12. package/lib/types/shared/numfmt/dec-to-frac.d.ts +26 -0
  13. package/lib/types/shared/numfmt/decimal.d.ts +37 -0
  14. package/lib/types/shared/numfmt/format-info.d.ts +21 -0
  15. package/lib/types/shared/numfmt/format-number.d.ts +18 -0
  16. package/lib/types/shared/numfmt/general.d.ts +18 -0
  17. package/lib/types/shared/numfmt/index.d.ts +18 -0
  18. package/lib/types/shared/numfmt/locale.d.ts +89 -0
  19. package/lib/types/shared/numfmt/num-dec.d.ts +17 -0
  20. package/lib/types/shared/numfmt/number-props.d.ts +17 -0
  21. package/lib/types/shared/numfmt/options.d.ts +17 -0
  22. package/lib/types/shared/numfmt/pad.d.ts +22 -0
  23. package/lib/types/shared/numfmt/parse-format-section.d.ts +17 -0
  24. package/lib/types/shared/numfmt/parse-pattern.d.ts +18 -0
  25. package/lib/types/shared/numfmt/parse-value.d.ts +30 -0
  26. package/lib/types/shared/numfmt/round.d.ts +26 -0
  27. package/lib/types/shared/numfmt/run-part.d.ts +18 -0
  28. package/lib/types/shared/numfmt/serial-date.d.ts +32 -0
  29. package/lib/types/shared/numfmt/to-ymd.d.ts +20 -0
  30. package/lib/types/shared/numfmt/tokenize.d.ts +20 -0
  31. package/lib/types/shared/numfmt/types.d.ts +193 -0
  32. package/lib/types/shared/{numfmt.d.ts → numfmt/utils.d.ts} +3 -4
  33. package/lib/types/types/interfaces/i-document-data.d.ts +4 -0
  34. package/lib/types/types/interfaces/i-style-data.d.ts +3 -1
  35. package/lib/umd/index.js +21 -19
  36. package/package.json +4 -5
package/lib/es/index.js CHANGED
@@ -2,8 +2,7 @@ import { BehaviorSubject, Observable, ReplaySubject, Subject, Subscription, comb
2
2
  import { ObjectScope, UnitRole, UniverType as UniverInstanceType } from "@univerjs/protocol";
3
3
  import { debounceTime as debounceTime$1, filter as filter$1, first, map as map$1 } from "rxjs/operators";
4
4
  import { Inject, Inject as Inject$1, InjectSelf, Injector, Injector as Injector$1, LookUp, Many, Optional, Quantity, RediError, Self, SkipSelf, WithNew, createIdentifier, createIdentifier as createIdentifier$1, forwardRef, isAsyncDependencyItem, isAsyncHook, isClassDependencyItem, isCtor, isDisposable, isFactoryDependencyItem, isValueDependencyItem, setDependencies } from "@wendellhu/redi";
5
- import { debounce, get, merge, mergeWith, mergeWith as mergeWith$1, set } from "lodash-es";
6
- import * as numfmt from "numfmt";
5
+ import { debounce, get, merge, mergeWith, set } from "lodash-es";
7
6
  import RBush, { default as RBush$1 } from "rbush";
8
7
  import AsyncLock from "async-lock";
9
8
  import * as json1 from "ot-json1";
@@ -11,6 +10,23 @@ import fastDiff from "fast-diff";
11
10
  import { defaultTheme } from "@univerjs/themes";
12
11
  import KDBush from "kdbush";
13
12
 
13
+ //#region \0rolldown/runtime.js
14
+ var __defProp = Object.defineProperty;
15
+ var __exportAll = (all, no_symbols) => {
16
+ let target = {};
17
+ for (var name in all) {
18
+ __defProp(target, name, {
19
+ get: all[name],
20
+ enumerable: true
21
+ });
22
+ }
23
+ if (!no_symbols) {
24
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
25
+ }
26
+ return target;
27
+ };
28
+
29
+ //#endregion
14
30
  //#region src/common/shims.ts
15
31
  /**
16
32
  * Copyright 2023-present DreamNum Co., Ltd.
@@ -1698,7 +1714,7 @@ let ThemeColors = /* @__PURE__ */ function(ThemeColors) {
1698
1714
  //#endregion
1699
1715
  //#region package.json
1700
1716
  var name = "@univerjs/core";
1701
- var version = "1.0.0-alpha.3";
1717
+ var version = "1.0.0-alpha.5";
1702
1718
 
1703
1719
  //#endregion
1704
1720
  //#region src/common/array.ts
@@ -3869,79 +3885,3516 @@ let DOC_RANGE_TYPE = /* @__PURE__ */ function(DOC_RANGE_TYPE) {
3869
3885
  return DOC_RANGE_TYPE;
3870
3886
  }({});
3871
3887
  /**
3872
- * Determines whether the cell(row, column) is within the range of the merged cells.
3873
- * @deprecated please use worksheet.getCellInfoInMergeData instead
3888
+ * Determines whether the cell(row, column) is within the range of the merged cells.
3889
+ * @deprecated please use worksheet.getCellInfoInMergeData instead
3890
+ */
3891
+ function getCellInfoInMergeData(row, column, mergeData) {
3892
+ let isMerged = false;
3893
+ let isMergedMainCell = false;
3894
+ let newEndRow = row;
3895
+ let newEndColumn = column;
3896
+ let mergeRow = row;
3897
+ let mergeColumn = column;
3898
+ if (mergeData == null) return {
3899
+ actualRow: row,
3900
+ actualColumn: column,
3901
+ isMergedMainCell,
3902
+ isMerged,
3903
+ endRow: newEndRow,
3904
+ endColumn: newEndColumn,
3905
+ startRow: mergeRow,
3906
+ startColumn: mergeColumn
3907
+ };
3908
+ for (let i = 0; i < mergeData.length; i++) {
3909
+ const { startRow: startRowMarge, endRow: endRowMarge, startColumn: startColumnMarge, endColumn: endColumnMarge } = mergeData[i];
3910
+ if (row === startRowMarge && column === startColumnMarge) {
3911
+ newEndRow = endRowMarge;
3912
+ newEndColumn = endColumnMarge;
3913
+ mergeRow = startRowMarge;
3914
+ mergeColumn = startColumnMarge;
3915
+ isMergedMainCell = true;
3916
+ break;
3917
+ }
3918
+ if (row >= startRowMarge && row <= endRowMarge && column >= startColumnMarge && column <= endColumnMarge) {
3919
+ newEndRow = endRowMarge;
3920
+ newEndColumn = endColumnMarge;
3921
+ mergeRow = startRowMarge;
3922
+ mergeColumn = startColumnMarge;
3923
+ isMerged = true;
3924
+ break;
3925
+ }
3926
+ }
3927
+ return {
3928
+ actualRow: row,
3929
+ actualColumn: column,
3930
+ isMergedMainCell,
3931
+ isMerged,
3932
+ endRow: newEndRow,
3933
+ endColumn: newEndColumn,
3934
+ startRow: mergeRow,
3935
+ startColumn: mergeColumn
3936
+ };
3937
+ }
3938
+ let CellModeEnum = /* @__PURE__ */ function(CellModeEnum) {
3939
+ CellModeEnum["Raw"] = "raw";
3940
+ CellModeEnum["Intercepted"] = "intercepted";
3941
+ CellModeEnum["Both"] = "both";
3942
+ return CellModeEnum;
3943
+ }({});
3944
+
3945
+ //#endregion
3946
+ //#region src/types/const/theme-color-map.ts
3947
+ const THEME_COLORS = { ["Office"]: {
3948
+ [4]: "#4472C4",
3949
+ [5]: "#ED7D31",
3950
+ [6]: "#A5A5A5",
3951
+ [7]: "#70AD47",
3952
+ [8]: "#5B9BD5",
3953
+ [9]: "#70AD47",
3954
+ [0]: "#000000",
3955
+ [2]: "#44546A",
3956
+ [1]: "#FFFFFF",
3957
+ [3]: "#E7E6E6",
3958
+ [10]: "#0563C1",
3959
+ [11]: "#954F72"
3960
+ } };
3961
+
3962
+ //#endregion
3963
+ //#region src/shared/numfmt/constants.ts
3964
+ const MAX_S_DATE = 2958466;
3965
+ const MIN_L_DATE = -694324;
3966
+ const MAX_L_DATE = 35830291;
3967
+ const TOKEN_GENERAL = "general";
3968
+ const TOKEN_HASH = "hash";
3969
+ const TOKEN_ZERO = "zero";
3970
+ const TOKEN_QMARK = "qmark";
3971
+ const TOKEN_SLASH = "slash";
3972
+ const TOKEN_GROUP = "group";
3973
+ const TOKEN_SCALE = "scale";
3974
+ const TOKEN_COMMA = "comma";
3975
+ const TOKEN_BREAK = "break";
3976
+ const TOKEN_TEXT = "text";
3977
+ const TOKEN_PLUS = "plus";
3978
+ const TOKEN_MINUS = "minus";
3979
+ const TOKEN_POINT = "point";
3980
+ const TOKEN_SPACE = "space";
3981
+ const TOKEN_PERCENT = "percent";
3982
+ const TOKEN_DIGIT = "digit";
3983
+ const TOKEN_CALENDAR = "calendar";
3984
+ const TOKEN_ERROR = "error";
3985
+ const TOKEN_DATETIME = "datetime";
3986
+ const TOKEN_DURATION = "duration";
3987
+ const TOKEN_CONDITION = "condition";
3988
+ const TOKEN_DBNUM = "dbnum";
3989
+ const TOKEN_NATNUM = "natnum";
3990
+ const TOKEN_LOCALE = "locale";
3991
+ const TOKEN_COLOR = "color";
3992
+ const TOKEN_MODIFIER = "modifier";
3993
+ const TOKEN_AMPM = "ampm";
3994
+ const TOKEN_ESCAPED = "escaped";
3995
+ const TOKEN_STRING = "string";
3996
+ const TOKEN_SKIP = "skip";
3997
+ const TOKEN_FILL = "fill";
3998
+ const TOKEN_PAREN = "paren";
3999
+ const TOKEN_CHAR = "char";
4000
+ const indexColors = [
4001
+ "#000000",
4002
+ "#FFFFFF",
4003
+ "#FF0000",
4004
+ "#00FF00",
4005
+ "#0000FF",
4006
+ "#FFFF00",
4007
+ "#FF00FF",
4008
+ "#00FFFF",
4009
+ "#800000",
4010
+ "#008000",
4011
+ "#000080",
4012
+ "#808000",
4013
+ "#800080",
4014
+ "#008080",
4015
+ "#C0C0C0",
4016
+ "#808080",
4017
+ "#9999FF",
4018
+ "#993366",
4019
+ "#FFFFCC",
4020
+ "#CCFFFF",
4021
+ "#660066",
4022
+ "#FF8080",
4023
+ "#0066CC",
4024
+ "#CCCCFF",
4025
+ "#000080",
4026
+ "#FF00FF",
4027
+ "#FFFF00",
4028
+ "#00FFFF",
4029
+ "#800080",
4030
+ "#800000",
4031
+ "#008080",
4032
+ "#0000FF",
4033
+ "#00CCFF",
4034
+ "#CCFFFF",
4035
+ "#CCFFCC",
4036
+ "#FFFF99",
4037
+ "#99CCFF",
4038
+ "#FF99CC",
4039
+ "#CC99FF",
4040
+ "#FFCC99",
4041
+ "#3366FF",
4042
+ "#33CCCC",
4043
+ "#99CC00",
4044
+ "#FFCC00",
4045
+ "#FF9900",
4046
+ "#FF6600",
4047
+ "#666699",
4048
+ "#969696",
4049
+ "#003366",
4050
+ "#339966",
4051
+ "#003300",
4052
+ "#333300",
4053
+ "#993300",
4054
+ "#993366",
4055
+ "#333399",
4056
+ "#333333"
4057
+ ];
4058
+ const currencySymbols$1 = [
4059
+ "¤",
4060
+ "$",
4061
+ "£",
4062
+ "¥",
4063
+ "֏",
4064
+ "؋",
4065
+ "৳",
4066
+ "฿",
4067
+ "៛",
4068
+ "₡",
4069
+ "₦",
4070
+ "₩",
4071
+ "₪",
4072
+ "₫",
4073
+ "€",
4074
+ "₭",
4075
+ "₮",
4076
+ "₱",
4077
+ "₲",
4078
+ "₴",
4079
+ "₸",
4080
+ "₹",
4081
+ "₺",
4082
+ "₼",
4083
+ "₽",
4084
+ "₾",
4085
+ "₿"
4086
+ ];
4087
+ const reCurrencySymbols = new RegExp(`[${currencySymbols$1.join("")}]`);
4088
+
4089
+ //#endregion
4090
+ //#region src/shared/numfmt/format-info.ts
4091
+ function isParsedSection$1(part) {
4092
+ return !!part && "scale" in part;
4093
+ }
4094
+ function isGenerated(part) {
4095
+ return !!part && "generated" in part && Boolean(part.generated);
4096
+ }
4097
+ function isPercent(partitions) {
4098
+ return !!(isParsedSection$1(partitions[0]) && partitions[0].percent || isParsedSection$1(partitions[1]) && partitions[1].percent || isParsedSection$1(partitions[2]) && partitions[2].percent || isParsedSection$1(partitions[3]) && partitions[3].percent);
4099
+ }
4100
+ function isDate(partitions) {
4101
+ return !!(isParsedSection$1(partitions[0]) && partitions[0].date || isParsedSection$1(partitions[1]) && partitions[1].date || isParsedSection$1(partitions[2]) && partitions[2].date || isParsedSection$1(partitions[3]) && partitions[3].date);
4102
+ }
4103
+ function isText(partitions) {
4104
+ const [part1, part2, part3, part4] = partitions;
4105
+ return !!((!part1 || isGenerated(part1)) && (!part2 || isGenerated(part2)) && (!part3 || isGenerated(part3)) && isParsedSection$1(part4) && part4.text && !isGenerated(part4));
4106
+ }
4107
+ const level = {
4108
+ text: 15,
4109
+ datetime: 10.8,
4110
+ date: 10.8,
4111
+ time: 10.8,
4112
+ percent: 10.6,
4113
+ currency: 10.4,
4114
+ grouped: 10.2,
4115
+ scientific: 6,
4116
+ number: 4,
4117
+ fraction: 2,
4118
+ general: 0,
4119
+ error: 0
4120
+ };
4121
+ const dateCodes = [
4122
+ ["DMY", 1],
4123
+ ["DM", 2],
4124
+ ["MY", 3],
4125
+ ["MDY", 4],
4126
+ ["MD", 5],
4127
+ ["hmsa", 6],
4128
+ ["hma", 7],
4129
+ ["hms", 8],
4130
+ ["hm", 9]
4131
+ ];
4132
+ function info(partitions, currencyId = null) {
4133
+ var _positive$scale;
4134
+ const [partPositive, partNegative] = partitions;
4135
+ if (!partPositive) throw new TypeError("Cannot read properties of undefined (reading 'frac_max')");
4136
+ const positive = isParsedSection$1(partPositive) ? partPositive : void 0;
4137
+ const negative = isParsedSection$1(partNegative) ? partNegative : void 0;
4138
+ const isError = "error" in partPositive;
4139
+ const fracMax = positive === null || positive === void 0 ? void 0 : positive.frac_max;
4140
+ const output = {
4141
+ type: "general",
4142
+ isDate: isDate(partitions),
4143
+ isText: isText(partitions),
4144
+ isPercent: isPercent(partitions),
4145
+ maxDecimals: (positive === null || positive === void 0 ? void 0 : positive.general) ? 9 : fracMax !== null && fracMax !== void 0 ? fracMax : 0,
4146
+ scale: (_positive$scale = positive === null || positive === void 0 ? void 0 : positive.scale) !== null && _positive$scale !== void 0 ? _positive$scale : 1,
4147
+ color: 0,
4148
+ parentheses: 0,
4149
+ grouped: (positive === null || positive === void 0 ? void 0 : positive.grouping) ? 1 : 0,
4150
+ code: "",
4151
+ level: 0
4152
+ };
4153
+ const isCurrency = !output.isDate && !output.isText && !isError && partPositive.tokens.some((token) => token.type === "string" && typeof token.value === "string" && (currencyId ? token.value === currencyId : reCurrencySymbols.test(token.value)));
4154
+ let codeType = "G";
4155
+ let codeNumber = fracMax !== void 0 && fracMax >= 0 ? Math.min(15, fracMax) : "";
4156
+ let codeParentheses = "";
4157
+ let codeDash = "";
4158
+ if (negative === null || negative === void 0 ? void 0 : negative.color) {
4159
+ codeDash = "-";
4160
+ output.color = 1;
4161
+ }
4162
+ if (positive === null || positive === void 0 ? void 0 : positive.parens) {
4163
+ codeParentheses = "()";
4164
+ output.parentheses = 1;
4165
+ }
4166
+ if (isCurrency) {
4167
+ codeType = "C";
4168
+ output.type = "currency";
4169
+ } else if (isError) {
4170
+ output.type = "error";
4171
+ output.maxDecimals = 0;
4172
+ } else if (output.isDate) {
4173
+ let haveTime = 0;
4174
+ let haveDate = 0;
4175
+ let order = "";
4176
+ partPositive.tokens.forEach((token) => {
4177
+ const type = token.type;
4178
+ if (/^(b-)?year/.test(type)) {
4179
+ order += "Y";
4180
+ haveDate++;
4181
+ } else if (type.startsWith("month")) {
4182
+ order += "M";
4183
+ haveDate++;
4184
+ } else if (/^(week)?day/.test(type)) {
4185
+ order += "D";
4186
+ haveDate++;
4187
+ } else if (type === "hour" || type === "min" || type === "sec" || type === "ampm") {
4188
+ order += type[0];
4189
+ haveTime++;
4190
+ }
4191
+ });
4192
+ output.type = "date";
4193
+ if (haveDate && haveTime) output.type = "datetime";
4194
+ else if (!haveDate && haveTime) output.type = "time";
4195
+ const code = dateCodes.find(([prefix]) => order.startsWith(prefix));
4196
+ codeType = code ? "D" : "G";
4197
+ codeNumber = code ? code[1] : "";
4198
+ } else if (output.isText) {
4199
+ codeType = "G";
4200
+ output.type = "text";
4201
+ codeNumber = "";
4202
+ output.maxDecimals = 0;
4203
+ } else if (positive === null || positive === void 0 ? void 0 : positive.general) {
4204
+ codeType = "G";
4205
+ output.type = "general";
4206
+ codeNumber = "";
4207
+ } else if (positive === null || positive === void 0 ? void 0 : positive.fractions) {
4208
+ codeType = "G";
4209
+ output.type = "fraction";
4210
+ codeNumber = "";
4211
+ } else if (positive === null || positive === void 0 ? void 0 : positive.exponential) {
4212
+ codeType = "S";
4213
+ output.type = "scientific";
4214
+ } else if (output.isPercent) {
4215
+ codeType = "P";
4216
+ output.type = "percent";
4217
+ } else if (positive === null || positive === void 0 ? void 0 : positive.grouping) {
4218
+ codeType = ",";
4219
+ output.type = "grouped";
4220
+ } else if (positive && (positive.int_max || fracMax)) {
4221
+ codeType = "F";
4222
+ output.type = "number";
4223
+ }
4224
+ output.code = codeType + codeNumber + codeDash + codeParentheses;
4225
+ output.level = level[output.type];
4226
+ return Object.freeze(output);
4227
+ }
4228
+ function dateInfo(partitions) {
4229
+ var _positive$date;
4230
+ const [partPositive] = partitions;
4231
+ if (!partPositive) throw new TypeError("Cannot read properties of undefined (reading 'date')");
4232
+ const positive = isParsedSection$1(partPositive) ? partPositive : void 0;
4233
+ const date = (_positive$date = positive === null || positive === void 0 ? void 0 : positive.date) !== null && _positive$date !== void 0 ? _positive$date : 0;
4234
+ return {
4235
+ year: !!(date & 2),
4236
+ month: !!(date & 4),
4237
+ day: !!(date & 8),
4238
+ hours: !!(date & 16),
4239
+ minutes: !!(date & 32),
4240
+ seconds: !!(date & 64),
4241
+ clockType: (positive === null || positive === void 0 ? void 0 : positive.clock) === 12 ? 12 : 24
4242
+ };
4243
+ }
4244
+
4245
+ //#endregion
4246
+ //#region src/shared/numfmt/decimal.ts
4247
+ /**
4248
+ * Copyright 2023-present DreamNum Co., Ltd.
4249
+ *
4250
+ * Licensed under the Apache License, Version 2.0 (the "License");
4251
+ * you may not use this file except in compliance with the License.
4252
+ * You may obtain a copy of the License at
4253
+ *
4254
+ * http://www.apache.org/licenses/LICENSE-2.0
4255
+ *
4256
+ * Unless required by applicable law or agreed to in writing, software
4257
+ * distributed under the License is distributed on an "AS IS" BASIS,
4258
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4259
+ * See the License for the specific language governing permissions and
4260
+ * limitations under the License.
4261
+ */
4262
+ const SPREADSHEET_SIGNIFICANT_DIGITS = 15;
4263
+ function decimalFromNumber(value) {
4264
+ if (!Number.isFinite(value)) throw new RangeError("decimalFromNumber requires a finite number");
4265
+ const negative = value < 0 || Object.is(value, -0);
4266
+ if (value === 0) return {
4267
+ negative,
4268
+ digits: "0",
4269
+ exponent: 0
4270
+ };
4271
+ const [mantissa, exponentText] = Math.abs(value).toExponential(15 - 1).split("e");
4272
+ return {
4273
+ negative,
4274
+ digits: mantissa.replace(".", "").replace(/0+$/, "") || "0",
4275
+ exponent: Number(exponentText)
4276
+ };
4277
+ }
4278
+ function shiftDecimal(value, power) {
4279
+ return {
4280
+ ...value,
4281
+ exponent: value.digits === "0" ? 0 : value.exponent + Math.trunc(power)
4282
+ };
4283
+ }
4284
+ function incrementDigits(value) {
4285
+ const characters = [...value];
4286
+ for (let index = characters.length - 1; index >= 0; index--) {
4287
+ if (characters[index] !== "9") {
4288
+ characters[index] = String(Number(characters[index]) + 1);
4289
+ return characters.join("");
4290
+ }
4291
+ characters[index] = "0";
4292
+ }
4293
+ return `1${characters.join("")}`;
4294
+ }
4295
+ function roundDecimal(value, places = 0) {
4296
+ const normalizedPlaces = Math.trunc(places);
4297
+ const keep = value.exponent + 1 + normalizedPlaces;
4298
+ let units;
4299
+ if (keep < 0) units = "0";
4300
+ else if (keep === 0) units = value.digits[0] >= "5" ? "1" : "0";
4301
+ else {
4302
+ units = value.digits.slice(0, keep).padEnd(keep, "0") || "0";
4303
+ if (keep < value.digits.length && value.digits[keep] >= "5") units = incrementDigits(units);
4304
+ }
4305
+ if (/^0+$/.test(units)) return {
4306
+ negative: value.negative,
4307
+ integer: "0",
4308
+ fraction: "",
4309
+ zero: true
4310
+ };
4311
+ if (normalizedPlaces <= 0) return {
4312
+ negative: value.negative,
4313
+ integer: units + "0".repeat(-normalizedPlaces),
4314
+ fraction: "",
4315
+ zero: false
4316
+ };
4317
+ const fixed = units.padStart(normalizedPlaces + 1, "0");
4318
+ return {
4319
+ negative: value.negative,
4320
+ integer: fixed.slice(0, -normalizedPlaces),
4321
+ fraction: fixed.slice(-normalizedPlaces).replace(/0+$/, ""),
4322
+ zero: false
4323
+ };
4324
+ }
4325
+ function decimalPartsToNumber(value) {
4326
+ const magnitude = Number(value.fraction ? `${value.integer}.${value.fraction}` : value.integer);
4327
+ return value.negative && !value.zero ? -magnitude : magnitude;
4328
+ }
4329
+ function decimalPartsToPlainString(value) {
4330
+ return `${value.negative && !value.zero ? "-" : ""}${value.integer}${value.fraction ? `.${value.fraction}` : ""}`;
4331
+ }
4332
+ function roundScientificDecimal(value, integerDigits, hasIntegerPattern, fractionDigits) {
4333
+ if (value.digits === "0") return {
4334
+ exponent: 0,
4335
+ rounded: roundDecimal(value, fractionDigits)
4336
+ };
4337
+ let exponent = integerDigits > 1 ? Math.floor(value.exponent / integerDigits) * integerDigits : value.exponent;
4338
+ if (!hasIntegerPattern) exponent++;
4339
+ let rounded = roundDecimal(shiftDecimal(value, -exponent), fractionDigits);
4340
+ if (integerDigits === 1 && rounded.integer.length > 1) {
4341
+ exponent++;
4342
+ rounded = roundDecimal(shiftDecimal(value, -exponent), fractionDigits);
4343
+ }
4344
+ return {
4345
+ exponent,
4346
+ rounded
4347
+ };
4348
+ }
4349
+
4350
+ //#endregion
4351
+ //#region src/shared/numfmt/code-to-locale.ts
4352
+ /**
4353
+ * Copyright 2023-present DreamNum Co., Ltd.
4354
+ *
4355
+ * Licensed under the Apache License, Version 2.0 (the "License");
4356
+ * you may not use this file except in compliance with the License.
4357
+ * You may obtain a copy of the License at
4358
+ *
4359
+ * http://www.apache.org/licenses/LICENSE-2.0
4360
+ *
4361
+ * Unless required by applicable law or agreed to in writing, software
4362
+ * distributed under the License is distributed on an "AS IS" BASIS,
4363
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4364
+ * See the License for the specific language governing permissions and
4365
+ * limitations under the License.
4366
+ */
4367
+ const codeToLocale = Object.freeze({
4368
+ 1078: "af",
4369
+ 1052: "sq",
4370
+ 1118: "am",
4371
+ 5121: "ar_DZ",
4372
+ 15361: "ar_BH",
4373
+ 3073: "ar_EG",
4374
+ 2049: "ar_IQ",
4375
+ 11265: "ar_JO",
4376
+ 13313: "ar_KW",
4377
+ 12289: "ar_LB",
4378
+ 4097: "ar_LY",
4379
+ 6145: "ar_MA",
4380
+ 8193: "ar_OM",
4381
+ 16385: "ar_QA",
4382
+ 1025: "ar_SA",
4383
+ 10241: "ar_SY",
4384
+ 7169: "ar_TN",
4385
+ 14337: "ar_AE",
4386
+ 9217: "ar_YE",
4387
+ 1067: "hy",
4388
+ 1101: "as",
4389
+ 2092: "az_AZ",
4390
+ 1068: "az_AZ",
4391
+ 1069: "eu",
4392
+ 1059: "be",
4393
+ 2117: "bn",
4394
+ 1093: "bn_IN",
4395
+ 5146: "bs",
4396
+ 1026: "bg",
4397
+ 1109: "my",
4398
+ 1027: "ca",
4399
+ 2052: "zh_CN",
4400
+ 3076: "zh_HK",
4401
+ 5124: "zh_MO",
4402
+ 4100: "zh_SG",
4403
+ 1028: "zh_TW",
4404
+ 1050: "hr",
4405
+ 1029: "cs",
4406
+ 1030: "da",
4407
+ 1125: "dv",
4408
+ 2067: "nl_BE",
4409
+ 1043: "nl_NL",
4410
+ 1126: "bin",
4411
+ 3081: "en_AU",
4412
+ 10249: "en_BZ",
4413
+ 4105: "en_CA",
4414
+ 9225: "en_CB",
4415
+ 2057: "en_GB",
4416
+ 16393: "en_IN",
4417
+ 6153: "en_IE",
4418
+ 8201: "en_JM",
4419
+ 5129: "en_NZ",
4420
+ 13321: "en_PH",
4421
+ 7177: "en_ZA",
4422
+ 11273: "en_TT",
4423
+ 1033: "en_US",
4424
+ 12297: "en_ZW",
4425
+ 1061: "et",
4426
+ 1071: "mk",
4427
+ 1080: "fo",
4428
+ 1065: "fa",
4429
+ 1124: "fil",
4430
+ 1035: "fi",
4431
+ 2060: "fr_BE",
4432
+ 11276: "fr_CM",
4433
+ 3084: "fr_CA",
4434
+ 9228: "fr_CG",
4435
+ 12300: "fr_CI",
4436
+ 1036: "fr_FR",
4437
+ 5132: "fr_LU",
4438
+ 13324: "fr_ML",
4439
+ 6156: "fr_MC",
4440
+ 14348: "fr_MA",
4441
+ 10252: "fr_SN",
4442
+ 4108: "fr_CH",
4443
+ 7180: "fr",
4444
+ 1122: "fy_NL",
4445
+ 2108: "gd_IE",
4446
+ 1084: "gd",
4447
+ 1110: "gl",
4448
+ 1079: "ka",
4449
+ 3079: "de_AT",
4450
+ 1031: "de_DE",
4451
+ 5127: "de_LI",
4452
+ 4103: "de_LU",
4453
+ 2055: "de_CH",
4454
+ 1032: "el",
4455
+ 1140: "gn",
4456
+ 1095: "gu",
4457
+ 1279: "en",
4458
+ 1037: "he",
4459
+ 1081: "hi",
4460
+ 1038: "hu",
4461
+ 1039: "is",
4462
+ 1136: "ig_NG",
4463
+ 1057: "id",
4464
+ 1040: "it_IT",
4465
+ 2064: "it_CH",
4466
+ 1041: "ja",
4467
+ 1099: "kn",
4468
+ 1120: "ks",
4469
+ 1087: "kk",
4470
+ 1107: "km",
4471
+ 1111: "kok",
4472
+ 1042: "ko",
4473
+ 1088: "ky",
4474
+ 1108: "lo",
4475
+ 1142: "la",
4476
+ 1062: "lv",
4477
+ 1063: "lt",
4478
+ 2110: "ms_BN",
4479
+ 1086: "ms_MY",
4480
+ 1100: "ml",
4481
+ 1082: "mt",
4482
+ 1112: "mni",
4483
+ 1153: "mi",
4484
+ 1102: "mr",
4485
+ 1104: "mn",
4486
+ 2128: "mn",
4487
+ 1121: "ne",
4488
+ 1044: "no_NO",
4489
+ 2068: "no_NO",
4490
+ 1096: "or",
4491
+ 1045: "pl",
4492
+ 1046: "pt_BR",
4493
+ 2070: "pt_PT",
4494
+ 1094: "pa",
4495
+ 1047: "rm",
4496
+ 2072: "ro_MO",
4497
+ 1048: "ro_RO",
4498
+ 1049: "ru",
4499
+ 2073: "ru_MO",
4500
+ 1083: "se",
4501
+ 1103: "sa",
4502
+ 3098: "sr_SP",
4503
+ 2074: "sr_SP",
4504
+ 1072: "st",
4505
+ 1074: "tn",
4506
+ 1113: "sd",
4507
+ 1115: "si",
4508
+ 1051: "sk",
4509
+ 1060: "sl",
4510
+ 1143: "so",
4511
+ 1070: "sb",
4512
+ 11274: "es_AR",
4513
+ 16394: "es_BO",
4514
+ 13322: "es_CL",
4515
+ 9226: "es_CO",
4516
+ 5130: "es_CR",
4517
+ 7178: "es_DO",
4518
+ 12298: "es_EC",
4519
+ 17418: "es_SV",
4520
+ 4106: "es_GT",
4521
+ 18442: "es_HN",
4522
+ 2058: "es_MX",
4523
+ 19466: "es_NI",
4524
+ 6154: "es_PA",
4525
+ 15370: "es_PY",
4526
+ 10250: "es_PE",
4527
+ 20490: "es_PR",
4528
+ 1034: "es_ES",
4529
+ 14346: "es_UY",
4530
+ 8202: "es_VE",
4531
+ 1089: "sw",
4532
+ 2077: "sv_FI",
4533
+ 1053: "sv_SE",
4534
+ 1114: "syc",
4535
+ 1064: "tg",
4536
+ 1097: "ta",
4537
+ 1092: "tt",
4538
+ 1098: "te",
4539
+ 1054: "th",
4540
+ 1105: "bo",
4541
+ 1073: "ts",
4542
+ 1055: "tr",
4543
+ 1090: "tk",
4544
+ 1058: "uk",
4545
+ 1056: "ur",
4546
+ 2115: "uz_UZ",
4547
+ 1091: "uz_UZ",
4548
+ 1075: "ve",
4549
+ 1066: "vi",
4550
+ 1106: "cy",
4551
+ 1076: "xh",
4552
+ 1085: "yi",
4553
+ 1077: "zu"
4554
+ });
4555
+
4556
+ //#endregion
4557
+ //#region src/shared/numfmt/locale.ts
4558
+ const re_locale = /^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i;
4559
+ const locales = {};
4560
+ /**
4561
+ * Split a semicolon delimited string and replace instances of characters
4562
+ * @ignore
4563
+ * @param {string} str Semicolon delimited string
4564
+ * @param {string} [tilde] String to be inserted on every instance of ~
4565
+ * @returns {string[]} Array of strings
4566
+ */
4567
+ const _ = (str, tilde = "") => str.replace(/~/g, tilde).split(";");
4568
+ const xm = (o, ml = 0, dl = 0) => {
4569
+ if (!o.mmm) o.mmm = ml < 1 ? o.mmmm.concat() : o.mmmm.map((d) => {
4570
+ const s = d.slice(0, ml % 10);
4571
+ return s + (ml < 10 || d === s ? "" : ".");
4572
+ });
4573
+ if (!o.ddd) o.ddd = dl < 1 ? o.dddd.concat() : o.dddd.map((d) => {
4574
+ const s = d.slice(0, dl % 10);
4575
+ return s + (dl < 10 || d === s ? "" : ".");
4576
+ });
4577
+ if (!o.mmm6 && o.mmmm6) o.mmm6 = o.mmmm6;
4578
+ return o;
4579
+ };
4580
+ /**
4581
+ * @typedef {object} LocaleData
4582
+ * An object of properties used by a formatter when printing a number in a certain locale.
4583
+ * @property {string} group - Symbol used as a grouping separator (`1,000,000` uses `,`)
4584
+ * @property {string} decimal - Symbol used to separate integers from fractions (usually `.`)
4585
+ * @property {string} positive - Symbol used to indicate positive numbers (usually `+`)
4586
+ * @property {string} negative - Symbol used to indicate positive numbers (usually `-`)
4587
+ * @property {string} percent - Symbol used to indicate a percentage (usually `%`)
4588
+ * @property {string} exponent - Symbol used to indicate an exponent (usually `E`)
4589
+ * @property {string} nan - Symbol used to indicate NaN values (`NaN`)
4590
+ * @property {string} infinity - Symbol used to indicate infinite values (`∞`)
4591
+ * @property {Array<string>} ampm - How AM and PM should be presented
4592
+ * @property {Array<string>} mmmm6 - Long month names for the Islamic calendar (`Rajab`)
4593
+ * @property {Array<string>} mmm6 - Short month names for the Islamic calendar (`Raj.`)
4594
+ * @property {Array<string>} mmmm - Long month names for the Gregorian calendar (`November`)
4595
+ * @property {Array<string>} mmm - Short month names for the Gregorian calendar (`Nov`)
4596
+ * @property {Array<string>} dddd - Long day names (`Wednesday`)
4597
+ * @property {Array<string>} ddd - Shortened day names (`Wed`)
4598
+ * @property {Array<string>} bool - How TRUE and FALSE should be presented
4599
+ * @property {boolean} preferMDY - Is the prefered date format month first (12/31/2025) or day first (31/12/2025)
4600
+ */
4601
+ /**
4602
+ * @ignore
4603
+ * @type {LocaleData}
4604
+ */
4605
+ const baseLocaleData = {
4606
+ group: "\xA0",
4607
+ decimal: ".",
4608
+ positive: "+",
4609
+ negative: "-",
4610
+ percent: "%",
4611
+ exponent: "E",
4612
+ nan: "NaN",
4613
+ infinity: "∞",
4614
+ ampm: _("AM;PM"),
4615
+ mmmm6: _("Muharram;Safar;Rabiʻ I;Rabiʻ II;Jumada I;Jumada II;Rajab;Shaʻban;Ramadan;Shawwal;Dhuʻl-Qiʻdah;Dhuʻl-Hijjah"),
4616
+ mmm6: _("Muh.;Saf.;Rab. I;Rab. II;Jum. I;Jum. II;Raj.;Sha.;Ram.;Shaw.;Dhuʻl-Q.;Dhuʻl-H."),
4617
+ mmmm: _("January;February;March;April;May;June;July;August;September;October;November;December"),
4618
+ mmm: _("Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"),
4619
+ dddd: _("Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"),
4620
+ ddd: _("Sun;Mon;Tue;Wed;Thu;Fri;Sat"),
4621
+ bool: _("TRUE;FALSE"),
4622
+ preferMDY: false
4623
+ };
4624
+ /**
4625
+ * @typedef {object} LocaleToken - An object of properties for a locale tag.
4626
+ * @property {string} lang - The basic tag such as `zh_CN` or `fi`
4627
+ * @property {string} language - The language section (`zh` for `zh_CN`)
4628
+ * @property {string} territory - The territory section (`CN` for `zh_CN`)
4629
+ */
4630
+ /**
4631
+ * Parse a regular IETF BCP 47 locale tag and emit an object of its parts.
4632
+ * Irregular tags and subtags are not supported.
4633
+ *
4634
+ * @param {string} locale - A BCP 47 string tag of the locale.
4635
+ * @returns {LocaleToken} - An object describing the locale.
4636
+ */
4637
+ function parseLocale(locale) {
4638
+ const lm = re_locale.exec(locale);
4639
+ if (!lm) throw new SyntaxError(`Malformed locale: ${locale}`);
4640
+ return {
4641
+ lang: lm[1] + (lm[2] ? `_${lm[2]}` : ""),
4642
+ language: lm[1],
4643
+ territory: lm[2] || ""
4644
+ };
4645
+ }
4646
+ function resolveLocale(locale) {
4647
+ if (typeof locale === "number") return codeToLocale[locale & 65535] || null;
4648
+ const wincode = Number.parseInt(locale, 16);
4649
+ if (Number.isFinite(wincode) && codeToLocale[wincode & 65535]) return codeToLocale[wincode & 65535] || null;
4650
+ if (re_locale.test(locale)) return locale;
4651
+ return null;
4652
+ }
4653
+ /**
4654
+ * Used by the formatter to pull a locate from its registered locales. If
4655
+ * subtag isn't available but the base language is, the base language is used.
4656
+ * So if `en-CA` is not found, the formatter tries to find `en` else it
4657
+ * returns a `null`.
4658
+ *
4659
+ * @param {string} locale - A BCP 47 string tag of the locale, or an Excel locale code.
4660
+ * @returns {LocaleData | null} - An object of format date properties.
4661
+ */
4662
+ function getLocale(locale) {
4663
+ const tag = resolveLocale(locale);
4664
+ let obj = null;
4665
+ if (tag) {
4666
+ const c = parseLocale(tag);
4667
+ obj = locales[c.lang] || locales[c.language] || null;
4668
+ }
4669
+ return obj;
4670
+ }
4671
+ function createLocale(settings) {
4672
+ return Object.assign({}, baseLocaleData, settings);
4673
+ }
4674
+ /**
4675
+ * Register locale data for a language so for use when formatting.
4676
+ *
4677
+ * Any partial set of properties may be returned to have the defaults used where properties are missing.
4678
+ *
4679
+ * @see {LocaleData}
4680
+ * @param {object} settings - A collection of settings for a locale.
4681
+ * @param {string} [settings.group]
4682
+ * Symbol used as a grouping separator (`1,000,000` uses `,`)
4683
+ * @param {string} [settings.decimal]
4684
+ * Symbol used to separate integers from fractions (usually `.`)
4685
+ * @param {string} [settings.positive]
4686
+ * Symbol used to indicate positive numbers (usually `+`)
4687
+ * @param {string} [settings.negative]
4688
+ * Symbol used to indicate positive numbers (usually `-`)
4689
+ * @param {string} [settings.percent]
4690
+ * Symbol used to indicate a percentage (usually `%`)
4691
+ * @param {string} [settings.exponent]
4692
+ * Symbol used to indicate an exponent (usually `E`)
4693
+ * @param {string} [settings.nan]
4694
+ * Symbol used to indicate NaN values (`NaN`)
4695
+ * @param {string} [settings.infinity]
4696
+ * Symbol used to indicate infinite values (`∞`)
4697
+ * @param {Array<string>} [settings.ampm]
4698
+ * How AM and PM should be presented.
4699
+ * @param {Array<string>} [settings.mmmm6]
4700
+ * Long month names for the Islamic calendar (e.g. `Rajab`)
4701
+ * @param {Array<string>} [settings.mmm6]
4702
+ * Short month names for the Islamic calendar (e.g. `Raj.`)
4703
+ * @param {Array<string>} [settings.mmmm]
4704
+ * Long month names for the Gregorian calendar (e.g. `November`)
4705
+ * @param {Array<string>} [settings.mmm]
4706
+ * Short month names for the Gregorian calendar (e.g. `Nov`)
4707
+ * @param {Array<string>} [settings.dddd]
4708
+ * Long day names (e.g. `Wednesday`)
4709
+ * @param {Array<string>} [settings.ddd]
4710
+ * Shortened day names (e.g. `Wed`)
4711
+ * @param {Array<string>} [settings.bool]
4712
+ * How TRUE and FALSE should be presented.
4713
+ * @param {boolean} [settings.preferMDY]
4714
+ * Is the prefered date format month first (12/31/2025) or day first (31/12/2025)
4715
+ * @param {string | LocaleToken} locale - A string BCP 47 tag or parsed locale token.
4716
+ * @returns {LocaleData} - A full collection of settings for a locale
4717
+ */
4718
+ function addLocale(settings, locale) {
4719
+ const c = typeof locale === "object" ? locale : parseLocale(locale);
4720
+ locales[c.lang] = createLocale(settings);
4721
+ if (c.language !== c.lang && !locales[c.language]) locales[c.language] = createLocale(settings);
4722
+ return locales[c.lang];
4723
+ }
4724
+ const defaultLocale = createLocale({
4725
+ group: ",",
4726
+ preferMDY: true
4727
+ });
4728
+ defaultLocale.isDefault = true;
4729
+ addLocale({
4730
+ group: ",",
4731
+ ampm: _("上午;下午"),
4732
+ mmmm: _("一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"),
4733
+ mmm: _("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),
4734
+ dddd: _("~日;~一;~二;~三;~四;~五;~六", "星期"),
4735
+ ddd: _("周日;周一;周二;周三;周四;周五;周六")
4736
+ }, "zh_CN");
4737
+ const _zh = {
4738
+ group: ",",
4739
+ ampm: _("上午;下午"),
4740
+ mmmm: _("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),
4741
+ mmm: _("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),
4742
+ dddd: _("~日;~一;~二;~三;~四;~五;~六", "星期"),
4743
+ ddd: _("周日;周一;周二;周三;周四;周五;周六")
4744
+ };
4745
+ addLocale({
4746
+ ..._zh,
4747
+ nan: "非數值",
4748
+ dddd: _("~日;~一;~二;~三;~四;~五;~六", "星期")
4749
+ }, "zh_TW");
4750
+ addLocale({
4751
+ ..._zh,
4752
+ dddd: _("~日;~一;~二;~三;~四;~五;~六", "星期")
4753
+ }, "zh_HK");
4754
+ addLocale({
4755
+ ..._zh,
4756
+ ampm: _("午前;午後"),
4757
+ dddd: _("日~;月~;火~;水~;木~;金~;土~", "曜日"),
4758
+ ddd: _("日;月;火;水;木;金;土")
4759
+ }, "ja");
4760
+ addLocale({
4761
+ group: ",",
4762
+ ampm: _("오전;오후"),
4763
+ mmmm: _("1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월"),
4764
+ mmm: _("1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월"),
4765
+ dddd: _("일요일;월요일;화요일;수요일;목요일;금요일;토요일"),
4766
+ ddd: _("일;월;화;수;목;금;토")
4767
+ }, "ko");
4768
+ addLocale({
4769
+ group: ",",
4770
+ ampm: _("ก่อนเที่ยง;หลังเที่ยง"),
4771
+ mmmm: _("มกร~;กุมภาพันธ์;มีน~;เมษายน;พฤษภ~;มิถุนายน;กรกฎ~;สิงห~;กันยายน;ตุล~;พฤศจิกายน;ธันว~", "าคม"),
4772
+ mmm: _("ม.ค.;ก.พ.;มี.ค.;เม.ย.;พ.ค.;มิ.ย.;ก.ค.;ส.ค.;ก.ย.;ต.ค.;พ.ย.;ธ.ค."),
4773
+ dddd: _("วันอาทิตย์;วันจันทร์;วันอังคาร;วันพุธ;วันพฤหัสบดี;วันศุกร์;วันเสาร์"),
4774
+ ddd: _("อา.;จ.;อ.;พ.;พฤ.;ศ.;ส.")
4775
+ }, "th");
4776
+ addLocale(xm({
4777
+ decimal: ",",
4778
+ ampm: _("dop.;odp."),
4779
+ mmmm: _("ledna;února;března;dubna;května;června;července;srpna;září;října;listopadu;prosince"),
4780
+ mmm: _("I;II;III;IV;V;VI;VII;VIII;IX;X;XI;XII"),
4781
+ dddd: _("neděle;pondělí;úterý;středa;čtvrtek;pátek;sobota"),
4782
+ bool: _("PRAVDA;NEPRAVDA")
4783
+ }, -1, 2), "cs");
4784
+ addLocale(xm({
4785
+ group: ".",
4786
+ decimal: ",",
4787
+ mmmm: _("januar;februar;marts;april;maj;juni;juli;august;september;oktober;november;december"),
4788
+ dddd: _("søn~;man~;tirs~;ons~;tors~;fre~;lør~", "dag"),
4789
+ bool: _("SAND;FALSK")
4790
+ }, 13, 13), "da");
4791
+ addLocale(xm({
4792
+ group: ".",
4793
+ decimal: ",",
4794
+ ampm: _("a.m.;p.m."),
4795
+ mmmm: _("januari;februari;maart;april;mei;juni;juli;augustus;september;oktober;november;december"),
4796
+ mmm: _("jan.;feb.;mrt.;apr.;mei;jun.;jul.;aug.;sep.;okt.;nov.;dec."),
4797
+ dddd: _("zondag;maandag;dinsdag;woensdag;donderdag;vrijdag;zaterdag"),
4798
+ bool: _("WAAR;ONWAAR")
4799
+ }, -1, 2), "nl");
4800
+ addLocale({
4801
+ group: ",",
4802
+ preferMDY: true
4803
+ }, "en");
4804
+ addLocale({
4805
+ group: ",",
4806
+ preferMDY: true
4807
+ }, "en_US");
4808
+ addLocale({ group: "," }, "en_AU");
4809
+ addLocale({ group: "," }, "en_CA");
4810
+ addLocale({ group: "," }, "en_GB");
4811
+ addLocale({
4812
+ group: ",",
4813
+ mmm: _("Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sept;Oct;Nov;Dec")
4814
+ }, "en_IE");
4815
+ addLocale(xm({
4816
+ decimal: ",",
4817
+ nan: "epäluku",
4818
+ ampm: _("ap.;ip."),
4819
+ mmmm: _("tammi~;helmi~;maalis~;huhti~;touko~;kesä~;heinä~;elo~;syys~;loka~;marras~;joulu~", "kuuta"),
4820
+ mmm: _("tammik.;helmik.;maalisk.;huhtik.;toukok.;kesäk.;heinäk.;elok.;syysk.;lokak.;marrask.;jouluk."),
4821
+ dddd: _("sunnun~;maanan~;tiis~;keskiviikkona;tors~;perjan~;lauan~", "taina"),
4822
+ bool: _("TOSI;EPÄTOSI")
4823
+ }, -1, 2), "fi");
4824
+ const _fr = xm({
4825
+ group: " ",
4826
+ decimal: ",",
4827
+ mmmm: _("janvier;février;mars;avril;mai;juin;juillet;août;septembre;octobre;novembre;décembre"),
4828
+ mmm: _("janv.;févr.;mars;avr.;mai;juin;juil.;août;sept.;oct.;nov.;déc."),
4829
+ dddd: _("~manche;lun~;mar~;mercre~;jeu~;vendre~;same~", "di"),
4830
+ bool: _("VRAI;FAUX")
4831
+ }, -1, 13);
4832
+ addLocale({ ..._fr }, "fr");
4833
+ addLocale({
4834
+ ..._fr,
4835
+ mmm: _("janv.;févr.;mars;avr.;mai;juin;juill.;août;sept.;oct.;nov.;déc.")
4836
+ }, "fr_CA");
4837
+ addLocale({
4838
+ group: "'",
4839
+ decimal: ".",
4840
+ ..._fr
4841
+ }, "fr_CH");
4842
+ const _de = xm({
4843
+ mmmm: _("Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember"),
4844
+ mmm: _("Jan.;Feb.;März;Apr.;Mai;Juni;Juli;Aug.;Sept.;Okt.;Nov.;Dez."),
4845
+ dddd: _("Sonn~;Mon~;Diens~;Mittwoch;Donners~;Frei~;Sams~", "tag"),
4846
+ bool: _("WAHR;FALSCH")
4847
+ }, -1, 12);
4848
+ addLocale({
4849
+ group: ".",
4850
+ decimal: ",",
4851
+ ..._de
4852
+ }, "de");
4853
+ addLocale({
4854
+ group: "'",
4855
+ decimal: ".",
4856
+ ..._de
4857
+ }, "de_CH");
4858
+ addLocale(xm({
4859
+ group: ".",
4860
+ decimal: ",",
4861
+ ampm: _("π.μ.;μ.μ."),
4862
+ mmmm: _("Ιανουαρ~;Φεβρουαρ~;Μαρτ~;Απριλ~;Μαΐου;Ιουν~;Ιουλ~;Αυγούστου;Σεπτεμβρ~;Οκτωβρ~;Νοεμβρ~;Δεκεμβρ~", "ίου"),
4863
+ mmm: _("Ιαν;Φεβ;Μαρ;Απρ;Μαΐ;Ιουν;Ιουλ;Αυγ;Σεπ;Οκτ;Νοε;Δεκ"),
4864
+ dddd: _("Κυριακή;Δευτέρα;Τρίτη;Τετάρτη;Πέμπτη;Παρασκευή;Σάββατο")
4865
+ }, -1, 3), "el");
4866
+ addLocale({
4867
+ decimal: ",",
4868
+ ampm: _("de.;du."),
4869
+ mmmm: _("január;február;március;április;május;június;július;augusztus;szeptember;október;november;december"),
4870
+ mmm: _("jan.;febr.;márc.;ápr.;máj.;jún.;júl.;aug.;szept.;okt.;nov.;dec."),
4871
+ dddd: _("vasárnap;hétfő;kedd;szerda;csütörtök;péntek;szombat"),
4872
+ ddd: _("V;H;K;Sze;Cs;P;Szo"),
4873
+ bool: _("IGAZ;HAMIS")
4874
+ }, "hu");
4875
+ addLocale(xm({
4876
+ group: ".",
4877
+ decimal: ",",
4878
+ ampm: _("f.h.;e.h."),
4879
+ mmmm: _("janúar;febrúar;mars;apríl;maí;júní;júlí;ágúst;september;október;nóvember;desember"),
4880
+ dddd: _("sunnu~;mánu~;þriðju~;miðviku~;fimmtu~;föstu~;laugar~", "dagur")
4881
+ }, 13, 13), "is");
4882
+ addLocale(xm({
4883
+ group: ".",
4884
+ decimal: ",",
4885
+ mmmm: _("Januari;Februari;Maret;April;Mei;Juni;Juli;Agustus;September;Oktober;November;Desember"),
4886
+ dddd: _("Minggu;Senin;Selasa;Rabu;Kamis;Jumat;Sabtu")
4887
+ }, 3, 3), "id");
4888
+ const _it = xm({
4889
+ mmmm: _("gennaio;febbraio;marzo;aprile;maggio;giugno;luglio;agosto;settembre;ottobre;novembre;dicembre"),
4890
+ dddd: _("domenica;lunedì;martedì;mercoledì;giovedì;venerdì;sabato"),
4891
+ bool: _("VERO;FALSO")
4892
+ }, 3, 3);
4893
+ addLocale({
4894
+ group: ".",
4895
+ decimal: ",",
4896
+ ..._it
4897
+ }, "it");
4898
+ addLocale({
4899
+ group: "'",
4900
+ decimal: ".",
4901
+ ..._it
4902
+ }, "it_CH");
4903
+ const _no = {
4904
+ decimal: ",",
4905
+ ampm: _("a.m.;p.m."),
4906
+ mmmm: _("januar;februar;mars;april;mai;juni;juli;august;september;oktober;november;desember"),
4907
+ mmm: _("jan.;feb.;mar.;apr.;mai;jun.;jul.;aug.;sep.;okt.;nov.;des."),
4908
+ dddd: _("søn~;man~;tirs~;ons~;tors~;fre~;lør~", "dag"),
4909
+ bool: _("SANN;USANN")
4910
+ };
4911
+ addLocale(xm({ ..._no }, -1, 13), "nb");
4912
+ addLocale(xm({ ..._no }, -1, 13), "no");
4913
+ addLocale(xm({
4914
+ decimal: ",",
4915
+ mmmm: _("stycznia;lutego;marca;kwietnia;maja;czerwca;lipca;sierpnia;września;października;listopada;grudnia"),
4916
+ dddd: _("niedziela;poniedziałek;wtorek;środa;czwartek;piątek;sobota"),
4917
+ ddd: _("niedz.;pon.;wt.;śr.;czw.;pt.;sob."),
4918
+ bool: _("PRAWDA;FAŁSZ")
4919
+ }, 3, -1), "pl");
4920
+ const _pt = {
4921
+ group: ".",
4922
+ decimal: ",",
4923
+ mmmm: _("janeiro;fevereiro;março;abril;maio;junho;julho;agosto;setembro;outubro;novembro;dezembro"),
4924
+ dddd: _("domingo;segunda-feira;terça-feira;quarta-feira;quinta-feira;sexta-feira;sábado"),
4925
+ bool: _("VERDADEIRO;FALSO")
4926
+ };
4927
+ addLocale(xm(_pt, 13, 13), "pt");
4928
+ addLocale(xm(_pt, 13, 13), "pt_BR");
4929
+ addLocale({
4930
+ decimal: ",",
4931
+ nan: "не\xA0число",
4932
+ mmmm: _("января;февраля;марта;апреля;мая;июня;июля;августа;сентября;октября;ноября;декабря"),
4933
+ mmm: _("янв.;февр.;мар.;апр.;мая;июн.;июл.;авг.;сент.;окт.;нояб.;дек."),
4934
+ dddd: _("воскресенье;понедельник;вторник;среда;четверг;пятница;суббота"),
4935
+ ddd: _("вс;пн;вт;ср;чт;пт;сб"),
4936
+ mmmm6: _("рамадан;шавваль;зуль-каада;зуль-хиджжа;мухаррам;раби-уль-авваль;раби-уль-ахир;джумад-уль-авваль;джумад-уль-ахир;раджаб;шаабан;рамадан"),
4937
+ mmm6: _("рам.;шав.;зуль-к.;зуль-х.;мух.;раб. I;раб. II;джум. I;джум. II;радж.;шааб.;рам."),
4938
+ bool: _("ИСТИНА;ЛОЖЬ")
4939
+ }, "ru");
4940
+ addLocale(xm({
4941
+ decimal: ",",
4942
+ mmmm: _("januára;februára;marca;apríla;mája;júna;júla;augusta;septembra;októbra;novembra;decembra"),
4943
+ dddd: _("nedeľa;pondelok;utorok;streda;štvrtok;piatok;sobota")
4944
+ }, 3, 2), "sk");
4945
+ const _es = {
4946
+ group: ".",
4947
+ decimal: ",",
4948
+ ampm: _("a.\xA0m.;p.\xA0m."),
4949
+ mmmm: _("enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiem~;octu~;noviem~;diciem~", "bre"),
4950
+ mmm: _("ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic"),
4951
+ dddd: _("domingo;lunes;martes;miércoles;jueves;viernes;sábado"),
4952
+ ddd: _("dom;lun;mar;mié;jue;vie;sáb"),
4953
+ bool: _("VERDADERO;FALSO")
4954
+ };
4955
+ const _esM3 = _("ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic");
4956
+ const _esM13 = _("ene.;feb.;mar.;abr.;may.;jun.;jul.;ago.;sept.;oct.;nov.;dic.");
4957
+ addLocale({ ..._es }, "es");
4958
+ addLocale({ ..._es }, "es_AR");
4959
+ addLocale({ ..._es }, "es_BO");
4960
+ addLocale({ ..._es }, "es_CL");
4961
+ addLocale({ ..._es }, "es_CO");
4962
+ addLocale({ ..._es }, "es_EC");
4963
+ addLocale({
4964
+ ..._es,
4965
+ mmm: _esM3,
4966
+ ampm: _("a.m.;p.m.")
4967
+ }, "es_MX");
4968
+ addLocale({
4969
+ ..._es,
4970
+ mmm: _esM13
4971
+ }, "es_PY");
4972
+ addLocale({
4973
+ ..._es,
4974
+ mmm: _esM13
4975
+ }, "es_UY");
4976
+ addLocale({
4977
+ ..._es,
4978
+ mmm: _esM13,
4979
+ mmmm: _("enero;febrero;marzo;abril;mayo;junio;julio;agosto;setiembre;octubre;noviembre;diciembre")
4980
+ }, "es_VE");
4981
+ addLocale({
4982
+ decimal: ",",
4983
+ ampm: _("fm;em"),
4984
+ mmmm: _("januari;februari;mars;april;maj;juni;juli;augusti;september;oktober;november;december"),
4985
+ mmm: _("jan.;feb.;mars;apr.;maj;juni;juli;aug.;sep.;okt.;nov.;dec."),
4986
+ dddd: _("sön~;mån~;tis~;ons~;tors~;fre~;lör~", "dag"),
4987
+ ddd: _("sön;mån;tis;ons;tors;fre;lör")
4988
+ }, "sv");
4989
+ addLocale(xm({
4990
+ group: ".",
4991
+ decimal: ",",
4992
+ ampm: _("ÖÖ;ÖS"),
4993
+ mmmm: _("Ocak;Şubat;Mart;Nisan;Mayıs;Haziran;Temmuz;Ağustos;Eylül;Ekim;Kasım;Aralık"),
4994
+ mmm: _("Oca;Şub;Mar;Nis;May;Haz;Tem;Ağu;Eyl;Eki;Kas;Ara"),
4995
+ dddd: _("Pazar;Pazartesi;Salı;Çarşamba;Perşembe;Cuma;Cumartesi"),
4996
+ ddd: _("Paz;Pzt;Sal;Çar;Per;Cum;Cmt"),
4997
+ bool: _("DOĞRU;YANLIŞ")
4998
+ }, 3, -1), "tr");
4999
+ addLocale({
5000
+ group: ",",
5001
+ ampm: _("yb;yh"),
5002
+ mmmm: _("Ionawr;Chwefror;Mawrth;Ebrill;Mai;Mehefin;Gorffennaf;Awst;Medi;Hydref;Tachwedd;Rhagfyr"),
5003
+ mmm: _("Ion;Chwef;Maw;Ebr;Mai;Meh;Gorff;Awst;Medi;Hyd;Tach;Rhag"),
5004
+ dddd: _("Dydd Sul;Dydd Llun;Dydd Mawrth;Dydd Mercher;Dydd Iau;Dydd Gwener;Dydd Sadwrn"),
5005
+ ddd: _("Sul;Llun;Maw;Mer;Iau;Gwen;Sad")
5006
+ }, "cy");
5007
+ addLocale({
5008
+ group: ".",
5009
+ decimal: ",",
5010
+ mmmm: _("yanvar;fevral;mart;aprel;may;iyun;iyul;avqust;sentyabr;oktyabr;noyabr;dekabr"),
5011
+ mmm: _("yan;fev;mar;apr;may;iyn;iyl;avq;sen;okt;noy;dek"),
5012
+ dddd: _("bazar;bazar ertəsi;çərşənbə axşamı;çərşənbə;cümə axşamı;cümə;şənbə"),
5013
+ ddd: _("B.;B.e.;Ç.a.;Ç.;C.a.;C.;Ş.")
5014
+ }, "az");
5015
+ addLocale(xm({
5016
+ decimal: ",",
5017
+ mmmm: _("студзеня;лютага;сакавіка;красавіка;мая;чэрвеня;ліпеня;жніўня;верасня;кастрычніка;лістапада;снежня"),
5018
+ dddd: _("нядзеля;панядзелак;аўторак;серада;чацвер;пятніца;субота"),
5019
+ ddd: _("нд;пн;аў;ср;чц;пт;сб")
5020
+ }, 3, -1), "be");
5021
+ addLocale({
5022
+ decimal: ",",
5023
+ ampm: _("пр.об.;сл.об."),
5024
+ mmmm: _("януари;февруари;март;април;май;юни;юли;август;септември;октомври;ноември;декември"),
5025
+ mmm: _("яну;фев;март;апр;май;юни;юли;авг;сеп;окт;ное;дек"),
5026
+ dddd: _("неделя;понеделник;вторник;сряда;четвъртък;петък;събота"),
5027
+ ddd: _("нд;пн;вт;ср;чт;пт;сб"),
5028
+ bool: _("ИСТИНА;ЛОЖЬ")
5029
+ }, "bg");
5030
+ addLocale({
5031
+ group: ".",
5032
+ decimal: ",",
5033
+ mmmm: _("de gener;de febrer;de març;d’abril;de maig;de juny;de juliol;d’agost;de setembre;d’octubre;de novembre;de desembre"),
5034
+ mmm: _("de gen.;de febr.;de març;d’abr.;de maig;de juny;de jul.;d’ag.;de set.;d’oct.;de nov.;de des."),
5035
+ dddd: _("diumenge;dilluns;dimarts;dimecres;dijous;divendres;dissabte"),
5036
+ ddd: _("dg.;dl.;dt.;dc.;dj.;dv.;ds."),
5037
+ ampm: _("a.\xA0m.;p.\xA0m.")
5038
+ }, "ca");
5039
+ addLocale(xm({
5040
+ group: ",",
5041
+ decimal: ".",
5042
+ mmmm: _("Enero;Pebrero;Marso;Abril;Mayo;Hunyo;Hulyo;Agosto;Setyembre;Oktubre;Nobyembre;Disyembre"),
5043
+ dddd: _("Linggo;Lunes;Martes;Miyerkules;Huwebes;Biyernes;Sabado")
5044
+ }, 3, 3), "fil");
5045
+ addLocale({
5046
+ group: ",",
5047
+ decimal: ".",
5048
+ mmmm: _("જાન્યુઆરી;ફેબ્રુઆરી;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટેમ્બર;ઑક્ટોબર;નવેમ્બર;ડિસેમ્બર"),
5049
+ mmm: _("જાન્યુ;ફેબ્રુ;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટે;ઑક્ટો;નવે;ડિસે"),
5050
+ dddd: _("રવિ~;સોમ~;મંગળ~;બુધ~;ગુરુ~;શુક્ર~;શનિ~", "વાર"),
5051
+ ddd: _("રવિ;સોમ;મંગળ;બુધ;ગુરુ;શુક્ર;શનિ")
5052
+ }, "gu");
5053
+ addLocale({
5054
+ group: ",",
5055
+ decimal: ".",
5056
+ ampm: _("לפנה״צ;אחה״צ"),
5057
+ dddd: _("~ראשון;~שני;~שלישי;~רביעי;~חמישי;~שישי;~שבת", "יום "),
5058
+ ddd: _("~א׳;~ב׳;~ג׳;~ד׳;~ה׳;~ו׳;שבת", "יום "),
5059
+ mmmm: _("ינואר;פברואר;מרץ;אפריל;מאי;יוני;יולי;אוגוסט;ספטמבר;אוקטובר;נובמבר;דצמבר"),
5060
+ mmm: _("ינו׳;פבר׳;מרץ;אפר׳;מאי;יוני;יולי;אוג׳;ספט׳;אוק׳;נוב׳;דצמ׳"),
5061
+ mmmm6: _("רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע אל־אוול;רביע א־ת׳אני;ג׳ומאדא אל־אולא;ג׳ומאדא א־ת׳אניה;רג׳ב;שעבאן;רמדאן"),
5062
+ mmm6: _("רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע א׳;רביע ב׳;ג׳ומאדא א׳;ג׳ומאדא ב׳;רג׳ב;שעבאן;רמדאן")
5063
+ }, "he");
5064
+ addLocale(xm({
5065
+ group: ".",
5066
+ decimal: ",",
5067
+ mmmm: _("siječnja;veljače;ožujka;travnja;svibnja;lipnja;srpnja;kolovoza;rujna;listopada;studenoga;prosinca"),
5068
+ mmm: _("sij;velj;ožu;tra;svi;lip;srp;kol;ruj;lis;stu;pro"),
5069
+ dddd: _("nedjelja;ponedjeljak;utorak;srijeda;četvrtak;petak;subota")
5070
+ }, -1, 3), "hr");
5071
+ addLocale({
5072
+ decimal: ",",
5073
+ mmmm: _("հունվարի;փետրվարի;մարտի;ապրիլի;մայիսի;հունիսի;հուլիսի;օգոստոսի;սեպտեմբերի;հոկտեմբերի;նոյեմբերի;դեկտեմբերի"),
5074
+ mmm: _("հնվ;փտվ;մրտ;ապր;մյս;հնս;հլս;օգս;սեպ;հոկ;նոյ;դեկ"),
5075
+ dddd: _("կիրակի;երկուշաբթի;երեքշաբթի;չորեքշաբթի;հինգշաբթի;ուրբաթ;շաբաթ"),
5076
+ ddd: _("կիր;երկ;երք;չրք;հնգ;ուր;շբթ")
5077
+ }, "hy");
5078
+ addLocale(xm({
5079
+ decimal: ",",
5080
+ mmmm: _("იანვარი;თებერვალი;მარტი;აპრილი;მაისი;ივნისი;ივლისი;აგვისტო;სექტემბერი;ოქტომბერი;ნოემბერი;დეკემბერი"),
5081
+ dddd: _("კვირა;ორშაბათი;სამშაბათი;ოთხშაბათი;ხუთშაბათი;პარასკევი;შაბათი")
5082
+ }, 3, 3), "ka");
5083
+ addLocale(xm({
5084
+ decimal: ",",
5085
+ mmmm: _("қаңтар;ақпан;наурыз;сәуір;мамыр;маусым;шілде;тамыз;қыркүйек;қазан;қараша;желтоқсан"),
5086
+ dddd: _("жексенбі;дүйсенбі;сейсенбі;сәрсенбі;бейсенбі;жұма;сенбі"),
5087
+ ddd: _("жс;дс;сс;ср;бс;жм;сб")
5088
+ }, 13, -1), "kk");
5089
+ addLocale({
5090
+ group: ",",
5091
+ mmmm: _("ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿಲ್;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂಬರ್;ಅಕ್ಟೋಬರ್;ನವೆಂಬರ್;ಡಿಸೆಂಬರ್"),
5092
+ mmm: _("ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿ;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂ;ಅಕ್ಟೋ;ನವೆಂ;ಡಿಸೆಂ"),
5093
+ dddd: _("ಭಾನು~;ಸೋಮ~;ಮಂಗಳ~;ಬುಧ~;ಗುರು~;ಶುಕ್ರ~;ಶನಿ~", "ವಾರ"),
5094
+ ddd: _("ಭಾನು;ಸೋಮ;ಮಂಗಳ;ಬುಧ;ಗುರು;ಶುಕ್ರ;ಶನಿ"),
5095
+ ampm: _("ಪೂರ್ವಾಹ್ನ;ಅಪರಾಹ್ನ")
5096
+ }, "kn");
5097
+ addLocale({
5098
+ decimal: ",",
5099
+ mmmm: _("sausio;vasario;kovo;balandžio;gegužės;birželio;liepos;rugpjūčio;rugsėjo;spalio;lapkričio;gruodžio"),
5100
+ mmm: _("saus.;vas.;kov.;bal.;geg.;birž.;liep.;rugp.;rugs.;spal.;lapkr.;gruod."),
5101
+ dddd: _("sekmadienis;pirmadienis;antradienis;trečiadienis;ketvirtadienis;penktadienis;šeštadienis"),
5102
+ ddd: _("sk;pr;an;tr;kt;pn;št"),
5103
+ ampm: _("priešpiet;popiet")
5104
+ }, "lt");
5105
+ addLocale({
5106
+ decimal: ",",
5107
+ mmmm: _("janvāris;februāris;marts;aprīlis;maijs;jūnijs;jūlijs;augusts;septembris;oktobris;novembris;decembris"),
5108
+ mmm: _("janv.;febr.;marts;apr.;maijs;jūn.;jūl.;aug.;sept.;okt.;nov.;dec."),
5109
+ dddd: _("svētdiena;pirmdiena;otrdiena;trešdiena;ceturtdiena;piektdiena;sestdiena"),
5110
+ ddd: _("svētd.;pirmd.;otrd.;trešd.;ceturtd.;piektd.;sestd."),
5111
+ ampm: _("priekšpusdienā;pēcpusdienā")
5112
+ }, "lv");
5113
+ addLocale({
5114
+ group: ",",
5115
+ decimal: ".",
5116
+ mmmm: _("ജനുവരി;ഫെബ്രുവരി;മാർച്ച്;ഏപ്രിൽ;മേയ്;ജൂൺ;ജൂലൈ;ഓഗസ്റ്റ്;സെപ്റ്റംബർ;ഒക്‌ടോബർ;നവംബർ;ഡിസംബർ"),
5117
+ mmm: _("ജനു;ഫെബ്രു;മാർ;ഏപ്രി;മേയ്;ജൂൺ;ജൂലൈ;ഓഗ;സെപ്റ്റം;ഒക്ടോ;നവം;ഡിസം"),
5118
+ dddd: _("ഞായറാഴ്‌ച;തിങ്കളാഴ്‌ച;ചൊവ്വാഴ്ച;ബുധനാഴ്‌ച;വ്യാഴാഴ്‌ച;വെള്ളിയാഴ്‌ച;ശനിയാഴ്‌ച"),
5119
+ ddd: _("ഞായർ;തിങ്കൾ;ചൊവ്വ;ബുധൻ;വ്യാഴം;വെള്ളി;ശനി")
5120
+ }, "ml");
5121
+ addLocale({
5122
+ group: ",",
5123
+ decimal: ".",
5124
+ mmmm: _("нэгдүгээ~;хоёрдугаа~;гуравдугаа~;дөрөвдүгээ~;тавдугаа~;зургаадугаа~;долоодугаа~;наймдугаа~;есдүгээ~;аравдугаа~;арван нэгдүгээ~;арван хоёрдугаа~", "р сар"),
5125
+ mmm: _("1~;2~;3~;4~;5~;6~;7~;8~;9~;10~;11~;12~", "-р сар"),
5126
+ dddd: _("ням;даваа;мягмар;лхагва;пүрэв;баасан;бямба"),
5127
+ ddd: _("Ня;Да;Мя;Лх;Пү;Ба;Бя"),
5128
+ ampm: _("ү.ө.;ү.х.")
5129
+ }, "mn");
5130
+ addLocale({
5131
+ group: ",",
5132
+ decimal: ".",
5133
+ mmmm: _("जानेवारी;फेब्रुवारी;मार्च;एप्रिल;मे;जून;जुलै;ऑगस्ट;सप्टेंबर;ऑक्टोबर;नोव्हेंबर;डिसेंबर"),
5134
+ mmm: _("जाने;फेब्रु;मार्च;एप्रि;मे;जून;जुलै;ऑग;सप्टें;ऑक्टो;नोव्हें;डिसें"),
5135
+ dddd: _("रविवार;सोमवार;मंगळवार;बुधवार;गुरुवार;शुक्रवार;शनिवार"),
5136
+ ddd: _("रवि;सोम;मंगळ;बुध;गुरु;शुक्र;शनि")
5137
+ }, "mr");
5138
+ addLocale(xm({
5139
+ group: ",",
5140
+ decimal: ".",
5141
+ mmmm: _("ဇန်နဝါရီ;ဖေဖော်ဝါရီ;မတ်;ဧပြီ;မေ;ဇွန်;ဇူလိုင်;ဩဂုတ်;စက်တင်ဘာ;အောက်တိုဘာ;နိုဝင်ဘာ;ဒီဇင်ဘာ"),
5142
+ mmm: _("ဇန်;ဖေ;မတ်;ဧ;မေ;ဇွန်;ဇူ;ဩ;စက်;အောက်;နို;ဒီ"),
5143
+ dddd: _("တနင်္ဂနွေ;တနင်္လာ;အင်္ဂါ;ဗုဒ္ဓဟူး;ကြာသပတေး;သောကြာ;စနေ"),
5144
+ ampm: _("နံနက်;ညနေ")
5145
+ }, -1, 0), "my");
5146
+ addLocale({
5147
+ group: ",",
5148
+ decimal: ".",
5149
+ mmmm: _("ਜਨਵਰੀ;ਫ਼ਰਵਰੀ;ਮਾਰਚ;ਅਪ੍ਰੈਲ;ਮਈ;ਜੂਨ;ਜੁਲਾਈ;ਅਗਸਤ;ਸਤੰਬਰ;ਅਕਤੂਬਰ;ਨਵੰਬਰ;ਦਸੰਬਰ"),
5150
+ mmm: _("ਜਨ;ਫ਼ਰ;ਮਾਰਚ;ਅਪ੍ਰੈ;ਮਈ;ਜੂਨ;ਜੁਲਾ;ਅਗ;ਸਤੰ;ਅਕਤੂ;ਨਵੰ;ਦਸੰ"),
5151
+ dddd: _("ਐਤਵਾਰ;ਸੋਮਵਾਰ;ਮੰਗਲਵਾਰ;ਬੁੱਧਵਾਰ;ਵੀਰਵਾਰ;ਸ਼ੁੱਕਰਵਾਰ;ਸ਼ਨਿੱਚਰਵਾਰ"),
5152
+ ddd: _("ਐਤ;ਸੋਮ;ਮੰਗਲ;ਬੁੱਧ;ਵੀਰ;ਸ਼ੁੱਕਰ;ਸ਼ਨਿੱਚਰ"),
5153
+ ampm: _("ਪੂ.ਦੁ.;ਬਾ.ਦੁ.")
5154
+ }, "pa");
5155
+ addLocale({
5156
+ group: ".",
5157
+ decimal: ",",
5158
+ mmmm: _("ianuarie;februarie;martie;aprilie;mai;iunie;iulie;august;septem~;octom~;noiem~;decem~", "brie"),
5159
+ mmm: _("ian.;feb.;mar.;apr.;mai;iun.;iul.;aug.;sept.;oct.;nov.;dec."),
5160
+ dddd: _("duminică;luni;marți;miercuri;joi;vineri;sâmbătă"),
5161
+ ddd: _("dum.;lun.;mar.;mie.;joi;vin.;sâm."),
5162
+ ampm: _("a.m.;p.m.")
5163
+ }, "ro");
5164
+ addLocale(xm({
5165
+ group: ".",
5166
+ decimal: ",",
5167
+ mmmm: _("januar;februar;marec;april;maj;junij;julij;avgust;september;oktober;november;december"),
5168
+ mmm: _("jan.;feb.;mar.;apr.;maj;jun.;jul.;avg.;sep.;okt.;nov.;dec."),
5169
+ dddd: _("nedelja;ponedeljek;torek;sreda;četrtek;petek;sobota"),
5170
+ ampm: _("dop.;pop.")
5171
+ }, -1, 13), "sl");
5172
+ addLocale(xm({
5173
+ group: ".",
5174
+ decimal: ",",
5175
+ mmmm: _("јануар;фебруар;март;април;мај;јун;јул;август;септембар;октобар;новембар;децембар"),
5176
+ dddd: _("недеља;понедељак;уторак;среда;четвртак;петак;субота")
5177
+ }, 3, 3), "sr");
5178
+ addLocale({
5179
+ group: ",",
5180
+ decimal: ".",
5181
+ mmmm: _("ஜனவரி;பிப்ரவரி;மார்ச்;ஏப்ரல்;மே;ஜூன்;ஜூலை;ஆகஸ்ட்;செப்டம்பர்;அக்டோபர்;நவம்பர்;டிசம்பர்"),
5182
+ mmm: _("ஜன.;பிப்.;மார்.;ஏப்.;மே;ஜூன்;ஜூலை;ஆக.;செப்.;அக்.;நவ.;டிச."),
5183
+ dddd: _("ஞாயிறு;திங்கள்;செவ்வாய்;புதன்;வியாழன்;வெள்ளி;சனி"),
5184
+ ddd: _("ஞாயி.;திங்.;செவ்.;புத.;வியா.;வெள்.;சனி")
5185
+ }, "ta");
5186
+ addLocale({
5187
+ group: ",",
5188
+ decimal: ".",
5189
+ mmmm: _("జనవరి;ఫిబ్రవరి;మార్చి;ఏప్రిల్;మే;జూన్;జులై;ఆగస్టు;సెప్టెంబర్;అక్టోబర్;నవంబర్;డిసెంబర్"),
5190
+ mmm: _("జన;ఫిబ్ర;మార్చి;ఏప్రి;మే;జూన్;జులై;ఆగ;సెప్టెం;అక్టో;నవం;డిసెం"),
5191
+ dddd: _("ఆదివారం;సోమవారం;మంగళవారం;బుధవారం;గురువారం;శుక్రవారం;శనివారం"),
5192
+ ddd: _("ఆది;సోమ;మంగళ;బుధ;గురు;శుక్ర;శని")
5193
+ }, "te");
5194
+ addLocale({
5195
+ decimal: ",",
5196
+ mmmm: _("січня;лютого;березня;квітня;травня;червня;липня;серпня;вересня;жовтня;листопада;грудня"),
5197
+ mmm: _("січ.;лют.;бер.;квіт.;трав.;черв.;лип.;серп.;вер.;жовт.;лист.;груд."),
5198
+ dddd: _("неділю;понеділок;вівторок;середу;четвер;пʼятницю;суботу"),
5199
+ ddd: _("нд;пн;вт;ср;чт;пт;сб"),
5200
+ ampm: _("дп;пп")
5201
+ }, "uk");
5202
+ addLocale({
5203
+ group: ".",
5204
+ decimal: ",",
5205
+ mmmm: _("~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12", "tháng "),
5206
+ mmm: _("~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12", "thg "),
5207
+ dddd: _("Chủ Nhật;Thứ Hai;Thứ Ba;Thứ Tư;Thứ Năm;Thứ Sáu;Thứ Bảy"),
5208
+ ddd: _("CN;Th 2;Th 3;Th 4;Th 5;Th 6;Th 7"),
5209
+ ampm: _("SA;CH")
5210
+ }, "vi");
5211
+ addLocale(xm({
5212
+ group: "٬",
5213
+ decimal: "٫",
5214
+ ampm: _("ص;م"),
5215
+ mmmm: _("يناير;فبراير;مارس;أبريل;مايو;يونيو;يوليو;أغسطس;سبتمبر;أكتوبر;نوفمبر;ديسمبر"),
5216
+ dddd: _("الأحد;الاثنين;الثلاثاء;الأربعاء;الخميس;الجمعة;السبت"),
5217
+ mmmm6: _("رمضان;شوال;ذو القعدة;ذو الحجة;محرم;ربيع الأول;ربيع الآخرة;جمادى الأولى;جمادى الآخرة;رجب;شعبان;رمضان")
5218
+ }, 0, 0), "ar");
5219
+ addLocale({
5220
+ group: ",",
5221
+ decimal: ".",
5222
+ mmmm: _("জানুয়ারী;ফেব্রুয়ারী;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগস্ট;সেপ্টেম্বর;অক্টোবর;নভেম্বর;ডিসেম্বর"),
5223
+ mmm: _("জানু;ফেব;মার্চ;এপ্রি;মে;জুন;জুল;আগ;সেপ্টেঃ;অক্টোঃ;নভেঃ;ডিসেঃ"),
5224
+ dddd: _("রবিবার;সোমবার;মঙ্গলবার;বুধবার;বৃহস্পতিবার;শুক্রবার;শনিবার"),
5225
+ ddd: _("রবি;সোম;মঙ্গল;বুধ;বৃহস্পতি;শুক্র;শনি")
5226
+ }, "bn");
5227
+ addLocale({
5228
+ group: ",",
5229
+ decimal: ".",
5230
+ mmmm: _("जनवरी;फ़रवरी;मार्च;अप्रैल;मई;जून;जुलाई;अगस्त;सितंबर;अक्तूबर;नवंबर;दिसंबर"),
5231
+ mmm: _("जन॰;फ़र॰;मार्च;अप्रैल;मई;जून;जुल॰;अग॰;सित॰;अक्तू॰;नव॰;दिस॰"),
5232
+ dddd: _("रविवार;सोमवार;मंगलवार;बुधवार;गुरुवार;शुक्रवार;शनिवार"),
5233
+ ddd: _("रवि;सोम;मंगल;बुध;गुरु;शुक्र;शनि"),
5234
+ ampm: _("am;pm")
5235
+ }, "hi");
5236
+
5237
+ //#endregion
5238
+ //#region src/shared/numfmt/parse-format-section.ts
5239
+ function getNumberPattern(part, prefix) {
5240
+ switch (prefix) {
5241
+ case "int": return part.int_pattern;
5242
+ case "frac": return part.frac_pattern;
5243
+ case "man": return part.man_pattern;
5244
+ case "den": return part.den_pattern;
5245
+ case "num": return part.num_pattern;
5246
+ }
5247
+ }
5248
+ function minMaxPad(str, part, prefix) {
5249
+ const max = str.length;
5250
+ const min = str.replace(/#/g, "").length;
5251
+ switch (prefix) {
5252
+ case "int":
5253
+ part.int_max = max;
5254
+ part.int_min = min;
5255
+ break;
5256
+ case "frac":
5257
+ part.frac_max = max;
5258
+ part.frac_min = min;
5259
+ break;
5260
+ case "man":
5261
+ part.man_max = max;
5262
+ part.man_min = min;
5263
+ break;
5264
+ case "den":
5265
+ part.den_max = max;
5266
+ part.den_min = min;
5267
+ break;
5268
+ case "num":
5269
+ part.num_max = max;
5270
+ part.num_min = min;
5271
+ break;
5272
+ }
5273
+ return part;
5274
+ }
5275
+ function add(token, tokens) {
5276
+ if (typeof token === "string") tokens.push({
5277
+ type: "string",
5278
+ value: token
5279
+ });
5280
+ else tokens.push(token);
5281
+ }
5282
+ function isNumOp$1(token, activePattern) {
5283
+ const type = token === null || token === void 0 ? void 0 : token.type;
5284
+ return type === "hash" || type === "zero" || type === "qmark" || type === "digit" && activePattern === "den";
5285
+ }
5286
+ function assertNumberChunk(token) {
5287
+ if (token === null) throw new TypeError("Cannot read properties of null (reading 'num')");
5288
+ }
5289
+ function parseFormatSection(inputTokens) {
5290
+ const outputTokens = [];
5291
+ const part = {
5292
+ scale: 1,
5293
+ scaleExponent: 0,
5294
+ percent: false,
5295
+ text: false,
5296
+ date: 0,
5297
+ date_eval: false,
5298
+ date_system: 1,
5299
+ sec_decimals: 0,
5300
+ general: false,
5301
+ clock: 24,
5302
+ int_pattern: [],
5303
+ frac_pattern: [],
5304
+ man_pattern: [],
5305
+ den_pattern: [],
5306
+ num_pattern: [],
5307
+ tokens: outputTokens,
5308
+ tokensUsed: 0,
5309
+ pattern: "",
5310
+ int_max: 0,
5311
+ int_min: 0,
5312
+ frac_max: 0,
5313
+ frac_min: 0,
5314
+ man_max: 0,
5315
+ man_min: 0,
5316
+ num_max: 0,
5317
+ num_min: 0,
5318
+ den_max: 0,
5319
+ den_min: 0,
5320
+ int_p: "",
5321
+ man_p: "",
5322
+ num_p: "",
5323
+ den_p: "",
5324
+ integer: false
5325
+ };
5326
+ let currentPattern = "int";
5327
+ let lastNumberChunk = null;
5328
+ const dateChunks = [];
5329
+ let last;
5330
+ let haveLocale = false;
5331
+ let index = -1;
5332
+ let partOver = false;
5333
+ let patternSource = "";
5334
+ let haveSlash = false;
5335
+ while (++index < inputTokens.length && !partOver) {
5336
+ var _inputTokens;
5337
+ const token = inputTokens[index];
5338
+ const type = token.type || "error";
5339
+ patternSource += token.raw;
5340
+ if (type === "general") {
5341
+ part.general = true;
5342
+ add(token, outputTokens);
5343
+ } else if (isNumOp$1(token, currentPattern)) {
5344
+ const pattern = getNumberPattern(part, currentPattern);
5345
+ if (isNumOp$1(last, currentPattern) || (last === null || last === void 0 ? void 0 : last.type) === "group") {
5346
+ pattern.push((pattern.pop() || "") + token.value);
5347
+ assertNumberChunk(lastNumberChunk);
5348
+ lastNumberChunk.num += token.value;
5349
+ } else {
5350
+ pattern.push(token.value);
5351
+ lastNumberChunk = {
5352
+ type: currentPattern,
5353
+ num: token.value
5354
+ };
5355
+ add(lastNumberChunk, outputTokens);
5356
+ }
5357
+ } else if (type === "paren") {
5358
+ if (token.value === "(") part.parens = true;
5359
+ add(token.value, outputTokens);
5360
+ } else if (type === "digit") add(token.value, outputTokens);
5361
+ else if (type === "slash") {
5362
+ haveSlash = true;
5363
+ const pattern = getNumberPattern(part, currentPattern);
5364
+ if (pattern.length) {
5365
+ if (!lastNumberChunk) throw new SyntaxError("Format pattern is missing a numerator");
5366
+ part.fractions = true;
5367
+ const numerator = pattern.pop();
5368
+ if (numerator === void 0) throw new SyntaxError("Format pattern is missing a numerator");
5369
+ part.num_pattern.push(numerator);
5370
+ lastNumberChunk.type = "num";
5371
+ currentPattern = "den";
5372
+ add({ type: "div" }, outputTokens);
5373
+ } else add(token.value, outputTokens);
5374
+ } else if (type === "comma") add(",", outputTokens);
5375
+ else if (type === "scale") {
5376
+ part.scale = .001 ** token.raw.length;
5377
+ part.scaleExponent = -3 * token.raw.length;
5378
+ } else if (type === "group") {
5379
+ if (currentPattern === "int") part.grouping = true;
5380
+ if (currentPattern === "den") throw new SyntaxError("Cannot group denominator digits");
5381
+ } else if (type === "space") add(token, outputTokens);
5382
+ else if (type === "break") {
5383
+ partOver = true;
5384
+ break;
5385
+ } else if (type === "text") {
5386
+ part.text = true;
5387
+ add(token, outputTokens);
5388
+ } else if (type === "plus" || type === "minus") add(token, outputTokens);
5389
+ else if (type === "duration") {
5390
+ const tokenValue = token.value.toLowerCase();
5391
+ const startsWith = tokenValue[0];
5392
+ const bit = {
5393
+ type: "",
5394
+ size: 0,
5395
+ date: 1,
5396
+ pad: tokenValue.length
5397
+ };
5398
+ if (startsWith === "h") {
5399
+ bit.size = 16;
5400
+ bit.type = "hour-elap";
5401
+ } else if (startsWith === "m") {
5402
+ bit.size = 32;
5403
+ bit.type = "min-elap";
5404
+ } else {
5405
+ bit.size = 64;
5406
+ bit.type = "sec-elap";
5407
+ }
5408
+ part.date = part.date | bit.size;
5409
+ dateChunks.push(bit);
5410
+ add(bit, outputTokens);
5411
+ } else if (part.date && type === "point" && ((_inputTokens = inputTokens[index + 1]) === null || _inputTokens === void 0 ? void 0 : _inputTokens.type) === "zero") {
5412
+ var _inputTokens2, _inputTokens3;
5413
+ let decimals = 1;
5414
+ index++;
5415
+ let raw = "0";
5416
+ if (((_inputTokens2 = inputTokens[index + 1]) === null || _inputTokens2 === void 0 ? void 0 : _inputTokens2.type) === "zero") {
5417
+ raw += "0";
5418
+ decimals = 2;
5419
+ index++;
5420
+ }
5421
+ if (((_inputTokens3 = inputTokens[index + 1]) === null || _inputTokens3 === void 0 ? void 0 : _inputTokens3.type) === "zero") {
5422
+ raw += "0";
5423
+ decimals = 3;
5424
+ index++;
5425
+ }
5426
+ patternSource += raw;
5427
+ const size = [
5428
+ 64,
5429
+ 128,
5430
+ 256,
5431
+ 512
5432
+ ][decimals];
5433
+ part.date = part.date | size;
5434
+ part.date_eval = true;
5435
+ part.sec_decimals = Math.max(part.sec_decimals, decimals);
5436
+ add({
5437
+ type: "subsec",
5438
+ size,
5439
+ decimals,
5440
+ date: 1
5441
+ }, outputTokens);
5442
+ } else if (type === "calendar") {
5443
+ if (!haveLocale) if (token.value === "B2" || token.value === "b2") part.date_system = 6;
5444
+ else part.date_system = 1;
5445
+ } else if (type === "datetime") {
5446
+ const bit = {
5447
+ type: "",
5448
+ size: 0,
5449
+ date: 1
5450
+ };
5451
+ const value = token.value.toLowerCase();
5452
+ const startsWith = value[0];
5453
+ if (value === "y" || value === "yy") {
5454
+ bit.size = 2;
5455
+ bit.type = "year-short";
5456
+ } else if (startsWith === "y" || startsWith === "e") {
5457
+ bit.size = 2;
5458
+ bit.type = "year";
5459
+ } else if (value === "b" || value === "bb") {
5460
+ bit.size = 2;
5461
+ bit.type = "b-year-short";
5462
+ } else if (startsWith === "b") {
5463
+ bit.size = 2;
5464
+ bit.type = "b-year";
5465
+ } else if (value === "d" || value === "dd") {
5466
+ bit.size = 8;
5467
+ bit.type = "day";
5468
+ bit.pad = /dd/.test(value);
5469
+ } else if (value === "ddd" || value === "aaa") {
5470
+ bit.size = 8;
5471
+ bit.type = "weekday-short";
5472
+ } else if (startsWith === "d" || startsWith === "a") {
5473
+ bit.size = 8;
5474
+ bit.type = "weekday";
5475
+ } else if (startsWith === "h") {
5476
+ bit.size = 16;
5477
+ bit.type = "hour";
5478
+ bit.pad = /hh/i.test(value);
5479
+ } else if (startsWith === "m") {
5480
+ if (value.length === 3) {
5481
+ bit.size = 4;
5482
+ bit.type = "monthname-short";
5483
+ } else if (value.length === 5) {
5484
+ bit.size = 4;
5485
+ bit.type = "monthname-single";
5486
+ } else if (value.length >= 4) {
5487
+ bit.size = 4;
5488
+ bit.type = "monthname";
5489
+ }
5490
+ const lastDateChunk = dateChunks[dateChunks.length - 1];
5491
+ if (!bit.type && lastDateChunk && !lastDateChunk.used && lastDateChunk.size & (16 | 64)) {
5492
+ lastDateChunk.used = true;
5493
+ bit.size = 32;
5494
+ bit.type = "min";
5495
+ bit.pad = /mm/.test(value);
5496
+ }
5497
+ if (!bit.type) {
5498
+ bit.size = 4;
5499
+ bit.type = "month";
5500
+ bit.pad = /mm/.test(value);
5501
+ bit.indeterminate = true;
5502
+ }
5503
+ } else if (startsWith === "s") {
5504
+ bit.size = 64;
5505
+ bit.type = "sec";
5506
+ bit.pad = /ss/.test(value);
5507
+ const lastDateChunk = dateChunks[dateChunks.length - 1];
5508
+ if (lastDateChunk && lastDateChunk.size & 32) bit.used = true;
5509
+ else if (lastDateChunk === null || lastDateChunk === void 0 ? void 0 : lastDateChunk.indeterminate) {
5510
+ delete lastDateChunk.indeterminate;
5511
+ lastDateChunk.size = 32;
5512
+ lastDateChunk.type = "min";
5513
+ bit.used = true;
5514
+ }
5515
+ } else if (startsWith === "g") {}
5516
+ part.date = part.date | bit.size;
5517
+ part.date_eval = true;
5518
+ dateChunks.push(bit);
5519
+ add(bit, outputTokens);
5520
+ } else if (type === "ampm") {
5521
+ part.clock = 12;
5522
+ part.date = part.date | 16;
5523
+ part.date_eval = true;
5524
+ token.short = token.value === "A/P";
5525
+ add(token, outputTokens);
5526
+ } else if (type === "string" || type === "escaped" || type === "char") add(token.value, outputTokens);
5527
+ else if (type === "condition") part.condition = [token.value[0], Number.parseFloat(token.value[1])];
5528
+ else if (type === "locale") {
5529
+ const bits = token.value.split("-");
5530
+ const code = bits.length < 2 ? "" : bits.slice(1).join("-");
5531
+ const currency = bits[0];
5532
+ if (currency) add(currency, outputTokens);
5533
+ const locale = resolveLocale(code);
5534
+ if (locale) part.locale = locale;
5535
+ const windowsCode = Number.parseInt(code, 16);
5536
+ if (Number.isFinite(windowsCode) && windowsCode & 16711680) {
5537
+ if ((windowsCode >> 16 & 255) === 6) part.date_system = 6;
5538
+ }
5539
+ haveLocale = true;
5540
+ } else if (type === "color") {
5541
+ const normalizedColor = token.value.toLowerCase();
5542
+ let color = normalizedColor;
5543
+ const colorMatch = /^color\s*(\d+)$/i.exec(normalizedColor);
5544
+ if (colorMatch) color = Number.parseInt(colorMatch[1], 10);
5545
+ part.color = color;
5546
+ } else if (type === "percent") {
5547
+ part.scale = 100;
5548
+ part.scaleExponent = 2;
5549
+ part.percent = true;
5550
+ add("%", outputTokens);
5551
+ } else if (type === "point") {
5552
+ add(token, outputTokens);
5553
+ if (!part.date) {
5554
+ part.dec_fractions = true;
5555
+ currentPattern = "frac";
5556
+ }
5557
+ } else if (type === "exp") {
5558
+ part.exponential = true;
5559
+ part.exp_plus = token.value.includes("+");
5560
+ currentPattern = "man";
5561
+ add({
5562
+ type: "exp",
5563
+ plus: part.exp_plus
5564
+ }, outputTokens);
5565
+ } else if (type === "skip" || type === "fill") add(token, outputTokens);
5566
+ else if (type === "dbnum" || type === "natnum") {} else if (type === "error") throw new SyntaxError(`Illegal character: ${patternSource}`);
5567
+ else throw new SyntaxError(`Unknown token ${type} in ${patternSource}`);
5568
+ last = token;
5569
+ }
5570
+ part.tokensUsed = index;
5571
+ part.pattern = patternSource;
5572
+ if (/^((?:\[[^\]]+\])+)(;|$)/.test(part.pattern) && !/^\[(?:h+|m+|s+)\]/.test(part.pattern)) add({ type: "text" }, outputTokens);
5573
+ if (part.fractions && part.dec_fractions || part.grouping && !part.int_pattern.length || part.fractions && part.exponential || part.fractions && part.den_pattern.length * part.num_pattern.length === 0 || haveSlash && !part.fractions && !part.date || part.exponential && (part.int_pattern.length || part.frac_pattern.length) * part.man_pattern.length === 0) throw new SyntaxError(`Invalid pattern: ${patternSource}`);
5574
+ const intPattern = part.int_pattern.join("");
5575
+ const manPattern = part.man_pattern.join("");
5576
+ const fracPattern = part.frac_pattern.join("");
5577
+ minMaxPad(intPattern, part, "int");
5578
+ let min = 0;
5579
+ for (let patternIndex = 0; patternIndex < intPattern.length; patternIndex++) {
5580
+ const character = intPattern[intPattern.length - 1 - patternIndex];
5581
+ if (/^[0-9?]/.test(character)) min = patternIndex + 1;
5582
+ }
5583
+ part.int_min = min;
5584
+ minMaxPad(fracPattern, part, "frac");
5585
+ minMaxPad(manPattern, part, "man");
5586
+ let numeratorPattern = part.num_pattern.join("");
5587
+ let denominatorPattern = part.den_pattern[0] || "";
5588
+ if (denominatorPattern.includes("?") || numeratorPattern.includes("?")) {
5589
+ denominatorPattern = denominatorPattern.replace(/\d/g, "?");
5590
+ denominatorPattern = denominatorPattern.replace(/#$/g, "?");
5591
+ minMaxPad(numeratorPattern, part, "num");
5592
+ minMaxPad(denominatorPattern, part, "den");
5593
+ numeratorPattern = numeratorPattern.replace(/#$/g, "?");
5594
+ } else {
5595
+ minMaxPad(numeratorPattern, part, "num");
5596
+ minMaxPad(denominatorPattern, part, "den");
5597
+ }
5598
+ part.int_p = intPattern;
5599
+ part.man_p = manPattern;
5600
+ part.num_p = numeratorPattern;
5601
+ part.den_p = denominatorPattern;
5602
+ if (part.den_pattern.length) part.denominator = Number.parseInt(part.den_pattern.join("").replace(/\D/g, ""), 10);
5603
+ part.integer = !!intPattern.length;
5604
+ if (!part.integer && !part.exponential && fracPattern.length) {
5605
+ const pointIndex = part.tokens.findIndex((token) => token.type === "point");
5606
+ part.tokens.splice(pointIndex, 0, {
5607
+ type: "int",
5608
+ value: "#"
5609
+ });
5610
+ part.integer = true;
5611
+ part.int_pattern = ["#"];
5612
+ part.int_p = "#";
5613
+ }
5614
+ if (part.fractions) for (let tokenIndex = 0; tokenIndex < outputTokens.length - 1; tokenIndex++) {
5615
+ const token = outputTokens[tokenIndex];
5616
+ if (token.type !== "string" && token.type !== "space") continue;
5617
+ const nextType = outputTokens[tokenIndex + 1].type;
5618
+ if (nextType === "num") token.rule = "num+int";
5619
+ else if (nextType === "div") token.rule = "num";
5620
+ else if (nextType === "den") token.rule = "den";
5621
+ }
5622
+ if (part.grouping && part.int_pattern.length > 1) part.grouping = false;
5623
+ return part;
5624
+ }
5625
+
5626
+ //#endregion
5627
+ //#region src/shared/numfmt/clamp.ts
5628
+ /**
5629
+ * Copyright 2023-present DreamNum Co., Ltd.
5630
+ *
5631
+ * Licensed under the Apache License, Version 2.0 (the "License");
5632
+ * you may not use this file except in compliance with the License.
5633
+ * You may obtain a copy of the License at
5634
+ *
5635
+ * http://www.apache.org/licenses/LICENSE-2.0
5636
+ *
5637
+ * Unless required by applicable law or agreed to in writing, software
5638
+ * distributed under the License is distributed on an "AS IS" BASIS,
5639
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5640
+ * See the License for the specific language governing permissions and
5641
+ * limitations under the License.
5642
+ */
5643
+ function clamp(number) {
5644
+ if (number === 0) return number;
5645
+ const d = Math.ceil(Math.log10(number < 0 ? -number : number));
5646
+ const mag = 10 ** (16 - Math.floor(d));
5647
+ return isFinite(mag) ? Math.round(number * mag) / mag : 0;
5648
+ }
5649
+
5650
+ //#endregion
5651
+ //#region src/shared/numfmt/dec-to-frac.ts
5652
+ /**
5653
+ * Copyright 2023-present DreamNum Co., Ltd.
5654
+ *
5655
+ * Licensed under the Apache License, Version 2.0 (the "License");
5656
+ * you may not use this file except in compliance with the License.
5657
+ * You may obtain a copy of the License at
5658
+ *
5659
+ * http://www.apache.org/licenses/LICENSE-2.0
5660
+ *
5661
+ * Unless required by applicable law or agreed to in writing, software
5662
+ * distributed under the License is distributed on an "AS IS" BASIS,
5663
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5664
+ * See the License for the specific language governing permissions and
5665
+ * limitations under the License.
5666
+ */
5667
+ const PRECISION = 1e-13;
5668
+ /**
5669
+ * Split a fractional number into a numerator and denominator for display as
5670
+ * vulgar fractions.
5671
+ *
5672
+ * @ignore
5673
+ * @param {number} number The value to split
5674
+ * @param {number} [numeratorMaxDigits] The maxdigits number
5675
+ * @param {number} [denominatorMaxDigits] The maxdigits de
5676
+ * @returns {Array<number>} Array of two numbers, numerator and denominator.
5677
+ */
5678
+ function dec2frac(number, numeratorMaxDigits = 2, denominatorMaxDigits = 2) {
5679
+ const sign = number < 0 ? -1 : 1;
5680
+ const maxdigits_n = 10 ** (numeratorMaxDigits || 2);
5681
+ const maxdigits_d = 10 ** (denominatorMaxDigits || 2);
5682
+ let z = Math.abs(number);
5683
+ let last_d = 0;
5684
+ let last_n = 0;
5685
+ let curr_n = 0;
5686
+ let curr_d = 1;
5687
+ let tmp;
5688
+ let r;
5689
+ number = z;
5690
+ if (number % 1 === 0) r = [number * sign, 1];
5691
+ else if (number < 1e-19) r = [sign, 0x8ac7230489e80000];
5692
+ else if (number > 0x8ac7230489e80000) r = [0x8ac7230489e80000 * sign, 1];
5693
+ else {
5694
+ do {
5695
+ z = 1 / (z - Math.floor(z));
5696
+ tmp = curr_d;
5697
+ curr_d = curr_d * Math.floor(z) + last_d;
5698
+ last_d = tmp;
5699
+ last_n = curr_n;
5700
+ curr_n = Math.floor(number * curr_d + .5);
5701
+ if (curr_n >= maxdigits_n || curr_d >= maxdigits_d) return [sign * last_n, last_d];
5702
+ } while (Math.abs(number - curr_n / curr_d) >= PRECISION && z !== Math.floor(z));
5703
+ r = [sign * curr_n, curr_d];
5704
+ }
5705
+ return r;
5706
+ }
5707
+
5708
+ //#endregion
5709
+ //#region src/shared/numfmt/num-dec.ts
5710
+ const ZERO_DIGITS = {
5711
+ total: 1,
5712
+ sign: 0,
5713
+ period: 0,
5714
+ int: 1,
5715
+ frac: 0
5716
+ };
5717
+ function numDec(value, includeSign = true) {
5718
+ const decimal = decimalFromNumber(value);
5719
+ if (decimal.digits === "0") return ZERO_DIGITS;
5720
+ const decimalPoint = decimal.exponent + 1;
5721
+ const intSize = Math.max(decimalPoint, 1);
5722
+ const fracSize = Math.max(0, decimal.digits.length - decimalPoint);
5723
+ const signSize = includeSign && decimal.negative ? 1 : 0;
5724
+ const periodSize = fracSize > 0 ? 1 : 0;
5725
+ return {
5726
+ total: signSize + intSize + periodSize + fracSize,
5727
+ digits: Math.max(decimalPoint, 0) + fracSize,
5728
+ sign: signSize,
5729
+ period: periodSize,
5730
+ int: intSize,
5731
+ frac: fracSize
5732
+ };
5733
+ }
5734
+
5735
+ //#endregion
5736
+ //#region src/shared/numfmt/number-props.ts
5737
+ /**
5738
+ * Copyright 2023-present DreamNum Co., Ltd.
5739
+ *
5740
+ * Licensed under the Apache License, Version 2.0 (the "License");
5741
+ * you may not use this file except in compliance with the License.
5742
+ * You may obtain a copy of the License at
5743
+ *
5744
+ * http://www.apache.org/licenses/LICENSE-2.0
5745
+ *
5746
+ * Unless required by applicable law or agreed to in writing, software
5747
+ * distributed under the License is distributed on an "AS IS" BASIS,
5748
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5749
+ * See the License for the specific language governing permissions and
5750
+ * limitations under the License.
5751
+ */
5752
+ function getExponent(number, intMax = 0) {
5753
+ const exponent = Math.floor(Math.log10(number));
5754
+ return intMax > 1 ? Math.floor(exponent / intMax) * intMax : exponent;
5755
+ }
5756
+ function getSignificand(number, exponent = 1) {
5757
+ if (exponent < -300) return Number.parseFloat(number.toExponential().split("e")[0]);
5758
+ return number * 10 ** -exponent;
5759
+ }
5760
+
5761
+ //#endregion
5762
+ //#region src/shared/numfmt/round.ts
5763
+ /**
5764
+ * Copyright 2023-present DreamNum Co., Ltd.
5765
+ *
5766
+ * Licensed under the Apache License, Version 2.0 (the "License");
5767
+ * you may not use this file except in compliance with the License.
5768
+ * You may obtain a copy of the License at
5769
+ *
5770
+ * http://www.apache.org/licenses/LICENSE-2.0
5771
+ *
5772
+ * Unless required by applicable law or agreed to in writing, software
5773
+ * distributed under the License is distributed on an "AS IS" BASIS,
5774
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5775
+ * See the License for the specific language governing permissions and
5776
+ * limitations under the License.
5777
+ */
5778
+ function legacyRound$1(number, places = 0) {
5779
+ if (number < 0) return -legacyRound$1(-number, places);
5780
+ if (places) {
5781
+ const power = 10 ** places || 1;
5782
+ return legacyRound$1(number * power, 0) / power;
5783
+ }
5784
+ return Math.round(number);
5785
+ }
5786
+ function round(number, places = 0) {
5787
+ if (typeof number !== "number") return number;
5788
+ if (!Number.isFinite(number) || number === 0) return number === 0 ? 0 : number;
5789
+ if (!Number.isFinite(places)) return legacyRound$1(number, places);
5790
+ const normalizedPlaces = Math.trunc(places);
5791
+ if (Number.isInteger(number) && normalizedPlaces >= 0 || normalizedPlaces > 324) return number;
5792
+ const rounded = decimalPartsToNumber(roundDecimal(decimalFromNumber(number), normalizedPlaces));
5793
+ return Number.isFinite(rounded) ? rounded : number;
5794
+ }
5795
+
5796
+ //#endregion
5797
+ //#region src/shared/numfmt/general.ts
5798
+ function fixLocale(value, locale) {
5799
+ return value.replace(/\./, locale.decimal);
5800
+ }
5801
+ function getAbsoluteDecimal(value) {
5802
+ if (!value) return null;
5803
+ return value.negative ? {
5804
+ ...value,
5805
+ negative: false
5806
+ } : value;
5807
+ }
5808
+ function getDecimalExponent(value) {
5809
+ var _value$exponent;
5810
+ return (_value$exponent = value === null || value === void 0 ? void 0 : value.exponent) !== null && _value$exponent !== void 0 ? _value$exponent : 0;
5811
+ }
5812
+ function usesShortestSignificand(value) {
5813
+ return !value || value.exponent < -308;
5814
+ }
5815
+ function getExp(value, locale) {
5816
+ const scientific = roundScientificDecimal(value, 1, true, 5);
5817
+ const exponent = scientific.exponent;
5818
+ const absoluteExponent = Math.abs(exponent);
5819
+ return [
5820
+ fixLocale(decimalPartsToPlainString(scientific.rounded), locale),
5821
+ locale.exponent,
5822
+ exponent < 0 ? locale.negative : locale.positive,
5823
+ absoluteExponent < 10 ? "0" : "",
5824
+ absoluteExponent
5825
+ ];
5826
+ }
5827
+ function getShortestExp(number, exponent, locale) {
5828
+ const absoluteExponent = Math.abs(exponent);
5829
+ const mantissa = number === 1 ? number : Math.round(number * 1e5) / 1e5;
5830
+ return [
5831
+ fixLocale(String(mantissa), locale),
5832
+ locale.exponent,
5833
+ exponent < 0 ? locale.negative : locale.positive,
5834
+ absoluteExponent < 10 ? "0" : "",
5835
+ absoluteExponent
5836
+ ];
5837
+ }
5838
+ function general(output, part, value, locale, decimalValue = null) {
5839
+ const integer = typeof value === "number" ? value | 0 : 0;
5840
+ if (typeof value === "string") output.push(value);
5841
+ else if (value === integer) output.push(Math.abs(integer));
5842
+ else {
5843
+ const absoluteValue = Math.abs(value);
5844
+ const absoluteDecimal = getAbsoluteDecimal(decimalValue);
5845
+ let exponent = getDecimalExponent(absoluteDecimal);
5846
+ let shortestSignificand = null;
5847
+ if (usesShortestSignificand(absoluteDecimal)) {
5848
+ exponent = getExponent(absoluteValue);
5849
+ shortestSignificand = getSignificand(absoluteValue, exponent);
5850
+ if (shortestSignificand === 10) {
5851
+ shortestSignificand = 1;
5852
+ exponent++;
5853
+ }
5854
+ }
5855
+ const digits = numDec(absoluteValue);
5856
+ if (exponent >= -4 && exponent <= -1) {
5857
+ const formatted = absoluteValue.toPrecision(10 + exponent).replace(/\.?0+$/, "");
5858
+ output.push(fixLocale(formatted, locale));
5859
+ } else if (exponent === 10) {
5860
+ const formatted = absoluteValue.toFixed(10).slice(0, 12).replace(/\.$/, "");
5861
+ output.push(fixLocale(formatted, locale));
5862
+ } else if (Math.abs(exponent) <= 9) if (digits.total <= 11) {
5863
+ const formatted = round(absoluteValue, 9).toFixed(digits.frac);
5864
+ output.push(fixLocale(formatted, locale));
5865
+ } else if (exponent === 9) output.push(Math.floor(absoluteValue));
5866
+ else if (exponent >= 0 && exponent < 9) output.push(fixLocale(String(round(absoluteValue, 9 - exponent)), locale));
5867
+ else output.push(...shortestSignificand === null ? getExp(absoluteDecimal, locale) : getShortestExp(shortestSignificand, exponent, locale));
5868
+ else if (digits.total >= 12) output.push(...shortestSignificand === null ? getExp(absoluteDecimal, locale) : getShortestExp(shortestSignificand, exponent, locale));
5869
+ else output.push(fixLocale(round(absoluteValue, 9).toFixed(digits.frac), locale));
5870
+ }
5871
+ return output;
5872
+ }
5873
+
5874
+ //#endregion
5875
+ //#region src/shared/numfmt/pad.ts
5876
+ /**
5877
+ * Copyright 2023-present DreamNum Co., Ltd.
5878
+ *
5879
+ * Licensed under the Apache License, Version 2.0 (the "License");
5880
+ * you may not use this file except in compliance with the License.
5881
+ * You may obtain a copy of the License at
5882
+ *
5883
+ * http://www.apache.org/licenses/LICENSE-2.0
5884
+ *
5885
+ * Unless required by applicable law or agreed to in writing, software
5886
+ * distributed under the License is distributed on an "AS IS" BASIS,
5887
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5888
+ * See the License for the specific language governing permissions and
5889
+ * limitations under the License.
5890
+ */
5891
+ /**
5892
+ * @ignore
5893
+ * @param {string} char Instruction character (['#', '?', '0'])
5894
+ * @param {boolean} [nbsp] Use nonbreaking space or not?
5895
+ * @returns {string} Padding character
5896
+ */
5897
+ function pad$1(char, nbsp = false) {
5898
+ if (char === "0") return "0";
5899
+ else if (char === "?") return nbsp ? "\xA0" : " ";
5900
+ return "";
5901
+ }
5902
+
5903
+ //#endregion
5904
+ //#region src/shared/numfmt/to-ymd.ts
5905
+ const floor$1 = Math.floor;
5906
+ function toYMD1900(serial, leap1900 = true) {
5907
+ if (leap1900 && serial >= 0) {
5908
+ if (serial === 0) return [
5909
+ 1900,
5910
+ 1,
5911
+ 0
5912
+ ];
5913
+ if (serial === 60) return [
5914
+ 1900,
5915
+ 2,
5916
+ 29
5917
+ ];
5918
+ if (serial < 60) return [
5919
+ 1900,
5920
+ serial < 32 ? 1 : 2,
5921
+ (serial - 1) % 31 + 1
5922
+ ];
5923
+ }
5924
+ let l = serial + 68569 + 2415019;
5925
+ const n = floor$1(4 * l / 146097);
5926
+ l -= floor$1((146097 * n + 3) / 4);
5927
+ const i = floor$1(4e3 * (l + 1) / 1461001);
5928
+ l = l - floor$1(1461 * i / 4) + 31;
5929
+ const j = floor$1(80 * l / 2447);
5930
+ const nDay = l - floor$1(2447 * j / 80);
5931
+ l = floor$1(j / 11);
5932
+ const nMonth = j + 2 - 12 * l;
5933
+ return [
5934
+ 100 * (n - 49) + i + l | 0,
5935
+ nMonth | 0,
5936
+ nDay | 0
5937
+ ];
5938
+ }
5939
+ function toYMD1904(serial) {
5940
+ return toYMD1900(serial + 1462);
5941
+ }
5942
+ function toYMD1317(serial) {
5943
+ if (serial === 60) throw new Error("#VALUE!");
5944
+ if (serial <= 1) return [
5945
+ 1317,
5946
+ 8,
5947
+ 29
5948
+ ];
5949
+ if (serial < 60) return [
5950
+ 1317,
5951
+ serial < 32 ? 9 : 10,
5952
+ 1 + (serial - 2) % 30
5953
+ ];
5954
+ const y = 10631 / 30;
5955
+ const shift1 = 8.01 / 60;
5956
+ let z = serial + 466935;
5957
+ const cyc = floor$1(z / 10631);
5958
+ z -= 10631 * cyc;
5959
+ const j = floor$1((z - shift1) / y);
5960
+ z -= floor$1(j * y + shift1);
5961
+ const m = floor$1((z + 28.5001) / 29.5);
5962
+ if (m === 13) return [
5963
+ 30 * cyc + j,
5964
+ 12,
5965
+ 30
5966
+ ];
5967
+ return [
5968
+ 30 * cyc + j,
5969
+ m,
5970
+ z - floor$1(29.5001 * m - 29)
5971
+ ];
5972
+ }
5973
+ function toYMD(serial, system = 0, leap1900 = true) {
5974
+ const int = floor$1(serial);
5975
+ if (system === 6) return toYMD1317(int);
5976
+ if (system === -1) return toYMD1904(int);
5977
+ return toYMD1900(int, leap1900);
5978
+ }
5979
+
5980
+ //#endregion
5981
+ //#region src/shared/numfmt/run-part.ts
5982
+ const DAYSIZE$1 = 86400;
5983
+ function dateOverflows(inputValue, roundedValue, bigRange) {
5984
+ if (bigRange) return inputValue < -694324 || roundedValue >= 35830291;
5985
+ return inputValue < 0 || roundedValue >= 2958466;
5986
+ }
5987
+ function legacyRound(number, places = 0) {
5988
+ if (number < 0) return -legacyRound(-number, places);
5989
+ if (places) {
5990
+ const power = 10 ** places || 1;
5991
+ return legacyRound(number * power, 0) / power;
5992
+ }
5993
+ return Math.round(number);
5994
+ }
5995
+ function runPart(value, part, options, locale, decimalValue = null) {
5996
+ var _options$grouping$, _options$grouping$2;
5997
+ const section = part;
5998
+ let renderValue = value;
5999
+ let numericValue = value;
6000
+ let mantissa = "";
6001
+ let mantissaSign = "";
6002
+ let numerator = "";
6003
+ let denominator = "";
6004
+ let fraction = "";
6005
+ let integer = "";
6006
+ let exponent = 0;
6007
+ let roundedNumber = null;
6008
+ let date = 0;
6009
+ if (typeof renderValue === "bigint") {
6010
+ if (renderValue <= Number.MAX_SAFE_INTEGER && renderValue >= Number.MIN_SAFE_INTEGER) {
6011
+ numericValue = Number(renderValue);
6012
+ renderValue = numericValue;
6013
+ } else return options.bigintErrorNumber ? String(renderValue) : options.overflow;
6014
+ date = numericValue;
6015
+ } else date = Math.trunc(numericValue);
6016
+ let time = 0;
6017
+ let year = 0;
6018
+ let month = 1;
6019
+ let day = 0;
6020
+ let weekday = 0;
6021
+ let hour = 0;
6022
+ let minute = 0;
6023
+ let second = 0;
6024
+ let subsec = 0;
6025
+ const l10n = locale || defaultLocale;
6026
+ let decimal = decimalValue;
6027
+ if (!decimal && typeof value === "number" && Number.isFinite(value)) decimal = decimalFromNumber(value);
6028
+ if (decimal && !section.text && section.scaleExponent) decimal = shiftDecimal(decimal, section.scaleExponent);
6029
+ if (!section.text && Number.isFinite(section.scale) && section.scale !== 1) {
6030
+ numericValue = clamp(numericValue * section.scale);
6031
+ renderValue = numericValue;
6032
+ }
6033
+ if (section.exponential && decimal && decimal.exponent >= -308) {
6034
+ const scientific = roundScientificDecimal(decimal, section.int_max, Boolean(section.integer), section.frac_max);
6035
+ exponent = scientific.exponent;
6036
+ roundedNumber = scientific.rounded;
6037
+ mantissa += Math.abs(exponent);
6038
+ } else if (section.exponential) {
6039
+ let significand = Math.abs(numericValue);
6040
+ if (significand) exponent = getExponent(significand, section.int_max);
6041
+ if (numericValue && !section.integer) exponent++;
6042
+ significand = getSignificand(significand, exponent);
6043
+ if (section.int_max === 1 && legacyRound(significand, section.frac_max) === 10) {
6044
+ significand = 1;
6045
+ exponent++;
6046
+ }
6047
+ numericValue = numericValue < 0 ? -significand : significand;
6048
+ renderValue = numericValue;
6049
+ mantissa += Math.abs(exponent);
6050
+ }
6051
+ const requiresDecimalRounding = !Number.isSafeInteger(numericValue) || Boolean(section.scaleExponent);
6052
+ roundedNumber = roundedNumber || (decimal && requiresDecimalRounding && !section.date && !section.fractions && !section.exponential && (section.integer || section.dec_fractions) ? roundDecimal(decimal, section.frac_max) : null);
6053
+ if (section.integer) if (roundedNumber) integer = roundedNumber.integer === "0" ? "" : roundedNumber.integer;
6054
+ else {
6055
+ const places = section.fractions ? 1 : section.frac_max;
6056
+ const roundedInteger = Math.abs(Number.isSafeInteger(numericValue) && places === 0 ? numericValue : legacyRound(numericValue, places));
6057
+ integer += roundedInteger < 1 ? "" : Math.floor(roundedInteger);
6058
+ }
6059
+ const primaryGroup = (_options$grouping$ = options.grouping[0]) !== null && _options$grouping$ !== void 0 ? _options$grouping$ : 3;
6060
+ const secondaryGroup = (_options$grouping$2 = options.grouping[1]) !== null && _options$grouping$2 !== void 0 ? _options$grouping$2 : primaryGroup;
6061
+ if (section.dec_fractions) fraction = roundedNumber ? roundedNumber.fraction : String(legacyRound(numericValue, section.frac_max)).split(".")[1] || "";
6062
+ const fixedSlash = !section.error && (section.num_p.includes("0") || section.den_p.includes("0"));
6063
+ let haveFraction = fixedSlash;
6064
+ if (section.fractions) {
6065
+ haveFraction = fixedSlash || !!(numericValue % 1);
6066
+ const decimal = Math.abs(section.integer ? numericValue % 1 : numericValue);
6067
+ if (decimal) {
6068
+ haveFraction = true;
6069
+ if (section.denominator && Number.isFinite(section.denominator)) {
6070
+ denominator += section.denominator;
6071
+ numerator += legacyRound(decimal * section.denominator);
6072
+ if (numerator === "0") {
6073
+ numerator = "";
6074
+ denominator = "";
6075
+ haveFraction = fixedSlash;
6076
+ }
6077
+ } else {
6078
+ const fractionParts = dec2frac(decimal, Infinity, section.den_max);
6079
+ numerator += fractionParts[0];
6080
+ denominator += fractionParts[1];
6081
+ if (section.integer && numerator === "0") {
6082
+ numerator = "";
6083
+ denominator = "";
6084
+ haveFraction = fixedSlash;
6085
+ }
6086
+ }
6087
+ } else if (!numericValue && !section.integer) {
6088
+ haveFraction = true;
6089
+ numerator = "0";
6090
+ denominator = "1";
6091
+ }
6092
+ if (section.integer && !haveFraction && !Math.trunc(numericValue)) integer = "0";
6093
+ }
6094
+ if (section.date) {
6095
+ date = Math.trunc(numericValue);
6096
+ const rawTime = DAYSIZE$1 * (numericValue - date);
6097
+ time = Math.floor(rawTime);
6098
+ subsec = rawTime - time;
6099
+ if (Math.abs(subsec) < 1e-6) subsec = 0;
6100
+ else if (subsec > .9999) {
6101
+ subsec = 0;
6102
+ time += 1;
6103
+ if (time === DAYSIZE$1) {
6104
+ time = 0;
6105
+ date += 1;
6106
+ }
6107
+ }
6108
+ if (subsec) {
6109
+ const minimumUnit = section.date & 512 || section.date & 256 || section.date & 128;
6110
+ if (minimumUnit === 512 && subsec > .9995 || minimumUnit === 256 && subsec > .995 || minimumUnit === 128 && subsec > .95 || !minimumUnit && subsec >= .5) {
6111
+ time++;
6112
+ subsec = 0;
6113
+ }
6114
+ }
6115
+ if (date || section.date_system) {
6116
+ const dateOutput = toYMD(numericValue, section.date_system, options.leap1900);
6117
+ year = dateOutput[0];
6118
+ month = dateOutput[1];
6119
+ day = dateOutput[2];
6120
+ }
6121
+ if (time) {
6122
+ const normalizedTime = time < 0 ? DAYSIZE$1 + time : time;
6123
+ second = Math.floor(normalizedTime) % 60;
6124
+ minute = Math.floor(normalizedTime / 60) % 60;
6125
+ hour = Math.floor(normalizedTime / 60 / 60) % 60;
6126
+ }
6127
+ weekday = (6 + date) % 7;
6128
+ if (section.date_eval && dateOverflows(numericValue, date + time / DAYSIZE$1, options.dateSpanLarge)) {
6129
+ if (options.dateErrorThrows) throw new Error("Date out of bounds");
6130
+ if (options.dateErrorNumber) return general(numericValue < 0 ? [l10n.negative] : [], {}, numericValue, l10n, decimal).join("");
6131
+ return options.overflow;
6132
+ }
6133
+ }
6134
+ const questionPadding = pad$1("?", options.nbsp);
6135
+ if (exponent < 0) mantissaSign = "-";
6136
+ else if (section.exp_plus) mantissaSign = "+";
6137
+ const output = [];
6138
+ const digitsStart = (numberString, pattern, tokenPattern, offset) => {
6139
+ let normalizedOffset = offset;
6140
+ const length = !normalizedOffset && numberString.length > pattern.length ? tokenPattern.length + numberString.length - pattern.length : tokenPattern.length;
6141
+ if (numberString.length < pattern.length) normalizedOffset += numberString.length - pattern.length;
6142
+ for (let index = 0; index < length; index++) output.push(numberString[index + normalizedOffset] || pad$1(tokenPattern[index], options.nbsp));
6143
+ return length;
6144
+ };
6145
+ let denominatorFixed = false;
6146
+ const counter = {
6147
+ int: 0,
6148
+ frac: 0,
6149
+ man: 0,
6150
+ num: 0,
6151
+ den: 0
6152
+ };
6153
+ for (let tokenIndex = 0, tokenLength = section.tokens.length; tokenIndex < tokenLength; tokenIndex++) {
6154
+ const token = section.tokens[tokenIndex];
6155
+ const tokenType = token.type;
6156
+ const length = token.num ? token.num.length : 0;
6157
+ if (tokenType === "string") {
6158
+ const tokenValue = token.value;
6159
+ if (token.rule) {
6160
+ if (token.rule === "num") {
6161
+ if (haveFraction) output.push(tokenValue.replace(/ /g, questionPadding));
6162
+ else if (section.num_min > 0 || section.den_min > 0) output.push(tokenValue.replace(/./g, questionPadding));
6163
+ } else if (token.rule === "num+int") {
6164
+ if (haveFraction && integer) output.push(tokenValue.replace(/ /g, questionPadding));
6165
+ else if (section.den_min > 0 && (integer || section.num_min)) output.push(tokenValue.replace(/./g, questionPadding));
6166
+ } else if (token.rule === "den") {
6167
+ if (haveFraction) output.push(tokenValue.replace(/ /g, questionPadding));
6168
+ else if (section.den_min > 0) output.push(tokenValue.replace(/./g, questionPadding));
6169
+ }
6170
+ } else output.push(tokenValue.replace(/ /g, questionPadding));
6171
+ } else if (tokenType === "space") if (token.rule === "num+int") {
6172
+ if ((haveFraction || section.num_min || section.den_min) && (integer || section.num_min)) output.push(questionPadding);
6173
+ } else output.push(questionPadding);
6174
+ else if (tokenType === "error") output.push(options.invalid);
6175
+ else if (tokenType === "point") output.push(section.date ? token.value : l10n.decimal);
6176
+ else if (tokenType === "general") general(output, section, renderValue, l10n, decimal);
6177
+ else if (tokenType === "exp") output.push(l10n.exponent);
6178
+ else if (tokenType === "minus") if (token.volatile && section.date) {} else if (token.volatile && roundedNumber) {
6179
+ if (roundedNumber.negative && !roundedNumber.zero) output.push(l10n.negative);
6180
+ } else if (token.volatile && (numericValue >= 0 || typeof renderValue !== "number")) {} else if (token.volatile && !section.fractions && (section.integer || section.dec_fractions)) {
6181
+ if (numericValue < 0 && !!integer && integer !== "0" || fraction) output.push(l10n.negative);
6182
+ } else output.push(l10n.negative);
6183
+ else if (tokenType === "plus") output.push(l10n.positive);
6184
+ else if (tokenType === "text") output.push(renderValue);
6185
+ else if (tokenType === "fill") {
6186
+ if (options.fillChar) output.push(options.fillChar, token.value);
6187
+ } else if (tokenType === "skip") if (options.skipChar) output.push(options.skipChar, token.value);
6188
+ else output.push(options.nbsp ? "\xA0" : " ");
6189
+ else if (tokenType === "div") if (haveFraction) output.push("/");
6190
+ else if (section.num_min > 0 || section.den_min > 0) output.push(questionPadding);
6191
+ else output.push(pad$1("#", options.nbsp));
6192
+ else if (tokenType === "int") if (section.int_pattern.length === 1) {
6193
+ const pattern = section.int_p;
6194
+ const length = Math.max(section.int_min, integer.length);
6195
+ let digits = "";
6196
+ for (let index = length; index > 0; index--) {
6197
+ const digit = integer.charAt(integer.length - index);
6198
+ const patternDigit = digit ? "" : pattern.charAt(pattern.length - index) || pattern[0];
6199
+ let separator = "";
6200
+ if (section.grouping) {
6201
+ const groupIndex = index - 1 - primaryGroup;
6202
+ if (groupIndex >= 0 && !(groupIndex % secondaryGroup)) separator = digit || patternDigit === "0" ? l10n.group : pad$1("?", options.nbsp);
6203
+ }
6204
+ digits += (digit || pad$1(patternDigit, options.nbsp)) + separator;
6205
+ }
6206
+ output.push(digits);
6207
+ } else counter.int += digitsStart(integer, section.int_p, token.num, counter.int);
6208
+ else if (tokenType === "frac") {
6209
+ const offset = counter.frac;
6210
+ for (let index = 0; index < length; index++) output.push(fraction[index + offset] || pad$1(token.num[index], options.nbsp));
6211
+ counter.frac += length;
6212
+ } else if (tokenType === "man") {
6213
+ if (!counter[tokenType] && !counter.man) output.push(mantissaSign);
6214
+ counter.man += digitsStart(mantissa, section.man_p, token.num, counter.man);
6215
+ } else if (tokenType === "num") counter.num += digitsStart(numerator, section.num_p, token.num, counter.num);
6216
+ else if (tokenType === "den") {
6217
+ const offset = counter.den;
6218
+ for (let index = 0; index < length; index++) {
6219
+ let digit = denominator[index + offset];
6220
+ if (!digit) {
6221
+ const char = token.num[index];
6222
+ if ("123456789".includes(char) || denominatorFixed && char === "0") {
6223
+ denominatorFixed = true;
6224
+ digit = options.nbsp ? "\xA0" : " ";
6225
+ } else if (!denominatorFixed && index === length - 1 && char === "0" && !denominator) digit = "1";
6226
+ else digit = pad$1(char, options.nbsp);
6227
+ }
6228
+ output.push(digit);
6229
+ }
6230
+ counter.den += length;
6231
+ } else if (tokenType === "year") {
6232
+ if (year < 0) output.push(l10n.negative);
6233
+ output.push(String(Math.abs(year)).padStart(4, "0"));
6234
+ } else if (tokenType === "year-short") {
6235
+ const shortYear = year % 100;
6236
+ output.push(shortYear < 10 ? "0" : "", shortYear);
6237
+ } else if (tokenType === "month") output.push(token.pad && month < 10 ? "0" : "", month);
6238
+ else if (tokenType === "monthname-single") if (section.date_system === 6) output.push(l10n.mmmm6[month - 1].charAt(0));
6239
+ else output.push(l10n.mmmm[month - 1].charAt(0));
6240
+ else if (tokenType === "monthname-short") if (section.date_system === 6) output.push(l10n.mmm6[month - 1]);
6241
+ else output.push(l10n.mmm[month - 1]);
6242
+ else if (tokenType === "monthname") if (section.date_system === 6) output.push(l10n.mmmm6[month - 1]);
6243
+ else output.push(l10n.mmmm[month - 1]);
6244
+ else if (token.type === "weekday-short") output.push(l10n.ddd[weekday]);
6245
+ else if (tokenType === "weekday") output.push(l10n.dddd[weekday]);
6246
+ else if (tokenType === "day") output.push(token.pad && day < 10 ? "0" : "", day);
6247
+ else if (tokenType === "hour") {
6248
+ const displayHour = hour % section.clock || (section.clock < 24 ? section.clock : 0);
6249
+ output.push(token.pad && displayHour < 10 ? "0" : "", displayHour);
6250
+ } else if (tokenType === "min") output.push(token.pad && minute < 10 ? "0" : "", minute);
6251
+ else if (tokenType === "sec") output.push(token.pad && second < 10 ? "0" : "", second);
6252
+ else if (tokenType === "subsec") {
6253
+ output.push(l10n.decimal);
6254
+ const formattedSubseconds = subsec.toFixed(section.sec_decimals);
6255
+ output.push(formattedSubseconds.slice(2, 2 + token.decimals));
6256
+ } else if (tokenType === "ampm") {
6257
+ const index = hour < 12 ? 0 : 1;
6258
+ if (token.short && !locale) output.push("AP"[index]);
6259
+ else output.push(l10n.ampm[index]);
6260
+ } else if (tokenType === "hour-elap") {
6261
+ if (numericValue < 0) output.push(l10n.negative);
6262
+ const elapsedHours = date * 24 + Math.floor(Math.abs(time) / 3600);
6263
+ output.push(String(Math.abs(elapsedHours)).padStart(token.pad, "0"));
6264
+ } else if (tokenType === "min-elap") {
6265
+ if (numericValue < 0) output.push(l10n.negative);
6266
+ const elapsedMinutes = date * 1440 + Math.floor(Math.abs(time) / 60);
6267
+ output.push(String(Math.abs(elapsedMinutes)).padStart(token.pad, "0"));
6268
+ } else if (tokenType === "sec-elap") {
6269
+ if (numericValue < 0) output.push(l10n.negative);
6270
+ const elapsedSeconds = date * DAYSIZE$1 + Math.abs(time);
6271
+ output.push(String(Math.abs(elapsedSeconds)).padStart(token.pad, "0"));
6272
+ } else if (tokenType === "b-year") output.push(year + 543);
6273
+ else if (tokenType === "b-year-short") {
6274
+ const shortYear = (year + 543) % 100;
6275
+ output.push(shortYear < 10 ? "0" : "", shortYear);
6276
+ }
6277
+ }
6278
+ return output.join("");
6279
+ }
6280
+
6281
+ //#endregion
6282
+ //#region src/shared/numfmt/format-number.ts
6283
+ const defaultText = parseFormatSection([{
6284
+ type: TOKEN_TEXT,
6285
+ value: "@",
6286
+ raw: "@"
6287
+ }]);
6288
+ function isParsedSection(part) {
6289
+ return !!part && "scale" in part;
6290
+ }
6291
+ function getPart(value, parts) {
6292
+ for (let partIndex = 0; partIndex < 3; partIndex++) {
6293
+ const part = parts[partIndex];
6294
+ if (isParsedSection(part)) {
6295
+ let condition;
6296
+ if (part.condition) {
6297
+ const operator = part.condition[0];
6298
+ const operand = part.condition[1];
6299
+ if (operator === "=") condition = value === operand;
6300
+ else if (operator === ">") condition = value > operand;
6301
+ else if (operator === "<") condition = value < operand;
6302
+ else if (operator === ">=") condition = value >= operand;
6303
+ else if (operator === "<=") condition = value <= operand;
6304
+ else if (operator === "<>") condition = value !== operand;
6305
+ } else condition = true;
6306
+ if (condition) return part;
6307
+ } else if (part) return part;
6308
+ }
6309
+ }
6310
+ function formatColor$1(value, pattern, options) {
6311
+ const parts = pattern.partitions;
6312
+ let part = parts[3];
6313
+ let color = null;
6314
+ if ((typeof value === "number" || typeof value === "bigint") && isFinite(value)) part = getPart(value, parts);
6315
+ if (isParsedSection(part) && part.color) color = part.color;
6316
+ if (color && typeof color === "number" && options.indexColors) color = indexColors[color - 1] || "#000";
6317
+ return color;
6318
+ }
6319
+ function formatValue(value, pattern, options) {
6320
+ const parts = pattern.partitions;
6321
+ const locale = getLocale(pattern.locale || options.locale);
6322
+ let renderValue = value;
6323
+ const textPart = parts[3] ? parts[3] : defaultText;
6324
+ if (typeof renderValue === "boolean") renderValue = (locale || defaultLocale).bool[renderValue ? 0 : 1];
6325
+ if (renderValue == null) return "";
6326
+ const isBigInt = typeof renderValue === "bigint";
6327
+ if (typeof renderValue !== "number" && !isBigInt) return runPart(renderValue, textPart, options, locale);
6328
+ if (!isBigInt && !Number.isFinite(renderValue)) {
6329
+ const resolvedLocale = locale || defaultLocale;
6330
+ if (Number.isNaN(renderValue)) return resolvedLocale.nan;
6331
+ return (renderValue < 0 ? resolvedLocale.negative : "") + resolvedLocale.infinity;
6332
+ }
6333
+ const part = getPart(value, parts);
6334
+ const decimalValue = part && typeof value === "number" && Number.isFinite(value) ? decimalFromNumber(value) : null;
6335
+ return part ? runPart(value, part, options, locale, decimalValue) : options.overflow;
6336
+ }
6337
+
6338
+ //#endregion
6339
+ //#region src/shared/numfmt/options.ts
6340
+ const defaultOptions = {
6341
+ overflow: "######",
6342
+ dateErrorThrows: false,
6343
+ dateErrorNumber: true,
6344
+ bigintErrorNumber: false,
6345
+ dateSpanLarge: true,
6346
+ leap1900: true,
6347
+ nbsp: false,
6348
+ throws: true,
6349
+ invalid: "######",
6350
+ locale: "",
6351
+ ignoreTimezone: false,
6352
+ grouping: [3, 3],
6353
+ indexColors: true,
6354
+ skipChar: "",
6355
+ fillChar: ""
6356
+ };
6357
+
6358
+ //#endregion
6359
+ //#region src/shared/numfmt/tokenize.ts
6360
+ const tokenHandlers = [
6361
+ [
6362
+ TOKEN_GENERAL,
6363
+ /^General/i,
6364
+ 0
6365
+ ],
6366
+ [
6367
+ TOKEN_HASH,
6368
+ /^#/,
6369
+ 0
6370
+ ],
6371
+ [
6372
+ TOKEN_ZERO,
6373
+ /^0/,
6374
+ 0
6375
+ ],
6376
+ [
6377
+ TOKEN_QMARK,
6378
+ /^\?/,
6379
+ 0
6380
+ ],
6381
+ [
6382
+ TOKEN_SLASH,
6383
+ /^\//,
6384
+ 0
6385
+ ],
6386
+ [
6387
+ TOKEN_BREAK,
6388
+ /^;/,
6389
+ 0
6390
+ ],
6391
+ [
6392
+ TOKEN_TEXT,
6393
+ /^@/,
6394
+ 0
6395
+ ],
6396
+ [
6397
+ TOKEN_PLUS,
6398
+ /^\+/,
6399
+ 0
6400
+ ],
6401
+ [
6402
+ TOKEN_MINUS,
6403
+ /^-/,
6404
+ 0
6405
+ ],
6406
+ [
6407
+ TOKEN_POINT,
6408
+ /^\./,
6409
+ 0
6410
+ ],
6411
+ [
6412
+ TOKEN_SPACE,
6413
+ /^ /,
6414
+ 0
6415
+ ],
6416
+ [
6417
+ TOKEN_PERCENT,
6418
+ /^%/,
6419
+ 0
6420
+ ],
6421
+ [
6422
+ TOKEN_DIGIT,
6423
+ /^[1-9]/,
6424
+ 0
6425
+ ],
6426
+ [
6427
+ TOKEN_CALENDAR,
6428
+ /^(?:B[12])/i,
6429
+ 0
6430
+ ],
6431
+ [
6432
+ TOKEN_ERROR,
6433
+ /^B$/,
6434
+ 0
6435
+ ],
6436
+ [
6437
+ TOKEN_DATETIME,
6438
+ /^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/,
6439
+ 0
6440
+ ],
6441
+ [
6442
+ TOKEN_DURATION,
6443
+ /^(?:\[(h+|m+|s+)\])/i,
6444
+ 1
6445
+ ],
6446
+ [
6447
+ TOKEN_CONDITION,
6448
+ /^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/,
6449
+ [1, 2]
6450
+ ],
6451
+ [
6452
+ TOKEN_DBNUM,
6453
+ /^\[(DBNum[0-4]?\d)\]/i,
6454
+ 1
6455
+ ],
6456
+ [
6457
+ TOKEN_NATNUM,
6458
+ /^\[(NatNum[0-4]?\d)\]/i,
6459
+ 1
6460
+ ],
6461
+ [
6462
+ TOKEN_LOCALE,
6463
+ /^\[\$([^\]]+)\]/,
6464
+ 1
6465
+ ],
6466
+ [
6467
+ TOKEN_COLOR,
6468
+ /^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i,
6469
+ 1
6470
+ ],
6471
+ [
6472
+ TOKEN_MODIFIER,
6473
+ /^\[([^\]]+)\]/,
6474
+ 1
6475
+ ],
6476
+ [
6477
+ TOKEN_AMPM,
6478
+ /^(?:AM\/PM|am\/pm|A\/P)/,
6479
+ 0
6480
+ ],
6481
+ [
6482
+ TOKEN_ESCAPED,
6483
+ /^\\(.)/,
6484
+ 1
6485
+ ],
6486
+ [
6487
+ TOKEN_STRING,
6488
+ /^"([^"]*?)"/,
6489
+ 1
6490
+ ],
6491
+ [
6492
+ TOKEN_SKIP,
6493
+ /^_(\\.|.)/,
6494
+ 1
6495
+ ],
6496
+ [
6497
+ "exp",
6498
+ /^[Ee]([+-])/,
6499
+ 1
6500
+ ],
6501
+ [
6502
+ TOKEN_FILL,
6503
+ /^\*(\\.|.)/,
6504
+ 1
6505
+ ],
6506
+ [
6507
+ TOKEN_PAREN,
6508
+ /^[()]/,
6509
+ 0
6510
+ ],
6511
+ [
6512
+ TOKEN_ERROR,
6513
+ /^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/,
6514
+ 0
6515
+ ],
6516
+ [
6517
+ TOKEN_CHAR,
6518
+ /^./,
6519
+ 0
6520
+ ]
6521
+ ];
6522
+ const CODE_QMRK = 63;
6523
+ const CODE_HASH = 35;
6524
+ const CODE_ZERO = 48;
6525
+ const CODE_NINE = 57;
6526
+ const isNumOp = (char) => {
6527
+ const code = (char || "\0").charCodeAt(0);
6528
+ return code === CODE_QMRK || code === CODE_HASH || code >= CODE_ZERO && code <= CODE_NINE;
6529
+ };
6530
+ /**
6531
+ * Breaks a format pattern string into a list of tokens.
6532
+ */
6533
+ function tokenize(pattern) {
6534
+ let index = 0;
6535
+ const tokens = [];
6536
+ const unresolvedCommas = [];
6537
+ while (index < pattern.length) {
6538
+ const current = pattern.slice(index);
6539
+ let step = 0;
6540
+ const commaMatch = /^(,+)(.)?/.exec(current);
6541
+ if (commaMatch) {
6542
+ const raw = commaMatch[1];
6543
+ step = raw.length;
6544
+ const lookBehind = pattern[index - 1] || "";
6545
+ let maybeGroup = false;
6546
+ let maybeScale = false;
6547
+ if (isNumOp(lookBehind)) {
6548
+ maybeGroup = true;
6549
+ maybeScale = true;
6550
+ } else if (lookBehind === ".") maybeScale = true;
6551
+ const lookAhead = commaMatch[2] || "";
6552
+ if (maybeGroup && (!lookAhead || lookAhead === ";")) maybeGroup = false;
6553
+ if (maybeScale && isNumOp(lookAhead)) maybeScale = false;
6554
+ if (maybeGroup && !maybeScale) tokens.push({
6555
+ type: TOKEN_GROUP,
6556
+ value: ",",
6557
+ raw
6558
+ });
6559
+ else if (!maybeGroup && maybeScale) tokens.push({
6560
+ type: TOKEN_SCALE,
6561
+ value: ",",
6562
+ raw
6563
+ });
6564
+ else if (maybeGroup && maybeScale) {
6565
+ const token = {
6566
+ type: TOKEN_SCALE,
6567
+ value: ",",
6568
+ raw
6569
+ };
6570
+ tokens.push(token);
6571
+ unresolvedCommas.push(token);
6572
+ } else tokens.push({
6573
+ type: TOKEN_COMMA,
6574
+ value: ",",
6575
+ raw
6576
+ });
6577
+ } else {
6578
+ let token;
6579
+ for (const [type, expression, group] of tokenHandlers) {
6580
+ const match = expression.exec(current);
6581
+ if (match) {
6582
+ token = {
6583
+ type,
6584
+ value: typeof group !== "number" ? group.map((matchIndex) => match[matchIndex]) : match[group || 0],
6585
+ raw: match[0]
6586
+ };
6587
+ tokens.push(token);
6588
+ step = match[0].length;
6589
+ break;
6590
+ }
6591
+ }
6592
+ if (unresolvedCommas.length && (token === null || token === void 0 ? void 0 : token.raw) === ";") unresolvedCommas.length = 0;
6593
+ if (unresolvedCommas.length && isNumOp(token === null || token === void 0 ? void 0 : token.raw)) {
6594
+ unresolvedCommas.forEach((unresolved) => unresolved.type = TOKEN_GROUP);
6595
+ unresolvedCommas.length = 0;
6596
+ }
6597
+ }
6598
+ if (!step) {
6599
+ const raw = current[0];
6600
+ step = 1;
6601
+ tokens.push({
6602
+ type: TOKEN_CHAR,
6603
+ value: raw,
6604
+ raw
6605
+ });
6606
+ }
6607
+ index += step;
6608
+ }
6609
+ return tokens;
6610
+ }
6611
+
6612
+ //#endregion
6613
+ //#region src/shared/numfmt/parse-pattern.ts
6614
+ function maybeAddMinus(part) {
6615
+ var _part$condition, _part$condition2;
6616
+ const operator = (_part$condition = part.condition) === null || _part$condition === void 0 ? void 0 : _part$condition[0];
6617
+ const value = (_part$condition2 = part.condition) === null || _part$condition2 === void 0 ? void 0 : _part$condition2[1];
6618
+ if (!(typeof value === "number" && value < 0 && (operator === "<" || operator === "<=" || operator === "=") || value === 0 && operator === "<")) part.tokens.unshift({
6619
+ type: "minus",
6620
+ volatile: true
6621
+ });
6622
+ }
6623
+ function clonePart(part, prefixToken = null) {
6624
+ const result = {
6625
+ ...part,
6626
+ int_pattern: [...part.int_pattern],
6627
+ frac_pattern: [...part.frac_pattern],
6628
+ man_pattern: [...part.man_pattern],
6629
+ den_pattern: [...part.den_pattern],
6630
+ num_pattern: [...part.num_pattern],
6631
+ tokens: [...part.tokens]
6632
+ };
6633
+ if (part.condition) result.condition = [...part.condition];
6634
+ if (prefixToken) result.tokens.unshift(prefixToken);
6635
+ result.generated = true;
6636
+ return result;
6637
+ }
6638
+ function parsePattern(pattern) {
6639
+ const partitions = [];
6640
+ let conditional = false;
6641
+ let localeOverride;
6642
+ let textPartition = null;
6643
+ let more = 0;
6644
+ let index = 0;
6645
+ let conditions = 0;
6646
+ let tokens = tokenize(pattern);
6647
+ do {
6648
+ var _tokens$part$tokensUs;
6649
+ const part = parseFormatSection(tokens);
6650
+ if ((part.date || part.general) && (part.int_pattern.length || part.frac_pattern.length || part.scale !== 1 || part.text)) throw new Error("Illegal format");
6651
+ if (part.condition) {
6652
+ conditions++;
6653
+ conditional = true;
6654
+ }
6655
+ if (part.text) {
6656
+ if (textPartition) throw new Error("Unexpected partition");
6657
+ textPartition = part;
6658
+ }
6659
+ if (part.locale) localeOverride = resolveLocale(part.locale);
6660
+ partitions.push(part);
6661
+ more = ((_tokens$part$tokensUs = tokens[part.tokensUsed]) === null || _tokens$part$tokensUs === void 0 ? void 0 : _tokens$part$tokensUs.type) === "break" ? 1 : 0;
6662
+ tokens = tokens.slice(part.tokensUsed + more);
6663
+ index++;
6664
+ } while (more && index < 4 && conditions < 3);
6665
+ if (more) throw new Error("Unexpected partition");
6666
+ if (conditions > 2) throw new Error("Unexpected condition");
6667
+ const fourthPart = partitions[3];
6668
+ if (fourthPart && (fourthPart.int_pattern.length || fourthPart.frac_pattern.length || fourthPart.date)) throw new Error("Unexpected partition");
6669
+ if (conditional) {
6670
+ if (!partitions[0].condition) partitions[0].condition = [">", 0];
6671
+ const numberOfParts = partitions.length;
6672
+ if (numberOfParts === 1) {
6673
+ const fallback = parseFormatSection(tokenize("General"));
6674
+ fallback.generated = true;
6675
+ partitions[1] = fallback;
6676
+ }
6677
+ if (numberOfParts <= 2) {}
6678
+ if (numberOfParts < 3) {
6679
+ const firstPart = partitions[0];
6680
+ const secondPart = partitions[1];
6681
+ maybeAddMinus(firstPart);
6682
+ if (secondPart.condition) maybeAddMinus(secondPart);
6683
+ else {
6684
+ const condition = firstPart.condition;
6685
+ if ((condition === null || condition === void 0 ? void 0 : condition[0]) === "=" || typeof (condition === null || condition === void 0 ? void 0 : condition[1]) === "number" && condition[1] >= 0 && (condition[0] === ">" || condition[0] === ">=")) secondPart.tokens.unshift({
6686
+ type: "minus",
6687
+ volatile: true
6688
+ });
6689
+ }
6690
+ } else partitions.forEach(maybeAddMinus);
6691
+ } else {
6692
+ if (partitions.length < 4 && textPartition) {
6693
+ for (let partitionIndex = 0, length = partitions.length; partitionIndex < length; partitionIndex++) if (partitions[partitionIndex] === textPartition) partitions.splice(partitionIndex, 1);
6694
+ }
6695
+ if (partitions.length < 1 && textPartition) {
6696
+ const positive = parseFormatSection(tokenize("General"));
6697
+ positive.generated = true;
6698
+ partitions[0] = positive;
6699
+ }
6700
+ if (partitions.length < 2) partitions.push(clonePart(partitions[0], {
6701
+ type: "minus",
6702
+ volatile: true
6703
+ }));
6704
+ if (partitions.length < 3) partitions.push(clonePart(partitions[0]));
6705
+ if (partitions.length < 4) if (textPartition) partitions.push(textPartition);
6706
+ else {
6707
+ const text = parseFormatSection(tokenize("@"));
6708
+ text.generated = true;
6709
+ partitions.push(text);
6710
+ }
6711
+ partitions[0].condition = [">", 0];
6712
+ partitions[1].condition = ["<", 0];
6713
+ partitions[2].condition = null;
6714
+ }
6715
+ return {
6716
+ pattern,
6717
+ partitions,
6718
+ locale: localeOverride
6719
+ };
6720
+ }
6721
+
6722
+ //#endregion
6723
+ //#region src/shared/numfmt/serial-date.ts
6724
+ const floor = Math.floor;
6725
+ const DAYSIZE = 86400;
6726
+ const dateUTC = Date.UTC;
6727
+ /**
6728
+ * Convert a native JavaScript Date, or array to a spreadsheet serial date.
6729
+ *
6730
+ * Returns a serial date number if input was a Date object or an array of
6731
+ * numbers, or null.
6732
+ */
6733
+ function dateToSerial(date, options) {
6734
+ let timestamp = null;
6735
+ if (Array.isArray(date)) {
6736
+ const [year, month, day, hours, minutes, seconds] = date;
6737
+ timestamp = dateUTC(year, month == null ? 0 : month - 1, day !== null && day !== void 0 ? day : 1, hours || 0, minutes || 0, seconds || 0);
6738
+ } else if (date instanceof Date) {
6739
+ timestamp = date.getTime();
6740
+ if (!(options === null || options === void 0 ? void 0 : options.ignoreTimezone)) {
6741
+ const localDate = /* @__PURE__ */ new Date();
6742
+ localDate.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());
6743
+ localDate.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
6744
+ timestamp = localDate.getTime();
6745
+ }
6746
+ }
6747
+ if (timestamp != null && Number.isFinite(timestamp)) {
6748
+ const days = timestamp / 864e5;
6749
+ return days - (days <= -25509 ? -25568 : -25569);
6750
+ }
6751
+ return null;
6752
+ }
6753
+ /**
6754
+ * Convert a spreadsheet serial date to an array of date parts, accurate to a
6755
+ * second.
3874
6756
  */
3875
- function getCellInfoInMergeData(row, column, mergeData) {
3876
- let isMerged = false;
3877
- let isMergedMainCell = false;
3878
- let newEndRow = row;
3879
- let newEndColumn = column;
3880
- let mergeRow = row;
3881
- let mergeColumn = column;
3882
- if (mergeData == null) return {
3883
- actualRow: row,
3884
- actualColumn: column,
3885
- isMergedMainCell,
3886
- isMerged,
3887
- endRow: newEndRow,
3888
- endColumn: newEndColumn,
3889
- startRow: mergeRow,
3890
- startColumn: mergeColumn
3891
- };
3892
- for (let i = 0; i < mergeData.length; i++) {
3893
- const { startRow: startRowMarge, endRow: endRowMarge, startColumn: startColumnMarge, endColumn: endColumnMarge } = mergeData[i];
3894
- if (row === startRowMarge && column === startColumnMarge) {
3895
- newEndRow = endRowMarge;
3896
- newEndColumn = endColumnMarge;
3897
- mergeRow = startRowMarge;
3898
- mergeColumn = startColumnMarge;
3899
- isMergedMainCell = true;
3900
- break;
6757
+ function dateFromSerial(serial, options) {
6758
+ let date = serial | 0;
6759
+ const fractionalSeconds = DAYSIZE * (serial - date);
6760
+ let time = floor(fractionalSeconds);
6761
+ if (fractionalSeconds - time > .9999) {
6762
+ time += 1;
6763
+ if (time === DAYSIZE) {
6764
+ time = 0;
6765
+ date += 1;
6766
+ }
6767
+ }
6768
+ const normalizedTime = time < 0 ? DAYSIZE + time : time;
6769
+ const [year, month, day] = toYMD(serial, 0, options === null || options === void 0 ? void 0 : options.leap1900);
6770
+ return [
6771
+ year,
6772
+ month,
6773
+ day,
6774
+ floor(normalizedTime / 60 / 60) % 60,
6775
+ floor(normalizedTime / 60) % 60,
6776
+ floor(normalizedTime) % 60
6777
+ ];
6778
+ }
6779
+
6780
+ //#endregion
6781
+ //#region src/shared/numfmt/parse-value.ts
6782
+ const okDateFormats = [
6783
+ "!d-m-y",
6784
+ "!d-m-Y",
6785
+ "!j-m-y",
6786
+ "!j-m-Y",
6787
+ "!d-n-y",
6788
+ "!d-n-Y",
6789
+ "!j-n-y",
6790
+ "!j-n-Y",
6791
+ "?m-d-y",
6792
+ "?m-d-Y",
6793
+ "?m-j-y",
6794
+ "?m-j-Y",
6795
+ "?n-d-y",
6796
+ "?n-d-Y",
6797
+ "?n-j-y",
6798
+ "?n-j-Y",
6799
+ "d-M-y",
6800
+ "d-M-Y",
6801
+ "j-M-y",
6802
+ "j-M-Y",
6803
+ "M-d-y",
6804
+ "M-d-Y",
6805
+ "M-j-y",
6806
+ "M-j-Y",
6807
+ "d-F-y",
6808
+ "d-F-Y",
6809
+ "F-d-y",
6810
+ "F-d-Y",
6811
+ "F-j-y",
6812
+ "F-j-Y",
6813
+ "j-F-y",
6814
+ "j-F-Y",
6815
+ "y-F-d",
6816
+ "y-F-j",
6817
+ "y-M-d",
6818
+ "y-M-j",
6819
+ "Y-F-d",
6820
+ "Y-F-j",
6821
+ "Y-M-d",
6822
+ "Y-m-d",
6823
+ "Y-M-j",
6824
+ "Y-m-j",
6825
+ "Y-n-d",
6826
+ "Y-n-j",
6827
+ "j-F",
6828
+ "j-M",
6829
+ "d-F",
6830
+ "d-M",
6831
+ "n-d",
6832
+ "n-j",
6833
+ "n-Y",
6834
+ "m-d",
6835
+ "m-j",
6836
+ "m-Y",
6837
+ "M-Y",
6838
+ "M-y",
6839
+ "F-y",
6840
+ "F-Y",
6841
+ "Y-M",
6842
+ "Y-n",
6843
+ "Y-m",
6844
+ "Y-F",
6845
+ "Y-M"
6846
+ ];
6847
+ const tx0 = {
6848
+ j: "d",
6849
+ d: "d",
6850
+ D: "ddd",
6851
+ l: "dddd",
6852
+ n: "m",
6853
+ m: "m",
6854
+ M: "mmm",
6855
+ F: "mmmm",
6856
+ y: "yy",
6857
+ Y: "yyyy"
6858
+ };
6859
+ const tx00 = {
6860
+ j: "dd",
6861
+ d: "dd",
6862
+ D: "ddd",
6863
+ l: "dddd",
6864
+ n: "mm",
6865
+ m: "mm",
6866
+ M: "mmm",
6867
+ F: "mmmm",
6868
+ y: "yy",
6869
+ Y: "yyyy"
6870
+ };
6871
+ const dateTrieDM = {};
6872
+ const dateTrieMD = {};
6873
+ function packDate(format, node, allowType = 1) {
6874
+ if (format) {
6875
+ const char = format[0];
6876
+ const next = format.slice(1);
6877
+ if (char === "!") packDate(next, node, 4);
6878
+ else if (char === "?") packDate(next, node, 2);
6879
+ else {
6880
+ let branch = node[char];
6881
+ if (typeof branch !== "object") {
6882
+ branch = {};
6883
+ node[char] = branch;
6884
+ }
6885
+ packDate(next, branch, allowType);
6886
+ }
6887
+ } else node.$ = allowType;
6888
+ }
6889
+ function addFormatToTrie(format, trie) {
6890
+ packDate(format, trie);
6891
+ packDate(`${format} x`, trie);
6892
+ packDate(`${format} l`, trie);
6893
+ packDate(`${format} l x`, trie);
6894
+ packDate(`l ${format}`, trie);
6895
+ packDate(`l ${format} x`, trie);
6896
+ packDate(`${format} D`, trie);
6897
+ packDate(`${format} D x`, trie);
6898
+ packDate(`D ${format}`, trie);
6899
+ packDate(`D ${format} x`, trie);
6900
+ }
6901
+ okDateFormats.forEach((format) => {
6902
+ if (!format.startsWith("?")) addFormatToTrie(format, dateTrieDM);
6903
+ if (!format.startsWith("!")) addFormatToTrie(format, dateTrieMD);
6904
+ });
6905
+ const currentYear = (/* @__PURE__ */ new Date()).getUTCFullYear();
6906
+ const PT = ".";
6907
+ const CM = ",";
6908
+ const SP = " ";
6909
+ const NS = "\xA0";
6910
+ const NN = " ";
6911
+ const AP = "'";
6912
+ const AG = "٬";
6913
+ const dec2group = {
6914
+ ".": [
6915
+ CM,
6916
+ NS,
6917
+ NN,
6918
+ AP,
6919
+ AG
6920
+ ],
6921
+ ",": [
6922
+ PT,
6923
+ NS,
6924
+ NN,
6925
+ AP,
6926
+ AG
6927
+ ],
6928
+ "٫": [
6929
+ PT,
6930
+ NS,
6931
+ NN,
6932
+ AP,
6933
+ AG
6934
+ ]
6935
+ };
6936
+ const isDigit = (digit) => (digit === null || digit === void 0 ? void 0 : digit.length) === 1 && digit >= "0" && digit <= "9";
6937
+ /** Parse a numeric string and return its value and inferred format. */
6938
+ function parseNumber(value, options = {}) {
6939
+ const l10n = getLocale(options.locale || "") || defaultLocale;
6940
+ const decimal = l10n.decimal;
6941
+ const groupingChars = [...dec2group[decimal] || [AP, AG]];
6942
+ if (!groupingChars.includes(l10n.group) && l10n.group !== SP && l10n.group !== decimal) groupingChars.push(l10n.group);
6943
+ let number = "";
6944
+ let exponent = "";
6945
+ let sign = 1;
6946
+ let format = "";
6947
+ let minus = false;
6948
+ let openParen = false;
6949
+ let closeParen = false;
6950
+ let percent = false;
6951
+ let currency = false;
6952
+ let currencySymbol = "";
6953
+ let currencyTrailing = false;
6954
+ let index = 0;
6955
+ const prefixChars = [
6956
+ SP,
6957
+ NS,
6958
+ NN,
6959
+ "+",
6960
+ "%",
6961
+ "(",
6962
+ "-"
6963
+ ].concat(currencySymbols$1);
6964
+ while (prefixChars.includes(value.charAt(index))) {
6965
+ const char = value.charAt(index);
6966
+ if (char === "-") {
6967
+ if (minus || openParen) return null;
6968
+ minus = true;
6969
+ sign = -1;
6970
+ } else if (reCurrencySymbols.test(char)) {
6971
+ if (currency) return null;
6972
+ currency = true;
6973
+ currencySymbol = char;
6974
+ } else if (char === "(") {
6975
+ if (openParen || minus) return null;
6976
+ openParen = true;
6977
+ sign = -1;
6978
+ } else if (char === "%") {
6979
+ if (percent) return null;
6980
+ percent = true;
6981
+ }
6982
+ index++;
6983
+ }
6984
+ let haveDecimal = false;
6985
+ let grouping;
6986
+ if (value.charAt(index) === decimal || isDigit(value.charAt(index))) while (index < value.length) {
6987
+ const char = value.charAt(index);
6988
+ if (!grouping && groupingChars.includes(char)) grouping = char;
6989
+ else if (grouping && grouping === char) {} else if (char === decimal) {
6990
+ if (haveDecimal) break;
6991
+ number += ".";
6992
+ haveDecimal = true;
6993
+ } else if (isDigit(char)) number += char;
6994
+ else break;
6995
+ index++;
6996
+ }
6997
+ if (value.charAt(index) === "e" || value.charAt(index) === "E") {
6998
+ exponent += value.charAt(index);
6999
+ index++;
7000
+ if (value.charAt(index) === "+" || value.charAt(index) === "-") {
7001
+ exponent += value.charAt(index);
7002
+ index++;
3901
7003
  }
3902
- if (row >= startRowMarge && row <= endRowMarge && column >= startColumnMarge && column <= endColumnMarge) {
3903
- newEndRow = endRowMarge;
3904
- newEndColumn = endColumnMarge;
3905
- mergeRow = startRowMarge;
3906
- mergeColumn = startColumnMarge;
3907
- isMerged = true;
3908
- break;
7004
+ const exponentStart = index;
7005
+ while (isDigit(value.charAt(index))) {
7006
+ exponent += value.charAt(index);
7007
+ index++;
3909
7008
  }
7009
+ if (exponentStart === index) return null;
7010
+ }
7011
+ const suffixChars = [
7012
+ SP,
7013
+ NS,
7014
+ NN,
7015
+ "%",
7016
+ "$",
7017
+ ")"
7018
+ ].concat(currencySymbols$1);
7019
+ while (suffixChars.includes(value.charAt(index))) {
7020
+ const char = value.charAt(index);
7021
+ if (reCurrencySymbols.test(char)) {
7022
+ if (currency) return null;
7023
+ currency = true;
7024
+ currencySymbol = char;
7025
+ currencyTrailing = true;
7026
+ } else if (char === ")") {
7027
+ if (closeParen || !openParen) return null;
7028
+ closeParen = true;
7029
+ } else if (char === "%") {
7030
+ if (percent) return null;
7031
+ percent = true;
7032
+ }
7033
+ index++;
7034
+ }
7035
+ if (index !== value.length) return null;
7036
+ let numberValue = Number.parseFloat(number + exponent);
7037
+ if (!Number.isFinite(numberValue)) return null;
7038
+ if (exponent) {
7039
+ if (percent || currency) return null;
7040
+ format = "0.00E+00";
7041
+ } else if (percent) {
7042
+ if (currency) return null;
7043
+ format = number.includes(".") ? "0.00%" : "0%";
7044
+ numberValue *= .01;
7045
+ } else if (currency) {
7046
+ const currencyFormat = number.includes(".") ? "#,##0.00" : "#,##0";
7047
+ format = currencyTrailing ? currencyFormat + currencySymbol : currencySymbol + currencyFormat;
7048
+ } else if (grouping) format = number.includes(".") ? "#,##0.00" : "#,##0";
7049
+ const result = { v: numberValue * sign };
7050
+ if (format) result.z = format;
7051
+ return result;
7052
+ }
7053
+ function isValidDate(year, month, day) {
7054
+ if (day < 1) return false;
7055
+ if (month < 1 || month > 12) return false;
7056
+ if (month === 2) {
7057
+ if (day > (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0 || year === 1900 ? 29 : 28)) return false;
7058
+ } else if ((month === 4 || month === 6 || month === 9 || month === 11) && day > 30 || (month === 1 || month === 3 || month === 5 || month === 7 || month === 8 || month === 10 || month === 12) && day > 31) return false;
7059
+ return true;
7060
+ }
7061
+ const matchRec = (string, data, skipPeriod = false) => {
7062
+ for (const item of data) if (string.startsWith(item[0])) {
7063
+ let length = item[0].length;
7064
+ if (skipPeriod && (item[2] === "D" || item[2] === "M") && string[length] === ".") length++;
7065
+ return [string.slice(0, length), item];
7066
+ }
7067
+ return ["", null];
7068
+ };
7069
+ const nextToken = (string, node, data, localeData) => {
7070
+ const path = data.path || "";
7071
+ const matchOrder = Object.keys(node);
7072
+ for (const token of matchOrder) {
7073
+ const branch = node[token];
7074
+ let result;
7075
+ if (!branch) continue;
7076
+ if (token === "$" || token === "€") {
7077
+ if (!string) result = data;
7078
+ } else {
7079
+ if (typeof branch !== "object") continue;
7080
+ if (token === "-") {
7081
+ const match = /^(\s*([./-]|,\s)\s*|\s+)/.exec(string);
7082
+ if (match) {
7083
+ const separator = match[1] === "-" || match[1] === "/" || match[1] === "." ? match[1] : " ";
7084
+ if (!data.sep || data.sep === separator) {
7085
+ const normalizedSeparator = match[0].replace(/\s+/g, " ");
7086
+ result = nextToken(string.slice(match[0].length), branch, {
7087
+ ...data,
7088
+ sep: separator,
7089
+ path: path + normalizedSeparator
7090
+ }, localeData);
7091
+ }
7092
+ }
7093
+ } else if (token === " ") {
7094
+ const match = /^[,.]?\s+/.exec(string);
7095
+ if (match) {
7096
+ const normalizedSeparator = match[0].replace(/\s+/g, " ");
7097
+ result = nextToken(string.slice(match[0].length), branch, {
7098
+ ...data,
7099
+ path: path + normalizedSeparator
7100
+ }, localeData);
7101
+ }
7102
+ } else if (token === "j" || token === "d") {
7103
+ const match = /^(0?[1-9]|1\d|2\d|3[01])\b/.exec(string);
7104
+ if (match) result = nextToken(string.slice(match[0].length), branch, {
7105
+ ...data,
7106
+ day: match[0],
7107
+ path: path + token
7108
+ }, localeData);
7109
+ } else if (token === "n" || token === "m") {
7110
+ const match = /^(0?[1-9]|1[012])\b/.exec(string);
7111
+ if (match) result = nextToken(string.slice(match[0].length), branch, {
7112
+ ...data,
7113
+ month: +match[0],
7114
+ _mon: match[0],
7115
+ path: path + token
7116
+ }, localeData);
7117
+ } else if (token === "F" || token === "M") {
7118
+ const [matchedText, match] = matchRec(string, localeData.mon, localeData.mp);
7119
+ if ((match === null || match === void 0 ? void 0 : match[2]) === token) result = nextToken(string.slice(matchedText.length), branch, {
7120
+ ...data,
7121
+ month: match[1],
7122
+ _mon: matchedText,
7123
+ path: path + token
7124
+ }, localeData);
7125
+ } else if (token === "l" || token === "D") {
7126
+ const [matchedText, match] = matchRec(string, localeData.day, localeData.dp);
7127
+ if ((match === null || match === void 0 ? void 0 : match[2]) === token) result = nextToken(string.slice(matchedText.length), branch, {
7128
+ ...data,
7129
+ path: path + token
7130
+ }, localeData);
7131
+ } else if (token === "y") {
7132
+ const match = /^\d\d\b/.exec(string);
7133
+ if (match) {
7134
+ const year = +match[0] >= 30 ? +match[0] + 1900 : +match[0] + 2e3;
7135
+ result = nextToken(string.slice(match[0].length), branch, {
7136
+ ...data,
7137
+ year,
7138
+ path: path + token
7139
+ }, localeData);
7140
+ }
7141
+ } else if (token === "Y") {
7142
+ const match = /^\d\d\d\d\b/.exec(string);
7143
+ if (match) result = nextToken(string.slice(match[0].length), branch, {
7144
+ ...data,
7145
+ year: +match[0],
7146
+ path: path + token
7147
+ }, localeData);
7148
+ } else if (token === "x") {
7149
+ const time = parseTime(string, { locale: localeData.locale });
7150
+ if (time) result = nextToken("", branch, {
7151
+ ...data,
7152
+ time: time.v,
7153
+ tf: time.z,
7154
+ path: path + token
7155
+ }, localeData);
7156
+ } else throw new Error(`Unknown date token "${token}"`);
7157
+ }
7158
+ if (result && isValidDate(data.year || 1916, data.month || 1, data.day ? +data.day : 1)) return result;
3910
7159
  }
7160
+ };
7161
+ const normDateStr = (string) => string.replace(/\s+/g, " ").trim().replace(/’/, "'").replace(/\.$/, "").toLowerCase();
7162
+ const getLookups = (values, symbol) => {
7163
+ const lookups = values.map((value, index) => [
7164
+ normDateStr(value),
7165
+ index + 1,
7166
+ symbol
7167
+ ]);
7168
+ lookups.sort((a, b) => b[0].length - a[0].length);
7169
+ return lookups;
7170
+ };
7171
+ /** Parse a date or datetime string and return its serial value and format. */
7172
+ function parseDate(value, options = {}) {
7173
+ var _date$year, _date$day;
7174
+ const l10n = getLocale(options.locale || "") || defaultLocale;
7175
+ const localeData = {
7176
+ mon: getLookups(l10n.mmmm, "F").concat(getLookups(l10n.mmm, "M")),
7177
+ mp: l10n.mmm[0].at(-1) === ".",
7178
+ day: getLookups(l10n.dddd, "l").concat(getLookups(l10n.ddd, "D")),
7179
+ dp: l10n.ddd[0].at(-1) === ".",
7180
+ locale: options.locale
7181
+ };
7182
+ const date = nextToken(normDateStr(value), l10n.preferMDY ? dateTrieMD : dateTrieDM, { path: "" }, localeData);
7183
+ if (!date) return null;
7184
+ if (date.sep === "." && date.path.length === 3) return null;
7185
+ if (date.month == null || date._mon == null) return null;
7186
+ const year = +((_date$year = date.year) !== null && _date$year !== void 0 ? _date$year : currentYear);
7187
+ const day = (_date$day = date.day) !== null && _date$day !== void 0 ? _date$day : "1";
7188
+ let epoch = -Infinity;
7189
+ if (year < 1900) return null;
7190
+ else if (year <= 1900 && date.month <= 2) epoch = 25568;
7191
+ else if (year < 1e4) epoch = 25569;
7192
+ const dateValue = Date.UTC(year, date.month - 1, +day) / 864e5 + epoch + (date.time || 0);
7193
+ if (dateValue < 0 || dateValue > 2958465) return null;
7194
+ const lead0 = date._mon[0] === "0" || day[0] === "0" || date._mon.length === 2 && day.length === 2;
3911
7195
  return {
3912
- actualRow: row,
3913
- actualColumn: column,
3914
- isMergedMainCell,
3915
- isMerged,
3916
- endRow: newEndRow,
3917
- endColumn: newEndColumn,
3918
- startRow: mergeRow,
3919
- startColumn: mergeColumn
7196
+ v: dateValue,
7197
+ z: date.path.replace(/[jdlDnmMFyYx]/g, (token) => {
7198
+ if (token === "x") return date.tf || "";
7199
+ return (lead0 ? tx00[token] : tx0[token]) || token;
7200
+ })
3920
7201
  };
3921
7202
  }
3922
- let CellModeEnum = /* @__PURE__ */ function(CellModeEnum) {
3923
- CellModeEnum["Raw"] = "raw";
3924
- CellModeEnum["Intercepted"] = "intercepted";
3925
- CellModeEnum["Both"] = "both";
3926
- return CellModeEnum;
3927
- }({});
7203
+ const normAMPMStr = (string) => string.replace(/\s+/g, "").trim().replace(/\./g, "").toLowerCase();
7204
+ /** Parse a time string and return its day fraction and inferred format. */
7205
+ function parseTime(value, options = {}) {
7206
+ const l10n = getLocale(options.locale || "") || defaultLocale;
7207
+ const parts = /^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?=\s*[^\s\d]|$)/.exec(value);
7208
+ let ampm = "";
7209
+ if (parts) {
7210
+ const tail = normAMPMStr(value.slice(parts[0].length));
7211
+ if (tail === normAMPMStr(l10n.ampm[0]) || tail === "a" || tail === "am") ampm = "a";
7212
+ else if (tail === normAMPMStr(l10n.ampm[1]) || tail === "p" || tail === "pm") ampm = "p";
7213
+ else if (tail === ":") {
7214
+ if (!parts[3]) parts[3] = "0";
7215
+ if (!parts[2]) parts[2] = "0";
7216
+ } else if (tail) return null;
7217
+ }
7218
+ if (!parts) return null;
7219
+ const [, hoursPart, minutesPart, secondsPart, fractionPart] = parts;
7220
+ if (fractionPart && !secondsPart) return null;
7221
+ if (!ampm && !minutesPart && !secondsPart) return null;
7222
+ let hours = +(hoursPart || 0);
7223
+ if (ampm) {
7224
+ if (hours >= 13) return null;
7225
+ if (ampm === "a") {
7226
+ if (hours === 12) hours = 0;
7227
+ } else if (ampm === "p" && hours !== 12) hours += 12;
7228
+ }
7229
+ const minutes = +(minutesPart || 0);
7230
+ const seconds = +(secondsPart || 0);
7231
+ const milliseconds = +(fractionPart || 0);
7232
+ const hourFormat = hoursPart.length === 2 ? "hh" : "h";
7233
+ const secondsFormat = secondsPart ? ":ss" : "";
7234
+ const ampmFormat = ampm ? " AM/PM" : "";
7235
+ return {
7236
+ v: (hours * 60 * 60 + minutes * 60 + seconds + milliseconds) / (3600 * 24),
7237
+ z: `${hourFormat}:mm${secondsFormat}${ampmFormat}`
7238
+ };
7239
+ }
7240
+ /** Parse a localized or English boolean string. */
7241
+ function parseBool(value, options = {}) {
7242
+ const l10n = getLocale(options.locale || "") || defaultLocale;
7243
+ const normalizedValue = value.trim().toLowerCase();
7244
+ const localizedTrue = l10n.bool[0].toLowerCase();
7245
+ if (normalizedValue === "true" || normalizedValue === localizedTrue) return { v: true };
7246
+ const localizedFalse = l10n.bool[1].toLowerCase();
7247
+ if (normalizedValue === "false" || normalizedValue === localizedFalse) return { v: false };
7248
+ return null;
7249
+ }
7250
+ /** Parse a spreadsheet input as a number, date, time, or boolean. */
7251
+ function parseValue(value, options) {
7252
+ var _ref, _ref2, _parseNumber;
7253
+ return (_ref = (_ref2 = (_parseNumber = parseNumber(value, options)) !== null && _parseNumber !== void 0 ? _parseNumber : parseDate(value, options)) !== null && _ref2 !== void 0 ? _ref2 : parseTime(value, options)) !== null && _ref !== void 0 ? _ref : parseBool(value, options);
7254
+ }
3928
7255
 
3929
7256
  //#endregion
3930
- //#region src/types/const/theme-color-map.ts
3931
- const THEME_COLORS = { ["Office"]: {
3932
- [4]: "#4472C4",
3933
- [5]: "#ED7D31",
3934
- [6]: "#A5A5A5",
3935
- [7]: "#70AD47",
3936
- [8]: "#5B9BD5",
3937
- [9]: "#70AD47",
3938
- [0]: "#000000",
3939
- [2]: "#44546A",
3940
- [1]: "#FFFFFF",
3941
- [3]: "#E7E6E6",
3942
- [10]: "#0563C1",
3943
- [11]: "#954F72"
3944
- } };
7257
+ //#region src/shared/numfmt/api.ts
7258
+ var api_exports = /* @__PURE__ */ __exportAll({
7259
+ addLocale: () => addLocale,
7260
+ dateFromSerial: () => dateFromSerial,
7261
+ dateToSerial: () => dateToSerial,
7262
+ dec2frac: () => dec2frac,
7263
+ format: () => format,
7264
+ formatColor: () => formatColor,
7265
+ getFormatDateInfo: () => getFormatDateInfo,
7266
+ getFormatInfo: () => getFormatInfo,
7267
+ getLocale: () => getLocale,
7268
+ isDateFormat: () => isDateFormat,
7269
+ isPercentFormat: () => isPercentFormat,
7270
+ isTextFormat: () => isTextFormat$1,
7271
+ isValidFormat: () => isValidFormat,
7272
+ parseBool: () => parseBool,
7273
+ parseDate: () => parseDate,
7274
+ parseLocale: () => parseLocale,
7275
+ parseNumber: () => parseNumber,
7276
+ parseTime: () => parseTime,
7277
+ parseValue: () => parseValue,
7278
+ round: () => round,
7279
+ tokenTypes: () => tokenTypes,
7280
+ tokenize: () => tokenize
7281
+ });
7282
+ const parseDataCache = Object.create({});
7283
+ function prepareFormatterData(pattern, shouldThrow = false) {
7284
+ const normalizedPattern = pattern || "General";
7285
+ let parseData = parseDataCache[normalizedPattern];
7286
+ if (!parseData) try {
7287
+ parseData = parsePattern(normalizedPattern);
7288
+ parseDataCache[normalizedPattern] = parseData;
7289
+ } catch (error) {
7290
+ if (shouldThrow) throw error;
7291
+ const message = error instanceof Error ? error.message : String(error);
7292
+ const errorPart = {
7293
+ tokens: [{ type: "error" }],
7294
+ error: message
7295
+ };
7296
+ parseData = {
7297
+ pattern: normalizedPattern,
7298
+ partitions: [
7299
+ errorPart,
7300
+ errorPart,
7301
+ errorPart,
7302
+ errorPart
7303
+ ],
7304
+ error: message,
7305
+ locale: null
7306
+ };
7307
+ }
7308
+ return parseData;
7309
+ }
7310
+ /**
7311
+ * Formats a value as a string and returns the result.
7312
+ */
7313
+ function format(pattern, value, options = {}) {
7314
+ var _handleDates;
7315
+ const resolvedOptions = Object.assign({}, defaultOptions, options);
7316
+ const data = prepareFormatterData(pattern, resolvedOptions.throws);
7317
+ return formatValue((_handleDates = dateToSerial(value, resolvedOptions)) !== null && _handleDates !== void 0 ? _handleDates : value, data, resolvedOptions);
7318
+ }
7319
+ /**
7320
+ * Find the color appropriate to a value as dictated by a format pattern.
7321
+ */
7322
+ function formatColor(pattern, value, options) {
7323
+ var _handleDates2;
7324
+ const resolvedOptions = Object.assign({}, defaultOptions, options);
7325
+ const data = prepareFormatterData(pattern, resolvedOptions.throws);
7326
+ return formatColor$1((_handleDates2 = dateToSerial(value, resolvedOptions)) !== null && _handleDates2 !== void 0 ? _handleDates2 : value, data, resolvedOptions);
7327
+ }
7328
+ /** Determine if a given format pattern is a date pattern. */
7329
+ function isDateFormat(pattern) {
7330
+ return isDate(prepareFormatterData(pattern, false).partitions);
7331
+ }
7332
+ /** Determine if a given format pattern is a percentage pattern. */
7333
+ function isPercentFormat(pattern) {
7334
+ return isPercent(prepareFormatterData(pattern, false).partitions);
7335
+ }
7336
+ /** Determine if a given format pattern is a text only pattern. */
7337
+ function isTextFormat$1(pattern) {
7338
+ return isText(prepareFormatterData(pattern, false).partitions);
7339
+ }
7340
+ /** Determine if a given format pattern is valid. */
7341
+ function isValidFormat(pattern) {
7342
+ try {
7343
+ prepareFormatterData(pattern, true);
7344
+ return true;
7345
+ } catch {
7346
+ return false;
7347
+ }
7348
+ }
7349
+ /** Returns metadata describing a parsed format pattern. */
7350
+ function getFormatInfo(pattern, options = {}) {
7351
+ const data = prepareFormatterData(pattern, false);
7352
+ if (!data.info) data.info = info(data.partitions, options === null || options === void 0 ? void 0 : options.currency);
7353
+ return data.info;
7354
+ }
7355
+ /** Gets information about date codes used in a format string. */
7356
+ function getFormatDateInfo(pattern) {
7357
+ const data = prepareFormatterData(pattern, false);
7358
+ if (!data.dateInfo) data.dateInfo = dateInfo(data.partitions);
7359
+ return data.dateInfo;
7360
+ }
7361
+ /** A dictionary of the types used to identify token variants. */
7362
+ const tokenTypes = Object.freeze({
7363
+ AMPM: TOKEN_AMPM,
7364
+ BREAK: TOKEN_BREAK,
7365
+ CALENDAR: TOKEN_CALENDAR,
7366
+ CHAR: TOKEN_CHAR,
7367
+ COLOR: TOKEN_COLOR,
7368
+ COMMA: TOKEN_COMMA,
7369
+ CONDITION: TOKEN_CONDITION,
7370
+ DATETIME: TOKEN_DATETIME,
7371
+ DBNUM: TOKEN_DBNUM,
7372
+ DIGIT: TOKEN_DIGIT,
7373
+ DURATION: TOKEN_DURATION,
7374
+ ERROR: TOKEN_ERROR,
7375
+ ESCAPED: TOKEN_ESCAPED,
7376
+ EXP: "exp",
7377
+ FILL: TOKEN_FILL,
7378
+ GENERAL: TOKEN_GENERAL,
7379
+ GROUP: TOKEN_GROUP,
7380
+ HASH: TOKEN_HASH,
7381
+ LOCALE: TOKEN_LOCALE,
7382
+ MINUS: TOKEN_MINUS,
7383
+ MODIFIER: TOKEN_MODIFIER,
7384
+ NATNUM: TOKEN_NATNUM,
7385
+ PAREN: TOKEN_PAREN,
7386
+ PERCENT: TOKEN_PERCENT,
7387
+ PLUS: TOKEN_PLUS,
7388
+ POINT: TOKEN_POINT,
7389
+ QMARK: TOKEN_QMARK,
7390
+ SCALE: TOKEN_SCALE,
7391
+ SKIP: TOKEN_SKIP,
7392
+ SLASH: TOKEN_SLASH,
7393
+ SPACE: TOKEN_SPACE,
7394
+ STRING: TOKEN_STRING,
7395
+ TEXT: TOKEN_TEXT,
7396
+ ZERO: TOKEN_ZERO
7397
+ });
3945
7398
 
3946
7399
  //#endregion
3947
7400
  //#region src/common/regexp/factory.ts
@@ -4257,22 +7710,7 @@ const regexp = {
4257
7710
  };
4258
7711
 
4259
7712
  //#endregion
4260
- //#region src/shared/numfmt.ts
4261
- /**
4262
- * Copyright 2023-present DreamNum Co., Ltd.
4263
- *
4264
- * Licensed under the Apache License, Version 2.0 (the "License");
4265
- * you may not use this file except in compliance with the License.
4266
- * You may obtain a copy of the License at
4267
- *
4268
- * http://www.apache.org/licenses/LICENSE-2.0
4269
- *
4270
- * Unless required by applicable law or agreed to in writing, software
4271
- * distributed under the License is distributed on an "AS IS" BASIS,
4272
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4273
- * See the License for the specific language governing permissions and
4274
- * limitations under the License.
4275
- */
7713
+ //#region src/shared/numfmt/utils.ts
4276
7714
  const DEFAULT_TEXT_FORMAT = "@@@";
4277
7715
  const DEFAULT_TEXT_FORMAT_EXCEL = "@";
4278
7716
  const DEFAULT_NUMBER_FORMAT = "General";
@@ -4290,22 +7728,22 @@ function isDefaultFormat(pattern) {
4290
7728
  const isPatternEqualWithoutDecimal = (patternA, patternB) => {
4291
7729
  if (patternA && !patternB || !patternA && patternB) return false;
4292
7730
  const getStringWithoutDecimal = (pattern) => {
4293
- const tokens = numfmt.tokenize(pattern);
7731
+ const tokens = tokenize(pattern);
4294
7732
  let result = "";
4295
7733
  let isDecimalPart = false;
4296
7734
  let isColorBefore = false;
4297
7735
  for (const token of tokens) {
4298
- if (token.type === numfmt.tokenTypes.POINT) {
7736
+ if (token.type === tokenTypes.POINT) {
4299
7737
  isDecimalPart = true;
4300
7738
  continue;
4301
7739
  }
4302
- if (isColorBefore && token.type === numfmt.tokenTypes.MINUS) continue;
4303
- if (token.type === numfmt.tokenTypes.SKIP) continue;
4304
- if (token.type === numfmt.tokenTypes.COLOR) {
7740
+ if (isColorBefore && token.type === tokenTypes.MINUS) continue;
7741
+ if (token.type === tokenTypes.SKIP) continue;
7742
+ if (token.type === tokenTypes.COLOR) {
4305
7743
  isColorBefore = true;
4306
7744
  continue;
4307
7745
  } else isColorBefore = false;
4308
- if (isDecimalPart && token.type === numfmt.tokenTypes.ZERO) continue;
7746
+ if (isDecimalPart && token.type === tokenTypes.ZERO) continue;
4309
7747
  else isDecimalPart = false;
4310
7748
  if (!isDecimalPart) result += token.value || "";
4311
7749
  }
@@ -4355,8 +7793,8 @@ const CURRENCY_SYMBOL_PREFIX_REG = new RegExp(`^${regexp.charset(...Array.from(n
4355
7793
  * Get the numfmt parse value, and filter out the parse error.
4356
7794
  */
4357
7795
  const getNumfmtParseValueFilter = (value) => {
4358
- var _ref, _numfmt$parseDate;
4359
- const parseData = (_ref = (_numfmt$parseDate = numfmt.parseDate(value)) !== null && _numfmt$parseDate !== void 0 ? _numfmt$parseDate : numfmt.parseTime(value)) !== null && _ref !== void 0 ? _ref : numfmt.parseNumber(value);
7796
+ var _ref, _parseDate;
7797
+ const parseData = (_ref = (_parseDate = parseDate(value)) !== null && _parseDate !== void 0 ? _parseDate : parseTime(value)) !== null && _ref !== void 0 ? _ref : parseNumber(value);
4360
7798
  if (!parseData) return null;
4361
7799
  const { z } = parseData;
4362
7800
  if (z) {
@@ -6806,6 +10244,7 @@ const STYLE_KEYS = defineExactKeys()([
6806
10244
  "cl",
6807
10245
  "va",
6808
10246
  "n",
10247
+ "stf",
6809
10248
  "tr",
6810
10249
  "td",
6811
10250
  "ht",
@@ -13218,7 +16657,7 @@ function createDocumentSnapshot(snapshot) {
13218
16657
  };
13219
16658
  const defaultSnapshot = getEmptySnapshot$1(snapshot.id, snapshot.locale, snapshot.title, (_snapshot$documentSty = snapshot.documentStyle) === null || _snapshot$documentSty === void 0 ? void 0 : _snapshot$documentSty.documentFlavor);
13220
16659
  if (Tools.isEmptyObject(snapshot)) return defaultSnapshot;
13221
- const mergedSnapshot = mergeWith$1({}, defaultSnapshot, snapshot, (_objValue, srcValue, key) => {
16660
+ const mergedSnapshot = mergeWith({}, defaultSnapshot, snapshot, (_objValue, srcValue, key) => {
13222
16661
  if (Array.isArray(srcValue)) return srcValue;
13223
16662
  if (key === "body" && srcValue != null && typeof srcValue === "object") return srcValue;
13224
16663
  });
@@ -14305,6 +17744,7 @@ _defineProperty(BuildTextUtils, "drawing", { add: addDrawing });
14305
17744
 
14306
17745
  //#endregion
14307
17746
  //#region src/docs/data-model/rich-text-builder.ts
17747
+ const NON_EDITABLE_RICH_TEXT_TOKENS = new Set(Object.values(DataStreamTreeTokenType).filter((token) => token !== "" && token !== " "));
14308
17748
  function normalizeBody$1(body) {
14309
17749
  if (!body.customRanges) body.customRanges = [];
14310
17750
  if (!body.paragraphs) {
@@ -15914,9 +19354,158 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
15914
19354
  constructor(data) {
15915
19355
  super(data);
15916
19356
  _defineProperty(this, "_doc", void 0);
19357
+ _defineProperty(this, "_trackedRanges", /* @__PURE__ */ new Set());
15917
19358
  this._doc = new DocumentDataModel(data);
15918
19359
  }
15919
19360
  /**
19361
+ * Returns editable paragraph handles backed by this detached rich-text builder.
19362
+ *
19363
+ * Paragraph boundaries come from the document model rather than splitting plain text. Each handle stays aligned
19364
+ * when text in this builder grows or shrinks, so callers can safely iterate from the first paragraph to the last.
19365
+ *
19366
+ * @returns Editable paragraphs in document order.
19367
+ * @example
19368
+ * ```ts
19369
+ * const richText = univerAPI.newRichText()
19370
+ * .text('Quarterly Review')
19371
+ * .paragraph()
19372
+ * .text('Revenue increased by 18%.');
19373
+ * for (const paragraph of richText.getParagraphs()) {
19374
+ * console.log(paragraph.getText());
19375
+ * }
19376
+ * ```
19377
+ */
19378
+ getParagraphs() {
19379
+ var _body$paragraphs;
19380
+ const body = this._data.body;
19381
+ if (!body) return [];
19382
+ const startOffsets = getParagraphContentStartOffsets(body);
19383
+ return ((_body$paragraphs = body.paragraphs) !== null && _body$paragraphs !== void 0 ? _body$paragraphs : []).map((paragraph) => {
19384
+ var _startOffsets$get;
19385
+ return this._createParagraphBuilder(paragraph.paragraphId, (_startOffsets$get = startOffsets.get(paragraph.startIndex)) !== null && _startOffsets$get !== void 0 ? _startOffsets$get : 0, paragraph.startIndex);
19386
+ });
19387
+ }
19388
+ /**
19389
+ * Returns editable text-run handles for all paragraph text in this builder.
19390
+ *
19391
+ * Unlike the read-only value API, this method also returns unstyled gaps. Paragraph and section markers are never
19392
+ * exposed as text runs. Prefer `getParagraphs()` when paragraph context matters.
19393
+ *
19394
+ * @returns Editable text runs in document order.
19395
+ * @example
19396
+ * ```ts
19397
+ * const richText = univerAPI.newRichText()
19398
+ * .text('Status: ')
19399
+ * .span('Ready', { bold: true, color: '#16a34a' });
19400
+ * for (const run of richText.getTextRuns()) {
19401
+ * console.log(run.getText(), run.getTextStyle()?.getValue());
19402
+ * }
19403
+ * ```
19404
+ */
19405
+ getTextRuns() {
19406
+ return this.getParagraphs().flatMap((paragraph) => paragraph.getTextRuns());
19407
+ }
19408
+ /** @internal */
19409
+ _createTextRunBuilders(range) {
19410
+ var _body$textRuns, _body$customRanges, _body$customDecoratio;
19411
+ const body = this._data.body;
19412
+ if (!body || range.startOffset >= range.endOffset) return [];
19413
+ const boundaries = /* @__PURE__ */ new Set([range.startOffset, range.endOffset]);
19414
+ const addRangeBoundaries = (startOffset, endOffset) => {
19415
+ const start = Math.max(startOffset, range.startOffset);
19416
+ const end = Math.min(endOffset, range.endOffset);
19417
+ if (start < end) {
19418
+ boundaries.add(start);
19419
+ boundaries.add(end);
19420
+ }
19421
+ };
19422
+ for (const textRun of (_body$textRuns = body.textRuns) !== null && _body$textRuns !== void 0 ? _body$textRuns : []) addRangeBoundaries(textRun.st, textRun.ed);
19423
+ for (const customRange of (_body$customRanges = body.customRanges) !== null && _body$customRanges !== void 0 ? _body$customRanges : []) addRangeBoundaries(customRange.startIndex, customRange.endIndex + 1);
19424
+ for (const decoration of (_body$customDecoratio = body.customDecorations) !== null && _body$customDecoratio !== void 0 ? _body$customDecoratio : []) addRangeBoundaries(decoration.startIndex, decoration.endIndex + 1);
19425
+ for (let offset = range.startOffset; offset < range.endOffset; offset++) if (NON_EDITABLE_RICH_TEXT_TOKENS.has(body.dataStream[offset])) {
19426
+ boundaries.add(offset);
19427
+ boundaries.add(offset + 1);
19428
+ }
19429
+ const offsets = [...boundaries].sort((left, right) => left - right);
19430
+ const runs = [];
19431
+ for (let index = 0; index < offsets.length - 1; index++) {
19432
+ var _body$textRuns2;
19433
+ const startOffset = offsets[index];
19434
+ const endOffset = offsets[index + 1];
19435
+ if (startOffset >= endOffset || endOffset - startOffset === 1 && NON_EDITABLE_RICH_TEXT_TOKENS.has(body.dataStream[startOffset])) continue;
19436
+ const sourceRun = ((_body$textRuns2 = body.textRuns) !== null && _body$textRuns2 !== void 0 ? _body$textRuns2 : []).find((textRun) => textRun.st <= startOffset && textRun.ed >= endOffset);
19437
+ runs.push(new RichTextRunBuilder(this, this._trackRange(startOffset, endOffset), sourceRun === null || sourceRun === void 0 ? void 0 : sourceRun.ts, sourceRun === null || sourceRun === void 0 ? void 0 : sourceRun.sId, Boolean(sourceRun)));
19438
+ }
19439
+ return runs;
19440
+ }
19441
+ /** @internal */
19442
+ _replaceTextRun(range, text, textStyle, styleId, hasExplicitTextStyle) {
19443
+ var _sourceBody$customRan, _sourceBody$customDec;
19444
+ if (text.includes("\r") || text.includes("\n")) throw new RangeError("Rich text run replacement cannot contain paragraph or section breaks.");
19445
+ const body = this._doc.getBody();
19446
+ if (!body) throw new Error("Rich text body is not available.");
19447
+ const { startOffset, endOffset } = range;
19448
+ if (body.dataStream.slice(startOffset, endOffset) === text) return;
19449
+ const sourceBody = getBodySlice(body, startOffset, endOffset);
19450
+ const replacementBody = { dataStream: text };
19451
+ if (text && hasExplicitTextStyle) replacementBody.textRuns = [{
19452
+ st: 0,
19453
+ ed: text.length,
19454
+ sId: styleId,
19455
+ ts: Tools.deepClone(textStyle)
19456
+ }];
19457
+ if (text && ((_sourceBody$customRan = sourceBody.customRanges) === null || _sourceBody$customRan === void 0 ? void 0 : _sourceBody$customRan.length)) replacementBody.customRanges = sourceBody.customRanges.map((customRange) => ({
19458
+ ...Tools.deepClone(customRange),
19459
+ startIndex: 0,
19460
+ endIndex: text.length - 1
19461
+ }));
19462
+ if (text && ((_sourceBody$customDec = sourceBody.customDecorations) === null || _sourceBody$customDec === void 0 ? void 0 : _sourceBody$customDec.length)) replacementBody.customDecorations = sourceBody.customDecorations.map((decoration) => ({
19463
+ ...Tools.deepClone(decoration),
19464
+ startIndex: 0,
19465
+ endIndex: text.length - 1
19466
+ }));
19467
+ const textX = BuildTextUtils.selection.replace({
19468
+ doc: this._doc,
19469
+ selection: {
19470
+ startOffset,
19471
+ endOffset,
19472
+ collapsed: startOffset === endOffset
19473
+ },
19474
+ body: replacementBody
19475
+ });
19476
+ if (!textX) throw new Error("Replace rich text run failed.");
19477
+ TextX.apply(body, textX.serialize());
19478
+ this._rebaseTrackedRanges(startOffset, endOffset, text.length);
19479
+ }
19480
+ _createParagraphBuilder(paragraphId, startOffset, endOffset) {
19481
+ return new RichTextParagraphBuilder(this, paragraphId, this._trackRange(startOffset, endOffset));
19482
+ }
19483
+ _trackRange(startOffset, endOffset) {
19484
+ const range = {
19485
+ startOffset,
19486
+ endOffset
19487
+ };
19488
+ this._trackedRanges.add(range);
19489
+ return range;
19490
+ }
19491
+ _rebaseTrackedRanges(startOffset, endOffset, replacementLength) {
19492
+ const delta = replacementLength - (endOffset - startOffset);
19493
+ const mapStart = (offset) => {
19494
+ if (offset <= startOffset) return offset;
19495
+ if (offset >= endOffset) return offset + delta;
19496
+ return startOffset;
19497
+ };
19498
+ const mapEnd = (offset) => {
19499
+ if (offset <= startOffset) return offset;
19500
+ if (offset >= endOffset) return offset + delta;
19501
+ return startOffset + replacementLength;
19502
+ };
19503
+ for (const trackedRange of this._trackedRanges) {
19504
+ trackedRange.startOffset = mapStart(trackedRange.startOffset);
19505
+ trackedRange.endOffset = mapEnd(trackedRange.endOffset);
19506
+ }
19507
+ }
19508
+ /**
15920
19509
  * Appends plain text to the rich text.
15921
19510
  *
15922
19511
  * This is an agent-friendly alias of `insertText(text)`. Use it when building rich text from left to right for
@@ -15971,6 +19560,58 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
15971
19560
  return this;
15972
19561
  }
15973
19562
  /**
19563
+ * Sets the column layout for this rich-text document.
19564
+ *
19565
+ * Columns are stored in the rich-text document section layout. This creates text-flow columns, not table columns.
19566
+ * The host renderer must support rich-text columns for the layout to be visible.
19567
+ *
19568
+ * @param options The column layout options.
19569
+ * @param options.count The number of text columns. Must be a positive integer. Use `1` to clear multi-column layout.
19570
+ * @param options.spacing The spacing between columns, in px. Defaults to `0`.
19571
+ * @returns The current builder for chaining.
19572
+ *
19573
+ * @example
19574
+ * ```ts
19575
+ * const presentation = univerAPI.getActivePresentation();
19576
+ * if (!presentation) throw new Error('No active presentation');
19577
+ *
19578
+ * const slide = presentation.getSlideByIndex(0);
19579
+ * if (!slide) throw new Error('The presentation has no slides');
19580
+ * const richText = univerAPI.newRichText()
19581
+ * .columns({ count: 2, spacing: 12 })
19582
+ * .text('Column text');
19583
+ *
19584
+ * const shapeInfo = slide.newShape()
19585
+ * .setRichText(richText)
19586
+ * .setAbsolutePosition(80, 80)
19587
+ * .setSize(360, 160)
19588
+ * .build();
19589
+ *
19590
+ * slide.insertShape(shapeInfo);
19591
+ * ```
19592
+ */
19593
+ columns(options) {
19594
+ var _this$_data2, _this$_data2$body, _body$sectionBreaks, _options$spacing;
19595
+ if (!Number.isInteger(options.count) || options.count < 1) throw new RangeError("Rich text column count must be a positive integer.");
19596
+ const body = (_this$_data2$body = (_this$_data2 = this._data).body) !== null && _this$_data2$body !== void 0 ? _this$_data2$body : _this$_data2.body = { dataStream: "\r\n" };
19597
+ const sectionBreaks = (_body$sectionBreaks = body.sectionBreaks) !== null && _body$sectionBreaks !== void 0 ? _body$sectionBreaks : body.sectionBreaks = [];
19598
+ if (!sectionBreaks.length) {
19599
+ var _body$dataStream$leng, _body$dataStream;
19600
+ sectionBreaks.push({
19601
+ sectionId: createSectionId(/* @__PURE__ */ new Set()),
19602
+ startIndex: Math.max(0, ((_body$dataStream$leng = (_body$dataStream = body.dataStream) === null || _body$dataStream === void 0 ? void 0 : _body$dataStream.length) !== null && _body$dataStream$leng !== void 0 ? _body$dataStream$leng : 0) - 1)
19603
+ });
19604
+ }
19605
+ const spacing = Math.max(0, (_options$spacing = options.spacing) !== null && _options$spacing !== void 0 ? _options$spacing : 0);
19606
+ const columns = options.count === 1 ? void 0 : Array.from({ length: options.count }, (_, index) => ({
19607
+ width: 0,
19608
+ paddingEnd: index === options.count - 1 ? 0 : spacing
19609
+ }));
19610
+ for (const sectionBreak of sectionBreaks) if (columns) sectionBreak.columnProperties = columns.map((column) => ({ ...column }));
19611
+ else delete sectionBreak.columnProperties;
19612
+ return this;
19613
+ }
19614
+ /**
15974
19615
  * Appends one text span with explicit style.
15975
19616
  *
15976
19617
  * Prefer this method when combining multiple styles, because the style object is local to the inserted text and does
@@ -16349,6 +19990,174 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
16349
19990
  return typeof start === "number" ? this.insertRichText(start, rich) : this.insertRichText(rich);
16350
19991
  }
16351
19992
  };
19993
+ /**
19994
+ * An editable paragraph handle owned by a detached {@link RichTextBuilder}.
19995
+ *
19996
+ * The paragraph is resolved by its persisted paragraph id, while its tracked range is rebased after every run edit.
19997
+ * This keeps paragraph traversal safe when earlier translated text becomes longer or shorter.
19998
+ */
19999
+ var RichTextParagraphBuilder = class extends RichTextValue {
20000
+ /** @hideconstructor */
20001
+ constructor(_owner, _paragraphId, _range) {
20002
+ super(createParagraphSnapshot(_owner.getData(), _paragraphId, _range));
20003
+ this._owner = _owner;
20004
+ this._paragraphId = _paragraphId;
20005
+ this._range = _range;
20006
+ }
20007
+ /** Returns the persisted paragraph id. */
20008
+ getId() {
20009
+ return this._paragraphId;
20010
+ }
20011
+ /** Returns the current paragraph range without its trailing paragraph marker. */
20012
+ getRange() {
20013
+ return { ...this._range };
20014
+ }
20015
+ /**
20016
+ * Returns the current paragraph text without its trailing paragraph marker.
20017
+ * @example
20018
+ * ```ts
20019
+ * const richText = univerAPI.newRichText().text('Quarterly Review');
20020
+ * const paragraph = richText.getParagraphs()[0];
20021
+ * console.log(paragraph.getText());
20022
+ * ```
20023
+ */
20024
+ getText() {
20025
+ var _this$_owner$getData$, _this$_owner$getData$2;
20026
+ return ((_this$_owner$getData$ = (_this$_owner$getData$2 = this._owner.getData().body) === null || _this$_owner$getData$2 === void 0 ? void 0 : _this$_owner$getData$2.dataStream) !== null && _this$_owner$getData$ !== void 0 ? _this$_owner$getData$ : "").slice(this._range.startOffset, this._range.endOffset);
20027
+ }
20028
+ toPlainText() {
20029
+ return this.getText();
20030
+ }
20031
+ /**
20032
+ * Returns editable runs that cover all text in this paragraph, including unstyled gaps.
20033
+ * @returns Editable text runs in document order.
20034
+ */
20035
+ getTextRuns() {
20036
+ return this._owner._createTextRunBuilders(this._range);
20037
+ }
20038
+ getParagraphStyle() {
20039
+ return ParagraphStyleValue.create(this._getParagraph().paragraphStyle);
20040
+ }
20041
+ getParagraphBullet() {
20042
+ return this._getParagraph().bullet;
20043
+ }
20044
+ getLinks() {
20045
+ var _this$getData$body$cu, _this$getData$body;
20046
+ return (_this$getData$body$cu = (_this$getData$body = this.getData().body) === null || _this$getData$body === void 0 || (_this$getData$body = _this$getData$body.customRanges) === null || _this$getData$body === void 0 ? void 0 : _this$getData$body.filter((range) => range.rangeType === 0)) !== null && _this$getData$body$cu !== void 0 ? _this$getData$body$cu : [];
20047
+ }
20048
+ /** Agent-friendly alias of `getParagraphBullet()`. */
20049
+ getBullet() {
20050
+ return this.getParagraphBullet();
20051
+ }
20052
+ getData() {
20053
+ return createParagraphSnapshot(this._owner.getData(), this._paragraphId, this._range);
20054
+ }
20055
+ copy() {
20056
+ return RichTextBuilder.create(Tools.deepClone(this.getData()));
20057
+ }
20058
+ _getParagraph() {
20059
+ var _this$_owner$getData$3;
20060
+ const paragraph = (_this$_owner$getData$3 = this._owner.getData().body) === null || _this$_owner$getData$3 === void 0 || (_this$_owner$getData$3 = _this$_owner$getData$3.paragraphs) === null || _this$_owner$getData$3 === void 0 ? void 0 : _this$_owner$getData$3.find((item) => item.paragraphId === this._paragraphId);
20061
+ if (!paragraph) throw new Error(`Rich text paragraph "${this._paragraphId}" was not found.`);
20062
+ return paragraph;
20063
+ }
20064
+ };
20065
+ /**
20066
+ * An editable text-run handle owned by a detached {@link RichTextBuilder}.
20067
+ *
20068
+ * Calling {@link setText} replaces only the run text. The builder automatically updates this run, every later run,
20069
+ * paragraph indexes, hyperlinks, decorations, and other offset-based document metadata through TextX.
20070
+ */
20071
+ var RichTextRunBuilder = class {
20072
+ /** @hideconstructor */
20073
+ constructor(_owner, _range, _textStyle, _styleId, _hasExplicitTextStyle) {
20074
+ this._owner = _owner;
20075
+ this._range = _range;
20076
+ this._textStyle = _textStyle;
20077
+ this._styleId = _styleId;
20078
+ this._hasExplicitTextStyle = _hasExplicitTextStyle;
20079
+ _defineProperty(this, "_active", true);
20080
+ }
20081
+ /** Inclusive start offset, kept for compatibility with existing `getTextRuns()` callers. */
20082
+ get st() {
20083
+ return this._range.startOffset;
20084
+ }
20085
+ /** Exclusive end offset, automatically updated after text replacement. */
20086
+ get ed() {
20087
+ return this._range.endOffset;
20088
+ }
20089
+ /** Optional persisted style id. This is not a stable run identity. */
20090
+ get sId() {
20091
+ return this._styleId;
20092
+ }
20093
+ /** Existing text-style value property exposed by `getTextRuns()`. */
20094
+ get ts() {
20095
+ return this._textStyle ? TextStyleValue.create(this._textStyle) : null;
20096
+ }
20097
+ /** Returns the current run range. */
20098
+ getRange() {
20099
+ return { ...this._range };
20100
+ }
20101
+ /** Returns the current run text. */
20102
+ getText() {
20103
+ var _this$_owner$getData$4, _this$_owner$getData$5;
20104
+ return ((_this$_owner$getData$4 = (_this$_owner$getData$5 = this._owner.getData().body) === null || _this$_owner$getData$5 === void 0 ? void 0 : _this$_owner$getData$5.dataStream) !== null && _this$_owner$getData$4 !== void 0 ? _this$_owner$getData$4 : "").slice(this._range.startOffset, this._range.endOffset);
20105
+ }
20106
+ /** Returns this run's explicit text style, or `null` for an unstyled text segment. */
20107
+ getTextStyle() {
20108
+ return this.ts;
20109
+ }
20110
+ /** Returns whether this segment is backed by an explicit document text run. */
20111
+ hasTextStyle() {
20112
+ return this._hasExplicitTextStyle;
20113
+ }
20114
+ /**
20115
+ * Replaces this run's text without changing its style or paragraph structure.
20116
+ *
20117
+ * Replacement text may be longer or shorter than the original. Offsets are updated automatically, so handles
20118
+ * returned in the same `getTextRuns()` call remain safe to use in forward order. Paragraph and section breaks are
20119
+ * rejected because a text run cannot create or remove paragraphs.
20120
+ *
20121
+ * @param text New text for this run.
20122
+ * @returns This run handle for chaining. A handle becomes invalid after it is replaced with an empty string.
20123
+ * @example
20124
+ * ```ts
20125
+ * const richText = univerAPI.newRichText()
20126
+ * .span('标题', { bold: true, fontSize: 24 })
20127
+ * .paragraph()
20128
+ * .text('正文内容');
20129
+ * const replacements = ['Quarterly Review', 'Revenue increased by 18%.'];
20130
+ * let index = 0;
20131
+ * for (const run of richText.getTextRuns()) {
20132
+ * const replacement = replacements[index++];
20133
+ * if (replacement !== undefined) run.setText(replacement);
20134
+ * }
20135
+ * console.log(richText.toPlainText());
20136
+ * ```
20137
+ */
20138
+ setText(text) {
20139
+ if (!this._active) throw new Error("Rich text run handle is no longer valid.");
20140
+ this._owner._replaceTextRun(this._range, text, this._textStyle, this._styleId, this._hasExplicitTextStyle);
20141
+ if (!text) this._active = false;
20142
+ return this;
20143
+ }
20144
+ };
20145
+ function createParagraphSnapshot(data, paragraphId, range) {
20146
+ var _body$paragraphs2;
20147
+ const { body, ...documentData } = data;
20148
+ if (!body) throw new Error("Rich text body is not available.");
20149
+ const paragraph = (_body$paragraphs2 = body.paragraphs) === null || _body$paragraphs2 === void 0 ? void 0 : _body$paragraphs2.find((item) => item.paragraphId === paragraphId);
20150
+ if (!paragraph) throw new Error(`Rich text paragraph "${paragraphId}" was not found.`);
20151
+ const paragraphBody = getBodySlice(body, range.startOffset, range.endOffset);
20152
+ paragraphBody.paragraphs = [{
20153
+ ...Tools.deepClone(paragraph),
20154
+ startIndex: range.endOffset - range.startOffset
20155
+ }];
20156
+ return {
20157
+ ...Tools.deepClone(documentData),
20158
+ body: paragraphBody
20159
+ };
20160
+ }
16352
20161
 
16353
20162
  //#endregion
16354
20163
  //#region src/docs/data-model/subdocument.ts
@@ -22643,4 +26452,4 @@ function createUniverInjector(parentInjector, override) {
22643
26452
  installShims();
22644
26453
 
22645
26454
  //#endregion
22646
- export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BORDER_KEYS, BORDER_STYLE_KEYS, BaseDataModel, BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseSortDirection, BaseViewType, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnLayoutType, ColumnResponsiveType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW, DEFAULT_DOCUMENT_SUB_COMPONENT_ID, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_NUMBER_FORMAT, DEFAULT_RANGE, DEFAULT_RANGE_ARRAY, DEFAULT_SELECTION, DEFAULT_STYLES, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DataValidationErrorStyle, DataValidationImeMode, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentBlockRangeType, DocumentBlockType, DocumentDataModel, DocumentFlavor, DrawingTypeEnum, EDITOR_ACTIVATED, EXTENSION_NAMES, ErrorService, EventState, EventSubject, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_BUT_HIDDEN, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_SLIDE, FOCUSING_UNIT, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, FollowNumberWithType, FontItalic, FontStyleType, FontWeight, GridType, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, IImageIoService, ILocalStorageService, ILogService, IMentionIOService, IPermissionService, IResourceLoaderService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, InjectSelf, Injector, InterceptorEffectEnum, InterceptorManager, InterpolationPointType, json1 as JSON1, JSONX, LOCALE_META, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ROW_COUNT, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PARAGRAPH_ID_PREFIX, PRESERVE_INSERTED_PARAGRAPH_IDS, PRESET_LIST_TYPE, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RESTORE_INSERTED_PARAGRAPH_IDS, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextValue, RxDisposable, SECTION_ID_PREFIX, SHEET_EDITOR_UNITS, STYLE_KEYS, SectionType, Self, SheetSkeleton, SheetTypes, SheetViewModel, Skeleton, SkipSelf, SliceBodyType, SpacingRule, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, THEME_COLORS, TabStopAlignment, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneBodyWithFreshParagraphIds, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneParagraphWithId, cloneSectionBreakWithId, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, containsInteriorInsertionOffset, containsStreamIndex, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createDefaultBaseTableSnapshot, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createRandomId, createRowColIter, createSectionId, createSheetGapTestConfig, currencySymbols, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getEmptySnapshot as getBasesEmptySnapshot, getBlockRangeInterval, getBodySlice, getBodySliceForSplitTextXAction, getBodySliceForTextXAction, getBorderStyleType, getCellCoordByIndexSimple, getCellInfoInMergeData, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getColumnGroupRangeInterval, getCustomBlockInterval, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeInterval, getCustomRangeSlice, getDisplayValueFromCell, getEmptySnapshot$1 as getDocsEmptySnapshot, getDocsUpdateBody, getEmptyCell, getExclusiveRangeInterval, getInclusiveRangeInterval, getIntersectRange, getNumfmtParseValueFilter, getOriginCellValue, getParagraphContentStartOffset, getParagraphContentStartOffsets, getParagraphFollowingBlockOffset, getParagraphsSlice, getPlainText, getReverseDirection, getRichTextEditPath, getSectionBreakSlice, getSectionHeaderFooterReferenceKey, getEmptySnapshot$2 as getSheetsEmptySnapshot, getSingleDataStreamChange, getTableCellTokenInterval, getTableRangeInterval, getTableRowTokenInterval, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, intersectsOperationalIntervals, invertColorByHSL, invertColorByMatrix, isAsyncDependencyItem, isAsyncHook, isBlackColor, isBooleanString, isCellCoverable, isCellV, isClassDependencyItem, isCommentEditorID, isCtor, isDefaultFormat, isDisposable, isEmptyCell, isFactoryDependencyItem, isFormulaId, isFormulaString, isICellData, isInternalEditorID, isNodeEnv, isNotNullOrUndefined, isNullCell, isNumeric, isPatternEqualWithoutDecimal, isRangesEqual, isRealNum, isSafeNumeric, isSafeUrl, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, makeCellToSelection, makeCustomRangeStream, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, noop, normalizeBody, normalizeInsertedSectionIdsForDocument, normalizeTextRuns, normalizeUrl, numberToABC, numberToListABC, numfmt, queryObjectMatrix, regexp, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, shallowEqual, shiftExclusiveRangeOnDelete, shiftExclusiveRangeOnInsert, shiftInclusiveRangeOnDelete, shiftInclusiveRangeOnInsert, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, validateDocBodyStructure, validateDocumentStructure, willLoseNumericPrecision };
26455
+ export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BORDER_KEYS, BORDER_STYLE_KEYS, BaseDataModel, BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseSortDirection, BaseViewType, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnLayoutType, ColumnResponsiveType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW, DEFAULT_DOCUMENT_SUB_COMPONENT_ID, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_NUMBER_FORMAT, DEFAULT_RANGE, DEFAULT_RANGE_ARRAY, DEFAULT_SELECTION, DEFAULT_STYLES, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DataValidationErrorStyle, DataValidationImeMode, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentBlockRangeType, DocumentBlockType, DocumentDataModel, DocumentFlavor, DrawingTypeEnum, EDITOR_ACTIVATED, EXTENSION_NAMES, ErrorService, EventState, EventSubject, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_BUT_HIDDEN, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_SLIDE, FOCUSING_UNIT, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, FollowNumberWithType, FontItalic, FontStyleType, FontWeight, GridType, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, IImageIoService, ILocalStorageService, ILogService, IMentionIOService, IPermissionService, IResourceLoaderService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, InjectSelf, Injector, InterceptorEffectEnum, InterceptorManager, InterpolationPointType, json1 as JSON1, JSONX, LOCALE_META, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ROW_COUNT, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PARAGRAPH_ID_PREFIX, PRESERVE_INSERTED_PARAGRAPH_IDS, PRESET_LIST_TYPE, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RESTORE_INSERTED_PARAGRAPH_IDS, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextParagraphBuilder, RichTextRunBuilder, RichTextValue, RxDisposable, SECTION_ID_PREFIX, SHEET_EDITOR_UNITS, STYLE_KEYS, SectionType, Self, SheetSkeleton, SheetTypes, SheetViewModel, Skeleton, SkipSelf, SliceBodyType, SpacingRule, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, THEME_COLORS, TabStopAlignment, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneBodyWithFreshParagraphIds, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneParagraphWithId, cloneSectionBreakWithId, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, containsInteriorInsertionOffset, containsStreamIndex, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createDefaultBaseTableSnapshot, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createRandomId, createRowColIter, createSectionId, createSheetGapTestConfig, currencySymbols, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getEmptySnapshot as getBasesEmptySnapshot, getBlockRangeInterval, getBodySlice, getBodySliceForSplitTextXAction, getBodySliceForTextXAction, getBorderStyleType, getCellCoordByIndexSimple, getCellInfoInMergeData, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getColumnGroupRangeInterval, getCustomBlockIdsInSelections, getCustomBlockInterval, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeInterval, getCustomRangeSlice, getDisplayValueFromCell, getEmptySnapshot$1 as getDocsEmptySnapshot, getDocsUpdateBody, getEmptyCell, getExclusiveRangeInterval, getInclusiveRangeInterval, getIntersectRange, getNumfmtParseValueFilter, getOriginCellValue, getParagraphContentStartOffset, getParagraphContentStartOffsets, getParagraphFollowingBlockOffset, getParagraphsSlice, getPlainText, getReverseDirection, getRichTextEditPath, getSectionBreakSlice, getSectionHeaderFooterReferenceKey, getEmptySnapshot$2 as getSheetsEmptySnapshot, getSingleDataStreamChange, getTableCellTokenInterval, getTableRangeInterval, getTableRowTokenInterval, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, intersectsOperationalIntervals, invertColorByHSL, invertColorByMatrix, isAsyncDependencyItem, isAsyncHook, isBlackColor, isBooleanString, isCellCoverable, isCellV, isClassDependencyItem, isCommentEditorID, isCtor, isDefaultFormat, isDisposable, isEmptyCell, isFactoryDependencyItem, isFormulaId, isFormulaString, isICellData, isInternalEditorID, isNodeEnv, isNotNullOrUndefined, isNullCell, isNumeric, isPatternEqualWithoutDecimal, isRangesEqual, isRealNum, isSafeNumeric, isSafeUrl, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, makeCellToSelection, makeCustomRangeStream, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, noop, normalizeBody, normalizeInsertedSectionIdsForDocument, normalizeTextRuns, normalizeUrl, numberToABC, numberToListABC, api_exports as numfmt, queryObjectMatrix, regexp, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, shallowEqual, shiftExclusiveRangeOnDelete, shiftExclusiveRangeOnInsert, shiftInclusiveRangeOnDelete, shiftInclusiveRangeOnInsert, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, validateDocBodyStructure, validateDocumentStructure, willLoseNumericPrecision };