@prose-reader/enhancer-search 1.303.0 → 1.305.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2,12 +2,4 @@ import { Reader } from '@prose-reader/core';
2
2
  import { SearchResult } from './search';
3
3
  import { ResultItem, SearchEnhancerAPI } from './types';
4
4
  export type { SearchEnhancerAPI, ResultItem, SearchResult };
5
- /**
6
- * Contract of search enhancer.
7
- *
8
- * - At best a result match should be navigable. It means the search needs to
9
- * be done on a rendered document. This is because rendering can differ from the original
10
- * item resource. A resource can be something non digestible and very specific (.pdf). The search
11
- * enhancer is agnostic and can only search into documents.
12
- */
13
5
  export declare const searchEnhancer: <InheritOptions, InheritOutput extends Reader>(next: (options: InheritOptions) => InheritOutput) => (options: InheritOptions) => InheritOutput & SearchEnhancerAPI;
package/dist/index.js CHANGED
@@ -1,214 +1,101 @@
1
- import { deferIdle } from '@prose-reader/core';
2
- import { of, defer, forkJoin } from 'rxjs';
3
- import { map, switchMap, finalize, catchError } from 'rxjs/operators';
4
-
5
- const m = () => {
6
- if (!(typeof window > "u"))
7
- return window;
1
+ import { deferIdle as e } from "@prose-reader/core";
2
+ import { defer as t, forkJoin as n, of as r } from "rxjs";
3
+ import { catchError as i, finalize as a, map as o, switchMap as s } from "rxjs/operators";
4
+ //#region ../shared/dist/index.js
5
+ var c = () => {
6
+ if (!(typeof window > "u")) return window;
8
7
  };
9
- function b() {
10
- const e = m()?.__PROSE_READER_DEBUG;
11
- return e === true || e === "true";
8
+ function l() {
9
+ let e = c()?.__PROSE_READER_DEBUG;
10
+ return e === !0 || e === "true";
12
11
  }
13
- const E = (e, t) => typeof e == "boolean" ? {
14
- enabled: e,
15
- options: t
12
+ var u = (e, t) => typeof e == "boolean" ? {
13
+ enabled: e,
14
+ options: t
16
15
  } : {
17
- enabled: e?.enabled,
18
- options: e ?? t
19
- }, w = (e) => e.at(-1)?.color, u = (e) => {
20
- if (!e.length)
21
- return;
22
- if (!e.some((o) => o.color))
23
- return [e.map((o) => o.label).join(" ")];
24
- let t = "";
25
- const n = [];
26
- for (const o of e)
27
- t += `%c${t ? ` ${o.label}` : o.label}`, n.push(
28
- o.color ? `color: ${o.color}` : ""
29
- );
30
- return [t, ...n];
31
- }, p = (e = [], t = b()) => {
32
- let n = t;
33
- const o = {
34
- enable: (c) => {
35
- l(c);
36
- },
37
- namespace: (c, s, a) => {
38
- const i = E(
39
- s,
40
- a
41
- ), g = i.options?.color ?? w(e);
42
- return p(
43
- [
44
- ...e,
45
- {
46
- label: `[${c}]`,
47
- color: g
48
- }
49
- ],
50
- i.enabled ?? n
51
- );
52
- },
53
- isEnabled: () => n,
54
- debug: () => {
55
- },
56
- info: () => {
57
- },
58
- log: () => {
59
- },
60
- groupCollapsed: () => {
61
- },
62
- groupEnd: () => {
63
- },
64
- getGroupArgs: (c) => {
65
- const s = u(e);
66
- if (!s)
67
- return [c];
68
- const [a, ...i] = s;
69
- return [`${a} ${c}`, ...i];
70
- },
71
- warn: () => {
72
- },
73
- error: () => {
74
- }
75
- }, r = (c) => {
76
- if (!c) {
77
- o.debug = () => {
78
- }, o.info = () => {
79
- }, o.log = () => {
80
- }, o.groupCollapsed = () => {
81
- }, o.groupEnd = () => {
82
- }, o.warn = () => {
83
- }, o.error = () => {
84
- };
85
- return;
86
- }
87
- const s = u(e) ?? [];
88
- o.debug = Function.prototype.bind.call(
89
- console.debug,
90
- console,
91
- ...s
92
- ), o.info = Function.prototype.bind.call(
93
- console.info,
94
- console,
95
- ...s
96
- ), o.log = Function.prototype.bind.call(
97
- console.log,
98
- console,
99
- ...s
100
- ), o.groupCollapsed = Function.prototype.bind.call(
101
- console.groupCollapsed,
102
- console
103
- ), o.groupEnd = Function.prototype.bind.call(console.groupEnd, console), o.warn = Function.prototype.bind.call(
104
- console.warn,
105
- console,
106
- ...s
107
- ), o.error = Function.prototype.bind.call(
108
- console.error,
109
- console,
110
- ...s
111
- );
112
- }, l = (c) => {
113
- n !== c && (n = c, r(n));
114
- };
115
- return r(n), o;
116
- }, O = p();
117
-
118
- const name = "@prose-reader/enhancer-search";
119
-
120
- const IS_DEBUG_ENABLED = true;
121
- const report = O.namespace(name, IS_DEBUG_ENABLED);
122
-
123
- const searchNodeContainingText = (node, text) => {
124
- const nodeList = node.childNodes;
125
- if (node.nodeName === `head`) return [];
126
- const rangeList = [];
127
- for (let i = 0; i < nodeList.length; i++) {
128
- const subNode = nodeList[i];
129
- if (!subNode) {
130
- continue;
131
- }
132
- if (subNode?.hasChildNodes()) {
133
- rangeList.push(...searchNodeContainingText(subNode, text));
134
- }
135
- if (subNode.nodeType === 3) {
136
- const content = subNode.data.toLowerCase();
137
- if (content) {
138
- let match = null;
139
- const regexp = RegExp(`(${text})`, `gi`);
140
- while ((match = regexp.exec(content)) !== null) {
141
- if (match.index >= 0 && subNode.ownerDocument) {
142
- const range = subNode.ownerDocument.createRange();
143
- range.setStart(subNode, match.index);
144
- range.setEnd(subNode, match.index + text.length);
145
- rangeList.push(range);
146
- }
147
- }
148
- }
149
- }
150
- }
151
- return rangeList;
152
- };
153
- const searchInDocument = (reader, item, doc, text) => {
154
- const ranges = searchNodeContainingText(doc, text);
155
- const newResults = ranges.map((range) => {
156
- const cfi = reader.cfi.generateCfiFromRange(range, item.item);
157
- return {
158
- cfi
159
- };
160
- });
161
- return of(newResults);
162
- };
163
-
164
- const searchEnhancer = (next) => (options) => {
165
- const reader = next(options);
166
- const searchForItem = (index, text) => {
167
- const item = reader.spineItemsManager.get(index);
168
- if (!item) {
169
- return of([]);
170
- }
171
- return deferIdle(() => reader.renderHeadless(index)).pipe(
172
- switchMap((result) => {
173
- const { doc, release } = result || {};
174
- if (!doc) return of([]);
175
- return deferIdle(
176
- () => searchInDocument(reader, item, doc, text)
177
- ).pipe(
178
- finalize(() => {
179
- release?.();
180
- }),
181
- catchError((e) => {
182
- report.error(e);
183
- return of([]);
184
- })
185
- );
186
- })
187
- );
188
- };
189
- const search = (text) => defer(() => {
190
- if (text === ``) {
191
- return of([]);
192
- }
193
- const searches$ = reader.context.manifest?.spineItems.map(
194
- (_, index) => searchForItem(index, text)
195
- ) || [];
196
- return forkJoin([...searches$, of([])]);
197
- }).pipe(
198
- map((results) => {
199
- const flattenedResults = results.flat();
200
- report.debug("results", flattenedResults);
201
- return flattenedResults;
202
- })
203
- );
204
- return {
205
- ...reader,
206
- __PROSE_READER_ENHANCER_SEARCH: true,
207
- search: {
208
- search
209
- }
210
- };
16
+ enabled: e?.enabled,
17
+ options: e ?? t
18
+ }, d = (e) => e.at(-1)?.color, f = (e) => {
19
+ if (!e.length) return;
20
+ if (!e.some((e) => e.color)) return [e.map((e) => e.label).join(" ")];
21
+ let t = "", n = [];
22
+ for (let r of e) t += `%c${t ? ` ${r.label}` : r.label}`, n.push(r.color ? `color: ${r.color}` : "");
23
+ return [t, ...n];
24
+ }, p = (e = [], t = l()) => {
25
+ let n = t, r = {
26
+ enable: (e) => {
27
+ a(e);
28
+ },
29
+ namespace: (t, r, i) => {
30
+ let a = u(r, i), o = a.options?.color ?? d(e);
31
+ return p([...e, {
32
+ label: `[${t}]`,
33
+ color: o
34
+ }], a.enabled ?? n);
35
+ },
36
+ isEnabled: () => n,
37
+ debug: () => {},
38
+ info: () => {},
39
+ log: () => {},
40
+ groupCollapsed: () => {},
41
+ groupEnd: () => {},
42
+ getGroupArgs: (t) => {
43
+ let n = f(e);
44
+ if (!n) return [t];
45
+ let [r, ...i] = n;
46
+ return [`${r} ${t}`, ...i];
47
+ },
48
+ warn: () => {},
49
+ error: () => {}
50
+ }, i = (t) => {
51
+ if (!t) {
52
+ r.debug = () => {}, r.info = () => {}, r.log = () => {}, r.groupCollapsed = () => {}, r.groupEnd = () => {}, r.warn = () => {}, r.error = () => {};
53
+ return;
54
+ }
55
+ let n = f(e) ?? [];
56
+ r.debug = Function.prototype.bind.call(console.debug, console, ...n), r.info = Function.prototype.bind.call(console.info, console, ...n), r.log = Function.prototype.bind.call(console.log, console, ...n), r.groupCollapsed = Function.prototype.bind.call(console.groupCollapsed, console), r.groupEnd = Function.prototype.bind.call(console.groupEnd, console), r.warn = Function.prototype.bind.call(console.warn, console, ...n), r.error = Function.prototype.bind.call(console.error, console, ...n);
57
+ }, a = (e) => {
58
+ n !== e && (n = e, i(n));
59
+ };
60
+ return i(n), r;
61
+ }, m = p().namespace("@prose-reader/enhancer-search", !0), h = (e, t) => {
62
+ let n = e.childNodes;
63
+ if (e.nodeName === "head") return [];
64
+ let r = [];
65
+ for (let e = 0; e < n.length; e++) {
66
+ let i = n[e];
67
+ if (i && (i?.hasChildNodes() && r.push(...h(i, t)), i.nodeType === 3)) {
68
+ let e = i.data.toLowerCase();
69
+ if (e) {
70
+ let n = null, a = RegExp(`(${t})`, "gi");
71
+ for (; (n = a.exec(e)) !== null;) if (n.index >= 0 && i.ownerDocument) {
72
+ let e = i.ownerDocument.createRange();
73
+ e.setStart(i, n.index), e.setEnd(i, n.index + t.length), r.push(e);
74
+ }
75
+ }
76
+ }
77
+ }
78
+ return r;
79
+ }, g = (e, t, n, i) => r(h(n, i).map((n) => ({ cfi: e.cfi.generateCfiFromRange(n, t.item) }))), _ = (c) => (l) => {
80
+ let u = c(l), d = (t, n) => {
81
+ let o = u.spineItemsManager.get(t);
82
+ return o ? e(() => u.renderHeadless(t)).pipe(s((t) => {
83
+ let { doc: s, release: c } = t || {};
84
+ return s ? e(() => g(u, o, s, n)).pipe(a(() => {
85
+ c?.();
86
+ }), i((e) => (m.error(e), r([])))) : r([]);
87
+ })) : r([]);
88
+ }, f = (e) => t(() => e === "" ? r([]) : n([...u.context.manifest?.spineItems.map((t, n) => d(n, e)) || [], r([])])).pipe(o((e) => {
89
+ let t = e.flat();
90
+ return m.debug("results", t), t;
91
+ }));
92
+ return {
93
+ ...u,
94
+ __PROSE_READER_ENHANCER_SEARCH: !0,
95
+ search: { search: f }
96
+ };
211
97
  };
98
+ //#endregion
99
+ export { _ as searchEnhancer };
212
100
 
213
- export { searchEnhancer };
214
- //# sourceMappingURL=index.js.map
101
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../shared/dist/index.js","../src/report.ts","../src/search.ts","../src/index.ts"],"sourcesContent":["const y = (e, t) => e === t ? !0 : e.length !== t.length ? !1 : e.every((n, o) => n === t[o]), f = (e) => e.split(/[#?]/)[0]?.split(\".\").pop()?.trim() || \"\";\nfunction d(e) {\n const t = [];\n if (e.length === 0)\n return \"\";\n if (typeof e[0] != \"string\")\n throw new TypeError(`Url must be a string. Received ${e[0]}`);\n e[0].match(/^[^/:]+:\\/*$/) && e.length > 1 && (e[0] = e.shift() + e[0]), e[0].match(/^file:\\/\\/\\//) ? e[0] = e[0].replace(/^([^/:]+):\\/*/, \"$1:///\") : e[0] = e[0].replace(/^([^/:]+):\\/*/, \"$1://\");\n for (let r = 0; r < e.length; r++) {\n let l = e[r];\n if (typeof l != \"string\")\n throw new TypeError(`Url must be a string. Received ${l}`);\n l !== \"\" && (r > 0 && (l = l.replace(/^[/]+/, \"\")), r < e.length - 1 ? l = l.replace(/[/]+$/, \"\") : l = l.replace(/[/]+$/, \"/\"), t.push(l));\n }\n let n = t.join(\"/\");\n n = n.replace(/\\/(\\?|&|#[^!])/g, \"$1\");\n const o = n.split(\"?\");\n return n = o.shift() + (o.length > 0 ? \"?\" : \"\") + o.join(\"&\"), n;\n}\nfunction R(...e) {\n const t = Array.from(Array.isArray(e[0]) ? e[0] : e);\n return d(t);\n}\nfunction $(e) {\n const t = e.split(\"/\");\n return t.pop(), t.join(\"/\");\n}\nconst h = (e) => {\n switch (f(e)) {\n case \"png\":\n return \"image/png\";\n case \"jpg\":\n return \"image/jpg\";\n case \"jpeg\":\n return \"image/jpeg\";\n case \"txt\":\n return \"text/plain\";\n case \"webp\":\n return \"image/webp\";\n case \"xhtml\":\n return \"application/xhtml+xml\";\n case \"mp3\":\n return \"audio/mpeg\";\n case \"m4a\":\n case \"m4b\":\n return \"audio/mp4\";\n case \"aac\":\n return \"audio/aac\";\n case \"ogg\":\n case \"oga\":\n return \"audio/ogg\";\n case \"wav\":\n return \"audio/wav\";\n case \"flac\":\n return \"audio/flac\";\n case \"opus\":\n return \"audio/opus\";\n }\n}, x = ({\n mimeType: e,\n uri: t\n}) => (e ?? h(t ?? \"\"))?.startsWith(\"application/xhtml+xml\"), _ = (e) => e.startsWith(\"image/\") || e.startsWith(\"audio/\") || e.startsWith(\"video/\"), C = (e) => {\n if (!e.length) return;\n const t = e.indexOf(\";\");\n return t >= 0 ? e.substring(0, t) : e;\n}, v = (e) => {\n const t = e.pageSpreadLeft === !0, n = e.pageSpreadRight === !0;\n if (t !== n)\n return t ? \"left\" : \"right\";\n}, F = (e, t, n) => {\n if (Object.is(e, t))\n return !0;\n if (typeof e != \"object\" || e === null || typeof t != \"object\" || t === null)\n return !1;\n const o = Object.keys(e), r = Object.keys(t);\n if (o.length !== r.length)\n return !1;\n const l = n?.customEqual ?? Object.is, c = e, s = t;\n for (const a of o)\n if (!Object.hasOwn(s, a) || !l(c[a], s[a]))\n return !1;\n return !0;\n}, T = (e, t) => e.reduce(\n (n, o) => {\n const r = t(o);\n return n[r] || (n[r] = []), n[r].push(o), n;\n },\n {}\n);\nfunction M(e, t) {\n const n = { ...e };\n for (const o in t)\n if (Object.hasOwn(t, o)) {\n const r = t[o];\n (r !== void 0 || !(o in e)) && (n[o] = r);\n }\n return n;\n}\nconst m = () => {\n if (!(typeof window > \"u\"))\n return window;\n};\nfunction b() {\n const e = m()?.__PROSE_READER_DEBUG;\n return e === !0 || e === \"true\";\n}\nconst E = (e, t) => typeof e == \"boolean\" ? {\n enabled: e,\n options: t\n} : {\n enabled: e?.enabled,\n options: e ?? t\n}, w = (e) => e.at(-1)?.color, u = (e) => {\n if (!e.length)\n return;\n if (!e.some((o) => o.color))\n return [e.map((o) => o.label).join(\" \")];\n let t = \"\";\n const n = [];\n for (const o of e)\n t += `%c${t ? ` ${o.label}` : o.label}`, n.push(\n o.color ? `color: ${o.color}` : \"\"\n );\n return [t, ...n];\n}, p = (e = [], t = b()) => {\n let n = t;\n const o = {\n enable: (c) => {\n l(c);\n },\n namespace: (c, s, a) => {\n const i = E(\n s,\n a\n ), g = i.options?.color ?? w(e);\n return p(\n [\n ...e,\n {\n label: `[${c}]`,\n color: g\n }\n ],\n i.enabled ?? n\n );\n },\n isEnabled: () => n,\n debug: () => {\n },\n info: () => {\n },\n log: () => {\n },\n groupCollapsed: () => {\n },\n groupEnd: () => {\n },\n getGroupArgs: (c) => {\n const s = u(e);\n if (!s)\n return [c];\n const [a, ...i] = s;\n return [`${a} ${c}`, ...i];\n },\n warn: () => {\n },\n error: () => {\n }\n }, r = (c) => {\n if (!c) {\n o.debug = () => {\n }, o.info = () => {\n }, o.log = () => {\n }, o.groupCollapsed = () => {\n }, o.groupEnd = () => {\n }, o.warn = () => {\n }, o.error = () => {\n };\n return;\n }\n const s = u(e) ?? [];\n o.debug = Function.prototype.bind.call(\n console.debug,\n console,\n ...s\n ), o.info = Function.prototype.bind.call(\n console.info,\n console,\n ...s\n ), o.log = Function.prototype.bind.call(\n console.log,\n console,\n ...s\n ), o.groupCollapsed = Function.prototype.bind.call(\n console.groupCollapsed,\n console\n ), o.groupEnd = Function.prototype.bind.call(console.groupEnd, console), o.warn = Function.prototype.bind.call(\n console.warn,\n console,\n ...s\n ), o.error = Function.prototype.bind.call(\n console.error,\n console,\n ...s\n );\n }, l = (c) => {\n n !== c && (n = c, r(n));\n };\n return r(n), o;\n}, O = p(), P = \"prose-reader-resource-error\", S = (e) => e.replaceAll(\"&\", \"&amp;\").replaceAll('\"', \"&quot;\").replaceAll(\"'\", \"&apos;\").replaceAll(\"<\", \"&lt;\").replaceAll(\">\", \"&gt;\");\nexport {\n P as PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME,\n O as Report,\n y as arrayEqual,\n h as detectMimeTypeFromName,\n S as escapeXmlAttributeValue,\n v as getItemSpreadPosition,\n $ as getParentPath,\n f as getUrlExtension,\n T as groupBy,\n _ as isMediaContentMimeType,\n F as isShallowEqual,\n x as isXmlBasedMimeType,\n C as parseContentType,\n M as shallowMergeIfDefined,\n R as urlJoin\n};\n//# sourceMappingURL=index.js.map\n","import { Report } from \"@prose-reader/shared\"\nimport { name } from \"../package.json\"\n\nconst IS_DEBUG_ENABLED = true\n\nexport const report = Report.namespace(name, IS_DEBUG_ENABLED)\n","import type { Reader, SpineItem } from \"@prose-reader/core\"\nimport { type Observable, of } from \"rxjs\"\nimport type { ResultItem } from \"./types\"\n\nexport type SearchResult = ResultItem[]\n\nconst searchNodeContainingText = (node: Node, text: string) => {\n const nodeList = node.childNodes\n\n if (node.nodeName === `head`) return []\n\n const rangeList: Range[] = []\n\n for (let i = 0; i < nodeList.length; i++) {\n const subNode = nodeList[i]\n\n if (!subNode) {\n continue\n }\n\n if (subNode?.hasChildNodes()) {\n rangeList.push(...searchNodeContainingText(subNode, text))\n }\n\n if (subNode.nodeType === 3) {\n const content = (subNode as Text).data.toLowerCase()\n if (content) {\n let match: RegExpExecArray | null = null\n const regexp = RegExp(`(${text})`, `gi`)\n\n // biome-ignore lint/suspicious/noAssignInExpressions: TODO\n while ((match = regexp.exec(content)) !== null) {\n if (match.index >= 0 && subNode.ownerDocument) {\n const range = subNode.ownerDocument.createRange()\n range.setStart(subNode, match.index)\n range.setEnd(subNode, match.index + text.length)\n\n rangeList.push(range)\n }\n }\n }\n }\n }\n\n return rangeList\n}\n\nexport const searchInDocument = (\n reader: Reader,\n item: SpineItem,\n doc: Document,\n text: string,\n): Observable<SearchResult> => {\n const ranges = searchNodeContainingText(doc, text)\n\n const newResults = ranges.map((range) => {\n const cfi = reader.cfi.generateCfiFromRange(range, item.item)\n\n return {\n cfi,\n } satisfies ResultItem\n })\n\n return of(newResults)\n}\n","import { deferIdle, type Reader } from \"@prose-reader/core\"\nimport { defer, forkJoin, of } from \"rxjs\"\nimport { catchError, finalize, map, switchMap } from \"rxjs/operators\"\nimport { report } from \"./report\"\nimport type { SearchResult } from \"./search\"\nimport { searchInDocument } from \"./search\"\nimport type { ResultItem, SearchEnhancerAPI } from \"./types\"\n\nexport type { SearchEnhancerAPI, ResultItem, SearchResult }\n\n/**\n * Contract of search enhancer.\n *\n * - At best a result match should be navigable. It means the search needs to\n * be done on a rendered document. This is because rendering can differ from the original\n * item resource. A resource can be something non digestible and very specific (.pdf). The search\n * enhancer is agnostic and can only search into documents.\n */\nexport const searchEnhancer =\n <InheritOptions, InheritOutput extends Reader>(\n next: (options: InheritOptions) => InheritOutput,\n ) =>\n (options: InheritOptions): InheritOutput & SearchEnhancerAPI => {\n const reader = next(options)\n\n const searchForItem = (index: number, text: string) => {\n const item = reader.spineItemsManager.get(index)\n\n if (!item) {\n return of([])\n }\n\n return deferIdle(() => reader.renderHeadless(index)).pipe(\n switchMap((result) => {\n const { doc, release } = result || {}\n\n if (!doc) return of([])\n\n return deferIdle(() =>\n searchInDocument(reader, item, doc, text),\n ).pipe(\n finalize(() => {\n release?.()\n }),\n catchError((e) => {\n report.error(e)\n\n return of([])\n }),\n )\n }),\n )\n }\n\n const search = (text: string) =>\n defer(() => {\n if (text === ``) {\n return of([])\n }\n\n const searches$ =\n reader.context.manifest?.spineItems.map((_, index) =>\n searchForItem(index, text),\n ) || []\n\n return forkJoin([...searches$, of([])])\n }).pipe(\n map((results) => {\n const flattenedResults = results.flat()\n\n report.debug(\"results\", flattenedResults)\n\n return flattenedResults\n }),\n )\n\n return {\n ...reader,\n __PROSE_READER_ENHANCER_SEARCH: true,\n search: {\n search,\n },\n }\n }\n"],"names":["Report"],"mappings":";;;;AAkGA,MAAM,CAAC,GAAG,MAAM;AAChB,EAAE,IAAI,EAAE,OAAO,MAAM,GAAG,GAAG,CAAC;AAC5B,IAAI,OAAO,MAAM;AACjB,CAAC;AACD,SAAS,CAAC,GAAG;AACb,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,oBAAoB;AACrC,EAAE,OAAO,CAAC,KAAK,IAAE,IAA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EAAA,CAAG,EAAE,CAAA;AAAA,IACd;AAEA,IAAA,MAAM,SAAA,GACJ,MAAA,CAAO,OAAA,CAAQ,QAAA,EAAU,UAAA,CAAW,GAAA;AAAA,MAAI,CAAC,CAAA,EAAG,KAAA,KAC1C,aAAA,CAAc,OAAO,IAAI;AAAA,SACtB,EAAC;AAER,IAAA,OAAO,QAAA,CAAS,CAAC,GAAG,SAAA,EAAW,GAAG,EAAE,CAAC,CAAC,CAAA;AAAA,EACxC,CAAC,CAAA,CAAE,IAAA;AAAA,IACD,GAAA,CAAI,CAAC,OAAA,KAAY;AACf,MAAA,MAAM,gBAAA,GAAmB,QAAQ,IAAA,EAAK;AAEtC,MAAA,MAAA,CAAO,KAAA,CAAM,WAAW,gBAAgB,CAAA;AAExC,MAAA,OAAO,gBAAA;AAAA,IACT,CAAC;AAAA,GACH;AAEF,EAAA,OAAO;AAAA,IACL,GAAG,MAAA;AAAA,IACH,8BAAA,EAAgC,IAAA;AAAA,IAChC,MAAA,EAAQ;AAAA,MACN;AAAA;AACF,GACF;AACF;;;;"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../shared/dist/index.js","../package.json","../src/report.ts","../src/search.ts","../src/index.ts"],"sourcesContent":["//#region src/array.ts\nvar e = (e, t) => e === t ? !0 : e.length === t.length ? e.every((e, n) => e === t[n]) : !1, t = (e) => e.split(/[#?]/)[0]?.split(\".\").pop()?.trim() || \"\";\nfunction n(e) {\n\tlet t = [];\n\tif (e.length === 0) return \"\";\n\tif (typeof e[0] != \"string\") throw TypeError(`Url must be a string. Received ${e[0]}`);\n\te[0].match(/^[^/:]+:\\/*$/) && e.length > 1 && (e[0] = e.shift() + e[0]), e[0].match(/^file:\\/\\/\\//) ? e[0] = e[0].replace(/^([^/:]+):\\/*/, \"$1:///\") : e[0] = e[0].replace(/^([^/:]+):\\/*/, \"$1://\");\n\tfor (let n = 0; n < e.length; n++) {\n\t\tlet r = e[n];\n\t\tif (typeof r != \"string\") throw TypeError(`Url must be a string. Received ${r}`);\n\t\tr !== \"\" && (n > 0 && (r = r.replace(/^[/]+/, \"\")), r = n < e.length - 1 ? r.replace(/[/]+$/, \"\") : r.replace(/[/]+$/, \"/\"), t.push(r));\n\t}\n\tlet n = t.join(\"/\");\n\tn = n.replace(/\\/(\\?|&|#[^!])/g, \"$1\");\n\tlet r = n.split(\"?\");\n\treturn n = r.shift() + (r.length > 0 ? \"?\" : \"\") + r.join(\"&\"), n;\n}\nfunction r(...e) {\n\treturn n(Array.from(Array.isArray(e[0]) ? e[0] : e));\n}\nfunction i(e) {\n\tlet t = e.split(\"/\");\n\treturn t.pop(), t.join(\"/\");\n}\n//#endregion\n//#region src/contentType.ts\nvar a = (e) => {\n\tswitch (t(e)) {\n\t\tcase \"png\": return \"image/png\";\n\t\tcase \"jpg\": return \"image/jpg\";\n\t\tcase \"jpeg\": return \"image/jpeg\";\n\t\tcase \"txt\": return \"text/plain\";\n\t\tcase \"webp\": return \"image/webp\";\n\t\tcase \"xhtml\": return \"application/xhtml+xml\";\n\t\tcase \"mp3\": return \"audio/mpeg\";\n\t\tcase \"m4a\":\n\t\tcase \"m4b\": return \"audio/mp4\";\n\t\tcase \"aac\": return \"audio/aac\";\n\t\tcase \"ogg\":\n\t\tcase \"oga\": return \"audio/ogg\";\n\t\tcase \"wav\": return \"audio/wav\";\n\t\tcase \"flac\": return \"audio/flac\";\n\t\tcase \"opus\": return \"audio/opus\";\n\t}\n}, o = ({ mimeType: e, uri: t }) => (e ?? a(t ?? \"\"))?.startsWith(\"application/xhtml+xml\"), s = (e) => e.startsWith(\"image/\") || e.startsWith(\"audio/\") || e.startsWith(\"video/\"), c = (e) => {\n\tif (!e.length) return;\n\tlet t = e.indexOf(\";\");\n\treturn t >= 0 ? e.substring(0, t) : e;\n}, l = (e) => {\n\tlet t = e.pageSpreadLeft === !0;\n\tif (t !== (e.pageSpreadRight === !0)) return t ? \"left\" : \"right\";\n}, u = (e, t, n) => {\n\tif (Object.is(e, t)) return !0;\n\tif (typeof e != \"object\" || !e || typeof t != \"object\" || !t) return !1;\n\tlet r = Object.keys(e), i = Object.keys(t);\n\tif (r.length !== i.length) return !1;\n\tlet a = n?.customEqual ?? Object.is, o = e, s = t;\n\tfor (let e of r) if (!Object.hasOwn(s, e) || !a(o[e], s[e])) return !1;\n\treturn !0;\n}, d = (e, t) => e.reduce((e, n) => {\n\tlet r = t(n);\n\treturn e[r] || (e[r] = []), e[r].push(n), e;\n}, {});\nfunction f(e, t) {\n\tlet n = { ...e };\n\tfor (let r in t) if (Object.hasOwn(t, r)) {\n\t\tlet i = t[r];\n\t\t(i !== void 0 || !(r in e)) && (n[r] = i);\n\t}\n\treturn n;\n}\n//#endregion\n//#region src/report.ts\nvar p = () => {\n\tif (!(typeof window > \"u\")) return window;\n};\nfunction m() {\n\tlet e = p()?.__PROSE_READER_DEBUG;\n\treturn e === !0 || e === \"true\";\n}\nvar h = (e, t) => typeof e == \"boolean\" ? {\n\tenabled: e,\n\toptions: t\n} : {\n\tenabled: e?.enabled,\n\toptions: e ?? t\n}, g = (e) => e.at(-1)?.color, _ = (e) => {\n\tif (!e.length) return;\n\tif (!e.some((e) => e.color)) return [e.map((e) => e.label).join(\" \")];\n\tlet t = \"\", n = [];\n\tfor (let r of e) t += `%c${t ? ` ${r.label}` : r.label}`, n.push(r.color ? `color: ${r.color}` : \"\");\n\treturn [t, ...n];\n}, v = (e = [], t = m()) => {\n\tlet n = t, r = {\n\t\tenable: (e) => {\n\t\t\ta(e);\n\t\t},\n\t\tnamespace: (t, r, i) => {\n\t\t\tlet a = h(r, i), o = a.options?.color ?? g(e);\n\t\t\treturn v([...e, {\n\t\t\t\tlabel: `[${t}]`,\n\t\t\t\tcolor: o\n\t\t\t}], a.enabled ?? n);\n\t\t},\n\t\tisEnabled: () => n,\n\t\tdebug: () => {},\n\t\tinfo: () => {},\n\t\tlog: () => {},\n\t\tgroupCollapsed: () => {},\n\t\tgroupEnd: () => {},\n\t\tgetGroupArgs: (t) => {\n\t\t\tlet n = _(e);\n\t\t\tif (!n) return [t];\n\t\t\tlet [r, ...i] = n;\n\t\t\treturn [`${r} ${t}`, ...i];\n\t\t},\n\t\twarn: () => {},\n\t\terror: () => {}\n\t}, i = (t) => {\n\t\tif (!t) {\n\t\t\tr.debug = () => {}, r.info = () => {}, r.log = () => {}, r.groupCollapsed = () => {}, r.groupEnd = () => {}, r.warn = () => {}, r.error = () => {};\n\t\t\treturn;\n\t\t}\n\t\tlet n = _(e) ?? [];\n\t\tr.debug = Function.prototype.bind.call(console.debug, console, ...n), r.info = Function.prototype.bind.call(console.info, console, ...n), r.log = Function.prototype.bind.call(console.log, console, ...n), r.groupCollapsed = Function.prototype.bind.call(console.groupCollapsed, console), r.groupEnd = Function.prototype.bind.call(console.groupEnd, console), r.warn = Function.prototype.bind.call(console.warn, console, ...n), r.error = Function.prototype.bind.call(console.error, console, ...n);\n\t}, a = (e) => {\n\t\tn !== e && (n = e, i(n));\n\t};\n\treturn i(n), r;\n}, y = v(), b = \"prose-reader-resource-error\", x = (e) => e.replaceAll(\"&\", \"&amp;\").replaceAll(\"\\\"\", \"&quot;\").replaceAll(\"'\", \"&apos;\").replaceAll(\"<\", \"&lt;\").replaceAll(\">\", \"&gt;\");\n//#endregion\nexport { b as PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME, y as Report, e as arrayEqual, a as detectMimeTypeFromName, x as escapeXmlAttributeValue, l as getItemSpreadPosition, i as getParentPath, t as getUrlExtension, d as groupBy, s as isMediaContentMimeType, u as isShallowEqual, o as isXmlBasedMimeType, c as parseContentType, f as shallowMergeIfDefined, r as urlJoin };\n\n//# sourceMappingURL=index.js.map","{\n \"name\": \"@prose-reader/enhancer-search\",\n \"version\": \"1.304.0\",\n \"type\": \"module\",\n \"main\": \"./dist/index.umd.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"files\": [\n \"/dist\"\n ],\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.umd.cjs\"\n }\n },\n \"scripts\": {\n \"start\": \"vite build --watch --mode development\",\n \"build\": \"tsc && vite build\",\n \"test\": \"vitest run --coverage\"\n },\n \"dependencies\": {\n \"@prose-reader/core\": \"^1.304.0\"\n },\n \"peerDependencies\": {\n \"rxjs\": \"*\"\n },\n \"gitHead\": \"4601e14dcacf50b2295cb343582a7ef2c7e1eedc\"\n}\n","import { Report } from \"@prose-reader/shared\"\nimport { name } from \"../package.json\"\n\nconst IS_DEBUG_ENABLED = true\n\nexport const report = Report.namespace(name, IS_DEBUG_ENABLED)\n","import type { Reader, SpineItem } from \"@prose-reader/core\"\nimport { type Observable, of } from \"rxjs\"\nimport type { ResultItem } from \"./types\"\n\nexport type SearchResult = ResultItem[]\n\nconst searchNodeContainingText = (node: Node, text: string) => {\n const nodeList = node.childNodes\n\n if (node.nodeName === `head`) return []\n\n const rangeList: Range[] = []\n\n for (let i = 0; i < nodeList.length; i++) {\n const subNode = nodeList[i]\n\n if (!subNode) {\n continue\n }\n\n if (subNode?.hasChildNodes()) {\n rangeList.push(...searchNodeContainingText(subNode, text))\n }\n\n if (subNode.nodeType === 3) {\n const content = (subNode as Text).data.toLowerCase()\n if (content) {\n let match: RegExpExecArray | null = null\n const regexp = RegExp(`(${text})`, `gi`)\n\n // biome-ignore lint/suspicious/noAssignInExpressions: TODO\n while ((match = regexp.exec(content)) !== null) {\n if (match.index >= 0 && subNode.ownerDocument) {\n const range = subNode.ownerDocument.createRange()\n range.setStart(subNode, match.index)\n range.setEnd(subNode, match.index + text.length)\n\n rangeList.push(range)\n }\n }\n }\n }\n }\n\n return rangeList\n}\n\nexport const searchInDocument = (\n reader: Reader,\n item: SpineItem,\n doc: Document,\n text: string,\n): Observable<SearchResult> => {\n const ranges = searchNodeContainingText(doc, text)\n\n const newResults = ranges.map((range) => {\n const cfi = reader.cfi.generateCfiFromRange(range, item.item)\n\n return {\n cfi,\n } satisfies ResultItem\n })\n\n return of(newResults)\n}\n","import { deferIdle, type Reader } from \"@prose-reader/core\"\nimport { defer, forkJoin, of } from \"rxjs\"\nimport { catchError, finalize, map, switchMap } from \"rxjs/operators\"\nimport { report } from \"./report\"\nimport type { SearchResult } from \"./search\"\nimport { searchInDocument } from \"./search\"\nimport type { ResultItem, SearchEnhancerAPI } from \"./types\"\n\nexport type { SearchEnhancerAPI, ResultItem, SearchResult }\n\n/**\n * Contract of search enhancer.\n *\n * - At best a result match should be navigable. It means the search needs to\n * be done on a rendered document. This is because rendering can differ from the original\n * item resource. A resource can be something non digestible and very specific (.pdf). The search\n * enhancer is agnostic and can only search into documents.\n */\nexport const searchEnhancer =\n <InheritOptions, InheritOutput extends Reader>(\n next: (options: InheritOptions) => InheritOutput,\n ) =>\n (options: InheritOptions): InheritOutput & SearchEnhancerAPI => {\n const reader = next(options)\n\n const searchForItem = (index: number, text: string) => {\n const item = reader.spineItemsManager.get(index)\n\n if (!item) {\n return of([])\n }\n\n return deferIdle(() => reader.renderHeadless(index)).pipe(\n switchMap((result) => {\n const { doc, release } = result || {}\n\n if (!doc) return of([])\n\n return deferIdle(() =>\n searchInDocument(reader, item, doc, text),\n ).pipe(\n finalize(() => {\n release?.()\n }),\n catchError((e) => {\n report.error(e)\n\n return of([])\n }),\n )\n }),\n )\n }\n\n const search = (text: string) =>\n defer(() => {\n if (text === ``) {\n return of([])\n }\n\n const searches$ =\n reader.context.manifest?.spineItems.map((_, index) =>\n searchForItem(index, text),\n ) || []\n\n return forkJoin([...searches$, of([])])\n }).pipe(\n map((results) => {\n const flattenedResults = results.flat()\n\n report.debug(\"results\", flattenedResults)\n\n return flattenedResults\n }),\n )\n\n return {\n ...reader,\n __PROSE_READER_ENHANCER_SEARCH: true,\n search: {\n search,\n },\n }\n }\n"],"mappings":";;;;AAyEA,IAAI,UAAU;CACb,IAAI,EAAE,OAAO,SAAS,MAAM,OAAO;AACpC;AACA,SAAS,IAAI;CACZ,IAAI,IAAI,EAAE,GAAG;CACb,OAAO,MAAM,CAAC,KAAK,MAAM;A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AK,MAAY;EACf,IAAM,IAAmB,EAAQ,KAAK;EAItC,OAFA,EAAO,MAAM,WAAW,CAAgB,GAEjC;CACT,CAAC,CACH;CAEF,OAAO;EACL,GAAG;EACH,gCAAgC;EAChC,QAAQ,EACN,UACF;CACF;AACF"}
@@ -1,220 +1,2 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@prose-reader/core'), require('rxjs'), require('rxjs/operators')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@prose-reader/core', 'rxjs', 'rxjs/operators'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["prose-reader-enhancer-search"] = {}, global.core, global.rxjs, global.operators));
5
- })(this, (function (exports, core, rxjs, operators) { 'use strict';
6
-
7
- const m = () => {
8
- if (!(typeof window > "u"))
9
- return window;
10
- };
11
- function b() {
12
- const e = m()?.__PROSE_READER_DEBUG;
13
- return e === true || e === "true";
14
- }
15
- const E = (e, t) => typeof e == "boolean" ? {
16
- enabled: e,
17
- options: t
18
- } : {
19
- enabled: e?.enabled,
20
- options: e ?? t
21
- }, w = (e) => e.at(-1)?.color, u = (e) => {
22
- if (!e.length)
23
- return;
24
- if (!e.some((o) => o.color))
25
- return [e.map((o) => o.label).join(" ")];
26
- let t = "";
27
- const n = [];
28
- for (const o of e)
29
- t += `%c${t ? ` ${o.label}` : o.label}`, n.push(
30
- o.color ? `color: ${o.color}` : ""
31
- );
32
- return [t, ...n];
33
- }, p = (e = [], t = b()) => {
34
- let n = t;
35
- const o = {
36
- enable: (c) => {
37
- l(c);
38
- },
39
- namespace: (c, s, a) => {
40
- const i = E(
41
- s,
42
- a
43
- ), g = i.options?.color ?? w(e);
44
- return p(
45
- [
46
- ...e,
47
- {
48
- label: `[${c}]`,
49
- color: g
50
- }
51
- ],
52
- i.enabled ?? n
53
- );
54
- },
55
- isEnabled: () => n,
56
- debug: () => {
57
- },
58
- info: () => {
59
- },
60
- log: () => {
61
- },
62
- groupCollapsed: () => {
63
- },
64
- groupEnd: () => {
65
- },
66
- getGroupArgs: (c) => {
67
- const s = u(e);
68
- if (!s)
69
- return [c];
70
- const [a, ...i] = s;
71
- return [`${a} ${c}`, ...i];
72
- },
73
- warn: () => {
74
- },
75
- error: () => {
76
- }
77
- }, r = (c) => {
78
- if (!c) {
79
- o.debug = () => {
80
- }, o.info = () => {
81
- }, o.log = () => {
82
- }, o.groupCollapsed = () => {
83
- }, o.groupEnd = () => {
84
- }, o.warn = () => {
85
- }, o.error = () => {
86
- };
87
- return;
88
- }
89
- const s = u(e) ?? [];
90
- o.debug = Function.prototype.bind.call(
91
- console.debug,
92
- console,
93
- ...s
94
- ), o.info = Function.prototype.bind.call(
95
- console.info,
96
- console,
97
- ...s
98
- ), o.log = Function.prototype.bind.call(
99
- console.log,
100
- console,
101
- ...s
102
- ), o.groupCollapsed = Function.prototype.bind.call(
103
- console.groupCollapsed,
104
- console
105
- ), o.groupEnd = Function.prototype.bind.call(console.groupEnd, console), o.warn = Function.prototype.bind.call(
106
- console.warn,
107
- console,
108
- ...s
109
- ), o.error = Function.prototype.bind.call(
110
- console.error,
111
- console,
112
- ...s
113
- );
114
- }, l = (c) => {
115
- n !== c && (n = c, r(n));
116
- };
117
- return r(n), o;
118
- }, O = p();
119
-
120
- const name = "@prose-reader/enhancer-search";
121
-
122
- const IS_DEBUG_ENABLED = true;
123
- const report = O.namespace(name, IS_DEBUG_ENABLED);
124
-
125
- const searchNodeContainingText = (node, text) => {
126
- const nodeList = node.childNodes;
127
- if (node.nodeName === `head`) return [];
128
- const rangeList = [];
129
- for (let i = 0; i < nodeList.length; i++) {
130
- const subNode = nodeList[i];
131
- if (!subNode) {
132
- continue;
133
- }
134
- if (subNode?.hasChildNodes()) {
135
- rangeList.push(...searchNodeContainingText(subNode, text));
136
- }
137
- if (subNode.nodeType === 3) {
138
- const content = subNode.data.toLowerCase();
139
- if (content) {
140
- let match = null;
141
- const regexp = RegExp(`(${text})`, `gi`);
142
- while ((match = regexp.exec(content)) !== null) {
143
- if (match.index >= 0 && subNode.ownerDocument) {
144
- const range = subNode.ownerDocument.createRange();
145
- range.setStart(subNode, match.index);
146
- range.setEnd(subNode, match.index + text.length);
147
- rangeList.push(range);
148
- }
149
- }
150
- }
151
- }
152
- }
153
- return rangeList;
154
- };
155
- const searchInDocument = (reader, item, doc, text) => {
156
- const ranges = searchNodeContainingText(doc, text);
157
- const newResults = ranges.map((range) => {
158
- const cfi = reader.cfi.generateCfiFromRange(range, item.item);
159
- return {
160
- cfi
161
- };
162
- });
163
- return rxjs.of(newResults);
164
- };
165
-
166
- const searchEnhancer = (next) => (options) => {
167
- const reader = next(options);
168
- const searchForItem = (index, text) => {
169
- const item = reader.spineItemsManager.get(index);
170
- if (!item) {
171
- return rxjs.of([]);
172
- }
173
- return core.deferIdle(() => reader.renderHeadless(index)).pipe(
174
- operators.switchMap((result) => {
175
- const { doc, release } = result || {};
176
- if (!doc) return rxjs.of([]);
177
- return core.deferIdle(
178
- () => searchInDocument(reader, item, doc, text)
179
- ).pipe(
180
- operators.finalize(() => {
181
- release?.();
182
- }),
183
- operators.catchError((e) => {
184
- report.error(e);
185
- return rxjs.of([]);
186
- })
187
- );
188
- })
189
- );
190
- };
191
- const search = (text) => rxjs.defer(() => {
192
- if (text === ``) {
193
- return rxjs.of([]);
194
- }
195
- const searches$ = reader.context.manifest?.spineItems.map(
196
- (_, index) => searchForItem(index, text)
197
- ) || [];
198
- return rxjs.forkJoin([...searches$, rxjs.of([])]);
199
- }).pipe(
200
- operators.map((results) => {
201
- const flattenedResults = results.flat();
202
- report.debug("results", flattenedResults);
203
- return flattenedResults;
204
- })
205
- );
206
- return {
207
- ...reader,
208
- __PROSE_READER_ENHANCER_SEARCH: true,
209
- search: {
210
- search
211
- }
212
- };
213
- };
214
-
215
- exports.searchEnhancer = searchEnhancer;
216
-
217
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
218
-
219
- }));
220
- //# sourceMappingURL=index.umd.cjs.map
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@prose-reader/core"),require("rxjs"),require("rxjs/operators")):typeof define==`function`&&define.amd?define([`exports`,`@prose-reader/core`,`rxjs`,`rxjs/operators`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`prose-reader-enhancer-search`]={},e._prose_reader_core,e.rxjs,e.rxjs_operators))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=()=>{if(!(typeof window>`u`))return window};function a(){let e=i()?.__PROSE_READER_DEBUG;return e===!0||e===`true`}var o=(e,t)=>typeof e==`boolean`?{enabled:e,options:t}:{enabled:e?.enabled,options:e??t},s=e=>e.at(-1)?.color,c=e=>{if(!e.length)return;if(!e.some(e=>e.color))return[e.map(e=>e.label).join(` `)];let t=``,n=[];for(let r of e)t+=`%c${t?` ${r.label}`:r.label}`,n.push(r.color?`color: ${r.color}`:``);return[t,...n]},l=(e=[],t=a())=>{let n=t,r={enable:e=>{u(e)},namespace:(t,r,i)=>{let a=o(r,i),c=a.options?.color??s(e);return l([...e,{label:`[${t}]`,color:c}],a.enabled??n)},isEnabled:()=>n,debug:()=>{},info:()=>{},log:()=>{},groupCollapsed:()=>{},groupEnd:()=>{},getGroupArgs:t=>{let n=c(e);if(!n)return[t];let[r,...i]=n;return[`${r} ${t}`,...i]},warn:()=>{},error:()=>{}},i=t=>{if(!t){r.debug=()=>{},r.info=()=>{},r.log=()=>{},r.groupCollapsed=()=>{},r.groupEnd=()=>{},r.warn=()=>{},r.error=()=>{};return}let n=c(e)??[];r.debug=Function.prototype.bind.call(console.debug,console,...n),r.info=Function.prototype.bind.call(console.info,console,...n),r.log=Function.prototype.bind.call(console.log,console,...n),r.groupCollapsed=Function.prototype.bind.call(console.groupCollapsed,console),r.groupEnd=Function.prototype.bind.call(console.groupEnd,console),r.warn=Function.prototype.bind.call(console.warn,console,...n),r.error=Function.prototype.bind.call(console.error,console,...n)},u=e=>{n!==e&&(n=e,i(n))};return i(n),r},u=l().namespace(`@prose-reader/enhancer-search`,!0),d=(e,t)=>{let n=e.childNodes;if(e.nodeName===`head`)return[];let r=[];for(let e=0;e<n.length;e++){let i=n[e];if(i&&(i?.hasChildNodes()&&r.push(...d(i,t)),i.nodeType===3)){let e=i.data.toLowerCase();if(e){let n=null,a=RegExp(`(${t})`,`gi`);for(;(n=a.exec(e))!==null;)if(n.index>=0&&i.ownerDocument){let e=i.ownerDocument.createRange();e.setStart(i,n.index),e.setEnd(i,n.index+t.length),r.push(e)}}}}return r},f=(e,t,r,i)=>(0,n.of)(d(r,i).map(n=>({cfi:e.cfi.generateCfiFromRange(n,t.item)})));e.searchEnhancer=e=>i=>{let a=e(i),o=(e,i)=>{let o=a.spineItemsManager.get(e);return o?(0,t.deferIdle)(()=>a.renderHeadless(e)).pipe((0,r.switchMap)(e=>{let{doc:s,release:c}=e||{};return s?(0,t.deferIdle)(()=>f(a,o,s,i)).pipe((0,r.finalize)(()=>{c?.()}),(0,r.catchError)(e=>(u.error(e),(0,n.of)([])))):(0,n.of)([])})):(0,n.of)([])},s=e=>(0,n.defer)(()=>e===``?(0,n.of)([]):(0,n.forkJoin)([...a.context.manifest?.spineItems.map((t,n)=>o(n,e))||[],(0,n.of)([])])).pipe((0,r.map)(e=>{let t=e.flat();return u.debug(`results`,t),t}));return{...a,__PROSE_READER_ENHANCER_SEARCH:!0,search:{search:s}}}});
2
+ //# sourceMappingURL=index.umd.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.cjs","sources":["../../shared/dist/index.js","../src/report.ts","../src/search.ts","../src/index.ts"],"sourcesContent":["const y = (e, t) => e === t ? !0 : e.length !== t.length ? !1 : e.every((n, o) => n === t[o]), f = (e) => e.split(/[#?]/)[0]?.split(\".\").pop()?.trim() || \"\";\nfunction d(e) {\n const t = [];\n if (e.length === 0)\n return \"\";\n if (typeof e[0] != \"string\")\n throw new TypeError(`Url must be a string. Received ${e[0]}`);\n e[0].match(/^[^/:]+:\\/*$/) && e.length > 1 && (e[0] = e.shift() + e[0]), e[0].match(/^file:\\/\\/\\//) ? e[0] = e[0].replace(/^([^/:]+):\\/*/, \"$1:///\") : e[0] = e[0].replace(/^([^/:]+):\\/*/, \"$1://\");\n for (let r = 0; r < e.length; r++) {\n let l = e[r];\n if (typeof l != \"string\")\n throw new TypeError(`Url must be a string. Received ${l}`);\n l !== \"\" && (r > 0 && (l = l.replace(/^[/]+/, \"\")), r < e.length - 1 ? l = l.replace(/[/]+$/, \"\") : l = l.replace(/[/]+$/, \"/\"), t.push(l));\n }\n let n = t.join(\"/\");\n n = n.replace(/\\/(\\?|&|#[^!])/g, \"$1\");\n const o = n.split(\"?\");\n return n = o.shift() + (o.length > 0 ? \"?\" : \"\") + o.join(\"&\"), n;\n}\nfunction R(...e) {\n const t = Array.from(Array.isArray(e[0]) ? e[0] : e);\n return d(t);\n}\nfunction $(e) {\n const t = e.split(\"/\");\n return t.pop(), t.join(\"/\");\n}\nconst h = (e) => {\n switch (f(e)) {\n case \"png\":\n return \"image/png\";\n case \"jpg\":\n return \"image/jpg\";\n case \"jpeg\":\n return \"image/jpeg\";\n case \"txt\":\n return \"text/plain\";\n case \"webp\":\n return \"image/webp\";\n case \"xhtml\":\n return \"application/xhtml+xml\";\n case \"mp3\":\n return \"audio/mpeg\";\n case \"m4a\":\n case \"m4b\":\n return \"audio/mp4\";\n case \"aac\":\n return \"audio/aac\";\n case \"ogg\":\n case \"oga\":\n return \"audio/ogg\";\n case \"wav\":\n return \"audio/wav\";\n case \"flac\":\n return \"audio/flac\";\n case \"opus\":\n return \"audio/opus\";\n }\n}, x = ({\n mimeType: e,\n uri: t\n}) => (e ?? h(t ?? \"\"))?.startsWith(\"application/xhtml+xml\"), _ = (e) => e.startsWith(\"image/\") || e.startsWith(\"audio/\") || e.startsWith(\"video/\"), C = (e) => {\n if (!e.length) return;\n const t = e.indexOf(\";\");\n return t >= 0 ? e.substring(0, t) : e;\n}, v = (e) => {\n const t = e.pageSpreadLeft === !0, n = e.pageSpreadRight === !0;\n if (t !== n)\n return t ? \"left\" : \"right\";\n}, F = (e, t, n) => {\n if (Object.is(e, t))\n return !0;\n if (typeof e != \"object\" || e === null || typeof t != \"object\" || t === null)\n return !1;\n const o = Object.keys(e), r = Object.keys(t);\n if (o.length !== r.length)\n return !1;\n const l = n?.customEqual ?? Object.is, c = e, s = t;\n for (const a of o)\n if (!Object.hasOwn(s, a) || !l(c[a], s[a]))\n return !1;\n return !0;\n}, T = (e, t) => e.reduce(\n (n, o) => {\n const r = t(o);\n return n[r] || (n[r] = []), n[r].push(o), n;\n },\n {}\n);\nfunction M(e, t) {\n const n = { ...e };\n for (const o in t)\n if (Object.hasOwn(t, o)) {\n const r = t[o];\n (r !== void 0 || !(o in e)) && (n[o] = r);\n }\n return n;\n}\nconst m = () => {\n if (!(typeof window > \"u\"))\n return window;\n};\nfunction b() {\n const e = m()?.__PROSE_READER_DEBUG;\n return e === !0 || e === \"true\";\n}\nconst E = (e, t) => typeof e == \"boolean\" ? {\n enabled: e,\n options: t\n} : {\n enabled: e?.enabled,\n options: e ?? t\n}, w = (e) => e.at(-1)?.color, u = (e) => {\n if (!e.length)\n return;\n if (!e.some((o) => o.color))\n return [e.map((o) => o.label).join(\" \")];\n let t = \"\";\n const n = [];\n for (const o of e)\n t += `%c${t ? ` ${o.label}` : o.label}`, n.push(\n o.color ? `color: ${o.color}` : \"\"\n );\n return [t, ...n];\n}, p = (e = [], t = b()) => {\n let n = t;\n const o = {\n enable: (c) => {\n l(c);\n },\n namespace: (c, s, a) => {\n const i = E(\n s,\n a\n ), g = i.options?.color ?? w(e);\n return p(\n [\n ...e,\n {\n label: `[${c}]`,\n color: g\n }\n ],\n i.enabled ?? n\n );\n },\n isEnabled: () => n,\n debug: () => {\n },\n info: () => {\n },\n log: () => {\n },\n groupCollapsed: () => {\n },\n groupEnd: () => {\n },\n getGroupArgs: (c) => {\n const s = u(e);\n if (!s)\n return [c];\n const [a, ...i] = s;\n return [`${a} ${c}`, ...i];\n },\n warn: () => {\n },\n error: () => {\n }\n }, r = (c) => {\n if (!c) {\n o.debug = () => {\n }, o.info = () => {\n }, o.log = () => {\n }, o.groupCollapsed = () => {\n }, o.groupEnd = () => {\n }, o.warn = () => {\n }, o.error = () => {\n };\n return;\n }\n const s = u(e) ?? [];\n o.debug = Function.prototype.bind.call(\n console.debug,\n console,\n ...s\n ), o.info = Function.prototype.bind.call(\n console.info,\n console,\n ...s\n ), o.log = Function.prototype.bind.call(\n console.log,\n console,\n ...s\n ), o.groupCollapsed = Function.prototype.bind.call(\n console.groupCollapsed,\n console\n ), o.groupEnd = Function.prototype.bind.call(console.groupEnd, console), o.warn = Function.prototype.bind.call(\n console.warn,\n console,\n ...s\n ), o.error = Function.prototype.bind.call(\n console.error,\n console,\n ...s\n );\n }, l = (c) => {\n n !== c && (n = c, r(n));\n };\n return r(n), o;\n}, O = p(), P = \"prose-reader-resource-error\", S = (e) => e.replaceAll(\"&\", \"&amp;\").replaceAll('\"', \"&quot;\").replaceAll(\"'\", \"&apos;\").replaceAll(\"<\", \"&lt;\").replaceAll(\">\", \"&gt;\");\nexport {\n P as PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME,\n O as Report,\n y as arrayEqual,\n h as detectMimeTypeFromName,\n S as escapeXmlAttributeValue,\n v as getItemSpreadPosition,\n $ as getParentPath,\n f as getUrlExtension,\n T as groupBy,\n _ as isMediaContentMimeType,\n F as isShallowEqual,\n x as isXmlBasedMimeType,\n C as parseContentType,\n M as shallowMergeIfDefined,\n R as urlJoin\n};\n//# sourceMappingURL=index.js.map\n","import { Report } from \"@prose-reader/shared\"\nimport { name } from \"../package.json\"\n\nconst IS_DEBUG_ENABLED = true\n\nexport const report = Report.namespace(name, IS_DEBUG_ENABLED)\n","import type { Reader, SpineItem } from \"@prose-reader/core\"\nimport { type Observable, of } from \"rxjs\"\nimport type { ResultItem } from \"./types\"\n\nexport type SearchResult = ResultItem[]\n\nconst searchNodeContainingText = (node: Node, text: string) => {\n const nodeList = node.childNodes\n\n if (node.nodeName === `head`) return []\n\n const rangeList: Range[] = []\n\n for (let i = 0; i < nodeList.length; i++) {\n const subNode = nodeList[i]\n\n if (!subNode) {\n continue\n }\n\n if (subNode?.hasChildNodes()) {\n rangeList.push(...searchNodeContainingText(subNode, text))\n }\n\n if (subNode.nodeType === 3) {\n const content = (subNode as Text).data.toLowerCase()\n if (content) {\n let match: RegExpExecArray | null = null\n const regexp = RegExp(`(${text})`, `gi`)\n\n // biome-ignore lint/suspicious/noAssignInExpressions: TODO\n while ((match = regexp.exec(content)) !== null) {\n if (match.index >= 0 && subNode.ownerDocument) {\n const range = subNode.ownerDocument.createRange()\n range.setStart(subNode, match.index)\n range.setEnd(subNode, match.index + text.length)\n\n rangeList.push(range)\n }\n }\n }\n }\n }\n\n return rangeList\n}\n\nexport const searchInDocument = (\n reader: Reader,\n item: SpineItem,\n doc: Document,\n text: string,\n): Observable<SearchResult> => {\n const ranges = searchNodeContainingText(doc, text)\n\n const newResults = ranges.map((range) => {\n const cfi = reader.cfi.generateCfiFromRange(range, item.item)\n\n return {\n cfi,\n } satisfies ResultItem\n })\n\n return of(newResults)\n}\n","import { deferIdle, type Reader } from \"@prose-reader/core\"\nimport { defer, forkJoin, of } from \"rxjs\"\nimport { catchError, finalize, map, switchMap } from \"rxjs/operators\"\nimport { report } from \"./report\"\nimport type { SearchResult } from \"./search\"\nimport { searchInDocument } from \"./search\"\nimport type { ResultItem, SearchEnhancerAPI } from \"./types\"\n\nexport type { SearchEnhancerAPI, ResultItem, SearchResult }\n\n/**\n * Contract of search enhancer.\n *\n * - At best a result match should be navigable. It means the search needs to\n * be done on a rendered document. This is because rendering can differ from the original\n * item resource. A resource can be something non digestible and very specific (.pdf). The search\n * enhancer is agnostic and can only search into documents.\n */\nexport const searchEnhancer =\n <InheritOptions, InheritOutput extends Reader>(\n next: (options: InheritOptions) => InheritOutput,\n ) =>\n (options: InheritOptions): InheritOutput & SearchEnhancerAPI => {\n const reader = next(options)\n\n const searchForItem = (index: number, text: string) => {\n const item = reader.spineItemsManager.get(index)\n\n if (!item) {\n return of([])\n }\n\n return deferIdle(() => reader.renderHeadless(index)).pipe(\n switchMap((result) => {\n const { doc, release } = result || {}\n\n if (!doc) return of([])\n\n return deferIdle(() =>\n searchInDocument(reader, item, doc, text),\n ).pipe(\n finalize(() => {\n release?.()\n }),\n catchError((e) => {\n report.error(e)\n\n return of([])\n }),\n )\n }),\n )\n }\n\n const search = (text: string) =>\n defer(() => {\n if (text === ``) {\n return of([])\n }\n\n const searches$ =\n reader.context.manifest?.spineItems.map((_, index) =>\n searchForItem(index, text),\n ) || []\n\n return forkJoin([...searches$, of([])])\n }).pipe(\n map((results) => {\n const flattenedResults = results.flat()\n\n report.debug(\"results\", flattenedResults)\n\n return flattenedResults\n }),\n )\n\n return {\n ...reader,\n __PROSE_READER_ENHANCER_SEARCH: true,\n search: {\n search,\n },\n }\n }\n"],"names":["Report","of","deferIdle","switchMap","finalize","catchError","defer","forkJoin","map"],"mappings":";;;;;;EAkGA,MAAM,CAAC,GAAG,MAAM;EAChB,EAAE,IAAI,EAAE,OAAO,MAAM,GAAG,GAAG,CAAC;EAC5B,IAAI,OAAO,MAAM;EACjB,CAAC;EACD,SAAS,CAAC,GAAG;EACb,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,oBAAoB;EACrC,EAAE,OAAO,CAAC,KAAK,IAAE,IAAI,CAAC,KAAK,MAAM;EACjC;AACK,QAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,SAAS,GAAG;EAC5C,EAAE,OAAO,EAAE,CAAC;EACZ,EAAE,OAAO,EAAE;EACX,CAAC,GAAG;EACJ,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO;EACrB,EAAE,OAAO,EAAE,CAAC,IAAI;EAChB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK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A,CAAI,CAAC,OAAA,KAAY;EACf,MAAA,MAAM,gBAAA,GAAmB,QAAQ,IAAA,EAAK;EAEtC,MAAA,MAAA,CAAO,KAAA,CAAM,WAAW,gBAAgB,CAAA;EAExC,MAAA,OAAO,gBAAA;EAAA,IACT,CAAC;EAAA,GACH;EAEF,EAAA,OAAO;EAAA,IACL,GAAG,MAAA;EAAA,IACH,8BAAA,EAAgC,IAAA;EAAA,IAChC,MAAA,EAAQ;EAAA,MACN;EAAA;EACF,GACF;EACF;;;;;;;;;;"}
1
+ {"version":3,"file":"index.umd.cjs","names":[],"sources":["../../shared/dist/index.js","../package.json","../src/report.ts","../src/search.ts","../src/index.ts"],"sourcesContent":["//#region src/array.ts\nvar e = (e, t) => e === t ? !0 : e.length === t.length ? e.every((e, n) => e === t[n]) : !1, t = (e) => e.split(/[#?]/)[0]?.split(\".\").pop()?.trim() || \"\";\nfunction n(e) {\n\tlet t = [];\n\tif (e.length === 0) return \"\";\n\tif (typeof e[0] != \"string\") throw TypeError(`Url must be a string. Received ${e[0]}`);\n\te[0].match(/^[^/:]+:\\/*$/) && e.length > 1 && (e[0] = e.shift() + e[0]), e[0].match(/^file:\\/\\/\\//) ? e[0] = e[0].replace(/^([^/:]+):\\/*/, \"$1:///\") : e[0] = e[0].replace(/^([^/:]+):\\/*/, \"$1://\");\n\tfor (let n = 0; n < e.length; n++) {\n\t\tlet r = e[n];\n\t\tif (typeof r != \"string\") throw TypeError(`Url must be a string. Received ${r}`);\n\t\tr !== \"\" && (n > 0 && (r = r.replace(/^[/]+/, \"\")), r = n < e.length - 1 ? r.replace(/[/]+$/, \"\") : r.replace(/[/]+$/, \"/\"), t.push(r));\n\t}\n\tlet n = t.join(\"/\");\n\tn = n.replace(/\\/(\\?|&|#[^!])/g, \"$1\");\n\tlet r = n.split(\"?\");\n\treturn n = r.shift() + (r.length > 0 ? \"?\" : \"\") + r.join(\"&\"), n;\n}\nfunction r(...e) {\n\treturn n(Array.from(Array.isArray(e[0]) ? e[0] : e));\n}\nfunction i(e) {\n\tlet t = e.split(\"/\");\n\treturn t.pop(), t.join(\"/\");\n}\n//#endregion\n//#region src/contentType.ts\nvar a = (e) => {\n\tswitch (t(e)) {\n\t\tcase \"png\": return \"image/png\";\n\t\tcase \"jpg\": return \"image/jpg\";\n\t\tcase \"jpeg\": return \"image/jpeg\";\n\t\tcase \"txt\": return \"text/plain\";\n\t\tcase \"webp\": return \"image/webp\";\n\t\tcase \"xhtml\": return \"application/xhtml+xml\";\n\t\tcase \"mp3\": return \"audio/mpeg\";\n\t\tcase \"m4a\":\n\t\tcase \"m4b\": return \"audio/mp4\";\n\t\tcase \"aac\": return \"audio/aac\";\n\t\tcase \"ogg\":\n\t\tcase \"oga\": return \"audio/ogg\";\n\t\tcase \"wav\": return \"audio/wav\";\n\t\tcase \"flac\": return \"audio/flac\";\n\t\tcase \"opus\": return \"audio/opus\";\n\t}\n}, o = ({ mimeType: e, uri: t }) => (e ?? a(t ?? \"\"))?.startsWith(\"application/xhtml+xml\"), s = (e) => e.startsWith(\"image/\") || e.startsWith(\"audio/\") || e.startsWith(\"video/\"), c = (e) => {\n\tif (!e.length) return;\n\tlet t = e.indexOf(\";\");\n\treturn t >= 0 ? e.substring(0, t) : e;\n}, l = (e) => {\n\tlet t = e.pageSpreadLeft === !0;\n\tif (t !== (e.pageSpreadRight === !0)) return t ? \"left\" : \"right\";\n}, u = (e, t, n) => {\n\tif (Object.is(e, t)) return !0;\n\tif (typeof e != \"object\" || !e || typeof t != \"object\" || !t) return !1;\n\tlet r = Object.keys(e), i = Object.keys(t);\n\tif (r.length !== i.length) return !1;\n\tlet a = n?.customEqual ?? Object.is, o = e, s = t;\n\tfor (let e of r) if (!Object.hasOwn(s, e) || !a(o[e], s[e])) return !1;\n\treturn !0;\n}, d = (e, t) => e.reduce((e, n) => {\n\tlet r = t(n);\n\treturn e[r] || (e[r] = []), e[r].push(n), e;\n}, {});\nfunction f(e, t) {\n\tlet n = { ...e };\n\tfor (let r in t) if (Object.hasOwn(t, r)) {\n\t\tlet i = t[r];\n\t\t(i !== void 0 || !(r in e)) && (n[r] = i);\n\t}\n\treturn n;\n}\n//#endregion\n//#region src/report.ts\nvar p = () => {\n\tif (!(typeof window > \"u\")) return window;\n};\nfunction m() {\n\tlet e = p()?.__PROSE_READER_DEBUG;\n\treturn e === !0 || e === \"true\";\n}\nvar h = (e, t) => typeof e == \"boolean\" ? {\n\tenabled: e,\n\toptions: t\n} : {\n\tenabled: e?.enabled,\n\toptions: e ?? t\n}, g = (e) => e.at(-1)?.color, _ = (e) => {\n\tif (!e.length) return;\n\tif (!e.some((e) => e.color)) return [e.map((e) => e.label).join(\" \")];\n\tlet t = \"\", n = [];\n\tfor (let r of e) t += `%c${t ? ` ${r.label}` : r.label}`, n.push(r.color ? `color: ${r.color}` : \"\");\n\treturn [t, ...n];\n}, v = (e = [], t = m()) => {\n\tlet n = t, r = {\n\t\tenable: (e) => {\n\t\t\ta(e);\n\t\t},\n\t\tnamespace: (t, r, i) => {\n\t\t\tlet a = h(r, i), o = a.options?.color ?? g(e);\n\t\t\treturn v([...e, {\n\t\t\t\tlabel: `[${t}]`,\n\t\t\t\tcolor: o\n\t\t\t}], a.enabled ?? n);\n\t\t},\n\t\tisEnabled: () => n,\n\t\tdebug: () => {},\n\t\tinfo: () => {},\n\t\tlog: () => {},\n\t\tgroupCollapsed: () => {},\n\t\tgroupEnd: () => {},\n\t\tgetGroupArgs: (t) => {\n\t\t\tlet n = _(e);\n\t\t\tif (!n) return [t];\n\t\t\tlet [r, ...i] = n;\n\t\t\treturn [`${r} ${t}`, ...i];\n\t\t},\n\t\twarn: () => {},\n\t\terror: () => {}\n\t}, i = (t) => {\n\t\tif (!t) {\n\t\t\tr.debug = () => {}, r.info = () => {}, r.log = () => {}, r.groupCollapsed = () => {}, r.groupEnd = () => {}, r.warn = () => {}, r.error = () => {};\n\t\t\treturn;\n\t\t}\n\t\tlet n = _(e) ?? [];\n\t\tr.debug = Function.prototype.bind.call(console.debug, console, ...n), r.info = Function.prototype.bind.call(console.info, console, ...n), r.log = Function.prototype.bind.call(console.log, console, ...n), r.groupCollapsed = Function.prototype.bind.call(console.groupCollapsed, console), r.groupEnd = Function.prototype.bind.call(console.groupEnd, console), r.warn = Function.prototype.bind.call(console.warn, console, ...n), r.error = Function.prototype.bind.call(console.error, console, ...n);\n\t}, a = (e) => {\n\t\tn !== e && (n = e, i(n));\n\t};\n\treturn i(n), r;\n}, y = v(), b = \"prose-reader-resource-error\", x = (e) => e.replaceAll(\"&\", \"&amp;\").replaceAll(\"\\\"\", \"&quot;\").replaceAll(\"'\", \"&apos;\").replaceAll(\"<\", \"&lt;\").replaceAll(\">\", \"&gt;\");\n//#endregion\nexport { b as PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME, y as Report, e as arrayEqual, a as detectMimeTypeFromName, x as escapeXmlAttributeValue, l as getItemSpreadPosition, i as getParentPath, t as getUrlExtension, d as groupBy, s as isMediaContentMimeType, u as isShallowEqual, o as isXmlBasedMimeType, c as parseContentType, f as shallowMergeIfDefined, r as urlJoin };\n\n//# sourceMappingURL=index.js.map","{\n \"name\": \"@prose-reader/enhancer-search\",\n \"version\": \"1.304.0\",\n \"type\": \"module\",\n \"main\": \"./dist/index.umd.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"files\": [\n \"/dist\"\n ],\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.umd.cjs\"\n }\n },\n \"scripts\": {\n \"start\": \"vite build --watch --mode development\",\n \"build\": \"tsc && vite build\",\n \"test\": \"vitest run --coverage\"\n },\n \"dependencies\": {\n \"@prose-reader/core\": \"^1.304.0\"\n },\n \"peerDependencies\": {\n \"rxjs\": \"*\"\n },\n \"gitHead\": \"4601e14dcacf50b2295cb343582a7ef2c7e1eedc\"\n}\n","import { Report } from \"@prose-reader/shared\"\nimport { name } from \"../package.json\"\n\nconst IS_DEBUG_ENABLED = true\n\nexport const report = Report.namespace(name, IS_DEBUG_ENABLED)\n","import type { Reader, SpineItem } from \"@prose-reader/core\"\nimport { type Observable, of } from \"rxjs\"\nimport type { ResultItem } from \"./types\"\n\nexport type SearchResult = ResultItem[]\n\nconst searchNodeContainingText = (node: Node, text: string) => {\n const nodeList = node.childNodes\n\n if (node.nodeName === `head`) return []\n\n const rangeList: Range[] = []\n\n for (let i = 0; i < nodeList.length; i++) {\n const subNode = nodeList[i]\n\n if (!subNode) {\n continue\n }\n\n if (subNode?.hasChildNodes()) {\n rangeList.push(...searchNodeContainingText(subNode, text))\n }\n\n if (subNode.nodeType === 3) {\n const content = (subNode as Text).data.toLowerCase()\n if (content) {\n let match: RegExpExecArray | null = null\n const regexp = RegExp(`(${text})`, `gi`)\n\n // biome-ignore lint/suspicious/noAssignInExpressions: TODO\n while ((match = regexp.exec(content)) !== null) {\n if (match.index >= 0 && subNode.ownerDocument) {\n const range = subNode.ownerDocument.createRange()\n range.setStart(subNode, match.index)\n range.setEnd(subNode, match.index + text.length)\n\n rangeList.push(range)\n }\n }\n }\n }\n }\n\n return rangeList\n}\n\nexport const searchInDocument = (\n reader: Reader,\n item: SpineItem,\n doc: Document,\n text: string,\n): Observable<SearchResult> => {\n const ranges = searchNodeContainingText(doc, text)\n\n const newResults = ranges.map((range) => {\n const cfi = reader.cfi.generateCfiFromRange(range, item.item)\n\n return {\n cfi,\n } satisfies ResultItem\n })\n\n return of(newResults)\n}\n","import { deferIdle, type Reader } from \"@prose-reader/core\"\nimport { defer, forkJoin, of } from \"rxjs\"\nimport { catchError, finalize, map, switchMap } from \"rxjs/operators\"\nimport { report } from \"./report\"\nimport type { SearchResult } from \"./search\"\nimport { searchInDocument } from \"./search\"\nimport type { ResultItem, SearchEnhancerAPI } from \"./types\"\n\nexport type { SearchEnhancerAPI, ResultItem, SearchResult }\n\n/**\n * Contract of search enhancer.\n *\n * - At best a result match should be navigable. It means the search needs to\n * be done on a rendered document. This is because rendering can differ from the original\n * item resource. A resource can be something non digestible and very specific (.pdf). The search\n * enhancer is agnostic and can only search into documents.\n */\nexport const searchEnhancer =\n <InheritOptions, InheritOutput extends Reader>(\n next: (options: InheritOptions) => InheritOutput,\n ) =>\n (options: InheritOptions): InheritOutput & SearchEnhancerAPI => {\n const reader = next(options)\n\n const searchForItem = (index: number, text: string) => {\n const item = reader.spineItemsManager.get(index)\n\n if (!item) {\n return of([])\n }\n\n return deferIdle(() => reader.renderHeadless(index)).pipe(\n switchMap((result) => {\n const { doc, release } = result || {}\n\n if (!doc) return of([])\n\n return deferIdle(() =>\n searchInDocument(reader, item, doc, text),\n ).pipe(\n finalize(() => {\n release?.()\n }),\n catchError((e) => {\n report.error(e)\n\n return of([])\n }),\n )\n }),\n )\n }\n\n const search = (text: string) =>\n defer(() => {\n if (text === ``) {\n return of([])\n }\n\n const searches$ =\n reader.context.manifest?.spineItems.map((_, index) =>\n searchForItem(index, text),\n ) || []\n\n return forkJoin([...searches$, of([])])\n }).pipe(\n map((results) => {\n const flattenedResults = results.flat()\n\n report.debug(\"results\", flattenedResults)\n\n return flattenedResults\n }),\n )\n\n return {\n ...reader,\n __PROSE_READER_ENHANCER_SEARCH: true,\n search: {\n search,\n },\n }\n }\n"],"mappings":"+cAyEA,IAAI,MAAU,CACb,GAAI,EAAE,OAAO,OAAS,KAAM,OAAO,MACpC,EACA,SAAS,GAAI,CACZ,IAAI,EAAI,EAAE,GAAG,qBACb,OAAO,IAAM,CAAC,GAAK,IAAM,MAC1B,CACA,IAAI,GAAK,EAAG,IAAM,OAAO,GAAK,UAAY,CACzC,QAAS,EACT,QAAS,CACV,EAAI,CACH,QAAS,GAAG,QACZ,QAAS,GAAK,CACf,EAAG,EAAK,GAAM,EAAE,GAAG,EAAE,GAAG,MAAO,EAAK,GAAM,CACzC,GAAI,CAAC,EAAE,OAAQ,OACf,GAAI,CAAC,EAAE,KAAM,GAAM,EAAE,KAAK,EAAG,MAAO,CAAC,EAAE,IAAK,GAAM,EAAE,KAAK,EAAE,KAAK,GA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.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prose-reader/enhancer-search",
3
- "version": "1.303.0",
3
+ "version": "1.305.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "module": "./dist/index.js",
@@ -20,10 +20,10 @@
20
20
  "test": "vitest run --coverage"
21
21
  },
22
22
  "dependencies": {
23
- "@prose-reader/core": "^1.303.0"
23
+ "@prose-reader/core": "^1.305.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "rxjs": "*"
27
27
  },
28
- "gitHead": "dddc06869ba852fa280e050c1c1929433bb91c5e"
28
+ "gitHead": "9c94c0d55718d2054c2f12702d05464a361c717f"
29
29
  }