@univerjs/core 0.4.0-alpha.0 → 0.4.0-alpha.2

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,9 +2,8 @@ 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, merge as merge$1, timer, map, distinctUntilChanged, skip, of, combineLatest } from "rxjs";
6
- import { filter as filter$1, debounceTime, first, map as map$1 } from "rxjs/operators";
7
- import { Tools as Tools$1, normalizeTextRuns as normalizeTextRuns$1, generateRandomId as generateRandomId$1, DataStreamTreeTokenType as DataStreamTreeTokenType$1 } from "@univerjs/core";
5
+ import { BehaviorSubject, Subject, Observable, filter, tap, debounceTime, map, merge as merge$2, timer, distinctUntilChanged, skip, of, combineLatest } from "rxjs";
6
+ import { filter as filter$1, debounceTime as debounceTime$1, first, map as map$1 } from "rxjs/operators";
8
7
  import * as React from "react";
9
8
  import React__default, { useState, useEffect, useRef, useMemo, createContext, useCallback, useContext } from "react";
10
9
  function _mergeNamespaces(n, m) {
@@ -805,9 +804,12 @@ function baseMerge(object, source, srcIndex, customizer, stack) {
805
804
  __name(baseMerge, "baseMerge");
806
805
  var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
807
806
  baseMerge(object, source, srcIndex, customizer);
808
- }), merge = createAssigner(function(object, source, srcIndex) {
807
+ });
808
+ const mergeWith$1 = mergeWith;
809
+ var merge = createAssigner(function(object, source, srcIndex) {
809
810
  baseMerge(object, source, srcIndex);
810
811
  });
812
+ const merge$1 = merge;
811
813
  function baseSet(object, path, value, customizer) {
812
814
  if (!isObject$1(object))
813
815
  return object;
@@ -2650,11 +2652,23 @@ function takeAfter(callback) {
2650
2652
  }, "complateAfter");
2651
2653
  }
2652
2654
  __name(takeAfter, "takeAfter");
2655
+ function bufferDebounceTime(time = 0) {
2656
+ return (source) => {
2657
+ let bufferedValues = [];
2658
+ return source.pipe(
2659
+ tap((value) => bufferedValues.push(value)),
2660
+ debounceTime(time),
2661
+ map(() => bufferedValues),
2662
+ tap(() => bufferedValues = [])
2663
+ );
2664
+ };
2665
+ }
2666
+ __name(bufferDebounceTime, "bufferDebounceTime");
2653
2667
  const afterInitApply = /* @__PURE__ */ __name((commandService) => new Promise((res) => {
2654
- merge$1(
2668
+ merge$2(
2655
2669
  fromCallback(commandService.onCommandExecuted.bind(commandService)).pipe(filter$1(([info]) => info.type === CommandType.MUTATION)),
2656
2670
  timer(300)
2657
- ).pipe(debounceTime(16), first()).subscribe(() => {
2671
+ ).pipe(debounceTime$1(16), first()).subscribe(() => {
2658
2672
  res();
2659
2673
  });
2660
2674
  }), "afterInitApply");
@@ -5049,7 +5063,7 @@ var numfmt$2 = { exports: {} };
5049
5063
  return { pattern: e2, partitions: t2, locale: n2 };
5050
5064
  }
5051
5065
  __name(D, "D");
5052
- const S = Math.floor;
5066
+ const S2 = Math.floor;
5053
5067
  function C(e2) {
5054
5068
  if ((!(arguments.length > 1 && arguments[1] !== void 0) || arguments[1]) && e2 >= 0) {
5055
5069
  if (e2 === 0) return [1900, 1, 0];
@@ -5057,12 +5071,12 @@ var numfmt$2 = { exports: {} };
5057
5071
  if (e2 < 60) return [1900, e2 < 32 ? 1 : 2, (e2 - 1) % 31 + 1];
5058
5072
  }
5059
5073
  let n2 = e2 + 68569 + 2415019;
5060
- const a2 = S(4 * n2 / 146097);
5061
- n2 -= S((146097 * a2 + 3) / 4);
5062
- const r2 = S(4e3 * (n2 + 1) / 1461001);
5063
- n2 = n2 - S(1461 * r2 / 4) + 31;
5064
- const i2 = S(80 * n2 / 2447), s2 = n2 - S(2447 * i2 / 80);
5065
- n2 = S(i2 / 11);
5074
+ const a2 = S2(4 * n2 / 146097);
5075
+ n2 -= S2((146097 * a2 + 3) / 4);
5076
+ const r2 = S2(4e3 * (n2 + 1) / 1461001);
5077
+ n2 = n2 - S2(1461 * r2 / 4) + 31;
5078
+ const i2 = S2(80 * n2 / 2447), s2 = n2 - S2(2447 * i2 / 80);
5079
+ n2 = S2(i2 / 11);
5066
5080
  const o2 = i2 + 2 - 12 * n2;
5067
5081
  return [0 | 100 * (a2 - 49) + r2 + n2, 0 | o2, 0 | s2];
5068
5082
  }
@@ -5077,21 +5091,21 @@ var numfmt$2 = { exports: {} };
5077
5091
  if (e2 < 60) return [1317, e2 < 32 ? 9 : 10, 1 + (e2 - 2) % 30];
5078
5092
  const t2 = 10631 / 30, n2 = 0.1335;
5079
5093
  let a2 = e2 + 466935;
5080
- const r2 = S(a2 / 10631);
5094
+ const r2 = S2(a2 / 10631);
5081
5095
  a2 -= 10631 * r2;
5082
- const i2 = S((a2 - n2) / t2);
5083
- a2 -= S(i2 * t2 + n2);
5084
- const s2 = S((a2 + 28.5001) / 29.5);
5085
- return s2 === 13 ? [30 * r2 + i2, 12, 30] : [30 * r2 + i2, s2, a2 - S(29.5001 * s2 - 29)];
5096
+ const i2 = S2((a2 - n2) / t2);
5097
+ a2 -= S2(i2 * t2 + n2);
5098
+ const s2 = S2((a2 + 28.5001) / 29.5);
5099
+ return s2 === 13 ? [30 * r2 + i2, 12, 30] : [30 * r2 + i2, s2, a2 - S2(29.5001 * s2 - 29)];
5086
5100
  }
5087
5101
  __name(A, "A");
5088
5102
  function Y(e2) {
5089
5103
  let t2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n2 = !(arguments.length > 2 && arguments[2] !== void 0) || arguments[2];
5090
- const a2 = S(e2);
5104
+ const a2 = S2(e2);
5091
5105
  return t2 === 6 ? A(a2) : t2 === -1 ? E(a2) : C(a2, n2);
5092
5106
  }
5093
5107
  __name(Y, "Y");
