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 Big5Decoder {
|
||||
readonly fatal: boolean;
|
||||
Big5_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 @@
|
||||
import { decoderError } from "../../encoding/encodings";
|
||||
import { finished } from "../../encoding/finished";
|
||||
import { index, indexCodePointFor } from "../../encoding/indexes";
|
||||
import { end_of_stream, isASCIIByte } from "../../encoding/terminology";
|
||||
import { inRange } from "../../encoding/utilities";
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {Decoder}
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
var Big5Decoder = /** @class */ (function () {
|
||||
function Big5Decoder(options) {
|
||||
this.fatal = options.fatal;
|
||||
// Big5's decoder has an associated Big5 lead (initially 0x00).
|
||||
/** @type {number} */ this.Big5_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.
|
||||
*/
|
||||
Big5Decoder.prototype.handler = function (stream, bite) {
|
||||
// 1. If byte is end-of-stream and Big5 lead is not 0x00, set
|
||||
// Big5 lead to 0x00 and return error.
|
||||
if (bite === end_of_stream && this.Big5_lead !== 0x00) {
|
||||
this.Big5_lead = 0x00;
|
||||
return decoderError(this.fatal);
|
||||
}
|
||||
// 2. If byte is end-of-stream and Big5 lead is 0x00, return
|
||||
// finished.
|
||||
if (bite === end_of_stream && this.Big5_lead === 0x00)
|
||||
return finished;
|
||||
// 3. If Big5 lead is not 0x00, let lead be Big5 lead, let
|
||||
// pointer be null, set Big5 lead to 0x00, and then run these
|
||||
// substeps:
|
||||
if (this.Big5_lead !== 0x00) {
|
||||
var lead = this.Big5_lead;
|
||||
var pointer = null;
|
||||
this.Big5_lead = 0x00;
|
||||
// 1. Let offset be 0x40 if byte is less than 0x7F and 0x62
|
||||
// otherwise.
|
||||
var offset = bite < 0x7F ? 0x40 : 0x62;
|
||||
// 2. If byte is in the range 0x40 to 0x7E, inclusive, or 0xA1
|
||||
// to 0xFE, inclusive, set pointer to (lead − 0x81) × 157 +
|
||||
// (byte − offset).
|
||||
if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0xA1, 0xFE))
|
||||
pointer = (lead - 0x81) * 157 + (bite - offset);
|
||||
// 3. If there is a row in the table below whose first column
|
||||
// is pointer, return the two code points listed in its second
|
||||
// column
|
||||
// Pointer | Code points
|
||||
// --------+--------------
|
||||
// 1133 | U+00CA U+0304
|
||||
// 1135 | U+00CA U+030C
|
||||
// 1164 | U+00EA U+0304
|
||||
// 1166 | U+00EA U+030C
|
||||
switch (pointer) {
|
||||
case 1133: return [0x00CA, 0x0304];
|
||||
case 1135: return [0x00CA, 0x030C];
|
||||
case 1164: return [0x00EA, 0x0304];
|
||||
case 1166: return [0x00EA, 0x030C];
|
||||
}
|
||||
// 4. Let code point be null if pointer is null and the index
|
||||
// code point for pointer in index Big5 otherwise.
|
||||
var code_point = (pointer === null) ? null :
|
||||
indexCodePointFor(pointer, index('big5'));
|
||||
// 5. If code point is null and byte is an ASCII byte, prepend
|
||||
// byte to stream.
|
||||
if (code_point === null && isASCIIByte(bite))
|
||||
stream.prepend(bite);
|
||||
// 6. If code point is null, return error.
|
||||
if (code_point === null)
|
||||
return decoderError(this.fatal);
|
||||
// 7. Return a code point whose value is code point.
|
||||
return code_point;
|
||||
}
|
||||
// 4. If byte is an ASCII byte, return a code point whose value
|
||||
// is byte.
|
||||
if (isASCIIByte(bite))
|
||||
return bite;
|
||||
// 5. If byte is in the range 0x81 to 0xFE, inclusive, set Big5
|
||||
// lead to byte and return continue.
|
||||
if (inRange(bite, 0x81, 0xFE)) {
|
||||
this.Big5_lead = bite;
|
||||
return null;
|
||||
}
|
||||
// 6. Return error.
|
||||
return decoderError(this.fatal);
|
||||
};
|
||||
return Big5Decoder;
|
||||
}());
|
||||
export { Big5Decoder };
|
||||
//# sourceMappingURL=Big5Decoder.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Big5Decoder.js","sourceRoot":"","sources":["../../../../src/coders/big5/Big5Decoder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD;;;;IAII;AACJ;IAME,qBAAY,OAA4B;QACtC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,+DAA+D;QAC/D,qBAAqB,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC9C,CAAC;IAED;;;;;;OAMG;IACH,6BAAO,GAAP,UAAQ,MAAc,EAAE,IAAY;QAClC,6DAA6D;QAC7D,sCAAsC;QACtC,IAAI,IAAI,KAAK,aAAa,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE;YACrD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,OAAO,YAAY,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,6DAA6D;YAC7D,kDAAkD;YAClD,IAAM,UAAU,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAC5C,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAa,CAAC,CAAC;YAExD,8DAA8D;YAC9D,kBAAkB;YAClB,IAAI,UAAU,KAAK,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC;gBAC1C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAEvB,0CAA0C;YAC1C,IAAI,UAAU,KAAK,IAAI;gBACrB,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAElC,oDAAoD;YACpD,OAAO,UAAU,CAAC;SACnB;QAED,+DAA+D;QAC/D,WAAW;QACX,IAAI,WAAW,CAAC,IAAI,CAAC;YACnB,OAAO,IAAI,CAAC;QAEd,+DAA+D;QAC/D,oCAAoC;QACpC,IAAI,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;YAC7B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,OAAO,IAAI,CAAC;SACb;QAED,mBAAmB;QACnB,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IACH,kBAAC;AAAD,CAAC,AAnGD,IAmGC"}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import { Stream } from "../../common/Stream";
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {Encoder}
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
export declare class Big5Encoder {
|
||||
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>);
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
import { encoderError } from "../../encoding/encodings";
|
||||
import { finished } from "../../encoding/finished";
|
||||
import { indexBig5PointerFor } from "../../encoding/indexes";
|
||||
import { end_of_stream, isASCIICodePoint } from "../../encoding/terminology";
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {Encoder}
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
var Big5Encoder = /** @class */ (function () {
|
||||
function Big5Encoder(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.
|
||||
*/
|
||||
Big5Encoder.prototype.handler = function (stream, code_point) {
|
||||
// 1. If code point is end-of-stream, return finished.
|
||||
if (code_point === end_of_stream)
|
||||
return finished;
|
||||
// 2. If code point is an ASCII code point, return a byte whose
|
||||
// value is code point.
|
||||
if (isASCIICodePoint(code_point))
|
||||
return code_point;
|
||||
// 3. Let pointer be the index Big5 pointer for code point.
|
||||
var pointer = indexBig5PointerFor(code_point);
|
||||
// 4. If pointer is null, return error with code point.
|
||||
if (pointer === null)
|
||||
return encoderError(code_point);
|
||||
// 5. Let lead be Math.floor(pointer / 157) + 0x81.
|
||||
var lead = Math.floor(pointer / 157) + 0x81;
|
||||
// 6. If lead is less than 0xA1, return error with code point.
|
||||
if (lead < 0xA1)
|
||||
return encoderError(code_point);
|
||||
// 7. Let trail be pointer % 157.
|
||||
var trail = pointer % 157;
|
||||
// 8. Let offset be 0x40 if trail is less than 0x3F and 0x62
|
||||
// otherwise.
|
||||
var offset = trail < 0x3F ? 0x40 : 0x62;
|
||||
// Return two bytes whose values are lead and trail + offset.
|
||||
return [lead, trail + offset];
|
||||
};
|
||||
return Big5Encoder;
|
||||
}());
|
||||
export { Big5Encoder };
|
||||
//# sourceMappingURL=Big5Encoder.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Big5Enc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C;IAChC,CAAC;IACH,kBAAC;AAAD,CAAC,AA/CD,IA+CC"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export * from './Big5Decoder';
|
||||
export * from './Big5Encoder';
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
export * from './Big5Decoder';
|
||||
export * from './Big5Encoder';
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/coders/big5/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
||||
Reference in New Issue
Block a user