@react-pdf-kit/viewer 2.0.1-rc.2 → 2.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,25 @@
1
- import { jsx as o, Fragment as at, jsxs as C } from "react/jsx-runtime";
2
- import { UIButton as ct } from "../../ui/Button.js";
1
+ import { jsx as o, Fragment as pt, jsxs as x } from "react/jsx-runtime";
2
+ import { UIButton as mt } from "../../ui/Button.js";
3
3
  import { SearchIcon as A } from "../../icons/SearchIcon.js";
4
- import { useState as b, useCallback as i, useEffect as l, useMemo as W } from "react";
5
- import { useLayoutContainer as pt } from "../../../contexts/LayoutContainerContext.js";
4
+ import { useState as S, useCallback as i, useEffect as h, useMemo as W } from "react";
5
+ import { useLayoutContainer as st } from "../../../contexts/LayoutContainerContext.js";
6
6
  import { c as n } from "../../../SearchTool.module-99f60dc7.js";
7
- import { UIInput as mt } from "../../ui/Input.js";
7
+ import { UIInput as lt } from "../../ui/Input.js";
8
8
  import { UICheckbox as $ } from "../../ui/Checkbox.js";
9
9
  import { ClearIcon as ht } from "../../icons/ClearIcon.js";
10
- import { LoaderIcon as lt } from "../../icons/LoaderIcon.js";
11
- import { useSearchContext as st } from "../../../contexts/SearchContext.js";
12
- import { useIconContext as dt } from "../../../contexts/IconContext.js";
13
- import { useDocumentContext as ut } from "../../../contexts/RPDocumentContext.js";
14
- import E from "../../ui/RPTooltip.js";
15
- import { useToolbarComponentContext as ft } from "../../../contexts/ToolbarComponentContext.js";
16
- import { useLocalizationContext as It } from "../../../contexts/LocalizationContext.js";
10
+ import { LoaderIcon as dt } from "../../icons/LoaderIcon.js";
11
+ import { useSearchContext as ut } from "../../../contexts/SearchContext.js";
12
+ import { useIconContext as F } from "../../../contexts/IconContext.js";
13
+ import { useDocumentContext as ft } from "../../../contexts/RPDocumentContext.js";
14
+ import v from "../../ui/RPTooltip.js";
15
+ import { useToolbarComponentContext as It } from "../../../contexts/ToolbarComponentContext.js";
16
+ import { useLocalizationContext as Ct } from "../../../contexts/LocalizationContext.js";
17
17
  import { InfoIcon as j } from "../../icons/InfoIcon.js";
18
- import { useViewportContext as Ct } from "../../../contexts/ViewportContext.js";
18
+ import { useViewportContext as bt } from "../../../contexts/ViewportContext.js";
19
19
  import { SearchResultNavigator as q } from "./SearchResultNavigator.js";
20
20
  import { SearchCloseButton as z } from "./SearchCloseButton.js";
21
- import { UIDropDown as bt } from "../../ui/DropDown.js";
22
- import { useIconToolContext as xt } from "../../../contexts/IconToolContext.js";
21
+ import { UIDropDown as xt } from "../../ui/DropDown.js";
22
+ import { useIconToolContext as H } from "../../../contexts/IconToolContext.js";
23
23
  import { useToolComponentContext as St } from "../../../contexts/ToolComponentContext.js";
24
24
  import "../../../clsx-0c6e471a.js";
25
25
  import "../../../utils/withRef.js";
@@ -69,78 +69,81 @@ import "../../icons/CloseIcon.js";
69
69
  import "../../../index-61f59539.js";
70
70
  import "../../../Combination-136ff99c.js";