5094
- const T = Math.floor, N = 86400;
5108
+ const T2 = Math.floor, N = 86400;
5095
5109
  function P(e2, t2) {
5096
5110
  let n2 = null;
5097
5111
  if (Array.isArray(e2)) {
@@ -5108,19 +5122,19 @@ var numfmt$2 = { exports: {} };
5108
5122
  return e2;
5109
5123
  }
5110
5124
  __name(P, "P");
5111
- function I2(e2, t2) {
5125
+ function I(e2, t2) {
5112
5126
  let n2 = 0 | e2;
5113
5127
  const a2 = N * (e2 - n2);
5114
- let r2 = T(a2);
5128
+ let r2 = T2(a2);
5115
5129
  a2 - r2 > 0.9999 && (r2 += 1, r2 === N && (r2 = 0, n2 += 1));
5116
- 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;
5130
+ 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;
5117
5131
  if (t2 && t2.nativeDate) {
5118
5132
  const e3 = /* @__PURE__ */ new Date(0);
5119
5133
  return e3.setUTCFullYear(s2, o2 - 1, l2), e3.setUTCHours(d2, m2, u2), e3;
5120
5134
  }
5121
5135
  return [s2, o2, l2, d2, m2, u2];
5122
5136
  }
5123
- __name(I2, "I");
5137
+ __name(I, "I");
5124
5138
  function O(e2) {
5125
5139
  return !!(e2[0] && e2[0].percent || e2[1] && e2[1].percent || e2[2] && e2[2].percent || e2[3] && e2[3].percent);
5126
5140
  }
@@ -5134,7 +5148,7 @@ var numfmt$2 = { exports: {} };
5134
5148
  return !(t2 && !t2.generated || n2 && !n2.generated || a2 && !a2.generated || !r2 || !r2.text || r2.generated);
5135
5149
  }
5136
5150
  __name(L, "L");
5137
- 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 }, H2 = /* @__PURE__ */ __name((e2, t2) => e2.replace(/\./, t2.decimal), "H");
5151
+ 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");
5138
5152
  function B(e2, t2, n2, a2) {
5139
5153
  const r2 = 0 | n2;
5140
5154
  if (typeof n2 == "string") e2.push(n2);
@@ -5146,7 +5160,7 @@ var numfmt$2 = { exports: {} };
5146
5160
  const s2 = function(e3) {
5147
5161
  let t4 = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
5148
5162
  const n3 = Math.abs(e3);
5149
- if (!n3) return G2;
5163
+ if (!n3) return G;
5150
5164
  const a3 = t4 && e3 < 0 ? 1 : 0, r4 = Math.floor(n3), i3 = Math.floor(Math.log10(n3) + 1);
5151
5165
  let s3 = 0, o3 = 0;
5152
5166
  if (r4 !== n3) {
@@ -5166,19 +5180,19 @@ var numfmt$2 = { exports: {} };
5166
5180
  }(t3), o2 = /* @__PURE__ */ __name(() => {
5167
5181
  const t4 = Math.abs(r3);
5168
5182
  let n3;
5169
- n3 = i2 === 1 ? i2 : c(i2, 5), e2.push(H2(n3 + "", a2), a2.exponent, r3 < 0 ? a2.negative : a2.positive, t4 < 10 ? "0" : "", t4);
5183
+ n3 = i2 === 1 ? i2 : c(i2, 5), e2.push(H(n3 + "", a2), a2.exponent, r3 < 0 ? a2.negative : a2.positive, t4 < 10 ? "0" : "", t4);
5170
5184
  }, "o");
5171
5185
  if (r3 >= -4 && r3 <= -1) {
5172
5186
  const n3 = t3.toPrecision(10 + r3).replace(/\.?0+$/, "");
5173
- e2.push(H2(n3, a2));
5187
+ e2.push(H(n3, a2));
5174
5188
  } else if (r3 === 10) {
5175
5189
  const n3 = t3.toFixed(10).slice(0, 12).replace(/\.$/, "");
5176
- e2.push(H2(n3, a2));
5190
+ e2.push(H(n3, a2));
5177
5191
  } else if (Math.abs(r3) <= 9) if (s2.total <= 11) {
5178
5192
  const n3 = c(t3, 9).toFixed(s2.frac);
5179
- e2.push(H2(n3, a2));
5193
+ e2.push(H(n3, a2));
5180
5194
  } else r3 === 9 ? e2.push(Math.floor(t3)) : r3 >= 0 && r3 < 9 ? e2.push(c(t3, 9 - r3)) : o2();
5181
- else s2.total >= 12 ? o2() : Math.floor(t3) === t3 ? e2.push(Math.floor(t3)) : e2.push(H2(c(t3, 9).toFixed(s2.frac), a2));
5195
+ else s2.total >= 12 ? o2() : Math.floor(t3) === t3 ? e2.push(Math.floor(t3)) : e2.push(H(c(t3, 9).toFixed(s2.frac), a2));
5182
5196
  }
5183
5197
  return e2;
5184
5198
  }
@@ -5248,7 +5262,7 @@ var numfmt$2 = { exports: {} };
5248
5262
  r2 = t2.man_padding.length === 1 ? (d2 < 0 ? "-" : e3) + (r2 || t2.man_padding) : (d2 < 0 ? "-" : e3) + t2.man_padding.slice(0, t2.man_padding.length - r2.length) + r2;
5249
5263
  }
5250
5264
  const D2 = [];
5251
- let S2 = 0;
5265
+ let S3 = 0;
5252
5266
  const C2 = { int: 0, frac: 0, man: 0, num: 0, den: 0 };
5253
5267
  for (let d3 = 0, u2 = t2.tokens.length; d3 < u2; d3++) {
5254
5268
  const u3 = t2.tokens[d3], c2 = u3.num ? u3.num.length : 0;
@@ -5263,8 +5277,8 @@ var numfmt$2 = { exports: {} };
5263
5277
  else if (u3.type === "div") F2 ? D2.push("/") : t2.num_min > 0 || t2.den_min > 0 ? D2.push(y["?"]) : D2.push(y["#"]);
5264
5278
  else if (u3.type === "int") if (t2.int_pattern.length === 1) D2.push(l2);
5265
5279
  else {
5266
- const e3 = S2 ? t2.int_pattern.join("").length - C2.int : 1 / 0, n3 = S2 === t2.int_pattern.length - 1 ? 0 : t2.int_pattern.join("").length - (C2.int + u3.num.length);
5267
- D2.push(l2.substring(l2.length - e3, l2.length - n3)), S2++, C2.int += u3.num.length;
5280
+ const e3 = S3 ? t2.int_pattern.join("").length - C2.int : 1 / 0, n3 = S3 === t2.int_pattern.length - 1 ? 0 : t2.int_pattern.join("").length - (C2.int + u3.num.length);
5281
+ D2.push(l2.substring(l2.length - e3, l2.length - n3)), S3++, C2.int += u3.num.length;
5268
5282
  }
5269
5283
  else if (u3.type === "frac") {
5270
5284
  const e3 = C2.frac;
@@ -5463,7 +5477,7 @@ var numfmt$2 = { exports: {} };
5463
5477
  const i2 = Date.UTC(e3, n2.month - 1, n2.day) / 864e5 + r2 + (n2.time || 0);
5464
5478
  if (i2 >= 0 && i2 <= 2958465) {
5465
5479
  const e4 = n2._mon[0] === "0" || n2.day[0] === "0" || n2._mon.length === 2 && n2.day.length === 2, a3 = n2.path.replace(/[jdlDnmMFyYx-]/g, (t3) => t3 === "j" || t3 === "d" ? e4 ? "dd" : "d" : t3 === "D" ? "ddd" : t3 === "l" ? "dddd" : t3 === "n" || t3 === "m" ? e4 ? "mm" : "m" : t3 === "M" ? "mmm" : t3 === "F" ? "mmmm" : t3 === "y" ? "yy" : t3 === "x" ? n2.tf || "" : t3 === "Y" ? "yyyy" : t3);
5466
- return t2 && t2.nativeDate ? { v: I2(i2, t2), z: a3 } : { v: i2, z: a3 };
5480
+ return t2 && t2.nativeDate ? { v: I(i2, t2), z: a3 } : { v: i2, z: a3 };
5467
5481
  }
5468
5482
  }
5469
5483
  return null;
@@ -5525,7 +5539,7 @@ var numfmt$2 = { exports: {} };
5525
5539
  const r5 = a4.type;
5526
5540
  /^(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++);
5527
5541
  }), s3.type = "date", t4 && e4 ? s3.type = "datetime" : !t4 && e4 && (s3.type = "time");
