@univerjs/core 0.4.0-alpha.1 → 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,8 +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";
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";
7
7
  import * as React from "react";
8
8
  import React__default, { useState, useEffect, useRef, useMemo, createContext, useCallback, useContext } from "react";
9
9
  function _mergeNamespaces(n, m) {
@@ -804,9 +804,12 @@ 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
- }), merge = createAssigner(function(object, source, srcIndex) {
807
+ });
808
+ const mergeWith$1 = mergeWith;
809
+ var merge = createAssigner(function(object, source, srcIndex) {
808
810
  baseMerge(object, source, srcIndex);
809
811
  });
812
+ const merge$1 = merge;
810
813
  function baseSet(object, path, value, customizer) {
811
814
  if (!isObject$1(object))
812
815
  return object;
@@ -2649,11 +2652,23 @@ function takeAfter(callback) {
2649
2652
  }, "complateAfter");
2650
2653
  }
2651
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");
2652
2667
  const afterInitApply = /* @__PURE__ */ __name((commandService) => new Promise((res) => {
2653
- merge$1(
2668
+ merge$2(
2654
2669
  fromCallback(commandService.onCommandExecuted.bind(commandService)).pipe(filter$1(([info]) => info.type === CommandType.MUTATION)),
2655
2670
  timer(300)
2656
- ).pipe(debounceTime(16), first()).subscribe(() => {
2671
+ ).pipe(debounceTime$1(16), first()).subscribe(() => {
2657
2672
  res();
2658
2673
  });
2659
2674
  }), "afterInitApply");
@@ -5048,7 +5063,7 @@ var numfmt$2 = { exports: {} };
5048
5063
  return { pattern: e2, partitions: t2, locale: n2 };
5049
5064
  }
5050
5065
  __name(D, "D");
5051
- const S = Math.floor;
5066
+ const S2 = Math.floor;
5052
5067
  function C(e2) {
5053
5068
  if ((!(arguments.length > 1 && arguments[1] !== void 0) || arguments[1]) && e2 >= 0) {
5054
5069
  if (e2 === 0) return [1900, 1, 0];
@@ -5056,12 +5071,12 @@ var numfmt$2 = { exports: {} };
5056
5071
  if (e2 < 60) return [1900, e2 < 32 ? 1 : 2, (e2 - 1) % 31 + 1];
5057
5072
  }
5058
5073
  let n2 = e2 + 68569 + 2415019;
5059
- const a2 = S(4 * n2 / 146097);
5060
- n2 -= S((146097 * a2 + 3) / 4);
5061
- const r2 = S(4e3 * (n2 + 1) / 1461001);
5062
- n2 = n2 - S(1461 * r2 / 4) + 31;
5063
- const i2 = S(80 * n2 / 2447), s2 = n2 - S(2447 * i2 / 80);
5064
- 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);
5065
5080
  const o2 = i2 + 2 - 12 * n2;
5066
5081
  return [0 | 100 * (a2 - 49) + r2 + n2, 0 | o2, 0 | s2];
5067
5082
  }
@@ -5076,21 +5091,21 @@ var numfmt$2 = { exports: {} };
5076
5091
  if (e2 < 60) return [1317, e2 < 32 ? 9 : 10, 1 + (e2 - 2) % 30];
5077
5092
  const t2 = 10631 / 30, n2 = 0.1335;
5078
5093
  let a2 = e2 + 466935;
5079
- const r2 = S(a2 / 10631);
5094
+ const r2 = S2(a2 / 10631);
5080
5095
  a2 -= 10631 * r2;
5081
- const i2 = S((a2 - n2) / t2);
5082
- a2 -= S(i2 * t2 + n2);
5083
- const s2 = S((a2 + 28.5001) / 29.5);
5084
- 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)];
5085
5100
  }
5086
5101
  __name(A, "A");