71
71
  const yt = () => {
72
- const { searchIcon: x } = dt(), { searchIcon: v } = xt();
73
- return x || v || /* @__PURE__ */ o(A, {});
74
- }, jo = ({ icon: x }) => {
75
- const { container: v } = pt(), [s, L] = b(!1), { pdf: S } = ut(), [k, F] = b(null), {
72
+ const { searchIcon: s } = F(), { searchIcon: d } = H();
73
+ return s ?? d ?? /* @__PURE__ */ o(A, {});
74
+ }, Tt = () => {
75
+ const { searchClearIcon: s } = F(), { searchClearIcon: d } = H();
76
+ return s ?? d ?? /* @__PURE__ */ o(ht, {});
77
+ }, qo = ({ icon: s }) => {
78
+ const { container: d } = st(), [u, L] = S(!1), { pdf: y } = ft(), [k, G] = S(null), {
76
79
  searchOptions: D,
77
- setSearchOptions: y,
78
- loading: H,
80
+ setSearchOptions: T,
81
+ loading: J,
79
82
  setSearch: c,
80
83
  totalMatches: K,
81
84
  currentMatchPosition: B,
82
85
  nextMatch: O,
83
86
  prevMatch: P,
84
87
  search: e
85
- } = st(), { searchTool: G = !0 } = ft(), { searchTool: J = !0 } = St(), [d, u] = b(e), { localeMessages: t } = It(), { isSmallScreen: f } = Ct(), [T, Q] = b(null), [X, Y] = b(!1), Z = i(() => {
88
+ } = ut(), { searchTool: Q = !0 } = It(), { searchTool: X = !0 } = St(), [f, I] = S(e), { localeMessages: t } = Ct(), { isSmallScreen: C } = bt(), [E, Y] = S(null), [Z, _] = S(!1), g = i(() => {
86
89
  L(!0);
87
- }, []), h = i(() => {
88
- c(""), u(""), L(!1);
90
+ }, []), l = i(() => {
91
+ c(""), I(""), L(!1);
89
92
  }, [c]), R = (r) => {
90
- const a = r.key === "Enter", I = r.key === " ";
91
- (a || I) && h();
93
+ const a = r.key === "Enter", b = r.key === " ";
94
+ (a || b) && l();
92
95
  }, w = i(
93
96
  (r) => {
94
- r.key === "Escape" && s && h();
97
+ r.key === "Escape" && u && l();
95
98
  },
96
- [s]
97
- ), _ = i(
99
+ [u]
100
+ ), M = i(
98
101
  (r) => {
99
- r.shiftKey && r.key === "Enter" ? P() : r.key === "Enter" && e !== d ? c(d) : r.key === "Enter" && O();
102
+ r.shiftKey && r.key === "Enter" ? P() : r.key === "Enter" && e !== f ? c(f) : r.key === "Enter" && O();
100
103
  },
101
- [d, P, O, c, e]
104
+ [f, P, O, c, e]
102
105
  );
103
- l(() => {
104
- u(e);
105
- }, [e]), l(() => {
106
- e && S && Y(!0);
107
- }, [e, S]), l(() => {
108
- e && e.trim() !== "" && (u(e), c(e));
109
- }, []), l(() => (window.addEventListener("keydown", w), () => {
106
+ h(() => {
107
+ I(e);
108
+ }, [e]), h(() => {
109
+ e && y && _(!0);
110
+ }, [e, y]), h(() => {
111
+ e && e.trim() !== "" && (I(e), c(e));
112
+ }, []), h(() => (window.addEventListener("keydown", w), () => {
110
113
  window.removeEventListener("keydown", w);
111
- }), [w]), l(() => {
114
+ }), [w]), h(() => {
112
115
  k && setTimeout(() => {
113
116
  k.focus();
114
117
  }, 0);
115
118
  }, [k]);
116
- const g = i((r) => {
117
- u(r.target.value);
119
+ const tt = i((r) => {
120
+ I(r.target.value);
118
121
  }, []), U = i(() => {
119
- u(""), c("");
120
- }, [c]), M = W(() => `${B} / ${K}`, [B, K]), { wholeWords: tt, matchCase: ot } = W(() => D, [D]), rt = i(
122
+ I(""), c("");
123
+ }, [c]), ot = W(() => `${B} / ${K}`, [B, K]), { wholeWords: rt, matchCase: et } = W(() => D, [D]), nt = i(
121
124
  (r) => {
122
- y((a) => ({ ...a, matchCase: r }));
125
+ T((a) => ({ ...a, matchCase: r }));
123
126
  },
124
- [y]
125
- ), et = i(
127
+ [T]
128
+ ), it = i(
126
129
  (r) => {
127
- y((a) => ({ ...a, wholeWords: r }));
130
+ T((a) => ({ ...a, wholeWords: r }));
128
131
  },
129
- [y]
132
+ [T]
130
133
  );
131
- l(() => {
132
- S && X && h();
133
- }, [S, h]);
134
- const p = W(() => (T == null ? void 0 : T.querySelectorAll('[tabindex]:not([tabindex="-1"])')) || [], [T]), nt = i(
134
+ h(() => {
135
+ y && Z && l();
136
+ }, [y, l]);
137
+ const p = W(() => (E == null ? void 0 : E.querySelectorAll('[tabindex]:not([tabindex="-1"])')) || [], [E]), at = i(
135
138
  (r) => {
136
139
  if (r.key === "Tab") {
137
140
  const a = document.activeElement;
138
- let I = 0;
139
- p.forEach((m, it) => {
140
- m === a && (I = it);
141
+ let b = 0;
142
+ p.forEach((m, ct) => {
143
+ m === a && (b = ct);
141
144
  });
142
- let N = I + 1;
143
- r.shiftKey && (N = I - 1);
145
+ let N = b + 1;
146
+ r.shiftKey && (N = b - 1);
144
147
  const V = p[N];
145
148
  if (V)
146
149
  V.focus();
@@ -155,54 +158,54 @@ const yt = () => {
155
158
  },
156
159
  [p]
157
160
  );
158
- return !G || !J ? null : /* @__PURE__ */ o(at, { children: /* @__PURE__ */ o(
159
- bt,
161
+ return !Q || !X ? null : /* @__PURE__ */ o(pt, { children: /* @__PURE__ */ o(
162
+ xt,
160
163
  {
161
- open: s,
162
- container: v,
164
+ open: u,
165
+ container: d,
163
166
  side: "bottom",
164
167
  align: "start",
165
168
  tabIndex: 0,
166
169
  avoidCollisions: !1,
167
- triggerComponent: /* @__PURE__ */ o(E, { content: t == null ? void 0 : t.searchButtonTooltip, children: /* @__PURE__ */ o(
168
- ct,
170
+ triggerComponent: /* @__PURE__ */ o(v, { content: t == null ? void 0 : t.searchButtonTooltip, children: /* @__PURE__ */ o(
171
+ mt,
169
172
  {
170
- active: s,
171
- onClick: Z,
173
+ active: u,
174
+ onClick: g,
172
175
  "aria-label": t == null ? void 0 : t.searchButtonTooltip,
173
- "aria-expanded": s,
176
+ "aria-expanded": u,
174
177
  "aria-haspopup": "dialog",
175
- children: x || /* @__PURE__ */ o(yt, {})
178
+ children: s || /* @__PURE__ */ o(yt, {})
176
179
  }
177
180
  ) }),
178
- children: /* @__PURE__ */ C(
181
+ children: /* @__PURE__ */ x(
179
182
  "div",
180
183
  {
181
- ref: Q,
184
+ ref: Y,
182
185
  className: n["rp-search-tool-content"],
183
186
  tabIndex: 0,
184
- onKeyDown: nt,
187
+ onKeyDown: at,
185
188
  role: "dialog",
186
189
  "aria-label": (t == null ? void 0 : t.searchInputTooltip) || "Search dialog",
187
190
  children: [
188
- /* @__PURE__ */ C("div", { className: n["rp-search-tool-input-wrapper"], children: [
189
- /* @__PURE__ */ C("div", { className: n["rp-search-tool-input"], children: [
190
- /* @__PURE__ */ o(E, { content: t == null ? void 0 : t.searchInputTooltip, children: /* @__PURE__ */ o(
191
- mt,
191
+ /* @__PURE__ */ x("div", { className: n["rp-search-tool-input-wrapper"], children: [
192
+ /* @__PURE__ */ x("div", { className: n["rp-search-tool-input"], children: [
193
+ /* @__PURE__ */ o(v, { content: t == null ? void 0 : t.searchInputTooltip, children: /* @__PURE__ */ o(
194
+ lt,
192
195
  {
193
- value: d,
194
- onKeyDown: _,
195
- onChange: g,
196
+ value: f,
197
+ onKeyDown: M,
198
+ onChange: tt,
196
199
  icon: /* @__PURE__ */ o(A, {}),
197
200
  placeholder: t == null ? void 0 : t.searchInputPlaceholder,
198
201
  className: n["rp-search-input"],
199
- ref: F,
202
+ ref: G,
200
203
  id: "search-input",
201
204
  name: "search-input",
202
205
  tabIndex: 0,
203
206
  "aria-label": (t == null ? void 0 : t.searchInputTooltip) || (t == null ? void 0 : t.searchInputPlaceholder),
204
207
  "aria-describedby": "search-results-count",
205
- children: !!d && /* @__PURE__ */ o(
208
+ children: !!f && /* @__PURE__ */ o(
206
209
  "span",
207
210
  {
208
211
  className: n["rp-search-tool-input-clear"],
@@ -213,45 +216,45 @@ const yt = () => {
213
216
  onKeyDown: (r) => {
214
217
  (r.key === "Enter" || r.key === " ") && (r.preventDefault(), U());
215
218
  },
216
- children: /* @__PURE__ */ o(ht, {})
219
+ children: /* @__PURE__ */ o(Tt, {})
217
220
  }
218
221
  )
219
222
  }
220
223
  ) }),
221
- H ? /* @__PURE__ */ o("span", { "aria-live": "polite", "aria-label": "Searching", children: /* @__PURE__ */ o(lt, { className: n["rp-search-loader-icon"], "aria-hidden": "true" }) }) : /* @__PURE__ */ o("span", { id: "search-results-count", "aria-live": "polite", children: M }),
222
- f && /* @__PURE__ */ o("div", { className: n["rp-search-tool-controls"], children: /* @__PURE__ */ o(z, { onKeyPress: R, handleClose: h }) })
224
+ J ? /* @__PURE__ */ o("span", { "aria-live": "polite", "aria-label": "Searching", children: /* @__PURE__ */ o(dt, { className: n["rp-search-loader-icon"], "aria-hidden": "true" }) }) : /* @__PURE__ */ o("span", { id: "search-results-count", "aria-live": "polite", children: ot }),
225
+ C && /* @__PURE__ */ o("div", { className: n["rp-search-tool-controls"], children: /* @__PURE__ */ o(z, { onKeyPress: R, handleClose: l }) })
223
226
  ] }),
224
- /* @__PURE__ */ C("div", { className: n["rp-search-tool-input-checkboxes"], children: [
225
- f && /* @__PURE__ */ o(q, {}),
227
+ /* @__PURE__ */ x("div", { className: n["rp-search-tool-input-checkboxes"], children: [
228
+ C && /* @__PURE__ */ o(q, {}),
226
229
  /* @__PURE__ */ o(
227
230
  $,
228
231
  {
229
232
  tabIndex: 0,
230
233
  name: "matchCase",
231
- value: ot,
232
- onChange: rt,
234
+ value: et,
235
+ onChange: nt,
233
236
  "aria-label": t == null ? void 0 : t.searchMatchCaseLabel,
234
237
  children: t == null ? void 0 : t.searchMatchCaseLabel
235
238
  }
236
239
  ),
237
- !f && /* @__PURE__ */ o(E, { content: t == null ? void 0 : t.searchMatchCaseTooltip, children: /* @__PURE__ */ o("div", { className: n["rp-search-icon-info"], tabIndex: 0, children: /* @__PURE__ */ o(j, {}) }) }),
240
+ !C && /* @__PURE__ */ o(v, { content: t == null ? void 0 : t.searchMatchCaseTooltip, children: /* @__PURE__ */ o("div", { className: n["rp-search-icon-info"], tabIndex: 0, children: /* @__PURE__ */ o(j, {}) }) }),
238
241
  /* @__PURE__ */ o(
239
242
  $,
240
243
  {
241
244
  tabIndex: 0,
242
245
  name: "wholeWord",
243
- value: tt,
244
- onChange: et,
246
+ value: rt,
247
+ onChange: it,
245
248
  "aria-label": t == null ? void 0 : t.searchWholeWordsLabel,
246
249
  children: t == null ? void 0 : t.searchWholeWordsLabel
247
250
  }
248
251
  ),
249
- !f && /* @__PURE__ */ o(E, { content: t == null ? void 0 : t.searchWholeWordsTooltip, children: /* @__PURE__ */ o("div", { tabIndex: 0, className: n["rp-search-icon-info"], children: /* @__PURE__ */ o(j, {}) }) })
252
+ !C && /* @__PURE__ */ o(v, { content: t == null ? void 0 : t.searchWholeWordsTooltip, children: /* @__PURE__ */ o("div", { tabIndex: 0, className: n["rp-search-icon-info"], children: /* @__PURE__ */ o(j, {}) }) })
250
253
  ] })
251
254
  ] }),
252
- !f && /* @__PURE__ */ C("div", { className: n["rp-search-tool-controls"], children: [
255
+ !C && /* @__PURE__ */ x("div", { className: n["rp-search-tool-controls"], children: [
253
256
  /* @__PURE__ */ o(q, {}),
254
- /* @__PURE__ */ o(z, { onKeyPress: R, handleClose: h })
257
+ /* @__PURE__ */ o(z, { onKeyPress: R, handleClose: l })
255
258
  ] })
256
259
  ]
257
260
  }
@@ -260,5 +263,5 @@ const yt = () => {
260
263
  ) });
261
264
  };
262
265
  export {
263
- jo as SearchTool
266
+ qo as SearchTool
264
267
  };
@@ -1,13 +1,11 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { createContext as r, useContext as i } from "react";
3
- const t = r({
4
- instanceId: ""
5
- }), x = ({
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { createContext as n, useContext as i } from "react";
3
+ const t = n({}), x = ({
6
4
  children: e,
7
- ...n
8
- }) => /* @__PURE__ */ o(t.Provider, { value: n, children: e }), c = () => i(t);
5
+ ...o
6
+ }) => /* @__PURE__ */ r(t.Provider, { value: o, children: e }), u = () => i(t);
9
7
  export {
10
8
  t as InitialStateContext,
11
9
  x as InitialStateProvider,
12
- c as useInitialStateContext
10
+ u as useInitialStateContext
13
11
  };
@@ -1 +1 @@
1
- export declare const useWatermark: (instanceId?: string) => void;
1
+ export declare const useWatermark: (container: HTMLDivElement | null) => void;
@@ -540,7 +540,6 @@ export interface ZoomContextType {
540
540
  }
541
541
  export type ZoomProps = Omit<ZoomContextType, 'currentZoom'>;
542
542
  export type InitialStateContextType = {
543
- instanceId: string;
544
543
  interactiveForm?: boolean;
545
544
  } & ZoomProviderProps & PageProviderProps & ViewModeInitialProps & ScrollModeInitialProps & RotateProviderProps;
546
545
  export interface ZoomProviderProps {
@@ -820,6 +819,7 @@ export interface RPHorizontalBarIcons {
820
819
  documentPropertiesIcon?: React.ReactNode;
821
820
  printIcon?: React.ReactNode;
822
821
  searchIcon?: React.ReactNode;
822
+ searchClearIcon?: React.ReactNode;
823
823
  textSelectionIcon?: React.ReactNode;
824
824
  handModeIcon?: React.ReactNode;
825
825
  }
@@ -1,21 +1,21 @@
1
1
  import { getCharacterType as D } from "./charators.js";
2
- function _(l, c, m, i) {
2
+ function _(r, c, m, i) {
3
3
  const s = [];
4
- for (const n of l) {
4
+ for (const n of r) {
5
5
  const o = y(c, n, i);
6
6
  s.push(...R(o, c, m));
7
7
  }
8
8
  return s;
9
9
  }
10
- const L = (l, c) => {
10
+ const L = (r, c) => {
11
11
  const m = ["g"];
12
12
  c.matchCase || m.push("i");
13
- let s = l.replace(/[.^$*+?()[{|\\]/g, (n) => `\\${n}`).trim();
13
+ let s = r.replace(/[.^$*+?()[{|\\]/g, (n) => `\\${n}`).trim();
14
14
  return new RegExp(s, m.join(""));
15
15
  };
16
- function y(l, c, m) {
16
+ function y(r, c, m) {
17
17
  const i = [];
18
- for (const t of l.items)
18
+ for (const t of r.items)
19
19
  if (t.hasEOL)
20
20
  if (t.str.endsWith("-")) {
21
21
  const d = t.str.lastIndexOf("-");
@@ -34,14 +34,14 @@ function y(l, c, m) {
34
34
  m.wholeWords && !W(s, e.index, e[0].length) || o.push([e.index, e[0].length, e[0]]);
35
35
  return o;
36
36
  }
37
- function R(l, c, m) {
37
+ function R(r, c, m) {
38
38
  function i(d) {
39
39
  return d.hasEOL ? d.str.endsWith("-") ? -1 : 1 : 0;
40
40
  }
41
41
  let s = 0, n = 0;
42
42
  const o = c.items, e = o.length - 1, t = [];
43
- for (let d = 0; d < l.length; d++) {
44
- let h = l[d][0];
43
+ for (let d = 0; d < r.length; d++) {
44
+ let h = r[d][0];
45
45
  for (; s !== e && h >= n + o[s].str.length; ) {
46
46
  const x = o[s];
47
47
  n += x.str.length + i(x), s++;
@@ -50,19 +50,19 @@ function R(l, c, m) {
50
50
  idx: s,
51
51
  offset: h - n
52
52
  };
53
- for (h += l[d][1]; s !== e && h > n + o[s].str.length; ) {
53
+ for (h += r[d][1]; s !== e && h > n + o[s].str.length; ) {
54
54
  const x = o[s];
55
55
  n += x.str.length + i(x), s++;
56
56
  }
57
- const r = {
57
+ const l = {
58
58
  idx: s,
59
59
  offset: h - n
60
60
  };
61
61
  t.push({
62
62
  start: g,
63
- end: r,
64
- str: l[d][2],
65
- oIndex: l[d][0],
63
+ end: l,
64
+ str: r[d][2],
65
+ oIndex: r[d][0],
66
66
  pageIndex: m,
67
67
  rect: { left: 0, bottom: 0, width: 0, height: 0 },
68
68
  rects: []
@@ -71,45 +71,45 @@ function R(l, c, m) {
71
71
  for (const d of t) {
72
72
  const h = [];
73
73
  for (let g = d.start.idx; g <= d.end.idx; g++) {
74
- const r = o[g], x = r.transform[4], C = r.transform[5], a = r.str.length > 0 ? r.width / r.str.length : 0, M = g === d.start.idx ? d.start.offset : 0, N = g === d.end.idx ? d.end.offset : r.str.length, f = x + M * a, E = (N - M) * a, u = (c.styles ?? {})[r.fontName], T = (u == null ? void 0 : u.ascent) ?? 1, v = (u == null ? void 0 : u.descent) != null ? Math.abs(u.descent) : 1 - T, b = C - v * r.height;
75
- r.height > 0 && r.width > 0 && h.push({
74
+ const l = o[g], x = l.transform[4], C = l.transform[5], a = l.str.length > 0 ? l.width / l.str.length : 0, M = g === d.start.idx ? d.start.offset : 0, N = g === d.end.idx ? d.end.offset : l.str.length, f = x + M * a, E = (N - M) * a, u = (c.styles ?? {})[l.fontName], T = (u == null ? void 0 : u.ascent) ?? 1, v = (u == null ? void 0 : u.descent) != null ? Math.abs(u.descent) : 1 - T, b = C - v * l.height;
75
+ (E > 0 || l.height > 0) && h.push({
76
76
  left: f,
77
77
  bottom: b,
78
78
  width: E,
79
- height: r.height
79
+ height: l.height
80
80
  });
81
81
  }
82
82
  d.rect = h[0], d.rects = h;
83
83
  }
84
84
  return t;
85
85
  }
86
- function W(l, c, m) {
87
- let i = l.slice(0, c).match(/([^\p{M}])\p{M}*$/u);
86
+ function W(r, c, m) {
87
+ let i = r.slice(0, c).match(/([^\p{M}])\p{M}*$/u);
88
88
  if (i) {
89
- const s = l.charCodeAt(c), n = i[1].charCodeAt(0);
89
+ const s = r.charCodeAt(c), n = i[1].charCodeAt(0);
90
90
  if (D(s) === D(n))
91
91
  return !1;
92
92
  }
93
- if (i = l.slice(c + m).match(/^\p{M}*([^\p{M}])/u), i) {
94
- const s = l.charCodeAt(c + m - 1), n = i[1].charCodeAt(0);
93
+ if (i = r.slice(c + m).match(/^\p{M}*([^\p{M}])/u), i) {
94
+ const s = r.charCodeAt(c + m - 1), n = i[1].charCodeAt(0);
95
95
  if (D(s) === D(n))
96
96
  return !1;
97
97
  }
98
98
  return !0;
99
99
  }
100
- function I(l, c, m) {
100
+ function I(r, c, m) {
101
101
  const i = [];
102
102
  function s(n, o, e = -1, t = -1, d = "") {
103
103
  const h = c.items[n], g = [];
104
- let r = "", x = "", C = "", a = m[n];
104
+ let l = "", x = "", C = "", a = m[n];
105
105
  if (!a)
106
106
  return;
107
107
  if (a.nodeType === Node.TEXT_NODE) {
108
108
  const f = document.createElement("span");
109
109
  a.before(f), f.append(a), m[n] = f, a = f;
110
110
  }
111
- e >= 0 && t >= 0 ? r = h.str.substring(e, t) : e < 0 && t < 0 ? r = h.str : e >= 0 ? r = h.str.substring(e) : t >= 0 && (r = h.str.substring(0, t));
112
- const M = document.createTextNode(r), N = document.createElement("span");
111
+ e >= 0 && t >= 0 ? l = h.str.substring(e, t) : e < 0 && t < 0 ? l = h.str : e >= 0 ? l = h.str.substring(e) : t >= 0 && (l = h.str.substring(0, t));
112
+ const M = document.createTextNode(l), N = document.createElement("span");
113
113
  if (N.className = "highlight appended " + d, N.setAttribute("data-match-index", `${o}`), N.append(M), g.push(N), i.push({ element: N, index: o }), e > 0)
114
114
  if (a.childNodes.length === 1 && a.childNodes[0].nodeType === Node.TEXT_NODE) {
115
115
  x = h.str.substring(0, e);
@@ -135,7 +135,7 @@ function I(l, c, m) {
135
135
  }
136
136
  a.replaceChildren(...g);
137
137
  }
138
- for (const [n, o] of l.entries())
138
+ for (const [n, o] of r.entries())
139
139
  if (o.start.idx === o.end.idx)
140
140
  s(o.start.idx, n, o.start.offset, o.end.offset);
141
141
  else
@@ -143,8 +143,8 @@ function I(l, c, m) {
143
143
  e === o.start.idx ? s(e, n, o.start.offset, -1, "begin") : e === o.end.idx ? s(e, n, -1, o.end.offset, "end") : s(e, n, -1, -1, "middle");
144
144
  return i;
145
145
  }
146
- function V(l, c) {
147
- const m = l.items.map((i) => i.str);
146
+ function V(r, c) {
147
+ const m = r.items.map((i) => i.str);
148
148
  for (let i = 0; i < c.length; i++) {
149
149
  const s = c[i];
150
150
  if (s && s.nodeType !== Node.TEXT_NODE) {
@@ -153,19 +153,19 @@ function V(l, c) {
153
153
  }
154
154
  }
155
155
  }
156
- function H(l = {}) {
157
- return { matchCase: !1, wholeWords: !1, ...l };
156
+ function H(r = {}) {
157
+ return { matchCase: !1, wholeWords: !1, ...r };
158
158
  }
159
- function S(l, c, m) {
159
+ function S(r, c, m) {
160
160
  const i = [];
161
161
  function s(n, o, e = -1, t = -1, d) {
162
162
  var f, E;
163
163
  const h = c.items[n], g = [];
164
- let r = "", x = "", C = "", a = m[n];
164
+ let l = "", x = "", C = "", a = m[n];
165
165
  if (!a)
166
166
  return;
167
- e >= 0 && t >= 0 ? r = h.str.substring(e, t) : e < 0 && t < 0 ? r = h.str : e >= 0 ? r = h.str.substring(e) : t >= 0 && (r = h.str.substring(0, t));
168
- const M = document.createTextNode(r), N = document.createElement("span");
167
+ e >= 0 && t >= 0 ? l = h.str.substring(e, t) : e < 0 && t < 0 ? l = h.str : e >= 0 ? l = h.str.substring(e) : t >= 0 && (l = h.str.substring(0, t));
168
+ const M = document.createTextNode(l), N = document.createElement("span");
169
169
  if (N.style.background = d, N.append(M), g.push(N), e > 0)
170
170
  if (a.childNodes.length === 1 && a.childNodes[0].nodeType === Node.TEXT_NODE) {
171
171
  x = h.str.substring(0, e);
@@ -205,7 +205,7 @@ function S(l, c, m) {
205
205
  }
206
206
  a.replaceChildren(...g), i.push({ element: N, index: o });
207
207
  }
208
- for (const [n, o] of l.entries()) {
208
+ for (const [n, o] of r.entries()) {
209
209
  const { start: e, end: t, color: d } = o;
210
210
  e.idx === t.idx && s(e.idx, n, e.offset, t.offset, d);
211
211
  }