@prose-reader/koreader 13.0.0 → 14.1.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/cfi.d.ts +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +102 -102
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -76,10 +76,10 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
76
76
|
"th",
|
|
77
77
|
"thead",
|
|
78
78
|
"tr"
|
|
79
|
-
]),
|
|
79
|
+
]), ie = (e) => s.has(e) ? "none" : a.has(e) ? "block" : o.has(e) ? "inlineBlock" : e === "ruby" ? "ruby" : "inline", _ = (e) => {
|
|
80
80
|
let t = e.localName.toLowerCase();
|
|
81
|
-
return e.hasAttribute("hidden") && !re.has(t) ? "none" :
|
|
82
|
-
},
|
|
81
|
+
return e.hasAttribute("hidden") && !re.has(t) ? "none" : ie(t);
|
|
82
|
+
}, v = (e) => {
|
|
83
83
|
let t = e.localName.toLowerCase(), n = !1, r = !1, i = t === "math";
|
|
84
84
|
for (let t = e.parentNode; t && h(t); t = t.parentNode) {
|
|
85
85
|
let e = t.localName.toLowerCase();
|
|
@@ -110,7 +110,7 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
110
110
|
opaque: !1,
|
|
111
111
|
insideSvg: !1
|
|
112
112
|
};
|
|
113
|
-
let a =
|
|
113
|
+
let a = _(e);
|
|
114
114
|
return {
|
|
115
115
|
display: a,
|
|
116
116
|
block: a === "block" || a === "inlineBlock",
|
|
@@ -122,42 +122,42 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
122
122
|
opaque: p.has(t),
|
|
123
123
|
insideSvg: t === "svg"
|
|
124
124
|
};
|
|
125
|
-
},
|
|
125
|
+
}, y = 8192, b = 9, x = 10, S = 13, C = 32, w = (e) => e === C || e === S || e === x || e === b, T = (e) => {
|
|
126
126
|
for (let t = 0; t < e.length; t++) {
|
|
127
127
|
let n = e.charCodeAt(t);
|
|
128
|
-
if (n !==
|
|
128
|
+
if (n !== C && n !== S && n !== x && n !== b) return !1;
|
|
129
129
|
}
|
|
130
130
|
return !0;
|
|
131
|
-
},
|
|
131
|
+
}, E = (e) => e > 65535 ? 2 : 1, D = (e, t, n) => {
|
|
132
132
|
let r = 0;
|
|
133
133
|
if (!t.pre) {
|
|
134
134
|
let i = 0, a = 0, o = e.length;
|
|
135
|
-
if (t.trim) for (; o > 0 &&
|
|
135
|
+
if (t.trim) for (; o > 0 && w(e.charCodeAt(o - 1));) o--;
|
|
136
136
|
for (; r < e.length;) {
|
|
137
|
-
let s = e.codePointAt(r) ?? 0, c =
|
|
138
|
-
if (
|
|
137
|
+
let s = e.codePointAt(r) ?? 0, c = E(s), l = 1;
|
|
138
|
+
if (w(s) ? (l = +(i === 0), i++, t.trim && (a === 0 || r >= o) && (l = 0)) : i = 0, a += l, !n(r, c, l)) return;
|
|
139
139
|
r += c;
|
|
140
140
|
}
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
let i = 0, a = 0, o = t.stripsLeadingNewline;
|
|
144
144
|
for (; r < e.length;) {
|
|
145
|
-
let t = e.codePointAt(r) ?? 0, s =
|
|
146
|
-
if (t ===
|
|
145
|
+
let t = e.codePointAt(r) ?? 0, s = E(t), c = 1, l = !1;
|
|
146
|
+
if (t === S) {
|
|
147
147
|
let t = r + s < e.length ? e.codePointAt(r + s) : void 0;
|
|
148
|
-
(r === 0 || i !==
|
|
149
|
-
} else t ===
|
|
148
|
+
(r === 0 || i !== x) && t !== x ? (l = !0, i = x) : c = 0;
|
|
149
|
+
} else t === x ? (l = !0, i = x) : t === b ? (c = 8 - (a & 7), a += c, i = b) : (a++, i = t);
|
|
150
150
|
if (l && (a = 1), c > 0 && o && (o = !1, l && (c = 0)), !n(r, s, c)) return;
|
|
151
151
|
r += s;
|
|
152
152
|
}
|
|
153
|
-
}, ie = (e, t, n) => {
|
|
154
|
-
let r = 0;
|
|
155
|
-
return O(e, n, (e, n, i) => e + n > t ? !1 : (r += i, !0)), r;
|
|
156
153
|
}, ae = (e, t, n) => {
|
|
154
|
+
let r = 0;
|
|
155
|
+
return D(e, n, (e, n, i) => e + n > t ? !1 : (r += i, !0)), r;
|
|
156
|
+
}, oe = (e, t, n) => {
|
|
157
157
|
if (t < 0) return;
|
|
158
158
|
let r = 0, i;
|
|
159
|
-
return
|
|
160
|
-
},
|
|
159
|
+
return D(e, n, (e, n, a) => a === 0 ? !0 : r === t || r + a > t ? (i = e, !1) : (r += a, !0)), i === void 0 ? r === t ? e.length : void 0 : i;
|
|
160
|
+
}, O = (e) => {
|
|
161
161
|
if (e.length < 8192) return [{
|
|
162
162
|
start: 0,
|
|
163
163
|
end: e.length
|
|
@@ -165,7 +165,7 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
165
165
|
let t = [], n = 0;
|
|
166
166
|
for (; n < e.length;) {
|
|
167
167
|
let r = n, i = 0;
|
|
168
|
-
for (; r < e.length && i < 8192;) r +=
|
|
168
|
+
for (; r < e.length && i < 8192;) r += E(e.codePointAt(r) ?? 0), i++;
|
|
169
169
|
if (i < 8192) {
|
|
170
170
|
t.push({
|
|
171
171
|
start: n,
|
|
@@ -176,13 +176,13 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
176
176
|
let a = r;
|
|
177
177
|
for (let t = r - 1; t >= n; t--) {
|
|
178
178
|
let n = e.charCodeAt(t);
|
|
179
|
-
if (n ===
|
|
179
|
+
if (n === C) {
|
|
180
180
|
a = t + 1;
|
|
181
181
|
break;
|
|
182
182
|
}
|
|
183
|
-
if (n ===
|
|
183
|
+
if (n === S || n === x) {
|
|
184
184
|
let i = t + 1 < r ? e.charCodeAt(t + 1) : 0;
|
|
185
|
-
if (n ===
|
|
185
|
+
if (n === S && i !== x || n === x && i !== S) {
|
|
186
186
|
a = t + 1;
|
|
187
187
|
break;
|
|
188
188
|
}
|
|
@@ -194,12 +194,12 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
194
194
|
}), n = a;
|
|
195
195
|
}
|
|
196
196
|
return t;
|
|
197
|
-
},
|
|
197
|
+
}, k = 3, A = 4, j = (e) => e.nodeType === k || e.nodeType === A, se = (e, t) => {
|
|
198
198
|
let n = [], r = 0;
|
|
199
199
|
if (t.opaque) return n;
|
|
200
200
|
for (let i = e.firstChild; i; i = i.nextSibling, r++) {
|
|
201
201
|
if (h(i)) {
|
|
202
|
-
let e = t.insideSvg ? "inline" :
|
|
202
|
+
let e = t.insideSvg ? "inline" : _(i), a = e === "block" ? "block" : e === "none" ? "invisible" : "inline";
|
|
203
203
|
n.push({
|
|
204
204
|
node: i,
|
|
205
205
|
childIndex: r,
|
|
@@ -209,8 +209,8 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
209
209
|
});
|
|
210
210
|
continue;
|
|
211
211
|
}
|
|
212
|
-
if (!
|
|
213
|
-
let e =
|
|
212
|
+
if (!j(i) || !t.allowsText) continue;
|
|
213
|
+
let e = T(i.data);
|
|
214
214
|
e && (t.block && !t.pre && n.length === 0 || t.trimsText) || n.push({
|
|
215
215
|
node: i,
|
|
216
216
|
childIndex: r,
|
|
@@ -220,19 +220,19 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
return n;
|
|
223
|
-
},
|
|
223
|
+
}, M = (e) => e.role === "inline" || e.role === "text", N = (e) => e !== void 0 && e.role === "text" && e.whitespace, ce = (e, t) => {
|
|
224
224
|
let n = () => e.map((e) => ({
|
|
225
225
|
kind: "node",
|
|
226
226
|
child: e
|
|
227
227
|
}));
|
|
228
228
|
if (t.display === "block" || t.display === "inlineBlock") {
|
|
229
|
-
let r = e.some((e) => e.role === "block"), i = e.some(
|
|
229
|
+
let r = e.some((e) => e.role === "block"), i = e.some(M);
|
|
230
230
|
if (!r || !i) return n();
|
|
231
231
|
let a = [], o = 0;
|
|
232
232
|
for (; o < e.length;) {
|
|
233
233
|
let n = e[o];
|
|
234
234
|
if (!n) break;
|
|
235
|
-
if (!
|
|
235
|
+
if (!M(n)) {
|
|
236
236
|
a.push({
|
|
237
237
|
kind: "node",
|
|
238
238
|
child: n
|
|
@@ -242,14 +242,14 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
242
242
|
let r = o;
|
|
243
243
|
for (; r < e.length;) {
|
|
244
244
|
let t = e[r];
|
|
245
|
-
if (!t || !
|
|
245
|
+
if (!t || !M(t)) break;
|
|
246
246
|
r++;
|
|
247
247
|
}
|
|
248
248
|
let i = e.slice(o, r);
|
|
249
249
|
if (!t.pre) {
|
|
250
250
|
let e = 0;
|
|
251
|
-
for (; e < i.length &&
|
|
252
|
-
i = i.slice(e), i.length > 0 &&
|
|
251
|
+
for (; e < i.length && N(i[e]);) e++;
|
|
252
|
+
i = i.slice(e), i.length > 0 && N(i[i.length - 1]) && (i = i.slice(0, -1));
|
|
253
253
|
}
|
|
254
254
|
i.length > 0 && a.push({
|
|
255
255
|
kind: "box",
|
|
@@ -266,20 +266,20 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
266
266
|
return e.forEach((t, n) => {
|
|
267
267
|
if (t.role !== "block") return;
|
|
268
268
|
let r = e[n - 1], a = e[n + 1];
|
|
269
|
-
r &&
|
|
269
|
+
r && N(r) && i.add(r), a && N(a) && i.add(a);
|
|
270
270
|
}), e.filter((e) => !i.has(e)).map((e) => ({
|
|
271
271
|
kind: "node",
|
|
272
272
|
child: e
|
|
273
273
|
}));
|
|
274
274
|
}
|
|
275
275
|
return n();
|
|
276
|
-
},
|
|
276
|
+
}, P = (e, t) => ce(se(e, t), t), F = (e, t, n) => {
|
|
277
277
|
if (h(e.node)) return n({
|
|
278
278
|
kind: "element",
|
|
279
279
|
node: e.node,
|
|
280
280
|
childIndex: e.childIndex
|
|
281
281
|
});
|
|
282
|
-
let r =
|
|
282
|
+
let r = O(e.node.data);
|
|
283
283
|
for (let i = 0; i < r.length; i++) {
|
|
284
284
|
let a = r[i];
|
|
285
285
|
if (a && !n({
|
|
@@ -298,29 +298,29 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
298
298
|
})) return !1;
|
|
299
299
|
}
|
|
300
300
|
return !0;
|
|
301
|
-
},
|
|
302
|
-
for (let r of
|
|
301
|
+
}, I = (e, t, n = v(e)) => {
|
|
302
|
+
for (let r of P(e, n)) {
|
|
303
303
|
let e = r.kind === "box" ? r.children : [r.child];
|
|
304
|
-
for (let r of e) if (!
|
|
304
|
+
for (let r of e) if (!F(r, n, t)) return;
|
|
305
305
|
}
|
|
306
|
-
},
|
|
306
|
+
}, L = (e, t = v(e)) => {
|
|
307
307
|
let n = [];
|
|
308
|
-
for (let r of
|
|
308
|
+
for (let r of P(e, t)) {
|
|
309
309
|
if (r.kind === "box") {
|
|
310
310
|
let e = r.children[0], i = r.children[r.children.length - 1];
|
|
311
|
-
e && i &&
|
|
311
|
+
e && i && F(e, t, (e) => (n.push({
|
|
312
312
|
child: e,
|
|
313
313
|
lastChildIndex: i.childIndex
|
|
314
314
|
}), !1));
|
|
315
315
|
continue;
|
|
316
316
|
}
|
|
317
|
-
|
|
317
|
+
F(r.child, t, (e) => (n.push({
|
|
318
318
|
child: e,
|
|
319
319
|
lastChildIndex: e.childIndex
|
|
320
320
|
}), !0));
|
|
321
321
|
}
|
|
322
322
|
return n;
|
|
323
|
-
},
|
|
323
|
+
}, R = (e) => e.body ?? void 0, z = (e) => {
|
|
324
324
|
let t = `/body/DocFragment[${e.spineItemIndex + 1}]/body`;
|
|
325
325
|
for (let n of e.steps) if (n.kind === "nodeIndex") t += `/${n.index}`;
|
|
326
326
|
else {
|
|
@@ -328,14 +328,14 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
328
328
|
t += n.index === void 0 ? `/${e}` : `/${e}[${n.index}]`;
|
|
329
329
|
}
|
|
330
330
|
return e.point === void 0 ? t : `${t}.${e.point}`;
|
|
331
|
-
},
|
|
331
|
+
}, B = 9, V = (e) => e.nodeType === B, H = (e, t, n) => {
|
|
332
332
|
let r = g(t, n), i, a = 0;
|
|
333
|
-
if (
|
|
333
|
+
if (I(e, (e) => e.kind !== "element" || g(e.node, n) !== r || (a++, e.node === t && (i = a), i === void 0 || a === 1)), i !== void 0) return {
|
|
334
334
|
kind: "element",
|
|
335
335
|
name: r,
|
|
336
336
|
index: a > 1 ? i : void 0
|
|
337
337
|
};
|
|
338
|
-
},
|
|
338
|
+
}, U = (e, t) => {
|
|
339
339
|
let n = [], r = e;
|
|
340
340
|
for (; r !== t;) {
|
|
341
341
|
if (!r || !h(r)) return;
|
|
@@ -344,14 +344,14 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
344
344
|
n.reverse();
|
|
345
345
|
let i = [], a = t, o = !1;
|
|
346
346
|
for (let e of n) {
|
|
347
|
-
let t =
|
|
347
|
+
let t = H(a, e, o);
|
|
348
348
|
if (!t) return;
|
|
349
349
|
i.push(t), e.localName.toLowerCase() === "svg" && (o = !0), a = e;
|
|
350
350
|
}
|
|
351
351
|
return i;
|
|
352
|
-
},
|
|
352
|
+
}, W = (e, t, n) => {
|
|
353
353
|
let r, i = 0, a = 0;
|
|
354
|
-
if (
|
|
354
|
+
if (I(e, (e) => {
|
|
355
355
|
if (e.kind !== "text") return !0;
|
|
356
356
|
if (a++, r === void 0 && e.node === t) {
|
|
357
357
|
let t = e.pieceIndex === e.pieceCount - 1;
|
|
@@ -363,42 +363,42 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
363
363
|
index: i,
|
|
364
364
|
count: a
|
|
365
365
|
};
|
|
366
|
-
},
|
|
367
|
-
let n =
|
|
368
|
-
for (let { child: i, lastChildIndex: a } of
|
|
366
|
+
}, le = (e, t) => {
|
|
367
|
+
let n = v(e), r = 0;
|
|
368
|
+
for (let { child: i, lastChildIndex: a } of L(e, n)) {
|
|
369
369
|
if (i.childIndex >= t || t <= a) break;
|
|
370
370
|
r++;
|
|
371
371
|
}
|
|
372
372
|
return (n.restructured || te(e)) && r > 0 ? void 0 : r;
|
|
373
|
-
},
|
|
373
|
+
}, G = (e, t) => {
|
|
374
374
|
if (!Number.isInteger(t) || t < 0) return;
|
|
375
|
-
let { node: n, offset: r } = e, i =
|
|
375
|
+
let { node: n, offset: r } = e, i = V(n) ? n : n.ownerDocument;
|
|
376
376
|
if (!i) return;
|
|
377
|
-
let a =
|
|
377
|
+
let a = R(i), o = (e, n) => e === void 0 ? void 0 : z({
|
|
378
378
|
spineItemIndex: t,
|
|
379
379
|
steps: e,
|
|
380
380
|
point: n,
|
|
381
381
|
containsBoxingElements: !1
|
|
382
382
|
});
|
|
383
|
-
if (!a) return
|
|
384
|
-
if (
|
|
385
|
-
if (
|
|
383
|
+
if (!a) return V(n) || n === i.documentElement ? o([], void 0) : void 0;
|
|
384
|
+
if (V(n)) return;
|
|
385
|
+
if (j(n)) {
|
|
386
386
|
let e = n.parentNode, t = r ?? 0;
|
|
387
387
|
if (!e || !h(e) || t < 0 || t > n.data.length) return;
|
|
388
|
-
let i =
|
|
388
|
+
let i = W(e, n, t);
|
|
389
389
|
if (!i) return;
|
|
390
|
-
let { piece: s } = i, c =
|
|
390
|
+
let { piece: s } = i, c = U(e, a);
|
|
391
391
|
return c ? (c.push({
|
|
392
392
|
kind: "text",
|
|
393
393
|
index: i.count > 1 ? i.index : void 0
|
|
394
|
-
}), o(c,
|
|
394
|
+
}), o(c, ae(n.data.slice(s.start, s.end), t - s.start, s.mode))) : void 0;
|
|
395
395
|
}
|
|
396
396
|
if (!h(n)) return;
|
|
397
|
-
if (r === void 0) return o(
|
|
397
|
+
if (r === void 0) return o(U(n, a), void 0);
|
|
398
398
|
if (r < 0 || r > n.childNodes.length) return;
|
|
399
|
-
let s =
|
|
400
|
-
return s === void 0 ? void 0 : o(
|
|
401
|
-
},
|
|
399
|
+
let s = le(n, r);
|
|
400
|
+
return s === void 0 ? void 0 : o(U(n, a), s);
|
|
401
|
+
}, K = [
|
|
402
402
|
"autoBoxing",
|
|
403
403
|
"tabularBox",
|
|
404
404
|
"rubyBox",
|
|
@@ -406,16 +406,16 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
406
406
|
"floatBox",
|
|
407
407
|
"inlineBox",
|
|
408
408
|
"pseudoElem"
|
|
409
|
-
],
|
|
409
|
+
], ue = new Set(K.map((e) => e.toLowerCase())), q = (e) => e >= 48 && e <= 57, de = /^[A-Za-z_][A-Za-z0-9_:-]*$/, J = (e) => e === void 0 || e === "/" || e === ".", Y = (e, t) => {
|
|
410
410
|
let n = t;
|
|
411
|
-
for (; n < e.length &&
|
|
411
|
+
for (; n < e.length && q(e.charCodeAt(n));) n++;
|
|
412
412
|
return n;
|
|
413
|
-
},
|
|
413
|
+
}, fe = (e) => {
|
|
414
414
|
let t = [], n = 0;
|
|
415
415
|
for (; n < e.length;) {
|
|
416
416
|
let r = e[n];
|
|
417
417
|
if (r === ".") {
|
|
418
|
-
let r = n + 1, i =
|
|
418
|
+
let r = n + 1, i = Y(e, r);
|
|
419
419
|
return i === r || i !== e.length ? void 0 : {
|
|
420
420
|
steps: t,
|
|
421
421
|
point: Number(e.slice(r, i))
|
|
@@ -423,9 +423,9 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
423
423
|
}
|
|
424
424
|
if (r !== "/") return;
|
|
425
425
|
let i = n + 1;
|
|
426
|
-
if (
|
|
427
|
-
let r =
|
|
428
|
-
if (!
|
|
426
|
+
if (q(e.charCodeAt(i))) {
|
|
427
|
+
let r = Y(e, i);
|
|
428
|
+
if (!J(e[r])) return;
|
|
429
429
|
let a = Number(e.slice(i, r));
|
|
430
430
|
if (a < 1) return;
|
|
431
431
|
t.push({
|
|
@@ -442,15 +442,15 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
442
442
|
let t = e.indexOf("]", a + 1);
|
|
443
443
|
if (t === -1) return;
|
|
444
444
|
let n = e.slice(a + 1, t);
|
|
445
|
-
if (n.length === 0 ||
|
|
445
|
+
if (n.length === 0 || Y(n, 0) !== n.length || (s = Number(n), s < 1)) return;
|
|
446
446
|
c = t + 1;
|
|
447
447
|
}
|
|
448
|
-
if (!
|
|
448
|
+
if (!J(e[c])) return;
|
|
449
449
|
if (o === "text()") t.push({
|
|
450
450
|
kind: "text",
|
|
451
451
|
index: s
|
|
452
452
|
});
|
|
453
|
-
else if (
|
|
453
|
+
else if (de.test(o)) t.push({
|
|
454
454
|
kind: "element",
|
|
455
455
|
name: o,
|
|
456
456
|
index: s
|
|
@@ -462,11 +462,11 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
462
462
|
steps: t,
|
|
463
463
|
point: void 0
|
|
464
464
|
};
|
|
465
|
-
},
|
|
466
|
-
let t =
|
|
465
|
+
}, X = (e, t) => e?.kind === "element" && e.name.toLowerCase() === t, Z = (e) => {
|
|
466
|
+
let t = fe(e);
|
|
467
467
|
if (!t) return;
|
|
468
468
|
let [n, r, i, ...a] = t.steps;
|
|
469
|
-
if (!
|
|
469
|
+
if (!X(n, "body") || (n.index ?? 1) !== 1 || !X(r, "docfragment")) return;
|
|
470
470
|
let o = (r.index ?? 1) - 1;
|
|
471
471
|
if (i === void 0) return {
|
|
472
472
|
spineItemIndex: o,
|
|
@@ -474,16 +474,16 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
474
474
|
point: void 0,
|
|
475
475
|
containsBoxingElements: !1
|
|
476
476
|
};
|
|
477
|
-
if (
|
|
477
|
+
if (X(i, "body") && (i.index ?? 1) === 1) return {
|
|
478
478
|
spineItemIndex: o,
|
|
479
479
|
steps: a,
|
|
480
480
|
point: t.point,
|
|
481
|
-
containsBoxingElements: a.some((e) => e.kind === "element" &&
|
|
481
|
+
containsBoxingElements: a.some((e) => e.kind === "element" && ue.has(e.name.toLowerCase()))
|
|
482
482
|
};
|
|
483
|
-
},
|
|
483
|
+
}, pe = (e, t) => {
|
|
484
484
|
let n = t.index ?? 1, r = t.kind === "element" ? t.name.toLowerCase() : void 0, i = 0, a;
|
|
485
|
-
return
|
|
486
|
-
},
|
|
485
|
+
return I(e, (e) => t.kind === "nodeIndex" || (t.kind === "text" ? e.kind === "text" : e.kind === "element" && e.node.localName.toLowerCase() === r) ? (i++, i !== n || (a = e, !1)) : !0), a;
|
|
486
|
+
}, me = (e, t, n) => {
|
|
487
487
|
let r = t[n]?.child;
|
|
488
488
|
return r ? r.kind === "text" && r.pieceIndex > 0 ? {
|
|
489
489
|
node: r.node,
|
|
@@ -495,10 +495,10 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
495
495
|
node: e,
|
|
496
496
|
offset: e.childNodes.length
|
|
497
497
|
};
|
|
498
|
-
},
|
|
499
|
-
let n = typeof e == "string" ?
|
|
498
|
+
}, Q = (e, t) => {
|
|
499
|
+
let n = typeof e == "string" ? Z(e) : e;
|
|
500
500
|
if (!n || n.containsBoxingElements) return;
|
|
501
|
-
let r =
|
|
501
|
+
let r = R(t);
|
|
502
502
|
if (!r) return n.steps.length === 0 ? { node: t.documentElement } : void 0;
|
|
503
503
|
let i = {
|
|
504
504
|
kind: "parent",
|
|
@@ -506,7 +506,7 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
506
506
|
};
|
|
507
507
|
for (let e of n.steps) {
|
|
508
508
|
if (i.kind === "text") return;
|
|
509
|
-
let t =
|
|
509
|
+
let t = pe(i.node, e);
|
|
510
510
|
if (!t) return;
|
|
511
511
|
i = t.kind === "element" ? {
|
|
512
512
|
kind: "parent",
|
|
@@ -518,7 +518,7 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
518
518
|
node: i.node,
|
|
519
519
|
offset: i.start
|
|
520
520
|
};
|
|
521
|
-
let e =
|
|
521
|
+
let e = oe(i.node.data.slice(i.start, i.end), n.point, i.mode);
|
|
522
522
|
return e === void 0 ? void 0 : {
|
|
523
523
|
node: i.node,
|
|
524
524
|
offset: i.start + e
|
|
@@ -526,33 +526,33 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
526
526
|
}
|
|
527
527
|
let a = i.node;
|
|
528
528
|
if (n.point === void 0) return { node: a };
|
|
529
|
-
let o =
|
|
530
|
-
if (!(n.point > o.length)) return
|
|
531
|
-
},
|
|
529
|
+
let o = L(a);
|
|
530
|
+
if (!(n.point > o.length)) return me(a, o, n.point);
|
|
531
|
+
}, $ = (e) => {
|
|
532
532
|
let { node: t, offset: n } = e;
|
|
533
533
|
if (!h(t) || n === void 0) return e;
|
|
534
534
|
let r = t.childNodes[n];
|
|
535
|
-
if (r) return
|
|
535
|
+
if (r) return j(r) ? {
|
|
536
536
|
node: r,
|
|
537
537
|
offset: 0
|
|
538
538
|
} : { node: r };
|
|
539
539
|
let i = t.lastChild;
|
|
540
|
-
return i &&
|
|
540
|
+
return i && j(i) ? {
|
|
541
541
|
node: i,
|
|
542
542
|
offset: i.data.length
|
|
543
543
|
} : { node: t };
|
|
544
544
|
}, he = (t, n) => {
|
|
545
545
|
try {
|
|
546
|
-
let r = typeof t == "string" ?
|
|
546
|
+
let r = typeof t == "string" ? Z(t) : t;
|
|
547
547
|
if (!r) return;
|
|
548
548
|
let i = n(r.spineItemIndex);
|
|
549
549
|
if (!i) return;
|
|
550
|
-
let a =
|
|
550
|
+
let a = Q(r, i.document);
|
|
551
551
|
if (!a) return;
|
|
552
|
-
let { node: o, offset: s } =
|
|
552
|
+
let { node: o, offset: s } = $(a);
|
|
553
553
|
return e({
|
|
554
554
|
node: o,
|
|
555
|
-
offset:
|
|
555
|
+
offset: j(o) ? s : void 0,
|
|
556
556
|
spineIndex: r.spineItemIndex,
|
|
557
557
|
spineId: i.id
|
|
558
558
|
});
|
|
@@ -566,7 +566,7 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
566
566
|
let { spineIndex: s } = o;
|
|
567
567
|
if (!Number.isInteger(s) || s < 0) return;
|
|
568
568
|
let c = r(e);
|
|
569
|
-
if (n(c)) return
|
|
569
|
+
if (n(c)) return z({
|
|
570
570
|
spineItemIndex: s,
|
|
571
571
|
steps: [],
|
|
572
572
|
point: void 0,
|
|
@@ -575,18 +575,18 @@ var a = /* @__PURE__ */ new Set(/* @__PURE__ */ "address.annotation.applet.artic
|
|
|
575
575
|
let l = a(s);
|
|
576
576
|
if (!l) return;
|
|
577
577
|
let u = i(c, l.document);
|
|
578
|
-
return u.node ?
|
|
578
|
+
return u.node ? G(u.isRange ? {
|
|
579
579
|
node: u.node.startContainer,
|
|
580
580
|
offset: u.node.startOffset
|
|
581
581
|
} : {
|
|
582
582
|
node: u.node,
|
|
583
|
-
offset:
|
|
583
|
+
offset: j(u.node) ? ge(u.offset) ?? 0 : void 0
|
|
584
584
|
}, s) : void 0;
|
|
585
585
|
} catch {
|
|
586
586
|
return;
|
|
587
587
|
}
|
|
588
588
|
};
|
|
589
589
|
//#endregion
|
|
590
|
-
export {
|
|
590
|
+
export { y as CRENGINE_TEXT_SPLIT_SIZE, K as XPOINTER_BOXING_ELEMENT_NAMES, _e as cfiToXPointer, G as generateXPointer, Z as parseXPointer, Q as resolveXPointer, z as serializeXPointer, $ as toCfiPosition, he as xPointerToCfi };
|
|
591
591
|
|
|
592
592
|
//# sourceMappingURL=index.js.map
|