5087
5102
  function Y(e2) {
5088
5103
  let t2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n2 = !(arguments.length > 2 && arguments[2] !== void 0) || arguments[2];
5089
- const a2 = S(e2);
5104
+ const a2 = S2(e2);
5090
5105
  return t2 === 6 ? A(a2) : t2 === -1 ? E(a2) : C(a2, n2);
5091
5106
  }
5092
5107
  __name(Y, "Y");
5093
- const T = Math.floor, N = 86400;
5108
+ const T2 = Math.floor, N = 86400;
5094
5109
  function P(e2, t2) {
5095
5110
  let n2 = null;
5096
5111
  if (Array.isArray(e2)) {
@@ -5107,19 +5122,19 @@ var numfmt$2 = { exports: {} };
5107
5122
  return e2;
5108
5123
  }
5109
5124
  __name(P, "P");
5110
- function I2(e2, t2) {
5125
+ function I(e2, t2) {
5111
5126
  let n2 = 0 | e2;
5112
5127
  const a2 = N * (e2 - n2);
5113
- let r2 = T(a2);
5128
+ let r2 = T2(a2);
5114
5129
  a2 - r2 > 0.9999 && (r2 += 1, r2 === N && (r2 = 0, n2 += 1));
5115
- 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;
5116
5131
  if (t2 && t2.nativeDate) {
5117
5132
  const e3 = /* @__PURE__ */ new Date(0);
5118
5133
  return e3.setUTCFullYear(s2, o2 - 1, l2), e3.setUTCHours(d2, m2, u2), e3;
5119
5134
  }
5120
5135
  return [s2, o2, l2, d2, m2, u2];
5121
5136
  }
5122
- __name(I2, "I");
5137
+ __name(I, "I");
5123
5138
  function O(e2) {
5124
5139
  return !!(e2[0] && e2[0].percent || e2[1] && e2[1].percent || e2[2] && e2[2].percent || e2[3] && e2[3].percent);
5125
5140
  }
@@ -5133,7 +5148,7 @@ var numfmt$2 = { exports: {} };
5133
5148
  return !(t2 && !t2.generated || n2 && !n2.generated || a2 && !a2.generated || !r2 || !r2.text || r2.generated);
5134
5149
  }
5135
5150
  __name(L, "L");
5136
- 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");
5137
5152
  function B(e2, t2, n2, a2) {
5138
5153
  const r2 = 0 | n2;
5139
5154
  if (typeof n2 == "string") e2.push(n2);
@@ -5145,7 +5160,7 @@ var numfmt$2 = { exports: {} };
5145
5160
  const s2 = function(e3) {
5146
5161
  let t4 = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
5147
5162
  const n3 = Math.abs(e3);
5148
- if (!n3) return G2;
5163
+ if (!n3) return G;
5149
5164
  const a3 = t4 && e3 < 0 ? 1 : 0, r4 = Math.floor(n3), i3 = Math.floor(Math.log10(n3) + 1);
5150
5165
  let s3 = 0, o3 = 0;
5151
5166
  if (r4 !== n3) {
@@ -5165,19 +5180,19 @@ var numfmt$2 = { exports: {} };
5165
5180
  }(t3), o2 = /* @__PURE__ */ __name(() => {
5166
5181
  const t4 = Math.abs(r3);
5167
5182
  let n3;
5168
- 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);
5169
5184
  }, "o");
5170
5185
  if (r3 >= -4 && r3 <= -1) {
5171
5186
  const n3 = t3.toPrecision(10 + r3).replace(/\.?0+$/, "");
5172
- e2.push(H2(n3, a2));
5187
+ e2.push(H(n3, a2));
5173
5188
  } else if (r3 === 10) {
5174
5189
  const n3 = t3.toFixed(10).slice(0, 12).replace(/\.$/, "");
5175
- e2.push(H2(n3, a2));
5190
+ e2.push(H(n3, a2));
5176
5191
  } else if (Math.abs(r3) <= 9) if (s2.total <= 11) {
5177
5192
  const n3 = c(t3, 9).toFixed(s2.frac);
5178
- e2.push(H2(n3, a2));
5193
+ e2.push(H(n3, a2));
5179
5194
  } else r3 === 9 ? e2.push(Math.floor(t3)) : r3 >= 0 && r3 < 9 ? e2.push(c(t3, 9 - r3)) : o2();
5180
- 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));
5181
5196
  }
