Add barcode-detector-api-polyfill dependency and update environment variable declarations in SvelteKit project
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
import { Stream } from "../../common/Stream";
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {Decoder}
|
||||
* @param {boolean} utf16_be True if big-endian, false if little-endian.
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
export declare class UTF16Decoder {
|
||||
private utf16_be;
|
||||
readonly fatal: boolean;
|
||||
utf16_lead_byte: any;
|
||||
utf16_lead_surrogate: any;
|
||||
constructor(utf16_be: boolean, 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 { end_of_stream } from "../../encoding/terminology";
|
||||
import { inRange } from "../../encoding/utilities";
|
||||
import { convertCodeUnitToBytes } from "./converCodeUnitToBytes";
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {Decoder}
|
||||
* @param {boolean} utf16_be True if big-endian, false if little-endian.
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
var UTF16Decoder = /** @class */ (function () {
|
||||
function UTF16Decoder(utf16_be, options) {
|
||||
this.utf16_be = utf16_be;
|
||||
this.fatal = options.fatal;
|
||||
/** @type {?number} */ this.utf16_lead_byte = null;
|
||||
/** @type {?number} */ this.utf16_lead_surrogate = null;
|
||||
}
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
UTF16Decoder.prototype.handler = function (stream, bite) {
|
||||
// 1. If byte is end-of-stream and either utf-16 lead byte or
|
||||
// utf-16 lead surrogate is not null, set utf-16 lead byte and
|
||||
// utf-16 lead surrogate to null, and return error.
|
||||
if (bite === end_of_stream && (this.utf16_lead_byte !== null ||
|
||||
this.utf16_lead_surrogate !== null)) {
|
||||
return decoderError(this.fatal);
|
||||
}
|
||||
// 2. If byte is end-of-stream and utf-16 lead byte and utf-16
|
||||
// lead surrogate are null, return finished.
|
||||
if (bite === end_of_stream && this.utf16_lead_byte === null &&
|
||||
this.utf16_lead_surrogate === null) {
|
||||
return finished;
|
||||
}
|
||||
// 3. If utf-16 lead byte is null, set utf-16 lead byte to byte
|
||||
// and return continue.
|
||||
if (this.utf16_lead_byte === null) {
|
||||
this.utf16_lead_byte = bite;
|
||||
return null;
|
||||
}
|
||||
// 4. Let code unit be the result of:
|
||||
var code_unit;
|
||||
if (this.utf16_be) {
|
||||
// utf-16be decoder flag is set
|
||||
// (utf-16 lead byte << 8) + byte.
|
||||
code_unit = (this.utf16_lead_byte << 8) + bite;
|
||||
}
|
||||
else {
|
||||
// utf-16be decoder flag is unset
|
||||
// (byte << 8) + utf-16 lead byte.
|
||||
code_unit = (bite << 8) + this.utf16_lead_byte;
|
||||
}
|
||||
// Then set utf-16 lead byte to null.
|
||||
this.utf16_lead_byte = null;
|
||||
// 5. If utf-16 lead surrogate is not null, let lead surrogate
|
||||
// be utf-16 lead surrogate, set utf-16 lead surrogate to null,
|
||||
// and then run these substeps:
|
||||
if (this.utf16_lead_surrogate !== null) {
|
||||
var lead_surrogate = this.utf16_lead_surrogate;
|
||||
this.utf16_lead_surrogate = null;
|
||||
// 1. If code unit is in the range U+DC00 to U+DFFF,
|
||||
// inclusive, return a code point whose value is 0x10000 +
|
||||
// ((lead surrogate − 0xD800) << 10) + (code unit − 0xDC00).
|
||||
if (inRange(code_unit, 0xDC00, 0xDFFF)) {
|
||||
return 0x10000 + (lead_surrogate - 0xD800) * 0x400 +
|
||||
(code_unit - 0xDC00);
|
||||
}
|
||||
// 2. Prepend the sequence resulting of converting code unit
|
||||
// to bytes using utf-16be decoder flag to stream and return
|
||||
// error.
|
||||
stream.prepend(convertCodeUnitToBytes(code_unit, this.utf16_be));
|
||||
return decoderError(this.fatal);
|
||||
}
|
||||
// 6. If code unit is in the range U+D800 to U+DBFF, inclusive,
|
||||
// set utf-16 lead surrogate to code unit and return continue.
|
||||
if (inRange(code_unit, 0xD800, 0xDBFF)) {
|
||||
this.utf16_lead_surrogate = code_unit;
|
||||
return null;
|
||||
}
|
||||
// 7. If code unit is in the range U+DC00 to U+DFFF, inclusive,
|
||||
// return error.
|
||||
if (inRange(code_unit, 0xDC00, 0xDFFF))
|
||||
return decoderError(this.fatal);
|
||||
// 8. Return code point code unit.
|
||||
return code_unit;
|
||||
};
|
||||
return UTF16Decoder;
|
||||
}());
|
||||
export { UTF16Decoder };
|
||||
//# sourceMappingURL=UTF16Decoder.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"UTF16Decoder.js","sourceRoot":"","sources":["../../../../src/coders/utf-16/UTF16Decoder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAGjE;;;;;GAKG;AACH;IAOE,sBAAoB,QAAiB,EAAE,OAA4B;QAA/C,aAAQ,GAAR,QAAQ,CAAS;QACnC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QACzB,sBAAsB,CAAC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QACnD,sBAAsB,CAAC,I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D;YACpD,0DAA0D;YAC1D,4DAA4D;YAC5D,IAAI,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;gBACtC,OAAO,OAAO,GAAG,CAAC,cAAc,GAAG,MAAM,CAAC,GAAG,KAAK;oBAChD,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC;aACxB;YAED,4DAA4D;YAC5D,4DAA4D;YAC5D,SAAS;YACT,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YACjE,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACjC;QAED,+DAA+D;QAC/D,8DAA8D;QAC9D,IAAI,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;YACtC,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC;YACtC,OAAO,IAAI,CAAC;SACb;QAED,+DAA+D;QAC/D,gBAAgB;QAChB,IAAI,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC;YACpC,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAElC,kCAAkC;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IACH,mBAAC;AAAD,CAAC,AA9FD,IA8FC"}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import { Stream } from "../../common";
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {Encoder}
|
||||
* @param {boolean} utf16_be True if big-endian, false if little-endian.
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
export declare class UTF16Encoder {
|
||||
private utf16_be;
|
||||
readonly fatal: boolean;
|
||||
constructor(utf16_be: boolean, 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>);
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
import { finished } from "../../encoding/finished";
|
||||
import { end_of_stream } from "../../encoding/terminology";
|
||||
import { inRange } from "../../encoding/utilities";
|
||||
import { convertCodeUnitToBytes } from "./converCodeUnitToBytes";
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {Encoder}
|
||||
* @param {boolean} utf16_be True if big-endian, false if little-endian.
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
var UTF16Encoder = /** @class */ (function () {
|
||||
function UTF16Encoder(utf16_be, options) {
|
||||
this.utf16_be = utf16_be;
|
||||
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.
|
||||
*/
|
||||
UTF16Encoder.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 in the range U+0000 to U+FFFF, inclusive,
|
||||
// return the sequence resulting of converting code point to
|
||||
// bytes using utf-16be encoder flag.
|
||||
if (inRange(code_point, 0x0000, 0xFFFF))
|
||||
return convertCodeUnitToBytes(code_point, this.utf16_be);
|
||||
// 3. Let lead be ((code point − 0x10000) >> 10) + 0xD800,
|
||||
// converted to bytes using utf-16be encoder flag.
|
||||
var lead = convertCodeUnitToBytes(((code_point - 0x10000) >> 10) + 0xD800, this.utf16_be);
|
||||
// 4. Let trail be ((code point − 0x10000) & 0x3FF) + 0xDC00,
|
||||
// converted to bytes using utf-16be encoder flag.
|
||||
var trail = convertCodeUnitToBytes(((code_point - 0x10000) & 0x3FF) + 0xDC00, this.utf16_be);
|
||||
// 5. Return a byte sequence of lead followed by trail.
|
||||
return lead.concat(trail);
|
||||
};
|
||||
return UTF16Encoder;
|
||||
}());
|
||||
export { UTF16Encoder };
|
||||
//# sourceMappingURL=UTF16Encoder.js.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AAAD,CAAC,AArCD,IAqCC"}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* @param {number} code_unit
|
||||
* @param {boolean} utf16be
|
||||
* @return {!Array.<number>} bytes
|
||||
*/
|
||||
export declare function convertCodeUnitToBytes(code_unit: number, utf16be: boolean): Array<number>;
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @param {number} code_unit
|
||||
* @param {boolean} utf16be
|
||||
* @return {!Array.<number>} bytes
|
||||
*/
|
||||
export function convertCodeUnitToBytes(code_unit, utf16be) {
|
||||
// 1. Let byte1 be code unit >> 8.
|
||||
var byte1 = code_unit >> 8;
|
||||
// 2. Let byte2 be code unit & 0x00FF.
|
||||
var byte2 = code_unit & 0x00FF;
|
||||
// 3. Then return the bytes in order:
|
||||
// utf-16be flag is set: byte1, then byte2.
|
||||
if (utf16be)
|
||||
return [byte1, byte2];
|
||||
// utf-16be flag is unset: byte2, then byte1.
|
||||
return [byte2, byte1];
|
||||
}
|
||||
//# sourceMappingURL=converCodeUnitToBytes.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"converCodeUnitToBytes.js","sourceRoot":"","sources":["../../../../src/coders/utf-16/converCodeUnitToBytes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAiB,EAAE,OAAgB;IACxE,kCAAkC;IAClC,IAAM,KAAK,GAAG,SAAS,IAAI,CAAC,CAAC;IAE7B,sCAAsC;IACtC,IAAM,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;IAEjC,qCAAqC;IACrC,2CAA2C;IAC3C,IAAI,OAAO;QACT,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxB,6CAA6C;IAC7C,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACxB,CAAC"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export * from './UTF16Decoder';
|
||||
export * from './UTF16Encoder';
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
export * from './UTF16Decoder';
|
||||
export * from './UTF16Encoder';
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/coders/utf-16/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
||||
Reference in New Issue
Block a user