72966 lines
2.3 MiB
72966 lines
2.3 MiB
(function webpackUniversalModuleDefinition(root, factory) {
|
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
module.exports = factory();
|
|
else if(typeof define === 'function' && define.amd)
|
|
define([], factory);
|
|
else {
|
|
var a = factory();
|
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
}
|
|
})(this, function() {
|
|
return /******/ (function(modules) { // webpackBootstrap
|
|
/******/ // The module cache
|
|
/******/ var installedModules = {};
|
|
|
|
/******/ // The require function
|
|
/******/ function __webpack_require__(moduleId) {
|
|
|
|
/******/ // Check if module is in cache
|
|
/******/ if(installedModules[moduleId])
|
|
/******/ return installedModules[moduleId].exports;
|
|
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = installedModules[moduleId] = {
|
|
/******/ exports: {},
|
|
/******/ id: moduleId,
|
|
/******/ loaded: false
|
|
/******/ };
|
|
|
|
/******/ // Execute the module function
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
|
|
/******/ // Flag the module as loaded
|
|
/******/ module.loaded = true;
|
|
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
|
|
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
/******/ __webpack_require__.m = modules;
|
|
|
|
/******/ // expose the module cache
|
|
/******/ __webpack_require__.c = installedModules;
|
|
|
|
/******/ // __webpack_public_path__
|
|
/******/ __webpack_require__.p = "";
|
|
|
|
/******/ // Load entry module and return exports
|
|
/******/ return __webpack_require__(0);
|
|
/******/ })
|
|
/************************************************************************/
|
|
/******/ ([
|
|
/* 0 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(global) {module.exports = global["pdfMake"] = __webpack_require__(1);
|
|
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
|
|
|
/***/ },
|
|
/* 1 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {/* jslint node: true */
|
|
/* jslint browser: true */
|
|
/* global BlobBuilder */
|
|
'use strict';
|
|
|
|
var PdfPrinter = __webpack_require__(6);
|
|
var FileSaver = __webpack_require__(298);
|
|
var saveAs = FileSaver.saveAs;
|
|
|
|
var defaultClientFonts = {
|
|
Roboto: {
|
|
normal: 'Roboto-Regular.ttf',
|
|
bold: 'Roboto-Medium.ttf',
|
|
italics: 'Roboto-Italic.ttf',
|
|
bolditalics: 'Roboto-MediumItalic.ttf'
|
|
}
|
|
};
|
|
|
|
function Document(docDefinition, tableLayouts, fonts, vfs) {
|
|
this.docDefinition = docDefinition;
|
|
this.tableLayouts = tableLayouts || null;
|
|
this.fonts = fonts || defaultClientFonts;
|
|
this.vfs = vfs;
|
|
}
|
|
|
|
function canCreatePdf() {
|
|
// Ensure the browser provides the level of support needed
|
|
if (!Object.keys) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
Document.prototype._createDoc = function (options, callback) {
|
|
options = options || {};
|
|
if (this.tableLayouts) {
|
|
options.tableLayouts = this.tableLayouts;
|
|
}
|
|
|
|
var printer = new PdfPrinter(this.fonts);
|
|
printer.fs.bindFS(this.vfs);
|
|
|
|
var doc = printer.createPdfKitDocument(this.docDefinition, options);
|
|
var chunks = [];
|
|
var result;
|
|
|
|
doc.on('data', function (chunk) {
|
|
chunks.push(chunk);
|
|
});
|
|
doc.on('end', function () {
|
|
result = Buffer.concat(chunks);
|
|
callback(result, doc._pdfMakePages);
|
|
});
|
|
doc.end();
|
|
};
|
|
|
|
Document.prototype._getPages = function (options, cb) {
|
|
if (!cb) {
|
|
throw 'getBuffer is an async method and needs a callback argument';
|
|
}
|
|
this._createDoc(options, function (ignoreBuffer, pages) {
|
|
cb(pages);
|
|
});
|
|
};
|
|
|
|
Document.prototype.open = function (message) {
|
|
// we have to open the window immediately and store the reference
|
|
// otherwise popup blockers will stop us
|
|
var win = window.open('', '_blank');
|
|
|
|
try {
|
|
this.getBuffer(function (result) {
|
|
var blob;
|
|
try {
|
|
blob = new Blob([result], {type: 'application/pdf'});
|
|
} catch (e) {
|
|
// Old browser which can't handle it without making it an byte array (ie10)
|
|
if (e.name == 'InvalidStateError') {
|
|
var byteArray = new Uint8Array(result);
|
|
blob = new Blob([byteArray.buffer], {type: 'application/pdf'});
|
|
}
|
|
}
|
|
|
|
if (blob) {
|
|
var urlCreator = window.URL || window.webkitURL;
|
|
var pdfUrl = urlCreator.createObjectURL(blob);
|
|
win.location.href = pdfUrl;
|
|
} else {
|
|
throw 'Could not generate blob';
|
|
}
|
|
}, {autoPrint: false});
|
|
} catch (e) {
|
|
win.close();
|
|
throw e;
|
|
}
|
|
};
|
|
|
|
|
|
Document.prototype.print = function () {
|
|
// we have to open the window immediately and store the reference
|
|
// otherwise popup blockers will stop us
|
|
var win = window.open('', '_blank');
|
|
|
|
try {
|
|
this.getBuffer(function (result) {
|
|
var blob;
|
|
try {
|
|
blob = new Blob([result], {type: 'application/pdf'});
|
|
} catch (e) {
|
|
// Old browser which can't handle it without making it an byte array (ie10)
|
|
if (e.name == 'InvalidStateError') {
|
|
var byteArray = new Uint8Array(result);
|
|
blob = new Blob([byteArray.buffer], {type: 'application/pdf'});
|
|
}
|
|
}
|
|
|
|
if (blob) {
|
|
var urlCreator = window.URL || window.webkitURL;
|
|
var pdfUrl = urlCreator.createObjectURL(blob);
|
|
win.location.href = pdfUrl;
|
|
} else {
|
|
throw 'Could not generate blob';
|
|
}
|
|
}, {autoPrint: true});
|
|
} catch (e) {
|
|
win.close();
|
|
throw e;
|
|
}
|
|
};
|
|
|
|
Document.prototype.download = function (defaultFileName, cb) {
|
|
if (typeof defaultFileName === 'function') {
|
|
cb = defaultFileName;
|
|
defaultFileName = null;
|
|
}
|
|
|
|
defaultFileName = defaultFileName || 'file.pdf';
|
|
this.getBuffer(function (result) {
|
|
var blob;
|
|
try {
|
|
blob = new Blob([result], {type: 'application/pdf'});
|
|
} catch (e) {
|
|
// Old browser which can't handle it without making it an byte array (ie10)
|
|
if (e.name == 'InvalidStateError') {
|
|
var byteArray = new Uint8Array(result);
|
|
blob = new Blob([byteArray.buffer], {type: 'application/pdf'});
|
|
}
|
|
}
|
|
if (blob) {
|
|
saveAs(blob, defaultFileName);
|
|
} else {
|
|
throw 'Could not generate blob';
|
|
}
|
|
if (typeof cb === 'function') {
|
|
cb();
|
|
}
|
|
});
|
|
};
|
|
|
|
Document.prototype.getBase64 = function (cb, options) {
|
|
if (!cb) {
|
|
throw 'getBase64 is an async method and needs a callback argument';
|
|
}
|
|
this.getBuffer(function (buffer) {
|
|
cb(buffer.toString('base64'));
|
|
}, options);
|
|
};
|
|
|
|
Document.prototype.getDataUrl = function (cb, options) {
|
|
if (!cb) {
|
|
throw 'getDataUrl is an async method and needs a callback argument';
|
|
}
|
|
this.getBuffer(function (buffer) {
|
|
cb('data:application/pdf;base64,' + buffer.toString('base64'));
|
|
}, options);
|
|
};
|
|
|
|
Document.prototype.getBuffer = function (cb, options) {
|
|
if (!cb) {
|
|
throw 'getBuffer is an async method and needs a callback argument';
|
|
}
|
|
this._createDoc(options, function (buffer) {
|
|
cb(buffer);
|
|
});
|
|
};
|
|
|
|
module.exports = {
|
|
createPdf: function (docDefinition) {
|
|
if (!canCreatePdf()) {
|
|
throw 'Your browser does not provide the level of support needed';
|
|
}
|
|
return new Document(docDefinition, window.pdfMake.tableLayouts, window.pdfMake.fonts, window.pdfMake.vfs);
|
|
}
|
|
};
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 2 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(global) {/*!
|
|
* The buffer module from node.js, for the browser.
|
|
*
|
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
* @license MIT
|
|
*/
|
|
/* eslint-disable no-proto */
|
|
|
|
'use strict'
|
|
|
|
var base64 = __webpack_require__(3)
|
|
var ieee754 = __webpack_require__(4)
|
|
var isArray = __webpack_require__(5)
|
|
|
|
exports.Buffer = Buffer
|
|
exports.SlowBuffer = SlowBuffer
|
|
exports.INSPECT_MAX_BYTES = 50
|
|
|
|
/**
|
|
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
* === true Use Uint8Array implementation (fastest)
|
|
* === false Use Object implementation (most compatible, even IE6)
|
|
*
|
|
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
* Opera 11.6+, iOS 4.2+.
|
|
*
|
|
* Due to various browser bugs, sometimes the Object implementation will be used even
|
|
* when the browser supports typed arrays.
|
|
*
|
|
* Note:
|
|
*
|
|
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
|
|
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
|
|
*
|
|
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
|
|
*
|
|
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
|
|
* incorrect length in some situations.
|
|
|
|
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
|
|
* get the Object implementation, which is slower but behaves correctly.
|
|
*/
|
|
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
|
|
? global.TYPED_ARRAY_SUPPORT
|
|
: typedArraySupport()
|
|
|
|
/*
|
|
* Export kMaxLength after typed array support is determined.
|
|
*/
|
|
exports.kMaxLength = kMaxLength()
|
|
|
|
function typedArraySupport () {
|
|
try {
|
|
var arr = new Uint8Array(1)
|
|
arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
|
|
return arr.foo() === 42 && // typed array instances can be augmented
|
|
typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
|
|
arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
|
|
} catch (e) {
|
|
return false
|
|
}
|
|
}
|
|
|
|
function kMaxLength () {
|
|
return Buffer.TYPED_ARRAY_SUPPORT
|
|
? 0x7fffffff
|
|
: 0x3fffffff
|
|
}
|
|
|
|
function createBuffer (that, length) {
|
|
if (kMaxLength() < length) {
|
|
throw new RangeError('Invalid typed array length')
|
|
}
|
|
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
// Return an augmented `Uint8Array` instance, for best performance
|
|
that = new Uint8Array(length)
|
|
that.__proto__ = Buffer.prototype
|
|
} else {
|
|
// Fallback: Return an object instance of the Buffer class
|
|
if (that === null) {
|
|
that = new Buffer(length)
|
|
}
|
|
that.length = length
|
|
}
|
|
|
|
return that
|
|
}
|
|
|
|
/**
|
|
* The Buffer constructor returns instances of `Uint8Array` that have their
|
|
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
|
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
|
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
|
* returns a single octet.
|
|
*
|
|
* The `Uint8Array` prototype remains unmodified.
|
|
*/
|
|
|
|
function Buffer (arg, encodingOrOffset, length) {
|
|
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
|
|
return new Buffer(arg, encodingOrOffset, length)
|
|
}
|
|
|
|
// Common case.
|
|
if (typeof arg === 'number') {
|
|
if (typeof encodingOrOffset === 'string') {
|
|
throw new Error(
|
|
'If encoding is specified then the first argument must be a string'
|
|
)
|
|
}
|
|
return allocUnsafe(this, arg)
|
|
}
|
|
return from(this, arg, encodingOrOffset, length)
|
|
}
|
|
|
|
Buffer.poolSize = 8192 // not used by this implementation
|
|
|
|
// TODO: Legacy, not needed anymore. Remove in next major version.
|
|
Buffer._augment = function (arr) {
|
|
arr.__proto__ = Buffer.prototype
|
|
return arr
|
|
}
|
|
|
|
function from (that, value, encodingOrOffset, length) {
|
|
if (typeof value === 'number') {
|
|
throw new TypeError('"value" argument must not be a number')
|
|
}
|
|
|
|
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
|
return fromArrayBuffer(that, value, encodingOrOffset, length)
|
|
}
|
|
|
|
if (typeof value === 'string') {
|
|
return fromString(that, value, encodingOrOffset)
|
|
}
|
|
|
|
return fromObject(that, value)
|
|
}
|
|
|
|
/**
|
|
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
|
* if value is a number.
|
|
* Buffer.from(str[, encoding])
|
|
* Buffer.from(array)
|
|
* Buffer.from(buffer)
|
|
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
**/
|
|
Buffer.from = function (value, encodingOrOffset, length) {
|
|
return from(null, value, encodingOrOffset, length)
|
|
}
|
|
|
|
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
Buffer.prototype.__proto__ = Uint8Array.prototype
|
|
Buffer.__proto__ = Uint8Array
|
|
if (typeof Symbol !== 'undefined' && Symbol.species &&
|
|
Buffer[Symbol.species] === Buffer) {
|
|
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
|
|
Object.defineProperty(Buffer, Symbol.species, {
|
|
value: null,
|
|
configurable: true
|
|
})
|
|
}
|
|
}
|
|
|
|
function assertSize (size) {
|
|
if (typeof size !== 'number') {
|
|
throw new TypeError('"size" argument must be a number')
|
|
} else if (size < 0) {
|
|
throw new RangeError('"size" argument must not be negative')
|
|
}
|
|
}
|
|
|
|
function alloc (that, size, fill, encoding) {
|
|
assertSize(size)
|
|
if (size <= 0) {
|
|
return createBuffer(that, size)
|
|
}
|
|
if (fill !== undefined) {
|
|
// Only pay attention to encoding if it's a string. This
|
|
// prevents accidentally sending in a number that would
|
|
// be interpretted as a start offset.
|
|
return typeof encoding === 'string'
|
|
? createBuffer(that, size).fill(fill, encoding)
|
|
: createBuffer(that, size).fill(fill)
|
|
}
|
|
return createBuffer(that, size)
|
|
}
|
|
|
|
/**
|
|
* Creates a new filled Buffer instance.
|
|
* alloc(size[, fill[, encoding]])
|
|
**/
|
|
Buffer.alloc = function (size, fill, encoding) {
|
|
return alloc(null, size, fill, encoding)
|
|
}
|
|
|
|
function allocUnsafe (that, size) {
|
|
assertSize(size)
|
|
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
|
|
if (!Buffer.TYPED_ARRAY_SUPPORT) {
|
|
for (var i = 0; i < size; ++i) {
|
|
that[i] = 0
|
|
}
|
|
}
|
|
return that
|
|
}
|
|
|
|
/**
|
|
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
* */
|
|
Buffer.allocUnsafe = function (size) {
|
|
return allocUnsafe(null, size)
|
|
}
|
|
/**
|
|
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
*/
|
|
Buffer.allocUnsafeSlow = function (size) {
|
|
return allocUnsafe(null, size)
|
|
}
|
|
|
|
function fromString (that, string, encoding) {
|
|
if (typeof encoding !== 'string' || encoding === '') {
|
|
encoding = 'utf8'
|
|
}
|
|
|
|
if (!Buffer.isEncoding(encoding)) {
|
|
throw new TypeError('"encoding" must be a valid string encoding')
|
|
}
|
|
|
|
var length = byteLength(string, encoding) | 0
|
|
that = createBuffer(that, length)
|
|
|
|
var actual = that.write(string, encoding)
|
|
|
|
if (actual !== length) {
|
|
// Writing a hex string, for example, that contains invalid characters will
|
|
// cause everything after the first invalid character to be ignored. (e.g.
|
|
// 'abxxcd' will be treated as 'ab')
|
|
that = that.slice(0, actual)
|
|
}
|
|
|
|
return that
|
|
}
|
|
|
|
function fromArrayLike (that, array) {
|
|
var length = array.length < 0 ? 0 : checked(array.length) | 0
|
|
that = createBuffer(that, length)
|
|
for (var i = 0; i < length; i += 1) {
|
|
that[i] = array[i] & 255
|
|
}
|
|
return that
|
|
}
|
|
|
|
function fromArrayBuffer (that, array, byteOffset, length) {
|
|
array.byteLength // this throws if `array` is not a valid ArrayBuffer
|
|
|
|
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
throw new RangeError('\'offset\' is out of bounds')
|
|
}
|
|
|
|
if (array.byteLength < byteOffset + (length || 0)) {
|
|
throw new RangeError('\'length\' is out of bounds')
|
|
}
|
|
|
|
if (byteOffset === undefined && length === undefined) {
|
|
array = new Uint8Array(array)
|
|
} else if (length === undefined) {
|
|
array = new Uint8Array(array, byteOffset)
|
|
} else {
|
|
array = new Uint8Array(array, byteOffset, length)
|
|
}
|
|
|
|
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
// Return an augmented `Uint8Array` instance, for best performance
|
|
that = array
|
|
that.__proto__ = Buffer.prototype
|
|
} else {
|
|
// Fallback: Return an object instance of the Buffer class
|
|
that = fromArrayLike(that, array)
|
|
}
|
|
return that
|
|
}
|
|
|
|
function fromObject (that, obj) {
|
|
if (Buffer.isBuffer(obj)) {
|
|
var len = checked(obj.length) | 0
|
|
that = createBuffer(that, len)
|
|
|
|
if (that.length === 0) {
|
|
return that
|
|
}
|
|
|
|
obj.copy(that, 0, 0, len)
|
|
return that
|
|
}
|
|
|
|
if (obj) {
|
|
if ((typeof ArrayBuffer !== 'undefined' &&
|
|
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
|
|
if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
|
return createBuffer(that, 0)
|
|
}
|
|
return fromArrayLike(that, obj)
|
|
}
|
|
|
|
if (obj.type === 'Buffer' && isArray(obj.data)) {
|
|
return fromArrayLike(that, obj.data)
|
|
}
|
|
}
|
|
|
|
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
|
|
}
|
|
|
|
function checked (length) {
|
|
// Note: cannot use `length < kMaxLength()` here because that fails when
|
|
// length is NaN (which is otherwise coerced to zero.)
|
|
if (length >= kMaxLength()) {
|
|
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
|
'size: 0x' + kMaxLength().toString(16) + ' bytes')
|
|
}
|
|
return length | 0
|
|
}
|
|
|
|
function SlowBuffer (length) {
|
|
if (+length != length) { // eslint-disable-line eqeqeq
|
|
length = 0
|
|
}
|
|
return Buffer.alloc(+length)
|
|
}
|
|
|
|
Buffer.isBuffer = function isBuffer (b) {
|
|
return !!(b != null && b._isBuffer)
|
|
}
|
|
|
|
Buffer.compare = function compare (a, b) {
|
|
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
|
throw new TypeError('Arguments must be Buffers')
|
|
}
|
|
|
|
if (a === b) return 0
|
|
|
|
var x = a.length
|
|
var y = b.length
|
|
|
|
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
if (a[i] !== b[i]) {
|
|
x = a[i]
|
|
y = b[i]
|
|
break
|
|
}
|
|
}
|
|
|
|
if (x < y) return -1
|
|
if (y < x) return 1
|
|
return 0
|
|
}
|
|
|
|
Buffer.isEncoding = function isEncoding (encoding) {
|
|
switch (String(encoding).toLowerCase()) {
|
|
case 'hex':
|
|
case 'utf8':
|
|
case 'utf-8':
|
|
case 'ascii':
|
|
case 'latin1':
|
|
case 'binary':
|
|
case 'base64':
|
|
case 'ucs2':
|
|
case 'ucs-2':
|
|
case 'utf16le':
|
|
case 'utf-16le':
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
Buffer.concat = function concat (list, length) {
|
|
if (!isArray(list)) {
|
|
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
}
|
|
|
|
if (list.length === 0) {
|
|
return Buffer.alloc(0)
|
|
}
|
|
|
|
var i
|
|
if (length === undefined) {
|
|
length = 0
|
|
for (i = 0; i < list.length; ++i) {
|
|
length += list[i].length
|
|
}
|
|
}
|
|
|
|
var buffer = Buffer.allocUnsafe(length)
|
|
var pos = 0
|
|
for (i = 0; i < list.length; ++i) {
|
|
var buf = list[i]
|
|
if (!Buffer.isBuffer(buf)) {
|
|
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
}
|
|
buf.copy(buffer, pos)
|
|
pos += buf.length
|
|
}
|
|
return buffer
|
|
}
|
|
|
|
function byteLength (string, encoding) {
|
|
if (Buffer.isBuffer(string)) {
|
|
return string.length
|
|
}
|
|
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
|
|
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
|
return string.byteLength
|
|
}
|
|
if (typeof string !== 'string') {
|
|
string = '' + string
|
|
}
|
|
|
|
var len = string.length
|
|
if (len === 0) return 0
|
|
|
|
// Use a for loop to avoid recursion
|
|
var loweredCase = false
|
|
for (;;) {
|
|
switch (encoding) {
|
|
case 'ascii':
|
|
case 'latin1':
|
|
case 'binary':
|
|
return len
|
|
case 'utf8':
|
|
case 'utf-8':
|
|
case undefined:
|
|
return utf8ToBytes(string).length
|
|
case 'ucs2':
|
|
case 'ucs-2':
|
|
case 'utf16le':
|
|
case 'utf-16le':
|
|
return len * 2
|
|
case 'hex':
|
|
return len >>> 1
|
|
case 'base64':
|
|
return base64ToBytes(string).length
|
|
default:
|
|
if (loweredCase) return utf8ToBytes(string).length // assume utf8
|
|
encoding = ('' + encoding).toLowerCase()
|
|
loweredCase = true
|
|
}
|
|
}
|
|
}
|
|
Buffer.byteLength = byteLength
|
|
|
|
function slowToString (encoding, start, end) {
|
|
var loweredCase = false
|
|
|
|
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
// property of a typed array.
|
|
|
|
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
// to their upper/lower bounds if the value passed is out of range.
|
|
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
if (start === undefined || start < 0) {
|
|
start = 0
|
|
}
|
|
// Return early if start > this.length. Done here to prevent potential uint32
|
|
// coercion fail below.
|
|
if (start > this.length) {
|
|
return ''
|
|
}
|
|
|
|
if (end === undefined || end > this.length) {
|
|
end = this.length
|
|
}
|
|
|
|
if (end <= 0) {
|
|
return ''
|
|
}
|
|
|
|
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
|
|
end >>>= 0
|
|
start >>>= 0
|
|
|
|
if (end <= start) {
|
|
return ''
|
|
}
|
|
|
|
if (!encoding) encoding = 'utf8'
|
|
|
|
while (true) {
|
|
switch (encoding) {
|
|
case 'hex':
|
|
return hexSlice(this, start, end)
|
|
|
|
case 'utf8':
|
|
case 'utf-8':
|
|
return utf8Slice(this, start, end)
|
|
|
|
case 'ascii':
|
|
return asciiSlice(this, start, end)
|
|
|
|
case 'latin1':
|
|
case 'binary':
|
|
return latin1Slice(this, start, end)
|
|
|
|
case 'base64':
|
|
return base64Slice(this, start, end)
|
|
|
|
case 'ucs2':
|
|
case 'ucs-2':
|
|
case 'utf16le':
|
|
case 'utf-16le':
|
|
return utf16leSlice(this, start, end)
|
|
|
|
default:
|
|
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
encoding = (encoding + '').toLowerCase()
|
|
loweredCase = true
|
|
}
|
|
}
|
|
}
|
|
|
|
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
|
// Buffer instances.
|
|
Buffer.prototype._isBuffer = true
|
|
|
|
function swap (b, n, m) {
|
|
var i = b[n]
|
|
b[n] = b[m]
|
|
b[m] = i
|
|
}
|
|
|
|
Buffer.prototype.swap16 = function swap16 () {
|
|
var len = this.length
|
|
if (len % 2 !== 0) {
|
|
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
|
}
|
|
for (var i = 0; i < len; i += 2) {
|
|
swap(this, i, i + 1)
|
|
}
|
|
return this
|
|
}
|
|
|
|
Buffer.prototype.swap32 = function swap32 () {
|
|
var len = this.length
|
|
if (len % 4 !== 0) {
|
|
throw new RangeError('Buffer size must be a multiple of 32-bits')
|
|
}
|
|
for (var i = 0; i < len; i += 4) {
|
|
swap(this, i, i + 3)
|
|
swap(this, i + 1, i + 2)
|
|
}
|
|
return this
|
|
}
|
|
|
|
Buffer.prototype.swap64 = function swap64 () {
|
|
var len = this.length
|
|
if (len % 8 !== 0) {
|
|
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
|
}
|
|
for (var i = 0; i < len; i += 8) {
|
|
swap(this, i, i + 7)
|
|
swap(this, i + 1, i + 6)
|
|
swap(this, i + 2, i + 5)
|
|
swap(this, i + 3, i + 4)
|
|
}
|
|
return this
|
|
}
|
|
|
|
Buffer.prototype.toString = function toString () {
|
|
var length = this.length | 0
|
|
if (length === 0) return ''
|
|
if (arguments.length === 0) return utf8Slice(this, 0, length)
|
|
return slowToString.apply(this, arguments)
|
|
}
|
|
|
|
Buffer.prototype.equals = function equals (b) {
|
|
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
|
if (this === b) return true
|
|
return Buffer.compare(this, b) === 0
|
|
}
|
|
|
|
Buffer.prototype.inspect = function inspect () {
|
|
var str = ''
|
|
var max = exports.INSPECT_MAX_BYTES
|
|
if (this.length > 0) {
|
|
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
|
|
if (this.length > max) str += ' ... '
|
|
}
|
|
return '<Buffer ' + str + '>'
|
|
}
|
|
|
|
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
|
if (!Buffer.isBuffer(target)) {
|
|
throw new TypeError('Argument must be a Buffer')
|
|
}
|
|
|
|
if (start === undefined) {
|
|
start = 0
|
|
}
|
|
if (end === undefined) {
|
|
end = target ? target.length : 0
|
|
}
|
|
if (thisStart === undefined) {
|
|
thisStart = 0
|
|
}
|
|
if (thisEnd === undefined) {
|
|
thisEnd = this.length
|
|
}
|
|
|
|
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
throw new RangeError('out of range index')
|
|
}
|
|
|
|
if (thisStart >= thisEnd && start >= end) {
|
|
return 0
|
|
}
|
|
if (thisStart >= thisEnd) {
|
|
return -1
|
|
}
|
|
if (start >= end) {
|
|
return 1
|
|
}
|
|
|
|
start >>>= 0
|
|
end >>>= 0
|
|
thisStart >>>= 0
|
|
thisEnd >>>= 0
|
|
|
|
if (this === target) return 0
|
|
|
|
var x = thisEnd - thisStart
|
|
var y = end - start
|
|
var len = Math.min(x, y)
|
|
|
|
var thisCopy = this.slice(thisStart, thisEnd)
|
|
var targetCopy = target.slice(start, end)
|
|
|
|
for (var i = 0; i < len; ++i) {
|
|
if (thisCopy[i] !== targetCopy[i]) {
|
|
x = thisCopy[i]
|
|
y = targetCopy[i]
|
|
break
|
|
}
|
|
}
|
|
|
|
if (x < y) return -1
|
|
if (y < x) return 1
|
|
return 0
|
|
}
|
|
|
|
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
|
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
|
//
|
|
// Arguments:
|
|
// - buffer - a Buffer to search
|
|
// - val - a string, Buffer, or number
|
|
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
// - encoding - an optional encoding, relevant is val is a string
|
|
// - dir - true for indexOf, false for lastIndexOf
|
|
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
|
// Empty buffer means no match
|
|
if (buffer.length === 0) return -1
|
|
|
|
// Normalize byteOffset
|
|
if (typeof byteOffset === 'string') {
|
|
encoding = byteOffset
|
|
byteOffset = 0
|
|
} else if (byteOffset > 0x7fffffff) {
|
|
byteOffset = 0x7fffffff
|
|
} else if (byteOffset < -0x80000000) {
|
|
byteOffset = -0x80000000
|
|
}
|
|
byteOffset = +byteOffset // Coerce to Number.
|
|
if (isNaN(byteOffset)) {
|
|
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
byteOffset = dir ? 0 : (buffer.length - 1)
|
|
}
|
|
|
|
// Normalize byteOffset: negative offsets start from the end of the buffer
|
|
if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
|
if (byteOffset >= buffer.length) {
|
|
if (dir) return -1
|
|
else byteOffset = buffer.length - 1
|
|
} else if (byteOffset < 0) {
|
|
if (dir) byteOffset = 0
|
|
else return -1
|
|
}
|
|
|
|
// Normalize val
|
|
if (typeof val === 'string') {
|
|
val = Buffer.from(val, encoding)
|
|
}
|
|
|
|
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
if (Buffer.isBuffer(val)) {
|
|
// Special case: looking for empty string/buffer always fails
|
|
if (val.length === 0) {
|
|
return -1
|
|
}
|
|
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
|
} else if (typeof val === 'number') {
|
|
val = val & 0xFF // Search for a byte value [0-255]
|
|
if (Buffer.TYPED_ARRAY_SUPPORT &&
|
|
typeof Uint8Array.prototype.indexOf === 'function') {
|
|
if (dir) {
|
|
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
|
} else {
|
|
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
|
}
|
|
}
|
|
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
|
|
}
|
|
|
|
throw new TypeError('val must be string, number or Buffer')
|
|
}
|
|
|
|
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|
var indexSize = 1
|
|
var arrLength = arr.length
|
|
var valLength = val.length
|
|
|
|
if (encoding !== undefined) {
|
|
encoding = String(encoding).toLowerCase()
|
|
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
|
encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
if (arr.length < 2 || val.length < 2) {
|
|
return -1
|
|
}
|
|
indexSize = 2
|
|
arrLength /= 2
|
|
valLength /= 2
|
|
byteOffset /= 2
|
|
}
|
|
}
|
|
|
|
function read (buf, i) {
|
|
if (indexSize === 1) {
|
|
return buf[i]
|
|
} else {
|
|
return buf.readUInt16BE(i * indexSize)
|
|
}
|
|
}
|
|
|
|
var i
|
|
if (dir) {
|
|
var foundIndex = -1
|
|
for (i = byteOffset; i < arrLength; i++) {
|
|
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
if (foundIndex === -1) foundIndex = i
|
|
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
|
} else {
|
|
if (foundIndex !== -1) i -= i - foundIndex
|
|
foundIndex = -1
|
|
}
|
|
}
|
|
} else {
|
|
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
|
for (i = byteOffset; i >= 0; i--) {
|
|
var found = true
|
|
for (var j = 0; j < valLength; j++) {
|
|
if (read(arr, i + j) !== read(val, j)) {
|
|
found = false
|
|
break
|
|
}
|
|
}
|
|
if (found) return i
|
|
}
|
|
}
|
|
|
|
return -1
|
|
}
|
|
|
|
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
|
return this.indexOf(val, byteOffset, encoding) !== -1
|
|
}
|
|
|
|
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
|
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
|
}
|
|
|
|
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
|
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
|
}
|
|
|
|
function hexWrite (buf, string, offset, length) {
|
|
offset = Number(offset) || 0
|
|
var remaining = buf.length - offset
|
|
if (!length) {
|
|
length = remaining
|
|
} else {
|
|
length = Number(length)
|
|
if (length > remaining) {
|
|
length = remaining
|
|
}
|
|
}
|
|
|
|
// must be an even number of digits
|
|
var strLen = string.length
|
|
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
|
|
|
|
if (length > strLen / 2) {
|
|
length = strLen / 2
|
|
}
|
|
for (var i = 0; i < length; ++i) {
|
|
var parsed = parseInt(string.substr(i * 2, 2), 16)
|
|
if (isNaN(parsed)) return i
|
|
buf[offset + i] = parsed
|
|
}
|
|
return i
|
|
}
|
|
|
|
function utf8Write (buf, string, offset, length) {
|
|
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
|
}
|
|
|
|
function asciiWrite (buf, string, offset, length) {
|
|
return blitBuffer(asciiToBytes(string), buf, offset, length)
|
|
}
|
|
|
|
function latin1Write (buf, string, offset, length) {
|
|
return asciiWrite(buf, string, offset, length)
|
|
}
|
|
|
|
function base64Write (buf, string, offset, length) {
|
|
return blitBuffer(base64ToBytes(string), buf, offset, length)
|
|
}
|
|
|
|
function ucs2Write (buf, string, offset, length) {
|
|
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
|
}
|
|
|
|
Buffer.prototype.write = function write (string, offset, length, encoding) {
|
|
// Buffer#write(string)
|
|
if (offset === undefined) {
|
|
encoding = 'utf8'
|
|
length = this.length
|
|
offset = 0
|
|
// Buffer#write(string, encoding)
|
|
} else if (length === undefined && typeof offset === 'string') {
|
|
encoding = offset
|
|
length = this.length
|
|
offset = 0
|
|
// Buffer#write(string, offset[, length][, encoding])
|
|
} else if (isFinite(offset)) {
|
|
offset = offset | 0
|
|
if (isFinite(length)) {
|
|
length = length | 0
|
|
if (encoding === undefined) encoding = 'utf8'
|
|
} else {
|
|
encoding = length
|
|
length = undefined
|
|
}
|
|
// legacy write(string, encoding, offset, length) - remove in v0.13
|
|
} else {
|
|
throw new Error(
|
|
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
|
)
|
|
}
|
|
|
|
var remaining = this.length - offset
|
|
if (length === undefined || length > remaining) length = remaining
|
|
|
|
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
|
throw new RangeError('Attempt to write outside buffer bounds')
|
|
}
|
|
|
|
if (!encoding) encoding = 'utf8'
|
|
|
|
var loweredCase = false
|
|
for (;;) {
|
|
switch (encoding) {
|
|
case 'hex':
|
|
return hexWrite(this, string, offset, length)
|
|
|
|
case 'utf8':
|
|
case 'utf-8':
|
|
return utf8Write(this, string, offset, length)
|
|
|
|
case 'ascii':
|
|
return asciiWrite(this, string, offset, length)
|
|
|
|
case 'latin1':
|
|
case 'binary':
|
|
return latin1Write(this, string, offset, length)
|
|
|
|
case 'base64':
|
|
// Warning: maxLength not taken into account in base64Write
|
|
return base64Write(this, string, offset, length)
|
|
|
|
case 'ucs2':
|
|
case 'ucs-2':
|
|
case 'utf16le':
|
|
case 'utf-16le':
|
|
return ucs2Write(this, string, offset, length)
|
|
|
|
default:
|
|
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
encoding = ('' + encoding).toLowerCase()
|
|
loweredCase = true
|
|
}
|
|
}
|
|
}
|
|
|
|
Buffer.prototype.toJSON = function toJSON () {
|
|
return {
|
|
type: 'Buffer',
|
|
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
}
|
|
}
|
|
|
|
function base64Slice (buf, start, end) {
|
|
if (start === 0 && end === buf.length) {
|
|
return base64.fromByteArray(buf)
|
|
} else {
|
|
return base64.fromByteArray(buf.slice(start, end))
|
|
}
|
|
}
|
|
|
|
function utf8Slice (buf, start, end) {
|
|
end = Math.min(buf.length, end)
|
|
var res = []
|
|
|
|
var i = start
|
|
while (i < end) {
|
|
var firstByte = buf[i]
|
|
var codePoint = null
|
|
var bytesPerSequence = (firstByte > 0xEF) ? 4
|
|
: (firstByte > 0xDF) ? 3
|
|
: (firstByte > 0xBF) ? 2
|
|
: 1
|
|
|
|
if (i + bytesPerSequence <= end) {
|
|
var secondByte, thirdByte, fourthByte, tempCodePoint
|
|
|
|
switch (bytesPerSequence) {
|
|
case 1:
|
|
if (firstByte < 0x80) {
|
|
codePoint = firstByte
|
|
}
|
|
break
|
|
case 2:
|
|
secondByte = buf[i + 1]
|
|
if ((secondByte & 0xC0) === 0x80) {
|
|
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
|
if (tempCodePoint > 0x7F) {
|
|
codePoint = tempCodePoint
|
|
}
|
|
}
|
|
break
|
|
case 3:
|
|
secondByte = buf[i + 1]
|
|
thirdByte = buf[i + 2]
|
|
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
|
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
codePoint = tempCodePoint
|
|
}
|
|
}
|
|
break
|
|
case 4:
|
|
secondByte = buf[i + 1]
|
|
thirdByte = buf[i + 2]
|
|
fourthByte = buf[i + 3]
|
|
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
|
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
codePoint = tempCodePoint
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (codePoint === null) {
|
|
// we did not generate a valid codePoint so insert a
|
|
// replacement char (U+FFFD) and advance only 1 byte
|
|
codePoint = 0xFFFD
|
|
bytesPerSequence = 1
|
|
} else if (codePoint > 0xFFFF) {
|
|
// encode to utf16 (surrogate pair dance)
|
|
codePoint -= 0x10000
|
|
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
|
codePoint = 0xDC00 | codePoint & 0x3FF
|
|
}
|
|
|
|
res.push(codePoint)
|
|
i += bytesPerSequence
|
|
}
|
|
|
|
return decodeCodePointsArray(res)
|
|
}
|
|
|
|
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
// the lowest limit is Chrome, with 0x10000 args.
|
|
// We go 1 magnitude less, for safety
|
|
var MAX_ARGUMENTS_LENGTH = 0x1000
|
|
|
|
function decodeCodePointsArray (codePoints) {
|
|
var len = codePoints.length
|
|
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
|
|
}
|
|
|
|
// Decode in chunks to avoid "call stack size exceeded".
|
|
var res = ''
|
|
var i = 0
|
|
while (i < len) {
|
|
res += String.fromCharCode.apply(
|
|
String,
|
|
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
)
|
|
}
|
|
return res
|
|
}
|
|
|
|
function asciiSlice (buf, start, end) {
|
|
var ret = ''
|
|
end = Math.min(buf.length, end)
|
|
|
|
for (var i = start; i < end; ++i) {
|
|
ret += String.fromCharCode(buf[i] & 0x7F)
|
|
}
|
|
return ret
|
|
}
|
|
|
|
function latin1Slice (buf, start, end) {
|
|
var ret = ''
|
|
end = Math.min(buf.length, end)
|
|
|
|
for (var i = start; i < end; ++i) {
|
|
ret += String.fromCharCode(buf[i])
|
|
}
|
|
return ret
|
|
}
|
|
|
|
function hexSlice (buf, start, end) {
|
|
var len = buf.length
|
|
|
|
if (!start || start < 0) start = 0
|
|
if (!end || end < 0 || end > len) end = len
|
|
|
|
var out = ''
|
|
for (var i = start; i < end; ++i) {
|
|
out += toHex(buf[i])
|
|
}
|
|
return out
|
|
}
|
|
|
|
function utf16leSlice (buf, start, end) {
|
|
var bytes = buf.slice(start, end)
|
|
var res = ''
|
|
for (var i = 0; i < bytes.length; i += 2) {
|
|
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
|
|
}
|
|
return res
|
|
}
|
|
|
|
Buffer.prototype.slice = function slice (start, end) {
|
|
var len = this.length
|
|
start = ~~start
|
|
end = end === undefined ? len : ~~end
|
|
|
|
if (start < 0) {
|
|
start += len
|
|
if (start < 0) start = 0
|
|
} else if (start > len) {
|
|
start = len
|
|
}
|
|
|
|
if (end < 0) {
|
|
end += len
|
|
if (end < 0) end = 0
|
|
} else if (end > len) {
|
|
end = len
|
|
}
|
|
|
|
if (end < start) end = start
|
|
|
|
var newBuf
|
|
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
newBuf = this.subarray(start, end)
|
|
newBuf.__proto__ = Buffer.prototype
|
|
} else {
|
|
var sliceLen = end - start
|
|
newBuf = new Buffer(sliceLen, undefined)
|
|
for (var i = 0; i < sliceLen; ++i) {
|
|
newBuf[i] = this[i + start]
|
|
}
|
|
}
|
|
|
|
return newBuf
|
|
}
|
|
|
|
/*
|
|
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
*/
|
|
function checkOffset (offset, ext, length) {
|
|
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
|
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
|
}
|
|
|
|
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
|
offset = offset | 0
|
|
byteLength = byteLength | 0
|
|
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
|
|
var val = this[offset]
|
|
var mul = 1
|
|
var i = 0
|
|
while (++i < byteLength && (mul *= 0x100)) {
|
|
val += this[offset + i] * mul
|
|
}
|
|
|
|
return val
|
|
}
|
|
|
|
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
|
offset = offset | 0
|
|
byteLength = byteLength | 0
|
|
if (!noAssert) {
|
|
checkOffset(offset, byteLength, this.length)
|
|
}
|
|
|
|
var val = this[offset + --byteLength]
|
|
var mul = 1
|
|
while (byteLength > 0 && (mul *= 0x100)) {
|
|
val += this[offset + --byteLength] * mul
|
|
}
|
|
|
|
return val
|
|
}
|
|
|
|
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 1, this.length)
|
|
return this[offset]
|
|
}
|
|
|
|
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
return this[offset] | (this[offset + 1] << 8)
|
|
}
|
|
|
|
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
return (this[offset] << 8) | this[offset + 1]
|
|
}
|
|
|
|
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
|
|
return ((this[offset]) |
|
|
(this[offset + 1] << 8) |
|
|
(this[offset + 2] << 16)) +
|
|
(this[offset + 3] * 0x1000000)
|
|
}
|
|
|
|
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
|
|
return (this[offset] * 0x1000000) +
|
|
((this[offset + 1] << 16) |
|
|
(this[offset + 2] << 8) |
|
|
this[offset + 3])
|
|
}
|
|
|
|
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
|
offset = offset | 0
|
|
byteLength = byteLength | 0
|
|
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
|
|
var val = this[offset]
|
|
var mul = 1
|
|
var i = 0
|
|
while (++i < byteLength && (mul *= 0x100)) {
|
|
val += this[offset + i] * mul
|
|
}
|
|
mul *= 0x80
|
|
|
|
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
|
|
|
return val
|
|
}
|
|
|
|
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
|
offset = offset | 0
|
|
byteLength = byteLength | 0
|
|
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
|
|
var i = byteLength
|
|
var mul = 1
|
|
var val = this[offset + --i]
|
|
while (i > 0 && (mul *= 0x100)) {
|
|
val += this[offset + --i] * mul
|
|
}
|
|
mul *= 0x80
|
|
|
|
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
|
|
|
return val
|
|
}
|
|
|
|
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 1, this.length)
|
|
if (!(this[offset] & 0x80)) return (this[offset])
|
|
return ((0xff - this[offset] + 1) * -1)
|
|
}
|
|
|
|
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
var val = this[offset] | (this[offset + 1] << 8)
|
|
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
}
|
|
|
|
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
var val = this[offset + 1] | (this[offset] << 8)
|
|
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
}
|
|
|
|
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
|
|
return (this[offset]) |
|
|
(this[offset + 1] << 8) |
|
|
(this[offset + 2] << 16) |
|
|
(this[offset + 3] << 24)
|
|
}
|
|
|
|
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
|
|
return (this[offset] << 24) |
|
|
(this[offset + 1] << 16) |
|
|
(this[offset + 2] << 8) |
|
|
(this[offset + 3])
|
|
}
|
|
|
|
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
return ieee754.read(this, offset, true, 23, 4)
|
|
}
|
|
|
|
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
return ieee754.read(this, offset, false, 23, 4)
|
|
}
|
|
|
|
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 8, this.length)
|
|
return ieee754.read(this, offset, true, 52, 8)
|
|
}
|
|
|
|
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
|
if (!noAssert) checkOffset(offset, 8, this.length)
|
|
return ieee754.read(this, offset, false, 52, 8)
|
|
}
|
|
|
|
function checkInt (buf, value, offset, ext, max, min) {
|
|
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
|
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
|
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
}
|
|
|
|
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
byteLength = byteLength | 0
|
|
if (!noAssert) {
|
|
var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
}
|
|
|
|
var mul = 1
|
|
var i = 0
|
|
this[offset] = value & 0xFF
|
|
while (++i < byteLength && (mul *= 0x100)) {
|
|
this[offset + i] = (value / mul) & 0xFF
|
|
}
|
|
|
|
return offset + byteLength
|
|
}
|
|
|
|
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
byteLength = byteLength | 0
|
|
if (!noAssert) {
|
|
var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
}
|
|
|
|
var i = byteLength - 1
|
|
var mul = 1
|
|
this[offset + i] = value & 0xFF
|
|
while (--i >= 0 && (mul *= 0x100)) {
|
|
this[offset + i] = (value / mul) & 0xFF
|
|
}
|
|
|
|
return offset + byteLength
|
|
}
|
|
|
|
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
|
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
|
this[offset] = (value & 0xff)
|
|
return offset + 1
|
|
}
|
|
|
|
function objectWriteUInt16 (buf, value, offset, littleEndian) {
|
|
if (value < 0) value = 0xffff + value + 1
|
|
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
|
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
|
|
(littleEndian ? i : 1 - i) * 8
|
|
}
|
|
}
|
|
|
|
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
|
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
this[offset] = (value & 0xff)
|
|
this[offset + 1] = (value >>> 8)
|
|
} else {
|
|
objectWriteUInt16(this, value, offset, true)
|
|
}
|
|
return offset + 2
|
|
}
|
|
|
|
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
|
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
this[offset] = (value >>> 8)
|
|
this[offset + 1] = (value & 0xff)
|
|
} else {
|
|
objectWriteUInt16(this, value, offset, false)
|
|
}
|
|
return offset + 2
|
|
}
|
|
|
|
function objectWriteUInt32 (buf, value, offset, littleEndian) {
|
|
if (value < 0) value = 0xffffffff + value + 1
|
|
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
|
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
|
|
}
|
|
}
|
|
|
|
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
|
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
this[offset + 3] = (value >>> 24)
|
|
this[offset + 2] = (value >>> 16)
|
|
this[offset + 1] = (value >>> 8)
|
|
this[offset] = (value & 0xff)
|
|
} else {
|
|
objectWriteUInt32(this, value, offset, true)
|
|
}
|
|
return offset + 4
|
|
}
|
|
|
|
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
|
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
this[offset] = (value >>> 24)
|
|
this[offset + 1] = (value >>> 16)
|
|
this[offset + 2] = (value >>> 8)
|
|
this[offset + 3] = (value & 0xff)
|
|
} else {
|
|
objectWriteUInt32(this, value, offset, false)
|
|
}
|
|
return offset + 4
|
|
}
|
|
|
|
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
if (!noAssert) {
|
|
var limit = Math.pow(2, 8 * byteLength - 1)
|
|
|
|
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
}
|
|
|
|
var i = 0
|
|
var mul = 1
|
|
var sub = 0
|
|
this[offset] = value & 0xFF
|
|
while (++i < byteLength && (mul *= 0x100)) {
|
|
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
sub = 1
|
|
}
|
|
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
|
}
|
|
|
|
return offset + byteLength
|
|
}
|
|
|
|
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
if (!noAssert) {
|
|
var limit = Math.pow(2, 8 * byteLength - 1)
|
|
|
|
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
}
|
|
|
|
var i = byteLength - 1
|
|
var mul = 1
|
|
var sub = 0
|
|
this[offset + i] = value & 0xFF
|
|
while (--i >= 0 && (mul *= 0x100)) {
|
|
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
sub = 1
|
|
}
|
|
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
|
}
|
|
|
|
return offset + byteLength
|
|
}
|
|
|
|
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
|
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
|
if (value < 0) value = 0xff + value + 1
|
|
this[offset] = (value & 0xff)
|
|
return offset + 1
|
|
}
|
|
|
|
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
|
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
this[offset] = (value & 0xff)
|
|
this[offset + 1] = (value >>> 8)
|
|
} else {
|
|
objectWriteUInt16(this, value, offset, true)
|
|
}
|
|
return offset + 2
|
|
}
|
|
|
|
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
|
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
this[offset] = (value >>> 8)
|
|
this[offset + 1] = (value & 0xff)
|
|
} else {
|
|
objectWriteUInt16(this, value, offset, false)
|
|
}
|
|
return offset + 2
|
|
}
|
|
|
|
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
|
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
this[offset] = (value & 0xff)
|
|
this[offset + 1] = (value >>> 8)
|
|
this[offset + 2] = (value >>> 16)
|
|
this[offset + 3] = (value >>> 24)
|
|
} else {
|
|
objectWriteUInt32(this, value, offset, true)
|
|
}
|
|
return offset + 4
|
|
}
|
|
|
|
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
|
value = +value
|
|
offset = offset | 0
|
|
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
|
if (value < 0) value = 0xffffffff + value + 1
|
|
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
this[offset] = (value >>> 24)
|
|
this[offset + 1] = (value >>> 16)
|
|
this[offset + 2] = (value >>> 8)
|
|
this[offset + 3] = (value & 0xff)
|
|
} else {
|
|
objectWriteUInt32(this, value, offset, false)
|
|
}
|
|
return offset + 4
|
|
}
|
|
|
|
function checkIEEE754 (buf, value, offset, ext, max, min) {
|
|
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
if (offset < 0) throw new RangeError('Index out of range')
|
|
}
|
|
|
|
function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
|
if (!noAssert) {
|
|
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
|
}
|
|
ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
|
return offset + 4
|
|
}
|
|
|
|
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
|
return writeFloat(this, value, offset, true, noAssert)
|
|
}
|
|
|
|
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
|
return writeFloat(this, value, offset, false, noAssert)
|
|
}
|
|
|
|
function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
|
if (!noAssert) {
|
|
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
|
}
|
|
ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
|
return offset + 8
|
|
}
|
|
|
|
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
|
return writeDouble(this, value, offset, true, noAssert)
|
|
}
|
|
|
|
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
|
return writeDouble(this, value, offset, false, noAssert)
|
|
}
|
|
|
|
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
|
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
|
if (!start) start = 0
|
|
if (!end && end !== 0) end = this.length
|
|
if (targetStart >= target.length) targetStart = target.length
|
|
if (!targetStart) targetStart = 0
|
|
if (end > 0 && end < start) end = start
|
|
|
|
// Copy 0 bytes; we're done
|
|
if (end === start) return 0
|
|
if (target.length === 0 || this.length === 0) return 0
|
|
|
|
// Fatal error conditions
|
|
if (targetStart < 0) {
|
|
throw new RangeError('targetStart out of bounds')
|
|
}
|
|
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
|
|
if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
|
|
|
// Are we oob?
|
|
if (end > this.length) end = this.length
|
|
if (target.length - targetStart < end - start) {
|
|
end = target.length - targetStart + start
|
|
}
|
|
|
|
var len = end - start
|
|
var i
|
|
|
|
if (this === target && start < targetStart && targetStart < end) {
|
|
// descending copy from end
|
|
for (i = len - 1; i >= 0; --i) {
|
|
target[i + targetStart] = this[i + start]
|
|
}
|
|
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
|
|
// ascending copy from start
|
|
for (i = 0; i < len; ++i) {
|
|
target[i + targetStart] = this[i + start]
|
|
}
|
|
} else {
|
|
Uint8Array.prototype.set.call(
|
|
target,
|
|
this.subarray(start, start + len),
|
|
targetStart
|
|
)
|
|
}
|
|
|
|
return len
|
|
}
|
|
|
|
// Usage:
|
|
// buffer.fill(number[, offset[, end]])
|
|
// buffer.fill(buffer[, offset[, end]])
|
|
// buffer.fill(string[, offset[, end]][, encoding])
|
|
Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|
// Handle string cases:
|
|
if (typeof val === 'string') {
|
|
if (typeof start === 'string') {
|
|
encoding = start
|
|
start = 0
|
|
end = this.length
|
|
} else if (typeof end === 'string') {
|
|
encoding = end
|
|
end = this.length
|
|
}
|
|
if (val.length === 1) {
|
|
var code = val.charCodeAt(0)
|
|
if (code < 256) {
|
|
val = code
|
|
}
|
|
}
|
|
if (encoding !== undefined && typeof encoding !== 'string') {
|
|
throw new TypeError('encoding must be a string')
|
|
}
|
|
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
|
throw new TypeError('Unknown encoding: ' + encoding)
|
|
}
|
|
} else if (typeof val === 'number') {
|
|
val = val & 255
|
|
}
|
|
|
|
// Invalid ranges are not set to a default, so can range check early.
|
|
if (start < 0 || this.length < start || this.length < end) {
|
|
throw new RangeError('Out of range index')
|
|
}
|
|
|
|
if (end <= start) {
|
|
return this
|
|
}
|
|
|
|
start = start >>> 0
|
|
end = end === undefined ? this.length : end >>> 0
|
|
|
|
if (!val) val = 0
|
|
|
|
var i
|
|
if (typeof val === 'number') {
|
|
for (i = start; i < end; ++i) {
|
|
this[i] = val
|
|
}
|
|
} else {
|
|
var bytes = Buffer.isBuffer(val)
|
|
? val
|
|
: utf8ToBytes(new Buffer(val, encoding).toString())
|
|
var len = bytes.length
|
|
for (i = 0; i < end - start; ++i) {
|
|
this[i + start] = bytes[i % len]
|
|
}
|
|
}
|
|
|
|
return this
|
|
}
|
|
|
|
// HELPER FUNCTIONS
|
|
// ================
|
|
|
|
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
|
|
|
|
function base64clean (str) {
|
|
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
|
str = stringtrim(str).replace(INVALID_BASE64_RE, '')
|
|
// Node converts strings with length < 2 to ''
|
|
if (str.length < 2) return ''
|
|
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
|
while (str.length % 4 !== 0) {
|
|
str = str + '='
|
|
}
|
|
return str
|
|
}
|
|
|
|
function stringtrim (str) {
|
|
if (str.trim) return str.trim()
|
|
return str.replace(/^\s+|\s+$/g, '')
|
|
}
|
|
|
|
function toHex (n) {
|
|
if (n < 16) return '0' + n.toString(16)
|
|
return n.toString(16)
|
|
}
|
|
|
|
function utf8ToBytes (string, units) {
|
|
units = units || Infinity
|
|
var codePoint
|
|
var length = string.length
|
|
var leadSurrogate = null
|
|
var bytes = []
|
|
|
|
for (var i = 0; i < length; ++i) {
|
|
codePoint = string.charCodeAt(i)
|
|
|
|
// is surrogate component
|
|
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
|
// last char was a lead
|
|
if (!leadSurrogate) {
|
|
// no lead yet
|
|
if (codePoint > 0xDBFF) {
|
|
// unexpected trail
|
|
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
continue
|
|
} else if (i + 1 === length) {
|
|
// unpaired lead
|
|
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
continue
|
|
}
|
|
|
|
// valid lead
|
|
leadSurrogate = codePoint
|
|
|
|
continue
|
|
}
|
|
|
|
// 2 leads in a row
|
|
if (codePoint < 0xDC00) {
|
|
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
leadSurrogate = codePoint
|
|
continue
|
|
}
|
|
|
|
// valid surrogate pair
|
|
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
|
} else if (leadSurrogate) {
|
|
// valid bmp char, but last char was a lead
|
|
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
}
|
|
|
|
leadSurrogate = null
|
|
|
|
// encode utf8
|
|
if (codePoint < 0x80) {
|
|
if ((units -= 1) < 0) break
|
|
bytes.push(codePoint)
|
|
} else if (codePoint < 0x800) {
|
|
if ((units -= 2) < 0) break
|
|
bytes.push(
|
|
codePoint >> 0x6 | 0xC0,
|
|
codePoint & 0x3F | 0x80
|
|
)
|
|
} else if (codePoint < 0x10000) {
|
|
if ((units -= 3) < 0) break
|
|
bytes.push(
|
|
codePoint >> 0xC | 0xE0,
|
|
codePoint >> 0x6 & 0x3F | 0x80,
|
|
codePoint & 0x3F | 0x80
|
|
)
|
|
} else if (codePoint < 0x110000) {
|
|
if ((units -= 4) < 0) break
|
|
bytes.push(
|
|
codePoint >> 0x12 | 0xF0,
|
|
codePoint >> 0xC & 0x3F | 0x80,
|
|
codePoint >> 0x6 & 0x3F | 0x80,
|
|
codePoint & 0x3F | 0x80
|
|
)
|
|
} else {
|
|
throw new Error('Invalid code point')
|
|
}
|
|
}
|
|
|
|
return bytes
|
|
}
|
|
|
|
function asciiToBytes (str) {
|
|
var byteArray = []
|
|
for (var i = 0; i < str.length; ++i) {
|
|
// Node's code seems to be doing this and not & 0x7F..
|
|
byteArray.push(str.charCodeAt(i) & 0xFF)
|
|
}
|
|
return byteArray
|
|
}
|
|
|
|
function utf16leToBytes (str, units) {
|
|
var c, hi, lo
|
|
var byteArray = []
|
|
for (var i = 0; i < str.length; ++i) {
|
|
if ((units -= 2) < 0) break
|
|
|
|
c = str.charCodeAt(i)
|
|
hi = c >> 8
|
|
lo = c % 256
|
|
byteArray.push(lo)
|
|
byteArray.push(hi)
|
|
}
|
|
|
|
return byteArray
|
|
}
|
|
|
|
function base64ToBytes (str) {
|
|
return base64.toByteArray(base64clean(str))
|
|
}
|
|
|
|
function blitBuffer (src, dst, offset, length) {
|
|
for (var i = 0; i < length; ++i) {
|
|
if ((i + offset >= dst.length) || (i >= src.length)) break
|
|
dst[i + offset] = src[i]
|
|
}
|
|
return i
|
|
}
|
|
|
|
function isnan (val) {
|
|
return val !== val // eslint-disable-line no-self-compare
|
|
}
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
|
|
|
/***/ },
|
|
/* 3 */
|
|
/***/ function(module, exports) {
|
|
|
|
'use strict'
|
|
|
|
exports.byteLength = byteLength
|
|
exports.toByteArray = toByteArray
|
|
exports.fromByteArray = fromByteArray
|
|
|
|
var lookup = []
|
|
var revLookup = []
|
|
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
|
|
|
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
|
for (var i = 0, len = code.length; i < len; ++i) {
|
|
lookup[i] = code[i]
|
|
revLookup[code.charCodeAt(i)] = i
|
|
}
|
|
|
|
revLookup['-'.charCodeAt(0)] = 62
|
|
revLookup['_'.charCodeAt(0)] = 63
|
|
|
|
function placeHoldersCount (b64) {
|
|
var len = b64.length
|
|
if (len % 4 > 0) {
|
|
throw new Error('Invalid string. Length must be a multiple of 4')
|
|
}
|
|
|
|
// the number of equal signs (place holders)
|
|
// if there are two placeholders, than the two characters before it
|
|
// represent one byte
|
|
// if there is only one, then the three characters before it represent 2 bytes
|
|
// this is just a cheap hack to not do indexOf twice
|
|
return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
|
|
}
|
|
|
|
function byteLength (b64) {
|
|
// base64 is 4/3 + up to two characters of the original data
|
|
return b64.length * 3 / 4 - placeHoldersCount(b64)
|
|
}
|
|
|
|
function toByteArray (b64) {
|
|
var i, j, l, tmp, placeHolders, arr
|
|
var len = b64.length
|
|
placeHolders = placeHoldersCount(b64)
|
|
|
|
arr = new Arr(len * 3 / 4 - placeHolders)
|
|
|
|
// if there are placeholders, only get up to the last complete 4 chars
|
|
l = placeHolders > 0 ? len - 4 : len
|
|
|
|
var L = 0
|
|
|
|
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
|
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
|
|
arr[L++] = (tmp >> 16) & 0xFF
|
|
arr[L++] = (tmp >> 8) & 0xFF
|
|
arr[L++] = tmp & 0xFF
|
|
}
|
|
|
|
if (placeHolders === 2) {
|
|
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
|
|
arr[L++] = tmp & 0xFF
|
|
} else if (placeHolders === 1) {
|
|
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
|
|
arr[L++] = (tmp >> 8) & 0xFF
|
|
arr[L++] = tmp & 0xFF
|
|
}
|
|
|
|
return arr
|
|
}
|
|
|
|
function tripletToBase64 (num) {
|
|
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
|
|
}
|
|
|
|
function encodeChunk (uint8, start, end) {
|
|
var tmp
|
|
var output = []
|
|
for (var i = start; i < end; i += 3) {
|
|
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
|
|
output.push(tripletToBase64(tmp))
|
|
}
|
|
return output.join('')
|
|
}
|
|
|
|
function fromByteArray (uint8) {
|
|
var tmp
|
|
var len = uint8.length
|
|
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
|
var output = ''
|
|
var parts = []
|
|
var maxChunkLength = 16383 // must be multiple of 3
|
|
|
|
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
|
}
|
|
|
|
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
if (extraBytes === 1) {
|
|
tmp = uint8[len - 1]
|
|
output += lookup[tmp >> 2]
|
|
output += lookup[(tmp << 4) & 0x3F]
|
|
output += '=='
|
|
} else if (extraBytes === 2) {
|
|
tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
|
|
output += lookup[tmp >> 10]
|
|
output += lookup[(tmp >> 4) & 0x3F]
|
|
output += lookup[(tmp << 2) & 0x3F]
|
|
output += '='
|
|
}
|
|
|
|
parts.push(output)
|
|
|
|
return parts.join('')
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 4 */
|
|
/***/ function(module, exports) {
|
|
|
|
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
|
var e, m
|
|
var eLen = nBytes * 8 - mLen - 1
|
|
var eMax = (1 << eLen) - 1
|
|
var eBias = eMax >> 1
|
|
var nBits = -7
|
|
var i = isLE ? (nBytes - 1) : 0
|
|
var d = isLE ? -1 : 1
|
|
var s = buffer[offset + i]
|
|
|
|
i += d
|
|
|
|
e = s & ((1 << (-nBits)) - 1)
|
|
s >>= (-nBits)
|
|
nBits += eLen
|
|
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
|
|
m = e & ((1 << (-nBits)) - 1)
|
|
e >>= (-nBits)
|
|
nBits += mLen
|
|
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
|
|
if (e === 0) {
|
|
e = 1 - eBias
|
|
} else if (e === eMax) {
|
|
return m ? NaN : ((s ? -1 : 1) * Infinity)
|
|
} else {
|
|
m = m + Math.pow(2, mLen)
|
|
e = e - eBias
|
|
}
|
|
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
|
}
|
|
|
|
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
|
var e, m, c
|
|
var eLen = nBytes * 8 - mLen - 1
|
|
var eMax = (1 << eLen) - 1
|
|
var eBias = eMax >> 1
|
|
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
|
var i = isLE ? 0 : (nBytes - 1)
|
|
var d = isLE ? 1 : -1
|
|
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
|
|
|
value = Math.abs(value)
|
|
|
|
if (isNaN(value) || value === Infinity) {
|
|
m = isNaN(value) ? 1 : 0
|
|
e = eMax
|
|
} else {
|
|
e = Math.floor(Math.log(value) / Math.LN2)
|
|
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
e--
|
|
c *= 2
|
|
}
|
|
if (e + eBias >= 1) {
|
|
value += rt / c
|
|
} else {
|
|
value += rt * Math.pow(2, 1 - eBias)
|
|
}
|
|
if (value * c >= 2) {
|
|
e++
|
|
c /= 2
|
|
}
|
|
|
|
if (e + eBias >= eMax) {
|
|
m = 0
|
|
e = eMax
|
|
} else if (e + eBias >= 1) {
|
|
m = (value * c - 1) * Math.pow(2, mLen)
|
|
e = e + eBias
|
|
} else {
|
|
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
|
e = 0
|
|
}
|
|
}
|
|
|
|
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
|
|
|
e = (e << mLen) | m
|
|
eLen += mLen
|
|
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
|
|
buffer[offset + i - d] |= s * 128
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 5 */
|
|
/***/ function(module, exports) {
|
|
|
|
var toString = {}.toString;
|
|
|
|
module.exports = Array.isArray || function (arr) {
|
|
return toString.call(arr) == '[object Array]';
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 6 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* jslint node: true */
|
|
/* global window */
|
|
'use strict';
|
|
|
|
var _ = __webpack_require__(7);
|
|
var FontProvider = __webpack_require__(9);
|
|
var LayoutBuilder = __webpack_require__(10);
|
|
var PdfKit = __webpack_require__(29);
|
|
var sizes = __webpack_require__(295);
|
|
var ImageMeasure = __webpack_require__(296);
|
|
var textDecorator = __webpack_require__(297);
|
|
|
|
_.noConflict();
|
|
|
|
////////////////////////////////////////
|
|
// PdfPrinter
|
|
|
|
/**
|
|
* @class Creates an instance of a PdfPrinter which turns document definition into a pdf
|
|
*
|
|
* @param {Object} fontDescriptors font definition dictionary
|
|
*
|
|
* @example
|
|
* var fontDescriptors = {
|
|
* Roboto: {
|
|
* normal: 'fonts/Roboto-Regular.ttf',
|
|
* bold: 'fonts/Roboto-Medium.ttf',
|
|
* italics: 'fonts/Roboto-Italic.ttf',
|
|
* bolditalics: 'fonts/Roboto-MediumItalic.ttf'
|
|
* }
|
|
* };
|
|
*
|
|
* var printer = new PdfPrinter(fontDescriptors);
|
|
*/
|
|
function PdfPrinter(fontDescriptors) {
|
|
this.fontDescriptors = fontDescriptors;
|
|
}
|
|
|
|
/**
|
|
* Executes layout engine for the specified document and renders it into a pdfkit document
|
|
* ready to be saved.
|
|
*
|
|
* @param {Object} docDefinition document definition
|
|
* @param {Object} docDefinition.content an array describing the pdf structure (for more information take a look at the examples in the /examples folder)
|
|
* @param {Object} [docDefinition.defaultStyle] default (implicit) style definition
|
|
* @param {Object} [docDefinition.styles] dictionary defining all styles which can be used in the document
|
|
* @param {Object} [docDefinition.pageSize] page size (pdfkit units, A4 dimensions by default)
|
|
* @param {Number} docDefinition.pageSize.width width
|
|
* @param {Number} docDefinition.pageSize.height height
|
|
* @param {Object} [docDefinition.pageMargins] page margins (pdfkit units)
|
|
* @param {Number} docDefinition.maxPagesNumber maximum number of pages to render
|
|
*
|
|
* @example
|
|
*
|
|
* var docDefinition = {
|
|
* info: {
|
|
* title: 'awesome Document',
|
|
* author: 'john doe',
|
|
* subject: 'subject of document',
|
|
* keywords: 'keywords for document',
|
|
* },
|
|
* content: [
|
|
* 'First paragraph',
|
|
* 'Second paragraph, this time a little bit longer',
|
|
* { text: 'Third paragraph, slightly bigger font size', fontSize: 20 },
|
|
* { text: 'Another paragraph using a named style', style: 'header' },
|
|
* { text: ['playing with ', 'inlines' ] },
|
|
* { text: ['and ', { text: 'restyling ', bold: true }, 'them'] },
|
|
* ],
|
|
* styles: {
|
|
* header: { fontSize: 30, bold: true }
|
|
* }
|
|
* }
|
|
*
|
|
* var pdfDoc = printer.createPdfKitDocument(docDefinition);
|
|
*
|
|
* pdfDoc.pipe(fs.createWriteStream('sample.pdf'));
|
|
* pdfDoc.end();
|
|
*
|
|
* @return {Object} a pdfKit document object which can be saved or encode to data-url
|
|
*/
|
|
PdfPrinter.prototype.createPdfKitDocument = function (docDefinition, options) {
|
|
options = options || {};
|
|
|
|
var pageSize = pageSize2widthAndHeight(docDefinition.pageSize || 'a4');
|
|
|
|
if (docDefinition.pageOrientation === 'landscape') {
|
|
pageSize = {width: pageSize.height, height: pageSize.width};
|
|
}
|
|
pageSize.orientation = docDefinition.pageOrientation === 'landscape' ? docDefinition.pageOrientation : 'portrait';
|
|
|
|
this.pdfKitDoc = new PdfKit({size: [pageSize.width, pageSize.height], compress: docDefinition.compress || true});
|
|
this.pdfKitDoc.info.Producer = 'pdfmake';
|
|
this.pdfKitDoc.info.Creator = 'pdfmake';
|
|
|
|
// pdf kit maintains the uppercase fieldnames from pdf spec
|
|
// to keep the pdfmake api consistent, the info field are defined lowercase
|
|
if (docDefinition.info) {
|
|
var info = docDefinition.info;
|
|
// check for falsey an set null, so that pdfkit always get either null or value
|
|
this.pdfKitDoc.info.Title = info.title ? info.title : null;
|
|
this.pdfKitDoc.info.Author = info.author ? info.author : null;
|
|
this.pdfKitDoc.info.Subject = info.subject ? info.subject : null;
|
|
this.pdfKitDoc.info.Keywords = info.keywords ? info.keywords : null;
|
|
this.pdfKitDoc.info.CreationDate = info.creationDate ? info.creationDate : null;
|
|
}
|
|
|
|
this.fontProvider = new FontProvider(this.fontDescriptors, this.pdfKitDoc);
|
|
|
|
docDefinition.images = docDefinition.images || {};
|
|
|
|
var builder = new LayoutBuilder(
|
|
pageSize,
|
|
fixPageMargins(docDefinition.pageMargins || 40),
|
|
new ImageMeasure(this.pdfKitDoc, docDefinition.images));
|
|
|
|
registerDefaultTableLayouts(builder);
|
|
if (options.tableLayouts) {
|
|
builder.registerTableLayouts(options.tableLayouts);
|
|
}
|
|
|
|
var pages = builder.layoutDocument(docDefinition.content, this.fontProvider, docDefinition.styles || {}, docDefinition.defaultStyle || {fontSize: 12, font: 'Roboto'}, docDefinition.background, docDefinition.header, docDefinition.footer, docDefinition.images, docDefinition.watermark, docDefinition.pageBreakBefore);
|
|
var maxNumberPages = docDefinition.maxPagesNumber || -1;
|
|
if (typeof maxNumberPages === 'number' && maxNumberPages > -1) {
|
|
pages = pages.slice(0, maxNumberPages);
|
|
}
|
|
|
|
renderPages(pages, this.fontProvider, this.pdfKitDoc);
|
|
|
|
if (options.autoPrint) {
|
|
var printActionRef = this.pdfKitDoc.ref({
|
|
Type: 'Action',
|
|
S: 'Named',
|
|
N: 'Print'
|
|
});
|
|
this.pdfKitDoc._root.data.OpenAction = printActionRef;
|
|
printActionRef.end();
|
|
}
|
|
return this.pdfKitDoc;
|
|
};
|
|
|
|
function fixPageMargins(margin) {
|
|
if (!margin) {
|
|
return null;
|
|
}
|
|
|
|
if (typeof margin === 'number' || margin instanceof Number) {
|
|
margin = {left: margin, right: margin, top: margin, bottom: margin};
|
|
} else if (Array.isArray(margin)) {
|
|
if (margin.length === 2) {
|
|
margin = {left: margin[0], top: margin[1], right: margin[0], bottom: margin[1]};
|
|
} else if (margin.length === 4) {
|
|
margin = {left: margin[0], top: margin[1], right: margin[2], bottom: margin[3]};
|
|
} else
|
|
throw 'Invalid pageMargins definition';
|
|
}
|
|
|
|
return margin;
|
|
}
|
|
|
|
function registerDefaultTableLayouts(layoutBuilder) {
|
|
layoutBuilder.registerTableLayouts({
|
|
noBorders: {
|
|
hLineWidth: function (i) {
|
|
return 0;
|
|
},
|
|
vLineWidth: function (i) {
|
|
return 0;
|
|
},
|
|
paddingLeft: function (i) {
|
|
return i && 4 || 0;
|
|
},
|
|
paddingRight: function (i, node) {
|
|
return (i < node.table.widths.length - 1) ? 4 : 0;
|
|
},
|
|
},
|
|
headerLineOnly: {
|
|
hLineWidth: function (i, node) {
|
|
if (i === 0 || i === node.table.body.length) {
|
|
return 0;
|
|
}
|
|
return (i === node.table.headerRows) ? 2 : 0;
|
|
},
|
|
vLineWidth: function (i) {
|
|
return 0;
|
|
},
|
|
paddingLeft: function (i) {
|
|
return i === 0 ? 0 : 8;
|
|
},
|
|
paddingRight: function (i, node) {
|
|
return (i === node.table.widths.length - 1) ? 0 : 8;
|
|
}
|
|
},
|
|
lightHorizontalLines: {
|
|
hLineWidth: function (i, node) {
|
|
if (i === 0 || i === node.table.body.length) {
|
|
return 0;
|
|
}
|
|
return (i === node.table.headerRows) ? 2 : 1;
|
|
},
|
|
vLineWidth: function (i) {
|
|
return 0;
|
|
},
|
|
hLineColor: function (i) {
|
|
return i === 1 ? 'black' : '#aaa';
|
|
},
|
|
paddingLeft: function (i) {
|
|
return i === 0 ? 0 : 8;
|
|
},
|
|
paddingRight: function (i, node) {
|
|
return (i === node.table.widths.length - 1) ? 0 : 8;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
var defaultLayout = {
|
|
hLineWidth: function (i, node) {
|
|
return 1;
|
|
}, //return node.table.headerRows && i === node.table.headerRows && 3 || 0; },
|
|
vLineWidth: function (i, node) {
|
|
return 1;
|
|
},
|
|
hLineColor: function (i, node) {
|
|
return 'black';
|
|
},
|
|
vLineColor: function (i, node) {
|
|
return 'black';
|
|
},
|
|
paddingLeft: function (i, node) {
|
|
return 4;
|
|
}, //i && 4 || 0; },
|
|
paddingRight: function (i, node) {
|
|
return 4;
|
|
}, //(i < node.table.widths.length - 1) ? 4 : 0; },
|
|
paddingTop: function (i, node) {
|
|
return 2;
|
|
},
|
|
paddingBottom: function (i, node) {
|
|
return 2;
|
|
},
|
|
defaultBorder: true
|
|
};
|
|
|
|
function pageSize2widthAndHeight(pageSize) {
|
|
if (typeof pageSize == 'string' || pageSize instanceof String) {
|
|
var size = sizes[pageSize.toUpperCase()];
|
|
if (!size) {
|
|
throw ('Page size ' + pageSize + ' not recognized');
|
|
}
|
|
return {width: size[0], height: size[1]};
|
|
}
|
|
|
|
return pageSize;
|
|
}
|
|
|
|
function StringObject(str) {
|
|
this.isString = true;
|
|
this.toString = function () {
|
|
return str;
|
|
};
|
|
}
|
|
|
|
function updatePageOrientationInOptions(currentPage, pdfKitDoc) {
|
|
var previousPageOrientation = pdfKitDoc.options.size[0] > pdfKitDoc.options.size[1] ? 'landscape' : 'portrait';
|
|
|
|
if (currentPage.pageSize.orientation !== previousPageOrientation) {
|
|
var width = pdfKitDoc.options.size[0];
|
|
var height = pdfKitDoc.options.size[1];
|
|
pdfKitDoc.options.size = [height, width];
|
|
}
|
|
}
|
|
|
|
function renderPages(pages, fontProvider, pdfKitDoc) {
|
|
pdfKitDoc._pdfMakePages = pages;
|
|
for (var i = 0; i < pages.length; i++) {
|
|
if (i > 0) {
|
|
updatePageOrientationInOptions(pages[i], pdfKitDoc);
|
|
pdfKitDoc.addPage(pdfKitDoc.options);
|
|
}
|
|
|
|
var page = pages[i];
|
|
for (var ii = 0, il = page.items.length; ii < il; ii++) {
|
|
var item = page.items[ii];
|
|
switch (item.type) {
|
|
case 'vector':
|
|
renderVector(item.item, pdfKitDoc);
|
|
break;
|
|
case 'line':
|
|
renderLine(item.item, item.item.x, item.item.y, pdfKitDoc);
|
|
break;
|
|
case 'image':
|
|
renderImage(item.item, item.item.x, item.item.y, pdfKitDoc);
|
|
break;
|
|
}
|
|
}
|
|
if (page.watermark) {
|
|
renderWatermark(page, pdfKitDoc);
|
|
}
|
|
}
|
|
}
|
|
|
|
function renderLine(line, x, y, pdfKitDoc) {
|
|
x = x || 0;
|
|
y = y || 0;
|
|
|
|
var lineHeight = line.getHeight();
|
|
var ascenderHeight = line.getAscenderHeight();
|
|
var descent = lineHeight - ascenderHeight;
|
|
|
|
textDecorator.drawBackground(line, x, y, pdfKitDoc);
|
|
|
|
//TODO: line.optimizeInlines();
|
|
for (var i = 0, l = line.inlines.length; i < l; i++) {
|
|
var inline = line.inlines[i];
|
|
var shiftToBaseline = lineHeight - ((inline.font.ascender / 1000) * inline.fontSize) - descent;
|
|
|
|
pdfKitDoc.fill(inline.color || 'black');
|
|
|
|
pdfKitDoc._font = inline.font;
|
|
pdfKitDoc.fontSize(inline.fontSize);
|
|
pdfKitDoc.text(inline.text, x + inline.x, y + shiftToBaseline, {
|
|
lineBreak: false,
|
|
textWidth: inline.width,
|
|
wordCount: 1,
|
|
link: inline.link
|
|
});
|
|
}
|
|
|
|
textDecorator.drawDecorations(line, x, y, pdfKitDoc);
|
|
}
|
|
|
|
function renderWatermark(page, pdfKitDoc) {
|
|
var watermark = page.watermark;
|
|
|
|
pdfKitDoc.fill(watermark.color);
|
|
pdfKitDoc.opacity(watermark.opacity);
|
|
|
|
pdfKitDoc.save();
|
|
|
|
var angle = Math.atan2(pdfKitDoc.page.height, pdfKitDoc.page.width) * -180 / Math.PI;
|
|
pdfKitDoc.rotate(angle, {origin: [pdfKitDoc.page.width / 2, pdfKitDoc.page.height / 2]});
|
|
|
|
var x = pdfKitDoc.page.width / 2 - watermark.size.size.width / 2;
|
|
var y = pdfKitDoc.page.height / 2 - watermark.size.size.height / 4;
|
|
|
|
pdfKitDoc._font = watermark.font;
|
|
pdfKitDoc.fontSize(watermark.size.fontSize);
|
|
pdfKitDoc.text(watermark.text, x, y, {lineBreak: false});
|
|
|
|
pdfKitDoc.restore();
|
|
}
|
|
|
|
function renderVector(vector, pdfDoc) {
|
|
//TODO: pdf optimization (there's no need to write all properties everytime)
|
|
pdfDoc.lineWidth(vector.lineWidth || 1);
|
|
if (vector.dash) {
|
|
pdfDoc.dash(vector.dash.length, {space: vector.dash.space || vector.dash.length});
|
|
} else {
|
|
pdfDoc.undash();
|
|
}
|
|
pdfDoc.fillOpacity(vector.fillOpacity || 1);
|
|
pdfDoc.strokeOpacity(vector.strokeOpacity || 1);
|
|
pdfDoc.lineJoin(vector.lineJoin || 'miter');
|
|
|
|
//TODO: clipping
|
|
|
|
switch (vector.type) {
|
|
case 'ellipse':
|
|
pdfDoc.ellipse(vector.x, vector.y, vector.r1, vector.r2);
|
|
break;
|
|
case 'rect':
|
|
if (vector.r) {
|
|
pdfDoc.roundedRect(vector.x, vector.y, vector.w, vector.h, vector.r);
|
|
} else {
|
|
pdfDoc.rect(vector.x, vector.y, vector.w, vector.h);
|
|
}
|
|
|
|
if (vector.linearGradient) {
|
|
var gradient = pdfDoc.linearGradient(vector.x, vector.y, vector.x + vector.w, vector.y);
|
|
var step = 1 / (vector.linearGradient.length - 1);
|
|
|
|
for (var i = 0; i < vector.linearGradient.length; i++) {
|
|
gradient.stop(i * step, vector.linearGradient[i]);
|
|
}
|
|
|
|
vector.color = gradient;
|
|
}
|
|
break;
|
|
case 'line':
|
|
pdfDoc.moveTo(vector.x1, vector.y1);
|
|
pdfDoc.lineTo(vector.x2, vector.y2);
|
|
break;
|
|
case 'polyline':
|
|
if (vector.points.length === 0) {
|
|
break;
|
|
}
|
|
|
|
pdfDoc.moveTo(vector.points[0].x, vector.points[0].y);
|
|
for (var i = 1, l = vector.points.length; i < l; i++) {
|
|
pdfDoc.lineTo(vector.points[i].x, vector.points[i].y);
|
|
}
|
|
|
|
if (vector.points.length > 1) {
|
|
var p1 = vector.points[0];
|
|
var pn = vector.points[vector.points.length - 1];
|
|
|
|
if (vector.closePath || p1.x === pn.x && p1.y === pn.y) {
|
|
pdfDoc.closePath();
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
|
|
if (vector.color && vector.lineColor) {
|
|
pdfDoc.fillAndStroke(vector.color, vector.lineColor);
|
|
} else if (vector.color) {
|
|
pdfDoc.fill(vector.color);
|
|
} else {
|
|
pdfDoc.stroke(vector.lineColor || 'black');
|
|
}
|
|
}
|
|
|
|
function renderImage(image, x, y, pdfKitDoc) {
|
|
pdfKitDoc.image(image.image, image.x, image.y, {width: image._width, height: image._height});
|
|
if (image.link) {
|
|
pdfKitDoc.link(image.x, image.y, image._width, image._height, image.link);
|
|
}
|
|
}
|
|
|
|
module.exports = PdfPrinter;
|
|
|
|
|
|
/* temporary browser extension */
|
|
PdfPrinter.prototype.fs = __webpack_require__(53);
|
|
|
|
|
|
/***/ },
|
|
/* 7 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global, module) {/**
|
|
* @license
|
|
* Lodash <https://lodash.com/>
|
|
* Copyright JS Foundation and other contributors <https://js.foundation/>
|
|
* Released under MIT license <https://lodash.com/license>
|
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
*/
|
|
;(function() {
|
|
|
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
|
var undefined;
|
|
|
|
/** Used as the semantic version number. */
|
|
var VERSION = '4.17.4';
|
|
|
|
/** Used as the size to enable large array optimizations. */
|
|
var LARGE_ARRAY_SIZE = 200;
|
|
|
|
/** Error message constants. */
|
|
var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
|
|
FUNC_ERROR_TEXT = 'Expected a function';
|
|
|
|
/** Used to stand-in for `undefined` hash values. */
|
|
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
|
|
/** Used as the maximum memoize cache size. */
|
|
var MAX_MEMOIZE_SIZE = 500;
|
|
|
|
/** Used as the internal argument placeholder. */
|
|
var PLACEHOLDER = '__lodash_placeholder__';
|
|
|
|
/** Used to compose bitmasks for cloning. */
|
|
var CLONE_DEEP_FLAG = 1,
|
|
CLONE_FLAT_FLAG = 2,
|
|
CLONE_SYMBOLS_FLAG = 4;
|
|
|
|
/** Used to compose bitmasks for value comparisons. */
|
|
var COMPARE_PARTIAL_FLAG = 1,
|
|
COMPARE_UNORDERED_FLAG = 2;
|
|
|
|
/** Used to compose bitmasks for function metadata. */
|
|
var WRAP_BIND_FLAG = 1,
|
|
WRAP_BIND_KEY_FLAG = 2,
|
|
WRAP_CURRY_BOUND_FLAG = 4,
|
|
WRAP_CURRY_FLAG = 8,
|
|
WRAP_CURRY_RIGHT_FLAG = 16,
|
|
WRAP_PARTIAL_FLAG = 32,
|
|
WRAP_PARTIAL_RIGHT_FLAG = 64,
|
|
WRAP_ARY_FLAG = 128,
|
|
WRAP_REARG_FLAG = 256,
|
|
WRAP_FLIP_FLAG = 512;
|
|
|
|
/** Used as default options for `_.truncate`. */
|
|
var DEFAULT_TRUNC_LENGTH = 30,
|
|
DEFAULT_TRUNC_OMISSION = '...';
|
|
|
|
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
var HOT_COUNT = 800,
|
|
HOT_SPAN = 16;
|
|
|
|
/** Used to indicate the type of lazy iteratees. */
|
|
var LAZY_FILTER_FLAG = 1,
|
|
LAZY_MAP_FLAG = 2,
|
|
LAZY_WHILE_FLAG = 3;
|
|
|
|
/** Used as references for various `Number` constants. */
|
|
var INFINITY = 1 / 0,
|
|
MAX_SAFE_INTEGER = 9007199254740991,
|
|
MAX_INTEGER = 1.7976931348623157e+308,
|
|
NAN = 0 / 0;
|
|
|
|
/** Used as references for the maximum length and index of an array. */
|
|
var MAX_ARRAY_LENGTH = 4294967295,
|
|
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
|
|
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
|
|
|
|
/** Used to associate wrap methods with their bit flags. */
|
|
var wrapFlags = [
|
|
['ary', WRAP_ARY_FLAG],
|
|
['bind', WRAP_BIND_FLAG],
|
|
['bindKey', WRAP_BIND_KEY_FLAG],
|
|
['curry', WRAP_CURRY_FLAG],
|
|
['curryRight', WRAP_CURRY_RIGHT_FLAG],
|
|
['flip', WRAP_FLIP_FLAG],
|
|
['partial', WRAP_PARTIAL_FLAG],
|
|
['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
|
|
['rearg', WRAP_REARG_FLAG]
|
|
];
|
|
|
|
/** `Object#toString` result references. */
|
|
var argsTag = '[object Arguments]',
|
|
arrayTag = '[object Array]',
|
|
asyncTag = '[object AsyncFunction]',
|
|
boolTag = '[object Boolean]',
|
|
dateTag = '[object Date]',
|
|
domExcTag = '[object DOMException]',
|
|
errorTag = '[object Error]',
|
|
funcTag = '[object Function]',
|
|
genTag = '[object GeneratorFunction]',
|
|
mapTag = '[object Map]',
|
|
numberTag = '[object Number]',
|
|
nullTag = '[object Null]',
|
|
objectTag = '[object Object]',
|
|
promiseTag = '[object Promise]',
|
|
proxyTag = '[object Proxy]',
|
|
regexpTag = '[object RegExp]',
|
|
setTag = '[object Set]',
|
|
stringTag = '[object String]',
|
|
symbolTag = '[object Symbol]',
|
|
undefinedTag = '[object Undefined]',
|
|
weakMapTag = '[object WeakMap]',
|
|
weakSetTag = '[object WeakSet]';
|
|
|
|
var arrayBufferTag = '[object ArrayBuffer]',
|
|
dataViewTag = '[object DataView]',
|
|
float32Tag = '[object Float32Array]',
|
|
float64Tag = '[object Float64Array]',
|
|
int8Tag = '[object Int8Array]',
|
|
int16Tag = '[object Int16Array]',
|
|
int32Tag = '[object Int32Array]',
|
|
uint8Tag = '[object Uint8Array]',
|
|
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
uint16Tag = '[object Uint16Array]',
|
|
uint32Tag = '[object Uint32Array]';
|
|
|
|
/** Used to match empty string literals in compiled template source. */
|
|
var reEmptyStringLeading = /\b__p \+= '';/g,
|
|
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
|
|
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
|
|
|
|
/** Used to match HTML entities and HTML characters. */
|
|
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
|
|
reUnescapedHtml = /[&<>"']/g,
|
|
reHasEscapedHtml = RegExp(reEscapedHtml.source),
|
|
reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
|
|
|
|
/** Used to match template delimiters. */
|
|
var reEscape = /<%-([\s\S]+?)%>/g,
|
|
reEvaluate = /<%([\s\S]+?)%>/g,
|
|
reInterpolate = /<%=([\s\S]+?)%>/g;
|
|
|
|
/** Used to match property names within property paths. */
|
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
reIsPlainProp = /^\w*$/,
|
|
reLeadingDot = /^\./,
|
|
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
|
|
/**
|
|
* Used to match `RegExp`
|
|
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
*/
|
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
|
|
reHasRegExpChar = RegExp(reRegExpChar.source);
|
|
|
|
/** Used to match leading and trailing whitespace. */
|
|
var reTrim = /^\s+|\s+$/g,
|
|
reTrimStart = /^\s+/,
|
|
reTrimEnd = /\s+$/;
|
|
|
|
/** Used to match wrap detail comments. */
|
|
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
|
|
reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
|
|
reSplitDetails = /,? & /;
|
|
|
|
/** Used to match words composed of alphanumeric characters. */
|
|
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
|
|
/** Used to match backslashes in property paths. */
|
|
var reEscapeChar = /\\(\\)?/g;
|
|
|
|
/**
|
|
* Used to match
|
|
* [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
|
|
*/
|
|
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
|
|
|
/** Used to match `RegExp` flags from their coerced string values. */
|
|
var reFlags = /\w*$/;
|
|
|
|
/** Used to detect bad signed hexadecimal string values. */
|
|
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
|
|
/** Used to detect binary string values. */
|
|
var reIsBinary = /^0b[01]+$/i;
|
|
|
|
/** Used to detect host constructors (Safari). */
|
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
|
|
/** Used to detect octal string values. */
|
|
var reIsOctal = /^0o[0-7]+$/i;
|
|
|
|
/** Used to detect unsigned integer values. */
|
|
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
|
|
/** Used to match Latin Unicode letters (excluding mathematical operators). */
|
|
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
|
|
/** Used to ensure capturing order of template delimiters. */
|
|
var reNoMatch = /($^)/;
|
|
|
|
/** Used to match unescaped characters in compiled string literals. */
|
|
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
|
|
|
/** Used to compose unicode character classes. */
|
|
var rsAstralRange = '\\ud800-\\udfff',
|
|
rsComboMarksRange = '\\u0300-\\u036f',
|
|
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
|
rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
|
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
|
rsDingbatRange = '\\u2700-\\u27bf',
|
|
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
|
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
|
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
|
|
rsPunctuationRange = '\\u2000-\\u206f',
|
|
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
|
|
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
|
|
rsVarRange = '\\ufe0e\\ufe0f',
|
|
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
|
|
|
/** Used to compose unicode capture groups. */
|
|
var rsApos = "['\u2019]",
|
|
rsAstral = '[' + rsAstralRange + ']',
|
|
rsBreak = '[' + rsBreakRange + ']',
|
|
rsCombo = '[' + rsComboRange + ']',
|
|
rsDigits = '\\d+',
|
|
rsDingbat = '[' + rsDingbatRange + ']',
|
|
rsLower = '[' + rsLowerRange + ']',
|
|
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
|
|
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
|
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
|
rsNonAstral = '[^' + rsAstralRange + ']',
|
|
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
|
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
|
rsUpper = '[' + rsUpperRange + ']',
|
|
rsZWJ = '\\u200d';
|
|
|
|
/** Used to compose unicode regexes. */
|
|
var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
|
|
rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
|
|
rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
|
rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
|
reOptMod = rsModifier + '?',
|
|
rsOptVar = '[' + rsVarRange + ']?',
|
|
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
|
rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)',
|
|
rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)',
|
|
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
|
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
|
|
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
|
|
|
/** Used to match apostrophes. */
|
|
var reApos = RegExp(rsApos, 'g');
|
|
|
|
/**
|
|
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
|
|
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
|
|
*/
|
|
var reComboMark = RegExp(rsCombo, 'g');
|
|
|
|
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
|
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
|
|
|
/** Used to match complex or compound words. */
|
|
var reUnicodeWord = RegExp([
|
|
rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
|
rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
|
|
rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
|
|
rsUpper + '+' + rsOptContrUpper,
|
|
rsOrdUpper,
|
|
rsOrdLower,
|
|
rsDigits,
|
|
rsEmoji
|
|
].join('|'), 'g');
|
|
|
|
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
|
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
|
|
|
|
/** Used to detect strings that need a more robust regexp to match words. */
|
|
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
|
|
|
/** Used to assign default `context` object properties. */
|
|
var contextProps = [
|
|
'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
|
|
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
|
|
'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
|
|
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
|
|
'_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
|
|
];
|
|
|
|
/** Used to make template sourceURLs easier to identify. */
|
|
var templateCounter = -1;
|
|
|
|
/** Used to identify `toStringTag` values of typed arrays. */
|
|
var typedArrayTags = {};
|
|
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
|
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
|
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
|
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
|
typedArrayTags[uint32Tag] = true;
|
|
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
|
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
|
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
|
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
|
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
|
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
|
typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
|
typedArrayTags[weakMapTag] = false;
|
|
|
|
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
|
var cloneableTags = {};
|
|
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
|
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
|
|
cloneableTags[boolTag] = cloneableTags[dateTag] =
|
|
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
|
|
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
|
|
cloneableTags[int32Tag] = cloneableTags[mapTag] =
|
|
cloneableTags[numberTag] = cloneableTags[objectTag] =
|
|
cloneableTags[regexpTag] = cloneableTags[setTag] =
|
|
cloneableTags[stringTag] = cloneableTags[symbolTag] =
|
|
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
|
|
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
cloneableTags[errorTag] = cloneableTags[funcTag] =
|
|
cloneableTags[weakMapTag] = false;
|
|
|
|
/** Used to map Latin Unicode letters to basic Latin letters. */
|
|
var deburredLetters = {
|
|
// Latin-1 Supplement block.
|
|
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
|
|
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
|
|
'\xc7': 'C', '\xe7': 'c',
|
|
'\xd0': 'D', '\xf0': 'd',
|
|
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
|
|
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
|
|
'\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
|
|
'\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
|
|
'\xd1': 'N', '\xf1': 'n',
|
|
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
|
|
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
|
|
'\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
|
|
'\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
|
|
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
|
|
'\xc6': 'Ae', '\xe6': 'ae',
|
|
'\xde': 'Th', '\xfe': 'th',
|
|
'\xdf': 'ss',
|
|
// Latin Extended-A block.
|
|
'\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
|
|
'\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
|
|
'\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
|
|
'\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
|
|
'\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
|
|
'\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
|
|
'\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
|
|
'\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
|
|
'\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
|
|
'\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
|
|
'\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
|
|
'\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
|
|
'\u0134': 'J', '\u0135': 'j',
|
|
'\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
|
|
'\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
|
|
'\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
|
|
'\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
|
|
'\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
|
|
'\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
|
|
'\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
|
|
'\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
|
|
'\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
|
|
'\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
|
|
'\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
|
|
'\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
|
|
'\u0163': 't', '\u0165': 't', '\u0167': 't',
|
|
'\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
|
|
'\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
|
|
'\u0174': 'W', '\u0175': 'w',
|
|
'\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
|
|
'\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
|
|
'\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
|
|
'\u0132': 'IJ', '\u0133': 'ij',
|
|
'\u0152': 'Oe', '\u0153': 'oe',
|
|
'\u0149': "'n", '\u017f': 's'
|
|
};
|
|
|
|
/** Used to map characters to HTML entities. */
|
|
var htmlEscapes = {
|
|
'&': '&',
|
|
'<': '<',
|
|
'>': '>',
|
|
'"': '"',
|
|
"'": '''
|
|
};
|
|
|
|
/** Used to map HTML entities to characters. */
|
|
var htmlUnescapes = {
|
|
'&': '&',
|
|
'<': '<',
|
|
'>': '>',
|
|
'"': '"',
|
|
''': "'"
|
|
};
|
|
|
|
/** Used to escape characters for inclusion in compiled string literals. */
|
|
var stringEscapes = {
|
|
'\\': '\\',
|
|
"'": "'",
|
|
'\n': 'n',
|
|
'\r': 'r',
|
|
'\u2028': 'u2028',
|
|
'\u2029': 'u2029'
|
|
};
|
|
|
|
/** Built-in method references without a dependency on `root`. */
|
|
var freeParseFloat = parseFloat,
|
|
freeParseInt = parseInt;
|
|
|
|
/** Detect free variable `global` from Node.js. */
|
|
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
|
|
/** Detect free variable `self`. */
|
|
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
|
|
/** Used as a reference to the global object. */
|
|
var root = freeGlobal || freeSelf || Function('return this')();
|
|
|
|
/** Detect free variable `exports`. */
|
|
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
|
|
/** Detect free variable `module`. */
|
|
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
|
|
|
/** Detect the popular CommonJS extension `module.exports`. */
|
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
|
|
/** Detect free variable `process` from Node.js. */
|
|
var freeProcess = moduleExports && freeGlobal.process;
|
|
|
|
/** Used to access faster Node.js helpers. */
|
|
var nodeUtil = (function() {
|
|
try {
|
|
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
} catch (e) {}
|
|
}());
|
|
|
|
/* Node.js helper references. */
|
|
var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
|
|
nodeIsDate = nodeUtil && nodeUtil.isDate,
|
|
nodeIsMap = nodeUtil && nodeUtil.isMap,
|
|
nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
|
|
nodeIsSet = nodeUtil && nodeUtil.isSet,
|
|
nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Adds the key-value `pair` to `map`.
|
|
*
|
|
* @private
|
|
* @param {Object} map The map to modify.
|
|
* @param {Array} pair The key-value pair to add.
|
|
* @returns {Object} Returns `map`.
|
|
*/
|
|
function addMapEntry(map, pair) {
|
|
// Don't return `map.set` because it's not chainable in IE 11.
|
|
map.set(pair[0], pair[1]);
|
|
return map;
|
|
}
|
|
|
|
/**
|
|
* Adds `value` to `set`.
|
|
*
|
|
* @private
|
|
* @param {Object} set The set to modify.
|
|
* @param {*} value The value to add.
|
|
* @returns {Object} Returns `set`.
|
|
*/
|
|
function addSetEntry(set, value) {
|
|
// Don't return `set.add` because it's not chainable in IE 11.
|
|
set.add(value);
|
|
return set;
|
|
}
|
|
|
|
/**
|
|
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to invoke.
|
|
* @param {*} thisArg The `this` binding of `func`.
|
|
* @param {Array} args The arguments to invoke `func` with.
|
|
* @returns {*} Returns the result of `func`.
|
|
*/
|
|
function apply(func, thisArg, args) {
|
|
switch (args.length) {
|
|
case 0: return func.call(thisArg);
|
|
case 1: return func.call(thisArg, args[0]);
|
|
case 2: return func.call(thisArg, args[0], args[1]);
|
|
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
}
|
|
return func.apply(thisArg, args);
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseAggregator` for arrays.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} setter The function to set `accumulator` values.
|
|
* @param {Function} iteratee The iteratee to transform keys.
|
|
* @param {Object} accumulator The initial aggregated object.
|
|
* @returns {Function} Returns `accumulator`.
|
|
*/
|
|
function arrayAggregator(array, setter, iteratee, accumulator) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length;
|
|
|
|
while (++index < length) {
|
|
var value = array[index];
|
|
setter(accumulator, value, iteratee(value), array);
|
|
}
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.forEach` for arrays without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function arrayEach(array, iteratee) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length;
|
|
|
|
while (++index < length) {
|
|
if (iteratee(array[index], index, array) === false) {
|
|
break;
|
|
}
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.forEachRight` for arrays without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function arrayEachRight(array, iteratee) {
|
|
var length = array == null ? 0 : array.length;
|
|
|
|
while (length--) {
|
|
if (iteratee(array[length], length, array) === false) {
|
|
break;
|
|
}
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.every` for arrays without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
|
* else `false`.
|
|
*/
|
|
function arrayEvery(array, predicate) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length;
|
|
|
|
while (++index < length) {
|
|
if (!predicate(array[index], index, array)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.filter` for arrays without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {Array} Returns the new filtered array.
|
|
*/
|
|
function arrayFilter(array, predicate) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length,
|
|
resIndex = 0,
|
|
result = [];
|
|
|
|
while (++index < length) {
|
|
var value = array[index];
|
|
if (predicate(value, index, array)) {
|
|
result[resIndex++] = value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.includes` for arrays without support for
|
|
* specifying an index to search from.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to inspect.
|
|
* @param {*} target The value to search for.
|
|
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
|
*/
|
|
function arrayIncludes(array, value) {
|
|
var length = array == null ? 0 : array.length;
|
|
return !!length && baseIndexOf(array, value, 0) > -1;
|
|
}
|
|
|
|
/**
|
|
* This function is like `arrayIncludes` except that it accepts a comparator.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to inspect.
|
|
* @param {*} target The value to search for.
|
|
* @param {Function} comparator The comparator invoked per element.
|
|
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
|
*/
|
|
function arrayIncludesWith(array, value, comparator) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length;
|
|
|
|
while (++index < length) {
|
|
if (comparator(value, array[index])) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.map` for arrays without support for iteratee
|
|
* shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns the new mapped array.
|
|
*/
|
|
function arrayMap(array, iteratee) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length,
|
|
result = Array(length);
|
|
|
|
while (++index < length) {
|
|
result[index] = iteratee(array[index], index, array);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Appends the elements of `values` to `array`.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to modify.
|
|
* @param {Array} values The values to append.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function arrayPush(array, values) {
|
|
var index = -1,
|
|
length = values.length,
|
|
offset = array.length;
|
|
|
|
while (++index < length) {
|
|
array[offset + index] = values[index];
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.reduce` for arrays without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @param {*} [accumulator] The initial value.
|
|
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
|
* the initial value.
|
|
* @returns {*} Returns the accumulated value.
|
|
*/
|
|
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length;
|
|
|
|
if (initAccum && length) {
|
|
accumulator = array[++index];
|
|
}
|
|
while (++index < length) {
|
|
accumulator = iteratee(accumulator, array[index], index, array);
|
|
}
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.reduceRight` for arrays without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @param {*} [accumulator] The initial value.
|
|
* @param {boolean} [initAccum] Specify using the last element of `array` as
|
|
* the initial value.
|
|
* @returns {*} Returns the accumulated value.
|
|
*/
|
|
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (initAccum && length) {
|
|
accumulator = array[--length];
|
|
}
|
|
while (length--) {
|
|
accumulator = iteratee(accumulator, array[length], length, array);
|
|
}
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.some` for arrays without support for iteratee
|
|
* shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} [array] The array to iterate over.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
|
* else `false`.
|
|
*/
|
|
function arraySome(array, predicate) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length;
|
|
|
|
while (++index < length) {
|
|
if (predicate(array[index], index, array)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Gets the size of an ASCII `string`.
|
|
*
|
|
* @private
|
|
* @param {string} string The string inspect.
|
|
* @returns {number} Returns the string size.
|
|
*/
|
|
var asciiSize = baseProperty('length');
|
|
|
|
/**
|
|
* Converts an ASCII `string` to an array.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to convert.
|
|
* @returns {Array} Returns the converted array.
|
|
*/
|
|
function asciiToArray(string) {
|
|
return string.split('');
|
|
}
|
|
|
|
/**
|
|
* Splits an ASCII `string` into an array of its words.
|
|
*
|
|
* @private
|
|
* @param {string} The string to inspect.
|
|
* @returns {Array} Returns the words of `string`.
|
|
*/
|
|
function asciiWords(string) {
|
|
return string.match(reAsciiWord) || [];
|
|
}
|
|
|
|
/**
|
|
* The base implementation of methods like `_.findKey` and `_.findLastKey`,
|
|
* without support for iteratee shorthands, which iterates over `collection`
|
|
* using `eachFunc`.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to inspect.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @param {Function} eachFunc The function to iterate over `collection`.
|
|
* @returns {*} Returns the found element or its key, else `undefined`.
|
|
*/
|
|
function baseFindKey(collection, predicate, eachFunc) {
|
|
var result;
|
|
eachFunc(collection, function(value, key, collection) {
|
|
if (predicate(value, key, collection)) {
|
|
result = key;
|
|
return false;
|
|
}
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.findIndex` and `_.findLastIndex` without
|
|
* support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @param {number} fromIndex The index to search from.
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
*/
|
|
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
|
var length = array.length,
|
|
index = fromIndex + (fromRight ? 1 : -1);
|
|
|
|
while ((fromRight ? index-- : ++index < length)) {
|
|
if (predicate(array[index], index, array)) {
|
|
return index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} fromIndex The index to search from.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
*/
|
|
function baseIndexOf(array, value, fromIndex) {
|
|
return value === value
|
|
? strictIndexOf(array, value, fromIndex)
|
|
: baseFindIndex(array, baseIsNaN, fromIndex);
|
|
}
|
|
|
|
/**
|
|
* This function is like `baseIndexOf` except that it accepts a comparator.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} fromIndex The index to search from.
|
|
* @param {Function} comparator The comparator invoked per element.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
*/
|
|
function baseIndexOfWith(array, value, fromIndex, comparator) {
|
|
var index = fromIndex - 1,
|
|
length = array.length;
|
|
|
|
while (++index < length) {
|
|
if (comparator(array[index], value)) {
|
|
return index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isNaN` without support for number objects.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
|
|
*/
|
|
function baseIsNaN(value) {
|
|
return value !== value;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.mean` and `_.meanBy` without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {number} Returns the mean.
|
|
*/
|
|
function baseMean(array, iteratee) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? (baseSum(array, iteratee) / length) : NAN;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.property` without support for deep paths.
|
|
*
|
|
* @private
|
|
* @param {string} key The key of the property to get.
|
|
* @returns {Function} Returns the new accessor function.
|
|
*/
|
|
function baseProperty(key) {
|
|
return function(object) {
|
|
return object == null ? undefined : object[key];
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.propertyOf` without support for deep paths.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Function} Returns the new accessor function.
|
|
*/
|
|
function basePropertyOf(object) {
|
|
return function(key) {
|
|
return object == null ? undefined : object[key];
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.reduce` and `_.reduceRight`, without support
|
|
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @param {*} accumulator The initial value.
|
|
* @param {boolean} initAccum Specify using the first or last element of
|
|
* `collection` as the initial value.
|
|
* @param {Function} eachFunc The function to iterate over `collection`.
|
|
* @returns {*} Returns the accumulated value.
|
|
*/
|
|
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
|
|
eachFunc(collection, function(value, index, collection) {
|
|
accumulator = initAccum
|
|
? (initAccum = false, value)
|
|
: iteratee(accumulator, value, index, collection);
|
|
});
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sortBy` which uses `comparer` to define the
|
|
* sort order of `array` and replaces criteria objects with their corresponding
|
|
* values.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to sort.
|
|
* @param {Function} comparer The function to define sort order.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function baseSortBy(array, comparer) {
|
|
var length = array.length;
|
|
|
|
array.sort(comparer);
|
|
while (length--) {
|
|
array[length] = array[length].value;
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sum` and `_.sumBy` without support for
|
|
* iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {number} Returns the sum.
|
|
*/
|
|
function baseSum(array, iteratee) {
|
|
var result,
|
|
index = -1,
|
|
length = array.length;
|
|
|
|
while (++index < length) {
|
|
var current = iteratee(array[index]);
|
|
if (current !== undefined) {
|
|
result = result === undefined ? current : (result + current);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.times` without support for iteratee shorthands
|
|
* or max array length checks.
|
|
*
|
|
* @private
|
|
* @param {number} n The number of times to invoke `iteratee`.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns the array of results.
|
|
*/
|
|
function baseTimes(n, iteratee) {
|
|
var index = -1,
|
|
result = Array(n);
|
|
|
|
while (++index < n) {
|
|
result[index] = iteratee(index);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
|
|
* of key-value pairs for `object` corresponding to the property names of `props`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Array} props The property names to get values for.
|
|
* @returns {Object} Returns the key-value pairs.
|
|
*/
|
|
function baseToPairs(object, props) {
|
|
return arrayMap(props, function(key) {
|
|
return [key, object[key]];
|
|
});
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.unary` without support for storing metadata.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to cap arguments for.
|
|
* @returns {Function} Returns the new capped function.
|
|
*/
|
|
function baseUnary(func) {
|
|
return function(value) {
|
|
return func(value);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.values` and `_.valuesIn` which creates an
|
|
* array of `object` property values corresponding to the property names
|
|
* of `props`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Array} props The property names to get values for.
|
|
* @returns {Object} Returns the array of property values.
|
|
*/
|
|
function baseValues(object, props) {
|
|
return arrayMap(props, function(key) {
|
|
return object[key];
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Checks if a `cache` value for `key` exists.
|
|
*
|
|
* @private
|
|
* @param {Object} cache The cache to query.
|
|
* @param {string} key The key of the entry to check.
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
*/
|
|
function cacheHas(cache, key) {
|
|
return cache.has(key);
|
|
}
|
|
|
|
/**
|
|
* Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
|
|
* that is not found in the character symbols.
|
|
*
|
|
* @private
|
|
* @param {Array} strSymbols The string symbols to inspect.
|
|
* @param {Array} chrSymbols The character symbols to find.
|
|
* @returns {number} Returns the index of the first unmatched string symbol.
|
|
*/
|
|
function charsStartIndex(strSymbols, chrSymbols) {
|
|
var index = -1,
|
|
length = strSymbols.length;
|
|
|
|
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
|
|
return index;
|
|
}
|
|
|
|
/**
|
|
* Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
|
|
* that is not found in the character symbols.
|
|
*
|
|
* @private
|
|
* @param {Array} strSymbols The string symbols to inspect.
|
|
* @param {Array} chrSymbols The character symbols to find.
|
|
* @returns {number} Returns the index of the last unmatched string symbol.
|
|
*/
|
|
function charsEndIndex(strSymbols, chrSymbols) {
|
|
var index = strSymbols.length;
|
|
|
|
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
|
|
return index;
|
|
}
|
|
|
|
/**
|
|
* Gets the number of `placeholder` occurrences in `array`.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} placeholder The placeholder to search for.
|
|
* @returns {number} Returns the placeholder count.
|
|
*/
|
|
function countHolders(array, placeholder) {
|
|
var length = array.length,
|
|
result = 0;
|
|
|
|
while (length--) {
|
|
if (array[length] === placeholder) {
|
|
++result;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
|
|
* letters to basic Latin letters.
|
|
*
|
|
* @private
|
|
* @param {string} letter The matched letter to deburr.
|
|
* @returns {string} Returns the deburred letter.
|
|
*/
|
|
var deburrLetter = basePropertyOf(deburredLetters);
|
|
|
|
/**
|
|
* Used by `_.escape` to convert characters to HTML entities.
|
|
*
|
|
* @private
|
|
* @param {string} chr The matched character to escape.
|
|
* @returns {string} Returns the escaped character.
|
|
*/
|
|
var escapeHtmlChar = basePropertyOf(htmlEscapes);
|
|
|
|
/**
|
|
* Used by `_.template` to escape characters for inclusion in compiled string literals.
|
|
*
|
|
* @private
|
|
* @param {string} chr The matched character to escape.
|
|
* @returns {string} Returns the escaped character.
|
|
*/
|
|
function escapeStringChar(chr) {
|
|
return '\\' + stringEscapes[chr];
|
|
}
|
|
|
|
/**
|
|
* Gets the value at `key` of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} [object] The object to query.
|
|
* @param {string} key The key of the property to get.
|
|
* @returns {*} Returns the property value.
|
|
*/
|
|
function getValue(object, key) {
|
|
return object == null ? undefined : object[key];
|
|
}
|
|
|
|
/**
|
|
* Checks if `string` contains Unicode symbols.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to inspect.
|
|
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
|
*/
|
|
function hasUnicode(string) {
|
|
return reHasUnicode.test(string);
|
|
}
|
|
|
|
/**
|
|
* Checks if `string` contains a word composed of Unicode symbols.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to inspect.
|
|
* @returns {boolean} Returns `true` if a word is found, else `false`.
|
|
*/
|
|
function hasUnicodeWord(string) {
|
|
return reHasUnicodeWord.test(string);
|
|
}
|
|
|
|
/**
|
|
* Converts `iterator` to an array.
|
|
*
|
|
* @private
|
|
* @param {Object} iterator The iterator to convert.
|
|
* @returns {Array} Returns the converted array.
|
|
*/
|
|
function iteratorToArray(iterator) {
|
|
var data,
|
|
result = [];
|
|
|
|
while (!(data = iterator.next()).done) {
|
|
result.push(data.value);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts `map` to its key-value pairs.
|
|
*
|
|
* @private
|
|
* @param {Object} map The map to convert.
|
|
* @returns {Array} Returns the key-value pairs.
|
|
*/
|
|
function mapToArray(map) {
|
|
var index = -1,
|
|
result = Array(map.size);
|
|
|
|
map.forEach(function(value, key) {
|
|
result[++index] = [key, value];
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates a unary function that invokes `func` with its argument transformed.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to wrap.
|
|
* @param {Function} transform The argument transform.
|
|
* @returns {Function} Returns the new function.
|
|
*/
|
|
function overArg(func, transform) {
|
|
return function(arg) {
|
|
return func(transform(arg));
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Replaces all `placeholder` elements in `array` with an internal placeholder
|
|
* and returns an array of their indexes.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to modify.
|
|
* @param {*} placeholder The placeholder to replace.
|
|
* @returns {Array} Returns the new array of placeholder indexes.
|
|
*/
|
|
function replaceHolders(array, placeholder) {
|
|
var index = -1,
|
|
length = array.length,
|
|
resIndex = 0,
|
|
result = [];
|
|
|
|
while (++index < length) {
|
|
var value = array[index];
|
|
if (value === placeholder || value === PLACEHOLDER) {
|
|
array[index] = PLACEHOLDER;
|
|
result[resIndex++] = index;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts `set` to an array of its values.
|
|
*
|
|
* @private
|
|
* @param {Object} set The set to convert.
|
|
* @returns {Array} Returns the values.
|
|
*/
|
|
function setToArray(set) {
|
|
var index = -1,
|
|
result = Array(set.size);
|
|
|
|
set.forEach(function(value) {
|
|
result[++index] = value;
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts `set` to its value-value pairs.
|
|
*
|
|
* @private
|
|
* @param {Object} set The set to convert.
|
|
* @returns {Array} Returns the value-value pairs.
|
|
*/
|
|
function setToPairs(set) {
|
|
var index = -1,
|
|
result = Array(set.size);
|
|
|
|
set.forEach(function(value) {
|
|
result[++index] = [value, value];
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.indexOf` which performs strict equality
|
|
* comparisons of values, i.e. `===`.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} fromIndex The index to search from.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
*/
|
|
function strictIndexOf(array, value, fromIndex) {
|
|
var index = fromIndex - 1,
|
|
length = array.length;
|
|
|
|
while (++index < length) {
|
|
if (array[index] === value) {
|
|
return index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.lastIndexOf` which performs strict equality
|
|
* comparisons of values, i.e. `===`.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} fromIndex The index to search from.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
*/
|
|
function strictLastIndexOf(array, value, fromIndex) {
|
|
var index = fromIndex + 1;
|
|
while (index--) {
|
|
if (array[index] === value) {
|
|
return index;
|
|
}
|
|
}
|
|
return index;
|
|
}
|
|
|
|
/**
|
|
* Gets the number of symbols in `string`.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to inspect.
|
|
* @returns {number} Returns the string size.
|
|
*/
|
|
function stringSize(string) {
|
|
return hasUnicode(string)
|
|
? unicodeSize(string)
|
|
: asciiSize(string);
|
|
}
|
|
|
|
/**
|
|
* Converts `string` to an array.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to convert.
|
|
* @returns {Array} Returns the converted array.
|
|
*/
|
|
function stringToArray(string) {
|
|
return hasUnicode(string)
|
|
? unicodeToArray(string)
|
|
: asciiToArray(string);
|
|
}
|
|
|
|
/**
|
|
* Used by `_.unescape` to convert HTML entities to characters.
|
|
*
|
|
* @private
|
|
* @param {string} chr The matched character to unescape.
|
|
* @returns {string} Returns the unescaped character.
|
|
*/
|
|
var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
|
|
|
|
/**
|
|
* Gets the size of a Unicode `string`.
|
|
*
|
|
* @private
|
|
* @param {string} string The string inspect.
|
|
* @returns {number} Returns the string size.
|
|
*/
|
|
function unicodeSize(string) {
|
|
var result = reUnicode.lastIndex = 0;
|
|
while (reUnicode.test(string)) {
|
|
++result;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts a Unicode `string` to an array.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to convert.
|
|
* @returns {Array} Returns the converted array.
|
|
*/
|
|
function unicodeToArray(string) {
|
|
return string.match(reUnicode) || [];
|
|
}
|
|
|
|
/**
|
|
* Splits a Unicode `string` into an array of its words.
|
|
*
|
|
* @private
|
|
* @param {string} The string to inspect.
|
|
* @returns {Array} Returns the words of `string`.
|
|
*/
|
|
function unicodeWords(string) {
|
|
return string.match(reUnicodeWord) || [];
|
|
}
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Create a new pristine `lodash` function using the `context` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.1.0
|
|
* @category Util
|
|
* @param {Object} [context=root] The context object.
|
|
* @returns {Function} Returns a new `lodash` function.
|
|
* @example
|
|
*
|
|
* _.mixin({ 'foo': _.constant('foo') });
|
|
*
|
|
* var lodash = _.runInContext();
|
|
* lodash.mixin({ 'bar': lodash.constant('bar') });
|
|
*
|
|
* _.isFunction(_.foo);
|
|
* // => true
|
|
* _.isFunction(_.bar);
|
|
* // => false
|
|
*
|
|
* lodash.isFunction(lodash.foo);
|
|
* // => false
|
|
* lodash.isFunction(lodash.bar);
|
|
* // => true
|
|
*
|
|
* // Create a suped-up `defer` in Node.js.
|
|
* var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
|
|
*/
|
|
var runInContext = (function runInContext(context) {
|
|
context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
|
|
|
|
/** Built-in constructor references. */
|
|
var Array = context.Array,
|
|
Date = context.Date,
|
|
Error = context.Error,
|
|
Function = context.Function,
|
|
Math = context.Math,
|
|
Object = context.Object,
|
|
RegExp = context.RegExp,
|
|
String = context.String,
|
|
TypeError = context.TypeError;
|
|
|
|
/** Used for built-in method references. */
|
|
var arrayProto = Array.prototype,
|
|
funcProto = Function.prototype,
|
|
objectProto = Object.prototype;
|
|
|
|
/** Used to detect overreaching core-js shims. */
|
|
var coreJsData = context['__core-js_shared__'];
|
|
|
|
/** Used to resolve the decompiled source of functions. */
|
|
var funcToString = funcProto.toString;
|
|
|
|
/** Used to check objects for own properties. */
|
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
|
|
/** Used to generate unique IDs. */
|
|
var idCounter = 0;
|
|
|
|
/** Used to detect methods masquerading as native. */
|
|
var maskSrcKey = (function() {
|
|
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
}());
|
|
|
|
/**
|
|
* Used to resolve the
|
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
* of values.
|
|
*/
|
|
var nativeObjectToString = objectProto.toString;
|
|
|
|
/** Used to infer the `Object` constructor. */
|
|
var objectCtorString = funcToString.call(Object);
|
|
|
|
/** Used to restore the original `_` reference in `_.noConflict`. */
|
|
var oldDash = root._;
|
|
|
|
/** Used to detect if a method is native. */
|
|
var reIsNative = RegExp('^' +
|
|
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
|
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
);
|
|
|
|
/** Built-in value references. */
|
|
var Buffer = moduleExports ? context.Buffer : undefined,
|
|
Symbol = context.Symbol,
|
|
Uint8Array = context.Uint8Array,
|
|
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
|
|
getPrototype = overArg(Object.getPrototypeOf, Object),
|
|
objectCreate = Object.create,
|
|
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
|
splice = arrayProto.splice,
|
|
spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
|
|
symIterator = Symbol ? Symbol.iterator : undefined,
|
|
symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
|
|
var defineProperty = (function() {
|
|
try {
|
|
var func = getNative(Object, 'defineProperty');
|
|
func({}, '', {});
|
|
return func;
|
|
} catch (e) {}
|
|
}());
|
|
|
|
/** Mocked built-ins. */
|
|
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
|
|
ctxNow = Date && Date.now !== root.Date.now && Date.now,
|
|
ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
|
|
|
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
var nativeCeil = Math.ceil,
|
|
nativeFloor = Math.floor,
|
|
nativeGetSymbols = Object.getOwnPropertySymbols,
|
|
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
|
|
nativeIsFinite = context.isFinite,
|
|
nativeJoin = arrayProto.join,
|
|
nativeKeys = overArg(Object.keys, Object),
|
|
nativeMax = Math.max,
|
|
nativeMin = Math.min,
|
|
nativeNow = Date.now,
|
|
nativeParseInt = context.parseInt,
|
|
nativeRandom = Math.random,
|
|
nativeReverse = arrayProto.reverse;
|
|
|
|
/* Built-in method references that are verified to be native. */
|
|
var DataView = getNative(context, 'DataView'),
|
|
Map = getNative(context, 'Map'),
|
|
Promise = getNative(context, 'Promise'),
|
|
Set = getNative(context, 'Set'),
|
|
WeakMap = getNative(context, 'WeakMap'),
|
|
nativeCreate = getNative(Object, 'create');
|
|
|
|
/** Used to store function metadata. */
|
|
var metaMap = WeakMap && new WeakMap;
|
|
|
|
/** Used to lookup unminified function names. */
|
|
var realNames = {};
|
|
|
|
/** Used to detect maps, sets, and weakmaps. */
|
|
var dataViewCtorString = toSource(DataView),
|
|
mapCtorString = toSource(Map),
|
|
promiseCtorString = toSource(Promise),
|
|
setCtorString = toSource(Set),
|
|
weakMapCtorString = toSource(WeakMap);
|
|
|
|
/** Used to convert symbols to primitives and strings. */
|
|
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
|
|
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates a `lodash` object which wraps `value` to enable implicit method
|
|
* chain sequences. Methods that operate on and return arrays, collections,
|
|
* and functions can be chained together. Methods that retrieve a single value
|
|
* or may return a primitive value will automatically end the chain sequence
|
|
* and return the unwrapped value. Otherwise, the value must be unwrapped
|
|
* with `_#value`.
|
|
*
|
|
* Explicit chain sequences, which must be unwrapped with `_#value`, may be
|
|
* enabled using `_.chain`.
|
|
*
|
|
* The execution of chained methods is lazy, that is, it's deferred until
|
|
* `_#value` is implicitly or explicitly called.
|
|
*
|
|
* Lazy evaluation allows several methods to support shortcut fusion.
|
|
* Shortcut fusion is an optimization to merge iteratee calls; this avoids
|
|
* the creation of intermediate arrays and can greatly reduce the number of
|
|
* iteratee executions. Sections of a chain sequence qualify for shortcut
|
|
* fusion if the section is applied to an array and iteratees accept only
|
|
* one argument. The heuristic for whether a section qualifies for shortcut
|
|
* fusion is subject to change.
|
|
*
|
|
* Chaining is supported in custom builds as long as the `_#value` method is
|
|
* directly or indirectly included in the build.
|
|
*
|
|
* In addition to lodash methods, wrappers have `Array` and `String` methods.
|
|
*
|
|
* The wrapper `Array` methods are:
|
|
* `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
|
|
*
|
|
* The wrapper `String` methods are:
|
|
* `replace` and `split`
|
|
*
|
|
* The wrapper methods that support shortcut fusion are:
|
|
* `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
|
|
* `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
|
|
* `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
|
|
*
|
|
* The chainable wrapper methods are:
|
|
* `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
|
|
* `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
|
|
* `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
|
|
* `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
|
|
* `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
|
|
* `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
|
|
* `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
|
|
* `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
|
|
* `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
|
|
* `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
|
|
* `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
|
|
* `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
|
|
* `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
|
|
* `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
|
|
* `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
|
|
* `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
|
|
* `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
|
|
* `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
|
|
* `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
|
|
* `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
|
|
* `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
|
|
* `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
|
|
* `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
|
|
* `zipObject`, `zipObjectDeep`, and `zipWith`
|
|
*
|
|
* The wrapper methods that are **not** chainable by default are:
|
|
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
|
|
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
|
|
* `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
|
|
* `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
|
|
* `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
|
|
* `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
|
|
* `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
|
|
* `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
|
|
* `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
|
|
* `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
|
|
* `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
|
|
* `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
|
|
* `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
|
|
* `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
|
|
* `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
|
|
* `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
|
|
* `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
|
|
* `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
|
|
* `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
|
|
* `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
|
|
* `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
|
|
* `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
|
|
* `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
|
|
* `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
|
|
* `upperFirst`, `value`, and `words`
|
|
*
|
|
* @name _
|
|
* @constructor
|
|
* @category Seq
|
|
* @param {*} value The value to wrap in a `lodash` instance.
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* var wrapped = _([1, 2, 3]);
|
|
*
|
|
* // Returns an unwrapped value.
|
|
* wrapped.reduce(_.add);
|
|
* // => 6
|
|
*
|
|
* // Returns a wrapped value.
|
|
* var squares = wrapped.map(square);
|
|
*
|
|
* _.isArray(squares);
|
|
* // => false
|
|
*
|
|
* _.isArray(squares.value());
|
|
* // => true
|
|
*/
|
|
function lodash(value) {
|
|
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
|
|
if (value instanceof LodashWrapper) {
|
|
return value;
|
|
}
|
|
if (hasOwnProperty.call(value, '__wrapped__')) {
|
|
return wrapperClone(value);
|
|
}
|
|
}
|
|
return new LodashWrapper(value);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.create` without support for assigning
|
|
* properties to the created object.
|
|
*
|
|
* @private
|
|
* @param {Object} proto The object to inherit from.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
var baseCreate = (function() {
|
|
function object() {}
|
|
return function(proto) {
|
|
if (!isObject(proto)) {
|
|
return {};
|
|
}
|
|
if (objectCreate) {
|
|
return objectCreate(proto);
|
|
}
|
|
object.prototype = proto;
|
|
var result = new object;
|
|
object.prototype = undefined;
|
|
return result;
|
|
};
|
|
}());
|
|
|
|
/**
|
|
* The function whose prototype chain sequence wrappers inherit from.
|
|
*
|
|
* @private
|
|
*/
|
|
function baseLodash() {
|
|
// No operation performed.
|
|
}
|
|
|
|
/**
|
|
* The base constructor for creating `lodash` wrapper objects.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to wrap.
|
|
* @param {boolean} [chainAll] Enable explicit method chain sequences.
|
|
*/
|
|
function LodashWrapper(value, chainAll) {
|
|
this.__wrapped__ = value;
|
|
this.__actions__ = [];
|
|
this.__chain__ = !!chainAll;
|
|
this.__index__ = 0;
|
|
this.__values__ = undefined;
|
|
}
|
|
|
|
/**
|
|
* By default, the template delimiters used by lodash are like those in
|
|
* embedded Ruby (ERB) as well as ES2015 template strings. Change the
|
|
* following template settings to use alternative delimiters.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @type {Object}
|
|
*/
|
|
lodash.templateSettings = {
|
|
|
|
/**
|
|
* Used to detect `data` property values to be HTML-escaped.
|
|
*
|
|
* @memberOf _.templateSettings
|
|
* @type {RegExp}
|
|
*/
|
|
'escape': reEscape,
|
|
|
|
/**
|
|
* Used to detect code to be evaluated.
|
|
*
|
|
* @memberOf _.templateSettings
|
|
* @type {RegExp}
|
|
*/
|
|
'evaluate': reEvaluate,
|
|
|
|
/**
|
|
* Used to detect `data` property values to inject.
|
|
*
|
|
* @memberOf _.templateSettings
|
|
* @type {RegExp}
|
|
*/
|
|
'interpolate': reInterpolate,
|
|
|
|
/**
|
|
* Used to reference the data object in the template text.
|
|
*
|
|
* @memberOf _.templateSettings
|
|
* @type {string}
|
|
*/
|
|
'variable': '',
|
|
|
|
/**
|
|
* Used to import variables into the compiled template.
|
|
*
|
|
* @memberOf _.templateSettings
|
|
* @type {Object}
|
|
*/
|
|
'imports': {
|
|
|
|
/**
|
|
* A reference to the `lodash` function.
|
|
*
|
|
* @memberOf _.templateSettings.imports
|
|
* @type {Function}
|
|
*/
|
|
'_': lodash
|
|
}
|
|
};
|
|
|
|
// Ensure wrappers are instances of `baseLodash`.
|
|
lodash.prototype = baseLodash.prototype;
|
|
lodash.prototype.constructor = lodash;
|
|
|
|
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
|
|
LodashWrapper.prototype.constructor = LodashWrapper;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {*} value The value to wrap.
|
|
*/
|
|
function LazyWrapper(value) {
|
|
this.__wrapped__ = value;
|
|
this.__actions__ = [];
|
|
this.__dir__ = 1;
|
|
this.__filtered__ = false;
|
|
this.__iteratees__ = [];
|
|
this.__takeCount__ = MAX_ARRAY_LENGTH;
|
|
this.__views__ = [];
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of the lazy wrapper object.
|
|
*
|
|
* @private
|
|
* @name clone
|
|
* @memberOf LazyWrapper
|
|
* @returns {Object} Returns the cloned `LazyWrapper` object.
|
|
*/
|
|
function lazyClone() {
|
|
var result = new LazyWrapper(this.__wrapped__);
|
|
result.__actions__ = copyArray(this.__actions__);
|
|
result.__dir__ = this.__dir__;
|
|
result.__filtered__ = this.__filtered__;
|
|
result.__iteratees__ = copyArray(this.__iteratees__);
|
|
result.__takeCount__ = this.__takeCount__;
|
|
result.__views__ = copyArray(this.__views__);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Reverses the direction of lazy iteration.
|
|
*
|
|
* @private
|
|
* @name reverse
|
|
* @memberOf LazyWrapper
|
|
* @returns {Object} Returns the new reversed `LazyWrapper` object.
|
|
*/
|
|
function lazyReverse() {
|
|
if (this.__filtered__) {
|
|
var result = new LazyWrapper(this);
|
|
result.__dir__ = -1;
|
|
result.__filtered__ = true;
|
|
} else {
|
|
result = this.clone();
|
|
result.__dir__ *= -1;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Extracts the unwrapped value from its lazy wrapper.
|
|
*
|
|
* @private
|
|
* @name value
|
|
* @memberOf LazyWrapper
|
|
* @returns {*} Returns the unwrapped value.
|
|
*/
|
|
function lazyValue() {
|
|
var array = this.__wrapped__.value(),
|
|
dir = this.__dir__,
|
|
isArr = isArray(array),
|
|
isRight = dir < 0,
|
|
arrLength = isArr ? array.length : 0,
|
|
view = getView(0, arrLength, this.__views__),
|
|
start = view.start,
|
|
end = view.end,
|
|
length = end - start,
|
|
index = isRight ? end : (start - 1),
|
|
iteratees = this.__iteratees__,
|
|
iterLength = iteratees.length,
|
|
resIndex = 0,
|
|
takeCount = nativeMin(length, this.__takeCount__);
|
|
|
|
if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
|
|
return baseWrapperValue(array, this.__actions__);
|
|
}
|
|
var result = [];
|
|
|
|
outer:
|
|
while (length-- && resIndex < takeCount) {
|
|
index += dir;
|
|
|
|
var iterIndex = -1,
|
|
value = array[index];
|
|
|
|
while (++iterIndex < iterLength) {
|
|
var data = iteratees[iterIndex],
|
|
iteratee = data.iteratee,
|
|
type = data.type,
|
|
computed = iteratee(value);
|
|
|
|
if (type == LAZY_MAP_FLAG) {
|
|
value = computed;
|
|
} else if (!computed) {
|
|
if (type == LAZY_FILTER_FLAG) {
|
|
continue outer;
|
|
} else {
|
|
break outer;
|
|
}
|
|
}
|
|
}
|
|
result[resIndex++] = value;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Ensure `LazyWrapper` is an instance of `baseLodash`.
|
|
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
|
|
LazyWrapper.prototype.constructor = LazyWrapper;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates a hash object.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
*/
|
|
function Hash(entries) {
|
|
var index = -1,
|
|
length = entries == null ? 0 : entries.length;
|
|
|
|
this.clear();
|
|
while (++index < length) {
|
|
var entry = entries[index];
|
|
this.set(entry[0], entry[1]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Removes all key-value entries from the hash.
|
|
*
|
|
* @private
|
|
* @name clear
|
|
* @memberOf Hash
|
|
*/
|
|
function hashClear() {
|
|
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
this.size = 0;
|
|
}
|
|
|
|
/**
|
|
* Removes `key` and its value from the hash.
|
|
*
|
|
* @private
|
|
* @name delete
|
|
* @memberOf Hash
|
|
* @param {Object} hash The hash to modify.
|
|
* @param {string} key The key of the value to remove.
|
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
*/
|
|
function hashDelete(key) {
|
|
var result = this.has(key) && delete this.__data__[key];
|
|
this.size -= result ? 1 : 0;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Gets the hash value for `key`.
|
|
*
|
|
* @private
|
|
* @name get
|
|
* @memberOf Hash
|
|
* @param {string} key The key of the value to get.
|
|
* @returns {*} Returns the entry value.
|
|
*/
|
|
function hashGet(key) {
|
|
var data = this.__data__;
|
|
if (nativeCreate) {
|
|
var result = data[key];
|
|
return result === HASH_UNDEFINED ? undefined : result;
|
|
}
|
|
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
|
}
|
|
|
|
/**
|
|
* Checks if a hash value for `key` exists.
|
|
*
|
|
* @private
|
|
* @name has
|
|
* @memberOf Hash
|
|
* @param {string} key The key of the entry to check.
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
*/
|
|
function hashHas(key) {
|
|
var data = this.__data__;
|
|
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
|
}
|
|
|
|
/**
|
|
* Sets the hash `key` to `value`.
|
|
*
|
|
* @private
|
|
* @name set
|
|
* @memberOf Hash
|
|
* @param {string} key The key of the value to set.
|
|
* @param {*} value The value to set.
|
|
* @returns {Object} Returns the hash instance.
|
|
*/
|
|
function hashSet(key, value) {
|
|
var data = this.__data__;
|
|
this.size += this.has(key) ? 0 : 1;
|
|
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
return this;
|
|
}
|
|
|
|
// Add methods to `Hash`.
|
|
Hash.prototype.clear = hashClear;
|
|
Hash.prototype['delete'] = hashDelete;
|
|
Hash.prototype.get = hashGet;
|
|
Hash.prototype.has = hashHas;
|
|
Hash.prototype.set = hashSet;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates an list cache object.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
*/
|
|
function ListCache(entries) {
|
|
var index = -1,
|
|
length = entries == null ? 0 : entries.length;
|
|
|
|
this.clear();
|
|
while (++index < length) {
|
|
var entry = entries[index];
|
|
this.set(entry[0], entry[1]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Removes all key-value entries from the list cache.
|
|
*
|
|
* @private
|
|
* @name clear
|
|
* @memberOf ListCache
|
|
*/
|
|
function listCacheClear() {
|
|
this.__data__ = [];
|
|
this.size = 0;
|
|
}
|
|
|
|
/**
|
|
* Removes `key` and its value from the list cache.
|
|
*
|
|
* @private
|
|
* @name delete
|
|
* @memberOf ListCache
|
|
* @param {string} key The key of the value to remove.
|
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
*/
|
|
function listCacheDelete(key) {
|
|
var data = this.__data__,
|
|
index = assocIndexOf(data, key);
|
|
|
|
if (index < 0) {
|
|
return false;
|
|
}
|
|
var lastIndex = data.length - 1;
|
|
if (index == lastIndex) {
|
|
data.pop();
|
|
} else {
|
|
splice.call(data, index, 1);
|
|
}
|
|
--this.size;
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Gets the list cache value for `key`.
|
|
*
|
|
* @private
|
|
* @name get
|
|
* @memberOf ListCache
|
|
* @param {string} key The key of the value to get.
|
|
* @returns {*} Returns the entry value.
|
|
*/
|
|
function listCacheGet(key) {
|
|
var data = this.__data__,
|
|
index = assocIndexOf(data, key);
|
|
|
|
return index < 0 ? undefined : data[index][1];
|
|
}
|
|
|
|
/**
|
|
* Checks if a list cache value for `key` exists.
|
|
*
|
|
* @private
|
|
* @name has
|
|
* @memberOf ListCache
|
|
* @param {string} key The key of the entry to check.
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
*/
|
|
function listCacheHas(key) {
|
|
return assocIndexOf(this.__data__, key) > -1;
|
|
}
|
|
|
|
/**
|
|
* Sets the list cache `key` to `value`.
|
|
*
|
|
* @private
|
|
* @name set
|
|
* @memberOf ListCache
|
|
* @param {string} key The key of the value to set.
|
|
* @param {*} value The value to set.
|
|
* @returns {Object} Returns the list cache instance.
|
|
*/
|
|
function listCacheSet(key, value) {
|
|
var data = this.__data__,
|
|
index = assocIndexOf(data, key);
|
|
|
|
if (index < 0) {
|
|
++this.size;
|
|
data.push([key, value]);
|
|
} else {
|
|
data[index][1] = value;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
// Add methods to `ListCache`.
|
|
ListCache.prototype.clear = listCacheClear;
|
|
ListCache.prototype['delete'] = listCacheDelete;
|
|
ListCache.prototype.get = listCacheGet;
|
|
ListCache.prototype.has = listCacheHas;
|
|
ListCache.prototype.set = listCacheSet;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates a map cache object to store key-value pairs.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
*/
|
|
function MapCache(entries) {
|
|
var index = -1,
|
|
length = entries == null ? 0 : entries.length;
|
|
|
|
this.clear();
|
|
while (++index < length) {
|
|
var entry = entries[index];
|
|
this.set(entry[0], entry[1]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Removes all key-value entries from the map.
|
|
*
|
|
* @private
|
|
* @name clear
|
|
* @memberOf MapCache
|
|
*/
|
|
function mapCacheClear() {
|
|
this.size = 0;
|
|
this.__data__ = {
|
|
'hash': new Hash,
|
|
'map': new (Map || ListCache),
|
|
'string': new Hash
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Removes `key` and its value from the map.
|
|
*
|
|
* @private
|
|
* @name delete
|
|
* @memberOf MapCache
|
|
* @param {string} key The key of the value to remove.
|
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
*/
|
|
function mapCacheDelete(key) {
|
|
var result = getMapData(this, key)['delete'](key);
|
|
this.size -= result ? 1 : 0;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Gets the map value for `key`.
|
|
*
|
|
* @private
|
|
* @name get
|
|
* @memberOf MapCache
|
|
* @param {string} key The key of the value to get.
|
|
* @returns {*} Returns the entry value.
|
|
*/
|
|
function mapCacheGet(key) {
|
|
return getMapData(this, key).get(key);
|
|
}
|
|
|
|
/**
|
|
* Checks if a map value for `key` exists.
|
|
*
|
|
* @private
|
|
* @name has
|
|
* @memberOf MapCache
|
|
* @param {string} key The key of the entry to check.
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
*/
|
|
function mapCacheHas(key) {
|
|
return getMapData(this, key).has(key);
|
|
}
|
|
|
|
/**
|
|
* Sets the map `key` to `value`.
|
|
*
|
|
* @private
|
|
* @name set
|
|
* @memberOf MapCache
|
|
* @param {string} key The key of the value to set.
|
|
* @param {*} value The value to set.
|
|
* @returns {Object} Returns the map cache instance.
|
|
*/
|
|
function mapCacheSet(key, value) {
|
|
var data = getMapData(this, key),
|
|
size = data.size;
|
|
|
|
data.set(key, value);
|
|
this.size += data.size == size ? 0 : 1;
|
|
return this;
|
|
}
|
|
|
|
// Add methods to `MapCache`.
|
|
MapCache.prototype.clear = mapCacheClear;
|
|
MapCache.prototype['delete'] = mapCacheDelete;
|
|
MapCache.prototype.get = mapCacheGet;
|
|
MapCache.prototype.has = mapCacheHas;
|
|
MapCache.prototype.set = mapCacheSet;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
*
|
|
* Creates an array cache object to store unique values.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {Array} [values] The values to cache.
|
|
*/
|
|
function SetCache(values) {
|
|
var index = -1,
|
|
length = values == null ? 0 : values.length;
|
|
|
|
this.__data__ = new MapCache;
|
|
while (++index < length) {
|
|
this.add(values[index]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Adds `value` to the array cache.
|
|
*
|
|
* @private
|
|
* @name add
|
|
* @memberOf SetCache
|
|
* @alias push
|
|
* @param {*} value The value to cache.
|
|
* @returns {Object} Returns the cache instance.
|
|
*/
|
|
function setCacheAdd(value) {
|
|
this.__data__.set(value, HASH_UNDEFINED);
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is in the array cache.
|
|
*
|
|
* @private
|
|
* @name has
|
|
* @memberOf SetCache
|
|
* @param {*} value The value to search for.
|
|
* @returns {number} Returns `true` if `value` is found, else `false`.
|
|
*/
|
|
function setCacheHas(value) {
|
|
return this.__data__.has(value);
|
|
}
|
|
|
|
// Add methods to `SetCache`.
|
|
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
SetCache.prototype.has = setCacheHas;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates a stack cache object to store key-value pairs.
|
|
*
|
|
* @private
|
|
* @constructor
|
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
*/
|
|
function Stack(entries) {
|
|
var data = this.__data__ = new ListCache(entries);
|
|
this.size = data.size;
|
|
}
|
|
|
|
/**
|
|
* Removes all key-value entries from the stack.
|
|
*
|
|
* @private
|
|
* @name clear
|
|
* @memberOf Stack
|
|
*/
|
|
function stackClear() {
|
|
this.__data__ = new ListCache;
|
|
this.size = 0;
|
|
}
|
|
|
|
/**
|
|
* Removes `key` and its value from the stack.
|
|
*
|
|
* @private
|
|
* @name delete
|
|
* @memberOf Stack
|
|
* @param {string} key The key of the value to remove.
|
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
*/
|
|
function stackDelete(key) {
|
|
var data = this.__data__,
|
|
result = data['delete'](key);
|
|
|
|
this.size = data.size;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Gets the stack value for `key`.
|
|
*
|
|
* @private
|
|
* @name get
|
|
* @memberOf Stack
|
|
* @param {string} key The key of the value to get.
|
|
* @returns {*} Returns the entry value.
|
|
*/
|
|
function stackGet(key) {
|
|
return this.__data__.get(key);
|
|
}
|
|
|
|
/**
|
|
* Checks if a stack value for `key` exists.
|
|
*
|
|
* @private
|
|
* @name has
|
|
* @memberOf Stack
|
|
* @param {string} key The key of the entry to check.
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
*/
|
|
function stackHas(key) {
|
|
return this.__data__.has(key);
|
|
}
|
|
|
|
/**
|
|
* Sets the stack `key` to `value`.
|
|
*
|
|
* @private
|
|
* @name set
|
|
* @memberOf Stack
|
|
* @param {string} key The key of the value to set.
|
|
* @param {*} value The value to set.
|
|
* @returns {Object} Returns the stack cache instance.
|
|
*/
|
|
function stackSet(key, value) {
|
|
var data = this.__data__;
|
|
if (data instanceof ListCache) {
|
|
var pairs = data.__data__;
|
|
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
pairs.push([key, value]);
|
|
this.size = ++data.size;
|
|
return this;
|
|
}
|
|
data = this.__data__ = new MapCache(pairs);
|
|
}
|
|
data.set(key, value);
|
|
this.size = data.size;
|
|
return this;
|
|
}
|
|
|
|
// Add methods to `Stack`.
|
|
Stack.prototype.clear = stackClear;
|
|
Stack.prototype['delete'] = stackDelete;
|
|
Stack.prototype.get = stackGet;
|
|
Stack.prototype.has = stackHas;
|
|
Stack.prototype.set = stackSet;
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates an array of the enumerable property names of the array-like `value`.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to query.
|
|
* @param {boolean} inherited Specify returning inherited property names.
|
|
* @returns {Array} Returns the array of property names.
|
|
*/
|
|
function arrayLikeKeys(value, inherited) {
|
|
var isArr = isArray(value),
|
|
isArg = !isArr && isArguments(value),
|
|
isBuff = !isArr && !isArg && isBuffer(value),
|
|
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
|
skipIndexes = isArr || isArg || isBuff || isType,
|
|
result = skipIndexes ? baseTimes(value.length, String) : [],
|
|
length = result.length;
|
|
|
|
for (var key in value) {
|
|
if ((inherited || hasOwnProperty.call(value, key)) &&
|
|
!(skipIndexes && (
|
|
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
key == 'length' ||
|
|
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
// Skip index properties.
|
|
isIndex(key, length)
|
|
))) {
|
|
result.push(key);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.sample` for arrays.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to sample.
|
|
* @returns {*} Returns the random element.
|
|
*/
|
|
function arraySample(array) {
|
|
var length = array.length;
|
|
return length ? array[baseRandom(0, length - 1)] : undefined;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.sampleSize` for arrays.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to sample.
|
|
* @param {number} n The number of elements to sample.
|
|
* @returns {Array} Returns the random elements.
|
|
*/
|
|
function arraySampleSize(array, n) {
|
|
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.shuffle` for arrays.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to shuffle.
|
|
* @returns {Array} Returns the new shuffled array.
|
|
*/
|
|
function arrayShuffle(array) {
|
|
return shuffleSelf(copyArray(array));
|
|
}
|
|
|
|
/**
|
|
* This function is like `assignValue` except that it doesn't assign
|
|
* `undefined` values.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to modify.
|
|
* @param {string} key The key of the property to assign.
|
|
* @param {*} value The value to assign.
|
|
*/
|
|
function assignMergeValue(object, key, value) {
|
|
if ((value !== undefined && !eq(object[key], value)) ||
|
|
(value === undefined && !(key in object))) {
|
|
baseAssignValue(object, key, value);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to modify.
|
|
* @param {string} key The key of the property to assign.
|
|
* @param {*} value The value to assign.
|
|
*/
|
|
function assignValue(object, key, value) {
|
|
var objValue = object[key];
|
|
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
|
(value === undefined && !(key in object))) {
|
|
baseAssignValue(object, key, value);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} key The key to search for.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
*/
|
|
function assocIndexOf(array, key) {
|
|
var length = array.length;
|
|
while (length--) {
|
|
if (eq(array[length][0], key)) {
|
|
return length;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* Aggregates elements of `collection` on `accumulator` with keys transformed
|
|
* by `iteratee` and values set by `setter`.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} setter The function to set `accumulator` values.
|
|
* @param {Function} iteratee The iteratee to transform keys.
|
|
* @param {Object} accumulator The initial aggregated object.
|
|
* @returns {Function} Returns `accumulator`.
|
|
*/
|
|
function baseAggregator(collection, setter, iteratee, accumulator) {
|
|
baseEach(collection, function(value, key, collection) {
|
|
setter(accumulator, value, iteratee(value), collection);
|
|
});
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.assign` without support for multiple sources
|
|
* or `customizer` functions.
|
|
*
|
|
* @private
|
|
* @param {Object} object The destination object.
|
|
* @param {Object} source The source object.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseAssign(object, source) {
|
|
return object && copyObject(source, keys(source), object);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.assignIn` without support for multiple sources
|
|
* or `customizer` functions.
|
|
*
|
|
* @private
|
|
* @param {Object} object The destination object.
|
|
* @param {Object} source The source object.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseAssignIn(object, source) {
|
|
return object && copyObject(source, keysIn(source), object);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
* value checks.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to modify.
|
|
* @param {string} key The key of the property to assign.
|
|
* @param {*} value The value to assign.
|
|
*/
|
|
function baseAssignValue(object, key, value) {
|
|
if (key == '__proto__' && defineProperty) {
|
|
defineProperty(object, key, {
|
|
'configurable': true,
|
|
'enumerable': true,
|
|
'value': value,
|
|
'writable': true
|
|
});
|
|
} else {
|
|
object[key] = value;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.at` without support for individual paths.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {string[]} paths The property paths to pick.
|
|
* @returns {Array} Returns the picked elements.
|
|
*/
|
|
function baseAt(object, paths) {
|
|
var index = -1,
|
|
length = paths.length,
|
|
result = Array(length),
|
|
skip = object == null;
|
|
|
|
while (++index < length) {
|
|
result[index] = skip ? undefined : get(object, paths[index]);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.clamp` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {number} number The number to clamp.
|
|
* @param {number} [lower] The lower bound.
|
|
* @param {number} upper The upper bound.
|
|
* @returns {number} Returns the clamped number.
|
|
*/
|
|
function baseClamp(number, lower, upper) {
|
|
if (number === number) {
|
|
if (upper !== undefined) {
|
|
number = number <= upper ? number : upper;
|
|
}
|
|
if (lower !== undefined) {
|
|
number = number >= lower ? number : lower;
|
|
}
|
|
}
|
|
return number;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
|
|
* traversed objects.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to clone.
|
|
* @param {boolean} bitmask The bitmask flags.
|
|
* 1 - Deep clone
|
|
* 2 - Flatten inherited properties
|
|
* 4 - Clone symbols
|
|
* @param {Function} [customizer] The function to customize cloning.
|
|
* @param {string} [key] The key of `value`.
|
|
* @param {Object} [object] The parent object of `value`.
|
|
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
|
* @returns {*} Returns the cloned value.
|
|
*/
|
|
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
var result,
|
|
isDeep = bitmask & CLONE_DEEP_FLAG,
|
|
isFlat = bitmask & CLONE_FLAT_FLAG,
|
|
isFull = bitmask & CLONE_SYMBOLS_FLAG;
|
|
|
|
if (customizer) {
|
|
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
}
|
|
if (result !== undefined) {
|
|
return result;
|
|
}
|
|
if (!isObject(value)) {
|
|
return value;
|
|
}
|
|
var isArr = isArray(value);
|
|
if (isArr) {
|
|
result = initCloneArray(value);
|
|
if (!isDeep) {
|
|
return copyArray(value, result);
|
|
}
|
|
} else {
|
|
var tag = getTag(value),
|
|
isFunc = tag == funcTag || tag == genTag;
|
|
|
|
if (isBuffer(value)) {
|
|
return cloneBuffer(value, isDeep);
|
|
}
|
|
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
|
|
result = (isFlat || isFunc) ? {} : initCloneObject(value);
|
|
if (!isDeep) {
|
|
return isFlat
|
|
? copySymbolsIn(value, baseAssignIn(result, value))
|
|
: copySymbols(value, baseAssign(result, value));
|
|
}
|
|
} else {
|
|
if (!cloneableTags[tag]) {
|
|
return object ? value : {};
|
|
}
|
|
result = initCloneByTag(value, tag, baseClone, isDeep);
|
|
}
|
|
}
|
|
// Check for circular references and return its corresponding clone.
|
|
stack || (stack = new Stack);
|
|
var stacked = stack.get(value);
|
|
if (stacked) {
|
|
return stacked;
|
|
}
|
|
stack.set(value, result);
|
|
|
|
var keysFunc = isFull
|
|
? (isFlat ? getAllKeysIn : getAllKeys)
|
|
: (isFlat ? keysIn : keys);
|
|
|
|
var props = isArr ? undefined : keysFunc(value);
|
|
arrayEach(props || value, function(subValue, key) {
|
|
if (props) {
|
|
key = subValue;
|
|
subValue = value[key];
|
|
}
|
|
// Recursively populate clone (susceptible to call stack limits).
|
|
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.conforms` which doesn't clone `source`.
|
|
*
|
|
* @private
|
|
* @param {Object} source The object of property predicates to conform to.
|
|
* @returns {Function} Returns the new spec function.
|
|
*/
|
|
function baseConforms(source) {
|
|
var props = keys(source);
|
|
return function(object) {
|
|
return baseConformsTo(object, source, props);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.conformsTo` which accepts `props` to check.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Object} source The object of property predicates to conform to.
|
|
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
|
|
*/
|
|
function baseConformsTo(object, source, props) {
|
|
var length = props.length;
|
|
if (object == null) {
|
|
return !length;
|
|
}
|
|
object = Object(object);
|
|
while (length--) {
|
|
var key = props[length],
|
|
predicate = source[key],
|
|
value = object[key];
|
|
|
|
if ((value === undefined && !(key in object)) || !predicate(value)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.delay` and `_.defer` which accepts `args`
|
|
* to provide to `func`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to delay.
|
|
* @param {number} wait The number of milliseconds to delay invocation.
|
|
* @param {Array} args The arguments to provide to `func`.
|
|
* @returns {number|Object} Returns the timer id or timeout object.
|
|
*/
|
|
function baseDelay(func, wait, args) {
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
return setTimeout(function() { func.apply(undefined, args); }, wait);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of methods like `_.difference` without support
|
|
* for excluding multiple arrays or iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Array} values The values to exclude.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
*/
|
|
function baseDifference(array, values, iteratee, comparator) {
|
|
var index = -1,
|
|
includes = arrayIncludes,
|
|
isCommon = true,
|
|
length = array.length,
|
|
result = [],
|
|
valuesLength = values.length;
|
|
|
|
if (!length) {
|
|
return result;
|
|
}
|
|
if (iteratee) {
|
|
values = arrayMap(values, baseUnary(iteratee));
|
|
}
|
|
if (comparator) {
|
|
includes = arrayIncludesWith;
|
|
isCommon = false;
|
|
}
|
|
else if (values.length >= LARGE_ARRAY_SIZE) {
|
|
includes = cacheHas;
|
|
isCommon = false;
|
|
values = new SetCache(values);
|
|
}
|
|
outer:
|
|
while (++index < length) {
|
|
var value = array[index],
|
|
computed = iteratee == null ? value : iteratee(value);
|
|
|
|
value = (comparator || value !== 0) ? value : 0;
|
|
if (isCommon && computed === computed) {
|
|
var valuesIndex = valuesLength;
|
|
while (valuesIndex--) {
|
|
if (values[valuesIndex] === computed) {
|
|
continue outer;
|
|
}
|
|
}
|
|
result.push(value);
|
|
}
|
|
else if (!includes(values, computed, comparator)) {
|
|
result.push(value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.forEach` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array|Object} Returns `collection`.
|
|
*/
|
|
var baseEach = createBaseEach(baseForOwn);
|
|
|
|
/**
|
|
* The base implementation of `_.forEachRight` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array|Object} Returns `collection`.
|
|
*/
|
|
var baseEachRight = createBaseEach(baseForOwnRight, true);
|
|
|
|
/**
|
|
* The base implementation of `_.every` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
|
* else `false`
|
|
*/
|
|
function baseEvery(collection, predicate) {
|
|
var result = true;
|
|
baseEach(collection, function(value, index, collection) {
|
|
result = !!predicate(value, index, collection);
|
|
return result;
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of methods like `_.max` and `_.min` which accepts a
|
|
* `comparator` to determine the extremum value.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} iteratee The iteratee invoked per iteration.
|
|
* @param {Function} comparator The comparator used to compare values.
|
|
* @returns {*} Returns the extremum value.
|
|
*/
|
|
function baseExtremum(array, iteratee, comparator) {
|
|
var index = -1,
|
|
length = array.length;
|
|
|
|
while (++index < length) {
|
|
var value = array[index],
|
|
current = iteratee(value);
|
|
|
|
if (current != null && (computed === undefined
|
|
? (current === current && !isSymbol(current))
|
|
: comparator(current, computed)
|
|
)) {
|
|
var computed = current,
|
|
result = value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.fill` without an iteratee call guard.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to fill.
|
|
* @param {*} value The value to fill `array` with.
|
|
* @param {number} [start=0] The start position.
|
|
* @param {number} [end=array.length] The end position.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function baseFill(array, value, start, end) {
|
|
var length = array.length;
|
|
|
|
start = toInteger(start);
|
|
if (start < 0) {
|
|
start = -start > length ? 0 : (length + start);
|
|
}
|
|
end = (end === undefined || end > length) ? length : toInteger(end);
|
|
if (end < 0) {
|
|
end += length;
|
|
}
|
|
end = start > end ? 0 : toLength(end);
|
|
while (start < end) {
|
|
array[start++] = value;
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.filter` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {Array} Returns the new filtered array.
|
|
*/
|
|
function baseFilter(collection, predicate) {
|
|
var result = [];
|
|
baseEach(collection, function(value, index, collection) {
|
|
if (predicate(value, index, collection)) {
|
|
result.push(value);
|
|
}
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.flatten` with support for restricting flattening.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to flatten.
|
|
* @param {number} depth The maximum recursion depth.
|
|
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
* @param {Array} [result=[]] The initial result value.
|
|
* @returns {Array} Returns the new flattened array.
|
|
*/
|
|
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
var index = -1,
|
|
length = array.length;
|
|
|
|
predicate || (predicate = isFlattenable);
|
|
result || (result = []);
|
|
|
|
while (++index < length) {
|
|
var value = array[index];
|
|
if (depth > 0 && predicate(value)) {
|
|
if (depth > 1) {
|
|
// Recursively flatten arrays (susceptible to call stack limits).
|
|
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
} else {
|
|
arrayPush(result, value);
|
|
}
|
|
} else if (!isStrict) {
|
|
result[result.length] = value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `baseForOwn` which iterates over `object`
|
|
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
var baseFor = createBaseFor();
|
|
|
|
/**
|
|
* This function is like `baseFor` except that it iterates over properties
|
|
* in the opposite order.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
var baseForRight = createBaseFor(true);
|
|
|
|
/**
|
|
* The base implementation of `_.forOwn` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseForOwn(object, iteratee) {
|
|
return object && baseFor(object, iteratee, keys);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.forOwnRight` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseForOwnRight(object, iteratee) {
|
|
return object && baseForRight(object, iteratee, keys);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.functions` which creates an array of
|
|
* `object` function property names filtered from `props`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Array} props The property names to filter.
|
|
* @returns {Array} Returns the function names.
|
|
*/
|
|
function baseFunctions(object, props) {
|
|
return arrayFilter(props, function(key) {
|
|
return isFunction(object[key]);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.get` without support for default values.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path of the property to get.
|
|
* @returns {*} Returns the resolved value.
|
|
*/
|
|
function baseGet(object, path) {
|
|
path = castPath(path, object);
|
|
|
|
var index = 0,
|
|
length = path.length;
|
|
|
|
while (object != null && index < length) {
|
|
object = object[toKey(path[index++])];
|
|
}
|
|
return (index && index == length) ? object : undefined;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
* symbols of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
* @returns {Array} Returns the array of property names and symbols.
|
|
*/
|
|
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
var result = keysFunc(object);
|
|
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to query.
|
|
* @returns {string} Returns the `toStringTag`.
|
|
*/
|
|
function baseGetTag(value) {
|
|
if (value == null) {
|
|
return value === undefined ? undefinedTag : nullTag;
|
|
}
|
|
return (symToStringTag && symToStringTag in Object(value))
|
|
? getRawTag(value)
|
|
: objectToString(value);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.gt` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is greater than `other`,
|
|
* else `false`.
|
|
*/
|
|
function baseGt(value, other) {
|
|
return value > other;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.has` without support for deep paths.
|
|
*
|
|
* @private
|
|
* @param {Object} [object] The object to query.
|
|
* @param {Array|string} key The key to check.
|
|
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
*/
|
|
function baseHas(object, key) {
|
|
return object != null && hasOwnProperty.call(object, key);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.hasIn` without support for deep paths.
|
|
*
|
|
* @private
|
|
* @param {Object} [object] The object to query.
|
|
* @param {Array|string} key The key to check.
|
|
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
*/
|
|
function baseHasIn(object, key) {
|
|
return object != null && key in Object(object);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.inRange` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {number} number The number to check.
|
|
* @param {number} start The start of the range.
|
|
* @param {number} end The end of the range.
|
|
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
|
|
*/
|
|
function baseInRange(number, start, end) {
|
|
return number >= nativeMin(start, end) && number < nativeMax(start, end);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of methods like `_.intersection`, without support
|
|
* for iteratee shorthands, that accepts an array of arrays to inspect.
|
|
*
|
|
* @private
|
|
* @param {Array} arrays The arrays to inspect.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of shared values.
|
|
*/
|
|
function baseIntersection(arrays, iteratee, comparator) {
|
|
var includes = comparator ? arrayIncludesWith : arrayIncludes,
|
|
length = arrays[0].length,
|
|
othLength = arrays.length,
|
|
othIndex = othLength,
|
|
caches = Array(othLength),
|
|
maxLength = Infinity,
|
|
result = [];
|
|
|
|
while (othIndex--) {
|
|
var array = arrays[othIndex];
|
|
if (othIndex && iteratee) {
|
|
array = arrayMap(array, baseUnary(iteratee));
|
|
}
|
|
maxLength = nativeMin(array.length, maxLength);
|
|
caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
|
|
? new SetCache(othIndex && array)
|
|
: undefined;
|
|
}
|
|
array = arrays[0];
|
|
|
|
var index = -1,
|
|
seen = caches[0];
|
|
|
|
outer:
|
|
while (++index < length && result.length < maxLength) {
|
|
var value = array[index],
|
|
computed = iteratee ? iteratee(value) : value;
|
|
|
|
value = (comparator || value !== 0) ? value : 0;
|
|
if (!(seen
|
|
? cacheHas(seen, computed)
|
|
: includes(result, computed, comparator)
|
|
)) {
|
|
othIndex = othLength;
|
|
while (--othIndex) {
|
|
var cache = caches[othIndex];
|
|
if (!(cache
|
|
? cacheHas(cache, computed)
|
|
: includes(arrays[othIndex], computed, comparator))
|
|
) {
|
|
continue outer;
|
|
}
|
|
}
|
|
if (seen) {
|
|
seen.push(computed);
|
|
}
|
|
result.push(value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.invert` and `_.invertBy` which inverts
|
|
* `object` with values transformed by `iteratee` and set by `setter`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} setter The function to set `accumulator` values.
|
|
* @param {Function} iteratee The iteratee to transform values.
|
|
* @param {Object} accumulator The initial inverted object.
|
|
* @returns {Function} Returns `accumulator`.
|
|
*/
|
|
function baseInverter(object, setter, iteratee, accumulator) {
|
|
baseForOwn(object, function(value, key, object) {
|
|
setter(accumulator, iteratee(value), key, object);
|
|
});
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.invoke` without support for individual
|
|
* method arguments.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path of the method to invoke.
|
|
* @param {Array} args The arguments to invoke the method with.
|
|
* @returns {*} Returns the result of the invoked method.
|
|
*/
|
|
function baseInvoke(object, path, args) {
|
|
path = castPath(path, object);
|
|
object = parent(object, path);
|
|
var func = object == null ? object : object[toKey(last(path))];
|
|
return func == null ? undefined : apply(func, object, args);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isArguments`.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
*/
|
|
function baseIsArguments(value) {
|
|
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isArrayBuffer` without Node.js optimizations.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
|
|
*/
|
|
function baseIsArrayBuffer(value) {
|
|
return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isDate` without Node.js optimizations.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
|
|
*/
|
|
function baseIsDate(value) {
|
|
return isObjectLike(value) && baseGetTag(value) == dateTag;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isEqual` which supports partial comparisons
|
|
* and tracks traversed objects.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @param {boolean} bitmask The bitmask flags.
|
|
* 1 - Unordered comparison
|
|
* 2 - Partial comparison
|
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
*/
|
|
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
if (value === other) {
|
|
return true;
|
|
}
|
|
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
|
return value !== value && other !== other;
|
|
}
|
|
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
|
* deep comparisons and tracks traversed objects enabling objects with circular
|
|
* references to be compared.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to compare.
|
|
* @param {Object} other The other object to compare.
|
|
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
* @param {Function} customizer The function to customize comparisons.
|
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
*/
|
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
var objIsArr = isArray(object),
|
|
othIsArr = isArray(other),
|
|
objTag = objIsArr ? arrayTag : getTag(object),
|
|
othTag = othIsArr ? arrayTag : getTag(other);
|
|
|
|
objTag = objTag == argsTag ? objectTag : objTag;
|
|
othTag = othTag == argsTag ? objectTag : othTag;
|
|
|
|
var objIsObj = objTag == objectTag,
|
|
othIsObj = othTag == objectTag,
|
|
isSameTag = objTag == othTag;
|
|
|
|
if (isSameTag && isBuffer(object)) {
|
|
if (!isBuffer(other)) {
|
|
return false;
|
|
}
|
|
objIsArr = true;
|
|
objIsObj = false;
|
|
}
|
|
if (isSameTag && !objIsObj) {
|
|
stack || (stack = new Stack);
|
|
return (objIsArr || isTypedArray(object))
|
|
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
}
|
|
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
|
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
|
|
|
if (objIsWrapped || othIsWrapped) {
|
|
var objUnwrapped = objIsWrapped ? object.value() : object,
|
|
othUnwrapped = othIsWrapped ? other.value() : other;
|
|
|
|
stack || (stack = new Stack);
|
|
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
}
|
|
}
|
|
if (!isSameTag) {
|
|
return false;
|
|
}
|
|
stack || (stack = new Stack);
|
|
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isMap` without Node.js optimizations.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
*/
|
|
function baseIsMap(value) {
|
|
return isObjectLike(value) && getTag(value) == mapTag;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Object} source The object of property values to match.
|
|
* @param {Array} matchData The property names, values, and compare flags to match.
|
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
*/
|
|
function baseIsMatch(object, source, matchData, customizer) {
|
|
var index = matchData.length,
|
|
length = index,
|
|
noCustomizer = !customizer;
|
|
|
|
if (object == null) {
|
|
return !length;
|
|
}
|
|
object = Object(object);
|
|
while (index--) {
|
|
var data = matchData[index];
|
|
if ((noCustomizer && data[2])
|
|
? data[1] !== object[data[0]]
|
|
: !(data[0] in object)
|
|
) {
|
|
return false;
|
|
}
|
|
}
|
|
while (++index < length) {
|
|
data = matchData[index];
|
|
var key = data[0],
|
|
objValue = object[key],
|
|
srcValue = data[1];
|
|
|
|
if (noCustomizer && data[2]) {
|
|
if (objValue === undefined && !(key in object)) {
|
|
return false;
|
|
}
|
|
} else {
|
|
var stack = new Stack;
|
|
if (customizer) {
|
|
var result = customizer(objValue, srcValue, key, object, source, stack);
|
|
}
|
|
if (!(result === undefined
|
|
? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
|
|
: result
|
|
)) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isNative` without bad shim checks.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
* else `false`.
|
|
*/
|
|
function baseIsNative(value) {
|
|
if (!isObject(value) || isMasked(value)) {
|
|
return false;
|
|
}
|
|
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
return pattern.test(toSource(value));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isRegExp` without Node.js optimizations.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
|
|
*/
|
|
function baseIsRegExp(value) {
|
|
return isObjectLike(value) && baseGetTag(value) == regexpTag;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isSet` without Node.js optimizations.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
*/
|
|
function baseIsSet(value) {
|
|
return isObjectLike(value) && getTag(value) == setTag;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
*/
|
|
function baseIsTypedArray(value) {
|
|
return isObjectLike(value) &&
|
|
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.iteratee`.
|
|
*
|
|
* @private
|
|
* @param {*} [value=_.identity] The value to convert to an iteratee.
|
|
* @returns {Function} Returns the iteratee.
|
|
*/
|
|
function baseIteratee(value) {
|
|
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
|
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
|
if (typeof value == 'function') {
|
|
return value;
|
|
}
|
|
if (value == null) {
|
|
return identity;
|
|
}
|
|
if (typeof value == 'object') {
|
|
return isArray(value)
|
|
? baseMatchesProperty(value[0], value[1])
|
|
: baseMatches(value);
|
|
}
|
|
return property(value);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names.
|
|
*/
|
|
function baseKeys(object) {
|
|
if (!isPrototype(object)) {
|
|
return nativeKeys(object);
|
|
}
|
|
var result = [];
|
|
for (var key in Object(object)) {
|
|
if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
|
result.push(key);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names.
|
|
*/
|
|
function baseKeysIn(object) {
|
|
if (!isObject(object)) {
|
|
return nativeKeysIn(object);
|
|
}
|
|
var isProto = isPrototype(object),
|
|
result = [];
|
|
|
|
for (var key in object) {
|
|
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
|
result.push(key);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.lt` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is less than `other`,
|
|
* else `false`.
|
|
*/
|
|
function baseLt(value, other) {
|
|
return value < other;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.map` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns the new mapped array.
|
|
*/
|
|
function baseMap(collection, iteratee) {
|
|
var index = -1,
|
|
result = isArrayLike(collection) ? Array(collection.length) : [];
|
|
|
|
baseEach(collection, function(value, key, collection) {
|
|
result[++index] = iteratee(value, key, collection);
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.matches` which doesn't clone `source`.
|
|
*
|
|
* @private
|
|
* @param {Object} source The object of property values to match.
|
|
* @returns {Function} Returns the new spec function.
|
|
*/
|
|
function baseMatches(source) {
|
|
var matchData = getMatchData(source);
|
|
if (matchData.length == 1 && matchData[0][2]) {
|
|
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
|
}
|
|
return function(object) {
|
|
return object === source || baseIsMatch(object, source, matchData);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
|
*
|
|
* @private
|
|
* @param {string} path The path of the property to get.
|
|
* @param {*} srcValue The value to match.
|
|
* @returns {Function} Returns the new spec function.
|
|
*/
|
|
function baseMatchesProperty(path, srcValue) {
|
|
if (isKey(path) && isStrictComparable(srcValue)) {
|
|
return matchesStrictComparable(toKey(path), srcValue);
|
|
}
|
|
return function(object) {
|
|
var objValue = get(object, path);
|
|
return (objValue === undefined && objValue === srcValue)
|
|
? hasIn(object, path)
|
|
: baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.merge` without support for multiple sources.
|
|
*
|
|
* @private
|
|
* @param {Object} object The destination object.
|
|
* @param {Object} source The source object.
|
|
* @param {number} srcIndex The index of `source`.
|
|
* @param {Function} [customizer] The function to customize merged values.
|
|
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
* counterparts.
|
|
*/
|
|
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
if (object === source) {
|
|
return;
|
|
}
|
|
baseFor(source, function(srcValue, key) {
|
|
if (isObject(srcValue)) {
|
|
stack || (stack = new Stack);
|
|
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
|
}
|
|
else {
|
|
var newValue = customizer
|
|
? customizer(object[key], srcValue, (key + ''), object, source, stack)
|
|
: undefined;
|
|
|
|
if (newValue === undefined) {
|
|
newValue = srcValue;
|
|
}
|
|
assignMergeValue(object, key, newValue);
|
|
}
|
|
}, keysIn);
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseMerge` for arrays and objects which performs
|
|
* deep merges and tracks traversed objects enabling objects with circular
|
|
* references to be merged.
|
|
*
|
|
* @private
|
|
* @param {Object} object The destination object.
|
|
* @param {Object} source The source object.
|
|
* @param {string} key The key of the value to merge.
|
|
* @param {number} srcIndex The index of `source`.
|
|
* @param {Function} mergeFunc The function to merge values.
|
|
* @param {Function} [customizer] The function to customize assigned values.
|
|
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
* counterparts.
|
|
*/
|
|
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
|
var objValue = object[key],
|
|
srcValue = source[key],
|
|
stacked = stack.get(srcValue);
|
|
|
|
if (stacked) {
|
|
assignMergeValue(object, key, stacked);
|
|
return;
|
|
}
|
|
var newValue = customizer
|
|
? customizer(objValue, srcValue, (key + ''), object, source, stack)
|
|
: undefined;
|
|
|
|
var isCommon = newValue === undefined;
|
|
|
|
if (isCommon) {
|
|
var isArr = isArray(srcValue),
|
|
isBuff = !isArr && isBuffer(srcValue),
|
|
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
|
|
|
newValue = srcValue;
|
|
if (isArr || isBuff || isTyped) {
|
|
if (isArray(objValue)) {
|
|
newValue = objValue;
|
|
}
|
|
else if (isArrayLikeObject(objValue)) {
|
|
newValue = copyArray(objValue);
|
|
}
|
|
else if (isBuff) {
|
|
isCommon = false;
|
|
newValue = cloneBuffer(srcValue, true);
|
|
}
|
|
else if (isTyped) {
|
|
isCommon = false;
|
|
newValue = cloneTypedArray(srcValue, true);
|
|
}
|
|
else {
|
|
newValue = [];
|
|
}
|
|
}
|
|
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
|
newValue = objValue;
|
|
if (isArguments(objValue)) {
|
|
newValue = toPlainObject(objValue);
|
|
}
|
|
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
|
|
newValue = initCloneObject(srcValue);
|
|
}
|
|
}
|
|
else {
|
|
isCommon = false;
|
|
}
|
|
}
|
|
if (isCommon) {
|
|
// Recursively merge objects and arrays (susceptible to call stack limits).
|
|
stack.set(srcValue, newValue);
|
|
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
|
stack['delete'](srcValue);
|
|
}
|
|
assignMergeValue(object, key, newValue);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.nth` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to query.
|
|
* @param {number} n The index of the element to return.
|
|
* @returns {*} Returns the nth element of `array`.
|
|
*/
|
|
function baseNth(array, n) {
|
|
var length = array.length;
|
|
if (!length) {
|
|
return;
|
|
}
|
|
n += n < 0 ? length : 0;
|
|
return isIndex(n, length) ? array[n] : undefined;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.orderBy` without param guards.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
|
* @param {string[]} orders The sort orders of `iteratees`.
|
|
* @returns {Array} Returns the new sorted array.
|
|
*/
|
|
function baseOrderBy(collection, iteratees, orders) {
|
|
var index = -1;
|
|
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
|
|
|
|
var result = baseMap(collection, function(value, key, collection) {
|
|
var criteria = arrayMap(iteratees, function(iteratee) {
|
|
return iteratee(value);
|
|
});
|
|
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
|
});
|
|
|
|
return baseSortBy(result, function(object, other) {
|
|
return compareMultiple(object, other, orders);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.pick` without support for individual
|
|
* property identifiers.
|
|
*
|
|
* @private
|
|
* @param {Object} object The source object.
|
|
* @param {string[]} paths The property paths to pick.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
function basePick(object, paths) {
|
|
return basePickBy(object, paths, function(value, path) {
|
|
return hasIn(object, path);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.pickBy` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Object} object The source object.
|
|
* @param {string[]} paths The property paths to pick.
|
|
* @param {Function} predicate The function invoked per property.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
function basePickBy(object, paths, predicate) {
|
|
var index = -1,
|
|
length = paths.length,
|
|
result = {};
|
|
|
|
while (++index < length) {
|
|
var path = paths[index],
|
|
value = baseGet(object, path);
|
|
|
|
if (predicate(value, path)) {
|
|
baseSet(result, castPath(path, object), value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseProperty` which supports deep paths.
|
|
*
|
|
* @private
|
|
* @param {Array|string} path The path of the property to get.
|
|
* @returns {Function} Returns the new accessor function.
|
|
*/
|
|
function basePropertyDeep(path) {
|
|
return function(object) {
|
|
return baseGet(object, path);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.pullAllBy` without support for iteratee
|
|
* shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to modify.
|
|
* @param {Array} values The values to remove.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function basePullAll(array, values, iteratee, comparator) {
|
|
var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
|
|
index = -1,
|
|
length = values.length,
|
|
seen = array;
|
|
|
|
if (array === values) {
|
|
values = copyArray(values);
|
|
}
|
|
if (iteratee) {
|
|
seen = arrayMap(array, baseUnary(iteratee));
|
|
}
|
|
while (++index < length) {
|
|
var fromIndex = 0,
|
|
value = values[index],
|
|
computed = iteratee ? iteratee(value) : value;
|
|
|
|
while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
|
|
if (seen !== array) {
|
|
splice.call(seen, fromIndex, 1);
|
|
}
|
|
splice.call(array, fromIndex, 1);
|
|
}
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.pullAt` without support for individual
|
|
* indexes or capturing the removed elements.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to modify.
|
|
* @param {number[]} indexes The indexes of elements to remove.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function basePullAt(array, indexes) {
|
|
var length = array ? indexes.length : 0,
|
|
lastIndex = length - 1;
|
|
|
|
while (length--) {
|
|
var index = indexes[length];
|
|
if (length == lastIndex || index !== previous) {
|
|
var previous = index;
|
|
if (isIndex(index)) {
|
|
splice.call(array, index, 1);
|
|
} else {
|
|
baseUnset(array, index);
|
|
}
|
|
}
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.random` without support for returning
|
|
* floating-point numbers.
|
|
*
|
|
* @private
|
|
* @param {number} lower The lower bound.
|
|
* @param {number} upper The upper bound.
|
|
* @returns {number} Returns the random number.
|
|
*/
|
|
function baseRandom(lower, upper) {
|
|
return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.range` and `_.rangeRight` which doesn't
|
|
* coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {number} start The start of the range.
|
|
* @param {number} end The end of the range.
|
|
* @param {number} step The value to increment or decrement by.
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Array} Returns the range of numbers.
|
|
*/
|
|
function baseRange(start, end, step, fromRight) {
|
|
var index = -1,
|
|
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
|
|
result = Array(length);
|
|
|
|
while (length--) {
|
|
result[fromRight ? length : ++index] = start;
|
|
start += step;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.repeat` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to repeat.
|
|
* @param {number} n The number of times to repeat the string.
|
|
* @returns {string} Returns the repeated string.
|
|
*/
|
|
function baseRepeat(string, n) {
|
|
var result = '';
|
|
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
|
|
return result;
|
|
}
|
|
// Leverage the exponentiation by squaring algorithm for a faster repeat.
|
|
// See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
|
|
do {
|
|
if (n % 2) {
|
|
result += string;
|
|
}
|
|
n = nativeFloor(n / 2);
|
|
if (n) {
|
|
string += string;
|
|
}
|
|
} while (n);
|
|
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to apply a rest parameter to.
|
|
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
* @returns {Function} Returns the new function.
|
|
*/
|
|
function baseRest(func, start) {
|
|
return setToString(overRest(func, start, identity), func + '');
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sample`.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to sample.
|
|
* @returns {*} Returns the random element.
|
|
*/
|
|
function baseSample(collection) {
|
|
return arraySample(values(collection));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sampleSize` without param guards.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to sample.
|
|
* @param {number} n The number of elements to sample.
|
|
* @returns {Array} Returns the random elements.
|
|
*/
|
|
function baseSampleSize(collection, n) {
|
|
var array = values(collection);
|
|
return shuffleSelf(array, baseClamp(n, 0, array.length));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.set`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to set.
|
|
* @param {*} value The value to set.
|
|
* @param {Function} [customizer] The function to customize path creation.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseSet(object, path, value, customizer) {
|
|
if (!isObject(object)) {
|
|
return object;
|
|
}
|
|
path = castPath(path, object);
|
|
|
|
var index = -1,
|
|
length = path.length,
|
|
lastIndex = length - 1,
|
|
nested = object;
|
|
|
|
while (nested != null && ++index < length) {
|
|
var key = toKey(path[index]),
|
|
newValue = value;
|
|
|
|
if (index != lastIndex) {
|
|
var objValue = nested[key];
|
|
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
|
if (newValue === undefined) {
|
|
newValue = isObject(objValue)
|
|
? objValue
|
|
: (isIndex(path[index + 1]) ? [] : {});
|
|
}
|
|
}
|
|
assignValue(nested, key, newValue);
|
|
nested = nested[key];
|
|
}
|
|
return object;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `setData` without support for hot loop shorting.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to associate metadata with.
|
|
* @param {*} data The metadata.
|
|
* @returns {Function} Returns `func`.
|
|
*/
|
|
var baseSetData = !metaMap ? identity : function(func, data) {
|
|
metaMap.set(func, data);
|
|
return func;
|
|
};
|
|
|
|
/**
|
|
* The base implementation of `setToString` without support for hot loop shorting.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to modify.
|
|
* @param {Function} string The `toString` result.
|
|
* @returns {Function} Returns `func`.
|
|
*/
|
|
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
|
return defineProperty(func, 'toString', {
|
|
'configurable': true,
|
|
'enumerable': false,
|
|
'value': constant(string),
|
|
'writable': true
|
|
});
|
|
};
|
|
|
|
/**
|
|
* The base implementation of `_.shuffle`.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to shuffle.
|
|
* @returns {Array} Returns the new shuffled array.
|
|
*/
|
|
function baseShuffle(collection) {
|
|
return shuffleSelf(values(collection));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.slice` without an iteratee call guard.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to slice.
|
|
* @param {number} [start=0] The start position.
|
|
* @param {number} [end=array.length] The end position.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
*/
|
|
function baseSlice(array, start, end) {
|
|
var index = -1,
|
|
length = array.length;
|
|
|
|
if (start < 0) {
|
|
start = -start > length ? 0 : (length + start);
|
|
}
|
|
end = end > length ? length : end;
|
|
if (end < 0) {
|
|
end += length;
|
|
}
|
|
length = start > end ? 0 : ((end - start) >>> 0);
|
|
start >>>= 0;
|
|
|
|
var result = Array(length);
|
|
while (++index < length) {
|
|
result[index] = array[index + start];
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.some` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
|
* else `false`.
|
|
*/
|
|
function baseSome(collection, predicate) {
|
|
var result;
|
|
|
|
baseEach(collection, function(value, index, collection) {
|
|
result = predicate(value, index, collection);
|
|
return !result;
|
|
});
|
|
return !!result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
|
|
* performs a binary search of `array` to determine the index at which `value`
|
|
* should be inserted into `array` in order to maintain its sort order.
|
|
*
|
|
* @private
|
|
* @param {Array} array The sorted array to inspect.
|
|
* @param {*} value The value to evaluate.
|
|
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
* into `array`.
|
|
*/
|
|
function baseSortedIndex(array, value, retHighest) {
|
|
var low = 0,
|
|
high = array == null ? low : array.length;
|
|
|
|
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
|
|
while (low < high) {
|
|
var mid = (low + high) >>> 1,
|
|
computed = array[mid];
|
|
|
|
if (computed !== null && !isSymbol(computed) &&
|
|
(retHighest ? (computed <= value) : (computed < value))) {
|
|
low = mid + 1;
|
|
} else {
|
|
high = mid;
|
|
}
|
|
}
|
|
return high;
|
|
}
|
|
return baseSortedIndexBy(array, value, identity, retHighest);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
|
|
* which invokes `iteratee` for `value` and each element of `array` to compute
|
|
* their sort ranking. The iteratee is invoked with one argument; (value).
|
|
*
|
|
* @private
|
|
* @param {Array} array The sorted array to inspect.
|
|
* @param {*} value The value to evaluate.
|
|
* @param {Function} iteratee The iteratee invoked per element.
|
|
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
* into `array`.
|
|
*/
|
|
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
|
value = iteratee(value);
|
|
|
|
var low = 0,
|
|
high = array == null ? 0 : array.length,
|
|
valIsNaN = value !== value,
|
|
valIsNull = value === null,
|
|
valIsSymbol = isSymbol(value),
|
|
valIsUndefined = value === undefined;
|
|
|
|
while (low < high) {
|
|
var mid = nativeFloor((low + high) / 2),
|
|
computed = iteratee(array[mid]),
|
|
othIsDefined = computed !== undefined,
|
|
othIsNull = computed === null,
|
|
othIsReflexive = computed === computed,
|
|
othIsSymbol = isSymbol(computed);
|
|
|
|
if (valIsNaN) {
|
|
var setLow = retHighest || othIsReflexive;
|
|
} else if (valIsUndefined) {
|
|
setLow = othIsReflexive && (retHighest || othIsDefined);
|
|
} else if (valIsNull) {
|
|
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
|
|
} else if (valIsSymbol) {
|
|
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
|
|
} else if (othIsNull || othIsSymbol) {
|
|
setLow = false;
|
|
} else {
|
|
setLow = retHighest ? (computed <= value) : (computed < value);
|
|
}
|
|
if (setLow) {
|
|
low = mid + 1;
|
|
} else {
|
|
high = mid;
|
|
}
|
|
}
|
|
return nativeMin(high, MAX_ARRAY_INDEX);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
|
|
* support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
*/
|
|
function baseSortedUniq(array, iteratee) {
|
|
var index = -1,
|
|
length = array.length,
|
|
resIndex = 0,
|
|
result = [];
|
|
|
|
while (++index < length) {
|
|
var value = array[index],
|
|
computed = iteratee ? iteratee(value) : value;
|
|
|
|
if (!index || !eq(computed, seen)) {
|
|
var seen = computed;
|
|
result[resIndex++] = value === 0 ? 0 : value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.toNumber` which doesn't ensure correct
|
|
* conversions of binary, hexadecimal, or octal string values.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to process.
|
|
* @returns {number} Returns the number.
|
|
*/
|
|
function baseToNumber(value) {
|
|
if (typeof value == 'number') {
|
|
return value;
|
|
}
|
|
if (isSymbol(value)) {
|
|
return NAN;
|
|
}
|
|
return +value;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.toString` which doesn't convert nullish
|
|
* values to empty strings.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to process.
|
|
* @returns {string} Returns the string.
|
|
*/
|
|
function baseToString(value) {
|
|
// Exit early for strings to avoid a performance hit in some environments.
|
|
if (typeof value == 'string') {
|
|
return value;
|
|
}
|
|
if (isArray(value)) {
|
|
// Recursively convert values (susceptible to call stack limits).
|
|
return arrayMap(value, baseToString) + '';
|
|
}
|
|
if (isSymbol(value)) {
|
|
return symbolToString ? symbolToString.call(value) : '';
|
|
}
|
|
var result = (value + '');
|
|
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
*/
|
|
function baseUniq(array, iteratee, comparator) {
|
|
var index = -1,
|
|
includes = arrayIncludes,
|
|
length = array.length,
|
|
isCommon = true,
|
|
result = [],
|
|
seen = result;
|
|
|
|
if (comparator) {
|
|
isCommon = false;
|
|
includes = arrayIncludesWith;
|
|
}
|
|
else if (length >= LARGE_ARRAY_SIZE) {
|
|
var set = iteratee ? null : createSet(array);
|
|
if (set) {
|
|
return setToArray(set);
|
|
}
|
|
isCommon = false;
|
|
includes = cacheHas;
|
|
seen = new SetCache;
|
|
}
|
|
else {
|
|
seen = iteratee ? [] : result;
|
|
}
|
|
outer:
|
|
while (++index < length) {
|
|
var value = array[index],
|
|
computed = iteratee ? iteratee(value) : value;
|
|
|
|
value = (comparator || value !== 0) ? value : 0;
|
|
if (isCommon && computed === computed) {
|
|
var seenIndex = seen.length;
|
|
while (seenIndex--) {
|
|
if (seen[seenIndex] === computed) {
|
|
continue outer;
|
|
}
|
|
}
|
|
if (iteratee) {
|
|
seen.push(computed);
|
|
}
|
|
result.push(value);
|
|
}
|
|
else if (!includes(seen, computed, comparator)) {
|
|
if (seen !== result) {
|
|
seen.push(computed);
|
|
}
|
|
result.push(value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.unset`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The property path to unset.
|
|
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
|
*/
|
|
function baseUnset(object, path) {
|
|
path = castPath(path, object);
|
|
object = parent(object, path);
|
|
return object == null || delete object[toKey(last(path))];
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `_.update`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to update.
|
|
* @param {Function} updater The function to produce the updated value.
|
|
* @param {Function} [customizer] The function to customize path creation.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseUpdate(object, path, updater, customizer) {
|
|
return baseSet(object, path, updater(baseGet(object, path)), customizer);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of methods like `_.dropWhile` and `_.takeWhile`
|
|
* without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to query.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @param {boolean} [isDrop] Specify dropping elements instead of taking them.
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
*/
|
|
function baseWhile(array, predicate, isDrop, fromRight) {
|
|
var length = array.length,
|
|
index = fromRight ? length : -1;
|
|
|
|
while ((fromRight ? index-- : ++index < length) &&
|
|
predicate(array[index], index, array)) {}
|
|
|
|
return isDrop
|
|
? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
|
|
: baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
|
|
}
|
|
|
|
/**
|
|
* The base implementation of `wrapperValue` which returns the result of
|
|
* performing a sequence of actions on the unwrapped `value`, where each
|
|
* successive action is supplied the return value of the previous.
|
|
*
|
|
* @private
|
|
* @param {*} value The unwrapped value.
|
|
* @param {Array} actions Actions to perform to resolve the unwrapped value.
|
|
* @returns {*} Returns the resolved value.
|
|
*/
|
|
function baseWrapperValue(value, actions) {
|
|
var result = value;
|
|
if (result instanceof LazyWrapper) {
|
|
result = result.value();
|
|
}
|
|
return arrayReduce(actions, function(result, action) {
|
|
return action.func.apply(action.thisArg, arrayPush([result], action.args));
|
|
}, result);
|
|
}
|
|
|
|
/**
|
|
* The base implementation of methods like `_.xor`, without support for
|
|
* iteratee shorthands, that accepts an array of arrays to inspect.
|
|
*
|
|
* @private
|
|
* @param {Array} arrays The arrays to inspect.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of values.
|
|
*/
|
|
function baseXor(arrays, iteratee, comparator) {
|
|
var length = arrays.length;
|
|
if (length < 2) {
|
|
return length ? baseUniq(arrays[0]) : [];
|
|
}
|
|
var index = -1,
|
|
result = Array(length);
|
|
|
|
while (++index < length) {
|
|
var array = arrays[index],
|
|
othIndex = -1;
|
|
|
|
while (++othIndex < length) {
|
|
if (othIndex != index) {
|
|
result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
|
|
}
|
|
}
|
|
}
|
|
return baseUniq(baseFlatten(result, 1), iteratee, comparator);
|
|
}
|
|
|
|
/**
|
|
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
|
|
*
|
|
* @private
|
|
* @param {Array} props The property identifiers.
|
|
* @param {Array} values The property values.
|
|
* @param {Function} assignFunc The function to assign values.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
function baseZipObject(props, values, assignFunc) {
|
|
var index = -1,
|
|
length = props.length,
|
|
valsLength = values.length,
|
|
result = {};
|
|
|
|
while (++index < length) {
|
|
var value = index < valsLength ? values[index] : undefined;
|
|
assignFunc(result, props[index], value);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Casts `value` to an empty array if it's not an array like object.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to inspect.
|
|
* @returns {Array|Object} Returns the cast array-like object.
|
|
*/
|
|
function castArrayLikeObject(value) {
|
|
return isArrayLikeObject(value) ? value : [];
|
|
}
|
|
|
|
/**
|
|
* Casts `value` to `identity` if it's not a function.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to inspect.
|
|
* @returns {Function} Returns cast function.
|
|
*/
|
|
function castFunction(value) {
|
|
return typeof value == 'function' ? value : identity;
|
|
}
|
|
|
|
/**
|
|
* Casts `value` to a path array if it's not one.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to inspect.
|
|
* @param {Object} [object] The object to query keys on.
|
|
* @returns {Array} Returns the cast property path array.
|
|
*/
|
|
function castPath(value, object) {
|
|
if (isArray(value)) {
|
|
return value;
|
|
}
|
|
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
}
|
|
|
|
/**
|
|
* A `baseRest` alias which can be replaced with `identity` by module
|
|
* replacement plugins.
|
|
*
|
|
* @private
|
|
* @type {Function}
|
|
* @param {Function} func The function to apply a rest parameter to.
|
|
* @returns {Function} Returns the new function.
|
|
*/
|
|
var castRest = baseRest;
|
|
|
|
/**
|
|
* Casts `array` to a slice if it's needed.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to inspect.
|
|
* @param {number} start The start position.
|
|
* @param {number} [end=array.length] The end position.
|
|
* @returns {Array} Returns the cast slice.
|
|
*/
|
|
function castSlice(array, start, end) {
|
|
var length = array.length;
|
|
end = end === undefined ? length : end;
|
|
return (!start && end >= length) ? array : baseSlice(array, start, end);
|
|
}
|
|
|
|
/**
|
|
* A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
|
|
*
|
|
* @private
|
|
* @param {number|Object} id The timer id or timeout object of the timer to clear.
|
|
*/
|
|
var clearTimeout = ctxClearTimeout || function(id) {
|
|
return root.clearTimeout(id);
|
|
};
|
|
|
|
/**
|
|
* Creates a clone of `buffer`.
|
|
*
|
|
* @private
|
|
* @param {Buffer} buffer The buffer to clone.
|
|
* @param {boolean} [isDeep] Specify a deep clone.
|
|
* @returns {Buffer} Returns the cloned buffer.
|
|
*/
|
|
function cloneBuffer(buffer, isDeep) {
|
|
if (isDeep) {
|
|
return buffer.slice();
|
|
}
|
|
var length = buffer.length,
|
|
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
|
|
buffer.copy(result);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of `arrayBuffer`.
|
|
*
|
|
* @private
|
|
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
|
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
*/
|
|
function cloneArrayBuffer(arrayBuffer) {
|
|
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of `dataView`.
|
|
*
|
|
* @private
|
|
* @param {Object} dataView The data view to clone.
|
|
* @param {boolean} [isDeep] Specify a deep clone.
|
|
* @returns {Object} Returns the cloned data view.
|
|
*/
|
|
function cloneDataView(dataView, isDeep) {
|
|
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
|
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of `map`.
|
|
*
|
|
* @private
|
|
* @param {Object} map The map to clone.
|
|
* @param {Function} cloneFunc The function to clone values.
|
|
* @param {boolean} [isDeep] Specify a deep clone.
|
|
* @returns {Object} Returns the cloned map.
|
|
*/
|
|
function cloneMap(map, isDeep, cloneFunc) {
|
|
var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
|
|
return arrayReduce(array, addMapEntry, new map.constructor);
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of `regexp`.
|
|
*
|
|
* @private
|
|
* @param {Object} regexp The regexp to clone.
|
|
* @returns {Object} Returns the cloned regexp.
|
|
*/
|
|
function cloneRegExp(regexp) {
|
|
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
result.lastIndex = regexp.lastIndex;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of `set`.
|
|
*
|
|
* @private
|
|
* @param {Object} set The set to clone.
|
|
* @param {Function} cloneFunc The function to clone values.
|
|
* @param {boolean} [isDeep] Specify a deep clone.
|
|
* @returns {Object} Returns the cloned set.
|
|
*/
|
|
function cloneSet(set, isDeep, cloneFunc) {
|
|
var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
|
|
return arrayReduce(array, addSetEntry, new set.constructor);
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of the `symbol` object.
|
|
*
|
|
* @private
|
|
* @param {Object} symbol The symbol object to clone.
|
|
* @returns {Object} Returns the cloned symbol object.
|
|
*/
|
|
function cloneSymbol(symbol) {
|
|
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of `typedArray`.
|
|
*
|
|
* @private
|
|
* @param {Object} typedArray The typed array to clone.
|
|
* @param {boolean} [isDeep] Specify a deep clone.
|
|
* @returns {Object} Returns the cloned typed array.
|
|
*/
|
|
function cloneTypedArray(typedArray, isDeep) {
|
|
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
}
|
|
|
|
/**
|
|
* Compares values to sort them in ascending order.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {number} Returns the sort order indicator for `value`.
|
|
*/
|
|
function compareAscending(value, other) {
|
|
if (value !== other) {
|
|
var valIsDefined = value !== undefined,
|
|
valIsNull = value === null,
|
|
valIsReflexive = value === value,
|
|
valIsSymbol = isSymbol(value);
|
|
|
|
var othIsDefined = other !== undefined,
|
|
othIsNull = other === null,
|
|
othIsReflexive = other === other,
|
|
othIsSymbol = isSymbol(other);
|
|
|
|
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
|
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
|
(valIsNull && othIsDefined && othIsReflexive) ||
|
|
(!valIsDefined && othIsReflexive) ||
|
|
!valIsReflexive) {
|
|
return 1;
|
|
}
|
|
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
|
|
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
|
|
(othIsNull && valIsDefined && valIsReflexive) ||
|
|
(!othIsDefined && valIsReflexive) ||
|
|
!othIsReflexive) {
|
|
return -1;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* Used by `_.orderBy` to compare multiple properties of a value to another
|
|
* and stable sort them.
|
|
*
|
|
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
|
|
* specify an order of "desc" for descending or "asc" for ascending sort order
|
|
* of corresponding values.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to compare.
|
|
* @param {Object} other The other object to compare.
|
|
* @param {boolean[]|string[]} orders The order to sort by for each property.
|
|
* @returns {number} Returns the sort order indicator for `object`.
|
|
*/
|
|
function compareMultiple(object, other, orders) {
|
|
var index = -1,
|
|
objCriteria = object.criteria,
|
|
othCriteria = other.criteria,
|
|
length = objCriteria.length,
|
|
ordersLength = orders.length;
|
|
|
|
while (++index < length) {
|
|
var result = compareAscending(objCriteria[index], othCriteria[index]);
|
|
if (result) {
|
|
if (index >= ordersLength) {
|
|
return result;
|
|
}
|
|
var order = orders[index];
|
|
return result * (order == 'desc' ? -1 : 1);
|
|
}
|
|
}
|
|
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
|
// that causes it, under certain circumstances, to provide the same value for
|
|
// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
|
|
// for more details.
|
|
//
|
|
// This also ensures a stable sort in V8 and other engines.
|
|
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
|
|
return object.index - other.index;
|
|
}
|
|
|
|
/**
|
|
* Creates an array that is the composition of partially applied arguments,
|
|
* placeholders, and provided arguments into a single array of arguments.
|
|
*
|
|
* @private
|
|
* @param {Array} args The provided arguments.
|
|
* @param {Array} partials The arguments to prepend to those provided.
|
|
* @param {Array} holders The `partials` placeholder indexes.
|
|
* @params {boolean} [isCurried] Specify composing for a curried function.
|
|
* @returns {Array} Returns the new array of composed arguments.
|
|
*/
|
|
function composeArgs(args, partials, holders, isCurried) {
|
|
var argsIndex = -1,
|
|
argsLength = args.length,
|
|
holdersLength = holders.length,
|
|
leftIndex = -1,
|
|
leftLength = partials.length,
|
|
rangeLength = nativeMax(argsLength - holdersLength, 0),
|
|
result = Array(leftLength + rangeLength),
|
|
isUncurried = !isCurried;
|
|
|
|
while (++leftIndex < leftLength) {
|
|
result[leftIndex] = partials[leftIndex];
|
|
}
|
|
while (++argsIndex < holdersLength) {
|
|
if (isUncurried || argsIndex < argsLength) {
|
|
result[holders[argsIndex]] = args[argsIndex];
|
|
}
|
|
}
|
|
while (rangeLength--) {
|
|
result[leftIndex++] = args[argsIndex++];
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* This function is like `composeArgs` except that the arguments composition
|
|
* is tailored for `_.partialRight`.
|
|
*
|
|
* @private
|
|
* @param {Array} args The provided arguments.
|
|
* @param {Array} partials The arguments to append to those provided.
|
|
* @param {Array} holders The `partials` placeholder indexes.
|
|
* @params {boolean} [isCurried] Specify composing for a curried function.
|
|
* @returns {Array} Returns the new array of composed arguments.
|
|
*/
|
|
function composeArgsRight(args, partials, holders, isCurried) {
|
|
var argsIndex = -1,
|
|
argsLength = args.length,
|
|
holdersIndex = -1,
|
|
holdersLength = holders.length,
|
|
rightIndex = -1,
|
|
rightLength = partials.length,
|
|
rangeLength = nativeMax(argsLength - holdersLength, 0),
|
|
result = Array(rangeLength + rightLength),
|
|
isUncurried = !isCurried;
|
|
|
|
while (++argsIndex < rangeLength) {
|
|
result[argsIndex] = args[argsIndex];
|
|
}
|
|
var offset = argsIndex;
|
|
while (++rightIndex < rightLength) {
|
|
result[offset + rightIndex] = partials[rightIndex];
|
|
}
|
|
while (++holdersIndex < holdersLength) {
|
|
if (isUncurried || argsIndex < argsLength) {
|
|
result[offset + holders[holdersIndex]] = args[argsIndex++];
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Copies the values of `source` to `array`.
|
|
*
|
|
* @private
|
|
* @param {Array} source The array to copy values from.
|
|
* @param {Array} [array=[]] The array to copy values to.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function copyArray(source, array) {
|
|
var index = -1,
|
|
length = source.length;
|
|
|
|
array || (array = Array(length));
|
|
while (++index < length) {
|
|
array[index] = source[index];
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* Copies properties of `source` to `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} source The object to copy properties from.
|
|
* @param {Array} props The property identifiers to copy.
|
|
* @param {Object} [object={}] The object to copy properties to.
|
|
* @param {Function} [customizer] The function to customize copied values.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function copyObject(source, props, object, customizer) {
|
|
var isNew = !object;
|
|
object || (object = {});
|
|
|
|
var index = -1,
|
|
length = props.length;
|
|
|
|
while (++index < length) {
|
|
var key = props[index];
|
|
|
|
var newValue = customizer
|
|
? customizer(object[key], source[key], key, object, source)
|
|
: undefined;
|
|
|
|
if (newValue === undefined) {
|
|
newValue = source[key];
|
|
}
|
|
if (isNew) {
|
|
baseAssignValue(object, key, newValue);
|
|
} else {
|
|
assignValue(object, key, newValue);
|
|
}
|
|
}
|
|
return object;
|
|
}
|
|
|
|
/**
|
|
* Copies own symbols of `source` to `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} source The object to copy symbols from.
|
|
* @param {Object} [object={}] The object to copy symbols to.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function copySymbols(source, object) {
|
|
return copyObject(source, getSymbols(source), object);
|
|
}
|
|
|
|
/**
|
|
* Copies own and inherited symbols of `source` to `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} source The object to copy symbols from.
|
|
* @param {Object} [object={}] The object to copy symbols to.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function copySymbolsIn(source, object) {
|
|
return copyObject(source, getSymbolsIn(source), object);
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.groupBy`.
|
|
*
|
|
* @private
|
|
* @param {Function} setter The function to set accumulator values.
|
|
* @param {Function} [initializer] The accumulator object initializer.
|
|
* @returns {Function} Returns the new aggregator function.
|
|
*/
|
|
function createAggregator(setter, initializer) {
|
|
return function(collection, iteratee) {
|
|
var func = isArray(collection) ? arrayAggregator : baseAggregator,
|
|
accumulator = initializer ? initializer() : {};
|
|
|
|
return func(collection, setter, getIteratee(iteratee, 2), accumulator);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.assign`.
|
|
*
|
|
* @private
|
|
* @param {Function} assigner The function to assign values.
|
|
* @returns {Function} Returns the new assigner function.
|
|
*/
|
|
function createAssigner(assigner) {
|
|
return baseRest(function(object, sources) {
|
|
var index = -1,
|
|
length = sources.length,
|
|
customizer = length > 1 ? sources[length - 1] : undefined,
|
|
guard = length > 2 ? sources[2] : undefined;
|
|
|
|
customizer = (assigner.length > 3 && typeof customizer == 'function')
|
|
? (length--, customizer)
|
|
: undefined;
|
|
|
|
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
|
customizer = length < 3 ? undefined : customizer;
|
|
length = 1;
|
|
}
|
|
object = Object(object);
|
|
while (++index < length) {
|
|
var source = sources[index];
|
|
if (source) {
|
|
assigner(object, source, index, customizer);
|
|
}
|
|
}
|
|
return object;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a `baseEach` or `baseEachRight` function.
|
|
*
|
|
* @private
|
|
* @param {Function} eachFunc The function to iterate over a collection.
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Function} Returns the new base function.
|
|
*/
|
|
function createBaseEach(eachFunc, fromRight) {
|
|
return function(collection, iteratee) {
|
|
if (collection == null) {
|
|
return collection;
|
|
}
|
|
if (!isArrayLike(collection)) {
|
|
return eachFunc(collection, iteratee);
|
|
}
|
|
var length = collection.length,
|
|
index = fromRight ? length : -1,
|
|
iterable = Object(collection);
|
|
|
|
while ((fromRight ? index-- : ++index < length)) {
|
|
if (iteratee(iterable[index], index, iterable) === false) {
|
|
break;
|
|
}
|
|
}
|
|
return collection;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
|
*
|
|
* @private
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Function} Returns the new base function.
|
|
*/
|
|
function createBaseFor(fromRight) {
|
|
return function(object, iteratee, keysFunc) {
|
|
var index = -1,
|
|
iterable = Object(object),
|
|
props = keysFunc(object),
|
|
length = props.length;
|
|
|
|
while (length--) {
|
|
var key = props[fromRight ? length : ++index];
|
|
if (iteratee(iterable[key], key, iterable) === false) {
|
|
break;
|
|
}
|
|
}
|
|
return object;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that wraps `func` to invoke it with the optional `this`
|
|
* binding of `thisArg`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to wrap.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @param {*} [thisArg] The `this` binding of `func`.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createBind(func, bitmask, thisArg) {
|
|
var isBind = bitmask & WRAP_BIND_FLAG,
|
|
Ctor = createCtor(func);
|
|
|
|
function wrapper() {
|
|
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
|
return fn.apply(isBind ? thisArg : this, arguments);
|
|
}
|
|
return wrapper;
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.lowerFirst`.
|
|
*
|
|
* @private
|
|
* @param {string} methodName The name of the `String` case method to use.
|
|
* @returns {Function} Returns the new case function.
|
|
*/
|
|
function createCaseFirst(methodName) {
|
|
return function(string) {
|
|
string = toString(string);
|
|
|
|
var strSymbols = hasUnicode(string)
|
|
? stringToArray(string)
|
|
: undefined;
|
|
|
|
var chr = strSymbols
|
|
? strSymbols[0]
|
|
: string.charAt(0);
|
|
|
|
var trailing = strSymbols
|
|
? castSlice(strSymbols, 1).join('')
|
|
: string.slice(1);
|
|
|
|
return chr[methodName]() + trailing;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.camelCase`.
|
|
*
|
|
* @private
|
|
* @param {Function} callback The function to combine each word.
|
|
* @returns {Function} Returns the new compounder function.
|
|
*/
|
|
function createCompounder(callback) {
|
|
return function(string) {
|
|
return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that produces an instance of `Ctor` regardless of
|
|
* whether it was invoked as part of a `new` expression or by `call` or `apply`.
|
|
*
|
|
* @private
|
|
* @param {Function} Ctor The constructor to wrap.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createCtor(Ctor) {
|
|
return function() {
|
|
// Use a `switch` statement to work with class constructors. See
|
|
// http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
|
|
// for more details.
|
|
var args = arguments;
|
|
switch (args.length) {
|
|
case 0: return new Ctor;
|
|
case 1: return new Ctor(args[0]);
|
|
case 2: return new Ctor(args[0], args[1]);
|
|
case 3: return new Ctor(args[0], args[1], args[2]);
|
|
case 4: return new Ctor(args[0], args[1], args[2], args[3]);
|
|
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
|
|
case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
|
|
case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
|
|
}
|
|
var thisBinding = baseCreate(Ctor.prototype),
|
|
result = Ctor.apply(thisBinding, args);
|
|
|
|
// Mimic the constructor's `return` behavior.
|
|
// See https://es5.github.io/#x13.2.2 for more details.
|
|
return isObject(result) ? result : thisBinding;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that wraps `func` to enable currying.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to wrap.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @param {number} arity The arity of `func`.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createCurry(func, bitmask, arity) {
|
|
var Ctor = createCtor(func);
|
|
|
|
function wrapper() {
|
|
var length = arguments.length,
|
|
args = Array(length),
|
|
index = length,
|
|
placeholder = getHolder(wrapper);
|
|
|
|
while (index--) {
|
|
args[index] = arguments[index];
|
|
}
|
|
var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
|
|
? []
|
|
: replaceHolders(args, placeholder);
|
|
|
|
length -= holders.length;
|
|
if (length < arity) {
|
|
return createRecurry(
|
|
func, bitmask, createHybrid, wrapper.placeholder, undefined,
|
|
args, holders, undefined, undefined, arity - length);
|
|
}
|
|
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
|
return apply(fn, this, args);
|
|
}
|
|
return wrapper;
|
|
}
|
|
|
|
/**
|
|
* Creates a `_.find` or `_.findLast` function.
|
|
*
|
|
* @private
|
|
* @param {Function} findIndexFunc The function to find the collection index.
|
|
* @returns {Function} Returns the new find function.
|
|
*/
|
|
function createFind(findIndexFunc) {
|
|
return function(collection, predicate, fromIndex) {
|
|
var iterable = Object(collection);
|
|
if (!isArrayLike(collection)) {
|
|
var iteratee = getIteratee(predicate, 3);
|
|
collection = keys(collection);
|
|
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
|
|
}
|
|
var index = findIndexFunc(collection, predicate, fromIndex);
|
|
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a `_.flow` or `_.flowRight` function.
|
|
*
|
|
* @private
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Function} Returns the new flow function.
|
|
*/
|
|
function createFlow(fromRight) {
|
|
return flatRest(function(funcs) {
|
|
var length = funcs.length,
|
|
index = length,
|
|
prereq = LodashWrapper.prototype.thru;
|
|
|
|
if (fromRight) {
|
|
funcs.reverse();
|
|
}
|
|
while (index--) {
|
|
var func = funcs[index];
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
|
|
var wrapper = new LodashWrapper([], true);
|
|
}
|
|
}
|
|
index = wrapper ? index : length;
|
|
while (++index < length) {
|
|
func = funcs[index];
|
|
|
|
var funcName = getFuncName(func),
|
|
data = funcName == 'wrapper' ? getData(func) : undefined;
|
|
|
|
if (data && isLaziable(data[0]) &&
|
|
data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
|
|
!data[4].length && data[9] == 1
|
|
) {
|
|
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
|
|
} else {
|
|
wrapper = (func.length == 1 && isLaziable(func))
|
|
? wrapper[funcName]()
|
|
: wrapper.thru(func);
|
|
}
|
|
}
|
|
return function() {
|
|
var args = arguments,
|
|
value = args[0];
|
|
|
|
if (wrapper && args.length == 1 && isArray(value)) {
|
|
return wrapper.plant(value).value();
|
|
}
|
|
var index = 0,
|
|
result = length ? funcs[index].apply(this, args) : value;
|
|
|
|
while (++index < length) {
|
|
result = funcs[index].call(this, result);
|
|
}
|
|
return result;
|
|
};
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a function that wraps `func` to invoke it with optional `this`
|
|
* binding of `thisArg`, partial application, and currying.
|
|
*
|
|
* @private
|
|
* @param {Function|string} func The function or method name to wrap.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @param {*} [thisArg] The `this` binding of `func`.
|
|
* @param {Array} [partials] The arguments to prepend to those provided to
|
|
* the new function.
|
|
* @param {Array} [holders] The `partials` placeholder indexes.
|
|
* @param {Array} [partialsRight] The arguments to append to those provided
|
|
* to the new function.
|
|
* @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
|
|
* @param {Array} [argPos] The argument positions of the new function.
|
|
* @param {number} [ary] The arity cap of `func`.
|
|
* @param {number} [arity] The arity of `func`.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
|
|
var isAry = bitmask & WRAP_ARY_FLAG,
|
|
isBind = bitmask & WRAP_BIND_FLAG,
|
|
isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
|
|
isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
|
|
isFlip = bitmask & WRAP_FLIP_FLAG,
|
|
Ctor = isBindKey ? undefined : createCtor(func);
|
|
|
|
function wrapper() {
|
|
var length = arguments.length,
|
|
args = Array(length),
|
|
index = length;
|
|
|
|
while (index--) {
|
|
args[index] = arguments[index];
|
|
}
|
|
if (isCurried) {
|
|
var placeholder = getHolder(wrapper),
|
|
holdersCount = countHolders(args, placeholder);
|
|
}
|
|
if (partials) {
|
|
args = composeArgs(args, partials, holders, isCurried);
|
|
}
|
|
if (partialsRight) {
|
|
args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
|
|
}
|
|
length -= holdersCount;
|
|
if (isCurried && length < arity) {
|
|
var newHolders = replaceHolders(args, placeholder);
|
|
return createRecurry(
|
|
func, bitmask, createHybrid, wrapper.placeholder, thisArg,
|
|
args, newHolders, argPos, ary, arity - length
|
|
);
|
|
}
|
|
var thisBinding = isBind ? thisArg : this,
|
|
fn = isBindKey ? thisBinding[func] : func;
|
|
|
|
length = args.length;
|
|
if (argPos) {
|
|
args = reorder(args, argPos);
|
|
} else if (isFlip && length > 1) {
|
|
args.reverse();
|
|
}
|
|
if (isAry && ary < length) {
|
|
args.length = ary;
|
|
}
|
|
if (this && this !== root && this instanceof wrapper) {
|
|
fn = Ctor || createCtor(fn);
|
|
}
|
|
return fn.apply(thisBinding, args);
|
|
}
|
|
return wrapper;
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.invertBy`.
|
|
*
|
|
* @private
|
|
* @param {Function} setter The function to set accumulator values.
|
|
* @param {Function} toIteratee The function to resolve iteratees.
|
|
* @returns {Function} Returns the new inverter function.
|
|
*/
|
|
function createInverter(setter, toIteratee) {
|
|
return function(object, iteratee) {
|
|
return baseInverter(object, setter, toIteratee(iteratee), {});
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that performs a mathematical operation on two values.
|
|
*
|
|
* @private
|
|
* @param {Function} operator The function to perform the operation.
|
|
* @param {number} [defaultValue] The value used for `undefined` arguments.
|
|
* @returns {Function} Returns the new mathematical operation function.
|
|
*/
|
|
function createMathOperation(operator, defaultValue) {
|
|
return function(value, other) {
|
|
var result;
|
|
if (value === undefined && other === undefined) {
|
|
return defaultValue;
|
|
}
|
|
if (value !== undefined) {
|
|
result = value;
|
|
}
|
|
if (other !== undefined) {
|
|
if (result === undefined) {
|
|
return other;
|
|
}
|
|
if (typeof value == 'string' || typeof other == 'string') {
|
|
value = baseToString(value);
|
|
other = baseToString(other);
|
|
} else {
|
|
value = baseToNumber(value);
|
|
other = baseToNumber(other);
|
|
}
|
|
result = operator(value, other);
|
|
}
|
|
return result;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.over`.
|
|
*
|
|
* @private
|
|
* @param {Function} arrayFunc The function to iterate over iteratees.
|
|
* @returns {Function} Returns the new over function.
|
|
*/
|
|
function createOver(arrayFunc) {
|
|
return flatRest(function(iteratees) {
|
|
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
|
|
return baseRest(function(args) {
|
|
var thisArg = this;
|
|
return arrayFunc(iteratees, function(iteratee) {
|
|
return apply(iteratee, thisArg, args);
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates the padding for `string` based on `length`. The `chars` string
|
|
* is truncated if the number of characters exceeds `length`.
|
|
*
|
|
* @private
|
|
* @param {number} length The padding length.
|
|
* @param {string} [chars=' '] The string used as padding.
|
|
* @returns {string} Returns the padding for `string`.
|
|
*/
|
|
function createPadding(length, chars) {
|
|
chars = chars === undefined ? ' ' : baseToString(chars);
|
|
|
|
var charsLength = chars.length;
|
|
if (charsLength < 2) {
|
|
return charsLength ? baseRepeat(chars, length) : chars;
|
|
}
|
|
var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
|
|
return hasUnicode(chars)
|
|
? castSlice(stringToArray(result), 0, length).join('')
|
|
: result.slice(0, length);
|
|
}
|
|
|
|
/**
|
|
* Creates a function that wraps `func` to invoke it with the `this` binding
|
|
* of `thisArg` and `partials` prepended to the arguments it receives.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to wrap.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @param {*} thisArg The `this` binding of `func`.
|
|
* @param {Array} partials The arguments to prepend to those provided to
|
|
* the new function.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createPartial(func, bitmask, thisArg, partials) {
|
|
var isBind = bitmask & WRAP_BIND_FLAG,
|
|
Ctor = createCtor(func);
|
|
|
|
function wrapper() {
|
|
var argsIndex = -1,
|
|
argsLength = arguments.length,
|
|
leftIndex = -1,
|
|
leftLength = partials.length,
|
|
args = Array(leftLength + argsLength),
|
|
fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
|
|
|
while (++leftIndex < leftLength) {
|
|
args[leftIndex] = partials[leftIndex];
|
|
}
|
|
while (argsLength--) {
|
|
args[leftIndex++] = arguments[++argsIndex];
|
|
}
|
|
return apply(fn, isBind ? thisArg : this, args);
|
|
}
|
|
return wrapper;
|
|
}
|
|
|
|
/**
|
|
* Creates a `_.range` or `_.rangeRight` function.
|
|
*
|
|
* @private
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Function} Returns the new range function.
|
|
*/
|
|
function createRange(fromRight) {
|
|
return function(start, end, step) {
|
|
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
|
|
end = step = undefined;
|
|
}
|
|
// Ensure the sign of `-0` is preserved.
|
|
start = toFinite(start);
|
|
if (end === undefined) {
|
|
end = start;
|
|
start = 0;
|
|
} else {
|
|
end = toFinite(end);
|
|
}
|
|
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
|
|
return baseRange(start, end, step, fromRight);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that performs a relational operation on two values.
|
|
*
|
|
* @private
|
|
* @param {Function} operator The function to perform the operation.
|
|
* @returns {Function} Returns the new relational operation function.
|
|
*/
|
|
function createRelationalOperation(operator) {
|
|
return function(value, other) {
|
|
if (!(typeof value == 'string' && typeof other == 'string')) {
|
|
value = toNumber(value);
|
|
other = toNumber(other);
|
|
}
|
|
return operator(value, other);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that wraps `func` to continue currying.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to wrap.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @param {Function} wrapFunc The function to create the `func` wrapper.
|
|
* @param {*} placeholder The placeholder value.
|
|
* @param {*} [thisArg] The `this` binding of `func`.
|
|
* @param {Array} [partials] The arguments to prepend to those provided to
|
|
* the new function.
|
|
* @param {Array} [holders] The `partials` placeholder indexes.
|
|
* @param {Array} [argPos] The argument positions of the new function.
|
|
* @param {number} [ary] The arity cap of `func`.
|
|
* @param {number} [arity] The arity of `func`.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
|
|
var isCurry = bitmask & WRAP_CURRY_FLAG,
|
|
newHolders = isCurry ? holders : undefined,
|
|
newHoldersRight = isCurry ? undefined : holders,
|
|
newPartials = isCurry ? partials : undefined,
|
|
newPartialsRight = isCurry ? undefined : partials;
|
|
|
|
bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
|
|
bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
|
|
|
|
if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
|
|
bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
|
|
}
|
|
var newData = [
|
|
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
|
|
newHoldersRight, argPos, ary, arity
|
|
];
|
|
|
|
var result = wrapFunc.apply(undefined, newData);
|
|
if (isLaziable(func)) {
|
|
setData(result, newData);
|
|
}
|
|
result.placeholder = placeholder;
|
|
return setWrapToString(result, func, bitmask);
|
|
}
|
|
|
|
/**
|
|
* Creates a function like `_.round`.
|
|
*
|
|
* @private
|
|
* @param {string} methodName The name of the `Math` method to use when rounding.
|
|
* @returns {Function} Returns the new round function.
|
|
*/
|
|
function createRound(methodName) {
|
|
var func = Math[methodName];
|
|
return function(number, precision) {
|
|
number = toNumber(number);
|
|
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
|
if (precision) {
|
|
// Shift with exponential notation to avoid floating-point issues.
|
|
// See [MDN](https://mdn.io/round#Examples) for more details.
|
|
var pair = (toString(number) + 'e').split('e'),
|
|
value = func(pair[0] + 'e' + (+pair[1] + precision));
|
|
|
|
pair = (toString(value) + 'e').split('e');
|
|
return +(pair[0] + 'e' + (+pair[1] - precision));
|
|
}
|
|
return func(number);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a set object of `values`.
|
|
*
|
|
* @private
|
|
* @param {Array} values The values to add to the set.
|
|
* @returns {Object} Returns the new set.
|
|
*/
|
|
var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
|
|
return new Set(values);
|
|
};
|
|
|
|
/**
|
|
* Creates a `_.toPairs` or `_.toPairsIn` function.
|
|
*
|
|
* @private
|
|
* @param {Function} keysFunc The function to get the keys of a given object.
|
|
* @returns {Function} Returns the new pairs function.
|
|
*/
|
|
function createToPairs(keysFunc) {
|
|
return function(object) {
|
|
var tag = getTag(object);
|
|
if (tag == mapTag) {
|
|
return mapToArray(object);
|
|
}
|
|
if (tag == setTag) {
|
|
return setToPairs(object);
|
|
}
|
|
return baseToPairs(object, keysFunc(object));
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that either curries or invokes `func` with optional
|
|
* `this` binding and partially applied arguments.
|
|
*
|
|
* @private
|
|
* @param {Function|string} func The function or method name to wrap.
|
|
* @param {number} bitmask The bitmask flags.
|
|
* 1 - `_.bind`
|
|
* 2 - `_.bindKey`
|
|
* 4 - `_.curry` or `_.curryRight` of a bound function
|
|
* 8 - `_.curry`
|
|
* 16 - `_.curryRight`
|
|
* 32 - `_.partial`
|
|
* 64 - `_.partialRight`
|
|
* 128 - `_.rearg`
|
|
* 256 - `_.ary`
|
|
* 512 - `_.flip`
|
|
* @param {*} [thisArg] The `this` binding of `func`.
|
|
* @param {Array} [partials] The arguments to be partially applied.
|
|
* @param {Array} [holders] The `partials` placeholder indexes.
|
|
* @param {Array} [argPos] The argument positions of the new function.
|
|
* @param {number} [ary] The arity cap of `func`.
|
|
* @param {number} [arity] The arity of `func`.
|
|
* @returns {Function} Returns the new wrapped function.
|
|
*/
|
|
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
|
|
var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
|
|
if (!isBindKey && typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
var length = partials ? partials.length : 0;
|
|
if (!length) {
|
|
bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
|
|
partials = holders = undefined;
|
|
}
|
|
ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
|
|
arity = arity === undefined ? arity : toInteger(arity);
|
|
length -= holders ? holders.length : 0;
|
|
|
|
if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
|
|
var partialsRight = partials,
|
|
holdersRight = holders;
|
|
|
|
partials = holders = undefined;
|
|
}
|
|
var data = isBindKey ? undefined : getData(func);
|
|
|
|
var newData = [
|
|
func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
|
|
argPos, ary, arity
|
|
];
|
|
|
|
if (data) {
|
|
mergeData(newData, data);
|
|
}
|
|
func = newData[0];
|
|
bitmask = newData[1];
|
|
thisArg = newData[2];
|
|
partials = newData[3];
|
|
holders = newData[4];
|
|
arity = newData[9] = newData[9] === undefined
|
|
? (isBindKey ? 0 : func.length)
|
|
: nativeMax(newData[9] - length, 0);
|
|
|
|
if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
|
|
bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
|
|
}
|
|
if (!bitmask || bitmask == WRAP_BIND_FLAG) {
|
|
var result = createBind(func, bitmask, thisArg);
|
|
} else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
|
|
result = createCurry(func, bitmask, arity);
|
|
} else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
|
|
result = createPartial(func, bitmask, thisArg, partials);
|
|
} else {
|
|
result = createHybrid.apply(undefined, newData);
|
|
}
|
|
var setter = data ? baseSetData : setData;
|
|
return setWrapToString(setter(result, newData), func, bitmask);
|
|
}
|
|
|
|
/**
|
|
* Used by `_.defaults` to customize its `_.assignIn` use to assign properties
|
|
* of source objects to the destination object for all destination properties
|
|
* that resolve to `undefined`.
|
|
*
|
|
* @private
|
|
* @param {*} objValue The destination value.
|
|
* @param {*} srcValue The source value.
|
|
* @param {string} key The key of the property to assign.
|
|
* @param {Object} object The parent object of `objValue`.
|
|
* @returns {*} Returns the value to assign.
|
|
*/
|
|
function customDefaultsAssignIn(objValue, srcValue, key, object) {
|
|
if (objValue === undefined ||
|
|
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
|
|
return srcValue;
|
|
}
|
|
return objValue;
|
|
}
|
|
|
|
/**
|
|
* Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
|
|
* objects into destination objects that are passed thru.
|
|
*
|
|
* @private
|
|
* @param {*} objValue The destination value.
|
|
* @param {*} srcValue The source value.
|
|
* @param {string} key The key of the property to merge.
|
|
* @param {Object} object The parent object of `objValue`.
|
|
* @param {Object} source The parent object of `srcValue`.
|
|
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
* counterparts.
|
|
* @returns {*} Returns the value to assign.
|
|
*/
|
|
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
|
|
if (isObject(objValue) && isObject(srcValue)) {
|
|
// Recursively merge objects and arrays (susceptible to call stack limits).
|
|
stack.set(srcValue, objValue);
|
|
baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
|
|
stack['delete'](srcValue);
|
|
}
|
|
return objValue;
|
|
}
|
|
|
|
/**
|
|
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
|
|
* objects.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to inspect.
|
|
* @param {string} key The key of the property to inspect.
|
|
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
|
|
*/
|
|
function customOmitClone(value) {
|
|
return isPlainObject(value) ? undefined : value;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
* partial deep comparisons.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to compare.
|
|
* @param {Array} other The other array to compare.
|
|
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
* @param {Function} customizer The function to customize comparisons.
|
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
*/
|
|
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
|
arrLength = array.length,
|
|
othLength = other.length;
|
|
|
|
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
return false;
|
|
}
|
|
// Assume cyclic values are equal.
|
|
var stacked = stack.get(array);
|
|
if (stacked && stack.get(other)) {
|
|
return stacked == other;
|
|
}
|
|
var index = -1,
|
|
result = true,
|
|
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
|
|
|
|
stack.set(array, other);
|
|
stack.set(other, array);
|
|
|
|
// Ignore non-index properties.
|
|
while (++index < arrLength) {
|
|
var arrValue = array[index],
|
|
othValue = other[index];
|
|
|
|
if (customizer) {
|
|
var compared = isPartial
|
|
? customizer(othValue, arrValue, index, other, array, stack)
|
|
: customizer(arrValue, othValue, index, array, other, stack);
|
|
}
|
|
if (compared !== undefined) {
|
|
if (compared) {
|
|
continue;
|
|
}
|
|
result = false;
|
|
break;
|
|
}
|
|
// Recursively compare arrays (susceptible to call stack limits).
|
|
if (seen) {
|
|
if (!arraySome(other, function(othValue, othIndex) {
|
|
if (!cacheHas(seen, othIndex) &&
|
|
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
return seen.push(othIndex);
|
|
}
|
|
})) {
|
|
result = false;
|
|
break;
|
|
}
|
|
} else if (!(
|
|
arrValue === othValue ||
|
|
equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
|
)) {
|
|
result = false;
|
|
break;
|
|
}
|
|
}
|
|
stack['delete'](array);
|
|
stack['delete'](other);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
* the same `toStringTag`.
|
|
*
|
|
* **Note:** This function only supports comparing values with tags of
|
|
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to compare.
|
|
* @param {Object} other The other object to compare.
|
|
* @param {string} tag The `toStringTag` of the objects to compare.
|
|
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
* @param {Function} customizer The function to customize comparisons.
|
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
*/
|
|
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
switch (tag) {
|
|
case dataViewTag:
|
|
if ((object.byteLength != other.byteLength) ||
|
|
(object.byteOffset != other.byteOffset)) {
|
|
return false;
|
|
}
|
|
object = object.buffer;
|
|
other = other.buffer;
|
|
|
|
case arrayBufferTag:
|
|
if ((object.byteLength != other.byteLength) ||
|
|
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
return false;
|
|
}
|
|
return true;
|
|
|
|
case boolTag:
|
|
case dateTag:
|
|
case numberTag:
|
|
// Coerce booleans to `1` or `0` and dates to milliseconds.
|
|
// Invalid dates are coerced to `NaN`.
|
|
return eq(+object, +other);
|
|
|
|
case errorTag:
|
|
return object.name == other.name && object.message == other.message;
|
|
|
|
case regexpTag:
|
|
case stringTag:
|
|
// Coerce regexes to strings and treat strings, primitives and objects,
|
|
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
|
// for more details.
|
|
return object == (other + '');
|
|
|
|
case mapTag:
|
|
var convert = mapToArray;
|
|
|
|
case setTag:
|
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
|
convert || (convert = setToArray);
|
|
|
|
if (object.size != other.size && !isPartial) {
|
|
return false;
|
|
}
|
|
// Assume cyclic values are equal.
|
|
var stacked = stack.get(object);
|
|
if (stacked) {
|
|
return stacked == other;
|
|
}
|
|
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
|
|
// Recursively compare objects (susceptible to call stack limits).
|
|
stack.set(object, other);
|
|
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
stack['delete'](object);
|
|
return result;
|
|
|
|
case symbolTag:
|
|
if (symbolValueOf) {
|
|
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseIsEqualDeep` for objects with support for
|
|
* partial deep comparisons.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to compare.
|
|
* @param {Object} other The other object to compare.
|
|
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
* @param {Function} customizer The function to customize comparisons.
|
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
*/
|
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
|
objProps = getAllKeys(object),
|
|
objLength = objProps.length,
|
|
othProps = getAllKeys(other),
|
|
othLength = othProps.length;
|
|
|
|
if (objLength != othLength && !isPartial) {
|
|
return false;
|
|
}
|
|
var index = objLength;
|
|
while (index--) {
|
|
var key = objProps[index];
|
|
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
|
return false;
|
|
}
|
|
}
|
|
// Assume cyclic values are equal.
|
|
var stacked = stack.get(object);
|
|
if (stacked && stack.get(other)) {
|
|
return stacked == other;
|
|
}
|
|
var result = true;
|
|
stack.set(object, other);
|
|
stack.set(other, object);
|
|
|
|
var skipCtor = isPartial;
|
|
while (++index < objLength) {
|
|
key = objProps[index];
|
|
var objValue = object[key],
|
|
othValue = other[key];
|
|
|
|
if (customizer) {
|
|
var compared = isPartial
|
|
? customizer(othValue, objValue, key, other, object, stack)
|
|
: customizer(objValue, othValue, key, object, other, stack);
|
|
}
|
|
// Recursively compare objects (susceptible to call stack limits).
|
|
if (!(compared === undefined
|
|
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
|
: compared
|
|
)) {
|
|
result = false;
|
|
break;
|
|
}
|
|
skipCtor || (skipCtor = key == 'constructor');
|
|
}
|
|
if (result && !skipCtor) {
|
|
var objCtor = object.constructor,
|
|
othCtor = other.constructor;
|
|
|
|
// Non `Object` object instances with different constructors are not equal.
|
|
if (objCtor != othCtor &&
|
|
('constructor' in object && 'constructor' in other) &&
|
|
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
|
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
|
result = false;
|
|
}
|
|
}
|
|
stack['delete'](object);
|
|
stack['delete'](other);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseRest` which flattens the rest array.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to apply a rest parameter to.
|
|
* @returns {Function} Returns the new function.
|
|
*/
|
|
function flatRest(func) {
|
|
return setToString(overRest(func, undefined, flatten), func + '');
|
|
}
|
|
|
|
/**
|
|
* Creates an array of own enumerable property names and symbols of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names and symbols.
|
|
*/
|
|
function getAllKeys(object) {
|
|
return baseGetAllKeys(object, keys, getSymbols);
|
|
}
|
|
|
|
/**
|
|
* Creates an array of own and inherited enumerable property names and
|
|
* symbols of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names and symbols.
|
|
*/
|
|
function getAllKeysIn(object) {
|
|
return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
|
}
|
|
|
|
/**
|
|
* Gets metadata for `func`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to query.
|
|
* @returns {*} Returns the metadata for `func`.
|
|
*/
|
|
var getData = !metaMap ? noop : function(func) {
|
|
return metaMap.get(func);
|
|
};
|
|
|
|
/**
|
|
* Gets the name of `func`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to query.
|
|
* @returns {string} Returns the function name.
|
|
*/
|
|
function getFuncName(func) {
|
|
var result = (func.name + ''),
|
|
array = realNames[result],
|
|
length = hasOwnProperty.call(realNames, result) ? array.length : 0;
|
|
|
|
while (length--) {
|
|
var data = array[length],
|
|
otherFunc = data.func;
|
|
if (otherFunc == null || otherFunc == func) {
|
|
return data.name;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Gets the argument placeholder value for `func`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to inspect.
|
|
* @returns {*} Returns the placeholder value.
|
|
*/
|
|
function getHolder(func) {
|
|
var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
|
|
return object.placeholder;
|
|
}
|
|
|
|
/**
|
|
* Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
|
|
* this function returns the custom method, otherwise it returns `baseIteratee`.
|
|
* If arguments are provided, the chosen function is invoked with them and
|
|
* its result is returned.
|
|
*
|
|
* @private
|
|
* @param {*} [value] The value to convert to an iteratee.
|
|
* @param {number} [arity] The arity of the created iteratee.
|
|
* @returns {Function} Returns the chosen function or its result.
|
|
*/
|
|
function getIteratee() {
|
|
var result = lodash.iteratee || iteratee;
|
|
result = result === iteratee ? baseIteratee : result;
|
|
return arguments.length ? result(arguments[0], arguments[1]) : result;
|
|
}
|
|
|
|
/**
|
|
* Gets the data for `map`.
|
|
*
|
|
* @private
|
|
* @param {Object} map The map to query.
|
|
* @param {string} key The reference key.
|
|
* @returns {*} Returns the map data.
|
|
*/
|
|
function getMapData(map, key) {
|
|
var data = map.__data__;
|
|
return isKeyable(key)
|
|
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
: data.map;
|
|
}
|
|
|
|
/**
|
|
* Gets the property names, values, and compare flags of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the match data of `object`.
|
|
*/
|
|
function getMatchData(object) {
|
|
var result = keys(object),
|
|
length = result.length;
|
|
|
|
while (length--) {
|
|
var key = result[length],
|
|
value = object[key];
|
|
|
|
result[length] = [key, value, isStrictComparable(value)];
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Gets the native function at `key` of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {string} key The key of the method to get.
|
|
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
*/
|
|
function getNative(object, key) {
|
|
var value = getValue(object, key);
|
|
return baseIsNative(value) ? value : undefined;
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to query.
|
|
* @returns {string} Returns the raw `toStringTag`.
|
|
*/
|
|
function getRawTag(value) {
|
|
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
|
tag = value[symToStringTag];
|
|
|
|
try {
|
|
value[symToStringTag] = undefined;
|
|
var unmasked = true;
|
|
} catch (e) {}
|
|
|
|
var result = nativeObjectToString.call(value);
|
|
if (unmasked) {
|
|
if (isOwn) {
|
|
value[symToStringTag] = tag;
|
|
} else {
|
|
delete value[symToStringTag];
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates an array of the own enumerable symbols of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of symbols.
|
|
*/
|
|
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
if (object == null) {
|
|
return [];
|
|
}
|
|
object = Object(object);
|
|
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
return propertyIsEnumerable.call(object, symbol);
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Creates an array of the own and inherited enumerable symbols of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of symbols.
|
|
*/
|
|
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
|
|
var result = [];
|
|
while (object) {
|
|
arrayPush(result, getSymbols(object));
|
|
object = getPrototype(object);
|
|
}
|
|
return result;
|
|
};
|
|
|
|
/**
|
|
* Gets the `toStringTag` of `value`.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to query.
|
|
* @returns {string} Returns the `toStringTag`.
|
|
*/
|
|
var getTag = baseGetTag;
|
|
|
|
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
(Map && getTag(new Map) != mapTag) ||
|
|
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
|
(Set && getTag(new Set) != setTag) ||
|
|
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
|
getTag = function(value) {
|
|
var result = baseGetTag(value),
|
|
Ctor = result == objectTag ? value.constructor : undefined,
|
|
ctorString = Ctor ? toSource(Ctor) : '';
|
|
|
|
if (ctorString) {
|
|
switch (ctorString) {
|
|
case dataViewCtorString: return dataViewTag;
|
|
case mapCtorString: return mapTag;
|
|
case promiseCtorString: return promiseTag;
|
|
case setCtorString: return setTag;
|
|
case weakMapCtorString: return weakMapTag;
|
|
}
|
|
}
|
|
return result;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Gets the view, applying any `transforms` to the `start` and `end` positions.
|
|
*
|
|
* @private
|
|
* @param {number} start The start of the view.
|
|
* @param {number} end The end of the view.
|
|
* @param {Array} transforms The transformations to apply to the view.
|
|
* @returns {Object} Returns an object containing the `start` and `end`
|
|
* positions of the view.
|
|
*/
|
|
function getView(start, end, transforms) {
|
|
var index = -1,
|
|
length = transforms.length;
|
|
|
|
while (++index < length) {
|
|
var data = transforms[index],
|
|
size = data.size;
|
|
|
|
switch (data.type) {
|
|
case 'drop': start += size; break;
|
|
case 'dropRight': end -= size; break;
|
|
case 'take': end = nativeMin(end, start + size); break;
|
|
case 'takeRight': start = nativeMax(start, end - size); break;
|
|
}
|
|
}
|
|
return { 'start': start, 'end': end };
|
|
}
|
|
|
|
/**
|
|
* Extracts wrapper details from the `source` body comment.
|
|
*
|
|
* @private
|
|
* @param {string} source The source to inspect.
|
|
* @returns {Array} Returns the wrapper details.
|
|
*/
|
|
function getWrapDetails(source) {
|
|
var match = source.match(reWrapDetails);
|
|
return match ? match[1].split(reSplitDetails) : [];
|
|
}
|
|
|
|
/**
|
|
* Checks if `path` exists on `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path to check.
|
|
* @param {Function} hasFunc The function to check properties.
|
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
*/
|
|
function hasPath(object, path, hasFunc) {
|
|
path = castPath(path, object);
|
|
|
|
var index = -1,
|
|
length = path.length,
|
|
result = false;
|
|
|
|
while (++index < length) {
|
|
var key = toKey(path[index]);
|
|
if (!(result = object != null && hasFunc(object, key))) {
|
|
break;
|
|
}
|
|
object = object[key];
|
|
}
|
|
if (result || ++index != length) {
|
|
return result;
|
|
}
|
|
length = object == null ? 0 : object.length;
|
|
return !!length && isLength(length) && isIndex(key, length) &&
|
|
(isArray(object) || isArguments(object));
|
|
}
|
|
|
|
/**
|
|
* Initializes an array clone.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to clone.
|
|
* @returns {Array} Returns the initialized clone.
|
|
*/
|
|
function initCloneArray(array) {
|
|
var length = array.length,
|
|
result = array.constructor(length);
|
|
|
|
// Add properties assigned by `RegExp#exec`.
|
|
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
|
|
result.index = array.index;
|
|
result.input = array.input;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Initializes an object clone.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to clone.
|
|
* @returns {Object} Returns the initialized clone.
|
|
*/
|
|
function initCloneObject(object) {
|
|
return (typeof object.constructor == 'function' && !isPrototype(object))
|
|
? baseCreate(getPrototype(object))
|
|
: {};
|
|
}
|
|
|
|
/**
|
|
* Initializes an object clone based on its `toStringTag`.
|
|
*
|
|
* **Note:** This function only supports cloning values with tags of
|
|
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to clone.
|
|
* @param {string} tag The `toStringTag` of the object to clone.
|
|
* @param {Function} cloneFunc The function to clone values.
|
|
* @param {boolean} [isDeep] Specify a deep clone.
|
|
* @returns {Object} Returns the initialized clone.
|
|
*/
|
|
function initCloneByTag(object, tag, cloneFunc, isDeep) {
|
|
var Ctor = object.constructor;
|
|
switch (tag) {
|
|
case arrayBufferTag:
|
|
return cloneArrayBuffer(object);
|
|
|
|
case boolTag:
|
|
case dateTag:
|
|
return new Ctor(+object);
|
|
|
|
case dataViewTag:
|
|
return cloneDataView(object, isDeep);
|
|
|
|
case float32Tag: case float64Tag:
|
|
case int8Tag: case int16Tag: case int32Tag:
|
|
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
|
|
return cloneTypedArray(object, isDeep);
|
|
|
|
case mapTag:
|
|
return cloneMap(object, isDeep, cloneFunc);
|
|
|
|
case numberTag:
|
|
case stringTag:
|
|
return new Ctor(object);
|
|
|
|
case regexpTag:
|
|
return cloneRegExp(object);
|
|
|
|
case setTag:
|
|
return cloneSet(object, isDeep, cloneFunc);
|
|
|
|
case symbolTag:
|
|
return cloneSymbol(object);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Inserts wrapper `details` in a comment at the top of the `source` body.
|
|
*
|
|
* @private
|
|
* @param {string} source The source to modify.
|
|
* @returns {Array} details The details to insert.
|
|
* @returns {string} Returns the modified source.
|
|
*/
|
|
function insertWrapDetails(source, details) {
|
|
var length = details.length;
|
|
if (!length) {
|
|
return source;
|
|
}
|
|
var lastIndex = length - 1;
|
|
details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
|
|
details = details.join(length > 2 ? ', ' : ' ');
|
|
return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a flattenable `arguments` object or array.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
|
*/
|
|
function isFlattenable(value) {
|
|
return isArray(value) || isArguments(value) ||
|
|
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a valid array-like index.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
*/
|
|
function isIndex(value, length) {
|
|
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
return !!length &&
|
|
(typeof value == 'number' || reIsUint.test(value)) &&
|
|
(value > -1 && value % 1 == 0 && value < length);
|
|
}
|
|
|
|
/**
|
|
* Checks if the given arguments are from an iteratee call.
|
|
*
|
|
* @private
|
|
* @param {*} value The potential iteratee value argument.
|
|
* @param {*} index The potential iteratee index or key argument.
|
|
* @param {*} object The potential iteratee object argument.
|
|
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
* else `false`.
|
|
*/
|
|
function isIterateeCall(value, index, object) {
|
|
if (!isObject(object)) {
|
|
return false;
|
|
}
|
|
var type = typeof index;
|
|
if (type == 'number'
|
|
? (isArrayLike(object) && isIndex(index, object.length))
|
|
: (type == 'string' && index in object)
|
|
) {
|
|
return eq(object[index], value);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a property name and not a property path.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @param {Object} [object] The object to query keys on.
|
|
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
*/
|
|
function isKey(value, object) {
|
|
if (isArray(value)) {
|
|
return false;
|
|
}
|
|
var type = typeof value;
|
|
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
value == null || isSymbol(value)) {
|
|
return true;
|
|
}
|
|
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
(object != null && value in Object(object));
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is suitable for use as unique object key.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
*/
|
|
function isKeyable(value) {
|
|
var type = typeof value;
|
|
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
? (value !== '__proto__')
|
|
: (value === null);
|
|
}
|
|
|
|
/**
|
|
* Checks if `func` has a lazy counterpart.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to check.
|
|
* @returns {boolean} Returns `true` if `func` has a lazy counterpart,
|
|
* else `false`.
|
|
*/
|
|
function isLaziable(func) {
|
|
var funcName = getFuncName(func),
|
|
other = lodash[funcName];
|
|
|
|
if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
|
|
return false;
|
|
}
|
|
if (func === other) {
|
|
return true;
|
|
}
|
|
var data = getData(other);
|
|
return !!data && func === data[0];
|
|
}
|
|
|
|
/**
|
|
* Checks if `func` has its source masked.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to check.
|
|
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
*/
|
|
function isMasked(func) {
|
|
return !!maskSrcKey && (maskSrcKey in func);
|
|
}
|
|
|
|
/**
|
|
* Checks if `func` is capable of being masked.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `func` is maskable, else `false`.
|
|
*/
|
|
var isMaskable = coreJsData ? isFunction : stubFalse;
|
|
|
|
/**
|
|
* Checks if `value` is likely a prototype object.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
*/
|
|
function isPrototype(value) {
|
|
var Ctor = value && value.constructor,
|
|
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
|
|
|
return value === proto;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` if suitable for strict
|
|
* equality comparisons, else `false`.
|
|
*/
|
|
function isStrictComparable(value) {
|
|
return value === value && !isObject(value);
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `matchesProperty` for source values suitable
|
|
* for strict equality comparisons, i.e. `===`.
|
|
*
|
|
* @private
|
|
* @param {string} key The key of the property to get.
|
|
* @param {*} srcValue The value to match.
|
|
* @returns {Function} Returns the new spec function.
|
|
*/
|
|
function matchesStrictComparable(key, srcValue) {
|
|
return function(object) {
|
|
if (object == null) {
|
|
return false;
|
|
}
|
|
return object[key] === srcValue &&
|
|
(srcValue !== undefined || (key in Object(object)));
|
|
};
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.memoize` which clears the memoized function's
|
|
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to have its output memoized.
|
|
* @returns {Function} Returns the new memoized function.
|
|
*/
|
|
function memoizeCapped(func) {
|
|
var result = memoize(func, function(key) {
|
|
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
cache.clear();
|
|
}
|
|
return key;
|
|
});
|
|
|
|
var cache = result.cache;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Merges the function metadata of `source` into `data`.
|
|
*
|
|
* Merging metadata reduces the number of wrappers used to invoke a function.
|
|
* This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
|
|
* may be applied regardless of execution order. Methods like `_.ary` and
|
|
* `_.rearg` modify function arguments, making the order in which they are
|
|
* executed important, preventing the merging of metadata. However, we make
|
|
* an exception for a safe combined case where curried functions have `_.ary`
|
|
* and or `_.rearg` applied.
|
|
*
|
|
* @private
|
|
* @param {Array} data The destination metadata.
|
|
* @param {Array} source The source metadata.
|
|
* @returns {Array} Returns `data`.
|
|
*/
|
|
function mergeData(data, source) {
|
|
var bitmask = data[1],
|
|
srcBitmask = source[1],
|
|
newBitmask = bitmask | srcBitmask,
|
|
isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
|
|
|
|
var isCombo =
|
|
((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
|
|
((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
|
|
((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
|
|
|
|
// Exit early if metadata can't be merged.
|
|
if (!(isCommon || isCombo)) {
|
|
return data;
|
|
}
|
|
// Use source `thisArg` if available.
|
|
if (srcBitmask & WRAP_BIND_FLAG) {
|
|
data[2] = source[2];
|
|
// Set when currying a bound function.
|
|
newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
|
|
}
|
|
// Compose partial arguments.
|
|
var value = source[3];
|
|
if (value) {
|
|
var partials = data[3];
|
|
data[3] = partials ? composeArgs(partials, value, source[4]) : value;
|
|
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
|
|
}
|
|
// Compose partial right arguments.
|
|
value = source[5];
|
|
if (value) {
|
|
partials = data[5];
|
|
data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
|
|
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
|
|
}
|
|
// Use source `argPos` if available.
|
|
value = source[7];
|
|
if (value) {
|
|
data[7] = value;
|
|
}
|
|
// Use source `ary` if it's smaller.
|
|
if (srcBitmask & WRAP_ARY_FLAG) {
|
|
data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
|
|
}
|
|
// Use source `arity` if one is not provided.
|
|
if (data[9] == null) {
|
|
data[9] = source[9];
|
|
}
|
|
// Use source `func` and merge bitmasks.
|
|
data[0] = source[0];
|
|
data[1] = newBitmask;
|
|
|
|
return data;
|
|
}
|
|
|
|
/**
|
|
* This function is like
|
|
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
* except that it includes inherited enumerable properties.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names.
|
|
*/
|
|
function nativeKeysIn(object) {
|
|
var result = [];
|
|
if (object != null) {
|
|
for (var key in Object(object)) {
|
|
result.push(key);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a string using `Object.prototype.toString`.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to convert.
|
|
* @returns {string} Returns the converted string.
|
|
*/
|
|
function objectToString(value) {
|
|
return nativeObjectToString.call(value);
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `baseRest` which transforms the rest array.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to apply a rest parameter to.
|
|
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
* @param {Function} transform The rest array transform.
|
|
* @returns {Function} Returns the new function.
|
|
*/
|
|
function overRest(func, start, transform) {
|
|
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
|
return function() {
|
|
var args = arguments,
|
|
index = -1,
|
|
length = nativeMax(args.length - start, 0),
|
|
array = Array(length);
|
|
|
|
while (++index < length) {
|
|
array[index] = args[start + index];
|
|
}
|
|
index = -1;
|
|
var otherArgs = Array(start + 1);
|
|
while (++index < start) {
|
|
otherArgs[index] = args[index];
|
|
}
|
|
otherArgs[start] = transform(array);
|
|
return apply(func, this, otherArgs);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Gets the parent value at `path` of `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to query.
|
|
* @param {Array} path The path to get the parent value of.
|
|
* @returns {*} Returns the parent value.
|
|
*/
|
|
function parent(object, path) {
|
|
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
|
|
}
|
|
|
|
/**
|
|
* Reorder `array` according to the specified indexes where the element at
|
|
* the first index is assigned as the first element, the element at
|
|
* the second index is assigned as the second element, and so on.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to reorder.
|
|
* @param {Array} indexes The arranged array indexes.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function reorder(array, indexes) {
|
|
var arrLength = array.length,
|
|
length = nativeMin(indexes.length, arrLength),
|
|
oldArray = copyArray(array);
|
|
|
|
while (length--) {
|
|
var index = indexes[length];
|
|
array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* Sets metadata for `func`.
|
|
*
|
|
* **Note:** If this function becomes hot, i.e. is invoked a lot in a short
|
|
* period of time, it will trip its breaker and transition to an identity
|
|
* function to avoid garbage collection pauses in V8. See
|
|
* [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
|
|
* for more details.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to associate metadata with.
|
|
* @param {*} data The metadata.
|
|
* @returns {Function} Returns `func`.
|
|
*/
|
|
var setData = shortOut(baseSetData);
|
|
|
|
/**
|
|
* A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to delay.
|
|
* @param {number} wait The number of milliseconds to delay invocation.
|
|
* @returns {number|Object} Returns the timer id or timeout object.
|
|
*/
|
|
var setTimeout = ctxSetTimeout || function(func, wait) {
|
|
return root.setTimeout(func, wait);
|
|
};
|
|
|
|
/**
|
|
* Sets the `toString` method of `func` to return `string`.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to modify.
|
|
* @param {Function} string The `toString` result.
|
|
* @returns {Function} Returns `func`.
|
|
*/
|
|
var setToString = shortOut(baseSetToString);
|
|
|
|
/**
|
|
* Sets the `toString` method of `wrapper` to mimic the source of `reference`
|
|
* with wrapper details in a comment at the top of the source body.
|
|
*
|
|
* @private
|
|
* @param {Function} wrapper The function to modify.
|
|
* @param {Function} reference The reference function.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @returns {Function} Returns `wrapper`.
|
|
*/
|
|
function setWrapToString(wrapper, reference, bitmask) {
|
|
var source = (reference + '');
|
|
return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
|
|
}
|
|
|
|
/**
|
|
* Creates a function that'll short out and invoke `identity` instead
|
|
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
* milliseconds.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to restrict.
|
|
* @returns {Function} Returns the new shortable function.
|
|
*/
|
|
function shortOut(func) {
|
|
var count = 0,
|
|
lastCalled = 0;
|
|
|
|
return function() {
|
|
var stamp = nativeNow(),
|
|
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
|
|
lastCalled = stamp;
|
|
if (remaining > 0) {
|
|
if (++count >= HOT_COUNT) {
|
|
return arguments[0];
|
|
}
|
|
} else {
|
|
count = 0;
|
|
}
|
|
return func.apply(undefined, arguments);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* A specialized version of `_.shuffle` which mutates and sets the size of `array`.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to shuffle.
|
|
* @param {number} [size=array.length] The size of `array`.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function shuffleSelf(array, size) {
|
|
var index = -1,
|
|
length = array.length,
|
|
lastIndex = length - 1;
|
|
|
|
size = size === undefined ? length : size;
|
|
while (++index < size) {
|
|
var rand = baseRandom(index, lastIndex),
|
|
value = array[rand];
|
|
|
|
array[rand] = array[index];
|
|
array[index] = value;
|
|
}
|
|
array.length = size;
|
|
return array;
|
|
}
|
|
|
|
/**
|
|
* Converts `string` to a property path array.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to convert.
|
|
* @returns {Array} Returns the property path array.
|
|
*/
|
|
var stringToPath = memoizeCapped(function(string) {
|
|
var result = [];
|
|
if (reLeadingDot.test(string)) {
|
|
result.push('');
|
|
}
|
|
string.replace(rePropName, function(match, number, quote, string) {
|
|
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
|
});
|
|
return result;
|
|
});
|
|
|
|
/**
|
|
* Converts `value` to a string key if it's not a string or symbol.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to inspect.
|
|
* @returns {string|symbol} Returns the key.
|
|
*/
|
|
function toKey(value) {
|
|
if (typeof value == 'string' || isSymbol(value)) {
|
|
return value;
|
|
}
|
|
var result = (value + '');
|
|
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
}
|
|
|
|
/**
|
|
* Converts `func` to its source code.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to convert.
|
|
* @returns {string} Returns the source code.
|
|
*/
|
|
function toSource(func) {
|
|
if (func != null) {
|
|
try {
|
|
return funcToString.call(func);
|
|
} catch (e) {}
|
|
try {
|
|
return (func + '');
|
|
} catch (e) {}
|
|
}
|
|
return '';
|
|
}
|
|
|
|
/**
|
|
* Updates wrapper `details` based on `bitmask` flags.
|
|
*
|
|
* @private
|
|
* @returns {Array} details The details to modify.
|
|
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
|
* @returns {Array} Returns `details`.
|
|
*/
|
|
function updateWrapDetails(details, bitmask) {
|
|
arrayEach(wrapFlags, function(pair) {
|
|
var value = '_.' + pair[0];
|
|
if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
|
|
details.push(value);
|
|
}
|
|
});
|
|
return details.sort();
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of `wrapper`.
|
|
*
|
|
* @private
|
|
* @param {Object} wrapper The wrapper to clone.
|
|
* @returns {Object} Returns the cloned wrapper.
|
|
*/
|
|
function wrapperClone(wrapper) {
|
|
if (wrapper instanceof LazyWrapper) {
|
|
return wrapper.clone();
|
|
}
|
|
var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
|
|
result.__actions__ = copyArray(wrapper.__actions__);
|
|
result.__index__ = wrapper.__index__;
|
|
result.__values__ = wrapper.__values__;
|
|
return result;
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates an array of elements split into groups the length of `size`.
|
|
* If `array` can't be split evenly, the final chunk will be the remaining
|
|
* elements.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to process.
|
|
* @param {number} [size=1] The length of each chunk
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the new array of chunks.
|
|
* @example
|
|
*
|
|
* _.chunk(['a', 'b', 'c', 'd'], 2);
|
|
* // => [['a', 'b'], ['c', 'd']]
|
|
*
|
|
* _.chunk(['a', 'b', 'c', 'd'], 3);
|
|
* // => [['a', 'b', 'c'], ['d']]
|
|
*/
|
|
function chunk(array, size, guard) {
|
|
if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
|
|
size = 1;
|
|
} else {
|
|
size = nativeMax(toInteger(size), 0);
|
|
}
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length || size < 1) {
|
|
return [];
|
|
}
|
|
var index = 0,
|
|
resIndex = 0,
|
|
result = Array(nativeCeil(length / size));
|
|
|
|
while (index < length) {
|
|
result[resIndex++] = baseSlice(array, index, (index += size));
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates an array with all falsey values removed. The values `false`, `null`,
|
|
* `0`, `""`, `undefined`, and `NaN` are falsey.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to compact.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @example
|
|
*
|
|
* _.compact([0, 1, false, 2, '', 3]);
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function compact(array) {
|
|
var index = -1,
|
|
length = array == null ? 0 : array.length,
|
|
resIndex = 0,
|
|
result = [];
|
|
|
|
while (++index < length) {
|
|
var value = array[index];
|
|
if (value) {
|
|
result[resIndex++] = value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates a new array concatenating `array` with any additional arrays
|
|
* and/or values.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to concatenate.
|
|
* @param {...*} [values] The values to concatenate.
|
|
* @returns {Array} Returns the new concatenated array.
|
|
* @example
|
|
*
|
|
* var array = [1];
|
|
* var other = _.concat(array, 2, [3], [[4]]);
|
|
*
|
|
* console.log(other);
|
|
* // => [1, 2, 3, [4]]
|
|
*
|
|
* console.log(array);
|
|
* // => [1]
|
|
*/
|
|
function concat() {
|
|
var length = arguments.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
var args = Array(length - 1),
|
|
array = arguments[0],
|
|
index = length;
|
|
|
|
while (index--) {
|
|
args[index - 1] = arguments[index];
|
|
}
|
|
return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
|
|
}
|
|
|
|
/**
|
|
* Creates an array of `array` values not included in the other given arrays
|
|
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons. The order and references of result values are
|
|
* determined by the first array.
|
|
*
|
|
* **Note:** Unlike `_.pullAll`, this method returns a new array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {...Array} [values] The values to exclude.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @see _.without, _.xor
|
|
* @example
|
|
*
|
|
* _.difference([2, 1], [2, 3]);
|
|
* // => [1]
|
|
*/
|
|
var difference = baseRest(function(array, values) {
|
|
return isArrayLikeObject(array)
|
|
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.difference` except that it accepts `iteratee` which
|
|
* is invoked for each element of `array` and `values` to generate the criterion
|
|
* by which they're compared. The order and references of result values are
|
|
* determined by the first array. The iteratee is invoked with one argument:
|
|
* (value).
|
|
*
|
|
* **Note:** Unlike `_.pullAllBy`, this method returns a new array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {...Array} [values] The values to exclude.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @example
|
|
*
|
|
* _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
|
|
* // => [1.2]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
|
|
* // => [{ 'x': 2 }]
|
|
*/
|
|
var differenceBy = baseRest(function(array, values) {
|
|
var iteratee = last(values);
|
|
if (isArrayLikeObject(iteratee)) {
|
|
iteratee = undefined;
|
|
}
|
|
return isArrayLikeObject(array)
|
|
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.difference` except that it accepts `comparator`
|
|
* which is invoked to compare elements of `array` to `values`. The order and
|
|
* references of result values are determined by the first array. The comparator
|
|
* is invoked with two arguments: (arrVal, othVal).
|
|
*
|
|
* **Note:** Unlike `_.pullAllWith`, this method returns a new array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {...Array} [values] The values to exclude.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
|
*
|
|
* _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
|
|
* // => [{ 'x': 2, 'y': 1 }]
|
|
*/
|
|
var differenceWith = baseRest(function(array, values) {
|
|
var comparator = last(values);
|
|
if (isArrayLikeObject(comparator)) {
|
|
comparator = undefined;
|
|
}
|
|
return isArrayLikeObject(array)
|
|
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* Creates a slice of `array` with `n` elements dropped from the beginning.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.5.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {number} [n=1] The number of elements to drop.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* _.drop([1, 2, 3]);
|
|
* // => [2, 3]
|
|
*
|
|
* _.drop([1, 2, 3], 2);
|
|
* // => [3]
|
|
*
|
|
* _.drop([1, 2, 3], 5);
|
|
* // => []
|
|
*
|
|
* _.drop([1, 2, 3], 0);
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function drop(array, n, guard) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
n = (guard || n === undefined) ? 1 : toInteger(n);
|
|
return baseSlice(array, n < 0 ? 0 : n, length);
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` with `n` elements dropped from the end.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {number} [n=1] The number of elements to drop.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* _.dropRight([1, 2, 3]);
|
|
* // => [1, 2]
|
|
*
|
|
* _.dropRight([1, 2, 3], 2);
|
|
* // => [1]
|
|
*
|
|
* _.dropRight([1, 2, 3], 5);
|
|
* // => []
|
|
*
|
|
* _.dropRight([1, 2, 3], 0);
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function dropRight(array, n, guard) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
n = (guard || n === undefined) ? 1 : toInteger(n);
|
|
n = length - n;
|
|
return baseSlice(array, 0, n < 0 ? 0 : n);
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` excluding elements dropped from the end.
|
|
* Elements are dropped until `predicate` returns falsey. The predicate is
|
|
* invoked with three arguments: (value, index, array).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': true },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': false }
|
|
* ];
|
|
*
|
|
* _.dropRightWhile(users, function(o) { return !o.active; });
|
|
* // => objects for ['barney']
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
|
|
* // => objects for ['barney', 'fred']
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.dropRightWhile(users, ['active', false]);
|
|
* // => objects for ['barney']
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.dropRightWhile(users, 'active');
|
|
* // => objects for ['barney', 'fred', 'pebbles']
|
|
*/
|
|
function dropRightWhile(array, predicate) {
|
|
return (array && array.length)
|
|
? baseWhile(array, getIteratee(predicate, 3), true, true)
|
|
: [];
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` excluding elements dropped from the beginning.
|
|
* Elements are dropped until `predicate` returns falsey. The predicate is
|
|
* invoked with three arguments: (value, index, array).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': false },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': true }
|
|
* ];
|
|
*
|
|
* _.dropWhile(users, function(o) { return !o.active; });
|
|
* // => objects for ['pebbles']
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.dropWhile(users, { 'user': 'barney', 'active': false });
|
|
* // => objects for ['fred', 'pebbles']
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.dropWhile(users, ['active', false]);
|
|
* // => objects for ['pebbles']
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.dropWhile(users, 'active');
|
|
* // => objects for ['barney', 'fred', 'pebbles']
|
|
*/
|
|
function dropWhile(array, predicate) {
|
|
return (array && array.length)
|
|
? baseWhile(array, getIteratee(predicate, 3), true)
|
|
: [];
|
|
}
|
|
|
|
/**
|
|
* Fills elements of `array` with `value` from `start` up to, but not
|
|
* including, `end`.
|
|
*
|
|
* **Note:** This method mutates `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.2.0
|
|
* @category Array
|
|
* @param {Array} array The array to fill.
|
|
* @param {*} value The value to fill `array` with.
|
|
* @param {number} [start=0] The start position.
|
|
* @param {number} [end=array.length] The end position.
|
|
* @returns {Array} Returns `array`.
|
|
* @example
|
|
*
|
|
* var array = [1, 2, 3];
|
|
*
|
|
* _.fill(array, 'a');
|
|
* console.log(array);
|
|
* // => ['a', 'a', 'a']
|
|
*
|
|
* _.fill(Array(3), 2);
|
|
* // => [2, 2, 2]
|
|
*
|
|
* _.fill([4, 6, 8, 10], '*', 1, 3);
|
|
* // => [4, '*', '*', 10]
|
|
*/
|
|
function fill(array, value, start, end) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
|
|
start = 0;
|
|
end = length;
|
|
}
|
|
return baseFill(array, value, start, end);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.find` except that it returns the index of the first
|
|
* element `predicate` returns truthy for instead of the element itself.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param {number} [fromIndex=0] The index to search from.
|
|
* @returns {number} Returns the index of the found element, else `-1`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': false },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': true }
|
|
* ];
|
|
*
|
|
* _.findIndex(users, function(o) { return o.user == 'barney'; });
|
|
* // => 0
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.findIndex(users, { 'user': 'fred', 'active': false });
|
|
* // => 1
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.findIndex(users, ['active', false]);
|
|
* // => 0
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.findIndex(users, 'active');
|
|
* // => 2
|
|
*/
|
|
function findIndex(array, predicate, fromIndex) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return -1;
|
|
}
|
|
var index = fromIndex == null ? 0 : toInteger(fromIndex);
|
|
if (index < 0) {
|
|
index = nativeMax(length + index, 0);
|
|
}
|
|
return baseFindIndex(array, getIteratee(predicate, 3), index);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.findIndex` except that it iterates over elements
|
|
* of `collection` from right to left.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param {number} [fromIndex=array.length-1] The index to search from.
|
|
* @returns {number} Returns the index of the found element, else `-1`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': true },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': false }
|
|
* ];
|
|
*
|
|
* _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
|
|
* // => 2
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.findLastIndex(users, { 'user': 'barney', 'active': true });
|
|
* // => 0
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.findLastIndex(users, ['active', false]);
|
|
* // => 2
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.findLastIndex(users, 'active');
|
|
* // => 0
|
|
*/
|
|
function findLastIndex(array, predicate, fromIndex) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return -1;
|
|
}
|
|
var index = length - 1;
|
|
if (fromIndex !== undefined) {
|
|
index = toInteger(fromIndex);
|
|
index = fromIndex < 0
|
|
? nativeMax(length + index, 0)
|
|
: nativeMin(index, length - 1);
|
|
}
|
|
return baseFindIndex(array, getIteratee(predicate, 3), index, true);
|
|
}
|
|
|
|
/**
|
|
* Flattens `array` a single level deep.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to flatten.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* _.flatten([1, [2, [3, [4]], 5]]);
|
|
* // => [1, 2, [3, [4]], 5]
|
|
*/
|
|
function flatten(array) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? baseFlatten(array, 1) : [];
|
|
}
|
|
|
|
/**
|
|
* Recursively flattens `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to flatten.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* _.flattenDeep([1, [2, [3, [4]], 5]]);
|
|
* // => [1, 2, 3, 4, 5]
|
|
*/
|
|
function flattenDeep(array) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? baseFlatten(array, INFINITY) : [];
|
|
}
|
|
|
|
/**
|
|
* Recursively flatten `array` up to `depth` times.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.4.0
|
|
* @category Array
|
|
* @param {Array} array The array to flatten.
|
|
* @param {number} [depth=1] The maximum recursion depth.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* var array = [1, [2, [3, [4]], 5]];
|
|
*
|
|
* _.flattenDepth(array, 1);
|
|
* // => [1, 2, [3, [4]], 5]
|
|
*
|
|
* _.flattenDepth(array, 2);
|
|
* // => [1, 2, 3, [4], 5]
|
|
*/
|
|
function flattenDepth(array, depth) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
depth = depth === undefined ? 1 : toInteger(depth);
|
|
return baseFlatten(array, depth);
|
|
}
|
|
|
|
/**
|
|
* The inverse of `_.toPairs`; this method returns an object composed
|
|
* from key-value `pairs`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} pairs The key-value pairs.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* _.fromPairs([['a', 1], ['b', 2]]);
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*/
|
|
function fromPairs(pairs) {
|
|
var index = -1,
|
|
length = pairs == null ? 0 : pairs.length,
|
|
result = {};
|
|
|
|
while (++index < length) {
|
|
var pair = pairs[index];
|
|
result[pair[0]] = pair[1];
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Gets the first element of `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @alias first
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @returns {*} Returns the first element of `array`.
|
|
* @example
|
|
*
|
|
* _.head([1, 2, 3]);
|
|
* // => 1
|
|
*
|
|
* _.head([]);
|
|
* // => undefined
|
|
*/
|
|
function head(array) {
|
|
return (array && array.length) ? array[0] : undefined;
|
|
}
|
|
|
|
/**
|
|
* Gets the index at which the first occurrence of `value` is found in `array`
|
|
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons. If `fromIndex` is negative, it's used as the
|
|
* offset from the end of `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} [fromIndex=0] The index to search from.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
* @example
|
|
*
|
|
* _.indexOf([1, 2, 1, 2], 2);
|
|
* // => 1
|
|
*
|
|
* // Search from the `fromIndex`.
|
|
* _.indexOf([1, 2, 1, 2], 2, 2);
|
|
* // => 3
|
|
*/
|
|
function indexOf(array, value, fromIndex) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return -1;
|
|
}
|
|
var index = fromIndex == null ? 0 : toInteger(fromIndex);
|
|
if (index < 0) {
|
|
index = nativeMax(length + index, 0);
|
|
}
|
|
return baseIndexOf(array, value, index);
|
|
}
|
|
|
|
/**
|
|
* Gets all but the last element of `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* _.initial([1, 2, 3]);
|
|
* // => [1, 2]
|
|
*/
|
|
function initial(array) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? baseSlice(array, 0, -1) : [];
|
|
}
|
|
|
|
/**
|
|
* Creates an array of unique values that are included in all given arrays
|
|
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons. The order and references of result values are
|
|
* determined by the first array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @returns {Array} Returns the new array of intersecting values.
|
|
* @example
|
|
*
|
|
* _.intersection([2, 1], [2, 3]);
|
|
* // => [2]
|
|
*/
|
|
var intersection = baseRest(function(arrays) {
|
|
var mapped = arrayMap(arrays, castArrayLikeObject);
|
|
return (mapped.length && mapped[0] === arrays[0])
|
|
? baseIntersection(mapped)
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.intersection` except that it accepts `iteratee`
|
|
* which is invoked for each element of each `arrays` to generate the criterion
|
|
* by which they're compared. The order and references of result values are
|
|
* determined by the first array. The iteratee is invoked with one argument:
|
|
* (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new array of intersecting values.
|
|
* @example
|
|
*
|
|
* _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
|
|
* // => [2.1]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
|
* // => [{ 'x': 1 }]
|
|
*/
|
|
var intersectionBy = baseRest(function(arrays) {
|
|
var iteratee = last(arrays),
|
|
mapped = arrayMap(arrays, castArrayLikeObject);
|
|
|
|
if (iteratee === last(mapped)) {
|
|
iteratee = undefined;
|
|
} else {
|
|
mapped.pop();
|
|
}
|
|
return (mapped.length && mapped[0] === arrays[0])
|
|
? baseIntersection(mapped, getIteratee(iteratee, 2))
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.intersection` except that it accepts `comparator`
|
|
* which is invoked to compare elements of `arrays`. The order and references
|
|
* of result values are determined by the first array. The comparator is
|
|
* invoked with two arguments: (arrVal, othVal).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of intersecting values.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
|
* var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
|
*
|
|
* _.intersectionWith(objects, others, _.isEqual);
|
|
* // => [{ 'x': 1, 'y': 2 }]
|
|
*/
|
|
var intersectionWith = baseRest(function(arrays) {
|
|
var comparator = last(arrays),
|
|
mapped = arrayMap(arrays, castArrayLikeObject);
|
|
|
|
comparator = typeof comparator == 'function' ? comparator : undefined;
|
|
if (comparator) {
|
|
mapped.pop();
|
|
}
|
|
return (mapped.length && mapped[0] === arrays[0])
|
|
? baseIntersection(mapped, undefined, comparator)
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* Converts all elements in `array` into a string separated by `separator`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to convert.
|
|
* @param {string} [separator=','] The element separator.
|
|
* @returns {string} Returns the joined string.
|
|
* @example
|
|
*
|
|
* _.join(['a', 'b', 'c'], '~');
|
|
* // => 'a~b~c'
|
|
*/
|
|
function join(array, separator) {
|
|
return array == null ? '' : nativeJoin.call(array, separator);
|
|
}
|
|
|
|
/**
|
|
* Gets the last element of `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @returns {*} Returns the last element of `array`.
|
|
* @example
|
|
*
|
|
* _.last([1, 2, 3]);
|
|
* // => 3
|
|
*/
|
|
function last(array) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? array[length - 1] : undefined;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.indexOf` except that it iterates over elements of
|
|
* `array` from right to left.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} [fromIndex=array.length-1] The index to search from.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
* @example
|
|
*
|
|
* _.lastIndexOf([1, 2, 1, 2], 2);
|
|
* // => 3
|
|
*
|
|
* // Search from the `fromIndex`.
|
|
* _.lastIndexOf([1, 2, 1, 2], 2, 2);
|
|
* // => 1
|
|
*/
|
|
function lastIndexOf(array, value, fromIndex) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return -1;
|
|
}
|
|
var index = length;
|
|
if (fromIndex !== undefined) {
|
|
index = toInteger(fromIndex);
|
|
index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
|
|
}
|
|
return value === value
|
|
? strictLastIndexOf(array, value, index)
|
|
: baseFindIndex(array, baseIsNaN, index, true);
|
|
}
|
|
|
|
/**
|
|
* Gets the element at index `n` of `array`. If `n` is negative, the nth
|
|
* element from the end is returned.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.11.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {number} [n=0] The index of the element to return.
|
|
* @returns {*} Returns the nth element of `array`.
|
|
* @example
|
|
*
|
|
* var array = ['a', 'b', 'c', 'd'];
|
|
*
|
|
* _.nth(array, 1);
|
|
* // => 'b'
|
|
*
|
|
* _.nth(array, -2);
|
|
* // => 'c';
|
|
*/
|
|
function nth(array, n) {
|
|
return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
|
|
}
|
|
|
|
/**
|
|
* Removes all given values from `array` using
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons.
|
|
*
|
|
* **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
|
|
* to remove elements from an array by predicate.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @param {...*} [values] The values to remove.
|
|
* @returns {Array} Returns `array`.
|
|
* @example
|
|
*
|
|
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
|
*
|
|
* _.pull(array, 'a', 'c');
|
|
* console.log(array);
|
|
* // => ['b', 'b']
|
|
*/
|
|
var pull = baseRest(pullAll);
|
|
|
|
/**
|
|
* This method is like `_.pull` except that it accepts an array of values to remove.
|
|
*
|
|
* **Note:** Unlike `_.difference`, this method mutates `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @param {Array} values The values to remove.
|
|
* @returns {Array} Returns `array`.
|
|
* @example
|
|
*
|
|
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
|
*
|
|
* _.pullAll(array, ['a', 'c']);
|
|
* console.log(array);
|
|
* // => ['b', 'b']
|
|
*/
|
|
function pullAll(array, values) {
|
|
return (array && array.length && values && values.length)
|
|
? basePullAll(array, values)
|
|
: array;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.pullAll` except that it accepts `iteratee` which is
|
|
* invoked for each element of `array` and `values` to generate the criterion
|
|
* by which they're compared. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* **Note:** Unlike `_.differenceBy`, this method mutates `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @param {Array} values The values to remove.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Array} Returns `array`.
|
|
* @example
|
|
*
|
|
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
|
*
|
|
* _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
|
* console.log(array);
|
|
* // => [{ 'x': 2 }]
|
|
*/
|
|
function pullAllBy(array, values, iteratee) {
|
|
return (array && array.length && values && values.length)
|
|
? basePullAll(array, values, getIteratee(iteratee, 2))
|
|
: array;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.pullAll` except that it accepts `comparator` which
|
|
* is invoked to compare elements of `array` to `values`. The comparator is
|
|
* invoked with two arguments: (arrVal, othVal).
|
|
*
|
|
* **Note:** Unlike `_.differenceWith`, this method mutates `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.6.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @param {Array} values The values to remove.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns `array`.
|
|
* @example
|
|
*
|
|
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
|
*
|
|
* _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
|
|
* console.log(array);
|
|
* // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
|
|
*/
|
|
function pullAllWith(array, values, comparator) {
|
|
return (array && array.length && values && values.length)
|
|
? basePullAll(array, values, undefined, comparator)
|
|
: array;
|
|
}
|
|
|
|
/**
|
|
* Removes elements from `array` corresponding to `indexes` and returns an
|
|
* array of removed elements.
|
|
*
|
|
* **Note:** Unlike `_.at`, this method mutates `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @param {...(number|number[])} [indexes] The indexes of elements to remove.
|
|
* @returns {Array} Returns the new array of removed elements.
|
|
* @example
|
|
*
|
|
* var array = ['a', 'b', 'c', 'd'];
|
|
* var pulled = _.pullAt(array, [1, 3]);
|
|
*
|
|
* console.log(array);
|
|
* // => ['a', 'c']
|
|
*
|
|
* console.log(pulled);
|
|
* // => ['b', 'd']
|
|
*/
|
|
var pullAt = flatRest(function(array, indexes) {
|
|
var length = array == null ? 0 : array.length,
|
|
result = baseAt(array, indexes);
|
|
|
|
basePullAt(array, arrayMap(indexes, function(index) {
|
|
return isIndex(index, length) ? +index : index;
|
|
}).sort(compareAscending));
|
|
|
|
return result;
|
|
});
|
|
|
|
/**
|
|
* Removes all elements from `array` that `predicate` returns truthy for
|
|
* and returns an array of the removed elements. The predicate is invoked
|
|
* with three arguments: (value, index, array).
|
|
*
|
|
* **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
|
|
* to pull elements from an array by value.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new array of removed elements.
|
|
* @example
|
|
*
|
|
* var array = [1, 2, 3, 4];
|
|
* var evens = _.remove(array, function(n) {
|
|
* return n % 2 == 0;
|
|
* });
|
|
*
|
|
* console.log(array);
|
|
* // => [1, 3]
|
|
*
|
|
* console.log(evens);
|
|
* // => [2, 4]
|
|
*/
|
|
function remove(array, predicate) {
|
|
var result = [];
|
|
if (!(array && array.length)) {
|
|
return result;
|
|
}
|
|
var index = -1,
|
|
indexes = [],
|
|
length = array.length;
|
|
|
|
predicate = getIteratee(predicate, 3);
|
|
while (++index < length) {
|
|
var value = array[index];
|
|
if (predicate(value, index, array)) {
|
|
result.push(value);
|
|
indexes.push(index);
|
|
}
|
|
}
|
|
basePullAt(array, indexes);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Reverses `array` so that the first element becomes the last, the second
|
|
* element becomes the second to last, and so on.
|
|
*
|
|
* **Note:** This method mutates `array` and is based on
|
|
* [`Array#reverse`](https://mdn.io/Array/reverse).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to modify.
|
|
* @returns {Array} Returns `array`.
|
|
* @example
|
|
*
|
|
* var array = [1, 2, 3];
|
|
*
|
|
* _.reverse(array);
|
|
* // => [3, 2, 1]
|
|
*
|
|
* console.log(array);
|
|
* // => [3, 2, 1]
|
|
*/
|
|
function reverse(array) {
|
|
return array == null ? array : nativeReverse.call(array);
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
|
*
|
|
* **Note:** This method is used instead of
|
|
* [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
|
|
* returned.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to slice.
|
|
* @param {number} [start=0] The start position.
|
|
* @param {number} [end=array.length] The end position.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
*/
|
|
function slice(array, start, end) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
|
|
start = 0;
|
|
end = length;
|
|
}
|
|
else {
|
|
start = start == null ? 0 : toInteger(start);
|
|
end = end === undefined ? length : toInteger(end);
|
|
}
|
|
return baseSlice(array, start, end);
|
|
}
|
|
|
|
/**
|
|
* Uses a binary search to determine the lowest index at which `value`
|
|
* should be inserted into `array` in order to maintain its sort order.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The sorted array to inspect.
|
|
* @param {*} value The value to evaluate.
|
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
* into `array`.
|
|
* @example
|
|
*
|
|
* _.sortedIndex([30, 50], 40);
|
|
* // => 1
|
|
*/
|
|
function sortedIndex(array, value) {
|
|
return baseSortedIndex(array, value);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.sortedIndex` except that it accepts `iteratee`
|
|
* which is invoked for `value` and each element of `array` to compute their
|
|
* sort ranking. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The sorted array to inspect.
|
|
* @param {*} value The value to evaluate.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
* into `array`.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 4 }, { 'x': 5 }];
|
|
*
|
|
* _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
|
|
* // => 0
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.sortedIndexBy(objects, { 'x': 4 }, 'x');
|
|
* // => 0
|
|
*/
|
|
function sortedIndexBy(array, value, iteratee) {
|
|
return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.indexOf` except that it performs a binary
|
|
* search on a sorted `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
* @example
|
|
*
|
|
* _.sortedIndexOf([4, 5, 5, 5, 6], 5);
|
|
* // => 1
|
|
*/
|
|
function sortedIndexOf(array, value) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (length) {
|
|
var index = baseSortedIndex(array, value);
|
|
if (index < length && eq(array[index], value)) {
|
|
return index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.sortedIndex` except that it returns the highest
|
|
* index at which `value` should be inserted into `array` in order to
|
|
* maintain its sort order.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The sorted array to inspect.
|
|
* @param {*} value The value to evaluate.
|
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
* into `array`.
|
|
* @example
|
|
*
|
|
* _.sortedLastIndex([4, 5, 5, 5, 6], 5);
|
|
* // => 4
|
|
*/
|
|
function sortedLastIndex(array, value) {
|
|
return baseSortedIndex(array, value, true);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.sortedLastIndex` except that it accepts `iteratee`
|
|
* which is invoked for `value` and each element of `array` to compute their
|
|
* sort ranking. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The sorted array to inspect.
|
|
* @param {*} value The value to evaluate.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
* into `array`.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 4 }, { 'x': 5 }];
|
|
*
|
|
* _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
|
|
* // => 1
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
|
|
* // => 1
|
|
*/
|
|
function sortedLastIndexBy(array, value, iteratee) {
|
|
return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.lastIndexOf` except that it performs a binary
|
|
* search on a sorted `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
* @example
|
|
*
|
|
* _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
|
|
* // => 3
|
|
*/
|
|
function sortedLastIndexOf(array, value) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (length) {
|
|
var index = baseSortedIndex(array, value, true) - 1;
|
|
if (eq(array[index], value)) {
|
|
return index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.uniq` except that it's designed and optimized
|
|
* for sorted arrays.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
* @example
|
|
*
|
|
* _.sortedUniq([1, 1, 2]);
|
|
* // => [1, 2]
|
|
*/
|
|
function sortedUniq(array) {
|
|
return (array && array.length)
|
|
? baseSortedUniq(array)
|
|
: [];
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.uniqBy` except that it's designed and optimized
|
|
* for sorted arrays.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
* @example
|
|
*
|
|
* _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
|
|
* // => [1.1, 2.3]
|
|
*/
|
|
function sortedUniqBy(array, iteratee) {
|
|
return (array && array.length)
|
|
? baseSortedUniq(array, getIteratee(iteratee, 2))
|
|
: [];
|
|
}
|
|
|
|
/**
|
|
* Gets all but the first element of `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* _.tail([1, 2, 3]);
|
|
* // => [2, 3]
|
|
*/
|
|
function tail(array) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? baseSlice(array, 1, length) : [];
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` with `n` elements taken from the beginning.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {number} [n=1] The number of elements to take.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* _.take([1, 2, 3]);
|
|
* // => [1]
|
|
*
|
|
* _.take([1, 2, 3], 2);
|
|
* // => [1, 2]
|
|
*
|
|
* _.take([1, 2, 3], 5);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* _.take([1, 2, 3], 0);
|
|
* // => []
|
|
*/
|
|
function take(array, n, guard) {
|
|
if (!(array && array.length)) {
|
|
return [];
|
|
}
|
|
n = (guard || n === undefined) ? 1 : toInteger(n);
|
|
return baseSlice(array, 0, n < 0 ? 0 : n);
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` with `n` elements taken from the end.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {number} [n=1] The number of elements to take.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* _.takeRight([1, 2, 3]);
|
|
* // => [3]
|
|
*
|
|
* _.takeRight([1, 2, 3], 2);
|
|
* // => [2, 3]
|
|
*
|
|
* _.takeRight([1, 2, 3], 5);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* _.takeRight([1, 2, 3], 0);
|
|
* // => []
|
|
*/
|
|
function takeRight(array, n, guard) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return [];
|
|
}
|
|
n = (guard || n === undefined) ? 1 : toInteger(n);
|
|
n = length - n;
|
|
return baseSlice(array, n < 0 ? 0 : n, length);
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` with elements taken from the end. Elements are
|
|
* taken until `predicate` returns falsey. The predicate is invoked with
|
|
* three arguments: (value, index, array).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': true },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': false }
|
|
* ];
|
|
*
|
|
* _.takeRightWhile(users, function(o) { return !o.active; });
|
|
* // => objects for ['fred', 'pebbles']
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
|
|
* // => objects for ['pebbles']
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.takeRightWhile(users, ['active', false]);
|
|
* // => objects for ['fred', 'pebbles']
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.takeRightWhile(users, 'active');
|
|
* // => []
|
|
*/
|
|
function takeRightWhile(array, predicate) {
|
|
return (array && array.length)
|
|
? baseWhile(array, getIteratee(predicate, 3), false, true)
|
|
: [];
|
|
}
|
|
|
|
/**
|
|
* Creates a slice of `array` with elements taken from the beginning. Elements
|
|
* are taken until `predicate` returns falsey. The predicate is invoked with
|
|
* three arguments: (value, index, array).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the slice of `array`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': false },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': true }
|
|
* ];
|
|
*
|
|
* _.takeWhile(users, function(o) { return !o.active; });
|
|
* // => objects for ['barney', 'fred']
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.takeWhile(users, { 'user': 'barney', 'active': false });
|
|
* // => objects for ['barney']
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.takeWhile(users, ['active', false]);
|
|
* // => objects for ['barney', 'fred']
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.takeWhile(users, 'active');
|
|
* // => []
|
|
*/
|
|
function takeWhile(array, predicate) {
|
|
return (array && array.length)
|
|
? baseWhile(array, getIteratee(predicate, 3))
|
|
: [];
|
|
}
|
|
|
|
/**
|
|
* Creates an array of unique values, in order, from all given arrays using
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @returns {Array} Returns the new array of combined values.
|
|
* @example
|
|
*
|
|
* _.union([2], [1, 2]);
|
|
* // => [2, 1]
|
|
*/
|
|
var union = baseRest(function(arrays) {
|
|
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.union` except that it accepts `iteratee` which is
|
|
* invoked for each element of each `arrays` to generate the criterion by
|
|
* which uniqueness is computed. Result values are chosen from the first
|
|
* array in which the value occurs. The iteratee is invoked with one argument:
|
|
* (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new array of combined values.
|
|
* @example
|
|
*
|
|
* _.unionBy([2.1], [1.2, 2.3], Math.floor);
|
|
* // => [2.1, 1.2]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
|
* // => [{ 'x': 1 }, { 'x': 2 }]
|
|
*/
|
|
var unionBy = baseRest(function(arrays) {
|
|
var iteratee = last(arrays);
|
|
if (isArrayLikeObject(iteratee)) {
|
|
iteratee = undefined;
|
|
}
|
|
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.union` except that it accepts `comparator` which
|
|
* is invoked to compare elements of `arrays`. Result values are chosen from
|
|
* the first array in which the value occurs. The comparator is invoked
|
|
* with two arguments: (arrVal, othVal).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of combined values.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
|
* var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
|
*
|
|
* _.unionWith(objects, others, _.isEqual);
|
|
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
|
|
*/
|
|
var unionWith = baseRest(function(arrays) {
|
|
var comparator = last(arrays);
|
|
comparator = typeof comparator == 'function' ? comparator : undefined;
|
|
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
|
|
});
|
|
|
|
/**
|
|
* Creates a duplicate-free version of an array, using
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons, in which only the first occurrence of each element
|
|
* is kept. The order of result values is determined by the order they occur
|
|
* in the array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
* @example
|
|
*
|
|
* _.uniq([2, 1, 2]);
|
|
* // => [2, 1]
|
|
*/
|
|
function uniq(array) {
|
|
return (array && array.length) ? baseUniq(array) : [];
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.uniq` except that it accepts `iteratee` which is
|
|
* invoked for each element in `array` to generate the criterion by which
|
|
* uniqueness is computed. The order of result values is determined by the
|
|
* order they occur in the array. The iteratee is invoked with one argument:
|
|
* (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
* @example
|
|
*
|
|
* _.uniqBy([2.1, 1.2, 2.3], Math.floor);
|
|
* // => [2.1, 1.2]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
|
|
* // => [{ 'x': 1 }, { 'x': 2 }]
|
|
*/
|
|
function uniqBy(array, iteratee) {
|
|
return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.uniq` except that it accepts `comparator` which
|
|
* is invoked to compare elements of `array`. The order of result values is
|
|
* determined by the order they occur in the array.The comparator is invoked
|
|
* with two arguments: (arrVal, othVal).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new duplicate free array.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
|
*
|
|
* _.uniqWith(objects, _.isEqual);
|
|
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
|
|
*/
|
|
function uniqWith(array, comparator) {
|
|
comparator = typeof comparator == 'function' ? comparator : undefined;
|
|
return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.zip` except that it accepts an array of grouped
|
|
* elements and creates an array regrouping the elements to their pre-zip
|
|
* configuration.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.2.0
|
|
* @category Array
|
|
* @param {Array} array The array of grouped elements to process.
|
|
* @returns {Array} Returns the new array of regrouped elements.
|
|
* @example
|
|
*
|
|
* var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
|
|
* // => [['a', 1, true], ['b', 2, false]]
|
|
*
|
|
* _.unzip(zipped);
|
|
* // => [['a', 'b'], [1, 2], [true, false]]
|
|
*/
|
|
function unzip(array) {
|
|
if (!(array && array.length)) {
|
|
return [];
|
|
}
|
|
var length = 0;
|
|
array = arrayFilter(array, function(group) {
|
|
if (isArrayLikeObject(group)) {
|
|
length = nativeMax(group.length, length);
|
|
return true;
|
|
}
|
|
});
|
|
return baseTimes(length, function(index) {
|
|
return arrayMap(array, baseProperty(index));
|
|
});
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.unzip` except that it accepts `iteratee` to specify
|
|
* how regrouped values should be combined. The iteratee is invoked with the
|
|
* elements of each group: (...group).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.8.0
|
|
* @category Array
|
|
* @param {Array} array The array of grouped elements to process.
|
|
* @param {Function} [iteratee=_.identity] The function to combine
|
|
* regrouped values.
|
|
* @returns {Array} Returns the new array of regrouped elements.
|
|
* @example
|
|
*
|
|
* var zipped = _.zip([1, 2], [10, 20], [100, 200]);
|
|
* // => [[1, 10, 100], [2, 20, 200]]
|
|
*
|
|
* _.unzipWith(zipped, _.add);
|
|
* // => [3, 30, 300]
|
|
*/
|
|
function unzipWith(array, iteratee) {
|
|
if (!(array && array.length)) {
|
|
return [];
|
|
}
|
|
var result = unzip(array);
|
|
if (iteratee == null) {
|
|
return result;
|
|
}
|
|
return arrayMap(result, function(group) {
|
|
return apply(iteratee, undefined, group);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates an array excluding all given values using
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons.
|
|
*
|
|
* **Note:** Unlike `_.pull`, this method returns a new array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {...*} [values] The values to exclude.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @see _.difference, _.xor
|
|
* @example
|
|
*
|
|
* _.without([2, 1, 2, 3], 1, 2);
|
|
* // => [3]
|
|
*/
|
|
var without = baseRest(function(array, values) {
|
|
return isArrayLikeObject(array)
|
|
? baseDifference(array, values)
|
|
: [];
|
|
});
|
|
|
|
/**
|
|
* Creates an array of unique values that is the
|
|
* [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
|
* of the given arrays. The order of result values is determined by the order
|
|
* they occur in the arrays.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.4.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @see _.difference, _.without
|
|
* @example
|
|
*
|
|
* _.xor([2, 1], [2, 3]);
|
|
* // => [1, 3]
|
|
*/
|
|
var xor = baseRest(function(arrays) {
|
|
return baseXor(arrayFilter(arrays, isArrayLikeObject));
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.xor` except that it accepts `iteratee` which is
|
|
* invoked for each element of each `arrays` to generate the criterion by
|
|
* which by which they're compared. The order of result values is determined
|
|
* by the order they occur in the arrays. The iteratee is invoked with one
|
|
* argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @example
|
|
*
|
|
* _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
|
|
* // => [1.2, 3.4]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
|
* // => [{ 'x': 2 }]
|
|
*/
|
|
var xorBy = baseRest(function(arrays) {
|
|
var iteratee = last(arrays);
|
|
if (isArrayLikeObject(iteratee)) {
|
|
iteratee = undefined;
|
|
}
|
|
return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.xor` except that it accepts `comparator` which is
|
|
* invoked to compare elements of `arrays`. The order of result values is
|
|
* determined by the order they occur in the arrays. The comparator is invoked
|
|
* with two arguments: (arrVal, othVal).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @param {Function} [comparator] The comparator invoked per element.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
|
* var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
|
*
|
|
* _.xorWith(objects, others, _.isEqual);
|
|
* // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
|
|
*/
|
|
var xorWith = baseRest(function(arrays) {
|
|
var comparator = last(arrays);
|
|
comparator = typeof comparator == 'function' ? comparator : undefined;
|
|
return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
|
|
});
|
|
|
|
/**
|
|
* Creates an array of grouped elements, the first of which contains the
|
|
* first elements of the given arrays, the second of which contains the
|
|
* second elements of the given arrays, and so on.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to process.
|
|
* @returns {Array} Returns the new array of grouped elements.
|
|
* @example
|
|
*
|
|
* _.zip(['a', 'b'], [1, 2], [true, false]);
|
|
* // => [['a', 1, true], ['b', 2, false]]
|
|
*/
|
|
var zip = baseRest(unzip);
|
|
|
|
/**
|
|
* This method is like `_.fromPairs` except that it accepts two arrays,
|
|
* one of property identifiers and one of corresponding values.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.4.0
|
|
* @category Array
|
|
* @param {Array} [props=[]] The property identifiers.
|
|
* @param {Array} [values=[]] The property values.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* _.zipObject(['a', 'b'], [1, 2]);
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*/
|
|
function zipObject(props, values) {
|
|
return baseZipObject(props || [], values || [], assignValue);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.zipObject` except that it supports property paths.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.1.0
|
|
* @category Array
|
|
* @param {Array} [props=[]] The property identifiers.
|
|
* @param {Array} [values=[]] The property values.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
|
|
* // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
|
|
*/
|
|
function zipObjectDeep(props, values) {
|
|
return baseZipObject(props || [], values || [], baseSet);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.zip` except that it accepts `iteratee` to specify
|
|
* how grouped values should be combined. The iteratee is invoked with the
|
|
* elements of each group: (...group).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.8.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to process.
|
|
* @param {Function} [iteratee=_.identity] The function to combine
|
|
* grouped values.
|
|
* @returns {Array} Returns the new array of grouped elements.
|
|
* @example
|
|
*
|
|
* _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
|
|
* return a + b + c;
|
|
* });
|
|
* // => [111, 222]
|
|
*/
|
|
var zipWith = baseRest(function(arrays) {
|
|
var length = arrays.length,
|
|
iteratee = length > 1 ? arrays[length - 1] : undefined;
|
|
|
|
iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
|
|
return unzipWith(arrays, iteratee);
|
|
});
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates a `lodash` wrapper instance that wraps `value` with explicit method
|
|
* chain sequences enabled. The result of such sequences must be unwrapped
|
|
* with `_#value`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.3.0
|
|
* @category Seq
|
|
* @param {*} value The value to wrap.
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36 },
|
|
* { 'user': 'fred', 'age': 40 },
|
|
* { 'user': 'pebbles', 'age': 1 }
|
|
* ];
|
|
*
|
|
* var youngest = _
|
|
* .chain(users)
|
|
* .sortBy('age')
|
|
* .map(function(o) {
|
|
* return o.user + ' is ' + o.age;
|
|
* })
|
|
* .head()
|
|
* .value();
|
|
* // => 'pebbles is 1'
|
|
*/
|
|
function chain(value) {
|
|
var result = lodash(value);
|
|
result.__chain__ = true;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* This method invokes `interceptor` and returns `value`. The interceptor
|
|
* is invoked with one argument; (value). The purpose of this method is to
|
|
* "tap into" a method chain sequence in order to modify intermediate results.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Seq
|
|
* @param {*} value The value to provide to `interceptor`.
|
|
* @param {Function} interceptor The function to invoke.
|
|
* @returns {*} Returns `value`.
|
|
* @example
|
|
*
|
|
* _([1, 2, 3])
|
|
* .tap(function(array) {
|
|
* // Mutate input array.
|
|
* array.pop();
|
|
* })
|
|
* .reverse()
|
|
* .value();
|
|
* // => [2, 1]
|
|
*/
|
|
function tap(value, interceptor) {
|
|
interceptor(value);
|
|
return value;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.tap` except that it returns the result of `interceptor`.
|
|
* The purpose of this method is to "pass thru" values replacing intermediate
|
|
* results in a method chain sequence.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Seq
|
|
* @param {*} value The value to provide to `interceptor`.
|
|
* @param {Function} interceptor The function to invoke.
|
|
* @returns {*} Returns the result of `interceptor`.
|
|
* @example
|
|
*
|
|
* _(' abc ')
|
|
* .chain()
|
|
* .trim()
|
|
* .thru(function(value) {
|
|
* return [value];
|
|
* })
|
|
* .value();
|
|
* // => ['abc']
|
|
*/
|
|
function thru(value, interceptor) {
|
|
return interceptor(value);
|
|
}
|
|
|
|
/**
|
|
* This method is the wrapper version of `_.at`.
|
|
*
|
|
* @name at
|
|
* @memberOf _
|
|
* @since 1.0.0
|
|
* @category Seq
|
|
* @param {...(string|string[])} [paths] The property paths to pick.
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
|
|
*
|
|
* _(object).at(['a[0].b.c', 'a[1]']).value();
|
|
* // => [3, 4]
|
|
*/
|
|
var wrapperAt = flatRest(function(paths) {
|
|
var length = paths.length,
|
|
start = length ? paths[0] : 0,
|
|
value = this.__wrapped__,
|
|
interceptor = function(object) { return baseAt(object, paths); };
|
|
|
|
if (length > 1 || this.__actions__.length ||
|
|
!(value instanceof LazyWrapper) || !isIndex(start)) {
|
|
return this.thru(interceptor);
|
|
}
|
|
value = value.slice(start, +start + (length ? 1 : 0));
|
|
value.__actions__.push({
|
|
'func': thru,
|
|
'args': [interceptor],
|
|
'thisArg': undefined
|
|
});
|
|
return new LodashWrapper(value, this.__chain__).thru(function(array) {
|
|
if (length && !array.length) {
|
|
array.push(undefined);
|
|
}
|
|
return array;
|
|
});
|
|
});
|
|
|
|
/**
|
|
* Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
|
|
*
|
|
* @name chain
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Seq
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36 },
|
|
* { 'user': 'fred', 'age': 40 }
|
|
* ];
|
|
*
|
|
* // A sequence without explicit chaining.
|
|
* _(users).head();
|
|
* // => { 'user': 'barney', 'age': 36 }
|
|
*
|
|
* // A sequence with explicit chaining.
|
|
* _(users)
|
|
* .chain()
|
|
* .head()
|
|
* .pick('user')
|
|
* .value();
|
|
* // => { 'user': 'barney' }
|
|
*/
|
|
function wrapperChain() {
|
|
return chain(this);
|
|
}
|
|
|
|
/**
|
|
* Executes the chain sequence and returns the wrapped result.
|
|
*
|
|
* @name commit
|
|
* @memberOf _
|
|
* @since 3.2.0
|
|
* @category Seq
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* var array = [1, 2];
|
|
* var wrapped = _(array).push(3);
|
|
*
|
|
* console.log(array);
|
|
* // => [1, 2]
|
|
*
|
|
* wrapped = wrapped.commit();
|
|
* console.log(array);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* wrapped.last();
|
|
* // => 3
|
|
*
|
|
* console.log(array);
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function wrapperCommit() {
|
|
return new LodashWrapper(this.value(), this.__chain__);
|
|
}
|
|
|
|
/**
|
|
* Gets the next value on a wrapped object following the
|
|
* [iterator protocol](https://mdn.io/iteration_protocols#iterator).
|
|
*
|
|
* @name next
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Seq
|
|
* @returns {Object} Returns the next iterator value.
|
|
* @example
|
|
*
|
|
* var wrapped = _([1, 2]);
|
|
*
|
|
* wrapped.next();
|
|
* // => { 'done': false, 'value': 1 }
|
|
*
|
|
* wrapped.next();
|
|
* // => { 'done': false, 'value': 2 }
|
|
*
|
|
* wrapped.next();
|
|
* // => { 'done': true, 'value': undefined }
|
|
*/
|
|
function wrapperNext() {
|
|
if (this.__values__ === undefined) {
|
|
this.__values__ = toArray(this.value());
|
|
}
|
|
var done = this.__index__ >= this.__values__.length,
|
|
value = done ? undefined : this.__values__[this.__index__++];
|
|
|
|
return { 'done': done, 'value': value };
|
|
}
|
|
|
|
/**
|
|
* Enables the wrapper to be iterable.
|
|
*
|
|
* @name Symbol.iterator
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Seq
|
|
* @returns {Object} Returns the wrapper object.
|
|
* @example
|
|
*
|
|
* var wrapped = _([1, 2]);
|
|
*
|
|
* wrapped[Symbol.iterator]() === wrapped;
|
|
* // => true
|
|
*
|
|
* Array.from(wrapped);
|
|
* // => [1, 2]
|
|
*/
|
|
function wrapperToIterator() {
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Creates a clone of the chain sequence planting `value` as the wrapped value.
|
|
*
|
|
* @name plant
|
|
* @memberOf _
|
|
* @since 3.2.0
|
|
* @category Seq
|
|
* @param {*} value The value to plant.
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* var wrapped = _([1, 2]).map(square);
|
|
* var other = wrapped.plant([3, 4]);
|
|
*
|
|
* other.value();
|
|
* // => [9, 16]
|
|
*
|
|
* wrapped.value();
|
|
* // => [1, 4]
|
|
*/
|
|
function wrapperPlant(value) {
|
|
var result,
|
|
parent = this;
|
|
|
|
while (parent instanceof baseLodash) {
|
|
var clone = wrapperClone(parent);
|
|
clone.__index__ = 0;
|
|
clone.__values__ = undefined;
|
|
if (result) {
|
|
previous.__wrapped__ = clone;
|
|
} else {
|
|
result = clone;
|
|
}
|
|
var previous = clone;
|
|
parent = parent.__wrapped__;
|
|
}
|
|
previous.__wrapped__ = value;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* This method is the wrapper version of `_.reverse`.
|
|
*
|
|
* **Note:** This method mutates the wrapped array.
|
|
*
|
|
* @name reverse
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Seq
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
* @example
|
|
*
|
|
* var array = [1, 2, 3];
|
|
*
|
|
* _(array).reverse().value()
|
|
* // => [3, 2, 1]
|
|
*
|
|
* console.log(array);
|
|
* // => [3, 2, 1]
|
|
*/
|
|
function wrapperReverse() {
|
|
var value = this.__wrapped__;
|
|
if (value instanceof LazyWrapper) {
|
|
var wrapped = value;
|
|
if (this.__actions__.length) {
|
|
wrapped = new LazyWrapper(this);
|
|
}
|
|
wrapped = wrapped.reverse();
|
|
wrapped.__actions__.push({
|
|
'func': thru,
|
|
'args': [reverse],
|
|
'thisArg': undefined
|
|
});
|
|
return new LodashWrapper(wrapped, this.__chain__);
|
|
}
|
|
return this.thru(reverse);
|
|
}
|
|
|
|
/**
|
|
* Executes the chain sequence to resolve the unwrapped value.
|
|
*
|
|
* @name value
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @alias toJSON, valueOf
|
|
* @category Seq
|
|
* @returns {*} Returns the resolved unwrapped value.
|
|
* @example
|
|
*
|
|
* _([1, 2, 3]).value();
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function wrapperValue() {
|
|
return baseWrapperValue(this.__wrapped__, this.__actions__);
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Creates an object composed of keys generated from the results of running
|
|
* each element of `collection` thru `iteratee`. The corresponding value of
|
|
* each key is the number of times the key was returned by `iteratee`. The
|
|
* iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.5.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
|
|
* @returns {Object} Returns the composed aggregate object.
|
|
* @example
|
|
*
|
|
* _.countBy([6.1, 4.2, 6.3], Math.floor);
|
|
* // => { '4': 1, '6': 2 }
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.countBy(['one', 'two', 'three'], 'length');
|
|
* // => { '3': 2, '5': 1 }
|
|
*/
|
|
var countBy = createAggregator(function(result, value, key) {
|
|
if (hasOwnProperty.call(result, key)) {
|
|
++result[key];
|
|
} else {
|
|
baseAssignValue(result, key, 1);
|
|
}
|
|
});
|
|
|
|
/**
|
|
* Checks if `predicate` returns truthy for **all** elements of `collection`.
|
|
* Iteration is stopped once `predicate` returns falsey. The predicate is
|
|
* invoked with three arguments: (value, index|key, collection).
|
|
*
|
|
* **Note:** This method returns `true` for
|
|
* [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
|
|
* [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
|
|
* elements of empty collections.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.every([true, 1, null, 'yes'], Boolean);
|
|
* // => false
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': false },
|
|
* { 'user': 'fred', 'age': 40, 'active': false }
|
|
* ];
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.every(users, { 'user': 'barney', 'active': false });
|
|
* // => false
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.every(users, ['active', false]);
|
|
* // => true
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.every(users, 'active');
|
|
* // => false
|
|
*/
|
|
function every(collection, predicate, guard) {
|
|
var func = isArray(collection) ? arrayEvery : baseEvery;
|
|
if (guard && isIterateeCall(collection, predicate, guard)) {
|
|
predicate = undefined;
|
|
}
|
|
return func(collection, getIteratee(predicate, 3));
|
|
}
|
|
|
|
/**
|
|
* Iterates over elements of `collection`, returning an array of all elements
|
|
* `predicate` returns truthy for. The predicate is invoked with three
|
|
* arguments: (value, index|key, collection).
|
|
*
|
|
* **Note:** Unlike `_.remove`, this method returns a new array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new filtered array.
|
|
* @see _.reject
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': true },
|
|
* { 'user': 'fred', 'age': 40, 'active': false }
|
|
* ];
|
|
*
|
|
* _.filter(users, function(o) { return !o.active; });
|
|
* // => objects for ['fred']
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.filter(users, { 'age': 36, 'active': true });
|
|
* // => objects for ['barney']
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.filter(users, ['active', false]);
|
|
* // => objects for ['fred']
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.filter(users, 'active');
|
|
* // => objects for ['barney']
|
|
*/
|
|
function filter(collection, predicate) {
|
|
var func = isArray(collection) ? arrayFilter : baseFilter;
|
|
return func(collection, getIteratee(predicate, 3));
|
|
}
|
|
|
|
/**
|
|
* Iterates over elements of `collection`, returning the first element
|
|
* `predicate` returns truthy for. The predicate is invoked with three
|
|
* arguments: (value, index|key, collection).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param {number} [fromIndex=0] The index to search from.
|
|
* @returns {*} Returns the matched element, else `undefined`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': true },
|
|
* { 'user': 'fred', 'age': 40, 'active': false },
|
|
* { 'user': 'pebbles', 'age': 1, 'active': true }
|
|
* ];
|
|
*
|
|
* _.find(users, function(o) { return o.age < 40; });
|
|
* // => object for 'barney'
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.find(users, { 'age': 1, 'active': true });
|
|
* // => object for 'pebbles'
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.find(users, ['active', false]);
|
|
* // => object for 'fred'
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.find(users, 'active');
|
|
* // => object for 'barney'
|
|
*/
|
|
var find = createFind(findIndex);
|
|
|
|
/**
|
|
* This method is like `_.find` except that it iterates over elements of
|
|
* `collection` from right to left.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param {number} [fromIndex=collection.length-1] The index to search from.
|
|
* @returns {*} Returns the matched element, else `undefined`.
|
|
* @example
|
|
*
|
|
* _.findLast([1, 2, 3, 4], function(n) {
|
|
* return n % 2 == 1;
|
|
* });
|
|
* // => 3
|
|
*/
|
|
var findLast = createFind(findLastIndex);
|
|
|
|
/**
|
|
* Creates a flattened array of values by running each element in `collection`
|
|
* thru `iteratee` and flattening the mapped results. The iteratee is invoked
|
|
* with three arguments: (value, index|key, collection).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* function duplicate(n) {
|
|
* return [n, n];
|
|
* }
|
|
*
|
|
* _.flatMap([1, 2], duplicate);
|
|
* // => [1, 1, 2, 2]
|
|
*/
|
|
function flatMap(collection, iteratee) {
|
|
return baseFlatten(map(collection, iteratee), 1);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.flatMap` except that it recursively flattens the
|
|
* mapped results.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.7.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* function duplicate(n) {
|
|
* return [[[n, n]]];
|
|
* }
|
|
*
|
|
* _.flatMapDeep([1, 2], duplicate);
|
|
* // => [1, 1, 2, 2]
|
|
*/
|
|
function flatMapDeep(collection, iteratee) {
|
|
return baseFlatten(map(collection, iteratee), INFINITY);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.flatMap` except that it recursively flattens the
|
|
* mapped results up to `depth` times.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.7.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @param {number} [depth=1] The maximum recursion depth.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* function duplicate(n) {
|
|
* return [[[n, n]]];
|
|
* }
|
|
*
|
|
* _.flatMapDepth([1, 2], duplicate, 2);
|
|
* // => [[1, 1], [2, 2]]
|
|
*/
|
|
function flatMapDepth(collection, iteratee, depth) {
|
|
depth = depth === undefined ? 1 : toInteger(depth);
|
|
return baseFlatten(map(collection, iteratee), depth);
|
|
}
|
|
|
|
/**
|
|
* Iterates over elements of `collection` and invokes `iteratee` for each element.
|
|
* The iteratee is invoked with three arguments: (value, index|key, collection).
|
|
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
*
|
|
* **Note:** As with other "Collections" methods, objects with a "length"
|
|
* property are iterated like arrays. To avoid this behavior use `_.forIn`
|
|
* or `_.forOwn` for object iteration.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @alias each
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array|Object} Returns `collection`.
|
|
* @see _.forEachRight
|
|
* @example
|
|
*
|
|
* _.forEach([1, 2], function(value) {
|
|
* console.log(value);
|
|
* });
|
|
* // => Logs `1` then `2`.
|
|
*
|
|
* _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
|
|
* console.log(key);
|
|
* });
|
|
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
|
*/
|
|
function forEach(collection, iteratee) {
|
|
var func = isArray(collection) ? arrayEach : baseEach;
|
|
return func(collection, getIteratee(iteratee, 3));
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.forEach` except that it iterates over elements of
|
|
* `collection` from right to left.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @alias eachRight
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array|Object} Returns `collection`.
|
|
* @see _.forEach
|
|
* @example
|
|
*
|
|
* _.forEachRight([1, 2], function(value) {
|
|
* console.log(value);
|
|
* });
|
|
* // => Logs `2` then `1`.
|
|
*/
|
|
function forEachRight(collection, iteratee) {
|
|
var func = isArray(collection) ? arrayEachRight : baseEachRight;
|
|
return func(collection, getIteratee(iteratee, 3));
|
|
}
|
|
|
|
/**
|
|
* Creates an object composed of keys generated from the results of running
|
|
* each element of `collection` thru `iteratee`. The order of grouped values
|
|
* is determined by the order they occur in `collection`. The corresponding
|
|
* value of each key is an array of elements responsible for generating the
|
|
* key. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
|
|
* @returns {Object} Returns the composed aggregate object.
|
|
* @example
|
|
*
|
|
* _.groupBy([6.1, 4.2, 6.3], Math.floor);
|
|
* // => { '4': [4.2], '6': [6.1, 6.3] }
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.groupBy(['one', 'two', 'three'], 'length');
|
|
* // => { '3': ['one', 'two'], '5': ['three'] }
|
|
*/
|
|
var groupBy = createAggregator(function(result, value, key) {
|
|
if (hasOwnProperty.call(result, key)) {
|
|
result[key].push(value);
|
|
} else {
|
|
baseAssignValue(result, key, [value]);
|
|
}
|
|
});
|
|
|
|
/**
|
|
* Checks if `value` is in `collection`. If `collection` is a string, it's
|
|
* checked for a substring of `value`, otherwise
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* is used for equality comparisons. If `fromIndex` is negative, it's used as
|
|
* the offset from the end of `collection`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object|string} collection The collection to inspect.
|
|
* @param {*} value The value to search for.
|
|
* @param {number} [fromIndex=0] The index to search from.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
|
|
* @returns {boolean} Returns `true` if `value` is found, else `false`.
|
|
* @example
|
|
*
|
|
* _.includes([1, 2, 3], 1);
|
|
* // => true
|
|
*
|
|
* _.includes([1, 2, 3], 1, 2);
|
|
* // => false
|
|
*
|
|
* _.includes({ 'a': 1, 'b': 2 }, 1);
|
|
* // => true
|
|
*
|
|
* _.includes('abcd', 'bc');
|
|
* // => true
|
|
*/
|
|
function includes(collection, value, fromIndex, guard) {
|
|
collection = isArrayLike(collection) ? collection : values(collection);
|
|
fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
|
|
|
|
var length = collection.length;
|
|
if (fromIndex < 0) {
|
|
fromIndex = nativeMax(length + fromIndex, 0);
|
|
}
|
|
return isString(collection)
|
|
? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
|
|
: (!!length && baseIndexOf(collection, value, fromIndex) > -1);
|
|
}
|
|
|
|
/**
|
|
* Invokes the method at `path` of each element in `collection`, returning
|
|
* an array of the results of each invoked method. Any additional arguments
|
|
* are provided to each invoked method. If `path` is a function, it's invoked
|
|
* for, and `this` bound to, each element in `collection`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Array|Function|string} path The path of the method to invoke or
|
|
* the function invoked per iteration.
|
|
* @param {...*} [args] The arguments to invoke each method with.
|
|
* @returns {Array} Returns the array of results.
|
|
* @example
|
|
*
|
|
* _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
|
|
* // => [[1, 5, 7], [1, 2, 3]]
|
|
*
|
|
* _.invokeMap([123, 456], String.prototype.split, '');
|
|
* // => [['1', '2', '3'], ['4', '5', '6']]
|
|
*/
|
|
var invokeMap = baseRest(function(collection, path, args) {
|
|
var index = -1,
|
|
isFunc = typeof path == 'function',
|
|
result = isArrayLike(collection) ? Array(collection.length) : [];
|
|
|
|
baseEach(collection, function(value) {
|
|
result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
|
|
});
|
|
return result;
|
|
});
|
|
|
|
/**
|
|
* Creates an object composed of keys generated from the results of running
|
|
* each element of `collection` thru `iteratee`. The corresponding value of
|
|
* each key is the last element responsible for generating the key. The
|
|
* iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
|
|
* @returns {Object} Returns the composed aggregate object.
|
|
* @example
|
|
*
|
|
* var array = [
|
|
* { 'dir': 'left', 'code': 97 },
|
|
* { 'dir': 'right', 'code': 100 }
|
|
* ];
|
|
*
|
|
* _.keyBy(array, function(o) {
|
|
* return String.fromCharCode(o.code);
|
|
* });
|
|
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
|
|
*
|
|
* _.keyBy(array, 'dir');
|
|
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
|
|
*/
|
|
var keyBy = createAggregator(function(result, value, key) {
|
|
baseAssignValue(result, key, value);
|
|
});
|
|
|
|
/**
|
|
* Creates an array of values by running each element in `collection` thru
|
|
* `iteratee`. The iteratee is invoked with three arguments:
|
|
* (value, index|key, collection).
|
|
*
|
|
* Many lodash methods are guarded to work as iteratees for methods like
|
|
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
|
|
*
|
|
* The guarded methods are:
|
|
* `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
|
|
* `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
|
|
* `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
|
|
* `template`, `trim`, `trimEnd`, `trimStart`, and `words`
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new mapped array.
|
|
* @example
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* _.map([4, 8], square);
|
|
* // => [16, 64]
|
|
*
|
|
* _.map({ 'a': 4, 'b': 8 }, square);
|
|
* // => [16, 64] (iteration order is not guaranteed)
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney' },
|
|
* { 'user': 'fred' }
|
|
* ];
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.map(users, 'user');
|
|
* // => ['barney', 'fred']
|
|
*/
|
|
function map(collection, iteratee) {
|
|
var func = isArray(collection) ? arrayMap : baseMap;
|
|
return func(collection, getIteratee(iteratee, 3));
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.sortBy` except that it allows specifying the sort
|
|
* orders of the iteratees to sort by. If `orders` is unspecified, all values
|
|
* are sorted in ascending order. Otherwise, specify an order of "desc" for
|
|
* descending or "asc" for ascending sort order of corresponding values.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
|
|
* The iteratees to sort by.
|
|
* @param {string[]} [orders] The sort orders of `iteratees`.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
|
|
* @returns {Array} Returns the new sorted array.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'fred', 'age': 48 },
|
|
* { 'user': 'barney', 'age': 34 },
|
|
* { 'user': 'fred', 'age': 40 },
|
|
* { 'user': 'barney', 'age': 36 }
|
|
* ];
|
|
*
|
|
* // Sort by `user` in ascending order and by `age` in descending order.
|
|
* _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
|
|
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
|
|
*/
|
|
function orderBy(collection, iteratees, orders, guard) {
|
|
if (collection == null) {
|
|
return [];
|
|
}
|
|
if (!isArray(iteratees)) {
|
|
iteratees = iteratees == null ? [] : [iteratees];
|
|
}
|
|
orders = guard ? undefined : orders;
|
|
if (!isArray(orders)) {
|
|
orders = orders == null ? [] : [orders];
|
|
}
|
|
return baseOrderBy(collection, iteratees, orders);
|
|
}
|
|
|
|
/**
|
|
* Creates an array of elements split into two groups, the first of which
|
|
* contains elements `predicate` returns truthy for, the second of which
|
|
* contains elements `predicate` returns falsey for. The predicate is
|
|
* invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the array of grouped elements.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': false },
|
|
* { 'user': 'fred', 'age': 40, 'active': true },
|
|
* { 'user': 'pebbles', 'age': 1, 'active': false }
|
|
* ];
|
|
*
|
|
* _.partition(users, function(o) { return o.active; });
|
|
* // => objects for [['fred'], ['barney', 'pebbles']]
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.partition(users, { 'age': 1, 'active': false });
|
|
* // => objects for [['pebbles'], ['barney', 'fred']]
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.partition(users, ['active', false]);
|
|
* // => objects for [['barney', 'pebbles'], ['fred']]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.partition(users, 'active');
|
|
* // => objects for [['fred'], ['barney', 'pebbles']]
|
|
*/
|
|
var partition = createAggregator(function(result, value, key) {
|
|
result[key ? 0 : 1].push(value);
|
|
}, function() { return [[], []]; });
|
|
|
|
/**
|
|
* Reduces `collection` to a value which is the accumulated result of running
|
|
* each element in `collection` thru `iteratee`, where each successive
|
|
* invocation is supplied the return value of the previous. If `accumulator`
|
|
* is not given, the first element of `collection` is used as the initial
|
|
* value. The iteratee is invoked with four arguments:
|
|
* (accumulator, value, index|key, collection).
|
|
*
|
|
* Many lodash methods are guarded to work as iteratees for methods like
|
|
* `_.reduce`, `_.reduceRight`, and `_.transform`.
|
|
*
|
|
* The guarded methods are:
|
|
* `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
|
|
* and `sortBy`
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @param {*} [accumulator] The initial value.
|
|
* @returns {*} Returns the accumulated value.
|
|
* @see _.reduceRight
|
|
* @example
|
|
*
|
|
* _.reduce([1, 2], function(sum, n) {
|
|
* return sum + n;
|
|
* }, 0);
|
|
* // => 3
|
|
*
|
|
* _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
|
* (result[value] || (result[value] = [])).push(key);
|
|
* return result;
|
|
* }, {});
|
|
* // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
|
|
*/
|
|
function reduce(collection, iteratee, accumulator) {
|
|
var func = isArray(collection) ? arrayReduce : baseReduce,
|
|
initAccum = arguments.length < 3;
|
|
|
|
return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.reduce` except that it iterates over elements of
|
|
* `collection` from right to left.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @param {*} [accumulator] The initial value.
|
|
* @returns {*} Returns the accumulated value.
|
|
* @see _.reduce
|
|
* @example
|
|
*
|
|
* var array = [[0, 1], [2, 3], [4, 5]];
|
|
*
|
|
* _.reduceRight(array, function(flattened, other) {
|
|
* return flattened.concat(other);
|
|
* }, []);
|
|
* // => [4, 5, 2, 3, 0, 1]
|
|
*/
|
|
function reduceRight(collection, iteratee, accumulator) {
|
|
var func = isArray(collection) ? arrayReduceRight : baseReduce,
|
|
initAccum = arguments.length < 3;
|
|
|
|
return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
|
|
}
|
|
|
|
/**
|
|
* The opposite of `_.filter`; this method returns the elements of `collection`
|
|
* that `predicate` does **not** return truthy for.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new filtered array.
|
|
* @see _.filter
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': false },
|
|
* { 'user': 'fred', 'age': 40, 'active': true }
|
|
* ];
|
|
*
|
|
* _.reject(users, function(o) { return !o.active; });
|
|
* // => objects for ['fred']
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.reject(users, { 'age': 40, 'active': true });
|
|
* // => objects for ['barney']
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.reject(users, ['active', false]);
|
|
* // => objects for ['fred']
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.reject(users, 'active');
|
|
* // => objects for ['barney']
|
|
*/
|
|
function reject(collection, predicate) {
|
|
var func = isArray(collection) ? arrayFilter : baseFilter;
|
|
return func(collection, negate(getIteratee(predicate, 3)));
|
|
}
|
|
|
|
/**
|
|
* Gets a random element from `collection`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to sample.
|
|
* @returns {*} Returns the random element.
|
|
* @example
|
|
*
|
|
* _.sample([1, 2, 3, 4]);
|
|
* // => 2
|
|
*/
|
|
function sample(collection) {
|
|
var func = isArray(collection) ? arraySample : baseSample;
|
|
return func(collection);
|
|
}
|
|
|
|
/**
|
|
* Gets `n` random elements at unique keys from `collection` up to the
|
|
* size of `collection`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to sample.
|
|
* @param {number} [n=1] The number of elements to sample.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the random elements.
|
|
* @example
|
|
*
|
|
* _.sampleSize([1, 2, 3], 2);
|
|
* // => [3, 1]
|
|
*
|
|
* _.sampleSize([1, 2, 3], 4);
|
|
* // => [2, 3, 1]
|
|
*/
|
|
function sampleSize(collection, n, guard) {
|
|
if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
|
|
n = 1;
|
|
} else {
|
|
n = toInteger(n);
|
|
}
|
|
var func = isArray(collection) ? arraySampleSize : baseSampleSize;
|
|
return func(collection, n);
|
|
}
|
|
|
|
/**
|
|
* Creates an array of shuffled values, using a version of the
|
|
* [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to shuffle.
|
|
* @returns {Array} Returns the new shuffled array.
|
|
* @example
|
|
*
|
|
* _.shuffle([1, 2, 3, 4]);
|
|
* // => [4, 1, 3, 2]
|
|
*/
|
|
function shuffle(collection) {
|
|
var func = isArray(collection) ? arrayShuffle : baseShuffle;
|
|
return func(collection);
|
|
}
|
|
|
|
/**
|
|
* Gets the size of `collection` by returning its length for array-like
|
|
* values or the number of own enumerable string keyed properties for objects.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object|string} collection The collection to inspect.
|
|
* @returns {number} Returns the collection size.
|
|
* @example
|
|
*
|
|
* _.size([1, 2, 3]);
|
|
* // => 3
|
|
*
|
|
* _.size({ 'a': 1, 'b': 2 });
|
|
* // => 2
|
|
*
|
|
* _.size('pebbles');
|
|
* // => 7
|
|
*/
|
|
function size(collection) {
|
|
if (collection == null) {
|
|
return 0;
|
|
}
|
|
if (isArrayLike(collection)) {
|
|
return isString(collection) ? stringSize(collection) : collection.length;
|
|
}
|
|
var tag = getTag(collection);
|
|
if (tag == mapTag || tag == setTag) {
|
|
return collection.size;
|
|
}
|
|
return baseKeys(collection).length;
|
|
}
|
|
|
|
/**
|
|
* Checks if `predicate` returns truthy for **any** element of `collection`.
|
|
* Iteration is stopped once `predicate` returns truthy. The predicate is
|
|
* invoked with three arguments: (value, index|key, collection).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.some([null, 0, 'yes', false], Boolean);
|
|
* // => true
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': true },
|
|
* { 'user': 'fred', 'active': false }
|
|
* ];
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.some(users, { 'user': 'barney', 'active': false });
|
|
* // => false
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.some(users, ['active', false]);
|
|
* // => true
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.some(users, 'active');
|
|
* // => true
|
|
*/
|
|
function some(collection, predicate, guard) {
|
|
var func = isArray(collection) ? arraySome : baseSome;
|
|
if (guard && isIterateeCall(collection, predicate, guard)) {
|
|
predicate = undefined;
|
|
}
|
|
return func(collection, getIteratee(predicate, 3));
|
|
}
|
|
|
|
/**
|
|
* Creates an array of elements, sorted in ascending order by the results of
|
|
* running each element in a collection thru each iteratee. This method
|
|
* performs a stable sort, that is, it preserves the original sort order of
|
|
* equal elements. The iteratees are invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {...(Function|Function[])} [iteratees=[_.identity]]
|
|
* The iteratees to sort by.
|
|
* @returns {Array} Returns the new sorted array.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'fred', 'age': 48 },
|
|
* { 'user': 'barney', 'age': 36 },
|
|
* { 'user': 'fred', 'age': 40 },
|
|
* { 'user': 'barney', 'age': 34 }
|
|
* ];
|
|
*
|
|
* _.sortBy(users, [function(o) { return o.user; }]);
|
|
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
|
|
*
|
|
* _.sortBy(users, ['user', 'age']);
|
|
* // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
|
|
*/
|
|
var sortBy = baseRest(function(collection, iteratees) {
|
|
if (collection == null) {
|
|
return [];
|
|
}
|
|
var length = iteratees.length;
|
|
if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
|
|
iteratees = [];
|
|
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
|
iteratees = [iteratees[0]];
|
|
}
|
|
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
|
|
});
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.4.0
|
|
* @category Date
|
|
* @returns {number} Returns the timestamp.
|
|
* @example
|
|
*
|
|
* _.defer(function(stamp) {
|
|
* console.log(_.now() - stamp);
|
|
* }, _.now());
|
|
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
*/
|
|
var now = ctxNow || function() {
|
|
return root.Date.now();
|
|
};
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* The opposite of `_.before`; this method creates a function that invokes
|
|
* `func` once it's called `n` or more times.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {number} n The number of calls before `func` is invoked.
|
|
* @param {Function} func The function to restrict.
|
|
* @returns {Function} Returns the new restricted function.
|
|
* @example
|
|
*
|
|
* var saves = ['profile', 'settings'];
|
|
*
|
|
* var done = _.after(saves.length, function() {
|
|
* console.log('done saving!');
|
|
* });
|
|
*
|
|
* _.forEach(saves, function(type) {
|
|
* asyncSave({ 'type': type, 'complete': done });
|
|
* });
|
|
* // => Logs 'done saving!' after the two async saves have completed.
|
|
*/
|
|
function after(n, func) {
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
n = toInteger(n);
|
|
return function() {
|
|
if (--n < 1) {
|
|
return func.apply(this, arguments);
|
|
}
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `func`, with up to `n` arguments,
|
|
* ignoring any additional arguments.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to cap arguments for.
|
|
* @param {number} [n=func.length] The arity cap.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Function} Returns the new capped function.
|
|
* @example
|
|
*
|
|
* _.map(['6', '8', '10'], _.ary(parseInt, 1));
|
|
* // => [6, 8, 10]
|
|
*/
|
|
function ary(func, n, guard) {
|
|
n = guard ? undefined : n;
|
|
n = (func && n == null) ? func.length : n;
|
|
return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `func`, with the `this` binding and arguments
|
|
* of the created function, while it's called less than `n` times. Subsequent
|
|
* calls to the created function return the result of the last `func` invocation.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Function
|
|
* @param {number} n The number of calls at which `func` is no longer invoked.
|
|
* @param {Function} func The function to restrict.
|
|
* @returns {Function} Returns the new restricted function.
|
|
* @example
|
|
*
|
|
* jQuery(element).on('click', _.before(5, addContactToList));
|
|
* // => Allows adding up to 4 contacts to the list.
|
|
*/
|
|
function before(n, func) {
|
|
var result;
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
n = toInteger(n);
|
|
return function() {
|
|
if (--n > 0) {
|
|
result = func.apply(this, arguments);
|
|
}
|
|
if (n <= 1) {
|
|
func = undefined;
|
|
}
|
|
return result;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with the `this` binding of `thisArg`
|
|
* and `partials` prepended to the arguments it receives.
|
|
*
|
|
* The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
|
|
* may be used as a placeholder for partially applied arguments.
|
|
*
|
|
* **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
|
|
* property of bound functions.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to bind.
|
|
* @param {*} thisArg The `this` binding of `func`.
|
|
* @param {...*} [partials] The arguments to be partially applied.
|
|
* @returns {Function} Returns the new bound function.
|
|
* @example
|
|
*
|
|
* function greet(greeting, punctuation) {
|
|
* return greeting + ' ' + this.user + punctuation;
|
|
* }
|
|
*
|
|
* var object = { 'user': 'fred' };
|
|
*
|
|
* var bound = _.bind(greet, object, 'hi');
|
|
* bound('!');
|
|
* // => 'hi fred!'
|
|
*
|
|
* // Bound with placeholders.
|
|
* var bound = _.bind(greet, object, _, '!');
|
|
* bound('hi');
|
|
* // => 'hi fred!'
|
|
*/
|
|
var bind = baseRest(function(func, thisArg, partials) {
|
|
var bitmask = WRAP_BIND_FLAG;
|
|
if (partials.length) {
|
|
var holders = replaceHolders(partials, getHolder(bind));
|
|
bitmask |= WRAP_PARTIAL_FLAG;
|
|
}
|
|
return createWrap(func, bitmask, thisArg, partials, holders);
|
|
});
|
|
|
|
/**
|
|
* Creates a function that invokes the method at `object[key]` with `partials`
|
|
* prepended to the arguments it receives.
|
|
*
|
|
* This method differs from `_.bind` by allowing bound functions to reference
|
|
* methods that may be redefined or don't yet exist. See
|
|
* [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
|
|
* for more details.
|
|
*
|
|
* The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
|
|
* builds, may be used as a placeholder for partially applied arguments.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.10.0
|
|
* @category Function
|
|
* @param {Object} object The object to invoke the method on.
|
|
* @param {string} key The key of the method.
|
|
* @param {...*} [partials] The arguments to be partially applied.
|
|
* @returns {Function} Returns the new bound function.
|
|
* @example
|
|
*
|
|
* var object = {
|
|
* 'user': 'fred',
|
|
* 'greet': function(greeting, punctuation) {
|
|
* return greeting + ' ' + this.user + punctuation;
|
|
* }
|
|
* };
|
|
*
|
|
* var bound = _.bindKey(object, 'greet', 'hi');
|
|
* bound('!');
|
|
* // => 'hi fred!'
|
|
*
|
|
* object.greet = function(greeting, punctuation) {
|
|
* return greeting + 'ya ' + this.user + punctuation;
|
|
* };
|
|
*
|
|
* bound('!');
|
|
* // => 'hiya fred!'
|
|
*
|
|
* // Bound with placeholders.
|
|
* var bound = _.bindKey(object, 'greet', _, '!');
|
|
* bound('hi');
|
|
* // => 'hiya fred!'
|
|
*/
|
|
var bindKey = baseRest(function(object, key, partials) {
|
|
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
|
|
if (partials.length) {
|
|
var holders = replaceHolders(partials, getHolder(bindKey));
|
|
bitmask |= WRAP_PARTIAL_FLAG;
|
|
}
|
|
return createWrap(key, bitmask, object, partials, holders);
|
|
});
|
|
|
|
/**
|
|
* Creates a function that accepts arguments of `func` and either invokes
|
|
* `func` returning its result, if at least `arity` number of arguments have
|
|
* been provided, or returns a function that accepts the remaining `func`
|
|
* arguments, and so on. The arity of `func` may be specified if `func.length`
|
|
* is not sufficient.
|
|
*
|
|
* The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
|
|
* may be used as a placeholder for provided arguments.
|
|
*
|
|
* **Note:** This method doesn't set the "length" property of curried functions.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to curry.
|
|
* @param {number} [arity=func.length] The arity of `func`.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Function} Returns the new curried function.
|
|
* @example
|
|
*
|
|
* var abc = function(a, b, c) {
|
|
* return [a, b, c];
|
|
* };
|
|
*
|
|
* var curried = _.curry(abc);
|
|
*
|
|
* curried(1)(2)(3);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* curried(1, 2)(3);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* curried(1, 2, 3);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* // Curried with placeholders.
|
|
* curried(1)(_, 3)(2);
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function curry(func, arity, guard) {
|
|
arity = guard ? undefined : arity;
|
|
var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
|
|
result.placeholder = curry.placeholder;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.curry` except that arguments are applied to `func`
|
|
* in the manner of `_.partialRight` instead of `_.partial`.
|
|
*
|
|
* The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
|
|
* builds, may be used as a placeholder for provided arguments.
|
|
*
|
|
* **Note:** This method doesn't set the "length" property of curried functions.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to curry.
|
|
* @param {number} [arity=func.length] The arity of `func`.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Function} Returns the new curried function.
|
|
* @example
|
|
*
|
|
* var abc = function(a, b, c) {
|
|
* return [a, b, c];
|
|
* };
|
|
*
|
|
* var curried = _.curryRight(abc);
|
|
*
|
|
* curried(3)(2)(1);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* curried(2, 3)(1);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* curried(1, 2, 3);
|
|
* // => [1, 2, 3]
|
|
*
|
|
* // Curried with placeholders.
|
|
* curried(3)(1, _)(2);
|
|
* // => [1, 2, 3]
|
|
*/
|
|
function curryRight(func, arity, guard) {
|
|
arity = guard ? undefined : arity;
|
|
var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
|
|
result.placeholder = curryRight.placeholder;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
* milliseconds have elapsed since the last time the debounced function was
|
|
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
* Provide `options` to indicate whether `func` should be invoked on the
|
|
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
* with the last arguments provided to the debounced function. Subsequent
|
|
* calls to the debounced function return the result of the last `func`
|
|
* invocation.
|
|
*
|
|
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
* invoked on the trailing edge of the timeout only if the debounced function
|
|
* is invoked more than once during the `wait` timeout.
|
|
*
|
|
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
*
|
|
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to debounce.
|
|
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
* @param {Object} [options={}] The options object.
|
|
* @param {boolean} [options.leading=false]
|
|
* Specify invoking on the leading edge of the timeout.
|
|
* @param {number} [options.maxWait]
|
|
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
* @param {boolean} [options.trailing=true]
|
|
* Specify invoking on the trailing edge of the timeout.
|
|
* @returns {Function} Returns the new debounced function.
|
|
* @example
|
|
*
|
|
* // Avoid costly calculations while the window size is in flux.
|
|
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
*
|
|
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
* 'leading': true,
|
|
* 'trailing': false
|
|
* }));
|
|
*
|
|
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
* var source = new EventSource('/stream');
|
|
* jQuery(source).on('message', debounced);
|
|
*
|
|
* // Cancel the trailing debounced invocation.
|
|
* jQuery(window).on('popstate', debounced.cancel);
|
|
*/
|
|
function debounce(func, wait, options) {
|
|
var lastArgs,
|
|
lastThis,
|
|
maxWait,
|
|
result,
|
|
timerId,
|
|
lastCallTime,
|
|
lastInvokeTime = 0,
|
|
leading = false,
|
|
maxing = false,
|
|
trailing = true;
|
|
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
wait = toNumber(wait) || 0;
|
|
if (isObject(options)) {
|
|
leading = !!options.leading;
|
|
maxing = 'maxWait' in options;
|
|
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
}
|
|
|
|
function invokeFunc(time) {
|
|
var args = lastArgs,
|
|
thisArg = lastThis;
|
|
|
|
lastArgs = lastThis = undefined;
|
|
lastInvokeTime = time;
|
|
result = func.apply(thisArg, args);
|
|
return result;
|
|
}
|
|
|
|
function leadingEdge(time) {
|
|
// Reset any `maxWait` timer.
|
|
lastInvokeTime = time;
|
|
// Start the timer for the trailing edge.
|
|
timerId = setTimeout(timerExpired, wait);
|
|
// Invoke the leading edge.
|
|
return leading ? invokeFunc(time) : result;
|
|
}
|
|
|
|
function remainingWait(time) {
|
|
var timeSinceLastCall = time - lastCallTime,
|
|
timeSinceLastInvoke = time - lastInvokeTime,
|
|
result = wait - timeSinceLastCall;
|
|
|
|
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
|
|
}
|
|
|
|
function shouldInvoke(time) {
|
|
var timeSinceLastCall = time - lastCallTime,
|
|
timeSinceLastInvoke = time - lastInvokeTime;
|
|
|
|
// Either this is the first call, activity has stopped and we're at the
|
|
// trailing edge, the system time has gone backwards and we're treating
|
|
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
}
|
|
|
|
function timerExpired() {
|
|
var time = now();
|
|
if (shouldInvoke(time)) {
|
|
return trailingEdge(time);
|
|
}
|
|
// Restart the timer.
|
|
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
}
|
|
|
|
function trailingEdge(time) {
|
|
timerId = undefined;
|
|
|
|
// Only invoke if we have `lastArgs` which means `func` has been
|
|
// debounced at least once.
|
|
if (trailing && lastArgs) {
|
|
return invokeFunc(time);
|
|
}
|
|
lastArgs = lastThis = undefined;
|
|
return result;
|
|
}
|
|
|
|
function cancel() {
|
|
if (timerId !== undefined) {
|
|
clearTimeout(timerId);
|
|
}
|
|
lastInvokeTime = 0;
|
|
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
}
|
|
|
|
function flush() {
|
|
return timerId === undefined ? result : trailingEdge(now());
|
|
}
|
|
|
|
function debounced() {
|
|
var time = now(),
|
|
isInvoking = shouldInvoke(time);
|
|
|
|
lastArgs = arguments;
|
|
lastThis = this;
|
|
lastCallTime = time;
|
|
|
|
if (isInvoking) {
|
|
if (timerId === undefined) {
|
|
return leadingEdge(lastCallTime);
|
|
}
|
|
if (maxing) {
|
|
// Handle invocations in a tight loop.
|
|
timerId = setTimeout(timerExpired, wait);
|
|
return invokeFunc(lastCallTime);
|
|
}
|
|
}
|
|
if (timerId === undefined) {
|
|
timerId = setTimeout(timerExpired, wait);
|
|
}
|
|
return result;
|
|
}
|
|
debounced.cancel = cancel;
|
|
debounced.flush = flush;
|
|
return debounced;
|
|
}
|
|
|
|
/**
|
|
* Defers invoking the `func` until the current call stack has cleared. Any
|
|
* additional arguments are provided to `func` when it's invoked.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to defer.
|
|
* @param {...*} [args] The arguments to invoke `func` with.
|
|
* @returns {number} Returns the timer id.
|
|
* @example
|
|
*
|
|
* _.defer(function(text) {
|
|
* console.log(text);
|
|
* }, 'deferred');
|
|
* // => Logs 'deferred' after one millisecond.
|
|
*/
|
|
var defer = baseRest(function(func, args) {
|
|
return baseDelay(func, 1, args);
|
|
});
|
|
|
|
/**
|
|
* Invokes `func` after `wait` milliseconds. Any additional arguments are
|
|
* provided to `func` when it's invoked.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to delay.
|
|
* @param {number} wait The number of milliseconds to delay invocation.
|
|
* @param {...*} [args] The arguments to invoke `func` with.
|
|
* @returns {number} Returns the timer id.
|
|
* @example
|
|
*
|
|
* _.delay(function(text) {
|
|
* console.log(text);
|
|
* }, 1000, 'later');
|
|
* // => Logs 'later' after one second.
|
|
*/
|
|
var delay = baseRest(function(func, wait, args) {
|
|
return baseDelay(func, toNumber(wait) || 0, args);
|
|
});
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with arguments reversed.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to flip arguments for.
|
|
* @returns {Function} Returns the new flipped function.
|
|
* @example
|
|
*
|
|
* var flipped = _.flip(function() {
|
|
* return _.toArray(arguments);
|
|
* });
|
|
*
|
|
* flipped('a', 'b', 'c', 'd');
|
|
* // => ['d', 'c', 'b', 'a']
|
|
*/
|
|
function flip(func) {
|
|
return createWrap(func, WRAP_FLIP_FLAG);
|
|
}
|
|
|
|
/**
|
|
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
* provided, it determines the cache key for storing the result based on the
|
|
* arguments provided to the memoized function. By default, the first argument
|
|
* provided to the memoized function is used as the map cache key. The `func`
|
|
* is invoked with the `this` binding of the memoized function.
|
|
*
|
|
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
* constructor with one whose instances implement the
|
|
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to have its output memoized.
|
|
* @param {Function} [resolver] The function to resolve the cache key.
|
|
* @returns {Function} Returns the new memoized function.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': 2 };
|
|
* var other = { 'c': 3, 'd': 4 };
|
|
*
|
|
* var values = _.memoize(_.values);
|
|
* values(object);
|
|
* // => [1, 2]
|
|
*
|
|
* values(other);
|
|
* // => [3, 4]
|
|
*
|
|
* object.a = 2;
|
|
* values(object);
|
|
* // => [1, 2]
|
|
*
|
|
* // Modify the result cache.
|
|
* values.cache.set(object, ['a', 'b']);
|
|
* values(object);
|
|
* // => ['a', 'b']
|
|
*
|
|
* // Replace `_.memoize.Cache`.
|
|
* _.memoize.Cache = WeakMap;
|
|
*/
|
|
function memoize(func, resolver) {
|
|
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
var memoized = function() {
|
|
var args = arguments,
|
|
key = resolver ? resolver.apply(this, args) : args[0],
|
|
cache = memoized.cache;
|
|
|
|
if (cache.has(key)) {
|
|
return cache.get(key);
|
|
}
|
|
var result = func.apply(this, args);
|
|
memoized.cache = cache.set(key, result) || cache;
|
|
return result;
|
|
};
|
|
memoized.cache = new (memoize.Cache || MapCache);
|
|
return memoized;
|
|
}
|
|
|
|
// Expose `MapCache`.
|
|
memoize.Cache = MapCache;
|
|
|
|
/**
|
|
* Creates a function that negates the result of the predicate `func`. The
|
|
* `func` predicate is invoked with the `this` binding and arguments of the
|
|
* created function.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Function
|
|
* @param {Function} predicate The predicate to negate.
|
|
* @returns {Function} Returns the new negated function.
|
|
* @example
|
|
*
|
|
* function isEven(n) {
|
|
* return n % 2 == 0;
|
|
* }
|
|
*
|
|
* _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
|
|
* // => [1, 3, 5]
|
|
*/
|
|
function negate(predicate) {
|
|
if (typeof predicate != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
return function() {
|
|
var args = arguments;
|
|
switch (args.length) {
|
|
case 0: return !predicate.call(this);
|
|
case 1: return !predicate.call(this, args[0]);
|
|
case 2: return !predicate.call(this, args[0], args[1]);
|
|
case 3: return !predicate.call(this, args[0], args[1], args[2]);
|
|
}
|
|
return !predicate.apply(this, args);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a function that is restricted to invoking `func` once. Repeat calls
|
|
* to the function return the value of the first invocation. The `func` is
|
|
* invoked with the `this` binding and arguments of the created function.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to restrict.
|
|
* @returns {Function} Returns the new restricted function.
|
|
* @example
|
|
*
|
|
* var initialize = _.once(createApplication);
|
|
* initialize();
|
|
* initialize();
|
|
* // => `createApplication` is invoked once
|
|
*/
|
|
function once(func) {
|
|
return before(2, func);
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with its arguments transformed.
|
|
*
|
|
* @static
|
|
* @since 4.0.0
|
|
* @memberOf _
|
|
* @category Function
|
|
* @param {Function} func The function to wrap.
|
|
* @param {...(Function|Function[])} [transforms=[_.identity]]
|
|
* The argument transforms.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* function doubled(n) {
|
|
* return n * 2;
|
|
* }
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* var func = _.overArgs(function(x, y) {
|
|
* return [x, y];
|
|
* }, [square, doubled]);
|
|
*
|
|
* func(9, 3);
|
|
* // => [81, 6]
|
|
*
|
|
* func(10, 5);
|
|
* // => [100, 10]
|
|
*/
|
|
var overArgs = castRest(function(func, transforms) {
|
|
transforms = (transforms.length == 1 && isArray(transforms[0]))
|
|
? arrayMap(transforms[0], baseUnary(getIteratee()))
|
|
: arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
|
|
|
|
var funcsLength = transforms.length;
|
|
return baseRest(function(args) {
|
|
var index = -1,
|
|
length = nativeMin(args.length, funcsLength);
|
|
|
|
while (++index < length) {
|
|
args[index] = transforms[index].call(this, args[index]);
|
|
}
|
|
return apply(func, this, args);
|
|
});
|
|
});
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with `partials` prepended to the
|
|
* arguments it receives. This method is like `_.bind` except it does **not**
|
|
* alter the `this` binding.
|
|
*
|
|
* The `_.partial.placeholder` value, which defaults to `_` in monolithic
|
|
* builds, may be used as a placeholder for partially applied arguments.
|
|
*
|
|
* **Note:** This method doesn't set the "length" property of partially
|
|
* applied functions.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.2.0
|
|
* @category Function
|
|
* @param {Function} func The function to partially apply arguments to.
|
|
* @param {...*} [partials] The arguments to be partially applied.
|
|
* @returns {Function} Returns the new partially applied function.
|
|
* @example
|
|
*
|
|
* function greet(greeting, name) {
|
|
* return greeting + ' ' + name;
|
|
* }
|
|
*
|
|
* var sayHelloTo = _.partial(greet, 'hello');
|
|
* sayHelloTo('fred');
|
|
* // => 'hello fred'
|
|
*
|
|
* // Partially applied with placeholders.
|
|
* var greetFred = _.partial(greet, _, 'fred');
|
|
* greetFred('hi');
|
|
* // => 'hi fred'
|
|
*/
|
|
var partial = baseRest(function(func, partials) {
|
|
var holders = replaceHolders(partials, getHolder(partial));
|
|
return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.partial` except that partially applied arguments
|
|
* are appended to the arguments it receives.
|
|
*
|
|
* The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
|
|
* builds, may be used as a placeholder for partially applied arguments.
|
|
*
|
|
* **Note:** This method doesn't set the "length" property of partially
|
|
* applied functions.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to partially apply arguments to.
|
|
* @param {...*} [partials] The arguments to be partially applied.
|
|
* @returns {Function} Returns the new partially applied function.
|
|
* @example
|
|
*
|
|
* function greet(greeting, name) {
|
|
* return greeting + ' ' + name;
|
|
* }
|
|
*
|
|
* var greetFred = _.partialRight(greet, 'fred');
|
|
* greetFred('hi');
|
|
* // => 'hi fred'
|
|
*
|
|
* // Partially applied with placeholders.
|
|
* var sayHelloTo = _.partialRight(greet, 'hello', _);
|
|
* sayHelloTo('fred');
|
|
* // => 'hello fred'
|
|
*/
|
|
var partialRight = baseRest(function(func, partials) {
|
|
var holders = replaceHolders(partials, getHolder(partialRight));
|
|
return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
|
|
});
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with arguments arranged according
|
|
* to the specified `indexes` where the argument value at the first index is
|
|
* provided as the first argument, the argument value at the second index is
|
|
* provided as the second argument, and so on.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to rearrange arguments for.
|
|
* @param {...(number|number[])} indexes The arranged argument indexes.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var rearged = _.rearg(function(a, b, c) {
|
|
* return [a, b, c];
|
|
* }, [2, 0, 1]);
|
|
*
|
|
* rearged('b', 'c', 'a')
|
|
* // => ['a', 'b', 'c']
|
|
*/
|
|
var rearg = flatRest(function(func, indexes) {
|
|
return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
|
|
});
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with the `this` binding of the
|
|
* created function and arguments from `start` and beyond provided as
|
|
* an array.
|
|
*
|
|
* **Note:** This method is based on the
|
|
* [rest parameter](https://mdn.io/rest_parameters).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to apply a rest parameter to.
|
|
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var say = _.rest(function(what, names) {
|
|
* return what + ' ' + _.initial(names).join(', ') +
|
|
* (_.size(names) > 1 ? ', & ' : '') + _.last(names);
|
|
* });
|
|
*
|
|
* say('hello', 'fred', 'barney', 'pebbles');
|
|
* // => 'hello fred, barney, & pebbles'
|
|
*/
|
|
function rest(func, start) {
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
start = start === undefined ? start : toInteger(start);
|
|
return baseRest(func, start);
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with the `this` binding of the
|
|
* create function and an array of arguments much like
|
|
* [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
|
|
*
|
|
* **Note:** This method is based on the
|
|
* [spread operator](https://mdn.io/spread_operator).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.2.0
|
|
* @category Function
|
|
* @param {Function} func The function to spread arguments over.
|
|
* @param {number} [start=0] The start position of the spread.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var say = _.spread(function(who, what) {
|
|
* return who + ' says ' + what;
|
|
* });
|
|
*
|
|
* say(['fred', 'hello']);
|
|
* // => 'fred says hello'
|
|
*
|
|
* var numbers = Promise.all([
|
|
* Promise.resolve(40),
|
|
* Promise.resolve(36)
|
|
* ]);
|
|
*
|
|
* numbers.then(_.spread(function(x, y) {
|
|
* return x + y;
|
|
* }));
|
|
* // => a Promise of 76
|
|
*/
|
|
function spread(func, start) {
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
start = start == null ? 0 : nativeMax(toInteger(start), 0);
|
|
return baseRest(function(args) {
|
|
var array = args[start],
|
|
otherArgs = castSlice(args, 0, start);
|
|
|
|
if (array) {
|
|
arrayPush(otherArgs, array);
|
|
}
|
|
return apply(func, this, otherArgs);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a throttled function that only invokes `func` at most once per
|
|
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
* method to cancel delayed `func` invocations and a `flush` method to
|
|
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
* timeout. The `func` is invoked with the last arguments provided to the
|
|
* throttled function. Subsequent calls to the throttled function return the
|
|
* result of the last `func` invocation.
|
|
*
|
|
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
* invoked on the trailing edge of the timeout only if the throttled function
|
|
* is invoked more than once during the `wait` timeout.
|
|
*
|
|
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
*
|
|
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {Function} func The function to throttle.
|
|
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
* @param {Object} [options={}] The options object.
|
|
* @param {boolean} [options.leading=true]
|
|
* Specify invoking on the leading edge of the timeout.
|
|
* @param {boolean} [options.trailing=true]
|
|
* Specify invoking on the trailing edge of the timeout.
|
|
* @returns {Function} Returns the new throttled function.
|
|
* @example
|
|
*
|
|
* // Avoid excessively updating the position while scrolling.
|
|
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
*
|
|
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
* jQuery(element).on('click', throttled);
|
|
*
|
|
* // Cancel the trailing throttled invocation.
|
|
* jQuery(window).on('popstate', throttled.cancel);
|
|
*/
|
|
function throttle(func, wait, options) {
|
|
var leading = true,
|
|
trailing = true;
|
|
|
|
if (typeof func != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
if (isObject(options)) {
|
|
leading = 'leading' in options ? !!options.leading : leading;
|
|
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
}
|
|
return debounce(func, wait, {
|
|
'leading': leading,
|
|
'maxWait': wait,
|
|
'trailing': trailing
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a function that accepts up to one argument, ignoring any
|
|
* additional arguments.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Function
|
|
* @param {Function} func The function to cap arguments for.
|
|
* @returns {Function} Returns the new capped function.
|
|
* @example
|
|
*
|
|
* _.map(['6', '8', '10'], _.unary(parseInt));
|
|
* // => [6, 8, 10]
|
|
*/
|
|
function unary(func) {
|
|
return ary(func, 1);
|
|
}
|
|
|
|
/**
|
|
* Creates a function that provides `value` to `wrapper` as its first
|
|
* argument. Any additional arguments provided to the function are appended
|
|
* to those provided to the `wrapper`. The wrapper is invoked with the `this`
|
|
* binding of the created function.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Function
|
|
* @param {*} value The value to wrap.
|
|
* @param {Function} [wrapper=identity] The wrapper function.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var p = _.wrap(_.escape, function(func, text) {
|
|
* return '<p>' + func(text) + '</p>';
|
|
* });
|
|
*
|
|
* p('fred, barney, & pebbles');
|
|
* // => '<p>fred, barney, & pebbles</p>'
|
|
*/
|
|
function wrap(value, wrapper) {
|
|
return partial(castFunction(wrapper), value);
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Casts `value` as an array if it's not one.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.4.0
|
|
* @category Lang
|
|
* @param {*} value The value to inspect.
|
|
* @returns {Array} Returns the cast array.
|
|
* @example
|
|
*
|
|
* _.castArray(1);
|
|
* // => [1]
|
|
*
|
|
* _.castArray({ 'a': 1 });
|
|
* // => [{ 'a': 1 }]
|
|
*
|
|
* _.castArray('abc');
|
|
* // => ['abc']
|
|
*
|
|
* _.castArray(null);
|
|
* // => [null]
|
|
*
|
|
* _.castArray(undefined);
|
|
* // => [undefined]
|
|
*
|
|
* _.castArray();
|
|
* // => []
|
|
*
|
|
* var array = [1, 2, 3];
|
|
* console.log(_.castArray(array) === array);
|
|
* // => true
|
|
*/
|
|
function castArray() {
|
|
if (!arguments.length) {
|
|
return [];
|
|
}
|
|
var value = arguments[0];
|
|
return isArray(value) ? value : [value];
|
|
}
|
|
|
|
/**
|
|
* Creates a shallow clone of `value`.
|
|
*
|
|
* **Note:** This method is loosely based on the
|
|
* [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
|
|
* and supports cloning arrays, array buffers, booleans, date objects, maps,
|
|
* numbers, `Object` objects, regexes, sets, strings, symbols, and typed
|
|
* arrays. The own enumerable properties of `arguments` objects are cloned
|
|
* as plain objects. An empty object is returned for uncloneable values such
|
|
* as error objects, functions, DOM nodes, and WeakMaps.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to clone.
|
|
* @returns {*} Returns the cloned value.
|
|
* @see _.cloneDeep
|
|
* @example
|
|
*
|
|
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
|
*
|
|
* var shallow = _.clone(objects);
|
|
* console.log(shallow[0] === objects[0]);
|
|
* // => true
|
|
*/
|
|
function clone(value) {
|
|
return baseClone(value, CLONE_SYMBOLS_FLAG);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.clone` except that it accepts `customizer` which
|
|
* is invoked to produce the cloned value. If `customizer` returns `undefined`,
|
|
* cloning is handled by the method instead. The `customizer` is invoked with
|
|
* up to four arguments; (value [, index|key, object, stack]).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to clone.
|
|
* @param {Function} [customizer] The function to customize cloning.
|
|
* @returns {*} Returns the cloned value.
|
|
* @see _.cloneDeepWith
|
|
* @example
|
|
*
|
|
* function customizer(value) {
|
|
* if (_.isElement(value)) {
|
|
* return value.cloneNode(false);
|
|
* }
|
|
* }
|
|
*
|
|
* var el = _.cloneWith(document.body, customizer);
|
|
*
|
|
* console.log(el === document.body);
|
|
* // => false
|
|
* console.log(el.nodeName);
|
|
* // => 'BODY'
|
|
* console.log(el.childNodes.length);
|
|
* // => 0
|
|
*/
|
|
function cloneWith(value, customizer) {
|
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.clone` except that it recursively clones `value`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to recursively clone.
|
|
* @returns {*} Returns the deep cloned value.
|
|
* @see _.clone
|
|
* @example
|
|
*
|
|
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
|
*
|
|
* var deep = _.cloneDeep(objects);
|
|
* console.log(deep[0] === objects[0]);
|
|
* // => false
|
|
*/
|
|
function cloneDeep(value) {
|
|
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.cloneWith` except that it recursively clones `value`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to recursively clone.
|
|
* @param {Function} [customizer] The function to customize cloning.
|
|
* @returns {*} Returns the deep cloned value.
|
|
* @see _.cloneWith
|
|
* @example
|
|
*
|
|
* function customizer(value) {
|
|
* if (_.isElement(value)) {
|
|
* return value.cloneNode(true);
|
|
* }
|
|
* }
|
|
*
|
|
* var el = _.cloneDeepWith(document.body, customizer);
|
|
*
|
|
* console.log(el === document.body);
|
|
* // => false
|
|
* console.log(el.nodeName);
|
|
* // => 'BODY'
|
|
* console.log(el.childNodes.length);
|
|
* // => 20
|
|
*/
|
|
function cloneDeepWith(value, customizer) {
|
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
|
|
}
|
|
|
|
/**
|
|
* Checks if `object` conforms to `source` by invoking the predicate
|
|
* properties of `source` with the corresponding property values of `object`.
|
|
*
|
|
* **Note:** This method is equivalent to `_.conforms` when `source` is
|
|
* partially applied.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.14.0
|
|
* @category Lang
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Object} source The object of property predicates to conform to.
|
|
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': 2 };
|
|
*
|
|
* _.conformsTo(object, { 'b': function(n) { return n > 1; } });
|
|
* // => true
|
|
*
|
|
* _.conformsTo(object, { 'b': function(n) { return n > 2; } });
|
|
* // => false
|
|
*/
|
|
function conformsTo(object, source) {
|
|
return source == null || baseConformsTo(object, source, keys(source));
|
|
}
|
|
|
|
/**
|
|
* Performs a
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* comparison between two values to determine if they are equivalent.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1 };
|
|
* var other = { 'a': 1 };
|
|
*
|
|
* _.eq(object, object);
|
|
* // => true
|
|
*
|
|
* _.eq(object, other);
|
|
* // => false
|
|
*
|
|
* _.eq('a', 'a');
|
|
* // => true
|
|
*
|
|
* _.eq('a', Object('a'));
|
|
* // => false
|
|
*
|
|
* _.eq(NaN, NaN);
|
|
* // => true
|
|
*/
|
|
function eq(value, other) {
|
|
return value === other || (value !== value && other !== other);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is greater than `other`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.9.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is greater than `other`,
|
|
* else `false`.
|
|
* @see _.lt
|
|
* @example
|
|
*
|
|
* _.gt(3, 1);
|
|
* // => true
|
|
*
|
|
* _.gt(3, 3);
|
|
* // => false
|
|
*
|
|
* _.gt(1, 3);
|
|
* // => false
|
|
*/
|
|
var gt = createRelationalOperation(baseGt);
|
|
|
|
/**
|
|
* Checks if `value` is greater than or equal to `other`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.9.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is greater than or equal to
|
|
* `other`, else `false`.
|
|
* @see _.lte
|
|
* @example
|
|
*
|
|
* _.gte(3, 1);
|
|
* // => true
|
|
*
|
|
* _.gte(3, 3);
|
|
* // => true
|
|
*
|
|
* _.gte(1, 3);
|
|
* // => false
|
|
*/
|
|
var gte = createRelationalOperation(function(value, other) {
|
|
return value >= other;
|
|
});
|
|
|
|
/**
|
|
* Checks if `value` is likely an `arguments` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.isArguments(function() { return arguments; }());
|
|
* // => true
|
|
*
|
|
* _.isArguments([1, 2, 3]);
|
|
* // => false
|
|
*/
|
|
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
|
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
|
!propertyIsEnumerable.call(value, 'callee');
|
|
};
|
|
|
|
/**
|
|
* Checks if `value` is classified as an `Array` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
* @example
|
|
*
|
|
* _.isArray([1, 2, 3]);
|
|
* // => true
|
|
*
|
|
* _.isArray(document.body.children);
|
|
* // => false
|
|
*
|
|
* _.isArray('abc');
|
|
* // => false
|
|
*
|
|
* _.isArray(_.noop);
|
|
* // => false
|
|
*/
|
|
var isArray = Array.isArray;
|
|
|
|
/**
|
|
* Checks if `value` is classified as an `ArrayBuffer` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
|
|
* @example
|
|
*
|
|
* _.isArrayBuffer(new ArrayBuffer(2));
|
|
* // => true
|
|
*
|
|
* _.isArrayBuffer(new Array(2));
|
|
* // => false
|
|
*/
|
|
var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
|
|
|
|
/**
|
|
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
* not a function and has a `value.length` that's an integer greater than or
|
|
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
* @example
|
|
*
|
|
* _.isArrayLike([1, 2, 3]);
|
|
* // => true
|
|
*
|
|
* _.isArrayLike(document.body.children);
|
|
* // => true
|
|
*
|
|
* _.isArrayLike('abc');
|
|
* // => true
|
|
*
|
|
* _.isArrayLike(_.noop);
|
|
* // => false
|
|
*/
|
|
function isArrayLike(value) {
|
|
return value != null && isLength(value.length) && !isFunction(value);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.isArrayLike` except that it also checks if `value`
|
|
* is an object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an array-like object,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.isArrayLikeObject([1, 2, 3]);
|
|
* // => true
|
|
*
|
|
* _.isArrayLikeObject(document.body.children);
|
|
* // => true
|
|
*
|
|
* _.isArrayLikeObject('abc');
|
|
* // => false
|
|
*
|
|
* _.isArrayLikeObject(_.noop);
|
|
* // => false
|
|
*/
|
|
function isArrayLikeObject(value) {
|
|
return isObjectLike(value) && isArrayLike(value);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a boolean primitive or object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
|
|
* @example
|
|
*
|
|
* _.isBoolean(false);
|
|
* // => true
|
|
*
|
|
* _.isBoolean(null);
|
|
* // => false
|
|
*/
|
|
function isBoolean(value) {
|
|
return value === true || value === false ||
|
|
(isObjectLike(value) && baseGetTag(value) == boolTag);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a buffer.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
* @example
|
|
*
|
|
* _.isBuffer(new Buffer(2));
|
|
* // => true
|
|
*
|
|
* _.isBuffer(new Uint8Array(2));
|
|
* // => false
|
|
*/
|
|
var isBuffer = nativeIsBuffer || stubFalse;
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Date` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
|
|
* @example
|
|
*
|
|
* _.isDate(new Date);
|
|
* // => true
|
|
*
|
|
* _.isDate('Mon April 23 2012');
|
|
* // => false
|
|
*/
|
|
var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
|
|
|
|
/**
|
|
* Checks if `value` is likely a DOM element.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
|
|
* @example
|
|
*
|
|
* _.isElement(document.body);
|
|
* // => true
|
|
*
|
|
* _.isElement('<body>');
|
|
* // => false
|
|
*/
|
|
function isElement(value) {
|
|
return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is an empty object, collection, map, or set.
|
|
*
|
|
* Objects are considered empty if they have no own enumerable string keyed
|
|
* properties.
|
|
*
|
|
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
|
|
* jQuery-like collections are considered empty if they have a `length` of `0`.
|
|
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
|
|
* @example
|
|
*
|
|
* _.isEmpty(null);
|
|
* // => true
|
|
*
|
|
* _.isEmpty(true);
|
|
* // => true
|
|
*
|
|
* _.isEmpty(1);
|
|
* // => true
|
|
*
|
|
* _.isEmpty([1, 2, 3]);
|
|
* // => false
|
|
*
|
|
* _.isEmpty({ 'a': 1 });
|
|
* // => false
|
|
*/
|
|
function isEmpty(value) {
|
|
if (value == null) {
|
|
return true;
|
|
}
|
|
if (isArrayLike(value) &&
|
|
(isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
|
|
isBuffer(value) || isTypedArray(value) || isArguments(value))) {
|
|
return !value.length;
|
|
}
|
|
var tag = getTag(value);
|
|
if (tag == mapTag || tag == setTag) {
|
|
return !value.size;
|
|
}
|
|
if (isPrototype(value)) {
|
|
return !baseKeys(value).length;
|
|
}
|
|
for (var key in value) {
|
|
if (hasOwnProperty.call(value, key)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Performs a deep comparison between two values to determine if they are
|
|
* equivalent.
|
|
*
|
|
* **Note:** This method supports comparing arrays, array buffers, booleans,
|
|
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
* nodes are compared by strict equality, i.e. `===`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1 };
|
|
* var other = { 'a': 1 };
|
|
*
|
|
* _.isEqual(object, other);
|
|
* // => true
|
|
*
|
|
* object === other;
|
|
* // => false
|
|
*/
|
|
function isEqual(value, other) {
|
|
return baseIsEqual(value, other);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.isEqual` except that it accepts `customizer` which
|
|
* is invoked to compare values. If `customizer` returns `undefined`, comparisons
|
|
* are handled by the method instead. The `customizer` is invoked with up to
|
|
* six arguments: (objValue, othValue [, index|key, object, other, stack]).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
* @example
|
|
*
|
|
* function isGreeting(value) {
|
|
* return /^h(?:i|ello)$/.test(value);
|
|
* }
|
|
*
|
|
* function customizer(objValue, othValue) {
|
|
* if (isGreeting(objValue) && isGreeting(othValue)) {
|
|
* return true;
|
|
* }
|
|
* }
|
|
*
|
|
* var array = ['hello', 'goodbye'];
|
|
* var other = ['hi', 'goodbye'];
|
|
*
|
|
* _.isEqualWith(array, other, customizer);
|
|
* // => true
|
|
*/
|
|
function isEqualWith(value, other, customizer) {
|
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
var result = customizer ? customizer(value, other) : undefined;
|
|
return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
|
|
* `SyntaxError`, `TypeError`, or `URIError` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an error object, else `false`.
|
|
* @example
|
|
*
|
|
* _.isError(new Error);
|
|
* // => true
|
|
*
|
|
* _.isError(Error);
|
|
* // => false
|
|
*/
|
|
function isError(value) {
|
|
if (!isObjectLike(value)) {
|
|
return false;
|
|
}
|
|
var tag = baseGetTag(value);
|
|
return tag == errorTag || tag == domExcTag ||
|
|
(typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a finite primitive number.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`Number.isFinite`](https://mdn.io/Number/isFinite).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
|
|
* @example
|
|
*
|
|
* _.isFinite(3);
|
|
* // => true
|
|
*
|
|
* _.isFinite(Number.MIN_VALUE);
|
|
* // => true
|
|
*
|
|
* _.isFinite(Infinity);
|
|
* // => false
|
|
*
|
|
* _.isFinite('3');
|
|
* // => false
|
|
*/
|
|
function isFinite(value) {
|
|
return typeof value == 'number' && nativeIsFinite(value);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Function` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
* @example
|
|
*
|
|
* _.isFunction(_);
|
|
* // => true
|
|
*
|
|
* _.isFunction(/abc/);
|
|
* // => false
|
|
*/
|
|
function isFunction(value) {
|
|
if (!isObject(value)) {
|
|
return false;
|
|
}
|
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
var tag = baseGetTag(value);
|
|
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is an integer.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`Number.isInteger`](https://mdn.io/Number/isInteger).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an integer, else `false`.
|
|
* @example
|
|
*
|
|
* _.isInteger(3);
|
|
* // => true
|
|
*
|
|
* _.isInteger(Number.MIN_VALUE);
|
|
* // => false
|
|
*
|
|
* _.isInteger(Infinity);
|
|
* // => false
|
|
*
|
|
* _.isInteger('3');
|
|
* // => false
|
|
*/
|
|
function isInteger(value) {
|
|
return typeof value == 'number' && value == toInteger(value);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a valid array-like length.
|
|
*
|
|
* **Note:** This method is loosely based on
|
|
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
* @example
|
|
*
|
|
* _.isLength(3);
|
|
* // => true
|
|
*
|
|
* _.isLength(Number.MIN_VALUE);
|
|
* // => false
|
|
*
|
|
* _.isLength(Infinity);
|
|
* // => false
|
|
*
|
|
* _.isLength('3');
|
|
* // => false
|
|
*/
|
|
function isLength(value) {
|
|
return typeof value == 'number' &&
|
|
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is the
|
|
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
* @example
|
|
*
|
|
* _.isObject({});
|
|
* // => true
|
|
*
|
|
* _.isObject([1, 2, 3]);
|
|
* // => true
|
|
*
|
|
* _.isObject(_.noop);
|
|
* // => true
|
|
*
|
|
* _.isObject(null);
|
|
* // => false
|
|
*/
|
|
function isObject(value) {
|
|
var type = typeof value;
|
|
return value != null && (type == 'object' || type == 'function');
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
* and has a `typeof` result of "object".
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
* @example
|
|
*
|
|
* _.isObjectLike({});
|
|
* // => true
|
|
*
|
|
* _.isObjectLike([1, 2, 3]);
|
|
* // => true
|
|
*
|
|
* _.isObjectLike(_.noop);
|
|
* // => false
|
|
*
|
|
* _.isObjectLike(null);
|
|
* // => false
|
|
*/
|
|
function isObjectLike(value) {
|
|
return value != null && typeof value == 'object';
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Map` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
* @example
|
|
*
|
|
* _.isMap(new Map);
|
|
* // => true
|
|
*
|
|
* _.isMap(new WeakMap);
|
|
* // => false
|
|
*/
|
|
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
|
|
|
|
/**
|
|
* Performs a partial deep comparison between `object` and `source` to
|
|
* determine if `object` contains equivalent property values.
|
|
*
|
|
* **Note:** This method is equivalent to `_.matches` when `source` is
|
|
* partially applied.
|
|
*
|
|
* Partial comparisons will match empty array and empty object `source`
|
|
* values against any array or object value, respectively. See `_.isEqual`
|
|
* for a list of supported value comparisons.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Lang
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Object} source The object of property values to match.
|
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': 2 };
|
|
*
|
|
* _.isMatch(object, { 'b': 2 });
|
|
* // => true
|
|
*
|
|
* _.isMatch(object, { 'b': 1 });
|
|
* // => false
|
|
*/
|
|
function isMatch(object, source) {
|
|
return object === source || baseIsMatch(object, source, getMatchData(source));
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.isMatch` except that it accepts `customizer` which
|
|
* is invoked to compare values. If `customizer` returns `undefined`, comparisons
|
|
* are handled by the method instead. The `customizer` is invoked with five
|
|
* arguments: (objValue, srcValue, index|key, object, source).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Object} source The object of property values to match.
|
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
* @example
|
|
*
|
|
* function isGreeting(value) {
|
|
* return /^h(?:i|ello)$/.test(value);
|
|
* }
|
|
*
|
|
* function customizer(objValue, srcValue) {
|
|
* if (isGreeting(objValue) && isGreeting(srcValue)) {
|
|
* return true;
|
|
* }
|
|
* }
|
|
*
|
|
* var object = { 'greeting': 'hello' };
|
|
* var source = { 'greeting': 'hi' };
|
|
*
|
|
* _.isMatchWith(object, source, customizer);
|
|
* // => true
|
|
*/
|
|
function isMatchWith(object, source, customizer) {
|
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
return baseIsMatch(object, source, getMatchData(source), customizer);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is `NaN`.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
|
|
* global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
|
|
* `undefined` and other non-number values.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
|
|
* @example
|
|
*
|
|
* _.isNaN(NaN);
|
|
* // => true
|
|
*
|
|
* _.isNaN(new Number(NaN));
|
|
* // => true
|
|
*
|
|
* isNaN(undefined);
|
|
* // => true
|
|
*
|
|
* _.isNaN(undefined);
|
|
* // => false
|
|
*/
|
|
function isNaN(value) {
|
|
// An `NaN` primitive is the only value that is not equal to itself.
|
|
// Perform the `toStringTag` check first to avoid errors with some
|
|
// ActiveX objects in IE.
|
|
return isNumber(value) && value != +value;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a pristine native function.
|
|
*
|
|
* **Note:** This method can't reliably detect native functions in the presence
|
|
* of the core-js package because core-js circumvents this kind of detection.
|
|
* Despite multiple requests, the core-js maintainer has made it clear: any
|
|
* attempt to fix the detection will be obstructed. As a result, we're left
|
|
* with little choice but to throw an error. Unfortunately, this also affects
|
|
* packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
|
|
* which rely on core-js.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.isNative(Array.prototype.push);
|
|
* // => true
|
|
*
|
|
* _.isNative(_);
|
|
* // => false
|
|
*/
|
|
function isNative(value) {
|
|
if (isMaskable(value)) {
|
|
throw new Error(CORE_ERROR_TEXT);
|
|
}
|
|
return baseIsNative(value);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is `null`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is `null`, else `false`.
|
|
* @example
|
|
*
|
|
* _.isNull(null);
|
|
* // => true
|
|
*
|
|
* _.isNull(void 0);
|
|
* // => false
|
|
*/
|
|
function isNull(value) {
|
|
return value === null;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is `null` or `undefined`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is nullish, else `false`.
|
|
* @example
|
|
*
|
|
* _.isNil(null);
|
|
* // => true
|
|
*
|
|
* _.isNil(void 0);
|
|
* // => true
|
|
*
|
|
* _.isNil(NaN);
|
|
* // => false
|
|
*/
|
|
function isNil(value) {
|
|
return value == null;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Number` primitive or object.
|
|
*
|
|
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
|
|
* classified as numbers, use the `_.isFinite` method.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a number, else `false`.
|
|
* @example
|
|
*
|
|
* _.isNumber(3);
|
|
* // => true
|
|
*
|
|
* _.isNumber(Number.MIN_VALUE);
|
|
* // => true
|
|
*
|
|
* _.isNumber(Infinity);
|
|
* // => true
|
|
*
|
|
* _.isNumber('3');
|
|
* // => false
|
|
*/
|
|
function isNumber(value) {
|
|
return typeof value == 'number' ||
|
|
(isObjectLike(value) && baseGetTag(value) == numberTag);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is a plain object, that is, an object created by the
|
|
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.8.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* }
|
|
*
|
|
* _.isPlainObject(new Foo);
|
|
* // => false
|
|
*
|
|
* _.isPlainObject([1, 2, 3]);
|
|
* // => false
|
|
*
|
|
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
* // => true
|
|
*
|
|
* _.isPlainObject(Object.create(null));
|
|
* // => true
|
|
*/
|
|
function isPlainObject(value) {
|
|
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
|
return false;
|
|
}
|
|
var proto = getPrototype(value);
|
|
if (proto === null) {
|
|
return true;
|
|
}
|
|
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
|
funcToString.call(Ctor) == objectCtorString;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `RegExp` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
|
|
* @example
|
|
*
|
|
* _.isRegExp(/abc/);
|
|
* // => true
|
|
*
|
|
* _.isRegExp('/abc/');
|
|
* // => false
|
|
*/
|
|
var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
|
|
|
|
/**
|
|
* Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
|
|
* double precision number which isn't the result of a rounded unsafe integer.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
|
|
* @example
|
|
*
|
|
* _.isSafeInteger(3);
|
|
* // => true
|
|
*
|
|
* _.isSafeInteger(Number.MIN_VALUE);
|
|
* // => false
|
|
*
|
|
* _.isSafeInteger(Infinity);
|
|
* // => false
|
|
*
|
|
* _.isSafeInteger('3');
|
|
* // => false
|
|
*/
|
|
function isSafeInteger(value) {
|
|
return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Set` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
* @example
|
|
*
|
|
* _.isSet(new Set);
|
|
* // => true
|
|
*
|
|
* _.isSet(new WeakSet);
|
|
* // => false
|
|
*/
|
|
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `String` primitive or object.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
|
|
* @example
|
|
*
|
|
* _.isString('abc');
|
|
* // => true
|
|
*
|
|
* _.isString(1);
|
|
* // => false
|
|
*/
|
|
function isString(value) {
|
|
return typeof value == 'string' ||
|
|
(!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
* @example
|
|
*
|
|
* _.isSymbol(Symbol.iterator);
|
|
* // => true
|
|
*
|
|
* _.isSymbol('abc');
|
|
* // => false
|
|
*/
|
|
function isSymbol(value) {
|
|
return typeof value == 'symbol' ||
|
|
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a typed array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
* @example
|
|
*
|
|
* _.isTypedArray(new Uint8Array);
|
|
* // => true
|
|
*
|
|
* _.isTypedArray([]);
|
|
* // => false
|
|
*/
|
|
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
|
|
/**
|
|
* Checks if `value` is `undefined`.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
|
|
* @example
|
|
*
|
|
* _.isUndefined(void 0);
|
|
* // => true
|
|
*
|
|
* _.isUndefined(null);
|
|
* // => false
|
|
*/
|
|
function isUndefined(value) {
|
|
return value === undefined;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `WeakMap` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
|
|
* @example
|
|
*
|
|
* _.isWeakMap(new WeakMap);
|
|
* // => true
|
|
*
|
|
* _.isWeakMap(new Map);
|
|
* // => false
|
|
*/
|
|
function isWeakMap(value) {
|
|
return isObjectLike(value) && getTag(value) == weakMapTag;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `WeakSet` object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.3.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
|
|
* @example
|
|
*
|
|
* _.isWeakSet(new WeakSet);
|
|
* // => true
|
|
*
|
|
* _.isWeakSet(new Set);
|
|
* // => false
|
|
*/
|
|
function isWeakSet(value) {
|
|
return isObjectLike(value) && baseGetTag(value) == weakSetTag;
|
|
}
|
|
|
|
/**
|
|
* Checks if `value` is less than `other`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.9.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is less than `other`,
|
|
* else `false`.
|
|
* @see _.gt
|
|
* @example
|
|
*
|
|
* _.lt(1, 3);
|
|
* // => true
|
|
*
|
|
* _.lt(3, 3);
|
|
* // => false
|
|
*
|
|
* _.lt(3, 1);
|
|
* // => false
|
|
*/
|
|
var lt = createRelationalOperation(baseLt);
|
|
|
|
/**
|
|
* Checks if `value` is less than or equal to `other`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.9.0
|
|
* @category Lang
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is less than or equal to
|
|
* `other`, else `false`.
|
|
* @see _.gte
|
|
* @example
|
|
*
|
|
* _.lte(1, 3);
|
|
* // => true
|
|
*
|
|
* _.lte(3, 3);
|
|
* // => true
|
|
*
|
|
* _.lte(3, 1);
|
|
* // => false
|
|
*/
|
|
var lte = createRelationalOperation(function(value, other) {
|
|
return value <= other;
|
|
});
|
|
|
|
/**
|
|
* Converts `value` to an array.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {Array} Returns the converted array.
|
|
* @example
|
|
*
|
|
* _.toArray({ 'a': 1, 'b': 2 });
|
|
* // => [1, 2]
|
|
*
|
|
* _.toArray('abc');
|
|
* // => ['a', 'b', 'c']
|
|
*
|
|
* _.toArray(1);
|
|
* // => []
|
|
*
|
|
* _.toArray(null);
|
|
* // => []
|
|
*/
|
|
function toArray(value) {
|
|
if (!value) {
|
|
return [];
|
|
}
|
|
if (isArrayLike(value)) {
|
|
return isString(value) ? stringToArray(value) : copyArray(value);
|
|
}
|
|
if (symIterator && value[symIterator]) {
|
|
return iteratorToArray(value[symIterator]());
|
|
}
|
|
var tag = getTag(value),
|
|
func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
|
|
|
|
return func(value);
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a finite number.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.12.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {number} Returns the converted number.
|
|
* @example
|
|
*
|
|
* _.toFinite(3.2);
|
|
* // => 3.2
|
|
*
|
|
* _.toFinite(Number.MIN_VALUE);
|
|
* // => 5e-324
|
|
*
|
|
* _.toFinite(Infinity);
|
|
* // => 1.7976931348623157e+308
|
|
*
|
|
* _.toFinite('3.2');
|
|
* // => 3.2
|
|
*/
|
|
function toFinite(value) {
|
|
if (!value) {
|
|
return value === 0 ? value : 0;
|
|
}
|
|
value = toNumber(value);
|
|
if (value === INFINITY || value === -INFINITY) {
|
|
var sign = (value < 0 ? -1 : 1);
|
|
return sign * MAX_INTEGER;
|
|
}
|
|
return value === value ? value : 0;
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to an integer.
|
|
*
|
|
* **Note:** This method is loosely based on
|
|
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {number} Returns the converted integer.
|
|
* @example
|
|
*
|
|
* _.toInteger(3.2);
|
|
* // => 3
|
|
*
|
|
* _.toInteger(Number.MIN_VALUE);
|
|
* // => 0
|
|
*
|
|
* _.toInteger(Infinity);
|
|
* // => 1.7976931348623157e+308
|
|
*
|
|
* _.toInteger('3.2');
|
|
* // => 3
|
|
*/
|
|
function toInteger(value) {
|
|
var result = toFinite(value),
|
|
remainder = result % 1;
|
|
|
|
return result === result ? (remainder ? result - remainder : result) : 0;
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to an integer suitable for use as the length of an
|
|
* array-like object.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {number} Returns the converted integer.
|
|
* @example
|
|
*
|
|
* _.toLength(3.2);
|
|
* // => 3
|
|
*
|
|
* _.toLength(Number.MIN_VALUE);
|
|
* // => 0
|
|
*
|
|
* _.toLength(Infinity);
|
|
* // => 4294967295
|
|
*
|
|
* _.toLength('3.2');
|
|
* // => 3
|
|
*/
|
|
function toLength(value) {
|
|
return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a number.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to process.
|
|
* @returns {number} Returns the number.
|
|
* @example
|
|
*
|
|
* _.toNumber(3.2);
|
|
* // => 3.2
|
|
*
|
|
* _.toNumber(Number.MIN_VALUE);
|
|
* // => 5e-324
|
|
*
|
|
* _.toNumber(Infinity);
|
|
* // => Infinity
|
|
*
|
|
* _.toNumber('3.2');
|
|
* // => 3.2
|
|
*/
|
|
function toNumber(value) {
|
|
if (typeof value == 'number') {
|
|
return value;
|
|
}
|
|
if (isSymbol(value)) {
|
|
return NAN;
|
|
}
|
|
if (isObject(value)) {
|
|
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
value = isObject(other) ? (other + '') : other;
|
|
}
|
|
if (typeof value != 'string') {
|
|
return value === 0 ? value : +value;
|
|
}
|
|
value = value.replace(reTrim, '');
|
|
var isBinary = reIsBinary.test(value);
|
|
return (isBinary || reIsOctal.test(value))
|
|
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
: (reIsBadHex.test(value) ? NAN : +value);
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a plain object flattening inherited enumerable string
|
|
* keyed properties of `value` to own properties of the plain object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {Object} Returns the converted plain object.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.assign({ 'a': 1 }, new Foo);
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*
|
|
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
|
|
* // => { 'a': 1, 'b': 2, 'c': 3 }
|
|
*/
|
|
function toPlainObject(value) {
|
|
return copyObject(value, keysIn(value));
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a safe integer. A safe integer can be compared and
|
|
* represented correctly.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {number} Returns the converted integer.
|
|
* @example
|
|
*
|
|
* _.toSafeInteger(3.2);
|
|
* // => 3
|
|
*
|
|
* _.toSafeInteger(Number.MIN_VALUE);
|
|
* // => 0
|
|
*
|
|
* _.toSafeInteger(Infinity);
|
|
* // => 9007199254740991
|
|
*
|
|
* _.toSafeInteger('3.2');
|
|
* // => 3
|
|
*/
|
|
function toSafeInteger(value) {
|
|
return value
|
|
? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
|
|
: (value === 0 ? value : 0);
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a string. An empty string is returned for `null`
|
|
* and `undefined` values. The sign of `-0` is preserved.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {string} Returns the converted string.
|
|
* @example
|
|
*
|
|
* _.toString(null);
|
|
* // => ''
|
|
*
|
|
* _.toString(-0);
|
|
* // => '-0'
|
|
*
|
|
* _.toString([1, 2, 3]);
|
|
* // => '1,2,3'
|
|
*/
|
|
function toString(value) {
|
|
return value == null ? '' : baseToString(value);
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Assigns own enumerable string keyed properties of source objects to the
|
|
* destination object. Source objects are applied from left to right.
|
|
* Subsequent sources overwrite property assignments of previous sources.
|
|
*
|
|
* **Note:** This method mutates `object` and is loosely based on
|
|
* [`Object.assign`](https://mdn.io/Object/assign).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.10.0
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} [sources] The source objects.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.assignIn
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* }
|
|
*
|
|
* function Bar() {
|
|
* this.c = 3;
|
|
* }
|
|
*
|
|
* Foo.prototype.b = 2;
|
|
* Bar.prototype.d = 4;
|
|
*
|
|
* _.assign({ 'a': 0 }, new Foo, new Bar);
|
|
* // => { 'a': 1, 'c': 3 }
|
|
*/
|
|
var assign = createAssigner(function(object, source) {
|
|
if (isPrototype(source) || isArrayLike(source)) {
|
|
copyObject(source, keys(source), object);
|
|
return;
|
|
}
|
|
for (var key in source) {
|
|
if (hasOwnProperty.call(source, key)) {
|
|
assignValue(object, key, source[key]);
|
|
}
|
|
}
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.assign` except that it iterates over own and
|
|
* inherited source properties.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @alias extend
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} [sources] The source objects.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.assign
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* }
|
|
*
|
|
* function Bar() {
|
|
* this.c = 3;
|
|
* }
|
|
*
|
|
* Foo.prototype.b = 2;
|
|
* Bar.prototype.d = 4;
|
|
*
|
|
* _.assignIn({ 'a': 0 }, new Foo, new Bar);
|
|
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
|
|
*/
|
|
var assignIn = createAssigner(function(object, source) {
|
|
copyObject(source, keysIn(source), object);
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.assignIn` except that it accepts `customizer`
|
|
* which is invoked to produce the assigned values. If `customizer` returns
|
|
* `undefined`, assignment is handled by the method instead. The `customizer`
|
|
* is invoked with five arguments: (objValue, srcValue, key, object, source).
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @alias extendWith
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} sources The source objects.
|
|
* @param {Function} [customizer] The function to customize assigned values.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.assignWith
|
|
* @example
|
|
*
|
|
* function customizer(objValue, srcValue) {
|
|
* return _.isUndefined(objValue) ? srcValue : objValue;
|
|
* }
|
|
*
|
|
* var defaults = _.partialRight(_.assignInWith, customizer);
|
|
*
|
|
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*/
|
|
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
copyObject(source, keysIn(source), object, customizer);
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.assign` except that it accepts `customizer`
|
|
* which is invoked to produce the assigned values. If `customizer` returns
|
|
* `undefined`, assignment is handled by the method instead. The `customizer`
|
|
* is invoked with five arguments: (objValue, srcValue, key, object, source).
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} sources The source objects.
|
|
* @param {Function} [customizer] The function to customize assigned values.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.assignInWith
|
|
* @example
|
|
*
|
|
* function customizer(objValue, srcValue) {
|
|
* return _.isUndefined(objValue) ? srcValue : objValue;
|
|
* }
|
|
*
|
|
* var defaults = _.partialRight(_.assignWith, customizer);
|
|
*
|
|
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*/
|
|
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
copyObject(source, keys(source), object, customizer);
|
|
});
|
|
|
|
/**
|
|
* Creates an array of values corresponding to `paths` of `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {...(string|string[])} [paths] The property paths to pick.
|
|
* @returns {Array} Returns the picked values.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
|
|
*
|
|
* _.at(object, ['a[0].b.c', 'a[1]']);
|
|
* // => [3, 4]
|
|
*/
|
|
var at = flatRest(baseAt);
|
|
|
|
/**
|
|
* Creates an object that inherits from the `prototype` object. If a
|
|
* `properties` object is given, its own enumerable string keyed properties
|
|
* are assigned to the created object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.3.0
|
|
* @category Object
|
|
* @param {Object} prototype The object to inherit from.
|
|
* @param {Object} [properties] The properties to assign to the object.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* function Shape() {
|
|
* this.x = 0;
|
|
* this.y = 0;
|
|
* }
|
|
*
|
|
* function Circle() {
|
|
* Shape.call(this);
|
|
* }
|
|
*
|
|
* Circle.prototype = _.create(Shape.prototype, {
|
|
* 'constructor': Circle
|
|
* });
|
|
*
|
|
* var circle = new Circle;
|
|
* circle instanceof Circle;
|
|
* // => true
|
|
*
|
|
* circle instanceof Shape;
|
|
* // => true
|
|
*/
|
|
function create(prototype, properties) {
|
|
var result = baseCreate(prototype);
|
|
return properties == null ? result : baseAssign(result, properties);
|
|
}
|
|
|
|
/**
|
|
* Assigns own and inherited enumerable string keyed properties of source
|
|
* objects to the destination object for all destination properties that
|
|
* resolve to `undefined`. Source objects are applied from left to right.
|
|
* Once a property is set, additional values of the same property are ignored.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} [sources] The source objects.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.defaultsDeep
|
|
* @example
|
|
*
|
|
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*/
|
|
var defaults = baseRest(function(args) {
|
|
args.push(undefined, customDefaultsAssignIn);
|
|
return apply(assignInWith, undefined, args);
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.defaults` except that it recursively assigns
|
|
* default properties.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.10.0
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} [sources] The source objects.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.defaults
|
|
* @example
|
|
*
|
|
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
|
|
* // => { 'a': { 'b': 2, 'c': 3 } }
|
|
*/
|
|
var defaultsDeep = baseRest(function(args) {
|
|
args.push(undefined, customDefaultsMerge);
|
|
return apply(mergeWith, undefined, args);
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.find` except that it returns the key of the first
|
|
* element `predicate` returns truthy for instead of the element itself.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.1.0
|
|
* @category Object
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {string|undefined} Returns the key of the matched element,
|
|
* else `undefined`.
|
|
* @example
|
|
*
|
|
* var users = {
|
|
* 'barney': { 'age': 36, 'active': true },
|
|
* 'fred': { 'age': 40, 'active': false },
|
|
* 'pebbles': { 'age': 1, 'active': true }
|
|
* };
|
|
*
|
|
* _.findKey(users, function(o) { return o.age < 40; });
|
|
* // => 'barney' (iteration order is not guaranteed)
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.findKey(users, { 'age': 1, 'active': true });
|
|
* // => 'pebbles'
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.findKey(users, ['active', false]);
|
|
* // => 'fred'
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.findKey(users, 'active');
|
|
* // => 'barney'
|
|
*/
|
|
function findKey(object, predicate) {
|
|
return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.findKey` except that it iterates over elements of
|
|
* a collection in the opposite order.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @returns {string|undefined} Returns the key of the matched element,
|
|
* else `undefined`.
|
|
* @example
|
|
*
|
|
* var users = {
|
|
* 'barney': { 'age': 36, 'active': true },
|
|
* 'fred': { 'age': 40, 'active': false },
|
|
* 'pebbles': { 'age': 1, 'active': true }
|
|
* };
|
|
*
|
|
* _.findLastKey(users, function(o) { return o.age < 40; });
|
|
* // => returns 'pebbles' assuming `_.findKey` returns 'barney'
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.findLastKey(users, { 'age': 36, 'active': true });
|
|
* // => 'barney'
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.findLastKey(users, ['active', false]);
|
|
* // => 'fred'
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.findLastKey(users, 'active');
|
|
* // => 'pebbles'
|
|
*/
|
|
function findLastKey(object, predicate) {
|
|
return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
|
|
}
|
|
|
|
/**
|
|
* Iterates over own and inherited enumerable string keyed properties of an
|
|
* object and invokes `iteratee` for each property. The iteratee is invoked
|
|
* with three arguments: (value, key, object). Iteratee functions may exit
|
|
* iteration early by explicitly returning `false`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.3.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.forInRight
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.forIn(new Foo, function(value, key) {
|
|
* console.log(key);
|
|
* });
|
|
* // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
|
|
*/
|
|
function forIn(object, iteratee) {
|
|
return object == null
|
|
? object
|
|
: baseFor(object, getIteratee(iteratee, 3), keysIn);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.forIn` except that it iterates over properties of
|
|
* `object` in the opposite order.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.forIn
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.forInRight(new Foo, function(value, key) {
|
|
* console.log(key);
|
|
* });
|
|
* // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
|
|
*/
|
|
function forInRight(object, iteratee) {
|
|
return object == null
|
|
? object
|
|
: baseForRight(object, getIteratee(iteratee, 3), keysIn);
|
|
}
|
|
|
|
/**
|
|
* Iterates over own enumerable string keyed properties of an object and
|
|
* invokes `iteratee` for each property. The iteratee is invoked with three
|
|
* arguments: (value, key, object). Iteratee functions may exit iteration
|
|
* early by explicitly returning `false`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.3.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.forOwnRight
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.forOwn(new Foo, function(value, key) {
|
|
* console.log(key);
|
|
* });
|
|
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
|
*/
|
|
function forOwn(object, iteratee) {
|
|
return object && baseForOwn(object, getIteratee(iteratee, 3));
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.forOwn` except that it iterates over properties of
|
|
* `object` in the opposite order.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.forOwn
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.forOwnRight(new Foo, function(value, key) {
|
|
* console.log(key);
|
|
* });
|
|
* // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
|
|
*/
|
|
function forOwnRight(object, iteratee) {
|
|
return object && baseForOwnRight(object, getIteratee(iteratee, 3));
|
|
}
|
|
|
|
/**
|
|
* Creates an array of function property names from own enumerable properties
|
|
* of `object`.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The object to inspect.
|
|
* @returns {Array} Returns the function names.
|
|
* @see _.functionsIn
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = _.constant('a');
|
|
* this.b = _.constant('b');
|
|
* }
|
|
*
|
|
* Foo.prototype.c = _.constant('c');
|
|
*
|
|
* _.functions(new Foo);
|
|
* // => ['a', 'b']
|
|
*/
|
|
function functions(object) {
|
|
return object == null ? [] : baseFunctions(object, keys(object));
|
|
}
|
|
|
|
/**
|
|
* Creates an array of function property names from own and inherited
|
|
* enumerable properties of `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to inspect.
|
|
* @returns {Array} Returns the function names.
|
|
* @see _.functions
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = _.constant('a');
|
|
* this.b = _.constant('b');
|
|
* }
|
|
*
|
|
* Foo.prototype.c = _.constant('c');
|
|
*
|
|
* _.functionsIn(new Foo);
|
|
* // => ['a', 'b', 'c']
|
|
*/
|
|
function functionsIn(object) {
|
|
return object == null ? [] : baseFunctions(object, keysIn(object));
|
|
}
|
|
|
|
/**
|
|
* Gets the value at `path` of `object`. If the resolved value is
|
|
* `undefined`, the `defaultValue` is returned in its place.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.7.0
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path of the property to get.
|
|
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
* @returns {*} Returns the resolved value.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
*
|
|
* _.get(object, 'a[0].b.c');
|
|
* // => 3
|
|
*
|
|
* _.get(object, ['a', '0', 'b', 'c']);
|
|
* // => 3
|
|
*
|
|
* _.get(object, 'a.b.c', 'default');
|
|
* // => 'default'
|
|
*/
|
|
function get(object, path, defaultValue) {
|
|
var result = object == null ? undefined : baseGet(object, path);
|
|
return result === undefined ? defaultValue : result;
|
|
}
|
|
|
|
/**
|
|
* Checks if `path` is a direct property of `object`.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path to check.
|
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': { 'b': 2 } };
|
|
* var other = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
*
|
|
* _.has(object, 'a');
|
|
* // => true
|
|
*
|
|
* _.has(object, 'a.b');
|
|
* // => true
|
|
*
|
|
* _.has(object, ['a', 'b']);
|
|
* // => true
|
|
*
|
|
* _.has(other, 'a');
|
|
* // => false
|
|
*/
|
|
function has(object, path) {
|
|
return object != null && hasPath(object, path, baseHas);
|
|
}
|
|
|
|
/**
|
|
* Checks if `path` is a direct or inherited property of `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path to check.
|
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
* @example
|
|
*
|
|
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
*
|
|
* _.hasIn(object, 'a');
|
|
* // => true
|
|
*
|
|
* _.hasIn(object, 'a.b');
|
|
* // => true
|
|
*
|
|
* _.hasIn(object, ['a', 'b']);
|
|
* // => true
|
|
*
|
|
* _.hasIn(object, 'b');
|
|
* // => false
|
|
*/
|
|
function hasIn(object, path) {
|
|
return object != null && hasPath(object, path, baseHasIn);
|
|
}
|
|
|
|
/**
|
|
* Creates an object composed of the inverted keys and values of `object`.
|
|
* If `object` contains duplicate values, subsequent values overwrite
|
|
* property assignments of previous values.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.7.0
|
|
* @category Object
|
|
* @param {Object} object The object to invert.
|
|
* @returns {Object} Returns the new inverted object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': 2, 'c': 1 };
|
|
*
|
|
* _.invert(object);
|
|
* // => { '1': 'c', '2': 'b' }
|
|
*/
|
|
var invert = createInverter(function(result, value, key) {
|
|
result[value] = key;
|
|
}, constant(identity));
|
|
|
|
/**
|
|
* This method is like `_.invert` except that the inverted object is generated
|
|
* from the results of running each element of `object` thru `iteratee`. The
|
|
* corresponding inverted value of each inverted key is an array of keys
|
|
* responsible for generating the inverted value. The iteratee is invoked
|
|
* with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.1.0
|
|
* @category Object
|
|
* @param {Object} object The object to invert.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {Object} Returns the new inverted object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': 2, 'c': 1 };
|
|
*
|
|
* _.invertBy(object);
|
|
* // => { '1': ['a', 'c'], '2': ['b'] }
|
|
*
|
|
* _.invertBy(object, function(value) {
|
|
* return 'group' + value;
|
|
* });
|
|
* // => { 'group1': ['a', 'c'], 'group2': ['b'] }
|
|
*/
|
|
var invertBy = createInverter(function(result, value, key) {
|
|
if (hasOwnProperty.call(result, value)) {
|
|
result[value].push(key);
|
|
} else {
|
|
result[value] = [key];
|
|
}
|
|
}, getIteratee);
|
|
|
|
/**
|
|
* Invokes the method at `path` of `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path of the method to invoke.
|
|
* @param {...*} [args] The arguments to invoke the method with.
|
|
* @returns {*} Returns the result of the invoked method.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
|
|
*
|
|
* _.invoke(object, 'a[0].b.c.slice', 1, 3);
|
|
* // => [2, 3]
|
|
*/
|
|
var invoke = baseRest(baseInvoke);
|
|
|
|
/**
|
|
* Creates an array of the own enumerable property names of `object`.
|
|
*
|
|
* **Note:** Non-object values are coerced to objects. See the
|
|
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
* for more details.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.keys(new Foo);
|
|
* // => ['a', 'b'] (iteration order is not guaranteed)
|
|
*
|
|
* _.keys('hi');
|
|
* // => ['0', '1']
|
|
*/
|
|
function keys(object) {
|
|
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
}
|
|
|
|
/**
|
|
* Creates an array of the own and inherited enumerable property names of `object`.
|
|
*
|
|
* **Note:** Non-object values are coerced to objects.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property names.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.keysIn(new Foo);
|
|
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
*/
|
|
function keysIn(object) {
|
|
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
}
|
|
|
|
/**
|
|
* The opposite of `_.mapValues`; this method creates an object with the
|
|
* same values as `object` and keys generated by running each own enumerable
|
|
* string keyed property of `object` thru `iteratee`. The iteratee is invoked
|
|
* with three arguments: (value, key, object).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.8.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns the new mapped object.
|
|
* @see _.mapValues
|
|
* @example
|
|
*
|
|
* _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
|
|
* return key + value;
|
|
* });
|
|
* // => { 'a1': 1, 'b2': 2 }
|
|
*/
|
|
function mapKeys(object, iteratee) {
|
|
var result = {};
|
|
iteratee = getIteratee(iteratee, 3);
|
|
|
|
baseForOwn(object, function(value, key, object) {
|
|
baseAssignValue(result, iteratee(value, key, object), value);
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Creates an object with the same keys as `object` and values generated
|
|
* by running each own enumerable string keyed property of `object` thru
|
|
* `iteratee`. The iteratee is invoked with three arguments:
|
|
* (value, key, object).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.4.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns the new mapped object.
|
|
* @see _.mapKeys
|
|
* @example
|
|
*
|
|
* var users = {
|
|
* 'fred': { 'user': 'fred', 'age': 40 },
|
|
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
|
|
* };
|
|
*
|
|
* _.mapValues(users, function(o) { return o.age; });
|
|
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.mapValues(users, 'age');
|
|
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
|
*/
|
|
function mapValues(object, iteratee) {
|
|
var result = {};
|
|
iteratee = getIteratee(iteratee, 3);
|
|
|
|
baseForOwn(object, function(value, key, object) {
|
|
baseAssignValue(result, key, iteratee(value, key, object));
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.assign` except that it recursively merges own and
|
|
* inherited enumerable string keyed properties of source objects into the
|
|
* destination object. Source properties that resolve to `undefined` are
|
|
* skipped if a destination value exists. Array and plain object properties
|
|
* are merged recursively. Other objects and value types are overridden by
|
|
* assignment. Source objects are applied from left to right. Subsequent
|
|
* sources overwrite property assignments of previous sources.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.5.0
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} [sources] The source objects.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* var object = {
|
|
* 'a': [{ 'b': 2 }, { 'd': 4 }]
|
|
* };
|
|
*
|
|
* var other = {
|
|
* 'a': [{ 'c': 3 }, { 'e': 5 }]
|
|
* };
|
|
*
|
|
* _.merge(object, other);
|
|
* // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
|
|
*/
|
|
var merge = createAssigner(function(object, source, srcIndex) {
|
|
baseMerge(object, source, srcIndex);
|
|
});
|
|
|
|
/**
|
|
* This method is like `_.merge` except that it accepts `customizer` which
|
|
* is invoked to produce the merged values of the destination and source
|
|
* properties. If `customizer` returns `undefined`, merging is handled by the
|
|
* method instead. The `customizer` is invoked with six arguments:
|
|
* (objValue, srcValue, key, object, source, stack).
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} sources The source objects.
|
|
* @param {Function} customizer The function to customize assigned values.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* function customizer(objValue, srcValue) {
|
|
* if (_.isArray(objValue)) {
|
|
* return objValue.concat(srcValue);
|
|
* }
|
|
* }
|
|
*
|
|
* var object = { 'a': [1], 'b': [2] };
|
|
* var other = { 'a': [3], 'b': [4] };
|
|
*
|
|
* _.mergeWith(object, other, customizer);
|
|
* // => { 'a': [1, 3], 'b': [2, 4] }
|
|
*/
|
|
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
baseMerge(object, source, srcIndex, customizer);
|
|
});
|
|
|
|
/**
|
|
* The opposite of `_.pick`; this method creates an object composed of the
|
|
* own and inherited enumerable property paths of `object` that are not omitted.
|
|
*
|
|
* **Note:** This method is considerably slower than `_.pick`.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The source object.
|
|
* @param {...(string|string[])} [paths] The property paths to omit.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
*
|
|
* _.omit(object, ['a', 'c']);
|
|
* // => { 'b': '2' }
|
|
*/
|
|
var omit = flatRest(function(object, paths) {
|
|
var result = {};
|
|
if (object == null) {
|
|
return result;
|
|
}
|
|
var isDeep = false;
|
|
paths = arrayMap(paths, function(path) {
|
|
path = castPath(path, object);
|
|
isDeep || (isDeep = path.length > 1);
|
|
return path;
|
|
});
|
|
copyObject(object, getAllKeysIn(object), result);
|
|
if (isDeep) {
|
|
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
|
|
}
|
|
var length = paths.length;
|
|
while (length--) {
|
|
baseUnset(result, paths[length]);
|
|
}
|
|
return result;
|
|
});
|
|
|
|
/**
|
|
* The opposite of `_.pickBy`; this method creates an object composed of
|
|
* the own and inherited enumerable string keyed properties of `object` that
|
|
* `predicate` doesn't return truthy for. The predicate is invoked with two
|
|
* arguments: (value, key).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The source object.
|
|
* @param {Function} [predicate=_.identity] The function invoked per property.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
*
|
|
* _.omitBy(object, _.isNumber);
|
|
* // => { 'b': '2' }
|
|
*/
|
|
function omitBy(object, predicate) {
|
|
return pickBy(object, negate(getIteratee(predicate)));
|
|
}
|
|
|
|
/**
|
|
* Creates an object composed of the picked `object` properties.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The source object.
|
|
* @param {...(string|string[])} [paths] The property paths to pick.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
*
|
|
* _.pick(object, ['a', 'c']);
|
|
* // => { 'a': 1, 'c': 3 }
|
|
*/
|
|
var pick = flatRest(function(object, paths) {
|
|
return object == null ? {} : basePick(object, paths);
|
|
});
|
|
|
|
/**
|
|
* Creates an object composed of the `object` properties `predicate` returns
|
|
* truthy for. The predicate is invoked with two arguments: (value, key).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The source object.
|
|
* @param {Function} [predicate=_.identity] The function invoked per property.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
*
|
|
* _.pickBy(object, _.isNumber);
|
|
* // => { 'a': 1, 'c': 3 }
|
|
*/
|
|
function pickBy(object, predicate) {
|
|
if (object == null) {
|
|
return {};
|
|
}
|
|
var props = arrayMap(getAllKeysIn(object), function(prop) {
|
|
return [prop];
|
|
});
|
|
predicate = getIteratee(predicate);
|
|
return basePickBy(object, props, function(value, path) {
|
|
return predicate(value, path[0]);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.get` except that if the resolved value is a
|
|
* function it's invoked with the `this` binding of its parent object and
|
|
* its result is returned.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path of the property to resolve.
|
|
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
* @returns {*} Returns the resolved value.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
|
|
*
|
|
* _.result(object, 'a[0].b.c1');
|
|
* // => 3
|
|
*
|
|
* _.result(object, 'a[0].b.c2');
|
|
* // => 4
|
|
*
|
|
* _.result(object, 'a[0].b.c3', 'default');
|
|
* // => 'default'
|
|
*
|
|
* _.result(object, 'a[0].b.c3', _.constant('default'));
|
|
* // => 'default'
|
|
*/
|
|
function result(object, path, defaultValue) {
|
|
path = castPath(path, object);
|
|
|
|
var index = -1,
|
|
length = path.length;
|
|
|
|
// Ensure the loop is entered when path is empty.
|
|
if (!length) {
|
|
length = 1;
|
|
object = undefined;
|
|
}
|
|
while (++index < length) {
|
|
var value = object == null ? undefined : object[toKey(path[index])];
|
|
if (value === undefined) {
|
|
index = length;
|
|
value = defaultValue;
|
|
}
|
|
object = isFunction(value) ? value.call(object) : value;
|
|
}
|
|
return object;
|
|
}
|
|
|
|
/**
|
|
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
|
|
* it's created. Arrays are created for missing index properties while objects
|
|
* are created for all other missing properties. Use `_.setWith` to customize
|
|
* `path` creation.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.7.0
|
|
* @category Object
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to set.
|
|
* @param {*} value The value to set.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
*
|
|
* _.set(object, 'a[0].b.c', 4);
|
|
* console.log(object.a[0].b.c);
|
|
* // => 4
|
|
*
|
|
* _.set(object, ['x', '0', 'y', 'z'], 5);
|
|
* console.log(object.x[0].y.z);
|
|
* // => 5
|
|
*/
|
|
function set(object, path, value) {
|
|
return object == null ? object : baseSet(object, path, value);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.set` except that it accepts `customizer` which is
|
|
* invoked to produce the objects of `path`. If `customizer` returns `undefined`
|
|
* path creation is handled by the method instead. The `customizer` is invoked
|
|
* with three arguments: (nsValue, key, nsObject).
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to set.
|
|
* @param {*} value The value to set.
|
|
* @param {Function} [customizer] The function to customize assigned values.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* var object = {};
|
|
*
|
|
* _.setWith(object, '[0][1]', 'a', Object);
|
|
* // => { '0': { '1': 'a' } }
|
|
*/
|
|
function setWith(object, path, value, customizer) {
|
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
return object == null ? object : baseSet(object, path, value, customizer);
|
|
}
|
|
|
|
/**
|
|
* Creates an array of own enumerable string keyed-value pairs for `object`
|
|
* which can be consumed by `_.fromPairs`. If `object` is a map or set, its
|
|
* entries are returned.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @alias entries
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the key-value pairs.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.toPairs(new Foo);
|
|
* // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
|
|
*/
|
|
var toPairs = createToPairs(keys);
|
|
|
|
/**
|
|
* Creates an array of own and inherited enumerable string keyed-value pairs
|
|
* for `object` which can be consumed by `_.fromPairs`. If `object` is a map
|
|
* or set, its entries are returned.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @alias entriesIn
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the key-value pairs.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.toPairsIn(new Foo);
|
|
* // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
|
|
*/
|
|
var toPairsIn = createToPairs(keysIn);
|
|
|
|
/**
|
|
* An alternative to `_.reduce`; this method transforms `object` to a new
|
|
* `accumulator` object which is the result of running each of its own
|
|
* enumerable string keyed properties thru `iteratee`, with each invocation
|
|
* potentially mutating the `accumulator` object. If `accumulator` is not
|
|
* provided, a new object with the same `[[Prototype]]` will be used. The
|
|
* iteratee is invoked with four arguments: (accumulator, value, key, object).
|
|
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.3.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @param {*} [accumulator] The custom accumulator value.
|
|
* @returns {*} Returns the accumulated value.
|
|
* @example
|
|
*
|
|
* _.transform([2, 3, 4], function(result, n) {
|
|
* result.push(n *= n);
|
|
* return n % 2 == 0;
|
|
* }, []);
|
|
* // => [4, 9]
|
|
*
|
|
* _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
|
* (result[value] || (result[value] = [])).push(key);
|
|
* }, {});
|
|
* // => { '1': ['a', 'c'], '2': ['b'] }
|
|
*/
|
|
function transform(object, iteratee, accumulator) {
|
|
var isArr = isArray(object),
|
|
isArrLike = isArr || isBuffer(object) || isTypedArray(object);
|
|
|
|
iteratee = getIteratee(iteratee, 4);
|
|
if (accumulator == null) {
|
|
var Ctor = object && object.constructor;
|
|
if (isArrLike) {
|
|
accumulator = isArr ? new Ctor : [];
|
|
}
|
|
else if (isObject(object)) {
|
|
accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
|
|
}
|
|
else {
|
|
accumulator = {};
|
|
}
|
|
}
|
|
(isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
|
|
return iteratee(accumulator, value, index, object);
|
|
});
|
|
return accumulator;
|
|
}
|
|
|
|
/**
|
|
* Removes the property at `path` of `object`.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to unset.
|
|
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': 7 } }] };
|
|
* _.unset(object, 'a[0].b.c');
|
|
* // => true
|
|
*
|
|
* console.log(object);
|
|
* // => { 'a': [{ 'b': {} }] };
|
|
*
|
|
* _.unset(object, ['a', '0', 'b', 'c']);
|
|
* // => true
|
|
*
|
|
* console.log(object);
|
|
* // => { 'a': [{ 'b': {} }] };
|
|
*/
|
|
function unset(object, path) {
|
|
return object == null ? true : baseUnset(object, path);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.set` except that accepts `updater` to produce the
|
|
* value to set. Use `_.updateWith` to customize `path` creation. The `updater`
|
|
* is invoked with one argument: (value).
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.6.0
|
|
* @category Object
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to set.
|
|
* @param {Function} updater The function to produce the updated value.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
*
|
|
* _.update(object, 'a[0].b.c', function(n) { return n * n; });
|
|
* console.log(object.a[0].b.c);
|
|
* // => 9
|
|
*
|
|
* _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
|
|
* console.log(object.x[0].y.z);
|
|
* // => 0
|
|
*/
|
|
function update(object, path, updater) {
|
|
return object == null ? object : baseUpdate(object, path, castFunction(updater));
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.update` except that it accepts `customizer` which is
|
|
* invoked to produce the objects of `path`. If `customizer` returns `undefined`
|
|
* path creation is handled by the method instead. The `customizer` is invoked
|
|
* with three arguments: (nsValue, key, nsObject).
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.6.0
|
|
* @category Object
|
|
* @param {Object} object The object to modify.
|
|
* @param {Array|string} path The path of the property to set.
|
|
* @param {Function} updater The function to produce the updated value.
|
|
* @param {Function} [customizer] The function to customize assigned values.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* var object = {};
|
|
*
|
|
* _.updateWith(object, '[0][1]', _.constant('a'), Object);
|
|
* // => { '0': { '1': 'a' } }
|
|
*/
|
|
function updateWith(object, path, updater, customizer) {
|
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
|
return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
|
|
}
|
|
|
|
/**
|
|
* Creates an array of the own enumerable string keyed property values of `object`.
|
|
*
|
|
* **Note:** Non-object values are coerced to objects.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property values.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.values(new Foo);
|
|
* // => [1, 2] (iteration order is not guaranteed)
|
|
*
|
|
* _.values('hi');
|
|
* // => ['h', 'i']
|
|
*/
|
|
function values(object) {
|
|
return object == null ? [] : baseValues(object, keys(object));
|
|
}
|
|
|
|
/**
|
|
* Creates an array of the own and inherited enumerable string keyed property
|
|
* values of `object`.
|
|
*
|
|
* **Note:** Non-object values are coerced to objects.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @returns {Array} Returns the array of property values.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.valuesIn(new Foo);
|
|
* // => [1, 2, 3] (iteration order is not guaranteed)
|
|
*/
|
|
function valuesIn(object) {
|
|
return object == null ? [] : baseValues(object, keysIn(object));
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Clamps `number` within the inclusive `lower` and `upper` bounds.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Number
|
|
* @param {number} number The number to clamp.
|
|
* @param {number} [lower] The lower bound.
|
|
* @param {number} upper The upper bound.
|
|
* @returns {number} Returns the clamped number.
|
|
* @example
|
|
*
|
|
* _.clamp(-10, -5, 5);
|
|
* // => -5
|
|
*
|
|
* _.clamp(10, -5, 5);
|
|
* // => 5
|
|
*/
|
|
function clamp(number, lower, upper) {
|
|
if (upper === undefined) {
|
|
upper = lower;
|
|
lower = undefined;
|
|
}
|
|
if (upper !== undefined) {
|
|
upper = toNumber(upper);
|
|
upper = upper === upper ? upper : 0;
|
|
}
|
|
if (lower !== undefined) {
|
|
lower = toNumber(lower);
|
|
lower = lower === lower ? lower : 0;
|
|
}
|
|
return baseClamp(toNumber(number), lower, upper);
|
|
}
|
|
|
|
/**
|
|
* Checks if `n` is between `start` and up to, but not including, `end`. If
|
|
* `end` is not specified, it's set to `start` with `start` then set to `0`.
|
|
* If `start` is greater than `end` the params are swapped to support
|
|
* negative ranges.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.3.0
|
|
* @category Number
|
|
* @param {number} number The number to check.
|
|
* @param {number} [start=0] The start of the range.
|
|
* @param {number} end The end of the range.
|
|
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
|
|
* @see _.range, _.rangeRight
|
|
* @example
|
|
*
|
|
* _.inRange(3, 2, 4);
|
|
* // => true
|
|
*
|
|
* _.inRange(4, 8);
|
|
* // => true
|
|
*
|
|
* _.inRange(4, 2);
|
|
* // => false
|
|
*
|
|
* _.inRange(2, 2);
|
|
* // => false
|
|
*
|
|
* _.inRange(1.2, 2);
|
|
* // => true
|
|
*
|
|
* _.inRange(5.2, 4);
|
|
* // => false
|
|
*
|
|
* _.inRange(-3, -2, -6);
|
|
* // => true
|
|
*/
|
|
function inRange(number, start, end) {
|
|
start = toFinite(start);
|
|
if (end === undefined) {
|
|
end = start;
|
|
start = 0;
|
|
} else {
|
|
end = toFinite(end);
|
|
}
|
|
number = toNumber(number);
|
|
return baseInRange(number, start, end);
|
|
}
|
|
|
|
/**
|
|
* Produces a random number between the inclusive `lower` and `upper` bounds.
|
|
* If only one argument is provided a number between `0` and the given number
|
|
* is returned. If `floating` is `true`, or either `lower` or `upper` are
|
|
* floats, a floating-point number is returned instead of an integer.
|
|
*
|
|
* **Note:** JavaScript follows the IEEE-754 standard for resolving
|
|
* floating-point values which can produce unexpected results.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.7.0
|
|
* @category Number
|
|
* @param {number} [lower=0] The lower bound.
|
|
* @param {number} [upper=1] The upper bound.
|
|
* @param {boolean} [floating] Specify returning a floating-point number.
|
|
* @returns {number} Returns the random number.
|
|
* @example
|
|
*
|
|
* _.random(0, 5);
|
|
* // => an integer between 0 and 5
|
|
*
|
|
* _.random(5);
|
|
* // => also an integer between 0 and 5
|
|
*
|
|
* _.random(5, true);
|
|
* // => a floating-point number between 0 and 5
|
|
*
|
|
* _.random(1.2, 5.2);
|
|
* // => a floating-point number between 1.2 and 5.2
|
|
*/
|
|
function random(lower, upper, floating) {
|
|
if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
|
|
upper = floating = undefined;
|
|
}
|
|
if (floating === undefined) {
|
|
if (typeof upper == 'boolean') {
|
|
floating = upper;
|
|
upper = undefined;
|
|
}
|
|
else if (typeof lower == 'boolean') {
|
|
floating = lower;
|
|
lower = undefined;
|
|
}
|
|
}
|
|
if (lower === undefined && upper === undefined) {
|
|
lower = 0;
|
|
upper = 1;
|
|
}
|
|
else {
|
|
lower = toFinite(lower);
|
|
if (upper === undefined) {
|
|
upper = lower;
|
|
lower = 0;
|
|
} else {
|
|
upper = toFinite(upper);
|
|
}
|
|
}
|
|
if (lower > upper) {
|
|
var temp = lower;
|
|
lower = upper;
|
|
upper = temp;
|
|
}
|
|
if (floating || lower % 1 || upper % 1) {
|
|
var rand = nativeRandom();
|
|
return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
|
|
}
|
|
return baseRandom(lower, upper);
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the camel cased string.
|
|
* @example
|
|
*
|
|
* _.camelCase('Foo Bar');
|
|
* // => 'fooBar'
|
|
*
|
|
* _.camelCase('--foo-bar--');
|
|
* // => 'fooBar'
|
|
*
|
|
* _.camelCase('__FOO_BAR__');
|
|
* // => 'fooBar'
|
|
*/
|
|
var camelCase = createCompounder(function(result, word, index) {
|
|
word = word.toLowerCase();
|
|
return result + (index ? capitalize(word) : word);
|
|
});
|
|
|
|
/**
|
|
* Converts the first character of `string` to upper case and the remaining
|
|
* to lower case.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to capitalize.
|
|
* @returns {string} Returns the capitalized string.
|
|
* @example
|
|
*
|
|
* _.capitalize('FRED');
|
|
* // => 'Fred'
|
|
*/
|
|
function capitalize(string) {
|
|
return upperFirst(toString(string).toLowerCase());
|
|
}
|
|
|
|
/**
|
|
* Deburrs `string` by converting
|
|
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
|
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
|
|
* letters to basic Latin letters and removing
|
|
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to deburr.
|
|
* @returns {string} Returns the deburred string.
|
|
* @example
|
|
*
|
|
* _.deburr('déjà vu');
|
|
* // => 'deja vu'
|
|
*/
|
|
function deburr(string) {
|
|
string = toString(string);
|
|
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
|
|
}
|
|
|
|
/**
|
|
* Checks if `string` ends with the given target string.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to inspect.
|
|
* @param {string} [target] The string to search for.
|
|
* @param {number} [position=string.length] The position to search up to.
|
|
* @returns {boolean} Returns `true` if `string` ends with `target`,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.endsWith('abc', 'c');
|
|
* // => true
|
|
*
|
|
* _.endsWith('abc', 'b');
|
|
* // => false
|
|
*
|
|
* _.endsWith('abc', 'b', 2);
|
|
* // => true
|
|
*/
|
|
function endsWith(string, target, position) {
|
|
string = toString(string);
|
|
target = baseToString(target);
|
|
|
|
var length = string.length;
|
|
position = position === undefined
|
|
? length
|
|
: baseClamp(toInteger(position), 0, length);
|
|
|
|
var end = position;
|
|
position -= target.length;
|
|
return position >= 0 && string.slice(position, end) == target;
|
|
}
|
|
|
|
/**
|
|
* Converts the characters "&", "<", ">", '"', and "'" in `string` to their
|
|
* corresponding HTML entities.
|
|
*
|
|
* **Note:** No other characters are escaped. To escape additional
|
|
* characters use a third-party library like [_he_](https://mths.be/he).
|
|
*
|
|
* Though the ">" character is escaped for symmetry, characters like
|
|
* ">" and "/" don't need escaping in HTML and have no special meaning
|
|
* unless they're part of a tag or unquoted attribute value. See
|
|
* [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
|
|
* (under "semi-related fun fact") for more details.
|
|
*
|
|
* When working with HTML you should always
|
|
* [quote attribute values](http://wonko.com/post/html-escaping) to reduce
|
|
* XSS vectors.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category String
|
|
* @param {string} [string=''] The string to escape.
|
|
* @returns {string} Returns the escaped string.
|
|
* @example
|
|
*
|
|
* _.escape('fred, barney, & pebbles');
|
|
* // => 'fred, barney, & pebbles'
|
|
*/
|
|
function escape(string) {
|
|
string = toString(string);
|
|
return (string && reHasUnescapedHtml.test(string))
|
|
? string.replace(reUnescapedHtml, escapeHtmlChar)
|
|
: string;
|
|
}
|
|
|
|
/**
|
|
* Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
|
|
* "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to escape.
|
|
* @returns {string} Returns the escaped string.
|
|
* @example
|
|
*
|
|
* _.escapeRegExp('[lodash](https://lodash.com/)');
|
|
* // => '\[lodash\]\(https://lodash\.com/\)'
|
|
*/
|
|
function escapeRegExp(string) {
|
|
string = toString(string);
|
|
return (string && reHasRegExpChar.test(string))
|
|
? string.replace(reRegExpChar, '\\$&')
|
|
: string;
|
|
}
|
|
|
|
/**
|
|
* Converts `string` to
|
|
* [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the kebab cased string.
|
|
* @example
|
|
*
|
|
* _.kebabCase('Foo Bar');
|
|
* // => 'foo-bar'
|
|
*
|
|
* _.kebabCase('fooBar');
|
|
* // => 'foo-bar'
|
|
*
|
|
* _.kebabCase('__FOO_BAR__');
|
|
* // => 'foo-bar'
|
|
*/
|
|
var kebabCase = createCompounder(function(result, word, index) {
|
|
return result + (index ? '-' : '') + word.toLowerCase();
|
|
});
|
|
|
|
/**
|
|
* Converts `string`, as space separated words, to lower case.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the lower cased string.
|
|
* @example
|
|
*
|
|
* _.lowerCase('--Foo-Bar--');
|
|
* // => 'foo bar'
|
|
*
|
|
* _.lowerCase('fooBar');
|
|
* // => 'foo bar'
|
|
*
|
|
* _.lowerCase('__FOO_BAR__');
|
|
* // => 'foo bar'
|
|
*/
|
|
var lowerCase = createCompounder(function(result, word, index) {
|
|
return result + (index ? ' ' : '') + word.toLowerCase();
|
|
});
|
|
|
|
/**
|
|
* Converts the first character of `string` to lower case.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the converted string.
|
|
* @example
|
|
*
|
|
* _.lowerFirst('Fred');
|
|
* // => 'fred'
|
|
*
|
|
* _.lowerFirst('FRED');
|
|
* // => 'fRED'
|
|
*/
|
|
var lowerFirst = createCaseFirst('toLowerCase');
|
|
|
|
/**
|
|
* Pads `string` on the left and right sides if it's shorter than `length`.
|
|
* Padding characters are truncated if they can't be evenly divided by `length`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to pad.
|
|
* @param {number} [length=0] The padding length.
|
|
* @param {string} [chars=' '] The string used as padding.
|
|
* @returns {string} Returns the padded string.
|
|
* @example
|
|
*
|
|
* _.pad('abc', 8);
|
|
* // => ' abc '
|
|
*
|
|
* _.pad('abc', 8, '_-');
|
|
* // => '_-abc_-_'
|
|
*
|
|
* _.pad('abc', 3);
|
|
* // => 'abc'
|
|
*/
|
|
function pad(string, length, chars) {
|
|
string = toString(string);
|
|
length = toInteger(length);
|
|
|
|
var strLength = length ? stringSize(string) : 0;
|
|
if (!length || strLength >= length) {
|
|
return string;
|
|
}
|
|
var mid = (length - strLength) / 2;
|
|
return (
|
|
createPadding(nativeFloor(mid), chars) +
|
|
string +
|
|
createPadding(nativeCeil(mid), chars)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Pads `string` on the right side if it's shorter than `length`. Padding
|
|
* characters are truncated if they exceed `length`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to pad.
|
|
* @param {number} [length=0] The padding length.
|
|
* @param {string} [chars=' '] The string used as padding.
|
|
* @returns {string} Returns the padded string.
|
|
* @example
|
|
*
|
|
* _.padEnd('abc', 6);
|
|
* // => 'abc '
|
|
*
|
|
* _.padEnd('abc', 6, '_-');
|
|
* // => 'abc_-_'
|
|
*
|
|
* _.padEnd('abc', 3);
|
|
* // => 'abc'
|
|
*/
|
|
function padEnd(string, length, chars) {
|
|
string = toString(string);
|
|
length = toInteger(length);
|
|
|
|
var strLength = length ? stringSize(string) : 0;
|
|
return (length && strLength < length)
|
|
? (string + createPadding(length - strLength, chars))
|
|
: string;
|
|
}
|
|
|
|
/**
|
|
* Pads `string` on the left side if it's shorter than `length`. Padding
|
|
* characters are truncated if they exceed `length`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to pad.
|
|
* @param {number} [length=0] The padding length.
|
|
* @param {string} [chars=' '] The string used as padding.
|
|
* @returns {string} Returns the padded string.
|
|
* @example
|
|
*
|
|
* _.padStart('abc', 6);
|
|
* // => ' abc'
|
|
*
|
|
* _.padStart('abc', 6, '_-');
|
|
* // => '_-_abc'
|
|
*
|
|
* _.padStart('abc', 3);
|
|
* // => 'abc'
|
|
*/
|
|
function padStart(string, length, chars) {
|
|
string = toString(string);
|
|
length = toInteger(length);
|
|
|
|
var strLength = length ? stringSize(string) : 0;
|
|
return (length && strLength < length)
|
|
? (createPadding(length - strLength, chars) + string)
|
|
: string;
|
|
}
|
|
|
|
/**
|
|
* Converts `string` to an integer of the specified radix. If `radix` is
|
|
* `undefined` or `0`, a `radix` of `10` is used unless `value` is a
|
|
* hexadecimal, in which case a `radix` of `16` is used.
|
|
*
|
|
* **Note:** This method aligns with the
|
|
* [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.1.0
|
|
* @category String
|
|
* @param {string} string The string to convert.
|
|
* @param {number} [radix=10] The radix to interpret `value` by.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {number} Returns the converted integer.
|
|
* @example
|
|
*
|
|
* _.parseInt('08');
|
|
* // => 8
|
|
*
|
|
* _.map(['6', '08', '10'], _.parseInt);
|
|
* // => [6, 8, 10]
|
|
*/
|
|
function parseInt(string, radix, guard) {
|
|
if (guard || radix == null) {
|
|
radix = 0;
|
|
} else if (radix) {
|
|
radix = +radix;
|
|
}
|
|
return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
|
|
}
|
|
|
|
/**
|
|
* Repeats the given string `n` times.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to repeat.
|
|
* @param {number} [n=1] The number of times to repeat the string.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {string} Returns the repeated string.
|
|
* @example
|
|
*
|
|
* _.repeat('*', 3);
|
|
* // => '***'
|
|
*
|
|
* _.repeat('abc', 2);
|
|
* // => 'abcabc'
|
|
*
|
|
* _.repeat('abc', 0);
|
|
* // => ''
|
|
*/
|
|
function repeat(string, n, guard) {
|
|
if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
|
|
n = 1;
|
|
} else {
|
|
n = toInteger(n);
|
|
}
|
|
return baseRepeat(toString(string), n);
|
|
}
|
|
|
|
/**
|
|
* Replaces matches for `pattern` in `string` with `replacement`.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`String#replace`](https://mdn.io/String/replace).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to modify.
|
|
* @param {RegExp|string} pattern The pattern to replace.
|
|
* @param {Function|string} replacement The match replacement.
|
|
* @returns {string} Returns the modified string.
|
|
* @example
|
|
*
|
|
* _.replace('Hi Fred', 'Fred', 'Barney');
|
|
* // => 'Hi Barney'
|
|
*/
|
|
function replace() {
|
|
var args = arguments,
|
|
string = toString(args[0]);
|
|
|
|
return args.length < 3 ? string : string.replace(args[1], args[2]);
|
|
}
|
|
|
|
/**
|
|
* Converts `string` to
|
|
* [snake case](https://en.wikipedia.org/wiki/Snake_case).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the snake cased string.
|
|
* @example
|
|
*
|
|
* _.snakeCase('Foo Bar');
|
|
* // => 'foo_bar'
|
|
*
|
|
* _.snakeCase('fooBar');
|
|
* // => 'foo_bar'
|
|
*
|
|
* _.snakeCase('--FOO-BAR--');
|
|
* // => 'foo_bar'
|
|
*/
|
|
var snakeCase = createCompounder(function(result, word, index) {
|
|
return result + (index ? '_' : '') + word.toLowerCase();
|
|
});
|
|
|
|
/**
|
|
* Splits `string` by `separator`.
|
|
*
|
|
* **Note:** This method is based on
|
|
* [`String#split`](https://mdn.io/String/split).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to split.
|
|
* @param {RegExp|string} separator The separator pattern to split by.
|
|
* @param {number} [limit] The length to truncate results to.
|
|
* @returns {Array} Returns the string segments.
|
|
* @example
|
|
*
|
|
* _.split('a-b-c', '-', 2);
|
|
* // => ['a', 'b']
|
|
*/
|
|
function split(string, separator, limit) {
|
|
if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
|
|
separator = limit = undefined;
|
|
}
|
|
limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
|
|
if (!limit) {
|
|
return [];
|
|
}
|
|
string = toString(string);
|
|
if (string && (
|
|
typeof separator == 'string' ||
|
|
(separator != null && !isRegExp(separator))
|
|
)) {
|
|
separator = baseToString(separator);
|
|
if (!separator && hasUnicode(string)) {
|
|
return castSlice(stringToArray(string), 0, limit);
|
|
}
|
|
}
|
|
return string.split(separator, limit);
|
|
}
|
|
|
|
/**
|
|
* Converts `string` to
|
|
* [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.1.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the start cased string.
|
|
* @example
|
|
*
|
|
* _.startCase('--foo-bar--');
|
|
* // => 'Foo Bar'
|
|
*
|
|
* _.startCase('fooBar');
|
|
* // => 'Foo Bar'
|
|
*
|
|
* _.startCase('__FOO_BAR__');
|
|
* // => 'FOO BAR'
|
|
*/
|
|
var startCase = createCompounder(function(result, word, index) {
|
|
return result + (index ? ' ' : '') + upperFirst(word);
|
|
});
|
|
|
|
/**
|
|
* Checks if `string` starts with the given target string.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to inspect.
|
|
* @param {string} [target] The string to search for.
|
|
* @param {number} [position=0] The position to search from.
|
|
* @returns {boolean} Returns `true` if `string` starts with `target`,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* _.startsWith('abc', 'a');
|
|
* // => true
|
|
*
|
|
* _.startsWith('abc', 'b');
|
|
* // => false
|
|
*
|
|
* _.startsWith('abc', 'b', 1);
|
|
* // => true
|
|
*/
|
|
function startsWith(string, target, position) {
|
|
string = toString(string);
|
|
position = position == null
|
|
? 0
|
|
: baseClamp(toInteger(position), 0, string.length);
|
|
|
|
target = baseToString(target);
|
|
return string.slice(position, position + target.length) == target;
|
|
}
|
|
|
|
/**
|
|
* Creates a compiled template function that can interpolate data properties
|
|
* in "interpolate" delimiters, HTML-escape interpolated data properties in
|
|
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
|
|
* properties may be accessed as free variables in the template. If a setting
|
|
* object is given, it takes precedence over `_.templateSettings` values.
|
|
*
|
|
* **Note:** In the development build `_.template` utilizes
|
|
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
|
* for easier debugging.
|
|
*
|
|
* For more information on precompiling templates see
|
|
* [lodash's custom builds documentation](https://lodash.com/custom-builds).
|
|
*
|
|
* For more information on Chrome extension sandboxes see
|
|
* [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category String
|
|
* @param {string} [string=''] The template string.
|
|
* @param {Object} [options={}] The options object.
|
|
* @param {RegExp} [options.escape=_.templateSettings.escape]
|
|
* The HTML "escape" delimiter.
|
|
* @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
|
|
* The "evaluate" delimiter.
|
|
* @param {Object} [options.imports=_.templateSettings.imports]
|
|
* An object to import into the template as free variables.
|
|
* @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
|
|
* The "interpolate" delimiter.
|
|
* @param {string} [options.sourceURL='lodash.templateSources[n]']
|
|
* The sourceURL of the compiled template.
|
|
* @param {string} [options.variable='obj']
|
|
* The data object variable name.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Function} Returns the compiled template function.
|
|
* @example
|
|
*
|
|
* // Use the "interpolate" delimiter to create a compiled template.
|
|
* var compiled = _.template('hello <%= user %>!');
|
|
* compiled({ 'user': 'fred' });
|
|
* // => 'hello fred!'
|
|
*
|
|
* // Use the HTML "escape" delimiter to escape data property values.
|
|
* var compiled = _.template('<b><%- value %></b>');
|
|
* compiled({ 'value': '<script>' });
|
|
* // => '<b><script></b>'
|
|
*
|
|
* // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
|
|
* var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
|
|
* compiled({ 'users': ['fred', 'barney'] });
|
|
* // => '<li>fred</li><li>barney</li>'
|
|
*
|
|
* // Use the internal `print` function in "evaluate" delimiters.
|
|
* var compiled = _.template('<% print("hello " + user); %>!');
|
|
* compiled({ 'user': 'barney' });
|
|
* // => 'hello barney!'
|
|
*
|
|
* // Use the ES template literal delimiter as an "interpolate" delimiter.
|
|
* // Disable support by replacing the "interpolate" delimiter.
|
|
* var compiled = _.template('hello ${ user }!');
|
|
* compiled({ 'user': 'pebbles' });
|
|
* // => 'hello pebbles!'
|
|
*
|
|
* // Use backslashes to treat delimiters as plain text.
|
|
* var compiled = _.template('<%= "\\<%- value %\\>" %>');
|
|
* compiled({ 'value': 'ignored' });
|
|
* // => '<%- value %>'
|
|
*
|
|
* // Use the `imports` option to import `jQuery` as `jq`.
|
|
* var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
|
|
* var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
|
|
* compiled({ 'users': ['fred', 'barney'] });
|
|
* // => '<li>fred</li><li>barney</li>'
|
|
*
|
|
* // Use the `sourceURL` option to specify a custom sourceURL for the template.
|
|
* var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
|
|
* compiled(data);
|
|
* // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
|
|
*
|
|
* // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
|
|
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
|
|
* compiled.source;
|
|
* // => function(data) {
|
|
* // var __t, __p = '';
|
|
* // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
|
|
* // return __p;
|
|
* // }
|
|
*
|
|
* // Use custom template delimiters.
|
|
* _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
|
|
* var compiled = _.template('hello {{ user }}!');
|
|
* compiled({ 'user': 'mustache' });
|
|
* // => 'hello mustache!'
|
|
*
|
|
* // Use the `source` property to inline compiled templates for meaningful
|
|
* // line numbers in error messages and stack traces.
|
|
* fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
|
|
* var JST = {\
|
|
* "main": ' + _.template(mainText).source + '\
|
|
* };\
|
|
* ');
|
|
*/
|
|
function template(string, options, guard) {
|
|
// Based on John Resig's `tmpl` implementation
|
|
// (http://ejohn.org/blog/javascript-micro-templating/)
|
|
// and Laura Doktorova's doT.js (https://github.com/olado/doT).
|
|
var settings = lodash.templateSettings;
|
|
|
|
if (guard && isIterateeCall(string, options, guard)) {
|
|
options = undefined;
|
|
}
|
|
string = toString(string);
|
|
options = assignInWith({}, options, settings, customDefaultsAssignIn);
|
|
|
|
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
|
|
importsKeys = keys(imports),
|
|
importsValues = baseValues(imports, importsKeys);
|
|
|
|
var isEscaping,
|
|
isEvaluating,
|
|
index = 0,
|
|
interpolate = options.interpolate || reNoMatch,
|
|
source = "__p += '";
|
|
|
|
// Compile the regexp to match each delimiter.
|
|
var reDelimiters = RegExp(
|
|
(options.escape || reNoMatch).source + '|' +
|
|
interpolate.source + '|' +
|
|
(interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
|
|
(options.evaluate || reNoMatch).source + '|$'
|
|
, 'g');
|
|
|
|
// Use a sourceURL for easier debugging.
|
|
var sourceURL = '//# sourceURL=' +
|
|
('sourceURL' in options
|
|
? options.sourceURL
|
|
: ('lodash.templateSources[' + (++templateCounter) + ']')
|
|
) + '\n';
|
|
|
|
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
|
interpolateValue || (interpolateValue = esTemplateValue);
|
|
|
|
// Escape characters that can't be included in string literals.
|
|
source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
|
|
|
|
// Replace delimiters with snippets.
|
|
if (escapeValue) {
|
|
isEscaping = true;
|
|
source += "' +\n__e(" + escapeValue + ") +\n'";
|
|
}
|
|
if (evaluateValue) {
|
|
isEvaluating = true;
|
|
source += "';\n" + evaluateValue + ";\n__p += '";
|
|
}
|
|
if (interpolateValue) {
|
|
source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
|
|
}
|
|
index = offset + match.length;
|
|
|
|
// The JS engine embedded in Adobe products needs `match` returned in
|
|
// order to produce the correct `offset` value.
|
|
return match;
|
|
});
|
|
|
|
source += "';\n";
|
|
|
|
// If `variable` is not specified wrap a with-statement around the generated
|
|
// code to add the data object to the top of the scope chain.
|
|
var variable = options.variable;
|
|
if (!variable) {
|
|
source = 'with (obj) {\n' + source + '\n}\n';
|
|
}
|
|
// Cleanup code by stripping empty strings.
|
|
source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
|
|
.replace(reEmptyStringMiddle, '$1')
|
|
.replace(reEmptyStringTrailing, '$1;');
|
|
|
|
// Frame code as the function body.
|
|
source = 'function(' + (variable || 'obj') + ') {\n' +
|
|
(variable
|
|
? ''
|
|
: 'obj || (obj = {});\n'
|
|
) +
|
|
"var __t, __p = ''" +
|
|
(isEscaping
|
|
? ', __e = _.escape'
|
|
: ''
|
|
) +
|
|
(isEvaluating
|
|
? ', __j = Array.prototype.join;\n' +
|
|
"function print() { __p += __j.call(arguments, '') }\n"
|
|
: ';\n'
|
|
) +
|
|
source +
|
|
'return __p\n}';
|
|
|
|
var result = attempt(function() {
|
|
return Function(importsKeys, sourceURL + 'return ' + source)
|
|
.apply(undefined, importsValues);
|
|
});
|
|
|
|
// Provide the compiled function's source by its `toString` method or
|
|
// the `source` property as a convenience for inlining compiled templates.
|
|
result.source = source;
|
|
if (isError(result)) {
|
|
throw result;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts `string`, as a whole, to lower case just like
|
|
* [String#toLowerCase](https://mdn.io/toLowerCase).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the lower cased string.
|
|
* @example
|
|
*
|
|
* _.toLower('--Foo-Bar--');
|
|
* // => '--foo-bar--'
|
|
*
|
|
* _.toLower('fooBar');
|
|
* // => 'foobar'
|
|
*
|
|
* _.toLower('__FOO_BAR__');
|
|
* // => '__foo_bar__'
|
|
*/
|
|
function toLower(value) {
|
|
return toString(value).toLowerCase();
|
|
}
|
|
|
|
/**
|
|
* Converts `string`, as a whole, to upper case just like
|
|
* [String#toUpperCase](https://mdn.io/toUpperCase).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the upper cased string.
|
|
* @example
|
|
*
|
|
* _.toUpper('--foo-bar--');
|
|
* // => '--FOO-BAR--'
|
|
*
|
|
* _.toUpper('fooBar');
|
|
* // => 'FOOBAR'
|
|
*
|
|
* _.toUpper('__foo_bar__');
|
|
* // => '__FOO_BAR__'
|
|
*/
|
|
function toUpper(value) {
|
|
return toString(value).toUpperCase();
|
|
}
|
|
|
|
/**
|
|
* Removes leading and trailing whitespace or specified characters from `string`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to trim.
|
|
* @param {string} [chars=whitespace] The characters to trim.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {string} Returns the trimmed string.
|
|
* @example
|
|
*
|
|
* _.trim(' abc ');
|
|
* // => 'abc'
|
|
*
|
|
* _.trim('-_-abc-_-', '_-');
|
|
* // => 'abc'
|
|
*
|
|
* _.map([' foo ', ' bar '], _.trim);
|
|
* // => ['foo', 'bar']
|
|
*/
|
|
function trim(string, chars, guard) {
|
|
string = toString(string);
|
|
if (string && (guard || chars === undefined)) {
|
|
return string.replace(reTrim, '');
|
|
}
|
|
if (!string || !(chars = baseToString(chars))) {
|
|
return string;
|
|
}
|
|
var strSymbols = stringToArray(string),
|
|
chrSymbols = stringToArray(chars),
|
|
start = charsStartIndex(strSymbols, chrSymbols),
|
|
end = charsEndIndex(strSymbols, chrSymbols) + 1;
|
|
|
|
return castSlice(strSymbols, start, end).join('');
|
|
}
|
|
|
|
/**
|
|
* Removes trailing whitespace or specified characters from `string`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to trim.
|
|
* @param {string} [chars=whitespace] The characters to trim.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {string} Returns the trimmed string.
|
|
* @example
|
|
*
|
|
* _.trimEnd(' abc ');
|
|
* // => ' abc'
|
|
*
|
|
* _.trimEnd('-_-abc-_-', '_-');
|
|
* // => '-_-abc'
|
|
*/
|
|
function trimEnd(string, chars, guard) {
|
|
string = toString(string);
|
|
if (string && (guard || chars === undefined)) {
|
|
return string.replace(reTrimEnd, '');
|
|
}
|
|
if (!string || !(chars = baseToString(chars))) {
|
|
return string;
|
|
}
|
|
var strSymbols = stringToArray(string),
|
|
end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
|
|
|
|
return castSlice(strSymbols, 0, end).join('');
|
|
}
|
|
|
|
/**
|
|
* Removes leading whitespace or specified characters from `string`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to trim.
|
|
* @param {string} [chars=whitespace] The characters to trim.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {string} Returns the trimmed string.
|
|
* @example
|
|
*
|
|
* _.trimStart(' abc ');
|
|
* // => 'abc '
|
|
*
|
|
* _.trimStart('-_-abc-_-', '_-');
|
|
* // => 'abc-_-'
|
|
*/
|
|
function trimStart(string, chars, guard) {
|
|
string = toString(string);
|
|
if (string && (guard || chars === undefined)) {
|
|
return string.replace(reTrimStart, '');
|
|
}
|
|
if (!string || !(chars = baseToString(chars))) {
|
|
return string;
|
|
}
|
|
var strSymbols = stringToArray(string),
|
|
start = charsStartIndex(strSymbols, stringToArray(chars));
|
|
|
|
return castSlice(strSymbols, start).join('');
|
|
}
|
|
|
|
/**
|
|
* Truncates `string` if it's longer than the given maximum string length.
|
|
* The last characters of the truncated string are replaced with the omission
|
|
* string which defaults to "...".
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to truncate.
|
|
* @param {Object} [options={}] The options object.
|
|
* @param {number} [options.length=30] The maximum string length.
|
|
* @param {string} [options.omission='...'] The string to indicate text is omitted.
|
|
* @param {RegExp|string} [options.separator] The separator pattern to truncate to.
|
|
* @returns {string} Returns the truncated string.
|
|
* @example
|
|
*
|
|
* _.truncate('hi-diddly-ho there, neighborino');
|
|
* // => 'hi-diddly-ho there, neighbo...'
|
|
*
|
|
* _.truncate('hi-diddly-ho there, neighborino', {
|
|
* 'length': 24,
|
|
* 'separator': ' '
|
|
* });
|
|
* // => 'hi-diddly-ho there,...'
|
|
*
|
|
* _.truncate('hi-diddly-ho there, neighborino', {
|
|
* 'length': 24,
|
|
* 'separator': /,? +/
|
|
* });
|
|
* // => 'hi-diddly-ho there...'
|
|
*
|
|
* _.truncate('hi-diddly-ho there, neighborino', {
|
|
* 'omission': ' [...]'
|
|
* });
|
|
* // => 'hi-diddly-ho there, neig [...]'
|
|
*/
|
|
function truncate(string, options) {
|
|
var length = DEFAULT_TRUNC_LENGTH,
|
|
omission = DEFAULT_TRUNC_OMISSION;
|
|
|
|
if (isObject(options)) {
|
|
var separator = 'separator' in options ? options.separator : separator;
|
|
length = 'length' in options ? toInteger(options.length) : length;
|
|
omission = 'omission' in options ? baseToString(options.omission) : omission;
|
|
}
|
|
string = toString(string);
|
|
|
|
var strLength = string.length;
|
|
if (hasUnicode(string)) {
|
|
var strSymbols = stringToArray(string);
|
|
strLength = strSymbols.length;
|
|
}
|
|
if (length >= strLength) {
|
|
return string;
|
|
}
|
|
var end = length - stringSize(omission);
|
|
if (end < 1) {
|
|
return omission;
|
|
}
|
|
var result = strSymbols
|
|
? castSlice(strSymbols, 0, end).join('')
|
|
: string.slice(0, end);
|
|
|
|
if (separator === undefined) {
|
|
return result + omission;
|
|
}
|
|
if (strSymbols) {
|
|
end += (result.length - end);
|
|
}
|
|
if (isRegExp(separator)) {
|
|
if (string.slice(end).search(separator)) {
|
|
var match,
|
|
substring = result;
|
|
|
|
if (!separator.global) {
|
|
separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
|
|
}
|
|
separator.lastIndex = 0;
|
|
while ((match = separator.exec(substring))) {
|
|
var newEnd = match.index;
|
|
}
|
|
result = result.slice(0, newEnd === undefined ? end : newEnd);
|
|
}
|
|
} else if (string.indexOf(baseToString(separator), end) != end) {
|
|
var index = result.lastIndexOf(separator);
|
|
if (index > -1) {
|
|
result = result.slice(0, index);
|
|
}
|
|
}
|
|
return result + omission;
|
|
}
|
|
|
|
/**
|
|
* The inverse of `_.escape`; this method converts the HTML entities
|
|
* `&`, `<`, `>`, `"`, and `'` in `string` to
|
|
* their corresponding characters.
|
|
*
|
|
* **Note:** No other HTML entities are unescaped. To unescape additional
|
|
* HTML entities use a third-party library like [_he_](https://mths.be/he).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.6.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to unescape.
|
|
* @returns {string} Returns the unescaped string.
|
|
* @example
|
|
*
|
|
* _.unescape('fred, barney, & pebbles');
|
|
* // => 'fred, barney, & pebbles'
|
|
*/
|
|
function unescape(string) {
|
|
string = toString(string);
|
|
return (string && reHasEscapedHtml.test(string))
|
|
? string.replace(reEscapedHtml, unescapeHtmlChar)
|
|
: string;
|
|
}
|
|
|
|
/**
|
|
* Converts `string`, as space separated words, to upper case.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the upper cased string.
|
|
* @example
|
|
*
|
|
* _.upperCase('--foo-bar');
|
|
* // => 'FOO BAR'
|
|
*
|
|
* _.upperCase('fooBar');
|
|
* // => 'FOO BAR'
|
|
*
|
|
* _.upperCase('__foo_bar__');
|
|
* // => 'FOO BAR'
|
|
*/
|
|
var upperCase = createCompounder(function(result, word, index) {
|
|
return result + (index ? ' ' : '') + word.toUpperCase();
|
|
});
|
|
|
|
/**
|
|
* Converts the first character of `string` to upper case.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the converted string.
|
|
* @example
|
|
*
|
|
* _.upperFirst('fred');
|
|
* // => 'Fred'
|
|
*
|
|
* _.upperFirst('FRED');
|
|
* // => 'FRED'
|
|
*/
|
|
var upperFirst = createCaseFirst('toUpperCase');
|
|
|
|
/**
|
|
* Splits `string` into an array of its words.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to inspect.
|
|
* @param {RegExp|string} [pattern] The pattern to match words.
|
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
* @returns {Array} Returns the words of `string`.
|
|
* @example
|
|
*
|
|
* _.words('fred, barney, & pebbles');
|
|
* // => ['fred', 'barney', 'pebbles']
|
|
*
|
|
* _.words('fred, barney, & pebbles', /[^, ]+/g);
|
|
* // => ['fred', 'barney', '&', 'pebbles']
|
|
*/
|
|
function words(string, pattern, guard) {
|
|
string = toString(string);
|
|
pattern = guard ? undefined : pattern;
|
|
|
|
if (pattern === undefined) {
|
|
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
|
}
|
|
return string.match(pattern) || [];
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Attempts to invoke `func`, returning either the result or the caught error
|
|
* object. Any additional arguments are provided to `func` when it's invoked.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Util
|
|
* @param {Function} func The function to attempt.
|
|
* @param {...*} [args] The arguments to invoke `func` with.
|
|
* @returns {*} Returns the `func` result or error object.
|
|
* @example
|
|
*
|
|
* // Avoid throwing errors for invalid selectors.
|
|
* var elements = _.attempt(function(selector) {
|
|
* return document.querySelectorAll(selector);
|
|
* }, '>_>');
|
|
*
|
|
* if (_.isError(elements)) {
|
|
* elements = [];
|
|
* }
|
|
*/
|
|
var attempt = baseRest(function(func, args) {
|
|
try {
|
|
return apply(func, undefined, args);
|
|
} catch (e) {
|
|
return isError(e) ? e : new Error(e);
|
|
}
|
|
});
|
|
|
|
/**
|
|
* Binds methods of an object to the object itself, overwriting the existing
|
|
* method.
|
|
*
|
|
* **Note:** This method doesn't set the "length" property of bound functions.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {Object} object The object to bind and assign the bound methods to.
|
|
* @param {...(string|string[])} methodNames The object method names to bind.
|
|
* @returns {Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* var view = {
|
|
* 'label': 'docs',
|
|
* 'click': function() {
|
|
* console.log('clicked ' + this.label);
|
|
* }
|
|
* };
|
|
*
|
|
* _.bindAll(view, ['click']);
|
|
* jQuery(element).on('click', view.click);
|
|
* // => Logs 'clicked docs' when clicked.
|
|
*/
|
|
var bindAll = flatRest(function(object, methodNames) {
|
|
arrayEach(methodNames, function(key) {
|
|
key = toKey(key);
|
|
baseAssignValue(object, key, bind(object[key], object));
|
|
});
|
|
return object;
|
|
});
|
|
|
|
/**
|
|
* Creates a function that iterates over `pairs` and invokes the corresponding
|
|
* function of the first predicate to return truthy. The predicate-function
|
|
* pairs are invoked with the `this` binding and arguments of the created
|
|
* function.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {Array} pairs The predicate-function pairs.
|
|
* @returns {Function} Returns the new composite function.
|
|
* @example
|
|
*
|
|
* var func = _.cond([
|
|
* [_.matches({ 'a': 1 }), _.constant('matches A')],
|
|
* [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
|
|
* [_.stubTrue, _.constant('no match')]
|
|
* ]);
|
|
*
|
|
* func({ 'a': 1, 'b': 2 });
|
|
* // => 'matches A'
|
|
*
|
|
* func({ 'a': 0, 'b': 1 });
|
|
* // => 'matches B'
|
|
*
|
|
* func({ 'a': '1', 'b': '2' });
|
|
* // => 'no match'
|
|
*/
|
|
function cond(pairs) {
|
|
var length = pairs == null ? 0 : pairs.length,
|
|
toIteratee = getIteratee();
|
|
|
|
pairs = !length ? [] : arrayMap(pairs, function(pair) {
|
|
if (typeof pair[1] != 'function') {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
return [toIteratee(pair[0]), pair[1]];
|
|
});
|
|
|
|
return baseRest(function(args) {
|
|
var index = -1;
|
|
while (++index < length) {
|
|
var pair = pairs[index];
|
|
if (apply(pair[0], this, args)) {
|
|
return apply(pair[1], this, args);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes the predicate properties of `source` with
|
|
* the corresponding property values of a given object, returning `true` if
|
|
* all predicates return truthy, else `false`.
|
|
*
|
|
* **Note:** The created function is equivalent to `_.conformsTo` with
|
|
* `source` partially applied.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {Object} source The object of property predicates to conform to.
|
|
* @returns {Function} Returns the new spec function.
|
|
* @example
|
|
*
|
|
* var objects = [
|
|
* { 'a': 2, 'b': 1 },
|
|
* { 'a': 1, 'b': 2 }
|
|
* ];
|
|
*
|
|
* _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
|
|
* // => [{ 'a': 1, 'b': 2 }]
|
|
*/
|
|
function conforms(source) {
|
|
return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
|
|
}
|
|
|
|
/**
|
|
* Creates a function that returns `value`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.4.0
|
|
* @category Util
|
|
* @param {*} value The value to return from the new function.
|
|
* @returns {Function} Returns the new constant function.
|
|
* @example
|
|
*
|
|
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
*
|
|
* console.log(objects);
|
|
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
*
|
|
* console.log(objects[0] === objects[1]);
|
|
* // => true
|
|
*/
|
|
function constant(value) {
|
|
return function() {
|
|
return value;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Checks `value` to determine whether a default value should be returned in
|
|
* its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
|
|
* or `undefined`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.14.0
|
|
* @category Util
|
|
* @param {*} value The value to check.
|
|
* @param {*} defaultValue The default value.
|
|
* @returns {*} Returns the resolved value.
|
|
* @example
|
|
*
|
|
* _.defaultTo(1, 10);
|
|
* // => 1
|
|
*
|
|
* _.defaultTo(undefined, 10);
|
|
* // => 10
|
|
*/
|
|
function defaultTo(value, defaultValue) {
|
|
return (value == null || value !== value) ? defaultValue : value;
|
|
}
|
|
|
|
/**
|
|
* Creates a function that returns the result of invoking the given functions
|
|
* with the `this` binding of the created function, where each successive
|
|
* invocation is supplied the return value of the previous.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Util
|
|
* @param {...(Function|Function[])} [funcs] The functions to invoke.
|
|
* @returns {Function} Returns the new composite function.
|
|
* @see _.flowRight
|
|
* @example
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* var addSquare = _.flow([_.add, square]);
|
|
* addSquare(1, 2);
|
|
* // => 9
|
|
*/
|
|
var flow = createFlow();
|
|
|
|
/**
|
|
* This method is like `_.flow` except that it creates a function that
|
|
* invokes the given functions from right to left.
|
|
*
|
|
* @static
|
|
* @since 3.0.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {...(Function|Function[])} [funcs] The functions to invoke.
|
|
* @returns {Function} Returns the new composite function.
|
|
* @see _.flow
|
|
* @example
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* var addSquare = _.flowRight([square, _.add]);
|
|
* addSquare(1, 2);
|
|
* // => 9
|
|
*/
|
|
var flowRight = createFlow(true);
|
|
|
|
/**
|
|
* This method returns the first argument it receives.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {*} value Any value.
|
|
* @returns {*} Returns `value`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1 };
|
|
*
|
|
* console.log(_.identity(object) === object);
|
|
* // => true
|
|
*/
|
|
function identity(value) {
|
|
return value;
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `func` with the arguments of the created
|
|
* function. If `func` is a property name, the created function returns the
|
|
* property value for a given element. If `func` is an array or object, the
|
|
* created function returns `true` for elements that contain the equivalent
|
|
* source properties, otherwise it returns `false`.
|
|
*
|
|
* @static
|
|
* @since 4.0.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {*} [func=_.identity] The value to convert to a callback.
|
|
* @returns {Function} Returns the callback.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': true },
|
|
* { 'user': 'fred', 'age': 40, 'active': false }
|
|
* ];
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
|
|
* // => [{ 'user': 'barney', 'age': 36, 'active': true }]
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.filter(users, _.iteratee(['user', 'fred']));
|
|
* // => [{ 'user': 'fred', 'age': 40 }]
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.map(users, _.iteratee('user'));
|
|
* // => ['barney', 'fred']
|
|
*
|
|
* // Create custom iteratee shorthands.
|
|
* _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
|
|
* return !_.isRegExp(func) ? iteratee(func) : function(string) {
|
|
* return func.test(string);
|
|
* };
|
|
* });
|
|
*
|
|
* _.filter(['abc', 'def'], /ef/);
|
|
* // => ['def']
|
|
*/
|
|
function iteratee(func) {
|
|
return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
|
|
}
|
|
|
|
/**
|
|
* Creates a function that performs a partial deep comparison between a given
|
|
* object and `source`, returning `true` if the given object has equivalent
|
|
* property values, else `false`.
|
|
*
|
|
* **Note:** The created function is equivalent to `_.isMatch` with `source`
|
|
* partially applied.
|
|
*
|
|
* Partial comparisons will match empty array and empty object `source`
|
|
* values against any array or object value, respectively. See `_.isEqual`
|
|
* for a list of supported value comparisons.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Util
|
|
* @param {Object} source The object of property values to match.
|
|
* @returns {Function} Returns the new spec function.
|
|
* @example
|
|
*
|
|
* var objects = [
|
|
* { 'a': 1, 'b': 2, 'c': 3 },
|
|
* { 'a': 4, 'b': 5, 'c': 6 }
|
|
* ];
|
|
*
|
|
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
|
|
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
|
|
*/
|
|
function matches(source) {
|
|
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
|
|
}
|
|
|
|
/**
|
|
* Creates a function that performs a partial deep comparison between the
|
|
* value at `path` of a given object to `srcValue`, returning `true` if the
|
|
* object value is equivalent, else `false`.
|
|
*
|
|
* **Note:** Partial comparisons will match empty array and empty object
|
|
* `srcValue` values against any array or object value, respectively. See
|
|
* `_.isEqual` for a list of supported value comparisons.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.2.0
|
|
* @category Util
|
|
* @param {Array|string} path The path of the property to get.
|
|
* @param {*} srcValue The value to match.
|
|
* @returns {Function} Returns the new spec function.
|
|
* @example
|
|
*
|
|
* var objects = [
|
|
* { 'a': 1, 'b': 2, 'c': 3 },
|
|
* { 'a': 4, 'b': 5, 'c': 6 }
|
|
* ];
|
|
*
|
|
* _.find(objects, _.matchesProperty('a', 4));
|
|
* // => { 'a': 4, 'b': 5, 'c': 6 }
|
|
*/
|
|
function matchesProperty(path, srcValue) {
|
|
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes the method at `path` of a given object.
|
|
* Any additional arguments are provided to the invoked method.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.7.0
|
|
* @category Util
|
|
* @param {Array|string} path The path of the method to invoke.
|
|
* @param {...*} [args] The arguments to invoke the method with.
|
|
* @returns {Function} Returns the new invoker function.
|
|
* @example
|
|
*
|
|
* var objects = [
|
|
* { 'a': { 'b': _.constant(2) } },
|
|
* { 'a': { 'b': _.constant(1) } }
|
|
* ];
|
|
*
|
|
* _.map(objects, _.method('a.b'));
|
|
* // => [2, 1]
|
|
*
|
|
* _.map(objects, _.method(['a', 'b']));
|
|
* // => [2, 1]
|
|
*/
|
|
var method = baseRest(function(path, args) {
|
|
return function(object) {
|
|
return baseInvoke(object, path, args);
|
|
};
|
|
});
|
|
|
|
/**
|
|
* The opposite of `_.method`; this method creates a function that invokes
|
|
* the method at a given path of `object`. Any additional arguments are
|
|
* provided to the invoked method.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.7.0
|
|
* @category Util
|
|
* @param {Object} object The object to query.
|
|
* @param {...*} [args] The arguments to invoke the method with.
|
|
* @returns {Function} Returns the new invoker function.
|
|
* @example
|
|
*
|
|
* var array = _.times(3, _.constant),
|
|
* object = { 'a': array, 'b': array, 'c': array };
|
|
*
|
|
* _.map(['a[2]', 'c[0]'], _.methodOf(object));
|
|
* // => [2, 0]
|
|
*
|
|
* _.map([['a', '2'], ['c', '0']], _.methodOf(object));
|
|
* // => [2, 0]
|
|
*/
|
|
var methodOf = baseRest(function(object, args) {
|
|
return function(path) {
|
|
return baseInvoke(object, path, args);
|
|
};
|
|
});
|
|
|
|
/**
|
|
* Adds all own enumerable string keyed function properties of a source
|
|
* object to the destination object. If `object` is a function, then methods
|
|
* are added to its prototype as well.
|
|
*
|
|
* **Note:** Use `_.runInContext` to create a pristine `lodash` function to
|
|
* avoid conflicts caused by modifying the original.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {Function|Object} [object=lodash] The destination object.
|
|
* @param {Object} source The object of functions to add.
|
|
* @param {Object} [options={}] The options object.
|
|
* @param {boolean} [options.chain=true] Specify whether mixins are chainable.
|
|
* @returns {Function|Object} Returns `object`.
|
|
* @example
|
|
*
|
|
* function vowels(string) {
|
|
* return _.filter(string, function(v) {
|
|
* return /[aeiou]/i.test(v);
|
|
* });
|
|
* }
|
|
*
|
|
* _.mixin({ 'vowels': vowels });
|
|
* _.vowels('fred');
|
|
* // => ['e']
|
|
*
|
|
* _('fred').vowels().value();
|
|
* // => ['e']
|
|
*
|
|
* _.mixin({ 'vowels': vowels }, { 'chain': false });
|
|
* _('fred').vowels();
|
|
* // => ['e']
|
|
*/
|
|
function mixin(object, source, options) {
|
|
var props = keys(source),
|
|
methodNames = baseFunctions(source, props);
|
|
|
|
if (options == null &&
|
|
!(isObject(source) && (methodNames.length || !props.length))) {
|
|
options = source;
|
|
source = object;
|
|
object = this;
|
|
methodNames = baseFunctions(source, keys(source));
|
|
}
|
|
var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
|
|
isFunc = isFunction(object);
|
|
|
|
arrayEach(methodNames, function(methodName) {
|
|
var func = source[methodName];
|
|
object[methodName] = func;
|
|
if (isFunc) {
|
|
object.prototype[methodName] = function() {
|
|
var chainAll = this.__chain__;
|
|
if (chain || chainAll) {
|
|
var result = object(this.__wrapped__),
|
|
actions = result.__actions__ = copyArray(this.__actions__);
|
|
|
|
actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
|
|
result.__chain__ = chainAll;
|
|
return result;
|
|
}
|
|
return func.apply(object, arrayPush([this.value()], arguments));
|
|
};
|
|
}
|
|
});
|
|
|
|
return object;
|
|
}
|
|
|
|
/**
|
|
* Reverts the `_` variable to its previous value and returns a reference to
|
|
* the `lodash` function.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @returns {Function} Returns the `lodash` function.
|
|
* @example
|
|
*
|
|
* var lodash = _.noConflict();
|
|
*/
|
|
function noConflict() {
|
|
if (root._ === this) {
|
|
root._ = oldDash;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* This method returns `undefined`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.3.0
|
|
* @category Util
|
|
* @example
|
|
*
|
|
* _.times(2, _.noop);
|
|
* // => [undefined, undefined]
|
|
*/
|
|
function noop() {
|
|
// No operation performed.
|
|
}
|
|
|
|
/**
|
|
* Creates a function that gets the argument at index `n`. If `n` is negative,
|
|
* the nth argument from the end is returned.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {number} [n=0] The index of the argument to return.
|
|
* @returns {Function} Returns the new pass-thru function.
|
|
* @example
|
|
*
|
|
* var func = _.nthArg(1);
|
|
* func('a', 'b', 'c', 'd');
|
|
* // => 'b'
|
|
*
|
|
* var func = _.nthArg(-2);
|
|
* func('a', 'b', 'c', 'd');
|
|
* // => 'c'
|
|
*/
|
|
function nthArg(n) {
|
|
n = toInteger(n);
|
|
return baseRest(function(args) {
|
|
return baseNth(args, n);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates a function that invokes `iteratees` with the arguments it receives
|
|
* and returns their results.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {...(Function|Function[])} [iteratees=[_.identity]]
|
|
* The iteratees to invoke.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var func = _.over([Math.max, Math.min]);
|
|
*
|
|
* func(1, 2, 3, 4);
|
|
* // => [4, 1]
|
|
*/
|
|
var over = createOver(arrayMap);
|
|
|
|
/**
|
|
* Creates a function that checks if **all** of the `predicates` return
|
|
* truthy when invoked with the arguments it receives.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {...(Function|Function[])} [predicates=[_.identity]]
|
|
* The predicates to check.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var func = _.overEvery([Boolean, isFinite]);
|
|
*
|
|
* func('1');
|
|
* // => true
|
|
*
|
|
* func(null);
|
|
* // => false
|
|
*
|
|
* func(NaN);
|
|
* // => false
|
|
*/
|
|
var overEvery = createOver(arrayEvery);
|
|
|
|
/**
|
|
* Creates a function that checks if **any** of the `predicates` return
|
|
* truthy when invoked with the arguments it receives.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {...(Function|Function[])} [predicates=[_.identity]]
|
|
* The predicates to check.
|
|
* @returns {Function} Returns the new function.
|
|
* @example
|
|
*
|
|
* var func = _.overSome([Boolean, isFinite]);
|
|
*
|
|
* func('1');
|
|
* // => true
|
|
*
|
|
* func(null);
|
|
* // => true
|
|
*
|
|
* func(NaN);
|
|
* // => false
|
|
*/
|
|
var overSome = createOver(arraySome);
|
|
|
|
/**
|
|
* Creates a function that returns the value at `path` of a given object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.4.0
|
|
* @category Util
|
|
* @param {Array|string} path The path of the property to get.
|
|
* @returns {Function} Returns the new accessor function.
|
|
* @example
|
|
*
|
|
* var objects = [
|
|
* { 'a': { 'b': 2 } },
|
|
* { 'a': { 'b': 1 } }
|
|
* ];
|
|
*
|
|
* _.map(objects, _.property('a.b'));
|
|
* // => [2, 1]
|
|
*
|
|
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
|
|
* // => [1, 2]
|
|
*/
|
|
function property(path) {
|
|
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
|
|
}
|
|
|
|
/**
|
|
* The opposite of `_.property`; this method creates a function that returns
|
|
* the value at a given path of `object`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.0.0
|
|
* @category Util
|
|
* @param {Object} object The object to query.
|
|
* @returns {Function} Returns the new accessor function.
|
|
* @example
|
|
*
|
|
* var array = [0, 1, 2],
|
|
* object = { 'a': array, 'b': array, 'c': array };
|
|
*
|
|
* _.map(['a[2]', 'c[0]'], _.propertyOf(object));
|
|
* // => [2, 0]
|
|
*
|
|
* _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
|
|
* // => [2, 0]
|
|
*/
|
|
function propertyOf(object) {
|
|
return function(path) {
|
|
return object == null ? undefined : baseGet(object, path);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates an array of numbers (positive and/or negative) progressing from
|
|
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
|
|
* `start` is specified without an `end` or `step`. If `end` is not specified,
|
|
* it's set to `start` with `start` then set to `0`.
|
|
*
|
|
* **Note:** JavaScript follows the IEEE-754 standard for resolving
|
|
* floating-point values which can produce unexpected results.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {number} [start=0] The start of the range.
|
|
* @param {number} end The end of the range.
|
|
* @param {number} [step=1] The value to increment or decrement by.
|
|
* @returns {Array} Returns the range of numbers.
|
|
* @see _.inRange, _.rangeRight
|
|
* @example
|
|
*
|
|
* _.range(4);
|
|
* // => [0, 1, 2, 3]
|
|
*
|
|
* _.range(-4);
|
|
* // => [0, -1, -2, -3]
|
|
*
|
|
* _.range(1, 5);
|
|
* // => [1, 2, 3, 4]
|
|
*
|
|
* _.range(0, 20, 5);
|
|
* // => [0, 5, 10, 15]
|
|
*
|
|
* _.range(0, -4, -1);
|
|
* // => [0, -1, -2, -3]
|
|
*
|
|
* _.range(1, 4, 0);
|
|
* // => [1, 1, 1]
|
|
*
|
|
* _.range(0);
|
|
* // => []
|
|
*/
|
|
var range = createRange();
|
|
|
|
/**
|
|
* This method is like `_.range` except that it populates values in
|
|
* descending order.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {number} [start=0] The start of the range.
|
|
* @param {number} end The end of the range.
|
|
* @param {number} [step=1] The value to increment or decrement by.
|
|
* @returns {Array} Returns the range of numbers.
|
|
* @see _.inRange, _.range
|
|
* @example
|
|
*
|
|
* _.rangeRight(4);
|
|
* // => [3, 2, 1, 0]
|
|
*
|
|
* _.rangeRight(-4);
|
|
* // => [-3, -2, -1, 0]
|
|
*
|
|
* _.rangeRight(1, 5);
|
|
* // => [4, 3, 2, 1]
|
|
*
|
|
* _.rangeRight(0, 20, 5);
|
|
* // => [15, 10, 5, 0]
|
|
*
|
|
* _.rangeRight(0, -4, -1);
|
|
* // => [-3, -2, -1, 0]
|
|
*
|
|
* _.rangeRight(1, 4, 0);
|
|
* // => [1, 1, 1]
|
|
*
|
|
* _.rangeRight(0);
|
|
* // => []
|
|
*/
|
|
var rangeRight = createRange(true);
|
|
|
|
/**
|
|
* This method returns a new empty array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.13.0
|
|
* @category Util
|
|
* @returns {Array} Returns the new empty array.
|
|
* @example
|
|
*
|
|
* var arrays = _.times(2, _.stubArray);
|
|
*
|
|
* console.log(arrays);
|
|
* // => [[], []]
|
|
*
|
|
* console.log(arrays[0] === arrays[1]);
|
|
* // => false
|
|
*/
|
|
function stubArray() {
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* This method returns `false`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.13.0
|
|
* @category Util
|
|
* @returns {boolean} Returns `false`.
|
|
* @example
|
|
*
|
|
* _.times(2, _.stubFalse);
|
|
* // => [false, false]
|
|
*/
|
|
function stubFalse() {
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* This method returns a new empty object.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.13.0
|
|
* @category Util
|
|
* @returns {Object} Returns the new empty object.
|
|
* @example
|
|
*
|
|
* var objects = _.times(2, _.stubObject);
|
|
*
|
|
* console.log(objects);
|
|
* // => [{}, {}]
|
|
*
|
|
* console.log(objects[0] === objects[1]);
|
|
* // => false
|
|
*/
|
|
function stubObject() {
|
|
return {};
|
|
}
|
|
|
|
/**
|
|
* This method returns an empty string.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.13.0
|
|
* @category Util
|
|
* @returns {string} Returns the empty string.
|
|
* @example
|
|
*
|
|
* _.times(2, _.stubString);
|
|
* // => ['', '']
|
|
*/
|
|
function stubString() {
|
|
return '';
|
|
}
|
|
|
|
/**
|
|
* This method returns `true`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.13.0
|
|
* @category Util
|
|
* @returns {boolean} Returns `true`.
|
|
* @example
|
|
*
|
|
* _.times(2, _.stubTrue);
|
|
* // => [true, true]
|
|
*/
|
|
function stubTrue() {
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Invokes the iteratee `n` times, returning an array of the results of
|
|
* each invocation. The iteratee is invoked with one argument; (index).
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {number} n The number of times to invoke `iteratee`.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the array of results.
|
|
* @example
|
|
*
|
|
* _.times(3, String);
|
|
* // => ['0', '1', '2']
|
|
*
|
|
* _.times(4, _.constant(0));
|
|
* // => [0, 0, 0, 0]
|
|
*/
|
|
function times(n, iteratee) {
|
|
n = toInteger(n);
|
|
if (n < 1 || n > MAX_SAFE_INTEGER) {
|
|
return [];
|
|
}
|
|
var index = MAX_ARRAY_LENGTH,
|
|
length = nativeMin(n, MAX_ARRAY_LENGTH);
|
|
|
|
iteratee = getIteratee(iteratee);
|
|
n -= MAX_ARRAY_LENGTH;
|
|
|
|
var result = baseTimes(length, iteratee);
|
|
while (++index < n) {
|
|
iteratee(index);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Converts `value` to a property path array.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Util
|
|
* @param {*} value The value to convert.
|
|
* @returns {Array} Returns the new property path array.
|
|
* @example
|
|
*
|
|
* _.toPath('a.b.c');
|
|
* // => ['a', 'b', 'c']
|
|
*
|
|
* _.toPath('a[0].b.c');
|
|
* // => ['a', '0', 'b', 'c']
|
|
*/
|
|
function toPath(value) {
|
|
if (isArray(value)) {
|
|
return arrayMap(value, toKey);
|
|
}
|
|
return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
|
|
}
|
|
|
|
/**
|
|
* Generates a unique ID. If `prefix` is given, the ID is appended to it.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {string} [prefix=''] The value to prefix the ID with.
|
|
* @returns {string} Returns the unique ID.
|
|
* @example
|
|
*
|
|
* _.uniqueId('contact_');
|
|
* // => 'contact_104'
|
|
*
|
|
* _.uniqueId();
|
|
* // => '105'
|
|
*/
|
|
function uniqueId(prefix) {
|
|
var id = ++idCounter;
|
|
return toString(prefix) + id;
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Adds two numbers.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.4.0
|
|
* @category Math
|
|
* @param {number} augend The first number in an addition.
|
|
* @param {number} addend The second number in an addition.
|
|
* @returns {number} Returns the total.
|
|
* @example
|
|
*
|
|
* _.add(6, 4);
|
|
* // => 10
|
|
*/
|
|
var add = createMathOperation(function(augend, addend) {
|
|
return augend + addend;
|
|
}, 0);
|
|
|
|
/**
|
|
* Computes `number` rounded up to `precision`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.10.0
|
|
* @category Math
|
|
* @param {number} number The number to round up.
|
|
* @param {number} [precision=0] The precision to round up to.
|
|
* @returns {number} Returns the rounded up number.
|
|
* @example
|
|
*
|
|
* _.ceil(4.006);
|
|
* // => 5
|
|
*
|
|
* _.ceil(6.004, 2);
|
|
* // => 6.01
|
|
*
|
|
* _.ceil(6040, -2);
|
|
* // => 6100
|
|
*/
|
|
var ceil = createRound('ceil');
|
|
|
|
/**
|
|
* Divide two numbers.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.7.0
|
|
* @category Math
|
|
* @param {number} dividend The first number in a division.
|
|
* @param {number} divisor The second number in a division.
|
|
* @returns {number} Returns the quotient.
|
|
* @example
|
|
*
|
|
* _.divide(6, 4);
|
|
* // => 1.5
|
|
*/
|
|
var divide = createMathOperation(function(dividend, divisor) {
|
|
return dividend / divisor;
|
|
}, 1);
|
|
|
|
/**
|
|
* Computes `number` rounded down to `precision`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.10.0
|
|
* @category Math
|
|
* @param {number} number The number to round down.
|
|
* @param {number} [precision=0] The precision to round down to.
|
|
* @returns {number} Returns the rounded down number.
|
|
* @example
|
|
*
|
|
* _.floor(4.006);
|
|
* // => 4
|
|
*
|
|
* _.floor(0.046, 2);
|
|
* // => 0.04
|
|
*
|
|
* _.floor(4060, -2);
|
|
* // => 4000
|
|
*/
|
|
var floor = createRound('floor');
|
|
|
|
/**
|
|
* Computes the maximum value of `array`. If `array` is empty or falsey,
|
|
* `undefined` is returned.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @returns {*} Returns the maximum value.
|
|
* @example
|
|
*
|
|
* _.max([4, 2, 8, 6]);
|
|
* // => 8
|
|
*
|
|
* _.max([]);
|
|
* // => undefined
|
|
*/
|
|
function max(array) {
|
|
return (array && array.length)
|
|
? baseExtremum(array, identity, baseGt)
|
|
: undefined;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.max` except that it accepts `iteratee` which is
|
|
* invoked for each element in `array` to generate the criterion by which
|
|
* the value is ranked. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {*} Returns the maximum value.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
|
*
|
|
* _.maxBy(objects, function(o) { return o.n; });
|
|
* // => { 'n': 2 }
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.maxBy(objects, 'n');
|
|
* // => { 'n': 2 }
|
|
*/
|
|
function maxBy(array, iteratee) {
|
|
return (array && array.length)
|
|
? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
|
|
: undefined;
|
|
}
|
|
|
|
/**
|
|
* Computes the mean of the values in `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @returns {number} Returns the mean.
|
|
* @example
|
|
*
|
|
* _.mean([4, 2, 8, 6]);
|
|
* // => 5
|
|
*/
|
|
function mean(array) {
|
|
return baseMean(array, identity);
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.mean` except that it accepts `iteratee` which is
|
|
* invoked for each element in `array` to generate the value to be averaged.
|
|
* The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.7.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {number} Returns the mean.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
|
|
*
|
|
* _.meanBy(objects, function(o) { return o.n; });
|
|
* // => 5
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.meanBy(objects, 'n');
|
|
* // => 5
|
|
*/
|
|
function meanBy(array, iteratee) {
|
|
return baseMean(array, getIteratee(iteratee, 2));
|
|
}
|
|
|
|
/**
|
|
* Computes the minimum value of `array`. If `array` is empty or falsey,
|
|
* `undefined` is returned.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @returns {*} Returns the minimum value.
|
|
* @example
|
|
*
|
|
* _.min([4, 2, 8, 6]);
|
|
* // => 2
|
|
*
|
|
* _.min([]);
|
|
* // => undefined
|
|
*/
|
|
function min(array) {
|
|
return (array && array.length)
|
|
? baseExtremum(array, identity, baseLt)
|
|
: undefined;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.min` except that it accepts `iteratee` which is
|
|
* invoked for each element in `array` to generate the criterion by which
|
|
* the value is ranked. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {*} Returns the minimum value.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
|
*
|
|
* _.minBy(objects, function(o) { return o.n; });
|
|
* // => { 'n': 1 }
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.minBy(objects, 'n');
|
|
* // => { 'n': 1 }
|
|
*/
|
|
function minBy(array, iteratee) {
|
|
return (array && array.length)
|
|
? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
|
|
: undefined;
|
|
}
|
|
|
|
/**
|
|
* Multiply two numbers.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.7.0
|
|
* @category Math
|
|
* @param {number} multiplier The first number in a multiplication.
|
|
* @param {number} multiplicand The second number in a multiplication.
|
|
* @returns {number} Returns the product.
|
|
* @example
|
|
*
|
|
* _.multiply(6, 4);
|
|
* // => 24
|
|
*/
|
|
var multiply = createMathOperation(function(multiplier, multiplicand) {
|
|
return multiplier * multiplicand;
|
|
}, 1);
|
|
|
|
/**
|
|
* Computes `number` rounded to `precision`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.10.0
|
|
* @category Math
|
|
* @param {number} number The number to round.
|
|
* @param {number} [precision=0] The precision to round to.
|
|
* @returns {number} Returns the rounded number.
|
|
* @example
|
|
*
|
|
* _.round(4.006);
|
|
* // => 4
|
|
*
|
|
* _.round(4.006, 2);
|
|
* // => 4.01
|
|
*
|
|
* _.round(4060, -2);
|
|
* // => 4100
|
|
*/
|
|
var round = createRound('round');
|
|
|
|
/**
|
|
* Subtract two numbers.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Math
|
|
* @param {number} minuend The first number in a subtraction.
|
|
* @param {number} subtrahend The second number in a subtraction.
|
|
* @returns {number} Returns the difference.
|
|
* @example
|
|
*
|
|
* _.subtract(6, 4);
|
|
* // => 2
|
|
*/
|
|
var subtract = createMathOperation(function(minuend, subtrahend) {
|
|
return minuend - subtrahend;
|
|
}, 0);
|
|
|
|
/**
|
|
* Computes the sum of the values in `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 3.4.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @returns {number} Returns the sum.
|
|
* @example
|
|
*
|
|
* _.sum([4, 2, 8, 6]);
|
|
* // => 20
|
|
*/
|
|
function sum(array) {
|
|
return (array && array.length)
|
|
? baseSum(array, identity)
|
|
: 0;
|
|
}
|
|
|
|
/**
|
|
* This method is like `_.sum` except that it accepts `iteratee` which is
|
|
* invoked for each element in `array` to generate the value to be summed.
|
|
* The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {number} Returns the sum.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
|
|
*
|
|
* _.sumBy(objects, function(o) { return o.n; });
|
|
* // => 20
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.sumBy(objects, 'n');
|
|
* // => 20
|
|
*/
|
|
function sumBy(array, iteratee) {
|
|
return (array && array.length)
|
|
? baseSum(array, getIteratee(iteratee, 2))
|
|
: 0;
|
|
}
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
// Add methods that return wrapped values in chain sequences.
|
|
lodash.after = after;
|
|
lodash.ary = ary;
|
|
lodash.assign = assign;
|
|
lodash.assignIn = assignIn;
|
|
lodash.assignInWith = assignInWith;
|
|
lodash.assignWith = assignWith;
|
|
lodash.at = at;
|
|
lodash.before = before;
|
|
lodash.bind = bind;
|
|
lodash.bindAll = bindAll;
|
|
lodash.bindKey = bindKey;
|
|
lodash.castArray = castArray;
|
|
lodash.chain = chain;
|
|
lodash.chunk = chunk;
|
|
lodash.compact = compact;
|
|
lodash.concat = concat;
|
|
lodash.cond = cond;
|
|
lodash.conforms = conforms;
|
|
lodash.constant = constant;
|
|
lodash.countBy = countBy;
|
|
lodash.create = create;
|
|
lodash.curry = curry;
|
|
lodash.curryRight = curryRight;
|
|
lodash.debounce = debounce;
|
|
lodash.defaults = defaults;
|
|
lodash.defaultsDeep = defaultsDeep;
|
|
lodash.defer = defer;
|
|
lodash.delay = delay;
|
|
lodash.difference = difference;
|
|
lodash.differenceBy = differenceBy;
|
|
lodash.differenceWith = differenceWith;
|
|
lodash.drop = drop;
|
|
lodash.dropRight = dropRight;
|
|
lodash.dropRightWhile = dropRightWhile;
|
|
lodash.dropWhile = dropWhile;
|
|
lodash.fill = fill;
|
|
lodash.filter = filter;
|
|
lodash.flatMap = flatMap;
|
|
lodash.flatMapDeep = flatMapDeep;
|
|
lodash.flatMapDepth = flatMapDepth;
|
|
lodash.flatten = flatten;
|
|
lodash.flattenDeep = flattenDeep;
|
|
lodash.flattenDepth = flattenDepth;
|
|
lodash.flip = flip;
|
|
lodash.flow = flow;
|
|
lodash.flowRight = flowRight;
|
|
lodash.fromPairs = fromPairs;
|
|
lodash.functions = functions;
|
|
lodash.functionsIn = functionsIn;
|
|
lodash.groupBy = groupBy;
|
|
lodash.initial = initial;
|
|
lodash.intersection = intersection;
|
|
lodash.intersectionBy = intersectionBy;
|
|
lodash.intersectionWith = intersectionWith;
|
|
lodash.invert = invert;
|
|
lodash.invertBy = invertBy;
|
|
lodash.invokeMap = invokeMap;
|
|
lodash.iteratee = iteratee;
|
|
lodash.keyBy = keyBy;
|
|
lodash.keys = keys;
|
|
lodash.keysIn = keysIn;
|
|
lodash.map = map;
|
|
lodash.mapKeys = mapKeys;
|
|
lodash.mapValues = mapValues;
|
|
lodash.matches = matches;
|
|
lodash.matchesProperty = matchesProperty;
|
|
lodash.memoize = memoize;
|
|
lodash.merge = merge;
|
|
lodash.mergeWith = mergeWith;
|
|
lodash.method = method;
|
|
lodash.methodOf = methodOf;
|
|
lodash.mixin = mixin;
|
|
lodash.negate = negate;
|
|
lodash.nthArg = nthArg;
|
|
lodash.omit = omit;
|
|
lodash.omitBy = omitBy;
|
|
lodash.once = once;
|
|
lodash.orderBy = orderBy;
|
|
lodash.over = over;
|
|
lodash.overArgs = overArgs;
|
|
lodash.overEvery = overEvery;
|
|
lodash.overSome = overSome;
|
|
lodash.partial = partial;
|
|
lodash.partialRight = partialRight;
|
|
lodash.partition = partition;
|
|
lodash.pick = pick;
|
|
lodash.pickBy = pickBy;
|
|
lodash.property = property;
|
|
lodash.propertyOf = propertyOf;
|
|
lodash.pull = pull;
|
|
lodash.pullAll = pullAll;
|
|
lodash.pullAllBy = pullAllBy;
|
|
lodash.pullAllWith = pullAllWith;
|
|
lodash.pullAt = pullAt;
|
|
lodash.range = range;
|
|
lodash.rangeRight = rangeRight;
|
|
lodash.rearg = rearg;
|
|
lodash.reject = reject;
|
|
lodash.remove = remove;
|
|
lodash.rest = rest;
|
|
lodash.reverse = reverse;
|
|
lodash.sampleSize = sampleSize;
|
|
lodash.set = set;
|
|
lodash.setWith = setWith;
|
|
lodash.shuffle = shuffle;
|
|
lodash.slice = slice;
|
|
lodash.sortBy = sortBy;
|
|
lodash.sortedUniq = sortedUniq;
|
|
lodash.sortedUniqBy = sortedUniqBy;
|
|
lodash.split = split;
|
|
lodash.spread = spread;
|
|
lodash.tail = tail;
|
|
lodash.take = take;
|
|
lodash.takeRight = takeRight;
|
|
lodash.takeRightWhile = takeRightWhile;
|
|
lodash.takeWhile = takeWhile;
|
|
lodash.tap = tap;
|
|
lodash.throttle = throttle;
|
|
lodash.thru = thru;
|
|
lodash.toArray = toArray;
|
|
lodash.toPairs = toPairs;
|
|
lodash.toPairsIn = toPairsIn;
|
|
lodash.toPath = toPath;
|
|
lodash.toPlainObject = toPlainObject;
|
|
lodash.transform = transform;
|
|
lodash.unary = unary;
|
|
lodash.union = union;
|
|
lodash.unionBy = unionBy;
|
|
lodash.unionWith = unionWith;
|
|
lodash.uniq = uniq;
|
|
lodash.uniqBy = uniqBy;
|
|
lodash.uniqWith = uniqWith;
|
|
lodash.unset = unset;
|
|
lodash.unzip = unzip;
|
|
lodash.unzipWith = unzipWith;
|
|
lodash.update = update;
|
|
lodash.updateWith = updateWith;
|
|
lodash.values = values;
|
|
lodash.valuesIn = valuesIn;
|
|
lodash.without = without;
|
|
lodash.words = words;
|
|
lodash.wrap = wrap;
|
|
lodash.xor = xor;
|
|
lodash.xorBy = xorBy;
|
|
lodash.xorWith = xorWith;
|
|
lodash.zip = zip;
|
|
lodash.zipObject = zipObject;
|
|
lodash.zipObjectDeep = zipObjectDeep;
|
|
lodash.zipWith = zipWith;
|
|
|
|
// Add aliases.
|
|
lodash.entries = toPairs;
|
|
lodash.entriesIn = toPairsIn;
|
|
lodash.extend = assignIn;
|
|
lodash.extendWith = assignInWith;
|
|
|
|
// Add methods to `lodash.prototype`.
|
|
mixin(lodash, lodash);
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
// Add methods that return unwrapped values in chain sequences.
|
|
lodash.add = add;
|
|
lodash.attempt = attempt;
|
|
lodash.camelCase = camelCase;
|
|
lodash.capitalize = capitalize;
|
|
lodash.ceil = ceil;
|
|
lodash.clamp = clamp;
|
|
lodash.clone = clone;
|
|
lodash.cloneDeep = cloneDeep;
|
|
lodash.cloneDeepWith = cloneDeepWith;
|
|
lodash.cloneWith = cloneWith;
|
|
lodash.conformsTo = conformsTo;
|
|
lodash.deburr = deburr;
|
|
lodash.defaultTo = defaultTo;
|
|
lodash.divide = divide;
|
|
lodash.endsWith = endsWith;
|
|
lodash.eq = eq;
|
|
lodash.escape = escape;
|
|
lodash.escapeRegExp = escapeRegExp;
|
|
lodash.every = every;
|
|
lodash.find = find;
|
|
lodash.findIndex = findIndex;
|
|
lodash.findKey = findKey;
|
|
lodash.findLast = findLast;
|
|
lodash.findLastIndex = findLastIndex;
|
|
lodash.findLastKey = findLastKey;
|
|
lodash.floor = floor;
|
|
lodash.forEach = forEach;
|
|
lodash.forEachRight = forEachRight;
|
|
lodash.forIn = forIn;
|
|
lodash.forInRight = forInRight;
|
|
lodash.forOwn = forOwn;
|
|
lodash.forOwnRight = forOwnRight;
|
|
lodash.get = get;
|
|
lodash.gt = gt;
|
|
lodash.gte = gte;
|
|
lodash.has = has;
|
|
lodash.hasIn = hasIn;
|
|
lodash.head = head;
|
|
lodash.identity = identity;
|
|
lodash.includes = includes;
|
|
lodash.indexOf = indexOf;
|
|
lodash.inRange = inRange;
|
|
lodash.invoke = invoke;
|
|
lodash.isArguments = isArguments;
|
|
lodash.isArray = isArray;
|
|
lodash.isArrayBuffer = isArrayBuffer;
|
|
lodash.isArrayLike = isArrayLike;
|
|
lodash.isArrayLikeObject = isArrayLikeObject;
|
|
lodash.isBoolean = isBoolean;
|
|
lodash.isBuffer = isBuffer;
|
|
lodash.isDate = isDate;
|
|
lodash.isElement = isElement;
|
|
lodash.isEmpty = isEmpty;
|
|
lodash.isEqual = isEqual;
|
|
lodash.isEqualWith = isEqualWith;
|
|
lodash.isError = isError;
|
|
lodash.isFinite = isFinite;
|
|
lodash.isFunction = isFunction;
|
|
lodash.isInteger = isInteger;
|
|
lodash.isLength = isLength;
|
|
lodash.isMap = isMap;
|
|
lodash.isMatch = isMatch;
|
|
lodash.isMatchWith = isMatchWith;
|
|
lodash.isNaN = isNaN;
|
|
lodash.isNative = isNative;
|
|
lodash.isNil = isNil;
|
|
lodash.isNull = isNull;
|
|
lodash.isNumber = isNumber;
|
|
lodash.isObject = isObject;
|
|
lodash.isObjectLike = isObjectLike;
|
|
lodash.isPlainObject = isPlainObject;
|
|
lodash.isRegExp = isRegExp;
|
|
lodash.isSafeInteger = isSafeInteger;
|
|
lodash.isSet = isSet;
|
|
lodash.isString = isString;
|
|
lodash.isSymbol = isSymbol;
|
|
lodash.isTypedArray = isTypedArray;
|
|
lodash.isUndefined = isUndefined;
|
|
lodash.isWeakMap = isWeakMap;
|
|
lodash.isWeakSet = isWeakSet;
|
|
lodash.join = join;
|
|
lodash.kebabCase = kebabCase;
|
|
lodash.last = last;
|
|
lodash.lastIndexOf = lastIndexOf;
|
|
lodash.lowerCase = lowerCase;
|
|
lodash.lowerFirst = lowerFirst;
|
|
lodash.lt = lt;
|
|
lodash.lte = lte;
|
|
lodash.max = max;
|
|
lodash.maxBy = maxBy;
|
|
lodash.mean = mean;
|
|
lodash.meanBy = meanBy;
|
|
lodash.min = min;
|
|
lodash.minBy = minBy;
|
|
lodash.stubArray = stubArray;
|
|
lodash.stubFalse = stubFalse;
|
|
lodash.stubObject = stubObject;
|
|
lodash.stubString = stubString;
|
|
lodash.stubTrue = stubTrue;
|
|
lodash.multiply = multiply;
|
|
lodash.nth = nth;
|
|
lodash.noConflict = noConflict;
|
|
lodash.noop = noop;
|
|
lodash.now = now;
|
|
lodash.pad = pad;
|
|
lodash.padEnd = padEnd;
|
|
lodash.padStart = padStart;
|
|
lodash.parseInt = parseInt;
|
|
lodash.random = random;
|
|
lodash.reduce = reduce;
|
|
lodash.reduceRight = reduceRight;
|
|
lodash.repeat = repeat;
|
|
lodash.replace = replace;
|
|
lodash.result = result;
|
|
lodash.round = round;
|
|
lodash.runInContext = runInContext;
|
|
lodash.sample = sample;
|
|
lodash.size = size;
|
|
lodash.snakeCase = snakeCase;
|
|
lodash.some = some;
|
|
lodash.sortedIndex = sortedIndex;
|
|
lodash.sortedIndexBy = sortedIndexBy;
|
|
lodash.sortedIndexOf = sortedIndexOf;
|
|
lodash.sortedLastIndex = sortedLastIndex;
|
|
lodash.sortedLastIndexBy = sortedLastIndexBy;
|
|
lodash.sortedLastIndexOf = sortedLastIndexOf;
|
|
lodash.startCase = startCase;
|
|
lodash.startsWith = startsWith;
|
|
lodash.subtract = subtract;
|
|
lodash.sum = sum;
|
|
lodash.sumBy = sumBy;
|
|
lodash.template = template;
|
|
lodash.times = times;
|
|
lodash.toFinite = toFinite;
|
|
lodash.toInteger = toInteger;
|
|
lodash.toLength = toLength;
|
|
lodash.toLower = toLower;
|
|
lodash.toNumber = toNumber;
|
|
lodash.toSafeInteger = toSafeInteger;
|
|
lodash.toString = toString;
|
|
lodash.toUpper = toUpper;
|
|
lodash.trim = trim;
|
|
lodash.trimEnd = trimEnd;
|
|
lodash.trimStart = trimStart;
|
|
lodash.truncate = truncate;
|
|
lodash.unescape = unescape;
|
|
lodash.uniqueId = uniqueId;
|
|
lodash.upperCase = upperCase;
|
|
lodash.upperFirst = upperFirst;
|
|
|
|
// Add aliases.
|
|
lodash.each = forEach;
|
|
lodash.eachRight = forEachRight;
|
|
lodash.first = head;
|
|
|
|
mixin(lodash, (function() {
|
|
var source = {};
|
|
baseForOwn(lodash, function(func, methodName) {
|
|
if (!hasOwnProperty.call(lodash.prototype, methodName)) {
|
|
source[methodName] = func;
|
|
}
|
|
});
|
|
return source;
|
|
}()), { 'chain': false });
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* The semantic version number.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @type {string}
|
|
*/
|
|
lodash.VERSION = VERSION;
|
|
|
|
// Assign default placeholders.
|
|
arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
|
|
lodash[methodName].placeholder = lodash;
|
|
});
|
|
|
|
// Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
|
|
arrayEach(['drop', 'take'], function(methodName, index) {
|
|
LazyWrapper.prototype[methodName] = function(n) {
|
|
n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
|
|
|
|
var result = (this.__filtered__ && !index)
|
|
? new LazyWrapper(this)
|
|
: this.clone();
|
|
|
|
if (result.__filtered__) {
|
|
result.__takeCount__ = nativeMin(n, result.__takeCount__);
|
|
} else {
|
|
result.__views__.push({
|
|
'size': nativeMin(n, MAX_ARRAY_LENGTH),
|
|
'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
|
|
});
|
|
}
|
|
return result;
|
|
};
|
|
|
|
LazyWrapper.prototype[methodName + 'Right'] = function(n) {
|
|
return this.reverse()[methodName](n).reverse();
|
|
};
|
|
});
|
|
|
|
// Add `LazyWrapper` methods that accept an `iteratee` value.
|
|
arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
|
|
var type = index + 1,
|
|
isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
|
|
|
|
LazyWrapper.prototype[methodName] = function(iteratee) {
|
|
var result = this.clone();
|
|
result.__iteratees__.push({
|
|
'iteratee': getIteratee(iteratee, 3),
|
|
'type': type
|
|
});
|
|
result.__filtered__ = result.__filtered__ || isFilter;
|
|
return result;
|
|
};
|
|
});
|
|
|
|
// Add `LazyWrapper` methods for `_.head` and `_.last`.
|
|
arrayEach(['head', 'last'], function(methodName, index) {
|
|
var takeName = 'take' + (index ? 'Right' : '');
|
|
|
|
LazyWrapper.prototype[methodName] = function() {
|
|
return this[takeName](1).value()[0];
|
|
};
|
|
});
|
|
|
|
// Add `LazyWrapper` methods for `_.initial` and `_.tail`.
|
|
arrayEach(['initial', 'tail'], function(methodName, index) {
|
|
var dropName = 'drop' + (index ? '' : 'Right');
|
|
|
|
LazyWrapper.prototype[methodName] = function() {
|
|
return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
|
|
};
|
|
});
|
|
|
|
LazyWrapper.prototype.compact = function() {
|
|
return this.filter(identity);
|
|
};
|
|
|
|
LazyWrapper.prototype.find = function(predicate) {
|
|
return this.filter(predicate).head();
|
|
};
|
|
|
|
LazyWrapper.prototype.findLast = function(predicate) {
|
|
return this.reverse().find(predicate);
|
|
};
|
|
|
|
LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
|
|
if (typeof path == 'function') {
|
|
return new LazyWrapper(this);
|
|
}
|
|
return this.map(function(value) {
|
|
return baseInvoke(value, path, args);
|
|
});
|
|
});
|
|
|
|
LazyWrapper.prototype.reject = function(predicate) {
|
|
return this.filter(negate(getIteratee(predicate)));
|
|
};
|
|
|
|
LazyWrapper.prototype.slice = function(start, end) {
|
|
start = toInteger(start);
|
|
|
|
var result = this;
|
|
if (result.__filtered__ && (start > 0 || end < 0)) {
|
|
return new LazyWrapper(result);
|
|
}
|
|
if (start < 0) {
|
|
result = result.takeRight(-start);
|
|
} else if (start) {
|
|
result = result.drop(start);
|
|
}
|
|
if (end !== undefined) {
|
|
end = toInteger(end);
|
|
result = end < 0 ? result.dropRight(-end) : result.take(end - start);
|
|
}
|
|
return result;
|
|
};
|
|
|
|
LazyWrapper.prototype.takeRightWhile = function(predicate) {
|
|
return this.reverse().takeWhile(predicate).reverse();
|
|
};
|
|
|
|
LazyWrapper.prototype.toArray = function() {
|
|
return this.take(MAX_ARRAY_LENGTH);
|
|
};
|
|
|
|
// Add `LazyWrapper` methods to `lodash.prototype`.
|
|
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
|
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
|
|
isTaker = /^(?:head|last)$/.test(methodName),
|
|
lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
|
|
retUnwrapped = isTaker || /^find/.test(methodName);
|
|
|
|
if (!lodashFunc) {
|
|
return;
|
|
}
|
|
lodash.prototype[methodName] = function() {
|
|
var value = this.__wrapped__,
|
|
args = isTaker ? [1] : arguments,
|
|
isLazy = value instanceof LazyWrapper,
|
|
iteratee = args[0],
|
|
useLazy = isLazy || isArray(value);
|
|
|
|
var interceptor = function(value) {
|
|
var result = lodashFunc.apply(lodash, arrayPush([value], args));
|
|
return (isTaker && chainAll) ? result[0] : result;
|
|
};
|
|
|
|
if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
|
|
// Avoid lazy use if the iteratee has a "length" value other than `1`.
|
|
isLazy = useLazy = false;
|
|
}
|
|
var chainAll = this.__chain__,
|
|
isHybrid = !!this.__actions__.length,
|
|
isUnwrapped = retUnwrapped && !chainAll,
|
|
onlyLazy = isLazy && !isHybrid;
|
|
|
|
if (!retUnwrapped && useLazy) {
|
|
value = onlyLazy ? value : new LazyWrapper(this);
|
|
var result = func.apply(value, args);
|
|
result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
|
|
return new LodashWrapper(result, chainAll);
|
|
}
|
|
if (isUnwrapped && onlyLazy) {
|
|
return func.apply(this, args);
|
|
}
|
|
result = this.thru(interceptor);
|
|
return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
|
|
};
|
|
});
|
|
|
|
// Add `Array` methods to `lodash.prototype`.
|
|
arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
|
|
var func = arrayProto[methodName],
|
|
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
|
|
retUnwrapped = /^(?:pop|shift)$/.test(methodName);
|
|
|
|
lodash.prototype[methodName] = function() {
|
|
var args = arguments;
|
|
if (retUnwrapped && !this.__chain__) {
|
|
var value = this.value();
|
|
return func.apply(isArray(value) ? value : [], args);
|
|
}
|
|
return this[chainName](function(value) {
|
|
return func.apply(isArray(value) ? value : [], args);
|
|
});
|
|
};
|
|
});
|
|
|
|
// Map minified method names to their real names.
|
|
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
|
var lodashFunc = lodash[methodName];
|
|
if (lodashFunc) {
|
|
var key = (lodashFunc.name + ''),
|
|
names = realNames[key] || (realNames[key] = []);
|
|
|
|
names.push({ 'name': methodName, 'func': lodashFunc });
|
|
}
|
|
});
|
|
|
|
realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
|
|
'name': 'wrapper',
|
|
'func': undefined
|
|
}];
|
|
|
|
// Add methods to `LazyWrapper`.
|
|
LazyWrapper.prototype.clone = lazyClone;
|
|
LazyWrapper.prototype.reverse = lazyReverse;
|
|
LazyWrapper.prototype.value = lazyValue;
|
|
|
|
// Add chain sequence methods to the `lodash` wrapper.
|
|
lodash.prototype.at = wrapperAt;
|
|
lodash.prototype.chain = wrapperChain;
|
|
lodash.prototype.commit = wrapperCommit;
|
|
lodash.prototype.next = wrapperNext;
|
|
lodash.prototype.plant = wrapperPlant;
|
|
lodash.prototype.reverse = wrapperReverse;
|
|
lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
|
|
|
|
// Add lazy aliases.
|
|
lodash.prototype.first = lodash.prototype.head;
|
|
|
|
if (symIterator) {
|
|
lodash.prototype[symIterator] = wrapperToIterator;
|
|
}
|
|
return lodash;
|
|
});
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
// Export lodash.
|
|
var _ = runInContext();
|
|
|
|
// Some AMD build optimizers, like r.js, check for condition patterns like:
|
|
if (true) {
|
|
// Expose Lodash on the global object to prevent errors when Lodash is
|
|
// loaded by a script tag in the presence of an AMD loader.
|
|
// See http://requirejs.org/docs/errors.html#mismatch for more details.
|
|
// Use `_.noConflict` to remove Lodash from the global object.
|
|
root._ = _;
|
|
|
|
// Define as an anonymous module so, through path mapping, it can be
|
|
// referenced as the "underscore" module.
|
|
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
|
|
return _;
|
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
}
|
|
// Check for `exports` after `define` in case a build optimizer adds it.
|
|
else if (freeModule) {
|
|
// Export for Node.js.
|
|
(freeModule.exports = _)._ = _;
|
|
// Export for CommonJS support.
|
|
freeExports._ = _;
|
|
}
|
|
else {
|
|
// Export to the global object.
|
|
root._ = _;
|
|
}
|
|
}.call(this));
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(8)(module)))
|
|
|
|
/***/ },
|
|
/* 8 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = function(module) {
|
|
if(!module.webpackPolyfill) {
|
|
module.deprecate = function() {};
|
|
module.paths = [];
|
|
// module.parent = undefined by default
|
|
module.children = [];
|
|
module.webpackPolyfill = 1;
|
|
}
|
|
return module;
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 9 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
var _ = __webpack_require__(7);
|
|
|
|
_.noConflict();
|
|
|
|
function typeName(bold, italics) {
|
|
var type = 'normal';
|
|
if (bold && italics) {
|
|
type = 'bolditalics';
|
|
} else if (bold) {
|
|
type = 'bold';
|
|
} else if (italics) {
|
|
type = 'italics';
|
|
}
|
|
return type;
|
|
}
|
|
|
|
function FontProvider(fontDescriptors, pdfDoc) {
|
|
this.fonts = {};
|
|
this.pdfDoc = pdfDoc;
|
|
this.fontCache = {};
|
|
|
|
for (var font in fontDescriptors) {
|
|
if (fontDescriptors.hasOwnProperty(font)) {
|
|
var fontDef = fontDescriptors[font];
|
|
|
|
this.fonts[font] = {
|
|
normal: fontDef.normal,
|
|
bold: fontDef.bold,
|
|
italics: fontDef.italics,
|
|
bolditalics: fontDef.bolditalics
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|
|
FontProvider.prototype.provideFont = function (familyName, bold, italics) {
|
|
var type = typeName(bold, italics);
|
|
if (!this.fonts[familyName] || !this.fonts[familyName][type]) {
|
|
throw new Error('Font \'' + familyName + '\' in style \'' + type + '\' is not defined in the font section of the document definition.');
|
|
}
|
|
|
|
this.fontCache[familyName] = this.fontCache[familyName] || {};
|
|
|
|
if (!this.fontCache[familyName][type]) {
|
|
var def = this.fonts[familyName][type];
|
|
if (!Array.isArray(def)) {
|
|
def = [def];
|
|
}
|
|
this.fontCache[familyName][type] = this.pdfDoc.font.apply(this.pdfDoc, def)._font;
|
|
}
|
|
|
|
return this.fontCache[familyName][type];
|
|
};
|
|
|
|
module.exports = FontProvider;
|
|
|
|
|
|
/***/ },
|
|
/* 10 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
var _ = __webpack_require__(7);
|
|
var TraversalTracker = __webpack_require__(11);
|
|
var DocMeasure = __webpack_require__(12);
|
|
var DocumentContext = __webpack_require__(24);
|
|
var PageElementWriter = __webpack_require__(25);
|
|
var ColumnCalculator = __webpack_require__(21);
|
|
var TableProcessor = __webpack_require__(28);
|
|
var Line = __webpack_require__(27);
|
|
var pack = __webpack_require__(22).pack;
|
|
var offsetVector = __webpack_require__(22).offsetVector;
|
|
var fontStringify = __webpack_require__(22).fontStringify;
|
|
var isFunction = __webpack_require__(22).isFunction;
|
|
var TextTools = __webpack_require__(13);
|
|
var StyleContextStack = __webpack_require__(20);
|
|
|
|
function addAll(target, otherArray) {
|
|
_.each(otherArray, function (item) {
|
|
target.push(item);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Creates an instance of LayoutBuilder - layout engine which turns document-definition-object
|
|
* into a set of pages, lines, inlines and vectors ready to be rendered into a PDF
|
|
*
|
|
* @param {Object} pageSize - an object defining page width and height
|
|
* @param {Object} pageMargins - an object defining top, left, right and bottom margins
|
|
*/
|
|
function LayoutBuilder(pageSize, pageMargins, imageMeasure) {
|
|
this.pageSize = pageSize;
|
|
this.pageMargins = pageMargins;
|
|
this.tracker = new TraversalTracker();
|
|
this.imageMeasure = imageMeasure;
|
|
this.tableLayouts = {};
|
|
}
|
|
|
|
LayoutBuilder.prototype.registerTableLayouts = function (tableLayouts) {
|
|
this.tableLayouts = pack(this.tableLayouts, tableLayouts);
|
|
};
|
|
|
|
/**
|
|
* Executes layout engine on document-definition-object and creates an array of pages
|
|
* containing positioned Blocks, Lines and inlines
|
|
*
|
|
* @param {Object} docStructure document-definition-object
|
|
* @param {Object} fontProvider font provider
|
|
* @param {Object} styleDictionary dictionary with style definitions
|
|
* @param {Object} defaultStyle default style definition
|
|
* @return {Array} an array of pages
|
|
*/
|
|
LayoutBuilder.prototype.layoutDocument = function (docStructure, fontProvider, styleDictionary, defaultStyle, background, header, footer, images, watermark, pageBreakBeforeFct) {
|
|
|
|
function addPageBreaksIfNecessary(linearNodeList, pages) {
|
|
|
|
if (!isFunction(pageBreakBeforeFct)) {
|
|
return false;
|
|
}
|
|
|
|
linearNodeList = _.reject(linearNodeList, function (node) {
|
|
return _.isEmpty(node.positions);
|
|
});
|
|
|
|
_.each(linearNodeList, function (node) {
|
|
var nodeInfo = _.pick(node, [
|
|
'id', 'text', 'ul', 'ol', 'table', 'image', 'qr', 'canvas', 'columns',
|
|
'headlineLevel', 'style', 'pageBreak', 'pageOrientation',
|
|
'width', 'height'
|
|
]);
|
|
nodeInfo.startPosition = _.first(node.positions);
|
|
nodeInfo.pageNumbers = _.chain(node.positions).map('pageNumber').uniq().value();
|
|
nodeInfo.pages = pages.length;
|
|
nodeInfo.stack = _.isArray(node.stack);
|
|
|
|
node.nodeInfo = nodeInfo;
|
|
});
|
|
|
|
return _.some(linearNodeList, function (node, index, followingNodeList) {
|
|
if (node.pageBreak !== 'before' && !node.pageBreakCalculated) {
|
|
node.pageBreakCalculated = true;
|
|
var pageNumber = _.first(node.nodeInfo.pageNumbers);
|
|
|
|
var followingNodesOnPage = _.chain(followingNodeList).drop(index + 1).filter(function (node0) {
|
|
return _.includes(node0.nodeInfo.pageNumbers, pageNumber);
|
|
}).value();
|
|
|
|
var nodesOnNextPage = _.chain(followingNodeList).drop(index + 1).filter(function (node0) {
|
|
return _.includes(node0.nodeInfo.pageNumbers, pageNumber + 1);
|
|
}).value();
|
|
|
|
var previousNodesOnPage = _.chain(followingNodeList).take(index).filter(function (node0) {
|
|
return _.includes(node0.nodeInfo.pageNumbers, pageNumber);
|
|
}).value();
|
|
|
|
if (pageBreakBeforeFct(node.nodeInfo,
|
|
_.map(followingNodesOnPage, 'nodeInfo'),
|
|
_.map(nodesOnNextPage, 'nodeInfo'),
|
|
_.map(previousNodesOnPage, 'nodeInfo'))) {
|
|
node.pageBreak = 'before';
|
|
return true;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
this.docMeasure = new DocMeasure(fontProvider, styleDictionary, defaultStyle, this.imageMeasure, this.tableLayouts, images);
|
|
|
|
|
|
function resetXYs(result) {
|
|
_.each(result.linearNodeList, function (node) {
|
|
node.resetXY();
|
|
});
|
|
}
|
|
|
|
var result = this.tryLayoutDocument(docStructure, fontProvider, styleDictionary, defaultStyle, background, header, footer, images, watermark);
|
|
while (addPageBreaksIfNecessary(result.linearNodeList, result.pages)) {
|
|
resetXYs(result);
|
|
result = this.tryLayoutDocument(docStructure, fontProvider, styleDictionary, defaultStyle, background, header, footer, images, watermark);
|
|
}
|
|
|
|
return result.pages;
|
|
};
|
|
|
|
LayoutBuilder.prototype.tryLayoutDocument = function (docStructure, fontProvider, styleDictionary, defaultStyle, background, header, footer, images, watermark, pageBreakBeforeFct) {
|
|
|
|
this.linearNodeList = [];
|
|
docStructure = this.docMeasure.measureDocument(docStructure);
|
|
|
|
this.writer = new PageElementWriter(
|
|
new DocumentContext(this.pageSize, this.pageMargins), this.tracker);
|
|
|
|
var _this = this;
|
|
this.writer.context().tracker.startTracking('pageAdded', function () {
|
|
_this.addBackground(background);
|
|
});
|
|
|
|
this.addBackground(background);
|
|
this.processNode(docStructure);
|
|
this.addHeadersAndFooters(header, footer);
|
|
/* jshint eqnull:true */
|
|
if (watermark != null) {
|
|
this.addWatermark(watermark, fontProvider, defaultStyle);
|
|
}
|
|
|
|
return {pages: this.writer.context().pages, linearNodeList: this.linearNodeList};
|
|
};
|
|
|
|
|
|
LayoutBuilder.prototype.addBackground = function (background) {
|
|
var backgroundGetter = isFunction(background) ? background : function () {
|
|
return background;
|
|
};
|
|
|
|
var pageBackground = backgroundGetter(this.writer.context().page + 1);
|
|
|
|
if (pageBackground) {
|
|
var pageSize = this.writer.context().getCurrentPage().pageSize;
|
|
this.writer.beginUnbreakableBlock(pageSize.width, pageSize.height);
|
|
this.processNode(this.docMeasure.measureDocument(pageBackground));
|
|
this.writer.commitUnbreakableBlock(0, 0);
|
|
}
|
|
};
|
|
|
|
LayoutBuilder.prototype.addStaticRepeatable = function (headerOrFooter, sizeFunction) {
|
|
this.addDynamicRepeatable(function () {
|
|
return headerOrFooter;
|
|
}, sizeFunction);
|
|
};
|
|
|
|
LayoutBuilder.prototype.addDynamicRepeatable = function (nodeGetter, sizeFunction) {
|
|
var pages = this.writer.context().pages;
|
|
|
|
for (var pageIndex = 0, l = pages.length; pageIndex < l; pageIndex++) {
|
|
this.writer.context().page = pageIndex;
|
|
|
|
var node = nodeGetter(pageIndex + 1, l, this.writer.context().pages[pageIndex].pageSize);
|
|
|
|
if (node) {
|
|
var sizes = sizeFunction(this.writer.context().getCurrentPage().pageSize, this.pageMargins);
|
|
this.writer.beginUnbreakableBlock(sizes.width, sizes.height);
|
|
this.processNode(this.docMeasure.measureDocument(node));
|
|
this.writer.commitUnbreakableBlock(sizes.x, sizes.y);
|
|
}
|
|
}
|
|
};
|
|
|
|
LayoutBuilder.prototype.addHeadersAndFooters = function (header, footer) {
|
|
var headerSizeFct = function (pageSize, pageMargins) {
|
|
return {
|
|
x: 0,
|
|
y: 0,
|
|
width: pageSize.width,
|
|
height: pageMargins.top
|
|
};
|
|
};
|
|
|
|
var footerSizeFct = function (pageSize, pageMargins) {
|
|
return {
|
|
x: 0,
|
|
y: pageSize.height - pageMargins.bottom,
|
|
width: pageSize.width,
|
|
height: pageMargins.bottom
|
|
};
|
|
};
|
|
|
|
if (isFunction(header)) {
|
|
this.addDynamicRepeatable(header, headerSizeFct);
|
|
} else if (header) {
|
|
this.addStaticRepeatable(header, headerSizeFct);
|
|
}
|
|
|
|
if (isFunction(footer)) {
|
|
this.addDynamicRepeatable(footer, footerSizeFct);
|
|
} else if (footer) {
|
|
this.addStaticRepeatable(footer, footerSizeFct);
|
|
}
|
|
};
|
|
|
|
LayoutBuilder.prototype.addWatermark = function (watermark, fontProvider, defaultStyle) {
|
|
if (typeof watermark === 'string') {
|
|
watermark = {'text': watermark};
|
|
}
|
|
|
|
if (!watermark.text) { // empty watermark text
|
|
return;
|
|
}
|
|
|
|
watermark.font = watermark.font || defaultStyle.font || 'Roboto';
|
|
watermark.color = watermark.color || 'black';
|
|
watermark.opacity = watermark.opacity || 0.6;
|
|
watermark.bold = watermark.bold || false;
|
|
watermark.italics = watermark.italics || false;
|
|
|
|
var watermarkObject = {
|
|
text: watermark.text,
|
|
font: fontProvider.provideFont(watermark.font, watermark.bold, watermark.italics),
|
|
size: getSize(this.pageSize, watermark, fontProvider),
|
|
color: watermark.color,
|
|
opacity: watermark.opacity
|
|
};
|
|
|
|
var pages = this.writer.context().pages;
|
|
for (var i = 0, l = pages.length; i < l; i++) {
|
|
pages[i].watermark = watermarkObject;
|
|
}
|
|
|
|
function getSize(pageSize, watermark, fontProvider) {
|
|
var width = pageSize.width;
|
|
var height = pageSize.height;
|
|
var targetWidth = Math.sqrt(width * width + height * height) * 0.8; /* page diagonal * sample factor */
|
|
var textTools = new TextTools(fontProvider);
|
|
var styleContextStack = new StyleContextStack(null, {font: watermark.font, bold: watermark.bold, italics: watermark.italics});
|
|
var size;
|
|
|
|
/**
|
|
* Binary search the best font size.
|
|
* Initial bounds [0, 1000]
|
|
* Break when range < 1
|
|
*/
|
|
var a = 0;
|
|
var b = 1000;
|
|
var c = (a + b) / 2;
|
|
while (Math.abs(a - b) > 1) {
|
|
styleContextStack.push({
|
|
fontSize: c
|
|
});
|
|
size = textTools.sizeOfString(watermark.text, styleContextStack);
|
|
if (size.width > targetWidth) {
|
|
b = c;
|
|
c = (a + b) / 2;
|
|
} else if (size.width < targetWidth) {
|
|
a = c;
|
|
c = (a + b) / 2;
|
|
}
|
|
styleContextStack.pop();
|
|
}
|
|
/*
|
|
End binary search
|
|
*/
|
|
return {size: size, fontSize: c};
|
|
}
|
|
};
|
|
|
|
function decorateNode(node) {
|
|
var x = node.x, y = node.y;
|
|
node.positions = [];
|
|
|
|
_.each(node.canvas, function (vector) {
|
|
var x = vector.x, y = vector.y, x1 = vector.x1, y1 = vector.y1, x2 = vector.x2, y2 = vector.y2;
|
|
vector.resetXY = function () {
|
|
vector.x = x;
|
|
vector.y = y;
|
|
vector.x1 = x1;
|
|
vector.y1 = y1;
|
|
vector.x2 = x2;
|
|
vector.y2 = y2;
|
|
};
|
|
});
|
|
|
|
node.resetXY = function () {
|
|
node.x = x;
|
|
node.y = y;
|
|
_.each(node.canvas, function (vector) {
|
|
vector.resetXY();
|
|
});
|
|
};
|
|
}
|
|
|
|
LayoutBuilder.prototype.processNode = function (node) {
|
|
var self = this;
|
|
|
|
this.linearNodeList.push(node);
|
|
decorateNode(node);
|
|
|
|
applyMargins(function () {
|
|
var absPosition = node.absolutePosition;
|
|
if (absPosition) {
|
|
self.writer.context().beginDetachedBlock();
|
|
self.writer.context().moveTo(absPosition.x || 0, absPosition.y || 0);
|
|
}
|
|
|
|
var relPosition = node.relativePosition;
|
|
if (relPosition) {
|
|
self.writer.context().beginDetachedBlock();
|
|
self.writer.context().moveTo((relPosition.x || 0) + self.writer.context().x, (relPosition.y || 0) + self.writer.context().y);
|
|
}
|
|
|
|
if (node.stack) {
|
|
self.processVerticalContainer(node);
|
|
} else if (node.columns) {
|
|
self.processColumns(node);
|
|
} else if (node.ul) {
|
|
self.processList(false, node);
|
|
} else if (node.ol) {
|
|
self.processList(true, node);
|
|
} else if (node.table) {
|
|
self.processTable(node);
|
|
} else if (node.text !== undefined) {
|
|
self.processLeaf(node);
|
|
} else if (node.image) {
|
|
self.processImage(node);
|
|
} else if (node.canvas) {
|
|
self.processCanvas(node);
|
|
} else if (node.qr) {
|
|
self.processQr(node);
|
|
} else if (!node._span) {
|
|
throw 'Unrecognized document structure: ' + JSON.stringify(node, fontStringify);
|
|
}
|
|
|
|
if (absPosition || relPosition) {
|
|
self.writer.context().endDetachedBlock();
|
|
}
|
|
});
|
|
|
|
function applyMargins(callback) {
|
|
var margin = node._margin;
|
|
|
|
if (node.pageBreak === 'before') {
|
|
self.writer.moveToNextPage(node.pageOrientation);
|
|
}
|
|
|
|
if (margin) {
|
|
self.writer.context().moveDown(margin[1]);
|
|
self.writer.context().addMargin(margin[0], margin[2]);
|
|
}
|
|
|
|
callback();
|
|
|
|
if (margin) {
|
|
self.writer.context().addMargin(-margin[0], -margin[2]);
|
|
self.writer.context().moveDown(margin[3]);
|
|
}
|
|
|
|
if (node.pageBreak === 'after') {
|
|
self.writer.moveToNextPage(node.pageOrientation);
|
|
}
|
|
}
|
|
};
|
|
|
|
// vertical container
|
|
LayoutBuilder.prototype.processVerticalContainer = function (node) {
|
|
var self = this;
|
|
node.stack.forEach(function (item) {
|
|
self.processNode(item);
|
|
addAll(node.positions, item.positions);
|
|
|
|
//TODO: paragraph gap
|
|
});
|
|
};
|
|
|
|
// columns
|
|
LayoutBuilder.prototype.processColumns = function (columnNode) {
|
|
var columns = columnNode.columns;
|
|
var availableWidth = this.writer.context().availableWidth;
|
|
var gaps = gapArray(columnNode._gap);
|
|
|
|
if (gaps) {
|
|
availableWidth -= (gaps.length - 1) * columnNode._gap;
|
|
}
|
|
|
|
ColumnCalculator.buildColumnWidths(columns, availableWidth);
|
|
var result = this.processRow(columns, columns, gaps);
|
|
addAll(columnNode.positions, result.positions);
|
|
|
|
|
|
function gapArray(gap) {
|
|
if (!gap) {
|
|
return null;
|
|
}
|
|
|
|
var gaps = [];
|
|
gaps.push(0);
|
|
|
|
for (var i = columns.length - 1; i > 0; i--) {
|
|
gaps.push(gap);
|
|
}
|
|
|
|
return gaps;
|
|
}
|
|
};
|
|
|
|
LayoutBuilder.prototype.processRow = function (columns, widths, gaps, tableBody, tableRow) {
|
|
var self = this;
|
|
var pageBreaks = [], positions = [];
|
|
|
|
this.tracker.auto('pageChanged', storePageBreakData, function () {
|
|
widths = widths || columns;
|
|
|
|
self.writer.context().beginColumnGroup();
|
|
|
|
for (var i = 0, l = columns.length; i < l; i++) {
|
|
var column = columns[i];
|
|
var width = widths[i]._calcWidth;
|
|
var leftOffset = colLeftOffset(i);
|
|
|
|
if (column.colSpan && column.colSpan > 1) {
|
|
for (var j = 1; j < column.colSpan; j++) {
|
|
width += widths[++i]._calcWidth + gaps[i];
|
|
}
|
|
}
|
|
|
|
self.writer.context().beginColumn(width, leftOffset, getEndingCell(column, i));
|
|
if (!column._span) {
|
|
self.processNode(column);
|
|
addAll(positions, column.positions);
|
|
} else if (column._columnEndingContext) {
|
|
// row-span ending
|
|
self.writer.context().markEnding(column);
|
|
}
|
|
}
|
|
|
|
self.writer.context().completeColumnGroup();
|
|
});
|
|
|
|
return {pageBreaks: pageBreaks, positions: positions};
|
|
|
|
function storePageBreakData(data) {
|
|
var pageDesc;
|
|
|
|
for (var i = 0, l = pageBreaks.length; i < l; i++) {
|
|
var desc = pageBreaks[i];
|
|
if (desc.prevPage === data.prevPage) {
|
|
pageDesc = desc;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!pageDesc) {
|
|
pageDesc = data;
|
|
pageBreaks.push(pageDesc);
|
|
}
|
|
pageDesc.prevY = Math.max(pageDesc.prevY, data.prevY);
|
|
pageDesc.y = Math.min(pageDesc.y, data.y);
|
|
}
|
|
|
|
function colLeftOffset(i) {
|
|
if (gaps && gaps.length > i) {
|
|
return gaps[i];
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
function getEndingCell(column, columnIndex) {
|
|
if (column.rowSpan && column.rowSpan > 1) {
|
|
var endingRow = tableRow + column.rowSpan - 1;
|
|
if (endingRow >= tableBody.length) {
|
|
throw 'Row span for column ' + columnIndex + ' (with indexes starting from 0) exceeded row count';
|
|
}
|
|
return tableBody[endingRow][columnIndex];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
};
|
|
|
|
// lists
|
|
LayoutBuilder.prototype.processList = function (orderedList, node) {
|
|
var self = this,
|
|
items = orderedList ? node.ol : node.ul,
|
|
gapSize = node._gapSize;
|
|
|
|
this.writer.context().addMargin(gapSize.width);
|
|
|
|
var nextMarker;
|
|
this.tracker.auto('lineAdded', addMarkerToFirstLeaf, function () {
|
|
items.forEach(function (item) {
|
|
nextMarker = item.listMarker;
|
|
self.processNode(item);
|
|
addAll(node.positions, item.positions);
|
|
});
|
|
});
|
|
|
|
this.writer.context().addMargin(-gapSize.width);
|
|
|
|
function addMarkerToFirstLeaf(line) {
|
|
// I'm not very happy with the way list processing is implemented
|
|
// (both code and algorithm should be rethinked)
|
|
if (nextMarker) {
|
|
var marker = nextMarker;
|
|
nextMarker = null;
|
|
|
|
if (marker.canvas) {
|
|
var vector = marker.canvas[0];
|
|
|
|
offsetVector(vector, -marker._minWidth, 0);
|
|
self.writer.addVector(vector);
|
|
} else {
|
|
var markerLine = new Line(self.pageSize.width);
|
|
markerLine.addInline(marker._inlines[0]);
|
|
markerLine.x = -marker._minWidth;
|
|
markerLine.y = line.getAscenderHeight() - markerLine.getAscenderHeight();
|
|
self.writer.addLine(markerLine, true);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
// tables
|
|
LayoutBuilder.prototype.processTable = function (tableNode) {
|
|
var processor = new TableProcessor(tableNode);
|
|
|
|
processor.beginTable(this.writer);
|
|
|
|
for (var i = 0, l = tableNode.table.body.length; i < l; i++) {
|
|
processor.beginRow(i, this.writer);
|
|
|
|
var result = this.processRow(tableNode.table.body[i], tableNode.table.widths, tableNode._offsets.offsets, tableNode.table.body, i);
|
|
addAll(tableNode.positions, result.positions);
|
|
|
|
processor.endRow(i, this.writer, result.pageBreaks);
|
|
}
|
|
|
|
processor.endTable(this.writer);
|
|
};
|
|
|
|
// leafs (texts)
|
|
LayoutBuilder.prototype.processLeaf = function (node) {
|
|
var line = this.buildNextLine(node);
|
|
var currentHeight = (line) ? line.getHeight() : 0;
|
|
var maxHeight = node.maxHeight || -1;
|
|
|
|
while (line && (maxHeight === -1 || currentHeight < maxHeight)) {
|
|
var positions = this.writer.addLine(line);
|
|
node.positions.push(positions);
|
|
line = this.buildNextLine(node);
|
|
if (line) {
|
|
currentHeight += line.getHeight();
|
|
}
|
|
}
|
|
};
|
|
|
|
LayoutBuilder.prototype.buildNextLine = function (textNode) {
|
|
if (!textNode._inlines || textNode._inlines.length === 0) {
|
|
return null;
|
|
}
|
|
|
|
var line = new Line(this.writer.context().availableWidth);
|
|
|
|
while (textNode._inlines && textNode._inlines.length > 0 && line.hasEnoughSpaceForInline(textNode._inlines[0])) {
|
|
line.addInline(textNode._inlines.shift());
|
|
}
|
|
|
|
line.lastLineInParagraph = textNode._inlines.length === 0;
|
|
|
|
return line;
|
|
};
|
|
|
|
// images
|
|
LayoutBuilder.prototype.processImage = function (node) {
|
|
var position = this.writer.addImage(node);
|
|
node.positions.push(position);
|
|
};
|
|
|
|
LayoutBuilder.prototype.processCanvas = function (node) {
|
|
var height = node._minHeight;
|
|
|
|
if (this.writer.context().availableHeight < height) {
|
|
// TODO: support for canvas larger than a page
|
|
// TODO: support for other overflow methods
|
|
|
|
this.writer.moveToNextPage();
|
|
}
|
|
|
|
node.canvas.forEach(function (vector) {
|
|
var position = this.writer.addVector(vector);
|
|
node.positions.push(position);
|
|
}, this);
|
|
|
|
this.writer.context().moveDown(height);
|
|
};
|
|
|
|
LayoutBuilder.prototype.processQr = function (node) {
|
|
var position = this.writer.addQr(node);
|
|
node.positions.push(position);
|
|
};
|
|
|
|
module.exports = LayoutBuilder;
|
|
|
|
|
|
/***/ },
|
|
/* 11 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
/**
|
|
* Creates an instance of TraversalTracker
|
|
*
|
|
* @constructor
|
|
*/
|
|
function TraversalTracker() {
|
|
this.events = {};
|
|
}
|
|
|
|
TraversalTracker.prototype.startTracking = function (event, cb) {
|
|
var callbacks = (this.events[event] || (this.events[event] = []));
|
|
|
|
if (callbacks.indexOf(cb) < 0) {
|
|
callbacks.push(cb);
|
|
}
|
|
};
|
|
|
|
TraversalTracker.prototype.stopTracking = function (event, cb) {
|
|
var callbacks = this.events[event];
|
|
|
|
if (callbacks) {
|
|
var index = callbacks.indexOf(cb);
|
|
if (index >= 0) {
|
|
callbacks.splice(index, 1);
|
|
}
|
|
}
|
|
};
|
|
|
|
TraversalTracker.prototype.emit = function (event) {
|
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
|
|
var callbacks = this.events[event];
|
|
|
|
if (callbacks) {
|
|
callbacks.forEach(function (cb) {
|
|
cb.apply(this, args);
|
|
});
|
|
}
|
|
};
|
|
|
|
TraversalTracker.prototype.auto = function (event, cb, innerBlock) {
|
|
this.startTracking(event, cb);
|
|
innerBlock();
|
|
this.stopTracking(event, cb);
|
|
};
|
|
|
|
module.exports = TraversalTracker;
|
|
|
|
|
|
/***/ },
|
|
/* 12 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
var TextTools = __webpack_require__(13);
|
|
var StyleContextStack = __webpack_require__(20);
|
|
var ColumnCalculator = __webpack_require__(21);
|
|
var fontStringify = __webpack_require__(22).fontStringify;
|
|
var pack = __webpack_require__(22).pack;
|
|
var qrEncoder = __webpack_require__(23);
|
|
|
|
/**
|
|
* @private
|
|
*/
|
|
function DocMeasure(fontProvider, styleDictionary, defaultStyle, imageMeasure, tableLayouts, images) {
|
|
this.textTools = new TextTools(fontProvider);
|
|
this.styleStack = new StyleContextStack(styleDictionary, defaultStyle);
|
|
this.imageMeasure = imageMeasure;
|
|
this.tableLayouts = tableLayouts;
|
|
this.images = images;
|
|
this.autoImageIndex = 1;
|
|
}
|
|
|
|
/**
|
|
* Measures all nodes and sets min/max-width properties required for the second
|
|
* layout-pass.
|
|
* @param {Object} docStructure document-definition-object
|
|
* @return {Object} document-measurement-object
|
|
*/
|
|
DocMeasure.prototype.measureDocument = function (docStructure) {
|
|
return this.measureNode(docStructure);
|
|
};
|
|
|
|
DocMeasure.prototype.measureNode = function (node) {
|
|
// expand shortcuts
|
|
if (Array.isArray(node)) {
|
|
node = {stack: node};
|
|
} else if (typeof node === 'string' || node instanceof String) {
|
|
node = {text: node};
|
|
} else if (typeof node === 'number' || typeof node === 'boolean') {
|
|
node = {text: node.toString()};
|
|
} else if (node === null) {
|
|
node = {text: ''};
|
|
}
|
|
|
|
// Deal with empty nodes to prevent crash in getNodeMargin
|
|
if (Object.keys(node).length === 0) {
|
|
// A warning could be logged: console.warn('pdfmake: Empty node, ignoring it');
|
|
node = {text: ''};
|
|
}
|
|
|
|
var self = this;
|
|
|
|
return this.styleStack.auto(node, function () {
|
|
// TODO: refactor + rethink whether this is the proper way to handle margins
|
|
node._margin = getNodeMargin(node);
|
|
|
|
if (node.columns) {
|
|
return extendMargins(self.measureColumns(node));
|
|
} else if (node.stack) {
|
|
return extendMargins(self.measureVerticalContainer(node));
|
|
} else if (node.ul) {
|
|
return extendMargins(self.measureList(false, node));
|
|
} else if (node.ol) {
|
|
return extendMargins(self.measureList(true, node));
|
|
} else if (node.table) {
|
|
return extendMargins(self.measureTable(node));
|
|
} else if (node.text !== undefined) {
|
|
return extendMargins(self.measureLeaf(node));
|
|
} else if (node.image) {
|
|
return extendMargins(self.measureImage(node));
|
|
} else if (node.canvas) {
|
|
return extendMargins(self.measureCanvas(node));
|
|
} else if (node.qr) {
|
|
return extendMargins(self.measureQr(node));
|
|
} else {
|
|
throw 'Unrecognized document structure: ' + JSON.stringify(node, fontStringify);
|
|
}
|
|
});
|
|
|
|
function extendMargins(node) {
|
|
var margin = node._margin;
|
|
|
|
if (margin) {
|
|
node._minWidth += margin[0] + margin[2];
|
|
node._maxWidth += margin[0] + margin[2];
|
|
}
|
|
|
|
return node;
|
|
}
|
|
|
|
function getNodeMargin() {
|
|
|
|
function processSingleMargins(node, currentMargin) {
|
|
if (node.marginLeft || node.marginTop || node.marginRight || node.marginBottom) {
|
|
return [
|
|
node.marginLeft || currentMargin[0] || 0,
|
|
node.marginTop || currentMargin[1] || 0,
|
|
node.marginRight || currentMargin[2] || 0,
|
|
node.marginBottom || currentMargin[3] || 0
|
|
];
|
|
}
|
|
return currentMargin;
|
|
}
|
|
|
|
function flattenStyleArray(styleArray) {
|
|
var flattenedStyles = {};
|
|
for (var i = styleArray.length - 1; i >= 0; i--) {
|
|
var styleName = styleArray[i];
|
|
var style = self.styleStack.styleDictionary[styleName];
|
|
for (var key in style) {
|
|
if (style.hasOwnProperty(key)) {
|
|
flattenedStyles[key] = style[key];
|
|
}
|
|
}
|
|
}
|
|
return flattenedStyles;
|
|
}
|
|
|
|
function convertMargin(margin) {
|
|
if (typeof margin === 'number' || margin instanceof Number) {
|
|
margin = [margin, margin, margin, margin];
|
|
} else if (Array.isArray(margin)) {
|
|
if (margin.length === 2) {
|
|
margin = [margin[0], margin[1], margin[0], margin[1]];
|
|
}
|
|
}
|
|
return margin;
|
|
}
|
|
|
|
var margin = [undefined, undefined, undefined, undefined];
|
|
|
|
if (node.style) {
|
|
var styleArray = (Array.isArray(node.style)) ? node.style : [node.style];
|
|
var flattenedStyleArray = flattenStyleArray(styleArray);
|
|
|
|
if (flattenedStyleArray) {
|
|
margin = processSingleMargins(flattenedStyleArray, margin);
|
|
}
|
|
|
|
if (flattenedStyleArray.margin) {
|
|
margin = convertMargin(flattenedStyleArray.margin);
|
|
}
|
|
}
|
|
|
|
margin = processSingleMargins(node, margin);
|
|
|
|
if (node.margin) {
|
|
margin = convertMargin(node.margin);
|
|
}
|
|
|
|
if (margin[0] === undefined && margin[1] === undefined && margin[2] === undefined && margin[3] === undefined) {
|
|
return null;
|
|
} else {
|
|
return margin;
|
|
}
|
|
}
|
|
};
|
|
|
|
DocMeasure.prototype.convertIfBase64Image = function (node) {
|
|
if (/^data:image\/(jpeg|jpg|png);base64,/.test(node.image)) {
|
|
var label = '$$pdfmake$$' + this.autoImageIndex++;
|
|
this.images[label] = node.image;
|
|
node.image = label;
|
|
}
|
|
};
|
|
|
|
DocMeasure.prototype.measureImage = function (node) {
|
|
if (this.images) {
|
|
this.convertIfBase64Image(node);
|
|
}
|
|
|
|
var imageSize = this.imageMeasure.measureImage(node.image);
|
|
|
|
if (node.fit) {
|
|
var factor = (imageSize.width / imageSize.height > node.fit[0] / node.fit[1]) ? node.fit[0] / imageSize.width : node.fit[1] / imageSize.height;
|
|
node._width = node._minWidth = node._maxWidth = imageSize.width * factor;
|
|
node._height = imageSize.height * factor;
|
|
} else {
|
|
node._width = node._minWidth = node._maxWidth = node.width || imageSize.width;
|
|
node._height = node.height || (imageSize.height * node._width / imageSize.width);
|
|
}
|
|
|
|
node._alignment = this.styleStack.getProperty('alignment');
|
|
return node;
|
|
};
|
|
|
|
DocMeasure.prototype.measureLeaf = function (node) {
|
|
|
|
// Make sure style properties of the node itself are considered when building inlines.
|
|
// We could also just pass [node] to buildInlines, but that fails for bullet points.
|
|
var styleStack = this.styleStack.clone();
|
|
styleStack.push(node);
|
|
|
|
var data = this.textTools.buildInlines(node.text, styleStack);
|
|
|
|
node._inlines = data.items;
|
|
node._minWidth = data.minWidth;
|
|
node._maxWidth = data.maxWidth;
|
|
|
|
return node;
|
|
};
|
|
|
|
DocMeasure.prototype.measureVerticalContainer = function (node) {
|
|
var items = node.stack;
|
|
|
|
node._minWidth = 0;
|
|
node._maxWidth = 0;
|
|
|
|
for (var i = 0, l = items.length; i < l; i++) {
|
|
items[i] = this.measureNode(items[i]);
|
|
|
|
node._minWidth = Math.max(node._minWidth, items[i]._minWidth);
|
|
node._maxWidth = Math.max(node._maxWidth, items[i]._maxWidth);
|
|
}
|
|
|
|
return node;
|
|
};
|
|
|
|
DocMeasure.prototype.gapSizeForList = function (isOrderedList, listItems) {
|
|
if (isOrderedList) {
|
|
var longestNo = (listItems.length).toString().replace(/./g, '9');
|
|
return this.textTools.sizeOfString(longestNo + '. ', this.styleStack);
|
|
} else {
|
|
return this.textTools.sizeOfString('9. ', this.styleStack);
|
|
}
|
|
};
|
|
|
|
DocMeasure.prototype.buildMarker = function (isOrderedList, counter, styleStack, gapSize) {
|
|
var marker;
|
|
|
|
if (isOrderedList) {
|
|
marker = {_inlines: this.textTools.buildInlines(counter, styleStack).items};
|
|
} else {
|
|
// TODO: ascender-based calculations
|
|
var radius = gapSize.fontSize / 6;
|
|
marker = {
|
|
canvas: [{
|
|
x: radius,
|
|
y: (gapSize.height / gapSize.lineHeight) + gapSize.descender - gapSize.fontSize / 3,
|
|
r1: radius,
|
|
r2: radius,
|
|
type: 'ellipse',
|
|
color: 'black'
|
|
}]
|
|
};
|
|
}
|
|
|
|
marker._minWidth = marker._maxWidth = gapSize.width;
|
|
marker._minHeight = marker._maxHeight = gapSize.height;
|
|
|
|
return marker;
|
|
};
|
|
|
|
DocMeasure.prototype.measureList = function (isOrdered, node) {
|
|
var style = this.styleStack.clone();
|
|
|
|
var items = isOrdered ? node.ol : node.ul;
|
|
node._gapSize = this.gapSizeForList(isOrdered, items);
|
|
node._minWidth = 0;
|
|
node._maxWidth = 0;
|
|
|
|
var counter = 1;
|
|
|
|
for (var i = 0, l = items.length; i < l; i++) {
|
|
var nextItem = items[i] = this.measureNode(items[i]);
|
|
|
|
var marker = counter++ + '. ';
|
|
|
|
if (!nextItem.ol && !nextItem.ul) {
|
|
nextItem.listMarker = this.buildMarker(isOrdered, nextItem.counter || marker, style, node._gapSize);
|
|
} // TODO: else - nested lists numbering
|
|
|
|
node._minWidth = Math.max(node._minWidth, items[i]._minWidth + node._gapSize.width);
|
|
node._maxWidth = Math.max(node._maxWidth, items[i]._maxWidth + node._gapSize.width);
|
|
}
|
|
|
|
return node;
|
|
};
|
|
|
|
DocMeasure.prototype.measureColumns = function (node) {
|
|
var columns = node.columns;
|
|
node._gap = this.styleStack.getProperty('columnGap') || 0;
|
|
|
|
for (var i = 0, l = columns.length; i < l; i++) {
|
|
columns[i] = this.measureNode(columns[i]);
|
|
}
|
|
|
|
var measures = ColumnCalculator.measureMinMax(columns);
|
|
|
|
node._minWidth = measures.min + node._gap * (columns.length - 1);
|
|
node._maxWidth = measures.max + node._gap * (columns.length - 1);
|
|
|
|
return node;
|
|
};
|
|
|
|
DocMeasure.prototype.measureTable = function (node) {
|
|
extendTableWidths(node);
|
|
node._layout = getLayout(this.tableLayouts);
|
|
node._offsets = getOffsets(node._layout);
|
|
|
|
var colSpans = [];
|
|
var col, row, cols, rows;
|
|
|
|
for (col = 0, cols = node.table.body[0].length; col < cols; col++) {
|
|
var c = node.table.widths[col];
|
|
c._minWidth = 0;
|
|
c._maxWidth = 0;
|
|
|
|
for (row = 0, rows = node.table.body.length; row < rows; row++) {
|
|
var rowData = node.table.body[row];
|
|
var data = rowData[col];
|
|
if (data === undefined) {
|
|
console.error('Malformed table row ', rowData, 'in node ', node);
|
|
throw 'Malformed table row, a cell is undefined.';
|
|
}
|
|
if (data === null) { // transform to object
|
|
data = '';
|
|
}
|
|
if (!data._span) {
|
|
var _this = this;
|
|
data = rowData[col] = this.styleStack.auto(data, measureCb(this, data));
|
|
|
|
if (data.colSpan && data.colSpan > 1) {
|
|
markSpans(rowData, col, data.colSpan);
|
|
colSpans.push({col: col, span: data.colSpan, minWidth: data._minWidth, maxWidth: data._maxWidth});
|
|
} else {
|
|
c._minWidth = Math.max(c._minWidth, data._minWidth);
|
|
c._maxWidth = Math.max(c._maxWidth, data._maxWidth);
|
|
}
|
|
}
|
|
|
|
if (data.rowSpan && data.rowSpan > 1) {
|
|
markVSpans(node.table, row, col, data.rowSpan);
|
|
}
|
|
}
|
|
}
|
|
|
|
extendWidthsForColSpans();
|
|
|
|
var measures = ColumnCalculator.measureMinMax(node.table.widths);
|
|
|
|
node._minWidth = measures.min + node._offsets.total;
|
|
node._maxWidth = measures.max + node._offsets.total;
|
|
|
|
return node;
|
|
|
|
function measureCb(_this, data) {
|
|
return function () {
|
|
if (data !== null && typeof data === 'object') {
|
|
data.fillColor = _this.styleStack.getProperty('fillColor');
|
|
}
|
|
return _this.measureNode(data);
|
|
};
|
|
}
|
|
|
|
function getLayout(tableLayouts) {
|
|
var layout = node.layout;
|
|
|
|
if (typeof node.layout === 'string' || node instanceof String) {
|
|
layout = tableLayouts[layout];
|
|
}
|
|
|
|
var defaultLayout = {
|
|
hLineWidth: function (i, node) {
|
|
return 1;
|
|
}, //return node.table.headerRows && i === node.table.headerRows && 3 || 0; },
|
|
vLineWidth: function (i, node) {
|
|
return 1;
|
|
},
|
|
hLineColor: function (i, node) {
|
|
return 'black';
|
|
},
|
|
vLineColor: function (i, node) {
|
|
return 'black';
|
|
},
|
|
paddingLeft: function (i, node) {
|
|
return 4;
|
|
}, //i && 4 || 0; },
|
|
paddingRight: function (i, node) {
|
|
return 4;
|
|
}, //(i < node.table.widths.length - 1) ? 4 : 0; },
|
|
paddingTop: function (i, node) {
|
|
return 2;
|
|
},
|
|
paddingBottom: function (i, node) {
|
|
return 2;
|
|
},
|
|
defaultBorder: true
|
|
};
|
|
|
|
return pack(defaultLayout, layout);
|
|
}
|
|
|
|
function getOffsets(layout) {
|
|
var offsets = [];
|
|
var totalOffset = 0;
|
|
var prevRightPadding = 0;
|
|
|
|
for (var i = 0, l = node.table.widths.length; i < l; i++) {
|
|
var lOffset = prevRightPadding + layout.vLineWidth(i, node) + layout.paddingLeft(i, node);
|
|
offsets.push(lOffset);
|
|
totalOffset += lOffset;
|
|
prevRightPadding = layout.paddingRight(i, node);
|
|
}
|
|
|
|
totalOffset += prevRightPadding + layout.vLineWidth(node.table.widths.length, node);
|
|
|
|
return {
|
|
total: totalOffset,
|
|
offsets: offsets
|
|
};
|
|
}
|
|
|
|
function extendWidthsForColSpans() {
|
|
var q, j;
|
|
|
|
for (var i = 0, l = colSpans.length; i < l; i++) {
|
|
var span = colSpans[i];
|
|
|
|
var currentMinMax = getMinMax(span.col, span.span, node._offsets);
|
|
var minDifference = span.minWidth - currentMinMax.minWidth;
|
|
var maxDifference = span.maxWidth - currentMinMax.maxWidth;
|
|
|
|
if (minDifference > 0) {
|
|
q = minDifference / span.span;
|
|
|
|
for (j = 0; j < span.span; j++) {
|
|
node.table.widths[span.col + j]._minWidth += q;
|
|
}
|
|
}
|
|
|
|
if (maxDifference > 0) {
|
|
q = maxDifference / span.span;
|
|
|
|
for (j = 0; j < span.span; j++) {
|
|
node.table.widths[span.col + j]._maxWidth += q;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function getMinMax(col, span, offsets) {
|
|
var result = {minWidth: 0, maxWidth: 0};
|
|
|
|
for (var i = 0; i < span; i++) {
|
|
result.minWidth += node.table.widths[col + i]._minWidth + (i ? offsets.offsets[col + i] : 0);
|
|
result.maxWidth += node.table.widths[col + i]._maxWidth + (i ? offsets.offsets[col + i] : 0);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
function markSpans(rowData, col, span) {
|
|
for (var i = 1; i < span; i++) {
|
|
rowData[col + i] = {
|
|
_span: true,
|
|
_minWidth: 0,
|
|
_maxWidth: 0,
|
|
rowSpan: rowData[col].rowSpan
|
|
};
|
|
}
|
|
}
|
|
|
|
function markVSpans(table, row, col, span) {
|
|
for (var i = 1; i < span; i++) {
|
|
table.body[row + i][col] = {
|
|
_span: true,
|
|
_minWidth: 0,
|
|
_maxWidth: 0,
|
|
fillColor: table.body[row][col].fillColor
|
|
};
|
|
}
|
|
}
|
|
|
|
function extendTableWidths(node) {
|
|
if (!node.table.widths) {
|
|
node.table.widths = 'auto';
|
|
}
|
|
|
|
if (typeof node.table.widths === 'string' || node.table.widths instanceof String) {
|
|
node.table.widths = [node.table.widths];
|
|
|
|
while (node.table.widths.length < node.table.body[0].length) {
|
|
node.table.widths.push(node.table.widths[node.table.widths.length - 1]);
|
|
}
|
|
}
|
|
|
|
for (var i = 0, l = node.table.widths.length; i < l; i++) {
|
|
var w = node.table.widths[i];
|
|
if (typeof w === 'number' || w instanceof Number || typeof w === 'string' || w instanceof String) {
|
|
node.table.widths[i] = {width: w};
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
DocMeasure.prototype.measureCanvas = function (node) {
|
|
var w = 0, h = 0;
|
|
|
|
for (var i = 0, l = node.canvas.length; i < l; i++) {
|
|
var vector = node.canvas[i];
|
|
|
|
switch (vector.type) {
|
|
case 'ellipse':
|
|
w = Math.max(w, vector.x + vector.r1);
|
|
h = Math.max(h, vector.y + vector.r2);
|
|
break;
|
|
case 'rect':
|
|
w = Math.max(w, vector.x + vector.w);
|
|
h = Math.max(h, vector.y + vector.h);
|
|
break;
|
|
case 'line':
|
|
w = Math.max(w, vector.x1, vector.x2);
|
|
h = Math.max(h, vector.y1, vector.y2);
|
|
break;
|
|
case 'polyline':
|
|
for (var i2 = 0, l2 = vector.points.length; i2 < l2; i2++) {
|
|
w = Math.max(w, vector.points[i2].x);
|
|
h = Math.max(h, vector.points[i2].y);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
node._minWidth = node._maxWidth = w;
|
|
node._minHeight = node._maxHeight = h;
|
|
|
|
return node;
|
|
};
|
|
|
|
DocMeasure.prototype.measureQr = function (node) {
|
|
node = qrEncoder.measure(node);
|
|
node._alignment = this.styleStack.getProperty('alignment');
|
|
return node;
|
|
};
|
|
|
|
module.exports = DocMeasure;
|
|
|
|
|
|
/***/ },
|
|
/* 13 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
var LineBreaker = __webpack_require__(14);
|
|
|
|
var LEADING = /^(\s)+/g;
|
|
var TRAILING = /(\s)+$/g;
|
|
|
|
/**
|
|
* Creates an instance of TextTools - text measurement utility
|
|
*
|
|
* @constructor
|
|
* @param {FontProvider} fontProvider
|
|
*/
|
|
function TextTools(fontProvider) {
|
|
this.fontProvider = fontProvider;
|
|
}
|
|
|
|
/**
|
|
* Converts an array of strings (or inline-definition-objects) into a collection
|
|
* of inlines and calculated minWidth/maxWidth.
|
|
* and their min/max widths
|
|
* @param {Object} textArray - an array of inline-definition-objects (or strings)
|
|
* @param {Object} styleContextStack current style stack
|
|
* @return {Object} collection of inlines, minWidth, maxWidth
|
|
*/
|
|
TextTools.prototype.buildInlines = function (textArray, styleContextStack) {
|
|
var measured = measure(this.fontProvider, textArray, styleContextStack);
|
|
|
|
var minWidth = 0,
|
|
maxWidth = 0,
|
|
currentLineWidth;
|
|
|
|
measured.forEach(function (inline) {
|
|
minWidth = Math.max(minWidth, inline.width - inline.leadingCut - inline.trailingCut);
|
|
|
|
if (!currentLineWidth) {
|
|
currentLineWidth = {width: 0, leadingCut: inline.leadingCut, trailingCut: 0};
|
|
}
|
|
|
|
currentLineWidth.width += inline.width;
|
|
currentLineWidth.trailingCut = inline.trailingCut;
|
|
|
|
maxWidth = Math.max(maxWidth, getTrimmedWidth(currentLineWidth));
|
|
|
|
if (inline.lineEnd) {
|
|
currentLineWidth = null;
|
|
}
|
|
});
|
|
|
|
if (getStyleProperty({}, styleContextStack, 'noWrap', false)) {
|
|
minWidth = maxWidth;
|
|
}
|
|
|
|
return {
|
|
items: measured,
|
|
minWidth: minWidth,
|
|
maxWidth: maxWidth
|
|
};
|
|
|
|
function getTrimmedWidth(item) {
|
|
return Math.max(0, item.width - item.leadingCut - item.trailingCut);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Returns size of the specified string (without breaking it) using the current style
|
|
* @param {String} text text to be measured
|
|
* @param {Object} styleContextStack current style stack
|
|
* @return {Object} size of the specified string
|
|
*/
|
|
TextTools.prototype.sizeOfString = function (text, styleContextStack) {
|
|
text = text ? text.toString().replace('\t', ' ') : '';
|
|
|
|
//TODO: refactor - extract from measure
|
|
var fontName = getStyleProperty({}, styleContextStack, 'font', 'Roboto');
|
|
var fontSize = getStyleProperty({}, styleContextStack, 'fontSize', 12);
|
|
var bold = getStyleProperty({}, styleContextStack, 'bold', false);
|
|
var italics = getStyleProperty({}, styleContextStack, 'italics', false);
|
|
var lineHeight = getStyleProperty({}, styleContextStack, 'lineHeight', 1);
|
|
|
|
var font = this.fontProvider.provideFont(fontName, bold, italics);
|
|
|
|
return {
|
|
width: font.widthOfString(removeDiacritics(text), fontSize),
|
|
height: font.lineHeight(fontSize) * lineHeight,
|
|
fontSize: fontSize,
|
|
lineHeight: lineHeight,
|
|
ascender: font.ascender / 1000 * fontSize,
|
|
descender: font.descender / 1000 * fontSize
|
|
};
|
|
};
|
|
|
|
function splitWords(text, noWrap) {
|
|
var results = [];
|
|
text = text.replace('\t', ' ');
|
|
|
|
if (noWrap) {
|
|
results.push({text: text});
|
|
return results;
|
|
}
|
|
|
|
var breaker = new LineBreaker(text);
|
|
var last = 0;
|
|
var bk;
|
|
|
|
while (bk = breaker.nextBreak()) {
|
|
var word = text.slice(last, bk.position);
|
|
|
|
if (bk.required || word.match(/\r?\n$|\r$/)) { // new line
|
|
word = word.replace(/\r?\n$|\r$/, '');
|
|
results.push({text: word, lineEnd: true});
|
|
} else {
|
|
results.push({text: word});
|
|
}
|
|
|
|
last = bk.position;
|
|
}
|
|
|
|
return results;
|
|
}
|
|
|
|
function copyStyle(source, destination) {
|
|
destination = destination || {};
|
|
source = source || {}; //TODO: default style
|
|
|
|
for (var key in source) {
|
|
if (key != 'text' && source.hasOwnProperty(key)) {
|
|
destination[key] = source[key];
|
|
}
|
|
}
|
|
|
|
return destination;
|
|
}
|
|
|
|
function normalizeTextArray(array) {
|
|
var results = [];
|
|
|
|
if (!Array.isArray(array)) {
|
|
array = [array];
|
|
}
|
|
|
|
for (var i = 0, l = array.length; i < l; i++) {
|
|
var item = array[i];
|
|
var style = null;
|
|
var words;
|
|
|
|
if (item !== null && (typeof item === 'object' || item instanceof Object)) {
|
|
words = splitWords(normalizeString(item.text), item.noWrap);
|
|
style = copyStyle(item);
|
|
} else {
|
|
words = splitWords(normalizeString(item));
|
|
}
|
|
|
|
for (var i2 = 0, l2 = words.length; i2 < l2; i2++) {
|
|
var result = {
|
|
text: words[i2].text
|
|
};
|
|
|
|
if (words[i2].lineEnd) {
|
|
result.lineEnd = true;
|
|
}
|
|
|
|
copyStyle(style, result);
|
|
|
|
results.push(result);
|
|
}
|
|
}
|
|
|
|
return results;
|
|
}
|
|
|
|
function normalizeString(value) {
|
|
if (value === undefined || value === null) {
|
|
return '';
|
|
} else if (typeof value === 'number') {
|
|
return value.toString();
|
|
} else if (typeof value === 'string' || value instanceof String) {
|
|
return value;
|
|
} else {
|
|
return value.toString();
|
|
}
|
|
}
|
|
|
|
//TODO: support for other languages (currently only polish is supported)
|
|
var diacriticsMap = {'Ą': 'A', 'Ć': 'C', 'Ę': 'E', 'Ł': 'L', 'Ń': 'N', 'Ó': 'O', 'Ś': 'S', 'Ź': 'Z', 'Ż': 'Z', 'ą': 'a', 'ć': 'c', 'ę': 'e', 'ł': 'l', 'ń': 'n', 'ó': 'o', 'ś': 's', 'ź': 'z', 'ż': 'z'};
|
|
// ' << atom.io workaround
|
|
|
|
function removeDiacritics(text) {
|
|
return text.replace(/[^A-Za-z0-9\[\] ]/g, function (a) {
|
|
return diacriticsMap[a] || a;
|
|
});
|
|
}
|
|
|
|
function getStyleProperty(item, styleContextStack, property, defaultValue) {
|
|
var value;
|
|
|
|
if (item[property] !== undefined && item[property] !== null) {
|
|
// item defines this property
|
|
return item[property];
|
|
}
|
|
|
|
if (!styleContextStack) {
|
|
return defaultValue;
|
|
}
|
|
|
|
styleContextStack.auto(item, function () {
|
|
value = styleContextStack.getProperty(property);
|
|
});
|
|
|
|
if (value !== null && value !== undefined) {
|
|
return value;
|
|
} else {
|
|
return defaultValue;
|
|
}
|
|
}
|
|
|
|
function measure(fontProvider, textArray, styleContextStack) {
|
|
var normalized = normalizeTextArray(textArray);
|
|
|
|
normalized.forEach(function (item) {
|
|
var fontName = getStyleProperty(item, styleContextStack, 'font', 'Roboto');
|
|
var fontSize = getStyleProperty(item, styleContextStack, 'fontSize', 12);
|
|
var bold = getStyleProperty(item, styleContextStack, 'bold', false);
|
|
var italics = getStyleProperty(item, styleContextStack, 'italics', false);
|
|
var color = getStyleProperty(item, styleContextStack, 'color', 'black');
|
|
var decoration = getStyleProperty(item, styleContextStack, 'decoration', null);
|
|
var decorationColor = getStyleProperty(item, styleContextStack, 'decorationColor', null);
|
|
var decorationStyle = getStyleProperty(item, styleContextStack, 'decorationStyle', null);
|
|
var background = getStyleProperty(item, styleContextStack, 'background', null);
|
|
var lineHeight = getStyleProperty(item, styleContextStack, 'lineHeight', 1);
|
|
var link = getStyleProperty(item, styleContextStack, 'link', null);
|
|
|
|
var font = fontProvider.provideFont(fontName, bold, italics);
|
|
|
|
// TODO: character spacing
|
|
item.width = font.widthOfString(removeDiacritics(item.text), fontSize);
|
|
item.height = font.lineHeight(fontSize) * lineHeight;
|
|
|
|
var leadingSpaces = item.text.match(LEADING);
|
|
var trailingSpaces = item.text.match(TRAILING);
|
|
if (leadingSpaces) {
|
|
item.leadingCut = font.widthOfString(leadingSpaces[0], fontSize);
|
|
} else {
|
|
item.leadingCut = 0;
|
|
}
|
|
|
|
if (trailingSpaces) {
|
|
item.trailingCut = font.widthOfString(trailingSpaces[0], fontSize);
|
|
} else {
|
|
item.trailingCut = 0;
|
|
}
|
|
|
|
item.alignment = getStyleProperty(item, styleContextStack, 'alignment', 'left');
|
|
item.font = font;
|
|
item.fontSize = fontSize;
|
|
item.color = color;
|
|
item.decoration = decoration;
|
|
item.decorationColor = decorationColor;
|
|
item.decorationStyle = decorationStyle;
|
|
item.background = background;
|
|
item.link = link;
|
|
});
|
|
|
|
return normalized;
|
|
}
|
|
|
|
/****TESTS**** (add a leading '/' to uncomment)
|
|
TextTools.prototype.splitWords = splitWords;
|
|
TextTools.prototype.normalizeTextArray = normalizeTextArray;
|
|
TextTools.prototype.measure = measure;
|
|
// */
|
|
|
|
|
|
module.exports = TextTools;
|
|
|
|
|
|
/***/ },
|
|
/* 14 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var AI, AL, BA, BK, CB, CI_BRK, CJ, CP_BRK, CR, DI_BRK, ID, IN_BRK, LF, LineBreaker, NL, NS, PR_BRK, SA, SG, SP, UnicodeTrie, WJ, XX, base64, characterClasses, classTrie, data, fs, pairTable, _ref, _ref1;
|
|
|
|
UnicodeTrie = __webpack_require__(15);
|
|
|
|
|
|
|
|
base64 = __webpack_require__(17);
|
|
|
|
_ref = __webpack_require__(18), BK = _ref.BK, CR = _ref.CR, LF = _ref.LF, NL = _ref.NL, CB = _ref.CB, BA = _ref.BA, SP = _ref.SP, WJ = _ref.WJ, SP = _ref.SP, BK = _ref.BK, LF = _ref.LF, NL = _ref.NL, AI = _ref.AI, AL = _ref.AL, SA = _ref.SA, SG = _ref.SG, XX = _ref.XX, CJ = _ref.CJ, ID = _ref.ID, NS = _ref.NS, characterClasses = _ref.characterClasses;
|
|
|
|
_ref1 = __webpack_require__(19), DI_BRK = _ref1.DI_BRK, IN_BRK = _ref1.IN_BRK, CI_BRK = _ref1.CI_BRK, CP_BRK = _ref1.CP_BRK, PR_BRK = _ref1.PR_BRK, pairTable = _ref1.pairTable;
|
|
|
|
data = base64.toByteArray("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");
|
|
|
|
classTrie = new UnicodeTrie(data);
|
|
|
|
LineBreaker = (function() {
|
|
var Break, mapClass, mapFirst;
|
|
|
|
function LineBreaker(string) {
|
|
this.string = string;
|
|
this.pos = 0;
|
|
this.lastPos = 0;
|
|
this.curClass = null;
|
|
this.nextClass = null;
|
|
}
|
|
|
|
LineBreaker.prototype.nextCodePoint = function() {
|
|
var code, next;
|
|
code = this.string.charCodeAt(this.pos++);
|
|
next = this.string.charCodeAt(this.pos);
|
|
if ((0xd800 <= code && code <= 0xdbff) && (0xdc00 <= next && next <= 0xdfff)) {
|
|
this.pos++;
|
|
return ((code - 0xd800) * 0x400) + (next - 0xdc00) + 0x10000;
|
|
}
|
|
return code;
|
|
};
|
|
|
|
mapClass = function(c) {
|
|
switch (c) {
|
|
case AI:
|
|
return AL;
|
|
case SA:
|
|
case SG:
|
|
case XX:
|
|
return AL;
|
|
case CJ:
|
|
return NS;
|
|
default:
|
|
return c;
|
|
}
|
|
};
|
|
|
|
mapFirst = function(c) {
|
|
switch (c) {
|
|
case LF:
|
|
case NL:
|
|
return BK;
|
|
case CB:
|
|
return BA;
|
|
case SP:
|
|
return WJ;
|
|
default:
|
|
return c;
|
|
}
|
|
};
|
|
|
|
LineBreaker.prototype.nextCharClass = function(first) {
|
|
if (first == null) {
|
|
first = false;
|
|
}
|
|
return mapClass(classTrie.get(this.nextCodePoint()));
|
|
};
|
|
|
|
Break = (function() {
|
|
function Break(position, required) {
|
|
this.position = position;
|
|
this.required = required != null ? required : false;
|
|
}
|
|
|
|
return Break;
|
|
|
|
})();
|
|
|
|
LineBreaker.prototype.nextBreak = function() {
|
|
var cur, lastClass, shouldBreak;
|
|
if (this.curClass == null) {
|
|
this.curClass = mapFirst(this.nextCharClass());
|
|
}
|
|
while (this.pos < this.string.length) {
|
|
this.lastPos = this.pos;
|
|
lastClass = this.nextClass;
|
|
this.nextClass = this.nextCharClass();
|
|
if (this.curClass === BK || (this.curClass === CR && this.nextClass !== LF)) {
|
|
this.curClass = mapFirst(mapClass(this.nextClass));
|
|
return new Break(this.lastPos, true);
|
|
}
|
|
cur = (function() {
|
|
switch (this.nextClass) {
|
|
case SP:
|
|
return this.curClass;
|
|
case BK:
|
|
case LF:
|
|
case NL:
|
|
return BK;
|
|
case CR:
|
|
return CR;
|
|
case CB:
|
|
return BA;
|
|
}
|
|
}).call(this);
|
|
if (cur != null) {
|
|
this.curClass = cur;
|
|
if (this.nextClass === CB) {
|
|
return new Break(this.lastPos);
|
|
}
|
|
continue;
|
|
}
|
|
shouldBreak = false;
|
|
switch (pairTable[this.curClass][this.nextClass]) {
|
|
case DI_BRK:
|
|
shouldBreak = true;
|
|
break;
|
|
case IN_BRK:
|
|
shouldBreak = lastClass === SP;
|
|
break;
|
|
case CI_BRK:
|
|
shouldBreak = lastClass === SP;
|
|
if (!shouldBreak) {
|
|
continue;
|
|
}
|
|
break;
|
|
case CP_BRK:
|
|
if (lastClass !== SP) {
|
|
continue;
|
|
}
|
|
}
|
|
this.curClass = this.nextClass;
|
|
if (shouldBreak) {
|
|
return new Break(this.lastPos);
|
|
}
|
|
}
|
|
if (this.pos >= this.string.length) {
|
|
if (this.lastPos < this.string.length) {
|
|
this.lastPos = this.string.length;
|
|
return new Break(this.string.length);
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
};
|
|
|
|
return LineBreaker;
|
|
|
|
})();
|
|
|
|
module.exports = LineBreaker;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 15 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
var UnicodeTrie, inflate;
|
|
|
|
inflate = __webpack_require__(16);
|
|
|
|
UnicodeTrie = (function() {
|
|
var DATA_BLOCK_LENGTH, DATA_GRANULARITY, DATA_MASK, INDEX_1_OFFSET, INDEX_2_BLOCK_LENGTH, INDEX_2_BMP_LENGTH, INDEX_2_MASK, INDEX_SHIFT, LSCP_INDEX_2_LENGTH, LSCP_INDEX_2_OFFSET, OMITTED_BMP_INDEX_1_LENGTH, SHIFT_1, SHIFT_1_2, SHIFT_2, UTF8_2B_INDEX_2_LENGTH, UTF8_2B_INDEX_2_OFFSET;
|
|
|
|
SHIFT_1 = 6 + 5;
|
|
|
|
SHIFT_2 = 5;
|
|
|
|
SHIFT_1_2 = SHIFT_1 - SHIFT_2;
|
|
|
|
OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> SHIFT_1;
|
|
|
|
INDEX_2_BLOCK_LENGTH = 1 << SHIFT_1_2;
|
|
|
|
INDEX_2_MASK = INDEX_2_BLOCK_LENGTH - 1;
|
|
|
|
INDEX_SHIFT = 2;
|
|
|
|
DATA_BLOCK_LENGTH = 1 << SHIFT_2;
|
|
|
|
DATA_MASK = DATA_BLOCK_LENGTH - 1;
|
|
|
|
LSCP_INDEX_2_OFFSET = 0x10000 >> SHIFT_2;
|
|
|
|
LSCP_INDEX_2_LENGTH = 0x400 >> SHIFT_2;
|
|
|
|
INDEX_2_BMP_LENGTH = LSCP_INDEX_2_OFFSET + LSCP_INDEX_2_LENGTH;
|
|
|
|
UTF8_2B_INDEX_2_OFFSET = INDEX_2_BMP_LENGTH;
|
|
|
|
UTF8_2B_INDEX_2_LENGTH = 0x800 >> 6;
|
|
|
|
INDEX_1_OFFSET = UTF8_2B_INDEX_2_OFFSET + UTF8_2B_INDEX_2_LENGTH;
|
|
|
|
DATA_GRANULARITY = 1 << INDEX_SHIFT;
|
|
|
|
function UnicodeTrie(data) {
|
|
var isBuffer, uncompressedLength, view;
|
|
isBuffer = typeof data.readUInt32BE === 'function' && typeof data.slice === 'function';
|
|
if (isBuffer || data instanceof Uint8Array) {
|
|
if (isBuffer) {
|
|
this.highStart = data.readUInt32BE(0);
|
|
this.errorValue = data.readUInt32BE(4);
|
|
uncompressedLength = data.readUInt32BE(8);
|
|
data = data.slice(12);
|
|
} else {
|
|
view = new DataView(data.buffer);
|
|
this.highStart = view.getUint32(0);
|
|
this.errorValue = view.getUint32(4);
|
|
uncompressedLength = view.getUint32(8);
|
|
data = data.subarray(12);
|
|
}
|
|
data = inflate(data, new Uint8Array(uncompressedLength));
|
|
data = inflate(data, new Uint8Array(uncompressedLength));
|
|
this.data = new Uint32Array(data.buffer);
|
|
} else {
|
|
this.data = data.data, this.highStart = data.highStart, this.errorValue = data.errorValue;
|
|
}
|
|
}
|
|
|
|
UnicodeTrie.prototype.get = function(codePoint) {
|
|
var index;
|
|
if (codePoint < 0 || codePoint > 0x10ffff) {
|
|
return this.errorValue;
|
|
}
|
|
if (codePoint < 0xd800 || (codePoint > 0xdbff && codePoint <= 0xffff)) {
|
|
index = (this.data[codePoint >> SHIFT_2] << INDEX_SHIFT) + (codePoint & DATA_MASK);
|
|
return this.data[index];
|
|
}
|
|
if (codePoint <= 0xffff) {
|
|
index = (this.data[LSCP_INDEX_2_OFFSET + ((codePoint - 0xd800) >> SHIFT_2)] << INDEX_SHIFT) + (codePoint & DATA_MASK);
|
|
return this.data[index];
|
|
}
|
|
if (codePoint < this.highStart) {
|
|
index = this.data[(INDEX_1_OFFSET - OMITTED_BMP_INDEX_1_LENGTH) + (codePoint >> SHIFT_1)];
|
|
index = this.data[index + ((codePoint >> SHIFT_2) & INDEX_2_MASK)];
|
|
index = (index << INDEX_SHIFT) + (codePoint & DATA_MASK);
|
|
return this.data[index];
|
|
}
|
|
return this.data[this.data.length - DATA_GRANULARITY];
|
|
};
|
|
|
|
return UnicodeTrie;
|
|
|
|
})();
|
|
|
|
module.exports = UnicodeTrie;
|
|
|
|
|
|
/***/ },
|
|
/* 16 */
|
|
/***/ function(module, exports) {
|
|
|
|
var TINF_OK = 0;
|
|
var TINF_DATA_ERROR = -3;
|
|
|
|
function Tree() {
|
|
this.table = new Uint16Array(16); /* table of code length counts */
|
|
this.trans = new Uint16Array(288); /* code -> symbol translation table */
|
|
}
|
|
|
|
function Data(source, dest) {
|
|
this.source = source;
|
|
this.sourceIndex = 0;
|
|
this.tag = 0;
|
|
this.bitcount = 0;
|
|
|
|
this.dest = dest;
|
|
this.destLen = 0;
|
|
|
|
this.ltree = new Tree(); /* dynamic length/symbol tree */
|
|
this.dtree = new Tree(); /* dynamic distance tree */
|
|
}
|
|
|
|
/* --------------------------------------------------- *
|
|
* -- uninitialized global data (static structures) -- *
|
|
* --------------------------------------------------- */
|
|
|
|
var sltree = new Tree();
|
|
var sdtree = new Tree();
|
|
|
|
/* extra bits and base tables for length codes */
|
|
var length_bits = new Uint8Array(30);
|
|
var length_base = new Uint16Array(30);
|
|
|
|
/* extra bits and base tables for distance codes */
|
|
var dist_bits = new Uint8Array(30);
|
|
var dist_base = new Uint16Array(30);
|
|
|
|
/* special ordering of code length codes */
|
|
var clcidx = new Uint8Array([
|
|
16, 17, 18, 0, 8, 7, 9, 6,
|
|
10, 5, 11, 4, 12, 3, 13, 2,
|
|
14, 1, 15
|
|
]);
|
|
|
|
/* used by tinf_decode_trees, avoids allocations every call */
|
|
var code_tree = new Tree();
|
|
var lengths = new Uint8Array(288 + 32);
|
|
|
|
/* ----------------------- *
|
|
* -- utility functions -- *
|
|
* ----------------------- */
|
|
|
|
/* build extra bits and base tables */
|
|
function tinf_build_bits_base(bits, base, delta, first) {
|
|
var i, sum;
|
|
|
|
/* build bits table */
|
|
for (i = 0; i < delta; ++i) bits[i] = 0;
|
|
for (i = 0; i < 30 - delta; ++i) bits[i + delta] = i / delta | 0;
|
|
|
|
/* build base table */
|
|
for (sum = first, i = 0; i < 30; ++i) {
|
|
base[i] = sum;
|
|
sum += 1 << bits[i];
|
|
}
|
|
}
|
|
|
|
/* build the fixed huffman trees */
|
|
function tinf_build_fixed_trees(lt, dt) {
|
|
var i;
|
|
|
|
/* build fixed length tree */
|
|
for (i = 0; i < 7; ++i) lt.table[i] = 0;
|
|
|
|
lt.table[7] = 24;
|
|
lt.table[8] = 152;
|
|
lt.table[9] = 112;
|
|
|
|
for (i = 0; i < 24; ++i) lt.trans[i] = 256 + i;
|
|
for (i = 0; i < 144; ++i) lt.trans[24 + i] = i;
|
|
for (i = 0; i < 8; ++i) lt.trans[24 + 144 + i] = 280 + i;
|
|
for (i = 0; i < 112; ++i) lt.trans[24 + 144 + 8 + i] = 144 + i;
|
|
|
|
/* build fixed distance tree */
|
|
for (i = 0; i < 5; ++i) dt.table[i] = 0;
|
|
|
|
dt.table[5] = 32;
|
|
|
|
for (i = 0; i < 32; ++i) dt.trans[i] = i;
|
|
}
|
|
|
|
/* given an array of code lengths, build a tree */
|
|
var offs = new Uint16Array(16);
|
|
|
|
function tinf_build_tree(t, lengths, off, num) {
|
|
var i, sum;
|
|
|
|
/* clear code length count table */
|
|
for (i = 0; i < 16; ++i) t.table[i] = 0;
|
|
|
|
/* scan symbol lengths, and sum code length counts */
|
|
for (i = 0; i < num; ++i) t.table[lengths[off + i]]++;
|
|
|
|
t.table[0] = 0;
|
|
|
|
/* compute offset table for distribution sort */
|
|
for (sum = 0, i = 0; i < 16; ++i) {
|
|
offs[i] = sum;
|
|
sum += t.table[i];
|
|
}
|
|
|
|
/* create code->symbol translation table (symbols sorted by code) */
|
|
for (i = 0; i < num; ++i) {
|
|
if (lengths[off + i]) t.trans[offs[lengths[off + i]]++] = i;
|
|
}
|
|
}
|
|
|
|
/* ---------------------- *
|
|
* -- decode functions -- *
|
|
* ---------------------- */
|
|
|
|
/* get one bit from source stream */
|
|
function tinf_getbit(d) {
|
|
/* check if tag is empty */
|
|
if (!d.bitcount--) {
|
|
/* load next tag */
|
|
d.tag = d.source[d.sourceIndex++];
|
|
d.bitcount = 7;
|
|
}
|
|
|
|
/* shift bit out of tag */
|
|
var bit = d.tag & 1;
|
|
d.tag >>>= 1;
|
|
|
|
return bit;
|
|
}
|
|
|
|
/* read a num bit value from a stream and add base */
|
|
function tinf_read_bits(d, num, base) {
|
|
if (!num)
|
|
return base;
|
|
|
|
while (d.bitcount < 24) {
|
|
d.tag |= d.source[d.sourceIndex++] << d.bitcount;
|
|
d.bitcount += 8;
|
|
}
|
|
|
|
var val = d.tag & (0xffff >>> (16 - num));
|
|
d.tag >>>= num;
|
|
d.bitcount -= num;
|
|
return val + base;
|
|
}
|
|
|
|
/* given a data stream and a tree, decode a symbol */
|
|
function tinf_decode_symbol(d, t) {
|
|
while (d.bitcount < 24) {
|
|
d.tag |= d.source[d.sourceIndex++] << d.bitcount;
|
|
d.bitcount += 8;
|
|
}
|
|
|
|
var sum = 0, cur = 0, len = 0;
|
|
var tag = d.tag;
|
|
|
|
/* get more bits while code value is above sum */
|
|
do {
|
|
cur = 2 * cur + (tag & 1);
|
|
tag >>>= 1;
|
|
++len;
|
|
|
|
sum += t.table[len];
|
|
cur -= t.table[len];
|
|
} while (cur >= 0);
|
|
|
|
d.tag = tag;
|
|
d.bitcount -= len;
|
|
|
|
return t.trans[sum + cur];
|
|
}
|
|
|
|
/* given a data stream, decode dynamic trees from it */
|
|
function tinf_decode_trees(d, lt, dt) {
|
|
var hlit, hdist, hclen;
|
|
var i, num, length;
|
|
|
|
/* get 5 bits HLIT (257-286) */
|
|
hlit = tinf_read_bits(d, 5, 257);
|
|
|
|
/* get 5 bits HDIST (1-32) */
|
|
hdist = tinf_read_bits(d, 5, 1);
|
|
|
|
/* get 4 bits HCLEN (4-19) */
|
|
hclen = tinf_read_bits(d, 4, 4);
|
|
|
|
for (i = 0; i < 19; ++i) lengths[i] = 0;
|
|
|
|
/* read code lengths for code length alphabet */
|
|
for (i = 0; i < hclen; ++i) {
|
|
/* get 3 bits code length (0-7) */
|
|
var clen = tinf_read_bits(d, 3, 0);
|
|
lengths[clcidx[i]] = clen;
|
|
}
|
|
|
|
/* build code length tree */
|
|
tinf_build_tree(code_tree, lengths, 0, 19);
|
|
|
|
/* decode code lengths for the dynamic trees */
|
|
for (num = 0; num < hlit + hdist;) {
|
|
var sym = tinf_decode_symbol(d, code_tree);
|
|
|
|
switch (sym) {
|
|
case 16:
|
|
/* copy previous code length 3-6 times (read 2 bits) */
|
|
var prev = lengths[num - 1];
|
|
for (length = tinf_read_bits(d, 2, 3); length; --length) {
|
|
lengths[num++] = prev;
|
|
}
|
|
break;
|
|
case 17:
|
|
/* repeat code length 0 for 3-10 times (read 3 bits) */
|
|
for (length = tinf_read_bits(d, 3, 3); length; --length) {
|
|
lengths[num++] = 0;
|
|
}
|
|
break;
|
|
case 18:
|
|
/* repeat code length 0 for 11-138 times (read 7 bits) */
|
|
for (length = tinf_read_bits(d, 7, 11); length; --length) {
|
|
lengths[num++] = 0;
|
|
}
|
|
break;
|
|
default:
|
|
/* values 0-15 represent the actual code lengths */
|
|
lengths[num++] = sym;
|
|
break;
|
|
}
|
|
}
|
|
|
|
/* build dynamic trees */
|
|
tinf_build_tree(lt, lengths, 0, hlit);
|
|
tinf_build_tree(dt, lengths, hlit, hdist);
|
|
}
|
|
|
|
/* ----------------------------- *
|
|
* -- block inflate functions -- *
|
|
* ----------------------------- */
|
|
|
|
/* given a stream and two trees, inflate a block of data */
|
|
function tinf_inflate_block_data(d, lt, dt) {
|
|
while (1) {
|
|
var sym = tinf_decode_symbol(d, lt);
|
|
|
|
/* check for end of block */
|
|
if (sym === 256) {
|
|
return TINF_OK;
|
|
}
|
|
|
|
if (sym < 256) {
|
|
d.dest[d.destLen++] = sym;
|
|
} else {
|
|
var length, dist, offs;
|
|
var i;
|
|
|
|
sym -= 257;
|
|
|
|
/* possibly get more bits from length code */
|
|
length = tinf_read_bits(d, length_bits[sym], length_base[sym]);
|
|
|
|
dist = tinf_decode_symbol(d, dt);
|
|
|
|
/* possibly get more bits from distance code */
|
|
offs = d.destLen - tinf_read_bits(d, dist_bits[dist], dist_base[dist]);
|
|
|
|
/* copy match */
|
|
for (i = offs; i < offs + length; ++i) {
|
|
d.dest[d.destLen++] = d.dest[i];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* inflate an uncompressed block of data */
|
|
function tinf_inflate_uncompressed_block(d) {
|
|
var length, invlength;
|
|
var i;
|
|
|
|
/* unread from bitbuffer */
|
|
while (d.bitcount > 8) {
|
|
d.sourceIndex--;
|
|
d.bitcount -= 8;
|
|
}
|
|
|
|
/* get length */
|
|
length = d.source[d.sourceIndex + 1];
|
|
length = 256 * length + d.source[d.sourceIndex];
|
|
|
|
/* get one's complement of length */
|
|
invlength = d.source[d.sourceIndex + 3];
|
|
invlength = 256 * invlength + d.source[d.sourceIndex + 2];
|
|
|
|
/* check length */
|
|
if (length !== (~invlength & 0x0000ffff))
|
|
return TINF_DATA_ERROR;
|
|
|
|
d.sourceIndex += 4;
|
|
|
|
/* copy block */
|
|
for (i = length; i; --i)
|
|
d.dest[d.destLen++] = d.source[d.sourceIndex++];
|
|
|
|
/* make sure we start next block on a byte boundary */
|
|
d.bitcount = 0;
|
|
|
|
return TINF_OK;
|
|
}
|
|
|
|
/* inflate stream from source to dest */
|
|
function tinf_uncompress(source, dest) {
|
|
var d = new Data(source, dest);
|
|
var bfinal, btype, res;
|
|
|
|
do {
|
|
/* read final block flag */
|
|
bfinal = tinf_getbit(d);
|
|
|
|
/* read block type (2 bits) */
|
|
btype = tinf_read_bits(d, 2, 0);
|
|
|
|
/* decompress block */
|
|
switch (btype) {
|
|
case 0:
|
|
/* decompress uncompressed block */
|
|
res = tinf_inflate_uncompressed_block(d);
|
|
break;
|
|
case 1:
|
|
/* decompress block with fixed huffman trees */
|
|
res = tinf_inflate_block_data(d, sltree, sdtree);
|
|
break;
|
|
case 2:
|
|
/* decompress block with dynamic huffman trees */
|
|
tinf_decode_trees(d, d.ltree, d.dtree);
|
|
res = tinf_inflate_block_data(d, d.ltree, d.dtree);
|
|
break;
|
|
default:
|
|
res = TINF_DATA_ERROR;
|
|
}
|
|
|
|
if (res !== TINF_OK)
|
|
throw new Error('Data error');
|
|
|
|
} while (!bfinal);
|
|
|
|
if (d.destLen < d.dest.length) {
|
|
if (typeof d.dest.slice === 'function')
|
|
return d.dest.slice(0, d.destLen);
|
|
else
|
|
return d.dest.subarray(0, d.destLen);
|
|
}
|
|
|
|
return d.dest;
|
|
}
|
|
|
|
/* -------------------- *
|
|
* -- initialization -- *
|
|
* -------------------- */
|
|
|
|
/* build fixed huffman trees */
|
|
tinf_build_fixed_trees(sltree, sdtree);
|
|
|
|
/* build extra bits and base tables */
|
|
tinf_build_bits_base(length_bits, length_base, 4, 3);
|
|
tinf_build_bits_base(dist_bits, dist_base, 2, 1);
|
|
|
|
/* fix a special case */
|
|
length_bits[28] = 0;
|
|
length_base[28] = 258;
|
|
|
|
module.exports = tinf_uncompress;
|
|
|
|
|
|
/***/ },
|
|
/* 17 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
|
|
;(function (exports) {
|
|
'use strict';
|
|
|
|
var Arr = (typeof Uint8Array !== 'undefined')
|
|
? Uint8Array
|
|
: Array
|
|
|
|
var PLUS = '+'.charCodeAt(0)
|
|
var SLASH = '/'.charCodeAt(0)
|
|
var NUMBER = '0'.charCodeAt(0)
|
|
var LOWER = 'a'.charCodeAt(0)
|
|
var UPPER = 'A'.charCodeAt(0)
|
|
var PLUS_URL_SAFE = '-'.charCodeAt(0)
|
|
var SLASH_URL_SAFE = '_'.charCodeAt(0)
|
|
|
|
function decode (elt) {
|
|
var code = elt.charCodeAt(0)
|
|
if (code === PLUS ||
|
|
code === PLUS_URL_SAFE)
|
|
return 62 // '+'
|
|
if (code === SLASH ||
|
|
code === SLASH_URL_SAFE)
|
|
return 63 // '/'
|
|
if (code < NUMBER)
|
|
return -1 //no match
|
|
if (code < NUMBER + 10)
|
|
return code - NUMBER + 26 + 26
|
|
if (code < UPPER + 26)
|
|
return code - UPPER
|
|
if (code < LOWER + 26)
|
|
return code - LOWER + 26
|
|
}
|
|
|
|
function b64ToByteArray (b64) {
|
|
var i, j, l, tmp, placeHolders, arr
|
|
|
|
if (b64.length % 4 > 0) {
|
|
throw new Error('Invalid string. Length must be a multiple of 4')
|
|
}
|
|
|
|
// the number of equal signs (place holders)
|
|
// if there are two placeholders, than the two characters before it
|
|
// represent one byte
|
|
// if there is only one, then the three characters before it represent 2 bytes
|
|
// this is just a cheap hack to not do indexOf twice
|
|
var len = b64.length
|
|
placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
|
|
|
|
// base64 is 4/3 + up to two characters of the original data
|
|
arr = new Arr(b64.length * 3 / 4 - placeHolders)
|
|
|
|
// if there are placeholders, only get up to the last complete 4 chars
|
|
l = placeHolders > 0 ? b64.length - 4 : b64.length
|
|
|
|
var L = 0
|
|
|
|
function push (v) {
|
|
arr[L++] = v
|
|
}
|
|
|
|
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
|
tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
|
|
push((tmp & 0xFF0000) >> 16)
|
|
push((tmp & 0xFF00) >> 8)
|
|
push(tmp & 0xFF)
|
|
}
|
|
|
|
if (placeHolders === 2) {
|
|
tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
|
|
push(tmp & 0xFF)
|
|
} else if (placeHolders === 1) {
|
|
tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
|
|
push((tmp >> 8) & 0xFF)
|
|
push(tmp & 0xFF)
|
|
}
|
|
|
|
return arr
|
|
}
|
|
|
|
function uint8ToBase64 (uint8) {
|
|
var i,
|
|
extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
|
|
output = "",
|
|
temp, length
|
|
|
|
function encode (num) {
|
|
return lookup.charAt(num)
|
|
}
|
|
|
|
function tripletToBase64 (num) {
|
|
return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
|
|
}
|
|
|
|
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
|
|
temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
|
|
output += tripletToBase64(temp)
|
|
}
|
|
|
|
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
switch (extraBytes) {
|
|
case 1:
|
|
temp = uint8[uint8.length - 1]
|
|
output += encode(temp >> 2)
|
|
output += encode((temp << 4) & 0x3F)
|
|
output += '=='
|
|
break
|
|
case 2:
|
|
temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
|
|
output += encode(temp >> 10)
|
|
output += encode((temp >> 4) & 0x3F)
|
|
output += encode((temp << 2) & 0x3F)
|
|
output += '='
|
|
break
|
|
}
|
|
|
|
return output
|
|
}
|
|
|
|
exports.toByteArray = b64ToByteArray
|
|
exports.fromByteArray = uint8ToBase64
|
|
}( false ? (this.base64js = {}) : exports))
|
|
|
|
|
|
/***/ },
|
|
/* 18 */
|
|
/***/ function(module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var AI, AL, B2, BA, BB, BK, CB, CJ, CL, CM, CP, CR, EX, GL, H2, H3, HL, HY, ID, IN, IS, JL, JT, JV, LF, NL, NS, NU, OP, PO, PR, QU, RI, SA, SG, SP, SY, WJ, XX, ZW;
|
|
|
|
exports.OP = OP = 0;
|
|
|
|
exports.CL = CL = 1;
|
|
|
|
exports.CP = CP = 2;
|
|
|
|
exports.QU = QU = 3;
|
|
|
|
exports.GL = GL = 4;
|
|
|
|
exports.NS = NS = 5;
|
|
|
|
exports.EX = EX = 6;
|
|
|
|
exports.SY = SY = 7;
|
|
|
|
exports.IS = IS = 8;
|
|
|
|
exports.PR = PR = 9;
|
|
|
|
exports.PO = PO = 10;
|
|
|
|
exports.NU = NU = 11;
|
|
|
|
exports.AL = AL = 12;
|
|
|
|
exports.HL = HL = 13;
|
|
|
|
exports.ID = ID = 14;
|
|
|
|
exports.IN = IN = 15;
|
|
|
|
exports.HY = HY = 16;
|
|
|
|
exports.BA = BA = 17;
|
|
|
|
exports.BB = BB = 18;
|
|
|
|
exports.B2 = B2 = 19;
|
|
|
|
exports.ZW = ZW = 20;
|
|
|
|
exports.CM = CM = 21;
|
|
|
|
exports.WJ = WJ = 22;
|
|
|
|
exports.H2 = H2 = 23;
|
|
|
|
exports.H3 = H3 = 24;
|
|
|
|
exports.JL = JL = 25;
|
|
|
|
exports.JV = JV = 26;
|
|
|
|
exports.JT = JT = 27;
|
|
|
|
exports.RI = RI = 28;
|
|
|
|
exports.AI = AI = 29;
|
|
|
|
exports.BK = BK = 30;
|
|
|
|
exports.CB = CB = 31;
|
|
|
|
exports.CJ = CJ = 32;
|
|
|
|
exports.CR = CR = 33;
|
|
|
|
exports.LF = LF = 34;
|
|
|
|
exports.NL = NL = 35;
|
|
|
|
exports.SA = SA = 36;
|
|
|
|
exports.SG = SG = 37;
|
|
|
|
exports.SP = SP = 38;
|
|
|
|
exports.XX = XX = 39;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 19 */
|
|
/***/ function(module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var CI_BRK, CP_BRK, DI_BRK, IN_BRK, PR_BRK;
|
|
|
|
exports.DI_BRK = DI_BRK = 0;
|
|
|
|
exports.IN_BRK = IN_BRK = 1;
|
|
|
|
exports.CI_BRK = CI_BRK = 2;
|
|
|
|
exports.CP_BRK = CP_BRK = 3;
|
|
|
|
exports.PR_BRK = PR_BRK = 4;
|
|
|
|
exports.pairTable = [[PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, CP_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK], [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK], [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, DI_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, DI_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, PR_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK]];
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 20 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
/**
|
|
* Creates an instance of StyleContextStack used for style inheritance and style overrides
|
|
*
|
|
* @constructor
|
|
* @this {StyleContextStack}
|
|
* @param {Object} named styles dictionary
|
|
* @param {Object} optional default style definition
|
|
*/
|
|
function StyleContextStack(styleDictionary, defaultStyle) {
|
|
this.defaultStyle = defaultStyle || {};
|
|
this.styleDictionary = styleDictionary;
|
|
this.styleOverrides = [];
|
|
}
|
|
|
|
/**
|
|
* Creates cloned version of current stack
|
|
* @return {StyleContextStack} current stack snapshot
|
|
*/
|
|
StyleContextStack.prototype.clone = function () {
|
|
var stack = new StyleContextStack(this.styleDictionary, this.defaultStyle);
|
|
|
|
this.styleOverrides.forEach(function (item) {
|
|
stack.styleOverrides.push(item);
|
|
});
|
|
|
|
return stack;
|
|
};
|
|
|
|
/**
|
|
* Pushes style-name or style-overrides-object onto the stack for future evaluation
|
|
*
|
|
* @param {String|Object} styleNameOrOverride style-name (referring to styleDictionary) or
|
|
* a new dictionary defining overriding properties
|
|
*/
|
|
StyleContextStack.prototype.push = function (styleNameOrOverride) {
|
|
this.styleOverrides.push(styleNameOrOverride);
|
|
};
|
|
|
|
/**
|
|
* Removes last style-name or style-overrides-object from the stack
|
|
*
|
|
* @param {Number} howMany - optional number of elements to be popped (if not specified,
|
|
* one element will be removed from the stack)
|
|
*/
|
|
StyleContextStack.prototype.pop = function (howMany) {
|
|
howMany = howMany || 1;
|
|
|
|
while (howMany-- > 0) {
|
|
this.styleOverrides.pop();
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Creates a set of named styles or/and a style-overrides-object based on the item,
|
|
* pushes those elements onto the stack for future evaluation and returns the number
|
|
* of elements pushed, so they can be easily poped then.
|
|
*
|
|
* @param {Object} item - an object with optional style property and/or style overrides
|
|
* @return the number of items pushed onto the stack
|
|
*/
|
|
StyleContextStack.prototype.autopush = function (item) {
|
|
if (typeof item === 'string' || item instanceof String) {
|
|
return 0;
|
|
}
|
|
|
|
var styleNames = [];
|
|
|
|
if (item.style) {
|
|
if (Array.isArray(item.style)) {
|
|
styleNames = item.style;
|
|
} else {
|
|
styleNames = [item.style];
|
|
}
|
|
}
|
|
|
|
for (var i = 0, l = styleNames.length; i < l; i++) {
|
|
this.push(styleNames[i]);
|
|
}
|
|
|
|
var styleOverrideObject = {};
|
|
var pushSOO = false;
|
|
|
|
[
|
|
'font',
|
|
'fontSize',
|
|
'bold',
|
|
'italics',
|
|
'alignment',
|
|
'color',
|
|
'columnGap',
|
|
'fillColor',
|
|
'decoration',
|
|
'decorationStyle',
|
|
'decorationColor',
|
|
'background',
|
|
'lineHeight',
|
|
'noWrap'
|
|
//'tableCellPadding'
|
|
// 'cellBorder',
|
|
// 'headerCellBorder',
|
|
// 'oddRowCellBorder',
|
|
// 'evenRowCellBorder',
|
|
// 'tableBorder'
|
|
].forEach(function (key) {
|
|
if (item[key] !== undefined && item[key] !== null) {
|
|
styleOverrideObject[key] = item[key];
|
|
pushSOO = true;
|
|
}
|
|
});
|
|
|
|
if (pushSOO) {
|
|
this.push(styleOverrideObject);
|
|
}
|
|
|
|
return styleNames.length + (pushSOO ? 1 : 0);
|
|
};
|
|
|
|
/**
|
|
* Automatically pushes elements onto the stack, using autopush based on item,
|
|
* executes callback and then pops elements back. Returns value returned by callback
|
|
*
|
|
* @param {Object} item - an object with optional style property and/or style overrides
|
|
* @param {Function} function to be called between autopush and pop
|
|
* @return {Object} value returned by callback
|
|
*/
|
|
StyleContextStack.prototype.auto = function (item, callback) {
|
|
var pushedItems = this.autopush(item);
|
|
var result = callback();
|
|
|
|
if (pushedItems > 0) {
|
|
this.pop(pushedItems);
|
|
}
|
|
|
|
return result;
|
|
};
|
|
|
|
/**
|
|
* Evaluates stack and returns value of a named property
|
|
*
|
|
* @param {String} property - property name
|
|
* @return property value or null if not found
|
|
*/
|
|
StyleContextStack.prototype.getProperty = function (property) {
|
|
if (this.styleOverrides) {
|
|
for (var i = this.styleOverrides.length - 1; i >= 0; i--) {
|
|
var item = this.styleOverrides[i];
|
|
|
|
if (typeof item == 'string' || item instanceof String) {
|
|
// named-style-override
|
|
|
|
var style = this.styleDictionary[item];
|
|
if (style && style[property] !== null && style[property] !== undefined) {
|
|
return style[property];
|
|
}
|
|
} else {
|
|
// style-overrides-object
|
|
if (item[property] !== undefined && item[property] !== null) {
|
|
return item[property];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return this.defaultStyle && this.defaultStyle[property];
|
|
};
|
|
|
|
module.exports = StyleContextStack;
|
|
|
|
|
|
/***/ },
|
|
/* 21 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
function buildColumnWidths(columns, availableWidth) {
|
|
var autoColumns = [],
|
|
autoMin = 0, autoMax = 0,
|
|
starColumns = [],
|
|
starMaxMin = 0,
|
|
starMaxMax = 0,
|
|
fixedColumns = [],
|
|
initial_availableWidth = availableWidth;
|
|
|
|
columns.forEach(function (column) {
|
|
if (isAutoColumn(column)) {
|
|
autoColumns.push(column);
|
|
autoMin += column._minWidth;
|
|
autoMax += column._maxWidth;
|
|
} else if (isStarColumn(column)) {
|
|
starColumns.push(column);
|
|
starMaxMin = Math.max(starMaxMin, column._minWidth);
|
|
starMaxMax = Math.max(starMaxMax, column._maxWidth);
|
|
} else {
|
|
fixedColumns.push(column);
|
|
}
|
|
});
|
|
|
|
fixedColumns.forEach(function (col) {
|
|
// width specified as %
|
|
if (typeof col.width === 'string' && /\d+%/.test(col.width)) {
|
|
col.width = parseFloat(col.width) * initial_availableWidth / 100;
|
|
}
|
|
if (col.width < (col._minWidth) && col.elasticWidth) {
|
|
col._calcWidth = col._minWidth;
|
|
} else {
|
|
col._calcWidth = col.width;
|
|
}
|
|
|
|
availableWidth -= col._calcWidth;
|
|
});
|
|
|
|
// http://www.freesoft.org/CIE/RFC/1942/18.htm
|
|
// http://www.w3.org/TR/CSS2/tables.html#width-layout
|
|
// http://dev.w3.org/csswg/css3-tables-algorithms/Overview.src.htm
|
|
var minW = autoMin + starMaxMin * starColumns.length;
|
|
var maxW = autoMax + starMaxMax * starColumns.length;
|
|
if (minW >= availableWidth) {
|
|
// case 1 - there's no way to fit all columns within available width
|
|
// that's actually pretty bad situation with PDF as we have no horizontal scroll
|
|
// no easy workaround (unless we decide, in the future, to split single words)
|
|
// currently we simply use minWidths for all columns
|
|
autoColumns.forEach(function (col) {
|
|
col._calcWidth = col._minWidth;
|
|
});
|
|
|
|
starColumns.forEach(function (col) {
|
|
col._calcWidth = starMaxMin; // starMaxMin already contains padding
|
|
});
|
|
} else {
|
|
if (maxW < availableWidth) {
|
|
// case 2 - we can fit rest of the table within available space
|
|
autoColumns.forEach(function (col) {
|
|
col._calcWidth = col._maxWidth;
|
|
availableWidth -= col._calcWidth;
|
|
});
|
|
} else {
|
|
// maxW is too large, but minW fits within available width
|
|
var W = availableWidth - minW;
|
|
var D = maxW - minW;
|
|
|
|
autoColumns.forEach(function (col) {
|
|
var d = col._maxWidth - col._minWidth;
|
|
col._calcWidth = col._minWidth + d * W / D;
|
|
availableWidth -= col._calcWidth;
|
|
});
|
|
}
|
|
|
|
if (starColumns.length > 0) {
|
|
var starSize = availableWidth / starColumns.length;
|
|
|
|
starColumns.forEach(function (col) {
|
|
col._calcWidth = starSize;
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
function isAutoColumn(column) {
|
|
return column.width === 'auto';
|
|
}
|
|
|
|
function isStarColumn(column) {
|
|
return column.width === null || column.width === undefined || column.width === '*' || column.width === 'star';
|
|
}
|
|
|
|
//TODO: refactor and reuse in measureTable
|
|
function measureMinMax(columns) {
|
|
var result = {min: 0, max: 0};
|
|
|
|
var maxStar = {min: 0, max: 0};
|
|
var starCount = 0;
|
|
|
|
for (var i = 0, l = columns.length; i < l; i++) {
|
|
var c = columns[i];
|
|
|
|
if (isStarColumn(c)) {
|
|
maxStar.min = Math.max(maxStar.min, c._minWidth);
|
|
maxStar.max = Math.max(maxStar.max, c._maxWidth);
|
|
starCount++;
|
|
} else if (isAutoColumn(c)) {
|
|
result.min += c._minWidth;
|
|
result.max += c._maxWidth;
|
|
} else {
|
|
result.min += ((c.width !== undefined && c.width) || c._minWidth);
|
|
result.max += ((c.width !== undefined && c.width) || c._maxWidth);
|
|
}
|
|
}
|
|
|
|
if (starCount) {
|
|
result.min += starCount * maxStar.min;
|
|
result.max += starCount * maxStar.max;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Calculates column widths
|
|
* @private
|
|
*/
|
|
module.exports = {
|
|
buildColumnWidths: buildColumnWidths,
|
|
measureMinMax: measureMinMax,
|
|
isAutoColumn: isAutoColumn,
|
|
isStarColumn: isStarColumn
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 22 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
function pack() {
|
|
var result = {};
|
|
|
|
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
var obj = arguments[i];
|
|
|
|
if (obj) {
|
|
for (var key in obj) {
|
|
if (obj.hasOwnProperty(key)) {
|
|
result[key] = obj[key];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
function offsetVector(vector, x, y) {
|
|
switch (vector.type) {
|
|
case 'ellipse':
|
|
case 'rect':
|
|
vector.x += x;
|
|
vector.y += y;
|
|
break;
|
|
case 'line':
|
|
vector.x1 += x;
|
|
vector.x2 += x;
|
|
vector.y1 += y;
|
|
vector.y2 += y;
|
|
break;
|
|
case 'polyline':
|
|
for (var i = 0, l = vector.points.length; i < l; i++) {
|
|
vector.points[i].x += x;
|
|
vector.points[i].y += y;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
function fontStringify(key, val) {
|
|
if (key === 'font') {
|
|
return 'font';
|
|
}
|
|
return val;
|
|
}
|
|
|
|
function isFunction(functionToCheck) {
|
|
var getType = {};
|
|
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
pack: pack,
|
|
fontStringify: fontStringify,
|
|
offsetVector: offsetVector,
|
|
isFunction: isFunction
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 23 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
/*jshint -W004 */
|
|
/* qr.js -- QR code generator in Javascript (revision 2011-01-19)
|
|
* Written by Kang Seonghoon <public+qrjs@mearie.org>.
|
|
*
|
|
* This source code is in the public domain; if your jurisdiction does not
|
|
* recognize the public domain the terms of Creative Commons CC0 license
|
|
* apply. In the other words, you can always do what you want.
|
|
*/
|
|
|
|
|
|
// per-version information (cf. JIS X 0510:2004 pp. 30--36, 71)
|
|
//
|
|
// [0]: the degree of generator polynomial by ECC levels
|
|
// [1]: # of code blocks by ECC levels
|
|
// [2]: left-top positions of alignment patterns
|
|
//
|
|
// the number in this table (in particular, [0]) does not exactly match with
|
|
// the numbers in the specficiation. see augumenteccs below for the reason.
|
|
var VERSIONS = [
|
|
null,
|
|
[[10, 7, 17, 13], [1, 1, 1, 1], []],
|
|
[[16, 10, 28, 22], [1, 1, 1, 1], [4, 16]],
|
|
[[26, 15, 22, 18], [1, 1, 2, 2], [4, 20]],
|
|
[[18, 20, 16, 26], [2, 1, 4, 2], [4, 24]],
|
|
[[24, 26, 22, 18], [2, 1, 4, 4], [4, 28]],
|
|
[[16, 18, 28, 24], [4, 2, 4, 4], [4, 32]],
|
|
[[18, 20, 26, 18], [4, 2, 5, 6], [4, 20, 36]],
|
|
[[22, 24, 26, 22], [4, 2, 6, 6], [4, 22, 40]],
|
|
[[22, 30, 24, 20], [5, 2, 8, 8], [4, 24, 44]],
|
|
[[26, 18, 28, 24], [5, 4, 8, 8], [4, 26, 48]],
|
|
[[30, 20, 24, 28], [5, 4, 11, 8], [4, 28, 52]],
|
|
[[22, 24, 28, 26], [8, 4, 11, 10], [4, 30, 56]],
|
|
[[22, 26, 22, 24], [9, 4, 16, 12], [4, 32, 60]],
|
|
[[24, 30, 24, 20], [9, 4, 16, 16], [4, 24, 44, 64]],
|
|
[[24, 22, 24, 30], [10, 6, 18, 12], [4, 24, 46, 68]],
|
|
[[28, 24, 30, 24], [10, 6, 16, 17], [4, 24, 48, 72]],
|
|
[[28, 28, 28, 28], [11, 6, 19, 16], [4, 28, 52, 76]],
|
|
[[26, 30, 28, 28], [13, 6, 21, 18], [4, 28, 54, 80]],
|
|
[[26, 28, 26, 26], [14, 7, 25, 21], [4, 28, 56, 84]],
|
|
[[26, 28, 28, 30], [16, 8, 25, 20], [4, 32, 60, 88]],
|
|
[[26, 28, 30, 28], [17, 8, 25, 23], [4, 26, 48, 70, 92]],
|
|
[[28, 28, 24, 30], [17, 9, 34, 23], [4, 24, 48, 72, 96]],
|
|
[[28, 30, 30, 30], [18, 9, 30, 25], [4, 28, 52, 76, 100]],
|
|
[[28, 30, 30, 30], [20, 10, 32, 27], [4, 26, 52, 78, 104]],
|
|
[[28, 26, 30, 30], [21, 12, 35, 29], [4, 30, 56, 82, 108]],
|
|
[[28, 28, 30, 28], [23, 12, 37, 34], [4, 28, 56, 84, 112]],
|
|
[[28, 30, 30, 30], [25, 12, 40, 34], [4, 32, 60, 88, 116]],
|
|
[[28, 30, 30, 30], [26, 13, 42, 35], [4, 24, 48, 72, 96, 120]],
|
|
[[28, 30, 30, 30], [28, 14, 45, 38], [4, 28, 52, 76, 100, 124]],
|
|
[[28, 30, 30, 30], [29, 15, 48, 40], [4, 24, 50, 76, 102, 128]],
|
|
[[28, 30, 30, 30], [31, 16, 51, 43], [4, 28, 54, 80, 106, 132]],
|
|
[[28, 30, 30, 30], [33, 17, 54, 45], [4, 32, 58, 84, 110, 136]],
|
|
[[28, 30, 30, 30], [35, 18, 57, 48], [4, 28, 56, 84, 112, 140]],
|
|
[[28, 30, 30, 30], [37, 19, 60, 51], [4, 32, 60, 88, 116, 144]],
|
|
[[28, 30, 30, 30], [38, 19, 63, 53], [4, 28, 52, 76, 100, 124, 148]],
|
|
[[28, 30, 30, 30], [40, 20, 66, 56], [4, 22, 48, 74, 100, 126, 152]],
|
|
[[28, 30, 30, 30], [43, 21, 70, 59], [4, 26, 52, 78, 104, 130, 156]],
|
|
[[28, 30, 30, 30], [45, 22, 74, 62], [4, 30, 56, 82, 108, 134, 160]],
|
|
[[28, 30, 30, 30], [47, 24, 77, 65], [4, 24, 52, 80, 108, 136, 164]],
|
|
[[28, 30, 30, 30], [49, 25, 81, 68], [4, 28, 56, 84, 112, 140, 168]]];
|
|
|
|
// mode constants (cf. Table 2 in JIS X 0510:2004 p. 16)
|
|
var MODE_TERMINATOR = 0;
|
|
var MODE_NUMERIC = 1, MODE_ALPHANUMERIC = 2, MODE_OCTET = 4, MODE_KANJI = 8;
|
|
|
|
// validation regexps
|
|
var NUMERIC_REGEXP = /^\d*$/;
|
|
var ALPHANUMERIC_REGEXP = /^[A-Za-z0-9 $%*+\-./:]*$/;
|
|
var ALPHANUMERIC_OUT_REGEXP = /^[A-Z0-9 $%*+\-./:]*$/;
|
|
|
|
// ECC levels (cf. Table 22 in JIS X 0510:2004 p. 45)
|
|
var ECCLEVEL_L = 1, ECCLEVEL_M = 0, ECCLEVEL_Q = 3, ECCLEVEL_H = 2;
|
|
|
|
// GF(2^8)-to-integer mapping with a reducing polynomial x^8+x^4+x^3+x^2+1
|
|
// invariant: GF256_MAP[GF256_INVMAP[i]] == i for all i in [1,256)
|
|
var GF256_MAP = [], GF256_INVMAP = [-1];
|
|
for (var i = 0, v = 1; i < 255; ++i) {
|
|
GF256_MAP.push(v);
|
|
GF256_INVMAP[v] = i;
|
|
v = (v * 2) ^ (v >= 128 ? 0x11d : 0);
|
|
}
|
|
|
|
// generator polynomials up to degree 30
|
|
// (should match with polynomials in JIS X 0510:2004 Appendix A)
|
|
//
|
|
// generator polynomial of degree K is product of (x-\alpha^0), (x-\alpha^1),
|
|
// ..., (x-\alpha^(K-1)). by convention, we omit the K-th coefficient (always 1)
|
|
// from the result; also other coefficients are written in terms of the exponent
|
|
// to \alpha to avoid the redundant calculation. (see also calculateecc below.)
|
|
var GF256_GENPOLY = [[]];
|
|
for (var i = 0; i < 30; ++i) {
|
|
var prevpoly = GF256_GENPOLY[i], poly = [];
|
|
for (var j = 0; j <= i; ++j) {
|
|
var a = (j < i ? GF256_MAP[prevpoly[j]] : 0);
|
|
var b = GF256_MAP[(i + (prevpoly[j - 1] || 0)) % 255];
|
|
poly.push(GF256_INVMAP[a ^ b]);
|
|
}
|
|
GF256_GENPOLY.push(poly);
|
|
}
|
|
|
|
// alphanumeric character mapping (cf. Table 5 in JIS X 0510:2004 p. 19)
|
|
var ALPHANUMERIC_MAP = {};
|
|
for (var i = 0; i < 45; ++i) {
|
|
ALPHANUMERIC_MAP['0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'.charAt(i)] = i;
|
|
}
|
|
|
|
// mask functions in terms of row # and column #
|
|
// (cf. Table 20 in JIS X 0510:2004 p. 42)
|
|
var MASKFUNCS = [
|
|
function (i, j) {
|
|
return (i + j) % 2 === 0;
|
|
},
|
|
function (i, j) {
|
|
return i % 2 === 0;
|
|
},
|
|
function (i, j) {
|
|
return j % 3 === 0;
|
|
},
|
|
function (i, j) {
|
|
return (i + j) % 3 === 0;
|
|
},
|
|
function (i, j) {
|
|
return (((i / 2) | 0) + ((j / 3) | 0)) % 2 === 0;
|
|
},
|
|
function (i, j) {
|
|
return (i * j) % 2 + (i * j) % 3 === 0;
|
|
},
|
|
function (i, j) {
|
|
return ((i * j) % 2 + (i * j) % 3) % 2 === 0;
|
|
},
|
|
function (i, j) {
|
|
return ((i + j) % 2 + (i * j) % 3) % 2 === 0;
|
|
}];
|
|
|
|
// returns true when the version information has to be embeded.
|
|
var needsverinfo = function (ver) {
|
|
return ver > 6;
|
|
};
|
|
|
|
// returns the size of entire QR code for given version.
|
|
var getsizebyver = function (ver) {
|
|
return 4 * ver + 17;
|
|
};
|
|
|
|
// returns the number of bits available for code words in this version.
|
|
var nfullbits = function (ver) {
|
|
/*
|
|
* |<--------------- n --------------->|
|
|
* | |<----- n-17 ---->| |
|
|
* +-------+ ///+-------+ ----
|
|
* | | ///| | ^
|
|
* | 9x9 | @@@@@ ///| 9x8 | |
|
|
* | | # # # @5x5@ # # # | | |
|
|
* +-------+ @@@@@ +-------+ |
|
|
* # ---|
|
|
* ^ |
|
|
* # |
|
|
* @@@@@ @@@@@ @@@@@ | n
|
|
* @5x5@ @5x5@ @5x5@ n-17
|
|
* @@@@@ @@@@@ @@@@@ | |
|
|
* # | |
|
|
* ////// v |
|
|
* //////# ---|
|
|
* +-------+ @@@@@ @@@@@ |
|
|
* | | @5x5@ @5x5@ |
|
|
* | 8x9 | @@@@@ @@@@@ |
|
|
* | | v
|
|
* +-------+ ----
|
|
*
|
|
* when the entire code has n^2 modules and there are m^2-3 alignment
|
|
* patterns, we have:
|
|
* - 225 (= 9x9 + 9x8 + 8x9) modules for finder patterns and
|
|
* format information;
|
|
* - 2n-34 (= 2(n-17)) modules for timing patterns;
|
|
* - 36 (= 3x6 + 6x3) modules for version information, if any;
|
|
* - 25m^2-75 (= (m^2-3)(5x5)) modules for alignment patterns
|
|
* if any, but 10m-20 (= 2(m-2)x5) of them overlaps with
|
|
* timing patterns.
|
|
*/
|
|
var v = VERSIONS[ver];
|
|
var nbits = 16 * ver * ver + 128 * ver + 64; // finder, timing and format info.
|
|
if (needsverinfo(ver))
|
|
nbits -= 36; // version information
|
|
if (v[2].length) { // alignment patterns
|
|
nbits -= 25 * v[2].length * v[2].length - 10 * v[2].length - 55;
|
|
}
|
|
return nbits;
|
|
};
|
|
|
|
// returns the number of bits available for data portions (i.e. excludes ECC
|
|
// bits but includes mode and length bits) in this version and ECC level.
|
|
var ndatabits = function (ver, ecclevel) {
|
|
var nbits = nfullbits(ver) & ~7; // no sub-octet code words
|
|
var v = VERSIONS[ver];
|
|
nbits -= 8 * v[0][ecclevel] * v[1][ecclevel]; // ecc bits
|
|
return nbits;
|
|
};
|
|
|
|
// returns the number of bits required for the length of data.
|
|
// (cf. Table 3 in JIS X 0510:2004 p. 16)
|
|
var ndatalenbits = function (ver, mode) {
|
|
switch (mode) {
|
|
case MODE_NUMERIC:
|
|
return (ver < 10 ? 10 : ver < 27 ? 12 : 14);
|
|
case MODE_ALPHANUMERIC:
|
|
return (ver < 10 ? 9 : ver < 27 ? 11 : 13);
|
|
case MODE_OCTET:
|
|
return (ver < 10 ? 8 : 16);
|
|
case MODE_KANJI:
|
|
return (ver < 10 ? 8 : ver < 27 ? 10 : 12);
|
|
}
|
|
};
|
|
|
|
// returns the maximum length of data possible in given configuration.
|
|
var getmaxdatalen = function (ver, mode, ecclevel) {
|
|
var nbits = ndatabits(ver, ecclevel) - 4 - ndatalenbits(ver, mode); // 4 for mode bits
|
|
switch (mode) {
|
|
case MODE_NUMERIC:
|
|
return ((nbits / 10) | 0) * 3 + (nbits % 10 < 4 ? 0 : nbits % 10 < 7 ? 1 : 2);
|
|
case MODE_ALPHANUMERIC:
|
|
return ((nbits / 11) | 0) * 2 + (nbits % 11 < 6 ? 0 : 1);
|
|
case MODE_OCTET:
|
|
return (nbits / 8) | 0;
|
|
case MODE_KANJI:
|
|
return (nbits / 13) | 0;
|
|
}
|
|
};
|
|
|
|
// checks if the given data can be encoded in given mode, and returns
|
|
// the converted data for the further processing if possible. otherwise
|
|
// returns null.
|
|
//
|
|
// this function does not check the length of data; it is a duty of
|
|
// encode function below (as it depends on the version and ECC level too).
|
|
var validatedata = function (mode, data) {
|
|
switch (mode) {
|
|
case MODE_NUMERIC:
|
|
if (!data.match(NUMERIC_REGEXP))
|
|
return null;
|
|
return data;
|
|
|
|
case MODE_ALPHANUMERIC:
|
|
if (!data.match(ALPHANUMERIC_REGEXP))
|
|
return null;
|
|
return data.toUpperCase();
|
|
|
|
case MODE_OCTET:
|
|
if (typeof data === 'string') { // encode as utf-8 string
|
|
var newdata = [];
|
|
for (var i = 0; i < data.length; ++i) {
|
|
var ch = data.charCodeAt(i);
|
|
if (ch < 0x80) {
|
|
newdata.push(ch);
|
|
} else if (ch < 0x800) {
|
|
newdata.push(0xc0 | (ch >> 6),
|
|
0x80 | (ch & 0x3f));
|
|
} else if (ch < 0x10000) {
|
|
newdata.push(0xe0 | (ch >> 12),
|
|
0x80 | ((ch >> 6) & 0x3f),
|
|
0x80 | (ch & 0x3f));
|
|
} else {
|
|
newdata.push(0xf0 | (ch >> 18),
|
|
0x80 | ((ch >> 12) & 0x3f),
|
|
0x80 | ((ch >> 6) & 0x3f),
|
|
0x80 | (ch & 0x3f));
|
|
}
|
|
}
|
|
return newdata;
|
|
} else {
|
|
return data;
|
|
}
|
|
}
|
|
};
|
|
|
|
// returns the code words (sans ECC bits) for given data and configurations.
|
|
// requires data to be preprocessed by validatedata. no length check is
|
|
// performed, and everything has to be checked before calling this function.
|
|
var encode = function (ver, mode, data, maxbuflen) {
|
|
var buf = [];
|
|
var bits = 0, remaining = 8;
|
|
var datalen = data.length;
|
|
|
|
// this function is intentionally no-op when n=0.
|
|
var pack = function (x, n) {
|
|
if (n >= remaining) {
|
|
buf.push(bits | (x >> (n -= remaining)));
|
|
while (n >= 8)
|
|
buf.push((x >> (n -= 8)) & 255);
|
|
bits = 0;
|
|
remaining = 8;
|
|
}
|
|
if (n > 0)
|
|
bits |= (x & ((1 << n) - 1)) << (remaining -= n);
|
|
};
|
|
|
|
var nlenbits = ndatalenbits(ver, mode);
|
|
pack(mode, 4);
|
|
pack(datalen, nlenbits);
|
|
|
|
switch (mode) {
|
|
case MODE_NUMERIC:
|
|
for (var i = 2; i < datalen; i += 3) {
|
|
pack(parseInt(data.substring(i - 2, i + 1), 10), 10);
|
|
}
|
|
pack(parseInt(data.substring(i - 2), 10), [0, 4, 7][datalen % 3]);
|
|
break;
|
|
|
|
case MODE_ALPHANUMERIC:
|
|
for (var i = 1; i < datalen; i += 2) {
|
|
pack(ALPHANUMERIC_MAP[data.charAt(i - 1)] * 45 +
|
|
ALPHANUMERIC_MAP[data.charAt(i)], 11);
|
|
}
|
|
if (datalen % 2 == 1) {
|
|
pack(ALPHANUMERIC_MAP[data.charAt(i - 1)], 6);
|
|
}
|
|
break;
|
|
|
|
case MODE_OCTET:
|
|
for (var i = 0; i < datalen; ++i) {
|
|
pack(data[i], 8);
|
|
}
|
|
break;
|
|
}
|
|
|
|
// final bits. it is possible that adding terminator causes the buffer
|
|
// to overflow, but then the buffer truncated to the maximum size will
|
|
// be valid as the truncated terminator mode bits and padding is
|
|
// identical in appearance (cf. JIS X 0510:2004 sec 8.4.8).
|
|
pack(MODE_TERMINATOR, 4);
|
|
if (remaining < 8)
|
|
buf.push(bits);
|
|
|
|
// the padding to fill up the remaining space. we should not add any
|
|
// words when the overflow already occurred.
|
|
while (buf.length + 1 < maxbuflen)
|
|
buf.push(0xec, 0x11);
|
|
if (buf.length < maxbuflen)
|
|
buf.push(0xec);
|
|
return buf;
|
|
};
|
|
|
|
// calculates ECC code words for given code words and generator polynomial.
|
|
//
|
|
// this is quite similar to CRC calculation as both Reed-Solomon and CRC use
|
|
// the certain kind of cyclic codes, which is effectively the division of
|
|
// zero-augumented polynomial by the generator polynomial. the only difference
|
|
// is that Reed-Solomon uses GF(2^8), instead of CRC's GF(2), and Reed-Solomon
|
|
// uses the different generator polynomial than CRC's.
|
|
var calculateecc = function (poly, genpoly) {
|
|
var modulus = poly.slice(0);
|
|
var polylen = poly.length, genpolylen = genpoly.length;
|
|
for (var i = 0; i < genpolylen; ++i)
|
|
modulus.push(0);
|
|
for (var i = 0; i < polylen; ) {
|
|
var quotient = GF256_INVMAP[modulus[i++]];
|
|
if (quotient >= 0) {
|
|
for (var j = 0; j < genpolylen; ++j) {
|
|
modulus[i + j] ^= GF256_MAP[(quotient + genpoly[j]) % 255];
|
|
}
|
|
}
|
|
}
|
|
return modulus.slice(polylen);
|
|
};
|
|
|
|
// auguments ECC code words to given code words. the resulting words are
|
|
// ready to be encoded in the matrix.
|
|
//
|
|
// the much of actual augumenting procedure follows JIS X 0510:2004 sec 8.7.
|
|
// the code is simplified using the fact that the size of each code & ECC
|
|
// blocks is almost same; for example, when we have 4 blocks and 46 data words
|
|
// the number of code words in those blocks are 11, 11, 12, 12 respectively.
|
|
var augumenteccs = function (poly, nblocks, genpoly) {
|
|
var subsizes = [];
|
|
var subsize = (poly.length / nblocks) | 0, subsize0 = 0;
|
|
var pivot = nblocks - poly.length % nblocks;
|
|
for (var i = 0; i < pivot; ++i) {
|
|
subsizes.push(subsize0);
|
|
subsize0 += subsize;
|
|
}
|
|
for (var i = pivot; i < nblocks; ++i) {
|
|
subsizes.push(subsize0);
|
|
subsize0 += subsize + 1;
|
|
}
|
|
subsizes.push(subsize0);
|
|
|
|
var eccs = [];
|
|
for (var i = 0; i < nblocks; ++i) {
|
|
eccs.push(calculateecc(poly.slice(subsizes[i], subsizes[i + 1]), genpoly));
|
|
}
|
|
|
|
var result = [];
|
|
var nitemsperblock = (poly.length / nblocks) | 0;
|
|
for (var i = 0; i < nitemsperblock; ++i) {
|
|
for (var j = 0; j < nblocks; ++j) {
|
|
result.push(poly[subsizes[j] + i]);
|
|
}
|
|
}
|
|
for (var j = pivot; j < nblocks; ++j) {
|
|
result.push(poly[subsizes[j + 1] - 1]);
|
|
}
|
|
for (var i = 0; i < genpoly.length; ++i) {
|
|
for (var j = 0; j < nblocks; ++j) {
|
|
result.push(eccs[j][i]);
|
|
}
|
|
}
|
|
return result;
|
|
};
|
|
|
|
// auguments BCH(p+q,q) code to the polynomial over GF(2), given the proper
|
|
// genpoly. the both input and output are in binary numbers, and unlike
|
|
// calculateecc genpoly should include the 1 bit for the highest degree.
|
|
//
|
|
// actual polynomials used for this procedure are as follows:
|
|
// - p=10, q=5, genpoly=x^10+x^8+x^5+x^4+x^2+x+1 (JIS X 0510:2004 Appendix C)
|
|
// - p=18, q=6, genpoly=x^12+x^11+x^10+x^9+x^8+x^5+x^2+1 (ibid. Appendix D)
|
|
var augumentbch = function (poly, p, genpoly, q) {
|
|
var modulus = poly << q;
|
|
for (var i = p - 1; i >= 0; --i) {
|
|
if ((modulus >> (q + i)) & 1)
|
|
modulus ^= genpoly << i;
|
|
}
|
|
return (poly << q) | modulus;
|
|
};
|
|
|
|
// creates the base matrix for given version. it returns two matrices, one of
|
|
// them is the actual one and the another represents the "reserved" portion
|
|
// (e.g. finder and timing patterns) of the matrix.
|
|
//
|
|
// some entries in the matrix may be undefined, rather than 0 or 1. this is
|
|
// intentional (no initialization needed!), and putdata below will fill
|
|
// the remaining ones.
|
|
var makebasematrix = function (ver) {
|
|
var v = VERSIONS[ver], n = getsizebyver(ver);
|
|
var matrix = [], reserved = [];
|
|
for (var i = 0; i < n; ++i) {
|
|
matrix.push([]);
|
|
reserved.push([]);
|
|
}
|
|
|
|
var blit = function (y, x, h, w, bits) {
|
|
for (var i = 0; i < h; ++i) {
|
|
for (var j = 0; j < w; ++j) {
|
|
matrix[y + i][x + j] = (bits[i] >> j) & 1;
|
|
reserved[y + i][x + j] = 1;
|
|
}
|
|
}
|
|
};
|
|
|
|
// finder patterns and a part of timing patterns
|
|
// will also mark the format information area (not yet written) as reserved.
|
|
blit(0, 0, 9, 9, [0x7f, 0x41, 0x5d, 0x5d, 0x5d, 0x41, 0x17f, 0x00, 0x40]);
|
|
blit(n - 8, 0, 8, 9, [0x100, 0x7f, 0x41, 0x5d, 0x5d, 0x5d, 0x41, 0x7f]);
|
|
blit(0, n - 8, 9, 8, [0xfe, 0x82, 0xba, 0xba, 0xba, 0x82, 0xfe, 0x00, 0x00]);
|
|
|
|
// the rest of timing patterns
|
|
for (var i = 9; i < n - 8; ++i) {
|
|
matrix[6][i] = matrix[i][6] = ~i & 1;
|
|
reserved[6][i] = reserved[i][6] = 1;
|
|
}
|
|
|
|
// alignment patterns
|
|
var aligns = v[2], m = aligns.length;
|
|
for (var i = 0; i < m; ++i) {
|
|
var minj = (i === 0 || i === m - 1 ? 1 : 0), maxj = (i === 0 ? m - 1 : m);
|
|
for (var j = minj; j < maxj; ++j) {
|
|
blit(aligns[i], aligns[j], 5, 5, [0x1f, 0x11, 0x15, 0x11, 0x1f]);
|
|
}
|
|
}
|
|
|
|
// version information
|
|
if (needsverinfo(ver)) {
|
|
var code = augumentbch(ver, 6, 0x1f25, 12);
|
|
var k = 0;
|
|
for (var i = 0; i < 6; ++i) {
|
|
for (var j = 0; j < 3; ++j) {
|
|
matrix[i][(n - 11) + j] = matrix[(n - 11) + j][i] = (code >> k++) & 1;
|
|
reserved[i][(n - 11) + j] = reserved[(n - 11) + j][i] = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
return {matrix: matrix, reserved: reserved};
|
|
};
|
|
|
|
// fills the data portion (i.e. unmarked in reserved) of the matrix with given
|
|
// code words. the size of code words should be no more than available bits,
|
|
// and remaining bits are padded to 0 (cf. JIS X 0510:2004 sec 8.7.3).
|
|
var putdata = function (matrix, reserved, buf) {
|
|
var n = matrix.length;
|
|
var k = 0, dir = -1;
|
|
for (var i = n - 1; i >= 0; i -= 2) {
|
|
if (i == 6)
|
|
--i; // skip the entire timing pattern column
|
|
var jj = (dir < 0 ? n - 1 : 0);
|
|
for (var j = 0; j < n; ++j) {
|
|
for (var ii = i; ii > i - 2; --ii) {
|
|
if (!reserved[jj][ii]) {
|
|
// may overflow, but (undefined >> x)
|
|
// is 0 so it will auto-pad to zero.
|
|
matrix[jj][ii] = (buf[k >> 3] >> (~k & 7)) & 1;
|
|
++k;
|
|
}
|
|
}
|
|
jj += dir;
|
|
}
|
|
dir = -dir;
|
|
}
|
|
return matrix;
|
|
};
|
|
|
|
// XOR-masks the data portion of the matrix. repeating the call with the same
|
|
// arguments will revert the prior call (convenient in the matrix evaluation).
|
|
var maskdata = function (matrix, reserved, mask) {
|
|
var maskf = MASKFUNCS[mask];
|
|
var n = matrix.length;
|
|
for (var i = 0; i < n; ++i) {
|
|
for (var j = 0; j < n; ++j) {
|
|
if (!reserved[i][j])
|
|
matrix[i][j] ^= maskf(i, j);
|
|
}
|
|
}
|
|
return matrix;
|
|
};
|
|
|
|
// puts the format information.
|
|
var putformatinfo = function (matrix, reserved, ecclevel, mask) {
|
|
var n = matrix.length;
|
|
var code = augumentbch((ecclevel << 3) | mask, 5, 0x537, 10) ^ 0x5412;
|
|
for (var i = 0; i < 15; ++i) {
|
|
var r = [0, 1, 2, 3, 4, 5, 7, 8, n - 7, n - 6, n - 5, n - 4, n - 3, n - 2, n - 1][i];
|
|
var c = [n - 1, n - 2, n - 3, n - 4, n - 5, n - 6, n - 7, n - 8, 7, 5, 4, 3, 2, 1, 0][i];
|
|
matrix[r][8] = matrix[8][c] = (code >> i) & 1;
|
|
// we don't have to mark those bits reserved; always done
|
|
// in makebasematrix above.
|
|
}
|
|
return matrix;
|
|
};
|
|
|
|
// evaluates the resulting matrix and returns the score (lower is better).
|
|
// (cf. JIS X 0510:2004 sec 8.8.2)
|
|
//
|
|
// the evaluation procedure tries to avoid the problematic patterns naturally
|
|
// occuring from the original matrix. for example, it penaltizes the patterns
|
|
// which just look like the finder pattern which will confuse the decoder.
|
|
// we choose the mask which results in the lowest score among 8 possible ones.
|
|
//
|
|
// note: zxing seems to use the same procedure and in many cases its choice
|
|
// agrees to ours, but sometimes it does not. practically it doesn't matter.
|
|
var evaluatematrix = function (matrix) {
|
|
// N1+(k-5) points for each consecutive row of k same-colored modules,
|
|
// where k >= 5. no overlapping row counts.
|
|
var PENALTY_CONSECUTIVE = 3;
|
|
// N2 points for each 2x2 block of same-colored modules.
|
|
// overlapping block does count.
|
|
var PENALTY_TWOBYTWO = 3;
|
|
// N3 points for each pattern with >4W:1B:1W:3B:1W:1B or
|
|
// 1B:1W:3B:1W:1B:>4W, or their multiples (e.g. highly unlikely,
|
|
// but 13W:3B:3W:9B:3W:3B counts).
|
|
var PENALTY_FINDERLIKE = 40;
|
|
// N4*k points for every (5*k)% deviation from 50% black density.
|
|
// i.e. k=1 for 55~60% and 40~45%, k=2 for 60~65% and 35~40%, etc.
|
|
var PENALTY_DENSITY = 10;
|
|
|
|
var evaluategroup = function (groups) { // assumes [W,B,W,B,W,...,B,W]
|
|
var score = 0;
|
|
for (var i = 0; i < groups.length; ++i) {
|
|
if (groups[i] >= 5)
|
|
score += PENALTY_CONSECUTIVE + (groups[i] - 5);
|
|
}
|
|
for (var i = 5; i < groups.length; i += 2) {
|
|
var p = groups[i];
|
|
if (groups[i - 1] == p && groups[i - 2] == 3 * p && groups[i - 3] == p &&
|
|
groups[i - 4] == p && (groups[i - 5] >= 4 * p || groups[i + 1] >= 4 * p)) {
|
|
// this part differs from zxing...
|
|
score += PENALTY_FINDERLIKE;
|
|
}
|
|
}
|
|
return score;
|
|
};
|
|
|
|
var n = matrix.length;
|
|
var score = 0, nblacks = 0;
|
|
for (var i = 0; i < n; ++i) {
|
|
var row = matrix[i];
|
|
var groups;
|
|
|
|
// evaluate the current row
|
|
groups = [0]; // the first empty group of white
|
|
for (var j = 0; j < n; ) {
|
|
var k;
|
|
for (k = 0; j < n && row[j]; ++k)
|
|
++j;
|
|
groups.push(k);
|
|
for (k = 0; j < n && !row[j]; ++k)
|
|
++j;
|
|
groups.push(k);
|
|
}
|
|
score += evaluategroup(groups);
|
|
|
|
// evaluate the current column
|
|
groups = [0];
|
|
for (var j = 0; j < n; ) {
|
|
var k;
|
|
for (k = 0; j < n && matrix[j][i]; ++k)
|
|
++j;
|
|
groups.push(k);
|
|
for (k = 0; j < n && !matrix[j][i]; ++k)
|
|
++j;
|
|
groups.push(k);
|
|
}
|
|
score += evaluategroup(groups);
|
|
|
|
// check the 2x2 box and calculate the density
|
|
var nextrow = matrix[i + 1] || [];
|
|
nblacks += row[0];
|
|
for (var j = 1; j < n; ++j) {
|
|
var p = row[j];
|
|
nblacks += p;
|
|
// at least comparison with next row should be strict...
|
|
if (row[j - 1] == p && nextrow[j] === p && nextrow[j - 1] === p) {
|
|
score += PENALTY_TWOBYTWO;
|
|
}
|
|
}
|
|
}
|
|
|
|
score += PENALTY_DENSITY * ((Math.abs(nblacks / n / n - 0.5) / 0.05) | 0);
|
|
return score;
|
|
};
|
|
|
|
// returns the fully encoded QR code matrix which contains given data.
|
|
// it also chooses the best mask automatically when mask is -1.
|
|
var generate = function (data, ver, mode, ecclevel, mask) {
|
|
var v = VERSIONS[ver];
|
|
var buf = encode(ver, mode, data, ndatabits(ver, ecclevel) >> 3);
|
|
buf = augumenteccs(buf, v[1][ecclevel], GF256_GENPOLY[v[0][ecclevel]]);
|
|
|
|
var result = makebasematrix(ver);
|
|
var matrix = result.matrix, reserved = result.reserved;
|
|
putdata(matrix, reserved, buf);
|
|
|
|
if (mask < 0) {
|
|
// find the best mask
|
|
maskdata(matrix, reserved, 0);
|
|
putformatinfo(matrix, reserved, ecclevel, 0);
|
|
var bestmask = 0, bestscore = evaluatematrix(matrix);
|
|
maskdata(matrix, reserved, 0);
|
|
for (mask = 1; mask < 8; ++mask) {
|
|
maskdata(matrix, reserved, mask);
|
|
putformatinfo(matrix, reserved, ecclevel, mask);
|
|
var score = evaluatematrix(matrix);
|
|
if (bestscore > score) {
|
|
bestscore = score;
|
|
bestmask = mask;
|
|
}
|
|
maskdata(matrix, reserved, mask);
|
|
}
|
|
mask = bestmask;
|
|
}
|
|
|
|
maskdata(matrix, reserved, mask);
|
|
putformatinfo(matrix, reserved, ecclevel, mask);
|
|
return matrix;
|
|
};
|
|
|
|
// the public interface is trivial; the options available are as follows:
|
|
//
|
|
// - version: an integer in [1,40]. when omitted (or -1) the smallest possible
|
|
// version is chosen.
|
|
// - mode: one of 'numeric', 'alphanumeric', 'octet'. when omitted the smallest
|
|
// possible mode is chosen.
|
|
// - eccLevel: one of 'L', 'M', 'Q', 'H'. defaults to 'L'.
|
|
// - mask: an integer in [0,7]. when omitted (or -1) the best mask is chosen.
|
|
//
|
|
|
|
function generateFrame(data, options) {
|
|
var MODES = {'numeric': MODE_NUMERIC, 'alphanumeric': MODE_ALPHANUMERIC,
|
|
'octet': MODE_OCTET};
|
|
var ECCLEVELS = {'L': ECCLEVEL_L, 'M': ECCLEVEL_M, 'Q': ECCLEVEL_Q,
|
|
'H': ECCLEVEL_H};
|
|
|
|
options = options || {};
|
|
var ver = options.version || -1;
|
|
var ecclevel = ECCLEVELS[(options.eccLevel || 'L').toUpperCase()];
|
|
var mode = options.mode ? MODES[options.mode.toLowerCase()] : -1;
|
|
var mask = 'mask' in options ? options.mask : -1;
|
|
|
|
if (mode < 0) {
|
|
if (typeof data === 'string') {
|
|
if (data.match(NUMERIC_REGEXP)) {
|
|
mode = MODE_NUMERIC;
|
|
} else if (data.match(ALPHANUMERIC_OUT_REGEXP)) {
|
|
// while encode supports case-insensitive encoding, we restrict the data to be uppercased when auto-selecting the mode.
|
|
mode = MODE_ALPHANUMERIC;
|
|
} else {
|
|
mode = MODE_OCTET;
|
|
}
|
|
} else {
|
|
mode = MODE_OCTET;
|
|
}
|
|
} else if (!(mode == MODE_NUMERIC || mode == MODE_ALPHANUMERIC ||
|
|
mode == MODE_OCTET)) {
|
|
throw 'invalid or unsupported mode';
|
|
}
|
|
|
|
data = validatedata(mode, data);
|
|
if (data === null)
|
|
throw 'invalid data format';
|
|
|
|
if (ecclevel < 0 || ecclevel > 3)
|
|
throw 'invalid ECC level';
|
|
|
|
if (ver < 0) {
|
|
for (ver = 1; ver <= 40; ++ver) {
|
|
if (data.length <= getmaxdatalen(ver, mode, ecclevel))
|
|
break;
|
|
}
|
|
if (ver > 40)
|
|
throw 'too large data for the Qr format';
|
|
} else if (ver < 1 || ver > 40) {
|
|
throw 'invalid Qr version! should be between 1 and 40';
|
|
}
|
|
|
|
if (mask != -1 && (mask < 0 || mask > 8))
|
|
throw 'invalid mask';
|
|
//console.log('version:', ver, 'mode:', mode, 'ECC:', ecclevel, 'mask:', mask )
|
|
return generate(data, ver, mode, ecclevel, mask);
|
|
}
|
|
|
|
|
|
// options
|
|
// - modulesize: a number. this is a size of each modules in pixels, and
|
|
// defaults to 5px.
|
|
// - margin: a number. this is a size of margin in *modules*, and defaults to
|
|
// 4 (white modules). the specficiation mandates the margin no less than 4
|
|
// modules, so it is better not to alter this value unless you know what
|
|
// you're doing.
|
|
function buildCanvas(data, options) {
|
|
|
|
var canvas = [];
|
|
var background = data.background || '#fff';
|
|
var foreground = data.foreground || '#000';
|
|
//var margin = options.margin || 4;
|
|
var matrix = generateFrame(data, options);
|
|
var n = matrix.length;
|
|
var modSize = Math.floor(options.fit ? options.fit / n : 5);
|
|
var size = n * modSize;
|
|
|
|
canvas.push({
|
|
type: 'rect',
|
|
x: 0, y: 0, w: size, h: size, lineWidth: 0, color: background
|
|
});
|
|
|
|
for (var i = 0; i < n; ++i) {
|
|
for (var j = 0; j < n; ++j) {
|
|
if (matrix[i][j]) {
|
|
canvas.push({
|
|
type: 'rect',
|
|
x: modSize * j,
|
|
y: modSize * i,
|
|
w: modSize,
|
|
h: modSize,
|
|
lineWidth: 0,
|
|
color: foreground
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
return {
|
|
canvas: canvas,
|
|
size: size
|
|
};
|
|
|
|
}
|
|
|
|
function measure(node) {
|
|
var cd = buildCanvas(node.qr, node);
|
|
node._canvas = cd.canvas;
|
|
node._width = node._height = node._minWidth = node._maxWidth = node._minHeight = node._maxHeight = cd.size;
|
|
return node;
|
|
}
|
|
|
|
module.exports = {
|
|
measure: measure
|
|
};
|
|
|
|
/***/ },
|
|
/* 24 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
var TraversalTracker = __webpack_require__(11);
|
|
|
|
/**
|
|
* Creates an instance of DocumentContext - a store for current x, y positions and available width/height.
|
|
* It facilitates column divisions and vertical sync
|
|
*/
|
|
function DocumentContext(pageSize, pageMargins) {
|
|
this.pages = [];
|
|
|
|
this.pageMargins = pageMargins;
|
|
|
|
this.x = pageMargins.left;
|
|
this.availableWidth = pageSize.width - pageMargins.left - pageMargins.right;
|
|
this.availableHeight = 0;
|
|
this.page = -1;
|
|
|
|
this.snapshots = [];
|
|
|
|
this.endingCell = null;
|
|
|
|
this.tracker = new TraversalTracker();
|
|
|
|
this.addPage(pageSize);
|
|
}
|
|
|
|
DocumentContext.prototype.beginColumnGroup = function () {
|
|
this.snapshots.push({
|
|
x: this.x,
|
|
y: this.y,
|
|
availableHeight: this.availableHeight,
|
|
availableWidth: this.availableWidth,
|
|
page: this.page,
|
|
bottomMost: {y: this.y, page: this.page},
|
|
endingCell: this.endingCell,
|
|
lastColumnWidth: this.lastColumnWidth
|
|
});
|
|
|
|
this.lastColumnWidth = 0;
|
|
};
|
|
|
|
DocumentContext.prototype.beginColumn = function (width, offset, endingCell) {
|
|
var saved = this.snapshots[this.snapshots.length - 1];
|
|
|
|
this.calculateBottomMost(saved);
|
|
|
|
this.endingCell = endingCell;
|
|
this.page = saved.page;
|
|
this.x = this.x + this.lastColumnWidth + (offset || 0);
|
|
this.y = saved.y;
|
|
this.availableWidth = width; //saved.availableWidth - offset;
|
|
this.availableHeight = saved.availableHeight;
|
|
|
|
this.lastColumnWidth = width;
|
|
};
|
|
|
|
DocumentContext.prototype.calculateBottomMost = function (destContext) {
|
|
if (this.endingCell) {
|
|
this.saveContextInEndingCell(this.endingCell);
|
|
this.endingCell = null;
|
|
} else {
|
|
destContext.bottomMost = bottomMostContext(this, destContext.bottomMost);
|
|
}
|
|
};
|
|
|
|
DocumentContext.prototype.markEnding = function (endingCell) {
|
|
this.page = endingCell._columnEndingContext.page;
|
|
this.x = endingCell._columnEndingContext.x;
|
|
this.y = endingCell._columnEndingContext.y;
|
|
this.availableWidth = endingCell._columnEndingContext.availableWidth;
|
|
this.availableHeight = endingCell._columnEndingContext.availableHeight;
|
|
this.lastColumnWidth = endingCell._columnEndingContext.lastColumnWidth;
|
|
};
|
|
|
|
DocumentContext.prototype.saveContextInEndingCell = function (endingCell) {
|
|
endingCell._columnEndingContext = {
|
|
page: this.page,
|
|
x: this.x,
|
|
y: this.y,
|
|
availableHeight: this.availableHeight,
|
|
availableWidth: this.availableWidth,
|
|
lastColumnWidth: this.lastColumnWidth
|
|
};
|
|
};
|
|
|
|
DocumentContext.prototype.completeColumnGroup = function () {
|
|
var saved = this.snapshots.pop();
|
|
|
|
this.calculateBottomMost(saved);
|
|
|
|
this.endingCell = null;
|
|
this.x = saved.x;
|
|
this.y = saved.bottomMost.y;
|
|
this.page = saved.bottomMost.page;
|
|
this.availableWidth = saved.availableWidth;
|
|
this.availableHeight = saved.bottomMost.availableHeight;
|
|
this.lastColumnWidth = saved.lastColumnWidth;
|
|
};
|
|
|
|
DocumentContext.prototype.addMargin = function (left, right) {
|
|
this.x += left;
|
|
this.availableWidth -= left + (right || 0);
|
|
};
|
|
|
|
DocumentContext.prototype.moveDown = function (offset) {
|
|
this.y += offset;
|
|
this.availableHeight -= offset;
|
|
|
|
return this.availableHeight > 0;
|
|
};
|
|
|
|
DocumentContext.prototype.initializePage = function () {
|
|
this.y = this.pageMargins.top;
|
|
this.availableHeight = this.getCurrentPage().pageSize.height - this.pageMargins.top - this.pageMargins.bottom;
|
|
this.pageSnapshot().availableWidth = this.getCurrentPage().pageSize.width - this.pageMargins.left - this.pageMargins.right;
|
|
};
|
|
|
|
DocumentContext.prototype.pageSnapshot = function () {
|
|
if (this.snapshots[0]) {
|
|
return this.snapshots[0];
|
|
} else {
|
|
return this;
|
|
}
|
|
};
|
|
|
|
DocumentContext.prototype.moveTo = function (x, y) {
|
|
if (x !== undefined && x !== null) {
|
|
this.x = x;
|
|
this.availableWidth = this.getCurrentPage().pageSize.width - this.x - this.pageMargins.right;
|
|
}
|
|
if (y !== undefined && y !== null) {
|
|
this.y = y;
|
|
this.availableHeight = this.getCurrentPage().pageSize.height - this.y - this.pageMargins.bottom;
|
|
}
|
|
};
|
|
|
|
DocumentContext.prototype.beginDetachedBlock = function () {
|
|
this.snapshots.push({
|
|
x: this.x,
|
|
y: this.y,
|
|
availableHeight: this.availableHeight,
|
|
availableWidth: this.availableWidth,
|
|
page: this.page,
|
|
endingCell: this.endingCell,
|
|
lastColumnWidth: this.lastColumnWidth
|
|
});
|
|
};
|
|
|
|
DocumentContext.prototype.endDetachedBlock = function () {
|
|
var saved = this.snapshots.pop();
|
|
|
|
this.x = saved.x;
|
|
this.y = saved.y;
|
|
this.availableWidth = saved.availableWidth;
|
|
this.availableHeight = saved.availableHeight;
|
|
this.page = saved.page;
|
|
this.endingCell = saved.endingCell;
|
|
this.lastColumnWidth = saved.lastColumnWidth;
|
|
};
|
|
|
|
function pageOrientation(pageOrientationString, currentPageOrientation) {
|
|
if (pageOrientationString === undefined) {
|
|
return currentPageOrientation;
|
|
} else if (pageOrientationString === 'landscape') {
|
|
return 'landscape';
|
|
} else {
|
|
return 'portrait';
|
|
}
|
|
}
|
|
|
|
var getPageSize = function (currentPage, newPageOrientation) {
|
|
|
|
newPageOrientation = pageOrientation(newPageOrientation, currentPage.pageSize.orientation);
|
|
|
|
if (newPageOrientation !== currentPage.pageSize.orientation) {
|
|
return {
|
|
orientation: newPageOrientation,
|
|
width: currentPage.pageSize.height,
|
|
height: currentPage.pageSize.width
|
|
};
|
|
} else {
|
|
return {
|
|
orientation: currentPage.pageSize.orientation,
|
|
width: currentPage.pageSize.width,
|
|
height: currentPage.pageSize.height
|
|
};
|
|
}
|
|
|
|
};
|
|
|
|
|
|
DocumentContext.prototype.moveToNextPage = function (pageOrientation) {
|
|
var nextPageIndex = this.page + 1;
|
|
|
|
var prevPage = this.page;
|
|
var prevY = this.y;
|
|
|
|
var createNewPage = nextPageIndex >= this.pages.length;
|
|
if (createNewPage) {
|
|
var currentAvailableWidth = this.availableWidth;
|
|
this.addPage(getPageSize(this.getCurrentPage(), pageOrientation));
|
|
this.availableWidth = currentAvailableWidth;
|
|
} else {
|
|
this.page = nextPageIndex;
|
|
this.initializePage();
|
|
}
|
|
|
|
return {
|
|
newPageCreated: createNewPage,
|
|
prevPage: prevPage,
|
|
prevY: prevY,
|
|
y: this.y
|
|
};
|
|
};
|
|
|
|
|
|
DocumentContext.prototype.addPage = function (pageSize) {
|
|
var page = {items: [], pageSize: pageSize};
|
|
this.pages.push(page);
|
|
this.page = this.pages.length - 1;
|
|
this.initializePage();
|
|
|
|
this.tracker.emit('pageAdded');
|
|
|
|
return page;
|
|
};
|
|
|
|
DocumentContext.prototype.getCurrentPage = function () {
|
|
if (this.page < 0 || this.page >= this.pages.length) {
|
|
return null;
|
|
}
|
|
|
|
return this.pages[this.page];
|
|
};
|
|
|
|
DocumentContext.prototype.getCurrentPosition = function () {
|
|
var pageSize = this.getCurrentPage().pageSize;
|
|
var innerHeight = pageSize.height - this.pageMargins.top - this.pageMargins.bottom;
|
|
var innerWidth = pageSize.width - this.pageMargins.left - this.pageMargins.right;
|
|
|
|
return {
|
|
pageNumber: this.page + 1,
|
|
pageOrientation: pageSize.orientation,
|
|
pageInnerHeight: innerHeight,
|
|
pageInnerWidth: innerWidth,
|
|
left: this.x,
|
|
top: this.y,
|
|
verticalRatio: ((this.y - this.pageMargins.top) / innerHeight),
|
|
horizontalRatio: ((this.x - this.pageMargins.left) / innerWidth)
|
|
};
|
|
};
|
|
|
|
function bottomMostContext(c1, c2) {
|
|
var r;
|
|
|
|
if (c1.page > c2.page) {
|
|
r = c1;
|
|
} else if (c2.page > c1.page) {
|
|
r = c2;
|
|
} else {
|
|
r = (c1.y > c2.y) ? c1 : c2;
|
|
}
|
|
|
|
return {
|
|
page: r.page,
|
|
x: r.x,
|
|
y: r.y,
|
|
availableHeight: r.availableHeight,
|
|
availableWidth: r.availableWidth
|
|
};
|
|
}
|
|
|
|
/****TESTS**** (add a leading '/' to uncomment)
|
|
DocumentContext.bottomMostContext = bottomMostContext;
|
|
// */
|
|
|
|
module.exports = DocumentContext;
|
|
|
|
|
|
/***/ },
|
|
/* 25 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
var ElementWriter = __webpack_require__(26);
|
|
|
|
/**
|
|
* Creates an instance of PageElementWriter - an extended ElementWriter
|
|
* which can handle:
|
|
* - page-breaks (it adds new pages when there's not enough space left),
|
|
* - repeatable fragments (like table-headers, which are repeated everytime
|
|
* a page-break occurs)
|
|
* - transactions (used for unbreakable-blocks when we want to make sure
|
|
* whole block will be rendered on the same page)
|
|
*/
|
|
function PageElementWriter(context, tracker) {
|
|
this.transactionLevel = 0;
|
|
this.repeatables = [];
|
|
this.tracker = tracker;
|
|
this.writer = new ElementWriter(context, tracker);
|
|
}
|
|
|
|
function fitOnPage(self, addFct) {
|
|
var position = addFct(self);
|
|
if (!position) {
|
|
self.moveToNextPage();
|
|
position = addFct(self);
|
|
}
|
|
return position;
|
|
}
|
|
|
|
PageElementWriter.prototype.addLine = function (line, dontUpdateContextPosition, index) {
|
|
return fitOnPage(this, function (self) {
|
|
return self.writer.addLine(line, dontUpdateContextPosition, index);
|
|
});
|
|
};
|
|
|
|
PageElementWriter.prototype.addImage = function (image, index) {
|
|
return fitOnPage(this, function (self) {
|
|
return self.writer.addImage(image, index);
|
|
});
|
|
};
|
|
|
|
PageElementWriter.prototype.addQr = function (qr, index) {
|
|
return fitOnPage(this, function (self) {
|
|
return self.writer.addQr(qr, index);
|
|
});
|
|
};
|
|
|
|
PageElementWriter.prototype.addVector = function (vector, ignoreContextX, ignoreContextY, index) {
|
|
return this.writer.addVector(vector, ignoreContextX, ignoreContextY, index);
|
|
};
|
|
|
|
PageElementWriter.prototype.addFragment = function (fragment, useBlockXOffset, useBlockYOffset, dontUpdateContextPosition) {
|
|
if (!this.writer.addFragment(fragment, useBlockXOffset, useBlockYOffset, dontUpdateContextPosition)) {
|
|
this.moveToNextPage();
|
|
this.writer.addFragment(fragment, useBlockXOffset, useBlockYOffset, dontUpdateContextPosition);
|
|
}
|
|
};
|
|
|
|
PageElementWriter.prototype.moveToNextPage = function (pageOrientation) {
|
|
|
|
var nextPage = this.writer.context.moveToNextPage(pageOrientation);
|
|
|
|
if (nextPage.newPageCreated) {
|
|
this.repeatables.forEach(function (rep) {
|
|
this.writer.addFragment(rep, true);
|
|
}, this);
|
|
} else {
|
|
this.repeatables.forEach(function (rep) {
|
|
this.writer.context.moveDown(rep.height);
|
|
}, this);
|
|
}
|
|
|
|
this.writer.tracker.emit('pageChanged', {
|
|
prevPage: nextPage.prevPage,
|
|
prevY: nextPage.prevY,
|
|
y: nextPage.y
|
|
});
|
|
};
|
|
|
|
PageElementWriter.prototype.beginUnbreakableBlock = function (width, height) {
|
|
if (this.transactionLevel++ === 0) {
|
|
this.originalX = this.writer.context.x;
|
|
this.writer.pushContext(width, height);
|
|
}
|
|
};
|
|
|
|
PageElementWriter.prototype.commitUnbreakableBlock = function (forcedX, forcedY) {
|
|
if (--this.transactionLevel === 0) {
|
|
var unbreakableContext = this.writer.context;
|
|
this.writer.popContext();
|
|
|
|
var nbPages = unbreakableContext.pages.length;
|
|
if (nbPages > 0) {
|
|
// no support for multi-page unbreakableBlocks
|
|
var fragment = unbreakableContext.pages[0];
|
|
fragment.xOffset = forcedX;
|
|
fragment.yOffset = forcedY;
|
|
|
|
//TODO: vectors can influence height in some situations
|
|
if (nbPages > 1) {
|
|
// on out-of-context blocs (headers, footers, background) height should be the whole DocumentContext height
|
|
if (forcedX !== undefined || forcedY !== undefined) {
|
|
fragment.height = unbreakableContext.getCurrentPage().pageSize.height - unbreakableContext.pageMargins.top - unbreakableContext.pageMargins.bottom;
|
|
} else {
|
|
fragment.height = this.writer.context.getCurrentPage().pageSize.height - this.writer.context.pageMargins.top - this.writer.context.pageMargins.bottom;
|
|
for (var i = 0, l = this.repeatables.length; i < l; i++) {
|
|
fragment.height -= this.repeatables[i].height;
|
|
}
|
|
}
|
|
} else {
|
|
fragment.height = unbreakableContext.y;
|
|
}
|
|
|
|
if (forcedX !== undefined || forcedY !== undefined) {
|
|
this.writer.addFragment(fragment, true, true, true);
|
|
} else {
|
|
this.addFragment(fragment);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
PageElementWriter.prototype.currentBlockToRepeatable = function () {
|
|
var unbreakableContext = this.writer.context;
|
|
var rep = {items: []};
|
|
|
|
unbreakableContext.pages[0].items.forEach(function (item) {
|
|
rep.items.push(item);
|
|
});
|
|
|
|
rep.xOffset = this.originalX;
|
|
|
|
//TODO: vectors can influence height in some situations
|
|
rep.height = unbreakableContext.y;
|
|
|
|
return rep;
|
|
};
|
|
|
|
PageElementWriter.prototype.pushToRepeatables = function (rep) {
|
|
this.repeatables.push(rep);
|
|
};
|
|
|
|
PageElementWriter.prototype.popFromRepeatables = function () {
|
|
this.repeatables.pop();
|
|
};
|
|
|
|
PageElementWriter.prototype.context = function () {
|
|
return this.writer.context;
|
|
};
|
|
|
|
module.exports = PageElementWriter;
|
|
|
|
|
|
/***/ },
|
|
/* 26 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
var Line = __webpack_require__(27);
|
|
var pack = __webpack_require__(22).pack;
|
|
var offsetVector = __webpack_require__(22).offsetVector;
|
|
var DocumentContext = __webpack_require__(24);
|
|
|
|
/**
|
|
* Creates an instance of ElementWriter - a line/vector writer, which adds
|
|
* elements to current page and sets their positions based on the context
|
|
*/
|
|
function ElementWriter(context, tracker) {
|
|
this.context = context;
|
|
this.contextStack = [];
|
|
this.tracker = tracker;
|
|
}
|
|
|
|
function addPageItem(page, item, index) {
|
|
if (index === null || index === undefined || index < 0 || index > page.items.length) {
|
|
page.items.push(item);
|
|
} else {
|
|
page.items.splice(index, 0, item);
|
|
}
|
|
}
|
|
|
|
ElementWriter.prototype.addLine = function (line, dontUpdateContextPosition, index) {
|
|
var height = line.getHeight();
|
|
var context = this.context;
|
|
var page = context.getCurrentPage(),
|
|
position = this.getCurrentPositionOnPage();
|
|
|
|
if (context.availableHeight < height || !page) {
|
|
return false;
|
|
}
|
|
|
|
line.x = context.x + (line.x || 0);
|
|
line.y = context.y + (line.y || 0);
|
|
|
|
this.alignLine(line);
|
|
|
|
addPageItem(page, {
|
|
type: 'line',
|
|
item: line
|
|
}, index);
|
|
this.tracker.emit('lineAdded', line);
|
|
|
|
if (!dontUpdateContextPosition) {
|
|
context.moveDown(height);
|
|
}
|
|
|
|
return position;
|
|
};
|
|
|
|
ElementWriter.prototype.alignLine = function (line) {
|
|
var width = this.context.availableWidth;
|
|
var lineWidth = line.getWidth();
|
|
|
|
var alignment = line.inlines && line.inlines.length > 0 && line.inlines[0].alignment;
|
|
|
|
var offset = 0;
|
|
switch (alignment) {
|
|
case 'right':
|
|
offset = width - lineWidth;
|
|
break;
|
|
case 'center':
|
|
offset = (width - lineWidth) / 2;
|
|
break;
|
|
}
|
|
|
|
if (offset) {
|
|
line.x = (line.x || 0) + offset;
|
|
}
|
|
|
|
if (alignment === 'justify' &&
|
|
!line.newLineForced &&
|
|
!line.lastLineInParagraph &&
|
|
line.inlines.length > 1) {
|
|
var additionalSpacing = (width - lineWidth) / (line.inlines.length - 1);
|
|
|
|
for (var i = 1, l = line.inlines.length; i < l; i++) {
|
|
offset = i * additionalSpacing;
|
|
|
|
line.inlines[i].x += offset;
|
|
}
|
|
}
|
|
};
|
|
|
|
ElementWriter.prototype.addImage = function (image, index) {
|
|
var context = this.context;
|
|
var page = context.getCurrentPage(),
|
|
position = this.getCurrentPositionOnPage();
|
|
|
|
if (context.availableHeight < image._height || !page) {
|
|
return false;
|
|
}
|
|
|
|
if (image._x === undefined) {
|
|
image._x = image.x || 0;
|
|
}
|
|
|
|
image.x = context.x + image._x;
|
|
image.y = context.y;
|
|
|
|
this.alignImage(image);
|
|
|
|
addPageItem(page, {
|
|
type: 'image',
|
|
item: image
|
|
}, index);
|
|
|
|
context.moveDown(image._height);
|
|
|
|
return position;
|
|
};
|
|
|
|
ElementWriter.prototype.addQr = function (qr, index) {
|
|
var context = this.context;
|
|
var page = context.getCurrentPage(),
|
|
position = this.getCurrentPositionOnPage();
|
|
|
|
if (context.availableHeight < qr._height || !page) {
|
|
return false;
|
|
}
|
|
|
|
if (qr._x === undefined) {
|
|
qr._x = qr.x || 0;
|
|
}
|
|
|
|
qr.x = context.x + qr._x;
|
|
qr.y = context.y;
|
|
|
|
this.alignImage(qr);
|
|
|
|
for (var i = 0, l = qr._canvas.length; i < l; i++) {
|
|
var vector = qr._canvas[i];
|
|
vector.x += qr.x;
|
|
vector.y += qr.y;
|
|
this.addVector(vector, true, true, index);
|
|
}
|
|
|
|
context.moveDown(qr._height);
|
|
|
|
return position;
|
|
};
|
|
|
|
ElementWriter.prototype.alignImage = function (image) {
|
|
var width = this.context.availableWidth;
|
|
var imageWidth = image._minWidth;
|
|
var offset = 0;
|
|
switch (image._alignment) {
|
|
case 'right':
|
|
offset = width - imageWidth;
|
|
break;
|
|
case 'center':
|
|
offset = (width - imageWidth) / 2;
|
|
break;
|
|
}
|
|
|
|
if (offset) {
|
|
image.x = (image.x || 0) + offset;
|
|
}
|
|
};
|
|
|
|
ElementWriter.prototype.addVector = function (vector, ignoreContextX, ignoreContextY, index) {
|
|
var context = this.context;
|
|
var page = context.getCurrentPage(),
|
|
position = this.getCurrentPositionOnPage();
|
|
|
|
if (page) {
|
|
offsetVector(vector, ignoreContextX ? 0 : context.x, ignoreContextY ? 0 : context.y);
|
|
addPageItem(page, {
|
|
type: 'vector',
|
|
item: vector
|
|
}, index);
|
|
return position;
|
|
}
|
|
};
|
|
|
|
function cloneLine(line) {
|
|
var result = new Line(line.maxWidth);
|
|
|
|
for (var key in line) {
|
|
if (line.hasOwnProperty(key)) {
|
|
result[key] = line[key];
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
ElementWriter.prototype.addFragment = function (block, useBlockXOffset, useBlockYOffset, dontUpdateContextPosition) {
|
|
var ctx = this.context;
|
|
var page = ctx.getCurrentPage();
|
|
|
|
if (!useBlockXOffset && block.height > ctx.availableHeight) {
|
|
return false;
|
|
}
|
|
|
|
block.items.forEach(function (item) {
|
|
switch (item.type) {
|
|
case 'line':
|
|
var l = cloneLine(item.item);
|
|
|
|
l.x = (l.x || 0) + (useBlockXOffset ? (block.xOffset || 0) : ctx.x);
|
|
l.y = (l.y || 0) + (useBlockYOffset ? (block.yOffset || 0) : ctx.y);
|
|
|
|
page.items.push({
|
|
type: 'line',
|
|
item: l
|
|
});
|
|
break;
|
|
|
|
case 'vector':
|
|
var v = pack(item.item);
|
|
|
|
offsetVector(v, useBlockXOffset ? (block.xOffset || 0) : ctx.x, useBlockYOffset ? (block.yOffset || 0) : ctx.y);
|
|
page.items.push({
|
|
type: 'vector',
|
|
item: v
|
|
});
|
|
break;
|
|
|
|
case 'image':
|
|
var img = pack(item.item);
|
|
|
|
img.x = (img.x || 0) + (useBlockXOffset ? (block.xOffset || 0) : ctx.x);
|
|
img.y = (img.y || 0) + (useBlockYOffset ? (block.yOffset || 0) : ctx.y);
|
|
|
|
page.items.push({
|
|
type: 'image',
|
|
item: img
|
|
});
|
|
break;
|
|
}
|
|
});
|
|
|
|
if (!dontUpdateContextPosition) {
|
|
ctx.moveDown(block.height);
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
/**
|
|
* Pushes the provided context onto the stack or creates a new one
|
|
*
|
|
* pushContext(context) - pushes the provided context and makes it current
|
|
* pushContext(width, height) - creates and pushes a new context with the specified width and height
|
|
* pushContext() - creates a new context for unbreakable blocks (with current availableWidth and full-page-height)
|
|
*/
|
|
ElementWriter.prototype.pushContext = function (contextOrWidth, height) {
|
|
if (contextOrWidth === undefined) {
|
|
height = this.context.getCurrentPage().height - this.context.pageMargins.top - this.context.pageMargins.bottom;
|
|
contextOrWidth = this.context.availableWidth;
|
|
}
|
|
|
|
if (typeof contextOrWidth === 'number' || contextOrWidth instanceof Number) {
|
|
contextOrWidth = new DocumentContext({width: contextOrWidth, height: height}, {left: 0, right: 0, top: 0, bottom: 0});
|
|
}
|
|
|
|
this.contextStack.push(this.context);
|
|
this.context = contextOrWidth;
|
|
};
|
|
|
|
ElementWriter.prototype.popContext = function () {
|
|
this.context = this.contextStack.pop();
|
|
};
|
|
|
|
ElementWriter.prototype.getCurrentPositionOnPage = function () {
|
|
return (this.contextStack[0] || this.context).getCurrentPosition();
|
|
};
|
|
|
|
|
|
module.exports = ElementWriter;
|
|
|
|
|
|
/***/ },
|
|
/* 27 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
/**
|
|
* Creates an instance of Line
|
|
*
|
|
* @constructor
|
|
* @this {Line}
|
|
* @param {Number} Maximum width this line can have
|
|
*/
|
|
function Line(maxWidth) {
|
|
this.maxWidth = maxWidth;
|
|
this.leadingCut = 0;
|
|
this.trailingCut = 0;
|
|
this.inlineWidths = 0;
|
|
this.inlines = [];
|
|
}
|
|
|
|
Line.prototype.getAscenderHeight = function () {
|
|
var y = 0;
|
|
|
|
this.inlines.forEach(function (inline) {
|
|
y = Math.max(y, inline.font.ascender / 1000 * inline.fontSize);
|
|
});
|
|
return y;
|
|
};
|
|
|
|
Line.prototype.hasEnoughSpaceForInline = function (inline) {
|
|
if (this.inlines.length === 0) {
|
|
return true;
|
|
}
|
|
if (this.newLineForced) {
|
|
return false;
|
|
}
|
|
|
|
return this.inlineWidths + inline.width - this.leadingCut - (inline.trailingCut || 0) <= this.maxWidth;
|
|
};
|
|
|
|
Line.prototype.addInline = function (inline) {
|
|
if (this.inlines.length === 0) {
|
|
this.leadingCut = inline.leadingCut || 0;
|
|
}
|
|
this.trailingCut = inline.trailingCut || 0;
|
|
|
|
inline.x = this.inlineWidths - this.leadingCut;
|
|
|
|
this.inlines.push(inline);
|
|
this.inlineWidths += inline.width;
|
|
|
|
if (inline.lineEnd) {
|
|
this.newLineForced = true;
|
|
}
|
|
};
|
|
|
|
Line.prototype.getWidth = function () {
|
|
return this.inlineWidths - this.leadingCut - this.trailingCut;
|
|
};
|
|
|
|
/**
|
|
* Returns line height
|
|
* @return {Number}
|
|
*/
|
|
Line.prototype.getHeight = function () {
|
|
var max = 0;
|
|
|
|
this.inlines.forEach(function (item) {
|
|
max = Math.max(max, item.height || 0);
|
|
});
|
|
|
|
return max;
|
|
};
|
|
|
|
module.exports = Line;
|
|
|
|
|
|
/***/ },
|
|
/* 28 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
var ColumnCalculator = __webpack_require__(21);
|
|
|
|
function TableProcessor(tableNode) {
|
|
this.tableNode = tableNode;
|
|
}
|
|
|
|
TableProcessor.prototype.beginTable = function (writer) {
|
|
var tableNode;
|
|
var availableWidth;
|
|
var self = this;
|
|
|
|
tableNode = this.tableNode;
|
|
this.offsets = tableNode._offsets;
|
|
this.layout = tableNode._layout;
|
|
|
|
availableWidth = writer.context().availableWidth - this.offsets.total;
|
|
ColumnCalculator.buildColumnWidths(tableNode.table.widths, availableWidth);
|
|
|
|
this.tableWidth = tableNode._offsets.total + getTableInnerContentWidth();
|
|
this.rowSpanData = prepareRowSpanData();
|
|
this.cleanUpRepeatables = false;
|
|
|
|
this.headerRows = tableNode.table.headerRows || 0;
|
|
this.rowsWithoutPageBreak = this.headerRows + (tableNode.table.keepWithHeaderRows || 0);
|
|
this.dontBreakRows = tableNode.table.dontBreakRows || false;
|
|
|
|
if (this.rowsWithoutPageBreak) {
|
|
writer.beginUnbreakableBlock();
|
|
}
|
|
|
|
// update the border properties of all cells before drawing any lines
|
|
prepareCellBorders(this.tableNode.table.body);
|
|
|
|
this.drawHorizontalLine(0, writer);
|
|
|
|
function getTableInnerContentWidth() {
|
|
var width = 0;
|
|
|
|
tableNode.table.widths.forEach(function (w) {
|
|
width += w._calcWidth;
|
|
});
|
|
|
|
return width;
|
|
}
|
|
|
|
function prepareRowSpanData() {
|
|
var rsd = [];
|
|
var x = 0;
|
|
var lastWidth = 0;
|
|
|
|
rsd.push({left: 0, rowSpan: 0});
|
|
|
|
for (var i = 0, l = self.tableNode.table.body[0].length; i < l; i++) {
|
|
var paddings = self.layout.paddingLeft(i, self.tableNode) + self.layout.paddingRight(i, self.tableNode);
|
|
var lBorder = self.layout.vLineWidth(i, self.tableNode);
|
|
lastWidth = paddings + lBorder + self.tableNode.table.widths[i]._calcWidth;
|
|
rsd[rsd.length - 1].width = lastWidth;
|
|
x += lastWidth;
|
|
rsd.push({left: x, rowSpan: 0, width: 0});
|
|
}
|
|
|
|
return rsd;
|
|
}
|
|
|
|
// Iterate through all cells. If the current cell is the start of a
|
|
// rowSpan/colSpan, update the border property of the cells on its
|
|
// bottom/right accordingly. This is needed since each iteration of the
|
|
// line-drawing loops draws lines for a single cell, not for an entire
|
|
// rowSpan/colSpan.
|
|
function prepareCellBorders(body) {
|
|
for (var rowIndex = 0; rowIndex < body.length; rowIndex++) {
|
|
var row = body[rowIndex];
|
|
|
|
for (var colIndex = 0; colIndex < row.length; colIndex++) {
|
|
var cell = row[colIndex];
|
|
|
|
if (cell.border) {
|
|
var rowSpan = cell.rowSpan || 1;
|
|
var colSpan = cell.colSpan || 1;
|
|
|
|
for (var rowOffset = 0; rowOffset < rowSpan; rowOffset++) {
|
|
// set left border
|
|
if (cell.border[0] !== undefined && rowOffset > 0) {
|
|
setBorder(rowIndex + rowOffset, colIndex, 0, cell.border[0]);
|
|
}
|
|
|
|
// set right border
|
|
if (cell.border[2] !== undefined) {
|
|
setBorder(rowIndex + rowOffset, colIndex + colSpan - 1, 2, cell.border[2]);
|
|
}
|
|
}
|
|
|
|
for (var colOffset = 0; colOffset < colSpan; colOffset++) {
|
|
// set top border
|
|
if (cell.border[1] !== undefined && colOffset > 0) {
|
|
setBorder(rowIndex, colIndex + colOffset, 1, cell.border[1]);
|
|
}
|
|
|
|
// set bottom border
|
|
if (cell.border[3] !== undefined) {
|
|
setBorder(rowIndex + rowSpan - 1, colIndex + colOffset, 3, cell.border[3]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// helper function to set the border for a given cell
|
|
function setBorder(rowIndex, colIndex, borderIndex, borderValue) {
|
|
var cell = body[rowIndex][colIndex];
|
|
cell.border = cell.border || {};
|
|
cell.border[borderIndex] = borderValue;
|
|
}
|
|
}
|
|
};
|
|
|
|
TableProcessor.prototype.onRowBreak = function (rowIndex, writer) {
|
|
var self = this;
|
|
return function () {
|
|
//console.log('moving by : ', topLineWidth, rowPaddingTop);
|
|
var offset = self.rowPaddingTop + (!self.headerRows ? self.topLineWidth : 0);
|
|
writer.context().moveDown(offset);
|
|
};
|
|
|
|
};
|
|
|
|
TableProcessor.prototype.beginRow = function (rowIndex, writer) {
|
|
this.topLineWidth = this.layout.hLineWidth(rowIndex, this.tableNode);
|
|
this.rowPaddingTop = this.layout.paddingTop(rowIndex, this.tableNode);
|
|
this.bottomLineWidth = this.layout.hLineWidth(rowIndex + 1, this.tableNode);
|
|
this.rowPaddingBottom = this.layout.paddingBottom(rowIndex, this.tableNode);
|
|
|
|
this.rowCallback = this.onRowBreak(rowIndex, writer);
|
|
writer.tracker.startTracking('pageChanged', this.rowCallback);
|
|
if (this.dontBreakRows) {
|
|
writer.beginUnbreakableBlock();
|
|
}
|
|
this.rowTopY = writer.context().y;
|
|
this.reservedAtBottom = this.bottomLineWidth + this.rowPaddingBottom;
|
|
|
|
writer.context().availableHeight -= this.reservedAtBottom;
|
|
|
|
writer.context().moveDown(this.rowPaddingTop);
|
|
};
|
|
|
|
TableProcessor.prototype.drawHorizontalLine = function (lineIndex, writer, overrideY) {
|
|
var lineWidth = this.layout.hLineWidth(lineIndex, this.tableNode);
|
|
if (lineWidth) {
|
|
var offset = lineWidth / 2;
|
|
var currentLine = null;
|
|
var body = this.tableNode.table.body;
|
|
|
|
for (var i = 0, l = this.rowSpanData.length; i < l; i++) {
|
|
var data = this.rowSpanData[i];
|
|
var shouldDrawLine = !data.rowSpan;
|
|
|
|
// draw only if the current cell requires a top border or the cell in the
|
|
// row above requires a bottom border
|
|
if (shouldDrawLine && i < l - 1) {
|
|
var topBorder = false, bottomBorder = false;
|
|
|
|
// the current cell
|
|
if (lineIndex < body.length) {
|
|
var cell = body[lineIndex][i];
|
|
topBorder = cell.border ? cell.border[1] : this.layout.defaultBorder;
|
|
}
|
|
|
|
// the cell in the row above
|
|
if (lineIndex > 0) {
|
|
var cellAbove = body[lineIndex - 1][i];
|
|
bottomBorder = cellAbove.border ? cellAbove.border[3] : this.layout.defaultBorder;
|
|
}
|
|
|
|
shouldDrawLine = topBorder || bottomBorder;
|
|
}
|
|
|
|
if (!currentLine && shouldDrawLine) {
|
|
currentLine = {left: data.left, width: 0};
|
|
}
|
|
|
|
if (shouldDrawLine) {
|
|
currentLine.width += (data.width || 0);
|
|
}
|
|
|
|
var y = (overrideY || 0) + offset;
|
|
|
|
if (!shouldDrawLine || i === l - 1) {
|
|
if (currentLine && currentLine.width) {
|
|
writer.addVector({
|
|
type: 'line',
|
|
x1: currentLine.left,
|
|
x2: currentLine.left + currentLine.width,
|
|
y1: y,
|
|
y2: y,
|
|
lineWidth: lineWidth,
|
|
lineColor: typeof this.layout.hLineColor === 'function' ? this.layout.hLineColor(lineIndex, this.tableNode) : this.layout.hLineColor
|
|
}, false, overrideY);
|
|
currentLine = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
writer.context().moveDown(lineWidth);
|
|
}
|
|
};
|
|
|
|
TableProcessor.prototype.drawVerticalLine = function (x, y0, y1, vLineIndex, writer) {
|
|
var width = this.layout.vLineWidth(vLineIndex, this.tableNode);
|
|
if (width === 0) {
|
|
return;
|
|
}
|
|
writer.addVector({
|
|
type: 'line',
|
|
x1: x + width / 2,
|
|
x2: x + width / 2,
|
|
y1: y0,
|
|
y2: y1,
|
|
lineWidth: width,
|
|
lineColor: typeof this.layout.vLineColor === 'function' ? this.layout.vLineColor(vLineIndex, this.tableNode) : this.layout.vLineColor
|
|
}, false, true);
|
|
};
|
|
|
|
TableProcessor.prototype.endTable = function (writer) {
|
|
if (this.cleanUpRepeatables) {
|
|
writer.popFromRepeatables();
|
|
}
|
|
};
|
|
|
|
TableProcessor.prototype.endRow = function (rowIndex, writer, pageBreaks) {
|
|
var l, i;
|
|
var self = this;
|
|
writer.tracker.stopTracking('pageChanged', this.rowCallback);
|
|
writer.context().moveDown(this.layout.paddingBottom(rowIndex, this.tableNode));
|
|
writer.context().availableHeight += this.reservedAtBottom;
|
|
|
|
var endingPage = writer.context().page;
|
|
var endingY = writer.context().y;
|
|
|
|
var xs = getLineXs();
|
|
|
|
var ys = [];
|
|
|
|
var hasBreaks = pageBreaks && pageBreaks.length > 0;
|
|
var body = this.tableNode.table.body;
|
|
|
|
ys.push({
|
|
y0: this.rowTopY,
|
|
page: hasBreaks ? pageBreaks[0].prevPage : endingPage
|
|
});
|
|
|
|
if (hasBreaks) {
|
|
for (i = 0, l = pageBreaks.length; i < l; i++) {
|
|
var pageBreak = pageBreaks[i];
|
|
ys[ys.length - 1].y1 = pageBreak.prevY;
|
|
|
|
ys.push({y0: pageBreak.y, page: pageBreak.prevPage + 1});
|
|
}
|
|
}
|
|
|
|
ys[ys.length - 1].y1 = endingY;
|
|
|
|
var skipOrphanePadding = (ys[0].y1 - ys[0].y0 === this.rowPaddingTop);
|
|
for (var yi = (skipOrphanePadding ? 1 : 0), yl = ys.length; yi < yl; yi++) {
|
|
var willBreak = yi < ys.length - 1;
|
|
var rowBreakWithoutHeader = (yi > 0 && !this.headerRows);
|
|
var hzLineOffset = rowBreakWithoutHeader ? 0 : this.topLineWidth;
|
|
var y1 = ys[yi].y0;
|
|
var y2 = ys[yi].y1;
|
|
|
|
if (willBreak) {
|
|
y2 = y2 + this.rowPaddingBottom;
|
|
}
|
|
|
|
if (writer.context().page != ys[yi].page) {
|
|
writer.context().page = ys[yi].page;
|
|
|
|
//TODO: buggy, availableHeight should be updated on every pageChanged event
|
|
// TableProcessor should be pageChanged listener, instead of processRow
|
|
this.reservedAtBottom = 0;
|
|
}
|
|
|
|
for (i = 0, l = xs.length; i < l; i++) {
|
|
var leftBorder = false, rightBorder = false;
|
|
var colIndex = xs[i].index;
|
|
|
|
// the current cell
|
|
if (colIndex < body[rowIndex].length) {
|
|
var cell = body[rowIndex][colIndex];
|
|
leftBorder = cell.border ? cell.border[0] : this.layout.defaultBorder;
|
|
}
|
|
|
|
// the cell from before column
|
|
if (colIndex > 0) {
|
|
var cell = body[rowIndex][colIndex - 1];
|
|
rightBorder = cell.border ? cell.border[2] : this.layout.defaultBorder;
|
|
}
|
|
|
|
if (leftBorder || rightBorder) {
|
|
this.drawVerticalLine(xs[i].x, y1 - hzLineOffset, y2 + this.bottomLineWidth, xs[i].index, writer);
|
|
}
|
|
|
|
if (i < l - 1) {
|
|
var fillColor = body[rowIndex][colIndex].fillColor;
|
|
if (fillColor) {
|
|
var wBorder = (leftBorder || rightBorder) ? this.layout.vLineWidth(colIndex, this.tableNode) : 0;
|
|
var xf = xs[i].x + wBorder;
|
|
var yf = this.dontBreakRows ? y1 : y1 - hzLineOffset;
|
|
writer.addVector({
|
|
type: 'rect',
|
|
x: xf,
|
|
y: yf,
|
|
w: xs[i + 1].x - xf,
|
|
h: y2 + this.bottomLineWidth - yf,
|
|
lineWidth: 0,
|
|
color: fillColor
|
|
}, false, true, 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (willBreak && this.layout.hLineWhenBroken !== false) {
|
|
this.drawHorizontalLine(rowIndex + 1, writer, y2);
|
|
}
|
|
if (rowBreakWithoutHeader && this.layout.hLineWhenBroken !== false) {
|
|
this.drawHorizontalLine(rowIndex, writer, y1);
|
|
}
|
|
}
|
|
|
|
writer.context().page = endingPage;
|
|
writer.context().y = endingY;
|
|
|
|
var row = this.tableNode.table.body[rowIndex];
|
|
for (i = 0, l = row.length; i < l; i++) {
|
|
if (row[i].rowSpan) {
|
|
this.rowSpanData[i].rowSpan = row[i].rowSpan;
|
|
|
|
// fix colSpans
|
|
if (row[i].colSpan && row[i].colSpan > 1) {
|
|
for (var j = 1; j < row[i].rowSpan; j++) {
|
|
this.tableNode.table.body[rowIndex + j][i]._colSpan = row[i].colSpan;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (this.rowSpanData[i].rowSpan > 0) {
|
|
this.rowSpanData[i].rowSpan--;
|
|
}
|
|
}
|
|
|
|
this.drawHorizontalLine(rowIndex + 1, writer);
|
|
|
|
if (this.headerRows && rowIndex === this.headerRows - 1) {
|
|
this.headerRepeatable = writer.currentBlockToRepeatable();
|
|
}
|
|
|
|
if (this.dontBreakRows) {
|
|
writer.tracker.auto('pageChanged',
|
|
function () {
|
|
if (!self.headerRows && self.layout.hLineWhenBroken !== false) {
|
|
self.drawHorizontalLine(rowIndex, writer);
|
|
}
|
|
},
|
|
function () {
|
|
writer.commitUnbreakableBlock();
|
|
}
|
|
);
|
|
}
|
|
|
|
if (this.headerRepeatable && (rowIndex === (this.rowsWithoutPageBreak - 1) || rowIndex === this.tableNode.table.body.length - 1)) {
|
|
writer.commitUnbreakableBlock();
|
|
writer.pushToRepeatables(this.headerRepeatable);
|
|
this.cleanUpRepeatables = true;
|
|
this.headerRepeatable = null;
|
|
}
|
|
|
|
function getLineXs() {
|
|
var result = [];
|
|
var cols = 0;
|
|
|
|
for (var i = 0, l = self.tableNode.table.body[rowIndex].length; i < l; i++) {
|
|
if (!cols) {
|
|
result.push({x: self.rowSpanData[i].left, index: i});
|
|
|
|
var item = self.tableNode.table.body[rowIndex][i];
|
|
cols = (item._colSpan || item.colSpan || 0);
|
|
}
|
|
if (cols > 0) {
|
|
cols--;
|
|
}
|
|
}
|
|
|
|
result.push({x: self.rowSpanData[self.rowSpanData.length - 1].left, index: self.rowSpanData.length - 1});
|
|
|
|
return result;
|
|
}
|
|
};
|
|
|
|
module.exports = TableProcessor;
|
|
|
|
|
|
/***/ },
|
|
/* 29 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Generated by CoffeeScript 1.10.0
|
|
|
|
/*
|
|
PDFDocument - represents an entire PDF document
|
|
By Devon Govett
|
|
*/
|
|
|
|
(function() {
|
|
var PDFDocument, PDFObject, PDFPage, PDFReference, fs, stream,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
stream = __webpack_require__(30);
|
|
|
|
fs = __webpack_require__(53);
|
|
|
|
PDFObject = __webpack_require__(54);
|
|
|
|
PDFReference = __webpack_require__(55);
|
|
|
|
PDFPage = __webpack_require__(73);
|
|
|
|
PDFDocument = (function(superClass) {
|
|
var mixin;
|
|
|
|
extend(PDFDocument, superClass);
|
|
|
|
function PDFDocument(options1) {
|
|
var key, ref1, ref2, val;
|
|
this.options = options1 != null ? options1 : {};
|
|
PDFDocument.__super__.constructor.apply(this, arguments);
|
|
this.version = 1.3;
|
|
this.compress = (ref1 = this.options.compress) != null ? ref1 : true;
|
|
this._pageBuffer = [];
|
|
this._pageBufferStart = 0;
|
|
this._offsets = [];
|
|
this._waiting = 0;
|
|
this._ended = false;
|
|
this._offset = 0;
|
|
this._root = this.ref({
|
|
Type: 'Catalog',
|
|
Pages: this.ref({
|
|
Type: 'Pages',
|
|
Count: 0,
|
|
Kids: []
|
|
})
|
|
});
|
|
this.page = null;
|
|
this.initColor();
|
|
this.initVector();
|
|
this.initFonts();
|
|
this.initText();
|
|
this.initImages();
|
|
this.info = {
|
|
Producer: 'PDFKit',
|
|
Creator: 'PDFKit',
|
|
CreationDate: new Date()
|
|
};
|
|
if (this.options.info) {
|
|
ref2 = this.options.info;
|
|
for (key in ref2) {
|
|
val = ref2[key];
|
|
this.info[key] = val;
|
|
}
|
|
}
|
|
this._write("%PDF-" + this.version);
|
|
this._write("%\xFF\xFF\xFF\xFF");
|
|
if (this.options.autoFirstPage !== false) {
|
|
this.addPage();
|
|
}
|
|
}
|
|
|
|
mixin = function(methods) {
|
|
var method, name, results;
|
|
results = [];
|
|
for (name in methods) {
|
|
method = methods[name];
|
|
results.push(PDFDocument.prototype[name] = method);
|
|
}
|
|
return results;
|
|
};
|
|
|
|
mixin(__webpack_require__(74));
|
|
|
|
mixin(__webpack_require__(76));
|
|
|
|
mixin(__webpack_require__(78));
|
|
|
|
mixin(__webpack_require__(286));
|
|
|
|
mixin(__webpack_require__(288));
|
|
|
|
mixin(__webpack_require__(294));
|
|
|
|
PDFDocument.prototype.addPage = function(options) {
|
|
var pages;
|
|
if (options == null) {
|
|
options = this.options;
|
|
}
|
|
if (!this.options.bufferPages) {
|
|
this.flushPages();
|
|
}
|
|
this.page = new PDFPage(this, options);
|
|
this._pageBuffer.push(this.page);
|
|
pages = this._root.data.Pages.data;
|
|
pages.Kids.push(this.page.dictionary);
|
|
pages.Count++;
|
|
this.x = this.page.margins.left;
|
|
this.y = this.page.margins.top;
|
|
this._ctm = [1, 0, 0, 1, 0, 0];
|
|
this.transform(1, 0, 0, -1, 0, this.page.height);
|
|
this.emit('pageAdded');
|
|
return this;
|
|
};
|
|
|
|
PDFDocument.prototype.bufferedPageRange = function() {
|
|
return {
|
|
start: this._pageBufferStart,
|
|
count: this._pageBuffer.length
|
|
};
|
|
};
|
|
|
|
PDFDocument.prototype.switchToPage = function(n) {
|
|
var page;
|
|
if (!(page = this._pageBuffer[n - this._pageBufferStart])) {
|
|
throw new Error("switchToPage(" + n + ") out of bounds, current buffer covers pages " + this._pageBufferStart + " to " + (this._pageBufferStart + this._pageBuffer.length - 1));
|
|
}
|
|
return this.page = page;
|
|
};
|
|
|
|
PDFDocument.prototype.flushPages = function() {
|
|
var i, len, page, pages;
|
|
pages = this._pageBuffer;
|
|
this._pageBuffer = [];
|
|
this._pageBufferStart += pages.length;
|
|
for (i = 0, len = pages.length; i < len; i++) {
|
|
page = pages[i];
|
|
page.end();
|
|
}
|
|
};
|
|
|
|
PDFDocument.prototype.ref = function(data) {
|
|
var ref;
|
|
ref = new PDFReference(this, this._offsets.length + 1, data);
|
|
this._offsets.push(null);
|
|
this._waiting++;
|
|
return ref;
|
|
};
|
|
|
|
PDFDocument.prototype._read = function() {};
|
|
|
|
PDFDocument.prototype._write = function(data) {
|
|
if (!Buffer.isBuffer(data)) {
|
|
data = new Buffer(data + '\n', 'binary');
|
|
}
|
|
this.push(data);
|
|
return this._offset += data.length;
|
|
};
|
|
|
|
PDFDocument.prototype.addContent = function(data) {
|
|
this.page.write(data);
|
|
return this;
|
|
};
|
|
|
|
PDFDocument.prototype._refEnd = function(ref) {
|
|
this._offsets[ref.id - 1] = ref.offset;
|
|
if (--this._waiting === 0 && this._ended) {
|
|
this._finalize();
|
|
return this._ended = false;
|
|
}
|
|
};
|
|
|
|
PDFDocument.prototype.write = function(filename, fn) {
|
|
var err;
|
|
err = new Error('PDFDocument#write is deprecated, and will be removed in a future version of PDFKit. Please pipe the document into a Node stream.');
|
|
console.warn(err.stack);
|
|
this.pipe(fs.createWriteStream(filename));
|
|
this.end();
|
|
return this.once('end', fn);
|
|
};
|
|
|
|
PDFDocument.prototype.output = function(fn) {
|
|
throw new Error('PDFDocument#output is deprecated, and has been removed from PDFKit. Please pipe the document into a Node stream.');
|
|
};
|
|
|
|
PDFDocument.prototype.end = function() {
|
|
var font, key, name, ref1, ref2, val;
|
|
this.flushPages();
|
|
this._info = this.ref();
|
|
ref1 = this.info;
|
|
for (key in ref1) {
|
|
val = ref1[key];
|
|
if (typeof val === 'string') {
|
|
val = new String(val);
|
|
}
|
|
this._info.data[key] = val;
|
|
}
|
|
this._info.end();
|
|
ref2 = this._fontFamilies;
|
|
for (name in ref2) {
|
|
font = ref2[name];
|
|
font.finalize();
|
|
}
|
|
this._root.end();
|
|
this._root.data.Pages.end();
|
|
if (this._waiting === 0) {
|
|
return this._finalize();
|
|
} else {
|
|
return this._ended = true;
|
|
}
|
|
};
|
|
|
|
PDFDocument.prototype._finalize = function(fn) {
|
|
var i, len, offset, ref1, xRefOffset;
|
|
xRefOffset = this._offset;
|
|
this._write("xref");
|
|
this._write("0 " + (this._offsets.length + 1));
|
|
this._write("0000000000 65535 f ");
|
|
ref1 = this._offsets;
|
|
for (i = 0, len = ref1.length; i < len; i++) {
|
|
offset = ref1[i];
|
|
offset = ('0000000000' + offset).slice(-10);
|
|
this._write(offset + ' 00000 n ');
|
|
}
|
|
this._write('trailer');
|
|
this._write(PDFObject.convert({
|
|
Size: this._offsets.length + 1,
|
|
Root: this._root,
|
|
Info: this._info
|
|
}));
|
|
this._write('startxref');
|
|
this._write("" + xRefOffset);
|
|
this._write('%%EOF');
|
|
return this.push(null);
|
|
};
|
|
|
|
PDFDocument.prototype.toString = function() {
|
|
return "[object PDFDocument]";
|
|
};
|
|
|
|
return PDFDocument;
|
|
|
|
})(stream.Readable);
|
|
|
|
module.exports = PDFDocument;
|
|
|
|
}).call(this);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 30 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
module.exports = Stream;
|
|
|
|
var EE = __webpack_require__(31).EventEmitter;
|
|
var inherits = __webpack_require__(32);
|
|
|
|
inherits(Stream, EE);
|
|
Stream.Readable = __webpack_require__(33);
|
|
Stream.Writable = __webpack_require__(49);
|
|
Stream.Duplex = __webpack_require__(50);
|
|
Stream.Transform = __webpack_require__(51);
|
|
Stream.PassThrough = __webpack_require__(52);
|
|
|
|
// Backwards-compat with node 0.4.x
|
|
Stream.Stream = Stream;
|
|
|
|
|
|
|
|
// old-style streams. Note that the pipe method (the only relevant
|
|
// part of this class) is overridden in the Readable class.
|
|
|
|
function Stream() {
|
|
EE.call(this);
|
|
}
|
|
|
|
Stream.prototype.pipe = function(dest, options) {
|
|
var source = this;
|
|
|
|
function ondata(chunk) {
|
|
if (dest.writable) {
|
|
if (false === dest.write(chunk) && source.pause) {
|
|
source.pause();
|
|
}
|
|
}
|
|
}
|
|
|
|
source.on('data', ondata);
|
|
|
|
function ondrain() {
|
|
if (source.readable && source.resume) {
|
|
source.resume();
|
|
}
|
|
}
|
|
|
|
dest.on('drain', ondrain);
|
|
|
|
// If the 'end' option is not supplied, dest.end() will be called when
|
|
// source gets the 'end' or 'close' events. Only dest.end() once.
|
|
if (!dest._isStdio && (!options || options.end !== false)) {
|
|
source.on('end', onend);
|
|
source.on('close', onclose);
|
|
}
|
|
|
|
var didOnEnd = false;
|
|
function onend() {
|
|
if (didOnEnd) return;
|
|
didOnEnd = true;
|
|
|
|
dest.end();
|
|
}
|
|
|
|
|
|
function onclose() {
|
|
if (didOnEnd) return;
|
|
didOnEnd = true;
|
|
|
|
if (typeof dest.destroy === 'function') dest.destroy();
|
|
}
|
|
|
|
// don't leave dangling pipes when there are errors.
|
|
function onerror(er) {
|
|
cleanup();
|
|
if (EE.listenerCount(this, 'error') === 0) {
|
|
throw er; // Unhandled stream error in pipe.
|
|
}
|
|
}
|
|
|
|
source.on('error', onerror);
|
|
dest.on('error', onerror);
|
|
|
|
// remove all the event listeners that were added.
|
|
function cleanup() {
|
|
source.removeListener('data', ondata);
|
|
dest.removeListener('drain', ondrain);
|
|
|
|
source.removeListener('end', onend);
|
|
source.removeListener('close', onclose);
|
|
|
|
source.removeListener('error', onerror);
|
|
dest.removeListener('error', onerror);
|
|
|
|
source.removeListener('end', cleanup);
|
|
source.removeListener('close', cleanup);
|
|
|
|
dest.removeListener('close', cleanup);
|
|
}
|
|
|
|
source.on('end', cleanup);
|
|
source.on('close', cleanup);
|
|
|
|
dest.on('close', cleanup);
|
|
|
|
dest.emit('pipe', source);
|
|
|
|
// Allow for unix-like usage: A.pipe(B).pipe(C)
|
|
return dest;
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 31 */
|
|
/***/ function(module, exports) {
|
|
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
function EventEmitter() {
|
|
this._events = this._events || {};
|
|
this._maxListeners = this._maxListeners || undefined;
|
|
}
|
|
module.exports = EventEmitter;
|
|
|
|
// Backwards-compat with node 0.10.x
|
|
EventEmitter.EventEmitter = EventEmitter;
|
|
|
|
EventEmitter.prototype._events = undefined;
|
|
EventEmitter.prototype._maxListeners = undefined;
|
|
|
|
// By default EventEmitters will print a warning if more than 10 listeners are
|
|
// added to it. This is a useful default which helps finding memory leaks.
|
|
EventEmitter.defaultMaxListeners = 10;
|
|
|
|
// Obviously not all Emitters should be limited to 10. This function allows
|
|
// that to be increased. Set to zero for unlimited.
|
|
EventEmitter.prototype.setMaxListeners = function(n) {
|
|
if (!isNumber(n) || n < 0 || isNaN(n))
|
|
throw TypeError('n must be a positive number');
|
|
this._maxListeners = n;
|
|
return this;
|
|
};
|
|
|
|
EventEmitter.prototype.emit = function(type) {
|
|
var er, handler, len, args, i, listeners;
|
|
|
|
if (!this._events)
|
|
this._events = {};
|
|
|
|
// If there is no 'error' event listener then throw.
|
|
if (type === 'error') {
|
|
if (!this._events.error ||
|
|
(isObject(this._events.error) && !this._events.error.length)) {
|
|
er = arguments[1];
|
|
if (er instanceof Error) {
|
|
throw er; // Unhandled 'error' event
|
|
} else {
|
|
// At least give some kind of context to the user
|
|
var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
|
|
err.context = er;
|
|
throw err;
|
|
}
|
|
}
|
|
}
|
|
|
|
handler = this._events[type];
|
|
|
|
if (isUndefined(handler))
|
|
return false;
|
|
|
|
if (isFunction(handler)) {
|
|
switch (arguments.length) {
|
|
// fast cases
|
|
case 1:
|
|
handler.call(this);
|
|
break;
|
|
case 2:
|
|
handler.call(this, arguments[1]);
|
|
break;
|
|
case 3:
|
|
handler.call(this, arguments[1], arguments[2]);
|
|
break;
|
|
// slower
|
|
default:
|
|
args = Array.prototype.slice.call(arguments, 1);
|
|
handler.apply(this, args);
|
|
}
|
|
} else if (isObject(handler)) {
|
|
args = Array.prototype.slice.call(arguments, 1);
|
|
listeners = handler.slice();
|
|
len = listeners.length;
|
|
for (i = 0; i < len; i++)
|
|
listeners[i].apply(this, args);
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
EventEmitter.prototype.addListener = function(type, listener) {
|
|
var m;
|
|
|
|
if (!isFunction(listener))
|
|
throw TypeError('listener must be a function');
|
|
|
|
if (!this._events)
|
|
this._events = {};
|
|
|
|
// To avoid recursion in the case that type === "newListener"! Before
|
|
// adding it to the listeners, first emit "newListener".
|
|
if (this._events.newListener)
|
|
this.emit('newListener', type,
|
|
isFunction(listener.listener) ?
|
|
listener.listener : listener);
|
|
|
|
if (!this._events[type])
|
|
// Optimize the case of one listener. Don't need the extra array object.
|
|
this._events[type] = listener;
|
|
else if (isObject(this._events[type]))
|
|
// If we've already got an array, just append.
|
|
this._events[type].push(listener);
|
|
else
|
|
// Adding the second element, need to change to array.
|
|
this._events[type] = [this._events[type], listener];
|
|
|
|
// Check for listener leak
|
|
if (isObject(this._events[type]) && !this._events[type].warned) {
|
|
if (!isUndefined(this._maxListeners)) {
|
|
m = this._maxListeners;
|
|
} else {
|
|
m = EventEmitter.defaultMaxListeners;
|
|
}
|
|
|
|
if (m && m > 0 && this._events[type].length > m) {
|
|
this._events[type].warned = true;
|
|
console.error('(node) warning: possible EventEmitter memory ' +
|
|
'leak detected. %d listeners added. ' +
|
|
'Use emitter.setMaxListeners() to increase limit.',
|
|
this._events[type].length);
|
|
if (typeof console.trace === 'function') {
|
|
// not supported in IE 10
|
|
console.trace();
|
|
}
|
|
}
|
|
}
|
|
|
|
return this;
|
|
};
|
|
|
|
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
|
|
EventEmitter.prototype.once = function(type, listener) {
|
|
if (!isFunction(listener))
|
|
throw TypeError('listener must be a function');
|
|
|
|
var fired = false;
|
|
|
|
function g() {
|
|
this.removeListener(type, g);
|
|
|
|
if (!fired) {
|
|
fired = true;
|
|
listener.apply(this, arguments);
|
|
}
|
|
}
|
|
|
|
g.listener = listener;
|
|
this.on(type, g);
|
|
|
|
return this;
|
|
};
|
|
|
|
// emits a 'removeListener' event iff the listener was removed
|
|
EventEmitter.prototype.removeListener = function(type, listener) {
|
|
var list, position, length, i;
|
|
|
|
if (!isFunction(listener))
|
|
throw TypeError('listener must be a function');
|
|
|
|
if (!this._events || !this._events[type])
|
|
return this;
|
|
|
|
list = this._events[type];
|
|
length = list.length;
|
|
position = -1;
|
|
|
|
if (list === listener ||
|
|
(isFunction(list.listener) && list.listener === listener)) {
|
|
delete this._events[type];
|
|
if (this._events.removeListener)
|
|
this.emit('removeListener', type, listener);
|
|
|
|
} else if (isObject(list)) {
|
|
for (i = length; i-- > 0;) {
|
|
if (list[i] === listener ||
|
|
(list[i].listener && list[i].listener === listener)) {
|
|
position = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (position < 0)
|
|
return this;
|
|
|
|
if (list.length === 1) {
|
|
list.length = 0;
|
|
delete this._events[type];
|
|
} else {
|
|
list.splice(position, 1);
|
|
}
|
|
|
|
if (this._events.removeListener)
|
|
this.emit('removeListener', type, listener);
|
|
}
|
|
|
|
return this;
|
|
};
|
|
|
|
EventEmitter.prototype.removeAllListeners = function(type) {
|
|
var key, listeners;
|
|
|
|
if (!this._events)
|
|
return this;
|
|
|
|
// not listening for removeListener, no need to emit
|
|
if (!this._events.removeListener) {
|
|
if (arguments.length === 0)
|
|
this._events = {};
|
|
else if (this._events[type])
|
|
delete this._events[type];
|
|
return this;
|
|
}
|
|
|
|
// emit removeListener for all listeners on all events
|
|
if (arguments.length === 0) {
|
|
for (key in this._events) {
|
|
if (key === 'removeListener') continue;
|
|
this.removeAllListeners(key);
|
|
}
|
|
this.removeAllListeners('removeListener');
|
|
this._events = {};
|
|
return this;
|
|
}
|
|
|
|
listeners = this._events[type];
|
|
|
|
if (isFunction(listeners)) {
|
|
this.removeListener(type, listeners);
|
|
} else if (listeners) {
|
|
// LIFO order
|
|
while (listeners.length)
|
|
this.removeListener(type, listeners[listeners.length - 1]);
|
|
}
|
|
delete this._events[type];
|
|
|
|
return this;
|
|
};
|
|
|
|
EventEmitter.prototype.listeners = function(type) {
|
|
var ret;
|
|
if (!this._events || !this._events[type])
|
|
ret = [];
|
|
else if (isFunction(this._events[type]))
|
|
ret = [this._events[type]];
|
|
else
|
|
ret = this._events[type].slice();
|
|
return ret;
|
|
};
|
|
|
|
EventEmitter.prototype.listenerCount = function(type) {
|
|
if (this._events) {
|
|
var evlistener = this._events[type];
|
|
|
|
if (isFunction(evlistener))
|
|
return 1;
|
|
else if (evlistener)
|
|
return evlistener.length;
|
|
}
|
|
return 0;
|
|
};
|
|
|
|
EventEmitter.listenerCount = function(emitter, type) {
|
|
return emitter.listenerCount(type);
|
|
};
|
|
|
|
function isFunction(arg) {
|
|
return typeof arg === 'function';
|
|
}
|
|
|
|
function isNumber(arg) {
|
|
return typeof arg === 'number';
|
|
}
|
|
|
|
function isObject(arg) {
|
|
return typeof arg === 'object' && arg !== null;
|
|
}
|
|
|
|
function isUndefined(arg) {
|
|
return arg === void 0;
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 32 */
|
|
/***/ function(module, exports) {
|
|
|
|
if (typeof Object.create === 'function') {
|
|
// implementation from standard node.js 'util' module
|
|
module.exports = function inherits(ctor, superCtor) {
|
|
ctor.super_ = superCtor
|
|
ctor.prototype = Object.create(superCtor.prototype, {
|
|
constructor: {
|
|
value: ctor,
|
|
enumerable: false,
|
|
writable: true,
|
|
configurable: true
|
|
}
|
|
});
|
|
};
|
|
} else {
|
|
// old school shim for old browsers
|
|
module.exports = function inherits(ctor, superCtor) {
|
|
ctor.super_ = superCtor
|
|
var TempCtor = function () {}
|
|
TempCtor.prototype = superCtor.prototype
|
|
ctor.prototype = new TempCtor()
|
|
ctor.prototype.constructor = ctor
|
|
}
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 33 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(process) {var Stream = (function (){
|
|
try {
|
|
return __webpack_require__(30); // hack to fix a circular dependency issue when used with browserify
|
|
} catch(_){}
|
|
}());
|
|
exports = module.exports = __webpack_require__(35);
|
|
exports.Stream = Stream || exports;
|
|
exports.Readable = exports;
|
|
exports.Writable = __webpack_require__(42);
|
|
exports.Duplex = __webpack_require__(41);
|
|
exports.Transform = __webpack_require__(47);
|
|
exports.PassThrough = __webpack_require__(48);
|
|
|
|
if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) {
|
|
module.exports = Stream;
|
|
}
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(34)))
|
|
|
|
/***/ },
|
|
/* 34 */
|
|
/***/ function(module, exports) {
|
|
|
|
// shim for using process in browser
|
|
var process = module.exports = {};
|
|
|
|
// cached from whatever global is present so that test runners that stub it
|
|
// don't break things. But we need to wrap it in a try catch in case it is
|
|
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
// function because try/catches deoptimize in certain engines.
|
|
|
|
var cachedSetTimeout;
|
|
var cachedClearTimeout;
|
|
|
|
function defaultSetTimout() {
|
|
throw new Error('setTimeout has not been defined');
|
|
}
|
|
function defaultClearTimeout () {
|
|
throw new Error('clearTimeout has not been defined');
|
|
}
|
|
(function () {
|
|
try {
|
|
if (typeof setTimeout === 'function') {
|
|
cachedSetTimeout = setTimeout;
|
|
} else {
|
|
cachedSetTimeout = defaultSetTimout;
|
|
}
|
|
} catch (e) {
|
|
cachedSetTimeout = defaultSetTimout;
|
|
}
|
|
try {
|
|
if (typeof clearTimeout === 'function') {
|
|
cachedClearTimeout = clearTimeout;
|
|
} else {
|
|
cachedClearTimeout = defaultClearTimeout;
|
|
}
|
|
} catch (e) {
|
|
cachedClearTimeout = defaultClearTimeout;
|
|
}
|
|
} ())
|
|
function runTimeout(fun) {
|
|
if (cachedSetTimeout === setTimeout) {
|
|
//normal enviroments in sane situations
|
|
return setTimeout(fun, 0);
|
|
}
|
|
// if setTimeout wasn't available but was latter defined
|
|
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
cachedSetTimeout = setTimeout;
|
|
return setTimeout(fun, 0);
|
|
}
|
|
try {
|
|
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
return cachedSetTimeout(fun, 0);
|
|
} catch(e){
|
|
try {
|
|
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
return cachedSetTimeout.call(null, fun, 0);
|
|
} catch(e){
|
|
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
return cachedSetTimeout.call(this, fun, 0);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
function runClearTimeout(marker) {
|
|
if (cachedClearTimeout === clearTimeout) {
|
|
//normal enviroments in sane situations
|
|
return clearTimeout(marker);
|
|
}
|
|
// if clearTimeout wasn't available but was latter defined
|
|
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
cachedClearTimeout = clearTimeout;
|
|
return clearTimeout(marker);
|
|
}
|
|
try {
|
|
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
return cachedClearTimeout(marker);
|
|
} catch (e){
|
|
try {
|
|
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
return cachedClearTimeout.call(null, marker);
|
|
} catch (e){
|
|
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
return cachedClearTimeout.call(this, marker);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
var queue = [];
|
|
var draining = false;
|
|
var currentQueue;
|
|
var queueIndex = -1;
|
|
|
|
function cleanUpNextTick() {
|
|
if (!draining || !currentQueue) {
|
|
return;
|
|
}
|
|
draining = false;
|
|
if (currentQueue.length) {
|
|
queue = currentQueue.concat(queue);
|
|
} else {
|
|
queueIndex = -1;
|
|
}
|
|
if (queue.length) {
|
|
drainQueue();
|
|
}
|
|
}
|
|
|
|
function drainQueue() {
|
|
if (draining) {
|
|
return;
|
|
}
|
|
var timeout = runTimeout(cleanUpNextTick);
|
|
draining = true;
|
|
|
|
var len = queue.length;
|
|
while(len) {
|
|
currentQueue = queue;
|
|
queue = [];
|
|
while (++queueIndex < len) {
|
|
if (currentQueue) {
|
|
currentQueue[queueIndex].run();
|
|
}
|
|
}
|
|
queueIndex = -1;
|
|
len = queue.length;
|
|
}
|
|
currentQueue = null;
|
|
draining = false;
|
|
runClearTimeout(timeout);
|
|
}
|
|
|
|
process.nextTick = function (fun) {
|
|
var args = new Array(arguments.length - 1);
|
|
if (arguments.length > 1) {
|
|
for (var i = 1; i < arguments.length; i++) {
|
|
args[i - 1] = arguments[i];
|
|
}
|
|
}
|
|
queue.push(new Item(fun, args));
|
|
if (queue.length === 1 && !draining) {
|
|
runTimeout(drainQueue);
|
|
}
|
|
};
|
|
|
|
// v8 likes predictible objects
|
|
function Item(fun, array) {
|
|
this.fun = fun;
|
|
this.array = array;
|
|
}
|
|
Item.prototype.run = function () {
|
|
this.fun.apply(null, this.array);
|
|
};
|
|
process.title = 'browser';
|
|
process.browser = true;
|
|
process.env = {};
|
|
process.argv = [];
|
|
process.version = ''; // empty string to avoid regexp issues
|
|
process.versions = {};
|
|
|
|
function noop() {}
|
|
|
|
process.on = noop;
|
|
process.addListener = noop;
|
|
process.once = noop;
|
|
process.off = noop;
|
|
process.removeListener = noop;
|
|
process.removeAllListeners = noop;
|
|
process.emit = noop;
|
|
|
|
process.binding = function (name) {
|
|
throw new Error('process.binding is not supported');
|
|
};
|
|
|
|
process.cwd = function () { return '/' };
|
|
process.chdir = function (dir) {
|
|
throw new Error('process.chdir is not supported');
|
|
};
|
|
process.umask = function() { return 0; };
|
|
|
|
|
|
/***/ },
|
|
/* 35 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
|
|
|
|
module.exports = Readable;
|
|
|
|
/*<replacement>*/
|
|
var processNextTick = __webpack_require__(36);
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var isArray = __webpack_require__(5);
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var Duplex;
|
|
/*</replacement>*/
|
|
|
|
Readable.ReadableState = ReadableState;
|
|
|
|
/*<replacement>*/
|
|
var EE = __webpack_require__(31).EventEmitter;
|
|
|
|
var EElistenerCount = function (emitter, type) {
|
|
return emitter.listeners(type).length;
|
|
};
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var Stream;
|
|
(function () {
|
|
try {
|
|
Stream = __webpack_require__(30);
|
|
} catch (_) {} finally {
|
|
if (!Stream) Stream = __webpack_require__(31).EventEmitter;
|
|
}
|
|
})();
|
|
/*</replacement>*/
|
|
|
|
var Buffer = __webpack_require__(2).Buffer;
|
|
/*<replacement>*/
|
|
var bufferShim = __webpack_require__(37);
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var util = __webpack_require__(38);
|
|
util.inherits = __webpack_require__(32);
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var debugUtil = __webpack_require__(39);
|
|
var debug = void 0;
|
|
if (debugUtil && debugUtil.debuglog) {
|
|
debug = debugUtil.debuglog('stream');
|
|
} else {
|
|
debug = function () {};
|
|
}
|
|
/*</replacement>*/
|
|
|
|
var BufferList = __webpack_require__(40);
|
|
var StringDecoder;
|
|
|
|
util.inherits(Readable, Stream);
|
|
|
|
function prependListener(emitter, event, fn) {
|
|
// Sadly this is not cacheable as some libraries bundle their own
|
|
// event emitter implementation with them.
|
|
if (typeof emitter.prependListener === 'function') {
|
|
return emitter.prependListener(event, fn);
|
|
} else {
|
|
// This is a hack to make sure that our error handler is attached before any
|
|
// userland ones. NEVER DO THIS. This is here only because this code needs
|
|
// to continue to work with older versions of Node.js that do not include
|
|
// the prependListener() method. The goal is to eventually remove this hack.
|
|
if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
|
|
}
|
|
}
|
|
|
|
function ReadableState(options, stream) {
|
|
Duplex = Duplex || __webpack_require__(41);
|
|
|
|
options = options || {};
|
|
|
|
// object stream flag. Used to make read(n) ignore n and to
|
|
// make all the buffer merging and length checks go away
|
|
this.objectMode = !!options.objectMode;
|
|
|
|
if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
|
|
|
|
// the point at which it stops calling _read() to fill the buffer
|
|
// Note: 0 is a valid value, means "don't call _read preemptively ever"
|
|
var hwm = options.highWaterMark;
|
|
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
|
this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
|
|
|
|
// cast to ints.
|
|
this.highWaterMark = ~ ~this.highWaterMark;
|
|
|
|
// A linked list is used to store data chunks instead of an array because the
|
|
// linked list can remove elements from the beginning faster than
|
|
// array.shift()
|
|
this.buffer = new BufferList();
|
|
this.length = 0;
|
|
this.pipes = null;
|
|
this.pipesCount = 0;
|
|
this.flowing = null;
|
|
this.ended = false;
|
|
this.endEmitted = false;
|
|
this.reading = false;
|
|
|
|
// a flag to be able to tell if the onwrite cb is called immediately,
|
|
// or on a later tick. We set this to true at first, because any
|
|
// actions that shouldn't happen until "later" should generally also
|
|
// not happen before the first write call.
|
|
this.sync = true;
|
|
|
|
// whenever we return null, then we set a flag to say
|
|
// that we're awaiting a 'readable' event emission.
|
|
this.needReadable = false;
|
|
this.emittedReadable = false;
|
|
this.readableListening = false;
|
|
this.resumeScheduled = false;
|
|
|
|
// Crypto is kind of old and crusty. Historically, its default string
|
|
// encoding is 'binary' so we have to make this configurable.
|
|
// Everything else in the universe uses 'utf8', though.
|
|
this.defaultEncoding = options.defaultEncoding || 'utf8';
|
|
|
|
// when piping, we only care about 'readable' events that happen
|
|
// after read()ing all the bytes and not getting any pushback.
|
|
this.ranOut = false;
|
|
|
|
// the number of writers that are awaiting a drain event in .pipe()s
|
|
this.awaitDrain = 0;
|
|
|
|
// if true, a maybeReadMore has been scheduled
|
|
this.readingMore = false;
|
|
|
|
this.decoder = null;
|
|
this.encoding = null;
|
|
if (options.encoding) {
|
|
if (!StringDecoder) StringDecoder = __webpack_require__(46).StringDecoder;
|
|
this.decoder = new StringDecoder(options.encoding);
|
|
this.encoding = options.encoding;
|
|
}
|
|
}
|
|
|
|
function Readable(options) {
|
|
Duplex = Duplex || __webpack_require__(41);
|
|
|
|
if (!(this instanceof Readable)) return new Readable(options);
|
|
|
|
this._readableState = new ReadableState(options, this);
|
|
|
|
// legacy
|
|
this.readable = true;
|
|
|
|
if (options && typeof options.read === 'function') this._read = options.read;
|
|
|
|
Stream.call(this);
|
|
}
|
|
|
|
// Manually shove something into the read() buffer.
|
|
// This returns true if the highWaterMark has not been hit yet,
|
|
// similar to how Writable.write() returns true if you should
|
|
// write() some more.
|
|
Readable.prototype.push = function (chunk, encoding) {
|
|
var state = this._readableState;
|
|
|
|
if (!state.objectMode && typeof chunk === 'string') {
|
|
encoding = encoding || state.defaultEncoding;
|
|
if (encoding !== state.encoding) {
|
|
chunk = bufferShim.from(chunk, encoding);
|
|
encoding = '';
|
|
}
|
|
}
|
|
|
|
return readableAddChunk(this, state, chunk, encoding, false);
|
|
};
|
|
|
|
// Unshift should *always* be something directly out of read()
|
|
Readable.prototype.unshift = function (chunk) {
|
|
var state = this._readableState;
|
|
return readableAddChunk(this, state, chunk, '', true);
|
|
};
|
|
|
|
Readable.prototype.isPaused = function () {
|
|
return this._readableState.flowing === false;
|
|
};
|
|
|
|
function readableAddChunk(stream, state, chunk, encoding, addToFront) {
|
|
var er = chunkInvalid(state, chunk);
|
|
if (er) {
|
|
stream.emit('error', er);
|
|
} else if (chunk === null) {
|
|
state.reading = false;
|
|
onEofChunk(stream, state);
|
|
} else if (state.objectMode || chunk && chunk.length > 0) {
|
|
if (state.ended && !addToFront) {
|
|
var e = new Error('stream.push() after EOF');
|
|
stream.emit('error', e);
|
|
} else if (state.endEmitted && addToFront) {
|
|
var _e = new Error('stream.unshift() after end event');
|
|
stream.emit('error', _e);
|
|
} else {
|
|
var skipAdd;
|
|
if (state.decoder && !addToFront && !encoding) {
|
|
chunk = state.decoder.write(chunk);
|
|
skipAdd = !state.objectMode && chunk.length === 0;
|
|
}
|
|
|
|
if (!addToFront) state.reading = false;
|
|
|
|
// Don't add to the buffer if we've decoded to an empty string chunk and
|
|
// we're not in object mode
|
|
if (!skipAdd) {
|
|
// if we want the data now, just emit it.
|
|
if (state.flowing && state.length === 0 && !state.sync) {
|
|
stream.emit('data', chunk);
|
|
stream.read(0);
|
|
} else {
|
|
// update the buffer info.
|
|
state.length += state.objectMode ? 1 : chunk.length;
|
|
if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
|
|
|
|
if (state.needReadable) emitReadable(stream);
|
|
}
|
|
}
|
|
|
|
maybeReadMore(stream, state);
|
|
}
|
|
} else if (!addToFront) {
|
|
state.reading = false;
|
|
}
|
|
|
|
return needMoreData(state);
|
|
}
|
|
|
|
// if it's past the high water mark, we can push in some more.
|
|
// Also, if we have no data yet, we can stand some
|
|
// more bytes. This is to work around cases where hwm=0,
|
|
// such as the repl. Also, if the push() triggered a
|
|
// readable event, and the user called read(largeNumber) such that
|
|
// needReadable was set, then we ought to push more, so that another
|
|
// 'readable' event will be triggered.
|
|
function needMoreData(state) {
|
|
return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
|
|
}
|
|
|
|
// backwards compatibility.
|
|
Readable.prototype.setEncoding = function (enc) {
|
|
if (!StringDecoder) StringDecoder = __webpack_require__(46).StringDecoder;
|
|
this._readableState.decoder = new StringDecoder(enc);
|
|
this._readableState.encoding = enc;
|
|
return this;
|
|
};
|
|
|
|
// Don't raise the hwm > 8MB
|
|
var MAX_HWM = 0x800000;
|
|
function computeNewHighWaterMark(n) {
|
|
if (n >= MAX_HWM) {
|
|
n = MAX_HWM;
|
|
} else {
|
|
// Get the next highest power of 2 to prevent increasing hwm excessively in
|
|
// tiny amounts
|
|
n--;
|
|
n |= n >>> 1;
|
|
n |= n >>> 2;
|
|
n |= n >>> 4;
|
|
n |= n >>> 8;
|
|
n |= n >>> 16;
|
|
n++;
|
|
}
|
|
return n;
|
|
}
|
|
|
|
// This function is designed to be inlinable, so please take care when making
|
|
// changes to the function body.
|
|
function howMuchToRead(n, state) {
|
|
if (n <= 0 || state.length === 0 && state.ended) return 0;
|
|
if (state.objectMode) return 1;
|
|
if (n !== n) {
|
|
// Only flow one buffer at a time
|
|
if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
|
|
}
|
|
// If we're asking for more than the current hwm, then raise the hwm.
|
|
if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
|
|
if (n <= state.length) return n;
|
|
// Don't have enough
|
|
if (!state.ended) {
|
|
state.needReadable = true;
|
|
return 0;
|
|
}
|
|
return state.length;
|
|
}
|
|
|
|
// you can override either this method, or the async _read(n) below.
|
|
Readable.prototype.read = function (n) {
|
|
debug('read', n);
|
|
n = parseInt(n, 10);
|
|
var state = this._readableState;
|
|
var nOrig = n;
|
|
|
|
if (n !== 0) state.emittedReadable = false;
|
|
|
|
// if we're doing read(0) to trigger a readable event, but we
|
|
// already have a bunch of data in the buffer, then just trigger
|
|
// the 'readable' event and move on.
|
|
if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
|
|
debug('read: emitReadable', state.length, state.ended);
|
|
if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
|
|
return null;
|
|
}
|
|
|
|
n = howMuchToRead(n, state);
|
|
|
|
// if we've ended, and we're now clear, then finish it up.
|
|
if (n === 0 && state.ended) {
|
|
if (state.length === 0) endReadable(this);
|
|
return null;
|
|
}
|
|
|
|
// All the actual chunk generation logic needs to be
|
|
// *below* the call to _read. The reason is that in certain
|
|
// synthetic stream cases, such as passthrough streams, _read
|
|
// may be a completely synchronous operation which may change
|
|
// the state of the read buffer, providing enough data when
|
|
// before there was *not* enough.
|
|
//
|
|
// So, the steps are:
|
|
// 1. Figure out what the state of things will be after we do
|
|
// a read from the buffer.
|
|
//
|
|
// 2. If that resulting state will trigger a _read, then call _read.
|
|
// Note that this may be asynchronous, or synchronous. Yes, it is
|
|
// deeply ugly to write APIs this way, but that still doesn't mean
|
|
// that the Readable class should behave improperly, as streams are
|
|
// designed to be sync/async agnostic.
|
|
// Take note if the _read call is sync or async (ie, if the read call
|
|
// has returned yet), so that we know whether or not it's safe to emit
|
|
// 'readable' etc.
|
|
//
|
|
// 3. Actually pull the requested chunks out of the buffer and return.
|
|
|
|
// if we need a readable event, then we need to do some reading.
|
|
var doRead = state.needReadable;
|
|
debug('need readable', doRead);
|
|
|
|
// if we currently have less than the highWaterMark, then also read some
|
|
if (state.length === 0 || state.length - n < state.highWaterMark) {
|
|
doRead = true;
|
|
debug('length less than watermark', doRead);
|
|
}
|
|
|
|
// however, if we've ended, then there's no point, and if we're already
|
|
// reading, then it's unnecessary.
|
|
if (state.ended || state.reading) {
|
|
doRead = false;
|
|
debug('reading or ended', doRead);
|
|
} else if (doRead) {
|
|
debug('do read');
|
|
state.reading = true;
|
|
state.sync = true;
|
|
// if the length is currently zero, then we *need* a readable event.
|
|
if (state.length === 0) state.needReadable = true;
|
|
// call internal read method
|
|
this._read(state.highWaterMark);
|
|
state.sync = false;
|
|
// If _read pushed data synchronously, then `reading` will be false,
|
|
// and we need to re-evaluate how much data we can return to the user.
|
|
if (!state.reading) n = howMuchToRead(nOrig, state);
|
|
}
|
|
|
|
var ret;
|
|
if (n > 0) ret = fromList(n, state);else ret = null;
|
|
|
|
if (ret === null) {
|
|
state.needReadable = true;
|
|
n = 0;
|
|
} else {
|
|
state.length -= n;
|
|
}
|
|
|
|
if (state.length === 0) {
|
|
// If we have nothing in the buffer, then we want to know
|
|
// as soon as we *do* get something into the buffer.
|
|
if (!state.ended) state.needReadable = true;
|
|
|
|
// If we tried to read() past the EOF, then emit end on the next tick.
|
|
if (nOrig !== n && state.ended) endReadable(this);
|
|
}
|
|
|
|
if (ret !== null) this.emit('data', ret);
|
|
|
|
return ret;
|
|
};
|
|
|
|
function chunkInvalid(state, chunk) {
|
|
var er = null;
|
|
if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
|
|
er = new TypeError('Invalid non-string/buffer chunk');
|
|
}
|
|
return er;
|
|
}
|
|
|
|
function onEofChunk(stream, state) {
|
|
if (state.ended) return;
|
|
if (state.decoder) {
|
|
var chunk = state.decoder.end();
|
|
if (chunk && chunk.length) {
|
|
state.buffer.push(chunk);
|
|
state.length += state.objectMode ? 1 : chunk.length;
|
|
}
|
|
}
|
|
state.ended = true;
|
|
|
|
// emit 'readable' now to make sure it gets picked up.
|
|
emitReadable(stream);
|
|
}
|
|
|
|
// Don't emit readable right away in sync mode, because this can trigger
|
|
// another read() call => stack overflow. This way, it might trigger
|
|
// a nextTick recursion warning, but that's not so bad.
|
|
function emitReadable(stream) {
|
|
var state = stream._readableState;
|
|
state.needReadable = false;
|
|
if (!state.emittedReadable) {
|
|
debug('emitReadable', state.flowing);
|
|
state.emittedReadable = true;
|
|
if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
|
|
}
|
|
}
|
|
|
|
function emitReadable_(stream) {
|
|
debug('emit readable');
|
|
stream.emit('readable');
|
|
flow(stream);
|
|
}
|
|
|
|
// at this point, the user has presumably seen the 'readable' event,
|
|
// and called read() to consume some data. that may have triggered
|
|
// in turn another _read(n) call, in which case reading = true if
|
|
// it's in progress.
|
|
// However, if we're not ended, or reading, and the length < hwm,
|
|
// then go ahead and try to read some more preemptively.
|
|
function maybeReadMore(stream, state) {
|
|
if (!state.readingMore) {
|
|
state.readingMore = true;
|
|
processNextTick(maybeReadMore_, stream, state);
|
|
}
|
|
}
|
|
|
|
function maybeReadMore_(stream, state) {
|
|
var len = state.length;
|
|
while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
|
|
debug('maybeReadMore read 0');
|
|
stream.read(0);
|
|
if (len === state.length)
|
|
// didn't get any data, stop spinning.
|
|
break;else len = state.length;
|
|
}
|
|
state.readingMore = false;
|
|
}
|
|
|
|
// abstract method. to be overridden in specific implementation classes.
|
|
// call cb(er, data) where data is <= n in length.
|
|
// for virtual (non-string, non-buffer) streams, "length" is somewhat
|
|
// arbitrary, and perhaps not very meaningful.
|
|
Readable.prototype._read = function (n) {
|
|
this.emit('error', new Error('_read() is not implemented'));
|
|
};
|
|
|
|
Readable.prototype.pipe = function (dest, pipeOpts) {
|
|
var src = this;
|
|
var state = this._readableState;
|
|
|
|
switch (state.pipesCount) {
|
|
case 0:
|
|
state.pipes = dest;
|
|
break;
|
|
case 1:
|
|
state.pipes = [state.pipes, dest];
|
|
break;
|
|
default:
|
|
state.pipes.push(dest);
|
|
break;
|
|
}
|
|
state.pipesCount += 1;
|
|
debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
|
|
|
|
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
|
|
|
|
var endFn = doEnd ? onend : cleanup;
|
|
if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
|
|
|
|
dest.on('unpipe', onunpipe);
|
|
function onunpipe(readable) {
|
|
debug('onunpipe');
|
|
if (readable === src) {
|
|
cleanup();
|
|
}
|
|
}
|
|
|
|
function onend() {
|
|
debug('onend');
|
|
dest.end();
|
|
}
|
|
|
|
// when the dest drains, it reduces the awaitDrain counter
|
|
// on the source. This would be more elegant with a .once()
|
|
// handler in flow(), but adding and removing repeatedly is
|
|
// too slow.
|
|
var ondrain = pipeOnDrain(src);
|
|
dest.on('drain', ondrain);
|
|
|
|
var cleanedUp = false;
|
|
function cleanup() {
|
|
debug('cleanup');
|
|
// cleanup event handlers once the pipe is broken
|
|
dest.removeListener('close', onclose);
|
|
dest.removeListener('finish', onfinish);
|
|
dest.removeListener('drain', ondrain);
|
|
dest.removeListener('error', onerror);
|
|
dest.removeListener('unpipe', onunpipe);
|
|
src.removeListener('end', onend);
|
|
src.removeListener('end', cleanup);
|
|
src.removeListener('data', ondata);
|
|
|
|
cleanedUp = true;
|
|
|
|
// if the reader is waiting for a drain event from this
|
|
// specific writer, then it would cause it to never start
|
|
// flowing again.
|
|
// So, if this is awaiting a drain, then we just call it now.
|
|
// If we don't know, then assume that we are waiting for one.
|
|
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
|
|
}
|
|
|
|
// If the user pushes more data while we're writing to dest then we'll end up
|
|
// in ondata again. However, we only want to increase awaitDrain once because
|
|
// dest will only emit one 'drain' event for the multiple writes.
|
|
// => Introduce a guard on increasing awaitDrain.
|
|
var increasedAwaitDrain = false;
|
|
src.on('data', ondata);
|
|
function ondata(chunk) {
|
|
debug('ondata');
|
|
increasedAwaitDrain = false;
|
|
var ret = dest.write(chunk);
|
|
if (false === ret && !increasedAwaitDrain) {
|
|
// If the user unpiped during `dest.write()`, it is possible
|
|
// to get stuck in a permanently paused state if that write
|
|
// also returned false.
|
|
// => Check whether `dest` is still a piping destination.
|
|
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
|
debug('false write response, pause', src._readableState.awaitDrain);
|
|
src._readableState.awaitDrain++;
|
|
increasedAwaitDrain = true;
|
|
}
|
|
src.pause();
|
|
}
|
|
}
|
|
|
|
// if the dest has an error, then stop piping into it.
|
|
// however, don't suppress the throwing behavior for this.
|
|
function onerror(er) {
|
|
debug('onerror', er);
|
|
unpipe();
|
|
dest.removeListener('error', onerror);
|
|
if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
|
|
}
|
|
|
|
// Make sure our error handler is attached before userland ones.
|
|
prependListener(dest, 'error', onerror);
|
|
|
|
// Both close and finish should trigger unpipe, but only once.
|
|
function onclose() {
|
|
dest.removeListener('finish', onfinish);
|
|
unpipe();
|
|
}
|
|
dest.once('close', onclose);
|
|
function onfinish() {
|
|
debug('onfinish');
|
|
dest.removeListener('close', onclose);
|
|
unpipe();
|
|
}
|
|
dest.once('finish', onfinish);
|
|
|
|
function unpipe() {
|
|
debug('unpipe');
|
|
src.unpipe(dest);
|
|
}
|
|
|
|
// tell the dest that it's being piped to
|
|
dest.emit('pipe', src);
|
|
|
|
// start the flow if it hasn't been started already.
|
|
if (!state.flowing) {
|
|
debug('pipe resume');
|
|
src.resume();
|
|
}
|
|
|
|
return dest;
|
|
};
|
|
|
|
function pipeOnDrain(src) {
|
|
return function () {
|
|
var state = src._readableState;
|
|
debug('pipeOnDrain', state.awaitDrain);
|
|
if (state.awaitDrain) state.awaitDrain--;
|
|
if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
|
|
state.flowing = true;
|
|
flow(src);
|
|
}
|
|
};
|
|
}
|
|
|
|
Readable.prototype.unpipe = function (dest) {
|
|
var state = this._readableState;
|
|
|
|
// if we're not piping anywhere, then do nothing.
|
|
if (state.pipesCount === 0) return this;
|
|
|
|
// just one destination. most common case.
|
|
if (state.pipesCount === 1) {
|
|
// passed in one, but it's not the right one.
|
|
if (dest && dest !== state.pipes) return this;
|
|
|
|
if (!dest) dest = state.pipes;
|
|
|
|
// got a match.
|
|
state.pipes = null;
|
|
state.pipesCount = 0;
|
|
state.flowing = false;
|
|
if (dest) dest.emit('unpipe', this);
|
|
return this;
|
|
}
|
|
|
|
// slow case. multiple pipe destinations.
|
|
|
|
if (!dest) {
|
|
// remove all.
|
|
var dests = state.pipes;
|
|
var len = state.pipesCount;
|
|
state.pipes = null;
|
|
state.pipesCount = 0;
|
|
state.flowing = false;
|
|
|
|
for (var i = 0; i < len; i++) {
|
|
dests[i].emit('unpipe', this);
|
|
}return this;
|
|
}
|
|
|
|
// try to find the right one.
|
|
var index = indexOf(state.pipes, dest);
|
|
if (index === -1) return this;
|
|
|
|
state.pipes.splice(index, 1);
|
|
state.pipesCount -= 1;
|
|
if (state.pipesCount === 1) state.pipes = state.pipes[0];
|
|
|
|
dest.emit('unpipe', this);
|
|
|
|
return this;
|
|
};
|
|
|
|
// set up data events if they are asked for
|
|
// Ensure readable listeners eventually get something
|
|
Readable.prototype.on = function (ev, fn) {
|
|
var res = Stream.prototype.on.call(this, ev, fn);
|
|
|
|
if (ev === 'data') {
|
|
// Start flowing on next tick if stream isn't explicitly paused
|
|
if (this._readableState.flowing !== false) this.resume();
|
|
} else if (ev === 'readable') {
|
|
var state = this._readableState;
|
|
if (!state.endEmitted && !state.readableListening) {
|
|
state.readableListening = state.needReadable = true;
|
|
state.emittedReadable = false;
|
|
if (!state.reading) {
|
|
processNextTick(nReadingNextTick, this);
|
|
} else if (state.length) {
|
|
emitReadable(this, state);
|
|
}
|
|
}
|
|
}
|
|
|
|
return res;
|
|
};
|
|
Readable.prototype.addListener = Readable.prototype.on;
|
|
|
|
function nReadingNextTick(self) {
|
|
debug('readable nexttick read 0');
|
|
self.read(0);
|
|
}
|
|
|
|
// pause() and resume() are remnants of the legacy readable stream API
|
|
// If the user uses them, then switch into old mode.
|
|
Readable.prototype.resume = function () {
|
|
var state = this._readableState;
|
|
if (!state.flowing) {
|
|
debug('resume');
|
|
state.flowing = true;
|
|
resume(this, state);
|
|
}
|
|
return this;
|
|
};
|
|
|
|
function resume(stream, state) {
|
|
if (!state.resumeScheduled) {
|
|
state.resumeScheduled = true;
|
|
processNextTick(resume_, stream, state);
|
|
}
|
|
}
|
|
|
|
function resume_(stream, state) {
|
|
if (!state.reading) {
|
|
debug('resume read 0');
|
|
stream.read(0);
|
|
}
|
|
|
|
state.resumeScheduled = false;
|
|
state.awaitDrain = 0;
|
|
stream.emit('resume');
|
|
flow(stream);
|
|
if (state.flowing && !state.reading) stream.read(0);
|
|
}
|
|
|
|
Readable.prototype.pause = function () {
|
|
debug('call pause flowing=%j', this._readableState.flowing);
|
|
if (false !== this._readableState.flowing) {
|
|
debug('pause');
|
|
this._readableState.flowing = false;
|
|
this.emit('pause');
|
|
}
|
|
return this;
|
|
};
|
|
|
|
function flow(stream) {
|
|
var state = stream._readableState;
|
|
debug('flow', state.flowing);
|
|
while (state.flowing && stream.read(9007199254740991) !== null) {}
|
|
}
|
|
|
|
// wrap an old-style stream as the async data source.
|
|
// This is *not* part of the readable stream interface.
|
|
// It is an ugly unfortunate mess of history.
|
|
Readable.prototype.wrap = function (stream) {
|
|
var state = this._readableState;
|
|
var paused = false;
|
|
|
|
var self = this;
|
|
stream.on('end', function () {
|
|
debug('wrapped end');
|
|
if (state.decoder && !state.ended) {
|
|
var chunk = state.decoder.end();
|
|
if (chunk && chunk.length) self.push(chunk);
|
|
}
|
|
|
|
self.push(null);
|
|
});
|
|
|
|
stream.on('data', function (chunk) {
|
|
debug('wrapped data');
|
|
if (state.decoder) chunk = state.decoder.write(chunk);
|
|
|
|
// don't skip over falsy values in objectMode
|
|
if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
|
|
|
|
var ret = self.push(chunk);
|
|
if (!ret) {
|
|
paused = true;
|
|
stream.pause();
|
|
}
|
|
});
|
|
|
|
// proxy all the other methods.
|
|
// important when wrapping filters and duplexes.
|
|
for (var i in stream) {
|
|
if (this[i] === undefined && typeof stream[i] === 'function') {
|
|
this[i] = function (method) {
|
|
return function () {
|
|
return stream[method].apply(stream, arguments);
|
|
};
|
|
}(i);
|
|
}
|
|
}
|
|
|
|
// proxy certain important events.
|
|
var events = ['error', 'close', 'destroy', 'pause', 'resume'];
|
|
forEach(events, function (ev) {
|
|
stream.on(ev, self.emit.bind(self, ev));
|
|
});
|
|
|
|
// when we try to consume some more bytes, simply unpause the
|
|
// underlying stream.
|
|
self._read = function (n) {
|
|
debug('wrapped _read', n);
|
|
if (paused) {
|
|
paused = false;
|
|
stream.resume();
|
|
}
|
|
};
|
|
|
|
return self;
|
|
};
|
|
|
|
// exposed for testing purposes only.
|
|
Readable._fromList = fromList;
|
|
|
|
// Pluck off n bytes from an array of buffers.
|
|
// Length is the combined lengths of all the buffers in the list.
|
|
// This function is designed to be inlinable, so please take care when making
|
|
// changes to the function body.
|
|
function fromList(n, state) {
|
|
// nothing buffered
|
|
if (state.length === 0) return null;
|
|
|
|
var ret;
|
|
if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
|
|
// read it all, truncate the list
|
|
if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
|
|
state.buffer.clear();
|
|
} else {
|
|
// read part of list
|
|
ret = fromListPartial(n, state.buffer, state.decoder);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
// Extracts only enough buffered data to satisfy the amount requested.
|
|
// This function is designed to be inlinable, so please take care when making
|
|
// changes to the function body.
|
|
function fromListPartial(n, list, hasStrings) {
|
|
var ret;
|
|
if (n < list.head.data.length) {
|
|
// slice is the same for buffers and strings
|
|
ret = list.head.data.slice(0, n);
|
|
list.head.data = list.head.data.slice(n);
|
|
} else if (n === list.head.data.length) {
|
|
// first chunk is a perfect match
|
|
ret = list.shift();
|
|
} else {
|
|
// result spans more than one buffer
|
|
ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
// Copies a specified amount of characters from the list of buffered data
|
|
// chunks.
|
|
// This function is designed to be inlinable, so please take care when making
|
|
// changes to the function body.
|
|
function copyFromBufferString(n, list) {
|
|
var p = list.head;
|
|
var c = 1;
|
|
var ret = p.data;
|
|
n -= ret.length;
|
|
while (p = p.next) {
|
|
var str = p.data;
|
|
var nb = n > str.length ? str.length : n;
|
|
if (nb === str.length) ret += str;else ret += str.slice(0, n);
|
|
n -= nb;
|
|
if (n === 0) {
|
|
if (nb === str.length) {
|
|
++c;
|
|
if (p.next) list.head = p.next;else list.head = list.tail = null;
|
|
} else {
|
|
list.head = p;
|
|
p.data = str.slice(nb);
|
|
}
|
|
break;
|
|
}
|
|
++c;
|
|
}
|
|
list.length -= c;
|
|
return ret;
|
|
}
|
|
|
|
// Copies a specified amount of bytes from the list of buffered data chunks.
|
|
// This function is designed to be inlinable, so please take care when making
|
|
// changes to the function body.
|
|
function copyFromBuffer(n, list) {
|
|
var ret = bufferShim.allocUnsafe(n);
|
|
var p = list.head;
|
|
var c = 1;
|
|
p.data.copy(ret);
|
|
n -= p.data.length;
|
|
while (p = p.next) {
|
|
var buf = p.data;
|
|
var nb = n > buf.length ? buf.length : n;
|
|
buf.copy(ret, ret.length - n, 0, nb);
|
|
n -= nb;
|
|
if (n === 0) {
|
|
if (nb === buf.length) {
|
|
++c;
|
|
if (p.next) list.head = p.next;else list.head = list.tail = null;
|
|
} else {
|
|
list.head = p;
|
|
p.data = buf.slice(nb);
|
|
}
|
|
break;
|
|
}
|
|
++c;
|
|
}
|
|
list.length -= c;
|
|
return ret;
|
|
}
|
|
|
|
function endReadable(stream) {
|
|
var state = stream._readableState;
|
|
|
|
// If we get here before consuming all the bytes, then that is a
|
|
// bug in node. Should never happen.
|
|
if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
|
|
|
|
if (!state.endEmitted) {
|
|
state.ended = true;
|
|
processNextTick(endReadableNT, state, stream);
|
|
}
|
|
}
|
|
|
|
function endReadableNT(state, stream) {
|
|
// Check that we didn't get one last unshift.
|
|
if (!state.endEmitted && state.length === 0) {
|
|
state.endEmitted = true;
|
|
stream.readable = false;
|
|
stream.emit('end');
|
|
}
|
|
}
|
|
|
|
function forEach(xs, f) {
|
|
for (var i = 0, l = xs.length; i < l; i++) {
|
|
f(xs[i], i);
|
|
}
|
|
}
|
|
|
|
function indexOf(xs, x) {
|
|
for (var i = 0, l = xs.length; i < l; i++) {
|
|
if (xs[i] === x) return i;
|
|
}
|
|
return -1;
|
|
}
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(34)))
|
|
|
|
/***/ },
|
|
/* 36 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
|
|
|
|
if (!process.version ||
|
|
process.version.indexOf('v0.') === 0 ||
|
|
process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
|
|
module.exports = nextTick;
|
|
} else {
|
|
module.exports = process.nextTick;
|
|
}
|
|
|
|
function nextTick(fn, arg1, arg2, arg3) {
|
|
if (typeof fn !== 'function') {
|
|
throw new TypeError('"callback" argument must be a function');
|
|
}
|
|
var len = arguments.length;
|
|
var args, i;
|
|
switch (len) {
|
|
case 0:
|
|
case 1:
|
|
return process.nextTick(fn);
|
|
case 2:
|
|
return process.nextTick(function afterTickOne() {
|
|
fn.call(null, arg1);
|
|
});
|
|
case 3:
|
|
return process.nextTick(function afterTickTwo() {
|
|
fn.call(null, arg1, arg2);
|
|
});
|
|
case 4:
|
|
return process.nextTick(function afterTickThree() {
|
|
fn.call(null, arg1, arg2, arg3);
|
|
});
|
|
default:
|
|
args = new Array(len - 1);
|
|
i = 0;
|
|
while (i < args.length) {
|
|
args[i++] = arguments[i];
|
|
}
|
|
return process.nextTick(function afterTick() {
|
|
fn.apply(null, args);
|
|
});
|
|
}
|
|
}
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(34)))
|
|
|
|
/***/ },
|
|
/* 37 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(global) {'use strict';
|
|
|
|
var buffer = __webpack_require__(2);
|
|
var Buffer = buffer.Buffer;
|
|
var SlowBuffer = buffer.SlowBuffer;
|
|
var MAX_LEN = buffer.kMaxLength || 2147483647;
|
|
exports.alloc = function alloc(size, fill, encoding) {
|
|
if (typeof Buffer.alloc === 'function') {
|
|
return Buffer.alloc(size, fill, encoding);
|
|
}
|
|
if (typeof encoding === 'number') {
|
|
throw new TypeError('encoding must not be number');
|
|
}
|
|
if (typeof size !== 'number') {
|
|
throw new TypeError('size must be a number');
|
|
}
|
|
if (size > MAX_LEN) {
|
|
throw new RangeError('size is too large');
|
|
}
|
|
var enc = encoding;
|
|
var _fill = fill;
|
|
if (_fill === undefined) {
|
|
enc = undefined;
|
|
_fill = 0;
|
|
}
|
|
var buf = new Buffer(size);
|
|
if (typeof _fill === 'string') {
|
|
var fillBuf = new Buffer(_fill, enc);
|
|
var flen = fillBuf.length;
|
|
var i = -1;
|
|
while (++i < size) {
|
|
buf[i] = fillBuf[i % flen];
|
|
}
|
|
} else {
|
|
buf.fill(_fill);
|
|
}
|
|
return buf;
|
|
}
|
|
exports.allocUnsafe = function allocUnsafe(size) {
|
|
if (typeof Buffer.allocUnsafe === 'function') {
|
|
return Buffer.allocUnsafe(size);
|
|
}
|
|
if (typeof size !== 'number') {
|
|
throw new TypeError('size must be a number');
|
|
}
|
|
if (size > MAX_LEN) {
|
|
throw new RangeError('size is too large');
|
|
}
|
|
return new Buffer(size);
|
|
}
|
|
exports.from = function from(value, encodingOrOffset, length) {
|
|
if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) {
|
|
return Buffer.from(value, encodingOrOffset, length);
|
|
}
|
|
if (typeof value === 'number') {
|
|
throw new TypeError('"value" argument must not be a number');
|
|
}
|
|
if (typeof value === 'string') {
|
|
return new Buffer(value, encodingOrOffset);
|
|
}
|
|
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
|
var offset = encodingOrOffset;
|
|
if (arguments.length === 1) {
|
|
return new Buffer(value);
|
|
}
|
|
if (typeof offset === 'undefined') {
|
|
offset = 0;
|
|
}
|
|
var len = length;
|
|
if (typeof len === 'undefined') {
|
|
len = value.byteLength - offset;
|
|
}
|
|
if (offset >= value.byteLength) {
|
|
throw new RangeError('\'offset\' is out of bounds');
|
|
}
|
|
if (len > value.byteLength - offset) {
|
|
throw new RangeError('\'length\' is out of bounds');
|
|
}
|
|
return new Buffer(value.slice(offset, offset + len));
|
|
}
|
|
if (Buffer.isBuffer(value)) {
|
|
var out = new Buffer(value.length);
|
|
value.copy(out, 0, 0, value.length);
|
|
return out;
|
|
}
|
|
if (value) {
|
|
if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) {
|
|
return new Buffer(value);
|
|
}
|
|
if (value.type === 'Buffer' && Array.isArray(value.data)) {
|
|
return new Buffer(value.data);
|
|
}
|
|
}
|
|
|
|
throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.');
|
|
}
|
|
exports.allocUnsafeSlow = function allocUnsafeSlow(size) {
|
|
if (typeof Buffer.allocUnsafeSlow === 'function') {
|
|
return Buffer.allocUnsafeSlow(size);
|
|
}
|
|
if (typeof size !== 'number') {
|
|
throw new TypeError('size must be a number');
|
|
}
|
|
if (size >= MAX_LEN) {
|
|
throw new RangeError('size is too large');
|
|
}
|
|
return new SlowBuffer(size);
|
|
}
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
|
|
|
/***/ },
|
|
/* 38 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
// NOTE: These type checking functions intentionally don't use `instanceof`
|
|
// because it is fragile and can be easily faked with `Object.create()`.
|
|
|
|
function isArray(arg) {
|
|
if (Array.isArray) {
|
|
return Array.isArray(arg);
|
|
}
|
|
return objectToString(arg) === '[object Array]';
|
|
}
|
|
exports.isArray = isArray;
|
|
|
|
function isBoolean(arg) {
|
|
return typeof arg === 'boolean';
|
|
}
|
|
exports.isBoolean = isBoolean;
|
|
|
|
function isNull(arg) {
|
|
return arg === null;
|
|
}
|
|
exports.isNull = isNull;
|
|
|
|
function isNullOrUndefined(arg) {
|
|
return arg == null;
|
|
}
|
|
exports.isNullOrUndefined = isNullOrUndefined;
|
|
|
|
function isNumber(arg) {
|
|
return typeof arg === 'number';
|
|
}
|
|
exports.isNumber = isNumber;
|
|
|
|
function isString(arg) {
|
|
return typeof arg === 'string';
|
|
}
|
|
exports.isString = isString;
|
|
|
|
function isSymbol(arg) {
|
|
return typeof arg === 'symbol';
|
|
}
|
|
exports.isSymbol = isSymbol;
|
|
|
|
function isUndefined(arg) {
|
|
return arg === void 0;
|
|
}
|
|
exports.isUndefined = isUndefined;
|
|
|
|
function isRegExp(re) {
|
|
return objectToString(re) === '[object RegExp]';
|
|
}
|
|
exports.isRegExp = isRegExp;
|
|
|
|
function isObject(arg) {
|
|
return typeof arg === 'object' && arg !== null;
|
|
}
|
|
exports.isObject = isObject;
|
|
|
|
function isDate(d) {
|
|
return objectToString(d) === '[object Date]';
|
|
}
|
|
exports.isDate = isDate;
|
|
|
|
function isError(e) {
|
|
return (objectToString(e) === '[object Error]' || e instanceof Error);
|
|
}
|
|
exports.isError = isError;
|
|
|
|
function isFunction(arg) {
|
|
return typeof arg === 'function';
|
|
}
|
|
exports.isFunction = isFunction;
|
|
|
|
function isPrimitive(arg) {
|
|
return arg === null ||
|
|
typeof arg === 'boolean' ||
|
|
typeof arg === 'number' ||
|
|
typeof arg === 'string' ||
|
|
typeof arg === 'symbol' || // ES6 symbol
|
|
typeof arg === 'undefined';
|
|
}
|
|
exports.isPrimitive = isPrimitive;
|
|
|
|
exports.isBuffer = Buffer.isBuffer;
|
|
|
|
function objectToString(o) {
|
|
return Object.prototype.toString.call(o);
|
|
}
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 39 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* (ignored) */
|
|
|
|
/***/ },
|
|
/* 40 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
var Buffer = __webpack_require__(2).Buffer;
|
|
/*<replacement>*/
|
|
var bufferShim = __webpack_require__(37);
|
|
/*</replacement>*/
|
|
|
|
module.exports = BufferList;
|
|
|
|
function BufferList() {
|
|
this.head = null;
|
|
this.tail = null;
|
|
this.length = 0;
|
|
}
|
|
|
|
BufferList.prototype.push = function (v) {
|
|
var entry = { data: v, next: null };
|
|
if (this.length > 0) this.tail.next = entry;else this.head = entry;
|
|
this.tail = entry;
|
|
++this.length;
|
|
};
|
|
|
|
BufferList.prototype.unshift = function (v) {
|
|
var entry = { data: v, next: this.head };
|
|
if (this.length === 0) this.tail = entry;
|
|
this.head = entry;
|
|
++this.length;
|
|
};
|
|
|
|
BufferList.prototype.shift = function () {
|
|
if (this.length === 0) return;
|
|
var ret = this.head.data;
|
|
if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
|
|
--this.length;
|
|
return ret;
|
|
};
|
|
|
|
BufferList.prototype.clear = function () {
|
|
this.head = this.tail = null;
|
|
this.length = 0;
|
|
};
|
|
|
|
BufferList.prototype.join = function (s) {
|
|
if (this.length === 0) return '';
|
|
var p = this.head;
|
|
var ret = '' + p.data;
|
|
while (p = p.next) {
|
|
ret += s + p.data;
|
|
}return ret;
|
|
};
|
|
|
|
BufferList.prototype.concat = function (n) {
|
|
if (this.length === 0) return bufferShim.alloc(0);
|
|
if (this.length === 1) return this.head.data;
|
|
var ret = bufferShim.allocUnsafe(n >>> 0);
|
|
var p = this.head;
|
|
var i = 0;
|
|
while (p) {
|
|
p.data.copy(ret, i);
|
|
i += p.data.length;
|
|
p = p.next;
|
|
}
|
|
return ret;
|
|
};
|
|
|
|
/***/ },
|
|
/* 41 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// a duplex stream is just a stream that is both readable and writable.
|
|
// Since JS doesn't have multiple prototypal inheritance, this class
|
|
// prototypally inherits from Readable, and then parasitically from
|
|
// Writable.
|
|
|
|
'use strict';
|
|
|
|
/*<replacement>*/
|
|
|
|
var objectKeys = Object.keys || function (obj) {
|
|
var keys = [];
|
|
for (var key in obj) {
|
|
keys.push(key);
|
|
}return keys;
|
|
};
|
|
/*</replacement>*/
|
|
|
|
module.exports = Duplex;
|
|
|
|
/*<replacement>*/
|
|
var processNextTick = __webpack_require__(36);
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var util = __webpack_require__(38);
|
|
util.inherits = __webpack_require__(32);
|
|
/*</replacement>*/
|
|
|
|
var Readable = __webpack_require__(35);
|
|
var Writable = __webpack_require__(42);
|
|
|
|
util.inherits(Duplex, Readable);
|
|
|
|
var keys = objectKeys(Writable.prototype);
|
|
for (var v = 0; v < keys.length; v++) {
|
|
var method = keys[v];
|
|
if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
|
}
|
|
|
|
function Duplex(options) {
|
|
if (!(this instanceof Duplex)) return new Duplex(options);
|
|
|
|
Readable.call(this, options);
|
|
Writable.call(this, options);
|
|
|
|
if (options && options.readable === false) this.readable = false;
|
|
|
|
if (options && options.writable === false) this.writable = false;
|
|
|
|
this.allowHalfOpen = true;
|
|
if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
|
|
|
|
this.once('end', onend);
|
|
}
|
|
|
|
// the no-half-open enforcer
|
|
function onend() {
|
|
// if we allow half-open state, or if the writable side ended,
|
|
// then we're ok.
|
|
if (this.allowHalfOpen || this._writableState.ended) return;
|
|
|
|
// no more data can be written.
|
|
// But allow more writes to happen in this tick.
|
|
processNextTick(onEndNT, this);
|
|
}
|
|
|
|
function onEndNT(self) {
|
|
self.end();
|
|
}
|
|
|
|
function forEach(xs, f) {
|
|
for (var i = 0, l = xs.length; i < l; i++) {
|
|
f(xs[i], i);
|
|
}
|
|
}
|
|
|
|
/***/ },
|
|
/* 42 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(process, setImmediate) {// A bit simpler than readable streams.
|
|
// Implement an async ._write(chunk, encoding, cb), and it'll handle all
|
|
// the drain event emission and buffering.
|
|
|
|
'use strict';
|
|
|
|
module.exports = Writable;
|
|
|
|
/*<replacement>*/
|
|
var processNextTick = __webpack_require__(36);
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var Duplex;
|
|
/*</replacement>*/
|
|
|
|
Writable.WritableState = WritableState;
|
|
|
|
/*<replacement>*/
|
|
var util = __webpack_require__(38);
|
|
util.inherits = __webpack_require__(32);
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var internalUtil = {
|
|
deprecate: __webpack_require__(45)
|
|
};
|
|
/*</replacement>*/
|
|
|
|
/*<replacement>*/
|
|
var Stream;
|
|
(function () {
|
|
try {
|
|
Stream = __webpack_require__(30);
|
|
} catch (_) {} finally {
|
|
if (!Stream) Stream = __webpack_require__(31).EventEmitter;
|
|
}
|
|
})();
|
|
/*</replacement>*/
|
|
|
|
var Buffer = __webpack_require__(2).Buffer;
|
|
/*<replacement>*/
|
|
var bufferShim = __webpack_require__(37);
|
|
/*</replacement>*/
|
|
|
|
util.inherits(Writable, Stream);
|
|
|
|
function nop() {}
|
|
|
|
function WriteReq(chunk, encoding, cb) {
|
|
this.chunk = chunk;
|
|
this.encoding = encoding;
|
|
this.callback = cb;
|
|
this.next = null;
|
|
}
|
|
|
|
function WritableState(options, stream) {
|
|
Duplex = Duplex || __webpack_require__(41);
|
|
|
|
options = options || {};
|
|
|
|
// object stream flag to indicate whether or not this stream
|
|
// contains buffers or objects.
|
|
this.objectMode = !!options.objectMode;
|
|
|
|
if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
|
|
|
|
// the point at which write() starts returning false
|
|
// Note: 0 is a valid value, means that we always return false if
|
|
// the entire buffer is not flushed immediately on write()
|
|
var hwm = options.highWaterMark;
|
|
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
|
this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
|
|
|
|
// cast to ints.
|
|
this.highWaterMark = ~ ~this.highWaterMark;
|
|
|
|
// drain event flag.
|
|
this.needDrain = false;
|
|
// at the start of calling end()
|
|
this.ending = false;
|
|
// when end() has been called, and returned
|
|
this.ended = false;
|
|
// when 'finish' is emitted
|
|
this.finished = false;
|
|
|
|
// should we decode strings into buffers before passing to _write?
|
|
// this is here so that some node-core streams can optimize string
|
|
// handling at a lower level.
|
|
var noDecode = options.decodeStrings === false;
|
|
this.decodeStrings = !noDecode;
|
|
|
|
// Crypto is kind of old and crusty. Historically, its default string
|
|
// encoding is 'binary' so we have to make this configurable.
|
|
// Everything else in the universe uses 'utf8', though.
|
|
this.defaultEncoding = options.defaultEncoding || 'utf8';
|
|
|
|
// not an actual buffer we keep track of, but a measurement
|
|
// of how much we're waiting to get pushed to some underlying
|
|
// socket or file.
|
|
this.length = 0;
|
|
|
|
// a flag to see when we're in the middle of a write.
|
|
this.writing = false;
|
|
|
|
// when true all writes will be buffered until .uncork() call
|
|
this.corked = 0;
|
|
|
|
// a flag to be able to tell if the onwrite cb is called immediately,
|
|
// or on a later tick. We set this to true at first, because any
|
|
// actions that shouldn't happen until "later" should generally also
|
|
// not happen before the first write call.
|
|
this.sync = true;
|
|
|
|
// a flag to know if we're processing previously buffered items, which
|
|
// may call the _write() callback in the same tick, so that we don't
|
|
// end up in an overlapped onwrite situation.
|
|
this.bufferProcessing = false;
|
|
|
|
// the callback that's passed to _write(chunk,cb)
|
|
this.onwrite = function (er) {
|
|
onwrite(stream, er);
|
|
};
|
|
|
|
// the callback that the user supplies to write(chunk,encoding,cb)
|
|
this.writecb = null;
|
|
|
|
// the amount that is being written when _write is called.
|
|
this.writelen = 0;
|
|
|
|
this.bufferedRequest = null;
|
|
this.lastBufferedRequest = null;
|
|
|
|
// number of pending user-supplied write callbacks
|
|
// this must be 0 before 'finish' can be emitted
|
|
this.pendingcb = 0;
|
|
|
|
// emit prefinish if the only thing we're waiting for is _write cbs
|
|
// This is relevant for synchronous Transform streams
|
|
this.prefinished = false;
|
|
|
|
// True if the error was already emitted and should not be thrown again
|
|
this.errorEmitted = false;
|
|
|
|
// count buffered requests
|
|
this.bufferedRequestCount = 0;
|
|
|
|
// allocate the first CorkedRequest, there is always
|
|
// one allocated and free to use, and we maintain at most two
|
|
this.corkedRequestsFree = new CorkedRequest(this);
|
|
}
|
|
|
|
WritableState.prototype.getBuffer = function getBuffer() {
|
|
var current = this.bufferedRequest;
|
|
var out = [];
|
|
while (current) {
|
|
out.push(current);
|
|
current = current.next;
|
|
}
|
|
return out;
|
|
};
|
|
|
|
(function () {
|
|
try {
|
|
Object.defineProperty(WritableState.prototype, 'buffer', {
|
|
get: internalUtil.deprecate(function () {
|
|
return this.getBuffer();
|
|
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
|
|
});
|
|
} catch (_) {}
|
|
})();
|
|
|
|
// Test _writableState for inheritance to account for Duplex streams,
|
|
// whose prototype chain only points to Readable.
|
|
var realHasInstance;
|
|
if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
|
|
realHasInstance = Function.prototype[Symbol.hasInstance];
|
|
Object.defineProperty(Writable, Symbol.hasInstance, {
|
|
value: function (object) {
|
|
if (realHasInstance.call(this, object)) return true;
|
|
|
|
return object && object._writableState instanceof WritableState;
|
|
}
|
|
});
|
|
} else {
|
|
realHasInstance = function (object) {
|
|
return object instanceof this;
|
|
};
|
|
}
|
|
|
|
function Writable(options) {
|
|
Duplex = Duplex || __webpack_require__(41);
|
|
|
|
// Writable ctor is applied to Duplexes, too.
|
|
// `realHasInstance` is necessary because using plain `instanceof`
|
|
// would return false, as no `_writableState` property is attached.
|
|
|
|
// Trying to use the custom `instanceof` for Writable here will also break the
|
|
// Node.js LazyTransform implementation, which has a non-trivial getter for
|
|
// `_writableState` that would lead to infinite recursion.
|
|
if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
|
|
return new Writable(options);
|
|
}
|
|
|
|
this._writableState = new WritableState(options, this);
|
|
|
|
// legacy.
|
|
this.writable = true;
|
|
|
|
if (options) {
|
|
if (typeof options.write === 'function') this._write = options.write;
|
|
|
|
if (typeof options.writev === 'function') this._writev = options.writev;
|
|
}
|
|
|
|
Stream.call(this);
|
|
}
|
|
|
|
// Otherwise people can pipe Writable streams, which is just wrong.
|
|
Writable.prototype.pipe = function () {
|
|
this.emit('error', new Error('Cannot pipe, not readable'));
|
|
};
|
|
|
|
function writeAfterEnd(stream, cb) {
|
|
var er = new Error('write after end');
|
|
// TODO: defer error events consistently everywhere, not just the cb
|
|
stream.emit('error', er);
|
|
processNextTick(cb, er);
|
|
}
|
|
|
|
// If we get something that is not a buffer, string, null, or undefined,
|
|
// and we're not in objectMode, then that's an error.
|
|
// Otherwise stream chunks are all considered to be of length=1, and the
|
|
// watermarks determine how many objects to keep in the buffer, rather than
|
|
// how many bytes or characters.
|
|
function validChunk(stream, state, chunk, cb) {
|
|
var valid = true;
|
|
var er = false;
|
|
// Always throw error if a null is written
|
|
// if we are not in object mode then throw
|
|
// if it is not a buffer, string, or undefined.
|
|
if (chunk === null) {
|
|
er = new TypeError('May not write null values to stream');
|
|
} else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
|
er = new TypeError('Invalid non-string/buffer chunk');
|
|
}
|
|
if (er) {
|
|
stream.emit('error', er);
|
|
processNextTick(cb, er);
|
|
valid = false;
|
|
}
|
|
return valid;
|
|
}
|
|
|
|
Writable.prototype.write = function (chunk, encoding, cb) {
|
|
var state = this._writableState;
|
|
var ret = false;
|
|
|
|
if (typeof encoding === 'function') {
|
|
cb = encoding;
|
|
encoding = null;
|
|
}
|
|
|
|
if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
|
|
|
|
if (typeof cb !== 'function') cb = nop;
|
|
|
|
if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {
|
|
state.pendingcb++;
|
|
ret = writeOrBuffer(this, state, chunk, encoding, cb);
|
|
}
|
|
|
|
return ret;
|
|
};
|
|
|
|
Writable.prototype.cork = function () {
|
|
var state = this._writableState;
|
|
|
|
state.corked++;
|
|
};
|
|
|
|
Writable.prototype.uncork = function () {
|
|
var state = this._writableState;
|
|
|
|
if (state.corked) {
|
|
state.corked--;
|
|
|
|
if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
|
}
|
|
};
|
|
|
|
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
|
// node::ParseEncoding() requires lower case.
|
|
if (typeof encoding === 'string') encoding = encoding.toLowerCase();
|
|
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
|
|
this._writableState.defaultEncoding = encoding;
|
|
return this;
|
|
};
|
|
|
|
function decodeChunk(state, chunk, encoding) {
|
|
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
|
|
chunk = bufferShim.from(chunk, encoding);
|
|
}
|
|
return chunk;
|
|
}
|
|
|
|
// if we're already writing something, then just put this
|
|
// in the queue, and wait our turn. Otherwise, call _write
|
|
// If we return false, then we need a drain event, so set that flag.
|
|
function writeOrBuffer(stream, state, chunk, encoding, cb) {
|
|
chunk = decodeChunk(state, chunk, encoding);
|
|
|
|
if (Buffer.isBuffer(chunk)) encoding = 'buffer';
|
|
var len = state.objectMode ? 1 : chunk.length;
|
|
|
|
state.length += len;
|
|
|
|
var ret = state.length < state.highWaterMark;
|
|
// we must ensure that previous needDrain will not be reset to false.
|
|
if (!ret) state.needDrain = true;
|
|
|
|
if (state.writing || state.corked) {
|
|
var last = state.lastBufferedRequest;
|
|
state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
|
|
if (last) {
|
|
last.next = state.lastBufferedRequest;
|
|
} else {
|
|
state.bufferedRequest = state.lastBufferedRequest;
|
|
}
|
|
state.bufferedRequestCount += 1;
|
|
} else {
|
|
doWrite(stream, state, false, len, chunk, encoding, cb);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
|
state.writelen = len;
|
|
state.writecb = cb;
|
|
state.writing = true;
|
|
state.sync = true;
|
|
if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
|
|
state.sync = false;
|
|
}
|
|
|
|
function onwriteError(stream, state, sync, er, cb) {
|
|
--state.pendingcb;
|
|
if (sync) processNextTick(cb, er);else cb(er);
|
|
|
|
stream._writableState.errorEmitted = true;
|
|
stream.emit('error', er);
|
|
}
|
|
|
|
function onwriteStateUpdate(state) {
|
|
state.writing = false;
|
|
state.writecb = null;
|
|
state.length -= state.writelen;
|
|
state.writelen = 0;
|
|
}
|
|
|
|
function onwrite(stream, er) {
|
|
var state = stream._writableState;
|
|
var sync = state.sync;
|
|
var cb = state.writecb;
|
|
|
|
onwriteStateUpdate(state);
|
|
|
|
if (er) onwriteError(stream, state, sync, er, cb);else {
|
|
// Check if we're actually ready to finish, but don't emit yet
|
|
var finished = needFinish(state);
|
|
|
|
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
|
clearBuffer(stream, state);
|
|
}
|
|
|
|
if (sync) {
|
|
/*<replacement>*/
|
|
asyncWrite(afterWrite, stream, state, finished, cb);
|
|
/*</replacement>*/
|
|
} else {
|
|
afterWrite(stream, state, finished, cb);
|
|
}
|
|
}
|
|
}
|
|
|
|
function afterWrite(stream, state, finished, cb) {
|
|
if (!finished) onwriteDrain(stream, state);
|
|
state.pendingcb--;
|
|
cb();
|
|
finishMaybe(stream, state);
|
|
}
|
|
|
|
// Must force callback to be called on nextTick, so that we don't
|
|
// emit 'drain' before the write() consumer gets the 'false' return
|
|
// value, and has a chance to attach a 'drain' listener.
|
|
function onwriteDrain(stream, state) {
|
|
if (state.length === 0 && state.needDrain) {
|
|
state.needDrain = false;
|
|
stream.emit('drain');
|
|
}
|
|
}
|
|
|
|
// if there's something in the buffer waiting, then process it
|
|
function clearBuffer(stream, state) {
|
|
state.bufferProcessing = true;
|
|
var entry = state.bufferedRequest;
|
|
|
|
if (stream._writev && entry && entry.next) {
|
|
// Fast case, write everything using _writev()
|
|
var l = state.bufferedRequestCount;
|
|
var buffer = new Array(l);
|
|
var holder = state.corkedRequestsFree;
|
|
holder.entry = entry;
|
|
|
|
var count = 0;
|
|
while (entry) {
|
|
buffer[count] = entry;
|
|
entry = entry.next;
|
|
count += 1;
|
|
}
|
|
|
|
doWrite(stream, state, true, state.length, buffer, '', holder.finish);
|
|
|
|
// doWrite is almost always async, defer these to save a bit of time
|
|
// as the hot path ends with doWrite
|
|
state.pendingcb++;
|
|
state.lastBufferedRequest = null;
|
|
if (holder.next) {
|
|
state.corkedRequestsFree = holder.next;
|
|
holder.next = null;
|
|
} else {
|
|
state.corkedRequestsFree = new CorkedRequest(state);
|
|
}
|
|
} else {
|
|
// Slow case, write chunks one-by-one
|
|
while (entry) {
|
|
var chunk = entry.chunk;
|
|
var encoding = entry.encoding;
|
|
var cb = entry.callback;
|
|
var len = state.objectMode ? 1 : chunk.length;
|
|
|
|
doWrite(stream, state, false, len, chunk, encoding, cb);
|
|
entry = entry.next;
|
|
// if we didn't call the onwrite immediately, then
|
|
// it means that we need to wait until it does.
|
|
// also, that means that the chunk and cb are currently
|
|
// being processed, so move the buffer counter past them.
|
|
if (state.writing) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (entry === null) state.lastBufferedRequest = null;
|
|
}
|
|
|
|
state.bufferedRequestCount = 0;
|
|
state.bufferedRequest = entry;
|
|
state.bufferProcessing = false;
|
|
}
|
|
|
|
Writable.prototype._write = function (chunk, encoding, cb) {
|
|
cb(new Error('_write() is not implemented'));
|
|
};
|
|
|
|
Writable.prototype._writev = null;
|
|
|
|
Writable.prototype.end = function (chunk, encoding, cb) {
|
|
var state = this._writableState;
|
|
|
|
if (typeof chunk === 'function') {
|
|
cb = chunk;
|
|
chunk = null;
|
|
encoding = null;
|
|
} else if (typeof encoding === 'function') {
|
|
cb = encoding;
|
|
encoding = null;
|
|
}
|
|
|
|
if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
|
|
|
|
// .end() fully uncorks
|
|
if (state.corked) {
|
|
state.corked = 1;
|
|
this.uncork();
|
|
}
|
|
|
|
// ignore unnecessary end() calls.
|
|
if (!state.ending && !state.finished) endWritable(this, state, cb);
|
|
};
|
|
|
|
function needFinish(state) {
|
|
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
|
}
|
|
|
|
function prefinish(stream, state) {
|
|
if (!state.prefinished) {
|
|
state.prefinished = true;
|
|
stream.emit('prefinish');
|
|
}
|
|
}
|
|
|
|
function finishMaybe(stream, state) {
|
|
var need = needFinish(state);
|
|
if (need) {
|
|
if (state.pendingcb === 0) {
|
|
prefinish(stream, state);
|
|
state.finished = true;
|
|
stream.emit('finish');
|
|
} else {
|
|
prefinish(stream, state);
|
|
}
|
|
}
|
|
return need;
|
|
}
|
|
|
|
function endWritable(stream, state, cb) {
|
|
state.ending = true;
|
|
finishMaybe(stream, state);
|
|
if (cb) {
|
|
if (state.finished) processNextTick(cb);else stream.once('finish', cb);
|
|
}
|
|
state.ended = true;
|
|
stream.writable = false;
|
|
}
|
|
|
|
// It seems a linked list but it is not
|
|
// there will be only 2 of these for each stream
|
|
function CorkedRequest(state) {
|
|
var _this = this;
|
|
|
|
this.next = null;
|
|
this.entry = null;
|
|
|
|
this.finish = function (err) {
|
|
var entry = _this.entry;
|
|
_this.entry = null;
|
|
while (entry) {
|
|
var cb = entry.callback;
|
|
state.pendingcb--;
|
|
cb(err);
|
|
entry = entry.next;
|
|
}
|
|
if (state.corkedRequestsFree) {
|
|
state.corkedRequestsFree.next = _this;
|
|
} else {
|
|
state.corkedRequestsFree = _this;
|
|
}
|
|
};
|
|
}
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(34), __webpack_require__(43).setImmediate))
|
|
|
|
/***/ },
|
|
/* 43 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var apply = Function.prototype.apply;
|
|
|
|
// DOM APIs, for completeness
|
|
|
|
exports.setTimeout = function() {
|
|
return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
|
|
};
|
|
exports.setInterval = function() {
|
|
return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
|
|
};
|
|
exports.clearTimeout =
|
|
exports.clearInterval = function(timeout) {
|
|
if (timeout) {
|
|
timeout.close();
|
|
}
|
|
};
|
|
|
|
function Timeout(id, clearFn) {
|
|
this._id = id;
|
|
this._clearFn = clearFn;
|
|
}
|
|
Timeout.prototype.unref = Timeout.prototype.ref = function() {};
|
|
Timeout.prototype.close = function() {
|
|
this._clearFn.call(window, this._id);
|
|
};
|
|
|
|
// Does not start the time, just sets up the members needed.
|
|
exports.enroll = function(item, msecs) {
|
|
clearTimeout(item._idleTimeoutId);
|
|
item._idleTimeout = msecs;
|
|
};
|
|
|
|
exports.unenroll = function(item) {
|
|
clearTimeout(item._idleTimeoutId);
|
|
item._idleTimeout = -1;
|
|
};
|
|
|
|
exports._unrefActive = exports.active = function(item) {
|
|
clearTimeout(item._idleTimeoutId);
|
|
|
|
var msecs = item._idleTimeout;
|
|
if (msecs >= 0) {
|
|
item._idleTimeoutId = setTimeout(function onTimeout() {
|
|
if (item._onTimeout)
|
|
item._onTimeout();
|
|
}, msecs);
|
|
}
|
|
};
|
|
|
|
// setimmediate attaches itself to the global object
|
|
__webpack_require__(44);
|
|
exports.setImmediate = setImmediate;
|
|
exports.clearImmediate = clearImmediate;
|
|
|
|
|
|
/***/ },
|
|
/* 44 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
|
|
"use strict";
|
|
|
|
if (global.setImmediate) {
|
|
return;
|
|
}
|
|
|
|
var nextHandle = 1; // Spec says greater than zero
|
|
var tasksByHandle = {};
|
|
var currentlyRunningATask = false;
|
|
var doc = global.document;
|
|
var registerImmediate;
|
|
|
|
function setImmediate(callback) {
|
|
// Callback can either be a function or a string
|
|
if (typeof callback !== "function") {
|
|
callback = new Function("" + callback);
|
|
}
|
|
// Copy function arguments
|
|
var args = new Array(arguments.length - 1);
|
|
for (var i = 0; i < args.length; i++) {
|
|
args[i] = arguments[i + 1];
|
|
}
|
|
// Store and register the task
|
|
var task = { callback: callback, args: args };
|
|
tasksByHandle[nextHandle] = task;
|
|
registerImmediate(nextHandle);
|
|
return nextHandle++;
|
|
}
|
|
|
|
function clearImmediate(handle) {
|
|
delete tasksByHandle[handle];
|
|
}
|
|
|
|
function run(task) {
|
|
var callback = task.callback;
|
|
var args = task.args;
|
|
switch (args.length) {
|
|
case 0:
|
|
callback();
|
|
break;
|
|
case 1:
|
|
callback(args[0]);
|
|
break;
|
|
case 2:
|
|
callback(args[0], args[1]);
|
|
break;
|
|
case 3:
|
|
callback(args[0], args[1], args[2]);
|
|
break;
|
|
default:
|
|
callback.apply(undefined, args);
|
|
break;
|
|
}
|
|
}
|
|
|
|
function runIfPresent(handle) {
|
|
// From the spec: "Wait until any invocations of this algorithm started before this one have completed."
|
|
// So if we're currently running a task, we'll need to delay this invocation.
|
|
if (currentlyRunningATask) {
|
|
// Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
|
|
// "too much recursion" error.
|
|
setTimeout(runIfPresent, 0, handle);
|
|
} else {
|
|
var task = tasksByHandle[handle];
|
|
if (task) {
|
|
currentlyRunningATask = true;
|
|
try {
|
|
run(task);
|
|
} finally {
|
|
clearImmediate(handle);
|
|
currentlyRunningATask = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function installNextTickImplementation() {
|
|
registerImmediate = function(handle) {
|
|
process.nextTick(function () { runIfPresent(handle); });
|
|
};
|
|
}
|
|
|
|
function canUsePostMessage() {
|
|
// The test against `importScripts` prevents this implementation from being installed inside a web worker,
|
|
// where `global.postMessage` means something completely different and can't be used for this purpose.
|
|
if (global.postMessage && !global.importScripts) {
|
|
var postMessageIsAsynchronous = true;
|
|
var oldOnMessage = global.onmessage;
|
|
global.onmessage = function() {
|
|
postMessageIsAsynchronous = false;
|
|
};
|
|
global.postMessage("", "*");
|
|
global.onmessage = oldOnMessage;
|
|
return postMessageIsAsynchronous;
|
|
}
|
|
}
|
|
|
|
function installPostMessageImplementation() {
|
|
// Installs an event handler on `global` for the `message` event: see
|
|
// * https://developer.mozilla.org/en/DOM/window.postMessage
|
|
// * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
|
|
|
|
var messagePrefix = "setImmediate$" + Math.random() + "$";
|
|
var onGlobalMessage = function(event) {
|
|
if (event.source === global &&
|
|
typeof event.data === "string" &&
|
|
event.data.indexOf(messagePrefix) === 0) {
|
|
runIfPresent(+event.data.slice(messagePrefix.length));
|
|
}
|
|
};
|
|
|
|
if (global.addEventListener) {
|
|
global.addEventListener("message", onGlobalMessage, false);
|
|
} else {
|
|
global.attachEvent("onmessage", onGlobalMessage);
|
|
}
|
|
|
|
registerImmediate = function(handle) {
|
|
global.postMessage(messagePrefix + handle, "*");
|
|
};
|
|
}
|
|
|
|
function installMessageChannelImplementation() {
|
|
var channel = new MessageChannel();
|
|
channel.port1.onmessage = function(event) {
|
|
var handle = event.data;
|
|
runIfPresent(handle);
|
|
};
|
|
|
|
registerImmediate = function(handle) {
|
|
channel.port2.postMessage(handle);
|
|
};
|
|
}
|
|
|
|
function installReadyStateChangeImplementation() {
|
|
var html = doc.documentElement;
|
|
registerImmediate = function(handle) {
|
|
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
|
|
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
|
|
var script = doc.createElement("script");
|
|
script.onreadystatechange = function () {
|
|
runIfPresent(handle);
|
|
script.onreadystatechange = null;
|
|
html.removeChild(script);
|
|
script = null;
|
|
};
|
|
html.appendChild(script);
|
|
};
|
|
}
|
|
|
|
function installSetTimeoutImplementation() {
|
|
registerImmediate = function(handle) {
|
|
setTimeout(runIfPresent, 0, handle);
|
|
};
|
|
}
|
|
|
|
// If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
|
|
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
|
|
attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
|
|
|
|
// Don't get fooled by e.g. browserify environments.
|
|
if ({}.toString.call(global.process) === "[object process]") {
|
|
// For Node.js before 0.9
|
|
installNextTickImplementation();
|
|
|
|
} else if (canUsePostMessage()) {
|
|
// For non-IE10 modern browsers
|
|
installPostMessageImplementation();
|
|
|
|
} else if (global.MessageChannel) {
|
|
// For web workers, where supported
|
|
installMessageChannelImplementation();
|
|
|
|
} else if (doc && "onreadystatechange" in doc.createElement("script")) {
|
|
// For IE 6–8
|
|
installReadyStateChangeImplementation();
|
|
|
|
} else {
|
|
// For older browsers
|
|
installSetTimeoutImplementation();
|
|
}
|
|
|
|
attachTo.setImmediate = setImmediate;
|
|
attachTo.clearImmediate = clearImmediate;
|
|
}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(34)))
|
|
|
|
/***/ },
|
|
/* 45 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(global) {
|
|
/**
|
|
* Module exports.
|
|
*/
|
|
|
|
module.exports = deprecate;
|
|
|
|
/**
|
|
* Mark that a method should not be used.
|
|
* Returns a modified function which warns once by default.
|
|
*
|
|
* If `localStorage.noDeprecation = true` is set, then it is a no-op.
|
|
*
|
|
* If `localStorage.throwDeprecation = true` is set, then deprecated functions
|
|
* will throw an Error when invoked.
|
|
*
|
|
* If `localStorage.traceDeprecation = true` is set, then deprecated functions
|
|
* will invoke `console.trace()` instead of `console.error()`.
|
|
*
|
|
* @param {Function} fn - the function to deprecate
|
|
* @param {String} msg - the string to print to the console when `fn` is invoked
|
|
* @returns {Function} a new "deprecated" version of `fn`
|
|
* @api public
|
|
*/
|
|
|
|
function deprecate (fn, msg) {
|
|
if (config('noDeprecation')) {
|
|
return fn;
|
|
}
|
|
|
|
var warned = false;
|
|
function deprecated() {
|
|
if (!warned) {
|
|
if (config('throwDeprecation')) {
|
|
throw new Error(msg);
|
|
} else if (config('traceDeprecation')) {
|
|
console.trace(msg);
|
|
} else {
|
|
console.warn(msg);
|
|
}
|
|
warned = true;
|
|
}
|
|
return fn.apply(this, arguments);
|
|
}
|
|
|
|
return deprecated;
|
|
}
|
|
|
|
/**
|
|
* Checks `localStorage` for boolean values for the given `name`.
|
|
*
|
|
* @param {String} name
|
|
* @returns {Boolean}
|
|
* @api private
|
|
*/
|
|
|
|
function config (name) {
|
|
// accessing global.localStorage can trigger a DOMException in sandboxed iframes
|
|
try {
|
|
if (!global.localStorage) return false;
|
|
} catch (_) {
|
|
return false;
|
|
}
|
|
var val = global.localStorage[name];
|
|
if (null == val) return false;
|
|
return String(val).toLowerCase() === 'true';
|
|
}
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
|
|
|
/***/ },
|
|
/* 46 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
var Buffer = __webpack_require__(2).Buffer;
|
|
|
|
var isBufferEncoding = Buffer.isEncoding
|
|
|| function(encoding) {
|
|
switch (encoding && encoding.toLowerCase()) {
|
|
case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
|
|
default: return false;
|
|
}
|
|
}
|
|
|
|
|
|
function assertEncoding(encoding) {
|
|
if (encoding && !isBufferEncoding(encoding)) {
|
|
throw new Error('Unknown encoding: ' + encoding);
|
|
}
|
|
}
|
|
|
|
// StringDecoder provides an interface for efficiently splitting a series of
|
|
// buffers into a series of JS strings without breaking apart multi-byte
|
|
// characters. CESU-8 is handled as part of the UTF-8 encoding.
|
|
//
|
|
// @TODO Handling all encodings inside a single object makes it very difficult
|
|
// to reason about this code, so it should be split up in the future.
|
|
// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
|
|
// points as used by CESU-8.
|
|
var StringDecoder = exports.StringDecoder = function(encoding) {
|
|
this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
|
|
assertEncoding(encoding);
|
|
switch (this.encoding) {
|
|
case 'utf8':
|
|
// CESU-8 represents each of Surrogate Pair by 3-bytes
|
|
this.surrogateSize = 3;
|
|
break;
|
|
case 'ucs2':
|
|
case 'utf16le':
|
|
// UTF-16 represents each of Surrogate Pair by 2-bytes
|
|
this.surrogateSize = 2;
|
|
this.detectIncompleteChar = utf16DetectIncompleteChar;
|
|
break;
|
|
case 'base64':
|
|
// Base-64 stores 3 bytes in 4 chars, and pads the remainder.
|
|
this.surrogateSize = 3;
|
|
this.detectIncompleteChar = base64DetectIncompleteChar;
|
|
break;
|
|
default:
|
|
this.write = passThroughWrite;
|
|
return;
|
|
}
|
|
|
|
// Enough space to store all bytes of a single character. UTF-8 needs 4
|
|
// bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
|
|
this.charBuffer = new Buffer(6);
|
|
// Number of bytes received for the current incomplete multi-byte character.
|
|
this.charReceived = 0;
|
|
// Number of bytes expected for the current incomplete multi-byte character.
|
|
this.charLength = 0;
|
|
};
|
|
|
|
|
|
// write decodes the given buffer and returns it as JS string that is
|
|
// guaranteed to not contain any partial multi-byte characters. Any partial
|
|
// character found at the end of the buffer is buffered up, and will be
|
|
// returned when calling write again with the remaining bytes.
|
|
//
|
|
// Note: Converting a Buffer containing an orphan surrogate to a String
|
|
// currently works, but converting a String to a Buffer (via `new Buffer`, or
|
|
// Buffer#write) will replace incomplete surrogates with the unicode
|
|
// replacement character. See https://codereview.chromium.org/121173009/ .
|
|
StringDecoder.prototype.write = function(buffer) {
|
|
var charStr = '';
|
|
// if our last write ended with an incomplete multibyte character
|
|
while (this.charLength) {
|
|
// determine how many remaining bytes this buffer has to offer for this char
|
|
var available = (buffer.length >= this.charLength - this.charReceived) ?
|
|
this.charLength - this.charReceived :
|
|
buffer.length;
|
|
|
|
// add the new bytes to the char buffer
|
|
buffer.copy(this.charBuffer, this.charReceived, 0, available);
|
|
this.charReceived += available;
|
|
|
|
if (this.charReceived < this.charLength) {
|
|
// still not enough chars in this buffer? wait for more ...
|
|
return '';
|
|
}
|
|
|
|
// remove bytes belonging to the current character from the buffer
|
|
buffer = buffer.slice(available, buffer.length);
|
|
|
|
// get the character that was split
|
|
charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
|
|
|
|
// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
|
|
var charCode = charStr.charCodeAt(charStr.length - 1);
|
|
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
|
this.charLength += this.surrogateSize;
|
|
charStr = '';
|
|
continue;
|
|
}
|
|
this.charReceived = this.charLength = 0;
|
|
|
|
// if there are no more bytes in this buffer, just emit our char
|
|
if (buffer.length === 0) {
|
|
return charStr;
|
|
}
|
|
break;
|
|
}
|
|
|
|
// determine and set charLength / charReceived
|
|
this.detectIncompleteChar(buffer);
|
|
|
|
var end = buffer.length;
|
|
if (this.charLength) {
|
|
// buffer the incomplete character bytes we got
|
|
buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
|
|
end -= this.charReceived;
|
|
}
|
|
|
|
charStr += buffer.toString(this.encoding, 0, end);
|
|
|
|
var end = charStr.length - 1;
|
|
var charCode = charStr.charCodeAt(end);
|
|
// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
|
|
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
|
var size = this.surrogateSize;
|
|
this.charLength += size;
|
|
this.charReceived += size;
|
|
this.charBuffer.copy(this.charBuffer, size, 0, size);
|
|
buffer.copy(this.charBuffer, 0, 0, size);
|
|
return charStr.substring(0, end);
|
|
}
|
|
|
|
// or just emit the charStr
|
|
return charStr;
|
|
};
|
|
|
|
// detectIncompleteChar determines if there is an incomplete UTF-8 character at
|
|
// the end of the given buffer. If so, it sets this.charLength to the byte
|
|
// length that character, and sets this.charReceived to the number of bytes
|
|
// that are available for this character.
|
|
StringDecoder.prototype.detectIncompleteChar = function(buffer) {
|
|
// determine how many bytes we have to check at the end of this buffer
|
|
var i = (buffer.length >= 3) ? 3 : buffer.length;
|
|
|
|
// Figure out if one of the last i bytes of our buffer announces an
|
|
// incomplete char.
|
|
for (; i > 0; i--) {
|
|
var c = buffer[buffer.length - i];
|
|
|
|
// See http://en.wikipedia.org/wiki/UTF-8#Description
|
|
|
|
// 110XXXXX
|
|
if (i == 1 && c >> 5 == 0x06) {
|
|
this.charLength = 2;
|
|
break;
|
|
}
|
|
|
|
// 1110XXXX
|
|
if (i <= 2 && c >> 4 == 0x0E) {
|
|
this.charLength = 3;
|
|
break;
|
|
}
|
|
|
|
// 11110XXX
|
|
if (i <= 3 && c >> 3 == 0x1E) {
|
|
this.charLength = 4;
|
|
break;
|
|
}
|
|
}
|
|
this.charReceived = i;
|
|
};
|
|
|
|
StringDecoder.prototype.end = function(buffer) {
|
|
var res = '';
|
|
if (buffer && buffer.length)
|
|
res = this.write(buffer);
|
|
|
|
if (this.charReceived) {
|
|
var cr = this.charReceived;
|
|
var buf = this.charBuffer;
|
|
var enc = this.encoding;
|
|
res += buf.slice(0, cr).toString(enc);
|
|
}
|
|
|
|
return res;
|
|
};
|
|
|
|
function passThroughWrite(buffer) {
|
|
return buffer.toString(this.encoding);
|
|
}
|
|
|
|
function utf16DetectIncompleteChar(buffer) {
|
|
this.charReceived = buffer.length % 2;
|
|
this.charLength = this.charReceived ? 2 : 0;
|
|
}
|
|
|
|
function base64DetectIncompleteChar(buffer) {
|
|
this.charReceived = buffer.length % 3;
|
|
this.charLength = this.charReceived ? 3 : 0;
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 47 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// a transform stream is a readable/writable stream where you do
|
|
// something with the data. Sometimes it's called a "filter",
|
|
// but that's not a great name for it, since that implies a thing where
|
|
// some bits pass through, and others are simply ignored. (That would
|
|
// be a valid example of a transform, of course.)
|
|
//
|
|
// While the output is causally related to the input, it's not a
|
|
// necessarily symmetric or synchronous transformation. For example,
|
|
// a zlib stream might take multiple plain-text writes(), and then
|
|
// emit a single compressed chunk some time in the future.
|
|
//
|
|
// Here's how this works:
|
|
//
|
|
// The Transform stream has all the aspects of the readable and writable
|
|
// stream classes. When you write(chunk), that calls _write(chunk,cb)
|
|
// internally, and returns false if there's a lot of pending writes
|
|
// buffered up. When you call read(), that calls _read(n) until
|
|
// there's enough pending readable data buffered up.
|
|
//
|
|
// In a transform stream, the written data is placed in a buffer. When
|
|
// _read(n) is called, it transforms the queued up data, calling the
|
|
// buffered _write cb's as it consumes chunks. If consuming a single
|
|
// written chunk would result in multiple output chunks, then the first
|
|
// outputted bit calls the readcb, and subsequent chunks just go into
|
|
// the read buffer, and will cause it to emit 'readable' if necessary.
|
|
//
|
|
// This way, back-pressure is actually determined by the reading side,
|
|
// since _read has to be called to start processing a new chunk. However,
|
|
// a pathological inflate type of transform can cause excessive buffering
|
|
// here. For example, imagine a stream where every byte of input is
|
|
// interpreted as an integer from 0-255, and then results in that many
|
|
// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
|
|
// 1kb of data being output. In this case, you could write a very small
|
|
// amount of input, and end up with a very large amount of output. In
|
|
// such a pathological inflating mechanism, there'd be no way to tell
|
|
// the system to stop doing the transform. A single 4MB write could
|
|
// cause the system to run out of memory.
|
|
//
|
|
// However, even in such a pathological case, only a single written chunk
|
|
// would be consumed, and then the rest would wait (un-transformed) until
|
|
// the results of the previous transformed chunk were consumed.
|
|
|
|
'use strict';
|
|
|
|
module.exports = Transform;
|
|
|
|
var Duplex = __webpack_require__(41);
|
|
|
|
/*<replacement>*/
|
|
var util = __webpack_require__(38);
|
|
util.inherits = __webpack_require__(32);
|
|
/*</replacement>*/
|
|
|
|
util.inherits(Transform, Duplex);
|
|
|
|
function TransformState(stream) {
|
|
this.afterTransform = function (er, data) {
|
|
return afterTransform(stream, er, data);
|
|
};
|
|
|
|
this.needTransform = false;
|
|
this.transforming = false;
|
|
this.writecb = null;
|
|
this.writechunk = null;
|
|
this.writeencoding = null;
|
|
}
|
|
|
|
function afterTransform(stream, er, data) {
|
|
var ts = stream._transformState;
|
|
ts.transforming = false;
|
|
|
|
var cb = ts.writecb;
|
|
|
|
if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));
|
|
|
|
ts.writechunk = null;
|
|
ts.writecb = null;
|
|
|
|
if (data !== null && data !== undefined) stream.push(data);
|
|
|
|
cb(er);
|
|
|
|
var rs = stream._readableState;
|
|
rs.reading = false;
|
|
if (rs.needReadable || rs.length < rs.highWaterMark) {
|
|
stream._read(rs.highWaterMark);
|
|
}
|
|
}
|
|
|
|
function Transform(options) {
|
|
if (!(this instanceof Transform)) return new Transform(options);
|
|
|
|
Duplex.call(this, options);
|
|
|
|
this._transformState = new TransformState(this);
|
|
|
|
var stream = this;
|
|
|
|
// start out asking for a readable event once data is transformed.
|
|
this._readableState.needReadable = true;
|
|
|
|
// we have implemented the _read method, and done the other things
|
|
// that Readable wants before the first _read call, so unset the
|
|
// sync guard flag.
|
|
this._readableState.sync = false;
|
|
|
|
if (options) {
|
|
if (typeof options.transform === 'function') this._transform = options.transform;
|
|
|
|
if (typeof options.flush === 'function') this._flush = options.flush;
|
|
}
|
|
|
|
// When the writable side finishes, then flush out anything remaining.
|
|
this.once('prefinish', function () {
|
|
if (typeof this._flush === 'function') this._flush(function (er, data) {
|
|
done(stream, er, data);
|
|
});else done(stream);
|
|
});
|
|
}
|
|
|
|
Transform.prototype.push = function (chunk, encoding) {
|
|
this._transformState.needTransform = false;
|
|
return Duplex.prototype.push.call(this, chunk, encoding);
|
|
};
|
|
|
|
// This is the part where you do stuff!
|
|
// override this function in implementation classes.
|
|
// 'chunk' is an input chunk.
|
|
//
|
|
// Call `push(newChunk)` to pass along transformed output
|
|
// to the readable side. You may call 'push' zero or more times.
|
|
//
|
|
// Call `cb(err)` when you are done with this chunk. If you pass
|
|
// an error, then that'll put the hurt on the whole operation. If you
|
|
// never call cb(), then you'll never get another chunk.
|
|
Transform.prototype._transform = function (chunk, encoding, cb) {
|
|
throw new Error('_transform() is not implemented');
|
|
};
|
|
|
|
Transform.prototype._write = function (chunk, encoding, cb) {
|
|
var ts = this._transformState;
|
|
ts.writecb = cb;
|
|
ts.writechunk = chunk;
|
|
ts.writeencoding = encoding;
|
|
if (!ts.transforming) {
|
|
var rs = this._readableState;
|
|
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
|
}
|
|
};
|
|
|
|
// Doesn't matter what the args are here.
|
|
// _transform does all the work.
|
|
// That we got here means that the readable side wants more data.
|
|
Transform.prototype._read = function (n) {
|
|
var ts = this._transformState;
|
|
|
|
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
|
|
ts.transforming = true;
|
|
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
|
} else {
|
|
// mark that we need a transform, so that any data that comes in
|
|
// will get processed, now that we've asked for it.
|
|
ts.needTransform = true;
|
|
}
|
|
};
|
|
|
|
function done(stream, er, data) {
|
|
if (er) return stream.emit('error', er);
|
|
|
|
if (data !== null && data !== undefined) stream.push(data);
|
|
|
|
// if there's nothing in the write buffer, then that means
|
|
// that nothing more will ever be provided
|
|
var ws = stream._writableState;
|
|
var ts = stream._transformState;
|
|
|
|
if (ws.length) throw new Error('Calling transform done when ws.length != 0');
|
|
|
|
if (ts.transforming) throw new Error('Calling transform done when still transforming');
|
|
|
|
return stream.push(null);
|
|
}
|
|
|
|
/***/ },
|
|
/* 48 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// a passthrough stream.
|
|
// basically just the most minimal sort of Transform stream.
|
|
// Every written chunk gets output as-is.
|
|
|
|
'use strict';
|
|
|
|
module.exports = PassThrough;
|
|
|
|
var Transform = __webpack_require__(47);
|
|
|
|
/*<replacement>*/
|
|
var util = __webpack_require__(38);
|
|
util.inherits = __webpack_require__(32);
|
|
/*</replacement>*/
|
|
|
|
util.inherits(PassThrough, Transform);
|
|
|
|
function PassThrough(options) {
|
|
if (!(this instanceof PassThrough)) return new PassThrough(options);
|
|
|
|
Transform.call(this, options);
|
|
}
|
|
|
|
PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
|
cb(null, chunk);
|
|
};
|
|
|
|
/***/ },
|
|
/* 49 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(42)
|
|
|
|
|
|
/***/ },
|
|
/* 50 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(41)
|
|
|
|
|
|
/***/ },
|
|
/* 51 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(47)
|
|
|
|
|
|
/***/ },
|
|
/* 52 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(48)
|
|
|
|
|
|
/***/ },
|
|
/* 53 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer, __dirname) {/* jslint node: true */
|
|
'use strict';
|
|
|
|
function VirtualFileSystem() {
|
|
this.fileSystem = {};
|
|
this.baseSystem = {};
|
|
}
|
|
|
|
VirtualFileSystem.prototype.readFileSync = function (filename) {
|
|
filename = fixFilename(filename);
|
|
|
|
var base64content = this.baseSystem[filename];
|
|
if (base64content) {
|
|
return new Buffer(base64content, 'base64');
|
|
}
|
|
|
|
return this.fileSystem[filename];
|
|
};
|
|
|
|
VirtualFileSystem.prototype.writeFileSync = function (filename, content) {
|
|
this.fileSystem[fixFilename(filename)] = content;
|
|
};
|
|
|
|
VirtualFileSystem.prototype.bindFS = function (data) {
|
|
this.baseSystem = data;
|
|
};
|
|
|
|
|
|
function fixFilename(filename) {
|
|
if (filename.indexOf(__dirname) === 0) {
|
|
filename = filename.substring(__dirname.length);
|
|
}
|
|
|
|
if (filename.indexOf('/') === 0) {
|
|
filename = filename.substring(1);
|
|
}
|
|
|
|
return filename;
|
|
}
|
|
|
|
module.exports = new VirtualFileSystem();
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer, "/"))
|
|
|
|
/***/ },
|
|
/* 54 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Generated by CoffeeScript 1.10.0
|
|
|
|
/*
|
|
PDFObject - converts JavaScript types into their corrisponding PDF types.
|
|
By Devon Govett
|
|
*/
|
|
|
|
(function() {
|
|
var PDFObject, PDFReference;
|
|
|
|
PDFObject = (function() {
|
|
var escapable, escapableRe, pad, swapBytes;
|
|
|
|
function PDFObject() {}
|
|
|
|
pad = function(str, length) {
|
|
return (Array(length + 1).join('0') + str).slice(-length);
|
|
};
|
|
|
|
escapableRe = /[\n\r\t\b\f\(\)\\]/g;
|
|
|
|
escapable = {
|
|
'\n': '\\n',
|
|
'\r': '\\r',
|
|
'\t': '\\t',
|
|
'\b': '\\b',
|
|
'\f': '\\f',
|
|
'\\': '\\\\',
|
|
'(': '\\(',
|
|
')': '\\)'
|
|
};
|
|
|
|
swapBytes = function(buff) {
|
|
var a, i, j, l, ref;
|
|
l = buff.length;
|
|
if (l & 0x01) {
|
|
throw new Error("Buffer length must be even");
|
|
} else {
|
|
for (i = j = 0, ref = l - 1; j < ref; i = j += 2) {
|
|
a = buff[i];
|
|
buff[i] = buff[i + 1];
|
|
buff[i + 1] = a;
|
|
}
|
|
}
|
|
return buff;
|
|
};
|
|
|
|
PDFObject.convert = function(object) {
|
|
var e, i, isUnicode, items, j, key, out, ref, string, val;
|
|
if (typeof object === 'string') {
|
|
return '/' + object;
|
|
} else if (object instanceof String) {
|
|
string = object.replace(escapableRe, function(c) {
|
|
return escapable[c];
|
|
});
|
|
isUnicode = false;
|
|
for (i = j = 0, ref = string.length; j < ref; i = j += 1) {
|
|
if (string.charCodeAt(i) > 0x7f) {
|
|
isUnicode = true;
|
|
break;
|
|
}
|
|
}
|
|
if (isUnicode) {
|
|
string = swapBytes(new Buffer('\ufeff' + string, 'utf16le')).toString('binary');
|
|
}
|
|
return '(' + string + ')';
|
|
} else if (Buffer.isBuffer(object)) {
|
|
return '<' + object.toString('hex') + '>';
|
|
} else if (object instanceof PDFReference) {
|
|
return object.toString();
|
|
} else if (object instanceof Date) {
|
|
return '(D:' + pad(object.getUTCFullYear(), 4) + pad(object.getUTCMonth() + 1, 2) + pad(object.getUTCDate(), 2) + pad(object.getUTCHours(), 2) + pad(object.getUTCMinutes(), 2) + pad(object.getUTCSeconds(), 2) + 'Z)';
|
|
} else if (Array.isArray(object)) {
|
|
items = ((function() {
|
|
var k, len, results;
|
|
results = [];
|
|
for (k = 0, len = object.length; k < len; k++) {
|
|
e = object[k];
|
|
results.push(PDFObject.convert(e));
|
|
}
|
|
return results;
|
|
})()).join(' ');
|
|
return '[' + items + ']';
|
|
} else if ({}.toString.call(object) === '[object Object]') {
|
|
out = ['<<'];
|
|
for (key in object) {
|
|
val = object[key];
|
|
out.push('/' + key + ' ' + PDFObject.convert(val));
|
|
}
|
|
out.push('>>');
|
|
return out.join('\n');
|
|
} else {
|
|
return '' + object;
|
|
}
|
|
};
|
|
|
|
return PDFObject;
|
|
|
|
})();
|
|
|
|
module.exports = PDFObject;
|
|
|
|
PDFReference = __webpack_require__(55);
|
|
|
|
}).call(this);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 55 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Generated by CoffeeScript 1.10.0
|
|
|
|
/*
|
|
PDFReference - represents a reference to another object in the PDF object heirarchy
|
|
By Devon Govett
|
|
*/
|
|
|
|
(function() {
|
|
var PDFObject, PDFReference, stream, zlib,
|
|
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
zlib = __webpack_require__(56);
|
|
|
|
stream = __webpack_require__(30);
|
|
|
|
PDFReference = (function(superClass) {
|
|
extend(PDFReference, superClass);
|
|
|
|
function PDFReference(document, id, data) {
|
|
this.document = document;
|
|
this.id = id;
|
|
this.data = data != null ? data : {};
|
|
this.finalize = bind(this.finalize, this);
|
|
PDFReference.__super__.constructor.call(this, {
|
|
decodeStrings: false
|
|
});
|
|
this.gen = 0;
|
|
this.deflate = null;
|
|
this.compress = this.document.compress && !this.data.Filter;
|
|
this.uncompressedLength = 0;
|
|
this.chunks = [];
|
|
}
|
|
|
|
PDFReference.prototype.initDeflate = function() {
|
|
this.data.Filter = 'FlateDecode';
|
|
this.deflate = zlib.createDeflate();
|
|
this.deflate.on('data', (function(_this) {
|
|
return function(chunk) {
|
|
_this.chunks.push(chunk);
|
|
return _this.data.Length += chunk.length;
|
|
};
|
|
})(this));
|
|
return this.deflate.on('end', this.finalize);
|
|
};
|
|
|
|
PDFReference.prototype._write = function(chunk, encoding, callback) {
|
|
var base;
|
|
if (!Buffer.isBuffer(chunk)) {
|
|
chunk = new Buffer(chunk + '\n', 'binary');
|
|
}
|
|
this.uncompressedLength += chunk.length;
|
|
if ((base = this.data).Length == null) {
|
|
base.Length = 0;
|
|
}
|
|
if (this.compress) {
|
|
if (!this.deflate) {
|
|
this.initDeflate();
|
|
}
|
|
this.deflate.write(chunk);
|
|
} else {
|
|
this.chunks.push(chunk);
|
|
this.data.Length += chunk.length;
|
|
}
|
|
return callback();
|
|
};
|
|
|
|
PDFReference.prototype.end = function(chunk) {
|
|
PDFReference.__super__.end.apply(this, arguments);
|
|
if (this.deflate) {
|
|
return this.deflate.end();
|
|
} else {
|
|
return this.finalize();
|
|
}
|
|
};
|
|
|
|
PDFReference.prototype.finalize = function() {
|
|
var chunk, i, len, ref;
|
|
this.offset = this.document._offset;
|
|
this.document._write(this.id + " " + this.gen + " obj");
|
|
this.document._write(PDFObject.convert(this.data));
|
|
if (this.chunks.length) {
|
|
this.document._write('stream');
|
|
ref = this.chunks;
|
|
for (i = 0, len = ref.length; i < len; i++) {
|
|
chunk = ref[i];
|
|
this.document._write(chunk);
|
|
}
|
|
this.chunks.length = 0;
|
|
this.document._write('\nendstream');
|
|
}
|
|
this.document._write('endobj');
|
|
return this.document._refEnd(this);
|
|
};
|
|
|
|
PDFReference.prototype.toString = function() {
|
|
return this.id + " " + this.gen + " R";
|
|
};
|
|
|
|
return PDFReference;
|
|
|
|
})(stream.Writable);
|
|
|
|
module.exports = PDFReference;
|
|
|
|
PDFObject = __webpack_require__(54);
|
|
|
|
}).call(this);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 56 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer, process) {// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
var Transform = __webpack_require__(51);
|
|
|
|
var binding = __webpack_require__(57);
|
|
var util = __webpack_require__(69);
|
|
var assert = __webpack_require__(72).ok;
|
|
|
|
// zlib doesn't provide these, so kludge them in following the same
|
|
// const naming scheme zlib uses.
|
|
binding.Z_MIN_WINDOWBITS = 8;
|
|
binding.Z_MAX_WINDOWBITS = 15;
|
|
binding.Z_DEFAULT_WINDOWBITS = 15;
|
|
|
|
// fewer than 64 bytes per chunk is stupid.
|
|
// technically it could work with as few as 8, but even 64 bytes
|
|
// is absurdly low. Usually a MB or more is best.
|
|
binding.Z_MIN_CHUNK = 64;
|
|
binding.Z_MAX_CHUNK = Infinity;
|
|
binding.Z_DEFAULT_CHUNK = (16 * 1024);
|
|
|
|
binding.Z_MIN_MEMLEVEL = 1;
|
|
binding.Z_MAX_MEMLEVEL = 9;
|
|
binding.Z_DEFAULT_MEMLEVEL = 8;
|
|
|
|
binding.Z_MIN_LEVEL = -1;
|
|
binding.Z_MAX_LEVEL = 9;
|
|
binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION;
|
|
|
|
// expose all the zlib constants
|
|
Object.keys(binding).forEach(function(k) {
|
|
if (k.match(/^Z/)) exports[k] = binding[k];
|
|
});
|
|
|
|
// translation table for return codes.
|
|
exports.codes = {
|
|
Z_OK: binding.Z_OK,
|
|
Z_STREAM_END: binding.Z_STREAM_END,
|
|
Z_NEED_DICT: binding.Z_NEED_DICT,
|
|
Z_ERRNO: binding.Z_ERRNO,
|
|
Z_STREAM_ERROR: binding.Z_STREAM_ERROR,
|
|
Z_DATA_ERROR: binding.Z_DATA_ERROR,
|
|
Z_MEM_ERROR: binding.Z_MEM_ERROR,
|
|
Z_BUF_ERROR: binding.Z_BUF_ERROR,
|
|
Z_VERSION_ERROR: binding.Z_VERSION_ERROR
|
|
};
|
|
|
|
Object.keys(exports.codes).forEach(function(k) {
|
|
exports.codes[exports.codes[k]] = k;
|
|
});
|
|
|
|
exports.Deflate = Deflate;
|
|
exports.Inflate = Inflate;
|
|
exports.Gzip = Gzip;
|
|
exports.Gunzip = Gunzip;
|
|
exports.DeflateRaw = DeflateRaw;
|
|
exports.InflateRaw = InflateRaw;
|
|
exports.Unzip = Unzip;
|
|
|
|
exports.createDeflate = function(o) {
|
|
return new Deflate(o);
|
|
};
|
|
|
|
exports.createInflate = function(o) {
|
|
return new Inflate(o);
|
|
};
|
|
|
|
exports.createDeflateRaw = function(o) {
|
|
return new DeflateRaw(o);
|
|
};
|
|
|
|
exports.createInflateRaw = function(o) {
|
|
return new InflateRaw(o);
|
|
};
|
|
|
|
exports.createGzip = function(o) {
|
|
return new Gzip(o);
|
|
};
|
|
|
|
exports.createGunzip = function(o) {
|
|
return new Gunzip(o);
|
|
};
|
|
|
|
exports.createUnzip = function(o) {
|
|
return new Unzip(o);
|
|
};
|
|
|
|
|
|
// Convenience methods.
|
|
// compress/decompress a string or buffer in one step.
|
|
exports.deflate = function(buffer, opts, callback) {
|
|
if (typeof opts === 'function') {
|
|
callback = opts;
|
|
opts = {};
|
|
}
|
|
return zlibBuffer(new Deflate(opts), buffer, callback);
|
|
};
|
|
|
|
exports.deflateSync = function(buffer, opts) {
|
|
return zlibBufferSync(new Deflate(opts), buffer);
|
|
};
|
|
|
|
exports.gzip = function(buffer, opts, callback) {
|
|
if (typeof opts === 'function') {
|
|
callback = opts;
|
|
opts = {};
|
|
}
|
|
return zlibBuffer(new Gzip(opts), buffer, callback);
|
|
};
|
|
|
|
exports.gzipSync = function(buffer, opts) {
|
|
return zlibBufferSync(new Gzip(opts), buffer);
|
|
};
|
|
|
|
exports.deflateRaw = function(buffer, opts, callback) {
|
|
if (typeof opts === 'function') {
|
|
callback = opts;
|
|
opts = {};
|
|
}
|
|
return zlibBuffer(new DeflateRaw(opts), buffer, callback);
|
|
};
|
|
|
|
exports.deflateRawSync = function(buffer, opts) {
|
|
return zlibBufferSync(new DeflateRaw(opts), buffer);
|
|
};
|
|
|
|
exports.unzip = function(buffer, opts, callback) {
|
|
if (typeof opts === 'function') {
|
|
callback = opts;
|
|
opts = {};
|
|
}
|
|
return zlibBuffer(new Unzip(opts), buffer, callback);
|
|
};
|
|
|
|
exports.unzipSync = function(buffer, opts) {
|
|
return zlibBufferSync(new Unzip(opts), buffer);
|
|
};
|
|
|
|
exports.inflate = function(buffer, opts, callback) {
|
|
if (typeof opts === 'function') {
|
|
callback = opts;
|
|
opts = {};
|
|
}
|
|
return zlibBuffer(new Inflate(opts), buffer, callback);
|
|
};
|
|
|
|
exports.inflateSync = function(buffer, opts) {
|
|
return zlibBufferSync(new Inflate(opts), buffer);
|
|
};
|
|
|
|
exports.gunzip = function(buffer, opts, callback) {
|
|
if (typeof opts === 'function') {
|
|
callback = opts;
|
|
opts = {};
|
|
}
|
|
return zlibBuffer(new Gunzip(opts), buffer, callback);
|
|
};
|
|
|
|
exports.gunzipSync = function(buffer, opts) {
|
|
return zlibBufferSync(new Gunzip(opts), buffer);
|
|
};
|
|
|
|
exports.inflateRaw = function(buffer, opts, callback) {
|
|
if (typeof opts === 'function') {
|
|
callback = opts;
|
|
opts = {};
|
|
}
|
|
return zlibBuffer(new InflateRaw(opts), buffer, callback);
|
|
};
|
|
|
|
exports.inflateRawSync = function(buffer, opts) {
|
|
return zlibBufferSync(new InflateRaw(opts), buffer);
|
|
};
|
|
|
|
function zlibBuffer(engine, buffer, callback) {
|
|
var buffers = [];
|
|
var nread = 0;
|
|
|
|
engine.on('error', onError);
|
|
engine.on('end', onEnd);
|
|
|
|
engine.end(buffer);
|
|
flow();
|
|
|
|
function flow() {
|
|
var chunk;
|
|
while (null !== (chunk = engine.read())) {
|
|
buffers.push(chunk);
|
|
nread += chunk.length;
|
|
}
|
|
engine.once('readable', flow);
|
|
}
|
|
|
|
function onError(err) {
|
|
engine.removeListener('end', onEnd);
|
|
engine.removeListener('readable', flow);
|
|
callback(err);
|
|
}
|
|
|
|
function onEnd() {
|
|
var buf = Buffer.concat(buffers, nread);
|
|
buffers = [];
|
|
callback(null, buf);
|
|
engine.close();
|
|
}
|
|
}
|
|
|
|
function zlibBufferSync(engine, buffer) {
|
|
if (typeof buffer === 'string')
|
|
buffer = new Buffer(buffer);
|
|
if (!Buffer.isBuffer(buffer))
|
|
throw new TypeError('Not a string or buffer');
|
|
|
|
var flushFlag = binding.Z_FINISH;
|
|
|
|
return engine._processChunk(buffer, flushFlag);
|
|
}
|
|
|
|
// generic zlib
|
|
// minimal 2-byte header
|
|
function Deflate(opts) {
|
|
if (!(this instanceof Deflate)) return new Deflate(opts);
|
|
Zlib.call(this, opts, binding.DEFLATE);
|
|
}
|
|
|
|
function Inflate(opts) {
|
|
if (!(this instanceof Inflate)) return new Inflate(opts);
|
|
Zlib.call(this, opts, binding.INFLATE);
|
|
}
|
|
|
|
|
|
|
|
// gzip - bigger header, same deflate compression
|
|
function Gzip(opts) {
|
|
if (!(this instanceof Gzip)) return new Gzip(opts);
|
|
Zlib.call(this, opts, binding.GZIP);
|
|
}
|
|
|
|
function Gunzip(opts) {
|
|
if (!(this instanceof Gunzip)) return new Gunzip(opts);
|
|
Zlib.call(this, opts, binding.GUNZIP);
|
|
}
|
|
|
|
|
|
|
|
// raw - no header
|
|
function DeflateRaw(opts) {
|
|
if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts);
|
|
Zlib.call(this, opts, binding.DEFLATERAW);
|
|
}
|
|
|
|
function InflateRaw(opts) {
|
|
if (!(this instanceof InflateRaw)) return new InflateRaw(opts);
|
|
Zlib.call(this, opts, binding.INFLATERAW);
|
|
}
|
|
|
|
|
|
// auto-detect header.
|
|
function Unzip(opts) {
|
|
if (!(this instanceof Unzip)) return new Unzip(opts);
|
|
Zlib.call(this, opts, binding.UNZIP);
|
|
}
|
|
|
|
|
|
// the Zlib class they all inherit from
|
|
// This thing manages the queue of requests, and returns
|
|
// true or false if there is anything in the queue when
|
|
// you call the .write() method.
|
|
|
|
function Zlib(opts, mode) {
|
|
this._opts = opts = opts || {};
|
|
this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK;
|
|
|
|
Transform.call(this, opts);
|
|
|
|
if (opts.flush) {
|
|
if (opts.flush !== binding.Z_NO_FLUSH &&
|
|
opts.flush !== binding.Z_PARTIAL_FLUSH &&
|
|
opts.flush !== binding.Z_SYNC_FLUSH &&
|
|
opts.flush !== binding.Z_FULL_FLUSH &&
|
|
opts.flush !== binding.Z_FINISH &&
|
|
opts.flush !== binding.Z_BLOCK) {
|
|
throw new Error('Invalid flush flag: ' + opts.flush);
|
|
}
|
|
}
|
|
this._flushFlag = opts.flush || binding.Z_NO_FLUSH;
|
|
|
|
if (opts.chunkSize) {
|
|
if (opts.chunkSize < exports.Z_MIN_CHUNK ||
|
|
opts.chunkSize > exports.Z_MAX_CHUNK) {
|
|
throw new Error('Invalid chunk size: ' + opts.chunkSize);
|
|
}
|
|
}
|
|
|
|
if (opts.windowBits) {
|
|
if (opts.windowBits < exports.Z_MIN_WINDOWBITS ||
|
|
opts.windowBits > exports.Z_MAX_WINDOWBITS) {
|
|
throw new Error('Invalid windowBits: ' + opts.windowBits);
|
|
}
|
|
}
|
|
|
|
if (opts.level) {
|
|
if (opts.level < exports.Z_MIN_LEVEL ||
|
|
opts.level > exports.Z_MAX_LEVEL) {
|
|
throw new Error('Invalid compression level: ' + opts.level);
|
|
}
|
|
}
|
|
|
|
if (opts.memLevel) {
|
|
if (opts.memLevel < exports.Z_MIN_MEMLEVEL ||
|
|
opts.memLevel > exports.Z_MAX_MEMLEVEL) {
|
|
throw new Error('Invalid memLevel: ' + opts.memLevel);
|
|
}
|
|
}
|
|
|
|
if (opts.strategy) {
|
|
if (opts.strategy != exports.Z_FILTERED &&
|
|
opts.strategy != exports.Z_HUFFMAN_ONLY &&
|
|
opts.strategy != exports.Z_RLE &&
|
|
opts.strategy != exports.Z_FIXED &&
|
|
opts.strategy != exports.Z_DEFAULT_STRATEGY) {
|
|
throw new Error('Invalid strategy: ' + opts.strategy);
|
|
}
|
|
}
|
|
|
|
if (opts.dictionary) {
|
|
if (!Buffer.isBuffer(opts.dictionary)) {
|
|
throw new Error('Invalid dictionary: it should be a Buffer instance');
|
|
}
|
|
}
|
|
|
|
this._binding = new binding.Zlib(mode);
|
|
|
|
var self = this;
|
|
this._hadError = false;
|
|
this._binding.onerror = function(message, errno) {
|
|
// there is no way to cleanly recover.
|
|
// continuing only obscures problems.
|
|
self._binding = null;
|
|
self._hadError = true;
|
|
|
|
var error = new Error(message);
|
|
error.errno = errno;
|
|
error.code = exports.codes[errno];
|
|
self.emit('error', error);
|
|
};
|
|
|
|
var level = exports.Z_DEFAULT_COMPRESSION;
|
|
if (typeof opts.level === 'number') level = opts.level;
|
|
|
|
var strategy = exports.Z_DEFAULT_STRATEGY;
|
|
if (typeof opts.strategy === 'number') strategy = opts.strategy;
|
|
|
|
this._binding.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS,
|
|
level,
|
|
opts.memLevel || exports.Z_DEFAULT_MEMLEVEL,
|
|
strategy,
|
|
opts.dictionary);
|
|
|
|
this._buffer = new Buffer(this._chunkSize);
|
|
this._offset = 0;
|
|
this._closed = false;
|
|
this._level = level;
|
|
this._strategy = strategy;
|
|
|
|
this.once('end', this.close);
|
|
}
|
|
|
|
util.inherits(Zlib, Transform);
|
|
|
|
Zlib.prototype.params = function(level, strategy, callback) {
|
|
if (level < exports.Z_MIN_LEVEL ||
|
|
level > exports.Z_MAX_LEVEL) {
|
|
throw new RangeError('Invalid compression level: ' + level);
|
|
}
|
|
if (strategy != exports.Z_FILTERED &&
|
|
strategy != exports.Z_HUFFMAN_ONLY &&
|
|
strategy != exports.Z_RLE &&
|
|
strategy != exports.Z_FIXED &&
|
|
strategy != exports.Z_DEFAULT_STRATEGY) {
|
|
throw new TypeError('Invalid strategy: ' + strategy);
|
|
}
|
|
|
|
if (this._level !== level || this._strategy !== strategy) {
|
|
var self = this;
|
|
this.flush(binding.Z_SYNC_FLUSH, function() {
|
|
self._binding.params(level, strategy);
|
|
if (!self._hadError) {
|
|
self._level = level;
|
|
self._strategy = strategy;
|
|
if (callback) callback();
|
|
}
|
|
});
|
|
} else {
|
|
process.nextTick(callback);
|
|
}
|
|
};
|
|
|
|
Zlib.prototype.reset = function() {
|
|
return this._binding.reset();
|
|
};
|
|
|
|
// This is the _flush function called by the transform class,
|
|
// internally, when the last chunk has been written.
|
|
Zlib.prototype._flush = function(callback) {
|
|
this._transform(new Buffer(0), '', callback);
|
|
};
|
|
|
|
Zlib.prototype.flush = function(kind, callback) {
|
|
var ws = this._writableState;
|
|
|
|
if (typeof kind === 'function' || (kind === void 0 && !callback)) {
|
|
callback = kind;
|
|
kind = binding.Z_FULL_FLUSH;
|
|
}
|
|
|
|
if (ws.ended) {
|
|
if (callback)
|
|
process.nextTick(callback);
|
|
} else if (ws.ending) {
|
|
if (callback)
|
|
this.once('end', callback);
|
|
} else if (ws.needDrain) {
|
|
var self = this;
|
|
this.once('drain', function() {
|
|
self.flush(callback);
|
|
});
|
|
} else {
|
|
this._flushFlag = kind;
|
|
this.write(new Buffer(0), '', callback);
|
|
}
|
|
};
|
|
|
|
Zlib.prototype.close = function(callback) {
|
|
if (callback)
|
|
process.nextTick(callback);
|
|
|
|
if (this._closed)
|
|
return;
|
|
|
|
this._closed = true;
|
|
|
|
this._binding.close();
|
|
|
|
var self = this;
|
|
process.nextTick(function() {
|
|
self.emit('close');
|
|
});
|
|
};
|
|
|
|
Zlib.prototype._transform = function(chunk, encoding, cb) {
|
|
var flushFlag;
|
|
var ws = this._writableState;
|
|
var ending = ws.ending || ws.ended;
|
|
var last = ending && (!chunk || ws.length === chunk.length);
|
|
|
|
if (!chunk === null && !Buffer.isBuffer(chunk))
|
|
return cb(new Error('invalid input'));
|
|
|
|
// If it's the last chunk, or a final flush, we use the Z_FINISH flush flag.
|
|
// If it's explicitly flushing at some other time, then we use
|
|
// Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression
|
|
// goodness.
|
|
if (last)
|
|
flushFlag = binding.Z_FINISH;
|
|
else {
|
|
flushFlag = this._flushFlag;
|
|
// once we've flushed the last of the queue, stop flushing and
|
|
// go back to the normal behavior.
|
|
if (chunk.length >= ws.length) {
|
|
this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH;
|
|
}
|
|
}
|
|
|
|
var self = this;
|
|
this._processChunk(chunk, flushFlag, cb);
|
|
};
|
|
|
|
Zlib.prototype._processChunk = function(chunk, flushFlag, cb) {
|
|
var availInBefore = chunk && chunk.length;
|
|
var availOutBefore = this._chunkSize - this._offset;
|
|
var inOff = 0;
|
|
|
|
var self = this;
|
|
|
|
var async = typeof cb === 'function';
|
|
|
|
if (!async) {
|
|
var buffers = [];
|
|
var nread = 0;
|
|
|
|
var error;
|
|
this.on('error', function(er) {
|
|
error = er;
|
|
});
|
|
|
|
do {
|
|
var res = this._binding.writeSync(flushFlag,
|
|
chunk, // in
|
|
inOff, // in_off
|
|
availInBefore, // in_len
|
|
this._buffer, // out
|
|
this._offset, //out_off
|
|
availOutBefore); // out_len
|
|
} while (!this._hadError && callback(res[0], res[1]));
|
|
|
|
if (this._hadError) {
|
|
throw error;
|
|
}
|
|
|
|
var buf = Buffer.concat(buffers, nread);
|
|
this.close();
|
|
|
|
return buf;
|
|
}
|
|
|
|
var req = this._binding.write(flushFlag,
|
|
chunk, // in
|
|
inOff, // in_off
|
|
availInBefore, // in_len
|
|
this._buffer, // out
|
|
this._offset, //out_off
|
|
availOutBefore); // out_len
|
|
|
|
req.buffer = chunk;
|
|
req.callback = callback;
|
|
|
|
function callback(availInAfter, availOutAfter) {
|
|
if (self._hadError)
|
|
return;
|
|
|
|
var have = availOutBefore - availOutAfter;
|
|
assert(have >= 0, 'have should not go down');
|
|
|
|
if (have > 0) {
|
|
var out = self._buffer.slice(self._offset, self._offset + have);
|
|
self._offset += have;
|
|
// serve some output to the consumer.
|
|
if (async) {
|
|
self.push(out);
|
|
} else {
|
|
buffers.push(out);
|
|
nread += out.length;
|
|
}
|
|
}
|
|
|
|
// exhausted the output buffer, or used all the input create a new one.
|
|
if (availOutAfter === 0 || self._offset >= self._chunkSize) {
|
|
availOutBefore = self._chunkSize;
|
|
self._offset = 0;
|
|
self._buffer = new Buffer(self._chunkSize);
|
|
}
|
|
|
|
if (availOutAfter === 0) {
|
|
// Not actually done. Need to reprocess.
|
|
// Also, update the availInBefore to the availInAfter value,
|
|
// so that if we have to hit it a third (fourth, etc.) time,
|
|
// it'll have the correct byte counts.
|
|
inOff += (availInBefore - availInAfter);
|
|
availInBefore = availInAfter;
|
|
|
|
if (!async)
|
|
return true;
|
|
|
|
var newReq = self._binding.write(flushFlag,
|
|
chunk,
|
|
inOff,
|
|
availInBefore,
|
|
self._buffer,
|
|
self._offset,
|
|
self._chunkSize);
|
|
newReq.callback = callback; // this same function
|
|
newReq.buffer = chunk;
|
|
return;
|
|
}
|
|
|
|
if (!async)
|
|
return false;
|
|
|
|
// finished with the chunk.
|
|
cb();
|
|
}
|
|
};
|
|
|
|
util.inherits(Deflate, Zlib);
|
|
util.inherits(Inflate, Zlib);
|
|
util.inherits(Gzip, Zlib);
|
|
util.inherits(Gunzip, Zlib);
|
|
util.inherits(DeflateRaw, Zlib);
|
|
util.inherits(InflateRaw, Zlib);
|
|
util.inherits(Unzip, Zlib);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer, __webpack_require__(34)))
|
|
|
|
/***/ },
|
|
/* 57 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(process, Buffer) {var msg = __webpack_require__(58);
|
|
var zstream = __webpack_require__(59);
|
|
var zlib_deflate = __webpack_require__(60);
|
|
var zlib_inflate = __webpack_require__(65);
|
|
var constants = __webpack_require__(68);
|
|
|
|
for (var key in constants) {
|
|
exports[key] = constants[key];
|
|
}
|
|
|
|
// zlib modes
|
|
exports.NONE = 0;
|
|
exports.DEFLATE = 1;
|
|
exports.INFLATE = 2;
|
|
exports.GZIP = 3;
|
|
exports.GUNZIP = 4;
|
|
exports.DEFLATERAW = 5;
|
|
exports.INFLATERAW = 6;
|
|
exports.UNZIP = 7;
|
|
|
|
/**
|
|
* Emulate Node's zlib C++ layer for use by the JS layer in index.js
|
|
*/
|
|
function Zlib(mode) {
|
|
if (mode < exports.DEFLATE || mode > exports.UNZIP)
|
|
throw new TypeError("Bad argument");
|
|
|
|
this.mode = mode;
|
|
this.init_done = false;
|
|
this.write_in_progress = false;
|
|
this.pending_close = false;
|
|
this.windowBits = 0;
|
|
this.level = 0;
|
|
this.memLevel = 0;
|
|
this.strategy = 0;
|
|
this.dictionary = null;
|
|
}
|
|
|
|
Zlib.prototype.init = function(windowBits, level, memLevel, strategy, dictionary) {
|
|
this.windowBits = windowBits;
|
|
this.level = level;
|
|
this.memLevel = memLevel;
|
|
this.strategy = strategy;
|
|
// dictionary not supported.
|
|
|
|
if (this.mode === exports.GZIP || this.mode === exports.GUNZIP)
|
|
this.windowBits += 16;
|
|
|
|
if (this.mode === exports.UNZIP)
|
|
this.windowBits += 32;
|
|
|
|
if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW)
|
|
this.windowBits = -this.windowBits;
|
|
|
|
this.strm = new zstream();
|
|
|
|
switch (this.mode) {
|
|
case exports.DEFLATE:
|
|
case exports.GZIP:
|
|
case exports.DEFLATERAW:
|
|
var status = zlib_deflate.deflateInit2(
|
|
this.strm,
|
|
this.level,
|
|
exports.Z_DEFLATED,
|
|
this.windowBits,
|
|
this.memLevel,
|
|
this.strategy
|
|
);
|
|
break;
|
|
case exports.INFLATE:
|
|
case exports.GUNZIP:
|
|
case exports.INFLATERAW:
|
|
case exports.UNZIP:
|
|
var status = zlib_inflate.inflateInit2(
|
|
this.strm,
|
|
this.windowBits
|
|
);
|
|
break;
|
|
default:
|
|
throw new Error("Unknown mode " + this.mode);
|
|
}
|
|
|
|
if (status !== exports.Z_OK) {
|
|
this._error(status);
|
|
return;
|
|
}
|
|
|
|
this.write_in_progress = false;
|
|
this.init_done = true;
|
|
};
|
|
|
|
Zlib.prototype.params = function() {
|
|
throw new Error("deflateParams Not supported");
|
|
};
|
|
|
|
Zlib.prototype._writeCheck = function() {
|
|
if (!this.init_done)
|
|
throw new Error("write before init");
|
|
|
|
if (this.mode === exports.NONE)
|
|
throw new Error("already finalized");
|
|
|
|
if (this.write_in_progress)
|
|
throw new Error("write already in progress");
|
|
|
|
if (this.pending_close)
|
|
throw new Error("close is pending");
|
|
};
|
|
|
|
Zlib.prototype.write = function(flush, input, in_off, in_len, out, out_off, out_len) {
|
|
this._writeCheck();
|
|
this.write_in_progress = true;
|
|
|
|
var self = this;
|
|
process.nextTick(function() {
|
|
self.write_in_progress = false;
|
|
var res = self._write(flush, input, in_off, in_len, out, out_off, out_len);
|
|
self.callback(res[0], res[1]);
|
|
|
|
if (self.pending_close)
|
|
self.close();
|
|
});
|
|
|
|
return this;
|
|
};
|
|
|
|
// set method for Node buffers, used by pako
|
|
function bufferSet(data, offset) {
|
|
for (var i = 0; i < data.length; i++) {
|
|
this[offset + i] = data[i];
|
|
}
|
|
}
|
|
|
|
Zlib.prototype.writeSync = function(flush, input, in_off, in_len, out, out_off, out_len) {
|
|
this._writeCheck();
|
|
return this._write(flush, input, in_off, in_len, out, out_off, out_len);
|
|
};
|
|
|
|
Zlib.prototype._write = function(flush, input, in_off, in_len, out, out_off, out_len) {
|
|
this.write_in_progress = true;
|
|
|
|
if (flush !== exports.Z_NO_FLUSH &&
|
|
flush !== exports.Z_PARTIAL_FLUSH &&
|
|
flush !== exports.Z_SYNC_FLUSH &&
|
|
flush !== exports.Z_FULL_FLUSH &&
|
|
flush !== exports.Z_FINISH &&
|
|
flush !== exports.Z_BLOCK) {
|
|
throw new Error("Invalid flush value");
|
|
}
|
|
|
|
if (input == null) {
|
|
input = new Buffer(0);
|
|
in_len = 0;
|
|
in_off = 0;
|
|
}
|
|
|
|
if (out._set)
|
|
out.set = out._set;
|
|
else
|
|
out.set = bufferSet;
|
|
|
|
var strm = this.strm;
|
|
strm.avail_in = in_len;
|
|
strm.input = input;
|
|
strm.next_in = in_off;
|
|
strm.avail_out = out_len;
|
|
strm.output = out;
|
|
strm.next_out = out_off;
|
|
|
|
switch (this.mode) {
|
|
case exports.DEFLATE:
|
|
case exports.GZIP:
|
|
case exports.DEFLATERAW:
|
|
var status = zlib_deflate.deflate(strm, flush);
|
|
break;
|
|
case exports.UNZIP:
|
|
case exports.INFLATE:
|
|
case exports.GUNZIP:
|
|
case exports.INFLATERAW:
|
|
var status = zlib_inflate.inflate(strm, flush);
|
|
break;
|
|
default:
|
|
throw new Error("Unknown mode " + this.mode);
|
|
}
|
|
|
|
if (status !== exports.Z_STREAM_END && status !== exports.Z_OK) {
|
|
this._error(status);
|
|
}
|
|
|
|
this.write_in_progress = false;
|
|
return [strm.avail_in, strm.avail_out];
|
|
};
|
|
|
|
Zlib.prototype.close = function() {
|
|
if (this.write_in_progress) {
|
|
this.pending_close = true;
|
|
return;
|
|
}
|
|
|
|
this.pending_close = false;
|
|
|
|
if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) {
|
|
zlib_deflate.deflateEnd(this.strm);
|
|
} else {
|
|
zlib_inflate.inflateEnd(this.strm);
|
|
}
|
|
|
|
this.mode = exports.NONE;
|
|
};
|
|
|
|
Zlib.prototype.reset = function() {
|
|
switch (this.mode) {
|
|
case exports.DEFLATE:
|
|
case exports.DEFLATERAW:
|
|
var status = zlib_deflate.deflateReset(this.strm);
|
|
break;
|
|
case exports.INFLATE:
|
|
case exports.INFLATERAW:
|
|
var status = zlib_inflate.inflateReset(this.strm);
|
|
break;
|
|
}
|
|
|
|
if (status !== exports.Z_OK) {
|
|
this._error(status);
|
|
}
|
|
};
|
|
|
|
Zlib.prototype._error = function(status) {
|
|
this.onerror(msg[status] + ': ' + this.strm.msg, status);
|
|
|
|
this.write_in_progress = false;
|
|
if (this.pending_close)
|
|
this.close();
|
|
};
|
|
|
|
exports.Zlib = Zlib;
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(34), __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 58 */
|
|
/***/ function(module, exports) {
|
|
|
|
'use strict';
|
|
|
|
module.exports = {
|
|
2: 'need dictionary', /* Z_NEED_DICT 2 */
|
|
1: 'stream end', /* Z_STREAM_END 1 */
|
|
0: '', /* Z_OK 0 */
|
|
'-1': 'file error', /* Z_ERRNO (-1) */
|
|
'-2': 'stream error', /* Z_STREAM_ERROR (-2) */
|
|
'-3': 'data error', /* Z_DATA_ERROR (-3) */
|
|
'-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */
|
|
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
|
|
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 59 */
|
|
/***/ function(module, exports) {
|
|
|
|
'use strict';
|
|
|
|
|
|
function ZStream() {
|
|
/* next input byte */
|
|
this.input = null; // JS specific, because we have no pointers
|
|
this.next_in = 0;
|
|
/* number of bytes available at input */
|
|
this.avail_in = 0;
|
|
/* total number of input bytes read so far */
|
|
this.total_in = 0;
|
|
/* next output byte should be put there */
|
|
this.output = null; // JS specific, because we have no pointers
|
|
this.next_out = 0;
|
|
/* remaining free space at output */
|
|
this.avail_out = 0;
|
|
/* total number of bytes output so far */
|
|
this.total_out = 0;
|
|
/* last error message, NULL if no error */
|
|
this.msg = ''/*Z_NULL*/;
|
|
/* not visible by applications */
|
|
this.state = null;
|
|
/* best guess about the data type: binary or text */
|
|
this.data_type = 2/*Z_UNKNOWN*/;
|
|
/* adler32 value of the uncompressed data */
|
|
this.adler = 0;
|
|
}
|
|
|
|
module.exports = ZStream;
|
|
|
|
|
|
/***/ },
|
|
/* 60 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
var utils = __webpack_require__(61);
|
|
var trees = __webpack_require__(62);
|
|
var adler32 = __webpack_require__(63);
|
|
var crc32 = __webpack_require__(64);
|
|
var msg = __webpack_require__(58);
|
|
|
|
/* Public constants ==========================================================*/
|
|
/* ===========================================================================*/
|
|
|
|
|
|
/* Allowed flush values; see deflate() and inflate() below for details */
|
|
var Z_NO_FLUSH = 0;
|
|
var Z_PARTIAL_FLUSH = 1;
|
|
//var Z_SYNC_FLUSH = 2;
|
|
var Z_FULL_FLUSH = 3;
|
|
var Z_FINISH = 4;
|
|
var Z_BLOCK = 5;
|
|
//var Z_TREES = 6;
|
|
|
|
|
|
/* Return codes for the compression/decompression functions. Negative values
|
|
* are errors, positive values are used for special but normal events.
|
|
*/
|
|
var Z_OK = 0;
|
|
var Z_STREAM_END = 1;
|
|
//var Z_NEED_DICT = 2;
|
|
//var Z_ERRNO = -1;
|
|
var Z_STREAM_ERROR = -2;
|
|
var Z_DATA_ERROR = -3;
|
|
//var Z_MEM_ERROR = -4;
|
|
var Z_BUF_ERROR = -5;
|
|
//var Z_VERSION_ERROR = -6;
|
|
|
|
|
|
/* compression levels */
|
|
//var Z_NO_COMPRESSION = 0;
|
|
//var Z_BEST_SPEED = 1;
|
|
//var Z_BEST_COMPRESSION = 9;
|
|
var Z_DEFAULT_COMPRESSION = -1;
|
|
|
|
|
|
var Z_FILTERED = 1;
|
|
var Z_HUFFMAN_ONLY = 2;
|
|
var Z_RLE = 3;
|
|
var Z_FIXED = 4;
|
|
var Z_DEFAULT_STRATEGY = 0;
|
|
|
|
/* Possible values of the data_type field (though see inflate()) */
|
|
//var Z_BINARY = 0;
|
|
//var Z_TEXT = 1;
|
|
//var Z_ASCII = 1; // = Z_TEXT
|
|
var Z_UNKNOWN = 2;
|
|
|
|
|
|
/* The deflate compression method */
|
|
var Z_DEFLATED = 8;
|
|
|
|
/*============================================================================*/
|
|
|
|
|
|
var MAX_MEM_LEVEL = 9;
|
|
/* Maximum value for memLevel in deflateInit2 */
|
|
var MAX_WBITS = 15;
|
|
/* 32K LZ77 window */
|
|
var DEF_MEM_LEVEL = 8;
|
|
|
|
|
|
var LENGTH_CODES = 29;
|
|
/* number of length codes, not counting the special END_BLOCK code */
|
|
var LITERALS = 256;
|
|
/* number of literal bytes 0..255 */
|
|
var L_CODES = LITERALS + 1 + LENGTH_CODES;
|
|
/* number of Literal or Length codes, including the END_BLOCK code */
|
|
var D_CODES = 30;
|
|
/* number of distance codes */
|
|
var BL_CODES = 19;
|
|
/* number of codes used to transfer the bit lengths */
|
|
var HEAP_SIZE = 2 * L_CODES + 1;
|
|
/* maximum heap size */
|
|
var MAX_BITS = 15;
|
|
/* All codes must not exceed MAX_BITS bits */
|
|
|
|
var MIN_MATCH = 3;
|
|
var MAX_MATCH = 258;
|
|
var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);
|
|
|
|
var PRESET_DICT = 0x20;
|
|
|
|
var INIT_STATE = 42;
|
|
var EXTRA_STATE = 69;
|
|
var NAME_STATE = 73;
|
|
var COMMENT_STATE = 91;
|
|
var HCRC_STATE = 103;
|
|
var BUSY_STATE = 113;
|
|
var FINISH_STATE = 666;
|
|
|
|
var BS_NEED_MORE = 1; /* block not completed, need more input or more output */
|
|
var BS_BLOCK_DONE = 2; /* block flush performed */
|
|
var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */
|
|
var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */
|
|
|
|
var OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
|
|
|
|
function err(strm, errorCode) {
|
|
strm.msg = msg[errorCode];
|
|
return errorCode;
|
|
}
|
|
|
|
function rank(f) {
|
|
return ((f) << 1) - ((f) > 4 ? 9 : 0);
|
|
}
|
|
|
|
function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
|
|
|
|
|
|
/* =========================================================================
|
|
* Flush as much pending output as possible. All deflate() output goes
|
|
* through this function so some applications may wish to modify it
|
|
* to avoid allocating a large strm->output buffer and copying into it.
|
|
* (See also read_buf()).
|
|
*/
|
|
function flush_pending(strm) {
|
|
var s = strm.state;
|
|
|
|
//_tr_flush_bits(s);
|
|
var len = s.pending;
|
|
if (len > strm.avail_out) {
|
|
len = strm.avail_out;
|
|
}
|
|
if (len === 0) { return; }
|
|
|
|
utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
|
|
strm.next_out += len;
|
|
s.pending_out += len;
|
|
strm.total_out += len;
|
|
strm.avail_out -= len;
|
|
s.pending -= len;
|
|
if (s.pending === 0) {
|
|
s.pending_out = 0;
|
|
}
|
|
}
|
|
|
|
|
|
function flush_block_only(s, last) {
|
|
trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);
|
|
s.block_start = s.strstart;
|
|
flush_pending(s.strm);
|
|
}
|
|
|
|
|
|
function put_byte(s, b) {
|
|
s.pending_buf[s.pending++] = b;
|
|
}
|
|
|
|
|
|
/* =========================================================================
|
|
* Put a short in the pending buffer. The 16-bit value is put in MSB order.
|
|
* IN assertion: the stream state is correct and there is enough room in
|
|
* pending_buf.
|
|
*/
|
|
function putShortMSB(s, b) {
|
|
// put_byte(s, (Byte)(b >> 8));
|
|
// put_byte(s, (Byte)(b & 0xff));
|
|
s.pending_buf[s.pending++] = (b >>> 8) & 0xff;
|
|
s.pending_buf[s.pending++] = b & 0xff;
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Read a new buffer from the current input stream, update the adler32
|
|
* and total number of bytes read. All deflate() input goes through
|
|
* this function so some applications may wish to modify it to avoid
|
|
* allocating a large strm->input buffer and copying from it.
|
|
* (See also flush_pending()).
|
|
*/
|
|
function read_buf(strm, buf, start, size) {
|
|
var len = strm.avail_in;
|
|
|
|
if (len > size) { len = size; }
|
|
if (len === 0) { return 0; }
|
|
|
|
strm.avail_in -= len;
|
|
|
|
// zmemcpy(buf, strm->next_in, len);
|
|
utils.arraySet(buf, strm.input, strm.next_in, len, start);
|
|
if (strm.state.wrap === 1) {
|
|
strm.adler = adler32(strm.adler, buf, len, start);
|
|
}
|
|
|
|
else if (strm.state.wrap === 2) {
|
|
strm.adler = crc32(strm.adler, buf, len, start);
|
|
}
|
|
|
|
strm.next_in += len;
|
|
strm.total_in += len;
|
|
|
|
return len;
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Set match_start to the longest match starting at the given string and
|
|
* return its length. Matches shorter or equal to prev_length are discarded,
|
|
* in which case the result is equal to prev_length and match_start is
|
|
* garbage.
|
|
* IN assertions: cur_match is the head of the hash chain for the current
|
|
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
|
|
* OUT assertion: the match length is not greater than s->lookahead.
|
|
*/
|
|
function longest_match(s, cur_match) {
|
|
var chain_length = s.max_chain_length; /* max hash chain length */
|
|
var scan = s.strstart; /* current string */
|
|
var match; /* matched string */
|
|
var len; /* length of current match */
|
|
var best_len = s.prev_length; /* best match length so far */
|
|
var nice_match = s.nice_match; /* stop if match long enough */
|
|
var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?
|
|
s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;
|
|
|
|
var _win = s.window; // shortcut
|
|
|
|
var wmask = s.w_mask;
|
|
var prev = s.prev;
|
|
|
|
/* Stop when cur_match becomes <= limit. To simplify the code,
|
|
* we prevent matches with the string of window index 0.
|
|
*/
|
|
|
|
var strend = s.strstart + MAX_MATCH;
|
|
var scan_end1 = _win[scan + best_len - 1];
|
|
var scan_end = _win[scan + best_len];
|
|
|
|
/* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
|
* It is easy to get rid of this optimization if necessary.
|
|
*/
|
|
// Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
|
|
|
|
/* Do not waste too much time if we already have a good match: */
|
|
if (s.prev_length >= s.good_match) {
|
|
chain_length >>= 2;
|
|
}
|
|
/* Do not look for matches beyond the end of the input. This is necessary
|
|
* to make deflate deterministic.
|
|
*/
|
|
if (nice_match > s.lookahead) { nice_match = s.lookahead; }
|
|
|
|
// Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
|
|
|
|
do {
|
|
// Assert(cur_match < s->strstart, "no future");
|
|
match = cur_match;
|
|
|
|
/* Skip to next match if the match length cannot increase
|
|
* or if the match length is less than 2. Note that the checks below
|
|
* for insufficient lookahead only occur occasionally for performance
|
|
* reasons. Therefore uninitialized memory will be accessed, and
|
|
* conditional jumps will be made that depend on those values.
|
|
* However the length of the match is limited to the lookahead, so
|
|
* the output of deflate is not affected by the uninitialized values.
|
|
*/
|
|
|
|
if (_win[match + best_len] !== scan_end ||
|
|
_win[match + best_len - 1] !== scan_end1 ||
|
|
_win[match] !== _win[scan] ||
|
|
_win[++match] !== _win[scan + 1]) {
|
|
continue;
|
|
}
|
|
|
|
/* The check at best_len-1 can be removed because it will be made
|
|
* again later. (This heuristic is not always a win.)
|
|
* It is not necessary to compare scan[2] and match[2] since they
|
|
* are always equal when the other bytes match, given that
|
|
* the hash keys are equal and that HASH_BITS >= 8.
|
|
*/
|
|
scan += 2;
|
|
match++;
|
|
// Assert(*scan == *match, "match[2]?");
|
|
|
|
/* We check for insufficient lookahead only every 8th comparison;
|
|
* the 256th check will be made at strstart+258.
|
|
*/
|
|
do {
|
|
/*jshint noempty:false*/
|
|
} while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
|
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
|
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
|
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
|
|
scan < strend);
|
|
|
|
// Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
|
|
|
len = MAX_MATCH - (strend - scan);
|
|
scan = strend - MAX_MATCH;
|
|
|
|
if (len > best_len) {
|
|
s.match_start = cur_match;
|
|
best_len = len;
|
|
if (len >= nice_match) {
|
|
break;
|
|
}
|
|
scan_end1 = _win[scan + best_len - 1];
|
|
scan_end = _win[scan + best_len];
|
|
}
|
|
} while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);
|
|
|
|
if (best_len <= s.lookahead) {
|
|
return best_len;
|
|
}
|
|
return s.lookahead;
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Fill the window when the lookahead becomes insufficient.
|
|
* Updates strstart and lookahead.
|
|
*
|
|
* IN assertion: lookahead < MIN_LOOKAHEAD
|
|
* OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
|
|
* At least one byte has been read, or avail_in == 0; reads are
|
|
* performed for at least two bytes (required for the zip translate_eol
|
|
* option -- not supported here).
|
|
*/
|
|
function fill_window(s) {
|
|
var _w_size = s.w_size;
|
|
var p, n, m, more, str;
|
|
|
|
//Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
|
|
|
|
do {
|
|
more = s.window_size - s.lookahead - s.strstart;
|
|
|
|
// JS ints have 32 bit, block below not needed
|
|
/* Deal with !@#$% 64K limit: */
|
|
//if (sizeof(int) <= 2) {
|
|
// if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
|
|
// more = wsize;
|
|
//
|
|
// } else if (more == (unsigned)(-1)) {
|
|
// /* Very unlikely, but possible on 16 bit machine if
|
|
// * strstart == 0 && lookahead == 1 (input done a byte at time)
|
|
// */
|
|
// more--;
|
|
// }
|
|
//}
|
|
|
|
|
|
/* If the window is almost full and there is insufficient lookahead,
|
|
* move the upper half to the lower one to make room in the upper half.
|
|
*/
|
|
if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
|
|
|
|
utils.arraySet(s.window, s.window, _w_size, _w_size, 0);
|
|
s.match_start -= _w_size;
|
|
s.strstart -= _w_size;
|
|
/* we now have strstart >= MAX_DIST */
|
|
s.block_start -= _w_size;
|
|
|
|
/* Slide the hash table (could be avoided with 32 bit values
|
|
at the expense of memory usage). We slide even when level == 0
|
|
to keep the hash table consistent if we switch back to level > 0
|
|
later. (Using level 0 permanently is not an optimal usage of
|
|
zlib, so we don't care about this pathological case.)
|
|
*/
|
|
|
|
n = s.hash_size;
|
|
p = n;
|
|
do {
|
|
m = s.head[--p];
|
|
s.head[p] = (m >= _w_size ? m - _w_size : 0);
|
|
} while (--n);
|
|
|
|
n = _w_size;
|
|
p = n;
|
|
do {
|
|
m = s.prev[--p];
|
|
s.prev[p] = (m >= _w_size ? m - _w_size : 0);
|
|
/* If n is not on any hash chain, prev[n] is garbage but
|
|
* its value will never be used.
|
|
*/
|
|
} while (--n);
|
|
|
|
more += _w_size;
|
|
}
|
|
if (s.strm.avail_in === 0) {
|
|
break;
|
|
}
|
|
|
|
/* If there was no sliding:
|
|
* strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
|
|
* more == window_size - lookahead - strstart
|
|
* => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
|
|
* => more >= window_size - 2*WSIZE + 2
|
|
* In the BIG_MEM or MMAP case (not yet supported),
|
|
* window_size == input_size + MIN_LOOKAHEAD &&
|
|
* strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
|
|
* Otherwise, window_size == 2*WSIZE so more >= 2.
|
|
* If there was sliding, more >= WSIZE. So in all cases, more >= 2.
|
|
*/
|
|
//Assert(more >= 2, "more < 2");
|
|
n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);
|
|
s.lookahead += n;
|
|
|
|
/* Initialize the hash value now that we have some input: */
|
|
if (s.lookahead + s.insert >= MIN_MATCH) {
|
|
str = s.strstart - s.insert;
|
|
s.ins_h = s.window[str];
|
|
|
|
/* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */
|
|
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;
|
|
//#if MIN_MATCH != 3
|
|
// Call update_hash() MIN_MATCH-3 more times
|
|
//#endif
|
|
while (s.insert) {
|
|
/* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
|
|
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
|
|
|
|
s.prev[str & s.w_mask] = s.head[s.ins_h];
|
|
s.head[s.ins_h] = str;
|
|
str++;
|
|
s.insert--;
|
|
if (s.lookahead + s.insert < MIN_MATCH) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
|
|
* but this is not important since only literal bytes will be emitted.
|
|
*/
|
|
|
|
} while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);
|
|
|
|
/* If the WIN_INIT bytes after the end of the current data have never been
|
|
* written, then zero those bytes in order to avoid memory check reports of
|
|
* the use of uninitialized (or uninitialised as Julian writes) bytes by
|
|
* the longest match routines. Update the high water mark for the next
|
|
* time through here. WIN_INIT is set to MAX_MATCH since the longest match
|
|
* routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
|
|
*/
|
|
// if (s.high_water < s.window_size) {
|
|
// var curr = s.strstart + s.lookahead;
|
|
// var init = 0;
|
|
//
|
|
// if (s.high_water < curr) {
|
|
// /* Previous high water mark below current data -- zero WIN_INIT
|
|
// * bytes or up to end of window, whichever is less.
|
|
// */
|
|
// init = s.window_size - curr;
|
|
// if (init > WIN_INIT)
|
|
// init = WIN_INIT;
|
|
// zmemzero(s->window + curr, (unsigned)init);
|
|
// s->high_water = curr + init;
|
|
// }
|
|
// else if (s->high_water < (ulg)curr + WIN_INIT) {
|
|
// /* High water mark at or above current data, but below current data
|
|
// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
|
|
// * to end of window, whichever is less.
|
|
// */
|
|
// init = (ulg)curr + WIN_INIT - s->high_water;
|
|
// if (init > s->window_size - s->high_water)
|
|
// init = s->window_size - s->high_water;
|
|
// zmemzero(s->window + s->high_water, (unsigned)init);
|
|
// s->high_water += init;
|
|
// }
|
|
// }
|
|
//
|
|
// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
|
|
// "not enough room for search");
|
|
}
|
|
|
|
/* ===========================================================================
|
|
* Copy without compression as much as possible from the input stream, return
|
|
* the current block state.
|
|
* This function does not insert new strings in the dictionary since
|
|
* uncompressible data is probably not useful. This function is used
|
|
* only for the level=0 compression option.
|
|
* NOTE: this function should be optimized to avoid extra copying from
|
|
* window to pending_buf.
|
|
*/
|
|
function deflate_stored(s, flush) {
|
|
/* Stored blocks are limited to 0xffff bytes, pending_buf is limited
|
|
* to pending_buf_size, and each stored block has a 5 byte header:
|
|
*/
|
|
var max_block_size = 0xffff;
|
|
|
|
if (max_block_size > s.pending_buf_size - 5) {
|
|
max_block_size = s.pending_buf_size - 5;
|
|
}
|
|
|
|
/* Copy as much as possible from input to output: */
|
|
for (;;) {
|
|
/* Fill the window as much as possible: */
|
|
if (s.lookahead <= 1) {
|
|
|
|
//Assert(s->strstart < s->w_size+MAX_DIST(s) ||
|
|
// s->block_start >= (long)s->w_size, "slide too late");
|
|
// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||
|
|
// s.block_start >= s.w_size)) {
|
|
// throw new Error("slide too late");
|
|
// }
|
|
|
|
fill_window(s);
|
|
if (s.lookahead === 0 && flush === Z_NO_FLUSH) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
|
|
if (s.lookahead === 0) {
|
|
break;
|
|
}
|
|
/* flush the current block */
|
|
}
|
|
//Assert(s->block_start >= 0L, "block gone");
|
|
// if (s.block_start < 0) throw new Error("block gone");
|
|
|
|
s.strstart += s.lookahead;
|
|
s.lookahead = 0;
|
|
|
|
/* Emit a stored block if pending_buf will be full: */
|
|
var max_start = s.block_start + max_block_size;
|
|
|
|
if (s.strstart === 0 || s.strstart >= max_start) {
|
|
/* strstart == 0 is possible when wraparound on 16-bit machine */
|
|
s.lookahead = s.strstart - max_start;
|
|
s.strstart = max_start;
|
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
flush_block_only(s, false);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
/***/
|
|
|
|
|
|
}
|
|
/* Flush if we may have to slide, otherwise block_start may become
|
|
* negative and the data will be gone:
|
|
*/
|
|
if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {
|
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
flush_block_only(s, false);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
/***/
|
|
}
|
|
}
|
|
|
|
s.insert = 0;
|
|
|
|
if (flush === Z_FINISH) {
|
|
/*** FLUSH_BLOCK(s, 1); ***/
|
|
flush_block_only(s, true);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_FINISH_STARTED;
|
|
}
|
|
/***/
|
|
return BS_FINISH_DONE;
|
|
}
|
|
|
|
if (s.strstart > s.block_start) {
|
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
flush_block_only(s, false);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
/***/
|
|
}
|
|
|
|
return BS_NEED_MORE;
|
|
}
|
|
|
|
/* ===========================================================================
|
|
* Compress as much as possible from the input stream, return the current
|
|
* block state.
|
|
* This function does not perform lazy evaluation of matches and inserts
|
|
* new strings in the dictionary only for unmatched strings or for short
|
|
* matches. It is used only for the fast compression options.
|
|
*/
|
|
function deflate_fast(s, flush) {
|
|
var hash_head; /* head of the hash chain */
|
|
var bflush; /* set if current block must be flushed */
|
|
|
|
for (;;) {
|
|
/* Make sure that we always have enough lookahead, except
|
|
* at the end of the input file. We need MAX_MATCH bytes
|
|
* for the next match, plus MIN_MATCH bytes to insert the
|
|
* string following the next match.
|
|
*/
|
|
if (s.lookahead < MIN_LOOKAHEAD) {
|
|
fill_window(s);
|
|
if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
if (s.lookahead === 0) {
|
|
break; /* flush the current block */
|
|
}
|
|
}
|
|
|
|
/* Insert the string window[strstart .. strstart+2] in the
|
|
* dictionary, and set hash_head to the head of the hash chain:
|
|
*/
|
|
hash_head = 0/*NIL*/;
|
|
if (s.lookahead >= MIN_MATCH) {
|
|
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
|
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
|
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
|
s.head[s.ins_h] = s.strstart;
|
|
/***/
|
|
}
|
|
|
|
/* Find the longest match, discarding those <= prev_length.
|
|
* At this point we have always match_length < MIN_MATCH
|
|
*/
|
|
if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {
|
|
/* To simplify the code, we prevent matches with the string
|
|
* of window index 0 (in particular we have to avoid a match
|
|
* of the string with itself at the start of the input file).
|
|
*/
|
|
s.match_length = longest_match(s, hash_head);
|
|
/* longest_match() sets match_start */
|
|
}
|
|
if (s.match_length >= MIN_MATCH) {
|
|
// check_match(s, s.strstart, s.match_start, s.match_length); // for debug only
|
|
|
|
/*** _tr_tally_dist(s, s.strstart - s.match_start,
|
|
s.match_length - MIN_MATCH, bflush); ***/
|
|
bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);
|
|
|
|
s.lookahead -= s.match_length;
|
|
|
|
/* Insert new strings in the hash table only if the match length
|
|
* is not too large. This saves time but degrades compression.
|
|
*/
|
|
if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {
|
|
s.match_length--; /* string at strstart already in table */
|
|
do {
|
|
s.strstart++;
|
|
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
|
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
|
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
|
s.head[s.ins_h] = s.strstart;
|
|
/***/
|
|
/* strstart never exceeds WSIZE-MAX_MATCH, so there are
|
|
* always MIN_MATCH bytes ahead.
|
|
*/
|
|
} while (--s.match_length !== 0);
|
|
s.strstart++;
|
|
} else
|
|
{
|
|
s.strstart += s.match_length;
|
|
s.match_length = 0;
|
|
s.ins_h = s.window[s.strstart];
|
|
/* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */
|
|
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;
|
|
|
|
//#if MIN_MATCH != 3
|
|
// Call UPDATE_HASH() MIN_MATCH-3 more times
|
|
//#endif
|
|
/* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
|
|
* matter since it will be recomputed at next deflate call.
|
|
*/
|
|
}
|
|
} else {
|
|
/* No match, output a literal byte */
|
|
//Tracevv((stderr,"%c", s.window[s.strstart]));
|
|
/*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
|
|
bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
|
|
|
|
s.lookahead--;
|
|
s.strstart++;
|
|
}
|
|
if (bflush) {
|
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
flush_block_only(s, false);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
/***/
|
|
}
|
|
}
|
|
s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);
|
|
if (flush === Z_FINISH) {
|
|
/*** FLUSH_BLOCK(s, 1); ***/
|
|
flush_block_only(s, true);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_FINISH_STARTED;
|
|
}
|
|
/***/
|
|
return BS_FINISH_DONE;
|
|
}
|
|
if (s.last_lit) {
|
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
flush_block_only(s, false);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
/***/
|
|
}
|
|
return BS_BLOCK_DONE;
|
|
}
|
|
|
|
/* ===========================================================================
|
|
* Same as above, but achieves better compression. We use a lazy
|
|
* evaluation for matches: a match is finally adopted only if there is
|
|
* no better match at the next window position.
|
|
*/
|
|
function deflate_slow(s, flush) {
|
|
var hash_head; /* head of hash chain */
|
|
var bflush; /* set if current block must be flushed */
|
|
|
|
var max_insert;
|
|
|
|
/* Process the input block. */
|
|
for (;;) {
|
|
/* Make sure that we always have enough lookahead, except
|
|
* at the end of the input file. We need MAX_MATCH bytes
|
|
* for the next match, plus MIN_MATCH bytes to insert the
|
|
* string following the next match.
|
|
*/
|
|
if (s.lookahead < MIN_LOOKAHEAD) {
|
|
fill_window(s);
|
|
if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
if (s.lookahead === 0) { break; } /* flush the current block */
|
|
}
|
|
|
|
/* Insert the string window[strstart .. strstart+2] in the
|
|
* dictionary, and set hash_head to the head of the hash chain:
|
|
*/
|
|
hash_head = 0/*NIL*/;
|
|
if (s.lookahead >= MIN_MATCH) {
|
|
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
|
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
|
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
|
s.head[s.ins_h] = s.strstart;
|
|
/***/
|
|
}
|
|
|
|
/* Find the longest match, discarding those <= prev_length.
|
|
*/
|
|
s.prev_length = s.match_length;
|
|
s.prev_match = s.match_start;
|
|
s.match_length = MIN_MATCH - 1;
|
|
|
|
if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&
|
|
s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {
|
|
/* To simplify the code, we prevent matches with the string
|
|
* of window index 0 (in particular we have to avoid a match
|
|
* of the string with itself at the start of the input file).
|
|
*/
|
|
s.match_length = longest_match(s, hash_head);
|
|
/* longest_match() sets match_start */
|
|
|
|
if (s.match_length <= 5 &&
|
|
(s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {
|
|
|
|
/* If prev_match is also MIN_MATCH, match_start is garbage
|
|
* but we will ignore the current match anyway.
|
|
*/
|
|
s.match_length = MIN_MATCH - 1;
|
|
}
|
|
}
|
|
/* If there was a match at the previous step and the current
|
|
* match is not better, output the previous match:
|
|
*/
|
|
if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {
|
|
max_insert = s.strstart + s.lookahead - MIN_MATCH;
|
|
/* Do not insert strings in hash table beyond this. */
|
|
|
|
//check_match(s, s.strstart-1, s.prev_match, s.prev_length);
|
|
|
|
/***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,
|
|
s.prev_length - MIN_MATCH, bflush);***/
|
|
bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);
|
|
/* Insert in hash table all strings up to the end of the match.
|
|
* strstart-1 and strstart are already inserted. If there is not
|
|
* enough lookahead, the last two strings are not inserted in
|
|
* the hash table.
|
|
*/
|
|
s.lookahead -= s.prev_length - 1;
|
|
s.prev_length -= 2;
|
|
do {
|
|
if (++s.strstart <= max_insert) {
|
|
/*** INSERT_STRING(s, s.strstart, hash_head); ***/
|
|
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
|
|
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
|
s.head[s.ins_h] = s.strstart;
|
|
/***/
|
|
}
|
|
} while (--s.prev_length !== 0);
|
|
s.match_available = 0;
|
|
s.match_length = MIN_MATCH - 1;
|
|
s.strstart++;
|
|
|
|
if (bflush) {
|
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
flush_block_only(s, false);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
/***/
|
|
}
|
|
|
|
} else if (s.match_available) {
|
|
/* If there was no match at the previous position, output a
|
|
* single literal. If there was a match but the current match
|
|
* is longer, truncate the previous match to a single literal.
|
|
*/
|
|
//Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
|
/*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
|
|
bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
|
|
|
|
if (bflush) {
|
|
/*** FLUSH_BLOCK_ONLY(s, 0) ***/
|
|
flush_block_only(s, false);
|
|
/***/
|
|
}
|
|
s.strstart++;
|
|
s.lookahead--;
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
} else {
|
|
/* There is no previous match to compare with, wait for
|
|
* the next step to decide.
|
|
*/
|
|
s.match_available = 1;
|
|
s.strstart++;
|
|
s.lookahead--;
|
|
}
|
|
}
|
|
//Assert (flush != Z_NO_FLUSH, "no flush?");
|
|
if (s.match_available) {
|
|
//Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
|
/*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
|
|
bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
|
|
|
|
s.match_available = 0;
|
|
}
|
|
s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;
|
|
if (flush === Z_FINISH) {
|
|
/*** FLUSH_BLOCK(s, 1); ***/
|
|
flush_block_only(s, true);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_FINISH_STARTED;
|
|
}
|
|
/***/
|
|
return BS_FINISH_DONE;
|
|
}
|
|
if (s.last_lit) {
|
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
flush_block_only(s, false);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
/***/
|
|
}
|
|
|
|
return BS_BLOCK_DONE;
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* For Z_RLE, simply look for runs of bytes, generate matches only of distance
|
|
* one. Do not maintain a hash table. (It will be regenerated if this run of
|
|
* deflate switches away from Z_RLE.)
|
|
*/
|
|
function deflate_rle(s, flush) {
|
|
var bflush; /* set if current block must be flushed */
|
|
var prev; /* byte at distance one to match */
|
|
var scan, strend; /* scan goes up to strend for length of run */
|
|
|
|
var _win = s.window;
|
|
|
|
for (;;) {
|
|
/* Make sure that we always have enough lookahead, except
|
|
* at the end of the input file. We need MAX_MATCH bytes
|
|
* for the longest run, plus one for the unrolled loop.
|
|
*/
|
|
if (s.lookahead <= MAX_MATCH) {
|
|
fill_window(s);
|
|
if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
if (s.lookahead === 0) { break; } /* flush the current block */
|
|
}
|
|
|
|
/* See how many times the previous byte repeats */
|
|
s.match_length = 0;
|
|
if (s.lookahead >= MIN_MATCH && s.strstart > 0) {
|
|
scan = s.strstart - 1;
|
|
prev = _win[scan];
|
|
if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
|
|
strend = s.strstart + MAX_MATCH;
|
|
do {
|
|
/*jshint noempty:false*/
|
|
} while (prev === _win[++scan] && prev === _win[++scan] &&
|
|
prev === _win[++scan] && prev === _win[++scan] &&
|
|
prev === _win[++scan] && prev === _win[++scan] &&
|
|
prev === _win[++scan] && prev === _win[++scan] &&
|
|
scan < strend);
|
|
s.match_length = MAX_MATCH - (strend - scan);
|
|
if (s.match_length > s.lookahead) {
|
|
s.match_length = s.lookahead;
|
|
}
|
|
}
|
|
//Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
|
|
}
|
|
|
|
/* Emit match if have run of MIN_MATCH or longer, else emit literal */
|
|
if (s.match_length >= MIN_MATCH) {
|
|
//check_match(s, s.strstart, s.strstart - 1, s.match_length);
|
|
|
|
/*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/
|
|
bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);
|
|
|
|
s.lookahead -= s.match_length;
|
|
s.strstart += s.match_length;
|
|
s.match_length = 0;
|
|
} else {
|
|
/* No match, output a literal byte */
|
|
//Tracevv((stderr,"%c", s->window[s->strstart]));
|
|
/*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
|
|
bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
|
|
|
|
s.lookahead--;
|
|
s.strstart++;
|
|
}
|
|
if (bflush) {
|
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
flush_block_only(s, false);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
/***/
|
|
}
|
|
}
|
|
s.insert = 0;
|
|
if (flush === Z_FINISH) {
|
|
/*** FLUSH_BLOCK(s, 1); ***/
|
|
flush_block_only(s, true);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_FINISH_STARTED;
|
|
}
|
|
/***/
|
|
return BS_FINISH_DONE;
|
|
}
|
|
if (s.last_lit) {
|
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
flush_block_only(s, false);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
/***/
|
|
}
|
|
return BS_BLOCK_DONE;
|
|
}
|
|
|
|
/* ===========================================================================
|
|
* For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
|
|
* (It will be regenerated if this run of deflate switches away from Huffman.)
|
|
*/
|
|
function deflate_huff(s, flush) {
|
|
var bflush; /* set if current block must be flushed */
|
|
|
|
for (;;) {
|
|
/* Make sure that we have a literal to write. */
|
|
if (s.lookahead === 0) {
|
|
fill_window(s);
|
|
if (s.lookahead === 0) {
|
|
if (flush === Z_NO_FLUSH) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
break; /* flush the current block */
|
|
}
|
|
}
|
|
|
|
/* Output a literal byte */
|
|
s.match_length = 0;
|
|
//Tracevv((stderr,"%c", s->window[s->strstart]));
|
|
/*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
|
|
bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
|
|
s.lookahead--;
|
|
s.strstart++;
|
|
if (bflush) {
|
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
flush_block_only(s, false);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
/***/
|
|
}
|
|
}
|
|
s.insert = 0;
|
|
if (flush === Z_FINISH) {
|
|
/*** FLUSH_BLOCK(s, 1); ***/
|
|
flush_block_only(s, true);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_FINISH_STARTED;
|
|
}
|
|
/***/
|
|
return BS_FINISH_DONE;
|
|
}
|
|
if (s.last_lit) {
|
|
/*** FLUSH_BLOCK(s, 0); ***/
|
|
flush_block_only(s, false);
|
|
if (s.strm.avail_out === 0) {
|
|
return BS_NEED_MORE;
|
|
}
|
|
/***/
|
|
}
|
|
return BS_BLOCK_DONE;
|
|
}
|
|
|
|
/* Values for max_lazy_match, good_match and max_chain_length, depending on
|
|
* the desired pack level (0..9). The values given below have been tuned to
|
|
* exclude worst case performance for pathological files. Better values may be
|
|
* found for specific files.
|
|
*/
|
|
function Config(good_length, max_lazy, nice_length, max_chain, func) {
|
|
this.good_length = good_length;
|
|
this.max_lazy = max_lazy;
|
|
this.nice_length = nice_length;
|
|
this.max_chain = max_chain;
|
|
this.func = func;
|
|
}
|
|
|
|
var configuration_table;
|
|
|
|
configuration_table = [
|
|
/* good lazy nice chain */
|
|
new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */
|
|
new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */
|
|
new Config(4, 5, 16, 8, deflate_fast), /* 2 */
|
|
new Config(4, 6, 32, 32, deflate_fast), /* 3 */
|
|
|
|
new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */
|
|
new Config(8, 16, 32, 32, deflate_slow), /* 5 */
|
|
new Config(8, 16, 128, 128, deflate_slow), /* 6 */
|
|
new Config(8, 32, 128, 256, deflate_slow), /* 7 */
|
|
new Config(32, 128, 258, 1024, deflate_slow), /* 8 */
|
|
new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */
|
|
];
|
|
|
|
|
|
/* ===========================================================================
|
|
* Initialize the "longest match" routines for a new zlib stream
|
|
*/
|
|
function lm_init(s) {
|
|
s.window_size = 2 * s.w_size;
|
|
|
|
/*** CLEAR_HASH(s); ***/
|
|
zero(s.head); // Fill with NIL (= 0);
|
|
|
|
/* Set the default configuration parameters:
|
|
*/
|
|
s.max_lazy_match = configuration_table[s.level].max_lazy;
|
|
s.good_match = configuration_table[s.level].good_length;
|
|
s.nice_match = configuration_table[s.level].nice_length;
|
|
s.max_chain_length = configuration_table[s.level].max_chain;
|
|
|
|
s.strstart = 0;
|
|
s.block_start = 0;
|
|
s.lookahead = 0;
|
|
s.insert = 0;
|
|
s.match_length = s.prev_length = MIN_MATCH - 1;
|
|
s.match_available = 0;
|
|
s.ins_h = 0;
|
|
}
|
|
|
|
|
|
function DeflateState() {
|
|
this.strm = null; /* pointer back to this zlib stream */
|
|
this.status = 0; /* as the name implies */
|
|
this.pending_buf = null; /* output still pending */
|
|
this.pending_buf_size = 0; /* size of pending_buf */
|
|
this.pending_out = 0; /* next pending byte to output to the stream */
|
|
this.pending = 0; /* nb of bytes in the pending buffer */
|
|
this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
|
|
this.gzhead = null; /* gzip header information to write */
|
|
this.gzindex = 0; /* where in extra, name, or comment */
|
|
this.method = Z_DEFLATED; /* can only be DEFLATED */
|
|
this.last_flush = -1; /* value of flush param for previous deflate call */
|
|
|
|
this.w_size = 0; /* LZ77 window size (32K by default) */
|
|
this.w_bits = 0; /* log2(w_size) (8..16) */
|
|
this.w_mask = 0; /* w_size - 1 */
|
|
|
|
this.window = null;
|
|
/* Sliding window. Input bytes are read into the second half of the window,
|
|
* and move to the first half later to keep a dictionary of at least wSize
|
|
* bytes. With this organization, matches are limited to a distance of
|
|
* wSize-MAX_MATCH bytes, but this ensures that IO is always
|
|
* performed with a length multiple of the block size.
|
|
*/
|
|
|
|
this.window_size = 0;
|
|
/* Actual size of window: 2*wSize, except when the user input buffer
|
|
* is directly used as sliding window.
|
|
*/
|
|
|
|
this.prev = null;
|
|
/* Link to older string with same hash index. To limit the size of this
|
|
* array to 64K, this link is maintained only for the last 32K strings.
|
|
* An index in this array is thus a window index modulo 32K.
|
|
*/
|
|
|
|
this.head = null; /* Heads of the hash chains or NIL. */
|
|
|
|
this.ins_h = 0; /* hash index of string to be inserted */
|
|
this.hash_size = 0; /* number of elements in hash table */
|
|
this.hash_bits = 0; /* log2(hash_size) */
|
|
this.hash_mask = 0; /* hash_size-1 */
|
|
|
|
this.hash_shift = 0;
|
|
/* Number of bits by which ins_h must be shifted at each input
|
|
* step. It must be such that after MIN_MATCH steps, the oldest
|
|
* byte no longer takes part in the hash key, that is:
|
|
* hash_shift * MIN_MATCH >= hash_bits
|
|
*/
|
|
|
|
this.block_start = 0;
|
|
/* Window position at the beginning of the current output block. Gets
|
|
* negative when the window is moved backwards.
|
|
*/
|
|
|
|
this.match_length = 0; /* length of best match */
|
|
this.prev_match = 0; /* previous match */
|
|
this.match_available = 0; /* set if previous match exists */
|
|
this.strstart = 0; /* start of string to insert */
|
|
this.match_start = 0; /* start of matching string */
|
|
this.lookahead = 0; /* number of valid bytes ahead in window */
|
|
|
|
this.prev_length = 0;
|
|
/* Length of the best match at previous step. Matches not greater than this
|
|
* are discarded. This is used in the lazy match evaluation.
|
|
*/
|
|
|
|
this.max_chain_length = 0;
|
|
/* To speed up deflation, hash chains are never searched beyond this
|
|
* length. A higher limit improves compression ratio but degrades the
|
|
* speed.
|
|
*/
|
|
|
|
this.max_lazy_match = 0;
|
|
/* Attempt to find a better match only when the current match is strictly
|
|
* smaller than this value. This mechanism is used only for compression
|
|
* levels >= 4.
|
|
*/
|
|
// That's alias to max_lazy_match, don't use directly
|
|
//this.max_insert_length = 0;
|
|
/* Insert new strings in the hash table only if the match length is not
|
|
* greater than this length. This saves time but degrades compression.
|
|
* max_insert_length is used only for compression levels <= 3.
|
|
*/
|
|
|
|
this.level = 0; /* compression level (1..9) */
|
|
this.strategy = 0; /* favor or force Huffman coding*/
|
|
|
|
this.good_match = 0;
|
|
/* Use a faster search when the previous match is longer than this */
|
|
|
|
this.nice_match = 0; /* Stop searching when current match exceeds this */
|
|
|
|
/* used by trees.c: */
|
|
|
|
/* Didn't use ct_data typedef below to suppress compiler warning */
|
|
|
|
// struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
|
|
// struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
|
|
// struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
|
|
|
|
// Use flat array of DOUBLE size, with interleaved fata,
|
|
// because JS does not support effective
|
|
this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);
|
|
this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);
|
|
this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);
|
|
zero(this.dyn_ltree);
|
|
zero(this.dyn_dtree);
|
|
zero(this.bl_tree);
|
|
|
|
this.l_desc = null; /* desc. for literal tree */
|
|
this.d_desc = null; /* desc. for distance tree */
|
|
this.bl_desc = null; /* desc. for bit length tree */
|
|
|
|
//ush bl_count[MAX_BITS+1];
|
|
this.bl_count = new utils.Buf16(MAX_BITS + 1);
|
|
/* number of codes at each bit length for an optimal tree */
|
|
|
|
//int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
|
|
this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */
|
|
zero(this.heap);
|
|
|
|
this.heap_len = 0; /* number of elements in the heap */
|
|
this.heap_max = 0; /* element of largest frequency */
|
|
/* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
|
|
* The same heap array is used to build all trees.
|
|
*/
|
|
|
|
this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];
|
|
zero(this.depth);
|
|
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
|
*/
|
|
|
|
this.l_buf = 0; /* buffer index for literals or lengths */
|
|
|
|
this.lit_bufsize = 0;
|
|
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
|
* limiting lit_bufsize to 64K:
|
|
* - frequencies can be kept in 16 bit counters
|
|
* - if compression is not successful for the first block, all input
|
|
* data is still in the window so we can still emit a stored block even
|
|
* when input comes from standard input. (This can also be done for
|
|
* all blocks if lit_bufsize is not greater than 32K.)
|
|
* - if compression is not successful for a file smaller than 64K, we can
|
|
* even emit a stored file instead of a stored block (saving 5 bytes).
|
|
* This is applicable only for zip (not gzip or zlib).
|
|
* - creating new Huffman trees less frequently may not provide fast
|
|
* adaptation to changes in the input data statistics. (Take for
|
|
* example a binary file with poorly compressible code followed by
|
|
* a highly compressible string table.) Smaller buffer sizes give
|
|
* fast adaptation but have of course the overhead of transmitting
|
|
* trees more frequently.
|
|
* - I can't count above 4
|
|
*/
|
|
|
|
this.last_lit = 0; /* running index in l_buf */
|
|
|
|
this.d_buf = 0;
|
|
/* Buffer index for distances. To simplify the code, d_buf and l_buf have
|
|
* the same number of elements. To use different lengths, an extra flag
|
|
* array would be necessary.
|
|
*/
|
|
|
|
this.opt_len = 0; /* bit length of current block with optimal trees */
|
|
this.static_len = 0; /* bit length of current block with static trees */
|
|
this.matches = 0; /* number of string matches in current block */
|
|
this.insert = 0; /* bytes at end of window left to insert */
|
|
|
|
|
|
this.bi_buf = 0;
|
|
/* Output buffer. bits are inserted starting at the bottom (least
|
|
* significant bits).
|
|
*/
|
|
this.bi_valid = 0;
|
|
/* Number of valid bits in bi_buf. All bits above the last valid bit
|
|
* are always zero.
|
|
*/
|
|
|
|
// Used for window memory init. We safely ignore it for JS. That makes
|
|
// sense only for pointers and memory check tools.
|
|
//this.high_water = 0;
|
|
/* High water mark offset in window for initialized bytes -- bytes above
|
|
* this are set to zero in order to avoid memory check warnings when
|
|
* longest match routines access bytes past the input. This is then
|
|
* updated to the new high water mark.
|
|
*/
|
|
}
|
|
|
|
|
|
function deflateResetKeep(strm) {
|
|
var s;
|
|
|
|
if (!strm || !strm.state) {
|
|
return err(strm, Z_STREAM_ERROR);
|
|
}
|
|
|
|
strm.total_in = strm.total_out = 0;
|
|
strm.data_type = Z_UNKNOWN;
|
|
|
|
s = strm.state;
|
|
s.pending = 0;
|
|
s.pending_out = 0;
|
|
|
|
if (s.wrap < 0) {
|
|
s.wrap = -s.wrap;
|
|
/* was made negative by deflate(..., Z_FINISH); */
|
|
}
|
|
s.status = (s.wrap ? INIT_STATE : BUSY_STATE);
|
|
strm.adler = (s.wrap === 2) ?
|
|
0 // crc32(0, Z_NULL, 0)
|
|
:
|
|
1; // adler32(0, Z_NULL, 0)
|
|
s.last_flush = Z_NO_FLUSH;
|
|
trees._tr_init(s);
|
|
return Z_OK;
|
|
}
|
|
|
|
|
|
function deflateReset(strm) {
|
|
var ret = deflateResetKeep(strm);
|
|
if (ret === Z_OK) {
|
|
lm_init(strm.state);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
|
|
function deflateSetHeader(strm, head) {
|
|
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
|
|
if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }
|
|
strm.state.gzhead = head;
|
|
return Z_OK;
|
|
}
|
|
|
|
|
|
function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
|
|
if (!strm) { // === Z_NULL
|
|
return Z_STREAM_ERROR;
|
|
}
|
|
var wrap = 1;
|
|
|
|
if (level === Z_DEFAULT_COMPRESSION) {
|
|
level = 6;
|
|
}
|
|
|
|
if (windowBits < 0) { /* suppress zlib wrapper */
|
|
wrap = 0;
|
|
windowBits = -windowBits;
|
|
}
|
|
|
|
else if (windowBits > 15) {
|
|
wrap = 2; /* write gzip wrapper instead */
|
|
windowBits -= 16;
|
|
}
|
|
|
|
|
|
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||
|
|
windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
|
|
strategy < 0 || strategy > Z_FIXED) {
|
|
return err(strm, Z_STREAM_ERROR);
|
|
}
|
|
|
|
|
|
if (windowBits === 8) {
|
|
windowBits = 9;
|
|
}
|
|
/* until 256-byte window bug fixed */
|
|
|
|
var s = new DeflateState();
|
|
|
|
strm.state = s;
|
|
s.strm = strm;
|
|
|
|
s.wrap = wrap;
|
|
s.gzhead = null;
|
|
s.w_bits = windowBits;
|
|
s.w_size = 1 << s.w_bits;
|
|
s.w_mask = s.w_size - 1;
|
|
|
|
s.hash_bits = memLevel + 7;
|
|
s.hash_size = 1 << s.hash_bits;
|
|
s.hash_mask = s.hash_size - 1;
|
|
s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);
|
|
|
|
s.window = new utils.Buf8(s.w_size * 2);
|
|
s.head = new utils.Buf16(s.hash_size);
|
|
s.prev = new utils.Buf16(s.w_size);
|
|
|
|
// Don't need mem init magic for JS.
|
|
//s.high_water = 0; /* nothing written to s->window yet */
|
|
|
|
s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
|
|
|
|
s.pending_buf_size = s.lit_bufsize * 4;
|
|
|
|
//overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
|
|
//s->pending_buf = (uchf *) overlay;
|
|
s.pending_buf = new utils.Buf8(s.pending_buf_size);
|
|
|
|
// It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)
|
|
//s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
|
|
s.d_buf = 1 * s.lit_bufsize;
|
|
|
|
//s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
|
|
s.l_buf = (1 + 2) * s.lit_bufsize;
|
|
|
|
s.level = level;
|
|
s.strategy = strategy;
|
|
s.method = method;
|
|
|
|
return deflateReset(strm);
|
|
}
|
|
|
|
function deflateInit(strm, level) {
|
|
return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
|
|
}
|
|
|
|
|
|
function deflate(strm, flush) {
|
|
var old_flush, s;
|
|
var beg, val; // for gzip header write only
|
|
|
|
if (!strm || !strm.state ||
|
|
flush > Z_BLOCK || flush < 0) {
|
|
return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
|
|
}
|
|
|
|
s = strm.state;
|
|
|
|
if (!strm.output ||
|
|
(!strm.input && strm.avail_in !== 0) ||
|
|
(s.status === FINISH_STATE && flush !== Z_FINISH)) {
|
|
return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);
|
|
}
|
|
|
|
s.strm = strm; /* just in case */
|
|
old_flush = s.last_flush;
|
|
s.last_flush = flush;
|
|
|
|
/* Write the header */
|
|
if (s.status === INIT_STATE) {
|
|
|
|
if (s.wrap === 2) { // GZIP header
|
|
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
|
put_byte(s, 31);
|
|
put_byte(s, 139);
|
|
put_byte(s, 8);
|
|
if (!s.gzhead) { // s->gzhead == Z_NULL
|
|
put_byte(s, 0);
|
|
put_byte(s, 0);
|
|
put_byte(s, 0);
|
|
put_byte(s, 0);
|
|
put_byte(s, 0);
|
|
put_byte(s, s.level === 9 ? 2 :
|
|
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
|
4 : 0));
|
|
put_byte(s, OS_CODE);
|
|
s.status = BUSY_STATE;
|
|
}
|
|
else {
|
|
put_byte(s, (s.gzhead.text ? 1 : 0) +
|
|
(s.gzhead.hcrc ? 2 : 0) +
|
|
(!s.gzhead.extra ? 0 : 4) +
|
|
(!s.gzhead.name ? 0 : 8) +
|
|
(!s.gzhead.comment ? 0 : 16)
|
|
);
|
|
put_byte(s, s.gzhead.time & 0xff);
|
|
put_byte(s, (s.gzhead.time >> 8) & 0xff);
|
|
put_byte(s, (s.gzhead.time >> 16) & 0xff);
|
|
put_byte(s, (s.gzhead.time >> 24) & 0xff);
|
|
put_byte(s, s.level === 9 ? 2 :
|
|
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
|
|
4 : 0));
|
|
put_byte(s, s.gzhead.os & 0xff);
|
|
if (s.gzhead.extra && s.gzhead.extra.length) {
|
|
put_byte(s, s.gzhead.extra.length & 0xff);
|
|
put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);
|
|
}
|
|
if (s.gzhead.hcrc) {
|
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);
|
|
}
|
|
s.gzindex = 0;
|
|
s.status = EXTRA_STATE;
|
|
}
|
|
}
|
|
else // DEFLATE header
|
|
{
|
|
var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;
|
|
var level_flags = -1;
|
|
|
|
if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
|
|
level_flags = 0;
|
|
} else if (s.level < 6) {
|
|
level_flags = 1;
|
|
} else if (s.level === 6) {
|
|
level_flags = 2;
|
|
} else {
|
|
level_flags = 3;
|
|
}
|
|
header |= (level_flags << 6);
|
|
if (s.strstart !== 0) { header |= PRESET_DICT; }
|
|
header += 31 - (header % 31);
|
|
|
|
s.status = BUSY_STATE;
|
|
putShortMSB(s, header);
|
|
|
|
/* Save the adler32 of the preset dictionary: */
|
|
if (s.strstart !== 0) {
|
|
putShortMSB(s, strm.adler >>> 16);
|
|
putShortMSB(s, strm.adler & 0xffff);
|
|
}
|
|
strm.adler = 1; // adler32(0L, Z_NULL, 0);
|
|
}
|
|
}
|
|
|
|
//#ifdef GZIP
|
|
if (s.status === EXTRA_STATE) {
|
|
if (s.gzhead.extra/* != Z_NULL*/) {
|
|
beg = s.pending; /* start of bytes to update crc */
|
|
|
|
while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {
|
|
if (s.pending === s.pending_buf_size) {
|
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
}
|
|
flush_pending(strm);
|
|
beg = s.pending;
|
|
if (s.pending === s.pending_buf_size) {
|
|
break;
|
|
}
|
|
}
|
|
put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);
|
|
s.gzindex++;
|
|
}
|
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
}
|
|
if (s.gzindex === s.gzhead.extra.length) {
|
|
s.gzindex = 0;
|
|
s.status = NAME_STATE;
|
|
}
|
|
}
|
|
else {
|
|
s.status = NAME_STATE;
|
|
}
|
|
}
|
|
if (s.status === NAME_STATE) {
|
|
if (s.gzhead.name/* != Z_NULL*/) {
|
|
beg = s.pending; /* start of bytes to update crc */
|
|
//int val;
|
|
|
|
do {
|
|
if (s.pending === s.pending_buf_size) {
|
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
}
|
|
flush_pending(strm);
|
|
beg = s.pending;
|
|
if (s.pending === s.pending_buf_size) {
|
|
val = 1;
|
|
break;
|
|
}
|
|
}
|
|
// JS specific: little magic to add zero terminator to end of string
|
|
if (s.gzindex < s.gzhead.name.length) {
|
|
val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;
|
|
} else {
|
|
val = 0;
|
|
}
|
|
put_byte(s, val);
|
|
} while (val !== 0);
|
|
|
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
}
|
|
if (val === 0) {
|
|
s.gzindex = 0;
|
|
s.status = COMMENT_STATE;
|
|
}
|
|
}
|
|
else {
|
|
s.status = COMMENT_STATE;
|
|
}
|
|
}
|
|
if (s.status === COMMENT_STATE) {
|
|
if (s.gzhead.comment/* != Z_NULL*/) {
|
|
beg = s.pending; /* start of bytes to update crc */
|
|
//int val;
|
|
|
|
do {
|
|
if (s.pending === s.pending_buf_size) {
|
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
}
|
|
flush_pending(strm);
|
|
beg = s.pending;
|
|
if (s.pending === s.pending_buf_size) {
|
|
val = 1;
|
|
break;
|
|
}
|
|
}
|
|
// JS specific: little magic to add zero terminator to end of string
|
|
if (s.gzindex < s.gzhead.comment.length) {
|
|
val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;
|
|
} else {
|
|
val = 0;
|
|
}
|
|
put_byte(s, val);
|
|
} while (val !== 0);
|
|
|
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
}
|
|
if (val === 0) {
|
|
s.status = HCRC_STATE;
|
|
}
|
|
}
|
|
else {
|
|
s.status = HCRC_STATE;
|
|
}
|
|
}
|
|
if (s.status === HCRC_STATE) {
|
|
if (s.gzhead.hcrc) {
|
|
if (s.pending + 2 > s.pending_buf_size) {
|
|
flush_pending(strm);
|
|
}
|
|
if (s.pending + 2 <= s.pending_buf_size) {
|
|
put_byte(s, strm.adler & 0xff);
|
|
put_byte(s, (strm.adler >> 8) & 0xff);
|
|
strm.adler = 0; //crc32(0L, Z_NULL, 0);
|
|
s.status = BUSY_STATE;
|
|
}
|
|
}
|
|
else {
|
|
s.status = BUSY_STATE;
|
|
}
|
|
}
|
|
//#endif
|
|
|
|
/* Flush as much pending output as possible */
|
|
if (s.pending !== 0) {
|
|
flush_pending(strm);
|
|
if (strm.avail_out === 0) {
|
|
/* Since avail_out is 0, deflate will be called again with
|
|
* more output space, but possibly with both pending and
|
|
* avail_in equal to zero. There won't be anything to do,
|
|
* but this is not an error situation so make sure we
|
|
* return OK instead of BUF_ERROR at next call of deflate:
|
|
*/
|
|
s.last_flush = -1;
|
|
return Z_OK;
|
|
}
|
|
|
|
/* Make sure there is something to do and avoid duplicate consecutive
|
|
* flushes. For repeated and useless calls with Z_FINISH, we keep
|
|
* returning Z_STREAM_END instead of Z_BUF_ERROR.
|
|
*/
|
|
} else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&
|
|
flush !== Z_FINISH) {
|
|
return err(strm, Z_BUF_ERROR);
|
|
}
|
|
|
|
/* User must not provide more input after the first FINISH: */
|
|
if (s.status === FINISH_STATE && strm.avail_in !== 0) {
|
|
return err(strm, Z_BUF_ERROR);
|
|
}
|
|
|
|
/* Start a new block or continue the current one.
|
|
*/
|
|
if (strm.avail_in !== 0 || s.lookahead !== 0 ||
|
|
(flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {
|
|
var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :
|
|
(s.strategy === Z_RLE ? deflate_rle(s, flush) :
|
|
configuration_table[s.level].func(s, flush));
|
|
|
|
if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
|
|
s.status = FINISH_STATE;
|
|
}
|
|
if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {
|
|
if (strm.avail_out === 0) {
|
|
s.last_flush = -1;
|
|
/* avoid BUF_ERROR next call, see above */
|
|
}
|
|
return Z_OK;
|
|
/* If flush != Z_NO_FLUSH && avail_out == 0, the next call
|
|
* of deflate should use the same flush parameter to make sure
|
|
* that the flush is complete. So we don't have to output an
|
|
* empty block here, this will be done at next call. This also
|
|
* ensures that for a very small output buffer, we emit at most
|
|
* one empty block.
|
|
*/
|
|
}
|
|
if (bstate === BS_BLOCK_DONE) {
|
|
if (flush === Z_PARTIAL_FLUSH) {
|
|
trees._tr_align(s);
|
|
}
|
|
else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
|
|
|
|
trees._tr_stored_block(s, 0, 0, false);
|
|
/* For a full flush, this empty block will be recognized
|
|
* as a special marker by inflate_sync().
|
|
*/
|
|
if (flush === Z_FULL_FLUSH) {
|
|
/*** CLEAR_HASH(s); ***/ /* forget history */
|
|
zero(s.head); // Fill with NIL (= 0);
|
|
|
|
if (s.lookahead === 0) {
|
|
s.strstart = 0;
|
|
s.block_start = 0;
|
|
s.insert = 0;
|
|
}
|
|
}
|
|
}
|
|
flush_pending(strm);
|
|
if (strm.avail_out === 0) {
|
|
s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */
|
|
return Z_OK;
|
|
}
|
|
}
|
|
}
|
|
//Assert(strm->avail_out > 0, "bug2");
|
|
//if (strm.avail_out <= 0) { throw new Error("bug2");}
|
|
|
|
if (flush !== Z_FINISH) { return Z_OK; }
|
|
if (s.wrap <= 0) { return Z_STREAM_END; }
|
|
|
|
/* Write the trailer */
|
|
if (s.wrap === 2) {
|
|
put_byte(s, strm.adler & 0xff);
|
|
put_byte(s, (strm.adler >> 8) & 0xff);
|
|
put_byte(s, (strm.adler >> 16) & 0xff);
|
|
put_byte(s, (strm.adler >> 24) & 0xff);
|
|
put_byte(s, strm.total_in & 0xff);
|
|
put_byte(s, (strm.total_in >> 8) & 0xff);
|
|
put_byte(s, (strm.total_in >> 16) & 0xff);
|
|
put_byte(s, (strm.total_in >> 24) & 0xff);
|
|
}
|
|
else
|
|
{
|
|
putShortMSB(s, strm.adler >>> 16);
|
|
putShortMSB(s, strm.adler & 0xffff);
|
|
}
|
|
|
|
flush_pending(strm);
|
|
/* If avail_out is zero, the application will call deflate again
|
|
* to flush the rest.
|
|
*/
|
|
if (s.wrap > 0) { s.wrap = -s.wrap; }
|
|
/* write the trailer only once! */
|
|
return s.pending !== 0 ? Z_OK : Z_STREAM_END;
|
|
}
|
|
|
|
function deflateEnd(strm) {
|
|
var status;
|
|
|
|
if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {
|
|
return Z_STREAM_ERROR;
|
|
}
|
|
|
|
status = strm.state.status;
|
|
if (status !== INIT_STATE &&
|
|
status !== EXTRA_STATE &&
|
|
status !== NAME_STATE &&
|
|
status !== COMMENT_STATE &&
|
|
status !== HCRC_STATE &&
|
|
status !== BUSY_STATE &&
|
|
status !== FINISH_STATE
|
|
) {
|
|
return err(strm, Z_STREAM_ERROR);
|
|
}
|
|
|
|
strm.state = null;
|
|
|
|
return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
|
|
}
|
|
|
|
|
|
/* =========================================================================
|
|
* Initializes the compression dictionary from the given byte
|
|
* sequence without producing any compressed output.
|
|
*/
|
|
function deflateSetDictionary(strm, dictionary) {
|
|
var dictLength = dictionary.length;
|
|
|
|
var s;
|
|
var str, n;
|
|
var wrap;
|
|
var avail;
|
|
var next;
|
|
var input;
|
|
var tmpDict;
|
|
|
|
if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {
|
|
return Z_STREAM_ERROR;
|
|
}
|
|
|
|
s = strm.state;
|
|
wrap = s.wrap;
|
|
|
|
if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {
|
|
return Z_STREAM_ERROR;
|
|
}
|
|
|
|
/* when using zlib wrappers, compute Adler-32 for provided dictionary */
|
|
if (wrap === 1) {
|
|
/* adler32(strm->adler, dictionary, dictLength); */
|
|
strm.adler = adler32(strm.adler, dictionary, dictLength, 0);
|
|
}
|
|
|
|
s.wrap = 0; /* avoid computing Adler-32 in read_buf */
|
|
|
|
/* if dictionary would fill window, just replace the history */
|
|
if (dictLength >= s.w_size) {
|
|
if (wrap === 0) { /* already empty otherwise */
|
|
/*** CLEAR_HASH(s); ***/
|
|
zero(s.head); // Fill with NIL (= 0);
|
|
s.strstart = 0;
|
|
s.block_start = 0;
|
|
s.insert = 0;
|
|
}
|
|
/* use the tail */
|
|
// dictionary = dictionary.slice(dictLength - s.w_size);
|
|
tmpDict = new utils.Buf8(s.w_size);
|
|
utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);
|
|
dictionary = tmpDict;
|
|
dictLength = s.w_size;
|
|
}
|
|
/* insert dictionary into window and hash */
|
|
avail = strm.avail_in;
|
|
next = strm.next_in;
|
|
input = strm.input;
|
|
strm.avail_in = dictLength;
|
|
strm.next_in = 0;
|
|
strm.input = dictionary;
|
|
fill_window(s);
|
|
while (s.lookahead >= MIN_MATCH) {
|
|
str = s.strstart;
|
|
n = s.lookahead - (MIN_MATCH - 1);
|
|
do {
|
|
/* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
|
|
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
|
|
|
|
s.prev[str & s.w_mask] = s.head[s.ins_h];
|
|
|
|
s.head[s.ins_h] = str;
|
|
str++;
|
|
} while (--n);
|
|
s.strstart = str;
|
|
s.lookahead = MIN_MATCH - 1;
|
|
fill_window(s);
|
|
}
|
|
s.strstart += s.lookahead;
|
|
s.block_start = s.strstart;
|
|
s.insert = s.lookahead;
|
|
s.lookahead = 0;
|
|
s.match_length = s.prev_length = MIN_MATCH - 1;
|
|
s.match_available = 0;
|
|
strm.next_in = next;
|
|
strm.input = input;
|
|
strm.avail_in = avail;
|
|
s.wrap = wrap;
|
|
return Z_OK;
|
|
}
|
|
|
|
|
|
exports.deflateInit = deflateInit;
|
|
exports.deflateInit2 = deflateInit2;
|
|
exports.deflateReset = deflateReset;
|
|
exports.deflateResetKeep = deflateResetKeep;
|
|
exports.deflateSetHeader = deflateSetHeader;
|
|
exports.deflate = deflate;
|
|
exports.deflateEnd = deflateEnd;
|
|
exports.deflateSetDictionary = deflateSetDictionary;
|
|
exports.deflateInfo = 'pako deflate (from Nodeca project)';
|
|
|
|
/* Not implemented
|
|
exports.deflateBound = deflateBound;
|
|
exports.deflateCopy = deflateCopy;
|
|
exports.deflateParams = deflateParams;
|
|
exports.deflatePending = deflatePending;
|
|
exports.deflatePrime = deflatePrime;
|
|
exports.deflateTune = deflateTune;
|
|
*/
|
|
|
|
|
|
/***/ },
|
|
/* 61 */
|
|
/***/ function(module, exports) {
|
|
|
|
'use strict';
|
|
|
|
|
|
var TYPED_OK = (typeof Uint8Array !== 'undefined') &&
|
|
(typeof Uint16Array !== 'undefined') &&
|
|
(typeof Int32Array !== 'undefined');
|
|
|
|
|
|
exports.assign = function (obj /*from1, from2, from3, ...*/) {
|
|
var sources = Array.prototype.slice.call(arguments, 1);
|
|
while (sources.length) {
|
|
var source = sources.shift();
|
|
if (!source) { continue; }
|
|
|
|
if (typeof source !== 'object') {
|
|
throw new TypeError(source + 'must be non-object');
|
|
}
|
|
|
|
for (var p in source) {
|
|
if (source.hasOwnProperty(p)) {
|
|
obj[p] = source[p];
|
|
}
|
|
}
|
|
}
|
|
|
|
return obj;
|
|
};
|
|
|
|
|
|
// reduce buffer size, avoiding mem copy
|
|
exports.shrinkBuf = function (buf, size) {
|
|
if (buf.length === size) { return buf; }
|
|
if (buf.subarray) { return buf.subarray(0, size); }
|
|
buf.length = size;
|
|
return buf;
|
|
};
|
|
|
|
|
|
var fnTyped = {
|
|
arraySet: function (dest, src, src_offs, len, dest_offs) {
|
|
if (src.subarray && dest.subarray) {
|
|
dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
|
|
return;
|
|
}
|
|
// Fallback to ordinary array
|
|
for (var i = 0; i < len; i++) {
|
|
dest[dest_offs + i] = src[src_offs + i];
|
|
}
|
|
},
|
|
// Join array of chunks to single array.
|
|
flattenChunks: function (chunks) {
|
|
var i, l, len, pos, chunk, result;
|
|
|
|
// calculate data length
|
|
len = 0;
|
|
for (i = 0, l = chunks.length; i < l; i++) {
|
|
len += chunks[i].length;
|
|
}
|
|
|
|
// join chunks
|
|
result = new Uint8Array(len);
|
|
pos = 0;
|
|
for (i = 0, l = chunks.length; i < l; i++) {
|
|
chunk = chunks[i];
|
|
result.set(chunk, pos);
|
|
pos += chunk.length;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
};
|
|
|
|
var fnUntyped = {
|
|
arraySet: function (dest, src, src_offs, len, dest_offs) {
|
|
for (var i = 0; i < len; i++) {
|
|
dest[dest_offs + i] = src[src_offs + i];
|
|
}
|
|
},
|
|
// Join array of chunks to single array.
|
|
flattenChunks: function (chunks) {
|
|
return [].concat.apply([], chunks);
|
|
}
|
|
};
|
|
|
|
|
|
// Enable/Disable typed arrays use, for testing
|
|
//
|
|
exports.setTyped = function (on) {
|
|
if (on) {
|
|
exports.Buf8 = Uint8Array;
|
|
exports.Buf16 = Uint16Array;
|
|
exports.Buf32 = Int32Array;
|
|
exports.assign(exports, fnTyped);
|
|
} else {
|
|
exports.Buf8 = Array;
|
|
exports.Buf16 = Array;
|
|
exports.Buf32 = Array;
|
|
exports.assign(exports, fnUntyped);
|
|
}
|
|
};
|
|
|
|
exports.setTyped(TYPED_OK);
|
|
|
|
|
|
/***/ },
|
|
/* 62 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
|
|
var utils = __webpack_require__(61);
|
|
|
|
/* Public constants ==========================================================*/
|
|
/* ===========================================================================*/
|
|
|
|
|
|
//var Z_FILTERED = 1;
|
|
//var Z_HUFFMAN_ONLY = 2;
|
|
//var Z_RLE = 3;
|
|
var Z_FIXED = 4;
|
|
//var Z_DEFAULT_STRATEGY = 0;
|
|
|
|
/* Possible values of the data_type field (though see inflate()) */
|
|
var Z_BINARY = 0;
|
|
var Z_TEXT = 1;
|
|
//var Z_ASCII = 1; // = Z_TEXT
|
|
var Z_UNKNOWN = 2;
|
|
|
|
/*============================================================================*/
|
|
|
|
|
|
function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
|
|
|
|
// From zutil.h
|
|
|
|
var STORED_BLOCK = 0;
|
|
var STATIC_TREES = 1;
|
|
var DYN_TREES = 2;
|
|
/* The three kinds of block type */
|
|
|
|
var MIN_MATCH = 3;
|
|
var MAX_MATCH = 258;
|
|
/* The minimum and maximum match lengths */
|
|
|
|
// From deflate.h
|
|
/* ===========================================================================
|
|
* Internal compression state.
|
|
*/
|
|
|
|
var LENGTH_CODES = 29;
|
|
/* number of length codes, not counting the special END_BLOCK code */
|
|
|
|
var LITERALS = 256;
|
|
/* number of literal bytes 0..255 */
|
|
|
|
var L_CODES = LITERALS + 1 + LENGTH_CODES;
|
|
/* number of Literal or Length codes, including the END_BLOCK code */
|
|
|
|
var D_CODES = 30;
|
|
/* number of distance codes */
|
|
|
|
var BL_CODES = 19;
|
|
/* number of codes used to transfer the bit lengths */
|
|
|
|
var HEAP_SIZE = 2 * L_CODES + 1;
|
|
/* maximum heap size */
|
|
|
|
var MAX_BITS = 15;
|
|
/* All codes must not exceed MAX_BITS bits */
|
|
|
|
var Buf_size = 16;
|
|
/* size of bit buffer in bi_buf */
|
|
|
|
|
|
/* ===========================================================================
|
|
* Constants
|
|
*/
|
|
|
|
var MAX_BL_BITS = 7;
|
|
/* Bit length codes must not exceed MAX_BL_BITS bits */
|
|
|
|
var END_BLOCK = 256;
|
|
/* end of block literal code */
|
|
|
|
var REP_3_6 = 16;
|
|
/* repeat previous bit length 3-6 times (2 bits of repeat count) */
|
|
|
|
var REPZ_3_10 = 17;
|
|
/* repeat a zero length 3-10 times (3 bits of repeat count) */
|
|
|
|
var REPZ_11_138 = 18;
|
|
/* repeat a zero length 11-138 times (7 bits of repeat count) */
|
|
|
|
/* eslint-disable comma-spacing,array-bracket-spacing */
|
|
var extra_lbits = /* extra bits for each length code */
|
|
[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];
|
|
|
|
var extra_dbits = /* extra bits for each distance code */
|
|
[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];
|
|
|
|
var extra_blbits = /* extra bits for each bit length code */
|
|
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];
|
|
|
|
var bl_order =
|
|
[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];
|
|
/* eslint-enable comma-spacing,array-bracket-spacing */
|
|
|
|
/* The lengths of the bit length codes are sent in order of decreasing
|
|
* probability, to avoid transmitting the lengths for unused bit length codes.
|
|
*/
|
|
|
|
/* ===========================================================================
|
|
* Local data. These are initialized only once.
|
|
*/
|
|
|
|
// We pre-fill arrays with 0 to avoid uninitialized gaps
|
|
|
|
var DIST_CODE_LEN = 512; /* see definition of array dist_code below */
|
|
|
|
// !!!! Use flat array insdead of structure, Freq = i*2, Len = i*2+1
|
|
var static_ltree = new Array((L_CODES + 2) * 2);
|
|
zero(static_ltree);
|
|
/* The static literal tree. Since the bit lengths are imposed, there is no
|
|
* need for the L_CODES extra codes used during heap construction. However
|
|
* The codes 286 and 287 are needed to build a canonical tree (see _tr_init
|
|
* below).
|
|
*/
|
|
|
|
var static_dtree = new Array(D_CODES * 2);
|
|
zero(static_dtree);
|
|
/* The static distance tree. (Actually a trivial tree since all codes use
|
|
* 5 bits.)
|
|
*/
|
|
|
|
var _dist_code = new Array(DIST_CODE_LEN);
|
|
zero(_dist_code);
|
|
/* Distance codes. The first 256 values correspond to the distances
|
|
* 3 .. 258, the last 256 values correspond to the top 8 bits of
|
|
* the 15 bit distances.
|
|
*/
|
|
|
|
var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);
|
|
zero(_length_code);
|
|
/* length code for each normalized match length (0 == MIN_MATCH) */
|
|
|
|
var base_length = new Array(LENGTH_CODES);
|
|
zero(base_length);
|
|
/* First normalized length for each code (0 = MIN_MATCH) */
|
|
|
|
var base_dist = new Array(D_CODES);
|
|
zero(base_dist);
|
|
/* First normalized distance for each code (0 = distance of 1) */
|
|
|
|
|
|
function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {
|
|
|
|
this.static_tree = static_tree; /* static tree or NULL */
|
|
this.extra_bits = extra_bits; /* extra bits for each code or NULL */
|
|
this.extra_base = extra_base; /* base index for extra_bits */
|
|
this.elems = elems; /* max number of elements in the tree */
|
|
this.max_length = max_length; /* max bit length for the codes */
|
|
|
|
// show if `static_tree` has data or dummy - needed for monomorphic objects
|
|
this.has_stree = static_tree && static_tree.length;
|
|
}
|
|
|
|
|
|
var static_l_desc;
|
|
var static_d_desc;
|
|
var static_bl_desc;
|
|
|
|
|
|
function TreeDesc(dyn_tree, stat_desc) {
|
|
this.dyn_tree = dyn_tree; /* the dynamic tree */
|
|
this.max_code = 0; /* largest code with non zero frequency */
|
|
this.stat_desc = stat_desc; /* the corresponding static tree */
|
|
}
|
|
|
|
|
|
|
|
function d_code(dist) {
|
|
return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Output a short LSB first on the stream.
|
|
* IN assertion: there is enough room in pendingBuf.
|
|
*/
|
|
function put_short(s, w) {
|
|
// put_byte(s, (uch)((w) & 0xff));
|
|
// put_byte(s, (uch)((ush)(w) >> 8));
|
|
s.pending_buf[s.pending++] = (w) & 0xff;
|
|
s.pending_buf[s.pending++] = (w >>> 8) & 0xff;
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Send a value on a given number of bits.
|
|
* IN assertion: length <= 16 and value fits in length bits.
|
|
*/
|
|
function send_bits(s, value, length) {
|
|
if (s.bi_valid > (Buf_size - length)) {
|
|
s.bi_buf |= (value << s.bi_valid) & 0xffff;
|
|
put_short(s, s.bi_buf);
|
|
s.bi_buf = value >> (Buf_size - s.bi_valid);
|
|
s.bi_valid += length - Buf_size;
|
|
} else {
|
|
s.bi_buf |= (value << s.bi_valid) & 0xffff;
|
|
s.bi_valid += length;
|
|
}
|
|
}
|
|
|
|
|
|
function send_code(s, c, tree) {
|
|
send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Reverse the first len bits of a code, using straightforward code (a faster
|
|
* method would use a table)
|
|
* IN assertion: 1 <= len <= 15
|
|
*/
|
|
function bi_reverse(code, len) {
|
|
var res = 0;
|
|
do {
|
|
res |= code & 1;
|
|
code >>>= 1;
|
|
res <<= 1;
|
|
} while (--len > 0);
|
|
return res >>> 1;
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Flush the bit buffer, keeping at most 7 bits in it.
|
|
*/
|
|
function bi_flush(s) {
|
|
if (s.bi_valid === 16) {
|
|
put_short(s, s.bi_buf);
|
|
s.bi_buf = 0;
|
|
s.bi_valid = 0;
|
|
|
|
} else if (s.bi_valid >= 8) {
|
|
s.pending_buf[s.pending++] = s.bi_buf & 0xff;
|
|
s.bi_buf >>= 8;
|
|
s.bi_valid -= 8;
|
|
}
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Compute the optimal bit lengths for a tree and update the total bit length
|
|
* for the current block.
|
|
* IN assertion: the fields freq and dad are set, heap[heap_max] and
|
|
* above are the tree nodes sorted by increasing frequency.
|
|
* OUT assertions: the field len is set to the optimal bit length, the
|
|
* array bl_count contains the frequencies for each bit length.
|
|
* The length opt_len is updated; static_len is also updated if stree is
|
|
* not null.
|
|
*/
|
|
function gen_bitlen(s, desc)
|
|
// deflate_state *s;
|
|
// tree_desc *desc; /* the tree descriptor */
|
|
{
|
|
var tree = desc.dyn_tree;
|
|
var max_code = desc.max_code;
|
|
var stree = desc.stat_desc.static_tree;
|
|
var has_stree = desc.stat_desc.has_stree;
|
|
var extra = desc.stat_desc.extra_bits;
|
|
var base = desc.stat_desc.extra_base;
|
|
var max_length = desc.stat_desc.max_length;
|
|
var h; /* heap index */
|
|
var n, m; /* iterate over the tree elements */
|
|
var bits; /* bit length */
|
|
var xbits; /* extra bits */
|
|
var f; /* frequency */
|
|
var overflow = 0; /* number of elements with bit length too large */
|
|
|
|
for (bits = 0; bits <= MAX_BITS; bits++) {
|
|
s.bl_count[bits] = 0;
|
|
}
|
|
|
|
/* In a first pass, compute the optimal bit lengths (which may
|
|
* overflow in the case of the bit length tree).
|
|
*/
|
|
tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */
|
|
|
|
for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {
|
|
n = s.heap[h];
|
|
bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;
|
|
if (bits > max_length) {
|
|
bits = max_length;
|
|
overflow++;
|
|
}
|
|
tree[n * 2 + 1]/*.Len*/ = bits;
|
|
/* We overwrite tree[n].Dad which is no longer needed */
|
|
|
|
if (n > max_code) { continue; } /* not a leaf node */
|
|
|
|
s.bl_count[bits]++;
|
|
xbits = 0;
|
|
if (n >= base) {
|
|
xbits = extra[n - base];
|
|
}
|
|
f = tree[n * 2]/*.Freq*/;
|
|
s.opt_len += f * (bits + xbits);
|
|
if (has_stree) {
|
|
s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);
|
|
}
|
|
}
|
|
if (overflow === 0) { return; }
|
|
|
|
// Trace((stderr,"\nbit length overflow\n"));
|
|
/* This happens for example on obj2 and pic of the Calgary corpus */
|
|
|
|
/* Find the first bit length which could increase: */
|
|
do {
|
|
bits = max_length - 1;
|
|
while (s.bl_count[bits] === 0) { bits--; }
|
|
s.bl_count[bits]--; /* move one leaf down the tree */
|
|
s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */
|
|
s.bl_count[max_length]--;
|
|
/* The brother of the overflow item also moves one step up,
|
|
* but this does not affect bl_count[max_length]
|
|
*/
|
|
overflow -= 2;
|
|
} while (overflow > 0);
|
|
|
|
/* Now recompute all bit lengths, scanning in increasing frequency.
|
|
* h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
|
|
* lengths instead of fixing only the wrong ones. This idea is taken
|
|
* from 'ar' written by Haruhiko Okumura.)
|
|
*/
|
|
for (bits = max_length; bits !== 0; bits--) {
|
|
n = s.bl_count[bits];
|
|
while (n !== 0) {
|
|
m = s.heap[--h];
|
|
if (m > max_code) { continue; }
|
|
if (tree[m * 2 + 1]/*.Len*/ !== bits) {
|
|
// Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
|
|
s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;
|
|
tree[m * 2 + 1]/*.Len*/ = bits;
|
|
}
|
|
n--;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Generate the codes for a given tree and bit counts (which need not be
|
|
* optimal).
|
|
* IN assertion: the array bl_count contains the bit length statistics for
|
|
* the given tree and the field len is set for all tree elements.
|
|
* OUT assertion: the field code is set for all tree elements of non
|
|
* zero code length.
|
|
*/
|
|
function gen_codes(tree, max_code, bl_count)
|
|
// ct_data *tree; /* the tree to decorate */
|
|
// int max_code; /* largest code with non zero frequency */
|
|
// ushf *bl_count; /* number of codes at each bit length */
|
|
{
|
|
var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */
|
|
var code = 0; /* running code value */
|
|
var bits; /* bit index */
|
|
var n; /* code index */
|
|
|
|
/* The distribution counts are first used to generate the code values
|
|
* without bit reversal.
|
|
*/
|
|
for (bits = 1; bits <= MAX_BITS; bits++) {
|
|
next_code[bits] = code = (code + bl_count[bits - 1]) << 1;
|
|
}
|
|
/* Check that the bit counts in bl_count are consistent. The last code
|
|
* must be all ones.
|
|
*/
|
|
//Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
|
|
// "inconsistent bit counts");
|
|
//Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
|
|
|
|
for (n = 0; n <= max_code; n++) {
|
|
var len = tree[n * 2 + 1]/*.Len*/;
|
|
if (len === 0) { continue; }
|
|
/* Now reverse the bits */
|
|
tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len);
|
|
|
|
//Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
|
|
// n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
|
|
}
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Initialize the various 'constant' tables.
|
|
*/
|
|
function tr_static_init() {
|
|
var n; /* iterates over tree elements */
|
|
var bits; /* bit counter */
|
|
var length; /* length value */
|
|
var code; /* code value */
|
|
var dist; /* distance index */
|
|
var bl_count = new Array(MAX_BITS + 1);
|
|
/* number of codes at each bit length for an optimal tree */
|
|
|
|
// do check in _tr_init()
|
|
//if (static_init_done) return;
|
|
|
|
/* For some embedded targets, global variables are not initialized: */
|
|
/*#ifdef NO_INIT_GLOBAL_POINTERS
|
|
static_l_desc.static_tree = static_ltree;
|
|
static_l_desc.extra_bits = extra_lbits;
|
|
static_d_desc.static_tree = static_dtree;
|
|
static_d_desc.extra_bits = extra_dbits;
|
|
static_bl_desc.extra_bits = extra_blbits;
|
|
#endif*/
|
|
|
|
/* Initialize the mapping length (0..255) -> length code (0..28) */
|
|
length = 0;
|
|
for (code = 0; code < LENGTH_CODES - 1; code++) {
|
|
base_length[code] = length;
|
|
for (n = 0; n < (1 << extra_lbits[code]); n++) {
|
|
_length_code[length++] = code;
|
|
}
|
|
}
|
|
//Assert (length == 256, "tr_static_init: length != 256");
|
|
/* Note that the length 255 (match length 258) can be represented
|
|
* in two different ways: code 284 + 5 bits or code 285, so we
|
|
* overwrite length_code[255] to use the best encoding:
|
|
*/
|
|
_length_code[length - 1] = code;
|
|
|
|
/* Initialize the mapping dist (0..32K) -> dist code (0..29) */
|
|
dist = 0;
|
|
for (code = 0; code < 16; code++) {
|
|
base_dist[code] = dist;
|
|
for (n = 0; n < (1 << extra_dbits[code]); n++) {
|
|
_dist_code[dist++] = code;
|
|
}
|
|
}
|
|
//Assert (dist == 256, "tr_static_init: dist != 256");
|
|
dist >>= 7; /* from now on, all distances are divided by 128 */
|
|
for (; code < D_CODES; code++) {
|
|
base_dist[code] = dist << 7;
|
|
for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {
|
|
_dist_code[256 + dist++] = code;
|
|
}
|
|
}
|
|
//Assert (dist == 256, "tr_static_init: 256+dist != 512");
|
|
|
|
/* Construct the codes of the static literal tree */
|
|
for (bits = 0; bits <= MAX_BITS; bits++) {
|
|
bl_count[bits] = 0;
|
|
}
|
|
|
|
n = 0;
|
|
while (n <= 143) {
|
|
static_ltree[n * 2 + 1]/*.Len*/ = 8;
|
|
n++;
|
|
bl_count[8]++;
|
|
}
|
|
while (n <= 255) {
|
|
static_ltree[n * 2 + 1]/*.Len*/ = 9;
|
|
n++;
|
|
bl_count[9]++;
|
|
}
|
|
while (n <= 279) {
|
|
static_ltree[n * 2 + 1]/*.Len*/ = 7;
|
|
n++;
|
|
bl_count[7]++;
|
|
}
|
|
while (n <= 287) {
|
|
static_ltree[n * 2 + 1]/*.Len*/ = 8;
|
|
n++;
|
|
bl_count[8]++;
|
|
}
|
|
/* Codes 286 and 287 do not exist, but we must include them in the
|
|
* tree construction to get a canonical Huffman tree (longest code
|
|
* all ones)
|
|
*/
|
|
gen_codes(static_ltree, L_CODES + 1, bl_count);
|
|
|
|
/* The static distance tree is trivial: */
|
|
for (n = 0; n < D_CODES; n++) {
|
|
static_dtree[n * 2 + 1]/*.Len*/ = 5;
|
|
static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);
|
|
}
|
|
|
|
// Now data ready and we can init static trees
|
|
static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);
|
|
static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);
|
|
static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);
|
|
|
|
//static_init_done = true;
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Initialize a new block.
|
|
*/
|
|
function init_block(s) {
|
|
var n; /* iterates over tree elements */
|
|
|
|
/* Initialize the trees. */
|
|
for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }
|
|
for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }
|
|
for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }
|
|
|
|
s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;
|
|
s.opt_len = s.static_len = 0;
|
|
s.last_lit = s.matches = 0;
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Flush the bit buffer and align the output on a byte boundary
|
|
*/
|
|
function bi_windup(s)
|
|
{
|
|
if (s.bi_valid > 8) {
|
|
put_short(s, s.bi_buf);
|
|
} else if (s.bi_valid > 0) {
|
|
//put_byte(s, (Byte)s->bi_buf);
|
|
s.pending_buf[s.pending++] = s.bi_buf;
|
|
}
|
|
s.bi_buf = 0;
|
|
s.bi_valid = 0;
|
|
}
|
|
|
|
/* ===========================================================================
|
|
* Copy a stored block, storing first the length and its
|
|
* one's complement if requested.
|
|
*/
|
|
function copy_block(s, buf, len, header)
|
|
//DeflateState *s;
|
|
//charf *buf; /* the input data */
|
|
//unsigned len; /* its length */
|
|
//int header; /* true if block header must be written */
|
|
{
|
|
bi_windup(s); /* align on byte boundary */
|
|
|
|
if (header) {
|
|
put_short(s, len);
|
|
put_short(s, ~len);
|
|
}
|
|
// while (len--) {
|
|
// put_byte(s, *buf++);
|
|
// }
|
|
utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);
|
|
s.pending += len;
|
|
}
|
|
|
|
/* ===========================================================================
|
|
* Compares to subtrees, using the tree depth as tie breaker when
|
|
* the subtrees have equal frequency. This minimizes the worst case length.
|
|
*/
|
|
function smaller(tree, n, m, depth) {
|
|
var _n2 = n * 2;
|
|
var _m2 = m * 2;
|
|
return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||
|
|
(tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));
|
|
}
|
|
|
|
/* ===========================================================================
|
|
* Restore the heap property by moving down the tree starting at node k,
|
|
* exchanging a node with the smallest of its two sons if necessary, stopping
|
|
* when the heap property is re-established (each father smaller than its
|
|
* two sons).
|
|
*/
|
|
function pqdownheap(s, tree, k)
|
|
// deflate_state *s;
|
|
// ct_data *tree; /* the tree to restore */
|
|
// int k; /* node to move down */
|
|
{
|
|
var v = s.heap[k];
|
|
var j = k << 1; /* left son of k */
|
|
while (j <= s.heap_len) {
|
|
/* Set j to the smallest of the two sons: */
|
|
if (j < s.heap_len &&
|
|
smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
|
|
j++;
|
|
}
|
|
/* Exit if v is smaller than both sons */
|
|
if (smaller(tree, v, s.heap[j], s.depth)) { break; }
|
|
|
|
/* Exchange v with the smallest son */
|
|
s.heap[k] = s.heap[j];
|
|
k = j;
|
|
|
|
/* And continue down the tree, setting j to the left son of k */
|
|
j <<= 1;
|
|
}
|
|
s.heap[k] = v;
|
|
}
|
|
|
|
|
|
// inlined manually
|
|
// var SMALLEST = 1;
|
|
|
|
/* ===========================================================================
|
|
* Send the block data compressed using the given Huffman trees
|
|
*/
|
|
function compress_block(s, ltree, dtree)
|
|
// deflate_state *s;
|
|
// const ct_data *ltree; /* literal tree */
|
|
// const ct_data *dtree; /* distance tree */
|
|
{
|
|
var dist; /* distance of matched string */
|
|
var lc; /* match length or unmatched char (if dist == 0) */
|
|
var lx = 0; /* running index in l_buf */
|
|
var code; /* the code to send */
|
|
var extra; /* number of extra bits to send */
|
|
|
|
if (s.last_lit !== 0) {
|
|
do {
|
|
dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);
|
|
lc = s.pending_buf[s.l_buf + lx];
|
|
lx++;
|
|
|
|
if (dist === 0) {
|
|
send_code(s, lc, ltree); /* send a literal byte */
|
|
//Tracecv(isgraph(lc), (stderr," '%c' ", lc));
|
|
} else {
|
|
/* Here, lc is the match length - MIN_MATCH */
|
|
code = _length_code[lc];
|
|
send_code(s, code + LITERALS + 1, ltree); /* send the length code */
|
|
extra = extra_lbits[code];
|
|
if (extra !== 0) {
|
|
lc -= base_length[code];
|
|
send_bits(s, lc, extra); /* send the extra length bits */
|
|
}
|
|
dist--; /* dist is now the match distance - 1 */
|
|
code = d_code(dist);
|
|
//Assert (code < D_CODES, "bad d_code");
|
|
|
|
send_code(s, code, dtree); /* send the distance code */
|
|
extra = extra_dbits[code];
|
|
if (extra !== 0) {
|
|
dist -= base_dist[code];
|
|
send_bits(s, dist, extra); /* send the extra distance bits */
|
|
}
|
|
} /* literal or match pair ? */
|
|
|
|
/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
|
|
//Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
|
|
// "pendingBuf overflow");
|
|
|
|
} while (lx < s.last_lit);
|
|
}
|
|
|
|
send_code(s, END_BLOCK, ltree);
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Construct one Huffman tree and assigns the code bit strings and lengths.
|
|
* Update the total bit length for the current block.
|
|
* IN assertion: the field freq is set for all tree elements.
|
|
* OUT assertions: the fields len and code are set to the optimal bit length
|
|
* and corresponding code. The length opt_len is updated; static_len is
|
|
* also updated if stree is not null. The field max_code is set.
|
|
*/
|
|
function build_tree(s, desc)
|
|
// deflate_state *s;
|
|
// tree_desc *desc; /* the tree descriptor */
|
|
{
|
|
var tree = desc.dyn_tree;
|
|
var stree = desc.stat_desc.static_tree;
|
|
var has_stree = desc.stat_desc.has_stree;
|
|
var elems = desc.stat_desc.elems;
|
|
var n, m; /* iterate over heap elements */
|
|
var max_code = -1; /* largest code with non zero frequency */
|
|
var node; /* new node being created */
|
|
|
|
/* Construct the initial heap, with least frequent element in
|
|
* heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
|
|
* heap[0] is not used.
|
|
*/
|
|
s.heap_len = 0;
|
|
s.heap_max = HEAP_SIZE;
|
|
|
|
for (n = 0; n < elems; n++) {
|
|
if (tree[n * 2]/*.Freq*/ !== 0) {
|
|
s.heap[++s.heap_len] = max_code = n;
|
|
s.depth[n] = 0;
|
|
|
|
} else {
|
|
tree[n * 2 + 1]/*.Len*/ = 0;
|
|
}
|
|
}
|
|
|
|
/* The pkzip format requires that at least one distance code exists,
|
|
* and that at least one bit should be sent even if there is only one
|
|
* possible code. So to avoid special checks later on we force at least
|
|
* two codes of non zero frequency.
|
|
*/
|
|
while (s.heap_len < 2) {
|
|
node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);
|
|
tree[node * 2]/*.Freq*/ = 1;
|
|
s.depth[node] = 0;
|
|
s.opt_len--;
|
|
|
|
if (has_stree) {
|
|
s.static_len -= stree[node * 2 + 1]/*.Len*/;
|
|
}
|
|
/* node is 0 or 1 so it does not have extra bits */
|
|
}
|
|
desc.max_code = max_code;
|
|
|
|
/* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
|
|
* establish sub-heaps of increasing lengths:
|
|
*/
|
|
for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }
|
|
|
|
/* Construct the Huffman tree by repeatedly combining the least two
|
|
* frequent nodes.
|
|
*/
|
|
node = elems; /* next internal node of the tree */
|
|
do {
|
|
//pqremove(s, tree, n); /* n = node of least frequency */
|
|
/*** pqremove ***/
|
|
n = s.heap[1/*SMALLEST*/];
|
|
s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];
|
|
pqdownheap(s, tree, 1/*SMALLEST*/);
|
|
/***/
|
|
|
|
m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */
|
|
|
|
s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */
|
|
s.heap[--s.heap_max] = m;
|
|
|
|
/* Create a new node father of n and m */
|
|
tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;
|
|
s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;
|
|
tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;
|
|
|
|
/* and insert the new node in the heap */
|
|
s.heap[1/*SMALLEST*/] = node++;
|
|
pqdownheap(s, tree, 1/*SMALLEST*/);
|
|
|
|
} while (s.heap_len >= 2);
|
|
|
|
s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];
|
|
|
|
/* At this point, the fields freq and dad are set. We can now
|
|
* generate the bit lengths.
|
|
*/
|
|
gen_bitlen(s, desc);
|
|
|
|
/* The field len is now set, we can generate the bit codes */
|
|
gen_codes(tree, max_code, s.bl_count);
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Scan a literal or distance tree to determine the frequencies of the codes
|
|
* in the bit length tree.
|
|
*/
|
|
function scan_tree(s, tree, max_code)
|
|
// deflate_state *s;
|
|
// ct_data *tree; /* the tree to be scanned */
|
|
// int max_code; /* and its largest code of non zero frequency */
|
|
{
|
|
var n; /* iterates over all tree elements */
|
|
var prevlen = -1; /* last emitted length */
|
|
var curlen; /* length of current code */
|
|
|
|
var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */
|
|
|
|
var count = 0; /* repeat count of the current code */
|
|
var max_count = 7; /* max repeat count */
|
|
var min_count = 4; /* min repeat count */
|
|
|
|
if (nextlen === 0) {
|
|
max_count = 138;
|
|
min_count = 3;
|
|
}
|
|
tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */
|
|
|
|
for (n = 0; n <= max_code; n++) {
|
|
curlen = nextlen;
|
|
nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;
|
|
|
|
if (++count < max_count && curlen === nextlen) {
|
|
continue;
|
|
|
|
} else if (count < min_count) {
|
|
s.bl_tree[curlen * 2]/*.Freq*/ += count;
|
|
|
|
} else if (curlen !== 0) {
|
|
|
|
if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }
|
|
s.bl_tree[REP_3_6 * 2]/*.Freq*/++;
|
|
|
|
} else if (count <= 10) {
|
|
s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;
|
|
|
|
} else {
|
|
s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;
|
|
}
|
|
|
|
count = 0;
|
|
prevlen = curlen;
|
|
|
|
if (nextlen === 0) {
|
|
max_count = 138;
|
|
min_count = 3;
|
|
|
|
} else if (curlen === nextlen) {
|
|
max_count = 6;
|
|
min_count = 3;
|
|
|
|
} else {
|
|
max_count = 7;
|
|
min_count = 4;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Send a literal or distance tree in compressed form, using the codes in
|
|
* bl_tree.
|
|
*/
|
|
function send_tree(s, tree, max_code)
|
|
// deflate_state *s;
|
|
// ct_data *tree; /* the tree to be scanned */
|
|
// int max_code; /* and its largest code of non zero frequency */
|
|
{
|
|
var n; /* iterates over all tree elements */
|
|
var prevlen = -1; /* last emitted length */
|
|
var curlen; /* length of current code */
|
|
|
|
var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */
|
|
|
|
var count = 0; /* repeat count of the current code */
|
|
var max_count = 7; /* max repeat count */
|
|
var min_count = 4; /* min repeat count */
|
|
|
|
/* tree[max_code+1].Len = -1; */ /* guard already set */
|
|
if (nextlen === 0) {
|
|
max_count = 138;
|
|
min_count = 3;
|
|
}
|
|
|
|
for (n = 0; n <= max_code; n++) {
|
|
curlen = nextlen;
|
|
nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;
|
|
|
|
if (++count < max_count && curlen === nextlen) {
|
|
continue;
|
|
|
|
} else if (count < min_count) {
|
|
do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);
|
|
|
|
} else if (curlen !== 0) {
|
|
if (curlen !== prevlen) {
|
|
send_code(s, curlen, s.bl_tree);
|
|
count--;
|
|
}
|
|
//Assert(count >= 3 && count <= 6, " 3_6?");
|
|
send_code(s, REP_3_6, s.bl_tree);
|
|
send_bits(s, count - 3, 2);
|
|
|
|
} else if (count <= 10) {
|
|
send_code(s, REPZ_3_10, s.bl_tree);
|
|
send_bits(s, count - 3, 3);
|
|
|
|
} else {
|
|
send_code(s, REPZ_11_138, s.bl_tree);
|
|
send_bits(s, count - 11, 7);
|
|
}
|
|
|
|
count = 0;
|
|
prevlen = curlen;
|
|
if (nextlen === 0) {
|
|
max_count = 138;
|
|
min_count = 3;
|
|
|
|
} else if (curlen === nextlen) {
|
|
max_count = 6;
|
|
min_count = 3;
|
|
|
|
} else {
|
|
max_count = 7;
|
|
min_count = 4;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Construct the Huffman tree for the bit lengths and return the index in
|
|
* bl_order of the last bit length code to send.
|
|
*/
|
|
function build_bl_tree(s) {
|
|
var max_blindex; /* index of last bit length code of non zero freq */
|
|
|
|
/* Determine the bit length frequencies for literal and distance trees */
|
|
scan_tree(s, s.dyn_ltree, s.l_desc.max_code);
|
|
scan_tree(s, s.dyn_dtree, s.d_desc.max_code);
|
|
|
|
/* Build the bit length tree: */
|
|
build_tree(s, s.bl_desc);
|
|
/* opt_len now includes the length of the tree representations, except
|
|
* the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
|
|
*/
|
|
|
|
/* Determine the number of bit length codes to send. The pkzip format
|
|
* requires that at least 4 bit length codes be sent. (appnote.txt says
|
|
* 3 but the actual value used is 4.)
|
|
*/
|
|
for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {
|
|
if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {
|
|
break;
|
|
}
|
|
}
|
|
/* Update opt_len to include the bit length tree and counts */
|
|
s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;
|
|
//Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
|
|
// s->opt_len, s->static_len));
|
|
|
|
return max_blindex;
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Send the header for a block using dynamic Huffman trees: the counts, the
|
|
* lengths of the bit length codes, the literal tree and the distance tree.
|
|
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
|
|
*/
|
|
function send_all_trees(s, lcodes, dcodes, blcodes)
|
|
// deflate_state *s;
|
|
// int lcodes, dcodes, blcodes; /* number of codes for each tree */
|
|
{
|
|
var rank; /* index in bl_order */
|
|
|
|
//Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
|
|
//Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
|
|
// "too many codes");
|
|
//Tracev((stderr, "\nbl counts: "));
|
|
send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */
|
|
send_bits(s, dcodes - 1, 5);
|
|
send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */
|
|
for (rank = 0; rank < blcodes; rank++) {
|
|
//Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
|
|
send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);
|
|
}
|
|
//Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
|
|
|
|
send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */
|
|
//Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
|
|
|
|
send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */
|
|
//Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
|
* - TEXT if the two conditions below are satisfied:
|
|
* a) There are no non-portable control characters belonging to the
|
|
* "black list" (0..6, 14..25, 28..31).
|
|
* b) There is at least one printable character belonging to the
|
|
* "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
|
|
* - BINARY otherwise.
|
|
* - The following partially-portable control characters form a
|
|
* "gray list" that is ignored in this detection algorithm:
|
|
* (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
|
|
* IN assertion: the fields Freq of dyn_ltree are set.
|
|
*/
|
|
function detect_data_type(s) {
|
|
/* black_mask is the bit mask of black-listed bytes
|
|
* set bits 0..6, 14..25, and 28..31
|
|
* 0xf3ffc07f = binary 11110011111111111100000001111111
|
|
*/
|
|
var black_mask = 0xf3ffc07f;
|
|
var n;
|
|
|
|
/* Check for non-textual ("black-listed") bytes. */
|
|
for (n = 0; n <= 31; n++, black_mask >>>= 1) {
|
|
if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {
|
|
return Z_BINARY;
|
|
}
|
|
}
|
|
|
|
/* Check for textual ("white-listed") bytes. */
|
|
if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||
|
|
s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {
|
|
return Z_TEXT;
|
|
}
|
|
for (n = 32; n < LITERALS; n++) {
|
|
if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {
|
|
return Z_TEXT;
|
|
}
|
|
}
|
|
|
|
/* There are no "black-listed" or "white-listed" bytes:
|
|
* this stream either is empty or has tolerated ("gray-listed") bytes only.
|
|
*/
|
|
return Z_BINARY;
|
|
}
|
|
|
|
|
|
var static_init_done = false;
|
|
|
|
/* ===========================================================================
|
|
* Initialize the tree data structures for a new zlib stream.
|
|
*/
|
|
function _tr_init(s)
|
|
{
|
|
|
|
if (!static_init_done) {
|
|
tr_static_init();
|
|
static_init_done = true;
|
|
}
|
|
|
|
s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);
|
|
s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);
|
|
s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);
|
|
|
|
s.bi_buf = 0;
|
|
s.bi_valid = 0;
|
|
|
|
/* Initialize the first block of the first file: */
|
|
init_block(s);
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Send a stored block
|
|
*/
|
|
function _tr_stored_block(s, buf, stored_len, last)
|
|
//DeflateState *s;
|
|
//charf *buf; /* input block */
|
|
//ulg stored_len; /* length of input block */
|
|
//int last; /* one if this is the last block for a file */
|
|
{
|
|
send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */
|
|
copy_block(s, buf, stored_len, true); /* with header */
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Send one empty static block to give enough lookahead for inflate.
|
|
* This takes 10 bits, of which 7 may remain in the bit buffer.
|
|
*/
|
|
function _tr_align(s) {
|
|
send_bits(s, STATIC_TREES << 1, 3);
|
|
send_code(s, END_BLOCK, static_ltree);
|
|
bi_flush(s);
|
|
}
|
|
|
|
|
|
/* ===========================================================================
|
|
* Determine the best encoding for the current block: dynamic trees, static
|
|
* trees or store, and output the encoded block to the zip file.
|
|
*/
|
|
function _tr_flush_block(s, buf, stored_len, last)
|
|
//DeflateState *s;
|
|
//charf *buf; /* input block, or NULL if too old */
|
|
//ulg stored_len; /* length of input block */
|
|
//int last; /* one if this is the last block for a file */
|
|
{
|
|
var opt_lenb, static_lenb; /* opt_len and static_len in bytes */
|
|
var max_blindex = 0; /* index of last bit length code of non zero freq */
|
|
|
|
/* Build the Huffman trees unless a stored block is forced */
|
|
if (s.level > 0) {
|
|
|
|
/* Check if the file is binary or text */
|
|
if (s.strm.data_type === Z_UNKNOWN) {
|
|
s.strm.data_type = detect_data_type(s);
|
|
}
|
|
|
|
/* Construct the literal and distance trees */
|
|
build_tree(s, s.l_desc);
|
|
// Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
|
|
// s->static_len));
|
|
|
|
build_tree(s, s.d_desc);
|
|
// Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
|
|
// s->static_len));
|
|
/* At this point, opt_len and static_len are the total bit lengths of
|
|
* the compressed block data, excluding the tree representations.
|
|
*/
|
|
|
|
/* Build the bit length tree for the above two trees, and get the index
|
|
* in bl_order of the last bit length code to send.
|
|
*/
|
|
max_blindex = build_bl_tree(s);
|
|
|
|
/* Determine the best encoding. Compute the block lengths in bytes. */
|
|
opt_lenb = (s.opt_len + 3 + 7) >>> 3;
|
|
static_lenb = (s.static_len + 3 + 7) >>> 3;
|
|
|
|
// Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
|
// opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
|
// s->last_lit));
|
|
|
|
if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }
|
|
|
|
} else {
|
|
// Assert(buf != (char*)0, "lost buf");
|
|
opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
|
|
}
|
|
|
|
if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {
|
|
/* 4: two words for the lengths */
|
|
|
|
/* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
|
|
* Otherwise we can't have processed more than WSIZE input bytes since
|
|
* the last block flush, because compression would have been
|
|
* successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
|
|
* transform a block into a stored block.
|
|
*/
|
|
_tr_stored_block(s, buf, stored_len, last);
|
|
|
|
} else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {
|
|
|
|
send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);
|
|
compress_block(s, static_ltree, static_dtree);
|
|
|
|
} else {
|
|
send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);
|
|
send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);
|
|
compress_block(s, s.dyn_ltree, s.dyn_dtree);
|
|
}
|
|
// Assert (s->compressed_len == s->bits_sent, "bad compressed size");
|
|
/* The above check is made mod 2^32, for files larger than 512 MB
|
|
* and uLong implemented on 32 bits.
|
|
*/
|
|
init_block(s);
|
|
|
|
if (last) {
|
|
bi_windup(s);
|
|
}
|
|
// Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
|
|
// s->compressed_len-7*last));
|
|
}
|
|
|
|
/* ===========================================================================
|
|
* Save the match info and tally the frequency counts. Return true if
|
|
* the current block must be flushed.
|
|
*/
|
|
function _tr_tally(s, dist, lc)
|
|
// deflate_state *s;
|
|
// unsigned dist; /* distance of matched string */
|
|
// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
|
|
{
|
|
//var out_length, in_length, dcode;
|
|
|
|
s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;
|
|
s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;
|
|
|
|
s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;
|
|
s.last_lit++;
|
|
|
|
if (dist === 0) {
|
|
/* lc is the unmatched char */
|
|
s.dyn_ltree[lc * 2]/*.Freq*/++;
|
|
} else {
|
|
s.matches++;
|
|
/* Here, lc is the match length - MIN_MATCH */
|
|
dist--; /* dist = match distance - 1 */
|
|
//Assert((ush)dist < (ush)MAX_DIST(s) &&
|
|
// (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
|
|
// (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
|
|
|
|
s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;
|
|
s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;
|
|
}
|
|
|
|
// (!) This block is disabled in zlib defailts,
|
|
// don't enable it for binary compatibility
|
|
|
|
//#ifdef TRUNCATE_BLOCK
|
|
// /* Try to guess if it is profitable to stop the current block here */
|
|
// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {
|
|
// /* Compute an upper bound for the compressed length */
|
|
// out_length = s.last_lit*8;
|
|
// in_length = s.strstart - s.block_start;
|
|
//
|
|
// for (dcode = 0; dcode < D_CODES; dcode++) {
|
|
// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);
|
|
// }
|
|
// out_length >>>= 3;
|
|
// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
|
|
// // s->last_lit, in_length, out_length,
|
|
// // 100L - out_length*100L/in_length));
|
|
// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {
|
|
// return true;
|
|
// }
|
|
// }
|
|
//#endif
|
|
|
|
return (s.last_lit === s.lit_bufsize - 1);
|
|
/* We avoid equality with lit_bufsize because of wraparound at 64K
|
|
* on 16 bit machines and because stored blocks are restricted to
|
|
* 64K-1 bytes.
|
|
*/
|
|
}
|
|
|
|
exports._tr_init = _tr_init;
|
|
exports._tr_stored_block = _tr_stored_block;
|
|
exports._tr_flush_block = _tr_flush_block;
|
|
exports._tr_tally = _tr_tally;
|
|
exports._tr_align = _tr_align;
|
|
|
|
|
|
/***/ },
|
|
/* 63 */
|
|
/***/ function(module, exports) {
|
|
|
|
'use strict';
|
|
|
|
// Note: adler32 takes 12% for level 0 and 2% for level 6.
|
|
// It doesn't worth to make additional optimizationa as in original.
|
|
// Small size is preferable.
|
|
|
|
function adler32(adler, buf, len, pos) {
|
|
var s1 = (adler & 0xffff) |0,
|
|
s2 = ((adler >>> 16) & 0xffff) |0,
|
|
n = 0;
|
|
|
|
while (len !== 0) {
|
|
// Set limit ~ twice less than 5552, to keep
|
|
// s2 in 31-bits, because we force signed ints.
|
|
// in other case %= will fail.
|
|
n = len > 2000 ? 2000 : len;
|
|
len -= n;
|
|
|
|
do {
|
|
s1 = (s1 + buf[pos++]) |0;
|
|
s2 = (s2 + s1) |0;
|
|
} while (--n);
|
|
|
|
s1 %= 65521;
|
|
s2 %= 65521;
|
|
}
|
|
|
|
return (s1 | (s2 << 16)) |0;
|
|
}
|
|
|
|
|
|
module.exports = adler32;
|
|
|
|
|
|
/***/ },
|
|
/* 64 */
|
|
/***/ function(module, exports) {
|
|
|
|
'use strict';
|
|
|
|
// Note: we can't get significant speed boost here.
|
|
// So write code to minimize size - no pregenerated tables
|
|
// and array tools dependencies.
|
|
|
|
|
|
// Use ordinary array, since untyped makes no boost here
|
|
function makeTable() {
|
|
var c, table = [];
|
|
|
|
for (var n = 0; n < 256; n++) {
|
|
c = n;
|
|
for (var k = 0; k < 8; k++) {
|
|
c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
|
|
}
|
|
table[n] = c;
|
|
}
|
|
|
|
return table;
|
|
}
|
|
|
|
// Create table on load. Just 255 signed longs. Not a problem.
|
|
var crcTable = makeTable();
|
|
|
|
|
|
function crc32(crc, buf, len, pos) {
|
|
var t = crcTable,
|
|
end = pos + len;
|
|
|
|
crc ^= -1;
|
|
|
|
for (var i = pos; i < end; i++) {
|
|
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
|
|
}
|
|
|
|
return (crc ^ (-1)); // >>> 0;
|
|
}
|
|
|
|
|
|
module.exports = crc32;
|
|
|
|
|
|
/***/ },
|
|
/* 65 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
|
|
var utils = __webpack_require__(61);
|
|
var adler32 = __webpack_require__(63);
|
|
var crc32 = __webpack_require__(64);
|
|
var inflate_fast = __webpack_require__(66);
|
|
var inflate_table = __webpack_require__(67);
|
|
|
|
var CODES = 0;
|
|
var LENS = 1;
|
|
var DISTS = 2;
|
|
|
|
/* Public constants ==========================================================*/
|
|
/* ===========================================================================*/
|
|
|
|
|
|
/* Allowed flush values; see deflate() and inflate() below for details */
|
|
//var Z_NO_FLUSH = 0;
|
|
//var Z_PARTIAL_FLUSH = 1;
|
|
//var Z_SYNC_FLUSH = 2;
|
|
//var Z_FULL_FLUSH = 3;
|
|
var Z_FINISH = 4;
|
|
var Z_BLOCK = 5;
|
|
var Z_TREES = 6;
|
|
|
|
|
|
/* Return codes for the compression/decompression functions. Negative values
|
|
* are errors, positive values are used for special but normal events.
|
|
*/
|
|
var Z_OK = 0;
|
|
var Z_STREAM_END = 1;
|
|
var Z_NEED_DICT = 2;
|
|
//var Z_ERRNO = -1;
|
|
var Z_STREAM_ERROR = -2;
|
|
var Z_DATA_ERROR = -3;
|
|
var Z_MEM_ERROR = -4;
|
|
var Z_BUF_ERROR = -5;
|
|
//var Z_VERSION_ERROR = -6;
|
|
|
|
/* The deflate compression method */
|
|
var Z_DEFLATED = 8;
|
|
|
|
|
|
/* STATES ====================================================================*/
|
|
/* ===========================================================================*/
|
|
|
|
|
|
var HEAD = 1; /* i: waiting for magic header */
|
|
var FLAGS = 2; /* i: waiting for method and flags (gzip) */
|
|
var TIME = 3; /* i: waiting for modification time (gzip) */
|
|
var OS = 4; /* i: waiting for extra flags and operating system (gzip) */
|
|
var EXLEN = 5; /* i: waiting for extra length (gzip) */
|
|
var EXTRA = 6; /* i: waiting for extra bytes (gzip) */
|
|
var NAME = 7; /* i: waiting for end of file name (gzip) */
|
|
var COMMENT = 8; /* i: waiting for end of comment (gzip) */
|
|
var HCRC = 9; /* i: waiting for header crc (gzip) */
|
|
var DICTID = 10; /* i: waiting for dictionary check value */
|
|
var DICT = 11; /* waiting for inflateSetDictionary() call */
|
|
var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
|
|
var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */
|
|
var STORED = 14; /* i: waiting for stored size (length and complement) */
|
|
var COPY_ = 15; /* i/o: same as COPY below, but only first time in */
|
|
var COPY = 16; /* i/o: waiting for input or output to copy stored block */
|
|
var TABLE = 17; /* i: waiting for dynamic block table lengths */
|
|
var LENLENS = 18; /* i: waiting for code length code lengths */
|
|
var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */
|
|
var LEN_ = 20; /* i: same as LEN below, but only first time in */
|
|
var LEN = 21; /* i: waiting for length/lit/eob code */
|
|
var LENEXT = 22; /* i: waiting for length extra bits */
|
|
var DIST = 23; /* i: waiting for distance code */
|
|
var DISTEXT = 24; /* i: waiting for distance extra bits */
|
|
var MATCH = 25; /* o: waiting for output space to copy string */
|
|
var LIT = 26; /* o: waiting for output space to write literal */
|
|
var CHECK = 27; /* i: waiting for 32-bit check value */
|
|
var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */
|
|
var DONE = 29; /* finished check, done -- remain here until reset */
|
|
var BAD = 30; /* got a data error -- remain here until reset */
|
|
var MEM = 31; /* got an inflate() memory error -- remain here until reset */
|
|
var SYNC = 32; /* looking for synchronization bytes to restart inflate() */
|
|
|
|
/* ===========================================================================*/
|
|
|
|
|
|
|
|
var ENOUGH_LENS = 852;
|
|
var ENOUGH_DISTS = 592;
|
|
//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
|
|
|
|
var MAX_WBITS = 15;
|
|
/* 32K LZ77 window */
|
|
var DEF_WBITS = MAX_WBITS;
|
|
|
|
|
|
function zswap32(q) {
|
|
return (((q >>> 24) & 0xff) +
|
|
((q >>> 8) & 0xff00) +
|
|
((q & 0xff00) << 8) +
|
|
((q & 0xff) << 24));
|
|
}
|
|
|
|
|
|
function InflateState() {
|
|
this.mode = 0; /* current inflate mode */
|
|
this.last = false; /* true if processing last block */
|
|
this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
|
|
this.havedict = false; /* true if dictionary provided */
|
|
this.flags = 0; /* gzip header method and flags (0 if zlib) */
|
|
this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */
|
|
this.check = 0; /* protected copy of check value */
|
|
this.total = 0; /* protected copy of output count */
|
|
// TODO: may be {}
|
|
this.head = null; /* where to save gzip header information */
|
|
|
|
/* sliding window */
|
|
this.wbits = 0; /* log base 2 of requested window size */
|
|
this.wsize = 0; /* window size or zero if not using window */
|
|
this.whave = 0; /* valid bytes in the window */
|
|
this.wnext = 0; /* window write index */
|
|
this.window = null; /* allocated sliding window, if needed */
|
|
|
|
/* bit accumulator */
|
|
this.hold = 0; /* input bit accumulator */
|
|
this.bits = 0; /* number of bits in "in" */
|
|
|
|
/* for string and stored block copying */
|
|
this.length = 0; /* literal or length of data to copy */
|
|
this.offset = 0; /* distance back to copy string from */
|
|
|
|
/* for table and code decoding */
|
|
this.extra = 0; /* extra bits needed */
|
|
|
|
/* fixed and dynamic code tables */
|
|
this.lencode = null; /* starting table for length/literal codes */
|
|
this.distcode = null; /* starting table for distance codes */
|
|
this.lenbits = 0; /* index bits for lencode */
|
|
this.distbits = 0; /* index bits for distcode */
|
|
|
|
/* dynamic table building */
|
|
this.ncode = 0; /* number of code length code lengths */
|
|
this.nlen = 0; /* number of length code lengths */
|
|
this.ndist = 0; /* number of distance code lengths */
|
|
this.have = 0; /* number of code lengths in lens[] */
|
|
this.next = null; /* next available space in codes[] */
|
|
|
|
this.lens = new utils.Buf16(320); /* temporary storage for code lengths */
|
|
this.work = new utils.Buf16(288); /* work area for code table building */
|
|
|
|
/*
|
|
because we don't have pointers in js, we use lencode and distcode directly
|
|
as buffers so we don't need codes
|
|
*/
|
|
//this.codes = new utils.Buf32(ENOUGH); /* space for code tables */
|
|
this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */
|
|
this.distdyn = null; /* dynamic table for distance codes (JS specific) */
|
|
this.sane = 0; /* if false, allow invalid distance too far */
|
|
this.back = 0; /* bits back of last unprocessed length/lit */
|
|
this.was = 0; /* initial length of match */
|
|
}
|
|
|
|
function inflateResetKeep(strm) {
|
|
var state;
|
|
|
|
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
|
|
state = strm.state;
|
|
strm.total_in = strm.total_out = state.total = 0;
|
|
strm.msg = ''; /*Z_NULL*/
|
|
if (state.wrap) { /* to support ill-conceived Java test suite */
|
|
strm.adler = state.wrap & 1;
|
|
}
|
|
state.mode = HEAD;
|
|
state.last = 0;
|
|
state.havedict = 0;
|
|
state.dmax = 32768;
|
|
state.head = null/*Z_NULL*/;
|
|
state.hold = 0;
|
|
state.bits = 0;
|
|
//state.lencode = state.distcode = state.next = state.codes;
|
|
state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);
|
|
state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);
|
|
|
|
state.sane = 1;
|
|
state.back = -1;
|
|
//Tracev((stderr, "inflate: reset\n"));
|
|
return Z_OK;
|
|
}
|
|
|
|
function inflateReset(strm) {
|
|
var state;
|
|
|
|
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
|
|
state = strm.state;
|
|
state.wsize = 0;
|
|
state.whave = 0;
|
|
state.wnext = 0;
|
|
return inflateResetKeep(strm);
|
|
|
|
}
|
|
|
|
function inflateReset2(strm, windowBits) {
|
|
var wrap;
|
|
var state;
|
|
|
|
/* get the state */
|
|
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
|
|
state = strm.state;
|
|
|
|
/* extract wrap request from windowBits parameter */
|
|
if (windowBits < 0) {
|
|
wrap = 0;
|
|
windowBits = -windowBits;
|
|
}
|
|
else {
|
|
wrap = (windowBits >> 4) + 1;
|
|
if (windowBits < 48) {
|
|
windowBits &= 15;
|
|
}
|
|
}
|
|
|
|
/* set number of window bits, free window if different */
|
|
if (windowBits && (windowBits < 8 || windowBits > 15)) {
|
|
return Z_STREAM_ERROR;
|
|
}
|
|
if (state.window !== null && state.wbits !== windowBits) {
|
|
state.window = null;
|
|
}
|
|
|
|
/* update state and reset the rest of it */
|
|
state.wrap = wrap;
|
|
state.wbits = windowBits;
|
|
return inflateReset(strm);
|
|
}
|
|
|
|
function inflateInit2(strm, windowBits) {
|
|
var ret;
|
|
var state;
|
|
|
|
if (!strm) { return Z_STREAM_ERROR; }
|
|
//strm.msg = Z_NULL; /* in case we return an error */
|
|
|
|
state = new InflateState();
|
|
|
|
//if (state === Z_NULL) return Z_MEM_ERROR;
|
|
//Tracev((stderr, "inflate: allocated\n"));
|
|
strm.state = state;
|
|
state.window = null/*Z_NULL*/;
|
|
ret = inflateReset2(strm, windowBits);
|
|
if (ret !== Z_OK) {
|
|
strm.state = null/*Z_NULL*/;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
function inflateInit(strm) {
|
|
return inflateInit2(strm, DEF_WBITS);
|
|
}
|
|
|
|
|
|
/*
|
|
Return state with length and distance decoding tables and index sizes set to
|
|
fixed code decoding. Normally this returns fixed tables from inffixed.h.
|
|
If BUILDFIXED is defined, then instead this routine builds the tables the
|
|
first time it's called, and returns those tables the first time and
|
|
thereafter. This reduces the size of the code by about 2K bytes, in
|
|
exchange for a little execution time. However, BUILDFIXED should not be
|
|
used for threaded applications, since the rewriting of the tables and virgin
|
|
may not be thread-safe.
|
|
*/
|
|
var virgin = true;
|
|
|
|
var lenfix, distfix; // We have no pointers in JS, so keep tables separate
|
|
|
|
function fixedtables(state) {
|
|
/* build fixed huffman tables if first call (may not be thread safe) */
|
|
if (virgin) {
|
|
var sym;
|
|
|
|
lenfix = new utils.Buf32(512);
|
|
distfix = new utils.Buf32(32);
|
|
|
|
/* literal/length table */
|
|
sym = 0;
|
|
while (sym < 144) { state.lens[sym++] = 8; }
|
|
while (sym < 256) { state.lens[sym++] = 9; }
|
|
while (sym < 280) { state.lens[sym++] = 7; }
|
|
while (sym < 288) { state.lens[sym++] = 8; }
|
|
|
|
inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });
|
|
|
|
/* distance table */
|
|
sym = 0;
|
|
while (sym < 32) { state.lens[sym++] = 5; }
|
|
|
|
inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });
|
|
|
|
/* do this just once */
|
|
virgin = false;
|
|
}
|
|
|
|
state.lencode = lenfix;
|
|
state.lenbits = 9;
|
|
state.distcode = distfix;
|
|
state.distbits = 5;
|
|
}
|
|
|
|
|
|
/*
|
|
Update the window with the last wsize (normally 32K) bytes written before
|
|
returning. If window does not exist yet, create it. This is only called
|
|
when a window is already in use, or when output has been written during this
|
|
inflate call, but the end of the deflate stream has not been reached yet.
|
|
It is also called to create a window for dictionary data when a dictionary
|
|
is loaded.
|
|
|
|
Providing output buffers larger than 32K to inflate() should provide a speed
|
|
advantage, since only the last 32K of output is copied to the sliding window
|
|
upon return from inflate(), and since all distances after the first 32K of
|
|
output will fall in the output data, making match copies simpler and faster.
|
|
The advantage may be dependent on the size of the processor's data caches.
|
|
*/
|
|
function updatewindow(strm, src, end, copy) {
|
|
var dist;
|
|
var state = strm.state;
|
|
|
|
/* if it hasn't been done already, allocate space for the window */
|
|
if (state.window === null) {
|
|
state.wsize = 1 << state.wbits;
|
|
state.wnext = 0;
|
|
state.whave = 0;
|
|
|
|
state.window = new utils.Buf8(state.wsize);
|
|
}
|
|
|
|
/* copy state->wsize or less output bytes into the circular window */
|
|
if (copy >= state.wsize) {
|
|
utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);
|
|
state.wnext = 0;
|
|
state.whave = state.wsize;
|
|
}
|
|
else {
|
|
dist = state.wsize - state.wnext;
|
|
if (dist > copy) {
|
|
dist = copy;
|
|
}
|
|
//zmemcpy(state->window + state->wnext, end - copy, dist);
|
|
utils.arraySet(state.window, src, end - copy, dist, state.wnext);
|
|
copy -= dist;
|
|
if (copy) {
|
|
//zmemcpy(state->window, end - copy, copy);
|
|
utils.arraySet(state.window, src, end - copy, copy, 0);
|
|
state.wnext = copy;
|
|
state.whave = state.wsize;
|
|
}
|
|
else {
|
|
state.wnext += dist;
|
|
if (state.wnext === state.wsize) { state.wnext = 0; }
|
|
if (state.whave < state.wsize) { state.whave += dist; }
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
function inflate(strm, flush) {
|
|
var state;
|
|
var input, output; // input/output buffers
|
|
var next; /* next input INDEX */
|
|
var put; /* next output INDEX */
|
|
var have, left; /* available input and output */
|
|
var hold; /* bit buffer */
|
|
var bits; /* bits in bit buffer */
|
|
var _in, _out; /* save starting available input and output */
|
|
var copy; /* number of stored or match bytes to copy */
|
|
var from; /* where to copy match bytes from */
|
|
var from_source;
|
|
var here = 0; /* current decoding table entry */
|
|
var here_bits, here_op, here_val; // paked "here" denormalized (JS specific)
|
|
//var last; /* parent table entry */
|
|
var last_bits, last_op, last_val; // paked "last" denormalized (JS specific)
|
|
var len; /* length to copy for repeats, bits to drop */
|
|
var ret; /* return code */
|
|
var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */
|
|
var opts;
|
|
|
|
var n; // temporary var for NEED_BITS
|
|
|
|
var order = /* permutation of code lengths */
|
|
[ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];
|
|
|
|
|
|
if (!strm || !strm.state || !strm.output ||
|
|
(!strm.input && strm.avail_in !== 0)) {
|
|
return Z_STREAM_ERROR;
|
|
}
|
|
|
|
state = strm.state;
|
|
if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */
|
|
|
|
|
|
//--- LOAD() ---
|
|
put = strm.next_out;
|
|
output = strm.output;
|
|
left = strm.avail_out;
|
|
next = strm.next_in;
|
|
input = strm.input;
|
|
have = strm.avail_in;
|
|
hold = state.hold;
|
|
bits = state.bits;
|
|
//---
|
|
|
|
_in = have;
|
|
_out = left;
|
|
ret = Z_OK;
|
|
|
|
inf_leave: // goto emulation
|
|
for (;;) {
|
|
switch (state.mode) {
|
|
case HEAD:
|
|
if (state.wrap === 0) {
|
|
state.mode = TYPEDO;
|
|
break;
|
|
}
|
|
//=== NEEDBITS(16);
|
|
while (bits < 16) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */
|
|
state.check = 0/*crc32(0L, Z_NULL, 0)*/;
|
|
//=== CRC2(state.check, hold);
|
|
hbuf[0] = hold & 0xff;
|
|
hbuf[1] = (hold >>> 8) & 0xff;
|
|
state.check = crc32(state.check, hbuf, 2, 0);
|
|
//===//
|
|
|
|
//=== INITBITS();
|
|
hold = 0;
|
|
bits = 0;
|
|
//===//
|
|
state.mode = FLAGS;
|
|
break;
|
|
}
|
|
state.flags = 0; /* expect zlib header */
|
|
if (state.head) {
|
|
state.head.done = false;
|
|
}
|
|
if (!(state.wrap & 1) || /* check if zlib header allowed */
|
|
(((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {
|
|
strm.msg = 'incorrect header check';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {
|
|
strm.msg = 'unknown compression method';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
//--- DROPBITS(4) ---//
|
|
hold >>>= 4;
|
|
bits -= 4;
|
|
//---//
|
|
len = (hold & 0x0f)/*BITS(4)*/ + 8;
|
|
if (state.wbits === 0) {
|
|
state.wbits = len;
|
|
}
|
|
else if (len > state.wbits) {
|
|
strm.msg = 'invalid window size';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
state.dmax = 1 << len;
|
|
//Tracev((stderr, "inflate: zlib header ok\n"));
|
|
strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
|
|
state.mode = hold & 0x200 ? DICTID : TYPE;
|
|
//=== INITBITS();
|
|
hold = 0;
|
|
bits = 0;
|
|
//===//
|
|
break;
|
|
case FLAGS:
|
|
//=== NEEDBITS(16); */
|
|
while (bits < 16) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
state.flags = hold;
|
|
if ((state.flags & 0xff) !== Z_DEFLATED) {
|
|
strm.msg = 'unknown compression method';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
if (state.flags & 0xe000) {
|
|
strm.msg = 'unknown header flags set';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
if (state.head) {
|
|
state.head.text = ((hold >> 8) & 1);
|
|
}
|
|
if (state.flags & 0x0200) {
|
|
//=== CRC2(state.check, hold);
|
|
hbuf[0] = hold & 0xff;
|
|
hbuf[1] = (hold >>> 8) & 0xff;
|
|
state.check = crc32(state.check, hbuf, 2, 0);
|
|
//===//
|
|
}
|
|
//=== INITBITS();
|
|
hold = 0;
|
|
bits = 0;
|
|
//===//
|
|
state.mode = TIME;
|
|
/* falls through */
|
|
case TIME:
|
|
//=== NEEDBITS(32); */
|
|
while (bits < 32) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
if (state.head) {
|
|
state.head.time = hold;
|
|
}
|
|
if (state.flags & 0x0200) {
|
|
//=== CRC4(state.check, hold)
|
|
hbuf[0] = hold & 0xff;
|
|
hbuf[1] = (hold >>> 8) & 0xff;
|
|
hbuf[2] = (hold >>> 16) & 0xff;
|
|
hbuf[3] = (hold >>> 24) & 0xff;
|
|
state.check = crc32(state.check, hbuf, 4, 0);
|
|
//===
|
|
}
|
|
//=== INITBITS();
|
|
hold = 0;
|
|
bits = 0;
|
|
//===//
|
|
state.mode = OS;
|
|
/* falls through */
|
|
case OS:
|
|
//=== NEEDBITS(16); */
|
|
while (bits < 16) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
if (state.head) {
|
|
state.head.xflags = (hold & 0xff);
|
|
state.head.os = (hold >> 8);
|
|
}
|
|
if (state.flags & 0x0200) {
|
|
//=== CRC2(state.check, hold);
|
|
hbuf[0] = hold & 0xff;
|
|
hbuf[1] = (hold >>> 8) & 0xff;
|
|
state.check = crc32(state.check, hbuf, 2, 0);
|
|
//===//
|
|
}
|
|
//=== INITBITS();
|
|
hold = 0;
|
|
bits = 0;
|
|
//===//
|
|
state.mode = EXLEN;
|
|
/* falls through */
|
|
case EXLEN:
|
|
if (state.flags & 0x0400) {
|
|
//=== NEEDBITS(16); */
|
|
while (bits < 16) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
state.length = hold;
|
|
if (state.head) {
|
|
state.head.extra_len = hold;
|
|
}
|
|
if (state.flags & 0x0200) {
|
|
//=== CRC2(state.check, hold);
|
|
hbuf[0] = hold & 0xff;
|
|
hbuf[1] = (hold >>> 8) & 0xff;
|
|
state.check = crc32(state.check, hbuf, 2, 0);
|
|
//===//
|
|
}
|
|
//=== INITBITS();
|
|
hold = 0;
|
|
bits = 0;
|
|
//===//
|
|
}
|
|
else if (state.head) {
|
|
state.head.extra = null/*Z_NULL*/;
|
|
}
|
|
state.mode = EXTRA;
|
|
/* falls through */
|
|
case EXTRA:
|
|
if (state.flags & 0x0400) {
|
|
copy = state.length;
|
|
if (copy > have) { copy = have; }
|
|
if (copy) {
|
|
if (state.head) {
|
|
len = state.head.extra_len - state.length;
|
|
if (!state.head.extra) {
|
|
// Use untyped array for more conveniend processing later
|
|
state.head.extra = new Array(state.head.extra_len);
|
|
}
|
|
utils.arraySet(
|
|
state.head.extra,
|
|
input,
|
|
next,
|
|
// extra field is limited to 65536 bytes
|
|
// - no need for additional size check
|
|
copy,
|
|
/*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
|
|
len
|
|
);
|
|
//zmemcpy(state.head.extra + len, next,
|
|
// len + copy > state.head.extra_max ?
|
|
// state.head.extra_max - len : copy);
|
|
}
|
|
if (state.flags & 0x0200) {
|
|
state.check = crc32(state.check, input, copy, next);
|
|
}
|
|
have -= copy;
|
|
next += copy;
|
|
state.length -= copy;
|
|
}
|
|
if (state.length) { break inf_leave; }
|
|
}
|
|
state.length = 0;
|
|
state.mode = NAME;
|
|
/* falls through */
|
|
case NAME:
|
|
if (state.flags & 0x0800) {
|
|
if (have === 0) { break inf_leave; }
|
|
copy = 0;
|
|
do {
|
|
// TODO: 2 or 1 bytes?
|
|
len = input[next + copy++];
|
|
/* use constant limit because in js we should not preallocate memory */
|
|
if (state.head && len &&
|
|
(state.length < 65536 /*state.head.name_max*/)) {
|
|
state.head.name += String.fromCharCode(len);
|
|
}
|
|
} while (len && copy < have);
|
|
|
|
if (state.flags & 0x0200) {
|
|
state.check = crc32(state.check, input, copy, next);
|
|
}
|
|
have -= copy;
|
|
next += copy;
|
|
if (len) { break inf_leave; }
|
|
}
|
|
else if (state.head) {
|
|
state.head.name = null;
|
|
}
|
|
state.length = 0;
|
|
state.mode = COMMENT;
|
|
/* falls through */
|
|
case COMMENT:
|
|
if (state.flags & 0x1000) {
|
|
if (have === 0) { break inf_leave; }
|
|
copy = 0;
|
|
do {
|
|
len = input[next + copy++];
|
|
/* use constant limit because in js we should not preallocate memory */
|
|
if (state.head && len &&
|
|
(state.length < 65536 /*state.head.comm_max*/)) {
|
|
state.head.comment += String.fromCharCode(len);
|
|
}
|
|
} while (len && copy < have);
|
|
if (state.flags & 0x0200) {
|
|
state.check = crc32(state.check, input, copy, next);
|
|
}
|
|
have -= copy;
|
|
next += copy;
|
|
if (len) { break inf_leave; }
|
|
}
|
|
else if (state.head) {
|
|
state.head.comment = null;
|
|
}
|
|
state.mode = HCRC;
|
|
/* falls through */
|
|
case HCRC:
|
|
if (state.flags & 0x0200) {
|
|
//=== NEEDBITS(16); */
|
|
while (bits < 16) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
if (hold !== (state.check & 0xffff)) {
|
|
strm.msg = 'header crc mismatch';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
//=== INITBITS();
|
|
hold = 0;
|
|
bits = 0;
|
|
//===//
|
|
}
|
|
if (state.head) {
|
|
state.head.hcrc = ((state.flags >> 9) & 1);
|
|
state.head.done = true;
|
|
}
|
|
strm.adler = state.check = 0;
|
|
state.mode = TYPE;
|
|
break;
|
|
case DICTID:
|
|
//=== NEEDBITS(32); */
|
|
while (bits < 32) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
strm.adler = state.check = zswap32(hold);
|
|
//=== INITBITS();
|
|
hold = 0;
|
|
bits = 0;
|
|
//===//
|
|
state.mode = DICT;
|
|
/* falls through */
|
|
case DICT:
|
|
if (state.havedict === 0) {
|
|
//--- RESTORE() ---
|
|
strm.next_out = put;
|
|
strm.avail_out = left;
|
|
strm.next_in = next;
|
|
strm.avail_in = have;
|
|
state.hold = hold;
|
|
state.bits = bits;
|
|
//---
|
|
return Z_NEED_DICT;
|
|
}
|
|
strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
|
|
state.mode = TYPE;
|
|
/* falls through */
|
|
case TYPE:
|
|
if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }
|
|
/* falls through */
|
|
case TYPEDO:
|
|
if (state.last) {
|
|
//--- BYTEBITS() ---//
|
|
hold >>>= bits & 7;
|
|
bits -= bits & 7;
|
|
//---//
|
|
state.mode = CHECK;
|
|
break;
|
|
}
|
|
//=== NEEDBITS(3); */
|
|
while (bits < 3) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
state.last = (hold & 0x01)/*BITS(1)*/;
|
|
//--- DROPBITS(1) ---//
|
|
hold >>>= 1;
|
|
bits -= 1;
|
|
//---//
|
|
|
|
switch ((hold & 0x03)/*BITS(2)*/) {
|
|
case 0: /* stored block */
|
|
//Tracev((stderr, "inflate: stored block%s\n",
|
|
// state.last ? " (last)" : ""));
|
|
state.mode = STORED;
|
|
break;
|
|
case 1: /* fixed block */
|
|
fixedtables(state);
|
|
//Tracev((stderr, "inflate: fixed codes block%s\n",
|
|
// state.last ? " (last)" : ""));
|
|
state.mode = LEN_; /* decode codes */
|
|
if (flush === Z_TREES) {
|
|
//--- DROPBITS(2) ---//
|
|
hold >>>= 2;
|
|
bits -= 2;
|
|
//---//
|
|
break inf_leave;
|
|
}
|
|
break;
|
|
case 2: /* dynamic block */
|
|
//Tracev((stderr, "inflate: dynamic codes block%s\n",
|
|
// state.last ? " (last)" : ""));
|
|
state.mode = TABLE;
|
|
break;
|
|
case 3:
|
|
strm.msg = 'invalid block type';
|
|
state.mode = BAD;
|
|
}
|
|
//--- DROPBITS(2) ---//
|
|
hold >>>= 2;
|
|
bits -= 2;
|
|
//---//
|
|
break;
|
|
case STORED:
|
|
//--- BYTEBITS() ---// /* go to byte boundary */
|
|
hold >>>= bits & 7;
|
|
bits -= bits & 7;
|
|
//---//
|
|
//=== NEEDBITS(32); */
|
|
while (bits < 32) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {
|
|
strm.msg = 'invalid stored block lengths';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
state.length = hold & 0xffff;
|
|
//Tracev((stderr, "inflate: stored length %u\n",
|
|
// state.length));
|
|
//=== INITBITS();
|
|
hold = 0;
|
|
bits = 0;
|
|
//===//
|
|
state.mode = COPY_;
|
|
if (flush === Z_TREES) { break inf_leave; }
|
|
/* falls through */
|
|
case COPY_:
|
|
state.mode = COPY;
|
|
/* falls through */
|
|
case COPY:
|
|
copy = state.length;
|
|
if (copy) {
|
|
if (copy > have) { copy = have; }
|
|
if (copy > left) { copy = left; }
|
|
if (copy === 0) { break inf_leave; }
|
|
//--- zmemcpy(put, next, copy); ---
|
|
utils.arraySet(output, input, next, copy, put);
|
|
//---//
|
|
have -= copy;
|
|
next += copy;
|
|
left -= copy;
|
|
put += copy;
|
|
state.length -= copy;
|
|
break;
|
|
}
|
|
//Tracev((stderr, "inflate: stored end\n"));
|
|
state.mode = TYPE;
|
|
break;
|
|
case TABLE:
|
|
//=== NEEDBITS(14); */
|
|
while (bits < 14) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;
|
|
//--- DROPBITS(5) ---//
|
|
hold >>>= 5;
|
|
bits -= 5;
|
|
//---//
|
|
state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;
|
|
//--- DROPBITS(5) ---//
|
|
hold >>>= 5;
|
|
bits -= 5;
|
|
//---//
|
|
state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;
|
|
//--- DROPBITS(4) ---//
|
|
hold >>>= 4;
|
|
bits -= 4;
|
|
//---//
|
|
//#ifndef PKZIP_BUG_WORKAROUND
|
|
if (state.nlen > 286 || state.ndist > 30) {
|
|
strm.msg = 'too many length or distance symbols';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
//#endif
|
|
//Tracev((stderr, "inflate: table sizes ok\n"));
|
|
state.have = 0;
|
|
state.mode = LENLENS;
|
|
/* falls through */
|
|
case LENLENS:
|
|
while (state.have < state.ncode) {
|
|
//=== NEEDBITS(3);
|
|
while (bits < 3) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);
|
|
//--- DROPBITS(3) ---//
|
|
hold >>>= 3;
|
|
bits -= 3;
|
|
//---//
|
|
}
|
|
while (state.have < 19) {
|
|
state.lens[order[state.have++]] = 0;
|
|
}
|
|
// We have separate tables & no pointers. 2 commented lines below not needed.
|
|
//state.next = state.codes;
|
|
//state.lencode = state.next;
|
|
// Switch to use dynamic table
|
|
state.lencode = state.lendyn;
|
|
state.lenbits = 7;
|
|
|
|
opts = { bits: state.lenbits };
|
|
ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
|
|
state.lenbits = opts.bits;
|
|
|
|
if (ret) {
|
|
strm.msg = 'invalid code lengths set';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
//Tracev((stderr, "inflate: code lengths ok\n"));
|
|
state.have = 0;
|
|
state.mode = CODELENS;
|
|
/* falls through */
|
|
case CODELENS:
|
|
while (state.have < state.nlen + state.ndist) {
|
|
for (;;) {
|
|
here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/
|
|
here_bits = here >>> 24;
|
|
here_op = (here >>> 16) & 0xff;
|
|
here_val = here & 0xffff;
|
|
|
|
if ((here_bits) <= bits) { break; }
|
|
//--- PULLBYTE() ---//
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
//---//
|
|
}
|
|
if (here_val < 16) {
|
|
//--- DROPBITS(here.bits) ---//
|
|
hold >>>= here_bits;
|
|
bits -= here_bits;
|
|
//---//
|
|
state.lens[state.have++] = here_val;
|
|
}
|
|
else {
|
|
if (here_val === 16) {
|
|
//=== NEEDBITS(here.bits + 2);
|
|
n = here_bits + 2;
|
|
while (bits < n) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
//--- DROPBITS(here.bits) ---//
|
|
hold >>>= here_bits;
|
|
bits -= here_bits;
|
|
//---//
|
|
if (state.have === 0) {
|
|
strm.msg = 'invalid bit length repeat';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
len = state.lens[state.have - 1];
|
|
copy = 3 + (hold & 0x03);//BITS(2);
|
|
//--- DROPBITS(2) ---//
|
|
hold >>>= 2;
|
|
bits -= 2;
|
|
//---//
|
|
}
|
|
else if (here_val === 17) {
|
|
//=== NEEDBITS(here.bits + 3);
|
|
n = here_bits + 3;
|
|
while (bits < n) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
//--- DROPBITS(here.bits) ---//
|
|
hold >>>= here_bits;
|
|
bits -= here_bits;
|
|
//---//
|
|
len = 0;
|
|
copy = 3 + (hold & 0x07);//BITS(3);
|
|
//--- DROPBITS(3) ---//
|
|
hold >>>= 3;
|
|
bits -= 3;
|
|
//---//
|
|
}
|
|
else {
|
|
//=== NEEDBITS(here.bits + 7);
|
|
n = here_bits + 7;
|
|
while (bits < n) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
//--- DROPBITS(here.bits) ---//
|
|
hold >>>= here_bits;
|
|
bits -= here_bits;
|
|
//---//
|
|
len = 0;
|
|
copy = 11 + (hold & 0x7f);//BITS(7);
|
|
//--- DROPBITS(7) ---//
|
|
hold >>>= 7;
|
|
bits -= 7;
|
|
//---//
|
|
}
|
|
if (state.have + copy > state.nlen + state.ndist) {
|
|
strm.msg = 'invalid bit length repeat';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
while (copy--) {
|
|
state.lens[state.have++] = len;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* handle error breaks in while */
|
|
if (state.mode === BAD) { break; }
|
|
|
|
/* check for end-of-block code (better have one) */
|
|
if (state.lens[256] === 0) {
|
|
strm.msg = 'invalid code -- missing end-of-block';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
|
|
/* build code tables -- note: do not change the lenbits or distbits
|
|
values here (9 and 6) without reading the comments in inftrees.h
|
|
concerning the ENOUGH constants, which depend on those values */
|
|
state.lenbits = 9;
|
|
|
|
opts = { bits: state.lenbits };
|
|
ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
|
|
// We have separate tables & no pointers. 2 commented lines below not needed.
|
|
// state.next_index = opts.table_index;
|
|
state.lenbits = opts.bits;
|
|
// state.lencode = state.next;
|
|
|
|
if (ret) {
|
|
strm.msg = 'invalid literal/lengths set';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
|
|
state.distbits = 6;
|
|
//state.distcode.copy(state.codes);
|
|
// Switch to use dynamic table
|
|
state.distcode = state.distdyn;
|
|
opts = { bits: state.distbits };
|
|
ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
|
|
// We have separate tables & no pointers. 2 commented lines below not needed.
|
|
// state.next_index = opts.table_index;
|
|
state.distbits = opts.bits;
|
|
// state.distcode = state.next;
|
|
|
|
if (ret) {
|
|
strm.msg = 'invalid distances set';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
//Tracev((stderr, 'inflate: codes ok\n'));
|
|
state.mode = LEN_;
|
|
if (flush === Z_TREES) { break inf_leave; }
|
|
/* falls through */
|
|
case LEN_:
|
|
state.mode = LEN;
|
|
/* falls through */
|
|
case LEN:
|
|
if (have >= 6 && left >= 258) {
|
|
//--- RESTORE() ---
|
|
strm.next_out = put;
|
|
strm.avail_out = left;
|
|
strm.next_in = next;
|
|
strm.avail_in = have;
|
|
state.hold = hold;
|
|
state.bits = bits;
|
|
//---
|
|
inflate_fast(strm, _out);
|
|
//--- LOAD() ---
|
|
put = strm.next_out;
|
|
output = strm.output;
|
|
left = strm.avail_out;
|
|
next = strm.next_in;
|
|
input = strm.input;
|
|
have = strm.avail_in;
|
|
hold = state.hold;
|
|
bits = state.bits;
|
|
//---
|
|
|
|
if (state.mode === TYPE) {
|
|
state.back = -1;
|
|
}
|
|
break;
|
|
}
|
|
state.back = 0;
|
|
for (;;) {
|
|
here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/
|
|
here_bits = here >>> 24;
|
|
here_op = (here >>> 16) & 0xff;
|
|
here_val = here & 0xffff;
|
|
|
|
if (here_bits <= bits) { break; }
|
|
//--- PULLBYTE() ---//
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
//---//
|
|
}
|
|
if (here_op && (here_op & 0xf0) === 0) {
|
|
last_bits = here_bits;
|
|
last_op = here_op;
|
|
last_val = here_val;
|
|
for (;;) {
|
|
here = state.lencode[last_val +
|
|
((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];
|
|
here_bits = here >>> 24;
|
|
here_op = (here >>> 16) & 0xff;
|
|
here_val = here & 0xffff;
|
|
|
|
if ((last_bits + here_bits) <= bits) { break; }
|
|
//--- PULLBYTE() ---//
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
//---//
|
|
}
|
|
//--- DROPBITS(last.bits) ---//
|
|
hold >>>= last_bits;
|
|
bits -= last_bits;
|
|
//---//
|
|
state.back += last_bits;
|
|
}
|
|
//--- DROPBITS(here.bits) ---//
|
|
hold >>>= here_bits;
|
|
bits -= here_bits;
|
|
//---//
|
|
state.back += here_bits;
|
|
state.length = here_val;
|
|
if (here_op === 0) {
|
|
//Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
|
// "inflate: literal '%c'\n" :
|
|
// "inflate: literal 0x%02x\n", here.val));
|
|
state.mode = LIT;
|
|
break;
|
|
}
|
|
if (here_op & 32) {
|
|
//Tracevv((stderr, "inflate: end of block\n"));
|
|
state.back = -1;
|
|
state.mode = TYPE;
|
|
break;
|
|
}
|
|
if (here_op & 64) {
|
|
strm.msg = 'invalid literal/length code';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
state.extra = here_op & 15;
|
|
state.mode = LENEXT;
|
|
/* falls through */
|
|
case LENEXT:
|
|
if (state.extra) {
|
|
//=== NEEDBITS(state.extra);
|
|
n = state.extra;
|
|
while (bits < n) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;
|
|
//--- DROPBITS(state.extra) ---//
|
|
hold >>>= state.extra;
|
|
bits -= state.extra;
|
|
//---//
|
|
state.back += state.extra;
|
|
}
|
|
//Tracevv((stderr, "inflate: length %u\n", state.length));
|
|
state.was = state.length;
|
|
state.mode = DIST;
|
|
/* falls through */
|
|
case DIST:
|
|
for (;;) {
|
|
here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/
|
|
here_bits = here >>> 24;
|
|
here_op = (here >>> 16) & 0xff;
|
|
here_val = here & 0xffff;
|
|
|
|
if ((here_bits) <= bits) { break; }
|
|
//--- PULLBYTE() ---//
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
//---//
|
|
}
|
|
if ((here_op & 0xf0) === 0) {
|
|
last_bits = here_bits;
|
|
last_op = here_op;
|
|
last_val = here_val;
|
|
for (;;) {
|
|
here = state.distcode[last_val +
|
|
((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];
|
|
here_bits = here >>> 24;
|
|
here_op = (here >>> 16) & 0xff;
|
|
here_val = here & 0xffff;
|
|
|
|
if ((last_bits + here_bits) <= bits) { break; }
|
|
//--- PULLBYTE() ---//
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
//---//
|
|
}
|
|
//--- DROPBITS(last.bits) ---//
|
|
hold >>>= last_bits;
|
|
bits -= last_bits;
|
|
//---//
|
|
state.back += last_bits;
|
|
}
|
|
//--- DROPBITS(here.bits) ---//
|
|
hold >>>= here_bits;
|
|
bits -= here_bits;
|
|
//---//
|
|
state.back += here_bits;
|
|
if (here_op & 64) {
|
|
strm.msg = 'invalid distance code';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
state.offset = here_val;
|
|
state.extra = (here_op) & 15;
|
|
state.mode = DISTEXT;
|
|
/* falls through */
|
|
case DISTEXT:
|
|
if (state.extra) {
|
|
//=== NEEDBITS(state.extra);
|
|
n = state.extra;
|
|
while (bits < n) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;
|
|
//--- DROPBITS(state.extra) ---//
|
|
hold >>>= state.extra;
|
|
bits -= state.extra;
|
|
//---//
|
|
state.back += state.extra;
|
|
}
|
|
//#ifdef INFLATE_STRICT
|
|
if (state.offset > state.dmax) {
|
|
strm.msg = 'invalid distance too far back';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
//#endif
|
|
//Tracevv((stderr, "inflate: distance %u\n", state.offset));
|
|
state.mode = MATCH;
|
|
/* falls through */
|
|
case MATCH:
|
|
if (left === 0) { break inf_leave; }
|
|
copy = _out - left;
|
|
if (state.offset > copy) { /* copy from window */
|
|
copy = state.offset - copy;
|
|
if (copy > state.whave) {
|
|
if (state.sane) {
|
|
strm.msg = 'invalid distance too far back';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
// (!) This block is disabled in zlib defailts,
|
|
// don't enable it for binary compatibility
|
|
//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
|
// Trace((stderr, "inflate.c too far\n"));
|
|
// copy -= state.whave;
|
|
// if (copy > state.length) { copy = state.length; }
|
|
// if (copy > left) { copy = left; }
|
|
// left -= copy;
|
|
// state.length -= copy;
|
|
// do {
|
|
// output[put++] = 0;
|
|
// } while (--copy);
|
|
// if (state.length === 0) { state.mode = LEN; }
|
|
// break;
|
|
//#endif
|
|
}
|
|
if (copy > state.wnext) {
|
|
copy -= state.wnext;
|
|
from = state.wsize - copy;
|
|
}
|
|
else {
|
|
from = state.wnext - copy;
|
|
}
|
|
if (copy > state.length) { copy = state.length; }
|
|
from_source = state.window;
|
|
}
|
|
else { /* copy from output */
|
|
from_source = output;
|
|
from = put - state.offset;
|
|
copy = state.length;
|
|
}
|
|
if (copy > left) { copy = left; }
|
|
left -= copy;
|
|
state.length -= copy;
|
|
do {
|
|
output[put++] = from_source[from++];
|
|
} while (--copy);
|
|
if (state.length === 0) { state.mode = LEN; }
|
|
break;
|
|
case LIT:
|
|
if (left === 0) { break inf_leave; }
|
|
output[put++] = state.length;
|
|
left--;
|
|
state.mode = LEN;
|
|
break;
|
|
case CHECK:
|
|
if (state.wrap) {
|
|
//=== NEEDBITS(32);
|
|
while (bits < 32) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
// Use '|' insdead of '+' to make sure that result is signed
|
|
hold |= input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
_out -= left;
|
|
strm.total_out += _out;
|
|
state.total += _out;
|
|
if (_out) {
|
|
strm.adler = state.check =
|
|
/*UPDATE(state.check, put - _out, _out);*/
|
|
(state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));
|
|
|
|
}
|
|
_out = left;
|
|
// NB: crc32 stored as signed 32-bit int, zswap32 returns signed too
|
|
if ((state.flags ? hold : zswap32(hold)) !== state.check) {
|
|
strm.msg = 'incorrect data check';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
//=== INITBITS();
|
|
hold = 0;
|
|
bits = 0;
|
|
//===//
|
|
//Tracev((stderr, "inflate: check matches trailer\n"));
|
|
}
|
|
state.mode = LENGTH;
|
|
/* falls through */
|
|
case LENGTH:
|
|
if (state.wrap && state.flags) {
|
|
//=== NEEDBITS(32);
|
|
while (bits < 32) {
|
|
if (have === 0) { break inf_leave; }
|
|
have--;
|
|
hold += input[next++] << bits;
|
|
bits += 8;
|
|
}
|
|
//===//
|
|
if (hold !== (state.total & 0xffffffff)) {
|
|
strm.msg = 'incorrect length check';
|
|
state.mode = BAD;
|
|
break;
|
|
}
|
|
//=== INITBITS();
|
|
hold = 0;
|
|
bits = 0;
|
|
//===//
|
|
//Tracev((stderr, "inflate: length matches trailer\n"));
|
|
}
|
|
state.mode = DONE;
|
|
/* falls through */
|
|
case DONE:
|
|
ret = Z_STREAM_END;
|
|
break inf_leave;
|
|
case BAD:
|
|
ret = Z_DATA_ERROR;
|
|
break inf_leave;
|
|
case MEM:
|
|
return Z_MEM_ERROR;
|
|
case SYNC:
|
|
/* falls through */
|
|
default:
|
|
return Z_STREAM_ERROR;
|
|
}
|
|
}
|
|
|
|
// inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave"
|
|
|
|
/*
|
|
Return from inflate(), updating the total counts and the check value.
|
|
If there was no progress during the inflate() call, return a buffer
|
|
error. Call updatewindow() to create and/or update the window state.
|
|
Note: a memory error from inflate() is non-recoverable.
|
|
*/
|
|
|
|
//--- RESTORE() ---
|
|
strm.next_out = put;
|
|
strm.avail_out = left;
|
|
strm.next_in = next;
|
|
strm.avail_in = have;
|
|
state.hold = hold;
|
|
state.bits = bits;
|
|
//---
|
|
|
|
if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&
|
|
(state.mode < CHECK || flush !== Z_FINISH))) {
|
|
if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {
|
|
state.mode = MEM;
|
|
return Z_MEM_ERROR;
|
|
}
|
|
}
|
|
_in -= strm.avail_in;
|
|
_out -= strm.avail_out;
|
|
strm.total_in += _in;
|
|
strm.total_out += _out;
|
|
state.total += _out;
|
|
if (state.wrap && _out) {
|
|
strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
|
|
(state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));
|
|
}
|
|
strm.data_type = state.bits + (state.last ? 64 : 0) +
|
|
(state.mode === TYPE ? 128 : 0) +
|
|
(state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
|
|
if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {
|
|
ret = Z_BUF_ERROR;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
function inflateEnd(strm) {
|
|
|
|
if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {
|
|
return Z_STREAM_ERROR;
|
|
}
|
|
|
|
var state = strm.state;
|
|
if (state.window) {
|
|
state.window = null;
|
|
}
|
|
strm.state = null;
|
|
return Z_OK;
|
|
}
|
|
|
|
function inflateGetHeader(strm, head) {
|
|
var state;
|
|
|
|
/* check state */
|
|
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
|
|
state = strm.state;
|
|
if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }
|
|
|
|
/* save header structure */
|
|
state.head = head;
|
|
head.done = false;
|
|
return Z_OK;
|
|
}
|
|
|
|
function inflateSetDictionary(strm, dictionary) {
|
|
var dictLength = dictionary.length;
|
|
|
|
var state;
|
|
var dictid;
|
|
var ret;
|
|
|
|
/* check state */
|
|
if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }
|
|
state = strm.state;
|
|
|
|
if (state.wrap !== 0 && state.mode !== DICT) {
|
|
return Z_STREAM_ERROR;
|
|
}
|
|
|
|
/* check for correct dictionary identifier */
|
|
if (state.mode === DICT) {
|
|
dictid = 1; /* adler32(0, null, 0)*/
|
|
/* dictid = adler32(dictid, dictionary, dictLength); */
|
|
dictid = adler32(dictid, dictionary, dictLength, 0);
|
|
if (dictid !== state.check) {
|
|
return Z_DATA_ERROR;
|
|
}
|
|
}
|
|
/* copy dictionary to window using updatewindow(), which will amend the
|
|
existing dictionary if appropriate */
|
|
ret = updatewindow(strm, dictionary, dictLength, dictLength);
|
|
if (ret) {
|
|
state.mode = MEM;
|
|
return Z_MEM_ERROR;
|
|
}
|
|
state.havedict = 1;
|
|
// Tracev((stderr, "inflate: dictionary set\n"));
|
|
return Z_OK;
|
|
}
|
|
|
|
exports.inflateReset = inflateReset;
|
|
exports.inflateReset2 = inflateReset2;
|
|
exports.inflateResetKeep = inflateResetKeep;
|
|
exports.inflateInit = inflateInit;
|
|
exports.inflateInit2 = inflateInit2;
|
|
exports.inflate = inflate;
|
|
exports.inflateEnd = inflateEnd;
|
|
exports.inflateGetHeader = inflateGetHeader;
|
|
exports.inflateSetDictionary = inflateSetDictionary;
|
|
exports.inflateInfo = 'pako inflate (from Nodeca project)';
|
|
|
|
/* Not implemented
|
|
exports.inflateCopy = inflateCopy;
|
|
exports.inflateGetDictionary = inflateGetDictionary;
|
|
exports.inflateMark = inflateMark;
|
|
exports.inflatePrime = inflatePrime;
|
|
exports.inflateSync = inflateSync;
|
|
exports.inflateSyncPoint = inflateSyncPoint;
|
|
exports.inflateUndermine = inflateUndermine;
|
|
*/
|
|
|
|
|
|
/***/ },
|
|
/* 66 */
|
|
/***/ function(module, exports) {
|
|
|
|
'use strict';
|
|
|
|
// See state defs from inflate.js
|
|
var BAD = 30; /* got a data error -- remain here until reset */
|
|
var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
|
|
|
|
/*
|
|
Decode literal, length, and distance codes and write out the resulting
|
|
literal and match bytes until either not enough input or output is
|
|
available, an end-of-block is encountered, or a data error is encountered.
|
|
When large enough input and output buffers are supplied to inflate(), for
|
|
example, a 16K input buffer and a 64K output buffer, more than 95% of the
|
|
inflate execution time is spent in this routine.
|
|
|
|
Entry assumptions:
|
|
|
|
state.mode === LEN
|
|
strm.avail_in >= 6
|
|
strm.avail_out >= 258
|
|
start >= strm.avail_out
|
|
state.bits < 8
|
|
|
|
On return, state.mode is one of:
|
|
|
|
LEN -- ran out of enough output space or enough available input
|
|
TYPE -- reached end of block code, inflate() to interpret next block
|
|
BAD -- error in block data
|
|
|
|
Notes:
|
|
|
|
- The maximum input bits used by a length/distance pair is 15 bits for the
|
|
length code, 5 bits for the length extra, 15 bits for the distance code,
|
|
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
|
|
Therefore if strm.avail_in >= 6, then there is enough input to avoid
|
|
checking for available input while decoding.
|
|
|
|
- The maximum bytes that a single length/distance pair can output is 258
|
|
bytes, which is the maximum length that can be coded. inflate_fast()
|
|
requires strm.avail_out >= 258 for each loop to avoid checking for
|
|
output space.
|
|
*/
|
|
module.exports = function inflate_fast(strm, start) {
|
|
var state;
|
|
var _in; /* local strm.input */
|
|
var last; /* have enough input while in < last */
|
|
var _out; /* local strm.output */
|
|
var beg; /* inflate()'s initial strm.output */
|
|
var end; /* while out < end, enough space available */
|
|
//#ifdef INFLATE_STRICT
|
|
var dmax; /* maximum distance from zlib header */
|
|
//#endif
|
|
var wsize; /* window size or zero if not using window */
|
|
var whave; /* valid bytes in the window */
|
|
var wnext; /* window write index */
|
|
// Use `s_window` instead `window`, avoid conflict with instrumentation tools
|
|
var s_window; /* allocated sliding window, if wsize != 0 */
|
|
var hold; /* local strm.hold */
|
|
var bits; /* local strm.bits */
|
|
var lcode; /* local strm.lencode */
|
|
var dcode; /* local strm.distcode */
|
|
var lmask; /* mask for first level of length codes */
|
|
var dmask; /* mask for first level of distance codes */
|
|
var here; /* retrieved table entry */
|
|
var op; /* code bits, operation, extra bits, or */
|
|
/* window position, window bytes to copy */
|
|
var len; /* match length, unused bytes */
|
|
var dist; /* match distance */
|
|
var from; /* where to copy match from */
|
|
var from_source;
|
|
|
|
|
|
var input, output; // JS specific, because we have no pointers
|
|
|
|
/* copy state to local variables */
|
|
state = strm.state;
|
|
//here = state.here;
|
|
_in = strm.next_in;
|
|
input = strm.input;
|
|
last = _in + (strm.avail_in - 5);
|
|
_out = strm.next_out;
|
|
output = strm.output;
|
|
beg = _out - (start - strm.avail_out);
|
|
end = _out + (strm.avail_out - 257);
|
|
//#ifdef INFLATE_STRICT
|
|
dmax = state.dmax;
|
|
//#endif
|
|
wsize = state.wsize;
|
|
whave = state.whave;
|
|
wnext = state.wnext;
|
|
s_window = state.window;
|
|
hold = state.hold;
|
|
bits = state.bits;
|
|
lcode = state.lencode;
|
|
dcode = state.distcode;
|
|
lmask = (1 << state.lenbits) - 1;
|
|
dmask = (1 << state.distbits) - 1;
|
|
|
|
|
|
/* decode literals and length/distances until end-of-block or not enough
|
|
input data or output space */
|
|
|
|
top:
|
|
do {
|
|
if (bits < 15) {
|
|
hold += input[_in++] << bits;
|
|
bits += 8;
|
|
hold += input[_in++] << bits;
|
|
bits += 8;
|
|
}
|
|
|
|
here = lcode[hold & lmask];
|
|
|
|
dolen:
|
|
for (;;) { // Goto emulation
|
|
op = here >>> 24/*here.bits*/;
|
|
hold >>>= op;
|
|
bits -= op;
|
|
op = (here >>> 16) & 0xff/*here.op*/;
|
|
if (op === 0) { /* literal */
|
|
//Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
|
// "inflate: literal '%c'\n" :
|
|
// "inflate: literal 0x%02x\n", here.val));
|
|
output[_out++] = here & 0xffff/*here.val*/;
|
|
}
|
|
else if (op & 16) { /* length base */
|
|
len = here & 0xffff/*here.val*/;
|
|
op &= 15; /* number of extra bits */
|
|
if (op) {
|
|
if (bits < op) {
|
|
hold += input[_in++] << bits;
|
|
bits += 8;
|
|
}
|
|
len += hold & ((1 << op) - 1);
|
|
hold >>>= op;
|
|
bits -= op;
|
|
}
|
|
//Tracevv((stderr, "inflate: length %u\n", len));
|
|
if (bits < 15) {
|
|
hold += input[_in++] << bits;
|
|
bits += 8;
|
|
hold += input[_in++] << bits;
|
|
bits += 8;
|
|
}
|
|
here = dcode[hold & dmask];
|
|
|
|
dodist:
|
|
for (;;) { // goto emulation
|
|
op = here >>> 24/*here.bits*/;
|
|
hold >>>= op;
|
|
bits -= op;
|
|
op = (here >>> 16) & 0xff/*here.op*/;
|
|
|
|
if (op & 16) { /* distance base */
|
|
dist = here & 0xffff/*here.val*/;
|
|
op &= 15; /* number of extra bits */
|
|
if (bits < op) {
|
|
hold += input[_in++] << bits;
|
|
bits += 8;
|
|
if (bits < op) {
|
|
hold += input[_in++] << bits;
|
|
bits += 8;
|
|
}
|
|
}
|
|
dist += hold & ((1 << op) - 1);
|
|
//#ifdef INFLATE_STRICT
|
|
if (dist > dmax) {
|
|
strm.msg = 'invalid distance too far back';
|
|
state.mode = BAD;
|
|
break top;
|
|
}
|
|
//#endif
|
|
hold >>>= op;
|
|
bits -= op;
|
|
//Tracevv((stderr, "inflate: distance %u\n", dist));
|
|
op = _out - beg; /* max distance in output */
|
|
if (dist > op) { /* see if copy from window */
|
|
op = dist - op; /* distance back in window */
|
|
if (op > whave) {
|
|
if (state.sane) {
|
|
strm.msg = 'invalid distance too far back';
|
|
state.mode = BAD;
|
|
break top;
|
|
}
|
|
|
|
// (!) This block is disabled in zlib defailts,
|
|
// don't enable it for binary compatibility
|
|
//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
|
// if (len <= op - whave) {
|
|
// do {
|
|
// output[_out++] = 0;
|
|
// } while (--len);
|
|
// continue top;
|
|
// }
|
|
// len -= op - whave;
|
|
// do {
|
|
// output[_out++] = 0;
|
|
// } while (--op > whave);
|
|
// if (op === 0) {
|
|
// from = _out - dist;
|
|
// do {
|
|
// output[_out++] = output[from++];
|
|
// } while (--len);
|
|
// continue top;
|
|
// }
|
|
//#endif
|
|
}
|
|
from = 0; // window index
|
|
from_source = s_window;
|
|
if (wnext === 0) { /* very common case */
|
|
from += wsize - op;
|
|
if (op < len) { /* some from window */
|
|
len -= op;
|
|
do {
|
|
output[_out++] = s_window[from++];
|
|
} while (--op);
|
|
from = _out - dist; /* rest from output */
|
|
from_source = output;
|
|
}
|
|
}
|
|
else if (wnext < op) { /* wrap around window */
|
|
from += wsize + wnext - op;
|
|
op -= wnext;
|
|
if (op < len) { /* some from end of window */
|
|
len -= op;
|
|
do {
|
|
output[_out++] = s_window[from++];
|
|
} while (--op);
|
|
from = 0;
|
|
if (wnext < len) { /* some from start of window */
|
|
op = wnext;
|
|
len -= op;
|
|
do {
|
|
output[_out++] = s_window[from++];
|
|
} while (--op);
|
|
from = _out - dist; /* rest from output */
|
|
from_source = output;
|
|
}
|
|
}
|
|
}
|
|
else { /* contiguous in window */
|
|
from += wnext - op;
|
|
if (op < len) { /* some from window */
|
|
len -= op;
|
|
do {
|
|
output[_out++] = s_window[from++];
|
|
} while (--op);
|
|
from = _out - dist; /* rest from output */
|
|
from_source = output;
|
|
}
|
|
}
|
|
while (len > 2) {
|
|
output[_out++] = from_source[from++];
|
|
output[_out++] = from_source[from++];
|
|
output[_out++] = from_source[from++];
|
|
len -= 3;
|
|
}
|
|
if (len) {
|
|
output[_out++] = from_source[from++];
|
|
if (len > 1) {
|
|
output[_out++] = from_source[from++];
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
from = _out - dist; /* copy direct from output */
|
|
do { /* minimum length is three */
|
|
output[_out++] = output[from++];
|
|
output[_out++] = output[from++];
|
|
output[_out++] = output[from++];
|
|
len -= 3;
|
|
} while (len > 2);
|
|
if (len) {
|
|
output[_out++] = output[from++];
|
|
if (len > 1) {
|
|
output[_out++] = output[from++];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if ((op & 64) === 0) { /* 2nd level distance code */
|
|
here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
|
|
continue dodist;
|
|
}
|
|
else {
|
|
strm.msg = 'invalid distance code';
|
|
state.mode = BAD;
|
|
break top;
|
|
}
|
|
|
|
break; // need to emulate goto via "continue"
|
|
}
|
|
}
|
|
else if ((op & 64) === 0) { /* 2nd level length code */
|
|
here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
|
|
continue dolen;
|
|
}
|
|
else if (op & 32) { /* end-of-block */
|
|
//Tracevv((stderr, "inflate: end of block\n"));
|
|
state.mode = TYPE;
|
|
break top;
|
|
}
|
|
else {
|
|
strm.msg = 'invalid literal/length code';
|
|
state.mode = BAD;
|
|
break top;
|
|
}
|
|
|
|
break; // need to emulate goto via "continue"
|
|
}
|
|
} while (_in < last && _out < end);
|
|
|
|
/* return unused bytes (on entry, bits < 8, so in won't go too far back) */
|
|
len = bits >> 3;
|
|
_in -= len;
|
|
bits -= len << 3;
|
|
hold &= (1 << bits) - 1;
|
|
|
|
/* update state and return */
|
|
strm.next_in = _in;
|
|
strm.next_out = _out;
|
|
strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
|
|
strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
|
|
state.hold = hold;
|
|
state.bits = bits;
|
|
return;
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 67 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
|
|
var utils = __webpack_require__(61);
|
|
|
|
var MAXBITS = 15;
|
|
var ENOUGH_LENS = 852;
|
|
var ENOUGH_DISTS = 592;
|
|
//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
|
|
|
|
var CODES = 0;
|
|
var LENS = 1;
|
|
var DISTS = 2;
|
|
|
|
var lbase = [ /* Length codes 257..285 base */
|
|
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
|
|
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
|
|
];
|
|
|
|
var lext = [ /* Length codes 257..285 extra */
|
|
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
|
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78
|
|
];
|
|
|
|
var dbase = [ /* Distance codes 0..29 base */
|
|
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
|
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
|
8193, 12289, 16385, 24577, 0, 0
|
|
];
|
|
|
|
var dext = [ /* Distance codes 0..29 extra */
|
|
16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
|
|
23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
|
|
28, 28, 29, 29, 64, 64
|
|
];
|
|
|
|
module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)
|
|
{
|
|
var bits = opts.bits;
|
|
//here = opts.here; /* table entry for duplication */
|
|
|
|
var len = 0; /* a code's length in bits */
|
|
var sym = 0; /* index of code symbols */
|
|
var min = 0, max = 0; /* minimum and maximum code lengths */
|
|
var root = 0; /* number of index bits for root table */
|
|
var curr = 0; /* number of index bits for current table */
|
|
var drop = 0; /* code bits to drop for sub-table */
|
|
var left = 0; /* number of prefix codes available */
|
|
var used = 0; /* code entries in table used */
|
|
var huff = 0; /* Huffman code */
|
|
var incr; /* for incrementing code, index */
|
|
var fill; /* index for replicating entries */
|
|
var low; /* low bits for current root entry */
|
|
var mask; /* mask for low root bits */
|
|
var next; /* next available space in table */
|
|
var base = null; /* base value table to use */
|
|
var base_index = 0;
|
|
// var shoextra; /* extra bits table to use */
|
|
var end; /* use base and extra for symbol > end */
|
|
var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */
|
|
var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */
|
|
var extra = null;
|
|
var extra_index = 0;
|
|
|
|
var here_bits, here_op, here_val;
|
|
|
|
/*
|
|
Process a set of code lengths to create a canonical Huffman code. The
|
|
code lengths are lens[0..codes-1]. Each length corresponds to the
|
|
symbols 0..codes-1. The Huffman code is generated by first sorting the
|
|
symbols by length from short to long, and retaining the symbol order
|
|
for codes with equal lengths. Then the code starts with all zero bits
|
|
for the first code of the shortest length, and the codes are integer
|
|
increments for the same length, and zeros are appended as the length
|
|
increases. For the deflate format, these bits are stored backwards
|
|
from their more natural integer increment ordering, and so when the
|
|
decoding tables are built in the large loop below, the integer codes
|
|
are incremented backwards.
|
|
|
|
This routine assumes, but does not check, that all of the entries in
|
|
lens[] are in the range 0..MAXBITS. The caller must assure this.
|
|
1..MAXBITS is interpreted as that code length. zero means that that
|
|
symbol does not occur in this code.
|
|
|
|
The codes are sorted by computing a count of codes for each length,
|
|
creating from that a table of starting indices for each length in the
|
|
sorted table, and then entering the symbols in order in the sorted
|
|
table. The sorted table is work[], with that space being provided by
|
|
the caller.
|
|
|
|
The length counts are used for other purposes as well, i.e. finding
|
|
the minimum and maximum length codes, determining if there are any
|
|
codes at all, checking for a valid set of lengths, and looking ahead
|
|
at length counts to determine sub-table sizes when building the
|
|
decoding tables.
|
|
*/
|
|
|
|
/* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
|
|
for (len = 0; len <= MAXBITS; len++) {
|
|
count[len] = 0;
|
|
}
|
|
for (sym = 0; sym < codes; sym++) {
|
|
count[lens[lens_index + sym]]++;
|
|
}
|
|
|
|
/* bound code lengths, force root to be within code lengths */
|
|
root = bits;
|
|
for (max = MAXBITS; max >= 1; max--) {
|
|
if (count[max] !== 0) { break; }
|
|
}
|
|
if (root > max) {
|
|
root = max;
|
|
}
|
|
if (max === 0) { /* no symbols to code at all */
|
|
//table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */
|
|
//table.bits[opts.table_index] = 1; //here.bits = (var char)1;
|
|
//table.val[opts.table_index++] = 0; //here.val = (var short)0;
|
|
table[table_index++] = (1 << 24) | (64 << 16) | 0;
|
|
|
|
|
|
//table.op[opts.table_index] = 64;
|
|
//table.bits[opts.table_index] = 1;
|
|
//table.val[opts.table_index++] = 0;
|
|
table[table_index++] = (1 << 24) | (64 << 16) | 0;
|
|
|
|
opts.bits = 1;
|
|
return 0; /* no symbols, but wait for decoding to report error */
|
|
}
|
|
for (min = 1; min < max; min++) {
|
|
if (count[min] !== 0) { break; }
|
|
}
|
|
if (root < min) {
|
|
root = min;
|
|
}
|
|
|
|
/* check for an over-subscribed or incomplete set of lengths */
|
|
left = 1;
|
|
for (len = 1; len <= MAXBITS; len++) {
|
|
left <<= 1;
|
|
left -= count[len];
|
|
if (left < 0) {
|
|
return -1;
|
|
} /* over-subscribed */
|
|
}
|
|
if (left > 0 && (type === CODES || max !== 1)) {
|
|
return -1; /* incomplete set */
|
|
}
|
|
|
|
/* generate offsets into symbol table for each length for sorting */
|
|
offs[1] = 0;
|
|
for (len = 1; len < MAXBITS; len++) {
|
|
offs[len + 1] = offs[len] + count[len];
|
|
}
|
|
|
|
/* sort symbols by length, by symbol order within each length */
|
|
for (sym = 0; sym < codes; sym++) {
|
|
if (lens[lens_index + sym] !== 0) {
|
|
work[offs[lens[lens_index + sym]]++] = sym;
|
|
}
|
|
}
|
|
|
|
/*
|
|
Create and fill in decoding tables. In this loop, the table being
|
|
filled is at next and has curr index bits. The code being used is huff
|
|
with length len. That code is converted to an index by dropping drop
|
|
bits off of the bottom. For codes where len is less than drop + curr,
|
|
those top drop + curr - len bits are incremented through all values to
|
|
fill the table with replicated entries.
|
|
|
|
root is the number of index bits for the root table. When len exceeds
|
|
root, sub-tables are created pointed to by the root entry with an index
|
|
of the low root bits of huff. This is saved in low to check for when a
|
|
new sub-table should be started. drop is zero when the root table is
|
|
being filled, and drop is root when sub-tables are being filled.
|
|
|
|
When a new sub-table is needed, it is necessary to look ahead in the
|
|
code lengths to determine what size sub-table is needed. The length
|
|
counts are used for this, and so count[] is decremented as codes are
|
|
entered in the tables.
|
|
|
|
used keeps track of how many table entries have been allocated from the
|
|
provided *table space. It is checked for LENS and DIST tables against
|
|
the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
|
|
the initial root table size constants. See the comments in inftrees.h
|
|
for more information.
|
|
|
|
sym increments through all symbols, and the loop terminates when
|
|
all codes of length max, i.e. all codes, have been processed. This
|
|
routine permits incomplete codes, so another loop after this one fills
|
|
in the rest of the decoding tables with invalid code markers.
|
|
*/
|
|
|
|
/* set up for code type */
|
|
// poor man optimization - use if-else instead of switch,
|
|
// to avoid deopts in old v8
|
|
if (type === CODES) {
|
|
base = extra = work; /* dummy value--not used */
|
|
end = 19;
|
|
|
|
} else if (type === LENS) {
|
|
base = lbase;
|
|
base_index -= 257;
|
|
extra = lext;
|
|
extra_index -= 257;
|
|
end = 256;
|
|
|
|
} else { /* DISTS */
|
|
base = dbase;
|
|
extra = dext;
|
|
end = -1;
|
|
}
|
|
|
|
/* initialize opts for loop */
|
|
huff = 0; /* starting code */
|
|
sym = 0; /* starting code symbol */
|
|
len = min; /* starting code length */
|
|
next = table_index; /* current table to fill in */
|
|
curr = root; /* current table index bits */
|
|
drop = 0; /* current bits to drop from code for index */
|
|
low = -1; /* trigger new sub-table when len > root */
|
|
used = 1 << root; /* use root table entries */
|
|
mask = used - 1; /* mask for comparing low */
|
|
|
|
/* check available table space */
|
|
if ((type === LENS && used > ENOUGH_LENS) ||
|
|
(type === DISTS && used > ENOUGH_DISTS)) {
|
|
return 1;
|
|
}
|
|
|
|
var i = 0;
|
|
/* process all codes and make table entries */
|
|
for (;;) {
|
|
i++;
|
|
/* create table entry */
|
|
here_bits = len - drop;
|
|
if (work[sym] < end) {
|
|
here_op = 0;
|
|
here_val = work[sym];
|
|
}
|
|
else if (work[sym] > end) {
|
|
here_op = extra[extra_index + work[sym]];
|
|
here_val = base[base_index + work[sym]];
|
|
}
|
|
else {
|
|
here_op = 32 + 64; /* end of block */
|
|
here_val = 0;
|
|
}
|
|
|
|
/* replicate for those indices with low len bits equal to huff */
|
|
incr = 1 << (len - drop);
|
|
fill = 1 << curr;
|
|
min = fill; /* save offset to next table */
|
|
do {
|
|
fill -= incr;
|
|
table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;
|
|
} while (fill !== 0);
|
|
|
|
/* backwards increment the len-bit code huff */
|
|
incr = 1 << (len - 1);
|
|
while (huff & incr) {
|
|
incr >>= 1;
|
|
}
|
|
if (incr !== 0) {
|
|
huff &= incr - 1;
|
|
huff += incr;
|
|
} else {
|
|
huff = 0;
|
|
}
|
|
|
|
/* go to next symbol, update count, len */
|
|
sym++;
|
|
if (--count[len] === 0) {
|
|
if (len === max) { break; }
|
|
len = lens[lens_index + work[sym]];
|
|
}
|
|
|
|
/* create new sub-table if needed */
|
|
if (len > root && (huff & mask) !== low) {
|
|
/* if first time, transition to sub-tables */
|
|
if (drop === 0) {
|
|
drop = root;
|
|
}
|
|
|
|
/* increment past last table */
|
|
next += min; /* here min is 1 << curr */
|
|
|
|
/* determine length of next table */
|
|
curr = len - drop;
|
|
left = 1 << curr;
|
|
while (curr + drop < max) {
|
|
left -= count[curr + drop];
|
|
if (left <= 0) { break; }
|
|
curr++;
|
|
left <<= 1;
|
|
}
|
|
|
|
/* check for enough space */
|
|
used += 1 << curr;
|
|
if ((type === LENS && used > ENOUGH_LENS) ||
|
|
(type === DISTS && used > ENOUGH_DISTS)) {
|
|
return 1;
|
|
}
|
|
|
|
/* point entry in root table to sub-table */
|
|
low = huff & mask;
|
|
/*table.op[low] = curr;
|
|
table.bits[low] = root;
|
|
table.val[low] = next - opts.table_index;*/
|
|
table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;
|
|
}
|
|
}
|
|
|
|
/* fill in remaining table entry if code is incomplete (guaranteed to have
|
|
at most one remaining entry, since if the code is incomplete, the
|
|
maximum code length that was allowed to get this far is one bit) */
|
|
if (huff !== 0) {
|
|
//table.op[next + huff] = 64; /* invalid code marker */
|
|
//table.bits[next + huff] = len - drop;
|
|
//table.val[next + huff] = 0;
|
|
table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;
|
|
}
|
|
|
|
/* set return parameters */
|
|
//opts.table_index += used;
|
|
opts.bits = root;
|
|
return 0;
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 68 */
|
|
/***/ function(module, exports) {
|
|
|
|
'use strict';
|
|
|
|
|
|
module.exports = {
|
|
|
|
/* Allowed flush values; see deflate() and inflate() below for details */
|
|
Z_NO_FLUSH: 0,
|
|
Z_PARTIAL_FLUSH: 1,
|
|
Z_SYNC_FLUSH: 2,
|
|
Z_FULL_FLUSH: 3,
|
|
Z_FINISH: 4,
|
|
Z_BLOCK: 5,
|
|
Z_TREES: 6,
|
|
|
|
/* Return codes for the compression/decompression functions. Negative values
|
|
* are errors, positive values are used for special but normal events.
|
|
*/
|
|
Z_OK: 0,
|
|
Z_STREAM_END: 1,
|
|
Z_NEED_DICT: 2,
|
|
Z_ERRNO: -1,
|
|
Z_STREAM_ERROR: -2,
|
|
Z_DATA_ERROR: -3,
|
|
//Z_MEM_ERROR: -4,
|
|
Z_BUF_ERROR: -5,
|
|
//Z_VERSION_ERROR: -6,
|
|
|
|
/* compression levels */
|
|
Z_NO_COMPRESSION: 0,
|
|
Z_BEST_SPEED: 1,
|
|
Z_BEST_COMPRESSION: 9,
|
|
Z_DEFAULT_COMPRESSION: -1,
|
|
|
|
|
|
Z_FILTERED: 1,
|
|
Z_HUFFMAN_ONLY: 2,
|
|
Z_RLE: 3,
|
|
Z_FIXED: 4,
|
|
Z_DEFAULT_STRATEGY: 0,
|
|
|
|
/* Possible values of the data_type field (though see inflate()) */
|
|
Z_BINARY: 0,
|
|
Z_TEXT: 1,
|
|
//Z_ASCII: 1, // = Z_TEXT (deprecated)
|
|
Z_UNKNOWN: 2,
|
|
|
|
/* The deflate compression method */
|
|
Z_DEFLATED: 8
|
|
//Z_NULL: null // Use -1 or null inline, depending on var type
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 69 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
var formatRegExp = /%[sdj%]/g;
|
|
exports.format = function(f) {
|
|
if (!isString(f)) {
|
|
var objects = [];
|
|
for (var i = 0; i < arguments.length; i++) {
|
|
objects.push(inspect(arguments[i]));
|
|
}
|
|
return objects.join(' ');
|
|
}
|
|
|
|
var i = 1;
|
|
var args = arguments;
|
|
var len = args.length;
|
|
var str = String(f).replace(formatRegExp, function(x) {
|
|
if (x === '%%') return '%';
|
|
if (i >= len) return x;
|
|
switch (x) {
|
|
case '%s': return String(args[i++]);
|
|
case '%d': return Number(args[i++]);
|
|
case '%j':
|
|
try {
|
|
return JSON.stringify(args[i++]);
|
|
} catch (_) {
|
|
return '[Circular]';
|
|
}
|
|
default:
|
|
return x;
|
|
}
|
|
});
|
|
for (var x = args[i]; i < len; x = args[++i]) {
|
|
if (isNull(x) || !isObject(x)) {
|
|
str += ' ' + x;
|
|
} else {
|
|
str += ' ' + inspect(x);
|
|
}
|
|
}
|
|
return str;
|
|
};
|
|
|
|
|
|
// Mark that a method should not be used.
|
|
// Returns a modified function which warns once by default.
|
|
// If --no-deprecation is set, then it is a no-op.
|
|
exports.deprecate = function(fn, msg) {
|
|
// Allow for deprecating things in the process of starting up.
|
|
if (isUndefined(global.process)) {
|
|
return function() {
|
|
return exports.deprecate(fn, msg).apply(this, arguments);
|
|
};
|
|
}
|
|
|
|
if (process.noDeprecation === true) {
|
|
return fn;
|
|
}
|
|
|
|
var warned = false;
|
|
function deprecated() {
|
|
if (!warned) {
|
|
if (process.throwDeprecation) {
|
|
throw new Error(msg);
|
|
} else if (process.traceDeprecation) {
|
|
console.trace(msg);
|
|
} else {
|
|
console.error(msg);
|
|
}
|
|
warned = true;
|
|
}
|
|
return fn.apply(this, arguments);
|
|
}
|
|
|
|
return deprecated;
|
|
};
|
|
|
|
|
|
var debugs = {};
|
|
var debugEnviron;
|
|
exports.debuglog = function(set) {
|
|
if (isUndefined(debugEnviron))
|
|
debugEnviron = process.env.NODE_DEBUG || '';
|
|
set = set.toUpperCase();
|
|
if (!debugs[set]) {
|
|
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
|
var pid = process.pid;
|
|
debugs[set] = function() {
|
|
var msg = exports.format.apply(exports, arguments);
|
|
console.error('%s %d: %s', set, pid, msg);
|
|
};
|
|
} else {
|
|
debugs[set] = function() {};
|
|
}
|
|
}
|
|
return debugs[set];
|
|
};
|
|
|
|
|
|
/**
|
|
* Echos the value of a value. Trys to print the value out
|
|
* in the best way possible given the different types.
|
|
*
|
|
* @param {Object} obj The object to print out.
|
|
* @param {Object} opts Optional options object that alters the output.
|
|
*/
|
|
/* legacy: obj, showHidden, depth, colors*/
|
|
function inspect(obj, opts) {
|
|
// default options
|
|
var ctx = {
|
|
seen: [],
|
|
stylize: stylizeNoColor
|
|
};
|
|
// legacy...
|
|
if (arguments.length >= 3) ctx.depth = arguments[2];
|
|
if (arguments.length >= 4) ctx.colors = arguments[3];
|
|
if (isBoolean(opts)) {
|
|
// legacy...
|
|
ctx.showHidden = opts;
|
|
} else if (opts) {
|
|
// got an "options" object
|
|
exports._extend(ctx, opts);
|
|
}
|
|
// set default options
|
|
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
|
if (isUndefined(ctx.depth)) ctx.depth = 2;
|
|
if (isUndefined(ctx.colors)) ctx.colors = false;
|
|
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
|
if (ctx.colors) ctx.stylize = stylizeWithColor;
|
|
return formatValue(ctx, obj, ctx.depth);
|
|
}
|
|
exports.inspect = inspect;
|
|
|
|
|
|
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
|
inspect.colors = {
|
|
'bold' : [1, 22],
|
|
'italic' : [3, 23],
|
|
'underline' : [4, 24],
|
|
'inverse' : [7, 27],
|
|
'white' : [37, 39],
|
|
'grey' : [90, 39],
|
|
'black' : [30, 39],
|
|
'blue' : [34, 39],
|
|
'cyan' : [36, 39],
|
|
'green' : [32, 39],
|
|
'magenta' : [35, 39],
|
|
'red' : [31, 39],
|
|
'yellow' : [33, 39]
|
|
};
|
|
|
|
// Don't use 'blue' not visible on cmd.exe
|
|
inspect.styles = {
|
|
'special': 'cyan',
|
|
'number': 'yellow',
|
|
'boolean': 'yellow',
|
|
'undefined': 'grey',
|
|
'null': 'bold',
|
|
'string': 'green',
|
|
'date': 'magenta',
|
|
// "name": intentionally not styling
|
|
'regexp': 'red'
|
|
};
|
|
|
|
|
|
function stylizeWithColor(str, styleType) {
|
|
var style = inspect.styles[styleType];
|
|
|
|
if (style) {
|
|
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
|
'\u001b[' + inspect.colors[style][1] + 'm';
|
|
} else {
|
|
return str;
|
|
}
|
|
}
|
|
|
|
|
|
function stylizeNoColor(str, styleType) {
|
|
return str;
|
|
}
|
|
|
|
|
|
function arrayToHash(array) {
|
|
var hash = {};
|
|
|
|
array.forEach(function(val, idx) {
|
|
hash[val] = true;
|
|
});
|
|
|
|
return hash;
|
|
}
|
|
|
|
|
|
function formatValue(ctx, value, recurseTimes) {
|
|
// Provide a hook for user-specified inspect functions.
|
|
// Check that value is an object with an inspect function on it
|
|
if (ctx.customInspect &&
|
|
value &&
|
|
isFunction(value.inspect) &&
|
|
// Filter out the util module, it's inspect function is special
|
|
value.inspect !== exports.inspect &&
|
|
// Also filter out any prototype objects using the circular check.
|
|
!(value.constructor && value.constructor.prototype === value)) {
|
|
var ret = value.inspect(recurseTimes, ctx);
|
|
if (!isString(ret)) {
|
|
ret = formatValue(ctx, ret, recurseTimes);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
// Primitive types cannot have properties
|
|
var primitive = formatPrimitive(ctx, value);
|
|
if (primitive) {
|
|
return primitive;
|
|
}
|
|
|
|
// Look up the keys of the object.
|
|
var keys = Object.keys(value);
|
|
var visibleKeys = arrayToHash(keys);
|
|
|
|
if (ctx.showHidden) {
|
|
keys = Object.getOwnPropertyNames(value);
|
|
}
|
|
|
|
// IE doesn't make error fields non-enumerable
|
|
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
|
|
if (isError(value)
|
|
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
|
return formatError(value);
|
|
}
|
|
|
|
// Some type of object without properties can be shortcutted.
|
|
if (keys.length === 0) {
|
|
if (isFunction(value)) {
|
|
var name = value.name ? ': ' + value.name : '';
|
|
return ctx.stylize('[Function' + name + ']', 'special');
|
|
}
|
|
if (isRegExp(value)) {
|
|
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
|
}
|
|
if (isDate(value)) {
|
|
return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
|
}
|
|
if (isError(value)) {
|
|
return formatError(value);
|
|
}
|
|
}
|
|
|
|
var base = '', array = false, braces = ['{', '}'];
|
|
|
|
// Make Array say that they are Array
|
|
if (isArray(value)) {
|
|
array = true;
|
|
braces = ['[', ']'];
|
|
}
|
|
|
|
// Make functions say that they are functions
|
|
if (isFunction(value)) {
|
|
var n = value.name ? ': ' + value.name : '';
|
|
base = ' [Function' + n + ']';
|
|
}
|
|
|
|
// Make RegExps say that they are RegExps
|
|
if (isRegExp(value)) {
|
|
base = ' ' + RegExp.prototype.toString.call(value);
|
|
}
|
|
|
|
// Make dates with properties first say the date
|
|
if (isDate(value)) {
|
|
base = ' ' + Date.prototype.toUTCString.call(value);
|
|
}
|
|
|
|
// Make error with message first say the error
|
|
if (isError(value)) {
|
|
base = ' ' + formatError(value);
|
|
}
|
|
|
|
if (keys.length === 0 && (!array || value.length == 0)) {
|
|
return braces[0] + base + braces[1];
|
|
}
|
|
|
|
if (recurseTimes < 0) {
|
|
if (isRegExp(value)) {
|
|
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
|
} else {
|
|
return ctx.stylize('[Object]', 'special');
|
|
}
|
|
}
|
|
|
|
ctx.seen.push(value);
|
|
|
|
var output;
|
|
if (array) {
|
|
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
|
} else {
|
|
output = keys.map(function(key) {
|
|
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
|
});
|
|
}
|
|
|
|
ctx.seen.pop();
|
|
|
|
return reduceToSingleString(output, base, braces);
|
|
}
|
|
|
|
|
|
function formatPrimitive(ctx, value) {
|
|
if (isUndefined(value))
|
|
return ctx.stylize('undefined', 'undefined');
|
|
if (isString(value)) {
|
|
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
|
.replace(/'/g, "\\'")
|
|
.replace(/\\"/g, '"') + '\'';
|
|
return ctx.stylize(simple, 'string');
|
|
}
|
|
if (isNumber(value))
|
|
return ctx.stylize('' + value, 'number');
|
|
if (isBoolean(value))
|
|
return ctx.stylize('' + value, 'boolean');
|
|
// For some reason typeof null is "object", so special case here.
|
|
if (isNull(value))
|
|
return ctx.stylize('null', 'null');
|
|
}
|
|
|
|
|
|
function formatError(value) {
|
|
return '[' + Error.prototype.toString.call(value) + ']';
|
|
}
|
|
|
|
|
|
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
|
var output = [];
|
|
for (var i = 0, l = value.length; i < l; ++i) {
|
|
if (hasOwnProperty(value, String(i))) {
|
|
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
|
String(i), true));
|
|
} else {
|
|
output.push('');
|
|
}
|
|
}
|
|
keys.forEach(function(key) {
|
|
if (!key.match(/^\d+$/)) {
|
|
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
|
key, true));
|
|
}
|
|
});
|
|
return output;
|
|
}
|
|
|
|
|
|
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
|
var name, str, desc;
|
|
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
|
if (desc.get) {
|
|
if (desc.set) {
|
|
str = ctx.stylize('[Getter/Setter]', 'special');
|
|
} else {
|
|
str = ctx.stylize('[Getter]', 'special');
|
|
}
|
|
} else {
|
|
if (desc.set) {
|
|
str = ctx.stylize('[Setter]', 'special');
|
|
}
|
|
}
|
|
if (!hasOwnProperty(visibleKeys, key)) {
|
|
name = '[' + key + ']';
|
|
}
|
|
if (!str) {
|
|
if (ctx.seen.indexOf(desc.value) < 0) {
|
|
if (isNull(recurseTimes)) {
|
|
str = formatValue(ctx, desc.value, null);
|
|
} else {
|
|
str = formatValue(ctx, desc.value, recurseTimes - 1);
|
|
}
|
|
if (str.indexOf('\n') > -1) {
|
|
if (array) {
|
|
str = str.split('\n').map(function(line) {
|
|
return ' ' + line;
|
|
}).join('\n').substr(2);
|
|
} else {
|
|
str = '\n' + str.split('\n').map(function(line) {
|
|
return ' ' + line;
|
|
}).join('\n');
|
|
}
|
|
}
|
|
} else {
|
|
str = ctx.stylize('[Circular]', 'special');
|
|
}
|
|
}
|
|
if (isUndefined(name)) {
|
|
if (array && key.match(/^\d+$/)) {
|
|
return str;
|
|
}
|
|
name = JSON.stringify('' + key);
|
|
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
|
name = name.substr(1, name.length - 2);
|
|
name = ctx.stylize(name, 'name');
|
|
} else {
|
|
name = name.replace(/'/g, "\\'")
|
|
.replace(/\\"/g, '"')
|
|
.replace(/(^"|"$)/g, "'");
|
|
name = ctx.stylize(name, 'string');
|
|
}
|
|
}
|
|
|
|
return name + ': ' + str;
|
|
}
|
|
|
|
|
|
function reduceToSingleString(output, base, braces) {
|
|
var numLinesEst = 0;
|
|
var length = output.reduce(function(prev, cur) {
|
|
numLinesEst++;
|
|
if (cur.indexOf('\n') >= 0) numLinesEst++;
|
|
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
|
}, 0);
|
|
|
|
if (length > 60) {
|
|
return braces[0] +
|
|
(base === '' ? '' : base + '\n ') +
|
|
' ' +
|
|
output.join(',\n ') +
|
|
' ' +
|
|
braces[1];
|
|
}
|
|
|
|
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
|
}
|
|
|
|
|
|
// NOTE: These type checking functions intentionally don't use `instanceof`
|
|
// because it is fragile and can be easily faked with `Object.create()`.
|
|
function isArray(ar) {
|
|
return Array.isArray(ar);
|
|
}
|
|
exports.isArray = isArray;
|
|
|
|
function isBoolean(arg) {
|
|
return typeof arg === 'boolean';
|
|
}
|
|
exports.isBoolean = isBoolean;
|
|
|
|
function isNull(arg) {
|
|
return arg === null;
|
|
}
|
|
exports.isNull = isNull;
|
|
|
|
function isNullOrUndefined(arg) {
|
|
return arg == null;
|
|
}
|
|
exports.isNullOrUndefined = isNullOrUndefined;
|
|
|
|
function isNumber(arg) {
|
|
return typeof arg === 'number';
|
|
}
|
|
exports.isNumber = isNumber;
|
|
|
|
function isString(arg) {
|
|
return typeof arg === 'string';
|
|
}
|
|
exports.isString = isString;
|
|
|
|
function isSymbol(arg) {
|
|
return typeof arg === 'symbol';
|
|
}
|
|
exports.isSymbol = isSymbol;
|
|
|
|
function isUndefined(arg) {
|
|
return arg === void 0;
|
|
}
|
|
exports.isUndefined = isUndefined;
|
|
|
|
function isRegExp(re) {
|
|
return isObject(re) && objectToString(re) === '[object RegExp]';
|
|
}
|
|
exports.isRegExp = isRegExp;
|
|
|
|
function isObject(arg) {
|
|
return typeof arg === 'object' && arg !== null;
|
|
}
|
|
exports.isObject = isObject;
|
|
|
|
function isDate(d) {
|
|
return isObject(d) && objectToString(d) === '[object Date]';
|
|
}
|
|
exports.isDate = isDate;
|
|
|
|
function isError(e) {
|
|
return isObject(e) &&
|
|
(objectToString(e) === '[object Error]' || e instanceof Error);
|
|
}
|
|
exports.isError = isError;
|
|
|
|
function isFunction(arg) {
|
|
return typeof arg === 'function';
|
|
}
|
|
exports.isFunction = isFunction;
|
|
|
|
function isPrimitive(arg) {
|
|
return arg === null ||
|
|
typeof arg === 'boolean' ||
|
|
typeof arg === 'number' ||
|
|
typeof arg === 'string' ||
|
|
typeof arg === 'symbol' || // ES6 symbol
|
|
typeof arg === 'undefined';
|
|
}
|
|
exports.isPrimitive = isPrimitive;
|
|
|
|
exports.isBuffer = __webpack_require__(70);
|
|
|
|
function objectToString(o) {
|
|
return Object.prototype.toString.call(o);
|
|
}
|
|
|
|
|
|
function pad(n) {
|
|
return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
|
}
|
|
|
|
|
|
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
|
'Oct', 'Nov', 'Dec'];
|
|
|
|
// 26 Feb 16:19:34
|
|
function timestamp() {
|
|
var d = new Date();
|
|
var time = [pad(d.getHours()),
|
|
pad(d.getMinutes()),
|
|
pad(d.getSeconds())].join(':');
|
|
return [d.getDate(), months[d.getMonth()], time].join(' ');
|
|
}
|
|
|
|
|
|
// log is just a thin wrapper to console.log that prepends a timestamp
|
|
exports.log = function() {
|
|
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
|
};
|
|
|
|
|
|
/**
|
|
* Inherit the prototype methods from one constructor into another.
|
|
*
|
|
* The Function.prototype.inherits from lang.js rewritten as a standalone
|
|
* function (not on Function.prototype). NOTE: If this file is to be loaded
|
|
* during bootstrapping this function needs to be rewritten using some native
|
|
* functions as prototype setup using normal JavaScript does not work as
|
|
* expected during bootstrapping (see mirror.js in r114903).
|
|
*
|
|
* @param {function} ctor Constructor function which needs to inherit the
|
|
* prototype.
|
|
* @param {function} superCtor Constructor function to inherit prototype from.
|
|
*/
|
|
exports.inherits = __webpack_require__(71);
|
|
|
|
exports._extend = function(origin, add) {
|
|
// Don't do anything if add isn't an object
|
|
if (!add || !isObject(add)) return origin;
|
|
|
|
var keys = Object.keys(add);
|
|
var i = keys.length;
|
|
while (i--) {
|
|
origin[keys[i]] = add[keys[i]];
|
|
}
|
|
return origin;
|
|
};
|
|
|
|
function hasOwnProperty(obj, prop) {
|
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
}
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(34)))
|
|
|
|
/***/ },
|
|
/* 70 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = function isBuffer(arg) {
|
|
return arg && typeof arg === 'object'
|
|
&& typeof arg.copy === 'function'
|
|
&& typeof arg.fill === 'function'
|
|
&& typeof arg.readUInt8 === 'function';
|
|
}
|
|
|
|
/***/ },
|
|
/* 71 */
|
|
/***/ function(module, exports) {
|
|
|
|
if (typeof Object.create === 'function') {
|
|
// implementation from standard node.js 'util' module
|
|
module.exports = function inherits(ctor, superCtor) {
|
|
ctor.super_ = superCtor
|
|
ctor.prototype = Object.create(superCtor.prototype, {
|
|
constructor: {
|
|
value: ctor,
|
|
enumerable: false,
|
|
writable: true,
|
|
configurable: true
|
|
}
|
|
});
|
|
};
|
|
} else {
|
|
// old school shim for old browsers
|
|
module.exports = function inherits(ctor, superCtor) {
|
|
ctor.super_ = superCtor
|
|
var TempCtor = function () {}
|
|
TempCtor.prototype = superCtor.prototype
|
|
ctor.prototype = new TempCtor()
|
|
ctor.prototype.constructor = ctor
|
|
}
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 72 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(global) {'use strict';
|
|
|
|
// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
|
|
// original notice:
|
|
|
|
/*!
|
|
* The buffer module from node.js, for the browser.
|
|
*
|
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
* @license MIT
|
|
*/
|
|
function compare(a, b) {
|
|
if (a === b) {
|
|
return 0;
|
|
}
|
|
|
|
var x = a.length;
|
|
var y = b.length;
|
|
|
|
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
if (a[i] !== b[i]) {
|
|
x = a[i];
|
|
y = b[i];
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (x < y) {
|
|
return -1;
|
|
}
|
|
if (y < x) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
function isBuffer(b) {
|
|
if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
|
|
return global.Buffer.isBuffer(b);
|
|
}
|
|
return !!(b != null && b._isBuffer);
|
|
}
|
|
|
|
// based on node assert, original notice:
|
|
|
|
// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
|
|
//
|
|
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
|
|
//
|
|
// Originally from narwhal.js (http://narwhaljs.org)
|
|
// Copyright (c) 2009 Thomas Robinson <280north.com>
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
// of this software and associated documentation files (the 'Software'), to
|
|
// deal in the Software without restriction, including without limitation the
|
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
// sell copies of the Software, and to permit persons to whom the Software is
|
|
// furnished to do so, subject to the following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included in
|
|
// all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
var util = __webpack_require__(69);
|
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
var pSlice = Array.prototype.slice;
|
|
var functionsHaveNames = (function () {
|
|
return function foo() {}.name === 'foo';
|
|
}());
|
|
function pToString (obj) {
|
|
return Object.prototype.toString.call(obj);
|
|
}
|
|
function isView(arrbuf) {
|
|
if (isBuffer(arrbuf)) {
|
|
return false;
|
|
}
|
|
if (typeof global.ArrayBuffer !== 'function') {
|
|
return false;
|
|
}
|
|
if (typeof ArrayBuffer.isView === 'function') {
|
|
return ArrayBuffer.isView(arrbuf);
|
|
}
|
|
if (!arrbuf) {
|
|
return false;
|
|
}
|
|
if (arrbuf instanceof DataView) {
|
|
return true;
|
|
}
|
|
if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
// 1. The assert module provides functions that throw
|
|
// AssertionError's when particular conditions are not met. The
|
|
// assert module must conform to the following interface.
|
|
|
|
var assert = module.exports = ok;
|
|
|
|
// 2. The AssertionError is defined in assert.
|
|
// new assert.AssertionError({ message: message,
|
|
// actual: actual,
|
|
// expected: expected })
|
|
|
|
var regex = /\s*function\s+([^\(\s]*)\s*/;
|
|
// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
|
|
function getName(func) {
|
|
if (!util.isFunction(func)) {
|
|
return;
|
|
}
|
|
if (functionsHaveNames) {
|
|
return func.name;
|
|
}
|
|
var str = func.toString();
|
|
var match = str.match(regex);
|
|
return match && match[1];
|
|
}
|
|
assert.AssertionError = function AssertionError(options) {
|
|
this.name = 'AssertionError';
|
|
this.actual = options.actual;
|
|
this.expected = options.expected;
|
|
this.operator = options.operator;
|
|
if (options.message) {
|
|
this.message = options.message;
|
|
this.generatedMessage = false;
|
|
} else {
|
|
this.message = getMessage(this);
|
|
this.generatedMessage = true;
|
|
}
|
|
var stackStartFunction = options.stackStartFunction || fail;
|
|
if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this, stackStartFunction);
|
|
} else {
|
|
// non v8 browsers so we can have a stacktrace
|
|
var err = new Error();
|
|
if (err.stack) {
|
|
var out = err.stack;
|
|
|
|
// try to strip useless frames
|
|
var fn_name = getName(stackStartFunction);
|
|
var idx = out.indexOf('\n' + fn_name);
|
|
if (idx >= 0) {
|
|
// once we have located the function frame
|
|
// we need to strip out everything before it (and its line)
|
|
var next_line = out.indexOf('\n', idx + 1);
|
|
out = out.substring(next_line + 1);
|
|
}
|
|
|
|
this.stack = out;
|
|
}
|
|
}
|
|
};
|
|
|
|
// assert.AssertionError instanceof Error
|
|
util.inherits(assert.AssertionError, Error);
|
|
|
|
function truncate(s, n) {
|
|
if (typeof s === 'string') {
|
|
return s.length < n ? s : s.slice(0, n);
|
|
} else {
|
|
return s;
|
|
}
|
|
}
|
|
function inspect(something) {
|
|
if (functionsHaveNames || !util.isFunction(something)) {
|
|
return util.inspect(something);
|
|
}
|
|
var rawname = getName(something);
|
|
var name = rawname ? ': ' + rawname : '';
|
|
return '[Function' + name + ']';
|
|
}
|
|
function getMessage(self) {
|
|
return truncate(inspect(self.actual), 128) + ' ' +
|
|
self.operator + ' ' +
|
|
truncate(inspect(self.expected), 128);
|
|
}
|
|
|
|
// At present only the three keys mentioned above are used and
|
|
// understood by the spec. Implementations or sub modules can pass
|
|
// other keys to the AssertionError's constructor - they will be
|
|
// ignored.
|
|
|
|
// 3. All of the following functions must throw an AssertionError
|
|
// when a corresponding condition is not met, with a message that
|
|
// may be undefined if not provided. All assertion methods provide
|
|
// both the actual and expected values to the assertion error for
|
|
// display purposes.
|
|
|
|
function fail(actual, expected, message, operator, stackStartFunction) {
|
|
throw new assert.AssertionError({
|
|
message: message,
|
|
actual: actual,
|
|
expected: expected,
|
|
operator: operator,
|
|
stackStartFunction: stackStartFunction
|
|
});
|
|
}
|
|
|
|
// EXTENSION! allows for well behaved errors defined elsewhere.
|
|
assert.fail = fail;
|
|
|
|
// 4. Pure assertion tests whether a value is truthy, as determined
|
|
// by !!guard.
|
|
// assert.ok(guard, message_opt);
|
|
// This statement is equivalent to assert.equal(true, !!guard,
|
|
// message_opt);. To test strictly for the value true, use
|
|
// assert.strictEqual(true, guard, message_opt);.
|
|
|
|
function ok(value, message) {
|
|
if (!value) fail(value, true, message, '==', assert.ok);
|
|
}
|
|
assert.ok = ok;
|
|
|
|
// 5. The equality assertion tests shallow, coercive equality with
|
|
// ==.
|
|
// assert.equal(actual, expected, message_opt);
|
|
|
|
assert.equal = function equal(actual, expected, message) {
|
|
if (actual != expected) fail(actual, expected, message, '==', assert.equal);
|
|
};
|
|
|
|
// 6. The non-equality assertion tests for whether two objects are not equal
|
|
// with != assert.notEqual(actual, expected, message_opt);
|
|
|
|
assert.notEqual = function notEqual(actual, expected, message) {
|
|
if (actual == expected) {
|
|
fail(actual, expected, message, '!=', assert.notEqual);
|
|
}
|
|
};
|
|
|
|
// 7. The equivalence assertion tests a deep equality relation.
|
|
// assert.deepEqual(actual, expected, message_opt);
|
|
|
|
assert.deepEqual = function deepEqual(actual, expected, message) {
|
|
if (!_deepEqual(actual, expected, false)) {
|
|
fail(actual, expected, message, 'deepEqual', assert.deepEqual);
|
|
}
|
|
};
|
|
|
|
assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
|
|
if (!_deepEqual(actual, expected, true)) {
|
|
fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
|
|
}
|
|
};
|
|
|
|
function _deepEqual(actual, expected, strict, memos) {
|
|
// 7.1. All identical values are equivalent, as determined by ===.
|
|
if (actual === expected) {
|
|
return true;
|
|
} else if (isBuffer(actual) && isBuffer(expected)) {
|
|
return compare(actual, expected) === 0;
|
|
|
|
// 7.2. If the expected value is a Date object, the actual value is
|
|
// equivalent if it is also a Date object that refers to the same time.
|
|
} else if (util.isDate(actual) && util.isDate(expected)) {
|
|
return actual.getTime() === expected.getTime();
|
|
|
|
// 7.3 If the expected value is a RegExp object, the actual value is
|
|
// equivalent if it is also a RegExp object with the same source and
|
|
// properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
|
|
} else if (util.isRegExp(actual) && util.isRegExp(expected)) {
|
|
return actual.source === expected.source &&
|
|
actual.global === expected.global &&
|
|
actual.multiline === expected.multiline &&
|
|
actual.lastIndex === expected.lastIndex &&
|
|
actual.ignoreCase === expected.ignoreCase;
|
|
|
|
// 7.4. Other pairs that do not both pass typeof value == 'object',
|
|
// equivalence is determined by ==.
|
|
} else if ((actual === null || typeof actual !== 'object') &&
|
|
(expected === null || typeof expected !== 'object')) {
|
|
return strict ? actual === expected : actual == expected;
|
|
|
|
// If both values are instances of typed arrays, wrap their underlying
|
|
// ArrayBuffers in a Buffer each to increase performance
|
|
// This optimization requires the arrays to have the same type as checked by
|
|
// Object.prototype.toString (aka pToString). Never perform binary
|
|
// comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
|
|
// bit patterns are not identical.
|
|
} else if (isView(actual) && isView(expected) &&
|
|
pToString(actual) === pToString(expected) &&
|
|
!(actual instanceof Float32Array ||
|
|
actual instanceof Float64Array)) {
|
|
return compare(new Uint8Array(actual.buffer),
|
|
new Uint8Array(expected.buffer)) === 0;
|
|
|
|
// 7.5 For all other Object pairs, including Array objects, equivalence is
|
|
// determined by having the same number of owned properties (as verified
|
|
// with Object.prototype.hasOwnProperty.call), the same set of keys
|
|
// (although not necessarily the same order), equivalent values for every
|
|
// corresponding key, and an identical 'prototype' property. Note: this
|
|
// accounts for both named and indexed properties on Arrays.
|
|
} else if (isBuffer(actual) !== isBuffer(expected)) {
|
|
return false;
|
|
} else {
|
|
memos = memos || {actual: [], expected: []};
|
|
|
|
var actualIndex = memos.actual.indexOf(actual);
|
|
if (actualIndex !== -1) {
|
|
if (actualIndex === memos.expected.indexOf(expected)) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
memos.actual.push(actual);
|
|
memos.expected.push(expected);
|
|
|
|
return objEquiv(actual, expected, strict, memos);
|
|
}
|
|
}
|
|
|
|
function isArguments(object) {
|
|
return Object.prototype.toString.call(object) == '[object Arguments]';
|
|
}
|
|
|
|
function objEquiv(a, b, strict, actualVisitedObjects) {
|
|
if (a === null || a === undefined || b === null || b === undefined)
|
|
return false;
|
|
// if one is a primitive, the other must be same
|
|
if (util.isPrimitive(a) || util.isPrimitive(b))
|
|
return a === b;
|
|
if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
|
|
return false;
|
|
var aIsArgs = isArguments(a);
|
|
var bIsArgs = isArguments(b);
|
|
if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
|
|
return false;
|
|
if (aIsArgs) {
|
|
a = pSlice.call(a);
|
|
b = pSlice.call(b);
|
|
return _deepEqual(a, b, strict);
|
|
}
|
|
var ka = objectKeys(a);
|
|
var kb = objectKeys(b);
|
|
var key, i;
|
|
// having the same number of owned properties (keys incorporates
|
|
// hasOwnProperty)
|
|
if (ka.length !== kb.length)
|
|
return false;
|
|
//the same set of keys (although not necessarily the same order),
|
|
ka.sort();
|
|
kb.sort();
|
|
//~~~cheap key test
|
|
for (i = ka.length - 1; i >= 0; i--) {
|
|
if (ka[i] !== kb[i])
|
|
return false;
|
|
}
|
|
//equivalent values for every corresponding key, and
|
|
//~~~possibly expensive deep test
|
|
for (i = ka.length - 1; i >= 0; i--) {
|
|
key = ka[i];
|
|
if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// 8. The non-equivalence assertion tests for any deep inequality.
|
|
// assert.notDeepEqual(actual, expected, message_opt);
|
|
|
|
assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
|
|
if (_deepEqual(actual, expected, false)) {
|
|
fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
|
|
}
|
|
};
|
|
|
|
assert.notDeepStrictEqual = notDeepStrictEqual;
|
|
function notDeepStrictEqual(actual, expected, message) {
|
|
if (_deepEqual(actual, expected, true)) {
|
|
fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
|
|
}
|
|
}
|
|
|
|
|
|
// 9. The strict equality assertion tests strict equality, as determined by ===.
|
|
// assert.strictEqual(actual, expected, message_opt);
|
|
|
|
assert.strictEqual = function strictEqual(actual, expected, message) {
|
|
if (actual !== expected) {
|
|
fail(actual, expected, message, '===', assert.strictEqual);
|
|
}
|
|
};
|
|
|
|
// 10. The strict non-equality assertion tests for strict inequality, as
|
|
// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
|
|
|
|
assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
|
|
if (actual === expected) {
|
|
fail(actual, expected, message, '!==', assert.notStrictEqual);
|
|
}
|
|
};
|
|
|
|
function expectedException(actual, expected) {
|
|
if (!actual || !expected) {
|
|
return false;
|
|
}
|
|
|
|
if (Object.prototype.toString.call(expected) == '[object RegExp]') {
|
|
return expected.test(actual);
|
|
}
|
|
|
|
try {
|
|
if (actual instanceof expected) {
|
|
return true;
|
|
}
|
|
} catch (e) {
|
|
// Ignore. The instanceof check doesn't work for arrow functions.
|
|
}
|
|
|
|
if (Error.isPrototypeOf(expected)) {
|
|
return false;
|
|
}
|
|
|
|
return expected.call({}, actual) === true;
|
|
}
|
|
|
|
function _tryBlock(block) {
|
|
var error;
|
|
try {
|
|
block();
|
|
} catch (e) {
|
|
error = e;
|
|
}
|
|
return error;
|
|
}
|
|
|
|
function _throws(shouldThrow, block, expected, message) {
|
|
var actual;
|
|
|
|
if (typeof block !== 'function') {
|
|
throw new TypeError('"block" argument must be a function');
|
|
}
|
|
|
|
if (typeof expected === 'string') {
|
|
message = expected;
|
|
expected = null;
|
|
}
|
|
|
|
actual = _tryBlock(block);
|
|
|
|
message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
|
|
(message ? ' ' + message : '.');
|
|
|
|
if (shouldThrow && !actual) {
|
|
fail(actual, expected, 'Missing expected exception' + message);
|
|
}
|
|
|
|
var userProvidedMessage = typeof message === 'string';
|
|
var isUnwantedException = !shouldThrow && util.isError(actual);
|
|
var isUnexpectedException = !shouldThrow && actual && !expected;
|
|
|
|
if ((isUnwantedException &&
|
|
userProvidedMessage &&
|
|
expectedException(actual, expected)) ||
|
|
isUnexpectedException) {
|
|
fail(actual, expected, 'Got unwanted exception' + message);
|
|
}
|
|
|
|
if ((shouldThrow && actual && expected &&
|
|
!expectedException(actual, expected)) || (!shouldThrow && actual)) {
|
|
throw actual;
|
|
}
|
|
}
|
|
|
|
// 11. Expected to throw an error:
|
|
// assert.throws(block, Error_opt, message_opt);
|
|
|
|
assert.throws = function(block, /*optional*/error, /*optional*/message) {
|
|
_throws(true, block, error, message);
|
|
};
|
|
|
|
// EXTENSION! This is annoying to write outside this module.
|
|
assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
|
|
_throws(false, block, error, message);
|
|
};
|
|
|
|
assert.ifError = function(err) { if (err) throw err; };
|
|
|
|
var objectKeys = Object.keys || function (obj) {
|
|
var keys = [];
|
|
for (var key in obj) {
|
|
if (hasOwn.call(obj, key)) keys.push(key);
|
|
}
|
|
return keys;
|
|
};
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
|
|
|
/***/ },
|
|
/* 73 */
|
|
/***/ function(module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
|
|
/*
|
|
PDFPage - represents a single page in the PDF document
|
|
By Devon Govett
|
|
*/
|
|
|
|
(function() {
|
|
var PDFPage;
|
|
|
|
PDFPage = (function() {
|
|
var DEFAULT_MARGINS, SIZES;
|
|
|
|
function PDFPage(document, options) {
|
|
var dimensions;
|
|
this.document = document;
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
this.size = options.size || 'letter';
|
|
this.layout = options.layout || 'portrait';
|
|
if (typeof options.margin === 'number') {
|
|
this.margins = {
|
|
top: options.margin,
|
|
left: options.margin,
|
|
bottom: options.margin,
|
|
right: options.margin
|
|
};
|
|
} else {
|
|
this.margins = options.margins || DEFAULT_MARGINS;
|
|
}
|
|
dimensions = Array.isArray(this.size) ? this.size : SIZES[this.size.toUpperCase()];
|
|
this.width = dimensions[this.layout === 'portrait' ? 0 : 1];
|
|
this.height = dimensions[this.layout === 'portrait' ? 1 : 0];
|
|
this.content = this.document.ref();
|
|
this.resources = this.document.ref({
|
|
ProcSet: ['PDF', 'Text', 'ImageB', 'ImageC', 'ImageI']
|
|
});
|
|
Object.defineProperties(this, {
|
|
fonts: {
|
|
get: (function(_this) {
|
|
return function() {
|
|
var base;
|
|
return (base = _this.resources.data).Font != null ? base.Font : base.Font = {};
|
|
};
|
|
})(this)
|
|
},
|
|
xobjects: {
|
|
get: (function(_this) {
|
|
return function() {
|
|
var base;
|
|
return (base = _this.resources.data).XObject != null ? base.XObject : base.XObject = {};
|
|
};
|
|
})(this)
|
|
},
|
|
ext_gstates: {
|
|
get: (function(_this) {
|
|
return function() {
|
|
var base;
|
|
return (base = _this.resources.data).ExtGState != null ? base.ExtGState : base.ExtGState = {};
|
|
};
|
|
})(this)
|
|
},
|
|
patterns: {
|
|
get: (function(_this) {
|
|
return function() {
|
|
var base;
|
|
return (base = _this.resources.data).Pattern != null ? base.Pattern : base.Pattern = {};
|
|
};
|
|
})(this)
|
|
},
|
|
annotations: {
|
|
get: (function(_this) {
|
|
return function() {
|
|
var base;
|
|
return (base = _this.dictionary.data).Annots != null ? base.Annots : base.Annots = [];
|
|
};
|
|
})(this)
|
|
}
|
|
});
|
|
this.dictionary = this.document.ref({
|
|
Type: 'Page',
|
|
Parent: this.document._root.data.Pages,
|
|
MediaBox: [0, 0, this.width, this.height],
|
|
Contents: this.content,
|
|
Resources: this.resources
|
|
});
|
|
}
|
|
|
|
PDFPage.prototype.maxY = function() {
|
|
return this.height - this.margins.bottom;
|
|
};
|
|
|
|
PDFPage.prototype.write = function(chunk) {
|
|
return this.content.write(chunk);
|
|
};
|
|
|
|
PDFPage.prototype.end = function() {
|
|
this.dictionary.end();
|
|
this.resources.end();
|
|
return this.content.end();
|
|
};
|
|
|
|
DEFAULT_MARGINS = {
|
|
top: 72,
|
|
left: 72,
|
|
bottom: 72,
|
|
right: 72
|
|
};
|
|
|
|
SIZES = {
|
|
'4A0': [4767.87, 6740.79],
|
|
'2A0': [3370.39, 4767.87],
|
|
A0: [2383.94, 3370.39],
|
|
A1: [1683.78, 2383.94],
|
|
A2: [1190.55, 1683.78],
|
|
A3: [841.89, 1190.55],
|
|
A4: [595.28, 841.89],
|
|
A5: [419.53, 595.28],
|
|
A6: [297.64, 419.53],
|
|
A7: [209.76, 297.64],
|
|
A8: [147.40, 209.76],
|
|
A9: [104.88, 147.40],
|
|
A10: [73.70, 104.88],
|
|
B0: [2834.65, 4008.19],
|
|
B1: [2004.09, 2834.65],
|
|
B2: [1417.32, 2004.09],
|
|
B3: [1000.63, 1417.32],
|
|
B4: [708.66, 1000.63],
|
|
B5: [498.90, 708.66],
|
|
B6: [354.33, 498.90],
|
|
B7: [249.45, 354.33],
|
|
B8: [175.75, 249.45],
|
|
B9: [124.72, 175.75],
|
|
B10: [87.87, 124.72],
|
|
C0: [2599.37, 3676.54],
|
|
C1: [1836.85, 2599.37],
|
|
C2: [1298.27, 1836.85],
|
|
C3: [918.43, 1298.27],
|
|
C4: [649.13, 918.43],
|
|
C5: [459.21, 649.13],
|
|
C6: [323.15, 459.21],
|
|
C7: [229.61, 323.15],
|
|
C8: [161.57, 229.61],
|
|
C9: [113.39, 161.57],
|
|
C10: [79.37, 113.39],
|
|
RA0: [2437.80, 3458.27],
|
|
RA1: [1729.13, 2437.80],
|
|
RA2: [1218.90, 1729.13],
|
|
RA3: [864.57, 1218.90],
|
|
RA4: [609.45, 864.57],
|
|
SRA0: [2551.18, 3628.35],
|
|
SRA1: [1814.17, 2551.18],
|
|
SRA2: [1275.59, 1814.17],
|
|
SRA3: [907.09, 1275.59],
|
|
SRA4: [637.80, 907.09],
|
|
EXECUTIVE: [521.86, 756.00],
|
|
FOLIO: [612.00, 936.00],
|
|
LEGAL: [612.00, 1008.00],
|
|
LETTER: [612.00, 792.00],
|
|
TABLOID: [792.00, 1224.00]
|
|
};
|
|
|
|
return PDFPage;
|
|
|
|
})();
|
|
|
|
module.exports = PDFPage;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 74 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var PDFGradient, PDFLinearGradient, PDFRadialGradient, namedColors, ref;
|
|
|
|
ref = __webpack_require__(75), PDFGradient = ref.PDFGradient, PDFLinearGradient = ref.PDFLinearGradient, PDFRadialGradient = ref.PDFRadialGradient;
|
|
|
|
module.exports = {
|
|
initColor: function() {
|
|
this._opacityRegistry = {};
|
|
this._opacityCount = 0;
|
|
return this._gradCount = 0;
|
|
},
|
|
_normalizeColor: function(color) {
|
|
var hex, part;
|
|
if (color instanceof PDFGradient) {
|
|
return color;
|
|
}
|
|
if (typeof color === 'string') {
|
|
if (color.charAt(0) === '#') {
|
|
if (color.length === 4) {
|
|
color = color.replace(/#([0-9A-F])([0-9A-F])([0-9A-F])/i, "#$1$1$2$2$3$3");
|
|
}
|
|
hex = parseInt(color.slice(1), 16);
|
|
color = [hex >> 16, hex >> 8 & 0xff, hex & 0xff];
|
|
} else if (namedColors[color]) {
|
|
color = namedColors[color];
|
|
}
|
|
}
|
|
if (Array.isArray(color)) {
|
|
if (color.length === 3) {
|
|
color = (function() {
|
|
var i, len, results;
|
|
results = [];
|
|
for (i = 0, len = color.length; i < len; i++) {
|
|
part = color[i];
|
|
results.push(part / 255);
|
|
}
|
|
return results;
|
|
})();
|
|
} else if (color.length === 4) {
|
|
color = (function() {
|
|
var i, len, results;
|
|
results = [];
|
|
for (i = 0, len = color.length; i < len; i++) {
|
|
part = color[i];
|
|
results.push(part / 100);
|
|
}
|
|
return results;
|
|
})();
|
|
}
|
|
return color;
|
|
}
|
|
return null;
|
|
},
|
|
_setColor: function(color, stroke) {
|
|
var gstate, name, op, space;
|
|
color = this._normalizeColor(color);
|
|
if (!color) {
|
|
return false;
|
|
}
|
|
if (this._sMasked) {
|
|
gstate = this.ref({
|
|
Type: 'ExtGState',
|
|
SMask: 'None'
|
|
});
|
|
gstate.end();
|
|
name = "Gs" + (++this._opacityCount);
|
|
this.page.ext_gstates[name] = gstate;
|
|
this.addContent("/" + name + " gs");
|
|
this._sMasked = false;
|
|
}
|
|
op = stroke ? 'SCN' : 'scn';
|
|
if (color instanceof PDFGradient) {
|
|
this._setColorSpace('Pattern', stroke);
|
|
color.apply(op);
|
|
} else {
|
|
space = color.length === 4 ? 'DeviceCMYK' : 'DeviceRGB';
|
|
this._setColorSpace(space, stroke);
|
|
color = color.join(' ');
|
|
this.addContent(color + " " + op);
|
|
}
|
|
return true;
|
|
},
|
|
_setColorSpace: function(space, stroke) {
|
|
var op;
|
|
op = stroke ? 'CS' : 'cs';
|
|
return this.addContent("/" + space + " " + op);
|
|
},
|
|
fillColor: function(color, opacity) {
|
|
var set;
|
|
if (opacity == null) {
|
|
opacity = 1;
|
|
}
|
|
set = this._setColor(color, false);
|
|
if (set) {
|
|
this.fillOpacity(opacity);
|
|
}
|
|
this._fillColor = [color, opacity];
|
|
return this;
|
|
},
|
|
strokeColor: function(color, opacity) {
|
|
var set;
|
|
if (opacity == null) {
|
|
opacity = 1;
|
|
}
|
|
set = this._setColor(color, true);
|
|
if (set) {
|
|
this.strokeOpacity(opacity);
|
|
}
|
|
return this;
|
|
},
|
|
opacity: function(opacity) {
|
|
this._doOpacity(opacity, opacity);
|
|
return this;
|
|
},
|
|
fillOpacity: function(opacity) {
|
|
this._doOpacity(opacity, null);
|
|
return this;
|
|
},
|
|
strokeOpacity: function(opacity) {
|
|
this._doOpacity(null, opacity);
|
|
return this;
|
|
},
|
|
_doOpacity: function(fillOpacity, strokeOpacity) {
|
|
var dictionary, id, key, name, ref1;
|
|
if (!((fillOpacity != null) || (strokeOpacity != null))) {
|
|
return;
|
|
}
|
|
if (fillOpacity != null) {
|
|
fillOpacity = Math.max(0, Math.min(1, fillOpacity));
|
|
}
|
|
if (strokeOpacity != null) {
|
|
strokeOpacity = Math.max(0, Math.min(1, strokeOpacity));
|
|
}
|
|
key = fillOpacity + "_" + strokeOpacity;
|
|
if (this._opacityRegistry[key]) {
|
|
ref1 = this._opacityRegistry[key], dictionary = ref1[0], name = ref1[1];
|
|
} else {
|
|
dictionary = {
|
|
Type: 'ExtGState'
|
|
};
|
|
if (fillOpacity != null) {
|
|
dictionary.ca = fillOpacity;
|
|
}
|
|
if (strokeOpacity != null) {
|
|
dictionary.CA = strokeOpacity;
|
|
}
|
|
dictionary = this.ref(dictionary);
|
|
dictionary.end();
|
|
id = ++this._opacityCount;
|
|
name = "Gs" + id;
|
|
this._opacityRegistry[key] = [dictionary, name];
|
|
}
|
|
this.page.ext_gstates[name] = dictionary;
|
|
return this.addContent("/" + name + " gs");
|
|
},
|
|
linearGradient: function(x1, y1, x2, y2) {
|
|
return new PDFLinearGradient(this, x1, y1, x2, y2);
|
|
},
|
|
radialGradient: function(x1, y1, r1, x2, y2, r2) {
|
|
return new PDFRadialGradient(this, x1, y1, r1, x2, y2, r2);
|
|
}
|
|
};
|
|
|
|
namedColors = {
|
|
aliceblue: [240, 248, 255],
|
|
antiquewhite: [250, 235, 215],
|
|
aqua: [0, 255, 255],
|
|
aquamarine: [127, 255, 212],
|
|
azure: [240, 255, 255],
|
|
beige: [245, 245, 220],
|
|
bisque: [255, 228, 196],
|
|
black: [0, 0, 0],
|
|
blanchedalmond: [255, 235, 205],
|
|
blue: [0, 0, 255],
|
|
blueviolet: [138, 43, 226],
|
|
brown: [165, 42, 42],
|
|
burlywood: [222, 184, 135],
|
|
cadetblue: [95, 158, 160],
|
|
chartreuse: [127, 255, 0],
|
|
chocolate: [210, 105, 30],
|
|
coral: [255, 127, 80],
|
|
cornflowerblue: [100, 149, 237],
|
|
cornsilk: [255, 248, 220],
|
|
crimson: [220, 20, 60],
|
|
cyan: [0, 255, 255],
|
|
darkblue: [0, 0, 139],
|
|
darkcyan: [0, 139, 139],
|
|
darkgoldenrod: [184, 134, 11],
|
|
darkgray: [169, 169, 169],
|
|
darkgreen: [0, 100, 0],
|
|
darkgrey: [169, 169, 169],
|
|
darkkhaki: [189, 183, 107],
|
|
darkmagenta: [139, 0, 139],
|
|
darkolivegreen: [85, 107, 47],
|
|
darkorange: [255, 140, 0],
|
|
darkorchid: [153, 50, 204],
|
|
darkred: [139, 0, 0],
|
|
darksalmon: [233, 150, 122],
|
|
darkseagreen: [143, 188, 143],
|
|
darkslateblue: [72, 61, 139],
|
|
darkslategray: [47, 79, 79],
|
|
darkslategrey: [47, 79, 79],
|
|
darkturquoise: [0, 206, 209],
|
|
darkviolet: [148, 0, 211],
|
|
deeppink: [255, 20, 147],
|
|
deepskyblue: [0, 191, 255],
|
|
dimgray: [105, 105, 105],
|
|
dimgrey: [105, 105, 105],
|
|
dodgerblue: [30, 144, 255],
|
|
firebrick: [178, 34, 34],
|
|
floralwhite: [255, 250, 240],
|
|
forestgreen: [34, 139, 34],
|
|
fuchsia: [255, 0, 255],
|
|
gainsboro: [220, 220, 220],
|
|
ghostwhite: [248, 248, 255],
|
|
gold: [255, 215, 0],
|
|
goldenrod: [218, 165, 32],
|
|
gray: [128, 128, 128],
|
|
grey: [128, 128, 128],
|
|
green: [0, 128, 0],
|
|
greenyellow: [173, 255, 47],
|
|
honeydew: [240, 255, 240],
|
|
hotpink: [255, 105, 180],
|
|
indianred: [205, 92, 92],
|
|
indigo: [75, 0, 130],
|
|
ivory: [255, 255, 240],
|
|
khaki: [240, 230, 140],
|
|
lavender: [230, 230, 250],
|
|
lavenderblush: [255, 240, 245],
|
|
lawngreen: [124, 252, 0],
|
|
lemonchiffon: [255, 250, 205],
|
|
lightblue: [173, 216, 230],
|
|
lightcoral: [240, 128, 128],
|
|
lightcyan: [224, 255, 255],
|
|
lightgoldenrodyellow: [250, 250, 210],
|
|
lightgray: [211, 211, 211],
|
|
lightgreen: [144, 238, 144],
|
|
lightgrey: [211, 211, 211],
|
|
lightpink: [255, 182, 193],
|
|
lightsalmon: [255, 160, 122],
|
|
lightseagreen: [32, 178, 170],
|
|
lightskyblue: [135, 206, 250],
|
|
lightslategray: [119, 136, 153],
|
|
lightslategrey: [119, 136, 153],
|
|
lightsteelblue: [176, 196, 222],
|
|
lightyellow: [255, 255, 224],
|
|
lime: [0, 255, 0],
|
|
limegreen: [50, 205, 50],
|
|
linen: [250, 240, 230],
|
|
magenta: [255, 0, 255],
|
|
maroon: [128, 0, 0],
|
|
mediumaquamarine: [102, 205, 170],
|
|
mediumblue: [0, 0, 205],
|
|
mediumorchid: [186, 85, 211],
|
|
mediumpurple: [147, 112, 219],
|
|
mediumseagreen: [60, 179, 113],
|
|
mediumslateblue: [123, 104, 238],
|
|
mediumspringgreen: [0, 250, 154],
|
|
mediumturquoise: [72, 209, 204],
|
|
mediumvioletred: [199, 21, 133],
|
|
midnightblue: [25, 25, 112],
|
|
mintcream: [245, 255, 250],
|
|
mistyrose: [255, 228, 225],
|
|
moccasin: [255, 228, 181],
|
|
navajowhite: [255, 222, 173],
|
|
navy: [0, 0, 128],
|
|
oldlace: [253, 245, 230],
|
|
olive: [128, 128, 0],
|
|
olivedrab: [107, 142, 35],
|
|
orange: [255, 165, 0],
|
|
orangered: [255, 69, 0],
|
|
orchid: [218, 112, 214],
|
|
palegoldenrod: [238, 232, 170],
|
|
palegreen: [152, 251, 152],
|
|
paleturquoise: [175, 238, 238],
|
|
palevioletred: [219, 112, 147],
|
|
papayawhip: [255, 239, 213],
|
|
peachpuff: [255, 218, 185],
|
|
peru: [205, 133, 63],
|
|
pink: [255, 192, 203],
|
|
plum: [221, 160, 221],
|
|
powderblue: [176, 224, 230],
|
|
purple: [128, 0, 128],
|
|
red: [255, 0, 0],
|
|
rosybrown: [188, 143, 143],
|
|
royalblue: [65, 105, 225],
|
|
saddlebrown: [139, 69, 19],
|
|
salmon: [250, 128, 114],
|
|
sandybrown: [244, 164, 96],
|
|
seagreen: [46, 139, 87],
|
|
seashell: [255, 245, 238],
|
|
sienna: [160, 82, 45],
|
|
silver: [192, 192, 192],
|
|
skyblue: [135, 206, 235],
|
|
slateblue: [106, 90, 205],
|
|
slategray: [112, 128, 144],
|
|
slategrey: [112, 128, 144],
|
|
snow: [255, 250, 250],
|
|
springgreen: [0, 255, 127],
|
|
steelblue: [70, 130, 180],
|
|
tan: [210, 180, 140],
|
|
teal: [0, 128, 128],
|
|
thistle: [216, 191, 216],
|
|
tomato: [255, 99, 71],
|
|
turquoise: [64, 224, 208],
|
|
violet: [238, 130, 238],
|
|
wheat: [245, 222, 179],
|
|
white: [255, 255, 255],
|
|
whitesmoke: [245, 245, 245],
|
|
yellow: [255, 255, 0],
|
|
yellowgreen: [154, 205, 50]
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 75 */
|
|
/***/ function(module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var PDFGradient, PDFLinearGradient, PDFRadialGradient,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
PDFGradient = (function() {
|
|
function PDFGradient(doc) {
|
|
this.doc = doc;
|
|
this.stops = [];
|
|
this.embedded = false;
|
|
this.transform = [1, 0, 0, 1, 0, 0];
|
|
this._colorSpace = 'DeviceRGB';
|
|
}
|
|
|
|
PDFGradient.prototype.stop = function(pos, color, opacity) {
|
|
if (opacity == null) {
|
|
opacity = 1;
|
|
}
|
|
opacity = Math.max(0, Math.min(1, opacity));
|
|
this.stops.push([pos, this.doc._normalizeColor(color), opacity]);
|
|
return this;
|
|
};
|
|
|
|
PDFGradient.prototype.embed = function() {
|
|
var bounds, dx, dy, encode, fn, form, grad, group, gstate, i, j, k, last, len, m, m0, m1, m11, m12, m2, m21, m22, m3, m4, m5, name, pattern, ref, ref1, ref2, resources, sMask, shader, stop, stops, v;
|
|
if (this.embedded || this.stops.length === 0) {
|
|
return;
|
|
}
|
|
this.embedded = true;
|
|
last = this.stops[this.stops.length - 1];
|
|
if (last[0] < 1) {
|
|
this.stops.push([1, last[1], last[2]]);
|
|
}
|
|
bounds = [];
|
|
encode = [];
|
|
stops = [];
|
|
for (i = j = 0, ref = this.stops.length - 1; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
|
|
encode.push(0, 1);
|
|
if (i + 2 !== this.stops.length) {
|
|
bounds.push(this.stops[i + 1][0]);
|
|
}
|
|
fn = this.doc.ref({
|
|
FunctionType: 2,
|
|
Domain: [0, 1],
|
|
C0: this.stops[i + 0][1],
|
|
C1: this.stops[i + 1][1],
|
|
N: 1
|
|
});
|
|
stops.push(fn);
|
|
fn.end();
|
|
}
|
|
if (stops.length === 1) {
|
|
fn = stops[0];
|
|
} else {
|
|
fn = this.doc.ref({
|
|
FunctionType: 3,
|
|
Domain: [0, 1],
|
|
Functions: stops,
|
|
Bounds: bounds,
|
|
Encode: encode
|
|
});
|
|
fn.end();
|
|
}
|
|
this.id = 'Sh' + (++this.doc._gradCount);
|
|
m = this.doc._ctm.slice();
|
|
m0 = m[0], m1 = m[1], m2 = m[2], m3 = m[3], m4 = m[4], m5 = m[5];
|
|
ref1 = this.transform, m11 = ref1[0], m12 = ref1[1], m21 = ref1[2], m22 = ref1[3], dx = ref1[4], dy = ref1[5];
|
|
m[0] = m0 * m11 + m2 * m12;
|
|
m[1] = m1 * m11 + m3 * m12;
|
|
m[2] = m0 * m21 + m2 * m22;
|
|
m[3] = m1 * m21 + m3 * m22;
|
|
m[4] = m0 * dx + m2 * dy + m4;
|
|
m[5] = m1 * dx + m3 * dy + m5;
|
|
shader = this.shader(fn);
|
|
shader.end();
|
|
pattern = this.doc.ref({
|
|
Type: 'Pattern',
|
|
PatternType: 2,
|
|
Shading: shader,
|
|
Matrix: (function() {
|
|
var k, len, results;
|
|
results = [];
|
|
for (k = 0, len = m.length; k < len; k++) {
|
|
v = m[k];
|
|
results.push(+v.toFixed(5));
|
|
}
|
|
return results;
|
|
})()
|
|
});
|
|
this.doc.page.patterns[this.id] = pattern;
|
|
pattern.end();
|
|
if (this.stops.some(function(stop) {
|
|
return stop[2] < 1;
|
|
})) {
|
|
grad = this.opacityGradient();
|
|
grad._colorSpace = 'DeviceGray';
|
|
ref2 = this.stops;
|
|
for (k = 0, len = ref2.length; k < len; k++) {
|
|
stop = ref2[k];
|
|
grad.stop(stop[0], [stop[2]]);
|
|
}
|
|
grad = grad.embed();
|
|
group = this.doc.ref({
|
|
Type: 'Group',
|
|
S: 'Transparency',
|
|
CS: 'DeviceGray'
|
|
});
|
|
group.end();
|
|
resources = this.doc.ref({
|
|
ProcSet: ['PDF', 'Text', 'ImageB', 'ImageC', 'ImageI'],
|
|
Shading: {
|
|
Sh1: grad.data.Shading
|
|
}
|
|
});
|
|
resources.end();
|
|
form = this.doc.ref({
|
|
Type: 'XObject',
|
|
Subtype: 'Form',
|
|
FormType: 1,
|
|
BBox: [0, 0, this.doc.page.width, this.doc.page.height],
|
|
Group: group,
|
|
Resources: resources
|
|
});
|
|
form.end("/Sh1 sh");
|
|
sMask = this.doc.ref({
|
|
Type: 'Mask',
|
|
S: 'Luminosity',
|
|
G: form
|
|
});
|
|
sMask.end();
|
|
gstate = this.doc.ref({
|
|
Type: 'ExtGState',
|
|
SMask: sMask
|
|
});
|
|
this.opacity_id = ++this.doc._opacityCount;
|
|
name = "Gs" + this.opacity_id;
|
|
this.doc.page.ext_gstates[name] = gstate;
|
|
gstate.end();
|
|
}
|
|
return pattern;
|
|
};
|
|
|
|
PDFGradient.prototype.apply = function(op) {
|
|
if (!this.embedded) {
|
|
this.embed();
|
|
}
|
|
this.doc.addContent("/" + this.id + " " + op);
|
|
if (this.opacity_id) {
|
|
this.doc.addContent("/Gs" + this.opacity_id + " gs");
|
|
return this.doc._sMasked = true;
|
|
}
|
|
};
|
|
|
|
return PDFGradient;
|
|
|
|
})();
|
|
|
|
PDFLinearGradient = (function(superClass) {
|
|
extend(PDFLinearGradient, superClass);
|
|
|
|
function PDFLinearGradient(doc, x1, y1, x2, y2) {
|
|
this.doc = doc;
|
|
this.x1 = x1;
|
|
this.y1 = y1;
|
|
this.x2 = x2;
|
|
this.y2 = y2;
|
|
PDFLinearGradient.__super__.constructor.apply(this, arguments);
|
|
}
|
|
|
|
PDFLinearGradient.prototype.shader = function(fn) {
|
|
return this.doc.ref({
|
|
ShadingType: 2,
|
|
ColorSpace: this._colorSpace,
|
|
Coords: [this.x1, this.y1, this.x2, this.y2],
|
|
Function: fn,
|
|
Extend: [true, true]
|
|
});
|
|
};
|
|
|
|
PDFLinearGradient.prototype.opacityGradient = function() {
|
|
return new PDFLinearGradient(this.doc, this.x1, this.y1, this.x2, this.y2);
|
|
};
|
|
|
|
return PDFLinearGradient;
|
|
|
|
})(PDFGradient);
|
|
|
|
PDFRadialGradient = (function(superClass) {
|
|
extend(PDFRadialGradient, superClass);
|
|
|
|
function PDFRadialGradient(doc, x1, y1, r1, x2, y2, r2) {
|
|
this.doc = doc;
|
|
this.x1 = x1;
|
|
this.y1 = y1;
|
|
this.r1 = r1;
|
|
this.x2 = x2;
|
|
this.y2 = y2;
|
|
this.r2 = r2;
|
|
PDFRadialGradient.__super__.constructor.apply(this, arguments);
|
|
}
|
|
|
|
PDFRadialGradient.prototype.shader = function(fn) {
|
|
return this.doc.ref({
|
|
ShadingType: 3,
|
|
ColorSpace: this._colorSpace,
|
|
Coords: [this.x1, this.y1, this.r1, this.x2, this.y2, this.r2],
|
|
Function: fn,
|
|
Extend: [true, true]
|
|
});
|
|
};
|
|
|
|
PDFRadialGradient.prototype.opacityGradient = function() {
|
|
return new PDFRadialGradient(this.doc, this.x1, this.y1, this.r1, this.x2, this.y2, this.r2);
|
|
};
|
|
|
|
return PDFRadialGradient;
|
|
|
|
})(PDFGradient);
|
|
|
|
module.exports = {
|
|
PDFGradient: PDFGradient,
|
|
PDFLinearGradient: PDFLinearGradient,
|
|
PDFRadialGradient: PDFRadialGradient
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 76 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var KAPPA, SVGPath,
|
|
slice = [].slice;
|
|
|
|
SVGPath = __webpack_require__(77);
|
|
|
|
KAPPA = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0);
|
|
|
|
module.exports = {
|
|
initVector: function() {
|
|
this._ctm = [1, 0, 0, 1, 0, 0];
|
|
return this._ctmStack = [];
|
|
},
|
|
save: function() {
|
|
this._ctmStack.push(this._ctm.slice());
|
|
return this.addContent('q');
|
|
},
|
|
restore: function() {
|
|
this._ctm = this._ctmStack.pop() || [1, 0, 0, 1, 0, 0];
|
|
return this.addContent('Q');
|
|
},
|
|
closePath: function() {
|
|
return this.addContent('h');
|
|
},
|
|
lineWidth: function(w) {
|
|
return this.addContent(w + " w");
|
|
},
|
|
_CAP_STYLES: {
|
|
BUTT: 0,
|
|
ROUND: 1,
|
|
SQUARE: 2
|
|
},
|
|
lineCap: function(c) {
|
|
if (typeof c === 'string') {
|
|
c = this._CAP_STYLES[c.toUpperCase()];
|
|
}
|
|
return this.addContent(c + " J");
|
|
},
|
|
_JOIN_STYLES: {
|
|
MITER: 0,
|
|
ROUND: 1,
|
|
BEVEL: 2
|
|
},
|
|
lineJoin: function(j) {
|
|
if (typeof j === 'string') {
|
|
j = this._JOIN_STYLES[j.toUpperCase()];
|
|
}
|
|
return this.addContent(j + " j");
|
|
},
|
|
miterLimit: function(m) {
|
|
return this.addContent(m + " M");
|
|
},
|
|
dash: function(length, options) {
|
|
var phase, ref, space;
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
if (length == null) {
|
|
return this;
|
|
}
|
|
space = (ref = options.space) != null ? ref : length;
|
|
phase = options.phase || 0;
|
|
return this.addContent("[" + length + " " + space + "] " + phase + " d");
|
|
},
|
|
undash: function() {
|
|
return this.addContent("[] 0 d");
|
|
},
|
|
moveTo: function(x, y) {
|
|
return this.addContent(x + " " + y + " m");
|
|
},
|
|
lineTo: function(x, y) {
|
|
return this.addContent(x + " " + y + " l");
|
|
},
|
|
bezierCurveTo: function(cp1x, cp1y, cp2x, cp2y, x, y) {
|
|
return this.addContent(cp1x + " " + cp1y + " " + cp2x + " " + cp2y + " " + x + " " + y + " c");
|
|
},
|
|
quadraticCurveTo: function(cpx, cpy, x, y) {
|
|
return this.addContent(cpx + " " + cpy + " " + x + " " + y + " v");
|
|
},
|
|
rect: function(x, y, w, h) {
|
|
return this.addContent(x + " " + y + " " + w + " " + h + " re");
|
|
},
|
|
roundedRect: function(x, y, w, h, r) {
|
|
if (r == null) {
|
|
r = 0;
|
|
}
|
|
this.moveTo(x + r, y);
|
|
this.lineTo(x + w - r, y);
|
|
this.quadraticCurveTo(x + w, y, x + w, y + r);
|
|
this.lineTo(x + w, y + h - r);
|
|
this.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
|
|
this.lineTo(x + r, y + h);
|
|
this.quadraticCurveTo(x, y + h, x, y + h - r);
|
|
this.lineTo(x, y + r);
|
|
return this.quadraticCurveTo(x, y, x + r, y);
|
|
},
|
|
ellipse: function(x, y, r1, r2) {
|
|
var ox, oy, xe, xm, ye, ym;
|
|
if (r2 == null) {
|
|
r2 = r1;
|
|
}
|
|
x -= r1;
|
|
y -= r2;
|
|
ox = r1 * KAPPA;
|
|
oy = r2 * KAPPA;
|
|
xe = x + r1 * 2;
|
|
ye = y + r2 * 2;
|
|
xm = x + r1;
|
|
ym = y + r2;
|
|
this.moveTo(x, ym);
|
|
this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);
|
|
this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);
|
|
this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);
|
|
this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);
|
|
return this.closePath();
|
|
},
|
|
circle: function(x, y, radius) {
|
|
return this.ellipse(x, y, radius);
|
|
},
|
|
polygon: function() {
|
|
var i, len, point, points;
|
|
points = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
this.moveTo.apply(this, points.shift());
|
|
for (i = 0, len = points.length; i < len; i++) {
|
|
point = points[i];
|
|
this.lineTo.apply(this, point);
|
|
}
|
|
return this.closePath();
|
|
},
|
|
path: function(path) {
|
|
SVGPath.apply(this, path);
|
|
return this;
|
|
},
|
|
_windingRule: function(rule) {
|
|
if (/even-?odd/.test(rule)) {
|
|
return '*';
|
|
}
|
|
return '';
|
|
},
|
|
fill: function(color, rule) {
|
|
if (/(even-?odd)|(non-?zero)/.test(color)) {
|
|
rule = color;
|
|
color = null;
|
|
}
|
|
if (color) {
|
|
this.fillColor(color);
|
|
}
|
|
return this.addContent('f' + this._windingRule(rule));
|
|
},
|
|
stroke: function(color) {
|
|
if (color) {
|
|
this.strokeColor(color);
|
|
}
|
|
return this.addContent('S');
|
|
},
|
|
fillAndStroke: function(fillColor, strokeColor, rule) {
|
|
var isFillRule;
|
|
if (strokeColor == null) {
|
|
strokeColor = fillColor;
|
|
}
|
|
isFillRule = /(even-?odd)|(non-?zero)/;
|
|
if (isFillRule.test(fillColor)) {
|
|
rule = fillColor;
|
|
fillColor = null;
|
|
}
|
|
if (isFillRule.test(strokeColor)) {
|
|
rule = strokeColor;
|
|
strokeColor = fillColor;
|
|
}
|
|
if (fillColor) {
|
|
this.fillColor(fillColor);
|
|
this.strokeColor(strokeColor);
|
|
}
|
|
return this.addContent('B' + this._windingRule(rule));
|
|
},
|
|
clip: function(rule) {
|
|
return this.addContent('W' + this._windingRule(rule) + ' n');
|
|
},
|
|
transform: function(m11, m12, m21, m22, dx, dy) {
|
|
var m, m0, m1, m2, m3, m4, m5, v, values;
|
|
m = this._ctm;
|
|
m0 = m[0], m1 = m[1], m2 = m[2], m3 = m[3], m4 = m[4], m5 = m[5];
|
|
m[0] = m0 * m11 + m2 * m12;
|
|
m[1] = m1 * m11 + m3 * m12;
|
|
m[2] = m0 * m21 + m2 * m22;
|
|
m[3] = m1 * m21 + m3 * m22;
|
|
m[4] = m0 * dx + m2 * dy + m4;
|
|
m[5] = m1 * dx + m3 * dy + m5;
|
|
values = ((function() {
|
|
var i, len, ref, results;
|
|
ref = [m11, m12, m21, m22, dx, dy];
|
|
results = [];
|
|
for (i = 0, len = ref.length; i < len; i++) {
|
|
v = ref[i];
|
|
results.push(+v.toFixed(5));
|
|
}
|
|
return results;
|
|
})()).join(' ');
|
|
return this.addContent(values + " cm");
|
|
},
|
|
translate: function(x, y) {
|
|
return this.transform(1, 0, 0, 1, x, y);
|
|
},
|
|
rotate: function(angle, options) {
|
|
var cos, rad, ref, sin, x, x1, y, y1;
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
rad = angle * Math.PI / 180;
|
|
cos = Math.cos(rad);
|
|
sin = Math.sin(rad);
|
|
x = y = 0;
|
|
if (options.origin != null) {
|
|
ref = options.origin, x = ref[0], y = ref[1];
|
|
x1 = x * cos - y * sin;
|
|
y1 = x * sin + y * cos;
|
|
x -= x1;
|
|
y -= y1;
|
|
}
|
|
return this.transform(cos, sin, -sin, cos, x, y);
|
|
},
|
|
scale: function(xFactor, yFactor, options) {
|
|
var ref, x, y;
|
|
if (yFactor == null) {
|
|
yFactor = xFactor;
|
|
}
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
if (arguments.length === 2) {
|
|
yFactor = xFactor;
|
|
options = yFactor;
|
|
}
|
|
x = y = 0;
|
|
if (options.origin != null) {
|
|
ref = options.origin, x = ref[0], y = ref[1];
|
|
x -= xFactor * x;
|
|
y -= yFactor * y;
|
|
}
|
|
return this.transform(xFactor, 0, 0, yFactor, x, y);
|
|
}
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 77 */
|
|
/***/ function(module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var SVGPath;
|
|
|
|
SVGPath = (function() {
|
|
var apply, arcToSegments, cx, cy, fixRoundingError, parameters, parse, px, py, runners, segmentToBezier, solveArc, sx, sy;
|
|
|
|
function SVGPath() {}
|
|
|
|
SVGPath.apply = function(doc, path) {
|
|
var commands;
|
|
commands = parse(path);
|
|
return apply(commands, doc);
|
|
};
|
|
|
|
parameters = {
|
|
A: 7,
|
|
a: 7,
|
|
C: 6,
|
|
c: 6,
|
|
H: 1,
|
|
h: 1,
|
|
L: 2,
|
|
l: 2,
|
|
M: 2,
|
|
m: 2,
|
|
Q: 4,
|
|
q: 4,
|
|
S: 4,
|
|
s: 4,
|
|
T: 2,
|
|
t: 2,
|
|
V: 1,
|
|
v: 1,
|
|
Z: 0,
|
|
z: 0
|
|
};
|
|
|
|
parse = function(path) {
|
|
var args, c, cmd, curArg, foundDecimal, j, len, params, ret;
|
|
ret = [];
|
|
args = [];
|
|
curArg = "";
|
|
foundDecimal = false;
|
|
params = 0;
|
|
for (j = 0, len = path.length; j < len; j++) {
|
|
c = path[j];
|
|
if (parameters[c] != null) {
|
|
params = parameters[c];
|
|
if (cmd) {
|
|
if (curArg.length > 0) {
|
|
args[args.length] = +curArg;
|
|
}
|
|
ret[ret.length] = {
|
|
cmd: cmd,
|
|
args: args
|
|
};
|
|
args = [];
|
|
curArg = "";
|
|
foundDecimal = false;
|
|
}
|
|
cmd = c;
|
|
} else if ((c === " " || c === ",") || (c === "-" && curArg.length > 0 && curArg[curArg.length - 1] !== 'e') || (c === "." && foundDecimal)) {
|
|
if (curArg.length === 0) {
|
|
continue;
|
|
}
|
|
if (args.length === params) {
|
|
ret[ret.length] = {
|
|
cmd: cmd,
|
|
args: args
|
|
};
|
|
args = [+curArg];
|
|
if (cmd === "M") {
|
|
cmd = "L";
|
|
}
|
|
if (cmd === "m") {
|
|
cmd = "l";
|
|
}
|
|
} else {
|
|
args[args.length] = +curArg;
|
|
}
|
|
foundDecimal = c === ".";
|
|
curArg = c === '-' || c === '.' ? c : '';
|
|
} else {
|
|
curArg += c;
|
|
if (c === '.') {
|
|
foundDecimal = true;
|
|
}
|
|
}
|
|
}
|
|
if (curArg.length > 0) {
|
|
if (args.length === params) {
|
|
ret[ret.length] = {
|
|
cmd: cmd,
|
|
args: args
|
|
};
|
|
args = [+curArg];
|
|
if (cmd === "M") {
|
|
cmd = "L";
|
|
}
|
|
if (cmd === "m") {
|
|
cmd = "l";
|
|
}
|
|
} else {
|
|
args[args.length] = +curArg;
|
|
}
|
|
}
|
|
ret[ret.length] = {
|
|
cmd: cmd,
|
|
args: args
|
|
};
|
|
return ret;
|
|
};
|
|
|
|
cx = cy = px = py = sx = sy = 0;
|
|
|
|
apply = function(commands, doc) {
|
|
var c, i, j, len, name;
|
|
cx = cy = px = py = sx = sy = 0;
|
|
for (i = j = 0, len = commands.length; j < len; i = ++j) {
|
|
c = commands[i];
|
|
if (typeof runners[name = c.cmd] === "function") {
|
|
runners[name](doc, c.args);
|
|
}
|
|
}
|
|
return cx = cy = px = py = 0;
|
|
};
|
|
|
|
runners = {
|
|
M: function(doc, a) {
|
|
cx = a[0];
|
|
cy = a[1];
|
|
px = py = null;
|
|
sx = cx;
|
|
sy = cy;
|
|
return doc.moveTo(cx, cy);
|
|
},
|
|
m: function(doc, a) {
|
|
cx += a[0];
|
|
cy += a[1];
|
|
px = py = null;
|
|
sx = cx;
|
|
sy = cy;
|
|
return doc.moveTo(cx, cy);
|
|
},
|
|
C: function(doc, a) {
|
|
cx = a[4];
|
|
cy = a[5];
|
|
px = a[2];
|
|
py = a[3];
|
|
return doc.bezierCurveTo.apply(doc, a);
|
|
},
|
|
c: function(doc, a) {
|
|
doc.bezierCurveTo(a[0] + cx, a[1] + cy, a[2] + cx, a[3] + cy, a[4] + cx, a[5] + cy);
|
|
px = cx + a[2];
|
|
py = cy + a[3];
|
|
cx += a[4];
|
|
return cy += a[5];
|
|
},
|
|
S: function(doc, a) {
|
|
if (px === null) {
|
|
px = cx;
|
|
py = cy;
|
|
}
|
|
doc.bezierCurveTo(cx - (px - cx), cy - (py - cy), a[0], a[1], a[2], a[3]);
|
|
px = a[0];
|
|
py = a[1];
|
|
cx = a[2];
|
|
return cy = a[3];
|
|
},
|
|
s: function(doc, a) {
|
|
if (px === null) {
|
|
px = cx;
|
|
py = cy;
|
|
}
|
|
doc.bezierCurveTo(cx - (px - cx), cy - (py - cy), cx + a[0], cy + a[1], cx + a[2], cy + a[3]);
|
|
px = cx + a[0];
|
|
py = cy + a[1];
|
|
cx += a[2];
|
|
return cy += a[3];
|
|
},
|
|
Q: function(doc, a) {
|
|
px = a[0];
|
|
py = a[1];
|
|
cx = a[2];
|
|
cy = a[3];
|
|
return doc.quadraticCurveTo(a[0], a[1], cx, cy);
|
|
},
|
|
q: function(doc, a) {
|
|
doc.quadraticCurveTo(a[0] + cx, a[1] + cy, a[2] + cx, a[3] + cy);
|
|
px = cx + a[0];
|
|
py = cy + a[1];
|
|
cx += a[2];
|
|
return cy += a[3];
|
|
},
|
|
T: function(doc, a) {
|
|
if (px === null) {
|
|
px = cx;
|
|
py = cy;
|
|
} else {
|
|
px = cx - (px - cx);
|
|
py = cy - (py - cy);
|
|
}
|
|
doc.quadraticCurveTo(px, py, a[0], a[1]);
|
|
px = cx - (px - cx);
|
|
py = cy - (py - cy);
|
|
cx = a[0];
|
|
return cy = a[1];
|
|
},
|
|
t: function(doc, a) {
|
|
if (px === null) {
|
|
px = cx;
|
|
py = cy;
|
|
} else {
|
|
px = cx - (px - cx);
|
|
py = cy - (py - cy);
|
|
}
|
|
doc.quadraticCurveTo(px, py, cx + a[0], cy + a[1]);
|
|
cx += a[0];
|
|
return cy += a[1];
|
|
},
|
|
A: function(doc, a) {
|
|
solveArc(doc, cx, cy, a);
|
|
cx = a[5];
|
|
return cy = a[6];
|
|
},
|
|
a: function(doc, a) {
|
|
a[5] += cx;
|
|
a[6] += cy;
|
|
solveArc(doc, cx, cy, a);
|
|
cx = a[5];
|
|
return cy = a[6];
|
|
},
|
|
L: function(doc, a) {
|
|
cx = a[0];
|
|
cy = a[1];
|
|
px = py = null;
|
|
return doc.lineTo(cx, cy);
|
|
},
|
|
l: function(doc, a) {
|
|
cx += a[0];
|
|
cy += a[1];
|
|
px = py = null;
|
|
return doc.lineTo(cx, cy);
|
|
},
|
|
H: function(doc, a) {
|
|
cx = a[0];
|
|
px = py = null;
|
|
return doc.lineTo(cx, cy);
|
|
},
|
|
h: function(doc, a) {
|
|
cx += a[0];
|
|
px = py = null;
|
|
return doc.lineTo(cx, cy);
|
|
},
|
|
V: function(doc, a) {
|
|
cy = a[0];
|
|
px = py = null;
|
|
return doc.lineTo(cx, cy);
|
|
},
|
|
v: function(doc, a) {
|
|
cy += a[0];
|
|
px = py = null;
|
|
return doc.lineTo(cx, cy);
|
|
},
|
|
Z: function(doc) {
|
|
doc.closePath();
|
|
cx = sx;
|
|
return cy = sy;
|
|
},
|
|
z: function(doc) {
|
|
doc.closePath();
|
|
cx = sx;
|
|
return cy = sy;
|
|
}
|
|
};
|
|
|
|
solveArc = function(doc, x, y, coords) {
|
|
var bez, ex, ey, j, large, len, results, rot, rx, ry, seg, segs, sweep;
|
|
rx = coords[0], ry = coords[1], rot = coords[2], large = coords[3], sweep = coords[4], ex = coords[5], ey = coords[6];
|
|
segs = arcToSegments(ex, ey, rx, ry, large, sweep, rot, x, y);
|
|
results = [];
|
|
for (j = 0, len = segs.length; j < len; j++) {
|
|
seg = segs[j];
|
|
bez = segmentToBezier.apply(null, seg);
|
|
results.push(doc.bezierCurveTo.apply(doc, bez));
|
|
}
|
|
return results;
|
|
};
|
|
|
|
arcToSegments = function(x, y, rx, ry, large, sweep, rotateX, ox, oy) {
|
|
var a00, a01, a10, a11, cos_th, d, i, j, pl, ref, result, segments, sfactor, sfactor_sq, sin_th, th, th0, th1, th2, th3, th_arc, x0, x1, xc, y0, y1, yc;
|
|
th = rotateX * (Math.PI / 180);
|
|
sin_th = Math.sin(th);
|
|
cos_th = Math.cos(th);
|
|
rx = Math.abs(rx);
|
|
ry = Math.abs(ry);
|
|
px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5;
|
|
py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5;
|
|
pl = (px * px) / (rx * rx) + (py * py) / (ry * ry);
|
|
if (pl > 1) {
|
|
pl = Math.sqrt(pl);
|
|
rx *= pl;
|
|
ry *= pl;
|
|
}
|
|
a00 = cos_th / rx;
|
|
a01 = sin_th / rx;
|
|
a10 = (-sin_th) / ry;
|
|
a11 = cos_th / ry;
|
|
x0 = a00 * ox + a01 * oy;
|
|
y0 = a10 * ox + a11 * oy;
|
|
x1 = a00 * x + a01 * y;
|
|
y1 = a10 * x + a11 * y;
|
|
d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);
|
|
sfactor_sq = 1 / d - 0.25;
|
|
if (sfactor_sq < 0) {
|
|
sfactor_sq = 0;
|
|
}
|
|
sfactor = Math.sqrt(sfactor_sq);
|
|
if (sweep === large) {
|
|
sfactor = -sfactor;
|
|
}
|
|
xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0);
|
|
yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0);
|
|
th0 = Math.atan2(y0 - yc, x0 - xc);
|
|
th1 = Math.atan2(y1 - yc, x1 - xc);
|
|
th_arc = th1 - th0;
|
|
if (th_arc < 0 && sweep === 1) {
|
|
th_arc += 2 * Math.PI;
|
|
} else if (th_arc > 0 && sweep === 0) {
|
|
th_arc -= 2 * Math.PI;
|
|
}
|
|
segments = Math.ceil(Math.abs(th_arc / (Math.PI * 0.5 + 0.001)));
|
|
result = [];
|
|
for (i = j = 0, ref = segments; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
|
|
th2 = th0 + i * th_arc / segments;
|
|
th3 = th0 + (i + 1) * th_arc / segments;
|
|
result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th];
|
|
}
|
|
return result;
|
|
};
|
|
|
|
segmentToBezier = function(cx, cy, th0, th1, rx, ry, sin_th, cos_th) {
|
|
var a00, a01, a10, a11, t, th_half, x1, x2, x3, y1, y2, y3;
|
|
a00 = cos_th * rx;
|
|
a01 = -sin_th * ry;
|
|
a10 = sin_th * rx;
|
|
a11 = cos_th * ry;
|
|
th_half = 0.5 * (th1 - th0);
|
|
t = (8 / 3) * Math.sin(th_half * 0.5) * Math.sin(th_half * 0.5) / Math.sin(th_half);
|
|
x1 = fixRoundingError(cx + Math.cos(th0) - t * Math.sin(th0));
|
|
y1 = fixRoundingError(cy + Math.sin(th0) + t * Math.cos(th0));
|
|
x3 = fixRoundingError(cx + Math.cos(th1));
|
|
y3 = fixRoundingError(cy + Math.sin(th1));
|
|
x2 = fixRoundingError(x3 + t * Math.sin(th1));
|
|
y2 = fixRoundingError(y3 - t * Math.cos(th1));
|
|
return [a00 * x1 + a01 * y1, a10 * x1 + a11 * y1, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3];
|
|
};
|
|
|
|
fixRoundingError = function(x) {
|
|
if (Math.abs(Math.round(x) - x) < 0.0000000000001) {
|
|
return Math.round(x);
|
|
}
|
|
return x;
|
|
};
|
|
|
|
return SVGPath;
|
|
|
|
})();
|
|
|
|
module.exports = SVGPath;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 78 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var PDFFont;
|
|
|
|
PDFFont = __webpack_require__(79);
|
|
|
|
module.exports = {
|
|
initFonts: function() {
|
|
this._fontFamilies = {};
|
|
this._fontCount = 0;
|
|
this._fontSize = 12;
|
|
this._font = null;
|
|
this._registeredFonts = {};
|
|
|
|
},
|
|
font: function(src, family, size) {
|
|
var cacheKey, font, id, ref;
|
|
if (typeof family === 'number') {
|
|
size = family;
|
|
family = null;
|
|
}
|
|
if (typeof src === 'string' && this._registeredFonts[src]) {
|
|
cacheKey = src;
|
|
ref = this._registeredFonts[src], src = ref.src, family = ref.family;
|
|
} else {
|
|
cacheKey = family || src;
|
|
if (typeof cacheKey !== 'string') {
|
|
cacheKey = null;
|
|
}
|
|
}
|
|
if (size != null) {
|
|
this.fontSize(size);
|
|
}
|
|
if (font = this._fontFamilies[cacheKey]) {
|
|
this._font = font;
|
|
return this;
|
|
}
|
|
id = 'F' + (++this._fontCount);
|
|
this._font = PDFFont.open(this, src, family, id);
|
|
if (font = this._fontFamilies[this._font.name]) {
|
|
this._font = font;
|
|
return this;
|
|
}
|
|
if (cacheKey) {
|
|
this._fontFamilies[cacheKey] = this._font;
|
|
}
|
|
this._fontFamilies[this._font.name] = this._font;
|
|
return this;
|
|
},
|
|
fontSize: function(_fontSize) {
|
|
this._fontSize = _fontSize;
|
|
return this;
|
|
},
|
|
currentLineHeight: function(includeGap) {
|
|
if (includeGap == null) {
|
|
includeGap = false;
|
|
}
|
|
return this._font.lineHeight(this._fontSize, includeGap);
|
|
},
|
|
registerFont: function(name, src, family) {
|
|
this._registeredFonts[name] = {
|
|
src: src,
|
|
family: family
|
|
};
|
|
return this;
|
|
}
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 79 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var EmbeddedFont, PDFFont, StandardFont, fontkit;
|
|
|
|
fontkit = __webpack_require__(80);
|
|
|
|
PDFFont = (function() {
|
|
PDFFont.open = function(document, src, family, id) {
|
|
var font;
|
|
if (typeof src === 'string') {
|
|
if (StandardFont.isStandardFont(src)) {
|
|
return new StandardFont(document, src, id);
|
|
}
|
|
font = fontkit.openSync(src, family);
|
|
} else if (Buffer.isBuffer(src)) {
|
|
font = fontkit.create(src, family);
|
|
} else if (src instanceof Uint8Array) {
|
|
font = fontkit.create(new Buffer(src), family);
|
|
} else if (src instanceof ArrayBuffer) {
|
|
font = fontkit.create(new Buffer(new Uint8Array(src)), family);
|
|
}
|
|
if (font == null) {
|
|
throw new Error('Not a supported font format or standard PDF font.');
|
|
}
|
|
return new EmbeddedFont(document, font, id);
|
|
};
|
|
|
|
function PDFFont() {
|
|
throw new Error('Cannot construct a PDFFont directly.');
|
|
}
|
|
|
|
PDFFont.prototype.encode = function(text) {
|
|
throw new Error('Must be implemented by subclasses');
|
|
};
|
|
|
|
PDFFont.prototype.widthOfString = function(text) {
|
|
throw new Error('Must be implemented by subclasses');
|
|
};
|
|
|
|
PDFFont.prototype.ref = function() {
|
|
return this.dictionary != null ? this.dictionary : this.dictionary = this.document.ref();
|
|
};
|
|
|
|
PDFFont.prototype.finalize = function() {
|
|
if (this.embedded || (this.dictionary == null)) {
|
|
return;
|
|
}
|
|
this.embed();
|
|
return this.embedded = true;
|
|
};
|
|
|
|
PDFFont.prototype.embed = function() {
|
|
throw new Error('Must be implemented by subclasses');
|
|
};
|
|
|
|
PDFFont.prototype.lineHeight = function(size, includeGap) {
|
|
var gap;
|
|
if (includeGap == null) {
|
|
includeGap = false;
|
|
}
|
|
gap = includeGap ? this.lineGap : 0;
|
|
return (this.ascender + gap - this.descender) / 1000 * size;
|
|
};
|
|
|
|
return PDFFont;
|
|
|
|
})();
|
|
|
|
module.exports = PDFFont;
|
|
|
|
StandardFont = __webpack_require__(283);
|
|
|
|
EmbeddedFont = __webpack_require__(285);
|
|
|
|
}).call(this);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 80 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer, process) {'use strict';
|
|
|
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
|
|
var r = _interopDefault(__webpack_require__(81));
|
|
var _Object$getOwnPropertyDescriptor = _interopDefault(__webpack_require__(119));
|
|
var _getIterator = _interopDefault(__webpack_require__(145));
|
|
var _Object$freeze = _interopDefault(__webpack_require__(178));
|
|
var _Object$keys = _interopDefault(__webpack_require__(182));
|
|
var _typeof = _interopDefault(__webpack_require__(185));
|
|
var _Object$defineProperty = _interopDefault(__webpack_require__(202));
|
|
var _classCallCheck = _interopDefault(__webpack_require__(205));
|
|
var _createClass = _interopDefault(__webpack_require__(206));
|
|
var _Map = _interopDefault(__webpack_require__(207));
|
|
var _Object$getPrototypeOf = _interopDefault(__webpack_require__(224));
|
|
var _possibleConstructorReturn = _interopDefault(__webpack_require__(227));
|
|
var _inherits = _interopDefault(__webpack_require__(228));
|
|
var restructure_src_utils = __webpack_require__(107);
|
|
var _Object$defineProperties = _interopDefault(__webpack_require__(236));
|
|
var isEqual = _interopDefault(__webpack_require__(239));
|
|
var _get = _interopDefault(__webpack_require__(242));
|
|
var _Object$assign = _interopDefault(__webpack_require__(243));
|
|
var _toConsumableArray = _interopDefault(__webpack_require__(247));
|
|
var _String$fromCodePoint = _interopDefault(__webpack_require__(253));
|
|
var _slicedToArray = _interopDefault(__webpack_require__(256));
|
|
var _Array$from = _interopDefault(__webpack_require__(248));
|
|
var _Set = _interopDefault(__webpack_require__(260));
|
|
var unicode = _interopDefault(__webpack_require__(264));
|
|
var UnicodeTrie = _interopDefault(__webpack_require__(15));
|
|
var StateMachine = _interopDefault(__webpack_require__(266));
|
|
var cloneDeep = _interopDefault(__webpack_require__(271));
|
|
var inflate = _interopDefault(__webpack_require__(16));
|
|
var brotli = _interopDefault(__webpack_require__(272));
|
|
|
|
|
|
|
|
var fontkit = {};
|
|
fontkit.logErrors = false;
|
|
|
|
var formats = [];
|
|
fontkit.registerFormat = function (format) {
|
|
formats.push(format);
|
|
};
|
|
|
|
fontkit.openSync = function (filename, postscriptName) {
|
|
var buffer = __webpack_require__(53).readFileSync(filename);
|
|
return fontkit.create(buffer, postscriptName);
|
|
};
|
|
|
|
fontkit.open = function (filename, postscriptName, callback) {
|
|
if (typeof postscriptName === 'function') {
|
|
callback = postscriptName;
|
|
postscriptName = null;
|
|
}
|
|
|
|
__webpack_require__(53).readFile(filename, function (err, buffer) {
|
|
if (err) {
|
|
return callback(err);
|
|
}
|
|
|
|
try {
|
|
var font = fontkit.create(buffer, postscriptName);
|
|
} catch (e) {
|
|
return callback(e);
|
|
}
|
|
|
|
return callback(null, font);
|
|
});
|
|
|
|
return;
|
|
};
|
|
|
|
fontkit.create = function (buffer, postscriptName) {
|
|
for (var i = 0; i < formats.length; i++) {
|
|
var format = formats[i];
|
|
if (format.probe(buffer)) {
|
|
var font = new format(new r.DecodeStream(buffer));
|
|
if (postscriptName) {
|
|
return font.getFont(postscriptName);
|
|
}
|
|
|
|
return font;
|
|
}
|
|
}
|
|
|
|
throw new Error('Unknown font format');
|
|
};
|
|
|
|
/**
|
|
* This decorator caches the results of a getter or method such that
|
|
* the results are lazily computed once, and then cached.
|
|
* @private
|
|
*/
|
|
function cache(target, key, descriptor) {
|
|
if (descriptor.get) {
|
|
(function () {
|
|
var get = descriptor.get;
|
|
descriptor.get = function () {
|
|
var value = get.call(this);
|
|
_Object$defineProperty(this, key, { value: value });
|
|
return value;
|
|
};
|
|
})();
|
|
} else if (typeof descriptor.value === 'function') {
|
|
var _ret2 = function () {
|
|
var fn = descriptor.value;
|
|
|
|
return {
|
|
v: {
|
|
get: function get() {
|
|
var cache = new _Map();
|
|
function memoized() {
|
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
var key = args.length > 0 ? args[0] : 'value';
|
|
if (cache.has(key)) {
|
|
return cache.get(key);
|
|
}
|
|
|
|
var result = fn.apply(this, args);
|
|
cache.set(key, result);
|
|
return result;
|
|
};
|
|
|
|
_Object$defineProperty(this, key, { value: memoized });
|
|
return memoized;
|
|
}
|
|
}
|
|
};
|
|
}();
|
|
|
|
if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v;
|
|
}
|
|
}
|
|
|
|
var SubHeader = new r.Struct({
|
|
firstCode: r.uint16,
|
|
entryCount: r.uint16,
|
|
idDelta: r.int16,
|
|
idRangeOffset: r.uint16
|
|
});
|
|
|
|
var CmapGroup = new r.Struct({
|
|
startCharCode: r.uint32,
|
|
endCharCode: r.uint32,
|
|
glyphID: r.uint32
|
|
});
|
|
|
|
var UnicodeValueRange = new r.Struct({
|
|
startUnicodeValue: r.uint24,
|
|
additionalCount: r.uint8
|
|
});
|
|
|
|
var UVSMapping = new r.Struct({
|
|
unicodeValue: r.uint24,
|
|
glyphID: r.uint16
|
|
});
|
|
|
|
var DefaultUVS = new r.Array(UnicodeValueRange, r.uint32);
|
|
var NonDefaultUVS = new r.Array(UVSMapping, r.uint32);
|
|
|
|
var VarSelectorRecord = new r.Struct({
|
|
varSelector: r.uint24,
|
|
defaultUVS: new r.Pointer(r.uint32, DefaultUVS, { type: 'parent' }),
|
|
nonDefaultUVS: new r.Pointer(r.uint32, NonDefaultUVS, { type: 'parent' })
|
|
});
|
|
|
|
var CmapSubtable = new r.VersionedStruct(r.uint16, {
|
|
0: { // Byte encoding
|
|
length: r.uint16, // Total table length in bytes (set to 262 for format 0)
|
|
language: r.uint16, // Language code for this encoding subtable, or zero if language-independent
|
|
codeMap: new r.LazyArray(r.uint8, 256)
|
|
},
|
|
|
|
2: { // High-byte mapping (CJK)
|
|
length: r.uint16,
|
|
language: r.uint16,
|
|
subHeaderKeys: new r.Array(r.uint16, 256),
|
|
subHeaderCount: function subHeaderCount(t) {
|
|
return Math.max.apply(Math, t.subHeaderKeys);
|
|
},
|
|
subHeaders: new r.LazyArray(SubHeader, 'subHeaderCount'),
|
|
glyphIndexArray: new r.LazyArray(r.uint16, 'subHeaderCount')
|
|
},
|
|
|
|
4: { // Segment mapping to delta values
|
|
length: r.uint16, // Total table length in bytes
|
|
language: r.uint16, // Language code
|
|
segCountX2: r.uint16,
|
|
segCount: function segCount(t) {
|
|
return t.segCountX2 >> 1;
|
|
},
|
|
searchRange: r.uint16,
|
|
entrySelector: r.uint16,
|
|
rangeShift: r.uint16,
|
|
endCode: new r.LazyArray(r.uint16, 'segCount'),
|
|
reservedPad: new r.Reserved(r.uint16), // This value should be zero
|
|
startCode: new r.LazyArray(r.uint16, 'segCount'),
|
|
idDelta: new r.LazyArray(r.int16, 'segCount'),
|
|
idRangeOffset: new r.LazyArray(r.uint16, 'segCount'),
|
|
glyphIndexArray: new r.LazyArray(r.uint16, function (t) {
|
|
return (t.length - t._currentOffset) / 2;
|
|
})
|
|
},
|
|
|
|
6: { // Trimmed table
|
|
length: r.uint16,
|
|
language: r.uint16,
|
|
firstCode: r.uint16,
|
|
entryCount: r.uint16,
|
|
glyphIndices: new r.LazyArray(r.uint16, 'entryCount')
|
|
},
|
|
|
|
8: { // mixed 16-bit and 32-bit coverage
|
|
reserved: new r.Reserved(r.uint16),
|
|
length: r.uint32,
|
|
language: r.uint16,
|
|
is32: new r.LazyArray(r.uint8, 8192),
|
|
nGroups: r.uint32,
|
|
groups: new r.LazyArray(CmapGroup, 'nGroups')
|
|
},
|
|
|
|
10: { // Trimmed Array
|
|
reserved: new r.Reserved(r.uint16),
|
|
length: r.uint32,
|
|
language: r.uint32,
|
|
firstCode: r.uint32,
|
|
entryCount: r.uint32,
|
|
glyphIndices: new r.LazyArray(r.uint16, 'numChars')
|
|
},
|
|
|
|
12: { // Segmented coverage
|
|
reserved: new r.Reserved(r.uint16),
|
|
length: r.uint32,
|
|
language: r.uint32,
|
|
nGroups: r.uint32,
|
|
groups: new r.LazyArray(CmapGroup, 'nGroups')
|
|
},
|
|
|
|
13: { // Many-to-one range mappings (same as 12 except for group.startGlyphID)
|
|
reserved: new r.Reserved(r.uint16),
|
|
length: r.uint32,
|
|
language: r.uint32,
|
|
nGroups: r.uint32,
|
|
groups: new r.LazyArray(CmapGroup, 'nGroups')
|
|
},
|
|
|
|
14: { // Unicode Variation Sequences
|
|
length: r.uint32,
|
|
numRecords: r.uint32,
|
|
varSelectors: new r.LazyArray(VarSelectorRecord, 'numRecords')
|
|
}
|
|
});
|
|
|
|
var CmapEntry = new r.Struct({
|
|
platformID: r.uint16, // Platform identifier
|
|
encodingID: r.uint16, // Platform-specific encoding identifier
|
|
table: new r.Pointer(r.uint32, CmapSubtable, { type: 'parent', lazy: true })
|
|
});
|
|
|
|
// character to glyph mapping
|
|
var cmap = new r.Struct({
|
|
version: r.uint16,
|
|
numSubtables: r.uint16,
|
|
tables: new r.Array(CmapEntry, 'numSubtables')
|
|
});
|
|
|
|
// font header
|
|
var head = new r.Struct({
|
|
version: r.int32, // 0x00010000 (version 1.0)
|
|
revision: r.int32, // set by font manufacturer
|
|
checkSumAdjustment: r.uint32,
|
|
magicNumber: r.uint32, // set to 0x5F0F3CF5
|
|
flags: r.uint16,
|
|
unitsPerEm: r.uint16, // range from 64 to 16384
|
|
created: new r.Array(r.int32, 2),
|
|
modified: new r.Array(r.int32, 2),
|
|
xMin: r.int16, // for all glyph bounding boxes
|
|
yMin: r.int16, // for all glyph bounding boxes
|
|
xMax: r.int16, // for all glyph bounding boxes
|
|
yMax: r.int16, // for all glyph bounding boxes
|
|
macStyle: new r.Bitfield(r.uint16, ['bold', 'italic', 'underline', 'outline', 'shadow', 'condensed', 'extended']),
|
|
lowestRecPPEM: r.uint16, // smallest readable size in pixels
|
|
fontDirectionHint: r.int16,
|
|
indexToLocFormat: r.int16, // 0 for short offsets, 1 for long
|
|
glyphDataFormat: r.int16 // 0 for current format
|
|
});
|
|
|
|
// horizontal header
|
|
var hhea = new r.Struct({
|
|
version: r.int32,
|
|
ascent: r.int16, // Distance from baseline of highest ascender
|
|
descent: r.int16, // Distance from baseline of lowest descender
|
|
lineGap: r.int16, // Typographic line gap
|
|
advanceWidthMax: r.uint16, // Maximum advance width value in 'hmtx' table
|
|
minLeftSideBearing: r.int16, // Maximum advance width value in 'hmtx' table
|
|
minRightSideBearing: r.int16, // Minimum right sidebearing value
|
|
xMaxExtent: r.int16,
|
|
caretSlopeRise: r.int16, // Used to calculate the slope of the cursor (rise/run); 1 for vertical
|
|
caretSlopeRun: r.int16, // 0 for vertical
|
|
caretOffset: r.int16, // Set to 0 for non-slanted fonts
|
|
reserved: new r.Reserved(r.int16, 4),
|
|
metricDataFormat: r.int16, // 0 for current format
|
|
numberOfMetrics: r.uint16 // Number of advance widths in 'hmtx' table
|
|
});
|
|
|
|
var HmtxEntry = new r.Struct({
|
|
advance: r.uint16,
|
|
bearing: r.int16
|
|
});
|
|
|
|
var hmtx = new r.Struct({
|
|
metrics: new r.LazyArray(HmtxEntry, function (t) {
|
|
return t.parent.hhea.numberOfMetrics;
|
|
}),
|
|
bearings: new r.LazyArray(r.int16, function (t) {
|
|
return t.parent.maxp.numGlyphs - t.parent.hhea.numberOfMetrics;
|
|
})
|
|
});
|
|
|
|
// maxiumum profile
|
|
var maxp = new r.Struct({
|
|
version: r.int32,
|
|
numGlyphs: r.uint16, // The number of glyphs in the font
|
|
maxPoints: r.uint16, // Maximum points in a non-composite glyph
|
|
maxContours: r.uint16, // Maximum contours in a non-composite glyph
|
|
maxComponentPoints: r.uint16, // Maximum points in a composite glyph
|
|
maxComponentContours: r.uint16, // Maximum contours in a composite glyph
|
|
maxZones: r.uint16, // 1 if instructions do not use the twilight zone, 2 otherwise
|
|
maxTwilightPoints: r.uint16, // Maximum points used in Z0
|
|
maxStorage: r.uint16, // Number of Storage Area locations
|
|
maxFunctionDefs: r.uint16, // Number of FDEFs
|
|
maxInstructionDefs: r.uint16, // Number of IDEFs
|
|
maxStackElements: r.uint16, // Maximum stack depth
|
|
maxSizeOfInstructions: r.uint16, // Maximum byte count for glyph instructions
|
|
maxComponentElements: r.uint16, // Maximum number of components referenced at “top level” for any composite glyph
|
|
maxComponentDepth: r.uint16 // Maximum levels of recursion; 1 for simple components
|
|
});
|
|
|
|
/**
|
|
* Gets an encoding name from platform, encoding, and language ids.
|
|
* Returned encoding names can be used in iconv-lite to decode text.
|
|
*/
|
|
function getEncoding(platformID, encodingID) {
|
|
var languageID = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
|
|
if (platformID === 1 && MAC_LANGUAGE_ENCODINGS[languageID]) {
|
|
return MAC_LANGUAGE_ENCODINGS[languageID];
|
|
}
|
|
|
|
return ENCODINGS[platformID][encodingID];
|
|
}
|
|
|
|
// Map of platform ids to encoding ids.
|
|
var ENCODINGS = [
|
|
// unicode
|
|
['utf16be', 'utf16be', 'utf16be', 'utf16be', 'utf16be', 'utf16be'],
|
|
|
|
// macintosh
|
|
// Mappings available at http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/
|
|
// 0 Roman 17 Malayalam
|
|
// 1 Japanese 18 Sinhalese
|
|
// 2 Traditional Chinese 19 Burmese
|
|
// 3 Korean 20 Khmer
|
|
// 4 Arabic 21 Thai
|
|
// 5 Hebrew 22 Laotian
|
|
// 6 Greek 23 Georgian
|
|
// 7 Russian 24 Armenian
|
|
// 8 RSymbol 25 Simplified Chinese
|
|
// 9 Devanagari 26 Tibetan
|
|
// 10 Gurmukhi 27 Mongolian
|
|
// 11 Gujarati 28 Geez
|
|
// 12 Oriya 29 Slavic
|
|
// 13 Bengali 30 Vietnamese
|
|
// 14 Tamil 31 Sindhi
|
|
// 15 Telugu 32 (Uninterpreted)
|
|
// 16 Kannada
|
|
['macroman', 'shift-jis', 'big5', 'euc-kr', 'iso-8859-6', 'iso-8859-8', 'macgreek', 'maccyrillic', 'symbol', 'Devanagari', 'Gurmukhi', 'Gujarati', 'Oriya', 'Bengali', 'Tamil', 'Telugu', 'Kannada', 'Malayalam', 'Sinhalese', 'Burmese', 'Khmer', 'macthai', 'Laotian', 'Georgian', 'Armenian', 'gb-2312-80', 'Tibetan', 'Mongolian', 'Geez', 'maccenteuro', 'Vietnamese', 'Sindhi'],
|
|
|
|
// ISO (deprecated)
|
|
['ascii'],
|
|
|
|
// windows
|
|
// Docs here: http://msdn.microsoft.com/en-us/library/system.text.encoding(v=vs.110).aspx
|
|
['symbol', 'utf16be', 'shift-jis', 'gb18030', 'big5', 'wansung', 'johab', null, null, null, 'utf16be']];
|
|
|
|
// Overrides for Mac scripts by language id.
|
|
// See http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt
|
|
var MAC_LANGUAGE_ENCODINGS = {
|
|
15: 'maciceland',
|
|
17: 'macturkish',
|
|
18: 'maccroatian',
|
|
24: 'maccenteuro',
|
|
25: 'maccenteuro',
|
|
26: 'maccenteuro',
|
|
27: 'maccenteuro',
|
|
28: 'maccenteuro',
|
|
30: 'maciceland',
|
|
37: 'macromania',
|
|
38: 'maccenteuro',
|
|
39: 'maccenteuro',
|
|
40: 'maccenteuro',
|
|
143: 'macinuit', // Unsupported by iconv-lite
|
|
146: 'macgaelic' // Unsupported by iconv-lite
|
|
};
|
|
|
|
// Map of platform ids to BCP-47 language codes.
|
|
var LANGUAGES = [
|
|
// unicode
|
|
[], { // macintosh
|
|
0: 'en', 30: 'fo', 60: 'ks', 90: 'rw',
|
|
1: 'fr', 31: 'fa', 61: 'ku', 91: 'rn',
|
|
2: 'de', 32: 'ru', 62: 'sd', 92: 'ny',
|
|
3: 'it', 33: 'zh', 63: 'bo', 93: 'mg',
|
|
4: 'nl', 34: 'nl-BE', 64: 'ne', 94: 'eo',
|
|
5: 'sv', 35: 'ga', 65: 'sa', 128: 'cy',
|
|
6: 'es', 36: 'sq', 66: 'mr', 129: 'eu',
|
|
7: 'da', 37: 'ro', 67: 'bn', 130: 'ca',
|
|
8: 'pt', 38: 'cz', 68: 'as', 131: 'la',
|
|
9: 'no', 39: 'sk', 69: 'gu', 132: 'qu',
|
|
10: 'he', 40: 'si', 70: 'pa', 133: 'gn',
|
|
11: 'ja', 41: 'yi', 71: 'or', 134: 'ay',
|
|
12: 'ar', 42: 'sr', 72: 'ml', 135: 'tt',
|
|
13: 'fi', 43: 'mk', 73: 'kn', 136: 'ug',
|
|
14: 'el', 44: 'bg', 74: 'ta', 137: 'dz',
|
|
15: 'is', 45: 'uk', 75: 'te', 138: 'jv',
|
|
16: 'mt', 46: 'be', 76: 'si', 139: 'su',
|
|
17: 'tr', 47: 'uz', 77: 'my', 140: 'gl',
|
|
18: 'hr', 48: 'kk', 78: 'km', 141: 'af',
|
|
19: 'zh-Hant', 49: 'az-Cyrl', 79: 'lo', 142: 'br',
|
|
20: 'ur', 50: 'az-Arab', 80: 'vi', 143: 'iu',
|
|
21: 'hi', 51: 'hy', 81: 'id', 144: 'gd',
|
|
22: 'th', 52: 'ka', 82: 'tl', 145: 'gv',
|
|
23: 'ko', 53: 'mo', 83: 'ms', 146: 'ga',
|
|
24: 'lt', 54: 'ky', 84: 'ms-Arab', 147: 'to',
|
|
25: 'pl', 55: 'tg', 85: 'am', 148: 'el-polyton',
|
|
26: 'hu', 56: 'tk', 86: 'ti', 149: 'kl',
|
|
27: 'es', 57: 'mn-CN', 87: 'om', 150: 'az',
|
|
28: 'lv', 58: 'mn', 88: 'so', 151: 'nn',
|
|
29: 'se', 59: 'ps', 89: 'sw'
|
|
},
|
|
|
|
// ISO (deprecated)
|
|
[], { // windows
|
|
0x0436: 'af', 0x4009: 'en-IN', 0x0487: 'rw', 0x0432: 'tn',
|
|
0x041C: 'sq', 0x1809: 'en-IE', 0x0441: 'sw', 0x045B: 'si',
|
|
0x0484: 'gsw', 0x2009: 'en-JM', 0x0457: 'kok', 0x041B: 'sk',
|
|
0x045E: 'am', 0x4409: 'en-MY', 0x0412: 'ko', 0x0424: 'sl',
|
|
0x1401: 'ar-DZ', 0x1409: 'en-NZ', 0x0440: 'ky', 0x2C0A: 'es-AR',
|
|
0x3C01: 'ar-BH', 0x3409: 'en-PH', 0x0454: 'lo', 0x400A: 'es-BO',
|
|
0x0C01: 'ar', 0x4809: 'en-SG', 0x0426: 'lv', 0x340A: 'es-CL',
|
|
0x0801: 'ar-IQ', 0x1C09: 'en-ZA', 0x0427: 'lt', 0x240A: 'es-CO',
|
|
0x2C01: 'ar-JO', 0x2C09: 'en-TT', 0x082E: 'dsb', 0x140A: 'es-CR',
|
|
0x3401: 'ar-KW', 0x0809: 'en-GB', 0x046E: 'lb', 0x1C0A: 'es-DO',
|
|
0x3001: 'ar-LB', 0x0409: 'en', 0x042F: 'mk', 0x300A: 'es-EC',
|
|
0x1001: 'ar-LY', 0x3009: 'en-ZW', 0x083E: 'ms-BN', 0x440A: 'es-SV',
|
|
0x1801: 'ary', 0x0425: 'et', 0x043E: 'ms', 0x100A: 'es-GT',
|
|
0x2001: 'ar-OM', 0x0438: 'fo', 0x044C: 'ml', 0x480A: 'es-HN',
|
|
0x4001: 'ar-QA', 0x0464: 'fil', 0x043A: 'mt', 0x080A: 'es-MX',
|
|
0x0401: 'ar-SA', 0x040B: 'fi', 0x0481: 'mi', 0x4C0A: 'es-NI',
|
|
0x2801: 'ar-SY', 0x080C: 'fr-BE', 0x047A: 'arn', 0x180A: 'es-PA',
|
|
0x1C01: 'aeb', 0x0C0C: 'fr-CA', 0x044E: 'mr', 0x3C0A: 'es-PY',
|
|
0x3801: 'ar-AE', 0x040C: 'fr', 0x047C: 'moh', 0x280A: 'es-PE',
|
|
0x2401: 'ar-YE', 0x140C: 'fr-LU', 0x0450: 'mn', 0x500A: 'es-PR',
|
|
0x042B: 'hy', 0x180C: 'fr-MC', 0x0850: 'mn-CN', 0x0C0A: 'es',
|
|
0x044D: 'as', 0x100C: 'fr-CH', 0x0461: 'ne', 0x040A: 'es',
|
|
0x082C: 'az-Cyrl', 0x0462: 'fy', 0x0414: 'nb', 0x540A: 'es-US',
|
|
0x042C: 'az', 0x0456: 'gl', 0x0814: 'nn', 0x380A: 'es-UY',
|
|
0x046D: 'ba', 0x0437: 'ka', 0x0482: 'oc', 0x200A: 'es-VE',
|
|
0x042D: 'eu', 0x0C07: 'de-AT', 0x0448: 'or', 0x081D: 'sv-FI',
|
|
0x0423: 'be', 0x0407: 'de', 0x0463: 'ps', 0x041D: 'sv',
|
|
0x0845: 'bn', 0x1407: 'de-LI', 0x0415: 'pl', 0x045A: 'syr',
|
|
0x0445: 'bn-IN', 0x1007: 'de-LU', 0x0416: 'pt', 0x0428: 'tg',
|
|
0x201A: 'bs-Cyrl', 0x0807: 'de-CH', 0x0816: 'pt-PT', 0x085F: 'tzm',
|
|
0x141A: 'bs', 0x0408: 'el', 0x0446: 'pa', 0x0449: 'ta',
|
|
0x047E: 'br', 0x046F: 'kl', 0x046B: 'qu-BO', 0x0444: 'tt',
|
|
0x0402: 'bg', 0x0447: 'gu', 0x086B: 'qu-EC', 0x044A: 'te',
|
|
0x0403: 'ca', 0x0468: 'ha', 0x0C6B: 'qu', 0x041E: 'th',
|
|
0x0C04: 'zh-HK', 0x040D: 'he', 0x0418: 'ro', 0x0451: 'bo',
|
|
0x1404: 'zh-MO', 0x0439: 'hi', 0x0417: 'rm', 0x041F: 'tr',
|
|
0x0804: 'zh', 0x040E: 'hu', 0x0419: 'ru', 0x0442: 'tk',
|
|
0x1004: 'zh-SG', 0x040F: 'is', 0x243B: 'smn', 0x0480: 'ug',
|
|
0x0404: 'zh-TW', 0x0470: 'ig', 0x103B: 'smj-NO', 0x0422: 'uk',
|
|
0x0483: 'co', 0x0421: 'id', 0x143B: 'smj', 0x042E: 'hsb',
|
|
0x041A: 'hr', 0x045D: 'iu', 0x0C3B: 'se-FI', 0x0420: 'ur',
|
|
0x101A: 'hr-BA', 0x085D: 'iu-Latn', 0x043B: 'se', 0x0843: 'uz-Cyrl',
|
|
0x0405: 'cs', 0x083C: 'ga', 0x083B: 'se-SE', 0x0443: 'uz',
|
|
0x0406: 'da', 0x0434: 'xh', 0x203B: 'sms', 0x042A: 'vi',
|
|
0x048C: 'prs', 0x0435: 'zu', 0x183B: 'sma-NO', 0x0452: 'cy',
|
|
0x0465: 'dv', 0x0410: 'it', 0x1C3B: 'sms', 0x0488: 'wo',
|
|
0x0813: 'nl-BE', 0x0810: 'it-CH', 0x044F: 'sa', 0x0485: 'sah',
|
|
0x0413: 'nl', 0x0411: 'ja', 0x1C1A: 'sr-Cyrl-BA', 0x0478: 'ii',
|
|
0x0C09: 'en-AU', 0x044B: 'kn', 0x0C1A: 'sr', 0x046A: 'yo',
|
|
0x2809: 'en-BZ', 0x043F: 'kk', 0x181A: 'sr-Latn-BA',
|
|
0x1009: 'en-CA', 0x0453: 'km', 0x081A: 'sr-Latn',
|
|
0x2409: 'en-029', 0x0486: 'quc', 0x046C: 'nso'
|
|
}];
|
|
|
|
var NameRecord = new r.Struct({
|
|
platformID: r.uint16,
|
|
encodingID: r.uint16,
|
|
languageID: r.uint16,
|
|
nameID: r.uint16,
|
|
length: r.uint16,
|
|
string: new r.Pointer(r.uint16, new r.String('length', function (t) {
|
|
return getEncoding(t.platformID, t.encodingID, t.languageID);
|
|
}), { type: 'parent', relativeTo: 'parent.stringOffset', allowNull: false })
|
|
});
|
|
|
|
var LangTagRecord = new r.Struct({
|
|
length: r.uint16,
|
|
tag: new r.Pointer(r.uint16, new r.String('length', 'utf16be'), { type: 'parent', relativeTo: 'stringOffset' })
|
|
});
|
|
|
|
var NameTable = new r.VersionedStruct(r.uint16, {
|
|
0: {
|
|
count: r.uint16,
|
|
stringOffset: r.uint16,
|
|
records: new r.Array(NameRecord, 'count')
|
|
},
|
|
1: {
|
|
count: r.uint16,
|
|
stringOffset: r.uint16,
|
|
records: new r.Array(NameRecord, 'count'),
|
|
langTagCount: r.uint16,
|
|
langTags: new r.Array(LangTagRecord, 'langTagCount')
|
|
}
|
|
});
|
|
|
|
var NAMES = ['copyright', 'fontFamily', 'fontSubfamily', 'uniqueSubfamily', 'fullName', 'version', 'postscriptName', // Note: A font may have only one PostScript name and that name must be ASCII.
|
|
'trademark', 'manufacturer', 'designer', 'description', 'vendorURL', 'designerURL', 'license', 'licenseURL', null, // reserved
|
|
'preferredFamily', 'preferredSubfamily', 'compatibleFull', 'sampleText', 'postscriptCIDFontName', 'wwsFamilyName', 'wwsSubfamilyName'];
|
|
|
|
NameTable.process = function (stream) {
|
|
var records = {};
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.records), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var record = _step.value;
|
|
|
|
// find out what language this is for
|
|
var language = LANGUAGES[record.platformID][record.languageID];
|
|
|
|
if (language == null && this.langTags != null && record.languageID >= 0x8000) {
|
|
language = this.langTags[record.languageID - 0x8000].tag;
|
|
}
|
|
|
|
if (language == null) {
|
|
language = record.platformID + '-' + record.languageID;
|
|
}
|
|
|
|
// if the nameID is >= 256, it is a font feature record (AAT)
|
|
var key = record.nameID >= 256 ? 'fontFeatures' : NAMES[record.nameID] || record.nameID;
|
|
if (records[key] == null) {
|
|
records[key] = {};
|
|
}
|
|
|
|
var obj = records[key];
|
|
if (record.nameID >= 256) {
|
|
obj = obj[record.nameID] || (obj[record.nameID] = {});
|
|
}
|
|
|
|
obj[language] = record.string;
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
this.records = records;
|
|
};
|
|
|
|
NameTable.preEncode = function () {
|
|
if (Array.isArray(this.records)) return;
|
|
this.version = 0;
|
|
|
|
var records = [];
|
|
for (var key in this.records) {
|
|
var val = this.records[key];
|
|
if (key === 'fontFeatures') continue;
|
|
|
|
records.push({
|
|
platformID: 3,
|
|
encodingID: 1,
|
|
languageID: 0x409,
|
|
nameID: NAMES.indexOf(key),
|
|
length: Buffer.byteLength(val.en, 'utf16le'),
|
|
string: val.en
|
|
});
|
|
|
|
if (key === 'postscriptName') {
|
|
records.push({
|
|
platformID: 1,
|
|
encodingID: 0,
|
|
languageID: 0,
|
|
nameID: NAMES.indexOf(key),
|
|
length: val.en.length,
|
|
string: val.en
|
|
});
|
|
}
|
|
}
|
|
|
|
this.records = records;
|
|
this.count = records.length;
|
|
this.stringOffset = NameTable.size(this, null, false);
|
|
};
|
|
|
|
var OS2 = new r.VersionedStruct(r.uint16, {
|
|
header: {
|
|
xAvgCharWidth: r.int16, // average weighted advance width of lower case letters and space
|
|
usWeightClass: r.uint16, // visual weight of stroke in glyphs
|
|
usWidthClass: r.uint16, // relative change from the normal aspect ratio (width to height ratio)
|
|
fsType: new r.Bitfield(r.uint16, [// Indicates font embedding licensing rights
|
|
null, 'noEmbedding', 'viewOnly', 'editable', null, null, null, null, 'noSubsetting', 'bitmapOnly']),
|
|
ySubscriptXSize: r.int16, // recommended horizontal size in pixels for subscripts
|
|
ySubscriptYSize: r.int16, // recommended vertical size in pixels for subscripts
|
|
ySubscriptXOffset: r.int16, // recommended horizontal offset for subscripts
|
|
ySubscriptYOffset: r.int16, // recommended vertical offset form the baseline for subscripts
|
|
ySuperscriptXSize: r.int16, // recommended horizontal size in pixels for superscripts
|
|
ySuperscriptYSize: r.int16, // recommended vertical size in pixels for superscripts
|
|
ySuperscriptXOffset: r.int16, // recommended horizontal offset for superscripts
|
|
ySuperscriptYOffset: r.int16, // recommended vertical offset from the baseline for superscripts
|
|
yStrikeoutSize: r.int16, // width of the strikeout stroke
|
|
yStrikeoutPosition: r.int16, // position of the strikeout stroke relative to the baseline
|
|
sFamilyClass: r.int16, // classification of font-family design
|
|
panose: new r.Array(r.uint8, 10), // describe the visual characteristics of a given typeface
|
|
ulCharRange: new r.Array(r.uint32, 4),
|
|
vendorID: new r.String(4), // four character identifier for the font vendor
|
|
fsSelection: new r.Bitfield(r.uint16, [// bit field containing information about the font
|
|
'italic', 'underscore', 'negative', 'outlined', 'strikeout', 'bold', 'regular', 'useTypoMetrics', 'wws', 'oblique']),
|
|
usFirstCharIndex: r.uint16, // The minimum Unicode index in this font
|
|
usLastCharIndex: r.uint16 // The maximum Unicode index in this font
|
|
},
|
|
|
|
// The Apple version of this table ends here, but the Microsoft one continues on...
|
|
0: {},
|
|
|
|
1: {
|
|
typoAscender: r.int16,
|
|
typoDescender: r.int16,
|
|
typoLineGap: r.int16,
|
|
winAscent: r.uint16,
|
|
winDescent: r.uint16,
|
|
codePageRange: new r.Array(r.uint32, 2)
|
|
},
|
|
|
|
2: {
|
|
// these should be common with version 1 somehow
|
|
typoAscender: r.int16,
|
|
typoDescender: r.int16,
|
|
typoLineGap: r.int16,
|
|
winAscent: r.uint16,
|
|
winDescent: r.uint16,
|
|
codePageRange: new r.Array(r.uint32, 2),
|
|
|
|
xHeight: r.int16,
|
|
capHeight: r.int16,
|
|
defaultChar: r.uint16,
|
|
breakChar: r.uint16,
|
|
maxContent: r.uint16
|
|
},
|
|
|
|
5: {
|
|
typoAscender: r.int16,
|
|
typoDescender: r.int16,
|
|
typoLineGap: r.int16,
|
|
winAscent: r.uint16,
|
|
winDescent: r.uint16,
|
|
codePageRange: new r.Array(r.uint32, 2),
|
|
|
|
xHeight: r.int16,
|
|
capHeight: r.int16,
|
|
defaultChar: r.uint16,
|
|
breakChar: r.uint16,
|
|
maxContent: r.uint16,
|
|
|
|
usLowerOpticalPointSize: r.uint16,
|
|
usUpperOpticalPointSize: r.uint16
|
|
}
|
|
});
|
|
|
|
var versions = OS2.versions;
|
|
versions[3] = versions[4] = versions[2];
|
|
|
|
// PostScript information
|
|
var post = new r.VersionedStruct(r.fixed32, {
|
|
header: { // these fields exist at the top of all versions
|
|
italicAngle: r.fixed32, // Italic angle in counter-clockwise degrees from the vertical.
|
|
underlinePosition: r.int16, // Suggested distance of the top of the underline from the baseline
|
|
underlineThickness: r.int16, // Suggested values for the underline thickness
|
|
isFixedPitch: r.uint32, // Whether the font is monospaced
|
|
minMemType42: r.uint32, // Minimum memory usage when a TrueType font is downloaded as a Type 42 font
|
|
maxMemType42: r.uint32, // Maximum memory usage when a TrueType font is downloaded as a Type 42 font
|
|
minMemType1: r.uint32, // Minimum memory usage when a TrueType font is downloaded as a Type 1 font
|
|
maxMemType1: r.uint32 // Maximum memory usage when a TrueType font is downloaded as a Type 1 font
|
|
},
|
|
|
|
1: {}, // version 1 has no additional fields
|
|
|
|
2: {
|
|
numberOfGlyphs: r.uint16,
|
|
glyphNameIndex: new r.Array(r.uint16, 'numberOfGlyphs'),
|
|
names: new r.Array(new r.String(r.uint8))
|
|
},
|
|
|
|
2.5: {
|
|
numberOfGlyphs: r.uint16,
|
|
offsets: new r.Array(r.uint8, 'numberOfGlyphs')
|
|
},
|
|
|
|
3: {}, // version 3 has no additional fields
|
|
|
|
4: {
|
|
map: new r.Array(r.uint32, function (t) {
|
|
return t.parent.maxp.numGlyphs;
|
|
})
|
|
}
|
|
});
|
|
|
|
// An array of predefined values accessible by instructions
|
|
var cvt = new r.Struct({
|
|
controlValues: new r.Array(r.int16)
|
|
});
|
|
|
|
// A list of instructions that are executed once when a font is first used.
|
|
// These instructions are known as the font program. The main use of this table
|
|
// is for the definition of functions that are used in many different glyph programs.
|
|
var fpgm = new r.Struct({
|
|
instructions: new r.Array(r.uint8)
|
|
});
|
|
|
|
var loca = new r.VersionedStruct('head.indexToLocFormat', {
|
|
0: {
|
|
offsets: new r.Array(r.uint16)
|
|
},
|
|
1: {
|
|
offsets: new r.Array(r.uint32)
|
|
}
|
|
});
|
|
|
|
loca.process = function () {
|
|
if (this.version === 0) {
|
|
for (var i = 0; i < this.offsets.length; i++) {
|
|
this.offsets[i] <<= 1;
|
|
}
|
|
}
|
|
};
|
|
|
|
loca.preEncode = function () {
|
|
if (this.version != null) return;
|
|
|
|
// assume this.offsets is a sorted array
|
|
this.version = this.offsets[this.offsets.length - 1] > 0xffff ? 1 : 0;
|
|
|
|
if (this.version === 0) {
|
|
for (var i = 0; i < this.offsets.length; i++) {
|
|
this.offsets[i] >>>= 1;
|
|
}
|
|
}
|
|
};
|
|
|
|
// Set of instructions executed whenever the point size or font transformation change
|
|
var prep = new r.Struct({
|
|
controlValueProgram: new r.Array(r.uint8)
|
|
});
|
|
|
|
// only used for encoding
|
|
var glyf = new r.Array(new r.Buffer());
|
|
|
|
var CFFIndex = function () {
|
|
function CFFIndex(type) {
|
|
_classCallCheck(this, CFFIndex);
|
|
|
|
this.type = type;
|
|
}
|
|
|
|
_createClass(CFFIndex, [{
|
|
key: "decode",
|
|
value: function decode(stream, parent) {
|
|
var count = stream.readUInt16BE();
|
|
if (count === 0) {
|
|
return [];
|
|
}
|
|
|
|
var offSize = stream.readUInt8();
|
|
var offsetType = void 0;
|
|
if (offSize === 1) {
|
|
offsetType = r.uint8;
|
|
} else if (offSize === 2) {
|
|
offsetType = r.uint16;
|
|
} else if (offSize === 3) {
|
|
offsetType = r.uint24;
|
|
} else if (offSize === 4) {
|
|
offsetType = r.uint32;
|
|
} else {
|
|
throw new Error("Bad offset size in CFFIndex: " + offSize + " " + stream.pos);
|
|
}
|
|
|
|
var ret = [];
|
|
var startPos = stream.pos + (count + 1) * offSize - 1;
|
|
|
|
var start = offsetType.decode(stream);
|
|
for (var i = 0; i < count; i++) {
|
|
var end = offsetType.decode(stream);
|
|
|
|
if (this.type != null) {
|
|
var pos = stream.pos;
|
|
stream.pos = startPos + start;
|
|
|
|
parent.length = end - start;
|
|
ret.push(this.type.decode(stream, parent));
|
|
stream.pos = pos;
|
|
} else {
|
|
ret.push({
|
|
offset: startPos + start,
|
|
length: end - start
|
|
});
|
|
}
|
|
|
|
start = end;
|
|
}
|
|
|
|
stream.pos = startPos + start;
|
|
return ret;
|
|
}
|
|
}, {
|
|
key: "size",
|
|
value: function size(arr, parent) {
|
|
var size = 2;
|
|
if (arr.length === 0) {
|
|
return size;
|
|
}
|
|
|
|
var type = this.type || new r.Buffer();
|
|
|
|
// find maximum offset to detminine offset type
|
|
var offset = 1;
|
|
for (var i = 0; i < arr.length; i++) {
|
|
var item = arr[i];
|
|
offset += type.size(item, parent);
|
|
}
|
|
|
|
var offsetType = void 0;
|
|
if (offset <= 0xff) {
|
|
offsetType = r.uint8;
|
|
} else if (offset <= 0xffff) {
|
|
offsetType = r.uint16;
|
|
} else if (offset <= 0xffffff) {
|
|
offsetType = r.uint24;
|
|
} else if (offset <= 0xffffffff) {
|
|
offsetType = r.uint32;
|
|
} else {
|
|
throw new Error("Bad offset in CFFIndex");
|
|
}
|
|
|
|
size += 1 + offsetType.size() * (arr.length + 1);
|
|
size += offset - 1;
|
|
|
|
return size;
|
|
}
|
|
}, {
|
|
key: "encode",
|
|
value: function encode(stream, arr, parent) {
|
|
stream.writeUInt16BE(arr.length);
|
|
if (arr.length === 0) {
|
|
return;
|
|
}
|
|
|
|
var type = this.type || new r.Buffer();
|
|
|
|
// find maximum offset to detminine offset type
|
|
var sizes = [];
|
|
var offset = 1;
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(arr), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var item = _step.value;
|
|
|
|
var s = type.size(item, parent);
|
|
sizes.push(s);
|
|
offset += s;
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
var offsetType = void 0;
|
|
if (offset <= 0xff) {
|
|
offsetType = r.uint8;
|
|
} else if (offset <= 0xffff) {
|
|
offsetType = r.uint16;
|
|
} else if (offset <= 0xffffff) {
|
|
offsetType = r.uint24;
|
|
} else if (offset <= 0xffffffff) {
|
|
offsetType = r.uint32;
|
|
} else {
|
|
throw new Error("Bad offset in CFFIndex");
|
|
}
|
|
|
|
// write offset size
|
|
stream.writeUInt8(offsetType.size());
|
|
|
|
// write elements
|
|
offset = 1;
|
|
offsetType.encode(stream, offset);
|
|
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(sizes), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var size = _step2.value;
|
|
|
|
offset += size;
|
|
offsetType.encode(stream, offset);
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
var _iteratorNormalCompletion3 = true;
|
|
var _didIteratorError3 = false;
|
|
var _iteratorError3 = undefined;
|
|
|
|
try {
|
|
for (var _iterator3 = _getIterator(arr), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
var _item = _step3.value;
|
|
|
|
type.encode(stream, _item, parent);
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError3 = true;
|
|
_iteratorError3 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
_iterator3.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError3) {
|
|
throw _iteratorError3;
|
|
}
|
|
}
|
|
}
|
|
|
|
return;
|
|
}
|
|
}]);
|
|
|
|
return CFFIndex;
|
|
}();
|
|
|
|
var FLOAT_EOF = 0xf;
|
|
var FLOAT_LOOKUP = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'E', 'E-', null, '-'];
|
|
|
|
var FLOAT_ENCODE_LOOKUP = {
|
|
'.': 10,
|
|
'E': 11,
|
|
'E-': 12,
|
|
'-': 14
|
|
};
|
|
|
|
var CFFOperand = function () {
|
|
function CFFOperand() {
|
|
_classCallCheck(this, CFFOperand);
|
|
}
|
|
|
|
_createClass(CFFOperand, null, [{
|
|
key: 'decode',
|
|
value: function decode(stream, value) {
|
|
if (32 <= value && value <= 246) {
|
|
return value - 139;
|
|
}
|
|
|
|
if (247 <= value && value <= 250) {
|
|
return (value - 247) * 256 + stream.readUInt8() + 108;
|
|
}
|
|
|
|
if (251 <= value && value <= 254) {
|
|
return -(value - 251) * 256 - stream.readUInt8() - 108;
|
|
}
|
|
|
|
if (value === 28) {
|
|
return stream.readInt16BE();
|
|
}
|
|
|
|
if (value === 29) {
|
|
return stream.readInt32BE();
|
|
}
|
|
|
|
if (value === 30) {
|
|
var str = '';
|
|
while (true) {
|
|
var b = stream.readUInt8();
|
|
|
|
var n1 = b >> 4;
|
|
if (n1 === FLOAT_EOF) {
|
|
break;
|
|
}
|
|
str += FLOAT_LOOKUP[n1];
|
|
|
|
var n2 = b & 15;
|
|
if (n2 === FLOAT_EOF) {
|
|
break;
|
|
}
|
|
str += FLOAT_LOOKUP[n2];
|
|
}
|
|
|
|
return parseFloat(str);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}, {
|
|
key: 'size',
|
|
value: function size(value) {
|
|
// if the value needs to be forced to the largest size (32 bit)
|
|
// e.g. for unknown pointers, set to 32768
|
|
if (value.forceLarge) {
|
|
value = 32768;
|
|
}
|
|
|
|
if ((value | 0) !== value) {
|
|
// floating point
|
|
var str = '' + value;
|
|
return 1 + Math.ceil((str.length + 1) / 2);
|
|
} else if (-107 <= value && value <= 107) {
|
|
return 1;
|
|
} else if (108 <= value && value <= 1131 || -1131 <= value && value <= -108) {
|
|
return 2;
|
|
} else if (-32768 <= value && value <= 32767) {
|
|
return 3;
|
|
} else {
|
|
return 5;
|
|
}
|
|
}
|
|
}, {
|
|
key: 'encode',
|
|
value: function encode(stream, value) {
|
|
// if the value needs to be forced to the largest size (32 bit)
|
|
// e.g. for unknown pointers, save the old value and set to 32768
|
|
var val = Number(value);
|
|
|
|
if (value.forceLarge) {
|
|
stream.writeUInt8(29);
|
|
return stream.writeInt32BE(val);
|
|
} else if ((val | 0) !== val) {
|
|
// floating point
|
|
stream.writeUInt8(30);
|
|
|
|
var str = '' + val;
|
|
for (var i = 0; i < str.length; i += 2) {
|
|
var c1 = str[i];
|
|
var n1 = FLOAT_ENCODE_LOOKUP[c1] || +c1;
|
|
|
|
if (i === str.length - 1) {
|
|
var n2 = FLOAT_EOF;
|
|
} else {
|
|
var c2 = str[i + 1];
|
|
var n2 = FLOAT_ENCODE_LOOKUP[c2] || +c2;
|
|
}
|
|
|
|
stream.writeUInt8(n1 << 4 | n2 & 15);
|
|
}
|
|
|
|
if (n2 !== FLOAT_EOF) {
|
|
return stream.writeUInt8(FLOAT_EOF << 4);
|
|
}
|
|
} else if (-107 <= val && val <= 107) {
|
|
return stream.writeUInt8(val + 139);
|
|
} else if (108 <= val && val <= 1131) {
|
|
val -= 108;
|
|
stream.writeUInt8((val >> 8) + 247);
|
|
return stream.writeUInt8(val & 0xff);
|
|
} else if (-1131 <= val && val <= -108) {
|
|
val = -val - 108;
|
|
stream.writeUInt8((val >> 8) + 251);
|
|
return stream.writeUInt8(val & 0xff);
|
|
} else if (-32768 <= val && val <= 32767) {
|
|
stream.writeUInt8(28);
|
|
return stream.writeInt16BE(val);
|
|
} else {
|
|
stream.writeUInt8(29);
|
|
return stream.writeInt32BE(val);
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return CFFOperand;
|
|
}();
|
|
|
|
var CFFDict = function () {
|
|
function CFFDict() {
|
|
var ops = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
|
|
_classCallCheck(this, CFFDict);
|
|
|
|
this.ops = ops;
|
|
this.fields = {};
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(ops), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var field = _step.value;
|
|
|
|
var key = Array.isArray(field[0]) ? field[0][0] << 8 | field[0][1] : field[0];
|
|
this.fields[key] = field;
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
_createClass(CFFDict, [{
|
|
key: 'decodeOperands',
|
|
value: function decodeOperands(type, stream, ret, operands) {
|
|
var _this = this;
|
|
|
|
if (Array.isArray(type)) {
|
|
return operands.map(function (op, i) {
|
|
return _this.decodeOperands(type[i], stream, ret, [op]);
|
|
});
|
|
} else if (type.decode != null) {
|
|
return type.decode(stream, ret, operands);
|
|
} else {
|
|
switch (type) {
|
|
case 'number':
|
|
case 'offset':
|
|
case 'sid':
|
|
return operands[0];
|
|
case 'boolean':
|
|
return !!operands[0];
|
|
default:
|
|
return operands;
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: 'encodeOperands',
|
|
value: function encodeOperands(type, stream, ctx, operands) {
|
|
var _this2 = this;
|
|
|
|
if (Array.isArray(type)) {
|
|
return operands.map(function (op, i) {
|
|
return _this2.encodeOperands(type[i], stream, ctx, op)[0];
|
|
});
|
|
} else if (type.encode != null) {
|
|
return type.encode(stream, operands, ctx);
|
|
} else if (typeof operands === 'number') {
|
|
return [operands];
|
|
} else if (typeof operands === 'boolean') {
|
|
return [+operands];
|
|
} else if (Array.isArray(operands)) {
|
|
return operands;
|
|
} else {
|
|
return [operands];
|
|
}
|
|
}
|
|
}, {
|
|
key: 'decode',
|
|
value: function decode(stream, parent) {
|
|
var end = stream.pos + parent.length;
|
|
var ret = {};
|
|
var operands = [];
|
|
|
|
// define hidden properties
|
|
_Object$defineProperties(ret, {
|
|
parent: { value: parent },
|
|
_startOffset: { value: stream.pos }
|
|
});
|
|
|
|
// fill in defaults
|
|
for (var key in this.fields) {
|
|
var field = this.fields[key];
|
|
ret[field[1]] = field[3];
|
|
}
|
|
|
|
while (stream.pos < end) {
|
|
var b = stream.readUInt8();
|
|
if (b <= 21) {
|
|
if (b === 12) {
|
|
b = b << 8 | stream.readUInt8();
|
|
}
|
|
|
|
var _field = this.fields[b];
|
|
if (!_field) {
|
|
throw new Error('Unknown operator ' + b);
|
|
}
|
|
|
|
var val = this.decodeOperands(_field[2], stream, ret, operands);
|
|
if (val != null) {
|
|
if (val instanceof restructure_src_utils.PropertyDescriptor) {
|
|
_Object$defineProperty(ret, _field[1], val);
|
|
} else {
|
|
ret[_field[1]] = val;
|
|
}
|
|
}
|
|
|
|
operands = [];
|
|
} else {
|
|
operands.push(CFFOperand.decode(stream, b));
|
|
}
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
}, {
|
|
key: 'size',
|
|
value: function size(dict, parent) {
|
|
var includePointers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
|
|
var ctx = {
|
|
parent: parent,
|
|
val: dict,
|
|
pointerSize: 0,
|
|
startOffset: parent.startOffset || 0
|
|
};
|
|
|
|
var len = 0;
|
|
|
|
for (var k in this.fields) {
|
|
var field = this.fields[k];
|
|
var val = dict[field[1]];
|
|
if (val == null || isEqual(val, field[3])) {
|
|
continue;
|
|
}
|
|
|
|
var operands = this.encodeOperands(field[2], null, ctx, val);
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(operands), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var op = _step2.value;
|
|
|
|
len += CFFOperand.size(op);
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
var key = Array.isArray(field[0]) ? field[0] : [field[0]];
|
|
len += key.length;
|
|
}
|
|
|
|
if (includePointers) {
|
|
len += ctx.pointerSize;
|
|
}
|
|
|
|
return len;
|
|
}
|
|
}, {
|
|
key: 'encode',
|
|
value: function encode(stream, dict, parent) {
|
|
var ctx = {
|
|
pointers: [],
|
|
startOffset: stream.pos,
|
|
parent: parent,
|
|
val: dict,
|
|
pointerSize: 0
|
|
};
|
|
|
|
ctx.pointerOffset = stream.pos + this.size(dict, ctx, false);
|
|
|
|
var _iteratorNormalCompletion3 = true;
|
|
var _didIteratorError3 = false;
|
|
var _iteratorError3 = undefined;
|
|
|
|
try {
|
|
for (var _iterator3 = _getIterator(this.ops), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
var field = _step3.value;
|
|
|
|
var val = dict[field[1]];
|
|
if (val == null || isEqual(val, field[3])) {
|
|
continue;
|
|
}
|
|
|
|
var operands = this.encodeOperands(field[2], stream, ctx, val);
|
|
var _iteratorNormalCompletion4 = true;
|
|
var _didIteratorError4 = false;
|
|
var _iteratorError4 = undefined;
|
|
|
|
try {
|
|
for (var _iterator4 = _getIterator(operands), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
var op = _step4.value;
|
|
|
|
CFFOperand.encode(stream, op);
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError4 = true;
|
|
_iteratorError4 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
|
_iterator4.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError4) {
|
|
throw _iteratorError4;
|
|
}
|
|
}
|
|
}
|
|
|
|
var key = Array.isArray(field[0]) ? field[0] : [field[0]];
|
|
var _iteratorNormalCompletion5 = true;
|
|
var _didIteratorError5 = false;
|
|
var _iteratorError5 = undefined;
|
|
|
|
try {
|
|
for (var _iterator5 = _getIterator(key), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
|
var _op = _step5.value;
|
|
|
|
stream.writeUInt8(_op);
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError5 = true;
|
|
_iteratorError5 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion5 && _iterator5.return) {
|
|
_iterator5.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError5) {
|
|
throw _iteratorError5;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError3 = true;
|
|
_iteratorError3 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
_iterator3.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError3) {
|
|
throw _iteratorError3;
|
|
}
|
|
}
|
|
}
|
|
|
|
var i = 0;
|
|
while (i < ctx.pointers.length) {
|
|
var ptr = ctx.pointers[i++];
|
|
ptr.type.encode(stream, ptr.val, ptr.parent);
|
|
}
|
|
|
|
return;
|
|
}
|
|
}]);
|
|
|
|
return CFFDict;
|
|
}();
|
|
|
|
var CFFPointer = function (_r$Pointer) {
|
|
_inherits(CFFPointer, _r$Pointer);
|
|
|
|
function CFFPointer(type) {
|
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
|
_classCallCheck(this, CFFPointer);
|
|
|
|
if (options.type == null) {
|
|
options.type = 'global';
|
|
}
|
|
|
|
return _possibleConstructorReturn(this, (CFFPointer.__proto__ || _Object$getPrototypeOf(CFFPointer)).call(this, null, type, options));
|
|
}
|
|
|
|
_createClass(CFFPointer, [{
|
|
key: 'decode',
|
|
value: function decode(stream, parent, operands) {
|
|
this.offsetType = {
|
|
decode: function decode() {
|
|
return operands[0];
|
|
}
|
|
};
|
|
|
|
return _get(CFFPointer.prototype.__proto__ || _Object$getPrototypeOf(CFFPointer.prototype), 'decode', this).call(this, stream, parent, operands);
|
|
}
|
|
}, {
|
|
key: 'encode',
|
|
value: function encode(stream, value, ctx) {
|
|
if (!stream) {
|
|
// compute the size (so ctx.pointerSize is correct)
|
|
this.offsetType = {
|
|
size: function size() {
|
|
return 0;
|
|
}
|
|
};
|
|
|
|
this.size(value, ctx);
|
|
return [new Ptr(0)];
|
|
}
|
|
|
|
var ptr = null;
|
|
this.offsetType = {
|
|
encode: function encode(stream, val) {
|
|
return ptr = val;
|
|
}
|
|
};
|
|
|
|
_get(CFFPointer.prototype.__proto__ || _Object$getPrototypeOf(CFFPointer.prototype), 'encode', this).call(this, stream, value, ctx);
|
|
return [new Ptr(ptr)];
|
|
}
|
|
}]);
|
|
|
|
return CFFPointer;
|
|
}(r.Pointer);
|
|
|
|
var Ptr = function () {
|
|
function Ptr(val) {
|
|
_classCallCheck(this, Ptr);
|
|
|
|
this.val = val;
|
|
this.forceLarge = true;
|
|
}
|
|
|
|
_createClass(Ptr, [{
|
|
key: 'valueOf',
|
|
value: function valueOf() {
|
|
return this.val;
|
|
}
|
|
}]);
|
|
|
|
return Ptr;
|
|
}();
|
|
|
|
var CFFPrivateDict = new CFFDict([
|
|
// key name type default
|
|
[6, 'BlueValues', 'delta', null], [7, 'OtherBlues', 'delta', null], [8, 'FamilyBlues', 'delta', null], [9, 'FamilyOtherBlues', 'delta', null], [[12, 9], 'BlueScale', 'number', 0.039625], [[12, 10], 'BlueShift', 'number', 7], [[12, 11], 'BlueFuzz', 'number', 1], [10, 'StdHW', 'number', null], [11, 'StdVW', 'number', null], [[12, 12], 'StemSnapH', 'delta', null], [[12, 13], 'StemSnapV', 'delta', null], [[12, 14], 'ForceBold', 'boolean', false], [[12, 17], 'LanguageGroup', 'number', 0], [[12, 18], 'ExpansionFactor', 'number', 0.06], [[12, 19], 'initialRandomSeed', 'number', 0], [20, 'defaultWidthX', 'number', 0], [21, 'nominalWidthX', 'number', 0], [19, 'Subrs', new CFFPointer(new CFFIndex(), { type: 'local' }), null]]);
|
|
|
|
// Automatically generated from Appendix A of the CFF specification; do
|
|
// not edit. Length should be 391.
|
|
var standardStrings = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"];
|
|
|
|
var StandardEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'exclamdown', 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', '', 'endash', 'dagger', 'daggerdbl', 'periodcentered', '', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', '', 'questiondown', '', 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', '', 'ring', 'cedilla', '', 'hungarumlaut', 'ogonek', 'caron', 'emdash', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'AE', '', 'ordfeminine', '', '', '', '', 'Lslash', 'Oslash', 'OE', 'ordmasculine', '', '', '', '', '', 'ae', '', '', '', 'dotlessi', '', '', 'lslash', 'oslash', 'oe', 'germandbls'];
|
|
|
|
var ExpertEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclamsmall', 'Hungarumlautsmall', '', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', '', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', '', '', 'isuperior', '', '', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', '', '', 'rsuperior', 'ssuperior', 'tsuperior', '', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', '', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', '', '', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', '', 'Dotaccentsmall', '', '', 'Macronsmall', '', '', 'figuredash', 'hypheninferior', '', '', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', '', '', '', 'onequarter', 'onehalf', 'threequarters', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', '', '', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall'];
|
|
|
|
var ISOAdobeCharset = ['.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'exclamdown', 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'endash', 'dagger', 'daggerdbl', 'periodcentered', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', 'questiondown', 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'emdash', 'AE', 'ordfeminine', 'Lslash', 'Oslash', 'OE', 'ordmasculine', 'ae', 'dotlessi', 'lslash', 'oslash', 'oe', 'germandbls', 'onesuperior', 'logicalnot', 'mu', 'trademark', 'Eth', 'onehalf', 'plusminus', 'Thorn', 'onequarter', 'divide', 'brokenbar', 'degree', 'thorn', 'threequarters', 'twosuperior', 'registered', 'minus', 'eth', 'multiply', 'threesuperior', 'copyright', 'Aacute', 'Acircumflex', 'Adieresis', 'Agrave', 'Aring', 'Atilde', 'Ccedilla', 'Eacute', 'Ecircumflex', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Ntilde', 'Oacute', 'Ocircumflex', 'Odieresis', 'Ograve', 'Otilde', 'Scaron', 'Uacute', 'Ucircumflex', 'Udieresis', 'Ugrave', 'Yacute', 'Ydieresis', 'Zcaron', 'aacute', 'acircumflex', 'adieresis', 'agrave', 'aring', 'atilde', 'ccedilla', 'eacute', 'ecircumflex', 'edieresis', 'egrave', 'iacute', 'icircumflex', 'idieresis', 'igrave', 'ntilde', 'oacute', 'ocircumflex', 'odieresis', 'ograve', 'otilde', 'scaron', 'uacute', 'ucircumflex', 'udieresis', 'ugrave', 'yacute', 'ydieresis', 'zcaron'];
|
|
|
|
var ExpertCharset = ['.notdef', 'space', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', 'Dotaccentsmall', 'Macronsmall', 'figuredash', 'hypheninferior', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', 'onequarter', 'onehalf', 'threequarters', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall'];
|
|
|
|
var ExpertSubsetCharset = ['.notdef', 'space', 'dollaroldstyle', 'dollarsuperior', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', 'hyphensuperior', 'colonmonetary', 'onefitted', 'rupiah', 'centoldstyle', 'figuredash', 'hypheninferior', 'onequarter', 'onehalf', 'threequarters', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior'];
|
|
|
|
// Checks if an operand is an index of a predefined value,
|
|
// otherwise delegates to the provided type.
|
|
|
|
var PredefinedOp = function () {
|
|
function PredefinedOp(predefinedOps, type) {
|
|
_classCallCheck(this, PredefinedOp);
|
|
|
|
this.predefinedOps = predefinedOps;
|
|
this.type = type;
|
|
}
|
|
|
|
_createClass(PredefinedOp, [{
|
|
key: 'decode',
|
|
value: function decode(stream, parent, operands) {
|
|
if (this.predefinedOps[operands[0]]) {
|
|
return this.predefinedOps[operands[0]];
|
|
}
|
|
|
|
return this.type.decode(stream, parent, operands);
|
|
}
|
|
}, {
|
|
key: 'size',
|
|
value: function size(value, ctx) {
|
|
return this.type.size(value, ctx);
|
|
}
|
|
}, {
|
|
key: 'encode',
|
|
value: function encode(stream, value, ctx) {
|
|
var index = this.predefinedOps.indexOf(value);
|
|
if (index !== -1) {
|
|
return index;
|
|
}
|
|
|
|
return this.type.encode(stream, value, ctx);
|
|
}
|
|
}]);
|
|
|
|
return PredefinedOp;
|
|
}();
|
|
|
|
var CFFEncodingVersion = function (_r$Number) {
|
|
_inherits(CFFEncodingVersion, _r$Number);
|
|
|
|
function CFFEncodingVersion() {
|
|
_classCallCheck(this, CFFEncodingVersion);
|
|
|
|
return _possibleConstructorReturn(this, (CFFEncodingVersion.__proto__ || _Object$getPrototypeOf(CFFEncodingVersion)).call(this, 'UInt8'));
|
|
}
|
|
|
|
_createClass(CFFEncodingVersion, [{
|
|
key: 'decode',
|
|
value: function decode(stream) {
|
|
return r.uint8.decode(stream) & 0x7f;
|
|
}
|
|
}]);
|
|
|
|
return CFFEncodingVersion;
|
|
}(r.Number);
|
|
|
|
var Range1 = new r.Struct({
|
|
first: r.uint16,
|
|
nLeft: r.uint8
|
|
});
|
|
|
|
var Range2 = new r.Struct({
|
|
first: r.uint16,
|
|
nLeft: r.uint16
|
|
});
|
|
|
|
var CFFCustomEncoding = new r.VersionedStruct(new CFFEncodingVersion(), {
|
|
0: {
|
|
nCodes: r.uint8,
|
|
codes: new r.Array(r.uint8, 'nCodes')
|
|
},
|
|
|
|
1: {
|
|
nRanges: r.uint8,
|
|
ranges: new r.Array(Range1, 'nRanges')
|
|
}
|
|
|
|
// TODO: supplement?
|
|
});
|
|
|
|
var CFFEncoding = new PredefinedOp([StandardEncoding, ExpertEncoding], new CFFPointer(CFFCustomEncoding, { lazy: true }));
|
|
|
|
// Decodes an array of ranges until the total
|
|
// length is equal to the provided length.
|
|
|
|
var RangeArray = function (_r$Array) {
|
|
_inherits(RangeArray, _r$Array);
|
|
|
|
function RangeArray() {
|
|
_classCallCheck(this, RangeArray);
|
|
|
|
return _possibleConstructorReturn(this, (RangeArray.__proto__ || _Object$getPrototypeOf(RangeArray)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(RangeArray, [{
|
|
key: 'decode',
|
|
value: function decode(stream, parent) {
|
|
var length = restructure_src_utils.resolveLength(this.length, stream, parent);
|
|
var count = 0;
|
|
var res = [];
|
|
while (count < length) {
|
|
var range = this.type.decode(stream, parent);
|
|
range.offset = count;
|
|
count += range.nLeft + 1;
|
|
res.push(range);
|
|
}
|
|
|
|
return res;
|
|
}
|
|
}]);
|
|
|
|
return RangeArray;
|
|
}(r.Array);
|
|
|
|
var CFFCustomCharset = new r.VersionedStruct(r.uint8, {
|
|
0: {
|
|
glyphs: new r.Array(r.uint16, function (t) {
|
|
return t.parent.CharStrings.length - 1;
|
|
})
|
|
},
|
|
|
|
1: {
|
|
ranges: new RangeArray(Range1, function (t) {
|
|
return t.parent.CharStrings.length - 1;
|
|
})
|
|
},
|
|
|
|
2: {
|
|
ranges: new RangeArray(Range2, function (t) {
|
|
return t.parent.CharStrings.length - 1;
|
|
})
|
|
}
|
|
});
|
|
|
|
var CFFCharset = new PredefinedOp([ISOAdobeCharset, ExpertCharset, ExpertSubsetCharset], new CFFPointer(CFFCustomCharset, { lazy: true }));
|
|
|
|
var FDRange = new r.Struct({
|
|
first: r.uint16,
|
|
fd: r.uint8
|
|
});
|
|
|
|
var FDSelect = new r.VersionedStruct(r.uint8, {
|
|
0: {
|
|
fds: new r.Array(r.uint8, function (t) {
|
|
return t.parent.CharStrings.length;
|
|
})
|
|
},
|
|
|
|
3: {
|
|
nRanges: r.uint16,
|
|
ranges: new r.Array(FDRange, 'nRanges'),
|
|
sentinel: r.uint16
|
|
}
|
|
});
|
|
|
|
var ptr = new CFFPointer(CFFPrivateDict);
|
|
|
|
var CFFPrivateOp = function () {
|
|
function CFFPrivateOp() {
|
|
_classCallCheck(this, CFFPrivateOp);
|
|
}
|
|
|
|
_createClass(CFFPrivateOp, [{
|
|
key: 'decode',
|
|
value: function decode(stream, parent, operands) {
|
|
parent.length = operands[0];
|
|
return ptr.decode(stream, parent, [operands[1]]);
|
|
}
|
|
}, {
|
|
key: 'size',
|
|
value: function size(dict, ctx) {
|
|
return [CFFPrivateDict.size(dict, ctx, false), ptr.size(dict, ctx)[0]];
|
|
}
|
|
}, {
|
|
key: 'encode',
|
|
value: function encode(stream, dict, ctx) {
|
|
return [CFFPrivateDict.size(dict, ctx, false), ptr.encode(stream, dict, ctx)[0]];
|
|
}
|
|
}]);
|
|
|
|
return CFFPrivateOp;
|
|
}();
|
|
|
|
var FontDict = new CFFDict([
|
|
// key name type(s) default
|
|
[18, 'Private', new CFFPrivateOp(), null], [[12, 38], 'FontName', 'sid', null]]);
|
|
|
|
var CFFTopDict = new CFFDict([
|
|
// key name type(s) default
|
|
[[12, 30], 'ROS', ['sid', 'sid', 'number'], null], [0, 'version', 'sid', null], [1, 'Notice', 'sid', null], [[12, 0], 'Copyright', 'sid', null], [2, 'FullName', 'sid', null], [3, 'FamilyName', 'sid', null], [4, 'Weight', 'sid', null], [[12, 1], 'isFixedPitch', 'boolean', false], [[12, 2], 'ItalicAngle', 'number', 0], [[12, 3], 'UnderlinePosition', 'number', -100], [[12, 4], 'UnderlineThickness', 'number', 50], [[12, 5], 'PaintType', 'number', 0], [[12, 6], 'CharstringType', 'number', 2], [[12, 7], 'FontMatrix', 'array', [0.001, 0, 0, 0.001, 0, 0]], [13, 'UniqueID', 'number', null], [5, 'FontBBox', 'array', [0, 0, 0, 0]], [[12, 8], 'StrokeWidth', 'number', 0], [14, 'XUID', 'array', null], [15, 'charset', CFFCharset, ISOAdobeCharset], [16, 'Encoding', CFFEncoding, StandardEncoding], [17, 'CharStrings', new CFFPointer(new CFFIndex()), null], [18, 'Private', new CFFPrivateOp(), null], [[12, 20], 'SyntheticBase', 'number', null], [[12, 21], 'PostScript', 'sid', null], [[12, 22], 'BaseFontName', 'sid', null], [[12, 23], 'BaseFontBlend', 'delta', null],
|
|
|
|
// CID font specific
|
|
[[12, 31], 'CIDFontVersion', 'number', 0], [[12, 32], 'CIDFontRevision', 'number', 0], [[12, 33], 'CIDFontType', 'number', 0], [[12, 34], 'CIDCount', 'number', 8720], [[12, 35], 'UIDBase', 'number', null], [[12, 37], 'FDSelect', new CFFPointer(FDSelect), null], [[12, 36], 'FDArray', new CFFPointer(new CFFIndex(FontDict)), null], [[12, 38], 'FontName', 'sid', null]]);
|
|
|
|
var CFFHeader = new r.Struct({
|
|
majorVersion: r.uint8,
|
|
minorVersion: r.uint8,
|
|
hdrSize: r.uint8,
|
|
offSize: r.uint8
|
|
});
|
|
|
|
var CFFTop = new r.Struct({
|
|
header: CFFHeader,
|
|
nameIndex: new CFFIndex(new r.String('length')),
|
|
topDictIndex: new CFFIndex(CFFTopDict),
|
|
stringIndex: new CFFIndex(new r.String('length')),
|
|
globalSubrIndex: new CFFIndex()
|
|
});
|
|
|
|
var CFFFont = function () {
|
|
function CFFFont(stream) {
|
|
_classCallCheck(this, CFFFont);
|
|
|
|
this.stream = stream;
|
|
this.decode();
|
|
}
|
|
|
|
_createClass(CFFFont, [{
|
|
key: 'decode',
|
|
value: function decode() {
|
|
var start = this.stream.pos;
|
|
var top = CFFTop.decode(this.stream);
|
|
for (var key in top) {
|
|
var val = top[key];
|
|
this[key] = val;
|
|
}
|
|
|
|
if (this.topDictIndex.length !== 1) {
|
|
throw new Error("Only a single font is allowed in CFF");
|
|
}
|
|
|
|
this.isCIDFont = this.topDict.ROS != null;
|
|
|
|
return this;
|
|
}
|
|
}, {
|
|
key: 'string',
|
|
value: function string(sid) {
|
|
if (sid < standardStrings.length) {
|
|
return standardStrings[sid];
|
|
}
|
|
|
|
return this.stringIndex[sid - standardStrings.length];
|
|
}
|
|
}, {
|
|
key: 'getCharString',
|
|
value: function getCharString(glyph) {
|
|
this.stream.pos = this.topDict.CharStrings[glyph].offset;
|
|
return this.stream.readBuffer(this.topDict.CharStrings[glyph].length);
|
|
}
|
|
}, {
|
|
key: 'getGlyphName',
|
|
value: function getGlyphName(gid) {
|
|
var charset = this.topDict.charset;
|
|
|
|
if (Array.isArray(charset)) {
|
|
return charset[gid];
|
|
}
|
|
|
|
if (gid === 0) {
|
|
return '.notdef';
|
|
}
|
|
|
|
gid -= 1;
|
|
|
|
switch (charset.version) {
|
|
case 0:
|
|
return this.string(charset.glyphs[gid]);
|
|
|
|
case 1:
|
|
case 2:
|
|
for (var i = 0; i < charset.ranges.length; i++) {
|
|
var range = charset.ranges[i];
|
|
if (range.offset <= gid && gid <= range.offset + range.nLeft) {
|
|
return this.string(range.first + (gid - range.offset));
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}, {
|
|
key: 'fdForGlyph',
|
|
value: function fdForGlyph(gid) {
|
|
if (!this.topDict.FDSelect) {
|
|
return null;
|
|
}
|
|
|
|
switch (this.topDict.FDSelect.version) {
|
|
case 0:
|
|
return this.topDict.FDSelect.fds[gid];
|
|
|
|
case 3:
|
|
var ranges = this.topDict.FDSelect.ranges;
|
|
|
|
var low = 0;
|
|
var high = ranges.length - 1;
|
|
|
|
while (low <= high) {
|
|
var mid = low + high >> 1;
|
|
|
|
if (gid < ranges[mid].first) {
|
|
high = mid - 1;
|
|
} else if (mid < high && gid > ranges[mid + 1].first) {
|
|
low = mid + 1;
|
|
} else {
|
|
return ranges[mid].fd;
|
|
}
|
|
}
|
|
default:
|
|
throw new Error('Unknown FDSelect version: ' + this.topDict.FDSelect.version);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'privateDictForGlyph',
|
|
value: function privateDictForGlyph(gid) {
|
|
if (this.topDict.FDSelect) {
|
|
var fd = this.fdForGlyph(gid);
|
|
if (this.topDict.FDArray[fd]) {
|
|
return this.topDict.FDArray[fd].Private;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
return this.topDict.Private;
|
|
}
|
|
}, {
|
|
key: 'topDict',
|
|
get: function get() {
|
|
return this.topDictIndex[0];
|
|
}
|
|
}, {
|
|
key: 'postscriptName',
|
|
get: function get() {
|
|
return this.nameIndex[0];
|
|
}
|
|
}, {
|
|
key: 'fullName',
|
|
get: function get() {
|
|
return this.string(this.topDict.FullName);
|
|
}
|
|
}, {
|
|
key: 'familyName',
|
|
get: function get() {
|
|
return this.string(this.topDict.FamilyName);
|
|
}
|
|
}], [{
|
|
key: 'decode',
|
|
value: function decode(stream) {
|
|
return new CFFFont(stream);
|
|
}
|
|
}]);
|
|
|
|
return CFFFont;
|
|
}();
|
|
|
|
var VerticalOrigin = new r.Struct({
|
|
glyphIndex: r.uint16,
|
|
vertOriginY: r.int16
|
|
});
|
|
|
|
var VORG = new r.Struct({
|
|
majorVersion: r.uint16,
|
|
minorVersion: r.uint16,
|
|
defaultVertOriginY: r.int16,
|
|
numVertOriginYMetrics: r.uint16,
|
|
metrics: new r.Array(VerticalOrigin, 'numVertOriginYMetrics')
|
|
});
|
|
|
|
var BigMetrics = new r.Struct({
|
|
height: r.uint8,
|
|
width: r.uint8,
|
|
horiBearingX: r.int8,
|
|
horiBearingY: r.int8,
|
|
horiAdvance: r.uint8,
|
|
vertBearingX: r.int8,
|
|
vertBearingY: r.int8,
|
|
vertAdvance: r.uint8
|
|
});
|
|
|
|
var SmallMetrics = new r.Struct({
|
|
height: r.uint8,
|
|
width: r.uint8,
|
|
bearingX: r.int8,
|
|
bearingY: r.int8,
|
|
advance: r.uint8
|
|
});
|
|
|
|
var EBDTComponent = new r.Struct({
|
|
glyph: r.uint16,
|
|
xOffset: r.int8,
|
|
yOffset: r.int8
|
|
});
|
|
|
|
var ByteAligned = function ByteAligned() {
|
|
_classCallCheck(this, ByteAligned);
|
|
};
|
|
|
|
var BitAligned = function BitAligned() {
|
|
_classCallCheck(this, BitAligned);
|
|
};
|
|
|
|
var glyph = new r.VersionedStruct('version', {
|
|
1: {
|
|
metrics: SmallMetrics,
|
|
data: ByteAligned
|
|
},
|
|
|
|
2: {
|
|
metrics: SmallMetrics,
|
|
data: BitAligned
|
|
},
|
|
|
|
// format 3 is deprecated
|
|
// format 4 is not supported by Microsoft
|
|
|
|
5: {
|
|
data: BitAligned
|
|
},
|
|
|
|
6: {
|
|
metrics: BigMetrics,
|
|
data: ByteAligned
|
|
},
|
|
|
|
7: {
|
|
metrics: BigMetrics,
|
|
data: BitAligned
|
|
},
|
|
|
|
8: {
|
|
metrics: SmallMetrics,
|
|
pad: new r.Reserved(r.uint8),
|
|
numComponents: r.uint16,
|
|
components: new r.Array(EBDTComponent, 'numComponents')
|
|
},
|
|
|
|
9: {
|
|
metrics: BigMetrics,
|
|
pad: new r.Reserved(r.uint8),
|
|
numComponents: r.uint16,
|
|
components: new r.Array(EBDTComponent, 'numComponents')
|
|
},
|
|
|
|
17: {
|
|
metrics: SmallMetrics,
|
|
dataLen: r.uint32,
|
|
data: new r.Buffer('dataLen')
|
|
},
|
|
|
|
18: {
|
|
metrics: BigMetrics,
|
|
dataLen: r.uint32,
|
|
data: new r.Buffer('dataLen')
|
|
},
|
|
|
|
19: {
|
|
dataLen: r.uint32,
|
|
data: new r.Buffer('dataLen')
|
|
}
|
|
});
|
|
|
|
var SBitLineMetrics = new r.Struct({
|
|
ascender: r.int8,
|
|
descender: r.int8,
|
|
widthMax: r.uint8,
|
|
caretSlopeNumerator: r.int8,
|
|
caretSlopeDenominator: r.int8,
|
|
caretOffset: r.int8,
|
|
minOriginSB: r.int8,
|
|
minAdvanceSB: r.int8,
|
|
maxBeforeBL: r.int8,
|
|
minAfterBL: r.int8,
|
|
pad: new r.Reserved(r.int8, 2)
|
|
});
|
|
|
|
var CodeOffsetPair = new r.Struct({
|
|
glyphCode: r.uint16,
|
|
offset: r.uint16
|
|
});
|
|
|
|
var IndexSubtable = new r.VersionedStruct(r.uint16, {
|
|
header: {
|
|
imageFormat: r.uint16,
|
|
imageDataOffset: r.uint32
|
|
},
|
|
|
|
1: {
|
|
offsetArray: new r.Array(r.uint32, function (t) {
|
|
return t.parent.lastGlyphIndex - t.parent.firstGlyphIndex + 1;
|
|
})
|
|
},
|
|
|
|
2: {
|
|
imageSize: r.uint32,
|
|
bigMetrics: BigMetrics
|
|
},
|
|
|
|
3: {
|
|
offsetArray: new r.Array(r.uint16, function (t) {
|
|
return t.parent.lastGlyphIndex - t.parent.firstGlyphIndex + 1;
|
|
})
|
|
},
|
|
|
|
4: {
|
|
numGlyphs: r.uint32,
|
|
glyphArray: new r.Array(CodeOffsetPair, function (t) {
|
|
return t.numGlyphs + 1;
|
|
})
|
|
},
|
|
|
|
5: {
|
|
imageSize: r.uint32,
|
|
bigMetrics: BigMetrics,
|
|
numGlyphs: r.uint32,
|
|
glyphCodeArray: new r.Array(r.uint16, 'numGlyphs')
|
|
}
|
|
});
|
|
|
|
var IndexSubtableArray = new r.Struct({
|
|
firstGlyphIndex: r.uint16,
|
|
lastGlyphIndex: r.uint16,
|
|
subtable: new r.Pointer(r.uint32, IndexSubtable)
|
|
});
|
|
|
|
var BitmapSizeTable = new r.Struct({
|
|
indexSubTableArray: new r.Pointer(r.uint32, new r.Array(IndexSubtableArray, 1), { type: 'parent' }),
|
|
indexTablesSize: r.uint32,
|
|
numberOfIndexSubTables: r.uint32,
|
|
colorRef: r.uint32,
|
|
hori: SBitLineMetrics,
|
|
vert: SBitLineMetrics,
|
|
startGlyphIndex: r.uint16,
|
|
endGlyphIndex: r.uint16,
|
|
ppemX: r.uint8,
|
|
ppemY: r.uint8,
|
|
bitDepth: r.uint8,
|
|
flags: new r.Bitfield(r.uint8, ['horizontal', 'vertical'])
|
|
});
|
|
|
|
var EBLC = new r.Struct({
|
|
version: r.uint32, // 0x00020000
|
|
numSizes: r.uint32,
|
|
sizes: new r.Array(BitmapSizeTable, 'numSizes')
|
|
});
|
|
|
|
var ImageTable = new r.Struct({
|
|
ppem: r.uint16,
|
|
resolution: r.uint16,
|
|
imageOffsets: new r.Array(new r.Pointer(r.uint32, 'void'), function (t) {
|
|
return t.parent.parent.maxp.numGlyphs + 1;
|
|
})
|
|
});
|
|
|
|
// This is the Apple sbix table, used by the "Apple Color Emoji" font.
|
|
// It includes several image tables with images for each bitmap glyph
|
|
// of several different sizes.
|
|
var sbix = new r.Struct({
|
|
version: r.uint16,
|
|
flags: new r.Bitfield(r.uint16, ['renderOutlines']),
|
|
numImgTables: r.uint32,
|
|
imageTables: new r.Array(new r.Pointer(r.uint32, ImageTable), 'numImgTables')
|
|
});
|
|
|
|
var LayerRecord = new r.Struct({
|
|
gid: r.uint16, // Glyph ID of layer glyph (must be in z-order from bottom to top).
|
|
paletteIndex: r.uint16 // Index value to use in the appropriate palette. This value must
|
|
}); // be less than numPaletteEntries in the CPAL table, except for
|
|
// the special case noted below. Each palette entry is 16 bits.
|
|
// A palette index of 0xFFFF is a special case indicating that
|
|
// the text foreground color should be used.
|
|
|
|
var BaseGlyphRecord = new r.Struct({
|
|
gid: r.uint16, // Glyph ID of reference glyph. This glyph is for reference only
|
|
// and is not rendered for color.
|
|
firstLayerIndex: r.uint16, // Index (from beginning of the Layer Records) to the layer record.
|
|
// There will be numLayers consecutive entries for this base glyph.
|
|
numLayers: r.uint16
|
|
});
|
|
|
|
var COLR = new r.Struct({
|
|
version: r.uint16,
|
|
numBaseGlyphRecords: r.uint16,
|
|
baseGlyphRecord: new r.Pointer(r.uint32, new r.Array(BaseGlyphRecord, 'numBaseGlyphRecords')),
|
|
layerRecords: new r.Pointer(r.uint32, new r.Array(LayerRecord, 'numLayerRecords'), { lazy: true }),
|
|
numLayerRecords: r.uint16
|
|
});
|
|
|
|
var ColorRecord = new r.Struct({
|
|
blue: r.uint8,
|
|
green: r.uint8,
|
|
red: r.uint8,
|
|
alpha: r.uint8
|
|
});
|
|
|
|
var CPAL = new r.Struct({
|
|
version: r.uint16,
|
|
numPaletteEntries: r.uint16,
|
|
numPalettes: r.uint16,
|
|
numColorRecords: r.uint16,
|
|
colorRecords: new r.Pointer(r.uint32, new r.Array(ColorRecord, 'numColorRecords')),
|
|
colorRecordIndices: new r.Array(r.uint16, 'numPalettes')
|
|
});
|
|
|
|
//########################
|
|
// Scripts and Languages #
|
|
//########################
|
|
|
|
var LangSysTable = new r.Struct({
|
|
reserved: new r.Reserved(r.uint16),
|
|
reqFeatureIndex: r.uint16,
|
|
featureCount: r.uint16,
|
|
featureIndexes: new r.Array(r.uint16, 'featureCount')
|
|
});
|
|
|
|
var LangSysRecord = new r.Struct({
|
|
tag: new r.String(4),
|
|
langSys: new r.Pointer(r.uint16, LangSysTable, { type: 'parent' })
|
|
});
|
|
|
|
var Script = new r.Struct({
|
|
defaultLangSys: new r.Pointer(r.uint16, LangSysTable),
|
|
count: r.uint16,
|
|
langSysRecords: new r.Array(LangSysRecord, 'count')
|
|
});
|
|
|
|
var ScriptRecord = new r.Struct({
|
|
tag: new r.String(4),
|
|
script: new r.Pointer(r.uint16, Script, { type: 'parent' })
|
|
});
|
|
|
|
var ScriptList = new r.Array(ScriptRecord, r.uint16);
|
|
|
|
//#######################
|
|
// Features and Lookups #
|
|
//#######################
|
|
|
|
var Feature = new r.Struct({
|
|
featureParams: r.uint16, // pointer
|
|
lookupCount: r.uint16,
|
|
lookupListIndexes: new r.Array(r.uint16, 'lookupCount')
|
|
});
|
|
|
|
var FeatureRecord = new r.Struct({
|
|
tag: new r.String(4),
|
|
feature: new r.Pointer(r.uint16, Feature, { type: 'parent' })
|
|
});
|
|
|
|
var FeatureList = new r.Array(FeatureRecord, r.uint16);
|
|
|
|
var LookupFlags = new r.Bitfield(r.uint16, ['rightToLeft', 'ignoreBaseGlyphs', 'ignoreLigatures', 'ignoreMarks', 'useMarkFilteringSet', null, 'markAttachmentType']);
|
|
|
|
function LookupList(SubTable) {
|
|
var Lookup = new r.Struct({
|
|
lookupType: r.uint16,
|
|
flags: LookupFlags,
|
|
subTableCount: r.uint16,
|
|
subTables: new r.Array(new r.Pointer(r.uint16, SubTable), 'subTableCount'),
|
|
markFilteringSet: r.uint16 // TODO: only present when flags says so...
|
|
});
|
|
|
|
return new r.LazyArray(new r.Pointer(r.uint16, Lookup), r.uint16);
|
|
}
|
|
|
|
//#################
|
|
// Coverage Table #
|
|
//#################
|
|
|
|
var RangeRecord = new r.Struct({
|
|
start: r.uint16,
|
|
end: r.uint16,
|
|
startCoverageIndex: r.uint16
|
|
});
|
|
|
|
var Coverage = new r.VersionedStruct(r.uint16, {
|
|
1: {
|
|
glyphCount: r.uint16,
|
|
glyphs: new r.Array(r.uint16, 'glyphCount')
|
|
},
|
|
2: {
|
|
rangeCount: r.uint16,
|
|
rangeRecords: new r.Array(RangeRecord, 'rangeCount')
|
|
}
|
|
});
|
|
|
|
//#########################
|
|
// Class Definition Table #
|
|
//#########################
|
|
|
|
var ClassRangeRecord = new r.Struct({
|
|
start: r.uint16,
|
|
end: r.uint16,
|
|
class: r.uint16
|
|
});
|
|
|
|
var ClassDef = new r.VersionedStruct(r.uint16, {
|
|
1: { // Class array
|
|
startGlyph: r.uint16,
|
|
glyphCount: r.uint16,
|
|
classValueArray: new r.Array(r.uint16, 'glyphCount')
|
|
},
|
|
2: { // Class ranges
|
|
classRangeCount: r.uint16,
|
|
classRangeRecord: new r.Array(ClassRangeRecord, 'classRangeCount')
|
|
}
|
|
});
|
|
|
|
//###############
|
|
// Device Table #
|
|
//###############
|
|
|
|
var Device = new r.Struct({
|
|
startSize: r.uint16,
|
|
endSize: r.uint16,
|
|
deltaFormat: r.uint16
|
|
});
|
|
|
|
//#############################################
|
|
// Contextual Substitution/Positioning Tables #
|
|
//#############################################
|
|
|
|
var LookupRecord = new r.Struct({
|
|
sequenceIndex: r.uint16,
|
|
lookupListIndex: r.uint16
|
|
});
|
|
|
|
var Rule = new r.Struct({
|
|
glyphCount: r.uint16,
|
|
lookupCount: r.uint16,
|
|
input: new r.Array(r.uint16, function (t) {
|
|
return t.glyphCount - 1;
|
|
}),
|
|
lookupRecords: new r.Array(LookupRecord, 'lookupCount')
|
|
});
|
|
|
|
var RuleSet = new r.Array(new r.Pointer(r.uint16, Rule), r.uint16);
|
|
|
|
var ClassRule = new r.Struct({
|
|
glyphCount: r.uint16,
|
|
lookupCount: r.uint16,
|
|
classes: new r.Array(r.uint16, function (t) {
|
|
return t.glyphCount - 1;
|
|
}),
|
|
lookupRecords: new r.Array(LookupRecord, 'lookupCount')
|
|
});
|
|
|
|
var ClassSet = new r.Array(new r.Pointer(r.uint16, ClassRule), r.uint16);
|
|
|
|
var Context = new r.VersionedStruct(r.uint16, {
|
|
1: { // Simple context
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
ruleSetCount: r.uint16,
|
|
ruleSets: new r.Array(new r.Pointer(r.uint16, RuleSet), 'ruleSetCount')
|
|
},
|
|
2: { // Class-based context
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
classDef: new r.Pointer(r.uint16, ClassDef),
|
|
classSetCnt: r.uint16,
|
|
classSet: new r.Array(new r.Pointer(r.uint16, ClassSet), 'classSetCnt')
|
|
},
|
|
3: {
|
|
glyphCount: r.uint16,
|
|
lookupCount: r.uint16,
|
|
coverages: new r.Array(new r.Pointer(r.uint16, Coverage), 'glyphCount'),
|
|
lookupRecords: new r.Array(LookupRecord, 'lookupCount')
|
|
}
|
|
});
|
|
|
|
//######################################################
|
|
// Chaining Contextual Substitution/Positioning Tables #
|
|
//######################################################
|
|
|
|
var ChainRule = new r.Struct({
|
|
backtrackGlyphCount: r.uint16,
|
|
backtrack: new r.Array(r.uint16, 'backtrackGlyphCount'),
|
|
inputGlyphCount: r.uint16,
|
|
input: new r.Array(r.uint16, function (t) {
|
|
return t.inputGlyphCount - 1;
|
|
}),
|
|
lookaheadGlyphCount: r.uint16,
|
|
lookahead: new r.Array(r.uint16, 'lookaheadGlyphCount'),
|
|
lookupCount: r.uint16,
|
|
lookupRecords: new r.Array(LookupRecord, 'lookupCount')
|
|
});
|
|
|
|
var ChainRuleSet = new r.Array(new r.Pointer(r.uint16, ChainRule), r.uint16);
|
|
|
|
var ChainingContext = new r.VersionedStruct(r.uint16, {
|
|
1: { // Simple context glyph substitution
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
chainCount: r.uint16,
|
|
chainRuleSets: new r.Array(new r.Pointer(r.uint16, ChainRuleSet), 'chainCount')
|
|
},
|
|
|
|
2: { // Class-based chaining context
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
backtrackClassDef: new r.Pointer(r.uint16, ClassDef),
|
|
inputClassDef: new r.Pointer(r.uint16, ClassDef),
|
|
lookaheadClassDef: new r.Pointer(r.uint16, ClassDef),
|
|
chainCount: r.uint16,
|
|
chainClassSet: new r.Array(new r.Pointer(r.uint16, ChainRuleSet), 'chainCount')
|
|
},
|
|
|
|
3: { // Coverage-based chaining context
|
|
backtrackGlyphCount: r.uint16,
|
|
backtrackCoverage: new r.Array(new r.Pointer(r.uint16, Coverage), 'backtrackGlyphCount'),
|
|
inputGlyphCount: r.uint16,
|
|
inputCoverage: new r.Array(new r.Pointer(r.uint16, Coverage), 'inputGlyphCount'),
|
|
lookaheadGlyphCount: r.uint16,
|
|
lookaheadCoverage: new r.Array(new r.Pointer(r.uint16, Coverage), 'lookaheadGlyphCount'),
|
|
lookupCount: r.uint16,
|
|
lookupRecords: new r.Array(LookupRecord, 'lookupCount')
|
|
}
|
|
});
|
|
|
|
var BaseCoord = new r.VersionedStruct(r.uint16, {
|
|
1: { // Design units only
|
|
coordinate: r.int16 // X or Y value, in design units
|
|
},
|
|
|
|
2: { // Design units plus contour point
|
|
coordinate: r.int16, // X or Y value, in design units
|
|
referenceGlyph: r.uint16, // GlyphID of control glyph
|
|
baseCoordPoint: r.uint16 // Index of contour point on the referenceGlyph
|
|
},
|
|
|
|
3: { // Design units plus Device table
|
|
coordinate: r.int16, // X or Y value, in design units
|
|
deviceTable: new r.Pointer(r.uint16, Device) // Device table for X or Y value
|
|
}
|
|
});
|
|
|
|
var BaseValues = new r.Struct({
|
|
defaultIndex: r.uint16, // Index of default baseline for this script-same index in the BaseTagList
|
|
baseCoordCount: r.uint16,
|
|
baseCoords: new r.Array(new r.Pointer(r.uint16, BaseCoord), 'baseCoordCount')
|
|
});
|
|
|
|
var FeatMinMaxRecord = new r.Struct({
|
|
tag: new r.String(4), // 4-byte feature identification tag-must match FeatureTag in FeatureList
|
|
minCoord: new r.Pointer(r.uint16, BaseCoord, { type: 'parent' }), // May be NULL
|
|
maxCoord: new r.Pointer(r.uint16, BaseCoord, { type: 'parent' }) // May be NULL
|
|
});
|
|
|
|
var MinMax = new r.Struct({
|
|
minCoord: new r.Pointer(r.uint16, BaseCoord), // May be NULL
|
|
maxCoord: new r.Pointer(r.uint16, BaseCoord), // May be NULL
|
|
featMinMaxCount: r.uint16, // May be 0
|
|
featMinMaxRecords: new r.Array(FeatMinMaxRecord, 'featMinMaxCount') // In alphabetical order
|
|
});
|
|
|
|
var BaseLangSysRecord = new r.Struct({
|
|
tag: new r.String(4), // 4-byte language system identification tag
|
|
minMax: new r.Pointer(r.uint16, MinMax, { type: 'parent' })
|
|
});
|
|
|
|
var BaseScript = new r.Struct({
|
|
baseValues: new r.Pointer(r.uint16, BaseValues), // May be NULL
|
|
defaultMinMax: new r.Pointer(r.uint16, MinMax), // May be NULL
|
|
baseLangSysCount: r.uint16, // May be 0
|
|
baseLangSysRecords: new r.Array(BaseLangSysRecord, 'baseLangSysCount') // in alphabetical order by BaseLangSysTag
|
|
});
|
|
|
|
var BaseScriptRecord = new r.Struct({
|
|
tag: new r.String(4), // 4-byte script identification tag
|
|
script: new r.Pointer(r.uint16, BaseScript, { type: 'parent' })
|
|
});
|
|
|
|
var BaseScriptList = new r.Array(BaseScriptRecord, r.uint16);
|
|
|
|
// Array of 4-byte baseline identification tags-must be in alphabetical order
|
|
var BaseTagList = new r.Array(new r.String(4), r.uint16);
|
|
|
|
var Axis = new r.Struct({
|
|
baseTagList: new r.Pointer(r.uint16, BaseTagList), // May be NULL
|
|
baseScriptList: new r.Pointer(r.uint16, BaseScriptList)
|
|
});
|
|
|
|
var BASE = new r.Struct({
|
|
version: r.uint32, // Version of the BASE table-initially 0x00010000
|
|
horizAxis: new r.Pointer(r.uint16, Axis), // May be NULL
|
|
vertAxis: new r.Pointer(r.uint16, Axis) // May be NULL
|
|
});
|
|
|
|
var AttachPoint = new r.Array(r.uint16, r.uint16);
|
|
var AttachList = new r.Struct({
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
glyphCount: r.uint16,
|
|
attachPoints: new r.Array(new r.Pointer(r.uint16, AttachPoint), 'glyphCount')
|
|
});
|
|
|
|
var CaretValue = new r.VersionedStruct(r.uint16, {
|
|
1: { // Design units only
|
|
coordinate: r.int16
|
|
},
|
|
|
|
2: { // Contour point
|
|
caretValuePoint: r.uint16
|
|
},
|
|
|
|
3: { // Design units plus Device table
|
|
coordinate: r.int16,
|
|
deviceTable: new r.Pointer(r.uint16, Device)
|
|
}
|
|
});
|
|
|
|
var LigGlyph = new r.Array(new r.Pointer(r.uint16, CaretValue), r.uint16);
|
|
|
|
var LigCaretList = new r.Struct({
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
ligGlyphCount: r.uint16,
|
|
ligGlyphs: new r.Array(new r.Pointer(r.uint16, LigGlyph), 'ligGlyphCount')
|
|
});
|
|
|
|
var MarkGlyphSetsDef = new r.Struct({
|
|
markSetTableFormat: r.uint16,
|
|
markSetCount: r.uint16,
|
|
coverage: new r.Array(new r.Pointer(r.uint32, Coverage), 'markSetCount')
|
|
});
|
|
|
|
var GDEF = new r.VersionedStruct(r.uint32, {
|
|
0x00010000: {
|
|
glyphClassDef: new r.Pointer(r.uint16, ClassDef), // 1: base glyph, 2: ligature, 3: mark, 4: component
|
|
attachList: new r.Pointer(r.uint16, AttachList),
|
|
ligCaretList: new r.Pointer(r.uint16, LigCaretList),
|
|
markAttachClassDef: new r.Pointer(r.uint16, ClassDef)
|
|
},
|
|
0x00010002: {
|
|
glyphClassDef: new r.Pointer(r.uint16, ClassDef),
|
|
attachList: new r.Pointer(r.uint16, AttachList),
|
|
ligCaretList: new r.Pointer(r.uint16, LigCaretList),
|
|
markAttachClassDef: new r.Pointer(r.uint16, ClassDef),
|
|
markGlyphSetsDef: new r.Pointer(r.uint16, MarkGlyphSetsDef)
|
|
}
|
|
});
|
|
|
|
var ValueFormat = new r.Bitfield(r.uint16, ['xPlacement', 'yPlacement', 'xAdvance', 'yAdvance', 'xPlaDevice', 'yPlaDevice', 'xAdvDevice', 'yAdvDevice']);
|
|
|
|
var types = {
|
|
xPlacement: r.int16,
|
|
yPlacement: r.int16,
|
|
xAdvance: r.int16,
|
|
yAdvance: r.int16,
|
|
xPlaDevice: new r.Pointer(r.uint16, Device, { type: 'global', relativeTo: 'rel' }),
|
|
yPlaDevice: new r.Pointer(r.uint16, Device, { type: 'global', relativeTo: 'rel' }),
|
|
xAdvDevice: new r.Pointer(r.uint16, Device, { type: 'global', relativeTo: 'rel' }),
|
|
yAdvDevice: new r.Pointer(r.uint16, Device, { type: 'global', relativeTo: 'rel' })
|
|
};
|
|
|
|
var ValueRecord = function () {
|
|
function ValueRecord() {
|
|
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'valueFormat';
|
|
|
|
_classCallCheck(this, ValueRecord);
|
|
|
|
this.key = key;
|
|
}
|
|
|
|
_createClass(ValueRecord, [{
|
|
key: 'buildStruct',
|
|
value: function buildStruct(parent) {
|
|
var struct = parent;
|
|
while (!struct[this.key] && struct.parent) {
|
|
struct = struct.parent;
|
|
}
|
|
|
|
if (!struct[this.key]) return;
|
|
|
|
var fields = {};
|
|
fields.rel = function () {
|
|
return struct._startOffset;
|
|
};
|
|
|
|
var format = struct[this.key];
|
|
for (var key in format) {
|
|
if (format[key]) {
|
|
fields[key] = types[key];
|
|
}
|
|
}
|
|
|
|
return new r.Struct(fields);
|
|
}
|
|
}, {
|
|
key: 'size',
|
|
value: function size(val, ctx) {
|
|
return this.buildStruct(ctx).size(val, ctx);
|
|
}
|
|
}, {
|
|
key: 'decode',
|
|
value: function decode(stream, parent) {
|
|
var res = this.buildStruct(parent).decode(stream, parent);
|
|
delete res.rel;
|
|
return res;
|
|
}
|
|
}]);
|
|
|
|
return ValueRecord;
|
|
}();
|
|
|
|
var PairValueRecord = new r.Struct({
|
|
secondGlyph: r.uint16,
|
|
value1: new ValueRecord('valueFormat1'),
|
|
value2: new ValueRecord('valueFormat2')
|
|
});
|
|
|
|
var PairSet = new r.Array(PairValueRecord, r.uint16);
|
|
|
|
var Class2Record = new r.Struct({
|
|
value1: new ValueRecord('valueFormat1'),
|
|
value2: new ValueRecord('valueFormat2')
|
|
});
|
|
|
|
var Anchor = new r.VersionedStruct(r.uint16, {
|
|
1: { // Design units only
|
|
xCoordinate: r.int16,
|
|
yCoordinate: r.int16
|
|
},
|
|
|
|
2: { // Design units plus contour point
|
|
xCoordinate: r.int16,
|
|
yCoordinate: r.int16,
|
|
anchorPoint: r.uint16
|
|
},
|
|
|
|
3: { // Design units plus Device tables
|
|
xCoordinate: r.int16,
|
|
yCoordinate: r.int16,
|
|
xDeviceTable: new r.Pointer(r.uint16, Device),
|
|
yDeviceTable: new r.Pointer(r.uint16, Device)
|
|
}
|
|
});
|
|
|
|
var EntryExitRecord = new r.Struct({
|
|
entryAnchor: new r.Pointer(r.uint16, Anchor, { type: 'parent' }),
|
|
exitAnchor: new r.Pointer(r.uint16, Anchor, { type: 'parent' })
|
|
});
|
|
|
|
var MarkRecord = new r.Struct({
|
|
class: r.uint16,
|
|
markAnchor: new r.Pointer(r.uint16, Anchor, { type: 'parent' })
|
|
});
|
|
|
|
var MarkArray = new r.Array(MarkRecord, r.uint16);
|
|
|
|
var BaseRecord = new r.Array(new r.Pointer(r.uint16, Anchor), function (t) {
|
|
return t.parent.classCount;
|
|
});
|
|
var BaseArray = new r.Array(BaseRecord, r.uint16);
|
|
|
|
var ComponentRecord = new r.Array(new r.Pointer(r.uint16, Anchor), function (t) {
|
|
return t.parent.parent.classCount;
|
|
});
|
|
var LigatureAttach = new r.Array(ComponentRecord, r.uint16);
|
|
var LigatureArray = new r.Array(new r.Pointer(r.uint16, LigatureAttach), r.uint16);
|
|
|
|
var GPOSLookup = new r.VersionedStruct('lookupType', {
|
|
1: new r.VersionedStruct(r.uint16, { // Single Adjustment
|
|
1: { // Single positioning value
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
valueFormat: ValueFormat,
|
|
value: new ValueRecord()
|
|
},
|
|
2: {
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
valueFormat: ValueFormat,
|
|
valueCount: r.uint16,
|
|
values: new r.LazyArray(new ValueRecord(), 'valueCount')
|
|
}
|
|
}),
|
|
|
|
2: new r.VersionedStruct(r.uint16, { // Pair Adjustment Positioning
|
|
1: { // Adjustments for glyph pairs
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
valueFormat1: ValueFormat,
|
|
valueFormat2: ValueFormat,
|
|
pairSetCount: r.uint16,
|
|
pairSets: new r.LazyArray(new r.Pointer(r.uint16, PairSet), 'pairSetCount')
|
|
},
|
|
|
|
2: { // Class pair adjustment
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
valueFormat1: ValueFormat,
|
|
valueFormat2: ValueFormat,
|
|
classDef1: new r.Pointer(r.uint16, ClassDef),
|
|
classDef2: new r.Pointer(r.uint16, ClassDef),
|
|
class1Count: r.uint16,
|
|
class2Count: r.uint16,
|
|
classRecords: new r.LazyArray(new r.LazyArray(Class2Record, 'class2Count'), 'class1Count')
|
|
}
|
|
}),
|
|
|
|
3: { // Cursive Attachment Positioning
|
|
format: r.uint16,
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
entryExitCount: r.uint16,
|
|
entryExitRecords: new r.Array(EntryExitRecord, 'entryExitCount')
|
|
},
|
|
|
|
4: { // MarkToBase Attachment Positioning
|
|
format: r.uint16,
|
|
markCoverage: new r.Pointer(r.uint16, Coverage),
|
|
baseCoverage: new r.Pointer(r.uint16, Coverage),
|
|
classCount: r.uint16,
|
|
markArray: new r.Pointer(r.uint16, MarkArray),
|
|
baseArray: new r.Pointer(r.uint16, BaseArray)
|
|
},
|
|
|
|
5: { // MarkToLigature Attachment Positioning
|
|
format: r.uint16,
|
|
markCoverage: new r.Pointer(r.uint16, Coverage),
|
|
ligatureCoverage: new r.Pointer(r.uint16, Coverage),
|
|
classCount: r.uint16,
|
|
markArray: new r.Pointer(r.uint16, MarkArray),
|
|
ligatureArray: new r.Pointer(r.uint16, LigatureArray)
|
|
},
|
|
|
|
6: { // MarkToMark Attachment Positioning
|
|
format: r.uint16,
|
|
mark1Coverage: new r.Pointer(r.uint16, Coverage),
|
|
mark2Coverage: new r.Pointer(r.uint16, Coverage),
|
|
classCount: r.uint16,
|
|
mark1Array: new r.Pointer(r.uint16, MarkArray),
|
|
mark2Array: new r.Pointer(r.uint16, BaseArray)
|
|
},
|
|
|
|
7: Context, // Contextual positioning
|
|
8: ChainingContext, // Chaining contextual positioning
|
|
|
|
9: { // Extension Positioning
|
|
posFormat: r.uint16,
|
|
lookupType: r.uint16, // cannot also be 9
|
|
extension: new r.Pointer(r.uint32, GPOSLookup)
|
|
}
|
|
});
|
|
|
|
// Fix circular reference
|
|
GPOSLookup.versions[9].extension.type = GPOSLookup;
|
|
|
|
var GPOS = new r.Struct({
|
|
version: r.int32,
|
|
scriptList: new r.Pointer(r.uint16, ScriptList),
|
|
featureList: new r.Pointer(r.uint16, FeatureList),
|
|
lookupList: new r.Pointer(r.uint16, new LookupList(GPOSLookup))
|
|
});
|
|
|
|
var Sequence = new r.Array(r.uint16, r.uint16);
|
|
var AlternateSet = Sequence;
|
|
|
|
var Ligature = new r.Struct({
|
|
glyph: r.uint16,
|
|
compCount: r.uint16,
|
|
components: new r.Array(r.uint16, function (t) {
|
|
return t.compCount - 1;
|
|
})
|
|
});
|
|
|
|
var LigatureSet = new r.Array(new r.Pointer(r.uint16, Ligature), r.uint16);
|
|
|
|
var GSUBLookup = new r.VersionedStruct('lookupType', {
|
|
1: new r.VersionedStruct(r.uint16, { // Single Substitution
|
|
1: {
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
deltaGlyphID: r.int16
|
|
},
|
|
2: {
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
glyphCount: r.uint16,
|
|
substitute: new r.LazyArray(r.uint16, 'glyphCount')
|
|
}
|
|
}),
|
|
|
|
2: { // Multiple Substitution
|
|
substFormat: r.uint16,
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
count: r.uint16,
|
|
sequences: new r.LazyArray(new r.Pointer(r.uint16, Sequence), 'count')
|
|
},
|
|
|
|
3: { // Alternate Substitution
|
|
substFormat: r.uint16,
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
count: r.uint16,
|
|
alternateSet: new r.LazyArray(new r.Pointer(r.uint16, AlternateSet), 'count')
|
|
},
|
|
|
|
4: { // Ligature Substitution
|
|
substFormat: r.uint16,
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
count: r.uint16,
|
|
ligatureSets: new r.LazyArray(new r.Pointer(r.uint16, LigatureSet), 'count')
|
|
},
|
|
|
|
5: Context, // Contextual Substitution
|
|
6: ChainingContext, // Chaining Contextual Substitution
|
|
|
|
7: { // Extension Substitution
|
|
substFormat: r.uint16,
|
|
lookupType: r.uint16, // cannot also be 7
|
|
extension: new r.Pointer(r.uint32, GSUBLookup)
|
|
},
|
|
|
|
8: { // Reverse Chaining Contextual Single Substitution
|
|
substFormat: r.uint16,
|
|
coverage: new r.Pointer(r.uint16, Coverage),
|
|
backtrackCoverage: new r.Array(new r.Pointer(r.uint16, Coverage), 'backtrackGlyphCount'),
|
|
lookaheadGlyphCount: r.uint16,
|
|
lookaheadCoverage: new r.Array(new r.Pointer(r.uint16, Coverage), 'lookaheadGlyphCount'),
|
|
glyphCount: r.uint16,
|
|
substitutes: new r.Array(r.uint16, 'glyphCount')
|
|
}
|
|
});
|
|
|
|
// Fix circular reference
|
|
GSUBLookup.versions[7].extension.type = GSUBLookup;
|
|
|
|
var GSUB = new r.Struct({
|
|
version: r.int32,
|
|
scriptList: new r.Pointer(r.uint16, ScriptList),
|
|
featureList: new r.Pointer(r.uint16, FeatureList),
|
|
lookupList: new r.Pointer(r.uint16, new LookupList(GSUBLookup))
|
|
});
|
|
|
|
var JstfGSUBModList = new r.Array(r.uint16, r.uint16);
|
|
|
|
var JstfPriority = new r.Struct({
|
|
shrinkageEnableGSUB: new r.Pointer(r.uint16, JstfGSUBModList),
|
|
shrinkageDisableGSUB: new r.Pointer(r.uint16, JstfGSUBModList),
|
|
shrinkageEnableGPOS: new r.Pointer(r.uint16, JstfGSUBModList),
|
|
shrinkageDisableGPOS: new r.Pointer(r.uint16, JstfGSUBModList),
|
|
shrinkageJstfMax: new r.Pointer(r.uint16, new LookupList(GPOSLookup)),
|
|
extensionEnableGSUB: new r.Pointer(r.uint16, JstfGSUBModList),
|
|
extensionDisableGSUB: new r.Pointer(r.uint16, JstfGSUBModList),
|
|
extensionEnableGPOS: new r.Pointer(r.uint16, JstfGSUBModList),
|
|
extensionDisableGPOS: new r.Pointer(r.uint16, JstfGSUBModList),
|
|
extensionJstfMax: new r.Pointer(r.uint16, new LookupList(GPOSLookup))
|
|
});
|
|
|
|
var JstfLangSys = new r.Array(new r.Pointer(r.uint16, JstfPriority), r.uint16);
|
|
|
|
var JstfLangSysRecord = new r.Struct({
|
|
tag: new r.String(4),
|
|
jstfLangSys: new r.Pointer(r.uint16, JstfLangSys)
|
|
});
|
|
|
|
var JstfScript = new r.Struct({
|
|
extenderGlyphs: new r.Pointer(r.uint16, new r.Array(r.uint16, r.uint16)), // array of glyphs to extend line length
|
|
defaultLangSys: new r.Pointer(r.uint16, JstfLangSys),
|
|
langSysCount: r.uint16,
|
|
langSysRecords: new r.Array(JstfLangSysRecord, 'langSysCount')
|
|
});
|
|
|
|
var JstfScriptRecord = new r.Struct({
|
|
tag: new r.String(4),
|
|
script: new r.Pointer(r.uint16, JstfScript, { type: 'parent' })
|
|
});
|
|
|
|
var JSTF = new r.Struct({
|
|
version: r.uint32, // should be 0x00010000
|
|
scriptCount: r.uint16,
|
|
scriptList: new r.Array(JstfScriptRecord, 'scriptCount')
|
|
});
|
|
|
|
var Signature = new r.Struct({
|
|
format: r.uint32,
|
|
length: r.uint32,
|
|
offset: r.uint32
|
|
});
|
|
|
|
var SignatureBlock = new r.Struct({
|
|
reserved: new r.Reserved(r.uint16, 2),
|
|
cbSignature: r.uint32, // Length (in bytes) of the PKCS#7 packet in pbSignature
|
|
signature: new r.Buffer('cbSignature')
|
|
});
|
|
|
|
var DSIG = new r.Struct({
|
|
ulVersion: r.uint32, // Version number of the DSIG table (0x00000001)
|
|
usNumSigs: r.uint16, // Number of signatures in the table
|
|
usFlag: r.uint16, // Permission flags
|
|
signatures: new r.Array(Signature, 'usNumSigs'),
|
|
signatureBlocks: new r.Array(SignatureBlock, 'usNumSigs')
|
|
});
|
|
|
|
var GaspRange = new r.Struct({
|
|
rangeMaxPPEM: r.uint16, // Upper limit of range, in ppem
|
|
rangeGaspBehavior: new r.Bitfield(r.uint16, [// Flags describing desired rasterizer behavior
|
|
'grayscale', 'gridfit', 'symmetricSmoothing', 'symmetricGridfit' // only in version 1, for ClearType
|
|
])
|
|
});
|
|
|
|
var gasp = new r.Struct({
|
|
version: r.uint16, // set to 0
|
|
numRanges: r.uint16,
|
|
gaspRanges: new r.Array(GaspRange, 'numRanges') // Sorted by ppem
|
|
});
|
|
|
|
var DeviceRecord = new r.Struct({
|
|
pixelSize: r.uint8,
|
|
maximumWidth: r.uint8,
|
|
widths: new r.Array(r.uint8, function (t) {
|
|
return t.parent.parent.maxp.numGlyphs;
|
|
})
|
|
});
|
|
|
|
// The Horizontal Device Metrics table stores integer advance widths scaled to particular pixel sizes
|
|
var hdmx = new r.Struct({
|
|
version: r.uint16,
|
|
numRecords: r.int16,
|
|
sizeDeviceRecord: r.int32,
|
|
records: new r.Array(DeviceRecord, 'numRecords')
|
|
});
|
|
|
|
var KernPair = new r.Struct({
|
|
left: r.uint16,
|
|
right: r.uint16,
|
|
value: r.int16
|
|
});
|
|
|
|
var ClassTable = new r.Struct({
|
|
firstGlyph: r.uint16,
|
|
nGlyphs: r.uint16,
|
|
offsets: new r.Array(r.uint16, 'nGlyphs'),
|
|
max: function max(t) {
|
|
return t.offsets.length && Math.max.apply(Math, t.offsets);
|
|
}
|
|
});
|
|
|
|
var Kern2Array = new r.Struct({
|
|
off: function off(t) {
|
|
return t._startOffset - t.parent.parent._startOffset;
|
|
},
|
|
len: function len(t) {
|
|
return ((t.parent.leftTable.max - t.off) / t.parent.rowWidth + 1) * (t.parent.rowWidth / 2);
|
|
},
|
|
values: new r.LazyArray(r.int16, 'len')
|
|
});
|
|
|
|
var KernSubtable = new r.VersionedStruct('format', {
|
|
0: {
|
|
nPairs: r.uint16,
|
|
searchRange: r.uint16,
|
|
entrySelector: r.uint16,
|
|
rangeShift: r.uint16,
|
|
pairs: new r.Array(KernPair, 'nPairs')
|
|
},
|
|
|
|
2: {
|
|
rowWidth: r.uint16,
|
|
leftTable: new r.Pointer(r.uint16, ClassTable, { type: 'parent' }),
|
|
rightTable: new r.Pointer(r.uint16, ClassTable, { type: 'parent' }),
|
|
array: new r.Pointer(r.uint16, Kern2Array, { type: 'parent' })
|
|
},
|
|
|
|
3: {
|
|
glyphCount: r.uint16,
|
|
kernValueCount: r.uint8,
|
|
leftClassCount: r.uint8,
|
|
rightClassCount: r.uint8,
|
|
flags: r.uint8,
|
|
kernValue: new r.Array(r.int16, 'kernValueCount'),
|
|
leftClass: new r.Array(r.uint8, 'glyphCount'),
|
|
rightClass: new r.Array(r.uint8, 'glyphCount'),
|
|
kernIndex: new r.Array(r.uint8, function (t) {
|
|
return t.leftClassCount * t.rightClassCount;
|
|
})
|
|
}
|
|
});
|
|
|
|
var KernTable = new r.VersionedStruct('version', {
|
|
0: { // Microsoft uses this format
|
|
subVersion: r.uint16, // Microsoft has an extra sub-table version number
|
|
length: r.uint16, // Length of the subtable, in bytes
|
|
format: r.uint8, // Format of subtable
|
|
coverage: new r.Bitfield(r.uint8, ['horizontal', // 1 if table has horizontal data, 0 if vertical
|
|
'minimum', // If set to 1, the table has minimum values. If set to 0, the table has kerning values.
|
|
'crossStream', // If set to 1, kerning is perpendicular to the flow of the text
|
|
'override' // If set to 1 the value in this table replaces the accumulated value
|
|
]),
|
|
subtable: KernSubtable,
|
|
padding: new r.Reserved(r.uint8, function (t) {
|
|
return t.length - t._currentOffset;
|
|
})
|
|
},
|
|
1: { // Apple uses this format
|
|
length: r.uint32,
|
|
coverage: new r.Bitfield(r.uint8, [null, null, null, null, null, 'variation', // Set if table has variation kerning values
|
|
'crossStream', // Set if table has cross-stream kerning values
|
|
'vertical' // Set if table has vertical kerning values
|
|
]),
|
|
format: r.uint8,
|
|
tupleIndex: r.uint16,
|
|
subtable: KernSubtable,
|
|
padding: new r.Reserved(r.uint8, function (t) {
|
|
return t.length - t._currentOffset;
|
|
})
|
|
}
|
|
});
|
|
|
|
var kern = new r.VersionedStruct(r.uint16, {
|
|
0: { // Microsoft Version
|
|
nTables: r.uint16,
|
|
tables: new r.Array(KernTable, 'nTables')
|
|
},
|
|
|
|
1: { // Apple Version
|
|
reserved: new r.Reserved(r.uint16), // the other half of the version number
|
|
nTables: r.uint32,
|
|
tables: new r.Array(KernTable, 'nTables')
|
|
}
|
|
});
|
|
|
|
// Linear Threshold table
|
|
// Records the ppem for each glyph at which the scaling becomes linear again,
|
|
// despite instructions effecting the advance width
|
|
var LTSH = new r.Struct({
|
|
version: r.uint16,
|
|
numGlyphs: r.uint16,
|
|
yPels: new r.Array(r.uint8, 'numGlyphs')
|
|
});
|
|
|
|
// PCL 5 Table
|
|
// NOTE: The PCLT table is strongly discouraged for OpenType fonts with TrueType outlines
|
|
var PCLT = new r.Struct({
|
|
version: r.uint16,
|
|
fontNumber: r.uint32,
|
|
pitch: r.uint16,
|
|
xHeight: r.uint16,
|
|
style: r.uint16,
|
|
typeFamily: r.uint16,
|
|
capHeight: r.uint16,
|
|
symbolSet: r.uint16,
|
|
typeface: new r.String(16),
|
|
characterComplement: new r.String(8),
|
|
fileName: new r.String(6),
|
|
strokeWeight: new r.String(1),
|
|
widthType: new r.String(1),
|
|
serifStyle: r.uint8,
|
|
reserved: new r.Reserved(r.uint8)
|
|
});
|
|
|
|
// VDMX tables contain ascender/descender overrides for certain (usually small)
|
|
// sizes. This is needed in order to match font metrics on Windows.
|
|
|
|
var Ratio = new r.Struct({
|
|
bCharSet: r.uint8, // Character set
|
|
xRatio: r.uint8, // Value to use for x-Ratio
|
|
yStartRatio: r.uint8, // Starting y-Ratio value
|
|
yEndRatio: r.uint8 // Ending y-Ratio value
|
|
});
|
|
|
|
var vTable = new r.Struct({
|
|
yPelHeight: r.uint16, // yPelHeight to which values apply
|
|
yMax: r.int16, // Maximum value (in pels) for this yPelHeight
|
|
yMin: r.int16 // Minimum value (in pels) for this yPelHeight
|
|
});
|
|
|
|
var VdmxGroup = new r.Struct({
|
|
recs: r.uint16, // Number of height records in this group
|
|
startsz: r.uint8, // Starting yPelHeight
|
|
endsz: r.uint8, // Ending yPelHeight
|
|
entries: new r.Array(vTable, 'recs') // The VDMX records
|
|
});
|
|
|
|
var VDMX = new r.Struct({
|
|
version: r.uint16, // Version number (0 or 1)
|
|
numRecs: r.uint16, // Number of VDMX groups present
|
|
numRatios: r.uint16, // Number of aspect ratio groupings
|
|
ratioRanges: new r.Array(Ratio, 'numRatios'), // Ratio ranges
|
|
offsets: new r.Array(r.uint16, 'numRatios'), // Offset to the VDMX group for this ratio range
|
|
groups: new r.Array(VdmxGroup, 'numRecs') // The actual VDMX groupings
|
|
});
|
|
|
|
// Vertical Header Table
|
|
var vhea = new r.Struct({
|
|
version: r.uint16, // Version number of the Vertical Header Table
|
|
ascent: r.int16, // The vertical typographic ascender for this font
|
|
descent: r.int16, // The vertical typographic descender for this font
|
|
lineGap: r.int16, // The vertical typographic line gap for this font
|
|
advanceHeightMax: r.int16, // The maximum advance height measurement found in the font
|
|
minTopSideBearing: r.int16, // The minimum top side bearing measurement found in the font
|
|
minBottomSideBearing: r.int16, // The minimum bottom side bearing measurement found in the font
|
|
yMaxExtent: r.int16,
|
|
caretSlopeRise: r.int16, // Caret slope (rise/run)
|
|
caretSlopeRun: r.int16,
|
|
caretOffset: r.int16, // Set value equal to 0 for nonslanted fonts
|
|
reserved: new r.Reserved(r.int16, 4),
|
|
metricDataFormat: r.int16, // Set to 0
|
|
numberOfMetrics: r.uint16 // Number of advance heights in the Vertical Metrics table
|
|
});
|
|
|
|
var VmtxEntry = new r.Struct({
|
|
advance: r.uint16, // The advance height of the glyph
|
|
bearing: r.int16 // The top sidebearing of the glyph
|
|
});
|
|
|
|
// Vertical Metrics Table
|
|
var vmtx = new r.Struct({
|
|
metrics: new r.LazyArray(VmtxEntry, function (t) {
|
|
return t.parent.vhea.numberOfMetrics;
|
|
}),
|
|
bearings: new r.LazyArray(r.int16, function (t) {
|
|
return t.parent.maxp.numGlyphs - t.parent.vhea.numberOfMetrics;
|
|
})
|
|
});
|
|
|
|
var shortFrac = new r.Fixed(16, 'BE', 14);
|
|
|
|
var Correspondence = new r.Struct({
|
|
fromCoord: shortFrac,
|
|
toCoord: shortFrac
|
|
});
|
|
|
|
var Segment = new r.Struct({
|
|
pairCount: r.uint16,
|
|
correspondence: new r.Array(Correspondence, 'pairCount')
|
|
});
|
|
|
|
var avar = new r.Struct({
|
|
version: r.fixed32,
|
|
axisCount: r.uint32,
|
|
segment: new r.Array(Segment, 'axisCount')
|
|
});
|
|
|
|
var UnboundedArrayAccessor = function () {
|
|
function UnboundedArrayAccessor(type, stream, parent) {
|
|
_classCallCheck(this, UnboundedArrayAccessor);
|
|
|
|
this.type = type;
|
|
this.stream = stream;
|
|
this.parent = parent;
|
|
this.base = this.stream.pos;
|
|
this._items = [];
|
|
}
|
|
|
|
_createClass(UnboundedArrayAccessor, [{
|
|
key: 'getItem',
|
|
value: function getItem(index) {
|
|
if (this._items[index] == null) {
|
|
var pos = this.stream.pos;
|
|
this.stream.pos = this.base + this.type.size(null, this.parent) * index;
|
|
this._items[index] = this.type.decode(this.stream, this.parent);
|
|
this.stream.pos = pos;
|
|
}
|
|
|
|
return this._items[index];
|
|
}
|
|
}, {
|
|
key: 'inspect',
|
|
value: function inspect() {
|
|
return '[UnboundedArray ' + this.type.constructor.name + ']';
|
|
}
|
|
}]);
|
|
|
|
return UnboundedArrayAccessor;
|
|
}();
|
|
|
|
var UnboundedArray = function (_r$Array) {
|
|
_inherits(UnboundedArray, _r$Array);
|
|
|
|
function UnboundedArray(type) {
|
|
_classCallCheck(this, UnboundedArray);
|
|
|
|
return _possibleConstructorReturn(this, (UnboundedArray.__proto__ || _Object$getPrototypeOf(UnboundedArray)).call(this, type, 0));
|
|
}
|
|
|
|
_createClass(UnboundedArray, [{
|
|
key: 'decode',
|
|
value: function decode(stream, parent) {
|
|
return new UnboundedArrayAccessor(this.type, stream, parent);
|
|
}
|
|
}]);
|
|
|
|
return UnboundedArray;
|
|
}(r.Array);
|
|
|
|
var LookupTable = function LookupTable() {
|
|
var ValueType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : r.uint16;
|
|
|
|
// Helper class that makes internal structures invisible to pointers
|
|
var Shadow = function () {
|
|
function Shadow(type) {
|
|
_classCallCheck(this, Shadow);
|
|
|
|
this.type = type;
|
|
}
|
|
|
|
_createClass(Shadow, [{
|
|
key: 'decode',
|
|
value: function decode(stream, ctx) {
|
|
ctx = ctx.parent.parent;
|
|
return this.type.decode(stream, ctx);
|
|
}
|
|
}, {
|
|
key: 'size',
|
|
value: function size(val, ctx) {
|
|
ctx = ctx.parent.parent;
|
|
return this.type.size(val, ctx);
|
|
}
|
|
}, {
|
|
key: 'encode',
|
|
value: function encode(stream, val, ctx) {
|
|
ctx = ctx.parent.parent;
|
|
return this.type.encode(stream, val, ctx);
|
|
}
|
|
}]);
|
|
|
|
return Shadow;
|
|
}();
|
|
|
|
ValueType = new Shadow(ValueType);
|
|
|
|
var BinarySearchHeader = new r.Struct({
|
|
unitSize: r.uint16,
|
|
nUnits: r.uint16,
|
|
searchRange: r.uint16,
|
|
entrySelector: r.uint16,
|
|
rangeShift: r.uint16
|
|
});
|
|
|
|
var LookupSegmentSingle = new r.Struct({
|
|
lastGlyph: r.uint16,
|
|
firstGlyph: r.uint16,
|
|
value: ValueType
|
|
});
|
|
|
|
var LookupSegmentArray = new r.Struct({
|
|
lastGlyph: r.uint16,
|
|
firstGlyph: r.uint16,
|
|
values: new r.Pointer(r.uint16, new r.Array(ValueType, function (t) {
|
|
return t.lastGlyph - t.firstGlyph + 1;
|
|
}), { type: 'parent' })
|
|
});
|
|
|
|
var LookupSingle = new r.Struct({
|
|
glyph: r.uint16,
|
|
value: ValueType
|
|
});
|
|
|
|
return new r.VersionedStruct(r.uint16, {
|
|
0: {
|
|
values: new UnboundedArray(ValueType) // length == number of glyphs maybe?
|
|
},
|
|
2: {
|
|
binarySearchHeader: BinarySearchHeader,
|
|
segments: new r.Array(LookupSegmentSingle, function (t) {
|
|
return t.binarySearchHeader.nUnits;
|
|
})
|
|
},
|
|
4: {
|
|
binarySearchHeader: BinarySearchHeader,
|
|
segments: new r.Array(LookupSegmentArray, function (t) {
|
|
return t.binarySearchHeader.nUnits;
|
|
})
|
|
},
|
|
6: {
|
|
binarySearchHeader: BinarySearchHeader,
|
|
segments: new r.Array(LookupSingle, function (t) {
|
|
return t.binarySearchHeader.nUnits;
|
|
})
|
|
},
|
|
8: {
|
|
firstGlyph: r.uint16,
|
|
count: r.uint16,
|
|
values: new r.Array(ValueType, 'count')
|
|
}
|
|
});
|
|
};
|
|
|
|
function StateTable() {
|
|
var entryData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
var lookupType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : r.uint16;
|
|
|
|
var entry = _Object$assign({
|
|
newState: r.uint16,
|
|
flags: r.uint16
|
|
}, entryData);
|
|
|
|
var Entry = new r.Struct(entry);
|
|
var StateArray = new UnboundedArray(new r.Array(r.uint16, function (t) {
|
|
return t.nClasses;
|
|
}));
|
|
|
|
var StateHeader = new r.Struct({
|
|
nClasses: r.uint32,
|
|
classTable: new r.Pointer(r.uint32, new LookupTable(lookupType)),
|
|
stateArray: new r.Pointer(r.uint32, StateArray),
|
|
entryTable: new r.Pointer(r.uint32, new UnboundedArray(Entry))
|
|
});
|
|
|
|
return StateHeader;
|
|
}
|
|
|
|
// This is the old version of the StateTable structure
|
|
function StateTable1() {
|
|
var entryData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
var lookupType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : r.uint16;
|
|
|
|
var ClassLookupTable = new r.Struct({
|
|
version: function version() {
|
|
return 8;
|
|
},
|
|
// simulate LookupTable
|
|
firstGlyph: r.uint16,
|
|
values: new r.Array(r.uint8, r.uint16)
|
|
});
|
|
|
|
var entry = _Object$assign({
|
|
newStateOffset: r.uint16,
|
|
// convert offset to stateArray index
|
|
newState: function newState(t) {
|
|
return (t.newStateOffset - (t.parent.stateArray.base - t.parent._startOffset)) / t.parent.nClasses;
|
|
},
|
|
flags: r.uint16
|
|
}, entryData);
|
|
|
|
var Entry = new r.Struct(entry);
|
|
var StateArray = new UnboundedArray(new r.Array(r.uint8, function (t) {
|
|
return t.nClasses;
|
|
}));
|
|
|
|
var StateHeader1 = new r.Struct({
|
|
nClasses: r.uint16,
|
|
classTable: new r.Pointer(r.uint16, ClassLookupTable),
|
|
stateArray: new r.Pointer(r.uint16, StateArray),
|
|
entryTable: new r.Pointer(r.uint16, new UnboundedArray(Entry))
|
|
});
|
|
|
|
return StateHeader1;
|
|
}
|
|
|
|
var BslnSubtable = new r.VersionedStruct('format', {
|
|
0: { // Distance-based, no mapping
|
|
deltas: new r.Array(r.int16, 32)
|
|
},
|
|
|
|
1: { // Distance-based, with mapping
|
|
deltas: new r.Array(r.int16, 32),
|
|
mappingData: new LookupTable(r.uint16)
|
|
},
|
|
|
|
2: { // Control point-based, no mapping
|
|
standardGlyph: r.uint16,
|
|
controlPoints: new r.Array(r.uint16, 32)
|
|
},
|
|
|
|
3: { // Control point-based, with mapping
|
|
standardGlyph: r.uint16,
|
|
controlPoints: new r.Array(r.uint16, 32),
|
|
mappingData: new LookupTable(r.uint16)
|
|
}
|
|
});
|
|
|
|
var bsln = new r.Struct({
|
|
version: r.fixed32,
|
|
format: r.uint16,
|
|
defaultBaseline: r.uint16,
|
|
subtable: BslnSubtable
|
|
});
|
|
|
|
var Setting = new r.Struct({
|
|
setting: r.uint16,
|
|
nameIndex: r.int16,
|
|
name: function name(t) {
|
|
return t.parent.parent.parent.name.records.fontFeatures[t.nameIndex];
|
|
}
|
|
});
|
|
|
|
var FeatureName = new r.Struct({
|
|
feature: r.uint16,
|
|
nSettings: r.uint16,
|
|
settingTable: new r.Pointer(r.uint32, new r.Array(Setting, 'nSettings'), { type: 'parent' }),
|
|
featureFlags: new r.Bitfield(r.uint8, [null, null, null, null, null, null, 'hasDefault', 'exclusive']),
|
|
defaultSetting: r.uint8,
|
|
nameIndex: r.int16,
|
|
name: function name(t) {
|
|
return t.parent.parent.name.records.fontFeatures[t.nameIndex];
|
|
}
|
|
});
|
|
|
|
var feat = new r.Struct({
|
|
version: r.fixed32,
|
|
featureNameCount: r.uint16,
|
|
reserved1: new r.Reserved(r.uint16),
|
|
reserved2: new r.Reserved(r.uint32),
|
|
featureNames: new r.Array(FeatureName, 'featureNameCount')
|
|
});
|
|
|
|
var Axis$1 = new r.Struct({
|
|
axisTag: new r.String(4),
|
|
minValue: r.fixed32,
|
|
defaultValue: r.fixed32,
|
|
maxValue: r.fixed32,
|
|
flags: r.uint16,
|
|
nameID: r.uint16,
|
|
name: function name(t) {
|
|
return t.parent.parent.name.records.fontFeatures[t.nameID];
|
|
}
|
|
});
|
|
|
|
var Instance = new r.Struct({
|
|
nameID: r.uint16,
|
|
name: function name(t) {
|
|
return t.parent.parent.name.records.fontFeatures[t.nameID];
|
|
},
|
|
flags: r.uint16,
|
|
coord: new r.Array(r.fixed32, function (t) {
|
|
return t.parent.axisCount;
|
|
})
|
|
});
|
|
|
|
var fvar = new r.Struct({
|
|
version: r.fixed32,
|
|
offsetToData: r.uint16,
|
|
countSizePairs: r.uint16,
|
|
axisCount: r.uint16,
|
|
axisSize: r.uint16,
|
|
instanceCount: r.uint16,
|
|
instanceSize: r.uint16,
|
|
axis: new r.Array(Axis$1, 'axisCount'),
|
|
instance: new r.Array(Instance, 'instanceCount')
|
|
});
|
|
|
|
var shortFrac$1 = new r.Fixed(16, 'BE', 14);
|
|
|
|
var Offset = function () {
|
|
function Offset() {
|
|
_classCallCheck(this, Offset);
|
|
}
|
|
|
|
_createClass(Offset, null, [{
|
|
key: 'decode',
|
|
value: function decode(stream, parent) {
|
|
// In short format, offsets are multiplied by 2.
|
|
// This doesn't seem to be documented by Apple, but it
|
|
// is implemented this way in Freetype.
|
|
return parent.flags ? stream.readUInt32BE() : stream.readUInt16BE() * 2;
|
|
}
|
|
}]);
|
|
|
|
return Offset;
|
|
}();
|
|
|
|
var gvar = new r.Struct({
|
|
version: r.uint16,
|
|
reserved: new r.Reserved(r.uint16),
|
|
axisCount: r.uint16,
|
|
globalCoordCount: r.uint16,
|
|
globalCoords: new r.Pointer(r.uint32, new r.Array(new r.Array(shortFrac$1, 'axisCount'), 'globalCoordCount')),
|
|
glyphCount: r.uint16,
|
|
flags: r.uint16,
|
|
offsetToData: r.uint32,
|
|
offsets: new r.Array(new r.Pointer(Offset, 'void', { relativeTo: 'offsetToData', allowNull: false }), function (t) {
|
|
return t.glyphCount + 1;
|
|
})
|
|
});
|
|
|
|
var ClassTable$1 = new r.Struct({
|
|
length: r.uint16,
|
|
coverage: r.uint16,
|
|
subFeatureFlags: r.uint32,
|
|
stateTable: new StateTable1()
|
|
});
|
|
|
|
var WidthDeltaRecord = new r.Struct({
|
|
justClass: r.uint32,
|
|
beforeGrowLimit: r.fixed32,
|
|
beforeShrinkLimit: r.fixed32,
|
|
afterGrowLimit: r.fixed32,
|
|
afterShrinkLimit: r.fixed32,
|
|
growFlags: r.uint16,
|
|
shrinkFlags: r.uint16
|
|
});
|
|
|
|
var WidthDeltaCluster = new r.Array(WidthDeltaRecord, r.uint32);
|
|
|
|
var ActionData = new r.VersionedStruct('actionType', {
|
|
0: { // Decomposition action
|
|
lowerLimit: r.fixed32,
|
|
upperLimit: r.fixed32,
|
|
order: r.uint16,
|
|
glyphs: new r.Array(r.uint16, r.uint16)
|
|
},
|
|
|
|
1: { // Unconditional add glyph action
|
|
addGlyph: r.uint16
|
|
},
|
|
|
|
2: { // Conditional add glyph action
|
|
substThreshold: r.fixed32,
|
|
addGlyph: r.uint16,
|
|
substGlyph: r.uint16
|
|
},
|
|
|
|
3: {}, // Stretch glyph action (no data, not supported by CoreText)
|
|
|
|
4: { // Ductile glyph action (not supported by CoreText)
|
|
variationAxis: r.uint32,
|
|
minimumLimit: r.fixed32,
|
|
noStretchValue: r.fixed32,
|
|
maximumLimit: r.fixed32
|
|
},
|
|
|
|
5: { // Repeated add glyph action
|
|
flags: r.uint16,
|
|
glyph: r.uint16
|
|
}
|
|
});
|
|
|
|
var Action = new r.Struct({
|
|
actionClass: r.uint16,
|
|
actionType: r.uint16,
|
|
actionLength: r.uint32,
|
|
actionData: ActionData,
|
|
padding: new r.Reserved(r.uint8, function (t) {
|
|
return t.actionLength - t._currentOffset;
|
|
})
|
|
});
|
|
|
|
var PostcompensationAction = new r.Array(Action, r.uint32);
|
|
var PostCompensationTable = new r.Struct({
|
|
lookupTable: new LookupTable(new r.Pointer(r.uint16, PostcompensationAction))
|
|
});
|
|
|
|
var JustificationTable = new r.Struct({
|
|
classTable: new r.Pointer(r.uint16, ClassTable$1, { type: 'parent' }),
|
|
wdcOffset: r.uint16,
|
|
postCompensationTable: new r.Pointer(r.uint16, PostCompensationTable, { type: 'parent' }),
|
|
widthDeltaClusters: new LookupTable(new r.Pointer(r.uint16, WidthDeltaCluster, { type: 'parent', relativeTo: 'wdcOffset' }))
|
|
});
|
|
|
|
var just = new r.Struct({
|
|
version: r.uint32,
|
|
format: r.uint16,
|
|
horizontal: new r.Pointer(r.uint16, JustificationTable),
|
|
vertical: new r.Pointer(r.uint16, JustificationTable)
|
|
});
|
|
|
|
var LigatureData = {
|
|
action: r.uint16
|
|
};
|
|
|
|
var ContextualData = {
|
|
markIndex: r.uint16,
|
|
currentIndex: r.uint16
|
|
};
|
|
|
|
var InsertionData = {
|
|
currentInsertIndex: r.uint16,
|
|
markedInsertIndex: r.uint16
|
|
};
|
|
|
|
var SubstitutionTable = new r.Struct({
|
|
items: new UnboundedArray(new r.Pointer(r.uint32, new LookupTable()))
|
|
});
|
|
|
|
var SubtableData = new r.VersionedStruct('type', {
|
|
0: { // Indic Rearrangement Subtable
|
|
stateTable: new StateTable()
|
|
},
|
|
|
|
1: { // Contextual Glyph Substitution Subtable
|
|
stateTable: new StateTable(ContextualData),
|
|
substitutionTable: new r.Pointer(r.uint32, SubstitutionTable)
|
|
},
|
|
|
|
2: { // Ligature subtable
|
|
stateTable: new StateTable(LigatureData),
|
|
ligatureActions: new r.Pointer(r.uint32, new UnboundedArray(r.uint32)),
|
|
components: new r.Pointer(r.uint32, new UnboundedArray(r.uint16)),
|
|
ligatureList: new r.Pointer(r.uint32, new UnboundedArray(r.uint16))
|
|
},
|
|
|
|
4: { // Non-contextual Glyph Substitution Subtable
|
|
lookupTable: new LookupTable()
|
|
},
|
|
|
|
5: { // Glyph Insertion Subtable
|
|
stateTable: new StateTable(InsertionData),
|
|
insertionActions: new r.Pointer(r.uint32, new UnboundedArray(r.uint16))
|
|
}
|
|
});
|
|
|
|
var Subtable = new r.Struct({
|
|
length: r.uint32,
|
|
coverage: r.uint24,
|
|
type: r.uint8,
|
|
subFeatureFlags: r.uint32,
|
|
table: SubtableData,
|
|
padding: new r.Reserved(r.uint8, function (t) {
|
|
return t.length - t._currentOffset;
|
|
})
|
|
});
|
|
|
|
var FeatureEntry = new r.Struct({
|
|
featureType: r.uint16,
|
|
featureSetting: r.uint16,
|
|
enableFlags: r.uint32,
|
|
disableFlags: r.uint32
|
|
});
|
|
|
|
var MorxChain = new r.Struct({
|
|
defaultFlags: r.uint32,
|
|
chainLength: r.uint32,
|
|
nFeatureEntries: r.uint32,
|
|
nSubtables: r.uint32,
|
|
features: new r.Array(FeatureEntry, 'nFeatureEntries'),
|
|
subtables: new r.Array(Subtable, 'nSubtables')
|
|
});
|
|
|
|
var morx = new r.Struct({
|
|
version: r.uint16,
|
|
unused: new r.Reserved(r.uint16),
|
|
nChains: r.uint32,
|
|
chains: new r.Array(MorxChain, 'nChains')
|
|
});
|
|
|
|
var OpticalBounds = new r.Struct({
|
|
left: r.int16,
|
|
top: r.int16,
|
|
right: r.int16,
|
|
bottom: r.int16
|
|
});
|
|
|
|
var opbd = new r.Struct({
|
|
version: r.fixed32,
|
|
format: r.uint16,
|
|
lookupTable: new LookupTable(OpticalBounds)
|
|
});
|
|
|
|
var tables = {};
|
|
// Required Tables
|
|
tables.cmap = cmap;
|
|
tables.head = head;
|
|
tables.hhea = hhea;
|
|
tables.hmtx = hmtx;
|
|
tables.maxp = maxp;
|
|
tables.name = NameTable;
|
|
tables['OS/2'] = OS2;
|
|
tables.post = post;
|
|
|
|
// TrueType Outlines
|
|
tables.fpgm = fpgm;
|
|
tables.loca = loca;
|
|
tables.prep = prep;
|
|
tables['cvt '] = cvt;
|
|
tables.glyf = glyf;
|
|
|
|
// PostScript Outlines
|
|
tables['CFF '] = CFFFont;
|
|
tables.VORG = VORG;
|
|
|
|
// Bitmap Glyphs
|
|
tables.EBLC = EBLC;
|
|
tables.CBLC = tables.EBLC;
|
|
tables.sbix = sbix;
|
|
tables.COLR = COLR;
|
|
tables.CPAL = CPAL;
|
|
|
|
// Advanced OpenType Tables
|
|
tables.BASE = BASE;
|
|
tables.GDEF = GDEF;
|
|
tables.GPOS = GPOS;
|
|
tables.GSUB = GSUB;
|
|
tables.JSTF = JSTF;
|
|
|
|
// Other OpenType Tables
|
|
tables.DSIG = DSIG;
|
|
tables.gasp = gasp;
|
|
tables.hdmx = hdmx;
|
|
tables.kern = kern;
|
|
tables.LTSH = LTSH;
|
|
tables.PCLT = PCLT;
|
|
tables.VDMX = VDMX;
|
|
tables.vhea = vhea;
|
|
tables.vmtx = vmtx;
|
|
|
|
// Apple Advanced Typography Tables
|
|
tables.avar = avar;
|
|
tables.bsln = bsln;
|
|
tables.feat = feat;
|
|
tables.fvar = fvar;
|
|
tables.gvar = gvar;
|
|
tables.just = just;
|
|
tables.morx = morx;
|
|
tables.opbd = opbd;
|
|
|
|
var TableEntry = new r.Struct({
|
|
tag: new r.String(4),
|
|
checkSum: r.uint32,
|
|
offset: new r.Pointer(r.uint32, 'void', { type: 'global' }),
|
|
length: r.uint32
|
|
});
|
|
|
|
var Directory = new r.Struct({
|
|
tag: new r.String(4),
|
|
numTables: r.uint16,
|
|
searchRange: r.uint16,
|
|
entrySelector: r.uint16,
|
|
rangeShift: r.uint16,
|
|
tables: new r.Array(TableEntry, 'numTables')
|
|
});
|
|
|
|
Directory.process = function () {
|
|
var tables = {};
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.tables), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var table = _step.value;
|
|
|
|
tables[table.tag] = table;
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
this.tables = tables;
|
|
};
|
|
|
|
Directory.preEncode = function (stream) {
|
|
var tables$$ = [];
|
|
for (var tag in this.tables) {
|
|
var table = this.tables[tag];
|
|
if (table) {
|
|
tables$$.push({
|
|
tag: tag,
|
|
checkSum: 0,
|
|
offset: new r.VoidPointer(tables[tag], table),
|
|
length: tables[tag].size(table)
|
|
});
|
|
}
|
|
}
|
|
|
|
this.tag = 'true';
|
|
this.numTables = tables$$.length;
|
|
this.tables = tables$$;
|
|
|
|
this.searchRange = Math.floor(Math.log(this.numTables) / Math.LN2) * 16;
|
|
this.entrySelector = Math.floor(this.searchRange / Math.LN2);
|
|
this.rangeShift = this.numTables * 16 - this.searchRange;
|
|
};
|
|
|
|
function binarySearch(arr, cmp) {
|
|
var min = 0;
|
|
var max = arr.length - 1;
|
|
while (min <= max) {
|
|
var mid = min + max >> 1;
|
|
var res = cmp(arr[mid]);
|
|
|
|
if (res < 0) {
|
|
max = mid - 1;
|
|
} else if (res > 0) {
|
|
min = mid + 1;
|
|
} else {
|
|
return mid;
|
|
}
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
function range(index, end) {
|
|
var range = [];
|
|
while (index < end) {
|
|
range.push(index++);
|
|
}
|
|
return range;
|
|
}
|
|
|
|
var _class$1;
|
|
function _applyDecoratedDescriptor$1(target, property, decorators, descriptor, context) {
|
|
var desc = {};
|
|
Object['ke' + 'ys'](descriptor).forEach(function (key) {
|
|
desc[key] = descriptor[key];
|
|
});
|
|
desc.enumerable = !!desc.enumerable;
|
|
desc.configurable = !!desc.configurable;
|
|
|
|
if ('value' in desc || desc.initializer) {
|
|
desc.writable = true;
|
|
}
|
|
|
|
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
|
|
return decorator(target, property, desc) || desc;
|
|
}, desc);
|
|
|
|
if (context && desc.initializer !== void 0) {
|
|
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
|
|
desc.initializer = undefined;
|
|
}
|
|
|
|
if (desc.initializer === void 0) {
|
|
Object['define' + 'Property'](target, property, desc);
|
|
desc = null;
|
|
}
|
|
|
|
return desc;
|
|
}
|
|
|
|
// iconv-lite is an optional dependency.
|
|
try {
|
|
var iconv = __webpack_require__(84);
|
|
} catch (err) {}
|
|
|
|
var CmapProcessor = (_class$1 = function () {
|
|
function CmapProcessor(cmapTable) {
|
|
_classCallCheck(this, CmapProcessor);
|
|
|
|
// Attempt to find a Unicode cmap first
|
|
this.encoding = null;
|
|
this.cmap = this.findSubtable(cmapTable, [
|
|
// 32-bit subtables
|
|
[3, 10], [0, 6], [0, 4],
|
|
|
|
// 16-bit subtables
|
|
[3, 1], [0, 3], [0, 2], [0, 1], [0, 0], [3, 0]]);
|
|
|
|
// If not unicode cmap was found, and iconv-lite is installed,
|
|
// take the first table with a supported encoding.
|
|
if (!this.cmap && iconv) {
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(cmapTable.tables), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var cmap = _step.value;
|
|
|
|
var encoding = getEncoding(cmap.platformID, cmap.encodingID, cmap.table.language - 1);
|
|
if (iconv.encodingExists(encoding)) {
|
|
this.cmap = cmap.table;
|
|
this.encoding = encoding;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!this.cmap) {
|
|
throw new Error("Could not find a supported cmap table");
|
|
}
|
|
|
|
this.uvs = this.findSubtable(cmapTable, [[0, 5]]);
|
|
if (this.uvs && this.uvs.version !== 14) {
|
|
this.uvs = null;
|
|
}
|
|
}
|
|
|
|
_createClass(CmapProcessor, [{
|
|
key: 'findSubtable',
|
|
value: function findSubtable(cmapTable, pairs) {
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(pairs), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var _step2$value = _slicedToArray(_step2.value, 2),
|
|
platformID = _step2$value[0],
|
|
encodingID = _step2$value[1];
|
|
|
|
var _iteratorNormalCompletion3 = true;
|
|
var _didIteratorError3 = false;
|
|
var _iteratorError3 = undefined;
|
|
|
|
try {
|
|
for (var _iterator3 = _getIterator(cmapTable.tables), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
var cmap = _step3.value;
|
|
|
|
if (cmap.platformID === platformID && cmap.encodingID === encodingID) {
|
|
return cmap.table;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError3 = true;
|
|
_iteratorError3 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
_iterator3.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError3) {
|
|
throw _iteratorError3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}, {
|
|
key: 'lookup',
|
|
value: function lookup(codepoint, variationSelector) {
|
|
// If there is no Unicode cmap in this font, we need to re-encode
|
|
// the codepoint in the encoding that the cmap supports.
|
|
if (this.encoding) {
|
|
var buf = iconv.encode(_String$fromCodePoint(codepoint), this.encoding);
|
|
codepoint = 0;
|
|
for (var i = 0; i < buf.length; i++) {
|
|
codepoint = codepoint << 8 | buf[i];
|
|
}
|
|
|
|
// Otherwise, try to get a Unicode variation selector for this codepoint if one is provided.
|
|
} else if (variationSelector) {
|
|
var gid = this.getVariationSelector(codepoint, variationSelector);
|
|
if (gid) {
|
|
return gid;
|
|
}
|
|
}
|
|
|
|
var cmap = this.cmap;
|
|
switch (cmap.version) {
|
|
case 0:
|
|
return cmap.codeMap.get(codepoint) || 0;
|
|
|
|
case 4:
|
|
{
|
|
var min = 0;
|
|
var max = cmap.segCount - 1;
|
|
while (min <= max) {
|
|
var mid = min + max >> 1;
|
|
|
|
if (codepoint < cmap.startCode.get(mid)) {
|
|
max = mid - 1;
|
|
} else if (codepoint > cmap.endCode.get(mid)) {
|
|
min = mid + 1;
|
|
} else {
|
|
var rangeOffset = cmap.idRangeOffset.get(mid);
|
|
var _gid = void 0;
|
|
|
|
if (rangeOffset === 0) {
|
|
_gid = codepoint + cmap.idDelta.get(mid);
|
|
} else {
|
|
var index = rangeOffset / 2 + (codepoint - cmap.startCode.get(mid)) - (cmap.segCount - mid);
|
|
_gid = cmap.glyphIndexArray.get(index) || 0;
|
|
if (_gid !== 0) {
|
|
_gid += cmap.idDelta.get(mid);
|
|
}
|
|
}
|
|
|
|
return _gid & 0xffff;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
case 8:
|
|
throw new Error('TODO: cmap format 8');
|
|
|
|
case 6:
|
|
case 10:
|
|
return cmap.glyphIndices.get(codepoint - cmap.firstCode) || 0;
|
|
|
|
case 12:
|
|
case 13:
|
|
{
|
|
var _min = 0;
|
|
var _max = cmap.nGroups - 1;
|
|
while (_min <= _max) {
|
|
var _mid = _min + _max >> 1;
|
|
var group = cmap.groups.get(_mid);
|
|
|
|
if (codepoint < group.startCharCode) {
|
|
_max = _mid - 1;
|
|
} else if (codepoint > group.endCharCode) {
|
|
_min = _mid + 1;
|
|
} else {
|
|
if (cmap.version === 12) {
|
|
return group.glyphID + (codepoint - group.startCharCode);
|
|
} else {
|
|
return group.glyphID;
|
|
}
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
case 14:
|
|
throw new Error('TODO: cmap format 14');
|
|
|
|
default:
|
|
throw new Error('Unknown cmap format ' + cmap.version);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'getVariationSelector',
|
|
value: function getVariationSelector(codepoint, variationSelector) {
|
|
if (!this.uvs) {
|
|
return 0;
|
|
}
|
|
|
|
var selectors = this.uvs.varSelectors.toArray();
|
|
var i = binarySearch(selectors, function (x) {
|
|
return variationSelector - x.varSelector;
|
|
});
|
|
var sel = selectors[i];
|
|
|
|
if (i !== -1 && sel.defaultUVS) {
|
|
i = binarySearch(sel.defaultUVS, function (x) {
|
|
return codepoint < x.startUnicodeValue ? -1 : codepoint > x.startUnicodeValue + x.additionalCount ? +1 : 0;
|
|
});
|
|
}
|
|
|
|
if (i !== -1 && sel.nonDefaultUVS) {
|
|
i = binarySearch(sel.nonDefaultUVS, function (x) {
|
|
return codepoint - x.unicodeValue;
|
|
});
|
|
if (i !== -1) {
|
|
return sel.nonDefaultUVS[i].glyphID;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
}, {
|
|
key: 'getCharacterSet',
|
|
value: function getCharacterSet() {
|
|
var cmap = this.cmap;
|
|
switch (cmap.version) {
|
|
case 0:
|
|
return range(0, cmap.codeMap.length);
|
|
|
|
case 4:
|
|
{
|
|
var res = [];
|
|
var endCodes = cmap.endCode.toArray();
|
|
for (var i = 0; i < endCodes.length; i++) {
|
|
var tail = endCodes[i] + 1;
|
|
var start = cmap.startCode.get(i);
|
|
res.push.apply(res, _toConsumableArray(range(start, tail)));
|
|
}
|
|
|
|
return res;
|
|
}
|
|
|
|
case 8:
|
|
throw new Error('TODO: cmap format 8');
|
|
|
|
case 6:
|
|
case 10:
|
|
return range(cmap.firstCode, cmap.firstCode + cmap.glyphIndices.length);
|
|
|
|
case 12:
|
|
case 13:
|
|
{
|
|
var _res = [];
|
|
var _iteratorNormalCompletion4 = true;
|
|
var _didIteratorError4 = false;
|
|
var _iteratorError4 = undefined;
|
|
|
|
try {
|
|
for (var _iterator4 = _getIterator(cmap.groups.toArray()), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
var group = _step4.value;
|
|
|
|
_res.push.apply(_res, _toConsumableArray(range(group.startCharCode, group.endCharCode + 1)));
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError4 = true;
|
|
_iteratorError4 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
|
_iterator4.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError4) {
|
|
throw _iteratorError4;
|
|
}
|
|
}
|
|
}
|
|
|
|
return _res;
|
|
}
|
|
|
|
case 14:
|
|
throw new Error('TODO: cmap format 14');
|
|
|
|
default:
|
|
throw new Error('Unknown cmap format ' + cmap.version);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'codePointsForGlyph',
|
|
value: function codePointsForGlyph(gid) {
|
|
var cmap = this.cmap;
|
|
switch (cmap.version) {
|
|
case 0:
|
|
{
|
|
var res = [];
|
|
for (var i = 0; i < 256; i++) {
|
|
if (cmap.codeMap.get(i) === gid) {
|
|
res.push(i);
|
|
}
|
|
}
|
|
|
|
return res;
|
|
}
|
|
|
|
case 4:
|
|
{
|
|
var _res2 = [];
|
|
for (var _i = 0; _i < cmap.segCount; _i++) {
|
|
var end = cmap.endCode.get(_i);
|
|
var start = cmap.startCode.get(_i);
|
|
var rangeOffset = cmap.idRangeOffset.get(_i);
|
|
var delta = cmap.idDelta.get(_i);
|
|
|
|
for (var c = start; c <= end; c++) {
|
|
var g = 0;
|
|
if (rangeOffset === 0) {
|
|
g = c + delta;
|
|
} else {
|
|
var index = rangeOffset / 2 + (c - start) - (cmap.segCount - _i);
|
|
g = cmap.glyphIndexArray.get(index) || 0;
|
|
if (g !== 0) {
|
|
g += delta;
|
|
}
|
|
}
|
|
|
|
if (g === gid) {
|
|
_res2.push(c);
|
|
}
|
|
}
|
|
}
|
|
|
|
return _res2;
|
|
}
|
|
|
|
case 12:
|
|
{
|
|
var _res3 = [];
|
|
var _iteratorNormalCompletion5 = true;
|
|
var _didIteratorError5 = false;
|
|
var _iteratorError5 = undefined;
|
|
|
|
try {
|
|
for (var _iterator5 = _getIterator(cmap.groups.toArray()), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
|
var group = _step5.value;
|
|
|
|
if (gid >= group.glyphID && gid <= group.glyphID + (group.endCharCode - group.startCharCode)) {
|
|
_res3.push(group.startCharCode + (gid - group.glyphID));
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError5 = true;
|
|
_iteratorError5 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion5 && _iterator5.return) {
|
|
_iterator5.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError5) {
|
|
throw _iteratorError5;
|
|
}
|
|
}
|
|
}
|
|
|
|
return _res3;
|
|
}
|
|
|
|
case 13:
|
|
{
|
|
var _res4 = [];
|
|
var _iteratorNormalCompletion6 = true;
|
|
var _didIteratorError6 = false;
|
|
var _iteratorError6 = undefined;
|
|
|
|
try {
|
|
for (var _iterator6 = _getIterator(cmap.groups.toArray()), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
|
|
var _group = _step6.value;
|
|
|
|
if (gid === _group.glyphID) {
|
|
_res4.push.apply(_res4, _toConsumableArray(range(_group.startCharCode, _group.endCharCode + 1)));
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError6 = true;
|
|
_iteratorError6 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion6 && _iterator6.return) {
|
|
_iterator6.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError6) {
|
|
throw _iteratorError6;
|
|
}
|
|
}
|
|
}
|
|
|
|
return _res4;
|
|
}
|
|
|
|
default:
|
|
throw new Error('Unknown cmap format ' + cmap.version);
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return CmapProcessor;
|
|
}(), (_applyDecoratedDescriptor$1(_class$1.prototype, 'getCharacterSet', [cache], _Object$getOwnPropertyDescriptor(_class$1.prototype, 'getCharacterSet'), _class$1.prototype), _applyDecoratedDescriptor$1(_class$1.prototype, 'codePointsForGlyph', [cache], _Object$getOwnPropertyDescriptor(_class$1.prototype, 'codePointsForGlyph'), _class$1.prototype)), _class$1);
|
|
|
|
var KernProcessor = function () {
|
|
function KernProcessor(font) {
|
|
_classCallCheck(this, KernProcessor);
|
|
|
|
this.kern = font.kern;
|
|
}
|
|
|
|
_createClass(KernProcessor, [{
|
|
key: "process",
|
|
value: function process(glyphs, positions) {
|
|
for (var glyphIndex = 0; glyphIndex < glyphs.length - 1; glyphIndex++) {
|
|
var left = glyphs[glyphIndex].id;
|
|
var right = glyphs[glyphIndex + 1].id;
|
|
positions[glyphIndex].xAdvance += this.getKerning(left, right);
|
|
}
|
|
}
|
|
}, {
|
|
key: "getKerning",
|
|
value: function getKerning(left, right) {
|
|
var res = 0;
|
|
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.kern.tables), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var table = _step.value;
|
|
|
|
if (table.coverage.crossStream) {
|
|
continue;
|
|
}
|
|
|
|
switch (table.version) {
|
|
case 0:
|
|
if (!table.coverage.horizontal) {
|
|
continue;
|
|
}
|
|
|
|
break;
|
|
case 1:
|
|
if (table.coverage.vertical || table.coverage.variation) {
|
|
continue;
|
|
}
|
|
|
|
break;
|
|
default:
|
|
throw new Error("Unsupported kerning table version " + table.version);
|
|
}
|
|
|
|
var val = 0;
|
|
var s = table.subtable;
|
|
switch (table.format) {
|
|
case 0:
|
|
// TODO: binary search
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(s.pairs), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var pair = _step2.value;
|
|
|
|
if (pair.left === left && pair.right === right) {
|
|
val = pair.value;
|
|
break;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
var leftOffset = 0,
|
|
rightOffset = 0;
|
|
if (left >= s.leftTable.firstGlyph && left < s.leftTable.firstGlyph + s.leftTable.nGlyphs) {
|
|
leftOffset = s.leftTable.offsets[left - s.leftTable.firstGlyph];
|
|
} else {
|
|
leftOffset = s.array.off;
|
|
}
|
|
|
|
if (right >= s.rightTable.firstGlyph && right < s.rightTable.firstGlyph + s.rightTable.nGlyphs) {
|
|
rightOffset = s.rightTable.offsets[right - s.rightTable.firstGlyph];
|
|
}
|
|
|
|
var index = (leftOffset + rightOffset - s.array.off) / 2;
|
|
val = s.array.values.get(index);
|
|
break;
|
|
|
|
case 3:
|
|
if (left >= s.glyphCount || right >= s.glyphCount) {
|
|
return 0;
|
|
}
|
|
|
|
val = s.kernValue[s.kernIndex[s.leftClass[left] * s.rightClassCount + s.rightClass[right]]];
|
|
break;
|
|
|
|
default:
|
|
throw new Error("Unsupported kerning sub-table format " + table.format);
|
|
}
|
|
|
|
// Microsoft supports the override flag, which resets the result
|
|
// Otherwise, the sum of the results from all subtables is returned
|
|
if (table.coverage.override) {
|
|
res = val;
|
|
} else {
|
|
res += val;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
return res;
|
|
}
|
|
}]);
|
|
|
|
return KernProcessor;
|
|
}();
|
|
|
|
/**
|
|
* This class is used when GPOS does not define 'mark' or 'mkmk' features
|
|
* for positioning marks relative to base glyphs. It uses the unicode
|
|
* combining class property to position marks.
|
|
*
|
|
* Based on code from Harfbuzz, thanks!
|
|
* https://github.com/behdad/harfbuzz/blob/master/src/hb-ot-shape-fallback.cc
|
|
*/
|
|
|
|
var UnicodeLayoutEngine = function () {
|
|
function UnicodeLayoutEngine(font) {
|
|
_classCallCheck(this, UnicodeLayoutEngine);
|
|
|
|
this.font = font;
|
|
}
|
|
|
|
_createClass(UnicodeLayoutEngine, [{
|
|
key: 'positionGlyphs',
|
|
value: function positionGlyphs(glyphs, positions) {
|
|
// find each base + mark cluster, and position the marks relative to the base
|
|
var clusterStart = 0;
|
|
var clusterEnd = 0;
|
|
for (var index = 0; index < glyphs.length; index++) {
|
|
var glyph = glyphs[index];
|
|
if (glyph.isMark) {
|
|
// TODO: handle ligatures
|
|
clusterEnd = index;
|
|
} else {
|
|
if (clusterStart !== clusterEnd) {
|
|
this.positionCluster(glyphs, positions, clusterStart, clusterEnd);
|
|
}
|
|
|
|
clusterStart = clusterEnd = index;
|
|
}
|
|
}
|
|
|
|
if (clusterStart !== clusterEnd) {
|
|
this.positionCluster(glyphs, positions, clusterStart, clusterEnd);
|
|
}
|
|
|
|
return positions;
|
|
}
|
|
}, {
|
|
key: 'positionCluster',
|
|
value: function positionCluster(glyphs, positions, clusterStart, clusterEnd) {
|
|
var base = glyphs[clusterStart];
|
|
var baseBox = base.cbox.copy();
|
|
|
|
// adjust bounding box for ligature glyphs
|
|
if (base.codePoints.length > 1) {
|
|
// LTR. TODO: RTL support.
|
|
baseBox.minX += (base.codePoints.length - 1) * baseBox.width / base.codePoints.length;
|
|
}
|
|
|
|
var xOffset = -positions[clusterStart].xAdvance;
|
|
var yOffset = 0;
|
|
var yGap = this.font.unitsPerEm / 16;
|
|
|
|
// position each of the mark glyphs relative to the base glyph
|
|
for (var index = clusterStart + 1; index <= clusterEnd; index++) {
|
|
var mark = glyphs[index];
|
|
var markBox = mark.cbox;
|
|
var position = positions[index];
|
|
|
|
var combiningClass = this.getCombiningClass(mark.codePoints[0]);
|
|
|
|
if (combiningClass !== 'Not_Reordered') {
|
|
position.xOffset = position.yOffset = 0;
|
|
|
|
// x positioning
|
|
switch (combiningClass) {
|
|
case 'Double_Above':
|
|
case 'Double_Below':
|
|
// LTR. TODO: RTL support.
|
|
position.xOffset += baseBox.minX - markBox.width / 2 - markBox.minX;
|
|
break;
|
|
|
|
case 'Attached_Below_Left':
|
|
case 'Below_Left':
|
|
case 'Above_Left':
|
|
// left align
|
|
position.xOffset += baseBox.minX - markBox.minX;
|
|
break;
|
|
|
|
case 'Attached_Above_Right':
|
|
case 'Below_Right':
|
|
case 'Above_Right':
|
|
// right align
|
|
position.xOffset += baseBox.maxX - markBox.width - markBox.minX;
|
|
break;
|
|
|
|
default:
|
|
// Attached_Below, Attached_Above, Below, Above, other
|
|
// center align
|
|
position.xOffset += baseBox.minX + (baseBox.width - markBox.width) / 2 - markBox.minX;
|
|
}
|
|
|
|
// y positioning
|
|
switch (combiningClass) {
|
|
case 'Double_Below':
|
|
case 'Below_Left':
|
|
case 'Below':
|
|
case 'Below_Right':
|
|
case 'Attached_Below_Left':
|
|
case 'Attached_Below':
|
|
// add a small gap between the glyphs if they are not attached
|
|
if (combiningClass === 'Attached_Below_Left' || combiningClass === 'Attached_Below') {
|
|
baseBox.minY += yGap;
|
|
}
|
|
|
|
position.yOffset = -baseBox.minY - markBox.maxY;
|
|
baseBox.minY += markBox.height;
|
|
break;
|
|
|
|
case 'Double_Above':
|
|
case 'Above_Left':
|
|
case 'Above':
|
|
case 'Above_Right':
|
|
case 'Attached_Above':
|
|
case 'Attached_Above_Right':
|
|
// add a small gap between the glyphs if they are not attached
|
|
if (combiningClass === 'Attached_Above' || combiningClass === 'Attached_Above_Right') {
|
|
baseBox.maxY += yGap;
|
|
}
|
|
|
|
position.yOffset = baseBox.maxY - markBox.minY;
|
|
baseBox.maxY += markBox.height;
|
|
break;
|
|
}
|
|
|
|
position.xAdvance = position.yAdvance = 0;
|
|
position.xOffset += xOffset;
|
|
position.yOffset += yOffset;
|
|
} else {
|
|
xOffset -= position.xAdvance;
|
|
yOffset -= position.yAdvance;
|
|
}
|
|
}
|
|
|
|
return;
|
|
}
|
|
}, {
|
|
key: 'getCombiningClass',
|
|
value: function getCombiningClass(codePoint) {
|
|
var combiningClass = unicode.getCombiningClass(codePoint);
|
|
|
|
// Thai / Lao need some per-character work
|
|
if ((codePoint & ~0xff) === 0x0e00) {
|
|
if (combiningClass === 'Not_Reordered') {
|
|
switch (codePoint) {
|
|
case 0x0e31:
|
|
case 0x0e34:
|
|
case 0x0e35:
|
|
case 0x0e36:
|
|
case 0x0e37:
|
|
case 0x0e47:
|
|
case 0x0e4c:
|
|
case 0x0e3d:
|
|
case 0x0e4e:
|
|
return 'Above_Right';
|
|
|
|
case 0x0eb1:
|
|
case 0x0eb4:
|
|
case 0x0eb5:
|
|
case 0x0eb6:
|
|
case 0x0eb7:
|
|
case 0x0ebb:
|
|
case 0x0ecc:
|
|
case 0x0ecd:
|
|
return 'Above';
|
|
|
|
case 0x0ebc:
|
|
return 'Below';
|
|
}
|
|
} else if (codePoint === 0x0e3a) {
|
|
// virama
|
|
return 'Below_Right';
|
|
}
|
|
}
|
|
|
|
switch (combiningClass) {
|
|
// Hebrew
|
|
|
|
case 'CCC10': // sheva
|
|
case 'CCC11': // hataf segol
|
|
case 'CCC12': // hataf patah
|
|
case 'CCC13': // hataf qamats
|
|
case 'CCC14': // hiriq
|
|
case 'CCC15': // tsere
|
|
case 'CCC16': // segol
|
|
case 'CCC17': // patah
|
|
case 'CCC18': // qamats
|
|
case 'CCC20': // qubuts
|
|
case 'CCC22':
|
|
// meteg
|
|
return 'Below';
|
|
|
|
case 'CCC23':
|
|
// rafe
|
|
return 'Attached_Above';
|
|
|
|
case 'CCC24':
|
|
// shin dot
|
|
return 'Above_Right';
|
|
|
|
case 'CCC25': // sin dot
|
|
case 'CCC19':
|
|
// holam
|
|
return 'Above_Left';
|
|
|
|
case 'CCC26':
|
|
// point varika
|
|
return 'Above';
|
|
|
|
case 'CCC21':
|
|
// dagesh
|
|
break;
|
|
|
|
// Arabic and Syriac
|
|
|
|
case 'CCC27': // fathatan
|
|
case 'CCC28': // dammatan
|
|
case 'CCC30': // fatha
|
|
case 'CCC31': // damma
|
|
case 'CCC33': // shadda
|
|
case 'CCC34': // sukun
|
|
case 'CCC35': // superscript alef
|
|
case 'CCC36':
|
|
// superscript alaph
|
|
return 'Above';
|
|
|
|
case 'CCC29': // kasratan
|
|
case 'CCC32':
|
|
// kasra
|
|
return 'Below';
|
|
|
|
// Thai
|
|
|
|
case 'CCC103':
|
|
// sara u / sara uu
|
|
return 'Below_Right';
|
|
|
|
case 'CCC107':
|
|
// mai
|
|
return 'Above_Right';
|
|
|
|
// Lao
|
|
|
|
case 'CCC118':
|
|
// sign u / sign uu
|
|
return 'Below';
|
|
|
|
case 'CCC122':
|
|
// mai
|
|
return 'Above';
|
|
|
|
// Tibetan
|
|
|
|
case 'CCC129': // sign aa
|
|
case 'CCC132':
|
|
// sign u
|
|
return 'Below';
|
|
|
|
case 'CCC130':
|
|
// sign i
|
|
return 'Above';
|
|
}
|
|
|
|
return combiningClass;
|
|
}
|
|
}]);
|
|
|
|
return UnicodeLayoutEngine;
|
|
}();
|
|
|
|
/**
|
|
* Represents a glyph bounding box
|
|
*/
|
|
var BBox = function () {
|
|
function BBox() {
|
|
var minX = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity;
|
|
var minY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
|
var maxX = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -Infinity;
|
|
var maxY = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -Infinity;
|
|
|
|
_classCallCheck(this, BBox);
|
|
|
|
/**
|
|
* The minimum X position in the bounding box
|
|
* @type {number}
|
|
*/
|
|
this.minX = minX;
|
|
|
|
/**
|
|
* The minimum Y position in the bounding box
|
|
* @type {number}
|
|
*/
|
|
this.minY = minY;
|
|
|
|
/**
|
|
* The maxmimum X position in the bounding box
|
|
* @type {number}
|
|
*/
|
|
this.maxX = maxX;
|
|
|
|
/**
|
|
* The maxmimum Y position in the bounding box
|
|
* @type {number}
|
|
*/
|
|
this.maxY = maxY;
|
|
}
|
|
|
|
/**
|
|
* The width of the bounding box
|
|
* @type {number}
|
|
*/
|
|
|
|
|
|
_createClass(BBox, [{
|
|
key: "addPoint",
|
|
value: function addPoint(x, y) {
|
|
if (x < this.minX) {
|
|
this.minX = x;
|
|
}
|
|
|
|
if (y < this.minY) {
|
|
this.minY = y;
|
|
}
|
|
|
|
if (x > this.maxX) {
|
|
this.maxX = x;
|
|
}
|
|
|
|
if (y > this.maxY) {
|
|
this.maxY = y;
|
|
}
|
|
}
|
|
}, {
|
|
key: "copy",
|
|
value: function copy() {
|
|
return new BBox(this.minX, this.minY, this.maxX, this.maxY);
|
|
}
|
|
}, {
|
|
key: "width",
|
|
get: function get() {
|
|
return this.maxX - this.minX;
|
|
}
|
|
|
|
/**
|
|
* The height of the bounding box
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: "height",
|
|
get: function get() {
|
|
return this.maxY - this.minY;
|
|
}
|
|
}]);
|
|
|
|
return BBox;
|
|
}();
|
|
|
|
/**
|
|
* Represents a run of Glyph and GlyphPosition objects.
|
|
* Returned by the font layout method.
|
|
*/
|
|
|
|
var GlyphRun = function () {
|
|
function GlyphRun(glyphs, positions) {
|
|
_classCallCheck(this, GlyphRun);
|
|
|
|
/**
|
|
* An array of Glyph objects in the run
|
|
* @type {Glyph[]}
|
|
*/
|
|
this.glyphs = glyphs;
|
|
|
|
/**
|
|
* An array of GlyphPosition objects for each glyph in the run
|
|
* @type {GlyphPosition[]}
|
|
*/
|
|
this.positions = positions;
|
|
}
|
|
|
|
/**
|
|
* The total advance width of the run.
|
|
* @type {number}
|
|
*/
|
|
|
|
|
|
_createClass(GlyphRun, [{
|
|
key: 'advanceWidth',
|
|
get: function get() {
|
|
var width = 0;
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.positions), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var position = _step.value;
|
|
|
|
width += position.xAdvance;
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
return width;
|
|
}
|
|
|
|
/**
|
|
* The total advance height of the run.
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'advanceHeight',
|
|
get: function get() {
|
|
var height = 0;
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(this.positions), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var position = _step2.value;
|
|
|
|
height += position.yAdvance;
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
return height;
|
|
}
|
|
|
|
/**
|
|
* The bounding box containing all glyphs in the run.
|
|
* @type {BBox}
|
|
*/
|
|
|
|
}, {
|
|
key: 'bbox',
|
|
get: function get() {
|
|
var bbox = new BBox();
|
|
|
|
var x = 0;
|
|
var y = 0;
|
|
for (var index = 0; index < this.glyphs.length; index++) {
|
|
var glyph = this.glyphs[index];
|
|
var p = this.positions[index];
|
|
var b = glyph.bbox;
|
|
|
|
bbox.addPoint(b.minX + x + p.xOffset, b.minY + y + p.yOffset);
|
|
bbox.addPoint(b.maxX + x + p.xOffset, b.maxY + y + p.yOffset);
|
|
|
|
x += p.xAdvance;
|
|
y += p.yAdvance;
|
|
}
|
|
|
|
return bbox;
|
|
}
|
|
}]);
|
|
|
|
return GlyphRun;
|
|
}();
|
|
|
|
/**
|
|
* Represents positioning information for a glyph in a GlyphRun.
|
|
*/
|
|
var GlyphPosition = function GlyphPosition() {
|
|
var xAdvance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
var yAdvance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
var xOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
var yOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
|
|
_classCallCheck(this, GlyphPosition);
|
|
|
|
/**
|
|
* The amount to move the virtual pen in the X direction after rendering this glyph.
|
|
* @type {number}
|
|
*/
|
|
this.xAdvance = xAdvance;
|
|
|
|
/**
|
|
* The amount to move the virtual pen in the Y direction after rendering this glyph.
|
|
* @type {number}
|
|
*/
|
|
this.yAdvance = yAdvance;
|
|
|
|
/**
|
|
* The offset from the pen position in the X direction at which to render this glyph.
|
|
* @type {number}
|
|
*/
|
|
this.xOffset = xOffset;
|
|
|
|
/**
|
|
* The offset from the pen position in the Y direction at which to render this glyph.
|
|
* @type {number}
|
|
*/
|
|
this.yOffset = yOffset;
|
|
};
|
|
|
|
// This maps the Unicode Script property to an OpenType script tag
|
|
// Data from http://www.microsoft.com/typography/otspec/scripttags.htm
|
|
// and http://www.unicode.org/Public/UNIDATA/PropertyValueAliases.txt.
|
|
var UNICODE_SCRIPTS = {
|
|
Caucasian_Albanian: 'aghb',
|
|
Arabic: 'arab',
|
|
Imperial_Aramaic: 'armi',
|
|
Armenian: 'armn',
|
|
Avestan: 'avst',
|
|
Balinese: 'bali',
|
|
Bamum: 'bamu',
|
|
Bassa_Vah: 'bass',
|
|
Batak: 'batk',
|
|
Bengali: ['bng2', 'beng'],
|
|
Bopomofo: 'bopo',
|
|
Brahmi: 'brah',
|
|
Braille: 'brai',
|
|
Buginese: 'bugi',
|
|
Buhid: 'buhd',
|
|
Chakma: 'cakm',
|
|
Canadian_Aboriginal: 'cans',
|
|
Carian: 'cari',
|
|
Cham: 'cham',
|
|
Cherokee: 'cher',
|
|
Coptic: 'copt',
|
|
Cypriot: 'cprt',
|
|
Cyrillic: 'cyrl',
|
|
Devanagari: ['dev2', 'deva'],
|
|
Deseret: 'dsrt',
|
|
Duployan: 'dupl',
|
|
Egyptian_Hieroglyphs: 'egyp',
|
|
Elbasan: 'elba',
|
|
Ethiopic: 'ethi',
|
|
Georgian: 'geor',
|
|
Glagolitic: 'glag',
|
|
Gothic: 'goth',
|
|
Grantha: 'gran',
|
|
Greek: 'grek',
|
|
Gujarati: ['gjr2', 'gujr'],
|
|
Gurmukhi: ['gur2', 'guru'],
|
|
Hangul: 'hang',
|
|
Han: 'hani',
|
|
Hanunoo: 'hano',
|
|
Hebrew: 'hebr',
|
|
Hiragana: 'hira',
|
|
Pahawh_Hmong: 'hmng',
|
|
Katakana_Or_Hiragana: 'hrkt',
|
|
Old_Italic: 'ital',
|
|
Javanese: 'java',
|
|
Kayah_Li: 'kali',
|
|
Katakana: 'kana',
|
|
Kharoshthi: 'khar',
|
|
Khmer: 'khmr',
|
|
Khojki: 'khoj',
|
|
Kannada: ['knd2', 'knda'],
|
|
Kaithi: 'kthi',
|
|
Tai_Tham: 'lana',
|
|
Lao: 'lao ',
|
|
Latin: 'latn',
|
|
Lepcha: 'lepc',
|
|
Limbu: 'limb',
|
|
Linear_A: 'lina',
|
|
Linear_B: 'linb',
|
|
Lisu: 'lisu',
|
|
Lycian: 'lyci',
|
|
Lydian: 'lydi',
|
|
Mahajani: 'mahj',
|
|
Mandaic: 'mand',
|
|
Manichaean: 'mani',
|
|
Mende_Kikakui: 'mend',
|
|
Meroitic_Cursive: 'merc',
|
|
Meroitic_Hieroglyphs: 'mero',
|
|
Malayalam: ['mlm2', 'mlym'],
|
|
Modi: 'modi',
|
|
Mongolian: 'mong',
|
|
Mro: 'mroo',
|
|
Meetei_Mayek: 'mtei',
|
|
Myanmar: ['mym2', 'mymr'],
|
|
Old_North_Arabian: 'narb',
|
|
Nabataean: 'nbat',
|
|
Nko: 'nko ',
|
|
Ogham: 'ogam',
|
|
Ol_Chiki: 'olck',
|
|
Old_Turkic: 'orkh',
|
|
Oriya: 'orya',
|
|
Osmanya: 'osma',
|
|
Palmyrene: 'palm',
|
|
Pau_Cin_Hau: 'pauc',
|
|
Old_Permic: 'perm',
|
|
Phags_Pa: 'phag',
|
|
Inscriptional_Pahlavi: 'phli',
|
|
Psalter_Pahlavi: 'phlp',
|
|
Phoenician: 'phnx',
|
|
Miao: 'plrd',
|
|
Inscriptional_Parthian: 'prti',
|
|
Rejang: 'rjng',
|
|
Runic: 'runr',
|
|
Samaritan: 'samr',
|
|
Old_South_Arabian: 'sarb',
|
|
Saurashtra: 'saur',
|
|
Shavian: 'shaw',
|
|
Sharada: 'shrd',
|
|
Siddham: 'sidd',
|
|
Khudawadi: 'sind',
|
|
Sinhala: 'sinh',
|
|
Sora_Sompeng: 'sora',
|
|
Sundanese: 'sund',
|
|
Syloti_Nagri: 'sylo',
|
|
Syriac: 'syrc',
|
|
Tagbanwa: 'tagb',
|
|
Takri: 'takr',
|
|
Tai_Le: 'tale',
|
|
New_Tai_Lue: 'talu',
|
|
Tamil: 'taml',
|
|
Tai_Viet: 'tavt',
|
|
Telugu: ['tel2', 'telu'],
|
|
Tifinagh: 'tfng',
|
|
Tagalog: 'tglg',
|
|
Thaana: 'thaa',
|
|
Thai: 'thai',
|
|
Tibetan: 'tibt',
|
|
Tirhuta: 'tirh',
|
|
Ugaritic: 'ugar',
|
|
Vai: 'vai ',
|
|
Warang_Citi: 'wara',
|
|
Old_Persian: 'xpeo',
|
|
Cuneiform: 'xsux',
|
|
Yi: 'yi ',
|
|
Inherited: 'zinh',
|
|
Common: 'zyyy',
|
|
Unknown: 'zzzz'
|
|
};
|
|
|
|
function forString(string) {
|
|
var len = string.length;
|
|
var idx = 0;
|
|
while (idx < len) {
|
|
var code = string.charCodeAt(idx++);
|
|
|
|
// Check if this is a high surrogate
|
|
if (0xd800 <= code && code <= 0xdbff && idx < len) {
|
|
var next = string.charCodeAt(idx);
|
|
|
|
// Check if this is a low surrogate
|
|
if (0xdc00 <= next && next <= 0xdfff) {
|
|
idx++;
|
|
code = ((code & 0x3FF) << 10) + (next & 0x3FF) + 0x10000;
|
|
}
|
|
}
|
|
|
|
var script = unicode.getScript(code);
|
|
if (script !== 'Common' && script !== 'Inherited' && script !== 'Unknown') {
|
|
return UNICODE_SCRIPTS[script];
|
|
}
|
|
}
|
|
|
|
return UNICODE_SCRIPTS.Unknown;
|
|
}
|
|
|
|
function forCodePoints(codePoints) {
|
|
for (var i = 0; i < codePoints.length; i++) {
|
|
var codePoint = codePoints[i];
|
|
var script = unicode.getScript(codePoint);
|
|
if (script !== 'Common' && script !== 'Inherited' && script !== 'Unknown') {
|
|
return UNICODE_SCRIPTS[script];
|
|
}
|
|
}
|
|
|
|
return UNICODE_SCRIPTS.Unknown;
|
|
}
|
|
|
|
// The scripts in this map are written from right to left
|
|
var RTL = {
|
|
arab: true, // Arabic
|
|
hebr: true, // Hebrew
|
|
syrc: true, // Syriac
|
|
thaa: true, // Thaana
|
|
cprt: true, // Cypriot Syllabary
|
|
khar: true, // Kharosthi
|
|
phnx: true, // Phoenician
|
|
'nko ': true, // N'Ko
|
|
lydi: true, // Lydian
|
|
avst: true, // Avestan
|
|
armi: true, // Imperial Aramaic
|
|
phli: true, // Inscriptional Pahlavi
|
|
prti: true, // Inscriptional Parthian
|
|
sarb: true, // Old South Arabian
|
|
orkh: true, // Old Turkic, Orkhon Runic
|
|
samr: true, // Samaritan
|
|
mand: true, // Mandaic, Mandaean
|
|
merc: true, // Meroitic Cursive
|
|
mero: true, // Meroitic Hieroglyphs
|
|
|
|
// Unicode 7.0 (not listed on http://www.microsoft.com/typography/otspec/scripttags.htm)
|
|
mani: true, // Manichaean
|
|
mend: true, // Mende Kikakui
|
|
nbat: true, // Nabataean
|
|
narb: true, // Old North Arabian
|
|
palm: true, // Palmyrene
|
|
phlp: true // Psalter Pahlavi
|
|
};
|
|
|
|
function direction(script) {
|
|
if (RTL[script]) {
|
|
return 'rtl';
|
|
}
|
|
|
|
return 'ltr';
|
|
}
|
|
|
|
// see https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html
|
|
// and /System/Library/Frameworks/CoreText.framework/Versions/A/Headers/SFNTLayoutTypes.h on a Mac
|
|
var features = {
|
|
allTypographicFeatures: {
|
|
code: 0,
|
|
exclusive: false,
|
|
allTypeFeatures: 0
|
|
},
|
|
ligatures: {
|
|
code: 1,
|
|
exclusive: false,
|
|
requiredLigatures: 0,
|
|
commonLigatures: 2,
|
|
rareLigatures: 4,
|
|
// logos: 6
|
|
rebusPictures: 8,
|
|
diphthongLigatures: 10,
|
|
squaredLigatures: 12,
|
|
abbrevSquaredLigatures: 14,
|
|
symbolLigatures: 16,
|
|
contextualLigatures: 18,
|
|
historicalLigatures: 20
|
|
},
|
|
cursiveConnection: {
|
|
code: 2,
|
|
exclusive: true,
|
|
unconnected: 0,
|
|
partiallyConnected: 1,
|
|
cursive: 2
|
|
},
|
|
letterCase: {
|
|
code: 3,
|
|
exclusive: true
|
|
},
|
|
// upperAndLowerCase: 0 # deprecated
|
|
// allCaps: 1 # deprecated
|
|
// allLowerCase: 2 # deprecated
|
|
// smallCaps: 3 # deprecated
|
|
// initialCaps: 4 # deprecated
|
|
// initialCapsAndSmallCaps: 5 # deprecated
|
|
verticalSubstitution: {
|
|
code: 4,
|
|
exclusive: false,
|
|
substituteVerticalForms: 0
|
|
},
|
|
linguisticRearrangement: {
|
|
code: 5,
|
|
exclusive: false,
|
|
linguisticRearrangement: 0
|
|
},
|
|
numberSpacing: {
|
|
code: 6,
|
|
exclusive: true,
|
|
monospacedNumbers: 0,
|
|
proportionalNumbers: 1,
|
|
thirdWidthNumbers: 2,
|
|
quarterWidthNumbers: 3
|
|
},
|
|
smartSwash: {
|
|
code: 8,
|
|
exclusive: false,
|
|
wordInitialSwashes: 0,
|
|
wordFinalSwashes: 2,
|
|
// lineInitialSwashes: 4
|
|
// lineFinalSwashes: 6
|
|
nonFinalSwashes: 8
|
|
},
|
|
diacritics: {
|
|
code: 9,
|
|
exclusive: true,
|
|
showDiacritics: 0,
|
|
hideDiacritics: 1,
|
|
decomposeDiacritics: 2
|
|
},
|
|
verticalPosition: {
|
|
code: 10,
|
|
exclusive: true,
|
|
normalPosition: 0,
|
|
superiors: 1,
|
|
inferiors: 2,
|
|
ordinals: 3,
|
|
scientificInferiors: 4
|
|
},
|
|
fractions: {
|
|
code: 11,
|
|
exclusive: true,
|
|
noFractions: 0,
|
|
verticalFractions: 1,
|
|
diagonalFractions: 2
|
|
},
|
|
overlappingCharacters: {
|
|
code: 13,
|
|
exclusive: false,
|
|
preventOverlap: 0
|
|
},
|
|
typographicExtras: {
|
|
code: 14,
|
|
exclusive: false,
|
|
// hyphensToEmDash: 0
|
|
// hyphenToEnDash: 2
|
|
slashedZero: 4
|
|
},
|
|
// formInterrobang: 6
|
|
// smartQuotes: 8
|
|
// periodsToEllipsis: 10
|
|
mathematicalExtras: {
|
|
code: 15,
|
|
exclusive: false,
|
|
// hyphenToMinus: 0
|
|
// asteristoMultiply: 2
|
|
// slashToDivide: 4
|
|
// inequalityLigatures: 6
|
|
// exponents: 8
|
|
mathematicalGreek: 10
|
|
},
|
|
ornamentSets: {
|
|
code: 16,
|
|
exclusive: true,
|
|
noOrnaments: 0,
|
|
dingbats: 1,
|
|
piCharacters: 2,
|
|
fleurons: 3,
|
|
decorativeBorders: 4,
|
|
internationalSymbols: 5,
|
|
mathSymbols: 6
|
|
},
|
|
characterAlternatives: {
|
|
code: 17,
|
|
exclusive: true,
|
|
noAlternates: 0
|
|
},
|
|
// user defined options
|
|
designComplexity: {
|
|
code: 18,
|
|
exclusive: true,
|
|
designLevel1: 0,
|
|
designLevel2: 1,
|
|
designLevel3: 2,
|
|
designLevel4: 3,
|
|
designLevel5: 4
|
|
},
|
|
styleOptions: {
|
|
code: 19,
|
|
exclusive: true,
|
|
noStyleOptions: 0,
|
|
displayText: 1,
|
|
engravedText: 2,
|
|
illuminatedCaps: 3,
|
|
titlingCaps: 4,
|
|
tallCaps: 5
|
|
},
|
|
characterShape: {
|
|
code: 20,
|
|
exclusive: true,
|
|
traditionalCharacters: 0,
|
|
simplifiedCharacters: 1,
|
|
JIS1978Characters: 2,
|
|
JIS1983Characters: 3,
|
|
JIS1990Characters: 4,
|
|
traditionalAltOne: 5,
|
|
traditionalAltTwo: 6,
|
|
traditionalAltThree: 7,
|
|
traditionalAltFour: 8,
|
|
traditionalAltFive: 9,
|
|
expertCharacters: 10,
|
|
JIS2004Characters: 11,
|
|
hojoCharacters: 12,
|
|
NLCCharacters: 13,
|
|
traditionalNamesCharacters: 14
|
|
},
|
|
numberCase: {
|
|
code: 21,
|
|
exclusive: true,
|
|
lowerCaseNumbers: 0,
|
|
upperCaseNumbers: 1
|
|
},
|
|
textSpacing: {
|
|
code: 22,
|
|
exclusive: true,
|
|
proportionalText: 0,
|
|
monospacedText: 1,
|
|
halfWidthText: 2,
|
|
thirdWidthText: 3,
|
|
quarterWidthText: 4,
|
|
altProportionalText: 5,
|
|
altHalfWidthText: 6
|
|
},
|
|
transliteration: {
|
|
code: 23,
|
|
exclusive: true,
|
|
noTransliteration: 0
|
|
},
|
|
// hanjaToHangul: 1
|
|
// hiraganaToKatakana: 2
|
|
// katakanaToHiragana: 3
|
|
// kanaToRomanization: 4
|
|
// romanizationToHiragana: 5
|
|
// romanizationToKatakana: 6
|
|
// hanjaToHangulAltOne: 7
|
|
// hanjaToHangulAltTwo: 8
|
|
// hanjaToHangulAltThree: 9
|
|
annotation: {
|
|
code: 24,
|
|
exclusive: true,
|
|
noAnnotation: 0,
|
|
boxAnnotation: 1,
|
|
roundedBoxAnnotation: 2,
|
|
circleAnnotation: 3,
|
|
invertedCircleAnnotation: 4,
|
|
parenthesisAnnotation: 5,
|
|
periodAnnotation: 6,
|
|
romanNumeralAnnotation: 7,
|
|
diamondAnnotation: 8,
|
|
invertedBoxAnnotation: 9,
|
|
invertedRoundedBoxAnnotation: 10
|
|
},
|
|
kanaSpacing: {
|
|
code: 25,
|
|
exclusive: true,
|
|
fullWidthKana: 0,
|
|
proportionalKana: 1
|
|
},
|
|
ideographicSpacing: {
|
|
code: 26,
|
|
exclusive: true,
|
|
fullWidthIdeographs: 0,
|
|
proportionalIdeographs: 1,
|
|
halfWidthIdeographs: 2
|
|
},
|
|
unicodeDecomposition: {
|
|
code: 27,
|
|
exclusive: false,
|
|
canonicalComposition: 0,
|
|
compatibilityComposition: 2,
|
|
transcodingComposition: 4
|
|
},
|
|
rubyKana: {
|
|
code: 28,
|
|
exclusive: false,
|
|
// noRubyKana: 0 # deprecated - use rubyKanaOff instead
|
|
// rubyKana: 1 # deprecated - use rubyKanaOn instead
|
|
rubyKana: 2
|
|
},
|
|
CJKSymbolAlternatives: {
|
|
code: 29,
|
|
exclusive: true,
|
|
noCJKSymbolAlternatives: 0,
|
|
CJKSymbolAltOne: 1,
|
|
CJKSymbolAltTwo: 2,
|
|
CJKSymbolAltThree: 3,
|
|
CJKSymbolAltFour: 4,
|
|
CJKSymbolAltFive: 5
|
|
},
|
|
ideographicAlternatives: {
|
|
code: 30,
|
|
exclusive: true,
|
|
noIdeographicAlternatives: 0,
|
|
ideographicAltOne: 1,
|
|
ideographicAltTwo: 2,
|
|
ideographicAltThree: 3,
|
|
ideographicAltFour: 4,
|
|
ideographicAltFive: 5
|
|
},
|
|
CJKVerticalRomanPlacement: {
|
|
code: 31,
|
|
exclusive: true,
|
|
CJKVerticalRomanCentered: 0,
|
|
CJKVerticalRomanHBaseline: 1
|
|
},
|
|
italicCJKRoman: {
|
|
code: 32,
|
|
exclusive: false,
|
|
// noCJKItalicRoman: 0 # deprecated - use CJKItalicRomanOff instead
|
|
// CJKItalicRoman: 1 # deprecated - use CJKItalicRomanOn instead
|
|
CJKItalicRoman: 2
|
|
},
|
|
caseSensitiveLayout: {
|
|
code: 33,
|
|
exclusive: false,
|
|
caseSensitiveLayout: 0,
|
|
caseSensitiveSpacing: 2
|
|
},
|
|
alternateKana: {
|
|
code: 34,
|
|
exclusive: false,
|
|
alternateHorizKana: 0,
|
|
alternateVertKana: 2
|
|
},
|
|
stylisticAlternatives: {
|
|
code: 35,
|
|
exclusive: false,
|
|
noStylisticAlternates: 0,
|
|
stylisticAltOne: 2,
|
|
stylisticAltTwo: 4,
|
|
stylisticAltThree: 6,
|
|
stylisticAltFour: 8,
|
|
stylisticAltFive: 10,
|
|
stylisticAltSix: 12,
|
|
stylisticAltSeven: 14,
|
|
stylisticAltEight: 16,
|
|
stylisticAltNine: 18,
|
|
stylisticAltTen: 20,
|
|
stylisticAltEleven: 22,
|
|
stylisticAltTwelve: 24,
|
|
stylisticAltThirteen: 26,
|
|
stylisticAltFourteen: 28,
|
|
stylisticAltFifteen: 30,
|
|
stylisticAltSixteen: 32,
|
|
stylisticAltSeventeen: 34,
|
|
stylisticAltEighteen: 36,
|
|
stylisticAltNineteen: 38,
|
|
stylisticAltTwenty: 40
|
|
},
|
|
contextualAlternates: {
|
|
code: 36,
|
|
exclusive: false,
|
|
contextualAlternates: 0,
|
|
swashAlternates: 2,
|
|
contextualSwashAlternates: 4
|
|
},
|
|
lowerCase: {
|
|
code: 37,
|
|
exclusive: true,
|
|
defaultLowerCase: 0,
|
|
lowerCaseSmallCaps: 1,
|
|
lowerCasePetiteCaps: 2
|
|
},
|
|
upperCase: {
|
|
code: 38,
|
|
exclusive: true,
|
|
defaultUpperCase: 0,
|
|
upperCaseSmallCaps: 1,
|
|
upperCasePetiteCaps: 2
|
|
},
|
|
languageTag: { // indices into ltag table
|
|
code: 39,
|
|
exclusive: true
|
|
},
|
|
CJKRomanSpacing: {
|
|
code: 103,
|
|
exclusive: true,
|
|
halfWidthCJKRoman: 0,
|
|
proportionalCJKRoman: 1,
|
|
defaultCJKRoman: 2,
|
|
fullWidthCJKRoman: 3
|
|
}
|
|
};
|
|
|
|
var feature = function feature(name, selector) {
|
|
return [features[name].code, features[name][selector]];
|
|
};
|
|
|
|
var OTMapping = {
|
|
rlig: feature('ligatures', 'requiredLigatures'),
|
|
clig: feature('ligatures', 'contextualLigatures'),
|
|
dlig: feature('ligatures', 'rareLigatures'),
|
|
hlig: feature('ligatures', 'historicalLigatures'),
|
|
liga: feature('ligatures', 'commonLigatures'),
|
|
hist: feature('ligatures', 'historicalLigatures'), // ??
|
|
|
|
smcp: feature('lowerCase', 'lowerCaseSmallCaps'),
|
|
pcap: feature('lowerCase', 'lowerCasePetiteCaps'),
|
|
|
|
frac: feature('fractions', 'diagonalFractions'),
|
|
dnom: feature('fractions', 'diagonalFractions'), // ??
|
|
numr: feature('fractions', 'diagonalFractions'), // ??
|
|
afrc: feature('fractions', 'verticalFractions'),
|
|
// aalt
|
|
// abvf, abvm, abvs, akhn, blwf, blwm, blws, cfar, cjct, cpsp, falt, isol, jalt, ljmo, mset?
|
|
// ltra, ltrm, nukt, pref, pres, pstf, psts, rand, rkrf, rphf, rtla, rtlm, size, tjmo, tnum?
|
|
// unic, vatu, vhal, vjmo, vpal, vrt2
|
|
// dist -> trak table?
|
|
// kern, vkrn -> kern table
|
|
// lfbd + opbd + rtbd -> opbd table?
|
|
// mark, mkmk -> acnt table?
|
|
// locl -> languageTag + ltag table
|
|
|
|
case: feature('caseSensitiveLayout', 'caseSensitiveLayout'), // also caseSensitiveSpacing
|
|
ccmp: feature('unicodeDecomposition', 'canonicalComposition'), // compatibilityComposition?
|
|
cpct: feature('CJKVerticalRomanPlacement', 'CJKVerticalRomanCentered'), // guess..., probably not given below
|
|
valt: feature('CJKVerticalRomanPlacement', 'CJKVerticalRomanCentered'),
|
|
swsh: feature('contextualAlternates', 'swashAlternates'),
|
|
cswh: feature('contextualAlternates', 'contextualSwashAlternates'),
|
|
curs: feature('cursiveConnection', 'cursive'), // ??
|
|
c2pc: feature('upperCase', 'upperCasePetiteCaps'),
|
|
c2sc: feature('upperCase', 'upperCaseSmallCaps'),
|
|
|
|
init: feature('smartSwash', 'wordInitialSwashes'), // ??
|
|
fin2: feature('smartSwash', 'wordFinalSwashes'), // ??
|
|
medi: feature('smartSwash', 'nonFinalSwashes'), // ??
|
|
med2: feature('smartSwash', 'nonFinalSwashes'), // ??
|
|
fin3: feature('smartSwash', 'wordFinalSwashes'), // ??
|
|
fina: feature('smartSwash', 'wordFinalSwashes'), // ??
|
|
|
|
pkna: feature('kanaSpacing', 'proportionalKana'),
|
|
half: feature('textSpacing', 'halfWidthText'), // also HalfWidthCJKRoman, HalfWidthIdeographs?
|
|
halt: feature('textSpacing', 'altHalfWidthText'),
|
|
|
|
hkna: feature('alternateKana', 'alternateHorizKana'),
|
|
vkna: feature('alternateKana', 'alternateVertKana'),
|
|
// hngl: feature 'transliteration', 'hanjaToHangulSelector' # deprecated
|
|
|
|
ital: feature('italicCJKRoman', 'CJKItalicRoman'),
|
|
lnum: feature('numberCase', 'upperCaseNumbers'),
|
|
onum: feature('numberCase', 'lowerCaseNumbers'),
|
|
mgrk: feature('mathematicalExtras', 'mathematicalGreek'),
|
|
|
|
// nalt: not enough info. what type of annotation?
|
|
// ornm: ditto, which ornament style?
|
|
|
|
calt: feature('contextualAlternates', 'contextualAlternates'), // or more?
|
|
vrt2: feature('verticalSubstitution', 'substituteVerticalForms'), // oh... below?
|
|
vert: feature('verticalSubstitution', 'substituteVerticalForms'),
|
|
tnum: feature('numberSpacing', 'monospacedNumbers'),
|
|
pnum: feature('numberSpacing', 'proportionalNumbers'),
|
|
sups: feature('verticalPosition', 'superiors'),
|
|
subs: feature('verticalPosition', 'inferiors'),
|
|
ordn: feature('verticalPosition', 'ordinals'),
|
|
pwid: feature('textSpacing', 'proportionalText'),
|
|
hwid: feature('textSpacing', 'halfWidthText'),
|
|
qwid: feature('textSpacing', 'quarterWidthText'), // also QuarterWidthNumbers?
|
|
twid: feature('textSpacing', 'thirdWidthText'), // also ThirdWidthNumbers?
|
|
fwid: feature('textSpacing', 'proportionalText'), //??
|
|
palt: feature('textSpacing', 'altProportionalText'),
|
|
trad: feature('characterShape', 'traditionalCharacters'),
|
|
smpl: feature('characterShape', 'simplifiedCharacters'),
|
|
jp78: feature('characterShape', 'JIS1978Characters'),
|
|
jp83: feature('characterShape', 'JIS1983Characters'),
|
|
jp90: feature('characterShape', 'JIS1990Characters'),
|
|
jp04: feature('characterShape', 'JIS2004Characters'),
|
|
expt: feature('characterShape', 'expertCharacters'),
|
|
hojo: feature('characterShape', 'hojoCharacters'),
|
|
nlck: feature('characterShape', 'NLCCharacters'),
|
|
tnam: feature('characterShape', 'traditionalNamesCharacters'),
|
|
ruby: feature('rubyKana', 'rubyKana'),
|
|
titl: feature('styleOptions', 'titlingCaps'),
|
|
zero: feature('typographicExtras', 'slashedZero'),
|
|
|
|
ss01: feature('stylisticAlternatives', 'stylisticAltOne'),
|
|
ss02: feature('stylisticAlternatives', 'stylisticAltTwo'),
|
|
ss03: feature('stylisticAlternatives', 'stylisticAltThree'),
|
|
ss04: feature('stylisticAlternatives', 'stylisticAltFour'),
|
|
ss05: feature('stylisticAlternatives', 'stylisticAltFive'),
|
|
ss06: feature('stylisticAlternatives', 'stylisticAltSix'),
|
|
ss07: feature('stylisticAlternatives', 'stylisticAltSeven'),
|
|
ss08: feature('stylisticAlternatives', 'stylisticAltEight'),
|
|
ss09: feature('stylisticAlternatives', 'stylisticAltNine'),
|
|
ss10: feature('stylisticAlternatives', 'stylisticAltTen'),
|
|
ss11: feature('stylisticAlternatives', 'stylisticAltEleven'),
|
|
ss12: feature('stylisticAlternatives', 'stylisticAltTwelve'),
|
|
ss13: feature('stylisticAlternatives', 'stylisticAltThirteen'),
|
|
ss14: feature('stylisticAlternatives', 'stylisticAltFourteen'),
|
|
ss15: feature('stylisticAlternatives', 'stylisticAltFifteen'),
|
|
ss16: feature('stylisticAlternatives', 'stylisticAltSixteen'),
|
|
ss17: feature('stylisticAlternatives', 'stylisticAltSeventeen'),
|
|
ss18: feature('stylisticAlternatives', 'stylisticAltEighteen'),
|
|
ss19: feature('stylisticAlternatives', 'stylisticAltNineteen'),
|
|
ss20: feature('stylisticAlternatives', 'stylisticAltTwenty')
|
|
};
|
|
|
|
// salt: feature 'stylisticAlternatives', 'stylisticAltOne' # hmm, which one to choose
|
|
|
|
// Add cv01-cv99 features
|
|
for (var i = 1; i <= 99; i++) {
|
|
OTMapping['cv' + ('00' + i).slice(-2)] = [features.characterAlternatives.code, i];
|
|
}
|
|
|
|
// create inverse mapping
|
|
var AATMapping = {};
|
|
for (var ot in OTMapping) {
|
|
var aat = OTMapping[ot];
|
|
if (AATMapping[aat[0]] == null) {
|
|
AATMapping[aat[0]] = {};
|
|
}
|
|
|
|
AATMapping[aat[0]][aat[1]] = ot;
|
|
}
|
|
|
|
// Maps an array of OpenType features to AAT features
|
|
// in the form of {featureType:{featureSetting:true}}
|
|
function mapOTToAAT(features) {
|
|
var res = {};
|
|
for (var k = 0; k < features.length; k++) {
|
|
var r = void 0;
|
|
if (r = OTMapping[features[k]]) {
|
|
if (res[r[0]] == null) {
|
|
res[r[0]] = {};
|
|
}
|
|
|
|
res[r[0]][r[1]] = true;
|
|
}
|
|
}
|
|
|
|
return res;
|
|
}
|
|
|
|
// Maps strings in a [featureType, featureSetting]
|
|
// to their equivalent number codes
|
|
function mapFeatureStrings(f) {
|
|
var _f = _slicedToArray(f, 2),
|
|
type = _f[0],
|
|
setting = _f[1];
|
|
|
|
if (isNaN(type)) {
|
|
var typeCode = features[type] && features[type].code;
|
|
} else {
|
|
var typeCode = type;
|
|
}
|
|
|
|
if (isNaN(setting)) {
|
|
var settingCode = features[type] && features[type][setting];
|
|
} else {
|
|
var settingCode = setting;
|
|
}
|
|
|
|
return [typeCode, settingCode];
|
|
}
|
|
|
|
// Maps AAT features to an array of OpenType features
|
|
// Supports both arrays in the form of [[featureType, featureSetting]]
|
|
// and objects in the form of {featureType:{featureSetting:true}}
|
|
// featureTypes and featureSettings can be either strings or number codes
|
|
function mapAATToOT(features) {
|
|
var res = {};
|
|
if (Array.isArray(features)) {
|
|
for (var k = 0; k < features.length; k++) {
|
|
var r = void 0;
|
|
var f = mapFeatureStrings(features[k]);
|
|
if (r = AATMapping[f[0]] && AATMapping[f[0]][f[1]]) {
|
|
res[r] = true;
|
|
}
|
|
}
|
|
} else if ((typeof features === 'undefined' ? 'undefined' : _typeof(features)) === 'object') {
|
|
for (var type in features) {
|
|
var _feature = features[type];
|
|
for (var setting in _feature) {
|
|
var _r = void 0;
|
|
var _f2 = mapFeatureStrings([type, setting]);
|
|
if (_feature[setting] && (_r = AATMapping[_f2[0]] && AATMapping[_f2[0]][_f2[1]])) {
|
|
res[_r] = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return _Object$keys(res);
|
|
}
|
|
|
|
var _class$3;
|
|
function _applyDecoratedDescriptor$3(target, property, decorators, descriptor, context) {
|
|
var desc = {};
|
|
Object['ke' + 'ys'](descriptor).forEach(function (key) {
|
|
desc[key] = descriptor[key];
|
|
});
|
|
desc.enumerable = !!desc.enumerable;
|
|
desc.configurable = !!desc.configurable;
|
|
|
|
if ('value' in desc || desc.initializer) {
|
|
desc.writable = true;
|
|
}
|
|
|
|
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
|
|
return decorator(target, property, desc) || desc;
|
|
}, desc);
|
|
|
|
if (context && desc.initializer !== void 0) {
|
|
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
|
|
desc.initializer = undefined;
|
|
}
|
|
|
|
if (desc.initializer === void 0) {
|
|
Object['define' + 'Property'](target, property, desc);
|
|
desc = null;
|
|
}
|
|
|
|
return desc;
|
|
}
|
|
|
|
var AATLookupTable = (_class$3 = function () {
|
|
function AATLookupTable(table) {
|
|
_classCallCheck(this, AATLookupTable);
|
|
|
|
this.table = table;
|
|
}
|
|
|
|
_createClass(AATLookupTable, [{
|
|
key: 'lookup',
|
|
value: function lookup(glyph) {
|
|
switch (this.table.version) {
|
|
case 0:
|
|
// simple array format
|
|
return this.table.values.getItem(glyph);
|
|
|
|
case 2: // segment format
|
|
case 4:
|
|
{
|
|
var min = 0;
|
|
var max = this.table.binarySearchHeader.nUnits - 1;
|
|
|
|
while (min <= max) {
|
|
var mid = min + max >> 1;
|
|
var seg = this.table.segments[mid];
|
|
|
|
// special end of search value
|
|
if (seg.firstGlyph === 0xffff) {
|
|
return null;
|
|
}
|
|
|
|
if (glyph < seg.firstGlyph) {
|
|
max = mid - 1;
|
|
} else if (glyph > seg.lastGlyph) {
|
|
min = mid + 1;
|
|
} else {
|
|
if (this.table.version === 2) {
|
|
return seg.value;
|
|
} else {
|
|
return seg.values[glyph - seg.firstGlyph];
|
|
}
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
case 6:
|
|
{
|
|
// lookup single
|
|
var _min = 0;
|
|
var _max = this.table.binarySearchHeader.nUnits - 1;
|
|
|
|
while (_min <= _max) {
|
|
var mid = _min + _max >> 1;
|
|
var seg = this.table.segments[mid];
|
|
|
|
// special end of search value
|
|
if (seg.glyph === 0xffff) {
|
|
return null;
|
|
}
|
|
|
|
if (glyph < seg.glyph) {
|
|
_max = mid - 1;
|
|
} else if (glyph > seg.glyph) {
|
|
_min = mid + 1;
|
|
} else {
|
|
return seg.value;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
case 8:
|
|
// lookup trimmed
|
|
return this.table.values[glyph - this.table.firstGlyph];
|
|
|
|
default:
|
|
throw new Error('Unknown lookup table format: ' + this.table.version);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'glyphsForValue',
|
|
value: function glyphsForValue(classValue) {
|
|
var res = [];
|
|
|
|
switch (this.table.version) {
|
|
case 2: // segment format
|
|
case 4:
|
|
{
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.table.segments), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var segment = _step.value;
|
|
|
|
if (this.table.version === 2 && segment.value === classValue) {
|
|
res.push.apply(res, _toConsumableArray(range(segment.firstGlyph, segment.lastGlyph + 1)));
|
|
} else {
|
|
for (var index = 0; index < segment.values.length; index++) {
|
|
if (segment.values[index] === classValue) {
|
|
res.push(segment.firstGlyph + index);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
case 6:
|
|
{
|
|
// lookup single
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(this.table.segments), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var _segment = _step2.value;
|
|
|
|
if (_segment.value === classValue) {
|
|
res.push(_segment.glyph);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
case 8:
|
|
{
|
|
// lookup trimmed
|
|
for (var i = 0; i < this.table.values.length; i++) {
|
|
if (this.table.values[i] === classValue) {
|
|
res.push(this.table.firstGlyph + i);
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
default:
|
|
throw new Error('Unknown lookup table format: ' + this.table.version);
|
|
}
|
|
|
|
return res;
|
|
}
|
|
}]);
|
|
|
|
return AATLookupTable;
|
|
}(), (_applyDecoratedDescriptor$3(_class$3.prototype, 'glyphsForValue', [cache], _Object$getOwnPropertyDescriptor(_class$3.prototype, 'glyphsForValue'), _class$3.prototype)), _class$3);
|
|
|
|
var START_OF_TEXT_STATE = 0;
|
|
var END_OF_TEXT_CLASS = 0;
|
|
var OUT_OF_BOUNDS_CLASS = 1;
|
|
var DELETED_GLYPH_CLASS = 2;
|
|
var DONT_ADVANCE = 0x4000;
|
|
|
|
var AATStateMachine = function () {
|
|
function AATStateMachine(stateTable) {
|
|
_classCallCheck(this, AATStateMachine);
|
|
|
|
this.stateTable = stateTable;
|
|
this.lookupTable = new AATLookupTable(stateTable.classTable);
|
|
}
|
|
|
|
_createClass(AATStateMachine, [{
|
|
key: 'process',
|
|
value: function process(glyphs, reverse, processEntry) {
|
|
var currentState = START_OF_TEXT_STATE; // START_OF_LINE_STATE is used for kashida glyph insertions sometimes I think?
|
|
var index = reverse ? glyphs.length - 1 : 0;
|
|
var dir = reverse ? -1 : 1;
|
|
|
|
while (dir === 1 && index <= glyphs.length || dir === -1 && index >= -1) {
|
|
var glyph = null;
|
|
var classCode = OUT_OF_BOUNDS_CLASS;
|
|
var shouldAdvance = true;
|
|
|
|
if (index === glyphs.length || index === -1) {
|
|
classCode = END_OF_TEXT_CLASS;
|
|
} else {
|
|
glyph = glyphs[index];
|
|
if (glyph.id === 0xffff) {
|
|
// deleted glyph
|
|
classCode = DELETED_GLYPH_CLASS;
|
|
} else {
|
|
classCode = this.lookupTable.lookup(glyph.id);
|
|
if (classCode == null) {
|
|
classCode = OUT_OF_BOUNDS_CLASS;
|
|
}
|
|
}
|
|
}
|
|
|
|
var row = this.stateTable.stateArray.getItem(currentState);
|
|
var entryIndex = row[classCode];
|
|
var entry = this.stateTable.entryTable.getItem(entryIndex);
|
|
|
|
if (classCode !== END_OF_TEXT_CLASS && classCode !== DELETED_GLYPH_CLASS) {
|
|
processEntry(glyph, entry, index);
|
|
shouldAdvance = !(entry.flags & DONT_ADVANCE);
|
|
}
|
|
|
|
currentState = entry.newState;
|
|
if (shouldAdvance) {
|
|
index += dir;
|
|
}
|
|
}
|
|
|
|
return glyphs;
|
|
}
|
|
|
|
/**
|
|
* Performs a depth-first traversal of the glyph strings
|
|
* represented by the state machine.
|
|
*/
|
|
|
|
}, {
|
|
key: 'traverse',
|
|
value: function traverse(opts) {
|
|
var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
var visited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new _Set();
|
|
|
|
if (visited.has(state)) {
|
|
return;
|
|
}
|
|
|
|
visited.add(state);
|
|
|
|
var _stateTable = this.stateTable,
|
|
nClasses = _stateTable.nClasses,
|
|
stateArray = _stateTable.stateArray,
|
|
entryTable = _stateTable.entryTable;
|
|
|
|
var row = stateArray.getItem(state);
|
|
|
|
// Skip predefined classes
|
|
for (var classCode = 4; classCode < nClasses; classCode++) {
|
|
var entryIndex = row[classCode];
|
|
var entry = entryTable.getItem(entryIndex);
|
|
|
|
// Try all glyphs in the class
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.lookupTable.glyphsForValue(classCode)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var glyph = _step.value;
|
|
|
|
if (opts.enter) {
|
|
opts.enter(glyph, entry);
|
|
}
|
|
|
|
if (entry.newState !== 0) {
|
|
this.traverse(opts, entry.newState, visited);
|
|
}
|
|
|
|
if (opts.exit) {
|
|
opts.exit(glyph, entry);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return AATStateMachine;
|
|
}();
|
|
|
|
var _class$2;
|
|
function _applyDecoratedDescriptor$2(target, property, decorators, descriptor, context) {
|
|
var desc = {};
|
|
Object['ke' + 'ys'](descriptor).forEach(function (key) {
|
|
desc[key] = descriptor[key];
|
|
});
|
|
desc.enumerable = !!desc.enumerable;
|
|
desc.configurable = !!desc.configurable;
|
|
|
|
if ('value' in desc || desc.initializer) {
|
|
desc.writable = true;
|
|
}
|
|
|
|
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
|
|
return decorator(target, property, desc) || desc;
|
|
}, desc);
|
|
|
|
if (context && desc.initializer !== void 0) {
|
|
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
|
|
desc.initializer = undefined;
|
|
}
|
|
|
|
if (desc.initializer === void 0) {
|
|
Object['define' + 'Property'](target, property, desc);
|
|
desc = null;
|
|
}
|
|
|
|
return desc;
|
|
}
|
|
|
|
// indic replacement flags
|
|
var MARK_FIRST = 0x8000;
|
|
var MARK_LAST = 0x2000;
|
|
var VERB = 0x000F;
|
|
|
|
// contextual substitution and glyph insertion flag
|
|
var SET_MARK = 0x8000;
|
|
|
|
// ligature entry flags
|
|
var SET_COMPONENT = 0x8000;
|
|
var PERFORM_ACTION = 0x2000;
|
|
|
|
// ligature action masks
|
|
var LAST_MASK = 0x80000000;
|
|
var STORE_MASK = 0x40000000;
|
|
var OFFSET_MASK = 0x3FFFFFFF;
|
|
|
|
var REVERSE_DIRECTION = 0x400000;
|
|
var CURRENT_INSERT_BEFORE = 0x0800;
|
|
var MARKED_INSERT_BEFORE = 0x0400;
|
|
var CURRENT_INSERT_COUNT = 0x03E0;
|
|
var MARKED_INSERT_COUNT = 0x001F;
|
|
|
|
var AATMorxProcessor = (_class$2 = function () {
|
|
function AATMorxProcessor(font) {
|
|
_classCallCheck(this, AATMorxProcessor);
|
|
|
|
this.processIndicRearragement = this.processIndicRearragement.bind(this);
|
|
this.processContextualSubstitution = this.processContextualSubstitution.bind(this);
|
|
this.processLigature = this.processLigature.bind(this);
|
|
this.processNoncontextualSubstitutions = this.processNoncontextualSubstitutions.bind(this);
|
|
this.processGlyphInsertion = this.processGlyphInsertion.bind(this);
|
|
this.font = font;
|
|
this.morx = font.morx;
|
|
this.inputCache = null;
|
|
}
|
|
|
|
// Processes an array of glyphs and applies the specified features
|
|
// Features should be in the form of {featureType:{featureSetting:true}}
|
|
|
|
|
|
_createClass(AATMorxProcessor, [{
|
|
key: 'process',
|
|
value: function process(glyphs) {
|
|
var features = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.morx.chains), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var chain = _step.value;
|
|
|
|
var flags = chain.defaultFlags;
|
|
|
|
// enable/disable the requested features
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(chain.features), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var feature = _step2.value;
|
|
|
|
var f = void 0;
|
|
if ((f = features[feature.featureType]) && f[feature.featureSetting]) {
|
|
flags &= feature.disableFlags;
|
|
flags |= feature.enableFlags;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
var _iteratorNormalCompletion3 = true;
|
|
var _didIteratorError3 = false;
|
|
var _iteratorError3 = undefined;
|
|
|
|
try {
|
|
for (var _iterator3 = _getIterator(chain.subtables), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
var subtable = _step3.value;
|
|
|
|
if (subtable.subFeatureFlags & flags) {
|
|
this.processSubtable(subtable, glyphs);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError3 = true;
|
|
_iteratorError3 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
_iterator3.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError3) {
|
|
throw _iteratorError3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// remove deleted glyphs
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
var index = glyphs.length - 1;
|
|
while (index >= 0) {
|
|
if (glyphs[index].id === 0xffff) {
|
|
glyphs.splice(index, 1);
|
|
}
|
|
|
|
index--;
|
|
}
|
|
|
|
return glyphs;
|
|
}
|
|
}, {
|
|
key: 'processSubtable',
|
|
value: function processSubtable(subtable, glyphs) {
|
|
this.subtable = subtable;
|
|
this.glyphs = glyphs;
|
|
if (this.subtable.type === 4) {
|
|
this.processNoncontextualSubstitutions(this.subtable, this.glyphs);
|
|
return;
|
|
}
|
|
|
|
this.ligatureStack = [];
|
|
this.markedGlyph = null;
|
|
this.firstGlyph = null;
|
|
this.lastGlyph = null;
|
|
this.markedIndex = null;
|
|
|
|
var stateMachine = this.getStateMachine(subtable);
|
|
var process = this.getProcessor();
|
|
|
|
var reverse = !!(this.subtable.coverage & REVERSE_DIRECTION);
|
|
return stateMachine.process(this.glyphs, reverse, process);
|
|
}
|
|
}, {
|
|
key: 'getStateMachine',
|
|
value: function getStateMachine(subtable) {
|
|
return new AATStateMachine(subtable.table.stateTable);
|
|
}
|
|
}, {
|
|
key: 'getProcessor',
|
|
value: function getProcessor() {
|
|
switch (this.subtable.type) {
|
|
case 0:
|
|
return this.processIndicRearragement;
|
|
case 1:
|
|
return this.processContextualSubstitution;
|
|
case 2:
|
|
return this.processLigature;
|
|
case 4:
|
|
return this.processNoncontextualSubstitutions;
|
|
case 5:
|
|
return this.processGlyphInsertion;
|
|
default:
|
|
throw new Error('Invalid morx subtable type: ' + this.subtable.type);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'processIndicRearragement',
|
|
value: function processIndicRearragement(glyph, entry, index) {
|
|
if (entry.flags & MARK_FIRST) {
|
|
this.firstGlyph = index;
|
|
}
|
|
|
|
if (entry.flags & MARK_LAST) {
|
|
this.lastGlyph = index;
|
|
}
|
|
|
|
reorderGlyphs(this.glyphs, entry.flags & VERB, this.firstGlyph, this.lastGlyph);
|
|
}
|
|
}, {
|
|
key: 'processContextualSubstitution',
|
|
value: function processContextualSubstitution(glyph, entry, index) {
|
|
var subsitutions = this.subtable.table.substitutionTable.items;
|
|
if (entry.markIndex !== 0xffff) {
|
|
var lookup = subsitutions.getItem(entry.markIndex);
|
|
var lookupTable = new AATLookupTable(lookup);
|
|
glyph = this.glyphs[this.markedGlyph];
|
|
var gid = lookupTable.lookup(glyph.id);
|
|
if (gid) {
|
|
this.glyphs[this.markedGlyph] = this.font.getGlyph(gid, glyph.codePoints);
|
|
}
|
|
}
|
|
|
|
if (entry.currentIndex !== 0xffff) {
|
|
var _lookup = subsitutions.getItem(entry.currentIndex);
|
|
var _lookupTable = new AATLookupTable(_lookup);
|
|
glyph = this.glyphs[index];
|
|
var gid = _lookupTable.lookup(glyph.id);
|
|
if (gid) {
|
|
this.glyphs[index] = this.font.getGlyph(gid, glyph.codePoints);
|
|
}
|
|
}
|
|
|
|
if (entry.flags & SET_MARK) {
|
|
this.markedGlyph = index;
|
|
}
|
|
}
|
|
}, {
|
|
key: 'processLigature',
|
|
value: function processLigature(glyph, entry, index) {
|
|
if (entry.flags & SET_COMPONENT) {
|
|
this.ligatureStack.push(index);
|
|
}
|
|
|
|
if (entry.flags & PERFORM_ACTION) {
|
|
var _ligatureStack;
|
|
|
|
var actions = this.subtable.table.ligatureActions;
|
|
var components = this.subtable.table.components;
|
|
var ligatureList = this.subtable.table.ligatureList;
|
|
|
|
var actionIndex = entry.action;
|
|
var last = false;
|
|
var ligatureIndex = 0;
|
|
var codePoints = [];
|
|
var ligatureGlyphs = [];
|
|
|
|
while (!last) {
|
|
var _codePoints;
|
|
|
|
var componentGlyph = this.ligatureStack.pop();
|
|
(_codePoints = codePoints).unshift.apply(_codePoints, _toConsumableArray(this.glyphs[componentGlyph].codePoints));
|
|
|
|
var action = actions.getItem(actionIndex++);
|
|
last = !!(action & LAST_MASK);
|
|
var store = !!(action & STORE_MASK);
|
|
var offset = (action & OFFSET_MASK) << 2 >> 2; // sign extend 30 to 32 bits
|
|
offset += this.glyphs[componentGlyph].id;
|
|
|
|
var component = components.getItem(offset);
|
|
ligatureIndex += component;
|
|
|
|
if (last || store) {
|
|
var ligatureEntry = ligatureList.getItem(ligatureIndex);
|
|
this.glyphs[componentGlyph] = this.font.getGlyph(ligatureEntry, codePoints);
|
|
ligatureGlyphs.push(componentGlyph);
|
|
ligatureIndex = 0;
|
|
codePoints = [];
|
|
} else {
|
|
this.glyphs[componentGlyph] = this.font.getGlyph(0xffff);
|
|
}
|
|
}
|
|
|
|
// Put ligature glyph indexes back on the stack
|
|
(_ligatureStack = this.ligatureStack).push.apply(_ligatureStack, ligatureGlyphs);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'processNoncontextualSubstitutions',
|
|
value: function processNoncontextualSubstitutions(subtable, glyphs, index) {
|
|
var lookupTable = new AATLookupTable(subtable.table.lookupTable);
|
|
|
|
for (index = 0; index < glyphs.length; index++) {
|
|
var glyph = glyphs[index];
|
|
if (glyph.id !== 0xffff) {
|
|
var gid = lookupTable.lookup(glyph.id);
|
|
if (gid) {
|
|
// 0 means do nothing
|
|
glyphs[index] = this.font.getGlyph(gid, glyph.codePoints);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: '_insertGlyphs',
|
|
value: function _insertGlyphs(glyphIndex, insertionActionIndex, count, isBefore) {
|
|
var _glyphs;
|
|
|
|
var insertions = [];
|
|
while (count--) {
|
|
var gid = this.subtable.table.insertionActions.getItem(insertionActionIndex++);
|
|
insertions.push(this.font.getGlyph(gid));
|
|
}
|
|
|
|
if (!isBefore) {
|
|
glyphIndex++;
|
|
}
|
|
|
|
(_glyphs = this.glyphs).splice.apply(_glyphs, [glyphIndex, 0].concat(insertions));
|
|
}
|
|
}, {
|
|
key: 'processGlyphInsertion',
|
|
value: function processGlyphInsertion(glyph, entry, index) {
|
|
if (entry.flags & SET_MARK) {
|
|
this.markedIndex = index;
|
|
}
|
|
|
|
if (entry.markedInsertIndex !== 0xffff) {
|
|
var count = (entry.flags & MARKED_INSERT_COUNT) >>> 5;
|
|
var isBefore = !!(entry.flags & MARKED_INSERT_BEFORE);
|
|
this._insertGlyphs(this.markedIndex, entry.markedInsertIndex, count, isBefore);
|
|
}
|
|
|
|
if (entry.currentInsertIndex !== 0xffff) {
|
|
var _count = (entry.flags & CURRENT_INSERT_COUNT) >>> 5;
|
|
var _isBefore = !!(entry.flags & CURRENT_INSERT_BEFORE);
|
|
this._insertGlyphs(index, entry.currentInsertIndex, _count, _isBefore);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'getSupportedFeatures',
|
|
value: function getSupportedFeatures() {
|
|
var features = [];
|
|
var _iteratorNormalCompletion4 = true;
|
|
var _didIteratorError4 = false;
|
|
var _iteratorError4 = undefined;
|
|
|
|
try {
|
|
for (var _iterator4 = _getIterator(this.morx.chains), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
var chain = _step4.value;
|
|
var _iteratorNormalCompletion5 = true;
|
|
var _didIteratorError5 = false;
|
|
var _iteratorError5 = undefined;
|
|
|
|
try {
|
|
for (var _iterator5 = _getIterator(chain.features), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
|
var feature = _step5.value;
|
|
|
|
features.push([feature.featureType, feature.featureSetting]);
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError5 = true;
|
|
_iteratorError5 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion5 && _iterator5.return) {
|
|
_iterator5.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError5) {
|
|
throw _iteratorError5;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError4 = true;
|
|
_iteratorError4 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
|
_iterator4.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError4) {
|
|
throw _iteratorError4;
|
|
}
|
|
}
|
|
}
|
|
|
|
return features;
|
|
}
|
|
}, {
|
|
key: 'generateInputs',
|
|
value: function generateInputs(gid) {
|
|
if (!this.inputCache) {
|
|
this.generateInputCache();
|
|
}
|
|
|
|
return this.inputCache[gid] || [];
|
|
}
|
|
}, {
|
|
key: 'generateInputCache',
|
|
value: function generateInputCache() {
|
|
this.inputCache = {};
|
|
|
|
var _iteratorNormalCompletion6 = true;
|
|
var _didIteratorError6 = false;
|
|
var _iteratorError6 = undefined;
|
|
|
|
try {
|
|
for (var _iterator6 = _getIterator(this.morx.chains), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
|
|
var chain = _step6.value;
|
|
|
|
var flags = chain.defaultFlags;
|
|
|
|
var _iteratorNormalCompletion7 = true;
|
|
var _didIteratorError7 = false;
|
|
var _iteratorError7 = undefined;
|
|
|
|
try {
|
|
for (var _iterator7 = _getIterator(chain.subtables), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
|
|
var subtable = _step7.value;
|
|
|
|
if (subtable.subFeatureFlags & flags) {
|
|
this.generateInputsForSubtable(subtable);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError7 = true;
|
|
_iteratorError7 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion7 && _iterator7.return) {
|
|
_iterator7.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError7) {
|
|
throw _iteratorError7;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError6 = true;
|
|
_iteratorError6 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion6 && _iterator6.return) {
|
|
_iterator6.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError6) {
|
|
throw _iteratorError6;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: 'generateInputsForSubtable',
|
|
value: function generateInputsForSubtable(subtable) {
|
|
var _this = this;
|
|
|
|
// Currently, only supporting ligature subtables.
|
|
if (subtable.type !== 2) {
|
|
return;
|
|
}
|
|
|
|
var reverse = !!(subtable.coverage & REVERSE_DIRECTION);
|
|
if (reverse) {
|
|
throw new Error('Reverse subtable, not supported.');
|
|
}
|
|
|
|
this.subtable = subtable;
|
|
this.ligatureStack = [];
|
|
|
|
var stateMachine = this.getStateMachine(subtable);
|
|
var process = this.getProcessor();
|
|
|
|
var input = [];
|
|
var stack = [];
|
|
this.glyphs = [];
|
|
|
|
stateMachine.traverse({
|
|
enter: function enter(glyph, entry) {
|
|
var glyphs = _this.glyphs;
|
|
stack.push({
|
|
glyphs: glyphs.slice(),
|
|
ligatureStack: _this.ligatureStack.slice()
|
|
});
|
|
|
|
// Add glyph to input and glyphs to process.
|
|
var g = _this.font.getGlyph(glyph);
|
|
input.push(g);
|
|
glyphs.push(input[input.length - 1]);
|
|
|
|
// Process ligature substitution
|
|
process(glyphs[glyphs.length - 1], entry, glyphs.length - 1);
|
|
|
|
// Add input to result if only one matching (non-deleted) glyph remains.
|
|
var count = 0;
|
|
var found = 0;
|
|
for (var i = 0; i < glyphs.length && count <= 1; i++) {
|
|
if (glyphs[i].id !== 0xffff) {
|
|
count++;
|
|
found = glyphs[i].id;
|
|
}
|
|
}
|
|
|
|
if (count === 1) {
|
|
var result = input.map(function (g) {
|
|
return g.id;
|
|
});
|
|
var _cache = _this.inputCache[found];
|
|
if (_cache) {
|
|
_cache.push(result);
|
|
} else {
|
|
_this.inputCache[found] = [result];
|
|
}
|
|
}
|
|
},
|
|
|
|
exit: function exit() {
|
|
var _stack$pop = stack.pop();
|
|
|
|
_this.glyphs = _stack$pop.glyphs;
|
|
_this.ligatureStack = _stack$pop.ligatureStack;
|
|
|
|
input.pop();
|
|
}
|
|
});
|
|
}
|
|
}]);
|
|
|
|
return AATMorxProcessor;
|
|
}(), (_applyDecoratedDescriptor$2(_class$2.prototype, 'getStateMachine', [cache], _Object$getOwnPropertyDescriptor(_class$2.prototype, 'getStateMachine'), _class$2.prototype)), _class$2);
|
|
|
|
function swap(glyphs, rangeA, rangeB) {
|
|
var reverseA = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
var reverseB = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
|
|
var end = glyphs.splice(rangeB[0] - (rangeB[1] - 1), rangeB[1]);
|
|
if (reverseB) {
|
|
end.reverse();
|
|
}
|
|
|
|
var start = glyphs.splice.apply(glyphs, [rangeA[0], rangeA[1]].concat(_toConsumableArray(end)));
|
|
if (reverseA) {
|
|
start.reverse();
|
|
}
|
|
|
|
glyphs.splice.apply(glyphs, [rangeB[0] - (rangeA[1] - 1), 0].concat(_toConsumableArray(start)));
|
|
return glyphs;
|
|
}
|
|
|
|
function reorderGlyphs(glyphs, verb, firstGlyph, lastGlyph) {
|
|
var length = lastGlyph - firstGlyph + 1;
|
|
switch (verb) {
|
|
case 0:
|
|
// no change
|
|
return glyphs;
|
|
|
|
case 1:
|
|
// Ax => xA
|
|
return swap(glyphs, [firstGlyph, 1], [lastGlyph, 0]);
|
|
|
|
case 2:
|
|
// xD => Dx
|
|
return swap(glyphs, [firstGlyph, 0], [lastGlyph, 1]);
|
|
|
|
case 3:
|
|
// AxD => DxA
|
|
return swap(glyphs, [firstGlyph, 1], [lastGlyph, 1]);
|
|
|
|
case 4:
|
|
// ABx => xAB
|
|
return swap(glyphs, [firstGlyph, 2], [lastGlyph, 0]);
|
|
|
|
case 5:
|
|
// ABx => xBA
|
|
return swap(glyphs, [firstGlyph, 2], [lastGlyph, 0], true, false);
|
|
|
|
case 6:
|
|
// xCD => CDx
|
|
return swap(glyphs, [firstGlyph, 0], [lastGlyph, 2]);
|
|
|
|
case 7:
|
|
// xCD => DCx
|
|
return swap(glyphs, [firstGlyph, 0], [lastGlyph, 2], false, true);
|
|
|
|
case 8:
|
|
// AxCD => CDxA
|
|
return swap(glyphs, [firstGlyph, 1], [lastGlyph, 2]);
|
|
|
|
case 9:
|
|
// AxCD => DCxA
|
|
return swap(glyphs, [firstGlyph, 1], [lastGlyph, 2], false, true);
|
|
|
|
case 10:
|
|
// ABxD => DxAB
|
|
return swap(glyphs, [firstGlyph, 2], [lastGlyph, 1]);
|
|
|
|
case 11:
|
|
// ABxD => DxBA
|
|
return swap(glyphs, [firstGlyph, 2], [lastGlyph, 1], true, false);
|
|
|
|
case 12:
|
|
// ABxCD => CDxAB
|
|
return swap(glyphs, [firstGlyph, 2], [lastGlyph, 2]);
|
|
|
|
case 13:
|
|
// ABxCD => CDxBA
|
|
return swap(glyphs, [firstGlyph, 2], [lastGlyph, 2], true, false);
|
|
|
|
case 14:
|
|
// ABxCD => DCxAB
|
|
return swap(glyphs, [firstGlyph, 2], [lastGlyph, 2], false, true);
|
|
|
|
case 15:
|
|
// ABxCD => DCxBA
|
|
return swap(glyphs, [firstGlyph, 2], [lastGlyph, 2], true, true);
|
|
|
|
default:
|
|
throw new Error('Unknown verb: ' + verb);
|
|
}
|
|
}
|
|
|
|
var AATLayoutEngine = function () {
|
|
function AATLayoutEngine(font) {
|
|
_classCallCheck(this, AATLayoutEngine);
|
|
|
|
this.font = font;
|
|
this.morxProcessor = new AATMorxProcessor(font);
|
|
}
|
|
|
|
_createClass(AATLayoutEngine, [{
|
|
key: 'substitute',
|
|
value: function substitute(glyphs, features, script, language) {
|
|
// AAT expects the glyphs to be in visual order prior to morx processing,
|
|
// so reverse the glyphs if the script is right-to-left.
|
|
var isRTL = direction(script) === 'rtl';
|
|
if (isRTL) {
|
|
glyphs.reverse();
|
|
}
|
|
|
|
this.morxProcessor.process(glyphs, mapOTToAAT(features));
|
|
return glyphs;
|
|
}
|
|
}, {
|
|
key: 'getAvailableFeatures',
|
|
value: function getAvailableFeatures(script, language) {
|
|
return mapAATToOT(this.morxProcessor.getSupportedFeatures());
|
|
}
|
|
}, {
|
|
key: 'stringsForGlyph',
|
|
value: function stringsForGlyph(gid) {
|
|
var glyphStrings = this.morxProcessor.generateInputs(gid);
|
|
var result = new _Set();
|
|
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(glyphStrings), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var glyphs = _step.value;
|
|
|
|
this._addStrings(glyphs, 0, result, '');
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}, {
|
|
key: '_addStrings',
|
|
value: function _addStrings(glyphs, index, strings, string) {
|
|
var codePoints = this.font._cmapProcessor.codePointsForGlyph(glyphs[index]);
|
|
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(codePoints), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var codePoint = _step2.value;
|
|
|
|
var s = string + _String$fromCodePoint(codePoint);
|
|
if (index < glyphs.length - 1) {
|
|
this._addStrings(glyphs, index + 1, strings, s);
|
|
} else {
|
|
strings.add(s);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return AATLayoutEngine;
|
|
}();
|
|
|
|
/**
|
|
* ShapingPlans are used by the OpenType shapers to store which
|
|
* features should by applied, and in what order to apply them.
|
|
* The features are applied in groups called stages. A feature
|
|
* can be applied globally to all glyphs, or locally to only
|
|
* specific glyphs.
|
|
*
|
|
* @private
|
|
*/
|
|
|
|
var ShapingPlan = function () {
|
|
function ShapingPlan(font, script, language) {
|
|
_classCallCheck(this, ShapingPlan);
|
|
|
|
this.font = font;
|
|
this.script = script;
|
|
this.language = language;
|
|
this.direction = direction(script);
|
|
this.stages = [];
|
|
this.globalFeatures = {};
|
|
this.allFeatures = {};
|
|
}
|
|
|
|
/**
|
|
* Adds the given features to the last stage.
|
|
* Ignores features that have already been applied.
|
|
*/
|
|
|
|
|
|
_createClass(ShapingPlan, [{
|
|
key: '_addFeatures',
|
|
value: function _addFeatures(features) {
|
|
var stage = this.stages[this.stages.length - 1];
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(features), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var feature = _step.value;
|
|
|
|
if (!this.allFeatures[feature]) {
|
|
stage.push(feature);
|
|
this.allFeatures[feature] = true;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Adds the given features to the global list
|
|
*/
|
|
|
|
}, {
|
|
key: '_addGlobal',
|
|
value: function _addGlobal(features) {
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(features), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var feature = _step2.value;
|
|
|
|
this.globalFeatures[feature] = true;
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Add features to the last stage
|
|
*/
|
|
|
|
}, {
|
|
key: 'add',
|
|
value: function add(arg) {
|
|
var global = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
|
|
if (this.stages.length === 0) {
|
|
this.stages.push([]);
|
|
}
|
|
|
|
if (typeof arg === 'string') {
|
|
arg = [arg];
|
|
}
|
|
|
|
if (Array.isArray(arg)) {
|
|
this._addFeatures(arg);
|
|
if (global) {
|
|
this._addGlobal(arg);
|
|
}
|
|
} else if ((typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'object') {
|
|
var features = (arg.global || []).concat(arg.local || []);
|
|
this._addFeatures(features);
|
|
if (arg.global) {
|
|
this._addGlobal(arg.global);
|
|
}
|
|
} else {
|
|
throw new Error("Unsupported argument to ShapingPlan#add");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Add a new stage
|
|
*/
|
|
|
|
}, {
|
|
key: 'addStage',
|
|
value: function addStage(arg, global) {
|
|
if (typeof arg === 'function') {
|
|
this.stages.push(arg, []);
|
|
} else {
|
|
this.stages.push([]);
|
|
this.add(arg, global);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Assigns the global features to the given glyphs
|
|
*/
|
|
|
|
}, {
|
|
key: 'assignGlobalFeatures',
|
|
value: function assignGlobalFeatures(glyphs) {
|
|
var _iteratorNormalCompletion3 = true;
|
|
var _didIteratorError3 = false;
|
|
var _iteratorError3 = undefined;
|
|
|
|
try {
|
|
for (var _iterator3 = _getIterator(glyphs), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
var glyph = _step3.value;
|
|
|
|
for (var feature in this.globalFeatures) {
|
|
glyph.features[feature] = true;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError3 = true;
|
|
_iteratorError3 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
_iterator3.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError3) {
|
|
throw _iteratorError3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Executes the planned stages using the given OTProcessor
|
|
*/
|
|
|
|
}, {
|
|
key: 'process',
|
|
value: function process(processor, glyphs, positions) {
|
|
processor.selectScript(this.script, this.language);
|
|
|
|
var _iteratorNormalCompletion4 = true;
|
|
var _didIteratorError4 = false;
|
|
var _iteratorError4 = undefined;
|
|
|
|
try {
|
|
for (var _iterator4 = _getIterator(this.stages), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
var stage = _step4.value;
|
|
|
|
if (typeof stage === 'function') {
|
|
if (!positions) {
|
|
stage(this.font, glyphs, positions);
|
|
}
|
|
} else if (stage.length > 0) {
|
|
processor.applyFeatures(stage, glyphs, positions);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError4 = true;
|
|
_iteratorError4 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
|
_iterator4.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError4) {
|
|
throw _iteratorError4;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return ShapingPlan;
|
|
}();
|
|
|
|
var _class$4;
|
|
var _temp;
|
|
var COMMON_FEATURES = ['ccmp', 'locl', 'rlig', 'mark', 'mkmk'];
|
|
var FRACTIONAL_FEATURES = ['frac', 'numr', 'dnom'];
|
|
var HORIZONTAL_FEATURES = ['calt', 'clig', 'liga', 'rclt', 'curs', 'kern'];
|
|
var DIRECTIONAL_FEATURES = {
|
|
ltr: ['ltra', 'ltrm'],
|
|
rtl: ['rtla', 'rtlm']
|
|
};
|
|
|
|
var DefaultShaper = (_temp = _class$4 = function () {
|
|
function DefaultShaper() {
|
|
_classCallCheck(this, DefaultShaper);
|
|
}
|
|
|
|
_createClass(DefaultShaper, null, [{
|
|
key: 'plan',
|
|
value: function plan(_plan, glyphs, features) {
|
|
// Plan the features we want to apply
|
|
this.planPreprocessing(_plan);
|
|
this.planFeatures(_plan);
|
|
this.planPostprocessing(_plan, features);
|
|
|
|
// Assign the global features to all the glyphs
|
|
_plan.assignGlobalFeatures(glyphs);
|
|
|
|
// Assign local features to glyphs
|
|
this.assignFeatures(_plan, glyphs);
|
|
}
|
|
}, {
|
|
key: 'planPreprocessing',
|
|
value: function planPreprocessing(plan) {
|
|
plan.add({
|
|
global: DIRECTIONAL_FEATURES[plan.direction],
|
|
local: FRACTIONAL_FEATURES
|
|
});
|
|
}
|
|
}, {
|
|
key: 'planFeatures',
|
|
value: function planFeatures(plan) {
|
|
// Do nothing by default. Let subclasses override this.
|
|
}
|
|
}, {
|
|
key: 'planPostprocessing',
|
|
value: function planPostprocessing(plan, userFeatures) {
|
|
plan.add([].concat(COMMON_FEATURES, HORIZONTAL_FEATURES, _toConsumableArray(userFeatures)));
|
|
}
|
|
}, {
|
|
key: 'assignFeatures',
|
|
value: function assignFeatures(plan, glyphs) {
|
|
// Enable contextual fractions
|
|
var i = 0;
|
|
while (i < glyphs.length) {
|
|
var glyph = glyphs[i];
|
|
if (glyph.codePoints[0] === 0x2044) {
|
|
// fraction slash
|
|
var start = i - 1;
|
|
var end = i + 1;
|
|
|
|
// Apply numerator
|
|
while (start >= 0 && unicode.isDigit(glyphs[start].codePoints[0])) {
|
|
glyphs[start].features.numr = true;
|
|
glyphs[start].features.frac = true;
|
|
start--;
|
|
}
|
|
|
|
// Apply denominator
|
|
while (end < glyphs.length && unicode.isDigit(glyphs[end].codePoints[0])) {
|
|
glyphs[end].features.dnom = true;
|
|
glyphs[end].features.frac = true;
|
|
end++;
|
|
}
|
|
|
|
// Apply fraction slash
|
|
glyph.features.frac = true;
|
|
i = end - 1;
|
|
} else {
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return DefaultShaper;
|
|
}(), _class$4.zeroMarkWidths = 'AFTER_GPOS', _temp);
|
|
|
|
var trie = new UnicodeTrie(Buffer("AAEQAAAAAAAAADGgAZUBav7t2CtPA0EUBeDZB00pin9AJZIEgyUEj0QhweDAgQOJxCBRBElQSBwSicLgkOAwnNKZ5GaY2c7uzj4o5yZfZrrbefbuIx2nSq3CGmzAWH/+K+UO7MIe7MMhHMMpnMMFXMIVXIt2t3CnP088iPqjqNN8e4Ij7Rle4LUH82rLm6i/92A+RERERERERERNmfz/89GDeRARERERzbN8ceps2Iwt9H0C9/AJ6yOlDkbTczcot5VSm8Pm1vcFWfb7+BKOLTuOd2UlTX4wGP85Eg953lWPFbnuN7PkjtLmalOWbNenkHOSa7T3KmR9MVTZ2zZkVj1kHa68MueVKH0R4zqQ44WEXLM8VjcWHP0PtKLfPzQnMtGn3W4QYf6qxFxceVI394r2xnV+1rih0fV1Vzf3fO1n3evL5J78ruvZ5ptX2Rwy92Tfb1wlEqut3U+sZ3HXOeJ7/zDrbyuP6+Zz0fqa6Nv3vhY7Yu1xWnGevmsvsUpTT/RYIe8waUH/rvHMWKFzLfN8L+rTfp645mfX7ftlnfDtYxN59w0=","base64"));
|
|
var FEATURES = ['isol', 'fina', 'fin2', 'fin3', 'medi', 'med2', 'init'];
|
|
|
|
var ShapingClasses = {
|
|
Non_Joining: 0,
|
|
Left_Joining: 1,
|
|
Right_Joining: 2,
|
|
Dual_Joining: 3,
|
|
Join_Causing: 3,
|
|
ALAPH: 4,
|
|
'DALATH RISH': 5,
|
|
Transparent: 6
|
|
};
|
|
|
|
var ISOL = 'isol';
|
|
var FINA = 'fina';
|
|
var FIN2 = 'fin2';
|
|
var FIN3 = 'fin3';
|
|
var MEDI = 'medi';
|
|
var MED2 = 'med2';
|
|
var INIT = 'init';
|
|
var NONE = null;
|
|
|
|
// Each entry is [prevAction, curAction, nextState]
|
|
var STATE_TABLE = [
|
|
// Non_Joining, Left_Joining, Right_Joining, Dual_Joining, ALAPH, DALATH RISH
|
|
// State 0: prev was U, not willing to join.
|
|
[[NONE, NONE, 0], [NONE, ISOL, 2], [NONE, ISOL, 1], [NONE, ISOL, 2], [NONE, ISOL, 1], [NONE, ISOL, 6]],
|
|
|
|
// State 1: prev was R or ISOL/ALAPH, not willing to join.
|
|
[[NONE, NONE, 0], [NONE, ISOL, 2], [NONE, ISOL, 1], [NONE, ISOL, 2], [NONE, FIN2, 5], [NONE, ISOL, 6]],
|
|
|
|
// State 2: prev was D/L in ISOL form, willing to join.
|
|
[[NONE, NONE, 0], [NONE, ISOL, 2], [INIT, FINA, 1], [INIT, FINA, 3], [INIT, FINA, 4], [INIT, FINA, 6]],
|
|
|
|
// State 3: prev was D in FINA form, willing to join.
|
|
[[NONE, NONE, 0], [NONE, ISOL, 2], [MEDI, FINA, 1], [MEDI, FINA, 3], [MEDI, FINA, 4], [MEDI, FINA, 6]],
|
|
|
|
// State 4: prev was FINA ALAPH, not willing to join.
|
|
[[NONE, NONE, 0], [NONE, ISOL, 2], [MED2, ISOL, 1], [MED2, ISOL, 2], [MED2, FIN2, 5], [MED2, ISOL, 6]],
|
|
|
|
// State 5: prev was FIN2/FIN3 ALAPH, not willing to join.
|
|
[[NONE, NONE, 0], [NONE, ISOL, 2], [ISOL, ISOL, 1], [ISOL, ISOL, 2], [ISOL, FIN2, 5], [ISOL, ISOL, 6]],
|
|
|
|
// State 6: prev was DALATH/RISH, not willing to join.
|
|
[[NONE, NONE, 0], [NONE, ISOL, 2], [NONE, ISOL, 1], [NONE, ISOL, 2], [NONE, FIN3, 5], [NONE, ISOL, 6]]];
|
|
|
|
/**
|
|
* This is a shaper for Arabic, and other cursive scripts.
|
|
* It uses data from ArabicShaping.txt in the Unicode database,
|
|
* compiled to a UnicodeTrie by generate-data.coffee.
|
|
*
|
|
* The shaping state machine was ported from Harfbuzz.
|
|
* https://github.com/behdad/harfbuzz/blob/master/src/hb-ot-shape-complex-arabic.cc
|
|
*/
|
|
|
|
var ArabicShaper = function (_DefaultShaper) {
|
|
_inherits(ArabicShaper, _DefaultShaper);
|
|
|
|
function ArabicShaper() {
|
|
_classCallCheck(this, ArabicShaper);
|
|
|
|
return _possibleConstructorReturn(this, (ArabicShaper.__proto__ || _Object$getPrototypeOf(ArabicShaper)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(ArabicShaper, null, [{
|
|
key: 'planFeatures',
|
|
value: function planFeatures(plan) {
|
|
plan.add(['ccmp', 'locl']);
|
|
for (var i = 0; i < FEATURES.length; i++) {
|
|
var feature = FEATURES[i];
|
|
plan.addStage(feature, false);
|
|
}
|
|
|
|
plan.addStage('mset');
|
|
}
|
|
}, {
|
|
key: 'assignFeatures',
|
|
value: function assignFeatures(plan, glyphs) {
|
|
_get(ArabicShaper.__proto__ || _Object$getPrototypeOf(ArabicShaper), 'assignFeatures', this).call(this, plan, glyphs);
|
|
|
|
var prev = -1;
|
|
var state = 0;
|
|
var actions = [];
|
|
|
|
// Apply the state machine to map glyphs to features
|
|
for (var i = 0; i < glyphs.length; i++) {
|
|
var curAction = void 0,
|
|
prevAction = void 0;
|
|
var glyph = glyphs[i];
|
|
var type = getShapingClass(glyph.codePoints[0]);
|
|
if (type === ShapingClasses.Transparent) {
|
|
actions[i] = NONE;
|
|
continue;
|
|
}
|
|
|
|
var _STATE_TABLE$state$ty = _slicedToArray(STATE_TABLE[state][type], 3);
|
|
|
|
prevAction = _STATE_TABLE$state$ty[0];
|
|
curAction = _STATE_TABLE$state$ty[1];
|
|
state = _STATE_TABLE$state$ty[2];
|
|
|
|
|
|
if (prevAction !== NONE && prev !== -1) {
|
|
actions[prev] = prevAction;
|
|
}
|
|
|
|
actions[i] = curAction;
|
|
prev = i;
|
|
}
|
|
|
|
// Apply the chosen features to their respective glyphs
|
|
for (var index = 0; index < glyphs.length; index++) {
|
|
var feature = void 0;
|
|
var glyph = glyphs[index];
|
|
if (feature = actions[index]) {
|
|
glyph.features[feature] = true;
|
|
}
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return ArabicShaper;
|
|
}(DefaultShaper);
|
|
|
|
function getShapingClass(codePoint) {
|
|
var res = trie.get(codePoint);
|
|
if (res) {
|
|
return res - 1;
|
|
}
|
|
|
|
var category = unicode.getCategory(codePoint);
|
|
if (category === 'Mn' || category === 'Me' || category === 'Cf') {
|
|
return ShapingClasses.Transparent;
|
|
}
|
|
|
|
return ShapingClasses.Non_Joining;
|
|
}
|
|
|
|
var GlyphIterator = function () {
|
|
function GlyphIterator(glyphs, flags) {
|
|
_classCallCheck(this, GlyphIterator);
|
|
|
|
this.glyphs = glyphs;
|
|
this.reset(flags);
|
|
}
|
|
|
|
_createClass(GlyphIterator, [{
|
|
key: "reset",
|
|
value: function reset() {
|
|
var flags = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
|
|
this.flags = flags;
|
|
this.index = 0;
|
|
}
|
|
}, {
|
|
key: "shouldIgnore",
|
|
value: function shouldIgnore(glyph, flags) {
|
|
return flags.ignoreMarks && glyph.isMark || flags.ignoreBaseGlyphs && !glyph.isMark || flags.ignoreLigatures && glyph.isLigature;
|
|
}
|
|
}, {
|
|
key: "move",
|
|
value: function move(dir) {
|
|
this.index += dir;
|
|
while (0 <= this.index && this.index < this.glyphs.length && this.shouldIgnore(this.glyphs[this.index], this.flags)) {
|
|
this.index += dir;
|
|
}
|
|
|
|
if (0 > this.index || this.index >= this.glyphs.length) {
|
|
return null;
|
|
}
|
|
|
|
return this.glyphs[this.index];
|
|
}
|
|
}, {
|
|
key: "next",
|
|
value: function next() {
|
|
return this.move(+1);
|
|
}
|
|
}, {
|
|
key: "prev",
|
|
value: function prev() {
|
|
return this.move(-1);
|
|
}
|
|
}, {
|
|
key: "peek",
|
|
value: function peek() {
|
|
var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
|
|
var idx = this.index;
|
|
var res = this.increment(count);
|
|
this.index = idx;
|
|
return res;
|
|
}
|
|
}, {
|
|
key: "peekIndex",
|
|
value: function peekIndex() {
|
|
var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
|
|
var idx = this.index;
|
|
this.increment(count);
|
|
var res = this.index;
|
|
this.index = idx;
|
|
return res;
|
|
}
|
|
}, {
|
|
key: "increment",
|
|
value: function increment() {
|
|
var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
|
|
var dir = count < 0 ? -1 : 1;
|
|
count = Math.abs(count);
|
|
while (count--) {
|
|
this.move(dir);
|
|
}
|
|
|
|
return this.glyphs[this.index];
|
|
}
|
|
}, {
|
|
key: "cur",
|
|
get: function get() {
|
|
return this.glyphs[this.index] || null;
|
|
}
|
|
}]);
|
|
|
|
return GlyphIterator;
|
|
}();
|
|
|
|
var DEFAULT_SCRIPTS = ['DFLT', 'dflt', 'latn'];
|
|
|
|
var OTProcessor = function () {
|
|
function OTProcessor(font, table) {
|
|
_classCallCheck(this, OTProcessor);
|
|
|
|
this.font = font;
|
|
this.table = table;
|
|
|
|
this.script = null;
|
|
this.scriptTag = null;
|
|
|
|
this.language = null;
|
|
this.languageTag = null;
|
|
|
|
this.features = {};
|
|
this.lookups = {};
|
|
|
|
// initialize to default script + language
|
|
this.selectScript();
|
|
|
|
// current context (set by applyFeatures)
|
|
this.glyphs = [];
|
|
this.positions = []; // only used by GPOS
|
|
this.ligatureID = 1;
|
|
}
|
|
|
|
_createClass(OTProcessor, [{
|
|
key: 'findScript',
|
|
value: function findScript(script) {
|
|
if (this.table.scriptList == null) {
|
|
return null;
|
|
}
|
|
|
|
if (!Array.isArray(script)) {
|
|
script = [script];
|
|
}
|
|
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.table.scriptList), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var entry = _step.value;
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(script), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var s = _step2.value;
|
|
|
|
if (entry.tag === s) {
|
|
return entry;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}, {
|
|
key: 'selectScript',
|
|
value: function selectScript(script, language) {
|
|
var changed = false;
|
|
var entry = void 0;
|
|
if (!this.script || script !== this.scriptTag) {
|
|
entry = this.findScript(script);
|
|
if (script) {
|
|
entry = this.findScript(script);
|
|
}
|
|
|
|
if (!entry) {
|
|
entry = this.findScript(DEFAULT_SCRIPTS);
|
|
}
|
|
|
|
if (!entry) {
|
|
return;
|
|
}
|
|
|
|
this.scriptTag = entry.tag;
|
|
this.script = entry.script;
|
|
this.direction = direction(script);
|
|
this.language = null;
|
|
changed = true;
|
|
}
|
|
|
|
if (!language && language !== this.langugeTag) {
|
|
var _iteratorNormalCompletion3 = true;
|
|
var _didIteratorError3 = false;
|
|
var _iteratorError3 = undefined;
|
|
|
|
try {
|
|
for (var _iterator3 = _getIterator(this.script.langSysRecords), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
var lang = _step3.value;
|
|
|
|
if (lang.tag === language) {
|
|
this.language = lang.langSys;
|
|
this.langugeTag = lang.tag;
|
|
changed = true;
|
|
break;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError3 = true;
|
|
_iteratorError3 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
_iterator3.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError3) {
|
|
throw _iteratorError3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!this.language) {
|
|
this.language = this.script.defaultLangSys;
|
|
}
|
|
|
|
// Build a feature lookup table
|
|
if (changed) {
|
|
this.features = {};
|
|
if (this.language) {
|
|
var _iteratorNormalCompletion4 = true;
|
|
var _didIteratorError4 = false;
|
|
var _iteratorError4 = undefined;
|
|
|
|
try {
|
|
for (var _iterator4 = _getIterator(this.language.featureIndexes), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
var featureIndex = _step4.value;
|
|
|
|
var record = this.table.featureList[featureIndex];
|
|
this.features[record.tag] = record.feature;
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError4 = true;
|
|
_iteratorError4 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
|
_iterator4.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError4) {
|
|
throw _iteratorError4;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: 'lookupsForFeatures',
|
|
value: function lookupsForFeatures() {
|
|
var userFeatures = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
var exclude = arguments[1];
|
|
|
|
var lookups = [];
|
|
var _iteratorNormalCompletion5 = true;
|
|
var _didIteratorError5 = false;
|
|
var _iteratorError5 = undefined;
|
|
|
|
try {
|
|
for (var _iterator5 = _getIterator(userFeatures), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
|
var tag = _step5.value;
|
|
|
|
var feature = this.features[tag];
|
|
if (!feature) {
|
|
continue;
|
|
}
|
|
|
|
var _iteratorNormalCompletion6 = true;
|
|
var _didIteratorError6 = false;
|
|
var _iteratorError6 = undefined;
|
|
|
|
try {
|
|
for (var _iterator6 = _getIterator(feature.lookupListIndexes), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
|
|
var lookupIndex = _step6.value;
|
|
|
|
if (exclude && exclude.indexOf(lookupIndex) !== -1) {
|
|
continue;
|
|
}
|
|
|
|
lookups.push({
|
|
feature: tag,
|
|
index: lookupIndex,
|
|
lookup: this.table.lookupList.get(lookupIndex)
|
|
});
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError6 = true;
|
|
_iteratorError6 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion6 && _iterator6.return) {
|
|
_iterator6.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError6) {
|
|
throw _iteratorError6;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError5 = true;
|
|
_iteratorError5 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion5 && _iterator5.return) {
|
|
_iterator5.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError5) {
|
|
throw _iteratorError5;
|
|
}
|
|
}
|
|
}
|
|
|
|
lookups.sort(function (a, b) {
|
|
return a.index - b.index;
|
|
});
|
|
return lookups;
|
|
}
|
|
}, {
|
|
key: 'applyFeatures',
|
|
value: function applyFeatures(userFeatures, glyphs, advances) {
|
|
var lookups = this.lookupsForFeatures(userFeatures);
|
|
this.applyLookups(lookups, glyphs, advances);
|
|
}
|
|
}, {
|
|
key: 'applyLookups',
|
|
value: function applyLookups(lookups, glyphs, positions) {
|
|
this.glyphs = glyphs;
|
|
this.positions = positions;
|
|
this.glyphIterator = new GlyphIterator(glyphs);
|
|
|
|
var _iteratorNormalCompletion7 = true;
|
|
var _didIteratorError7 = false;
|
|
var _iteratorError7 = undefined;
|
|
|
|
try {
|
|
for (var _iterator7 = _getIterator(lookups), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
|
|
var _step7$value = _step7.value,
|
|
feature = _step7$value.feature,
|
|
lookup = _step7$value.lookup;
|
|
|
|
this.glyphIterator.reset(lookup.flags);
|
|
|
|
while (this.glyphIterator.index < glyphs.length) {
|
|
if (!(feature in this.glyphIterator.cur.features)) {
|
|
this.glyphIterator.next();
|
|
continue;
|
|
}
|
|
|
|
var _iteratorNormalCompletion8 = true;
|
|
var _didIteratorError8 = false;
|
|
var _iteratorError8 = undefined;
|
|
|
|
try {
|
|
for (var _iterator8 = _getIterator(lookup.subTables), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
|
|
var table = _step8.value;
|
|
|
|
var res = this.applyLookup(lookup.lookupType, table);
|
|
if (res) {
|
|
break;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError8 = true;
|
|
_iteratorError8 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion8 && _iterator8.return) {
|
|
_iterator8.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError8) {
|
|
throw _iteratorError8;
|
|
}
|
|
}
|
|
}
|
|
|
|
this.glyphIterator.next();
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError7 = true;
|
|
_iteratorError7 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion7 && _iterator7.return) {
|
|
_iterator7.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError7) {
|
|
throw _iteratorError7;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: 'applyLookup',
|
|
value: function applyLookup(lookup, table) {
|
|
throw new Error("applyLookup must be implemented by subclasses");
|
|
}
|
|
}, {
|
|
key: 'applyLookupList',
|
|
value: function applyLookupList(lookupRecords) {
|
|
var glyphIndex = this.glyphIterator.index;
|
|
|
|
var _iteratorNormalCompletion9 = true;
|
|
var _didIteratorError9 = false;
|
|
var _iteratorError9 = undefined;
|
|
|
|
try {
|
|
for (var _iterator9 = _getIterator(lookupRecords), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
|
|
var lookupRecord = _step9.value;
|
|
|
|
this.glyphIterator.index = glyphIndex;
|
|
this.glyphIterator.increment(lookupRecord.sequenceIndex);
|
|
|
|
var lookup = this.table.lookupList.get(lookupRecord.lookupListIndex);
|
|
var _iteratorNormalCompletion10 = true;
|
|
var _didIteratorError10 = false;
|
|
var _iteratorError10 = undefined;
|
|
|
|
try {
|
|
for (var _iterator10 = _getIterator(lookup.subTables), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
|
|
var table = _step10.value;
|
|
|
|
this.applyLookup(lookup.lookupType, table);
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError10 = true;
|
|
_iteratorError10 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion10 && _iterator10.return) {
|
|
_iterator10.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError10) {
|
|
throw _iteratorError10;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError9 = true;
|
|
_iteratorError9 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion9 && _iterator9.return) {
|
|
_iterator9.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError9) {
|
|
throw _iteratorError9;
|
|
}
|
|
}
|
|
}
|
|
|
|
this.glyphIterator.index = glyphIndex;
|
|
return true;
|
|
}
|
|
}, {
|
|
key: 'coverageIndex',
|
|
value: function coverageIndex(coverage, glyph) {
|
|
if (glyph == null) {
|
|
glyph = this.glyphIterator.cur.id;
|
|
}
|
|
|
|
switch (coverage.version) {
|
|
case 1:
|
|
return coverage.glyphs.indexOf(glyph);
|
|
|
|
case 2:
|
|
var _iteratorNormalCompletion11 = true;
|
|
var _didIteratorError11 = false;
|
|
var _iteratorError11 = undefined;
|
|
|
|
try {
|
|
for (var _iterator11 = _getIterator(coverage.rangeRecords), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {
|
|
var range = _step11.value;
|
|
|
|
if (range.start <= glyph && glyph <= range.end) {
|
|
return range.startCoverageIndex + glyph - range.start;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError11 = true;
|
|
_iteratorError11 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion11 && _iterator11.return) {
|
|
_iterator11.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError11) {
|
|
throw _iteratorError11;
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
}, {
|
|
key: 'match',
|
|
value: function match(sequenceIndex, sequence, fn, matched) {
|
|
var pos = this.glyphIterator.index;
|
|
var glyph = this.glyphIterator.increment(sequenceIndex);
|
|
var idx = 0;
|
|
|
|
while (idx < sequence.length && glyph && fn(sequence[idx], glyph.id)) {
|
|
if (matched) {
|
|
matched.push(this.glyphIterator.index);
|
|
}
|
|
|
|
idx++;
|
|
glyph = this.glyphIterator.next();
|
|
}
|
|
|
|
this.glyphIterator.index = pos;
|
|
if (idx < sequence.length) {
|
|
return false;
|
|
}
|
|
|
|
return matched || true;
|
|
}
|
|
}, {
|
|
key: 'sequenceMatches',
|
|
value: function sequenceMatches(sequenceIndex, sequence) {
|
|
return this.match(sequenceIndex, sequence, function (component, glyph) {
|
|
return component === glyph;
|
|
});
|
|
}
|
|
}, {
|
|
key: 'sequenceMatchIndices',
|
|
value: function sequenceMatchIndices(sequenceIndex, sequence) {
|
|
return this.match(sequenceIndex, sequence, function (component, glyph) {
|
|
return component === glyph;
|
|
}, []);
|
|
}
|
|
}, {
|
|
key: 'coverageSequenceMatches',
|
|
value: function coverageSequenceMatches(sequenceIndex, sequence) {
|
|
var _this = this;
|
|
|
|
return this.match(sequenceIndex, sequence, function (coverage, glyph) {
|
|
return _this.coverageIndex(coverage, glyph) >= 0;
|
|
});
|
|
}
|
|
}, {
|
|
key: 'getClassID',
|
|
value: function getClassID(glyph, classDef) {
|
|
switch (classDef.version) {
|
|
case 1:
|
|
// Class array
|
|
var i = glyph - classDef.startGlyph;
|
|
if (i > -1 && i < classDef.classValueArray.length) {
|
|
return classDef.classValueArray[i];
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
var _iteratorNormalCompletion12 = true;
|
|
var _didIteratorError12 = false;
|
|
var _iteratorError12 = undefined;
|
|
|
|
try {
|
|
for (var _iterator12 = _getIterator(classDef.classRangeRecord), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
|
|
var range = _step12.value;
|
|
|
|
if (range.start <= glyph && glyph <= range.end) {
|
|
return range.class;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError12 = true;
|
|
_iteratorError12 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion12 && _iterator12.return) {
|
|
_iterator12.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError12) {
|
|
throw _iteratorError12;
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
}, {
|
|
key: 'classSequenceMatches',
|
|
value: function classSequenceMatches(sequenceIndex, sequence, classDef) {
|
|
var _this2 = this;
|
|
|
|
return this.match(sequenceIndex, sequence, function (classID, glyph) {
|
|
return classID === _this2.getClassID(glyph, classDef);
|
|
});
|
|
}
|
|
}, {
|
|
key: 'applyContext',
|
|
value: function applyContext(table) {
|
|
switch (table.version) {
|
|
case 1:
|
|
var index = this.coverageIndex(table.coverage);
|
|
if (index === -1) {
|
|
return false;
|
|
}
|
|
|
|
var set = table.ruleSets[index];
|
|
var _iteratorNormalCompletion13 = true;
|
|
var _didIteratorError13 = false;
|
|
var _iteratorError13 = undefined;
|
|
|
|
try {
|
|
for (var _iterator13 = _getIterator(set), _step13; !(_iteratorNormalCompletion13 = (_step13 = _iterator13.next()).done); _iteratorNormalCompletion13 = true) {
|
|
var rule = _step13.value;
|
|
|
|
if (this.sequenceMatches(1, rule.input)) {
|
|
return this.applyLookupList(rule.lookupRecords);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError13 = true;
|
|
_iteratorError13 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion13 && _iterator13.return) {
|
|
_iterator13.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError13) {
|
|
throw _iteratorError13;
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
if (this.coverageIndex(table.coverage) === -1) {
|
|
return false;
|
|
}
|
|
|
|
index = this.getClassID(this.glyphIterator.cur.id, table.classDef);
|
|
if (index === -1) {
|
|
return false;
|
|
}
|
|
|
|
set = table.classSet[index];
|
|
var _iteratorNormalCompletion14 = true;
|
|
var _didIteratorError14 = false;
|
|
var _iteratorError14 = undefined;
|
|
|
|
try {
|
|
for (var _iterator14 = _getIterator(set), _step14; !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true) {
|
|
var _rule = _step14.value;
|
|
|
|
if (this.classSequenceMatches(1, _rule.classes, table.classDef)) {
|
|
return this.applyLookupList(_rule.lookupRecords);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError14 = true;
|
|
_iteratorError14 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion14 && _iterator14.return) {
|
|
_iterator14.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError14) {
|
|
throw _iteratorError14;
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
if (this.coverageSequenceMatches(0, table.coverages)) {
|
|
return this.applyLookupList(table.lookupRecords);
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}, {
|
|
key: 'applyChainingContext',
|
|
value: function applyChainingContext(table) {
|
|
switch (table.version) {
|
|
case 1:
|
|
var index = this.coverageIndex(table.coverage);
|
|
if (index === -1) {
|
|
return false;
|
|
}
|
|
|
|
var set = table.chainRuleSets[index];
|
|
var _iteratorNormalCompletion15 = true;
|
|
var _didIteratorError15 = false;
|
|
var _iteratorError15 = undefined;
|
|
|
|
try {
|
|
for (var _iterator15 = _getIterator(set), _step15; !(_iteratorNormalCompletion15 = (_step15 = _iterator15.next()).done); _iteratorNormalCompletion15 = true) {
|
|
var rule = _step15.value;
|
|
|
|
if (this.sequenceMatches(-rule.backtrack.length, rule.backtrack) && this.sequenceMatches(1, rule.input) && this.sequenceMatches(1 + rule.input.length, rule.lookahead)) {
|
|
return this.applyLookupList(rule.lookupRecords);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError15 = true;
|
|
_iteratorError15 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion15 && _iterator15.return) {
|
|
_iterator15.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError15) {
|
|
throw _iteratorError15;
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
if (this.coverageIndex(table.coverage) === -1) {
|
|
return false;
|
|
}
|
|
|
|
index = this.getClassID(this.glyphIterator.cur.id, table.inputClassDef);
|
|
var rules = table.chainClassSet[index];
|
|
if (!rules) {
|
|
return false;
|
|
}
|
|
|
|
var _iteratorNormalCompletion16 = true;
|
|
var _didIteratorError16 = false;
|
|
var _iteratorError16 = undefined;
|
|
|
|
try {
|
|
for (var _iterator16 = _getIterator(rules), _step16; !(_iteratorNormalCompletion16 = (_step16 = _iterator16.next()).done); _iteratorNormalCompletion16 = true) {
|
|
var _rule2 = _step16.value;
|
|
|
|
if (this.classSequenceMatches(-_rule2.backtrack.length, _rule2.backtrack, table.backtrackClassDef) && this.classSequenceMatches(1, _rule2.input, table.inputClassDef) && this.classSequenceMatches(1 + _rule2.input.length, _rule2.lookahead, table.lookaheadClassDef)) {
|
|
return this.applyLookupList(_rule2.lookupRecords);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError16 = true;
|
|
_iteratorError16 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion16 && _iterator16.return) {
|
|
_iterator16.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError16) {
|
|
throw _iteratorError16;
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
if (this.coverageSequenceMatches(-table.backtrackGlyphCount, table.backtrackCoverage) && this.coverageSequenceMatches(0, table.inputCoverage) && this.coverageSequenceMatches(table.inputGlyphCount, table.lookaheadCoverage)) {
|
|
return this.applyLookupList(table.lookupRecords);
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}]);
|
|
|
|
return OTProcessor;
|
|
}();
|
|
|
|
var GlyphInfo = function () {
|
|
function GlyphInfo(font, id) {
|
|
var codePoints = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
var features = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
|
|
_classCallCheck(this, GlyphInfo);
|
|
|
|
this._font = font;
|
|
this.codePoints = codePoints;
|
|
this.id = id;
|
|
|
|
this.features = {};
|
|
if (Array.isArray(features)) {
|
|
for (var i = 0; i < features.length; i++) {
|
|
var feature = features[i];
|
|
this.features[feature] = true;
|
|
}
|
|
} else if ((typeof features === 'undefined' ? 'undefined' : _typeof(features)) === 'object') {
|
|
_Object$assign(this.features, features);
|
|
}
|
|
|
|
this.ligatureID = null;
|
|
this.ligatureComponent = null;
|
|
this.ligated = false;
|
|
this.cursiveAttachment = null;
|
|
this.markAttachment = null;
|
|
this.shaperInfo = null;
|
|
this.substituted = false;
|
|
}
|
|
|
|
_createClass(GlyphInfo, [{
|
|
key: 'id',
|
|
get: function get() {
|
|
return this._id;
|
|
},
|
|
set: function set(id) {
|
|
this._id = id;
|
|
this.substituted = true;
|
|
|
|
if (this._font.GDEF) {
|
|
// TODO: clean this up
|
|
var classID = OTProcessor.prototype.getClassID(id, this._font.GDEF.glyphClassDef);
|
|
this.isMark = classID === 3;
|
|
this.isLigature = classID === 2;
|
|
} else {
|
|
this.isMark = this.codePoints.every(unicode.isMark);
|
|
this.isLigature = this.codePoints.length > 1;
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return GlyphInfo;
|
|
}();
|
|
|
|
var _class$5;
|
|
var _temp$1;
|
|
/**
|
|
* This is a shaper for the Hangul script, used by the Korean language.
|
|
* It does the following:
|
|
* - decompose if unsupported by the font:
|
|
* <LV> -> <L,V>
|
|
* <LVT> -> <L,V,T>
|
|
* <LV,T> -> <L,V,T>
|
|
*
|
|
* - compose if supported by the font:
|
|
* <L,V> -> <LV>
|
|
* <L,V,T> -> <LVT>
|
|
* <LV,T> -> <LVT>
|
|
*
|
|
* - reorder tone marks (S is any valid syllable):
|
|
* <S, M> -> <M, S>
|
|
*
|
|
* - apply ljmo, vjmo, and tjmo OpenType features to decomposed Jamo sequences.
|
|
*
|
|
* This logic is based on the following documents:
|
|
* - http://www.microsoft.com/typography/OpenTypeDev/hangul/intro.htm
|
|
* - http://ktug.org/~nomos/harfbuzz-hangul/hangulshaper.pdf
|
|
*/
|
|
var HangulShaper = (_temp$1 = _class$5 = function (_DefaultShaper) {
|
|
_inherits(HangulShaper, _DefaultShaper);
|
|
|
|
function HangulShaper() {
|
|
_classCallCheck(this, HangulShaper);
|
|
|
|
return _possibleConstructorReturn(this, (HangulShaper.__proto__ || _Object$getPrototypeOf(HangulShaper)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(HangulShaper, null, [{
|
|
key: 'planFeatures',
|
|
value: function planFeatures(plan) {
|
|
plan.add(['ljmo', 'vjmo', 'tjmo'], false);
|
|
}
|
|
}, {
|
|
key: 'assignFeatures',
|
|
value: function assignFeatures(plan, glyphs) {
|
|
var state = 0;
|
|
var i = 0;
|
|
while (i < glyphs.length) {
|
|
var action = void 0;
|
|
var glyph = glyphs[i];
|
|
var code = glyph.codePoints[0];
|
|
var type = getType(code);
|
|
|
|
var _STATE_TABLE$state$ty = _slicedToArray(STATE_TABLE$1[state][type], 2);
|
|
|
|
action = _STATE_TABLE$state$ty[0];
|
|
state = _STATE_TABLE$state$ty[1];
|
|
|
|
|
|
switch (action) {
|
|
case DECOMPOSE:
|
|
// Decompose the composed syllable if it is not supported by the font.
|
|
if (!plan.font.hasGlyphForCodePoint(code)) {
|
|
i = decompose(glyphs, i, plan.font);
|
|
}
|
|
break;
|
|
|
|
case COMPOSE:
|
|
// Found a decomposed syllable. Try to compose if supported by the font.
|
|
i = compose(glyphs, i, plan.font);
|
|
break;
|
|
|
|
case TONE_MARK:
|
|
// Got a valid syllable, followed by a tone mark. Move the tone mark to the beginning of the syllable.
|
|
reorderToneMark(glyphs, i, plan.font);
|
|
break;
|
|
|
|
case INVALID:
|
|
// Tone mark has no valid syllable to attach to, so insert a dotted circle
|
|
i = insertDottedCircle(glyphs, i, plan.font);
|
|
break;
|
|
}
|
|
|
|
i++;
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return HangulShaper;
|
|
}(DefaultShaper), _class$5.zeroMarkWidths = 'NONE', _temp$1);
|
|
var HANGUL_BASE = 0xac00;
|
|
var HANGUL_END = 0xd7a4;
|
|
var HANGUL_COUNT = HANGUL_END - HANGUL_BASE + 1;
|
|
var L_BASE = 0x1100; // lead
|
|
var V_BASE = 0x1161; // vowel
|
|
var T_BASE = 0x11a7; // trail
|
|
var L_COUNT = 19;
|
|
var V_COUNT = 21;
|
|
var T_COUNT = 28;
|
|
var L_END = L_BASE + L_COUNT - 1;
|
|
var V_END = V_BASE + V_COUNT - 1;
|
|
var T_END = T_BASE + T_COUNT - 1;
|
|
var DOTTED_CIRCLE = 0x25cc;
|
|
|
|
var isL = function isL(code) {
|
|
return 0x1100 <= code && code <= 0x115f || 0xa960 <= code && code <= 0xa97c;
|
|
};
|
|
var isV = function isV(code) {
|
|
return 0x1160 <= code && code <= 0x11a7 || 0xd7b0 <= code && code <= 0xd7c6;
|
|
};
|
|
var isT = function isT(code) {
|
|
return 0x11a8 <= code && code <= 0x11ff || 0xd7cb <= code && code <= 0xd7fb;
|
|
};
|
|
var isTone = function isTone(code) {
|
|
return 0x302e <= code && code <= 0x302f;
|
|
};
|
|
var isLVT = function isLVT(code) {
|
|
return HANGUL_BASE <= code && code <= HANGUL_END;
|
|
};
|
|
var isLV = function isLV(code) {
|
|
return code - HANGUL_BASE < HANGUL_COUNT && (code - HANGUL_BASE) % T_COUNT === 0;
|
|
};
|
|
var isCombiningL = function isCombiningL(code) {
|
|
return L_BASE <= code && code <= L_END;
|
|
};
|
|
var isCombiningV = function isCombiningV(code) {
|
|
return V_BASE <= code && code <= V_END;
|
|
};
|
|
var isCombiningT = function isCombiningT(code) {
|
|
return T_BASE + 1 && 1 <= code && code <= T_END;
|
|
};
|
|
|
|
// Character categories
|
|
var X = 0; // Other character
|
|
var L = 1; // Leading consonant
|
|
var V = 2; // Medial vowel
|
|
var T = 3; // Trailing consonant
|
|
var LV = 4; // Composed <LV> syllable
|
|
var LVT = 5; // Composed <LVT> syllable
|
|
var M = 6; // Tone mark
|
|
|
|
// This function classifies a character using the above categories.
|
|
function getType(code) {
|
|
if (isL(code)) {
|
|
return L;
|
|
}
|
|
if (isV(code)) {
|
|
return V;
|
|
}
|
|
if (isT(code)) {
|
|
return T;
|
|
}
|
|
if (isLV(code)) {
|
|
return LV;
|
|
}
|
|
if (isLVT(code)) {
|
|
return LVT;
|
|
}
|
|
if (isTone(code)) {
|
|
return M;
|
|
}
|
|
return X;
|
|
}
|
|
|
|
// State machine actions
|
|
var NO_ACTION = 0;
|
|
var DECOMPOSE = 1;
|
|
var COMPOSE = 2;
|
|
var TONE_MARK = 4;
|
|
var INVALID = 5;
|
|
|
|
// Build a state machine that accepts valid syllables, and applies actions along the way.
|
|
// The logic this is implementing is documented at the top of the file.
|
|
var STATE_TABLE$1 = [
|
|
// X L V T LV LVT M
|
|
// State 0: start state
|
|
[[NO_ACTION, 0], [NO_ACTION, 1], [NO_ACTION, 0], [NO_ACTION, 0], [DECOMPOSE, 2], [DECOMPOSE, 3], [INVALID, 0]],
|
|
|
|
// State 1: <L>
|
|
[[NO_ACTION, 0], [NO_ACTION, 1], [COMPOSE, 2], [NO_ACTION, 0], [DECOMPOSE, 2], [DECOMPOSE, 3], [INVALID, 0]],
|
|
|
|
// State 2: <L,V> or <LV>
|
|
[[NO_ACTION, 0], [NO_ACTION, 1], [NO_ACTION, 0], [COMPOSE, 3], [DECOMPOSE, 2], [DECOMPOSE, 3], [TONE_MARK, 0]],
|
|
|
|
// State 3: <L,V,T> or <LVT>
|
|
[[NO_ACTION, 0], [NO_ACTION, 1], [NO_ACTION, 0], [NO_ACTION, 0], [DECOMPOSE, 2], [DECOMPOSE, 3], [TONE_MARK, 0]]];
|
|
|
|
function getGlyph(font, code, features) {
|
|
return new GlyphInfo(font, font.glyphForCodePoint(code).id, [code], features);
|
|
}
|
|
|
|
function decompose(glyphs, i, font) {
|
|
var glyph = glyphs[i];
|
|
var code = glyph.codePoints[0];
|
|
|
|
var s = code - HANGUL_BASE;
|
|
var t = T_BASE + s % T_COUNT;
|
|
s = s / T_COUNT | 0;
|
|
var l = L_BASE + s / V_COUNT | 0;
|
|
var v = V_BASE + s % V_COUNT;
|
|
|
|
// Don't decompose if all of the components are not available
|
|
if (!font.hasGlyphForCodePoint(l) || !font.hasGlyphForCodePoint(v) || t !== T_BASE && !font.hasGlyphForCodePoint(t)) {
|
|
return i;
|
|
}
|
|
|
|
// Replace the current glyph with decomposed L, V, and T glyphs,
|
|
// and apply the proper OpenType features to each component.
|
|
var ljmo = getGlyph(font, l, glyph.features);
|
|
ljmo.features.ljmo = true;
|
|
|
|
var vjmo = getGlyph(font, v, glyph.features);
|
|
vjmo.features.vjmo = true;
|
|
|
|
var insert = [ljmo, vjmo];
|
|
|
|
if (t > T_BASE) {
|
|
var tjmo = getGlyph(font, t, glyph.features);
|
|
tjmo.features.tjmo = true;
|
|
insert.push(tjmo);
|
|
}
|
|
|
|
glyphs.splice.apply(glyphs, [i, 1].concat(insert));
|
|
return i + insert.length - 1;
|
|
}
|
|
|
|
function compose(glyphs, i, font) {
|
|
var glyph = glyphs[i];
|
|
var code = glyphs[i].codePoints[0];
|
|
var type = getType(code);
|
|
|
|
var prev = glyphs[i - 1].codePoints[0];
|
|
var prevType = getType(prev);
|
|
|
|
// Figure out what type of syllable we're dealing with
|
|
var lv = void 0,
|
|
ljmo = void 0,
|
|
vjmo = void 0,
|
|
tjmo = void 0;
|
|
if (prevType === LV && type === T) {
|
|
// <LV,T>
|
|
lv = prev;
|
|
tjmo = glyph;
|
|
} else {
|
|
if (type === V) {
|
|
// <L,V>
|
|
ljmo = glyphs[i - 1];
|
|
vjmo = glyph;
|
|
} else {
|
|
// <L,V,T>
|
|
ljmo = glyphs[i - 2];
|
|
vjmo = glyphs[i - 1];
|
|
tjmo = glyph;
|
|
}
|
|
|
|
var l = ljmo.codePoints[0];
|
|
var v = vjmo.codePoints[0];
|
|
|
|
// Make sure L and V are combining characters
|
|
if (isCombiningL(l) && isCombiningV(v)) {
|
|
lv = HANGUL_BASE + ((l - L_BASE) * V_COUNT + (v - V_BASE)) * T_COUNT;
|
|
}
|
|
}
|
|
|
|
var t = tjmo && tjmo.codePoints[0] || T_BASE;
|
|
if (lv != null && (t === T_BASE || isCombiningT(t))) {
|
|
var s = lv + (t - T_BASE);
|
|
|
|
// Replace with a composed glyph if supported by the font,
|
|
// otherwise apply the proper OpenType features to each component.
|
|
if (font.hasGlyphForCodePoint(s)) {
|
|
var del = prevType === V ? 3 : 2;
|
|
glyphs.splice(i - del + 1, del, getGlyph(font, s, glyph.features));
|
|
return i - del + 1;
|
|
}
|
|
}
|
|
|
|
// Didn't compose (either a non-combining component or unsupported by font).
|
|
if (ljmo) {
|
|
ljmo.features.ljmo = true;
|
|
}
|
|
if (vjmo) {
|
|
vjmo.features.vjmo = true;
|
|
}
|
|
if (tjmo) {
|
|
tjmo.features.tjmo = true;
|
|
}
|
|
|
|
if (prevType === LV) {
|
|
// Sequence was originally <L,V>, which got combined earlier.
|
|
// Either the T was non-combining, or the LVT glyph wasn't supported.
|
|
// Decompose the glyph again and apply OT features.
|
|
decompose(glyphs, i - 1, font);
|
|
return i + 1;
|
|
}
|
|
|
|
return i;
|
|
}
|
|
|
|
function getLength(code) {
|
|
switch (getType(code)) {
|
|
case LV:
|
|
case LVT:
|
|
return 1;
|
|
case V:
|
|
return 2;
|
|
case T:
|
|
return 3;
|
|
}
|
|
}
|
|
|
|
function reorderToneMark(glyphs, i, font) {
|
|
var glyph = glyphs[i];
|
|
var code = glyphs[i].codePoints[0];
|
|
|
|
// Move tone mark to the beginning of the previous syllable, unless it is zero width
|
|
if (font.glyphForCodePoint(code).advanceWidth === 0) {
|
|
return;
|
|
}
|
|
|
|
var prev = glyphs[i - 1].codePoints[0];
|
|
var len = getLength(prev);
|
|
|
|
glyphs.splice(i, 1);
|
|
return glyphs.splice(i - len, 0, glyph);
|
|
}
|
|
|
|
function insertDottedCircle(glyphs, i, font) {
|
|
var glyph = glyphs[i];
|
|
var code = glyphs[i].codePoints[0];
|
|
|
|
if (font.hasGlyphForCodePoint(DOTTED_CIRCLE)) {
|
|
var dottedCircle = getGlyph(font, DOTTED_CIRCLE, glyph.features);
|
|
|
|
// If the tone mark is zero width, insert the dotted circle before, otherwise after
|
|
var idx = font.glyphForCodePoint(code).advanceWidth === 0 ? i : i + 1;
|
|
glyphs.splice(idx, 0, dottedCircle);
|
|
i++;
|
|
}
|
|
|
|
return i;
|
|
}
|
|
|
|
var categories$1 = ["O", "IND", "S", "GB", "B", "FM", "CGJ", "VMAbv", "VMPst", "VAbv", "VPst", "CMBlw", "VPre", "VBlw", "H", "VMBlw", "CMAbv", "MBlw", "CS", "R", "SUB", "MPst", "MPre", "FAbv", "FPst", "FBlw", "SMAbv", "SMBlw", "VMPre", "ZWNJ", "ZWJ", "WJ", "VS", "N", "HN", "MAbv"];
|
|
var decompositions$1 = { "2507": [2503, 2494], "2508": [2503, 2519], "2888": [2887, 2902], "2891": [2887, 2878], "2892": [2887, 2903], "3018": [3014, 3006], "3019": [3015, 3006], "3020": [3014, 3031], "3144": [3142, 3158], "3264": [3263, 3285], "3271": [3270, 3285], "3272": [3270, 3286], "3274": [3270, 3266], "3275": [3270, 3266, 3285], "3402": [3398, 3390], "3403": [3399, 3390], "3404": [3398, 3415], "3546": [3545, 3530], "3548": [3545, 3535], "3549": [3545, 3535, 3530], "3550": [3545, 3551], "3635": [3661, 3634], "3763": [3789, 3762], "3955": [3953, 3954], "3957": [3953, 3956], "3958": [4018, 3968], "3959": [4018, 3953, 3968], "3960": [4019, 3968], "3961": [4019, 3953, 3968], "3969": [3953, 3968], "6971": [6970, 6965], "6973": [6972, 6965], "6976": [6974, 6965], "6977": [6975, 6965], "6979": [6978, 6965], "69934": [69937, 69927], "69935": [69938, 69927], "70475": [70471, 70462], "70476": [70471, 70487], "70843": [70841, 70842], "70844": [70841, 70832], "70846": [70841, 70845], "71098": [71096, 71087], "71099": [71097, 71087] };
|
|
var stateTable = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 2, 3, 4, 4, 5, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 17, 0, 11, 18, 19, 20, 21, 0, 0, 22, 0, 0, 2, 0, 23, 0, 24], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 27, 0, 0, 0, 0, 26, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, 0, 0, 34, 40, 41, 42, 43, 0, 0, 44, 0, 0, 0, 38, 0, 0, 45], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 6, 7, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 19, 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 6, 7, 8, 9, 0, 0, 12, 0, 14, 0, 0, 0, 0, 0, 0, 0, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 6, 7, 0, 9, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 16, 0, 0, 0, 11, 18, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 24], [0, 0, 0, 0, 0, 5, 0, 6, 7, 8, 9, 0, 11, 12, 0, 14, 0, 0, 0, 0, 0, 0, 0, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 6, 7, 0, 9, 0, 0, 12, 0, 14, 0, 0, 0, 0, 0, 0, 0, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 0, 7, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 19, 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 11, 18, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 24], [0, 0, 0, 0, 0, 5, 0, 6, 7, 8, 9, 0, 11, 12, 0, 14, 0, 0, 0, 0, 0, 11, 0, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 4, 4, 5, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 11, 18, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 24], [0, 0, 0, 0, 0, 5, 0, 6, 7, 8, 9, 0, 11, 12, 0, 14, 0, 16, 0, 0, 0, 11, 0, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 24], [0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 6, 7, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 0, 48, 0], [0, 0, 0, 0, 0, 5, 0, 6, 7, 8, 9, 0, 11, 12, 0, 14, 0, 16, 0, 0, 0, 11, 0, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 27, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 29, 30, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 29, 30, 31, 32, 0, 0, 35, 0, 37, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 29, 30, 0, 32, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 0, 39, 0, 0, 0, 34, 40, 41, 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 45], [0, 0, 0, 0, 0, 28, 0, 29, 30, 31, 32, 0, 34, 35, 0, 37, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 29, 30, 0, 32, 0, 0, 35, 0, 37, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 0, 30, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, 0, 0, 34, 40, 41, 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 45], [0, 0, 0, 0, 0, 28, 0, 29, 30, 31, 32, 0, 34, 35, 0, 37, 0, 0, 0, 0, 0, 34, 0, 41, 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 29, 30, 31, 32, 0, 34, 35, 0, 37, 0, 39, 0, 0, 0, 34, 0, 41, 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 45], [0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 29, 30, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 28, 0, 29, 30, 31, 32, 0, 34, 35, 0, 37, 0, 39, 0, 0, 0, 34, 0, 41, 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 6, 7, 8, 9, 50, 11, 12, 13, 14, 50, 16, 0, 0, 0, 11, 18, 19, 20, 21, 0, 0, 22, 0, 0, 0, 51, 0, 0, 24], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0], [0, 0, 0, 0, 0, 28, 0, 29, 30, 31, 32, 53, 34, 35, 36, 37, 53, 39, 0, 0, 0, 34, 40, 41, 42, 43, 0, 0, 44, 0, 0, 0, 54, 0, 0, 45], [0, 0, 0, 0, 0, 5, 0, 6, 7, 8, 9, 50, 11, 12, 13, 14, 0, 16, 0, 0, 0, 11, 18, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 24], [0, 0, 0, 0, 0, 5, 0, 6, 7, 8, 9, 50, 11, 12, 13, 14, 50, 16, 0, 0, 0, 11, 18, 19, 20, 21, 0, 0, 22, 0, 0, 0, 0, 0, 0, 24], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 0, 48, 0], [0, 0, 0, 0, 0, 28, 0, 29, 30, 31, 32, 53, 34, 35, 36, 37, 0, 39, 0, 0, 0, 34, 40, 41, 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 45], [0, 0, 0, 0, 0, 28, 0, 29, 30, 31, 32, 53, 34, 35, 36, 37, 53, 39, 0, 0, 0, 34, 40, 41, 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 45]];
|
|
var accepting = [false, true, true, true, true, true, true, true, true, true, true, true, true, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true];
|
|
var tags = [[], ["broken_cluster"], ["independent_cluster"], ["symbol_cluster"], ["standard_cluster"], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], [], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], ["broken_cluster"], ["numeral_cluster"], ["broken_cluster"], ["independent_cluster"], ["symbol_cluster"], ["symbol_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["virama_terminated_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["standard_cluster"], ["broken_cluster"], ["numeral_cluster"], ["number_joiner_terminated_cluster"], ["standard_cluster"], ["broken_cluster"], ["broken_cluster"], ["numeral_cluster"], ["standard_cluster"], ["standard_cluster"]];
|
|
var useData = {
|
|
categories: categories$1,
|
|
decompositions: decompositions$1,
|
|
stateTable: stateTable,
|
|
accepting: accepting,
|
|
tags: tags
|
|
};
|
|
|
|
var _class$6;
|
|
var _temp$2;
|
|
var categories = useData.categories;
|
|
var decompositions = useData.decompositions;
|
|
var trie$1 = new UnicodeTrie(Buffer("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","base64"));
|
|
var stateMachine = new StateMachine(useData);
|
|
|
|
/**
|
|
* This shaper is an implementation of the Universal Shaping Engine, which
|
|
* uses Unicode data to shape a number of scripts without a dedicated shaping engine.
|
|
* See https://www.microsoft.com/typography/OpenTypeDev/USE/intro.htm.
|
|
*/
|
|
var UniversalShaper = (_temp$2 = _class$6 = function (_DefaultShaper) {
|
|
_inherits(UniversalShaper, _DefaultShaper);
|
|
|
|
function UniversalShaper() {
|
|
_classCallCheck(this, UniversalShaper);
|
|
|
|
return _possibleConstructorReturn(this, (UniversalShaper.__proto__ || _Object$getPrototypeOf(UniversalShaper)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(UniversalShaper, null, [{
|
|
key: 'planFeatures',
|
|
value: function planFeatures(plan) {
|
|
plan.addStage(setupSyllables);
|
|
|
|
// Default glyph pre-processing group
|
|
plan.addStage(['locl', 'ccmp', 'nukt', 'akhn']);
|
|
|
|
// Reordering group
|
|
plan.addStage(clearSubstitutionFlags);
|
|
plan.addStage(['rphf'], false);
|
|
plan.addStage(recordRphf);
|
|
plan.addStage(clearSubstitutionFlags);
|
|
plan.addStage(['pref']);
|
|
plan.addStage(recordPref);
|
|
|
|
// Orthographic unit shaping group
|
|
plan.addStage(['rkrf', 'abvf', 'blwf', 'half', 'pstf', 'vatu', 'cjct']);
|
|
plan.addStage(reorder);
|
|
|
|
// Topographical features
|
|
// Scripts that need this are handled by the Arabic shaper, not implemented here for now.
|
|
// plan.addStage(['isol', 'init', 'medi', 'fina', 'med2', 'fin2', 'fin3'], false);
|
|
|
|
// Standard topographic presentation and positional feature application
|
|
plan.addStage(['abvs', 'blws', 'pres', 'psts', 'dist', 'abvm', 'blwm']);
|
|
}
|
|
}, {
|
|
key: 'assignFeatures',
|
|
value: function assignFeatures(plan, glyphs) {
|
|
var _loop = function _loop(i) {
|
|
var codepoint = glyphs[i].codePoints[0];
|
|
if (decompositions[codepoint]) {
|
|
var decomposed = decompositions[codepoint].map(function (c) {
|
|
var g = plan.font.glyphForCodePoint(c);
|
|
return new GlyphInfo(plan.font, g.id, [c], glyphs[i].features);
|
|
});
|
|
|
|
glyphs.splice.apply(glyphs, [i, 1].concat(_toConsumableArray(decomposed)));
|
|
}
|
|
};
|
|
|
|
// Decompose split vowels
|
|
// TODO: do this in a more general unicode normalizer
|
|
for (var i = glyphs.length - 1; i >= 0; i--) {
|
|
_loop(i);
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return UniversalShaper;
|
|
}(DefaultShaper), _class$6.zeroMarkWidths = 'BEFORE_GPOS', _temp$2);
|
|
function useCategory(glyph) {
|
|
return trie$1.get(glyph.codePoints[0]);
|
|
}
|
|
|
|
var USEInfo = function USEInfo(category, syllableType, syllable) {
|
|
_classCallCheck(this, USEInfo);
|
|
|
|
this.category = category;
|
|
this.syllableType = syllableType;
|
|
this.syllable = syllable;
|
|
};
|
|
|
|
function setupSyllables(font, glyphs) {
|
|
var syllable = 0;
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(stateMachine.match(glyphs.map(useCategory))), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var _step$value = _slicedToArray(_step.value, 3),
|
|
start = _step$value[0],
|
|
end = _step$value[1],
|
|
tags = _step$value[2];
|
|
|
|
++syllable;
|
|
|
|
// Create shaper info
|
|
for (var i = start; i <= end; i++) {
|
|
glyphs[i].shaperInfo = new USEInfo(categories[useCategory(glyphs[i])], tags[0], syllable);
|
|
}
|
|
|
|
// Assign rphf feature
|
|
var limit = glyphs[start].shaperInfo.category === 'R' ? 1 : Math.min(3, end - start);
|
|
for (var _i = start; _i < start + limit; _i++) {
|
|
glyphs[_i].features.rphf = true;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function clearSubstitutionFlags(font, glyphs) {
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(glyphs), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var glyph = _step2.value;
|
|
|
|
glyph.substituted = false;
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function recordRphf(font, glyphs) {
|
|
var _iteratorNormalCompletion3 = true;
|
|
var _didIteratorError3 = false;
|
|
var _iteratorError3 = undefined;
|
|
|
|
try {
|
|
for (var _iterator3 = _getIterator(glyphs), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
var glyph = _step3.value;
|
|
|
|
if (glyph.substituted && glyph.features.rphf) {
|
|
// Mark a substituted repha.
|
|
glyph.shaperInfo.category = 'R';
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError3 = true;
|
|
_iteratorError3 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
_iterator3.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError3) {
|
|
throw _iteratorError3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function recordPref(font, glyphs) {
|
|
var _iteratorNormalCompletion4 = true;
|
|
var _didIteratorError4 = false;
|
|
var _iteratorError4 = undefined;
|
|
|
|
try {
|
|
for (var _iterator4 = _getIterator(glyphs), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
var glyph = _step4.value;
|
|
|
|
if (glyph.substituted) {
|
|
// Mark a substituted pref as VPre, as they behave the same way.
|
|
glyph.shaperInfo.category = 'VPre';
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError4 = true;
|
|
_iteratorError4 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
|
_iterator4.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError4) {
|
|
throw _iteratorError4;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function reorder(font, glyphs) {
|
|
var dottedCircle = font.glyphForCodePoint(0x25cc).id;
|
|
|
|
for (var start = 0, end = nextSyllable(glyphs, 0); start < glyphs.length; start = end, end = nextSyllable(glyphs, start)) {
|
|
var i = void 0,
|
|
j = void 0;
|
|
var info = glyphs[start].shaperInfo;
|
|
var type = info.syllableType;
|
|
|
|
// Only a few syllable types need reordering.
|
|
if (type !== 'virama_terminated_cluster' && type !== 'standard_cluster' && type !== 'broken_cluster') {
|
|
continue;
|
|
}
|
|
|
|
// Insert a dotted circle glyph in broken clusters.
|
|
if (type === 'broken_cluster' && dottedCircle) {
|
|
var g = new GlyphInfo(font, dottedCircle, [0x25cc]);
|
|
g.shaperInfo = info;
|
|
|
|
// Insert after possible Repha.
|
|
for (i = start; i < end && glyphs[i].shaperInfo.category === 'R'; i++) {}
|
|
glyphs.splice(++i, 0, g);
|
|
end++;
|
|
}
|
|
|
|
// Move things forward.
|
|
if (info.category === 'R' && end - start > 1) {
|
|
// Got a repha. Reorder it to after first base, before first halant.
|
|
for (i = start + 1; i < end; i++) {
|
|
info = glyphs[i].shaperInfo;
|
|
if (isBase(info) || isHalant(glyphs[i])) {
|
|
// If we hit a halant, move before it; otherwise it's a base: move to it's
|
|
// place, and shift things in between backward.
|
|
if (isHalant(glyphs[i])) {
|
|
i--;
|
|
}
|
|
|
|
glyphs.splice.apply(glyphs, [start, 0].concat(_toConsumableArray(glyphs.splice(start + 1, i - start)), [glyphs[i]]));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Move things back.
|
|
for (i = start, j = end; i < end; i++) {
|
|
info = glyphs[i].shaperInfo;
|
|
if (isBase(info) || isHalant(glyphs[i])) {
|
|
// If we hit a halant, move after it; otherwise it's a base: move to it's
|
|
// place, and shift things in between backward.
|
|
j = isHalant(glyphs[i]) ? i + 1 : i;
|
|
} else if ((info.category === 'VPre' || info.category === 'VMPre') && j < i) {
|
|
glyphs.splice.apply(glyphs, [j, 1, glyphs[i]].concat(_toConsumableArray(glyphs.splice(j, i - j))));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function nextSyllable(glyphs, start) {
|
|
if (start >= glyphs.length) return start;
|
|
var syllable = glyphs[start].shaperInfo.syllable;
|
|
while (++start < glyphs.length && glyphs[start].shaperInfo.syllable === syllable) {}
|
|
return start;
|
|
}
|
|
|
|
function isHalant(glyph) {
|
|
return glyph.shaperInfo.category === 'H' && !glyph.isLigated;
|
|
}
|
|
|
|
function isBase(info) {
|
|
return info.category === 'B' || info.category === 'GB';
|
|
}
|
|
|
|
var SHAPERS = {
|
|
arab: ArabicShaper, // Arabic
|
|
mong: ArabicShaper, // Mongolian
|
|
syrc: ArabicShaper, // Syriac
|
|
'nko ': ArabicShaper, // N'Ko
|
|
phag: ArabicShaper, // Phags Pa
|
|
mand: ArabicShaper, // Mandaic
|
|
mani: ArabicShaper, // Manichaean
|
|
phlp: ArabicShaper, // Psalter Pahlavi
|
|
|
|
hang: HangulShaper, // Hangul
|
|
|
|
bali: UniversalShaper, // Balinese
|
|
batk: UniversalShaper, // Batak
|
|
brah: UniversalShaper, // Brahmi
|
|
bugi: UniversalShaper, // Buginese
|
|
buhd: UniversalShaper, // Buhid
|
|
cakm: UniversalShaper, // Chakma
|
|
cham: UniversalShaper, // Cham
|
|
dupl: UniversalShaper, // Duployan
|
|
egyp: UniversalShaper, // Egyptian Hieroglyphs
|
|
gran: UniversalShaper, // Grantha
|
|
hano: UniversalShaper, // Hanunoo
|
|
java: UniversalShaper, // Javanese
|
|
kthi: UniversalShaper, // Kaithi
|
|
kali: UniversalShaper, // Kayah Li
|
|
khar: UniversalShaper, // Kharoshthi
|
|
khoj: UniversalShaper, // Khojki
|
|
sind: UniversalShaper, // Khudawadi
|
|
lepc: UniversalShaper, // Lepcha
|
|
limb: UniversalShaper, // Limbu
|
|
mahj: UniversalShaper, // Mahajani
|
|
// mand: UniversalShaper, // Mandaic
|
|
// mani: UniversalShaper, // Manichaean
|
|
mtei: UniversalShaper, // Meitei Mayek
|
|
modi: UniversalShaper, // Modi
|
|
// mong: UniversalShaper, // Mongolian
|
|
// 'nko ': UniversalShaper, // N’Ko
|
|
hmng: UniversalShaper, // Pahawh Hmong
|
|
// phag: UniversalShaper, // Phags-pa
|
|
// phlp: UniversalShaper, // Psalter Pahlavi
|
|
rjng: UniversalShaper, // Rejang
|
|
saur: UniversalShaper, // Saurashtra
|
|
shrd: UniversalShaper, // Sharada
|
|
sidd: UniversalShaper, // Siddham
|
|
sinh: UniversalShaper, // Sinhala
|
|
sund: UniversalShaper, // Sundanese
|
|
sylo: UniversalShaper, // Syloti Nagri
|
|
tglg: UniversalShaper, // Tagalog
|
|
tagb: UniversalShaper, // Tagbanwa
|
|
tale: UniversalShaper, // Tai Le
|
|
lana: UniversalShaper, // Tai Tham
|
|
tavt: UniversalShaper, // Tai Viet
|
|
takr: UniversalShaper, // Takri
|
|
tibt: UniversalShaper, // Tibetan
|
|
tfng: UniversalShaper, // Tifinagh
|
|
tirh: UniversalShaper, // Tirhuta
|
|
|
|
latn: DefaultShaper, // Latin
|
|
DFLT: DefaultShaper // Default
|
|
};
|
|
|
|
function choose(script) {
|
|
var shaper = SHAPERS[script];
|
|
if (shaper) {
|
|
return shaper;
|
|
}
|
|
|
|
return DefaultShaper;
|
|
}
|
|
|
|
var GSUBProcessor = function (_OTProcessor) {
|
|
_inherits(GSUBProcessor, _OTProcessor);
|
|
|
|
function GSUBProcessor() {
|
|
_classCallCheck(this, GSUBProcessor);
|
|
|
|
return _possibleConstructorReturn(this, (GSUBProcessor.__proto__ || _Object$getPrototypeOf(GSUBProcessor)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(GSUBProcessor, [{
|
|
key: 'applyLookup',
|
|
value: function applyLookup(lookupType, table) {
|
|
var _this2 = this;
|
|
|
|
switch (lookupType) {
|
|
case 1:
|
|
{
|
|
// Single Substitution
|
|
var index = this.coverageIndex(table.coverage);
|
|
if (index === -1) {
|
|
return false;
|
|
}
|
|
|
|
var glyph = this.glyphIterator.cur;
|
|
switch (table.version) {
|
|
case 1:
|
|
glyph.id = glyph.id + table.deltaGlyphID & 0xffff;
|
|
break;
|
|
|
|
case 2:
|
|
glyph.id = table.substitute.get(index);
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
case 2:
|
|
{
|
|
// Multiple Substitution
|
|
var _index = this.coverageIndex(table.coverage);
|
|
if (_index !== -1) {
|
|
var _ret = function () {
|
|
var _glyphs;
|
|
|
|
var sequence = table.sequences.get(_index);
|
|
_this2.glyphIterator.cur.id = sequence[0];
|
|
_this2.glyphIterator.cur.ligatureComponent = 0;
|
|
|
|
var features = _this2.glyphIterator.cur.features;
|
|
var curGlyph = _this2.glyphIterator.cur;
|
|
var replacement = sequence.slice(1).map(function (gid, i) {
|
|
var glyph = new GlyphInfo(_this2.font, gid, undefined, features);
|
|
glyph.shaperInfo = curGlyph.shaperInfo;
|
|
glyph.isLigated = curGlyph.isLigated;
|
|
glyph.ligatureComponent = i + 1;
|
|
glyph.substituted = true;
|
|
return glyph;
|
|
});
|
|
|
|
(_glyphs = _this2.glyphs).splice.apply(_glyphs, [_this2.glyphIterator.index + 1, 0].concat(_toConsumableArray(replacement)));
|
|
return {
|
|
v: true
|
|
};
|
|
}();
|
|
|
|
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
case 3:
|
|
{
|
|
// Alternate Substitution
|
|
var _index2 = this.coverageIndex(table.coverage);
|
|
if (_index2 !== -1) {
|
|
var USER_INDEX = 0; // TODO
|
|
this.glyphIterator.cur.id = table.alternateSet.get(_index2)[USER_INDEX];
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
case 4:
|
|
{
|
|
// Ligature Substitution
|
|
var _index3 = this.coverageIndex(table.coverage);
|
|
if (_index3 === -1) {
|
|
return false;
|
|
}
|
|
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(table.ligatureSets.get(_index3)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var ligature = _step.value;
|
|
|
|
var matched = this.sequenceMatchIndices(1, ligature.components);
|
|
if (!matched) {
|
|
continue;
|
|
}
|
|
|
|
var curGlyph = this.glyphIterator.cur;
|
|
|
|
// Concatenate all of the characters the new ligature will represent
|
|
var characters = curGlyph.codePoints.slice();
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(matched), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var _index4 = _step2.value;
|
|
|
|
characters.push.apply(characters, _toConsumableArray(this.glyphs[_index4].codePoints));
|
|
}
|
|
|
|
// Create the replacement ligature glyph
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
var ligatureGlyph = new GlyphInfo(this.font, ligature.glyph, characters, curGlyph.features);
|
|
ligatureGlyph.shaperInfo = curGlyph.shaperInfo;
|
|
ligatureGlyph.isLigated = true;
|
|
ligatureGlyph.substituted = true;
|
|
|
|
// From Harfbuzz:
|
|
// - If it *is* a mark ligature, we don't allocate a new ligature id, and leave
|
|
// the ligature to keep its old ligature id. This will allow it to attach to
|
|
// a base ligature in GPOS. Eg. if the sequence is: LAM,LAM,SHADDA,FATHA,HEH,
|
|
// and LAM,LAM,HEH for a ligature, they will leave SHADDA and FATHA with a
|
|
// ligature id and component value of 2. Then if SHADDA,FATHA form a ligature
|
|
// later, we don't want them to lose their ligature id/component, otherwise
|
|
// GPOS will fail to correctly position the mark ligature on top of the
|
|
// LAM,LAM,HEH ligature. See https://bugzilla.gnome.org/show_bug.cgi?id=676343
|
|
//
|
|
// - If a ligature is formed of components that some of which are also ligatures
|
|
// themselves, and those ligature components had marks attached to *their*
|
|
// components, we have to attach the marks to the new ligature component
|
|
// positions! Now *that*'s tricky! And these marks may be following the
|
|
// last component of the whole sequence, so we should loop forward looking
|
|
// for them and update them.
|
|
//
|
|
// Eg. the sequence is LAM,LAM,SHADDA,FATHA,HEH, and the font first forms a
|
|
// 'calt' ligature of LAM,HEH, leaving the SHADDA and FATHA with a ligature
|
|
// id and component == 1. Now, during 'liga', the LAM and the LAM-HEH ligature
|
|
// form a LAM-LAM-HEH ligature. We need to reassign the SHADDA and FATHA to
|
|
// the new ligature with a component value of 2.
|
|
//
|
|
// This in fact happened to a font... See https://bugzilla.gnome.org/show_bug.cgi?id=437633
|
|
var isMarkLigature = curGlyph.isMark;
|
|
for (var i = 0; i < matched.length && isMarkLigature; i++) {
|
|
isMarkLigature = this.glyphs[matched[i]].isMark;
|
|
}
|
|
|
|
ligatureGlyph.ligatureID = isMarkLigature ? null : this.ligatureID++;
|
|
|
|
var lastLigID = curGlyph.ligatureID;
|
|
var lastNumComps = curGlyph.codePoints.length;
|
|
var curComps = lastNumComps;
|
|
var idx = this.glyphIterator.index + 1;
|
|
|
|
// Set ligatureID and ligatureComponent on glyphs that were skipped in the matched sequence.
|
|
// This allows GPOS to attach marks to the correct ligature components.
|
|
var _iteratorNormalCompletion3 = true;
|
|
var _didIteratorError3 = false;
|
|
var _iteratorError3 = undefined;
|
|
|
|
try {
|
|
for (var _iterator3 = _getIterator(matched), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
var matchIndex = _step3.value;
|
|
|
|
// Don't assign new ligature components for mark ligatures (see above)
|
|
if (isMarkLigature) {
|
|
idx = matchIndex;
|
|
} else {
|
|
while (idx < matchIndex) {
|
|
var ligatureComponent = curComps - lastNumComps + Math.min(this.glyphs[idx].ligatureComponent || 1, lastNumComps);
|
|
this.glyphs[idx].ligatureID = ligatureGlyph.ligatureID;
|
|
this.glyphs[idx].ligatureComponent = ligatureComponent;
|
|
idx++;
|
|
}
|
|
}
|
|
|
|
lastLigID = this.glyphs[idx].ligatureID;
|
|
lastNumComps = this.glyphs[idx].codePoints.length;
|
|
curComps += lastNumComps;
|
|
idx++; // skip base glyph
|
|
}
|
|
|
|
// Adjust ligature components for any marks following
|
|
} catch (err) {
|
|
_didIteratorError3 = true;
|
|
_iteratorError3 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
_iterator3.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError3) {
|
|
throw _iteratorError3;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (lastLigID && !isMarkLigature) {
|
|
for (var _i = idx; _i < this.glyphs.length; _i++) {
|
|
if (this.glyphs[_i].ligatureID === lastLigID) {
|
|
var ligatureComponent = curComps - lastNumComps + Math.min(this.glyphs[_i].ligatureComponent || 1, lastNumComps);
|
|
this.glyphs[_i].ligatureComponent = ligatureComponent;
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Delete the matched glyphs, and replace the current glyph with the ligature glyph
|
|
for (var _i2 = matched.length - 1; _i2 >= 0; _i2--) {
|
|
this.glyphs.splice(matched[_i2], 1);
|
|
}
|
|
|
|
this.glyphs[this.glyphIterator.index] = ligatureGlyph;
|
|
return true;
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
case 5:
|
|
// Contextual Substitution
|
|
return this.applyContext(table);
|
|
|
|
case 6:
|
|
// Chaining Contextual Substitution
|
|
return this.applyChainingContext(table);
|
|
|
|
case 7:
|
|
// Extension Substitution
|
|
return this.applyLookup(table.lookupType, table.extension);
|
|
|
|
default:
|
|
throw new Error('GSUB lookupType ' + lookupType + ' is not supported');
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return GSUBProcessor;
|
|
}(OTProcessor);
|
|
|
|
var GPOSProcessor = function (_OTProcessor) {
|
|
_inherits(GPOSProcessor, _OTProcessor);
|
|
|
|
function GPOSProcessor() {
|
|
_classCallCheck(this, GPOSProcessor);
|
|
|
|
return _possibleConstructorReturn(this, (GPOSProcessor.__proto__ || _Object$getPrototypeOf(GPOSProcessor)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(GPOSProcessor, [{
|
|
key: 'applyPositionValue',
|
|
value: function applyPositionValue(sequenceIndex, value) {
|
|
var position = this.positions[this.glyphIterator.peekIndex(sequenceIndex)];
|
|
if (value.xAdvance != null) {
|
|
position.xAdvance += value.xAdvance;
|
|
}
|
|
|
|
if (value.yAdvance != null) {
|
|
position.yAdvance += value.yAdvance;
|
|
}
|
|
|
|
if (value.xPlacement != null) {
|
|
position.xOffset += value.xPlacement;
|
|
}
|
|
|
|
if (value.yPlacement != null) {
|
|
position.yOffset += value.yPlacement;
|
|
}
|
|
|
|
// TODO: device tables
|
|
}
|
|
}, {
|
|
key: 'applyLookup',
|
|
value: function applyLookup(lookupType, table) {
|
|
switch (lookupType) {
|
|
case 1:
|
|
{
|
|
// Single positioning value
|
|
var index = this.coverageIndex(table.coverage);
|
|
if (index === -1) {
|
|
return false;
|
|
}
|
|
|
|
switch (table.version) {
|
|
case 1:
|
|
this.applyPositionValue(0, table.value);
|
|
break;
|
|
|
|
case 2:
|
|
this.applyPositionValue(0, table.values.get(index));
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
case 2:
|
|
{
|
|
// Pair Adjustment Positioning
|
|
var nextGlyph = this.glyphIterator.peek();
|
|
if (!nextGlyph) {
|
|
return false;
|
|
}
|
|
|
|
var _index = this.coverageIndex(table.coverage);
|
|
if (_index === -1) {
|
|
return false;
|
|
}
|
|
|
|
switch (table.version) {
|
|
case 1:
|
|
// Adjustments for glyph pairs
|
|
var set = table.pairSets.get(_index);
|
|
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(set), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var _pair = _step.value;
|
|
|
|
if (_pair.secondGlyph === nextGlyph.id) {
|
|
this.applyPositionValue(0, _pair.value1);
|
|
this.applyPositionValue(1, _pair.value2);
|
|
return true;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
|
|
case 2:
|
|
// Class pair adjustment
|
|
var class1 = this.getClassID(this.glyphIterator.cur.id, table.classDef1);
|
|
var class2 = this.getClassID(nextGlyph.id, table.classDef2);
|
|
if (class1 === -1 || class2 === -1) {
|
|
return false;
|
|
}
|
|
|
|
var pair = table.classRecords.get(class1).get(class2);
|
|
this.applyPositionValue(0, pair.value1);
|
|
this.applyPositionValue(1, pair.value2);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
case 3:
|
|
{
|
|
// Cursive Attachment Positioning
|
|
var nextIndex = this.glyphIterator.peekIndex();
|
|
var _nextGlyph = this.glyphs[nextIndex];
|
|
if (!_nextGlyph) {
|
|
return false;
|
|
}
|
|
|
|
var curRecord = table.entryExitRecords[this.coverageIndex(table.coverage)];
|
|
if (!curRecord || !curRecord.exitAnchor) {
|
|
return false;
|
|
}
|
|
|
|
var nextRecord = table.entryExitRecords[this.coverageIndex(table.coverage, _nextGlyph.id)];
|
|
if (!nextRecord || !nextRecord.entryAnchor) {
|
|
return false;
|
|
}
|
|
|
|
var entry = this.getAnchor(nextRecord.entryAnchor);
|
|
var exit = this.getAnchor(curRecord.exitAnchor);
|
|
|
|
var cur = this.positions[this.glyphIterator.index];
|
|
var next = this.positions[nextIndex];
|
|
|
|
switch (this.direction) {
|
|
case 'ltr':
|
|
cur.xAdvance = exit.x + cur.xOffset;
|
|
|
|
var d = entry.x + next.xOffset;
|
|
next.xAdvance -= d;
|
|
next.xOffset -= d;
|
|
break;
|
|
|
|
case 'rtl':
|
|
d = exit.x + cur.xOffset;
|
|
cur.xAdvance -= d;
|
|
cur.xOffset -= d;
|
|
next.xAdvance = entry.x + next.xOffset;
|
|
break;
|
|
}
|
|
|
|
if (this.glyphIterator.flags.rightToLeft) {
|
|
this.glyphIterator.cur.cursiveAttachment = nextIndex;
|
|
cur.yOffset = entry.y - exit.y;
|
|
} else {
|
|
_nextGlyph.cursiveAttachment = this.glyphIterator.index;
|
|
cur.yOffset = exit.y - entry.y;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
case 4:
|
|
{
|
|
// Mark to base positioning
|
|
var markIndex = this.coverageIndex(table.markCoverage);
|
|
if (markIndex === -1) {
|
|
return false;
|
|
}
|
|
|
|
// search backward for a base glyph
|
|
var baseGlyphIndex = this.glyphIterator.index;
|
|
while (--baseGlyphIndex >= 0 && this.glyphs[baseGlyphIndex].isMark) {}
|
|
|
|
if (baseGlyphIndex < 0) {
|
|
return false;
|
|
}
|
|
|
|
var baseIndex = this.coverageIndex(table.baseCoverage, this.glyphs[baseGlyphIndex].id);
|
|
if (baseIndex === -1) {
|
|
return false;
|
|
}
|
|
|
|
var markRecord = table.markArray[markIndex];
|
|
var baseAnchor = table.baseArray[baseIndex][markRecord.class];
|
|
this.applyAnchor(markRecord, baseAnchor, baseGlyphIndex);
|
|
return true;
|
|
}
|
|
|
|
case 5:
|
|
{
|
|
// Mark to ligature positioning
|
|
var _markIndex = this.coverageIndex(table.markCoverage);
|
|
if (_markIndex === -1) {
|
|
return false;
|
|
}
|
|
|
|
// search backward for a base glyph
|
|
var _baseGlyphIndex = this.glyphIterator.index;
|
|
while (--_baseGlyphIndex >= 0 && this.glyphs[_baseGlyphIndex].isMark) {}
|
|
|
|
if (_baseGlyphIndex < 0) {
|
|
return false;
|
|
}
|
|
|
|
var ligIndex = this.coverageIndex(table.ligatureCoverage, this.glyphs[_baseGlyphIndex].id);
|
|
if (ligIndex === -1) {
|
|
return false;
|
|
}
|
|
|
|
var ligAttach = table.ligatureArray[ligIndex];
|
|
var markGlyph = this.glyphIterator.cur;
|
|
var ligGlyph = this.glyphs[_baseGlyphIndex];
|
|
var compIndex = ligGlyph.ligatureID && ligGlyph.ligatureID === markGlyph.ligatureID && markGlyph.ligatureComponent != null ? Math.min(markGlyph.ligatureComponent, ligGlyph.codePoints.length) - 1 : ligGlyph.codePoints.length - 1;
|
|
|
|
var _markRecord = table.markArray[_markIndex];
|
|
var _baseAnchor = ligAttach[compIndex][_markRecord.class];
|
|
this.applyAnchor(_markRecord, _baseAnchor, _baseGlyphIndex);
|
|
return true;
|
|
}
|
|
|
|
case 6:
|
|
{
|
|
// Mark to mark positioning
|
|
var mark1Index = this.coverageIndex(table.mark1Coverage);
|
|
if (mark1Index === -1) {
|
|
return false;
|
|
}
|
|
|
|
// get the previous mark to attach to
|
|
var prevIndex = this.glyphIterator.peekIndex(-1);
|
|
var prev = this.glyphs[prevIndex];
|
|
if (!prev || !prev.isMark) {
|
|
return false;
|
|
}
|
|
|
|
var _cur = this.glyphIterator.cur;
|
|
|
|
// The following logic was borrowed from Harfbuzz
|
|
var good = false;
|
|
if (_cur.ligatureID === prev.ligatureID) {
|
|
if (!_cur.ligatureID) {
|
|
// Marks belonging to the same base
|
|
good = true;
|
|
} else if (_cur.ligatureComponent === prev.ligatureComponent) {
|
|
// Marks belonging to the same ligature component
|
|
good = true;
|
|
}
|
|
} else {
|
|
// If ligature ids don't match, it may be the case that one of the marks
|
|
// itself is a ligature, in which case match.
|
|
if (_cur.ligatureID && !_cur.ligatureComponent || prev.ligatureID && !prev.ligatureComponent) {
|
|
good = true;
|
|
}
|
|
}
|
|
|
|
if (!good) {
|
|
return false;
|
|
}
|
|
|
|
var mark2Index = this.coverageIndex(table.mark2Coverage, prev.id);
|
|
if (mark2Index === -1) {
|
|
return false;
|
|
}
|
|
|
|
var _markRecord2 = table.mark1Array[mark1Index];
|
|
var _baseAnchor2 = table.mark2Array[mark2Index][_markRecord2.class];
|
|
this.applyAnchor(_markRecord2, _baseAnchor2, prevIndex);
|
|
return true;
|
|
}
|
|
|
|
case 7:
|
|
// Contextual positioning
|
|
return this.applyContext(table);
|
|
|
|
case 8:
|
|
// Chaining contextual positioning
|
|
return this.applyChainingContext(table);
|
|
|
|
case 9:
|
|
// Extension positioning
|
|
return this.applyLookup(table.lookupType, table.extension);
|
|
|
|
default:
|
|
throw new Error('Unsupported GPOS table: ' + lookupType);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'applyAnchor',
|
|
value: function applyAnchor(markRecord, baseAnchor, baseGlyphIndex) {
|
|
var baseCoords = this.getAnchor(baseAnchor);
|
|
var markCoords = this.getAnchor(markRecord.markAnchor);
|
|
|
|
var basePos = this.positions[baseGlyphIndex];
|
|
var markPos = this.positions[this.glyphIterator.index];
|
|
|
|
markPos.xOffset = baseCoords.x - markCoords.x;
|
|
markPos.yOffset = baseCoords.y - markCoords.y;
|
|
this.glyphIterator.cur.markAttachment = baseGlyphIndex;
|
|
}
|
|
}, {
|
|
key: 'getAnchor',
|
|
value: function getAnchor(anchor) {
|
|
// TODO: contour point, device tables
|
|
return {
|
|
x: anchor.xCoordinate,
|
|
y: anchor.yCoordinate
|
|
};
|
|
}
|
|
}, {
|
|
key: 'applyFeatures',
|
|
value: function applyFeatures(userFeatures, glyphs, advances) {
|
|
_get(GPOSProcessor.prototype.__proto__ || _Object$getPrototypeOf(GPOSProcessor.prototype), 'applyFeatures', this).call(this, userFeatures, glyphs, advances);
|
|
|
|
for (var i = 0; i < this.glyphs.length; i++) {
|
|
this.fixCursiveAttachment(i);
|
|
}
|
|
|
|
this.fixMarkAttachment();
|
|
}
|
|
}, {
|
|
key: 'fixCursiveAttachment',
|
|
value: function fixCursiveAttachment(i) {
|
|
var glyph = this.glyphs[i];
|
|
if (glyph.cursiveAttachment != null) {
|
|
var j = glyph.cursiveAttachment;
|
|
|
|
glyph.cursiveAttachment = null;
|
|
this.fixCursiveAttachment(j);
|
|
|
|
this.positions[i].yOffset += this.positions[j].yOffset;
|
|
}
|
|
}
|
|
}, {
|
|
key: 'fixMarkAttachment',
|
|
value: function fixMarkAttachment() {
|
|
for (var i = 0; i < this.glyphs.length; i++) {
|
|
var glyph = this.glyphs[i];
|
|
if (glyph.markAttachment != null) {
|
|
var j = glyph.markAttachment;
|
|
|
|
this.positions[i].xOffset += this.positions[j].xOffset;
|
|
this.positions[i].yOffset += this.positions[j].yOffset;
|
|
|
|
if (this.direction === 'ltr') {
|
|
for (var k = j; k < i; k++) {
|
|
this.positions[i].xOffset -= this.positions[k].xAdvance;
|
|
this.positions[i].yOffset -= this.positions[k].yAdvance;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return GPOSProcessor;
|
|
}(OTProcessor);
|
|
|
|
var OTLayoutEngine = function () {
|
|
function OTLayoutEngine(font) {
|
|
_classCallCheck(this, OTLayoutEngine);
|
|
|
|
this.font = font;
|
|
this.glyphInfos = null;
|
|
this.plan = null;
|
|
this.GSUBProcessor = null;
|
|
this.GPOSProcessor = null;
|
|
|
|
if (font.GSUB) {
|
|
this.GSUBProcessor = new GSUBProcessor(font, font.GSUB);
|
|
}
|
|
|
|
if (font.GPOS) {
|
|
this.GPOSProcessor = new GPOSProcessor(font, font.GPOS);
|
|
}
|
|
}
|
|
|
|
_createClass(OTLayoutEngine, [{
|
|
key: 'setup',
|
|
value: function setup(glyphs, features, script, language) {
|
|
var _this = this;
|
|
|
|
// Map glyphs to GlyphInfo objects so data can be passed between
|
|
// GSUB and GPOS without mutating the real (shared) Glyph objects.
|
|
this.glyphInfos = glyphs.map(function (glyph) {
|
|
return new GlyphInfo(_this.font, glyph.id, [].concat(_toConsumableArray(glyph.codePoints)));
|
|
});
|
|
|
|
// Choose a shaper based on the script, and setup a shaping plan.
|
|
// This determines which features to apply to which glyphs.
|
|
this.shaper = choose(script);
|
|
this.plan = new ShapingPlan(this.font, script, language);
|
|
return this.shaper.plan(this.plan, this.glyphInfos, features);
|
|
}
|
|
}, {
|
|
key: 'substitute',
|
|
value: function substitute(glyphs) {
|
|
var _this2 = this;
|
|
|
|
if (this.GSUBProcessor) {
|
|
this.plan.process(this.GSUBProcessor, this.glyphInfos);
|
|
|
|
// Map glyph infos back to normal Glyph objects
|
|
glyphs = this.glyphInfos.map(function (glyphInfo) {
|
|
return _this2.font.getGlyph(glyphInfo.id, glyphInfo.codePoints);
|
|
});
|
|
}
|
|
|
|
return glyphs;
|
|
}
|
|
}, {
|
|
key: 'position',
|
|
value: function position(glyphs, positions) {
|
|
if (this.shaper.zeroMarkWidths === 'BEFORE_GPOS') {
|
|
this.zeroMarkAdvances(positions);
|
|
}
|
|
|
|
if (this.GPOSProcessor) {
|
|
this.plan.process(this.GPOSProcessor, this.glyphInfos, positions);
|
|
}
|
|
|
|
if (this.shaper.zeroMarkWidths === 'AFTER_GPOS') {
|
|
this.zeroMarkAdvances(positions);
|
|
}
|
|
|
|
// Reverse the glyphs and positions if the script is right-to-left
|
|
if (this.plan.direction === 'rtl') {
|
|
glyphs.reverse();
|
|
positions.reverse();
|
|
}
|
|
|
|
return this.GPOSProcessor && this.GPOSProcessor.features;
|
|
}
|
|
}, {
|
|
key: 'zeroMarkAdvances',
|
|
value: function zeroMarkAdvances(positions) {
|
|
for (var i = 0; i < this.glyphInfos.length; i++) {
|
|
if (this.glyphInfos[i].isMark) {
|
|
positions[i].xAdvance = 0;
|
|
positions[i].yAdvance = 0;
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: 'cleanup',
|
|
value: function cleanup() {
|
|
this.glyphInfos = null;
|
|
this.plan = null;
|
|
this.shaper = null;
|
|
}
|
|
}, {
|
|
key: 'getAvailableFeatures',
|
|
value: function getAvailableFeatures(script, language) {
|
|
var features = [];
|
|
|
|
if (this.GSUBProcessor) {
|
|
this.GSUBProcessor.selectScript(script, language);
|
|
features.push.apply(features, _toConsumableArray(_Object$keys(this.GSUBProcessor.features)));
|
|
}
|
|
|
|
if (this.GPOSProcessor) {
|
|
this.GPOSProcessor.selectScript(script, language);
|
|
features.push.apply(features, _toConsumableArray(_Object$keys(this.GPOSProcessor.features)));
|
|
}
|
|
|
|
return features;
|
|
}
|
|
}]);
|
|
|
|
return OTLayoutEngine;
|
|
}();
|
|
|
|
var LayoutEngine = function () {
|
|
function LayoutEngine(font) {
|
|
_classCallCheck(this, LayoutEngine);
|
|
|
|
this.font = font;
|
|
this.unicodeLayoutEngine = null;
|
|
this.kernProcessor = null;
|
|
|
|
// Choose an advanced layout engine. We try the AAT morx table first since more
|
|
// scripts are currently supported because the shaping logic is built into the font.
|
|
if (this.font.morx) {
|
|
this.engine = new AATLayoutEngine(this.font);
|
|
} else if (this.font.GSUB || this.font.GPOS) {
|
|
this.engine = new OTLayoutEngine(this.font);
|
|
}
|
|
}
|
|
|
|
_createClass(LayoutEngine, [{
|
|
key: 'layout',
|
|
value: function layout(string) {
|
|
var features = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
var script = arguments[2];
|
|
var language = arguments[3];
|
|
|
|
// Make the features parameter optional
|
|
if (typeof features === 'string') {
|
|
script = features;
|
|
language = script;
|
|
features = [];
|
|
}
|
|
|
|
// Map string to glyphs if needed
|
|
if (typeof string === 'string') {
|
|
// Attempt to detect the script from the string if not provided.
|
|
if (script == null) {
|
|
script = forString(string);
|
|
}
|
|
|
|
var glyphs = this.font.glyphsForString(string);
|
|
} else {
|
|
// Attempt to detect the script from the glyph code points if not provided.
|
|
if (script == null) {
|
|
var codePoints = [];
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(string), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var glyph = _step.value;
|
|
|
|
codePoints.push.apply(codePoints, _toConsumableArray(glyph.codePoints));
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
script = forCodePoints(codePoints);
|
|
}
|
|
|
|
var glyphs = string;
|
|
}
|
|
|
|
// Return early if there are no glyphs
|
|
if (glyphs.length === 0) {
|
|
return new GlyphRun(glyphs, []);
|
|
}
|
|
|
|
// Setup the advanced layout engine
|
|
if (this.engine && this.engine.setup) {
|
|
this.engine.setup(glyphs, features, script, language);
|
|
}
|
|
|
|
// Substitute and position the glyphs
|
|
glyphs = this.substitute(glyphs, features, script, language);
|
|
var positions = this.position(glyphs, features, script, language);
|
|
|
|
// Let the layout engine clean up any state it might have
|
|
if (this.engine && this.engine.cleanup) {
|
|
this.engine.cleanup();
|
|
}
|
|
|
|
return new GlyphRun(glyphs, positions);
|
|
}
|
|
}, {
|
|
key: 'substitute',
|
|
value: function substitute(glyphs, features, script, language) {
|
|
// Call the advanced layout engine to make substitutions
|
|
if (this.engine && this.engine.substitute) {
|
|
glyphs = this.engine.substitute(glyphs, features, script, language);
|
|
}
|
|
|
|
return glyphs;
|
|
}
|
|
}, {
|
|
key: 'position',
|
|
value: function position(glyphs, features, script, language) {
|
|
// Get initial glyph positions
|
|
var positions = glyphs.map(function (glyph) {
|
|
return new GlyphPosition(glyph.advanceWidth);
|
|
});
|
|
var positioned = null;
|
|
|
|
// Call the advanced layout engine. Returns the features applied.
|
|
if (this.engine && this.engine.position) {
|
|
positioned = this.engine.position(glyphs, positions, features, script, language);
|
|
}
|
|
|
|
// if there is no GPOS table, use unicode properties to position marks.
|
|
if (!positioned) {
|
|
if (!this.unicodeLayoutEngine) {
|
|
this.unicodeLayoutEngine = new UnicodeLayoutEngine(this.font);
|
|
}
|
|
|
|
this.unicodeLayoutEngine.positionGlyphs(glyphs, positions);
|
|
}
|
|
|
|
// if kerning is not supported by GPOS, do kerning with the TrueType/AAT kern table
|
|
if ((!positioned || !positioned.kern) && this.font.kern) {
|
|
if (!this.kernProcessor) {
|
|
this.kernProcessor = new KernProcessor(this.font);
|
|
}
|
|
|
|
this.kernProcessor.process(glyphs, positions);
|
|
}
|
|
|
|
return positions;
|
|
}
|
|
}, {
|
|
key: 'getAvailableFeatures',
|
|
value: function getAvailableFeatures(script, language) {
|
|
var features = [];
|
|
|
|
if (this.engine) {
|
|
features.push.apply(features, _toConsumableArray(this.engine.getAvailableFeatures(script, language)));
|
|
}
|
|
|
|
if (this.font.kern && features.indexOf('kern') === -1) {
|
|
features.push('kern');
|
|
}
|
|
|
|
return features;
|
|
}
|
|
}, {
|
|
key: 'stringsForGlyph',
|
|
value: function stringsForGlyph(gid) {
|
|
var result = new _Set();
|
|
|
|
var codePoints = this.font._cmapProcessor.codePointsForGlyph(gid);
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(codePoints), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var codePoint = _step2.value;
|
|
|
|
result.add(_String$fromCodePoint(codePoint));
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (this.engine && this.engine.stringsForGlyph) {
|
|
var _iteratorNormalCompletion3 = true;
|
|
var _didIteratorError3 = false;
|
|
var _iteratorError3 = undefined;
|
|
|
|
try {
|
|
for (var _iterator3 = _getIterator(this.engine.stringsForGlyph(gid)), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
var string = _step3.value;
|
|
|
|
result.add(string);
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError3 = true;
|
|
_iteratorError3 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
_iterator3.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError3) {
|
|
throw _iteratorError3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return _Array$from(result);
|
|
}
|
|
}]);
|
|
|
|
return LayoutEngine;
|
|
}();
|
|
|
|
var SVG_COMMANDS = {
|
|
moveTo: 'M',
|
|
lineTo: 'L',
|
|
quadraticCurveTo: 'Q',
|
|
bezierCurveTo: 'C',
|
|
closePath: 'Z'
|
|
};
|
|
|
|
/**
|
|
* Path objects are returned by glyphs and represent the actual
|
|
* vector outlines for each glyph in the font. Paths can be converted
|
|
* to SVG path data strings, or to functions that can be applied to
|
|
* render the path to a graphics context.
|
|
*/
|
|
|
|
var Path = function () {
|
|
function Path() {
|
|
_classCallCheck(this, Path);
|
|
|
|
this.commands = [];
|
|
this._bbox = null;
|
|
this._cbox = null;
|
|
}
|
|
|
|
/**
|
|
* Compiles the path to a JavaScript function that can be applied with
|
|
* a graphics context in order to render the path.
|
|
* @return {string}
|
|
*/
|
|
|
|
|
|
_createClass(Path, [{
|
|
key: 'toFunction',
|
|
value: function toFunction() {
|
|
var cmds = this.commands.map(function (c) {
|
|
return ' ctx.' + c.command + '(' + c.args.join(', ') + ');';
|
|
});
|
|
return new Function('ctx', cmds.join('\n'));
|
|
}
|
|
|
|
/**
|
|
* Converts the path to an SVG path data string
|
|
* @return {string}
|
|
*/
|
|
|
|
}, {
|
|
key: 'toSVG',
|
|
value: function toSVG() {
|
|
var cmds = this.commands.map(function (c) {
|
|
var args = c.args.map(function (arg) {
|
|
return Math.round(arg * 100) / 100;
|
|
});
|
|
return '' + SVG_COMMANDS[c.command] + args.join(' ');
|
|
});
|
|
|
|
return cmds.join('');
|
|
}
|
|
|
|
/**
|
|
* Gets the "control box" of a path.
|
|
* This is like the bounding box, but it includes all points including
|
|
* control points of bezier segments and is much faster to compute than
|
|
* the real bounding box.
|
|
* @type {BBox}
|
|
*/
|
|
|
|
}, {
|
|
key: 'cbox',
|
|
get: function get() {
|
|
if (!this._cbox) {
|
|
var cbox = new BBox();
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.commands), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var command = _step.value;
|
|
|
|
for (var _i = 0; _i < command.args.length; _i += 2) {
|
|
cbox.addPoint(command.args[_i], command.args[_i + 1]);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
this._cbox = _Object$freeze(cbox);
|
|
}
|
|
|
|
return this._cbox;
|
|
}
|
|
|
|
/**
|
|
* Gets the exact bounding box of the path by evaluating curve segments.
|
|
* Slower to compute than the control box, but more accurate.
|
|
* @type {BBox}
|
|
*/
|
|
|
|
}, {
|
|
key: 'bbox',
|
|
get: function get() {
|
|
if (this._bbox) {
|
|
return this._bbox;
|
|
}
|
|
|
|
var bbox = new BBox();
|
|
var cx = 0,
|
|
cy = 0;
|
|
|
|
var f = function f(t) {
|
|
return Math.pow(1 - t, 3) * p0[i] + 3 * Math.pow(1 - t, 2) * t * p1[i] + 3 * (1 - t) * Math.pow(t, 2) * p2[i] + Math.pow(t, 3) * p3[i];
|
|
};
|
|
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(this.commands), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var c = _step2.value;
|
|
|
|
switch (c.command) {
|
|
case 'moveTo':
|
|
case 'lineTo':
|
|
var _c$args = _slicedToArray(c.args, 2),
|
|
x = _c$args[0],
|
|
y = _c$args[1];
|
|
|
|
bbox.addPoint(x, y);
|
|
cx = x;
|
|
cy = y;
|
|
break;
|
|
|
|
case 'quadraticCurveTo':
|
|
case 'bezierCurveTo':
|
|
if (c.command === 'quadraticCurveTo') {
|
|
// http://fontforge.org/bezier.html
|
|
var _c$args2 = _slicedToArray(c.args, 4),
|
|
qp1x = _c$args2[0],
|
|
qp1y = _c$args2[1],
|
|
p3x = _c$args2[2],
|
|
p3y = _c$args2[3];
|
|
|
|
var cp1x = cx + 2 / 3 * (qp1x - cx); // CP1 = QP0 + 2/3 * (QP1-QP0)
|
|
var cp1y = cy + 2 / 3 * (qp1y - cy);
|
|
var cp2x = p3x + 2 / 3 * (qp1x - p3x); // CP2 = QP2 + 2/3 * (QP1-QP2)
|
|
var cp2y = p3y + 2 / 3 * (qp1y - p3y);
|
|
} else {
|
|
var _c$args3 = _slicedToArray(c.args, 6),
|
|
cp1x = _c$args3[0],
|
|
cp1y = _c$args3[1],
|
|
cp2x = _c$args3[2],
|
|
cp2y = _c$args3[3],
|
|
p3x = _c$args3[4],
|
|
p3y = _c$args3[5];
|
|
}
|
|
|
|
// http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
|
|
bbox.addPoint(p3x, p3y);
|
|
|
|
var p0 = [cx, cy];
|
|
var p1 = [cp1x, cp1y];
|
|
var p2 = [cp2x, cp2y];
|
|
var p3 = [p3x, p3y];
|
|
|
|
for (var i = 0; i <= 1; i++) {
|
|
var b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];
|
|
var a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];
|
|
c = 3 * p1[i] - 3 * p0[i];
|
|
|
|
if (a === 0) {
|
|
if (b === 0) {
|
|
continue;
|
|
}
|
|
|
|
var t = -c / b;
|
|
if (0 < t && t < 1) {
|
|
if (i === 0) {
|
|
bbox.addPoint(f(t), bbox.maxY);
|
|
} else if (i === 1) {
|
|
bbox.addPoint(bbox.maxX, f(t));
|
|
}
|
|
}
|
|
|
|
continue;
|
|
}
|
|
|
|
var b2ac = Math.pow(b, 2) - 4 * c * a;
|
|
if (b2ac < 0) {
|
|
continue;
|
|
}
|
|
|
|
var t1 = (-b + Math.sqrt(b2ac)) / (2 * a);
|
|
if (0 < t1 && t1 < 1) {
|
|
if (i === 0) {
|
|
bbox.addPoint(f(t1), bbox.maxY);
|
|
} else if (i === 1) {
|
|
bbox.addPoint(bbox.maxX, f(t1));
|
|
}
|
|
}
|
|
|
|
var t2 = (-b - Math.sqrt(b2ac)) / (2 * a);
|
|
if (0 < t2 && t2 < 1) {
|
|
if (i === 0) {
|
|
bbox.addPoint(f(t2), bbox.maxY);
|
|
} else if (i === 1) {
|
|
bbox.addPoint(bbox.maxX, f(t2));
|
|
}
|
|
}
|
|
}
|
|
|
|
cx = p3x;
|
|
cy = p3y;
|
|
break;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
return this._bbox = _Object$freeze(bbox);
|
|
}
|
|
}]);
|
|
|
|
return Path;
|
|
}();
|
|
|
|
var _arr = ['moveTo', 'lineTo', 'quadraticCurveTo', 'bezierCurveTo', 'closePath'];
|
|
|
|
var _loop = function _loop() {
|
|
var command = _arr[_i2];
|
|
Path.prototype[command] = function () {
|
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
this._bbox = this._cbox = null;
|
|
this.commands.push({
|
|
command: command,
|
|
args: args
|
|
});
|
|
|
|
return this;
|
|
};
|
|
};
|
|
|
|
for (var _i2 = 0; _i2 < _arr.length; _i2++) {
|
|
_loop();
|
|
}
|
|
|
|
var StandardNames = ['.notdef', '.null', 'nonmarkingreturn', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'Adieresis', 'Aring', 'Ccedilla', 'Eacute', 'Ntilde', 'Odieresis', 'Udieresis', 'aacute', 'agrave', 'acircumflex', 'adieresis', 'atilde', 'aring', 'ccedilla', 'eacute', 'egrave', 'ecircumflex', 'edieresis', 'iacute', 'igrave', 'icircumflex', 'idieresis', 'ntilde', 'oacute', 'ograve', 'ocircumflex', 'odieresis', 'otilde', 'uacute', 'ugrave', 'ucircumflex', 'udieresis', 'dagger', 'degree', 'cent', 'sterling', 'section', 'bullet', 'paragraph', 'germandbls', 'registered', 'copyright', 'trademark', 'acute', 'dieresis', 'notequal', 'AE', 'Oslash', 'infinity', 'plusminus', 'lessequal', 'greaterequal', 'yen', 'mu', 'partialdiff', 'summation', 'product', 'pi', 'integral', 'ordfeminine', 'ordmasculine', 'Omega', 'ae', 'oslash', 'questiondown', 'exclamdown', 'logicalnot', 'radical', 'florin', 'approxequal', 'Delta', 'guillemotleft', 'guillemotright', 'ellipsis', 'nonbreakingspace', 'Agrave', 'Atilde', 'Otilde', 'OE', 'oe', 'endash', 'emdash', 'quotedblleft', 'quotedblright', 'quoteleft', 'quoteright', 'divide', 'lozenge', 'ydieresis', 'Ydieresis', 'fraction', 'currency', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'daggerdbl', 'periodcentered', 'quotesinglbase', 'quotedblbase', 'perthousand', 'Acircumflex', 'Ecircumflex', 'Aacute', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Oacute', 'Ocircumflex', 'apple', 'Ograve', 'Uacute', 'Ucircumflex', 'Ugrave', 'dotlessi', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'Lslash', 'lslash', 'Scaron', 'scaron', 'Zcaron', 'zcaron', 'brokenbar', 'Eth', 'eth', 'Yacute', 'yacute', 'Thorn', 'thorn', 'minus', 'multiply', 'onesuperior', 'twosuperior', 'threesuperior', 'onehalf', 'onequarter', 'threequarters', 'franc', 'Gbreve', 'gbreve', 'Idotaccent', 'Scedilla', 'scedilla', 'Cacute', 'cacute', 'Ccaron', 'ccaron', 'dcroat'];
|
|
|
|
var _class$7;
|
|
function _applyDecoratedDescriptor$4(target, property, decorators, descriptor, context) {
|
|
var desc = {};
|
|
Object['ke' + 'ys'](descriptor).forEach(function (key) {
|
|
desc[key] = descriptor[key];
|
|
});
|
|
desc.enumerable = !!desc.enumerable;
|
|
desc.configurable = !!desc.configurable;
|
|
|
|
if ('value' in desc || desc.initializer) {
|
|
desc.writable = true;
|
|
}
|
|
|
|
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
|
|
return decorator(target, property, desc) || desc;
|
|
}, desc);
|
|
|
|
if (context && desc.initializer !== void 0) {
|
|
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
|
|
desc.initializer = undefined;
|
|
}
|
|
|
|
if (desc.initializer === void 0) {
|
|
Object['define' + 'Property'](target, property, desc);
|
|
desc = null;
|
|
}
|
|
|
|
return desc;
|
|
}
|
|
|
|
/**
|
|
* Glyph objects represent a glyph in the font. They have various properties for accessing metrics and
|
|
* the actual vector path the glyph represents, and methods for rendering the glyph to a graphics context.
|
|
*
|
|
* You do not create glyph objects directly. They are created by various methods on the font object.
|
|
* There are several subclasses of the base Glyph class internally that may be returned depending
|
|
* on the font format, but they all inherit from this class.
|
|
*/
|
|
var Glyph = (_class$7 = function () {
|
|
function Glyph(id, codePoints, font) {
|
|
_classCallCheck(this, Glyph);
|
|
|
|
/**
|
|
* The glyph id in the font
|
|
* @type {number}
|
|
*/
|
|
this.id = id;
|
|
|
|
/**
|
|
* An array of unicode code points that are represented by this glyph.
|
|
* There can be multiple code points in the case of ligatures and other glyphs
|
|
* that represent multiple visual characters.
|
|
* @type {number[]}
|
|
*/
|
|
this.codePoints = codePoints;
|
|
this._font = font;
|
|
|
|
// TODO: get this info from GDEF if available
|
|
this.isMark = this.codePoints.every(unicode.isMark);
|
|
this.isLigature = this.codePoints.length > 1;
|
|
}
|
|
|
|
_createClass(Glyph, [{
|
|
key: '_getPath',
|
|
value: function _getPath() {
|
|
return new Path();
|
|
}
|
|
}, {
|
|
key: '_getCBox',
|
|
value: function _getCBox() {
|
|
return this.path.cbox;
|
|
}
|
|
}, {
|
|
key: '_getBBox',
|
|
value: function _getBBox() {
|
|
return this.path.bbox;
|
|
}
|
|
}, {
|
|
key: '_getTableMetrics',
|
|
value: function _getTableMetrics(table) {
|
|
if (this.id < table.metrics.length) {
|
|
return table.metrics.get(this.id);
|
|
}
|
|
|
|
var metric = table.metrics.get(table.metrics.length - 1);
|
|
var res = {
|
|
advance: metric ? metric.advance : 0,
|
|
bearing: table.bearings.get(this.id - table.metrics.length) || 0
|
|
};
|
|
|
|
return res;
|
|
}
|
|
}, {
|
|
key: '_getMetrics',
|
|
value: function _getMetrics(cbox) {
|
|
if (this._metrics) {
|
|
return this._metrics;
|
|
}
|
|
|
|
var _getTableMetrics2 = this._getTableMetrics(this._font.hmtx),
|
|
advanceWidth = _getTableMetrics2.advance,
|
|
leftBearing = _getTableMetrics2.bearing;
|
|
|
|
// For vertical metrics, use vmtx if available, or fall back to global data from OS/2 or hhea
|
|
|
|
|
|
if (this._font.vmtx) {
|
|
var _getTableMetrics3 = this._getTableMetrics(this._font.vmtx),
|
|
advanceHeight = _getTableMetrics3.advance,
|
|
topBearing = _getTableMetrics3.bearing;
|
|
} else {
|
|
var os2 = void 0;
|
|
if (typeof cbox === 'undefined' || cbox === null) {
|
|
cbox = this.cbox;
|
|
}
|
|
|
|
if ((os2 = this._font['OS/2']) && os2.version > 0) {
|
|
var advanceHeight = Math.abs(os2.typoAscender - os2.typoDescender);
|
|
var topBearing = os2.typoAscender - cbox.maxY;
|
|
} else {
|
|
var hhea = this._font.hhea;
|
|
|
|
var advanceHeight = Math.abs(hhea.ascent - hhea.descent);
|
|
var topBearing = hhea.ascent - cbox.maxY;
|
|
}
|
|
}
|
|
|
|
return this._metrics = { advanceWidth: advanceWidth, advanceHeight: advanceHeight, leftBearing: leftBearing, topBearing: topBearing };
|
|
}
|
|
|
|
/**
|
|
* The glyph’s control box.
|
|
* This is often the same as the bounding box, but is faster to compute.
|
|
* Because of the way bezier curves are defined, some of the control points
|
|
* can be outside of the bounding box. Where `bbox` takes this into account,
|
|
* `cbox` does not. Thus, cbox is less accurate, but faster to compute.
|
|
* See [here](http://www.freetype.org/freetype2/docs/glyphs/glyphs-6.html#section-2)
|
|
* for a more detailed description.
|
|
*
|
|
* @type {BBox}
|
|
*/
|
|
|
|
}, {
|
|
key: '_getName',
|
|
value: function _getName() {
|
|
var post = this._font.post;
|
|
|
|
if (!post) {
|
|
return null;
|
|
}
|
|
|
|
switch (post.version) {
|
|
case 1:
|
|
return StandardNames[this.id];
|
|
|
|
case 2:
|
|
var id = post.glyphNameIndex[this.id];
|
|
if (id < StandardNames.length) {
|
|
return StandardNames[id];
|
|
}
|
|
|
|
return post.names[id - StandardNames.length];
|
|
|
|
case 2.5:
|
|
return StandardNames[this.id + post.offsets[this.id]];
|
|
|
|
case 4:
|
|
return String.fromCharCode(post.map[this.id]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* The glyph's name
|
|
* @type {string}
|
|
*/
|
|
|
|
}, {
|
|
key: 'render',
|
|
|
|
|
|
/**
|
|
* Renders the glyph to the given graphics context, at the specified font size.
|
|
* @param {CanvasRenderingContext2d} ctx
|
|
* @param {number} size
|
|
*/
|
|
value: function render(ctx, size) {
|
|
ctx.save();
|
|
|
|
var scale = 1 / this._font.head.unitsPerEm * size;
|
|
ctx.scale(scale, scale);
|
|
|
|
var fn = this.path.toFunction();
|
|
fn(ctx);
|
|
ctx.fill();
|
|
|
|
ctx.restore();
|
|
}
|
|
}, {
|
|
key: 'cbox',
|
|
get: function get() {
|
|
return this._getCBox();
|
|
}
|
|
|
|
/**
|
|
* The glyph’s bounding box, i.e. the rectangle that encloses the
|
|
* glyph outline as tightly as possible.
|
|
* @type {BBox}
|
|
*/
|
|
|
|
}, {
|
|
key: 'bbox',
|
|
get: function get() {
|
|
return this._getBBox();
|
|
}
|
|
|
|
/**
|
|
* A vector Path object representing the glyph outline.
|
|
* @type {Path}
|
|
*/
|
|
|
|
}, {
|
|
key: 'path',
|
|
get: function get() {
|
|
// Cache the path so we only decode it once
|
|
// Decoding is actually performed by subclasses
|
|
return this._getPath();
|
|
}
|
|
|
|
/**
|
|
* The glyph's advance width.
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'advanceWidth',
|
|
get: function get() {
|
|
return this._getMetrics().advanceWidth;
|
|
}
|
|
|
|
/**
|
|
* The glyph's advance height.
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'advanceHeight',
|
|
get: function get() {
|
|
return this._getMetrics().advanceHeight;
|
|
}
|
|
}, {
|
|
key: 'ligatureCaretPositions',
|
|
get: function get() {}
|
|
}, {
|
|
key: 'name',
|
|
get: function get() {
|
|
return this._getName();
|
|
}
|
|
}]);
|
|
|
|
return Glyph;
|
|
}(), (_applyDecoratedDescriptor$4(_class$7.prototype, 'cbox', [cache], _Object$getOwnPropertyDescriptor(_class$7.prototype, 'cbox'), _class$7.prototype), _applyDecoratedDescriptor$4(_class$7.prototype, 'bbox', [cache], _Object$getOwnPropertyDescriptor(_class$7.prototype, 'bbox'), _class$7.prototype), _applyDecoratedDescriptor$4(_class$7.prototype, 'path', [cache], _Object$getOwnPropertyDescriptor(_class$7.prototype, 'path'), _class$7.prototype), _applyDecoratedDescriptor$4(_class$7.prototype, 'advanceWidth', [cache], _Object$getOwnPropertyDescriptor(_class$7.prototype, 'advanceWidth'), _class$7.prototype), _applyDecoratedDescriptor$4(_class$7.prototype, 'advanceHeight', [cache], _Object$getOwnPropertyDescriptor(_class$7.prototype, 'advanceHeight'), _class$7.prototype), _applyDecoratedDescriptor$4(_class$7.prototype, 'name', [cache], _Object$getOwnPropertyDescriptor(_class$7.prototype, 'name'), _class$7.prototype)), _class$7);
|
|
|
|
// The header for both simple and composite glyphs
|
|
var GlyfHeader = new r.Struct({
|
|
numberOfContours: r.int16, // if negative, this is a composite glyph
|
|
xMin: r.int16,
|
|
yMin: r.int16,
|
|
xMax: r.int16,
|
|
yMax: r.int16
|
|
});
|
|
|
|
// Flags for simple glyphs
|
|
var ON_CURVE = 1 << 0;
|
|
var X_SHORT_VECTOR = 1 << 1;
|
|
var Y_SHORT_VECTOR = 1 << 2;
|
|
var REPEAT = 1 << 3;
|
|
var SAME_X = 1 << 4;
|
|
var SAME_Y = 1 << 5;
|
|
|
|
// Flags for composite glyphs
|
|
var ARG_1_AND_2_ARE_WORDS = 1 << 0;
|
|
var WE_HAVE_A_SCALE = 1 << 3;
|
|
var MORE_COMPONENTS = 1 << 5;
|
|
var WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
|
|
var WE_HAVE_A_TWO_BY_TWO = 1 << 7;
|
|
var WE_HAVE_INSTRUCTIONS = 1 << 8;
|
|
// Represents a point in a simple glyph
|
|
var Point = function () {
|
|
function Point(onCurve, endContour) {
|
|
var x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
var y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
|
|
_classCallCheck(this, Point);
|
|
|
|
this.onCurve = onCurve;
|
|
this.endContour = endContour;
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
_createClass(Point, [{
|
|
key: 'copy',
|
|
value: function copy() {
|
|
return new Point(this.onCurve, this.endContour, this.x, this.y);
|
|
}
|
|
}]);
|
|
|
|
return Point;
|
|
}();
|
|
|
|
// Represents a component in a composite glyph
|
|
|
|
var Component = function Component(glyphID, dx, dy) {
|
|
_classCallCheck(this, Component);
|
|
|
|
this.glyphID = glyphID;
|
|
this.dx = dx;
|
|
this.dy = dy;
|
|
this.pos = 0;
|
|
this.scaleX = this.scaleY = 1;
|
|
this.scale01 = this.scale10 = 0;
|
|
};
|
|
|
|
/**
|
|
* Represents a TrueType glyph.
|
|
*/
|
|
|
|
|
|
var TTFGlyph = function (_Glyph) {
|
|
_inherits(TTFGlyph, _Glyph);
|
|
|
|
function TTFGlyph() {
|
|
_classCallCheck(this, TTFGlyph);
|
|
|
|
return _possibleConstructorReturn(this, (TTFGlyph.__proto__ || _Object$getPrototypeOf(TTFGlyph)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(TTFGlyph, [{
|
|
key: '_getCBox',
|
|
|
|
// Parses just the glyph header and returns the bounding box
|
|
value: function _getCBox(internal) {
|
|
// We need to decode the glyph if variation processing is requested,
|
|
// so it's easier just to recompute the path's cbox after decoding.
|
|
if (this._font._variationProcessor && !internal) {
|
|
return this.path.cbox;
|
|
}
|
|
|
|
var stream = this._font._getTableStream('glyf');
|
|
stream.pos += this._font.loca.offsets[this.id];
|
|
var glyph = GlyfHeader.decode(stream);
|
|
|
|
var cbox = new BBox(glyph.xMin, glyph.yMin, glyph.xMax, glyph.yMax);
|
|
return _Object$freeze(cbox);
|
|
}
|
|
|
|
// Parses a single glyph coordinate
|
|
|
|
}, {
|
|
key: '_parseGlyphCoord',
|
|
value: function _parseGlyphCoord(stream, prev, short, same) {
|
|
if (short) {
|
|
var val = stream.readUInt8();
|
|
if (!same) {
|
|
val = -val;
|
|
}
|
|
|
|
val += prev;
|
|
} else {
|
|
if (same) {
|
|
var val = prev;
|
|
} else {
|
|
var val = prev + stream.readInt16BE();
|
|
}
|
|
}
|
|
|
|
return val;
|
|
}
|
|
|
|
// Decodes the glyph data into points for simple glyphs,
|
|
// or components for composite glyphs
|
|
|
|
}, {
|
|
key: '_decode',
|
|
value: function _decode() {
|
|
var glyfPos = this._font.loca.offsets[this.id];
|
|
var nextPos = this._font.loca.offsets[this.id + 1];
|
|
|
|
// Nothing to do if there is no data for this glyph
|
|
if (glyfPos === nextPos) {
|
|
return null;
|
|
}
|
|
|
|
var stream = this._font._getTableStream('glyf');
|
|
stream.pos += glyfPos;
|
|
var startPos = stream.pos;
|
|
|
|
var glyph = GlyfHeader.decode(stream);
|
|
|
|
if (glyph.numberOfContours > 0) {
|
|
this._decodeSimple(glyph, stream);
|
|
} else if (glyph.numberOfContours < 0) {
|
|
this._decodeComposite(glyph, stream, startPos);
|
|
}
|
|
|
|
return glyph;
|
|
}
|
|
}, {
|
|
key: '_decodeSimple',
|
|
value: function _decodeSimple(glyph, stream) {
|
|
// this is a simple glyph
|
|
glyph.points = [];
|
|
|
|
var endPtsOfContours = new r.Array(r.uint16, glyph.numberOfContours).decode(stream);
|
|
glyph.instructions = new r.Array(r.uint8, r.uint16).decode(stream);
|
|
|
|
var flags = [];
|
|
var numCoords = endPtsOfContours[endPtsOfContours.length - 1] + 1;
|
|
|
|
while (flags.length < numCoords) {
|
|
var flag = stream.readUInt8();
|
|
flags.push(flag);
|
|
|
|
// check for repeat flag
|
|
if (flag & REPEAT) {
|
|
var count = stream.readUInt8();
|
|
for (var j = 0; j < count; j++) {
|
|
flags.push(flag);
|
|
}
|
|
}
|
|
}
|
|
|
|
for (var i = 0; i < flags.length; i++) {
|
|
var flag = flags[i];
|
|
var point = new Point(!!(flag & ON_CURVE), endPtsOfContours.indexOf(i) >= 0, 0, 0);
|
|
glyph.points.push(point);
|
|
}
|
|
|
|
var px = 0;
|
|
for (var i = 0; i < flags.length; i++) {
|
|
var flag = flags[i];
|
|
glyph.points[i].x = px = this._parseGlyphCoord(stream, px, flag & X_SHORT_VECTOR, flag & SAME_X);
|
|
}
|
|
|
|
var py = 0;
|
|
for (var i = 0; i < flags.length; i++) {
|
|
var flag = flags[i];
|
|
glyph.points[i].y = py = this._parseGlyphCoord(stream, py, flag & Y_SHORT_VECTOR, flag & SAME_Y);
|
|
}
|
|
|
|
if (this._font._variationProcessor) {
|
|
var points = glyph.points.slice();
|
|
points.push.apply(points, _toConsumableArray(this._getPhantomPoints(glyph)));
|
|
|
|
this._font._variationProcessor.transformPoints(this.id, points);
|
|
glyph.phantomPoints = points.slice(-4);
|
|
}
|
|
|
|
return;
|
|
}
|
|
}, {
|
|
key: '_decodeComposite',
|
|
value: function _decodeComposite(glyph, stream) {
|
|
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
|
|
// this is a composite glyph
|
|
glyph.components = [];
|
|
var haveInstructions = false;
|
|
var flags = MORE_COMPONENTS;
|
|
|
|
while (flags & MORE_COMPONENTS) {
|
|
flags = stream.readUInt16BE();
|
|
var gPos = stream.pos - offset;
|
|
var glyphID = stream.readUInt16BE();
|
|
if (!haveInstructions) {
|
|
haveInstructions = (flags & WE_HAVE_INSTRUCTIONS) !== 0;
|
|
}
|
|
|
|
if (flags & ARG_1_AND_2_ARE_WORDS) {
|
|
var dx = stream.readInt16BE();
|
|
var dy = stream.readInt16BE();
|
|
} else {
|
|
var dx = stream.readInt8();
|
|
var dy = stream.readInt8();
|
|
}
|
|
|
|
var component = new Component(glyphID, dx, dy);
|
|
component.pos = gPos;
|
|
|
|
if (flags & WE_HAVE_A_SCALE) {
|
|
// fixed number with 14 bits of fraction
|
|
component.scaleX = component.scaleY = (stream.readUInt8() << 24 | stream.readUInt8() << 16) / 1073741824;
|
|
} else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
|
|
component.scaleX = (stream.readUInt8() << 24 | stream.readUInt8() << 16) / 1073741824;
|
|
component.scaleY = (stream.readUInt8() << 24 | stream.readUInt8() << 16) / 1073741824;
|
|
} else if (flags & WE_HAVE_A_TWO_BY_TWO) {
|
|
component.scaleX = (stream.readUInt8() << 24 | stream.readUInt8() << 16) / 1073741824;
|
|
component.scale01 = (stream.readUInt8() << 24 | stream.readUInt8() << 16) / 1073741824;
|
|
component.scale10 = (stream.readUInt8() << 24 | stream.readUInt8() << 16) / 1073741824;
|
|
component.scaleY = (stream.readUInt8() << 24 | stream.readUInt8() << 16) / 1073741824;
|
|
}
|
|
|
|
glyph.components.push(component);
|
|
}
|
|
|
|
if (this._font._variationProcessor) {
|
|
var points = [];
|
|
for (var j = 0; j < glyph.components.length; j++) {
|
|
var component = glyph.components[j];
|
|
points.push(new Point(true, true, component.dx, component.dy));
|
|
}
|
|
|
|
points.push.apply(points, _toConsumableArray(this._getPhantomPoints(glyph)));
|
|
|
|
this._font._variationProcessor.transformPoints(this.id, points);
|
|
glyph.phantomPoints = points.splice(-4, 4);
|
|
|
|
for (var i = 0; i < points.length; i++) {
|
|
var point = points[i];
|
|
glyph.components[i].dx = point.x;
|
|
glyph.components[i].dy = point.y;
|
|
}
|
|
}
|
|
|
|
return haveInstructions;
|
|
}
|
|
}, {
|
|
key: '_getPhantomPoints',
|
|
value: function _getPhantomPoints(glyph) {
|
|
var cbox = this._getCBox(true);
|
|
if (this._metrics == null) {
|
|
this._metrics = Glyph.prototype._getMetrics.call(this, cbox);
|
|
}
|
|
|
|
var _metrics = this._metrics,
|
|
advanceWidth = _metrics.advanceWidth,
|
|
advanceHeight = _metrics.advanceHeight,
|
|
leftBearing = _metrics.leftBearing,
|
|
topBearing = _metrics.topBearing;
|
|
|
|
|
|
return [new Point(false, true, glyph.xMin - leftBearing, 0), new Point(false, true, glyph.xMin - leftBearing + advanceWidth, 0), new Point(false, true, 0, glyph.yMax + topBearing), new Point(false, true, 0, glyph.yMax + topBearing + advanceHeight)];
|
|
}
|
|
|
|
// Decodes font data, resolves composite glyphs, and returns an array of contours
|
|
|
|
}, {
|
|
key: '_getContours',
|
|
value: function _getContours() {
|
|
var glyph = this._decode();
|
|
if (!glyph) {
|
|
return [];
|
|
}
|
|
|
|
if (glyph.numberOfContours < 0) {
|
|
// resolve composite glyphs
|
|
var points = [];
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(glyph.components), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var component = _step.value;
|
|
|
|
glyph = this._font.getGlyph(component.glyphID)._decode();
|
|
// TODO transform
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(glyph.points), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var _point = _step2.value;
|
|
|
|
points.push(new Point(_point.onCurve, _point.endContour, _point.x + component.dx, _point.y + component.dy));
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
var points = glyph.points || [];
|
|
}
|
|
|
|
// Recompute and cache metrics if we performed variation processing
|
|
if (glyph.phantomPoints) {
|
|
this._metrics.advanceWidth = glyph.phantomPoints[1].x - glyph.phantomPoints[0].x;
|
|
this._metrics.advanceHeight = glyph.phantomPoints[3].y - glyph.phantomPoints[2].y;
|
|
this._metrics.leftBearing = glyph.xMin - glyph.phantomPoints[0].x;
|
|
this._metrics.topBearing = glyph.phantomPoints[2].y - glyph.yMax;
|
|
}
|
|
|
|
var contours = [];
|
|
var cur = [];
|
|
for (var k = 0; k < points.length; k++) {
|
|
var point = points[k];
|
|
cur.push(point);
|
|
if (point.endContour) {
|
|
contours.push(cur);
|
|
cur = [];
|
|
}
|
|
}
|
|
|
|
return contours;
|
|
}
|
|
}, {
|
|
key: '_getMetrics',
|
|
value: function _getMetrics() {
|
|
if (this._metrics) {
|
|
return this._metrics;
|
|
}
|
|
|
|
var cbox = this._getCBox(true);
|
|
_get(TTFGlyph.prototype.__proto__ || _Object$getPrototypeOf(TTFGlyph.prototype), '_getMetrics', this).call(this, cbox);
|
|
|
|
if (this._font._variationProcessor) {
|
|
// Decode the font data (and cache for later).
|
|
// This triggers recomputation of metrics
|
|
this.path;
|
|
}
|
|
|
|
return this._metrics;
|
|
}
|
|
|
|
// Converts contours to a Path object that can be rendered
|
|
|
|
}, {
|
|
key: '_getPath',
|
|
value: function _getPath() {
|
|
var contours = this._getContours();
|
|
var path = new Path();
|
|
|
|
for (var i = 0; i < contours.length; i++) {
|
|
var contour = contours[i];
|
|
var firstPt = contour[0];
|
|
var lastPt = contour[contour.length - 1];
|
|
var start = 0;
|
|
|
|
if (firstPt.onCurve) {
|
|
// The first point will be consumed by the moveTo command, so skip in the loop
|
|
var curvePt = null;
|
|
start = 1;
|
|
} else {
|
|
if (lastPt.onCurve) {
|
|
// Start at the last point if the first point is off curve and the last point is on curve
|
|
firstPt = lastPt;
|
|
} else {
|
|
// Start at the middle if both the first and last points are off curve
|
|
firstPt = new Point(false, false, (firstPt.x + lastPt.x) / 2, (firstPt.y + lastPt.y) / 2);
|
|
}
|
|
|
|
var curvePt = firstPt;
|
|
}
|
|
|
|
path.moveTo(firstPt.x, firstPt.y);
|
|
|
|
for (var j = start; j < contour.length; j++) {
|
|
var pt = contour[j];
|
|
var prevPt = j === 0 ? firstPt : contour[j - 1];
|
|
|
|
if (prevPt.onCurve && pt.onCurve) {
|
|
path.lineTo(pt.x, pt.y);
|
|
} else if (prevPt.onCurve && !pt.onCurve) {
|
|
var curvePt = pt;
|
|
} else if (!prevPt.onCurve && !pt.onCurve) {
|
|
var midX = (prevPt.x + pt.x) / 2;
|
|
var midY = (prevPt.y + pt.y) / 2;
|
|
path.quadraticCurveTo(prevPt.x, prevPt.y, midX, midY);
|
|
var curvePt = pt;
|
|
} else if (!prevPt.onCurve && pt.onCurve) {
|
|
path.quadraticCurveTo(curvePt.x, curvePt.y, pt.x, pt.y);
|
|
var curvePt = null;
|
|
} else {
|
|
throw new Error("Unknown TTF path state");
|
|
}
|
|
}
|
|
|
|
// Connect the first and last points
|
|
if (curvePt) {
|
|
path.quadraticCurveTo(curvePt.x, curvePt.y, firstPt.x, firstPt.y);
|
|
}
|
|
|
|
path.closePath();
|
|
}
|
|
|
|
return path;
|
|
}
|
|
}]);
|
|
|
|
return TTFGlyph;
|
|
}(Glyph);
|
|
|
|
/**
|
|
* Represents an OpenType PostScript glyph, in the Compact Font Format.
|
|
*/
|
|
|
|
var CFFGlyph = function (_Glyph) {
|
|
_inherits(CFFGlyph, _Glyph);
|
|
|
|
function CFFGlyph() {
|
|
_classCallCheck(this, CFFGlyph);
|
|
|
|
return _possibleConstructorReturn(this, (CFFGlyph.__proto__ || _Object$getPrototypeOf(CFFGlyph)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(CFFGlyph, [{
|
|
key: '_getName',
|
|
value: function _getName() {
|
|
return this._font['CFF '].getGlyphName(this.id);
|
|
}
|
|
}, {
|
|
key: 'bias',
|
|
value: function bias(s) {
|
|
if (s.length < 1240) {
|
|
return 107;
|
|
} else if (s.length < 33900) {
|
|
return 1131;
|
|
} else {
|
|
return 32768;
|
|
}
|
|
}
|
|
}, {
|
|
key: '_getPath',
|
|
value: function _getPath() {
|
|
var stream = this._font.stream;
|
|
var pos = stream.pos;
|
|
|
|
|
|
var cff = this._font['CFF '];
|
|
var str = cff.topDict.CharStrings[this.id];
|
|
var end = str.offset + str.length;
|
|
stream.pos = str.offset;
|
|
|
|
var path = new Path();
|
|
var stack = [];
|
|
var trans = [];
|
|
|
|
var width = null;
|
|
var nStems = 0;
|
|
var x = 0,
|
|
y = 0;
|
|
var usedGsubrs = void 0;
|
|
var usedSubrs = void 0;
|
|
var open = false;
|
|
|
|
this._usedGsubrs = usedGsubrs = {};
|
|
this._usedSubrs = usedSubrs = {};
|
|
|
|
var gsubrs = cff.globalSubrIndex || [];
|
|
var gsubrsBias = this.bias(gsubrs);
|
|
|
|
var privateDict = cff.privateDictForGlyph(this.id);
|
|
var subrs = privateDict.Subrs || [];
|
|
var subrsBias = this.bias(subrs);
|
|
|
|
function parseStems() {
|
|
if (stack.length % 2 !== 0) {
|
|
if (width === null) {
|
|
width = stack.shift() + privateDict.nominalWidthX;
|
|
}
|
|
}
|
|
|
|
nStems += stack.length >> 1;
|
|
return stack.length = 0;
|
|
}
|
|
|
|
function moveTo(x, y) {
|
|
if (open) {
|
|
path.closePath();
|
|
}
|
|
|
|
path.moveTo(x, y);
|
|
open = true;
|
|
}
|
|
|
|
var parse = function parse() {
|
|
while (stream.pos < end) {
|
|
var op = stream.readUInt8();
|
|
if (op < 32) {
|
|
switch (op) {
|
|
case 1: // hstem
|
|
case 3: // vstem
|
|
case 18: // hstemhm
|
|
case 23:
|
|
// vstemhm
|
|
parseStems();
|
|
break;
|
|
|
|
case 4:
|
|
// vmoveto
|
|
if (stack.length > 1) {
|
|
if (typeof width === 'undefined' || width === null) {
|
|
width = stack.shift() + privateDict.nominalWidthX;
|
|
}
|
|
}
|
|
|
|
y += stack.shift();
|
|
moveTo(x, y);
|
|
break;
|
|
|
|
case 5:
|
|
// rlineto
|
|
while (stack.length >= 2) {
|
|
x += stack.shift();
|
|
y += stack.shift();
|
|
path.lineTo(x, y);
|
|
}
|
|
break;
|
|
|
|
case 6: // hlineto
|
|
case 7:
|
|
// vlineto
|
|
var phase = op === 6;
|
|
while (stack.length >= 1) {
|
|
if (phase) {
|
|
x += stack.shift();
|
|
} else {
|
|
y += stack.shift();
|
|
}
|
|
|
|
path.lineTo(x, y);
|
|
phase = !phase;
|
|
}
|
|
break;
|
|
|
|
case 8:
|
|
// rrcurveto
|
|
while (stack.length > 0) {
|
|
var c1x = x + stack.shift();
|
|
var c1y = y + stack.shift();
|
|
var c2x = c1x + stack.shift();
|
|
var c2y = c1y + stack.shift();
|
|
x = c2x + stack.shift();
|
|
y = c2y + stack.shift();
|
|
path.bezierCurveTo(c1x, c1y, c2x, c2y, x, y);
|
|
}
|
|
break;
|
|
|
|
case 10:
|
|
// callsubr
|
|
var index = stack.pop() + subrsBias;
|
|
var subr = subrs[index];
|
|
if (subr) {
|
|
usedSubrs[index] = true;
|
|
var p = stream.pos;
|
|
var e = end;
|
|
stream.pos = subr.offset;
|
|
end = subr.offset + subr.length;
|
|
parse();
|
|
stream.pos = p;
|
|
end = e;
|
|
}
|
|
break;
|
|
|
|
case 11:
|
|
// return
|
|
return;
|
|
|
|
case 14:
|
|
// endchar
|
|
if (stack.length > 0) {
|
|
if (typeof width === 'undefined' || width === null) {
|
|
width = stack.shift() + privateDict.nominalWidthX;
|
|
}
|
|
}
|
|
|
|
path.closePath();
|
|
open = false;
|
|
break;
|
|
|
|
case 19: // hintmask
|
|
case 20:
|
|
// cntrmask
|
|
parseStems();
|
|
stream.pos += nStems + 7 >> 3;
|
|
break;
|
|
|
|
case 21:
|
|
// rmoveto
|
|
if (stack.length > 2) {
|
|
if (typeof width === 'undefined' || width === null) {
|
|
width = stack.shift() + privateDict.nominalWidthX;
|
|
}
|
|
var haveWidth = true;
|
|
}
|
|
|
|
x += stack.shift();
|
|
y += stack.shift();
|
|
moveTo(x, y);
|
|
break;
|
|
|
|
case 22:
|
|
// hmoveto
|
|
if (stack.length > 1) {
|
|
if (typeof width === 'undefined' || width === null) {
|
|
width = stack.shift() + privateDict.nominalWidthX;
|
|
}
|
|
}
|
|
|
|
x += stack.shift();
|
|
moveTo(x, y);
|
|
break;
|
|
|
|
case 24:
|
|
// rcurveline
|
|
while (stack.length >= 8) {
|
|
var c1x = x + stack.shift();
|
|
var c1y = y + stack.shift();
|
|
var c2x = c1x + stack.shift();
|
|
var c2y = c1y + stack.shift();
|
|
x = c2x + stack.shift();
|
|
y = c2y + stack.shift();
|
|
path.bezierCurveTo(c1x, c1y, c2x, c2y, x, y);
|
|
}
|
|
|
|
x += stack.shift();
|
|
y += stack.shift();
|
|
path.lineTo(x, y);
|
|
break;
|
|
|
|
case 25:
|
|
// rlinecurve
|
|
while (stack.length >= 8) {
|
|
x += stack.shift();
|
|
y += stack.shift();
|
|
path.lineTo(x, y);
|
|
}
|
|
|
|
var c1x = x + stack.shift();
|
|
var c1y = y + stack.shift();
|
|
var c2x = c1x + stack.shift();
|
|
var c2y = c1y + stack.shift();
|
|
x = c2x + stack.shift();
|
|
y = c2y + stack.shift();
|
|
path.bezierCurveTo(c1x, c1y, c2x, c2y, x, y);
|
|
break;
|
|
|
|
case 26:
|
|
// vvcurveto
|
|
if (stack.length % 2) {
|
|
x += stack.shift();
|
|
}
|
|
|
|
while (stack.length >= 4) {
|
|
c1x = x;
|
|
c1y = y + stack.shift();
|
|
c2x = c1x + stack.shift();
|
|
c2y = c1y + stack.shift();
|
|
x = c2x;
|
|
y = c2y + stack.shift();
|
|
path.bezierCurveTo(c1x, c1y, c2x, c2y, x, y);
|
|
}
|
|
break;
|
|
|
|
case 27:
|
|
// hhcurveto
|
|
if (stack.length % 2) {
|
|
y += stack.shift();
|
|
}
|
|
|
|
while (stack.length >= 4) {
|
|
c1x = x + stack.shift();
|
|
c1y = y;
|
|
c2x = c1x + stack.shift();
|
|
c2y = c1y + stack.shift();
|
|
x = c2x + stack.shift();
|
|
y = c2y;
|
|
path.bezierCurveTo(c1x, c1y, c2x, c2y, x, y);
|
|
}
|
|
break;
|
|
|
|
case 28:
|
|
// shortint
|
|
stack.push(stream.readInt16BE());
|
|
break;
|
|
|
|
case 29:
|
|
// callgsubr
|
|
index = stack.pop() + gsubrsBias;
|
|
subr = gsubrs[index];
|
|
if (subr) {
|
|
usedGsubrs[index] = true;
|
|
var p = stream.pos;
|
|
var e = end;
|
|
stream.pos = subr.offset;
|
|
end = subr.offset + subr.length;
|
|
parse();
|
|
stream.pos = p;
|
|
end = e;
|
|
}
|
|
break;
|
|
|
|
case 30: // vhcurveto
|
|
case 31:
|
|
// hvcurveto
|
|
phase = op === 31;
|
|
while (stack.length >= 4) {
|
|
if (phase) {
|
|
c1x = x + stack.shift();
|
|
c1y = y;
|
|
c2x = c1x + stack.shift();
|
|
c2y = c1y + stack.shift();
|
|
y = c2y + stack.shift();
|
|
x = c2x + (stack.length === 1 ? stack.shift() : 0);
|
|
} else {
|
|
c1x = x;
|
|
c1y = y + stack.shift();
|
|
c2x = c1x + stack.shift();
|
|
c2y = c1y + stack.shift();
|
|
x = c2x + stack.shift();
|
|
y = c2y + (stack.length === 1 ? stack.shift() : 0);
|
|
}
|
|
|
|
path.bezierCurveTo(c1x, c1y, c2x, c2y, x, y);
|
|
phase = !phase;
|
|
}
|
|
break;
|
|
|
|
case 12:
|
|
op = stream.readUInt8();
|
|
switch (op) {
|
|
case 3:
|
|
// and
|
|
var a = stack.pop();
|
|
var b = stack.pop();
|
|
stack.push(a && b ? 1 : 0);
|
|
break;
|
|
|
|
case 4:
|
|
// or
|
|
a = stack.pop();
|
|
b = stack.pop();
|
|
stack.push(a || b ? 1 : 0);
|
|
break;
|
|
|
|
case 5:
|
|
// not
|
|
a = stack.pop();
|
|
stack.push(a ? 0 : 1);
|
|
break;
|
|
|
|
case 9:
|
|
// abs
|
|
a = stack.pop();
|
|
stack.push(Math.abs(a));
|
|
break;
|
|
|
|
case 10:
|
|
// add
|
|
a = stack.pop();
|
|
b = stack.pop();
|
|
stack.push(a + b);
|
|
break;
|
|
|
|
case 11:
|
|
// sub
|
|
a = stack.pop();
|
|
b = stack.pop();
|
|
stack.push(a - b);
|
|
break;
|
|
|
|
case 12:
|
|
// div
|
|
a = stack.pop();
|
|
b = stack.pop();
|
|
stack.push(a / b);
|
|
break;
|
|
|
|
case 14:
|
|
// neg
|
|
a = stack.pop();
|
|
stack.push(-a);
|
|
break;
|
|
|
|
case 15:
|
|
// eq
|
|
a = stack.pop();
|
|
b = stack.pop();
|
|
stack.push(a === b ? 1 : 0);
|
|
break;
|
|
|
|
case 18:
|
|
// drop
|
|
stack.pop();
|
|
break;
|
|
|
|
case 20:
|
|
// put
|
|
var val = stack.pop();
|
|
var idx = stack.pop();
|
|
trans[idx] = val;
|
|
break;
|
|
|
|
case 21:
|
|
// get
|
|
idx = stack.pop();
|
|
stack.push(trans[idx] || 0);
|
|
break;
|
|
|
|
case 22:
|
|
// ifelse
|
|
var s1 = stack.pop();
|
|
var s2 = stack.pop();
|
|
var v1 = stack.pop();
|
|
var v2 = stack.pop();
|
|
stack.push(v1 <= v2 ? s1 : s2);
|
|
break;
|
|
|
|
case 23:
|
|
// random
|
|
stack.push(Math.random());
|
|
break;
|
|
|
|
case 24:
|
|
// mul
|
|
a = stack.pop();
|
|
b = stack.pop();
|
|
stack.push(a * b);
|
|
break;
|
|
|
|
case 26:
|
|
// sqrt
|
|
a = stack.pop();
|
|
stack.push(Math.sqrt(a));
|
|
break;
|
|
|
|
case 27:
|
|
// dup
|
|
a = stack.pop();
|
|
stack.push(a, a);
|
|
break;
|
|
|
|
case 28:
|
|
// exch
|
|
a = stack.pop();
|
|
b = stack.pop();
|
|
stack.push(b, a);
|
|
break;
|
|
|
|
case 29:
|
|
// index
|
|
idx = stack.pop();
|
|
if (idx < 0) {
|
|
idx = 0;
|
|
} else if (idx > stack.length - 1) {
|
|
idx = stack.length - 1;
|
|
}
|
|
|
|
stack.push(stack[idx]);
|
|
break;
|
|
|
|
case 30:
|
|
// roll
|
|
var n = stack.pop();
|
|
var j = stack.pop();
|
|
|
|
if (j >= 0) {
|
|
while (j > 0) {
|
|
var t = stack[n - 1];
|
|
for (var i = n - 2; i >= 0; i--) {
|
|
stack[i + 1] = stack[i];
|
|
}
|
|
|
|
stack[0] = t;
|
|
j--;
|
|
}
|
|
} else {
|
|
while (j < 0) {
|
|
var t = stack[0];
|
|
for (var _i = 0; _i <= n; _i++) {
|
|
stack[_i] = stack[_i + 1];
|
|
}
|
|
|
|
stack[n - 1] = t;
|
|
j++;
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 34:
|
|
// hflex
|
|
c1x = x + stack.shift();
|
|
c1y = y;
|
|
c2x = c1x + stack.shift();
|
|
c2y = c1y + stack.shift();
|
|
var c3x = c2x + stack.shift();
|
|
var c3y = c2y;
|
|
var c4x = c3x + stack.shift();
|
|
var c4y = c3y;
|
|
var c5x = c4x + stack.shift();
|
|
var c5y = c4y;
|
|
var c6x = c5x + stack.shift();
|
|
var c6y = c5y;
|
|
x = c6x;
|
|
y = c6y;
|
|
|
|
path.bezierCurveTo(c1x, c1y, c2x, c2y, c3x, c3y);
|
|
path.bezierCurveTo(c4x, c4y, c5x, c5y, c6x, c6y);
|
|
break;
|
|
|
|
case 35:
|
|
// flex
|
|
var pts = [];
|
|
|
|
for (var _i2 = 0; _i2 <= 5; _i2++) {
|
|
x += stack.shift();
|
|
y += stack.shift();
|
|
pts.push(x, y);
|
|
}
|
|
|
|
path.bezierCurveTo.apply(path, _toConsumableArray(pts.slice(0, 6)));
|
|
path.bezierCurveTo.apply(path, _toConsumableArray(pts.slice(6)));
|
|
stack.shift(); // fd
|
|
break;
|
|
|
|
case 36:
|
|
// hflex1
|
|
c1x = x + stack.shift();
|
|
c1y = y + stack.shift();
|
|
c2x = c1x + stack.shift();
|
|
c2y = c1y + stack.shift();
|
|
c3x = c2x + stack.shift();
|
|
c3y = c2y;
|
|
c4x = c3x + stack.shift();
|
|
c4y = c3y;
|
|
c5x = c4x + stack.shift();
|
|
c5y = c4y + stack.shift();
|
|
c6x = c5x + stack.shift();
|
|
c6y = c5y;
|
|
x = c6x;
|
|
y = c6y;
|
|
|
|
path.bezierCurveTo(c1x, c1y, c2x, c2y, c3x, c3y);
|
|
path.bezierCurveTo(c4x, c4y, c5x, c5y, c6x, c6y);
|
|
break;
|
|
|
|
case 37:
|
|
// flex1
|
|
var startx = x;
|
|
var starty = y;
|
|
|
|
pts = [];
|
|
for (var _i3 = 0; _i3 <= 4; _i3++) {
|
|
x += stack.shift();
|
|
y += stack.shift();
|
|
pts.push(x, y);
|
|
}
|
|
|
|
if (Math.abs(x - startx) > Math.abs(y - starty)) {
|
|
// horizontal
|
|
x += stack.shift();
|
|
y = starty;
|
|
} else {
|
|
x = startx;
|
|
y += stack.shift();
|
|
}
|
|
|
|
pts.push(x, y);
|
|
path.bezierCurveTo.apply(path, _toConsumableArray(pts.slice(0, 6)));
|
|
path.bezierCurveTo.apply(path, _toConsumableArray(pts.slice(6)));
|
|
break;
|
|
|
|
default:
|
|
throw new Error('Unknown op: 12 ' + op);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
throw new Error('Unknown op: ' + op);
|
|
}
|
|
} else if (op < 247) {
|
|
stack.push(op - 139);
|
|
} else if (op < 251) {
|
|
var b1 = stream.readUInt8();
|
|
stack.push((op - 247) * 256 + b1 + 108);
|
|
} else if (op < 255) {
|
|
var b1 = stream.readUInt8();
|
|
stack.push(-(op - 251) * 256 - b1 - 108);
|
|
} else {
|
|
stack.push(stream.readInt32BE() / 65536);
|
|
}
|
|
}
|
|
};
|
|
|
|
parse();
|
|
return path;
|
|
}
|
|
}]);
|
|
|
|
return CFFGlyph;
|
|
}(Glyph);
|
|
|
|
var SBIXImage = new r.Struct({
|
|
originX: r.uint16,
|
|
originY: r.uint16,
|
|
type: new r.String(4),
|
|
data: new r.Buffer(function (t) {
|
|
return t.parent.buflen - t._currentOffset;
|
|
})
|
|
});
|
|
|
|
/**
|
|
* Represents a color (e.g. emoji) glyph in Apple's SBIX format.
|
|
*/
|
|
|
|
var SBIXGlyph = function (_TTFGlyph) {
|
|
_inherits(SBIXGlyph, _TTFGlyph);
|
|
|
|
function SBIXGlyph() {
|
|
_classCallCheck(this, SBIXGlyph);
|
|
|
|
return _possibleConstructorReturn(this, (SBIXGlyph.__proto__ || _Object$getPrototypeOf(SBIXGlyph)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(SBIXGlyph, [{
|
|
key: 'getImageForSize',
|
|
|
|
/**
|
|
* Returns an object representing a glyph image at the given point size.
|
|
* The object has a data property with a Buffer containing the actual image data,
|
|
* along with the image type, and origin.
|
|
*
|
|
* @param {number} size
|
|
* @return {object}
|
|
*/
|
|
value: function getImageForSize(size) {
|
|
for (var i = 0; i < this._font.sbix.imageTables.length; i++) {
|
|
var table = this._font.sbix.imageTables[i];
|
|
if (table.ppem >= size) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
var offsets = table.imageOffsets;
|
|
var start = offsets[this.id];
|
|
var end = offsets[this.id + 1];
|
|
|
|
if (start === end) {
|
|
return null;
|
|
}
|
|
|
|
this._font.stream.pos = start;
|
|
return SBIXImage.decode(this._font.stream, { buflen: end - start });
|
|
}
|
|
}, {
|
|
key: 'render',
|
|
value: function render(ctx, size) {
|
|
var img = this.getImageForSize(size);
|
|
if (img != null) {
|
|
var scale = size / this._font.unitsPerEm;
|
|
ctx.image(img.data, { height: size, x: img.originX, y: (this.bbox.minY - img.originY) * scale });
|
|
}
|
|
|
|
if (this._font.sbix.flags.renderOutlines) {
|
|
_get(SBIXGlyph.prototype.__proto__ || _Object$getPrototypeOf(SBIXGlyph.prototype), 'render', this).call(this, ctx, size);
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return SBIXGlyph;
|
|
}(TTFGlyph);
|
|
|
|
var COLRLayer = function COLRLayer(glyph, color) {
|
|
_classCallCheck(this, COLRLayer);
|
|
|
|
this.glyph = glyph;
|
|
this.color = color;
|
|
};
|
|
|
|
/**
|
|
* Represents a color (e.g. emoji) glyph in Microsoft's COLR format.
|
|
* Each glyph in this format contain a list of colored layers, each
|
|
* of which is another vector glyph.
|
|
*/
|
|
|
|
|
|
var COLRGlyph = function (_Glyph) {
|
|
_inherits(COLRGlyph, _Glyph);
|
|
|
|
function COLRGlyph() {
|
|
_classCallCheck(this, COLRGlyph);
|
|
|
|
return _possibleConstructorReturn(this, (COLRGlyph.__proto__ || _Object$getPrototypeOf(COLRGlyph)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(COLRGlyph, [{
|
|
key: '_getBBox',
|
|
value: function _getBBox() {
|
|
var bbox = new BBox();
|
|
for (var i = 0; i < this.layers.length; i++) {
|
|
var layer = this.layers[i];
|
|
var b = layer.glyph.bbox;
|
|
bbox.addPoint(b.minX, b.minY);
|
|
bbox.addPoint(b.maxX, b.maxY);
|
|
}
|
|
|
|
return bbox;
|
|
}
|
|
|
|
/**
|
|
* Returns an array of objects containing the glyph and color for
|
|
* each layer in the composite color glyph.
|
|
* @type {object[]}
|
|
*/
|
|
|
|
}, {
|
|
key: 'render',
|
|
value: function render(ctx, size) {
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.layers), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var _step$value = _step.value,
|
|
glyph = _step$value.glyph,
|
|
color = _step$value.color;
|
|
|
|
ctx.fillColor([color.red, color.green, color.blue], color.alpha / 255 * 100);
|
|
glyph.render(ctx, size);
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
return;
|
|
}
|
|
}, {
|
|
key: 'layers',
|
|
get: function get() {
|
|
var cpal = this._font.CPAL;
|
|
var colr = this._font.COLR;
|
|
var low = 0;
|
|
var high = colr.baseGlyphRecord.length - 1;
|
|
|
|
while (low <= high) {
|
|
var mid = low + high >> 1;
|
|
var rec = colr.baseGlyphRecord[mid];
|
|
|
|
if (this.id < rec.gid) {
|
|
high = mid - 1;
|
|
} else if (this.id > rec.gid) {
|
|
low = mid + 1;
|
|
} else {
|
|
var baseLayer = rec;
|
|
break;
|
|
}
|
|
}
|
|
|
|
// if base glyph not found in COLR table,
|
|
// default to normal glyph from glyf or CFF
|
|
if (baseLayer == null) {
|
|
var g = this._font._getBaseGlyph(this.id);
|
|
var color = {
|
|
red: 0,
|
|
green: 0,
|
|
blue: 0,
|
|
alpha: 255
|
|
};
|
|
|
|
return [new COLRLayer(g, color)];
|
|
}
|
|
|
|
// otherwise, return an array of all the layers
|
|
var layers = [];
|
|
for (var i = baseLayer.firstLayerIndex; i < baseLayer.firstLayerIndex + baseLayer.numLayers; i++) {
|
|
var rec = colr.layerRecords[i];
|
|
var color = cpal.colorRecords[rec.paletteIndex];
|
|
var g = this._font._getBaseGlyph(rec.gid);
|
|
layers.push(new COLRLayer(g, color));
|
|
}
|
|
|
|
return layers;
|
|
}
|
|
}]);
|
|
|
|
return COLRGlyph;
|
|
}(Glyph);
|
|
|
|
var TUPLES_SHARE_POINT_NUMBERS = 0x8000;
|
|
var TUPLE_COUNT_MASK = 0x0fff;
|
|
var EMBEDDED_TUPLE_COORD = 0x8000;
|
|
var INTERMEDIATE_TUPLE = 0x4000;
|
|
var PRIVATE_POINT_NUMBERS = 0x2000;
|
|
var TUPLE_INDEX_MASK = 0x0fff;
|
|
var POINTS_ARE_WORDS = 0x80;
|
|
var POINT_RUN_COUNT_MASK = 0x7f;
|
|
var DELTAS_ARE_ZERO = 0x80;
|
|
var DELTAS_ARE_WORDS = 0x40;
|
|
var DELTA_RUN_COUNT_MASK = 0x3f;
|
|
|
|
/**
|
|
* This class is transforms TrueType glyphs according to the data from
|
|
* the Apple Advanced Typography variation tables (fvar, gvar, and avar).
|
|
* These tables allow infinite adjustments to glyph weight, width, slant,
|
|
* and optical size without the designer needing to specify every exact style.
|
|
*
|
|
* Apple's documentation for these tables is not great, so thanks to the
|
|
* Freetype project for figuring much of this out.
|
|
*
|
|
* @private
|
|
*/
|
|
|
|
var GlyphVariationProcessor = function () {
|
|
function GlyphVariationProcessor(font, coords) {
|
|
_classCallCheck(this, GlyphVariationProcessor);
|
|
|
|
this.font = font;
|
|
this.normalizedCoords = this.normalizeCoords(coords);
|
|
}
|
|
|
|
_createClass(GlyphVariationProcessor, [{
|
|
key: 'normalizeCoords',
|
|
value: function normalizeCoords(coords) {
|
|
// the default mapping is linear along each axis, in two segments:
|
|
// from the minValue to defaultValue, and from defaultValue to maxValue.
|
|
var normalized = [];
|
|
for (var i = 0; i < this.font.fvar.axis.length; i++) {
|
|
var axis = this.font.fvar.axis[i];
|
|
if (coords[i] < axis.defaultValue) {
|
|
normalized.push((coords[i] - axis.defaultValue) / (axis.defaultValue - axis.minValue));
|
|
} else {
|
|
normalized.push((coords[i] - axis.defaultValue) / (axis.maxValue - axis.defaultValue));
|
|
}
|
|
}
|
|
|
|
// if there is an avar table, the normalized value is calculated
|
|
// by interpolating between the two nearest mapped values.
|
|
if (this.font.avar) {
|
|
for (var i = 0; i < this.font.avar.segment.length; i++) {
|
|
var segment = this.font.avar.segment[i];
|
|
for (var j = 0; j < segment.correspondence.length; j++) {
|
|
var pair = segment.correspondence[j];
|
|
if (j >= 1 && normalized[i] < pair.fromCoord) {
|
|
var prev = segment.correspondence[j - 1];
|
|
normalized[i] = (normalized[i] - prev.fromCoord) * (pair.toCoord - prev.toCoord) / (pair.fromCoord - prev.fromCoord) + prev.toCoord;
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return normalized;
|
|
}
|
|
}, {
|
|
key: 'transformPoints',
|
|
value: function transformPoints(gid, glyphPoints) {
|
|
if (!this.font.fvar || !this.font.gvar) {
|
|
return;
|
|
}
|
|
|
|
var gvar = this.font.gvar;
|
|
|
|
if (gid >= gvar.glyphCount) {
|
|
return;
|
|
}
|
|
|
|
var offset = gvar.offsets[gid];
|
|
if (offset === gvar.offsets[gid + 1]) {
|
|
return;
|
|
}
|
|
|
|
// Read the gvar data for this glyph
|
|
var stream = this.font.stream;
|
|
|
|
stream.pos = offset;
|
|
if (stream.pos >= stream.length) {
|
|
return;
|
|
}
|
|
|
|
var tupleCount = stream.readUInt16BE();
|
|
var offsetToData = offset + stream.readUInt16BE();
|
|
|
|
if (tupleCount & TUPLES_SHARE_POINT_NUMBERS) {
|
|
var here = stream.pos;
|
|
stream.pos = offsetToData;
|
|
var sharedPoints = this.decodePoints();
|
|
offsetToData = stream.pos;
|
|
stream.pos = here;
|
|
}
|
|
|
|
var origPoints = glyphPoints.map(function (pt) {
|
|
return pt.copy();
|
|
});
|
|
|
|
tupleCount &= TUPLE_COUNT_MASK;
|
|
for (var i = 0; i < tupleCount; i++) {
|
|
var tupleDataSize = stream.readUInt16BE();
|
|
var tupleIndex = stream.readUInt16BE();
|
|
|
|
if (tupleIndex & EMBEDDED_TUPLE_COORD) {
|
|
var tupleCoords = [];
|
|
for (var a = 0; a < gvar.axisCount; a++) {
|
|
tupleCoords.push(stream.readInt16BE() / 16384);
|
|
}
|
|
} else {
|
|
if ((tupleIndex & TUPLE_INDEX_MASK) >= gvar.globalCoordCount) {
|
|
throw new Error('Invalid gvar table');
|
|
}
|
|
|
|
var tupleCoords = gvar.globalCoords[tupleIndex & TUPLE_INDEX_MASK];
|
|
}
|
|
|
|
if (tupleIndex & INTERMEDIATE_TUPLE) {
|
|
var startCoords = [];
|
|
for (var _a = 0; _a < gvar.axisCount; _a++) {
|
|
startCoords.push(stream.readInt16BE() / 16384);
|
|
}
|
|
|
|
var endCoords = [];
|
|
for (var _a2 = 0; _a2 < gvar.axisCount; _a2++) {
|
|
endCoords.push(stream.readInt16BE() / 16384);
|
|
}
|
|
}
|
|
|
|
// Get the factor at which to apply this tuple
|
|
var factor = this.tupleFactor(tupleIndex, tupleCoords, startCoords, endCoords);
|
|
if (factor === 0) {
|
|
offsetToData += tupleDataSize;
|
|
continue;
|
|
}
|
|
|
|
var here = stream.pos;
|
|
stream.pos = offsetToData;
|
|
|
|
if (tupleIndex & PRIVATE_POINT_NUMBERS) {
|
|
var points = this.decodePoints();
|
|
} else {
|
|
var points = sharedPoints;
|
|
}
|
|
|
|
// points.length = 0 means there are deltas for all points
|
|
var nPoints = points.length === 0 ? glyphPoints.length : points.length;
|
|
var xDeltas = this.decodeDeltas(nPoints);
|
|
var yDeltas = this.decodeDeltas(nPoints);
|
|
|
|
if (points.length === 0) {
|
|
// all points
|
|
for (var _i = 0; _i < glyphPoints.length; _i++) {
|
|
var point = glyphPoints[_i];
|
|
point.x += Math.round(xDeltas[_i] * factor);
|
|
point.y += Math.round(yDeltas[_i] * factor);
|
|
}
|
|
} else {
|
|
var outPoints = origPoints.map(function (pt) {
|
|
return pt.copy();
|
|
});
|
|
var hasDelta = glyphPoints.map(function () {
|
|
return false;
|
|
});
|
|
|
|
for (var _i2 = 0; _i2 < points.length; _i2++) {
|
|
var idx = points[_i2];
|
|
if (idx < glyphPoints.length) {
|
|
var _point = outPoints[idx];
|
|
hasDelta[idx] = true;
|
|
|
|
_point.x += Math.round(xDeltas[_i2] * factor);
|
|
_point.y += Math.round(yDeltas[_i2] * factor);
|
|
}
|
|
}
|
|
|
|
this.interpolateMissingDeltas(outPoints, origPoints, hasDelta);
|
|
|
|
for (var _i3 = 0; _i3 < glyphPoints.length; _i3++) {
|
|
var deltaX = outPoints[_i3].x - origPoints[_i3].x;
|
|
var deltaY = outPoints[_i3].y - origPoints[_i3].y;
|
|
|
|
glyphPoints[_i3].x += deltaX;
|
|
glyphPoints[_i3].y += deltaY;
|
|
}
|
|
}
|
|
|
|
offsetToData += tupleDataSize;
|
|
stream.pos = here;
|
|
}
|
|
}
|
|
}, {
|
|
key: 'decodePoints',
|
|
value: function decodePoints() {
|
|
var stream = this.font.stream;
|
|
var count = stream.readUInt8();
|
|
|
|
if (count & POINTS_ARE_WORDS) {
|
|
count = (count & POINT_RUN_COUNT_MASK) << 8 | stream.readUInt8();
|
|
}
|
|
|
|
var points = new Uint16Array(count);
|
|
var i = 0;
|
|
var point = 0;
|
|
while (i < count) {
|
|
var run = stream.readUInt8();
|
|
var runCount = (run & POINT_RUN_COUNT_MASK) + 1;
|
|
var fn = run & POINTS_ARE_WORDS ? stream.readUInt16 : stream.readUInt8;
|
|
|
|
for (var j = 0; j < runCount && i < count; j++) {
|
|
point += fn.call(stream);
|
|
points[i++] = point;
|
|
}
|
|
}
|
|
|
|
return points;
|
|
}
|
|
}, {
|
|
key: 'decodeDeltas',
|
|
value: function decodeDeltas(count) {
|
|
var stream = this.font.stream;
|
|
var i = 0;
|
|
var deltas = new Int16Array(count);
|
|
|
|
while (i < count) {
|
|
var run = stream.readUInt8();
|
|
var runCount = (run & DELTA_RUN_COUNT_MASK) + 1;
|
|
|
|
if (run & DELTAS_ARE_ZERO) {
|
|
i += runCount;
|
|
} else {
|
|
var fn = run & DELTAS_ARE_WORDS ? stream.readInt16BE : stream.readInt8;
|
|
for (var j = 0; j < runCount && i < count; j++) {
|
|
deltas[i++] = fn.call(stream);
|
|
}
|
|
}
|
|
}
|
|
|
|
return deltas;
|
|
}
|
|
}, {
|
|
key: 'tupleFactor',
|
|
value: function tupleFactor(tupleIndex, tupleCoords, startCoords, endCoords) {
|
|
var normalized = this.normalizedCoords;
|
|
var gvar = this.font.gvar;
|
|
|
|
var factor = 1;
|
|
|
|
for (var i = 0; i < gvar.axisCount; i++) {
|
|
if (tupleCoords[i] === 0) {
|
|
continue;
|
|
}
|
|
|
|
if (normalized[i] === 0) {
|
|
return 0;
|
|
}
|
|
|
|
if ((tupleIndex & INTERMEDIATE_TUPLE) === 0) {
|
|
if (normalized[i] < Math.min(0, tupleCoords[i]) || normalized[i] > Math.max(0, tupleCoords[i])) {
|
|
return 0;
|
|
}
|
|
|
|
factor = factor * normalized[i] / tupleCoords[i];
|
|
} else {
|
|
if (normalized[i] < startCoords[i] || normalized[i] > endCoords[i]) {
|
|
return 0;
|
|
} else if (normalized[i] < tupleCoords[i]) {
|
|
factor = factor * (normalized[i] - startCoords[i]) / (tupleCoords[i] - startCoords[i]);
|
|
} else {
|
|
factor = factor * (endCoords[i] - normalized[i]) / (endCoords[i] - tupleCoords[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
return factor;
|
|
}
|
|
|
|
// Interpolates points without delta values.
|
|
// Needed for the Ø and Q glyphs in Skia.
|
|
// Algorithm from Freetype.
|
|
|
|
}, {
|
|
key: 'interpolateMissingDeltas',
|
|
value: function interpolateMissingDeltas(points, inPoints, hasDelta) {
|
|
if (points.length === 0) {
|
|
return;
|
|
}
|
|
|
|
var point = 0;
|
|
while (point < points.length) {
|
|
var firstPoint = point;
|
|
|
|
// find the end point of the contour
|
|
var endPoint = point;
|
|
var pt = points[endPoint];
|
|
while (!pt.endContour) {
|
|
pt = points[++endPoint];
|
|
}
|
|
|
|
// find the first point that has a delta
|
|
while (point <= endPoint && !hasDelta[point]) {
|
|
point++;
|
|
}
|
|
|
|
if (point > endPoint) {
|
|
continue;
|
|
}
|
|
|
|
var firstDelta = point;
|
|
var curDelta = point;
|
|
point++;
|
|
|
|
while (point <= endPoint) {
|
|
// find the next point with a delta, and interpolate intermediate points
|
|
if (hasDelta[point]) {
|
|
this.deltaInterpolate(curDelta + 1, point - 1, curDelta, point, inPoints, points);
|
|
curDelta = point;
|
|
}
|
|
|
|
point++;
|
|
}
|
|
|
|
// shift contour if we only have a single delta
|
|
if (curDelta === firstDelta) {
|
|
this.deltaShift(firstPoint, endPoint, curDelta, inPoints, points);
|
|
} else {
|
|
// otherwise, handle the remaining points at the end and beginning of the contour
|
|
this.deltaInterpolate(curDelta + 1, endPoint, curDelta, firstDelta, inPoints, points);
|
|
|
|
if (firstDelta > 0) {
|
|
this.deltaInterpolate(firstPoint, firstDelta - 1, curDelta, firstDelta, inPoints, points);
|
|
}
|
|
}
|
|
|
|
point = endPoint + 1;
|
|
}
|
|
}
|
|
}, {
|
|
key: 'deltaInterpolate',
|
|
value: function deltaInterpolate(p1, p2, ref1, ref2, inPoints, outPoints) {
|
|
if (p1 > p2) {
|
|
return;
|
|
}
|
|
|
|
var iterable = ['x', 'y'];
|
|
for (var i = 0; i < iterable.length; i++) {
|
|
var k = iterable[i];
|
|
if (inPoints[ref1][k] > inPoints[ref2][k]) {
|
|
var p = ref1;
|
|
ref1 = ref2;
|
|
ref2 = p;
|
|
}
|
|
|
|
var in1 = inPoints[ref1][k];
|
|
var in2 = inPoints[ref2][k];
|
|
var out1 = outPoints[ref1][k];
|
|
var out2 = outPoints[ref2][k];
|
|
|
|
var scale = in1 === in2 ? 0 : (out2 - out1) / (in2 - in1);
|
|
|
|
for (var _p = p1; _p <= p2; _p++) {
|
|
var out = inPoints[_p][k];
|
|
|
|
if (out <= in1) {
|
|
out += out1 - in1;
|
|
} else if (out >= in2) {
|
|
out += out2 - in2;
|
|
} else {
|
|
out = out1 + (out - in1) * scale;
|
|
}
|
|
|
|
outPoints[_p][k] = out;
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: 'deltaShift',
|
|
value: function deltaShift(p1, p2, ref, inPoints, outPoints) {
|
|
var deltaX = outPoints[ref].x - inPoints[ref].x;
|
|
var deltaY = outPoints[ref].y - inPoints[ref].y;
|
|
|
|
if (deltaX === 0 && deltaY === 0) {
|
|
return;
|
|
}
|
|
|
|
for (var p = p1; p <= p2; p++) {
|
|
if (p !== ref) {
|
|
outPoints[p].x += deltaX;
|
|
outPoints[p].y += deltaY;
|
|
}
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return GlyphVariationProcessor;
|
|
}();
|
|
|
|
var Subset = function () {
|
|
function Subset(font) {
|
|
_classCallCheck(this, Subset);
|
|
|
|
this.font = font;
|
|
this.glyphs = [];
|
|
this.mapping = {};
|
|
|
|
// always include the missing glyph
|
|
this.includeGlyph(0);
|
|
}
|
|
|
|
_createClass(Subset, [{
|
|
key: 'includeGlyph',
|
|
value: function includeGlyph(glyph) {
|
|
if ((typeof glyph === 'undefined' ? 'undefined' : _typeof(glyph)) === 'object') {
|
|
glyph = glyph.id;
|
|
}
|
|
|
|
if (this.mapping[glyph] == null) {
|
|
this.glyphs.push(glyph);
|
|
this.mapping[glyph] = this.glyphs.length - 1;
|
|
}
|
|
|
|
return this.mapping[glyph];
|
|
}
|
|
}, {
|
|
key: 'encodeStream',
|
|
value: function encodeStream() {
|
|
var _this = this;
|
|
|
|
var s = new r.EncodeStream();
|
|
|
|
process.nextTick(function () {
|
|
_this.encode(s);
|
|
return s.end();
|
|
});
|
|
|
|
return s;
|
|
}
|
|
}]);
|
|
|
|
return Subset;
|
|
}();
|
|
|
|
// Flags for simple glyphs
|
|
var ON_CURVE$1 = 1 << 0;
|
|
var X_SHORT_VECTOR$1 = 1 << 1;
|
|
var Y_SHORT_VECTOR$1 = 1 << 2;
|
|
var REPEAT$1 = 1 << 3;
|
|
var SAME_X$1 = 1 << 4;
|
|
var SAME_Y$1 = 1 << 5;
|
|
|
|
var Point$1 = function () {
|
|
function Point() {
|
|
_classCallCheck(this, Point);
|
|
}
|
|
|
|
_createClass(Point, null, [{
|
|
key: 'size',
|
|
value: function size(val) {
|
|
return val >= 0 && val <= 255 ? 1 : 2;
|
|
}
|
|
}, {
|
|
key: 'encode',
|
|
value: function encode(stream, value) {
|
|
if (value >= 0 && value <= 255) {
|
|
stream.writeUInt8(value);
|
|
} else {
|
|
stream.writeInt16BE(value);
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return Point;
|
|
}();
|
|
|
|
var Glyf = new r.Struct({
|
|
numberOfContours: r.int16, // if negative, this is a composite glyph
|
|
xMin: r.int16,
|
|
yMin: r.int16,
|
|
xMax: r.int16,
|
|
yMax: r.int16,
|
|
endPtsOfContours: new r.Array(r.uint16, 'numberOfContours'),
|
|
instructions: new r.Array(r.uint8, r.uint16),
|
|
flags: new r.Array(r.uint8, 0),
|
|
xPoints: new r.Array(Point$1, 0),
|
|
yPoints: new r.Array(Point$1, 0)
|
|
});
|
|
|
|
/**
|
|
* Encodes TrueType glyph outlines
|
|
*/
|
|
|
|
var TTFGlyphEncoder = function () {
|
|
function TTFGlyphEncoder() {
|
|
_classCallCheck(this, TTFGlyphEncoder);
|
|
}
|
|
|
|
_createClass(TTFGlyphEncoder, [{
|
|
key: 'encodeSimple',
|
|
value: function encodeSimple(path) {
|
|
var instructions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
|
|
var endPtsOfContours = [];
|
|
var xPoints = [];
|
|
var yPoints = [];
|
|
var flags = [];
|
|
var same = 0;
|
|
var lastX = 0,
|
|
lastY = 0,
|
|
lastFlag = 0;
|
|
var pointCount = 0;
|
|
|
|
for (var i = 0; i < path.commands.length; i++) {
|
|
var c = path.commands[i];
|
|
|
|
for (var j = 0; j < c.args.length; j += 2) {
|
|
var x = c.args[j];
|
|
var y = c.args[j + 1];
|
|
var flag = 0;
|
|
|
|
// If the ending point of a quadratic curve is the midpoint
|
|
// between the control point and the control point of the next
|
|
// quadratic curve, we can omit the ending point.
|
|
if (c.command === 'quadraticCurveTo' && j === 2) {
|
|
var next = path.commands[i + 1];
|
|
if (next && next.command === 'quadraticCurveTo') {
|
|
var midX = (lastX + next.args[0]) / 2;
|
|
var midY = (lastY + next.args[1]) / 2;
|
|
|
|
if (x === midX && y === midY) {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
|
|
// All points except control points are on curve.
|
|
if (!(c.command === 'quadraticCurveTo' && j === 0)) {
|
|
flag |= ON_CURVE$1;
|
|
}
|
|
|
|
flag = this._encodePoint(x, lastX, xPoints, flag, X_SHORT_VECTOR$1, SAME_X$1);
|
|
flag = this._encodePoint(y, lastY, yPoints, flag, Y_SHORT_VECTOR$1, SAME_Y$1);
|
|
|
|
if (flag === lastFlag && same < 255) {
|
|
flags[flags.length - 1] |= REPEAT$1;
|
|
same++;
|
|
} else {
|
|
if (same > 0) {
|
|
flags.push(same);
|
|
same = 0;
|
|
}
|
|
|
|
flags.push(flag);
|
|
lastFlag = flag;
|
|
}
|
|
|
|
lastX = x;
|
|
lastY = y;
|
|
pointCount++;
|
|
}
|
|
|
|
if (c.command === 'closePath') {
|
|
endPtsOfContours.push(pointCount - 1);
|
|
}
|
|
}
|
|
|
|
// Close the path if the last command didn't already
|
|
if (path.commands.length > 1 && path.commands[path.commands.length - 1].command !== 'closePath') {
|
|
endPtsOfContours.push(pointCount - 1);
|
|
}
|
|
|
|
var bbox = path.bbox;
|
|
var glyf = {
|
|
numberOfContours: endPtsOfContours.length,
|
|
xMin: bbox.minX,
|
|
yMin: bbox.minY,
|
|
xMax: bbox.maxX,
|
|
yMax: bbox.maxY,
|
|
endPtsOfContours: endPtsOfContours,
|
|
instructions: instructions,
|
|
flags: flags,
|
|
xPoints: xPoints,
|
|
yPoints: yPoints
|
|
};
|
|
|
|
var size = Glyf.size(glyf);
|
|
var tail = 4 - size % 4;
|
|
|
|
var stream = new r.EncodeStream(size + tail);
|
|
Glyf.encode(stream, glyf);
|
|
|
|
// Align to 4-byte length
|
|
if (tail !== 0) {
|
|
stream.fill(0, tail);
|
|
}
|
|
|
|
return stream.buffer;
|
|
}
|
|
}, {
|
|
key: '_encodePoint',
|
|
value: function _encodePoint(value, last, points, flag, shortFlag, sameFlag) {
|
|
var diff = value - last;
|
|
|
|
if (value === last) {
|
|
flag |= sameFlag;
|
|
} else {
|
|
if (-255 <= diff && diff <= 255) {
|
|
flag |= shortFlag;
|
|
if (diff < 0) {
|
|
diff = -diff;
|
|
} else {
|
|
flag |= sameFlag;
|
|
}
|
|
}
|
|
|
|
points.push(diff);
|
|
}
|
|
|
|
return flag;
|
|
}
|
|
}]);
|
|
|
|
return TTFGlyphEncoder;
|
|
}();
|
|
|
|
var TTFSubset = function (_Subset) {
|
|
_inherits(TTFSubset, _Subset);
|
|
|
|
function TTFSubset(font) {
|
|
_classCallCheck(this, TTFSubset);
|
|
|
|
var _this = _possibleConstructorReturn(this, (TTFSubset.__proto__ || _Object$getPrototypeOf(TTFSubset)).call(this, font));
|
|
|
|
_this.glyphEncoder = new TTFGlyphEncoder();
|
|
return _this;
|
|
}
|
|
|
|
_createClass(TTFSubset, [{
|
|
key: '_addGlyph',
|
|
value: function _addGlyph(gid) {
|
|
var glyph = this.font.getGlyph(gid);
|
|
var glyf = glyph._decode();
|
|
|
|
// get the offset to the glyph from the loca table
|
|
var curOffset = this.font.loca.offsets[gid];
|
|
var nextOffset = this.font.loca.offsets[gid + 1];
|
|
|
|
var stream = this.font._getTableStream('glyf');
|
|
stream.pos += curOffset;
|
|
|
|
var buffer = stream.readBuffer(nextOffset - curOffset);
|
|
|
|
// if it is a compound glyph, include its components
|
|
if (glyf && glyf.numberOfContours < 0) {
|
|
buffer = new Buffer(buffer);
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(glyf.components), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var component = _step.value;
|
|
|
|
gid = this.includeGlyph(component.glyphID);
|
|
buffer.writeUInt16BE(gid, component.pos);
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
} else if (glyf && this.font._variationProcessor) {
|
|
// If this is a TrueType variation glyph, re-encode the path
|
|
buffer = this.glyphEncoder.encodeSimple(glyph.path, glyf.instructions);
|
|
}
|
|
|
|
this.glyf.push(buffer);
|
|
this.loca.offsets.push(this.offset);
|
|
|
|
this.hmtx.metrics.push({
|
|
advance: glyph.advanceWidth,
|
|
bearing: glyph._getMetrics().leftBearing
|
|
});
|
|
|
|
this.offset += buffer.length;
|
|
return this.glyf.length - 1;
|
|
}
|
|
}, {
|
|
key: 'encode',
|
|
value: function encode(stream) {
|
|
// tables required by PDF spec:
|
|
// head, hhea, loca, maxp, cvt , prep, glyf, hmtx, fpgm
|
|
//
|
|
// additional tables required for standalone fonts:
|
|
// name, cmap, OS/2, post
|
|
|
|
this.glyf = [];
|
|
this.offset = 0;
|
|
this.loca = {
|
|
offsets: []
|
|
};
|
|
|
|
this.hmtx = {
|
|
metrics: [],
|
|
bearings: []
|
|
};
|
|
|
|
// include all the glyphs
|
|
// not using a for loop because we need to support adding more
|
|
// glyphs to the array as we go, and CoffeeScript caches the length.
|
|
var i = 0;
|
|
while (i < this.glyphs.length) {
|
|
this._addGlyph(this.glyphs[i++]);
|
|
}
|
|
|
|
var maxp = cloneDeep(this.font.maxp);
|
|
maxp.numGlyphs = this.glyf.length;
|
|
|
|
this.loca.offsets.push(this.offset);
|
|
tables.loca.preEncode.call(this.loca);
|
|
|
|
var head = cloneDeep(this.font.head);
|
|
head.indexToLocFormat = this.loca.version;
|
|
|
|
var hhea = cloneDeep(this.font.hhea);
|
|
hhea.numberOfMetrics = this.hmtx.metrics.length;
|
|
|
|
// map = []
|
|
// for index in [0...256]
|
|
// if index < @numGlyphs
|
|
// map[index] = index
|
|
// else
|
|
// map[index] = 0
|
|
//
|
|
// cmapTable =
|
|
// version: 0
|
|
// length: 262
|
|
// language: 0
|
|
// codeMap: map
|
|
//
|
|
// cmap =
|
|
// version: 0
|
|
// numSubtables: 1
|
|
// tables: [
|
|
// platformID: 1
|
|
// encodingID: 0
|
|
// table: cmapTable
|
|
// ]
|
|
|
|
// TODO: subset prep, cvt, fpgm?
|
|
Directory.encode(stream, {
|
|
tables: {
|
|
head: head,
|
|
hhea: hhea,
|
|
loca: this.loca,
|
|
maxp: maxp,
|
|
'cvt ': this.font['cvt '],
|
|
prep: this.font.prep,
|
|
glyf: this.glyf,
|
|
hmtx: this.hmtx,
|
|
fpgm: this.font.fpgm
|
|
|
|
// name: clone @font.name
|
|
// 'OS/2': clone @font['OS/2']
|
|
// post: clone @font.post
|
|
// cmap: cmap
|
|
}
|
|
});
|
|
}
|
|
}]);
|
|
|
|
return TTFSubset;
|
|
}(Subset);
|
|
|
|
var CFFSubset = function (_Subset) {
|
|
_inherits(CFFSubset, _Subset);
|
|
|
|
function CFFSubset(font) {
|
|
_classCallCheck(this, CFFSubset);
|
|
|
|
var _this = _possibleConstructorReturn(this, (CFFSubset.__proto__ || _Object$getPrototypeOf(CFFSubset)).call(this, font));
|
|
|
|
_this.cff = _this.font['CFF '];
|
|
if (!_this.cff) {
|
|
throw new Error('Not a CFF Font');
|
|
}
|
|
return _this;
|
|
}
|
|
|
|
_createClass(CFFSubset, [{
|
|
key: 'subsetCharstrings',
|
|
value: function subsetCharstrings() {
|
|
this.charstrings = [];
|
|
var gsubrs = {};
|
|
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.glyphs), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var gid = _step.value;
|
|
|
|
this.charstrings.push(this.cff.getCharString(gid));
|
|
|
|
var glyph = this.font.getGlyph(gid);
|
|
var path = glyph.path; // this causes the glyph to be parsed
|
|
|
|
for (var subr in glyph._usedGsubrs) {
|
|
gsubrs[subr] = true;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
this.gsubrs = this.subsetSubrs(this.cff.globalSubrIndex, gsubrs);
|
|
}
|
|
}, {
|
|
key: 'subsetSubrs',
|
|
value: function subsetSubrs(subrs, used) {
|
|
var res = [];
|
|
for (var i = 0; i < subrs.length; i++) {
|
|
var subr = subrs[i];
|
|
if (used[i]) {
|
|
this.cff.stream.pos = subr.offset;
|
|
res.push(this.cff.stream.readBuffer(subr.length));
|
|
} else {
|
|
res.push(new Buffer([11])); // return
|
|
}
|
|
}
|
|
|
|
return res;
|
|
}
|
|
}, {
|
|
key: 'subsetFontdict',
|
|
value: function subsetFontdict(topDict) {
|
|
topDict.FDArray = [];
|
|
topDict.FDSelect = {
|
|
version: 0,
|
|
fds: []
|
|
};
|
|
|
|
var used_fds = {};
|
|
var used_subrs = [];
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(this.glyphs), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var gid = _step2.value;
|
|
|
|
var fd = this.cff.fdForGlyph(gid);
|
|
if (fd == null) {
|
|
continue;
|
|
}
|
|
|
|
if (!used_fds[fd]) {
|
|
topDict.FDArray.push(_Object$assign({}, this.cff.topDict.FDArray[fd]));
|
|
used_subrs.push({});
|
|
}
|
|
|
|
used_fds[fd] = true;
|
|
topDict.FDSelect.fds.push(topDict.FDArray.length - 1);
|
|
|
|
var glyph = this.font.getGlyph(gid);
|
|
var path = glyph.path; // this causes the glyph to be parsed
|
|
for (var subr in glyph._usedSubrs) {
|
|
used_subrs[used_subrs.length - 1][subr] = true;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
for (var i = 0; i < topDict.FDArray.length; i++) {
|
|
var dict = topDict.FDArray[i];
|
|
delete dict.FontName;
|
|
if (dict.Private && dict.Private.Subrs) {
|
|
dict.Private = _Object$assign({}, dict.Private);
|
|
dict.Private.Subrs = this.subsetSubrs(dict.Private.Subrs, used_subrs[i]);
|
|
}
|
|
}
|
|
|
|
return;
|
|
}
|
|
}, {
|
|
key: 'createCIDFontdict',
|
|
value: function createCIDFontdict(topDict) {
|
|
var used_subrs = {};
|
|
var _iteratorNormalCompletion3 = true;
|
|
var _didIteratorError3 = false;
|
|
var _iteratorError3 = undefined;
|
|
|
|
try {
|
|
for (var _iterator3 = _getIterator(this.glyphs), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
var gid = _step3.value;
|
|
|
|
var glyph = this.font.getGlyph(gid);
|
|
var path = glyph.path; // this causes the glyph to be parsed
|
|
|
|
for (var subr in glyph._usedSubrs) {
|
|
used_subrs[subr] = true;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError3 = true;
|
|
_iteratorError3 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
_iterator3.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError3) {
|
|
throw _iteratorError3;
|
|
}
|
|
}
|
|
}
|
|
|
|
var privateDict = _Object$assign({}, this.cff.topDict.Private);
|
|
privateDict.Subrs = this.subsetSubrs(this.cff.topDict.Private.Subrs, used_subrs);
|
|
|
|
topDict.FDArray = [{ Private: privateDict }];
|
|
return topDict.FDSelect = {
|
|
version: 3,
|
|
nRanges: 1,
|
|
ranges: [{ first: 0, fd: 0 }],
|
|
sentinel: this.charstrings.length
|
|
};
|
|
}
|
|
}, {
|
|
key: 'addString',
|
|
value: function addString(string) {
|
|
if (!string) {
|
|
return null;
|
|
}
|
|
|
|
if (!this.strings) {
|
|
this.strings = [];
|
|
}
|
|
|
|
this.strings.push(string);
|
|
return standardStrings.length + this.strings.length - 1;
|
|
}
|
|
}, {
|
|
key: 'encode',
|
|
value: function encode(stream) {
|
|
this.subsetCharstrings();
|
|
|
|
var charset = {
|
|
version: this.charstrings.length > 255 ? 2 : 1,
|
|
ranges: [{ first: 1, nLeft: this.charstrings.length - 2 }]
|
|
};
|
|
|
|
var topDict = _Object$assign({}, this.cff.topDict);
|
|
topDict.Private = null;
|
|
topDict.charset = charset;
|
|
topDict.Encoding = null;
|
|
topDict.CharStrings = this.charstrings;
|
|
|
|
var _arr = ['version', 'Notice', 'Copyright', 'FullName', 'FamilyName', 'Weight', 'PostScript', 'BaseFontName', 'FontName'];
|
|
for (var _i = 0; _i < _arr.length; _i++) {
|
|
var key = _arr[_i];
|
|
topDict[key] = this.addString(this.cff.string(topDict[key]));
|
|
}
|
|
|
|
topDict.ROS = [this.addString('Adobe'), this.addString('Identity'), 0];
|
|
topDict.CIDCount = this.charstrings.length;
|
|
|
|
if (this.cff.isCIDFont) {
|
|
this.subsetFontdict(topDict);
|
|
} else {
|
|
this.createCIDFontdict(topDict);
|
|
}
|
|
|
|
var top = {
|
|
header: this.cff.header,
|
|
nameIndex: [this.cff.postscriptName],
|
|
topDictIndex: [topDict],
|
|
stringIndex: this.strings,
|
|
globalSubrIndex: this.gsubrs
|
|
};
|
|
|
|
CFFTop.encode(stream, top);
|
|
}
|
|
}]);
|
|
|
|
return CFFSubset;
|
|
}(Subset);
|
|
|
|
var _class;
|
|
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
|
|
var desc = {};
|
|
Object['ke' + 'ys'](descriptor).forEach(function (key) {
|
|
desc[key] = descriptor[key];
|
|
});
|
|
desc.enumerable = !!desc.enumerable;
|
|
desc.configurable = !!desc.configurable;
|
|
|
|
if ('value' in desc || desc.initializer) {
|
|
desc.writable = true;
|
|
}
|
|
|
|
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
|
|
return decorator(target, property, desc) || desc;
|
|
}, desc);
|
|
|
|
if (context && desc.initializer !== void 0) {
|
|
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
|
|
desc.initializer = undefined;
|
|
}
|
|
|
|
if (desc.initializer === void 0) {
|
|
Object['define' + 'Property'](target, property, desc);
|
|
desc = null;
|
|
}
|
|
|
|
return desc;
|
|
}
|
|
|
|
/**
|
|
* This is the base class for all SFNT-based font formats in fontkit.
|
|
* It supports TrueType, and PostScript glyphs, and several color glyph formats.
|
|
*/
|
|
var TTFFont = (_class = function () {
|
|
_createClass(TTFFont, null, [{
|
|
key: 'probe',
|
|
value: function probe(buffer) {
|
|
var format = buffer.toString('ascii', 0, 4);
|
|
return format === 'true' || format === 'OTTO' || format === String.fromCharCode(0, 1, 0, 0);
|
|
}
|
|
}]);
|
|
|
|
function TTFFont(stream) {
|
|
var variationCoords = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
|
|
_classCallCheck(this, TTFFont);
|
|
|
|
this.stream = stream;
|
|
this._directoryPos = this.stream.pos;
|
|
this._tables = {};
|
|
this._glyphs = {};
|
|
this._decodeDirectory();
|
|
|
|
// define properties for each table to lazily parse
|
|
for (var tag in this.directory.tables) {
|
|
var table = this.directory.tables[tag];
|
|
if (tables[tag] && table.length > 0) {
|
|
_Object$defineProperty(this, tag, {
|
|
get: this._getTable.bind(this, table)
|
|
});
|
|
}
|
|
}
|
|
|
|
if (variationCoords) {
|
|
this._variationProcessor = new GlyphVariationProcessor(this, variationCoords);
|
|
}
|
|
}
|
|
|
|
_createClass(TTFFont, [{
|
|
key: '_getTable',
|
|
value: function _getTable(table) {
|
|
if (!(table.tag in this._tables)) {
|
|
try {
|
|
this._tables[table.tag] = this._decodeTable(table);
|
|
} catch (e) {
|
|
if (fontkit.logErrors) {
|
|
console.error('Error decoding table ' + table.tag);
|
|
console.error(e.stack);
|
|
}
|
|
}
|
|
}
|
|
|
|
return this._tables[table.tag];
|
|
}
|
|
}, {
|
|
key: '_getTableStream',
|
|
value: function _getTableStream(tag) {
|
|
var table = this.directory.tables[tag];
|
|
if (table) {
|
|
this.stream.pos = table.offset;
|
|
return this.stream;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}, {
|
|
key: '_decodeDirectory',
|
|
value: function _decodeDirectory() {
|
|
return this.directory = Directory.decode(this.stream, { _startOffset: 0 });
|
|
}
|
|
}, {
|
|
key: '_decodeTable',
|
|
value: function _decodeTable(table) {
|
|
var pos = this.stream.pos;
|
|
|
|
var stream = this._getTableStream(table.tag);
|
|
var result = tables[table.tag].decode(stream, this, table.length);
|
|
|
|
this.stream.pos = pos;
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* The unique PostScript name for this font
|
|
* @type {string}
|
|
*/
|
|
|
|
}, {
|
|
key: 'getName',
|
|
|
|
|
|
/**
|
|
* Gets a string from the font's `name` table
|
|
* `lang` is a BCP-47 language code.
|
|
* @return {string}
|
|
*/
|
|
value: function getName(key) {
|
|
var lang = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en';
|
|
|
|
var record = this.name.records[key];
|
|
if (record) {
|
|
return record[lang];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* The font's full name, e.g. "Helvetica Bold"
|
|
* @type {string}
|
|
*/
|
|
|
|
}, {
|
|
key: 'hasGlyphForCodePoint',
|
|
|
|
|
|
/**
|
|
* Returns whether there is glyph in the font for the given unicode code point.
|
|
*
|
|
* @param {number} codePoint
|
|
* @return {boolean}
|
|
*/
|
|
value: function hasGlyphForCodePoint(codePoint) {
|
|
return !!this._cmapProcessor.lookup(codePoint);
|
|
}
|
|
|
|
/**
|
|
* Maps a single unicode code point to a Glyph object.
|
|
* Does not perform any advanced substitutions (there is no context to do so).
|
|
*
|
|
* @param {number} codePoint
|
|
* @return {Glyph}
|
|
*/
|
|
|
|
}, {
|
|
key: 'glyphForCodePoint',
|
|
value: function glyphForCodePoint(codePoint) {
|
|
return this.getGlyph(this._cmapProcessor.lookup(codePoint), [codePoint]);
|
|
}
|
|
|
|
/**
|
|
* Returns an array of Glyph objects for the given string.
|
|
* This is only a one-to-one mapping from characters to glyphs.
|
|
* For most uses, you should use font.layout (described below), which
|
|
* provides a much more advanced mapping supporting AAT and OpenType shaping.
|
|
*
|
|
* @param {string} string
|
|
* @return {Glyph[]}
|
|
*/
|
|
|
|
}, {
|
|
key: 'glyphsForString',
|
|
value: function glyphsForString(string) {
|
|
var glyphs = [];
|
|
var len = string.length;
|
|
var idx = 0;
|
|
var last = -1;
|
|
var state = -1;
|
|
|
|
while (idx <= len) {
|
|
var code = 0;
|
|
var nextState = 0;
|
|
|
|
if (idx < len) {
|
|
// Decode the next codepoint from UTF 16
|
|
code = string.charCodeAt(idx++);
|
|
if (0xd800 <= code && code <= 0xdbff && idx < len) {
|
|
var next = string.charCodeAt(idx);
|
|
if (0xdc00 <= next && next <= 0xdfff) {
|
|
idx++;
|
|
code = ((code & 0x3ff) << 10) + (next & 0x3ff) + 0x10000;
|
|
}
|
|
}
|
|
|
|
// Compute the next state: 1 if the next codepoint is a variation selector, 0 otherwise.
|
|
nextState = 0xfe00 <= code && code <= 0xfe0f || 0xe0100 <= code && code <= 0xe01ef ? 1 : 0;
|
|
} else {
|
|
idx++;
|
|
}
|
|
|
|
if (state === 0 && nextState === 1) {
|
|
// Variation selector following normal codepoint.
|
|
glyphs.push(this.getGlyph(this._cmapProcessor.lookup(last, code), [last, code]));
|
|
} else if (state === 0 && nextState === 0) {
|
|
// Normal codepoint following normal codepoint.
|
|
glyphs.push(this.glyphForCodePoint(last));
|
|
}
|
|
|
|
last = code;
|
|
state = nextState;
|
|
}
|
|
|
|
return glyphs;
|
|
}
|
|
}, {
|
|
key: 'layout',
|
|
|
|
|
|
/**
|
|
* Returns a GlyphRun object, which includes an array of Glyphs and GlyphPositions for the given string.
|
|
*
|
|
* @param {string} string
|
|
* @param {string[]} [userFeatures]
|
|
* @param {string} [script]
|
|
* @param {string} [language]
|
|
* @return {GlyphRun}
|
|
*/
|
|
value: function layout(string, userFeatures, script, language) {
|
|
return this._layoutEngine.layout(string, userFeatures, script, language);
|
|
}
|
|
|
|
/**
|
|
* Returns an array of strings that map to the given glyph id.
|
|
* @param {number} gid - glyph id
|
|
*/
|
|
|
|
}, {
|
|
key: 'stringsForGlyph',
|
|
value: function stringsForGlyph(gid) {
|
|
return this._layoutEngine.stringsForGlyph(gid);
|
|
}
|
|
|
|
/**
|
|
* An array of all [OpenType feature tags](https://www.microsoft.com/typography/otspec/featuretags.htm)
|
|
* (or mapped AAT tags) supported by the font.
|
|
* The features parameter is an array of OpenType feature tags to be applied in addition to the default set.
|
|
* If this is an AAT font, the OpenType feature tags are mapped to AAT features.
|
|
*
|
|
* @type {string[]}
|
|
*/
|
|
|
|
}, {
|
|
key: '_getBaseGlyph',
|
|
value: function _getBaseGlyph(glyph) {
|
|
var characters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
|
|
if (!this._glyphs[glyph]) {
|
|
if (this.directory.tables.glyf) {
|
|
this._glyphs[glyph] = new TTFGlyph(glyph, characters, this);
|
|
} else if (this.directory.tables['CFF ']) {
|
|
this._glyphs[glyph] = new CFFGlyph(glyph, characters, this);
|
|
}
|
|
}
|
|
|
|
return this._glyphs[glyph] || null;
|
|
}
|
|
|
|
/**
|
|
* Returns a glyph object for the given glyph id.
|
|
* You can pass the array of code points this glyph represents for
|
|
* your use later, and it will be stored in the glyph object.
|
|
*
|
|
* @param {number} glyph
|
|
* @param {number[]} characters
|
|
* @return {Glyph}
|
|
*/
|
|
|
|
}, {
|
|
key: 'getGlyph',
|
|
value: function getGlyph(glyph) {
|
|
var characters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
|
|
if (!this._glyphs[glyph]) {
|
|
if (this.directory.tables.sbix) {
|
|
this._glyphs[glyph] = new SBIXGlyph(glyph, characters, this);
|
|
} else if (this.directory.tables.COLR && this.directory.tables.CPAL) {
|
|
this._glyphs[glyph] = new COLRGlyph(glyph, characters, this);
|
|
} else {
|
|
this._getBaseGlyph(glyph, characters);
|
|
}
|
|
}
|
|
|
|
return this._glyphs[glyph] || null;
|
|
}
|
|
|
|
/**
|
|
* Returns a Subset for this font.
|
|
* @return {Subset}
|
|
*/
|
|
|
|
}, {
|
|
key: 'createSubset',
|
|
value: function createSubset() {
|
|
if (this.directory.tables['CFF ']) {
|
|
return new CFFSubset(this);
|
|
}
|
|
|
|
return new TTFSubset(this);
|
|
}
|
|
|
|
/**
|
|
* Returns an object describing the available variation axes
|
|
* that this font supports. Keys are setting tags, and values
|
|
* contain the axis name, range, and default value.
|
|
*
|
|
* @type {object}
|
|
*/
|
|
|
|
}, {
|
|
key: 'getVariation',
|
|
|
|
|
|
/**
|
|
* Returns a new font with the given variation settings applied.
|
|
* Settings can either be an instance name, or an object containing
|
|
* variation tags as specified by the `variationAxes` property.
|
|
*
|
|
* @param {object} settings
|
|
* @return {TTFFont}
|
|
*/
|
|
value: function getVariation(settings) {
|
|
if (!this.directory.tables.fvar || !this.directory.tables.gvar || !this.directory.tables.glyf) {
|
|
throw new Error('Variations require a font with the fvar, gvar, and glyf tables.');
|
|
}
|
|
|
|
if (typeof settings === 'string') {
|
|
settings = this.namedVariations[settings];
|
|
}
|
|
|
|
if ((typeof settings === 'undefined' ? 'undefined' : _typeof(settings)) !== 'object') {
|
|
throw new Error('Variation settings must be either a variation name or settings object.');
|
|
}
|
|
|
|
// normalize the coordinates
|
|
var coords = this.fvar.axis.map(function (axis, i) {
|
|
var axisTag = axis.axisTag.trim();
|
|
if (axisTag in settings) {
|
|
return Math.max(axis.minValue, Math.min(axis.maxValue, settings[axisTag]));
|
|
} else {
|
|
return axis.defaultValue;
|
|
}
|
|
});
|
|
|
|
var stream = new r.DecodeStream(this.stream.buffer);
|
|
stream.pos = this._directoryPos;
|
|
|
|
var font = new TTFFont(stream, coords);
|
|
font._tables = this._tables;
|
|
|
|
return font;
|
|
}
|
|
|
|
// Standardized format plugin API
|
|
|
|
}, {
|
|
key: 'getFont',
|
|
value: function getFont(name) {
|
|
return this.getVariation(name);
|
|
}
|
|
}, {
|
|
key: 'postscriptName',
|
|
get: function get() {
|
|
var name = this.name.records.postscriptName;
|
|
var lang = _Object$keys(name)[0];
|
|
return name[lang];
|
|
}
|
|
}, {
|
|
key: 'fullName',
|
|
get: function get() {
|
|
return this.getName('fullName');
|
|
}
|
|
|
|
/**
|
|
* The font's family name, e.g. "Helvetica"
|
|
* @type {string}
|
|
*/
|
|
|
|
}, {
|
|
key: 'familyName',
|
|
get: function get() {
|
|
return this.getName('fontFamily');
|
|
}
|
|
|
|
/**
|
|
* The font's sub-family, e.g. "Bold".
|
|
* @type {string}
|
|
*/
|
|
|
|
}, {
|
|
key: 'subfamilyName',
|
|
get: function get() {
|
|
return this.getName('fontSubfamily');
|
|
}
|
|
|
|
/**
|
|
* The font's copyright information
|
|
* @type {string}
|
|
*/
|
|
|
|
}, {
|
|
key: 'copyright',
|
|
get: function get() {
|
|
return this.getName('copyright');
|
|
}
|
|
|
|
/**
|
|
* The font's version number
|
|
* @type {string}
|
|
*/
|
|
|
|
}, {
|
|
key: 'version',
|
|
get: function get() {
|
|
return this.getName('version');
|
|
}
|
|
|
|
/**
|
|
* The font’s [ascender](https://en.wikipedia.org/wiki/Ascender_(typography))
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'ascent',
|
|
get: function get() {
|
|
return this.hhea.ascent;
|
|
}
|
|
|
|
/**
|
|
* The font’s [descender](https://en.wikipedia.org/wiki/Descender)
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'descent',
|
|
get: function get() {
|
|
return this.hhea.descent;
|
|
}
|
|
|
|
/**
|
|
* The amount of space that should be included between lines
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'lineGap',
|
|
get: function get() {
|
|
return this.hhea.lineGap;
|
|
}
|
|
|
|
/**
|
|
* The offset from the normal underline position that should be used
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'underlinePosition',
|
|
get: function get() {
|
|
return this.post.underlinePosition;
|
|
}
|
|
|
|
/**
|
|
* The weight of the underline that should be used
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'underlineThickness',
|
|
get: function get() {
|
|
return this.post.underlineThickness;
|
|
}
|
|
|
|
/**
|
|
* If this is an italic font, the angle the cursor should be drawn at to match the font design
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'italicAngle',
|
|
get: function get() {
|
|
return this.post.italicAngle;
|
|
}
|
|
|
|
/**
|
|
* The height of capital letters above the baseline.
|
|
* See [here](https://en.wikipedia.org/wiki/Cap_height) for more details.
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'capHeight',
|
|
get: function get() {
|
|
var os2 = this['OS/2'];
|
|
return os2 ? os2.capHeight : this.ascent;
|
|
}
|
|
|
|
/**
|
|
* The height of lower case letters in the font.
|
|
* See [here](https://en.wikipedia.org/wiki/X-height) for more details.
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'xHeight',
|
|
get: function get() {
|
|
var os2 = this['OS/2'];
|
|
return os2 ? os2.xHeight : 0;
|
|
}
|
|
|
|
/**
|
|
* The number of glyphs in the font.
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'numGlyphs',
|
|
get: function get() {
|
|
return this.maxp.numGlyphs;
|
|
}
|
|
|
|
/**
|
|
* The size of the font’s internal coordinate grid
|
|
* @type {number}
|
|
*/
|
|
|
|
}, {
|
|
key: 'unitsPerEm',
|
|
get: function get() {
|
|
return this.head.unitsPerEm;
|
|
}
|
|
|
|
/**
|
|
* The font’s bounding box, i.e. the box that encloses all glyphs in the font.
|
|
* @type {BBox}
|
|
*/
|
|
|
|
}, {
|
|
key: 'bbox',
|
|
get: function get() {
|
|
return _Object$freeze(new BBox(this.head.xMin, this.head.yMin, this.head.xMax, this.head.yMax));
|
|
}
|
|
}, {
|
|
key: '_cmapProcessor',
|
|
get: function get() {
|
|
return new CmapProcessor(this.cmap);
|
|
}
|
|
|
|
/**
|
|
* An array of all of the unicode code points supported by the font.
|
|
* @type {number[]}
|
|
*/
|
|
|
|
}, {
|
|
key: 'characterSet',
|
|
get: function get() {
|
|
return this._cmapProcessor.getCharacterSet();
|
|
}
|
|
}, {
|
|
key: '_layoutEngine',
|
|
get: function get() {
|
|
return new LayoutEngine(this);
|
|
}
|
|
}, {
|
|
key: 'availableFeatures',
|
|
get: function get() {
|
|
return this._layoutEngine.getAvailableFeatures();
|
|
}
|
|
}, {
|
|
key: 'variationAxes',
|
|
get: function get() {
|
|
var res = {};
|
|
if (!this.fvar) {
|
|
return res;
|
|
}
|
|
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.fvar.axis), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var axis = _step.value;
|
|
|
|
res[axis.axisTag.trim()] = {
|
|
name: axis.name.en,
|
|
min: axis.minValue,
|
|
default: axis.defaultValue,
|
|
max: axis.maxValue
|
|
};
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
return res;
|
|
}
|
|
|
|
/**
|
|
* Returns an object describing the named variation instances
|
|
* that the font designer has specified. Keys are variation names
|
|
* and values are the variation settings for this instance.
|
|
*
|
|
* @type {object}
|
|
*/
|
|
|
|
}, {
|
|
key: 'namedVariations',
|
|
get: function get() {
|
|
var res = {};
|
|
if (!this.fvar) {
|
|
return res;
|
|
}
|
|
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(this.fvar.instance), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var instance = _step2.value;
|
|
|
|
var settings = {};
|
|
for (var i = 0; i < this.fvar.axis.length; i++) {
|
|
var axis = this.fvar.axis[i];
|
|
settings[axis.axisTag.trim()] = instance.coord[i];
|
|
}
|
|
|
|
res[instance.name.en] = settings;
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
return res;
|
|
}
|
|
}]);
|
|
|
|
return TTFFont;
|
|
}(), (_applyDecoratedDescriptor(_class.prototype, 'bbox', [cache], _Object$getOwnPropertyDescriptor(_class.prototype, 'bbox'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, '_cmapProcessor', [cache], _Object$getOwnPropertyDescriptor(_class.prototype, '_cmapProcessor'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'characterSet', [cache], _Object$getOwnPropertyDescriptor(_class.prototype, 'characterSet'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, '_layoutEngine', [cache], _Object$getOwnPropertyDescriptor(_class.prototype, '_layoutEngine'), _class.prototype)), _class);
|
|
|
|
var WOFFDirectoryEntry = new r.Struct({
|
|
tag: new r.String(4),
|
|
offset: new r.Pointer(r.uint32, 'void', { type: 'global' }),
|
|
compLength: r.uint32,
|
|
length: r.uint32,
|
|
origChecksum: r.uint32
|
|
});
|
|
|
|
var WOFFDirectory = new r.Struct({
|
|
tag: new r.String(4), // should be 'wOFF'
|
|
flavor: r.uint32,
|
|
length: r.uint32,
|
|
numTables: r.uint16,
|
|
reserved: new r.Reserved(r.uint16),
|
|
totalSfntSize: r.uint32,
|
|
majorVersion: r.uint16,
|
|
minorVersion: r.uint16,
|
|
metaOffset: r.uint32,
|
|
metaLength: r.uint32,
|
|
metaOrigLength: r.uint32,
|
|
privOffset: r.uint32,
|
|
privLength: r.uint32,
|
|
tables: new r.Array(WOFFDirectoryEntry, 'numTables')
|
|
});
|
|
|
|
WOFFDirectory.process = function () {
|
|
var tables = {};
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.tables), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var table = _step.value;
|
|
|
|
tables[table.tag] = table;
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
this.tables = tables;
|
|
};
|
|
|
|
var WOFFFont = function (_TTFFont) {
|
|
_inherits(WOFFFont, _TTFFont);
|
|
|
|
function WOFFFont() {
|
|
_classCallCheck(this, WOFFFont);
|
|
|
|
return _possibleConstructorReturn(this, (WOFFFont.__proto__ || _Object$getPrototypeOf(WOFFFont)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(WOFFFont, [{
|
|
key: '_decodeDirectory',
|
|
value: function _decodeDirectory() {
|
|
this.directory = WOFFDirectory.decode(this.stream, { _startOffset: 0 });
|
|
}
|
|
}, {
|
|
key: '_getTableStream',
|
|
value: function _getTableStream(tag) {
|
|
var table = this.directory.tables[tag];
|
|
if (table) {
|
|
this.stream.pos = table.offset;
|
|
|
|
if (table.compLength < table.length) {
|
|
this.stream.pos += 2; // skip deflate header
|
|
var outBuffer = new Buffer(table.length);
|
|
var buf = inflate(this.stream.readBuffer(table.compLength - 2), outBuffer);
|
|
return new r.DecodeStream(buf);
|
|
} else {
|
|
return this.stream;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}], [{
|
|
key: 'probe',
|
|
value: function probe(buffer) {
|
|
return buffer.toString('ascii', 0, 4) === 'wOFF';
|
|
}
|
|
}]);
|
|
|
|
return WOFFFont;
|
|
}(TTFFont);
|
|
|
|
/**
|
|
* Represents a TrueType glyph in the WOFF2 format, which compresses glyphs differently.
|
|
*/
|
|
|
|
var WOFF2Glyph = function (_TTFGlyph) {
|
|
_inherits(WOFF2Glyph, _TTFGlyph);
|
|
|
|
function WOFF2Glyph() {
|
|
_classCallCheck(this, WOFF2Glyph);
|
|
|
|
return _possibleConstructorReturn(this, (WOFF2Glyph.__proto__ || _Object$getPrototypeOf(WOFF2Glyph)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(WOFF2Glyph, [{
|
|
key: '_decode',
|
|
value: function _decode() {
|
|
// We have to decode in advance (in WOFF2Font), so just return the pre-decoded data.
|
|
return this._font._transformedGlyphs[this.id];
|
|
}
|
|
}, {
|
|
key: '_getCBox',
|
|
value: function _getCBox() {
|
|
return this.path.bbox;
|
|
}
|
|
}]);
|
|
|
|
return WOFF2Glyph;
|
|
}(TTFGlyph);
|
|
|
|
var Base128 = {
|
|
decode: function decode(stream) {
|
|
var result = 0;
|
|
var iterable = [0, 1, 2, 3, 4];
|
|
for (var j = 0; j < iterable.length; j++) {
|
|
var i = iterable[j];
|
|
var code = stream.readUInt8();
|
|
|
|
// If any of the top seven bits are set then we're about to overflow.
|
|
if (result & 0xe0000000) {
|
|
throw new Error('Overflow');
|
|
}
|
|
|
|
result = result << 7 | code & 0x7f;
|
|
if ((code & 0x80) === 0) {
|
|
return result;
|
|
}
|
|
}
|
|
|
|
throw new Error('Bad base 128 number');
|
|
}
|
|
};
|
|
|
|
var knownTags = ['cmap', 'head', 'hhea', 'hmtx', 'maxp', 'name', 'OS/2', 'post', 'cvt ', 'fpgm', 'glyf', 'loca', 'prep', 'CFF ', 'VORG', 'EBDT', 'EBLC', 'gasp', 'hdmx', 'kern', 'LTSH', 'PCLT', 'VDMX', 'vhea', 'vmtx', 'BASE', 'GDEF', 'GPOS', 'GSUB', 'EBSC', 'JSTF', 'MATH', 'CBDT', 'CBLC', 'COLR', 'CPAL', 'SVG ', 'sbix', 'acnt', 'avar', 'bdat', 'bloc', 'bsln', 'cvar', 'fdsc', 'feat', 'fmtx', 'fvar', 'gvar', 'hsty', 'just', 'lcar', 'mort', 'morx', 'opbd', 'prop', 'trak', 'Zapf', 'Silf', 'Glat', 'Gloc', 'Feat', 'Sill'];
|
|
|
|
var WOFF2DirectoryEntry = new r.Struct({
|
|
flags: r.uint8,
|
|
customTag: new r.Optional(new r.String(4), function (t) {
|
|
return (t.flags & 0x3f) === 0x3f;
|
|
}),
|
|
tag: function tag(t) {
|
|
return t.customTag || knownTags[t.flags & 0x3f];
|
|
}, // || (() => { throw new Error(`Bad tag: ${flags & 0x3f}`); })(); },
|
|
length: Base128,
|
|
transformVersion: function transformVersion(t) {
|
|
return t.flags >>> 6 & 0x03;
|
|
},
|
|
transformed: function transformed(t) {
|
|
return t.tag === 'glyf' || t.tag === 'loca' ? t.transformVersion === 0 : t.transformVersion !== 0;
|
|
},
|
|
transformLength: new r.Optional(Base128, function (t) {
|
|
return t.transformed;
|
|
})
|
|
});
|
|
|
|
var WOFF2Directory = new r.Struct({
|
|
tag: new r.String(4), // should be 'wOF2'
|
|
flavor: r.uint32,
|
|
length: r.uint32,
|
|
numTables: r.uint16,
|
|
reserved: new r.Reserved(r.uint16),
|
|
totalSfntSize: r.uint32,
|
|
totalCompressedSize: r.uint32,
|
|
majorVersion: r.uint16,
|
|
minorVersion: r.uint16,
|
|
metaOffset: r.uint32,
|
|
metaLength: r.uint32,
|
|
metaOrigLength: r.uint32,
|
|
privOffset: r.uint32,
|
|
privLength: r.uint32,
|
|
tables: new r.Array(WOFF2DirectoryEntry, 'numTables')
|
|
});
|
|
|
|
WOFF2Directory.process = function () {
|
|
var tables = {};
|
|
for (var i = 0; i < this.tables.length; i++) {
|
|
var table = this.tables[i];
|
|
tables[table.tag] = table;
|
|
}
|
|
|
|
return this.tables = tables;
|
|
};
|
|
|
|
/**
|
|
* Subclass of TTFFont that represents a TTF/OTF font compressed by WOFF2
|
|
* See spec here: http://www.w3.org/TR/WOFF2/
|
|
*/
|
|
|
|
var WOFF2Font = function (_TTFFont) {
|
|
_inherits(WOFF2Font, _TTFFont);
|
|
|
|
function WOFF2Font() {
|
|
_classCallCheck(this, WOFF2Font);
|
|
|
|
return _possibleConstructorReturn(this, (WOFF2Font.__proto__ || _Object$getPrototypeOf(WOFF2Font)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(WOFF2Font, [{
|
|
key: '_decodeDirectory',
|
|
value: function _decodeDirectory() {
|
|
this.directory = WOFF2Directory.decode(this.stream);
|
|
this._dataPos = this.stream.pos;
|
|
}
|
|
}, {
|
|
key: '_decompress',
|
|
value: function _decompress() {
|
|
// decompress data and setup table offsets if we haven't already
|
|
if (!this._decompressed) {
|
|
this.stream.pos = this._dataPos;
|
|
var buffer = this.stream.readBuffer(this.directory.totalCompressedSize);
|
|
|
|
var decompressedSize = 0;
|
|
for (var tag in this.directory.tables) {
|
|
var entry = this.directory.tables[tag];
|
|
entry.offset = decompressedSize;
|
|
decompressedSize += entry.transformLength != null ? entry.transformLength : entry.length;
|
|
}
|
|
|
|
var decompressed = brotli(buffer, decompressedSize);
|
|
if (!decompressed) {
|
|
throw new Error('Error decoding compressed data in WOFF2');
|
|
}
|
|
|
|
this.stream = new r.DecodeStream(new Buffer(decompressed));
|
|
this._decompressed = true;
|
|
}
|
|
}
|
|
}, {
|
|
key: '_decodeTable',
|
|
value: function _decodeTable(table) {
|
|
this._decompress();
|
|
return _get(WOFF2Font.prototype.__proto__ || _Object$getPrototypeOf(WOFF2Font.prototype), '_decodeTable', this).call(this, table);
|
|
}
|
|
|
|
// Override this method to get a glyph and return our
|
|
// custom subclass if there is a glyf table.
|
|
|
|
}, {
|
|
key: '_getBaseGlyph',
|
|
value: function _getBaseGlyph(glyph) {
|
|
var characters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
|
|
if (!this._glyphs[glyph]) {
|
|
if (this.directory.tables.glyf && this.directory.tables.glyf.transformed) {
|
|
if (!this._transformedGlyphs) {
|
|
this._transformGlyfTable();
|
|
}
|
|
return this._glyphs[glyph] = new WOFF2Glyph(glyph, characters, this);
|
|
} else {
|
|
return _get(WOFF2Font.prototype.__proto__ || _Object$getPrototypeOf(WOFF2Font.prototype), '_getBaseGlyph', this).call(this, glyph, characters);
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: '_transformGlyfTable',
|
|
value: function _transformGlyfTable() {
|
|
this._decompress();
|
|
this.stream.pos = this.directory.tables.glyf.offset;
|
|
var table = GlyfTable.decode(this.stream);
|
|
var glyphs = [];
|
|
|
|
for (var index = 0; index < table.numGlyphs; index++) {
|
|
var glyph = {};
|
|
var nContours = table.nContours.readInt16BE();
|
|
glyph.numberOfContours = nContours;
|
|
|
|
if (nContours > 0) {
|
|
// simple glyph
|
|
var nPoints = [];
|
|
var totalPoints = 0;
|
|
|
|
for (var i = 0; i < nContours; i++) {
|
|
var _r = read255UInt16(table.nPoints);
|
|
nPoints.push(_r);
|
|
totalPoints += _r;
|
|
}
|
|
|
|
glyph.points = decodeTriplet(table.flags, table.glyphs, totalPoints);
|
|
for (var _i = 0; _i < nContours; _i++) {
|
|
glyph.points[nPoints[_i] - 1].endContour = true;
|
|
}
|
|
|
|
var instructionSize = read255UInt16(table.glyphs);
|
|
} else if (nContours < 0) {
|
|
// composite glyph
|
|
var haveInstructions = TTFGlyph.prototype._decodeComposite.call({ _font: this }, glyph, table.composites);
|
|
if (haveInstructions) {
|
|
var instructionSize = read255UInt16(table.glyphs);
|
|
}
|
|
}
|
|
|
|
glyphs.push(glyph);
|
|
}
|
|
|
|
this._transformedGlyphs = glyphs;
|
|
}
|
|
}], [{
|
|
key: 'probe',
|
|
value: function probe(buffer) {
|
|
return buffer.toString('ascii', 0, 4) === 'wOF2';
|
|
}
|
|
}]);
|
|
|
|
return WOFF2Font;
|
|
}(TTFFont);
|
|
|
|
var Substream = function () {
|
|
function Substream(length) {
|
|
_classCallCheck(this, Substream);
|
|
|
|
this.length = length;
|
|
this._buf = new r.Buffer(length);
|
|
}
|
|
|
|
_createClass(Substream, [{
|
|
key: 'decode',
|
|
value: function decode(stream, parent) {
|
|
return new r.DecodeStream(this._buf.decode(stream, parent));
|
|
}
|
|
}]);
|
|
|
|
return Substream;
|
|
}();
|
|
|
|
// This struct represents the entire glyf table
|
|
|
|
|
|
var GlyfTable = new r.Struct({
|
|
version: r.uint32,
|
|
numGlyphs: r.uint16,
|
|
indexFormat: r.uint16,
|
|
nContourStreamSize: r.uint32,
|
|
nPointsStreamSize: r.uint32,
|
|
flagStreamSize: r.uint32,
|
|
glyphStreamSize: r.uint32,
|
|
compositeStreamSize: r.uint32,
|
|
bboxStreamSize: r.uint32,
|
|
instructionStreamSize: r.uint32,
|
|
nContours: new Substream('nContourStreamSize'),
|
|
nPoints: new Substream('nPointsStreamSize'),
|
|
flags: new Substream('flagStreamSize'),
|
|
glyphs: new Substream('glyphStreamSize'),
|
|
composites: new Substream('compositeStreamSize'),
|
|
bboxes: new Substream('bboxStreamSize'),
|
|
instructions: new Substream('instructionStreamSize')
|
|
});
|
|
|
|
var WORD_CODE = 253;
|
|
var ONE_MORE_BYTE_CODE2 = 254;
|
|
var ONE_MORE_BYTE_CODE1 = 255;
|
|
var LOWEST_U_CODE = 253;
|
|
|
|
function read255UInt16(stream) {
|
|
var code = stream.readUInt8();
|
|
|
|
if (code === WORD_CODE) {
|
|
return stream.readUInt16BE();
|
|
}
|
|
|
|
if (code === ONE_MORE_BYTE_CODE1) {
|
|
return stream.readUInt8() + LOWEST_U_CODE;
|
|
}
|
|
|
|
if (code === ONE_MORE_BYTE_CODE2) {
|
|
return stream.readUInt8() + LOWEST_U_CODE * 2;
|
|
}
|
|
|
|
return code;
|
|
}
|
|
|
|
function withSign(flag, baseval) {
|
|
return flag & 1 ? baseval : -baseval;
|
|
}
|
|
|
|
function decodeTriplet(flags, glyphs, nPoints) {
|
|
var y = void 0;
|
|
var x = y = 0;
|
|
var res = [];
|
|
|
|
for (var i = 0; i < nPoints; i++) {
|
|
var dx = 0,
|
|
dy = 0;
|
|
var flag = flags.readUInt8();
|
|
var onCurve = !(flag >> 7);
|
|
flag &= 0x7f;
|
|
|
|
if (flag < 10) {
|
|
dx = 0;
|
|
dy = withSign(flag, ((flag & 14) << 7) + glyphs.readUInt8());
|
|
} else if (flag < 20) {
|
|
dx = withSign(flag, ((flag - 10 & 14) << 7) + glyphs.readUInt8());
|
|
dy = 0;
|
|
} else if (flag < 84) {
|
|
var b0 = flag - 20;
|
|
var b1 = glyphs.readUInt8();
|
|
dx = withSign(flag, 1 + (b0 & 0x30) + (b1 >> 4));
|
|
dy = withSign(flag >> 1, 1 + ((b0 & 0x0c) << 2) + (b1 & 0x0f));
|
|
} else if (flag < 120) {
|
|
var b0 = flag - 84;
|
|
dx = withSign(flag, 1 + (b0 / 12 << 8) + glyphs.readUInt8());
|
|
dy = withSign(flag >> 1, 1 + (b0 % 12 >> 2 << 8) + glyphs.readUInt8());
|
|
} else if (flag < 124) {
|
|
var b1 = glyphs.readUInt8();
|
|
var b2 = glyphs.readUInt8();
|
|
dx = withSign(flag, (b1 << 4) + (b2 >> 4));
|
|
dy = withSign(flag >> 1, ((b2 & 0x0f) << 8) + glyphs.readUInt8());
|
|
} else {
|
|
dx = withSign(flag, glyphs.readUInt16BE());
|
|
dy = withSign(flag >> 1, glyphs.readUInt16BE());
|
|
}
|
|
|
|
x += dx;
|
|
y += dy;
|
|
res.push(new Point(onCurve, false, x, y));
|
|
}
|
|
|
|
return res;
|
|
}
|
|
|
|
var TTCHeader = new r.VersionedStruct(r.uint32, {
|
|
0x00010000: {
|
|
numFonts: r.uint32,
|
|
offsets: new r.Array(r.uint32, 'numFonts')
|
|
},
|
|
0x00020000: {
|
|
numFonts: r.uint32,
|
|
offsets: new r.Array(r.uint32, 'numFonts'),
|
|
dsigTag: r.uint32,
|
|
dsigLength: r.uint32,
|
|
dsigOffset: r.uint32
|
|
}
|
|
});
|
|
|
|
var TrueTypeCollection = function () {
|
|
_createClass(TrueTypeCollection, null, [{
|
|
key: 'probe',
|
|
value: function probe(buffer) {
|
|
return buffer.toString('ascii', 0, 4) === 'ttcf';
|
|
}
|
|
}]);
|
|
|
|
function TrueTypeCollection(stream) {
|
|
_classCallCheck(this, TrueTypeCollection);
|
|
|
|
this.stream = stream;
|
|
if (stream.readString(4) !== 'ttcf') {
|
|
throw new Error('Not a TrueType collection');
|
|
}
|
|
|
|
this.header = TTCHeader.decode(stream);
|
|
}
|
|
|
|
_createClass(TrueTypeCollection, [{
|
|
key: 'getFont',
|
|
value: function getFont(name) {
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.header.offsets), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var offset = _step.value;
|
|
|
|
var stream = new r.DecodeStream(this.stream.buffer);
|
|
stream.pos = offset;
|
|
var font = new TTFFont(stream);
|
|
if (font.postscriptName === name) {
|
|
return font;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}, {
|
|
key: 'fonts',
|
|
get: function get() {
|
|
var fonts = [];
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(this.header.offsets), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var offset = _step2.value;
|
|
|
|
var stream = new r.DecodeStream(this.stream.buffer);
|
|
stream.pos = offset;
|
|
fonts.push(new TTFFont(stream));
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
|
|
return fonts;
|
|
}
|
|
}]);
|
|
|
|
return TrueTypeCollection;
|
|
}();
|
|
|
|
var DFontName = new r.String(r.uint8);
|
|
var DFontData = new r.Struct({
|
|
len: r.uint32,
|
|
buf: new r.Buffer('len')
|
|
});
|
|
|
|
var Ref = new r.Struct({
|
|
id: r.uint16,
|
|
nameOffset: r.int16,
|
|
attr: r.uint8,
|
|
dataOffset: r.uint24,
|
|
handle: r.uint32
|
|
});
|
|
|
|
var Type = new r.Struct({
|
|
name: new r.String(4),
|
|
maxTypeIndex: r.uint16,
|
|
refList: new r.Pointer(r.uint16, new r.Array(Ref, function (t) {
|
|
return t.maxTypeIndex + 1;
|
|
}), { type: 'parent' })
|
|
});
|
|
|
|
var TypeList = new r.Struct({
|
|
length: r.uint16,
|
|
types: new r.Array(Type, function (t) {
|
|
return t.length + 1;
|
|
})
|
|
});
|
|
|
|
var DFontMap = new r.Struct({
|
|
reserved: new r.Reserved(r.uint8, 24),
|
|
typeList: new r.Pointer(r.uint16, TypeList),
|
|
nameListOffset: new r.Pointer(r.uint16, 'void')
|
|
});
|
|
|
|
var DFontHeader = new r.Struct({
|
|
dataOffset: r.uint32,
|
|
map: new r.Pointer(r.uint32, DFontMap),
|
|
dataLength: r.uint32,
|
|
mapLength: r.uint32
|
|
});
|
|
|
|
var DFont = function () {
|
|
_createClass(DFont, null, [{
|
|
key: 'probe',
|
|
value: function probe(buffer) {
|
|
var stream = new r.DecodeStream(buffer);
|
|
|
|
try {
|
|
var header = DFontHeader.decode(stream);
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(header.map.typeList.types), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var type = _step.value;
|
|
|
|
if (type.name === 'sfnt') {
|
|
return true;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}]);
|
|
|
|
function DFont(stream) {
|
|
_classCallCheck(this, DFont);
|
|
|
|
this.stream = stream;
|
|
this.header = DFontHeader.decode(this.stream);
|
|
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(this.header.map.typeList.types), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var type = _step2.value;
|
|
var _iteratorNormalCompletion3 = true;
|
|
var _didIteratorError3 = false;
|
|
var _iteratorError3 = undefined;
|
|
|
|
try {
|
|
for (var _iterator3 = _getIterator(type.refList), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
var ref = _step3.value;
|
|
|
|
if (ref.nameOffset >= 0) {
|
|
this.stream.pos = ref.nameOffset + this.header.map.nameListOffset;
|
|
ref.name = DFontName.decode(this.stream);
|
|
} else {
|
|
ref.name = null;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError3 = true;
|
|
_iteratorError3 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
_iterator3.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError3) {
|
|
throw _iteratorError3;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (type.name === 'sfnt') {
|
|
this.sfnt = type;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
_createClass(DFont, [{
|
|
key: 'getFont',
|
|
value: function getFont(name) {
|
|
if (!this.sfnt) {
|
|
return null;
|
|
}
|
|
|
|
var _iteratorNormalCompletion4 = true;
|
|
var _didIteratorError4 = false;
|
|
var _iteratorError4 = undefined;
|
|
|
|
try {
|
|
for (var _iterator4 = _getIterator(this.sfnt.refList), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
var ref = _step4.value;
|
|
|
|
var pos = this.header.dataOffset + ref.dataOffset + 4;
|
|
var stream = new r.DecodeStream(this.stream.buffer.slice(pos));
|
|
var font = new TTFFont(stream);
|
|
if (font.postscriptName === name) {
|
|
return font;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError4 = true;
|
|
_iteratorError4 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
|
_iterator4.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError4) {
|
|
throw _iteratorError4;
|
|
}
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}, {
|
|
key: 'fonts',
|
|
get: function get() {
|
|
var fonts = [];
|
|
var _iteratorNormalCompletion5 = true;
|
|
var _didIteratorError5 = false;
|
|
var _iteratorError5 = undefined;
|
|
|
|
try {
|
|
for (var _iterator5 = _getIterator(this.sfnt.refList), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
|
var ref = _step5.value;
|
|
|
|
var pos = this.header.dataOffset + ref.dataOffset + 4;
|
|
var stream = new r.DecodeStream(this.stream.buffer.slice(pos));
|
|
fonts.push(new TTFFont(stream));
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError5 = true;
|
|
_iteratorError5 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion5 && _iterator5.return) {
|
|
_iterator5.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError5) {
|
|
throw _iteratorError5;
|
|
}
|
|
}
|
|
}
|
|
|
|
return fonts;
|
|
}
|
|
}]);
|
|
|
|
return DFont;
|
|
}();
|
|
|
|
// Register font formats
|
|
fontkit.registerFormat(TTFFont);
|
|
fontkit.registerFormat(WOFFFont);
|
|
fontkit.registerFormat(WOFF2Font);
|
|
fontkit.registerFormat(TrueTypeCollection);
|
|
fontkit.registerFormat(DFont);
|
|
|
|
module.exports = fontkit;
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer, __webpack_require__(34)))
|
|
|
|
/***/ },
|
|
/* 81 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var key, val, _ref, _ref1;
|
|
|
|
exports.EncodeStream = __webpack_require__(82);
|
|
|
|
exports.DecodeStream = __webpack_require__(83);
|
|
|
|
exports.Array = __webpack_require__(105);
|
|
|
|
exports.LazyArray = __webpack_require__(108);
|
|
|
|
exports.Bitfield = __webpack_require__(109);
|
|
|
|
exports.Boolean = __webpack_require__(110);
|
|
|
|
exports.Buffer = __webpack_require__(111);
|
|
|
|
exports.Enum = __webpack_require__(112);
|
|
|
|
exports.Optional = __webpack_require__(113);
|
|
|
|
exports.Reserved = __webpack_require__(114);
|
|
|
|
exports.String = __webpack_require__(115);
|
|
|
|
exports.Struct = __webpack_require__(116);
|
|
|
|
exports.VersionedStruct = __webpack_require__(117);
|
|
|
|
_ref = __webpack_require__(106);
|
|
for (key in _ref) {
|
|
val = _ref[key];
|
|
exports[key] = val;
|
|
}
|
|
|
|
_ref1 = __webpack_require__(118);
|
|
for (key in _ref1) {
|
|
val = _ref1[key];
|
|
exports[key] = val;
|
|
}
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 82 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var DecodeStream, EncodeStream, iconv, stream,
|
|
__hasProp = {}.hasOwnProperty,
|
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
|
|
|
stream = __webpack_require__(30);
|
|
|
|
DecodeStream = __webpack_require__(83);
|
|
|
|
try {
|
|
iconv = __webpack_require__(84);
|
|
} catch (_error) {}
|
|
|
|
EncodeStream = (function(_super) {
|
|
var key;
|
|
|
|
__extends(EncodeStream, _super);
|
|
|
|
function EncodeStream(bufferSize) {
|
|
if (bufferSize == null) {
|
|
bufferSize = 65536;
|
|
}
|
|
EncodeStream.__super__.constructor.apply(this, arguments);
|
|
this.buffer = new Buffer(bufferSize);
|
|
this.bufferOffset = 0;
|
|
this.pos = 0;
|
|
}
|
|
|
|
for (key in Buffer.prototype) {
|
|
if (key.slice(0, 5) === 'write') {
|
|
(function(key) {
|
|
var bytes;
|
|
bytes = +DecodeStream.TYPES[key.replace(/write|[BL]E/g, '')];
|
|
return EncodeStream.prototype[key] = function(value) {
|
|
this.ensure(bytes);
|
|
this.buffer[key](value, this.bufferOffset);
|
|
this.bufferOffset += bytes;
|
|
return this.pos += bytes;
|
|
};
|
|
})(key);
|
|
}
|
|
}
|
|
|
|
EncodeStream.prototype._read = function() {};
|
|
|
|
EncodeStream.prototype.ensure = function(bytes) {
|
|
if (this.bufferOffset + bytes > this.buffer.length) {
|
|
return this.flush();
|
|
}
|
|
};
|
|
|
|
EncodeStream.prototype.flush = function() {
|
|
if (this.bufferOffset > 0) {
|
|
this.push(new Buffer(this.buffer.slice(0, this.bufferOffset)));
|
|
return this.bufferOffset = 0;
|
|
}
|
|
};
|
|
|
|
EncodeStream.prototype.writeBuffer = function(buffer) {
|
|
this.flush();
|
|
this.push(buffer);
|
|
return this.pos += buffer.length;
|
|
};
|
|
|
|
EncodeStream.prototype.writeString = function(string, encoding) {
|
|
var buf, byte, i, _i, _ref;
|
|
if (encoding == null) {
|
|
encoding = 'ascii';
|
|
}
|
|
switch (encoding) {
|
|
case 'utf16le':
|
|
case 'ucs2':
|
|
case 'utf8':
|
|
case 'ascii':
|
|
return this.writeBuffer(new Buffer(string, encoding));
|
|
case 'utf16be':
|
|
buf = new Buffer(string, 'utf16le');
|
|
for (i = _i = 0, _ref = buf.length - 1; _i < _ref; i = _i += 2) {
|
|
byte = buf[i];
|
|
buf[i] = buf[i + 1];
|
|
buf[i + 1] = byte;
|
|
}
|
|
return this.writeBuffer(buf);
|
|
default:
|
|
if (iconv) {
|
|
return this.writeBuffer(iconv.encode(string, encoding));
|
|
} else {
|
|
throw new Error('Install iconv-lite to enable additional string encodings.');
|
|
}
|
|
}
|
|
};
|
|
|
|
EncodeStream.prototype.writeUInt24BE = function(val) {
|
|
this.ensure(3);
|
|
this.buffer[this.bufferOffset++] = val >>> 16 & 0xff;
|
|
this.buffer[this.bufferOffset++] = val >>> 8 & 0xff;
|
|
this.buffer[this.bufferOffset++] = val & 0xff;
|
|
return this.pos += 3;
|
|
};
|
|
|
|
EncodeStream.prototype.writeUInt24LE = function(val) {
|
|
this.ensure(3);
|
|
this.buffer[this.bufferOffset++] = val & 0xff;
|
|
this.buffer[this.bufferOffset++] = val >>> 8 & 0xff;
|
|
this.buffer[this.bufferOffset++] = val >>> 16 & 0xff;
|
|
return this.pos += 3;
|
|
};
|
|
|
|
EncodeStream.prototype.writeInt24BE = function(val) {
|
|
if (val >= 0) {
|
|
return this.writeUInt24BE(val);
|
|
} else {
|
|
return this.writeUInt24BE(val + 0xffffff + 1);
|
|
}
|
|
};
|
|
|
|
EncodeStream.prototype.writeInt24LE = function(val) {
|
|
if (val >= 0) {
|
|
return this.writeUInt24LE(val);
|
|
} else {
|
|
return this.writeUInt24LE(val + 0xffffff + 1);
|
|
}
|
|
};
|
|
|
|
EncodeStream.prototype.fill = function(val, length) {
|
|
var buf;
|
|
if (length < this.buffer.length) {
|
|
this.ensure(length);
|
|
this.buffer.fill(val, this.bufferOffset, this.bufferOffset + length);
|
|
this.bufferOffset += length;
|
|
return this.pos += length;
|
|
} else {
|
|
buf = new Buffer(length);
|
|
buf.fill(val);
|
|
return this.writeBuffer(buf);
|
|
}
|
|
};
|
|
|
|
EncodeStream.prototype.end = function() {
|
|
this.flush();
|
|
return this.push(null);
|
|
};
|
|
|
|
return EncodeStream;
|
|
|
|
})(stream.Readable);
|
|
|
|
module.exports = EncodeStream;
|
|
|
|
}).call(this);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 83 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var DecodeStream, iconv;
|
|
|
|
try {
|
|
iconv = __webpack_require__(84);
|
|
} catch (_error) {}
|
|
|
|
DecodeStream = (function() {
|
|
var key;
|
|
|
|
function DecodeStream(buffer) {
|
|
this.buffer = buffer;
|
|
this.pos = 0;
|
|
this.length = this.buffer.length;
|
|
}
|
|
|
|
DecodeStream.TYPES = {
|
|
UInt8: 1,
|
|
UInt16: 2,
|
|
UInt24: 3,
|
|
UInt32: 4,
|
|
Int8: 1,
|
|
Int16: 2,
|
|
Int24: 3,
|
|
Int32: 4,
|
|
Float: 4,
|
|
Double: 8
|
|
};
|
|
|
|
for (key in Buffer.prototype) {
|
|
if (key.slice(0, 4) === 'read') {
|
|
(function(key) {
|
|
var bytes;
|
|
bytes = DecodeStream.TYPES[key.replace(/read|[BL]E/g, '')];
|
|
return DecodeStream.prototype[key] = function() {
|
|
var ret;
|
|
ret = this.buffer[key](this.pos);
|
|
this.pos += bytes;
|
|
return ret;
|
|
};
|
|
})(key);
|
|
}
|
|
}
|
|
|
|
DecodeStream.prototype.readString = function(length, encoding) {
|
|
var buf, byte, i, _i, _ref;
|
|
if (encoding == null) {
|
|
encoding = 'ascii';
|
|
}
|
|
switch (encoding) {
|
|
case 'utf16le':
|
|
case 'ucs2':
|
|
case 'utf8':
|
|
case 'ascii':
|
|
return this.buffer.toString(encoding, this.pos, this.pos += length);
|
|
case 'utf16be':
|
|
buf = new Buffer(this.readBuffer(length));
|
|
for (i = _i = 0, _ref = buf.length - 1; _i < _ref; i = _i += 2) {
|
|
byte = buf[i];
|
|
buf[i] = buf[i + 1];
|
|
buf[i + 1] = byte;
|
|
}
|
|
return buf.toString('utf16le');
|
|
default:
|
|
buf = this.readBuffer(length);
|
|
if (iconv) {
|
|
return iconv.decode(buf, encoding);
|
|
}
|
|
return buf;
|
|
}
|
|
};
|
|
|
|
DecodeStream.prototype.readBuffer = function(length) {
|
|
return this.buffer.slice(this.pos, this.pos += length);
|
|
};
|
|
|
|
DecodeStream.prototype.readUInt24BE = function() {
|
|
return (this.readUInt16BE() << 8) + this.readUInt8();
|
|
};
|
|
|
|
DecodeStream.prototype.readUInt24LE = function() {
|
|
return this.readUInt16LE() + (this.readUInt8() << 16);
|
|
};
|
|
|
|
DecodeStream.prototype.readInt24BE = function() {
|
|
return (this.readInt16BE() << 8) + this.readUInt8();
|
|
};
|
|
|
|
DecodeStream.prototype.readInt24LE = function() {
|
|
return this.readUInt16LE() + (this.readInt8() << 16);
|
|
};
|
|
|
|
return DecodeStream;
|
|
|
|
})();
|
|
|
|
module.exports = DecodeStream;
|
|
|
|
}).call(this);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 84 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer, process) {"use strict"
|
|
|
|
var bomHandling = __webpack_require__(85),
|
|
iconv = module.exports;
|
|
|
|
// All codecs and aliases are kept here, keyed by encoding name/alias.
|
|
// They are lazy loaded in `iconv.getCodec` from `encodings/index.js`.
|
|
iconv.encodings = null;
|
|
|
|
// Characters emitted in case of error.
|
|
iconv.defaultCharUnicode = '�';
|
|
iconv.defaultCharSingleByte = '?';
|
|
|
|
// Public API.
|
|
iconv.encode = function encode(str, encoding, options) {
|
|
str = "" + (str || ""); // Ensure string.
|
|
|
|
var encoder = iconv.getEncoder(encoding, options);
|
|
|
|
var res = encoder.write(str);
|
|
var trail = encoder.end();
|
|
|
|
return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res;
|
|
}
|
|
|
|
iconv.decode = function decode(buf, encoding, options) {
|
|
if (typeof buf === 'string') {
|
|
if (!iconv.skipDecodeWarning) {
|
|
console.error('Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding');
|
|
iconv.skipDecodeWarning = true;
|
|
}
|
|
|
|
buf = new Buffer("" + (buf || ""), "binary"); // Ensure buffer.
|
|
}
|
|
|
|
var decoder = iconv.getDecoder(encoding, options);
|
|
|
|
var res = decoder.write(buf);
|
|
var trail = decoder.end();
|
|
|
|
return trail ? (res + trail) : res;
|
|
}
|
|
|
|
iconv.encodingExists = function encodingExists(enc) {
|
|
try {
|
|
iconv.getCodec(enc);
|
|
return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// Legacy aliases to convert functions
|
|
iconv.toEncoding = iconv.encode;
|
|
iconv.fromEncoding = iconv.decode;
|
|
|
|
// Search for a codec in iconv.encodings. Cache codec data in iconv._codecDataCache.
|
|
iconv._codecDataCache = {};
|
|
iconv.getCodec = function getCodec(encoding) {
|
|
if (!iconv.encodings)
|
|
iconv.encodings = __webpack_require__(86); // Lazy load all encoding definitions.
|
|
|
|
// Canonicalize encoding name: strip all non-alphanumeric chars and appended year.
|
|
var enc = (''+encoding).toLowerCase().replace(/[^0-9a-z]|:\d{4}$/g, "");
|
|
|
|
// Traverse iconv.encodings to find actual codec.
|
|
var codecOptions = {};
|
|
while (true) {
|
|
var codec = iconv._codecDataCache[enc];
|
|
if (codec)
|
|
return codec;
|
|
|
|
var codecDef = iconv.encodings[enc];
|
|
|
|
switch (typeof codecDef) {
|
|
case "string": // Direct alias to other encoding.
|
|
enc = codecDef;
|
|
break;
|
|
|
|
case "object": // Alias with options. Can be layered.
|
|
for (var key in codecDef)
|
|
codecOptions[key] = codecDef[key];
|
|
|
|
if (!codecOptions.encodingName)
|
|
codecOptions.encodingName = enc;
|
|
|
|
enc = codecDef.type;
|
|
break;
|
|
|
|
case "function": // Codec itself.
|
|
if (!codecOptions.encodingName)
|
|
codecOptions.encodingName = enc;
|
|
|
|
// The codec function must load all tables and return object with .encoder and .decoder methods.
|
|
// It'll be called only once (for each different options object).
|
|
codec = new codecDef(codecOptions, iconv);
|
|
|
|
iconv._codecDataCache[codecOptions.encodingName] = codec; // Save it to be reused later.
|
|
return codec;
|
|
|
|
default:
|
|
throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')");
|
|
}
|
|
}
|
|
}
|
|
|
|
iconv.getEncoder = function getEncoder(encoding, options) {
|
|
var codec = iconv.getCodec(encoding),
|
|
encoder = new codec.encoder(options, codec);
|
|
|
|
if (codec.bomAware && options && options.addBOM)
|
|
encoder = new bomHandling.PrependBOM(encoder, options);
|
|
|
|
return encoder;
|
|
}
|
|
|
|
iconv.getDecoder = function getDecoder(encoding, options) {
|
|
var codec = iconv.getCodec(encoding),
|
|
decoder = new codec.decoder(options, codec);
|
|
|
|
if (codec.bomAware && !(options && options.stripBOM === false))
|
|
decoder = new bomHandling.StripBOM(decoder, options);
|
|
|
|
return decoder;
|
|
}
|
|
|
|
|
|
// Load extensions in Node. All of them are omitted in Browserify build via 'browser' field in package.json.
|
|
var nodeVer = typeof process !== 'undefined' && process.versions && process.versions.node;
|
|
if (nodeVer) {
|
|
|
|
// Load streaming support in Node v0.10+
|
|
var nodeVerArr = nodeVer.split(".").map(Number);
|
|
if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) {
|
|
__webpack_require__(103)(iconv);
|
|
}
|
|
|
|
// Load Node primitive extensions.
|
|
__webpack_require__(104)(iconv);
|
|
}
|
|
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer, __webpack_require__(34)))
|
|
|
|
/***/ },
|
|
/* 85 */
|
|
/***/ function(module, exports) {
|
|
|
|
"use strict"
|
|
|
|
var BOMChar = '\uFEFF';
|
|
|
|
exports.PrependBOM = PrependBOMWrapper
|
|
function PrependBOMWrapper(encoder, options) {
|
|
this.encoder = encoder;
|
|
this.addBOM = true;
|
|
}
|
|
|
|
PrependBOMWrapper.prototype.write = function(str) {
|
|
if (this.addBOM) {
|
|
str = BOMChar + str;
|
|
this.addBOM = false;
|
|
}
|
|
|
|
return this.encoder.write(str);
|
|
}
|
|
|
|
PrependBOMWrapper.prototype.end = function() {
|
|
return this.encoder.end();
|
|
}
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
exports.StripBOM = StripBOMWrapper;
|
|
function StripBOMWrapper(decoder, options) {
|
|
this.decoder = decoder;
|
|
this.pass = false;
|
|
this.options = options || {};
|
|
}
|
|
|
|
StripBOMWrapper.prototype.write = function(buf) {
|
|
var res = this.decoder.write(buf);
|
|
if (this.pass || !res)
|
|
return res;
|
|
|
|
if (res[0] === BOMChar) {
|
|
res = res.slice(1);
|
|
if (typeof this.options.stripBOM === 'function')
|
|
this.options.stripBOM();
|
|
}
|
|
|
|
this.pass = true;
|
|
return res;
|
|
}
|
|
|
|
StripBOMWrapper.prototype.end = function() {
|
|
return this.decoder.end();
|
|
}
|
|
|
|
|
|
|
|
/***/ },
|
|
/* 86 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
"use strict"
|
|
|
|
// Update this array if you add/rename/remove files in this directory.
|
|
// We support Browserify by skipping automatic module discovery and requiring modules directly.
|
|
var modules = [
|
|
__webpack_require__(87),
|
|
__webpack_require__(88),
|
|
__webpack_require__(89),
|
|
__webpack_require__(90),
|
|
__webpack_require__(91),
|
|
__webpack_require__(92),
|
|
__webpack_require__(93),
|
|
__webpack_require__(94),
|
|
];
|
|
|
|
// Put all encoding/alias/codec definitions to single object and export it.
|
|
for (var i = 0; i < modules.length; i++) {
|
|
var module = modules[i];
|
|
for (var enc in module)
|
|
if (Object.prototype.hasOwnProperty.call(module, enc))
|
|
exports[enc] = module[enc];
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 87 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"
|
|
|
|
// Export Node.js internal encodings.
|
|
|
|
module.exports = {
|
|
// Encodings
|
|
utf8: { type: "_internal", bomAware: true},
|
|
cesu8: { type: "_internal", bomAware: true},
|
|
unicode11utf8: "utf8",
|
|
|
|
ucs2: { type: "_internal", bomAware: true},
|
|
utf16le: "ucs2",
|
|
|
|
binary: { type: "_internal" },
|
|
base64: { type: "_internal" },
|
|
hex: { type: "_internal" },
|
|
|
|
// Codec.
|
|
_internal: InternalCodec,
|
|
};
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
function InternalCodec(codecOptions, iconv) {
|
|
this.enc = codecOptions.encodingName;
|
|
this.bomAware = codecOptions.bomAware;
|
|
|
|
if (this.enc === "base64")
|
|
this.encoder = InternalEncoderBase64;
|
|
else if (this.enc === "cesu8") {
|
|
this.enc = "utf8"; // Use utf8 for decoding.
|
|
this.encoder = InternalEncoderCesu8;
|
|
|
|
// Add decoder for versions of Node not supporting CESU-8
|
|
if (new Buffer("eda080", 'hex').toString().length == 3) {
|
|
this.decoder = InternalDecoderCesu8;
|
|
this.defaultCharUnicode = iconv.defaultCharUnicode;
|
|
}
|
|
}
|
|
}
|
|
|
|
InternalCodec.prototype.encoder = InternalEncoder;
|
|
InternalCodec.prototype.decoder = InternalDecoder;
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// We use node.js internal decoder. Its signature is the same as ours.
|
|
var StringDecoder = __webpack_require__(46).StringDecoder;
|
|
|
|
if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method.
|
|
StringDecoder.prototype.end = function() {};
|
|
|
|
|
|
function InternalDecoder(options, codec) {
|
|
StringDecoder.call(this, codec.enc);
|
|
}
|
|
|
|
InternalDecoder.prototype = StringDecoder.prototype;
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Encoder is mostly trivial
|
|
|
|
function InternalEncoder(options, codec) {
|
|
this.enc = codec.enc;
|
|
}
|
|
|
|
InternalEncoder.prototype.write = function(str) {
|
|
return new Buffer(str, this.enc);
|
|
}
|
|
|
|
InternalEncoder.prototype.end = function() {
|
|
}
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Except base64 encoder, which must keep its state.
|
|
|
|
function InternalEncoderBase64(options, codec) {
|
|
this.prevStr = '';
|
|
}
|
|
|
|
InternalEncoderBase64.prototype.write = function(str) {
|
|
str = this.prevStr + str;
|
|
var completeQuads = str.length - (str.length % 4);
|
|
this.prevStr = str.slice(completeQuads);
|
|
str = str.slice(0, completeQuads);
|
|
|
|
return new Buffer(str, "base64");
|
|
}
|
|
|
|
InternalEncoderBase64.prototype.end = function() {
|
|
return new Buffer(this.prevStr, "base64");
|
|
}
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
// CESU-8 encoder is also special.
|
|
|
|
function InternalEncoderCesu8(options, codec) {
|
|
}
|
|
|
|
InternalEncoderCesu8.prototype.write = function(str) {
|
|
var buf = new Buffer(str.length * 3), bufIdx = 0;
|
|
for (var i = 0; i < str.length; i++) {
|
|
var charCode = str.charCodeAt(i);
|
|
// Naive implementation, but it works because CESU-8 is especially easy
|
|
// to convert from UTF-16 (which all JS strings are encoded in).
|
|
if (charCode < 0x80)
|
|
buf[bufIdx++] = charCode;
|
|
else if (charCode < 0x800) {
|
|
buf[bufIdx++] = 0xC0 + (charCode >>> 6);
|
|
buf[bufIdx++] = 0x80 + (charCode & 0x3f);
|
|
}
|
|
else { // charCode will always be < 0x10000 in javascript.
|
|
buf[bufIdx++] = 0xE0 + (charCode >>> 12);
|
|
buf[bufIdx++] = 0x80 + ((charCode >>> 6) & 0x3f);
|
|
buf[bufIdx++] = 0x80 + (charCode & 0x3f);
|
|
}
|
|
}
|
|
return buf.slice(0, bufIdx);
|
|
}
|
|
|
|
InternalEncoderCesu8.prototype.end = function() {
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// CESU-8 decoder is not implemented in Node v4.0+
|
|
|
|
function InternalDecoderCesu8(options, codec) {
|
|
this.acc = 0;
|
|
this.contBytes = 0;
|
|
this.accBytes = 0;
|
|
this.defaultCharUnicode = codec.defaultCharUnicode;
|
|
}
|
|
|
|
InternalDecoderCesu8.prototype.write = function(buf) {
|
|
var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes,
|
|
res = '';
|
|
for (var i = 0; i < buf.length; i++) {
|
|
var curByte = buf[i];
|
|
if ((curByte & 0xC0) !== 0x80) { // Leading byte
|
|
if (contBytes > 0) { // Previous code is invalid
|
|
res += this.defaultCharUnicode;
|
|
contBytes = 0;
|
|
}
|
|
|
|
if (curByte < 0x80) { // Single-byte code
|
|
res += String.fromCharCode(curByte);
|
|
} else if (curByte < 0xE0) { // Two-byte code
|
|
acc = curByte & 0x1F;
|
|
contBytes = 1; accBytes = 1;
|
|
} else if (curByte < 0xF0) { // Three-byte code
|
|
acc = curByte & 0x0F;
|
|
contBytes = 2; accBytes = 1;
|
|
} else { // Four or more are not supported for CESU-8.
|
|
res += this.defaultCharUnicode;
|
|
}
|
|
} else { // Continuation byte
|
|
if (contBytes > 0) { // We're waiting for it.
|
|
acc = (acc << 6) | (curByte & 0x3f);
|
|
contBytes--; accBytes++;
|
|
if (contBytes === 0) {
|
|
// Check for overlong encoding, but support Modified UTF-8 (encoding NULL as C0 80)
|
|
if (accBytes === 2 && acc < 0x80 && acc > 0)
|
|
res += this.defaultCharUnicode;
|
|
else if (accBytes === 3 && acc < 0x800)
|
|
res += this.defaultCharUnicode;
|
|
else
|
|
// Actually add character.
|
|
res += String.fromCharCode(acc);
|
|
}
|
|
} else { // Unexpected continuation byte
|
|
res += this.defaultCharUnicode;
|
|
}
|
|
}
|
|
}
|
|
this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes;
|
|
return res;
|
|
}
|
|
|
|
InternalDecoderCesu8.prototype.end = function() {
|
|
var res = 0;
|
|
if (this.contBytes > 0)
|
|
res += this.defaultCharUnicode;
|
|
return res;
|
|
}
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 88 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"
|
|
|
|
// Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js
|
|
|
|
// == UTF16-BE codec. ==========================================================
|
|
|
|
exports.utf16be = Utf16BECodec;
|
|
function Utf16BECodec() {
|
|
}
|
|
|
|
Utf16BECodec.prototype.encoder = Utf16BEEncoder;
|
|
Utf16BECodec.prototype.decoder = Utf16BEDecoder;
|
|
Utf16BECodec.prototype.bomAware = true;
|
|
|
|
|
|
// -- Encoding
|
|
|
|
function Utf16BEEncoder() {
|
|
}
|
|
|
|
Utf16BEEncoder.prototype.write = function(str) {
|
|
var buf = new Buffer(str, 'ucs2');
|
|
for (var i = 0; i < buf.length; i += 2) {
|
|
var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp;
|
|
}
|
|
return buf;
|
|
}
|
|
|
|
Utf16BEEncoder.prototype.end = function() {
|
|
}
|
|
|
|
|
|
// -- Decoding
|
|
|
|
function Utf16BEDecoder() {
|
|
this.overflowByte = -1;
|
|
}
|
|
|
|
Utf16BEDecoder.prototype.write = function(buf) {
|
|
if (buf.length == 0)
|
|
return '';
|
|
|
|
var buf2 = new Buffer(buf.length + 1),
|
|
i = 0, j = 0;
|
|
|
|
if (this.overflowByte !== -1) {
|
|
buf2[0] = buf[0];
|
|
buf2[1] = this.overflowByte;
|
|
i = 1; j = 2;
|
|
}
|
|
|
|
for (; i < buf.length-1; i += 2, j+= 2) {
|
|
buf2[j] = buf[i+1];
|
|
buf2[j+1] = buf[i];
|
|
}
|
|
|
|
this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1;
|
|
|
|
return buf2.slice(0, j).toString('ucs2');
|
|
}
|
|
|
|
Utf16BEDecoder.prototype.end = function() {
|
|
}
|
|
|
|
|
|
// == UTF-16 codec =============================================================
|
|
// Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic.
|
|
// Defaults to UTF-16LE, as it's prevalent and default in Node.
|
|
// http://en.wikipedia.org/wiki/UTF-16 and http://encoding.spec.whatwg.org/#utf-16le
|
|
// Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'});
|
|
|
|
// Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false).
|
|
|
|
exports.utf16 = Utf16Codec;
|
|
function Utf16Codec(codecOptions, iconv) {
|
|
this.iconv = iconv;
|
|
}
|
|
|
|
Utf16Codec.prototype.encoder = Utf16Encoder;
|
|
Utf16Codec.prototype.decoder = Utf16Decoder;
|
|
|
|
|
|
// -- Encoding (pass-through)
|
|
|
|
function Utf16Encoder(options, codec) {
|
|
options = options || {};
|
|
if (options.addBOM === undefined)
|
|
options.addBOM = true;
|
|
this.encoder = codec.iconv.getEncoder('utf-16le', options);
|
|
}
|
|
|
|
Utf16Encoder.prototype.write = function(str) {
|
|
return this.encoder.write(str);
|
|
}
|
|
|
|
Utf16Encoder.prototype.end = function() {
|
|
return this.encoder.end();
|
|
}
|
|
|
|
|
|
// -- Decoding
|
|
|
|
function Utf16Decoder(options, codec) {
|
|
this.decoder = null;
|
|
this.initialBytes = [];
|
|
this.initialBytesLen = 0;
|
|
|
|
this.options = options || {};
|
|
this.iconv = codec.iconv;
|
|
}
|
|
|
|
Utf16Decoder.prototype.write = function(buf) {
|
|
if (!this.decoder) {
|
|
// Codec is not chosen yet. Accumulate initial bytes.
|
|
this.initialBytes.push(buf);
|
|
this.initialBytesLen += buf.length;
|
|
|
|
if (this.initialBytesLen < 16) // We need more bytes to use space heuristic (see below)
|
|
return '';
|
|
|
|
// We have enough bytes -> detect endianness.
|
|
var buf = Buffer.concat(this.initialBytes),
|
|
encoding = detectEncoding(buf, this.options.defaultEncoding);
|
|
this.decoder = this.iconv.getDecoder(encoding, this.options);
|
|
this.initialBytes.length = this.initialBytesLen = 0;
|
|
}
|
|
|
|
return this.decoder.write(buf);
|
|
}
|
|
|
|
Utf16Decoder.prototype.end = function() {
|
|
if (!this.decoder) {
|
|
var buf = Buffer.concat(this.initialBytes),
|
|
encoding = detectEncoding(buf, this.options.defaultEncoding);
|
|
this.decoder = this.iconv.getDecoder(encoding, this.options);
|
|
|
|
var res = this.decoder.write(buf),
|
|
trail = this.decoder.end();
|
|
|
|
return trail ? (res + trail) : res;
|
|
}
|
|
return this.decoder.end();
|
|
}
|
|
|
|
function detectEncoding(buf, defaultEncoding) {
|
|
var enc = defaultEncoding || 'utf-16le';
|
|
|
|
if (buf.length >= 2) {
|
|
// Check BOM.
|
|
if (buf[0] == 0xFE && buf[1] == 0xFF) // UTF-16BE BOM
|
|
enc = 'utf-16be';
|
|
else if (buf[0] == 0xFF && buf[1] == 0xFE) // UTF-16LE BOM
|
|
enc = 'utf-16le';
|
|
else {
|
|
// No BOM found. Try to deduce encoding from initial content.
|
|
// Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon.
|
|
// So, we count ASCII as if it was LE or BE, and decide from that.
|
|
var asciiCharsLE = 0, asciiCharsBE = 0, // Counts of chars in both positions
|
|
_len = Math.min(buf.length - (buf.length % 2), 64); // Len is always even.
|
|
|
|
for (var i = 0; i < _len; i += 2) {
|
|
if (buf[i] === 0 && buf[i+1] !== 0) asciiCharsBE++;
|
|
if (buf[i] !== 0 && buf[i+1] === 0) asciiCharsLE++;
|
|
}
|
|
|
|
if (asciiCharsBE > asciiCharsLE)
|
|
enc = 'utf-16be';
|
|
else if (asciiCharsBE < asciiCharsLE)
|
|
enc = 'utf-16le';
|
|
}
|
|
}
|
|
|
|
return enc;
|
|
}
|
|
|
|
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 89 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"
|
|
|
|
// UTF-7 codec, according to https://tools.ietf.org/html/rfc2152
|
|
// See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3
|
|
|
|
exports.utf7 = Utf7Codec;
|
|
exports.unicode11utf7 = 'utf7'; // Alias UNICODE-1-1-UTF-7
|
|
function Utf7Codec(codecOptions, iconv) {
|
|
this.iconv = iconv;
|
|
};
|
|
|
|
Utf7Codec.prototype.encoder = Utf7Encoder;
|
|
Utf7Codec.prototype.decoder = Utf7Decoder;
|
|
Utf7Codec.prototype.bomAware = true;
|
|
|
|
|
|
// -- Encoding
|
|
|
|
var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g;
|
|
|
|
function Utf7Encoder(options, codec) {
|
|
this.iconv = codec.iconv;
|
|
}
|
|
|
|
Utf7Encoder.prototype.write = function(str) {
|
|
// Naive implementation.
|
|
// Non-direct chars are encoded as "+<base64>-"; single "+" char is encoded as "+-".
|
|
return new Buffer(str.replace(nonDirectChars, function(chunk) {
|
|
return "+" + (chunk === '+' ? '' :
|
|
this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, ''))
|
|
+ "-";
|
|
}.bind(this)));
|
|
}
|
|
|
|
Utf7Encoder.prototype.end = function() {
|
|
}
|
|
|
|
|
|
// -- Decoding
|
|
|
|
function Utf7Decoder(options, codec) {
|
|
this.iconv = codec.iconv;
|
|
this.inBase64 = false;
|
|
this.base64Accum = '';
|
|
}
|
|
|
|
var base64Regex = /[A-Za-z0-9\/+]/;
|
|
var base64Chars = [];
|
|
for (var i = 0; i < 256; i++)
|
|
base64Chars[i] = base64Regex.test(String.fromCharCode(i));
|
|
|
|
var plusChar = '+'.charCodeAt(0),
|
|
minusChar = '-'.charCodeAt(0),
|
|
andChar = '&'.charCodeAt(0);
|
|
|
|
Utf7Decoder.prototype.write = function(buf) {
|
|
var res = "", lastI = 0,
|
|
inBase64 = this.inBase64,
|
|
base64Accum = this.base64Accum;
|
|
|
|
// The decoder is more involved as we must handle chunks in stream.
|
|
|
|
for (var i = 0; i < buf.length; i++) {
|
|
if (!inBase64) { // We're in direct mode.
|
|
// Write direct chars until '+'
|
|
if (buf[i] == plusChar) {
|
|
res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars.
|
|
lastI = i+1;
|
|
inBase64 = true;
|
|
}
|
|
} else { // We decode base64.
|
|
if (!base64Chars[buf[i]]) { // Base64 ended.
|
|
if (i == lastI && buf[i] == minusChar) {// "+-" -> "+"
|
|
res += "+";
|
|
} else {
|
|
var b64str = base64Accum + buf.slice(lastI, i).toString();
|
|
res += this.iconv.decode(new Buffer(b64str, 'base64'), "utf16-be");
|
|
}
|
|
|
|
if (buf[i] != minusChar) // Minus is absorbed after base64.
|
|
i--;
|
|
|
|
lastI = i+1;
|
|
inBase64 = false;
|
|
base64Accum = '';
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!inBase64) {
|
|
res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars.
|
|
} else {
|
|
var b64str = base64Accum + buf.slice(lastI).toString();
|
|
|
|
var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.
|
|
base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future.
|
|
b64str = b64str.slice(0, canBeDecoded);
|
|
|
|
res += this.iconv.decode(new Buffer(b64str, 'base64'), "utf16-be");
|
|
}
|
|
|
|
this.inBase64 = inBase64;
|
|
this.base64Accum = base64Accum;
|
|
|
|
return res;
|
|
}
|
|
|
|
Utf7Decoder.prototype.end = function() {
|
|
var res = "";
|
|
if (this.inBase64 && this.base64Accum.length > 0)
|
|
res = this.iconv.decode(new Buffer(this.base64Accum, 'base64'), "utf16-be");
|
|
|
|
this.inBase64 = false;
|
|
this.base64Accum = '';
|
|
return res;
|
|
}
|
|
|
|
|
|
// UTF-7-IMAP codec.
|
|
// RFC3501 Sec. 5.1.3 Modified UTF-7 (http://tools.ietf.org/html/rfc3501#section-5.1.3)
|
|
// Differences:
|
|
// * Base64 part is started by "&" instead of "+"
|
|
// * Direct characters are 0x20-0x7E, except "&" (0x26)
|
|
// * In Base64, "," is used instead of "/"
|
|
// * Base64 must not be used to represent direct characters.
|
|
// * No implicit shift back from Base64 (should always end with '-')
|
|
// * String must end in non-shifted position.
|
|
// * "-&" while in base64 is not allowed.
|
|
|
|
|
|
exports.utf7imap = Utf7IMAPCodec;
|
|
function Utf7IMAPCodec(codecOptions, iconv) {
|
|
this.iconv = iconv;
|
|
};
|
|
|
|
Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder;
|
|
Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder;
|
|
Utf7IMAPCodec.prototype.bomAware = true;
|
|
|
|
|
|
// -- Encoding
|
|
|
|
function Utf7IMAPEncoder(options, codec) {
|
|
this.iconv = codec.iconv;
|
|
this.inBase64 = false;
|
|
this.base64Accum = new Buffer(6);
|
|
this.base64AccumIdx = 0;
|
|
}
|
|
|
|
Utf7IMAPEncoder.prototype.write = function(str) {
|
|
var inBase64 = this.inBase64,
|
|
base64Accum = this.base64Accum,
|
|
base64AccumIdx = this.base64AccumIdx,
|
|
buf = new Buffer(str.length*5 + 10), bufIdx = 0;
|
|
|
|
for (var i = 0; i < str.length; i++) {
|
|
var uChar = str.charCodeAt(i);
|
|
if (0x20 <= uChar && uChar <= 0x7E) { // Direct character or '&'.
|
|
if (inBase64) {
|
|
if (base64AccumIdx > 0) {
|
|
bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx);
|
|
base64AccumIdx = 0;
|
|
}
|
|
|
|
buf[bufIdx++] = minusChar; // Write '-', then go to direct mode.
|
|
inBase64 = false;
|
|
}
|
|
|
|
if (!inBase64) {
|
|
buf[bufIdx++] = uChar; // Write direct character
|
|
|
|
if (uChar === andChar) // Ampersand -> '&-'
|
|
buf[bufIdx++] = minusChar;
|
|
}
|
|
|
|
} else { // Non-direct character
|
|
if (!inBase64) {
|
|
buf[bufIdx++] = andChar; // Write '&', then go to base64 mode.
|
|
inBase64 = true;
|
|
}
|
|
if (inBase64) {
|
|
base64Accum[base64AccumIdx++] = uChar >> 8;
|
|
base64Accum[base64AccumIdx++] = uChar & 0xFF;
|
|
|
|
if (base64AccumIdx == base64Accum.length) {
|
|
bufIdx += buf.write(base64Accum.toString('base64').replace(/\//g, ','), bufIdx);
|
|
base64AccumIdx = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
this.inBase64 = inBase64;
|
|
this.base64AccumIdx = base64AccumIdx;
|
|
|
|
return buf.slice(0, bufIdx);
|
|
}
|
|
|
|
Utf7IMAPEncoder.prototype.end = function() {
|
|
var buf = new Buffer(10), bufIdx = 0;
|
|
if (this.inBase64) {
|
|
if (this.base64AccumIdx > 0) {
|
|
bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx);
|
|
this.base64AccumIdx = 0;
|
|
}
|
|
|
|
buf[bufIdx++] = minusChar; // Write '-', then go to direct mode.
|
|
this.inBase64 = false;
|
|
}
|
|
|
|
return buf.slice(0, bufIdx);
|
|
}
|
|
|
|
|
|
// -- Decoding
|
|
|
|
function Utf7IMAPDecoder(options, codec) {
|
|
this.iconv = codec.iconv;
|
|
this.inBase64 = false;
|
|
this.base64Accum = '';
|
|
}
|
|
|
|
var base64IMAPChars = base64Chars.slice();
|
|
base64IMAPChars[','.charCodeAt(0)] = true;
|
|
|
|
Utf7IMAPDecoder.prototype.write = function(buf) {
|
|
var res = "", lastI = 0,
|
|
inBase64 = this.inBase64,
|
|
base64Accum = this.base64Accum;
|
|
|
|
// The decoder is more involved as we must handle chunks in stream.
|
|
// It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end).
|
|
|
|
for (var i = 0; i < buf.length; i++) {
|
|
if (!inBase64) { // We're in direct mode.
|
|
// Write direct chars until '&'
|
|
if (buf[i] == andChar) {
|
|
res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars.
|
|
lastI = i+1;
|
|
inBase64 = true;
|
|
}
|
|
} else { // We decode base64.
|
|
if (!base64IMAPChars[buf[i]]) { // Base64 ended.
|
|
if (i == lastI && buf[i] == minusChar) { // "&-" -> "&"
|
|
res += "&";
|
|
} else {
|
|
var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/');
|
|
res += this.iconv.decode(new Buffer(b64str, 'base64'), "utf16-be");
|
|
}
|
|
|
|
if (buf[i] != minusChar) // Minus may be absorbed after base64.
|
|
i--;
|
|
|
|
lastI = i+1;
|
|
inBase64 = false;
|
|
base64Accum = '';
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!inBase64) {
|
|
res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars.
|
|
} else {
|
|
var b64str = base64Accum + buf.slice(lastI).toString().replace(/,/g, '/');
|
|
|
|
var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.
|
|
base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future.
|
|
b64str = b64str.slice(0, canBeDecoded);
|
|
|
|
res += this.iconv.decode(new Buffer(b64str, 'base64'), "utf16-be");
|
|
}
|
|
|
|
this.inBase64 = inBase64;
|
|
this.base64Accum = base64Accum;
|
|
|
|
return res;
|
|
}
|
|
|
|
Utf7IMAPDecoder.prototype.end = function() {
|
|
var res = "";
|
|
if (this.inBase64 && this.base64Accum.length > 0)
|
|
res = this.iconv.decode(new Buffer(this.base64Accum, 'base64'), "utf16-be");
|
|
|
|
this.inBase64 = false;
|
|
this.base64Accum = '';
|
|
return res;
|
|
}
|
|
|
|
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 90 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"
|
|
|
|
// Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that
|
|
// correspond to encoded bytes (if 128 - then lower half is ASCII).
|
|
|
|
exports._sbcs = SBCSCodec;
|
|
function SBCSCodec(codecOptions, iconv) {
|
|
if (!codecOptions)
|
|
throw new Error("SBCS codec is called without the data.")
|
|
|
|
// Prepare char buffer for decoding.
|
|
if (!codecOptions.chars || (codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256))
|
|
throw new Error("Encoding '"+codecOptions.type+"' has incorrect 'chars' (must be of len 128 or 256)");
|
|
|
|
if (codecOptions.chars.length === 128) {
|
|
var asciiString = "";
|
|
for (var i = 0; i < 128; i++)
|
|
asciiString += String.fromCharCode(i);
|
|
codecOptions.chars = asciiString + codecOptions.chars;
|
|
}
|
|
|
|
this.decodeBuf = new Buffer(codecOptions.chars, 'ucs2');
|
|
|
|
// Encoding buffer.
|
|
var encodeBuf = new Buffer(65536);
|
|
encodeBuf.fill(iconv.defaultCharSingleByte.charCodeAt(0));
|
|
|
|
for (var i = 0; i < codecOptions.chars.length; i++)
|
|
encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
|
|
|
|
this.encodeBuf = encodeBuf;
|
|
}
|
|
|
|
SBCSCodec.prototype.encoder = SBCSEncoder;
|
|
SBCSCodec.prototype.decoder = SBCSDecoder;
|
|
|
|
|
|
function SBCSEncoder(options, codec) {
|
|
this.encodeBuf = codec.encodeBuf;
|
|
}
|
|
|
|
SBCSEncoder.prototype.write = function(str) {
|
|
var buf = new Buffer(str.length);
|
|
for (var i = 0; i < str.length; i++)
|
|
buf[i] = this.encodeBuf[str.charCodeAt(i)];
|
|
|
|
return buf;
|
|
}
|
|
|
|
SBCSEncoder.prototype.end = function() {
|
|
}
|
|
|
|
|
|
function SBCSDecoder(options, codec) {
|
|
this.decodeBuf = codec.decodeBuf;
|
|
}
|
|
|
|
SBCSDecoder.prototype.write = function(buf) {
|
|
// Strings are immutable in JS -> we use ucs2 buffer to speed up computations.
|
|
var decodeBuf = this.decodeBuf;
|
|
var newBuf = new Buffer(buf.length*2);
|
|
var idx1 = 0, idx2 = 0;
|
|
for (var i = 0; i < buf.length; i++) {
|
|
idx1 = buf[i]*2; idx2 = i*2;
|
|
newBuf[idx2] = decodeBuf[idx1];
|
|
newBuf[idx2+1] = decodeBuf[idx1+1];
|
|
}
|
|
return newBuf.toString('ucs2');
|
|
}
|
|
|
|
SBCSDecoder.prototype.end = function() {
|
|
}
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 91 */
|
|
/***/ function(module, exports) {
|
|
|
|
"use strict"
|
|
|
|
// Manually added data to be used by sbcs codec in addition to generated one.
|
|
|
|
module.exports = {
|
|
// Not supported by iconv, not sure why.
|
|
"10029": "maccenteuro",
|
|
"maccenteuro": {
|
|
"type": "_sbcs",
|
|
"chars": "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ"
|
|
},
|
|
|
|
"808": "cp808",
|
|
"ibm808": "cp808",
|
|
"cp808": {
|
|
"type": "_sbcs",
|
|
"chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ "
|
|
},
|
|
|
|
// Aliases of generated encodings.
|
|
"ascii8bit": "ascii",
|
|
"usascii": "ascii",
|
|
"ansix34": "ascii",
|
|
"ansix341968": "ascii",
|
|
"ansix341986": "ascii",
|
|
"csascii": "ascii",
|
|
"cp367": "ascii",
|
|
"ibm367": "ascii",
|
|
"isoir6": "ascii",
|
|
"iso646us": "ascii",
|
|
"iso646irv": "ascii",
|
|
"us": "ascii",
|
|
|
|
"latin1": "iso88591",
|
|
"latin2": "iso88592",
|
|
"latin3": "iso88593",
|
|
"latin4": "iso88594",
|
|
"latin5": "iso88599",
|
|
"latin6": "iso885910",
|
|
"latin7": "iso885913",
|
|
"latin8": "iso885914",
|
|
"latin9": "iso885915",
|
|
"latin10": "iso885916",
|
|
|
|
"csisolatin1": "iso88591",
|
|
"csisolatin2": "iso88592",
|
|
"csisolatin3": "iso88593",
|
|
"csisolatin4": "iso88594",
|
|
"csisolatincyrillic": "iso88595",
|
|
"csisolatinarabic": "iso88596",
|
|
"csisolatingreek" : "iso88597",
|
|
"csisolatinhebrew": "iso88598",
|
|
"csisolatin5": "iso88599",
|
|
"csisolatin6": "iso885910",
|
|
|
|
"l1": "iso88591",
|
|
"l2": "iso88592",
|
|
"l3": "iso88593",
|
|
"l4": "iso88594",
|
|
"l5": "iso88599",
|
|
"l6": "iso885910",
|
|
"l7": "iso885913",
|
|
"l8": "iso885914",
|
|
"l9": "iso885915",
|
|
"l10": "iso885916",
|
|
|
|
"isoir14": "iso646jp",
|
|
"isoir57": "iso646cn",
|
|
"isoir100": "iso88591",
|
|
"isoir101": "iso88592",
|
|
"isoir109": "iso88593",
|
|
"isoir110": "iso88594",
|
|
"isoir144": "iso88595",
|
|
"isoir127": "iso88596",
|
|
"isoir126": "iso88597",
|
|
"isoir138": "iso88598",
|
|
"isoir148": "iso88599",
|
|
"isoir157": "iso885910",
|
|
"isoir166": "tis620",
|
|
"isoir179": "iso885913",
|
|
"isoir199": "iso885914",
|
|
"isoir203": "iso885915",
|
|
"isoir226": "iso885916",
|
|
|
|
"cp819": "iso88591",
|
|
"ibm819": "iso88591",
|
|
|
|
"cyrillic": "iso88595",
|
|
|
|
"arabic": "iso88596",
|
|
"arabic8": "iso88596",
|
|
"ecma114": "iso88596",
|
|
"asmo708": "iso88596",
|
|
|
|
"greek" : "iso88597",
|
|
"greek8" : "iso88597",
|
|
"ecma118" : "iso88597",
|
|
"elot928" : "iso88597",
|
|
|
|
"hebrew": "iso88598",
|
|
"hebrew8": "iso88598",
|
|
|
|
"turkish": "iso88599",
|
|
"turkish8": "iso88599",
|
|
|
|
"thai": "iso885911",
|
|
"thai8": "iso885911",
|
|
|
|
"celtic": "iso885914",
|
|
"celtic8": "iso885914",
|
|
"isoceltic": "iso885914",
|
|
|
|
"tis6200": "tis620",
|
|
"tis62025291": "tis620",
|
|
"tis62025330": "tis620",
|
|
|
|
"10000": "macroman",
|
|
"10006": "macgreek",
|
|
"10007": "maccyrillic",
|
|
"10079": "maciceland",
|
|
"10081": "macturkish",
|
|
|
|
"cspc8codepage437": "cp437",
|
|
"cspc775baltic": "cp775",
|
|
"cspc850multilingual": "cp850",
|
|
"cspcp852": "cp852",
|
|
"cspc862latinhebrew": "cp862",
|
|
"cpgr": "cp869",
|
|
|
|
"msee": "cp1250",
|
|
"mscyrl": "cp1251",
|
|
"msansi": "cp1252",
|
|
"msgreek": "cp1253",
|
|
"msturk": "cp1254",
|
|
"mshebr": "cp1255",
|
|
"msarab": "cp1256",
|
|
"winbaltrim": "cp1257",
|
|
|
|
"cp20866": "koi8r",
|
|
"20866": "koi8r",
|
|
"ibm878": "koi8r",
|
|
"cskoi8r": "koi8r",
|
|
|
|
"cp21866": "koi8u",
|
|
"21866": "koi8u",
|
|
"ibm1168": "koi8u",
|
|
|
|
"strk10482002": "rk1048",
|
|
|
|
"tcvn5712": "tcvn",
|
|
"tcvn57121": "tcvn",
|
|
|
|
"gb198880": "iso646cn",
|
|
"cn": "iso646cn",
|
|
|
|
"csiso14jisc6220ro": "iso646jp",
|
|
"jisc62201969ro": "iso646jp",
|
|
"jp": "iso646jp",
|
|
|
|
"cshproman8": "hproman8",
|
|
"r8": "hproman8",
|
|
"roman8": "hproman8",
|
|
"xroman8": "hproman8",
|
|
"ibm1051": "hproman8",
|
|
|
|
"mac": "macintosh",
|
|
"csmacintosh": "macintosh",
|
|
};
|
|
|
|
|
|
|
|
/***/ },
|
|
/* 92 */
|
|
/***/ function(module, exports) {
|
|
|
|
"use strict"
|
|
|
|
// Generated data for sbcs codec. Don't edit manually. Regenerate using generation/gen-sbcs.js script.
|
|
module.exports = {
|
|
"437": "cp437",
|
|
"737": "cp737",
|
|
"775": "cp775",
|
|
"850": "cp850",
|
|
"852": "cp852",
|
|
"855": "cp855",
|
|
"856": "cp856",
|
|
"857": "cp857",
|
|
"858": "cp858",
|
|
"860": "cp860",
|
|
"861": "cp861",
|
|
"862": "cp862",
|
|
"863": "cp863",
|
|
"864": "cp864",
|
|
"865": "cp865",
|
|
"866": "cp866",
|
|
"869": "cp869",
|
|
"874": "windows874",
|
|
"922": "cp922",
|
|
"1046": "cp1046",
|
|
"1124": "cp1124",
|
|
"1125": "cp1125",
|
|
"1129": "cp1129",
|
|
"1133": "cp1133",
|
|
"1161": "cp1161",
|
|
"1162": "cp1162",
|
|
"1163": "cp1163",
|
|
"1250": "windows1250",
|
|
"1251": "windows1251",
|
|
"1252": "windows1252",
|
|
"1253": "windows1253",
|
|
"1254": "windows1254",
|
|
"1255": "windows1255",
|
|
"1256": "windows1256",
|
|
"1257": "windows1257",
|
|
"1258": "windows1258",
|
|
"28591": "iso88591",
|
|
"28592": "iso88592",
|
|
"28593": "iso88593",
|
|
"28594": "iso88594",
|
|
"28595": "iso88595",
|
|
"28596": "iso88596",
|
|
"28597": "iso88597",
|
|
"28598": "iso88598",
|
|
"28599": "iso88599",
|
|
"28600": "iso885910",
|
|
"28601": "iso885911",
|
|
"28603": "iso885913",
|
|
"28604": "iso885914",
|
|
"28605": "iso885915",
|
|
"28606": "iso885916",
|
|
"windows874": {
|
|
"type": "_sbcs",
|
|
"chars": "€����…�����������‘’“”•–—�������� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"
|
|
},
|
|
"win874": "windows874",
|
|
"cp874": "windows874",
|
|
"windows1250": {
|
|
"type": "_sbcs",
|
|
"chars": "€�‚�„…†‡�‰Š‹ŚŤŽŹ�‘’“”•–—�™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙"
|
|
},
|
|
"win1250": "windows1250",
|
|
"cp1250": "windows1250",
|
|
"windows1251": {
|
|
"type": "_sbcs",
|
|
"chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬®Ї°±Ііґµ¶·ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"
|
|
},
|
|
"win1251": "windows1251",
|
|
"cp1251": "windows1251",
|
|
"windows1252": {
|
|
"type": "_sbcs",
|
|
"chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
|
|
},
|
|
"win1252": "windows1252",
|
|
"cp1252": "windows1252",
|
|
"windows1253": {
|
|
"type": "_sbcs",
|
|
"chars": "€�‚ƒ„…†‡�‰�‹�����‘’“”•–—�™�›���� ΅Ά£¤¥¦§¨©�«¬®―°±²³΄µ¶·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�"
|
|
},
|
|
"win1253": "windows1253",
|
|
"cp1253": "windows1253",
|
|
"windows1254": {
|
|
"type": "_sbcs",
|
|
"chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ����‘’“”•–—˜™š›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ"
|
|
},
|
|
"win1254": "windows1254",
|
|
"cp1254": "windows1254",
|
|
"windows1255": {
|
|
"type": "_sbcs",
|
|
"chars": "€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹ�ֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת���"
|
|
},
|
|
"win1255": "windows1255",
|
|
"cp1255": "windows1255",
|
|
"windows1256": {
|
|
"type": "_sbcs",
|
|
"chars": "€پ‚ƒ„…†‡ˆ‰ٹ‹Œچژڈگ‘’“”•–—ک™ڑ›œں ،¢£¤¥¦§¨©ھ«¬®¯°±²³´µ¶·¸¹؛»¼½¾؟ہءآأؤإئابةتثجحخدذرزسشصض×طظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِ÷ّùْûüے"
|
|
},
|
|
"win1256": "windows1256",
|
|
"cp1256": "windows1256",
|
|
"windows1257": {
|
|
"type": "_sbcs",
|
|
"chars": "€�‚�„…†‡�‰�‹�¨ˇ¸�‘’“”•–—�™�›�¯˛� �¢£¤�¦§Ø©Ŗ«¬®Æ°±²³´µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž˙"
|
|
},
|
|
"win1257": "windows1257",
|
|
"cp1257": "windows1257",
|
|
"windows1258": {
|
|
"type": "_sbcs",
|
|
"chars": "€�‚ƒ„…†‡ˆ‰�‹Œ����‘’“”•–—˜™�›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"
|
|
},
|
|
"win1258": "windows1258",
|
|
"cp1258": "windows1258",
|
|
"iso88591": {
|
|
"type": "_sbcs",
|
|
"chars": "
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
|
|
},
|
|
"cp28591": "iso88591",
|
|
"iso88592": {
|
|
"type": "_sbcs",
|
|
"chars": "
Ą˘Ł¤ĽŚ§¨ŠŞŤŹŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙"
|
|
},
|
|
"cp28592": "iso88592",
|
|
"iso88593": {
|
|
"type": "_sbcs",
|
|
"chars": "
Ħ˘£¤�Ĥ§¨İŞĞĴ�Ż°ħ²³´µĥ·¸ışğĵ½�żÀÁÂ�ÄĊĈÇÈÉÊËÌÍÎÏ�ÑÒÓÔĠÖ×ĜÙÚÛÜŬŜßàáâ�äċĉçèéêëìíîï�ñòóôġö÷ĝùúûüŭŝ˙"
|
|
},
|
|
"cp28593": "iso88593",
|
|
"iso88594": {
|
|
"type": "_sbcs",
|
|
"chars": "
ĄĸŖ¤ĨĻ§¨ŠĒĢŦŽ¯°ą˛ŗ´ĩļˇ¸šēģŧŊžŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎĪĐŅŌĶÔÕÖ×ØŲÚÛÜŨŪßāáâãäåæįčéęëėíîīđņōķôõö÷øųúûüũū˙"
|
|
},
|
|
"cp28594": "iso88594",
|
|
"iso88595": {
|
|
"type": "_sbcs",
|
|
"chars": "
ЁЂЃЄЅІЇЈЉЊЋЌЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђѓєѕіїјљњћќ§ўџ"
|
|
},
|
|
"cp28595": "iso88595",
|
|
"iso88596": {
|
|
"type": "_sbcs",
|
|
"chars": "
���¤�������،�������������؛���؟�ءآأؤإئابةتثجحخدذرزسشصضطظعغ�����ـفقكلمنهوىيًٌٍَُِّْ�������������"
|
|
},
|
|
"cp28596": "iso88596",
|
|
"iso88597": {
|
|
"type": "_sbcs",
|
|
"chars": "
‘’£€₯¦§¨©ͺ«¬�―°±²³΄΅Ά·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�"
|
|
},
|
|
"cp28597": "iso88597",
|
|
"iso88598": {
|
|
"type": "_sbcs",
|
|
"chars": "
�¢£¤¥¦§¨©×«¬®¯°±²³´µ¶·¸¹÷»¼½¾��������������������������������‗אבגדהוזחטיךכלםמןנסעףפץצקרשת���"
|
|
},
|
|
"cp28598": "iso88598",
|
|
"iso88599": {
|
|
"type": "_sbcs",
|
|
"chars": "
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ"
|
|
},
|
|
"cp28599": "iso88599",
|
|
"iso885910": {
|
|
"type": "_sbcs",
|
|
"chars": "
ĄĒĢĪĨĶ§ĻĐŠŦŽŪŊ°ąēģīĩķ·ļđšŧž―ūŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎÏÐŅŌÓÔÕÖŨØŲÚÛÜÝÞßāáâãäåæįčéęëėíîïðņōóôõöũøųúûüýþĸ"
|
|
},
|
|
"cp28600": "iso885910",
|
|
"iso885911": {
|
|
"type": "_sbcs",
|
|
"chars": "
กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"
|
|
},
|
|
"cp28601": "iso885911",
|
|
"iso885913": {
|
|
"type": "_sbcs",
|
|
"chars": "
”¢£¤„¦§Ø©Ŗ«¬®Æ°±²³“µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž’"
|
|
},
|
|
"cp28603": "iso885913",
|
|
"iso885914": {
|
|
"type": "_sbcs",
|
|
"chars": "
Ḃḃ£ĊċḊ§Ẁ©ẂḋỲ®ŸḞḟĠġṀṁ¶ṖẁṗẃṠỳẄẅṡÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŴÑÒÓÔÕÖṪØÙÚÛÜÝŶßàáâãäåæçèéêëìíîïŵñòóôõöṫøùúûüýŷÿ"
|
|
},
|
|
"cp28604": "iso885914",
|
|
"iso885915": {
|
|
"type": "_sbcs",
|
|
"chars": "
¡¢£€¥Š§š©ª«¬®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
|
|
},
|
|
"cp28605": "iso885915",
|
|
"iso885916": {
|
|
"type": "_sbcs",
|
|
"chars": "
ĄąŁ€„Š§š©Ș«ŹźŻ°±ČłŽ”¶·žčș»ŒœŸżÀÁÂĂÄĆÆÇÈÉÊËÌÍÎÏĐŃÒÓÔŐÖŚŰÙÚÛÜĘȚßàáâăäćæçèéêëìíîïđńòóôőöśűùúûüęțÿ"
|
|
},
|
|
"cp28606": "iso885916",
|
|
"cp437": {
|
|
"type": "_sbcs",
|
|
"chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
|
|
},
|
|
"ibm437": "cp437",
|
|
"csibm437": "cp437",
|
|
"cp737": {
|
|
"type": "_sbcs",
|
|
"chars": "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ "
|
|
},
|
|
"ibm737": "cp737",
|
|
"csibm737": "cp737",
|
|
"cp775": {
|
|
"type": "_sbcs",
|
|
"chars": "ĆüéāäģåćłēŖŗīŹÄÅÉæÆōöĢ¢ŚśÖÜø£ØפĀĪóŻżź”¦©®¬½¼Ł«»░▒▓│┤ĄČĘĖ╣║╗╝ĮŠ┐└┴┬├─┼ŲŪ╚╔╩╦╠═╬Žąčęėįšųūž┘┌█▄▌▐▀ÓßŌŃõÕµńĶķĻļņĒŅ’±“¾¶§÷„°∙·¹³²■ "
|
|
},
|
|
"ibm775": "cp775",
|
|
"csibm775": "cp775",
|
|
"cp850": {
|
|
"type": "_sbcs",
|
|
"chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈıÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´±‗¾¶§÷¸°¨·¹³²■ "
|
|
},
|
|
"ibm850": "cp850",
|
|
"csibm850": "cp850",
|
|
"cp852": {
|
|
"type": "_sbcs",
|
|
"chars": "ÇüéâäůćçłëŐőîŹÄĆÉĹĺôöĽľŚśÖÜŤťŁ×čáíóúĄąŽžĘ꬟Ⱥ«»░▒▓│┤ÁÂĚŞ╣║╗╝Żż┐└┴┬├─┼Ăă╚╔╩╦╠═╬¤đĐĎËďŇÍÎě┘┌█▄ŢŮ▀ÓßÔŃńňŠšŔÚŕŰýÝţ´˝˛ˇ˘§÷¸°¨˙űŘř■ "
|
|
},
|
|
"ibm852": "cp852",
|
|
"csibm852": "cp852",
|
|
"cp855": {
|
|
"type": "_sbcs",
|
|
"chars": "ђЂѓЃёЁєЄѕЅіІїЇјЈљЉњЊћЋќЌўЎџЏюЮъЪаАбБцЦдДеЕфФгГ«»░▒▓│┤хХиИ╣║╗╝йЙ┐└┴┬├─┼кК╚╔╩╦╠═╬¤лЛмМнНоОп┘┌█▄Пя▀ЯрРсСтТуУжЖвВьЬ№ыЫзЗшШэЭщЩчЧ§■ "
|
|
},
|
|
"ibm855": "cp855",
|
|
"csibm855": "cp855",
|
|
"cp856": {
|
|
"type": "_sbcs",
|
|
"chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת�£�×����������®¬½¼�«»░▒▓│┤���©╣║╗╝¢¥┐└┴┬├─┼��╚╔╩╦╠═╬¤���������┘┌█▄¦�▀������µ�������¯´±‗¾¶§÷¸°¨·¹³²■ "
|
|
},
|
|
"ibm856": "cp856",
|
|
"csibm856": "cp856",
|
|
"cp857": {
|
|
"type": "_sbcs",
|
|
"chars": "ÇüéâäàåçêëèïîıÄÅÉæÆôöòûùİÖÜø£ØŞşáíóúñÑĞ𿮬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ºªÊËÈ�ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµ�×ÚÛÙìÿ¯´±�¾¶§÷¸°¨·¹³²■ "
|
|
},
|
|
"ibm857": "cp857",
|
|
"csibm857": "cp857",
|
|
"cp858": {
|
|
"type": "_sbcs",
|
|
"chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈ€ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´±‗¾¶§÷¸°¨·¹³²■ "
|
|
},
|
|
"ibm858": "cp858",
|
|
"csibm858": "cp858",
|
|
"cp860": {
|
|
"type": "_sbcs",
|
|
"chars": "ÇüéâãàÁçêÊèÍÔìÃÂÉÀÈôõòÚùÌÕÜ¢£Ù₧ÓáíóúñѪº¿Ò¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
|
|
},
|
|
"ibm860": "cp860",
|
|
"csibm860": "cp860",
|
|
"cp861": {
|
|
"type": "_sbcs",
|
|
"chars": "ÇüéâäàåçêëèÐðÞÄÅÉæÆôöþûÝýÖÜø£Ø₧ƒáíóúÁÍÓÚ¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
|
|
},
|
|
"ibm861": "cp861",
|
|
"csibm861": "cp861",
|
|
"cp862": {
|
|
"type": "_sbcs",
|
|
"chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
|
|
},
|
|
"ibm862": "cp862",
|
|
"csibm862": "cp862",
|
|
"cp863": {
|
|
"type": "_sbcs",
|
|
"chars": "ÇüéâÂà¶çêëèïî‗À§ÉÈÊôËÏûù¤ÔÜ¢£ÙÛƒ¦´óú¨¸³¯Î⌐¬½¼¾«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
|
|
},
|
|
"ibm863": "cp863",
|
|
"csibm863": "cp863",
|
|
"cp864": {
|
|
"type": "_sbcs",
|
|
"chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�"
|
|
},
|
|
"ibm864": "cp864",
|
|
"csibm864": "cp864",
|
|
"cp865": {
|
|
"type": "_sbcs",
|
|
"chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
|
|
},
|
|
"ibm865": "cp865",
|
|
"csibm865": "cp865",
|
|
"cp866": {
|
|
"type": "_sbcs",
|
|
"chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ "
|
|
},
|
|
"ibm866": "cp866",
|
|
"csibm866": "cp866",
|
|
"cp869": {
|
|
"type": "_sbcs",
|
|
"chars": "������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄±υφχ§ψ΅°¨ωϋΰώ■ "
|
|
},
|
|
"ibm869": "cp869",
|
|
"csibm869": "cp869",
|
|
"cp922": {
|
|
"type": "_sbcs",
|
|
"chars": "
¡¢£¤¥¦§¨©ª«¬®‾°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖ×ØÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ"
|
|
},
|
|
"ibm922": "cp922",
|
|
"csibm922": "cp922",
|
|
"cp1046": {
|
|
"type": "_sbcs",
|
|
"chars": "ﺈ×÷ﹱ■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ�"
|
|
},
|
|
"ibm1046": "cp1046",
|
|
"csibm1046": "cp1046",
|
|
"cp1124": {
|
|
"type": "_sbcs",
|
|
"chars": "
ЁЂҐЄЅІЇЈЉЊЋЌЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ"
|
|
},
|
|
"ibm1124": "cp1124",
|
|
"csibm1124": "cp1124",
|
|
"cp1125": {
|
|
"type": "_sbcs",
|
|
"chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ "
|
|
},
|
|
"ibm1125": "cp1125",
|
|
"csibm1125": "cp1125",
|
|
"cp1129": {
|
|
"type": "_sbcs",
|
|
"chars": "
¡¢£¤¥¦§œ©ª«¬®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"
|
|
},
|
|
"ibm1129": "cp1129",
|
|
"csibm1129": "cp1129",
|
|
"cp1133": {
|
|
"type": "_sbcs",
|
|
"chars": "
ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�"
|
|
},
|
|
"ibm1133": "cp1133",
|
|
"csibm1133": "cp1133",
|
|
"cp1161": {
|
|
"type": "_sbcs",
|
|
"chars": "��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ "
|
|
},
|
|
"ibm1161": "cp1161",
|
|
"csibm1161": "cp1161",
|
|
"cp1162": {
|
|
"type": "_sbcs",
|
|
"chars": "€…‘’“”•–— กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"
|
|
},
|
|
"ibm1162": "cp1162",
|
|
"csibm1162": "cp1162",
|
|
"cp1163": {
|
|
"type": "_sbcs",
|
|
"chars": "
¡¢£€¥¦§œ©ª«¬®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"
|
|
},
|
|
"ibm1163": "cp1163",
|
|
"csibm1163": "cp1163",
|
|
"maccroatian": {
|
|
"type": "_sbcs",
|
|
"chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈Ć«Č… ÀÃÕŒœĐ—“”‘’÷◊�©⁄¤‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ"
|
|
},
|
|
"maccyrillic": {
|
|
"type": "_sbcs",
|
|
"chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°¢£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµ∂ЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤"
|
|
},
|
|
"macgreek": {
|
|
"type": "_sbcs",
|
|
"chars": "Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ�"
|
|
},
|
|
"maciceland": {
|
|
"type": "_sbcs",
|
|
"chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüÝ°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"
|
|
},
|
|
"macroman": {
|
|
"type": "_sbcs",
|
|
"chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"
|
|
},
|
|
"macromania": {
|
|
"type": "_sbcs",
|
|
"chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂŞ∞±≤≥¥µ∂∑∏π∫ªºΩăş¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›Ţţ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"
|
|
},
|
|
"macthai": {
|
|
"type": "_sbcs",
|
|
"chars": "«»…“”�•‘’� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู–—฿เแโใไๅๆ็่้๊๋์ํ™๏๐๑๒๓๔๕๖๗๘๙®©����"
|
|
},
|
|
"macturkish": {
|
|
"type": "_sbcs",
|
|
"chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙ�ˆ˜¯˘˙˚¸˝˛ˇ"
|
|
},
|
|
"macukraine": {
|
|
"type": "_sbcs",
|
|
"chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤"
|
|
},
|
|
"koi8r": {
|
|
"type": "_sbcs",
|
|
"chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ё╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡Ё╢╣╤╥╦╧╨╩╪╫╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ"
|
|
},
|
|
"koi8u": {
|
|
"type": "_sbcs",
|
|
"chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґ╝╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪Ґ╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ"
|
|
},
|
|
"koi8ru": {
|
|
"type": "_sbcs",
|
|
"chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґў╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪ҐЎ©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ"
|
|
},
|
|
"koi8t": {
|
|
"type": "_sbcs",
|
|
"chars": "қғ‚Ғ„…†‡�‰ҳ‹ҲҷҶ�Қ‘’“”•–—�™�›�����ӯӮё¤ӣ¦§���«¬®�°±²Ё�Ӣ¶·�№�»���©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ"
|
|
},
|
|
"armscii8": {
|
|
"type": "_sbcs",
|
|
"chars": "
�և։)(»«—.՝,-֊…՜՛՞ԱաԲբԳգԴդԵեԶզԷէԸըԹթԺժԻիԼլԽխԾծԿկՀհՁձՂղՃճՄմՅյՆնՇշՈոՉչՊպՋջՌռՍսՎվՏտՐրՑցՒւՓփՔքՕօՖֆ՚�"
|
|
},
|
|
"rk1048": {
|
|
"type": "_sbcs",
|
|
"chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊҚҺЏђ‘’“”•–—�™љ›њқһџ ҰұӘ¤Ө¦§Ё©Ғ«¬®Ү°±Ііөµ¶·ё№ғ»әҢңүАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"
|
|
},
|
|
"tcvn": {
|
|
"type": "_sbcs",
|
|
"chars": "\u0000ÚỤ\u0003ỪỬỮ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010ỨỰỲỶỸÝỴ\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ"
|
|
},
|
|
"georgianacademy": {
|
|
"type": "_sbcs",
|
|
"chars": "‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
|
|
},
|
|
"georgianps": {
|
|
"type": "_sbcs",
|
|
"chars": "‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
|
|
},
|
|
"pt154": {
|
|
"type": "_sbcs",
|
|
"chars": "ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө¶·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"
|
|
},
|
|
"viscii": {
|
|
"type": "_sbcs",
|
|
"chars": "\u0000\u0001Ẳ\u0003\u0004ẴẪ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013Ỷ\u0015\u0016\u0017\u0018Ỹ\u001a\u001b\u001c\u001dỴ\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ"
|
|
},
|
|
"iso646cn": {
|
|
"type": "_sbcs",
|
|
"chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������"
|
|
},
|
|
"iso646jp": {
|
|
"type": "_sbcs",
|
|
"chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������"
|
|
},
|
|
"hproman8": {
|
|
"type": "_sbcs",
|
|
"chars": "
ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¶¾—¼½ªº«■»±�"
|
|
},
|
|
"macintosh": {
|
|
"type": "_sbcs",
|
|
"chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"
|
|
},
|
|
"ascii": {
|
|
"type": "_sbcs",
|
|
"chars": "��������������������������������������������������������������������������������������������������������������������������������"
|
|
},
|
|
"tis620": {
|
|
"type": "_sbcs",
|
|
"chars": "���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"
|
|
}
|
|
}
|
|
|
|
/***/ },
|
|
/* 93 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"
|
|
|
|
// Multibyte codec. In this scheme, a character is represented by 1 or more bytes.
|
|
// Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences.
|
|
// To save memory and loading time, we read table files only when requested.
|
|
|
|
exports._dbcs = DBCSCodec;
|
|
|
|
var UNASSIGNED = -1,
|
|
GB18030_CODE = -2,
|
|
SEQ_START = -10,
|
|
NODE_START = -1000,
|
|
UNASSIGNED_NODE = new Array(0x100),
|
|
DEF_CHAR = -1;
|
|
|
|
for (var i = 0; i < 0x100; i++)
|
|
UNASSIGNED_NODE[i] = UNASSIGNED;
|
|
|
|
|
|
// Class DBCSCodec reads and initializes mapping tables.
|
|
function DBCSCodec(codecOptions, iconv) {
|
|
this.encodingName = codecOptions.encodingName;
|
|
if (!codecOptions)
|
|
throw new Error("DBCS codec is called without the data.")
|
|
if (!codecOptions.table)
|
|
throw new Error("Encoding '" + this.encodingName + "' has no data.");
|
|
|
|
// Load tables.
|
|
var mappingTable = codecOptions.table();
|
|
|
|
|
|
// Decode tables: MBCS -> Unicode.
|
|
|
|
// decodeTables is a trie, encoded as an array of arrays of integers. Internal arrays are trie nodes and all have len = 256.
|
|
// Trie root is decodeTables[0].
|
|
// Values: >= 0 -> unicode character code. can be > 0xFFFF
|
|
// == UNASSIGNED -> unknown/unassigned sequence.
|
|
// == GB18030_CODE -> this is the end of a GB18030 4-byte sequence.
|
|
// <= NODE_START -> index of the next node in our trie to process next byte.
|
|
// <= SEQ_START -> index of the start of a character code sequence, in decodeTableSeq.
|
|
this.decodeTables = [];
|
|
this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node.
|
|
|
|
// Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here.
|
|
this.decodeTableSeq = [];
|
|
|
|
// Actual mapping tables consist of chunks. Use them to fill up decode tables.
|
|
for (var i = 0; i < mappingTable.length; i++)
|
|
this._addDecodeChunk(mappingTable[i]);
|
|
|
|
this.defaultCharUnicode = iconv.defaultCharUnicode;
|
|
|
|
|
|
// Encode tables: Unicode -> DBCS.
|
|
|
|
// `encodeTable` is array mapping from unicode char to encoded char. All its values are integers for performance.
|
|
// Because it can be sparse, it is represented as array of buckets by 256 chars each. Bucket can be null.
|
|
// Values: >= 0 -> it is a normal char. Write the value (if <=256 then 1 byte, if <=65536 then 2 bytes, etc.).
|
|
// == UNASSIGNED -> no conversion found. Output a default char.
|
|
// <= SEQ_START -> it's an index in encodeTableSeq, see below. The character starts a sequence.
|
|
this.encodeTable = [];
|
|
|
|
// `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of
|
|
// objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key
|
|
// means end of sequence (needed when one sequence is a strict subsequence of another).
|
|
// Objects are kept separately from encodeTable to increase performance.
|
|
this.encodeTableSeq = [];
|
|
|
|
// Some chars can be decoded, but need not be encoded.
|
|
var skipEncodeChars = {};
|
|
if (codecOptions.encodeSkipVals)
|
|
for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) {
|
|
var val = codecOptions.encodeSkipVals[i];
|
|
if (typeof val === 'number')
|
|
skipEncodeChars[val] = true;
|
|
else
|
|
for (var j = val.from; j <= val.to; j++)
|
|
skipEncodeChars[j] = true;
|
|
}
|
|
|
|
// Use decode trie to recursively fill out encode tables.
|
|
this._fillEncodeTable(0, 0, skipEncodeChars);
|
|
|
|
// Add more encoding pairs when needed.
|
|
if (codecOptions.encodeAdd) {
|
|
for (var uChar in codecOptions.encodeAdd)
|
|
if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar))
|
|
this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]);
|
|
}
|
|
|
|
this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)];
|
|
if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?'];
|
|
if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0);
|
|
|
|
|
|
// Load & create GB18030 tables when needed.
|
|
if (typeof codecOptions.gb18030 === 'function') {
|
|
this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges.
|
|
|
|
// Add GB18030 decode tables.
|
|
var thirdByteNodeIdx = this.decodeTables.length;
|
|
var thirdByteNode = this.decodeTables[thirdByteNodeIdx] = UNASSIGNED_NODE.slice(0);
|
|
|
|
var fourthByteNodeIdx = this.decodeTables.length;
|
|
var fourthByteNode = this.decodeTables[fourthByteNodeIdx] = UNASSIGNED_NODE.slice(0);
|
|
|
|
for (var i = 0x81; i <= 0xFE; i++) {
|
|
var secondByteNodeIdx = NODE_START - this.decodeTables[0][i];
|
|
var secondByteNode = this.decodeTables[secondByteNodeIdx];
|
|
for (var j = 0x30; j <= 0x39; j++)
|
|
secondByteNode[j] = NODE_START - thirdByteNodeIdx;
|
|
}
|
|
for (var i = 0x81; i <= 0xFE; i++)
|
|
thirdByteNode[i] = NODE_START - fourthByteNodeIdx;
|
|
for (var i = 0x30; i <= 0x39; i++)
|
|
fourthByteNode[i] = GB18030_CODE
|
|
}
|
|
}
|
|
|
|
DBCSCodec.prototype.encoder = DBCSEncoder;
|
|
DBCSCodec.prototype.decoder = DBCSDecoder;
|
|
|
|
// Decoder helpers
|
|
DBCSCodec.prototype._getDecodeTrieNode = function(addr) {
|
|
var bytes = [];
|
|
for (; addr > 0; addr >>= 8)
|
|
bytes.push(addr & 0xFF);
|
|
if (bytes.length == 0)
|
|
bytes.push(0);
|
|
|
|
var node = this.decodeTables[0];
|
|
for (var i = bytes.length-1; i > 0; i--) { // Traverse nodes deeper into the trie.
|
|
var val = node[bytes[i]];
|
|
|
|
if (val == UNASSIGNED) { // Create new node.
|
|
node[bytes[i]] = NODE_START - this.decodeTables.length;
|
|
this.decodeTables.push(node = UNASSIGNED_NODE.slice(0));
|
|
}
|
|
else if (val <= NODE_START) { // Existing node.
|
|
node = this.decodeTables[NODE_START - val];
|
|
}
|
|
else
|
|
throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16));
|
|
}
|
|
return node;
|
|
}
|
|
|
|
|
|
DBCSCodec.prototype._addDecodeChunk = function(chunk) {
|
|
// First element of chunk is the hex mbcs code where we start.
|
|
var curAddr = parseInt(chunk[0], 16);
|
|
|
|
// Choose the decoding node where we'll write our chars.
|
|
var writeTable = this._getDecodeTrieNode(curAddr);
|
|
curAddr = curAddr & 0xFF;
|
|
|
|
// Write all other elements of the chunk to the table.
|
|
for (var k = 1; k < chunk.length; k++) {
|
|
var part = chunk[k];
|
|
if (typeof part === "string") { // String, write as-is.
|
|
for (var l = 0; l < part.length;) {
|
|
var code = part.charCodeAt(l++);
|
|
if (0xD800 <= code && code < 0xDC00) { // Decode surrogate
|
|
var codeTrail = part.charCodeAt(l++);
|
|
if (0xDC00 <= codeTrail && codeTrail < 0xE000)
|
|
writeTable[curAddr++] = 0x10000 + (code - 0xD800) * 0x400 + (codeTrail - 0xDC00);
|
|
else
|
|
throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]);
|
|
}
|
|
else if (0x0FF0 < code && code <= 0x0FFF) { // Character sequence (our own encoding used)
|
|
var len = 0xFFF - code + 2;
|
|
var seq = [];
|
|
for (var m = 0; m < len; m++)
|
|
seq.push(part.charCodeAt(l++)); // Simple variation: don't support surrogates or subsequences in seq.
|
|
|
|
writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length;
|
|
this.decodeTableSeq.push(seq);
|
|
}
|
|
else
|
|
writeTable[curAddr++] = code; // Basic char
|
|
}
|
|
}
|
|
else if (typeof part === "number") { // Integer, meaning increasing sequence starting with prev character.
|
|
var charCode = writeTable[curAddr - 1] + 1;
|
|
for (var l = 0; l < part; l++)
|
|
writeTable[curAddr++] = charCode++;
|
|
}
|
|
else
|
|
throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]);
|
|
}
|
|
if (curAddr > 0xFF)
|
|
throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr);
|
|
}
|
|
|
|
// Encoder helpers
|
|
DBCSCodec.prototype._getEncodeBucket = function(uCode) {
|
|
var high = uCode >> 8; // This could be > 0xFF because of astral characters.
|
|
if (this.encodeTable[high] === undefined)
|
|
this.encodeTable[high] = UNASSIGNED_NODE.slice(0); // Create bucket on demand.
|
|
return this.encodeTable[high];
|
|
}
|
|
|
|
DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) {
|
|
var bucket = this._getEncodeBucket(uCode);
|
|
var low = uCode & 0xFF;
|
|
if (bucket[low] <= SEQ_START)
|
|
this.encodeTableSeq[SEQ_START-bucket[low]][DEF_CHAR] = dbcsCode; // There's already a sequence, set a single-char subsequence of it.
|
|
else if (bucket[low] == UNASSIGNED)
|
|
bucket[low] = dbcsCode;
|
|
}
|
|
|
|
DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) {
|
|
|
|
// Get the root of character tree according to first character of the sequence.
|
|
var uCode = seq[0];
|
|
var bucket = this._getEncodeBucket(uCode);
|
|
var low = uCode & 0xFF;
|
|
|
|
var node;
|
|
if (bucket[low] <= SEQ_START) {
|
|
// There's already a sequence with - use it.
|
|
node = this.encodeTableSeq[SEQ_START-bucket[low]];
|
|
}
|
|
else {
|
|
// There was no sequence object - allocate a new one.
|
|
node = {};
|
|
if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low]; // If a char was set before - make it a single-char subsequence.
|
|
bucket[low] = SEQ_START - this.encodeTableSeq.length;
|
|
this.encodeTableSeq.push(node);
|
|
}
|
|
|
|
// Traverse the character tree, allocating new nodes as needed.
|
|
for (var j = 1; j < seq.length-1; j++) {
|
|
var oldVal = node[uCode];
|
|
if (typeof oldVal === 'object')
|
|
node = oldVal;
|
|
else {
|
|
node = node[uCode] = {}
|
|
if (oldVal !== undefined)
|
|
node[DEF_CHAR] = oldVal
|
|
}
|
|
}
|
|
|
|
// Set the leaf to given dbcsCode.
|
|
uCode = seq[seq.length-1];
|
|
node[uCode] = dbcsCode;
|
|
}
|
|
|
|
DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) {
|
|
var node = this.decodeTables[nodeIdx];
|
|
for (var i = 0; i < 0x100; i++) {
|
|
var uCode = node[i];
|
|
var mbCode = prefix + i;
|
|
if (skipEncodeChars[mbCode])
|
|
continue;
|
|
|
|
if (uCode >= 0)
|
|
this._setEncodeChar(uCode, mbCode);
|
|
else if (uCode <= NODE_START)
|
|
this._fillEncodeTable(NODE_START - uCode, mbCode << 8, skipEncodeChars);
|
|
else if (uCode <= SEQ_START)
|
|
this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// == Encoder ==================================================================
|
|
|
|
function DBCSEncoder(options, codec) {
|
|
// Encoder state
|
|
this.leadSurrogate = -1;
|
|
this.seqObj = undefined;
|
|
|
|
// Static data
|
|
this.encodeTable = codec.encodeTable;
|
|
this.encodeTableSeq = codec.encodeTableSeq;
|
|
this.defaultCharSingleByte = codec.defCharSB;
|
|
this.gb18030 = codec.gb18030;
|
|
}
|
|
|
|
DBCSEncoder.prototype.write = function(str) {
|
|
var newBuf = new Buffer(str.length * (this.gb18030 ? 4 : 3)),
|
|
leadSurrogate = this.leadSurrogate,
|
|
seqObj = this.seqObj, nextChar = -1,
|
|
i = 0, j = 0;
|
|
|
|
while (true) {
|
|
// 0. Get next character.
|
|
if (nextChar === -1) {
|
|
if (i == str.length) break;
|
|
var uCode = str.charCodeAt(i++);
|
|
}
|
|
else {
|
|
var uCode = nextChar;
|
|
nextChar = -1;
|
|
}
|
|
|
|
// 1. Handle surrogates.
|
|
if (0xD800 <= uCode && uCode < 0xE000) { // Char is one of surrogates.
|
|
if (uCode < 0xDC00) { // We've got lead surrogate.
|
|
if (leadSurrogate === -1) {
|
|
leadSurrogate = uCode;
|
|
continue;
|
|
} else {
|
|
leadSurrogate = uCode;
|
|
// Double lead surrogate found.
|
|
uCode = UNASSIGNED;
|
|
}
|
|
} else { // We've got trail surrogate.
|
|
if (leadSurrogate !== -1) {
|
|
uCode = 0x10000 + (leadSurrogate - 0xD800) * 0x400 + (uCode - 0xDC00);
|
|
leadSurrogate = -1;
|
|
} else {
|
|
// Incomplete surrogate pair - only trail surrogate found.
|
|
uCode = UNASSIGNED;
|
|
}
|
|
|
|
}
|
|
}
|
|
else if (leadSurrogate !== -1) {
|
|
// Incomplete surrogate pair - only lead surrogate found.
|
|
nextChar = uCode; uCode = UNASSIGNED; // Write an error, then current char.
|
|
leadSurrogate = -1;
|
|
}
|
|
|
|
// 2. Convert uCode character.
|
|
var dbcsCode = UNASSIGNED;
|
|
if (seqObj !== undefined && uCode != UNASSIGNED) { // We are in the middle of the sequence
|
|
var resCode = seqObj[uCode];
|
|
if (typeof resCode === 'object') { // Sequence continues.
|
|
seqObj = resCode;
|
|
continue;
|
|
|
|
} else if (typeof resCode == 'number') { // Sequence finished. Write it.
|
|
dbcsCode = resCode;
|
|
|
|
} else if (resCode == undefined) { // Current character is not part of the sequence.
|
|
|
|
// Try default character for this sequence
|
|
resCode = seqObj[DEF_CHAR];
|
|
if (resCode !== undefined) {
|
|
dbcsCode = resCode; // Found. Write it.
|
|
nextChar = uCode; // Current character will be written too in the next iteration.
|
|
|
|
} else {
|
|
// TODO: What if we have no default? (resCode == undefined)
|
|
// Then, we should write first char of the sequence as-is and try the rest recursively.
|
|
// Didn't do it for now because no encoding has this situation yet.
|
|
// Currently, just skip the sequence and write current char.
|
|
}
|
|
}
|
|
seqObj = undefined;
|
|
}
|
|
else if (uCode >= 0) { // Regular character
|
|
var subtable = this.encodeTable[uCode >> 8];
|
|
if (subtable !== undefined)
|
|
dbcsCode = subtable[uCode & 0xFF];
|
|
|
|
if (dbcsCode <= SEQ_START) { // Sequence start
|
|
seqObj = this.encodeTableSeq[SEQ_START-dbcsCode];
|
|
continue;
|
|
}
|
|
|
|
if (dbcsCode == UNASSIGNED && this.gb18030) {
|
|
// Use GB18030 algorithm to find character(s) to write.
|
|
var idx = findIdx(this.gb18030.uChars, uCode);
|
|
if (idx != -1) {
|
|
var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]);
|
|
newBuf[j++] = 0x81 + Math.floor(dbcsCode / 12600); dbcsCode = dbcsCode % 12600;
|
|
newBuf[j++] = 0x30 + Math.floor(dbcsCode / 1260); dbcsCode = dbcsCode % 1260;
|
|
newBuf[j++] = 0x81 + Math.floor(dbcsCode / 10); dbcsCode = dbcsCode % 10;
|
|
newBuf[j++] = 0x30 + dbcsCode;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
|
|
// 3. Write dbcsCode character.
|
|
if (dbcsCode === UNASSIGNED)
|
|
dbcsCode = this.defaultCharSingleByte;
|
|
|
|
if (dbcsCode < 0x100) {
|
|
newBuf[j++] = dbcsCode;
|
|
}
|
|
else if (dbcsCode < 0x10000) {
|
|
newBuf[j++] = dbcsCode >> 8; // high byte
|
|
newBuf[j++] = dbcsCode & 0xFF; // low byte
|
|
}
|
|
else {
|
|
newBuf[j++] = dbcsCode >> 16;
|
|
newBuf[j++] = (dbcsCode >> 8) & 0xFF;
|
|
newBuf[j++] = dbcsCode & 0xFF;
|
|
}
|
|
}
|
|
|
|
this.seqObj = seqObj;
|
|
this.leadSurrogate = leadSurrogate;
|
|
return newBuf.slice(0, j);
|
|
}
|
|
|
|
DBCSEncoder.prototype.end = function() {
|
|
if (this.leadSurrogate === -1 && this.seqObj === undefined)
|
|
return; // All clean. Most often case.
|
|
|
|
var newBuf = new Buffer(10), j = 0;
|
|
|
|
if (this.seqObj) { // We're in the sequence.
|
|
var dbcsCode = this.seqObj[DEF_CHAR];
|
|
if (dbcsCode !== undefined) { // Write beginning of the sequence.
|
|
if (dbcsCode < 0x100) {
|
|
newBuf[j++] = dbcsCode;
|
|
}
|
|
else {
|
|
newBuf[j++] = dbcsCode >> 8; // high byte
|
|
newBuf[j++] = dbcsCode & 0xFF; // low byte
|
|
}
|
|
} else {
|
|
// See todo above.
|
|
}
|
|
this.seqObj = undefined;
|
|
}
|
|
|
|
if (this.leadSurrogate !== -1) {
|
|
// Incomplete surrogate pair - only lead surrogate found.
|
|
newBuf[j++] = this.defaultCharSingleByte;
|
|
this.leadSurrogate = -1;
|
|
}
|
|
|
|
return newBuf.slice(0, j);
|
|
}
|
|
|
|
// Export for testing
|
|
DBCSEncoder.prototype.findIdx = findIdx;
|
|
|
|
|
|
// == Decoder ==================================================================
|
|
|
|
function DBCSDecoder(options, codec) {
|
|
// Decoder state
|
|
this.nodeIdx = 0;
|
|
this.prevBuf = new Buffer(0);
|
|
|
|
// Static data
|
|
this.decodeTables = codec.decodeTables;
|
|
this.decodeTableSeq = codec.decodeTableSeq;
|
|
this.defaultCharUnicode = codec.defaultCharUnicode;
|
|
this.gb18030 = codec.gb18030;
|
|
}
|
|
|
|
DBCSDecoder.prototype.write = function(buf) {
|
|
var newBuf = new Buffer(buf.length*2),
|
|
nodeIdx = this.nodeIdx,
|
|
prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length,
|
|
seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence.
|
|
uCode;
|
|
|
|
if (prevBufOffset > 0) // Make prev buf overlap a little to make it easier to slice later.
|
|
prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]);
|
|
|
|
for (var i = 0, j = 0; i < buf.length; i++) {
|
|
var curByte = (i >= 0) ? buf[i] : prevBuf[i + prevBufOffset];
|
|
|
|
// Lookup in current trie node.
|
|
var uCode = this.decodeTables[nodeIdx][curByte];
|
|
|
|
if (uCode >= 0) {
|
|
// Normal character, just use it.
|
|
}
|
|
else if (uCode === UNASSIGNED) { // Unknown char.
|
|
// TODO: Callback with seq.
|
|
//var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset);
|
|
i = seqStart; // Try to parse again, after skipping first byte of the sequence ('i' will be incremented by 'for' cycle).
|
|
uCode = this.defaultCharUnicode.charCodeAt(0);
|
|
}
|
|
else if (uCode === GB18030_CODE) {
|
|
var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset);
|
|
var ptr = (curSeq[0]-0x81)*12600 + (curSeq[1]-0x30)*1260 + (curSeq[2]-0x81)*10 + (curSeq[3]-0x30);
|
|
var idx = findIdx(this.gb18030.gbChars, ptr);
|
|
uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx];
|
|
}
|
|
else if (uCode <= NODE_START) { // Go to next trie node.
|
|
nodeIdx = NODE_START - uCode;
|
|
continue;
|
|
}
|
|
else if (uCode <= SEQ_START) { // Output a sequence of chars.
|
|
var seq = this.decodeTableSeq[SEQ_START - uCode];
|
|
for (var k = 0; k < seq.length - 1; k++) {
|
|
uCode = seq[k];
|
|
newBuf[j++] = uCode & 0xFF;
|
|
newBuf[j++] = uCode >> 8;
|
|
}
|
|
uCode = seq[seq.length-1];
|
|
}
|
|
else
|
|
throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte);
|
|
|
|
// Write the character to buffer, handling higher planes using surrogate pair.
|
|
if (uCode > 0xFFFF) {
|
|
uCode -= 0x10000;
|
|
var uCodeLead = 0xD800 + Math.floor(uCode / 0x400);
|
|
newBuf[j++] = uCodeLead & 0xFF;
|
|
newBuf[j++] = uCodeLead >> 8;
|
|
|
|
uCode = 0xDC00 + uCode % 0x400;
|
|
}
|
|
newBuf[j++] = uCode & 0xFF;
|
|
newBuf[j++] = uCode >> 8;
|
|
|
|
// Reset trie node.
|
|
nodeIdx = 0; seqStart = i+1;
|
|
}
|
|
|
|
this.nodeIdx = nodeIdx;
|
|
this.prevBuf = (seqStart >= 0) ? buf.slice(seqStart) : prevBuf.slice(seqStart + prevBufOffset);
|
|
return newBuf.slice(0, j).toString('ucs2');
|
|
}
|
|
|
|
DBCSDecoder.prototype.end = function() {
|
|
var ret = '';
|
|
|
|
// Try to parse all remaining chars.
|
|
while (this.prevBuf.length > 0) {
|
|
// Skip 1 character in the buffer.
|
|
ret += this.defaultCharUnicode;
|
|
var buf = this.prevBuf.slice(1);
|
|
|
|
// Parse remaining as usual.
|
|
this.prevBuf = new Buffer(0);
|
|
this.nodeIdx = 0;
|
|
if (buf.length > 0)
|
|
ret += this.write(buf);
|
|
}
|
|
|
|
this.nodeIdx = 0;
|
|
return ret;
|
|
}
|
|
|
|
// Binary search for GB18030. Returns largest i such that table[i] <= val.
|
|
function findIdx(table, val) {
|
|
if (table[0] > val)
|
|
return -1;
|
|
|
|
var l = 0, r = table.length;
|
|
while (l < r-1) { // always table[l] <= val < table[r]
|
|
var mid = l + Math.floor((r-l+1)/2);
|
|
if (table[mid] <= val)
|
|
l = mid;
|
|
else
|
|
r = mid;
|
|
}
|
|
return l;
|
|
}
|
|
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 94 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
"use strict"
|
|
|
|
// Description of supported double byte encodings and aliases.
|
|
// Tables are not require()-d until they are needed to speed up library load.
|
|
// require()-s are direct to support Browserify.
|
|
|
|
module.exports = {
|
|
|
|
// == Japanese/ShiftJIS ====================================================
|
|
// All japanese encodings are based on JIS X set of standards:
|
|
// JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF.
|
|
// JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes.
|
|
// Has several variations in 1978, 1983, 1990 and 1997.
|
|
// JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead.
|
|
// JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233.
|
|
// 2 planes, first is superset of 0208, second - revised 0212.
|
|
// Introduced in 2000, revised 2004. Some characters are in Unicode Plane 2 (0x2xxxx)
|
|
|
|
// Byte encodings are:
|
|
// * Shift_JIS: Compatible with 0201, uses not defined chars in top half as lead bytes for double-byte
|
|
// encoding of 0208. Lead byte ranges: 0x81-0x9F, 0xE0-0xEF; Trail byte ranges: 0x40-0x7E, 0x80-0x9E, 0x9F-0xFC.
|
|
// Windows CP932 is a superset of Shift_JIS. Some companies added more chars, notably KDDI.
|
|
// * EUC-JP: Up to 3 bytes per character. Used mostly on *nixes.
|
|
// 0x00-0x7F - lower part of 0201
|
|
// 0x8E, 0xA1-0xDF - upper part of 0201
|
|
// (0xA1-0xFE)x2 - 0208 plane (94x94).
|
|
// 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94).
|
|
// * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon.
|
|
// Used as-is in ISO2022 family.
|
|
// * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII,
|
|
// 0201-1976 Roman, 0208-1978, 0208-1983.
|
|
// * ISO2022-JP-1: Adds esc seq for 0212-1990.
|
|
// * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7.
|
|
// * ISO2022-JP-3: Adds esc seq for 0201-1976 Kana set, 0213-2000 Planes 1, 2.
|
|
// * ISO2022-JP-2004: Adds 0213-2004 Plane 1.
|
|
//
|
|
// After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes.
|
|
//
|
|
// Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html
|
|
|
|
'shiftjis': {
|
|
type: '_dbcs',
|
|
table: function() { return __webpack_require__(95) },
|
|
encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E},
|
|
encodeSkipVals: [{from: 0xED40, to: 0xF940}],
|
|
},
|
|
'csshiftjis': 'shiftjis',
|
|
'mskanji': 'shiftjis',
|
|
'sjis': 'shiftjis',
|
|
'windows31j': 'shiftjis',
|
|
'ms31j': 'shiftjis',
|
|
'xsjis': 'shiftjis',
|
|
'windows932': 'shiftjis',
|
|
'ms932': 'shiftjis',
|
|
'932': 'shiftjis',
|
|
'cp932': 'shiftjis',
|
|
|
|
'eucjp': {
|
|
type: '_dbcs',
|
|
table: function() { return __webpack_require__(96) },
|
|
encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E},
|
|
},
|
|
|
|
// TODO: KDDI extension to Shift_JIS
|
|
// TODO: IBM CCSID 942 = CP932, but F0-F9 custom chars and other char changes.
|
|
// TODO: IBM CCSID 943 = Shift_JIS = CP932 with original Shift_JIS lower 128 chars.
|
|
|
|
|
|
// == Chinese/GBK ==========================================================
|
|
// http://en.wikipedia.org/wiki/GBK
|
|
// We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder
|
|
|
|
// Oldest GB2312 (1981, ~7600 chars) is a subset of CP936
|
|
'gb2312': 'cp936',
|
|
'gb231280': 'cp936',
|
|
'gb23121980': 'cp936',
|
|
'csgb2312': 'cp936',
|
|
'csiso58gb231280': 'cp936',
|
|
'euccn': 'cp936',
|
|
|
|
// Microsoft's CP936 is a subset and approximation of GBK.
|
|
'windows936': 'cp936',
|
|
'ms936': 'cp936',
|
|
'936': 'cp936',
|
|
'cp936': {
|
|
type: '_dbcs',
|
|
table: function() { return __webpack_require__(97) },
|
|
},
|
|
|
|
// GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other.
|
|
'gbk': {
|
|
type: '_dbcs',
|
|
table: function() { return __webpack_require__(97).concat(__webpack_require__(98)) },
|
|
},
|
|
'xgbk': 'gbk',
|
|
'isoir58': 'gbk',
|
|
|
|
// GB18030 is an algorithmic extension of GBK.
|
|
// Main source: https://www.w3.org/TR/encoding/#gbk-encoder
|
|
// http://icu-project.org/docs/papers/gb18030.html
|
|
// http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml
|
|
// http://www.khngai.com/chinese/charmap/tblgbk.php?page=0
|
|
'gb18030': {
|
|
type: '_dbcs',
|
|
table: function() { return __webpack_require__(97).concat(__webpack_require__(98)) },
|
|
gb18030: function() { return __webpack_require__(99) },
|
|
encodeSkipVals: [0x80],
|
|
encodeAdd: {'€': 0xA2E3},
|
|
},
|
|
|
|
'chinese': 'gb18030',
|
|
|
|
|
|
// == Korean ===============================================================
|
|
// EUC-KR, KS_C_5601 and KS X 1001 are exactly the same.
|
|
'windows949': 'cp949',
|
|
'ms949': 'cp949',
|
|
'949': 'cp949',
|
|
'cp949': {
|
|
type: '_dbcs',
|
|
table: function() { return __webpack_require__(100) },
|
|
},
|
|
|
|
'cseuckr': 'cp949',
|
|
'csksc56011987': 'cp949',
|
|
'euckr': 'cp949',
|
|
'isoir149': 'cp949',
|
|
'korean': 'cp949',
|
|
'ksc56011987': 'cp949',
|
|
'ksc56011989': 'cp949',
|
|
'ksc5601': 'cp949',
|
|
|
|
|
|
// == Big5/Taiwan/Hong Kong ================================================
|
|
// There are lots of tables for Big5 and cp950. Please see the following links for history:
|
|
// http://moztw.org/docs/big5/ http://www.haible.de/bruno/charsets/conversion-tables/Big5.html
|
|
// Variations, in roughly number of defined chars:
|
|
// * Windows CP 950: Microsoft variant of Big5. Canonical: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT
|
|
// * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/
|
|
// * Big5-2003 (Taiwan standard) almost superset of cp950.
|
|
// * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers.
|
|
// * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard.
|
|
// many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years.
|
|
// Plus, it has 4 combining sequences.
|
|
// Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299
|
|
// because big5-hkscs is the only encoding to include astral characters in non-algorithmic way.
|
|
// Implementations are not consistent within browsers; sometimes labeled as just big5.
|
|
// MS Internet Explorer switches from big5 to big5-hkscs when a patch applied.
|
|
// Great discussion & recap of what's going on https://bugzilla.mozilla.org/show_bug.cgi?id=912470#c31
|
|
// In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s.
|
|
// Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt
|
|
// http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt
|
|
//
|
|
// Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder
|
|
// Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong.
|
|
|
|
'windows950': 'cp950',
|
|
'ms950': 'cp950',
|
|
'950': 'cp950',
|
|
'cp950': {
|
|
type: '_dbcs',
|
|
table: function() { return __webpack_require__(101) },
|
|
},
|
|
|
|
// Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus.
|
|
'big5': 'big5hkscs',
|
|
'big5hkscs': {
|
|
type: '_dbcs',
|
|
table: function() { return __webpack_require__(101).concat(__webpack_require__(102)) },
|
|
encodeSkipVals: [0xa2cc],
|
|
},
|
|
|
|
'cnbig5': 'big5hkscs',
|
|
'csbig5': 'big5hkscs',
|
|
'xxbig5': 'big5hkscs',
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 95 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = [
|
|
[
|
|
"0",
|
|
"\u0000",
|
|
128
|
|
],
|
|
[
|
|
"a1",
|
|
"。",
|
|
62
|
|
],
|
|
[
|
|
"8140",
|
|
" 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈",
|
|
9,
|
|
"+-±×"
|
|
],
|
|
[
|
|
"8180",
|
|
"÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇◆□■△▲▽▼※〒→←↑↓〓"
|
|
],
|
|
[
|
|
"81b8",
|
|
"∈∋⊆⊇⊂⊃∪∩"
|
|
],
|
|
[
|
|
"81c8",
|
|
"∧∨¬⇒⇔∀∃"
|
|
],
|
|
[
|
|
"81da",
|
|
"∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬"
|
|
],
|
|
[
|
|
"81f0",
|
|
"ʼn♯♭♪†‡¶"
|
|
],
|
|
[
|
|
"81fc",
|
|
"◯"
|
|
],
|
|
[
|
|
"824f",
|
|
"0",
|
|
9
|
|
],
|
|
[
|
|
"8260",
|
|
"A",
|
|
25
|
|
],
|
|
[
|
|
"8281",
|
|
"a",
|
|
25
|
|
],
|
|
[
|
|
"829f",
|
|
"ぁ",
|
|
82
|
|
],
|
|
[
|
|
"8340",
|
|
"ァ",
|
|
62
|
|
],
|
|
[
|
|
"8380",
|
|
"ム",
|
|
22
|
|
],
|
|
[
|
|
"839f",
|
|
"Α",
|
|
16,
|
|
"Σ",
|
|
6
|
|
],
|
|
[
|
|
"83bf",
|
|
"α",
|
|
16,
|
|
"σ",
|
|
6
|
|
],
|
|
[
|
|
"8440",
|
|
"А",
|
|
5,
|
|
"ЁЖ",
|
|
25
|
|
],
|
|
[
|
|
"8470",
|
|
"а",
|
|
5,
|
|
"ёж",
|
|
7
|
|
],
|
|
[
|
|
"8480",
|
|
"о",
|
|
17
|
|
],
|
|
[
|
|
"849f",
|
|
"─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂"
|
|
],
|
|
[
|
|
"8740",
|
|
"①",
|
|
19,
|
|
"Ⅰ",
|
|
9
|
|
],
|
|
[
|
|
"875f",
|
|
"㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡"
|
|
],
|
|
[
|
|
"877e",
|
|
"㍻"
|
|
],
|
|
[
|
|
"8780",
|
|
"〝〟№㏍℡㊤",
|
|
4,
|
|
"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪"
|
|
],
|
|
[
|
|
"889f",
|
|
"亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭"
|
|
],
|
|
[
|
|
"8940",
|
|
"院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円"
|
|
],
|
|
[
|
|
"8980",
|
|
"園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改"
|
|
],
|
|
[
|
|
"8a40",
|
|
"魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫"
|
|
],
|
|
[
|
|
"8a80",
|
|
"橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄"
|
|
],
|
|
[
|
|
"8b40",
|
|
"機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救"
|
|
],
|
|
[
|
|
"8b80",
|
|
"朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈"
|
|
],
|
|
[
|
|
"8c40",
|
|
"掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨"
|
|
],
|
|
[
|
|
"8c80",
|
|
"劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向"
|
|
],
|
|
[
|
|
"8d40",
|
|
"后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降"
|
|
],
|
|
[
|
|
"8d80",
|
|
"項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷"
|
|
],
|
|
[
|
|
"8e40",
|
|
"察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止"
|
|
],
|
|
[
|
|
"8e80",
|
|
"死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周"
|
|
],
|
|
[
|
|
"8f40",
|
|
"宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳"
|
|
],
|
|
[
|
|
"8f80",
|
|
"準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾"
|
|
],
|
|
[
|
|
"9040",
|
|
"拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨"
|
|
],
|
|
[
|
|
"9080",
|
|
"逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線"
|
|
],
|
|
[
|
|
"9140",
|
|
"繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻"
|
|
],
|
|
[
|
|
"9180",
|
|
"操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只"
|
|
],
|
|
[
|
|
"9240",
|
|
"叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄"
|
|
],
|
|
[
|
|
"9280",
|
|
"逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓"
|
|
],
|
|
[
|
|
"9340",
|
|
"邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬"
|
|
],
|
|
[
|
|
"9380",
|
|
"凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入"
|
|
],
|
|
[
|
|
"9440",
|
|
"如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅"
|
|
],
|
|
[
|
|
"9480",
|
|
"楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美"
|
|
],
|
|
[
|
|
"9540",
|
|
"鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷"
|
|
],
|
|
[
|
|
"9580",
|
|
"斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋"
|
|
],
|
|
[
|
|
"9640",
|
|
"法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆"
|
|
],
|
|
[
|
|
"9680",
|
|
"摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒"
|
|
],
|
|
[
|
|
"9740",
|
|
"諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲"
|
|
],
|
|
[
|
|
"9780",
|
|
"沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯"
|
|
],
|
|
[
|
|
"9840",
|
|
"蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕"
|
|
],
|
|
[
|
|
"989f",
|
|
"弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲"
|
|
],
|
|
[
|
|
"9940",
|
|
"僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭"
|
|
],
|
|
[
|
|
"9980",
|
|
"凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨"
|
|
],
|
|
[
|
|
"9a40",
|
|
"咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸"
|
|
],
|
|
[
|
|
"9a80",
|
|
"噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩"
|
|
],
|
|
[
|
|
"9b40",
|
|
"奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀"
|
|
],
|
|
[
|
|
"9b80",
|
|
"它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏"
|
|
],
|
|
[
|
|
"9c40",
|
|
"廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠"
|
|
],
|
|
[
|
|
"9c80",
|
|
"怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛"
|
|
],
|
|
[
|
|
"9d40",
|
|
"戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫"
|
|
],
|
|
[
|
|
"9d80",
|
|
"捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼"
|
|
],
|
|
[
|
|
"9e40",
|
|
"曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎"
|
|
],
|
|
[
|
|
"9e80",
|
|
"梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣"
|
|
],
|
|
[
|
|
"9f40",
|
|
"檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯"
|
|
],
|
|
[
|
|
"9f80",
|
|
"麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌"
|
|
],
|
|
[
|
|
"e040",
|
|
"漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝"
|
|
],
|
|
[
|
|
"e080",
|
|
"烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱"
|
|
],
|
|
[
|
|
"e140",
|
|
"瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿"
|
|
],
|
|
[
|
|
"e180",
|
|
"痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬"
|
|
],
|
|
[
|
|
"e240",
|
|
"磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰"
|
|
],
|
|
[
|
|
"e280",
|
|
"窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆"
|
|
],
|
|
[
|
|
"e340",
|
|
"紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷"
|
|
],
|
|
[
|
|
"e380",
|
|
"縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋"
|
|
],
|
|
[
|
|
"e440",
|
|
"隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤"
|
|
],
|
|
[
|
|
"e480",
|
|
"艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈"
|
|
],
|
|
[
|
|
"e540",
|
|
"蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬"
|
|
],
|
|
[
|
|
"e580",
|
|
"蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞"
|
|
],
|
|
[
|
|
"e640",
|
|
"襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧"
|
|
],
|
|
[
|
|
"e680",
|
|
"諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊"
|
|
],
|
|
[
|
|
"e740",
|
|
"蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜"
|
|
],
|
|
[
|
|
"e780",
|
|
"轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮"
|
|
],
|
|
[
|
|
"e840",
|
|
"錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙"
|
|
],
|
|
[
|
|
"e880",
|
|
"閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰"
|
|
],
|
|
[
|
|
"e940",
|
|
"顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃"
|
|
],
|
|
[
|
|
"e980",
|
|
"騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈"
|
|
],
|
|
[
|
|
"ea40",
|
|
"鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯"
|
|
],
|
|
[
|
|
"ea80",
|
|
"黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙"
|
|
],
|
|
[
|
|
"ed40",
|
|
"纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏"
|
|
],
|
|
[
|
|
"ed80",
|
|
"塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱"
|
|
],
|
|
[
|
|
"ee40",
|
|
"犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙"
|
|
],
|
|
[
|
|
"ee80",
|
|
"蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"
|
|
],
|
|
[
|
|
"eeef",
|
|
"ⅰ",
|
|
9,
|
|
"¬¦'""
|
|
],
|
|
[
|
|
"f040",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"f080",
|
|
"",
|
|
124
|
|
],
|
|
[
|
|
"f140",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"f180",
|
|
"",
|
|
124
|
|
],
|
|
[
|
|
"f240",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"f280",
|
|
"",
|
|
124
|
|
],
|
|
[
|
|
"f340",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"f380",
|
|
"",
|
|
124
|
|
],
|
|
[
|
|
"f440",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"f480",
|
|
"",
|
|
124
|
|
],
|
|
[
|
|
"f540",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"f580",
|
|
"",
|
|
124
|
|
],
|
|
[
|
|
"f640",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"f680",
|
|
"",
|
|
124
|
|
],
|
|
[
|
|
"f740",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"f780",
|
|
"",
|
|
124
|
|
],
|
|
[
|
|
"f840",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"f880",
|
|
"",
|
|
124
|
|
],
|
|
[
|
|
"f940",
|
|
""
|
|
],
|
|
[
|
|
"fa40",
|
|
"ⅰ",
|
|
9,
|
|
"Ⅰ",
|
|
9,
|
|
"¬¦'"㈱№℡∵纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊"
|
|
],
|
|
[
|
|
"fa80",
|
|
"兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯"
|
|
],
|
|
[
|
|
"fb40",
|
|
"涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神"
|
|
],
|
|
[
|
|
"fb80",
|
|
"祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙"
|
|
],
|
|
[
|
|
"fc40",
|
|
"髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"
|
|
]
|
|
];
|
|
|
|
/***/ },
|
|
/* 96 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = [
|
|
[
|
|
"0",
|
|
"\u0000",
|
|
127
|
|
],
|
|
[
|
|
"8ea1",
|
|
"。",
|
|
62
|
|
],
|
|
[
|
|
"a1a1",
|
|
" 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈",
|
|
9,
|
|
"+-±×÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇"
|
|
],
|
|
[
|
|
"a2a1",
|
|
"◆□■△▲▽▼※〒→←↑↓〓"
|
|
],
|
|
[
|
|
"a2ba",
|
|
"∈∋⊆⊇⊂⊃∪∩"
|
|
],
|
|
[
|
|
"a2ca",
|
|
"∧∨¬⇒⇔∀∃"
|
|
],
|
|
[
|
|
"a2dc",
|
|
"∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬"
|
|
],
|
|
[
|
|
"a2f2",
|
|
"ʼn♯♭♪†‡¶"
|
|
],
|
|
[
|
|
"a2fe",
|
|
"◯"
|
|
],
|
|
[
|
|
"a3b0",
|
|
"0",
|
|
9
|
|
],
|
|
[
|
|
"a3c1",
|
|
"A",
|
|
25
|
|
],
|
|
[
|
|
"a3e1",
|
|
"a",
|
|
25
|
|
],
|
|
[
|
|
"a4a1",
|
|
"ぁ",
|
|
82
|
|
],
|
|
[
|
|
"a5a1",
|
|
"ァ",
|
|
85
|
|
],
|
|
[
|
|
"a6a1",
|
|
"Α",
|
|
16,
|
|
"Σ",
|
|
6
|
|
],
|
|
[
|
|
"a6c1",
|
|
"α",
|
|
16,
|
|
"σ",
|
|
6
|
|
],
|
|
[
|
|
"a7a1",
|
|
"А",
|
|
5,
|
|
"ЁЖ",
|
|
25
|
|
],
|
|
[
|
|
"a7d1",
|
|
"а",
|
|
5,
|
|
"ёж",
|
|
25
|
|
],
|
|
[
|
|
"a8a1",
|
|
"─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂"
|
|
],
|
|
[
|
|
"ada1",
|
|
"①",
|
|
19,
|
|
"Ⅰ",
|
|
9
|
|
],
|
|
[
|
|
"adc0",
|
|
"㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡"
|
|
],
|
|
[
|
|
"addf",
|
|
"㍻〝〟№㏍℡㊤",
|
|
4,
|
|
"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪"
|
|
],
|
|
[
|
|
"b0a1",
|
|
"亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭"
|
|
],
|
|
[
|
|
"b1a1",
|
|
"院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応"
|
|
],
|
|
[
|
|
"b2a1",
|
|
"押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改"
|
|
],
|
|
[
|
|
"b3a1",
|
|
"魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱"
|
|
],
|
|
[
|
|
"b4a1",
|
|
"粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄"
|
|
],
|
|
[
|
|
"b5a1",
|
|
"機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京"
|
|
],
|
|
[
|
|
"b6a1",
|
|
"供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈"
|
|
],
|
|
[
|
|
"b7a1",
|
|
"掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲"
|
|
],
|
|
[
|
|
"b8a1",
|
|
"検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向"
|
|
],
|
|
[
|
|
"b9a1",
|
|
"后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込"
|
|
],
|
|
[
|
|
"baa1",
|
|
"此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷"
|
|
],
|
|
[
|
|
"bba1",
|
|
"察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時"
|
|
],
|
|
[
|
|
"bca1",
|
|
"次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周"
|
|
],
|
|
[
|
|
"bda1",
|
|
"宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償"
|
|
],
|
|
[
|
|
"bea1",
|
|
"勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾"
|
|
],
|
|
[
|
|
"bfa1",
|
|
"拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾"
|
|
],
|
|
[
|
|
"c0a1",
|
|
"澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線"
|
|
],
|
|
[
|
|
"c1a1",
|
|
"繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎"
|
|
],
|
|
[
|
|
"c2a1",
|
|
"臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只"
|
|
],
|
|
[
|
|
"c3a1",
|
|
"叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵"
|
|
],
|
|
[
|
|
"c4a1",
|
|
"帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓"
|
|
],
|
|
[
|
|
"c5a1",
|
|
"邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到"
|
|
],
|
|
[
|
|
"c6a1",
|
|
"董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入"
|
|
],
|
|
[
|
|
"c7a1",
|
|
"如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦"
|
|
],
|
|
[
|
|
"c8a1",
|
|
"函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美"
|
|
],
|
|
[
|
|
"c9a1",
|
|
"鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服"
|
|
],
|
|
[
|
|
"caa1",
|
|
"福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋"
|
|
],
|
|
[
|
|
"cba1",
|
|
"法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満"
|
|
],
|
|
[
|
|
"cca1",
|
|
"漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒"
|
|
],
|
|
[
|
|
"cda1",
|
|
"諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃"
|
|
],
|
|
[
|
|
"cea1",
|
|
"痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯"
|
|
],
|
|
[
|
|
"cfa1",
|
|
"蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕"
|
|
],
|
|
[
|
|
"d0a1",
|
|
"弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲"
|
|
],
|
|
[
|
|
"d1a1",
|
|
"僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨"
|
|
],
|
|
[
|
|
"d2a1",
|
|
"辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨"
|
|
],
|
|
[
|
|
"d3a1",
|
|
"咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉"
|
|
],
|
|
[
|
|
"d4a1",
|
|
"圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩"
|
|
],
|
|
[
|
|
"d5a1",
|
|
"奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓"
|
|
],
|
|
[
|
|
"d6a1",
|
|
"屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏"
|
|
],
|
|
[
|
|
"d7a1",
|
|
"廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚"
|
|
],
|
|
[
|
|
"d8a1",
|
|
"悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛"
|
|
],
|
|
[
|
|
"d9a1",
|
|
"戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼"
|
|
],
|
|
[
|
|
"daa1",
|
|
"據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼"
|
|
],
|
|
[
|
|
"dba1",
|
|
"曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍"
|
|
],
|
|
[
|
|
"dca1",
|
|
"棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣"
|
|
],
|
|
[
|
|
"dda1",
|
|
"檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾"
|
|
],
|
|
[
|
|
"dea1",
|
|
"沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌"
|
|
],
|
|
[
|
|
"dfa1",
|
|
"漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼"
|
|
],
|
|
[
|
|
"e0a1",
|
|
"燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱"
|
|
],
|
|
[
|
|
"e1a1",
|
|
"瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰"
|
|
],
|
|
[
|
|
"e2a1",
|
|
"癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬"
|
|
],
|
|
[
|
|
"e3a1",
|
|
"磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐"
|
|
],
|
|
[
|
|
"e4a1",
|
|
"筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆"
|
|
],
|
|
[
|
|
"e5a1",
|
|
"紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺"
|
|
],
|
|
[
|
|
"e6a1",
|
|
"罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋"
|
|
],
|
|
[
|
|
"e7a1",
|
|
"隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙"
|
|
],
|
|
[
|
|
"e8a1",
|
|
"茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈"
|
|
],
|
|
[
|
|
"e9a1",
|
|
"蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙"
|
|
],
|
|
[
|
|
"eaa1",
|
|
"蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞"
|
|
],
|
|
[
|
|
"eba1",
|
|
"襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫"
|
|
],
|
|
[
|
|
"eca1",
|
|
"譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊"
|
|
],
|
|
[
|
|
"eda1",
|
|
"蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸"
|
|
],
|
|
[
|
|
"eea1",
|
|
"遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮"
|
|
],
|
|
[
|
|
"efa1",
|
|
"錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞"
|
|
],
|
|
[
|
|
"f0a1",
|
|
"陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰"
|
|
],
|
|
[
|
|
"f1a1",
|
|
"顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷"
|
|
],
|
|
[
|
|
"f2a1",
|
|
"髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈"
|
|
],
|
|
[
|
|
"f3a1",
|
|
"鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠"
|
|
],
|
|
[
|
|
"f4a1",
|
|
"堯槇遙瑤凜熙"
|
|
],
|
|
[
|
|
"f9a1",
|
|
"纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德"
|
|
],
|
|
[
|
|
"faa1",
|
|
"忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱"
|
|
],
|
|
[
|
|
"fba1",
|
|
"犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚"
|
|
],
|
|
[
|
|
"fca1",
|
|
"釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"
|
|
],
|
|
[
|
|
"fcf1",
|
|
"ⅰ",
|
|
9,
|
|
"¬¦'""
|
|
],
|
|
[
|
|
"8fa2af",
|
|
"˘ˇ¸˙˝¯˛˚~΄΅"
|
|
],
|
|
[
|
|
"8fa2c2",
|
|
"¡¦¿"
|
|
],
|
|
[
|
|
"8fa2eb",
|
|
"ºª©®™¤№"
|
|
],
|
|
[
|
|
"8fa6e1",
|
|
"ΆΈΉΊΪ"
|
|
],
|
|
[
|
|
"8fa6e7",
|
|
"Ό"
|
|
],
|
|
[
|
|
"8fa6e9",
|
|
"ΎΫ"
|
|
],
|
|
[
|
|
"8fa6ec",
|
|
"Ώ"
|
|
],
|
|
[
|
|
"8fa6f1",
|
|
"άέήίϊΐόςύϋΰώ"
|
|
],
|
|
[
|
|
"8fa7c2",
|
|
"Ђ",
|
|
10,
|
|
"ЎЏ"
|
|
],
|
|
[
|
|
"8fa7f2",
|
|
"ђ",
|
|
10,
|
|
"ўџ"
|
|
],
|
|
[
|
|
"8fa9a1",
|
|
"ÆĐ"
|
|
],
|
|
[
|
|
"8fa9a4",
|
|
"Ħ"
|
|
],
|
|
[
|
|
"8fa9a6",
|
|
"IJ"
|
|
],
|
|
[
|
|
"8fa9a8",
|
|
"ŁĿ"
|
|
],
|
|
[
|
|
"8fa9ab",
|
|
"ŊØŒ"
|
|
],
|
|
[
|
|
"8fa9af",
|
|
"ŦÞ"
|
|
],
|
|
[
|
|
"8fa9c1",
|
|
"æđðħıijĸłŀʼnŋøœßŧþ"
|
|
],
|
|
[
|
|
"8faaa1",
|
|
"ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈËÊĚĖĒĘ"
|
|
],
|
|
[
|
|
"8faaba",
|
|
"ĜĞĢĠĤÍÌÏÎǏİĪĮĨĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙǕŴÝŸŶŹŽŻ"
|
|
],
|
|
[
|
|
"8faba1",
|
|
"áàäâăǎāąåãćĉčçċďéèëêěėēęǵĝğ"
|
|
],
|
|
[
|
|
"8fabbd",
|
|
"ġĥíìïîǐ"
|
|
],
|
|
[
|
|
"8fabc5",
|
|
"īįĩĵķĺľļńňņñóòöôǒőōõŕřŗśŝšşťţúùüûŭǔűūųůũǘǜǚǖŵýÿŷźžż"
|
|
],
|
|
[
|
|
"8fb0a1",
|
|
"丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄"
|
|
],
|
|
[
|
|
"8fb1a1",
|
|
"侅侉侊侌侎侐侒侓侔侗侙侚侞侟侲侷侹侻侼侽侾俀俁俅俆俈俉俋俌俍俏俒俜俠俢俰俲俼俽俿倀倁倄倇倊倌倎倐倓倗倘倛倜倝倞倢倧倮倰倲倳倵偀偁偂偅偆偊偌偎偑偒偓偗偙偟偠偢偣偦偧偪偭偰偱倻傁傃傄傆傊傎傏傐"
|
|
],
|
|
[
|
|
"8fb2a1",
|
|
"傒傓傔傖傛傜傞",
|
|
4,
|
|
"傪傯傰傹傺傽僀僃僄僇僌僎僐僓僔僘僜僝僟僢僤僦僨僩僯僱僶僺僾儃儆儇儈儋儌儍儎僲儐儗儙儛儜儝儞儣儧儨儬儭儯儱儳儴儵儸儹兂兊兏兓兕兗兘兟兤兦兾冃冄冋冎冘冝冡冣冭冸冺冼冾冿凂"
|
|
],
|
|
[
|
|
"8fb3a1",
|
|
"凈减凑凒凓凕凘凞凢凥凮凲凳凴凷刁刂刅划刓刕刖刘刢刨刱刲刵刼剅剉剕剗剘剚剜剟剠剡剦剮剷剸剹劀劂劅劊劌劓劕劖劗劘劚劜劤劥劦劧劯劰劶劷劸劺劻劽勀勄勆勈勌勏勑勔勖勛勜勡勥勨勩勪勬勰勱勴勶勷匀匃匊匋"
|
|
],
|
|
[
|
|
"8fb4a1",
|
|
"匌匑匓匘匛匜匞匟匥匧匨匩匫匬匭匰匲匵匼匽匾卂卌卋卙卛卡卣卥卬卭卲卹卾厃厇厈厎厓厔厙厝厡厤厪厫厯厲厴厵厷厸厺厽叀叅叏叒叓叕叚叝叞叠另叧叵吂吓吚吡吧吨吪启吱吴吵呃呄呇呍呏呞呢呤呦呧呩呫呭呮呴呿"
|
|
],
|
|
[
|
|
"8fb5a1",
|
|
"咁咃咅咈咉咍咑咕咖咜咟咡咦咧咩咪咭咮咱咷咹咺咻咿哆哊响哎哠哪哬哯哶哼哾哿唀唁唅唈唉唌唍唎唕唪唫唲唵唶唻唼唽啁啇啉啊啍啐啑啘啚啛啞啠啡啤啦啿喁喂喆喈喎喏喑喒喓喔喗喣喤喭喲喿嗁嗃嗆嗉嗋嗌嗎嗑嗒"
|
|
],
|
|
[
|
|
"8fb6a1",
|
|
"嗓嗗嗘嗛嗞嗢嗩嗶嗿嘅嘈嘊嘍",
|
|
5,
|
|
"嘙嘬嘰嘳嘵嘷嘹嘻嘼嘽嘿噀噁噃噄噆噉噋噍噏噔噞噠噡噢噣噦噩噭噯噱噲噵嚄嚅嚈嚋嚌嚕嚙嚚嚝嚞嚟嚦嚧嚨嚩嚫嚬嚭嚱嚳嚷嚾囅囉囊囋囏囐囌囍囙囜囝囟囡囤",
|
|
4,
|
|
"囱囫园"
|
|
],
|
|
[
|
|
"8fb7a1",
|
|
"囶囷圁圂圇圊圌圑圕圚圛圝圠圢圣圤圥圩圪圬圮圯圳圴圽圾圿坅坆坌坍坒坢坥坧坨坫坭",
|
|
4,
|
|
"坳坴坵坷坹坺坻坼坾垁垃垌垔垗垙垚垜垝垞垟垡垕垧垨垩垬垸垽埇埈埌埏埕埝埞埤埦埧埩埭埰埵埶埸埽埾埿堃堄堈堉埡"
|
|
],
|
|
[
|
|
"8fb8a1",
|
|
"堌堍堛堞堟堠堦堧堭堲堹堿塉塌塍塏塐塕塟塡塤塧塨塸塼塿墀墁墇墈墉墊墌墍墏墐墔墖墝墠墡墢墦墩墱墲壄墼壂壈壍壎壐壒壔壖壚壝壡壢壩壳夅夆夋夌夒夓夔虁夝夡夣夤夨夯夰夳夵夶夿奃奆奒奓奙奛奝奞奟奡奣奫奭"
|
|
],
|
|
[
|
|
"8fb9a1",
|
|
"奯奲奵奶她奻奼妋妌妎妒妕妗妟妤妧妭妮妯妰妳妷妺妼姁姃姄姈姊姍姒姝姞姟姣姤姧姮姯姱姲姴姷娀娄娌娍娎娒娓娞娣娤娧娨娪娭娰婄婅婇婈婌婐婕婞婣婥婧婭婷婺婻婾媋媐媓媖媙媜媞媟媠媢媧媬媱媲媳媵媸媺媻媿"
|
|
],
|
|
[
|
|
"8fbaa1",
|
|
"嫄嫆嫈嫏嫚嫜嫠嫥嫪嫮嫵嫶嫽嬀嬁嬈嬗嬴嬙嬛嬝嬡嬥嬭嬸孁孋孌孒孖孞孨孮孯孼孽孾孿宁宄宆宊宎宐宑宓宔宖宨宩宬宭宯宱宲宷宺宼寀寁寍寏寖",
|
|
4,
|
|
"寠寯寱寴寽尌尗尞尟尣尦尩尫尬尮尰尲尵尶屙屚屜屢屣屧屨屩"
|
|
],
|
|
[
|
|
"8fbba1",
|
|
"屭屰屴屵屺屻屼屽岇岈岊岏岒岝岟岠岢岣岦岪岲岴岵岺峉峋峒峝峗峮峱峲峴崁崆崍崒崫崣崤崦崧崱崴崹崽崿嵂嵃嵆嵈嵕嵑嵙嵊嵟嵠嵡嵢嵤嵪嵭嵰嵹嵺嵾嵿嶁嶃嶈嶊嶒嶓嶔嶕嶙嶛嶟嶠嶧嶫嶰嶴嶸嶹巃巇巋巐巎巘巙巠巤"
|
|
],
|
|
[
|
|
"8fbca1",
|
|
"巩巸巹帀帇帍帒帔帕帘帟帠帮帨帲帵帾幋幐幉幑幖幘幛幜幞幨幪",
|
|
4,
|
|
"幰庀庋庎庢庤庥庨庪庬庱庳庽庾庿廆廌廋廎廑廒廔廕廜廞廥廫异弆弇弈弎弙弜弝弡弢弣弤弨弫弬弮弰弴弶弻弽弿彀彄彅彇彍彐彔彘彛彠彣彤彧"
|
|
],
|
|
[
|
|
"8fbda1",
|
|
"彯彲彴彵彸彺彽彾徉徍徏徖徜徝徢徧徫徤徬徯徰徱徸忄忇忈忉忋忐",
|
|
4,
|
|
"忞忡忢忨忩忪忬忭忮忯忲忳忶忺忼怇怊怍怓怔怗怘怚怟怤怭怳怵恀恇恈恉恌恑恔恖恗恝恡恧恱恾恿悂悆悈悊悎悑悓悕悘悝悞悢悤悥您悰悱悷"
|
|
],
|
|
[
|
|
"8fbea1",
|
|
"悻悾惂惄惈惉惊惋惎惏惔惕惙惛惝惞惢惥惲惵惸惼惽愂愇愊愌愐",
|
|
4,
|
|
"愖愗愙愜愞愢愪愫愰愱愵愶愷愹慁慅慆慉慞慠慬慲慸慻慼慿憀憁憃憄憋憍憒憓憗憘憜憝憟憠憥憨憪憭憸憹憼懀懁懂懎懏懕懜懝懞懟懡懢懧懩懥"
|
|
],
|
|
[
|
|
"8fbfa1",
|
|
"懬懭懯戁戃戄戇戓戕戜戠戢戣戧戩戫戹戽扂扃扄扆扌扐扑扒扔扖扚扜扤扭扯扳扺扽抍抎抏抐抦抨抳抶抷抺抾抿拄拎拕拖拚拪拲拴拼拽挃挄挊挋挍挐挓挖挘挩挪挭挵挶挹挼捁捂捃捄捆捊捋捎捒捓捔捘捛捥捦捬捭捱捴捵"
|
|
],
|
|
[
|
|
"8fc0a1",
|
|
"捸捼捽捿掂掄掇掊掐掔掕掙掚掞掤掦掭掮掯掽揁揅揈揎揑揓揔揕揜揠揥揪揬揲揳揵揸揹搉搊搐搒搔搘搞搠搢搤搥搩搪搯搰搵搽搿摋摏摑摒摓摔摚摛摜摝摟摠摡摣摭摳摴摻摽撅撇撏撐撑撘撙撛撝撟撡撣撦撨撬撳撽撾撿"
|
|
],
|
|
[
|
|
"8fc1a1",
|
|
"擄擉擊擋擌擎擐擑擕擗擤擥擩擪擭擰擵擷擻擿攁攄攈攉攊攏攓攔攖攙攛攞攟攢攦攩攮攱攺攼攽敃敇敉敐敒敔敟敠敧敫敺敽斁斅斊斒斕斘斝斠斣斦斮斲斳斴斿旂旈旉旎旐旔旖旘旟旰旲旴旵旹旾旿昀昄昈昉昍昑昒昕昖昝"
|
|
],
|
|
[
|
|
"8fc2a1",
|
|
"昞昡昢昣昤昦昩昪昫昬昮昰昱昳昹昷晀晅晆晊晌晑晎晗晘晙晛晜晠晡曻晪晫晬晾晳晵晿晷晸晹晻暀晼暋暌暍暐暒暙暚暛暜暟暠暤暭暱暲暵暻暿曀曂曃曈曌曎曏曔曛曟曨曫曬曮曺朅朇朎朓朙朜朠朢朳朾杅杇杈杌杔杕杝"
|
|
],
|
|
[
|
|
"8fc3a1",
|
|
"杦杬杮杴杶杻极构枎枏枑枓枖枘枙枛枰枱枲枵枻枼枽柹柀柂柃柅柈柉柒柗柙柜柡柦柰柲柶柷桒栔栙栝栟栨栧栬栭栯栰栱栳栻栿桄桅桊桌桕桗桘桛桫桮",
|
|
4,
|
|
"桵桹桺桻桼梂梄梆梈梖梘梚梜梡梣梥梩梪梮梲梻棅棈棌棏"
|
|
],
|
|
[
|
|
"8fc4a1",
|
|
"棐棑棓棖棙棜棝棥棨棪棫棬棭棰棱棵棶棻棼棽椆椉椊椐椑椓椖椗椱椳椵椸椻楂楅楉楎楗楛楣楤楥楦楨楩楬楰楱楲楺楻楿榀榍榒榖榘榡榥榦榨榫榭榯榷榸榺榼槅槈槑槖槗槢槥槮槯槱槳槵槾樀樁樃樏樑樕樚樝樠樤樨樰樲"
|
|
],
|
|
[
|
|
"8fc5a1",
|
|
"樴樷樻樾樿橅橆橉橊橎橐橑橒橕橖橛橤橧橪橱橳橾檁檃檆檇檉檋檑檛檝檞檟檥檫檯檰檱檴檽檾檿櫆櫉櫈櫌櫐櫔櫕櫖櫜櫝櫤櫧櫬櫰櫱櫲櫼櫽欂欃欆欇欉欏欐欑欗欛欞欤欨欫欬欯欵欶欻欿歆歊歍歒歖歘歝歠歧歫歮歰歵歽"
|
|
],
|
|
[
|
|
"8fc6a1",
|
|
"歾殂殅殗殛殟殠殢殣殨殩殬殭殮殰殸殹殽殾毃毄毉毌毖毚毡毣毦毧毮毱毷毹毿氂氄氅氉氍氎氐氒氙氟氦氧氨氬氮氳氵氶氺氻氿汊汋汍汏汒汔汙汛汜汫汭汯汴汶汸汹汻沅沆沇沉沔沕沗沘沜沟沰沲沴泂泆泍泏泐泑泒泔泖"
|
|
],
|
|
[
|
|
"8fc7a1",
|
|
"泚泜泠泧泩泫泬泮泲泴洄洇洊洎洏洑洓洚洦洧洨汧洮洯洱洹洼洿浗浞浟浡浥浧浯浰浼涂涇涑涒涔涖涗涘涪涬涴涷涹涽涿淄淈淊淎淏淖淛淝淟淠淢淥淩淯淰淴淶淼渀渄渞渢渧渲渶渹渻渼湄湅湈湉湋湏湑湒湓湔湗湜湝湞"
|
|
],
|
|
[
|
|
"8fc8a1",
|
|
"湢湣湨湳湻湽溍溓溙溠溧溭溮溱溳溻溿滀滁滃滇滈滊滍滎滏滫滭滮滹滻滽漄漈漊漌漍漖漘漚漛漦漩漪漯漰漳漶漻漼漭潏潑潒潓潗潙潚潝潞潡潢潨潬潽潾澃澇澈澋澌澍澐澒澓澔澖澚澟澠澥澦澧澨澮澯澰澵澶澼濅濇濈濊"
|
|
],
|
|
[
|
|
"8fc9a1",
|
|
"濚濞濨濩濰濵濹濼濽瀀瀅瀆瀇瀍瀗瀠瀣瀯瀴瀷瀹瀼灃灄灈灉灊灋灔灕灝灞灎灤灥灬灮灵灶灾炁炅炆炔",
|
|
4,
|
|
"炛炤炫炰炱炴炷烊烑烓烔烕烖烘烜烤烺焃",
|
|
4,
|
|
"焋焌焏焞焠焫焭焯焰焱焸煁煅煆煇煊煋煐煒煗煚煜煞煠"
|
|
],
|
|
[
|
|
"8fcaa1",
|
|
"煨煹熀熅熇熌熒熚熛熠熢熯熰熲熳熺熿燀燁燄燋燌燓燖燙燚燜燸燾爀爇爈爉爓爗爚爝爟爤爫爯爴爸爹牁牂牃牅牎牏牐牓牕牖牚牜牞牠牣牨牫牮牯牱牷牸牻牼牿犄犉犍犎犓犛犨犭犮犱犴犾狁狇狉狌狕狖狘狟狥狳狴狺狻"
|
|
],
|
|
[
|
|
"8fcba1",
|
|
"狾猂猄猅猇猋猍猒猓猘猙猞猢猤猧猨猬猱猲猵猺猻猽獃獍獐獒獖獘獝獞獟獠獦獧獩獫獬獮獯獱獷獹獼玀玁玃玅玆玎玐玓玕玗玘玜玞玟玠玢玥玦玪玫玭玵玷玹玼玽玿珅珆珉珋珌珏珒珓珖珙珝珡珣珦珧珩珴珵珷珹珺珻珽"
|
|
],
|
|
[
|
|
"8fcca1",
|
|
"珿琀琁琄琇琊琑琚琛琤琦琨",
|
|
9,
|
|
"琹瑀瑃瑄瑆瑇瑋瑍瑑瑒瑗瑝瑢瑦瑧瑨瑫瑭瑮瑱瑲璀璁璅璆璇璉璏璐璑璒璘璙璚璜璟璠璡璣璦璨璩璪璫璮璯璱璲璵璹璻璿瓈瓉瓌瓐瓓瓘瓚瓛瓞瓟瓤瓨瓪瓫瓯瓴瓺瓻瓼瓿甆"
|
|
],
|
|
[
|
|
"8fcda1",
|
|
"甒甖甗甠甡甤甧甩甪甯甶甹甽甾甿畀畃畇畈畎畐畒畗畞畟畡畯畱畹",
|
|
5,
|
|
"疁疅疐疒疓疕疙疜疢疤疴疺疿痀痁痄痆痌痎痏痗痜痟痠痡痤痧痬痮痯痱痹瘀瘂瘃瘄瘇瘈瘊瘌瘏瘒瘓瘕瘖瘙瘛瘜瘝瘞瘣瘥瘦瘩瘭瘲瘳瘵瘸瘹"
|
|
],
|
|
[
|
|
"8fcea1",
|
|
"瘺瘼癊癀癁癃癄癅癉癋癕癙癟癤癥癭癮癯癱癴皁皅皌皍皕皛皜皝皟皠皢",
|
|
6,
|
|
"皪皭皽盁盅盉盋盌盎盔盙盠盦盨盬盰盱盶盹盼眀眆眊眎眒眔眕眗眙眚眜眢眨眭眮眯眴眵眶眹眽眾睂睅睆睊睍睎睏睒睖睗睜睞睟睠睢"
|
|
],
|
|
[
|
|
"8fcfa1",
|
|
"睤睧睪睬睰睲睳睴睺睽瞀瞄瞌瞍瞔瞕瞖瞚瞟瞢瞧瞪瞮瞯瞱瞵瞾矃矉矑矒矕矙矞矟矠矤矦矪矬矰矱矴矸矻砅砆砉砍砎砑砝砡砢砣砭砮砰砵砷硃硄硇硈硌硎硒硜硞硠硡硣硤硨硪确硺硾碊碏碔碘碡碝碞碟碤碨碬碭碰碱碲碳"
|
|
],
|
|
[
|
|
"8fd0a1",
|
|
"碻碽碿磇磈磉磌磎磒磓磕磖磤磛磟磠磡磦磪磲磳礀磶磷磺磻磿礆礌礐礚礜礞礟礠礥礧礩礭礱礴礵礻礽礿祄祅祆祊祋祏祑祔祘祛祜祧祩祫祲祹祻祼祾禋禌禑禓禔禕禖禘禛禜禡禨禩禫禯禱禴禸离秂秄秇秈秊秏秔秖秚秝秞"
|
|
],
|
|
[
|
|
"8fd1a1",
|
|
"秠秢秥秪秫秭秱秸秼稂稃稇稉稊稌稑稕稛稞稡稧稫稭稯稰稴稵稸稹稺穄穅穇穈穌穕穖穙穜穝穟穠穥穧穪穭穵穸穾窀窂窅窆窊窋窐窑窔窞窠窣窬窳窵窹窻窼竆竉竌竎竑竛竨竩竫竬竱竴竻竽竾笇笔笟笣笧笩笪笫笭笮笯笰"
|
|
],
|
|
[
|
|
"8fd2a1",
|
|
"笱笴笽笿筀筁筇筎筕筠筤筦筩筪筭筯筲筳筷箄箉箎箐箑箖箛箞箠箥箬箯箰箲箵箶箺箻箼箽篂篅篈篊篔篖篗篙篚篛篨篪篲篴篵篸篹篺篼篾簁簂簃簄簆簉簋簌簎簏簙簛簠簥簦簨簬簱簳簴簶簹簺籆籊籕籑籒籓籙",
|
|
5
|
|
],
|
|
[
|
|
"8fd3a1",
|
|
"籡籣籧籩籭籮籰籲籹籼籽粆粇粏粔粞粠粦粰粶粷粺粻粼粿糄糇糈糉糍糏糓糔糕糗糙糚糝糦糩糫糵紃紇紈紉紏紑紒紓紖紝紞紣紦紪紭紱紼紽紾絀絁絇絈絍絑絓絗絙絚絜絝絥絧絪絰絸絺絻絿綁綂綃綅綆綈綋綌綍綑綖綗綝"
|
|
],
|
|
[
|
|
"8fd4a1",
|
|
"綞綦綧綪綳綶綷綹緂",
|
|
4,
|
|
"緌緍緎緗緙縀緢緥緦緪緫緭緱緵緶緹緺縈縐縑縕縗縜縝縠縧縨縬縭縯縳縶縿繄繅繇繎繐繒繘繟繡繢繥繫繮繯繳繸繾纁纆纇纊纍纑纕纘纚纝纞缼缻缽缾缿罃罄罇罏罒罓罛罜罝罡罣罤罥罦罭"
|
|
],
|
|
[
|
|
"8fd5a1",
|
|
"罱罽罾罿羀羋羍羏羐羑羖羗羜羡羢羦羪羭羴羼羿翀翃翈翎翏翛翟翣翥翨翬翮翯翲翺翽翾翿耇耈耊耍耎耏耑耓耔耖耝耞耟耠耤耦耬耮耰耴耵耷耹耺耼耾聀聄聠聤聦聭聱聵肁肈肎肜肞肦肧肫肸肹胈胍胏胒胔胕胗胘胠胭胮"
|
|
],
|
|
[
|
|
"8fd6a1",
|
|
"胰胲胳胶胹胺胾脃脋脖脗脘脜脞脠脤脧脬脰脵脺脼腅腇腊腌腒腗腠腡腧腨腩腭腯腷膁膐膄膅膆膋膎膖膘膛膞膢膮膲膴膻臋臃臅臊臎臏臕臗臛臝臞臡臤臫臬臰臱臲臵臶臸臹臽臿舀舃舏舓舔舙舚舝舡舢舨舲舴舺艃艄艅艆"
|
|
],
|
|
[
|
|
"8fd7a1",
|
|
"艋艎艏艑艖艜艠艣艧艭艴艻艽艿芀芁芃芄芇芉芊芎芑芔芖芘芚芛芠芡芣芤芧芨芩芪芮芰芲芴芷芺芼芾芿苆苐苕苚苠苢苤苨苪苭苯苶苷苽苾茀茁茇茈茊茋荔茛茝茞茟茡茢茬茭茮茰茳茷茺茼茽荂荃荄荇荍荎荑荕荖荗荰荸"
|
|
],
|
|
[
|
|
"8fd8a1",
|
|
"荽荿莀莂莄莆莍莒莔莕莘莙莛莜莝莦莧莩莬莾莿菀菇菉菏菐菑菔菝荓菨菪菶菸菹菼萁萆萊萏萑萕萙莭萯萹葅葇葈葊葍葏葑葒葖葘葙葚葜葠葤葥葧葪葰葳葴葶葸葼葽蒁蒅蒒蒓蒕蒞蒦蒨蒩蒪蒯蒱蒴蒺蒽蒾蓀蓂蓇蓈蓌蓏蓓"
|
|
],
|
|
[
|
|
"8fd9a1",
|
|
"蓜蓧蓪蓯蓰蓱蓲蓷蔲蓺蓻蓽蔂蔃蔇蔌蔎蔐蔜蔞蔢蔣蔤蔥蔧蔪蔫蔯蔳蔴蔶蔿蕆蕏",
|
|
4,
|
|
"蕖蕙蕜",
|
|
6,
|
|
"蕤蕫蕯蕹蕺蕻蕽蕿薁薅薆薉薋薌薏薓薘薝薟薠薢薥薧薴薶薷薸薼薽薾薿藂藇藊藋藎薭藘藚藟藠藦藨藭藳藶藼"
|
|
],
|
|
[
|
|
"8fdaa1",
|
|
"藿蘀蘄蘅蘍蘎蘐蘑蘒蘘蘙蘛蘞蘡蘧蘩蘶蘸蘺蘼蘽虀虂虆虒虓虖虗虘虙虝虠",
|
|
4,
|
|
"虩虬虯虵虶虷虺蚍蚑蚖蚘蚚蚜蚡蚦蚧蚨蚭蚱蚳蚴蚵蚷蚸蚹蚿蛀蛁蛃蛅蛑蛒蛕蛗蛚蛜蛠蛣蛥蛧蚈蛺蛼蛽蜄蜅蜇蜋蜎蜏蜐蜓蜔蜙蜞蜟蜡蜣"
|
|
],
|
|
[
|
|
"8fdba1",
|
|
"蜨蜮蜯蜱蜲蜹蜺蜼蜽蜾蝀蝃蝅蝍蝘蝝蝡蝤蝥蝯蝱蝲蝻螃",
|
|
6,
|
|
"螋螌螐螓螕螗螘螙螞螠螣螧螬螭螮螱螵螾螿蟁蟈蟉蟊蟎蟕蟖蟙蟚蟜蟟蟢蟣蟤蟪蟫蟭蟱蟳蟸蟺蟿蠁蠃蠆蠉蠊蠋蠐蠙蠒蠓蠔蠘蠚蠛蠜蠞蠟蠨蠭蠮蠰蠲蠵"
|
|
],
|
|
[
|
|
"8fdca1",
|
|
"蠺蠼衁衃衅衈衉衊衋衎衑衕衖衘衚衜衟衠衤衩衱衹衻袀袘袚袛袜袟袠袨袪袺袽袾裀裊",
|
|
4,
|
|
"裑裒裓裛裞裧裯裰裱裵裷褁褆褍褎褏褕褖褘褙褚褜褠褦褧褨褰褱褲褵褹褺褾襀襂襅襆襉襏襒襗襚襛襜襡襢襣襫襮襰襳襵襺"
|
|
],
|
|
[
|
|
"8fdda1",
|
|
"襻襼襽覉覍覐覔覕覛覜覟覠覥覰覴覵覶覷覼觔",
|
|
4,
|
|
"觥觩觫觭觱觳觶觹觽觿訄訅訇訏訑訒訔訕訞訠訢訤訦訫訬訯訵訷訽訾詀詃詅詇詉詍詎詓詖詗詘詜詝詡詥詧詵詶詷詹詺詻詾詿誀誃誆誋誏誐誒誖誗誙誟誧誩誮誯誳"
|
|
],
|
|
[
|
|
"8fdea1",
|
|
"誶誷誻誾諃諆諈諉諊諑諓諔諕諗諝諟諬諰諴諵諶諼諿謅謆謋謑謜謞謟謊謭謰謷謼譂",
|
|
4,
|
|
"譈譒譓譔譙譍譞譣譭譶譸譹譼譾讁讄讅讋讍讏讔讕讜讞讟谸谹谽谾豅豇豉豋豏豑豓豔豗豘豛豝豙豣豤豦豨豩豭豳豵豶豻豾貆"
|
|
],
|
|
[
|
|
"8fdfa1",
|
|
"貇貋貐貒貓貙貛貜貤貹貺賅賆賉賋賏賖賕賙賝賡賨賬賯賰賲賵賷賸賾賿贁贃贉贒贗贛赥赩赬赮赿趂趄趈趍趐趑趕趞趟趠趦趫趬趯趲趵趷趹趻跀跅跆跇跈跊跎跑跔跕跗跙跤跥跧跬跰趼跱跲跴跽踁踄踅踆踋踑踔踖踠踡踢"
|
|
],
|
|
[
|
|
"8fe0a1",
|
|
"踣踦踧踱踳踶踷踸踹踽蹀蹁蹋蹍蹎蹏蹔蹛蹜蹝蹞蹡蹢蹩蹬蹭蹯蹰蹱蹹蹺蹻躂躃躉躐躒躕躚躛躝躞躢躧躩躭躮躳躵躺躻軀軁軃軄軇軏軑軔軜軨軮軰軱軷軹軺軭輀輂輇輈輏輐輖輗輘輞輠輡輣輥輧輨輬輭輮輴輵輶輷輺轀轁"
|
|
],
|
|
[
|
|
"8fe1a1",
|
|
"轃轇轏轑",
|
|
4,
|
|
"轘轝轞轥辝辠辡辤辥辦辵辶辸达迀迁迆迊迋迍运迒迓迕迠迣迤迨迮迱迵迶迻迾适逄逈逌逘逛逨逩逯逪逬逭逳逴逷逿遃遄遌遛遝遢遦遧遬遰遴遹邅邈邋邌邎邐邕邗邘邙邛邠邡邢邥邰邲邳邴邶邽郌邾郃"
|
|
],
|
|
[
|
|
"8fe2a1",
|
|
"郄郅郇郈郕郗郘郙郜郝郟郥郒郶郫郯郰郴郾郿鄀鄄鄅鄆鄈鄍鄐鄔鄖鄗鄘鄚鄜鄞鄠鄥鄢鄣鄧鄩鄮鄯鄱鄴鄶鄷鄹鄺鄼鄽酃酇酈酏酓酗酙酚酛酡酤酧酭酴酹酺酻醁醃醅醆醊醎醑醓醔醕醘醞醡醦醨醬醭醮醰醱醲醳醶醻醼醽醿"
|
|
],
|
|
[
|
|
"8fe3a1",
|
|
"釂釃釅釓釔釗釙釚釞釤釥釩釪釬",
|
|
5,
|
|
"釷釹釻釽鈀鈁鈄鈅鈆鈇鈉鈊鈌鈐鈒鈓鈖鈘鈜鈝鈣鈤鈥鈦鈨鈮鈯鈰鈳鈵鈶鈸鈹鈺鈼鈾鉀鉂鉃鉆鉇鉊鉍鉎鉏鉑鉘鉙鉜鉝鉠鉡鉥鉧鉨鉩鉮鉯鉰鉵",
|
|
4,
|
|
"鉻鉼鉽鉿銈銉銊銍銎銒銗"
|
|
],
|
|
[
|
|
"8fe4a1",
|
|
"銙銟銠銤銥銧銨銫銯銲銶銸銺銻銼銽銿",
|
|
4,
|
|
"鋅鋆鋇鋈鋋鋌鋍鋎鋐鋓鋕鋗鋘鋙鋜鋝鋟鋠鋡鋣鋥鋧鋨鋬鋮鋰鋹鋻鋿錀錂錈錍錑錔錕錜錝錞錟錡錤錥錧錩錪錳錴錶錷鍇鍈鍉鍐鍑鍒鍕鍗鍘鍚鍞鍤鍥鍧鍩鍪鍭鍯鍰鍱鍳鍴鍶"
|
|
],
|
|
[
|
|
"8fe5a1",
|
|
"鍺鍽鍿鎀鎁鎂鎈鎊鎋鎍鎏鎒鎕鎘鎛鎞鎡鎣鎤鎦鎨鎫鎴鎵鎶鎺鎩鏁鏄鏅鏆鏇鏉",
|
|
4,
|
|
"鏓鏙鏜鏞鏟鏢鏦鏧鏹鏷鏸鏺鏻鏽鐁鐂鐄鐈鐉鐍鐎鐏鐕鐖鐗鐟鐮鐯鐱鐲鐳鐴鐻鐿鐽鑃鑅鑈鑊鑌鑕鑙鑜鑟鑡鑣鑨鑫鑭鑮鑯鑱鑲钄钃镸镹"
|
|
],
|
|
[
|
|
"8fe6a1",
|
|
"镾閄閈閌閍閎閝閞閟閡閦閩閫閬閴閶閺閽閿闆闈闉闋闐闑闒闓闙闚闝闞闟闠闤闦阝阞阢阤阥阦阬阱阳阷阸阹阺阼阽陁陒陔陖陗陘陡陮陴陻陼陾陿隁隂隃隄隉隑隖隚隝隟隤隥隦隩隮隯隳隺雊雒嶲雘雚雝雞雟雩雯雱雺霂"
|
|
],
|
|
[
|
|
"8fe7a1",
|
|
"霃霅霉霚霛霝霡霢霣霨霱霳靁靃靊靎靏靕靗靘靚靛靣靧靪靮靳靶靷靸靻靽靿鞀鞉鞕鞖鞗鞙鞚鞞鞟鞢鞬鞮鞱鞲鞵鞶鞸鞹鞺鞼鞾鞿韁韄韅韇韉韊韌韍韎韐韑韔韗韘韙韝韞韠韛韡韤韯韱韴韷韸韺頇頊頙頍頎頔頖頜頞頠頣頦"
|
|
],
|
|
[
|
|
"8fe8a1",
|
|
"頫頮頯頰頲頳頵頥頾顄顇顊顑顒顓顖顗顙顚顢顣顥顦顪顬颫颭颮颰颴颷颸颺颻颿飂飅飈飌飡飣飥飦飧飪飳飶餂餇餈餑餕餖餗餚餛餜餟餢餦餧餫餱",
|
|
4,
|
|
"餹餺餻餼饀饁饆饇饈饍饎饔饘饙饛饜饞饟饠馛馝馟馦馰馱馲馵"
|
|
],
|
|
[
|
|
"8fe9a1",
|
|
"馹馺馽馿駃駉駓駔駙駚駜駞駧駪駫駬駰駴駵駹駽駾騂騃騄騋騌騐騑騖騞騠騢騣騤騧騭騮騳騵騶騸驇驁驄驊驋驌驎驑驔驖驝骪骬骮骯骲骴骵骶骹骻骾骿髁髃髆髈髎髐髒髕髖髗髛髜髠髤髥髧髩髬髲髳髵髹髺髽髿",
|
|
4
|
|
],
|
|
[
|
|
"8feaa1",
|
|
"鬄鬅鬈鬉鬋鬌鬍鬎鬐鬒鬖鬙鬛鬜鬠鬦鬫鬭鬳鬴鬵鬷鬹鬺鬽魈魋魌魕魖魗魛魞魡魣魥魦魨魪",
|
|
4,
|
|
"魳魵魷魸魹魿鮀鮄鮅鮆鮇鮉鮊鮋鮍鮏鮐鮔鮚鮝鮞鮦鮧鮩鮬鮰鮱鮲鮷鮸鮻鮼鮾鮿鯁鯇鯈鯎鯐鯗鯘鯝鯟鯥鯧鯪鯫鯯鯳鯷鯸"
|
|
],
|
|
[
|
|
"8feba1",
|
|
"鯹鯺鯽鯿鰀鰂鰋鰏鰑鰖鰘鰙鰚鰜鰞鰢鰣鰦",
|
|
4,
|
|
"鰱鰵鰶鰷鰽鱁鱃鱄鱅鱉鱊鱎鱏鱐鱓鱔鱖鱘鱛鱝鱞鱟鱣鱩鱪鱜鱫鱨鱮鱰鱲鱵鱷鱻鳦鳲鳷鳹鴋鴂鴑鴗鴘鴜鴝鴞鴯鴰鴲鴳鴴鴺鴼鵅鴽鵂鵃鵇鵊鵓鵔鵟鵣鵢鵥鵩鵪鵫鵰鵶鵷鵻"
|
|
],
|
|
[
|
|
"8feca1",
|
|
"鵼鵾鶃鶄鶆鶊鶍鶎鶒鶓鶕鶖鶗鶘鶡鶪鶬鶮鶱鶵鶹鶼鶿鷃鷇鷉鷊鷔鷕鷖鷗鷚鷞鷟鷠鷥鷧鷩鷫鷮鷰鷳鷴鷾鸊鸂鸇鸎鸐鸑鸒鸕鸖鸙鸜鸝鹺鹻鹼麀麂麃麄麅麇麎麏麖麘麛麞麤麨麬麮麯麰麳麴麵黆黈黋黕黟黤黧黬黭黮黰黱黲黵"
|
|
],
|
|
[
|
|
"8feda1",
|
|
"黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃",
|
|
4,
|
|
"齓齕齖齗齘齚齝齞齨齩齭",
|
|
4,
|
|
"齳齵齺齽龏龐龑龒龔龖龗龞龡龢龣龥"
|
|
]
|
|
];
|
|
|
|
/***/ },
|
|
/* 97 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = [
|
|
[
|
|
"0",
|
|
"\u0000",
|
|
127,
|
|
"€"
|
|
],
|
|
[
|
|
"8140",
|
|
"丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱丳丵丷丼乀乁乂乄乆乊乑乕乗乚乛乢乣乤乥乧乨乪",
|
|
5,
|
|
"乲乴",
|
|
9,
|
|
"乿",
|
|
6,
|
|
"亇亊"
|
|
],
|
|
[
|
|
"8180",
|
|
"亐亖亗亙亜亝亞亣亪亯亰亱亴亶亷亸亹亼亽亾仈仌仏仐仒仚仛仜仠仢仦仧仩仭仮仯仱仴仸仹仺仼仾伀伂",
|
|
6,
|
|
"伋伌伒",
|
|
4,
|
|
"伜伝伡伣伨伩伬伭伮伱伳伵伷伹伻伾",
|
|
4,
|
|
"佄佅佇",
|
|
5,
|
|
"佒佔佖佡佢佦佨佪佫佭佮佱佲併佷佸佹佺佽侀侁侂侅來侇侊侌侎侐侒侓侕侖侘侙侚侜侞侟価侢"
|
|
],
|
|
[
|
|
"8240",
|
|
"侤侫侭侰",
|
|
4,
|
|
"侶",
|
|
8,
|
|
"俀俁係俆俇俈俉俋俌俍俒",
|
|
4,
|
|
"俙俛俠俢俤俥俧俫俬俰俲俴俵俶俷俹俻俼俽俿",
|
|
11
|
|
],
|
|
[
|
|
"8280",
|
|
"個倎倐們倓倕倖倗倛倝倞倠倢倣値倧倫倯",
|
|
10,
|
|
"倻倽倿偀偁偂偄偅偆偉偊偋偍偐",
|
|
4,
|
|
"偖偗偘偙偛偝",
|
|
7,
|
|
"偦",
|
|
5,
|
|
"偭",
|
|
8,
|
|
"偸偹偺偼偽傁傂傃傄傆傇傉傊傋傌傎",
|
|
20,
|
|
"傤傦傪傫傭",
|
|
4,
|
|
"傳",
|
|
6,
|
|
"傼"
|
|
],
|
|
[
|
|
"8340",
|
|
"傽",
|
|
17,
|
|
"僐",
|
|
5,
|
|
"僗僘僙僛",
|
|
10,
|
|
"僨僩僪僫僯僰僱僲僴僶",
|
|
4,
|
|
"僼",
|
|
9,
|
|
"儈"
|
|
],
|
|
[
|
|
"8380",
|
|
"儉儊儌",
|
|
5,
|
|
"儓",
|
|
13,
|
|
"儢",
|
|
28,
|
|
"兂兇兊兌兎兏児兒兓兗兘兙兛兝",
|
|
4,
|
|
"兣兤兦內兩兪兯兲兺兾兿冃冄円冇冊冋冎冏冐冑冓冔冘冚冝冞冟冡冣冦",
|
|
4,
|
|
"冭冮冴冸冹冺冾冿凁凂凃凅凈凊凍凎凐凒",
|
|
5
|
|
],
|
|
[
|
|
"8440",
|
|
"凘凙凚凜凞凟凢凣凥",
|
|
5,
|
|
"凬凮凱凲凴凷凾刄刅刉刋刌刏刐刓刔刕刜刞刟刡刢刣別刦刧刪刬刯刱刲刴刵刼刾剄",
|
|
5,
|
|
"剋剎剏剒剓剕剗剘"
|
|
],
|
|
[
|
|
"8480",
|
|
"剙剚剛剝剟剠剢剣剤剦剨剫剬剭剮剰剱剳",
|
|
9,
|
|
"剾劀劃",
|
|
4,
|
|
"劉",
|
|
6,
|
|
"劑劒劔",
|
|
6,
|
|
"劜劤劥劦劧劮劯劰労",
|
|
9,
|
|
"勀勁勂勄勅勆勈勊勌勍勎勏勑勓勔動勗務",
|
|
5,
|
|
"勠勡勢勣勥",
|
|
10,
|
|
"勱",
|
|
7,
|
|
"勻勼勽匁匂匃匄匇匉匊匋匌匎"
|
|
],
|
|
[
|
|
"8540",
|
|
"匑匒匓匔匘匛匜匞匟匢匤匥匧匨匩匫匬匭匯",
|
|
9,
|
|
"匼匽區卂卄卆卋卌卍卐協単卙卛卝卥卨卪卬卭卲卶卹卻卼卽卾厀厁厃厇厈厊厎厏"
|
|
],
|
|
[
|
|
"8580",
|
|
"厐",
|
|
4,
|
|
"厖厗厙厛厜厞厠厡厤厧厪厫厬厭厯",
|
|
6,
|
|
"厷厸厹厺厼厽厾叀參",
|
|
4,
|
|
"収叏叐叒叓叕叚叜叝叞叡叢叧叴叺叾叿吀吂吅吇吋吔吘吙吚吜吢吤吥吪吰吳吶吷吺吽吿呁呂呄呅呇呉呌呍呎呏呑呚呝",
|
|
4,
|
|
"呣呥呧呩",
|
|
7,
|
|
"呴呹呺呾呿咁咃咅咇咈咉咊咍咑咓咗咘咜咞咟咠咡"
|
|
],
|
|
[
|
|
"8640",
|
|
"咢咥咮咰咲咵咶咷咹咺咼咾哃哅哊哋哖哘哛哠",
|
|
4,
|
|
"哫哬哯哰哱哴",
|
|
5,
|
|
"哻哾唀唂唃唄唅唈唊",
|
|
4,
|
|
"唒唓唕",
|
|
5,
|
|
"唜唝唞唟唡唥唦"
|
|
],
|
|
[
|
|
"8680",
|
|
"唨唩唫唭唲唴唵唶唸唹唺唻唽啀啂啅啇啈啋",
|
|
4,
|
|
"啑啒啓啔啗",
|
|
4,
|
|
"啝啞啟啠啢啣啨啩啫啯",
|
|
5,
|
|
"啹啺啽啿喅喆喌喍喎喐喒喓喕喖喗喚喛喞喠",
|
|
6,
|
|
"喨",
|
|
8,
|
|
"喲喴営喸喺喼喿",
|
|
4,
|
|
"嗆嗇嗈嗊嗋嗎嗏嗐嗕嗗",
|
|
4,
|
|
"嗞嗠嗢嗧嗩嗭嗮嗰嗱嗴嗶嗸",
|
|
4,
|
|
"嗿嘂嘃嘄嘅"
|
|
],
|
|
[
|
|
"8740",
|
|
"嘆嘇嘊嘋嘍嘐",
|
|
7,
|
|
"嘙嘚嘜嘝嘠嘡嘢嘥嘦嘨嘩嘪嘫嘮嘯嘰嘳嘵嘷嘸嘺嘼嘽嘾噀",
|
|
11,
|
|
"噏",
|
|
4,
|
|
"噕噖噚噛噝",
|
|
4
|
|
],
|
|
[
|
|
"8780",
|
|
"噣噥噦噧噭噮噯噰噲噳噴噵噷噸噹噺噽",
|
|
7,
|
|
"嚇",
|
|
6,
|
|
"嚐嚑嚒嚔",
|
|
14,
|
|
"嚤",
|
|
10,
|
|
"嚰",
|
|
6,
|
|
"嚸嚹嚺嚻嚽",
|
|
12,
|
|
"囋",
|
|
8,
|
|
"囕囖囘囙囜団囥",
|
|
5,
|
|
"囬囮囯囲図囶囷囸囻囼圀圁圂圅圇國",
|
|
6
|
|
],
|
|
[
|
|
"8840",
|
|
"園",
|
|
9,
|
|
"圝圞圠圡圢圤圥圦圧圫圱圲圴",
|
|
4,
|
|
"圼圽圿坁坃坄坅坆坈坉坋坒",
|
|
4,
|
|
"坘坙坢坣坥坧坬坮坰坱坲坴坵坸坹坺坽坾坿垀"
|
|
],
|
|
[
|
|
"8880",
|
|
"垁垇垈垉垊垍",
|
|
4,
|
|
"垔",
|
|
6,
|
|
"垜垝垞垟垥垨垪垬垯垰垱垳垵垶垷垹",
|
|
8,
|
|
"埄",
|
|
6,
|
|
"埌埍埐埑埓埖埗埛埜埞埡埢埣埥",
|
|
7,
|
|
"埮埰埱埲埳埵埶執埻埼埾埿堁堃堄堅堈堉堊堌堎堏堐堒堓堔堖堗堘堚堛堜堝堟堢堣堥",
|
|
4,
|
|
"堫",
|
|
4,
|
|
"報堲堳場堶",
|
|
7
|
|
],
|
|
[
|
|
"8940",
|
|
"堾",
|
|
5,
|
|
"塅",
|
|
6,
|
|
"塎塏塐塒塓塕塖塗塙",
|
|
4,
|
|
"塟",
|
|
5,
|
|
"塦",
|
|
4,
|
|
"塭",
|
|
16,
|
|
"塿墂墄墆墇墈墊墋墌"
|
|
],
|
|
[
|
|
"8980",
|
|
"墍",
|
|
4,
|
|
"墔",
|
|
4,
|
|
"墛墜墝墠",
|
|
7,
|
|
"墪",
|
|
17,
|
|
"墽墾墿壀壂壃壄壆",
|
|
10,
|
|
"壒壓壔壖",
|
|
13,
|
|
"壥",
|
|
5,
|
|
"壭壯壱売壴壵壷壸壺",
|
|
7,
|
|
"夃夅夆夈",
|
|
4,
|
|
"夎夐夑夒夓夗夘夛夝夞夠夡夢夣夦夨夬夰夲夳夵夶夻"
|
|
],
|
|
[
|
|
"8a40",
|
|
"夽夾夿奀奃奅奆奊奌奍奐奒奓奙奛",
|
|
4,
|
|
"奡奣奤奦",
|
|
12,
|
|
"奵奷奺奻奼奾奿妀妅妉妋妌妎妏妐妑妔妕妘妚妛妜妝妟妠妡妢妦"
|
|
],
|
|
[
|
|
"8a80",
|
|
"妧妬妭妰妱妳",
|
|
5,
|
|
"妺妼妽妿",
|
|
6,
|
|
"姇姈姉姌姍姎姏姕姖姙姛姞",
|
|
4,
|
|
"姤姦姧姩姪姫姭",
|
|
11,
|
|
"姺姼姽姾娀娂娊娋娍娎娏娐娒娔娕娖娗娙娚娛娝娞娡娢娤娦娧娨娪",
|
|
6,
|
|
"娳娵娷",
|
|
4,
|
|
"娽娾娿婁",
|
|
4,
|
|
"婇婈婋",
|
|
9,
|
|
"婖婗婘婙婛",
|
|
5
|
|
],
|
|
[
|
|
"8b40",
|
|
"婡婣婤婥婦婨婩婫",
|
|
8,
|
|
"婸婹婻婼婽婾媀",
|
|
17,
|
|
"媓",
|
|
6,
|
|
"媜",
|
|
13,
|
|
"媫媬"
|
|
],
|
|
[
|
|
"8b80",
|
|
"媭",
|
|
4,
|
|
"媴媶媷媹",
|
|
4,
|
|
"媿嫀嫃",
|
|
5,
|
|
"嫊嫋嫍",
|
|
4,
|
|
"嫓嫕嫗嫙嫚嫛嫝嫞嫟嫢嫤嫥嫧嫨嫪嫬",
|
|
4,
|
|
"嫲",
|
|
22,
|
|
"嬊",
|
|
11,
|
|
"嬘",
|
|
25,
|
|
"嬳嬵嬶嬸",
|
|
7,
|
|
"孁",
|
|
6
|
|
],
|
|
[
|
|
"8c40",
|
|
"孈",
|
|
7,
|
|
"孒孖孞孠孡孧孨孫孭孮孯孲孴孶孷學孹孻孼孾孿宂宆宊宍宎宐宑宒宔宖実宧宨宩宬宭宮宯宱宲宷宺宻宼寀寁寃寈寉寊寋寍寎寏"
|
|
],
|
|
[
|
|
"8c80",
|
|
"寑寔",
|
|
8,
|
|
"寠寢寣實寧審",
|
|
4,
|
|
"寯寱",
|
|
6,
|
|
"寽対尀専尃尅將專尋尌對導尐尒尓尗尙尛尞尟尠尡尣尦尨尩尪尫尭尮尯尰尲尳尵尶尷屃屄屆屇屌屍屒屓屔屖屗屘屚屛屜屝屟屢層屧",
|
|
6,
|
|
"屰屲",
|
|
6,
|
|
"屻屼屽屾岀岃",
|
|
4,
|
|
"岉岊岋岎岏岒岓岕岝",
|
|
4,
|
|
"岤",
|
|
4
|
|
],
|
|
[
|
|
"8d40",
|
|
"岪岮岯岰岲岴岶岹岺岻岼岾峀峂峃峅",
|
|
5,
|
|
"峌",
|
|
5,
|
|
"峓",
|
|
5,
|
|
"峚",
|
|
6,
|
|
"峢峣峧峩峫峬峮峯峱",
|
|
9,
|
|
"峼",
|
|
4
|
|
],
|
|
[
|
|
"8d80",
|
|
"崁崄崅崈",
|
|
5,
|
|
"崏",
|
|
4,
|
|
"崕崗崘崙崚崜崝崟",
|
|
4,
|
|
"崥崨崪崫崬崯",
|
|
4,
|
|
"崵",
|
|
7,
|
|
"崿",
|
|
7,
|
|
"嵈嵉嵍",
|
|
10,
|
|
"嵙嵚嵜嵞",
|
|
10,
|
|
"嵪嵭嵮嵰嵱嵲嵳嵵",
|
|
12,
|
|
"嶃",
|
|
21,
|
|
"嶚嶛嶜嶞嶟嶠"
|
|
],
|
|
[
|
|
"8e40",
|
|
"嶡",
|
|
21,
|
|
"嶸",
|
|
12,
|
|
"巆",
|
|
6,
|
|
"巎",
|
|
12,
|
|
"巜巟巠巣巤巪巬巭"
|
|
],
|
|
[
|
|
"8e80",
|
|
"巰巵巶巸",
|
|
4,
|
|
"巿帀帄帇帉帊帋帍帎帒帓帗帞",
|
|
7,
|
|
"帨",
|
|
4,
|
|
"帯帰帲",
|
|
4,
|
|
"帹帺帾帿幀幁幃幆",
|
|
5,
|
|
"幍",
|
|
6,
|
|
"幖",
|
|
4,
|
|
"幜幝幟幠幣",
|
|
14,
|
|
"幵幷幹幾庁庂広庅庈庉庌庍庎庒庘庛庝庡庢庣庤庨",
|
|
4,
|
|
"庮",
|
|
4,
|
|
"庴庺庻庼庽庿",
|
|
6
|
|
],
|
|
[
|
|
"8f40",
|
|
"廆廇廈廋",
|
|
5,
|
|
"廔廕廗廘廙廚廜",
|
|
11,
|
|
"廩廫",
|
|
8,
|
|
"廵廸廹廻廼廽弅弆弇弉弌弍弎弐弒弔弖弙弚弜弝弞弡弢弣弤"
|
|
],
|
|
[
|
|
"8f80",
|
|
"弨弫弬弮弰弲",
|
|
6,
|
|
"弻弽弾弿彁",
|
|
14,
|
|
"彑彔彙彚彛彜彞彟彠彣彥彧彨彫彮彯彲彴彵彶彸彺彽彾彿徃徆徍徎徏徑従徔徖徚徛徝從徟徠徢",
|
|
5,
|
|
"復徫徬徯",
|
|
5,
|
|
"徶徸徹徺徻徾",
|
|
4,
|
|
"忇忈忊忋忎忓忔忕忚忛応忞忟忢忣忥忦忨忩忬忯忰忲忳忴忶忷忹忺忼怇"
|
|
],
|
|
[
|
|
"9040",
|
|
"怈怉怋怌怐怑怓怗怘怚怞怟怢怣怤怬怭怮怰",
|
|
4,
|
|
"怶",
|
|
4,
|
|
"怽怾恀恄",
|
|
6,
|
|
"恌恎恏恑恓恔恖恗恘恛恜恞恟恠恡恥恦恮恱恲恴恵恷恾悀"
|
|
],
|
|
[
|
|
"9080",
|
|
"悁悂悅悆悇悈悊悋悎悏悐悑悓悕悗悘悙悜悞悡悢悤悥悧悩悪悮悰悳悵悶悷悹悺悽",
|
|
7,
|
|
"惇惈惉惌",
|
|
4,
|
|
"惒惓惔惖惗惙惛惞惡",
|
|
4,
|
|
"惪惱惲惵惷惸惻",
|
|
4,
|
|
"愂愃愄愅愇愊愋愌愐",
|
|
4,
|
|
"愖愗愘愙愛愜愝愞愡愢愥愨愩愪愬",
|
|
18,
|
|
"慀",
|
|
6
|
|
],
|
|
[
|
|
"9140",
|
|
"慇慉態慍慏慐慒慓慔慖",
|
|
6,
|
|
"慞慟慠慡慣慤慥慦慩",
|
|
6,
|
|
"慱慲慳慴慶慸",
|
|
18,
|
|
"憌憍憏",
|
|
4,
|
|
"憕"
|
|
],
|
|
[
|
|
"9180",
|
|
"憖",
|
|
6,
|
|
"憞",
|
|
8,
|
|
"憪憫憭",
|
|
9,
|
|
"憸",
|
|
5,
|
|
"憿懀懁懃",
|
|
4,
|
|
"應懌",
|
|
4,
|
|
"懓懕",
|
|
16,
|
|
"懧",
|
|
13,
|
|
"懶",
|
|
8,
|
|
"戀",
|
|
5,
|
|
"戇戉戓戔戙戜戝戞戠戣戦戧戨戩戫戭戯戰戱戲戵戶戸",
|
|
4,
|
|
"扂扄扅扆扊"
|
|
],
|
|
[
|
|
"9240",
|
|
"扏扐払扖扗扙扚扜",
|
|
6,
|
|
"扤扥扨扱扲扴扵扷扸扺扻扽抁抂抃抅抆抇抈抋",
|
|
5,
|
|
"抔抙抜抝択抣抦抧抩抪抭抮抯抰抲抳抴抶抷抸抺抾拀拁"
|
|
],
|
|
[
|
|
"9280",
|
|
"拃拋拏拑拕拝拞拠拡拤拪拫拰拲拵拸拹拺拻挀挃挄挅挆挊挋挌挍挏挐挒挓挔挕挗挘挙挜挦挧挩挬挭挮挰挱挳",
|
|
5,
|
|
"挻挼挾挿捀捁捄捇捈捊捑捒捓捔捖",
|
|
7,
|
|
"捠捤捥捦捨捪捫捬捯捰捲捳捴捵捸捹捼捽捾捿掁掃掄掅掆掋掍掑掓掔掕掗掙",
|
|
6,
|
|
"採掤掦掫掯掱掲掵掶掹掻掽掿揀"
|
|
],
|
|
[
|
|
"9340",
|
|
"揁揂揃揅揇揈揊揋揌揑揓揔揕揗",
|
|
6,
|
|
"揟揢揤",
|
|
4,
|
|
"揫揬揮揯揰揱揳揵揷揹揺揻揼揾搃搄搆",
|
|
4,
|
|
"損搎搑搒搕",
|
|
5,
|
|
"搝搟搢搣搤"
|
|
],
|
|
[
|
|
"9380",
|
|
"搥搧搨搩搫搮",
|
|
5,
|
|
"搵",
|
|
4,
|
|
"搻搼搾摀摂摃摉摋",
|
|
6,
|
|
"摓摕摖摗摙",
|
|
4,
|
|
"摟",
|
|
7,
|
|
"摨摪摫摬摮",
|
|
9,
|
|
"摻",
|
|
6,
|
|
"撃撆撈",
|
|
8,
|
|
"撓撔撗撘撚撛撜撝撟",
|
|
4,
|
|
"撥撦撧撨撪撫撯撱撲撳撴撶撹撻撽撾撿擁擃擄擆",
|
|
6,
|
|
"擏擑擓擔擕擖擙據"
|
|
],
|
|
[
|
|
"9440",
|
|
"擛擜擝擟擠擡擣擥擧",
|
|
24,
|
|
"攁",
|
|
7,
|
|
"攊",
|
|
7,
|
|
"攓",
|
|
4,
|
|
"攙",
|
|
8
|
|
],
|
|
[
|
|
"9480",
|
|
"攢攣攤攦",
|
|
4,
|
|
"攬攭攰攱攲攳攷攺攼攽敀",
|
|
4,
|
|
"敆敇敊敋敍敎敐敒敓敔敗敘敚敜敟敠敡敤敥敧敨敩敪敭敮敯敱敳敵敶數",
|
|
14,
|
|
"斈斉斊斍斎斏斒斔斕斖斘斚斝斞斠斢斣斦斨斪斬斮斱",
|
|
7,
|
|
"斺斻斾斿旀旂旇旈旉旊旍旐旑旓旔旕旘",
|
|
7,
|
|
"旡旣旤旪旫"
|
|
],
|
|
[
|
|
"9540",
|
|
"旲旳旴旵旸旹旻",
|
|
4,
|
|
"昁昄昅昇昈昉昋昍昐昑昒昖昗昘昚昛昜昞昡昢昣昤昦昩昪昫昬昮昰昲昳昷",
|
|
4,
|
|
"昽昿晀時晄",
|
|
6,
|
|
"晍晎晐晑晘"
|
|
],
|
|
[
|
|
"9580",
|
|
"晙晛晜晝晞晠晢晣晥晧晩",
|
|
4,
|
|
"晱晲晳晵晸晹晻晼晽晿暀暁暃暅暆暈暉暊暋暍暎暏暐暒暓暔暕暘",
|
|
4,
|
|
"暞",
|
|
8,
|
|
"暩",
|
|
4,
|
|
"暯",
|
|
4,
|
|
"暵暶暷暸暺暻暼暽暿",
|
|
25,
|
|
"曚曞",
|
|
7,
|
|
"曧曨曪",
|
|
5,
|
|
"曱曵曶書曺曻曽朁朂會"
|
|
],
|
|
[
|
|
"9640",
|
|
"朄朅朆朇朌朎朏朑朒朓朖朘朙朚朜朞朠",
|
|
5,
|
|
"朧朩朮朰朲朳朶朷朸朹朻朼朾朿杁杄杅杇杊杋杍杒杔杕杗",
|
|
4,
|
|
"杝杢杣杤杦杧杫杬杮東杴杶"
|
|
],
|
|
[
|
|
"9680",
|
|
"杸杹杺杻杽枀枂枃枅枆枈枊枌枍枎枏枑枒枓枔枖枙枛枟枠枡枤枦枩枬枮枱枲枴枹",
|
|
7,
|
|
"柂柅",
|
|
9,
|
|
"柕柖柗柛柟柡柣柤柦柧柨柪柫柭柮柲柵",
|
|
7,
|
|
"柾栁栂栃栄栆栍栐栒栔栕栘",
|
|
4,
|
|
"栞栟栠栢",
|
|
6,
|
|
"栫",
|
|
6,
|
|
"栴栵栶栺栻栿桇桋桍桏桒桖",
|
|
5
|
|
],
|
|
[
|
|
"9740",
|
|
"桜桝桞桟桪桬",
|
|
7,
|
|
"桵桸",
|
|
8,
|
|
"梂梄梇",
|
|
7,
|
|
"梐梑梒梔梕梖梘",
|
|
9,
|
|
"梣梤梥梩梪梫梬梮梱梲梴梶梷梸"
|
|
],
|
|
[
|
|
"9780",
|
|
"梹",
|
|
6,
|
|
"棁棃",
|
|
5,
|
|
"棊棌棎棏棐棑棓棔棖棗棙棛",
|
|
4,
|
|
"棡棢棤",
|
|
9,
|
|
"棯棲棳棴棶棷棸棻棽棾棿椀椂椃椄椆",
|
|
4,
|
|
"椌椏椑椓",
|
|
11,
|
|
"椡椢椣椥",
|
|
7,
|
|
"椮椯椱椲椳椵椶椷椸椺椻椼椾楀楁楃",
|
|
16,
|
|
"楕楖楘楙楛楜楟"
|
|
],
|
|
[
|
|
"9840",
|
|
"楡楢楤楥楧楨楩楪楬業楯楰楲",
|
|
4,
|
|
"楺楻楽楾楿榁榃榅榊榋榌榎",
|
|
5,
|
|
"榖榗榙榚榝",
|
|
9,
|
|
"榩榪榬榮榯榰榲榳榵榶榸榹榺榼榽"
|
|
],
|
|
[
|
|
"9880",
|
|
"榾榿槀槂",
|
|
7,
|
|
"構槍槏槑槒槓槕",
|
|
5,
|
|
"槜槝槞槡",
|
|
11,
|
|
"槮槯槰槱槳",
|
|
9,
|
|
"槾樀",
|
|
9,
|
|
"樋",
|
|
11,
|
|
"標",
|
|
5,
|
|
"樠樢",
|
|
5,
|
|
"権樫樬樭樮樰樲樳樴樶",
|
|
6,
|
|
"樿",
|
|
4,
|
|
"橅橆橈",
|
|
7,
|
|
"橑",
|
|
6,
|
|
"橚"
|
|
],
|
|
[
|
|
"9940",
|
|
"橜",
|
|
4,
|
|
"橢橣橤橦",
|
|
10,
|
|
"橲",
|
|
6,
|
|
"橺橻橽橾橿檁檂檃檅",
|
|
8,
|
|
"檏檒",
|
|
4,
|
|
"檘",
|
|
7,
|
|
"檡",
|
|
5
|
|
],
|
|
[
|
|
"9980",
|
|
"檧檨檪檭",
|
|
114,
|
|
"欥欦欨",
|
|
6
|
|
],
|
|
[
|
|
"9a40",
|
|
"欯欰欱欳欴欵欶欸欻欼欽欿歀歁歂歄歅歈歊歋歍",
|
|
11,
|
|
"歚",
|
|
7,
|
|
"歨歩歫",
|
|
13,
|
|
"歺歽歾歿殀殅殈"
|
|
],
|
|
[
|
|
"9a80",
|
|
"殌殎殏殐殑殔殕殗殘殙殜",
|
|
4,
|
|
"殢",
|
|
7,
|
|
"殫",
|
|
7,
|
|
"殶殸",
|
|
6,
|
|
"毀毃毄毆",
|
|
4,
|
|
"毌毎毐毑毘毚毜",
|
|
4,
|
|
"毢",
|
|
7,
|
|
"毬毭毮毰毱毲毴毶毷毸毺毻毼毾",
|
|
6,
|
|
"氈",
|
|
4,
|
|
"氎氒気氜氝氞氠氣氥氫氬氭氱氳氶氷氹氺氻氼氾氿汃汄汅汈汋",
|
|
4,
|
|
"汑汒汓汖汘"
|
|
],
|
|
[
|
|
"9b40",
|
|
"汙汚汢汣汥汦汧汫",
|
|
4,
|
|
"汱汳汵汷汸決汻汼汿沀沄沇沊沋沍沎沑沒沕沖沗沘沚沜沝沞沠沢沨沬沯沰沴沵沶沷沺泀況泂泃泆泇泈泋泍泎泏泑泒泘"
|
|
],
|
|
[
|
|
"9b80",
|
|
"泙泚泜泝泟泤泦泧泩泬泭泲泴泹泿洀洂洃洅洆洈洉洊洍洏洐洑洓洔洕洖洘洜洝洟",
|
|
5,
|
|
"洦洨洩洬洭洯洰洴洶洷洸洺洿浀浂浄浉浌浐浕浖浗浘浛浝浟浡浢浤浥浧浨浫浬浭浰浱浲浳浵浶浹浺浻浽",
|
|
4,
|
|
"涃涄涆涇涊涋涍涏涐涒涖",
|
|
4,
|
|
"涜涢涥涬涭涰涱涳涴涶涷涹",
|
|
5,
|
|
"淁淂淃淈淉淊"
|
|
],
|
|
[
|
|
"9c40",
|
|
"淍淎淏淐淒淓淔淕淗淚淛淜淟淢淣淥淧淨淩淪淭淯淰淲淴淵淶淸淺淽",
|
|
7,
|
|
"渆渇済渉渋渏渒渓渕渘渙減渜渞渟渢渦渧渨渪測渮渰渱渳渵"
|
|
],
|
|
[
|
|
"9c80",
|
|
"渶渷渹渻",
|
|
7,
|
|
"湅",
|
|
7,
|
|
"湏湐湑湒湕湗湙湚湜湝湞湠",
|
|
10,
|
|
"湬湭湯",
|
|
14,
|
|
"満溁溂溄溇溈溊",
|
|
4,
|
|
"溑",
|
|
6,
|
|
"溙溚溛溝溞溠溡溣溤溦溨溩溫溬溭溮溰溳溵溸溹溼溾溿滀滃滄滅滆滈滉滊滌滍滎滐滒滖滘滙滛滜滝滣滧滪",
|
|
5
|
|
],
|
|
[
|
|
"9d40",
|
|
"滰滱滲滳滵滶滷滸滺",
|
|
7,
|
|
"漃漄漅漇漈漊",
|
|
4,
|
|
"漐漑漒漖",
|
|
9,
|
|
"漡漢漣漥漦漧漨漬漮漰漲漴漵漷",
|
|
6,
|
|
"漿潀潁潂"
|
|
],
|
|
[
|
|
"9d80",
|
|
"潃潄潅潈潉潊潌潎",
|
|
9,
|
|
"潙潚潛潝潟潠潡潣潤潥潧",
|
|
5,
|
|
"潯潰潱潳潵潶潷潹潻潽",
|
|
6,
|
|
"澅澆澇澊澋澏",
|
|
12,
|
|
"澝澞澟澠澢",
|
|
4,
|
|
"澨",
|
|
10,
|
|
"澴澵澷澸澺",
|
|
5,
|
|
"濁濃",
|
|
5,
|
|
"濊",
|
|
6,
|
|
"濓",
|
|
10,
|
|
"濟濢濣濤濥"
|
|
],
|
|
[
|
|
"9e40",
|
|
"濦",
|
|
7,
|
|
"濰",
|
|
32,
|
|
"瀒",
|
|
7,
|
|
"瀜",
|
|
6,
|
|
"瀤",
|
|
6
|
|
],
|
|
[
|
|
"9e80",
|
|
"瀫",
|
|
9,
|
|
"瀶瀷瀸瀺",
|
|
17,
|
|
"灍灎灐",
|
|
13,
|
|
"灟",
|
|
11,
|
|
"灮灱灲灳灴灷灹灺灻災炁炂炃炄炆炇炈炋炌炍炏炐炑炓炗炘炚炛炞",
|
|
12,
|
|
"炰炲炴炵炶為炾炿烄烅烆烇烉烋",
|
|
12,
|
|
"烚"
|
|
],
|
|
[
|
|
"9f40",
|
|
"烜烝烞烠烡烢烣烥烪烮烰",
|
|
6,
|
|
"烸烺烻烼烾",
|
|
10,
|
|
"焋",
|
|
4,
|
|
"焑焒焔焗焛",
|
|
10,
|
|
"焧",
|
|
7,
|
|
"焲焳焴"
|
|
],
|
|
[
|
|
"9f80",
|
|
"焵焷",
|
|
13,
|
|
"煆煇煈煉煋煍煏",
|
|
12,
|
|
"煝煟",
|
|
4,
|
|
"煥煩",
|
|
4,
|
|
"煯煰煱煴煵煶煷煹煻煼煾",
|
|
5,
|
|
"熅",
|
|
4,
|
|
"熋熌熍熎熐熑熒熓熕熖熗熚",
|
|
4,
|
|
"熡",
|
|
6,
|
|
"熩熪熫熭",
|
|
5,
|
|
"熴熶熷熸熺",
|
|
8,
|
|
"燄",
|
|
9,
|
|
"燏",
|
|
4
|
|
],
|
|
[
|
|
"a040",
|
|
"燖",
|
|
9,
|
|
"燡燢燣燤燦燨",
|
|
5,
|
|
"燯",
|
|
9,
|
|
"燺",
|
|
11,
|
|
"爇",
|
|
19
|
|
],
|
|
[
|
|
"a080",
|
|
"爛爜爞",
|
|
9,
|
|
"爩爫爭爮爯爲爳爴爺爼爾牀",
|
|
6,
|
|
"牉牊牋牎牏牐牑牓牔牕牗牘牚牜牞牠牣牤牥牨牪牫牬牭牰牱牳牴牶牷牸牻牼牽犂犃犅",
|
|
4,
|
|
"犌犎犐犑犓",
|
|
11,
|
|
"犠",
|
|
11,
|
|
"犮犱犲犳犵犺",
|
|
6,
|
|
"狅狆狇狉狊狋狌狏狑狓狔狕狖狘狚狛"
|
|
],
|
|
[
|
|
"a1a1",
|
|
" 、。·ˉˇ¨〃々—~‖…‘’“”〔〕〈",
|
|
7,
|
|
"〖〗【】±×÷∶∧∨∑∏∪∩∈∷√⊥∥∠⌒⊙∫∮≡≌≈∽∝≠≮≯≤≥∞∵∴♂♀°′″℃$¤¢£‰§№☆★○●◎◇◆□■△▲※→←↑↓〓"
|
|
],
|
|
[
|
|
"a2a1",
|
|
"ⅰ",
|
|
9
|
|
],
|
|
[
|
|
"a2b1",
|
|
"⒈",
|
|
19,
|
|
"⑴",
|
|
19,
|
|
"①",
|
|
9
|
|
],
|
|
[
|
|
"a2e5",
|
|
"㈠",
|
|
9
|
|
],
|
|
[
|
|
"a2f1",
|
|
"Ⅰ",
|
|
11
|
|
],
|
|
[
|
|
"a3a1",
|
|
"!"#¥%",
|
|
88,
|
|
" ̄"
|
|
],
|
|
[
|
|
"a4a1",
|
|
"ぁ",
|
|
82
|
|
],
|
|
[
|
|
"a5a1",
|
|
"ァ",
|
|
85
|
|
],
|
|
[
|
|
"a6a1",
|
|
"Α",
|
|
16,
|
|
"Σ",
|
|
6
|
|
],
|
|
[
|
|
"a6c1",
|
|
"α",
|
|
16,
|
|
"σ",
|
|
6
|
|
],
|
|
[
|
|
"a6e0",
|
|
"︵︶︹︺︿﹀︽︾﹁﹂﹃﹄"
|
|
],
|
|
[
|
|
"a6ee",
|
|
"︻︼︷︸︱"
|
|
],
|
|
[
|
|
"a6f4",
|
|
"︳︴"
|
|
],
|
|
[
|
|
"a7a1",
|
|
"А",
|
|
5,
|
|
"ЁЖ",
|
|
25
|
|
],
|
|
[
|
|
"a7d1",
|
|
"а",
|
|
5,
|
|
"ёж",
|
|
25
|
|
],
|
|
[
|
|
"a840",
|
|
"ˊˋ˙–―‥‵℅℉↖↗↘↙∕∟∣≒≦≧⊿═",
|
|
35,
|
|
"▁",
|
|
6
|
|
],
|
|
[
|
|
"a880",
|
|
"█",
|
|
7,
|
|
"▓▔▕▼▽◢◣◤◥☉⊕〒〝〞"
|
|
],
|
|
[
|
|
"a8a1",
|
|
"āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜüêɑ"
|
|
],
|
|
[
|
|
"a8bd",
|
|
"ńň"
|
|
],
|
|
[
|
|
"a8c0",
|
|
"ɡ"
|
|
],
|
|
[
|
|
"a8c5",
|
|
"ㄅ",
|
|
36
|
|
],
|
|
[
|
|
"a940",
|
|
"〡",
|
|
8,
|
|
"㊣㎎㎏㎜㎝㎞㎡㏄㏎㏑㏒㏕︰¬¦"
|
|
],
|
|
[
|
|
"a959",
|
|
"℡㈱"
|
|
],
|
|
[
|
|
"a95c",
|
|
"‐"
|
|
],
|
|
[
|
|
"a960",
|
|
"ー゛゜ヽヾ〆ゝゞ﹉",
|
|
9,
|
|
"﹔﹕﹖﹗﹙",
|
|
8
|
|
],
|
|
[
|
|
"a980",
|
|
"﹢",
|
|
4,
|
|
"﹨﹩﹪﹫"
|
|
],
|
|
[
|
|
"a996",
|
|
"〇"
|
|
],
|
|
[
|
|
"a9a4",
|
|
"─",
|
|
75
|
|
],
|
|
[
|
|
"aa40",
|
|
"狜狝狟狢",
|
|
5,
|
|
"狪狫狵狶狹狽狾狿猀猂猄",
|
|
5,
|
|
"猋猌猍猏猐猑猒猔猘猙猚猟猠猣猤猦猧猨猭猯猰猲猳猵猶猺猻猼猽獀",
|
|
8
|
|
],
|
|
[
|
|
"aa80",
|
|
"獉獊獋獌獎獏獑獓獔獕獖獘",
|
|
7,
|
|
"獡",
|
|
10,
|
|
"獮獰獱"
|
|
],
|
|
[
|
|
"ab40",
|
|
"獲",
|
|
11,
|
|
"獿",
|
|
4,
|
|
"玅玆玈玊玌玍玏玐玒玓玔玕玗玘玙玚玜玝玞玠玡玣",
|
|
5,
|
|
"玪玬玭玱玴玵玶玸玹玼玽玾玿珁珃",
|
|
4
|
|
],
|
|
[
|
|
"ab80",
|
|
"珋珌珎珒",
|
|
6,
|
|
"珚珛珜珝珟珡珢珣珤珦珨珪珫珬珮珯珰珱珳",
|
|
4
|
|
],
|
|
[
|
|
"ac40",
|
|
"珸",
|
|
10,
|
|
"琄琇琈琋琌琍琎琑",
|
|
8,
|
|
"琜",
|
|
5,
|
|
"琣琤琧琩琫琭琯琱琲琷",
|
|
4,
|
|
"琽琾琿瑀瑂",
|
|
11
|
|
],
|
|
[
|
|
"ac80",
|
|
"瑎",
|
|
6,
|
|
"瑖瑘瑝瑠",
|
|
12,
|
|
"瑮瑯瑱",
|
|
4,
|
|
"瑸瑹瑺"
|
|
],
|
|
[
|
|
"ad40",
|
|
"瑻瑼瑽瑿璂璄璅璆璈璉璊璌璍璏璑",
|
|
10,
|
|
"璝璟",
|
|
7,
|
|
"璪",
|
|
15,
|
|
"璻",
|
|
12
|
|
],
|
|
[
|
|
"ad80",
|
|
"瓈",
|
|
9,
|
|
"瓓",
|
|
8,
|
|
"瓝瓟瓡瓥瓧",
|
|
6,
|
|
"瓰瓱瓲"
|
|
],
|
|
[
|
|
"ae40",
|
|
"瓳瓵瓸",
|
|
6,
|
|
"甀甁甂甃甅",
|
|
7,
|
|
"甎甐甒甔甕甖甗甛甝甞甠",
|
|
4,
|
|
"甦甧甪甮甴甶甹甼甽甿畁畂畃畄畆畇畉畊畍畐畑畒畓畕畖畗畘"
|
|
],
|
|
[
|
|
"ae80",
|
|
"畝",
|
|
7,
|
|
"畧畨畩畫",
|
|
6,
|
|
"畳畵當畷畺",
|
|
4,
|
|
"疀疁疂疄疅疇"
|
|
],
|
|
[
|
|
"af40",
|
|
"疈疉疊疌疍疎疐疓疕疘疛疜疞疢疦",
|
|
4,
|
|
"疭疶疷疺疻疿痀痁痆痋痌痎痏痐痑痓痗痙痚痜痝痟痠痡痥痩痬痭痮痯痲痳痵痶痷痸痺痻痽痾瘂瘄瘆瘇"
|
|
],
|
|
[
|
|
"af80",
|
|
"瘈瘉瘋瘍瘎瘏瘑瘒瘓瘔瘖瘚瘜瘝瘞瘡瘣瘧瘨瘬瘮瘯瘱瘲瘶瘷瘹瘺瘻瘽癁療癄"
|
|
],
|
|
[
|
|
"b040",
|
|
"癅",
|
|
6,
|
|
"癎",
|
|
5,
|
|
"癕癗",
|
|
4,
|
|
"癝癟癠癡癢癤",
|
|
6,
|
|
"癬癭癮癰",
|
|
7,
|
|
"癹発發癿皀皁皃皅皉皊皌皍皏皐皒皔皕皗皘皚皛"
|
|
],
|
|
[
|
|
"b080",
|
|
"皜",
|
|
7,
|
|
"皥",
|
|
8,
|
|
"皯皰皳皵",
|
|
9,
|
|
"盀盁盃啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆榜膀绑棒磅蚌镑傍谤苞胞包褒剥"
|
|
],
|
|
[
|
|
"b140",
|
|
"盄盇盉盋盌盓盕盙盚盜盝盞盠",
|
|
4,
|
|
"盦",
|
|
7,
|
|
"盰盳盵盶盷盺盻盽盿眀眂眃眅眆眊県眎",
|
|
10,
|
|
"眛眜眝眞眡眣眤眥眧眪眫"
|
|
],
|
|
[
|
|
"b180",
|
|
"眬眮眰",
|
|
4,
|
|
"眹眻眽眾眿睂睄睅睆睈",
|
|
7,
|
|
"睒",
|
|
7,
|
|
"睜薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳"
|
|
],
|
|
[
|
|
"b240",
|
|
"睝睞睟睠睤睧睩睪睭",
|
|
11,
|
|
"睺睻睼瞁瞂瞃瞆",
|
|
5,
|
|
"瞏瞐瞓",
|
|
11,
|
|
"瞡瞣瞤瞦瞨瞫瞭瞮瞯瞱瞲瞴瞶",
|
|
4
|
|
],
|
|
[
|
|
"b280",
|
|
"瞼瞾矀",
|
|
12,
|
|
"矎",
|
|
8,
|
|
"矘矙矚矝",
|
|
4,
|
|
"矤病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖"
|
|
],
|
|
[
|
|
"b340",
|
|
"矦矨矪矯矰矱矲矴矵矷矹矺矻矼砃",
|
|
5,
|
|
"砊砋砎砏砐砓砕砙砛砞砠砡砢砤砨砪砫砮砯砱砲砳砵砶砽砿硁硂硃硄硆硈硉硊硋硍硏硑硓硔硘硙硚"
|
|
],
|
|
[
|
|
"b380",
|
|
"硛硜硞",
|
|
11,
|
|
"硯",
|
|
7,
|
|
"硸硹硺硻硽",
|
|
6,
|
|
"场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚"
|
|
],
|
|
[
|
|
"b440",
|
|
"碄碅碆碈碊碋碏碐碒碔碕碖碙碝碞碠碢碤碦碨",
|
|
7,
|
|
"碵碶碷碸確碻碼碽碿磀磂磃磄磆磇磈磌磍磎磏磑磒磓磖磗磘磚",
|
|
9
|
|
],
|
|
[
|
|
"b480",
|
|
"磤磥磦磧磩磪磫磭",
|
|
4,
|
|
"磳磵磶磸磹磻",
|
|
5,
|
|
"礂礃礄礆",
|
|
6,
|
|
"础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮"
|
|
],
|
|
[
|
|
"b540",
|
|
"礍",
|
|
5,
|
|
"礔",
|
|
9,
|
|
"礟",
|
|
4,
|
|
"礥",
|
|
14,
|
|
"礵",
|
|
4,
|
|
"礽礿祂祃祄祅祇祊",
|
|
8,
|
|
"祔祕祘祙祡祣"
|
|
],
|
|
[
|
|
"b580",
|
|
"祤祦祩祪祫祬祮祰",
|
|
6,
|
|
"祹祻",
|
|
4,
|
|
"禂禃禆禇禈禉禋禌禍禎禐禑禒怠耽担丹单郸掸胆旦氮但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟蝶迭谍叠"
|
|
],
|
|
[
|
|
"b640",
|
|
"禓",
|
|
6,
|
|
"禛",
|
|
11,
|
|
"禨",
|
|
10,
|
|
"禴",
|
|
4,
|
|
"禼禿秂秄秅秇秈秊秌秎秏秐秓秔秖秗秙",
|
|
5,
|
|
"秠秡秢秥秨秪"
|
|
],
|
|
[
|
|
"b680",
|
|
"秬秮秱",
|
|
6,
|
|
"秹秺秼秾秿稁稄稅稇稈稉稊稌稏",
|
|
4,
|
|
"稕稖稘稙稛稜丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二"
|
|
],
|
|
[
|
|
"b740",
|
|
"稝稟稡稢稤",
|
|
14,
|
|
"稴稵稶稸稺稾穀",
|
|
5,
|
|
"穇",
|
|
9,
|
|
"穒",
|
|
4,
|
|
"穘",
|
|
16
|
|
],
|
|
[
|
|
"b780",
|
|
"穩",
|
|
6,
|
|
"穱穲穳穵穻穼穽穾窂窅窇窉窊窋窌窎窏窐窓窔窙窚窛窞窡窢贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服"
|
|
],
|
|
[
|
|
"b840",
|
|
"窣窤窧窩窪窫窮",
|
|
4,
|
|
"窴",
|
|
10,
|
|
"竀",
|
|
10,
|
|
"竌",
|
|
9,
|
|
"竗竘竚竛竜竝竡竢竤竧",
|
|
5,
|
|
"竮竰竱竲竳"
|
|
],
|
|
[
|
|
"b880",
|
|
"竴",
|
|
4,
|
|
"竻竼竾笀笁笂笅笇笉笌笍笎笐笒笓笖笗笘笚笜笝笟笡笢笣笧笩笭浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹"
|
|
],
|
|
[
|
|
"b940",
|
|
"笯笰笲笴笵笶笷笹笻笽笿",
|
|
5,
|
|
"筆筈筊筍筎筓筕筗筙筜筞筟筡筣",
|
|
10,
|
|
"筯筰筳筴筶筸筺筼筽筿箁箂箃箄箆",
|
|
6,
|
|
"箎箏"
|
|
],
|
|
[
|
|
"b980",
|
|
"箑箒箓箖箘箙箚箛箞箟箠箣箤箥箮箯箰箲箳箵箶箷箹",
|
|
7,
|
|
"篂篃範埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈"
|
|
],
|
|
[
|
|
"ba40",
|
|
"篅篈築篊篋篍篎篏篐篒篔",
|
|
4,
|
|
"篛篜篞篟篠篢篣篤篧篨篩篫篬篭篯篰篲",
|
|
4,
|
|
"篸篹篺篻篽篿",
|
|
7,
|
|
"簈簉簊簍簎簐",
|
|
5,
|
|
"簗簘簙"
|
|
],
|
|
[
|
|
"ba80",
|
|
"簚",
|
|
4,
|
|
"簠",
|
|
5,
|
|
"簨簩簫",
|
|
12,
|
|
"簹",
|
|
5,
|
|
"籂骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖"
|
|
],
|
|
[
|
|
"bb40",
|
|
"籃",
|
|
9,
|
|
"籎",
|
|
36,
|
|
"籵",
|
|
5,
|
|
"籾",
|
|
9
|
|
],
|
|
[
|
|
"bb80",
|
|
"粈粊",
|
|
6,
|
|
"粓粔粖粙粚粛粠粡粣粦粧粨粩粫粬粭粯粰粴",
|
|
4,
|
|
"粺粻弧虎唬护互沪户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸击圾基机畸稽积箕"
|
|
],
|
|
[
|
|
"bc40",
|
|
"粿糀糂糃糄糆糉糋糎",
|
|
6,
|
|
"糘糚糛糝糞糡",
|
|
6,
|
|
"糩",
|
|
5,
|
|
"糰",
|
|
7,
|
|
"糹糺糼",
|
|
13,
|
|
"紋",
|
|
5
|
|
],
|
|
[
|
|
"bc80",
|
|
"紑",
|
|
14,
|
|
"紡紣紤紥紦紨紩紪紬紭紮細",
|
|
6,
|
|
"肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件"
|
|
],
|
|
[
|
|
"bd40",
|
|
"紷",
|
|
54,
|
|
"絯",
|
|
7
|
|
],
|
|
[
|
|
"bd80",
|
|
"絸",
|
|
32,
|
|
"健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸"
|
|
],
|
|
[
|
|
"be40",
|
|
"継",
|
|
12,
|
|
"綧",
|
|
6,
|
|
"綯",
|
|
42
|
|
],
|
|
[
|
|
"be80",
|
|
"線",
|
|
32,
|
|
"尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻"
|
|
],
|
|
[
|
|
"bf40",
|
|
"緻",
|
|
62
|
|
],
|
|
[
|
|
"bf80",
|
|
"縺縼",
|
|
4,
|
|
"繂",
|
|
4,
|
|
"繈",
|
|
21,
|
|
"俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀"
|
|
],
|
|
[
|
|
"c040",
|
|
"繞",
|
|
35,
|
|
"纃",
|
|
23,
|
|
"纜纝纞"
|
|
],
|
|
[
|
|
"c080",
|
|
"纮纴纻纼绖绤绬绹缊缐缞缷缹缻",
|
|
6,
|
|
"罃罆",
|
|
9,
|
|
"罒罓馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐"
|
|
],
|
|
[
|
|
"c140",
|
|
"罖罙罛罜罝罞罠罣",
|
|
4,
|
|
"罫罬罭罯罰罳罵罶罷罸罺罻罼罽罿羀羂",
|
|
7,
|
|
"羋羍羏",
|
|
4,
|
|
"羕",
|
|
4,
|
|
"羛羜羠羢羣羥羦羨",
|
|
6,
|
|
"羱"
|
|
],
|
|
[
|
|
"c180",
|
|
"羳",
|
|
4,
|
|
"羺羻羾翀翂翃翄翆翇翈翉翋翍翏",
|
|
4,
|
|
"翖翗翙",
|
|
5,
|
|
"翢翣痢立粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫馏留刘瘤流柳六龙聋咙笼窿"
|
|
],
|
|
[
|
|
"c240",
|
|
"翤翧翨翪翫翬翭翯翲翴",
|
|
6,
|
|
"翽翾翿耂耇耈耉耊耎耏耑耓耚耛耝耞耟耡耣耤耫",
|
|
5,
|
|
"耲耴耹耺耼耾聀聁聄聅聇聈聉聎聏聐聑聓聕聖聗"
|
|
],
|
|
[
|
|
"c280",
|
|
"聙聛",
|
|
13,
|
|
"聫",
|
|
5,
|
|
"聲",
|
|
11,
|
|
"隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫"
|
|
],
|
|
[
|
|
"c340",
|
|
"聾肁肂肅肈肊肍",
|
|
5,
|
|
"肔肕肗肙肞肣肦肧肨肬肰肳肵肶肸肹肻胅胇",
|
|
4,
|
|
"胏",
|
|
6,
|
|
"胘胟胠胢胣胦胮胵胷胹胻胾胿脀脁脃脄脅脇脈脋"
|
|
],
|
|
[
|
|
"c380",
|
|
"脌脕脗脙脛脜脝脟",
|
|
12,
|
|
"脭脮脰脳脴脵脷脹",
|
|
4,
|
|
"脿谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸"
|
|
],
|
|
[
|
|
"c440",
|
|
"腀",
|
|
5,
|
|
"腇腉腍腎腏腒腖腗腘腛",
|
|
4,
|
|
"腡腢腣腤腦腨腪腫腬腯腲腳腵腶腷腸膁膃",
|
|
4,
|
|
"膉膋膌膍膎膐膒",
|
|
5,
|
|
"膙膚膞",
|
|
4,
|
|
"膤膥"
|
|
],
|
|
[
|
|
"c480",
|
|
"膧膩膫",
|
|
7,
|
|
"膴",
|
|
5,
|
|
"膼膽膾膿臄臅臇臈臉臋臍",
|
|
6,
|
|
"摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁"
|
|
],
|
|
[
|
|
"c540",
|
|
"臔",
|
|
14,
|
|
"臤臥臦臨臩臫臮",
|
|
4,
|
|
"臵",
|
|
5,
|
|
"臽臿舃與",
|
|
4,
|
|
"舎舏舑舓舕",
|
|
5,
|
|
"舝舠舤舥舦舧舩舮舲舺舼舽舿"
|
|
],
|
|
[
|
|
"c580",
|
|
"艀艁艂艃艅艆艈艊艌艍艎艐",
|
|
7,
|
|
"艙艛艜艝艞艠",
|
|
7,
|
|
"艩拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗"
|
|
],
|
|
[
|
|
"c640",
|
|
"艪艫艬艭艱艵艶艷艸艻艼芀芁芃芅芆芇芉芌芐芓芔芕芖芚芛芞芠芢芣芧芲芵芶芺芻芼芿苀苂苃苅苆苉苐苖苙苚苝苢苧苨苩苪苬苭苮苰苲苳苵苶苸"
|
|
],
|
|
[
|
|
"c680",
|
|
"苺苼",
|
|
4,
|
|
"茊茋茍茐茒茓茖茘茙茝",
|
|
9,
|
|
"茩茪茮茰茲茷茻茽啤脾疲皮匹痞僻屁譬篇偏片骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣讫掐"
|
|
],
|
|
[
|
|
"c740",
|
|
"茾茿荁荂荄荅荈荊",
|
|
4,
|
|
"荓荕",
|
|
4,
|
|
"荝荢荰",
|
|
6,
|
|
"荹荺荾",
|
|
6,
|
|
"莇莈莊莋莌莍莏莐莑莔莕莖莗莙莚莝莟莡",
|
|
6,
|
|
"莬莭莮"
|
|
],
|
|
[
|
|
"c780",
|
|
"莯莵莻莾莿菂菃菄菆菈菉菋菍菎菐菑菒菓菕菗菙菚菛菞菢菣菤菦菧菨菫菬菭恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠"
|
|
],
|
|
[
|
|
"c840",
|
|
"菮華菳",
|
|
4,
|
|
"菺菻菼菾菿萀萂萅萇萈萉萊萐萒",
|
|
5,
|
|
"萙萚萛萞",
|
|
5,
|
|
"萩",
|
|
7,
|
|
"萲",
|
|
5,
|
|
"萹萺萻萾",
|
|
7,
|
|
"葇葈葉"
|
|
],
|
|
[
|
|
"c880",
|
|
"葊",
|
|
6,
|
|
"葒",
|
|
4,
|
|
"葘葝葞葟葠葢葤",
|
|
4,
|
|
"葪葮葯葰葲葴葷葹葻葼取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁"
|
|
],
|
|
[
|
|
"c940",
|
|
"葽",
|
|
4,
|
|
"蒃蒄蒅蒆蒊蒍蒏",
|
|
7,
|
|
"蒘蒚蒛蒝蒞蒟蒠蒢",
|
|
12,
|
|
"蒰蒱蒳蒵蒶蒷蒻蒼蒾蓀蓂蓃蓅蓆蓇蓈蓋蓌蓎蓏蓒蓔蓕蓗"
|
|
],
|
|
[
|
|
"c980",
|
|
"蓘",
|
|
4,
|
|
"蓞蓡蓢蓤蓧",
|
|
4,
|
|
"蓭蓮蓯蓱",
|
|
10,
|
|
"蓽蓾蔀蔁蔂伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳"
|
|
],
|
|
[
|
|
"ca40",
|
|
"蔃",
|
|
8,
|
|
"蔍蔎蔏蔐蔒蔔蔕蔖蔘蔙蔛蔜蔝蔞蔠蔢",
|
|
8,
|
|
"蔭",
|
|
9,
|
|
"蔾",
|
|
4,
|
|
"蕄蕅蕆蕇蕋",
|
|
10
|
|
],
|
|
[
|
|
"ca80",
|
|
"蕗蕘蕚蕛蕜蕝蕟",
|
|
4,
|
|
"蕥蕦蕧蕩",
|
|
8,
|
|
"蕳蕵蕶蕷蕸蕼蕽蕿薀薁省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱"
|
|
],
|
|
[
|
|
"cb40",
|
|
"薂薃薆薈",
|
|
6,
|
|
"薐",
|
|
10,
|
|
"薝",
|
|
6,
|
|
"薥薦薧薩薫薬薭薱",
|
|
5,
|
|
"薸薺",
|
|
6,
|
|
"藂",
|
|
6,
|
|
"藊",
|
|
4,
|
|
"藑藒"
|
|
],
|
|
[
|
|
"cb80",
|
|
"藔藖",
|
|
5,
|
|
"藝",
|
|
6,
|
|
"藥藦藧藨藪",
|
|
14,
|
|
"恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔"
|
|
],
|
|
[
|
|
"cc40",
|
|
"藹藺藼藽藾蘀",
|
|
4,
|
|
"蘆",
|
|
10,
|
|
"蘒蘓蘔蘕蘗",
|
|
15,
|
|
"蘨蘪",
|
|
13,
|
|
"蘹蘺蘻蘽蘾蘿虀"
|
|
],
|
|
[
|
|
"cc80",
|
|
"虁",
|
|
11,
|
|
"虒虓處",
|
|
4,
|
|
"虛虜虝號虠虡虣",
|
|
7,
|
|
"獭挞蹋踏胎苔抬台泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳贴铁帖厅听烃"
|
|
],
|
|
[
|
|
"cd40",
|
|
"虭虯虰虲",
|
|
6,
|
|
"蚃",
|
|
6,
|
|
"蚎",
|
|
4,
|
|
"蚔蚖",
|
|
5,
|
|
"蚞",
|
|
4,
|
|
"蚥蚦蚫蚭蚮蚲蚳蚷蚸蚹蚻",
|
|
4,
|
|
"蛁蛂蛃蛅蛈蛌蛍蛒蛓蛕蛖蛗蛚蛜"
|
|
],
|
|
[
|
|
"cd80",
|
|
"蛝蛠蛡蛢蛣蛥蛦蛧蛨蛪蛫蛬蛯蛵蛶蛷蛺蛻蛼蛽蛿蜁蜄蜅蜆蜋蜌蜎蜏蜐蜑蜔蜖汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威"
|
|
],
|
|
[
|
|
"ce40",
|
|
"蜙蜛蜝蜟蜠蜤蜦蜧蜨蜪蜫蜬蜭蜯蜰蜲蜳蜵蜶蜸蜹蜺蜼蜽蝀",
|
|
6,
|
|
"蝊蝋蝍蝏蝐蝑蝒蝔蝕蝖蝘蝚",
|
|
5,
|
|
"蝡蝢蝦",
|
|
7,
|
|
"蝯蝱蝲蝳蝵"
|
|
],
|
|
[
|
|
"ce80",
|
|
"蝷蝸蝹蝺蝿螀螁螄螆螇螉螊螌螎",
|
|
4,
|
|
"螔螕螖螘",
|
|
6,
|
|
"螠",
|
|
4,
|
|
"巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺"
|
|
],
|
|
[
|
|
"cf40",
|
|
"螥螦螧螩螪螮螰螱螲螴螶螷螸螹螻螼螾螿蟁",
|
|
4,
|
|
"蟇蟈蟉蟌",
|
|
4,
|
|
"蟔",
|
|
6,
|
|
"蟜蟝蟞蟟蟡蟢蟣蟤蟦蟧蟨蟩蟫蟬蟭蟯",
|
|
9
|
|
],
|
|
[
|
|
"cf80",
|
|
"蟺蟻蟼蟽蟿蠀蠁蠂蠄",
|
|
5,
|
|
"蠋",
|
|
7,
|
|
"蠔蠗蠘蠙蠚蠜",
|
|
4,
|
|
"蠣稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓"
|
|
],
|
|
[
|
|
"d040",
|
|
"蠤",
|
|
13,
|
|
"蠳",
|
|
5,
|
|
"蠺蠻蠽蠾蠿衁衂衃衆",
|
|
5,
|
|
"衎",
|
|
5,
|
|
"衕衖衘衚",
|
|
6,
|
|
"衦衧衪衭衯衱衳衴衵衶衸衹衺"
|
|
],
|
|
[
|
|
"d080",
|
|
"衻衼袀袃袆袇袉袊袌袎袏袐袑袓袔袕袗",
|
|
4,
|
|
"袝",
|
|
4,
|
|
"袣袥",
|
|
5,
|
|
"小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄"
|
|
],
|
|
[
|
|
"d140",
|
|
"袬袮袯袰袲",
|
|
4,
|
|
"袸袹袺袻袽袾袿裀裃裄裇裈裊裋裌裍裏裐裑裓裖裗裚",
|
|
4,
|
|
"裠裡裦裧裩",
|
|
6,
|
|
"裲裵裶裷裺裻製裿褀褁褃",
|
|
5
|
|
],
|
|
[
|
|
"d180",
|
|
"褉褋",
|
|
4,
|
|
"褑褔",
|
|
4,
|
|
"褜",
|
|
4,
|
|
"褢褣褤褦褧褨褩褬褭褮褯褱褲褳褵褷选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶"
|
|
],
|
|
[
|
|
"d240",
|
|
"褸",
|
|
8,
|
|
"襂襃襅",
|
|
24,
|
|
"襠",
|
|
5,
|
|
"襧",
|
|
19,
|
|
"襼"
|
|
],
|
|
[
|
|
"d280",
|
|
"襽襾覀覂覄覅覇",
|
|
26,
|
|
"摇尧遥窑谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音阴姻吟银淫寅饮尹引隐"
|
|
],
|
|
[
|
|
"d340",
|
|
"覢",
|
|
30,
|
|
"觃觍觓觔觕觗觘觙觛觝觟觠觡觢觤觧觨觩觪觬觭觮觰觱觲觴",
|
|
6
|
|
],
|
|
[
|
|
"d380",
|
|
"觻",
|
|
4,
|
|
"訁",
|
|
5,
|
|
"計",
|
|
21,
|
|
"印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉"
|
|
],
|
|
[
|
|
"d440",
|
|
"訞",
|
|
31,
|
|
"訿",
|
|
8,
|
|
"詉",
|
|
21
|
|
],
|
|
[
|
|
"d480",
|
|
"詟",
|
|
25,
|
|
"詺",
|
|
6,
|
|
"浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧"
|
|
],
|
|
[
|
|
"d540",
|
|
"誁",
|
|
7,
|
|
"誋",
|
|
7,
|
|
"誔",
|
|
46
|
|
],
|
|
[
|
|
"d580",
|
|
"諃",
|
|
32,
|
|
"铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政"
|
|
],
|
|
[
|
|
"d640",
|
|
"諤",
|
|
34,
|
|
"謈",
|
|
27
|
|
],
|
|
[
|
|
"d680",
|
|
"謤謥謧",
|
|
30,
|
|
"帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑"
|
|
],
|
|
[
|
|
"d740",
|
|
"譆",
|
|
31,
|
|
"譧",
|
|
4,
|
|
"譭",
|
|
25
|
|
],
|
|
[
|
|
"d780",
|
|
"讇",
|
|
24,
|
|
"讬讱讻诇诐诪谉谞住注祝驻抓爪拽专砖转撰赚篆桩庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"
|
|
],
|
|
[
|
|
"d840",
|
|
"谸",
|
|
8,
|
|
"豂豃豄豅豈豊豋豍",
|
|
7,
|
|
"豖豗豘豙豛",
|
|
5,
|
|
"豣",
|
|
6,
|
|
"豬",
|
|
6,
|
|
"豴豵豶豷豻",
|
|
6,
|
|
"貃貄貆貇"
|
|
],
|
|
[
|
|
"d880",
|
|
"貈貋貍",
|
|
6,
|
|
"貕貖貗貙",
|
|
20,
|
|
"亍丌兀丐廿卅丕亘丞鬲孬噩丨禺丿匕乇夭爻卮氐囟胤馗毓睾鼗丶亟鼐乜乩亓芈孛啬嘏仄厍厝厣厥厮靥赝匚叵匦匮匾赜卦卣刂刈刎刭刳刿剀剌剞剡剜蒯剽劂劁劐劓冂罔亻仃仉仂仨仡仫仞伛仳伢佤仵伥伧伉伫佞佧攸佚佝"
|
|
],
|
|
[
|
|
"d940",
|
|
"貮",
|
|
62
|
|
],
|
|
[
|
|
"d980",
|
|
"賭",
|
|
32,
|
|
"佟佗伲伽佶佴侑侉侃侏佾佻侪佼侬侔俦俨俪俅俚俣俜俑俟俸倩偌俳倬倏倮倭俾倜倌倥倨偾偃偕偈偎偬偻傥傧傩傺僖儆僭僬僦僮儇儋仝氽佘佥俎龠汆籴兮巽黉馘冁夔勹匍訇匐凫夙兕亠兖亳衮袤亵脔裒禀嬴蠃羸冫冱冽冼"
|
|
],
|
|
[
|
|
"da40",
|
|
"贎",
|
|
14,
|
|
"贠赑赒赗赟赥赨赩赪赬赮赯赱赲赸",
|
|
8,
|
|
"趂趃趆趇趈趉趌",
|
|
4,
|
|
"趒趓趕",
|
|
9,
|
|
"趠趡"
|
|
],
|
|
[
|
|
"da80",
|
|
"趢趤",
|
|
12,
|
|
"趲趶趷趹趻趽跀跁跂跅跇跈跉跊跍跐跒跓跔凇冖冢冥讠讦讧讪讴讵讷诂诃诋诏诎诒诓诔诖诘诙诜诟诠诤诨诩诮诰诳诶诹诼诿谀谂谄谇谌谏谑谒谔谕谖谙谛谘谝谟谠谡谥谧谪谫谮谯谲谳谵谶卩卺阝阢阡阱阪阽阼陂陉陔陟陧陬陲陴隈隍隗隰邗邛邝邙邬邡邴邳邶邺"
|
|
],
|
|
[
|
|
"db40",
|
|
"跕跘跙跜跠跡跢跥跦跧跩跭跮跰跱跲跴跶跼跾",
|
|
6,
|
|
"踆踇踈踋踍踎踐踑踒踓踕",
|
|
7,
|
|
"踠踡踤",
|
|
4,
|
|
"踫踭踰踲踳踴踶踷踸踻踼踾"
|
|
],
|
|
[
|
|
"db80",
|
|
"踿蹃蹅蹆蹌",
|
|
4,
|
|
"蹓",
|
|
5,
|
|
"蹚",
|
|
11,
|
|
"蹧蹨蹪蹫蹮蹱邸邰郏郅邾郐郄郇郓郦郢郜郗郛郫郯郾鄄鄢鄞鄣鄱鄯鄹酃酆刍奂劢劬劭劾哿勐勖勰叟燮矍廴凵凼鬯厶弁畚巯坌垩垡塾墼壅壑圩圬圪圳圹圮圯坜圻坂坩垅坫垆坼坻坨坭坶坳垭垤垌垲埏垧垴垓垠埕埘埚埙埒垸埴埯埸埤埝"
|
|
],
|
|
[
|
|
"dc40",
|
|
"蹳蹵蹷",
|
|
4,
|
|
"蹽蹾躀躂躃躄躆躈",
|
|
6,
|
|
"躑躒躓躕",
|
|
6,
|
|
"躝躟",
|
|
11,
|
|
"躭躮躰躱躳",
|
|
6,
|
|
"躻",
|
|
7
|
|
],
|
|
[
|
|
"dc80",
|
|
"軃",
|
|
10,
|
|
"軏",
|
|
21,
|
|
"堋堍埽埭堀堞堙塄堠塥塬墁墉墚墀馨鼙懿艹艽艿芏芊芨芄芎芑芗芙芫芸芾芰苈苊苣芘芷芮苋苌苁芩芴芡芪芟苄苎芤苡茉苷苤茏茇苜苴苒苘茌苻苓茑茚茆茔茕苠苕茜荑荛荜茈莒茼茴茱莛荞茯荏荇荃荟荀茗荠茭茺茳荦荥"
|
|
],
|
|
[
|
|
"dd40",
|
|
"軥",
|
|
62
|
|
],
|
|
[
|
|
"dd80",
|
|
"輤",
|
|
32,
|
|
"荨茛荩荬荪荭荮莰荸莳莴莠莪莓莜莅荼莶莩荽莸荻莘莞莨莺莼菁萁菥菘堇萘萋菝菽菖萜萸萑萆菔菟萏萃菸菹菪菅菀萦菰菡葜葑葚葙葳蒇蒈葺蒉葸萼葆葩葶蒌蒎萱葭蓁蓍蓐蓦蒽蓓蓊蒿蒺蓠蒡蒹蒴蒗蓥蓣蔌甍蔸蓰蔹蔟蔺"
|
|
],
|
|
[
|
|
"de40",
|
|
"轅",
|
|
32,
|
|
"轪辀辌辒辝辠辡辢辤辥辦辧辪辬辭辮辯農辳辴辵辷辸辺辻込辿迀迃迆"
|
|
],
|
|
[
|
|
"de80",
|
|
"迉",
|
|
4,
|
|
"迏迒迖迗迚迠迡迣迧迬迯迱迲迴迵迶迺迻迼迾迿逇逈逌逎逓逕逘蕖蔻蓿蓼蕙蕈蕨蕤蕞蕺瞢蕃蕲蕻薤薨薇薏蕹薮薜薅薹薷薰藓藁藜藿蘧蘅蘩蘖蘼廾弈夼奁耷奕奚奘匏尢尥尬尴扌扪抟抻拊拚拗拮挢拶挹捋捃掭揶捱捺掎掴捭掬掊捩掮掼揲揸揠揿揄揞揎摒揆掾摅摁搋搛搠搌搦搡摞撄摭撖"
|
|
],
|
|
[
|
|
"df40",
|
|
"這逜連逤逥逧",
|
|
5,
|
|
"逰",
|
|
4,
|
|
"逷逹逺逽逿遀遃遅遆遈",
|
|
4,
|
|
"過達違遖遙遚遜",
|
|
5,
|
|
"遤遦遧適遪遫遬遯",
|
|
4,
|
|
"遶",
|
|
6,
|
|
"遾邁"
|
|
],
|
|
[
|
|
"df80",
|
|
"還邅邆邇邉邊邌",
|
|
4,
|
|
"邒邔邖邘邚邜邞邟邠邤邥邧邨邩邫邭邲邷邼邽邿郀摺撷撸撙撺擀擐擗擤擢攉攥攮弋忒甙弑卟叱叽叩叨叻吒吖吆呋呒呓呔呖呃吡呗呙吣吲咂咔呷呱呤咚咛咄呶呦咝哐咭哂咴哒咧咦哓哔呲咣哕咻咿哌哙哚哜咩咪咤哝哏哞唛哧唠哽唔哳唢唣唏唑唧唪啧喏喵啉啭啁啕唿啐唼"
|
|
],
|
|
[
|
|
"e040",
|
|
"郂郃郆郈郉郋郌郍郒郔郕郖郘郙郚郞郟郠郣郤郥郩郪郬郮郰郱郲郳郵郶郷郹郺郻郼郿鄀鄁鄃鄅",
|
|
19,
|
|
"鄚鄛鄜"
|
|
],
|
|
[
|
|
"e080",
|
|
"鄝鄟鄠鄡鄤",
|
|
10,
|
|
"鄰鄲",
|
|
6,
|
|
"鄺",
|
|
8,
|
|
"酄唷啖啵啶啷唳唰啜喋嗒喃喱喹喈喁喟啾嗖喑啻嗟喽喾喔喙嗪嗷嗉嘟嗑嗫嗬嗔嗦嗝嗄嗯嗥嗲嗳嗌嗍嗨嗵嗤辔嘞嘈嘌嘁嘤嘣嗾嘀嘧嘭噘嘹噗嘬噍噢噙噜噌噔嚆噤噱噫噻噼嚅嚓嚯囔囗囝囡囵囫囹囿圄圊圉圜帏帙帔帑帱帻帼"
|
|
],
|
|
[
|
|
"e140",
|
|
"酅酇酈酑酓酔酕酖酘酙酛酜酟酠酦酧酨酫酭酳酺酻酼醀",
|
|
4,
|
|
"醆醈醊醎醏醓",
|
|
6,
|
|
"醜",
|
|
5,
|
|
"醤",
|
|
5,
|
|
"醫醬醰醱醲醳醶醷醸醹醻"
|
|
],
|
|
[
|
|
"e180",
|
|
"醼",
|
|
10,
|
|
"釈釋釐釒",
|
|
9,
|
|
"針",
|
|
8,
|
|
"帷幄幔幛幞幡岌屺岍岐岖岈岘岙岑岚岜岵岢岽岬岫岱岣峁岷峄峒峤峋峥崂崃崧崦崮崤崞崆崛嵘崾崴崽嵬嵛嵯嵝嵫嵋嵊嵩嵴嶂嶙嶝豳嶷巅彳彷徂徇徉後徕徙徜徨徭徵徼衢彡犭犰犴犷犸狃狁狎狍狒狨狯狩狲狴狷猁狳猃狺"
|
|
],
|
|
[
|
|
"e240",
|
|
"釦",
|
|
62
|
|
],
|
|
[
|
|
"e280",
|
|
"鈥",
|
|
32,
|
|
"狻猗猓猡猊猞猝猕猢猹猥猬猸猱獐獍獗獠獬獯獾舛夥飧夤夂饣饧",
|
|
5,
|
|
"饴饷饽馀馄馇馊馍馐馑馓馔馕庀庑庋庖庥庠庹庵庾庳赓廒廑廛廨廪膺忄忉忖忏怃忮怄忡忤忾怅怆忪忭忸怙怵怦怛怏怍怩怫怊怿怡恸恹恻恺恂"
|
|
],
|
|
[
|
|
"e340",
|
|
"鉆",
|
|
45,
|
|
"鉵",
|
|
16
|
|
],
|
|
[
|
|
"e380",
|
|
"銆",
|
|
7,
|
|
"銏",
|
|
24,
|
|
"恪恽悖悚悭悝悃悒悌悛惬悻悱惝惘惆惚悴愠愦愕愣惴愀愎愫慊慵憬憔憧憷懔懵忝隳闩闫闱闳闵闶闼闾阃阄阆阈阊阋阌阍阏阒阕阖阗阙阚丬爿戕氵汔汜汊沣沅沐沔沌汨汩汴汶沆沩泐泔沭泷泸泱泗沲泠泖泺泫泮沱泓泯泾"
|
|
],
|
|
[
|
|
"e440",
|
|
"銨",
|
|
5,
|
|
"銯",
|
|
24,
|
|
"鋉",
|
|
31
|
|
],
|
|
[
|
|
"e480",
|
|
"鋩",
|
|
32,
|
|
"洹洧洌浃浈洇洄洙洎洫浍洮洵洚浏浒浔洳涑浯涞涠浞涓涔浜浠浼浣渚淇淅淞渎涿淠渑淦淝淙渖涫渌涮渫湮湎湫溲湟溆湓湔渲渥湄滟溱溘滠漭滢溥溧溽溻溷滗溴滏溏滂溟潢潆潇漤漕滹漯漶潋潴漪漉漩澉澍澌潸潲潼潺濑"
|
|
],
|
|
[
|
|
"e540",
|
|
"錊",
|
|
51,
|
|
"錿",
|
|
10
|
|
],
|
|
[
|
|
"e580",
|
|
"鍊",
|
|
31,
|
|
"鍫濉澧澹澶濂濡濮濞濠濯瀚瀣瀛瀹瀵灏灞宀宄宕宓宥宸甯骞搴寤寮褰寰蹇謇辶迓迕迥迮迤迩迦迳迨逅逄逋逦逑逍逖逡逵逶逭逯遄遑遒遐遨遘遢遛暹遴遽邂邈邃邋彐彗彖彘尻咫屐屙孱屣屦羼弪弩弭艴弼鬻屮妁妃妍妩妪妣"
|
|
],
|
|
[
|
|
"e640",
|
|
"鍬",
|
|
34,
|
|
"鎐",
|
|
27
|
|
],
|
|
[
|
|
"e680",
|
|
"鎬",
|
|
29,
|
|
"鏋鏌鏍妗姊妫妞妤姒妲妯姗妾娅娆姝娈姣姘姹娌娉娲娴娑娣娓婀婧婊婕娼婢婵胬媪媛婷婺媾嫫媲嫒嫔媸嫠嫣嫱嫖嫦嫘嫜嬉嬗嬖嬲嬷孀尕尜孚孥孳孑孓孢驵驷驸驺驿驽骀骁骅骈骊骐骒骓骖骘骛骜骝骟骠骢骣骥骧纟纡纣纥纨纩"
|
|
],
|
|
[
|
|
"e740",
|
|
"鏎",
|
|
7,
|
|
"鏗",
|
|
54
|
|
],
|
|
[
|
|
"e780",
|
|
"鐎",
|
|
32,
|
|
"纭纰纾绀绁绂绉绋绌绐绔绗绛绠绡绨绫绮绯绱绲缍绶绺绻绾缁缂缃缇缈缋缌缏缑缒缗缙缜缛缟缡",
|
|
6,
|
|
"缪缫缬缭缯",
|
|
4,
|
|
"缵幺畿巛甾邕玎玑玮玢玟珏珂珑玷玳珀珉珈珥珙顼琊珩珧珞玺珲琏琪瑛琦琥琨琰琮琬"
|
|
],
|
|
[
|
|
"e840",
|
|
"鐯",
|
|
14,
|
|
"鐿",
|
|
43,
|
|
"鑬鑭鑮鑯"
|
|
],
|
|
[
|
|
"e880",
|
|
"鑰",
|
|
20,
|
|
"钑钖钘铇铏铓铔铚铦铻锜锠琛琚瑁瑜瑗瑕瑙瑷瑭瑾璜璎璀璁璇璋璞璨璩璐璧瓒璺韪韫韬杌杓杞杈杩枥枇杪杳枘枧杵枨枞枭枋杷杼柰栉柘栊柩枰栌柙枵柚枳柝栀柃枸柢栎柁柽栲栳桠桡桎桢桄桤梃栝桕桦桁桧桀栾桊桉栩梵梏桴桷梓桫棂楮棼椟椠棹"
|
|
],
|
|
[
|
|
"e940",
|
|
"锧锳锽镃镈镋镕镚镠镮镴镵長",
|
|
7,
|
|
"門",
|
|
42
|
|
],
|
|
[
|
|
"e980",
|
|
"閫",
|
|
32,
|
|
"椤棰椋椁楗棣椐楱椹楠楂楝榄楫榀榘楸椴槌榇榈槎榉楦楣楹榛榧榻榫榭槔榱槁槊槟榕槠榍槿樯槭樗樘橥槲橄樾檠橐橛樵檎橹樽樨橘橼檑檐檩檗檫猷獒殁殂殇殄殒殓殍殚殛殡殪轫轭轱轲轳轵轶轸轷轹轺轼轾辁辂辄辇辋"
|
|
],
|
|
[
|
|
"ea40",
|
|
"闌",
|
|
27,
|
|
"闬闿阇阓阘阛阞阠阣",
|
|
6,
|
|
"阫阬阭阯阰阷阸阹阺阾陁陃陊陎陏陑陒陓陖陗"
|
|
],
|
|
[
|
|
"ea80",
|
|
"陘陙陚陜陝陞陠陣陥陦陫陭",
|
|
4,
|
|
"陳陸",
|
|
12,
|
|
"隇隉隊辍辎辏辘辚軎戋戗戛戟戢戡戥戤戬臧瓯瓴瓿甏甑甓攴旮旯旰昊昙杲昃昕昀炅曷昝昴昱昶昵耆晟晔晁晏晖晡晗晷暄暌暧暝暾曛曜曦曩贲贳贶贻贽赀赅赆赈赉赇赍赕赙觇觊觋觌觎觏觐觑牮犟牝牦牯牾牿犄犋犍犏犒挈挲掰"
|
|
],
|
|
[
|
|
"eb40",
|
|
"隌階隑隒隓隕隖隚際隝",
|
|
9,
|
|
"隨",
|
|
7,
|
|
"隱隲隴隵隷隸隺隻隿雂雃雈雊雋雐雑雓雔雖",
|
|
9,
|
|
"雡",
|
|
6,
|
|
"雫"
|
|
],
|
|
[
|
|
"eb80",
|
|
"雬雭雮雰雱雲雴雵雸雺電雼雽雿霂霃霅霊霋霌霐霑霒霔霕霗",
|
|
4,
|
|
"霝霟霠搿擘耄毪毳毽毵毹氅氇氆氍氕氘氙氚氡氩氤氪氲攵敕敫牍牒牖爰虢刖肟肜肓肼朊肽肱肫肭肴肷胧胨胩胪胛胂胄胙胍胗朐胝胫胱胴胭脍脎胲胼朕脒豚脶脞脬脘脲腈腌腓腴腙腚腱腠腩腼腽腭腧塍媵膈膂膑滕膣膪臌朦臊膻"
|
|
],
|
|
[
|
|
"ec40",
|
|
"霡",
|
|
8,
|
|
"霫霬霮霯霱霳",
|
|
4,
|
|
"霺霻霼霽霿",
|
|
18,
|
|
"靔靕靗靘靚靜靝靟靣靤靦靧靨靪",
|
|
7
|
|
],
|
|
[
|
|
"ec80",
|
|
"靲靵靷",
|
|
4,
|
|
"靽",
|
|
7,
|
|
"鞆",
|
|
4,
|
|
"鞌鞎鞏鞐鞓鞕鞖鞗鞙",
|
|
4,
|
|
"臁膦欤欷欹歃歆歙飑飒飓飕飙飚殳彀毂觳斐齑斓於旆旄旃旌旎旒旖炀炜炖炝炻烀炷炫炱烨烊焐焓焖焯焱煳煜煨煅煲煊煸煺熘熳熵熨熠燠燔燧燹爝爨灬焘煦熹戾戽扃扈扉礻祀祆祉祛祜祓祚祢祗祠祯祧祺禅禊禚禧禳忑忐"
|
|
],
|
|
[
|
|
"ed40",
|
|
"鞞鞟鞡鞢鞤",
|
|
6,
|
|
"鞬鞮鞰鞱鞳鞵",
|
|
46
|
|
],
|
|
[
|
|
"ed80",
|
|
"韤韥韨韮",
|
|
4,
|
|
"韴韷",
|
|
23,
|
|
"怼恝恚恧恁恙恣悫愆愍慝憩憝懋懑戆肀聿沓泶淼矶矸砀砉砗砘砑斫砭砜砝砹砺砻砟砼砥砬砣砩硎硭硖硗砦硐硇硌硪碛碓碚碇碜碡碣碲碹碥磔磙磉磬磲礅磴礓礤礞礴龛黹黻黼盱眄眍盹眇眈眚眢眙眭眦眵眸睐睑睇睃睚睨"
|
|
],
|
|
[
|
|
"ee40",
|
|
"頏",
|
|
62
|
|
],
|
|
[
|
|
"ee80",
|
|
"顎",
|
|
32,
|
|
"睢睥睿瞍睽瞀瞌瞑瞟瞠瞰瞵瞽町畀畎畋畈畛畲畹疃罘罡罟詈罨罴罱罹羁罾盍盥蠲钅钆钇钋钊钌钍钏钐钔钗钕钚钛钜钣钤钫钪钭钬钯钰钲钴钶",
|
|
4,
|
|
"钼钽钿铄铈",
|
|
6,
|
|
"铐铑铒铕铖铗铙铘铛铞铟铠铢铤铥铧铨铪"
|
|
],
|
|
[
|
|
"ef40",
|
|
"顯",
|
|
5,
|
|
"颋颎颒颕颙颣風",
|
|
37,
|
|
"飏飐飔飖飗飛飜飝飠",
|
|
4
|
|
],
|
|
[
|
|
"ef80",
|
|
"飥飦飩",
|
|
30,
|
|
"铩铫铮铯铳铴铵铷铹铼铽铿锃锂锆锇锉锊锍锎锏锒",
|
|
4,
|
|
"锘锛锝锞锟锢锪锫锩锬锱锲锴锶锷锸锼锾锿镂锵镄镅镆镉镌镎镏镒镓镔镖镗镘镙镛镞镟镝镡镢镤",
|
|
8,
|
|
"镯镱镲镳锺矧矬雉秕秭秣秫稆嵇稃稂稞稔"
|
|
],
|
|
[
|
|
"f040",
|
|
"餈",
|
|
4,
|
|
"餎餏餑",
|
|
28,
|
|
"餯",
|
|
26
|
|
],
|
|
[
|
|
"f080",
|
|
"饊",
|
|
9,
|
|
"饖",
|
|
12,
|
|
"饤饦饳饸饹饻饾馂馃馉稹稷穑黏馥穰皈皎皓皙皤瓞瓠甬鸠鸢鸨",
|
|
4,
|
|
"鸲鸱鸶鸸鸷鸹鸺鸾鹁鹂鹄鹆鹇鹈鹉鹋鹌鹎鹑鹕鹗鹚鹛鹜鹞鹣鹦",
|
|
6,
|
|
"鹱鹭鹳疒疔疖疠疝疬疣疳疴疸痄疱疰痃痂痖痍痣痨痦痤痫痧瘃痱痼痿瘐瘀瘅瘌瘗瘊瘥瘘瘕瘙"
|
|
],
|
|
[
|
|
"f140",
|
|
"馌馎馚",
|
|
10,
|
|
"馦馧馩",
|
|
47
|
|
],
|
|
[
|
|
"f180",
|
|
"駙",
|
|
32,
|
|
"瘛瘼瘢瘠癀瘭瘰瘿瘵癃瘾瘳癍癞癔癜癖癫癯翊竦穸穹窀窆窈窕窦窠窬窨窭窳衤衩衲衽衿袂袢裆袷袼裉裢裎裣裥裱褚裼裨裾裰褡褙褓褛褊褴褫褶襁襦襻疋胥皲皴矜耒耔耖耜耠耢耥耦耧耩耨耱耋耵聃聆聍聒聩聱覃顸颀颃"
|
|
],
|
|
[
|
|
"f240",
|
|
"駺",
|
|
62
|
|
],
|
|
[
|
|
"f280",
|
|
"騹",
|
|
32,
|
|
"颉颌颍颏颔颚颛颞颟颡颢颥颦虍虔虬虮虿虺虼虻蚨蚍蚋蚬蚝蚧蚣蚪蚓蚩蚶蛄蚵蛎蚰蚺蚱蚯蛉蛏蚴蛩蛱蛲蛭蛳蛐蜓蛞蛴蛟蛘蛑蜃蜇蛸蜈蜊蜍蜉蜣蜻蜞蜥蜮蜚蜾蝈蜴蜱蜩蜷蜿螂蜢蝽蝾蝻蝠蝰蝌蝮螋蝓蝣蝼蝤蝙蝥螓螯螨蟒"
|
|
],
|
|
[
|
|
"f340",
|
|
"驚",
|
|
17,
|
|
"驲骃骉骍骎骔骕骙骦骩",
|
|
6,
|
|
"骲骳骴骵骹骻骽骾骿髃髄髆",
|
|
4,
|
|
"髍髎髏髐髒體髕髖髗髙髚髛髜"
|
|
],
|
|
[
|
|
"f380",
|
|
"髝髞髠髢髣髤髥髧髨髩髪髬髮髰",
|
|
8,
|
|
"髺髼",
|
|
6,
|
|
"鬄鬅鬆蟆螈螅螭螗螃螫蟥螬螵螳蟋蟓螽蟑蟀蟊蟛蟪蟠蟮蠖蠓蟾蠊蠛蠡蠹蠼缶罂罄罅舐竺竽笈笃笄笕笊笫笏筇笸笪笙笮笱笠笥笤笳笾笞筘筚筅筵筌筝筠筮筻筢筲筱箐箦箧箸箬箝箨箅箪箜箢箫箴篑篁篌篝篚篥篦篪簌篾篼簏簖簋"
|
|
],
|
|
[
|
|
"f440",
|
|
"鬇鬉",
|
|
5,
|
|
"鬐鬑鬒鬔",
|
|
10,
|
|
"鬠鬡鬢鬤",
|
|
10,
|
|
"鬰鬱鬳",
|
|
7,
|
|
"鬽鬾鬿魀魆魊魋魌魎魐魒魓魕",
|
|
5
|
|
],
|
|
[
|
|
"f480",
|
|
"魛",
|
|
32,
|
|
"簟簪簦簸籁籀臾舁舂舄臬衄舡舢舣舭舯舨舫舸舻舳舴舾艄艉艋艏艚艟艨衾袅袈裘裟襞羝羟羧羯羰羲籼敉粑粝粜粞粢粲粼粽糁糇糌糍糈糅糗糨艮暨羿翎翕翥翡翦翩翮翳糸絷綦綮繇纛麸麴赳趄趔趑趱赧赭豇豉酊酐酎酏酤"
|
|
],
|
|
[
|
|
"f540",
|
|
"魼",
|
|
62
|
|
],
|
|
[
|
|
"f580",
|
|
"鮻",
|
|
32,
|
|
"酢酡酰酩酯酽酾酲酴酹醌醅醐醍醑醢醣醪醭醮醯醵醴醺豕鹾趸跫踅蹙蹩趵趿趼趺跄跖跗跚跞跎跏跛跆跬跷跸跣跹跻跤踉跽踔踝踟踬踮踣踯踺蹀踹踵踽踱蹉蹁蹂蹑蹒蹊蹰蹶蹼蹯蹴躅躏躔躐躜躞豸貂貊貅貘貔斛觖觞觚觜"
|
|
],
|
|
[
|
|
"f640",
|
|
"鯜",
|
|
62
|
|
],
|
|
[
|
|
"f680",
|
|
"鰛",
|
|
32,
|
|
"觥觫觯訾謦靓雩雳雯霆霁霈霏霎霪霭霰霾龀龃龅",
|
|
5,
|
|
"龌黾鼋鼍隹隼隽雎雒瞿雠銎銮鋈錾鍪鏊鎏鐾鑫鱿鲂鲅鲆鲇鲈稣鲋鲎鲐鲑鲒鲔鲕鲚鲛鲞",
|
|
5,
|
|
"鲥",
|
|
4,
|
|
"鲫鲭鲮鲰",
|
|
7,
|
|
"鲺鲻鲼鲽鳄鳅鳆鳇鳊鳋"
|
|
],
|
|
[
|
|
"f740",
|
|
"鰼",
|
|
62
|
|
],
|
|
[
|
|
"f780",
|
|
"鱻鱽鱾鲀鲃鲄鲉鲊鲌鲏鲓鲖鲗鲘鲙鲝鲪鲬鲯鲹鲾",
|
|
4,
|
|
"鳈鳉鳑鳒鳚鳛鳠鳡鳌",
|
|
4,
|
|
"鳓鳔鳕鳗鳘鳙鳜鳝鳟鳢靼鞅鞑鞒鞔鞯鞫鞣鞲鞴骱骰骷鹘骶骺骼髁髀髅髂髋髌髑魅魃魇魉魈魍魑飨餍餮饕饔髟髡髦髯髫髻髭髹鬈鬏鬓鬟鬣麽麾縻麂麇麈麋麒鏖麝麟黛黜黝黠黟黢黩黧黥黪黯鼢鼬鼯鼹鼷鼽鼾齄"
|
|
],
|
|
[
|
|
"f840",
|
|
"鳣",
|
|
62
|
|
],
|
|
[
|
|
"f880",
|
|
"鴢",
|
|
32
|
|
],
|
|
[
|
|
"f940",
|
|
"鵃",
|
|
62
|
|
],
|
|
[
|
|
"f980",
|
|
"鶂",
|
|
32
|
|
],
|
|
[
|
|
"fa40",
|
|
"鶣",
|
|
62
|
|
],
|
|
[
|
|
"fa80",
|
|
"鷢",
|
|
32
|
|
],
|
|
[
|
|
"fb40",
|
|
"鸃",
|
|
27,
|
|
"鸤鸧鸮鸰鸴鸻鸼鹀鹍鹐鹒鹓鹔鹖鹙鹝鹟鹠鹡鹢鹥鹮鹯鹲鹴",
|
|
9,
|
|
"麀"
|
|
],
|
|
[
|
|
"fb80",
|
|
"麁麃麄麅麆麉麊麌",
|
|
5,
|
|
"麔",
|
|
8,
|
|
"麞麠",
|
|
5,
|
|
"麧麨麩麪"
|
|
],
|
|
[
|
|
"fc40",
|
|
"麫",
|
|
8,
|
|
"麵麶麷麹麺麼麿",
|
|
4,
|
|
"黅黆黇黈黊黋黌黐黒黓黕黖黗黙黚點黡黣黤黦黨黫黬黭黮黰",
|
|
8,
|
|
"黺黽黿",
|
|
6
|
|
],
|
|
[
|
|
"fc80",
|
|
"鼆",
|
|
4,
|
|
"鼌鼏鼑鼒鼔鼕鼖鼘鼚",
|
|
5,
|
|
"鼡鼣",
|
|
8,
|
|
"鼭鼮鼰鼱"
|
|
],
|
|
[
|
|
"fd40",
|
|
"鼲",
|
|
4,
|
|
"鼸鼺鼼鼿",
|
|
4,
|
|
"齅",
|
|
10,
|
|
"齒",
|
|
38
|
|
],
|
|
[
|
|
"fd80",
|
|
"齹",
|
|
5,
|
|
"龁龂龍",
|
|
11,
|
|
"龜龝龞龡",
|
|
4,
|
|
"郎凉秊裏隣"
|
|
],
|
|
[
|
|
"fe40",
|
|
"兀嗀﨎﨏﨑﨓﨔礼﨟蘒﨡﨣﨤﨧﨨﨩"
|
|
]
|
|
];
|
|
|
|
/***/ },
|
|
/* 98 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = [
|
|
[
|
|
"a140",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"a180",
|
|
"",
|
|
32
|
|
],
|
|
[
|
|
"a240",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"a280",
|
|
"",
|
|
32
|
|
],
|
|
[
|
|
"a2ab",
|
|
"",
|
|
5
|
|
],
|
|
[
|
|
"a2e3",
|
|
"€"
|
|
],
|
|
[
|
|
"a2ef",
|
|
""
|
|
],
|
|
[
|
|
"a2fd",
|
|
""
|
|
],
|
|
[
|
|
"a340",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"a380",
|
|
"",
|
|
31,
|
|
" "
|
|
],
|
|
[
|
|
"a440",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"a480",
|
|
"",
|
|
32
|
|
],
|
|
[
|
|
"a4f4",
|
|
"",
|
|
10
|
|
],
|
|
[
|
|
"a540",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"a580",
|
|
"",
|
|
32
|
|
],
|
|
[
|
|
"a5f7",
|
|
"",
|
|
7
|
|
],
|
|
[
|
|
"a640",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"a680",
|
|
"",
|
|
32
|
|
],
|
|
[
|
|
"a6b9",
|
|
"",
|
|
7
|
|
],
|
|
[
|
|
"a6d9",
|
|
"",
|
|
6
|
|
],
|
|
[
|
|
"a6ec",
|
|
""
|
|
],
|
|
[
|
|
"a6f3",
|
|
""
|
|
],
|
|
[
|
|
"a6f6",
|
|
"",
|
|
8
|
|
],
|
|
[
|
|
"a740",
|
|
"",
|
|
62
|
|
],
|
|
[
|
|
"a780",
|
|
"",
|
|
32
|
|
],
|
|
[
|
|
"a7c2",
|
|
"",
|
|
14
|
|
],
|
|
[
|
|
"a7f2",
|
|
"",
|
|
12
|
|
],
|
|
[
|
|
"a896",
|
|
"",
|
|
10
|
|
],
|
|
[
|
|
"a8bc",
|
|
""
|
|
],
|
|
[
|
|
"a8bf",
|
|
"ǹ"
|
|
],
|
|
[
|
|
"a8c1",
|
|
""
|
|
],
|
|
[
|
|
"a8ea",
|
|
"",
|
|
20
|
|
],
|
|
[
|
|
"a958",
|
|
""
|
|
],
|
|
[
|
|
"a95b",
|
|
""
|
|
],
|
|
[
|
|
"a95d",
|
|
""
|
|
],
|
|
[
|
|
"a989",
|
|
"〾⿰",
|
|
11
|
|
],
|
|
[
|
|
"a997",
|
|
"",
|
|
12
|
|
],
|
|
[
|
|
"a9f0",
|
|
"",
|
|
14
|
|
],
|
|
[
|
|
"aaa1",
|
|
"",
|
|
93
|
|
],
|
|
[
|
|
"aba1",
|
|
"",
|
|
93
|
|
],
|
|
[
|
|
"aca1",
|
|
"",
|
|
93
|
|
],
|
|
[
|
|
"ada1",
|
|
"",
|
|
93
|
|
],
|
|
[
|
|
"aea1",
|
|
"",
|
|
93
|
|
],
|
|
[
|
|
"afa1",
|
|
"",
|
|
93
|
|
],
|
|
[
|
|
"d7fa",
|
|
"",
|
|
4
|
|
],
|
|
[
|
|
"f8a1",
|
|
"",
|
|
93
|
|
],
|
|
[
|
|
"f9a1",
|
|
"",
|
|
93
|
|
],
|
|
[
|
|
"faa1",
|
|
"",
|
|
93
|
|
],
|
|
[
|
|
"fba1",
|
|
"",
|
|
93
|
|
],
|
|
[
|
|
"fca1",
|
|
"",
|
|
93
|
|
],
|
|
[
|
|
"fda1",
|
|
"",
|
|
93
|
|
],
|
|
[
|
|
"fe50",
|
|
"⺁⺄㑳㑇⺈⺋㖞㘚㘎⺌⺗㥮㤘㧏㧟㩳㧐㭎㱮㳠⺧⺪䁖䅟⺮䌷⺳⺶⺷䎱䎬⺻䏝䓖䙡䙌"
|
|
],
|
|
[
|
|
"fe80",
|
|
"䜣䜩䝼䞍⻊䥇䥺䥽䦂䦃䦅䦆䦟䦛䦷䦶䲣䲟䲠䲡䱷䲢䴓",
|
|
6,
|
|
"䶮",
|
|
93
|
|
]
|
|
];
|
|
|
|
/***/ },
|
|
/* 99 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = {
|
|
"uChars": [
|
|
128,
|
|
165,
|
|
169,
|
|
178,
|
|
184,
|
|
216,
|
|
226,
|
|
235,
|
|
238,
|
|
244,
|
|
248,
|
|
251,
|
|
253,
|
|
258,
|
|
276,
|
|
284,
|
|
300,
|
|
325,
|
|
329,
|
|
334,
|
|
364,
|
|
463,
|
|
465,
|
|
467,
|
|
469,
|
|
471,
|
|
473,
|
|
475,
|
|
477,
|
|
506,
|
|
594,
|
|
610,
|
|
712,
|
|
716,
|
|
730,
|
|
930,
|
|
938,
|
|
962,
|
|
970,
|
|
1026,
|
|
1104,
|
|
1106,
|
|
8209,
|
|
8215,
|
|
8218,
|
|
8222,
|
|
8231,
|
|
8241,
|
|
8244,
|
|
8246,
|
|
8252,
|
|
8365,
|
|
8452,
|
|
8454,
|
|
8458,
|
|
8471,
|
|
8482,
|
|
8556,
|
|
8570,
|
|
8596,
|
|
8602,
|
|
8713,
|
|
8720,
|
|
8722,
|
|
8726,
|
|
8731,
|
|
8737,
|
|
8740,
|
|
8742,
|
|
8748,
|
|
8751,
|
|
8760,
|
|
8766,
|
|
8777,
|
|
8781,
|
|
8787,
|
|
8802,
|
|
8808,
|
|
8816,
|
|
8854,
|
|
8858,
|
|
8870,
|
|
8896,
|
|
8979,
|
|
9322,
|
|
9372,
|
|
9548,
|
|
9588,
|
|
9616,
|
|
9622,
|
|
9634,
|
|
9652,
|
|
9662,
|
|
9672,
|
|
9676,
|
|
9680,
|
|
9702,
|
|
9735,
|
|
9738,
|
|
9793,
|
|
9795,
|
|
11906,
|
|
11909,
|
|
11913,
|
|
11917,
|
|
11928,
|
|
11944,
|
|
11947,
|
|
11951,
|
|
11956,
|
|
11960,
|
|
11964,
|
|
11979,
|
|
12284,
|
|
12292,
|
|
12312,
|
|
12319,
|
|
12330,
|
|
12351,
|
|
12436,
|
|
12447,
|
|
12535,
|
|
12543,
|
|
12586,
|
|
12842,
|
|
12850,
|
|
12964,
|
|
13200,
|
|
13215,
|
|
13218,
|
|
13253,
|
|
13263,
|
|
13267,
|
|
13270,
|
|
13384,
|
|
13428,
|
|
13727,
|
|
13839,
|
|
13851,
|
|
14617,
|
|
14703,
|
|
14801,
|
|
14816,
|
|
14964,
|
|
15183,
|
|
15471,
|
|
15585,
|
|
16471,
|
|
16736,
|
|
17208,
|
|
17325,
|
|
17330,
|
|
17374,
|
|
17623,
|
|
17997,
|
|
18018,
|
|
18212,
|
|
18218,
|
|
18301,
|
|
18318,
|
|
18760,
|
|
18811,
|
|
18814,
|
|
18820,
|
|
18823,
|
|
18844,
|
|
18848,
|
|
18872,
|
|
19576,
|
|
19620,
|
|
19738,
|
|
19887,
|
|
40870,
|
|
59244,
|
|
59336,
|
|
59367,
|
|
59413,
|
|
59417,
|
|
59423,
|
|
59431,
|
|
59437,
|
|
59443,
|
|
59452,
|
|
59460,
|
|
59478,
|
|
59493,
|
|
63789,
|
|
63866,
|
|
63894,
|
|
63976,
|
|
63986,
|
|
64016,
|
|
64018,
|
|
64021,
|
|
64025,
|
|
64034,
|
|
64037,
|
|
64042,
|
|
65074,
|
|
65093,
|
|
65107,
|
|
65112,
|
|
65127,
|
|
65132,
|
|
65375,
|
|
65510,
|
|
65536
|
|
],
|
|
"gbChars": [
|
|
0,
|
|
36,
|
|
38,
|
|
45,
|
|
50,
|
|
81,
|
|
89,
|
|
95,
|
|
96,
|
|
100,
|
|
103,
|
|
104,
|
|
105,
|
|
109,
|
|
126,
|
|
133,
|
|
148,
|
|
172,
|
|
175,
|
|
179,
|
|
208,
|
|
306,
|
|
307,
|
|
308,
|
|
309,
|
|
310,
|
|
311,
|
|
312,
|
|
313,
|
|
341,
|
|
428,
|
|
443,
|
|
544,
|
|
545,
|
|
558,
|
|
741,
|
|
742,
|
|
749,
|
|
750,
|
|
805,
|
|
819,
|
|
820,
|
|
7922,
|
|
7924,
|
|
7925,
|
|
7927,
|
|
7934,
|
|
7943,
|
|
7944,
|
|
7945,
|
|
7950,
|
|
8062,
|
|
8148,
|
|
8149,
|
|
8152,
|
|
8164,
|
|
8174,
|
|
8236,
|
|
8240,
|
|
8262,
|
|
8264,
|
|
8374,
|
|
8380,
|
|
8381,
|
|
8384,
|
|
8388,
|
|
8390,
|
|
8392,
|
|
8393,
|
|
8394,
|
|
8396,
|
|
8401,
|
|
8406,
|
|
8416,
|
|
8419,
|
|
8424,
|
|
8437,
|
|
8439,
|
|
8445,
|
|
8482,
|
|
8485,
|
|
8496,
|
|
8521,
|
|
8603,
|
|
8936,
|
|
8946,
|
|
9046,
|
|
9050,
|
|
9063,
|
|
9066,
|
|
9076,
|
|
9092,
|
|
9100,
|
|
9108,
|
|
9111,
|
|
9113,
|
|
9131,
|
|
9162,
|
|
9164,
|
|
9218,
|
|
9219,
|
|
11329,
|
|
11331,
|
|
11334,
|
|
11336,
|
|
11346,
|
|
11361,
|
|
11363,
|
|
11366,
|
|
11370,
|
|
11372,
|
|
11375,
|
|
11389,
|
|
11682,
|
|
11686,
|
|
11687,
|
|
11692,
|
|
11694,
|
|
11714,
|
|
11716,
|
|
11723,
|
|
11725,
|
|
11730,
|
|
11736,
|
|
11982,
|
|
11989,
|
|
12102,
|
|
12336,
|
|
12348,
|
|
12350,
|
|
12384,
|
|
12393,
|
|
12395,
|
|
12397,
|
|
12510,
|
|
12553,
|
|
12851,
|
|
12962,
|
|
12973,
|
|
13738,
|
|
13823,
|
|
13919,
|
|
13933,
|
|
14080,
|
|
14298,
|
|
14585,
|
|
14698,
|
|
15583,
|
|
15847,
|
|
16318,
|
|
16434,
|
|
16438,
|
|
16481,
|
|
16729,
|
|
17102,
|
|
17122,
|
|
17315,
|
|
17320,
|
|
17402,
|
|
17418,
|
|
17859,
|
|
17909,
|
|
17911,
|
|
17915,
|
|
17916,
|
|
17936,
|
|
17939,
|
|
17961,
|
|
18664,
|
|
18703,
|
|
18814,
|
|
18962,
|
|
19043,
|
|
33469,
|
|
33470,
|
|
33471,
|
|
33484,
|
|
33485,
|
|
33490,
|
|
33497,
|
|
33501,
|
|
33505,
|
|
33513,
|
|
33520,
|
|
33536,
|
|
33550,
|
|
37845,
|
|
37921,
|
|
37948,
|
|
38029,
|
|
38038,
|
|
38064,
|
|
38065,
|
|
38066,
|
|
38069,
|
|
38075,
|
|
38076,
|
|
38078,
|
|
39108,
|
|
39109,
|
|
39113,
|
|
39114,
|
|
39115,
|
|
39116,
|
|
39265,
|
|
39394,
|
|
189000
|
|
]
|
|
};
|
|
|
|
/***/ },
|
|
/* 100 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = [
|
|
[
|
|
"0",
|
|
"\u0000",
|
|
127
|
|
],
|
|
[
|
|
"8141",
|
|
"갂갃갅갆갋",
|
|
4,
|
|
"갘갞갟갡갢갣갥",
|
|
6,
|
|
"갮갲갳갴"
|
|
],
|
|
[
|
|
"8161",
|
|
"갵갶갷갺갻갽갾갿걁",
|
|
9,
|
|
"걌걎",
|
|
5,
|
|
"걕"
|
|
],
|
|
[
|
|
"8181",
|
|
"걖걗걙걚걛걝",
|
|
18,
|
|
"걲걳걵걶걹걻",
|
|
4,
|
|
"겂겇겈겍겎겏겑겒겓겕",
|
|
6,
|
|
"겞겢",
|
|
5,
|
|
"겫겭겮겱",
|
|
6,
|
|
"겺겾겿곀곂곃곅곆곇곉곊곋곍",
|
|
7,
|
|
"곖곘",
|
|
7,
|
|
"곢곣곥곦곩곫곭곮곲곴곷",
|
|
4,
|
|
"곾곿괁괂괃괅괇",
|
|
4,
|
|
"괎괐괒괓"
|
|
],
|
|
[
|
|
"8241",
|
|
"괔괕괖괗괙괚괛괝괞괟괡",
|
|
7,
|
|
"괪괫괮",
|
|
5
|
|
],
|
|
[
|
|
"8261",
|
|
"괶괷괹괺괻괽",
|
|
6,
|
|
"굆굈굊",
|
|
5,
|
|
"굑굒굓굕굖굗"
|
|
],
|
|
[
|
|
"8281",
|
|
"굙",
|
|
7,
|
|
"굢굤",
|
|
7,
|
|
"굮굯굱굲굷굸굹굺굾궀궃",
|
|
4,
|
|
"궊궋궍궎궏궑",
|
|
10,
|
|
"궞",
|
|
5,
|
|
"궥",
|
|
17,
|
|
"궸",
|
|
7,
|
|
"귂귃귅귆귇귉",
|
|
6,
|
|
"귒귔",
|
|
7,
|
|
"귝귞귟귡귢귣귥",
|
|
18
|
|
],
|
|
[
|
|
"8341",
|
|
"귺귻귽귾긂",
|
|
5,
|
|
"긊긌긎",
|
|
5,
|
|
"긕",
|
|
7
|
|
],
|
|
[
|
|
"8361",
|
|
"긝",
|
|
18,
|
|
"긲긳긵긶긹긻긼"
|
|
],
|
|
[
|
|
"8381",
|
|
"긽긾긿깂깄깇깈깉깋깏깑깒깓깕깗",
|
|
4,
|
|
"깞깢깣깤깦깧깪깫깭깮깯깱",
|
|
6,
|
|
"깺깾",
|
|
5,
|
|
"꺆",
|
|
5,
|
|
"꺍",
|
|
46,
|
|
"꺿껁껂껃껅",
|
|
6,
|
|
"껎껒",
|
|
5,
|
|
"껚껛껝",
|
|
8
|
|
],
|
|
[
|
|
"8441",
|
|
"껦껧껩껪껬껮",
|
|
5,
|
|
"껵껶껷껹껺껻껽",
|
|
8
|
|
],
|
|
[
|
|
"8461",
|
|
"꼆꼉꼊꼋꼌꼎꼏꼑",
|
|
18
|
|
],
|
|
[
|
|
"8481",
|
|
"꼤",
|
|
7,
|
|
"꼮꼯꼱꼳꼵",
|
|
6,
|
|
"꼾꽀꽄꽅꽆꽇꽊",
|
|
5,
|
|
"꽑",
|
|
10,
|
|
"꽞",
|
|
5,
|
|
"꽦",
|
|
18,
|
|
"꽺",
|
|
5,
|
|
"꾁꾂꾃꾅꾆꾇꾉",
|
|
6,
|
|
"꾒꾓꾔꾖",
|
|
5,
|
|
"꾝",
|
|
26,
|
|
"꾺꾻꾽꾾"
|
|
],
|
|
[
|
|
"8541",
|
|
"꾿꿁",
|
|
5,
|
|
"꿊꿌꿏",
|
|
4,
|
|
"꿕",
|
|
6,
|
|
"꿝",
|
|
4
|
|
],
|
|
[
|
|
"8561",
|
|
"꿢",
|
|
5,
|
|
"꿪",
|
|
5,
|
|
"꿲꿳꿵꿶꿷꿹",
|
|
6,
|
|
"뀂뀃"
|
|
],
|
|
[
|
|
"8581",
|
|
"뀅",
|
|
6,
|
|
"뀍뀎뀏뀑뀒뀓뀕",
|
|
6,
|
|
"뀞",
|
|
9,
|
|
"뀩",
|
|
26,
|
|
"끆끇끉끋끍끏끐끑끒끖끘끚끛끜끞",
|
|
29,
|
|
"끾끿낁낂낃낅",
|
|
6,
|
|
"낎낐낒",
|
|
5,
|
|
"낛낝낞낣낤"
|
|
],
|
|
[
|
|
"8641",
|
|
"낥낦낧낪낰낲낶낷낹낺낻낽",
|
|
6,
|
|
"냆냊",
|
|
5,
|
|
"냒"
|
|
],
|
|
[
|
|
"8661",
|
|
"냓냕냖냗냙",
|
|
6,
|
|
"냡냢냣냤냦",
|
|
10
|
|
],
|
|
[
|
|
"8681",
|
|
"냱",
|
|
22,
|
|
"넊넍넎넏넑넔넕넖넗넚넞",
|
|
4,
|
|
"넦넧넩넪넫넭",
|
|
6,
|
|
"넶넺",
|
|
5,
|
|
"녂녃녅녆녇녉",
|
|
6,
|
|
"녒녓녖녗녙녚녛녝녞녟녡",
|
|
22,
|
|
"녺녻녽녾녿놁놃",
|
|
4,
|
|
"놊놌놎놏놐놑놕놖놗놙놚놛놝"
|
|
],
|
|
[
|
|
"8741",
|
|
"놞",
|
|
9,
|
|
"놩",
|
|
15
|
|
],
|
|
[
|
|
"8761",
|
|
"놹",
|
|
18,
|
|
"뇍뇎뇏뇑뇒뇓뇕"
|
|
],
|
|
[
|
|
"8781",
|
|
"뇖",
|
|
5,
|
|
"뇞뇠",
|
|
7,
|
|
"뇪뇫뇭뇮뇯뇱",
|
|
7,
|
|
"뇺뇼뇾",
|
|
5,
|
|
"눆눇눉눊눍",
|
|
6,
|
|
"눖눘눚",
|
|
5,
|
|
"눡",
|
|
18,
|
|
"눵",
|
|
6,
|
|
"눽",
|
|
26,
|
|
"뉙뉚뉛뉝뉞뉟뉡",
|
|
6,
|
|
"뉪",
|
|
4
|
|
],
|
|
[
|
|
"8841",
|
|
"뉯",
|
|
4,
|
|
"뉶",
|
|
5,
|
|
"뉽",
|
|
6,
|
|
"늆늇늈늊",
|
|
4
|
|
],
|
|
[
|
|
"8861",
|
|
"늏늒늓늕늖늗늛",
|
|
4,
|
|
"늢늤늧늨늩늫늭늮늯늱늲늳늵늶늷"
|
|
],
|
|
[
|
|
"8881",
|
|
"늸",
|
|
15,
|
|
"닊닋닍닎닏닑닓",
|
|
4,
|
|
"닚닜닞닟닠닡닣닧닩닪닰닱닲닶닼닽닾댂댃댅댆댇댉",
|
|
6,
|
|
"댒댖",
|
|
5,
|
|
"댝",
|
|
54,
|
|
"덗덙덚덝덠덡덢덣"
|
|
],
|
|
[
|
|
"8941",
|
|
"덦덨덪덬덭덯덲덳덵덶덷덹",
|
|
6,
|
|
"뎂뎆",
|
|
5,
|
|
"뎍"
|
|
],
|
|
[
|
|
"8961",
|
|
"뎎뎏뎑뎒뎓뎕",
|
|
10,
|
|
"뎢",
|
|
5,
|
|
"뎩뎪뎫뎭"
|
|
],
|
|
[
|
|
"8981",
|
|
"뎮",
|
|
21,
|
|
"돆돇돉돊돍돏돑돒돓돖돘돚돜돞돟돡돢돣돥돦돧돩",
|
|
18,
|
|
"돽",
|
|
18,
|
|
"됑",
|
|
6,
|
|
"됙됚됛됝됞됟됡",
|
|
6,
|
|
"됪됬",
|
|
7,
|
|
"됵",
|
|
15
|
|
],
|
|
[
|
|
"8a41",
|
|
"둅",
|
|
10,
|
|
"둒둓둕둖둗둙",
|
|
6,
|
|
"둢둤둦"
|
|
],
|
|
[
|
|
"8a61",
|
|
"둧",
|
|
4,
|
|
"둭",
|
|
18,
|
|
"뒁뒂"
|
|
],
|
|
[
|
|
"8a81",
|
|
"뒃",
|
|
4,
|
|
"뒉",
|
|
19,
|
|
"뒞",
|
|
5,
|
|
"뒥뒦뒧뒩뒪뒫뒭",
|
|
7,
|
|
"뒶뒸뒺",
|
|
5,
|
|
"듁듂듃듅듆듇듉",
|
|
6,
|
|
"듑듒듓듔듖",
|
|
5,
|
|
"듞듟듡듢듥듧",
|
|
4,
|
|
"듮듰듲",
|
|
5,
|
|
"듹",
|
|
26,
|
|
"딖딗딙딚딝"
|
|
],
|
|
[
|
|
"8b41",
|
|
"딞",
|
|
5,
|
|
"딦딫",
|
|
4,
|
|
"딲딳딵딶딷딹",
|
|
6,
|
|
"땂땆"
|
|
],
|
|
[
|
|
"8b61",
|
|
"땇땈땉땊땎땏땑땒땓땕",
|
|
6,
|
|
"땞땢",
|
|
8
|
|
],
|
|
[
|
|
"8b81",
|
|
"땫",
|
|
52,
|
|
"떢떣떥떦떧떩떬떭떮떯떲떶",
|
|
4,
|
|
"떾떿뗁뗂뗃뗅",
|
|
6,
|
|
"뗎뗒",
|
|
5,
|
|
"뗙",
|
|
18,
|
|
"뗭",
|
|
18
|
|
],
|
|
[
|
|
"8c41",
|
|
"똀",
|
|
15,
|
|
"똒똓똕똖똗똙",
|
|
4
|
|
],
|
|
[
|
|
"8c61",
|
|
"똞",
|
|
6,
|
|
"똦",
|
|
5,
|
|
"똭",
|
|
6,
|
|
"똵",
|
|
5
|
|
],
|
|
[
|
|
"8c81",
|
|
"똻",
|
|
12,
|
|
"뙉",
|
|
26,
|
|
"뙥뙦뙧뙩",
|
|
50,
|
|
"뚞뚟뚡뚢뚣뚥",
|
|
5,
|
|
"뚭뚮뚯뚰뚲",
|
|
16
|
|
],
|
|
[
|
|
"8d41",
|
|
"뛃",
|
|
16,
|
|
"뛕",
|
|
8
|
|
],
|
|
[
|
|
"8d61",
|
|
"뛞",
|
|
17,
|
|
"뛱뛲뛳뛵뛶뛷뛹뛺"
|
|
],
|
|
[
|
|
"8d81",
|
|
"뛻",
|
|
4,
|
|
"뜂뜃뜄뜆",
|
|
33,
|
|
"뜪뜫뜭뜮뜱",
|
|
6,
|
|
"뜺뜼",
|
|
7,
|
|
"띅띆띇띉띊띋띍",
|
|
6,
|
|
"띖",
|
|
9,
|
|
"띡띢띣띥띦띧띩",
|
|
6,
|
|
"띲띴띶",
|
|
5,
|
|
"띾띿랁랂랃랅",
|
|
6,
|
|
"랎랓랔랕랚랛랝랞"
|
|
],
|
|
[
|
|
"8e41",
|
|
"랟랡",
|
|
6,
|
|
"랪랮",
|
|
5,
|
|
"랶랷랹",
|
|
8
|
|
],
|
|
[
|
|
"8e61",
|
|
"럂",
|
|
4,
|
|
"럈럊",
|
|
19
|
|
],
|
|
[
|
|
"8e81",
|
|
"럞",
|
|
13,
|
|
"럮럯럱럲럳럵",
|
|
6,
|
|
"럾렂",
|
|
4,
|
|
"렊렋렍렎렏렑",
|
|
6,
|
|
"렚렜렞",
|
|
5,
|
|
"렦렧렩렪렫렭",
|
|
6,
|
|
"렶렺",
|
|
5,
|
|
"롁롂롃롅",
|
|
11,
|
|
"롒롔",
|
|
7,
|
|
"롞롟롡롢롣롥",
|
|
6,
|
|
"롮롰롲",
|
|
5,
|
|
"롹롺롻롽",
|
|
7
|
|
],
|
|
[
|
|
"8f41",
|
|
"뢅",
|
|
7,
|
|
"뢎",
|
|
17
|
|
],
|
|
[
|
|
"8f61",
|
|
"뢠",
|
|
7,
|
|
"뢩",
|
|
6,
|
|
"뢱뢲뢳뢵뢶뢷뢹",
|
|
4
|
|
],
|
|
[
|
|
"8f81",
|
|
"뢾뢿룂룄룆",
|
|
5,
|
|
"룍룎룏룑룒룓룕",
|
|
7,
|
|
"룞룠룢",
|
|
5,
|
|
"룪룫룭룮룯룱",
|
|
6,
|
|
"룺룼룾",
|
|
5,
|
|
"뤅",
|
|
18,
|
|
"뤙",
|
|
6,
|
|
"뤡",
|
|
26,
|
|
"뤾뤿륁륂륃륅",
|
|
6,
|
|
"륍륎륐륒",
|
|
5
|
|
],
|
|
[
|
|
"9041",
|
|
"륚륛륝륞륟륡",
|
|
6,
|
|
"륪륬륮",
|
|
5,
|
|
"륶륷륹륺륻륽"
|
|
],
|
|
[
|
|
"9061",
|
|
"륾",
|
|
5,
|
|
"릆릈릋릌릏",
|
|
15
|
|
],
|
|
[
|
|
"9081",
|
|
"릟",
|
|
12,
|
|
"릮릯릱릲릳릵",
|
|
6,
|
|
"릾맀맂",
|
|
5,
|
|
"맊맋맍맓",
|
|
4,
|
|
"맚맜맟맠맢맦맧맩맪맫맭",
|
|
6,
|
|
"맶맻",
|
|
4,
|
|
"먂",
|
|
5,
|
|
"먉",
|
|
11,
|
|
"먖",
|
|
33,
|
|
"먺먻먽먾먿멁멃멄멅멆"
|
|
],
|
|
[
|
|
"9141",
|
|
"멇멊멌멏멐멑멒멖멗멙멚멛멝",
|
|
6,
|
|
"멦멪",
|
|
5
|
|
],
|
|
[
|
|
"9161",
|
|
"멲멳멵멶멷멹",
|
|
9,
|
|
"몆몈몉몊몋몍",
|
|
5
|
|
],
|
|
[
|
|
"9181",
|
|
"몓",
|
|
20,
|
|
"몪몭몮몯몱몳",
|
|
4,
|
|
"몺몼몾",
|
|
5,
|
|
"뫅뫆뫇뫉",
|
|
14,
|
|
"뫚",
|
|
33,
|
|
"뫽뫾뫿묁묂묃묅",
|
|
7,
|
|
"묎묐묒",
|
|
5,
|
|
"묙묚묛묝묞묟묡",
|
|
6
|
|
],
|
|
[
|
|
"9241",
|
|
"묨묪묬",
|
|
7,
|
|
"묷묹묺묿",
|
|
4,
|
|
"뭆뭈뭊뭋뭌뭎뭑뭒"
|
|
],
|
|
[
|
|
"9261",
|
|
"뭓뭕뭖뭗뭙",
|
|
7,
|
|
"뭢뭤",
|
|
7,
|
|
"뭭",
|
|
4
|
|
],
|
|
[
|
|
"9281",
|
|
"뭲",
|
|
21,
|
|
"뮉뮊뮋뮍뮎뮏뮑",
|
|
18,
|
|
"뮥뮦뮧뮩뮪뮫뮭",
|
|
6,
|
|
"뮵뮶뮸",
|
|
7,
|
|
"믁믂믃믅믆믇믉",
|
|
6,
|
|
"믑믒믔",
|
|
35,
|
|
"믺믻믽믾밁"
|
|
],
|
|
[
|
|
"9341",
|
|
"밃",
|
|
4,
|
|
"밊밎밐밒밓밙밚밠밡밢밣밦밨밪밫밬밮밯밲밳밵"
|
|
],
|
|
[
|
|
"9361",
|
|
"밶밷밹",
|
|
6,
|
|
"뱂뱆뱇뱈뱊뱋뱎뱏뱑",
|
|
8
|
|
],
|
|
[
|
|
"9381",
|
|
"뱚뱛뱜뱞",
|
|
37,
|
|
"벆벇벉벊벍벏",
|
|
4,
|
|
"벖벘벛",
|
|
4,
|
|
"벢벣벥벦벩",
|
|
6,
|
|
"벲벶",
|
|
5,
|
|
"벾벿볁볂볃볅",
|
|
7,
|
|
"볎볒볓볔볖볗볙볚볛볝",
|
|
22,
|
|
"볷볹볺볻볽"
|
|
],
|
|
[
|
|
"9441",
|
|
"볾",
|
|
5,
|
|
"봆봈봊",
|
|
5,
|
|
"봑봒봓봕",
|
|
8
|
|
],
|
|
[
|
|
"9461",
|
|
"봞",
|
|
5,
|
|
"봥",
|
|
6,
|
|
"봭",
|
|
12
|
|
],
|
|
[
|
|
"9481",
|
|
"봺",
|
|
5,
|
|
"뵁",
|
|
6,
|
|
"뵊뵋뵍뵎뵏뵑",
|
|
6,
|
|
"뵚",
|
|
9,
|
|
"뵥뵦뵧뵩",
|
|
22,
|
|
"붂붃붅붆붋",
|
|
4,
|
|
"붒붔붖붗붘붛붝",
|
|
6,
|
|
"붥",
|
|
10,
|
|
"붱",
|
|
6,
|
|
"붹",
|
|
24
|
|
],
|
|
[
|
|
"9541",
|
|
"뷒뷓뷖뷗뷙뷚뷛뷝",
|
|
11,
|
|
"뷪",
|
|
5,
|
|
"뷱"
|
|
],
|
|
[
|
|
"9561",
|
|
"뷲뷳뷵뷶뷷뷹",
|
|
6,
|
|
"븁븂븄븆",
|
|
5,
|
|
"븎븏븑븒븓"
|
|
],
|
|
[
|
|
"9581",
|
|
"븕",
|
|
6,
|
|
"븞븠",
|
|
35,
|
|
"빆빇빉빊빋빍빏",
|
|
4,
|
|
"빖빘빜빝빞빟빢빣빥빦빧빩빫",
|
|
4,
|
|
"빲빶",
|
|
4,
|
|
"빾빿뺁뺂뺃뺅",
|
|
6,
|
|
"뺎뺒",
|
|
5,
|
|
"뺚",
|
|
13,
|
|
"뺩",
|
|
14
|
|
],
|
|
[
|
|
"9641",
|
|
"뺸",
|
|
23,
|
|
"뻒뻓"
|
|
],
|
|
[
|
|
"9661",
|
|
"뻕뻖뻙",
|
|
6,
|
|
"뻡뻢뻦",
|
|
5,
|
|
"뻭",
|
|
8
|
|
],
|
|
[
|
|
"9681",
|
|
"뻶",
|
|
10,
|
|
"뼂",
|
|
5,
|
|
"뼊",
|
|
13,
|
|
"뼚뼞",
|
|
33,
|
|
"뽂뽃뽅뽆뽇뽉",
|
|
6,
|
|
"뽒뽓뽔뽖",
|
|
44
|
|
],
|
|
[
|
|
"9741",
|
|
"뾃",
|
|
16,
|
|
"뾕",
|
|
8
|
|
],
|
|
[
|
|
"9761",
|
|
"뾞",
|
|
17,
|
|
"뾱",
|
|
7
|
|
],
|
|
[
|
|
"9781",
|
|
"뾹",
|
|
11,
|
|
"뿆",
|
|
5,
|
|
"뿎뿏뿑뿒뿓뿕",
|
|
6,
|
|
"뿝뿞뿠뿢",
|
|
89,
|
|
"쀽쀾쀿"
|
|
],
|
|
[
|
|
"9841",
|
|
"쁀",
|
|
16,
|
|
"쁒",
|
|
5,
|
|
"쁙쁚쁛"
|
|
],
|
|
[
|
|
"9861",
|
|
"쁝쁞쁟쁡",
|
|
6,
|
|
"쁪",
|
|
15
|
|
],
|
|
[
|
|
"9881",
|
|
"쁺",
|
|
21,
|
|
"삒삓삕삖삗삙",
|
|
6,
|
|
"삢삤삦",
|
|
5,
|
|
"삮삱삲삷",
|
|
4,
|
|
"삾샂샃샄샆샇샊샋샍샎샏샑",
|
|
6,
|
|
"샚샞",
|
|
5,
|
|
"샦샧샩샪샫샭",
|
|
6,
|
|
"샶샸샺",
|
|
5,
|
|
"섁섂섃섅섆섇섉",
|
|
6,
|
|
"섑섒섓섔섖",
|
|
5,
|
|
"섡섢섥섨섩섪섫섮"
|
|
],
|
|
[
|
|
"9941",
|
|
"섲섳섴섵섷섺섻섽섾섿셁",
|
|
6,
|
|
"셊셎",
|
|
5,
|
|
"셖셗"
|
|
],
|
|
[
|
|
"9961",
|
|
"셙셚셛셝",
|
|
6,
|
|
"셦셪",
|
|
5,
|
|
"셱셲셳셵셶셷셹셺셻"
|
|
],
|
|
[
|
|
"9981",
|
|
"셼",
|
|
8,
|
|
"솆",
|
|
5,
|
|
"솏솑솒솓솕솗",
|
|
4,
|
|
"솞솠솢솣솤솦솧솪솫솭솮솯솱",
|
|
11,
|
|
"솾",
|
|
5,
|
|
"쇅쇆쇇쇉쇊쇋쇍",
|
|
6,
|
|
"쇕쇖쇙",
|
|
6,
|
|
"쇡쇢쇣쇥쇦쇧쇩",
|
|
6,
|
|
"쇲쇴",
|
|
7,
|
|
"쇾쇿숁숂숃숅",
|
|
6,
|
|
"숎숐숒",
|
|
5,
|
|
"숚숛숝숞숡숢숣"
|
|
],
|
|
[
|
|
"9a41",
|
|
"숤숥숦숧숪숬숮숰숳숵",
|
|
16
|
|
],
|
|
[
|
|
"9a61",
|
|
"쉆쉇쉉",
|
|
6,
|
|
"쉒쉓쉕쉖쉗쉙",
|
|
6,
|
|
"쉡쉢쉣쉤쉦"
|
|
],
|
|
[
|
|
"9a81",
|
|
"쉧",
|
|
4,
|
|
"쉮쉯쉱쉲쉳쉵",
|
|
6,
|
|
"쉾슀슂",
|
|
5,
|
|
"슊",
|
|
5,
|
|
"슑",
|
|
6,
|
|
"슙슚슜슞",
|
|
5,
|
|
"슦슧슩슪슫슮",
|
|
5,
|
|
"슶슸슺",
|
|
33,
|
|
"싞싟싡싢싥",
|
|
5,
|
|
"싮싰싲싳싴싵싷싺싽싾싿쌁",
|
|
6,
|
|
"쌊쌋쌎쌏"
|
|
],
|
|
[
|
|
"9b41",
|
|
"쌐쌑쌒쌖쌗쌙쌚쌛쌝",
|
|
6,
|
|
"쌦쌧쌪",
|
|
8
|
|
],
|
|
[
|
|
"9b61",
|
|
"쌳",
|
|
17,
|
|
"썆",
|
|
7
|
|
],
|
|
[
|
|
"9b81",
|
|
"썎",
|
|
25,
|
|
"썪썫썭썮썯썱썳",
|
|
4,
|
|
"썺썻썾",
|
|
5,
|
|
"쎅쎆쎇쎉쎊쎋쎍",
|
|
50,
|
|
"쏁",
|
|
22,
|
|
"쏚"
|
|
],
|
|
[
|
|
"9c41",
|
|
"쏛쏝쏞쏡쏣",
|
|
4,
|
|
"쏪쏫쏬쏮",
|
|
5,
|
|
"쏶쏷쏹",
|
|
5
|
|
],
|
|
[
|
|
"9c61",
|
|
"쏿",
|
|
8,
|
|
"쐉",
|
|
6,
|
|
"쐑",
|
|
9
|
|
],
|
|
[
|
|
"9c81",
|
|
"쐛",
|
|
8,
|
|
"쐥",
|
|
6,
|
|
"쐭쐮쐯쐱쐲쐳쐵",
|
|
6,
|
|
"쐾",
|
|
9,
|
|
"쑉",
|
|
26,
|
|
"쑦쑧쑩쑪쑫쑭",
|
|
6,
|
|
"쑶쑷쑸쑺",
|
|
5,
|
|
"쒁",
|
|
18,
|
|
"쒕",
|
|
6,
|
|
"쒝",
|
|
12
|
|
],
|
|
[
|
|
"9d41",
|
|
"쒪",
|
|
13,
|
|
"쒹쒺쒻쒽",
|
|
8
|
|
],
|
|
[
|
|
"9d61",
|
|
"쓆",
|
|
25
|
|
],
|
|
[
|
|
"9d81",
|
|
"쓠",
|
|
8,
|
|
"쓪",
|
|
5,
|
|
"쓲쓳쓵쓶쓷쓹쓻쓼쓽쓾씂",
|
|
9,
|
|
"씍씎씏씑씒씓씕",
|
|
6,
|
|
"씝",
|
|
10,
|
|
"씪씫씭씮씯씱",
|
|
6,
|
|
"씺씼씾",
|
|
5,
|
|
"앆앇앋앏앐앑앒앖앚앛앜앟앢앣앥앦앧앩",
|
|
6,
|
|
"앲앶",
|
|
5,
|
|
"앾앿얁얂얃얅얆얈얉얊얋얎얐얒얓얔"
|
|
],
|
|
[
|
|
"9e41",
|
|
"얖얙얚얛얝얞얟얡",
|
|
7,
|
|
"얪",
|
|
9,
|
|
"얶"
|
|
],
|
|
[
|
|
"9e61",
|
|
"얷얺얿",
|
|
4,
|
|
"엋엍엏엒엓엕엖엗엙",
|
|
6,
|
|
"엢엤엦엧"
|
|
],
|
|
[
|
|
"9e81",
|
|
"엨엩엪엫엯엱엲엳엵엸엹엺엻옂옃옄옉옊옋옍옎옏옑",
|
|
6,
|
|
"옚옝",
|
|
6,
|
|
"옦옧옩옪옫옯옱옲옶옸옺옼옽옾옿왂왃왅왆왇왉",
|
|
6,
|
|
"왒왖",
|
|
5,
|
|
"왞왟왡",
|
|
10,
|
|
"왭왮왰왲",
|
|
5,
|
|
"왺왻왽왾왿욁",
|
|
6,
|
|
"욊욌욎",
|
|
5,
|
|
"욖욗욙욚욛욝",
|
|
6,
|
|
"욦"
|
|
],
|
|
[
|
|
"9f41",
|
|
"욨욪",
|
|
5,
|
|
"욲욳욵욶욷욻",
|
|
4,
|
|
"웂웄웆",
|
|
5,
|
|
"웎"
|
|
],
|
|
[
|
|
"9f61",
|
|
"웏웑웒웓웕",
|
|
6,
|
|
"웞웟웢",
|
|
5,
|
|
"웪웫웭웮웯웱웲"
|
|
],
|
|
[
|
|
"9f81",
|
|
"웳",
|
|
4,
|
|
"웺웻웼웾",
|
|
5,
|
|
"윆윇윉윊윋윍",
|
|
6,
|
|
"윖윘윚",
|
|
5,
|
|
"윢윣윥윦윧윩",
|
|
6,
|
|
"윲윴윶윸윹윺윻윾윿읁읂읃읅",
|
|
4,
|
|
"읋읎읐읙읚읛읝읞읟읡",
|
|
6,
|
|
"읩읪읬",
|
|
7,
|
|
"읶읷읹읺읻읿잀잁잂잆잋잌잍잏잒잓잕잙잛",
|
|
4,
|
|
"잢잧",
|
|
4,
|
|
"잮잯잱잲잳잵잶잷"
|
|
],
|
|
[
|
|
"a041",
|
|
"잸잹잺잻잾쟂",
|
|
5,
|
|
"쟊쟋쟍쟏쟑",
|
|
6,
|
|
"쟙쟚쟛쟜"
|
|
],
|
|
[
|
|
"a061",
|
|
"쟞",
|
|
5,
|
|
"쟥쟦쟧쟩쟪쟫쟭",
|
|
13
|
|
],
|
|
[
|
|
"a081",
|
|
"쟻",
|
|
4,
|
|
"젂젃젅젆젇젉젋",
|
|
4,
|
|
"젒젔젗",
|
|
4,
|
|
"젞젟젡젢젣젥",
|
|
6,
|
|
"젮젰젲",
|
|
5,
|
|
"젹젺젻젽젾젿졁",
|
|
6,
|
|
"졊졋졎",
|
|
5,
|
|
"졕",
|
|
26,
|
|
"졲졳졵졶졷졹졻",
|
|
4,
|
|
"좂좄좈좉좊좎",
|
|
5,
|
|
"좕",
|
|
7,
|
|
"좞좠좢좣좤"
|
|
],
|
|
[
|
|
"a141",
|
|
"좥좦좧좩",
|
|
18,
|
|
"좾좿죀죁"
|
|
],
|
|
[
|
|
"a161",
|
|
"죂죃죅죆죇죉죊죋죍",
|
|
6,
|
|
"죖죘죚",
|
|
5,
|
|
"죢죣죥"
|
|
],
|
|
[
|
|
"a181",
|
|
"죦",
|
|
14,
|
|
"죶",
|
|
5,
|
|
"죾죿줁줂줃줇",
|
|
4,
|
|
"줎 、。·‥…¨〃―∥\∼‘’“”〔〕〈",
|
|
9,
|
|
"±×÷≠≤≥∞∴°′″℃Å¢£¥♂♀∠⊥⌒∂∇≡≒§※☆★○●◎◇◆□■△▲▽▼→←↑↓↔〓≪≫√∽∝∵∫∬∈∋⊆⊇⊂⊃∪∩∧∨¬"
|
|
],
|
|
[
|
|
"a241",
|
|
"줐줒",
|
|
5,
|
|
"줙",
|
|
18
|
|
],
|
|
[
|
|
"a261",
|
|
"줭",
|
|
6,
|
|
"줵",
|
|
18
|
|
],
|
|
[
|
|
"a281",
|
|
"쥈",
|
|
7,
|
|
"쥒쥓쥕쥖쥗쥙",
|
|
6,
|
|
"쥢쥤",
|
|
7,
|
|
"쥭쥮쥯⇒⇔∀∃´~ˇ˘˝˚˙¸˛¡¿ː∮∑∏¤℉‰◁◀▷▶♤♠♡♥♧♣⊙◈▣◐◑▒▤▥▨▧▦▩♨☏☎☜☞¶†‡↕↗↙↖↘♭♩♪♬㉿㈜№㏇™㏂㏘℡€®"
|
|
],
|
|
[
|
|
"a341",
|
|
"쥱쥲쥳쥵",
|
|
6,
|
|
"쥽",
|
|
10,
|
|
"즊즋즍즎즏"
|
|
],
|
|
[
|
|
"a361",
|
|
"즑",
|
|
6,
|
|
"즚즜즞",
|
|
16
|
|
],
|
|
[
|
|
"a381",
|
|
"즯",
|
|
16,
|
|
"짂짃짅짆짉짋",
|
|
4,
|
|
"짒짔짗짘짛!",
|
|
58,
|
|
"₩]",
|
|
32,
|
|
" ̄"
|
|
],
|
|
[
|
|
"a441",
|
|
"짞짟짡짣짥짦짨짩짪짫짮짲",
|
|
5,
|
|
"짺짻짽짾짿쨁쨂쨃쨄"
|
|
],
|
|
[
|
|
"a461",
|
|
"쨅쨆쨇쨊쨎",
|
|
5,
|
|
"쨕쨖쨗쨙",
|
|
12
|
|
],
|
|
[
|
|
"a481",
|
|
"쨦쨧쨨쨪",
|
|
28,
|
|
"ㄱ",
|
|
93
|
|
],
|
|
[
|
|
"a541",
|
|
"쩇",
|
|
4,
|
|
"쩎쩏쩑쩒쩓쩕",
|
|
6,
|
|
"쩞쩢",
|
|
5,
|
|
"쩩쩪"
|
|
],
|
|
[
|
|
"a561",
|
|
"쩫",
|
|
17,
|
|
"쩾",
|
|
5,
|
|
"쪅쪆"
|
|
],
|
|
[
|
|
"a581",
|
|
"쪇",
|
|
16,
|
|
"쪙",
|
|
14,
|
|
"ⅰ",
|
|
9
|
|
],
|
|
[
|
|
"a5b0",
|
|
"Ⅰ",
|
|
9
|
|
],
|
|
[
|
|
"a5c1",
|
|
"Α",
|
|
16,
|
|
"Σ",
|
|
6
|
|
],
|
|
[
|
|
"a5e1",
|
|
"α",
|
|
16,
|
|
"σ",
|
|
6
|
|
],
|
|
[
|
|
"a641",
|
|
"쪨",
|
|
19,
|
|
"쪾쪿쫁쫂쫃쫅"
|
|
],
|
|
[
|
|
"a661",
|
|
"쫆",
|
|
5,
|
|
"쫎쫐쫒쫔쫕쫖쫗쫚",
|
|
5,
|
|
"쫡",
|
|
6
|
|
],
|
|
[
|
|
"a681",
|
|
"쫨쫩쫪쫫쫭",
|
|
6,
|
|
"쫵",
|
|
18,
|
|
"쬉쬊─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂┒┑┚┙┖┕┎┍┞┟┡┢┦┧┩┪┭┮┱┲┵┶┹┺┽┾╀╁╃",
|
|
7
|
|
],
|
|
[
|
|
"a741",
|
|
"쬋",
|
|
4,
|
|
"쬑쬒쬓쬕쬖쬗쬙",
|
|
6,
|
|
"쬢",
|
|
7
|
|
],
|
|
[
|
|
"a761",
|
|
"쬪",
|
|
22,
|
|
"쭂쭃쭄"
|
|
],
|
|
[
|
|
"a781",
|
|
"쭅쭆쭇쭊쭋쭍쭎쭏쭑",
|
|
6,
|
|
"쭚쭛쭜쭞",
|
|
5,
|
|
"쭥",
|
|
7,
|
|
"㎕㎖㎗ℓ㎘㏄㎣㎤㎥㎦㎙",
|
|
9,
|
|
"㏊㎍㎎㎏㏏㎈㎉㏈㎧㎨㎰",
|
|
9,
|
|
"㎀",
|
|
4,
|
|
"㎺",
|
|
5,
|
|
"㎐",
|
|
4,
|
|
"Ω㏀㏁㎊㎋㎌㏖㏅㎭㎮㎯㏛㎩㎪㎫㎬㏝㏐㏓㏃㏉㏜㏆"
|
|
],
|
|
[
|
|
"a841",
|
|
"쭭",
|
|
10,
|
|
"쭺",
|
|
14
|
|
],
|
|
[
|
|
"a861",
|
|
"쮉",
|
|
18,
|
|
"쮝",
|
|
6
|
|
],
|
|
[
|
|
"a881",
|
|
"쮤",
|
|
19,
|
|
"쮹",
|
|
11,
|
|
"ÆЪĦ"
|
|
],
|
|
[
|
|
"a8a6",
|
|
"IJ"
|
|
],
|
|
[
|
|
"a8a8",
|
|
"ĿŁØŒºÞŦŊ"
|
|
],
|
|
[
|
|
"a8b1",
|
|
"㉠",
|
|
27,
|
|
"ⓐ",
|
|
25,
|
|
"①",
|
|
14,
|
|
"½⅓⅔¼¾⅛⅜⅝⅞"
|
|
],
|
|
[
|
|
"a941",
|
|
"쯅",
|
|
14,
|
|
"쯕",
|
|
10
|
|
],
|
|
[
|
|
"a961",
|
|
"쯠쯡쯢쯣쯥쯦쯨쯪",
|
|
18
|
|
],
|
|
[
|
|
"a981",
|
|
"쯽",
|
|
14,
|
|
"찎찏찑찒찓찕",
|
|
6,
|
|
"찞찟찠찣찤æđðħıijĸŀłøœßþŧŋʼn㈀",
|
|
27,
|
|
"⒜",
|
|
25,
|
|
"⑴",
|
|
14,
|
|
"¹²³⁴ⁿ₁₂₃₄"
|
|
],
|
|
[
|
|
"aa41",
|
|
"찥찦찪찫찭찯찱",
|
|
6,
|
|
"찺찿",
|
|
4,
|
|
"챆챇챉챊챋챍챎"
|
|
],
|
|
[
|
|
"aa61",
|
|
"챏",
|
|
4,
|
|
"챖챚",
|
|
5,
|
|
"챡챢챣챥챧챩",
|
|
6,
|
|
"챱챲"
|
|
],
|
|
[
|
|
"aa81",
|
|
"챳챴챶",
|
|
29,
|
|
"ぁ",
|
|
82
|
|
],
|
|
[
|
|
"ab41",
|
|
"첔첕첖첗첚첛첝첞첟첡",
|
|
6,
|
|
"첪첮",
|
|
5,
|
|
"첶첷첹"
|
|
],
|
|
[
|
|
"ab61",
|
|
"첺첻첽",
|
|
6,
|
|
"쳆쳈쳊",
|
|
5,
|
|
"쳑쳒쳓쳕",
|
|
5
|
|
],
|
|
[
|
|
"ab81",
|
|
"쳛",
|
|
8,
|
|
"쳥",
|
|
6,
|
|
"쳭쳮쳯쳱",
|
|
12,
|
|
"ァ",
|
|
85
|
|
],
|
|
[
|
|
"ac41",
|
|
"쳾쳿촀촂",
|
|
5,
|
|
"촊촋촍촎촏촑",
|
|
6,
|
|
"촚촜촞촟촠"
|
|
],
|
|
[
|
|
"ac61",
|
|
"촡촢촣촥촦촧촩촪촫촭",
|
|
11,
|
|
"촺",
|
|
4
|
|
],
|
|
[
|
|
"ac81",
|
|
"촿",
|
|
28,
|
|
"쵝쵞쵟А",
|
|
5,
|
|
"ЁЖ",
|
|
25
|
|
],
|
|
[
|
|
"acd1",
|
|
"а",
|
|
5,
|
|
"ёж",
|
|
25
|
|
],
|
|
[
|
|
"ad41",
|
|
"쵡쵢쵣쵥",
|
|
6,
|
|
"쵮쵰쵲",
|
|
5,
|
|
"쵹",
|
|
7
|
|
],
|
|
[
|
|
"ad61",
|
|
"춁",
|
|
6,
|
|
"춉",
|
|
10,
|
|
"춖춗춙춚춛춝춞춟"
|
|
],
|
|
[
|
|
"ad81",
|
|
"춠춡춢춣춦춨춪",
|
|
5,
|
|
"춱",
|
|
18,
|
|
"췅"
|
|
],
|
|
[
|
|
"ae41",
|
|
"췆",
|
|
5,
|
|
"췍췎췏췑",
|
|
16
|
|
],
|
|
[
|
|
"ae61",
|
|
"췢",
|
|
5,
|
|
"췩췪췫췭췮췯췱",
|
|
6,
|
|
"췺췼췾",
|
|
4
|
|
],
|
|
[
|
|
"ae81",
|
|
"츃츅츆츇츉츊츋츍",
|
|
6,
|
|
"츕츖츗츘츚",
|
|
5,
|
|
"츢츣츥츦츧츩츪츫"
|
|
],
|
|
[
|
|
"af41",
|
|
"츬츭츮츯츲츴츶",
|
|
19
|
|
],
|
|
[
|
|
"af61",
|
|
"칊",
|
|
13,
|
|
"칚칛칝칞칢",
|
|
5,
|
|
"칪칬"
|
|
],
|
|
[
|
|
"af81",
|
|
"칮",
|
|
5,
|
|
"칶칷칹칺칻칽",
|
|
6,
|
|
"캆캈캊",
|
|
5,
|
|
"캒캓캕캖캗캙"
|
|
],
|
|
[
|
|
"b041",
|
|
"캚",
|
|
5,
|
|
"캢캦",
|
|
5,
|
|
"캮",
|
|
12
|
|
],
|
|
[
|
|
"b061",
|
|
"캻",
|
|
5,
|
|
"컂",
|
|
19
|
|
],
|
|
[
|
|
"b081",
|
|
"컖",
|
|
13,
|
|
"컦컧컩컪컭",
|
|
6,
|
|
"컶컺",
|
|
5,
|
|
"가각간갇갈갉갊감",
|
|
7,
|
|
"같",
|
|
4,
|
|
"갠갤갬갭갯갰갱갸갹갼걀걋걍걔걘걜거걱건걷걸걺검겁것겄겅겆겉겊겋게겐겔겜겝겟겠겡겨격겪견겯결겸겹겻겼경곁계곈곌곕곗고곡곤곧골곪곬곯곰곱곳공곶과곽관괄괆"
|
|
],
|
|
[
|
|
"b141",
|
|
"켂켃켅켆켇켉",
|
|
6,
|
|
"켒켔켖",
|
|
5,
|
|
"켝켞켟켡켢켣"
|
|
],
|
|
[
|
|
"b161",
|
|
"켥",
|
|
6,
|
|
"켮켲",
|
|
5,
|
|
"켹",
|
|
11
|
|
],
|
|
[
|
|
"b181",
|
|
"콅",
|
|
14,
|
|
"콖콗콙콚콛콝",
|
|
6,
|
|
"콦콨콪콫콬괌괍괏광괘괜괠괩괬괭괴괵괸괼굄굅굇굉교굔굘굡굣구국군굳굴굵굶굻굼굽굿궁궂궈궉권궐궜궝궤궷귀귁귄귈귐귑귓규균귤그극근귿글긁금급긋긍긔기긱긴긷길긺김깁깃깅깆깊까깍깎깐깔깖깜깝깟깠깡깥깨깩깬깰깸"
|
|
],
|
|
[
|
|
"b241",
|
|
"콭콮콯콲콳콵콶콷콹",
|
|
6,
|
|
"쾁쾂쾃쾄쾆",
|
|
5,
|
|
"쾍"
|
|
],
|
|
[
|
|
"b261",
|
|
"쾎",
|
|
18,
|
|
"쾢",
|
|
5,
|
|
"쾩"
|
|
],
|
|
[
|
|
"b281",
|
|
"쾪",
|
|
5,
|
|
"쾱",
|
|
18,
|
|
"쿅",
|
|
6,
|
|
"깹깻깼깽꺄꺅꺌꺼꺽꺾껀껄껌껍껏껐껑께껙껜껨껫껭껴껸껼꼇꼈꼍꼐꼬꼭꼰꼲꼴꼼꼽꼿꽁꽂꽃꽈꽉꽐꽜꽝꽤꽥꽹꾀꾄꾈꾐꾑꾕꾜꾸꾹꾼꿀꿇꿈꿉꿋꿍꿎꿔꿜꿨꿩꿰꿱꿴꿸뀀뀁뀄뀌뀐뀔뀜뀝뀨끄끅끈끊끌끎끓끔끕끗끙"
|
|
],
|
|
[
|
|
"b341",
|
|
"쿌",
|
|
19,
|
|
"쿢쿣쿥쿦쿧쿩"
|
|
],
|
|
[
|
|
"b361",
|
|
"쿪",
|
|
5,
|
|
"쿲쿴쿶",
|
|
5,
|
|
"쿽쿾쿿퀁퀂퀃퀅",
|
|
5
|
|
],
|
|
[
|
|
"b381",
|
|
"퀋",
|
|
5,
|
|
"퀒",
|
|
5,
|
|
"퀙",
|
|
19,
|
|
"끝끼끽낀낄낌낍낏낑나낙낚난낟날낡낢남납낫",
|
|
4,
|
|
"낱낳내낵낸낼냄냅냇냈냉냐냑냔냘냠냥너넉넋넌널넒넓넘넙넛넜넝넣네넥넨넬넴넵넷넸넹녀녁년녈념녑녔녕녘녜녠노녹논놀놂놈놉놋농높놓놔놘놜놨뇌뇐뇔뇜뇝"
|
|
],
|
|
[
|
|
"b441",
|
|
"퀮",
|
|
5,
|
|
"퀶퀷퀹퀺퀻퀽",
|
|
6,
|
|
"큆큈큊",
|
|
5
|
|
],
|
|
[
|
|
"b461",
|
|
"큑큒큓큕큖큗큙",
|
|
6,
|
|
"큡",
|
|
10,
|
|
"큮큯"
|
|
],
|
|
[
|
|
"b481",
|
|
"큱큲큳큵",
|
|
6,
|
|
"큾큿킀킂",
|
|
18,
|
|
"뇟뇨뇩뇬뇰뇹뇻뇽누눅눈눋눌눔눕눗눙눠눴눼뉘뉜뉠뉨뉩뉴뉵뉼늄늅늉느늑는늘늙늚늠늡늣능늦늪늬늰늴니닉닌닐닒님닙닛닝닢다닥닦단닫",
|
|
4,
|
|
"닳담답닷",
|
|
4,
|
|
"닿대댁댄댈댐댑댓댔댕댜더덕덖던덛덜덞덟덤덥"
|
|
],
|
|
[
|
|
"b541",
|
|
"킕",
|
|
14,
|
|
"킦킧킩킪킫킭",
|
|
5
|
|
],
|
|
[
|
|
"b561",
|
|
"킳킶킸킺",
|
|
5,
|
|
"탂탃탅탆탇탊",
|
|
5,
|
|
"탒탖",
|
|
4
|
|
],
|
|
[
|
|
"b581",
|
|
"탛탞탟탡탢탣탥",
|
|
6,
|
|
"탮탲",
|
|
5,
|
|
"탹",
|
|
11,
|
|
"덧덩덫덮데덱덴델뎀뎁뎃뎄뎅뎌뎐뎔뎠뎡뎨뎬도독돈돋돌돎돐돔돕돗동돛돝돠돤돨돼됐되된될됨됩됫됴두둑둔둘둠둡둣둥둬뒀뒈뒝뒤뒨뒬뒵뒷뒹듀듄듈듐듕드득든듣들듦듬듭듯등듸디딕딘딛딜딤딥딧딨딩딪따딱딴딸"
|
|
],
|
|
[
|
|
"b641",
|
|
"턅",
|
|
7,
|
|
"턎",
|
|
17
|
|
],
|
|
[
|
|
"b661",
|
|
"턠",
|
|
15,
|
|
"턲턳턵턶턷턹턻턼턽턾"
|
|
],
|
|
[
|
|
"b681",
|
|
"턿텂텆",
|
|
5,
|
|
"텎텏텑텒텓텕",
|
|
6,
|
|
"텞텠텢",
|
|
5,
|
|
"텩텪텫텭땀땁땃땄땅땋때땍땐땔땜땝땟땠땡떠떡떤떨떪떫떰떱떳떴떵떻떼떽뗀뗄뗌뗍뗏뗐뗑뗘뗬또똑똔똘똥똬똴뙈뙤뙨뚜뚝뚠뚤뚫뚬뚱뛔뛰뛴뛸뜀뜁뜅뜨뜩뜬뜯뜰뜸뜹뜻띄띈띌띔띕띠띤띨띰띱띳띵라락란랄람랍랏랐랑랒랖랗"
|
|
],
|
|
[
|
|
"b741",
|
|
"텮",
|
|
13,
|
|
"텽",
|
|
6,
|
|
"톅톆톇톉톊"
|
|
],
|
|
[
|
|
"b761",
|
|
"톋",
|
|
20,
|
|
"톢톣톥톦톧"
|
|
],
|
|
[
|
|
"b781",
|
|
"톩",
|
|
6,
|
|
"톲톴톶톷톸톹톻톽톾톿퇁",
|
|
14,
|
|
"래랙랜랠램랩랫랬랭랴략랸럇량러럭런럴럼럽럿렀렁렇레렉렌렐렘렙렛렝려력련렬렴렵렷렸령례롄롑롓로록론롤롬롭롯롱롸롼뢍뢨뢰뢴뢸룀룁룃룅료룐룔룝룟룡루룩룬룰룸룹룻룽뤄뤘뤠뤼뤽륀륄륌륏륑류륙륜률륨륩"
|
|
],
|
|
[
|
|
"b841",
|
|
"퇐",
|
|
7,
|
|
"퇙",
|
|
17
|
|
],
|
|
[
|
|
"b861",
|
|
"퇫",
|
|
8,
|
|
"퇵퇶퇷퇹",
|
|
13
|
|
],
|
|
[
|
|
"b881",
|
|
"툈툊",
|
|
5,
|
|
"툑",
|
|
24,
|
|
"륫륭르륵른를름릅릇릉릊릍릎리릭린릴림립릿링마막만많",
|
|
4,
|
|
"맘맙맛망맞맡맣매맥맨맬맴맵맷맸맹맺먀먁먈먕머먹먼멀멂멈멉멋멍멎멓메멕멘멜멤멥멧멨멩며멱면멸몃몄명몇몌모목몫몬몰몲몸몹못몽뫄뫈뫘뫙뫼"
|
|
],
|
|
[
|
|
"b941",
|
|
"툪툫툮툯툱툲툳툵",
|
|
6,
|
|
"툾퉀퉂",
|
|
5,
|
|
"퉉퉊퉋퉌"
|
|
],
|
|
[
|
|
"b961",
|
|
"퉍",
|
|
14,
|
|
"퉝",
|
|
6,
|
|
"퉥퉦퉧퉨"
|
|
],
|
|
[
|
|
"b981",
|
|
"퉩",
|
|
22,
|
|
"튂튃튅튆튇튉튊튋튌묀묄묍묏묑묘묜묠묩묫무묵묶문묻물묽묾뭄뭅뭇뭉뭍뭏뭐뭔뭘뭡뭣뭬뮈뮌뮐뮤뮨뮬뮴뮷므믄믈믐믓미믹민믿밀밂밈밉밋밌밍및밑바",
|
|
4,
|
|
"받",
|
|
4,
|
|
"밤밥밧방밭배백밴밸뱀뱁뱃뱄뱅뱉뱌뱍뱐뱝버벅번벋벌벎범법벗"
|
|
],
|
|
[
|
|
"ba41",
|
|
"튍튎튏튒튓튔튖",
|
|
5,
|
|
"튝튞튟튡튢튣튥",
|
|
6,
|
|
"튭"
|
|
],
|
|
[
|
|
"ba61",
|
|
"튮튯튰튲",
|
|
5,
|
|
"튺튻튽튾틁틃",
|
|
4,
|
|
"틊틌",
|
|
5
|
|
],
|
|
[
|
|
"ba81",
|
|
"틒틓틕틖틗틙틚틛틝",
|
|
6,
|
|
"틦",
|
|
9,
|
|
"틲틳틵틶틷틹틺벙벚베벡벤벧벨벰벱벳벴벵벼벽변별볍볏볐병볕볘볜보복볶본볼봄봅봇봉봐봔봤봬뵀뵈뵉뵌뵐뵘뵙뵤뵨부북분붇불붉붊붐붑붓붕붙붚붜붤붰붸뷔뷕뷘뷜뷩뷰뷴뷸븀븃븅브븍븐블븜븝븟비빅빈빌빎빔빕빗빙빚빛빠빡빤"
|
|
],
|
|
[
|
|
"bb41",
|
|
"틻",
|
|
4,
|
|
"팂팄팆",
|
|
5,
|
|
"팏팑팒팓팕팗",
|
|
4,
|
|
"팞팢팣"
|
|
],
|
|
[
|
|
"bb61",
|
|
"팤팦팧팪팫팭팮팯팱",
|
|
6,
|
|
"팺팾",
|
|
5,
|
|
"퍆퍇퍈퍉"
|
|
],
|
|
[
|
|
"bb81",
|
|
"퍊",
|
|
31,
|
|
"빨빪빰빱빳빴빵빻빼빽뺀뺄뺌뺍뺏뺐뺑뺘뺙뺨뻐뻑뻔뻗뻘뻠뻣뻤뻥뻬뼁뼈뼉뼘뼙뼛뼜뼝뽀뽁뽄뽈뽐뽑뽕뾔뾰뿅뿌뿍뿐뿔뿜뿟뿡쀼쁑쁘쁜쁠쁨쁩삐삑삔삘삠삡삣삥사삭삯산삳살삵삶삼삽삿샀상샅새색샌샐샘샙샛샜생샤"
|
|
],
|
|
[
|
|
"bc41",
|
|
"퍪",
|
|
17,
|
|
"퍾퍿펁펂펃펅펆펇"
|
|
],
|
|
[
|
|
"bc61",
|
|
"펈펉펊펋펎펒",
|
|
5,
|
|
"펚펛펝펞펟펡",
|
|
6,
|
|
"펪펬펮"
|
|
],
|
|
[
|
|
"bc81",
|
|
"펯",
|
|
4,
|
|
"펵펶펷펹펺펻펽",
|
|
6,
|
|
"폆폇폊",
|
|
5,
|
|
"폑",
|
|
5,
|
|
"샥샨샬샴샵샷샹섀섄섈섐섕서",
|
|
4,
|
|
"섣설섦섧섬섭섯섰성섶세섹센셀셈셉셋셌셍셔셕션셜셤셥셧셨셩셰셴셸솅소속솎손솔솖솜솝솟송솥솨솩솬솰솽쇄쇈쇌쇔쇗쇘쇠쇤쇨쇰쇱쇳쇼쇽숀숄숌숍숏숑수숙순숟술숨숩숫숭"
|
|
],
|
|
[
|
|
"bd41",
|
|
"폗폙",
|
|
7,
|
|
"폢폤",
|
|
7,
|
|
"폮폯폱폲폳폵폶폷"
|
|
],
|
|
[
|
|
"bd61",
|
|
"폸폹폺폻폾퐀퐂",
|
|
5,
|
|
"퐉",
|
|
13
|
|
],
|
|
[
|
|
"bd81",
|
|
"퐗",
|
|
5,
|
|
"퐞",
|
|
25,
|
|
"숯숱숲숴쉈쉐쉑쉔쉘쉠쉥쉬쉭쉰쉴쉼쉽쉿슁슈슉슐슘슛슝스슥슨슬슭슴습슷승시식신싣실싫심십싯싱싶싸싹싻싼쌀쌈쌉쌌쌍쌓쌔쌕쌘쌜쌤쌥쌨쌩썅써썩썬썰썲썸썹썼썽쎄쎈쎌쏀쏘쏙쏜쏟쏠쏢쏨쏩쏭쏴쏵쏸쐈쐐쐤쐬쐰"
|
|
],
|
|
[
|
|
"be41",
|
|
"퐸",
|
|
7,
|
|
"푁푂푃푅",
|
|
14
|
|
],
|
|
[
|
|
"be61",
|
|
"푔",
|
|
7,
|
|
"푝푞푟푡푢푣푥",
|
|
7,
|
|
"푮푰푱푲"
|
|
],
|
|
[
|
|
"be81",
|
|
"푳",
|
|
4,
|
|
"푺푻푽푾풁풃",
|
|
4,
|
|
"풊풌풎",
|
|
5,
|
|
"풕",
|
|
8,
|
|
"쐴쐼쐽쑈쑤쑥쑨쑬쑴쑵쑹쒀쒔쒜쒸쒼쓩쓰쓱쓴쓸쓺쓿씀씁씌씐씔씜씨씩씬씰씸씹씻씽아악안앉않알앍앎앓암압앗았앙앝앞애액앤앨앰앱앳앴앵야약얀얄얇얌얍얏양얕얗얘얜얠얩어억언얹얻얼얽얾엄",
|
|
6,
|
|
"엌엎"
|
|
],
|
|
[
|
|
"bf41",
|
|
"풞",
|
|
10,
|
|
"풪",
|
|
14
|
|
],
|
|
[
|
|
"bf61",
|
|
"풹",
|
|
18,
|
|
"퓍퓎퓏퓑퓒퓓퓕"
|
|
],
|
|
[
|
|
"bf81",
|
|
"퓖",
|
|
5,
|
|
"퓝퓞퓠",
|
|
7,
|
|
"퓩퓪퓫퓭퓮퓯퓱",
|
|
6,
|
|
"퓹퓺퓼에엑엔엘엠엡엣엥여역엮연열엶엷염",
|
|
5,
|
|
"옅옆옇예옌옐옘옙옛옜오옥온올옭옮옰옳옴옵옷옹옻와왁완왈왐왑왓왔왕왜왝왠왬왯왱외왹왼욀욈욉욋욍요욕욘욜욤욥욧용우욱운울욹욺움웁웃웅워웍원월웜웝웠웡웨"
|
|
],
|
|
[
|
|
"c041",
|
|
"퓾",
|
|
5,
|
|
"픅픆픇픉픊픋픍",
|
|
6,
|
|
"픖픘",
|
|
5
|
|
],
|
|
[
|
|
"c061",
|
|
"픞",
|
|
25
|
|
],
|
|
[
|
|
"c081",
|
|
"픸픹픺픻픾픿핁핂핃핅",
|
|
6,
|
|
"핎핐핒",
|
|
5,
|
|
"핚핛핝핞핟핡핢핣웩웬웰웸웹웽위윅윈윌윔윕윗윙유육윤율윰윱윳융윷으윽은을읊음읍읏응",
|
|
7,
|
|
"읜읠읨읫이익인일읽읾잃임입잇있잉잊잎자작잔잖잗잘잚잠잡잣잤장잦재잭잰잴잼잽잿쟀쟁쟈쟉쟌쟎쟐쟘쟝쟤쟨쟬저적전절젊"
|
|
],
|
|
[
|
|
"c141",
|
|
"핤핦핧핪핬핮",
|
|
5,
|
|
"핶핷핹핺핻핽",
|
|
6,
|
|
"햆햊햋"
|
|
],
|
|
[
|
|
"c161",
|
|
"햌햍햎햏햑",
|
|
19,
|
|
"햦햧"
|
|
],
|
|
[
|
|
"c181",
|
|
"햨",
|
|
31,
|
|
"점접젓정젖제젝젠젤젬젭젯젱져젼졀졈졉졌졍졔조족존졸졺좀좁좃종좆좇좋좌좍좔좝좟좡좨좼좽죄죈죌죔죕죗죙죠죡죤죵주죽준줄줅줆줌줍줏중줘줬줴쥐쥑쥔쥘쥠쥡쥣쥬쥰쥴쥼즈즉즌즐즘즙즛증지직진짇질짊짐집짓"
|
|
],
|
|
[
|
|
"c241",
|
|
"헊헋헍헎헏헑헓",
|
|
4,
|
|
"헚헜헞",
|
|
5,
|
|
"헦헧헩헪헫헭헮"
|
|
],
|
|
[
|
|
"c261",
|
|
"헯",
|
|
4,
|
|
"헶헸헺",
|
|
5,
|
|
"혂혃혅혆혇혉",
|
|
6,
|
|
"혒"
|
|
],
|
|
[
|
|
"c281",
|
|
"혖",
|
|
5,
|
|
"혝혞혟혡혢혣혥",
|
|
7,
|
|
"혮",
|
|
9,
|
|
"혺혻징짖짙짚짜짝짠짢짤짧짬짭짯짰짱째짹짼쨀쨈쨉쨋쨌쨍쨔쨘쨩쩌쩍쩐쩔쩜쩝쩟쩠쩡쩨쩽쪄쪘쪼쪽쫀쫄쫌쫍쫏쫑쫓쫘쫙쫠쫬쫴쬈쬐쬔쬘쬠쬡쭁쭈쭉쭌쭐쭘쭙쭝쭤쭸쭹쮜쮸쯔쯤쯧쯩찌찍찐찔찜찝찡찢찧차착찬찮찰참찹찻"
|
|
],
|
|
[
|
|
"c341",
|
|
"혽혾혿홁홂홃홄홆홇홊홌홎홏홐홒홓홖홗홙홚홛홝",
|
|
4
|
|
],
|
|
[
|
|
"c361",
|
|
"홢",
|
|
4,
|
|
"홨홪",
|
|
5,
|
|
"홲홳홵",
|
|
11
|
|
],
|
|
[
|
|
"c381",
|
|
"횁횂횄횆",
|
|
5,
|
|
"횎횏횑횒횓횕",
|
|
7,
|
|
"횞횠횢",
|
|
5,
|
|
"횩횪찼창찾채책챈챌챔챕챗챘챙챠챤챦챨챰챵처척천철첨첩첫첬청체첵첸첼쳄쳅쳇쳉쳐쳔쳤쳬쳰촁초촉촌촐촘촙촛총촤촨촬촹최쵠쵤쵬쵭쵯쵱쵸춈추축춘출춤춥춧충춰췄췌췐취췬췰췸췹췻췽츄츈츌츔츙츠측츤츨츰츱츳층"
|
|
],
|
|
[
|
|
"c441",
|
|
"횫횭횮횯횱",
|
|
7,
|
|
"횺횼",
|
|
7,
|
|
"훆훇훉훊훋"
|
|
],
|
|
[
|
|
"c461",
|
|
"훍훎훏훐훒훓훕훖훘훚",
|
|
5,
|
|
"훡훢훣훥훦훧훩",
|
|
4
|
|
],
|
|
[
|
|
"c481",
|
|
"훮훯훱훲훳훴훶",
|
|
5,
|
|
"훾훿휁휂휃휅",
|
|
11,
|
|
"휒휓휔치칙친칟칠칡침칩칫칭카칵칸칼캄캅캇캉캐캑캔캘캠캡캣캤캥캬캭컁커컥컨컫컬컴컵컷컸컹케켁켄켈켐켑켓켕켜켠켤켬켭켯켰켱켸코콕콘콜콤콥콧콩콰콱콴콸쾀쾅쾌쾡쾨쾰쿄쿠쿡쿤쿨쿰쿱쿳쿵쿼퀀퀄퀑퀘퀭퀴퀵퀸퀼"
|
|
],
|
|
[
|
|
"c541",
|
|
"휕휖휗휚휛휝휞휟휡",
|
|
6,
|
|
"휪휬휮",
|
|
5,
|
|
"휶휷휹"
|
|
],
|
|
[
|
|
"c561",
|
|
"휺휻휽",
|
|
6,
|
|
"흅흆흈흊",
|
|
5,
|
|
"흒흓흕흚",
|
|
4
|
|
],
|
|
[
|
|
"c581",
|
|
"흟흢흤흦흧흨흪흫흭흮흯흱흲흳흵",
|
|
6,
|
|
"흾흿힀힂",
|
|
5,
|
|
"힊힋큄큅큇큉큐큔큘큠크큭큰클큼큽킁키킥킨킬킴킵킷킹타탁탄탈탉탐탑탓탔탕태택탠탤탬탭탯탰탱탸턍터턱턴털턺텀텁텃텄텅테텍텐텔템텝텟텡텨텬텼톄톈토톡톤톨톰톱톳통톺톼퇀퇘퇴퇸툇툉툐투툭툰툴툼툽툿퉁퉈퉜"
|
|
],
|
|
[
|
|
"c641",
|
|
"힍힎힏힑",
|
|
6,
|
|
"힚힜힞",
|
|
5
|
|
],
|
|
[
|
|
"c6a1",
|
|
"퉤튀튁튄튈튐튑튕튜튠튤튬튱트특튼튿틀틂틈틉틋틔틘틜틤틥티틱틴틸팀팁팃팅파팍팎판팔팖팜팝팟팠팡팥패팩팬팰팸팹팻팼팽퍄퍅퍼퍽펀펄펌펍펏펐펑페펙펜펠펨펩펫펭펴편펼폄폅폈평폐폘폡폣포폭폰폴폼폽폿퐁"
|
|
],
|
|
[
|
|
"c7a1",
|
|
"퐈퐝푀푄표푠푤푭푯푸푹푼푿풀풂품풉풋풍풔풩퓌퓐퓔퓜퓟퓨퓬퓰퓸퓻퓽프픈플픔픕픗피픽핀필핌핍핏핑하학한할핥함합핫항해핵핸핼햄햅햇했행햐향허헉헌헐헒험헙헛헝헤헥헨헬헴헵헷헹혀혁현혈혐협혓혔형혜혠"
|
|
],
|
|
[
|
|
"c8a1",
|
|
"혤혭호혹혼홀홅홈홉홋홍홑화확환활홧황홰홱홴횃횅회획횐횔횝횟횡효횬횰횹횻후훅훈훌훑훔훗훙훠훤훨훰훵훼훽휀휄휑휘휙휜휠휨휩휫휭휴휵휸휼흄흇흉흐흑흔흖흗흘흙흠흡흣흥흩희흰흴흼흽힁히힉힌힐힘힙힛힝"
|
|
],
|
|
[
|
|
"caa1",
|
|
"伽佳假價加可呵哥嘉嫁家暇架枷柯歌珂痂稼苛茄街袈訶賈跏軻迦駕刻却各恪慤殼珏脚覺角閣侃刊墾奸姦干幹懇揀杆柬桿澗癎看磵稈竿簡肝艮艱諫間乫喝曷渴碣竭葛褐蝎鞨勘坎堪嵌感憾戡敢柑橄減甘疳監瞰紺邯鑑鑒龕"
|
|
],
|
|
[
|
|
"cba1",
|
|
"匣岬甲胛鉀閘剛堈姜岡崗康强彊慷江畺疆糠絳綱羌腔舡薑襁講鋼降鱇介价個凱塏愷愾慨改槪漑疥皆盖箇芥蓋豈鎧開喀客坑更粳羹醵倨去居巨拒据據擧渠炬祛距踞車遽鉅鋸乾件健巾建愆楗腱虔蹇鍵騫乞傑杰桀儉劍劒檢"
|
|
],
|
|
[
|
|
"cca1",
|
|
"瞼鈐黔劫怯迲偈憩揭擊格檄激膈覡隔堅牽犬甄絹繭肩見譴遣鵑抉決潔結缺訣兼慊箝謙鉗鎌京俓倞傾儆勁勍卿坰境庚徑慶憬擎敬景暻更梗涇炅烱璟璥瓊痙硬磬竟競絅經耕耿脛莖警輕逕鏡頃頸驚鯨係啓堺契季屆悸戒桂械"
|
|
],
|
|
[
|
|
"cda1",
|
|
"棨溪界癸磎稽系繫繼計誡谿階鷄古叩告呱固姑孤尻庫拷攷故敲暠枯槁沽痼皐睾稿羔考股膏苦苽菰藁蠱袴誥賈辜錮雇顧高鼓哭斛曲梏穀谷鵠困坤崑昆梱棍滾琨袞鯤汨滑骨供公共功孔工恐恭拱控攻珙空蚣貢鞏串寡戈果瓜"
|
|
],
|
|
[
|
|
"cea1",
|
|
"科菓誇課跨過鍋顆廓槨藿郭串冠官寬慣棺款灌琯瓘管罐菅觀貫關館刮恝括适侊光匡壙廣曠洸炚狂珖筐胱鑛卦掛罫乖傀塊壞怪愧拐槐魁宏紘肱轟交僑咬喬嬌嶠巧攪敎校橋狡皎矯絞翹膠蕎蛟較轎郊餃驕鮫丘久九仇俱具勾"
|
|
],
|
|
[
|
|
"cfa1",
|
|
"區口句咎嘔坵垢寇嶇廐懼拘救枸柩構歐毆毬求溝灸狗玖球瞿矩究絿耉臼舅舊苟衢謳購軀逑邱鉤銶駒驅鳩鷗龜國局菊鞠鞫麴君窘群裙軍郡堀屈掘窟宮弓穹窮芎躬倦券勸卷圈拳捲權淃眷厥獗蕨蹶闕机櫃潰詭軌饋句晷歸貴"
|
|
],
|
|
[
|
|
"d0a1",
|
|
"鬼龜叫圭奎揆槻珪硅窺竅糾葵規赳逵閨勻均畇筠菌鈞龜橘克剋劇戟棘極隙僅劤勤懃斤根槿瑾筋芹菫覲謹近饉契今妗擒昑檎琴禁禽芩衾衿襟金錦伋及急扱汲級給亘兢矜肯企伎其冀嗜器圻基埼夔奇妓寄岐崎己幾忌技旗旣"
|
|
],
|
|
[
|
|
"d1a1",
|
|
"朞期杞棋棄機欺氣汽沂淇玘琦琪璂璣畸畿碁磯祁祇祈祺箕紀綺羈耆耭肌記譏豈起錡錤飢饑騎騏驥麒緊佶吉拮桔金喫儺喇奈娜懦懶拏拿癩",
|
|
5,
|
|
"那樂",
|
|
4,
|
|
"諾酪駱亂卵暖欄煖爛蘭難鸞捏捺南嵐枏楠湳濫男藍襤拉"
|
|
],
|
|
[
|
|
"d2a1",
|
|
"納臘蠟衲囊娘廊",
|
|
4,
|
|
"乃來內奈柰耐冷女年撚秊念恬拈捻寧寗努勞奴弩怒擄櫓爐瑙盧",
|
|
5,
|
|
"駑魯",
|
|
10,
|
|
"濃籠聾膿農惱牢磊腦賂雷尿壘",
|
|
7,
|
|
"嫩訥杻紐勒",
|
|
5,
|
|
"能菱陵尼泥匿溺多茶"
|
|
],
|
|
[
|
|
"d3a1",
|
|
"丹亶但單團壇彖斷旦檀段湍短端簞緞蛋袒鄲鍛撻澾獺疸達啖坍憺擔曇淡湛潭澹痰聃膽蕁覃談譚錟沓畓答踏遝唐堂塘幢戇撞棠當糖螳黨代垈坮大對岱帶待戴擡玳臺袋貸隊黛宅德悳倒刀到圖堵塗導屠島嶋度徒悼挑掉搗桃"
|
|
],
|
|
[
|
|
"d4a1",
|
|
"棹櫂淘渡滔濤燾盜睹禱稻萄覩賭跳蹈逃途道都鍍陶韜毒瀆牘犢獨督禿篤纛讀墩惇敦旽暾沌焞燉豚頓乭突仝冬凍動同憧東桐棟洞潼疼瞳童胴董銅兜斗杜枓痘竇荳讀豆逗頭屯臀芚遁遯鈍得嶝橙燈登等藤謄鄧騰喇懶拏癩羅"
|
|
],
|
|
[
|
|
"d5a1",
|
|
"蘿螺裸邏樂洛烙珞絡落諾酪駱丹亂卵欄欒瀾爛蘭鸞剌辣嵐擥攬欖濫籃纜藍襤覽拉臘蠟廊朗浪狼琅瑯螂郞來崍徠萊冷掠略亮倆兩凉梁樑粮粱糧良諒輛量侶儷勵呂廬慮戾旅櫚濾礪藜蠣閭驢驪麗黎力曆歷瀝礫轢靂憐戀攣漣"
|
|
],
|
|
[
|
|
"d6a1",
|
|
"煉璉練聯蓮輦連鍊冽列劣洌烈裂廉斂殮濂簾獵令伶囹寧岺嶺怜玲笭羚翎聆逞鈴零靈領齡例澧禮醴隷勞怒撈擄櫓潞瀘爐盧老蘆虜路輅露魯鷺鹵碌祿綠菉錄鹿麓論壟弄朧瀧瓏籠聾儡瀨牢磊賂賚賴雷了僚寮廖料燎療瞭聊蓼"
|
|
],
|
|
[
|
|
"d7a1",
|
|
"遼鬧龍壘婁屢樓淚漏瘻累縷蔞褸鏤陋劉旒柳榴流溜瀏琉瑠留瘤硫謬類六戮陸侖倫崙淪綸輪律慄栗率隆勒肋凜凌楞稜綾菱陵俚利厘吏唎履悧李梨浬犁狸理璃異痢籬罹羸莉裏裡里釐離鯉吝潾燐璘藺躪隣鱗麟林淋琳臨霖砬"
|
|
],
|
|
[
|
|
"d8a1",
|
|
"立笠粒摩瑪痲碼磨馬魔麻寞幕漠膜莫邈万卍娩巒彎慢挽晩曼滿漫灣瞞萬蔓蠻輓饅鰻唜抹末沫茉襪靺亡妄忘忙望網罔芒茫莽輞邙埋妹媒寐昧枚梅每煤罵買賣邁魅脈貊陌驀麥孟氓猛盲盟萌冪覓免冕勉棉沔眄眠綿緬面麵滅"
|
|
],
|
|
[
|
|
"d9a1",
|
|
"蔑冥名命明暝椧溟皿瞑茗蓂螟酩銘鳴袂侮冒募姆帽慕摸摹暮某模母毛牟牡瑁眸矛耗芼茅謀謨貌木沐牧目睦穆鶩歿沒夢朦蒙卯墓妙廟描昴杳渺猫竗苗錨務巫憮懋戊拇撫无楙武毋無珷畝繆舞茂蕪誣貿霧鵡墨默們刎吻問文"
|
|
],
|
|
[
|
|
"daa1",
|
|
"汶紊紋聞蚊門雯勿沕物味媚尾嵋彌微未梶楣渼湄眉米美薇謎迷靡黴岷悶愍憫敏旻旼民泯玟珉緡閔密蜜謐剝博拍搏撲朴樸泊珀璞箔粕縛膊舶薄迫雹駁伴半反叛拌搬攀斑槃泮潘班畔瘢盤盼磐磻礬絆般蟠返頒飯勃拔撥渤潑"
|
|
],
|
|
[
|
|
"dba1",
|
|
"發跋醱鉢髮魃倣傍坊妨尨幇彷房放方旁昉枋榜滂磅紡肪膀舫芳蒡蚌訪謗邦防龐倍俳北培徘拜排杯湃焙盃背胚裴裵褙賠輩配陪伯佰帛柏栢白百魄幡樊煩燔番磻繁蕃藩飜伐筏罰閥凡帆梵氾汎泛犯範范法琺僻劈壁擘檗璧癖"
|
|
],
|
|
[
|
|
"dca1",
|
|
"碧蘗闢霹便卞弁變辨辯邊別瞥鱉鼈丙倂兵屛幷昞昺柄棅炳甁病秉竝輧餠騈保堡報寶普步洑湺潽珤甫菩補褓譜輔伏僕匐卜宓復服福腹茯蔔複覆輹輻馥鰒本乶俸奉封峯峰捧棒烽熢琫縫蓬蜂逢鋒鳳不付俯傅剖副否咐埠夫婦"
|
|
],
|
|
[
|
|
"dda1",
|
|
"孚孵富府復扶敷斧浮溥父符簿缶腐腑膚艀芙莩訃負賦賻赴趺部釜阜附駙鳧北分吩噴墳奔奮忿憤扮昐汾焚盆粉糞紛芬賁雰不佛弗彿拂崩朋棚硼繃鵬丕備匕匪卑妃婢庇悲憊扉批斐枇榧比毖毗毘沸泌琵痺砒碑秕秘粃緋翡肥"
|
|
],
|
|
[
|
|
"dea1",
|
|
"脾臂菲蜚裨誹譬費鄙非飛鼻嚬嬪彬斌檳殯浜濱瀕牝玭貧賓頻憑氷聘騁乍事些仕伺似使俟僿史司唆嗣四士奢娑寫寺射巳師徙思捨斜斯柶査梭死沙泗渣瀉獅砂社祀祠私篩紗絲肆舍莎蓑蛇裟詐詞謝賜赦辭邪飼駟麝削數朔索"
|
|
],
|
|
[
|
|
"dfa1",
|
|
"傘刪山散汕珊産疝算蒜酸霰乷撒殺煞薩三參杉森渗芟蔘衫揷澁鈒颯上傷像償商喪嘗孀尙峠常床庠廂想桑橡湘爽牀狀相祥箱翔裳觴詳象賞霜塞璽賽嗇塞穡索色牲生甥省笙墅壻嶼序庶徐恕抒捿敍暑曙書栖棲犀瑞筮絮緖署"
|
|
],
|
|
[
|
|
"e0a1",
|
|
"胥舒薯西誓逝鋤黍鼠夕奭席惜昔晳析汐淅潟石碩蓆釋錫仙僊先善嬋宣扇敾旋渲煽琁瑄璇璿癬禪線繕羨腺膳船蘚蟬詵跣選銑鐥饍鮮卨屑楔泄洩渫舌薛褻設說雪齧剡暹殲纖蟾贍閃陝攝涉燮葉城姓宬性惺成星晟猩珹盛省筬"
|
|
],
|
|
[
|
|
"e1a1",
|
|
"聖聲腥誠醒世勢歲洗稅笹細說貰召嘯塑宵小少巢所掃搔昭梳沼消溯瀟炤燒甦疏疎瘙笑篠簫素紹蔬蕭蘇訴逍遡邵銷韶騷俗屬束涑粟續謖贖速孫巽損蓀遜飡率宋悚松淞訟誦送頌刷殺灑碎鎖衰釗修受嗽囚垂壽嫂守岫峀帥愁"
|
|
],
|
|
[
|
|
"e2a1",
|
|
"戍手授搜收數樹殊水洙漱燧狩獸琇璲瘦睡秀穗竪粹綏綬繡羞脩茱蒐蓚藪袖誰讐輸遂邃酬銖銹隋隧隨雖需須首髓鬚叔塾夙孰宿淑潚熟琡璹肅菽巡徇循恂旬栒楯橓殉洵淳珣盾瞬筍純脣舜荀蓴蕣詢諄醇錞順馴戌術述鉥崇崧"
|
|
],
|
|
[
|
|
"e3a1",
|
|
"嵩瑟膝蝨濕拾習褶襲丞乘僧勝升承昇繩蠅陞侍匙嘶始媤尸屎屍市弑恃施是時枾柴猜矢示翅蒔蓍視試詩諡豕豺埴寔式息拭植殖湜熄篒蝕識軾食飾伸侁信呻娠宸愼新晨燼申神紳腎臣莘薪藎蜃訊身辛辰迅失室實悉審尋心沁"
|
|
],
|
|
[
|
|
"e4a1",
|
|
"沈深瀋甚芯諶什十拾雙氏亞俄兒啞娥峨我牙芽莪蛾衙訝阿雅餓鴉鵝堊岳嶽幄惡愕握樂渥鄂鍔顎鰐齷安岸按晏案眼雁鞍顔鮟斡謁軋閼唵岩巖庵暗癌菴闇壓押狎鴨仰央怏昻殃秧鴦厓哀埃崖愛曖涯碍艾隘靄厄扼掖液縊腋額"
|
|
],
|
|
[
|
|
"e5a1",
|
|
"櫻罌鶯鸚也倻冶夜惹揶椰爺耶若野弱掠略約若葯蒻藥躍亮佯兩凉壤孃恙揚攘敭暘梁楊樣洋瀁煬痒瘍禳穰糧羊良襄諒讓釀陽量養圄御於漁瘀禦語馭魚齬億憶抑檍臆偃堰彦焉言諺孼蘖俺儼嚴奄掩淹嶪業円予余勵呂女如廬"
|
|
],
|
|
[
|
|
"e6a1",
|
|
"旅歟汝濾璵礖礪與艅茹輿轝閭餘驪麗黎亦力域役易曆歷疫繹譯轢逆驛嚥堧姸娟宴年延憐戀捐挻撚椽沇沿涎涓淵演漣烟然煙煉燃燕璉硏硯秊筵緣練縯聯衍軟輦蓮連鉛鍊鳶列劣咽悅涅烈熱裂說閱厭廉念捻染殮炎焰琰艶苒"
|
|
],
|
|
[
|
|
"e7a1",
|
|
"簾閻髥鹽曄獵燁葉令囹塋寧嶺嶸影怜映暎楹榮永泳渶潁濚瀛瀯煐營獰玲瑛瑩瓔盈穎纓羚聆英詠迎鈴鍈零霙靈領乂倪例刈叡曳汭濊猊睿穢芮藝蘂禮裔詣譽豫醴銳隸霓預五伍俉傲午吾吳嗚塢墺奧娛寤悟惡懊敖旿晤梧汚澳"
|
|
],
|
|
[
|
|
"e8a1",
|
|
"烏熬獒筽蜈誤鰲鼇屋沃獄玉鈺溫瑥瘟穩縕蘊兀壅擁瓮甕癰翁邕雍饔渦瓦窩窪臥蛙蝸訛婉完宛梡椀浣玩琓琬碗緩翫脘腕莞豌阮頑曰往旺枉汪王倭娃歪矮外嵬巍猥畏了僚僥凹堯夭妖姚寥寮尿嶢拗搖撓擾料曜樂橈燎燿瑤療"
|
|
],
|
|
[
|
|
"e9a1",
|
|
"窈窯繇繞耀腰蓼蟯要謠遙遼邀饒慾欲浴縟褥辱俑傭冗勇埇墉容庸慂榕涌湧溶熔瑢用甬聳茸蓉踊鎔鏞龍于佑偶優又友右宇寓尤愚憂旴牛玗瑀盂祐禑禹紆羽芋藕虞迂遇郵釪隅雨雩勖彧旭昱栯煜稶郁頊云暈橒殞澐熉耘芸蕓"
|
|
],
|
|
[
|
|
"eaa1",
|
|
"運隕雲韻蔚鬱亐熊雄元原員圓園垣媛嫄寃怨愿援沅洹湲源爰猿瑗苑袁轅遠阮院願鴛月越鉞位偉僞危圍委威尉慰暐渭爲瑋緯胃萎葦蔿蝟衛褘謂違韋魏乳侑儒兪劉唯喩孺宥幼幽庾悠惟愈愉揄攸有杻柔柚柳楡楢油洧流游溜"
|
|
],
|
|
[
|
|
"eba1",
|
|
"濡猶猷琉瑜由留癒硫紐維臾萸裕誘諛諭踰蹂遊逾遺酉釉鍮類六堉戮毓肉育陸倫允奫尹崙淪潤玧胤贇輪鈗閏律慄栗率聿戎瀜絨融隆垠恩慇殷誾銀隱乙吟淫蔭陰音飮揖泣邑凝應膺鷹依倚儀宜意懿擬椅毅疑矣義艤薏蟻衣誼"
|
|
],
|
|
[
|
|
"eca1",
|
|
"議醫二以伊利吏夷姨履已弛彛怡易李梨泥爾珥理異痍痢移罹而耳肄苡荑裏裡貽貳邇里離飴餌匿溺瀷益翊翌翼謚人仁刃印吝咽因姻寅引忍湮燐璘絪茵藺蚓認隣靭靷鱗麟一佚佾壹日溢逸鎰馹任壬妊姙恁林淋稔臨荏賃入卄"
|
|
],
|
|
[
|
|
"eda1",
|
|
"立笠粒仍剩孕芿仔刺咨姉姿子字孜恣慈滋炙煮玆瓷疵磁紫者自茨蔗藉諮資雌作勺嚼斫昨灼炸爵綽芍酌雀鵲孱棧殘潺盞岑暫潛箴簪蠶雜丈仗匠場墻壯奬將帳庄張掌暲杖樟檣欌漿牆狀獐璋章粧腸臟臧莊葬蔣薔藏裝贓醬長"
|
|
],
|
|
[
|
|
"eea1",
|
|
"障再哉在宰才材栽梓渽滓災縡裁財載齋齎爭箏諍錚佇低儲咀姐底抵杵楮樗沮渚狙猪疽箸紵苧菹著藷詛貯躇這邸雎齟勣吊嫡寂摘敵滴狄炙的積笛籍績翟荻謫賊赤跡蹟迪迹適鏑佃佺傳全典前剪塡塼奠專展廛悛戰栓殿氈澱"
|
|
],
|
|
[
|
|
"efa1",
|
|
"煎琠田甸畑癲筌箋箭篆纏詮輾轉鈿銓錢鐫電顚顫餞切截折浙癤竊節絶占岾店漸点粘霑鮎點接摺蝶丁井亭停偵呈姃定幀庭廷征情挺政整旌晶晸柾楨檉正汀淀淨渟湞瀞炡玎珽町睛碇禎程穽精綎艇訂諪貞鄭酊釘鉦鋌錠霆靖"
|
|
],
|
|
[
|
|
"f0a1",
|
|
"靜頂鼎制劑啼堤帝弟悌提梯濟祭第臍薺製諸蹄醍除際霽題齊俎兆凋助嘲弔彫措操早晁曺曹朝條棗槽漕潮照燥爪璪眺祖祚租稠窕粗糟組繰肇藻蚤詔調趙躁造遭釣阻雕鳥族簇足鏃存尊卒拙猝倧宗從悰慫棕淙琮種終綜縱腫"
|
|
],
|
|
[
|
|
"f1a1",
|
|
"踪踵鍾鐘佐坐左座挫罪主住侏做姝胄呪周嗾奏宙州廚晝朱柱株注洲湊澍炷珠疇籌紂紬綢舟蛛註誅走躊輳週酎酒鑄駐竹粥俊儁准埈寯峻晙樽浚準濬焌畯竣蠢逡遵雋駿茁中仲衆重卽櫛楫汁葺增憎曾拯烝甑症繒蒸證贈之只"
|
|
],
|
|
[
|
|
"f2a1",
|
|
"咫地址志持指摯支旨智枝枳止池沚漬知砥祉祗紙肢脂至芝芷蜘誌識贄趾遲直稙稷織職唇嗔塵振搢晉晋桭榛殄津溱珍瑨璡畛疹盡眞瞋秦縉縝臻蔯袗診賑軫辰進鎭陣陳震侄叱姪嫉帙桎瓆疾秩窒膣蛭質跌迭斟朕什執潗緝輯"
|
|
],
|
|
[
|
|
"f3a1",
|
|
"鏶集徵懲澄且侘借叉嗟嵯差次此磋箚茶蹉車遮捉搾着窄錯鑿齪撰澯燦璨瓚竄簒纂粲纘讚贊鑽餐饌刹察擦札紮僭參塹慘慙懺斬站讒讖倉倡創唱娼廠彰愴敞昌昶暢槍滄漲猖瘡窓脹艙菖蒼債埰寀寨彩採砦綵菜蔡采釵冊柵策"
|
|
],
|
|
[
|
|
"f4a1",
|
|
"責凄妻悽處倜刺剔尺慽戚拓擲斥滌瘠脊蹠陟隻仟千喘天川擅泉淺玔穿舛薦賤踐遷釧闡阡韆凸哲喆徹撤澈綴輟轍鐵僉尖沾添甛瞻簽籤詹諂堞妾帖捷牒疊睫諜貼輒廳晴淸聽菁請靑鯖切剃替涕滯締諦逮遞體初剿哨憔抄招梢"
|
|
],
|
|
[
|
|
"f5a1",
|
|
"椒楚樵炒焦硝礁礎秒稍肖艸苕草蕉貂超酢醋醮促囑燭矗蜀觸寸忖村邨叢塚寵悤憁摠總聰蔥銃撮催崔最墜抽推椎楸樞湫皺秋芻萩諏趨追鄒酋醜錐錘鎚雛騶鰍丑畜祝竺筑築縮蓄蹙蹴軸逐春椿瑃出朮黜充忠沖蟲衝衷悴膵萃"
|
|
],
|
|
[
|
|
"f6a1",
|
|
"贅取吹嘴娶就炊翠聚脆臭趣醉驟鷲側仄厠惻測層侈値嗤峙幟恥梔治淄熾痔痴癡稚穉緇緻置致蚩輜雉馳齒則勅飭親七柒漆侵寢枕沈浸琛砧針鍼蟄秤稱快他咤唾墮妥惰打拖朶楕舵陀馱駝倬卓啄坼度托拓擢晫柝濁濯琢琸託"
|
|
],
|
|
[
|
|
"f7a1",
|
|
"鐸呑嘆坦彈憚歎灘炭綻誕奪脫探眈耽貪塔搭榻宕帑湯糖蕩兌台太怠態殆汰泰笞胎苔跆邰颱宅擇澤撑攄兎吐土討慟桶洞痛筒統通堆槌腿褪退頹偸套妬投透鬪慝特闖坡婆巴把播擺杷波派爬琶破罷芭跛頗判坂板版瓣販辦鈑"
|
|
],
|
|
[
|
|
"f8a1",
|
|
"阪八叭捌佩唄悖敗沛浿牌狽稗覇貝彭澎烹膨愎便偏扁片篇編翩遍鞭騙貶坪平枰萍評吠嬖幣廢弊斃肺蔽閉陛佈包匍匏咆哺圃布怖抛抱捕暴泡浦疱砲胞脯苞葡蒲袍褒逋鋪飽鮑幅暴曝瀑爆輻俵剽彪慓杓標漂瓢票表豹飇飄驃"
|
|
],
|
|
[
|
|
"f9a1",
|
|
"品稟楓諷豊風馮彼披疲皮被避陂匹弼必泌珌畢疋筆苾馝乏逼下何厦夏廈昰河瑕荷蝦賀遐霞鰕壑學虐謔鶴寒恨悍旱汗漢澣瀚罕翰閑閒限韓割轄函含咸啣喊檻涵緘艦銜陷鹹合哈盒蛤閤闔陜亢伉姮嫦巷恒抗杭桁沆港缸肛航"
|
|
],
|
|
[
|
|
"faa1",
|
|
"行降項亥偕咳垓奚孩害懈楷海瀣蟹解該諧邂駭骸劾核倖幸杏荇行享向嚮珦鄕響餉饗香噓墟虛許憲櫶獻軒歇險驗奕爀赫革俔峴弦懸晛泫炫玄玹現眩睍絃絢縣舷衒見賢鉉顯孑穴血頁嫌俠協夾峽挾浹狹脅脇莢鋏頰亨兄刑型"
|
|
],
|
|
[
|
|
"fba1",
|
|
"形泂滎瀅灐炯熒珩瑩荊螢衡逈邢鎣馨兮彗惠慧暳蕙蹊醯鞋乎互呼壕壺好岵弧戶扈昊晧毫浩淏湖滸澔濠濩灝狐琥瑚瓠皓祜糊縞胡芦葫蒿虎號蝴護豪鎬頀顥惑或酷婚昏混渾琿魂忽惚笏哄弘汞泓洪烘紅虹訌鴻化和嬅樺火畵"
|
|
],
|
|
[
|
|
"fca1",
|
|
"禍禾花華話譁貨靴廓擴攫確碻穫丸喚奐宦幻患換歡晥桓渙煥環紈還驩鰥活滑猾豁闊凰幌徨恍惶愰慌晃晄榥況湟滉潢煌璜皇篁簧荒蝗遑隍黃匯回廻徊恢悔懷晦會檜淮澮灰獪繪膾茴蛔誨賄劃獲宖橫鐄哮嚆孝效斅曉梟涍淆"
|
|
],
|
|
[
|
|
"fda1",
|
|
"爻肴酵驍侯候厚后吼喉嗅帿後朽煦珝逅勛勳塤壎焄熏燻薰訓暈薨喧暄煊萱卉喙毁彙徽揮暉煇諱輝麾休携烋畦虧恤譎鷸兇凶匈洶胸黑昕欣炘痕吃屹紇訖欠欽歆吸恰洽翕興僖凞喜噫囍姬嬉希憙憘戱晞曦熙熹熺犧禧稀羲詰"
|
|
]
|
|
];
|
|
|
|
/***/ },
|
|
/* 101 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = [
|
|
[
|
|
"0",
|
|
"\u0000",
|
|
127
|
|
],
|
|
[
|
|
"a140",
|
|
" ,、。.‧;:?!︰…‥﹐﹑﹒·﹔﹕﹖﹗|–︱—︳╴︴﹏()︵︶{}︷︸〔〕︹︺【】︻︼《》︽︾〈〉︿﹀「」﹁﹂『』﹃﹄﹙﹚"
|
|
],
|
|
[
|
|
"a1a1",
|
|
"﹛﹜﹝﹞‘’“”〝〞‵′#&*※§〃○●△▲◎☆★◇◆□■▽▼㊣℅¯ ̄_ˍ﹉﹊﹍﹎﹋﹌﹟﹠﹡+-×÷±√<>=≦≧≠∞≒≡﹢",
|
|
4,
|
|
"~∩∪⊥∠∟⊿㏒㏑∫∮∵∴♀♂⊕⊙↑↓←→↖↗↙↘∥∣/"
|
|
],
|
|
[
|
|
"a240",
|
|
"\∕﹨$¥〒¢£%@℃℉﹩﹪﹫㏕㎜㎝㎞㏎㎡㎎㎏㏄°兙兛兞兝兡兣嗧瓩糎▁",
|
|
7,
|
|
"▏▎▍▌▋▊▉┼┴┬┤├▔─│▕┌┐└┘╭"
|
|
],
|
|
[
|
|
"a2a1",
|
|
"╮╰╯═╞╪╡◢◣◥◤╱╲╳0",
|
|
9,
|
|
"Ⅰ",
|
|
9,
|
|
"〡",
|
|
8,
|
|
"十卄卅A",
|
|
25,
|
|
"a",
|
|
21
|
|
],
|
|
[
|
|
"a340",
|
|
"wxyzΑ",
|
|
16,
|
|
"Σ",
|
|
6,
|
|
"α",
|
|
16,
|
|
"σ",
|
|
6,
|
|
"ㄅ",
|
|
10
|
|
],
|
|
[
|
|
"a3a1",
|
|
"ㄐ",
|
|
25,
|
|
"˙ˉˊˇˋ"
|
|
],
|
|
[
|
|
"a3e1",
|
|
"€"
|
|
],
|
|
[
|
|
"a440",
|
|
"一乙丁七乃九了二人儿入八几刀刁力匕十卜又三下丈上丫丸凡久么也乞于亡兀刃勺千叉口土士夕大女子孑孓寸小尢尸山川工己已巳巾干廾弋弓才"
|
|
],
|
|
[
|
|
"a4a1",
|
|
"丑丐不中丰丹之尹予云井互五亢仁什仃仆仇仍今介仄元允內六兮公冗凶分切刈勻勾勿化匹午升卅卞厄友及反壬天夫太夭孔少尤尺屯巴幻廿弔引心戈戶手扎支文斗斤方日曰月木欠止歹毋比毛氏水火爪父爻片牙牛犬王丙"
|
|
],
|
|
[
|
|
"a540",
|
|
"世丕且丘主乍乏乎以付仔仕他仗代令仙仞充兄冉冊冬凹出凸刊加功包匆北匝仟半卉卡占卯卮去可古右召叮叩叨叼司叵叫另只史叱台句叭叻四囚外"
|
|
],
|
|
[
|
|
"a5a1",
|
|
"央失奴奶孕它尼巨巧左市布平幼弁弘弗必戊打扔扒扑斥旦朮本未末札正母民氐永汁汀氾犯玄玉瓜瓦甘生用甩田由甲申疋白皮皿目矛矢石示禾穴立丞丟乒乓乩亙交亦亥仿伉伙伊伕伍伐休伏仲件任仰仳份企伋光兇兆先全"
|
|
],
|
|
[
|
|
"a640",
|
|
"共再冰列刑划刎刖劣匈匡匠印危吉吏同吊吐吁吋各向名合吃后吆吒因回囝圳地在圭圬圯圩夙多夷夸妄奸妃好她如妁字存宇守宅安寺尖屹州帆并年"
|
|
],
|
|
[
|
|
"a6a1",
|
|
"式弛忙忖戎戌戍成扣扛托收早旨旬旭曲曳有朽朴朱朵次此死氖汝汗汙江池汐汕污汛汍汎灰牟牝百竹米糸缶羊羽老考而耒耳聿肉肋肌臣自至臼舌舛舟艮色艾虫血行衣西阡串亨位住佇佗佞伴佛何估佐佑伽伺伸佃佔似但佣"
|
|
],
|
|
[
|
|
"a740",
|
|
"作你伯低伶余佝佈佚兌克免兵冶冷別判利刪刨劫助努劬匣即卵吝吭吞吾否呎吧呆呃吳呈呂君吩告吹吻吸吮吵吶吠吼呀吱含吟听囪困囤囫坊坑址坍"
|
|
],
|
|
[
|
|
"a7a1",
|
|
"均坎圾坐坏圻壯夾妝妒妨妞妣妙妖妍妤妓妊妥孝孜孚孛完宋宏尬局屁尿尾岐岑岔岌巫希序庇床廷弄弟彤形彷役忘忌志忍忱快忸忪戒我抄抗抖技扶抉扭把扼找批扳抒扯折扮投抓抑抆改攻攸旱更束李杏材村杜杖杞杉杆杠"
|
|
],
|
|
[
|
|
"a840",
|
|
"杓杗步每求汞沙沁沈沉沅沛汪決沐汰沌汨沖沒汽沃汲汾汴沆汶沍沔沘沂灶灼災灸牢牡牠狄狂玖甬甫男甸皂盯矣私秀禿究系罕肖肓肝肘肛肚育良芒"
|
|
],
|
|
[
|
|
"a8a1",
|
|
"芋芍見角言谷豆豕貝赤走足身車辛辰迂迆迅迄巡邑邢邪邦那酉釆里防阮阱阪阬並乖乳事些亞享京佯依侍佳使佬供例來侃佰併侈佩佻侖佾侏侑佺兔兒兕兩具其典冽函刻券刷刺到刮制剁劾劻卒協卓卑卦卷卸卹取叔受味呵"
|
|
],
|
|
[
|
|
"a940",
|
|
"咖呸咕咀呻呷咄咒咆呼咐呱呶和咚呢周咋命咎固垃坷坪坩坡坦坤坼夜奉奇奈奄奔妾妻委妹妮姑姆姐姍始姓姊妯妳姒姅孟孤季宗定官宜宙宛尚屈居"
|
|
],
|
|
[
|
|
"a9a1",
|
|
"屆岷岡岸岩岫岱岳帘帚帖帕帛帑幸庚店府底庖延弦弧弩往征彿彼忝忠忽念忿怏怔怯怵怖怪怕怡性怩怫怛或戕房戾所承拉拌拄抿拂抹拒招披拓拔拋拈抨抽押拐拙拇拍抵拚抱拘拖拗拆抬拎放斧於旺昔易昌昆昂明昀昏昕昊"
|
|
],
|
|
[
|
|
"aa40",
|
|
"昇服朋杭枋枕東果杳杷枇枝林杯杰板枉松析杵枚枓杼杪杲欣武歧歿氓氛泣注泳沱泌泥河沽沾沼波沫法泓沸泄油況沮泗泅泱沿治泡泛泊沬泯泜泖泠"
|
|
],
|
|
[
|
|
"aaa1",
|
|
"炕炎炒炊炙爬爭爸版牧物狀狎狙狗狐玩玨玟玫玥甽疝疙疚的盂盲直知矽社祀祁秉秈空穹竺糾罔羌羋者肺肥肢肱股肫肩肴肪肯臥臾舍芳芝芙芭芽芟芹花芬芥芯芸芣芰芾芷虎虱初表軋迎返近邵邸邱邶采金長門阜陀阿阻附"
|
|
],
|
|
[
|
|
"ab40",
|
|
"陂隹雨青非亟亭亮信侵侯便俠俑俏保促侶俘俟俊俗侮俐俄係俚俎俞侷兗冒冑冠剎剃削前剌剋則勇勉勃勁匍南卻厚叛咬哀咨哎哉咸咦咳哇哂咽咪品"
|
|
],
|
|
[
|
|
"aba1",
|
|
"哄哈咯咫咱咻咩咧咿囿垂型垠垣垢城垮垓奕契奏奎奐姜姘姿姣姨娃姥姪姚姦威姻孩宣宦室客宥封屎屏屍屋峙峒巷帝帥帟幽庠度建弈弭彥很待徊律徇後徉怒思怠急怎怨恍恰恨恢恆恃恬恫恪恤扁拜挖按拼拭持拮拽指拱拷"
|
|
],
|
|
[
|
|
"ac40",
|
|
"拯括拾拴挑挂政故斫施既春昭映昧是星昨昱昤曷柿染柱柔某柬架枯柵柩柯柄柑枴柚查枸柏柞柳枰柙柢柝柒歪殃殆段毒毗氟泉洋洲洪流津洌洱洞洗"
|
|
],
|
|
[
|
|
"aca1",
|
|
"活洽派洶洛泵洹洧洸洩洮洵洎洫炫為炳炬炯炭炸炮炤爰牲牯牴狩狠狡玷珊玻玲珍珀玳甚甭畏界畎畋疫疤疥疢疣癸皆皇皈盈盆盃盅省盹相眉看盾盼眇矜砂研砌砍祆祉祈祇禹禺科秒秋穿突竿竽籽紂紅紀紉紇約紆缸美羿耄"
|
|
],
|
|
[
|
|
"ad40",
|
|
"耐耍耑耶胖胥胚胃胄背胡胛胎胞胤胝致舢苧范茅苣苛苦茄若茂茉苒苗英茁苜苔苑苞苓苟苯茆虐虹虻虺衍衫要觔計訂訃貞負赴赳趴軍軌述迦迢迪迥"
|
|
],
|
|
[
|
|
"ada1",
|
|
"迭迫迤迨郊郎郁郃酋酊重閂限陋陌降面革韋韭音頁風飛食首香乘亳倌倍倣俯倦倥俸倩倖倆值借倚倒們俺倀倔倨俱倡個候倘俳修倭倪俾倫倉兼冤冥冢凍凌准凋剖剜剔剛剝匪卿原厝叟哨唐唁唷哼哥哲唆哺唔哩哭員唉哮哪"
|
|
],
|
|
[
|
|
"ae40",
|
|
"哦唧唇哽唏圃圄埂埔埋埃堉夏套奘奚娑娘娜娟娛娓姬娠娣娩娥娌娉孫屘宰害家宴宮宵容宸射屑展屐峭峽峻峪峨峰島崁峴差席師庫庭座弱徒徑徐恙"
|
|
],
|
|
[
|
|
"aea1",
|
|
"恣恥恐恕恭恩息悄悟悚悍悔悌悅悖扇拳挈拿捎挾振捕捂捆捏捉挺捐挽挪挫挨捍捌效敉料旁旅時晉晏晃晒晌晅晁書朔朕朗校核案框桓根桂桔栩梳栗桌桑栽柴桐桀格桃株桅栓栘桁殊殉殷氣氧氨氦氤泰浪涕消涇浦浸海浙涓"
|
|
],
|
|
[
|
|
"af40",
|
|
"浬涉浮浚浴浩涌涊浹涅浥涔烊烘烤烙烈烏爹特狼狹狽狸狷玆班琉珮珠珪珞畔畝畜畚留疾病症疲疳疽疼疹痂疸皋皰益盍盎眩真眠眨矩砰砧砸砝破砷"
|
|
],
|
|
[
|
|
"afa1",
|
|
"砥砭砠砟砲祕祐祠祟祖神祝祗祚秤秣秧租秦秩秘窄窈站笆笑粉紡紗紋紊素索純紐紕級紜納紙紛缺罟羔翅翁耆耘耕耙耗耽耿胱脂胰脅胭胴脆胸胳脈能脊胼胯臭臬舀舐航舫舨般芻茫荒荔荊茸荐草茵茴荏茲茹茶茗荀茱茨荃"
|
|
],
|
|
[
|
|
"b040",
|
|
"虔蚊蚪蚓蚤蚩蚌蚣蚜衰衷袁袂衽衹記訐討訌訕訊託訓訖訏訑豈豺豹財貢起躬軒軔軏辱送逆迷退迺迴逃追逅迸邕郡郝郢酒配酌釘針釗釜釙閃院陣陡"
|
|
],
|
|
[
|
|
"b0a1",
|
|
"陛陝除陘陞隻飢馬骨高鬥鬲鬼乾偺偽停假偃偌做偉健偶偎偕偵側偷偏倏偯偭兜冕凰剪副勒務勘動匐匏匙匿區匾參曼商啪啦啄啞啡啃啊唱啖問啕唯啤唸售啜唬啣唳啁啗圈國圉域堅堊堆埠埤基堂堵執培夠奢娶婁婉婦婪婀"
|
|
],
|
|
[
|
|
"b140",
|
|
"娼婢婚婆婊孰寇寅寄寂宿密尉專將屠屜屝崇崆崎崛崖崢崑崩崔崙崤崧崗巢常帶帳帷康庸庶庵庾張強彗彬彩彫得徙從徘御徠徜恿患悉悠您惋悴惦悽"
|
|
],
|
|
[
|
|
"b1a1",
|
|
"情悻悵惜悼惘惕惆惟悸惚惇戚戛扈掠控捲掖探接捷捧掘措捱掩掉掃掛捫推掄授掙採掬排掏掀捻捩捨捺敝敖救教敗啟敏敘敕敔斜斛斬族旋旌旎晝晚晤晨晦晞曹勗望梁梯梢梓梵桿桶梱梧梗械梃棄梭梆梅梔條梨梟梡梂欲殺"
|
|
],
|
|
[
|
|
"b240",
|
|
"毫毬氫涎涼淳淙液淡淌淤添淺清淇淋涯淑涮淞淹涸混淵淅淒渚涵淚淫淘淪深淮淨淆淄涪淬涿淦烹焉焊烽烯爽牽犁猜猛猖猓猙率琅琊球理現琍瓠瓶"
|
|
],
|
|
[
|
|
"b2a1",
|
|
"瓷甜產略畦畢異疏痔痕疵痊痍皎盔盒盛眷眾眼眶眸眺硫硃硎祥票祭移窒窕笠笨笛第符笙笞笮粒粗粕絆絃統紮紹紼絀細紳組累終紲紱缽羞羚翌翎習耜聊聆脯脖脣脫脩脰脤舂舵舷舶船莎莞莘荸莢莖莽莫莒莊莓莉莠荷荻荼"
|
|
],
|
|
[
|
|
"b340",
|
|
"莆莧處彪蛇蛀蚶蛄蚵蛆蛋蚱蚯蛉術袞袈被袒袖袍袋覓規訪訝訣訥許設訟訛訢豉豚販責貫貨貪貧赧赦趾趺軛軟這逍通逗連速逝逐逕逞造透逢逖逛途"
|
|
],
|
|
[
|
|
"b3a1",
|
|
"部郭都酗野釵釦釣釧釭釩閉陪陵陳陸陰陴陶陷陬雀雪雩章竟頂頃魚鳥鹵鹿麥麻傢傍傅備傑傀傖傘傚最凱割剴創剩勞勝勛博厥啻喀喧啼喊喝喘喂喜喪喔喇喋喃喳單喟唾喲喚喻喬喱啾喉喫喙圍堯堪場堤堰報堡堝堠壹壺奠"
|
|
],
|
|
[
|
|
"b440",
|
|
"婷媚婿媒媛媧孳孱寒富寓寐尊尋就嵌嵐崴嵇巽幅帽幀幃幾廊廁廂廄弼彭復循徨惑惡悲悶惠愜愣惺愕惰惻惴慨惱愎惶愉愀愒戟扉掣掌描揀揩揉揆揍"
|
|
],
|
|
[
|
|
"b4a1",
|
|
"插揣提握揖揭揮捶援揪換摒揚揹敞敦敢散斑斐斯普晰晴晶景暑智晾晷曾替期朝棺棕棠棘棗椅棟棵森棧棹棒棲棣棋棍植椒椎棉棚楮棻款欺欽殘殖殼毯氮氯氬港游湔渡渲湧湊渠渥渣減湛湘渤湖湮渭渦湯渴湍渺測湃渝渾滋"
|
|
],
|
|
[
|
|
"b540",
|
|
"溉渙湎湣湄湲湩湟焙焚焦焰無然煮焜牌犄犀猶猥猴猩琺琪琳琢琥琵琶琴琯琛琦琨甥甦畫番痢痛痣痙痘痞痠登發皖皓皴盜睏短硝硬硯稍稈程稅稀窘"
|
|
],
|
|
[
|
|
"b5a1",
|
|
"窗窖童竣等策筆筐筒答筍筋筏筑粟粥絞結絨絕紫絮絲絡給絢絰絳善翔翕耋聒肅腕腔腋腑腎脹腆脾腌腓腴舒舜菩萃菸萍菠菅萋菁華菱菴著萊菰萌菌菽菲菊萸萎萄菜萇菔菟虛蛟蛙蛭蛔蛛蛤蛐蛞街裁裂袱覃視註詠評詞証詁"
|
|
],
|
|
[
|
|
"b640",
|
|
"詔詛詐詆訴診訶詖象貂貯貼貳貽賁費賀貴買貶貿貸越超趁跎距跋跚跑跌跛跆軻軸軼辜逮逵週逸進逶鄂郵鄉郾酣酥量鈔鈕鈣鈉鈞鈍鈐鈇鈑閔閏開閑"
|
|
],
|
|
[
|
|
"b6a1",
|
|
"間閒閎隊階隋陽隅隆隍陲隄雁雅雄集雇雯雲韌項順須飧飪飯飩飲飭馮馭黃黍黑亂傭債傲傳僅傾催傷傻傯僇剿剷剽募勦勤勢勣匯嗟嗨嗓嗦嗎嗜嗇嗑嗣嗤嗯嗚嗡嗅嗆嗥嗉園圓塞塑塘塗塚塔填塌塭塊塢塒塋奧嫁嫉嫌媾媽媼"
|
|
],
|
|
[
|
|
"b740",
|
|
"媳嫂媲嵩嵯幌幹廉廈弒彙徬微愚意慈感想愛惹愁愈慎慌慄慍愾愴愧愍愆愷戡戢搓搾搞搪搭搽搬搏搜搔損搶搖搗搆敬斟新暗暉暇暈暖暄暘暍會榔業"
|
|
],
|
|
[
|
|
"b7a1",
|
|
"楚楷楠楔極椰概楊楨楫楞楓楹榆楝楣楛歇歲毀殿毓毽溢溯滓溶滂源溝滇滅溥溘溼溺溫滑準溜滄滔溪溧溴煎煙煩煤煉照煜煬煦煌煥煞煆煨煖爺牒猷獅猿猾瑯瑚瑕瑟瑞瑁琿瑙瑛瑜當畸瘀痰瘁痲痱痺痿痴痳盞盟睛睫睦睞督"
|
|
],
|
|
[
|
|
"b840",
|
|
"睹睪睬睜睥睨睢矮碎碰碗碘碌碉硼碑碓硿祺祿禁萬禽稜稚稠稔稟稞窟窠筷節筠筮筧粱粳粵經絹綑綁綏絛置罩罪署義羨群聖聘肆肄腱腰腸腥腮腳腫"
|
|
],
|
|
[
|
|
"b8a1",
|
|
"腹腺腦舅艇蒂葷落萱葵葦葫葉葬葛萼萵葡董葩葭葆虞虜號蛹蜓蜈蜇蜀蛾蛻蜂蜃蜆蜊衙裟裔裙補裘裝裡裊裕裒覜解詫該詳試詩詰誇詼詣誠話誅詭詢詮詬詹詻訾詨豢貊貉賊資賈賄貲賃賂賅跡跟跨路跳跺跪跤跦躲較載軾輊"
|
|
],
|
|
[
|
|
"b940",
|
|
"辟農運遊道遂達逼違遐遇遏過遍遑逾遁鄒鄗酬酪酩釉鈷鉗鈸鈽鉀鈾鉛鉋鉤鉑鈴鉉鉍鉅鈹鈿鉚閘隘隔隕雍雋雉雊雷電雹零靖靴靶預頑頓頊頒頌飼飴"
|
|
],
|
|
[
|
|
"b9a1",
|
|
"飽飾馳馱馴髡鳩麂鼎鼓鼠僧僮僥僖僭僚僕像僑僱僎僩兢凳劃劂匱厭嗾嘀嘛嘗嗽嘔嘆嘉嘍嘎嗷嘖嘟嘈嘐嗶團圖塵塾境墓墊塹墅塽壽夥夢夤奪奩嫡嫦嫩嫗嫖嫘嫣孵寞寧寡寥實寨寢寤察對屢嶄嶇幛幣幕幗幔廓廖弊彆彰徹慇"
|
|
],
|
|
[
|
|
"ba40",
|
|
"愿態慷慢慣慟慚慘慵截撇摘摔撤摸摟摺摑摧搴摭摻敲斡旗旖暢暨暝榜榨榕槁榮槓構榛榷榻榫榴槐槍榭槌榦槃榣歉歌氳漳演滾漓滴漩漾漠漬漏漂漢"
|
|
],
|
|
[
|
|
"baa1",
|
|
"滿滯漆漱漸漲漣漕漫漯澈漪滬漁滲滌滷熔熙煽熊熄熒爾犒犖獄獐瑤瑣瑪瑰瑭甄疑瘧瘍瘋瘉瘓盡監瞄睽睿睡磁碟碧碳碩碣禎福禍種稱窪窩竭端管箕箋筵算箝箔箏箸箇箄粹粽精綻綰綜綽綾綠緊綴網綱綺綢綿綵綸維緒緇綬"
|
|
],
|
|
[
|
|
"bb40",
|
|
"罰翠翡翟聞聚肇腐膀膏膈膊腿膂臧臺與舔舞艋蓉蒿蓆蓄蒙蒞蒲蒜蓋蒸蓀蓓蒐蒼蓑蓊蜿蜜蜻蜢蜥蜴蜘蝕蜷蜩裳褂裴裹裸製裨褚裯誦誌語誣認誡誓誤"
|
|
],
|
|
[
|
|
"bba1",
|
|
"說誥誨誘誑誚誧豪貍貌賓賑賒赫趙趕跼輔輒輕輓辣遠遘遜遣遙遞遢遝遛鄙鄘鄞酵酸酷酴鉸銀銅銘銖鉻銓銜銨鉼銑閡閨閩閣閥閤隙障際雌雒需靼鞅韶頗領颯颱餃餅餌餉駁骯骰髦魁魂鳴鳶鳳麼鼻齊億儀僻僵價儂儈儉儅凜"
|
|
],
|
|
[
|
|
"bc40",
|
|
"劇劈劉劍劊勰厲嘮嘻嘹嘲嘿嘴嘩噓噎噗噴嘶嘯嘰墀墟增墳墜墮墩墦奭嬉嫻嬋嫵嬌嬈寮寬審寫層履嶝嶔幢幟幡廢廚廟廝廣廠彈影德徵慶慧慮慝慕憂"
|
|
],
|
|
[
|
|
"bca1",
|
|
"慼慰慫慾憧憐憫憎憬憚憤憔憮戮摩摯摹撞撲撈撐撰撥撓撕撩撒撮播撫撚撬撙撢撳敵敷數暮暫暴暱樣樟槨樁樞標槽模樓樊槳樂樅槭樑歐歎殤毅毆漿潼澄潑潦潔澆潭潛潸潮澎潺潰潤澗潘滕潯潠潟熟熬熱熨牖犛獎獗瑩璋璃"
|
|
],
|
|
[
|
|
"bd40",
|
|
"瑾璀畿瘠瘩瘟瘤瘦瘡瘢皚皺盤瞎瞇瞌瞑瞋磋磅確磊碾磕碼磐稿稼穀稽稷稻窯窮箭箱範箴篆篇篁箠篌糊締練緯緻緘緬緝編緣線緞緩綞緙緲緹罵罷羯"
|
|
],
|
|
[
|
|
"bda1",
|
|
"翩耦膛膜膝膠膚膘蔗蔽蔚蓮蔬蔭蔓蔑蔣蔡蔔蓬蔥蓿蔆螂蝴蝶蝠蝦蝸蝨蝙蝗蝌蝓衛衝褐複褒褓褕褊誼諒談諄誕請諸課諉諂調誰論諍誶誹諛豌豎豬賠賞賦賤賬賭賢賣賜質賡赭趟趣踫踐踝踢踏踩踟踡踞躺輝輛輟輩輦輪輜輞"
|
|
],
|
|
[
|
|
"be40",
|
|
"輥適遮遨遭遷鄰鄭鄧鄱醇醉醋醃鋅銻銷鋪銬鋤鋁銳銼鋒鋇鋰銲閭閱霄霆震霉靠鞍鞋鞏頡頫頜颳養餓餒餘駝駐駟駛駑駕駒駙骷髮髯鬧魅魄魷魯鴆鴉"
|
|
],
|
|
[
|
|
"bea1",
|
|
"鴃麩麾黎墨齒儒儘儔儐儕冀冪凝劑劓勳噙噫噹噩噤噸噪器噥噱噯噬噢噶壁墾壇壅奮嬝嬴學寰導彊憲憑憩憊懍憶憾懊懈戰擅擁擋撻撼據擄擇擂操撿擒擔撾整曆曉暹曄曇暸樽樸樺橙橫橘樹橄橢橡橋橇樵機橈歙歷氅濂澱澡"
|
|
],
|
|
[
|
|
"bf40",
|
|
"濃澤濁澧澳激澹澶澦澠澴熾燉燐燒燈燕熹燎燙燜燃燄獨璜璣璘璟璞瓢甌甍瘴瘸瘺盧盥瞠瞞瞟瞥磨磚磬磧禦積穎穆穌穋窺篙簑築篤篛篡篩篦糕糖縊"
|
|
],
|
|
[
|
|
"bfa1",
|
|
"縑縈縛縣縞縝縉縐罹羲翰翱翮耨膳膩膨臻興艘艙蕊蕙蕈蕨蕩蕃蕉蕭蕪蕞螃螟螞螢融衡褪褲褥褫褡親覦諦諺諫諱謀諜諧諮諾謁謂諷諭諳諶諼豫豭貓賴蹄踱踴蹂踹踵輻輯輸輳辨辦遵遴選遲遼遺鄴醒錠錶鋸錳錯錢鋼錫錄錚"
|
|
],
|
|
[
|
|
"c040",
|
|
"錐錦錡錕錮錙閻隧隨險雕霎霑霖霍霓霏靛靜靦鞘頰頸頻頷頭頹頤餐館餞餛餡餚駭駢駱骸骼髻髭鬨鮑鴕鴣鴦鴨鴒鴛默黔龍龜優償儡儲勵嚎嚀嚐嚅嚇"
|
|
],
|
|
[
|
|
"c0a1",
|
|
"嚏壕壓壑壎嬰嬪嬤孺尷屨嶼嶺嶽嶸幫彌徽應懂懇懦懋戲戴擎擊擘擠擰擦擬擱擢擭斂斃曙曖檀檔檄檢檜櫛檣橾檗檐檠歜殮毚氈濘濱濟濠濛濤濫濯澀濬濡濩濕濮濰燧營燮燦燥燭燬燴燠爵牆獰獲璩環璦璨癆療癌盪瞳瞪瞰瞬"
|
|
],
|
|
[
|
|
"c140",
|
|
"瞧瞭矯磷磺磴磯礁禧禪穗窿簇簍篾篷簌篠糠糜糞糢糟糙糝縮績繆縷縲繃縫總縱繅繁縴縹繈縵縿縯罄翳翼聱聲聰聯聳臆臃膺臂臀膿膽臉膾臨舉艱薪"
|
|
],
|
|
[
|
|
"c1a1",
|
|
"薄蕾薜薑薔薯薛薇薨薊虧蟀蟑螳蟒蟆螫螻螺蟈蟋褻褶襄褸褽覬謎謗謙講謊謠謝謄謐豁谿豳賺賽購賸賻趨蹉蹋蹈蹊轄輾轂轅輿避遽還邁邂邀鄹醣醞醜鍍鎂錨鍵鍊鍥鍋錘鍾鍬鍛鍰鍚鍔闊闋闌闈闆隱隸雖霜霞鞠韓顆颶餵騁"
|
|
],
|
|
[
|
|
"c240",
|
|
"駿鮮鮫鮪鮭鴻鴿麋黏點黜黝黛鼾齋叢嚕嚮壙壘嬸彝懣戳擴擲擾攆擺擻擷斷曜朦檳檬櫃檻檸櫂檮檯歟歸殯瀉瀋濾瀆濺瀑瀏燻燼燾燸獷獵璧璿甕癖癘"
|
|
],
|
|
[
|
|
"c2a1",
|
|
"癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶臍臏舊藏薩藍藐藉薰薺薹薦蟯蟬蟲蟠覆覲觴謨謹謬謫豐贅蹙蹣蹦蹤蹟蹕軀轉轍邇邃邈醫醬釐鎔鎊鎖鎢鎳鎮鎬鎰鎘鎚鎗闔闖闐闕離雜雙雛雞霤鞣鞦"
|
|
],
|
|
[
|
|
"c340",
|
|
"鞭韹額顏題顎顓颺餾餿餽餮馥騎髁鬃鬆魏魎魍鯊鯉鯽鯈鯀鵑鵝鵠黠鼕鼬儳嚥壞壟壢寵龐廬懲懷懶懵攀攏曠曝櫥櫝櫚櫓瀛瀟瀨瀚瀝瀕瀘爆爍牘犢獸"
|
|
],
|
|
[
|
|
"c3a1",
|
|
"獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩藝藪藕藤藥藷蟻蠅蠍蟹蟾襠襟襖襞譁譜識證譚譎譏譆譙贈贊蹼蹲躇蹶蹬蹺蹴轔轎辭邊邋醱醮鏡鏑鏟鏃鏈鏜鏝鏖鏢鏍鏘鏤鏗鏨關隴難霪霧靡韜韻類"
|
|
],
|
|
[
|
|
"c440",
|
|
"願顛颼饅饉騖騙鬍鯨鯧鯖鯛鶉鵡鵲鵪鵬麒麗麓麴勸嚨嚷嚶嚴嚼壤孀孃孽寶巉懸懺攘攔攙曦朧櫬瀾瀰瀲爐獻瓏癢癥礦礪礬礫竇競籌籃籍糯糰辮繽繼"
|
|
],
|
|
[
|
|
"c4a1",
|
|
"纂罌耀臚艦藻藹蘑藺蘆蘋蘇蘊蠔蠕襤覺觸議譬警譯譟譫贏贍躉躁躅躂醴釋鐘鐃鏽闡霰飄饒饑馨騫騰騷騵鰓鰍鹹麵黨鼯齟齣齡儷儸囁囀囂夔屬巍懼懾攝攜斕曩櫻欄櫺殲灌爛犧瓖瓔癩矓籐纏續羼蘗蘭蘚蠣蠢蠡蠟襪襬覽譴"
|
|
],
|
|
[
|
|
"c540",
|
|
"護譽贓躊躍躋轟辯醺鐮鐳鐵鐺鐸鐲鐫闢霸霹露響顧顥饗驅驃驀騾髏魔魑鰭鰥鶯鶴鷂鶸麝黯鼙齜齦齧儼儻囈囊囉孿巔巒彎懿攤權歡灑灘玀瓤疊癮癬"
|
|
],
|
|
[
|
|
"c5a1",
|
|
"禳籠籟聾聽臟襲襯觼讀贖贗躑躓轡酈鑄鑑鑒霽霾韃韁顫饕驕驍髒鬚鱉鰱鰾鰻鷓鷗鼴齬齪龔囌巖戀攣攫攪曬欐瓚竊籤籣籥纓纖纔臢蘸蘿蠱變邐邏鑣鑠鑤靨顯饜驚驛驗髓體髑鱔鱗鱖鷥麟黴囑壩攬灞癱癲矗罐羈蠶蠹衢讓讒"
|
|
],
|
|
[
|
|
"c640",
|
|
"讖艷贛釀鑪靂靈靄韆顰驟鬢魘鱟鷹鷺鹼鹽鼇齷齲廳欖灣籬籮蠻觀躡釁鑲鑰顱饞髖鬣黌灤矚讚鑷韉驢驥纜讜躪釅鑽鑾鑼鱷鱸黷豔鑿鸚爨驪鬱鸛鸞籲"
|
|
],
|
|
[
|
|
"c940",
|
|
"乂乜凵匚厂万丌乇亍囗兀屮彳丏冇与丮亓仂仉仈冘勼卬厹圠夃夬尐巿旡殳毌气爿丱丼仨仜仩仡仝仚刌匜卌圢圣夗夯宁宄尒尻屴屳帄庀庂忉戉扐氕"
|
|
],
|
|
[
|
|
"c9a1",
|
|
"氶汃氿氻犮犰玊禸肊阞伎优伬仵伔仱伀价伈伝伂伅伢伓伄仴伒冱刓刉刐劦匢匟卍厊吇囡囟圮圪圴夼妀奼妅奻奾奷奿孖尕尥屼屺屻屾巟幵庄异弚彴忕忔忏扜扞扤扡扦扢扙扠扚扥旯旮朾朹朸朻机朿朼朳氘汆汒汜汏汊汔汋"
|
|
],
|
|
[
|
|
"ca40",
|
|
"汌灱牞犴犵玎甪癿穵网艸艼芀艽艿虍襾邙邗邘邛邔阢阤阠阣佖伻佢佉体佤伾佧佒佟佁佘伭伳伿佡冏冹刜刞刡劭劮匉卣卲厎厏吰吷吪呔呅吙吜吥吘"
|
|
],
|
|
[
|
|
"caa1",
|
|
"吽呏呁吨吤呇囮囧囥坁坅坌坉坋坒夆奀妦妘妠妗妎妢妐妏妧妡宎宒尨尪岍岏岈岋岉岒岊岆岓岕巠帊帎庋庉庌庈庍弅弝彸彶忒忑忐忭忨忮忳忡忤忣忺忯忷忻怀忴戺抃抌抎抏抔抇扱扻扺扰抁抈扷扽扲扴攷旰旴旳旲旵杅杇"
|
|
],
|
|
[
|
|
"cb40",
|
|
"杙杕杌杈杝杍杚杋毐氙氚汸汧汫沄沋沏汱汯汩沚汭沇沕沜汦汳汥汻沎灴灺牣犿犽狃狆狁犺狅玕玗玓玔玒町甹疔疕皁礽耴肕肙肐肒肜芐芏芅芎芑芓"
|
|
],
|
|
[
|
|
"cba1",
|
|
"芊芃芄豸迉辿邟邡邥邞邧邠阰阨阯阭丳侘佼侅佽侀侇佶佴侉侄佷佌侗佪侚佹侁佸侐侜侔侞侒侂侕佫佮冞冼冾刵刲刳剆刱劼匊匋匼厒厔咇呿咁咑咂咈呫呺呾呥呬呴呦咍呯呡呠咘呣呧呤囷囹坯坲坭坫坱坰坶垀坵坻坳坴坢"
|
|
],
|
|
[
|
|
"cc40",
|
|
"坨坽夌奅妵妺姏姎妲姌姁妶妼姃姖妱妽姀姈妴姇孢孥宓宕屄屇岮岤岠岵岯岨岬岟岣岭岢岪岧岝岥岶岰岦帗帔帙弨弢弣弤彔徂彾彽忞忥怭怦怙怲怋"
|
|
],
|
|
[
|
|
"cca1",
|
|
"怴怊怗怳怚怞怬怢怍怐怮怓怑怌怉怜戔戽抭抴拑抾抪抶拊抮抳抯抻抩抰抸攽斨斻昉旼昄昒昈旻昃昋昍昅旽昑昐曶朊枅杬枎枒杶杻枘枆构杴枍枌杺枟枑枙枃杽极杸杹枔欥殀歾毞氝沓泬泫泮泙沶泔沭泧沷泐泂沺泃泆泭泲"
|
|
],
|
|
[
|
|
"cd40",
|
|
"泒泝沴沊沝沀泞泀洰泍泇沰泹泏泩泑炔炘炅炓炆炄炑炖炂炚炃牪狖狋狘狉狜狒狔狚狌狑玤玡玭玦玢玠玬玝瓝瓨甿畀甾疌疘皯盳盱盰盵矸矼矹矻矺"
|
|
],
|
|
[
|
|
"cda1",
|
|
"矷祂礿秅穸穻竻籵糽耵肏肮肣肸肵肭舠芠苀芫芚芘芛芵芧芮芼芞芺芴芨芡芩苂芤苃芶芢虰虯虭虮豖迒迋迓迍迖迕迗邲邴邯邳邰阹阽阼阺陃俍俅俓侲俉俋俁俔俜俙侻侳俛俇俖侺俀侹俬剄剉勀勂匽卼厗厖厙厘咺咡咭咥哏"
|
|
],
|
|
[
|
|
"ce40",
|
|
"哃茍咷咮哖咶哅哆咠呰咼咢咾呲哞咰垵垞垟垤垌垗垝垛垔垘垏垙垥垚垕壴复奓姡姞姮娀姱姝姺姽姼姶姤姲姷姛姩姳姵姠姾姴姭宨屌峐峘峌峗峋峛"
|
|
],
|
|
[
|
|
"cea1",
|
|
"峞峚峉峇峊峖峓峔峏峈峆峎峟峸巹帡帢帣帠帤庰庤庢庛庣庥弇弮彖徆怷怹恔恲恞恅恓恇恉恛恌恀恂恟怤恄恘恦恮扂扃拏挍挋拵挎挃拫拹挏挌拸拶挀挓挔拺挕拻拰敁敃斪斿昶昡昲昵昜昦昢昳昫昺昝昴昹昮朏朐柁柲柈枺"
|
|
],
|
|
[
|
|
"cf40",
|
|
"柜枻柸柘柀枷柅柫柤柟枵柍枳柷柶柮柣柂枹柎柧柰枲柼柆柭柌枮柦柛柺柉柊柃柪柋欨殂殄殶毖毘毠氠氡洨洴洭洟洼洿洒洊泚洳洄洙洺洚洑洀洝浂"
|
|
],
|
|
[
|
|
"cfa1",
|
|
"洁洘洷洃洏浀洇洠洬洈洢洉洐炷炟炾炱炰炡炴炵炩牁牉牊牬牰牳牮狊狤狨狫狟狪狦狣玅珌珂珈珅玹玶玵玴珫玿珇玾珃珆玸珋瓬瓮甮畇畈疧疪癹盄眈眃眄眅眊盷盻盺矧矨砆砑砒砅砐砏砎砉砃砓祊祌祋祅祄秕种秏秖秎窀"
|
|
],
|
|
[
|
|
"d040",
|
|
"穾竑笀笁籺籸籹籿粀粁紃紈紁罘羑羍羾耇耎耏耔耷胘胇胠胑胈胂胐胅胣胙胜胊胕胉胏胗胦胍臿舡芔苙苾苹茇苨茀苕茺苫苖苴苬苡苲苵茌苻苶苰苪"
|
|
],
|
|
[
|
|
"d0a1",
|
|
"苤苠苺苳苭虷虴虼虳衁衎衧衪衩觓訄訇赲迣迡迮迠郱邽邿郕郅邾郇郋郈釔釓陔陏陑陓陊陎倞倅倇倓倢倰倛俵俴倳倷倬俶俷倗倜倠倧倵倯倱倎党冔冓凊凄凅凈凎剡剚剒剞剟剕剢勍匎厞唦哢唗唒哧哳哤唚哿唄唈哫唑唅哱"
|
|
],
|
|
[
|
|
"d140",
|
|
"唊哻哷哸哠唎唃唋圁圂埌堲埕埒垺埆垽垼垸垶垿埇埐垹埁夎奊娙娖娭娮娕娏娗娊娞娳孬宧宭宬尃屖屔峬峿峮峱峷崀峹帩帨庨庮庪庬弳弰彧恝恚恧"
|
|
],
|
|
[
|
|
"d1a1",
|
|
"恁悢悈悀悒悁悝悃悕悛悗悇悜悎戙扆拲挐捖挬捄捅挶捃揤挹捋捊挼挩捁挴捘捔捙挭捇挳捚捑挸捗捀捈敊敆旆旃旄旂晊晟晇晑朒朓栟栚桉栲栳栻桋桏栖栱栜栵栫栭栯桎桄栴栝栒栔栦栨栮桍栺栥栠欬欯欭欱欴歭肂殈毦毤"
|
|
],
|
|
[
|
|
"d240",
|
|
"毨毣毢毧氥浺浣浤浶洍浡涒浘浢浭浯涑涍淯浿涆浞浧浠涗浰浼浟涂涘洯浨涋浾涀涄洖涃浻浽浵涐烜烓烑烝烋缹烢烗烒烞烠烔烍烅烆烇烚烎烡牂牸"
|
|
],
|
|
[
|
|
"d2a1",
|
|
"牷牶猀狺狴狾狶狳狻猁珓珙珥珖玼珧珣珩珜珒珛珔珝珚珗珘珨瓞瓟瓴瓵甡畛畟疰痁疻痄痀疿疶疺皊盉眝眛眐眓眒眣眑眕眙眚眢眧砣砬砢砵砯砨砮砫砡砩砳砪砱祔祛祏祜祓祒祑秫秬秠秮秭秪秜秞秝窆窉窅窋窌窊窇竘笐"
|
|
],
|
|
[
|
|
"d340",
|
|
"笄笓笅笏笈笊笎笉笒粄粑粊粌粈粍粅紞紝紑紎紘紖紓紟紒紏紌罜罡罞罠罝罛羖羒翃翂翀耖耾耹胺胲胹胵脁胻脀舁舯舥茳茭荄茙荑茥荖茿荁茦茜茢"
|
|
],
|
|
[
|
|
"d3a1",
|
|
"荂荎茛茪茈茼荍茖茤茠茷茯茩荇荅荌荓茞茬荋茧荈虓虒蚢蚨蚖蚍蚑蚞蚇蚗蚆蚋蚚蚅蚥蚙蚡蚧蚕蚘蚎蚝蚐蚔衃衄衭衵衶衲袀衱衿衯袃衾衴衼訒豇豗豻貤貣赶赸趵趷趶軑軓迾迵适迿迻逄迼迶郖郠郙郚郣郟郥郘郛郗郜郤酐"
|
|
],
|
|
[
|
|
"d440",
|
|
"酎酏釕釢釚陜陟隼飣髟鬯乿偰偪偡偞偠偓偋偝偲偈偍偁偛偊偢倕偅偟偩偫偣偤偆偀偮偳偗偑凐剫剭剬剮勖勓匭厜啵啶唼啍啐唴唪啑啢唶唵唰啒啅"
|
|
],
|
|
[
|
|
"d4a1",
|
|
"唌唲啥啎唹啈唭唻啀啋圊圇埻堔埢埶埜埴堀埭埽堈埸堋埳埏堇埮埣埲埥埬埡堎埼堐埧堁堌埱埩埰堍堄奜婠婘婕婧婞娸娵婭婐婟婥婬婓婤婗婃婝婒婄婛婈媎娾婍娹婌婰婩婇婑婖婂婜孲孮寁寀屙崞崋崝崚崠崌崨崍崦崥崏"
|
|
],
|
|
[
|
|
"d540",
|
|
"崰崒崣崟崮帾帴庱庴庹庲庳弶弸徛徖徟悊悐悆悾悰悺惓惔惏惤惙惝惈悱惛悷惊悿惃惍惀挲捥掊掂捽掽掞掭掝掗掫掎捯掇掐据掯捵掜捭掮捼掤挻掟"
|
|
],
|
|
[
|
|
"d5a1",
|
|
"捸掅掁掑掍捰敓旍晥晡晛晙晜晢朘桹梇梐梜桭桮梮梫楖桯梣梬梩桵桴梲梏桷梒桼桫桲梪梀桱桾梛梖梋梠梉梤桸桻梑梌梊桽欶欳欷欸殑殏殍殎殌氪淀涫涴涳湴涬淩淢涷淶淔渀淈淠淟淖涾淥淜淝淛淴淊涽淭淰涺淕淂淏淉"
|
|
],
|
|
[
|
|
"d640",
|
|
"淐淲淓淽淗淍淣涻烺焍烷焗烴焌烰焄烳焐烼烿焆焓焀烸烶焋焂焎牾牻牼牿猝猗猇猑猘猊猈狿猏猞玈珶珸珵琄琁珽琇琀珺珼珿琌琋珴琈畤畣痎痒痏"
|
|
],
|
|
[
|
|
"d6a1",
|
|
"痋痌痑痐皏皉盓眹眯眭眱眲眴眳眽眥眻眵硈硒硉硍硊硌砦硅硐祤祧祩祪祣祫祡离秺秸秶秷窏窔窐笵筇笴笥笰笢笤笳笘笪笝笱笫笭笯笲笸笚笣粔粘粖粣紵紽紸紶紺絅紬紩絁絇紾紿絊紻紨罣羕羜羝羛翊翋翍翐翑翇翏翉耟"
|
|
],
|
|
[
|
|
"d740",
|
|
"耞耛聇聃聈脘脥脙脛脭脟脬脞脡脕脧脝脢舑舸舳舺舴舲艴莐莣莨莍荺荳莤荴莏莁莕莙荵莔莩荽莃莌莝莛莪莋荾莥莯莈莗莰荿莦莇莮荶莚虙虖蚿蚷"
|
|
],
|
|
[
|
|
"d7a1",
|
|
"蛂蛁蛅蚺蚰蛈蚹蚳蚸蛌蚴蚻蚼蛃蚽蚾衒袉袕袨袢袪袚袑袡袟袘袧袙袛袗袤袬袌袓袎覂觖觙觕訰訧訬訞谹谻豜豝豽貥赽赻赹趼跂趹趿跁軘軞軝軜軗軠軡逤逋逑逜逌逡郯郪郰郴郲郳郔郫郬郩酖酘酚酓酕釬釴釱釳釸釤釹釪"
|
|
],
|
|
[
|
|
"d840",
|
|
"釫釷釨釮镺閆閈陼陭陫陱陯隿靪頄飥馗傛傕傔傞傋傣傃傌傎傝偨傜傒傂傇兟凔匒匑厤厧喑喨喥喭啷噅喢喓喈喏喵喁喣喒喤啽喌喦啿喕喡喎圌堩堷"
|
|
],
|
|
[
|
|
"d8a1",
|
|
"堙堞堧堣堨埵塈堥堜堛堳堿堶堮堹堸堭堬堻奡媯媔媟婺媢媞婸媦婼媥媬媕媮娷媄媊媗媃媋媩婻婽媌媜媏媓媝寪寍寋寔寑寊寎尌尰崷嵃嵫嵁嵋崿崵嵑嵎嵕崳崺嵒崽崱嵙嵂崹嵉崸崼崲崶嵀嵅幄幁彘徦徥徫惉悹惌惢惎惄愔"
|
|
],
|
|
[
|
|
"d940",
|
|
"惲愊愖愅惵愓惸惼惾惁愃愘愝愐惿愄愋扊掔掱掰揎揥揨揯揃撝揳揊揠揶揕揲揵摡揟掾揝揜揄揘揓揂揇揌揋揈揰揗揙攲敧敪敤敜敨敥斌斝斞斮旐旒"
|
|
],
|
|
[
|
|
"d9a1",
|
|
"晼晬晻暀晱晹晪晲朁椌棓椄棜椪棬棪棱椏棖棷棫棤棶椓椐棳棡椇棌椈楰梴椑棯棆椔棸棐棽棼棨椋椊椗棎棈棝棞棦棴棑椆棔棩椕椥棇欹欻欿欼殔殗殙殕殽毰毲毳氰淼湆湇渟湉溈渼渽湅湢渫渿湁湝湳渜渳湋湀湑渻渃渮湞"
|
|
],
|
|
[
|
|
"da40",
|
|
"湨湜湡渱渨湠湱湫渹渢渰湓湥渧湸湤湷湕湹湒湦渵渶湚焠焞焯烻焮焱焣焥焢焲焟焨焺焛牋牚犈犉犆犅犋猒猋猰猢猱猳猧猲猭猦猣猵猌琮琬琰琫琖"
|
|
],
|
|
[
|
|
"daa1",
|
|
"琚琡琭琱琤琣琝琩琠琲瓻甯畯畬痧痚痡痦痝痟痤痗皕皒盚睆睇睄睍睅睊睎睋睌矞矬硠硤硥硜硭硱硪确硰硩硨硞硢祴祳祲祰稂稊稃稌稄窙竦竤筊笻筄筈筌筎筀筘筅粢粞粨粡絘絯絣絓絖絧絪絏絭絜絫絒絔絩絑絟絎缾缿罥"
|
|
],
|
|
[
|
|
"db40",
|
|
"罦羢羠羡翗聑聏聐胾胔腃腊腒腏腇脽腍脺臦臮臷臸臹舄舼舽舿艵茻菏菹萣菀菨萒菧菤菼菶萐菆菈菫菣莿萁菝菥菘菿菡菋菎菖菵菉萉萏菞萑萆菂菳"
|
|
],
|
|
[
|
|
"dba1",
|
|
"菕菺菇菑菪萓菃菬菮菄菻菗菢萛菛菾蛘蛢蛦蛓蛣蛚蛪蛝蛫蛜蛬蛩蛗蛨蛑衈衖衕袺裗袹袸裀袾袶袼袷袽袲褁裉覕覘覗觝觚觛詎詍訹詙詀詗詘詄詅詒詈詑詊詌詏豟貁貀貺貾貰貹貵趄趀趉跘跓跍跇跖跜跏跕跙跈跗跅軯軷軺"
|
|
],
|
|
[
|
|
"dc40",
|
|
"軹軦軮軥軵軧軨軶軫軱軬軴軩逭逴逯鄆鄬鄄郿郼鄈郹郻鄁鄀鄇鄅鄃酡酤酟酢酠鈁鈊鈥鈃鈚鈦鈏鈌鈀鈒釿釽鈆鈄鈧鈂鈜鈤鈙鈗鈅鈖镻閍閌閐隇陾隈"
|
|
],
|
|
[
|
|
"dca1",
|
|
"隉隃隀雂雈雃雱雰靬靰靮頇颩飫鳦黹亃亄亶傽傿僆傮僄僊傴僈僂傰僁傺傱僋僉傶傸凗剺剸剻剼嗃嗛嗌嗐嗋嗊嗝嗀嗔嗄嗩喿嗒喍嗏嗕嗢嗖嗈嗲嗍嗙嗂圔塓塨塤塏塍塉塯塕塎塝塙塥塛堽塣塱壼嫇嫄嫋媺媸媱媵媰媿嫈媻嫆"
|
|
],
|
|
[
|
|
"dd40",
|
|
"媷嫀嫊媴媶嫍媹媐寖寘寙尟尳嵱嵣嵊嵥嵲嵬嵞嵨嵧嵢巰幏幎幊幍幋廅廌廆廋廇彀徯徭惷慉慊愫慅愶愲愮慆愯慏愩慀戠酨戣戥戤揅揱揫搐搒搉搠搤"
|
|
],
|
|
[
|
|
"dda1",
|
|
"搳摃搟搕搘搹搷搢搣搌搦搰搨摁搵搯搊搚摀搥搧搋揧搛搮搡搎敯斒旓暆暌暕暐暋暊暙暔晸朠楦楟椸楎楢楱椿楅楪椹楂楗楙楺楈楉椵楬椳椽楥棰楸椴楩楀楯楄楶楘楁楴楌椻楋椷楜楏楑椲楒椯楻椼歆歅歃歂歈歁殛嗀毻毼"
|
|
],
|
|
[
|
|
"de40",
|
|
"毹毷毸溛滖滈溏滀溟溓溔溠溱溹滆滒溽滁溞滉溷溰滍溦滏溲溾滃滜滘溙溒溎溍溤溡溿溳滐滊溗溮溣煇煔煒煣煠煁煝煢煲煸煪煡煂煘煃煋煰煟煐煓"
|
|
],
|
|
[
|
|
"dea1",
|
|
"煄煍煚牏犍犌犑犐犎猼獂猻猺獀獊獉瑄瑊瑋瑒瑑瑗瑀瑏瑐瑎瑂瑆瑍瑔瓡瓿瓾瓽甝畹畷榃痯瘏瘃痷痾痼痹痸瘐痻痶痭痵痽皙皵盝睕睟睠睒睖睚睩睧睔睙睭矠碇碚碔碏碄碕碅碆碡碃硹碙碀碖硻祼禂祽祹稑稘稙稒稗稕稢稓"
|
|
],
|
|
[
|
|
"df40",
|
|
"稛稐窣窢窞竫筦筤筭筴筩筲筥筳筱筰筡筸筶筣粲粴粯綈綆綀綍絿綅絺綎絻綃絼綌綔綄絽綒罭罫罧罨罬羦羥羧翛翜耡腤腠腷腜腩腛腢腲朡腞腶腧腯"
|
|
],
|
|
[
|
|
"dfa1",
|
|
"腄腡舝艉艄艀艂艅蓱萿葖葶葹蒏蒍葥葑葀蒆葧萰葍葽葚葙葴葳葝蔇葞萷萺萴葺葃葸萲葅萩菙葋萯葂萭葟葰萹葎葌葒葯蓅蒎萻葇萶萳葨葾葄萫葠葔葮葐蜋蜄蛷蜌蛺蛖蛵蝍蛸蜎蜉蜁蛶蜍蜅裖裋裍裎裞裛裚裌裐覅覛觟觥觤"
|
|
],
|
|
[
|
|
"e040",
|
|
"觡觠觢觜触詶誆詿詡訿詷誂誄詵誃誁詴詺谼豋豊豥豤豦貆貄貅賌赨赩趑趌趎趏趍趓趔趐趒跰跠跬跱跮跐跩跣跢跧跲跫跴輆軿輁輀輅輇輈輂輋遒逿"
|
|
],
|
|
[
|
|
"e0a1",
|
|
"遄遉逽鄐鄍鄏鄑鄖鄔鄋鄎酮酯鉈鉒鈰鈺鉦鈳鉥鉞銃鈮鉊鉆鉭鉬鉏鉠鉧鉯鈶鉡鉰鈱鉔鉣鉐鉲鉎鉓鉌鉖鈲閟閜閞閛隒隓隑隗雎雺雽雸雵靳靷靸靲頏頍頎颬飶飹馯馲馰馵骭骫魛鳪鳭鳧麀黽僦僔僗僨僳僛僪僝僤僓僬僰僯僣僠"
|
|
],
|
|
[
|
|
"e140",
|
|
"凘劀劁勩勫匰厬嘧嘕嘌嘒嗼嘏嘜嘁嘓嘂嗺嘝嘄嗿嗹墉塼墐墘墆墁塿塴墋塺墇墑墎塶墂墈塻墔墏壾奫嫜嫮嫥嫕嫪嫚嫭嫫嫳嫢嫠嫛嫬嫞嫝嫙嫨嫟孷寠"
|
|
],
|
|
[
|
|
"e1a1",
|
|
"寣屣嶂嶀嵽嶆嵺嶁嵷嶊嶉嶈嵾嵼嶍嵹嵿幘幙幓廘廑廗廎廜廕廙廒廔彄彃彯徶愬愨慁慞慱慳慒慓慲慬憀慴慔慺慛慥愻慪慡慖戩戧戫搫摍摛摝摴摶摲摳摽摵摦撦摎撂摞摜摋摓摠摐摿搿摬摫摙摥摷敳斠暡暠暟朅朄朢榱榶槉"
|
|
],
|
|
[
|
|
"e240",
|
|
"榠槎榖榰榬榼榑榙榎榧榍榩榾榯榿槄榽榤槔榹槊榚槏榳榓榪榡榞槙榗榐槂榵榥槆歊歍歋殞殟殠毃毄毾滎滵滱漃漥滸漷滻漮漉潎漙漚漧漘漻漒滭漊"
|
|
],
|
|
[
|
|
"e2a1",
|
|
"漶潳滹滮漭潀漰漼漵滫漇漎潃漅滽滶漹漜滼漺漟漍漞漈漡熇熐熉熀熅熂熏煻熆熁熗牄牓犗犕犓獃獍獑獌瑢瑳瑱瑵瑲瑧瑮甀甂甃畽疐瘖瘈瘌瘕瘑瘊瘔皸瞁睼瞅瞂睮瞀睯睾瞃碲碪碴碭碨硾碫碞碥碠碬碢碤禘禊禋禖禕禔禓"
|
|
],
|
|
[
|
|
"e340",
|
|
"禗禈禒禐稫穊稰稯稨稦窨窫窬竮箈箜箊箑箐箖箍箌箛箎箅箘劄箙箤箂粻粿粼粺綧綷緂綣綪緁緀緅綝緎緄緆緋緌綯綹綖綼綟綦綮綩綡緉罳翢翣翥翞"
|
|
],
|
|
[
|
|
"e3a1",
|
|
"耤聝聜膉膆膃膇膍膌膋舕蒗蒤蒡蒟蒺蓎蓂蒬蒮蒫蒹蒴蓁蓍蒪蒚蒱蓐蒝蒧蒻蒢蒔蓇蓌蒛蒩蒯蒨蓖蒘蒶蓏蒠蓗蓔蓒蓛蒰蒑虡蜳蜣蜨蝫蝀蜮蜞蜡蜙蜛蝃蜬蝁蜾蝆蜠蜲蜪蜭蜼蜒蜺蜱蜵蝂蜦蜧蜸蜤蜚蜰蜑裷裧裱裲裺裾裮裼裶裻"
|
|
],
|
|
[
|
|
"e440",
|
|
"裰裬裫覝覡覟覞觩觫觨誫誙誋誒誏誖谽豨豩賕賏賗趖踉踂跿踍跽踊踃踇踆踅跾踀踄輐輑輎輍鄣鄜鄠鄢鄟鄝鄚鄤鄡鄛酺酲酹酳銥銤鉶銛鉺銠銔銪銍"
|
|
],
|
|
[
|
|
"e4a1",
|
|
"銦銚銫鉹銗鉿銣鋮銎銂銕銢鉽銈銡銊銆銌銙銧鉾銇銩銝銋鈭隞隡雿靘靽靺靾鞃鞀鞂靻鞄鞁靿韎韍頖颭颮餂餀餇馝馜駃馹馻馺駂馽駇骱髣髧鬾鬿魠魡魟鳱鳲鳵麧僿儃儰僸儆儇僶僾儋儌僽儊劋劌勱勯噈噂噌嘵噁噊噉噆噘"
|
|
],
|
|
[
|
|
"e540",
|
|
"噚噀嘳嘽嘬嘾嘸嘪嘺圚墫墝墱墠墣墯墬墥墡壿嫿嫴嫽嫷嫶嬃嫸嬂嫹嬁嬇嬅嬏屧嶙嶗嶟嶒嶢嶓嶕嶠嶜嶡嶚嶞幩幝幠幜緳廛廞廡彉徲憋憃慹憱憰憢憉"
|
|
],
|
|
[
|
|
"e5a1",
|
|
"憛憓憯憭憟憒憪憡憍慦憳戭摮摰撖撠撅撗撜撏撋撊撌撣撟摨撱撘敶敺敹敻斲斳暵暰暩暲暷暪暯樀樆樗槥槸樕槱槤樠槿槬槢樛樝槾樧槲槮樔槷槧橀樈槦槻樍槼槫樉樄樘樥樏槶樦樇槴樖歑殥殣殢殦氁氀毿氂潁漦潾澇濆澒"
|
|
],
|
|
[
|
|
"e640",
|
|
"澍澉澌潢潏澅潚澖潶潬澂潕潲潒潐潗澔澓潝漀潡潫潽潧澐潓澋潩潿澕潣潷潪潻熲熯熛熰熠熚熩熵熝熥熞熤熡熪熜熧熳犘犚獘獒獞獟獠獝獛獡獚獙"
|
|
],
|
|
[
|
|
"e6a1",
|
|
"獢璇璉璊璆璁瑽璅璈瑼瑹甈甇畾瘥瘞瘙瘝瘜瘣瘚瘨瘛皜皝皞皛瞍瞏瞉瞈磍碻磏磌磑磎磔磈磃磄磉禚禡禠禜禢禛歶稹窲窴窳箷篋箾箬篎箯箹篊箵糅糈糌糋緷緛緪緧緗緡縃緺緦緶緱緰緮緟罶羬羰羭翭翫翪翬翦翨聤聧膣膟"
|
|
],
|
|
[
|
|
"e740",
|
|
"膞膕膢膙膗舖艏艓艒艐艎艑蔤蔻蔏蔀蔩蔎蔉蔍蔟蔊蔧蔜蓻蔫蓺蔈蔌蓴蔪蓲蔕蓷蓫蓳蓼蔒蓪蓩蔖蓾蔨蔝蔮蔂蓽蔞蓶蔱蔦蓧蓨蓰蓯蓹蔘蔠蔰蔋蔙蔯虢"
|
|
],
|
|
[
|
|
"e7a1",
|
|
"蝖蝣蝤蝷蟡蝳蝘蝔蝛蝒蝡蝚蝑蝞蝭蝪蝐蝎蝟蝝蝯蝬蝺蝮蝜蝥蝏蝻蝵蝢蝧蝩衚褅褌褔褋褗褘褙褆褖褑褎褉覢覤覣觭觰觬諏諆誸諓諑諔諕誻諗誾諀諅諘諃誺誽諙谾豍貏賥賟賙賨賚賝賧趠趜趡趛踠踣踥踤踮踕踛踖踑踙踦踧"
|
|
],
|
|
[
|
|
"e840",
|
|
"踔踒踘踓踜踗踚輬輤輘輚輠輣輖輗遳遰遯遧遫鄯鄫鄩鄪鄲鄦鄮醅醆醊醁醂醄醀鋐鋃鋄鋀鋙銶鋏鋱鋟鋘鋩鋗鋝鋌鋯鋂鋨鋊鋈鋎鋦鋍鋕鋉鋠鋞鋧鋑鋓"
|
|
],
|
|
[
|
|
"e8a1",
|
|
"銵鋡鋆銴镼閬閫閮閰隤隢雓霅霈霂靚鞊鞎鞈韐韏頞頝頦頩頨頠頛頧颲餈飺餑餔餖餗餕駜駍駏駓駔駎駉駖駘駋駗駌骳髬髫髳髲髱魆魃魧魴魱魦魶魵魰魨魤魬鳼鳺鳽鳿鳷鴇鴀鳹鳻鴈鴅鴄麃黓鼏鼐儜儓儗儚儑凞匴叡噰噠噮"
|
|
],
|
|
[
|
|
"e940",
|
|
"噳噦噣噭噲噞噷圜圛壈墽壉墿墺壂墼壆嬗嬙嬛嬡嬔嬓嬐嬖嬨嬚嬠嬞寯嶬嶱嶩嶧嶵嶰嶮嶪嶨嶲嶭嶯嶴幧幨幦幯廩廧廦廨廥彋徼憝憨憖懅憴懆懁懌憺"
|
|
],
|
|
[
|
|
"e9a1",
|
|
"憿憸憌擗擖擐擏擉撽撉擃擛擳擙攳敿敼斢曈暾曀曊曋曏暽暻暺曌朣樴橦橉橧樲橨樾橝橭橶橛橑樨橚樻樿橁橪橤橐橏橔橯橩橠樼橞橖橕橍橎橆歕歔歖殧殪殫毈毇氄氃氆澭濋澣濇澼濎濈潞濄澽澞濊澨瀄澥澮澺澬澪濏澿澸"
|
|
],
|
|
[
|
|
"ea40",
|
|
"澢濉澫濍澯澲澰燅燂熿熸燖燀燁燋燔燊燇燏熽燘熼燆燚燛犝犞獩獦獧獬獥獫獪瑿璚璠璔璒璕璡甋疀瘯瘭瘱瘽瘳瘼瘵瘲瘰皻盦瞚瞝瞡瞜瞛瞢瞣瞕瞙"
|
|
],
|
|
[
|
|
"eaa1",
|
|
"瞗磝磩磥磪磞磣磛磡磢磭磟磠禤穄穈穇窶窸窵窱窷篞篣篧篝篕篥篚篨篹篔篪篢篜篫篘篟糒糔糗糐糑縒縡縗縌縟縠縓縎縜縕縚縢縋縏縖縍縔縥縤罃罻罼罺羱翯耪耩聬膱膦膮膹膵膫膰膬膴膲膷膧臲艕艖艗蕖蕅蕫蕍蕓蕡蕘"
|
|
],
|
|
[
|
|
"eb40",
|
|
"蕀蕆蕤蕁蕢蕄蕑蕇蕣蔾蕛蕱蕎蕮蕵蕕蕧蕠薌蕦蕝蕔蕥蕬虣虥虤螛螏螗螓螒螈螁螖螘蝹螇螣螅螐螑螝螄螔螜螚螉褞褦褰褭褮褧褱褢褩褣褯褬褟觱諠"
|
|
],
|
|
[
|
|
"eba1",
|
|
"諢諲諴諵諝謔諤諟諰諈諞諡諨諿諯諻貑貒貐賵賮賱賰賳赬赮趥趧踳踾踸蹀蹅踶踼踽蹁踰踿躽輶輮輵輲輹輷輴遶遹遻邆郺鄳鄵鄶醓醐醑醍醏錧錞錈錟錆錏鍺錸錼錛錣錒錁鍆錭錎錍鋋錝鋺錥錓鋹鋷錴錂錤鋿錩錹錵錪錔錌"
|
|
],
|
|
[
|
|
"ec40",
|
|
"錋鋾錉錀鋻錖閼闍閾閹閺閶閿閵閽隩雔霋霒霐鞙鞗鞔韰韸頵頯頲餤餟餧餩馞駮駬駥駤駰駣駪駩駧骹骿骴骻髶髺髹髷鬳鮀鮅鮇魼魾魻鮂鮓鮒鮐魺鮕"
|
|
],
|
|
[
|
|
"eca1",
|
|
"魽鮈鴥鴗鴠鴞鴔鴩鴝鴘鴢鴐鴙鴟麈麆麇麮麭黕黖黺鼒鼽儦儥儢儤儠儩勴嚓嚌嚍嚆嚄嚃噾嚂噿嚁壖壔壏壒嬭嬥嬲嬣嬬嬧嬦嬯嬮孻寱寲嶷幬幪徾徻懃憵憼懧懠懥懤懨懞擯擩擣擫擤擨斁斀斶旚曒檍檖檁檥檉檟檛檡檞檇檓檎"
|
|
],
|
|
[
|
|
"ed40",
|
|
"檕檃檨檤檑橿檦檚檅檌檒歛殭氉濌澩濴濔濣濜濭濧濦濞濲濝濢濨燡燱燨燲燤燰燢獳獮獯璗璲璫璐璪璭璱璥璯甐甑甒甏疄癃癈癉癇皤盩瞵瞫瞲瞷瞶"
|
|
],
|
|
[
|
|
"eda1",
|
|
"瞴瞱瞨矰磳磽礂磻磼磲礅磹磾礄禫禨穜穛穖穘穔穚窾竀竁簅簏篲簀篿篻簎篴簋篳簂簉簃簁篸篽簆篰篱簐簊糨縭縼繂縳顈縸縪繉繀繇縩繌縰縻縶繄縺罅罿罾罽翴翲耬膻臄臌臊臅臇膼臩艛艚艜薃薀薏薧薕薠薋薣蕻薤薚薞"
|
|
],
|
|
[
|
|
"ee40",
|
|
"蕷蕼薉薡蕺蕸蕗薎薖薆薍薙薝薁薢薂薈薅蕹蕶薘薐薟虨螾螪螭蟅螰螬螹螵螼螮蟉蟃蟂蟌螷螯蟄蟊螴螶螿螸螽蟞螲褵褳褼褾襁襒褷襂覭覯覮觲觳謞"
|
|
],
|
|
[
|
|
"eea1",
|
|
"謘謖謑謅謋謢謏謒謕謇謍謈謆謜謓謚豏豰豲豱豯貕貔賹赯蹎蹍蹓蹐蹌蹇轃轀邅遾鄸醚醢醛醙醟醡醝醠鎡鎃鎯鍤鍖鍇鍼鍘鍜鍶鍉鍐鍑鍠鍭鎏鍌鍪鍹鍗鍕鍒鍏鍱鍷鍻鍡鍞鍣鍧鎀鍎鍙闇闀闉闃闅閷隮隰隬霠霟霘霝霙鞚鞡鞜"
|
|
],
|
|
[
|
|
"ef40",
|
|
"鞞鞝韕韔韱顁顄顊顉顅顃餥餫餬餪餳餲餯餭餱餰馘馣馡騂駺駴駷駹駸駶駻駽駾駼騃骾髾髽鬁髼魈鮚鮨鮞鮛鮦鮡鮥鮤鮆鮢鮠鮯鴳鵁鵧鴶鴮鴯鴱鴸鴰"
|
|
],
|
|
[
|
|
"efa1",
|
|
"鵅鵂鵃鴾鴷鵀鴽翵鴭麊麉麍麰黈黚黻黿鼤鼣鼢齔龠儱儭儮嚘嚜嚗嚚嚝嚙奰嬼屩屪巀幭幮懘懟懭懮懱懪懰懫懖懩擿攄擽擸攁攃擼斔旛曚曛曘櫅檹檽櫡櫆檺檶檷櫇檴檭歞毉氋瀇瀌瀍瀁瀅瀔瀎濿瀀濻瀦濼濷瀊爁燿燹爃燽獶"
|
|
],
|
|
[
|
|
"f040",
|
|
"璸瓀璵瓁璾璶璻瓂甔甓癜癤癙癐癓癗癚皦皽盬矂瞺磿礌礓礔礉礐礒礑禭禬穟簜簩簙簠簟簭簝簦簨簢簥簰繜繐繖繣繘繢繟繑繠繗繓羵羳翷翸聵臑臒"
|
|
],
|
|
[
|
|
"f0a1",
|
|
"臐艟艞薴藆藀藃藂薳薵薽藇藄薿藋藎藈藅薱薶藒蘤薸薷薾虩蟧蟦蟢蟛蟫蟪蟥蟟蟳蟤蟔蟜蟓蟭蟘蟣螤蟗蟙蠁蟴蟨蟝襓襋襏襌襆襐襑襉謪謧謣謳謰謵譇謯謼謾謱謥謷謦謶謮謤謻謽謺豂豵貙貘貗賾贄贂贀蹜蹢蹠蹗蹖蹞蹥蹧"
|
|
],
|
|
[
|
|
"f140",
|
|
"蹛蹚蹡蹝蹩蹔轆轇轈轋鄨鄺鄻鄾醨醥醧醯醪鎵鎌鎒鎷鎛鎝鎉鎧鎎鎪鎞鎦鎕鎈鎙鎟鎍鎱鎑鎲鎤鎨鎴鎣鎥闒闓闑隳雗雚巂雟雘雝霣霢霥鞬鞮鞨鞫鞤鞪"
|
|
],
|
|
[
|
|
"f1a1",
|
|
"鞢鞥韗韙韖韘韺顐顑顒颸饁餼餺騏騋騉騍騄騑騊騅騇騆髀髜鬈鬄鬅鬩鬵魊魌魋鯇鯆鯃鮿鯁鮵鮸鯓鮶鯄鮹鮽鵜鵓鵏鵊鵛鵋鵙鵖鵌鵗鵒鵔鵟鵘鵚麎麌黟鼁鼀鼖鼥鼫鼪鼩鼨齌齕儴儵劖勷厴嚫嚭嚦嚧嚪嚬壚壝壛夒嬽嬾嬿巃幰"
|
|
],
|
|
[
|
|
"f240",
|
|
"徿懻攇攐攍攉攌攎斄旞旝曞櫧櫠櫌櫑櫙櫋櫟櫜櫐櫫櫏櫍櫞歠殰氌瀙瀧瀠瀖瀫瀡瀢瀣瀩瀗瀤瀜瀪爌爊爇爂爅犥犦犤犣犡瓋瓅璷瓃甖癠矉矊矄矱礝礛"
|
|
],
|
|
[
|
|
"f2a1",
|
|
"礡礜礗礞禰穧穨簳簼簹簬簻糬糪繶繵繸繰繷繯繺繲繴繨罋罊羃羆羷翽翾聸臗臕艤艡艣藫藱藭藙藡藨藚藗藬藲藸藘藟藣藜藑藰藦藯藞藢蠀蟺蠃蟶蟷蠉蠌蠋蠆蟼蠈蟿蠊蠂襢襚襛襗襡襜襘襝襙覈覷覶觶譐譈譊譀譓譖譔譋譕"
|
|
],
|
|
[
|
|
"f340",
|
|
"譑譂譒譗豃豷豶貚贆贇贉趬趪趭趫蹭蹸蹳蹪蹯蹻軂轒轑轏轐轓辴酀鄿醰醭鏞鏇鏏鏂鏚鏐鏹鏬鏌鏙鎩鏦鏊鏔鏮鏣鏕鏄鏎鏀鏒鏧镽闚闛雡霩霫霬霨霦"
|
|
],
|
|
[
|
|
"f3a1",
|
|
"鞳鞷鞶韝韞韟顜顙顝顗颿颽颻颾饈饇饃馦馧騚騕騥騝騤騛騢騠騧騣騞騜騔髂鬋鬊鬎鬌鬷鯪鯫鯠鯞鯤鯦鯢鯰鯔鯗鯬鯜鯙鯥鯕鯡鯚鵷鶁鶊鶄鶈鵱鶀鵸鶆鶋鶌鵽鵫鵴鵵鵰鵩鶅鵳鵻鶂鵯鵹鵿鶇鵨麔麑黀黼鼭齀齁齍齖齗齘匷嚲"
|
|
],
|
|
[
|
|
"f440",
|
|
"嚵嚳壣孅巆巇廮廯忀忁懹攗攖攕攓旟曨曣曤櫳櫰櫪櫨櫹櫱櫮櫯瀼瀵瀯瀷瀴瀱灂瀸瀿瀺瀹灀瀻瀳灁爓爔犨獽獼璺皫皪皾盭矌矎矏矍矲礥礣礧礨礤礩"
|
|
],
|
|
[
|
|
"f4a1",
|
|
"禲穮穬穭竷籉籈籊籇籅糮繻繾纁纀羺翿聹臛臙舋艨艩蘢藿蘁藾蘛蘀藶蘄蘉蘅蘌藽蠙蠐蠑蠗蠓蠖襣襦覹觷譠譪譝譨譣譥譧譭趮躆躈躄轙轖轗轕轘轚邍酃酁醷醵醲醳鐋鐓鏻鐠鐏鐔鏾鐕鐐鐨鐙鐍鏵鐀鏷鐇鐎鐖鐒鏺鐉鏸鐊鏿"
|
|
],
|
|
[
|
|
"f540",
|
|
"鏼鐌鏶鐑鐆闞闠闟霮霯鞹鞻韽韾顠顢顣顟飁飂饐饎饙饌饋饓騲騴騱騬騪騶騩騮騸騭髇髊髆鬐鬒鬑鰋鰈鯷鰅鰒鯸鱀鰇鰎鰆鰗鰔鰉鶟鶙鶤鶝鶒鶘鶐鶛"
|
|
],
|
|
[
|
|
"f5a1",
|
|
"鶠鶔鶜鶪鶗鶡鶚鶢鶨鶞鶣鶿鶩鶖鶦鶧麙麛麚黥黤黧黦鼰鼮齛齠齞齝齙龑儺儹劘劗囃嚽嚾孈孇巋巏廱懽攛欂櫼欃櫸欀灃灄灊灈灉灅灆爝爚爙獾甗癪矐礭礱礯籔籓糲纊纇纈纋纆纍罍羻耰臝蘘蘪蘦蘟蘣蘜蘙蘧蘮蘡蘠蘩蘞蘥"
|
|
],
|
|
[
|
|
"f640",
|
|
"蠩蠝蠛蠠蠤蠜蠫衊襭襩襮襫觺譹譸譅譺譻贐贔趯躎躌轞轛轝酆酄酅醹鐿鐻鐶鐩鐽鐼鐰鐹鐪鐷鐬鑀鐱闥闤闣霵霺鞿韡顤飉飆飀饘饖騹騽驆驄驂驁騺"
|
|
],
|
|
[
|
|
"f6a1",
|
|
"騿髍鬕鬗鬘鬖鬺魒鰫鰝鰜鰬鰣鰨鰩鰤鰡鶷鶶鶼鷁鷇鷊鷏鶾鷅鷃鶻鶵鷎鶹鶺鶬鷈鶱鶭鷌鶳鷍鶲鹺麜黫黮黭鼛鼘鼚鼱齎齥齤龒亹囆囅囋奱孋孌巕巑廲攡攠攦攢欋欈欉氍灕灖灗灒爞爟犩獿瓘瓕瓙瓗癭皭礵禴穰穱籗籜籙籛籚"
|
|
],
|
|
[
|
|
"f740",
|
|
"糴糱纑罏羇臞艫蘴蘵蘳蘬蘲蘶蠬蠨蠦蠪蠥襱覿覾觻譾讄讂讆讅譿贕躕躔躚躒躐躖躗轠轢酇鑌鑐鑊鑋鑏鑇鑅鑈鑉鑆霿韣顪顩飋饔饛驎驓驔驌驏驈驊"
|
|
],
|
|
[
|
|
"f7a1",
|
|
"驉驒驐髐鬙鬫鬻魖魕鱆鱈鰿鱄鰹鰳鱁鰼鰷鰴鰲鰽鰶鷛鷒鷞鷚鷋鷐鷜鷑鷟鷩鷙鷘鷖鷵鷕鷝麶黰鼵鼳鼲齂齫龕龢儽劙壨壧奲孍巘蠯彏戁戃戄攩攥斖曫欑欒欏毊灛灚爢玂玁玃癰矔籧籦纕艬蘺虀蘹蘼蘱蘻蘾蠰蠲蠮蠳襶襴襳觾"
|
|
],
|
|
[
|
|
"f840",
|
|
"讌讎讋讈豅贙躘轤轣醼鑢鑕鑝鑗鑞韄韅頀驖驙鬞鬟鬠鱒鱘鱐鱊鱍鱋鱕鱙鱌鱎鷻鷷鷯鷣鷫鷸鷤鷶鷡鷮鷦鷲鷰鷢鷬鷴鷳鷨鷭黂黐黲黳鼆鼜鼸鼷鼶齃齏"
|
|
],
|
|
[
|
|
"f8a1",
|
|
"齱齰齮齯囓囍孎屭攭曭曮欓灟灡灝灠爣瓛瓥矕礸禷禶籪纗羉艭虃蠸蠷蠵衋讔讕躞躟躠躝醾醽釂鑫鑨鑩雥靆靃靇韇韥驞髕魙鱣鱧鱦鱢鱞鱠鸂鷾鸇鸃鸆鸅鸀鸁鸉鷿鷽鸄麠鼞齆齴齵齶囔攮斸欘欙欗欚灢爦犪矘矙礹籩籫糶纚"
|
|
],
|
|
[
|
|
"f940",
|
|
"纘纛纙臠臡虆虇虈襹襺襼襻觿讘讙躥躤躣鑮鑭鑯鑱鑳靉顲饟鱨鱮鱭鸋鸍鸐鸏鸒鸑麡黵鼉齇齸齻齺齹圞灦籯蠼趲躦釃鑴鑸鑶鑵驠鱴鱳鱱鱵鸔鸓黶鼊"
|
|
],
|
|
[
|
|
"f9a1",
|
|
"龤灨灥糷虪蠾蠽蠿讞貜躩軉靋顳顴飌饡馫驤驦驧鬤鸕鸗齈戇欞爧虌躨钂钀钁驩驨鬮鸙爩虋讟钃鱹麷癵驫鱺鸝灩灪麤齾齉龘碁銹裏墻恒粧嫺╔╦╗╠╬╣╚╩╝╒╤╕╞╪╡╘╧╛╓╥╖╟╫╢╙╨╜║═╭╮╰╯▓"
|
|
]
|
|
];
|
|
|
|
/***/ },
|
|
/* 102 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = [
|
|
[
|
|
"8740",
|
|
"䏰䰲䘃䖦䕸𧉧䵷䖳𧲱䳢𧳅㮕䜶䝄䱇䱀𤊿𣘗𧍒𦺋𧃒䱗𪍑䝏䗚䲅𧱬䴇䪤䚡𦬣爥𥩔𡩣𣸆𣽡晍囻"
|
|
],
|
|
[
|
|
"8767",
|
|
"綕夝𨮹㷴霴𧯯寛𡵞媤㘥𩺰嫑宷峼杮薓𩥅瑡璝㡵𡵓𣚞𦀡㻬"
|
|
],
|
|
[
|
|
"87a1",
|
|
"𥣞㫵竼龗𤅡𨤍𣇪𠪊𣉞䌊蒄龖鐯䤰蘓墖靊鈘秐稲晠権袝瑌篅枂稬剏遆㓦珄𥶹瓆鿇垳䤯呌䄱𣚎堘穲𧭥讏䚮𦺈䆁𥶙箮𢒼鿈𢓁𢓉𢓌鿉蔄𣖻䂴鿊䓡𪷿拁灮鿋"
|
|
],
|
|
[
|
|
"8840",
|
|
"㇀",
|
|
4,
|
|
"𠄌㇅𠃑𠃍㇆㇇𠃋𡿨㇈𠃊㇉㇊㇋㇌𠄎㇍㇎ĀÁǍÀĒÉĚÈŌÓǑÒÊ̄ẾÊ̌ỀÊāáǎàɑēéěèīíǐìōóǒòūúǔùǖǘǚ"
|
|
],
|
|
[
|
|
"88a1",
|
|
"ǜüê̄ếê̌ềêɡ⏚⏛"
|
|
],
|
|
[
|
|
"8940",
|
|
"𪎩𡅅"
|
|
],
|
|
[
|
|
"8943",
|
|
"攊"
|
|
],
|
|
[
|
|
"8946",
|
|
"丽滝鵎釟"
|
|
],
|
|
[
|
|
"894c",
|
|
"𧜵撑会伨侨兖兴农凤务动医华发变团声处备夲头学实実岚庆总斉柾栄桥济炼电纤纬纺织经统缆缷艺苏药视设询车轧轮"
|
|
],
|
|
[
|
|
"89a1",
|
|
"琑糼緍楆竉刧"
|
|
],
|
|
[
|
|
"89ab",
|
|
"醌碸酞肼"
|
|
],
|
|
[
|
|
"89b0",
|
|
"贋胶𠧧"
|
|
],
|
|
[
|
|
"89b5",
|
|
"肟黇䳍鷉鸌䰾𩷶𧀎鸊𪄳㗁"
|
|
],
|
|
[
|
|
"89c1",
|
|
"溚舾甙"
|
|
],
|
|
[
|
|
"89c5",
|
|
"䤑马骏龙禇𨑬𡷊𠗐𢫦两亁亀亇亿仫伷㑌侽㹈倃傈㑽㒓㒥円夅凛凼刅争剹劐匧㗇厩㕑厰㕓参吣㕭㕲㚁咓咣咴咹哐哯唘唣唨㖘唿㖥㖿嗗㗅"
|
|
],
|
|
[
|
|
"8a40",
|
|
"𧶄唥"
|
|
],
|
|
[
|
|
"8a43",
|
|
"𠱂𠴕𥄫喐𢳆㧬𠍁蹆𤶸𩓥䁓𨂾睺𢰸㨴䟕𨅝𦧲𤷪擝𠵼𠾴𠳕𡃴撍蹾𠺖𠰋𠽤𢲩𨉖𤓓"
|
|
],
|
|
[
|
|
"8a64",
|
|
"𠵆𩩍𨃩䟴𤺧𢳂骲㩧𩗴㿭㔆𥋇𩟔𧣈𢵄鵮頕"
|
|
],
|
|
[
|
|
"8a76",
|
|
"䏙𦂥撴哣𢵌𢯊𡁷㧻𡁯"
|
|
],
|
|
[
|
|
"8aa1",
|
|
"𦛚𦜖𧦠擪𥁒𠱃蹨𢆡𨭌𠜱"
|
|
],
|
|
[
|
|
"8aac",
|
|
"䠋𠆩㿺塳𢶍"
|
|
],
|
|
[
|
|
"8ab2",
|
|
"𤗈𠓼𦂗𠽌𠶖啹䂻䎺"
|
|
],
|
|
[
|
|
"8abb",
|
|
"䪴𢩦𡂝膪飵𠶜捹㧾𢝵跀嚡摼㹃"
|
|
],
|
|
[
|
|
"8ac9",
|
|
"𪘁𠸉𢫏𢳉"
|
|
],
|
|
[
|
|
"8ace",
|
|
"𡃈𣧂㦒㨆𨊛㕸𥹉𢃇噒𠼱𢲲𩜠㒼氽𤸻"
|
|
],
|
|
[
|
|
"8adf",
|
|
"𧕴𢺋𢈈𪙛𨳍𠹺𠰴𦠜羓𡃏𢠃𢤹㗻𥇣𠺌𠾍𠺪㾓𠼰𠵇𡅏𠹌"
|
|
],
|
|
[
|
|
"8af6",
|
|
"𠺫𠮩𠵈𡃀𡄽㿹𢚖搲𠾭"
|
|
],
|
|
[
|
|
"8b40",
|
|
"𣏴𧘹𢯎𠵾𠵿𢱑𢱕㨘𠺘𡃇𠼮𪘲𦭐𨳒𨶙𨳊閪哌苄喹"
|
|
],
|
|
[
|
|
"8b55",
|
|
"𩻃鰦骶𧝞𢷮煀腭胬尜𦕲脴㞗卟𨂽醶𠻺𠸏𠹷𠻻㗝𤷫㘉𠳖嚯𢞵𡃉𠸐𠹸𡁸𡅈𨈇𡑕𠹹𤹐𢶤婔𡀝𡀞𡃵𡃶垜𠸑"
|
|
],
|
|
[
|
|
"8ba1",
|
|
"𧚔𨋍𠾵𠹻𥅾㜃𠾶𡆀𥋘𪊽𤧚𡠺𤅷𨉼墙剨㘚𥜽箲孨䠀䬬鼧䧧鰟鮍𥭴𣄽嗻㗲嚉丨夂𡯁屮靑𠂆乛亻㔾尣彑忄㣺扌攵歺氵氺灬爫丬犭𤣩罒礻糹罓𦉪㓁"
|
|
],
|
|
[
|
|
"8bde",
|
|
"𦍋耂肀𦘒𦥑卝衤见𧢲讠贝钅镸长门𨸏韦页风飞饣𩠐鱼鸟黄歯龜丷𠂇阝户钢"
|
|
],
|
|
[
|
|
"8c40",
|
|
"倻淾𩱳龦㷉袏𤅎灷峵䬠𥇍㕙𥴰愢𨨲辧釶熑朙玺𣊁𪄇㲋𡦀䬐磤琂冮𨜏䀉橣𪊺䈣蘏𠩯稪𩥇𨫪靕灍匤𢁾鏴盙𨧣龧矝亣俰傼丯众龨吴綋墒壐𡶶庒庙忂𢜒斋"
|
|
],
|
|
[
|
|
"8ca1",
|
|
"𣏹椙橃𣱣泿"
|
|
],
|
|
[
|
|
"8ca7",
|
|
"爀𤔅玌㻛𤨓嬕璹讃𥲤𥚕窓篬糃繬苸薗龩袐龪躹龫迏蕟駠鈡龬𨶹𡐿䁱䊢娚"
|
|
],
|
|
[
|
|
"8cc9",
|
|
"顨杫䉶圽"
|
|
],
|
|
[
|
|
"8cce",
|
|
"藖𤥻芿𧄍䲁𦵴嵻𦬕𦾾龭龮宖龯曧繛湗秊㶈䓃𣉖𢞖䎚䔶"
|
|
],
|
|
[
|
|
"8ce6",
|
|
"峕𣬚諹屸㴒𣕑嵸龲煗䕘𤃬𡸣䱷㥸㑊𠆤𦱁諌侴𠈹妿腬顖𩣺弻"
|
|
],
|
|
[
|
|
"8d40",
|
|
"𠮟"
|
|
],
|
|
[
|
|
"8d42",
|
|
"𢇁𨥭䄂䚻𩁹㼇龳𪆵䃸㟖䛷𦱆䅼𨚲𧏿䕭㣔𥒚䕡䔛䶉䱻䵶䗪㿈𤬏㙡䓞䒽䇭崾嵈嵖㷼㠏嶤嶹㠠㠸幂庽弥徃㤈㤔㤿㥍惗愽峥㦉憷憹懏㦸戬抐拥挘㧸嚱"
|
|
],
|
|
[
|
|
"8da1",
|
|
"㨃揢揻搇摚㩋擀崕嘡龟㪗斆㪽旿晓㫲暒㬢朖㭂枤栀㭘桊梄㭲㭱㭻椉楃牜楤榟榅㮼槖㯝橥橴橱檂㯬檙㯲檫檵櫔櫶殁毁毪汵沪㳋洂洆洦涁㳯涤涱渕渘温溆𨧀溻滢滚齿滨滩漤漴㵆𣽁澁澾㵪㵵熷岙㶊瀬㶑灐灔灯灿炉𠌥䏁㗱𠻘"
|
|
],
|
|
[
|
|
"8e40",
|
|
"𣻗垾𦻓焾𥟠㙎榢𨯩孴穉𥣡𩓙穥穽𥦬窻窰竂竃燑𦒍䇊竚竝竪䇯咲𥰁笋筕笩𥌎𥳾箢筯莜𥮴𦱿篐萡箒箸𥴠㶭𥱥蒒篺簆簵𥳁籄粃𤢂粦晽𤕸糉糇糦籴糳糵糎"
|
|
],
|
|
[
|
|
"8ea1",
|
|
"繧䔝𦹄絝𦻖璍綉綫焵綳緒𤁗𦀩緤㴓緵𡟹緥𨍭縝𦄡𦅚繮纒䌫鑬縧罀罁罇礶𦋐駡羗𦍑羣𡙡𠁨䕜𣝦䔃𨌺翺𦒉者耈耝耨耯𪂇𦳃耻耼聡𢜔䦉𦘦𣷣𦛨朥肧𨩈脇脚墰𢛶汿𦒘𤾸擧𡒊舘𡡞橓𤩥𤪕䑺舩𠬍𦩒𣵾俹𡓽蓢荢𦬊𤦧𣔰𡝳𣷸芪椛芳䇛"
|
|
],
|
|
[
|
|
"8f40",
|
|
"蕋苐茚𠸖𡞴㛁𣅽𣕚艻苢茘𣺋𦶣𦬅𦮗𣗎㶿茝嗬莅䔋𦶥莬菁菓㑾𦻔橗蕚㒖𦹂𢻯葘𥯤葱㷓䓤檧葊𣲵祘蒨𦮖𦹷𦹃蓞萏莑䒠蒓蓤𥲑䉀𥳀䕃蔴嫲𦺙䔧蕳䔖枿蘖"
|
|
],
|
|
[
|
|
"8fa1",
|
|
"𨘥𨘻藁𧂈蘂𡖂𧃍䕫䕪蘨㙈𡢢号𧎚虾蝱𪃸蟮𢰧螱蟚蠏噡虬桖䘏衅衆𧗠𣶹𧗤衞袜䙛袴袵揁装睷𧜏覇覊覦覩覧覼𨨥觧𧤤𧪽誜瞓釾誐𧩙竩𧬺𣾏䜓𧬸煼謌謟𥐰𥕥謿譌譍誩𤩺讐讛誯𡛟䘕衏貛𧵔𧶏貫㜥𧵓賖𧶘𧶽贒贃𡤐賛灜贑𤳉㻐起"
|
|
],
|
|
[
|
|
"9040",
|
|
"趩𨀂𡀔𤦊㭼𨆼𧄌竧躭躶軃鋔輙輭𨍥𨐒辥錃𪊟𠩐辳䤪𨧞𨔽𣶻廸𣉢迹𪀔𨚼𨔁𢌥㦀𦻗逷𨔼𧪾遡𨕬𨘋邨𨜓郄𨛦邮都酧㫰醩釄粬𨤳𡺉鈎沟鉁鉢𥖹銹𨫆𣲛𨬌𥗛"
|
|
],
|
|
[
|
|
"90a1",
|
|
"𠴱錬鍫𨫡𨯫炏嫃𨫢𨫥䥥鉄𨯬𨰹𨯿鍳鑛躼閅閦鐦閠濶䊹𢙺𨛘𡉼𣸮䧟氜陻隖䅬隣𦻕懚隶磵𨫠隽双䦡𦲸𠉴𦐐𩂯𩃥𤫑𡤕𣌊霱虂霶䨏䔽䖅𤫩灵孁霛靜𩇕靗孊𩇫靟鐥僐𣂷𣂼鞉鞟鞱鞾韀韒韠𥑬韮琜𩐳響韵𩐝𧥺䫑頴頳顋顦㬎𧅵㵑𠘰𤅜"
|
|
],
|
|
[
|
|
"9140",
|
|
"𥜆飊颷飈飇䫿𦴧𡛓喰飡飦飬鍸餹𤨩䭲𩡗𩤅駵騌騻騐驘𥜥㛄𩂱𩯕髠髢𩬅髴䰎鬔鬭𨘀倴鬴𦦨㣃𣁽魐魀𩴾婅𡡣鮎𤉋鰂鯿鰌𩹨鷔𩾷𪆒𪆫𪃡𪄣𪇟鵾鶃𪄴鸎梈"
|
|
],
|
|
[
|
|
"91a1",
|
|
"鷄𢅛𪆓𪈠𡤻𪈳鴹𪂹𪊴麐麕麞麢䴴麪麯𤍤黁㭠㧥㴝伲㞾𨰫鼂鼈䮖鐤𦶢鼗鼖鼹嚟嚊齅馸𩂋韲葿齢齩竜龎爖䮾𤥵𤦻煷𤧸𤍈𤩑玞𨯚𡣺禟𨥾𨸶鍩鏳𨩄鋬鎁鏋𨥬𤒹爗㻫睲穃烐𤑳𤏸煾𡟯炣𡢾𣖙㻇𡢅𥐯𡟸㜢𡛻𡠹㛡𡝴𡣑𥽋㜣𡛀坛𤨥𡏾𡊨"
|
|
],
|
|
[
|
|
"9240",
|
|
"𡏆𡒶蔃𣚦蔃葕𤦔𧅥𣸱𥕜𣻻𧁒䓴𣛮𩦝𦼦柹㜳㰕㷧塬𡤢栐䁗𣜿𤃡𤂋𤄏𦰡哋嚞𦚱嚒𠿟𠮨𠸍鏆𨬓鎜仸儫㠙𤐶亼𠑥𠍿佋侊𥙑婨𠆫𠏋㦙𠌊𠐔㐵伩𠋀𨺳𠉵諚𠈌亘"
|
|
],
|
|
[
|
|
"92a1",
|
|
"働儍侢伃𤨎𣺊佂倮偬傁俌俥偘僼兙兛兝兞湶𣖕𣸹𣺿浲𡢄𣺉冨凃𠗠䓝𠒣𠒒𠒑赺𨪜𠜎剙劤𠡳勡鍮䙺熌𤎌𠰠𤦬𡃤槑𠸝瑹㻞璙琔瑖玘䮎𤪼𤂍叐㖄爏𤃉喴𠍅响𠯆圝鉝雴鍦埝垍坿㘾壋媙𨩆𡛺𡝯𡜐娬妸銏婾嫏娒𥥆𡧳𡡡𤊕㛵洅瑃娡𥺃"
|
|
],
|
|
[
|
|
"9340",
|
|
"媁𨯗𠐓鏠璌𡌃焅䥲鐈𨧻鎽㞠尞岞幞幈𡦖𡥼𣫮廍孏𡤃𡤄㜁𡢠㛝𡛾㛓脪𨩇𡶺𣑲𨦨弌弎𡤧𡞫婫𡜻孄蘔𧗽衠恾𢡠𢘫忛㺸𢖯𢖾𩂈𦽳懀𠀾𠁆𢘛憙憘恵𢲛𢴇𤛔𩅍"
|
|
],
|
|
[
|
|
"93a1",
|
|
"摱𤙥𢭪㨩𢬢𣑐𩣪𢹸挷𪑛撶挱揑𤧣𢵧护𢲡搻敫楲㯴𣂎𣊭𤦉𣊫唍𣋠𡣙𩐿曎𣊉𣆳㫠䆐𥖄𨬢𥖏𡛼𥕛𥐥磮𣄃𡠪𣈴㑤𣈏𣆂𤋉暎𦴤晫䮓昰𧡰𡷫晣𣋒𣋡昞𥡲㣑𣠺𣞼㮙𣞢𣏾瓐㮖枏𤘪梶栞㯄檾㡣𣟕𤒇樳橒櫉欅𡤒攑梘橌㯗橺歗𣿀𣲚鎠鋲𨯪𨫋"
|
|
],
|
|
[
|
|
"9440",
|
|
"銉𨀞𨧜鑧涥漋𤧬浧𣽿㶏渄𤀼娽渊塇洤硂焻𤌚𤉶烱牐犇犔𤞏𤜥兹𤪤𠗫瑺𣻸𣙟𤩊𤤗𥿡㼆㺱𤫟𨰣𣼵悧㻳瓌琼鎇琷䒟𦷪䕑疃㽣𤳙𤴆㽘畕癳𪗆㬙瑨𨫌𤦫𤦎㫻"
|
|
],
|
|
[
|
|
"94a1",
|
|
"㷍𤩎㻿𤧅𤣳釺圲鍂𨫣𡡤僟𥈡𥇧睸𣈲眎眏睻𤚗𣞁㩞𤣰琸璛㺿𤪺𤫇䃈𤪖𦆮錇𥖁砞碍碈磒珐祙𧝁𥛣䄎禛蒖禥樭𣻺稺秴䅮𡛦䄲鈵秱𠵌𤦌𠊙𣶺𡝮㖗啫㕰㚪𠇔𠰍竢婙𢛵𥪯𥪜娍𠉛磰娪𥯆竾䇹籝籭䈑𥮳𥺼𥺦糍𤧹𡞰粎籼粮檲緜縇緓罎𦉡"
|
|
],
|
|
[
|
|
"9540",
|
|
"𦅜𧭈綗𥺂䉪𦭵𠤖柖𠁎𣗏埄𦐒𦏸𤥢翝笧𠠬𥫩𥵃笌𥸎駦虅驣樜𣐿㧢𤧷𦖭騟𦖠蒀𧄧𦳑䓪脷䐂胆脉腂𦞴飃𦩂艢艥𦩑葓𦶧蘐𧈛媆䅿𡡀嬫𡢡嫤𡣘蚠蜨𣶏蠭𧐢娂"
|
|
],
|
|
[
|
|
"95a1",
|
|
"衮佅袇袿裦襥襍𥚃襔𧞅𧞄𨯵𨯙𨮜𨧹㺭蒣䛵䛏㟲訽訜𩑈彍鈫𤊄旔焩烄𡡅鵭貟賩𧷜妚矃姰䍮㛔踪躧𤰉輰轊䋴汘澻𢌡䢛潹溋𡟚鯩㚵𤤯邻邗啱䤆醻鐄𨩋䁢𨫼鐧𨰝𨰻蓥訫閙閧閗閖𨴴瑅㻂𤣿𤩂𤏪㻧𣈥随𨻧𨹦𨹥㻌𤧭𤩸𣿮琒瑫㻼靁𩂰"
|
|
],
|
|
[
|
|
"9640",
|
|
"桇䨝𩂓𥟟靝鍨𨦉𨰦𨬯𦎾銺嬑譩䤼珹𤈛鞛靱餸𠼦巁𨯅𤪲頟𩓚鋶𩗗釥䓀𨭐𤩧𨭤飜𨩅㼀鈪䤥萔餻饍𧬆㷽馛䭯馪驜𨭥𥣈檏騡嫾騯𩣱䮐𩥈馼䮽䮗鍽塲𡌂堢𤦸"
|
|
],
|
|
[
|
|
"96a1",
|
|
"𡓨硄𢜟𣶸棅㵽鑘㤧慐𢞁𢥫愇鱏鱓鱻鰵鰐魿鯏𩸭鮟𪇵𪃾鴡䲮𤄄鸘䲰鴌𪆴𪃭𪃳𩤯鶥蒽𦸒𦿟𦮂藼䔳𦶤𦺄𦷰萠藮𦸀𣟗𦁤秢𣖜𣙀䤭𤧞㵢鏛銾鍈𠊿碹鉷鑍俤㑀遤𥕝砽硔碶硋𡝗𣇉𤥁㚚佲濚濙瀞瀞吔𤆵垻壳垊鴖埗焴㒯𤆬燫𦱀𤾗嬨𡞵𨩉"
|
|
],
|
|
[
|
|
"9740",
|
|
"愌嫎娋䊼𤒈㜬䭻𨧼鎻鎸𡣖𠼝葲𦳀𡐓𤋺𢰦𤏁妔𣶷𦝁綨𦅛𦂤𤦹𤦋𨧺鋥珢㻩璴𨭣𡢟㻡𤪳櫘珳珻㻖𤨾𤪔𡟙𤩦𠎧𡐤𤧥瑈𤤖炥𤥶銄珦鍟𠓾錱𨫎𨨖鎆𨯧𥗕䤵𨪂煫"
|
|
],
|
|
[
|
|
"97a1",
|
|
"𤥃𠳿嚤𠘚𠯫𠲸唂秄𡟺緾𡛂𤩐𡡒䔮鐁㜊𨫀𤦭妰𡢿𡢃𧒄媡㛢𣵛㚰鉟婹𨪁𡡢鍴㳍𠪴䪖㦊僴㵩㵌𡎜煵䋻𨈘渏𩃤䓫浗𧹏灧沯㳖𣿭𣸭渂漌㵯𠏵畑㚼㓈䚀㻚䡱姄鉮䤾轁𨰜𦯀堒埈㛖𡑒烾𤍢𤩱𢿣𡊰𢎽梹楧𡎘𣓥𧯴𣛟𨪃𣟖𣏺𤲟樚𣚭𦲷萾䓟䓎"
|
|
],
|
|
[
|
|
"9840",
|
|
"𦴦𦵑𦲂𦿞漗𧄉茽𡜺菭𦲀𧁓𡟛妉媂𡞳婡婱𡤅𤇼㜭姯𡜼㛇熎鎐暚𤊥婮娫𤊓樫𣻹𧜶𤑛𤋊焝𤉙𨧡侰𦴨峂𤓎𧹍𤎽樌𤉖𡌄炦焳𤏩㶥泟勇𤩏繥姫崯㷳彜𤩝𡟟綤萦"
|
|
],
|
|
[
|
|
"98a1",
|
|
"咅𣫺𣌀𠈔坾𠣕𠘙㿥𡾞𪊶瀃𩅛嵰玏糓𨩙𩐠俈翧狍猐𧫴猸猹𥛶獁獈㺩𧬘遬燵𤣲珡臶㻊県㻑沢国琙琞琟㻢㻰㻴㻺瓓㼎㽓畂畭畲疍㽼痈痜㿀癍㿗癴㿜発𤽜熈嘣覀塩䀝睃䀹条䁅㗛瞘䁪䁯属瞾矋売砘点砜䂨砹硇硑硦葈𥔵礳栃礲䄃"
|
|
],
|
|
[
|
|
"9940",
|
|
"䄉禑禙辻稆込䅧窑䆲窼艹䇄竏竛䇏両筢筬筻簒簛䉠䉺类粜䊌粸䊔糭输烀𠳏総緔緐緽羮羴犟䎗耠耥笹耮耱联㷌垴炠肷胩䏭脌猪脎脒畠脔䐁㬹腖腙腚"
|
|
],
|
|
[
|
|
"99a1",
|
|
"䐓堺腼膄䐥膓䐭膥埯臁臤艔䒏芦艶苊苘苿䒰荗险榊萅烵葤惣蒈䔄蒾蓡蓸蔐蔸蕒䔻蕯蕰藠䕷虲蚒蚲蛯际螋䘆䘗袮裿褤襇覑𧥧訩訸誔誴豑賔賲贜䞘塟跃䟭仮踺嗘坔蹱嗵躰䠷軎転軤軭軲辷迁迊迌逳駄䢭飠鈓䤞鈨鉘鉫銱銮銿"
|
|
],
|
|
[
|
|
"9a40",
|
|
"鋣鋫鋳鋴鋽鍃鎄鎭䥅䥑麿鐗匁鐝鐭鐾䥪鑔鑹锭関䦧间阳䧥枠䨤靀䨵鞲韂噔䫤惨颹䬙飱塄餎餙冴餜餷饂饝饢䭰駅䮝騼鬏窃魩鮁鯝鯱鯴䱭鰠㝯𡯂鵉鰺"
|
|
],
|
|
[
|
|
"9aa1",
|
|
"黾噐鶓鶽鷀鷼银辶鹻麬麱麽黆铜黢黱黸竈齄𠂔𠊷𠎠椚铃妬𠓗塀铁㞹𠗕𠘕𠙶𡚺块煳𠫂𠫍𠮿呪吆𠯋咞𠯻𠰻𠱓𠱥𠱼惧𠲍噺𠲵𠳝𠳭𠵯𠶲𠷈楕鰯螥𠸄𠸎𠻗𠾐𠼭𠹳尠𠾼帋𡁜𡁏𡁶朞𡁻𡂈𡂖㙇𡂿𡃓𡄯𡄻卤蒭𡋣𡍵𡌶讁𡕷𡘙𡟃𡟇乸炻𡠭𡥪"
|
|
],
|
|
[
|
|
"9b40",
|
|
"𡨭𡩅𡰪𡱰𡲬𡻈拃𡻕𡼕熘桕𢁅槩㛈𢉼𢏗𢏺𢜪𢡱𢥏苽𢥧𢦓𢫕覥𢫨辠𢬎鞸𢬿顇骽𢱌"
|
|
],
|
|
[
|
|
"9b62",
|
|
"𢲈𢲷𥯨𢴈𢴒𢶷𢶕𢹂𢽴𢿌𣀳𣁦𣌟𣏞徱晈暿𧩹𣕧𣗳爁𤦺矗𣘚𣜖纇𠍆墵朎"
|
|
],
|
|
[
|
|
"9ba1",
|
|
"椘𣪧𧙗𥿢𣸑𣺹𧗾𢂚䣐䪸𤄙𨪚𤋮𤌍𤀻𤌴𤎖𤩅𠗊凒𠘑妟𡺨㮾𣳿𤐄𤓖垈𤙴㦛𤜯𨗨𩧉㝢𢇃譞𨭎駖𤠒𤣻𤨕爉𤫀𠱸奥𤺥𤾆𠝹軚𥀬劏圿煱𥊙𥐙𣽊𤪧喼𥑆𥑮𦭒釔㑳𥔿𧘲𥕞䜘𥕢𥕦𥟇𤤿𥡝偦㓻𣏌惞𥤃䝼𨥈𥪮𥮉𥰆𡶐垡煑澶𦄂𧰒遖𦆲𤾚譢𦐂𦑊"
|
|
],
|
|
[
|
|
"9c40",
|
|
"嵛𦯷輶𦒄𡤜諪𤧶𦒈𣿯𦔒䯀𦖿𦚵𢜛鑥𥟡憕娧晉侻嚹𤔡𦛼乪𤤴陖涏𦲽㘘襷𦞙𦡮𦐑𦡞營𦣇筂𩃀𠨑𦤦鄄𦤹穅鷰𦧺騦𦨭㙟𦑩𠀡禃𦨴𦭛崬𣔙菏𦮝䛐𦲤画补𦶮墶"
|
|
],
|
|
[
|
|
"9ca1",
|
|
"㜜𢖍𧁋𧇍㱔𧊀𧊅銁𢅺𧊋錰𧋦𤧐氹钟𧑐𠻸蠧裵𢤦𨑳𡞱溸𤨪𡠠㦤㚹尐秣䔿暶𩲭𩢤襃𧟌𧡘囖䃟𡘊㦡𣜯𨃨𡏅熭荦𧧝𩆨婧䲷𧂯𨦫𧧽𧨊𧬋𧵦𤅺筃祾𨀉澵𪋟樃𨌘厢𦸇鎿栶靝𨅯𨀣𦦵𡏭𣈯𨁈嶅𨰰𨂃圕頣𨥉嶫𤦈斾槕叒𤪥𣾁㰑朶𨂐𨃴𨄮𡾡𨅏"
|
|
],
|
|
[
|
|
"9d40",
|
|
"𨆉𨆯𨈚𨌆𨌯𨎊㗊𨑨𨚪䣺揦𨥖砈鉕𨦸䏲𨧧䏟𨧨𨭆𨯔姸𨰉輋𨿅𩃬筑𩄐𩄼㷷𩅞𤫊运犏嚋𩓧𩗩𩖰𩖸𩜲𩣑𩥉𩥪𩧃𩨨𩬎𩵚𩶛纟𩻸𩼣䲤镇𪊓熢𪋿䶑递𪗋䶜𠲜达嗁"
|
|
],
|
|
[
|
|
"9da1",
|
|
"辺𢒰边𤪓䔉繿潖檱仪㓤𨬬𧢝㜺躀𡟵𨀤𨭬𨮙𧨾𦚯㷫𧙕𣲷𥘵𥥖亚𥺁𦉘嚿𠹭踎孭𣺈𤲞揞拐𡟶𡡻攰嘭𥱊吚𥌑㷆𩶘䱽嘢嘞罉𥻘奵𣵀蝰东𠿪𠵉𣚺脗鵞贘瘻鱅癎瞹鍅吲腈苷嘥脲萘肽嗪祢噃吖𠺝㗎嘅嗱曱𨋢㘭甴嗰喺咗啲𠱁𠲖廐𥅈𠹶𢱢"
|
|
],
|
|
[
|
|
"9e40",
|
|
"𠺢麫絚嗞𡁵抝靭咔賍燶酶揼掹揾啩𢭃鱲𢺳冚㓟𠶧冧呍唞唓癦踭𦢊疱肶蠄螆裇膶萜𡃁䓬猄𤜆宐茋𦢓噻𢛴𧴯𤆣𧵳𦻐𧊶酰𡇙鈈𣳼𪚩𠺬𠻹牦𡲢䝎𤿂𧿹𠿫䃺"
|
|
],
|
|
[
|
|
"9ea1",
|
|
"鱝攟𢶠䣳𤟠𩵼𠿬𠸊恢𧖣𠿭"
|
|
],
|
|
[
|
|
"9ead",
|
|
"𦁈𡆇熣纎鵐业丄㕷嬍沲卧㚬㧜卽㚥𤘘墚𤭮舭呋垪𥪕𠥹"
|
|
],
|
|
[
|
|
"9ec5",
|
|
"㩒𢑥獴𩺬䴉鯭𣳾𩼰䱛𤾩𩖞𩿞葜𣶶𧊲𦞳𣜠挮紥𣻷𣸬㨪逈勌㹴㙺䗩𠒎癀嫰𠺶硺𧼮墧䂿噼鮋嵴癔𪐴麅䳡痹㟻愙𣃚𤏲"
|
|
],
|
|
[
|
|
"9ef5",
|
|
"噝𡊩垧𤥣𩸆刴𧂮㖭汊鵼"
|
|
],
|
|
[
|
|
"9f40",
|
|
"籖鬹埞𡝬屓擓𩓐𦌵𧅤蚭𠴨𦴢𤫢𠵱"
|
|
],
|
|
[
|
|
"9f4f",
|
|
"凾𡼏嶎霃𡷑麁遌笟鬂峑箣扨挵髿篏鬪籾鬮籂粆鰕篼鬉鼗鰛𤤾齚啳寃俽麘俲剠㸆勑坧偖妷帒韈鶫轜呩鞴饀鞺匬愰"
|
|
],
|
|
[
|
|
"9fa1",
|
|
"椬叚鰊鴂䰻陁榀傦畆𡝭駚剳"
|
|
],
|
|
[
|
|
"9fae",
|
|
"酙隁酜"
|
|
],
|
|
[
|
|
"9fb2",
|
|
"酑𨺗捿𦴣櫊嘑醎畺抅𠏼獏籰𥰡𣳽"
|
|
],
|
|
[
|
|
"9fc1",
|
|
"𤤙盖鮝个𠳔莾衂"
|
|
],
|
|
[
|
|
"9fc9",
|
|
"届槀僭坺刟巵从氱𠇲伹咜哚劚趂㗾弌㗳"
|
|
],
|
|
[
|
|
"9fdb",
|
|
"歒酼龥鮗頮颴骺麨麄煺笔"
|
|
],
|
|
[
|
|
"9fe7",
|
|
"毺蠘罸"
|
|
],
|
|
[
|
|
"9feb",
|
|
"嘠𪙊蹷齓"
|
|
],
|
|
[
|
|
"9ff0",
|
|
"跔蹏鸜踁抂𨍽踨蹵竓𤩷稾磘泪詧瘇"
|
|
],
|
|
[
|
|
"a040",
|
|
"𨩚鼦泎蟖痃𪊲硓咢贌狢獱謭猂瓱賫𤪻蘯徺袠䒷"
|
|
],
|
|
[
|
|
"a055",
|
|
"𡠻𦸅"
|
|
],
|
|
[
|
|
"a058",
|
|
"詾𢔛"
|
|
],
|
|
[
|
|
"a05b",
|
|
"惽癧髗鵄鍮鮏蟵"
|
|
],
|
|
[
|
|
"a063",
|
|
"蠏賷猬霡鮰㗖犲䰇籑饊𦅙慙䰄麖慽"
|
|
],
|
|
[
|
|
"a073",
|
|
"坟慯抦戹拎㩜懢厪𣏵捤栂㗒"
|
|
],
|
|
[
|
|
"a0a1",
|
|
"嵗𨯂迚𨸹"
|
|
],
|
|
[
|
|
"a0a6",
|
|
"僙𡵆礆匲阸𠼻䁥"
|
|
],
|
|
[
|
|
"a0ae",
|
|
"矾"
|
|
],
|
|
[
|
|
"a0b0",
|
|
"糂𥼚糚稭聦聣絍甅瓲覔舚朌聢𧒆聛瓰脃眤覉𦟌畓𦻑螩蟎臈螌詉貭譃眫瓸蓚㘵榲趦"
|
|
],
|
|
[
|
|
"a0d4",
|
|
"覩瑨涹蟁𤀑瓧㷛煶悤憜㳑煢恷"
|
|
],
|
|
[
|
|
"a0e2",
|
|
"罱𨬭牐惩䭾删㰘𣳇𥻗𧙖𥔱𡥄𡋾𩤃𦷜𧂭峁𦆭𨨏𣙷𠃮𦡆𤼎䕢嬟𦍌齐麦𦉫"
|
|
],
|
|
[
|
|
"a3c0",
|
|
"␀",
|
|
31,
|
|
"␡"
|
|
],
|
|
[
|
|
"c6a1",
|
|
"①",
|
|
9,
|
|
"⑴",
|
|
9,
|
|
"ⅰ",
|
|
9,
|
|
"丶丿亅亠冂冖冫勹匸卩厶夊宀巛⼳广廴彐彡攴无疒癶辵隶¨ˆヽヾゝゞ〃仝々〆〇ー[]✽ぁ",
|
|
23
|
|
],
|
|
[
|
|
"c740",
|
|
"す",
|
|
58,
|
|
"ァアィイ"
|
|
],
|
|
[
|
|
"c7a1",
|
|
"ゥ",
|
|
81,
|
|
"А",
|
|
5,
|
|
"ЁЖ",
|
|
4
|
|
],
|
|
[
|
|
"c840",
|
|
"Л",
|
|
26,
|
|
"ёж",
|
|
25,
|
|
"⇧↸↹㇏𠃌乚𠂊刂䒑"
|
|
],
|
|
[
|
|
"c8a1",
|
|
"龰冈龱𧘇"
|
|
],
|
|
[
|
|
"c8cd",
|
|
"¬¦'"㈱№℡゛゜⺀⺄⺆⺇⺈⺊⺌⺍⺕⺜⺝⺥⺧⺪⺬⺮⺶⺼⺾⻆⻊⻌⻍⻏⻖⻗⻞⻣"
|
|
],
|
|
[
|
|
"c8f5",
|
|
"ʃɐɛɔɵœøŋʊɪ"
|
|
],
|
|
[
|
|
"f9fe",
|
|
"■"
|
|
],
|
|
[
|
|
"fa40",
|
|
"𠕇鋛𠗟𣿅蕌䊵珯况㙉𤥂𨧤鍄𡧛苮𣳈砼杄拟𤤳𨦪𠊠𦮳𡌅侫𢓭倈𦴩𧪄𣘀𤪱𢔓倩𠍾徤𠎀𠍇滛𠐟偽儁㑺儎顬㝃萖𤦤𠒇兠𣎴兪𠯿𢃼𠋥𢔰𠖎𣈳𡦃宂蝽𠖳𣲙冲冸"
|
|
],
|
|
[
|
|
"faa1",
|
|
"鴴凉减凑㳜凓𤪦决凢卂凭菍椾𣜭彻刋刦刼劵剗劔効勅簕蕂勠蘍𦬓包𨫞啉滙𣾀𠥔𣿬匳卄𠯢泋𡜦栛珕恊㺪㣌𡛨燝䒢卭却𨚫卾卿𡖖𡘓矦厓𨪛厠厫厮玧𥝲㽙玜叁叅汉义埾叙㪫𠮏叠𣿫𢶣叶𠱷吓灹唫晗浛呭𦭓𠵴啝咏咤䞦𡜍𠻝㶴𠵍"
|
|
],
|
|
[
|
|
"fb40",
|
|
"𨦼𢚘啇䳭启琗喆喩嘅𡣗𤀺䕒𤐵暳𡂴嘷曍𣊊暤暭噍噏磱囱鞇叾圀囯园𨭦㘣𡉏坆𤆥汮炋坂㚱𦱾埦𡐖堃𡑔𤍣堦𤯵塜墪㕡壠壜𡈼壻寿坃𪅐𤉸鏓㖡够梦㛃湙"
|
|
],
|
|
[
|
|
"fba1",
|
|
"𡘾娤啓𡚒蔅姉𠵎𦲁𦴪𡟜姙𡟻𡞲𦶦浱𡠨𡛕姹𦹅媫婣㛦𤦩婷㜈媖瑥嫓𦾡𢕔㶅𡤑㜲𡚸広勐孶斈孼𧨎䀄䡝𠈄寕慠𡨴𥧌𠖥寳宝䴐尅𡭄尓珎尔𡲥𦬨屉䣝岅峩峯嶋𡷹𡸷崐崘嵆𡺤岺巗苼㠭𤤁𢁉𢅳芇㠶㯂帮檊幵幺𤒼𠳓厦亷廐厨𡝱帉廴𨒂"
|
|
],
|
|
[
|
|
"fc40",
|
|
"廹廻㢠廼栾鐛弍𠇁弢㫞䢮𡌺强𦢈𢏐彘𢑱彣鞽𦹮彲鍀𨨶徧嶶㵟𥉐𡽪𧃸𢙨釖𠊞𨨩怱暅𡡷㥣㷇㘹垐𢞴祱㹀悞悤悳𤦂𤦏𧩓璤僡媠慤萤慂慈𦻒憁凴𠙖憇宪𣾷"
|
|
],
|
|
[
|
|
"fca1",
|
|
"𢡟懓𨮝𩥝懐㤲𢦀𢣁怣慜攞掋𠄘担𡝰拕𢸍捬𤧟㨗搸揸𡎎𡟼撐澊𢸶頔𤂌𥜝擡擥鑻㩦携㩗敍漖𤨨𤨣斅敭敟𣁾斵𤥀䬷旑䃘𡠩无旣忟𣐀昘𣇷𣇸晄𣆤𣆥晋𠹵晧𥇦晳晴𡸽𣈱𨗴𣇈𥌓矅𢣷馤朂𤎜𤨡㬫槺𣟂杞杧杢𤇍𩃭柗䓩栢湐鈼栁𣏦𦶠桝"
|
|
],
|
|
[
|
|
"fd40",
|
|
"𣑯槡樋𨫟楳棃𣗍椁椀㴲㨁𣘼㮀枬楡𨩊䋼椶榘㮡𠏉荣傐槹𣙙𢄪橅𣜃檝㯳枱櫈𩆜㰍欝𠤣惞欵歴𢟍溵𣫛𠎵𡥘㝀吡𣭚毡𣻼毜氷𢒋𤣱𦭑汚舦汹𣶼䓅𣶽𤆤𤤌𤤀"
|
|
],
|
|
[
|
|
"fda1",
|
|
"𣳉㛥㳫𠴲鮃𣇹𢒑羏样𦴥𦶡𦷫涖浜湼漄𤥿𤂅𦹲蔳𦽴凇沜渝萮𨬡港𣸯瑓𣾂秌湏媑𣁋濸㜍澝𣸰滺𡒗𤀽䕕鏰潄潜㵎潴𩅰㴻澟𤅄濓𤂑𤅕𤀹𣿰𣾴𤄿凟𤅖𤅗𤅀𦇝灋灾炧炁烌烕烖烟䄄㷨熴熖𤉷焫煅媈煊煮岜𤍥煏鍢𤋁焬𤑚𤨧𤨢熺𨯨炽爎"
|
|
],
|
|
[
|
|
"fe40",
|
|
"鑂爕夑鑃爤鍁𥘅爮牀𤥴梽牕牗㹕𣁄栍漽犂猪猫𤠣𨠫䣭𨠄猨献珏玪𠰺𦨮珉瑉𤇢𡛧𤨤昣㛅𤦷𤦍𤧻珷琕椃𤨦琹𠗃㻗瑜𢢭瑠𨺲瑇珤瑶莹瑬㜰瑴鏱樬璂䥓𤪌"
|
|
],
|
|
[
|
|
"fea1",
|
|
"𤅟𤩹𨮏孆𨰃𡢞瓈𡦈甎瓩甞𨻙𡩋寗𨺬鎅畍畊畧畮𤾂㼄𤴓疎瑝疞疴瘂瘬癑癏癯癶𦏵皐臯㟸𦤑𦤎皡皥皷盌𦾟葢𥂝𥅽𡸜眞眦着撯𥈠睘𣊬瞯𨥤𨥨𡛁矴砉𡍶𤨒棊碯磇磓隥礮𥗠磗礴碱𧘌辸袄𨬫𦂃𢘜禆褀椂禀𥡗禝𧬹礼禩渪𧄦㺨秆𩄍秔"
|
|
]
|
|
];
|
|
|
|
/***/ },
|
|
/* 103 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"
|
|
|
|
var Transform = __webpack_require__(30).Transform;
|
|
|
|
|
|
// == Exports ==================================================================
|
|
module.exports = function(iconv) {
|
|
|
|
// Additional Public API.
|
|
iconv.encodeStream = function encodeStream(encoding, options) {
|
|
return new IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options);
|
|
}
|
|
|
|
iconv.decodeStream = function decodeStream(encoding, options) {
|
|
return new IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options);
|
|
}
|
|
|
|
iconv.supportsStreams = true;
|
|
|
|
|
|
// Not published yet.
|
|
iconv.IconvLiteEncoderStream = IconvLiteEncoderStream;
|
|
iconv.IconvLiteDecoderStream = IconvLiteDecoderStream;
|
|
iconv._collect = IconvLiteDecoderStream.prototype.collect;
|
|
};
|
|
|
|
|
|
// == Encoder stream =======================================================
|
|
function IconvLiteEncoderStream(conv, options) {
|
|
this.conv = conv;
|
|
options = options || {};
|
|
options.decodeStrings = false; // We accept only strings, so we don't need to decode them.
|
|
Transform.call(this, options);
|
|
}
|
|
|
|
IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, {
|
|
constructor: { value: IconvLiteEncoderStream }
|
|
});
|
|
|
|
IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
if (typeof chunk != 'string')
|
|
return done(new Error("Iconv encoding stream needs strings as its input."));
|
|
try {
|
|
var res = this.conv.write(chunk);
|
|
if (res && res.length) this.push(res);
|
|
done();
|
|
}
|
|
catch (e) {
|
|
done(e);
|
|
}
|
|
}
|
|
|
|
IconvLiteEncoderStream.prototype._flush = function(done) {
|
|
try {
|
|
var res = this.conv.end();
|
|
if (res && res.length) this.push(res);
|
|
done();
|
|
}
|
|
catch (e) {
|
|
done(e);
|
|
}
|
|
}
|
|
|
|
IconvLiteEncoderStream.prototype.collect = function(cb) {
|
|
var chunks = [];
|
|
this.on('error', cb);
|
|
this.on('data', function(chunk) { chunks.push(chunk); });
|
|
this.on('end', function() {
|
|
cb(null, Buffer.concat(chunks));
|
|
});
|
|
return this;
|
|
}
|
|
|
|
|
|
// == Decoder stream =======================================================
|
|
function IconvLiteDecoderStream(conv, options) {
|
|
this.conv = conv;
|
|
options = options || {};
|
|
options.encoding = this.encoding = 'utf8'; // We output strings.
|
|
Transform.call(this, options);
|
|
}
|
|
|
|
IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, {
|
|
constructor: { value: IconvLiteDecoderStream }
|
|
});
|
|
|
|
IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
if (!Buffer.isBuffer(chunk))
|
|
return done(new Error("Iconv decoding stream needs buffers as its input."));
|
|
try {
|
|
var res = this.conv.write(chunk);
|
|
if (res && res.length) this.push(res, this.encoding);
|
|
done();
|
|
}
|
|
catch (e) {
|
|
done(e);
|
|
}
|
|
}
|
|
|
|
IconvLiteDecoderStream.prototype._flush = function(done) {
|
|
try {
|
|
var res = this.conv.end();
|
|
if (res && res.length) this.push(res, this.encoding);
|
|
done();
|
|
}
|
|
catch (e) {
|
|
done(e);
|
|
}
|
|
}
|
|
|
|
IconvLiteDecoderStream.prototype.collect = function(cb) {
|
|
var res = '';
|
|
this.on('error', cb);
|
|
this.on('data', function(chunk) { res += chunk; });
|
|
this.on('end', function() {
|
|
cb(null, res);
|
|
});
|
|
return this;
|
|
}
|
|
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 104 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"
|
|
|
|
// == Extend Node primitives to use iconv-lite =================================
|
|
|
|
module.exports = function (iconv) {
|
|
var original = undefined; // Place to keep original methods.
|
|
|
|
// Node authors rewrote Buffer internals to make it compatible with
|
|
// Uint8Array and we cannot patch key functions since then.
|
|
iconv.supportsNodeEncodingsExtension = !(new Buffer(0) instanceof Uint8Array);
|
|
|
|
iconv.extendNodeEncodings = function extendNodeEncodings() {
|
|
if (original) return;
|
|
original = {};
|
|
|
|
if (!iconv.supportsNodeEncodingsExtension) {
|
|
console.error("ACTION NEEDED: require('iconv-lite').extendNodeEncodings() is not supported in your version of Node");
|
|
console.error("See more info at https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility");
|
|
return;
|
|
}
|
|
|
|
var nodeNativeEncodings = {
|
|
'hex': true, 'utf8': true, 'utf-8': true, 'ascii': true, 'binary': true,
|
|
'base64': true, 'ucs2': true, 'ucs-2': true, 'utf16le': true, 'utf-16le': true,
|
|
};
|
|
|
|
Buffer.isNativeEncoding = function(enc) {
|
|
return enc && nodeNativeEncodings[enc.toLowerCase()];
|
|
}
|
|
|
|
// -- SlowBuffer -----------------------------------------------------------
|
|
var SlowBuffer = __webpack_require__(2).SlowBuffer;
|
|
|
|
original.SlowBufferToString = SlowBuffer.prototype.toString;
|
|
SlowBuffer.prototype.toString = function(encoding, start, end) {
|
|
encoding = String(encoding || 'utf8').toLowerCase();
|
|
|
|
// Use native conversion when possible
|
|
if (Buffer.isNativeEncoding(encoding))
|
|
return original.SlowBufferToString.call(this, encoding, start, end);
|
|
|
|
// Otherwise, use our decoding method.
|
|
if (typeof start == 'undefined') start = 0;
|
|
if (typeof end == 'undefined') end = this.length;
|
|
return iconv.decode(this.slice(start, end), encoding);
|
|
}
|
|
|
|
original.SlowBufferWrite = SlowBuffer.prototype.write;
|
|
SlowBuffer.prototype.write = function(string, offset, length, encoding) {
|
|
// Support both (string, offset, length, encoding)
|
|
// and the legacy (string, encoding, offset, length)
|
|
if (isFinite(offset)) {
|
|
if (!isFinite(length)) {
|
|
encoding = length;
|
|
length = undefined;
|
|
}
|
|
} else { // legacy
|
|
var swap = encoding;
|
|
encoding = offset;
|
|
offset = length;
|
|
length = swap;
|
|
}
|
|
|
|
offset = +offset || 0;
|
|
var remaining = this.length - offset;
|
|
if (!length) {
|
|
length = remaining;
|
|
} else {
|
|
length = +length;
|
|
if (length > remaining) {
|
|
length = remaining;
|
|
}
|
|
}
|
|
encoding = String(encoding || 'utf8').toLowerCase();
|
|
|
|
// Use native conversion when possible
|
|
if (Buffer.isNativeEncoding(encoding))
|
|
return original.SlowBufferWrite.call(this, string, offset, length, encoding);
|
|
|
|
if (string.length > 0 && (length < 0 || offset < 0))
|
|
throw new RangeError('attempt to write beyond buffer bounds');
|
|
|
|
// Otherwise, use our encoding method.
|
|
var buf = iconv.encode(string, encoding);
|
|
if (buf.length < length) length = buf.length;
|
|
buf.copy(this, offset, 0, length);
|
|
return length;
|
|
}
|
|
|
|
// -- Buffer ---------------------------------------------------------------
|
|
|
|
original.BufferIsEncoding = Buffer.isEncoding;
|
|
Buffer.isEncoding = function(encoding) {
|
|
return Buffer.isNativeEncoding(encoding) || iconv.encodingExists(encoding);
|
|
}
|
|
|
|
original.BufferByteLength = Buffer.byteLength;
|
|
Buffer.byteLength = SlowBuffer.byteLength = function(str, encoding) {
|
|
encoding = String(encoding || 'utf8').toLowerCase();
|
|
|
|
// Use native conversion when possible
|
|
if (Buffer.isNativeEncoding(encoding))
|
|
return original.BufferByteLength.call(this, str, encoding);
|
|
|
|
// Slow, I know, but we don't have a better way yet.
|
|
return iconv.encode(str, encoding).length;
|
|
}
|
|
|
|
original.BufferToString = Buffer.prototype.toString;
|
|
Buffer.prototype.toString = function(encoding, start, end) {
|
|
encoding = String(encoding || 'utf8').toLowerCase();
|
|
|
|
// Use native conversion when possible
|
|
if (Buffer.isNativeEncoding(encoding))
|
|
return original.BufferToString.call(this, encoding, start, end);
|
|
|
|
// Otherwise, use our decoding method.
|
|
if (typeof start == 'undefined') start = 0;
|
|
if (typeof end == 'undefined') end = this.length;
|
|
return iconv.decode(this.slice(start, end), encoding);
|
|
}
|
|
|
|
original.BufferWrite = Buffer.prototype.write;
|
|
Buffer.prototype.write = function(string, offset, length, encoding) {
|
|
var _offset = offset, _length = length, _encoding = encoding;
|
|
// Support both (string, offset, length, encoding)
|
|
// and the legacy (string, encoding, offset, length)
|
|
if (isFinite(offset)) {
|
|
if (!isFinite(length)) {
|
|
encoding = length;
|
|
length = undefined;
|
|
}
|
|
} else { // legacy
|
|
var swap = encoding;
|
|
encoding = offset;
|
|
offset = length;
|
|
length = swap;
|
|
}
|
|
|
|
encoding = String(encoding || 'utf8').toLowerCase();
|
|
|
|
// Use native conversion when possible
|
|
if (Buffer.isNativeEncoding(encoding))
|
|
return original.BufferWrite.call(this, string, _offset, _length, _encoding);
|
|
|
|
offset = +offset || 0;
|
|
var remaining = this.length - offset;
|
|
if (!length) {
|
|
length = remaining;
|
|
} else {
|
|
length = +length;
|
|
if (length > remaining) {
|
|
length = remaining;
|
|
}
|
|
}
|
|
|
|
if (string.length > 0 && (length < 0 || offset < 0))
|
|
throw new RangeError('attempt to write beyond buffer bounds');
|
|
|
|
// Otherwise, use our encoding method.
|
|
var buf = iconv.encode(string, encoding);
|
|
if (buf.length < length) length = buf.length;
|
|
buf.copy(this, offset, 0, length);
|
|
return length;
|
|
|
|
// TODO: Set _charsWritten.
|
|
}
|
|
|
|
|
|
// -- Readable -------------------------------------------------------------
|
|
if (iconv.supportsStreams) {
|
|
var Readable = __webpack_require__(30).Readable;
|
|
|
|
original.ReadableSetEncoding = Readable.prototype.setEncoding;
|
|
Readable.prototype.setEncoding = function setEncoding(enc, options) {
|
|
// Use our own decoder, it has the same interface.
|
|
// We cannot use original function as it doesn't handle BOM-s.
|
|
this._readableState.decoder = iconv.getDecoder(enc, options);
|
|
this._readableState.encoding = enc;
|
|
}
|
|
|
|
Readable.prototype.collect = iconv._collect;
|
|
}
|
|
}
|
|
|
|
// Remove iconv-lite Node primitive extensions.
|
|
iconv.undoExtendNodeEncodings = function undoExtendNodeEncodings() {
|
|
if (!iconv.supportsNodeEncodingsExtension)
|
|
return;
|
|
if (!original)
|
|
throw new Error("require('iconv-lite').undoExtendNodeEncodings(): Nothing to undo; extendNodeEncodings() is not called.")
|
|
|
|
delete Buffer.isNativeEncoding;
|
|
|
|
var SlowBuffer = __webpack_require__(2).SlowBuffer;
|
|
|
|
SlowBuffer.prototype.toString = original.SlowBufferToString;
|
|
SlowBuffer.prototype.write = original.SlowBufferWrite;
|
|
|
|
Buffer.isEncoding = original.BufferIsEncoding;
|
|
Buffer.byteLength = original.BufferByteLength;
|
|
Buffer.prototype.toString = original.BufferToString;
|
|
Buffer.prototype.write = original.BufferWrite;
|
|
|
|
if (iconv.supportsStreams) {
|
|
var Readable = __webpack_require__(30).Readable;
|
|
|
|
Readable.prototype.setEncoding = original.ReadableSetEncoding;
|
|
delete Readable.prototype.collect;
|
|
}
|
|
|
|
original = undefined;
|
|
}
|
|
}
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 105 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var ArrayT, NumberT, utils;
|
|
|
|
NumberT = __webpack_require__(106).Number;
|
|
|
|
utils = __webpack_require__(107);
|
|
|
|
ArrayT = (function() {
|
|
function ArrayT(type, length, lengthType) {
|
|
this.type = type;
|
|
this.length = length;
|
|
this.lengthType = lengthType != null ? lengthType : 'count';
|
|
}
|
|
|
|
ArrayT.prototype.decode = function(stream, parent) {
|
|
var ctx, i, length, pos, res, target, _i;
|
|
pos = stream.pos;
|
|
res = [];
|
|
ctx = parent;
|
|
if (this.length != null) {
|
|
length = utils.resolveLength(this.length, stream, parent);
|
|
}
|
|
if (this.length instanceof NumberT) {
|
|
Object.defineProperties(res, {
|
|
parent: {
|
|
value: parent
|
|
},
|
|
_startOffset: {
|
|
value: pos
|
|
},
|
|
_currentOffset: {
|
|
value: 0,
|
|
writable: true
|
|
},
|
|
_length: {
|
|
value: length
|
|
}
|
|
});
|
|
ctx = res;
|
|
}
|
|
if ((length == null) || this.lengthType === 'bytes') {
|
|
target = length != null ? stream.pos + length : (parent != null ? parent._length : void 0) ? parent._startOffset + parent._length : stream.length;
|
|
while (stream.pos < target) {
|
|
res.push(this.type.decode(stream, ctx));
|
|
}
|
|
} else {
|
|
for (i = _i = 0; _i < length; i = _i += 1) {
|
|
res.push(this.type.decode(stream, ctx));
|
|
}
|
|
}
|
|
return res;
|
|
};
|
|
|
|
ArrayT.prototype.size = function(array, ctx) {
|
|
var item, size, _i, _len;
|
|
if (!array) {
|
|
return this.type.size(null, ctx) * utils.resolveLength(this.length, null, ctx);
|
|
}
|
|
size = 0;
|
|
if (this.length instanceof NumberT) {
|
|
size += this.length.size();
|
|
ctx = {
|
|
parent: ctx
|
|
};
|
|
}
|
|
for (_i = 0, _len = array.length; _i < _len; _i++) {
|
|
item = array[_i];
|
|
size += this.type.size(item, ctx);
|
|
}
|
|
return size;
|
|
};
|
|
|
|
ArrayT.prototype.encode = function(stream, array, parent) {
|
|
var ctx, i, item, ptr, _i, _len;
|
|
ctx = parent;
|
|
if (this.length instanceof NumberT) {
|
|
ctx = {
|
|
pointers: [],
|
|
startOffset: stream.pos,
|
|
parent: parent
|
|
};
|
|
ctx.pointerOffset = stream.pos + this.size(array, ctx);
|
|
this.length.encode(stream, array.length);
|
|
}
|
|
for (_i = 0, _len = array.length; _i < _len; _i++) {
|
|
item = array[_i];
|
|
this.type.encode(stream, item, ctx);
|
|
}
|
|
if (this.length instanceof NumberT) {
|
|
i = 0;
|
|
while (i < ctx.pointers.length) {
|
|
ptr = ctx.pointers[i++];
|
|
ptr.type.encode(stream, ptr.val);
|
|
}
|
|
}
|
|
};
|
|
|
|
return ArrayT;
|
|
|
|
})();
|
|
|
|
module.exports = ArrayT;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 106 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var DecodeStream, Fixed, NumberT,
|
|
__hasProp = {}.hasOwnProperty,
|
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
|
|
|
DecodeStream = __webpack_require__(83);
|
|
|
|
NumberT = (function() {
|
|
function NumberT(type, endian) {
|
|
this.type = type;
|
|
this.endian = endian != null ? endian : 'BE';
|
|
this.fn = this.type;
|
|
if (this.type[this.type.length - 1] !== '8') {
|
|
this.fn += this.endian;
|
|
}
|
|
}
|
|
|
|
NumberT.prototype.size = function() {
|
|
return DecodeStream.TYPES[this.type];
|
|
};
|
|
|
|
NumberT.prototype.decode = function(stream) {
|
|
return stream['read' + this.fn]();
|
|
};
|
|
|
|
NumberT.prototype.encode = function(stream, val) {
|
|
return stream['write' + this.fn](val);
|
|
};
|
|
|
|
return NumberT;
|
|
|
|
})();
|
|
|
|
exports.Number = NumberT;
|
|
|
|
exports.uint8 = new NumberT('UInt8');
|
|
|
|
exports.uint16be = exports.uint16 = new NumberT('UInt16', 'BE');
|
|
|
|
exports.uint16le = new NumberT('UInt16', 'LE');
|
|
|
|
exports.uint24be = exports.uint24 = new NumberT('UInt24', 'BE');
|
|
|
|
exports.uint24le = new NumberT('UInt24', 'LE');
|
|
|
|
exports.uint32be = exports.uint32 = new NumberT('UInt32', 'BE');
|
|
|
|
exports.uint32le = new NumberT('UInt32', 'LE');
|
|
|
|
exports.int8 = new NumberT('Int8');
|
|
|
|
exports.int16be = exports.int16 = new NumberT('Int16', 'BE');
|
|
|
|
exports.int16le = new NumberT('Int16', 'LE');
|
|
|
|
exports.int24be = exports.int24 = new NumberT('Int24', 'BE');
|
|
|
|
exports.int24le = new NumberT('Int24', 'LE');
|
|
|
|
exports.int32be = exports.int32 = new NumberT('Int32', 'BE');
|
|
|
|
exports.int32le = new NumberT('Int32', 'LE');
|
|
|
|
exports.floatbe = exports.float = new NumberT('Float', 'BE');
|
|
|
|
exports.floatle = new NumberT('Float', 'LE');
|
|
|
|
exports.doublebe = exports.double = new NumberT('Double', 'BE');
|
|
|
|
exports.doublele = new NumberT('Double', 'LE');
|
|
|
|
Fixed = (function(_super) {
|
|
__extends(Fixed, _super);
|
|
|
|
function Fixed(size, endian, fracBits) {
|
|
if (fracBits == null) {
|
|
fracBits = size >> 1;
|
|
}
|
|
Fixed.__super__.constructor.call(this, "Int" + size, endian);
|
|
this._point = 1 << fracBits;
|
|
}
|
|
|
|
Fixed.prototype.decode = function(stream) {
|
|
return Fixed.__super__.decode.call(this, stream) / this._point;
|
|
};
|
|
|
|
Fixed.prototype.encode = function(stream, val) {
|
|
return Fixed.__super__.encode.call(this, stream, val * this._point | 0);
|
|
};
|
|
|
|
return Fixed;
|
|
|
|
})(NumberT);
|
|
|
|
exports.Fixed = Fixed;
|
|
|
|
exports.fixed16be = exports.fixed16 = new Fixed(16, 'BE');
|
|
|
|
exports.fixed16le = new Fixed(16, 'LE');
|
|
|
|
exports.fixed32be = exports.fixed32 = new Fixed(32, 'BE');
|
|
|
|
exports.fixed32le = new Fixed(32, 'LE');
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 107 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var NumberT, PropertyDescriptor;
|
|
|
|
NumberT = __webpack_require__(106).Number;
|
|
|
|
exports.resolveLength = function(length, stream, parent) {
|
|
var res;
|
|
if (typeof length === 'number') {
|
|
res = length;
|
|
} else if (typeof length === 'function') {
|
|
res = length.call(parent, parent);
|
|
} else if (parent && typeof length === 'string') {
|
|
res = parent[length];
|
|
} else if (stream && length instanceof NumberT) {
|
|
res = length.decode(stream);
|
|
}
|
|
if (isNaN(res)) {
|
|
throw new Error('Not a fixed size');
|
|
}
|
|
return res;
|
|
};
|
|
|
|
PropertyDescriptor = (function() {
|
|
function PropertyDescriptor(opts) {
|
|
var key, val;
|
|
if (opts == null) {
|
|
opts = {};
|
|
}
|
|
this.enumerable = true;
|
|
this.configurable = true;
|
|
for (key in opts) {
|
|
val = opts[key];
|
|
this[key] = val;
|
|
}
|
|
}
|
|
|
|
return PropertyDescriptor;
|
|
|
|
})();
|
|
|
|
exports.PropertyDescriptor = PropertyDescriptor;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 108 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var ArrayT, LazyArray, LazyArrayT, NumberT, inspect, utils,
|
|
__hasProp = {}.hasOwnProperty,
|
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
|
|
|
ArrayT = __webpack_require__(105);
|
|
|
|
NumberT = __webpack_require__(106).Number;
|
|
|
|
utils = __webpack_require__(107);
|
|
|
|
inspect = __webpack_require__(69).inspect;
|
|
|
|
LazyArrayT = (function(_super) {
|
|
__extends(LazyArrayT, _super);
|
|
|
|
function LazyArrayT() {
|
|
return LazyArrayT.__super__.constructor.apply(this, arguments);
|
|
}
|
|
|
|
LazyArrayT.prototype.decode = function(stream, parent) {
|
|
var length, pos, res;
|
|
pos = stream.pos;
|
|
length = utils.resolveLength(this.length, stream, parent);
|
|
if (this.length instanceof NumberT) {
|
|
parent = {
|
|
parent: parent,
|
|
_startOffset: pos,
|
|
_currentOffset: 0,
|
|
_length: length
|
|
};
|
|
}
|
|
res = new LazyArray(this.type, length, stream, parent);
|
|
stream.pos += length * this.type.size(null, parent);
|
|
return res;
|
|
};
|
|
|
|
LazyArrayT.prototype.size = function(val, ctx) {
|
|
if (val instanceof LazyArray) {
|
|
val = val.toArray();
|
|
}
|
|
return LazyArrayT.__super__.size.call(this, val, ctx);
|
|
};
|
|
|
|
LazyArrayT.prototype.encode = function(stream, val, ctx) {
|
|
if (val instanceof LazyArray) {
|
|
val = val.toArray();
|
|
}
|
|
return LazyArrayT.__super__.encode.call(this, stream, val, ctx);
|
|
};
|
|
|
|
return LazyArrayT;
|
|
|
|
})(ArrayT);
|
|
|
|
LazyArray = (function() {
|
|
function LazyArray(type, length, stream, ctx) {
|
|
this.type = type;
|
|
this.length = length;
|
|
this.stream = stream;
|
|
this.ctx = ctx;
|
|
this.base = this.stream.pos;
|
|
this.items = [];
|
|
}
|
|
|
|
LazyArray.prototype.get = function(index) {
|
|
var pos;
|
|
if (index < 0 || index >= this.length) {
|
|
return void 0;
|
|
}
|
|
if (this.items[index] == null) {
|
|
pos = this.stream.pos;
|
|
this.stream.pos = this.base + this.type.size(null, this.ctx) * index;
|
|
this.items[index] = this.type.decode(this.stream, this.ctx);
|
|
this.stream.pos = pos;
|
|
}
|
|
return this.items[index];
|
|
};
|
|
|
|
LazyArray.prototype.toArray = function() {
|
|
var i, _i, _ref, _results;
|
|
_results = [];
|
|
for (i = _i = 0, _ref = this.length; _i < _ref; i = _i += 1) {
|
|
_results.push(this.get(i));
|
|
}
|
|
return _results;
|
|
};
|
|
|
|
LazyArray.prototype.inspect = function() {
|
|
return inspect(this.toArray());
|
|
};
|
|
|
|
return LazyArray;
|
|
|
|
})();
|
|
|
|
module.exports = LazyArrayT;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 109 */
|
|
/***/ function(module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var Bitfield;
|
|
|
|
Bitfield = (function() {
|
|
function Bitfield(type, flags) {
|
|
this.type = type;
|
|
this.flags = flags != null ? flags : [];
|
|
}
|
|
|
|
Bitfield.prototype.decode = function(stream) {
|
|
var flag, i, res, val, _i, _len, _ref;
|
|
val = this.type.decode(stream);
|
|
res = {};
|
|
_ref = this.flags;
|
|
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
|
|
flag = _ref[i];
|
|
if (flag != null) {
|
|
res[flag] = !!(val & (1 << i));
|
|
}
|
|
}
|
|
return res;
|
|
};
|
|
|
|
Bitfield.prototype.size = function() {
|
|
return this.type.size();
|
|
};
|
|
|
|
Bitfield.prototype.encode = function(stream, keys) {
|
|
var flag, i, val, _i, _len, _ref;
|
|
val = 0;
|
|
_ref = this.flags;
|
|
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
|
|
flag = _ref[i];
|
|
if (flag != null) {
|
|
if (keys[flag]) {
|
|
val |= 1 << i;
|
|
}
|
|
}
|
|
}
|
|
return this.type.encode(stream, val);
|
|
};
|
|
|
|
return Bitfield;
|
|
|
|
})();
|
|
|
|
module.exports = Bitfield;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 110 */
|
|
/***/ function(module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var BooleanT;
|
|
|
|
BooleanT = (function() {
|
|
function BooleanT(type) {
|
|
this.type = type;
|
|
}
|
|
|
|
BooleanT.prototype.decode = function(stream, parent) {
|
|
return !!this.type.decode(stream, parent);
|
|
};
|
|
|
|
BooleanT.prototype.size = function(val, parent) {
|
|
return this.type.size(val, parent);
|
|
};
|
|
|
|
BooleanT.prototype.encode = function(stream, val, parent) {
|
|
return this.type.encode(stream, +val, parent);
|
|
};
|
|
|
|
return BooleanT;
|
|
|
|
})();
|
|
|
|
module.exports = BooleanT;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 111 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var BufferT, NumberT, utils;
|
|
|
|
utils = __webpack_require__(107);
|
|
|
|
NumberT = __webpack_require__(106).Number;
|
|
|
|
BufferT = (function() {
|
|
function BufferT(length) {
|
|
this.length = length;
|
|
}
|
|
|
|
BufferT.prototype.decode = function(stream, parent) {
|
|
var length;
|
|
length = utils.resolveLength(this.length, stream, parent);
|
|
return stream.readBuffer(length);
|
|
};
|
|
|
|
BufferT.prototype.size = function(val, parent) {
|
|
if (!val) {
|
|
return utils.resolveLength(this.length, null, parent);
|
|
}
|
|
return val.length;
|
|
};
|
|
|
|
BufferT.prototype.encode = function(stream, buf, parent) {
|
|
if (this.length instanceof NumberT) {
|
|
this.length.encode(stream, buf.length);
|
|
}
|
|
return stream.writeBuffer(buf);
|
|
};
|
|
|
|
return BufferT;
|
|
|
|
})();
|
|
|
|
module.exports = BufferT;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 112 */
|
|
/***/ function(module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var Enum;
|
|
|
|
Enum = (function() {
|
|
function Enum(type, options) {
|
|
this.type = type;
|
|
this.options = options != null ? options : [];
|
|
}
|
|
|
|
Enum.prototype.decode = function(stream) {
|
|
var index;
|
|
index = this.type.decode(stream);
|
|
return this.options[index] || index;
|
|
};
|
|
|
|
Enum.prototype.size = function() {
|
|
return this.type.size();
|
|
};
|
|
|
|
Enum.prototype.encode = function(stream, val) {
|
|
var index;
|
|
index = this.options.indexOf(val);
|
|
if (index === -1) {
|
|
throw new Error("Unknown option in enum: " + val);
|
|
}
|
|
return this.type.encode(stream, index);
|
|
};
|
|
|
|
return Enum;
|
|
|
|
})();
|
|
|
|
module.exports = Enum;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 113 */
|
|
/***/ function(module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var Optional;
|
|
|
|
Optional = (function() {
|
|
function Optional(type, condition) {
|
|
this.type = type;
|
|
this.condition = condition != null ? condition : true;
|
|
}
|
|
|
|
Optional.prototype.decode = function(stream, parent) {
|
|
var condition;
|
|
condition = this.condition;
|
|
if (typeof condition === 'function') {
|
|
condition = condition.call(parent, parent);
|
|
}
|
|
if (condition) {
|
|
return this.type.decode(stream, parent);
|
|
}
|
|
};
|
|
|
|
Optional.prototype.size = function(val, parent) {
|
|
var condition;
|
|
condition = this.condition;
|
|
if (typeof condition === 'function') {
|
|
condition = condition.call(parent, parent);
|
|
}
|
|
if (condition) {
|
|
return this.type.size(val, parent);
|
|
} else {
|
|
return 0;
|
|
}
|
|
};
|
|
|
|
Optional.prototype.encode = function(stream, val, parent) {
|
|
var condition;
|
|
condition = this.condition;
|
|
if (typeof condition === 'function') {
|
|
condition = condition.call(parent, parent);
|
|
}
|
|
if (condition) {
|
|
return this.type.encode(stream, val, parent);
|
|
}
|
|
};
|
|
|
|
return Optional;
|
|
|
|
})();
|
|
|
|
module.exports = Optional;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 114 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var Reserved, utils;
|
|
|
|
utils = __webpack_require__(107);
|
|
|
|
Reserved = (function() {
|
|
function Reserved(type, count) {
|
|
this.type = type;
|
|
this.count = count != null ? count : 1;
|
|
}
|
|
|
|
Reserved.prototype.decode = function(stream, parent) {
|
|
stream.pos += this.size(null, parent);
|
|
return void 0;
|
|
};
|
|
|
|
Reserved.prototype.size = function(data, parent) {
|
|
var count;
|
|
count = utils.resolveLength(this.count, null, parent);
|
|
return this.type.size() * count;
|
|
};
|
|
|
|
Reserved.prototype.encode = function(stream, val, parent) {
|
|
return stream.fill(0, this.size(val, parent));
|
|
};
|
|
|
|
return Reserved;
|
|
|
|
})();
|
|
|
|
module.exports = Reserved;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 115 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var NumberT, StringT, utils;
|
|
|
|
NumberT = __webpack_require__(106).Number;
|
|
|
|
utils = __webpack_require__(107);
|
|
|
|
StringT = (function() {
|
|
function StringT(length, encoding) {
|
|
this.length = length;
|
|
this.encoding = encoding != null ? encoding : 'ascii';
|
|
}
|
|
|
|
StringT.prototype.decode = function(stream, parent) {
|
|
var buffer, encoding, length, pos, string;
|
|
length = (function() {
|
|
if (this.length != null) {
|
|
return utils.resolveLength(this.length, stream, parent);
|
|
} else {
|
|
buffer = stream.buffer, length = stream.length, pos = stream.pos;
|
|
while (pos < length && buffer[pos] !== 0x00) {
|
|
++pos;
|
|
}
|
|
return pos - stream.pos;
|
|
}
|
|
}).call(this);
|
|
encoding = this.encoding;
|
|
if (typeof encoding === 'function') {
|
|
encoding = encoding.call(parent, parent) || 'ascii';
|
|
}
|
|
string = stream.readString(length, encoding);
|
|
if ((this.length == null) && stream.pos < stream.length) {
|
|
stream.pos++;
|
|
}
|
|
return string;
|
|
};
|
|
|
|
StringT.prototype.size = function(val, parent) {
|
|
var encoding, size;
|
|
if (!val) {
|
|
return utils.resolveLength(this.length, null, parent);
|
|
}
|
|
encoding = this.encoding;
|
|
if (typeof encoding === 'function') {
|
|
encoding = encoding.call(parent != null ? parent.val : void 0, parent != null ? parent.val : void 0) || 'ascii';
|
|
}
|
|
if (encoding === 'utf16be') {
|
|
encoding = 'utf16le';
|
|
}
|
|
size = Buffer.byteLength(val, encoding);
|
|
if (this.length instanceof NumberT) {
|
|
size += this.length.size();
|
|
}
|
|
if (this.length == null) {
|
|
size++;
|
|
}
|
|
return size;
|
|
};
|
|
|
|
StringT.prototype.encode = function(stream, val, parent) {
|
|
var encoding;
|
|
encoding = this.encoding;
|
|
if (typeof encoding === 'function') {
|
|
encoding = encoding.call(parent != null ? parent.val : void 0, parent != null ? parent.val : void 0) || 'ascii';
|
|
}
|
|
if (this.length instanceof NumberT) {
|
|
this.length.encode(stream, Buffer.byteLength(val, encoding));
|
|
}
|
|
stream.writeString(val, encoding);
|
|
if (this.length == null) {
|
|
return stream.writeUInt8(0x00);
|
|
}
|
|
};
|
|
|
|
return StringT;
|
|
|
|
})();
|
|
|
|
module.exports = StringT;
|
|
|
|
}).call(this);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 116 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var Struct, utils;
|
|
|
|
utils = __webpack_require__(107);
|
|
|
|
Struct = (function() {
|
|
function Struct(fields) {
|
|
this.fields = fields != null ? fields : {};
|
|
}
|
|
|
|
Struct.prototype.decode = function(stream, parent, length) {
|
|
var res, _ref;
|
|
if (length == null) {
|
|
length = 0;
|
|
}
|
|
res = this._setup(stream, parent, length);
|
|
this._parseFields(stream, res, this.fields);
|
|
if ((_ref = this.process) != null) {
|
|
_ref.call(res, stream);
|
|
}
|
|
return res;
|
|
};
|
|
|
|
Struct.prototype._setup = function(stream, parent, length) {
|
|
var res;
|
|
res = {};
|
|
Object.defineProperties(res, {
|
|
parent: {
|
|
value: parent
|
|
},
|
|
_startOffset: {
|
|
value: stream.pos
|
|
},
|
|
_currentOffset: {
|
|
value: 0,
|
|
writable: true
|
|
},
|
|
_length: {
|
|
value: length
|
|
}
|
|
});
|
|
return res;
|
|
};
|
|
|
|
Struct.prototype._parseFields = function(stream, res, fields) {
|
|
var key, type, val;
|
|
for (key in fields) {
|
|
type = fields[key];
|
|
if (typeof type === 'function') {
|
|
val = type.call(res, res);
|
|
} else {
|
|
val = type.decode(stream, res);
|
|
}
|
|
if (val !== void 0) {
|
|
if (val instanceof utils.PropertyDescriptor) {
|
|
Object.defineProperty(res, key, val);
|
|
} else {
|
|
res[key] = val;
|
|
}
|
|
}
|
|
res._currentOffset = stream.pos - res._startOffset;
|
|
}
|
|
};
|
|
|
|
Struct.prototype.size = function(val, parent, includePointers) {
|
|
var ctx, key, size, type, _ref;
|
|
if (val == null) {
|
|
val = {};
|
|
}
|
|
if (includePointers == null) {
|
|
includePointers = true;
|
|
}
|
|
ctx = {
|
|
parent: parent,
|
|
val: val,
|
|
pointerSize: 0
|
|
};
|
|
size = 0;
|
|
_ref = this.fields;
|
|
for (key in _ref) {
|
|
type = _ref[key];
|
|
if (type.size != null) {
|
|
size += type.size(val[key], ctx);
|
|
}
|
|
}
|
|
if (includePointers) {
|
|
size += ctx.pointerSize;
|
|
}
|
|
return size;
|
|
};
|
|
|
|
Struct.prototype.encode = function(stream, val, parent) {
|
|
var ctx, i, key, ptr, type, _ref, _ref1;
|
|
if ((_ref = this.preEncode) != null) {
|
|
_ref.call(val, stream);
|
|
}
|
|
ctx = {
|
|
pointers: [],
|
|
startOffset: stream.pos,
|
|
parent: parent,
|
|
val: val,
|
|
pointerSize: 0
|
|
};
|
|
ctx.pointerOffset = stream.pos + this.size(val, ctx, false);
|
|
_ref1 = this.fields;
|
|
for (key in _ref1) {
|
|
type = _ref1[key];
|
|
if (type.encode != null) {
|
|
type.encode(stream, val[key], ctx);
|
|
}
|
|
}
|
|
i = 0;
|
|
while (i < ctx.pointers.length) {
|
|
ptr = ctx.pointers[i++];
|
|
ptr.type.encode(stream, ptr.val, ptr.parent);
|
|
}
|
|
};
|
|
|
|
return Struct;
|
|
|
|
})();
|
|
|
|
module.exports = Struct;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 117 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var Struct, VersionedStruct,
|
|
__hasProp = {}.hasOwnProperty,
|
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
|
|
|
Struct = __webpack_require__(116);
|
|
|
|
VersionedStruct = (function(_super) {
|
|
__extends(VersionedStruct, _super);
|
|
|
|
function VersionedStruct(type, versions) {
|
|
this.type = type;
|
|
this.versions = versions != null ? versions : {};
|
|
if (typeof this.type === 'string') {
|
|
this.versionGetter = new Function('parent', "return parent." + this.type);
|
|
this.versionSetter = new Function('parent', 'version', "return parent." + this.type + " = version");
|
|
}
|
|
}
|
|
|
|
VersionedStruct.prototype.decode = function(stream, parent, length) {
|
|
var fields, res, _ref;
|
|
if (length == null) {
|
|
length = 0;
|
|
}
|
|
res = this._setup(stream, parent, length);
|
|
if (typeof this.type === 'string') {
|
|
res.version = this.versionGetter(parent);
|
|
} else {
|
|
res.version = this.type.decode(stream);
|
|
}
|
|
if (this.versions.header) {
|
|
this._parseFields(stream, res, this.versions.header);
|
|
}
|
|
fields = this.versions[res.version];
|
|
if (fields == null) {
|
|
throw new Error("Unknown version " + res.version);
|
|
}
|
|
if (fields instanceof VersionedStruct) {
|
|
return fields.decode(stream, parent);
|
|
}
|
|
this._parseFields(stream, res, fields);
|
|
if ((_ref = this.process) != null) {
|
|
_ref.call(res, stream);
|
|
}
|
|
return res;
|
|
};
|
|
|
|
VersionedStruct.prototype.size = function(val, parent, includePointers) {
|
|
var ctx, fields, key, size, type, _ref;
|
|
if (includePointers == null) {
|
|
includePointers = true;
|
|
}
|
|
if (!val) {
|
|
throw new Error('Not a fixed size');
|
|
}
|
|
ctx = {
|
|
parent: parent,
|
|
val: val,
|
|
pointerSize: 0
|
|
};
|
|
size = 0;
|
|
if (typeof this.type !== 'string') {
|
|
size += this.type.size(val.version, ctx);
|
|
}
|
|
if (this.versions.header) {
|
|
_ref = this.versions.header;
|
|
for (key in _ref) {
|
|
type = _ref[key];
|
|
if (type.size != null) {
|
|
size += type.size(val[key], ctx);
|
|
}
|
|
}
|
|
}
|
|
fields = this.versions[val.version];
|
|
if (fields == null) {
|
|
throw new Error("Unknown version " + val.version);
|
|
}
|
|
for (key in fields) {
|
|
type = fields[key];
|
|
if (type.size != null) {
|
|
size += type.size(val[key], ctx);
|
|
}
|
|
}
|
|
if (includePointers) {
|
|
size += ctx.pointerSize;
|
|
}
|
|
return size;
|
|
};
|
|
|
|
VersionedStruct.prototype.encode = function(stream, val, parent) {
|
|
var ctx, fields, i, key, ptr, type, _ref, _ref1;
|
|
if ((_ref = this.preEncode) != null) {
|
|
_ref.call(val, stream);
|
|
}
|
|
ctx = {
|
|
pointers: [],
|
|
startOffset: stream.pos,
|
|
parent: parent,
|
|
val: val,
|
|
pointerSize: 0
|
|
};
|
|
ctx.pointerOffset = stream.pos + this.size(val, ctx, false);
|
|
if (typeof this.type !== 'string') {
|
|
this.type.encode(stream, val.version);
|
|
}
|
|
if (this.versions.header) {
|
|
_ref1 = this.versions.header;
|
|
for (key in _ref1) {
|
|
type = _ref1[key];
|
|
if (type.encode != null) {
|
|
type.encode(stream, val[key], ctx);
|
|
}
|
|
}
|
|
}
|
|
fields = this.versions[val.version];
|
|
for (key in fields) {
|
|
type = fields[key];
|
|
if (type.encode != null) {
|
|
type.encode(stream, val[key], ctx);
|
|
}
|
|
}
|
|
i = 0;
|
|
while (i < ctx.pointers.length) {
|
|
ptr = ctx.pointers[i++];
|
|
ptr.type.encode(stream, ptr.val, ptr.parent);
|
|
}
|
|
};
|
|
|
|
return VersionedStruct;
|
|
|
|
})(Struct);
|
|
|
|
module.exports = VersionedStruct;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 118 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
(function() {
|
|
var Pointer, VoidPointer, utils;
|
|
|
|
utils = __webpack_require__(107);
|
|
|
|
Pointer = (function() {
|
|
function Pointer(offsetType, type, options) {
|
|
var _base, _base1, _base2, _base3;
|
|
this.offsetType = offsetType;
|
|
this.type = type;
|
|
this.options = options != null ? options : {};
|
|
if (this.type === 'void') {
|
|
this.type = null;
|
|
}
|
|
if ((_base = this.options).type == null) {
|
|
_base.type = 'local';
|
|
}
|
|
if ((_base1 = this.options).allowNull == null) {
|
|
_base1.allowNull = true;
|
|
}
|
|
if ((_base2 = this.options).nullValue == null) {
|
|
_base2.nullValue = 0;
|
|
}
|
|
if ((_base3 = this.options).lazy == null) {
|
|
_base3.lazy = false;
|
|
}
|
|
if (this.options.relativeTo) {
|
|
this.relativeToGetter = new Function('ctx', "return ctx." + this.options.relativeTo);
|
|
}
|
|
}
|
|
|
|
Pointer.prototype.decode = function(stream, ctx) {
|
|
var c, decodeValue, offset, ptr, relative, val;
|
|
offset = this.offsetType.decode(stream, ctx);
|
|
if (offset === this.options.nullValue && this.options.allowNull) {
|
|
return null;
|
|
}
|
|
relative = (function() {
|
|
switch (this.options.type) {
|
|
case 'local':
|
|
return ctx._startOffset;
|
|
case 'immediate':
|
|
return stream.pos - this.offsetType.size();
|
|
case 'parent':
|
|
return ctx.parent._startOffset;
|
|
default:
|
|
c = ctx;
|
|
while (c.parent) {
|
|
c = c.parent;
|
|
}
|
|
return c._startOffset || 0;
|
|
}
|
|
}).call(this);
|
|
if (this.options.relativeTo) {
|
|
relative += this.relativeToGetter(ctx);
|
|
}
|
|
ptr = offset + relative;
|
|
if (this.type != null) {
|
|
val = null;
|
|
decodeValue = (function(_this) {
|
|
return function() {
|
|
var pos;
|
|
if (val != null) {
|
|
return val;
|
|
}
|
|
pos = stream.pos;
|
|
stream.pos = ptr;
|
|
val = _this.type.decode(stream, ctx);
|
|
stream.pos = pos;
|
|
return val;
|
|
};
|
|
})(this);
|
|
if (this.options.lazy) {
|
|
return new utils.PropertyDescriptor({
|
|
get: decodeValue
|
|
});
|
|
}
|
|
return decodeValue();
|
|
} else {
|
|
return ptr;
|
|
}
|
|
};
|
|
|
|
Pointer.prototype.size = function(val, ctx) {
|
|
var parent, type;
|
|
parent = ctx;
|
|
switch (this.options.type) {
|
|
case 'local':
|
|
case 'immediate':
|
|
break;
|
|
case 'parent':
|
|
ctx = ctx.parent;
|
|
break;
|
|
default:
|
|
while (ctx.parent) {
|
|
ctx = ctx.parent;
|
|
}
|
|
}
|
|
type = this.type;
|
|
if (type == null) {
|
|
if (!(val instanceof VoidPointer)) {
|
|
throw new Error("Must be a VoidPointer");
|
|
}
|
|
type = val.type;
|
|
val = val.value;
|
|
}
|
|
if (val && ctx) {
|
|
ctx.pointerSize += type.size(val, parent);
|
|
}
|
|
return this.offsetType.size();
|
|
};
|
|
|
|
Pointer.prototype.encode = function(stream, val, ctx) {
|
|
var parent, relative, type;
|
|
parent = ctx;
|
|
if (val == null) {
|
|
this.offsetType.encode(stream, this.options.nullValue);
|
|
return;
|
|
}
|
|
switch (this.options.type) {
|
|
case 'local':
|
|
relative = ctx.startOffset;
|
|
break;
|
|
case 'immediate':
|
|
relative = stream.pos + this.offsetType.size(val, parent);
|
|
break;
|
|
case 'parent':
|
|
ctx = ctx.parent;
|
|
relative = ctx.startOffset;
|
|
break;
|
|
default:
|
|
relative = 0;
|
|
while (ctx.parent) {
|
|
ctx = ctx.parent;
|
|
}
|
|
}
|
|
if (this.options.relativeTo) {
|
|
relative += this.relativeToGetter(parent.val);
|
|
}
|
|
this.offsetType.encode(stream, ctx.pointerOffset - relative);
|
|
type = this.type;
|
|
if (type == null) {
|
|
if (!(val instanceof VoidPointer)) {
|
|
throw new Error("Must be a VoidPointer");
|
|
}
|
|
type = val.type;
|
|
val = val.value;
|
|
}
|
|
ctx.pointers.push({
|
|
type: type,
|
|
val: val,
|
|
parent: parent
|
|
});
|
|
return ctx.pointerOffset += type.size(val, parent);
|
|
};
|
|
|
|
return Pointer;
|
|
|
|
})();
|
|
|
|
VoidPointer = (function() {
|
|
function VoidPointer(type, value) {
|
|
this.type = type;
|
|
this.value = value;
|
|
}
|
|
|
|
return VoidPointer;
|
|
|
|
})();
|
|
|
|
exports.Pointer = Pointer;
|
|
|
|
exports.VoidPointer = VoidPointer;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 119 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(120), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 120 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(121);
|
|
var $Object = __webpack_require__(139).Object;
|
|
module.exports = function getOwnPropertyDescriptor(it, key){
|
|
return $Object.getOwnPropertyDescriptor(it, key);
|
|
};
|
|
|
|
/***/ },
|
|
/* 121 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
|
|
var toIObject = __webpack_require__(122)
|
|
, $getOwnPropertyDescriptor = __webpack_require__(126).f;
|
|
|
|
__webpack_require__(137)('getOwnPropertyDescriptor', function(){
|
|
return function getOwnPropertyDescriptor(it, key){
|
|
return $getOwnPropertyDescriptor(toIObject(it), key);
|
|
};
|
|
});
|
|
|
|
/***/ },
|
|
/* 122 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// to indexed object, toObject with fallback for non-array-like ES3 strings
|
|
var IObject = __webpack_require__(123)
|
|
, defined = __webpack_require__(125);
|
|
module.exports = function(it){
|
|
return IObject(defined(it));
|
|
};
|
|
|
|
/***/ },
|
|
/* 123 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
var cof = __webpack_require__(124);
|
|
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
|
|
return cof(it) == 'String' ? it.split('') : Object(it);
|
|
};
|
|
|
|
/***/ },
|
|
/* 124 */
|
|
/***/ function(module, exports) {
|
|
|
|
var toString = {}.toString;
|
|
|
|
module.exports = function(it){
|
|
return toString.call(it).slice(8, -1);
|
|
};
|
|
|
|
/***/ },
|
|
/* 125 */
|
|
/***/ function(module, exports) {
|
|
|
|
// 7.2.1 RequireObjectCoercible(argument)
|
|
module.exports = function(it){
|
|
if(it == undefined)throw TypeError("Can't call method on " + it);
|
|
return it;
|
|
};
|
|
|
|
/***/ },
|
|
/* 126 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var pIE = __webpack_require__(127)
|
|
, createDesc = __webpack_require__(128)
|
|
, toIObject = __webpack_require__(122)
|
|
, toPrimitive = __webpack_require__(129)
|
|
, has = __webpack_require__(131)
|
|
, IE8_DOM_DEFINE = __webpack_require__(132)
|
|
, gOPD = Object.getOwnPropertyDescriptor;
|
|
|
|
exports.f = __webpack_require__(133) ? gOPD : function getOwnPropertyDescriptor(O, P){
|
|
O = toIObject(O);
|
|
P = toPrimitive(P, true);
|
|
if(IE8_DOM_DEFINE)try {
|
|
return gOPD(O, P);
|
|
} catch(e){ /* empty */ }
|
|
if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]);
|
|
};
|
|
|
|
/***/ },
|
|
/* 127 */
|
|
/***/ function(module, exports) {
|
|
|
|
exports.f = {}.propertyIsEnumerable;
|
|
|
|
/***/ },
|
|
/* 128 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = function(bitmap, value){
|
|
return {
|
|
enumerable : !(bitmap & 1),
|
|
configurable: !(bitmap & 2),
|
|
writable : !(bitmap & 4),
|
|
value : value
|
|
};
|
|
};
|
|
|
|
/***/ },
|
|
/* 129 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 7.1.1 ToPrimitive(input [, PreferredType])
|
|
var isObject = __webpack_require__(130);
|
|
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
|
|
// and the second argument - flag - preferred type is a string
|
|
module.exports = function(it, S){
|
|
if(!isObject(it))return it;
|
|
var fn, val;
|
|
if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
|
|
if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
|
|
if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
|
|
throw TypeError("Can't convert object to primitive value");
|
|
};
|
|
|
|
/***/ },
|
|
/* 130 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = function(it){
|
|
return typeof it === 'object' ? it !== null : typeof it === 'function';
|
|
};
|
|
|
|
/***/ },
|
|
/* 131 */
|
|
/***/ function(module, exports) {
|
|
|
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
module.exports = function(it, key){
|
|
return hasOwnProperty.call(it, key);
|
|
};
|
|
|
|
/***/ },
|
|
/* 132 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = !__webpack_require__(133) && !__webpack_require__(134)(function(){
|
|
return Object.defineProperty(__webpack_require__(135)('div'), 'a', {get: function(){ return 7; }}).a != 7;
|
|
});
|
|
|
|
/***/ },
|
|
/* 133 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Thank's IE8 for his funny defineProperty
|
|
module.exports = !__webpack_require__(134)(function(){
|
|
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
|
|
});
|
|
|
|
/***/ },
|
|
/* 134 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = function(exec){
|
|
try {
|
|
return !!exec();
|
|
} catch(e){
|
|
return true;
|
|
}
|
|
};
|
|
|
|
/***/ },
|
|
/* 135 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var isObject = __webpack_require__(130)
|
|
, document = __webpack_require__(136).document
|
|
// in old IE typeof document.createElement is 'object'
|
|
, is = isObject(document) && isObject(document.createElement);
|
|
module.exports = function(it){
|
|
return is ? document.createElement(it) : {};
|
|
};
|
|
|
|
/***/ },
|
|
/* 136 */
|
|
/***/ function(module, exports) {
|
|
|
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
var global = module.exports = typeof window != 'undefined' && window.Math == Math
|
|
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
|
|
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
|
|
|
|
/***/ },
|
|
/* 137 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// most Object methods by ES6 should accept primitives
|
|
var $export = __webpack_require__(138)
|
|
, core = __webpack_require__(139)
|
|
, fails = __webpack_require__(134);
|
|
module.exports = function(KEY, exec){
|
|
var fn = (core.Object || {})[KEY] || Object[KEY]
|
|
, exp = {};
|
|
exp[KEY] = exec(fn);
|
|
$export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
|
|
};
|
|
|
|
/***/ },
|
|
/* 138 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var global = __webpack_require__(136)
|
|
, core = __webpack_require__(139)
|
|
, ctx = __webpack_require__(140)
|
|
, hide = __webpack_require__(142)
|
|
, PROTOTYPE = 'prototype';
|
|
|
|
var $export = function(type, name, source){
|
|
var IS_FORCED = type & $export.F
|
|
, IS_GLOBAL = type & $export.G
|
|
, IS_STATIC = type & $export.S
|
|
, IS_PROTO = type & $export.P
|
|
, IS_BIND = type & $export.B
|
|
, IS_WRAP = type & $export.W
|
|
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
|
|
, expProto = exports[PROTOTYPE]
|
|
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
|
|
, key, own, out;
|
|
if(IS_GLOBAL)source = name;
|
|
for(key in source){
|
|
// contains in native
|
|
own = !IS_FORCED && target && target[key] !== undefined;
|
|
if(own && key in exports)continue;
|
|
// export native or passed
|
|
out = own ? target[key] : source[key];
|
|
// prevent global pollution for namespaces
|
|
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
|
|
// bind timers to global for call from export context
|
|
: IS_BIND && own ? ctx(out, global)
|
|
// wrap global constructors for prevent change them in library
|
|
: IS_WRAP && target[key] == out ? (function(C){
|
|
var F = function(a, b, c){
|
|
if(this instanceof C){
|
|
switch(arguments.length){
|
|
case 0: return new C;
|
|
case 1: return new C(a);
|
|
case 2: return new C(a, b);
|
|
} return new C(a, b, c);
|
|
} return C.apply(this, arguments);
|
|
};
|
|
F[PROTOTYPE] = C[PROTOTYPE];
|
|
return F;
|
|
// make static versions for prototype methods
|
|
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
|
|
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
|
|
if(IS_PROTO){
|
|
(exports.virtual || (exports.virtual = {}))[key] = out;
|
|
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
|
|
if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
|
|
}
|
|
}
|
|
};
|
|
// type bitmap
|
|
$export.F = 1; // forced
|
|
$export.G = 2; // global
|
|
$export.S = 4; // static
|
|
$export.P = 8; // proto
|
|
$export.B = 16; // bind
|
|
$export.W = 32; // wrap
|
|
$export.U = 64; // safe
|
|
$export.R = 128; // real proto method for `library`
|
|
module.exports = $export;
|
|
|
|
/***/ },
|
|
/* 139 */
|
|
/***/ function(module, exports) {
|
|
|
|
var core = module.exports = {version: '2.4.0'};
|
|
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
|
|
|
|
/***/ },
|
|
/* 140 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// optional / simple context binding
|
|
var aFunction = __webpack_require__(141);
|
|
module.exports = function(fn, that, length){
|
|
aFunction(fn);
|
|
if(that === undefined)return fn;
|
|
switch(length){
|
|
case 1: return function(a){
|
|
return fn.call(that, a);
|
|
};
|
|
case 2: return function(a, b){
|
|
return fn.call(that, a, b);
|
|
};
|
|
case 3: return function(a, b, c){
|
|
return fn.call(that, a, b, c);
|
|
};
|
|
}
|
|
return function(/* ...args */){
|
|
return fn.apply(that, arguments);
|
|
};
|
|
};
|
|
|
|
/***/ },
|
|
/* 141 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = function(it){
|
|
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
|
|
return it;
|
|
};
|
|
|
|
/***/ },
|
|
/* 142 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var dP = __webpack_require__(143)
|
|
, createDesc = __webpack_require__(128);
|
|
module.exports = __webpack_require__(133) ? function(object, key, value){
|
|
return dP.f(object, key, createDesc(1, value));
|
|
} : function(object, key, value){
|
|
object[key] = value;
|
|
return object;
|
|
};
|
|
|
|
/***/ },
|
|
/* 143 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var anObject = __webpack_require__(144)
|
|
, IE8_DOM_DEFINE = __webpack_require__(132)
|
|
, toPrimitive = __webpack_require__(129)
|
|
, dP = Object.defineProperty;
|
|
|
|
exports.f = __webpack_require__(133) ? Object.defineProperty : function defineProperty(O, P, Attributes){
|
|
anObject(O);
|
|
P = toPrimitive(P, true);
|
|
anObject(Attributes);
|
|
if(IE8_DOM_DEFINE)try {
|
|
return dP(O, P, Attributes);
|
|
} catch(e){ /* empty */ }
|
|
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
|
|
if('value' in Attributes)O[P] = Attributes.value;
|
|
return O;
|
|
};
|
|
|
|
/***/ },
|
|
/* 144 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var isObject = __webpack_require__(130);
|
|
module.exports = function(it){
|
|
if(!isObject(it))throw TypeError(it + ' is not an object!');
|
|
return it;
|
|
};
|
|
|
|
/***/ },
|
|
/* 145 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(146), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 146 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(147);
|
|
__webpack_require__(173);
|
|
module.exports = __webpack_require__(175);
|
|
|
|
/***/ },
|
|
/* 147 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(148);
|
|
var global = __webpack_require__(136)
|
|
, hide = __webpack_require__(142)
|
|
, Iterators = __webpack_require__(151)
|
|
, TO_STRING_TAG = __webpack_require__(170)('toStringTag');
|
|
|
|
for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
|
|
var NAME = collections[i]
|
|
, Collection = global[NAME]
|
|
, proto = Collection && Collection.prototype;
|
|
if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);
|
|
Iterators[NAME] = Iterators.Array;
|
|
}
|
|
|
|
/***/ },
|
|
/* 148 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
var addToUnscopables = __webpack_require__(149)
|
|
, step = __webpack_require__(150)
|
|
, Iterators = __webpack_require__(151)
|
|
, toIObject = __webpack_require__(122);
|
|
|
|
// 22.1.3.4 Array.prototype.entries()
|
|
// 22.1.3.13 Array.prototype.keys()
|
|
// 22.1.3.29 Array.prototype.values()
|
|
// 22.1.3.30 Array.prototype[@@iterator]()
|
|
module.exports = __webpack_require__(152)(Array, 'Array', function(iterated, kind){
|
|
this._t = toIObject(iterated); // target
|
|
this._i = 0; // next index
|
|
this._k = kind; // kind
|
|
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
|
|
}, function(){
|
|
var O = this._t
|
|
, kind = this._k
|
|
, index = this._i++;
|
|
if(!O || index >= O.length){
|
|
this._t = undefined;
|
|
return step(1);
|
|
}
|
|
if(kind == 'keys' )return step(0, index);
|
|
if(kind == 'values')return step(0, O[index]);
|
|
return step(0, [index, O[index]]);
|
|
}, 'values');
|
|
|
|
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
|
|
Iterators.Arguments = Iterators.Array;
|
|
|
|
addToUnscopables('keys');
|
|
addToUnscopables('values');
|
|
addToUnscopables('entries');
|
|
|
|
/***/ },
|
|
/* 149 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = function(){ /* empty */ };
|
|
|
|
/***/ },
|
|
/* 150 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = function(done, value){
|
|
return {value: value, done: !!done};
|
|
};
|
|
|
|
/***/ },
|
|
/* 151 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = {};
|
|
|
|
/***/ },
|
|
/* 152 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
var LIBRARY = __webpack_require__(153)
|
|
, $export = __webpack_require__(138)
|
|
, redefine = __webpack_require__(154)
|
|
, hide = __webpack_require__(142)
|
|
, has = __webpack_require__(131)
|
|
, Iterators = __webpack_require__(151)
|
|
, $iterCreate = __webpack_require__(155)
|
|
, setToStringTag = __webpack_require__(169)
|
|
, getPrototypeOf = __webpack_require__(171)
|
|
, ITERATOR = __webpack_require__(170)('iterator')
|
|
, BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
|
|
, FF_ITERATOR = '@@iterator'
|
|
, KEYS = 'keys'
|
|
, VALUES = 'values';
|
|
|
|
var returnThis = function(){ return this; };
|
|
|
|
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
|
|
$iterCreate(Constructor, NAME, next);
|
|
var getMethod = function(kind){
|
|
if(!BUGGY && kind in proto)return proto[kind];
|
|
switch(kind){
|
|
case KEYS: return function keys(){ return new Constructor(this, kind); };
|
|
case VALUES: return function values(){ return new Constructor(this, kind); };
|
|
} return function entries(){ return new Constructor(this, kind); };
|
|
};
|
|
var TAG = NAME + ' Iterator'
|
|
, DEF_VALUES = DEFAULT == VALUES
|
|
, VALUES_BUG = false
|
|
, proto = Base.prototype
|
|
, $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
|
|
, $default = $native || getMethod(DEFAULT)
|
|
, $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
|
|
, $anyNative = NAME == 'Array' ? proto.entries || $native : $native
|
|
, methods, key, IteratorPrototype;
|
|
// Fix native
|
|
if($anyNative){
|
|
IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
|
|
if(IteratorPrototype !== Object.prototype){
|
|
// Set @@toStringTag to native iterators
|
|
setToStringTag(IteratorPrototype, TAG, true);
|
|
// fix for some old engines
|
|
if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
|
|
}
|
|
}
|
|
// fix Array#{values, @@iterator}.name in V8 / FF
|
|
if(DEF_VALUES && $native && $native.name !== VALUES){
|
|
VALUES_BUG = true;
|
|
$default = function values(){ return $native.call(this); };
|
|
}
|
|
// Define iterator
|
|
if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
|
|
hide(proto, ITERATOR, $default);
|
|
}
|
|
// Plug for library
|
|
Iterators[NAME] = $default;
|
|
Iterators[TAG] = returnThis;
|
|
if(DEFAULT){
|
|
methods = {
|
|
values: DEF_VALUES ? $default : getMethod(VALUES),
|
|
keys: IS_SET ? $default : getMethod(KEYS),
|
|
entries: $entries
|
|
};
|
|
if(FORCED)for(key in methods){
|
|
if(!(key in proto))redefine(proto, key, methods[key]);
|
|
} else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
|
|
}
|
|
return methods;
|
|
};
|
|
|
|
/***/ },
|
|
/* 153 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = true;
|
|
|
|
/***/ },
|
|
/* 154 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(142);
|
|
|
|
/***/ },
|
|
/* 155 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
var create = __webpack_require__(156)
|
|
, descriptor = __webpack_require__(128)
|
|
, setToStringTag = __webpack_require__(169)
|
|
, IteratorPrototype = {};
|
|
|
|
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
|
|
__webpack_require__(142)(IteratorPrototype, __webpack_require__(170)('iterator'), function(){ return this; });
|
|
|
|
module.exports = function(Constructor, NAME, next){
|
|
Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
|
|
setToStringTag(Constructor, NAME + ' Iterator');
|
|
};
|
|
|
|
/***/ },
|
|
/* 156 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
|
|
var anObject = __webpack_require__(144)
|
|
, dPs = __webpack_require__(157)
|
|
, enumBugKeys = __webpack_require__(167)
|
|
, IE_PROTO = __webpack_require__(164)('IE_PROTO')
|
|
, Empty = function(){ /* empty */ }
|
|
, PROTOTYPE = 'prototype';
|
|
|
|
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
var createDict = function(){
|
|
// Thrash, waste and sodomy: IE GC bug
|
|
var iframe = __webpack_require__(135)('iframe')
|
|
, i = enumBugKeys.length
|
|
, lt = '<'
|
|
, gt = '>'
|
|
, iframeDocument;
|
|
iframe.style.display = 'none';
|
|
__webpack_require__(168).appendChild(iframe);
|
|
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
|
|
// createDict = iframe.contentWindow.Object;
|
|
// html.removeChild(iframe);
|
|
iframeDocument = iframe.contentWindow.document;
|
|
iframeDocument.open();
|
|
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
|
|
iframeDocument.close();
|
|
createDict = iframeDocument.F;
|
|
while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];
|
|
return createDict();
|
|
};
|
|
|
|
module.exports = Object.create || function create(O, Properties){
|
|
var result;
|
|
if(O !== null){
|
|
Empty[PROTOTYPE] = anObject(O);
|
|
result = new Empty;
|
|
Empty[PROTOTYPE] = null;
|
|
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
result[IE_PROTO] = O;
|
|
} else result = createDict();
|
|
return Properties === undefined ? result : dPs(result, Properties);
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 157 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var dP = __webpack_require__(143)
|
|
, anObject = __webpack_require__(144)
|
|
, getKeys = __webpack_require__(158);
|
|
|
|
module.exports = __webpack_require__(133) ? Object.defineProperties : function defineProperties(O, Properties){
|
|
anObject(O);
|
|
var keys = getKeys(Properties)
|
|
, length = keys.length
|
|
, i = 0
|
|
, P;
|
|
while(length > i)dP.f(O, P = keys[i++], Properties[P]);
|
|
return O;
|
|
};
|
|
|
|
/***/ },
|
|
/* 158 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
|
|
var $keys = __webpack_require__(159)
|
|
, enumBugKeys = __webpack_require__(167);
|
|
|
|
module.exports = Object.keys || function keys(O){
|
|
return $keys(O, enumBugKeys);
|
|
};
|
|
|
|
/***/ },
|
|
/* 159 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var has = __webpack_require__(131)
|
|
, toIObject = __webpack_require__(122)
|
|
, arrayIndexOf = __webpack_require__(160)(false)
|
|
, IE_PROTO = __webpack_require__(164)('IE_PROTO');
|
|
|
|
module.exports = function(object, names){
|
|
var O = toIObject(object)
|
|
, i = 0
|
|
, result = []
|
|
, key;
|
|
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
|
|
// Don't enum bug & hidden keys
|
|
while(names.length > i)if(has(O, key = names[i++])){
|
|
~arrayIndexOf(result, key) || result.push(key);
|
|
}
|
|
return result;
|
|
};
|
|
|
|
/***/ },
|
|
/* 160 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// false -> Array#indexOf
|
|
// true -> Array#includes
|
|
var toIObject = __webpack_require__(122)
|
|
, toLength = __webpack_require__(161)
|
|
, toIndex = __webpack_require__(163);
|
|
module.exports = function(IS_INCLUDES){
|
|
return function($this, el, fromIndex){
|
|
var O = toIObject($this)
|
|
, length = toLength(O.length)
|
|
, index = toIndex(fromIndex, length)
|
|
, value;
|
|
// Array#includes uses SameValueZero equality algorithm
|
|
if(IS_INCLUDES && el != el)while(length > index){
|
|
value = O[index++];
|
|
if(value != value)return true;
|
|
// Array#toIndex ignores holes, Array#includes - not
|
|
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
|
|
if(O[index] === el)return IS_INCLUDES || index || 0;
|
|
} return !IS_INCLUDES && -1;
|
|
};
|
|
};
|
|
|
|
/***/ },
|
|
/* 161 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 7.1.15 ToLength
|
|
var toInteger = __webpack_require__(162)
|
|
, min = Math.min;
|
|
module.exports = function(it){
|
|
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
|
|
};
|
|
|
|
/***/ },
|
|
/* 162 */
|
|
/***/ function(module, exports) {
|
|
|
|
// 7.1.4 ToInteger
|
|
var ceil = Math.ceil
|
|
, floor = Math.floor;
|
|
module.exports = function(it){
|
|
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
|
};
|
|
|
|
/***/ },
|
|
/* 163 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var toInteger = __webpack_require__(162)
|
|
, max = Math.max
|
|
, min = Math.min;
|
|
module.exports = function(index, length){
|
|
index = toInteger(index);
|
|
return index < 0 ? max(index + length, 0) : min(index, length);
|
|
};
|
|
|
|
/***/ },
|
|
/* 164 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var shared = __webpack_require__(165)('keys')
|
|
, uid = __webpack_require__(166);
|
|
module.exports = function(key){
|
|
return shared[key] || (shared[key] = uid(key));
|
|
};
|
|
|
|
/***/ },
|
|
/* 165 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var global = __webpack_require__(136)
|
|
, SHARED = '__core-js_shared__'
|
|
, store = global[SHARED] || (global[SHARED] = {});
|
|
module.exports = function(key){
|
|
return store[key] || (store[key] = {});
|
|
};
|
|
|
|
/***/ },
|
|
/* 166 */
|
|
/***/ function(module, exports) {
|
|
|
|
var id = 0
|
|
, px = Math.random();
|
|
module.exports = function(key){
|
|
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
|
};
|
|
|
|
/***/ },
|
|
/* 167 */
|
|
/***/ function(module, exports) {
|
|
|
|
// IE 8- don't enum bug keys
|
|
module.exports = (
|
|
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
|
|
).split(',');
|
|
|
|
/***/ },
|
|
/* 168 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(136).document && document.documentElement;
|
|
|
|
/***/ },
|
|
/* 169 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var def = __webpack_require__(143).f
|
|
, has = __webpack_require__(131)
|
|
, TAG = __webpack_require__(170)('toStringTag');
|
|
|
|
module.exports = function(it, tag, stat){
|
|
if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
|
|
};
|
|
|
|
/***/ },
|
|
/* 170 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var store = __webpack_require__(165)('wks')
|
|
, uid = __webpack_require__(166)
|
|
, Symbol = __webpack_require__(136).Symbol
|
|
, USE_SYMBOL = typeof Symbol == 'function';
|
|
|
|
var $exports = module.exports = function(name){
|
|
return store[name] || (store[name] =
|
|
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
|
|
};
|
|
|
|
$exports.store = store;
|
|
|
|
/***/ },
|
|
/* 171 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
|
|
var has = __webpack_require__(131)
|
|
, toObject = __webpack_require__(172)
|
|
, IE_PROTO = __webpack_require__(164)('IE_PROTO')
|
|
, ObjectProto = Object.prototype;
|
|
|
|
module.exports = Object.getPrototypeOf || function(O){
|
|
O = toObject(O);
|
|
if(has(O, IE_PROTO))return O[IE_PROTO];
|
|
if(typeof O.constructor == 'function' && O instanceof O.constructor){
|
|
return O.constructor.prototype;
|
|
} return O instanceof Object ? ObjectProto : null;
|
|
};
|
|
|
|
/***/ },
|
|
/* 172 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 7.1.13 ToObject(argument)
|
|
var defined = __webpack_require__(125);
|
|
module.exports = function(it){
|
|
return Object(defined(it));
|
|
};
|
|
|
|
/***/ },
|
|
/* 173 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
var $at = __webpack_require__(174)(true);
|
|
|
|
// 21.1.3.27 String.prototype[@@iterator]()
|
|
__webpack_require__(152)(String, 'String', function(iterated){
|
|
this._t = String(iterated); // target
|
|
this._i = 0; // next index
|
|
// 21.1.5.2.1 %StringIteratorPrototype%.next()
|
|
}, function(){
|
|
var O = this._t
|
|
, index = this._i
|
|
, point;
|
|
if(index >= O.length)return {value: undefined, done: true};
|
|
point = $at(O, index);
|
|
this._i += point.length;
|
|
return {value: point, done: false};
|
|
});
|
|
|
|
/***/ },
|
|
/* 174 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var toInteger = __webpack_require__(162)
|
|
, defined = __webpack_require__(125);
|
|
// true -> String#at
|
|
// false -> String#codePointAt
|
|
module.exports = function(TO_STRING){
|
|
return function(that, pos){
|
|
var s = String(defined(that))
|
|
, i = toInteger(pos)
|
|
, l = s.length
|
|
, a, b;
|
|
if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
|
|
a = s.charCodeAt(i);
|
|
return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
|
|
? TO_STRING ? s.charAt(i) : a
|
|
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
|
|
};
|
|
};
|
|
|
|
/***/ },
|
|
/* 175 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var anObject = __webpack_require__(144)
|
|
, get = __webpack_require__(176);
|
|
module.exports = __webpack_require__(139).getIterator = function(it){
|
|
var iterFn = get(it);
|
|
if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!');
|
|
return anObject(iterFn.call(it));
|
|
};
|
|
|
|
/***/ },
|
|
/* 176 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var classof = __webpack_require__(177)
|
|
, ITERATOR = __webpack_require__(170)('iterator')
|
|
, Iterators = __webpack_require__(151);
|
|
module.exports = __webpack_require__(139).getIteratorMethod = function(it){
|
|
if(it != undefined)return it[ITERATOR]
|
|
|| it['@@iterator']
|
|
|| Iterators[classof(it)];
|
|
};
|
|
|
|
/***/ },
|
|
/* 177 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// getting tag from 19.1.3.6 Object.prototype.toString()
|
|
var cof = __webpack_require__(124)
|
|
, TAG = __webpack_require__(170)('toStringTag')
|
|
// ES3 wrong here
|
|
, ARG = cof(function(){ return arguments; }()) == 'Arguments';
|
|
|
|
// fallback for IE11 Script Access Denied error
|
|
var tryGet = function(it, key){
|
|
try {
|
|
return it[key];
|
|
} catch(e){ /* empty */ }
|
|
};
|
|
|
|
module.exports = function(it){
|
|
var O, T, B;
|
|
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
// @@toStringTag case
|
|
: typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
|
|
// builtinTag case
|
|
: ARG ? cof(O)
|
|
// ES3 arguments fallback
|
|
: (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
|
|
};
|
|
|
|
/***/ },
|
|
/* 178 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(179), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 179 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(180);
|
|
module.exports = __webpack_require__(139).Object.freeze;
|
|
|
|
/***/ },
|
|
/* 180 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 19.1.2.5 Object.freeze(O)
|
|
var isObject = __webpack_require__(130)
|
|
, meta = __webpack_require__(181).onFreeze;
|
|
|
|
__webpack_require__(137)('freeze', function($freeze){
|
|
return function freeze(it){
|
|
return $freeze && isObject(it) ? $freeze(meta(it)) : it;
|
|
};
|
|
});
|
|
|
|
/***/ },
|
|
/* 181 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var META = __webpack_require__(166)('meta')
|
|
, isObject = __webpack_require__(130)
|
|
, has = __webpack_require__(131)
|
|
, setDesc = __webpack_require__(143).f
|
|
, id = 0;
|
|
var isExtensible = Object.isExtensible || function(){
|
|
return true;
|
|
};
|
|
var FREEZE = !__webpack_require__(134)(function(){
|
|
return isExtensible(Object.preventExtensions({}));
|
|
});
|
|
var setMeta = function(it){
|
|
setDesc(it, META, {value: {
|
|
i: 'O' + ++id, // object ID
|
|
w: {} // weak collections IDs
|
|
}});
|
|
};
|
|
var fastKey = function(it, create){
|
|
// return primitive with prefix
|
|
if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
|
|
if(!has(it, META)){
|
|
// can't set metadata to uncaught frozen object
|
|
if(!isExtensible(it))return 'F';
|
|
// not necessary to add metadata
|
|
if(!create)return 'E';
|
|
// add missing metadata
|
|
setMeta(it);
|
|
// return object ID
|
|
} return it[META].i;
|
|
};
|
|
var getWeak = function(it, create){
|
|
if(!has(it, META)){
|
|
// can't set metadata to uncaught frozen object
|
|
if(!isExtensible(it))return true;
|
|
// not necessary to add metadata
|
|
if(!create)return false;
|
|
// add missing metadata
|
|
setMeta(it);
|
|
// return hash weak collections IDs
|
|
} return it[META].w;
|
|
};
|
|
// add metadata on freeze-family methods calling
|
|
var onFreeze = function(it){
|
|
if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it);
|
|
return it;
|
|
};
|
|
var meta = module.exports = {
|
|
KEY: META,
|
|
NEED: false,
|
|
fastKey: fastKey,
|
|
getWeak: getWeak,
|
|
onFreeze: onFreeze
|
|
};
|
|
|
|
/***/ },
|
|
/* 182 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(183), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 183 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(184);
|
|
module.exports = __webpack_require__(139).Object.keys;
|
|
|
|
/***/ },
|
|
/* 184 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 19.1.2.14 Object.keys(O)
|
|
var toObject = __webpack_require__(172)
|
|
, $keys = __webpack_require__(158);
|
|
|
|
__webpack_require__(137)('keys', function(){
|
|
return function keys(it){
|
|
return $keys(toObject(it));
|
|
};
|
|
});
|
|
|
|
/***/ },
|
|
/* 185 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _iterator = __webpack_require__(186);
|
|
|
|
var _iterator2 = _interopRequireDefault(_iterator);
|
|
|
|
var _symbol = __webpack_require__(189);
|
|
|
|
var _symbol2 = _interopRequireDefault(_symbol);
|
|
|
|
var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
|
|
return typeof obj === "undefined" ? "undefined" : _typeof(obj);
|
|
} : function (obj) {
|
|
return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
|
|
};
|
|
|
|
/***/ },
|
|
/* 186 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(187), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 187 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(173);
|
|
__webpack_require__(147);
|
|
module.exports = __webpack_require__(188).f('iterator');
|
|
|
|
/***/ },
|
|
/* 188 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
exports.f = __webpack_require__(170);
|
|
|
|
/***/ },
|
|
/* 189 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(190), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 190 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(191);
|
|
__webpack_require__(199);
|
|
__webpack_require__(200);
|
|
__webpack_require__(201);
|
|
module.exports = __webpack_require__(139).Symbol;
|
|
|
|
/***/ },
|
|
/* 191 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
// ECMAScript 6 symbols shim
|
|
var global = __webpack_require__(136)
|
|
, has = __webpack_require__(131)
|
|
, DESCRIPTORS = __webpack_require__(133)
|
|
, $export = __webpack_require__(138)
|
|
, redefine = __webpack_require__(154)
|
|
, META = __webpack_require__(181).KEY
|
|
, $fails = __webpack_require__(134)
|
|
, shared = __webpack_require__(165)
|
|
, setToStringTag = __webpack_require__(169)
|
|
, uid = __webpack_require__(166)
|
|
, wks = __webpack_require__(170)
|
|
, wksExt = __webpack_require__(188)
|
|
, wksDefine = __webpack_require__(192)
|
|
, keyOf = __webpack_require__(193)
|
|
, enumKeys = __webpack_require__(194)
|
|
, isArray = __webpack_require__(196)
|
|
, anObject = __webpack_require__(144)
|
|
, toIObject = __webpack_require__(122)
|
|
, toPrimitive = __webpack_require__(129)
|
|
, createDesc = __webpack_require__(128)
|
|
, _create = __webpack_require__(156)
|
|
, gOPNExt = __webpack_require__(197)
|
|
, $GOPD = __webpack_require__(126)
|
|
, $DP = __webpack_require__(143)
|
|
, $keys = __webpack_require__(158)
|
|
, gOPD = $GOPD.f
|
|
, dP = $DP.f
|
|
, gOPN = gOPNExt.f
|
|
, $Symbol = global.Symbol
|
|
, $JSON = global.JSON
|
|
, _stringify = $JSON && $JSON.stringify
|
|
, PROTOTYPE = 'prototype'
|
|
, HIDDEN = wks('_hidden')
|
|
, TO_PRIMITIVE = wks('toPrimitive')
|
|
, isEnum = {}.propertyIsEnumerable
|
|
, SymbolRegistry = shared('symbol-registry')
|
|
, AllSymbols = shared('symbols')
|
|
, OPSymbols = shared('op-symbols')
|
|
, ObjectProto = Object[PROTOTYPE]
|
|
, USE_NATIVE = typeof $Symbol == 'function'
|
|
, QObject = global.QObject;
|
|
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
|
|
var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
|
|
|
|
// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
|
|
var setSymbolDesc = DESCRIPTORS && $fails(function(){
|
|
return _create(dP({}, 'a', {
|
|
get: function(){ return dP(this, 'a', {value: 7}).a; }
|
|
})).a != 7;
|
|
}) ? function(it, key, D){
|
|
var protoDesc = gOPD(ObjectProto, key);
|
|
if(protoDesc)delete ObjectProto[key];
|
|
dP(it, key, D);
|
|
if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc);
|
|
} : dP;
|
|
|
|
var wrap = function(tag){
|
|
var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
|
|
sym._k = tag;
|
|
return sym;
|
|
};
|
|
|
|
var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){
|
|
return typeof it == 'symbol';
|
|
} : function(it){
|
|
return it instanceof $Symbol;
|
|
};
|
|
|
|
var $defineProperty = function defineProperty(it, key, D){
|
|
if(it === ObjectProto)$defineProperty(OPSymbols, key, D);
|
|
anObject(it);
|
|
key = toPrimitive(key, true);
|
|
anObject(D);
|
|
if(has(AllSymbols, key)){
|
|
if(!D.enumerable){
|
|
if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {}));
|
|
it[HIDDEN][key] = true;
|
|
} else {
|
|
if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
|
|
D = _create(D, {enumerable: createDesc(0, false)});
|
|
} return setSymbolDesc(it, key, D);
|
|
} return dP(it, key, D);
|
|
};
|
|
var $defineProperties = function defineProperties(it, P){
|
|
anObject(it);
|
|
var keys = enumKeys(P = toIObject(P))
|
|
, i = 0
|
|
, l = keys.length
|
|
, key;
|
|
while(l > i)$defineProperty(it, key = keys[i++], P[key]);
|
|
return it;
|
|
};
|
|
var $create = function create(it, P){
|
|
return P === undefined ? _create(it) : $defineProperties(_create(it), P);
|
|
};
|
|
var $propertyIsEnumerable = function propertyIsEnumerable(key){
|
|
var E = isEnum.call(this, key = toPrimitive(key, true));
|
|
if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false;
|
|
return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
|
|
};
|
|
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
|
|
it = toIObject(it);
|
|
key = toPrimitive(key, true);
|
|
if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return;
|
|
var D = gOPD(it, key);
|
|
if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
|
|
return D;
|
|
};
|
|
var $getOwnPropertyNames = function getOwnPropertyNames(it){
|
|
var names = gOPN(toIObject(it))
|
|
, result = []
|
|
, i = 0
|
|
, key;
|
|
while(names.length > i){
|
|
if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key);
|
|
} return result;
|
|
};
|
|
var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
|
|
var IS_OP = it === ObjectProto
|
|
, names = gOPN(IS_OP ? OPSymbols : toIObject(it))
|
|
, result = []
|
|
, i = 0
|
|
, key;
|
|
while(names.length > i){
|
|
if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]);
|
|
} return result;
|
|
};
|
|
|
|
// 19.4.1.1 Symbol([description])
|
|
if(!USE_NATIVE){
|
|
$Symbol = function Symbol(){
|
|
if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!');
|
|
var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
|
|
var $set = function(value){
|
|
if(this === ObjectProto)$set.call(OPSymbols, value);
|
|
if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
|
|
setSymbolDesc(this, tag, createDesc(1, value));
|
|
};
|
|
if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set});
|
|
return wrap(tag);
|
|
};
|
|
redefine($Symbol[PROTOTYPE], 'toString', function toString(){
|
|
return this._k;
|
|
});
|
|
|
|
$GOPD.f = $getOwnPropertyDescriptor;
|
|
$DP.f = $defineProperty;
|
|
__webpack_require__(198).f = gOPNExt.f = $getOwnPropertyNames;
|
|
__webpack_require__(127).f = $propertyIsEnumerable;
|
|
__webpack_require__(195).f = $getOwnPropertySymbols;
|
|
|
|
if(DESCRIPTORS && !__webpack_require__(153)){
|
|
redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
|
|
}
|
|
|
|
wksExt.f = function(name){
|
|
return wrap(wks(name));
|
|
}
|
|
}
|
|
|
|
$export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol});
|
|
|
|
for(var symbols = (
|
|
// 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
|
|
'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
|
|
).split(','), i = 0; symbols.length > i; )wks(symbols[i++]);
|
|
|
|
for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]);
|
|
|
|
$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
|
|
// 19.4.2.1 Symbol.for(key)
|
|
'for': function(key){
|
|
return has(SymbolRegistry, key += '')
|
|
? SymbolRegistry[key]
|
|
: SymbolRegistry[key] = $Symbol(key);
|
|
},
|
|
// 19.4.2.5 Symbol.keyFor(sym)
|
|
keyFor: function keyFor(key){
|
|
if(isSymbol(key))return keyOf(SymbolRegistry, key);
|
|
throw TypeError(key + ' is not a symbol!');
|
|
},
|
|
useSetter: function(){ setter = true; },
|
|
useSimple: function(){ setter = false; }
|
|
});
|
|
|
|
$export($export.S + $export.F * !USE_NATIVE, 'Object', {
|
|
// 19.1.2.2 Object.create(O [, Properties])
|
|
create: $create,
|
|
// 19.1.2.4 Object.defineProperty(O, P, Attributes)
|
|
defineProperty: $defineProperty,
|
|
// 19.1.2.3 Object.defineProperties(O, Properties)
|
|
defineProperties: $defineProperties,
|
|
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
|
|
getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
|
|
// 19.1.2.7 Object.getOwnPropertyNames(O)
|
|
getOwnPropertyNames: $getOwnPropertyNames,
|
|
// 19.1.2.8 Object.getOwnPropertySymbols(O)
|
|
getOwnPropertySymbols: $getOwnPropertySymbols
|
|
});
|
|
|
|
// 24.3.2 JSON.stringify(value [, replacer [, space]])
|
|
$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){
|
|
var S = $Symbol();
|
|
// MS Edge converts symbol values to JSON as {}
|
|
// WebKit converts symbol values to JSON as null
|
|
// V8 throws on boxed symbols
|
|
return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
|
|
})), 'JSON', {
|
|
stringify: function stringify(it){
|
|
if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
|
|
var args = [it]
|
|
, i = 1
|
|
, replacer, $replacer;
|
|
while(arguments.length > i)args.push(arguments[i++]);
|
|
replacer = args[1];
|
|
if(typeof replacer == 'function')$replacer = replacer;
|
|
if($replacer || !isArray(replacer))replacer = function(key, value){
|
|
if($replacer)value = $replacer.call(this, key, value);
|
|
if(!isSymbol(value))return value;
|
|
};
|
|
args[1] = replacer;
|
|
return _stringify.apply($JSON, args);
|
|
}
|
|
});
|
|
|
|
// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
|
|
$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(142)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
|
|
// 19.4.3.5 Symbol.prototype[@@toStringTag]
|
|
setToStringTag($Symbol, 'Symbol');
|
|
// 20.2.1.9 Math[@@toStringTag]
|
|
setToStringTag(Math, 'Math', true);
|
|
// 24.3.3 JSON[@@toStringTag]
|
|
setToStringTag(global.JSON, 'JSON', true);
|
|
|
|
/***/ },
|
|
/* 192 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var global = __webpack_require__(136)
|
|
, core = __webpack_require__(139)
|
|
, LIBRARY = __webpack_require__(153)
|
|
, wksExt = __webpack_require__(188)
|
|
, defineProperty = __webpack_require__(143).f;
|
|
module.exports = function(name){
|
|
var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
|
|
if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)});
|
|
};
|
|
|
|
/***/ },
|
|
/* 193 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var getKeys = __webpack_require__(158)
|
|
, toIObject = __webpack_require__(122);
|
|
module.exports = function(object, el){
|
|
var O = toIObject(object)
|
|
, keys = getKeys(O)
|
|
, length = keys.length
|
|
, index = 0
|
|
, key;
|
|
while(length > index)if(O[key = keys[index++]] === el)return key;
|
|
};
|
|
|
|
/***/ },
|
|
/* 194 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// all enumerable object keys, includes symbols
|
|
var getKeys = __webpack_require__(158)
|
|
, gOPS = __webpack_require__(195)
|
|
, pIE = __webpack_require__(127);
|
|
module.exports = function(it){
|
|
var result = getKeys(it)
|
|
, getSymbols = gOPS.f;
|
|
if(getSymbols){
|
|
var symbols = getSymbols(it)
|
|
, isEnum = pIE.f
|
|
, i = 0
|
|
, key;
|
|
while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key);
|
|
} return result;
|
|
};
|
|
|
|
/***/ },
|
|
/* 195 */
|
|
/***/ function(module, exports) {
|
|
|
|
exports.f = Object.getOwnPropertySymbols;
|
|
|
|
/***/ },
|
|
/* 196 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 7.2.2 IsArray(argument)
|
|
var cof = __webpack_require__(124);
|
|
module.exports = Array.isArray || function isArray(arg){
|
|
return cof(arg) == 'Array';
|
|
};
|
|
|
|
/***/ },
|
|
/* 197 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
|
|
var toIObject = __webpack_require__(122)
|
|
, gOPN = __webpack_require__(198).f
|
|
, toString = {}.toString;
|
|
|
|
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
|
|
? Object.getOwnPropertyNames(window) : [];
|
|
|
|
var getWindowNames = function(it){
|
|
try {
|
|
return gOPN(it);
|
|
} catch(e){
|
|
return windowNames.slice();
|
|
}
|
|
};
|
|
|
|
module.exports.f = function getOwnPropertyNames(it){
|
|
return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 198 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
|
|
var $keys = __webpack_require__(159)
|
|
, hiddenKeys = __webpack_require__(167).concat('length', 'prototype');
|
|
|
|
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){
|
|
return $keys(O, hiddenKeys);
|
|
};
|
|
|
|
/***/ },
|
|
/* 199 */
|
|
/***/ function(module, exports) {
|
|
|
|
|
|
|
|
/***/ },
|
|
/* 200 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(192)('asyncIterator');
|
|
|
|
/***/ },
|
|
/* 201 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(192)('observable');
|
|
|
|
/***/ },
|
|
/* 202 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(203), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 203 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(204);
|
|
var $Object = __webpack_require__(139).Object;
|
|
module.exports = function defineProperty(it, key, desc){
|
|
return $Object.defineProperty(it, key, desc);
|
|
};
|
|
|
|
/***/ },
|
|
/* 204 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var $export = __webpack_require__(138);
|
|
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
|
|
$export($export.S + $export.F * !__webpack_require__(133), 'Object', {defineProperty: __webpack_require__(143).f});
|
|
|
|
/***/ },
|
|
/* 205 */
|
|
/***/ function(module, exports) {
|
|
|
|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
|
|
exports.default = function (instance, Constructor) {
|
|
if (!(instance instanceof Constructor)) {
|
|
throw new TypeError("Cannot call a class as a function");
|
|
}
|
|
};
|
|
|
|
/***/ },
|
|
/* 206 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _defineProperty = __webpack_require__(202);
|
|
|
|
var _defineProperty2 = _interopRequireDefault(_defineProperty);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.default = function () {
|
|
function defineProperties(target, props) {
|
|
for (var i = 0; i < props.length; i++) {
|
|
var descriptor = props[i];
|
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
descriptor.configurable = true;
|
|
if ("value" in descriptor) descriptor.writable = true;
|
|
(0, _defineProperty2.default)(target, descriptor.key, descriptor);
|
|
}
|
|
}
|
|
|
|
return function (Constructor, protoProps, staticProps) {
|
|
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
if (staticProps) defineProperties(Constructor, staticProps);
|
|
return Constructor;
|
|
};
|
|
}();
|
|
|
|
/***/ },
|
|
/* 207 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(208), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 208 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(199);
|
|
__webpack_require__(173);
|
|
__webpack_require__(147);
|
|
__webpack_require__(209);
|
|
__webpack_require__(221);
|
|
module.exports = __webpack_require__(139).Map;
|
|
|
|
/***/ },
|
|
/* 209 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
var strong = __webpack_require__(210);
|
|
|
|
// 23.1 Map Objects
|
|
module.exports = __webpack_require__(217)('Map', function(get){
|
|
return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
|
|
}, {
|
|
// 23.1.3.6 Map.prototype.get(key)
|
|
get: function get(key){
|
|
var entry = strong.getEntry(this, key);
|
|
return entry && entry.v;
|
|
},
|
|
// 23.1.3.9 Map.prototype.set(key, value)
|
|
set: function set(key, value){
|
|
return strong.def(this, key === 0 ? 0 : key, value);
|
|
}
|
|
}, strong, true);
|
|
|
|
/***/ },
|
|
/* 210 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
var dP = __webpack_require__(143).f
|
|
, create = __webpack_require__(156)
|
|
, redefineAll = __webpack_require__(211)
|
|
, ctx = __webpack_require__(140)
|
|
, anInstance = __webpack_require__(212)
|
|
, defined = __webpack_require__(125)
|
|
, forOf = __webpack_require__(213)
|
|
, $iterDefine = __webpack_require__(152)
|
|
, step = __webpack_require__(150)
|
|
, setSpecies = __webpack_require__(216)
|
|
, DESCRIPTORS = __webpack_require__(133)
|
|
, fastKey = __webpack_require__(181).fastKey
|
|
, SIZE = DESCRIPTORS ? '_s' : 'size';
|
|
|
|
var getEntry = function(that, key){
|
|
// fast case
|
|
var index = fastKey(key), entry;
|
|
if(index !== 'F')return that._i[index];
|
|
// frozen object case
|
|
for(entry = that._f; entry; entry = entry.n){
|
|
if(entry.k == key)return entry;
|
|
}
|
|
};
|
|
|
|
module.exports = {
|
|
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
|
|
var C = wrapper(function(that, iterable){
|
|
anInstance(that, C, NAME, '_i');
|
|
that._i = create(null); // index
|
|
that._f = undefined; // first entry
|
|
that._l = undefined; // last entry
|
|
that[SIZE] = 0; // size
|
|
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
|
|
});
|
|
redefineAll(C.prototype, {
|
|
// 23.1.3.1 Map.prototype.clear()
|
|
// 23.2.3.2 Set.prototype.clear()
|
|
clear: function clear(){
|
|
for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){
|
|
entry.r = true;
|
|
if(entry.p)entry.p = entry.p.n = undefined;
|
|
delete data[entry.i];
|
|
}
|
|
that._f = that._l = undefined;
|
|
that[SIZE] = 0;
|
|
},
|
|
// 23.1.3.3 Map.prototype.delete(key)
|
|
// 23.2.3.4 Set.prototype.delete(value)
|
|
'delete': function(key){
|
|
var that = this
|
|
, entry = getEntry(that, key);
|
|
if(entry){
|
|
var next = entry.n
|
|
, prev = entry.p;
|
|
delete that._i[entry.i];
|
|
entry.r = true;
|
|
if(prev)prev.n = next;
|
|
if(next)next.p = prev;
|
|
if(that._f == entry)that._f = next;
|
|
if(that._l == entry)that._l = prev;
|
|
that[SIZE]--;
|
|
} return !!entry;
|
|
},
|
|
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
|
|
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
|
|
forEach: function forEach(callbackfn /*, that = undefined */){
|
|
anInstance(this, C, 'forEach');
|
|
var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3)
|
|
, entry;
|
|
while(entry = entry ? entry.n : this._f){
|
|
f(entry.v, entry.k, this);
|
|
// revert to the last existing entry
|
|
while(entry && entry.r)entry = entry.p;
|
|
}
|
|
},
|
|
// 23.1.3.7 Map.prototype.has(key)
|
|
// 23.2.3.7 Set.prototype.has(value)
|
|
has: function has(key){
|
|
return !!getEntry(this, key);
|
|
}
|
|
});
|
|
if(DESCRIPTORS)dP(C.prototype, 'size', {
|
|
get: function(){
|
|
return defined(this[SIZE]);
|
|
}
|
|
});
|
|
return C;
|
|
},
|
|
def: function(that, key, value){
|
|
var entry = getEntry(that, key)
|
|
, prev, index;
|
|
// change existing entry
|
|
if(entry){
|
|
entry.v = value;
|
|
// create new entry
|
|
} else {
|
|
that._l = entry = {
|
|
i: index = fastKey(key, true), // <- index
|
|
k: key, // <- key
|
|
v: value, // <- value
|
|
p: prev = that._l, // <- previous entry
|
|
n: undefined, // <- next entry
|
|
r: false // <- removed
|
|
};
|
|
if(!that._f)that._f = entry;
|
|
if(prev)prev.n = entry;
|
|
that[SIZE]++;
|
|
// add to index
|
|
if(index !== 'F')that._i[index] = entry;
|
|
} return that;
|
|
},
|
|
getEntry: getEntry,
|
|
setStrong: function(C, NAME, IS_MAP){
|
|
// add .keys, .values, .entries, [@@iterator]
|
|
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
|
|
$iterDefine(C, NAME, function(iterated, kind){
|
|
this._t = iterated; // target
|
|
this._k = kind; // kind
|
|
this._l = undefined; // previous
|
|
}, function(){
|
|
var that = this
|
|
, kind = that._k
|
|
, entry = that._l;
|
|
// revert to the last existing entry
|
|
while(entry && entry.r)entry = entry.p;
|
|
// get next entry
|
|
if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){
|
|
// or finish the iteration
|
|
that._t = undefined;
|
|
return step(1);
|
|
}
|
|
// return step by kind
|
|
if(kind == 'keys' )return step(0, entry.k);
|
|
if(kind == 'values')return step(0, entry.v);
|
|
return step(0, [entry.k, entry.v]);
|
|
}, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);
|
|
|
|
// add [@@species], 23.1.2.2, 23.2.2.2
|
|
setSpecies(NAME);
|
|
}
|
|
};
|
|
|
|
/***/ },
|
|
/* 211 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var hide = __webpack_require__(142);
|
|
module.exports = function(target, src, safe){
|
|
for(var key in src){
|
|
if(safe && target[key])target[key] = src[key];
|
|
else hide(target, key, src[key]);
|
|
} return target;
|
|
};
|
|
|
|
/***/ },
|
|
/* 212 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = function(it, Constructor, name, forbiddenField){
|
|
if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){
|
|
throw TypeError(name + ': incorrect invocation!');
|
|
} return it;
|
|
};
|
|
|
|
/***/ },
|
|
/* 213 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var ctx = __webpack_require__(140)
|
|
, call = __webpack_require__(214)
|
|
, isArrayIter = __webpack_require__(215)
|
|
, anObject = __webpack_require__(144)
|
|
, toLength = __webpack_require__(161)
|
|
, getIterFn = __webpack_require__(176)
|
|
, BREAK = {}
|
|
, RETURN = {};
|
|
var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){
|
|
var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable)
|
|
, f = ctx(fn, that, entries ? 2 : 1)
|
|
, index = 0
|
|
, length, step, iterator, result;
|
|
if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
|
|
// fast case for arrays with default iterator
|
|
if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
|
|
result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
|
|
if(result === BREAK || result === RETURN)return result;
|
|
} else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
|
|
result = call(iterator, f, step.value, entries);
|
|
if(result === BREAK || result === RETURN)return result;
|
|
}
|
|
};
|
|
exports.BREAK = BREAK;
|
|
exports.RETURN = RETURN;
|
|
|
|
/***/ },
|
|
/* 214 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// call something on iterator step with safe closing on error
|
|
var anObject = __webpack_require__(144);
|
|
module.exports = function(iterator, fn, value, entries){
|
|
try {
|
|
return entries ? fn(anObject(value)[0], value[1]) : fn(value);
|
|
// 7.4.6 IteratorClose(iterator, completion)
|
|
} catch(e){
|
|
var ret = iterator['return'];
|
|
if(ret !== undefined)anObject(ret.call(iterator));
|
|
throw e;
|
|
}
|
|
};
|
|
|
|
/***/ },
|
|
/* 215 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// check on default Array iterator
|
|
var Iterators = __webpack_require__(151)
|
|
, ITERATOR = __webpack_require__(170)('iterator')
|
|
, ArrayProto = Array.prototype;
|
|
|
|
module.exports = function(it){
|
|
return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
|
|
};
|
|
|
|
/***/ },
|
|
/* 216 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
var global = __webpack_require__(136)
|
|
, core = __webpack_require__(139)
|
|
, dP = __webpack_require__(143)
|
|
, DESCRIPTORS = __webpack_require__(133)
|
|
, SPECIES = __webpack_require__(170)('species');
|
|
|
|
module.exports = function(KEY){
|
|
var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
|
|
if(DESCRIPTORS && C && !C[SPECIES])dP.f(C, SPECIES, {
|
|
configurable: true,
|
|
get: function(){ return this; }
|
|
});
|
|
};
|
|
|
|
/***/ },
|
|
/* 217 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
var global = __webpack_require__(136)
|
|
, $export = __webpack_require__(138)
|
|
, meta = __webpack_require__(181)
|
|
, fails = __webpack_require__(134)
|
|
, hide = __webpack_require__(142)
|
|
, redefineAll = __webpack_require__(211)
|
|
, forOf = __webpack_require__(213)
|
|
, anInstance = __webpack_require__(212)
|
|
, isObject = __webpack_require__(130)
|
|
, setToStringTag = __webpack_require__(169)
|
|
, dP = __webpack_require__(143).f
|
|
, each = __webpack_require__(218)(0)
|
|
, DESCRIPTORS = __webpack_require__(133);
|
|
|
|
module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
|
|
var Base = global[NAME]
|
|
, C = Base
|
|
, ADDER = IS_MAP ? 'set' : 'add'
|
|
, proto = C && C.prototype
|
|
, O = {};
|
|
if(!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){
|
|
new C().entries().next();
|
|
}))){
|
|
// create collection constructor
|
|
C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
|
|
redefineAll(C.prototype, methods);
|
|
meta.NEED = true;
|
|
} else {
|
|
C = wrapper(function(target, iterable){
|
|
anInstance(target, C, NAME, '_c');
|
|
target._c = new Base;
|
|
if(iterable != undefined)forOf(iterable, IS_MAP, target[ADDER], target);
|
|
});
|
|
each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','),function(KEY){
|
|
var IS_ADDER = KEY == 'add' || KEY == 'set';
|
|
if(KEY in proto && !(IS_WEAK && KEY == 'clear'))hide(C.prototype, KEY, function(a, b){
|
|
anInstance(this, C, KEY);
|
|
if(!IS_ADDER && IS_WEAK && !isObject(a))return KEY == 'get' ? undefined : false;
|
|
var result = this._c[KEY](a === 0 ? 0 : a, b);
|
|
return IS_ADDER ? this : result;
|
|
});
|
|
});
|
|
if('size' in proto)dP(C.prototype, 'size', {
|
|
get: function(){
|
|
return this._c.size;
|
|
}
|
|
});
|
|
}
|
|
|
|
setToStringTag(C, NAME);
|
|
|
|
O[NAME] = C;
|
|
$export($export.G + $export.W + $export.F, O);
|
|
|
|
if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);
|
|
|
|
return C;
|
|
};
|
|
|
|
/***/ },
|
|
/* 218 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 0 -> Array#forEach
|
|
// 1 -> Array#map
|
|
// 2 -> Array#filter
|
|
// 3 -> Array#some
|
|
// 4 -> Array#every
|
|
// 5 -> Array#find
|
|
// 6 -> Array#findIndex
|
|
var ctx = __webpack_require__(140)
|
|
, IObject = __webpack_require__(123)
|
|
, toObject = __webpack_require__(172)
|
|
, toLength = __webpack_require__(161)
|
|
, asc = __webpack_require__(219);
|
|
module.exports = function(TYPE, $create){
|
|
var IS_MAP = TYPE == 1
|
|
, IS_FILTER = TYPE == 2
|
|
, IS_SOME = TYPE == 3
|
|
, IS_EVERY = TYPE == 4
|
|
, IS_FIND_INDEX = TYPE == 6
|
|
, NO_HOLES = TYPE == 5 || IS_FIND_INDEX
|
|
, create = $create || asc;
|
|
return function($this, callbackfn, that){
|
|
var O = toObject($this)
|
|
, self = IObject(O)
|
|
, f = ctx(callbackfn, that, 3)
|
|
, length = toLength(self.length)
|
|
, index = 0
|
|
, result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined
|
|
, val, res;
|
|
for(;length > index; index++)if(NO_HOLES || index in self){
|
|
val = self[index];
|
|
res = f(val, index, O);
|
|
if(TYPE){
|
|
if(IS_MAP)result[index] = res; // map
|
|
else if(res)switch(TYPE){
|
|
case 3: return true; // some
|
|
case 5: return val; // find
|
|
case 6: return index; // findIndex
|
|
case 2: result.push(val); // filter
|
|
} else if(IS_EVERY)return false; // every
|
|
}
|
|
}
|
|
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
|
|
};
|
|
};
|
|
|
|
/***/ },
|
|
/* 219 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
|
|
var speciesConstructor = __webpack_require__(220);
|
|
|
|
module.exports = function(original, length){
|
|
return new (speciesConstructor(original))(length);
|
|
};
|
|
|
|
/***/ },
|
|
/* 220 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var isObject = __webpack_require__(130)
|
|
, isArray = __webpack_require__(196)
|
|
, SPECIES = __webpack_require__(170)('species');
|
|
|
|
module.exports = function(original){
|
|
var C;
|
|
if(isArray(original)){
|
|
C = original.constructor;
|
|
// cross-realm fallback
|
|
if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined;
|
|
if(isObject(C)){
|
|
C = C[SPECIES];
|
|
if(C === null)C = undefined;
|
|
}
|
|
} return C === undefined ? Array : C;
|
|
};
|
|
|
|
/***/ },
|
|
/* 221 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
|
|
var $export = __webpack_require__(138);
|
|
|
|
$export($export.P + $export.R, 'Map', {toJSON: __webpack_require__(222)('Map')});
|
|
|
|
/***/ },
|
|
/* 222 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
|
|
var classof = __webpack_require__(177)
|
|
, from = __webpack_require__(223);
|
|
module.exports = function(NAME){
|
|
return function toJSON(){
|
|
if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic");
|
|
return from(this);
|
|
};
|
|
};
|
|
|
|
/***/ },
|
|
/* 223 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var forOf = __webpack_require__(213);
|
|
|
|
module.exports = function(iter, ITERATOR){
|
|
var result = [];
|
|
forOf(iter, false, result.push, result, ITERATOR);
|
|
return result;
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 224 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(225), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 225 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(226);
|
|
module.exports = __webpack_require__(139).Object.getPrototypeOf;
|
|
|
|
/***/ },
|
|
/* 226 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 19.1.2.9 Object.getPrototypeOf(O)
|
|
var toObject = __webpack_require__(172)
|
|
, $getPrototypeOf = __webpack_require__(171);
|
|
|
|
__webpack_require__(137)('getPrototypeOf', function(){
|
|
return function getPrototypeOf(it){
|
|
return $getPrototypeOf(toObject(it));
|
|
};
|
|
});
|
|
|
|
/***/ },
|
|
/* 227 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _typeof2 = __webpack_require__(185);
|
|
|
|
var _typeof3 = _interopRequireDefault(_typeof2);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.default = function (self, call) {
|
|
if (!self) {
|
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
}
|
|
|
|
return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
|
|
};
|
|
|
|
/***/ },
|
|
/* 228 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _setPrototypeOf = __webpack_require__(229);
|
|
|
|
var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
|
|
|
|
var _create = __webpack_require__(233);
|
|
|
|
var _create2 = _interopRequireDefault(_create);
|
|
|
|
var _typeof2 = __webpack_require__(185);
|
|
|
|
var _typeof3 = _interopRequireDefault(_typeof2);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.default = function (subClass, superClass) {
|
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
|
|
}
|
|
|
|
subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
|
|
constructor: {
|
|
value: subClass,
|
|
enumerable: false,
|
|
writable: true,
|
|
configurable: true
|
|
}
|
|
});
|
|
if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
|
|
};
|
|
|
|
/***/ },
|
|
/* 229 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(230), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 230 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(231);
|
|
module.exports = __webpack_require__(139).Object.setPrototypeOf;
|
|
|
|
/***/ },
|
|
/* 231 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 19.1.3.19 Object.setPrototypeOf(O, proto)
|
|
var $export = __webpack_require__(138);
|
|
$export($export.S, 'Object', {setPrototypeOf: __webpack_require__(232).set});
|
|
|
|
/***/ },
|
|
/* 232 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
/* eslint-disable no-proto */
|
|
var isObject = __webpack_require__(130)
|
|
, anObject = __webpack_require__(144);
|
|
var check = function(O, proto){
|
|
anObject(O);
|
|
if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
|
|
};
|
|
module.exports = {
|
|
set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
|
|
function(test, buggy, set){
|
|
try {
|
|
set = __webpack_require__(140)(Function.call, __webpack_require__(126).f(Object.prototype, '__proto__').set, 2);
|
|
set(test, []);
|
|
buggy = !(test instanceof Array);
|
|
} catch(e){ buggy = true; }
|
|
return function setPrototypeOf(O, proto){
|
|
check(O, proto);
|
|
if(buggy)O.__proto__ = proto;
|
|
else set(O, proto);
|
|
return O;
|
|
};
|
|
}({}, false) : undefined),
|
|
check: check
|
|
};
|
|
|
|
/***/ },
|
|
/* 233 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(234), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 234 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(235);
|
|
var $Object = __webpack_require__(139).Object;
|
|
module.exports = function create(P, D){
|
|
return $Object.create(P, D);
|
|
};
|
|
|
|
/***/ },
|
|
/* 235 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var $export = __webpack_require__(138)
|
|
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
|
|
$export($export.S, 'Object', {create: __webpack_require__(156)});
|
|
|
|
/***/ },
|
|
/* 236 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(237), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 237 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(238);
|
|
var $Object = __webpack_require__(139).Object;
|
|
module.exports = function defineProperties(T, D){
|
|
return $Object.defineProperties(T, D);
|
|
};
|
|
|
|
/***/ },
|
|
/* 238 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var $export = __webpack_require__(138);
|
|
// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
|
|
$export($export.S + $export.F * !__webpack_require__(133), 'Object', {defineProperties: __webpack_require__(157)});
|
|
|
|
/***/ },
|
|
/* 239 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var pSlice = Array.prototype.slice;
|
|
var objectKeys = __webpack_require__(240);
|
|
var isArguments = __webpack_require__(241);
|
|
|
|
var deepEqual = module.exports = function (actual, expected, opts) {
|
|
if (!opts) opts = {};
|
|
// 7.1. All identical values are equivalent, as determined by ===.
|
|
if (actual === expected) {
|
|
return true;
|
|
|
|
} else if (actual instanceof Date && expected instanceof Date) {
|
|
return actual.getTime() === expected.getTime();
|
|
|
|
// 7.3. Other pairs that do not both pass typeof value == 'object',
|
|
// equivalence is determined by ==.
|
|
} else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
|
|
return opts.strict ? actual === expected : actual == expected;
|
|
|
|
// 7.4. For all other Object pairs, including Array objects, equivalence is
|
|
// determined by having the same number of owned properties (as verified
|
|
// with Object.prototype.hasOwnProperty.call), the same set of keys
|
|
// (although not necessarily the same order), equivalent values for every
|
|
// corresponding key, and an identical 'prototype' property. Note: this
|
|
// accounts for both named and indexed properties on Arrays.
|
|
} else {
|
|
return objEquiv(actual, expected, opts);
|
|
}
|
|
}
|
|
|
|
function isUndefinedOrNull(value) {
|
|
return value === null || value === undefined;
|
|
}
|
|
|
|
function isBuffer (x) {
|
|
if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
|
|
if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
|
|
return false;
|
|
}
|
|
if (x.length > 0 && typeof x[0] !== 'number') return false;
|
|
return true;
|
|
}
|
|
|
|
function objEquiv(a, b, opts) {
|
|
var i, key;
|
|
if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
|
|
return false;
|
|
// an identical 'prototype' property.
|
|
if (a.prototype !== b.prototype) return false;
|
|
//~~~I've managed to break Object.keys through screwy arguments passing.
|
|
// Converting to array solves the problem.
|
|
if (isArguments(a)) {
|
|
if (!isArguments(b)) {
|
|
return false;
|
|
}
|
|
a = pSlice.call(a);
|
|
b = pSlice.call(b);
|
|
return deepEqual(a, b, opts);
|
|
}
|
|
if (isBuffer(a)) {
|
|
if (!isBuffer(b)) {
|
|
return false;
|
|
}
|
|
if (a.length !== b.length) return false;
|
|
for (i = 0; i < a.length; i++) {
|
|
if (a[i] !== b[i]) return false;
|
|
}
|
|
return true;
|
|
}
|
|
try {
|
|
var ka = objectKeys(a),
|
|
kb = objectKeys(b);
|
|
} catch (e) {//happens when one is a string literal and the other isn't
|
|
return false;
|
|
}
|
|
// having the same number of owned properties (keys incorporates
|
|
// hasOwnProperty)
|
|
if (ka.length != kb.length)
|
|
return false;
|
|
//the same set of keys (although not necessarily the same order),
|
|
ka.sort();
|
|
kb.sort();
|
|
//~~~cheap key test
|
|
for (i = ka.length - 1; i >= 0; i--) {
|
|
if (ka[i] != kb[i])
|
|
return false;
|
|
}
|
|
//equivalent values for every corresponding key, and
|
|
//~~~possibly expensive deep test
|
|
for (i = ka.length - 1; i >= 0; i--) {
|
|
key = ka[i];
|
|
if (!deepEqual(a[key], b[key], opts)) return false;
|
|
}
|
|
return typeof a === typeof b;
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 240 */
|
|
/***/ function(module, exports) {
|
|
|
|
exports = module.exports = typeof Object.keys === 'function'
|
|
? Object.keys : shim;
|
|
|
|
exports.shim = shim;
|
|
function shim (obj) {
|
|
var keys = [];
|
|
for (var key in obj) keys.push(key);
|
|
return keys;
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 241 */
|
|
/***/ function(module, exports) {
|
|
|
|
var supportsArgumentsClass = (function(){
|
|
return Object.prototype.toString.call(arguments)
|
|
})() == '[object Arguments]';
|
|
|
|
exports = module.exports = supportsArgumentsClass ? supported : unsupported;
|
|
|
|
exports.supported = supported;
|
|
function supported(object) {
|
|
return Object.prototype.toString.call(object) == '[object Arguments]';
|
|
};
|
|
|
|
exports.unsupported = unsupported;
|
|
function unsupported(object){
|
|
return object &&
|
|
typeof object == 'object' &&
|
|
typeof object.length == 'number' &&
|
|
Object.prototype.hasOwnProperty.call(object, 'callee') &&
|
|
!Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
|
|
false;
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 242 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _getPrototypeOf = __webpack_require__(224);
|
|
|
|
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
|
|
|
var _getOwnPropertyDescriptor = __webpack_require__(119);
|
|
|
|
var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.default = function get(object, property, receiver) {
|
|
if (object === null) object = Function.prototype;
|
|
var desc = (0, _getOwnPropertyDescriptor2.default)(object, property);
|
|
|
|
if (desc === undefined) {
|
|
var parent = (0, _getPrototypeOf2.default)(object);
|
|
|
|
if (parent === null) {
|
|
return undefined;
|
|
} else {
|
|
return get(parent, property, receiver);
|
|
}
|
|
} else if ("value" in desc) {
|
|
return desc.value;
|
|
} else {
|
|
var getter = desc.get;
|
|
|
|
if (getter === undefined) {
|
|
return undefined;
|
|
}
|
|
|
|
return getter.call(receiver);
|
|
}
|
|
};
|
|
|
|
/***/ },
|
|
/* 243 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(244), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 244 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(245);
|
|
module.exports = __webpack_require__(139).Object.assign;
|
|
|
|
/***/ },
|
|
/* 245 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// 19.1.3.1 Object.assign(target, source)
|
|
var $export = __webpack_require__(138);
|
|
|
|
$export($export.S + $export.F, 'Object', {assign: __webpack_require__(246)});
|
|
|
|
/***/ },
|
|
/* 246 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
// 19.1.2.1 Object.assign(target, source, ...)
|
|
var getKeys = __webpack_require__(158)
|
|
, gOPS = __webpack_require__(195)
|
|
, pIE = __webpack_require__(127)
|
|
, toObject = __webpack_require__(172)
|
|
, IObject = __webpack_require__(123)
|
|
, $assign = Object.assign;
|
|
|
|
// should work with symbols and should have deterministic property order (V8 bug)
|
|
module.exports = !$assign || __webpack_require__(134)(function(){
|
|
var A = {}
|
|
, B = {}
|
|
, S = Symbol()
|
|
, K = 'abcdefghijklmnopqrst';
|
|
A[S] = 7;
|
|
K.split('').forEach(function(k){ B[k] = k; });
|
|
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
|
}) ? function assign(target, source){ // eslint-disable-line no-unused-vars
|
|
var T = toObject(target)
|
|
, aLen = arguments.length
|
|
, index = 1
|
|
, getSymbols = gOPS.f
|
|
, isEnum = pIE.f;
|
|
while(aLen > index){
|
|
var S = IObject(arguments[index++])
|
|
, keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
|
|
, length = keys.length
|
|
, j = 0
|
|
, key;
|
|
while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
|
|
} return T;
|
|
} : $assign;
|
|
|
|
/***/ },
|
|
/* 247 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _from = __webpack_require__(248);
|
|
|
|
var _from2 = _interopRequireDefault(_from);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.default = function (arr) {
|
|
if (Array.isArray(arr)) {
|
|
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
|
|
arr2[i] = arr[i];
|
|
}
|
|
|
|
return arr2;
|
|
} else {
|
|
return (0, _from2.default)(arr);
|
|
}
|
|
};
|
|
|
|
/***/ },
|
|
/* 248 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(249), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 249 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(173);
|
|
__webpack_require__(250);
|
|
module.exports = __webpack_require__(139).Array.from;
|
|
|
|
/***/ },
|
|
/* 250 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
var ctx = __webpack_require__(140)
|
|
, $export = __webpack_require__(138)
|
|
, toObject = __webpack_require__(172)
|
|
, call = __webpack_require__(214)
|
|
, isArrayIter = __webpack_require__(215)
|
|
, toLength = __webpack_require__(161)
|
|
, createProperty = __webpack_require__(251)
|
|
, getIterFn = __webpack_require__(176);
|
|
|
|
$export($export.S + $export.F * !__webpack_require__(252)(function(iter){ Array.from(iter); }), 'Array', {
|
|
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
|
|
from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
|
|
var O = toObject(arrayLike)
|
|
, C = typeof this == 'function' ? this : Array
|
|
, aLen = arguments.length
|
|
, mapfn = aLen > 1 ? arguments[1] : undefined
|
|
, mapping = mapfn !== undefined
|
|
, index = 0
|
|
, iterFn = getIterFn(O)
|
|
, length, result, step, iterator;
|
|
if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
|
|
// if object isn't iterable or it's array with default iterator - use simple case
|
|
if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
|
|
for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
|
|
createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
|
|
}
|
|
} else {
|
|
length = toLength(O.length);
|
|
for(result = new C(length); length > index; index++){
|
|
createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
|
|
}
|
|
}
|
|
result.length = index;
|
|
return result;
|
|
}
|
|
});
|
|
|
|
|
|
/***/ },
|
|
/* 251 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
var $defineProperty = __webpack_require__(143)
|
|
, createDesc = __webpack_require__(128);
|
|
|
|
module.exports = function(object, index, value){
|
|
if(index in object)$defineProperty.f(object, index, createDesc(0, value));
|
|
else object[index] = value;
|
|
};
|
|
|
|
/***/ },
|
|
/* 252 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var ITERATOR = __webpack_require__(170)('iterator')
|
|
, SAFE_CLOSING = false;
|
|
|
|
try {
|
|
var riter = [7][ITERATOR]();
|
|
riter['return'] = function(){ SAFE_CLOSING = true; };
|
|
Array.from(riter, function(){ throw 2; });
|
|
} catch(e){ /* empty */ }
|
|
|
|
module.exports = function(exec, skipClosing){
|
|
if(!skipClosing && !SAFE_CLOSING)return false;
|
|
var safe = false;
|
|
try {
|
|
var arr = [7]
|
|
, iter = arr[ITERATOR]();
|
|
iter.next = function(){ return {done: safe = true}; };
|
|
arr[ITERATOR] = function(){ return iter; };
|
|
exec(arr);
|
|
} catch(e){ /* empty */ }
|
|
return safe;
|
|
};
|
|
|
|
/***/ },
|
|
/* 253 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(254), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 254 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(255);
|
|
module.exports = __webpack_require__(139).String.fromCodePoint;
|
|
|
|
/***/ },
|
|
/* 255 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var $export = __webpack_require__(138)
|
|
, toIndex = __webpack_require__(163)
|
|
, fromCharCode = String.fromCharCode
|
|
, $fromCodePoint = String.fromCodePoint;
|
|
|
|
// length should be 1, old FF problem
|
|
$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
|
|
// 21.1.2.2 String.fromCodePoint(...codePoints)
|
|
fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars
|
|
var res = []
|
|
, aLen = arguments.length
|
|
, i = 0
|
|
, code;
|
|
while(aLen > i){
|
|
code = +arguments[i++];
|
|
if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
|
|
res.push(code < 0x10000
|
|
? fromCharCode(code)
|
|
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
|
|
);
|
|
} return res.join('');
|
|
}
|
|
});
|
|
|
|
/***/ },
|
|
/* 256 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _isIterable2 = __webpack_require__(257);
|
|
|
|
var _isIterable3 = _interopRequireDefault(_isIterable2);
|
|
|
|
var _getIterator2 = __webpack_require__(145);
|
|
|
|
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.default = function () {
|
|
function sliceIterator(arr, i) {
|
|
var _arr = [];
|
|
var _n = true;
|
|
var _d = false;
|
|
var _e = undefined;
|
|
|
|
try {
|
|
for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
_arr.push(_s.value);
|
|
|
|
if (i && _arr.length === i) break;
|
|
}
|
|
} catch (err) {
|
|
_d = true;
|
|
_e = err;
|
|
} finally {
|
|
try {
|
|
if (!_n && _i["return"]) _i["return"]();
|
|
} finally {
|
|
if (_d) throw _e;
|
|
}
|
|
}
|
|
|
|
return _arr;
|
|
}
|
|
|
|
return function (arr, i) {
|
|
if (Array.isArray(arr)) {
|
|
return arr;
|
|
} else if ((0, _isIterable3.default)(Object(arr))) {
|
|
return sliceIterator(arr, i);
|
|
} else {
|
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
}
|
|
};
|
|
}();
|
|
|
|
/***/ },
|
|
/* 257 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(258), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 258 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(147);
|
|
__webpack_require__(173);
|
|
module.exports = __webpack_require__(259);
|
|
|
|
/***/ },
|
|
/* 259 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var classof = __webpack_require__(177)
|
|
, ITERATOR = __webpack_require__(170)('iterator')
|
|
, Iterators = __webpack_require__(151);
|
|
module.exports = __webpack_require__(139).isIterable = function(it){
|
|
var O = Object(it);
|
|
return O[ITERATOR] !== undefined
|
|
|| '@@iterator' in O
|
|
|| Iterators.hasOwnProperty(classof(O));
|
|
};
|
|
|
|
/***/ },
|
|
/* 260 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = { "default": __webpack_require__(261), __esModule: true };
|
|
|
|
/***/ },
|
|
/* 261 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
__webpack_require__(199);
|
|
__webpack_require__(173);
|
|
__webpack_require__(147);
|
|
__webpack_require__(262);
|
|
__webpack_require__(263);
|
|
module.exports = __webpack_require__(139).Set;
|
|
|
|
/***/ },
|
|
/* 262 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
var strong = __webpack_require__(210);
|
|
|
|
// 23.2 Set Objects
|
|
module.exports = __webpack_require__(217)('Set', function(get){
|
|
return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
|
|
}, {
|
|
// 23.2.3.1 Set.prototype.add(value)
|
|
add: function add(value){
|
|
return strong.def(this, value = value === 0 ? 0 : value, value);
|
|
}
|
|
}, strong);
|
|
|
|
/***/ },
|
|
/* 263 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
|
|
var $export = __webpack_require__(138);
|
|
|
|
$export($export.P + $export.R, 'Set', {toJSON: __webpack_require__(222)('Set')});
|
|
|
|
/***/ },
|
|
/* 264 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Generated by CoffeeScript 1.9.1
|
|
var CATEGORY_BITS, CATEGORY_MASK, CATEGORY_SHIFT, COMBINING_BITS, COMBINING_MASK, COMBINING_SHIFT, EAW_BITS, EAW_MASK, EAW_SHIFT, NUMBER_BITS, NUMBER_MASK, SCRIPT_BITS, SCRIPT_MASK, SCRIPT_SHIFT, UnicodeTrie, bits, data, fs, log2, trie;
|
|
|
|
UnicodeTrie = __webpack_require__(15);
|
|
|
|
data = __webpack_require__(265);
|
|
|
|
|
|
|
|
trie = new UnicodeTrie(Buffer("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","base64"));
|
|
|
|
log2 = Math.log2 || function(n) {
|
|
return Math.log(n) / Math.LN2;
|
|
};
|
|
|
|
bits = function(n) {
|
|
return (log2(n) + 1) | 0;
|
|
};
|
|
|
|
CATEGORY_BITS = bits(data.categories.length - 1);
|
|
|
|
COMBINING_BITS = bits(data.combiningClasses.length - 1);
|
|
|
|
SCRIPT_BITS = bits(data.scripts.length - 1);
|
|
|
|
EAW_BITS = bits(data.eaw.length - 1);
|
|
|
|
NUMBER_BITS = 10;
|
|
|
|
CATEGORY_SHIFT = COMBINING_BITS + SCRIPT_BITS + EAW_BITS + NUMBER_BITS;
|
|
|
|
COMBINING_SHIFT = SCRIPT_BITS + EAW_BITS + NUMBER_BITS;
|
|
|
|
SCRIPT_SHIFT = EAW_BITS + NUMBER_BITS;
|
|
|
|
EAW_SHIFT = NUMBER_BITS;
|
|
|
|
CATEGORY_MASK = (1 << CATEGORY_BITS) - 1;
|
|
|
|
COMBINING_MASK = (1 << COMBINING_BITS) - 1;
|
|
|
|
SCRIPT_MASK = (1 << SCRIPT_BITS) - 1;
|
|
|
|
EAW_MASK = (1 << EAW_BITS) - 1;
|
|
|
|
NUMBER_MASK = (1 << NUMBER_BITS) - 1;
|
|
|
|
exports.getCategory = function(codePoint) {
|
|
var val;
|
|
val = trie.get(codePoint);
|
|
return data.categories[(val >> CATEGORY_SHIFT) & CATEGORY_MASK];
|
|
};
|
|
|
|
exports.getCombiningClass = function(codePoint) {
|
|
var val;
|
|
val = trie.get(codePoint);
|
|
return data.combiningClasses[(val >> COMBINING_SHIFT) & COMBINING_MASK];
|
|
};
|
|
|
|
exports.getScript = function(codePoint) {
|
|
var val;
|
|
val = trie.get(codePoint);
|
|
return data.scripts[(val >> SCRIPT_SHIFT) & SCRIPT_MASK];
|
|
};
|
|
|
|
exports.getEastAsianWidth = function(codePoint) {
|
|
var val;
|
|
val = trie.get(codePoint);
|
|
return data.eaw[(val >> EAW_SHIFT) & EAW_MASK];
|
|
};
|
|
|
|
exports.getNumericValue = function(codePoint) {
|
|
var denominator, exp, num, numerator, val;
|
|
val = trie.get(codePoint);
|
|
num = val & NUMBER_MASK;
|
|
if (num === 0) {
|
|
return null;
|
|
} else if (num <= 50) {
|
|
return num - 1;
|
|
} else if (num < 0x1e0) {
|
|
numerator = (num >> 4) - 12;
|
|
denominator = (num & 0xf) + 1;
|
|
return numerator / denominator;
|
|
} else if (num < 0x300) {
|
|
val = (num >> 5) - 14;
|
|
exp = (num & 0x1f) + 2;
|
|
while (exp > 0) {
|
|
val *= 10;
|
|
exp--;
|
|
}
|
|
return val;
|
|
} else {
|
|
val = (num >> 2) - 0xbf;
|
|
exp = (num & 3) + 1;
|
|
while (exp > 0) {
|
|
val *= 60;
|
|
exp--;
|
|
}
|
|
return val;
|
|
}
|
|
};
|
|
|
|
exports.isAlphabetic = function(codePoint) {
|
|
var ref;
|
|
return (ref = exports.getCategory(codePoint)) === 'Lu' || ref === 'Ll' || ref === 'Lt' || ref === 'Lm' || ref === 'Lo' || ref === 'Nl';
|
|
};
|
|
|
|
exports.isDigit = function(codePoint) {
|
|
return exports.getCategory(codePoint) === 'Nd';
|
|
};
|
|
|
|
exports.isPunctuation = function(codePoint) {
|
|
var ref;
|
|
return (ref = exports.getCategory(codePoint)) === 'Pc' || ref === 'Pd' || ref === 'Pe' || ref === 'Pf' || ref === 'Pi' || ref === 'Po' || ref === 'Ps';
|
|
};
|
|
|
|
exports.isLowerCase = function(codePoint) {
|
|
return exports.getCategory(codePoint) === 'Ll';
|
|
};
|
|
|
|
exports.isUpperCase = function(codePoint) {
|
|
return exports.getCategory(codePoint) === 'Lu';
|
|
};
|
|
|
|
exports.isTitleCase = function(codePoint) {
|
|
return exports.getCategory(codePoint) === 'Lt';
|
|
};
|
|
|
|
exports.isWhiteSpace = function(codePoint) {
|
|
var ref;
|
|
return (ref = exports.getCategory(codePoint)) === 'Zs' || ref === 'Zl' || ref === 'Zp';
|
|
};
|
|
|
|
exports.isBaseForm = function(codePoint) {
|
|
var ref;
|
|
return (ref = exports.getCategory(codePoint)) === 'Nd' || ref === 'No' || ref === 'Nl' || ref === 'Lu' || ref === 'Ll' || ref === 'Lt' || ref === 'Lm' || ref === 'Lo' || ref === 'Me' || ref === 'Mc';
|
|
};
|
|
|
|
exports.isMark = function(codePoint) {
|
|
var ref;
|
|
return (ref = exports.getCategory(codePoint)) === 'Mn' || ref === 'Me' || ref === 'Mc';
|
|
};
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 265 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = {
|
|
"categories": [
|
|
"Cc",
|
|
"Zs",
|
|
"Po",
|
|
"Sc",
|
|
"Ps",
|
|
"Pe",
|
|
"Sm",
|
|
"Pd",
|
|
"Nd",
|
|
"Lu",
|
|
"Sk",
|
|
"Pc",
|
|
"Ll",
|
|
"So",
|
|
"Lo",
|
|
"Pi",
|
|
"Cf",
|
|
"No",
|
|
"Pf",
|
|
"Lt",
|
|
"Lm",
|
|
"Mn",
|
|
"Me",
|
|
"Mc",
|
|
"Nl",
|
|
"Zl",
|
|
"Zp",
|
|
"Cs",
|
|
"Co"
|
|
],
|
|
"combiningClasses": [
|
|
"Not_Reordered",
|
|
"Above",
|
|
"Above_Right",
|
|
"Below",
|
|
"Attached_Above_Right",
|
|
"Attached_Below",
|
|
"Overlay",
|
|
"Iota_Subscript",
|
|
"Double_Below",
|
|
"Double_Above",
|
|
"Below_Right",
|
|
"Above_Left",
|
|
"CCC10",
|
|
"CCC11",
|
|
"CCC12",
|
|
"CCC13",
|
|
"CCC14",
|
|
"CCC15",
|
|
"CCC16",
|
|
"CCC17",
|
|
"CCC18",
|
|
"CCC19",
|
|
"CCC20",
|
|
"CCC21",
|
|
"CCC22",
|
|
"CCC23",
|
|
"CCC24",
|
|
"CCC25",
|
|
"CCC30",
|
|
"CCC31",
|
|
"CCC32",
|
|
"CCC27",
|
|
"CCC28",
|
|
"CCC29",
|
|
"CCC33",
|
|
"CCC34",
|
|
"CCC35",
|
|
"CCC36",
|
|
"Nukta",
|
|
"Virama",
|
|
"CCC84",
|
|
"CCC91",
|
|
"CCC103",
|
|
"CCC107",
|
|
"CCC118",
|
|
"CCC122",
|
|
"CCC129",
|
|
"CCC130",
|
|
"CCC132",
|
|
"Attached_Above",
|
|
"Below_Left",
|
|
"Left",
|
|
"Kana_Voicing",
|
|
"CCC26",
|
|
"Right"
|
|
],
|
|
"scripts": [
|
|
"Common",
|
|
"Latin",
|
|
"Bopomofo",
|
|
"Inherited",
|
|
"Greek",
|
|
"Coptic",
|
|
"Cyrillic",
|
|
"Armenian",
|
|
"Hebrew",
|
|
"Arabic",
|
|
"Syriac",
|
|
"Thaana",
|
|
"Nko",
|
|
"Samaritan",
|
|
"Mandaic",
|
|
"Devanagari",
|
|
"Bengali",
|
|
"Gurmukhi",
|
|
"Gujarati",
|
|
"Oriya",
|
|
"Tamil",
|
|
"Telugu",
|
|
"Kannada",
|
|
"Malayalam",
|
|
"Sinhala",
|
|
"Thai",
|
|
"Lao",
|
|
"Tibetan",
|
|
"Myanmar",
|
|
"Georgian",
|
|
"Hangul",
|
|
"Ethiopic",
|
|
"Cherokee",
|
|
"Canadian_Aboriginal",
|
|
"Ogham",
|
|
"Runic",
|
|
"Tagalog",
|
|
"Hanunoo",
|
|
"Buhid",
|
|
"Tagbanwa",
|
|
"Khmer",
|
|
"Mongolian",
|
|
"Limbu",
|
|
"Tai_Le",
|
|
"New_Tai_Lue",
|
|
"Buginese",
|
|
"Tai_Tham",
|
|
"Balinese",
|
|
"Sundanese",
|
|
"Batak",
|
|
"Lepcha",
|
|
"Ol_Chiki",
|
|
"Braille",
|
|
"Glagolitic",
|
|
"Tifinagh",
|
|
"Han",
|
|
"Hiragana",
|
|
"Katakana",
|
|
"Yi",
|
|
"Lisu",
|
|
"Vai",
|
|
"Bamum",
|
|
"Syloti_Nagri",
|
|
"Phags_Pa",
|
|
"Saurashtra",
|
|
"Kayah_Li",
|
|
"Rejang",
|
|
"Javanese",
|
|
"Cham",
|
|
"Tai_Viet",
|
|
"Meetei_Mayek",
|
|
"null",
|
|
"Linear_B",
|
|
"Lycian",
|
|
"Carian",
|
|
"Old_Italic",
|
|
"Gothic",
|
|
"Old_Permic",
|
|
"Ugaritic",
|
|
"Old_Persian",
|
|
"Deseret",
|
|
"Shavian",
|
|
"Osmanya",
|
|
"Elbasan",
|
|
"Caucasian_Albanian",
|
|
"Linear_A",
|
|
"Cypriot",
|
|
"Imperial_Aramaic",
|
|
"Palmyrene",
|
|
"Nabataean",
|
|
"Hatran",
|
|
"Phoenician",
|
|
"Lydian",
|
|
"Meroitic_Hieroglyphs",
|
|
"Meroitic_Cursive",
|
|
"Kharoshthi",
|
|
"Old_South_Arabian",
|
|
"Old_North_Arabian",
|
|
"Manichaean",
|
|
"Avestan",
|
|
"Inscriptional_Parthian",
|
|
"Inscriptional_Pahlavi",
|
|
"Psalter_Pahlavi",
|
|
"Old_Turkic",
|
|
"Old_Hungarian",
|
|
"Brahmi",
|
|
"Kaithi",
|
|
"Sora_Sompeng",
|
|
"Chakma",
|
|
"Mahajani",
|
|
"Sharada",
|
|
"Khojki",
|
|
"Multani",
|
|
"Khudawadi",
|
|
"Grantha",
|
|
"Tirhuta",
|
|
"Siddham",
|
|
"Modi",
|
|
"Takri",
|
|
"Ahom",
|
|
"Warang_Citi",
|
|
"Pau_Cin_Hau",
|
|
"Cuneiform",
|
|
"Egyptian_Hieroglyphs",
|
|
"Anatolian_Hieroglyphs",
|
|
"Mro",
|
|
"Bassa_Vah",
|
|
"Pahawh_Hmong",
|
|
"Miao",
|
|
"Duployan",
|
|
"SignWriting",
|
|
"Mende_Kikakui"
|
|
],
|
|
"eaw": [
|
|
"N",
|
|
"Na",
|
|
"A",
|
|
"W",
|
|
"H",
|
|
"F"
|
|
]
|
|
};
|
|
|
|
/***/ },
|
|
/* 266 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
|
|
var _slicedToArray = _interopDefault(__webpack_require__(256));
|
|
var _getIterator = _interopDefault(__webpack_require__(145));
|
|
var _defineProperty = _interopDefault(__webpack_require__(267));
|
|
var _regeneratorRuntime = _interopDefault(__webpack_require__(268));
|
|
var _Symbol$iterator = _interopDefault(__webpack_require__(186));
|
|
var _classCallCheck = _interopDefault(__webpack_require__(205));
|
|
var _createClass = _interopDefault(__webpack_require__(206));
|
|
|
|
var INITIAL_STATE = 1;
|
|
var FAIL_STATE = 0;
|
|
|
|
/**
|
|
* A StateMachine represents a deterministic finite automaton.
|
|
* It can perform matches over a sequence of values, similar to a regular expression.
|
|
*/
|
|
|
|
var StateMachine = function () {
|
|
function StateMachine(dfa) {
|
|
_classCallCheck(this, StateMachine);
|
|
|
|
this.stateTable = dfa.stateTable;
|
|
this.accepting = dfa.accepting;
|
|
this.tags = dfa.tags;
|
|
}
|
|
|
|
/**
|
|
* Returns an iterable object that yields pattern matches over the input sequence.
|
|
* Matches are of the form [startIndex, endIndex, tags].
|
|
*/
|
|
|
|
|
|
_createClass(StateMachine, [{
|
|
key: 'match',
|
|
value: function match(str) {
|
|
var self = this;
|
|
return _defineProperty({}, _Symbol$iterator, _regeneratorRuntime.mark(function _callee() {
|
|
var state, startRun, lastAccepting, lastState, p, c;
|
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
state = INITIAL_STATE;
|
|
startRun = null;
|
|
lastAccepting = null;
|
|
lastState = null;
|
|
p = 0;
|
|
|
|
case 5:
|
|
if (!(p < str.length)) {
|
|
_context.next = 21;
|
|
break;
|
|
}
|
|
|
|
c = str[p];
|
|
|
|
|
|
lastState = state;
|
|
state = self.stateTable[state][c];
|
|
|
|
if (!(state === FAIL_STATE)) {
|
|
_context.next = 15;
|
|
break;
|
|
}
|
|
|
|
if (!(startRun != null && lastAccepting != null && lastAccepting >= startRun)) {
|
|
_context.next = 13;
|
|
break;
|
|
}
|
|
|
|
_context.next = 13;
|
|
return [startRun, lastAccepting, self.tags[lastState]];
|
|
|
|
case 13:
|
|
|
|
// reset the state as if we started over from the initial state
|
|
state = self.stateTable[INITIAL_STATE][c];
|
|
startRun = null;
|
|
|
|
case 15:
|
|
|
|
// start a run if not in the failure state
|
|
if (state !== FAIL_STATE && startRun == null) {
|
|
startRun = p;
|
|
}
|
|
|
|
// if accepting, mark the potential match end
|
|
if (self.accepting[state]) {
|
|
lastAccepting = p;
|
|
}
|
|
|
|
// reset the state to the initial state if we get into the failure state
|
|
if (state === FAIL_STATE) {
|
|
state = INITIAL_STATE;
|
|
}
|
|
|
|
case 18:
|
|
p++;
|
|
_context.next = 5;
|
|
break;
|
|
|
|
case 21:
|
|
if (!(startRun != null && lastAccepting != null && lastAccepting >= startRun)) {
|
|
_context.next = 24;
|
|
break;
|
|
}
|
|
|
|
_context.next = 24;
|
|
return [startRun, lastAccepting, self.tags[state]];
|
|
|
|
case 24:
|
|
case 'end':
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}, _callee, this);
|
|
}));
|
|
}
|
|
|
|
/**
|
|
* For each match over the input sequence, action functions matching
|
|
* the tag definitions in the input pattern are called with the startIndex,
|
|
* endIndex, and sub-match sequence.
|
|
*/
|
|
|
|
}, {
|
|
key: 'apply',
|
|
value: function apply(str, actions) {
|
|
var _iteratorNormalCompletion = true;
|
|
var _didIteratorError = false;
|
|
var _iteratorError = undefined;
|
|
|
|
try {
|
|
for (var _iterator = _getIterator(this.match(str)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
var _step$value = _slicedToArray(_step.value, 3);
|
|
|
|
var start = _step$value[0];
|
|
var end = _step$value[1];
|
|
var tags = _step$value[2];
|
|
var _iteratorNormalCompletion2 = true;
|
|
var _didIteratorError2 = false;
|
|
var _iteratorError2 = undefined;
|
|
|
|
try {
|
|
for (var _iterator2 = _getIterator(tags), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
var tag = _step2.value;
|
|
|
|
if (typeof actions[tag] === 'function') {
|
|
actions[tag](start, end, str.slice(start, end + 1));
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError2 = true;
|
|
_iteratorError2 = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
_iterator2.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError2) {
|
|
throw _iteratorError2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_didIteratorError = true;
|
|
_iteratorError = err;
|
|
} finally {
|
|
try {
|
|
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
_iterator.return();
|
|
}
|
|
} finally {
|
|
if (_didIteratorError) {
|
|
throw _iteratorError;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return StateMachine;
|
|
}();
|
|
|
|
module.exports = StateMachine;
|
|
|
|
|
|
/***/ },
|
|
/* 267 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _defineProperty = __webpack_require__(202);
|
|
|
|
var _defineProperty2 = _interopRequireDefault(_defineProperty);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.default = function (obj, key, value) {
|
|
if (key in obj) {
|
|
(0, _defineProperty2.default)(obj, key, {
|
|
value: value,
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true
|
|
});
|
|
} else {
|
|
obj[key] = value;
|
|
}
|
|
|
|
return obj;
|
|
};
|
|
|
|
/***/ },
|
|
/* 268 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(269);
|
|
|
|
|
|
/***/ },
|
|
/* 269 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(global) {// This method of obtaining a reference to the global object needs to be
|
|
// kept identical to the way it is obtained in runtime.js
|
|
var g =
|
|
typeof global === "object" ? global :
|
|
typeof window === "object" ? window :
|
|
typeof self === "object" ? self : this;
|
|
|
|
// Use `getOwnPropertyNames` because not all browsers support calling
|
|
// `hasOwnProperty` on the global `self` object in a worker. See #183.
|
|
var hadRuntime = g.regeneratorRuntime &&
|
|
Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
|
|
|
|
// Save the old regeneratorRuntime in case it needs to be restored later.
|
|
var oldRuntime = hadRuntime && g.regeneratorRuntime;
|
|
|
|
// Force reevalutation of runtime.js.
|
|
g.regeneratorRuntime = undefined;
|
|
|
|
module.exports = __webpack_require__(270);
|
|
|
|
if (hadRuntime) {
|
|
// Restore the original runtime.
|
|
g.regeneratorRuntime = oldRuntime;
|
|
} else {
|
|
// Remove the global property added by runtime.js.
|
|
try {
|
|
delete g.regeneratorRuntime;
|
|
} catch(e) {
|
|
g.regeneratorRuntime = undefined;
|
|
}
|
|
}
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
|
|
|
/***/ },
|
|
/* 270 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(global, process) {/**
|
|
* Copyright (c) 2014, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An
|
|
* additional grant of patent rights can be found in the PATENTS file in
|
|
* the same directory.
|
|
*/
|
|
|
|
!(function(global) {
|
|
"use strict";
|
|
|
|
var Op = Object.prototype;
|
|
var hasOwn = Op.hasOwnProperty;
|
|
var undefined; // More compressible than void 0.
|
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
|
|
var inModule = typeof module === "object";
|
|
var runtime = global.regeneratorRuntime;
|
|
if (runtime) {
|
|
if (inModule) {
|
|
// If regeneratorRuntime is defined globally and we're in a module,
|
|
// make the exports object identical to regeneratorRuntime.
|
|
module.exports = runtime;
|
|
}
|
|
// Don't bother evaluating the rest of this file if the runtime was
|
|
// already defined globally.
|
|
return;
|
|
}
|
|
|
|
// Define the runtime globally (as expected by generated code) as either
|
|
// module.exports (if we're in a module) or a new, empty object.
|
|
runtime = global.regeneratorRuntime = inModule ? module.exports : {};
|
|
|
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
var generator = Object.create(protoGenerator.prototype);
|
|
var context = new Context(tryLocsList || []);
|
|
|
|
// The ._invoke method unifies the implementations of the .next,
|
|
// .throw, and .return methods.
|
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
|
|
return generator;
|
|
}
|
|
runtime.wrap = wrap;
|
|
|
|
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
// record like context.tryEntries[i].completion. This interface could
|
|
// have been (and was previously) designed to take a closure to be
|
|
// invoked without arguments, but in all the cases we care about we
|
|
// already have an existing method we want to call, so there's no need
|
|
// to create a new function object. We can even get away with assuming
|
|
// the method takes exactly one argument, since that happens to be true
|
|
// in every case, so we don't have to touch the arguments object. The
|
|
// only additional allocation required is the completion record, which
|
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
function tryCatch(fn, obj, arg) {
|
|
try {
|
|
return { type: "normal", arg: fn.call(obj, arg) };
|
|
} catch (err) {
|
|
return { type: "throw", arg: err };
|
|
}
|
|
}
|
|
|
|
var GenStateSuspendedStart = "suspendedStart";
|
|
var GenStateSuspendedYield = "suspendedYield";
|
|
var GenStateExecuting = "executing";
|
|
var GenStateCompleted = "completed";
|
|
|
|
// Returning this object from the innerFn has the same effect as
|
|
// breaking out of the dispatch switch statement.
|
|
var ContinueSentinel = {};
|
|
|
|
// Dummy constructor functions that we use as the .constructor and
|
|
// .constructor.prototype properties for functions that return Generator
|
|
// objects. For full spec compliance, you may wish to configure your
|
|
// minifier not to mangle the names of these two functions.
|
|
function Generator() {}
|
|
function GeneratorFunction() {}
|
|
function GeneratorFunctionPrototype() {}
|
|
|
|
// This is a polyfill for %IteratorPrototype% for environments that
|
|
// don't natively support it.
|
|
var IteratorPrototype = {};
|
|
IteratorPrototype[iteratorSymbol] = function () {
|
|
return this;
|
|
};
|
|
|
|
var getProto = Object.getPrototypeOf;
|
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
if (NativeIteratorPrototype &&
|
|
NativeIteratorPrototype !== Op &&
|
|
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
// of the polyfill.
|
|
IteratorPrototype = NativeIteratorPrototype;
|
|
}
|
|
|
|
var Gp = GeneratorFunctionPrototype.prototype =
|
|
Generator.prototype = Object.create(IteratorPrototype);
|
|
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
|
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
|
GeneratorFunctionPrototype[toStringTagSymbol] =
|
|
GeneratorFunction.displayName = "GeneratorFunction";
|
|
|
|
// Helper for defining the .next, .throw, and .return methods of the
|
|
// Iterator interface in terms of a single ._invoke method.
|
|
function defineIteratorMethods(prototype) {
|
|
["next", "throw", "return"].forEach(function(method) {
|
|
prototype[method] = function(arg) {
|
|
return this._invoke(method, arg);
|
|
};
|
|
});
|
|
}
|
|
|
|
runtime.isGeneratorFunction = function(genFun) {
|
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
return ctor
|
|
? ctor === GeneratorFunction ||
|
|
// For the native GeneratorFunction constructor, the best we can
|
|
// do is to check its .name property.
|
|
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
|
: false;
|
|
};
|
|
|
|
runtime.mark = function(genFun) {
|
|
if (Object.setPrototypeOf) {
|
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
} else {
|
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
if (!(toStringTagSymbol in genFun)) {
|
|
genFun[toStringTagSymbol] = "GeneratorFunction";
|
|
}
|
|
}
|
|
genFun.prototype = Object.create(Gp);
|
|
return genFun;
|
|
};
|
|
|
|
// Within the body of any async function, `await x` is transformed to
|
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
// meant to be awaited.
|
|
runtime.awrap = function(arg) {
|
|
return { __await: arg };
|
|
};
|
|
|
|
function AsyncIterator(generator) {
|
|
function invoke(method, arg, resolve, reject) {
|
|
var record = tryCatch(generator[method], generator, arg);
|
|
if (record.type === "throw") {
|
|
reject(record.arg);
|
|
} else {
|
|
var result = record.arg;
|
|
var value = result.value;
|
|
if (value &&
|
|
typeof value === "object" &&
|
|
hasOwn.call(value, "__await")) {
|
|
return Promise.resolve(value.__await).then(function(value) {
|
|
invoke("next", value, resolve, reject);
|
|
}, function(err) {
|
|
invoke("throw", err, resolve, reject);
|
|
});
|
|
}
|
|
|
|
return Promise.resolve(value).then(function(unwrapped) {
|
|
// When a yielded Promise is resolved, its final value becomes
|
|
// the .value of the Promise<{value,done}> result for the
|
|
// current iteration. If the Promise is rejected, however, the
|
|
// result for this iteration will be rejected with the same
|
|
// reason. Note that rejections of yielded Promises are not
|
|
// thrown back into the generator function, as is the case
|
|
// when an awaited Promise is rejected. This difference in
|
|
// behavior between yield and await is important, because it
|
|
// allows the consumer to decide what to do with the yielded
|
|
// rejection (swallow it and continue, manually .throw it back
|
|
// into the generator, abandon iteration, whatever). With
|
|
// await, by contrast, there is no opportunity to examine the
|
|
// rejection reason outside the generator function, so the
|
|
// only option is to throw it from the await expression, and
|
|
// let the generator function handle the exception.
|
|
result.value = unwrapped;
|
|
resolve(result);
|
|
}, reject);
|
|
}
|
|
}
|
|
|
|
if (typeof process === "object" && process.domain) {
|
|
invoke = process.domain.bind(invoke);
|
|
}
|
|
|
|
var previousPromise;
|
|
|
|
function enqueue(method, arg) {
|
|
function callInvokeWithMethodAndArg() {
|
|
return new Promise(function(resolve, reject) {
|
|
invoke(method, arg, resolve, reject);
|
|
});
|
|
}
|
|
|
|
return previousPromise =
|
|
// If enqueue has been called before, then we want to wait until
|
|
// all previous Promises have been resolved before calling invoke,
|
|
// so that results are always delivered in the correct order. If
|
|
// enqueue has not been called before, then it is important to
|
|
// call invoke immediately, without waiting on a callback to fire,
|
|
// so that the async generator function has the opportunity to do
|
|
// any necessary setup in a predictable way. This predictability
|
|
// is why the Promise constructor synchronously invokes its
|
|
// executor callback, and why async functions synchronously
|
|
// execute code before the first await. Since we implement simple
|
|
// async functions in terms of async generators, it is especially
|
|
// important to get this right, even though it requires care.
|
|
previousPromise ? previousPromise.then(
|
|
callInvokeWithMethodAndArg,
|
|
// Avoid propagating failures to Promises returned by later
|
|
// invocations of the iterator.
|
|
callInvokeWithMethodAndArg
|
|
) : callInvokeWithMethodAndArg();
|
|
}
|
|
|
|
// Define the unified helper method that is used to implement .next,
|
|
// .throw, and .return (see defineIteratorMethods).
|
|
this._invoke = enqueue;
|
|
}
|
|
|
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
runtime.AsyncIterator = AsyncIterator;
|
|
|
|
// Note that simple async functions are implemented on top of
|
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
// the final result produced by the iterator.
|
|
runtime.async = function(innerFn, outerFn, self, tryLocsList) {
|
|
var iter = new AsyncIterator(
|
|
wrap(innerFn, outerFn, self, tryLocsList)
|
|
);
|
|
|
|
return runtime.isGeneratorFunction(outerFn)
|
|
? iter // If outerFn is a generator, return the full iterator.
|
|
: iter.next().then(function(result) {
|
|
return result.done ? result.value : iter.next();
|
|
});
|
|
};
|
|
|
|
function makeInvokeMethod(innerFn, self, context) {
|
|
var state = GenStateSuspendedStart;
|
|
|
|
return function invoke(method, arg) {
|
|
if (state === GenStateExecuting) {
|
|
throw new Error("Generator is already running");
|
|
}
|
|
|
|
if (state === GenStateCompleted) {
|
|
if (method === "throw") {
|
|
throw arg;
|
|
}
|
|
|
|
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
return doneResult();
|
|
}
|
|
|
|
while (true) {
|
|
var delegate = context.delegate;
|
|
if (delegate) {
|
|
if (method === "return" ||
|
|
(method === "throw" && delegate.iterator[method] === undefined)) {
|
|
// A return or throw (when the delegate iterator has no throw
|
|
// method) always terminates the yield* loop.
|
|
context.delegate = null;
|
|
|
|
// If the delegate iterator has a return method, give it a
|
|
// chance to clean up.
|
|
var returnMethod = delegate.iterator["return"];
|
|
if (returnMethod) {
|
|
var record = tryCatch(returnMethod, delegate.iterator, arg);
|
|
if (record.type === "throw") {
|
|
// If the return method threw an exception, let that
|
|
// exception prevail over the original return or throw.
|
|
method = "throw";
|
|
arg = record.arg;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
if (method === "return") {
|
|
// Continue with the outer return, now that the delegate
|
|
// iterator has been terminated.
|
|
continue;
|
|
}
|
|
}
|
|
|
|
var record = tryCatch(
|
|
delegate.iterator[method],
|
|
delegate.iterator,
|
|
arg
|
|
);
|
|
|
|
if (record.type === "throw") {
|
|
context.delegate = null;
|
|
|
|
// Like returning generator.throw(uncaught), but without the
|
|
// overhead of an extra function call.
|
|
method = "throw";
|
|
arg = record.arg;
|
|
continue;
|
|
}
|
|
|
|
// Delegate generator ran and handled its own exceptions so
|
|
// regardless of what the method was, we continue as if it is
|
|
// "next" with an undefined arg.
|
|
method = "next";
|
|
arg = undefined;
|
|
|
|
var info = record.arg;
|
|
if (info.done) {
|
|
context[delegate.resultName] = info.value;
|
|
context.next = delegate.nextLoc;
|
|
} else {
|
|
state = GenStateSuspendedYield;
|
|
return info;
|
|
}
|
|
|
|
context.delegate = null;
|
|
}
|
|
|
|
if (method === "next") {
|
|
// Setting context._sent for legacy support of Babel's
|
|
// function.sent implementation.
|
|
context.sent = context._sent = arg;
|
|
|
|
} else if (method === "throw") {
|
|
if (state === GenStateSuspendedStart) {
|
|
state = GenStateCompleted;
|
|
throw arg;
|
|
}
|
|
|
|
if (context.dispatchException(arg)) {
|
|
// If the dispatched exception was caught by a catch block,
|
|
// then let that catch block handle the exception normally.
|
|
method = "next";
|
|
arg = undefined;
|
|
}
|
|
|
|
} else if (method === "return") {
|
|
context.abrupt("return", arg);
|
|
}
|
|
|
|
state = GenStateExecuting;
|
|
|
|
var record = tryCatch(innerFn, self, context);
|
|
if (record.type === "normal") {
|
|
// If an exception is thrown from innerFn, we leave state ===
|
|
// GenStateExecuting and loop back for another invocation.
|
|
state = context.done
|
|
? GenStateCompleted
|
|
: GenStateSuspendedYield;
|
|
|
|
var info = {
|
|
value: record.arg,
|
|
done: context.done
|
|
};
|
|
|
|
if (record.arg === ContinueSentinel) {
|
|
if (context.delegate && method === "next") {
|
|
// Deliberately forget the last sent value so that we don't
|
|
// accidentally pass it on to the delegate.
|
|
arg = undefined;
|
|
}
|
|
} else {
|
|
return info;
|
|
}
|
|
|
|
} else if (record.type === "throw") {
|
|
state = GenStateCompleted;
|
|
// Dispatch the exception by looping back around to the
|
|
// context.dispatchException(arg) call above.
|
|
method = "throw";
|
|
arg = record.arg;
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
// unified ._invoke helper method.
|
|
defineIteratorMethods(Gp);
|
|
|
|
Gp[toStringTagSymbol] = "Generator";
|
|
|
|
Gp.toString = function() {
|
|
return "[object Generator]";
|
|
};
|
|
|
|
function pushTryEntry(locs) {
|
|
var entry = { tryLoc: locs[0] };
|
|
|
|
if (1 in locs) {
|
|
entry.catchLoc = locs[1];
|
|
}
|
|
|
|
if (2 in locs) {
|
|
entry.finallyLoc = locs[2];
|
|
entry.afterLoc = locs[3];
|
|
}
|
|
|
|
this.tryEntries.push(entry);
|
|
}
|
|
|
|
function resetTryEntry(entry) {
|
|
var record = entry.completion || {};
|
|
record.type = "normal";
|
|
delete record.arg;
|
|
entry.completion = record;
|
|
}
|
|
|
|
function Context(tryLocsList) {
|
|
// The root entry object (effectively a try statement without a catch
|
|
// or a finally block) gives us a place to store values thrown from
|
|
// locations where there is no enclosing try statement.
|
|
this.tryEntries = [{ tryLoc: "root" }];
|
|
tryLocsList.forEach(pushTryEntry, this);
|
|
this.reset(true);
|
|
}
|
|
|
|
runtime.keys = function(object) {
|
|
var keys = [];
|
|
for (var key in object) {
|
|
keys.push(key);
|
|
}
|
|
keys.reverse();
|
|
|
|
// Rather than returning an object with a next method, we keep
|
|
// things simple and return the next function itself.
|
|
return function next() {
|
|
while (keys.length) {
|
|
var key = keys.pop();
|
|
if (key in object) {
|
|
next.value = key;
|
|
next.done = false;
|
|
return next;
|
|
}
|
|
}
|
|
|
|
// To avoid creating an additional object, we just hang the .value
|
|
// and .done properties off the next function object itself. This
|
|
// also ensures that the minifier will not anonymize the function.
|
|
next.done = true;
|
|
return next;
|
|
};
|
|
};
|
|
|
|
function values(iterable) {
|
|
if (iterable) {
|
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
if (iteratorMethod) {
|
|
return iteratorMethod.call(iterable);
|
|
}
|
|
|
|
if (typeof iterable.next === "function") {
|
|
return iterable;
|
|
}
|
|
|
|
if (!isNaN(iterable.length)) {
|
|
var i = -1, next = function next() {
|
|
while (++i < iterable.length) {
|
|
if (hasOwn.call(iterable, i)) {
|
|
next.value = iterable[i];
|
|
next.done = false;
|
|
return next;
|
|
}
|
|
}
|
|
|
|
next.value = undefined;
|
|
next.done = true;
|
|
|
|
return next;
|
|
};
|
|
|
|
return next.next = next;
|
|
}
|
|
}
|
|
|
|
// Return an iterator with no values.
|
|
return { next: doneResult };
|
|
}
|
|
runtime.values = values;
|
|
|
|
function doneResult() {
|
|
return { value: undefined, done: true };
|
|
}
|
|
|
|
Context.prototype = {
|
|
constructor: Context,
|
|
|
|
reset: function(skipTempReset) {
|
|
this.prev = 0;
|
|
this.next = 0;
|
|
// Resetting context._sent for legacy support of Babel's
|
|
// function.sent implementation.
|
|
this.sent = this._sent = undefined;
|
|
this.done = false;
|
|
this.delegate = null;
|
|
|
|
this.tryEntries.forEach(resetTryEntry);
|
|
|
|
if (!skipTempReset) {
|
|
for (var name in this) {
|
|
// Not sure about the optimal order of these conditions:
|
|
if (name.charAt(0) === "t" &&
|
|
hasOwn.call(this, name) &&
|
|
!isNaN(+name.slice(1))) {
|
|
this[name] = undefined;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
stop: function() {
|
|
this.done = true;
|
|
|
|
var rootEntry = this.tryEntries[0];
|
|
var rootRecord = rootEntry.completion;
|
|
if (rootRecord.type === "throw") {
|
|
throw rootRecord.arg;
|
|
}
|
|
|
|
return this.rval;
|
|
},
|
|
|
|
dispatchException: function(exception) {
|
|
if (this.done) {
|
|
throw exception;
|
|
}
|
|
|
|
var context = this;
|
|
function handle(loc, caught) {
|
|
record.type = "throw";
|
|
record.arg = exception;
|
|
context.next = loc;
|
|
return !!caught;
|
|
}
|
|
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
var entry = this.tryEntries[i];
|
|
var record = entry.completion;
|
|
|
|
if (entry.tryLoc === "root") {
|
|
// Exception thrown outside of any try block that could handle
|
|
// it, so set the completion value of the entire function to
|
|
// throw the exception.
|
|
return handle("end");
|
|
}
|
|
|
|
if (entry.tryLoc <= this.prev) {
|
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
|
|
if (hasCatch && hasFinally) {
|
|
if (this.prev < entry.catchLoc) {
|
|
return handle(entry.catchLoc, true);
|
|
} else if (this.prev < entry.finallyLoc) {
|
|
return handle(entry.finallyLoc);
|
|
}
|
|
|
|
} else if (hasCatch) {
|
|
if (this.prev < entry.catchLoc) {
|
|
return handle(entry.catchLoc, true);
|
|
}
|
|
|
|
} else if (hasFinally) {
|
|
if (this.prev < entry.finallyLoc) {
|
|
return handle(entry.finallyLoc);
|
|
}
|
|
|
|
} else {
|
|
throw new Error("try statement without catch or finally");
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
abrupt: function(type, arg) {
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
var entry = this.tryEntries[i];
|
|
if (entry.tryLoc <= this.prev &&
|
|
hasOwn.call(entry, "finallyLoc") &&
|
|
this.prev < entry.finallyLoc) {
|
|
var finallyEntry = entry;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (finallyEntry &&
|
|
(type === "break" ||
|
|
type === "continue") &&
|
|
finallyEntry.tryLoc <= arg &&
|
|
arg <= finallyEntry.finallyLoc) {
|
|
// Ignore the finally entry if control is not jumping to a
|
|
// location outside the try/catch block.
|
|
finallyEntry = null;
|
|
}
|
|
|
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
record.type = type;
|
|
record.arg = arg;
|
|
|
|
if (finallyEntry) {
|
|
this.next = finallyEntry.finallyLoc;
|
|
} else {
|
|
this.complete(record);
|
|
}
|
|
|
|
return ContinueSentinel;
|
|
},
|
|
|
|
complete: function(record, afterLoc) {
|
|
if (record.type === "throw") {
|
|
throw record.arg;
|
|
}
|
|
|
|
if (record.type === "break" ||
|
|
record.type === "continue") {
|
|
this.next = record.arg;
|
|
} else if (record.type === "return") {
|
|
this.rval = record.arg;
|
|
this.next = "end";
|
|
} else if (record.type === "normal" && afterLoc) {
|
|
this.next = afterLoc;
|
|
}
|
|
},
|
|
|
|
finish: function(finallyLoc) {
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
var entry = this.tryEntries[i];
|
|
if (entry.finallyLoc === finallyLoc) {
|
|
this.complete(entry.completion, entry.afterLoc);
|
|
resetTryEntry(entry);
|
|
return ContinueSentinel;
|
|
}
|
|
}
|
|
},
|
|
|
|
"catch": function(tryLoc) {
|
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
var entry = this.tryEntries[i];
|
|
if (entry.tryLoc === tryLoc) {
|
|
var record = entry.completion;
|
|
if (record.type === "throw") {
|
|
var thrown = record.arg;
|
|
resetTryEntry(entry);
|
|
}
|
|
return thrown;
|
|
}
|
|
}
|
|
|
|
// The context.catch method must only be called with a location
|
|
// argument that corresponds to a known catch block.
|
|
throw new Error("illegal catch attempt");
|
|
},
|
|
|
|
delegateYield: function(iterable, resultName, nextLoc) {
|
|
this.delegate = {
|
|
iterator: values(iterable),
|
|
resultName: resultName,
|
|
nextLoc: nextLoc
|
|
};
|
|
|
|
return ContinueSentinel;
|
|
}
|
|
};
|
|
})(
|
|
// Among the various tricks for obtaining a reference to the global
|
|
// object, this seems to be the most reliable technique that does not
|
|
// use indirect eval (which violates Content Security Policy).
|
|
typeof global === "object" ? global :
|
|
typeof window === "object" ? window :
|
|
typeof self === "object" ? self : this
|
|
);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(34)))
|
|
|
|
/***/ },
|
|
/* 271 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {var clone = (function() {
|
|
'use strict';
|
|
|
|
/**
|
|
* Clones (copies) an Object using deep copying.
|
|
*
|
|
* This function supports circular references by default, but if you are certain
|
|
* there are no circular references in your object, you can save some CPU time
|
|
* by calling clone(obj, false).
|
|
*
|
|
* Caution: if `circular` is false and `parent` contains circular references,
|
|
* your program may enter an infinite loop and crash.
|
|
*
|
|
* @param `parent` - the object to be cloned
|
|
* @param `circular` - set to true if the object to be cloned may contain
|
|
* circular references. (optional - true by default)
|
|
* @param `depth` - set to a number if the object is only to be cloned to
|
|
* a particular depth. (optional - defaults to Infinity)
|
|
* @param `prototype` - sets the prototype to be used when cloning an object.
|
|
* (optional - defaults to parent prototype).
|
|
*/
|
|
function clone(parent, circular, depth, prototype) {
|
|
var filter;
|
|
if (typeof circular === 'object') {
|
|
depth = circular.depth;
|
|
prototype = circular.prototype;
|
|
filter = circular.filter;
|
|
circular = circular.circular
|
|
}
|
|
// maintain two arrays for circular references, where corresponding parents
|
|
// and children have the same index
|
|
var allParents = [];
|
|
var allChildren = [];
|
|
|
|
var useBuffer = typeof Buffer != 'undefined';
|
|
|
|
if (typeof circular == 'undefined')
|
|
circular = true;
|
|
|
|
if (typeof depth == 'undefined')
|
|
depth = Infinity;
|
|
|
|
// recurse this function so we don't reset allParents and allChildren
|
|
function _clone(parent, depth) {
|
|
// cloning null always returns null
|
|
if (parent === null)
|
|
return null;
|
|
|
|
if (depth == 0)
|
|
return parent;
|
|
|
|
var child;
|
|
var proto;
|
|
if (typeof parent != 'object') {
|
|
return parent;
|
|
}
|
|
|
|
if (clone.__isArray(parent)) {
|
|
child = [];
|
|
} else if (clone.__isRegExp(parent)) {
|
|
child = new RegExp(parent.source, __getRegExpFlags(parent));
|
|
if (parent.lastIndex) child.lastIndex = parent.lastIndex;
|
|
} else if (clone.__isDate(parent)) {
|
|
child = new Date(parent.getTime());
|
|
} else if (useBuffer && Buffer.isBuffer(parent)) {
|
|
child = new Buffer(parent.length);
|
|
parent.copy(child);
|
|
return child;
|
|
} else {
|
|
if (typeof prototype == 'undefined') {
|
|
proto = Object.getPrototypeOf(parent);
|
|
child = Object.create(proto);
|
|
}
|
|
else {
|
|
child = Object.create(prototype);
|
|
proto = prototype;
|
|
}
|
|
}
|
|
|
|
if (circular) {
|
|
var index = allParents.indexOf(parent);
|
|
|
|
if (index != -1) {
|
|
return allChildren[index];
|
|
}
|
|
allParents.push(parent);
|
|
allChildren.push(child);
|
|
}
|
|
|
|
for (var i in parent) {
|
|
var attrs;
|
|
if (proto) {
|
|
attrs = Object.getOwnPropertyDescriptor(proto, i);
|
|
}
|
|
|
|
if (attrs && attrs.set == null) {
|
|
continue;
|
|
}
|
|
child[i] = _clone(parent[i], depth - 1);
|
|
}
|
|
|
|
return child;
|
|
}
|
|
|
|
return _clone(parent, depth);
|
|
}
|
|
|
|
/**
|
|
* Simple flat clone using prototype, accepts only objects, usefull for property
|
|
* override on FLAT configuration object (no nested props).
|
|
*
|
|
* USE WITH CAUTION! This may not behave as you wish if you do not know how this
|
|
* works.
|
|
*/
|
|
clone.clonePrototype = function clonePrototype(parent) {
|
|
if (parent === null)
|
|
return null;
|
|
|
|
var c = function () {};
|
|
c.prototype = parent;
|
|
return new c();
|
|
};
|
|
|
|
// private utility functions
|
|
|
|
function __objToStr(o) {
|
|
return Object.prototype.toString.call(o);
|
|
};
|
|
clone.__objToStr = __objToStr;
|
|
|
|
function __isDate(o) {
|
|
return typeof o === 'object' && __objToStr(o) === '[object Date]';
|
|
};
|
|
clone.__isDate = __isDate;
|
|
|
|
function __isArray(o) {
|
|
return typeof o === 'object' && __objToStr(o) === '[object Array]';
|
|
};
|
|
clone.__isArray = __isArray;
|
|
|
|
function __isRegExp(o) {
|
|
return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
|
|
};
|
|
clone.__isRegExp = __isRegExp;
|
|
|
|
function __getRegExpFlags(re) {
|
|
var flags = '';
|
|
if (re.global) flags += 'g';
|
|
if (re.ignoreCase) flags += 'i';
|
|
if (re.multiline) flags += 'm';
|
|
return flags;
|
|
};
|
|
clone.__getRegExpFlags = __getRegExpFlags;
|
|
|
|
return clone;
|
|
})();
|
|
|
|
if (typeof module === 'object' && module.exports) {
|
|
module.exports = clone;
|
|
}
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 272 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(273).BrotliDecompressBuffer;
|
|
|
|
|
|
/***/ },
|
|
/* 273 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* Copyright 2013 Google Inc. All Rights Reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
var BrotliInput = __webpack_require__(274).BrotliInput;
|
|
var BrotliOutput = __webpack_require__(274).BrotliOutput;
|
|
var BrotliBitReader = __webpack_require__(275);
|
|
var BrotliDictionary = __webpack_require__(276);
|
|
var HuffmanCode = __webpack_require__(279).HuffmanCode;
|
|
var BrotliBuildHuffmanTable = __webpack_require__(279).BrotliBuildHuffmanTable;
|
|
var Context = __webpack_require__(280);
|
|
var Prefix = __webpack_require__(281);
|
|
var Transform = __webpack_require__(282);
|
|
|
|
var kDefaultCodeLength = 8;
|
|
var kCodeLengthRepeatCode = 16;
|
|
var kNumLiteralCodes = 256;
|
|
var kNumInsertAndCopyCodes = 704;
|
|
var kNumBlockLengthCodes = 26;
|
|
var kLiteralContextBits = 6;
|
|
var kDistanceContextBits = 2;
|
|
|
|
var HUFFMAN_TABLE_BITS = 8;
|
|
var HUFFMAN_TABLE_MASK = 0xff;
|
|
/* Maximum possible Huffman table size for an alphabet size of 704, max code
|
|
* length 15 and root table bits 8. */
|
|
var HUFFMAN_MAX_TABLE_SIZE = 1080;
|
|
|
|
var CODE_LENGTH_CODES = 18;
|
|
var kCodeLengthCodeOrder = new Uint8Array([
|
|
1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
|
]);
|
|
|
|
var NUM_DISTANCE_SHORT_CODES = 16;
|
|
var kDistanceShortCodeIndexOffset = new Uint8Array([
|
|
3, 2, 1, 0, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2
|
|
]);
|
|
|
|
var kDistanceShortCodeValueOffset = new Int8Array([
|
|
0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3
|
|
]);
|
|
|
|
var kMaxHuffmanTableSize = new Uint16Array([
|
|
256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822,
|
|
854, 886, 920, 952, 984, 1016, 1048, 1080
|
|
]);
|
|
|
|
function DecodeWindowBits(br) {
|
|
var n;
|
|
if (br.readBits(1) === 0) {
|
|
return 16;
|
|
}
|
|
|
|
n = br.readBits(3);
|
|
if (n > 0) {
|
|
return 17 + n;
|
|
}
|
|
|
|
n = br.readBits(3);
|
|
if (n > 0) {
|
|
return 8 + n;
|
|
}
|
|
|
|
return 17;
|
|
}
|
|
|
|
/* Decodes a number in the range [0..255], by reading 1 - 11 bits. */
|
|
function DecodeVarLenUint8(br) {
|
|
if (br.readBits(1)) {
|
|
var nbits = br.readBits(3);
|
|
if (nbits === 0) {
|
|
return 1;
|
|
} else {
|
|
return br.readBits(nbits) + (1 << nbits);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
function MetaBlockLength() {
|
|
this.meta_block_length = 0;
|
|
this.input_end = 0;
|
|
this.is_uncompressed = 0;
|
|
this.is_metadata = false;
|
|
}
|
|
|
|
function DecodeMetaBlockLength(br) {
|
|
var out = new MetaBlockLength;
|
|
var size_nibbles;
|
|
var size_bytes;
|
|
var i;
|
|
|
|
out.input_end = br.readBits(1);
|
|
if (out.input_end && br.readBits(1)) {
|
|
return out;
|
|
}
|
|
|
|
size_nibbles = br.readBits(2) + 4;
|
|
if (size_nibbles === 7) {
|
|
out.is_metadata = true;
|
|
|
|
if (br.readBits(1) !== 0)
|
|
throw new Error('Invalid reserved bit');
|
|
|
|
size_bytes = br.readBits(2);
|
|
if (size_bytes === 0)
|
|
return out;
|
|
|
|
for (i = 0; i < size_bytes; i++) {
|
|
var next_byte = br.readBits(8);
|
|
if (i + 1 === size_bytes && size_bytes > 1 && next_byte === 0)
|
|
throw new Error('Invalid size byte');
|
|
|
|
out.meta_block_length |= next_byte << (i * 8);
|
|
}
|
|
} else {
|
|
for (i = 0; i < size_nibbles; ++i) {
|
|
var next_nibble = br.readBits(4);
|
|
if (i + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0)
|
|
throw new Error('Invalid size nibble');
|
|
|
|
out.meta_block_length |= next_nibble << (i * 4);
|
|
}
|
|
}
|
|
|
|
++out.meta_block_length;
|
|
|
|
if (!out.input_end && !out.is_metadata) {
|
|
out.is_uncompressed = br.readBits(1);
|
|
}
|
|
|
|
return out;
|
|
}
|
|
|
|
/* Decodes the next Huffman code from bit-stream. */
|
|
function ReadSymbol(table, index, br) {
|
|
var start_index = index;
|
|
|
|
var nbits;
|
|
br.fillBitWindow();
|
|
index += (br.val_ >>> br.bit_pos_) & HUFFMAN_TABLE_MASK;
|
|
nbits = table[index].bits - HUFFMAN_TABLE_BITS;
|
|
if (nbits > 0) {
|
|
br.bit_pos_ += HUFFMAN_TABLE_BITS;
|
|
index += table[index].value;
|
|
index += (br.val_ >>> br.bit_pos_) & ((1 << nbits) - 1);
|
|
}
|
|
br.bit_pos_ += table[index].bits;
|
|
return table[index].value;
|
|
}
|
|
|
|
function ReadHuffmanCodeLengths(code_length_code_lengths, num_symbols, code_lengths, br) {
|
|
var symbol = 0;
|
|
var prev_code_len = kDefaultCodeLength;
|
|
var repeat = 0;
|
|
var repeat_code_len = 0;
|
|
var space = 32768;
|
|
|
|
var table = [];
|
|
for (var i = 0; i < 32; i++)
|
|
table.push(new HuffmanCode(0, 0));
|
|
|
|
BrotliBuildHuffmanTable(table, 0, 5, code_length_code_lengths, CODE_LENGTH_CODES);
|
|
|
|
while (symbol < num_symbols && space > 0) {
|
|
var p = 0;
|
|
var code_len;
|
|
|
|
br.readMoreInput();
|
|
br.fillBitWindow();
|
|
p += (br.val_ >>> br.bit_pos_) & 31;
|
|
br.bit_pos_ += table[p].bits;
|
|
code_len = table[p].value & 0xff;
|
|
if (code_len < kCodeLengthRepeatCode) {
|
|
repeat = 0;
|
|
code_lengths[symbol++] = code_len;
|
|
if (code_len !== 0) {
|
|
prev_code_len = code_len;
|
|
space -= 32768 >> code_len;
|
|
}
|
|
} else {
|
|
var extra_bits = code_len - 14;
|
|
var old_repeat;
|
|
var repeat_delta;
|
|
var new_len = 0;
|
|
if (code_len === kCodeLengthRepeatCode) {
|
|
new_len = prev_code_len;
|
|
}
|
|
if (repeat_code_len !== new_len) {
|
|
repeat = 0;
|
|
repeat_code_len = new_len;
|
|
}
|
|
old_repeat = repeat;
|
|
if (repeat > 0) {
|
|
repeat -= 2;
|
|
repeat <<= extra_bits;
|
|
}
|
|
repeat += br.readBits(extra_bits) + 3;
|
|
repeat_delta = repeat - old_repeat;
|
|
if (symbol + repeat_delta > num_symbols) {
|
|
throw new Error('[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols');
|
|
}
|
|
|
|
for (var x = 0; x < repeat_delta; x++)
|
|
code_lengths[symbol + x] = repeat_code_len;
|
|
|
|
symbol += repeat_delta;
|
|
|
|
if (repeat_code_len !== 0) {
|
|
space -= repeat_delta << (15 - repeat_code_len);
|
|
}
|
|
}
|
|
}
|
|
if (space !== 0) {
|
|
throw new Error("[ReadHuffmanCodeLengths] space = " + space);
|
|
}
|
|
|
|
for (; symbol < num_symbols; symbol++)
|
|
code_lengths[symbol] = 0;
|
|
}
|
|
|
|
function ReadHuffmanCode(alphabet_size, tables, table, br) {
|
|
var table_size = 0;
|
|
var simple_code_or_skip;
|
|
var code_lengths = new Uint8Array(alphabet_size);
|
|
|
|
br.readMoreInput();
|
|
|
|
/* simple_code_or_skip is used as follows:
|
|
1 for simple code;
|
|
0 for no skipping, 2 skips 2 code lengths, 3 skips 3 code lengths */
|
|
simple_code_or_skip = br.readBits(2);
|
|
if (simple_code_or_skip === 1) {
|
|
/* Read symbols, codes & code lengths directly. */
|
|
var i;
|
|
var max_bits_counter = alphabet_size - 1;
|
|
var max_bits = 0;
|
|
var symbols = new Int32Array(4);
|
|
var num_symbols = br.readBits(2) + 1;
|
|
while (max_bits_counter) {
|
|
max_bits_counter >>= 1;
|
|
++max_bits;
|
|
}
|
|
|
|
for (i = 0; i < num_symbols; ++i) {
|
|
symbols[i] = br.readBits(max_bits) % alphabet_size;
|
|
code_lengths[symbols[i]] = 2;
|
|
}
|
|
code_lengths[symbols[0]] = 1;
|
|
switch (num_symbols) {
|
|
case 1:
|
|
break;
|
|
case 3:
|
|
if ((symbols[0] === symbols[1]) ||
|
|
(symbols[0] === symbols[2]) ||
|
|
(symbols[1] === symbols[2])) {
|
|
throw new Error('[ReadHuffmanCode] invalid symbols');
|
|
}
|
|
break;
|
|
case 2:
|
|
if (symbols[0] === symbols[1]) {
|
|
throw new Error('[ReadHuffmanCode] invalid symbols');
|
|
}
|
|
|
|
code_lengths[symbols[1]] = 1;
|
|
break;
|
|
case 4:
|
|
if ((symbols[0] === symbols[1]) ||
|
|
(symbols[0] === symbols[2]) ||
|
|
(symbols[0] === symbols[3]) ||
|
|
(symbols[1] === symbols[2]) ||
|
|
(symbols[1] === symbols[3]) ||
|
|
(symbols[2] === symbols[3])) {
|
|
throw new Error('[ReadHuffmanCode] invalid symbols');
|
|
}
|
|
|
|
if (br.readBits(1)) {
|
|
code_lengths[symbols[2]] = 3;
|
|
code_lengths[symbols[3]] = 3;
|
|
} else {
|
|
code_lengths[symbols[0]] = 2;
|
|
}
|
|
break;
|
|
}
|
|
} else { /* Decode Huffman-coded code lengths. */
|
|
var i;
|
|
var code_length_code_lengths = new Uint8Array(CODE_LENGTH_CODES);
|
|
var space = 32;
|
|
var num_codes = 0;
|
|
/* Static Huffman code for the code length code lengths */
|
|
var huff = [
|
|
new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2),
|
|
new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 1),
|
|
new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2),
|
|
new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 5)
|
|
];
|
|
for (i = simple_code_or_skip; i < CODE_LENGTH_CODES && space > 0; ++i) {
|
|
var code_len_idx = kCodeLengthCodeOrder[i];
|
|
var p = 0;
|
|
var v;
|
|
br.fillBitWindow();
|
|
p += (br.val_ >>> br.bit_pos_) & 15;
|
|
br.bit_pos_ += huff[p].bits;
|
|
v = huff[p].value;
|
|
code_length_code_lengths[code_len_idx] = v;
|
|
if (v !== 0) {
|
|
space -= (32 >> v);
|
|
++num_codes;
|
|
}
|
|
}
|
|
|
|
if (!(num_codes === 1 || space === 0))
|
|
throw new Error('[ReadHuffmanCode] invalid num_codes or space');
|
|
|
|
ReadHuffmanCodeLengths(code_length_code_lengths, alphabet_size, code_lengths, br);
|
|
}
|
|
|
|
table_size = BrotliBuildHuffmanTable(tables, table, HUFFMAN_TABLE_BITS, code_lengths, alphabet_size);
|
|
|
|
if (table_size === 0) {
|
|
throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: ");
|
|
}
|
|
|
|
return table_size;
|
|
}
|
|
|
|
function ReadBlockLength(table, index, br) {
|
|
var code;
|
|
var nbits;
|
|
code = ReadSymbol(table, index, br);
|
|
nbits = Prefix.kBlockLengthPrefixCode[code].nbits;
|
|
return Prefix.kBlockLengthPrefixCode[code].offset + br.readBits(nbits);
|
|
}
|
|
|
|
function TranslateShortCodes(code, ringbuffer, index) {
|
|
var val;
|
|
if (code < NUM_DISTANCE_SHORT_CODES) {
|
|
index += kDistanceShortCodeIndexOffset[code];
|
|
index &= 3;
|
|
val = ringbuffer[index] + kDistanceShortCodeValueOffset[code];
|
|
} else {
|
|
val = code - NUM_DISTANCE_SHORT_CODES + 1;
|
|
}
|
|
return val;
|
|
}
|
|
|
|
function MoveToFront(v, index) {
|
|
var value = v[index];
|
|
var i = index;
|
|
for (; i; --i) v[i] = v[i - 1];
|
|
v[0] = value;
|
|
}
|
|
|
|
function InverseMoveToFrontTransform(v, v_len) {
|
|
var mtf = new Uint8Array(256);
|
|
var i;
|
|
for (i = 0; i < 256; ++i) {
|
|
mtf[i] = i;
|
|
}
|
|
for (i = 0; i < v_len; ++i) {
|
|
var index = v[i];
|
|
v[i] = mtf[index];
|
|
if (index) MoveToFront(mtf, index);
|
|
}
|
|
}
|
|
|
|
/* Contains a collection of huffman trees with the same alphabet size. */
|
|
function HuffmanTreeGroup(alphabet_size, num_htrees) {
|
|
this.alphabet_size = alphabet_size;
|
|
this.num_htrees = num_htrees;
|
|
this.codes = new Array(num_htrees + num_htrees * kMaxHuffmanTableSize[(alphabet_size + 31) >>> 5]);
|
|
this.htrees = new Uint32Array(num_htrees);
|
|
}
|
|
|
|
HuffmanTreeGroup.prototype.decode = function(br) {
|
|
var i;
|
|
var table_size;
|
|
var next = 0;
|
|
for (i = 0; i < this.num_htrees; ++i) {
|
|
this.htrees[i] = next;
|
|
table_size = ReadHuffmanCode(this.alphabet_size, this.codes, next, br);
|
|
next += table_size;
|
|
}
|
|
};
|
|
|
|
function DecodeContextMap(context_map_size, br) {
|
|
var out = { num_htrees: null, context_map: null };
|
|
var use_rle_for_zeros;
|
|
var max_run_length_prefix = 0;
|
|
var table;
|
|
var i;
|
|
|
|
br.readMoreInput();
|
|
var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1;
|
|
|
|
var context_map = out.context_map = new Uint8Array(context_map_size);
|
|
if (num_htrees <= 1) {
|
|
return out;
|
|
}
|
|
|
|
use_rle_for_zeros = br.readBits(1);
|
|
if (use_rle_for_zeros) {
|
|
max_run_length_prefix = br.readBits(4) + 1;
|
|
}
|
|
|
|
table = [];
|
|
for (i = 0; i < HUFFMAN_MAX_TABLE_SIZE; i++) {
|
|
table[i] = new HuffmanCode(0, 0);
|
|
}
|
|
|
|
ReadHuffmanCode(num_htrees + max_run_length_prefix, table, 0, br);
|
|
|
|
for (i = 0; i < context_map_size;) {
|
|
var code;
|
|
|
|
br.readMoreInput();
|
|
code = ReadSymbol(table, 0, br);
|
|
if (code === 0) {
|
|
context_map[i] = 0;
|
|
++i;
|
|
} else if (code <= max_run_length_prefix) {
|
|
var reps = 1 + (1 << code) + br.readBits(code);
|
|
while (--reps) {
|
|
if (i >= context_map_size) {
|
|
throw new Error("[DecodeContextMap] i >= context_map_size");
|
|
}
|
|
context_map[i] = 0;
|
|
++i;
|
|
}
|
|
} else {
|
|
context_map[i] = code - max_run_length_prefix;
|
|
++i;
|
|
}
|
|
}
|
|
if (br.readBits(1)) {
|
|
InverseMoveToFrontTransform(context_map, context_map_size);
|
|
}
|
|
|
|
return out;
|
|
}
|
|
|
|
function DecodeBlockType(max_block_type, trees, tree_type, block_types, ringbuffers, indexes, br) {
|
|
var ringbuffer = tree_type * 2;
|
|
var index = tree_type;
|
|
var type_code = ReadSymbol(trees, tree_type * HUFFMAN_MAX_TABLE_SIZE, br);
|
|
var block_type;
|
|
if (type_code === 0) {
|
|
block_type = ringbuffers[ringbuffer + (indexes[index] & 1)];
|
|
} else if (type_code === 1) {
|
|
block_type = ringbuffers[ringbuffer + ((indexes[index] - 1) & 1)] + 1;
|
|
} else {
|
|
block_type = type_code - 2;
|
|
}
|
|
if (block_type >= max_block_type) {
|
|
block_type -= max_block_type;
|
|
}
|
|
block_types[tree_type] = block_type;
|
|
ringbuffers[ringbuffer + (indexes[index] & 1)] = block_type;
|
|
++indexes[index];
|
|
}
|
|
|
|
function CopyUncompressedBlockToOutput(output, len, pos, ringbuffer, ringbuffer_mask, br) {
|
|
var rb_size = ringbuffer_mask + 1;
|
|
var rb_pos = pos & ringbuffer_mask;
|
|
var br_pos = br.pos_ & BrotliBitReader.IBUF_MASK;
|
|
var nbytes;
|
|
|
|
/* For short lengths copy byte-by-byte */
|
|
if (len < 8 || br.bit_pos_ + (len << 3) < br.bit_end_pos_) {
|
|
while (len-- > 0) {
|
|
br.readMoreInput();
|
|
ringbuffer[rb_pos++] = br.readBits(8);
|
|
if (rb_pos === rb_size) {
|
|
output.write(ringbuffer, rb_size);
|
|
rb_pos = 0;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
if (br.bit_end_pos_ < 32) {
|
|
throw new Error('[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32');
|
|
}
|
|
|
|
/* Copy remaining 0-4 bytes from br.val_ to ringbuffer. */
|
|
while (br.bit_pos_ < 32) {
|
|
ringbuffer[rb_pos] = (br.val_ >>> br.bit_pos_);
|
|
br.bit_pos_ += 8;
|
|
++rb_pos;
|
|
--len;
|
|
}
|
|
|
|
/* Copy remaining bytes from br.buf_ to ringbuffer. */
|
|
nbytes = (br.bit_end_pos_ - br.bit_pos_) >> 3;
|
|
if (br_pos + nbytes > BrotliBitReader.IBUF_MASK) {
|
|
var tail = BrotliBitReader.IBUF_MASK + 1 - br_pos;
|
|
for (var x = 0; x < tail; x++)
|
|
ringbuffer[rb_pos + x] = br.buf_[br_pos + x];
|
|
|
|
nbytes -= tail;
|
|
rb_pos += tail;
|
|
len -= tail;
|
|
br_pos = 0;
|
|
}
|
|
|
|
for (var x = 0; x < nbytes; x++)
|
|
ringbuffer[rb_pos + x] = br.buf_[br_pos + x];
|
|
|
|
rb_pos += nbytes;
|
|
len -= nbytes;
|
|
|
|
/* If we wrote past the logical end of the ringbuffer, copy the tail of the
|
|
ringbuffer to its beginning and flush the ringbuffer to the output. */
|
|
if (rb_pos >= rb_size) {
|
|
output.write(ringbuffer, rb_size);
|
|
rb_pos -= rb_size;
|
|
for (var x = 0; x < rb_pos; x++)
|
|
ringbuffer[x] = ringbuffer[rb_size + x];
|
|
}
|
|
|
|
/* If we have more to copy than the remaining size of the ringbuffer, then we
|
|
first fill the ringbuffer from the input and then flush the ringbuffer to
|
|
the output */
|
|
while (rb_pos + len >= rb_size) {
|
|
nbytes = rb_size - rb_pos;
|
|
if (br.input_.read(ringbuffer, rb_pos, nbytes) < nbytes) {
|
|
throw new Error('[CopyUncompressedBlockToOutput] not enough bytes');
|
|
}
|
|
output.write(ringbuffer, rb_size);
|
|
len -= nbytes;
|
|
rb_pos = 0;
|
|
}
|
|
|
|
/* Copy straight from the input onto the ringbuffer. The ringbuffer will be
|
|
flushed to the output at a later time. */
|
|
if (br.input_.read(ringbuffer, rb_pos, len) < len) {
|
|
throw new Error('[CopyUncompressedBlockToOutput] not enough bytes');
|
|
}
|
|
|
|
/* Restore the state of the bit reader. */
|
|
br.reset();
|
|
}
|
|
|
|
/* Advances the bit reader position to the next byte boundary and verifies
|
|
that any skipped bits are set to zero. */
|
|
function JumpToByteBoundary(br) {
|
|
var new_bit_pos = (br.bit_pos_ + 7) & ~7;
|
|
var pad_bits = br.readBits(new_bit_pos - br.bit_pos_);
|
|
return pad_bits == 0;
|
|
}
|
|
|
|
function BrotliDecompressedSize(buffer) {
|
|
var input = new BrotliInput(buffer);
|
|
var br = new BrotliBitReader(input);
|
|
DecodeWindowBits(br);
|
|
var out = DecodeMetaBlockLength(br);
|
|
return out.meta_block_length;
|
|
}
|
|
|
|
exports.BrotliDecompressedSize = BrotliDecompressedSize;
|
|
|
|
function BrotliDecompressBuffer(buffer, output_size) {
|
|
var input = new BrotliInput(buffer);
|
|
|
|
if (output_size == null) {
|
|
output_size = BrotliDecompressedSize(buffer);
|
|
}
|
|
|
|
var output_buffer = new Uint8Array(output_size);
|
|
var output = new BrotliOutput(output_buffer);
|
|
|
|
BrotliDecompress(input, output);
|
|
|
|
if (output.pos < output.buffer.length) {
|
|
output.buffer = output.buffer.subarray(0, output.pos);
|
|
}
|
|
|
|
return output.buffer;
|
|
}
|
|
|
|
exports.BrotliDecompressBuffer = BrotliDecompressBuffer;
|
|
|
|
function BrotliDecompress(input, output) {
|
|
var i;
|
|
var pos = 0;
|
|
var input_end = 0;
|
|
var window_bits = 0;
|
|
var max_backward_distance;
|
|
var max_distance = 0;
|
|
var ringbuffer_size;
|
|
var ringbuffer_mask;
|
|
var ringbuffer;
|
|
var ringbuffer_end;
|
|
/* This ring buffer holds a few past copy distances that will be used by */
|
|
/* some special distance codes. */
|
|
var dist_rb = [ 16, 15, 11, 4 ];
|
|
var dist_rb_idx = 0;
|
|
/* The previous 2 bytes used for context. */
|
|
var prev_byte1 = 0;
|
|
var prev_byte2 = 0;
|
|
var hgroup = [new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0)];
|
|
var block_type_trees;
|
|
var block_len_trees;
|
|
var br;
|
|
|
|
/* We need the slack region for the following reasons:
|
|
- always doing two 8-byte copies for fast backward copying
|
|
- transforms
|
|
- flushing the input ringbuffer when decoding uncompressed blocks */
|
|
var kRingBufferWriteAheadSlack = 128 + BrotliBitReader.READ_SIZE;
|
|
|
|
br = new BrotliBitReader(input);
|
|
|
|
/* Decode window size. */
|
|
window_bits = DecodeWindowBits(br);
|
|
max_backward_distance = (1 << window_bits) - 16;
|
|
|
|
ringbuffer_size = 1 << window_bits;
|
|
ringbuffer_mask = ringbuffer_size - 1;
|
|
ringbuffer = new Uint8Array(ringbuffer_size + kRingBufferWriteAheadSlack + BrotliDictionary.maxDictionaryWordLength);
|
|
ringbuffer_end = ringbuffer_size;
|
|
|
|
block_type_trees = [];
|
|
block_len_trees = [];
|
|
for (var x = 0; x < 3 * HUFFMAN_MAX_TABLE_SIZE; x++) {
|
|
block_type_trees[x] = new HuffmanCode(0, 0);
|
|
block_len_trees[x] = new HuffmanCode(0, 0);
|
|
}
|
|
|
|
while (!input_end) {
|
|
var meta_block_remaining_len = 0;
|
|
var is_uncompressed;
|
|
var block_length = [ 1 << 28, 1 << 28, 1 << 28 ];
|
|
var block_type = [ 0 ];
|
|
var num_block_types = [ 1, 1, 1 ];
|
|
var block_type_rb = [ 0, 1, 0, 1, 0, 1 ];
|
|
var block_type_rb_index = [ 0 ];
|
|
var distance_postfix_bits;
|
|
var num_direct_distance_codes;
|
|
var distance_postfix_mask;
|
|
var num_distance_codes;
|
|
var context_map = null;
|
|
var context_modes = null;
|
|
var num_literal_htrees;
|
|
var dist_context_map = null;
|
|
var num_dist_htrees;
|
|
var context_offset = 0;
|
|
var context_map_slice = null;
|
|
var literal_htree_index = 0;
|
|
var dist_context_offset = 0;
|
|
var dist_context_map_slice = null;
|
|
var dist_htree_index = 0;
|
|
var context_lookup_offset1 = 0;
|
|
var context_lookup_offset2 = 0;
|
|
var context_mode;
|
|
var htree_command;
|
|
|
|
for (i = 0; i < 3; ++i) {
|
|
hgroup[i].codes = null;
|
|
hgroup[i].htrees = null;
|
|
}
|
|
|
|
br.readMoreInput();
|
|
|
|
var _out = DecodeMetaBlockLength(br);
|
|
meta_block_remaining_len = _out.meta_block_length;
|
|
if (pos + meta_block_remaining_len > output.buffer.length) {
|
|
/* We need to grow the output buffer to fit the additional data. */
|
|
var tmp = new Uint8Array( pos + meta_block_remaining_len );
|
|
tmp.set( output.buffer );
|
|
output.buffer = tmp;
|
|
}
|
|
input_end = _out.input_end;
|
|
is_uncompressed = _out.is_uncompressed;
|
|
|
|
if (_out.is_metadata) {
|
|
JumpToByteBoundary(br);
|
|
|
|
for (; meta_block_remaining_len > 0; --meta_block_remaining_len) {
|
|
br.readMoreInput();
|
|
/* Read one byte and ignore it. */
|
|
br.readBits(8);
|
|
}
|
|
|
|
continue;
|
|
}
|
|
|
|
if (meta_block_remaining_len === 0) {
|
|
continue;
|
|
}
|
|
|
|
if (is_uncompressed) {
|
|
br.bit_pos_ = (br.bit_pos_ + 7) & ~7;
|
|
CopyUncompressedBlockToOutput(output, meta_block_remaining_len, pos,
|
|
ringbuffer, ringbuffer_mask, br);
|
|
pos += meta_block_remaining_len;
|
|
continue;
|
|
}
|
|
|
|
for (i = 0; i < 3; ++i) {
|
|
num_block_types[i] = DecodeVarLenUint8(br) + 1;
|
|
if (num_block_types[i] >= 2) {
|
|
ReadHuffmanCode(num_block_types[i] + 2, block_type_trees, i * HUFFMAN_MAX_TABLE_SIZE, br);
|
|
ReadHuffmanCode(kNumBlockLengthCodes, block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br);
|
|
block_length[i] = ReadBlockLength(block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br);
|
|
block_type_rb_index[i] = 1;
|
|
}
|
|
}
|
|
|
|
br.readMoreInput();
|
|
|
|
distance_postfix_bits = br.readBits(2);
|
|
num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits);
|
|
distance_postfix_mask = (1 << distance_postfix_bits) - 1;
|
|
num_distance_codes = (num_direct_distance_codes + (48 << distance_postfix_bits));
|
|
context_modes = new Uint8Array(num_block_types[0]);
|
|
|
|
for (i = 0; i < num_block_types[0]; ++i) {
|
|
br.readMoreInput();
|
|
context_modes[i] = (br.readBits(2) << 1);
|
|
}
|
|
|
|
var _o1 = DecodeContextMap(num_block_types[0] << kLiteralContextBits, br);
|
|
num_literal_htrees = _o1.num_htrees;
|
|
context_map = _o1.context_map;
|
|
|
|
var _o2 = DecodeContextMap(num_block_types[2] << kDistanceContextBits, br);
|
|
num_dist_htrees = _o2.num_htrees;
|
|
dist_context_map = _o2.context_map;
|
|
|
|
hgroup[0] = new HuffmanTreeGroup(kNumLiteralCodes, num_literal_htrees);
|
|
hgroup[1] = new HuffmanTreeGroup(kNumInsertAndCopyCodes, num_block_types[1]);
|
|
hgroup[2] = new HuffmanTreeGroup(num_distance_codes, num_dist_htrees);
|
|
|
|
for (i = 0; i < 3; ++i) {
|
|
hgroup[i].decode(br);
|
|
}
|
|
|
|
context_map_slice = 0;
|
|
dist_context_map_slice = 0;
|
|
context_mode = context_modes[block_type[0]];
|
|
context_lookup_offset1 = Context.lookupOffsets[context_mode];
|
|
context_lookup_offset2 = Context.lookupOffsets[context_mode + 1];
|
|
htree_command = hgroup[1].htrees[0];
|
|
|
|
while (meta_block_remaining_len > 0) {
|
|
var cmd_code;
|
|
var range_idx;
|
|
var insert_code;
|
|
var copy_code;
|
|
var insert_length;
|
|
var copy_length;
|
|
var distance_code;
|
|
var distance;
|
|
var context;
|
|
var j;
|
|
var copy_dst;
|
|
|
|
br.readMoreInput();
|
|
|
|
if (block_length[1] === 0) {
|
|
DecodeBlockType(num_block_types[1],
|
|
block_type_trees, 1, block_type, block_type_rb,
|
|
block_type_rb_index, br);
|
|
block_length[1] = ReadBlockLength(block_len_trees, HUFFMAN_MAX_TABLE_SIZE, br);
|
|
htree_command = hgroup[1].htrees[block_type[1]];
|
|
}
|
|
--block_length[1];
|
|
cmd_code = ReadSymbol(hgroup[1].codes, htree_command, br);
|
|
range_idx = cmd_code >> 6;
|
|
if (range_idx >= 2) {
|
|
range_idx -= 2;
|
|
distance_code = -1;
|
|
} else {
|
|
distance_code = 0;
|
|
}
|
|
insert_code = Prefix.kInsertRangeLut[range_idx] + ((cmd_code >> 3) & 7);
|
|
copy_code = Prefix.kCopyRangeLut[range_idx] + (cmd_code & 7);
|
|
insert_length = Prefix.kInsertLengthPrefixCode[insert_code].offset +
|
|
br.readBits(Prefix.kInsertLengthPrefixCode[insert_code].nbits);
|
|
copy_length = Prefix.kCopyLengthPrefixCode[copy_code].offset +
|
|
br.readBits(Prefix.kCopyLengthPrefixCode[copy_code].nbits);
|
|
prev_byte1 = ringbuffer[pos-1 & ringbuffer_mask];
|
|
prev_byte2 = ringbuffer[pos-2 & ringbuffer_mask];
|
|
for (j = 0; j < insert_length; ++j) {
|
|
br.readMoreInput();
|
|
|
|
if (block_length[0] === 0) {
|
|
DecodeBlockType(num_block_types[0],
|
|
block_type_trees, 0, block_type, block_type_rb,
|
|
block_type_rb_index, br);
|
|
block_length[0] = ReadBlockLength(block_len_trees, 0, br);
|
|
context_offset = block_type[0] << kLiteralContextBits;
|
|
context_map_slice = context_offset;
|
|
context_mode = context_modes[block_type[0]];
|
|
context_lookup_offset1 = Context.lookupOffsets[context_mode];
|
|
context_lookup_offset2 = Context.lookupOffsets[context_mode + 1];
|
|
}
|
|
context = (Context.lookup[context_lookup_offset1 + prev_byte1] |
|
|
Context.lookup[context_lookup_offset2 + prev_byte2]);
|
|
literal_htree_index = context_map[context_map_slice + context];
|
|
--block_length[0];
|
|
prev_byte2 = prev_byte1;
|
|
prev_byte1 = ReadSymbol(hgroup[0].codes, hgroup[0].htrees[literal_htree_index], br);
|
|
ringbuffer[pos & ringbuffer_mask] = prev_byte1;
|
|
if ((pos & ringbuffer_mask) === ringbuffer_mask) {
|
|
output.write(ringbuffer, ringbuffer_size);
|
|
}
|
|
++pos;
|
|
}
|
|
meta_block_remaining_len -= insert_length;
|
|
if (meta_block_remaining_len <= 0) break;
|
|
|
|
if (distance_code < 0) {
|
|
var context;
|
|
|
|
br.readMoreInput();
|
|
if (block_length[2] === 0) {
|
|
DecodeBlockType(num_block_types[2],
|
|
block_type_trees, 2, block_type, block_type_rb,
|
|
block_type_rb_index, br);
|
|
block_length[2] = ReadBlockLength(block_len_trees, 2 * HUFFMAN_MAX_TABLE_SIZE, br);
|
|
dist_context_offset = block_type[2] << kDistanceContextBits;
|
|
dist_context_map_slice = dist_context_offset;
|
|
}
|
|
--block_length[2];
|
|
context = (copy_length > 4 ? 3 : copy_length - 2) & 0xff;
|
|
dist_htree_index = dist_context_map[dist_context_map_slice + context];
|
|
distance_code = ReadSymbol(hgroup[2].codes, hgroup[2].htrees[dist_htree_index], br);
|
|
if (distance_code >= num_direct_distance_codes) {
|
|
var nbits;
|
|
var postfix;
|
|
var offset;
|
|
distance_code -= num_direct_distance_codes;
|
|
postfix = distance_code & distance_postfix_mask;
|
|
distance_code >>= distance_postfix_bits;
|
|
nbits = (distance_code >> 1) + 1;
|
|
offset = ((2 + (distance_code & 1)) << nbits) - 4;
|
|
distance_code = num_direct_distance_codes +
|
|
((offset + br.readBits(nbits)) <<
|
|
distance_postfix_bits) + postfix;
|
|
}
|
|
}
|
|
|
|
/* Convert the distance code to the actual distance by possibly looking */
|
|
/* up past distnaces from the ringbuffer. */
|
|
distance = TranslateShortCodes(distance_code, dist_rb, dist_rb_idx);
|
|
if (distance < 0) {
|
|
throw new Error('[BrotliDecompress] invalid distance');
|
|
}
|
|
|
|
if (pos < max_backward_distance &&
|
|
max_distance !== max_backward_distance) {
|
|
max_distance = pos;
|
|
} else {
|
|
max_distance = max_backward_distance;
|
|
}
|
|
|
|
copy_dst = pos & ringbuffer_mask;
|
|
|
|
if (distance > max_distance) {
|
|
if (copy_length >= BrotliDictionary.minDictionaryWordLength &&
|
|
copy_length <= BrotliDictionary.maxDictionaryWordLength) {
|
|
var offset = BrotliDictionary.offsetsByLength[copy_length];
|
|
var word_id = distance - max_distance - 1;
|
|
var shift = BrotliDictionary.sizeBitsByLength[copy_length];
|
|
var mask = (1 << shift) - 1;
|
|
var word_idx = word_id & mask;
|
|
var transform_idx = word_id >> shift;
|
|
offset += word_idx * copy_length;
|
|
if (transform_idx < Transform.kNumTransforms) {
|
|
var len = Transform.transformDictionaryWord(ringbuffer, copy_dst, offset, copy_length, transform_idx);
|
|
copy_dst += len;
|
|
pos += len;
|
|
meta_block_remaining_len -= len;
|
|
if (copy_dst >= ringbuffer_end) {
|
|
output.write(ringbuffer, ringbuffer_size);
|
|
|
|
for (var _x = 0; _x < (copy_dst - ringbuffer_end); _x++)
|
|
ringbuffer[_x] = ringbuffer[ringbuffer_end + _x];
|
|
}
|
|
} else {
|
|
throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance +
|
|
" len: " + copy_length + " bytes left: " + meta_block_remaining_len);
|
|
}
|
|
} else {
|
|
throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance +
|
|
" len: " + copy_length + " bytes left: " + meta_block_remaining_len);
|
|
}
|
|
} else {
|
|
if (distance_code > 0) {
|
|
dist_rb[dist_rb_idx & 3] = distance;
|
|
++dist_rb_idx;
|
|
}
|
|
|
|
if (copy_length > meta_block_remaining_len) {
|
|
throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance +
|
|
" len: " + copy_length + " bytes left: " + meta_block_remaining_len);
|
|
}
|
|
|
|
for (j = 0; j < copy_length; ++j) {
|
|
ringbuffer[pos & ringbuffer_mask] = ringbuffer[(pos - distance) & ringbuffer_mask];
|
|
if ((pos & ringbuffer_mask) === ringbuffer_mask) {
|
|
output.write(ringbuffer, ringbuffer_size);
|
|
}
|
|
++pos;
|
|
--meta_block_remaining_len;
|
|
}
|
|
}
|
|
|
|
/* When we get here, we must have inserted at least one literal and */
|
|
/* made a copy of at least length two, therefore accessing the last 2 */
|
|
/* bytes is valid. */
|
|
prev_byte1 = ringbuffer[(pos - 1) & ringbuffer_mask];
|
|
prev_byte2 = ringbuffer[(pos - 2) & ringbuffer_mask];
|
|
}
|
|
|
|
/* Protect pos from overflow, wrap it around at every GB of input data */
|
|
pos &= 0x3fffffff;
|
|
}
|
|
|
|
output.write(ringbuffer, pos & ringbuffer_mask);
|
|
}
|
|
|
|
exports.BrotliDecompress = BrotliDecompress;
|
|
|
|
BrotliDictionary.init();
|
|
|
|
|
|
/***/ },
|
|
/* 274 */
|
|
/***/ function(module, exports) {
|
|
|
|
function BrotliInput(buffer) {
|
|
this.buffer = buffer;
|
|
this.pos = 0;
|
|
}
|
|
|
|
BrotliInput.prototype.read = function(buf, i, count) {
|
|
if (this.pos + count > this.buffer.length) {
|
|
count = this.buffer.length - this.pos;
|
|
}
|
|
|
|
for (var p = 0; p < count; p++)
|
|
buf[i + p] = this.buffer[this.pos + p];
|
|
|
|
this.pos += count;
|
|
return count;
|
|
}
|
|
|
|
exports.BrotliInput = BrotliInput;
|
|
|
|
function BrotliOutput(buf) {
|
|
this.buffer = buf;
|
|
this.pos = 0;
|
|
}
|
|
|
|
BrotliOutput.prototype.write = function(buf, count) {
|
|
if (this.pos + count > this.buffer.length)
|
|
throw new Error('Output buffer is not large enough');
|
|
|
|
this.buffer.set(buf.subarray(0, count), this.pos);
|
|
this.pos += count;
|
|
return count;
|
|
};
|
|
|
|
exports.BrotliOutput = BrotliOutput;
|
|
|
|
|
|
/***/ },
|
|
/* 275 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* Copyright 2013 Google Inc. All Rights Reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
Bit reading helpers
|
|
*/
|
|
|
|
var BROTLI_READ_SIZE = 4096;
|
|
var BROTLI_IBUF_SIZE = (2 * BROTLI_READ_SIZE + 32);
|
|
var BROTLI_IBUF_MASK = (2 * BROTLI_READ_SIZE - 1);
|
|
|
|
var kBitMask = new Uint32Array([
|
|
0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767,
|
|
65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215
|
|
]);
|
|
|
|
/* Input byte buffer, consist of a ringbuffer and a "slack" region where */
|
|
/* bytes from the start of the ringbuffer are copied. */
|
|
function BrotliBitReader(input) {
|
|
this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE);
|
|
this.input_ = input; /* input callback */
|
|
|
|
this.reset();
|
|
}
|
|
|
|
BrotliBitReader.READ_SIZE = BROTLI_READ_SIZE;
|
|
BrotliBitReader.IBUF_MASK = BROTLI_IBUF_MASK;
|
|
|
|
BrotliBitReader.prototype.reset = function() {
|
|
this.buf_ptr_ = 0; /* next input will write here */
|
|
this.val_ = 0; /* pre-fetched bits */
|
|
this.pos_ = 0; /* byte position in stream */
|
|
this.bit_pos_ = 0; /* current bit-reading position in val_ */
|
|
this.bit_end_pos_ = 0; /* bit-reading end position from LSB of val_ */
|
|
this.eos_ = 0; /* input stream is finished */
|
|
|
|
this.readMoreInput();
|
|
for (var i = 0; i < 4; i++) {
|
|
this.val_ |= this.buf_[this.pos_] << (8 * i);
|
|
++this.pos_;
|
|
}
|
|
|
|
return this.bit_end_pos_ > 0;
|
|
};
|
|
|
|
/* Fills up the input ringbuffer by calling the input callback.
|
|
|
|
Does nothing if there are at least 32 bytes present after current position.
|
|
|
|
Returns 0 if either:
|
|
- the input callback returned an error, or
|
|
- there is no more input and the position is past the end of the stream.
|
|
|
|
After encountering the end of the input stream, 32 additional zero bytes are
|
|
copied to the ringbuffer, therefore it is safe to call this function after
|
|
every 32 bytes of input is read.
|
|
*/
|
|
BrotliBitReader.prototype.readMoreInput = function() {
|
|
if (this.bit_end_pos_ > 256) {
|
|
return;
|
|
} else if (this.eos_) {
|
|
if (this.bit_pos_ > this.bit_end_pos_)
|
|
throw new Error('Unexpected end of input ' + this.bit_pos_ + ' ' + this.bit_end_pos_);
|
|
} else {
|
|
var dst = this.buf_ptr_;
|
|
var bytes_read = this.input_.read(this.buf_, dst, BROTLI_READ_SIZE);
|
|
if (bytes_read < 0) {
|
|
throw new Error('Unexpected end of input');
|
|
}
|
|
|
|
if (bytes_read < BROTLI_READ_SIZE) {
|
|
this.eos_ = 1;
|
|
/* Store 32 bytes of zero after the stream end. */
|
|
for (var p = 0; p < 32; p++)
|
|
this.buf_[dst + bytes_read + p] = 0;
|
|
}
|
|
|
|
if (dst === 0) {
|
|
/* Copy the head of the ringbuffer to the slack region. */
|
|
for (var p = 0; p < 32; p++)
|
|
this.buf_[(BROTLI_READ_SIZE << 1) + p] = this.buf_[p];
|
|
|
|
this.buf_ptr_ = BROTLI_READ_SIZE;
|
|
} else {
|
|
this.buf_ptr_ = 0;
|
|
}
|
|
|
|
this.bit_end_pos_ += bytes_read << 3;
|
|
}
|
|
};
|
|
|
|
/* Guarantees that there are at least 24 bits in the buffer. */
|
|
BrotliBitReader.prototype.fillBitWindow = function() {
|
|
while (this.bit_pos_ >= 8) {
|
|
this.val_ >>>= 8;
|
|
this.val_ |= this.buf_[this.pos_ & BROTLI_IBUF_MASK] << 24;
|
|
++this.pos_;
|
|
this.bit_pos_ = this.bit_pos_ - 8 >>> 0;
|
|
this.bit_end_pos_ = this.bit_end_pos_ - 8 >>> 0;
|
|
}
|
|
};
|
|
|
|
/* Reads the specified number of bits from Read Buffer. */
|
|
BrotliBitReader.prototype.readBits = function(n_bits) {
|
|
if (32 - this.bit_pos_ < n_bits) {
|
|
this.fillBitWindow();
|
|
}
|
|
|
|
var val = ((this.val_ >>> this.bit_pos_) & kBitMask[n_bits]);
|
|
this.bit_pos_ += n_bits;
|
|
return val;
|
|
};
|
|
|
|
module.exports = BrotliBitReader;
|
|
|
|
|
|
/***/ },
|
|
/* 276 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* Copyright 2013 Google Inc. All Rights Reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
Collection of static dictionary words.
|
|
*/
|
|
|
|
var data = __webpack_require__(277);
|
|
exports.init = function() {
|
|
exports.dictionary = data.init();
|
|
};
|
|
|
|
exports.offsetsByLength = new Uint32Array([
|
|
0, 0, 0, 0, 0, 4096, 9216, 21504, 35840, 44032,
|
|
53248, 63488, 74752, 87040, 93696, 100864, 104704, 106752, 108928, 113536,
|
|
115968, 118528, 119872, 121280, 122016,
|
|
]);
|
|
|
|
exports.sizeBitsByLength = new Uint8Array([
|
|
0, 0, 0, 0, 10, 10, 11, 11, 10, 10,
|
|
10, 10, 10, 9, 9, 8, 7, 7, 8, 7,
|
|
7, 6, 6, 5, 5,
|
|
]);
|
|
|
|
exports.minDictionaryWordLength = 4;
|
|
exports.maxDictionaryWordLength = 24;
|
|
|
|
|
|
/***/ },
|
|
/* 277 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var base64 = __webpack_require__(3);
|
|
var fs = __webpack_require__(53);
|
|
|
|
/**
|
|
* The normal dictionary-data.js is quite large, which makes it
|
|
* unsuitable for browser usage. In order to make it smaller,
|
|
* we read dictionary.bin, which is a compressed version of
|
|
* the dictionary, and on initial load, Brotli decompresses
|
|
* it's own dictionary. 😜
|
|
*/
|
|
exports.init = function() {
|
|
var BrotliDecompressBuffer = __webpack_require__(273).BrotliDecompressBuffer;
|
|
var compressed = base64.toByteArray(__webpack_require__(278));
|
|
return BrotliDecompressBuffer(compressed);
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 278 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports="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";
|
|
|
|
|
|
/***/ },
|
|
/* 279 */
|
|
/***/ function(module, exports) {
|
|
|
|
function HuffmanCode(bits, value) {
|
|
this.bits = bits; /* number of bits used for this symbol */
|
|
this.value = value; /* symbol value or table offset */
|
|
}
|
|
|
|
exports.HuffmanCode = HuffmanCode;
|
|
|
|
var MAX_LENGTH = 15;
|
|
|
|
/* Returns reverse(reverse(key, len) + 1, len), where reverse(key, len) is the
|
|
bit-wise reversal of the len least significant bits of key. */
|
|
function GetNextKey(key, len) {
|
|
var step = 1 << (len - 1);
|
|
while (key & step) {
|
|
step >>= 1;
|
|
}
|
|
return (key & (step - 1)) + step;
|
|
}
|
|
|
|
/* Stores code in table[0], table[step], table[2*step], ..., table[end] */
|
|
/* Assumes that end is an integer multiple of step */
|
|
function ReplicateValue(table, i, step, end, code) {
|
|
do {
|
|
end -= step;
|
|
table[i + end] = new HuffmanCode(code.bits, code.value);
|
|
} while (end > 0);
|
|
}
|
|
|
|
/* Returns the table width of the next 2nd level table. count is the histogram
|
|
of bit lengths for the remaining symbols, len is the code length of the next
|
|
processed symbol */
|
|
function NextTableBitSize(count, len, root_bits) {
|
|
var left = 1 << (len - root_bits);
|
|
while (len < MAX_LENGTH) {
|
|
left -= count[len];
|
|
if (left <= 0) break;
|
|
++len;
|
|
left <<= 1;
|
|
}
|
|
return len - root_bits;
|
|
}
|
|
|
|
exports.BrotliBuildHuffmanTable = function(root_table, table, root_bits, code_lengths, code_lengths_size) {
|
|
var start_table = table;
|
|
var code; /* current table entry */
|
|
var len; /* current code length */
|
|
var symbol; /* symbol index in original or sorted table */
|
|
var key; /* reversed prefix code */
|
|
var step; /* step size to replicate values in current table */
|
|
var low; /* low bits for current root entry */
|
|
var mask; /* mask for low bits */
|
|
var table_bits; /* key length of current table */
|
|
var table_size; /* size of current table */
|
|
var total_size; /* sum of root table size and 2nd level table sizes */
|
|
var sorted; /* symbols sorted by code length */
|
|
var count = new Int32Array(MAX_LENGTH + 1); /* number of codes of each length */
|
|
var offset = new Int32Array(MAX_LENGTH + 1); /* offsets in sorted table for each length */
|
|
|
|
sorted = new Int32Array(code_lengths_size);
|
|
|
|
/* build histogram of code lengths */
|
|
for (symbol = 0; symbol < code_lengths_size; symbol++) {
|
|
count[code_lengths[symbol]]++;
|
|
}
|
|
|
|
/* generate offsets into sorted symbol table by code length */
|
|
offset[1] = 0;
|
|
for (len = 1; len < MAX_LENGTH; len++) {
|
|
offset[len + 1] = offset[len] + count[len];
|
|
}
|
|
|
|
/* sort symbols by length, by symbol order within each length */
|
|
for (symbol = 0; symbol < code_lengths_size; symbol++) {
|
|
if (code_lengths[symbol] !== 0) {
|
|
sorted[offset[code_lengths[symbol]]++] = symbol;
|
|
}
|
|
}
|
|
|
|
table_bits = root_bits;
|
|
table_size = 1 << table_bits;
|
|
total_size = table_size;
|
|
|
|
/* special case code with only one value */
|
|
if (offset[MAX_LENGTH] === 1) {
|
|
for (key = 0; key < total_size; ++key) {
|
|
root_table[table + key] = new HuffmanCode(0, sorted[0] & 0xffff);
|
|
}
|
|
|
|
return total_size;
|
|
}
|
|
|
|
/* fill in root table */
|
|
key = 0;
|
|
symbol = 0;
|
|
for (len = 1, step = 2; len <= root_bits; ++len, step <<= 1) {
|
|
for (; count[len] > 0; --count[len]) {
|
|
code = new HuffmanCode(len & 0xff, sorted[symbol++] & 0xffff);
|
|
ReplicateValue(root_table, table + key, step, table_size, code);
|
|
key = GetNextKey(key, len);
|
|
}
|
|
}
|
|
|
|
/* fill in 2nd level tables and add pointers to root table */
|
|
mask = total_size - 1;
|
|
low = -1;
|
|
for (len = root_bits + 1, step = 2; len <= MAX_LENGTH; ++len, step <<= 1) {
|
|
for (; count[len] > 0; --count[len]) {
|
|
if ((key & mask) !== low) {
|
|
table += table_size;
|
|
table_bits = NextTableBitSize(count, len, root_bits);
|
|
table_size = 1 << table_bits;
|
|
total_size += table_size;
|
|
low = key & mask;
|
|
root_table[start_table + low] = new HuffmanCode((table_bits + root_bits) & 0xff, ((table - start_table) - low) & 0xffff);
|
|
}
|
|
code = new HuffmanCode((len - root_bits) & 0xff, sorted[symbol++] & 0xffff);
|
|
ReplicateValue(root_table, table + (key >> root_bits), step, table_size, code);
|
|
key = GetNextKey(key, len);
|
|
}
|
|
}
|
|
|
|
return total_size;
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 280 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* Copyright 2013 Google Inc. All Rights Reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
Lookup table to map the previous two bytes to a context id.
|
|
|
|
There are four different context modeling modes defined here:
|
|
CONTEXT_LSB6: context id is the least significant 6 bits of the last byte,
|
|
CONTEXT_MSB6: context id is the most significant 6 bits of the last byte,
|
|
CONTEXT_UTF8: second-order context model tuned for UTF8-encoded text,
|
|
CONTEXT_SIGNED: second-order context model tuned for signed integers.
|
|
|
|
The context id for the UTF8 context model is calculated as follows. If p1
|
|
and p2 are the previous two bytes, we calcualte the context as
|
|
|
|
context = kContextLookup[p1] | kContextLookup[p2 + 256].
|
|
|
|
If the previous two bytes are ASCII characters (i.e. < 128), this will be
|
|
equivalent to
|
|
|
|
context = 4 * context1(p1) + context2(p2),
|
|
|
|
where context1 is based on the previous byte in the following way:
|
|
|
|
0 : non-ASCII control
|
|
1 : \t, \n, \r
|
|
2 : space
|
|
3 : other punctuation
|
|
4 : " '
|
|
5 : %
|
|
6 : ( < [ {
|
|
7 : ) > ] }
|
|
8 : , ; :
|
|
9 : .
|
|
10 : =
|
|
11 : number
|
|
12 : upper-case vowel
|
|
13 : upper-case consonant
|
|
14 : lower-case vowel
|
|
15 : lower-case consonant
|
|
|
|
and context2 is based on the second last byte:
|
|
|
|
0 : control, space
|
|
1 : punctuation
|
|
2 : upper-case letter, number
|
|
3 : lower-case letter
|
|
|
|
If the last byte is ASCII, and the second last byte is not (in a valid UTF8
|
|
stream it will be a continuation byte, value between 128 and 191), the
|
|
context is the same as if the second last byte was an ASCII control or space.
|
|
|
|
If the last byte is a UTF8 lead byte (value >= 192), then the next byte will
|
|
be a continuation byte and the context id is 2 or 3 depending on the LSB of
|
|
the last byte and to a lesser extent on the second last byte if it is ASCII.
|
|
|
|
If the last byte is a UTF8 continuation byte, the second last byte can be:
|
|
- continuation byte: the next byte is probably ASCII or lead byte (assuming
|
|
4-byte UTF8 characters are rare) and the context id is 0 or 1.
|
|
- lead byte (192 - 207): next byte is ASCII or lead byte, context is 0 or 1
|
|
- lead byte (208 - 255): next byte is continuation byte, context is 2 or 3
|
|
|
|
The possible value combinations of the previous two bytes, the range of
|
|
context ids and the type of the next byte is summarized in the table below:
|
|
|
|
|--------\-----------------------------------------------------------------|
|
|
| \ Last byte |
|
|
| Second \---------------------------------------------------------------|
|
|
| last byte \ ASCII | cont. byte | lead byte |
|
|
| \ (0-127) | (128-191) | (192-) |
|
|
|=============|===================|=====================|==================|
|
|
| ASCII | next: ASCII/lead | not valid | next: cont. |
|
|
| (0-127) | context: 4 - 63 | | context: 2 - 3 |
|
|
|-------------|-------------------|---------------------|------------------|
|
|
| cont. byte | next: ASCII/lead | next: ASCII/lead | next: cont. |
|
|
| (128-191) | context: 4 - 63 | context: 0 - 1 | context: 2 - 3 |
|
|
|-------------|-------------------|---------------------|------------------|
|
|
| lead byte | not valid | next: ASCII/lead | not valid |
|
|
| (192-207) | | context: 0 - 1 | |
|
|
|-------------|-------------------|---------------------|------------------|
|
|
| lead byte | not valid | next: cont. | not valid |
|
|
| (208-) | | context: 2 - 3 | |
|
|
|-------------|-------------------|---------------------|------------------|
|
|
|
|
The context id for the signed context mode is calculated as:
|
|
|
|
context = (kContextLookup[512 + p1] << 3) | kContextLookup[512 + p2].
|
|
|
|
For any context modeling modes, the context ids can be calculated by |-ing
|
|
together two lookups from one table using context model dependent offsets:
|
|
|
|
context = kContextLookup[offset1 + p1] | kContextLookup[offset2 + p2].
|
|
|
|
where offset1 and offset2 are dependent on the context mode.
|
|
*/
|
|
|
|
var CONTEXT_LSB6 = 0;
|
|
var CONTEXT_MSB6 = 1;
|
|
var CONTEXT_UTF8 = 2;
|
|
var CONTEXT_SIGNED = 3;
|
|
|
|
/* Common context lookup table for all context modes. */
|
|
exports.lookup = new Uint8Array([
|
|
/* CONTEXT_UTF8, last byte. */
|
|
/* ASCII range. */
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
8, 12, 16, 12, 12, 20, 12, 16, 24, 28, 12, 12, 32, 12, 36, 12,
|
|
44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 32, 32, 24, 40, 28, 12,
|
|
12, 48, 52, 52, 52, 48, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48,
|
|
52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 24, 12, 28, 12, 12,
|
|
12, 56, 60, 60, 60, 56, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56,
|
|
60, 60, 60, 60, 60, 56, 60, 60, 60, 60, 60, 24, 12, 28, 12, 0,
|
|
/* UTF8 continuation byte range. */
|
|
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
|
|
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
|
|
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
|
|
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
|
|
/* UTF8 lead byte range. */
|
|
2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
|
|
2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
|
|
2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
|
|
2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
|
|
/* CONTEXT_UTF8 second last byte. */
|
|
/* ASCII range. */
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
|
|
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
|
|
1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
|
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0,
|
|
/* UTF8 continuation byte range. */
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
/* UTF8 lead byte range. */
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
/* CONTEXT_SIGNED, second last byte. */
|
|
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
|
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
|
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
|
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
|
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
|
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
|
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
|
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
|
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
|
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
|
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
|
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7,
|
|
/* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */
|
|
0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
|
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
|
|
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
|
|
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
|
|
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
|
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
|
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
|
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
|
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
|
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
|
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
|
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
|
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
|
|
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
|
|
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
|
|
48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 56,
|
|
/* CONTEXT_LSB6, last byte. */
|
|
0, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
|
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
|
0, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
|
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
|
0, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
|
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
|
0, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
|
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
|
/* CONTEXT_MSB6, last byte. */
|
|
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
|
|
4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
|
|
8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11,
|
|
12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15,
|
|
16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19,
|
|
20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23,
|
|
24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27,
|
|
28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31,
|
|
32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35,
|
|
36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39,
|
|
40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43,
|
|
44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47,
|
|
48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51,
|
|
52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55,
|
|
56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59,
|
|
60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63,
|
|
/* CONTEXT_{M,L}SB6, second last byte, */
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
]);
|
|
|
|
exports.lookupOffsets = new Uint16Array([
|
|
/* CONTEXT_LSB6 */
|
|
1024, 1536,
|
|
/* CONTEXT_MSB6 */
|
|
1280, 1536,
|
|
/* CONTEXT_UTF8 */
|
|
0, 256,
|
|
/* CONTEXT_SIGNED */
|
|
768, 512,
|
|
]);
|
|
|
|
|
|
/***/ },
|
|
/* 281 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* Copyright 2013 Google Inc. All Rights Reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
Lookup tables to map prefix codes to value ranges. This is used during
|
|
decoding of the block lengths, literal insertion lengths and copy lengths.
|
|
*/
|
|
|
|
/* Represents the range of values belonging to a prefix code: */
|
|
/* [offset, offset + 2^nbits) */
|
|
function PrefixCodeRange(offset, nbits) {
|
|
this.offset = offset;
|
|
this.nbits = nbits;
|
|
}
|
|
|
|
exports.kBlockLengthPrefixCode = [
|
|
new PrefixCodeRange(1, 2), new PrefixCodeRange(5, 2), new PrefixCodeRange(9, 2), new PrefixCodeRange(13, 2),
|
|
new PrefixCodeRange(17, 3), new PrefixCodeRange(25, 3), new PrefixCodeRange(33, 3), new PrefixCodeRange(41, 3),
|
|
new PrefixCodeRange(49, 4), new PrefixCodeRange(65, 4), new PrefixCodeRange(81, 4), new PrefixCodeRange(97, 4),
|
|
new PrefixCodeRange(113, 5), new PrefixCodeRange(145, 5), new PrefixCodeRange(177, 5), new PrefixCodeRange(209, 5),
|
|
new PrefixCodeRange(241, 6), new PrefixCodeRange(305, 6), new PrefixCodeRange(369, 7), new PrefixCodeRange(497, 8),
|
|
new PrefixCodeRange(753, 9), new PrefixCodeRange(1265, 10), new PrefixCodeRange(2289, 11), new PrefixCodeRange(4337, 12),
|
|
new PrefixCodeRange(8433, 13), new PrefixCodeRange(16625, 24)
|
|
];
|
|
|
|
exports.kInsertLengthPrefixCode = [
|
|
new PrefixCodeRange(0, 0), new PrefixCodeRange(1, 0), new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0),
|
|
new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), new PrefixCodeRange(6, 1), new PrefixCodeRange(8, 1),
|
|
new PrefixCodeRange(10, 2), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 3), new PrefixCodeRange(26, 3),
|
|
new PrefixCodeRange(34, 4), new PrefixCodeRange(50, 4), new PrefixCodeRange(66, 5), new PrefixCodeRange(98, 5),
|
|
new PrefixCodeRange(130, 6), new PrefixCodeRange(194, 7), new PrefixCodeRange(322, 8), new PrefixCodeRange(578, 9),
|
|
new PrefixCodeRange(1090, 10), new PrefixCodeRange(2114, 12), new PrefixCodeRange(6210, 14), new PrefixCodeRange(22594, 24),
|
|
];
|
|
|
|
exports.kCopyLengthPrefixCode = [
|
|
new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0),
|
|
new PrefixCodeRange(6, 0), new PrefixCodeRange(7, 0), new PrefixCodeRange(8, 0), new PrefixCodeRange(9, 0),
|
|
new PrefixCodeRange(10, 1), new PrefixCodeRange(12, 1), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 2),
|
|
new PrefixCodeRange(22, 3), new PrefixCodeRange(30, 3), new PrefixCodeRange(38, 4), new PrefixCodeRange(54, 4),
|
|
new PrefixCodeRange(70, 5), new PrefixCodeRange(102, 5), new PrefixCodeRange(134, 6), new PrefixCodeRange(198, 7),
|
|
new PrefixCodeRange(326, 8), new PrefixCodeRange(582, 9), new PrefixCodeRange(1094, 10), new PrefixCodeRange(2118, 24),
|
|
];
|
|
|
|
exports.kInsertRangeLut = [
|
|
0, 0, 8, 8, 0, 16, 8, 16, 16,
|
|
];
|
|
|
|
exports.kCopyRangeLut = [
|
|
0, 8, 0, 8, 16, 0, 16, 8, 16,
|
|
];
|
|
|
|
|
|
/***/ },
|
|
/* 282 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* Copyright 2013 Google Inc. All Rights Reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
Transformations on dictionary words.
|
|
*/
|
|
|
|
var BrotliDictionary = __webpack_require__(276);
|
|
|
|
var kIdentity = 0;
|
|
var kOmitLast1 = 1;
|
|
var kOmitLast2 = 2;
|
|
var kOmitLast3 = 3;
|
|
var kOmitLast4 = 4;
|
|
var kOmitLast5 = 5;
|
|
var kOmitLast6 = 6;
|
|
var kOmitLast7 = 7;
|
|
var kOmitLast8 = 8;
|
|
var kOmitLast9 = 9;
|
|
var kUppercaseFirst = 10;
|
|
var kUppercaseAll = 11;
|
|
var kOmitFirst1 = 12;
|
|
var kOmitFirst2 = 13;
|
|
var kOmitFirst3 = 14;
|
|
var kOmitFirst4 = 15;
|
|
var kOmitFirst5 = 16;
|
|
var kOmitFirst6 = 17;
|
|
var kOmitFirst7 = 18;
|
|
var kOmitFirst8 = 19;
|
|
var kOmitFirst9 = 20;
|
|
|
|
function Transform(prefix, transform, suffix) {
|
|
this.prefix = new Uint8Array(prefix.length);
|
|
this.transform = transform;
|
|
this.suffix = new Uint8Array(suffix.length);
|
|
|
|
for (var i = 0; i < prefix.length; i++)
|
|
this.prefix[i] = prefix.charCodeAt(i);
|
|
|
|
for (var i = 0; i < suffix.length; i++)
|
|
this.suffix[i] = suffix.charCodeAt(i);
|
|
}
|
|
|
|
var kTransforms = [
|
|
new Transform( "", kIdentity, "" ),
|
|
new Transform( "", kIdentity, " " ),
|
|
new Transform( " ", kIdentity, " " ),
|
|
new Transform( "", kOmitFirst1, "" ),
|
|
new Transform( "", kUppercaseFirst, " " ),
|
|
new Transform( "", kIdentity, " the " ),
|
|
new Transform( " ", kIdentity, "" ),
|
|
new Transform( "s ", kIdentity, " " ),
|
|
new Transform( "", kIdentity, " of " ),
|
|
new Transform( "", kUppercaseFirst, "" ),
|
|
new Transform( "", kIdentity, " and " ),
|
|
new Transform( "", kOmitFirst2, "" ),
|
|
new Transform( "", kOmitLast1, "" ),
|
|
new Transform( ", ", kIdentity, " " ),
|
|
new Transform( "", kIdentity, ", " ),
|
|
new Transform( " ", kUppercaseFirst, " " ),
|
|
new Transform( "", kIdentity, " in " ),
|
|
new Transform( "", kIdentity, " to " ),
|
|
new Transform( "e ", kIdentity, " " ),
|
|
new Transform( "", kIdentity, "\"" ),
|
|
new Transform( "", kIdentity, "." ),
|
|
new Transform( "", kIdentity, "\">" ),
|
|
new Transform( "", kIdentity, "\n" ),
|
|
new Transform( "", kOmitLast3, "" ),
|
|
new Transform( "", kIdentity, "]" ),
|
|
new Transform( "", kIdentity, " for " ),
|
|
new Transform( "", kOmitFirst3, "" ),
|
|
new Transform( "", kOmitLast2, "" ),
|
|
new Transform( "", kIdentity, " a " ),
|
|
new Transform( "", kIdentity, " that " ),
|
|
new Transform( " ", kUppercaseFirst, "" ),
|
|
new Transform( "", kIdentity, ". " ),
|
|
new Transform( ".", kIdentity, "" ),
|
|
new Transform( " ", kIdentity, ", " ),
|
|
new Transform( "", kOmitFirst4, "" ),
|
|
new Transform( "", kIdentity, " with " ),
|
|
new Transform( "", kIdentity, "'" ),
|
|
new Transform( "", kIdentity, " from " ),
|
|
new Transform( "", kIdentity, " by " ),
|
|
new Transform( "", kOmitFirst5, "" ),
|
|
new Transform( "", kOmitFirst6, "" ),
|
|
new Transform( " the ", kIdentity, "" ),
|
|
new Transform( "", kOmitLast4, "" ),
|
|
new Transform( "", kIdentity, ". The " ),
|
|
new Transform( "", kUppercaseAll, "" ),
|
|
new Transform( "", kIdentity, " on " ),
|
|
new Transform( "", kIdentity, " as " ),
|
|
new Transform( "", kIdentity, " is " ),
|
|
new Transform( "", kOmitLast7, "" ),
|
|
new Transform( "", kOmitLast1, "ing " ),
|
|
new Transform( "", kIdentity, "\n\t" ),
|
|
new Transform( "", kIdentity, ":" ),
|
|
new Transform( " ", kIdentity, ". " ),
|
|
new Transform( "", kIdentity, "ed " ),
|
|
new Transform( "", kOmitFirst9, "" ),
|
|
new Transform( "", kOmitFirst7, "" ),
|
|
new Transform( "", kOmitLast6, "" ),
|
|
new Transform( "", kIdentity, "(" ),
|
|
new Transform( "", kUppercaseFirst, ", " ),
|
|
new Transform( "", kOmitLast8, "" ),
|
|
new Transform( "", kIdentity, " at " ),
|
|
new Transform( "", kIdentity, "ly " ),
|
|
new Transform( " the ", kIdentity, " of " ),
|
|
new Transform( "", kOmitLast5, "" ),
|
|
new Transform( "", kOmitLast9, "" ),
|
|
new Transform( " ", kUppercaseFirst, ", " ),
|
|
new Transform( "", kUppercaseFirst, "\"" ),
|
|
new Transform( ".", kIdentity, "(" ),
|
|
new Transform( "", kUppercaseAll, " " ),
|
|
new Transform( "", kUppercaseFirst, "\">" ),
|
|
new Transform( "", kIdentity, "=\"" ),
|
|
new Transform( " ", kIdentity, "." ),
|
|
new Transform( ".com/", kIdentity, "" ),
|
|
new Transform( " the ", kIdentity, " of the " ),
|
|
new Transform( "", kUppercaseFirst, "'" ),
|
|
new Transform( "", kIdentity, ". This " ),
|
|
new Transform( "", kIdentity, "," ),
|
|
new Transform( ".", kIdentity, " " ),
|
|
new Transform( "", kUppercaseFirst, "(" ),
|
|
new Transform( "", kUppercaseFirst, "." ),
|
|
new Transform( "", kIdentity, " not " ),
|
|
new Transform( " ", kIdentity, "=\"" ),
|
|
new Transform( "", kIdentity, "er " ),
|
|
new Transform( " ", kUppercaseAll, " " ),
|
|
new Transform( "", kIdentity, "al " ),
|
|
new Transform( " ", kUppercaseAll, "" ),
|
|
new Transform( "", kIdentity, "='" ),
|
|
new Transform( "", kUppercaseAll, "\"" ),
|
|
new Transform( "", kUppercaseFirst, ". " ),
|
|
new Transform( " ", kIdentity, "(" ),
|
|
new Transform( "", kIdentity, "ful " ),
|
|
new Transform( " ", kUppercaseFirst, ". " ),
|
|
new Transform( "", kIdentity, "ive " ),
|
|
new Transform( "", kIdentity, "less " ),
|
|
new Transform( "", kUppercaseAll, "'" ),
|
|
new Transform( "", kIdentity, "est " ),
|
|
new Transform( " ", kUppercaseFirst, "." ),
|
|
new Transform( "", kUppercaseAll, "\">" ),
|
|
new Transform( " ", kIdentity, "='" ),
|
|
new Transform( "", kUppercaseFirst, "," ),
|
|
new Transform( "", kIdentity, "ize " ),
|
|
new Transform( "", kUppercaseAll, "." ),
|
|
new Transform( "\xc2\xa0", kIdentity, "" ),
|
|
new Transform( " ", kIdentity, "," ),
|
|
new Transform( "", kUppercaseFirst, "=\"" ),
|
|
new Transform( "", kUppercaseAll, "=\"" ),
|
|
new Transform( "", kIdentity, "ous " ),
|
|
new Transform( "", kUppercaseAll, ", " ),
|
|
new Transform( "", kUppercaseFirst, "='" ),
|
|
new Transform( " ", kUppercaseFirst, "," ),
|
|
new Transform( " ", kUppercaseAll, "=\"" ),
|
|
new Transform( " ", kUppercaseAll, ", " ),
|
|
new Transform( "", kUppercaseAll, "," ),
|
|
new Transform( "", kUppercaseAll, "(" ),
|
|
new Transform( "", kUppercaseAll, ". " ),
|
|
new Transform( " ", kUppercaseAll, "." ),
|
|
new Transform( "", kUppercaseAll, "='" ),
|
|
new Transform( " ", kUppercaseAll, ". " ),
|
|
new Transform( " ", kUppercaseFirst, "=\"" ),
|
|
new Transform( " ", kUppercaseAll, "='" ),
|
|
new Transform( " ", kUppercaseFirst, "='" )
|
|
];
|
|
|
|
exports.kTransforms = kTransforms;
|
|
exports.kNumTransforms = kTransforms.length;
|
|
|
|
function ToUpperCase(p, i) {
|
|
if (p[i] < 0xc0) {
|
|
if (p[i] >= 97 && p[i] <= 122) {
|
|
p[i] ^= 32;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
/* An overly simplified uppercasing model for utf-8. */
|
|
if (p[i] < 0xe0) {
|
|
p[i + 1] ^= 32;
|
|
return 2;
|
|
}
|
|
|
|
/* An arbitrary transform for three byte characters. */
|
|
p[i + 2] ^= 5;
|
|
return 3;
|
|
}
|
|
|
|
exports.transformDictionaryWord = function(dst, idx, word, len, transform) {
|
|
var prefix = kTransforms[transform].prefix;
|
|
var suffix = kTransforms[transform].suffix;
|
|
var t = kTransforms[transform].transform;
|
|
var skip = t < kOmitFirst1 ? 0 : t - (kOmitFirst1 - 1);
|
|
var i = 0;
|
|
var start_idx = idx;
|
|
var uppercase;
|
|
|
|
if (skip > len) {
|
|
skip = len;
|
|
}
|
|
|
|
var prefix_pos = 0;
|
|
while (prefix_pos < prefix.length) {
|
|
dst[idx++] = prefix[prefix_pos++];
|
|
}
|
|
|
|
word += skip;
|
|
len -= skip;
|
|
|
|
if (t <= kOmitLast9) {
|
|
len -= t;
|
|
}
|
|
|
|
for (i = 0; i < len; i++) {
|
|
dst[idx++] = BrotliDictionary.dictionary[word + i];
|
|
}
|
|
|
|
uppercase = idx - len;
|
|
|
|
if (t === kUppercaseFirst) {
|
|
ToUpperCase(dst, uppercase);
|
|
} else if (t === kUppercaseAll) {
|
|
while (len > 0) {
|
|
var step = ToUpperCase(dst, uppercase);
|
|
uppercase += step;
|
|
len -= step;
|
|
}
|
|
}
|
|
|
|
var suffix_pos = 0;
|
|
while (suffix_pos < suffix.length) {
|
|
dst[idx++] = suffix[suffix_pos++];
|
|
}
|
|
|
|
return idx - start_idx;
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 283 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(__dirname) {// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var AFMFont, PDFFont, StandardFont, fs,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
AFMFont = __webpack_require__(284);
|
|
|
|
PDFFont = __webpack_require__(79);
|
|
|
|
fs = __webpack_require__(53);
|
|
|
|
StandardFont = (function(superClass) {
|
|
var STANDARD_FONTS;
|
|
|
|
extend(StandardFont, superClass);
|
|
|
|
function StandardFont(document, name1, id) {
|
|
var ref;
|
|
this.document = document;
|
|
this.name = name1;
|
|
this.id = id;
|
|
this.font = new AFMFont(STANDARD_FONTS[this.name]());
|
|
ref = this.font, this.ascender = ref.ascender, this.descender = ref.descender, this.bbox = ref.bbox, this.lineGap = ref.lineGap;
|
|
}
|
|
|
|
StandardFont.prototype.embed = function() {
|
|
this.dictionary.data = {
|
|
Type: 'Font',
|
|
BaseFont: this.name,
|
|
Subtype: 'Type1',
|
|
Encoding: 'WinAnsiEncoding'
|
|
};
|
|
return this.dictionary.end();
|
|
};
|
|
|
|
StandardFont.prototype.encode = function(text) {
|
|
var advances, encoded, glyph, glyphs, i, j, len, positions;
|
|
encoded = this.font.encodeText(text);
|
|
glyphs = this.font.glyphsForString('' + text);
|
|
advances = this.font.advancesForGlyphs(glyphs);
|
|
positions = [];
|
|
for (i = j = 0, len = glyphs.length; j < len; i = ++j) {
|
|
glyph = glyphs[i];
|
|
positions.push({
|
|
xAdvance: advances[i],
|
|
yAdvance: 0,
|
|
xOffset: 0,
|
|
yOffset: 0,
|
|
advanceWidth: this.font.widthOfGlyph(glyph)
|
|
});
|
|
}
|
|
return [encoded, positions];
|
|
};
|
|
|
|
StandardFont.prototype.widthOfString = function(string, size) {
|
|
var advance, advances, glyphs, j, len, scale, width;
|
|
glyphs = this.font.glyphsForString('' + string);
|
|
advances = this.font.advancesForGlyphs(glyphs);
|
|
width = 0;
|
|
for (j = 0, len = advances.length; j < len; j++) {
|
|
advance = advances[j];
|
|
width += advance;
|
|
}
|
|
scale = size / 1000;
|
|
return width * scale;
|
|
};
|
|
|
|
StandardFont.isStandardFont = function(name) {
|
|
return name in STANDARD_FONTS;
|
|
};
|
|
|
|
STANDARD_FONTS = {
|
|
"Courier": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Courier.afm", 'utf8');
|
|
},
|
|
"Courier-Bold": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Courier-Bold.afm", 'utf8');
|
|
},
|
|
"Courier-Oblique": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Courier-Oblique.afm", 'utf8');
|
|
},
|
|
"Courier-BoldOblique": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Courier-BoldOblique.afm", 'utf8');
|
|
},
|
|
"Helvetica": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Helvetica.afm", 'utf8');
|
|
},
|
|
"Helvetica-Bold": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Helvetica-Bold.afm", 'utf8');
|
|
},
|
|
"Helvetica-Oblique": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Helvetica-Oblique.afm", 'utf8');
|
|
},
|
|
"Helvetica-BoldOblique": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Helvetica-BoldOblique.afm", 'utf8');
|
|
},
|
|
"Times-Roman": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Times-Roman.afm", 'utf8');
|
|
},
|
|
"Times-Bold": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Times-Bold.afm", 'utf8');
|
|
},
|
|
"Times-Italic": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Times-Italic.afm", 'utf8');
|
|
},
|
|
"Times-BoldItalic": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Times-BoldItalic.afm", 'utf8');
|
|
},
|
|
"Symbol": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/Symbol.afm", 'utf8');
|
|
},
|
|
"ZapfDingbats": function() {
|
|
return fs.readFileSync(__dirname + "/../font/data/ZapfDingbats.afm", 'utf8');
|
|
}
|
|
};
|
|
|
|
return StandardFont;
|
|
|
|
})(PDFFont);
|
|
|
|
module.exports = StandardFont;
|
|
|
|
}).call(this);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, "/"))
|
|
|
|
/***/ },
|
|
/* 284 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var AFMFont, fs;
|
|
|
|
fs = __webpack_require__(53);
|
|
|
|
AFMFont = (function() {
|
|
var WIN_ANSI_MAP, characters;
|
|
|
|
AFMFont.open = function(filename) {
|
|
return new AFMFont(fs.readFileSync(filename, 'utf8'));
|
|
};
|
|
|
|
function AFMFont(contents) {
|
|
var e, i;
|
|
this.contents = contents;
|
|
this.attributes = {};
|
|
this.glyphWidths = {};
|
|
this.boundingBoxes = {};
|
|
this.kernPairs = {};
|
|
this.parse();
|
|
this.charWidths = (function() {
|
|
var j, results;
|
|
results = [];
|
|
for (i = j = 0; j <= 255; i = ++j) {
|
|
results.push(this.glyphWidths[characters[i]]);
|
|
}
|
|
return results;
|
|
}).call(this);
|
|
this.bbox = (function() {
|
|
var j, len, ref, results;
|
|
ref = this.attributes['FontBBox'].split(/\s+/);
|
|
results = [];
|
|
for (j = 0, len = ref.length; j < len; j++) {
|
|
e = ref[j];
|
|
results.push(+e);
|
|
}
|
|
return results;
|
|
}).call(this);
|
|
this.ascender = +(this.attributes['Ascender'] || 0);
|
|
this.descender = +(this.attributes['Descender'] || 0);
|
|
this.lineGap = (this.bbox[3] - this.bbox[1]) - (this.ascender - this.descender);
|
|
}
|
|
|
|
AFMFont.prototype.parse = function() {
|
|
var a, j, key, len, line, match, name, ref, section, value;
|
|
section = '';
|
|
ref = this.contents.split('\n');
|
|
for (j = 0, len = ref.length; j < len; j++) {
|
|
line = ref[j];
|
|
if (match = line.match(/^Start(\w+)/)) {
|
|
section = match[1];
|
|
continue;
|
|
} else if (match = line.match(/^End(\w+)/)) {
|
|
section = '';
|
|
continue;
|
|
}
|
|
switch (section) {
|
|
case 'FontMetrics':
|
|
match = line.match(/(^\w+)\s+(.*)/);
|
|
key = match[1];
|
|
value = match[2];
|
|
if (a = this.attributes[key]) {
|
|
if (!Array.isArray(a)) {
|
|
a = this.attributes[key] = [a];
|
|
}
|
|
a.push(value);
|
|
} else {
|
|
this.attributes[key] = value;
|
|
}
|
|
break;
|
|
case 'CharMetrics':
|
|
if (!/^CH?\s/.test(line)) {
|
|
continue;
|
|
}
|
|
name = line.match(/\bN\s+(\.?\w+)\s*;/)[1];
|
|
this.glyphWidths[name] = +line.match(/\bWX\s+(\d+)\s*;/)[1];
|
|
break;
|
|
case 'KernPairs':
|
|
match = line.match(/^KPX\s+(\.?\w+)\s+(\.?\w+)\s+(-?\d+)/);
|
|
if (match) {
|
|
this.kernPairs[match[1] + '\0' + match[2]] = parseInt(match[3]);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
WIN_ANSI_MAP = {
|
|
402: 131,
|
|
8211: 150,
|
|
8212: 151,
|
|
8216: 145,
|
|
8217: 146,
|
|
8218: 130,
|
|
8220: 147,
|
|
8221: 148,
|
|
8222: 132,
|
|
8224: 134,
|
|
8225: 135,
|
|
8226: 149,
|
|
8230: 133,
|
|
8364: 128,
|
|
8240: 137,
|
|
8249: 139,
|
|
8250: 155,
|
|
710: 136,
|
|
8482: 153,
|
|
338: 140,
|
|
339: 156,
|
|
732: 152,
|
|
352: 138,
|
|
353: 154,
|
|
376: 159,
|
|
381: 142,
|
|
382: 158
|
|
};
|
|
|
|
AFMFont.prototype.encodeText = function(text) {
|
|
var char, i, j, ref, res;
|
|
res = [];
|
|
for (i = j = 0, ref = text.length; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
|
|
char = text.charCodeAt(i);
|
|
char = WIN_ANSI_MAP[char] || char;
|
|
res.push(char.toString(16));
|
|
}
|
|
return res;
|
|
};
|
|
|
|
AFMFont.prototype.glyphsForString = function(string) {
|
|
var charCode, glyphs, i, j, ref;
|
|
glyphs = [];
|
|
for (i = j = 0, ref = string.length; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
|
|
charCode = string.charCodeAt(i);
|
|
glyphs.push(this.characterToGlyph(charCode));
|
|
}
|
|
return glyphs;
|
|
};
|
|
|
|
AFMFont.prototype.characterToGlyph = function(character) {
|
|
return characters[WIN_ANSI_MAP[character] || character] || '.notdef';
|
|
};
|
|
|
|
AFMFont.prototype.widthOfGlyph = function(glyph) {
|
|
return this.glyphWidths[glyph] || 0;
|
|
};
|
|
|
|
AFMFont.prototype.getKernPair = function(left, right) {
|
|
return this.kernPairs[left + '\0' + right] || 0;
|
|
};
|
|
|
|
AFMFont.prototype.advancesForGlyphs = function(glyphs) {
|
|
var advances, index, j, left, len, right;
|
|
advances = [];
|
|
for (index = j = 0, len = glyphs.length; j < len; index = ++j) {
|
|
left = glyphs[index];
|
|
right = glyphs[index + 1];
|
|
advances.push(this.widthOfGlyph(left) + this.getKernPair(left, right));
|
|
}
|
|
return advances;
|
|
};
|
|
|
|
characters = '.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n.notdef .notdef .notdef .notdef\n\nspace exclam quotedbl numbersign\ndollar percent ampersand quotesingle\nparenleft parenright asterisk plus\ncomma hyphen period slash\nzero one two three\nfour five six seven\neight nine colon semicolon\nless equal greater question\n\nat A B C\nD E F G\nH I J K\nL M N O\nP Q R S\nT U V W\nX Y Z bracketleft\nbackslash bracketright asciicircum underscore\n\ngrave a b c\nd e f g\nh i j k\nl m n o\np q r s\nt u v w\nx y z braceleft\nbar braceright asciitilde .notdef\n\nEuro .notdef quotesinglbase florin\nquotedblbase ellipsis dagger daggerdbl\ncircumflex perthousand Scaron guilsinglleft\nOE .notdef Zcaron .notdef\n.notdef quoteleft quoteright quotedblleft\nquotedblright bullet endash emdash\ntilde trademark scaron guilsinglright\noe .notdef zcaron ydieresis\n\nspace exclamdown cent sterling\ncurrency yen brokenbar section\ndieresis copyright ordfeminine guillemotleft\nlogicalnot hyphen registered macron\ndegree plusminus twosuperior threesuperior\nacute mu paragraph periodcentered\ncedilla onesuperior ordmasculine guillemotright\nonequarter onehalf threequarters questiondown\n\nAgrave Aacute Acircumflex Atilde\nAdieresis Aring AE Ccedilla\nEgrave Eacute Ecircumflex Edieresis\nIgrave Iacute Icircumflex Idieresis\nEth Ntilde Ograve Oacute\nOcircumflex Otilde Odieresis multiply\nOslash Ugrave Uacute Ucircumflex\nUdieresis Yacute Thorn germandbls\n\nagrave aacute acircumflex atilde\nadieresis aring ae ccedilla\negrave eacute ecircumflex edieresis\nigrave iacute icircumflex idieresis\neth ntilde ograve oacute\nocircumflex otilde odieresis divide\noslash ugrave uacute ucircumflex\nudieresis yacute thorn ydieresis'.split(/\s+/);
|
|
|
|
return AFMFont;
|
|
|
|
})();
|
|
|
|
module.exports = AFMFont;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 285 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var EmbeddedFont, PDFFont, PDFObject,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty,
|
|
slice = [].slice;
|
|
|
|
PDFFont = __webpack_require__(79);
|
|
|
|
PDFObject = __webpack_require__(54);
|
|
|
|
EmbeddedFont = (function(superClass) {
|
|
var toHex;
|
|
|
|
extend(EmbeddedFont, superClass);
|
|
|
|
function EmbeddedFont(document, font, id) {
|
|
this.document = document;
|
|
this.font = font;
|
|
this.id = id;
|
|
this.subset = this.font.createSubset();
|
|
this.unicode = [[0]];
|
|
this.widths = [this.font.getGlyph(0).advanceWidth];
|
|
this.name = this.font.postscriptName;
|
|
this.scale = 1000 / this.font.unitsPerEm;
|
|
this.ascender = this.font.ascent * this.scale;
|
|
this.descender = this.font.descent * this.scale;
|
|
this.lineGap = this.font.lineGap * this.scale;
|
|
this.bbox = this.font.bbox;
|
|
}
|
|
|
|
EmbeddedFont.prototype.encode = function(text, features) {
|
|
var base, base1, gid, glyph, glyphs, i, j, key, len, positions, ref, res;
|
|
ref = this.font.layout(text, features), glyphs = ref.glyphs, positions = ref.positions;
|
|
res = [];
|
|
for (i = j = 0, len = glyphs.length; j < len; i = ++j) {
|
|
glyph = glyphs[i];
|
|
gid = this.subset.includeGlyph(glyph.id);
|
|
res.push(('0000' + gid.toString(16)).slice(-4));
|
|
if ((base = this.widths)[gid] == null) {
|
|
base[gid] = glyph.advanceWidth * this.scale;
|
|
}
|
|
if ((base1 = this.unicode)[gid] == null) {
|
|
base1[gid] = glyph.codePoints;
|
|
}
|
|
for (key in positions[i]) {
|
|
positions[i][key] *= this.scale;
|
|
}
|
|
positions[i].advanceWidth = glyph.advanceWidth * this.scale;
|
|
}
|
|
return [res, positions];
|
|
};
|
|
|
|
EmbeddedFont.prototype.widthOfString = function(string, size, features) {
|
|
var scale, width;
|
|
width = this.font.layout(string, features).advanceWidth;
|
|
scale = size / this.font.unitsPerEm;
|
|
return width * scale;
|
|
};
|
|
|
|
EmbeddedFont.prototype.embed = function() {
|
|
var bbox, descendantFont, descriptor, familyClass, flags, fontFile, i, isCFF, name, ref, tag;
|
|
isCFF = this.subset.cff != null;
|
|
fontFile = this.document.ref();
|
|
if (isCFF) {
|
|
fontFile.data.Subtype = 'CIDFontType0C';
|
|
}
|
|
this.subset.encodeStream().pipe(fontFile);
|
|
familyClass = (((ref = this.font['OS/2']) != null ? ref.sFamilyClass : void 0) || 0) >> 8;
|
|
flags = 0;
|
|
if (this.font.post.isFixedPitch) {
|
|
flags |= 1 << 0;
|
|
}
|
|
if ((1 <= familyClass && familyClass <= 7)) {
|
|
flags |= 1 << 1;
|
|
}
|
|
flags |= 1 << 2;
|
|
if (familyClass === 10) {
|
|
flags |= 1 << 3;
|
|
}
|
|
if (this.font.head.macStyle.italic) {
|
|
flags |= 1 << 6;
|
|
}
|
|
tag = ((function() {
|
|
var j, results;
|
|
results = [];
|
|
for (i = j = 0; j < 6; i = ++j) {
|
|
results.push(String.fromCharCode(Math.random() * 26 + 65));
|
|
}
|
|
return results;
|
|
})()).join('');
|
|
name = tag + '+' + this.font.postscriptName;
|
|
bbox = this.font.bbox;
|
|
descriptor = this.document.ref({
|
|
Type: 'FontDescriptor',
|
|
FontName: name,
|
|
Flags: flags,
|
|
FontBBox: [bbox.minX * this.scale, bbox.minY * this.scale, bbox.maxX * this.scale, bbox.maxY * this.scale],
|
|
ItalicAngle: this.font.italicAngle,
|
|
Ascent: this.ascender,
|
|
Descent: this.descender,
|
|
CapHeight: (this.font.capHeight || this.font.ascent) * this.scale,
|
|
XHeight: (this.font.xHeight || 0) * this.scale,
|
|
StemV: 0
|
|
});
|
|
if (isCFF) {
|
|
descriptor.data.FontFile3 = fontFile;
|
|
} else {
|
|
descriptor.data.FontFile2 = fontFile;
|
|
}
|
|
descriptor.end();
|
|
descendantFont = this.document.ref({
|
|
Type: 'Font',
|
|
Subtype: isCFF ? 'CIDFontType0' : 'CIDFontType2',
|
|
BaseFont: name,
|
|
CIDSystemInfo: {
|
|
Registry: new String('Adobe'),
|
|
Ordering: new String('Identity'),
|
|
Supplement: 0
|
|
},
|
|
FontDescriptor: descriptor,
|
|
W: [0, this.widths]
|
|
});
|
|
descendantFont.end();
|
|
this.dictionary.data = {
|
|
Type: 'Font',
|
|
Subtype: 'Type0',
|
|
BaseFont: name,
|
|
Encoding: 'Identity-H',
|
|
DescendantFonts: [descendantFont],
|
|
ToUnicode: this.toUnicodeCmap()
|
|
};
|
|
return this.dictionary.end();
|
|
};
|
|
|
|
toHex = function() {
|
|
var code, codePoints, codes;
|
|
codePoints = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
codes = (function() {
|
|
var j, len, results;
|
|
results = [];
|
|
for (j = 0, len = codePoints.length; j < len; j++) {
|
|
code = codePoints[j];
|
|
results.push(('0000' + code.toString(16)).slice(-4));
|
|
}
|
|
return results;
|
|
})();
|
|
return codes.join('');
|
|
};
|
|
|
|
EmbeddedFont.prototype.toUnicodeCmap = function() {
|
|
var cmap, codePoints, encoded, entries, j, k, len, len1, ref, value;
|
|
cmap = this.document.ref();
|
|
entries = [];
|
|
ref = this.unicode;
|
|
for (j = 0, len = ref.length; j < len; j++) {
|
|
codePoints = ref[j];
|
|
encoded = [];
|
|
for (k = 0, len1 = codePoints.length; k < len1; k++) {
|
|
value = codePoints[k];
|
|
if (value > 0xffff) {
|
|
value -= 0x10000;
|
|
encoded.push(toHex(value >>> 10 & 0x3ff | 0xd800));
|
|
value = 0xdc00 | value & 0x3ff;
|
|
}
|
|
encoded.push(toHex(value));
|
|
}
|
|
entries.push("<" + (encoded.join(' ')) + ">");
|
|
}
|
|
cmap.end("/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\n/CIDSystemInfo <<\n /Registry (Adobe)\n /Ordering (UCS)\n /Supplement 0\n>> def\n/CMapName /Adobe-Identity-UCS def\n/CMapType 2 def\n1 begincodespacerange\n<0000><ffff>\nendcodespacerange\n1 beginbfrange\n<0000> <" + (toHex(entries.length - 1)) + "> [" + (entries.join(' ')) + "]\nendbfrange\nendcmap\nCMapName currentdict /CMap defineresource pop\nend\nend");
|
|
return cmap;
|
|
};
|
|
|
|
return EmbeddedFont;
|
|
|
|
})(PDFFont);
|
|
|
|
module.exports = EmbeddedFont;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 286 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var LineWrapper;
|
|
|
|
LineWrapper = __webpack_require__(287);
|
|
|
|
module.exports = {
|
|
initText: function() {
|
|
this.x = 0;
|
|
this.y = 0;
|
|
return this._lineGap = 0;
|
|
},
|
|
lineGap: function(_lineGap) {
|
|
this._lineGap = _lineGap;
|
|
return this;
|
|
},
|
|
moveDown: function(lines) {
|
|
if (lines == null) {
|
|
lines = 1;
|
|
}
|
|
this.y += this.currentLineHeight(true) * lines + this._lineGap;
|
|
return this;
|
|
},
|
|
moveUp: function(lines) {
|
|
if (lines == null) {
|
|
lines = 1;
|
|
}
|
|
this.y -= this.currentLineHeight(true) * lines + this._lineGap;
|
|
return this;
|
|
},
|
|
_text: function(text, x, y, options, lineCallback) {
|
|
var j, len, line, ref, wrapper;
|
|
options = this._initOptions(x, y, options);
|
|
text = '' + text;
|
|
if (options.wordSpacing) {
|
|
text = text.replace(/\s{2,}/g, ' ');
|
|
}
|
|
if (options.width) {
|
|
wrapper = this._wrapper;
|
|
if (!wrapper) {
|
|
wrapper = new LineWrapper(this, options);
|
|
wrapper.on('line', lineCallback);
|
|
}
|
|
this._wrapper = options.continued ? wrapper : null;
|
|
this._textOptions = options.continued ? options : null;
|
|
wrapper.wrap(text, options);
|
|
} else {
|
|
ref = text.split('\n');
|
|
for (j = 0, len = ref.length; j < len; j++) {
|
|
line = ref[j];
|
|
lineCallback(line, options);
|
|
}
|
|
}
|
|
return this;
|
|
},
|
|
text: function(text, x, y, options) {
|
|
return this._text(text, x, y, options, this._line.bind(this));
|
|
},
|
|
widthOfString: function(string, options) {
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
return this._font.widthOfString(string, this._fontSize, options.features) + (options.characterSpacing || 0) * (string.length - 1);
|
|
},
|
|
heightOfString: function(text, options) {
|
|
var height, lineGap, x, y;
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
x = this.x, y = this.y;
|
|
options = this._initOptions(options);
|
|
options.height = Infinity;
|
|
lineGap = options.lineGap || this._lineGap || 0;
|
|
this._text(text, this.x, this.y, options, (function(_this) {
|
|
return function(line, options) {
|
|
return _this.y += _this.currentLineHeight(true) + lineGap;
|
|
};
|
|
})(this));
|
|
height = this.y - y;
|
|
this.x = x;
|
|
this.y = y;
|
|
return height;
|
|
},
|
|
list: function(list, x, y, options, wrapper) {
|
|
var flatten, i, indent, itemIndent, items, level, levels, r;
|
|
options = this._initOptions(x, y, options);
|
|
r = Math.round((this._font.ascender / 1000 * this._fontSize) / 3);
|
|
indent = options.textIndent || r * 5;
|
|
itemIndent = options.bulletIndent || r * 8;
|
|
level = 1;
|
|
items = [];
|
|
levels = [];
|
|
flatten = function(list) {
|
|
var i, item, j, len, results;
|
|
results = [];
|
|
for (i = j = 0, len = list.length; j < len; i = ++j) {
|
|
item = list[i];
|
|
if (Array.isArray(item)) {
|
|
level++;
|
|
flatten(item);
|
|
results.push(level--);
|
|
} else {
|
|
items.push(item);
|
|
results.push(levels.push(level));
|
|
}
|
|
}
|
|
return results;
|
|
};
|
|
flatten(list);
|
|
wrapper = new LineWrapper(this, options);
|
|
wrapper.on('line', this._line.bind(this));
|
|
level = 1;
|
|
i = 0;
|
|
wrapper.on('firstLine', (function(_this) {
|
|
return function() {
|
|
var diff, l;
|
|
if ((l = levels[i++]) !== level) {
|
|
diff = itemIndent * (l - level);
|
|
_this.x += diff;
|
|
wrapper.lineWidth -= diff;
|
|
level = l;
|
|
}
|
|
_this.circle(_this.x - indent + r, _this.y + r + (r / 2), r);
|
|
return _this.fill();
|
|
};
|
|
})(this));
|
|
wrapper.on('sectionStart', (function(_this) {
|
|
return function() {
|
|
var pos;
|
|
pos = indent + itemIndent * (level - 1);
|
|
_this.x += pos;
|
|
return wrapper.lineWidth -= pos;
|
|
};
|
|
})(this));
|
|
wrapper.on('sectionEnd', (function(_this) {
|
|
return function() {
|
|
var pos;
|
|
pos = indent + itemIndent * (level - 1);
|
|
_this.x -= pos;
|
|
return wrapper.lineWidth += pos;
|
|
};
|
|
})(this));
|
|
wrapper.wrap(items.join('\n'), options);
|
|
return this;
|
|
},
|
|
_initOptions: function(x, y, options) {
|
|
var key, margins, ref, val;
|
|
if (x == null) {
|
|
x = {};
|
|
}
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
if (typeof x === 'object') {
|
|
options = x;
|
|
x = null;
|
|
}
|
|
options = (function() {
|
|
var k, opts, v;
|
|
opts = {};
|
|
for (k in options) {
|
|
v = options[k];
|
|
opts[k] = v;
|
|
}
|
|
return opts;
|
|
})();
|
|
if (this._textOptions) {
|
|
ref = this._textOptions;
|
|
for (key in ref) {
|
|
val = ref[key];
|
|
if (key !== 'continued') {
|
|
if (options[key] == null) {
|
|
options[key] = val;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (x != null) {
|
|
this.x = x;
|
|
}
|
|
if (y != null) {
|
|
this.y = y;
|
|
}
|
|
if (options.lineBreak !== false) {
|
|
margins = this.page.margins;
|
|
if (options.width == null) {
|
|
options.width = this.page.width - this.x - margins.right;
|
|
}
|
|
}
|
|
options.columns || (options.columns = 0);
|
|
if (options.columnGap == null) {
|
|
options.columnGap = 18;
|
|
}
|
|
return options;
|
|
},
|
|
_line: function(text, options, wrapper) {
|
|
var lineGap;
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
this._fragment(text, this.x, this.y, options);
|
|
lineGap = options.lineGap || this._lineGap || 0;
|
|
if (!wrapper) {
|
|
return this.x += this.widthOfString(text);
|
|
} else {
|
|
return this.y += this.currentLineHeight(true) + lineGap;
|
|
}
|
|
},
|
|
_fragment: function(text, x, y, options) {
|
|
var addSegment, align, base, characterSpacing, commands, d, encoded, encodedWord, flush, hadOffset, i, j, last, len, len1, lineWidth, lineY, m, mode, name, pos, positions, positionsWord, ref, ref1, renderedWidth, scale, spaceWidth, textWidth, word, wordSpacing, words;
|
|
text = ('' + text).replace(/\n/g, '');
|
|
if (text.length === 0) {
|
|
return;
|
|
}
|
|
align = options.align || 'left';
|
|
wordSpacing = options.wordSpacing || 0;
|
|
characterSpacing = options.characterSpacing || 0;
|
|
if (options.width) {
|
|
switch (align) {
|
|
case 'right':
|
|
textWidth = this.widthOfString(text.replace(/\s+$/, ''), options);
|
|
x += options.lineWidth - textWidth;
|
|
break;
|
|
case 'center':
|
|
x += options.lineWidth / 2 - options.textWidth / 2;
|
|
break;
|
|
case 'justify':
|
|
words = text.trim().split(/\s+/);
|
|
textWidth = this.widthOfString(text.replace(/\s+/g, ''), options);
|
|
spaceWidth = this.widthOfString(' ') + characterSpacing;
|
|
wordSpacing = Math.max(0, (options.lineWidth - textWidth) / Math.max(1, words.length - 1) - spaceWidth);
|
|
}
|
|
}
|
|
renderedWidth = options.textWidth + (wordSpacing * (options.wordCount - 1)) + (characterSpacing * (text.length - 1));
|
|
if (options.link) {
|
|
this.link(x, y, renderedWidth, this.currentLineHeight(), options.link);
|
|
}
|
|
if (options.underline || options.strike) {
|
|
this.save();
|
|
if (!options.stroke) {
|
|
this.strokeColor.apply(this, this._fillColor);
|
|
}
|
|
lineWidth = this._fontSize < 10 ? 0.5 : Math.floor(this._fontSize / 10);
|
|
this.lineWidth(lineWidth);
|
|
d = options.underline ? 1 : 2;
|
|
lineY = y + this.currentLineHeight() / d;
|
|
if (options.underline) {
|
|
lineY -= lineWidth;
|
|
}
|
|
this.moveTo(x, lineY);
|
|
this.lineTo(x + renderedWidth, lineY);
|
|
this.stroke();
|
|
this.restore();
|
|
}
|
|
this.save();
|
|
this.transform(1, 0, 0, -1, 0, this.page.height);
|
|
y = this.page.height - y - (this._font.ascender / 1000 * this._fontSize);
|
|
if ((base = this.page.fonts)[name = this._font.id] == null) {
|
|
base[name] = this._font.ref();
|
|
}
|
|
this.addContent("BT");
|
|
this.addContent("1 0 0 1 " + x + " " + y + " Tm");
|
|
this.addContent("/" + this._font.id + " " + this._fontSize + " Tf");
|
|
mode = options.fill && options.stroke ? 2 : options.stroke ? 1 : 0;
|
|
if (mode) {
|
|
this.addContent(mode + " Tr");
|
|
}
|
|
if (characterSpacing) {
|
|
this.addContent(characterSpacing + " Tc");
|
|
}
|
|
if (wordSpacing) {
|
|
words = text.trim().split(/\s+/);
|
|
wordSpacing += this.widthOfString(' ') + characterSpacing;
|
|
wordSpacing *= 1000 / this._fontSize;
|
|
encoded = [];
|
|
positions = [];
|
|
for (j = 0, len = words.length; j < len; j++) {
|
|
word = words[j];
|
|
ref = this._font.encode(word, options.features), encodedWord = ref[0], positionsWord = ref[1];
|
|
encoded.push.apply(encoded, encodedWord);
|
|
positions.push.apply(positions, positionsWord);
|
|
positions[positions.length - 1].xAdvance += wordSpacing;
|
|
}
|
|
} else {
|
|
ref1 = this._font.encode(text, options.features), encoded = ref1[0], positions = ref1[1];
|
|
}
|
|
scale = this._fontSize / 1000;
|
|
commands = [];
|
|
last = 0;
|
|
hadOffset = false;
|
|
addSegment = (function(_this) {
|
|
return function(cur) {
|
|
var advance, hex;
|
|
if (last < cur) {
|
|
hex = encoded.slice(last, cur).join('');
|
|
advance = positions[cur - 1].xAdvance - positions[cur - 1].advanceWidth;
|
|
commands.push("<" + hex + "> " + (-advance));
|
|
}
|
|
return last = cur;
|
|
};
|
|
})(this);
|
|
flush = (function(_this) {
|
|
return function(i) {
|
|
addSegment(i);
|
|
if (commands.length > 0) {
|
|
_this.addContent("[" + (commands.join(' ')) + "] TJ");
|
|
return commands.length = 0;
|
|
}
|
|
};
|
|
})(this);
|
|
for (i = m = 0, len1 = positions.length; m < len1; i = ++m) {
|
|
pos = positions[i];
|
|
if (pos.xOffset || pos.yOffset) {
|
|
flush(i);
|
|
this.addContent("1 0 0 1 " + (x + pos.xOffset * scale) + " " + (y + pos.yOffset * scale) + " Tm");
|
|
flush(i + 1);
|
|
hadOffset = true;
|
|
} else {
|
|
if (hadOffset) {
|
|
this.addContent("1 0 0 1 " + x + " " + y + " Tm");
|
|
hadOffset = false;
|
|
}
|
|
if (pos.xAdvance - pos.advanceWidth !== 0) {
|
|
addSegment(i + 1);
|
|
}
|
|
}
|
|
x += pos.xAdvance * scale;
|
|
}
|
|
flush(i);
|
|
this.addContent("ET");
|
|
return this.restore();
|
|
}
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 287 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var EventEmitter, LineBreaker, LineWrapper,
|
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
hasProp = {}.hasOwnProperty;
|
|
|
|
EventEmitter = __webpack_require__(31).EventEmitter;
|
|
|
|
LineBreaker = __webpack_require__(14);
|
|
|
|
LineWrapper = (function(superClass) {
|
|
extend(LineWrapper, superClass);
|
|
|
|
function LineWrapper(document, options) {
|
|
var ref;
|
|
this.document = document;
|
|
this.indent = options.indent || 0;
|
|
this.characterSpacing = options.characterSpacing || 0;
|
|
this.wordSpacing = options.wordSpacing === 0;
|
|
this.columns = options.columns || 1;
|
|
this.columnGap = (ref = options.columnGap) != null ? ref : 18;
|
|
this.lineWidth = (options.width - (this.columnGap * (this.columns - 1))) / this.columns;
|
|
this.spaceLeft = this.lineWidth;
|
|
this.startX = this.document.x;
|
|
this.startY = this.document.y;
|
|
this.column = 1;
|
|
this.ellipsis = options.ellipsis;
|
|
this.continuedX = 0;
|
|
this.features = options.features;
|
|
if (options.height != null) {
|
|
this.height = options.height;
|
|
this.maxY = this.startY + options.height;
|
|
} else {
|
|
this.maxY = this.document.page.maxY();
|
|
}
|
|
this.on('firstLine', (function(_this) {
|
|
return function(options) {
|
|
var indent;
|
|
indent = _this.continuedX || _this.indent;
|
|
_this.document.x += indent;
|
|
_this.lineWidth -= indent;
|
|
return _this.once('line', function() {
|
|
_this.document.x -= indent;
|
|
_this.lineWidth += indent;
|
|
if (options.continued && !_this.continuedX) {
|
|
_this.continuedX = _this.indent;
|
|
}
|
|
if (!options.continued) {
|
|
return _this.continuedX = 0;
|
|
}
|
|
});
|
|
};
|
|
})(this));
|
|
this.on('lastLine', (function(_this) {
|
|
return function(options) {
|
|
var align;
|
|
align = options.align;
|
|
if (align === 'justify') {
|
|
options.align = 'left';
|
|
}
|
|
_this.lastLine = true;
|
|
return _this.once('line', function() {
|
|
_this.document.y += options.paragraphGap || 0;
|
|
options.align = align;
|
|
return _this.lastLine = false;
|
|
});
|
|
};
|
|
})(this));
|
|
}
|
|
|
|
LineWrapper.prototype.wordWidth = function(word) {
|
|
return this.document.widthOfString(word, this) + this.characterSpacing + this.wordSpacing;
|
|
};
|
|
|
|
LineWrapper.prototype.eachWord = function(text, fn) {
|
|
var bk, breaker, fbk, l, last, lbk, shouldContinue, w, word, wordWidths;
|
|
breaker = new LineBreaker(text);
|
|
last = null;
|
|
wordWidths = Object.create(null);
|
|
while (bk = breaker.nextBreak()) {
|
|
word = text.slice((last != null ? last.position : void 0) || 0, bk.position);
|
|
w = wordWidths[word] != null ? wordWidths[word] : wordWidths[word] = this.wordWidth(word);
|
|
if (w > this.lineWidth + this.continuedX) {
|
|
lbk = last;
|
|
fbk = {};
|
|
while (word.length) {
|
|
l = word.length;
|
|
while (w > this.spaceLeft) {
|
|
w = this.wordWidth(word.slice(0, --l));
|
|
}
|
|
fbk.required = l < word.length;
|
|
shouldContinue = fn(word.slice(0, l), w, fbk, lbk);
|
|
lbk = {
|
|
required: false
|
|
};
|
|
word = word.slice(l);
|
|
w = this.wordWidth(word);
|
|
if (shouldContinue === false) {
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
shouldContinue = fn(word, w, bk, last);
|
|
}
|
|
if (shouldContinue === false) {
|
|
break;
|
|
}
|
|
last = bk;
|
|
}
|
|
};
|
|
|
|
LineWrapper.prototype.wrap = function(text, options) {
|
|
var buffer, emitLine, lc, nextY, textWidth, wc, y;
|
|
if (options.indent != null) {
|
|
this.indent = options.indent;
|
|
}
|
|
if (options.characterSpacing != null) {
|
|
this.characterSpacing = options.characterSpacing;
|
|
}
|
|
if (options.wordSpacing != null) {
|
|
this.wordSpacing = options.wordSpacing;
|
|
}
|
|
if (options.ellipsis != null) {
|
|
this.ellipsis = options.ellipsis;
|
|
}
|
|
nextY = this.document.y + this.document.currentLineHeight(true);
|
|
if (this.document.y > this.maxY || nextY > this.maxY) {
|
|
this.nextSection();
|
|
}
|
|
buffer = '';
|
|
textWidth = 0;
|
|
wc = 0;
|
|
lc = 0;
|
|
y = this.document.y;
|
|
emitLine = (function(_this) {
|
|
return function() {
|
|
options.textWidth = textWidth + _this.wordSpacing * (wc - 1);
|
|
options.wordCount = wc;
|
|
options.lineWidth = _this.lineWidth;
|
|
y = _this.document.y;
|
|
_this.emit('line', buffer, options, _this);
|
|
return lc++;
|
|
};
|
|
})(this);
|
|
this.emit('sectionStart', options, this);
|
|
this.eachWord(text, (function(_this) {
|
|
return function(word, w, bk, last) {
|
|
var lh, shouldContinue;
|
|
if ((last == null) || last.required) {
|
|
_this.emit('firstLine', options, _this);
|
|
_this.spaceLeft = _this.lineWidth;
|
|
}
|
|
if (w <= _this.spaceLeft) {
|
|
buffer += word;
|
|
textWidth += w;
|
|
wc++;
|
|
}
|
|
if (bk.required || w > _this.spaceLeft) {
|
|
if (bk.required) {
|
|
_this.emit('lastLine', options, _this);
|
|
}
|
|
lh = _this.document.currentLineHeight(true);
|
|
if ((_this.height != null) && _this.ellipsis && _this.document.y + lh * 2 > _this.maxY && _this.column >= _this.columns) {
|
|
if (_this.ellipsis === true) {
|
|
_this.ellipsis = '…';
|
|
}
|
|
buffer = buffer.replace(/\s+$/, '');
|
|
textWidth = _this.wordWidth(buffer + _this.ellipsis);
|
|
while (textWidth > _this.lineWidth) {
|
|
buffer = buffer.slice(0, -1).replace(/\s+$/, '');
|
|
textWidth = _this.wordWidth(buffer + _this.ellipsis);
|
|
}
|
|
buffer = buffer + _this.ellipsis;
|
|
}
|
|
emitLine();
|
|
if (_this.document.y + lh > _this.maxY) {
|
|
shouldContinue = _this.nextSection();
|
|
if (!shouldContinue) {
|
|
wc = 0;
|
|
buffer = '';
|
|
return false;
|
|
}
|
|
}
|
|
if (bk.required) {
|
|
if (w > _this.spaceLeft) {
|
|
buffer = word;
|
|
textWidth = w;
|
|
wc = 1;
|
|
emitLine();
|
|
}
|
|
_this.spaceLeft = _this.lineWidth;
|
|
buffer = '';
|
|
textWidth = 0;
|
|
return wc = 0;
|
|
} else {
|
|
_this.spaceLeft = _this.lineWidth - w;
|
|
buffer = word;
|
|
textWidth = w;
|
|
return wc = 1;
|
|
}
|
|
} else {
|
|
return _this.spaceLeft -= w;
|
|
}
|
|
};
|
|
})(this));
|
|
if (wc > 0) {
|
|
this.emit('lastLine', options, this);
|
|
emitLine();
|
|
}
|
|
this.emit('sectionEnd', options, this);
|
|
if (options.continued === true) {
|
|
if (lc > 1) {
|
|
this.continuedX = 0;
|
|
}
|
|
this.continuedX += options.textWidth;
|
|
return this.document.y = y;
|
|
} else {
|
|
return this.document.x = this.startX;
|
|
}
|
|
};
|
|
|
|
LineWrapper.prototype.nextSection = function(options) {
|
|
var ref;
|
|
this.emit('sectionEnd', options, this);
|
|
if (++this.column > this.columns) {
|
|
if (this.height != null) {
|
|
return false;
|
|
}
|
|
this.document.addPage();
|
|
this.column = 1;
|
|
this.startY = this.document.page.margins.top;
|
|
this.maxY = this.document.page.maxY();
|
|
this.document.x = this.startX;
|
|
if (this.document._fillColor) {
|
|
(ref = this.document).fillColor.apply(ref, this.document._fillColor);
|
|
}
|
|
this.emit('pageBreak', options, this);
|
|
} else {
|
|
this.document.x += this.lineWidth + this.columnGap;
|
|
this.document.y = this.startY;
|
|
this.emit('columnBreak', options, this);
|
|
}
|
|
this.emit('sectionStart', options, this);
|
|
return true;
|
|
};
|
|
|
|
return LineWrapper;
|
|
|
|
})(EventEmitter);
|
|
|
|
module.exports = LineWrapper;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 288 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var PDFImage;
|
|
|
|
PDFImage = __webpack_require__(289);
|
|
|
|
module.exports = {
|
|
initImages: function() {
|
|
this._imageRegistry = {};
|
|
return this._imageCount = 0;
|
|
},
|
|
image: function(src, x, y, options) {
|
|
var base, bh, bp, bw, h, hp, image, ip, name, ref, ref1, ref2, w, wp;
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
if (typeof x === 'object') {
|
|
options = x;
|
|
x = null;
|
|
}
|
|
x = (ref = x != null ? x : options.x) != null ? ref : this.x;
|
|
y = (ref1 = y != null ? y : options.y) != null ? ref1 : this.y;
|
|
if (!Buffer.isBuffer(src)) {
|
|
image = this._imageRegistry[src];
|
|
}
|
|
if (!image) {
|
|
image = PDFImage.open(src, 'I' + (++this._imageCount));
|
|
image.embed(this);
|
|
if (!Buffer.isBuffer(src)) {
|
|
this._imageRegistry[src] = image;
|
|
}
|
|
}
|
|
if ((base = this.page.xobjects)[name = image.label] == null) {
|
|
base[name] = image.obj;
|
|
}
|
|
w = options.width || image.width;
|
|
h = options.height || image.height;
|
|
if (options.width && !options.height) {
|
|
wp = w / image.width;
|
|
w = image.width * wp;
|
|
h = image.height * wp;
|
|
} else if (options.height && !options.width) {
|
|
hp = h / image.height;
|
|
w = image.width * hp;
|
|
h = image.height * hp;
|
|
} else if (options.scale) {
|
|
w = image.width * options.scale;
|
|
h = image.height * options.scale;
|
|
} else if (options.fit) {
|
|
ref2 = options.fit, bw = ref2[0], bh = ref2[1];
|
|
bp = bw / bh;
|
|
ip = image.width / image.height;
|
|
if (ip > bp) {
|
|
w = bw;
|
|
h = bw / ip;
|
|
} else {
|
|
h = bh;
|
|
w = bh * ip;
|
|
}
|
|
if (options.align === 'center') {
|
|
x = x + bw / 2 - w / 2;
|
|
} else if (options.align === 'right') {
|
|
x = x + bw - w;
|
|
}
|
|
if (options.valign === 'center') {
|
|
y = y + bh / 2 - h / 2;
|
|
} else if (options.valign === 'bottom') {
|
|
y = y + bh - h;
|
|
}
|
|
}
|
|
if (this.y === y) {
|
|
this.y += h;
|
|
}
|
|
this.save();
|
|
this.transform(w, 0, 0, -h, x, y + h);
|
|
this.addContent("/" + image.label + " Do");
|
|
this.restore();
|
|
return this;
|
|
}
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 289 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Generated by CoffeeScript 1.10.0
|
|
|
|
/*
|
|
PDFImage - embeds images in PDF documents
|
|
By Devon Govett
|
|
*/
|
|
|
|
(function() {
|
|
var Data, JPEG, PDFImage, PNG, fs;
|
|
|
|
fs = __webpack_require__(53);
|
|
|
|
Data = __webpack_require__(290);
|
|
|
|
JPEG = __webpack_require__(291);
|
|
|
|
PNG = __webpack_require__(292);
|
|
|
|
PDFImage = (function() {
|
|
function PDFImage() {}
|
|
|
|
PDFImage.open = function(src, label) {
|
|
var data, match;
|
|
if (Buffer.isBuffer(src)) {
|
|
data = src;
|
|
} else if (src instanceof ArrayBuffer) {
|
|
data = new Buffer(new Uint8Array(src));
|
|
} else {
|
|
if (match = /^data:.+;base64,(.*)$/.exec(src)) {
|
|
data = new Buffer(match[1], 'base64');
|
|
} else {
|
|
data = fs.readFileSync(src);
|
|
if (!data) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
if (data[0] === 0xff && data[1] === 0xd8) {
|
|
return new JPEG(data, label);
|
|
} else if (data[0] === 0x89 && data.toString('ascii', 1, 4) === 'PNG') {
|
|
return new PNG(data, label);
|
|
} else {
|
|
throw new Error('Unknown image format.');
|
|
}
|
|
};
|
|
|
|
return PDFImage;
|
|
|
|
})();
|
|
|
|
module.exports = PDFImage;
|
|
|
|
}).call(this);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 290 */
|
|
/***/ function(module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var Data;
|
|
|
|
Data = (function() {
|
|
function Data(data) {
|
|
this.data = data != null ? data : [];
|
|
this.pos = 0;
|
|
this.length = this.data.length;
|
|
}
|
|
|
|
Data.prototype.readByte = function() {
|
|
return this.data[this.pos++];
|
|
};
|
|
|
|
Data.prototype.writeByte = function(byte) {
|
|
return this.data[this.pos++] = byte;
|
|
};
|
|
|
|
Data.prototype.byteAt = function(index) {
|
|
return this.data[index];
|
|
};
|
|
|
|
Data.prototype.readBool = function() {
|
|
return !!this.readByte();
|
|
};
|
|
|
|
Data.prototype.writeBool = function(val) {
|
|
return this.writeByte(val ? 1 : 0);
|
|
};
|
|
|
|
Data.prototype.readUInt32 = function() {
|
|
var b1, b2, b3, b4;
|
|
b1 = this.readByte() * 0x1000000;
|
|
b2 = this.readByte() << 16;
|
|
b3 = this.readByte() << 8;
|
|
b4 = this.readByte();
|
|
return b1 + b2 + b3 + b4;
|
|
};
|
|
|
|
Data.prototype.writeUInt32 = function(val) {
|
|
this.writeByte((val >>> 24) & 0xff);
|
|
this.writeByte((val >> 16) & 0xff);
|
|
this.writeByte((val >> 8) & 0xff);
|
|
return this.writeByte(val & 0xff);
|
|
};
|
|
|
|
Data.prototype.readInt32 = function() {
|
|
var int;
|
|
int = this.readUInt32();
|
|
if (int >= 0x80000000) {
|
|
return int - 0x100000000;
|
|
} else {
|
|
return int;
|
|
}
|
|
};
|
|
|
|
Data.prototype.writeInt32 = function(val) {
|
|
if (val < 0) {
|
|
val += 0x100000000;
|
|
}
|
|
return this.writeUInt32(val);
|
|
};
|
|
|
|
Data.prototype.readUInt16 = function() {
|
|
var b1, b2;
|
|
b1 = this.readByte() << 8;
|
|
b2 = this.readByte();
|
|
return b1 | b2;
|
|
};
|
|
|
|
Data.prototype.writeUInt16 = function(val) {
|
|
this.writeByte((val >> 8) & 0xff);
|
|
return this.writeByte(val & 0xff);
|
|
};
|
|
|
|
Data.prototype.readInt16 = function() {
|
|
var int;
|
|
int = this.readUInt16();
|
|
if (int >= 0x8000) {
|
|
return int - 0x10000;
|
|
} else {
|
|
return int;
|
|
}
|
|
};
|
|
|
|
Data.prototype.writeInt16 = function(val) {
|
|
if (val < 0) {
|
|
val += 0x10000;
|
|
}
|
|
return this.writeUInt16(val);
|
|
};
|
|
|
|
Data.prototype.readString = function(length) {
|
|
var i, j, ref, ret;
|
|
ret = [];
|
|
for (i = j = 0, ref = length; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
|
|
ret[i] = String.fromCharCode(this.readByte());
|
|
}
|
|
return ret.join('');
|
|
};
|
|
|
|
Data.prototype.writeString = function(val) {
|
|
var i, j, ref, results;
|
|
results = [];
|
|
for (i = j = 0, ref = val.length; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
|
|
results.push(this.writeByte(val.charCodeAt(i)));
|
|
}
|
|
return results;
|
|
};
|
|
|
|
Data.prototype.stringAt = function(pos, length) {
|
|
this.pos = pos;
|
|
return this.readString(length);
|
|
};
|
|
|
|
Data.prototype.readShort = function() {
|
|
return this.readInt16();
|
|
};
|
|
|
|
Data.prototype.writeShort = function(val) {
|
|
return this.writeInt16(val);
|
|
};
|
|
|
|
Data.prototype.readLongLong = function() {
|
|
var b1, b2, b3, b4, b5, b6, b7, b8;
|
|
b1 = this.readByte();
|
|
b2 = this.readByte();
|
|
b3 = this.readByte();
|
|
b4 = this.readByte();
|
|
b5 = this.readByte();
|
|
b6 = this.readByte();
|
|
b7 = this.readByte();
|
|
b8 = this.readByte();
|
|
if (b1 & 0x80) {
|
|
return ((b1 ^ 0xff) * 0x100000000000000 + (b2 ^ 0xff) * 0x1000000000000 + (b3 ^ 0xff) * 0x10000000000 + (b4 ^ 0xff) * 0x100000000 + (b5 ^ 0xff) * 0x1000000 + (b6 ^ 0xff) * 0x10000 + (b7 ^ 0xff) * 0x100 + (b8 ^ 0xff) + 1) * -1;
|
|
}
|
|
return b1 * 0x100000000000000 + b2 * 0x1000000000000 + b3 * 0x10000000000 + b4 * 0x100000000 + b5 * 0x1000000 + b6 * 0x10000 + b7 * 0x100 + b8;
|
|
};
|
|
|
|
Data.prototype.writeLongLong = function(val) {
|
|
var high, low;
|
|
high = Math.floor(val / 0x100000000);
|
|
low = val & 0xffffffff;
|
|
this.writeByte((high >> 24) & 0xff);
|
|
this.writeByte((high >> 16) & 0xff);
|
|
this.writeByte((high >> 8) & 0xff);
|
|
this.writeByte(high & 0xff);
|
|
this.writeByte((low >> 24) & 0xff);
|
|
this.writeByte((low >> 16) & 0xff);
|
|
this.writeByte((low >> 8) & 0xff);
|
|
return this.writeByte(low & 0xff);
|
|
};
|
|
|
|
Data.prototype.readInt = function() {
|
|
return this.readInt32();
|
|
};
|
|
|
|
Data.prototype.writeInt = function(val) {
|
|
return this.writeInt32(val);
|
|
};
|
|
|
|
Data.prototype.slice = function(start, end) {
|
|
return this.data.slice(start, end);
|
|
};
|
|
|
|
Data.prototype.read = function(bytes) {
|
|
var buf, i, j, ref;
|
|
buf = [];
|
|
for (i = j = 0, ref = bytes; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
|
|
buf.push(this.readByte());
|
|
}
|
|
return buf;
|
|
};
|
|
|
|
Data.prototype.write = function(bytes) {
|
|
var byte, j, len, results;
|
|
results = [];
|
|
for (j = 0, len = bytes.length; j < len; j++) {
|
|
byte = bytes[j];
|
|
results.push(this.writeByte(byte));
|
|
}
|
|
return results;
|
|
};
|
|
|
|
return Data;
|
|
|
|
})();
|
|
|
|
module.exports = Data;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 291 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var JPEG, fs,
|
|
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
|
|
|
fs = __webpack_require__(53);
|
|
|
|
JPEG = (function() {
|
|
var MARKERS;
|
|
|
|
MARKERS = [0xFFC0, 0xFFC1, 0xFFC2, 0xFFC3, 0xFFC5, 0xFFC6, 0xFFC7, 0xFFC8, 0xFFC9, 0xFFCA, 0xFFCB, 0xFFCC, 0xFFCD, 0xFFCE, 0xFFCF];
|
|
|
|
function JPEG(data, label) {
|
|
var channels, marker, pos;
|
|
this.data = data;
|
|
this.label = label;
|
|
if (this.data.readUInt16BE(0) !== 0xFFD8) {
|
|
throw "SOI not found in JPEG";
|
|
}
|
|
pos = 2;
|
|
while (pos < this.data.length) {
|
|
marker = this.data.readUInt16BE(pos);
|
|
pos += 2;
|
|
if (indexOf.call(MARKERS, marker) >= 0) {
|
|
break;
|
|
}
|
|
pos += this.data.readUInt16BE(pos);
|
|
}
|
|
if (indexOf.call(MARKERS, marker) < 0) {
|
|
throw "Invalid JPEG.";
|
|
}
|
|
pos += 2;
|
|
this.bits = this.data[pos++];
|
|
this.height = this.data.readUInt16BE(pos);
|
|
pos += 2;
|
|
this.width = this.data.readUInt16BE(pos);
|
|
pos += 2;
|
|
channels = this.data[pos++];
|
|
this.colorSpace = (function() {
|
|
switch (channels) {
|
|
case 1:
|
|
return 'DeviceGray';
|
|
case 3:
|
|
return 'DeviceRGB';
|
|
case 4:
|
|
return 'DeviceCMYK';
|
|
}
|
|
})();
|
|
this.obj = null;
|
|
}
|
|
|
|
JPEG.prototype.embed = function(document) {
|
|
if (this.obj) {
|
|
return;
|
|
}
|
|
this.obj = document.ref({
|
|
Type: 'XObject',
|
|
Subtype: 'Image',
|
|
BitsPerComponent: this.bits,
|
|
Width: this.width,
|
|
Height: this.height,
|
|
ColorSpace: this.colorSpace,
|
|
Filter: 'DCTDecode'
|
|
});
|
|
if (this.colorSpace === 'DeviceCMYK') {
|
|
this.obj.data['Decode'] = [1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0];
|
|
}
|
|
this.obj.end(this.data);
|
|
return this.data = null;
|
|
};
|
|
|
|
return JPEG;
|
|
|
|
})();
|
|
|
|
module.exports = JPEG;
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 292 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
var PNG, PNGImage, zlib;
|
|
|
|
zlib = __webpack_require__(56);
|
|
|
|
PNG = __webpack_require__(293);
|
|
|
|
PNGImage = (function() {
|
|
function PNGImage(data, label) {
|
|
this.label = label;
|
|
this.image = new PNG(data);
|
|
this.width = this.image.width;
|
|
this.height = this.image.height;
|
|
this.imgData = this.image.imgData;
|
|
this.obj = null;
|
|
}
|
|
|
|
PNGImage.prototype.embed = function(document) {
|
|
var k, len1, mask, palette, params, rgb, val, x;
|
|
this.document = document;
|
|
if (this.obj) {
|
|
return;
|
|
}
|
|
this.obj = this.document.ref({
|
|
Type: 'XObject',
|
|
Subtype: 'Image',
|
|
BitsPerComponent: this.image.bits,
|
|
Width: this.width,
|
|
Height: this.height,
|
|
Filter: 'FlateDecode'
|
|
});
|
|
if (!this.image.hasAlphaChannel) {
|
|
params = this.document.ref({
|
|
Predictor: 15,
|
|
Colors: this.image.colors,
|
|
BitsPerComponent: this.image.bits,
|
|
Columns: this.width
|
|
});
|
|
this.obj.data['DecodeParms'] = params;
|
|
params.end();
|
|
}
|
|
if (this.image.palette.length === 0) {
|
|
this.obj.data['ColorSpace'] = this.image.colorSpace;
|
|
} else {
|
|
palette = this.document.ref();
|
|
palette.end(new Buffer(this.image.palette));
|
|
this.obj.data['ColorSpace'] = ['Indexed', 'DeviceRGB', (this.image.palette.length / 3) - 1, palette];
|
|
}
|
|
if (this.image.transparency.grayscale) {
|
|
val = this.image.transparency.greyscale;
|
|
return this.obj.data['Mask'] = [val, val];
|
|
} else if (this.image.transparency.rgb) {
|
|
rgb = this.image.transparency.rgb;
|
|
mask = [];
|
|
for (k = 0, len1 = rgb.length; k < len1; k++) {
|
|
x = rgb[k];
|
|
mask.push(x, x);
|
|
}
|
|
return this.obj.data['Mask'] = mask;
|
|
} else if (this.image.transparency.indexed) {
|
|
return this.loadIndexedAlphaChannel();
|
|
} else if (this.image.hasAlphaChannel) {
|
|
return this.splitAlphaChannel();
|
|
} else {
|
|
return this.finalize();
|
|
}
|
|
};
|
|
|
|
PNGImage.prototype.finalize = function() {
|
|
var sMask;
|
|
if (this.alphaChannel) {
|
|
sMask = this.document.ref({
|
|
Type: 'XObject',
|
|
Subtype: 'Image',
|
|
Height: this.height,
|
|
Width: this.width,
|
|
BitsPerComponent: 8,
|
|
Filter: 'FlateDecode',
|
|
ColorSpace: 'DeviceGray',
|
|
Decode: [0, 1]
|
|
});
|
|
sMask.end(this.alphaChannel);
|
|
this.obj.data['SMask'] = sMask;
|
|
}
|
|
this.obj.end(this.imgData);
|
|
this.image = null;
|
|
return this.imgData = null;
|
|
};
|
|
|
|
PNGImage.prototype.splitAlphaChannel = function() {
|
|
return this.image.decodePixels((function(_this) {
|
|
return function(pixels) {
|
|
var a, alphaChannel, colorByteSize, done, i, imgData, len, p, pixelCount;
|
|
colorByteSize = _this.image.colors * _this.image.bits / 8;
|
|
pixelCount = _this.width * _this.height;
|
|
imgData = new Buffer(pixelCount * colorByteSize);
|
|
alphaChannel = new Buffer(pixelCount);
|
|
i = p = a = 0;
|
|
len = pixels.length;
|
|
while (i < len) {
|
|
imgData[p++] = pixels[i++];
|
|
imgData[p++] = pixels[i++];
|
|
imgData[p++] = pixels[i++];
|
|
alphaChannel[a++] = pixels[i++];
|
|
}
|
|
done = 0;
|
|
zlib.deflate(imgData, function(err, imgData1) {
|
|
_this.imgData = imgData1;
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
if (++done === 2) {
|
|
return _this.finalize();
|
|
}
|
|
});
|
|
return zlib.deflate(alphaChannel, function(err, alphaChannel1) {
|
|
_this.alphaChannel = alphaChannel1;
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
if (++done === 2) {
|
|
return _this.finalize();
|
|
}
|
|
});
|
|
};
|
|
})(this));
|
|
};
|
|
|
|
PNGImage.prototype.loadIndexedAlphaChannel = function(fn) {
|
|
var transparency;
|
|
transparency = this.image.transparency.indexed;
|
|
return this.image.decodePixels((function(_this) {
|
|
return function(pixels) {
|
|
var alphaChannel, i, j, k, ref;
|
|
alphaChannel = new Buffer(_this.width * _this.height);
|
|
i = 0;
|
|
for (j = k = 0, ref = pixels.length; k < ref; j = k += 1) {
|
|
alphaChannel[i++] = transparency[pixels[j]];
|
|
}
|
|
return zlib.deflate(alphaChannel, function(err, alphaChannel1) {
|
|
_this.alphaChannel = alphaChannel1;
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
return _this.finalize();
|
|
});
|
|
};
|
|
})(this));
|
|
};
|
|
|
|
return PNGImage;
|
|
|
|
})();
|
|
|
|
module.exports = PNGImage;
|
|
|
|
}).call(this);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 293 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {// Generated by CoffeeScript 1.4.0
|
|
|
|
/*
|
|
# MIT LICENSE
|
|
# Copyright (c) 2011 Devon Govett
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
|
# software and associated documentation files (the "Software"), to deal in the Software
|
|
# without restriction, including without limitation the rights to use, copy, modify, merge,
|
|
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
|
# to whom the Software is furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in all copies or
|
|
# substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
|
|
(function() {
|
|
var PNG, fs, zlib;
|
|
|
|
fs = __webpack_require__(53);
|
|
|
|
zlib = __webpack_require__(56);
|
|
|
|
module.exports = PNG = (function() {
|
|
|
|
PNG.decode = function(path, fn) {
|
|
return fs.readFile(path, function(err, file) {
|
|
var png;
|
|
png = new PNG(file);
|
|
return png.decode(function(pixels) {
|
|
return fn(pixels);
|
|
});
|
|
});
|
|
};
|
|
|
|
PNG.load = function(path) {
|
|
var file;
|
|
file = fs.readFileSync(path);
|
|
return new PNG(file);
|
|
};
|
|
|
|
function PNG(data) {
|
|
var chunkSize, colors, i, index, key, section, short, text, _i, _j, _ref;
|
|
this.data = data;
|
|
this.pos = 8;
|
|
this.palette = [];
|
|
this.imgData = [];
|
|
this.transparency = {};
|
|
this.text = {};
|
|
while (true) {
|
|
chunkSize = this.readUInt32();
|
|
section = ((function() {
|
|
var _i, _results;
|
|
_results = [];
|
|
for (i = _i = 0; _i < 4; i = ++_i) {
|
|
_results.push(String.fromCharCode(this.data[this.pos++]));
|
|
}
|
|
return _results;
|
|
}).call(this)).join('');
|
|
switch (section) {
|
|
case 'IHDR':
|
|
this.width = this.readUInt32();
|
|
this.height = this.readUInt32();
|
|
this.bits = this.data[this.pos++];
|
|
this.colorType = this.data[this.pos++];
|
|
this.compressionMethod = this.data[this.pos++];
|
|
this.filterMethod = this.data[this.pos++];
|
|
this.interlaceMethod = this.data[this.pos++];
|
|
break;
|
|
case 'PLTE':
|
|
this.palette = this.read(chunkSize);
|
|
break;
|
|
case 'IDAT':
|
|
for (i = _i = 0; _i < chunkSize; i = _i += 1) {
|
|
this.imgData.push(this.data[this.pos++]);
|
|
}
|
|
break;
|
|
case 'tRNS':
|
|
this.transparency = {};
|
|
switch (this.colorType) {
|
|
case 3:
|
|
this.transparency.indexed = this.read(chunkSize);
|
|
short = 255 - this.transparency.indexed.length;
|
|
if (short > 0) {
|
|
for (i = _j = 0; 0 <= short ? _j < short : _j > short; i = 0 <= short ? ++_j : --_j) {
|
|
this.transparency.indexed.push(255);
|
|
}
|
|
}
|
|
break;
|
|
case 0:
|
|
this.transparency.grayscale = this.read(chunkSize)[0];
|
|
break;
|
|
case 2:
|
|
this.transparency.rgb = this.read(chunkSize);
|
|
}
|
|
break;
|
|
case 'tEXt':
|
|
text = this.read(chunkSize);
|
|
index = text.indexOf(0);
|
|
key = String.fromCharCode.apply(String, text.slice(0, index));
|
|
this.text[key] = String.fromCharCode.apply(String, text.slice(index + 1));
|
|
break;
|
|
case 'IEND':
|
|
this.colors = (function() {
|
|
switch (this.colorType) {
|
|
case 0:
|
|
case 3:
|
|
case 4:
|
|
return 1;
|
|
case 2:
|
|
case 6:
|
|
return 3;
|
|
}
|
|
}).call(this);
|
|
this.hasAlphaChannel = (_ref = this.colorType) === 4 || _ref === 6;
|
|
colors = this.colors + (this.hasAlphaChannel ? 1 : 0);
|
|
this.pixelBitlength = this.bits * colors;
|
|
this.colorSpace = (function() {
|
|
switch (this.colors) {
|
|
case 1:
|
|
return 'DeviceGray';
|
|
case 3:
|
|
return 'DeviceRGB';
|
|
}
|
|
}).call(this);
|
|
this.imgData = new Buffer(this.imgData);
|
|
return;
|
|
default:
|
|
this.pos += chunkSize;
|
|
}
|
|
this.pos += 4;
|
|
if (this.pos > this.data.length) {
|
|
throw new Error("Incomplete or corrupt PNG file");
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
PNG.prototype.read = function(bytes) {
|
|
var i, _i, _results;
|
|
_results = [];
|
|
for (i = _i = 0; 0 <= bytes ? _i < bytes : _i > bytes; i = 0 <= bytes ? ++_i : --_i) {
|
|
_results.push(this.data[this.pos++]);
|
|
}
|
|
return _results;
|
|
};
|
|
|
|
PNG.prototype.readUInt32 = function() {
|
|
var b1, b2, b3, b4;
|
|
b1 = this.data[this.pos++] << 24;
|
|
b2 = this.data[this.pos++] << 16;
|
|
b3 = this.data[this.pos++] << 8;
|
|
b4 = this.data[this.pos++];
|
|
return b1 | b2 | b3 | b4;
|
|
};
|
|
|
|
PNG.prototype.readUInt16 = function() {
|
|
var b1, b2;
|
|
b1 = this.data[this.pos++] << 8;
|
|
b2 = this.data[this.pos++];
|
|
return b1 | b2;
|
|
};
|
|
|
|
PNG.prototype.decodePixels = function(fn) {
|
|
var _this = this;
|
|
return zlib.inflate(this.imgData, function(err, data) {
|
|
var byte, c, col, i, left, length, p, pa, paeth, pb, pc, pixelBytes, pixels, pos, row, scanlineLength, upper, upperLeft, _i, _j, _k, _l, _m;
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
pixelBytes = _this.pixelBitlength / 8;
|
|
scanlineLength = pixelBytes * _this.width;
|
|
pixels = new Buffer(scanlineLength * _this.height);
|
|
length = data.length;
|
|
row = 0;
|
|
pos = 0;
|
|
c = 0;
|
|
while (pos < length) {
|
|
switch (data[pos++]) {
|
|
case 0:
|
|
for (i = _i = 0; _i < scanlineLength; i = _i += 1) {
|
|
pixels[c++] = data[pos++];
|
|
}
|
|
break;
|
|
case 1:
|
|
for (i = _j = 0; _j < scanlineLength; i = _j += 1) {
|
|
byte = data[pos++];
|
|
left = i < pixelBytes ? 0 : pixels[c - pixelBytes];
|
|
pixels[c++] = (byte + left) % 256;
|
|
}
|
|
break;
|
|
case 2:
|
|
for (i = _k = 0; _k < scanlineLength; i = _k += 1) {
|
|
byte = data[pos++];
|
|
col = (i - (i % pixelBytes)) / pixelBytes;
|
|
upper = row && pixels[(row - 1) * scanlineLength + col * pixelBytes + (i % pixelBytes)];
|
|
pixels[c++] = (upper + byte) % 256;
|
|
}
|
|
break;
|
|
case 3:
|
|
for (i = _l = 0; _l < scanlineLength; i = _l += 1) {
|
|
byte = data[pos++];
|
|
col = (i - (i % pixelBytes)) / pixelBytes;
|
|
left = i < pixelBytes ? 0 : pixels[c - pixelBytes];
|
|
upper = row && pixels[(row - 1) * scanlineLength + col * pixelBytes + (i % pixelBytes)];
|
|
pixels[c++] = (byte + Math.floor((left + upper) / 2)) % 256;
|
|
}
|
|
break;
|
|
case 4:
|
|
for (i = _m = 0; _m < scanlineLength; i = _m += 1) {
|
|
byte = data[pos++];
|
|
col = (i - (i % pixelBytes)) / pixelBytes;
|
|
left = i < pixelBytes ? 0 : pixels[c - pixelBytes];
|
|
if (row === 0) {
|
|
upper = upperLeft = 0;
|
|
} else {
|
|
upper = pixels[(row - 1) * scanlineLength + col * pixelBytes + (i % pixelBytes)];
|
|
upperLeft = col && pixels[(row - 1) * scanlineLength + (col - 1) * pixelBytes + (i % pixelBytes)];
|
|
}
|
|
p = left + upper - upperLeft;
|
|
pa = Math.abs(p - left);
|
|
pb = Math.abs(p - upper);
|
|
pc = Math.abs(p - upperLeft);
|
|
if (pa <= pb && pa <= pc) {
|
|
paeth = left;
|
|
} else if (pb <= pc) {
|
|
paeth = upper;
|
|
} else {
|
|
paeth = upperLeft;
|
|
}
|
|
pixels[c++] = (byte + paeth) % 256;
|
|
}
|
|
break;
|
|
default:
|
|
throw new Error("Invalid filter algorithm: " + data[pos - 1]);
|
|
}
|
|
row++;
|
|
}
|
|
return fn(pixels);
|
|
});
|
|
};
|
|
|
|
PNG.prototype.decodePalette = function() {
|
|
var c, i, length, palette, pos, ret, transparency, _i, _ref, _ref1;
|
|
palette = this.palette;
|
|
transparency = this.transparency.indexed || [];
|
|
ret = new Buffer(transparency.length + palette.length);
|
|
pos = 0;
|
|
length = palette.length;
|
|
c = 0;
|
|
for (i = _i = 0, _ref = palette.length; _i < _ref; i = _i += 3) {
|
|
ret[pos++] = palette[i];
|
|
ret[pos++] = palette[i + 1];
|
|
ret[pos++] = palette[i + 2];
|
|
ret[pos++] = (_ref1 = transparency[c++]) != null ? _ref1 : 255;
|
|
}
|
|
return ret;
|
|
};
|
|
|
|
PNG.prototype.copyToImageData = function(imageData, pixels) {
|
|
var alpha, colors, data, i, input, j, k, length, palette, v, _ref;
|
|
colors = this.colors;
|
|
palette = null;
|
|
alpha = this.hasAlphaChannel;
|
|
if (this.palette.length) {
|
|
palette = (_ref = this._decodedPalette) != null ? _ref : this._decodedPalette = this.decodePalette();
|
|
colors = 4;
|
|
alpha = true;
|
|
}
|
|
data = (imageData != null ? imageData.data : void 0) || imageData;
|
|
length = data.length;
|
|
input = palette || pixels;
|
|
i = j = 0;
|
|
if (colors === 1) {
|
|
while (i < length) {
|
|
k = palette ? pixels[i / 4] * 4 : j;
|
|
v = input[k++];
|
|
data[i++] = v;
|
|
data[i++] = v;
|
|
data[i++] = v;
|
|
data[i++] = alpha ? input[k++] : 255;
|
|
j = k;
|
|
}
|
|
} else {
|
|
while (i < length) {
|
|
k = palette ? pixels[i / 4] * 4 : j;
|
|
data[i++] = input[k++];
|
|
data[i++] = input[k++];
|
|
data[i++] = input[k++];
|
|
data[i++] = alpha ? input[k++] : 255;
|
|
j = k;
|
|
}
|
|
}
|
|
};
|
|
|
|
PNG.prototype.decode = function(fn) {
|
|
var ret,
|
|
_this = this;
|
|
ret = new Buffer(this.width * this.height * 4);
|
|
return this.decodePixels(function(pixels) {
|
|
_this.copyToImageData(ret, pixels);
|
|
return fn(ret);
|
|
});
|
|
};
|
|
|
|
return PNG;
|
|
|
|
})();
|
|
|
|
}).call(this);
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 294 */
|
|
/***/ function(module, exports) {
|
|
|
|
// Generated by CoffeeScript 1.10.0
|
|
(function() {
|
|
module.exports = {
|
|
annotate: function(x, y, w, h, options) {
|
|
var key, ref, val;
|
|
options.Type = 'Annot';
|
|
options.Rect = this._convertRect(x, y, w, h);
|
|
options.Border = [0, 0, 0];
|
|
if (options.Subtype !== 'Link') {
|
|
if (options.C == null) {
|
|
options.C = this._normalizeColor(options.color || [0, 0, 0]);
|
|
}
|
|
}
|
|
delete options.color;
|
|
if (typeof options.Dest === 'string') {
|
|
options.Dest = new String(options.Dest);
|
|
}
|
|
for (key in options) {
|
|
val = options[key];
|
|
options[key[0].toUpperCase() + key.slice(1)] = val;
|
|
}
|
|
ref = this.ref(options);
|
|
this.page.annotations.push(ref);
|
|
ref.end();
|
|
return this;
|
|
},
|
|
note: function(x, y, w, h, contents, options) {
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
options.Subtype = 'Text';
|
|
options.Contents = new String(contents);
|
|
options.Name = 'Comment';
|
|
if (options.color == null) {
|
|
options.color = [243, 223, 92];
|
|
}
|
|
return this.annotate(x, y, w, h, options);
|
|
},
|
|
link: function(x, y, w, h, url, options) {
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
options.Subtype = 'Link';
|
|
options.A = this.ref({
|
|
S: 'URI',
|
|
URI: new String(url)
|
|
});
|
|
options.A.end();
|
|
return this.annotate(x, y, w, h, options);
|
|
},
|
|
_markup: function(x, y, w, h, options) {
|
|
var ref1, x1, x2, y1, y2;
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
ref1 = this._convertRect(x, y, w, h), x1 = ref1[0], y1 = ref1[1], x2 = ref1[2], y2 = ref1[3];
|
|
options.QuadPoints = [x1, y2, x2, y2, x1, y1, x2, y1];
|
|
options.Contents = new String;
|
|
return this.annotate(x, y, w, h, options);
|
|
},
|
|
highlight: function(x, y, w, h, options) {
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
options.Subtype = 'Highlight';
|
|
if (options.color == null) {
|
|
options.color = [241, 238, 148];
|
|
}
|
|
return this._markup(x, y, w, h, options);
|
|
},
|
|
underline: function(x, y, w, h, options) {
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
options.Subtype = 'Underline';
|
|
return this._markup(x, y, w, h, options);
|
|
},
|
|
strike: function(x, y, w, h, options) {
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
options.Subtype = 'StrikeOut';
|
|
return this._markup(x, y, w, h, options);
|
|
},
|
|
lineAnnotation: function(x1, y1, x2, y2, options) {
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
options.Subtype = 'Line';
|
|
options.Contents = new String;
|
|
options.L = [x1, this.page.height - y1, x2, this.page.height - y2];
|
|
return this.annotate(x1, y1, x2, y2, options);
|
|
},
|
|
rectAnnotation: function(x, y, w, h, options) {
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
options.Subtype = 'Square';
|
|
options.Contents = new String;
|
|
return this.annotate(x, y, w, h, options);
|
|
},
|
|
ellipseAnnotation: function(x, y, w, h, options) {
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
options.Subtype = 'Circle';
|
|
options.Contents = new String;
|
|
return this.annotate(x, y, w, h, options);
|
|
},
|
|
textAnnotation: function(x, y, w, h, text, options) {
|
|
if (options == null) {
|
|
options = {};
|
|
}
|
|
options.Subtype = 'FreeText';
|
|
options.Contents = new String(text);
|
|
options.DA = new String;
|
|
return this.annotate(x, y, w, h, options);
|
|
},
|
|
_convertRect: function(x1, y1, w, h) {
|
|
var m0, m1, m2, m3, m4, m5, ref1, x2, y2;
|
|
y2 = y1;
|
|
y1 += h;
|
|
x2 = x1 + w;
|
|
ref1 = this._ctm, m0 = ref1[0], m1 = ref1[1], m2 = ref1[2], m3 = ref1[3], m4 = ref1[4], m5 = ref1[5];
|
|
x1 = m0 * x1 + m2 * y1 + m4;
|
|
y1 = m1 * x1 + m3 * y1 + m5;
|
|
x2 = m0 * x2 + m2 * y2 + m4;
|
|
y2 = m1 * x2 + m3 * y2 + m5;
|
|
return [x1, y1, x2, y2];
|
|
}
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
|
|
/***/ },
|
|
/* 295 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
module.exports = {
|
|
'4A0': [4767.87, 6740.79],
|
|
'2A0': [3370.39, 4767.87],
|
|
A0: [2383.94, 3370.39],
|
|
A1: [1683.78, 2383.94],
|
|
A2: [1190.55, 1683.78],
|
|
A3: [841.89, 1190.55],
|
|
A4: [595.28, 841.89],
|
|
A5: [419.53, 595.28],
|
|
A6: [297.64, 419.53],
|
|
A7: [209.76, 297.64],
|
|
A8: [147.40, 209.76],
|
|
A9: [104.88, 147.40],
|
|
A10: [73.70, 104.88],
|
|
B0: [2834.65, 4008.19],
|
|
B1: [2004.09, 2834.65],
|
|
B2: [1417.32, 2004.09],
|
|
B3: [1000.63, 1417.32],
|
|
B4: [708.66, 1000.63],
|
|
B5: [498.90, 708.66],
|
|
B6: [354.33, 498.90],
|
|
B7: [249.45, 354.33],
|
|
B8: [175.75, 249.45],
|
|
B9: [124.72, 175.75],
|
|
B10: [87.87, 124.72],
|
|
C0: [2599.37, 3676.54],
|
|
C1: [1836.85, 2599.37],
|
|
C2: [1298.27, 1836.85],
|
|
C3: [918.43, 1298.27],
|
|
C4: [649.13, 918.43],
|
|
C5: [459.21, 649.13],
|
|
C6: [323.15, 459.21],
|
|
C7: [229.61, 323.15],
|
|
C8: [161.57, 229.61],
|
|
C9: [113.39, 161.57],
|
|
C10: [79.37, 113.39],
|
|
RA0: [2437.80, 3458.27],
|
|
RA1: [1729.13, 2437.80],
|
|
RA2: [1218.90, 1729.13],
|
|
RA3: [864.57, 1218.90],
|
|
RA4: [609.45, 864.57],
|
|
SRA0: [2551.18, 3628.35],
|
|
SRA1: [1814.17, 2551.18],
|
|
SRA2: [1275.59, 1814.17],
|
|
SRA3: [907.09, 1275.59],
|
|
SRA4: [637.80, 907.09],
|
|
EXECUTIVE: [521.86, 756.00],
|
|
FOLIO: [612.00, 936.00],
|
|
LEGAL: [612.00, 1008.00],
|
|
LETTER: [612.00, 792.00],
|
|
TABLOID: [792.00, 1224.00]
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 296 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(Buffer) {/* jslint node: true */
|
|
'use strict';
|
|
|
|
var PDFImage = __webpack_require__(289);
|
|
|
|
function ImageMeasure(pdfDoc, imageDictionary) {
|
|
this.pdfDoc = pdfDoc;
|
|
this.imageDictionary = imageDictionary || {};
|
|
}
|
|
|
|
ImageMeasure.prototype.measureImage = function (src) {
|
|
var image, label;
|
|
var that = this;
|
|
|
|
if (!this.pdfDoc._imageRegistry[src]) {
|
|
label = 'I' + (++this.pdfDoc._imageCount);
|
|
try {
|
|
image = PDFImage.open(realImageSrc(src), label);
|
|
} catch (error) {
|
|
image = null;
|
|
}
|
|
if (image === null || image === undefined) {
|
|
throw 'invalid image, images dictionary should contain dataURL entries (or local file paths in node.js)';
|
|
}
|
|
image.embed(this.pdfDoc);
|
|
this.pdfDoc._imageRegistry[src] = image;
|
|
} else {
|
|
image = this.pdfDoc._imageRegistry[src];
|
|
}
|
|
|
|
return {width: image.width, height: image.height};
|
|
|
|
function realImageSrc(src) {
|
|
var img = that.imageDictionary[src];
|
|
|
|
if (!img) {
|
|
return src;
|
|
}
|
|
|
|
var index = img.indexOf('base64,');
|
|
if (index < 0) {
|
|
return that.imageDictionary[src];
|
|
}
|
|
|
|
return new Buffer(img.substring(index + 7), 'base64');
|
|
}
|
|
};
|
|
|
|
module.exports = ImageMeasure;
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2).Buffer))
|
|
|
|
/***/ },
|
|
/* 297 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* jslint node: true */
|
|
'use strict';
|
|
|
|
|
|
function groupDecorations(line) {
|
|
var groups = [], curGroup = null;
|
|
for (var i = 0, l = line.inlines.length; i < l; i++) {
|
|
var inline = line.inlines[i];
|
|
var decoration = inline.decoration;
|
|
if (!decoration) {
|
|
curGroup = null;
|
|
continue;
|
|
}
|
|
var color = inline.decorationColor || inline.color || 'black';
|
|
var style = inline.decorationStyle || 'solid';
|
|
decoration = Array.isArray(decoration) ? decoration : [decoration];
|
|
for (var ii = 0, ll = decoration.length; ii < ll; ii++) {
|
|
var deco = decoration[ii];
|
|
if (!curGroup || deco !== curGroup.decoration ||
|
|
style !== curGroup.decorationStyle || color !== curGroup.decorationColor ||
|
|
deco === 'lineThrough') {
|
|
|
|
curGroup = {
|
|
line: line,
|
|
decoration: deco,
|
|
decorationColor: color,
|
|
decorationStyle: style,
|
|
inlines: [inline]
|
|
};
|
|
groups.push(curGroup);
|
|
} else {
|
|
curGroup.inlines.push(inline);
|
|
}
|
|
}
|
|
}
|
|
|
|
return groups;
|
|
}
|
|
|
|
function drawDecoration(group, x, y, pdfKitDoc) {
|
|
function maxInline() {
|
|
var max = 0;
|
|
for (var i = 0, l = group.inlines.length; i < l; i++) {
|
|
var inl = group.inlines[i];
|
|
max = inl.fontSize > max ? i : max;
|
|
}
|
|
return group.inlines[max];
|
|
}
|
|
function width() {
|
|
var sum = 0;
|
|
for (var i = 0, l = group.inlines.length; i < l; i++) {
|
|
sum += group.inlines[i].width;
|
|
}
|
|
return sum;
|
|
}
|
|
var firstInline = group.inlines[0],
|
|
biggerInline = maxInline(),
|
|
totalWidth = width(),
|
|
lineAscent = group.line.getAscenderHeight(),
|
|
ascent = biggerInline.font.ascender / 1000 * biggerInline.fontSize,
|
|
height = biggerInline.height,
|
|
descent = height - ascent;
|
|
|
|
var lw = 0.5 + Math.floor(Math.max(biggerInline.fontSize - 8, 0) / 2) * 0.12;
|
|
|
|
switch (group.decoration) {
|
|
case 'underline':
|
|
y += lineAscent + descent * 0.45;
|
|
break;
|
|
case 'overline':
|
|
y += lineAscent - (ascent * 0.85);
|
|
break;
|
|
case 'lineThrough':
|
|
y += lineAscent - (ascent * 0.25);
|
|
break;
|
|
default:
|
|
throw 'Unkown decoration : ' + group.decoration;
|
|
}
|
|
pdfKitDoc.save();
|
|
|
|
if (group.decorationStyle === 'double') {
|
|
var gap = Math.max(0.5, lw * 2);
|
|
pdfKitDoc.fillColor(group.decorationColor)
|
|
.rect(x + firstInline.x, y - lw / 2, totalWidth, lw / 2).fill()
|
|
.rect(x + firstInline.x, y + gap - lw / 2, totalWidth, lw / 2).fill();
|
|
} else if (group.decorationStyle === 'dashed') {
|
|
var nbDashes = Math.ceil(totalWidth / (3.96 + 2.84));
|
|
var rdx = x + firstInline.x;
|
|
pdfKitDoc.rect(rdx, y, totalWidth, lw).clip();
|
|
pdfKitDoc.fillColor(group.decorationColor);
|
|
for (var i = 0; i < nbDashes; i++) {
|
|
pdfKitDoc.rect(rdx, y - lw / 2, 3.96, lw).fill();
|
|
rdx += 3.96 + 2.84;
|
|
}
|
|
} else if (group.decorationStyle === 'dotted') {
|
|
var nbDots = Math.ceil(totalWidth / (lw * 3));
|
|
var rx = x + firstInline.x;
|
|
pdfKitDoc.rect(rx, y, totalWidth, lw).clip();
|
|
pdfKitDoc.fillColor(group.decorationColor);
|
|
for (var ii = 0; ii < nbDots; ii++) {
|
|
pdfKitDoc.rect(rx, y - lw / 2, lw, lw).fill();
|
|
rx += (lw * 3);
|
|
}
|
|
} else if (group.decorationStyle === 'wavy') {
|
|
var sh = 0.7, sv = 1;
|
|
var nbWaves = Math.ceil(totalWidth / (sh * 2)) + 1;
|
|
var rwx = x + firstInline.x - 1;
|
|
pdfKitDoc.rect(x + firstInline.x, y - sv, totalWidth, y + sv).clip();
|
|
pdfKitDoc.lineWidth(0.24);
|
|
pdfKitDoc.moveTo(rwx, y);
|
|
for (var iii = 0; iii < nbWaves; iii++) {
|
|
pdfKitDoc.bezierCurveTo(rwx + sh, y - sv, rwx + sh * 2, y - sv, rwx + sh * 3, y)
|
|
.bezierCurveTo(rwx + sh * 4, y + sv, rwx + sh * 5, y + sv, rwx + sh * 6, y);
|
|
rwx += sh * 6;
|
|
}
|
|
pdfKitDoc.stroke(group.decorationColor);
|
|
|
|
} else {
|
|
pdfKitDoc.fillColor(group.decorationColor)
|
|
.rect(x + firstInline.x, y - lw / 2, totalWidth, lw)
|
|
.fill();
|
|
}
|
|
pdfKitDoc.restore();
|
|
}
|
|
|
|
function drawDecorations(line, x, y, pdfKitDoc) {
|
|
var groups = groupDecorations(line);
|
|
for (var i = 0, l = groups.length; i < l; i++) {
|
|
drawDecoration(groups[i], x, y, pdfKitDoc);
|
|
}
|
|
}
|
|
|
|
function drawBackground(line, x, y, pdfKitDoc) {
|
|
var height = line.getHeight();
|
|
for (var i = 0, l = line.inlines.length; i < l; i++) {
|
|
var inline = line.inlines[i];
|
|
if (inline.background) {
|
|
pdfKitDoc.fillColor(inline.background)
|
|
.rect(x + inline.x, y, inline.width, height)
|
|
.fill();
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
drawBackground: drawBackground,
|
|
drawDecorations: drawDecorations
|
|
};
|
|
|
|
/***/ },
|
|
/* 298 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var __WEBPACK_AMD_DEFINE_RESULT__;/* FileSaver.js
|
|
* A saveAs() FileSaver implementation.
|
|
* 1.3.2
|
|
* 2016-06-16 18:25:19
|
|
*
|
|
* By Eli Grey, http://eligrey.com
|
|
* License: MIT
|
|
* See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
|
|
*/
|
|
|
|
/*global self */
|
|
/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
|
|
|
|
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
|
|
|
|
var saveAs = saveAs || (function(view) {
|
|
"use strict";
|
|
// IE <10 is explicitly unsupported
|
|
if (typeof view === "undefined" || typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {
|
|
return;
|
|
}
|
|
var
|
|
doc = view.document
|
|
// only get URL when necessary in case Blob.js hasn't overridden it yet
|
|
, get_URL = function() {
|
|
return view.URL || view.webkitURL || view;
|
|
}
|
|
, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
|
|
, can_use_save_link = "download" in save_link
|
|
, click = function(node) {
|
|
var event = new MouseEvent("click");
|
|
node.dispatchEvent(event);
|
|
}
|
|
, is_safari = /constructor/i.test(view.HTMLElement) || view.safari
|
|
, is_chrome_ios =/CriOS\/[\d]+/.test(navigator.userAgent)
|
|
, throw_outside = function(ex) {
|
|
(view.setImmediate || view.setTimeout)(function() {
|
|
throw ex;
|
|
}, 0);
|
|
}
|
|
, force_saveable_type = "application/octet-stream"
|
|
// the Blob API is fundamentally broken as there is no "downloadfinished" event to subscribe to
|
|
, arbitrary_revoke_timeout = 1000 * 40 // in ms
|
|
, revoke = function(file) {
|
|
var revoker = function() {
|
|
if (typeof file === "string") { // file is an object URL
|
|
get_URL().revokeObjectURL(file);
|
|
} else { // file is a File
|
|
file.remove();
|
|
}
|
|
};
|
|
setTimeout(revoker, arbitrary_revoke_timeout);
|
|
}
|
|
, dispatch = function(filesaver, event_types, event) {
|
|
event_types = [].concat(event_types);
|
|
var i = event_types.length;
|
|
while (i--) {
|
|
var listener = filesaver["on" + event_types[i]];
|
|
if (typeof listener === "function") {
|
|
try {
|
|
listener.call(filesaver, event || filesaver);
|
|
} catch (ex) {
|
|
throw_outside(ex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
, auto_bom = function(blob) {
|
|
// prepend BOM for UTF-8 XML and text/* types (including HTML)
|
|
// note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF
|
|
if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
|
|
return new Blob([String.fromCharCode(0xFEFF), blob], {type: blob.type});
|
|
}
|
|
return blob;
|
|
}
|
|
, FileSaver = function(blob, name, no_auto_bom) {
|
|
if (!no_auto_bom) {
|
|
blob = auto_bom(blob);
|
|
}
|
|
// First try a.download, then web filesystem, then object URLs
|
|
var
|
|
filesaver = this
|
|
, type = blob.type
|
|
, force = type === force_saveable_type
|
|
, object_url
|
|
, dispatch_all = function() {
|
|
dispatch(filesaver, "writestart progress write writeend".split(" "));
|
|
}
|
|
// on any filesys errors revert to saving with object URLs
|
|
, fs_error = function() {
|
|
if ((is_chrome_ios || (force && is_safari)) && view.FileReader) {
|
|
// Safari doesn't allow downloading of blob urls
|
|
var reader = new FileReader();
|
|
reader.onloadend = function() {
|
|
var url = is_chrome_ios ? reader.result : reader.result.replace(/^data:[^;]*;/, 'data:attachment/file;');
|
|
var popup = view.open(url, '_blank');
|
|
if(!popup) view.location.href = url;
|
|
url=undefined; // release reference before dispatching
|
|
filesaver.readyState = filesaver.DONE;
|
|
dispatch_all();
|
|
};
|
|
reader.readAsDataURL(blob);
|
|
filesaver.readyState = filesaver.INIT;
|
|
return;
|
|
}
|
|
// don't create more object URLs than needed
|
|
if (!object_url) {
|
|
object_url = get_URL().createObjectURL(blob);
|
|
}
|
|
if (force) {
|
|
view.location.href = object_url;
|
|
} else {
|
|
var opened = view.open(object_url, "_blank");
|
|
if (!opened) {
|
|
// Apple does not allow window.open, see https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html
|
|
view.location.href = object_url;
|
|
}
|
|
}
|
|
filesaver.readyState = filesaver.DONE;
|
|
dispatch_all();
|
|
revoke(object_url);
|
|
}
|
|
;
|
|
filesaver.readyState = filesaver.INIT;
|
|
|
|
if (can_use_save_link) {
|
|
object_url = get_URL().createObjectURL(blob);
|
|
setTimeout(function() {
|
|
save_link.href = object_url;
|
|
save_link.download = name;
|
|
click(save_link);
|
|
dispatch_all();
|
|
revoke(object_url);
|
|
filesaver.readyState = filesaver.DONE;
|
|
});
|
|
return;
|
|
}
|
|
|
|
fs_error();
|
|
}
|
|
, FS_proto = FileSaver.prototype
|
|
, saveAs = function(blob, name, no_auto_bom) {
|
|
return new FileSaver(blob, name || blob.name || "download", no_auto_bom);
|
|
}
|
|
;
|
|
// IE 10+ (native saveAs)
|
|
if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) {
|
|
return function(blob, name, no_auto_bom) {
|
|
name = name || blob.name || "download";
|
|
|
|
if (!no_auto_bom) {
|
|
blob = auto_bom(blob);
|
|
}
|
|
return navigator.msSaveOrOpenBlob(blob, name);
|
|
};
|
|
}
|
|
|
|
FS_proto.abort = function(){};
|
|
FS_proto.readyState = FS_proto.INIT = 0;
|
|
FS_proto.WRITING = 1;
|
|
FS_proto.DONE = 2;
|
|
|
|
FS_proto.error =
|
|
FS_proto.onwritestart =
|
|
FS_proto.onprogress =
|
|
FS_proto.onwrite =
|
|
FS_proto.onabort =
|
|
FS_proto.onerror =
|
|
FS_proto.onwriteend =
|
|
null;
|
|
|
|
return saveAs;
|
|
}(
|
|
typeof self !== "undefined" && self
|
|
|| typeof window !== "undefined" && window
|
|
|| this.content
|
|
));
|
|
// `self` is undefined in Firefox for Android content script context
|
|
// while `this` is nsIContentFrameMessageManager
|
|
// with an attribute `content` that corresponds to the window
|
|
|
|
if (typeof module !== "undefined" && module.exports) {
|
|
module.exports.saveAs = saveAs;
|
|
} else if (("function" !== "undefined" && __webpack_require__(299) !== null) && (__webpack_require__(300) !== null)) {
|
|
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
|
|
return saveAs;
|
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
}
|
|
|
|
|
|
/***/ },
|
|
/* 299 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = function() { throw new Error("define cannot be used indirect"); };
|
|
|
|
|
|
/***/ },
|
|
/* 300 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {module.exports = __webpack_amd_options__;
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, {}))
|
|
|
|
/***/ }
|
|
/******/ ])
|
|
});
|
|
; |