5182
5197
  return e2;
5183
5198
  }
@@ -5247,7 +5262,7 @@ var numfmt$2 = { exports: {} };
5247
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;
5248
5263
  }
5249
5264
  const D2 = [];
5250
- let S2 = 0;
5265
+ let S3 = 0;
5251
5266
  const C2 = { int: 0, frac: 0, man: 0, num: 0, den: 0 };
5252
5267
  for (let d3 = 0, u2 = t2.tokens.length; d3 < u2; d3++) {
5253
5268
  const u3 = t2.tokens[d3], c2 = u3.num ? u3.num.length : 0;
@@ -5262,8 +5277,8 @@ var numfmt$2 = { exports: {} };
5262
5277
  else if (u3.type === "div") F2 ? D2.push("/") : t2.num_min > 0 || t2.den_min > 0 ? D2.push(y["?"]) : D2.push(y["#"]);
5263
5278
  else if (u3.type === "int") if (t2.int_pattern.length === 1) D2.push(l2);
5264
5279
  else {
5265
- 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);
5266
- 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;
5267
5282
  }
5268
5283
  else if (u3.type === "frac") {
5269
5284
  const e3 = C2.frac;
@@ -5462,7 +5477,7 @@ var numfmt$2 = { exports: {} };
5462
5477
  const i2 = Date.UTC(e3, n2.month - 1, n2.day) / 864e5 + r2 + (n2.time || 0);
5463
5478
  if (i2 >= 0 && i2 <= 2958465) {
5464
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);
5465
- 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 };
5466
5481
  }
5467
5482
  }
5468
5483
  return null;
@@ -5524,7 +5539,7 @@ var numfmt$2 = { exports: {} };
5524
5539
  const r5 = a4.type;
5525
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++);
5526
5541
  }), s3.type = "date", t4 && e4 ? s3.type = "datetime" : !t4 && e4 && (s3.type = "time");
5527
- const r4 = R.find((e5) => n4.startsWith(e5[0]));
5542
+ const r4 = R2.find((e5) => n4.startsWith(e5[0]));
5528
5543
  l2 = r4 ? "D" : "G", d2 = r4 ? r4[1] : "";
5529
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");
5530
5545
  return s3.code = l2 + d2 + u2 + m2, s3.level = U[s3.type], Object.freeze(s3);
@@ -5547,7 +5562,7 @@ var numfmt$2 = { exports: {} };
5547
5562
  }
5548
5563
  }(e2), n2.error || (me[e2] = n2)), ue(n2, t2);
5549
5564
  }
5550
- __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) => {
5551
5566
  const n2 = s(t2);
5552
5567
  return delete me[n2.lang], delete me[n2.language], m(e2, n2);
5553
5568
  }, ce.format = function(e2, t2, n2) {
@@ -7125,7 +7140,7 @@ function sortRulesFactory(key = "index", ruler = 1) {
7125
7140
  return (oa, ob) => oa[key] > ob[key] ? ruler : oa[key] === ob[key] ? 0 : -ruler;
7126
7141
  }
7127
7142
  __name(sortRulesFactory, "sortRulesFactory");
7128
- 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 || {});
7129
7144
  const _UnitModel = class _UnitModel extends Disposable {
7130
7145
  };
7131
7146
  __name(_UnitModel, "UnitModel");
@@ -9424,7 +9439,7 @@ function updateSectionBreaks(body, updateBody, textLength, currentIndex, coverTy
9424
9439
  }
