@univerjs/core 0.4.1 → 0.4.2-nightly.202410291606

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { BehaviorSubject, Subject, Observable, filter, tap, debounceTime, map, merge as merge$2, timer, distinctUntilChanged, skip, of, combineLatest } from "rxjs";
5
+ import { BehaviorSubject, Subject, Observable, filter, tap, debounceTime, map, merge as merge$1, timer, distinctUntilChanged, skip, of, combineLatest } from "rxjs";
6
6
  import { filter as filter$1, debounceTime as debounceTime$1, first, map as map$1 } from "rxjs/operators";
7
7
  import * as React from "react";
8
8
  import React__default, { useState, useEffect, useRef, useMemo, createContext, useCallback, useContext } from "react";
@@ -804,12 +804,9 @@ function baseMerge(object, source, srcIndex, customizer, stack) {
804
804
  __name(baseMerge, "baseMerge");
805
805
  var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
806
806
  baseMerge(object, source, srcIndex, customizer);
807
- });
808
- const mergeWith$1 = mergeWith;
809
- var merge = createAssigner(function(object, source, srcIndex) {
807
+ }), merge = createAssigner(function(object, source, srcIndex) {
810
808
  baseMerge(object, source, srcIndex);
811
809
  });
812
- const merge$1 = merge;
813
810
  function baseSet(object, path, value, customizer) {
814
811
  if (!isObject$1(object))
815
812
  return object;
@@ -877,7 +874,7 @@ function isBooleanString(str) {
877
874
  }
878
875
  __name(isBooleanString, "isBooleanString");
879
876
  const PREFIX = "__INTERNAL_EDITOR__", DOCS_NORMAL_EDITOR_UNIT_ID_KEY = `${PREFIX}DOCS_NORMAL`, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY = `${PREFIX}DOCS_FORMULA_BAR`, DOCS_ZEN_EDITOR_UNIT_ID_KEY = `${PREFIX}ZEN_EDITOR`, DEFAULT_EMPTY_DOCUMENT_VALUE = `\r
880
- `;
877
+ `, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE = "isRowStylePrecedeColumnStyle";
881
878
  function createInternalEditorID(id) {
882
879
  return `${PREFIX}${id}`;
883
880
  }
@@ -2665,7 +2662,7 @@ function bufferDebounceTime(time = 0) {
2665
2662
  }
2666
2663
  __name(bufferDebounceTime, "bufferDebounceTime");
2667
2664
  const afterInitApply = /* @__PURE__ */ __name((commandService) => new Promise((res) => {
2668
- merge$2(
2665
+ merge$1(
2669
2666
  fromCallback(commandService.onCommandExecuted.bind(commandService)).pipe(filter$1(([info]) => info.type === CommandType.MUTATION)),
2670
2667
  timer(300)
2671
2668
  ).pipe(debounceTime$1(16), first()).subscribe(() => {
@@ -3086,7 +3083,38 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
3086
3083
  "X",
3087
3084
  "Y",
3088
3085
  "Z"
3089
- ], _Tools = class _Tools {
3086
+ ];
3087
+ function isValueEqual(oneValue, twoValue) {
3088
+ const oneType = Tools.getValueType(oneValue), twoType = Tools.getValueType(twoValue);
3089
+ return oneType !== twoType ? !1 : Tools.isArray(oneValue) ? diffArrays(oneValue, twoValue) : Tools.isObject(oneValue) ? diffObject(oneValue, twoValue) : Tools.isDate(oneValue) ? oneValue.getTime() === twoValue.getTime() : Tools.isRegExp(oneValue) ? oneValue.toString() === twoValue.toString() : oneValue === twoValue;
3090
+ }
3091
+ __name(isValueEqual, "isValueEqual");
3092
+ function diffArrays(oneArray, twoArray) {
3093
+ if (oneArray.length !== twoArray.length)
3094
+ return !1;
3095
+ for (let i = 0, len = oneArray.length; i < len; i++) {
3096
+ const oneValue = oneArray[i], twoValue = twoArray[i];
3097
+ if (!isValueEqual(oneValue, twoValue))
3098
+ return !1;
3099
+ }
3100
+ return !0;
3101
+ }
3102
+ __name(diffArrays, "diffArrays");
3103
+ function diffObject(oneObject, twoObject) {
3104
+ const oneKeys = Object.keys(oneObject), twoKeys = Object.keys(twoObject);
3105
+ if (oneKeys.length !== twoKeys.length)
3106
+ return !1;
3107
+ for (const key of oneKeys) {
3108
+ if (!twoKeys.includes(key))
3109
+ return !1;
3110
+ const oneValue = oneObject[key], twoValue = twoObject[key];
3111
+ if (!isValueEqual(oneValue, twoValue))
3112
+ return !1;
3113
+ }
3114
+ return !0;
3115
+ }
3116
+ __name(diffObject, "diffObject");
3117
+ const _Tools = class _Tools {
3090
3118
  static stringAt(index2) {
3091
3119
  let str = "", idx = index2;
3092
3120
  for (; idx >= alphabets.length; )
@@ -3201,37 +3229,8 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
3201
3229
  static numberFixed(value, digit) {
3202
3230
  return Number(Number(value).toFixed(digit));
3203
3231
  }
3204
- static diffValue(one, tow) {
3205
- function diffValue(oneValue, towValue) {
3206
- const oneType = _Tools.getValueType(oneValue), towType = _Tools.getValueType(towValue);
3207
- return oneType !== towType ? !1 : _Tools.isArray(oneValue) ? diffArrays(oneValue, towValue) : _Tools.isObject(oneValue) ? diffObject(oneValue, towValue) : _Tools.isDate(oneValue) ? oneValue.getTime() === towValue.getTime() : _Tools.isRegExp(oneValue) ? oneValue.toString() === towValue.toString() : oneValue === towValue;
3208
- }
3209
- __name(diffValue, "diffValue");
3210
- function diffArrays(oneArray, towArray) {
3211
- if (oneArray.length !== towArray.length)
3212
- return !1;
3213
- for (let i = 0, len = oneArray.length; i < len; i++) {
3214
- const oneValue = oneArray[i], towValue = towArray[i];
3215
- if (!diffValue(oneValue, towValue))
3216
- return !1;
3217
- }
3218
- return !0;
3219
- }
3220
- __name(diffArrays, "diffArrays");
3221
- function diffObject(oneObject, towObject) {
3222
- const oneKeys = Object.keys(oneObject), towKeys = Object.keys(towObject);
3223
- if (oneKeys.length !== towKeys.length)
3224
- return !1;
3225
- for (const key of oneKeys) {
3226
- if (!towKeys.includes(key))
3227
- return !1;
3228
- const oneValue = oneObject[key], towValue = towObject[key];
3229
- if (!diffValue(oneValue, towValue))
3230
- return !1;
3231
- }
3232
- return !0;
3233
- }
3234
- return __name(diffObject, "diffObject"), diffValue(one, tow);
3232
+ static diffValue(one, two) {
3233
+ return isValueEqual(one, two);
3235
3234
  }
3236
3235
  static deepClone(value) {
3237
3236
  if (!this.isDefine(value))
@@ -3485,6 +3484,19 @@ function generateRandomId(n = 21, alphabet) {
3485
3484
  return alphabet ? customAlphabet(alphabet, n)() : nanoid(n);
3486
3485
  }
3487
3486
  __name(generateRandomId, "generateRandomId");
3487
+ function composeStyles(...styles) {
3488
+ const result = {}, length = styles.length;
3489
+ for (let i = length - 1; i >= 0; i--) {
3490
+ const style = styles[i];
3491
+ if (style) {
3492
+ const keys = Object.keys(style);
3493
+ for (const key of keys)
3494
+ result[key] === void 0 && (result[key] = style[key]);
3495
+ }
3496
+ }
3497
+ return result;
3498
+ }
3499
+ __name(composeStyles, "composeStyles");
3488
3500
  function getBodySliceHtml(body, startIndex, endIndex) {
3489
3501
  const { dataStream, textRuns = [] } = body;
3490
3502
  let cursorIndex = startIndex;
@@ -4418,21 +4430,21 @@ function handleStyleToString(style, isCell = !1) {
4418
4430
  "ul",
4419
4431
  () => {
4420
4432
  var _a12;
4421
- (_a12 = style.ul) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_, p1) => `${p1} underline`) : str += "text-decoration: underline; ", style.ul.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.ul.cl)}; `), style.ul.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.ul.t} `));
4433
+ (_a12 = style.ul) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_2, p1) => `${p1} underline`) : str += "text-decoration: underline; ", style.ul.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.ul.cl)}; `), style.ul.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.ul.t} `));
4422
4434
  }
4423
4435
  ],
4424
4436
  [
4425
4437
  "st",
4426
4438
  () => {
4427
4439
  var _a12;
4428
- (_a12 = style.st) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_, p1) => `${p1} line-through`) : str += "text-decoration-line: line-through; ", style.st.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.st.cl)}; `), style.st.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.st.t} `));
4440
+ (_a12 = style.st) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_2, p1) => `${p1} line-through`) : str += "text-decoration-line: line-through; ", style.st.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.st.cl)}; `), style.st.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.st.t} `));
4429
4441
  }
4430
4442
  ],
4431
4443
  [
4432
4444
  "ol",
4433
4445
  () => {
4434
4446
  var _a12;
4435
- (_a12 = style.ol) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_, p1) => `${p1} overline`) : str += "text-decoration-line: overline; ", style.ol.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.ol.cl)}; `), style.ol.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.ol.t} `));
4447
+ (_a12 = style.ol) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_2, p1) => `${p1} overline`) : str += "text-decoration-line: overline; ", style.ol.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.ol.cl)}; `), style.ol.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.ol.t} `));
4436
4448
  }
4437
4449
  ],
4438
4450
  [
@@ -4906,7 +4918,7 @@ var numfmt$2 = { exports: {} };
4906
4918
  return { ...g };
4907
4919
  }
4908
4920
  __name(h, "h");
4909
- const y = { "#": "", 0: "0", "?": " " }, _ = { "@": "text", "-": "minus", "+": "plus" }, b = ["#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#800", "#080", "#008", "#880", "#808", "#088", "#CCC", "#888", "#99F", "#936", "#FFC", "#CFF", "#606", "#F88", "#06C", "#CCF", "#008", "#F0F", "#FF0", "#0FF", "#808", "#800", "#088", "#00F", "#0CF", "#CFF", "#CFC", "#FF9", "#9CF", "#F9C", "#C9F", "#FC9", "#36F", "#3CC", "#9C0", "#FC0"], j = ["¤", "$", "£", "¥", "֏", "؋", "৳", "฿", "៛", "₡", "₦", "₩", "₪", "₫", "€", "₭", "₮", "₱", "₲", "₴", "₸", "₹", "₺", "₼", "₽", "₾", "₿"], v = new RegExp("[" + j.join("") + "]");
4921
+ const y = { "#": "", 0: "0", "?": " " }, _2 = { "@": "text", "-": "minus", "+": "plus" }, b = ["#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#800", "#080", "#008", "#880", "#808", "#088", "#CCC", "#888", "#99F", "#936", "#FFC", "#CFF", "#606", "#F88", "#06C", "#CCF", "#008", "#F0F", "#FF0", "#0FF", "#808", "#800", "#088", "#00F", "#0CF", "#CFF", "#CFC", "#FF9", "#9CF", "#F9C", "#C9F", "#FC9", "#36F", "#3CC", "#9C0", "#FC0"], j = ["¤", "$", "£", "¥", "֏", "؋", "৳", "฿", "៛", "₡", "₦", "₩", "₪", "₫", "€", "₭", "₮", "₱", "₲", "₴", "₸", "₹", "₺", "₼", "₽", "₾", "₿"], v = new RegExp("[" + j.join("") + "]");
4910
4922
  function M(e2, t2, n2) {
4911
4923
  return t2[n2 + "_max"] = e2.length, t2[n2 + "_min"] = e2.replace(/#/g, "").length, t2;
4912
4924
  }
@@ -4947,7 +4959,7 @@ var numfmt$2 = { exports: {} };
4947
4959
  i2 = !0;
4948
4960
  break;
4949
4961
  }
4950
- if (d2 = /^[@+-]/.exec(a2)) d2[0] === "@" && (n2.text = !0), F({ type: _[d2[0]] }, t2);
4962
+ if (d2 = /^[@+-]/.exec(a2)) d2[0] === "@" && (n2.text = !0), F({ type: _2[d2[0]] }, t2);
4951
4963
  else if (d2 = /^(?:\[(h+|m+|s+)\])/i.exec(a2)) {
4952
4964
  const e3 = d2[1].toLowerCase(), a3 = e3[0], r3 = { type: "", size: 0, date: 1, raw: d2[0], pad: e3.length };
4953
4965
  a3 === "h" ? (r3.size = 16, r3.type = "hour-elap") : a3 === "m" ? (r3.size = 32, r3.type = "min-elap") : (r3.size = 64, r3.type = "sec-elap"), n2.date = n2.date | r3.size, l2.push(r3), F(r3, t2);
@@ -5106,7 +5118,7 @@ var numfmt$2 = { exports: {} };
5106
5118
  return t2 === 6 ? A(a2) : t2 === -1 ? E(a2) : C(a2, n2);
5107
5119
  }
5108
5120
  __name(Y, "Y");
5109
- const T2 = Math.floor, N = 86400;
5121
+ const T = Math.floor, N = 86400;
5110
5122
  function P(e2, t2) {
5111
5123
  let n2 = null;
5112
5124
  if (Array.isArray(e2)) {
@@ -5126,9 +5138,9 @@ var numfmt$2 = { exports: {} };
5126
5138
  function I(e2, t2) {
5127
5139
  let n2 = 0 | e2;
5128
5140
  const a2 = N * (e2 - n2);
5129
- let r2 = T2(a2);
5141
+ let r2 = T(a2);
5130
5142
  a2 - r2 > 0.9999 && (r2 += 1, r2 === N && (r2 = 0, n2 += 1));
5131
- const i2 = r2 < 0 ? N + r2 : r2, [s2, o2, l2] = Y(e2, 0, t2 && t2.leap1900), d2 = T2(i2 / 60 / 60) % 60, m2 = T2(i2 / 60) % 60, u2 = T2(i2) % 60;
5143
+ const i2 = r2 < 0 ? N + r2 : r2, [s2, o2, l2] = Y(e2, 0, t2 && t2.leap1900), d2 = T(i2 / 60 / 60) % 60, m2 = T(i2 / 60) % 60, u2 = T(i2) % 60;
5132
5144
  if (t2 && t2.nativeDate) {
5133
5145
  const e3 = /* @__PURE__ */ new Date(0);
5134
5146
  return e3.setUTCFullYear(s2, o2 - 1, l2), e3.setUTCHours(d2, m2, u2), e3;
@@ -5149,7 +5161,7 @@ var numfmt$2 = { exports: {} };
5149
5161
  return !(t2 && !t2.generated || n2 && !n2.generated || a2 && !a2.generated || !r2 || !r2.text || r2.generated);
5150
5162
  }
5151
5163
  __name(L, "L");
5152
- const U = { text: 15, datetime: 10.8, date: 10.8, time: 10.8, percent: 10.6, currency: 10.4, grouped: 10.2, scientific: 6, number: 4, fraction: 2, general: 0, error: 0 }, R2 = [["DMY", 1], ["DM", 2], ["MY", 3], ["MDY", 4], ["MD", 5], ["hmsa", 6], ["hma", 7], ["hms", 8], ["hm", 9]], G = { total: 1, sign: 0, period: 0, int: 1, frac: 0 }, H = /* @__PURE__ */ __name((e2, t2) => e2.replace(/\./, t2.decimal), "H");
5164
+ const U = { text: 15, datetime: 10.8, date: 10.8, time: 10.8, percent: 10.6, currency: 10.4, grouped: 10.2, scientific: 6, number: 4, fraction: 2, general: 0, error: 0 }, R = [["DMY", 1], ["DM", 2], ["MY", 3], ["MDY", 4], ["MD", 5], ["hmsa", 6], ["hma", 7], ["hms", 8], ["hm", 9]], G2 = { total: 1, sign: 0, period: 0, int: 1, frac: 0 }, H = /* @__PURE__ */ __name((e2, t2) => e2.replace(/\./, t2.decimal), "H");
5153
5165
  function B(e2, t2, n2, a2) {
5154
5166
  const r2 = 0 | n2;
5155
5167
  if (typeof n2 == "string") e2.push(n2);
@@ -5161,7 +5173,7 @@ var numfmt$2 = { exports: {} };
5161
5173
  const s2 = function(e3) {
5162
5174
  let t4 = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
5163
5175
  const n3 = Math.abs(e3);
5164
- if (!n3) return G;
5176
+ if (!n3) return G2;
5165
5177
  const a3 = t4 && e3 < 0 ? 1 : 0, r4 = Math.floor(n3), i3 = Math.floor(Math.log10(n3) + 1);
5166
5178
  let s3 = 0, o3 = 0;
5167
5179
  if (r4 !== n3) {
@@ -5204,7 +5216,7 @@ var numfmt$2 = { exports: {} };
5204
5216
  return t2 > 1 ? Math.floor(n2 / t2) * t2 : n2;
5205
5217
  }, "Z");
5206
5218
  function K(e2, t2, n2, a2) {
5207
- let r2 = "", i2 = "", s2 = "", o2 = "", l2 = "", d2 = 0, m2 = 0 | e2, f2 = 0, g2 = 0, h2 = 1, _2 = 0, b2 = 0, j2 = 0, v2 = 0, M2 = 0, k2 = 0;
5219
+ let r2 = "", i2 = "", s2 = "", o2 = "", l2 = "", d2 = 0, m2 = 0 | e2, f2 = 0, g2 = 0, h2 = 1, _3 = 0, b2 = 0, j2 = 0, v2 = 0, M2 = 0, k2 = 0;
5208
5220
  const x2 = a2 || u;
5209
5221
  if (!t2.text && isFinite(t2.scale) && t2.scale !== 1 && (e2 = function(e3) {
5210
5222
  if (e3 === 0) return e3;
@@ -5246,7 +5258,7 @@ var numfmt$2 = { exports: {} };
5246
5258
  }
5247
5259
  if (m2 || t2.date_system) {
5248
5260
  const a4 = Y(e2, t2.date_system, n2.leap1900);
5249
- g2 = a4[0], h2 = a4[1], _2 = a4[2];
5261
+ g2 = a4[0], h2 = a4[1], _3 = a4[2];
5250
5262
  }
5251
5263
  if (f2) {
5252
5264
  const e3 = f2 < 0 ? $ + f2 : f2;
@@ -5296,7 +5308,7 @@ var numfmt$2 = { exports: {} };
5296
5308
  else if (u3.type === "monthname") t2.date_system === 6 ? D2.push(x2.mmmm6[h2 - 1]) : D2.push(x2.mmmm[h2 - 1]);
5297
5309
  else if (u3.type === "weekday-short") D2.push(x2.ddd[b2]);
5298
5310
  else if (u3.type === "weekday") D2.push(x2.dddd[b2]);
5299
- else if (u3.type === "day") D2.push(u3.pad && _2 < 10 ? "0" : "", _2);
5311
+ else if (u3.type === "day") D2.push(u3.pad && _3 < 10 ? "0" : "", _3);
5300
5312
  else if (u3.type === "hour") {
5301
5313
  const e3 = j2 % t2.clock || (t2.clock < 24 ? t2.clock : 0);
5302
5314
  D2.push(u3.pad && e3 < 10 ? "0" : "", e3);
@@ -5540,7 +5552,7 @@ var numfmt$2 = { exports: {} };
5540
5552
  const r5 = a4.type;
5541
5553
  /^(b-)?year/.test(r5) ? (n4 += "Y", t4++) : r5.startsWith("month") ? (n4 += "M", t4++) : /^(week)?day/.test(r5) ? (n4 += "D", t4++) : r5 !== "hour" && r5 !== "min" && r5 !== "sec" && r5 !== "am" || (n4 += r5[0], e4++);
5542
5554
  }), s3.type = "date", t4 && e4 ? s3.type = "datetime" : !t4 && e4 && (s3.type = "time");
5543
- const r4 = R2.find((e5) => n4.startsWith(e5[0]));
5555
+ const r4 = R.find((e5) => n4.startsWith(e5[0]));
5544
5556
  l2 = r4 ? "D" : "G", d2 = r4 ? r4[1] : "";
5545
5557
  } else s3.isText ? (l2 = "G", s3.type = "text", d2 = "", s3.maxDecimals = 0) : a3.general ? (l2 = "G", s3.type = "general", d2 = "") : a3.fractions ? (l2 = "G", s3.type = "fraction", d2 = "") : a3.exponential ? (l2 = "S", s3.type = "scientific") : s3.isPercent ? (l2 = "P", s3.type = "percent") : a3.grouping ? (l2 = ",", s3.type = "grouped") : (a3.int_max || i3) && (l2 = "F", s3.type = "number");
5546
5558
  return s3.code = l2 + d2 + u2 + m2, s3.level = U[s3.type], Object.freeze(s3);
@@ -6630,10 +6642,23 @@ function moveRangeByOffset(range, refOffsetX, refOffsetY, ignoreAbsolute = !1) {
6630
6642
  if (refOffsetX === 0 && refOffsetY === 0)
6631
6643
  return range;
6632
6644
  let newRange = { ...range };
6633
- const startAbsoluteRefType = newRange.startAbsoluteRefType || AbsoluteRefType.NONE, endAbsoluteRefType = newRange.endAbsoluteRefType || AbsoluteRefType.NONE;
6634
- return !ignoreAbsolute && startAbsoluteRefType === AbsoluteRefType.ALL && endAbsoluteRefType === AbsoluteRefType.ALL ? newRange : ignoreAbsolute || startAbsoluteRefType === AbsoluteRefType.NONE && endAbsoluteRefType === AbsoluteRefType.NONE ? Rectangle.moveOffset(newRange, refOffsetX, refOffsetY) : (startAbsoluteRefType === AbsoluteRefType.NONE ? newRange = { ...newRange, startRow: newRange.startRow + refOffsetY, startColumn: newRange.startColumn + refOffsetX } : startAbsoluteRefType === AbsoluteRefType.COLUMN ? newRange = { ...newRange, startRow: newRange.startRow + refOffsetY } : startAbsoluteRefType === AbsoluteRefType.ROW && (newRange = { ...newRange, startColumn: newRange.startColumn + refOffsetX }), endAbsoluteRefType === AbsoluteRefType.NONE ? newRange = { ...newRange, endRow: newRange.endRow + refOffsetY, endColumn: newRange.endColumn + refOffsetX } : endAbsoluteRefType === AbsoluteRefType.COLUMN ? newRange = { ...newRange, endRow: newRange.endRow + refOffsetY } : endAbsoluteRefType === AbsoluteRefType.ROW && (newRange = { ...newRange, endColumn: newRange.endColumn + refOffsetX }), newRange);
6645
+ const startAbsoluteRefType = newRange.startAbsoluteRefType || AbsoluteRefType.NONE, endAbsoluteRefType = newRange.endAbsoluteRefType || AbsoluteRefType.NONE, rangeType = newRange.rangeType || RANGE_TYPE.NORMAL;
6646
+ if (!ignoreAbsolute && startAbsoluteRefType === AbsoluteRefType.ALL && endAbsoluteRefType === AbsoluteRefType.ALL)
6647
+ return newRange;
6648
+ const start = moveRangeByRangeType(newRange.startRow, refOffsetY, newRange.startColumn, refOffsetX, rangeType), end = moveRangeByRangeType(newRange.endRow, refOffsetY, newRange.endColumn, refOffsetX, rangeType);
6649
+ return ignoreAbsolute || startAbsoluteRefType === AbsoluteRefType.NONE && endAbsoluteRefType === AbsoluteRefType.NONE ? newRange = {
6650
+ ...newRange,
6651
+ startRow: start.row,
6652
+ startColumn: start.column,
6653
+ endRow: end.row,
6654
+ endColumn: end.column
6655
+ } : (startAbsoluteRefType === AbsoluteRefType.NONE ? newRange = { ...newRange, startRow: start.row, startColumn: start.column } : startAbsoluteRefType === AbsoluteRefType.COLUMN ? newRange = { ...newRange, startRow: start.row } : startAbsoluteRefType === AbsoluteRefType.ROW && (newRange = { ...newRange, startColumn: start.column }), endAbsoluteRefType === AbsoluteRefType.NONE ? newRange = { ...newRange, endRow: end.row, endColumn: end.column } : endAbsoluteRefType === AbsoluteRefType.COLUMN ? newRange = { ...newRange, endRow: end.row } : endAbsoluteRefType === AbsoluteRefType.ROW && (newRange = { ...newRange, endColumn: end.column }), newRange);
6635
6656
  }
6636
6657
  __name(moveRangeByOffset, "moveRangeByOffset");
6658
+ function moveRangeByRangeType(row, rowOffset, column, columnOffset, rangeType) {
6659
+ return rangeType === RANGE_TYPE.NORMAL ? { row: row + rowOffset, column: column + columnOffset } : rangeType === RANGE_TYPE.ROW ? { row: row + rowOffset, column } : rangeType === RANGE_TYPE.COLUMN ? { row, column: column + columnOffset } : { row, column };
6660
+ }
6661
+ __name(moveRangeByRangeType, "moveRangeByRangeType");
6637
6662
  function splitIntoGrid(ranges) {
6638
6663
  const columns = /* @__PURE__ */ new Set(), rows = /* @__PURE__ */ new Set();
6639
6664
  for (const range of ranges)
@@ -6937,6 +6962,9 @@ const _Rectangle = class _Rectangle {
6937
6962
  height: bottom - top
6938
6963
  };
6939
6964
  }
6965
+ static sort(ranges) {
6966
+ return ranges.sort((a, b) => a.startRow - b.startRow || a.startColumn - b.startColumn);
6967
+ }
6940
6968
  };
6941
6969
  __name(_Rectangle, "Rectangle"), __publicField(_Rectangle, "getRelativeRange", /* @__PURE__ */ __name((range, originRange) => ({
6942
6970
  startRow: range.startRow - originRange.startRow,
@@ -7143,7 +7171,7 @@ function sortRulesFactory(key = "index", ruler = 1) {
7143
7171
  return (oa, ob) => oa[key] > ob[key] ? ruler : oa[key] === ob[key] ? 0 : -ruler;
7144
7172
  }
7145
7173
  __name(sortRulesFactory, "sortRulesFactory");
7146
- var R = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(R || {}), S = /* @__PURE__ */ ((E) => (E[E.Reader = 0] = "Reader", E[E.Editor = 1] = "Editor", E[E.Owner = 2] = "Owner", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(S || {}), T = /* @__PURE__ */ ((E) => (E[E.SomeCollaborator = 0] = "SomeCollaborator", E[E.AllCollaborator = 1] = "AllCollaborator", E[E.OneSelf = 2] = "OneSelf", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(T || {});
7174
+ var _ = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(_ || {}), S = /* @__PURE__ */ ((E) => (E[E.Reader = 0] = "Reader", E[E.Editor = 1] = "Editor", E[E.Owner = 2] = "Owner", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(S || {}), G = /* @__PURE__ */ ((E) => (E[E.SomeCollaborator = 0] = "SomeCollaborator", E[E.AllCollaborator = 1] = "AllCollaborator", E[E.OneSelf = 2] = "OneSelf", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(G || {});
7147
7175
  const _UnitModel = class _UnitModel extends Disposable {
7148
7176
  };
7149
7177
  __name(_UnitModel, "UnitModel");
@@ -8697,7 +8725,7 @@ function makeCustomRangeStream(stream) {
8697
8725
  return `${stream}`;
8698
8726
  }
8699
8727
  __name(makeCustomRangeStream, "makeCustomRangeStream");
8700
- var DocStyleType = /* @__PURE__ */ ((DocStyleType2) => (DocStyleType2[DocStyleType2.character = 0] = "character", DocStyleType2[DocStyleType2.paragraph = 1] = "paragraph", DocStyleType2[DocStyleType2.table = 2] = "table", DocStyleType2[DocStyleType2.numbering = 3] = "numbering", DocStyleType2))(DocStyleType || {}), FollowNumberWithType = /* @__PURE__ */ ((FollowNumberWithType2) => (FollowNumberWithType2[FollowNumberWithType2.TAB = 0] = "TAB", FollowNumberWithType2[FollowNumberWithType2.SPACE = 1] = "SPACE", FollowNumberWithType2[FollowNumberWithType2.NOTHING = 2] = "NOTHING", FollowNumberWithType2))(FollowNumberWithType || {}), GlyphType = /* @__PURE__ */ ((GlyphType2) => (GlyphType2[GlyphType2.BULLET = 0] = "BULLET", GlyphType2[GlyphType2.NONE = 1] = "NONE", GlyphType2[GlyphType2.DECIMAL = 2] = "DECIMAL", GlyphType2[GlyphType2.DECIMAL_ZERO = 3] = "DECIMAL_ZERO", GlyphType2[GlyphType2.UPPER_LETTER = 4] = "UPPER_LETTER", GlyphType2[GlyphType2.LOWER_LETTER = 5] = "LOWER_LETTER", GlyphType2[GlyphType2.UPPER_ROMAN = 6] = "UPPER_ROMAN", GlyphType2[GlyphType2.LOWER_ROMAN = 7] = "LOWER_ROMAN", GlyphType2[GlyphType2.ORDINAL = 8] = "ORDINAL", GlyphType2[GlyphType2.CARDINAL_TEXT = 9] = "CARDINAL_TEXT", GlyphType2[GlyphType2.ORDINAL_TEXT = 10] = "ORDINAL_TEXT", GlyphType2[GlyphType2.HEX = 11] = "HEX", GlyphType2[GlyphType2.CHICAGO = 12] = "CHICAGO", GlyphType2[GlyphType2.IDEOGRAPH_DIGITAL = 13] = "IDEOGRAPH_DIGITAL", GlyphType2[GlyphType2.JAPANESE_COUNTING = 14] = "JAPANESE_COUNTING", GlyphType2[GlyphType2.AIUEO = 15] = "AIUEO", GlyphType2[GlyphType2.IROHA = 16] = "IROHA", GlyphType2[GlyphType2.DECIMAL_FULL_WIDTH = 17] = "DECIMAL_FULL_WIDTH", GlyphType2[GlyphType2.DECIMAL_HALF_WIDTH = 18] = "DECIMAL_HALF_WIDTH", GlyphType2[GlyphType2.JAPANESE_LEGAL = 19] = "JAPANESE_LEGAL", GlyphType2[GlyphType2.JAPANESE_DIGITAL_TEN_THOUSAND = 20] = "JAPANESE_DIGITAL_TEN_THOUSAND", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_CIRCLE = 21] = "DECIMAL_ENCLOSED_CIRCLE", GlyphType2[GlyphType2.DECIMAL_FULL_WIDTH2 = 22] = "DECIMAL_FULL_WIDTH2", GlyphType2[GlyphType2.AIUEO_FULL_WIDTH = 23] = "AIUEO_FULL_WIDTH", GlyphType2[GlyphType2.IROHA_FULL_WIDTH = 24] = "IROHA_FULL_WIDTH", GlyphType2[GlyphType2.GANADA = 25] = "GANADA", GlyphType2[GlyphType2.CHOSUNG = 26] = "CHOSUNG", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_FULLSTOP = 27] = "DECIMAL_ENCLOSED_FULLSTOP", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_PAREN = 28] = "DECIMAL_ENCLOSED_PAREN", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_CIRCLE_CHINESE = 29] = "DECIMAL_ENCLOSED_CIRCLE_CHINESE", GlyphType2[GlyphType2.IDEOGRAPH_ENCLOSED_CIRCLE = 30] = "IDEOGRAPH_ENCLOSED_CIRCLE", GlyphType2[GlyphType2.IDEOGRAPH_TRADITIONAL = 31] = "IDEOGRAPH_TRADITIONAL", GlyphType2[GlyphType2.IDEOGRAPH_ZODIAC = 32] = "IDEOGRAPH_ZODIAC", GlyphType2[GlyphType2.IDEOGRAPH_ZODIAC_TRADITIONAL = 33] = "IDEOGRAPH_ZODIAC_TRADITIONAL", GlyphType2[GlyphType2.TAIWANESE_COUNTING = 34] = "TAIWANESE_COUNTING", GlyphType2[GlyphType2.IDEOGRAPH_LEGAL_TRADITIONAL = 35] = "IDEOGRAPH_LEGAL_TRADITIONAL", GlyphType2[GlyphType2.TAIWANESE_COUNTING_THOUSAND = 36] = "TAIWANESE_COUNTING_THOUSAND", GlyphType2[GlyphType2.TAIWANESE_DIGITAL = 37] = "TAIWANESE_DIGITAL", GlyphType2[GlyphType2.CHINESE_COUNTING = 38] = "CHINESE_COUNTING", GlyphType2[GlyphType2.CHINESE_LEGAL_SIMPLIFIED = 39] = "CHINESE_LEGAL_SIMPLIFIED", GlyphType2[GlyphType2.CHINESE_COUNTING_THOUSAND = 40] = "CHINESE_COUNTING_THOUSAND", GlyphType2[GlyphType2.KOREAN_DIGITAL = 41] = "KOREAN_DIGITAL", GlyphType2[GlyphType2.KOREAN_COUNTING = 42] = "KOREAN_COUNTING", GlyphType2[GlyphType2.KOREAN_LEGAL = 43] = "KOREAN_LEGAL", GlyphType2[GlyphType2.KOREAN_DIGITAL2 = 44] = "KOREAN_DIGITAL2", GlyphType2[GlyphType2.VIETNAMESE_COUNTING = 45] = "VIETNAMESE_COUNTING", GlyphType2[GlyphType2.RUSSIAN_LOWER = 46] = "RUSSIAN_LOWER", GlyphType2[GlyphType2.RUSSIAN_UPPER = 47] = "RUSSIAN_UPPER", GlyphType2[GlyphType2.NUMBER_IN_DASH = 48] = "NUMBER_IN_DASH", GlyphType2[GlyphType2.HEBREW1 = 49] = "HEBREW1", GlyphType2[GlyphType2.HEBREW2 = 50] = "HEBREW2", GlyphType2[GlyphType2.ARABIC_ALPHA = 51] = "ARABIC_ALPHA", GlyphType2[GlyphType2.ARABIC_ABJAD = 52] = "ARABIC_ABJAD", GlyphType2[GlyphType2.HINDI_VOWELS = 53] = "HINDI_VOWELS", GlyphType2[GlyphType2.HINDI_CONSONANTS = 54] = "HINDI_CONSONANTS", GlyphType2[GlyphType2.HINDI_NUMBERS = 55] = "HINDI_NUMBERS", GlyphType2[GlyphType2.HINDI_COUNTING = 56] = "HINDI_COUNTING", GlyphType2[GlyphType2.THAI_LETTERS = 57] = "THAI_LETTERS", GlyphType2[GlyphType2.THAI_NUMBERS = 58] = "THAI_NUMBERS", GlyphType2[GlyphType2.THAI_COUNTING = 59] = "THAI_COUNTING", GlyphType2[GlyphType2.CUSTOM = 60] = "CUSTOM", GlyphType2))(GlyphType || {}), BulletAlignment = /* @__PURE__ */ ((BulletAlignment2) => (BulletAlignment2[BulletAlignment2.BULLET_ALIGNMENT_UNSPECIFIED = 0] = "BULLET_ALIGNMENT_UNSPECIFIED", BulletAlignment2[BulletAlignment2.START = 1] = "START", BulletAlignment2[BulletAlignment2.CENTER = 2] = "CENTER", BulletAlignment2[BulletAlignment2.END = 3] = "END", BulletAlignment2[BulletAlignment2.BOTH = 4] = "BOTH", BulletAlignment2))(BulletAlignment || {}), CustomRangeType = /* @__PURE__ */ ((CustomRangeType2) => (CustomRangeType2[CustomRangeType2.HYPERLINK = 0] = "HYPERLINK", CustomRangeType2[CustomRangeType2.FIELD = 1] = "FIELD", CustomRangeType2[CustomRangeType2.SDT = 2] = "SDT", CustomRangeType2[CustomRangeType2.BOOKMARK = 3] = "BOOKMARK", CustomRangeType2[CustomRangeType2.COMMENT = 4] = "COMMENT", CustomRangeType2[CustomRangeType2.CUSTOM = 5] = "CUSTOM", CustomRangeType2[CustomRangeType2.MENTION = 6] = "MENTION", CustomRangeType2[CustomRangeType2.UNI_FORMULA = 7] = "UNI_FORMULA", CustomRangeType2))(CustomRangeType || {}), CustomDecorationType = /* @__PURE__ */ ((CustomDecorationType2) => (CustomDecorationType2[CustomDecorationType2.COMMENT = 0] = "COMMENT", CustomDecorationType2))(CustomDecorationType || {}), BlockType = /* @__PURE__ */ ((BlockType2) => (BlockType2[BlockType2.DRAWING = 0] = "DRAWING", BlockType2[BlockType2.CUSTOM = 1] = "CUSTOM", BlockType2))(BlockType || {}), DocumentFlavor = /* @__PURE__ */ ((DocumentFlavor2) => (DocumentFlavor2[DocumentFlavor2.TRADITIONAL = 0] = "TRADITIONAL", DocumentFlavor2[DocumentFlavor2.MODERN = 1] = "MODERN", DocumentFlavor2))(DocumentFlavor || {}), GridType = /* @__PURE__ */ ((GridType2) => (GridType2[GridType2.DEFAULT = 0] = "DEFAULT", GridType2[GridType2.LINES = 1] = "LINES", GridType2[GridType2.LINES_AND_CHARS = 2] = "LINES_AND_CHARS", GridType2[GridType2.SNAP_TO_CHARS = 3] = "SNAP_TO_CHARS", GridType2))(GridType || {}), SectionType = /* @__PURE__ */ ((SectionType2) => (SectionType2[SectionType2.SECTION_TYPE_UNSPECIFIED = 0] = "SECTION_TYPE_UNSPECIFIED", SectionType2[SectionType2.CONTINUOUS = 1] = "CONTINUOUS", SectionType2[SectionType2.NEXT_PAGE = 2] = "NEXT_PAGE", SectionType2[SectionType2.EVEN_PAGE = 3] = "EVEN_PAGE", SectionType2[SectionType2.ODD_PAGE = 4] = "ODD_PAGE", SectionType2))(SectionType || {}), ColumnSeparatorType = /* @__PURE__ */ ((ColumnSeparatorType2) => (ColumnSeparatorType2[ColumnSeparatorType2.COLUMN_SEPARATOR_STYLE_UNSPECIFIED = 0] = "COLUMN_SEPARATOR_STYLE_UNSPECIFIED", ColumnSeparatorType2[ColumnSeparatorType2.NONE = 1] = "NONE", ColumnSeparatorType2[ColumnSeparatorType2.BETWEEN_EACH_COLUMN = 2] = "BETWEEN_EACH_COLUMN", ColumnSeparatorType2))(ColumnSeparatorType || {}), TextDirectionType = /* @__PURE__ */ ((TextDirectionType2) => (TextDirectionType2[TextDirectionType2.NORMAL = 0] = "NORMAL", TextDirectionType2[TextDirectionType2.TBRL = 1] = "TBRL", TextDirectionType2[TextDirectionType2.LRTBV = 2] = "LRTBV", TextDirectionType2))(TextDirectionType || {}), ParagraphElementType = /* @__PURE__ */ ((ParagraphElementType2) => (ParagraphElementType2[ParagraphElementType2.TEXT_RUN = 0] = "TEXT_RUN", ParagraphElementType2[ParagraphElementType2.AUTO_TEXT = 1] = "AUTO_TEXT", ParagraphElementType2[ParagraphElementType2.PAGE_BREAK = 2] = "PAGE_BREAK", ParagraphElementType2[ParagraphElementType2.COLUMN_BREAK = 3] = "COLUMN_BREAK", ParagraphElementType2[ParagraphElementType2.FOOT_NOTE_REFERENCE = 4] = "FOOT_NOTE_REFERENCE", ParagraphElementType2[ParagraphElementType2.HORIZONTAL_RULE = 5] = "HORIZONTAL_RULE", ParagraphElementType2[ParagraphElementType2.EQUATION = 6] = "EQUATION", ParagraphElementType2[ParagraphElementType2.DRAWING = 7] = "DRAWING", ParagraphElementType2[ParagraphElementType2.PERSON = 8] = "PERSON", ParagraphElementType2[ParagraphElementType2.RICH_LINK = 9] = "RICH_LINK", ParagraphElementType2))(ParagraphElementType || {}), WrapTextType = /* @__PURE__ */ ((WrapTextType2) => (WrapTextType2[WrapTextType2.BOTH_SIDES = 0] = "BOTH_SIDES", WrapTextType2[WrapTextType2.LEFT = 1] = "LEFT", WrapTextType2[WrapTextType2.RIGHT = 2] = "RIGHT", WrapTextType2[WrapTextType2.LARGEST = 3] = "LARGEST", WrapTextType2))(WrapTextType || {}), PositionedObjectLayoutType = /* @__PURE__ */ ((PositionedObjectLayoutType2) => (PositionedObjectLayoutType2[PositionedObjectLayoutType2.INLINE = 0] = "INLINE", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_NONE = 1] = "WRAP_NONE", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_POLYGON = 2] = "WRAP_POLYGON", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_SQUARE = 3] = "WRAP_SQUARE", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_THROUGH = 4] = "WRAP_THROUGH", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_TIGHT = 5] = "WRAP_TIGHT", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_TOP_AND_BOTTOM = 6] = "WRAP_TOP_AND_BOTTOM", PositionedObjectLayoutType2))(PositionedObjectLayoutType || {}), NamedStyleType = /* @__PURE__ */ ((NamedStyleType2) => (NamedStyleType2[NamedStyleType2.NAMED_STYLE_TYPE_UNSPECIFIED = 0] = "NAMED_STYLE_TYPE_UNSPECIFIED", NamedStyleType2[NamedStyleType2.NORMAL_TEXT = 1] = "NORMAL_TEXT", NamedStyleType2[NamedStyleType2.TITLE = 2] = "TITLE", NamedStyleType2[NamedStyleType2.SUBTITLE = 3] = "SUBTITLE", NamedStyleType2[NamedStyleType2.HEADING_1 = 4] = "HEADING_1", NamedStyleType2[NamedStyleType2.HEADING_2 = 5] = "HEADING_2", NamedStyleType2[NamedStyleType2.HEADING_3 = 6] = "HEADING_3", NamedStyleType2[NamedStyleType2.HEADING_4 = 7] = "HEADING_4", NamedStyleType2[NamedStyleType2.HEADING_5 = 8] = "HEADING_5", NamedStyleType2[NamedStyleType2.HEADING_6 = 9] = "HEADING_6", NamedStyleType2))(NamedStyleType || {}), SpacingRule = /* @__PURE__ */ ((SpacingRule2) => (SpacingRule2[SpacingRule2.AUTO = 0] = "AUTO", SpacingRule2[SpacingRule2.AT_LEAST = 1] = "AT_LEAST", SpacingRule2[SpacingRule2.EXACT = 2] = "EXACT", SpacingRule2))(SpacingRule || {}), DashStyleType = /* @__PURE__ */ ((DashStyleType2) => (DashStyleType2[DashStyleType2.DASH_STYLE_UNSPECIFIED = 0] = "DASH_STYLE_UNSPECIFIED", DashStyleType2[DashStyleType2.SOLID = 1] = "SOLID", DashStyleType2[DashStyleType2.DOT = 2] = "DOT", DashStyleType2[DashStyleType2.DASH = 3] = "DASH", DashStyleType2))(DashStyleType || {}), TabStopAlignment = /* @__PURE__ */ ((TabStopAlignment2) => (TabStopAlignment2[TabStopAlignment2.TAB_STOP_ALIGNMENT_UNSPECIFIED = 0] = "TAB_STOP_ALIGNMENT_UNSPECIFIED", TabStopAlignment2[TabStopAlignment2.START = 1] = "START", TabStopAlignment2[TabStopAlignment2.CENTER = 2] = "CENTER", TabStopAlignment2[TabStopAlignment2.END = 3] = "END", TabStopAlignment2))(TabStopAlignment || {}), TableSizeType = /* @__PURE__ */ ((TableSizeType2) => (TableSizeType2[TableSizeType2.UNSPECIFIED = 0] = "UNSPECIFIED", TableSizeType2[TableSizeType2.SPECIFIED = 1] = "SPECIFIED", TableSizeType2))(TableSizeType || {}), TableAlignmentType = /* @__PURE__ */ ((TableAlignmentType2) => (TableAlignmentType2[TableAlignmentType2.START = 0] = "START", TableAlignmentType2[TableAlignmentType2.CENTER = 1] = "CENTER", TableAlignmentType2[TableAlignmentType2.END = 2] = "END", TableAlignmentType2))(TableAlignmentType || {}), TableLayoutType = /* @__PURE__ */ ((TableLayoutType2) => (TableLayoutType2[TableLayoutType2.AUTO_FIT = 0] = "AUTO_FIT", TableLayoutType2[TableLayoutType2.FIXED = 1] = "FIXED", TableLayoutType2))(TableLayoutType || {}), TableTextWrapType = /* @__PURE__ */ ((TableTextWrapType2) => (TableTextWrapType2[TableTextWrapType2.NONE = 0] = "NONE", TableTextWrapType2[TableTextWrapType2.WRAP = 1] = "WRAP", TableTextWrapType2))(TableTextWrapType || {}), TableCellHeightRule = /* @__PURE__ */ ((TableCellHeightRule2) => (TableCellHeightRule2[TableCellHeightRule2.AUTO = 0] = "AUTO", TableCellHeightRule2[TableCellHeightRule2.AT_LEAST = 1] = "AT_LEAST", TableCellHeightRule2[TableCellHeightRule2.EXACT = 2] = "EXACT", TableCellHeightRule2))(TableCellHeightRule || {}), VerticalAlignmentType = /* @__PURE__ */ ((VerticalAlignmentType2) => (VerticalAlignmentType2[VerticalAlignmentType2.CONTENT_ALIGNMENT_UNSPECIFIED = 0] = "CONTENT_ALIGNMENT_UNSPECIFIED", VerticalAlignmentType2[VerticalAlignmentType2.BOTH = 1] = "BOTH", VerticalAlignmentType2[VerticalAlignmentType2.TOP = 2] = "TOP", VerticalAlignmentType2[VerticalAlignmentType2.CENTER = 3] = "CENTER", VerticalAlignmentType2[VerticalAlignmentType2.BOTTOM = 4] = "BOTTOM", VerticalAlignmentType2))(VerticalAlignmentType || {}), FontStyleType = /* @__PURE__ */ ((FontStyleType2) => (FontStyleType2.NORMAL = "normal", FontStyleType2.BOLD = "bold", FontStyleType2.ITALIC = "italic", FontStyleType2))(FontStyleType || {}), ObjectRelativeFromH = /* @__PURE__ */ ((ObjectRelativeFromH2) => (ObjectRelativeFromH2[ObjectRelativeFromH2.PAGE = 0] = "PAGE", ObjectRelativeFromH2[ObjectRelativeFromH2.COLUMN = 1] = "COLUMN", ObjectRelativeFromH2[ObjectRelativeFromH2.CHARACTER = 2] = "CHARACTER", ObjectRelativeFromH2[ObjectRelativeFromH2.MARGIN = 3] = "MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.INSIDE_MARGIN = 4] = "INSIDE_MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.OUTSIDE_MARGIN = 5] = "OUTSIDE_MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.LEFT_MARGIN = 6] = "LEFT_MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.RIGHT_MARGIN = 7] = "RIGHT_MARGIN", ObjectRelativeFromH2))(ObjectRelativeFromH || {}), ObjectRelativeFromV = /* @__PURE__ */ ((ObjectRelativeFromV2) => (ObjectRelativeFromV2[ObjectRelativeFromV2.PAGE = 0] = "PAGE", ObjectRelativeFromV2[ObjectRelativeFromV2.PARAGRAPH = 1] = "PARAGRAPH", ObjectRelativeFromV2[ObjectRelativeFromV2.LINE = 2] = "LINE", ObjectRelativeFromV2[ObjectRelativeFromV2.MARGIN = 3] = "MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.TOP_MARGIN = 4] = "TOP_MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.BOTTOM_MARGIN = 5] = "BOTTOM_MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.INSIDE_MARGIN = 6] = "INSIDE_MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.OUTSIDE_MARGIN = 7] = "OUTSIDE_MARGIN", ObjectRelativeFromV2))(ObjectRelativeFromV || {}), NumberUnitType = /* @__PURE__ */ ((NumberUnitType2) => (NumberUnitType2[NumberUnitType2.POINT = 0] = "POINT", NumberUnitType2[NumberUnitType2.LINE = 1] = "LINE", NumberUnitType2[NumberUnitType2.CHARACTER = 2] = "CHARACTER", NumberUnitType2[NumberUnitType2.PIXEL = 3] = "PIXEL", NumberUnitType2[NumberUnitType2.PERCENT = 4] = "PERCENT", NumberUnitType2))(NumberUnitType || {}), AlignTypeH = /* @__PURE__ */ ((AlignTypeH2) => (AlignTypeH2[AlignTypeH2.CENTER = 0] = "CENTER", AlignTypeH2[AlignTypeH2.INSIDE = 1] = "INSIDE", AlignTypeH2[AlignTypeH2.LEFT = 2] = "LEFT", AlignTypeH2[AlignTypeH2.OUTSIDE = 3] = "OUTSIDE", AlignTypeH2[AlignTypeH2.RIGHT = 4] = "RIGHT", AlignTypeH2[AlignTypeH2.BOTH = 5] = "BOTH", AlignTypeH2[AlignTypeH2.DISTRIBUTE = 6] = "DISTRIBUTE", AlignTypeH2))(AlignTypeH || {}), AlignTypeV = /* @__PURE__ */ ((AlignTypeV2) => (AlignTypeV2[AlignTypeV2.BOTTOM = 0] = "BOTTOM", AlignTypeV2[AlignTypeV2.CENTER = 1] = "CENTER", AlignTypeV2[AlignTypeV2.INSIDE = 2] = "INSIDE", AlignTypeV2[AlignTypeV2.OUTSIDE = 3] = "OUTSIDE", AlignTypeV2[AlignTypeV2.TOP = 4] = "TOP", AlignTypeV2))(AlignTypeV || {}), characterSpacingControlType = /* @__PURE__ */ ((characterSpacingControlType2) => (characterSpacingControlType2[characterSpacingControlType2.compressPunctuation = 0] = "compressPunctuation", characterSpacingControlType2[characterSpacingControlType2.compressPunctuationAndJapaneseKana = 1] = "compressPunctuationAndJapaneseKana", characterSpacingControlType2[characterSpacingControlType2.doNotCompress = 2] = "doNotCompress", characterSpacingControlType2))(characterSpacingControlType || {}), PageOrientType = /* @__PURE__ */ ((PageOrientType2) => (PageOrientType2[PageOrientType2.PORTRAIT = 0] = "PORTRAIT", PageOrientType2[PageOrientType2.LANDSCAPE = 1] = "LANDSCAPE", PageOrientType2))(PageOrientType || {}), ArrangeTypeEnum = /* @__PURE__ */ ((ArrangeTypeEnum2) => (ArrangeTypeEnum2[ArrangeTypeEnum2.forward = 0] = "forward", ArrangeTypeEnum2[ArrangeTypeEnum2.backward = 1] = "backward", ArrangeTypeEnum2[ArrangeTypeEnum2.front = 2] = "front", ArrangeTypeEnum2[ArrangeTypeEnum2.back = 3] = "back", ArrangeTypeEnum2))(ArrangeTypeEnum || {}), DrawingTypeEnum = /* @__PURE__ */ ((DrawingTypeEnum2) => (DrawingTypeEnum2[DrawingTypeEnum2.UNRECOGNIZED = -1] = "UNRECOGNIZED", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_IMAGE = 0] = "DRAWING_IMAGE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_SHAPE = 1] = "DRAWING_SHAPE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_CHART = 2] = "DRAWING_CHART", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_TABLE = 3] = "DRAWING_TABLE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_SMART_ART = 4] = "DRAWING_SMART_ART", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_VIDEO = 5] = "DRAWING_VIDEO", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_GROUP = 6] = "DRAWING_GROUP", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_UNIT = 7] = "DRAWING_UNIT", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_DOM = 8] = "DRAWING_DOM", DrawingTypeEnum2))(DrawingTypeEnum || {}), QuickListType = /* @__PURE__ */ ((QuickListType2) => (QuickListType2.ORDER_LIST_QUICK_1 = "1.", QuickListType2.ORDER_LIST_QUICK_2 = "a)", QuickListType2.ORDER_LIST_QUICK_3 = "a.", QuickListType2.ORDER_LIST_QUICK_4 = "i.", QuickListType2.ORDER_LIST_QUICK_5 = "A.", QuickListType2.ORDER_LIST_QUICK_6 = "I.", QuickListType2.ORDER_LIST_QUICK_7 = "01.", QuickListType2))(QuickListType || {}), PresetListType = /* @__PURE__ */ ((PresetListType2) => (PresetListType2.BULLET_LIST = "BULLET_LIST", PresetListType2.BULLET_LIST_1 = "BULLET_LIST_1", PresetListType2.BULLET_LIST_2 = "BULLET_LIST_2", PresetListType2.BULLET_LIST_3 = "BULLET_LIST_3", PresetListType2.BULLET_LIST_4 = "BULLET_LIST_4", PresetListType2.BULLET_LIST_5 = "BULLET_LIST_5", PresetListType2.ORDER_LIST = "ORDER_LIST", PresetListType2.ORDER_LIST_1 = "ORDER_LIST_1", PresetListType2.ORDER_LIST_2 = "ORDER_LIST_2", PresetListType2.ORDER_LIST_3 = "ORDER_LIST_3", PresetListType2.ORDER_LIST_4 = "ORDER_LIST_4", PresetListType2.ORDER_LIST_5 = "ORDER_LIST_5", PresetListType2.ORDER_LIST_QUICK_2 = "ORDER_LIST_QUICK_2", PresetListType2.ORDER_LIST_QUICK_3 = "ORDER_LIST_QUICK_3", PresetListType2.ORDER_LIST_QUICK_4 = "ORDER_LIST_QUICK_4", PresetListType2.ORDER_LIST_QUICK_5 = "ORDER_LIST_QUICK_5", PresetListType2.ORDER_LIST_QUICK_6 = "ORDER_LIST_QUICK_6", PresetListType2.CHECK_LIST = "CHECK_LIST", PresetListType2.CHECK_LIST_CHECKED = "CHECK_LIST_CHECKED", PresetListType2))(PresetListType || {});
8728
+ var DocStyleType = /* @__PURE__ */ ((DocStyleType2) => (DocStyleType2[DocStyleType2.character = 0] = "character", DocStyleType2[DocStyleType2.paragraph = 1] = "paragraph", DocStyleType2[DocStyleType2.table = 2] = "table", DocStyleType2[DocStyleType2.numbering = 3] = "numbering", DocStyleType2))(DocStyleType || {}), FollowNumberWithType = /* @__PURE__ */ ((FollowNumberWithType2) => (FollowNumberWithType2[FollowNumberWithType2.TAB = 0] = "TAB", FollowNumberWithType2[FollowNumberWithType2.SPACE = 1] = "SPACE", FollowNumberWithType2[FollowNumberWithType2.NOTHING = 2] = "NOTHING", FollowNumberWithType2))(FollowNumberWithType || {}), GlyphType = /* @__PURE__ */ ((GlyphType2) => (GlyphType2[GlyphType2.BULLET = 0] = "BULLET", GlyphType2[GlyphType2.NONE = 1] = "NONE", GlyphType2[GlyphType2.DECIMAL = 2] = "DECIMAL", GlyphType2[GlyphType2.DECIMAL_ZERO = 3] = "DECIMAL_ZERO", GlyphType2[GlyphType2.UPPER_LETTER = 4] = "UPPER_LETTER", GlyphType2[GlyphType2.LOWER_LETTER = 5] = "LOWER_LETTER", GlyphType2[GlyphType2.UPPER_ROMAN = 6] = "UPPER_ROMAN", GlyphType2[GlyphType2.LOWER_ROMAN = 7] = "LOWER_ROMAN", GlyphType2[GlyphType2.ORDINAL = 8] = "ORDINAL", GlyphType2[GlyphType2.CARDINAL_TEXT = 9] = "CARDINAL_TEXT", GlyphType2[GlyphType2.ORDINAL_TEXT = 10] = "ORDINAL_TEXT", GlyphType2[GlyphType2.HEX = 11] = "HEX", GlyphType2[GlyphType2.CHICAGO = 12] = "CHICAGO", GlyphType2[GlyphType2.IDEOGRAPH_DIGITAL = 13] = "IDEOGRAPH_DIGITAL", GlyphType2[GlyphType2.JAPANESE_COUNTING = 14] = "JAPANESE_COUNTING", GlyphType2[GlyphType2.AIUEO = 15] = "AIUEO", GlyphType2[GlyphType2.IROHA = 16] = "IROHA", GlyphType2[GlyphType2.DECIMAL_FULL_WIDTH = 17] = "DECIMAL_FULL_WIDTH", GlyphType2[GlyphType2.DECIMAL_HALF_WIDTH = 18] = "DECIMAL_HALF_WIDTH", GlyphType2[GlyphType2.JAPANESE_LEGAL = 19] = "JAPANESE_LEGAL", GlyphType2[GlyphType2.JAPANESE_DIGITAL_TEN_THOUSAND = 20] = "JAPANESE_DIGITAL_TEN_THOUSAND", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_CIRCLE = 21] = "DECIMAL_ENCLOSED_CIRCLE", GlyphType2[GlyphType2.DECIMAL_FULL_WIDTH2 = 22] = "DECIMAL_FULL_WIDTH2", GlyphType2[GlyphType2.AIUEO_FULL_WIDTH = 23] = "AIUEO_FULL_WIDTH", GlyphType2[GlyphType2.IROHA_FULL_WIDTH = 24] = "IROHA_FULL_WIDTH", GlyphType2[GlyphType2.GANADA = 25] = "GANADA", GlyphType2[GlyphType2.CHOSUNG = 26] = "CHOSUNG", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_FULLSTOP = 27] = "DECIMAL_ENCLOSED_FULLSTOP", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_PAREN = 28] = "DECIMAL_ENCLOSED_PAREN", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_CIRCLE_CHINESE = 29] = "DECIMAL_ENCLOSED_CIRCLE_CHINESE", GlyphType2[GlyphType2.IDEOGRAPH_ENCLOSED_CIRCLE = 30] = "IDEOGRAPH_ENCLOSED_CIRCLE", GlyphType2[GlyphType2.IDEOGRAPH_TRADITIONAL = 31] = "IDEOGRAPH_TRADITIONAL", GlyphType2[GlyphType2.IDEOGRAPH_ZODIAC = 32] = "IDEOGRAPH_ZODIAC", GlyphType2[GlyphType2.IDEOGRAPH_ZODIAC_TRADITIONAL = 33] = "IDEOGRAPH_ZODIAC_TRADITIONAL", GlyphType2[GlyphType2.TAIWANESE_COUNTING = 34] = "TAIWANESE_COUNTING", GlyphType2[GlyphType2.IDEOGRAPH_LEGAL_TRADITIONAL = 35] = "IDEOGRAPH_LEGAL_TRADITIONAL", GlyphType2[GlyphType2.TAIWANESE_COUNTING_THOUSAND = 36] = "TAIWANESE_COUNTING_THOUSAND", GlyphType2[GlyphType2.TAIWANESE_DIGITAL = 37] = "TAIWANESE_DIGITAL", GlyphType2[GlyphType2.CHINESE_COUNTING = 38] = "CHINESE_COUNTING", GlyphType2[GlyphType2.CHINESE_LEGAL_SIMPLIFIED = 39] = "CHINESE_LEGAL_SIMPLIFIED", GlyphType2[GlyphType2.CHINESE_COUNTING_THOUSAND = 40] = "CHINESE_COUNTING_THOUSAND", GlyphType2[GlyphType2.KOREAN_DIGITAL = 41] = "KOREAN_DIGITAL", GlyphType2[GlyphType2.KOREAN_COUNTING = 42] = "KOREAN_COUNTING", GlyphType2[GlyphType2.KOREAN_LEGAL = 43] = "KOREAN_LEGAL", GlyphType2[GlyphType2.KOREAN_DIGITAL2 = 44] = "KOREAN_DIGITAL2", GlyphType2[GlyphType2.VIETNAMESE_COUNTING = 45] = "VIETNAMESE_COUNTING", GlyphType2[GlyphType2.RUSSIAN_LOWER = 46] = "RUSSIAN_LOWER", GlyphType2[GlyphType2.RUSSIAN_UPPER = 47] = "RUSSIAN_UPPER", GlyphType2[GlyphType2.NUMBER_IN_DASH = 48] = "NUMBER_IN_DASH", GlyphType2[GlyphType2.HEBREW1 = 49] = "HEBREW1", GlyphType2[GlyphType2.HEBREW2 = 50] = "HEBREW2", GlyphType2[GlyphType2.ARABIC_ALPHA = 51] = "ARABIC_ALPHA", GlyphType2[GlyphType2.ARABIC_ABJAD = 52] = "ARABIC_ABJAD", GlyphType2[GlyphType2.HINDI_VOWELS = 53] = "HINDI_VOWELS", GlyphType2[GlyphType2.HINDI_CONSONANTS = 54] = "HINDI_CONSONANTS", GlyphType2[GlyphType2.HINDI_NUMBERS = 55] = "HINDI_NUMBERS", GlyphType2[GlyphType2.HINDI_COUNTING = 56] = "HINDI_COUNTING", GlyphType2[GlyphType2.THAI_LETTERS = 57] = "THAI_LETTERS", GlyphType2[GlyphType2.THAI_NUMBERS = 58] = "THAI_NUMBERS", GlyphType2[GlyphType2.THAI_COUNTING = 59] = "THAI_COUNTING", GlyphType2[GlyphType2.CUSTOM = 60] = "CUSTOM", GlyphType2))(GlyphType || {}), BulletAlignment = /* @__PURE__ */ ((BulletAlignment2) => (BulletAlignment2[BulletAlignment2.BULLET_ALIGNMENT_UNSPECIFIED = 0] = "BULLET_ALIGNMENT_UNSPECIFIED", BulletAlignment2[BulletAlignment2.START = 1] = "START", BulletAlignment2[BulletAlignment2.CENTER = 2] = "CENTER", BulletAlignment2[BulletAlignment2.END = 3] = "END", BulletAlignment2[BulletAlignment2.BOTH = 4] = "BOTH", BulletAlignment2))(BulletAlignment || {}), CustomRangeType = /* @__PURE__ */ ((CustomRangeType2) => (CustomRangeType2[CustomRangeType2.HYPERLINK = 0] = "HYPERLINK", CustomRangeType2[CustomRangeType2.FIELD = 1] = "FIELD", CustomRangeType2[CustomRangeType2.SDT = 2] = "SDT", CustomRangeType2[CustomRangeType2.BOOKMARK = 3] = "BOOKMARK", CustomRangeType2[CustomRangeType2.COMMENT = 4] = "COMMENT", CustomRangeType2[CustomRangeType2.CUSTOM = 5] = "CUSTOM", CustomRangeType2[CustomRangeType2.MENTION = 6] = "MENTION", CustomRangeType2[CustomRangeType2.UNI_FORMULA = 7] = "UNI_FORMULA", CustomRangeType2))(CustomRangeType || {}), CustomDecorationType = /* @__PURE__ */ ((CustomDecorationType2) => (CustomDecorationType2[CustomDecorationType2.COMMENT = 0] = "COMMENT", CustomDecorationType2))(CustomDecorationType || {}), BlockType = /* @__PURE__ */ ((BlockType2) => (BlockType2[BlockType2.DRAWING = 0] = "DRAWING", BlockType2[BlockType2.CUSTOM = 1] = "CUSTOM", BlockType2))(BlockType || {}), DocumentFlavor = /* @__PURE__ */ ((DocumentFlavor2) => (DocumentFlavor2[DocumentFlavor2.UNSPECIFIED = 0] = "UNSPECIFIED", DocumentFlavor2[DocumentFlavor2.TRADITIONAL = 1] = "TRADITIONAL", DocumentFlavor2[DocumentFlavor2.MODERN = 2] = "MODERN", DocumentFlavor2))(DocumentFlavor || {}), GridType = /* @__PURE__ */ ((GridType2) => (GridType2[GridType2.DEFAULT = 0] = "DEFAULT", GridType2[GridType2.LINES = 1] = "LINES", GridType2[GridType2.LINES_AND_CHARS = 2] = "LINES_AND_CHARS", GridType2[GridType2.SNAP_TO_CHARS = 3] = "SNAP_TO_CHARS", GridType2))(GridType || {}), SectionType = /* @__PURE__ */ ((SectionType2) => (SectionType2[SectionType2.SECTION_TYPE_UNSPECIFIED = 0] = "SECTION_TYPE_UNSPECIFIED", SectionType2[SectionType2.CONTINUOUS = 1] = "CONTINUOUS", SectionType2[SectionType2.NEXT_PAGE = 2] = "NEXT_PAGE", SectionType2[SectionType2.EVEN_PAGE = 3] = "EVEN_PAGE", SectionType2[SectionType2.ODD_PAGE = 4] = "ODD_PAGE", SectionType2))(SectionType || {}), ColumnSeparatorType = /* @__PURE__ */ ((ColumnSeparatorType2) => (ColumnSeparatorType2[ColumnSeparatorType2.COLUMN_SEPARATOR_STYLE_UNSPECIFIED = 0] = "COLUMN_SEPARATOR_STYLE_UNSPECIFIED", ColumnSeparatorType2[ColumnSeparatorType2.NONE = 1] = "NONE", ColumnSeparatorType2[ColumnSeparatorType2.BETWEEN_EACH_COLUMN = 2] = "BETWEEN_EACH_COLUMN", ColumnSeparatorType2))(ColumnSeparatorType || {}), TextDirectionType = /* @__PURE__ */ ((TextDirectionType2) => (TextDirectionType2[TextDirectionType2.NORMAL = 0] = "NORMAL", TextDirectionType2[TextDirectionType2.TBRL = 1] = "TBRL", TextDirectionType2[TextDirectionType2.LRTBV = 2] = "LRTBV", TextDirectionType2))(TextDirectionType || {}), ParagraphElementType = /* @__PURE__ */ ((ParagraphElementType2) => (ParagraphElementType2[ParagraphElementType2.TEXT_RUN = 0] = "TEXT_RUN", ParagraphElementType2[ParagraphElementType2.AUTO_TEXT = 1] = "AUTO_TEXT", ParagraphElementType2[ParagraphElementType2.PAGE_BREAK = 2] = "PAGE_BREAK", ParagraphElementType2[ParagraphElementType2.COLUMN_BREAK = 3] = "COLUMN_BREAK", ParagraphElementType2[ParagraphElementType2.FOOT_NOTE_REFERENCE = 4] = "FOOT_NOTE_REFERENCE", ParagraphElementType2[ParagraphElementType2.HORIZONTAL_RULE = 5] = "HORIZONTAL_RULE", ParagraphElementType2[ParagraphElementType2.EQUATION = 6] = "EQUATION", ParagraphElementType2[ParagraphElementType2.DRAWING = 7] = "DRAWING", ParagraphElementType2[ParagraphElementType2.PERSON = 8] = "PERSON", ParagraphElementType2[ParagraphElementType2.RICH_LINK = 9] = "RICH_LINK", ParagraphElementType2))(ParagraphElementType || {}), WrapTextType = /* @__PURE__ */ ((WrapTextType2) => (WrapTextType2[WrapTextType2.BOTH_SIDES = 0] = "BOTH_SIDES", WrapTextType2[WrapTextType2.LEFT = 1] = "LEFT", WrapTextType2[WrapTextType2.RIGHT = 2] = "RIGHT", WrapTextType2[WrapTextType2.LARGEST = 3] = "LARGEST", WrapTextType2))(WrapTextType || {}), PositionedObjectLayoutType = /* @__PURE__ */ ((PositionedObjectLayoutType2) => (PositionedObjectLayoutType2[PositionedObjectLayoutType2.INLINE = 0] = "INLINE", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_NONE = 1] = "WRAP_NONE", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_POLYGON = 2] = "WRAP_POLYGON", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_SQUARE = 3] = "WRAP_SQUARE", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_THROUGH = 4] = "WRAP_THROUGH", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_TIGHT = 5] = "WRAP_TIGHT", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_TOP_AND_BOTTOM = 6] = "WRAP_TOP_AND_BOTTOM", PositionedObjectLayoutType2))(PositionedObjectLayoutType || {}), NamedStyleType = /* @__PURE__ */ ((NamedStyleType2) => (NamedStyleType2[NamedStyleType2.NAMED_STYLE_TYPE_UNSPECIFIED = 0] = "NAMED_STYLE_TYPE_UNSPECIFIED", NamedStyleType2[NamedStyleType2.NORMAL_TEXT = 1] = "NORMAL_TEXT", NamedStyleType2[NamedStyleType2.TITLE = 2] = "TITLE", NamedStyleType2[NamedStyleType2.SUBTITLE = 3] = "SUBTITLE", NamedStyleType2[NamedStyleType2.HEADING_1 = 4] = "HEADING_1", NamedStyleType2[NamedStyleType2.HEADING_2 = 5] = "HEADING_2", NamedStyleType2[NamedStyleType2.HEADING_3 = 6] = "HEADING_3", NamedStyleType2[NamedStyleType2.HEADING_4 = 7] = "HEADING_4", NamedStyleType2[NamedStyleType2.HEADING_5 = 8] = "HEADING_5", NamedStyleType2[NamedStyleType2.HEADING_6 = 9] = "HEADING_6", NamedStyleType2))(NamedStyleType || {}), SpacingRule = /* @__PURE__ */ ((SpacingRule2) => (SpacingRule2[SpacingRule2.AUTO = 0] = "AUTO", SpacingRule2[SpacingRule2.AT_LEAST = 1] = "AT_LEAST", SpacingRule2[SpacingRule2.EXACT = 2] = "EXACT", SpacingRule2))(SpacingRule || {}), DashStyleType = /* @__PURE__ */ ((DashStyleType2) => (DashStyleType2[DashStyleType2.DASH_STYLE_UNSPECIFIED = 0] = "DASH_STYLE_UNSPECIFIED", DashStyleType2[DashStyleType2.SOLID = 1] = "SOLID", DashStyleType2[DashStyleType2.DOT = 2] = "DOT", DashStyleType2[DashStyleType2.DASH = 3] = "DASH", DashStyleType2))(DashStyleType || {}), TabStopAlignment = /* @__PURE__ */ ((TabStopAlignment2) => (TabStopAlignment2[TabStopAlignment2.TAB_STOP_ALIGNMENT_UNSPECIFIED = 0] = "TAB_STOP_ALIGNMENT_UNSPECIFIED", TabStopAlignment2[TabStopAlignment2.START = 1] = "START", TabStopAlignment2[TabStopAlignment2.CENTER = 2] = "CENTER", TabStopAlignment2[TabStopAlignment2.END = 3] = "END", TabStopAlignment2))(TabStopAlignment || {}), TableSizeType = /* @__PURE__ */ ((TableSizeType2) => (TableSizeType2[TableSizeType2.UNSPECIFIED = 0] = "UNSPECIFIED", TableSizeType2[TableSizeType2.SPECIFIED = 1] = "SPECIFIED", TableSizeType2))(TableSizeType || {}), TableAlignmentType = /* @__PURE__ */ ((TableAlignmentType2) => (TableAlignmentType2[TableAlignmentType2.START = 0] = "START", TableAlignmentType2[TableAlignmentType2.CENTER = 1] = "CENTER", TableAlignmentType2[TableAlignmentType2.END = 2] = "END", TableAlignmentType2))(TableAlignmentType || {}), TableLayoutType = /* @__PURE__ */ ((TableLayoutType2) => (TableLayoutType2[TableLayoutType2.AUTO_FIT = 0] = "AUTO_FIT", TableLayoutType2[TableLayoutType2.FIXED = 1] = "FIXED", TableLayoutType2))(TableLayoutType || {}), TableTextWrapType = /* @__PURE__ */ ((TableTextWrapType2) => (TableTextWrapType2[TableTextWrapType2.NONE = 0] = "NONE", TableTextWrapType2[TableTextWrapType2.WRAP = 1] = "WRAP", TableTextWrapType2))(TableTextWrapType || {}), TableCellHeightRule = /* @__PURE__ */ ((TableCellHeightRule2) => (TableCellHeightRule2[TableCellHeightRule2.AUTO = 0] = "AUTO", TableCellHeightRule2[TableCellHeightRule2.AT_LEAST = 1] = "AT_LEAST", TableCellHeightRule2[TableCellHeightRule2.EXACT = 2] = "EXACT", TableCellHeightRule2))(TableCellHeightRule || {}), VerticalAlignmentType = /* @__PURE__ */ ((VerticalAlignmentType2) => (VerticalAlignmentType2[VerticalAlignmentType2.CONTENT_ALIGNMENT_UNSPECIFIED = 0] = "CONTENT_ALIGNMENT_UNSPECIFIED", VerticalAlignmentType2[VerticalAlignmentType2.BOTH = 1] = "BOTH", VerticalAlignmentType2[VerticalAlignmentType2.TOP = 2] = "TOP", VerticalAlignmentType2[VerticalAlignmentType2.CENTER = 3] = "CENTER", VerticalAlignmentType2[VerticalAlignmentType2.BOTTOM = 4] = "BOTTOM", VerticalAlignmentType2))(VerticalAlignmentType || {}), FontStyleType = /* @__PURE__ */ ((FontStyleType2) => (FontStyleType2.NORMAL = "normal", FontStyleType2.BOLD = "bold", FontStyleType2.ITALIC = "italic", FontStyleType2))(FontStyleType || {}), ObjectRelativeFromH = /* @__PURE__ */ ((ObjectRelativeFromH2) => (ObjectRelativeFromH2[ObjectRelativeFromH2.PAGE = 0] = "PAGE", ObjectRelativeFromH2[ObjectRelativeFromH2.COLUMN = 1] = "COLUMN", ObjectRelativeFromH2[ObjectRelativeFromH2.CHARACTER = 2] = "CHARACTER", ObjectRelativeFromH2[ObjectRelativeFromH2.MARGIN = 3] = "MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.INSIDE_MARGIN = 4] = "INSIDE_MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.OUTSIDE_MARGIN = 5] = "OUTSIDE_MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.LEFT_MARGIN = 6] = "LEFT_MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.RIGHT_MARGIN = 7] = "RIGHT_MARGIN", ObjectRelativeFromH2))(ObjectRelativeFromH || {}), ObjectRelativeFromV = /* @__PURE__ */ ((ObjectRelativeFromV2) => (ObjectRelativeFromV2[ObjectRelativeFromV2.PAGE = 0] = "PAGE", ObjectRelativeFromV2[ObjectRelativeFromV2.PARAGRAPH = 1] = "PARAGRAPH", ObjectRelativeFromV2[ObjectRelativeFromV2.LINE = 2] = "LINE", ObjectRelativeFromV2[ObjectRelativeFromV2.MARGIN = 3] = "MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.TOP_MARGIN = 4] = "TOP_MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.BOTTOM_MARGIN = 5] = "BOTTOM_MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.INSIDE_MARGIN = 6] = "INSIDE_MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.OUTSIDE_MARGIN = 7] = "OUTSIDE_MARGIN", ObjectRelativeFromV2))(ObjectRelativeFromV || {}), NumberUnitType = /* @__PURE__ */ ((NumberUnitType2) => (NumberUnitType2[NumberUnitType2.POINT = 0] = "POINT", NumberUnitType2[NumberUnitType2.LINE = 1] = "LINE", NumberUnitType2[NumberUnitType2.CHARACTER = 2] = "CHARACTER", NumberUnitType2[NumberUnitType2.PIXEL = 3] = "PIXEL", NumberUnitType2[NumberUnitType2.PERCENT = 4] = "PERCENT", NumberUnitType2))(NumberUnitType || {}), AlignTypeH = /* @__PURE__ */ ((AlignTypeH2) => (AlignTypeH2[AlignTypeH2.CENTER = 0] = "CENTER", AlignTypeH2[AlignTypeH2.INSIDE = 1] = "INSIDE", AlignTypeH2[AlignTypeH2.LEFT = 2] = "LEFT", AlignTypeH2[AlignTypeH2.OUTSIDE = 3] = "OUTSIDE", AlignTypeH2[AlignTypeH2.RIGHT = 4] = "RIGHT", AlignTypeH2[AlignTypeH2.BOTH = 5] = "BOTH", AlignTypeH2[AlignTypeH2.DISTRIBUTE = 6] = "DISTRIBUTE", AlignTypeH2))(AlignTypeH || {}), AlignTypeV = /* @__PURE__ */ ((AlignTypeV2) => (AlignTypeV2[AlignTypeV2.BOTTOM = 0] = "BOTTOM", AlignTypeV2[AlignTypeV2.CENTER = 1] = "CENTER", AlignTypeV2[AlignTypeV2.INSIDE = 2] = "INSIDE", AlignTypeV2[AlignTypeV2.OUTSIDE = 3] = "OUTSIDE", AlignTypeV2[AlignTypeV2.TOP = 4] = "TOP", AlignTypeV2))(AlignTypeV || {}), characterSpacingControlType = /* @__PURE__ */ ((characterSpacingControlType2) => (characterSpacingControlType2[characterSpacingControlType2.compressPunctuation = 0] = "compressPunctuation", characterSpacingControlType2[characterSpacingControlType2.compressPunctuationAndJapaneseKana = 1] = "compressPunctuationAndJapaneseKana", characterSpacingControlType2[characterSpacingControlType2.doNotCompress = 2] = "doNotCompress", characterSpacingControlType2))(characterSpacingControlType || {}), PageOrientType = /* @__PURE__ */ ((PageOrientType2) => (PageOrientType2[PageOrientType2.PORTRAIT = 0] = "PORTRAIT", PageOrientType2[PageOrientType2.LANDSCAPE = 1] = "LANDSCAPE", PageOrientType2))(PageOrientType || {}), ArrangeTypeEnum = /* @__PURE__ */ ((ArrangeTypeEnum2) => (ArrangeTypeEnum2[ArrangeTypeEnum2.forward = 0] = "forward", ArrangeTypeEnum2[ArrangeTypeEnum2.backward = 1] = "backward", ArrangeTypeEnum2[ArrangeTypeEnum2.front = 2] = "front", ArrangeTypeEnum2[ArrangeTypeEnum2.back = 3] = "back", ArrangeTypeEnum2))(ArrangeTypeEnum || {}), DrawingTypeEnum = /* @__PURE__ */ ((DrawingTypeEnum2) => (DrawingTypeEnum2[DrawingTypeEnum2.UNRECOGNIZED = -1] = "UNRECOGNIZED", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_IMAGE = 0] = "DRAWING_IMAGE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_SHAPE = 1] = "DRAWING_SHAPE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_CHART = 2] = "DRAWING_CHART", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_TABLE = 3] = "DRAWING_TABLE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_SMART_ART = 4] = "DRAWING_SMART_ART", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_VIDEO = 5] = "DRAWING_VIDEO", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_GROUP = 6] = "DRAWING_GROUP", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_UNIT = 7] = "DRAWING_UNIT", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_DOM = 8] = "DRAWING_DOM", DrawingTypeEnum2))(DrawingTypeEnum || {}), QuickListType = /* @__PURE__ */ ((QuickListType2) => (QuickListType2.ORDER_LIST_QUICK_1 = "1.", QuickListType2.ORDER_LIST_QUICK_2 = "a)", QuickListType2.ORDER_LIST_QUICK_3 = "a.", QuickListType2.ORDER_LIST_QUICK_4 = "i.", QuickListType2.ORDER_LIST_QUICK_5 = "A.", QuickListType2.ORDER_LIST_QUICK_6 = "I.", QuickListType2.ORDER_LIST_QUICK_7 = "01.", QuickListType2))(QuickListType || {}), PresetListType = /* @__PURE__ */ ((PresetListType2) => (PresetListType2.BULLET_LIST = "BULLET_LIST", PresetListType2.BULLET_LIST_1 = "BULLET_LIST_1", PresetListType2.BULLET_LIST_2 = "BULLET_LIST_2", PresetListType2.BULLET_LIST_3 = "BULLET_LIST_3", PresetListType2.BULLET_LIST_4 = "BULLET_LIST_4", PresetListType2.BULLET_LIST_5 = "BULLET_LIST_5", PresetListType2.ORDER_LIST = "ORDER_LIST", PresetListType2.ORDER_LIST_1 = "ORDER_LIST_1", PresetListType2.ORDER_LIST_2 = "ORDER_LIST_2", PresetListType2.ORDER_LIST_3 = "ORDER_LIST_3", PresetListType2.ORDER_LIST_4 = "ORDER_LIST_4", PresetListType2.ORDER_LIST_5 = "ORDER_LIST_5", PresetListType2.ORDER_LIST_QUICK_2 = "ORDER_LIST_QUICK_2", PresetListType2.ORDER_LIST_QUICK_3 = "ORDER_LIST_QUICK_3", PresetListType2.ORDER_LIST_QUICK_4 = "ORDER_LIST_QUICK_4", PresetListType2.ORDER_LIST_QUICK_5 = "ORDER_LIST_QUICK_5", PresetListType2.ORDER_LIST_QUICK_6 = "ORDER_LIST_QUICK_6", PresetListType2.CHECK_LIST = "CHECK_LIST", PresetListType2.CHECK_LIST_CHECKED = "CHECK_LIST_CHECKED", PresetListType2))(PresetListType || {});
8701
8729
  const orderListSymbolMap = {
8702
8730
  "a)": { glyphFormat: "%1)", glyphType: GlyphType.DECIMAL },
8703
8731
  "1.": { glyphFormat: "%1.", glyphType: GlyphType.DECIMAL },
@@ -8732,7 +8760,7 @@ const orderListSymbolMap = {
8732
8760
  hanging: { v: 21 },
8733
8761
  indentStart: { v: 21 * i }
8734
8762
  }
8735
- })), "orderListFactory"), checkListFactory = /* @__PURE__ */ __name((symbol, textStyle) => new Array(9).fill(0).map((_, i) => ({
8763
+ })), "orderListFactory"), checkListFactory = /* @__PURE__ */ __name((symbol, textStyle) => new Array(9).fill(0).map((_2, i) => ({
8736
8764
  glyphFormat: ` %${i + 1}`,
8737
8765
  glyphSymbol: symbol,
8738
8766
  bulletAlignment: BulletAlignment.START,
@@ -8902,8 +8930,8 @@ const QuickListTypeMap = {
8902
8930
  function normalizeTextRuns(textRuns) {
8903
8931
  const results = [];
8904
8932
  for (const textRun of textRuns) {
8905
- const { ed, ts } = textRun;
8906
- if (textRun.sId === void 0 && delete textRun.sId, Tools.isEmptyObject(ts) && textRun.sId == null)
8933
+ const { st, ed, ts } = textRun;
8934
+ if (textRun.sId === void 0 && delete textRun.sId, st === ed || Tools.isEmptyObject(ts) && textRun.sId == null)
8907
8935
  continue;
8908
8936
  if (results.length === 0) {
8909
8937
  results.push(textRun);
@@ -8931,36 +8959,22 @@ function insertTextRuns(body, insertBody, textLength, currentIndex) {
8931
8959
  for (const insertTextRun of insertTextRuns2)
8932
8960
  insertTextRun.st += currentIndex, insertTextRun.ed += currentIndex;
8933
8961
  for (let i = 0; i < len; i++) {
8934
- const textRun = textRuns[i], nextRun = textRuns[i + 1], { st, ed } = textRun;
8935
- if (ed < currentIndex)
8962
+ const textRun = textRuns[i], { st, ed } = textRun;
8963
+ if (ed <= currentIndex)
8936
8964
  newTextRuns.push(textRun);
8937
- else if (currentIndex >= st && currentIndex <= ed) {
8938
- if (nextRun && nextRun.st === nextRun.ed && currentIndex === nextRun.st) {
8939
- newTextRuns.push(textRun);
8940
- continue;
8941
- }
8942
- if (hasInserted)
8943
- textRun.st += textLength, textRun.ed += textLength, newTextRuns.push(textRun);
8944
- else {
8945
- hasInserted = !0, textRun.ed += textLength;
8946
- const pendingTextRuns = [];
8947
- if (insertTextRuns2.length) {
8948
- const startSplitTextRun = {
8949
- ...textRun,
8950
- st,
8951
- ed: insertTextRuns2[0].st
8952
- };
8953
- startSplitTextRun.ed > startSplitTextRun.st && pendingTextRuns.push(startSplitTextRun), pendingTextRuns.push(...insertTextRuns2);
8954
- const lastInsertTextRuns = insertTextRuns2[insertTextRuns2.length - 1], endSplitTextRun = {
8955
- ...textRun,
8956
- st: lastInsertTextRuns.ed,
8957
- ed: ed + textLength
8958
- };
8959
- endSplitTextRun.ed > endSplitTextRun.st && pendingTextRuns.push(endSplitTextRun);
8960
- } else
8961
- pendingTextRuns.push(textRun);
8962
- newTextRuns.push(...pendingTextRuns);
8963
- }
8965
+ else if (currentIndex > st && currentIndex < ed) {
8966
+ hasInserted = !0;
8967
+ const firstSplitTextRun = {
8968
+ ...textRun,
8969
+ ed: currentIndex
8970
+ };
8971
+ newTextRuns.push(firstSplitTextRun), insertTextRuns2.length && newTextRuns.push(...insertTextRuns2);
8972
+ const lastSplitTextRun = {
8973
+ ...textRun,
8974
+ st: currentIndex + textLength,
8975
+ ed: ed + textLength
8976
+ };
8977
+ newTextRuns.push(lastSplitTextRun);
8964
8978
  } else
8965
8979
  textRun.st += textLength, textRun.ed += textLength, hasInserted || (hasInserted = !0, newTextRuns.push(...insertTextRuns2)), newTextRuns.push(textRun);
8966
8980
  }
@@ -9119,30 +9133,19 @@ function insertCustomDecorations(body, insertBody, textLength, currentIndex) {
9119
9133
  }
9120
9134
  __name(insertCustomDecorations, "insertCustomDecorations");
9121
9135
  function deleteTextRuns(body, textLength, currentIndex) {
9122
- var _a11;
9123
9136
  const { textRuns } = body, startIndex = currentIndex, endIndex = currentIndex + textLength, removeTextRuns = [];
9124
- if (startIndex === endIndex && (textRuns != null && textRuns.find((t) => t.st === currentIndex && t.ed === currentIndex))) {
9125
- const textRun = textRuns.find((t) => t.st === currentIndex && t.ed === currentIndex);
9126
- return removeTextRuns.push({
9127
- ...textRun,
9128
- st: textRun.st - currentIndex,
9129
- ed: textRun.ed - currentIndex
9130
- }), body.textRuns = (_a11 = body.textRuns) == null ? void 0 : _a11.filter((t) => t !== textRun), removeTextRuns;
9131
- }
9132
9137
  if (textRuns) {
9133
9138
  const newTextRuns = [];
9134
9139
  for (let i = 0, len = textRuns.length; i < len; i++) {
9135
9140
  const textRun = textRuns[i], { st, ed } = textRun;
9136
- if (startIndex <= st && endIndex >= ed)
9137
- if (removeTextRuns.push({
9141
+ if (startIndex <= st && endIndex >= ed) {
9142
+ removeTextRuns.push({
9138
9143
  ...textRun,
9139
9144
  st: st - startIndex,
9140
9145
  ed: ed - startIndex
9141
- }), startIndex === st)
9142
- textRun.ed = st;
9143
- else
9144
- continue;
9145
- else st <= startIndex && ed >= endIndex ? (removeTextRuns.push({
9146
+ });
9147
+ continue;
9148
+ } else st <= startIndex && ed >= endIndex ? (removeTextRuns.push({
9146
9149
  ...textRun,
9147
9150
  st: startIndex - startIndex,
9148
9151
  ed: endIndex - startIndex
@@ -9687,8 +9690,8 @@ function isUselessRetainAction(action) {
9687
9690
  const { body } = action;
9688
9691
  if (body == null)
9689
9692
  return !0;
9690
- const { textRuns = [], paragraphs = [] } = body;
9691
- return textRuns.length === 0 && paragraphs.length === 0;
9693
+ const { textRuns = [], paragraphs = [], customRanges = [], customBlocks = [], customDecorations = [] } = body;
9694
+ return textRuns.length === 0 && paragraphs.length === 0 && customRanges.length === 0 && customBlocks.length === 0 && customDecorations.length === 0;
9692
9695
  }
9693
9696
  __name(isUselessRetainAction, "isUselessRetainAction");
9694
9697
  const _ActionIterator = class _ActionIterator {
@@ -9849,7 +9852,15 @@ function transformTextRuns(originTextRuns, targetTextRuns, transformType) {
9849
9852
  return tempTopTextRun.ed !== Math.max(updateLastTextRun.ed, removeLastTextRun.ed) && (updateLastTextRun.ed > removeLastTextRun.ed ? newUpdateTextRuns.push(updateLastTextRun) : newUpdateTextRuns.push(removeLastTextRun)), normalizeTextRuns(newUpdateTextRuns);
9850
9853
  }
9851
9854
  __name(transformTextRuns, "transformTextRuns");
9852
- function transformParagraph(originParagraph, targetParagraph, transformType) {
9855
+ function transformCustomRanges(originCustomRanges, targetCustomRanges, transformType, coverType = UpdateDocsAttributeType.COVER) {
9856
+ if (originCustomRanges.length === 0)
9857
+ return Tools.deepClone(targetCustomRanges);
9858
+ if (coverType === UpdateDocsAttributeType.REPLACE)
9859
+ return transformType === 1 ? Tools.deepClone(originCustomRanges) : Tools.deepClone(targetCustomRanges);
9860
+ throw new Error("CustomRanges is only supported in replace mode.");
9861
+ }
9862
+ __name(transformCustomRanges, "transformCustomRanges");
9863
+ function transformParagraph(originParagraph, targetParagraph, transformType, coverType = UpdateDocsAttributeType.COVER) {
9853
9864
  const paragraph = {
9854
9865
  startIndex: targetParagraph.startIndex
9855
9866
  };
@@ -9858,6 +9869,8 @@ function transformParagraph(originParagraph, targetParagraph, transformType) {
9858
9869
  paragraph.paragraphStyle = {
9859
9870
  ...targetParagraph.paragraphStyle
9860
9871
  };
9872
+ else if (coverType === UpdateDocsAttributeType.REPLACE)
9873
+ paragraph.paragraphStyle = transformType === 1 ? { ...originParagraph.paragraphStyle } : { ...targetParagraph.paragraphStyle };
9861
9874
  else if (paragraph.paragraphStyle = {
9862
9875
  ...targetParagraph.paragraphStyle
9863
9876
  }, transformType === 1) {
@@ -9866,18 +9879,27 @@ function transformParagraph(originParagraph, targetParagraph, transformType) {
9866
9879
  paragraph.paragraphStyle[key] && delete paragraph.paragraphStyle[key];
9867
9880
  }
9868
9881
  }
9869
- return targetParagraph.bullet && (originParagraph.bullet == null || transformType === 0) && (paragraph.bullet = {
9870
- ...targetParagraph.bullet
9871
- }), paragraph;
9882
+ if (targetParagraph.bullet)
9883
+ if (originParagraph.bullet == null)
9884
+ paragraph.bullet = {
9885
+ ...targetParagraph.bullet
9886
+ };
9887
+ else if (coverType === UpdateDocsAttributeType.REPLACE)
9888
+ paragraph.bullet = transformType === 1 ? { ...originParagraph.bullet } : { ...targetParagraph.bullet };
9889
+ else
9890
+ throw new Error("Bullet is only supported in replace mode.");
9891
+ return paragraph;
9872
9892
  }
9873
9893
  __name(transformParagraph, "transformParagraph");
9874
9894
  function transformBody(thisAction, otherAction, priority = !1) {
9875
- const { body: thisBody } = thisAction, { body: otherBody } = otherAction;
9895
+ const { body: thisBody, coverType: thisCoverType } = thisAction, { body: otherBody, coverType: otherCoverType } = otherAction;
9876
9896
  if (thisBody == null || thisBody.dataStream !== "" || otherBody == null || otherBody.dataStream !== "")
9877
- throw new Error("Data stream is not supported in transform.");
9897
+ throw new Error("Data stream is not supported in retain transform.");
9898
+ if (thisCoverType !== otherCoverType)
9899
+ throw new Error("Cover type is not consistent.");
9878
9900
  const retBody = {
9879
9901
  dataStream: ""
9880
- }, { textRuns: thisTextRuns = [], paragraphs: thisParagraphs = [] } = thisBody, { textRuns: otherTextRuns = [], paragraphs: otherParagraphs = [] } = otherBody;
9902
+ }, { textRuns: thisTextRuns = [], paragraphs: thisParagraphs = [], customRanges: thisCustomRanges = [] } = thisBody, { textRuns: otherTextRuns = [], paragraphs: otherParagraphs = [], customRanges: otherCustomRanges = [] } = otherBody;
9881
9903
  let textRuns = [];
9882
9904
  priority ? textRuns = transformTextRuns(
9883
9905
  thisTextRuns,
@@ -9890,6 +9912,8 @@ function transformBody(thisAction, otherAction, priority = !1) {
9890
9912
  0
9891
9913
  /* COVER */
9892
9914
  ), textRuns.length && (retBody.textRuns = textRuns);
9915
+ let customRanges = [];
9916
+ priority ? customRanges = transformCustomRanges(thisCustomRanges, otherCustomRanges, 1, thisCoverType) : customRanges = transformCustomRanges(thisCustomRanges, otherCustomRanges, 0, thisCoverType), customRanges.length && (retBody.customRanges = customRanges);
9893
9917
  const paragraphs = [];
9894
9918
  let thisIndex = 0, otherIndex = 0;
9895
9919
  for (; thisIndex < thisParagraphs.length && otherIndex < otherParagraphs.length; ) {
@@ -9901,14 +9925,9 @@ function transformBody(thisAction, otherAction, priority = !1) {
9901
9925
  priority ? paragraph = transformParagraph(
9902
9926
  thisParagraph,
9903
9927
  otherParagraph,
9904
- 1
9905
- /* COVER_ONLY_NOT_EXISTED */
9906
- ) : paragraph = transformParagraph(
9907
- thisParagraph,
9908
- otherParagraph,
9909
- 0
9910
- /* COVER */
9911
- ), paragraphs.push(paragraph), thisIndex++, otherIndex++;
9928
+ 1,
9929
+ thisCoverType
9930
+ ) : paragraph = transformParagraph(thisParagraph, otherParagraph, 0, thisCoverType), paragraphs.push(paragraph), thisIndex++, otherIndex++;
9912
9931
  } else thisStart < otherStart ? thisIndex++ : (paragraphs.push(Tools.deepClone(otherParagraph)), otherIndex++);
9913
9932
  }
9914
9933
  return otherIndex < otherParagraphs.length && paragraphs.push(...otherParagraphs.slice(otherIndex)), paragraphs.length && (retBody.paragraphs = paragraphs), retBody;
@@ -9969,16 +9988,16 @@ const _TextX = class _TextX {
9969
9988
  * 2) If the other body property exists, then execute the TransformBody logic to override it
9970
9989
  */
9971
9990
  // priority - if true, this actions takes priority over other, that is, this actions are considered to happen "first".
9991
+ // thisActions is the target action.
9972
9992
  static transform(thisActions, otherActions, priority = "right") {
9973
9993
  return this._transform(otherActions, thisActions, priority === "left" ? "right" : "left");
9974
9994
  }
9975
9995
  static _transform(thisActions, otherActions, priority = "right") {
9976
- var _a11;
9977
9996
  const thisIter = new ActionIterator(thisActions), otherIter = new ActionIterator(otherActions), textX = new _TextX();
9978
9997
  for (; thisIter.hasNext() || otherIter.hasNext(); )
9979
9998
  if (thisIter.peekType() === TextXActionType.INSERT && (priority === "left" || otherIter.peekType() !== TextXActionType.INSERT)) {
9980
9999
  const thisAction = thisIter.next();
9981
- textX.retain(thisAction.len, (_a11 = thisAction.segmentId) != null ? _a11 : "");
10000
+ textX.retain(thisAction.len);
9982
10001
  } else if (otherIter.peekType() === TextXActionType.INSERT)
9983
10002
  textX.push(otherIter.next());
9984
10003
  else {
@@ -10023,10 +10042,7 @@ const _TextX = class _TextX {
10023
10042
  invertedActions.push({
10024
10043
  t: TextXActionType.DELETE,
10025
10044
  len: action.len,
10026
- line: 0,
10027
- // hardcode
10028
- body: action.body,
10029
- segmentId: action.segmentId
10045
+ body: action.body
10030
10046
  });
10031
10047
  else if (action.t === TextXActionType.DELETE) {
10032
10048
  if (action.body == null)
@@ -10034,10 +10050,7 @@ const _TextX = class _TextX {
10034
10050
  invertedActions.push({
10035
10051
  t: TextXActionType.INSERT,
10036
10052
  body: action.body,
10037
- len: action.len,
10038
- line: 0,
10039
- // hardcode
10040
- segmentId: action.segmentId
10053
+ len: action.len
10041
10054
  });
10042
10055
  } else if (action.body != null) {
10043
10056
  if (action.oldBody == null)
@@ -10047,8 +10060,7 @@ const _TextX = class _TextX {
10047
10060
  body: action.oldBody,
10048
10061
  oldBody: action.body,
10049
10062
  len: action.len,
10050
- coverType: UpdateDocsAttributeType.REPLACE,
10051
- segmentId: action.segmentId
10063
+ coverType: UpdateDocsAttributeType.REPLACE
10052
10064
  });
10053
10065
  } else
10054
10066
  invertedActions.push(action);
@@ -10073,32 +10085,25 @@ const _TextX = class _TextX {
10073
10085
  }
10074
10086
  return invertibleActions;
10075
10087
  }
10076
- insert(len, body, segmentId = "") {
10088
+ insert(len, body) {
10077
10089
  const insertAction = {
10078
10090
  t: TextXActionType.INSERT,
10079
10091
  body,
10080
- len,
10081
- line: 0,
10082
- // hardcode
10083
- segmentId
10092
+ len
10084
10093
  };
10085
10094
  return this.push(insertAction), this;
10086
10095
  }
10087
- retain(len, segmentId = "", body, coverType) {
10096
+ retain(len, body, coverType) {
10088
10097
  const retainAction = {
10089
10098
  t: TextXActionType.RETAIN,
10090
- len,
10091
- segmentId
10099
+ len
10092
10100
  };
10093
10101
  return body != null && (retainAction.body = body), coverType != null && (retainAction.coverType = coverType), this.push(retainAction), this;
10094
10102
  }
10095
- delete(len, segmentId = "") {
10103
+ delete(len) {
10096
10104
  const deleteAction = {
10097
10105
  t: TextXActionType.DELETE,
10098
- len,
10099
- line: 0,
10100
- // hardcode
10101
- segmentId
10106
+ len
10102
10107
  };
10103
10108
  return this.push(deleteAction), this;
10104
10109
  }
@@ -10202,7 +10207,7 @@ const DEFAULT_DOC = {
10202
10207
  constructor(snapshot) {
10203
10208
  var _a11;
10204
10209
  super();
10205
- __publicField(this, "type", R.UNIVER_DOC);
10210
+ __publicField(this, "type", _.UNIVER_DOC);
10206
10211
  __publicField(this, "_name$", new BehaviorSubject(""));
10207
10212
  __publicField(this, "name$", this._name$.asObservable());
10208
10213
  __publicField(this, "snapshot");
@@ -10403,15 +10408,15 @@ function shouldDeleteCustomRange(deleteStart, deleteLen, customRange, dataStream
10403
10408
  return !0;
10404
10409
  }
10405
10410
  __name(shouldDeleteCustomRange, "shouldDeleteCustomRange");
10406
- function getCustomRangesInterestsWithRange(range, customRanges) {
10411
+ function getCustomRangesInterestsWithSelection(range, customRanges) {
10407
10412
  const result = [];
10408
10413
  for (let i = 0, len = customRanges.length; i < len; i++) {
10409
10414
  const customRange = customRanges[i];
10410
- range.collapsed ? customRange.startIndex < range.startOffset && range.startOffset <= customRange.endIndex && result.push(customRange) : isIntersecting(range.startOffset, range.endOffset, customRange.startIndex, customRange.endIndex) && result.push(customRange);
10415
+ range.collapsed ? customRange.startIndex < range.startOffset && range.startOffset <= customRange.endIndex && result.push(customRange) : isIntersecting(range.startOffset, range.endOffset - 1, customRange.startIndex, customRange.endIndex) && result.push(customRange);
10411
10416
  }
10412
10417
  return result;
10413
10418
  }
10414
- __name(getCustomRangesInterestsWithRange, "getCustomRangesInterestsWithRange");
10419
+ __name(getCustomRangesInterestsWithSelection, "getCustomRangesInterestsWithSelection");
10415
10420
  function copyCustomRange(range) {
10416
10421
  return {
10417
10422
  ...Tools.deepClone(range),
@@ -10447,8 +10452,7 @@ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
10447
10452
  const { startIndex, paragraphStyle = {}, bullet } = paragraph;
10448
10453
  textX.push({
10449
10454
  t: TextXActionType.RETAIN,
10450
- len: startIndex - memoryCursor.cursor,
10451
- segmentId
10455
+ len: startIndex - memoryCursor.cursor
10452
10456
  }), textX.push({
10453
10457
  t: TextXActionType.RETAIN,
10454
10458
  len: 1,
@@ -10474,7 +10478,6 @@ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
10474
10478
  }
10475
10479
  ]
10476
10480
  },
10477
- segmentId,
10478
10481
  coverType: UpdateDocsAttributeType.REPLACE
10479
10482
  }), memoryCursor.moveCursorTo(startIndex + 1);
10480
10483
  }
@@ -10492,8 +10495,7 @@ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
10492
10495
  const textX = new TextX(), { startIndex, paragraphStyle = {} } = currentParagraph, listType = currentParagraph.bullet.listType === PresetListType.CHECK_LIST ? PresetListType.CHECK_LIST_CHECKED : PresetListType.CHECK_LIST;
10493
10496
  return textX.push({
10494
10497
  t: TextXActionType.RETAIN,
10495
- len: startIndex - memoryCursor.cursor,
10496
- segmentId
10498
+ len: startIndex - memoryCursor.cursor
10497
10499
  }), textX.push({
10498
10500
  t: TextXActionType.RETAIN,
10499
10501
  len: 1,
@@ -10511,8 +10513,7 @@ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
10511
10513
  }
10512
10514
  ]
10513
10515
  },
10514
- coverType: UpdateDocsAttributeType.REPLACE,
10515
- segmentId
10516
+ coverType: UpdateDocsAttributeType.REPLACE
10516
10517
  }), memoryCursor.moveCursorTo(startIndex + 1), textX;
10517
10518
  }, "toggleChecklistParagraph"), setParagraphBullet = /* @__PURE__ */ __name((params) => {
10518
10519
  var _a11, _b2;
@@ -10526,8 +10527,7 @@ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
10526
10527
  const { startIndex, paragraphStyle = {}, bullet } = paragraph;
10527
10528
  textX.push({
10528
10529
  t: TextXActionType.RETAIN,
10529
- len: startIndex - memoryCursor.cursor,
10530
- segmentId
10530
+ len: startIndex - memoryCursor.cursor
10531
10531
  }), textX.push({
10532
10532
  t: TextXActionType.RETAIN,
10533
10533
  len: 1,
@@ -10548,7 +10548,6 @@ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
10548
10548
  }
10549
10549
  ]
10550
10550
  },
10551
- segmentId,
10552
10551
  coverType: UpdateDocsAttributeType.REPLACE
10553
10552
  }), memoryCursor.moveCursorTo(startIndex + 1);
10554
10553
  }
@@ -10570,8 +10569,7 @@ const changeParagraphBulletNestLevel = /* @__PURE__ */ __name((params) => {
10570
10569
  const { startIndex, paragraphStyle = {}, bullet } = paragraph, isInTable = hasParagraphInTable(paragraph, tables);
10571
10570
  if (textX.push({
10572
10571
  t: TextXActionType.RETAIN,
10573
- len: startIndex - memoryCursor.cursor,
10574
- segmentId
10572
+ len: startIndex - memoryCursor.cursor
10575
10573
  }), bullet) {
10576
10574
  const listType = bullet.listType;
10577
10575
  let maxLevel = lists[listType].nestingLevel.length - 1;
@@ -10593,7 +10591,6 @@ const changeParagraphBulletNestLevel = /* @__PURE__ */ __name((params) => {
10593
10591
  }
10594
10592
  ]
10595
10593
  },
10596
- segmentId,
10597
10594
  coverType: UpdateDocsAttributeType.REPLACE
10598
10595
  });
10599
10596
  } else
@@ -10684,8 +10681,12 @@ function getSelectionWithSymbolMax(selection, body) {
10684
10681
  let { startOffset, endOffset } = normalizeSelection(selection);
10685
10682
  for (; body.dataStream[startOffset - 1] === DataStreamTreeTokenType.CUSTOM_RANGE_START; )
10686
10683
  startOffset -= 1;
10684
+ for (; body.dataStream[startOffset] === DataStreamTreeTokenType.CUSTOM_RANGE_END; )
10685
+ startOffset += 1;
10687
10686
  for (; body.dataStream[endOffset] === DataStreamTreeTokenType.CUSTOM_RANGE_END; )
10688
10687
  endOffset += 1;
10688
+ for (; body.dataStream[endOffset - 1] === DataStreamTreeTokenType.CUSTOM_RANGE_START; )
10689
+ endOffset -= 1;
10689
10690
  return {
10690
10691
  startOffset,
10691
10692
  endOffset
@@ -10791,13 +10792,12 @@ function isSegmentIntersects(start, end, start2, end2) {
10791
10792
  __name(isSegmentIntersects, "isSegmentIntersects");
10792
10793
  function getRetainAndDeleteFromReplace(range, segmentId = "", memoryCursor, body) {
10793
10794
  var _a11;
10794
- const { startOffset, endOffset } = range, dos = [], textStart = startOffset - memoryCursor, textEnd = endOffset - memoryCursor, dataStream = body.dataStream, relativeCustomRanges = (_a11 = body.customRanges) == null ? void 0 : _a11.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
10795
+ const { startOffset, endOffset } = range, dos = [], textStart = startOffset - memoryCursor, textEnd = endOffset - memoryCursor, dataStream = body.dataStream, relativeCustomRanges = (_a11 = body.customRanges) == null ? void 0 : _a11.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset - 1)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
10795
10796
  relativeCustomRanges == null || relativeCustomRanges.forEach((range2) => {
10796
10797
  toDeleteRanges.has(range2) || (range2.startIndex - memoryCursor >= textStart && range2.startIndex - memoryCursor < textEnd && range2.endIndex - memoryCursor >= textEnd && retainPoints.add(range2.startIndex), range2.endIndex - memoryCursor >= textStart && range2.endIndex - memoryCursor < textEnd && range2.startIndex - memoryCursor < textStart && retainPoints.add(range2.endIndex));
10797
10798
  }), textStart > 0 && dos.push({
10798
10799
  t: TextXActionType.RETAIN,
10799
- len: textStart,
10800
- segmentId
10800
+ len: textStart
10801
10801
  });
10802
10802
  const sortedRetains = [...retainPoints].sort((pre, aft) => pre - aft);
10803
10803
  let cursor2 = textStart;
@@ -10805,19 +10805,14 @@ function getRetainAndDeleteFromReplace(range, segmentId = "", memoryCursor, body
10805
10805
  const len = pos - cursor2;
10806
10806
  len > 0 && dos.push({
10807
10807
  t: TextXActionType.DELETE,
10808
- len,
10809
- line: 0,
10810
- segmentId
10808
+ len
10811
10809
  }), dos.push({
10812
10810
  t: TextXActionType.RETAIN,
10813
- len: 1,
10814
- segmentId
10811
+ len: 1
10815
10812
  }), cursor2 = pos + 1;
10816
10813
  }), cursor2 < textEnd && (dos.push({
10817
10814
  t: TextXActionType.DELETE,
10818
- len: textEnd - cursor2,
10819
- line: 0,
10820
- segmentId
10815
+ len: textEnd - cursor2
10821
10816
  }), cursor2 = textEnd + 1), {
10822
10817
  dos,
10823
10818
  cursor: cursor2,
@@ -10833,28 +10828,20 @@ function deleteCustomRangeTextX(accessor, params) {
10833
10828
  const { startIndex, endIndex } = range, textX = new TextX(), len = endIndex - startIndex + 1;
10834
10829
  return startIndex > 0 && textX.push({
10835
10830
  t: TextXActionType.RETAIN,
10836
- len: startIndex,
10837
- segmentId
10831
+ len: startIndex
10838
10832
  }), textX.push({
10839
10833
  t: TextXActionType.DELETE,
10840
- len: 1,
10841
- segmentId,
10842
- line: 0
10834
+ len: 1
10843
10835
  }), textRange && textRange.index > startIndex && textRange.index--, len - 2 > 0 && textX.push({
10844
10836
  t: TextXActionType.RETAIN,
10845
- len: len - 2,
10846
- segmentId
10837
+ len: len - 2
10847
10838
  }), textX.push({
10848
10839
  t: TextXActionType.DELETE,
10849
- len: 1,
10850
- segmentId,
10851
- line: 0
10840
+ len: 1
10852
10841
  }), textRange && textRange.index > endIndex && textRange.index--, insert && (textX.push({
10853
10842
  body: insert,
10854
10843
  t: TextXActionType.INSERT,
10855
- len: insert.dataStream.length,
10856
- segmentId,
10857
- line: 1
10844
+ len: insert.dataStream.length
10858
10845
  }), textRange && textRange.index > endIndex && (textRange.index += insert.dataStream.length)), textX;
10859
10846
  }
10860
10847
  __name(deleteCustomRangeTextX, "deleteCustomRangeTextX");
@@ -10881,31 +10868,24 @@ function addCustomRangeTextX(param) {
10881
10868
  };
10882
10869
  range2.startOffset !== cursor2 && (textX.push({
10883
10870
  t: TextXActionType.RETAIN,
10884
- len: range2.startOffset - cursor2,
10885
- segmentId
10871
+ len: range2.startOffset - cursor2
10886
10872
  }), cursor2 = range2.startOffset), textX.push({
10887
10873
  t: TextXActionType.INSERT,
10888
10874
  body: {
10889
10875
  dataStream: DataStreamTreeTokenType.CUSTOM_RANGE_START
10890
10876
  },
10891
- len: 1,
10892
- line: 0,
10893
- segmentId
10877
+ len: 1
10894
10878
  }), deletes.forEach((index22) => {
10895
10879
  index22 !== cursor2 && (textX.push({
10896
10880
  t: TextXActionType.RETAIN,
10897
- len: index22 - cursor2,
10898
- segmentId
10881
+ len: index22 - cursor2
10899
10882
  }), cursor2 = index22), textX.push({
10900
10883
  t: TextXActionType.DELETE,
10901
- len: 1,
10902
- line: 0,
10903
- segmentId
10884
+ len: 1
10904
10885
  }), cursor2++;
10905
10886
  }), cursor2 !== range2.endOffset && (textX.push({
10906
10887
  t: TextXActionType.RETAIN,
10907
- len: range2.endOffset - cursor2,
10908
- segmentId
10888
+ len: range2.endOffset - cursor2
10909
10889
  }), cursor2 = range2.endOffset), textX.push({
10910
10890
  t: TextXActionType.INSERT,
10911
10891
  body: {
@@ -10923,9 +10903,7 @@ function addCustomRangeTextX(param) {
10923
10903
  }
10924
10904
  ]
10925
10905
  },
10926
- len: 1,
10927
- line: 0,
10928
- segmentId
10906
+ len: 1
10929
10907
  });
10930
10908
  }, "addCustomRange"), relativeParagraphs = ((_b2 = body.paragraphs) != null ? _b2 : []).filter((p) => p.startIndex < endOffset && p.startIndex > startOffset);
10931
10909
  return excludePointsFromRange([startOffset, endOffset - 1], relativeParagraphs.map((p) => p.startIndex)).forEach(([start, end], i) => addCustomRange(start, end, i)), textX;
@@ -10935,13 +10913,12 @@ function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "",
10935
10913
  var _a11;
10936
10914
  const { startOffset, endOffset } = getDeleteSelection(selection, body), dos = [], { paragraphs = [], dataStream } = body, textStart = startOffset - memoryCursor, textEnd = endOffset - memoryCursor, paragraphInRange = paragraphs == null ? void 0 : paragraphs.find(
10937
10915
  (p) => p.startIndex - memoryCursor >= textStart && p.startIndex - memoryCursor < textEnd
10938
- ), relativeCustomRanges = (_a11 = body.customRanges) == null ? void 0 : _a11.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
10916
+ ), relativeCustomRanges = (_a11 = body.customRanges) == null ? void 0 : _a11.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset - 1)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
10939
10917
  if (relativeCustomRanges == null || relativeCustomRanges.forEach((range) => {
10940
10918
  toDeleteRanges.has(range) || (range.startIndex - memoryCursor >= textStart && range.startIndex - memoryCursor <= textEnd && range.endIndex - memoryCursor > textEnd && retainPoints.add(range.startIndex), range.endIndex - memoryCursor >= textStart && range.endIndex - memoryCursor <= textEnd && range.startIndex < textStart && retainPoints.add(range.endIndex));
10941
10919
  }), textStart > 0 && dos.push({
10942
10920
  t: TextXActionType.RETAIN,
10943
- len: textStart,
10944
- segmentId
10921
+ len: textStart
10945
10922
  }), preserveLineBreak && paragraphInRange && paragraphInRange.startIndex - memoryCursor > textStart) {
10946
10923
  const paragraphIndex = paragraphInRange.startIndex - memoryCursor;
10947
10924
  retainPoints.add(paragraphIndex);
@@ -10952,29 +10929,22 @@ function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "",
10952
10929
  const len = pos - cursor2;
10953
10930
  len > 0 && dos.push({
10954
10931
  t: TextXActionType.DELETE,
10955
- len,
10956
- line: 0,
10957
- segmentId
10932
+ len
10958
10933
  }), dos.push({
10959
10934
  t: TextXActionType.RETAIN,
10960
- len: 1,
10961
- segmentId
10935
+ len: 1
10962
10936
  }), cursor2 = pos + 1;
10963
10937
  }), cursor2 < textEnd && (dos.push({
10964
10938
  t: TextXActionType.DELETE,
10965
- len: textEnd - cursor2,
10966
- line: 0,
10967
- segmentId
10939
+ len: textEnd - cursor2
10968
10940
  }), cursor2 = textEnd), !preserveLineBreak) {
10969
10941
  const nextParagraph = paragraphs.find((p) => p.startIndex - memoryCursor >= textEnd);
10970
10942
  nextParagraph && (nextParagraph.startIndex > cursor2 && (dos.push({
10971
10943
  t: TextXActionType.RETAIN,
10972
- len: nextParagraph.startIndex - cursor2,
10973
- segmentId
10944
+ len: nextParagraph.startIndex - cursor2
10974
10945
  }), cursor2 = nextParagraph.startIndex), dos.push({
10975
10946
  t: TextXActionType.RETAIN,
10976
10947
  len: 1,
10977
- segmentId,
10978
10948
  body: {
10979
10949
  dataStream: "",
10980
10950
  paragraphs: [
@@ -10999,9 +10969,7 @@ const replaceSelectionTextX = /* @__PURE__ */ __name((params) => {
10999
10969
  return deleteActions.length && textX.push(...deleteActions), textX.push({
11000
10970
  t: TextXActionType.INSERT,
11001
10971
  body: insertBody,
11002
- len: insertBody.dataStream.length,
11003
- line: 0,
11004
- segmentId
10972
+ len: insertBody.dataStream.length
11005
10973
  }), textX;
11006
10974
  }, "replaceSelectionTextX"), _BuildTextUtils = class _BuildTextUtils {
11007
10975
  };
@@ -11009,7 +10977,7 @@ __name(_BuildTextUtils, "BuildTextUtils"), __publicField(_BuildTextUtils, "custo
11009
10977
  add: addCustomRangeTextX,
11010
10978
  delete: deleteCustomRangeTextX,
11011
10979
  copyCustomRange,
11012
- getCustomRangesInterestsWithRange,
10980
+ getCustomRangesInterestsWithSelection,
11013
10981
  shouldDeleteCustomRange,
11014
10982
  isIntersecting
11015
10983
  }), __publicField(_BuildTextUtils, "selection", {
@@ -11019,7 +10987,7 @@ __name(_BuildTextUtils, "BuildTextUtils"), __publicField(_BuildTextUtils, "custo
11019
10987
  getDeleteSelection,
11020
10988
  getInsertSelection,
11021
10989
  getDeleteActions: getRetainAndDeleteFromReplace,
11022
- getDeleteExculdeLastLineBreakActions: getRetainAndDeleteAndExcludeLineBreak
10990
+ getDeleteExcludeLastLineBreakActions: getRetainAndDeleteAndExcludeLineBreak
11023
10991
  }), __publicField(_BuildTextUtils, "range", {
11024
10992
  isIntersects: isSegmentIntersects
11025
10993
  }), __publicField(_BuildTextUtils, "transform", {
@@ -11234,7 +11202,7 @@ let AuthzIoLocalService = (_a3 = class {
11234
11202
  }, "toJson"),
11235
11203
  parseJson: /* @__PURE__ */ __name((json) => JSON.parse(json), "parseJson"),
11236
11204
  pluginName: "SHEET_AuthzIoMockService_PLUGIN",
11237
- businesses: [R.UNIVER_SHEET, R.UNIVER_DOC, R.UNIVER_SLIDE],
11205
+ businesses: [_.UNIVER_SHEET, _.UNIVER_DOC, _.UNIVER_SLIDE],
11238
11206
  onLoad: /* @__PURE__ */ __name((_unitId, resource) => {
11239
11207
  for (const key in resource)
11240
11208
  this._permissionMap.set(key, resource[key]);
@@ -11268,8 +11236,8 @@ let AuthzIoLocalService = (_a3 = class {
11268
11236
  shareRole: S.Owner,
11269
11237
  shareScope: -1,
11270
11238
  scope: {
11271
- read: T.AllCollaborator,
11272
- edit: T.AllCollaborator
11239
+ read: G.AllCollaborator,
11240
+ edit: G.AllCollaborator
11273
11241
  },
11274
11242
  creator: createDefaultUser(S.Owner),
11275
11243
  strategies: [
@@ -11358,23 +11326,32 @@ AuthzIoLocalService = __decorateClass$6([
11358
11326
  ], AuthzIoLocalService);
11359
11327
  const IAuthzIoService = createIdentifier("IAuthzIoIoService"), IConfigService = createIdentifier("univer.config-service"), _ConfigService = class _ConfigService {
11360
11328
  constructor() {
11329
+ __publicField(this, "_configChanged$", new Subject());
11330
+ __publicField(this, "configChanged$", this._configChanged$.asObservable());
11361
11331
  __publicField(this, "_config", /* @__PURE__ */ new Map());
11362
11332
  }
11333
+ dispose() {
11334
+ this._configChanged$.complete();
11335
+ }
11363
11336
  getConfig(id) {
11364
11337
  return this._config.get(id);
11365
11338
  }
11366
11339
  setConfig(id, value, options) {
11367
11340
  var _a11;
11368
- const { merge: merge2 = !1 } = options || {}, existingValue = (_a11 = this._config.get(id)) != null ? _a11 : {};
11369
- if (merge2) {
11370
- this._config.set(id, Tools.deepMerge(existingValue, value));
11371
- return;
11372
- }
11373
- this._config.set(id, value);
11341
+ const { merge: merge2 = !1 } = options || {};
11342
+ let nextValue = (_a11 = this._config.get(id)) != null ? _a11 : {};
11343
+ merge2 ? nextValue = Tools.deepMerge(nextValue, value) : nextValue = value, this._config.set(id, nextValue), this._configChanged$.next({ [id]: nextValue });
11374
11344
  }
11375
11345
  deleteConfig(id) {
11376
11346
  return this._config.delete(id);
11377
11347
  }
11348
+ subscribeConfigValue$(key) {
11349
+ return new Observable((observer) => {
11350
+ Object.prototype.hasOwnProperty.call(this._config, key) && observer.next(this._config.get(key));
11351
+ const sub = this.configChanged$.pipe(filter((c) => Object.prototype.hasOwnProperty.call(c, key))).subscribe((c) => observer.next(c[key]));
11352
+ return () => sub.unsubscribe();
11353
+ });
11354
+ }
11378
11355
  };
11379
11356
  __name(_ConfigService, "ConfigService");
11380
11357
  let ConfigService = _ConfigService;
@@ -11393,7 +11370,7 @@ const FOCUSING_UNIT = "FOCUSING_UNIT", FOCUSING_SHEET = "FOCUSING_SHEET", FOCUSI
11393
11370
  };
11394
11371
  __name(_ErrorService, "ErrorService");
11395
11372
  let ErrorService = _ErrorService;
11396
- const version = "0.4.1";
11373
+ const version = "0.4.2-nightly.202410291606";
11397
11374
  function getEmptySnapshot(unitID = "", locale = LocaleType.ZH_CN, name = "") {
11398
11375
  return {
11399
11376
  id: unitID,
@@ -11479,6 +11456,24 @@ const _ColumnManager = class _ColumnManager {
11479
11456
  const { _columnData } = this, col = _columnData[colPos];
11480
11457
  return col ? col.hd !== BooleanNumber.TRUE : !0;
11481
11458
  }
11459
+ /**
11460
+ * Get the column style
11461
+ * @param {number} col Column index
11462
+ * @returns {string | Nullable<IStyleData>} Style data, may be undefined
11463
+ */
11464
+ getColumnStyle(col) {
11465
+ var _a11;
11466
+ return (_a11 = this._columnData[col]) == null ? void 0 : _a11.s;
11467
+ }
11468
+ /**
11469
+ * Set the set column default style
11470
+ * @param {number} col Column index
11471
+ * @param {string | Nullable<IStyleData>} style Style data
11472
+ */
11473
+ setColumnStyle(col, style) {
11474
+ const coldData = this.getColumnOrCreate(col);
11475
+ coldData.s = style;
11476
+ }
11482
11477
  /**
11483
11478
  * Get all hidden columns
11484
11479
  * @param start Start index
@@ -11565,26 +11560,29 @@ const _ColumnManager = class _ColumnManager {
11565
11560
  /**
11566
11561
  * get given column data
11567
11562
  * @param columnPos column index
11568
- * @returns
11569
11563
  */
11570
11564
  getColumn(columnPos) {
11571
11565
  const column = this._columnData[columnPos];
11572
11566
  if (column)
11573
11567
  return column;
11574
11568
  }
11569
+ /**
11570
+ * Remove column data of given column
11571
+ * @param columnPos
11572
+ */
11573
+ removeColumn(columnPos) {
11574
+ delete this._columnData[columnPos];
11575
+ }
11575
11576
  /**
11576
11577
  * get given column data or create a column data when it's null
11577
11578
  * @param columnPos column index
11578
- * @returns
11579
+ * @returns {Partial<IColumnData>} columnData
11579
11580
  */
11580
11581
  getColumnOrCreate(columnPos) {
11581
- const { _columnData } = this, config = this._config, column = _columnData[columnPos];
11582
+ const { _columnData } = this, column = _columnData[columnPos];
11582
11583
  if (column)
11583
11584
  return column;
11584
- const create = {
11585
- w: config.defaultColumnWidth,
11586
- hd: BooleanNumber.FALSE
11587
- };
11585
+ const create = {};
11588
11586
  return this._columnData[columnPos] = create, create;
11589
11587
  }
11590
11588
  };
@@ -11602,6 +11600,24 @@ const _RowManager = class _RowManager {
11602
11600
  getRowData() {
11603
11601
  return this._rowData;
11604
11602
  }
11603
+ /**
11604
+ * Get the row style
11605
+ * @param {number} row Row index
11606
+ * @returns {string | Nullable<IStyleData>} Style data, may be undefined
11607
+ */
11608
+ getRowStyle(row) {
11609
+ var _a11;
11610
+ return (_a11 = this._rowData[row]) == null ? void 0 : _a11.s;
11611
+ }
11612
+ /**
11613
+ * Set row default style
11614
+ * @param {number} row The row index
11615
+ * @param {string | Nullable<IStyleData>} style The style data
11616
+ */
11617
+ setRowStyle(row, style) {
11618
+ const rowData = this.getRowOrCreate(row);
11619
+ rowData.s = style;
11620
+ }
11605
11621
  getRowDatas(rowPos, numRows) {
11606
11622
  const rowData = {};
11607
11623
  let index2 = 0;
@@ -11631,16 +11647,23 @@ const _RowManager = class _RowManager {
11631
11647
  getRow(rowPos) {
11632
11648
  return this._rowData[rowPos];
11633
11649
  }
11650
+ /**
11651
+ * Remove row data of given row
11652
+ * @param rowPos
11653
+ */
11654
+ removeRow(rowPos) {
11655
+ delete this._rowData[rowPos];
11656
+ }
11634
11657
  /**
11635
11658
  * Get given row data or create a row data when it's null
11636
11659
  * @param rowPos row index
11637
- * @returns
11660
+ * @returns {Partial<IRowData>} rowData
11638
11661
  */
11639
11662
  getRowOrCreate(rowPos) {
11640
11663
  const { _rowData } = this, row = _rowData[rowPos];
11641
11664
  if (row)
11642
11665
  return row;
11643
- const config = this._config, create = { hd: BooleanNumber.FALSE, h: config.defaultRowHeight };
11666
+ const create = {};
11644
11667
  return _rowData[rowPos] = create, create;
11645
11668
  }
11646
11669
  /**
@@ -11691,7 +11714,7 @@ const _RowManager = class _RowManager {
11691
11714
  }
11692
11715
  /**
11693
11716
  * Get count of row in the sheet
11694
- * @returns
11717
+ * @returns {number} row count
11695
11718
  */
11696
11719
  getSize() {
11697
11720
  return getArrayLength(this._rowData);
@@ -12013,9 +12036,77 @@ const _Worksheet = class _Worksheet {
12013
12036
  getSpanModel() {
12014
12037
  return this._spanModel;
12015
12038
  }
12039
+ /**
12040
+ * Get the style of the column.
12041
+ * @param {number} column The column index
12042
+ * @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
12043
+ * @returns {Nullable<IStyleData>|string} The style of the column
12044
+ */
12045
+ getColumnStyle(column, keepRaw = !1) {
12046
+ return keepRaw ? this._columnManager.getColumnStyle(column) : this._styles.get(this._columnManager.getColumnStyle(column));
12047
+ }
12048
+ /**
12049
+ * Set the style of the column.
12050
+ * @param {number} column The column index
12051
+ * @param {string|Nullable<IStyleData>} style The style to be set
12052
+ */
12053
+ setColumnStyle(column, style) {
12054
+ this._columnManager.setColumnStyle(column, style);
12055
+ }
12056
+ /**
12057
+ * Get the style of the row.
12058
+ * @param {number} row The row index
12059
+ * @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
12060
+ * @returns {Nullable<IStyleData>} The style of the row
12061
+ */
12062
+ getRowStyle(row, keepRaw = !1) {
12063
+ return keepRaw ? this._rowManager.getRowStyle(row) : this._styles.get(this._rowManager.getRowStyle(row));
12064
+ }
12065
+ /**
12066
+ * Set the style of the row.
12067
+ * @param {number} row
12068
+ * @param {string|Nullable<IStyleData>} style The style to be set
12069
+ */
12070
+ setRowStyle(row, style) {
12071
+ this._rowManager.setRowStyle(row, style);
12072
+ }
12073
+ /**
12074
+ * this function is used to mixin default style to cell raw{number}
12075
+ * @param {number} row The row index
12076
+ * @param {number} col The column index
12077
+ * @param cellRaw The cell raw data
12078
+ * @param {boolean} isRowStylePrecedeColumnStyle The priority of row style and column style
12079
+ */
12080
+ mixinDefaultStyleToCellRaw(row, col, cellRaw, isRowStylePrecedeColumnStyle) {
12081
+ const columnStyle = this.getColumnStyle(col), rowStyle = this.getRowStyle(row), defaultStyle = this.getDefaultCellStyleInternal();
12082
+ if (defaultStyle || columnStyle || rowStyle) {
12083
+ let cellStyle = cellRaw == null ? void 0 : cellRaw.s;
12084
+ typeof cellStyle == "string" && (cellStyle = this._styles.get(cellStyle));
12085
+ const s = isRowStylePrecedeColumnStyle ? composeStyles(defaultStyle, columnStyle, rowStyle, cellStyle) : composeStyles(defaultStyle, rowStyle, columnStyle, cellStyle);
12086
+ cellRaw || (cellRaw = {}), cellRaw.s = s;
12087
+ }
12088
+ }
12089
+ /**
12090
+ * Get the default style of the worksheet.
12091
+ * @returns {Nullable<IStyleData>} Default Style
12092
+ */
12093
+ getDefaultCellStyle() {
12094
+ return this._snapshot.defaultStyle;
12095
+ }
12096
+ getDefaultCellStyleInternal() {
12097
+ const style = this._snapshot.defaultStyle;
12098
+ return this._styles.get(style);
12099
+ }
12100
+ /**
12101
+ * Set Default Style, if the style has been set, all cells style will be base on this style.
12102
+ * @param {Nullable<IStyleData>} style The style to be set as default style
12103
+ */
12104
+ setDefaultCellStyle(style) {
12105
+ this._snapshot.defaultStyle = style;
12106
+ }
12016
12107
  /**
12017
12108
  * Returns WorkSheet Cell Data Matrix
12018
- * @returns
12109
+ * @returns WorkSheet Cell Data Matrix
12019
12110
  */
12020
12111
  getCellMatrix() {
12021
12112
  return this._cellData;
@@ -12543,7 +12634,7 @@ var _a4;
12543
12634
  let Workbook = (_a4 = class extends UnitModel {
12544
12635
  constructor(workbookData = {}, _logService) {
12545
12636
  super();
12546
- __publicField(this, "type", R.UNIVER_SHEET);
12637
+ __publicField(this, "type", _.UNIVER_SHEET);
12547
12638
  __publicField(this, "_sheetCreated$", new Subject());
12548
12639
  __publicField(this, "sheetCreated$", this._sheetCreated$.asObservable());
12549
12640
  __publicField(this, "_sheetDisposed$", new Subject());
@@ -12788,7 +12879,7 @@ const _SlideDataModel = class _SlideDataModel extends UnitModel {
12788
12879
  constructor(snapshot) {
12789
12880
  var _a11;
12790
12881
  super();
12791
- __publicField(this, "type", R.UNIVER_SLIDE);
12882
+ __publicField(this, "type", _.UNIVER_SLIDE);
12792
12883
  __publicField(this, "_activePage$", new BehaviorSubject(null));
12793
12884
  __publicField(this, "activePage$", this._activePage$.asObservable());
12794
12885
  __publicField(this, "_name$");
@@ -12961,20 +13052,20 @@ let UniverInstanceService = (_a5 = class extends Disposable {
12961
13052
  return type2 && (unit == null ? void 0 : unit.type) !== type2 ? null : unit;
12962
13053
  }
12963
13054
  getCurrentUniverDocInstance() {
12964
- return this.getCurrentUnitForType(R.UNIVER_DOC);
13055
+ return this.getCurrentUnitForType(_.UNIVER_DOC);
12965
13056
  }
12966
13057
  getUniverDocInstance(unitId) {
12967
- return this.getUnit(unitId, R.UNIVER_DOC);
13058
+ return this.getUnit(unitId, _.UNIVER_DOC);
12968
13059
  }
12969
13060
  getUniverSheetInstance(unitId) {
12970
- return this.getUnit(unitId, R.UNIVER_SHEET);
13061
+ return this.getUnit(unitId, _.UNIVER_SHEET);
12971
13062
  }
12972
13063
  getAllUnitsForType(type2) {
12973
13064
  var _a11;
12974
13065
  return (_a11 = this._unitsByType.get(type2)) != null ? _a11 : [];
12975
13066
  }
12976
13067
  changeDoc(unitId, doc) {
12977
- const allDocs = this.getAllUnitsForType(R.UNIVER_DOC), oldDoc = allDocs.find((doc2) => doc2.getUnitId() === unitId);
13068
+ const allDocs = this.getAllUnitsForType(_.UNIVER_DOC), oldDoc = allDocs.find((doc2) => doc2.getUnitId() === unitId);
12978
13069
  if (oldDoc != null) {
12979
13070
  const index2 = allDocs.indexOf(oldDoc);
12980
13071
  allDocs.splice(index2, 1);
@@ -12994,7 +13085,7 @@ let UniverInstanceService = (_a5 = class extends Disposable {
12994
13085
  }
12995
13086
  getUnitType(unitId) {
12996
13087
  const result = this._getUnitById(unitId);
12997
- return result ? result[1] : R.UNRECOGNIZED;
13088
+ return result ? result[1] : _.UNRECOGNIZED;
12998
13089
  }
12999
13090
  disposeUnit(unitId) {
13000
13091
  const result = this._getUnitById(unitId);
@@ -13059,7 +13150,7 @@ let LifecycleService = (_a6 = class extends Disposable {
13059
13150
  * @returns
13060
13151
  */
13061
13152
  subscribeWithPrevious() {
13062
- return merge$2(getLifecycleStagesAndBefore(this.stage), this._lifecycle$.pipe(skip(1))).pipe(takeAfter((s) => s === LifecycleStages.Steady));
13153
+ return merge$1(getLifecycleStagesAndBefore(this.stage), this._lifecycle$.pipe(skip(1))).pipe(takeAfter((s) => s === LifecycleStages.Steady));
13063
13154
  }
13064
13155
  _reportProgress(stage) {
13065
13156
  this._logService.debug("[LifecycleService]", `lifecycle progressed to "${LifecycleNameMap[stage]}".`);
@@ -13171,6 +13262,13 @@ const IPermissionService = createIdentifier("univer.permission-service"), _Permi
13171
13262
  __publicField(this, "_permissionPointMap", /* @__PURE__ */ new Map());
13172
13263
  __publicField(this, "_permissionPointUpdate$", new Subject());
13173
13264
  __publicField(this, "permissionPointUpdate$", this._permissionPointUpdate$.asObservable());
13265
+ __publicField(this, "_showComponents", !0);
13266
+ }
13267
+ setShowComponents(showComponents) {
13268
+ this._showComponents = showComponents;
13269
+ }
13270
+ getShowComponents() {
13271
+ return this._showComponents;
13174
13272
  }
13175
13273
  deletePermissionPoint(permissionId) {
13176
13274
  const permissionPoint = this._permissionPointMap.get(permissionId);
@@ -13251,7 +13349,7 @@ const DependentOnSymbol = Symbol("DependentOn"), _Plugin = class _Plugin extends
13251
13349
  return this.constructor.pluginName;
13252
13350
  }
13253
13351
  };
13254
- __name(_Plugin, "Plugin"), __publicField(_Plugin, "pluginName"), __publicField(_Plugin, "type", R.UNIVER_UNKNOWN);
13352
+ __name(_Plugin, "Plugin"), __publicField(_Plugin, "pluginName"), __publicField(_Plugin, "type", _.UNIVER_UNKNOWN);
13255
13353
  let Plugin = _Plugin;
13256
13354
  const _PluginStore = class _PluginStore {
13257
13355
  constructor() {
@@ -13310,7 +13408,7 @@ let PluginService = (_a7 = class {
13310
13408
  PluginHolder,
13311
13409
  this._checkPluginSeen.bind(this),
13312
13410
  this._immediateInitPlugin.bind(this)
13313
- ), this._pluginHoldersForTypes.set(R.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
13411
+ ), this._pluginHoldersForTypes.set(_.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
13314
13412
  }
13315
13413
  dispose() {
13316
13414
  this._clearFlushTimer();
@@ -13322,7 +13420,7 @@ let PluginService = (_a7 = class {
13322
13420
  registerPlugin(ctor, config) {
13323
13421
  this._assertPluginValid(ctor), this._scheduleInitPlugin();
13324
13422
  const { type: type2 } = ctor;
13325
- type2 === R.UNIVER_UNKNOWN ? (this._pluginHolderForUniver.register(ctor, config), this._pluginHolderForUniver.flush()) : this._ensurePluginHolderForType(type2).register(ctor, config);
13423
+ type2 === _.UNIVER_UNKNOWN ? (this._pluginHolderForUniver.register(ctor, config), this._pluginHolderForUniver.flush()) : this._ensurePluginHolderForType(type2).register(ctor, config);
13326
13424
  }
13327
13425
  startPluginForType(type2) {
13328
13426
  this._ensurePluginHolderForType(type2).start();
@@ -13346,7 +13444,7 @@ let PluginService = (_a7 = class {
13346
13444
  }
13347
13445
  _assertPluginValid(ctor) {
13348
13446
  const { type: type2, pluginName } = ctor;
13349
- if (type2 === R.UNRECOGNIZED)
13447
+ if (type2 === _.UNRECOGNIZED)
13350
13448
  throw new Error(`[PluginService]: invalid plugin type for ${ctor.name}. Please assign a "type" to your plugin.`);
13351
13449
  if (!pluginName)
13352
13450
  throw new Error(`[PluginService]: no plugin name for ${ctor.name}. Please assign a "pluginName" to your plugin.`);
@@ -13367,7 +13465,7 @@ let PluginService = (_a7 = class {
13367
13465
  }
13368
13466
  _flushPlugins() {
13369
13467
  this._pluginHolderForUniver.flush();
13370
- for (const [_, holder] of this._pluginHoldersForTypes)
13468
+ for (const [_2, holder] of this._pluginHoldersForTypes)
13371
13469
  holder.started && holder.flush();
13372
13470
  }
13373
13471
  }, __name(_a7, "PluginService"), _a7);
@@ -13715,7 +13813,157 @@ const isRangesEqual = /* @__PURE__ */ __name((oldRanges, ranges) => ranges.lengt
13715
13813
  const current = ranges[i];
13716
13814
  return current.unitId === oldRange.unitId && current.sheetId === oldRange.sheetId && Rectangle.equals(oldRange.range, current.range);
13717
13815
  }), "isUnitRangesEqual"), skipParseTagNames = ["script", "style", "meta", "comment", "link"];
13718
- var DataValidationErrorStyle = /* @__PURE__ */ ((DataValidationErrorStyle2) => (DataValidationErrorStyle2[DataValidationErrorStyle2.INFO = 0] = "INFO", DataValidationErrorStyle2[DataValidationErrorStyle2.STOP = 1] = "STOP", DataValidationErrorStyle2[DataValidationErrorStyle2.WARNING = 2] = "WARNING", DataValidationErrorStyle2))(DataValidationErrorStyle || {}), DataValidationImeMode = /* @__PURE__ */ ((DataValidationImeMode2) => (DataValidationImeMode2[DataValidationImeMode2.DISABLED = 0] = "DISABLED", DataValidationImeMode2[DataValidationImeMode2.FULL_ALPHA = 1] = "FULL_ALPHA", DataValidationImeMode2[DataValidationImeMode2.FULL_HANGUL = 2] = "FULL_HANGUL", DataValidationImeMode2[DataValidationImeMode2.FULL_KATAKANA = 3] = "FULL_KATAKANA", DataValidationImeMode2[DataValidationImeMode2.HALF_ALPHA = 4] = "HALF_ALPHA", DataValidationImeMode2[DataValidationImeMode2.HALF_HANGUL = 5] = "HALF_HANGUL", DataValidationImeMode2[DataValidationImeMode2.HALF_KATAKANA = 6] = "HALF_KATAKANA", DataValidationImeMode2[DataValidationImeMode2.HIRAGANA = 7] = "HIRAGANA", DataValidationImeMode2[DataValidationImeMode2.NO_CONTROL = 8] = "NO_CONTROL", DataValidationImeMode2[DataValidationImeMode2.OFF = 9] = "OFF", DataValidationImeMode2[DataValidationImeMode2.ON = 10] = "ON", DataValidationImeMode2))(DataValidationImeMode || {}), DataValidationOperator = /* @__PURE__ */ ((DataValidationOperator2) => (DataValidationOperator2.BETWEEN = "between", DataValidationOperator2.EQUAL = "equal", DataValidationOperator2.GREATER_THAN = "greaterThan", DataValidationOperator2.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", DataValidationOperator2.LESS_THAN = "lessThan", DataValidationOperator2.LESS_THAN_OR_EQUAL = "lessThanOrEqual", DataValidationOperator2.NOT_BETWEEN = "notBetween", DataValidationOperator2.NOT_EQUAL = "notEqual", DataValidationOperator2))(DataValidationOperator || {}), DataValidationRenderMode = /* @__PURE__ */ ((DataValidationRenderMode2) => (DataValidationRenderMode2[DataValidationRenderMode2.TEXT = 0] = "TEXT", DataValidationRenderMode2[DataValidationRenderMode2.ARROW = 1] = "ARROW", DataValidationRenderMode2[DataValidationRenderMode2.CUSTOM = 2] = "CUSTOM", DataValidationRenderMode2))(DataValidationRenderMode || {}), DataValidationStatus = /* @__PURE__ */ ((DataValidationStatus2) => (DataValidationStatus2.VALID = "valid", DataValidationStatus2.INVALID = "invalid", DataValidationStatus2.VALIDATING = "validating", DataValidationStatus2))(DataValidationStatus || {}), DataValidationType = /* @__PURE__ */ ((DataValidationType2) => (DataValidationType2.CUSTOM = "custom", DataValidationType2.LIST = "list", DataValidationType2.LIST_MULTIPLE = "listMultiple", DataValidationType2.NONE = "none", DataValidationType2.TEXT_LENGTH = "textLength", DataValidationType2.DATE = "date", DataValidationType2.TIME = "time", DataValidationType2.WHOLE = "whole", DataValidationType2.DECIMAL = "decimal", DataValidationType2.CHECKBOX = "checkbox", DataValidationType2))(DataValidationType || {});
13816
+ var DataValidationErrorStyle = /* @__PURE__ */ ((DataValidationErrorStyle2) => (DataValidationErrorStyle2[DataValidationErrorStyle2.INFO = 0] = "INFO", DataValidationErrorStyle2[DataValidationErrorStyle2.STOP = 1] = "STOP", DataValidationErrorStyle2[DataValidationErrorStyle2.WARNING = 2] = "WARNING", DataValidationErrorStyle2))(DataValidationErrorStyle || {}), DataValidationImeMode = /* @__PURE__ */ ((DataValidationImeMode2) => (DataValidationImeMode2[DataValidationImeMode2.DISABLED = 0] = "DISABLED", DataValidationImeMode2[DataValidationImeMode2.FULL_ALPHA = 1] = "FULL_ALPHA", DataValidationImeMode2[DataValidationImeMode2.FULL_HANGUL = 2] = "FULL_HANGUL", DataValidationImeMode2[DataValidationImeMode2.FULL_KATAKANA = 3] = "FULL_KATAKANA", DataValidationImeMode2[DataValidationImeMode2.HALF_ALPHA = 4] = "HALF_ALPHA", DataValidationImeMode2[DataValidationImeMode2.HALF_HANGUL = 5] = "HALF_HANGUL", DataValidationImeMode2[DataValidationImeMode2.HALF_KATAKANA = 6] = "HALF_KATAKANA", DataValidationImeMode2[DataValidationImeMode2.HIRAGANA = 7] = "HIRAGANA", DataValidationImeMode2[DataValidationImeMode2.NO_CONTROL = 8] = "NO_CONTROL", DataValidationImeMode2[DataValidationImeMode2.OFF = 9] = "OFF", DataValidationImeMode2[DataValidationImeMode2.ON = 10] = "ON", DataValidationImeMode2))(DataValidationImeMode || {}), DataValidationOperator = /* @__PURE__ */ ((DataValidationOperator2) => (DataValidationOperator2.BETWEEN = "between", DataValidationOperator2.EQUAL = "equal", DataValidationOperator2.GREATER_THAN = "greaterThan", DataValidationOperator2.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", DataValidationOperator2.LESS_THAN = "lessThan", DataValidationOperator2.LESS_THAN_OR_EQUAL = "lessThanOrEqual", DataValidationOperator2.NOT_BETWEEN = "notBetween", DataValidationOperator2.NOT_EQUAL = "notEqual", DataValidationOperator2))(DataValidationOperator || {}), DataValidationRenderMode = /* @__PURE__ */ ((DataValidationRenderMode2) => (DataValidationRenderMode2[DataValidationRenderMode2.TEXT = 0] = "TEXT", DataValidationRenderMode2[DataValidationRenderMode2.ARROW = 1] = "ARROW", DataValidationRenderMode2[DataValidationRenderMode2.CUSTOM = 2] = "CUSTOM", DataValidationRenderMode2))(DataValidationRenderMode || {}), DataValidationStatus = /* @__PURE__ */ ((DataValidationStatus2) => (DataValidationStatus2.VALID = "valid", DataValidationStatus2.INVALID = "invalid", DataValidationStatus2.VALIDATING = "validating", DataValidationStatus2))(DataValidationStatus || {}), DataValidationType = /* @__PURE__ */ ((DataValidationType2) => (DataValidationType2.CUSTOM = "custom", DataValidationType2.LIST = "list", DataValidationType2.LIST_MULTIPLE = "listMultiple", DataValidationType2.NONE = "none", DataValidationType2.TEXT_LENGTH = "textLength", DataValidationType2.DATE = "date", DataValidationType2.TIME = "time", DataValidationType2.WHOLE = "whole", DataValidationType2.DECIMAL = "decimal", DataValidationType2.CHECKBOX = "checkbox", DataValidationType2.ANY = "any", DataValidationType2))(DataValidationType || {});
13817
+ const ARRAY_TYPES = [
13818
+ Int8Array,
13819
+ Uint8Array,
13820
+ Uint8ClampedArray,
13821
+ Int16Array,
13822
+ Uint16Array,
13823
+ Int32Array,
13824
+ Uint32Array,
13825
+ Float32Array,
13826
+ Float64Array
13827
+ ], VERSION = 1, HEADER_SIZE = 8, _KDBush = class _KDBush {
13828
+ /**
13829
+ * Creates an index from raw `ArrayBuffer` data.
13830
+ * @param {ArrayBuffer} data
13831
+ */
13832
+ static from(data) {
13833
+ if (!(data instanceof ArrayBuffer))
13834
+ throw new Error("Data must be an instance of ArrayBuffer.");
13835
+ const [magic, versionAndType] = new Uint8Array(data, 0, 2);
13836
+ if (magic !== 219)
13837
+ throw new Error("Data does not appear to be in a KDBush format.");
13838
+ const version2 = versionAndType >> 4;
13839
+ if (version2 !== VERSION)
13840
+ throw new Error(`Got v${version2} data when expected v${VERSION}.`);
13841
+ const ArrayType = ARRAY_TYPES[versionAndType & 15];
13842
+ if (!ArrayType)
13843
+ throw new Error("Unrecognized array type.");
13844
+ const [nodeSize] = new Uint16Array(data, 2, 1), [numItems] = new Uint32Array(data, 4, 1);
13845
+ return new _KDBush(numItems, nodeSize, ArrayType, data);
13846
+ }
13847
+ /**
13848
+ * Creates an index that will hold a given number of items.
13849
+ * @param {number} numItems
13850
+ * @param {number} [nodeSize=64] Size of the KD-tree node (64 by default).
13851
+ * @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
13852
+ * @param {ArrayBuffer} [data] (For internal use only)
13853
+ */
13854
+ constructor(numItems, nodeSize = 64, ArrayType = Float64Array, data) {
13855
+ if (isNaN(numItems) || numItems < 0) throw new Error(`Unpexpected numItems value: ${numItems}.`);
13856
+ this.numItems = +numItems, this.nodeSize = Math.min(Math.max(+nodeSize, 2), 65535), this.ArrayType = ArrayType, this.IndexArrayType = numItems < 65536 ? Uint16Array : Uint32Array;
13857
+ const arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType), coordsByteSize = numItems * 2 * this.ArrayType.BYTES_PER_ELEMENT, idsByteSize = numItems * this.IndexArrayType.BYTES_PER_ELEMENT, padCoords = (8 - idsByteSize % 8) % 8;
13858
+ if (arrayTypeIndex < 0)
13859
+ throw new Error(`Unexpected typed array class: ${ArrayType}.`);
13860
+ data && data instanceof ArrayBuffer ? (this.data = data, this.ids = new this.IndexArrayType(this.data, HEADER_SIZE, numItems), this.coords = new this.ArrayType(this.data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2), this._pos = numItems * 2, this._finished = !0) : (this.data = new ArrayBuffer(HEADER_SIZE + coordsByteSize + idsByteSize + padCoords), this.ids = new this.IndexArrayType(this.data, HEADER_SIZE, numItems), this.coords = new this.ArrayType(this.data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (VERSION << 4) + arrayTypeIndex]), new Uint16Array(this.data, 2, 1)[0] = nodeSize, new Uint32Array(this.data, 4, 1)[0] = numItems);
13861
+ }
13862
+ /**
13863
+ * Add a point to the index.
13864
+ * @param {number} x
13865
+ * @param {number} y
13866
+ * @returns {number} An incremental index associated with the added item (starting from `0`).
13867
+ */
13868
+ add(x, y) {
13869
+ const index2 = this._pos >> 1;
13870
+ return this.ids[index2] = index2, this.coords[this._pos++] = x, this.coords[this._pos++] = y, index2;
13871
+ }
13872
+ /**
13873
+ * Perform indexing of the added points.
13874
+ */
13875
+ finish() {
13876
+ const numAdded = this._pos >> 1;
13877
+ if (numAdded !== this.numItems)
13878
+ throw new Error(`Added ${numAdded} items when expected ${this.numItems}.`);
13879
+ return sort(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = !0, this;
13880
+ }
13881
+ /**
13882
+ * Search the index for items within a given bounding box.
13883
+ * @param {number} minX
13884
+ * @param {number} minY
13885
+ * @param {number} maxX
13886
+ * @param {number} maxY
13887
+ * @returns {number[]} An array of indices correponding to the found items.
13888
+ */
13889
+ range(minX, minY, maxX, maxY) {
13890
+ if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
13891
+ const { ids, coords, nodeSize } = this, stack = [0, ids.length - 1, 0], result = [];
13892
+ for (; stack.length; ) {
13893
+ const axis = stack.pop() || 0, right = stack.pop() || 0, left = stack.pop() || 0;
13894
+ if (right - left <= nodeSize) {
13895
+ for (let i = left; i <= right; i++) {
13896
+ const x2 = coords[2 * i], y2 = coords[2 * i + 1];
13897
+ x2 >= minX && x2 <= maxX && y2 >= minY && y2 <= maxY && result.push(ids[i]);
13898
+ }
13899
+ continue;
13900
+ }
13901
+ const m = left + right >> 1, x = coords[2 * m], y = coords[2 * m + 1];
13902
+ x >= minX && x <= maxX && y >= minY && y <= maxY && result.push(ids[m]), (axis === 0 ? minX <= x : minY <= y) && (stack.push(left), stack.push(m - 1), stack.push(1 - axis)), (axis === 0 ? maxX >= x : maxY >= y) && (stack.push(m + 1), stack.push(right), stack.push(1 - axis));
13903
+ }
13904
+ return result;
13905
+ }
13906
+ /**
13907
+ * Search the index for items within a given radius.
13908
+ * @param {number} qx
13909
+ * @param {number} qy
13910
+ * @param {number} r Query radius.
13911
+ * @returns {number[]} An array of indices correponding to the found items.
13912
+ */
13913
+ within(qx, qy, r) {
13914
+ if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
13915
+ const { ids, coords, nodeSize } = this, stack = [0, ids.length - 1, 0], result = [], r2 = r * r;
13916
+ for (; stack.length; ) {
13917
+ const axis = stack.pop() || 0, right = stack.pop() || 0, left = stack.pop() || 0;
13918
+ if (right - left <= nodeSize) {
13919
+ for (let i = left; i <= right; i++)
13920
+ sqDist(coords[2 * i], coords[2 * i + 1], qx, qy) <= r2 && result.push(ids[i]);
13921
+ continue;
13922
+ }
13923
+ const m = left + right >> 1, x = coords[2 * m], y = coords[2 * m + 1];
13924
+ sqDist(x, y, qx, qy) <= r2 && result.push(ids[m]), (axis === 0 ? qx - r <= x : qy - r <= y) && (stack.push(left), stack.push(m - 1), stack.push(1 - axis)), (axis === 0 ? qx + r >= x : qy + r >= y) && (stack.push(m + 1), stack.push(right), stack.push(1 - axis));
13925
+ }
13926
+ return result;
13927
+ }
13928
+ };
13929
+ __name(_KDBush, "KDBush");
13930
+ let KDBush = _KDBush;
13931
+ function sort(ids, coords, nodeSize, left, right, axis) {
13932
+ if (right - left <= nodeSize) return;
13933
+ const m = left + right >> 1;
13934
+ select(ids, coords, m, left, right, axis), sort(ids, coords, nodeSize, left, m - 1, 1 - axis), sort(ids, coords, nodeSize, m + 1, right, 1 - axis);
13935
+ }
13936
+ __name(sort, "sort");
13937
+ function select(ids, coords, k, left, right, axis) {
13938
+ for (; right > left; ) {
13939
+ if (right - left > 600) {
13940
+ const n = right - left + 1, m = k - left + 1, z = Math.log(n), s = 0.5 * Math.exp(2 * z / 3), sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1), newLeft = Math.max(left, Math.floor(k - m * s / n + sd)), newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
13941
+ select(ids, coords, k, newLeft, newRight, axis);
13942
+ }
13943
+ const t = coords[2 * k + axis];
13944
+ let i = left, j = right;
13945
+ for (swapItem(ids, coords, left, k), coords[2 * right + axis] > t && swapItem(ids, coords, left, right); i < j; ) {
13946
+ for (swapItem(ids, coords, i, j), i++, j--; coords[2 * i + axis] < t; ) i++;
13947
+ for (; coords[2 * j + axis] > t; ) j--;
13948
+ }
13949
+ coords[2 * left + axis] === t ? swapItem(ids, coords, left, j) : (j++, swapItem(ids, coords, j, right)), j <= k && (left = j + 1), k <= j && (right = j - 1);
13950
+ }
13951
+ }
13952
+ __name(select, "select");
13953
+ function swapItem(ids, coords, i, j) {
13954
+ swap$1(ids, i, j), swap$1(coords, 2 * i, 2 * j), swap$1(coords, 2 * i + 1, 2 * j + 1);
13955
+ }
13956
+ __name(swapItem, "swapItem");
13957
+ function swap$1(arr, i, j) {
13958
+ const tmp = arr[i];
13959
+ arr[i] = arr[j], arr[j] = tmp;
13960
+ }
13961
+ __name(swap$1, "swap$1");
13962
+ function sqDist(ax, ay, bx, by) {
13963
+ const dx = ax - bx, dy = ay - by;
13964
+ return dx * dx + dy * dy;
13965
+ }
13966
+ __name(sqDist, "sqDist");
13719
13967
  function quickselect(arr, k, left = 0, right = arr.length - 1, compare = defaultCompare) {
13720
13968
  for (; right > left; ) {
13721
13969
  if (right - left > 600) {
@@ -14004,8 +14252,13 @@ function multiSelect(arr, left, right, n, compare) {
14004
14252
  }
14005
14253
  __name(multiSelect, "multiSelect");
14006
14254
  const _RTree = class _RTree {
14007
- constructor() {
14255
+ constructor(_enableOneCellCache = !1) {
14008
14256
  __publicField(this, "_tree", /* @__PURE__ */ new Map());
14257
+ // unitId -> subUnitId -> row -> column -> ids
14258
+ __publicField(this, "_oneCellCache", /* @__PURE__ */ new Map());
14259
+ __publicField(this, "_kdTree", /* @__PURE__ */ new Map());
14260
+ __publicField(this, "_kdTreeSearchState", !1);
14261
+ this._enableOneCellCache = _enableOneCellCache;
14009
14262
  }
14010
14263
  dispose() {
14011
14264
  this.clear();
@@ -14013,12 +14266,83 @@ const _RTree = class _RTree {
14013
14266
  getTree(unitId, subUnitId) {
14014
14267
  return this._tree.has(unitId) || this._tree.set(unitId, /* @__PURE__ */ new Map()), this._tree.get(unitId).has(subUnitId) || this._tree.get(unitId).set(subUnitId, new RBush()), this._tree.get(unitId).get(subUnitId);
14015
14268
  }
14269
+ _getOneCellCache(unitId, subUnitId, row, column) {
14270
+ return this._oneCellCache.has(unitId) || this._oneCellCache.set(unitId, /* @__PURE__ */ new Map()), this._oneCellCache.get(unitId).has(subUnitId) || this._oneCellCache.get(unitId).set(subUnitId, /* @__PURE__ */ new Map()), this._oneCellCache.get(unitId).get(subUnitId).has(row) || this._oneCellCache.get(unitId).get(subUnitId).set(row, /* @__PURE__ */ new Map()), this._oneCellCache.get(unitId).get(subUnitId).get(row).has(column) || this._oneCellCache.get(unitId).get(subUnitId).get(row).set(column, /* @__PURE__ */ new Set()), this._oneCellCache.get(unitId).get(subUnitId).get(row).get(column);
14271
+ }
14272
+ _removeOneCellCache(unitId, subUnitId, row, column, id) {
14273
+ const unitCache = this._oneCellCache.get(unitId);
14274
+ if (!unitCache) return;
14275
+ const subUnitCache = unitCache.get(subUnitId);
14276
+ if (!subUnitCache) return;
14277
+ const rowCache = subUnitCache.get(row);
14278
+ if (!rowCache) return;
14279
+ const cellCache = rowCache.get(column);
14280
+ cellCache && cellCache.delete(id);
14281
+ }
14282
+ _insertOneCellCache(unitId, subUnitId, row, column, id) {
14283
+ this._getOneCellCache(unitId, subUnitId, row, column).add(id);
14284
+ }
14285
+ _getRdTreeItems(map2) {
14286
+ const items = [];
14287
+ for (const [y, innerMap] of map2)
14288
+ for (const [x, ids] of innerMap)
14289
+ items.push({
14290
+ x,
14291
+ y,
14292
+ ids
14293
+ });
14294
+ return items;
14295
+ }
14296
+ _searchByOneCellCache(search) {
14297
+ var _a11;
14298
+ const { unitId, sheetId: subUnitId, range } = search, { startRow, startColumn, endRow, endColumn } = range, searchObject = (_a11 = this._kdTree.get(unitId)) == null ? void 0 : _a11.get(subUnitId);
14299
+ if (!searchObject)
14300
+ return [];
14301
+ const { tree, items } = searchObject, indexes = tree.range(startColumn, startRow, endColumn, endRow), result = [];
14302
+ for (const index2 of indexes) {
14303
+ const item = items[index2];
14304
+ result.push(...Array.from(item.ids));
14305
+ }
14306
+ return result;
14307
+ }
14308
+ /**
14309
+ * Open the kd-tree search state.
14310
+ * The kd-tree is used to search for data in a single cell.
14311
+ */
14312
+ openKdTree() {
14313
+ var _a11;
14314
+ this._kdTreeSearchState = !0;
14315
+ for (const [unitId, map1] of this._oneCellCache) {
14316
+ this._kdTree.has(unitId) || this._kdTree.set(unitId, /* @__PURE__ */ new Map());
14317
+ for (const [subUnitId, map2] of map1) {
14318
+ const items = this._getRdTreeItems(map2), tree = new KDBush(items.length);
14319
+ (_a11 = this._kdTree.get(unitId)) == null || _a11.set(subUnitId, {
14320
+ tree,
14321
+ items
14322
+ });
14323
+ for (const item of items)
14324
+ tree.add(item.x, item.y);
14325
+ tree.finish();
14326
+ }
14327
+ }
14328
+ }
14329
+ closeKdTree() {
14330
+ var _a11;
14331
+ this._kdTreeSearchState = !1;
14332
+ for (const [unitId, map1] of this._oneCellCache)
14333
+ for (const [subUnitId, map2] of map1)
14334
+ (_a11 = this._kdTree.get(unitId)) == null || _a11.set(subUnitId, void 0);
14335
+ }
14016
14336
  insert(item) {
14017
14337
  const { unitId, sheetId: subUnitId, range, id } = item;
14018
14338
  if (!unitId || unitId.length === 0)
14019
14339
  return;
14020
- const tree = this.getTree(unitId, subUnitId);
14021
14340
  let { startRow: rangeStartRow, endRow: rangeEndRow, startColumn: rangeStartColumn, endColumn: rangeEndColumn } = range;
14341
+ if (this._enableOneCellCache && rangeStartRow === rangeEndRow && rangeStartColumn === rangeEndColumn) {
14342
+ this._insertOneCellCache(unitId, subUnitId, rangeStartRow, rangeStartColumn, id);
14343
+ return;
14344
+ }
14345
+ const tree = this.getTree(unitId, subUnitId);
14022
14346
  Number.isNaN(rangeStartRow) && (rangeStartRow = 0), Number.isNaN(rangeStartColumn) && (rangeStartColumn = 0), Number.isNaN(rangeEndRow) && (rangeEndRow = Number.POSITIVE_INFINITY), Number.isNaN(rangeEndColumn) && (rangeEndColumn = Number.POSITIVE_INFINITY), tree.insert({
14023
14347
  minX: rangeStartColumn,
14024
14348
  minY: rangeStartRow,
@@ -14033,30 +14357,41 @@ const _RTree = class _RTree {
14033
14357
  }
14034
14358
  search(search) {
14035
14359
  var _a11;
14036
- const { unitId, sheetId: subUnitId, range } = search, tree = (_a11 = this._tree.get(unitId)) == null ? void 0 : _a11.get(subUnitId);
14037
- return tree ? tree.search({
14360
+ const { unitId, sheetId: subUnitId, range } = search, results = [];
14361
+ if (this._enableOneCellCache && this._enableOneCellCache) {
14362
+ const oneCellResults = this._searchByOneCellCache(search);
14363
+ for (const result of oneCellResults)
14364
+ results.push(result);
14365
+ }
14366
+ const tree = (_a11 = this._tree.get(unitId)) == null ? void 0 : _a11.get(subUnitId);
14367
+ if (!tree)
14368
+ return results;
14369
+ const searchData = tree.search({
14038
14370
  minX: range.startColumn,
14039
14371
  minY: range.startRow,
14040
14372
  maxX: range.endColumn,
14041
14373
  maxY: range.endRow
14042
- }) : [];
14374
+ });
14375
+ for (const item of searchData)
14376
+ results.push(item.id);
14377
+ return results;
14043
14378
  }
14044
14379
  bulkSearch(searchList) {
14045
- const result = /* @__PURE__ */ new Map();
14380
+ const result = /* @__PURE__ */ new Set();
14046
14381
  for (const search of searchList) {
14047
14382
  const items = this.search(search);
14048
14383
  for (const item of items)
14049
- result.set(item.id, item);
14384
+ result.add(item);
14050
14385
  }
14051
14386
  return result;
14052
14387
  }
14053
14388
  removeById(unitId, subUnitId) {
14054
- var _a11;
14055
- subUnitId ? (_a11 = this._tree.get(unitId)) == null || _a11.delete(subUnitId) : this._tree.delete(unitId);
14389
+ var _a11, _b2;
14390
+ subUnitId ? ((_a11 = this._tree.get(unitId)) == null || _a11.delete(subUnitId), (_b2 = this._oneCellCache.get(unitId)) == null || _b2.delete(subUnitId)) : (this._tree.delete(unitId), this._oneCellCache.delete(unitId));
14056
14391
  }
14057
14392
  remove(search) {
14058
- const { unitId, sheetId: subUnitId, range, id } = search;
14059
- this.getTree(unitId, subUnitId).remove({
14393
+ const { unitId, sheetId: subUnitId, range, id } = search, tree = this.getTree(unitId, subUnitId);
14394
+ this._removeOneCellCache(unitId, subUnitId, range.startRow, range.startColumn, id), tree.remove({
14060
14395
  minX: range.startColumn,
14061
14396
  minY: range.startRow,
14062
14397
  maxX: range.endColumn,
@@ -14069,7 +14404,7 @@ const _RTree = class _RTree {
14069
14404
  this.remove(search);
14070
14405
  }
14071
14406
  clear() {
14072
- this._tree.clear();
14407
+ this._tree.clear(), this._oneCellCache.clear();
14073
14408
  }
14074
14409
  toJSON() {
14075
14410
  const result = {};
@@ -14105,11 +14440,11 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
14105
14440
  const handleHookAdd = /* @__PURE__ */ __name((hook) => {
14106
14441
  hook.businesses.forEach((business) => {
14107
14442
  switch (business) {
14108
- case R.UNRECOGNIZED:
14109
- case R.UNIVER_UNKNOWN:
14110
- case R.UNIVER_SLIDE:
14111
- case R.UNIVER_DOC: {
14112
- this._univerInstanceService.getAllUnitsForType(R.UNIVER_DOC).forEach((doc) => {
14443
+ case _.UNRECOGNIZED:
14444
+ case _.UNIVER_UNKNOWN:
14445
+ case _.UNIVER_SLIDE:
14446
+ case _.UNIVER_DOC: {
14447
+ this._univerInstanceService.getAllUnitsForType(_.UNIVER_DOC).forEach((doc) => {
14113
14448
  const plugin = (doc.getSnapshot().resources || []).find((r) => r.name === hook.pluginName);
14114
14449
  if (plugin)
14115
14450
  try {
@@ -14121,8 +14456,8 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
14121
14456
  });
14122
14457
  break;
14123
14458
  }
14124
- case R.UNIVER_SHEET:
14125
- this._univerInstanceService.getAllUnitsForType(R.UNIVER_SHEET).forEach((workbook) => {
14459
+ case _.UNIVER_SHEET:
14460
+ this._univerInstanceService.getAllUnitsForType(_.UNIVER_SHEET).forEach((workbook) => {
14126
14461
  const plugin = (workbook.getSnapshot().resources || []).find((r) => r.name === hook.pluginName);
14127
14462
  if (plugin)
14128
14463
  try {
@@ -14136,20 +14471,20 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
14136
14471
  });
14137
14472
  }, "handleHookAdd");
14138
14473
  this._resourceManagerService.getAllResourceHooks().forEach((hook) => handleHookAdd(hook)), this.disposeWithMe(this._resourceManagerService.register$.subscribe((hook) => handleHookAdd(hook))), this.disposeWithMe(
14139
- this._univerInstanceService.getTypeOfUnitAdded$(R.UNIVER_SHEET).subscribe((workbook) => {
14474
+ this._univerInstanceService.getTypeOfUnitAdded$(_.UNIVER_SHEET).subscribe((workbook) => {
14140
14475
  this._resourceManagerService.loadResources(workbook.getUnitId(), workbook.getSnapshot().resources);
14141
14476
  })
14142
14477
  ), this.disposeWithMe(
14143
- this._univerInstanceService.getTypeOfUnitAdded$(R.UNIVER_DOC).subscribe((doc) => {
14478
+ this._univerInstanceService.getTypeOfUnitAdded$(_.UNIVER_DOC).subscribe((doc) => {
14144
14479
  const unitId = doc.getUnitId();
14145
14480
  isInternalEditorID(unitId) || this._resourceManagerService.loadResources(doc.getUnitId(), doc.getSnapshot().resources);
14146
14481
  })
14147
14482
  ), this.disposeWithMe(
14148
- this._univerInstanceService.getTypeOfUnitDisposed$(R.UNIVER_SHEET).subscribe((workbook) => {
14483
+ this._univerInstanceService.getTypeOfUnitDisposed$(_.UNIVER_SHEET).subscribe((workbook) => {
14149
14484
  this._resourceManagerService.unloadResources(workbook.getUnitId());
14150
14485
  })
14151
14486
  ), this.disposeWithMe(
14152
- this._univerInstanceService.getTypeOfUnitDisposed$(R.UNIVER_DOC).subscribe((doc) => {
14487
+ this._univerInstanceService.getTypeOfUnitDisposed$(_.UNIVER_DOC).subscribe((doc) => {
14153
14488
  this._resourceManagerService.unloadResources(doc.getUnitId());
14154
14489
  })
14155
14490
  );
@@ -14202,22 +14537,22 @@ const _Univer = class _Univer {
14202
14537
  * @deprecated use `createUnit` instead
14203
14538
  */
14204
14539
  createUniverSheet(data) {
14205
- return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(R.UNIVER_SHEET, data);
14540
+ return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(_.UNIVER_SHEET, data);
14206
14541
  }
14207
14542
  /**
14208
14543
  * @deprecated use `createUnit` instead
14209
14544
  */
14210
14545
  createUniverDoc(data) {
14211
- return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(R.UNIVER_DOC, data);
14546
+ return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(_.UNIVER_DOC, data);
14212
14547
  }
14213
14548
  /**
14214
14549
  * @deprecated use `createUnit` instead
14215
14550
  */
14216
14551
  createUniverSlide(data) {
14217
- return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(R.UNIVER_SLIDE, data);
14552
+ return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(_.UNIVER_SLIDE, data);
14218
14553
  }
14219
14554
  _init(injector) {
14220
- this._univerInstanceService.registerCtorForType(R.UNIVER_SHEET, Workbook), this._univerInstanceService.registerCtorForType(R.UNIVER_DOC, DocumentDataModel), this._univerInstanceService.registerCtorForType(R.UNIVER_SLIDE, SlideDataModel);
14555
+ this._univerInstanceService.registerCtorForType(_.UNIVER_SHEET, Workbook), this._univerInstanceService.registerCtorForType(_.UNIVER_DOC, DocumentDataModel), this._univerInstanceService.registerCtorForType(_.UNIVER_SLIDE, SlideDataModel);
14221
14556
  const univerInstanceService = injector.get(IUniverInstanceService);
14222
14557
  univerInstanceService.__setCreateHandler(
14223
14558
  (type2, data, ctor, options) => {
@@ -14383,6 +14718,7 @@ export {
14383
14718
  IPermissionService,
14384
14719
  IResourceLoaderService,
14385
14720
  IResourceManagerService,
14721
+ IS_ROW_STYLE_PRECEDE_COLUMN_STYLE,
14386
14722
  IUndoRedoService,
14387
14723
  IUniverInstanceService,
14388
14724
  Inject,
@@ -14482,7 +14818,7 @@ export {
14482
14818
  UnitModel,
14483
14819
  Univer,
14484
14820
  UniverInstanceService,
14485
- R as UniverInstanceType,
14821
+ _ as UniverInstanceType,
14486
14822
  UpdateDocsAttributeType,
14487
14823
  UserManagerService,
14488
14824
  VerticalAlign,
@@ -14507,6 +14843,7 @@ export {
14507
14843
  codeToBlob,
14508
14844
  composeBody,
14509
14845
  composeInterceptors,
14846
+ composeStyles,
14510
14847
  concatMatrixArray,
14511
14848
  connectDependencies,
14512
14849
  connectInjector,
@@ -14577,10 +14914,10 @@ export {
14577
14914
  makeCellRangeToRangeData,
14578
14915
  makeCellToSelection,
14579
14916
  makeCustomRangeStream,
14580
- merge$1 as merge,
14917
+ merge,
14581
14918
  mergeOverrideWithDependencies,
14582
14919
  mergeSets,
14583
- mergeWith$1 as mergeWith,
14920
+ mergeWith,
14584
14921
  mergeWorksheetSnapshotWithDefault,
14585
14922
  mixinClass,
14586
14923
  moveMatrixArray,