pdf-skryba 0.10.2 → 1.0.1
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/CHANGELOG.md +58 -3
- package/README.md +22 -20
- package/dist/first-party/reader.js +1346 -1157
- package/dist/first-party/reader.js.map +4 -4
- package/dist/first-party.js +8 -7
- package/dist/first-party.js.map +2 -2
- package/dist/index.js +1370 -1181
- package/dist/index.js.map +4 -4
- package/dist/index.min.js +4 -4
- package/dist/light.js +7 -6
- package/dist/light.js.map +3 -3
- package/dist/light.min.js +1 -1
- package/dist/types/extractor/codecs/ccitt-fax.d.ts +3 -3
- package/dist/types/extractor/document-cache.d.ts +1 -1
- package/dist/types/extractor/extraction-cost.d.ts +2 -2
- package/dist/types/extractor/font-weight.d.ts +1 -6
- package/dist/types/extractor/glyph-positions.d.ts +14 -14
- package/dist/types/extractor/glyph-runs.d.ts +4 -4
- package/dist/types/extractor/glyph-window.d.ts +2 -2
- package/dist/types/extractor/pdf-aside-figures.d.ts +1 -1
- package/dist/types/extractor/pdf-bands.d.ts +3 -2
- package/dist/types/extractor/pdf-ccitt-images.d.ts +1 -1
- package/dist/types/extractor/pdf-colour-ours.d.ts +4 -4
- package/dist/types/extractor/pdf-decrypt.d.ts +1 -1
- package/dist/types/extractor/pdf-document-info.d.ts +4 -4
- package/dist/types/extractor/pdf-document-scale.d.ts +1 -1
- package/dist/types/extractor/pdf-embedded-images.d.ts +1 -1
- package/dist/types/extractor/pdf-facts.d.ts +3 -3
- package/dist/types/extractor/pdf-flate-images.d.ts +1 -1
- package/dist/types/extractor/pdf-font-bridge.d.ts +3 -3
- package/dist/types/extractor/pdf-font-objects.d.ts +6 -7
- package/dist/types/extractor/pdf-fonts/font-text.d.ts +6 -6
- package/dist/types/extractor/pdf-fonts/predefined-cmaps.d.ts +6 -6
- package/dist/types/extractor/pdf-fonts/type1-encoding.d.ts +1 -1
- package/dist/types/extractor/pdf-fonts/widths.d.ts +2 -2
- package/dist/types/extractor/pdf-glyph-source.d.ts +14 -15
- package/dist/types/extractor/pdf-hidden-text.d.ts +1 -5
- package/dist/types/extractor/pdf-image-anchors.d.ts +1 -1
- package/dist/types/extractor/pdf-image-pixels.d.ts +13 -13
- package/dist/types/extractor/pdf-image-refusal.d.ts +2 -2
- package/dist/types/extractor/pdf-images.d.ts +4 -4
- package/dist/types/extractor/pdf-jpeg-images.d.ts +1 -1
- package/dist/types/extractor/pdf-layers.d.ts +1 -1
- package/dist/types/extractor/pdf-letter-spacing.d.ts +1 -1
- package/dist/types/extractor/pdf-line-breaks.d.ts +2 -2
- package/dist/types/extractor/pdf-lines.d.ts +2 -0
- package/dist/types/extractor/pdf-links-ours.d.ts +2 -2
- package/dist/types/extractor/pdf-links.d.ts +2 -2
- package/dist/types/extractor/pdf-model.d.ts +8 -8
- package/dist/types/extractor/pdf-objects/bounds.d.ts +4 -4
- package/dist/types/extractor/pdf-objects/content.d.ts +4 -4
- package/dist/types/extractor/pdf-objects/document.d.ts +14 -14
- package/dist/types/extractor/pdf-objects/objects.d.ts +10 -10
- package/dist/types/extractor/pdf-objects/parse.d.ts +4 -4
- package/dist/types/extractor/pdf-objects/refusal.d.ts +3 -3
- package/dist/types/extractor/pdf-objects/streams.d.ts +4 -4
- package/dist/types/extractor/pdf-objects/xref.d.ts +3 -3
- package/dist/types/extractor/pdf-objstm-guard.d.ts +1 -1
- package/dist/types/extractor/pdf-objstm-source.d.ts +1 -1
- package/dist/types/extractor/pdf-open.d.ts +1 -1
- package/dist/types/extractor/pdf-ops-ours.d.ts +4 -3
- package/dist/types/extractor/pdf-ops.d.ts +9 -9
- package/dist/types/extractor/pdf-outline.d.ts +3 -3
- package/dist/types/extractor/pdf-page-content.d.ts +2 -2
- package/dist/types/extractor/pdf-page-figures.d.ts +1 -1
- package/dist/types/extractor/pdf-page-plan.d.ts +7 -3
- package/dist/types/extractor/pdf-page-stages.d.ts +2 -2
- package/dist/types/extractor/pdf-paragraphs.d.ts +1 -1
- package/dist/types/extractor/pdf-paths-ours.d.ts +4 -8
- package/dist/types/extractor/pdf-reading-order.d.ts +7 -0
- package/dist/types/extractor/pdf-reference-ours.d.ts +2 -2
- package/dist/types/extractor/pdf-region-order.d.ts +2 -2
- package/dist/types/extractor/pdf-scanned.d.ts +2 -2
- package/dist/types/extractor/pdf-smask.d.ts +3 -3
- package/dist/types/extractor/pdf-source.d.ts +33 -32
- package/dist/types/extractor/pdf-stencil-images.d.ts +1 -1
- package/dist/types/extractor/pdf-structure.d.ts +1 -1
- package/dist/types/extractor/pdf-symbol-page.d.ts +2 -2
- package/dist/types/extractor/pdf-symbol-verdict.d.ts +3 -3
- package/dist/types/extractor/pdf-table-detector.d.ts +6 -6
- package/dist/types/extractor/pdf-table-render.d.ts +1 -1
- package/dist/types/extractor/text-writing-direction.d.ts +1 -1
- package/dist/types/layout/cell-text.d.ts +1 -1
- package/dist/types/layout/column-discriminant.d.ts +2 -2
- package/dist/types/layout/column-grid.d.ts +4 -4
- package/dist/types/layout/cut-word.d.ts +3 -3
- package/dist/types/layout/geometry.d.ts +3 -3
- package/dist/types/layout/grid-band.d.ts +3 -3
- package/dist/types/layout/gutter.d.ts +6 -6
- package/dist/types/layout/heading-sizes.d.ts +2 -2
- package/dist/types/layout/hidden-repaints.d.ts +1 -1
- package/dist/types/layout/hyphenation.d.ts +1 -1
- package/dist/types/layout/image-frontier.d.ts +1 -1
- package/dist/types/layout/induced-markers.d.ts +2 -2
- package/dist/types/layout/intervals.d.ts +3 -3
- package/dist/types/layout/list.d.ts +9 -9
- package/dist/types/layout/merged-cells.d.ts +1 -1
- package/dist/types/layout/mode.d.ts +2 -2
- package/dist/types/layout/superscript.d.ts +1 -1
- package/dist/types/layout/text-size.d.ts +1 -1
- package/dist/types/layout/vector-grid.d.ts +5 -5
- package/dist/types/lib/chunk.d.ts +1 -1
- package/dist/types/lib/extent.d.ts +2 -2
- package/dist/types/lib/link-schemes.d.ts +1 -1
- package/dist/types/lib/pdf-first-party.d.ts +4 -4
- package/dist/types/lib/pdf-light.d.ts +2 -2
- package/dist/types/lib/reader-options.d.ts +3 -3
- package/dist/types/lib/table-leading-bands.d.ts +2 -2
- package/dist/types/pipeline/cut-paragraph-repair.d.ts +1 -1
- package/dist/types/pipeline/glued-word-repair.d.ts +1 -1
- package/dist/types/pipeline/pdf-conservation-source.d.ts +8 -8
- package/package.json +1 -1
package/dist/first-party.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// src/lib/chunk.ts
|
|
2
|
-
function
|
|
2
|
+
function splitIntoChunks(items, size) {
|
|
3
3
|
const groups = [];
|
|
4
4
|
for (let start = 0; start < items.length; start += size) groups.push(items.slice(start, start + size));
|
|
5
5
|
return groups;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
// src/lib/link-schemes.ts
|
|
9
|
-
var
|
|
9
|
+
var PUBLISHED_LINK_SCHEME_PATTERN = /^(?:https?|mailto):/i;
|
|
10
10
|
|
|
11
11
|
// src/pipeline/glued-word-repair.ts
|
|
12
12
|
import { conservationKey } from "doc-ir";
|
|
@@ -62,6 +62,7 @@ var findSpaceInsertions = (blocks, respacing) => {
|
|
|
62
62
|
const token = findGluedToken(blocks, respacing);
|
|
63
63
|
if (token === void 0) return void 0;
|
|
64
64
|
const sourceKeys = respacing.sourceWords.map(conservationKey);
|
|
65
|
+
if (sourceKeys.some((key) => key.length === 0)) return void 0;
|
|
65
66
|
const tokenKey = conservationKey(token.map((codePoint) => codePoint.text).join(""));
|
|
66
67
|
if (token.map((codePoint) => codePoint.key).join("") !== tokenKey || sourceKeys.join("") !== tokenKey)
|
|
67
68
|
return void 0;
|
|
@@ -106,7 +107,7 @@ function gluedWordEdits(page, respacings) {
|
|
|
106
107
|
return { edits, repaired };
|
|
107
108
|
}
|
|
108
109
|
var countSplitWords = (verdict) => verdict.respacings.filter((respacing) => respacing.kind === "split").length;
|
|
109
|
-
var
|
|
110
|
+
var isGluedRepairNoWorse = (before, after, repaired) => after.lostLetters <= before.lostLetters && (after.decision !== "lost" || before.decision === "lost") && after.decision !== "abstain" && after.gluedWords <= before.gluedWords - repaired && after.unmatchedPageWords <= before.unmatchedPageWords && countSplitWords(after) <= countSplitWords(before);
|
|
110
111
|
|
|
111
112
|
// src/pipeline/lost-text-repair.ts
|
|
112
113
|
import {
|
|
@@ -165,10 +166,10 @@ function placeLostPassages(page, passages) {
|
|
|
165
166
|
return { insertions, abstentions };
|
|
166
167
|
}
|
|
167
168
|
export {
|
|
168
|
-
|
|
169
|
-
chunk,
|
|
169
|
+
PUBLISHED_LINK_SCHEME_PATTERN,
|
|
170
170
|
gluedWordEdits,
|
|
171
|
-
|
|
172
|
-
placeLostPassages
|
|
171
|
+
isGluedRepairNoWorse,
|
|
172
|
+
placeLostPassages,
|
|
173
|
+
splitIntoChunks
|
|
173
174
|
};
|
|
174
175
|
//# sourceMappingURL=first-party.js.map
|
package/dist/first-party.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/lib/chunk.ts", "../src/lib/link-schemes.ts", "../src/pipeline/glued-word-repair.ts", "../src/pipeline/lost-text-repair.ts"],
|
|
4
|
-
"sourcesContent": ["/** Splits a list into consecutive groups of at most `size` items, in order. Each caller decides what a group is and\n * how large it may be; this module imports nothing. */\nexport function chunk<T>(items: readonly T[], size: number): T[][] {\n const groups: T[][] = [];\n for (let start = 0; start < items.length; start += size) groups.push(items.slice(start, start + size));\n return groups;\n}\n", "/** The URI schemes an external link may keep when it is published: http, https and mailto. A link whose\n * target is not a web page or a mail address is not one a published page vouches for (`javascript:` runs a script,\n * `file:` points at the reader's own disk), so the words of any other scheme stay plain text. */\nexport const PUBLISHED_SCHEME = /^(?:https?|mailto):/i;\n", "/**\n * Proves where a glued page word should be split again, from the PDF's own reading, and hands the spaces back to the\n * caller as edits. The caller applies them and re-checks the page with `noWorse`.\n *\n * THE RULE. A page token is split only when its letters, as the conservation check normalises them, are exactly the\n * concatenation of the two or more consecutive source words the word reading proved. A space goes at each boundary the\n * source gives, and nothing else changes. Anything less certain is left alone and stays counted as glued.\n *\n * WHERE PUNCTUATION GOES. Between the last letter of one source word and the first of the next, the page may carry\n * non-letters (\u00AB IV.1.1)Vrsta \u00BB). They are split as the source words carry them: the first word's trailing characters,\n * then the next word's leading ones. When the page's characters there are not exactly those, the token is left alone\n * rather than guessed.\n *\n * Offsets are indices in the text the caller published, block by block, so the decision holds for any markup.\n *\n * The page text is the client's: it stays in memory only, like the verdict it reads.\n */\n\nimport { conservationKey, type ConservationVerdict, type PageEdit, type PublishedPage, type Respacing } from \"doc-ir\";\n\n/** One code point of a published block: its text, its letters as the check normalises them, and where it ends in\n * that block's text. */\ninterface CodePoint {\n readonly text: string;\n readonly key: string;\n readonly end: number;\n}\n\n/** One code point (the `u` flag makes `[\\s\\S]` match a whole surrogate pair), so that `end` is a UTF-16 index usable\n * with `slice`. */\nconst CODE_POINT = /[\\s\\S]/gu;\n\nconst splitCodePoints = (text: string): CodePoint[] =>\n [...text.matchAll(CODE_POINT)].map((match) => ({\n text: match[0],\n key: conservationKey(match[0]),\n end: match.index + match[0].length,\n }));\n\n/** The block's words as the check splits them: runs of non-space code points holding at least one letter. The same\n * split as doc-ir's `wordKeysOf`, kept by code point so that offsets can be located. */\nconst splitWords = (codePoints: readonly CodePoint[]): CodePoint[][] => {\n const words: CodePoint[][] = [];\n let current: CodePoint[] = [];\n const closeWord = (): void => {\n if (conservationKey(current.map((codePoint) => codePoint.text).join(\"\")).length > 0) words.push(current);\n current = [];\n };\n for (const codePoint of codePoints) {\n if (/^\\s+$/u.test(codePoint.text)) closeWord();\n else current.push(codePoint);\n }\n closeWord();\n return words;\n};\n\n/** The leading or trailing characters of a source word that carry no letter. */\nconst readNonLetterEdge = (word: string, side: \"lead\" | \"trail\"): string => {\n const characters = [...word];\n const ordered = side === \"lead\" ? characters : [...characters].reverse();\n const edge: string[] = [];\n for (const character of ordered) {\n if (conservationKey(character).length > 0) break;\n edge.push(character);\n }\n return (side === \"lead\" ? edge : [...edge].reverse()).join(\"\");\n};\n\n/** A renderer may put a zero-width space before a superscript glued to a word. It carries nothing the source says:\n * it is passed over between the words, and the space goes before it. */\nconst removeZeroWidthSpaces = (text: string): string => text.replaceAll(\"\\u200B\", \"\");\n\n/** The page token a respacing points at, or `undefined` when the respacing is not one glued page word made of two or\n * more source words. */\nconst findGluedToken = (blocks: readonly string[], respacing: Respacing): CodePoint[] | undefined => {\n const pageWord = respacing.pageWords[0];\n if (\n respacing.kind !== \"glued\" ||\n respacing.pageWords.length !== 1 ||\n pageWord === undefined ||\n respacing.sourceWords.length < 2\n )\n return undefined;\n const text = blocks[pageWord.block];\n if (text === undefined) return undefined;\n return splitWords(splitCodePoints(text))[pageWord.word];\n};\n\n/** How many of the non-letter code points between two source words belong to the first word, or `undefined` when they\n * are not exactly the first word's trailing characters followed by the next word's leading ones. */\nconst countTrailingCodePoints = (between: readonly CodePoint[], trail: string, lead: string): number | undefined => {\n if (removeZeroWidthSpaces(between.map((codePoint) => codePoint.text).join(\"\")) !== trail + lead) return undefined;\n let taken = \"\";\n let takenCount = 0;\n while (taken.length < trail.length && takenCount < between.length) {\n taken += removeZeroWidthSpaces(between[takenCount++]!.text);\n }\n return taken === trail ? takenCount : undefined;\n};\n\n/** Where in its block one glued token takes its spaces (character indices), or `undefined` to leave it alone. */\nconst findSpaceInsertions = (blocks: readonly string[], respacing: Respacing): number[] | undefined => {\n const token = findGluedToken(blocks, respacing);\n if (token === undefined) return undefined;\n const sourceKeys = respacing.sourceWords.map(conservationKey);\n const tokenKey = conservationKey(token.map((codePoint) => codePoint.text).join(\"\"));\n // Code point by code point, the letters must add up to the token's own (NFKC can join across characters), and the\n // token must be exactly the source words.\n if (token.map((codePoint) => codePoint.key).join(\"\") !== tokenKey || sourceKeys.join(\"\") !== tokenKey)\n return undefined;\n\n const offsets: number[] = [];\n let position = 0;\n let letterCount = 0;\n for (let sourceIndex = 0; sourceIndex < sourceKeys.length - 1; sourceIndex++) {\n const boundary = letterCount + sourceKeys[sourceIndex]!.length;\n // The code point carrying the first word's last letter must end exactly at the boundary.\n while (position < token.length && letterCount + token[position]!.key.length <= boundary && letterCount < boundary)\n letterCount += token[position++]!.key.length;\n if (letterCount !== boundary) return undefined;\n // The non-letters up to the next word's first letter, split as the source says.\n let nextLetter = position;\n while (nextLetter < token.length && token[nextLetter]!.key.length === 0) nextLetter++;\n const takenCount = countTrailingCodePoints(\n token.slice(position, nextLetter),\n readNonLetterEdge(respacing.sourceWords[sourceIndex]!, \"trail\"),\n readNonLetterEdge(respacing.sourceWords[sourceIndex + 1]!, \"lead\"),\n );\n if (takenCount === undefined) return undefined;\n offsets.push(token[position + takenCount - 1]!.end);\n position += takenCount;\n }\n return offsets;\n};\n\n/** The spaces this check proves, as edits for the caller to apply to its own page; `repaired` counts the glued tokens\n * that got all of theirs. It writes nothing: composing a page is the caller's job. */\nexport function gluedWordEdits(\n page: PublishedPage,\n respacings: readonly Respacing[],\n): { edits: PageEdit[]; repaired: number } {\n const glued = respacings.filter((respacing) => respacing.kind === \"glued\");\n if (glued.length === 0) return { edits: [], repaired: 0 };\n const takenOffsets = new Set<string>();\n const edits: PageEdit[] = [];\n let repaired = 0;\n for (const respacing of glued) {\n const block = respacing.pageWords[0]?.block;\n const offsets = findSpaceInsertions(page.blocks, respacing);\n if (\n offsets === undefined ||\n block === undefined ||\n offsets.some((offset) => takenOffsets.has(`${block}:${offset}`))\n )\n continue;\n for (const atChar of offsets) {\n takenOffsets.add(`${block}:${atChar}`);\n edits.push({ kind: \"insert-space\", block, atChar });\n }\n repaired += 1;\n }\n return { edits, repaired };\n}\n\n/** How many respacings of the verdict are splits: a source word published as several page words. */\nconst countSplitWords = (verdict: ConservationVerdict): number =>\n verdict.respacings.filter((respacing) => respacing.kind === \"split\").length;\n\n/** Whether the re-checked page is no worse than the original in any way. The caller applies the edits and re-checks,\n * because it writes the page; the rule for keeping or undoing a repair stays here, so that no caller keeps a page\n * that lost a letter. A repair is kept whole or not at all. */\nexport const noWorse = (before: ConservationVerdict, after: ConservationVerdict, repaired: number): boolean =>\n after.lostLetters <= before.lostLetters &&\n (after.decision !== \"lost\" || before.decision === \"lost\") &&\n after.decision !== \"abstain\" &&\n after.gluedWords <= before.gluedWords - repaired &&\n after.unmatchedPageWords <= before.unmatchedPageWords &&\n countSplitWords(after) <= countSplitWords(before);\n", "/**\n * Decides where a passage the render lost goes back into the published page, as its own unit between the two adjacent\n * units that hold its source neighbours. It hands the caller the edit and the letters it puts back, or why it\n * abstains; applying the edit, re-checking the page and keeping or undoing the repair are the caller's.\n *\n * THE RULE. A lost passage is a run of consecutive source words neither reading of the conservation check found. Its\n * neighbours are the source words right before and right after it. It goes back only when:\n * - each neighbour is a word the page matched (not an alternate text, a list number or a re-spacing: those have no\n * single place in the page);\n * - the neighbour before is the last word of a paragraph or heading unit, the one after the first word of the next\n * unit, with nothing between the two;\n * - at the start or the end of the document, the one neighbour opens the page's first block, or closes its last one.\n * Anything else abstains by name and the page stays \u00AB lost \u00BB: a loss inside a paragraph, a table cell or a list, or an\n * image between the two paragraphs. A paragraph cut in the wrong place reads as if nothing were wrong; a \u00AB N characters\n * are not published \u00BB notice does not.\n *\n * THE UNDO IS THE CALLER'S. This module hands back only what the re-check needs: for each passage placed, the edit\n * and the number of letters it puts back (`LostTextInsertion`); for each passage left out, why\n * (`LostTextAbstention`). A caller that wants an exact repair keeps it only when the lost letters drop by exactly the\n * letters handed back and nothing else of the page moves.\n *\n * WHERE IT LANDS IS THE SOURCE'S ORDER, NOT THE RENDER'S. The neighbours are read in content stream order. Measured on\n * 871 paragraphs cut from 45 renders: 426 put back with the page's letters exactly as before, 22 put back elsewhere,\n * where the content stream reads them; some of those read better than the render did, some worse (a second column read\n * line by line). Tried and not kept: also requiring the blocks on each side to follow the source's order. It caught 8\n * of the 22 and cost 17 exact repairs. Text back in the page is what search needs; a paragraph slightly out of place\n * is the lesser defect.\n *\n * The page text is the client's: it stays in memory only, like the verdict it reads.\n */\n\nimport {\n conservationKey,\n wordKeysOf,\n type LostPassage,\n type PageEdit,\n type PageWordAt,\n type PublishedPage,\n} from \"doc-ir\";\n\n/** Why a lost passage was not put back: a closed list. */\nexport type LostTextAbstention =\n | \"no-anchor\"\n | \"anchor-unmatched\"\n | \"anchors-out-of-order\"\n | \"anchor-in-container\"\n | \"loss-inside-block\"\n | \"blocks-not-adjacent\";\n\n/** One passage placed: the edit the caller applies, and the letters it puts back, for the caller's accounting. */\nexport interface LostTextInsertion {\n edit: PageEdit;\n letters: number;\n}\n\n/** Whether `later` sits strictly after `earlier` in the page's reading order (block, then word). */\nconst isAfterInPageOrder = (later: PageWordAt, earlier: PageWordAt): boolean =>\n later.block > earlier.block || (later.block === earlier.block && later.word > earlier.word);\n\n/** Where each lost passage goes, as an edit for the caller to apply, or why it goes nowhere.\n *\n * It reasons on the page's units (`PublishedPage.units`), never on markup. The reason of each abstention travels to the\n * caller, so that a reader of the result knows why nothing was repaired.\n *\n * `units` absent (the caller cannot say what a unit is): every passage abstains with `anchor-in-container`, the same\n * answer as for a page whose anchors sit where a paragraph may not go.\n */\nexport function placeLostPassages(\n page: PublishedPage,\n passages: readonly LostPassage[],\n): { insertions: LostTextInsertion[]; abstentions: LostTextAbstention[] } {\n const insertions: LostTextInsertion[] = [];\n const abstentions: LostTextAbstention[] = [];\n if (passages.length === 0) return { insertions, abstentions };\n const units = page.units;\n const wordCountByBlock = page.blocks.map((text) => wordKeysOf(text).length);\n const lastBlock = wordCountByBlock.length - 1;\n const findUnitOfBlock = (block: number): number => units?.findIndex((unit) => unit.blocks.includes(block)) ?? -1;\n\n /** The anchor's unit, or why it cannot anchor. */\n const findAnchorUnit = (anchor: PageWordAt, side: \"before\" | \"after\"): number | LostTextAbstention => {\n const unitIndex = findUnitOfBlock(anchor.block);\n if (unitIndex < 0 || units?.[unitIndex]?.paragraphOrHeading !== true) return \"anchor-in-container\";\n // The loss must sit at the unit's edge: the anchor before is the unit's last word, the anchor after its first.\n const neighbourBlock = side === \"before\" ? anchor.block + 1 : anchor.block - 1;\n const isAtEdge = side === \"before\" ? anchor.word === (wordCountByBlock[anchor.block] ?? 0) - 1 : anchor.word === 0;\n if (!isAtEdge || findUnitOfBlock(neighbourBlock) === unitIndex) return \"loss-inside-block\";\n return unitIndex;\n };\n\n /** The unit the passage goes after (`-1`: before the first unit), or why it goes nowhere. */\n const placePassage = (passage: LostPassage): number | LostTextAbstention => {\n const { before, after } = passage;\n if (before === \"unanchored\" || after === \"unanchored\") return \"anchor-unmatched\";\n if (before === \"document-edge\" && after === \"document-edge\") return \"no-anchor\";\n if (before !== \"document-edge\" && after !== \"document-edge\" && !isAfterInPageOrder(after, before))\n return \"anchors-out-of-order\";\n const unitBefore = before === \"document-edge\" ? undefined : findAnchorUnit(before, \"before\");\n if (typeof unitBefore === \"string\") return unitBefore;\n const unitAfter = after === \"document-edge\" ? undefined : findAnchorUnit(after, \"after\");\n if (typeof unitAfter === \"string\") return unitAfter;\n // At the start of the document, the passage goes before the unit that opens the page's first block.\n if (unitBefore === undefined) {\n if (unitAfter === undefined || after === \"document-edge\" || after.block !== 0) return \"no-anchor\";\n return unitAfter - 1;\n }\n // At the end of the document, the passage goes after the unit that closes the page's last block.\n if (unitAfter === undefined) {\n if (before === \"document-edge\" || before.block !== lastBlock) return \"no-anchor\";\n return unitBefore;\n }\n if (unitAfter !== unitBefore + 1 || units?.[unitBefore]?.adjacentToNext !== true) return \"blocks-not-adjacent\";\n return unitBefore;\n };\n\n for (const passage of passages) {\n const placement = placePassage(passage);\n if (typeof placement === \"string\") {\n abstentions.push(placement);\n continue;\n }\n insertions.push({\n edit: { kind: \"insert-unit-after\", unit: placement, text: passage.sourceWords.join(\" \") },\n letters: passage.sourceWords.reduce((letterTotal, word) => letterTotal + conservationKey(word).length, 0),\n });\n }\n return { insertions, abstentions };\n}\n"],
|
|
5
|
-
"mappings": ";AAEO,SAAS,
|
|
4
|
+
"sourcesContent": ["/** Splits a list into consecutive groups of at most `size` items, in order. Each caller decides what a group is and\n * how large it may be; this module imports nothing. */\nexport function splitIntoChunks<T>(items: readonly T[], size: number): T[][] {\n const groups: T[][] = [];\n for (let start = 0; start < items.length; start += size) groups.push(items.slice(start, start + size));\n return groups;\n}\n", "/** The URI schemes an external link may keep when it is published: http, https and mailto. A link whose\n * target is not a web page or a mail address is not one a published page vouches for (`javascript:` runs a script,\n * `file:` points at the reader's own disk), so the words of any other scheme stay plain text. */\nexport const PUBLISHED_LINK_SCHEME_PATTERN = /^(?:https?|mailto):/i;\n", "/**\n * Proves where a glued page word should be split again, from the PDF's own reading, and hands the spaces back to the\n * caller as edits. The caller applies them and re-checks the page with `isGluedRepairNoWorse`.\n *\n * THE RULE. A page token is split only when its letters, as the conservation check normalises them, are exactly the\n * concatenation of the two or more consecutive source words the word reading proved. A space goes at each boundary the\n * source gives, and nothing else changes. Anything less certain is left alone and stays counted as glued.\n *\n * WHERE PUNCTUATION GOES. Between the last letter of one source word and the first of the next, the page may carry\n * non-letters (\u00AB IV.1.1)Vrsta \u00BB). They are split as the source words carry them: the first word's trailing characters,\n * then the next word's leading ones. When the page's characters there are not exactly those, the token is left alone\n * rather than guessed.\n *\n * Offsets are indices in the text the caller published, block by block, so the decision holds for any markup.\n *\n * The page text is the client's: it stays in memory only, like the verdict it reads.\n */\n\nimport { conservationKey, type ConservationVerdict, type PageEdit, type PublishedPage, type Respacing } from \"doc-ir\";\n\n/** One code point of a published block: its text, its letters as the check normalises them, and where it ends in\n * that block's text. */\ninterface CodePoint {\n readonly text: string;\n readonly key: string;\n readonly end: number;\n}\n\n/** One code point (the `u` flag makes `[\\s\\S]` match a whole surrogate pair), so that `end` is a UTF-16 index usable\n * with `slice`. */\nconst CODE_POINT = /[\\s\\S]/gu;\n\nconst splitCodePoints = (text: string): CodePoint[] =>\n [...text.matchAll(CODE_POINT)].map((match) => ({\n text: match[0],\n key: conservationKey(match[0]),\n end: match.index + match[0].length,\n }));\n\n/** The block's words as the check splits them: runs of non-space code points holding at least one letter. The same\n * split as doc-ir's `wordKeysOf`, kept by code point so that offsets can be located. */\nconst splitWords = (codePoints: readonly CodePoint[]): CodePoint[][] => {\n const words: CodePoint[][] = [];\n let current: CodePoint[] = [];\n const closeWord = (): void => {\n if (conservationKey(current.map((codePoint) => codePoint.text).join(\"\")).length > 0) words.push(current);\n current = [];\n };\n for (const codePoint of codePoints) {\n if (/^\\s+$/u.test(codePoint.text)) closeWord();\n else current.push(codePoint);\n }\n closeWord();\n return words;\n};\n\n/** The leading or trailing characters of a source word that carry no letter. */\nconst readNonLetterEdge = (word: string, side: \"lead\" | \"trail\"): string => {\n const characters = [...word];\n const ordered = side === \"lead\" ? characters : [...characters].reverse();\n const edge: string[] = [];\n for (const character of ordered) {\n if (conservationKey(character).length > 0) break;\n edge.push(character);\n }\n return (side === \"lead\" ? edge : [...edge].reverse()).join(\"\");\n};\n\n/** A renderer may put a zero-width space before a superscript glued to a word. It carries nothing the source says:\n * it is passed over between the words, and the space goes before it. */\nconst removeZeroWidthSpaces = (text: string): string => text.replaceAll(\"\\u200B\", \"\");\n\n/** The page token a respacing points at, or `undefined` when the respacing is not one glued page word made of two or\n * more source words. */\nconst findGluedToken = (blocks: readonly string[], respacing: Respacing): CodePoint[] | undefined => {\n const pageWord = respacing.pageWords[0];\n if (\n respacing.kind !== \"glued\" ||\n respacing.pageWords.length !== 1 ||\n pageWord === undefined ||\n respacing.sourceWords.length < 2\n )\n return undefined;\n const text = blocks[pageWord.block];\n if (text === undefined) return undefined;\n return splitWords(splitCodePoints(text))[pageWord.word];\n};\n\n/** How many of the non-letter code points between two source words belong to the first word, or `undefined` when they\n * are not exactly the first word's trailing characters followed by the next word's leading ones. */\nconst countTrailingCodePoints = (between: readonly CodePoint[], trail: string, lead: string): number | undefined => {\n if (removeZeroWidthSpaces(between.map((codePoint) => codePoint.text).join(\"\")) !== trail + lead) return undefined;\n let taken = \"\";\n let takenCount = 0;\n while (taken.length < trail.length && takenCount < between.length) {\n taken += removeZeroWidthSpaces(between[takenCount++]!.text);\n }\n return taken === trail ? takenCount : undefined;\n};\n\n/** Where in its block one glued token takes its spaces (character indices), or `undefined` to leave it alone. */\nconst findSpaceInsertions = (blocks: readonly string[], respacing: Respacing): number[] | undefined => {\n const token = findGluedToken(blocks, respacing);\n if (token === undefined) return undefined;\n const sourceKeys = respacing.sourceWords.map(conservationKey);\n // A source word with no letter marks no boundary of its own: first, its boundary would fall before the token's first\n // code point (no character to put a space after); between two words, it would double the space of its neighbour's.\n if (sourceKeys.some((key) => key.length === 0)) return undefined;\n const tokenKey = conservationKey(token.map((codePoint) => codePoint.text).join(\"\"));\n // Code point by code point, the letters must add up to the token's own (NFKC can join across characters), and the\n // token must be exactly the source words.\n if (token.map((codePoint) => codePoint.key).join(\"\") !== tokenKey || sourceKeys.join(\"\") !== tokenKey)\n return undefined;\n\n const offsets: number[] = [];\n let position = 0;\n let letterCount = 0;\n for (let sourceIndex = 0; sourceIndex < sourceKeys.length - 1; sourceIndex++) {\n const boundary = letterCount + sourceKeys[sourceIndex]!.length;\n // The code point carrying the first word's last letter must end exactly at the boundary.\n while (position < token.length && letterCount + token[position]!.key.length <= boundary && letterCount < boundary)\n letterCount += token[position++]!.key.length;\n if (letterCount !== boundary) return undefined;\n // The non-letters up to the next word's first letter, split as the source says.\n let nextLetter = position;\n while (nextLetter < token.length && token[nextLetter]!.key.length === 0) nextLetter++;\n const takenCount = countTrailingCodePoints(\n token.slice(position, nextLetter),\n readNonLetterEdge(respacing.sourceWords[sourceIndex]!, \"trail\"),\n readNonLetterEdge(respacing.sourceWords[sourceIndex + 1]!, \"lead\"),\n );\n if (takenCount === undefined) return undefined;\n offsets.push(token[position + takenCount - 1]!.end);\n position += takenCount;\n }\n return offsets;\n};\n\n/** The spaces this check proves, as edits for the caller to apply to its own page; `repaired` counts the glued tokens\n * that got all of theirs. It writes nothing: composing a page is the caller's job. */\nexport function gluedWordEdits(\n page: PublishedPage,\n respacings: readonly Respacing[],\n): { edits: PageEdit[]; repaired: number } {\n const glued = respacings.filter((respacing) => respacing.kind === \"glued\");\n if (glued.length === 0) return { edits: [], repaired: 0 };\n const takenOffsets = new Set<string>();\n const edits: PageEdit[] = [];\n let repaired = 0;\n for (const respacing of glued) {\n const block = respacing.pageWords[0]?.block;\n const offsets = findSpaceInsertions(page.blocks, respacing);\n if (\n offsets === undefined ||\n block === undefined ||\n offsets.some((offset) => takenOffsets.has(`${block}:${offset}`))\n )\n continue;\n for (const atChar of offsets) {\n takenOffsets.add(`${block}:${atChar}`);\n edits.push({ kind: \"insert-space\", block, atChar });\n }\n repaired += 1;\n }\n return { edits, repaired };\n}\n\n/** How many respacings of the verdict are splits: a source word published as several page words. */\nconst countSplitWords = (verdict: ConservationVerdict): number =>\n verdict.respacings.filter((respacing) => respacing.kind === \"split\").length;\n\n/** Whether the re-checked page is no worse than the original in any way. The caller applies the edits and re-checks,\n * because it writes the page; the rule for keeping or undoing a repair stays here, so that no caller keeps a page\n * that lost a letter. A repair is kept whole or not at all. */\nexport const isGluedRepairNoWorse = (\n before: ConservationVerdict,\n after: ConservationVerdict,\n repaired: number,\n): boolean =>\n after.lostLetters <= before.lostLetters &&\n (after.decision !== \"lost\" || before.decision === \"lost\") &&\n after.decision !== \"abstain\" &&\n after.gluedWords <= before.gluedWords - repaired &&\n after.unmatchedPageWords <= before.unmatchedPageWords &&\n countSplitWords(after) <= countSplitWords(before);\n", "/**\n * Decides where a passage the render lost goes back into the published page, as its own unit between the two adjacent\n * units that hold its source neighbours. It hands the caller the edit and the letters it puts back, or why it\n * abstains; applying the edit, re-checking the page and keeping or undoing the repair are the caller's.\n *\n * THE RULE. A lost passage is a run of consecutive source words neither reading of the conservation check found. Its\n * neighbours are the source words right before and right after it. It goes back only when:\n * - each neighbour is a word the page matched (not an alternate text, a list number or a re-spacing: those have no\n * single place in the page);\n * - the neighbour before is the last word of a paragraph or heading unit, the one after the first word of the next\n * unit, with nothing between the two;\n * - at the start or the end of the document, the one neighbour opens the page's first block, or closes its last one.\n * Anything else abstains by name and the page stays \u00AB lost \u00BB: a loss inside a paragraph, a table cell or a list, or an\n * image between the two paragraphs. A paragraph cut in the wrong place reads as if nothing were wrong; a \u00AB N characters\n * are not published \u00BB notice does not.\n *\n * THE UNDO IS THE CALLER'S. This module hands back only what the re-check needs: for each passage placed, the edit\n * and the number of letters it puts back (`LostTextInsertion`); for each passage left out, why\n * (`LostTextAbstention`). A caller that wants an exact repair keeps it only when the lost letters drop by exactly the\n * letters handed back and nothing else of the page moves.\n *\n * WHERE IT LANDS IS THE SOURCE'S ORDER, NOT THE RENDER'S. The neighbours are read in content stream order. Measured on\n * 871 paragraphs cut from 45 renders: 426 put back with the page's letters exactly as before, 22 put back elsewhere,\n * where the content stream reads them; some of those read better than the render did, some worse (a second column read\n * line by line). Tried and not kept: also requiring the blocks on each side to follow the source's order. It caught 8\n * of the 22 and cost 17 exact repairs. Text back in the page is what search needs; a paragraph slightly out of place\n * is the lesser defect.\n *\n * The page text is the client's: it stays in memory only, like the verdict it reads.\n */\n\nimport {\n conservationKey,\n wordKeysOf,\n type LostPassage,\n type PageEdit,\n type PageWordAt,\n type PublishedPage,\n} from \"doc-ir\";\n\n/** Why a lost passage was not put back: a closed list. */\nexport type LostTextAbstention =\n | \"no-anchor\"\n | \"anchor-unmatched\"\n | \"anchors-out-of-order\"\n | \"anchor-in-container\"\n | \"loss-inside-block\"\n | \"blocks-not-adjacent\";\n\n/** One passage placed: the edit the caller applies, and the letters it puts back, for the caller's accounting. */\nexport interface LostTextInsertion {\n edit: PageEdit;\n letters: number;\n}\n\n/** Whether `later` sits strictly after `earlier` in the page's reading order (block, then word). */\nconst isAfterInPageOrder = (later: PageWordAt, earlier: PageWordAt): boolean =>\n later.block > earlier.block || (later.block === earlier.block && later.word > earlier.word);\n\n/** Where each lost passage goes, as an edit for the caller to apply, or why it goes nowhere.\n *\n * It reasons on the page's units (`PublishedPage.units`), never on markup. The reason of each abstention travels to the\n * caller, so that a reader of the result knows why nothing was repaired.\n *\n * `units` absent (the caller cannot say what a unit is): every passage abstains with `anchor-in-container`, the same\n * answer as for a page whose anchors sit where a paragraph may not go.\n */\nexport function placeLostPassages(\n page: PublishedPage,\n passages: readonly LostPassage[],\n): { insertions: LostTextInsertion[]; abstentions: LostTextAbstention[] } {\n const insertions: LostTextInsertion[] = [];\n const abstentions: LostTextAbstention[] = [];\n if (passages.length === 0) return { insertions, abstentions };\n const units = page.units;\n const wordCountByBlock = page.blocks.map((text) => wordKeysOf(text).length);\n const lastBlock = wordCountByBlock.length - 1;\n const findUnitOfBlock = (block: number): number => units?.findIndex((unit) => unit.blocks.includes(block)) ?? -1;\n\n /** The anchor's unit, or why it cannot anchor. */\n const findAnchorUnit = (anchor: PageWordAt, side: \"before\" | \"after\"): number | LostTextAbstention => {\n const unitIndex = findUnitOfBlock(anchor.block);\n if (unitIndex < 0 || units?.[unitIndex]?.paragraphOrHeading !== true) return \"anchor-in-container\";\n // The loss must sit at the unit's edge: the anchor before is the unit's last word, the anchor after its first.\n const neighbourBlock = side === \"before\" ? anchor.block + 1 : anchor.block - 1;\n const isAtEdge = side === \"before\" ? anchor.word === (wordCountByBlock[anchor.block] ?? 0) - 1 : anchor.word === 0;\n if (!isAtEdge || findUnitOfBlock(neighbourBlock) === unitIndex) return \"loss-inside-block\";\n return unitIndex;\n };\n\n /** The unit the passage goes after (`-1`: before the first unit), or why it goes nowhere. */\n const placePassage = (passage: LostPassage): number | LostTextAbstention => {\n const { before, after } = passage;\n if (before === \"unanchored\" || after === \"unanchored\") return \"anchor-unmatched\";\n if (before === \"document-edge\" && after === \"document-edge\") return \"no-anchor\";\n if (before !== \"document-edge\" && after !== \"document-edge\" && !isAfterInPageOrder(after, before))\n return \"anchors-out-of-order\";\n const unitBefore = before === \"document-edge\" ? undefined : findAnchorUnit(before, \"before\");\n if (typeof unitBefore === \"string\") return unitBefore;\n const unitAfter = after === \"document-edge\" ? undefined : findAnchorUnit(after, \"after\");\n if (typeof unitAfter === \"string\") return unitAfter;\n // At the start of the document, the passage goes before the unit that opens the page's first block.\n if (unitBefore === undefined) {\n if (unitAfter === undefined || after === \"document-edge\" || after.block !== 0) return \"no-anchor\";\n return unitAfter - 1;\n }\n // At the end of the document, the passage goes after the unit that closes the page's last block.\n if (unitAfter === undefined) {\n if (before === \"document-edge\" || before.block !== lastBlock) return \"no-anchor\";\n return unitBefore;\n }\n if (unitAfter !== unitBefore + 1 || units?.[unitBefore]?.adjacentToNext !== true) return \"blocks-not-adjacent\";\n return unitBefore;\n };\n\n for (const passage of passages) {\n const placement = placePassage(passage);\n if (typeof placement === \"string\") {\n abstentions.push(placement);\n continue;\n }\n insertions.push({\n edit: { kind: \"insert-unit-after\", unit: placement, text: passage.sourceWords.join(\" \") },\n letters: passage.sourceWords.reduce((letterTotal, word) => letterTotal + conservationKey(word).length, 0),\n });\n }\n return { insertions, abstentions };\n}\n"],
|
|
5
|
+
"mappings": ";AAEO,SAAS,gBAAmB,OAAqB,MAAqB;AAC3E,QAAM,SAAgB,CAAC;AACvB,WAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,KAAM,QAAO,KAAK,MAAM,MAAM,OAAO,QAAQ,IAAI,CAAC;AACrG,SAAO;AACT;;;ACHO,IAAM,gCAAgC;;;ACe7C,SAAS,uBAAoG;AAY7G,IAAM,aAAa;AAEnB,IAAM,kBAAkB,CAAC,SACvB,CAAC,GAAG,KAAK,SAAS,UAAU,CAAC,EAAE,IAAI,CAAC,WAAW;AAAA,EAC7C,MAAM,MAAM,CAAC;AAAA,EACb,KAAK,gBAAgB,MAAM,CAAC,CAAC;AAAA,EAC7B,KAAK,MAAM,QAAQ,MAAM,CAAC,EAAE;AAC9B,EAAE;AAIJ,IAAM,aAAa,CAAC,eAAoD;AACtE,QAAM,QAAuB,CAAC;AAC9B,MAAI,UAAuB,CAAC;AAC5B,QAAM,YAAY,MAAY;AAC5B,QAAI,gBAAgB,QAAQ,IAAI,CAAC,cAAc,UAAU,IAAI,EAAE,KAAK,EAAE,CA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