9425
9440
  updateBody.sectionBreaks = newUpdateSectionBreaks;
9426
9441
  }
9427
- return insertParagraphs(body, updateBody, textLength, currentIndex), removeSectionBreaks;
9442
+ return insertSectionBreaks(body, updateBody, textLength, currentIndex), removeSectionBreaks;
9428
9443
  }
9429
9444
  __name(updateSectionBreaks, "updateSectionBreaks");
9430
9445
  function updateCustomBlocks(body, updateBody, textLength, currentIndex, coverType) {
@@ -9544,7 +9559,7 @@ function getBodySlice(body, startOffset, endOffset, returnEmptyTextRun = !1, typ
9544
9559
  const newParagraphs = [];
9545
9560
  for (const paragraph of paragraphs) {
9546
9561
  const { startIndex } = paragraph;
9547
- startIndex >= startOffset && startIndex <= endOffset && newParagraphs.push(Tools.deepClone(paragraph));
9562
+ startIndex >= startOffset && startIndex < endOffset && newParagraphs.push(Tools.deepClone(paragraph));
9548
9563
  }
9549
9564
  newParagraphs.length && (docBody.paragraphs = newParagraphs.map((p) => ({
9550
9565
  ...p,
@@ -10184,7 +10199,7 @@ const DEFAULT_DOC = {
10184
10199
  constructor(snapshot) {
10185
10200
  var _a11;
10186
10201
  super();
10187
- __publicField(this, "type", I.UNIVER_DOC);
10202
+ __publicField(this, "type", R.UNIVER_DOC);
10188
10203
  __publicField(this, "_name$", new BehaviorSubject(""));
10189
10204
  __publicField(this, "name$", this._name$.asObservable());
10190
10205
  __publicField(this, "snapshot");
@@ -10409,6 +10424,184 @@ function excludePointsFromRange(range, points) {
10409
10424
  return start <= range[1] && newRanges.push([start, range[1]]), newRanges;
10410
10425
  }
10411
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");
10412
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 || {});
10413
10606
  const tags = [
10414
10607
  // DataStreamTreeTokenType.PARAGRAPH, // 段落
@@ -10752,7 +10945,7 @@ function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "",
10752
10945
  }
10753
10946
  const sortedRetains = [...retainPoints].sort((pre, aft) => pre - aft);
10754
10947
  let cursor2 = textStart;
10755
- return sortedRetains.forEach((pos) => {
10948
+ if (sortedRetains.forEach((pos) => {
10756
10949
  const len = pos - cursor2;
10757
10950
  len > 0 && dos.push({
10758
10951
  t: TextXActionType.DELETE,
@@ -10764,12 +10957,35 @@ function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "",
10764
10957
  len: 1,
10765
10958
  segmentId
10766
10959
  }), cursor2 = pos + 1;
10767
- }), cursor2 < textEnd && dos.push({
10960
+ }), cursor2 < textEnd && (dos.push({
10768
10961
  t: TextXActionType.DELETE,
10769
10962
  len: textEnd - cursor2,
10770
10963
  line: 0,
10771
10964
  segmentId
10772
- }), 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;
10773
10989
  }
10774
10990
  __name(getRetainAndDeleteAndExcludeLineBreak, "getRetainAndDeleteAndExcludeLineBreak");
10775
10991
  const replaceSelectionTextX = /* @__PURE__ */ __name((params) => {
@@ -10807,6 +11023,13 @@ __name(_BuildTextUtils, "BuildTextUtils"), __publicField(_BuildTextUtils, "custo
10807
11023
  getPlainText,
10808
11024
  fromPlainText,
10809
11025
  isEmptyDocument
11026
+ }), __publicField(_BuildTextUtils, "paragraph", {
11027
+ bullet: {
11028
+ set: setParagraphBullet,
11029
+ switch: switchParagraphBullet,
11030
+ toggleChecklist: toggleChecklistParagraph,
11031
+ changeNestLevel: changeParagraphBulletNestLevel
11032
+ }
10810
11033
  });
10811
11034
  let BuildTextUtils = _BuildTextUtils;
10812
11035
  function replaceInDocumentBody(body, query, target) {
@@ -10924,10 +11147,10 @@ function fromEventSubject(subject$) {
10924
11147
  }
10925
11148
  __name(fromEventSubject, "fromEventSubject");
10926
11149
  const IResourceManagerService = createIdentifier("core.resource-manager.service"), nameMap = {
10927
- [G.Editor]: "Editor",
10928
- [G.Owner]: "Owner",
10929
- [G.Reader]: "Reader",
10930
- [G.UNRECOGNIZED]: "UNRECOGNIZED"
11150
+ [S.Editor]: "Editor",
11151
+ [S.Owner]: "Owner",
11152
+ [S.Reader]: "Reader",
11153
+ [S.UNRECOGNIZED]: "UNRECOGNIZED"
10931
11154
  }, createDefaultUser = /* @__PURE__ */ __name((type2) => type2 ? {
10932
11155
  userID: `${nameMap[type2]}_${Tools.generateRandomId(8)}`,
10933
11156
  name: nameMap[type2],
@@ -10991,7 +11214,7 @@ let AuthzIoLocalService = (_a3 = class {
10991
11214
  }
10992
11215
  _initDefaultUser() {
10993
11216
  const currentUser = this._userManagerService.getCurrentUser();
10994
- currentUser && currentUser.userID || this._userManagerService.setCurrentUser(createDefaultUser(G.Owner));
11217
+ currentUser && currentUser.userID || this._userManagerService.setCurrentUser(createDefaultUser(S.Owner));
10995
11218
  }
10996
11219
  _getRole(type2) {
10997
11220
  const user = this._userManagerService.getCurrentUser();
@@ -11008,7 +11231,7 @@ let AuthzIoLocalService = (_a3 = class {
11008
11231
  }, "toJson"),
11009
11232
  parseJson: /* @__PURE__ */ __name((json) => JSON.parse(json), "parseJson"),
11010
11233
  pluginName: "SHEET_AuthzIoMockService_PLUGIN",
11011
- businesses: [I.UNIVER_SHEET, I.UNIVER_DOC, I.UNIVER_SLIDE],
11234
+ businesses: [R.UNIVER_SHEET, R.UNIVER_DOC, R.UNIVER_SLIDE],
11012
11235
  onLoad: /* @__PURE__ */ __name((_unitId, resource) => {
11013
11236
  for (const key in resource)
11014
11237
  this._permissionMap.set(key, resource[key]);
@@ -11039,13 +11262,13 @@ let AuthzIoLocalService = (_a3 = class {
11039
11262
  objectType: rule.objectType,
11040
11263
  name: rule.name,
11041
11264
  shareOn: !1,
11042
- shareRole: G.Owner,
11265
+ shareRole: S.Owner,
11043
11266
  shareScope: -1,
11044
11267
  scope: {
11045
- read: H.AllCollaborator,
11046
- edit: H.AllCollaborator
11268
+ read: T.AllCollaborator,
11269
+ edit: T.AllCollaborator
11047
11270
  },
11048
- creator: createDefaultUser(G.Owner),
11271
+ creator: createDefaultUser(S.Owner),
11049
11272
  strategies: [
11050
11273
  {
11051
11274
  action: 6,
@@ -11100,7 +11323,7 @@ let AuthzIoLocalService = (_a3 = class {
11100
11323
  role: 1
11101
11324
  }
11102
11325
  ],
11103
- 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) }))
11104
11327
  };
11105
11328
  result.push(item);
11106
11329
  }
@@ -11167,7 +11390,7 @@ const FOCUSING_UNIT = "FOCUSING_UNIT", FOCUSING_SHEET = "FOCUSING_SHEET", FOCUSI
11167
11390
  };
11168
11391
  __name(_ErrorService, "ErrorService");
11169
11392
  let ErrorService = _ErrorService;
11170
- const version = "0.4.0-alpha.1";
11393
+ const version = "0.4.0-alpha.2";
11171
11394
  function getEmptySnapshot(unitID = "", locale = LocaleType.ZH_CN, name = "") {
11172
11395
  return {
11173
11396
  id: unitID,
@@ -12317,7 +12540,7 @@ var _a4;
12317
12540
  let Workbook = (_a4 = class extends UnitModel {
12318
12541
  constructor(workbookData = {}, _logService) {
12319
12542
  super();
12320
- __publicField(this, "type", I.UNIVER_SHEET);
12543
+ __publicField(this, "type", R.UNIVER_SHEET);
12321
12544
  __publicField(this, "_sheetCreated$", new Subject());
12322
12545
  __publicField(this, "sheetCreated$", this._sheetCreated$.asObservable());
12323
12546
  __publicField(this, "_sheetDisposed$", new Subject());
@@ -12562,7 +12785,7 @@ const _SlideDataModel = class _SlideDataModel extends UnitModel {
12562
12785
  constructor(snapshot) {
12563
12786
  var _a11;
12564
12787
  super();
12565
- __publicField(this, "type", I.UNIVER_SLIDE);
12788
+ __publicField(this, "type", R.UNIVER_SLIDE);
12566
12789
  __publicField(this, "_activePage$", new BehaviorSubject(null));
12567
12790
  __publicField(this, "activePage$", this._activePage$.asObservable());
12568
12791
  __publicField(this, "_name$");
@@ -12735,20 +12958,20 @@ let UniverInstanceService = (_a5 = class extends Disposable {
12735
12958
  return type2 && (unit == null ? void 0 : unit.type) !== type2 ? null : unit;
12736
12959
  }
12737
12960
  getCurrentUniverDocInstance() {
12738
- return this.getCurrentUnitForType(I.UNIVER_DOC);
12961
+ return this.getCurrentUnitForType(R.UNIVER_DOC);
12739
12962
  }
12740
12963
  getUniverDocInstance(unitId) {
12741
- return this.getUnit(unitId, I.UNIVER_DOC);
12964
+ return this.getUnit(unitId, R.UNIVER_DOC);
12742
12965
  }
12743
12966
  getUniverSheetInstance(unitId) {
12744
- return this.getUnit(unitId, I.UNIVER_SHEET);
12967
+ return this.getUnit(unitId, R.UNIVER_SHEET);
12745
12968
  }
12746
12969
  getAllUnitsForType(type2) {
12747
12970
  var _a11;
12748
12971
  return (_a11 = this._unitsByType.get(type2)) != null ? _a11 : [];
12749
12972
  }
12750
12973
  changeDoc(unitId, doc) {
12751
- 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);
12752
12975
  if (oldDoc != null) {
12753
12976
  const index2 = allDocs.indexOf(oldDoc);
12754
12977
  allDocs.splice(index2, 1);
@@ -12768,7 +12991,7 @@ let UniverInstanceService = (_a5 = class extends Disposable {
12768
12991
  }
12769
12992
  getUnitType(unitId) {
12770
12993
  const result = this._getUnitById(unitId);
12771
- return result ? result[1] : I.UNRECOGNIZED;
12994
+ return result ? result[1] : R.UNRECOGNIZED;
12772
12995
  }
12773
12996
  disposeUnit(unitId) {
12774
12997
  const result = this._getUnitById(unitId);
@@ -12833,7 +13056,7 @@ let LifecycleService = (_a6 = class extends Disposable {
12833
13056
  * @returns
12834
13057
  */
12835
13058
  subscribeWithPrevious() {
12836
- 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));
12837
13060
  }
12838
13061
  _reportProgress(stage) {
12839
13062
  this._logService.debug("[LifecycleService]", `lifecycle progressed to "${LifecycleNameMap[stage]}".`);
@@ -13025,7 +13248,7 @@ const DependentOnSymbol = Symbol("DependentOn"), _Plugin = class _Plugin extends
13025
13248
  return this.constructor.pluginName;
13026
13249
  }
13027
13250
  };
13028
- __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);
13029
13252
  let Plugin = _Plugin;
13030
13253
  const _PluginStore = class _PluginStore {
13031
13254
  constructor() {
@@ -13084,7 +13307,7 @@ let PluginService = (_a7 = class {
13084
13307
  PluginHolder,
13085
13308
  this._checkPluginSeen.bind(this),
13086
13309
  this._immediateInitPlugin.bind(this)
13087
- ), this._pluginHoldersForTypes.set(I.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
13310
+ ), this._pluginHoldersForTypes.set(R.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
13088
13311
  }
13089
13312
  dispose() {
13090
13313
  this._clearFlushTimer();
@@ -13096,7 +13319,7 @@ let PluginService = (_a7 = class {
13096
13319
  registerPlugin(ctor, config) {
13097
13320
  this._assertPluginValid(ctor), this._scheduleInitPlugin();
13098
13321
  const { type: type2 } = ctor;
13099
- 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);
13100
13323
  }
13101
13324
  startPluginForType(type2) {
13102
13325
  this._ensurePluginHolderForType(type2).start();
@@ -13120,7 +13343,7 @@ let PluginService = (_a7 = class {
13120
13343
  }
13121
13344
  _assertPluginValid(ctor) {
13122
13345
  const { type: type2, pluginName } = ctor;
13123
- if (type2 === I.UNRECOGNIZED)
13346
+ if (type2 === R.UNRECOGNIZED)
13124
13347
  throw new Error(`[PluginService]: invalid plugin type for ${ctor.name}. Please assign a "type" to your plugin.`);
13125
13348
  if (!pluginName)
13126
13349
  throw new Error(`[PluginService]: no plugin name for ${ctor.name}. Please assign a "pluginName" to your plugin.`);
@@ -13895,11 +14118,11 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
13895
14118
  const handleHookAdd = /* @__PURE__ */ __name((hook) => {
13896
14119
  hook.businesses.forEach((business) => {
13897
14120
  switch (business) {
13898
- case I.UNRECOGNIZED:
13899
- case I.UNIVER_UNKNOWN:
13900
- case I.UNIVER_SLIDE:
13901
- case I.UNIVER_DOC: {
13902
- 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) => {
13903
14126
  const plugin = (doc.getSnapshot().resources || []).find((r) => r.name === hook.pluginName);
13904
14127
  if (plugin)
13905
14128
  try {
@@ -13911,8 +14134,8 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
13911
14134
  });
13912
14135
  break;
13913
14136
  }
13914
- case I.UNIVER_SHEET:
13915
- this._univerInstanceService.getAllUnitsForType(I.UNIVER_SHEET).forEach((workbook) => {
14137
+ case R.UNIVER_SHEET:
14138
+ this._univerInstanceService.getAllUnitsForType(R.UNIVER_SHEET).forEach((workbook) => {
13916
14139
  const plugin = (workbook.getSnapshot().resources || []).find((r) => r.name === hook.pluginName);
13917
14140
  if (plugin)
13918
14141
  try {
@@ -13926,20 +14149,20 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
13926
14149
  });
13927
14150
  }, "handleHookAdd");
13928
14151
  this._resourceManagerService.getAllResourceHooks().forEach((hook) => handleHookAdd(hook)), this.disposeWithMe(this._resourceManagerService.register$.subscribe((hook) => handleHookAdd(hook))), this.disposeWithMe(
13929
- this._univerInstanceService.getTypeOfUnitAdded$(I.UNIVER_SHEET).subscribe((workbook) => {
14152
+ this._univerInstanceService.getTypeOfUnitAdded$(R.UNIVER_SHEET).subscribe((workbook) => {
13930
14153
  this._resourceManagerService.loadResources(workbook.getUnitId(), workbook.getSnapshot().resources);
13931
14154
  })
13932
14155
  ), this.disposeWithMe(
13933
- this._univerInstanceService.getTypeOfUnitAdded$(I.UNIVER_DOC).subscribe((doc) => {
14156
+ this._univerInstanceService.getTypeOfUnitAdded$(R.UNIVER_DOC).subscribe((doc) => {
13934
14157
  const unitId = doc.getUnitId();
13935
14158
  isInternalEditorID(unitId) || this._resourceManagerService.loadResources(doc.getUnitId(), doc.getSnapshot().resources);
13936
14159
  })
13937
14160
  ), this.disposeWithMe(
13938
- this._univerInstanceService.getTypeOfUnitDisposed$(I.UNIVER_SHEET).subscribe((workbook) => {
14161
+ this._univerInstanceService.getTypeOfUnitDisposed$(R.UNIVER_SHEET).subscribe((workbook) => {
13939
14162
  this._resourceManagerService.unloadResources(workbook.getUnitId());
13940
14163
  })
13941
14164
  ), this.disposeWithMe(
13942
- this._univerInstanceService.getTypeOfUnitDisposed$(I.UNIVER_DOC).subscribe((doc) => {
14165
+ this._univerInstanceService.getTypeOfUnitDisposed$(R.UNIVER_DOC).subscribe((doc) => {
13943
14166
  this._resourceManagerService.unloadResources(doc.getUnitId());
13944
14167
  })
13945
14168
  );
@@ -13992,22 +14215,22 @@ const _Univer = class _Univer {
13992
14215
  * @deprecated use `createUnit` instead
13993
14216
  */
13994
14217
  createUniverSheet(data) {
13995
- 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);
13996
14219
  }
13997
14220
  /**
13998
14221
  * @deprecated use `createUnit` instead
13999
14222
  */
14000
14223
  createUniverDoc(data) {
14001
- 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);
14002
14225
  }
14003
14226
  /**
14004
14227
  * @deprecated use `createUnit` instead
14005
14228
  */
14006
14229
  createUniverSlide(data) {
14007
- 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);
14008
14231
  }
14009
14232
  _init(injector) {
14010
- 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);
14011
14234
  const univerInstanceService = injector.get(IUniverInstanceService);
14012
14235
  univerInstanceService.__setCreateHandler(
14013
14236
  (type2, data, ctor, options) => {
@@ -14272,7 +14495,7 @@ export {
14272
14495
  UnitModel,
14273
14496
  Univer,
14274
14497
  UniverInstanceService,
14275
- I as UniverInstanceType,
14498
+ R as UniverInstanceType,
14276
14499
  UpdateDocsAttributeType,
14277
14500
  UserManagerService,
14278
14501
  VerticalAlign,
@@ -14286,6 +14509,7 @@ export {
14286
14509
  afterInitApply,
14287
14510
  awaitTime,
14288
14511
  binarySearchArray,
14512
+ bufferDebounceTime,
14289
14513
  cellToRange,
14290
14514
  characterSpacingControlType,
14291
14515
  checkForSubstrings,
@@ -14366,10 +14590,10 @@ export {
14366
14590
  makeCellRangeToRangeData,
14367
14591
  makeCellToSelection,
14368
14592
  makeCustomRangeStream,
14369
- merge,
14593
+ merge$1 as merge,
14370
14594
  mergeOverrideWithDependencies,
14371
14595
  mergeSets,
14372
- mergeWith,
14596
+ mergeWith$1 as mergeWith,
14373
14597
  mergeWorksheetSnapshotWithDefault,
14374
14598
  mixinClass,
14375
14599
  moveMatrixArray,