@univerjs/find-replace 0.4.2 → 0.5.0-beta.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,100 +1,91 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { createIdentifier, Inject, Injector, Disposable, IUniverInstanceService, IContextService, DisposableCollection, toDisposable, CommandType, LocaleService, useDependency, ICommandService, FOCUSING_SHEET, EDITOR_ACTIVATED, UniverInstanceType, RxDisposable, Plugin, IConfigService } from "@univerjs/core";
6
- import { IConfirmService, IMessageService, useObservable, ILayoutService, KeyCode, MetaKeys, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, ComponentManager, IMenuManagerService, IShortcutService, IDialogService } from "@univerjs/ui";
7
- import { throttleTime, BehaviorSubject, combineLatest, debounceTime, Subject, fromEvent, map, takeUntil } from "rxjs";
8
- import { MessageType, InputWithSlot, Pager, Button, FormLayout, Input, Select, FormDualColumnLayout, Checkbox } from "@univerjs/design";
9
- import { RENDER_RAW_FORMULA_KEY } from "@univerjs/engine-render";
10
- import require$$0, { forwardRef, useRef, createElement, useCallback, Fragment, useEffect, useMemo, useImperativeHandle } from "react";
11
- const PLUGIN_CONFIG_KEY = "find-replace.config", defaultPluginConfig = {};
12
- var __assign = function() {
13
- return __assign = Object.assign || function(t) {
14
- for (var s, i = 1, n2 = arguments.length; i < n2; i++) {
15
- s = arguments[i];
16
- for (var p2 in s) Object.prototype.hasOwnProperty.call(s, p2) && (t[p2] = s[p2]);
1
+ var at = Object.defineProperty;
2
+ var ot = (i, e, n) => e in i ? at(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
3
+ var o = (i, e, n) => ot(i, typeof e != "symbol" ? e + "" : e, n);
4
+ import { createIdentifier as ct, Inject as y, Injector as X, Disposable as ee, IUniverInstanceService as pe, IContextService as te, DisposableCollection as lt, toDisposable as A, CommandType as x, LocaleService as U, useDependency as v, ICommandService as ie, FOCUSING_SHEET as _e, EDITOR_ACTIVATED as ge, UniverInstanceType as dt, RxDisposable as ht, Plugin as ut, IConfigService as ft } from "@univerjs/core";
5
+ import { IConfirmService as pt, IMessageService as me, useObservable as I, ILayoutService as ve, KeyCode as M, MetaKeys as b, MenuItemType as _t, getMenuHiddenObservable as gt, RibbonStartGroup as mt, ComponentManager as vt, IMenuManagerService as St, IShortcutService as Ct, IDialogService as Rt } from "@univerjs/ui";
6
+ import { throttleTime as Mt, BehaviorSubject as D, combineLatest as Se, debounceTime as bt, Subject as Ce, fromEvent as xt, map as yt, takeUntil as ce } from "rxjs";
7
+ import { MessageType as E, InputWithSlot as It, Pager as Dt, Button as N, FormLayout as R, Input as Ft, Select as V, FormDualColumnLayout as le, Checkbox as de } from "@univerjs/design";
8
+ import { RENDER_RAW_FORMULA_KEY as Pt } from "@univerjs/engine-render";
9
+ import Ot, { forwardRef as B, useRef as q, createElement as Re, useCallback as u, Fragment as $, useEffect as L, useMemo as ne, useImperativeHandle as Tt } from "react";
10
+ const Et = "find-replace.config", Nt = {};
11
+ var _ = function() {
12
+ return _ = Object.assign || function(i) {
13
+ for (var e, n = 1, t = arguments.length; n < t; n++) {
14
+ e = arguments[n];
15
+ for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (i[s] = e[s]);
17
16
  }
18
- return t;
19
- }, __assign.apply(this, arguments);
20
- }, __rest = function(s, e) {
21
- var t = {};
22
- for (var p2 in s) Object.prototype.hasOwnProperty.call(s, p2) && e.indexOf(p2) < 0 && (t[p2] = s[p2]);
23
- if (s != null && typeof Object.getOwnPropertySymbols == "function")
24
- for (var i = 0, p2 = Object.getOwnPropertySymbols(s); i < p2.length; i++)
25
- e.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p2[i]) && (t[p2[i]] = s[p2[i]]);
26
- return t;
27
- }, IconBase = forwardRef(function(props, ref) {
28
- var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
29
- return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
17
+ return i;
18
+ }, _.apply(this, arguments);
19
+ }, $t = function(i, e) {
20
+ var n = {};
21
+ for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]);
22
+ if (i != null && typeof Object.getOwnPropertySymbols == "function")
23
+ for (var s = 0, t = Object.getOwnPropertySymbols(i); s < t.length; s++)
24
+ e.indexOf(t[s]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[s]) && (n[t[s]] = i[t[s]]);
25
+ return n;
26
+ }, Me = B(function(i, e) {
27
+ var n = i.icon, t = i.id, s = i.className, r = i.extend, a = $t(i, ["icon", "id", "className", "extend"]), l = "univerjs-icon univerjs-icon-".concat(t, " ").concat(s || "").trim(), d = q("_".concat(jt()));
28
+ return be(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, _({ ref: e, className: l }, a), r);
30
29
  });
31
- function render(node, id, runtimeProps, rootProps, extend) {
32
- return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
33
- return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
30
+ function be(i, e, n, t, s) {
31
+ return Re(i.tag, _(_({ key: e }, At(i, n, s)), t), (Lt(i, n).children || []).map(function(r, a) {
32
+ return be(r, "".concat(e, "-").concat(i.tag, "-").concat(a), n, void 0, s);
34
33
  }));
35
34
  }
36
- __name(render, "render");
37
- function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
38
- var attrs = __assign({}, node.attrs);
39
- extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
40
- var defIds = runtimeProps.defIds;
41
- return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a5) {
42
- var key = _a5[0], value = _a5[1];
43
- typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
44
- })), attrs;
35
+ function At(i, e, n) {
36
+ var t = _({}, i.attrs);
37
+ n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
38
+ var s = e.defIds;
39
+ return !s || s.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(r) {
40
+ var a = r[0], l = r[1];
41
+ typeof l == "string" && (t[a] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
42
+ })), t;
45
43
  }
46
- __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
47
- function replaceRuntimeIdsInDefs(node, runtimeProps) {
48
- var _a5, defIds = runtimeProps.defIds;
49
- return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a5 = node.children) === null || _a5 === void 0) && _a5.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
50
- return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
51
- }) }) : node;
44
+ function Lt(i, e) {
45
+ var n, t = e.defIds;
46
+ return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? _(_({}, i), { children: i.children.map(function(s) {
47
+ return typeof s.attrs.id == "string" && t && t.indexOf(s.attrs.id) > -1 ? _(_({}, s), { attrs: _(_({}, s.attrs), { id: s.attrs.id + e.idSuffix }) }) : s;
48
+ }) }) : i;
52
49
  }