5528
- const r4 = R.find((e5) => n4.startsWith(e5[0]));
5542
+ const r4 = R2.find((e5) => n4.startsWith(e5[0]));
5529
5543
  l2 = r4 ? "D" : "G", d2 = r4 ? r4[1] : "";
5530
5544
  } 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");
5531
5545
  return s3.code = l2 + d2 + u2 + m2, s3.level = U[s3.type], Object.freeze(s3);
@@ -5548,7 +5562,7 @@ var numfmt$2 = { exports: {} };
5548
5562
  }
5549
5563
  }(e2), n2.error || (me[e2] = n2)), ue(n2, t2);
5550
5564
  }
5551
- __name(ce, "ce"), ce.isDate = (e2) => ce(e2, { throws: !1 }).isDate(), ce.isPercent = (e2) => ce(e2, { throws: !1 }).isPercent(), ce.isText = (e2) => ce(e2, { throws: !1 }).isText(), ce.getInfo = (e2, t2) => ce(e2, { ...t2, throws: !1 }).info, ce.getDateInfo = (e2, t2) => ce(e2, { ...t2, throws: !1 }).dateInfo, ce.dateToSerial = P, ce.dateFromSerial = I2, ce.options = h, ce.dec2frac = p, ce.round = c, ce.codeToLocale = n, ce.parseLocale = s, ce.getLocale = l, ce.addLocale = (e2, t2) => {
5565
+ __name(ce, "ce"), ce.isDate = (e2) => ce(e2, { throws: !1 }).isDate(), ce.isPercent = (e2) => ce(e2, { throws: !1 }).isPercent(), ce.isText = (e2) => ce(e2, { throws: !1 }).isText(), ce.getInfo = (e2, t2) => ce(e2, { ...t2, throws: !1 }).info, ce.getDateInfo = (e2, t2) => ce(e2, { ...t2, throws: !1 }).dateInfo, ce.dateToSerial = P, ce.dateFromSerial = I, ce.options = h, ce.dec2frac = p, ce.round = c, ce.codeToLocale = n, ce.parseLocale = s, ce.getLocale = l, ce.addLocale = (e2, t2) => {
5552
5566
  const n2 = s(t2);
5553
5567
  return delete me[n2.lang], delete me[n2.language], m(e2, n2);
5554
5568
  }, ce.format = function(e2, t2, n2) {
@@ -7126,7 +7140,7 @@ function sortRulesFactory(key = "index", ruler = 1) {
7126
7140
  return (oa, ob) => oa[key] > ob[key] ? ruler : oa[key] === ob[key] ? 0 : -ruler;
7127
7141
  }
7128
7142
  __name(sortRulesFactory, "sortRulesFactory");
7129
- var I = /* @__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))(I || {}), G = /* @__PURE__ */ ((E) => (E[E.Reader = 0] = "Reader", E[E.Editor = 1] = "Editor", E[E.Owner = 2] = "Owner", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(G || {}), H = /* @__PURE__ */ ((E) => (E[E.SomeCollaborator = 0] = "SomeCollaborator", E[E.AllCollaborator = 1] = "AllCollaborator", E[E.OneSelf = 2] = "OneSelf", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(H || {});
7143
+ 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 || {});
7130
7144
  const _UnitModel = class _UnitModel extends Disposable {
7131
7145
  };
7132
7146
  __name(_UnitModel, "UnitModel");
@@ -9425,7 +9439,7 @@ function updateSectionBreaks(body, updateBody, textLength, currentIndex, coverTy
9425
9439
  }
9426
9440
  updateBody.sectionBreaks = newUpdateSectionBreaks;
9427
9441
  }
9428
- return insertParagraphs(body, updateBody, textLength, currentIndex), removeSectionBreaks;
9442
+ return insertSectionBreaks(body, updateBody, textLength, currentIndex), removeSectionBreaks;
9429
9443
  }
9430
9444
  __name(updateSectionBreaks, "updateSectionBreaks");
9431
9445
  function updateCustomBlocks(body, updateBody, textLength, currentIndex, coverType) {
@@ -9545,7 +9559,7 @@ function getBodySlice(body, startOffset, endOffset, returnEmptyTextRun = !1, typ
9545
9559
  const newParagraphs = [];
9546
9560
  for (const paragraph of paragraphs) {
9547
9561
  const { startIndex } = paragraph;
9548
- startIndex >= startOffset && startIndex <= endOffset && newParagraphs.push(Tools.deepClone(paragraph));
9562
+ startIndex >= startOffset && startIndex < endOffset && newParagraphs.push(Tools.deepClone(paragraph));
9549
9563
  }
9550
9564
  newParagraphs.length && (docBody.paragraphs = newParagraphs.map((p) => ({
9551
9565
  ...p,
@@ -9785,7 +9799,7 @@ __name(textXApply, "textXApply");
9785
9799
  function transformTextRuns(originTextRuns, targetTextRuns, transformType) {
9786
9800
  if (originTextRuns.length === 0)
9787
9801
  return targetTextRuns;
9788
- targetTextRuns = Tools$1.deepClone(targetTextRuns), originTextRuns = Tools$1.deepClone(originTextRuns);
9802
+ targetTextRuns = Tools.deepClone(targetTextRuns), originTextRuns = Tools.deepClone(originTextRuns);
9789
9803
  const newUpdateTextRuns = [], updateLength = targetTextRuns.length, removeLength = originTextRuns.length;
9790
9804
  let updateIndex = 0, removeIndex = 0, pending = null;
9791
9805
  function pushPendingAndReturnStatus() {
@@ -9829,7 +9843,7 @@ function transformTextRuns(originTextRuns, targetTextRuns, transformType) {
9829
9843
  }
9830
9844
  pushPendingAndReturnStatus();
9831
9845
  const tempTopTextRun = newUpdateTextRuns[newUpdateTextRuns.length - 1], updateLastTextRun = targetTextRuns[updateLength - 1], removeLastTextRun = originTextRuns[removeLength - 1];
9832
- return tempTopTextRun.ed !== Math.max(updateLastTextRun.ed, removeLastTextRun.ed) && (updateLastTextRun.ed > removeLastTextRun.ed ? newUpdateTextRuns.push(updateLastTextRun) : newUpdateTextRuns.push(removeLastTextRun)), normalizeTextRuns$1(newUpdateTextRuns);
9846
+ return tempTopTextRun.ed !== Math.max(updateLastTextRun.ed, removeLastTextRun.ed) && (updateLastTextRun.ed > removeLastTextRun.ed ? newUpdateTextRuns.push(updateLastTextRun) : newUpdateTextRuns.push(removeLastTextRun)), normalizeTextRuns(newUpdateTextRuns);
9833
9847
  }
9834
9848
  __name(transformTextRuns, "transformTextRuns");
9835
9849
  function transformParagraph(originParagraph, targetParagraph, transformType) {
@@ -9892,7 +9906,7 @@ function transformBody(thisAction, otherAction, priority = !1) {
9892
9906
  0
9893
9907
  /* COVER */
9894
9908
  ), paragraphs.push(paragraph), thisIndex++, otherIndex++;
9895
- } else thisStart < otherStart ? thisIndex++ : (paragraphs.push(Tools$1.deepClone(otherParagraph)), otherIndex++);
9909
+ } else thisStart < otherStart ? thisIndex++ : (paragraphs.push(Tools.deepClone(otherParagraph)), otherIndex++);
9896
9910
  }
9897
9911
  return otherIndex < otherParagraphs.length && paragraphs.push(...otherParagraphs.slice(otherIndex)), paragraphs.length && (retBody.paragraphs = paragraphs), retBody;
9898
9912
  }
@@ -10185,7 +10199,7 @@ const DEFAULT_DOC = {
10185
10199
  constructor(snapshot) {
10186
10200
  var _a11;
10187
10201
  super();
10188
- __publicField(this, "type", I.UNIVER_DOC);
10202
+ __publicField(this, "type", R.UNIVER_DOC);
10189
10203
  __publicField(this, "_name$", new BehaviorSubject(""));
10190
10204
  __publicField(this, "name$", this._name$.asObservable());
10191
10205
  __publicField(this, "snapshot");
@@ -10364,7 +10378,7 @@ const _DocumentDataModel = class _DocumentDataModel extends DocumentDataModelSim
10364
10378
  __name(_DocumentDataModel, "DocumentDataModel");
10365
10379
  let DocumentDataModel = _DocumentDataModel;
10366
10380
  function isCustomRangeSplitSymbol(text) {
10367
- return text === DataStreamTreeTokenType$1.CUSTOM_RANGE_END || text === DataStreamTreeTokenType$1.CUSTOM_RANGE_START;
10381
+ return text === DataStreamTreeTokenType.CUSTOM_RANGE_END || text === DataStreamTreeTokenType.CUSTOM_RANGE_START;
10368
10382
  }
10369
10383
  __name(isCustomRangeSplitSymbol, "isCustomRangeSplitSymbol");
10370
10384
  function isIntersecting(line1Start, line1End, line2Start, line2End) {
@@ -10397,8 +10411,8 @@ function getCustomRangesInterestsWithRange(range, customRanges) {
10397
10411
  __name(getCustomRangesInterestsWithRange, "getCustomRangesInterestsWithRange");
10398
10412
  function copyCustomRange(range) {
10399
10413
  return {
10400
- ...Tools$1.deepClone(range),
10401
- rangeId: generateRandomId$1()
10414
+ ...Tools.deepClone(range),
10415
+ rangeId: generateRandomId()
10402
10416
  };
10403
10417
  }
10404
10418
  __name(copyCustomRange, "copyCustomRange");
@@ -10410,6 +10424,184 @@ function excludePointsFromRange(range, points) {
10410
10424
  return start <= range[1] && newRanges.push([start, range[1]]), newRanges;
10411
10425
  }
10412
10426
  __name(excludePointsFromRange, "excludePointsFromRange");
10427
+ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
10428
+ var _a11, _b2, _c;
10429
+ const { paragraphs: currentParagraphs, segmentId, document: docDataModel } = params;
10430
+ let listType = params.listType;
10431
+ const paragraphs = (_b2 = (_a11 = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) == null ? void 0 : _a11.paragraphs) != null ? _b2 : [], isAlreadyList = currentParagraphs.every((paragraph) => {
10432
+ var _a12;
10433
+ return ((_a12 = paragraph.bullet) == null ? void 0 : _a12.listType.indexOf(listType)) === 0;
10434
+ });
10435
+ let listId = Tools.generateRandomId(6);
10436
+ if (currentParagraphs.length === 1) {
10437
+ const curIndex = paragraphs.indexOf(currentParagraphs[0]), prevParagraph = paragraphs[curIndex - 1], nextParagraph = paragraphs[curIndex + 1];
10438
+ prevParagraph && prevParagraph.bullet && prevParagraph.bullet.listType.indexOf(listType) === 0 ? (listId = prevParagraph.bullet.listId, listType !== PresetListType.CHECK_LIST && (listType = prevParagraph.bullet.listType)) : nextParagraph && nextParagraph.bullet && nextParagraph.bullet.listType.indexOf(listType) === 0 && (listId = nextParagraph.bullet.listId, listType !== PresetListType.CHECK_LIST && (listType = nextParagraph.bullet.listType));
10439
+ }
10440
+ const memoryCursor = new MemoryCursor();
10441
+ memoryCursor.reset();
10442
+ const textX = new TextX();
10443
+ for (const paragraph of currentParagraphs) {
10444
+ const { startIndex, paragraphStyle = {}, bullet } = paragraph;
10445
+ textX.push({
10446
+ t: TextXActionType.RETAIN,
10447
+ len: startIndex - memoryCursor.cursor,
10448
+ segmentId
10449
+ }), textX.push({
10450
+ t: TextXActionType.RETAIN,
10451
+ len: 1,
10452
+ body: {
10453
+ dataStream: "",
10454
+ paragraphs: [
10455
+ isAlreadyList ? {
10456
+ paragraphStyle,
10457
+ startIndex: 0
10458
+ } : {
10459
+ startIndex: 0,
10460
+ paragraphStyle: {
10461
+ ...paragraphStyle
10462
+ },
10463
+ bullet: {
10464
+ nestingLevel: (_c = bullet == null ? void 0 : bullet.nestingLevel) != null ? _c : 0,
10465
+ textStyle: {
10466
+ fs: 20
10467
+ },
10468
+ listType,
10469
+ listId
10470
+ }
10471
+ }
10472
+ ]
10473
+ },
10474
+ segmentId,
10475
+ coverType: UpdateDocsAttributeType.REPLACE
10476
+ }), memoryCursor.moveCursorTo(startIndex + 1);
10477
+ }
10478
+ return textX;
10479
+ }, "switchParagraphBullet"), toggleChecklistParagraph = /* @__PURE__ */ __name((params) => {
10480
+ var _a11;
10481
+ const { paragraphIndex, segmentId, document: docDataModel } = params, paragraphs = (_a11 = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) == null ? void 0 : _a11.paragraphs;
10482
+ if (paragraphs == null)
10483
+ return !1;
10484
+ const currentParagraph = paragraphs.find((p) => p.startIndex === paragraphIndex);
10485
+ if (!(currentParagraph != null && currentParagraph.bullet) || currentParagraph.bullet.listType.indexOf(PresetListType.CHECK_LIST) === -1)
10486
+ return !1;
10487
+ const memoryCursor = new MemoryCursor();
10488
+ memoryCursor.reset();
10489
+ const textX = new TextX(), { startIndex, paragraphStyle = {} } = currentParagraph, listType = currentParagraph.bullet.listType === PresetListType.CHECK_LIST ? PresetListType.CHECK_LIST_CHECKED : PresetListType.CHECK_LIST;
10490
+ return textX.push({
10491
+ t: TextXActionType.RETAIN,
10492
+ len: startIndex - memoryCursor.cursor,
10493
+ segmentId
10494
+ }), textX.push({
10495
+ t: TextXActionType.RETAIN,
10496
+ len: 1,
10497
+ body: {
10498
+ dataStream: "",
10499
+ paragraphs: [
10500
+ {
10501
+ ...currentParagraph,
10502
+ paragraphStyle,
10503
+ startIndex: 0,
10504
+ bullet: {
10505
+ ...currentParagraph.bullet,
10506
+ listType
10507
+ }
10508
+ }
10509
+ ]
10510
+ },
10511
+ coverType: UpdateDocsAttributeType.REPLACE,
10512
+ segmentId
10513
+ }), memoryCursor.moveCursorTo(startIndex + 1), textX;
10514
+ }, "toggleChecklistParagraph"), setParagraphBullet = /* @__PURE__ */ __name((params) => {
10515
+ var _a11, _b2;
10516
+ const { paragraphs: currentParagraphs, listType, segmentId, document: docDataModel } = params;
10517
+ if (((_a11 = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) == null ? void 0 : _a11.paragraphs) == null)
10518
+ return !1;
10519
+ const listId = Tools.generateRandomId(6), memoryCursor = new MemoryCursor();
10520
+ memoryCursor.reset();
10521
+ const textX = new TextX();
10522
+ for (const paragraph of currentParagraphs) {
10523
+ const { startIndex, paragraphStyle = {}, bullet } = paragraph;
10524
+ textX.push({
10525
+ t: TextXActionType.RETAIN,
10526
+ len: startIndex - memoryCursor.cursor,
10527
+ segmentId
10528
+ }), textX.push({
10529
+ t: TextXActionType.RETAIN,
10530
+ len: 1,
10531
+ body: {
10532
+ dataStream: "",
10533
+ paragraphs: [
10534
+ {
10535
+ startIndex: 0,
10536
+ paragraphStyle,
10537
+ bullet: {
10538
+ nestingLevel: (_b2 = bullet == null ? void 0 : bullet.nestingLevel) != null ? _b2 : 0,
10539
+ textStyle: (bullet == null ? void 0 : bullet.listType) === listType ? bullet.textStyle : {
10540
+ fs: 20
10541
+ },
10542
+ listType,
10543
+ listId
10544
+ }
10545
+ }
10546
+ ]
10547
+ },
10548
+ segmentId,
10549
+ coverType: UpdateDocsAttributeType.REPLACE
10550
+ }), memoryCursor.moveCursorTo(startIndex + 1);
10551
+ }
10552
+ return textX;
10553
+ }, "setParagraphBullet");
10554
+ function hasParagraphInTable(paragraph, tables) {
10555
+ return tables.some((table) => paragraph.startIndex > table.startIndex && paragraph.startIndex < table.endIndex);
10556
+ }
10557
+ __name(hasParagraphInTable, "hasParagraphInTable");
10558
+ const changeParagraphBulletNestLevel = /* @__PURE__ */ __name((params) => {
10559
+ var _a11, _b2, _c;
10560
+ const { paragraphs: currentParagraphs, segmentId, document: docDataModel, type: type2 } = params, memoryCursor = new MemoryCursor();
10561
+ memoryCursor.reset();
10562
+ const textX = new TextX(), customLists = (_a11 = docDataModel.getSnapshot().lists) != null ? _a11 : {}, tables = (_c = (_b2 = docDataModel.getBody()) == null ? void 0 : _b2.tables) != null ? _c : [], lists = {
10563
+ ...PRESET_LIST_TYPE,
10564
+ ...customLists
10565
+ };
10566
+ for (const paragraph of currentParagraphs) {
10567
+ const { startIndex, paragraphStyle = {}, bullet } = paragraph, isInTable = hasParagraphInTable(paragraph, tables);
10568
+ if (textX.push({
10569
+ t: TextXActionType.RETAIN,
10570
+ len: startIndex - memoryCursor.cursor,
10571
+ segmentId
10572
+ }), bullet) {
10573
+ const listType = bullet.listType;
10574
+ let maxLevel = lists[listType].nestingLevel.length - 1;
10575
+ isInTable && (maxLevel = Math.min(maxLevel, 2)), textX.push({
10576
+ t: TextXActionType.RETAIN,
10577
+ len: 1,
10578
+ body: {
10579
+ dataStream: "",
10580
+ paragraphs: [
10581
+ {
10582
+ startIndex: 0,
10583
+ paragraphStyle: {
10584
+ ...paragraphStyle
10585
+ },
10586
+ bullet: {
10587
+ ...bullet,
10588
+ nestingLevel: Math.max(Math.min(bullet.nestingLevel + type2, maxLevel), 0)
10589
+ }
10590
+ }
10591
+ ]
10592
+ },
10593
+ segmentId,
10594
+ coverType: UpdateDocsAttributeType.REPLACE
10595
+ });
10596
+ } else
10597
+ textX.push({
10598
+ t: TextXActionType.RETAIN,
10599
+ len: 1
10600
+ });
10601
+ memoryCursor.moveCursorTo(startIndex + 1);
10602
+ }
10603
+ return textX;
10604
+ }, "changeParagraphBulletNestLevel");
10413
10605
  var PageType = /* @__PURE__ */ ((PageType2) => (PageType2[PageType2.SLIDE = 0] = "SLIDE", PageType2[PageType2.MASTER = 1] = "MASTER", PageType2[PageType2.LAYOUT = 2] = "LAYOUT", PageType2[PageType2.HANDOUT_MASTER = 3] = "HANDOUT_MASTER", PageType2[PageType2.NOTES_MASTER = 4] = "NOTES_MASTER", PageType2))(PageType || {}), PageElementType = /* @__PURE__ */ ((PageElementType2) => (PageElementType2[PageElementType2.SHAPE = 0] = "SHAPE", PageElementType2[PageElementType2.IMAGE = 1] = "IMAGE", PageElementType2[PageElementType2.TEXT = 2] = "TEXT", PageElementType2[PageElementType2.SPREADSHEET = 3] = "SPREADSHEET", PageElementType2[PageElementType2.DOCUMENT = 4] = "DOCUMENT", PageElementType2[PageElementType2.SLIDE = 5] = "SLIDE", PageElementType2))(PageElementType || {}), RelativeSlideLink = /* @__PURE__ */ ((RelativeSlideLink2) => (RelativeSlideLink2[RelativeSlideLink2.RELATIVE_SLIDE_LINK_UNSPECIFIED = 0] = "RELATIVE_SLIDE_LINK_UNSPECIFIED", RelativeSlideLink2[RelativeSlideLink2.NEXT_SLIDE = 1] = "NEXT_SLIDE", RelativeSlideLink2[RelativeSlideLink2.PREVIOUS_SLIDE = 2] = "PREVIOUS_SLIDE", RelativeSlideLink2[RelativeSlideLink2.FIRST_SLIDE = 3] = "FIRST_SLIDE", RelativeSlideLink2[RelativeSlideLink2.LAST_SLIDE = 4] = "LAST_SLIDE", RelativeSlideLink2))(RelativeSlideLink || {});
10414
10606
  const tags = [
10415
10607
  // DataStreamTreeTokenType.PARAGRAPH, // 段落
@@ -10753,7 +10945,7 @@ function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "",
10753
10945
  }
10754
10946
  const sortedRetains = [...retainPoints].sort((pre, aft) => pre - aft);
10755
10947
  let cursor2 = textStart;
10756
- return sortedRetains.forEach((pos) => {
10948
+ if (sortedRetains.forEach((pos) => {
10757
10949
  const len = pos - cursor2;
10758
10950
  len > 0 && dos.push({
10759
10951
  t: TextXActionType.DELETE,
@@ -10765,12 +10957,35 @@ function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "",
10765
10957
  len: 1,
10766
10958
  segmentId
10767
10959
  }), cursor2 = pos + 1;
10768
- }), cursor2 < textEnd && dos.push({
10960
+ }), cursor2 < textEnd && (dos.push({
10769
10961
  t: TextXActionType.DELETE,
10770
10962
  len: textEnd - cursor2,
10771
10963
  line: 0,
10772
10964
  segmentId
10773
- }), dos;
10965
+ }), cursor2 = textEnd), !preserveLineBreak) {
10966
+ const nextParagraph = paragraphs.find((p) => p.startIndex - memoryCursor >= textEnd);
10967
+ nextParagraph && (nextParagraph.startIndex > cursor2 && (dos.push({
10968
+ t: TextXActionType.RETAIN,
10969
+ len: nextParagraph.startIndex - cursor2,
10970
+ segmentId
10971
+ }), cursor2 = nextParagraph.startIndex), dos.push({
10972
+ t: TextXActionType.RETAIN,
10973
+ len: 1,
10974
+ segmentId,
10975
+ body: {
10976
+ dataStream: "",
10977
+ paragraphs: [
10978
+ {
10979
+ ...nextParagraph,
10980
+ startIndex: 0,
10981
+ bullet: paragraphInRange == null ? void 0 : paragraphInRange.bullet
10982
+ }
10983
+ ]
10984
+ },
10985
+ coverType: UpdateDocsAttributeType.REPLACE
10986
+ }));
10987
+ }
10988
+ return dos;
10774
10989
  }
10775
10990
  __name(getRetainAndDeleteAndExcludeLineBreak, "getRetainAndDeleteAndExcludeLineBreak");
10776
10991
  const replaceSelectionTextX = /* @__PURE__ */ __name((params) => {
@@ -10808,6 +11023,13 @@ __name(_BuildTextUtils, "BuildTextUtils"), __publicField(_BuildTextUtils, "custo
10808
11023
  getPlainText,
10809
11024
  fromPlainText,
10810
11025
  isEmptyDocument
11026
+ }), __publicField(_BuildTextUtils, "paragraph", {
11027
+ bullet: {
11028
+ set: setParagraphBullet,
11029
+ switch: switchParagraphBullet,
11030
+ toggleChecklist: toggleChecklistParagraph,
11031
+ changeNestLevel: changeParagraphBulletNestLevel
11032
+ }
10811
11033
  });
10812
11034
  let BuildTextUtils = _BuildTextUtils;
10813
11035
  function replaceInDocumentBody(body, query, target) {
@@ -10925,10 +11147,10 @@ function fromEventSubject(subject$) {
10925
11147
  }
10926
11148
  __name(fromEventSubject, "fromEventSubject");
10927
11149
  const IResourceManagerService = createIdentifier("core.resource-manager.service"), nameMap = {
10928
- [G.Editor]: "Editor",
10929
- [G.Owner]: "Owner",
10930
- [G.Reader]: "Reader",
10931
- [G.UNRECOGNIZED]: "UNRECOGNIZED"
11150
+ [S.Editor]: "Editor",
11151
+ [S.Owner]: "Owner",
11152
+ [S.Reader]: "Reader",
11153
+ [S.UNRECOGNIZED]: "UNRECOGNIZED"
10932
11154
  }, createDefaultUser = /* @__PURE__ */ __name((type2) => type2 ? {
10933
11155
  userID: `${nameMap[type2]}_${Tools.generateRandomId(8)}`,
10934
11156
  name: nameMap[type2],
@@ -10992,7 +11214,7 @@ let AuthzIoLocalService = (_a3 = class {
10992
11214
  }
10993
11215
  _initDefaultUser() {
10994
11216
  const currentUser = this._userManagerService.getCurrentUser();
10995
- currentUser && currentUser.userID || this._userManagerService.setCurrentUser(createDefaultUser(G.Owner));
11217
+ currentUser && currentUser.userID || this._userManagerService.setCurrentUser(createDefaultUser(S.Owner));
10996
11218
  }
10997
11219
  _getRole(type2) {
10998
11220
  const user = this._userManagerService.getCurrentUser();
@@ -11009,7 +11231,7 @@ let AuthzIoLocalService = (_a3 = class {
11009
11231
  }, "toJson"),
11010
11232
  parseJson: /* @__PURE__ */ __name((json) => JSON.parse(json), "parseJson"),
11011
11233
  pluginName: "SHEET_AuthzIoMockService_PLUGIN",
11012
- businesses: [I.UNIVER_SHEET, I.UNIVER_DOC, I.UNIVER_SLIDE],
11234
+ businesses: [R.UNIVER_SHEET, R.UNIVER_DOC, R.UNIVER_SLIDE],
11013
11235
  onLoad: /* @__PURE__ */ __name((_unitId, resource) => {
11014
11236
  for (const key in resource)
11015
11237
  this._permissionMap.set(key, resource[key]);
@@ -11040,13 +11262,13 @@ let AuthzIoLocalService = (_a3 = class {
11040
11262
  objectType: rule.objectType,
11041
11263
  name: rule.name,
11042
11264
  shareOn: !1,
11043
- shareRole: G.Owner,
11265
+ shareRole: S.Owner,
11044
11266
  shareScope: -1,
11045
11267
  scope: {
11046
- read: H.AllCollaborator,
11047
- edit: H.AllCollaborator
11268
+ read: T.AllCollaborator,
11269
+ edit: T.AllCollaborator
11048
11270
  },
11049
- creator: createDefaultUser(G.Owner),
11271
+ creator: createDefaultUser(S.Owner),
11050
11272
  strategies: [
11051
11273
  {
11052
11274
  action: 6,
@@ -11101,7 +11323,7 @@ let AuthzIoLocalService = (_a3 = class {
11101
11323
  role: 1
11102
11324
  }
11103
11325
  ],
11104
- actions: config.actions.map((a) => ({ action: a, allowed: this._getRole(G.Owner) || this._getRole(G.Editor) }))
11326
+ actions: config.actions.map((a) => ({ action: a, allowed: this._getRole(S.Owner) || this._getRole(S.Editor) }))
11105
11327
  };
11106
11328
  result.push(item);
11107
11329
  }
@@ -11168,7 +11390,7 @@ const FOCUSING_UNIT = "FOCUSING_UNIT", FOCUSING_SHEET = "FOCUSING_SHEET", FOCUSI
11168
11390
  };
11169
11391
  __name(_ErrorService, "ErrorService");
11170
11392
  let ErrorService = _ErrorService;
11171
- const version = "0.4.0-alpha.0";
11393
+ const version = "0.4.0-alpha.2";
11172
11394
  function getEmptySnapshot(unitID = "", locale = LocaleType.ZH_CN, name = "") {
11173
11395
  return {
11174
11396
  id: unitID,
@@ -12318,7 +12540,7 @@ var _a4;
12318
12540
  let Workbook = (_a4 = class extends UnitModel {
12319
12541
  constructor(workbookData = {}, _logService) {
12320
12542
  super();
12321
- __publicField(this, "type", I.UNIVER_SHEET);
12543
+ __publicField(this, "type", R.UNIVER_SHEET);
12322
12544
  __publicField(this, "_sheetCreated$", new Subject());
12323
12545
  __publicField(this, "sheetCreated$", this._sheetCreated$.asObservable());
12324
12546
  __publicField(this, "_sheetDisposed$", new Subject());
@@ -12563,7 +12785,7 @@ const _SlideDataModel = class _SlideDataModel extends UnitModel {
12563
12785
  constructor(snapshot) {
12564
12786
  var _a11;
12565
12787
  super();
12566
- __publicField(this, "type", I.UNIVER_SLIDE);
12788
+ __publicField(this, "type", R.UNIVER_SLIDE);
12567
12789
  __publicField(this, "_activePage$", new BehaviorSubject(null));
12568
12790
  __publicField(this, "activePage$", this._activePage$.asObservable());
12569
12791
  __publicField(this, "_name$");
@@ -12736,20 +12958,20 @@ let UniverInstanceService = (_a5 = class extends Disposable {
12736
12958
  return type2 && (unit == null ? void 0 : unit.type) !== type2 ? null : unit;
12737
12959
  }
12738
12960
  getCurrentUniverDocInstance() {
12739
- return this.getCurrentUnitForType(I.UNIVER_DOC);
12961
+ return this.getCurrentUnitForType(R.UNIVER_DOC);
12740
12962
  }
12741
12963
  getUniverDocInstance(unitId) {
12742
- return this.getUnit(unitId, I.UNIVER_DOC);
12964
+ return this.getUnit(unitId, R.UNIVER_DOC);
12743
12965
  }
12744
12966
  getUniverSheetInstance(unitId) {
12745
- return this.getUnit(unitId, I.UNIVER_SHEET);
12967
+ return this.getUnit(unitId, R.UNIVER_SHEET);
12746
12968
  }
12747
12969
  getAllUnitsForType(type2) {
12748
12970
  var _a11;
12749
12971
  return (_a11 = this._unitsByType.get(type2)) != null ? _a11 : [];
12750
12972
  }
12751
12973
  changeDoc(unitId, doc) {
12752
- const allDocs = this.getAllUnitsForType(I.UNIVER_DOC), oldDoc = allDocs.find((doc2) => doc2.getUnitId() === unitId);
12974
+ const allDocs = this.getAllUnitsForType(R.UNIVER_DOC), oldDoc = allDocs.find((doc2) => doc2.getUnitId() === unitId);
12753
12975
  if (oldDoc != null) {
12754
12976
  const index2 = allDocs.indexOf(oldDoc);
12755
12977
  allDocs.splice(index2, 1);
@@ -12769,7 +12991,7 @@ let UniverInstanceService = (_a5 = class extends Disposable {
12769
12991
  }
12770
12992
  getUnitType(unitId) {
12771
12993
  const result = this._getUnitById(unitId);
12772
- return result ? result[1] : I.UNRECOGNIZED;
12994
+ return result ? result[1] : R.UNRECOGNIZED;
12773
12995
  }
12774
12996
  disposeUnit(unitId) {
12775
12997
  const result = this._getUnitById(unitId);
@@ -12834,7 +13056,7 @@ let LifecycleService = (_a6 = class extends Disposable {
12834
13056
  * @returns
12835
13057
  */
12836
13058
  subscribeWithPrevious() {
12837
- return merge$1(getLifecycleStagesAndBefore(this.stage), this._lifecycle$.pipe(skip(1))).pipe(takeAfter((s) => s === LifecycleStages.Steady));
13059
+ return merge$2(getLifecycleStagesAndBefore(this.stage), this._lifecycle$.pipe(skip(1))).pipe(takeAfter((s) => s === LifecycleStages.Steady));
12838
13060
  }
12839
13061
  _reportProgress(stage) {
12840
13062
  this._logService.debug("[LifecycleService]", `lifecycle progressed to "${LifecycleNameMap[stage]}".`);
@@ -13026,7 +13248,7 @@ const DependentOnSymbol = Symbol("DependentOn"), _Plugin = class _Plugin extends
13026
13248
  return this.constructor.pluginName;
13027
13249
  }
13028
13250
  };
13029
- __name(_Plugin, "Plugin"), __publicField(_Plugin, "pluginName"), __publicField(_Plugin, "type", I.UNIVER_UNKNOWN);
13251
+ __name(_Plugin, "Plugin"), __publicField(_Plugin, "pluginName"), __publicField(_Plugin, "type", R.UNIVER_UNKNOWN);
13030
13252
  let Plugin = _Plugin;
13031
13253
  const _PluginStore = class _PluginStore {
13032
13254
  constructor() {
@@ -13085,7 +13307,7 @@ let PluginService = (_a7 = class {
13085
13307
  PluginHolder,
13086
13308
  this._checkPluginSeen.bind(this),
13087
13309
  this._immediateInitPlugin.bind(this)
13088
- ), this._pluginHoldersForTypes.set(I.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
13310
+ ), this._pluginHoldersForTypes.set(R.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
13089
13311
  }
13090
13312
  dispose() {
13091
13313
  this._clearFlushTimer();
@@ -13097,7 +13319,7 @@ let PluginService = (_a7 = class {
13097
13319
  registerPlugin(ctor, config) {
13098
13320
  this._assertPluginValid(ctor), this._scheduleInitPlugin();
13099
13321
  const { type: type2 } = ctor;
13100
- type2 === I.UNIVER_UNKNOWN ? (this._pluginHolderForUniver.register(ctor, config), this._pluginHolderForUniver.flush()) : this._ensurePluginHolderForType(type2).register(ctor, config);
13322
+ type2 === R.UNIVER_UNKNOWN ? (this._pluginHolderForUniver.register(ctor, config), this._pluginHolderForUniver.flush()) : this._ensurePluginHolderForType(type2).register(ctor, config);
13101
13323
  }
13102
13324
  startPluginForType(type2) {
13103
13325
  this._ensurePluginHolderForType(type2).start();
@@ -13121,7 +13343,7 @@ let PluginService = (_a7 = class {
13121
13343
  }
13122
13344
  _assertPluginValid(ctor) {
13123
13345
  const { type: type2, pluginName } = ctor;
13124
- if (type2 === I.UNRECOGNIZED)
13346
+ if (type2 === R.UNRECOGNIZED)
13125
13347
  throw new Error(`[PluginService]: invalid plugin type for ${ctor.name}. Please assign a "type" to your plugin.`);
13126
13348
  if (!pluginName)
13127
13349
  throw new Error(`[PluginService]: no plugin name for ${ctor.name}. Please assign a "pluginName" to your plugin.`);
@@ -13896,11 +14118,11 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
13896
14118
  const handleHookAdd = /* @__PURE__ */ __name((hook) => {
13897
14119
  hook.businesses.forEach((business) => {
13898
14120
  switch (business) {
13899
- case I.UNRECOGNIZED:
13900
- case I.UNIVER_UNKNOWN:
13901
- case I.UNIVER_SLIDE:
13902
- case I.UNIVER_DOC: {
13903
- this._univerInstanceService.getAllUnitsForType(I.UNIVER_DOC).forEach((doc) => {
14121
+ case R.UNRECOGNIZED:
14122
+ case R.UNIVER_UNKNOWN:
14123
+ case R.UNIVER_SLIDE:
14124
+ case R.UNIVER_DOC: {
14125
+ this._univerInstanceService.getAllUnitsForType(R.UNIVER_DOC).forEach((doc) => {
13904
14126
  const plugin = (doc.getSnapshot().resources || []).find((r) => r.name === hook.pluginName);
13905
14127
  if (plugin)
13906
14128
  try {
@@ -13912,8 +14134,8 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
13912
14134
  });
13913
14135
  break;
13914
14136
  }
13915
- case I.UNIVER_SHEET:
13916
- this._univerInstanceService.getAllUnitsForType(I.UNIVER_SHEET).forEach((workbook) => {
14137
+ case R.UNIVER_SHEET:
14138
+ this._univerInstanceService.getAllUnitsForType(R.UNIVER_SHEET).forEach((workbook) => {
13917
14139
  const plugin = (workbook.getSnapshot().resources || []).find((r) => r.name === hook.pluginName);
13918
14140
  if (plugin)
13919
14141
  try {
@@ -13927,20 +14149,20 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
13927
14149
  });
13928
14150
  }, "handleHookAdd");
13929
14151
  this._resourceManagerService.getAllResourceHooks().forEach((hook) => handleHookAdd(hook)), this.disposeWithMe(this._resourceManagerService.register$.subscribe((hook) => handleHookAdd(hook))), this.disposeWithMe(
13930
- this._univerInstanceService.getTypeOfUnitAdded$(I.UNIVER_SHEET).subscribe((workbook) => {
14152
+ this._univerInstanceService.getTypeOfUnitAdded$(R.UNIVER_SHEET).subscribe((workbook) => {
13931
14153
  this._resourceManagerService.loadResources(workbook.getUnitId(), workbook.getSnapshot().resources);
13932
14154
  })
13933
14155
  ), this.disposeWithMe(
13934
- this._univerInstanceService.getTypeOfUnitAdded$(I.UNIVER_DOC).subscribe((doc) => {
14156
+ this._univerInstanceService.getTypeOfUnitAdded$(R.UNIVER_DOC).subscribe((doc) => {
13935
14157
  const unitId = doc.getUnitId();
13936
14158
  isInternalEditorID(unitId) || this._resourceManagerService.loadResources(doc.getUnitId(), doc.getSnapshot().resources);
13937
14159
  })
13938
14160
  ), this.disposeWithMe(
13939
- this._univerInstanceService.getTypeOfUnitDisposed$(I.UNIVER_SHEET).subscribe((workbook) => {
14161
+ this._univerInstanceService.getTypeOfUnitDisposed$(R.UNIVER_SHEET).subscribe((workbook) => {
13940
14162
  this._resourceManagerService.unloadResources(workbook.getUnitId());
13941
14163
  })
13942
14164
  ), this.disposeWithMe(
13943
- this._univerInstanceService.getTypeOfUnitDisposed$(I.UNIVER_DOC).subscribe((doc) => {
14165
+ this._univerInstanceService.getTypeOfUnitDisposed$(R.UNIVER_DOC).subscribe((doc) => {
13944
14166
  this._resourceManagerService.unloadResources(doc.getUnitId());
13945
14167
  })
13946
14168
  );
@@ -13993,22 +14215,22 @@ const _Univer = class _Univer {
13993
14215
  * @deprecated use `createUnit` instead
13994
14216
  */
13995
14217
  createUniverSheet(data) {
13996
- return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(I.UNIVER_SHEET, data);
14218
+ return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(R.UNIVER_SHEET, data);
13997
14219
  }
13998
14220
  /**
13999
14221
  * @deprecated use `createUnit` instead
14000
14222
  */
14001
14223
  createUniverDoc(data) {
14002
- return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(I.UNIVER_DOC, data);
14224
+ return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(R.UNIVER_DOC, data);
14003
14225
  }
14004
14226
  /**
14005
14227
  * @deprecated use `createUnit` instead
14006
14228
  */
14007
14229
  createUniverSlide(data) {
14008
- return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(I.UNIVER_SLIDE, data);
14230
+ return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(R.UNIVER_SLIDE, data);
14009
14231
  }
14010
14232
  _init(injector) {
14011
- this._univerInstanceService.registerCtorForType(I.UNIVER_SHEET, Workbook), this._univerInstanceService.registerCtorForType(I.UNIVER_DOC, DocumentDataModel), this._univerInstanceService.registerCtorForType(I.UNIVER_SLIDE, SlideDataModel);
14233
+ this._univerInstanceService.registerCtorForType(R.UNIVER_SHEET, Workbook), this._univerInstanceService.registerCtorForType(R.UNIVER_DOC, DocumentDataModel), this._univerInstanceService.registerCtorForType(R.UNIVER_SLIDE, SlideDataModel);
14012
14234
  const univerInstanceService = injector.get(IUniverInstanceService);
14013
14235
  univerInstanceService.__setCreateHandler(
14014
14236
  (type2, data, ctor, options) => {
@@ -14273,7 +14495,7 @@ export {
14273
14495
  UnitModel,
14274
14496
  Univer,
14275
14497
  UniverInstanceService,
14276
- I as UniverInstanceType,
14498
+ R as UniverInstanceType,
14277
14499
  UpdateDocsAttributeType,
14278
14500
  UserManagerService,
14279
14501
  VerticalAlign,
@@ -14287,6 +14509,7 @@ export {
14287
14509
  afterInitApply,
14288
14510
  awaitTime,
14289
14511
  binarySearchArray,
14512
+ bufferDebounceTime,
14290
14513
  cellToRange,
14291
14514
  characterSpacingControlType,
14292
14515
  checkForSubstrings,
@@ -14367,10 +14590,10 @@ export {
14367
14590
  makeCellRangeToRangeData,
14368
14591
  makeCellToSelection,
14369
14592
  makeCustomRangeStream,
14370
- merge,
14593
+ merge$1 as merge,
14371
14594
  mergeOverrideWithDependencies,
14372
14595
  mergeSets,
14373
- mergeWith,
14596
+ mergeWith$1 as mergeWith,
14374
14597
  mergeWorksheetSnapshotWithDefault,
14375
14598
  mixinClass,
14376
14599
  moveMatrixArray,