Add barcode-detector-api-polyfill dependency and update environment variable declarations in SvelteKit project
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
import { Stream } from "../../common/Stream";
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {Decoder}
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
export declare class ShiftJISDecoder {
|
||||
readonly fatal: boolean;
|
||||
Shift_JIS_lead: number;
|
||||
constructor(options: {
|
||||
fatal: boolean;
|
||||
});
|
||||
/**
|
||||
* @param {Stream} stream The stream of bytes being decoded.
|
||||
* @param {number} bite The next byte read from the stream.
|
||||
* @return {?(number|!Array.<number>)} The next code point(s)
|
||||
* decoded, or null if not enough data exists in the input
|
||||
* stream to decode a complete code point.
|
||||
*/
|
||||
handler(stream: Stream, bite: number): (number | Array<number>) | null;
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var encodings_1 = require("../../encoding/encodings");
|
||||
var finished_1 = require("../../encoding/finished");
|
||||
var indexes_1 = require("../../encoding/indexes");
|
||||
var terminology_1 = require("../../encoding/terminology");
|
||||
var utilities_1 = require("../../encoding/utilities");
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {Decoder}
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
var ShiftJISDecoder = /** @class */ (function () {
|
||||
function ShiftJISDecoder(options) {
|
||||
this.fatal = options.fatal;
|
||||
// Shift_JIS's decoder has an associated Shift_JIS lead (initially
|
||||
// 0x00).
|
||||
/** @type {number} */ this.Shift_JIS_lead = 0x00;
|
||||
}
|
||||
/**
|
||||
* @param {Stream} stream The stream of bytes being decoded.
|
||||
* @param {number} bite The next byte read from the stream.
|
||||
* @return {?(number|!Array.<number>)} The next code point(s)
|
||||
* decoded, or null if not enough data exists in the input
|
||||
* stream to decode a complete code point.
|
||||
*/
|
||||
ShiftJISDecoder.prototype.handler = function (stream, bite) {
|
||||
// 1. If byte is end-of-stream and Shift_JIS lead is not 0x00,
|
||||
// set Shift_JIS lead to 0x00 and return error.
|
||||
if (bite === terminology_1.end_of_stream && this.Shift_JIS_lead !== 0x00) {
|
||||
this.Shift_JIS_lead = 0x00;
|
||||
return encodings_1.decoderError(this.fatal);
|
||||
}
|
||||
// 2. If byte is end-of-stream and Shift_JIS lead is 0x00,
|
||||
// return finished.
|
||||
if (bite === terminology_1.end_of_stream && this.Shift_JIS_lead === 0x00)
|
||||
return finished_1.finished;
|
||||
// 3. If Shift_JIS lead is not 0x00, let lead be Shift_JIS lead,
|
||||
// let pointer be null, set Shift_JIS lead to 0x00, and then run
|
||||
// these substeps:
|
||||
if (this.Shift_JIS_lead !== 0x00) {
|
||||
var lead = this.Shift_JIS_lead;
|
||||
var pointer = null;
|
||||
this.Shift_JIS_lead = 0x00;
|
||||
// 1. Let offset be 0x40, if byte is less than 0x7F, and 0x41
|
||||
// otherwise.
|
||||
var offset = (bite < 0x7F) ? 0x40 : 0x41;
|
||||
// 2. Let lead offset be 0x81, if lead is less than 0xA0, and
|
||||
// 0xC1 otherwise.
|
||||
var lead_offset = (lead < 0xA0) ? 0x81 : 0xC1;
|
||||
// 3. If byte is in the range 0x40 to 0x7E, inclusive, or 0x80
|
||||
// to 0xFC, inclusive, set pointer to (lead − lead offset) ×
|
||||
// 188 + byte − offset.
|
||||
if (utilities_1.inRange(bite, 0x40, 0x7E) || utilities_1.inRange(bite, 0x80, 0xFC))
|
||||
pointer = (lead - lead_offset) * 188 + bite - offset;
|
||||
// 4. If pointer is in the range 8836 to 10715, inclusive,
|
||||
// return a code point whose value is 0xE000 − 8836 + pointer.
|
||||
if (utilities_1.inRange(pointer, 8836, 10715))
|
||||
return 0xE000 - 8836 + pointer;
|
||||
// 5. Let code point be null, if pointer is null, and the
|
||||
// index code point for pointer in index jis0208 otherwise.
|
||||
var code_point = (pointer === null) ? null :
|
||||
indexes_1.indexCodePointFor(pointer, indexes_1.index('jis0208'));
|
||||
// 6. If code point is null and byte is an ASCII byte, prepend
|
||||
// byte to stream.
|
||||
if (code_point === null && terminology_1.isASCIIByte(bite))
|
||||
stream.prepend(bite);
|
||||
// 7. If code point is null, return error.
|
||||
if (code_point === null)
|
||||
return encodings_1.decoderError(this.fatal);
|
||||
// 8. Return a code point whose value is code point.
|
||||
return code_point;
|
||||
}
|
||||
// 4. If byte is an ASCII byte or 0x80, return a code point
|
||||
// whose value is byte.
|
||||
if (terminology_1.isASCIIByte(bite) || bite === 0x80)
|
||||
return bite;
|
||||
// 5. If byte is in the range 0xA1 to 0xDF, inclusive, return a
|
||||
// code point whose value is 0xFF61 − 0xA1 + byte.
|
||||
if (utilities_1.inRange(bite, 0xA1, 0xDF))
|
||||
return 0xFF61 - 0xA1 + bite;
|
||||
// 6. If byte is in the range 0x81 to 0x9F, inclusive, or 0xE0
|
||||
// to 0xFC, inclusive, set Shift_JIS lead to byte and return
|
||||
// continue.
|
||||
if (utilities_1.inRange(bite, 0x81, 0x9F) || utilities_1.inRange(bite, 0xE0, 0xFC)) {
|
||||
this.Shift_JIS_lead = bite;
|
||||
return null;
|
||||
}
|
||||
// 7. Return error.
|
||||
return encodings_1.decoderError(this.fatal);
|
||||
};
|
||||
return ShiftJISDecoder;
|
||||
}());
|
||||
exports.ShiftJISDecoder = ShiftJISDecoder;
|
||||
//# sourceMappingURL=ShiftJISDecoder.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ShiftJISDecoder.js","sourceRoot":"","sources":["../../../../src/coders/shift-jis/ShiftJISDecoder.ts"],"names":[],"mappings":";;AACA,sDAAwD;AACxD,oDAAmD;AACnD,kDAAkE;AAClE,0DAAwE;AACxE,sDAAmD;AAEnD;;;;GAIG;AACH;IAME,yBAAY,OAA4B;QACtC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,kEAAkE;QAClE,SAAS;QACT,qBAAqB,CAAC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IACnD,CAAC;IAED;;;;;;OA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or
|
||||
* @implements {Encoder}
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
export declare class ShiftJISEncoder {
|
||||
readonly fatal: boolean;
|
||||
constructor(options: {
|
||||
fatal: boolean;
|
||||
});
|
||||
/**
|
||||
* @param {Stream} stream Input stream.
|
||||
* @param {number} code_point Next code point read from the stream.
|
||||
* @return {(number|!Array.<number>)} Byte(s) to emit.
|
||||
*/
|
||||
handler(stream: Stream, code_point: number): (number | Array<number>);
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var encodings_1 = require("../../encoding/encodings");
|
||||
var finished_1 = require("../../encoding/finished");
|
||||
var indexes_1 = require("../../encoding/indexes");
|
||||
var terminology_1 = require("../../encoding/terminology");
|
||||
var utilities_1 = require("../../encoding/utilities");
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {Encoder}
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
var ShiftJISEncoder = /** @class */ (function () {
|
||||
function ShiftJISEncoder(options) {
|
||||
this.fatal = options.fatal;
|
||||
}
|
||||
/**
|
||||
* @param {Stream} stream Input stream.
|
||||
* @param {number} code_point Next code point read from the stream.
|
||||
* @return {(number|!Array.<number>)} Byte(s) to emit.
|
||||
*/
|
||||
ShiftJISEncoder.prototype.handler = function (stream, code_point) {
|
||||
// 1. If code point is end-of-stream, return finished.
|
||||
if (code_point === terminology_1.end_of_stream)
|
||||
return finished_1.finished;
|
||||
// 2. If code point is an ASCII code point or U+0080, return a
|
||||
// byte whose value is code point.
|
||||
if (terminology_1.isASCIICodePoint(code_point) || code_point === 0x0080)
|
||||
return code_point;
|
||||
// 3. If code point is U+00A5, return byte 0x5C.
|
||||
if (code_point === 0x00A5)
|
||||
return 0x5C;
|
||||
// 4. If code point is U+203E, return byte 0x7E.
|
||||
if (code_point === 0x203E)
|
||||
return 0x7E;
|
||||
// 5. If code point is in the range U+FF61 to U+FF9F, inclusive,
|
||||
// return a byte whose value is code point − 0xFF61 + 0xA1.
|
||||
if (utilities_1.inRange(code_point, 0xFF61, 0xFF9F))
|
||||
return code_point - 0xFF61 + 0xA1;
|
||||
// 6. If code point is U+2212, set it to U+FF0D.
|
||||
if (code_point === 0x2212)
|
||||
code_point = 0xFF0D;
|
||||
// 7. Let pointer be the index Shift_JIS pointer for code point.
|
||||
var pointer = indexes_1.indexShiftJISPointerFor(code_point);
|
||||
// 8. If pointer is null, return error with code point.
|
||||
if (pointer === null)
|
||||
return encodings_1.encoderError(code_point);
|
||||
// 9. Let lead be Math.floor(pointer / 188).
|
||||
var lead = Math.floor(pointer / 188);
|
||||
// 10. Let lead offset be 0x81, if lead is less than 0x1F, and
|
||||
// 0xC1 otherwise.
|
||||
var lead_offset = (lead < 0x1F) ? 0x81 : 0xC1;
|
||||
// 11. Let trail be pointer % 188.
|
||||
var trail = pointer % 188;
|
||||
// 12. Let offset be 0x40, if trail is less than 0x3F, and 0x41
|
||||
// otherwise.
|
||||
var offset = (trail < 0x3F) ? 0x40 : 0x41;
|
||||
// 13. Return two bytes whose values are lead + lead offset and
|
||||
// trail + offset.
|
||||
return [lead + lead_offset, trail + offset];
|
||||
};
|
||||
return ShiftJISEncoder;
|
||||
}());
|
||||
exports.ShiftJISEncoder = ShiftJISEncoder;
|
||||
//# sourceMappingURL=ShiftJISEncoder.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ShiftJISEncoder.js","sourceRoot":"","sources":["../../../../src/coders/shift-jis/ShiftJISEncoder.ts"],"names":[],"mappings":";;AACA,sDAAwD;AACxD,oDAAmD;AACnD,kDAAiE;AACjE,0DAA6E;AAC7E,sDAAmD;AAEnD;;;;GAIG;AACH;IAIE,yBAAY,OAA4B;QACtC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,iCAAO,GAAP,UAAQ,MAAc,EAAE,UAAkB;QACxC,sDAAsD;Q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,CAAC;IACH,sBAAC;AAAD,CAAC,AAjED,IAiEC;AAjEY,0CAAe"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export * from './ShiftJISDecoder';
|
||||
export * from './ShiftJISEncoder';
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./ShiftJISDecoder"));
|
||||
__export(require("./ShiftJISEncoder"));
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/coders/shift-jis/index.ts"],"names":[],"mappings":";;;;;AAAA,uCAAkC;AAClC,uCAAkC"}
|
||||
Reference in New Issue
Block a user