53
- __name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
54
- function generateShortUuid() {
50
+ function jt() {
55
51
  return Math.random().toString(36).substring(2, 8);
56
52
  }
57
- __name(generateShortUuid, "generateShortUuid");
58
- IconBase.displayName = "UniverIcon";
59
- var element = { 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" } }] }] }, SearchSingle16 = forwardRef(function(props, ref) {
60
- return createElement(IconBase, Object.assign({}, props, {
53
+ Me.displayName = "UniverIcon";
54
+ var wt = { 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 = B(function(i, e) {
55
+ return Re(Me, Object.assign({}, i, {
61
56
  id: "search-single-16",
62
- ref,
63
- icon: element
57
+ ref: e,
58
+ icon: wt
64
59
  }));
65
60
  });
66
- SearchSingle16.displayName = "SearchSingle16";
67
- const FIND_REPLACE_INPUT_FOCUS = "FIND_REPLACE_INPUT_FOCUS", FIND_REPLACE_DIALOG_FOCUS = "FIND_REPLACE_DIALOG_FOCUS", FIND_REPLACE_REPLACE_REVEALED = "FIND_REPLACE_REPLACE_REVEALED";
68
- var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
69
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
70
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
71
- return kind && result && __defProp$2(target, key, result), result;
72
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2");
73
- const _FindModel = class _FindModel extends Disposable {
74
- };
75
- __name(_FindModel, "FindModel");
76
- let FindModel = _FindModel;
77
- const IFindReplaceService = createIdentifier("find-replace.service");
78
- function shouldStateUpdateTriggerResearch(statusUpdate) {
79
- return typeof statusUpdate.findString < "u" || typeof statusUpdate.inputtingFindString < "u" || typeof statusUpdate.findDirection < "u" || typeof statusUpdate.matchesTheWholeCell < "u" || typeof statusUpdate.caseSensitive < "u" || typeof statusUpdate.findScope < "u" || typeof statusUpdate.findBy < "u";
61
+ xe.displayName = "SearchSingle16";
62
+ const ye = "FIND_REPLACE_INPUT_FOCUS", Ie = "FIND_REPLACE_DIALOG_FOCUS", De = "FIND_REPLACE_REPLACE_REVEALED";
63
+ var Ut = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, Fe = (i, e, n, t) => {
64
+ for (var s = t > 1 ? void 0 : t ? Bt(e, n) : e, r = i.length - 1, a; r >= 0; r--)
65
+ (a = i[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
66
+ return t && s && Ut(e, n, s), s;
67
+ }, K = (i, e) => (n, t) => e(n, t, i);
68
+ class Ei extends ee {
69
+ }
70
+ const g = ct("find-replace.service");
71
+ function Wt(i) {
72
+ return typeof i.findString < "u" || typeof i.inputtingFindString < "u" || typeof i.findDirection < "u" || typeof i.matchesTheWholeCell < "u" || typeof i.caseSensitive < "u" || typeof i.findScope < "u" || typeof i.findBy < "u";
80
73
  }
81
- __name(shouldStateUpdateTriggerResearch, "shouldStateUpdateTriggerResearch");
82
- var _a;
83
- let FindReplaceModel = (_a = class extends Disposable {
84
- constructor(_state, _providers, _univerInstanceService) {
74
+ let z = class extends ee {
75
+ constructor(e, n, t) {
85
76
  super();
86
- __publicField(this, "currentMatch$", new BehaviorSubject(null));
87
- __publicField(this, "replaceables$", new BehaviorSubject([]));
77
+ o(this, "currentMatch$", new D(null));
78
+ o(this, "replaceables$", new D([]));
88
79
  /** All find models returned by providers. */
89
- __publicField(this, "_findModels", []);
80
+ o(this, "_findModels", []);
90
81
  /** The find model that the current match is from. */
91
- __publicField(this, "_matchingModel", null);
92
- __publicField(this, "_matches", []);
93
- __publicField(this, "_currentSearchingDisposables", null);
94
- this._state = _state, this._providers = _providers, this._univerInstanceService = _univerInstanceService, this.disposeWithMe(
95
- this._state.stateUpdates$.pipe(throttleTime(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (stateUpdate) => {
96
- const state = this._state.state;
97
- shouldStateUpdateTriggerResearch(stateUpdate) && (state.findString !== "" && !state.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : stateUpdate.replaceRevealed !== !0 && this._stopSearching());
82
+ o(this, "_matchingModel", null);
83
+ o(this, "_matches", []);
84
+ o(this, "_currentSearchingDisposables", null);
85
+ this._state = e, this._providers = n, this._univerInstanceService = t, this.disposeWithMe(
86
+ this._state.stateUpdates$.pipe(Mt(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (s) => {
87
+ const r = this._state.state;
88
+ Wt(s) && (r.findString !== "" && !r.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : s.replaceRevealed !== !0 && this._stopSearching());
98
89
  })
99
90
  );
100
91
  }
@@ -102,19 +93,19 @@ let FindReplaceModel = (_a = class extends Disposable {
102
93
  return this._findModels.length > 0;
103
94
  }
104
95
  dispose() {
105
- super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...createInitFindReplaceState(), revealed: !1 });
96
+ super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...se(), revealed: !1 });
106
97
  }
107
98
  async start() {
108
99
  if (!this._state.findString)
109
100
  return { results: [] };
110
- const complete = await this._startSearching();
111
- return this._state.changeState({ findCompleted: !0 }), complete;
101
+ const e = await this._startSearching();
102
+ return this._state.changeState({ findCompleted: !0 }), e;
112
103
  }
113
104
  /** Call this method to start a `searching`. */
114
105
  async _startSearching() {
115
106
  if (!this._state.findString)
116
107
  return { results: [] };
117
- const providers = Array.from(this._providers), findModels = this._findModels = (await Promise.all(providers.map((provider) => provider.find({
108
+ const e = Array.from(this._providers), n = this._findModels = (await Promise.all(e.map((s) => s.find({
118
109
  findString: this._state.findString,
119
110
  findDirection: this._state.findDirection,
120
111
  findScope: this._state.findScope,
@@ -123,111 +114,111 @@ let FindReplaceModel = (_a = class extends Disposable {
123
114
  caseSensitive: this._state.caseSensitive,
124
115
  matchesTheWholeCell: this._state.matchesTheWholeCell
125
116
  })))).flat();
126
- this._subscribeToModelsChanges(findModels);
127
- const newMatches = this._matches = findModels.map((c) => c.getMatches()).flat();
128
- return this.replaceables$.next(newMatches.filter((m2) => m2.replaceable)), newMatches.length ? (this._moveToInitialMatch(findModels), this._state.changeState({ matchesCount: newMatches.length }), { results: newMatches }) : (this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), { results: [] });
117
+ this._subscribeToModelsChanges(n);
118
+ const t = this._matches = n.map((s) => s.getMatches()).flat();
119
+ return this.replaceables$.next(t.filter((s) => s.replaceable)), t.length ? (this._moveToInitialMatch(n), this._state.changeState({ matchesCount: t.length }), { results: t }) : (this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), { results: [] });
129
120
  }
130
121
  /** Terminate the current searching session, when searching string is empty. */
131
122
  _stopSearching() {
132
- var _a5;
133
- this._providers.forEach((provider) => provider.terminate()), this._findModels = [], this._matches = [], this._matchingModel = null, (_a5 = this._currentSearchingDisposables) == null || _a5.dispose(), this._currentSearchingDisposables = null, this.currentMatch$.next(null), this.replaceables$.next([]), this._state.changeState({
123
+ var e;
124
+ this._providers.forEach((n) => n.terminate()), this._findModels = [], this._matches = [], this._matchingModel = null, (e = this._currentSearchingDisposables) == null || e.dispose(), this._currentSearchingDisposables = null, this.currentMatch$.next(null), this.replaceables$.next([]), this._state.changeState({
134
125
  findCompleted: !1,
135
126
  matchesCount: 0,
136
127
  matchesPosition: 0
137
128
  });
138
129
  }
139
130
  // When a document's content changes, we should reset all matches and try to move to the next match.
140
- _subscribeToModelsChanges(models) {
141
- const disposables = this._currentSearchingDisposables = new DisposableCollection(), matchesUpdateSubscription = combineLatest(models.map((model) => model.matchesUpdate$)).pipe(debounceTime(220)).subscribe(([...allMatches]) => {
142
- const newMatches = this._matches = allMatches.flat();
143
- newMatches.length ? (this._moveToInitialMatch(this._findModels, !0), this._state.changeState({ matchesCount: newMatches.length }), this.replaceables$.next(newMatches.filter((m2) => m2.replaceable))) : (this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), this.replaceables$.next([]));
131
+ _subscribeToModelsChanges(e) {
132
+ const n = this._currentSearchingDisposables = new lt(), t = Se(e.map((s) => s.matchesUpdate$)).pipe(bt(220)).subscribe(([...s]) => {
133
+ const r = this._matches = s.flat();
134
+ r.length ? (this._moveToInitialMatch(this._findModels, !0), this._state.changeState({ matchesCount: r.length }), this.replaceables$.next(r.filter((a) => a.replaceable))) : (this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), this.replaceables$.next([]));
144
135
  });
145
- models.forEach((model) => disposables.add(toDisposable(model.activelyChangingMatch$.subscribe((match) => {
146
- const index = this._matches.findIndex((m2) => m2 === match);
147
- this._state.changeState({ matchesPosition: index + 1 });
148
- })))), disposables.add(toDisposable(matchesUpdateSubscription));
136
+ e.forEach((s) => n.add(A(s.activelyChangingMatch$.subscribe((r) => {
137
+ const a = this._matches.findIndex((l) => l === r);
138
+ this._state.changeState({ matchesPosition: a + 1 });
139
+ })))), n.add(A(t));
149
140
  }
150
141
  async replace() {
151
142
  return this._matchingModel ? this._matchingModel.replace(this._state.replaceString) : !1;
152
143
  }
153
144
  async replaceAll() {
154
- const result = await Promise.all(this._findModels.map((m2) => m2.replaceAll(this._state.replaceString))).then((results) => results.reduce((acc, cur) => (acc.success += cur.success, acc.failure += cur.failure, acc), { success: 0, failure: 0 }));
155
- return result.failure === 0 && this._stopSearching(), result;
145
+ const e = await Promise.all(this._findModels.map((n) => n.replaceAll(this._state.replaceString))).then((n) => n.reduce((t, s) => (t.success += s.success, t.failure += s.failure, t), { success: 0, failure: 0 }));
146
+ return e.failure === 0 && this._stopSearching(), e;
156
147
  }
157
148
  getCurrentMatch() {
158
149
  return this._state.matchesPosition > 0 ? this._matches[this._state.matchesPosition - 1] : null;
159
150
  }
160
- _markMatch(match) {
161
- const index = this._matches.findIndex((value) => value === match);
162
- this.currentMatch$.next(match), this._state.changeState({ matchesPosition: index + 1 });
151
+ _markMatch(e) {
152
+ const n = this._matches.findIndex((t) => t === e);
153
+ this.currentMatch$.next(e), this._state.changeState({ matchesPosition: n + 1 });
163
154
  }
164
155
  moveToNextMatch() {
165
156
  if (!this._matchingModel)
166
157
  return;
167
- const loopInCurrentUnit = this._findModels.length === 1, nextMatch = this._matchingModel.moveToNextMatch({ loop: loopInCurrentUnit });
168
- if (nextMatch)
169
- this._markMatch(nextMatch);
158
+ const e = this._findModels.length === 1, n = this._matchingModel.moveToNextMatch({ loop: e });
159
+ if (n)
160
+ this._markMatch(n);
170
161
  else {
171
- const currentModelIndex = this._findModels.findIndex((m2) => m2 === this._matchingModel);
172
- this._moveToNextUnitMatch(currentModelIndex);
162
+ const t = this._findModels.findIndex((s) => s === this._matchingModel);
163
+ this._moveToNextUnitMatch(t);
173
164
  }
174
165
  }
175
- _moveToNextUnitMatch(startingIndex) {
176
- const l2 = this._findModels.length;
177
- for (let i = (startingIndex + 1) % l2; i !== startingIndex; ) {
178
- const nextPositionModel = this._findModels[i], nextMatch = nextPositionModel.moveToNextMatch({ ignoreSelection: !0 });
179
- if (nextMatch) {
180
- this._matchingModel = nextPositionModel, this._markMatch(nextMatch);
166
+ _moveToNextUnitMatch(e) {
167
+ const n = this._findModels.length;
168
+ for (let t = (e + 1) % n; t !== e; ) {
169
+ const s = this._findModels[t], r = s.moveToNextMatch({ ignoreSelection: !0 });
170
+ if (r) {
171
+ this._matchingModel = s, this._markMatch(r);
181
172
  return;
182
173
  }
183
- i = (i + 1) % l2;
174
+ t = (t + 1) % n;
184
175
  }
185
176
  if (this._matchingModel) {
186
- const nextMatch = this._matchingModel.moveToNextMatch({ ignoreSelection: !0 });
187
- nextMatch && this._markMatch(nextMatch);
177
+ const t = this._matchingModel.moveToNextMatch({ ignoreSelection: !0 });
178
+ t && this._markMatch(t);
188
179
  }
189
180
  }
190
181
  moveToPreviousMatch() {
191
182
  if (!this._matchingModel)
192
183
  return;
193
- const loopInCurrentUnit = this._findModels.length === 1, nextMatch = this._matchingModel.moveToPreviousMatch({ loop: loopInCurrentUnit });
194
- if (nextMatch) {
195
- const index = this._matches.findIndex((value) => value === nextMatch);
196
- this.currentMatch$.next(nextMatch), this._state.changeState({ matchesPosition: index + 1 });
184
+ const e = this._findModels.length === 1, n = this._matchingModel.moveToPreviousMatch({ loop: e });
185
+ if (n) {
186
+ const t = this._matches.findIndex((s) => s === n);
187
+ this.currentMatch$.next(n), this._state.changeState({ matchesPosition: t + 1 });
197
188
  } else {
198
- const l2 = this._findModels.length, currentModelIndex = this._findModels.findIndex((m2) => m2 === this._matchingModel);
199
- for (let i = (currentModelIndex - 1 + l2) % l2; i !== currentModelIndex; ) {
200
- const nextPositionModel = this._findModels[i], nextMatch3 = nextPositionModel.moveToPreviousMatch({ ignoreSelection: !0 });
201
- if (nextMatch3) {
202
- this._matchingModel = nextPositionModel, this._markMatch(nextMatch3);
189
+ const t = this._findModels.length, s = this._findModels.findIndex((a) => a === this._matchingModel);
190
+ for (let a = (s - 1 + t) % t; a !== s; ) {
191
+ const l = this._findModels[a], d = l.moveToPreviousMatch({ ignoreSelection: !0 });
192
+ if (d) {
193
+ this._matchingModel = l, this._markMatch(d);
203
194
  return;
204
195
  }
205
- i = (i - 1) % l2;
196
+ a = (a - 1) % t;
206
197
  }
207
- const nextMatch2 = this._matchingModel.moveToPreviousMatch({ ignoreSelection: !0 });
208
- nextMatch2 && this._markMatch(nextMatch2);
198
+ const r = this._matchingModel.moveToPreviousMatch({ ignoreSelection: !0 });
199
+ r && this._markMatch(r);
209
200
  }
210
201
  }
211
- _moveToInitialMatch(findModels, noFocus = !1) {
212
- var _a5;
213
- const focusedUnitId = (_a5 = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : _a5.getUnitId();
214
- if (!focusedUnitId)
202
+ _moveToInitialMatch(e, n = !1) {
203
+ var r;
204
+ const t = (r = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : r.getUnitId();
205
+ if (!t)
215
206
  return -1;
216
- const i = findModels.findIndex((model) => model.unitId === focusedUnitId);
217
- if (i !== -1) {
218
- this._matchingModel = findModels[i];
219
- const nextMatch = this._matchingModel.moveToNextMatch({ stayIfOnMatch: !0, noFocus });
220
- if (nextMatch)
221
- return this._markMatch(nextMatch), i;
207
+ const s = e.findIndex((a) => a.unitId === t);
208
+ if (s !== -1) {
209
+ this._matchingModel = e[s];
210
+ const a = this._matchingModel.moveToNextMatch({ stayIfOnMatch: !0, noFocus: n });
211
+ if (a)
212
+ return this._markMatch(a), s;
222
213
  }
223
- return this._moveToNextUnitMatch(i), 0;
224
- }
225
- }, __name(_a, "FindReplaceModel"), _a);
226
- FindReplaceModel = __decorateClass$2([
227
- __decorateParam$2(2, IUniverInstanceService)
228
- ], FindReplaceModel);
229
- var FindDirection = /* @__PURE__ */ ((FindDirection2) => (FindDirection2.ROW = "row", FindDirection2.COLUMN = "column", FindDirection2))(FindDirection || {}), FindBy = /* @__PURE__ */ ((FindBy2) => (FindBy2.VALUE = "value", FindBy2.FORMULA = "formula", FindBy2))(FindBy || {}), FindScope = /* @__PURE__ */ ((FindScope2) => (FindScope2.SUBUNIT = "subunit", FindScope2.UNIT = "unit", FindScope2))(FindScope || {});
230
- function createInitFindReplaceState() {
214
+ return this._moveToNextUnitMatch(s), 0;
215
+ }
216
+ };
217
+ z = Fe([
218
+ K(2, pe)
219
+ ], z);
220
+ var Y = /* @__PURE__ */ ((i) => (i.ROW = "row", i.COLUMN = "column", i))(Y || {}), Z = /* @__PURE__ */ ((i) => (i.VALUE = "value", i.FORMULA = "formula", i))(Z || {}), J = /* @__PURE__ */ ((i) => (i.SUBUNIT = "subunit", i.UNIT = "unit", i))(J || {});
221
+ function se() {
231
222
  return {
232
223
  caseSensitive: !1,
233
224
  findBy: "value",
@@ -244,26 +235,25 @@ function createInitFindReplaceState() {
244
235
  revealed: !0
245
236
  };
246
237
  }
247
- __name(createInitFindReplaceState, "createInitFindReplaceState");
248
- const _FindReplaceState = class _FindReplaceState {
238
+ class Gt {
249
239
  constructor() {
250
- __publicField(this, "_stateUpdates$", new Subject());
251
- __publicField(this, "stateUpdates$", this._stateUpdates$.asObservable());
252
- __publicField(this, "_state$", new BehaviorSubject(createInitFindReplaceState()));
253
- __publicField(this, "state$", this._state$.asObservable());
254
- __publicField(this, "_findString", "");
255
- __publicField(this, "_inputtingFindString", "");
256
- __publicField(this, "_replaceString", "");
257
- __publicField(this, "_revealed", !1);
258
- __publicField(this, "_replaceRevealed", !1);
259
- __publicField(this, "_matchesPosition", 0);
260
- __publicField(this, "_matchesCount", 0);
261
- __publicField(this, "_caseSensitive", !0);
262
- __publicField(this, "_matchesTheWholeCell", !1);
263
- __publicField(this, "_findDirection", "row");
264
- __publicField(this, "_findScope", "subunit");
265
- __publicField(this, "_findBy", "value");
266
- __publicField(this, "_findCompleted", !1);
240
+ o(this, "_stateUpdates$", new Ce());
241
+ o(this, "stateUpdates$", this._stateUpdates$.asObservable());
242
+ o(this, "_state$", new D(se()));
243
+ o(this, "state$", this._state$.asObservable());
244
+ o(this, "_findString", "");
245
+ o(this, "_inputtingFindString", "");
246
+ o(this, "_replaceString", "");
247
+ o(this, "_revealed", !1);
248
+ o(this, "_replaceRevealed", !1);
249
+ o(this, "_matchesPosition", 0);
250
+ o(this, "_matchesCount", 0);
251
+ o(this, "_caseSensitive", !0);
252
+ o(this, "_matchesTheWholeCell", !1);
253
+ o(this, "_findDirection", "row");
254
+ o(this, "_findScope", "subunit");
255
+ o(this, "_findBy", "value");
256
+ o(this, "_findCompleted", !1);
267
257
  }
268
258
  get state() {
269
259
  return this._state$.getValue();
@@ -308,10 +298,10 @@ const _FindReplaceState = class _FindReplaceState {
308
298
  return this._findCompleted;
309
299
  }
310
300
  // eslint-disable-next-line max-lines-per-function, complexity
311
- changeState(changes) {
312
- let changed = !1;
313
- const changedState = {};
314
- typeof changes.findString < "u" && changes.findString !== this._findString && (this._findString = changes.findString, changedState.findString = this._findString, changed = !0), typeof changes.revealed < "u" && changes.revealed !== this._revealed && (this._revealed = changes.revealed, changedState.revealed = changes.revealed, changed = !0), typeof changes.replaceRevealed < "u" && changes.replaceRevealed !== this._replaceRevealed && (this._replaceRevealed = changes.replaceRevealed, changedState.replaceRevealed = changes.replaceRevealed, changed = !0), typeof changes.replaceString < "u" && changes.replaceString !== this._replaceString && (this._replaceString = changes.replaceString, changedState.replaceString = changes.replaceString, changed = !0), typeof changes.matchesCount < "u" && changes.matchesCount !== this._matchesCount && (this._matchesCount = changes.matchesCount, changedState.matchesCount = changes.matchesCount, changed = !0), typeof changes.matchesPosition < "u" && changes.matchesPosition !== this._matchesPosition && (this._matchesPosition = changes.matchesPosition, changedState.matchesPosition = changes.matchesPosition, changed = !0), typeof changes.findBy < "u" && changes.findBy !== this._findBy && (this._findBy = changes.findBy, changedState.findBy = changes.findBy, changed = !0), typeof changes.findScope < "u" && changes.findScope !== this._findScope && (this._findScope = changes.findScope, changedState.findScope = changes.findScope, changed = !0), typeof changes.findDirection < "u" && changes.findDirection !== this._findDirection && (this._findDirection = changes.findDirection, changedState.findDirection = changes.findDirection, changed = !0), typeof changes.caseSensitive < "u" && changes.caseSensitive !== this._caseSensitive && (this._caseSensitive = changes.caseSensitive, changedState.caseSensitive = changes.caseSensitive, changed = !0), typeof changes.matchesTheWholeCell < "u" && changes.matchesTheWholeCell !== this._matchesTheWholeCell && (this._matchesTheWholeCell = changes.matchesTheWholeCell, changedState.matchesTheWholeCell = changes.matchesTheWholeCell, changed = !0), typeof changes.inputtingFindString < "u" && changes.inputtingFindString !== this._inputtingFindString && (this._inputtingFindString = changes.inputtingFindString, changedState.inputtingFindString = changes.inputtingFindString, changed = !0), typeof changes.findCompleted < "u" && changes.findCompleted !== this._findCompleted && (this._findCompleted = changes.findCompleted, changedState.findCompleted = changes.findCompleted, changed = !0), changed && (this._state$.next({
301
+ changeState(e) {
302
+ let n = !1;
303
+ const t = {};
304
+ typeof e.findString < "u" && e.findString !== this._findString && (this._findString = e.findString, t.findString = this._findString, n = !0), typeof e.revealed < "u" && e.revealed !== this._revealed && (this._revealed = e.revealed, t.revealed = e.revealed, n = !0), typeof e.replaceRevealed < "u" && e.replaceRevealed !== this._replaceRevealed && (this._replaceRevealed = e.replaceRevealed, t.replaceRevealed = e.replaceRevealed, n = !0), typeof e.replaceString < "u" && e.replaceString !== this._replaceString && (this._replaceString = e.replaceString, t.replaceString = e.replaceString, n = !0), typeof e.matchesCount < "u" && e.matchesCount !== this._matchesCount && (this._matchesCount = e.matchesCount, t.matchesCount = e.matchesCount, n = !0), typeof e.matchesPosition < "u" && e.matchesPosition !== this._matchesPosition && (this._matchesPosition = e.matchesPosition, t.matchesPosition = e.matchesPosition, n = !0), typeof e.findBy < "u" && e.findBy !== this._findBy && (this._findBy = e.findBy, t.findBy = e.findBy, n = !0), typeof e.findScope < "u" && e.findScope !== this._findScope && (this._findScope = e.findScope, t.findScope = e.findScope, n = !0), typeof e.findDirection < "u" && e.findDirection !== this._findDirection && (this._findDirection = e.findDirection, t.findDirection = e.findDirection, n = !0), typeof e.caseSensitive < "u" && e.caseSensitive !== this._caseSensitive && (this._caseSensitive = e.caseSensitive, t.caseSensitive = e.caseSensitive, n = !0), typeof e.matchesTheWholeCell < "u" && e.matchesTheWholeCell !== this._matchesTheWholeCell && (this._matchesTheWholeCell = e.matchesTheWholeCell, t.matchesTheWholeCell = e.matchesTheWholeCell, n = !0), typeof e.inputtingFindString < "u" && e.inputtingFindString !== this._inputtingFindString && (this._inputtingFindString = e.inputtingFindString, t.inputtingFindString = e.inputtingFindString, n = !0), typeof e.findCompleted < "u" && e.findCompleted !== this._findCompleted && (this._findCompleted = e.findCompleted, t.findCompleted = e.findCompleted, n = !0), n && (this._state$.next({
315
305
  caseSensitive: this._caseSensitive,
316
306
  findBy: this._findBy,
317
307
  findCompleted: this._findCompleted,
@@ -324,25 +314,22 @@ const _FindReplaceState = class _FindReplaceState {
324
314
  matchesTheWholeCell: this._matchesTheWholeCell,
325
315
  replaceRevealed: this._replaceRevealed,
326
316
  revealed: this._revealed
327
- }), this._stateUpdates$.next(changedState));
317
+ }), this._stateUpdates$.next(t));
328
318
  }
329
- };
330
- __name(_FindReplaceState, "FindReplaceState");
331
- let FindReplaceState = _FindReplaceState;
332
- var _a2;
333
- let FindReplaceService = (_a2 = class extends Disposable {
334
- constructor(_injector, _contextService) {
319
+ }
320
+ let Q = class extends ee {
321
+ constructor(e, n) {
335
322
  super();
336
- __publicField(this, "_providers", /* @__PURE__ */ new Set());
337
- __publicField(this, "_state", new FindReplaceState());
338
- __publicField(this, "_model");
339
- __publicField(this, "_currentMatch$", new BehaviorSubject(null));
340
- __publicField(this, "currentMatch$", this._currentMatch$.asObservable());
341
- __publicField(this, "_replaceables$", new BehaviorSubject([]));
342
- __publicField(this, "replaceables$", this._replaceables$.asObservable());
343
- __publicField(this, "_focusSignal$", new Subject());
344
- __publicField(this, "focusSignal$", this._focusSignal$.asObservable());
345
- this._injector = _injector, this._contextService = _contextService;
323
+ o(this, "_providers", /* @__PURE__ */ new Set());
324
+ o(this, "_state", new Gt());
325
+ o(this, "_model");
326
+ o(this, "_currentMatch$", new D(null));
327
+ o(this, "currentMatch$", this._currentMatch$.asObservable());
328
+ o(this, "_replaceables$", new D([]));
329
+ o(this, "replaceables$", this._replaceables$.asObservable());
330
+ o(this, "_focusSignal$", new Ce());
331
+ o(this, "focusSignal$", this._focusSignal$.asObservable());
332
+ this._injector = e, this._contextService = n;
346
333
  }
347
334
  get stateUpdates$() {
348
335
  return this._state.stateUpdates$;
@@ -360,41 +347,41 @@ let FindReplaceService = (_a2 = class extends Disposable {
360
347
  super.dispose(), this._currentMatch$.next(null), this._currentMatch$.complete(), this._replaceables$.next([]), this._replaceables$.complete(), this._focusSignal$.complete();
361
348
  }
362
349
  getCurrentMatch() {
363
- var _a5;
364
- return (_a5 = this._model) == null ? void 0 : _a5.getCurrentMatch();
350
+ var e;
351
+ return (e = this._model) == null ? void 0 : e.getCurrentMatch();
365
352
  }
366
353
  getFindString() {
367
354
  return this._state.findString;
368
355
  }
369
- changeFindString(findString) {
370
- this._state.changeState({ findString });
356
+ changeFindString(e) {
357
+ this._state.changeState({ findString: e });
371
358
  }
372
359
  focusFindInput() {
373
360
  this._focusSignal$.next();
374
361
  }
375
- changeInputtingFindString(value) {
376
- value ? this._state.changeState({ inputtingFindString: value }) : this._state.changeState({ inputtingFindString: "", findString: "" });
362
+ changeInputtingFindString(e) {
363
+ e ? this._state.changeState({ inputtingFindString: e }) : this._state.changeState({ inputtingFindString: "", findString: "" });
377
364
  }
378
- changeReplaceString(replaceString) {
379
- this._state.changeState({ replaceString });
365
+ changeReplaceString(e) {
366
+ this._state.changeState({ replaceString: e });
380
367
  }
381
- changeMatchesTheWholeCell(matchesTheWholeCell) {
382
- this._state.changeState({ matchesTheWholeCell });
368
+ changeMatchesTheWholeCell(e) {
369
+ this._state.changeState({ matchesTheWholeCell: e });
383
370
  }
384
- changeCaseSensitive(caseSensitive) {
385
- this._state.changeState({ caseSensitive });
371
+ changeCaseSensitive(e) {
372
+ this._state.changeState({ caseSensitive: e });
386
373
  }
387
- changeFindBy(findBy) {
388
- this._state.changeState({ findBy }), this._toggleDisplayRawFormula(
389
- findBy === "formula"
374
+ changeFindBy(e) {
375
+ this._state.changeState({ findBy: e }), this._toggleDisplayRawFormula(
376
+ e === "formula"
390
377
  /* FORMULA */
391
378
  );
392
379
  }
393
- changeFindScope(scope) {
394
- this._state.changeState({ findScope: scope });
380
+ changeFindScope(e) {
381
+ this._state.changeState({ findScope: e });
395
382
  }
396
- changeFindDirection(direction) {
397
- this._state.changeState({ findDirection: direction });
383
+ changeFindDirection(e) {
384
+ this._state.changeState({ findDirection: e });
398
385
  }
399
386
  moveToNextMatch() {
400
387
  this._model && (this._state.replaceRevealed && !this._model.searched ? (this._state.changeState({ findString: this._state.inputtingFindString }), this._model.start()) : this._model.moveToNextMatch(), this._focusSignal$.next());
@@ -413,87 +400,87 @@ let FindReplaceService = (_a2 = class extends Disposable {
413
400
  revealReplace() {
414
401
  this._state.changeState({ replaceRevealed: !0, inputtingFindString: this._state.findString }), this._toggleRevealReplace(!0);
415
402
  }
416
- start(revealReplace = !1) {
403
+ start(e = !1) {
417
404
  if (this._providers.size === 0)
418
405
  return !1;
419
- this._model = this._injector.createInstance(FindReplaceModel, this._state, this._providers), this._model.currentMatch$.subscribe((match) => this._currentMatch$.next(match)), this._model.replaceables$.subscribe((replaceables) => this._replaceables$.next(replaceables));
420
- const newState = createInitFindReplaceState();
421
- return revealReplace && (newState.replaceRevealed = !0), this._state.changeState(newState), this._toggleRevealReplace(revealReplace), !0;
406
+ this._model = this._injector.createInstance(z, this._state, this._providers), this._model.currentMatch$.subscribe((t) => this._currentMatch$.next(t)), this._model.replaceables$.subscribe((t) => this._replaceables$.next(t));
407
+ const n = se();
408
+ return e && (n.replaceRevealed = !0), this._state.changeState(n), this._toggleRevealReplace(e), !0;
422
409
  }
423
410
  find() {
424
- var _a5;
425
- (_a5 = this._model) == null || _a5.start();
411
+ var e;
412
+ (e = this._model) == null || e.start();
426
413
  }
427
414
  terminate() {
428
- var _a5;
429
- (_a5 = this._model) == null || _a5.dispose(), this._model = null, this._toggleDisplayRawFormula(!1), this._toggleRevealReplace(!1);
415
+ var e;
416
+ (e = this._model) == null || e.dispose(), this._model = null, this._toggleDisplayRawFormula(!1), this._toggleRevealReplace(!1);
430
417
  }
431
- registerFindReplaceProvider(provider) {
432
- return this._providers.add(provider), toDisposable(() => this._providers.delete(provider));
418
+ registerFindReplaceProvider(e) {
419
+ return this._providers.add(e), A(() => this._providers.delete(e));
433
420
  }
434
- _toggleRevealReplace(revealReplace) {
435
- this._contextService.setContextValue(FIND_REPLACE_REPLACE_REVEALED, revealReplace);
421
+ _toggleRevealReplace(e) {
422
+ this._contextService.setContextValue(De, e);
436
423
  }
437
- _toggleDisplayRawFormula(force) {
438
- this._contextService.setContextValue(RENDER_RAW_FORMULA_KEY, force);
424
+ _toggleDisplayRawFormula(e) {
425
+ this._contextService.setContextValue(Pt, e);
439
426
  }
440
- }, __name(_a2, "FindReplaceService"), _a2);
441
- FindReplaceService = __decorateClass$2([
442
- __decorateParam$2(0, Inject(Injector)),
443
- __decorateParam$2(1, IContextService)
444
- ], FindReplaceService);
445
- const ReplaceCurrentMatchCommand = {
427
+ };
428
+ Q = Fe([
429
+ K(0, y(X)),
430
+ K(1, te)
431
+ ], Q);
432
+ const Pe = {
446
433
  id: "ui.command.replace-current-match",
447
- type: CommandType.COMMAND,
448
- handler: /* @__PURE__ */ __name((accessor) => accessor.get(IFindReplaceService).replace(), "handler")
449
- }, CONFIRM_REPLACE_ALL_ID = "CONFIRM_REPLACE_ALL", ReplaceAllMatchesCommand = {
434
+ type: x.COMMAND,
435
+ handler: (i) => i.get(g).replace()
436
+ }, kt = "CONFIRM_REPLACE_ALL", Oe = {
450
437
  id: "ui.command.replace-all-matches",
451
- type: CommandType.COMMAND,
452
- handler: /* @__PURE__ */ __name(async (accessor) => {
453
- const confirmService = accessor.get(IConfirmService), localeService = accessor.get(LocaleService), messageService = accessor.get(IMessageService);
454
- if (!await confirmService.confirm({
455
- id: CONFIRM_REPLACE_ALL_ID,
456
- title: { title: localeService.t("find-replace.replace.confirm.title") },
457
- cancelText: localeService.t("button.cancel"),
458
- confirmText: localeService.t("button.confirm")
438
+ type: x.COMMAND,
439
+ handler: async (i) => {
440
+ const e = i.get(pt), n = i.get(U), t = i.get(me);
441
+ if (!await e.confirm({
442
+ id: kt,
443
+ title: { title: n.t("find-replace.replace.confirm.title") },
444
+ cancelText: n.t("button.cancel"),
445
+ confirmText: n.t("button.confirm")
459
446
  }))
460
447
  return !1;
461
- const result = await accessor.get(IFindReplaceService).replaceAll(), { success, failure } = result;
462
- return failure > 0 ? (success === 0 ? messageService.show({
463
- type: MessageType.Error,
464
- content: localeService.t("find-replace.replace.all-failure")
465
- }) : messageService.show({
466
- type: MessageType.Warning,
467
- content: localeService.t("find-replace.replace.partial-success", `${success}`, `${failure}`)
468
- }), !1) : (messageService.show({
469
- type: MessageType.Success,
470
- content: localeService.t("find-replace.replace.all-success", `${success}`)
448
+ const r = await i.get(g).replaceAll(), { success: a, failure: l } = r;
449
+ return l > 0 ? (a === 0 ? t.show({
450
+ type: E.Error,
451
+ content: n.t("find-replace.replace.all-failure")
452
+ }) : t.show({
453
+ type: E.Warning,
454
+ content: n.t("find-replace.replace.partial-success", `${a}`, `${l}`)
455
+ }), !1) : (t.show({
456
+ type: E.Success,
457
+ content: n.t("find-replace.replace.all-success", `${a}`)
471
458
  }), !0);
472
- }, "handler")
473
- }, OpenFindDialogOperation = {
459
+ }
460
+ }, F = {
474
461
  id: "ui.operation.open-find-dialog",
475
- type: CommandType.OPERATION,
476
- handler: /* @__PURE__ */ __name((accessor) => {
477
- const findReplaceService = accessor.get(IFindReplaceService);
478
- return findReplaceService.revealed ? findReplaceService.focusFindInput() : findReplaceService.start(), !0;
479
- }, "handler")
480
- }, OpenReplaceDialogOperation = {
462
+ type: x.OPERATION,
463
+ handler: (i) => {
464
+ const e = i.get(g);
465
+ return e.revealed ? e.focusFindInput() : e.start(), !0;
466
+ }
467
+ }, re = {
481
468
  id: "ui.operation.open-replace-dialog",
482
- type: CommandType.OPERATION,
483
- handler: /* @__PURE__ */ __name((accessor) => {
484
- const findReplaceService = accessor.get(IFindReplaceService);
485
- return findReplaceService.revealed ? findReplaceService.replaceRevealed ? findReplaceService.focusFindInput() : findReplaceService.revealReplace() : findReplaceService.start(!0), !0;
486
- }, "handler")
487
- }, GoToNextMatchOperation = {
488
- type: CommandType.OPERATION,
469
+ type: x.OPERATION,
470
+ handler: (i) => {
471
+ const e = i.get(g);
472
+ return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
473
+ }
474
+ }, Te = {
475
+ type: x.OPERATION,
489
476
  id: "ui.operation.go-to-next-match",
490
- handler: /* @__PURE__ */ __name((accessor) => (accessor.get(IFindReplaceService).moveToNextMatch(), !0), "handler")
491
- }, GoToPreviousMatchOperation = {
492
- type: CommandType.OPERATION,
477
+ handler: (i) => (i.get(g).moveToNextMatch(), !0)
478
+ }, Ee = {
479
+ type: x.OPERATION,
493
480
  id: "ui.operation.go-to-previous-match",
494
- handler: /* @__PURE__ */ __name((accessor) => (accessor.get(IFindReplaceService).moveToPreviousMatch(), !0), "handler")
481
+ handler: (i) => (i.get(g).moveToPreviousMatch(), !0)
495
482
  };
496
- var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
483
+ var Ne = { exports: {} }, W = {};
497
484
  /**
498
485
  * @license React
499
486
  * react-jsx-runtime.production.min.js
@@ -503,438 +490,423 @@ var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
503
490
  * This source code is licensed under the MIT license found in the
504
491
  * LICENSE file in the root directory of this source tree.
505
492
  */
506
- var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: !0, ref: !0, __self: !0, __source: !0 };
507
- function q(c, a, g) {
508
- var b, d = {}, e = null, h = null;
509
- g !== void 0 && (e = "" + g), a.key !== void 0 && (e = "" + a.key), a.ref !== void 0 && (h = a.ref);
510
- for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
511
- if (c && c.defaultProps) for (b in a = c.defaultProps, a) d[b] === void 0 && (d[b] = a[b]);
512
- return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
493
+ var Vt = Ot, Ht = Symbol.for("react.element"), qt = Symbol.for("react.fragment"), Kt = Object.prototype.hasOwnProperty, zt = Vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Yt = { key: !0, ref: !0, __self: !0, __source: !0 };
494
+ function $e(i, e, n) {
495
+ var t, s = {}, r = null, a = null;
496
+ n !== void 0 && (r = "" + n), e.key !== void 0 && (r = "" + e.key), e.ref !== void 0 && (a = e.ref);
497
+ for (t in e) Kt.call(e, t) && !Yt.hasOwnProperty(t) && (s[t] = e[t]);
498
+ if (i && i.defaultProps) for (t in e = i.defaultProps, e) s[t] === void 0 && (s[t] = e[t]);
499
+ return { $$typeof: Ht, type: i, key: r, ref: a, props: s, _owner: zt.current };
513
500
  }
514
- __name(q, "q");
515
- reactJsxRuntime_production_min.Fragment = l;
516
- reactJsxRuntime_production_min.jsx = q;
517
- reactJsxRuntime_production_min.jsxs = q;
518
- jsxRuntime.exports = reactJsxRuntime_production_min;
519
- var jsxRuntimeExports = jsxRuntime.exports;
520
- function SearchInput(props) {
521
- const { findCompleted: findComplete, localeService, matchesCount, matchesPosition, findString, findReplaceService, onChange, ...rest } = props, text = findComplete && matchesCount === 0 ? localeService.t("find-replace.dialog.no-result") : matchesCount === 0 ? " " : void 0;
522
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
523
- InputWithSlot,
501
+ W.Fragment = qt;
502
+ W.jsx = $e;
503
+ W.jsxs = $e;
504
+ Ne.exports = W;
505
+ var c = Ne.exports;
506
+ function Ae(i) {
507
+ const { findCompleted: e, localeService: n, matchesCount: t, matchesPosition: s, findString: r, findReplaceService: a, onChange: l, ...d } = i, f = e && t === 0 ? n.t("find-replace.dialog.no-result") : t === 0 ? " " : void 0;
508
+ return /* @__PURE__ */ c.jsx(
509
+ It,
524
510
  {
525
511
  autoFocus: !0,
526
- placeholder: localeService.t("find-replace.dialog.find-placeholder"),
527
- slot: /* @__PURE__ */ jsxRuntimeExports.jsx(
528
- Pager,
512
+ placeholder: n.t("find-replace.dialog.find-placeholder"),
513
+ slot: /* @__PURE__ */ c.jsx(
514
+ Dt,
529
515
  {
530
516
  loop: !0,
531
- text,
532
- value: matchesPosition,
533
- total: matchesCount,
534
- onChange: /* @__PURE__ */ __name((newIndex) => {
535
- matchesPosition === matchesCount && newIndex === 1 ? findReplaceService.moveToNextMatch() : matchesPosition === 1 && newIndex === matchesCount || newIndex < matchesPosition ? findReplaceService.moveToPreviousMatch() : findReplaceService.moveToNextMatch();
536
- }, "onChange")
517
+ text: f,
518
+ value: s,
519
+ total: t,
520
+ onChange: (p) => {
521
+ s === t && p === 1 ? a.moveToNextMatch() : s === 1 && p === t || p < s ? a.moveToPreviousMatch() : a.moveToNextMatch();
522
+ }
537
523
  }
538
524
  ),
539
- value: findString,
540
- onChange: /* @__PURE__ */ __name((value) => onChange == null ? void 0 : onChange(value), "onChange"),
541
- ...rest
525
+ value: r,
526
+ onChange: (p) => l == null ? void 0 : l(p),
527
+ ...d
542
528
  }
543
529
  );
544
530
  }
545
- __name(SearchInput, "SearchInput");
546
- const findReplaceDialogContainer = "univer-find-replace-dialog-container", findReplaceExpandContainer = "univer-find-replace-expand-container", buttonText = "univer-button-text", findReplaceButtonsGroup = "univer-find-replace-buttons-group", findReplaceButtonsGroupRight = "univer-find-replace-buttons-group-right", styles = {
547
- findReplaceDialogContainer,
548
- findReplaceExpandContainer,
549
- buttonText,
550
- findReplaceButtonsGroup,
551
- findReplaceButtonsGroupRight
531
+ const Zt = "univer-find-replace-dialog-container", Jt = "univer-find-replace-expand-container", Qt = "univer-button-text", Xt = "univer-find-replace-buttons-group", ei = "univer-find-replace-buttons-group-right", j = {
532
+ findReplaceDialogContainer: Zt,
533
+ findReplaceExpandContainer: Jt,
534
+ buttonText: Qt,
535
+ findReplaceButtonsGroup: Xt,
536
+ findReplaceButtonsGroupRight: ei
552
537
  };
553
- function useFindInputFocus(findReplaceService, ref) {
554
- const focus = useCallback(() => {
555
- var _a5;
556
- (_a5 = document.querySelector(".univer-find-input input")) == null || _a5.focus();
557
- }, []), selectHasFocus = useCallback(() => {
558
- const allInputs = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
559
- return Array.from(allInputs).some((input) => input === document.activeElement);
538
+ function Le(i, e) {
539
+ const n = u(() => {
540
+ var s;
541
+ (s = document.querySelector(".univer-find-input input")) == null || s.focus();
542
+ }, []), t = u(() => {
543
+ const s = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
544
+ return Array.from(s).some((r) => r === document.activeElement);
560
545
  }, []);
561
- return useImperativeHandle(ref, () => ({ focus, selectHasFocus })), useEffect(() => {
562
- const subscription = findReplaceService.focusSignal$.subscribe(() => focus());
563
- return () => subscription.unsubscribe();
564
- }, [findReplaceService, focus]), { focus, selectHasFocus };
546
+ return Tt(e, () => ({ focus: n, selectHasFocus: t })), L(() => {
547
+ const s = i.focusSignal$.subscribe(() => n());
548
+ return () => s.unsubscribe();
549
+ }, [i, n]), { focus: n, selectHasFocus: t };
565
550
  }
566
- __name(useFindInputFocus, "useFindInputFocus");
567
- const FindDialog = forwardRef(/* @__PURE__ */ __name(function(_props, ref) {
568
- const localeService = useDependency(LocaleService), findReplaceService = useDependency(IFindReplaceService), commandService = useDependency(ICommandService), state = useObservable(findReplaceService.state$, void 0, !0), { findCompleted, findString, matchesCount, matchesPosition } = state, revealReplace = useCallback(() => {
569
- commandService.executeCommand(OpenReplaceDialogOperation.id);
570
- }, [commandService]), onFindStringChange = useCallback((findString2) => findReplaceService.changeFindString(findString2), [findReplaceService]);
571
- return useFindInputFocus(findReplaceService, ref), /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
572
- /* @__PURE__ */ jsxRuntimeExports.jsx(
573
- SearchInput,
551
+ const ti = B(function(e, n) {
552
+ const t = v(U), s = v(g), r = v(ie), a = I(s.state$, void 0, !0), { findCompleted: l, findString: d, matchesCount: S, matchesPosition: f } = a, p = u(() => {
553
+ r.executeCommand(re.id);
554
+ }, [r]), O = u((C) => s.changeFindString(C), [s]);
555
+ return Le(s, n), /* @__PURE__ */ c.jsxs($, { children: [
556
+ /* @__PURE__ */ c.jsx(
557
+ Ae,
574
558
  {
575
- findCompleted,
559
+ findCompleted: l,
576
560
  className: "univer-find-input",
577
- matchesCount,
578
- matchesPosition,
579
- findReplaceService,
580
- localeService,
581
- findString,
582
- onChange: onFindStringChange
561
+ matchesCount: S,
562
+ matchesPosition: f,
563
+ findReplaceService: s,
564
+ localeService: t,
565
+ findString: d,
566
+ onChange: O
583
567
  }
584
568
  ),
585
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.findReplaceExpandContainer, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "text", size: "small", onClick: revealReplace, children: localeService.t("find-replace.dialog.advanced-finding") }) })
569
+ /* @__PURE__ */ c.jsx("div", { className: j.findReplaceExpandContainer, children: /* @__PURE__ */ c.jsx(N, { type: "text", size: "small", onClick: p, children: t.t("find-replace.dialog.advanced-finding") }) })
586
570
  ] });
587
- }, "FindDialogImpl")), ReplaceDialog = forwardRef(/* @__PURE__ */ __name(function(_props, ref) {
588
- const findReplaceService = useDependency(IFindReplaceService), localeService = useDependency(LocaleService), commandService = useDependency(ICommandService), messageService = useDependency(IMessageService), currentMatch = useObservable(findReplaceService.currentMatch$, void 0, !0), replaceables = useObservable(findReplaceService.replaceables$, void 0, !0), state = useObservable(findReplaceService.state$, void 0, !0), {
589
- matchesCount,
590
- matchesPosition,
591
- findString,
592
- inputtingFindString,
593
- replaceString,
594
- caseSensitive,
595
- matchesTheWholeCell,
596
- findDirection,
597
- findScope,
598
- findBy,
599
- findCompleted
600
- } = state, findDisabled = inputtingFindString.length === 0, replaceDisabled = matchesCount === 0 || !(currentMatch != null && currentMatch.replaceable), replaceAllDisabled = replaceables.length === 0, onFindStringChange = useCallback(
601
- (newValue) => findReplaceService.changeInputtingFindString(newValue),
602
- [findReplaceService]
603
- ), onReplaceStringChange = useCallback(
604
- (replaceString2) => findReplaceService.changeReplaceString(replaceString2),
605
- [findReplaceService]
606
- ), { focus } = useFindInputFocus(findReplaceService, ref), onClickFindButton = useCallback(() => {
607
- findString === inputtingFindString ? findReplaceService.moveToNextMatch() : (findReplaceService.changeFindString(inputtingFindString), findReplaceService.find());
608
- }, [findString, inputtingFindString, findReplaceService]), onClickReplaceButton = useCallback(() => commandService.executeCommand(ReplaceCurrentMatchCommand.id), [commandService]), onClickReplaceAllButton = useCallback(async () => {
609
- await commandService.executeCommand(ReplaceAllMatchesCommand.id), focus();
610
- }, [commandService]), onChangeFindDirection = useCallback((findDirection2) => {
611
- findReplaceService.changeFindDirection(findDirection2);
612
- }, [findReplaceService]), onChangeFindScope = useCallback((findScope2) => {
613
- findReplaceService.changeFindScope(findScope2);
614
- }, [findReplaceService]), onChangeFindBy = useCallback((findBy2) => {
615
- findReplaceService.changeFindBy(findBy2);
616
- }, [findReplaceService]), findScopeOptions = useFindScopeOptions(localeService), findDirectionOptions = useFindDirectionOptions(localeService), findByOptions = useFindByOptions(localeService);
617
- return useEffect(() => {
618
- const shouldDisplayNoMatchInfo = findCompleted && matchesCount === 0;
619
- let messageDisposable = null;
620
- return shouldDisplayNoMatchInfo && (messageDisposable = messageService.show({
621
- content: localeService.t("find-replace.dialog.no-match"),
622
- type: MessageType.Warning,
571
+ }), ii = B(function(e, n) {
572
+ const t = v(g), s = v(U), r = v(ie), a = v(me), l = I(t.currentMatch$, void 0, !0), d = I(t.replaceables$, void 0, !0), S = I(t.state$, void 0, !0), {
573
+ matchesCount: f,
574
+ matchesPosition: p,
575
+ findString: O,
576
+ inputtingFindString: C,
577
+ replaceString: Ue,
578
+ caseSensitive: Be,
579
+ matchesTheWholeCell: We,
580
+ findDirection: Ge,
581
+ findScope: ke,
582
+ findBy: Ve,
583
+ findCompleted: k
584
+ } = S, He = C.length === 0, qe = f === 0 || !(l != null && l.replaceable), Ke = d.length === 0, ze = u(
585
+ (h) => t.changeInputtingFindString(h),
586
+ [t]
587
+ ), Ye = u(
588
+ (h) => t.changeReplaceString(h),
589
+ [t]
590
+ ), { focus: Ze } = Le(t, n), Je = u(() => {
591
+ O === C ? t.moveToNextMatch() : (t.changeFindString(C), t.find());
592
+ }, [O, C, t]), Qe = u(() => r.executeCommand(Pe.id), [r]), Xe = u(async () => {
593
+ await r.executeCommand(Oe.id), Ze();
594
+ }, [r]), et = u((h) => {
595
+ t.changeFindDirection(h);
596
+ }, [t]), tt = u((h) => {
597
+ t.changeFindScope(h);
598
+ }, [t]), it = u((h) => {
599
+ t.changeFindBy(h);
600
+ }, [t]), nt = si(s), st = ri(s), rt = ai(s);
601
+ return L(() => {
602
+ const h = k && f === 0;
603
+ let T = null;
604
+ return h && (T = a.show({
605
+ content: s.t("find-replace.dialog.no-match"),
606
+ type: E.Warning,
623
607
  duration: 5e3
624
- })), () => messageDisposable == null ? void 0 : messageDisposable.dispose();
625
- }, [findCompleted, matchesCount, messageService, localeService]), /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
626
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("find-replace.dialog.find"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
627
- SearchInput,
608
+ })), () => T == null ? void 0 : T.dispose();
609
+ }, [k, f, a, s]), /* @__PURE__ */ c.jsxs($, { children: [
610
+ /* @__PURE__ */ c.jsx(R, { label: s.t("find-replace.dialog.find"), children: /* @__PURE__ */ c.jsx(
611
+ Ae,
628
612
  {
629
- findCompleted,
613
+ findCompleted: k,
630
614
  className: "univer-find-input",
631
- matchesCount,
632
- matchesPosition,
633
- findReplaceService,
634
- localeService,
635
- findString: inputtingFindString,
636
- onChange: onFindStringChange
615
+ matchesCount: f,
616
+ matchesPosition: p,
617
+ findReplaceService: t,
618
+ localeService: s,
619
+ findString: C,
620
+ onChange: ze
637
621
  }
638
622
  ) }),
639
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("find-replace.dialog.replace"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
640
- Input,
623
+ /* @__PURE__ */ c.jsx(R, { label: s.t("find-replace.dialog.replace"), children: /* @__PURE__ */ c.jsx(
624
+ Ft,
641
625
  {
642
- placeholder: localeService.t("find-replace.dialog.replace-placeholder"),
643
- value: replaceString,
644
- onChange: /* @__PURE__ */ __name((value) => onReplaceStringChange(value), "onChange")
626
+ placeholder: s.t("find-replace.dialog.replace-placeholder"),
627
+ value: Ue,
628
+ onChange: (h) => Ye(h)
645
629
  }
646
630
  ) }),
647
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select, { value: findDirection, options: findDirectionOptions, onChange: onChangeFindDirection }) }),
648
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormDualColumnLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
649
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select, { value: findScope, options: findScopeOptions, onChange: onChangeFindScope }) }),
650
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select, { value: findBy, options: findByOptions, onChange: onChangeFindBy }) })
631
+ /* @__PURE__ */ c.jsx(R, { label: s.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ c.jsx(V, { value: Ge, options: st, onChange: et }) }),
632
+ /* @__PURE__ */ c.jsx(le, { children: /* @__PURE__ */ c.jsxs($, { children: [
633
+ /* @__PURE__ */ c.jsx(R, { label: s.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ c.jsx(V, { value: ke, options: nt, onChange: tt }) }),
634
+ /* @__PURE__ */ c.jsx(R, { label: s.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ c.jsx(V, { value: Ve, options: rt, onChange: it }) })
651
635
  ] }) }),
652
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormDualColumnLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
653
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
654
- Checkbox,
636
+ /* @__PURE__ */ c.jsx(le, { children: /* @__PURE__ */ c.jsxs($, { children: [
637
+ /* @__PURE__ */ c.jsx(R, { children: /* @__PURE__ */ c.jsx(
638
+ de,
655
639
  {
656
- checked: caseSensitive,
657
- onChange: /* @__PURE__ */ __name((checked) => {
658
- findReplaceService.changeCaseSensitive(checked);
659
- }, "onChange"),
660
- children: localeService.t("find-replace.dialog.case-sensitive")
640
+ checked: Be,
641
+ onChange: (h) => {
642
+ t.changeCaseSensitive(h);
643
+ },
644
+ children: s.t("find-replace.dialog.case-sensitive")
661
645
  }
662
646
  ) }),
663
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
664
- Checkbox,
647
+ /* @__PURE__ */ c.jsx(R, { children: /* @__PURE__ */ c.jsx(
648
+ de,
665
649
  {
666
- checked: matchesTheWholeCell,
667
- onChange: /* @__PURE__ */ __name((checked) => {
668
- findReplaceService.changeMatchesTheWholeCell(checked);
669
- }, "onChange"),
670
- children: localeService.t("find-replace.dialog.match-the-whole-cell")
650
+ checked: We,
651
+ onChange: (h) => {
652
+ t.changeMatchesTheWholeCell(h);
653
+ },
654
+ children: s.t("find-replace.dialog.match-the-whole-cell")
671
655
  }
672
656
  ) })
673
657
  ] }) }),
674
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.findReplaceButtonsGroup, children: [
675
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "primary", onClick: onClickFindButton, disabled: findDisabled, children: localeService.t("find-replace.dialog.find") }),
676
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: styles.findReplaceButtonsGroupRight, children: [
677
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { disabled: replaceDisabled, onClick: onClickReplaceButton, children: localeService.t("find-replace.dialog.replace") }),
678
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { disabled: replaceAllDisabled, onClick: onClickReplaceAllButton, children: localeService.t("find-replace.dialog.replace-all") })
658
+ /* @__PURE__ */ c.jsxs("div", { className: j.findReplaceButtonsGroup, children: [
659
+ /* @__PURE__ */ c.jsx(N, { type: "primary", onClick: Je, disabled: He, children: s.t("find-replace.dialog.find") }),
660
+ /* @__PURE__ */ c.jsxs("span", { className: j.findReplaceButtonsGroupRight, children: [
661
+ /* @__PURE__ */ c.jsx(N, { disabled: qe, onClick: Qe, children: s.t("find-replace.dialog.replace") }),
662
+ /* @__PURE__ */ c.jsx(N, { disabled: Ke, onClick: Xe, children: s.t("find-replace.dialog.replace-all") })
679
663
  ] })
680
664
  ] })
681
665
  ] });
682
- }, "ReplaceDIalogImpl"));
683
- function FindReplaceDialog() {
684
- const findReplaceService = useDependency(IFindReplaceService), layoutService = useDependency(ILayoutService), contextService = useDependency(IContextService), state = useObservable(findReplaceService.state$, void 0, !0), dialogContainerRef = useRef(null);
685
- useEffect(() => {
686
- let disposable;
687
- return dialogContainerRef.current && (disposable = layoutService.registerContainerElement(dialogContainerRef.current)), () => disposable == null ? void 0 : disposable.dispose();
688
- }, [layoutService]);
689
- const focusRef = useRef(null), setDialogContainerFocus = useCallback(
690
- (focused) => contextService.setContextValue(FIND_REPLACE_DIALOG_FOCUS, focused),
691
- [contextService]
692
- ), setDialogInputFocus = useCallback(
693
- (focused) => contextService.setContextValue(FIND_REPLACE_INPUT_FOCUS, focused),
694
- [contextService]
666
+ });
667
+ function ni() {
668
+ const i = v(g), e = v(ve), n = v(te), t = I(i.state$, void 0, !0), s = q(null);
669
+ L(() => {
670
+ let d;
671
+ return s.current && (d = e.registerContainerElement(s.current)), () => d == null ? void 0 : d.dispose();
672
+ }, [e]);
673
+ const r = q(null), a = u(
674
+ (d) => n.setContextValue(Ie, d),
675
+ [n]
676
+ ), l = u(
677
+ (d) => n.setContextValue(ye, d),
678
+ [n]
695
679
  );
696
- return useEffect(() => {
697
- var _a5;
698
- const focusSubscription = fromEvent(document, "focusin").subscribe((event) => {
699
- var _a6;
700
- event.target && ((_a6 = dialogContainerRef.current) != null && _a6.contains(event.target)) ? setDialogContainerFocus(!0) : setDialogContainerFocus(!1), !focusRef.current || !focusRef.current.selectHasFocus() ? setDialogInputFocus(!0) : setDialogInputFocus(!1);
680
+ return L(() => {
681
+ var S;
682
+ const d = xt(document, "focusin").subscribe((f) => {
683
+ var p;
684
+ f.target && ((p = s.current) != null && p.contains(f.target)) ? a(!0) : a(!1), !r.current || !r.current.selectHasFocus() ? l(!0) : l(!1);
701
685
  });
702
- return (_a5 = focusRef.current) == null || _a5.focus(), setDialogContainerFocus(!0), setDialogInputFocus(!0), () => {
703
- focusSubscription.unsubscribe(), setDialogContainerFocus(!1);
686
+ return (S = r.current) == null || S.focus(), a(!0), l(!0), () => {
687
+ d.unsubscribe(), a(!1);
704
688
  };
705
- }, [setDialogContainerFocus, setDialogInputFocus]), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.findReplaceDialogContainer, ref: dialogContainerRef, children: state.replaceRevealed ? /* @__PURE__ */ jsxRuntimeExports.jsx(ReplaceDialog, { ref: focusRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(FindDialog, { ref: focusRef }) });
689
+ }, [a, l]), /* @__PURE__ */ c.jsx("div", { className: j.findReplaceDialogContainer, ref: s, children: t.replaceRevealed ? /* @__PURE__ */ c.jsx(ii, { ref: r }) : /* @__PURE__ */ c.jsx(ti, { ref: r }) });
706
690
  }
707
- __name(FindReplaceDialog, "FindReplaceDialog");
708
- function useFindScopeOptions(localeService) {
709
- const locale = localeService.getCurrentLocale();
710
- return useMemo(() => [
711
- { label: localeService.t("find-replace.dialog.find-scope.current-sheet"), value: FindScope.SUBUNIT },
712
- { label: localeService.t("find-replace.dialog.find-scope.workbook"), value: FindScope.UNIT }
713
- ], [locale]);
691
+ function si(i) {
692
+ const e = i.getCurrentLocale();
693
+ return ne(() => [
694
+ { label: i.t("find-replace.dialog.find-scope.current-sheet"), value: J.SUBUNIT },
695
+ { label: i.t("find-replace.dialog.find-scope.workbook"), value: J.UNIT }
696
+ ], [e]);
714
697
  }
715
- __name(useFindScopeOptions, "useFindScopeOptions");
716
- function useFindDirectionOptions(localeService) {
717
- const locale = localeService.getCurrentLocale();
718
- return useMemo(() => [
719
- { label: localeService.t("find-replace.dialog.find-direction.row"), value: FindDirection.ROW },
720
- { label: localeService.t("find-replace.dialog.find-direction.column"), value: FindDirection.COLUMN }
721
- ], [locale]);
698
+ function ri(i) {
699
+ const e = i.getCurrentLocale();
700
+ return ne(() => [
701
+ { label: i.t("find-replace.dialog.find-direction.row"), value: Y.ROW },
702
+ { label: i.t("find-replace.dialog.find-direction.column"), value: Y.COLUMN }
703
+ ], [e]);
722
704
  }
723
- __name(useFindDirectionOptions, "useFindDirectionOptions");
724
- function useFindByOptions(localeService) {
725
- const locale = localeService.getCurrentLocale();
726
- return useMemo(() => [
727
- { label: localeService.t("find-replace.dialog.find-by.value"), value: FindBy.VALUE },
728
- { label: localeService.t("find-replace.dialog.find-by.formula"), value: FindBy.FORMULA }
729
- ], [locale]);
705
+ function ai(i) {
706
+ const e = i.getCurrentLocale();
707
+ return ne(() => [
708
+ { label: i.t("find-replace.dialog.find-by.value"), value: Z.VALUE },
709
+ { label: i.t("find-replace.dialog.find-by.formula"), value: Z.FORMULA }
710
+ ], [e]);
730
711
  }
731
- __name(useFindByOptions, "useFindByOptions");
732
- function whenFindReplaceDialogFocused(contextService) {
733
- return contextService.getContextValue(FIND_REPLACE_DIALOG_FOCUS);
712
+ function P(i) {
713
+ return i.getContextValue(Ie);
734
714
  }
735
- __name(whenFindReplaceDialogFocused, "whenFindReplaceDialogFocused");
736
- function whenReplaceRevealed(contextService) {
737
- return contextService.getContextValue(FIND_REPLACE_REPLACE_REVEALED);
715
+ function oi(i) {
716
+ return i.getContextValue(De);
738
717
  }
739
- __name(whenReplaceRevealed, "whenReplaceRevealed");
740
- function whenFindReplaceInputFocused(contextService) {
741
- return contextService.getContextValue(FIND_REPLACE_INPUT_FOCUS);
718
+ function je(i) {
719
+ return i.getContextValue(ye);
742
720
  }
743
- __name(whenFindReplaceInputFocused, "whenFindReplaceInputFocused");
744
- const FIND_REPLACE_SHORTCUT_GROUP = "7_find-replace-shortcuts";
745
- function whenSheetFocused(contextService) {
746
- return contextService.getContextValue(FOCUSING_SHEET);
721
+ const G = "7_find-replace-shortcuts";
722
+ function ae(i) {
723
+ return i.getContextValue(_e);
747
724
  }
748
- __name(whenSheetFocused, "whenSheetFocused");
749
- function whenEditorNotActivated(contextService) {
750
- return !contextService.getContextValue(EDITOR_ACTIVATED);
725
+ function oe(i) {
726
+ return !i.getContextValue(ge);
751
727
  }
752
- __name(whenEditorNotActivated, "whenEditorNotActivated");
753
- const OpenFindDialogShortcutItem = {
754
- id: OpenFindDialogOperation.id,
728
+ const ci = {
729
+ id: F.id,
755
730
  description: "find-replace.shortcut.open-find-dialog",
756
- binding: KeyCode.F | MetaKeys.CTRL_COMMAND,
757
- group: FIND_REPLACE_SHORTCUT_GROUP,
758
- preconditions(contextService) {
759
- return !whenFindReplaceDialogFocused(contextService) && whenSheetFocused(contextService) && whenEditorNotActivated(contextService);
731
+ binding: M.F | b.CTRL_COMMAND,
732
+ group: G,
733
+ preconditions(i) {
734
+ return !P(i) && ae(i) && oe(i);
760
735
  }
761
- }, MacOpenFindDialogShortcutItem = {
762
- id: OpenFindDialogOperation.id,
736
+ }, li = {
737
+ id: F.id,
763
738
  description: "find-replace.shortcut.open-find-dialog",
764
- binding: KeyCode.F | MetaKeys.CTRL_COMMAND,
765
- mac: KeyCode.F | MetaKeys.MAC_CTRL,
766
- preconditions(contextService) {
767
- return !whenFindReplaceDialogFocused(contextService) && whenSheetFocused(contextService) && whenEditorNotActivated(contextService);
739
+ binding: M.F | b.CTRL_COMMAND,
740
+ mac: M.F | b.MAC_CTRL,
741
+ preconditions(i) {
742
+ return !P(i) && ae(i) && oe(i);
768
743
  }
769
- }, OpenReplaceDialogShortcutItem = {
770
- id: OpenReplaceDialogOperation.id,
744
+ }, di = {
745
+ id: re.id,
771
746
  description: "find-replace.shortcut.open-replace-dialog",
772
- binding: KeyCode.H | MetaKeys.CTRL_COMMAND,
773
- mac: KeyCode.H | MetaKeys.MAC_CTRL,
774
- group: FIND_REPLACE_SHORTCUT_GROUP,
775
- preconditions(contextService) {
776
- return whenSheetFocused(contextService) && whenEditorNotActivated(contextService) && (!whenFindReplaceDialogFocused(contextService) || !whenReplaceRevealed(contextService));
777
- }
778
- }, GoToNextFindMatchShortcutItem = {
779
- id: GoToNextMatchOperation.id,
747
+ binding: M.H | b.CTRL_COMMAND,
748
+ mac: M.H | b.MAC_CTRL,
749
+ group: G,
750
+ preconditions(i) {
751
+ return ae(i) && oe(i) && (!P(i) || !oi(i));
752
+ }
753
+ }, hi = {
754
+ id: Te.id,
780
755
  description: "find-replace.shortcut.go-to-next-match",
781
- binding: KeyCode.ENTER,
782
- group: FIND_REPLACE_SHORTCUT_GROUP,
756
+ binding: M.ENTER,
757
+ group: G,
783
758
  priority: 1e3,
784
- preconditions(contextService) {
785
- return whenFindReplaceInputFocused(contextService) && whenFindReplaceDialogFocused(contextService);
759
+ preconditions(i) {
760
+ return je(i) && P(i);
786
761
  }
787
- }, GoToPreviousFindMatchShortcutItem = {
788
- id: GoToPreviousMatchOperation.id,
762
+ }, ui = {
763
+ id: Ee.id,
789
764
  description: "find-replace.shortcut.go-to-previous-match",
790
- binding: KeyCode.ENTER | MetaKeys.SHIFT,
791
- group: FIND_REPLACE_SHORTCUT_GROUP,
765
+ binding: M.ENTER | b.SHIFT,
766
+ group: G,
792
767
  priority: 1e3,
793
- preconditions(contextService) {
794
- return whenFindReplaceInputFocused(contextService) && whenFindReplaceDialogFocused(contextService);
768
+ preconditions(i) {
769
+ return je(i) && P(i);
795
770
  }
796
771
  };
797
- function FindReplaceMenuItemFactory(accessor) {
798
- const contextService = accessor.get(IContextService);
772
+ function fi(i) {
773
+ const e = i.get(te);
799
774
  return {
800
- id: OpenFindDialogOperation.id,
775
+ id: F.id,
801
776
  icon: "SearchIcon",
802
777
  tooltip: "find-replace.toolbar",
803
- type: MenuItemType.BUTTON,
804
- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
805
- disabled$: combineLatest([
806
- contextService.subscribeContextValue$(EDITOR_ACTIVATED),
807
- contextService.subscribeContextValue$(FOCUSING_SHEET)
808
- ]).pipe(map(([editorActivated, focusingSheet]) => editorActivated || !focusingSheet))
778
+ type: _t.BUTTON,
779
+ hidden$: gt(i, dt.UNIVER_SHEET),
780
+ disabled$: Se([
781
+ e.subscribeContextValue$(ge),
782
+ e.subscribeContextValue$(_e)
783
+ ]).pipe(yt(([n, t]) => n || !t))
809
784
  };
810
785
  }
811
- __name(FindReplaceMenuItemFactory, "FindReplaceMenuItemFactory");
812
- const menuSchema = {
813
- [RibbonStartGroup.OTHERS]: {
814
- [OpenFindDialogOperation.id]: {
786
+ const pi = {
787
+ [mt.OTHERS]: {
788
+ [F.id]: {
815
789
  order: 2,
816
- menuItemFactory: FindReplaceMenuItemFactory
790
+ menuItemFactory: fi
817
791
  }
818
792
  }
819
793
  };
820
- var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
821
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
822
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
823
- return kind && result && __defProp$1(target, key, result), result;
824
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
825
- const FIND_REPLACE_DIALOG_ID = "DESKTOP_FIND_REPLACE_DIALOG", FIND_REPLACE_PANEL_WIDTH = 350, FIND_REPLACE_PANEL_RIGHT_PADDING = 20, FIND_REPLACE_PANEL_TOP_PADDING = -90;
826
- var _a3;
827
- let FindReplaceController = (_a3 = class extends RxDisposable {
828
- constructor(_univerInstanceService, _menuManagerService, _shortcutService, _commandService, _findReplaceService, _dialogService, _layoutService, _localeService, _componentManager, _injector) {
794
+ var _i = Object.defineProperty, gi = Object.getOwnPropertyDescriptor, mi = (i, e, n, t) => {
795
+ for (var s = t > 1 ? void 0 : t ? gi(e, n) : e, r = i.length - 1, a; r >= 0; r--)
796
+ (a = i[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
797
+ return t && s && _i(e, n, s), s;
798
+ }, m = (i, e) => (n, t) => e(n, t, i);
799
+ const he = "DESKTOP_FIND_REPLACE_DIALOG", we = 350, vi = 20, Si = -90;
800
+ let w = class extends ht {
801
+ constructor(e, n, t, s, r, a, l, d, S, f) {
829
802
  super();
830
- __publicField(this, "_closingListenerDisposable");
831
- this._univerInstanceService = _univerInstanceService, this._menuManagerService = _menuManagerService, this._shortcutService = _shortcutService, this._commandService = _commandService, this._findReplaceService = _findReplaceService, this._dialogService = _dialogService, this._layoutService = _layoutService, this._localeService = _localeService, this._componentManager = _componentManager, this._injector = _injector, this._initCommands(), this._initUI(), this._initShortcuts();
803
+ o(this, "_closingListenerDisposable");
804
+ this._univerInstanceService = e, this._menuManagerService = n, this._shortcutService = t, this._commandService = s, this._findReplaceService = r, this._dialogService = a, this._layoutService = l, this._localeService = d, this._componentManager = S, this._injector = f, this._initCommands(), this._initUI(), this._initShortcuts();
832
805
  }
833
806
  dispose() {
834
- var _a5;
835
- super.dispose(), (_a5 = this._closingListenerDisposable) == null || _a5.dispose(), this._closingListenerDisposable = null;
807
+ var e;
808
+ super.dispose(), (e = this._closingListenerDisposable) == null || e.dispose(), this._closingListenerDisposable = null;
836
809
  }
837
810
  _initCommands() {
838
811
  [
839
- OpenFindDialogOperation,
840
- OpenReplaceDialogOperation,
841
- GoToNextMatchOperation,
842
- GoToPreviousMatchOperation,
843
- ReplaceAllMatchesCommand,
844
- ReplaceCurrentMatchCommand
845
- ].forEach((c) => {
846
- this.disposeWithMe(this._commandService.registerCommand(c));
812
+ F,
813
+ re,
814
+ Te,
815
+ Ee,
816
+ Oe,
817
+ Pe
818
+ ].forEach((e) => {
819
+ this.disposeWithMe(this._commandService.registerCommand(e));
847
820
  });
848
821
  }
849
822
  _initShortcuts() {
850
823
  [
851
- OpenReplaceDialogShortcutItem,
852
- OpenFindDialogShortcutItem,
853
- MacOpenFindDialogShortcutItem,
854
- GoToPreviousFindMatchShortcutItem,
855
- GoToNextFindMatchShortcutItem
856
- ].forEach((s) => this.disposeWithMe(this._shortcutService.registerShortcut(s)));
824
+ di,
825
+ ci,
826
+ li,
827
+ ui,
828
+ hi
829
+ ].forEach((e) => this.disposeWithMe(this._shortcutService.registerShortcut(e)));
857
830
  }
858
831
  _initUI() {
859
- this.disposeWithMe(this._componentManager.register("FindReplaceDialog", FindReplaceDialog)), this.disposeWithMe(this._componentManager.register("SearchIcon", SearchSingle16)), this._menuManagerService.mergeMenu(menuSchema), this._findReplaceService.stateUpdates$.pipe(takeUntil(this.dispose$)).subscribe((newState) => {
860
- newState.revealed === !0 && this._openPanel();
832
+ this.disposeWithMe(this._componentManager.register("FindReplaceDialog", ni)), this.disposeWithMe(this._componentManager.register("SearchIcon", xe)), this._menuManagerService.mergeMenu(pi), this._findReplaceService.stateUpdates$.pipe(ce(this.dispose$)).subscribe((e) => {
833
+ e.revealed === !0 && this._openPanel();
861
834
  });
862
835
  }
863
836
  _openPanel() {
864
837
  this._dialogService.open({
865
- id: FIND_REPLACE_DIALOG_ID,
838
+ id: he,
866
839
  draggable: !0,
867
- width: FIND_REPLACE_PANEL_WIDTH,
840
+ width: we,
868
841
  title: { title: this._localeService.t("find-replace.dialog.title") },
869
842
  children: { label: "FindReplaceDialog" },
870
843
  destroyOnClose: !0,
871
- defaultPosition: getFindReplaceDialogDefaultPosition(),
844
+ defaultPosition: Ci(),
872
845
  preservePositionOnDestroy: !0,
873
- onClose: /* @__PURE__ */ __name(() => this.closePanel(), "onClose")
874
- }), this._closingListenerDisposable = toDisposable(this._univerInstanceService.focused$.pipe(takeUntil(this.dispose$)).subscribe((focused) => {
875
- (!focused || !this._univerInstanceService.getUniverSheetInstance(focused)) && this.closePanel();
846
+ onClose: () => this.closePanel()
847
+ }), this._closingListenerDisposable = A(this._univerInstanceService.focused$.pipe(ce(this.dispose$)).subscribe((e) => {
848
+ (!e || !this._univerInstanceService.getUniverSheetInstance(e)) && this.closePanel();
876
849
  }));
877
850
  }
878
851
  closePanel() {
879
- this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(FIND_REPLACE_DIALOG_ID), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
880
- }
881
- }, __name(_a3, "FindReplaceController"), _a3);
882
- FindReplaceController = __decorateClass$1([
883
- __decorateParam$1(0, IUniverInstanceService),
884
- __decorateParam$1(1, IMenuManagerService),
885
- __decorateParam$1(2, IShortcutService),
886
- __decorateParam$1(3, ICommandService),
887
- __decorateParam$1(4, IFindReplaceService),
888
- __decorateParam$1(5, IDialogService),
889
- __decorateParam$1(6, ILayoutService),
890
- __decorateParam$1(7, Inject(LocaleService)),
891
- __decorateParam$1(8, Inject(ComponentManager)),
892
- __decorateParam$1(9, Inject(Injector))
893
- ], FindReplaceController);
894
- function getFindReplaceDialogDefaultPosition() {
895
- const { innerWidth } = window;
896
- return { x: (innerWidth - FIND_REPLACE_PANEL_WIDTH) / 2 - FIND_REPLACE_PANEL_RIGHT_PADDING, y: FIND_REPLACE_PANEL_TOP_PADDING };
852
+ this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(he), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
853
+ }
854
+ };
855
+ w = mi([
856
+ m(0, pe),
857
+ m(1, St),
858
+ m(2, Ct),
859
+ m(3, ie),
860
+ m(4, g),
861
+ m(5, Rt),
862
+ m(6, ve),
863
+ m(7, y(U)),
864
+ m(8, y(vt)),
865
+ m(9, y(X))
866
+ ], w);
867
+ function Ci() {
868
+ const { innerWidth: i } = window;
869
+ return { x: (i - we) / 2 - vi, y: Si };
897
870
  }
898
- __name(getFindReplaceDialogDefaultPosition, "getFindReplaceDialogDefaultPosition");
899
- var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
900
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
901
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
902
- return kind && result && __defProp2(target, key, result), result;
903
- }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
904
- const PLUGIN_NAME = "UNIVER_FIND_REPLACE_PLUGIN";
905
- var _a4;
906
- let UniverFindReplacePlugin = (_a4 = class extends Plugin {
907
- constructor(_config = defaultPluginConfig, _injector, _configService) {
908
- super(), this._config = _config, this._injector = _injector, this._configService = _configService;
909
- const { ...rest } = this._config;
910
- this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
871
+ var Ri = Object.defineProperty, Mi = Object.getOwnPropertyDescriptor, bi = (i, e, n, t) => {
872
+ for (var s = t > 1 ? void 0 : t ? Mi(e, n) : e, r = i.length - 1, a; r >= 0; r--)
873
+ (a = i[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
874
+ return t && s && Ri(e, n, s), s;
875
+ }, ue = (i, e) => (n, t) => e(n, t, i);
876
+ const xi = "UNIVER_FIND_REPLACE_PLUGIN";
877
+ var H;
878
+ let fe = (H = class extends ut {
879
+ constructor(i = Nt, e, n) {
880
+ super(), this._config = i, this._injector = e, this._configService = n;
881
+ const { ...t } = this._config;
882
+ this._configService.setConfig(Et, t);
911
883
  }
912
884
  onStarting() {
913
885
  [
914
- [FindReplaceController],
915
- [IFindReplaceService, { useClass: FindReplaceService }]
916
- ].forEach((d) => this._injector.add(d));
886
+ [w],
887
+ [g, { useClass: Q }]
888
+ ].forEach((i) => this._injector.add(i));
917
889
  }
918
890
  onRendered() {
919
- this._injector.get(FindReplaceController);
891
+ this._injector.get(w);
920
892
  }
921
- }, __name(_a4, "UniverFindReplacePlugin"), __publicField(_a4, "pluginName", PLUGIN_NAME), _a4);
922
- UniverFindReplacePlugin = __decorateClass([
923
- __decorateParam(1, Inject(Injector)),
924
- __decorateParam(2, IConfigService)
925
- ], UniverFindReplacePlugin);
893
+ }, o(H, "pluginName", xi), H);
894
+ fe = bi([
895
+ ue(1, y(X)),
896
+ ue(2, ft)
897
+ ], fe);
926
898
  export {
927
- FindBy,
928
- FindDirection,
929
- FindModel,
930
- FindReplaceController,
931
- FindScope,
932
- GoToNextMatchOperation,
933
- GoToPreviousMatchOperation,
934
- IFindReplaceService,
935
- OpenFindDialogOperation,
936
- OpenReplaceDialogOperation,
937
- ReplaceAllMatchesCommand,
938
- ReplaceCurrentMatchCommand,
939
- UniverFindReplacePlugin
899
+ Z as FindBy,
900
+ Y as FindDirection,
901
+ Ei as FindModel,
902
+ w as FindReplaceController,
903
+ J as FindScope,
904
+ Te as GoToNextMatchOperation,
905
+ Ee as GoToPreviousMatchOperation,
906
+ g as IFindReplaceService,
907
+ F as OpenFindDialogOperation,
908
+ re as OpenReplaceDialogOperation,
909
+ Oe as ReplaceAllMatchesCommand,
910
+ Pe as ReplaceCurrentMatchCommand,
911
+ fe as UniverFindReplacePlugin
940
912
  };