Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 4x 4x 4x 4x 4x 4x 4x 4x 4x 10572x 10572x 725x 725x 725x 10572x 4x 2x 2x 2x 2x | import { assertArgument } from "../utils/index.js"; import { decodeBits } from "./bit-reader.js"; import { decodeOwl } from "./decode-owl.js"; /** * @_ignore */ export function decodeOwlA(data: string, accents: string): Array<string> { let words = decodeOwl(data).join(","); // Inject the accents accents.split(/,/g).forEach((accent) => { const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); assertArgument(match !== null, "internal error parsing accents", "accents", accents); let posOffset = 0; const positions = decodeBits(parseInt(match[3]), match[4]); const charCode = parseInt(match[2]); const regex = new RegExp(`([${ match[1] }])`, "g"); words = words.replace(regex, (all, letter) => { const rem = --positions[posOffset]; if (rem === 0) { letter = String.fromCharCode(letter.charCodeAt(0), charCode); posOffset++; } return letter; }); }); return words.split(","); } |