@univerjs/find-replace 0.3.0-alpha.0 → 0.3.0-nightly.202410101606

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,943 +1 @@
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, OnLifecycle, LifecycleStages, 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 { RENDER_RAW_FORMULA_KEY } from "@univerjs/engine-render";
9
- import require$$0, { forwardRef, useRef, createElement, useCallback, Fragment, useEffect, useMemo, useImperativeHandle } from "react";
10
- import { MessageType, InputWithSlot, Pager, Button, FormLayout, Input, Select, FormDualColumnLayout, Checkbox } from "@univerjs/design";
11
- var __assign = function() {
12
- return __assign = Object.assign || function(t) {
13
- for (var s, i = 1, n2 = arguments.length; i < n2; i++) {
14
- s = arguments[i];
15
- for (var p2 in s) Object.prototype.hasOwnProperty.call(s, p2) && (t[p2] = s[p2]);
16
- }
17
- return t;
18
- }, __assign.apply(this, arguments);
19
- }, __rest = function(s, e) {
20
- var t = {};
21
- for (var p2 in s) Object.prototype.hasOwnProperty.call(s, p2) && e.indexOf(p2) < 0 && (t[p2] = s[p2]);
22
- if (s != null && typeof Object.getOwnPropertySymbols == "function")
23
- for (var i = 0, p2 = Object.getOwnPropertySymbols(s); i < p2.length; i++)
24
- e.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p2[i]) && (t[p2[i]] = s[p2[i]]);
25
- return t;
26
- }, IconBase = forwardRef(function(props, ref) {
27
- 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()));
28
- return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
29
- });
30
- function render(node, id, runtimeProps, rootProps, extend) {
31
- return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
32
- return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
33
- }));
34
- }
35
- __name(render, "render");
36
- function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
37
- var attrs = __assign({}, node.attrs);
38
- extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
39
- var defIds = runtimeProps.defIds;
40
- 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) {
41
- var key = _a5[0], value = _a5[1];
42
- typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
43
- })), attrs;
44
- }
45
- __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
46
- function replaceRuntimeIdsInDefs(node, runtimeProps) {
47
- var _a5, defIds = runtimeProps.defIds;
48
- 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) {
49
- 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;
50
- }) }) : node;
51
- }
52
- __name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
53
- function generateShortUuid() {
54
- return Math.random().toString(36).substring(2, 8);
55
- }
56
- __name(generateShortUuid, "generateShortUuid");
57
- IconBase.displayName = "UniverIcon";
58
- 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) {
59
- return createElement(IconBase, Object.assign({}, props, {
60
- id: "search-single-16",
61
- ref,
62
- icon: element
63
- }));
64
- });
65
- SearchSingle16.displayName = "SearchSingle16";
66
- 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";
67
- var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
68
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
69
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
70
- return kind && result && __defProp$2(target, key, result), result;
71
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2");
72
- const _FindModel = class _FindModel extends Disposable {
73
- };
74
- __name(_FindModel, "FindModel");
75
- let FindModel = _FindModel;
76
- const IFindReplaceService = createIdentifier("find-replace.service");
77
- function shouldStateUpdateTriggerResearch(statusUpdate) {
78
- 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";
79
- }
80
- __name(shouldStateUpdateTriggerResearch, "shouldStateUpdateTriggerResearch");
81
- var _a;
82
- let FindReplaceModel = (_a = class extends Disposable {
83
- constructor(_state, _providers, _univerInstanceService) {
84
- super();
85
- __publicField(this, "currentMatch$", new BehaviorSubject(null));
86
- __publicField(this, "replaceables$", new BehaviorSubject([]));
87
- /** All find models returned by providers. */
88
- __publicField(this, "_findModels", []);
89
- /** The find model that the current match is from. */
90
- __publicField(this, "_matchingModel", null);
91
- __publicField(this, "_matches", []);
92
- __publicField(this, "_currentSearchingDisposables", null);
93
- this._state = _state, this._providers = _providers, this._univerInstanceService = _univerInstanceService, this.disposeWithMe(
94
- this._state.stateUpdates$.pipe(throttleTime(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (stateUpdate) => {
95
- const state = this._state.state;
96
- shouldStateUpdateTriggerResearch(stateUpdate) && (state.findString !== "" && !state.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : stateUpdate.replaceRevealed !== !0 && this._stopSearching());
97
- })
98
- );
99
- }
100
- get searched() {
101
- return this._findModels.length > 0;
102
- }
103
- dispose() {
104
- super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...createInitFindReplaceState(), revealed: !1 });
105
- }
106
- async start() {
107
- if (!this._state.findString)
108
- return { results: [] };
109
- const complete = await this._startSearching();
110
- return this._state.changeState({ findCompleted: !0 }), complete;
111
- }
112
- /** Call this method to start a `searching`. */
113
- async _startSearching() {
114
- if (!this._state.findString)
115
- return { results: [] };
116
- const providers = Array.from(this._providers), findModels = this._findModels = (await Promise.all(providers.map((provider) => provider.find({
117
- findString: this._state.findString,
118
- findDirection: this._state.findDirection,
119
- findScope: this._state.findScope,
120
- findBy: this._state.findBy,
121
- replaceRevealed: this._state.replaceRevealed,
122
- caseSensitive: this._state.caseSensitive,
123
- matchesTheWholeCell: this._state.matchesTheWholeCell
124
- })))).flat();
125
- this._subscribeToModelsChanges(findModels);
126
- const newMatches = this._matches = findModels.map((c) => c.getMatches()).flat();
127
- 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: [] });
128
- }
129
- /** Terminate the current searching session, when searching string is empty. */
130
- _stopSearching() {
131
- var _a5;
132
- 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({
133
- findCompleted: !1,
134
- matchesCount: 0,
135
- matchesPosition: 0
136
- });
137
- }
138
- // When a document's content changes, we should reset all matches and try to move to the next match.
139
- _subscribeToModelsChanges(models) {
140
- const disposables = this._currentSearchingDisposables = new DisposableCollection(), matchesUpdateSubscription = combineLatest(models.map((model) => model.matchesUpdate$)).pipe(debounceTime(220)).subscribe(([...allMatches]) => {
141
- const newMatches = this._matches = allMatches.flat();
142
- 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([]));
143
- });
144
- models.forEach((model) => disposables.add(toDisposable(model.activelyChangingMatch$.subscribe((match) => {
145
- const index = this._matches.findIndex((m2) => m2 === match);
146
- this._state.changeState({ matchesPosition: index + 1 });
147
- })))), disposables.add(toDisposable(matchesUpdateSubscription));
148
- }
149
- async replace() {
150
- return this._matchingModel ? this._matchingModel.replace(this._state.replaceString) : !1;
151
- }
152
- async replaceAll() {
153
- 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 }));
154
- return result.failure === 0 && this._stopSearching(), result;
155
- }
156
- getCurrentMatch() {
157
- return this._state.matchesPosition > 0 ? this._matches[this._state.matchesPosition - 1] : null;
158
- }
159
- _markMatch(match) {
160
- const index = this._matches.findIndex((value) => value === match);
161
- this.currentMatch$.next(match), this._state.changeState({ matchesPosition: index + 1 });
162
- }
163
- moveToNextMatch() {
164
- if (!this._matchingModel)
165
- return;
166
- const loopInCurrentUnit = this._findModels.length === 1, nextMatch = this._matchingModel.moveToNextMatch({ loop: loopInCurrentUnit });
167
- if (nextMatch)
168
- this._markMatch(nextMatch);
169
- else {
170
- const currentModelIndex = this._findModels.findIndex((m2) => m2 === this._matchingModel);
171
- this._moveToNextUnitMatch(currentModelIndex);
172
- }
173
- }
174
- _moveToNextUnitMatch(startingIndex) {
175
- const l2 = this._findModels.length;
176
- for (let i = (startingIndex + 1) % l2; i !== startingIndex; ) {
177
- const nextPositionModel = this._findModels[i], nextMatch = nextPositionModel.moveToNextMatch({ ignoreSelection: !0 });
178
- if (nextMatch) {
179
- this._matchingModel = nextPositionModel, this._markMatch(nextMatch);
180
- return;
181
- }
182
- i = (i + 1) % l2;
183
- }
184
- if (this._matchingModel) {
185
- const nextMatch = this._matchingModel.moveToNextMatch({ ignoreSelection: !0 });
186
- nextMatch && this._markMatch(nextMatch);
187
- }
188
- }
189
- moveToPreviousMatch() {
190
- if (!this._matchingModel)
191
- return;
192
- const loopInCurrentUnit = this._findModels.length === 1, nextMatch = this._matchingModel.moveToPreviousMatch({ loop: loopInCurrentUnit });
193
- if (nextMatch) {
194
- const index = this._matches.findIndex((value) => value === nextMatch);
195
- this.currentMatch$.next(nextMatch), this._state.changeState({ matchesPosition: index + 1 });
196
- } else {
197
- const l2 = this._findModels.length, currentModelIndex = this._findModels.findIndex((m2) => m2 === this._matchingModel);
198
- for (let i = (currentModelIndex - 1 + l2) % l2; i !== currentModelIndex; ) {
199
- const nextPositionModel = this._findModels[i], nextMatch3 = nextPositionModel.moveToPreviousMatch({ ignoreSelection: !0 });
200
- if (nextMatch3) {
201
- this._matchingModel = nextPositionModel, this._markMatch(nextMatch3);
202
- return;
203
- }
204
- i = (i - 1) % l2;
205
- }
206
- const nextMatch2 = this._matchingModel.moveToPreviousMatch({ ignoreSelection: !0 });
207
- nextMatch2 && this._markMatch(nextMatch2);
208
- }
209
- }
210
- _moveToInitialMatch(findModels, noFocus = !1) {
211
- var _a5;
212
- const focusedUnitId = (_a5 = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : _a5.getUnitId();
213
- if (!focusedUnitId)
214
- return -1;
215
- const i = findModels.findIndex((model) => model.unitId === focusedUnitId);
216
- if (i !== -1) {
217
- this._matchingModel = findModels[i];
218
- const nextMatch = this._matchingModel.moveToNextMatch({ stayIfOnMatch: !0, noFocus });
219
- if (nextMatch)
220
- return this._markMatch(nextMatch), i;
221
- }
222
- return this._moveToNextUnitMatch(i), 0;
223
- }
224
- }, __name(_a, "FindReplaceModel"), _a);
225
- FindReplaceModel = __decorateClass$2([
226
- __decorateParam$2(2, IUniverInstanceService)
227
- ], FindReplaceModel);
228
- 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 || {});
229
- function createInitFindReplaceState() {
230
- return {
231
- caseSensitive: !1,
232
- findBy: "value",
233
- findCompleted: !1,
234
- findDirection: "row",
235
- findScope: "subunit",
236
- findString: "",
237
- inputtingFindString: "",
238
- matchesCount: 0,
239
- matchesPosition: 0,
240
- matchesTheWholeCell: !1,
241
- replaceRevealed: !1,
242
- replaceString: "",
243
- revealed: !0
244
- };
245
- }
246
- __name(createInitFindReplaceState, "createInitFindReplaceState");
247
- const _FindReplaceState = class _FindReplaceState {
248
- constructor() {
249
- __publicField(this, "_stateUpdates$", new Subject());
250
- __publicField(this, "stateUpdates$", this._stateUpdates$.asObservable());
251
- __publicField(this, "_state$", new BehaviorSubject(createInitFindReplaceState()));
252
- __publicField(this, "state$", this._state$.asObservable());
253
- __publicField(this, "_findString", "");
254
- __publicField(this, "_inputtingFindString", "");
255
- __publicField(this, "_replaceString", "");
256
- __publicField(this, "_revealed", !1);
257
- __publicField(this, "_replaceRevealed", !1);
258
- __publicField(this, "_matchesPosition", 0);
259
- __publicField(this, "_matchesCount", 0);
260
- __publicField(this, "_caseSensitive", !0);
261
- __publicField(this, "_matchesTheWholeCell", !1);
262
- __publicField(this, "_findDirection", "row");
263
- __publicField(this, "_findScope", "subunit");
264
- __publicField(this, "_findBy", "value");
265
- __publicField(this, "_findCompleted", !1);
266
- }
267
- get state() {
268
- return this._state$.getValue();
269
- }
270
- get inputtingFindString() {
271
- return this._inputtingFindString;
272
- }
273
- get findString() {
274
- return this._findString;
275
- }
276
- get revealed() {
277
- return this._revealed;
278
- }
279
- get replaceRevealed() {
280
- return this._replaceRevealed;
281
- }
282
- get matchesPosition() {
283
- return this._matchesPosition;
284
- }
285
- get matchesCount() {
286
- return this._matchesCount;
287
- }
288
- get replaceString() {
289
- return this._replaceString;
290
- }
291
- get caseSensitive() {
292
- return this._caseSensitive;
293
- }
294
- get matchesTheWholeCell() {
295
- return this._matchesTheWholeCell;
296
- }
297
- get findDirection() {
298
- return this._findDirection;
299
- }
300
- get findScope() {
301
- return this._findScope;
302
- }
303
- get findBy() {
304
- return this._findBy;
305
- }
306
- get findCompleted() {
307
- return this._findCompleted;
308
- }
309
- // eslint-disable-next-line max-lines-per-function, complexity
310
- changeState(changes) {
311
- let changed = !1;
312
- const changedState = {};
313
- 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({
314
- caseSensitive: this._caseSensitive,
315
- findBy: this._findBy,
316
- findCompleted: this._findCompleted,
317
- findDirection: this._findDirection,
318
- findScope: this._findScope,
319
- findString: this._findString,
320
- inputtingFindString: this._inputtingFindString,
321
- matchesCount: this._matchesCount,
322
- matchesPosition: this._matchesPosition,
323
- matchesTheWholeCell: this._matchesTheWholeCell,
324
- replaceRevealed: this._replaceRevealed,
325
- revealed: this._revealed
326
- }), this._stateUpdates$.next(changedState));
327
- }
328
- };
329
- __name(_FindReplaceState, "FindReplaceState");
330
- let FindReplaceState = _FindReplaceState;
331
- var _a2;
332
- let FindReplaceService = (_a2 = class extends Disposable {
333
- constructor(_injector, _contextService) {
334
- super();
335
- __publicField(this, "_providers", /* @__PURE__ */ new Set());
336
- __publicField(this, "_state", new FindReplaceState());
337
- __publicField(this, "_model");
338
- __publicField(this, "_currentMatch$", new BehaviorSubject(null));
339
- __publicField(this, "currentMatch$", this._currentMatch$.asObservable());
340
- __publicField(this, "_replaceables$", new BehaviorSubject([]));
341
- __publicField(this, "replaceables$", this._replaceables$.asObservable());
342
- __publicField(this, "_focusSignal$", new Subject());
343
- __publicField(this, "focusSignal$", this._focusSignal$.asObservable());
344
- this._injector = _injector, this._contextService = _contextService;
345
- }
346
- get stateUpdates$() {
347
- return this._state.stateUpdates$;
348
- }
349
- get state$() {
350
- return this._state.state$;
351
- }
352
- get revealed() {
353
- return this._state.revealed;
354
- }
355
- get replaceRevealed() {
356
- return this._state.replaceRevealed;
357
- }
358
- dispose() {
359
- super.dispose(), this._currentMatch$.next(null), this._currentMatch$.complete(), this._replaceables$.next([]), this._replaceables$.complete(), this._focusSignal$.complete();
360
- }
361
- getCurrentMatch() {
362
- var _a5;
363
- return (_a5 = this._model) == null ? void 0 : _a5.getCurrentMatch();
364
- }
365
- getFindString() {
366
- return this._state.findString;
367
- }
368
- changeFindString(findString) {
369
- this._state.changeState({ findString });
370
- }
371
- focusFindInput() {
372
- this._focusSignal$.next();
373
- }
374
- changeInputtingFindString(value) {
375
- value ? this._state.changeState({ inputtingFindString: value }) : this._state.changeState({ inputtingFindString: "", findString: "" });
376
- }
377
- changeReplaceString(replaceString) {
378
- this._state.changeState({ replaceString });
379
- }
380
- changeMatchesTheWholeCell(matchesTheWholeCell) {
381
- this._state.changeState({ matchesTheWholeCell });
382
- }
383
- changeCaseSensitive(caseSensitive) {
384
- this._state.changeState({ caseSensitive });
385
- }
386
- changeFindBy(findBy) {
387
- this._state.changeState({ findBy }), this._toggleDisplayRawFormula(
388
- findBy === "formula"
389
- /* FORMULA */
390
- );
391
- }
392
- changeFindScope(scope) {
393
- this._state.changeState({ findScope: scope });
394
- }
395
- changeFindDirection(direction) {
396
- this._state.changeState({ findDirection: direction });
397
- }
398
- moveToNextMatch() {
399
- this._model && (this._state.replaceRevealed && !this._model.searched ? (this._state.changeState({ findString: this._state.inputtingFindString }), this._model.start()) : this._model.moveToNextMatch(), this._focusSignal$.next());
400
- }
401
- moveToPreviousMatch() {
402
- this._model && (this._state.replaceRevealed && !this._model.searched ? (this._state.changeState({ findString: this._state.inputtingFindString }), this._model.start()) : this._model.moveToPreviousMatch(), this._focusSignal$.next());
403
- }
404
- async replace() {
405
- return this._model ? this._model.replace() : !1;
406
- }
407
- async replaceAll() {
408
- if (!this._model)
409
- throw new Error("[FindReplaceService] replaceAll: model is not initialized!");
410
- return this._model.replaceAll();
411
- }
412
- revealReplace() {
413
- this._state.changeState({ replaceRevealed: !0, inputtingFindString: this._state.findString }), this._toggleRevealReplace(!0);
414
- }
415
- start(revealReplace = !1) {
416
- if (this._providers.size === 0)
417
- return !1;
418
- 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));
419
- const newState = createInitFindReplaceState();
420
- return revealReplace && (newState.replaceRevealed = !0), this._state.changeState(newState), this._toggleRevealReplace(revealReplace), !0;
421
- }
422
- find() {
423
- var _a5;
424
- (_a5 = this._model) == null || _a5.start();
425
- }
426
- terminate() {
427
- var _a5;
428
- (_a5 = this._model) == null || _a5.dispose(), this._model = null, this._toggleDisplayRawFormula(!1), this._toggleRevealReplace(!1);
429
- }
430
- registerFindReplaceProvider(provider) {
431
- return this._providers.add(provider), toDisposable(() => this._providers.delete(provider));
432
- }
433
- _toggleRevealReplace(revealReplace) {
434
- this._contextService.setContextValue(FIND_REPLACE_REPLACE_REVEALED, revealReplace);
435
- }
436
- _toggleDisplayRawFormula(force) {
437
- this._contextService.setContextValue(RENDER_RAW_FORMULA_KEY, force);
438
- }
439
- }, __name(_a2, "FindReplaceService"), _a2);
440
- FindReplaceService = __decorateClass$2([
441
- __decorateParam$2(0, Inject(Injector)),
442
- __decorateParam$2(1, IContextService)
443
- ], FindReplaceService);
444
- const OpenFindDialogOperation = {
445
- id: "ui.operation.open-find-dialog",
446
- type: CommandType.OPERATION,
447
- handler: /* @__PURE__ */ __name((accessor) => {
448
- const findReplaceService = accessor.get(IFindReplaceService);
449
- return findReplaceService.revealed ? findReplaceService.focusFindInput() : findReplaceService.start(), !0;
450
- }, "handler")
451
- }, OpenReplaceDialogOperation = {
452
- id: "ui.operation.open-replace-dialog",
453
- type: CommandType.OPERATION,
454
- handler: /* @__PURE__ */ __name((accessor) => {
455
- const findReplaceService = accessor.get(IFindReplaceService);
456
- return findReplaceService.revealed ? findReplaceService.replaceRevealed ? findReplaceService.focusFindInput() : findReplaceService.revealReplace() : findReplaceService.start(!0), !0;
457
- }, "handler")
458
- }, GoToNextMatchOperation = {
459
- type: CommandType.OPERATION,
460
- id: "ui.operation.go-to-next-match",
461
- handler: /* @__PURE__ */ __name((accessor) => (accessor.get(IFindReplaceService).moveToNextMatch(), !0), "handler")
462
- }, GoToPreviousMatchOperation = {
463
- type: CommandType.OPERATION,
464
- id: "ui.operation.go-to-previous-match",
465
- handler: /* @__PURE__ */ __name((accessor) => (accessor.get(IFindReplaceService).moveToPreviousMatch(), !0), "handler")
466
- };
467
- var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
468
- /**
469
- * @license React
470
- * react-jsx-runtime.production.min.js
471
- *
472
- * Copyright (c) Facebook, Inc. and its affiliates.
473
- *
474
- * This source code is licensed under the MIT license found in the
475
- * LICENSE file in the root directory of this source tree.
476
- */
477
- 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 };
478
- function q(c, a, g) {
479
- var b, d = {}, e = null, h = null;
480
- g !== void 0 && (e = "" + g), a.key !== void 0 && (e = "" + a.key), a.ref !== void 0 && (h = a.ref);
481
- for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
482
- if (c && c.defaultProps) for (b in a = c.defaultProps, a) d[b] === void 0 && (d[b] = a[b]);
483
- return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
484
- }
485
- __name(q, "q");
486
- reactJsxRuntime_production_min.Fragment = l;
487
- reactJsxRuntime_production_min.jsx = q;
488
- reactJsxRuntime_production_min.jsxs = q;
489
- jsxRuntime.exports = reactJsxRuntime_production_min;
490
- var jsxRuntimeExports = jsxRuntime.exports;
491
- const ReplaceCurrentMatchCommand = {
492
- id: "ui.command.replace-current-match",
493
- type: CommandType.COMMAND,
494
- handler: /* @__PURE__ */ __name((accessor) => accessor.get(IFindReplaceService).replace(), "handler")
495
- }, CONFIRM_REPLACE_ALL_ID = "CONFIRM_REPLACE_ALL", ReplaceAllMatchesCommand = {
496
- id: "ui.command.replace-all-matches",
497
- type: CommandType.COMMAND,
498
- handler: /* @__PURE__ */ __name(async (accessor) => {
499
- const confirmService = accessor.get(IConfirmService), localeService = accessor.get(LocaleService), messageService = accessor.get(IMessageService);
500
- if (!await confirmService.confirm({
501
- id: CONFIRM_REPLACE_ALL_ID,
502
- title: { title: localeService.t("find-replace.replace.confirm.title") },
503
- cancelText: localeService.t("button.cancel"),
504
- confirmText: localeService.t("button.confirm")
505
- }))
506
- return !1;
507
- const result = await accessor.get(IFindReplaceService).replaceAll(), { success, failure } = result;
508
- return failure > 0 ? (success === 0 ? messageService.show({
509
- type: MessageType.Error,
510
- content: localeService.t("find-replace.replace.all-failure")
511
- }) : messageService.show({
512
- type: MessageType.Warning,
513
- content: localeService.t("find-replace.replace.partial-success", `${success}`, `${failure}`)
514
- }), !1) : (messageService.show({
515
- type: MessageType.Success,
516
- content: localeService.t("find-replace.replace.all-success", `${success}`)
517
- }), !0);
518
- }, "handler")
519
- };
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,
524
- {
525
- autoFocus: !0,
526
- placeholder: localeService.t("find-replace.dialog.find-placeholder"),
527
- slot: /* @__PURE__ */ jsxRuntimeExports.jsx(
528
- Pager,
529
- {
530
- 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")
537
- }
538
- ),
539
- value: findString,
540
- onChange: /* @__PURE__ */ __name((value) => onChange == null ? void 0 : onChange(value), "onChange"),
541
- ...rest
542
- }
543
- );
544
- }
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
552
- };
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);
560
- }, []);
561
- return useImperativeHandle(ref, () => ({ focus, selectHasFocus })), useEffect(() => {
562
- const subscription = findReplaceService.focusSignal$.subscribe(() => focus());
563
- return () => subscription.unsubscribe();
564
- }, [findReplaceService, focus]), { focus, selectHasFocus };
565
- }
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,
574
- {
575
- findCompleted,
576
- className: "univer-find-input",
577
- matchesCount,
578
- matchesPosition,
579
- findReplaceService,
580
- localeService,
581
- findString,
582
- onChange: onFindStringChange
583
- }
584
- ),
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") }) })
586
- ] });
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,
623
- 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,
628
- {
629
- findCompleted,
630
- className: "univer-find-input",
631
- matchesCount,
632
- matchesPosition,
633
- findReplaceService,
634
- localeService,
635
- findString: inputtingFindString,
636
- onChange: onFindStringChange
637
- }
638
- ) }),
639
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("find-replace.dialog.replace"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
640
- Input,
641
- {
642
- placeholder: localeService.t("find-replace.dialog.replace-placeholder"),
643
- value: replaceString,
644
- onChange: /* @__PURE__ */ __name((value) => onReplaceStringChange(value), "onChange")
645
- }
646
- ) }),
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 }) })
651
- ] }) }),
652
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormDualColumnLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
653
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
654
- Checkbox,
655
- {
656
- checked: caseSensitive,
657
- onChange: /* @__PURE__ */ __name((checked) => {
658
- findReplaceService.changeCaseSensitive(checked);
659
- }, "onChange"),
660
- children: localeService.t("find-replace.dialog.case-sensitive")
661
- }
662
- ) }),
663
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
664
- Checkbox,
665
- {
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")
671
- }
672
- ) })
673
- ] }) }),
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") })
679
- ] })
680
- ] })
681
- ] });
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]
695
- );
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);
701
- });
702
- return (_a5 = focusRef.current) == null || _a5.focus(), setDialogContainerFocus(!0), setDialogInputFocus(!0), () => {
703
- focusSubscription.unsubscribe(), setDialogContainerFocus(!1);
704
- };
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 }) });
706
- }
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]);
714
- }
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]);
722
- }
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]);
730
- }
731
- __name(useFindByOptions, "useFindByOptions");
732
- function whenFindReplaceDialogFocused(contextService) {
733
- return contextService.getContextValue(FIND_REPLACE_DIALOG_FOCUS);
734
- }
735
- __name(whenFindReplaceDialogFocused, "whenFindReplaceDialogFocused");
736
- function whenReplaceRevealed(contextService) {
737
- return contextService.getContextValue(FIND_REPLACE_REPLACE_REVEALED);
738
- }
739
- __name(whenReplaceRevealed, "whenReplaceRevealed");
740
- function whenFindReplaceInputFocused(contextService) {
741
- return contextService.getContextValue(FIND_REPLACE_INPUT_FOCUS);
742
- }
743
- __name(whenFindReplaceInputFocused, "whenFindReplaceInputFocused");
744
- const FIND_REPLACE_SHORTCUT_GROUP = "7_find-replace-shortcuts";
745
- function whenSheetFocused(contextService) {
746
- return contextService.getContextValue(FOCUSING_SHEET);
747
- }
748
- __name(whenSheetFocused, "whenSheetFocused");
749
- function whenEditorNotActivated(contextService) {
750
- return !contextService.getContextValue(EDITOR_ACTIVATED);
751
- }
752
- __name(whenEditorNotActivated, "whenEditorNotActivated");
753
- const OpenFindDialogShortcutItem = {
754
- id: OpenFindDialogOperation.id,
755
- 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);
760
- }
761
- }, MacOpenFindDialogShortcutItem = {
762
- id: OpenFindDialogOperation.id,
763
- 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);
768
- }
769
- }, OpenReplaceDialogShortcutItem = {
770
- id: OpenReplaceDialogOperation.id,
771
- 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,
780
- description: "find-replace.shortcut.go-to-next-match",
781
- binding: KeyCode.ENTER,
782
- group: FIND_REPLACE_SHORTCUT_GROUP,
783
- priority: 1e3,
784
- preconditions(contextService) {
785
- return whenFindReplaceInputFocused(contextService) && whenFindReplaceDialogFocused(contextService);
786
- }
787
- }, GoToPreviousFindMatchShortcutItem = {
788
- id: GoToPreviousMatchOperation.id,
789
- description: "find-replace.shortcut.go-to-previous-match",
790
- binding: KeyCode.ENTER | MetaKeys.SHIFT,
791
- group: FIND_REPLACE_SHORTCUT_GROUP,
792
- priority: 1e3,
793
- preconditions(contextService) {
794
- return whenFindReplaceInputFocused(contextService) && whenFindReplaceDialogFocused(contextService);
795
- }
796
- };
797
- function FindReplaceMenuItemFactory(accessor) {
798
- const contextService = accessor.get(IContextService);
799
- return {
800
- id: OpenFindDialogOperation.id,
801
- icon: "SearchIcon",
802
- 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))
809
- };
810
- }
811
- __name(FindReplaceMenuItemFactory, "FindReplaceMenuItemFactory");
812
- const menuSchema = {
813
- [RibbonStartGroup.OTHERS]: {
814
- [OpenFindDialogOperation.id]: {
815
- order: 2,
816
- menuItemFactory: FindReplaceMenuItemFactory
817
- }
818
- }
819
- };
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) {
829
- 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();
832
- }
833
- dispose() {
834
- var _a5;
835
- super.dispose(), (_a5 = this._closingListenerDisposable) == null || _a5.dispose(), this._closingListenerDisposable = null;
836
- }
837
- _initCommands() {
838
- [
839
- OpenFindDialogOperation,
840
- OpenReplaceDialogOperation,
841
- GoToNextMatchOperation,
842
- GoToPreviousMatchOperation,
843
- ReplaceAllMatchesCommand,
844
- ReplaceCurrentMatchCommand
845
- ].forEach((c) => {
846
- this.disposeWithMe(this._commandService.registerCommand(c));
847
- });
848
- }
849
- _initShortcuts() {
850
- [
851
- OpenReplaceDialogShortcutItem,
852
- OpenFindDialogShortcutItem,
853
- MacOpenFindDialogShortcutItem,
854
- GoToPreviousFindMatchShortcutItem,
855
- GoToNextFindMatchShortcutItem
856
- ].forEach((s) => this.disposeWithMe(this._shortcutService.registerShortcut(s)));
857
- }
858
- _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();
861
- });
862
- }
863
- _openPanel() {
864
- this._dialogService.open({
865
- id: FIND_REPLACE_DIALOG_ID,
866
- draggable: !0,
867
- width: FIND_REPLACE_PANEL_WIDTH,
868
- title: { title: this._localeService.t("find-replace.dialog.title") },
869
- children: { label: "FindReplaceDialog" },
870
- destroyOnClose: !0,
871
- defaultPosition: getFindReplaceDialogDefaultPosition(),
872
- 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();
876
- }));
877
- }
878
- 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
- OnLifecycle(LifecycleStages.Rendered, FindReplaceController),
884
- __decorateParam$1(0, IUniverInstanceService),
885
- __decorateParam$1(1, IMenuManagerService),
886
- __decorateParam$1(2, IShortcutService),
887
- __decorateParam$1(3, ICommandService),
888
- __decorateParam$1(4, IFindReplaceService),
889
- __decorateParam$1(5, IDialogService),
890
- __decorateParam$1(6, ILayoutService),
891
- __decorateParam$1(7, Inject(LocaleService)),
892
- __decorateParam$1(8, Inject(ComponentManager)),
893
- __decorateParam$1(9, Inject(Injector))
894
- ], FindReplaceController);
895
- function getFindReplaceDialogDefaultPosition() {
896
- const { innerWidth } = window;
897
- return { x: (innerWidth - FIND_REPLACE_PANEL_WIDTH) / 2 - FIND_REPLACE_PANEL_RIGHT_PADDING, y: FIND_REPLACE_PANEL_TOP_PADDING };
898
- }
899
- __name(getFindReplaceDialogDefaultPosition, "getFindReplaceDialogDefaultPosition");
900
- const PLUGIN_CONFIG_KEY = "find-replace.config", defaultPluginConfig = {};
901
- var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
902
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
903
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
904
- return kind && result && __defProp2(target, key, result), result;
905
- }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
906
- const PLUGIN_NAME = "UNIVER_FIND_REPLACE_PLUGIN";
907
- var _a4;
908
- let UniverFindReplacePlugin = (_a4 = class extends Plugin {
909
- constructor(_config = defaultPluginConfig, _injector, _configService) {
910
- super(), this._config = _config, this._injector = _injector, this._configService = _configService;
911
- const { ...rest } = this._config;
912
- this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
913
- }
914
- onStarting() {
915
- [
916
- [FindReplaceController],
917
- [IFindReplaceService, { useClass: FindReplaceService }]
918
- ].forEach(
919
- (d) => {
920
- this._injector.add(d);
921
- }
922
- );
923
- }
924
- }, __name(_a4, "UniverFindReplacePlugin"), __publicField(_a4, "pluginName", PLUGIN_NAME), _a4);
925
- UniverFindReplacePlugin = __decorateClass([
926
- __decorateParam(1, Inject(Injector)),
927
- __decorateParam(2, IConfigService)
928
- ], UniverFindReplacePlugin);
929
- export {
930
- FindBy,
931
- FindDirection,
932
- FindModel,
933
- FindReplaceController,
934
- FindScope,
935
- GoToNextMatchOperation,
936
- GoToPreviousMatchOperation,
937
- IFindReplaceService,
938
- OpenFindDialogOperation,
939
- OpenReplaceDialogOperation,
940
- ReplaceAllMatchesCommand,
941
- ReplaceCurrentMatchCommand,
942
- UniverFindReplacePlugin
943
- };
1
+ const _0x26ca9a=_0x4549;(function(_0x5bf82d,_0x5bd090){const _0xaee348=_0x4549,_0x1850d8=_0x5bf82d();while(!![]){try{const _0x32ff81=parseInt(_0xaee348(0x157))/0x1+-parseInt(_0xaee348(0xed))/0x2*(parseInt(_0xaee348(0xab))/0x3)+-parseInt(_0xaee348(0x109))/0x4+-parseInt(_0xaee348(0x78))/0x5*(parseInt(_0xaee348(0xec))/0x6)+-parseInt(_0xaee348(0x83))/0x7*(parseInt(_0xaee348(0x136))/0x8)+parseInt(_0xaee348(0xd1))/0x9*(parseInt(_0xaee348(0x19b))/0xa)+parseInt(_0xaee348(0x153))/0xb;if(_0x32ff81===_0x5bd090)break;else _0x1850d8['push'](_0x1850d8['shift']());}catch(_0x1cf4d9){_0x1850d8['push'](_0x1850d8['shift']());}}}(_0xbfbf,0x279ad));var __defProp=Object[_0x26ca9a(0x14e)],__defNormalProp=(_0x175722,_0x592f39,_0x38a68a)=>_0x592f39 in _0x175722?__defProp(_0x175722,_0x592f39,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x38a68a}):_0x175722[_0x592f39]=_0x38a68a,__name=(_0x4cae4e,_0x48090c)=>__defProp(_0x4cae4e,_0x26ca9a(0xe8),{'value':_0x48090c,'configurable':!0x0}),__publicField=(_0x563439,_0x3052c6,_0x23216d)=>__defNormalProp(_0x563439,typeof _0x3052c6!='symbol'?_0x3052c6+'':_0x3052c6,_0x23216d);import{createIdentifier,Inject,Injector,Disposable,IUniverInstanceService,IContextService,DisposableCollection,toDisposable,CommandType,LocaleService,useDependency,ICommandService,FOCUSING_SHEET,EDITOR_ACTIVATED,UniverInstanceType,RxDisposable,Plugin,IConfigService}from'@univerjs/core';import{IConfirmService,IMessageService,useObservable,ILayoutService,KeyCode,MetaKeys,MenuItemType,getMenuHiddenObservable,RibbonStartGroup,ComponentManager,IMenuManagerService,IShortcutService,IDialogService}from'@univerjs/ui';import{throttleTime,BehaviorSubject,combineLatest,debounceTime,Subject,fromEvent,map,takeUntil}from'rxjs';import{MessageType,InputWithSlot,Pager,Button,FormLayout,Input,Select,FormDualColumnLayout,Checkbox}from'@univerjs/design';import{RENDER_RAW_FORMULA_KEY}from'@univerjs/engine-render';import _0x578624,{forwardRef,useRef,createElement,useCallback,Fragment,useEffect,useMemo,useImperativeHandle}from'react';const PLUGIN_CONFIG_KEY='find-replace.config',defaultPluginConfig={};var __assign=function(){const _0x24d15f=_0x26ca9a;return __assign=Object[_0x24d15f(0x104)]||function(_0x5f0dd6){const _0x3af626=_0x24d15f;for(var _0x39082b,_0xf14fd3=0x1,_0xfbd8a=arguments[_0x3af626(0x19f)];_0xf14fd3<_0xfbd8a;_0xf14fd3++){_0x39082b=arguments[_0xf14fd3];for(var _0x39ae21 in _0x39082b)Object[_0x3af626(0x161)][_0x3af626(0xcc)][_0x3af626(0x132)](_0x39082b,_0x39ae21)&&(_0x5f0dd6[_0x39ae21]=_0x39082b[_0x39ae21]);}return _0x5f0dd6;},__assign[_0x24d15f(0xde)](this,arguments);},__rest=function(_0x5f072c,_0x196c5e){const _0x8abd54=_0x26ca9a;var _0x2976f3={};for(var _0x4e7b79 in _0x5f072c)Object[_0x8abd54(0x161)][_0x8abd54(0xcc)][_0x8abd54(0x132)](_0x5f072c,_0x4e7b79)&&_0x196c5e[_0x8abd54(0xb4)](_0x4e7b79)<0x0&&(_0x2976f3[_0x4e7b79]=_0x5f072c[_0x4e7b79]);if(_0x5f072c!=null&&typeof Object[_0x8abd54(0x18d)]=='function'){for(var _0x5809f8=0x0,_0x4e7b79=Object[_0x8abd54(0x18d)](_0x5f072c);_0x5809f8<_0x4e7b79[_0x8abd54(0x19f)];_0x5809f8++)_0x196c5e['indexOf'](_0x4e7b79[_0x5809f8])<0x0&&Object[_0x8abd54(0x161)][_0x8abd54(0x163)][_0x8abd54(0x132)](_0x5f072c,_0x4e7b79[_0x5809f8])&&(_0x2976f3[_0x4e7b79[_0x5809f8]]=_0x5f072c[_0x4e7b79[_0x5809f8]]);}return _0x2976f3;},IconBase=forwardRef(function(_0x519eab,_0x1303ef){const _0x2917bc=_0x26ca9a;var _0x3caf82=_0x519eab[_0x2917bc(0xe6)],_0x47b726=_0x519eab['id'],_0x325883=_0x519eab['className'],_0x13683f=_0x519eab['extend'],_0x5e3f51=__rest(_0x519eab,['icon','id',_0x2917bc(0x76),'extend']),_0x4116d5=_0x2917bc(0x13d)[_0x2917bc(0x146)](_0x47b726,'\x20')[_0x2917bc(0x146)](_0x325883||'')[_0x2917bc(0x72)](),_0xc9dd35=useRef('_'[_0x2917bc(0x146)](generateShortUuid()));return render(_0x3caf82,''[_0x2917bc(0x146)](_0x47b726),{'defIds':_0x3caf82[_0x2917bc(0x176)],'idSuffix':_0xc9dd35[_0x2917bc(0xdf)]},__assign({'ref':_0x1303ef,'className':_0x4116d5},_0x5e3f51),_0x13683f);});function render(_0x2da9de,_0x2afa9d,_0x4738cc,_0x43bd26,_0x5bdf0b){const _0x39c539=_0x26ca9a;return createElement(_0x2da9de['tag'],__assign(__assign({'key':_0x2afa9d},replaceRuntimeIdsAndExtInAttrs(_0x2da9de,_0x4738cc,_0x5bdf0b)),_0x43bd26),(replaceRuntimeIdsInDefs(_0x2da9de,_0x4738cc)['children']||[])[_0x39c539(0xcf)](function(_0x260037,_0x1ba470){const _0xeaa861=_0x39c539;return render(_0x260037,''[_0xeaa861(0x146)](_0x2afa9d,'-')[_0xeaa861(0x146)](_0x2da9de[_0xeaa861(0x7f)],'-')['concat'](_0x1ba470),_0x4738cc,void 0x0,_0x5bdf0b);}));}__name(render,_0x26ca9a(0x150));function replaceRuntimeIdsAndExtInAttrs(_0x44d602,_0x283a5a,_0x15c09d){const _0x3a379=_0x26ca9a;var _0x1374d8=__assign({},_0x44d602[_0x3a379(0x71)]);_0x15c09d!=null&&_0x15c09d[_0x3a379(0x14d)]&&_0x1374d8[_0x3a379(0x13a)]===_0x3a379(0x14d)&&(_0x1374d8['fill']=_0x15c09d[_0x3a379(0x14d)]);var _0x791c88=_0x283a5a[_0x3a379(0x176)];return!_0x791c88||_0x791c88[_0x3a379(0x19f)]===0x0||(_0x44d602['tag']===_0x3a379(0x1a4)&&_0x1374d8['xlink:href']&&(_0x1374d8[_0x3a379(0x11d)]=_0x1374d8[_0x3a379(0x11d)]+_0x283a5a[_0x3a379(0x1a3)]),Object['entries'](_0x1374d8)[_0x3a379(0x125)](function(_0x49c704){const _0x312d03=_0x3a379;var _0x28c5f1=_0x49c704[0x0],_0x1d6f1b=_0x49c704[0x1];typeof _0x1d6f1b==_0x312d03(0x159)&&(_0x1374d8[_0x28c5f1]=_0x1d6f1b['replace'](/url\(#(.*)\)/,_0x312d03(0x181)[_0x312d03(0x146)](_0x283a5a[_0x312d03(0x1a3)],')')));})),_0x1374d8;}__name(replaceRuntimeIdsAndExtInAttrs,'replaceRuntimeIdsAndExtInAttrs');function replaceRuntimeIdsInDefs(_0x3c71df,_0x20798a){const _0xf1cc72=_0x26ca9a;var _0x9643ed,_0x2b47d3=_0x20798a[_0xf1cc72(0x176)];return!_0x2b47d3||_0x2b47d3[_0xf1cc72(0x19f)]===0x0?_0x3c71df:_0x3c71df[_0xf1cc72(0x7f)]===_0xf1cc72(0x12c)&&(!((_0x9643ed=_0x3c71df[_0xf1cc72(0x175)])===null||_0x9643ed===void 0x0)&&_0x9643ed['length'])?__assign(__assign({},_0x3c71df),{'children':_0x3c71df[_0xf1cc72(0x175)]['map'](function(_0xaaa270){const _0xdbdd6=_0xf1cc72;return typeof _0xaaa270[_0xdbdd6(0x71)]['id']==_0xdbdd6(0x159)&&_0x2b47d3&&_0x2b47d3['indexOf'](_0xaaa270[_0xdbdd6(0x71)]['id'])>-0x1?__assign(__assign({},_0xaaa270),{'attrs':__assign(__assign({},_0xaaa270[_0xdbdd6(0x71)]),{'id':_0xaaa270[_0xdbdd6(0x71)]['id']+_0x20798a['idSuffix']})}):_0xaaa270;})}):_0x3c71df;}__name(replaceRuntimeIdsInDefs,_0x26ca9a(0x16e));function generateShortUuid(){const _0x4c7144=_0x26ca9a;return Math[_0x4c7144(0x120)]()[_0x4c7144(0x133)](0x24)[_0x4c7144(0x91)](0x2,0x8);}function _0xbfbf(){const _0x3ffaee=['_shortcutService','ReplaceDIalogImpl','matchesCount','find-replace.dialog.find-by.formula','FindDialogImpl','find-replace.replace.all-failure','changeReplaceString','concat','ROW','complete','primary','_matchesCount','subscribeContextValue$','find-replace.dialog.find-direction.column','colorChannel1','defineProperty','_contextService','render','FindReplaceState','find-replace.dialog.no-result','7573445PjIoXP','FIND_REPLACE_REPLACE_REVEALED','_dialogService','onChange','111436oKgAzp','focus','string','moveToNextMatch','querySelector','find-replace.dialog.find-scope.title','failure','findDirection','changeFindBy','getUniverSheetInstance','prototype','_findBy','propertyIsEnumerable','findReplaceButtonsGroup','_providers','find','whenFindReplaceDialogFocused','replaceables$','mask','_moveToInitialMatch','find-replace.dialog.find-by.value','replaceable','_replaceRevealed','replaceRuntimeIdsInDefs','find-replace.dialog.find-direction.title','SearchIcon','find-replace.dialog.replace-placeholder','subunit','evenodd','_startSearching','children','defIds','focusSignal$','onStarting','_localeService','find-replace.dialog.find-scope.current-sheet','executeCommand','_injector','next','subscribe','revealReplace','_findCompleted','url(#$1','ENTER','closePanel','_findReplaceService','find-replace.dialog.replace','changeFindScope','generateShortUuid','_model','useFindDirectionOptions','path','COLUMN','find-replace.dialog.find-direction.row','getOwnPropertySymbols','_configService','_toggleRevealReplace','_findDirection','VALUE','focusFindInput','caseSensitive','none','getFindString','changeCaseSensitive','changeFindString','_toggleDisplayRawFormula','replaceRevealed','FORMULA','20RluAqy','find-replace.dialog.title','find-replace.replace.partial-success','M2.39551\x207.37266C2.39551\x204.18105\x204.98281\x201.59375\x208.17441\x201.59375C11.366\x201.59375\x2013.9533\x204.18105\x2013.9533\x207.37266C13.9533\x208.72342\x2013.4898\x209.96603\x2012.7133\x2010.95L15.1964\x2013.4331C15.4619\x2013.6986\x2015.4619\x2014.1291\x2015.1964\x2014.3946C14.9309\x2014.6601\x2014.5004\x2014.6601\x2014.2349\x2014.3946L11.7518\x2011.9115C10.7678\x2012.6881\x209.52525\x2013.1516\x208.17441\x2013.1516C4.98281\x2013.1516\x202.39551\x2010.5642\x202.39551\x207.37266ZM8.17441\x202.95349C5.73378\x202.95349\x203.75525\x204.93202\x203.75525\x207.37266C3.75525\x209.81333\x205.73378\x2011.7918\x208.17441\x2011.7918C10.6151\x2011.7918\x2012.5936\x209.81333\x2012.5936\x207.37266C12.5936\x204.93202\x2010.6151\x202.95349\x208.17441\x202.95349Z','length','univer-button-text','_matchesTheWholeCell','_findModels','idSuffix','use','text','UNIVER_FIND_REPLACE_PLUGIN','attrs','trim','_stopSearching','getCurrentLocale','_focusSignal$','className','_findScope','178910qArlwU','ui.command.replace-current-match','_matches','univer-find-replace-buttons-group-right','changeMatchesTheWholeCell','setContextValue','_matchingModel','tag','currentColor','_currentMatch$','start','2249359fkVPmw','ui.command.replace-all-matches','_commandService','onClose','UNIVER_SHEET','COMMAND','focused$','add','Warning','DESKTOP_FIND_REPLACE_DIALOG','univer-find-replace-dialog-container','_univerInstanceService','_subscribeToModelsChanges','FindReplaceDialog','substring','OTHERS','from','FindModel','__decorateParam$2','value','all','revealed','find-replace.toolbar','stateUpdates$','target','success','_initUI','inputtingFindString','searched','find-replace.dialog.find-by.title','pipe','_menuManagerService','find-replace.dialog.no-match','FindReplaceModel','register','FIND_REPLACE_DIALOG_FOCUS','_replaceString','find-replace.shortcut.open-find-dialog','OPERATION','.univer-find-input\x20input','244347hRUAYD','find-replace.replace.all-success','onRendered','row','button.confirm','_matchesPosition','univer-find-replace-expand-container','getFindReplaceDialogDefaultPosition','_currentSearchingDisposables','indexOf','M0.9\x200.09H16.9V16.09H0.9z','findReplaceButtonsGroupRight','findBy','SearchInput','state$','_stateUpdates$','#D9D9D9','_closingListenerDisposable','matchesTheWholeCell','terminate','_initCommands','activelyChangingMatch$','react.element','selectHasFocus','changeFindDirection','find-replace.dialog.match-the-whole-cell','__decorateClass','0\x200\x2017\x2017','createInstance','moveToPreviousMatch','exports','createInitFindReplaceState','getUnitId','hasOwnProperty','getCurrentMatch','then','map','delete','948033NaGBNf','confirm','FindReplaceService','open','CTRL_COMMAND','Error','replaceAll','BUTTON','div','UniverIcon','changeState','useFindByOptions','_moveToNextUnitMatch','apply','current','activeElement','findString','find-replace.shortcut.open-replace-dialog','get','find-replace.service','registerContainerElement','icon','ref','name','mask0_217_40','1em','findScope','30RkuntN','4vhJMUU','show','getOwnPropertyDescriptor','useFindInputFocus','find-replace.dialog.advanced-finding','unsubscribe','getMatches','unit','for','replaceString','_config','currentMatch$','find-replace.shortcut.go-to-previous-match','findIndex','_openPanel','whenFindReplaceInputFocused','whenReplaceRevealed','find-replace.shortcut.go-to-next-match','univer-find-input','_replaceables$','disposeWithMe','dispose$','matchesPosition','assign','key','matchesUpdate$','displayName','replace','740956KMaijy','findReplaceDialogContainer','_caseSensitive','_inputtingFindString','defaultProps','focusin','state','_revealed','asObservable','registerCommand','UNIT','FindReplaceMenuItemFactory','jsx','unitId','button.cancel','getContextValue','_componentManager','changeInputtingFindString','find-replace.dialog.find','CONFIRM_REPLACE_ALL','xlink:href','_initShortcuts','Fragment','random','_findString','jsxs','SUBUNIT','__decorateParam$1','forEach','.univer-find-replace-dialog-container\x20.univer-select-selection-search-input','dispose','handler','FIND_REPLACE_INPUT_FOCUS','mergeMenu','flat','defs','__decorateParam','_state','_state$','_markMatch','filter','call','toString','__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED','findCompleted','8kzmnVy','reduce','column','svg','fill','shouldStateUpdateTriggerResearch','whenEditorNotActivated','univerjs-icon\x20univerjs-icon-','MAC_CTRL'];_0xbfbf=function(){return _0x3ffaee;};return _0xbfbf();}__name(generateShortUuid,_0x26ca9a(0x187)),IconBase[_0x26ca9a(0x107)]=_0x26ca9a(0xda);var element={'tag':_0x26ca9a(0x139),'attrs':{'fill':_0x26ca9a(0x194),'viewBox':_0x26ca9a(0xc6),'width':_0x26ca9a(0xea),'height':'1em'},'children':[{'tag':_0x26ca9a(0x169),'attrs':{'id':_0x26ca9a(0xe9),'style':{'maskType':'alpha'},'width':0x11,'height':0x11,'x':0x0,'y':0x0,'maskUnits':'userSpaceOnUse'},'children':[{'tag':_0x26ca9a(0x18a),'attrs':{'fill':_0x26ca9a(0xbb),'d':_0x26ca9a(0xb5)}}]},{'tag':'g','attrs':{'mask':'url(#mask0_217_40)'},'children':[{'tag':_0x26ca9a(0x18a),'attrs':{'fill':_0x26ca9a(0x80),'d':_0x26ca9a(0x19e),'fillRule':_0x26ca9a(0x173),'clipRule':_0x26ca9a(0x173)}}]}]},SearchSingle16=forwardRef(function(_0xb7c86d,_0xf1bc16){const _0x4b5826=_0x26ca9a;return createElement(IconBase,Object[_0x4b5826(0x104)]({},_0xb7c86d,{'id':'search-single-16','ref':_0xf1bc16,'icon':element}));});SearchSingle16[_0x26ca9a(0x107)]='SearchSingle16';const FIND_REPLACE_INPUT_FOCUS=_0x26ca9a(0x129),FIND_REPLACE_DIALOG_FOCUS=_0x26ca9a(0xa6),FIND_REPLACE_REPLACE_REVEALED=_0x26ca9a(0x154);var __defProp$2=Object[_0x26ca9a(0x14e)],__getOwnPropDesc$2=Object[_0x26ca9a(0xef)],__decorateClass$2=__name((_0x1cdb2b,_0x13cd36,_0x186aa8,_0x368642)=>{const _0xa3a2fd=_0x26ca9a;for(var _0x57c530=_0x368642>0x1?void 0x0:_0x368642?__getOwnPropDesc$2(_0x13cd36,_0x186aa8):_0x13cd36,_0x235fb1=_0x1cdb2b[_0xa3a2fd(0x19f)]-0x1,_0x1d481d;_0x235fb1>=0x0;_0x235fb1--)(_0x1d481d=_0x1cdb2b[_0x235fb1])&&(_0x57c530=(_0x368642?_0x1d481d(_0x13cd36,_0x186aa8,_0x57c530):_0x1d481d(_0x57c530))||_0x57c530);return _0x368642&&_0x57c530&&__defProp$2(_0x13cd36,_0x186aa8,_0x57c530),_0x57c530;},'__decorateClass$2'),__decorateParam$2=__name((_0x552cdc,_0x4f830a)=>(_0x2525fc,_0x19086c)=>_0x4f830a(_0x2525fc,_0x19086c,_0x552cdc),_0x26ca9a(0x95));const _FindModel=class _FindModel extends Disposable{};__name(_FindModel,_0x26ca9a(0x94));let FindModel=_FindModel;const IFindReplaceService=createIdentifier(_0x26ca9a(0xe4));function shouldStateUpdateTriggerResearch(_0x20c7c2){const _0x283609=_0x26ca9a;return typeof _0x20c7c2[_0x283609(0xe1)]<'u'||typeof _0x20c7c2[_0x283609(0x9e)]<'u'||typeof _0x20c7c2[_0x283609(0x15e)]<'u'||typeof _0x20c7c2[_0x283609(0xbd)]<'u'||typeof _0x20c7c2[_0x283609(0x193)]<'u'||typeof _0x20c7c2[_0x283609(0xeb)]<'u'||typeof _0x20c7c2['findBy']<'u';}__name(shouldStateUpdateTriggerResearch,_0x26ca9a(0x13b));var _a;let FindReplaceModel=(_a=class extends Disposable{constructor(_0x41d197,_0x12dc05,_0x415737){const _0x21f507=_0x26ca9a;super(),__publicField(this,_0x21f507(0xf8),new BehaviorSubject(null)),__publicField(this,_0x21f507(0x168),new BehaviorSubject([])),__publicField(this,'_findModels',[]),__publicField(this,_0x21f507(0x7e),null),__publicField(this,_0x21f507(0x7a),[]),__publicField(this,_0x21f507(0xb3),null),(this[_0x21f507(0x12e)]=_0x41d197,this[_0x21f507(0x165)]=_0x12dc05,this[_0x21f507(0x8e)]=_0x415737,this[_0x21f507(0x101)](this['_state'][_0x21f507(0x9a)]['pipe'](throttleTime(0xc8,void 0x0,{'leading':!0x0,'trailing':!0x0}))[_0x21f507(0x17e)](async _0x223e37=>{const _0x1f4bda=_0x21f507,_0x172a29=this[_0x1f4bda(0x12e)][_0x1f4bda(0x10f)];shouldStateUpdateTriggerResearch(_0x223e37)&&(_0x172a29['findString']!==''&&!_0x172a29['replaceRevealed']?(await this[_0x1f4bda(0x174)](),this[_0x1f4bda(0x12e)]['changeState']({'findCompleted':!0x0})):_0x223e37['replaceRevealed']!==!0x0&&this[_0x1f4bda(0x73)]());})));}get[_0x26ca9a(0x9f)](){const _0xef87c3=_0x26ca9a;return this[_0xef87c3(0x1a2)][_0xef87c3(0x19f)]>0x0;}[_0x26ca9a(0x127)](){const _0x2f9283=_0x26ca9a;super[_0x2f9283(0x127)](),this[_0x2f9283(0x73)](),this['currentMatch$']['complete'](),this['replaceables$'][_0x2f9283(0x148)](),this[_0x2f9283(0x12e)][_0x2f9283(0xdb)]({...createInitFindReplaceState(),'revealed':!0x1});}async[_0x26ca9a(0x82)](){const _0xfee40a=_0x26ca9a;if(!this['_state'][_0xfee40a(0xe1)])return{'results':[]};const _0x4c261d=await this[_0xfee40a(0x174)]();return this[_0xfee40a(0x12e)]['changeState']({'findCompleted':!0x0}),_0x4c261d;}async[_0x26ca9a(0x174)](){const _0x62b967=_0x26ca9a;if(!this[_0x62b967(0x12e)]['findString'])return{'results':[]};const _0x56014f=Array[_0x62b967(0x93)](this['_providers']),_0xcc2866=this[_0x62b967(0x1a2)]=(await Promise[_0x62b967(0x97)](_0x56014f[_0x62b967(0xcf)](_0x4170da=>_0x4170da[_0x62b967(0x166)]({'findString':this['_state']['findString'],'findDirection':this[_0x62b967(0x12e)][_0x62b967(0x15e)],'findScope':this[_0x62b967(0x12e)]['findScope'],'findBy':this['_state'][_0x62b967(0xb7)],'replaceRevealed':this[_0x62b967(0x12e)][_0x62b967(0x199)],'caseSensitive':this[_0x62b967(0x12e)]['caseSensitive'],'matchesTheWholeCell':this[_0x62b967(0x12e)][_0x62b967(0xbd)]}))))['flat']();this[_0x62b967(0x8f)](_0xcc2866);const _0x1e9783=this['_matches']=_0xcc2866[_0x62b967(0xcf)](_0x167ca2=>_0x167ca2[_0x62b967(0xf3)]())[_0x62b967(0x12b)]();return this[_0x62b967(0x168)][_0x62b967(0x17d)](_0x1e9783[_0x62b967(0x131)](_0x3aa678=>_0x3aa678[_0x62b967(0x16c)])),_0x1e9783[_0x62b967(0x19f)]?(this[_0x62b967(0x16a)](_0xcc2866),this[_0x62b967(0x12e)]['changeState']({'matchesCount':_0x1e9783[_0x62b967(0x19f)]}),{'results':_0x1e9783}):(this['_state'][_0x62b967(0xdb)]({'matchesCount':0x0,'matchesPosition':0x0}),{'results':[]});}[_0x26ca9a(0x73)](){const _0x31a943=_0x26ca9a;var _0x291cce;this['_providers'][_0x31a943(0x125)](_0x52e6e5=>_0x52e6e5['terminate']()),this['_findModels']=[],this['_matches']=[],this[_0x31a943(0x7e)]=null,(_0x291cce=this[_0x31a943(0xb3)])==null||_0x291cce[_0x31a943(0x127)](),this['_currentSearchingDisposables']=null,this['currentMatch$'][_0x31a943(0x17d)](null),this['replaceables$'][_0x31a943(0x17d)]([]),this['_state']['changeState']({'findCompleted':!0x1,'matchesCount':0x0,'matchesPosition':0x0});}[_0x26ca9a(0x8f)](_0x38ca29){const _0xf6c63=_0x26ca9a,_0x188937=this[_0xf6c63(0xb3)]=new DisposableCollection(),_0x2fbdd8=combineLatest(_0x38ca29[_0xf6c63(0xcf)](_0x4afbe1=>_0x4afbe1[_0xf6c63(0x106)]))[_0xf6c63(0xa1)](debounceTime(0xdc))['subscribe'](([..._0x547e59])=>{const _0x5bd5c4=_0xf6c63,_0x11dd86=this[_0x5bd5c4(0x7a)]=_0x547e59[_0x5bd5c4(0x12b)]();_0x11dd86[_0x5bd5c4(0x19f)]?(this[_0x5bd5c4(0x16a)](this[_0x5bd5c4(0x1a2)],!0x0),this[_0x5bd5c4(0x12e)]['changeState']({'matchesCount':_0x11dd86[_0x5bd5c4(0x19f)]}),this[_0x5bd5c4(0x168)][_0x5bd5c4(0x17d)](_0x11dd86[_0x5bd5c4(0x131)](_0x3e7799=>_0x3e7799[_0x5bd5c4(0x16c)]))):(this['_state'][_0x5bd5c4(0xdb)]({'matchesCount':0x0,'matchesPosition':0x0}),this[_0x5bd5c4(0x168)][_0x5bd5c4(0x17d)]([]));});_0x38ca29[_0xf6c63(0x125)](_0x3d26bf=>_0x188937[_0xf6c63(0x8a)](toDisposable(_0x3d26bf[_0xf6c63(0xc0)][_0xf6c63(0x17e)](_0x283003=>{const _0x234ec5=_0xf6c63,_0x35eed1=this[_0x234ec5(0x7a)][_0x234ec5(0xfa)](_0x5346b2=>_0x5346b2===_0x283003);this[_0x234ec5(0x12e)][_0x234ec5(0xdb)]({'matchesPosition':_0x35eed1+0x1});})))),_0x188937['add'](toDisposable(_0x2fbdd8));}async[_0x26ca9a(0x108)](){const _0x423916=_0x26ca9a;return this['_matchingModel']?this['_matchingModel'][_0x423916(0x108)](this[_0x423916(0x12e)][_0x423916(0xf6)]):!0x1;}async[_0x26ca9a(0xd7)](){const _0x317c54=_0x26ca9a,_0x24dd95=await Promise[_0x317c54(0x97)](this['_findModels']['map'](_0x5a477d=>_0x5a477d[_0x317c54(0xd7)](this[_0x317c54(0x12e)]['replaceString'])))[_0x317c54(0xce)](_0x3441bc=>_0x3441bc[_0x317c54(0x137)]((_0x31bfc7,_0x2e668e)=>(_0x31bfc7[_0x317c54(0x9c)]+=_0x2e668e[_0x317c54(0x9c)],_0x31bfc7[_0x317c54(0x15d)]+=_0x2e668e[_0x317c54(0x15d)],_0x31bfc7),{'success':0x0,'failure':0x0}));return _0x24dd95[_0x317c54(0x15d)]===0x0&&this[_0x317c54(0x73)](),_0x24dd95;}[_0x26ca9a(0xcd)](){const _0x20e08b=_0x26ca9a;return this['_state'][_0x20e08b(0x103)]>0x0?this['_matches'][this['_state']['matchesPosition']-0x1]:null;}[_0x26ca9a(0x130)](_0x22a742){const _0x198e10=_0x26ca9a,_0x2aca7a=this[_0x198e10(0x7a)][_0x198e10(0xfa)](_0x285257=>_0x285257===_0x22a742);this[_0x198e10(0xf8)][_0x198e10(0x17d)](_0x22a742),this['_state'][_0x198e10(0xdb)]({'matchesPosition':_0x2aca7a+0x1});}[_0x26ca9a(0x15a)](){const _0xdc3ff=_0x26ca9a;if(!this[_0xdc3ff(0x7e)])return;const _0x3383a9=this[_0xdc3ff(0x1a2)][_0xdc3ff(0x19f)]===0x1,_0x288232=this[_0xdc3ff(0x7e)]['moveToNextMatch']({'loop':_0x3383a9});if(_0x288232)this[_0xdc3ff(0x130)](_0x288232);else{const _0x37e4e9=this['_findModels'][_0xdc3ff(0xfa)](_0x1630a7=>_0x1630a7===this[_0xdc3ff(0x7e)]);this[_0xdc3ff(0xdd)](_0x37e4e9);}}[_0x26ca9a(0xdd)](_0x33160e){const _0x37aa7e=_0x26ca9a,_0x10e566=this[_0x37aa7e(0x1a2)][_0x37aa7e(0x19f)];for(let _0x4d760d=(_0x33160e+0x1)%_0x10e566;_0x4d760d!==_0x33160e;){const _0x3bace8=this['_findModels'][_0x4d760d],_0x1c9187=_0x3bace8['moveToNextMatch']({'ignoreSelection':!0x0});if(_0x1c9187){this[_0x37aa7e(0x7e)]=_0x3bace8,this[_0x37aa7e(0x130)](_0x1c9187);return;}_0x4d760d=(_0x4d760d+0x1)%_0x10e566;}if(this[_0x37aa7e(0x7e)]){const _0x5efc1b=this[_0x37aa7e(0x7e)][_0x37aa7e(0x15a)]({'ignoreSelection':!0x0});_0x5efc1b&&this[_0x37aa7e(0x130)](_0x5efc1b);}}[_0x26ca9a(0xc8)](){const _0x3d9972=_0x26ca9a;if(!this[_0x3d9972(0x7e)])return;const _0x396377=this[_0x3d9972(0x1a2)][_0x3d9972(0x19f)]===0x1,_0xa43761=this[_0x3d9972(0x7e)][_0x3d9972(0xc8)]({'loop':_0x396377});if(_0xa43761){const _0x283b0f=this[_0x3d9972(0x7a)]['findIndex'](_0x1df096=>_0x1df096===_0xa43761);this[_0x3d9972(0xf8)]['next'](_0xa43761),this['_state'][_0x3d9972(0xdb)]({'matchesPosition':_0x283b0f+0x1});}else{const _0x584dcd=this[_0x3d9972(0x1a2)]['length'],_0x5c2a59=this['_findModels'][_0x3d9972(0xfa)](_0x8a4e8f=>_0x8a4e8f===this[_0x3d9972(0x7e)]);for(let _0x5a3366=(_0x5c2a59-0x1+_0x584dcd)%_0x584dcd;_0x5a3366!==_0x5c2a59;){const _0x2ff099=this['_findModels'][_0x5a3366],_0x3f8553=_0x2ff099[_0x3d9972(0xc8)]({'ignoreSelection':!0x0});if(_0x3f8553){this[_0x3d9972(0x7e)]=_0x2ff099,this[_0x3d9972(0x130)](_0x3f8553);return;}_0x5a3366=(_0x5a3366-0x1)%_0x584dcd;}const _0x3326f7=this[_0x3d9972(0x7e)]['moveToPreviousMatch']({'ignoreSelection':!0x0});_0x3326f7&&this[_0x3d9972(0x130)](_0x3326f7);}}[_0x26ca9a(0x16a)](_0x4ad31b,_0x27c51c=!0x1){const _0x32555f=_0x26ca9a;var _0xdae966;const _0x1e7321=(_0xdae966=this[_0x32555f(0x8e)]['getFocusedUnit']())==null?void 0x0:_0xdae966[_0x32555f(0xcb)]();if(!_0x1e7321)return-0x1;const _0x70519f=_0x4ad31b[_0x32555f(0xfa)](_0x23890d=>_0x23890d[_0x32555f(0x116)]===_0x1e7321);if(_0x70519f!==-0x1){this[_0x32555f(0x7e)]=_0x4ad31b[_0x70519f];const _0x338126=this[_0x32555f(0x7e)][_0x32555f(0x15a)]({'stayIfOnMatch':!0x0,'noFocus':_0x27c51c});if(_0x338126)return this['_markMatch'](_0x338126),_0x70519f;}return this[_0x32555f(0xdd)](_0x70519f),0x0;}},__name(_a,_0x26ca9a(0xa4)),_a);FindReplaceModel=__decorateClass$2([__decorateParam$2(0x2,IUniverInstanceService)],FindReplaceModel);var FindDirection=(_0x5c893c=>(_0x5c893c[_0x26ca9a(0x147)]=_0x26ca9a(0xae),_0x5c893c[_0x26ca9a(0x18b)]=_0x26ca9a(0x138),_0x5c893c))(FindDirection||{}),FindBy=(_0x485d12=>(_0x485d12[_0x26ca9a(0x191)]='value',_0x485d12[_0x26ca9a(0x19a)]='formula',_0x485d12))(FindBy||{}),FindScope=(_0x1679b1=>(_0x1679b1[_0x26ca9a(0x123)]='subunit',_0x1679b1[_0x26ca9a(0x113)]=_0x26ca9a(0xf4),_0x1679b1))(FindScope||{});function createInitFindReplaceState(){const _0x5716f5=_0x26ca9a;return{'caseSensitive':!0x1,'findBy':'value','findCompleted':!0x1,'findDirection':_0x5716f5(0xae),'findScope':_0x5716f5(0x172),'findString':'','inputtingFindString':'','matchesCount':0x0,'matchesPosition':0x0,'matchesTheWholeCell':!0x1,'replaceRevealed':!0x1,'replaceString':'','revealed':!0x0};}__name(createInitFindReplaceState,_0x26ca9a(0xca));const _FindReplaceState=class _FindReplaceState{constructor(){const _0x514a88=_0x26ca9a;__publicField(this,_0x514a88(0xba),new Subject()),__publicField(this,_0x514a88(0x9a),this[_0x514a88(0xba)][_0x514a88(0x111)]()),__publicField(this,'_state$',new BehaviorSubject(createInitFindReplaceState())),__publicField(this,_0x514a88(0xb9),this['_state$'][_0x514a88(0x111)]()),__publicField(this,_0x514a88(0x121),''),__publicField(this,_0x514a88(0x10c),''),__publicField(this,_0x514a88(0xa7),''),__publicField(this,_0x514a88(0x110),!0x1),__publicField(this,_0x514a88(0x16d),!0x1),__publicField(this,_0x514a88(0xb0),0x0),__publicField(this,_0x514a88(0x14a),0x0),__publicField(this,'_caseSensitive',!0x0),__publicField(this,_0x514a88(0x1a1),!0x1),__publicField(this,_0x514a88(0x190),_0x514a88(0xae)),__publicField(this,_0x514a88(0x77),'subunit'),__publicField(this,'_findBy',_0x514a88(0x96)),__publicField(this,'_findCompleted',!0x1);}get[_0x26ca9a(0x10f)](){const _0x499263=_0x26ca9a;return this[_0x499263(0x12f)]['getValue']();}get['inputtingFindString'](){const _0x944057=_0x26ca9a;return this[_0x944057(0x10c)];}get[_0x26ca9a(0xe1)](){const _0x560bd6=_0x26ca9a;return this[_0x560bd6(0x121)];}get[_0x26ca9a(0x98)](){const _0x1c00eb=_0x26ca9a;return this[_0x1c00eb(0x110)];}get[_0x26ca9a(0x199)](){const _0x50f535=_0x26ca9a;return this[_0x50f535(0x16d)];}get['matchesPosition'](){const _0x22539c=_0x26ca9a;return this[_0x22539c(0xb0)];}get['matchesCount'](){const _0x23c0c5=_0x26ca9a;return this[_0x23c0c5(0x14a)];}get['replaceString'](){const _0x3e1ae3=_0x26ca9a;return this[_0x3e1ae3(0xa7)];}get[_0x26ca9a(0x193)](){const _0x5b876c=_0x26ca9a;return this[_0x5b876c(0x10b)];}get[_0x26ca9a(0xbd)](){const _0x44faec=_0x26ca9a;return this[_0x44faec(0x1a1)];}get[_0x26ca9a(0x15e)](){const _0x267c41=_0x26ca9a;return this[_0x267c41(0x190)];}get[_0x26ca9a(0xeb)](){const _0x41ef19=_0x26ca9a;return this[_0x41ef19(0x77)];}get[_0x26ca9a(0xb7)](){return this['_findBy'];}get[_0x26ca9a(0x135)](){return this['_findCompleted'];}[_0x26ca9a(0xdb)](_0x44e08f){const _0x4eb7f2=_0x26ca9a;let _0x34c916=!0x1;const _0x31b268={};typeof _0x44e08f[_0x4eb7f2(0xe1)]<'u'&&_0x44e08f[_0x4eb7f2(0xe1)]!==this[_0x4eb7f2(0x121)]&&(this[_0x4eb7f2(0x121)]=_0x44e08f['findString'],_0x31b268[_0x4eb7f2(0xe1)]=this[_0x4eb7f2(0x121)],_0x34c916=!0x0),typeof _0x44e08f[_0x4eb7f2(0x98)]<'u'&&_0x44e08f['revealed']!==this['_revealed']&&(this['_revealed']=_0x44e08f[_0x4eb7f2(0x98)],_0x31b268[_0x4eb7f2(0x98)]=_0x44e08f[_0x4eb7f2(0x98)],_0x34c916=!0x0),typeof _0x44e08f['replaceRevealed']<'u'&&_0x44e08f['replaceRevealed']!==this[_0x4eb7f2(0x16d)]&&(this[_0x4eb7f2(0x16d)]=_0x44e08f[_0x4eb7f2(0x199)],_0x31b268[_0x4eb7f2(0x199)]=_0x44e08f[_0x4eb7f2(0x199)],_0x34c916=!0x0),typeof _0x44e08f['replaceString']<'u'&&_0x44e08f[_0x4eb7f2(0xf6)]!==this['_replaceString']&&(this[_0x4eb7f2(0xa7)]=_0x44e08f[_0x4eb7f2(0xf6)],_0x31b268[_0x4eb7f2(0xf6)]=_0x44e08f['replaceString'],_0x34c916=!0x0),typeof _0x44e08f[_0x4eb7f2(0x141)]<'u'&&_0x44e08f[_0x4eb7f2(0x141)]!==this['_matchesCount']&&(this['_matchesCount']=_0x44e08f[_0x4eb7f2(0x141)],_0x31b268[_0x4eb7f2(0x141)]=_0x44e08f[_0x4eb7f2(0x141)],_0x34c916=!0x0),typeof _0x44e08f[_0x4eb7f2(0x103)]<'u'&&_0x44e08f[_0x4eb7f2(0x103)]!==this[_0x4eb7f2(0xb0)]&&(this[_0x4eb7f2(0xb0)]=_0x44e08f['matchesPosition'],_0x31b268[_0x4eb7f2(0x103)]=_0x44e08f[_0x4eb7f2(0x103)],_0x34c916=!0x0),typeof _0x44e08f[_0x4eb7f2(0xb7)]<'u'&&_0x44e08f['findBy']!==this[_0x4eb7f2(0x162)]&&(this['_findBy']=_0x44e08f[_0x4eb7f2(0xb7)],_0x31b268[_0x4eb7f2(0xb7)]=_0x44e08f[_0x4eb7f2(0xb7)],_0x34c916=!0x0),typeof _0x44e08f['findScope']<'u'&&_0x44e08f[_0x4eb7f2(0xeb)]!==this['_findScope']&&(this[_0x4eb7f2(0x77)]=_0x44e08f[_0x4eb7f2(0xeb)],_0x31b268[_0x4eb7f2(0xeb)]=_0x44e08f[_0x4eb7f2(0xeb)],_0x34c916=!0x0),typeof _0x44e08f['findDirection']<'u'&&_0x44e08f['findDirection']!==this[_0x4eb7f2(0x190)]&&(this[_0x4eb7f2(0x190)]=_0x44e08f[_0x4eb7f2(0x15e)],_0x31b268[_0x4eb7f2(0x15e)]=_0x44e08f[_0x4eb7f2(0x15e)],_0x34c916=!0x0),typeof _0x44e08f[_0x4eb7f2(0x193)]<'u'&&_0x44e08f[_0x4eb7f2(0x193)]!==this[_0x4eb7f2(0x10b)]&&(this[_0x4eb7f2(0x10b)]=_0x44e08f['caseSensitive'],_0x31b268['caseSensitive']=_0x44e08f[_0x4eb7f2(0x193)],_0x34c916=!0x0),typeof _0x44e08f[_0x4eb7f2(0xbd)]<'u'&&_0x44e08f[_0x4eb7f2(0xbd)]!==this[_0x4eb7f2(0x1a1)]&&(this[_0x4eb7f2(0x1a1)]=_0x44e08f[_0x4eb7f2(0xbd)],_0x31b268[_0x4eb7f2(0xbd)]=_0x44e08f['matchesTheWholeCell'],_0x34c916=!0x0),typeof _0x44e08f[_0x4eb7f2(0x9e)]<'u'&&_0x44e08f[_0x4eb7f2(0x9e)]!==this[_0x4eb7f2(0x10c)]&&(this[_0x4eb7f2(0x10c)]=_0x44e08f[_0x4eb7f2(0x9e)],_0x31b268[_0x4eb7f2(0x9e)]=_0x44e08f[_0x4eb7f2(0x9e)],_0x34c916=!0x0),typeof _0x44e08f[_0x4eb7f2(0x135)]<'u'&&_0x44e08f['findCompleted']!==this['_findCompleted']&&(this[_0x4eb7f2(0x180)]=_0x44e08f[_0x4eb7f2(0x135)],_0x31b268[_0x4eb7f2(0x135)]=_0x44e08f[_0x4eb7f2(0x135)],_0x34c916=!0x0),_0x34c916&&(this[_0x4eb7f2(0x12f)][_0x4eb7f2(0x17d)]({'caseSensitive':this[_0x4eb7f2(0x10b)],'findBy':this['_findBy'],'findCompleted':this[_0x4eb7f2(0x180)],'findDirection':this[_0x4eb7f2(0x190)],'findScope':this[_0x4eb7f2(0x77)],'findString':this['_findString'],'inputtingFindString':this[_0x4eb7f2(0x10c)],'matchesCount':this[_0x4eb7f2(0x14a)],'matchesPosition':this['_matchesPosition'],'matchesTheWholeCell':this[_0x4eb7f2(0x1a1)],'replaceRevealed':this[_0x4eb7f2(0x16d)],'revealed':this['_revealed']}),this['_stateUpdates$'][_0x4eb7f2(0x17d)](_0x31b268));}};__name(_FindReplaceState,_0x26ca9a(0x151));function _0x4549(_0x29a400,_0xe06e0b){const _0xbfbfa6=_0xbfbf();return _0x4549=function(_0x45496a,_0x335ed9){_0x45496a=_0x45496a-0x6f;let _0x438b51=_0xbfbfa6[_0x45496a];return _0x438b51;},_0x4549(_0x29a400,_0xe06e0b);}let FindReplaceState=_FindReplaceState;var _a2;let FindReplaceService=(_a2=class extends Disposable{constructor(_0x5833b4,_0x57a493){const _0x2f5e75=_0x26ca9a;super(),__publicField(this,_0x2f5e75(0x165),new Set()),__publicField(this,_0x2f5e75(0x12e),new FindReplaceState()),__publicField(this,_0x2f5e75(0x188)),__publicField(this,_0x2f5e75(0x81),new BehaviorSubject(null)),__publicField(this,_0x2f5e75(0xf8),this[_0x2f5e75(0x81)]['asObservable']()),__publicField(this,_0x2f5e75(0x100),new BehaviorSubject([])),__publicField(this,_0x2f5e75(0x168),this[_0x2f5e75(0x100)][_0x2f5e75(0x111)]()),__publicField(this,_0x2f5e75(0x75),new Subject()),__publicField(this,_0x2f5e75(0x177),this[_0x2f5e75(0x75)][_0x2f5e75(0x111)]()),(this[_0x2f5e75(0x17c)]=_0x5833b4,this[_0x2f5e75(0x14f)]=_0x57a493);}get['stateUpdates$'](){const _0x17c790=_0x26ca9a;return this[_0x17c790(0x12e)][_0x17c790(0x9a)];}get[_0x26ca9a(0xb9)](){const _0x41592c=_0x26ca9a;return this[_0x41592c(0x12e)][_0x41592c(0xb9)];}get[_0x26ca9a(0x98)](){const _0x44c501=_0x26ca9a;return this[_0x44c501(0x12e)]['revealed'];}get[_0x26ca9a(0x199)](){const _0x535890=_0x26ca9a;return this[_0x535890(0x12e)][_0x535890(0x199)];}['dispose'](){const _0x4d92d3=_0x26ca9a;super[_0x4d92d3(0x127)](),this[_0x4d92d3(0x81)]['next'](null),this[_0x4d92d3(0x81)][_0x4d92d3(0x148)](),this[_0x4d92d3(0x100)][_0x4d92d3(0x17d)]([]),this[_0x4d92d3(0x100)][_0x4d92d3(0x148)](),this['_focusSignal$']['complete']();}[_0x26ca9a(0xcd)](){const _0x48ab70=_0x26ca9a;var _0x277818;return(_0x277818=this[_0x48ab70(0x188)])==null?void 0x0:_0x277818[_0x48ab70(0xcd)]();}[_0x26ca9a(0x195)](){const _0x321212=_0x26ca9a;return this[_0x321212(0x12e)][_0x321212(0xe1)];}[_0x26ca9a(0x197)](_0x5e3417){const _0x555dd3=_0x26ca9a;this['_state'][_0x555dd3(0xdb)]({'findString':_0x5e3417});}[_0x26ca9a(0x192)](){const _0x4a6325=_0x26ca9a;this[_0x4a6325(0x75)][_0x4a6325(0x17d)]();}[_0x26ca9a(0x11a)](_0x3b3929){const _0x5059fa=_0x26ca9a;_0x3b3929?this[_0x5059fa(0x12e)][_0x5059fa(0xdb)]({'inputtingFindString':_0x3b3929}):this[_0x5059fa(0x12e)][_0x5059fa(0xdb)]({'inputtingFindString':'','findString':''});}[_0x26ca9a(0x145)](_0x487c30){const _0x48e586=_0x26ca9a;this[_0x48e586(0x12e)][_0x48e586(0xdb)]({'replaceString':_0x487c30});}['changeMatchesTheWholeCell'](_0x2bc140){const _0xb31172=_0x26ca9a;this['_state'][_0xb31172(0xdb)]({'matchesTheWholeCell':_0x2bc140});}[_0x26ca9a(0x196)](_0x32a9b6){const _0x5f3bf7=_0x26ca9a;this[_0x5f3bf7(0x12e)][_0x5f3bf7(0xdb)]({'caseSensitive':_0x32a9b6});}[_0x26ca9a(0x15f)](_0x161dbd){const _0x18df78=_0x26ca9a;this[_0x18df78(0x12e)][_0x18df78(0xdb)]({'findBy':_0x161dbd}),this[_0x18df78(0x198)](_0x161dbd==='formula');}[_0x26ca9a(0x186)](_0x1e81dd){const _0x4d4480=_0x26ca9a;this[_0x4d4480(0x12e)][_0x4d4480(0xdb)]({'findScope':_0x1e81dd});}[_0x26ca9a(0xc3)](_0x491085){const _0x4bd477=_0x26ca9a;this['_state'][_0x4bd477(0xdb)]({'findDirection':_0x491085});}[_0x26ca9a(0x15a)](){const _0x164570=_0x26ca9a;this[_0x164570(0x188)]&&(this[_0x164570(0x12e)]['replaceRevealed']&&!this['_model'][_0x164570(0x9f)]?(this[_0x164570(0x12e)][_0x164570(0xdb)]({'findString':this[_0x164570(0x12e)][_0x164570(0x9e)]}),this[_0x164570(0x188)]['start']()):this['_model']['moveToNextMatch'](),this[_0x164570(0x75)][_0x164570(0x17d)]());}[_0x26ca9a(0xc8)](){const _0x415bee=_0x26ca9a;this['_model']&&(this[_0x415bee(0x12e)]['replaceRevealed']&&!this[_0x415bee(0x188)][_0x415bee(0x9f)]?(this[_0x415bee(0x12e)][_0x415bee(0xdb)]({'findString':this[_0x415bee(0x12e)][_0x415bee(0x9e)]}),this[_0x415bee(0x188)][_0x415bee(0x82)]()):this[_0x415bee(0x188)][_0x415bee(0xc8)](),this[_0x415bee(0x75)][_0x415bee(0x17d)]());}async[_0x26ca9a(0x108)](){const _0x17f425=_0x26ca9a;return this['_model']?this[_0x17f425(0x188)]['replace']():!0x1;}async[_0x26ca9a(0xd7)](){const _0x2ed56e=_0x26ca9a;if(!this[_0x2ed56e(0x188)])throw new Error('[FindReplaceService]\x20replaceAll:\x20model\x20is\x20not\x20initialized!');return this['_model'][_0x2ed56e(0xd7)]();}[_0x26ca9a(0x17f)](){const _0x2ebf19=_0x26ca9a;this[_0x2ebf19(0x12e)]['changeState']({'replaceRevealed':!0x0,'inputtingFindString':this[_0x2ebf19(0x12e)][_0x2ebf19(0xe1)]}),this[_0x2ebf19(0x18f)](!0x0);}[_0x26ca9a(0x82)](_0x28c1c9=!0x1){const _0x33e7c9=_0x26ca9a;if(this[_0x33e7c9(0x165)]['size']===0x0)return!0x1;this['_model']=this['_injector'][_0x33e7c9(0xc7)](FindReplaceModel,this[_0x33e7c9(0x12e)],this[_0x33e7c9(0x165)]),this['_model'][_0x33e7c9(0xf8)][_0x33e7c9(0x17e)](_0x1d61fa=>this[_0x33e7c9(0x81)][_0x33e7c9(0x17d)](_0x1d61fa)),this['_model'][_0x33e7c9(0x168)]['subscribe'](_0x39a633=>this[_0x33e7c9(0x100)][_0x33e7c9(0x17d)](_0x39a633));const _0x4c1905=createInitFindReplaceState();return _0x28c1c9&&(_0x4c1905[_0x33e7c9(0x199)]=!0x0),this[_0x33e7c9(0x12e)][_0x33e7c9(0xdb)](_0x4c1905),this['_toggleRevealReplace'](_0x28c1c9),!0x0;}[_0x26ca9a(0x166)](){const _0x45f8bf=_0x26ca9a;var _0x21be75;(_0x21be75=this[_0x45f8bf(0x188)])==null||_0x21be75[_0x45f8bf(0x82)]();}['terminate'](){const _0x354c90=_0x26ca9a;var _0x146446;(_0x146446=this[_0x354c90(0x188)])==null||_0x146446[_0x354c90(0x127)](),this[_0x354c90(0x188)]=null,this['_toggleDisplayRawFormula'](!0x1),this['_toggleRevealReplace'](!0x1);}['registerFindReplaceProvider'](_0x1a9c0b){const _0x423f7b=_0x26ca9a;return this[_0x423f7b(0x165)][_0x423f7b(0x8a)](_0x1a9c0b),toDisposable(()=>this[_0x423f7b(0x165)][_0x423f7b(0xd0)](_0x1a9c0b));}[_0x26ca9a(0x18f)](_0x2eb6c7){const _0x4b1b85=_0x26ca9a;this[_0x4b1b85(0x14f)][_0x4b1b85(0x7d)](FIND_REPLACE_REPLACE_REVEALED,_0x2eb6c7);}[_0x26ca9a(0x198)](_0x330f59){const _0x334540=_0x26ca9a;this[_0x334540(0x14f)][_0x334540(0x7d)](RENDER_RAW_FORMULA_KEY,_0x330f59);}},__name(_a2,_0x26ca9a(0xd3)),_a2);FindReplaceService=__decorateClass$2([__decorateParam$2(0x0,Inject(Injector)),__decorateParam$2(0x1,IContextService)],FindReplaceService);const ReplaceCurrentMatchCommand={'id':_0x26ca9a(0x79),'type':CommandType[_0x26ca9a(0x88)],'handler':__name(_0x2ac2d5=>_0x2ac2d5['get'](IFindReplaceService)[_0x26ca9a(0x108)](),_0x26ca9a(0x128))},CONFIRM_REPLACE_ALL_ID=_0x26ca9a(0x11c),ReplaceAllMatchesCommand={'id':_0x26ca9a(0x84),'type':CommandType[_0x26ca9a(0x88)],'handler':__name(async _0x19095e=>{const _0x5a73b4=_0x26ca9a,_0x125e31=_0x19095e[_0x5a73b4(0xe3)](IConfirmService),_0x3490f7=_0x19095e[_0x5a73b4(0xe3)](LocaleService),_0x3032f5=_0x19095e[_0x5a73b4(0xe3)](IMessageService);if(!await _0x125e31[_0x5a73b4(0xd2)]({'id':CONFIRM_REPLACE_ALL_ID,'title':{'title':_0x3490f7['t']('find-replace.replace.confirm.title')},'cancelText':_0x3490f7['t'](_0x5a73b4(0x117)),'confirmText':_0x3490f7['t'](_0x5a73b4(0xaf))}))return!0x1;const _0x283954=await _0x19095e['get'](IFindReplaceService)[_0x5a73b4(0xd7)](),{success:_0x489463,failure:_0x337a57}=_0x283954;return _0x337a57>0x0?(_0x489463===0x0?_0x3032f5[_0x5a73b4(0xee)]({'type':MessageType[_0x5a73b4(0xd6)],'content':_0x3490f7['t'](_0x5a73b4(0x144))}):_0x3032f5['show']({'type':MessageType[_0x5a73b4(0x8b)],'content':_0x3490f7['t'](_0x5a73b4(0x19d),''+_0x489463,''+_0x337a57)}),!0x1):(_0x3032f5['show']({'type':MessageType['Success'],'content':_0x3490f7['t'](_0x5a73b4(0xac),''+_0x489463)}),!0x0);},_0x26ca9a(0x128))},OpenFindDialogOperation={'id':'ui.operation.open-find-dialog','type':CommandType[_0x26ca9a(0xa9)],'handler':__name(_0x5c3182=>{const _0x381ecf=_0x26ca9a,_0x59d1a8=_0x5c3182['get'](IFindReplaceService);return _0x59d1a8['revealed']?_0x59d1a8['focusFindInput']():_0x59d1a8[_0x381ecf(0x82)](),!0x0;},_0x26ca9a(0x128))},OpenReplaceDialogOperation={'id':'ui.operation.open-replace-dialog','type':CommandType[_0x26ca9a(0xa9)],'handler':__name(_0x3f1e3b=>{const _0x56bdd6=_0x26ca9a,_0x11bb81=_0x3f1e3b[_0x56bdd6(0xe3)](IFindReplaceService);return _0x11bb81['revealed']?_0x11bb81['replaceRevealed']?_0x11bb81[_0x56bdd6(0x192)]():_0x11bb81[_0x56bdd6(0x17f)]():_0x11bb81['start'](!0x0),!0x0;},_0x26ca9a(0x128))},GoToNextMatchOperation={'type':CommandType['OPERATION'],'id':'ui.operation.go-to-next-match','handler':__name(_0x4a523d=>(_0x4a523d['get'](IFindReplaceService)[_0x26ca9a(0x15a)](),!0x0),_0x26ca9a(0x128))},GoToPreviousMatchOperation={'type':CommandType[_0x26ca9a(0xa9)],'id':'ui.operation.go-to-previous-match','handler':__name(_0x3ca395=>(_0x3ca395['get'](IFindReplaceService)['moveToPreviousMatch'](),!0x0),_0x26ca9a(0x128))};var jsxRuntime={'exports':{}},reactJsxRuntime_production_min={},f=_0x578624,k=Symbol[_0x26ca9a(0xf5)](_0x26ca9a(0xc1)),l=Symbol['for']('react.fragment'),m=Object[_0x26ca9a(0x161)][_0x26ca9a(0xcc)],n=f[_0x26ca9a(0x134)]['ReactCurrentOwner'],p={'key':!0x0,'ref':!0x0,'__self':!0x0,'__source':!0x0};function q(_0x3630e6,_0x3eed2b,_0x5b1563){const _0x2e50d5=_0x26ca9a;var _0x2b8b98,_0x437ced={},_0x540123=null,_0x1fcfcf=null;_0x5b1563!==void 0x0&&(_0x540123=''+_0x5b1563),_0x3eed2b[_0x2e50d5(0x105)]!==void 0x0&&(_0x540123=''+_0x3eed2b[_0x2e50d5(0x105)]),_0x3eed2b[_0x2e50d5(0xe7)]!==void 0x0&&(_0x1fcfcf=_0x3eed2b[_0x2e50d5(0xe7)]);for(_0x2b8b98 in _0x3eed2b)m[_0x2e50d5(0x132)](_0x3eed2b,_0x2b8b98)&&!p[_0x2e50d5(0xcc)](_0x2b8b98)&&(_0x437ced[_0x2b8b98]=_0x3eed2b[_0x2b8b98]);if(_0x3630e6&&_0x3630e6[_0x2e50d5(0x10d)]){for(_0x2b8b98 in(_0x3eed2b=_0x3630e6[_0x2e50d5(0x10d)],_0x3eed2b))_0x437ced[_0x2b8b98]===void 0x0&&(_0x437ced[_0x2b8b98]=_0x3eed2b[_0x2b8b98]);}return{'$$typeof':k,'type':_0x3630e6,'key':_0x540123,'ref':_0x1fcfcf,'props':_0x437ced,'_owner':n['current']};}__name(q,'q'),reactJsxRuntime_production_min[_0x26ca9a(0x11f)]=l,reactJsxRuntime_production_min[_0x26ca9a(0x115)]=q,reactJsxRuntime_production_min['jsxs']=q,jsxRuntime['exports']=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime[_0x26ca9a(0xc9)];function SearchInput(_0xe4300d){const _0x20b465=_0x26ca9a,{findCompleted:_0xa0e2ad,localeService:_0x3ce5eb,matchesCount:_0x5819e6,matchesPosition:_0x566bb3,findString:_0x223646,findReplaceService:_0x1aab53,onChange:_0x57264a,..._0x57414e}=_0xe4300d,_0x135b26=_0xa0e2ad&&_0x5819e6===0x0?_0x3ce5eb['t'](_0x20b465(0x152)):_0x5819e6===0x0?'\x20':void 0x0;return jsxRuntimeExports['jsx'](InputWithSlot,{'autoFocus':!0x0,'placeholder':_0x3ce5eb['t']('find-replace.dialog.find-placeholder'),'slot':jsxRuntimeExports[_0x20b465(0x115)](Pager,{'loop':!0x0,'text':_0x135b26,'value':_0x566bb3,'total':_0x5819e6,'onChange':__name(_0x7ed899=>{const _0x37e521=_0x20b465;_0x566bb3===_0x5819e6&&_0x7ed899===0x1?_0x1aab53[_0x37e521(0x15a)]():_0x566bb3===0x1&&_0x7ed899===_0x5819e6||_0x7ed899<_0x566bb3?_0x1aab53['moveToPreviousMatch']():_0x1aab53[_0x37e521(0x15a)]();},_0x20b465(0x156))}),'value':_0x223646,'onChange':__name(_0x4781a4=>_0x57264a==null?void 0x0:_0x57264a(_0x4781a4),_0x20b465(0x156)),..._0x57414e});}__name(SearchInput,_0x26ca9a(0xb8));const findReplaceDialogContainer=_0x26ca9a(0x8d),findReplaceExpandContainer=_0x26ca9a(0xb1),buttonText=_0x26ca9a(0x1a0),findReplaceButtonsGroup='univer-find-replace-buttons-group',findReplaceButtonsGroupRight=_0x26ca9a(0x7b),styles={'findReplaceDialogContainer':findReplaceDialogContainer,'findReplaceExpandContainer':findReplaceExpandContainer,'buttonText':buttonText,'findReplaceButtonsGroup':findReplaceButtonsGroup,'findReplaceButtonsGroupRight':findReplaceButtonsGroupRight};function useFindInputFocus(_0xe8eae3,_0x4e83f3){const _0x2d1778=useCallback(()=>{const _0x3916c2=_0x4549;var _0x2fc6fe;(_0x2fc6fe=document[_0x3916c2(0x15b)](_0x3916c2(0xaa)))==null||_0x2fc6fe[_0x3916c2(0x158)]();},[]),_0x2a9834=useCallback(()=>{const _0x2366cd=_0x4549,_0x209126=document['querySelectorAll'](_0x2366cd(0x126));return Array[_0x2366cd(0x93)](_0x209126)['some'](_0x50c90b=>_0x50c90b===document[_0x2366cd(0xe0)]);},[]);return useImperativeHandle(_0x4e83f3,()=>({'focus':_0x2d1778,'selectHasFocus':_0x2a9834})),useEffect(()=>{const _0x53353b=_0x4549,_0x180881=_0xe8eae3[_0x53353b(0x177)][_0x53353b(0x17e)](()=>_0x2d1778());return()=>_0x180881[_0x53353b(0xf2)]();},[_0xe8eae3,_0x2d1778]),{'focus':_0x2d1778,'selectHasFocus':_0x2a9834};}__name(useFindInputFocus,_0x26ca9a(0xf0));const FindDialog=forwardRef(__name(function(_0x5f4c81,_0x3aa29c){const _0x4d5685=_0x26ca9a,_0x4343b0=useDependency(LocaleService),_0x166bac=useDependency(IFindReplaceService),_0x172ec1=useDependency(ICommandService),_0x41f613=useObservable(_0x166bac[_0x4d5685(0xb9)],void 0x0,!0x0),{findCompleted:_0x594c28,findString:_0x3e33db,matchesCount:_0x5aac6c,matchesPosition:_0x4a07ac}=_0x41f613,_0x14a980=useCallback(()=>{const _0x291c5c=_0x4d5685;_0x172ec1[_0x291c5c(0x17b)](OpenReplaceDialogOperation['id']);},[_0x172ec1]),_0x1c0d5d=useCallback(_0x137e28=>_0x166bac['changeFindString'](_0x137e28),[_0x166bac]);return useFindInputFocus(_0x166bac,_0x3aa29c),jsxRuntimeExports[_0x4d5685(0x122)](Fragment,{'children':[jsxRuntimeExports['jsx'](SearchInput,{'findCompleted':_0x594c28,'className':_0x4d5685(0xff),'matchesCount':_0x5aac6c,'matchesPosition':_0x4a07ac,'findReplaceService':_0x166bac,'localeService':_0x4343b0,'findString':_0x3e33db,'onChange':_0x1c0d5d}),jsxRuntimeExports[_0x4d5685(0x115)](_0x4d5685(0xd9),{'className':styles['findReplaceExpandContainer'],'children':jsxRuntimeExports[_0x4d5685(0x115)](Button,{'type':_0x4d5685(0x6f),'size':'small','onClick':_0x14a980,'children':_0x4343b0['t'](_0x4d5685(0xf1))})})]});},_0x26ca9a(0x143))),ReplaceDialog=forwardRef(__name(function(_0x16563b,_0xcc780c){const _0x4bd12c=_0x26ca9a,_0x222c68=useDependency(IFindReplaceService),_0x2b7bb3=useDependency(LocaleService),_0x5ba567=useDependency(ICommandService),_0x563cc0=useDependency(IMessageService),_0x2a79ae=useObservable(_0x222c68[_0x4bd12c(0xf8)],void 0x0,!0x0),_0x4ed50c=useObservable(_0x222c68[_0x4bd12c(0x168)],void 0x0,!0x0),_0x3d8007=useObservable(_0x222c68[_0x4bd12c(0xb9)],void 0x0,!0x0),{matchesCount:_0x333629,matchesPosition:_0x5d1444,findString:_0x5770df,inputtingFindString:_0x49dc45,replaceString:_0x563881,caseSensitive:_0x594287,matchesTheWholeCell:_0x5bb011,findDirection:_0x5d5c64,findScope:_0x1dc47e,findBy:_0x3bcaac,findCompleted:_0x300e98}=_0x3d8007,_0xa398f1=_0x49dc45[_0x4bd12c(0x19f)]===0x0,_0x2b308c=_0x333629===0x0||!(_0x2a79ae!=null&&_0x2a79ae[_0x4bd12c(0x16c)]),_0xee46e4=_0x4ed50c['length']===0x0,_0x29e4f8=useCallback(_0x186bd2=>_0x222c68[_0x4bd12c(0x11a)](_0x186bd2),[_0x222c68]),_0x9b659=useCallback(_0x17c890=>_0x222c68[_0x4bd12c(0x145)](_0x17c890),[_0x222c68]),{focus:_0x2cbe22}=useFindInputFocus(_0x222c68,_0xcc780c),_0x2a55fa=useCallback(()=>{const _0x55ebb2=_0x4bd12c;_0x5770df===_0x49dc45?_0x222c68[_0x55ebb2(0x15a)]():(_0x222c68[_0x55ebb2(0x197)](_0x49dc45),_0x222c68[_0x55ebb2(0x166)]());},[_0x5770df,_0x49dc45,_0x222c68]),_0x594f7d=useCallback(()=>_0x5ba567[_0x4bd12c(0x17b)](ReplaceCurrentMatchCommand['id']),[_0x5ba567]),_0x3ae0ec=useCallback(async()=>{const _0x34879d=_0x4bd12c;await _0x5ba567[_0x34879d(0x17b)](ReplaceAllMatchesCommand['id']),_0x2cbe22();},[_0x5ba567]),_0xeda9a4=useCallback(_0x586ce1=>{const _0x5460b6=_0x4bd12c;_0x222c68[_0x5460b6(0xc3)](_0x586ce1);},[_0x222c68]),_0x3c240d=useCallback(_0x4f4a5a=>{_0x222c68['changeFindScope'](_0x4f4a5a);},[_0x222c68]),_0x16cfd6=useCallback(_0x26c2fb=>{const _0x221db7=_0x4bd12c;_0x222c68[_0x221db7(0x15f)](_0x26c2fb);},[_0x222c68]),_0x5dbef6=useFindScopeOptions(_0x2b7bb3),_0x11c1d4=useFindDirectionOptions(_0x2b7bb3),_0x340805=useFindByOptions(_0x2b7bb3);return useEffect(()=>{const _0xb5b237=_0x4bd12c,_0x123528=_0x300e98&&_0x333629===0x0;let _0x3ee742=null;return _0x123528&&(_0x3ee742=_0x563cc0['show']({'content':_0x2b7bb3['t'](_0xb5b237(0xa3)),'type':MessageType[_0xb5b237(0x8b)],'duration':0x1388})),()=>_0x3ee742==null?void 0x0:_0x3ee742[_0xb5b237(0x127)]();},[_0x300e98,_0x333629,_0x563cc0,_0x2b7bb3]),jsxRuntimeExports[_0x4bd12c(0x122)](Fragment,{'children':[jsxRuntimeExports[_0x4bd12c(0x115)](FormLayout,{'label':_0x2b7bb3['t'](_0x4bd12c(0x11b)),'children':jsxRuntimeExports[_0x4bd12c(0x115)](SearchInput,{'findCompleted':_0x300e98,'className':_0x4bd12c(0xff),'matchesCount':_0x333629,'matchesPosition':_0x5d1444,'findReplaceService':_0x222c68,'localeService':_0x2b7bb3,'findString':_0x49dc45,'onChange':_0x29e4f8})}),jsxRuntimeExports[_0x4bd12c(0x115)](FormLayout,{'label':_0x2b7bb3['t'](_0x4bd12c(0x185)),'children':jsxRuntimeExports['jsx'](Input,{'placeholder':_0x2b7bb3['t'](_0x4bd12c(0x171)),'value':_0x563881,'onChange':__name(_0x243080=>_0x9b659(_0x243080),'onChange')})}),jsxRuntimeExports['jsx'](FormLayout,{'label':_0x2b7bb3['t'](_0x4bd12c(0x16f)),'children':jsxRuntimeExports[_0x4bd12c(0x115)](Select,{'value':_0x5d5c64,'options':_0x11c1d4,'onChange':_0xeda9a4})}),jsxRuntimeExports[_0x4bd12c(0x115)](FormDualColumnLayout,{'children':jsxRuntimeExports[_0x4bd12c(0x122)](Fragment,{'children':[jsxRuntimeExports[_0x4bd12c(0x115)](FormLayout,{'label':_0x2b7bb3['t'](_0x4bd12c(0x15c)),'children':jsxRuntimeExports[_0x4bd12c(0x115)](Select,{'value':_0x1dc47e,'options':_0x5dbef6,'onChange':_0x3c240d})}),jsxRuntimeExports[_0x4bd12c(0x115)](FormLayout,{'label':_0x2b7bb3['t'](_0x4bd12c(0xa0)),'children':jsxRuntimeExports[_0x4bd12c(0x115)](Select,{'value':_0x3bcaac,'options':_0x340805,'onChange':_0x16cfd6})})]})}),jsxRuntimeExports[_0x4bd12c(0x115)](FormDualColumnLayout,{'children':jsxRuntimeExports[_0x4bd12c(0x122)](Fragment,{'children':[jsxRuntimeExports[_0x4bd12c(0x115)](FormLayout,{'children':jsxRuntimeExports[_0x4bd12c(0x115)](Checkbox,{'checked':_0x594287,'onChange':__name(_0x3d1b25=>{const _0x2e5974=_0x4bd12c;_0x222c68[_0x2e5974(0x196)](_0x3d1b25);},'onChange'),'children':_0x2b7bb3['t']('find-replace.dialog.case-sensitive')})}),jsxRuntimeExports['jsx'](FormLayout,{'children':jsxRuntimeExports[_0x4bd12c(0x115)](Checkbox,{'checked':_0x5bb011,'onChange':__name(_0x4c7aee=>{const _0x477ed3=_0x4bd12c;_0x222c68[_0x477ed3(0x7c)](_0x4c7aee);},_0x4bd12c(0x156)),'children':_0x2b7bb3['t'](_0x4bd12c(0xc4))})})]})}),jsxRuntimeExports[_0x4bd12c(0x122)](_0x4bd12c(0xd9),{'className':styles[_0x4bd12c(0x164)],'children':[jsxRuntimeExports['jsx'](Button,{'type':_0x4bd12c(0x149),'onClick':_0x2a55fa,'disabled':_0xa398f1,'children':_0x2b7bb3['t']('find-replace.dialog.find')}),jsxRuntimeExports['jsxs']('span',{'className':styles[_0x4bd12c(0xb6)],'children':[jsxRuntimeExports['jsx'](Button,{'disabled':_0x2b308c,'onClick':_0x594f7d,'children':_0x2b7bb3['t'](_0x4bd12c(0x185))}),jsxRuntimeExports[_0x4bd12c(0x115)](Button,{'disabled':_0xee46e4,'onClick':_0x3ae0ec,'children':_0x2b7bb3['t']('find-replace.dialog.replace-all')})]})]})]});},_0x26ca9a(0x140)));function FindReplaceDialog(){const _0x18242b=_0x26ca9a,_0x99e6c5=useDependency(IFindReplaceService),_0x4f1f6c=useDependency(ILayoutService),_0x32a891=useDependency(IContextService),_0x30c265=useObservable(_0x99e6c5['state$'],void 0x0,!0x0),_0x5948c3=useRef(null);useEffect(()=>{const _0x2986f7=_0x4549;let _0x1d5048;return _0x5948c3[_0x2986f7(0xdf)]&&(_0x1d5048=_0x4f1f6c[_0x2986f7(0xe5)](_0x5948c3[_0x2986f7(0xdf)])),()=>_0x1d5048==null?void 0x0:_0x1d5048['dispose']();},[_0x4f1f6c]);const _0xd45834=useRef(null),_0x2e5948=useCallback(_0x1bb92e=>_0x32a891[_0x18242b(0x7d)](FIND_REPLACE_DIALOG_FOCUS,_0x1bb92e),[_0x32a891]),_0x98608f=useCallback(_0x36a48e=>_0x32a891[_0x18242b(0x7d)](FIND_REPLACE_INPUT_FOCUS,_0x36a48e),[_0x32a891]);return useEffect(()=>{const _0x524fd6=_0x18242b;var _0x3f507b;const _0x1972a2=fromEvent(document,_0x524fd6(0x10e))[_0x524fd6(0x17e)](_0x8b4884=>{const _0x26e2e5=_0x524fd6;var _0x16d2c5;_0x8b4884[_0x26e2e5(0x9b)]&&((_0x16d2c5=_0x5948c3[_0x26e2e5(0xdf)])!=null&&_0x16d2c5['contains'](_0x8b4884['target']))?_0x2e5948(!0x0):_0x2e5948(!0x1),!_0xd45834[_0x26e2e5(0xdf)]||!_0xd45834[_0x26e2e5(0xdf)][_0x26e2e5(0xc2)]()?_0x98608f(!0x0):_0x98608f(!0x1);});return(_0x3f507b=_0xd45834['current'])==null||_0x3f507b[_0x524fd6(0x158)](),_0x2e5948(!0x0),_0x98608f(!0x0),()=>{_0x1972a2['unsubscribe'](),_0x2e5948(!0x1);};},[_0x2e5948,_0x98608f]),jsxRuntimeExports[_0x18242b(0x115)](_0x18242b(0xd9),{'className':styles[_0x18242b(0x10a)],'ref':_0x5948c3,'children':_0x30c265['replaceRevealed']?jsxRuntimeExports[_0x18242b(0x115)](ReplaceDialog,{'ref':_0xd45834}):jsxRuntimeExports[_0x18242b(0x115)](FindDialog,{'ref':_0xd45834})});}__name(FindReplaceDialog,_0x26ca9a(0x90));function useFindScopeOptions(_0x1ea0ce){const _0x5bcf79=_0x26ca9a,_0x6ce79d=_0x1ea0ce['getCurrentLocale']();return useMemo(()=>[{'label':_0x1ea0ce['t'](_0x5bcf79(0x17a)),'value':FindScope[_0x5bcf79(0x123)]},{'label':_0x1ea0ce['t']('find-replace.dialog.find-scope.workbook'),'value':FindScope[_0x5bcf79(0x113)]}],[_0x6ce79d]);}__name(useFindScopeOptions,'useFindScopeOptions');function useFindDirectionOptions(_0x532645){const _0x10df37=_0x26ca9a,_0x2bec42=_0x532645[_0x10df37(0x74)]();return useMemo(()=>[{'label':_0x532645['t'](_0x10df37(0x18c)),'value':FindDirection[_0x10df37(0x147)]},{'label':_0x532645['t'](_0x10df37(0x14c)),'value':FindDirection[_0x10df37(0x18b)]}],[_0x2bec42]);}__name(useFindDirectionOptions,_0x26ca9a(0x189));function useFindByOptions(_0x29ccb9){const _0x4ab110=_0x26ca9a,_0x5c08f7=_0x29ccb9[_0x4ab110(0x74)]();return useMemo(()=>[{'label':_0x29ccb9['t'](_0x4ab110(0x16b)),'value':FindBy[_0x4ab110(0x191)]},{'label':_0x29ccb9['t'](_0x4ab110(0x142)),'value':FindBy[_0x4ab110(0x19a)]}],[_0x5c08f7]);}__name(useFindByOptions,_0x26ca9a(0xdc));function whenFindReplaceDialogFocused(_0x258fa3){const _0x490e31=_0x26ca9a;return _0x258fa3[_0x490e31(0x118)](FIND_REPLACE_DIALOG_FOCUS);}__name(whenFindReplaceDialogFocused,_0x26ca9a(0x167));function whenReplaceRevealed(_0x19516a){const _0x5b49f1=_0x26ca9a;return _0x19516a[_0x5b49f1(0x118)](FIND_REPLACE_REPLACE_REVEALED);}__name(whenReplaceRevealed,_0x26ca9a(0xfd));function whenFindReplaceInputFocused(_0x1bed70){return _0x1bed70['getContextValue'](FIND_REPLACE_INPUT_FOCUS);}__name(whenFindReplaceInputFocused,_0x26ca9a(0xfc));const FIND_REPLACE_SHORTCUT_GROUP='7_find-replace-shortcuts';function whenSheetFocused(_0x5d5d71){const _0x573c4f=_0x26ca9a;return _0x5d5d71[_0x573c4f(0x118)](FOCUSING_SHEET);}__name(whenSheetFocused,'whenSheetFocused');function whenEditorNotActivated(_0x538e06){const _0x5bfb83=_0x26ca9a;return!_0x538e06[_0x5bfb83(0x118)](EDITOR_ACTIVATED);}__name(whenEditorNotActivated,_0x26ca9a(0x13c));const OpenFindDialogShortcutItem={'id':OpenFindDialogOperation['id'],'description':_0x26ca9a(0xa8),'binding':KeyCode['F']|MetaKeys[_0x26ca9a(0xd5)],'group':FIND_REPLACE_SHORTCUT_GROUP,'preconditions'(_0x289af8){return!whenFindReplaceDialogFocused(_0x289af8)&&whenSheetFocused(_0x289af8)&&whenEditorNotActivated(_0x289af8);}},MacOpenFindDialogShortcutItem={'id':OpenFindDialogOperation['id'],'description':_0x26ca9a(0xa8),'binding':KeyCode['F']|MetaKeys[_0x26ca9a(0xd5)],'mac':KeyCode['F']|MetaKeys[_0x26ca9a(0x13e)],'preconditions'(_0x44d7f7){return!whenFindReplaceDialogFocused(_0x44d7f7)&&whenSheetFocused(_0x44d7f7)&&whenEditorNotActivated(_0x44d7f7);}},OpenReplaceDialogShortcutItem={'id':OpenReplaceDialogOperation['id'],'description':_0x26ca9a(0xe2),'binding':KeyCode['H']|MetaKeys['CTRL_COMMAND'],'mac':KeyCode['H']|MetaKeys[_0x26ca9a(0x13e)],'group':FIND_REPLACE_SHORTCUT_GROUP,'preconditions'(_0x566768){return whenSheetFocused(_0x566768)&&whenEditorNotActivated(_0x566768)&&(!whenFindReplaceDialogFocused(_0x566768)||!whenReplaceRevealed(_0x566768));}},GoToNextFindMatchShortcutItem={'id':GoToNextMatchOperation['id'],'description':_0x26ca9a(0xfe),'binding':KeyCode['ENTER'],'group':FIND_REPLACE_SHORTCUT_GROUP,'priority':0x3e8,'preconditions'(_0x287055){return whenFindReplaceInputFocused(_0x287055)&&whenFindReplaceDialogFocused(_0x287055);}},GoToPreviousFindMatchShortcutItem={'id':GoToPreviousMatchOperation['id'],'description':_0x26ca9a(0xf9),'binding':KeyCode[_0x26ca9a(0x182)]|MetaKeys['SHIFT'],'group':FIND_REPLACE_SHORTCUT_GROUP,'priority':0x3e8,'preconditions'(_0xffe91c){return whenFindReplaceInputFocused(_0xffe91c)&&whenFindReplaceDialogFocused(_0xffe91c);}};function FindReplaceMenuItemFactory(_0x3f92dd){const _0xa2d6cd=_0x26ca9a,_0x498801=_0x3f92dd[_0xa2d6cd(0xe3)](IContextService);return{'id':OpenFindDialogOperation['id'],'icon':_0xa2d6cd(0x170),'tooltip':_0xa2d6cd(0x99),'type':MenuItemType[_0xa2d6cd(0xd8)],'hidden$':getMenuHiddenObservable(_0x3f92dd,UniverInstanceType[_0xa2d6cd(0x87)]),'disabled$':combineLatest([_0x498801[_0xa2d6cd(0x14b)](EDITOR_ACTIVATED),_0x498801['subscribeContextValue$'](FOCUSING_SHEET)])[_0xa2d6cd(0xa1)](map(([_0x26c2ed,_0x2c3f1e])=>_0x26c2ed||!_0x2c3f1e))};}__name(FindReplaceMenuItemFactory,_0x26ca9a(0x114));const menuSchema={[RibbonStartGroup[_0x26ca9a(0x92)]]:{[OpenFindDialogOperation['id']]:{'order':0x2,'menuItemFactory':FindReplaceMenuItemFactory}}};var __defProp$1=Object[_0x26ca9a(0x14e)],__getOwnPropDesc$1=Object[_0x26ca9a(0xef)],__decorateClass$1=__name((_0x595138,_0x4fdf6c,_0x5ae887,_0x32344a)=>{const _0x2d55ca=_0x26ca9a;for(var _0x4c8fa6=_0x32344a>0x1?void 0x0:_0x32344a?__getOwnPropDesc$1(_0x4fdf6c,_0x5ae887):_0x4fdf6c,_0x3af010=_0x595138[_0x2d55ca(0x19f)]-0x1,_0xcaa72c;_0x3af010>=0x0;_0x3af010--)(_0xcaa72c=_0x595138[_0x3af010])&&(_0x4c8fa6=(_0x32344a?_0xcaa72c(_0x4fdf6c,_0x5ae887,_0x4c8fa6):_0xcaa72c(_0x4c8fa6))||_0x4c8fa6);return _0x32344a&&_0x4c8fa6&&__defProp$1(_0x4fdf6c,_0x5ae887,_0x4c8fa6),_0x4c8fa6;},'__decorateClass$1'),__decorateParam$1=__name((_0x4228bf,_0x16a2e2)=>(_0x298852,_0x5049e2)=>_0x16a2e2(_0x298852,_0x5049e2,_0x4228bf),_0x26ca9a(0x124));const FIND_REPLACE_DIALOG_ID=_0x26ca9a(0x8c),FIND_REPLACE_PANEL_WIDTH=0x15e,FIND_REPLACE_PANEL_RIGHT_PADDING=0x14,FIND_REPLACE_PANEL_TOP_PADDING=-0x5a;var _a3;let FindReplaceController=(_a3=class extends RxDisposable{constructor(_0x1ee749,_0x33d3cf,_0x1970d6,_0x33bf3a,_0x521429,_0x58cae5,_0x291698,_0x4577a4,_0x336d4b,_0x544071){const _0xb38d4c=_0x26ca9a;super(),__publicField(this,_0xb38d4c(0xbc)),(this['_univerInstanceService']=_0x1ee749,this[_0xb38d4c(0xa2)]=_0x33d3cf,this['_shortcutService']=_0x1970d6,this[_0xb38d4c(0x85)]=_0x33bf3a,this[_0xb38d4c(0x184)]=_0x521429,this[_0xb38d4c(0x155)]=_0x58cae5,this['_layoutService']=_0x291698,this['_localeService']=_0x4577a4,this['_componentManager']=_0x336d4b,this[_0xb38d4c(0x17c)]=_0x544071,this[_0xb38d4c(0xbf)](),this[_0xb38d4c(0x9d)](),this[_0xb38d4c(0x11e)]());}[_0x26ca9a(0x127)](){const _0x455b2d=_0x26ca9a;var _0x324f02;super[_0x455b2d(0x127)](),(_0x324f02=this[_0x455b2d(0xbc)])==null||_0x324f02[_0x455b2d(0x127)](),this[_0x455b2d(0xbc)]=null;}['_initCommands'](){const _0x49dda8=_0x26ca9a;[OpenFindDialogOperation,OpenReplaceDialogOperation,GoToNextMatchOperation,GoToPreviousMatchOperation,ReplaceAllMatchesCommand,ReplaceCurrentMatchCommand][_0x49dda8(0x125)](_0x3cb1a4=>{const _0x449054=_0x49dda8;this[_0x449054(0x101)](this[_0x449054(0x85)][_0x449054(0x112)](_0x3cb1a4));});}['_initShortcuts'](){const _0x293cfd=_0x26ca9a;[OpenReplaceDialogShortcutItem,OpenFindDialogShortcutItem,MacOpenFindDialogShortcutItem,GoToPreviousFindMatchShortcutItem,GoToNextFindMatchShortcutItem]['forEach'](_0x29ae45=>this[_0x293cfd(0x101)](this[_0x293cfd(0x13f)]['registerShortcut'](_0x29ae45)));}[_0x26ca9a(0x9d)](){const _0x207f4b=_0x26ca9a;this[_0x207f4b(0x101)](this[_0x207f4b(0x119)][_0x207f4b(0xa5)]('FindReplaceDialog',FindReplaceDialog)),this[_0x207f4b(0x101)](this['_componentManager'][_0x207f4b(0xa5)](_0x207f4b(0x170),SearchSingle16)),this[_0x207f4b(0xa2)][_0x207f4b(0x12a)](menuSchema),this[_0x207f4b(0x184)][_0x207f4b(0x9a)][_0x207f4b(0xa1)](takeUntil(this[_0x207f4b(0x102)]))[_0x207f4b(0x17e)](_0x5757ff=>{const _0x215ae1=_0x207f4b;_0x5757ff['revealed']===!0x0&&this[_0x215ae1(0xfb)]();});}[_0x26ca9a(0xfb)](){const _0x3898ab=_0x26ca9a;this['_dialogService'][_0x3898ab(0xd4)]({'id':FIND_REPLACE_DIALOG_ID,'draggable':!0x0,'width':FIND_REPLACE_PANEL_WIDTH,'title':{'title':this[_0x3898ab(0x179)]['t'](_0x3898ab(0x19c))},'children':{'label':'FindReplaceDialog'},'destroyOnClose':!0x0,'defaultPosition':getFindReplaceDialogDefaultPosition(),'preservePositionOnDestroy':!0x0,'onClose':__name(()=>this['closePanel'](),_0x3898ab(0x86))}),this['_closingListenerDisposable']=toDisposable(this['_univerInstanceService'][_0x3898ab(0x89)][_0x3898ab(0xa1)](takeUntil(this[_0x3898ab(0x102)]))['subscribe'](_0x418dae=>{const _0xdc9779=_0x3898ab;(!_0x418dae||!this['_univerInstanceService'][_0xdc9779(0x160)](_0x418dae))&&this[_0xdc9779(0x183)]();}));}['closePanel'](){const _0x516ffe=_0x26ca9a;this[_0x516ffe(0xbc)]&&(this[_0x516ffe(0xbc)][_0x516ffe(0x127)](),this['_closingListenerDisposable']=null,this[_0x516ffe(0x155)]['close'](FIND_REPLACE_DIALOG_ID),this[_0x516ffe(0x184)][_0x516ffe(0xbe)](),queueMicrotask(()=>this['_layoutService'][_0x516ffe(0x158)]()));}},__name(_a3,'FindReplaceController'),_a3);FindReplaceController=__decorateClass$1([__decorateParam$1(0x0,IUniverInstanceService),__decorateParam$1(0x1,IMenuManagerService),__decorateParam$1(0x2,IShortcutService),__decorateParam$1(0x3,ICommandService),__decorateParam$1(0x4,IFindReplaceService),__decorateParam$1(0x5,IDialogService),__decorateParam$1(0x6,ILayoutService),__decorateParam$1(0x7,Inject(LocaleService)),__decorateParam$1(0x8,Inject(ComponentManager)),__decorateParam$1(0x9,Inject(Injector))],FindReplaceController);function getFindReplaceDialogDefaultPosition(){const {innerWidth:_0x19223c}=window;return{'x':(_0x19223c-FIND_REPLACE_PANEL_WIDTH)/0x2-FIND_REPLACE_PANEL_RIGHT_PADDING,'y':FIND_REPLACE_PANEL_TOP_PADDING};}__name(getFindReplaceDialogDefaultPosition,_0x26ca9a(0xb2));var __defProp2=Object[_0x26ca9a(0x14e)],__getOwnPropDesc=Object['getOwnPropertyDescriptor'],__decorateClass=__name((_0x15bf02,_0x3fe34d,_0x34461d,_0xcd3e5c)=>{const _0x2b00ad=_0x26ca9a;for(var _0x205585=_0xcd3e5c>0x1?void 0x0:_0xcd3e5c?__getOwnPropDesc(_0x3fe34d,_0x34461d):_0x3fe34d,_0x4d8d1d=_0x15bf02[_0x2b00ad(0x19f)]-0x1,_0x50d0e1;_0x4d8d1d>=0x0;_0x4d8d1d--)(_0x50d0e1=_0x15bf02[_0x4d8d1d])&&(_0x205585=(_0xcd3e5c?_0x50d0e1(_0x3fe34d,_0x34461d,_0x205585):_0x50d0e1(_0x205585))||_0x205585);return _0xcd3e5c&&_0x205585&&__defProp2(_0x3fe34d,_0x34461d,_0x205585),_0x205585;},_0x26ca9a(0xc5)),__decorateParam=__name((_0x5726a5,_0x32f4f7)=>(_0x136a09,_0x2aee55)=>_0x32f4f7(_0x136a09,_0x2aee55,_0x5726a5),_0x26ca9a(0x12d));const PLUGIN_NAME=_0x26ca9a(0x70);var _a4;let UniverFindReplacePlugin=(_a4=class extends Plugin{constructor(_0x11b2ed=defaultPluginConfig,_0x239c8,_0x1adcf9){const _0xc99f96=_0x26ca9a;super(),this[_0xc99f96(0xf7)]=_0x11b2ed,this[_0xc99f96(0x17c)]=_0x239c8,this[_0xc99f96(0x18e)]=_0x1adcf9;const {..._0x445c0c}=this[_0xc99f96(0xf7)];this[_0xc99f96(0x18e)]['setConfig'](PLUGIN_CONFIG_KEY,_0x445c0c);}[_0x26ca9a(0x178)](){const _0x588fc8=_0x26ca9a;[[FindReplaceController],[IFindReplaceService,{'useClass':FindReplaceService}]]['forEach'](_0x46b703=>this['_injector'][_0x588fc8(0x8a)](_0x46b703));}[_0x26ca9a(0xad)](){const _0xff6460=_0x26ca9a;this[_0xff6460(0x17c)][_0xff6460(0xe3)](FindReplaceController);}},__name(_a4,'UniverFindReplacePlugin'),__publicField(_a4,'pluginName',PLUGIN_NAME),_a4);UniverFindReplacePlugin=__decorateClass([__decorateParam(0x1,Inject(Injector)),__decorateParam(0x2,IConfigService)],UniverFindReplacePlugin);export{FindBy,FindDirection,FindModel,FindReplaceController,FindScope,GoToNextMatchOperation,GoToPreviousMatchOperation,IFindReplaceService,OpenFindDialogOperation,OpenReplaceDialogOperation,ReplaceAllMatchesCommand,ReplaceCurrentMatchCommand,UniverFindReplacePlugin};