@univerjs/find-replace 0.2.3 → 0.2.4-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,92 +1,90 @@
1
1
  var at = Object.defineProperty;
2
2
  var ot = (t, e, n) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var c = (t, e, n) => ot(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { Disposable as X, IUniverInstanceService as pe, toDisposable as H, IContextService as ee, DisposableCollection as ct, CommandType as y, LocaleService as D, ICommandService as te, FOCUSING_SHEET as _e, EDITOR_ACTIVATED as ge, UniverInstanceType as lt, RxDisposable as dt, OnLifecycle as ht, LifecycleStages as ut, Plugin as ft, Tools as pt } from "@univerjs/core";
5
- import { createIdentifier as _t, Inject as x, Injector as ie } from "@wendellhu/redi";
6
- import { IConfirmService as gt, IMessageService as me, useObservable as I, ILayoutService as ve, KeyCode as M, MetaKeys as b, MenuGroup as mt, MenuItemType as vt, MenuPosition as St, getMenuHiddenObservable as Ct, ComponentManager as Rt, IMenuService as Mt, IShortcutService as xt, IDialogService as bt } from "@univerjs/ui";
7
- import { BehaviorSubject as P, Subject as Se, throttleTime as yt, combineLatest as Ce, debounceTime as It, fromEvent as Ft, map as Pt, takeUntil as ce } from "rxjs";
8
- import { RENDER_RAW_FORMULA_KEY as Dt } from "@univerjs/engine-render";
9
- import Ot, { forwardRef as w, useRef as q, createElement as Re, useCallback as _, Fragment as $, useEffect as j, useMemo as ne, useImperativeHandle as Tt } from "react";
10
- import { MessageType as N, InputWithSlot as Et, Pager as $t, Button as A, FormLayout as R, Input as Nt, Select as V, FormDualColumnLayout as le, Checkbox as de } from "@univerjs/design";
11
- import { useDependency as S } from "@wendellhu/redi/react-bindings";
12
- var g = function() {
13
- return g = Object.assign || function(t) {
3
+ var o = (t, e, n) => ot(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { Disposable as X, createIdentifier as ct, Inject as b, Injector as ee, IUniverInstanceService as pe, toDisposable as H, IContextService as te, DisposableCollection as lt, CommandType as y, LocaleService as O, useDependency as v, ICommandService as ie, FOCUSING_SHEET as _e, EDITOR_ACTIVATED as ge, UniverInstanceType as dt, RxDisposable as ht, OnLifecycle as ut, LifecycleStages as ft, Plugin as pt, Tools as _t } from "@univerjs/core";
5
+ import { IConfirmService as gt, IMessageService as me, useObservable as I, ILayoutService as ve, KeyCode as M, MetaKeys as x, MenuGroup as mt, MenuItemType as vt, MenuPosition as St, getMenuHiddenObservable as Ct, ComponentManager as Rt, IMenuService as Mt, IShortcutService as bt, IDialogService as xt } from "@univerjs/ui";
6
+ import { BehaviorSubject as D, Subject as Se, throttleTime as yt, combineLatest as Ce, debounceTime as It, fromEvent as Ft, map as Dt, takeUntil as ce } from "rxjs";
7
+ import { RENDER_RAW_FORMULA_KEY as Ot } from "@univerjs/engine-render";
8
+ import Pt, { forwardRef as w, useRef as q, createElement as Re, useCallback as u, Fragment as N, useEffect as j, useMemo as ne, useImperativeHandle as Tt } from "react";
9
+ import { MessageType as $, InputWithSlot as Et, Pager as Nt, Button as A, FormLayout as R, Input as $t, Select as G, FormDualColumnLayout as le, Checkbox as de } from "@univerjs/design";
10
+ var _ = function() {
11
+ return _ = Object.assign || function(t) {
14
12
  for (var e, n = 1, i = arguments.length; n < i; n++) {
15
13
  e = arguments[n];
16
- for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
14
+ for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
17
15
  }
18
16
  return t;
19
- }, g.apply(this, arguments);
17
+ }, _.apply(this, arguments);
20
18
  }, At = function(t, e) {
21
19
  var n = {};
22
20
  for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
23
21
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
24
- for (var s = 0, i = Object.getOwnPropertySymbols(t); s < i.length; s++)
25
- e.indexOf(i[s]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[s]) && (n[i[s]] = t[i[s]]);
22
+ for (var r = 0, i = Object.getOwnPropertySymbols(t); r < i.length; r++)
23
+ e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (n[i[r]] = t[i[r]]);
26
24
  return n;
27
25
  }, Me = w(function(t, e) {
28
- var n = t.icon, i = t.id, s = t.className, r = t.extend, a = At(t, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(i, " ").concat(s || "").trim(), d = q("_".concat(wt()));
29
- return xe(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, g({ ref: e, className: o }, a), r);
26
+ var n = t.icon, i = t.id, r = t.className, s = t.extend, a = At(t, ["icon", "id", "className", "extend"]), l = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), d = q("_".concat(wt()));
27
+ return be(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, _({ ref: e, className: l }, a), s);
30
28
  });
31
- function xe(t, e, n, i, s) {
32
- return Re(t.tag, g(g({ key: e }, jt(t, n, s)), i), (Lt(t, n).children || []).map(function(r, a) {
33
- return xe(r, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, s);
29
+ function be(t, e, n, i, r) {
30
+ return Re(t.tag, _(_({ key: e }, jt(t, n, r)), i), (Lt(t, n).children || []).map(function(s, a) {
31
+ return be(s, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, r);
34
32
  }));
35
33
  }
36
34
  function jt(t, e, n) {
37
- var i = g({}, t.attrs);
35
+ var i = _({}, t.attrs);
38
36
  n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1);
39
- var s = e.defIds;
40
- return !s || s.length === 0 || (t.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(function(r) {
41
- var a = r[0], o = r[1];
42
- typeof o == "string" && (i[a] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
37
+ var r = e.defIds;
38
+ return !r || r.length === 0 || (t.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(function(s) {
39
+ var a = s[0], l = s[1];
40
+ typeof l == "string" && (i[a] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
43
41
  })), i;
44
42
  }
45
43
  function Lt(t, e) {
46
44
  var n, i = e.defIds;
47
- return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? g(g({}, t), { children: t.children.map(function(s) {
48
- return typeof s.attrs.id == "string" && i && i.indexOf(s.attrs.id) > -1 ? g(g({}, s), { attrs: g(g({}, s.attrs), { id: s.attrs.id + e.idSuffix }) }) : s;
45
+ return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? _(_({}, t), { children: t.children.map(function(r) {
46
+ return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ? _(_({}, r), { attrs: _(_({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
49
47
  }) }) : t;
50
48
  }
51
49
  function wt() {
52
50
  return Math.random().toString(36).substring(2, 8);
53
51
  }
54
52
  Me.displayName = "UniverIcon";
55
- var Ut = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_217_40", style: { maskType: "alpha" }, width: 17, height: 17, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0.9 0.09H16.9V16.09H0.9z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_217_40)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.39551 7.37266C2.39551 4.18105 4.98281 1.59375 8.17441 1.59375C11.366 1.59375 13.9533 4.18105 13.9533 7.37266C13.9533 8.72342 13.4898 9.96603 12.7133 10.95L15.1964 13.4331C15.4619 13.6986 15.4619 14.1291 15.1964 14.3946C14.9309 14.6601 14.5004 14.6601 14.2349 14.3946L11.7518 11.9115C10.7678 12.6881 9.52525 13.1516 8.17441 13.1516C4.98281 13.1516 2.39551 10.5642 2.39551 7.37266ZM8.17441 2.95349C5.73378 2.95349 3.75525 4.93202 3.75525 7.37266C3.75525 9.81333 5.73378 11.7918 8.17441 11.7918C10.6151 11.7918 12.5936 9.81333 12.5936 7.37266C12.5936 4.93202 10.6151 2.95349 8.17441 2.95349Z", fillRule: "evenodd", clipRule: "evenodd" } }] }] }, be = w(function(t, e) {
53
+ var Ut = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_217_40", style: { maskType: "alpha" }, width: 17, height: 17, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0.9 0.09H16.9V16.09H0.9z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_217_40)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.39551 7.37266C2.39551 4.18105 4.98281 1.59375 8.17441 1.59375C11.366 1.59375 13.9533 4.18105 13.9533 7.37266C13.9533 8.72342 13.4898 9.96603 12.7133 10.95L15.1964 13.4331C15.4619 13.6986 15.4619 14.1291 15.1964 14.3946C14.9309 14.6601 14.5004 14.6601 14.2349 14.3946L11.7518 11.9115C10.7678 12.6881 9.52525 13.1516 8.17441 13.1516C4.98281 13.1516 2.39551 10.5642 2.39551 7.37266ZM8.17441 2.95349C5.73378 2.95349 3.75525 4.93202 3.75525 7.37266C3.75525 9.81333 5.73378 11.7918 8.17441 11.7918C10.6151 11.7918 12.5936 9.81333 12.5936 7.37266C12.5936 4.93202 10.6151 2.95349 8.17441 2.95349Z", fillRule: "evenodd", clipRule: "evenodd" } }] }] }, xe = w(function(t, e) {
56
54
  return Re(Me, Object.assign({}, t, {
57
55
  id: "search-single-16",
58
56
  ref: e,
59
57
  icon: Ut
60
58
  }));
61
59
  });
62
- be.displayName = "SearchSingle16";
60
+ xe.displayName = "SearchSingle16";
63
61
  const ye = "FIND_REPLACE_INPUT_FOCUS", Ie = "FIND_REPLACE_DIALOG_FOCUS", Fe = "FIND_REPLACE_REPLACE_REVEALED";
64
- var Bt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Pe = (t, e, n, i) => {
65
- for (var s = i > 1 ? void 0 : i ? Wt(e, n) : e, r = t.length - 1, a; r >= 0; r--)
66
- (a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
67
- return i && s && Bt(e, n, s), s;
62
+ var Bt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, De = (t, e, n, i) => {
63
+ for (var r = i > 1 ? void 0 : i ? Wt(e, n) : e, s = t.length - 1, a; s >= 0; s--)
64
+ (a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
65
+ return i && r && Bt(e, n, r), r;
68
66
  }, z = (t, e) => (n, i) => e(n, i, t);
69
- class Ai extends X {
67
+ class Ni extends X {
70
68
  }
71
- const m = _t("find-replace.service");
72
- function Gt(t) {
69
+ const g = ct("find-replace.service");
70
+ function kt(t) {
73
71
  return typeof t.findString < "u" || typeof t.inputtingFindString < "u" || typeof t.findDirection < "u" || typeof t.matchesTheWholeCell < "u" || typeof t.caseSensitive < "u" || typeof t.findScope < "u" || typeof t.findBy < "u";
74
72
  }
75
73
  let K = class extends X {
76
74
  constructor(e, n, i) {
77
75
  super();
78
- c(this, "currentMatch$", new P(null));
79
- c(this, "replaceables$", new P([]));
76
+ o(this, "currentMatch$", new D(null));
77
+ o(this, "replaceables$", new D([]));
80
78
  /** All find models returned by providers. */
81
- c(this, "_findModels", []);
79
+ o(this, "_findModels", []);
82
80
  /** The find model that the current match is from. */
83
- c(this, "_matchingModel", null);
84
- c(this, "_matches", []);
85
- c(this, "_currentSearchingDisposables", null);
81
+ o(this, "_matchingModel", null);
82
+ o(this, "_matches", []);
83
+ o(this, "_currentSearchingDisposables", null);
86
84
  this._state = e, this._providers = n, this._univerInstanceService = i, this.disposeWithMe(
87
- this._state.stateUpdates$.pipe(yt(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (s) => {
88
- const r = this._state.state;
89
- Gt(s) && (r.findString !== "" && !r.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : s.replaceRevealed !== !0 && this._stopSearching());
85
+ this._state.stateUpdates$.pipe(yt(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (r) => {
86
+ const s = this._state.state;
87
+ kt(r) && (s.findString !== "" && !s.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : r.replaceRevealed !== !0 && this._stopSearching());
90
88
  })
91
89
  );
92
90
  }
@@ -94,7 +92,7 @@ let K = class extends X {
94
92
  return this._findModels.length > 0;
95
93
  }
96
94
  dispose() {
97
- super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...se(), revealed: !1 });
95
+ super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...re(), revealed: !1 });
98
96
  }
99
97
  async start() {
100
98
  if (!this._state.findString)
@@ -117,14 +115,7 @@ let K = class extends X {
117
115
  })))).flat();
118
116
  this._subscribeToModelsChanges(n);
119
117
  const i = this._matches = n.map((r) => r.getMatches()).flat();
120
- if (this.replaceables$.next(i.filter((r) => r.replaceable)), !i.length)
121
- return this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), { results: [] };
122
- const s = this._moveToInitialMatch(n, i);
123
- return this._state.changeState({
124
- matchesCount: i.length,
125
- matchesPosition: s + 1
126
- // the matches position start from 1
127
- }), { results: i };
118
+ return this.replaceables$.next(i.filter((r) => r.replaceable)), i.length ? (this._moveToInitialMatch(n), this._state.changeState({ matchesCount: i.length }), { results: i }) : (this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), { results: [] });
128
119
  }
129
120
  /** Terminate the current searching session, when searching string is empty. */
130
121
  _stopSearching() {
@@ -137,16 +128,12 @@ let K = class extends X {
137
128
  }
138
129
  // When a document's content changes, we should reset all matches and try to move to the next match.
139
130
  _subscribeToModelsChanges(e) {
140
- const n = this._currentSearchingDisposables = new ct(), i = Ce(e.map((s) => s.matchesUpdate$)).pipe(It(220)).subscribe(([...s]) => {
141
- const r = this._matches = s.flat();
142
- if (r.length) {
143
- const a = this._moveToInitialMatch(this._findModels, r, !0);
144
- this._state.changeState({ matchesCount: r.length, matchesPosition: a + 1 }), this.replaceables$.next(r.filter((o) => o.replaceable));
145
- } else
146
- this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), this.replaceables$.next([]);
131
+ const n = this._currentSearchingDisposables = new lt(), i = Ce(e.map((r) => r.matchesUpdate$)).pipe(It(220)).subscribe(([...r]) => {
132
+ const s = this._matches = r.flat();
133
+ s.length ? (this._moveToInitialMatch(this._findModels, !0), this._state.changeState({ matchesCount: s.length }), this.replaceables$.next(s.filter((a) => a.replaceable))) : (this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), this.replaceables$.next([]));
147
134
  });
148
- e.forEach((s) => n.add(H(s.activelyChangingMatch$.subscribe((r) => {
149
- const a = this._matches.findIndex((o) => o === r);
135
+ e.forEach((r) => n.add(H(r.activelyChangingMatch$.subscribe((s) => {
136
+ const a = this._matches.findIndex((l) => l === s);
150
137
  this._state.changeState({ matchesPosition: a + 1 });
151
138
  })))), n.add(H(i));
152
139
  }
@@ -154,26 +141,40 @@ let K = class extends X {
154
141
  return this._matchingModel ? this._matchingModel.replace(this._state.replaceString) : !1;
155
142
  }
156
143
  async replaceAll() {
157
- const e = await Promise.all(this._findModels.map((n) => n.replaceAll(this._state.replaceString))).then((n) => n.reduce((i, s) => (i.success += s.success, i.failure += s.failure, i), { success: 0, failure: 0 }));
144
+ const e = await Promise.all(this._findModels.map((n) => n.replaceAll(this._state.replaceString))).then((n) => n.reduce((i, r) => (i.success += r.success, i.failure += r.failure, i), { success: 0, failure: 0 }));
158
145
  return e.failure === 0 && this._stopSearching(), e;
159
146
  }
160
147
  getCurrentMatch() {
161
148
  return this._state.matchesPosition > 0 ? this._matches[this._state.matchesPosition - 1] : null;
162
149
  }
150
+ _markMatch(e) {
151
+ const n = this._matches.findIndex((i) => i === e);
152
+ this.currentMatch$.next(e), this._state.changeState({ matchesPosition: n + 1 });
153
+ }
163
154
  moveToNextMatch() {
164
155
  if (!this._matchingModel)
165
156
  return;
166
157
  const e = this._findModels.length === 1, n = this._matchingModel.moveToNextMatch({ loop: e });
167
- if (n) {
168
- const i = this._matches.findIndex((s) => s === n);
169
- this.currentMatch$.next(n), this._state.changeState({
170
- matchesPosition: i + 1
171
- });
172
- } else {
173
- const i = this._findModels.findIndex((o) => o === this._matchingModel), s = this._findModels[(i + 1) % this._findModels.length], r = s.moveToNextMatch(), a = this._matches.findIndex((o) => o === r);
174
- this.currentMatch$.next(r), this._matchingModel = s, this._state.changeState({
175
- matchesPosition: a + 1
176
- });
158
+ if (n)
159
+ this._markMatch(n);
160
+ else {
161
+ const i = this._findModels.findIndex((r) => r === this._matchingModel);
162
+ this._moveToNextUnitMatch(i);
163
+ }
164
+ }
165
+ _moveToNextUnitMatch(e) {
166
+ const n = this._findModels.length;
167
+ for (let i = (e + 1) % n; i !== e; ) {
168
+ const r = this._findModels[i], s = r.moveToNextMatch({ ignoreSelection: !0 });
169
+ if (s) {
170
+ this._matchingModel = r, this._markMatch(s);
171
+ return;
172
+ }
173
+ i = (i + 1) % n;
174
+ }
175
+ if (this._matchingModel) {
176
+ const i = this._matchingModel.moveToNextMatch({ ignoreSelection: !0 });
177
+ i && this._markMatch(i);
177
178
  }
178
179
  }
179
180
  moveToPreviousMatch() {
@@ -181,38 +182,42 @@ let K = class extends X {
181
182
  return;
182
183
  const e = this._findModels.length === 1, n = this._matchingModel.moveToPreviousMatch({ loop: e });
183
184
  if (n) {
184
- const i = this._matches.findIndex((s) => s === n);
185
- this.currentMatch$.next(n), this._state.changeState({
186
- matchesPosition: i + 1
187
- });
185
+ const i = this._matches.findIndex((r) => r === n);
186
+ this.currentMatch$.next(n), this._state.changeState({ matchesPosition: i + 1 });
188
187
  } else {
189
- const i = this._findModels.findIndex((o) => o === this._matchingModel), s = this._findModels[(i - 1 + this._findModels.length) % this._findModels.length], r = s.moveToPreviousMatch(), a = this._matches.findIndex((o) => o === r);
190
- this.currentMatch$.next(r), this._matchingModel = s, this._state.changeState({
191
- matchesPosition: a + 1
192
- });
188
+ const i = this._findModels.length, r = this._findModels.findIndex((a) => a === this._matchingModel);
189
+ for (let a = (r - 1 + i) % i; a !== r; ) {
190
+ const l = this._findModels[a], d = l.moveToPreviousMatch({ ignoreSelection: !0 });
191
+ if (d) {
192
+ this._matchingModel = l, this._markMatch(d);
193
+ return;
194
+ }
195
+ a = (a - 1) % i;
196
+ }
197
+ const s = this._matchingModel.moveToPreviousMatch({ ignoreSelection: !0 });
198
+ s && this._markMatch(s);
193
199
  }
194
200
  }
195
- _moveToInitialMatch(e, n, i = !1) {
196
- var d;
197
- const s = (d = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : d.getUnitId();
198
- if (!s)
201
+ _moveToInitialMatch(e, n = !1) {
202
+ var s;
203
+ const i = (s = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : s.getUnitId();
204
+ if (!i)
199
205
  return -1;
200
- const r = e.find((u) => u.unitId === s);
201
- if (r) {
202
- this._matchingModel = r;
203
- const u = r.moveToNextMatch({ stayIfOnMatch: !0, noFocus: i }), f = n.findIndex((p) => p === u);
204
- return this.currentMatch$.next(u), f;
206
+ const r = e.findIndex((a) => a.unitId === i);
207
+ if (r !== -1) {
208
+ this._matchingModel = e[r];
209
+ const a = this._matchingModel.moveToNextMatch({ stayIfOnMatch: !0, noFocus: n });
210
+ if (a)
211
+ return this._markMatch(a), r;
205
212
  }
206
- this._matchingModel = e[0];
207
- const a = this._matchingModel.moveToNextMatch({ noFocus: i }), o = this._matches.findIndex((u) => u === a);
208
- return this.currentMatch$.next(a), o;
213
+ return this._moveToNextUnitMatch(r), 0;
209
214
  }
210
215
  };
211
- K = Pe([
216
+ K = De([
212
217
  z(2, pe)
213
218
  ], K);
214
219
  var Y = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(Y || {}), Z = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(Z || {}), J = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(J || {});
215
- function se() {
220
+ function re() {
216
221
  return {
217
222
  caseSensitive: !1,
218
223
  findBy: "value",
@@ -229,25 +234,25 @@ function se() {
229
234
  revealed: !0
230
235
  };
231
236
  }
232
- class Vt {
237
+ class Gt {
233
238
  constructor() {
234
- c(this, "_stateUpdates$", new Se());
235
- c(this, "stateUpdates$", this._stateUpdates$.asObservable());
236
- c(this, "_state$", new P(se()));
237
- c(this, "state$", this._state$.asObservable());
238
- c(this, "_findString", "");
239
- c(this, "_inputtingFindString", "");
240
- c(this, "_replaceString", "");
241
- c(this, "_revealed", !1);
242
- c(this, "_replaceRevealed", !1);
243
- c(this, "_matchesPosition", 0);
244
- c(this, "_matchesCount", 0);
245
- c(this, "_caseSensitive", !0);
246
- c(this, "_matchesTheWholeCell", !1);
247
- c(this, "_findDirection", "row");
248
- c(this, "_findScope", "subunit");
249
- c(this, "_findBy", "value");
250
- c(this, "_findCompleted", !1);
239
+ o(this, "_stateUpdates$", new Se());
240
+ o(this, "stateUpdates$", this._stateUpdates$.asObservable());
241
+ o(this, "_state$", new D(re()));
242
+ o(this, "state$", this._state$.asObservable());
243
+ o(this, "_findString", "");
244
+ o(this, "_inputtingFindString", "");
245
+ o(this, "_replaceString", "");
246
+ o(this, "_revealed", !1);
247
+ o(this, "_replaceRevealed", !1);
248
+ o(this, "_matchesPosition", 0);
249
+ o(this, "_matchesCount", 0);
250
+ o(this, "_caseSensitive", !0);
251
+ o(this, "_matchesTheWholeCell", !1);
252
+ o(this, "_findDirection", "row");
253
+ o(this, "_findScope", "subunit");
254
+ o(this, "_findBy", "value");
255
+ o(this, "_findCompleted", !1);
251
256
  }
252
257
  get state() {
253
258
  return this._state$.getValue();
@@ -291,6 +296,7 @@ class Vt {
291
296
  get findCompleted() {
292
297
  return this._findCompleted;
293
298
  }
299
+ // eslint-disable-next-line max-lines-per-function, complexity
294
300
  changeState(e) {
295
301
  let n = !1;
296
302
  const i = {};
@@ -313,15 +319,15 @@ class Vt {
313
319
  let Q = class extends X {
314
320
  constructor(e, n) {
315
321
  super();
316
- c(this, "_providers", /* @__PURE__ */ new Set());
317
- c(this, "_state", new Vt());
318
- c(this, "_model");
319
- c(this, "_currentMatch$", new P(null));
320
- c(this, "currentMatch$", this._currentMatch$.asObservable());
321
- c(this, "_replaceables$", new P([]));
322
- c(this, "replaceables$", this._replaceables$.asObservable());
323
- c(this, "_focusSignal$", new Se());
324
- c(this, "focusSignal$", this._focusSignal$.asObservable());
322
+ o(this, "_providers", /* @__PURE__ */ new Set());
323
+ o(this, "_state", new Gt());
324
+ o(this, "_model");
325
+ o(this, "_currentMatch$", new D(null));
326
+ o(this, "currentMatch$", this._currentMatch$.asObservable());
327
+ o(this, "_replaceables$", new D([]));
328
+ o(this, "replaceables$", this._replaceables$.asObservable());
329
+ o(this, "_focusSignal$", new Se());
330
+ o(this, "focusSignal$", this._focusSignal$.asObservable());
325
331
  this._injector = e, this._contextService = n;
326
332
  }
327
333
  get stateUpdates$() {
@@ -397,7 +403,7 @@ let Q = class extends X {
397
403
  if (this._providers.size === 0)
398
404
  return !1;
399
405
  this._model = this._injector.createInstance(K, this._state, this._providers), this._model.currentMatch$.subscribe((i) => this._currentMatch$.next(i)), this._model.replaceables$.subscribe((i) => this._replaceables$.next(i));
400
- const n = se();
406
+ const n = re();
401
407
  return e && (n.replaceRevealed = !0), this._state.changeState(n), this._toggleRevealReplace(e), !0;
402
408
  }
403
409
  find() {
@@ -415,35 +421,35 @@ let Q = class extends X {
415
421
  this._contextService.setContextValue(Fe, e);
416
422
  }
417
423
  _toggleDisplayRawFormula(e) {
418
- this._contextService.setContextValue(Dt, e);
424
+ this._contextService.setContextValue(Ot, e);
419
425
  }
420
426
  };
421
- Q = Pe([
422
- z(0, x(ie)),
423
- z(1, ee)
427
+ Q = De([
428
+ z(0, b(ee)),
429
+ z(1, te)
424
430
  ], Q);
425
431
  const U = {
426
432
  id: "ui.operation.open-find-dialog",
427
433
  type: y.OPERATION,
428
434
  handler: (t) => {
429
- const e = t.get(m);
435
+ const e = t.get(g);
430
436
  return e.revealed ? e.focusFindInput() : e.start(), !0;
431
437
  }
432
- }, re = {
438
+ }, se = {
433
439
  id: "ui.operation.open-replace-dialog",
434
440
  type: y.OPERATION,
435
441
  handler: (t) => {
436
- const e = t.get(m);
442
+ const e = t.get(g);
437
443
  return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
438
444
  }
439
- }, De = {
445
+ }, Oe = {
440
446
  type: y.OPERATION,
441
447
  id: "ui.operation.go-to-next-match",
442
- handler: (t) => (t.get(m).moveToNextMatch(), !0)
443
- }, Oe = {
448
+ handler: (t) => (t.get(g).moveToNextMatch(), !0)
449
+ }, Pe = {
444
450
  type: y.OPERATION,
445
451
  id: "ui.operation.go-to-previous-match",
446
- handler: (t) => (t.get(m).moveToPreviousMatch(), !0)
452
+ handler: (t) => (t.get(g).moveToPreviousMatch(), !0)
447
453
  };
448
454
  var Te = { exports: {} }, B = {};
449
455
  /**
@@ -455,28 +461,28 @@ var Te = { exports: {} }, B = {};
455
461
  * This source code is licensed under the MIT license found in the
456
462
  * LICENSE file in the root directory of this source tree.
457
463
  */
458
- var kt = Ot, Ht = Symbol.for("react.element"), qt = Symbol.for("react.fragment"), zt = Object.prototype.hasOwnProperty, Kt = kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Yt = { key: !0, ref: !0, __self: !0, __source: !0 };
464
+ var Vt = Pt, Ht = Symbol.for("react.element"), qt = Symbol.for("react.fragment"), zt = Object.prototype.hasOwnProperty, Kt = Vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Yt = { key: !0, ref: !0, __self: !0, __source: !0 };
459
465
  function Ee(t, e, n) {
460
- var i, s = {}, r = null, a = null;
461
- n !== void 0 && (r = "" + n), e.key !== void 0 && (r = "" + e.key), e.ref !== void 0 && (a = e.ref);
462
- for (i in e) zt.call(e, i) && !Yt.hasOwnProperty(i) && (s[i] = e[i]);
463
- if (t && t.defaultProps) for (i in e = t.defaultProps, e) s[i] === void 0 && (s[i] = e[i]);
464
- return { $$typeof: Ht, type: t, key: r, ref: a, props: s, _owner: Kt.current };
466
+ var i, r = {}, s = null, a = null;
467
+ n !== void 0 && (s = "" + n), e.key !== void 0 && (s = "" + e.key), e.ref !== void 0 && (a = e.ref);
468
+ for (i in e) zt.call(e, i) && !Yt.hasOwnProperty(i) && (r[i] = e[i]);
469
+ if (t && t.defaultProps) for (i in e = t.defaultProps, e) r[i] === void 0 && (r[i] = e[i]);
470
+ return { $$typeof: Ht, type: t, key: s, ref: a, props: r, _owner: Kt.current };
465
471
  }
466
472
  B.Fragment = qt;
467
473
  B.jsx = Ee;
468
474
  B.jsxs = Ee;
469
475
  Te.exports = B;
470
- var l = Te.exports;
471
- const $e = {
476
+ var c = Te.exports;
477
+ const Ne = {
472
478
  id: "ui.command.replace-current-match",
473
479
  type: y.COMMAND,
474
- handler: (t) => t.get(m).replace()
475
- }, Zt = "CONFIRM_REPLACE_ALL", Ne = {
480
+ handler: (t) => t.get(g).replace()
481
+ }, Zt = "CONFIRM_REPLACE_ALL", $e = {
476
482
  id: "ui.command.replace-all-matches",
477
483
  type: y.COMMAND,
478
484
  handler: async (t) => {
479
- const e = t.get(gt), n = t.get(D), i = t.get(me);
485
+ const e = t.get(gt), n = t.get(O), i = t.get(me);
480
486
  if (!await e.confirm({
481
487
  id: Zt,
482
488
  title: { title: n.t("find-replace.replace.confirm.title") },
@@ -484,40 +490,40 @@ const $e = {
484
490
  confirmText: n.t("button.confirm")
485
491
  }))
486
492
  return !1;
487
- const r = await t.get(m).replaceAll(), { success: a, failure: o } = r;
488
- return o > 0 ? (a === 0 ? i.show({
489
- type: N.Error,
493
+ const s = await t.get(g).replaceAll(), { success: a, failure: l } = s;
494
+ return l > 0 ? (a === 0 ? i.show({
495
+ type: $.Error,
490
496
  content: n.t("find-replace.replace.all-failure")
491
497
  }) : i.show({
492
- type: N.Warning,
493
- content: n.t("find-replace.replace.partial-success", `${a}`, `${o}`)
498
+ type: $.Warning,
499
+ content: n.t("find-replace.replace.partial-success", `${a}`, `${l}`)
494
500
  }), !1) : (i.show({
495
- type: N.Success,
501
+ type: $.Success,
496
502
  content: n.t("find-replace.replace.all-success", `${a}`)
497
503
  }), !0);
498
504
  }
499
505
  };
500
506
  function Ae(t) {
501
- const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: s, findString: r, findReplaceService: a, onChange: o, ...d } = t, f = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
502
- return /* @__PURE__ */ l.jsx(
507
+ const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: r, findString: s, findReplaceService: a, onChange: l, ...d } = t, f = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
508
+ return /* @__PURE__ */ c.jsx(
503
509
  Et,
504
510
  {
505
511
  autoFocus: !0,
506
512
  placeholder: n.t("find-replace.dialog.find-placeholder"),
507
- slot: /* @__PURE__ */ l.jsx(
508
- $t,
513
+ slot: /* @__PURE__ */ c.jsx(
514
+ Nt,
509
515
  {
510
516
  loop: !0,
511
517
  text: f,
512
- value: s,
518
+ value: r,
513
519
  total: i,
514
520
  onChange: (p) => {
515
- s === i && p === 1 ? a.moveToNextMatch() : s === 1 && p === i || p < s ? a.moveToPreviousMatch() : a.moveToNextMatch();
521
+ r === i && p === 1 ? a.moveToNextMatch() : r === 1 && p === i || p < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
516
522
  }
517
523
  }
518
524
  ),
519
- value: r,
520
- onChange: (p) => o == null ? void 0 : o(p),
525
+ value: s,
526
+ onChange: (p) => l == null ? void 0 : l(p),
521
527
  ...d
522
528
  }
523
529
  );
@@ -530,40 +536,40 @@ const Jt = "univer-find-replace-dialog-container", Qt = "univer-find-replace-exp
530
536
  findReplaceButtonsGroupRight: ti
531
537
  };
532
538
  function je(t, e) {
533
- const n = _(() => {
534
- var s;
535
- (s = document.querySelector(".univer-find-input input")) == null || s.focus();
536
- }, []), i = _(() => {
537
- const s = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
538
- return Array.from(s).some((r) => r === document.activeElement);
539
+ const n = u(() => {
540
+ var r;
541
+ (r = document.querySelector(".univer-find-input input")) == null || r.focus();
542
+ }, []), i = u(() => {
543
+ const r = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
544
+ return Array.from(r).some((s) => s === document.activeElement);
539
545
  }, []);
540
546
  return Tt(e, () => ({ focus: n, selectHasFocus: i })), j(() => {
541
- const s = t.focusSignal$.subscribe(() => n());
542
- return () => s.unsubscribe();
547
+ const r = t.focusSignal$.subscribe(() => n());
548
+ return () => r.unsubscribe();
543
549
  }, [t, n]), { focus: n, selectHasFocus: i };
544
550
  }
545
551
  const ii = w(function(e, n) {
546
- const i = S(D), s = S(m), r = S(te), a = I(s.state$, void 0, !0), { findCompleted: o, findString: d, matchesCount: u, matchesPosition: f } = a, p = _(() => {
547
- r.executeCommand(re.id);
548
- }, [r]), T = _((C) => s.changeFindString(C), [s]);
549
- return je(s, n), /* @__PURE__ */ l.jsxs($, { children: [
550
- /* @__PURE__ */ l.jsx(
552
+ const i = v(O), r = v(g), s = v(ie), a = I(r.state$, void 0, !0), { findCompleted: l, findString: d, matchesCount: S, matchesPosition: f } = a, p = u(() => {
553
+ s.executeCommand(se.id);
554
+ }, [s]), T = u((C) => r.changeFindString(C), [r]);
555
+ return je(r, n), /* @__PURE__ */ c.jsxs(N, { children: [
556
+ /* @__PURE__ */ c.jsx(
551
557
  Ae,
552
558
  {
553
- findCompleted: o,
559
+ findCompleted: l,
554
560
  className: "univer-find-input",
555
- matchesCount: u,
561
+ matchesCount: S,
556
562
  matchesPosition: f,
557
- findReplaceService: s,
563
+ findReplaceService: r,
558
564
  localeService: i,
559
565
  findString: d,
560
566
  onChange: T
561
567
  }
562
568
  ),
563
- /* @__PURE__ */ l.jsx("div", { className: L.findReplaceExpandContainer, children: /* @__PURE__ */ l.jsx(A, { type: "text", size: "small", onClick: p, children: i.t("find-replace.dialog.advanced-finding") }) })
569
+ /* @__PURE__ */ c.jsx("div", { className: L.findReplaceExpandContainer, children: /* @__PURE__ */ c.jsx(A, { type: "text", size: "small", onClick: p, children: i.t("find-replace.dialog.advanced-finding") }) })
564
570
  ] });
565
571
  }), ni = w(function(e, n) {
566
- const i = S(m), s = S(D), r = S(te), a = S(me), o = I(i.currentMatch$, void 0, !0), d = I(i.replaceables$, void 0, !0), u = I(i.state$, void 0, !0), {
572
+ const i = v(g), r = v(O), s = v(ie), a = v(me), l = I(i.currentMatch$, void 0, !0), d = I(i.replaceables$, void 0, !0), S = I(i.state$, void 0, !0), {
567
573
  matchesCount: f,
568
574
  matchesPosition: p,
569
575
  findString: T,
@@ -571,118 +577,118 @@ const ii = w(function(e, n) {
571
577
  replaceString: Ue,
572
578
  caseSensitive: Be,
573
579
  matchesTheWholeCell: We,
574
- findDirection: Ge,
575
- findScope: Ve,
576
- findBy: ke,
577
- findCompleted: G
578
- } = u, He = C.length === 0, qe = f === 0 || !(o != null && o.replaceable), ze = d.length === 0, Ke = _(
580
+ findDirection: ke,
581
+ findScope: Ge,
582
+ findBy: Ve,
583
+ findCompleted: k
584
+ } = S, He = C.length === 0, qe = f === 0 || !(l != null && l.replaceable), ze = d.length === 0, Ke = u(
579
585
  (h) => i.changeInputtingFindString(h),
580
586
  [i]
581
- ), Ye = _(
587
+ ), Ye = u(
582
588
  (h) => i.changeReplaceString(h),
583
589
  [i]
584
- ), { focus: Ze } = je(i, n), Je = _(() => {
590
+ ), { focus: Ze } = je(i, n), Je = u(() => {
585
591
  T === C ? i.moveToNextMatch() : (i.changeFindString(C), i.find());
586
- }, [T, C, i]), Qe = _(() => r.executeCommand($e.id), [r]), Xe = _(async () => {
587
- await r.executeCommand(Ne.id), Ze();
588
- }, [r]), et = _((h) => {
592
+ }, [T, C, i]), Qe = u(() => s.executeCommand(Ne.id), [s]), Xe = u(async () => {
593
+ await s.executeCommand($e.id), Ze();
594
+ }, [s]), et = u((h) => {
589
595
  i.changeFindDirection(h);
590
- }, [i]), tt = _((h) => {
596
+ }, [i]), tt = u((h) => {
591
597
  i.changeFindScope(h);
592
- }, [i]), it = _((h) => {
598
+ }, [i]), it = u((h) => {
593
599
  i.changeFindBy(h);
594
- }, [i]), nt = ri(s), st = ai(s), rt = oi(s);
600
+ }, [i]), nt = si(r), rt = ai(r), st = oi(r);
595
601
  return j(() => {
596
- const h = G && f === 0;
602
+ const h = k && f === 0;
597
603
  let E = null;
598
604
  return h && (E = a.show({
599
- content: s.t("find-replace.dialog.no-match"),
600
- type: N.Warning,
605
+ content: r.t("find-replace.dialog.no-match"),
606
+ type: $.Warning,
601
607
  duration: 5e3
602
608
  })), () => E == null ? void 0 : E.dispose();
603
- }, [G, f, a, s]), /* @__PURE__ */ l.jsxs($, { children: [
604
- /* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find"), children: /* @__PURE__ */ l.jsx(
609
+ }, [k, f, a, r]), /* @__PURE__ */ c.jsxs(N, { children: [
610
+ /* @__PURE__ */ c.jsx(R, { label: r.t("find-replace.dialog.find"), children: /* @__PURE__ */ c.jsx(
605
611
  Ae,
606
612
  {
607
- findCompleted: G,
613
+ findCompleted: k,
608
614
  className: "univer-find-input",
609
615
  matchesCount: f,
610
616
  matchesPosition: p,
611
617
  findReplaceService: i,
612
- localeService: s,
618
+ localeService: r,
613
619
  findString: C,
614
620
  onChange: Ke
615
621
  }
616
622
  ) }),
617
- /* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.replace"), children: /* @__PURE__ */ l.jsx(
618
- Nt,
623
+ /* @__PURE__ */ c.jsx(R, { label: r.t("find-replace.dialog.replace"), children: /* @__PURE__ */ c.jsx(
624
+ $t,
619
625
  {
620
- placeholder: s.t("find-replace.dialog.replace-placeholder"),
626
+ placeholder: r.t("find-replace.dialog.replace-placeholder"),
621
627
  value: Ue,
622
628
  onChange: (h) => Ye(h)
623
629
  }
624
630
  ) }),
625
- /* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l.jsx(V, { value: Ge, options: st, onChange: et }) }),
626
- /* @__PURE__ */ l.jsx(le, { children: /* @__PURE__ */ l.jsxs($, { children: [
627
- /* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l.jsx(V, { value: Ve, options: nt, onChange: tt }) }),
628
- /* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l.jsx(V, { value: ke, options: rt, onChange: it }) })
631
+ /* @__PURE__ */ c.jsx(R, { label: r.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ c.jsx(G, { value: ke, options: rt, onChange: et }) }),
632
+ /* @__PURE__ */ c.jsx(le, { children: /* @__PURE__ */ c.jsxs(N, { children: [
633
+ /* @__PURE__ */ c.jsx(R, { label: r.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ c.jsx(G, { value: Ge, options: nt, onChange: tt }) }),
634
+ /* @__PURE__ */ c.jsx(R, { label: r.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ c.jsx(G, { value: Ve, options: st, onChange: it }) })
629
635
  ] }) }),
630
- /* @__PURE__ */ l.jsx(le, { children: /* @__PURE__ */ l.jsxs($, { children: [
631
- /* @__PURE__ */ l.jsx(R, { children: /* @__PURE__ */ l.jsx(
636
+ /* @__PURE__ */ c.jsx(le, { children: /* @__PURE__ */ c.jsxs(N, { children: [
637
+ /* @__PURE__ */ c.jsx(R, { children: /* @__PURE__ */ c.jsx(
632
638
  de,
633
639
  {
634
640
  checked: Be,
635
641
  onChange: (h) => {
636
642
  i.changeCaseSensitive(h);
637
643
  },
638
- children: s.t("find-replace.dialog.case-sensitive")
644
+ children: r.t("find-replace.dialog.case-sensitive")
639
645
  }
640
646
  ) }),
641
- /* @__PURE__ */ l.jsx(R, { children: /* @__PURE__ */ l.jsx(
647
+ /* @__PURE__ */ c.jsx(R, { children: /* @__PURE__ */ c.jsx(
642
648
  de,
643
649
  {
644
650
  checked: We,
645
651
  onChange: (h) => {
646
652
  i.changeMatchesTheWholeCell(h);
647
653
  },
648
- children: s.t("find-replace.dialog.match-the-whole-cell")
654
+ children: r.t("find-replace.dialog.match-the-whole-cell")
649
655
  }
650
656
  ) })
651
657
  ] }) }),
652
- /* @__PURE__ */ l.jsxs("div", { className: L.findReplaceButtonsGroup, children: [
653
- /* @__PURE__ */ l.jsx(A, { type: "primary", onClick: Je, disabled: He, children: s.t("find-replace.dialog.find") }),
654
- /* @__PURE__ */ l.jsxs("span", { className: L.findReplaceButtonsGroupRight, children: [
655
- /* @__PURE__ */ l.jsx(A, { disabled: qe, onClick: Qe, children: s.t("find-replace.dialog.replace") }),
656
- /* @__PURE__ */ l.jsx(A, { disabled: ze, onClick: Xe, children: s.t("find-replace.dialog.replace-all") })
658
+ /* @__PURE__ */ c.jsxs("div", { className: L.findReplaceButtonsGroup, children: [
659
+ /* @__PURE__ */ c.jsx(A, { type: "primary", onClick: Je, disabled: He, children: r.t("find-replace.dialog.find") }),
660
+ /* @__PURE__ */ c.jsxs("span", { className: L.findReplaceButtonsGroupRight, children: [
661
+ /* @__PURE__ */ c.jsx(A, { disabled: qe, onClick: Qe, children: r.t("find-replace.dialog.replace") }),
662
+ /* @__PURE__ */ c.jsx(A, { disabled: ze, onClick: Xe, children: r.t("find-replace.dialog.replace-all") })
657
663
  ] })
658
664
  ] })
659
665
  ] });
660
666
  });
661
- function si() {
662
- const t = S(m), e = S(ve), n = S(ee), i = I(t.state$, void 0, !0), s = q(null);
667
+ function ri() {
668
+ const t = v(g), e = v(ve), n = v(te), i = I(t.state$, void 0, !0), r = q(null);
663
669
  j(() => {
664
670
  let d;
665
- return s.current && (d = e.registerContainerElement(s.current)), () => d == null ? void 0 : d.dispose();
671
+ return r.current && (d = e.registerContainerElement(r.current)), () => d == null ? void 0 : d.dispose();
666
672
  }, [e]);
667
- const r = q(null), a = _(
673
+ const s = q(null), a = u(
668
674
  (d) => n.setContextValue(Ie, d),
669
675
  [n]
670
- ), o = _(
676
+ ), l = u(
671
677
  (d) => n.setContextValue(ye, d),
672
678
  [n]
673
679
  );
674
680
  return j(() => {
675
- var u;
681
+ var S;
676
682
  const d = Ft(document, "focusin").subscribe((f) => {
677
683
  var p;
678
- f.target && ((p = s.current) != null && p.contains(f.target)) ? a(!0) : a(!1), !r.current || !r.current.selectHasFocus() ? o(!0) : o(!1);
684
+ f.target && ((p = r.current) != null && p.contains(f.target)) ? a(!0) : a(!1), !s.current || !s.current.selectHasFocus() ? l(!0) : l(!1);
679
685
  });
680
- return (u = r.current) == null || u.focus(), a(!0), o(!0), () => {
686
+ return (S = s.current) == null || S.focus(), a(!0), l(!0), () => {
681
687
  d.unsubscribe(), a(!1);
682
688
  };
683
- }, [a, o]), /* @__PURE__ */ l.jsx("div", { className: L.findReplaceDialogContainer, ref: s, children: i.replaceRevealed ? /* @__PURE__ */ l.jsx(ni, { ref: r }) : /* @__PURE__ */ l.jsx(ii, { ref: r }) });
689
+ }, [a, l]), /* @__PURE__ */ c.jsx("div", { className: L.findReplaceDialogContainer, ref: r, children: i.replaceRevealed ? /* @__PURE__ */ c.jsx(ni, { ref: s }) : /* @__PURE__ */ c.jsx(ii, { ref: s }) });
684
690
  }
685
- function ri(t) {
691
+ function si(t) {
686
692
  const e = t.getCurrentLocale();
687
693
  return ne(() => [
688
694
  { label: t.t("find-replace.dialog.find-scope.current-sheet"), value: J.SUBUNIT },
@@ -703,7 +709,7 @@ function oi(t) {
703
709
  { label: t.t("find-replace.dialog.find-by.formula"), value: Z.FORMULA }
704
710
  ], [e]);
705
711
  }
706
- function O(t) {
712
+ function P(t) {
707
713
  return t.getContextValue(Ie);
708
714
  }
709
715
  function ci(t) {
@@ -722,49 +728,49 @@ function oe(t) {
722
728
  const li = {
723
729
  id: U.id,
724
730
  description: "find-replace.shortcut.open-find-dialog",
725
- binding: M.F | b.CTRL_COMMAND,
731
+ binding: M.F | x.CTRL_COMMAND,
726
732
  group: W,
727
733
  preconditions(t) {
728
- return !O(t) && ae(t) && oe(t);
734
+ return !P(t) && ae(t) && oe(t);
729
735
  }
730
736
  }, di = {
731
737
  id: U.id,
732
738
  description: "find-replace.shortcut.open-find-dialog",
733
- binding: M.F | b.CTRL_COMMAND,
734
- mac: M.F | b.MAC_CTRL,
739
+ binding: M.F | x.CTRL_COMMAND,
740
+ mac: M.F | x.MAC_CTRL,
735
741
  preconditions(t) {
736
- return !O(t) && ae(t) && oe(t);
742
+ return !P(t) && ae(t) && oe(t);
737
743
  }
738
744
  }, hi = {
739
- id: re.id,
745
+ id: se.id,
740
746
  description: "find-replace.shortcut.open-replace-dialog",
741
- binding: M.H | b.CTRL_COMMAND,
742
- mac: M.H | b.MAC_CTRL,
747
+ binding: M.H | x.CTRL_COMMAND,
748
+ mac: M.H | x.MAC_CTRL,
743
749
  group: W,
744
750
  preconditions(t) {
745
- return ae(t) && oe(t) && (!O(t) || !ci(t));
751
+ return ae(t) && oe(t) && (!P(t) || !ci(t));
746
752
  }
747
753
  }, ui = {
748
- id: De.id,
754
+ id: Oe.id,
749
755
  description: "find-replace.shortcut.go-to-next-match",
750
756
  binding: M.ENTER,
751
757
  group: W,
752
758
  priority: 1e3,
753
759
  preconditions(t) {
754
- return Le(t) && O(t);
760
+ return Le(t) && P(t);
755
761
  }
756
762
  }, fi = {
757
- id: Oe.id,
763
+ id: Pe.id,
758
764
  description: "find-replace.shortcut.go-to-previous-match",
759
- binding: M.ENTER | b.SHIFT,
765
+ binding: M.ENTER | x.SHIFT,
760
766
  group: W,
761
767
  priority: 1e3,
762
768
  preconditions(t) {
763
- return Le(t) && O(t);
769
+ return Le(t) && P(t);
764
770
  }
765
771
  };
766
772
  function pi(t) {
767
- const e = t.get(ee);
773
+ const e = t.get(te);
768
774
  return {
769
775
  id: U.id,
770
776
  icon: "SearchIcon",
@@ -772,31 +778,31 @@ function pi(t) {
772
778
  group: mt.TOOLBAR_OTHERS,
773
779
  type: vt.BUTTON,
774
780
  positions: [St.TOOLBAR_START],
775
- hidden$: Ct(t, lt.UNIVER_SHEET),
781
+ hidden$: Ct(t, dt.UNIVER_SHEET),
776
782
  disabled$: Ce([
777
783
  e.subscribeContextValue$(ge),
778
784
  e.subscribeContextValue$(_e)
779
- ]).pipe(Pt(([n, i]) => n || !i))
785
+ ]).pipe(Dt(([n, i]) => n || !i))
780
786
  };
781
787
  }
782
788
  var _i = Object.defineProperty, gi = Object.getOwnPropertyDescriptor, mi = (t, e, n, i) => {
783
- for (var s = i > 1 ? void 0 : i ? gi(e, n) : e, r = t.length - 1, a; r >= 0; r--)
784
- (a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
785
- return i && s && _i(e, n, s), s;
786
- }, v = (t, e) => (n, i) => e(n, i, t);
789
+ for (var r = i > 1 ? void 0 : i ? gi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
790
+ (a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
791
+ return i && r && _i(e, n, r), r;
792
+ }, m = (t, e) => (n, i) => e(n, i, t);
787
793
  const vi = {}, he = "DESKTOP_FIND_REPLACE_DIALOG", we = 350, Si = 20, Ci = -90;
788
- let F = class extends dt {
789
- constructor(t, e, n, i, s, r, a, o, d, u, f) {
790
- super(), this._config = t, this._univerInstanceService = e, this._menuService = n, this._shortcutService = i, this._commandService = s, this._findReplaceService = r, this._dialogService = a, this._layoutService = o, this._localeService = d, this._componentManager = u, this._injector = f, this._initCommands(), this._initUI(), this._initShortcuts();
794
+ let F = class extends ht {
795
+ constructor(t, e, n, i, r, s, a, l, d, S, f) {
796
+ super(), this._config = t, this._univerInstanceService = e, this._menuService = n, this._shortcutService = i, this._commandService = r, this._findReplaceService = s, this._dialogService = a, this._layoutService = l, this._localeService = d, this._componentManager = S, this._injector = f, this._initCommands(), this._initUI(), this._initShortcuts();
791
797
  }
792
798
  _initCommands() {
793
799
  [
794
800
  U,
795
- re,
796
- De,
801
+ se,
797
802
  Oe,
798
- Ne,
799
- $e
803
+ Pe,
804
+ $e,
805
+ Ne
800
806
  ].forEach((t) => {
801
807
  this.disposeWithMe(this._commandService.registerCommand(t));
802
808
  });
@@ -812,7 +818,7 @@ let F = class extends dt {
812
818
  }
813
819
  _initUI() {
814
820
  const { menu: t = {} } = this._config;
815
- this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(pi), t)), this.disposeWithMe(this._componentManager.register("FindReplaceDialog", si)), this.disposeWithMe(this._componentManager.register("SearchIcon", be)), this._findReplaceService.stateUpdates$.pipe(ce(this.dispose$)).subscribe((e) => {
821
+ this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(pi), t)), this.disposeWithMe(this._componentManager.register("FindReplaceDialog", ri)), this.disposeWithMe(this._componentManager.register("SearchIcon", xe)), this._findReplaceService.stateUpdates$.pipe(ce(this.dispose$)).subscribe((e) => {
816
822
  e.revealed === !0 && this._openPanel();
817
823
  }), this.disposeWithMe(
818
824
  this._univerInstanceService.focused$.pipe(ce(this.dispose$)).subscribe((e) => {
@@ -838,32 +844,32 @@ let F = class extends dt {
838
844
  }
839
845
  };
840
846
  F = mi([
841
- ht(ut.Rendered, F),
842
- v(1, pe),
843
- v(2, Mt),
844
- v(3, xt),
845
- v(4, te),
846
- v(5, m),
847
- v(6, bt),
848
- v(7, ve),
849
- v(8, x(D)),
850
- v(9, x(Rt)),
851
- v(10, x(ie))
847
+ ut(ft.Rendered, F),
848
+ m(1, pe),
849
+ m(2, Mt),
850
+ m(3, bt),
851
+ m(4, ie),
852
+ m(5, g),
853
+ m(6, xt),
854
+ m(7, ve),
855
+ m(8, b(O)),
856
+ m(9, b(Rt)),
857
+ m(10, b(ee))
852
858
  ], F);
853
859
  function Ri() {
854
860
  const { innerWidth: t } = window;
855
861
  return { x: (t - we) / 2 - Si, y: Ci };
856
862
  }
857
- var Mi = Object.defineProperty, xi = Object.getOwnPropertyDescriptor, bi = (t, e, n, i) => {
858
- for (var s = i > 1 ? void 0 : i ? xi(e, n) : e, r = t.length - 1, a; r >= 0; r--)
859
- (a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
860
- return i && s && Mi(e, n, s), s;
863
+ var Mi = Object.defineProperty, bi = Object.getOwnPropertyDescriptor, xi = (t, e, n, i) => {
864
+ for (var r = i > 1 ? void 0 : i ? bi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
865
+ (a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
866
+ return i && r && Mi(e, n, r), r;
861
867
  }, ue = (t, e) => (n, i) => e(n, i, t);
862
868
  const yi = "FIND_REPLACE_PLUGIN";
863
- var k;
864
- let fe = (k = class extends ft {
869
+ var V;
870
+ let fe = (V = class extends pt {
865
871
  constructor(t = {}, e, n) {
866
- super(), this._config = t, this._injector = e, this._localeService = n, this._config = pt.deepMerge({}, vi, this._config);
872
+ super(), this._config = t, this._injector = e, this._localeService = n, this._config = _t.deepMerge({}, vi, this._config);
867
873
  }
868
874
  onStarting(t) {
869
875
  [
@@ -873,30 +879,30 @@ let fe = (k = class extends ft {
873
879
  useFactory: () => this._injector.createInstance(F, this._config)
874
880
  }
875
881
  ],
876
- [m, { useClass: Q }]
882
+ [g, { useClass: Q }]
877
883
  ].forEach(
878
884
  (e) => {
879
885
  t.add(e);
880
886
  }
881
887
  );
882
888
  }
883
- }, c(k, "pluginName", yi), k);
884
- fe = bi([
885
- ue(1, x(ie)),
886
- ue(2, x(D))
889
+ }, o(V, "pluginName", yi), V);
890
+ fe = xi([
891
+ ue(1, b(ee)),
892
+ ue(2, b(O))
887
893
  ], fe);
888
894
  export {
889
895
  Z as FindBy,
890
896
  Y as FindDirection,
891
- Ai as FindModel,
897
+ Ni as FindModel,
892
898
  F as FindReplaceController,
893
899
  J as FindScope,
894
- De as GoToNextMatchOperation,
895
- Oe as GoToPreviousMatchOperation,
896
- m as IFindReplaceService,
900
+ Oe as GoToNextMatchOperation,
901
+ Pe as GoToPreviousMatchOperation,
902
+ g as IFindReplaceService,
897
903
  U as OpenFindDialogOperation,
898
- re as OpenReplaceDialogOperation,
899
- Ne as ReplaceAllMatchesCommand,
900
- $e as ReplaceCurrentMatchCommand,
904
+ se as OpenReplaceDialogOperation,
905
+ $e as ReplaceAllMatchesCommand,
906
+ Ne as ReplaceCurrentMatchCommand,
901
907
  fe as UniverFindReplacePlugin
902
908
  };