From 1bfdde5346b18c3b1b54a90d00b295f8f7746eef Mon Sep 17 00:00:00 2001 From: Klemek Date: Wed, 17 Jul 2019 11:15:01 +0200 Subject: [PATCH] updated docs --- build_preview.js | 2 +- dist/fa-diagrams.js | 1950 ++++++++++++++++++++------------------- dist/fa-diagrams.min.js | 2 +- docs/fa-diagrams.min.js | 2 +- docs/sample.yml | 2 +- package-lock.json | 683 ++++---------- package.json | 5 +- preview/links.svg | 3 +- preview/sample.svg | 28 +- 9 files changed, 1209 insertions(+), 1468 deletions(-) diff --git a/build_preview.js b/build_preview.js index fbacfc8..68f9ecf 100644 --- a/build_preview.js +++ b/build_preview.js @@ -58,7 +58,7 @@ const data = { from: 'node1', to: 'node2', color: '#333333', - bottom: 'hello' + bottom: '"hello"' } ] }; diff --git a/dist/fa-diagrams.js b/dist/fa-diagrams.js index a71d3cb..43d468b 100644 --- a/dist/fa-diagrams.js +++ b/dist/fa-diagrams.js @@ -8252,963 +8252,1011 @@ module.exports = function(xml, userOptions) { },{"./options-helper":35,"./xml2js":36}],38:[function(require,module,exports){ (function (global){ -const placing = require('./placing'); -const rendering = require('./rendering'); - -const self = { - /** - * @param {{options: Object|undefined, nodes: Object[]|undefined, links: Object[]|undefined}} data - * @returns {string} - */ - compute: (data) => { - const options = data['options'] || {}; - - let nodes = {}; - const nodeList = (data['nodes'] || []).filter(n => typeof n.name === 'string'); - nodeList.forEach(n => nodes[n.name] = n); - - let links = (data['links'] || []).filter(l => l.from && l.to); - links.filter(l => !nodes[l.from]).forEach(l => console.warn(`unknown source node "${l.from}"`)); - links.filter(l => !nodes[l.to]).forEach(l => console.warn(`unknown destination node "${l.to}"`)); - links = links.filter(l => nodes[l.from] && nodes[l.to]); - - nodes = placing(options['placing']).compute(nodes, links); - - if (!nodes) - throw 'Failed to place nodes'; - - return rendering(options['rendering']).compute(nodes, links); - }, -}; - -module.exports = self; // Node +const placing = require('./placing'); +const rendering = require('./rendering'); + +const self = { + /** + * @param {{options: Object?, nodes: Object[]?, links: Object[]?}} data + * @returns {string} + */ + compute: (data) => { + const options = data['options'] || {}; + + let nodes = {}; + const nodeList = (data['nodes'] || []).filter(n => typeof n.name === 'string'); + nodeList.forEach(n => nodes[n.name] = n); + + let links = (data['links'] || []).filter(l => l.from && l.to); + links.filter(l => !nodes[l.from]).forEach(l => console.warn(`unknown source node "${l.from}"`)); + links.filter(l => !nodes[l.to]).forEach(l => console.warn(`unknown destination node "${l.to}"`)); + links = links.filter(l => nodes[l.from] && nodes[l.to]); + + nodes = placing(options['placing']).compute(nodes, links); + + if (!nodes) + throw 'Failed to place nodes'; + + return rendering(options['rendering']).compute(nodes, links); + }, +}; + +module.exports = self; // Node global['faDiagrams'] = self; // Browserify }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./placing":39,"./rendering":40}],39:[function(require,module,exports){ -const utils = require('./utils'); - -/** - * @typedef Node1 - * @property {string} name - * @property {undefined|number} x - * @property {undefined|number} y - * @property {undefined|{beforeX: string[], afterX: string[], beforeY: string[], afterY: string[]}} const - */ - -/** - * @typedef Link1 - * @property {string} from - * @property {string} to - * @property {string|undefined} direction - */ - -const NODE_DEF = { - 'name': '!string', - 'x': 'number', - 'y': 'number' -}; - -const LINK_DEF = { - 'from': '!string', - 'to': '!string', - 'direction': 'string' -}; - -const DEFAULT_OPTIONS = { - 'max-link-length': 3, - 'diagonals': true, -}; - -module.exports = (options) => { - - options = utils.merge(DEFAULT_OPTIONS, options); - - const self = { - - /** - * Get the current bounds of the graph of nodes - * @param {Object} nodes - * @returns {{w: number, x: number, h: number, y: number}} - */ - getBounds: (nodes) => { - const list = Object.values(nodes).filter(n => n.x !== undefined); - if (list.length === 0) - return {x: 0, y: 0, w: 0, h: 0}; //empty - let minX = null; - let minY = null; - let maxX = null; - let maxY = null; - list.forEach(n => { - minX = minX !== null ? Math.min(n.x, minX) : n.x; - minY = minY !== null ? Math.min(n.y, minY) : n.y; - maxX = maxX !== null ? Math.max(n.x, maxX) : n.x; - maxY = maxY !== null ? Math.max(n.y, maxY) : n.y; - }); - return {x: minX, y: minY, w: maxX - minX + 1, h: maxY - minY + 1}; - }, - - /** - * Get a new available position around the existing nodes - * @param {Object} nodes - * @returns {{x: number, y: number}} - */ - getNewPos: (nodes) => { - const b = self.getBounds(nodes); - const map = utils.newMap(b.w, b.h, false); - const list = Object.values(nodes).filter(n => n.x !== undefined); - list.forEach(n => { - map[n.x - b.x][n.y - b.y] = true; - }); - for (let y = 0; y < b.h; y++) { - for (let x = 0; x < b.w; x++) { - if (!map[x][y]) - return {x: x + b.x, y: y + b.y}; - } - } - if (b.w <= b.h) - return {x: b.x + b.w, y: b.y}; //expand horizontally - else - return {x: b.x, y: b.y + b.h}; //expand vertically - }, - - /** - * Check if no other nodes are located in the path of n1 <-> n2 - * @param {Object} nodes - * @param {string} n1 - * @param {string} n2 - * @returns {boolean} - */ - nodeBetween: (nodes, n1, n2) => { - let x1 = nodes[n1].x; - let y1 = nodes[n1].y; - let x2 = nodes[n2].x; - let y2 = nodes[n2].y; - - const dx = x2 - x1; - const dy = y2 - y1; - - const samePos = (x, y) => n => n.x === x && n.y === y && n.name !== n1 && n.name !== n2; - - if (Math.abs(dx) >= Math.abs(dy)) { - if (x1 > x2) { - let tmp = x1; - x1 = x2; - x2 = tmp; - } - for (let x = x1; x <= x2; x++) { - let y = Math.round(y1 + dy * (x - x1) / dx); - if (Object.values(nodes).find(samePos(x, y))) - return true; - } - } else { - if (y1 > y2) { - let tmp = y1; - y1 = y2; - y2 = tmp; - } - for (let y = y1; y <= y2; y++) { - let x = Math.round(x1 + dx * (y - y1) / dy); - if (Object.values(nodes).find(samePos(x, y))) - return true; - } - } - return false; - }, - - /** - * Compute the area of possibility for the node placement and return the node calculated position or if it is unconstrained - * @param {Object} nodes - * @param {string} n - node key - * @param {boolean} diagonals - * @returns {null|{x: number, y: number, free: boolean}} null if not possible - */ - getPosition: (nodes, n, diagonals) => { - const node = nodes[n]; - const c = { - maxX: null, - maxY: null, - minX: null, - minY: null, - startX: null, - startY: null, - free: true, - }; - - const apply = (dMinX, dMaxX, dMinY, dMaxY) => n2 => { - if (nodes[n2].x !== undefined) { - const x2 = nodes[n2].x; - const y2 = nodes[n2].y; - c.minX = c.minX !== null ? Math.max(x2 + dMinX, c.minX) : x2 + dMinX; - c.maxX = c.maxX !== null ? Math.min(x2 + dMaxX, c.maxX) : x2 + dMaxX; - c.minY = c.minY !== null ? Math.max(y2 + dMinY, c.minY) : y2 + dMinY; - c.maxY = c.maxY !== null ? Math.min(y2 + dMaxY, c.maxY) : y2 + dMaxY; - if (c.startX === null) { - c.startX = Math.abs(dMaxY + dMinY) > 0 ? x2 : (Math.abs(dMinX) === 1 ? 'minX' : 'maxX'); - c.startY = Math.abs(dMaxX + dMinX) > 0 ? y2 : (Math.abs(dMinY) === 1 ? 'minY' : 'maxY'); - } - c.free = false; - } - }; - - const area = options['max-link-length']; - const sideArea = diagonals ? area : 0; - - node.const.beforeX.forEach(apply(1, 1 + area, -sideArea, sideArea)); - node.const.beforeY.forEach(apply(-sideArea, sideArea, 1, 1 + area)); - node.const.afterX.forEach(apply(-1 - area, -1, -sideArea, sideArea)); - node.const.afterY.forEach(apply(-sideArea, sideArea, -1 - area, -1)); - - if (typeof c.startX === 'string') - c.startX = c[c.startX]; - if (typeof c.startY === 'string') - c.startY = c[c.startY]; - - return (c.minX > c.maxX || c.minY > c.maxY) ? null : {x: c.startX, y: c.startY, free: c.free}; - }, - - /** - * Test if the links are respected by the currently placed nodes - * @param {Object} nodes - * @param {Link1[]} links - * @returns {boolean} - */ - isValid: (nodes, links) => { - let link, src, dst; - - //check overlapping - const list = Object.values(nodes).filter(n => n.x !== undefined); - for (let n1 = 0; n1 < list.length - 1; n1++) - for (let n2 = n1 + 1; n2 < list.length; n2++) { - if (list[n1].x === list[n2].x && list[n1].y === list[n2].y) - return false; - } - - - for (let li = 0; li < links.length; li++) { - link = links[li]; - src = nodes[link.from]; - dst = nodes[link.to]; - if (src.x !== undefined && dst.x !== undefined) { - if (self.nodeBetween(nodes, link.from, link.to)) - return false; - if (Math.pow(dst.x - src.x, 2) + Math.pow(dst.y - src.y, 2) > Math.pow(options['max-link-length'], 2)) - return false; - switch (link.direction) { - case 'up': - case 'top': - if (dst.y - src.y >= 0) return false; - break; - case 'down': - case 'bottom': - if (dst.y - src.y <= 0) return false; - break; - case 'left': - if (dst.x - src.x >= 0) return false; - break; - case 'right': - if (dst.x - src.x <= 0) return false; - break; - } - if (!options['diagonals'] && src.x !== dst.x && src.y !== dst.y) - return false; - } - } - return true; - }, - - - /** - * Assure that all nodes coordinates are starting at 0,0 - * @param {Object} nodes - */ - correctPlacing: (nodes) => { - const b = self.getBounds(nodes); - Object.values(nodes).forEach(node => { - node.x -= b.x; - node.y -= b.y; - }); - }, - - /** - * Core function that do the placing recursively until one combination works - * @param {Object} nodes - * @param {Link1[]} links - * @param {number} depth - * @returns {null|Object} - */ - applyLinks: (nodes, links, depth = 0) => { - if (!self.isValid(nodes, links)) { - return null; - } - - const keys = Object.keys(nodes).filter(k => nodes[k].x === undefined); //not placed - - if (keys.length === 0) - return nodes; - - const free = []; - - const tryPos = (key, x, y) => { - const nodes2 = utils.ezClone(nodes); - nodes2[key].x = x; - nodes2[key].y = y; - return self.applyLinks(nodes2, links, depth + 1); - }; - - let key; - let nodes2; - let p; - - // prefer no diagonals - for (let ln = 0; ln < keys.length; ln++) { - key = keys[ln]; - p = self.getPosition(nodes, key, false); - if (!p && !options['diagonals']) { - return null; - } else if (p && p.free) { - free.push(keys[ln]); - } else if (p) { - nodes2 = tryPos(key, p.x, p.y); - if (nodes2) - return nodes2; - } - } - - // allow diagonals - for (let ln = 0; ln < keys.length; ln++) { - key = keys[ln]; - p = self.getPosition(nodes, key, true); - if (!p) { - return null; - } else if (p.free) { - free.push(keys[ln]); - } else { - nodes2 = tryPos(key, p.x, p.y); - if (nodes2) - return nodes2; - } - } - - for (let ln = 0; ln < free.length; ln++) { - key = free[ln]; - p = self.getNewPos(nodes); - nodes2 = tryPos(key, p.x, p.y); - if (nodes2) - return nodes2; - } - return null; - }, - - /** - * Compute x and y coordinates of the nodes with the given links between them - * @param {Object} nodes - * @param {Link1[]} links - * @returns {Object|null} - */ - compute: (nodes, links) => { - - Object.keys(nodes).forEach(key => { - const res = utils.isValid(nodes[key], NODE_DEF); - if (res) - throw `Node '${key}' is invalid at key '${res}'`; - }); - - links.forEach((link, i) => { - const res = utils.isValid(link, LINK_DEF); - if (res) - throw `Link ${i} (${link.from}->${link.to}) is invalid at key '${res}'`; - }); - - Object.values(nodes).forEach(node => { - node.const = { - beforeX: [], - afterX: [], - beforeY: [], - afterY: [] - }; - }); - - links.forEach(link => { - if (link.direction) { - switch (link.direction) { - case 'up': - case 'top': - nodes[link.from].const.beforeY.push(link.to); - nodes[link.to].const.afterY.push(link.from); - break; - case 'down': - case 'bottom': - nodes[link.from].const.afterY.push(link.to); - nodes[link.to].const.beforeY.push(link.from); - break; - case 'left': - nodes[link.from].const.beforeX.push(link.to); - nodes[link.to].const.afterX.push(link.from); - break; - case 'right': - nodes[link.from].const.afterX.push(link.to); - nodes[link.to].const.beforeX.push(link.from); - break; - } - } - }); - - nodes = self.applyLinks(nodes, links); - - if (nodes) { - self.correctPlacing(nodes); - - Object.values(nodes).forEach(node => { - delete node.const; - }); - } - - return nodes; - }, - - }; - return self; +const utils = require('./utils'); + +/** + * @typedef Node1 + * @property {string} name + * @property {undefined|number} x + * @property {undefined|number} y + * @property {undefined|{beforeX: string[], afterX: string[], beforeY: string[], afterY: string[]}} const + */ + +/** + * @typedef Link1 + * @property {string} from + * @property {string} to + * @property {string|undefined} direction + */ + +const NODE_DEF = { + 'name': '!string', + 'x': 'number', + 'y': 'number' +}; + +const LINK_DEF = { + 'from': '!string', + 'to': '!string', + 'direction': 'string' +}; + +const DEFAULT_OPTIONS = { + 'max-link-length': 3, + 'diagonals': true, +}; + +module.exports = (options) => { + + options = utils.merge(DEFAULT_OPTIONS, options); + + const self = { + + /** + * Get the current bounds of the graph of nodes + * @param {Object} nodes + * @returns {{w: number, x: number, h: number, y: number}} + */ + getBounds: (nodes) => { + const list = Object.values(nodes).filter(n => n.x !== undefined); + if (list.length === 0) + return {x: 0, y: 0, w: 0, h: 0}; //empty + let minX = null; + let minY = null; + let maxX = null; + let maxY = null; + list.forEach(n => { + minX = minX !== null ? Math.min(n.x, minX) : n.x; + minY = minY !== null ? Math.min(n.y, minY) : n.y; + maxX = maxX !== null ? Math.max(n.x, maxX) : n.x; + maxY = maxY !== null ? Math.max(n.y, maxY) : n.y; + }); + return {x: minX, y: minY, w: maxX - minX + 1, h: maxY - minY + 1}; + }, + + /** + * Get a new available position around the existing nodes + * @param {Object} nodes + * @returns {{x: number, y: number}} + */ + getNewPos: (nodes) => { + const b = self.getBounds(nodes); + const map = utils.newMap(b.w, b.h, false); + const list = Object.values(nodes).filter(n => n.x !== undefined); + list.forEach(n => { + map[n.x - b.x][n.y - b.y] = true; + }); + for (let y = 0; y < b.h; y++) { + for (let x = 0; x < b.w; x++) { + if (!map[x][y]) + return {x: x + b.x, y: y + b.y}; + } + } + if (b.w <= b.h) + return {x: b.x + b.w, y: b.y}; //expand horizontally + else + return {x: b.x, y: b.y + b.h}; //expand vertically + }, + + /** + * Check if no other nodes are located in the path of n1 <-> n2 + * @param {Object} nodes + * @param {string} n1 + * @param {string} n2 + * @returns {boolean} + */ + nodeBetween: (nodes, n1, n2) => { + let x1 = nodes[n1].x; + let y1 = nodes[n1].y; + let x2 = nodes[n2].x; + let y2 = nodes[n2].y; + + const dx = x2 - x1; + const dy = y2 - y1; + + const samePos = (x, y) => n => n.x === x && n.y === y && n.name !== n1 && n.name !== n2; + + if (Math.abs(dx) >= Math.abs(dy)) { + if (x1 > x2) { + let tmp = x1; + x1 = x2; + x2 = tmp; + } + for (let x = x1; x <= x2; x++) { + let y = Math.round(y1 + dy * (x - x1) / dx); + if (Object.values(nodes).find(samePos(x, y))) + return true; + } + } else { + if (y1 > y2) { + let tmp = y1; + y1 = y2; + y2 = tmp; + } + for (let y = y1; y <= y2; y++) { + let x = Math.round(x1 + dx * (y - y1) / dy); + if (Object.values(nodes).find(samePos(x, y))) + return true; + } + } + return false; + }, + + /** + * Compute the area of possibility for the node placement and return the node calculated position or if it is unconstrained + * @param {Object} nodes + * @param {string} n - node key + * @param {boolean} diagonals + * @returns {null|{x: number, y: number, free: boolean}} null if not possible + */ + getPosition: (nodes, n, diagonals) => { + const node = nodes[n]; + const c = { + maxX: null, + maxY: null, + minX: null, + minY: null, + startX: null, + startY: null, + free: true, + }; + + const apply = (dMinX, dMaxX, dMinY, dMaxY) => n2 => { + if (nodes[n2].x !== undefined) { + const x2 = nodes[n2].x; + const y2 = nodes[n2].y; + c.minX = c.minX !== null ? Math.max(x2 + dMinX, c.minX) : x2 + dMinX; + c.maxX = c.maxX !== null ? Math.min(x2 + dMaxX, c.maxX) : x2 + dMaxX; + c.minY = c.minY !== null ? Math.max(y2 + dMinY, c.minY) : y2 + dMinY; + c.maxY = c.maxY !== null ? Math.min(y2 + dMaxY, c.maxY) : y2 + dMaxY; + if (c.startX === null) { + c.startX = Math.abs(dMaxY + dMinY) > 0 ? x2 : (Math.abs(dMinX) === 1 ? 'minX' : 'maxX'); + c.startY = Math.abs(dMaxX + dMinX) > 0 ? y2 : (Math.abs(dMinY) === 1 ? 'minY' : 'maxY'); + } + c.free = false; + } + }; + + const area = options['max-link-length']; + const sideArea = diagonals ? area : 0; + + node.const.beforeX.forEach(apply(1, 1 + area, -sideArea, sideArea)); + node.const.beforeY.forEach(apply(-sideArea, sideArea, 1, 1 + area)); + node.const.afterX.forEach(apply(-1 - area, -1, -sideArea, sideArea)); + node.const.afterY.forEach(apply(-sideArea, sideArea, -1 - area, -1)); + + if (typeof c.startX === 'string') + c.startX = c[c.startX]; + if (typeof c.startY === 'string') + c.startY = c[c.startY]; + + return (c.minX > c.maxX || c.minY > c.maxY) ? null : {x: c.startX, y: c.startY, free: c.free}; + }, + + /** + * Test if the links are respected by the currently placed nodes + * @param {Object} nodes + * @param {Link1[]} links + * @returns {boolean} + */ + isValid: (nodes, links) => { + let link, src, dst; + + //check overlapping + const list = Object.values(nodes).filter(n => n.x !== undefined); + for (let n1 = 0; n1 < list.length - 1; n1++) + for (let n2 = n1 + 1; n2 < list.length; n2++) { + if (list[n1].x === list[n2].x && list[n1].y === list[n2].y) + return false; + } + + + for (let li = 0; li < links.length; li++) { + link = links[li]; + src = nodes[link.from]; + dst = nodes[link.to]; + if (src.x !== undefined && dst.x !== undefined) { + if (self.nodeBetween(nodes, link.from, link.to)) + return false; + if (Math.pow(dst.x - src.x, 2) + Math.pow(dst.y - src.y, 2) > Math.pow(options['max-link-length'], 2)) + return false; + switch (link.direction) { + case 'up': + case 'top': + if (dst.y - src.y >= 0) return false; + break; + case 'down': + case 'bottom': + if (dst.y - src.y <= 0) return false; + break; + case 'left': + if (dst.x - src.x >= 0) return false; + break; + case 'right': + if (dst.x - src.x <= 0) return false; + break; + } + if (!options['diagonals'] && src.x !== dst.x && src.y !== dst.y) + return false; + } + } + return true; + }, + + + /** + * Assure that all nodes coordinates are starting at 0,0 + * @param {Object} nodes + */ + correctPlacing: (nodes) => { + const b = self.getBounds(nodes); + Object.values(nodes).forEach(node => { + node.x -= b.x; + node.y -= b.y; + }); + }, + + /** + * Core function that do the placing recursively until one combination works + * @param {Object} nodes + * @param {Link1[]} links + * @param {number} depth + * @returns {null|Object} + */ + applyLinks: (nodes, links, depth = 0) => { + if (!self.isValid(nodes, links)) { + return null; + } + + const keys = Object.keys(nodes).filter(k => nodes[k].x === undefined); //not placed + + if (keys.length === 0) + return nodes; + + const free = []; + + const tryPos = (key, x, y) => { + const nodes2 = utils.ezClone(nodes); + nodes2[key].x = x; + nodes2[key].y = y; + return self.applyLinks(nodes2, links, depth + 1); + }; + + let key; + let nodes2; + let p; + + // prefer no diagonals + for (let ln = 0; ln < keys.length; ln++) { + key = keys[ln]; + p = self.getPosition(nodes, key, false); + if (!p && !options['diagonals']) { + return null; + } else if (p && p.free) { + free.push(keys[ln]); + } else if (p) { + nodes2 = tryPos(key, p.x, p.y); + if (nodes2) + return nodes2; + } + } + + // allow diagonals + for (let ln = 0; ln < keys.length; ln++) { + key = keys[ln]; + p = self.getPosition(nodes, key, true); + if (!p) { + return null; + } else if (p.free) { + free.push(keys[ln]); + } else { + nodes2 = tryPos(key, p.x, p.y); + if (nodes2) + return nodes2; + } + } + + for (let ln = 0; ln < free.length; ln++) { + key = free[ln]; + p = self.getNewPos(nodes); + nodes2 = tryPos(key, p.x, p.y); + if (nodes2) + return nodes2; + } + return null; + }, + + /** + * Compute x and y coordinates of the nodes with the given links between them + * @param {Object} nodes + * @param {Link1[]} links + * @returns {Object|null} + */ + compute: (nodes, links) => { + + Object.keys(nodes).forEach(key => { + const res = utils.isValid(nodes[key], NODE_DEF); + if (res) + throw `Node '${key}' is invalid at key '${res}'`; + }); + + links.forEach((link, i) => { + const res = utils.isValid(link, LINK_DEF); + if (res) + throw `Link ${i} (${link.from}->${link.to}) is invalid at key '${res}'`; + }); + + Object.values(nodes).forEach(node => { + node.const = { + beforeX: [], + afterX: [], + beforeY: [], + afterY: [] + }; + }); + + links.forEach(link => { + if (link.direction) { + switch (link.direction) { + case 'up': + case 'top': + nodes[link.from].const.beforeY.push(link.to); + nodes[link.to].const.afterY.push(link.from); + break; + case 'down': + case 'bottom': + nodes[link.from].const.afterY.push(link.to); + nodes[link.to].const.beforeY.push(link.from); + break; + case 'left': + nodes[link.from].const.beforeX.push(link.to); + nodes[link.to].const.afterX.push(link.from); + break; + case 'right': + nodes[link.from].const.afterX.push(link.to); + nodes[link.to].const.beforeX.push(link.from); + break; + } + } + }); + + nodes = self.applyLinks(nodes, links); + + if (nodes) { + self.correctPlacing(nodes); + + Object.values(nodes).forEach(node => { + delete node.const; + }); + } + + return nodes; + }, + + }; + return self; }; },{"./utils":41}],40:[function(require,module,exports){ -const convert = require('xml-js'); -const utils = require('./utils'); - -let resources = { - name: 'error', - height: 512, - index: [], - links: { - 'arrow-head': {}, - 'arrow-head-reverse': {}, - 'line-start': {}, - 'line-end': {}, - 'dashed-step': {} - }, - icons: {} -}; -try { - resources = require('../resources.json'); -} catch (err) { - console.error('fa-diagrams: SVG resources could not be loaded: ' + err); -} - -/** - * @typedef Node2 - * @property {string} name - * @property {number} x - * @property {number} y - * @property {string|{path:string,width:number:height:number}} icon - * @property {Object|undefined} bottom - * @property {Object|undefined} top - * @property {Object|undefined} left - * @property {Object|undefined} right - */ - -/** - * @typedef Link2 - * @property {string} from - * @property {string} to - * @property {string|undefined} type - * @property {Object|undefined} bottom - * @property {Object|undefined} top - */ - -const SUB_DEF = { - '_': 'string', - 'text': 'string', - 'icon': { - '_': 'string', - 'path': 'string', - 'width': 'number', - 'height': 'number' - }, - 'color': 'string', - 'font': 'string', - 'font-size': 'number', - 'font-style': 'string', - 'margin': 'number', - 'line-height': 'number', - 'scale': 'number' -}; - -const NODE_DEF = { - 'name': '!string', - 'icon': { - '_': 'string', - 'path': 'string', - 'width': 'number', - 'height': 'number' - }, - 'x': '!number', - 'y': '!number', - 'color': 'string', - 'scale': 'number', - 'top': SUB_DEF, - 'bottom': SUB_DEF, - 'left': SUB_DEF, - 'right': SUB_DEF -}; - -const LINK_DEF = { - 'from': '!string', - 'to': '!string', - 'type': 'string', - 'color': 'string', - 'scale': 'number', - 'size': 'number', - 'top': SUB_DEF, - 'bottom': SUB_DEF, -}; - -const DEFAULT_OPTIONS = { - 'beautify': false, - 'scale': 128, - 'h-spacing': 1.3, - 'color': 'black', - 'icons': { - 'scale': 1, - 'color': '' - }, - 'links': { - 'scale': 1, - 'color': '', - 'size': 0 - }, - 'texts': { - 'font': 'Arial', - 'font-size': 15, - 'font-style': 'normal', - 'color': '', - 'margin': 0.2, - 'line-height': 1.2 - } -}; - -const SUBSTITUTES = { - 'font-awesome': { - 'fas': 'solid', - 'far': 'regular', - 'fab': 'brands' - } -}; - -const DEFAULT_SCALE = 0.4; -const LINK_MARGIN = (1 - DEFAULT_SCALE) / 2; - -module.exports = (options) => { - - options = utils.merge(DEFAULT_OPTIONS, options); - - const self = { - - /** - * Find icon data from given name or data - * @param {string|{path: string, width: number, height: number}} icon - * @returns {null|{path: string, width: number, height: number}} - */ - getIcon: (icon) => { - if (!icon) - return null; - - if (typeof icon === 'object') { - if (!icon.path || !icon.path.trim()) - return null; - - icon.height = icon.height || icon.width || resources.height; - icon.width = icon.width || icon.height; - return icon; - } - - if (!icon.trim()) - return null; - - let search = utils.ezClone(resources.index); - const spl = icon.trim().split(' ').map(t => t.indexOf('fa-') === 0 ? t.substr(3) : t); - - for (let i = 0; i < spl.length; i++) { - //replace fas by regular for example - if (Object.keys(SUBSTITUTES[resources.name] || {}).includes(spl[i])) { - spl[i] = SUBSTITUTES[resources.name][spl[i]]; - } - if (resources.index.includes(spl[i])) { - search = [spl.splice(i, 1)]; - } - } - - icon = spl[0]; - - for (let i = 0; i < search.length; i++) { - if (resources.icons[search[i]] && resources.icons[search[i]][icon]) { - resources.icons[search[i]][icon].height = resources.height; - return resources.icons[search[i]][icon]; - } - } - - return null; - }, - - /** - * Create the correct path from the type and width - * @param {string} type - * @param {number} width - * @return {string|null} - */ - getLinkPath: (type, width) => { - const arrowHead = 'v46.059c0 21.382 25.851 32.09 40.971 16.971 l86.059 -86.059c9.373-9.373 9.373-24.569 0-33.941l-86.059-86.059c-15.119-15.119-40.971-4.411-40.971 16.971v46.059'; //134.059 - const arrowHeadR = 'v-46.059c0-21.382-25.851-32.09-40.971-16.971l-86.059 86.059c-9.373 9.373-9.373 24.568 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971v-46.059'; //134.059 - const lineEnd = 'c6.627 0 12 -5.373 12 -12v-56c0 -6.627 -5.373 -12 -12 -12'; // 12 - const lineStart = 'c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12'; // 12 - const dashedStep = `${lineStart}h56${lineEnd}`; // 80 - switch (type) { - case 'none': - return null; - default: - return `M12 216${lineStart}h${width * 512 - 146.059}${arrowHead}z`; - case 'line': - return `M12 216${lineStart}h${width * 512 - 24}${lineEnd}z`; - case 'double': - return `M134.059 216${arrowHeadR}h${width * 512 - 268.06}${arrowHead}z`; - case 'split-double': - return `M12 126${lineStart}h${width * 512 - 146.059}${arrowHead}M134.059 306${arrowHeadR}h${width * 512 - 146.059}${lineEnd}z`; - case 'dashed': - const n1 = Math.floor((width * 512 - 134.059) / (80 * 2.1)); - const space1 = ((width * 512 - 134.059) - n1 * 56 - 24) / (n1); - return `M12 216${new Array(n1).fill(`${dashedStep}m${space1} 0`).join('')}v80${arrowHead}z`; - case 'dashed-line': - const n2 = Math.floor(width * 512 / (80 * 2.1)); - const space2 = (width * 512 - n2 * 56 - 24) / (n2 - 1); - return `M12 216${new Array(n2).fill(dashedStep).join(`m${space2} 0`)}z`; - case 'dashed-double': - const n3 = Math.floor((width * 512 - 134.059 * 2) / (80 * 2.1)); - const space3 = ((width * 512 - 134.059 * 2) - n3 * 56 - 24) / (n3 + 1); - return `M134.059 216${arrowHeadR}m${space3}-80${new Array(n3).fill(`${dashedStep}m${space3} 0`).join('')}v80${arrowHead}z`; - case 'dashed-split-double': - const n4 = Math.floor((width * 512 - 134.059) / (80 * 2.1)); - const space4 = ((width * 512 - 134.059) - n4 * 56 - 24) / (n4); - return `M12 126${new Array(n4).fill(`${dashedStep}m${space4} 0`).join('')}v80${arrowHead}M134.059 306${arrowHeadR}m${space4} -80${new Array(n4).fill(`${dashedStep}`).join(`m${space4} 0`)}z`; - } - }, - - /** - * Get the width and height of the graph of nodes - * @param {Object} nodes - * @returns {{w: number, h: number}} - */ - getBounds: (nodes) => { - const list = Object.values(nodes); - if (list.length === 0) - return {w: 0, h: 0}; //empty - let maxX = 0; - let maxY = 0; - list.forEach(n => { - maxX = Math.max(n.x, maxX); - maxY = Math.max(n.y, maxY); - }); - return {w: maxX + 1, h: maxY + 1}; - }, - - /** - * @param {string} text - * @param {number} lineHeight - * @param {number} x - * @param {string} anchor - * @return {Object} - */ - getSvgText: (text, lineHeight, x, anchor) => { - text = text.trim(); - if (!text.includes('\n')) - return {'_text': text}; - const list = []; - text.split('\n').map(t => t.trim()).forEach((line, i) => { - list.push({ - '_attributes': { - 'x': x, - 'dy': i === 0 ? '0' : `${lineHeight}em`, - 'text-anchor': anchor - }, - '_text': line - }); - }); - return {'tspan': list}; - }, - - /** - * @param {Node2} node - */ - renderNode: (node) => { - const icon = self.getIcon(node.icon); - if (!icon) - return null; - const scale = (node['scale'] || options['icons']['scale']) * DEFAULT_SCALE; - const g = { - '_attributes': { - 'transform': `translate(${(node.x + 0.5) * options['h-spacing']} ${node.y + 0.5})`, - }, - 'g': [{ - '_attributes': { - 'transform': `scale(${scale / icon.height} ${scale / icon.height}) translate(${-icon.width / 2} ${-icon.height / 2})`, - 'stroke': (node['color'] || options['icons']['color'] || undefined), - 'fill': (node['color'] || options['icons']['color'] || undefined) - }, - 'path': { - '_attributes': { - 'd': icon.path, - } - } - }] - }; - - ['bottom', 'top', 'left', 'right'].forEach(side => { - const subE = node[side]; - if (subE && subE.text) { - const fontSize = subE['font-size'] || options['texts']['font-size']; - const margin = subE['margin'] || options['texts']['margin']; - let pos; - let anchor; - switch (side) { - case 'bottom': - pos = {x: 0, y: 1}; - anchor = 'middle'; - break; - case 'top': - pos = {x: 0, y: -1}; - anchor = 'middle'; - break; - case 'left': - pos = {x: -1, y: 0}; - anchor = 'end'; - break; - case 'right': - pos = {x: 1, y: 0}; - anchor = 'start'; - break; - } - - const lineHeight = subE['line-height'] || options['texts']['line-height']; - const text = self.getSvgText(subE.text, lineHeight, pos.x * fontSize / 2, anchor); - const textHeight = text['tspan'] ? text['tspan'].length - 1 : 0; - - text['_attributes'] = { - 'font-family': subE['font'] || options['texts']['font'], - 'font-size': fontSize, - 'text-anchor': anchor, - 'x': pos.x * fontSize / 2, - 'y': (pos.y + 0.25) * fontSize - (1 - pos.y) * textHeight * fontSize * lineHeight / 2 - }; - - g['g'].push({ - '_attributes': { - 'transform': `translate(${pos.x * margin} ${pos.y * margin}) scale(${1 / options['scale']} ${1 / options['scale']})`, - 'stroke': (subE['color'] || node['color'] || options['texts']['color'] || options['icons']['color'] || undefined), - 'fill': (subE['color'] || node['color'] || options['texts']['color'] || options['icons']['color'] || undefined) - }, - 'text': text - }); - } - }); - - return g; - }, - - /** - * @param {Object} nodes - * @param {Link2} link - */ - renderLink: (nodes, link) => { - const src = nodes[link.from]; - const dst = nodes[link.to]; - - const posX = ((src.x + dst.x) / 2 + 0.5) * options['h-spacing']; - const posY = (src.y + dst.y) / 2 + 0.5; - - const angle = Math.atan2(dst.y - src.y, (dst.x - src.x) * options['h-spacing']) * 180 / Math.PI; - const scale = (link['scale'] || options['links']['scale']) * DEFAULT_SCALE; - - let size = link['size'] || options['links']['size']; - - if (!size) { - let dx = Math.abs(dst.x - src.x) * options['h-spacing']; - if (dx > 0) - dx -= LINK_MARGIN * 2; - let dy = Math.abs(dst.y - src.y); - if (dy > 0) - dy -= LINK_MARGIN * 2; - - size = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)) / scale; - } - - const path = self.getLinkPath(link.type, size); - - if (!path) - return null; - - return { - '_attributes': { - 'transform': `translate(${posX} ${posY}) rotate(${angle})` - }, - 'g': { - '_attributes': { - 'transform': `scale(${scale / 512} ${scale / 512}) translate(${(-256 * size)} ${-256})`, - 'stroke': (link['color'] || options['links']['color'] || undefined), - 'fill': (link['color'] || options['links']['color'] || undefined) - }, - 'path': { - '_attributes': { - 'd': path - } - } - } - }; - }, - - /** - * Convert xml-js data into correct svg xml string - * @param {Object} data - * @param {{w:number, h:number}} bounds - * @returns {string} - */ - toXML: (data, bounds) => { - const xml = { - 'svg': { - '_attributes': { - 'xmlns': 'http://www.w3.org/2000/svg', - 'viewBox': `0 0 ${bounds.w * options['h-spacing']} ${bounds.h}`, - 'width': bounds.w * options['h-spacing'] * options['scale'] / DEFAULT_SCALE, - 'height': bounds.h * options['scale'] / DEFAULT_SCALE, - 'stroke': options['color'], - 'fill': options['color'] - } - } - }; - Object.keys(data).forEach(key => { - xml['svg'][key] = data[key]; - }); - return convert.js2xml(xml, { - compact: true, - spaces: options['beautify'] ? 4 : 0 - }).replace(/<\/tspan>(\s*)} nodes - * @param {Link2[]} links - */ - compute: (nodes, links) => { - - const data = {'g': []}; - - Object.keys(nodes).forEach(key => { - const res = utils.isValid(nodes[key], NODE_DEF); - if (res) - throw `Node '${key}' is invalid at key '${res}'`; - - ['bottom', 'top', 'left', 'right'].forEach(sub => { - if (typeof nodes[key][sub] === 'string') - nodes[key][sub] = {text: nodes[key][sub]}; - }); - - const group = self.renderNode(nodes[key]); - if (group) - data['g'].push(group); - }); - - links.forEach((link, i) => { - const res = utils.isValid(link, LINK_DEF); - if (res) - throw `Link ${i} (${link.from}->${link.to}) is invalid at key '${res}'`; - - ['bottom', 'top'].forEach(sub => { - if (typeof link[sub] === 'string') - link[sub] = {text: link[sub]}; - }); - - const group = self.renderLink(nodes, link); - if (group) - data['g'].push(group); - }); - - const bounds = self.getBounds(nodes); - - return self.toXML(data, bounds); - } - }; - - return self; +const convert = require('xml-js'); +const utils = require('./utils'); + +let resources = { + name: 'error', + height: 512, + index: [], + links: { + 'arrow-head': {}, + 'arrow-head-reverse': {}, + 'line-start': {}, + 'line-end': {}, + 'dashed-step': {} + }, + icons: {} +}; +try { + resources = require('../resources.json'); +} catch (err) { + console.error('fa-diagrams: SVG resources could not be loaded: ' + err); +} + + +/** + * @typedef SubElement2 + * @property {string|undefined} text + * @property {string|{path:string,width:number:height:number}|undefined} icon + * @property {string|undefined} color + * @property {string|undefined} font + * @property {string|undefined} font-size + * @property {string|undefined} font-style + * @property {number|undefined} margin + * @property {number|undefined} line-height + * @property {number|undefined} scale + */ +const SUB_DEF = { + '_': 'string', + 'text': 'string', + 'icon': { + '_': 'string', + 'path': 'string', + 'width': 'number', + 'height': 'number' + }, + 'color': 'string', + 'font': 'string', + 'font-size': 'number', + 'font-style': 'string', + 'margin': 'number', + 'line-height': 'number', + 'scale': 'number' +}; + +/** + * @typedef Node2 + * @property {string} name + * @property {number} x + * @property {number} y + * @property {string|{path:string,width:number:height:number}} icon + * @property {SubElement2|undefined} bottom + * @property {SubElement2|undefined} top + * @property {SubElement2|undefined} left + * @property {SubElement2|undefined} right + */ +const NODE_DEF = { + 'name': '!string', + 'icon': { + '_': 'string', + 'path': 'string', + 'width': 'number', + 'height': 'number' + }, + 'x': '!number', + 'y': '!number', + 'color': 'string', + 'scale': 'number', + 'top': SUB_DEF, + 'bottom': SUB_DEF, + 'left': SUB_DEF, + 'right': SUB_DEF +}; + +/** + * @typedef Link2 + * @property {string} from + * @property {string} to + * @property {string|undefined} type + * @property {SubElement2|undefined} bottom + * @property {SubElement2|undefined} top + * @property {SubElement2|undefined} left + * @property {SubElement2|undefined} right + */ +const LINK_DEF = { + 'from': '!string', + 'to': '!string', + 'type': 'string', + 'color': 'string', + 'scale': 'number', + 'size': 'number', + 'top': SUB_DEF, + 'bottom': SUB_DEF, +}; + +const DEFAULT_OPTIONS = { + 'beautify': false, + 'scale': 128, + 'h-spacing': 1.3, + 'color': 'black', + 'icons': { + 'scale': 1, + 'color': '' + }, + 'links': { + 'scale': 1, + 'color': '', + 'size': 0 + }, + 'texts': { + 'font': 'Arial', + 'font-size': 15, + 'font-style': 'normal', + 'color': '', + 'margin': 0.2, + 'line-height': 1.2 + } +}; + +const SUBSTITUTES = { + 'font-awesome': { + 'fas': 'solid', + 'far': 'regular', + 'fab': 'brands' + } +}; + +const DEFAULT_SCALE = 0.4; +const LINK_MARGIN = (1 - DEFAULT_SCALE) / 2; + +module.exports = (options) => { + + options = utils.merge(DEFAULT_OPTIONS, options); + + const self = { + + /** + * Find icon data from given name or data + * @param {string|{path: string, width: number, height: number}} icon + * @returns {null|{path: string, width: number, height: number}} + */ + getIcon: (icon) => { + if (!icon) + return null; + + if (typeof icon === 'object') { + if (!icon.path || !icon.path.trim()) + return null; + + icon.height = icon.height || icon.width || resources.height; + icon.width = icon.width || icon.height; + return icon; + } + + if (!icon.trim()) + return null; + + let search = utils.ezClone(resources.index); + const spl = icon.trim().split(' ').map(t => t.indexOf('fa-') === 0 ? t.substr(3) : t); + + for (let i = 0; i < spl.length; i++) { + //replace fas by regular for example + if (Object.keys(SUBSTITUTES[resources.name] || {}).includes(spl[i])) { + spl[i] = SUBSTITUTES[resources.name][spl[i]]; + } + if (resources.index.includes(spl[i])) { + search = [spl.splice(i, 1)]; + } + } + + icon = spl[0]; + + for (let i = 0; i < search.length; i++) { + if (resources.icons[search[i]] && resources.icons[search[i]][icon]) { + resources.icons[search[i]][icon].height = resources.height; + return resources.icons[search[i]][icon]; + } + } + + return null; + }, + + /** + * Create the correct path from the type and width + * @param {string} type + * @param {number} width + * @return {string|null} + */ + getLinkPath: (type, width) => { + const arrowHead = 'v46.059c0 21.382 25.851 32.09 40.971 16.971 l86.059 -86.059c9.373-9.373 9.373-24.569 0-33.941l-86.059-86.059c-15.119-15.119-40.971-4.411-40.971 16.971v46.059'; //134.059 + const arrowHeadR = 'v-46.059c0-21.382-25.851-32.09-40.971-16.971l-86.059 86.059c-9.373 9.373-9.373 24.568 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971v-46.059'; //134.059 + const lineEnd = 'c6.627 0 12 -5.373 12 -12v-56c0 -6.627 -5.373 -12 -12 -12'; // 12 + const lineStart = 'c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12'; // 12 + const dashedStep = `${lineStart}h56${lineEnd}`; // 80 + switch (type) { + case 'none': + return null; + default: + return `M12 216${lineStart}h${width * 512 - 146.059}${arrowHead}z`; + case 'line': + return `M12 216${lineStart}h${width * 512 - 24}${lineEnd}z`; + case 'double': + return `M134.059 216${arrowHeadR}h${width * 512 - 268.06}${arrowHead}z`; + case 'split-double': + return `M12 126${lineStart}h${width * 512 - 146.059}${arrowHead}M134.059 306${arrowHeadR}h${width * 512 - 146.059}${lineEnd}z`; + case 'dashed': + const n1 = Math.floor((width * 512 - 134.059) / (80 * 2.1)); + const space1 = ((width * 512 - 134.059) - n1 * 56 - 24) / (n1); + return `M12 216${new Array(n1).fill(`${dashedStep}m${space1} 0`).join('')}v80${arrowHead}z`; + case 'dashed-line': + const n2 = Math.floor(width * 512 / (80 * 2.1)); + const space2 = (width * 512 - n2 * 56 - 24) / (n2 - 1); + return `M12 216${new Array(n2).fill(dashedStep).join(`m${space2} 0`)}z`; + case 'dashed-double': + const n3 = Math.floor((width * 512 - 134.059 * 2) / (80 * 2.1)); + const space3 = ((width * 512 - 134.059 * 2) - n3 * 56 - 24) / (n3 + 1); + return `M134.059 216${arrowHeadR}m${space3}-80${new Array(n3).fill(`${dashedStep}m${space3} 0`).join('')}v80${arrowHead}z`; + case 'dashed-split-double': + const n4 = Math.floor((width * 512 - 134.059) / (80 * 2.1)); + const space4 = ((width * 512 - 134.059) - n4 * 56 - 24) / (n4); + return `M12 126${new Array(n4).fill(`${dashedStep}m${space4} 0`).join('')}v80${arrowHead}M134.059 306${arrowHeadR}m${space4} -80${new Array(n4).fill(`${dashedStep}`).join(`m${space4} 0`)}z`; + } + }, + + /** + * Get the width and height of the graph of nodes + * @param {Object} nodes + * @returns {{w: number, h: number}} + */ + getBounds: (nodes) => { + const list = Object.values(nodes); + if (list.length === 0) + return {w: 0, h: 0}; //empty + let maxX = 0; + let maxY = 0; + list.forEach(n => { + maxX = Math.max(n.x, maxX); + maxY = Math.max(n.y, maxY); + }); + return {w: maxX + 1, h: maxY + 1}; + }, + + /** + * @param {string} text + * @param {number} lineHeight + * @param {number} x + * @param {string} anchor + * @return {Object} svg text + */ + getSvgText: (text, lineHeight, x, anchor) => { + text = text.trim(); + if (!text.includes('\n')) + return {'_text': text}; + const list = []; + text.split('\n').map(t => t.trim()).forEach((line, i) => { + list.push({ + '_attributes': { + 'x': x, + 'dy': i === 0 ? '0' : `${lineHeight}em`, + 'text-anchor': anchor + }, + '_text': line + }); + }); + return {'tspan': list}; + }, + + /** + * @param {Node2|Link2} element + * @param {string} side + * @param {SubElement2} subE + * @param {boolean?} reverse + * @param {boolean?} link + * @returns {Object} svg group + */ + renderSubText: (element, side, subE, reverse, link) => { + const fontSize = subE['font-size'] || options['texts']['font-size']; + const margin = (subE['margin'] || options['texts']['margin']) / (link ? 4 : 1); + let pos; + let anchor; + switch (side) { + case 'bottom': + pos = {x: 0, y: 1}; + anchor = 'middle'; + break; + case 'top': + pos = {x: 0, y: -1}; + anchor = 'middle'; + break; + case 'left': + pos = {x: -1, y: 0}; + anchor = 'end'; + break; + case 'right': + pos = {x: 1, y: 0}; + break; + } + + const lineHeight = subE['line-height'] || options['texts']['line-height']; + const text = self.getSvgText(subE.text, lineHeight, pos.x * fontSize / 2, anchor); + const textHeight = text['tspan'] ? text['tspan'].length - 1 : 0; + + text['_attributes'] = { + 'font-family': subE['font'], + 'font-size': subE['font-size'], + 'text-anchor': anchor, + 'x': pos.x * fontSize / 2, + 'y': (pos.y + 0.25) * fontSize - (1 - pos.y) * textHeight * fontSize * lineHeight / 2 + }; + + return { + '_attributes': { + 'transform': `${reverse?'rotate(180) ':''}translate(${pos.x * margin} ${pos.y * margin}) scale(${1 / options['scale']} ${1 / options['scale']})`, + 'fill': (subE['color'] || element['color'] || options['texts']['color'] || options[link ? 'links' : 'icons']['color'] || undefined), + }, + 'text': text + }; + }, + + /** + * @param {Node2} node + * @return {Object} svg group + */ + renderNode: (node) => { + const groups = []; + + const icon = self.getIcon(node.icon); + if (icon) { + const scale = (node['scale'] || options['icons']['scale']) * DEFAULT_SCALE; + groups.push({ + '_attributes': { + 'transform': `scale(${scale / icon.height} ${scale / icon.height}) translate(${-icon.width / 2} ${-icon.height / 2})`, + 'fill': (node['color'] || options['icons']['color'] || undefined) + }, + 'path': { + '_attributes': { + 'd': icon.path, + } + } + }); + } + + ['bottom', 'top', 'left', 'right'].forEach(side => { + const subE = node[side]; + if (subE && subE.text) + groups.push(self.renderSubText(node, side, subE)); + }); + + return !groups.length ? null : { + '_attributes': { + 'transform': `translate(${(node.x + 0.5) * options['h-spacing']} ${node.y + 0.5})`, + }, + 'g': groups + }; + }, + + /** + * @param {Object} nodes + * @param {Link2} link + * @return {Object} svg group + */ + renderLink: (nodes, link) => { + const src = nodes[link.from]; + const dst = nodes[link.to]; + + const posX = ((src.x + dst.x) / 2 + 0.5) * options['h-spacing']; + const posY = (src.y + dst.y) / 2 + 0.5; + + const angle = Math.atan2(dst.y - src.y, (dst.x - src.x) * options['h-spacing']) * 180 / Math.PI; + + console.log(angle); + + const groups = []; + + const scale = (link['scale'] || options['links']['scale']) * DEFAULT_SCALE; + let size = link['size'] || options['links']['size']; + + if (!size) { + let dx = Math.abs(dst.x - src.x) * options['h-spacing']; + if (dx > 0) + dx -= LINK_MARGIN * 2; + let dy = Math.abs(dst.y - src.y); + if (dy > 0) + dy -= LINK_MARGIN * 2; + + size = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)) / scale; + } + + const path = self.getLinkPath(link.type, size); + + if (path) { + groups.push({ + '_attributes': { + 'transform': `scale(${scale / 512} ${scale / 512}) translate(${(-256 * size)} ${-256})`, + 'fill': (link['color'] || options['links']['color'] || undefined) + }, + 'path': { + '_attributes': { + 'd': path + } + } + }); + } + + const reverse = Math.abs(angle) > 90; + if (!reverse) { + link.top = link.top || link.left; + link.bottom = link.bottom || link.right; + } else { + link.top = link.top || link.right; + link.bottom = link.bottom || link.left; + } + + ['bottom', 'top'].forEach(side => { + const subE = link[side]; + if (subE && subE.text) + groups.push(self.renderSubText(link, side, subE, reverse, true)); + }); + + + return !groups.length ? null : { + '_attributes': { + 'transform': `translate(${posX} ${posY}) rotate(${angle})` + }, + 'g': groups + }; + }, + + /** + * Convert xml-js data into correct svg xml string + * @param {Object} data + * @param {{w:number, h:number}} bounds + * @returns {string} SVG data + */ + toXML: (data, bounds) => { + const xml = { + 'svg': { + '_attributes': { + 'xmlns': 'http://www.w3.org/2000/svg', + 'viewBox': `0 0 ${bounds.w * options['h-spacing']} ${bounds.h}`, + 'width': bounds.w * options['h-spacing'] * options['scale'] / DEFAULT_SCALE, + 'height': bounds.h * options['scale'] / DEFAULT_SCALE, + 'font-family': options['texts']['font'], + 'font-size': options['texts']['font-size'], + 'fill': options['color'], + 'stroke-width': 0 + } + } + }; + Object.keys(data).forEach(key => { + xml['svg'][key] = data[key]; + }); + return convert.js2xml(xml, { + compact: true, + spaces: options['beautify'] ? 4 : 0 + }).replace(/<\/tspan>(\s*)} nodes + * @param {Link2[]} links + * @returns {string} SVG data + */ + compute: (nodes, links) => { + + const data = {'g': []}; + + links.forEach((link, i) => { + const res = utils.isValid(link, LINK_DEF); + if (res) + throw `Link ${i} (${link.from}->${link.to}) is invalid at key '${res}'`; + + ['bottom', 'top'].forEach(sub => { + if (typeof link[sub] === 'string') + link[sub] = {text: link[sub]}; + }); + + const group = self.renderLink(nodes, link); + if (group) + data['g'].push(group); + }); + + Object.keys(nodes).forEach(key => { + const res = utils.isValid(nodes[key], NODE_DEF); + if (res) + throw `Node '${key}' is invalid at key '${res}'`; + + ['bottom', 'top', 'left', 'right'].forEach(sub => { + if (typeof nodes[key][sub] === 'string') + nodes[key][sub] = {text: nodes[key][sub]}; + }); + + const group = self.renderNode(nodes[key]); + if (group) + data['g'].push(group); + }); + + const bounds = self.getBounds(nodes); + + return self.toXML(data, bounds); + } + }; + + return self; }; },{"../resources.json":undefined,"./utils":41,"xml-js":32}],41:[function(require,module,exports){ -const self = { - /** - * Merge resources by reading object keys and keeping reference value only if it's type is different from the source - * @param ref - reference object/value - * @param src - source object/value - * @returns {*} - */ - merge: (ref, src) => { - if (typeof ref !== typeof src) { - return ref; - } else if (ref.length && !src.length) { - return ref; - } else if (ref.length && src.length) { - return src; - } else if (typeof ref === 'object') { - const out = {}; - Object.keys(ref).forEach((key) => out[key] = self.merge(ref[key], src[key])); - return out; - } else { - return src; - } - }, - - /** - * Verify if an object respect it's definition - * @param obj - * @param def - * @returns {null|string} - */ - isValid: (obj, def) => { - const keys = Object.keys(def).filter(k => k !== '_'); - let key; - let type; - for (let i = 0; i < keys.length; i++) { - key = keys[i]; - type = (typeof obj !== 'object' || obj[key] === undefined || obj[key] === null) ? null : typeof obj[key]; - if (type === 'object' && obj[key].length > 0) - type = 'array'; - if (typeof def[key] === 'object') { - if (type && type !== 'object' && type !== def[key]['_']) - return key; - const res = self.isValid(type ? obj[key] : undefined, def[key]); - if (res) - return key + '.' + res; - } else { - if (def[key][0] === '!') { - def[key] = def[key].substr(1); - if (!type) - return key; - } - if (type && type !== def[key]) - return key; - } - } - return null; - }, - - /** - * Clone any JS variable or object - * @param {*} arg - * @returns {any} - */ - ezClone: (arg) => JSON.parse(JSON.stringify(arg)), - - /** - * Create a new map of the defined bounds and filling - * @param {number} w - * @param {number} h - * @param {*} fill - * @returns {any[][]} - */ - newMap: (w, h, fill) => new Array(w).fill(0).map(() => new Array(h).fill(fill)) -}; - +const self = { + /** + * Merge resources by reading object keys and keeping reference value only if it's type is different from the source + * @param ref - reference object/value + * @param src - source object/value + * @returns {*} + */ + merge: (ref, src) => { + if (typeof ref !== typeof src) { + return ref; + } else if (ref.length && !src.length) { + return ref; + } else if (ref.length && src.length) { + return src; + } else if (typeof ref === 'object') { + const out = {}; + Object.keys(ref).forEach((key) => out[key] = self.merge(ref[key], src[key])); + return out; + } else { + return src; + } + }, + + /** + * Verify if an object respect it's definition + * @param obj + * @param def + * @returns {null|string} + */ + isValid: (obj, def) => { + const keys = Object.keys(def).filter(k => k !== '_'); + let key; + let type; + for (let i = 0; i < keys.length; i++) { + key = keys[i]; + type = (typeof obj !== 'object' || obj[key] === undefined || obj[key] === null) ? null : typeof obj[key]; + if (type === 'object' && obj[key].length > 0) + type = 'array'; + if (typeof def[key] === 'object') { + if (type && type !== 'object' && type !== def[key]['_']) + return key; + const res = self.isValid(type ? obj[key] : undefined, def[key]); + if (res) + return key + '.' + res; + } else { + if (def[key][0] === '!') { + def[key] = def[key].substr(1); + if (!type) + return key; + } + if (type && type !== def[key]) + return key; + } + } + return null; + }, + + /** + * Clone any JS variable or object + * @param {*} arg + * @returns {any} + */ + ezClone: (arg) => JSON.parse(JSON.stringify(arg)), + + /** + * Create a new map of the defined bounds and filling + * @param {number} w + * @param {number} h + * @param {*} fill + * @returns {any[][]} + */ + newMap: (w, h, fill) => new Array(w).fill(0).map(() => new Array(h).fill(fill)) +}; + module.exports = self; },{}]},{},[38]); diff --git a/dist/fa-diagrams.min.js b/dist/fa-diagrams.min.js index 74b4fde..60af52f 100644 --- a/dist/fa-diagrams.min.js +++ b/dist/fa-diagrams.min.js @@ -1 +1 @@ -!function(){return function t(e,r,n){function i(o,a){if(!r[o]){if(!e[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){return i(e[o][1][t]||t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o0?n-4:n,f=0;f>16&255,a[u++]=e>>8&255,a[u++]=255&e;2===o&&(e=i[t.charCodeAt(f)]<<2|i[t.charCodeAt(f+1)]>>4,a[u++]=255&e);1===o&&(e=i[t.charCodeAt(f)]<<10|i[t.charCodeAt(f+1)]<<4|i[t.charCodeAt(f+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e);return a},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,s=[],o=0,a=r-i;oa?a:o+16383));1===i?(e=t[r-1],s.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],s.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return s.join("")};for(var n=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,s,o=[],a=e;a>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(t,e,r){},{}],3:[function(t,e,r){(function(e){"use strict";var n=t("base64-js"),i=t("ieee754");r.Buffer=e,r.SlowBuffer=function(t){+t!=t&&(t=0);return e.alloc(+t)},r.INSPECT_MAX_BYTES=50;var s=2147483647;function o(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=e.prototype,r}function e(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return a(t,e,r)}function a(t,r,n){if("string"==typeof t)return function(t,r){"string"==typeof r&&""!==r||(r="utf8");if(!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|h(t,r),i=o(n),s=i.write(t,r);s!==n&&(i=i.slice(0,s));return i}(t,r);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(P(t,ArrayBuffer)||t&&P(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function h(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||P(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var s=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return B(t).length;default:if(s)return i?-1:j(t).length;r=(""+r).toLowerCase(),s=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,r,n,i,s){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),U(n=+n)&&(n=s?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(s)return-1;n=t.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof r&&(r=e.from(r,i)),e.isBuffer(r))return 0===r.length?-1:g(t,r,n,i,s);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):g(t,[r],n,i,s);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,i){var s,o=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,a/=2,u/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var c=-1;for(s=r;sa&&(r=a-u),s=r;s>=0;s--){for(var f=!0,h=0;hi&&(n=i):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>8,i=r%256,s.push(i),s.push(n);return s}(e,t.length-r),t,r,n)}function _(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:l>223?3:l>191?2:1;if(i+f<=r)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)>127&&(c=u);break;case 3:s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(u=(15&l)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return A(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return _(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},e.prototype.toLocaleString=e.prototype.toString,e.prototype.equals=function(t){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===e.compare(this,t)},e.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},e.prototype.compare=function(t,r,n,i,s){if(P(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===s&&(s=this.length),r<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),c=t.slice(r,n),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return y(this,t,e,r);case"ascii":return b(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function A(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function F(t,r,n,i,s,o){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>s||rt.length)throw new RangeError("Index out of range")}function I(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function O(t,e,r,n,s){return e=+e,r>>>=0,s||I(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,s){return e=+e,r>>>=0,s||I(t,0,r,8),i.write(t,e,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;t=~~t,r=void 0===r?n:~~r,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),r<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,e>>>=0,r||k(t,e,this.length);for(var n=this[t],i=1,s=0;++s>>=0,e>>>=0,r||k(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},e.prototype.readUInt8=function(t,e){return t>>>=0,e||k(t,1,this.length),this[t]},e.prototype.readUInt16LE=function(t,e){return t>>>=0,e||k(t,2,this.length),this[t]|this[t+1]<<8},e.prototype.readUInt16BE=function(t,e){return t>>>=0,e||k(t,2,this.length),this[t]<<8|this[t+1]},e.prototype.readUInt32LE=function(t,e){return t>>>=0,e||k(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},e.prototype.readUInt32BE=function(t,e){return t>>>=0,e||k(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},e.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||k(t,e,this.length);for(var n=this[t],i=1,s=0;++s=(i*=128)&&(n-=Math.pow(2,8*e)),n},e.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||k(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*e)),s},e.prototype.readInt8=function(t,e){return t>>>=0,e||k(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},e.prototype.readInt16LE=function(t,e){t>>>=0,e||k(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(t,e){t>>>=0,e||k(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(t,e){return t>>>=0,e||k(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},e.prototype.readInt32BE=function(t,e){return t>>>=0,e||k(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},e.prototype.readFloatLE=function(t,e){return t>>>=0,e||k(t,4,this.length),i.read(this,t,!0,23,4)},e.prototype.readFloatBE=function(t,e){return t>>>=0,e||k(t,4,this.length),i.read(this,t,!1,23,4)},e.prototype.readDoubleLE=function(t,e){return t>>>=0,e||k(t,8,this.length),i.read(this,t,!0,52,8)},e.prototype.readDoubleBE=function(t,e){return t>>>=0,e||k(t,8,this.length),i.read(this,t,!1,52,8)},e.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||F(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,n)||F(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},e.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,255,0),this[e]=255&t,e+1},e.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},e.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},e.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},e.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},e.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},e.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeFloatLE=function(t,e,r){return O(this,t,e,!0,r)},e.prototype.writeFloatBE=function(t,e,r){return O(this,t,e,!1,r)},e.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},e.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},e.prototype.copy=function(t,r,n,i){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,i),r);return s},e.prototype.fill=function(t,r,n,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!e.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var s=t.charCodeAt(0);("utf8"===i&&s<128||"latin1"===i)&&(t=s)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function B(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function R(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function P(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function U(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:6}],4:[function(t,e,r){(function(t){function e(t){return Object.prototype.toString.call(t)}r.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},r.isBoolean=function(t){return"boolean"==typeof t},r.isNull=function(t){return null===t},r.isNullOrUndefined=function(t){return null==t},r.isNumber=function(t){return"number"==typeof t},r.isString=function(t){return"string"==typeof t},r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=function(t){return void 0===t},r.isRegExp=function(t){return"[object RegExp]"===e(t)},r.isObject=function(t){return"object"==typeof t&&null!==t},r.isDate=function(t){return"[object Date]"===e(t)},r.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},r.isFunction=function(t){return"function"==typeof t},r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t.isBuffer}).call(this,{isBuffer:t("../../is-buffer/index.js")})},{"../../is-buffer/index.js":8}],5:[function(t,e,r){var n=Object.create||function(t){var e=function(){};return e.prototype=t,new e},i=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return r},s=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}e.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var a,u=10;try{var l={};Object.defineProperty&&Object.defineProperty(l,"x",{value:0}),a=0===l.x}catch(t){a=!1}function c(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function f(t,e,r,i){var s,o,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),a=o[e]):(o=t._events=n(null),t._eventsCount=0),a){if("function"==typeof a?a=o[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),!a.warned&&(s=c(t))&&s>0&&a.length>s){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else a=o[e]=r,++t._eventsCount;return t}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e1&&(e=arguments[1]),e instanceof Error)throw e;var u=new Error('Unhandled "error" event. ('+e+")");throw u.context=e,u}if(!(r=o[t]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var n=t.length,i=m(t,n),s=0;s=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,s=o;break}if(s<0)return this;0===s?r.shift():function(t,e){for(var r=e,n=r+1,i=t.length;n=0;s--)this.removeListener(t,e[s]);return this},o.prototype.listeners=function(t){return d(this,t,!0)},o.prototype.rawListeners=function(t){return d(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},o.prototype.listenerCount=g,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],6:[function(t,e,r){r.read=function(t,e,r,n,i){var s,o,a=8*i-n-1,u=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,p=t[e+f];for(f+=h,s=p&(1<<-c)-1,p>>=-c,c+=a;c>0;s=256*s+t[e+f],f+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===s)s=1-l;else{if(s===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),s-=l}return(p?-1:1)*o*Math.pow(2,s-n)},r.write=function(t,e,r,n,i,s){var o,a,u,l=8*s-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=c?(a=0,o=c):o+f>=1?(a=(e*u-1)*Math.pow(2,i),o+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,l-=8);t[r+p-d]|=128*g}},{}],7:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}],8:[function(t,e,r){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],9:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],10:[function(t,e,r){(function(t){"use strict";void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,r)});case 3:return t.nextTick(function(){e.call(null,r,n)});case 4:return t.nextTick(function(){e.call(null,r,n,i)});default:for(s=new Array(a-1),o=0;o1)for(var r=1;r0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===l.prototype||(e=function(t){return l.from(t)}(e)),n?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):E(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?E(t,o,e,!1):N(t,o)):E(t,o,e,!1))):n||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=_?t=_:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function T(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(p("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(A,t):A(t))}function A(t){p("emit readable"),t.emit("readable"),F(t)}function N(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(S,t,e))}function S(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;ts.length?s.length:t;if(o===s.length?i+=s:i+=s.slice(0,t),0===(t-=o)){o===s.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=l.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var s=n.data,o=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,o),0===(t-=o)){o===s.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=s.slice(o));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function O(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(L,e,t))}function L(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function M(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return p("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?O(this):T(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&O(this),null;var n,i=e.needReadable;return p("need readable",i),(0===e.length||e.length-t0?I(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&O(this)),null!==n&&this.emit("data",n),n},w.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(t,e){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,p("pipe count=%d opts=%j",s.pipesCount,e);var u=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?c:w;function l(e,r){p("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),t.removeListener("close",y),t.removeListener("finish",b),t.removeListener("drain",f),t.removeListener("error",m),t.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",g),h=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function c(){p("onend"),t.end()}s.endEmitted?i.nextTick(u):n.once("end",u),t.on("unpipe",l);var f=function(t){return function(){var e=t._readableState;p("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,F(t))}}(n);t.on("drain",f);var h=!1;var d=!1;function g(e){p("ondata"),d=!1,!1!==t.write(e)||d||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==M(s.pipes,t))&&!h&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function m(e){p("onerror",e),w(),t.removeListener("error",m),0===a(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",b),w()}function b(){p("onfinish"),t.removeListener("close",y),w()}function w(){p("unpipe"),n.unpipe(t)}return n.on("data",g),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",m),t.once("close",y),t.once("finish",b),t.emit("pipe",n),s.flowing||(p("pipe resume"),n.resume()),t},w.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s-1?i:s.nextTick;b.WritableState=y;var l=t("core-util-is");l.inherits=t("inherits");var c={deprecate:t("util-deprecate")},f=t("./internal/streams/stream"),h=t("safe-buffer").Buffer,p=n.Uint8Array||function(){};var d,g=t("./internal/streams/destroy");function m(){}function y(e,r){a=a||t("./_stream_duplex"),e=e||{};var n=r instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,l=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(s.nextTick(i,n),s.nextTick(T,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),T(t,e))}(t,r,n,e,i);else{var o=_(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||E(t,r),n?u(v,t,r,o,i):v(t,r,o,i)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function b(e){if(a=a||t("./_stream_duplex"),!(d.call(b,this)||this instanceof a))return new b(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function v(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),T(t,e)}function E(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),s=e.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,w(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,f=r.callback;if(w(t,e,!1,e.objectMode?1:l.length,l,c,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function _(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),T(t,e)})}function T(t,e){var r=_(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,s.nextTick(x,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}l.inherits(b,f),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(t){return!!d.call(this,t)||this===b&&(t&&t._writableState instanceof y)}})):d=function(t){return t instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(t,e,r){var n,i=this._writableState,o=!1,a=!i.objectMode&&(n=t,h.isBuffer(n)||n instanceof p);return a&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=m),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),s.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var i=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),s.nextTick(n,o),i=!1),i}(this,i,t,r))&&(i.pendingcb++,o=function(t,e,r,n,i,s){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,r));return e}(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,T(t,e),r&&(e.finished?s.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),b.prototype.destroy=g.destroy,b.prototype._undestroy=g.undestroy,b.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{"./_stream_duplex":13,"./internal/streams/destroy":19,"./internal/streams/stream":20,_process:11,"core-util-is":4,inherits:7,"process-nextick-args":10,"safe-buffer":25,timers:29,"util-deprecate":30}],18:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("util");e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,s=n.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=s,i=a,e.copy(r,i),a+=o.data.length,o=o.next;return s},t}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},{"safe-buffer":25,util:2}],19:[function(t,e,r){"use strict";var n=t("process-nextick-args");function i(t,e){t.emit("error",e)}e.exports={destroy:function(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(n.nextTick(i,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":10}],20:[function(t,e,r){e.exports=t("events").EventEmitter},{events:5}],21:[function(t,e,r){e.exports=t("./readable").PassThrough},{"./readable":22}],22:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":13,"./lib/_stream_passthrough.js":14,"./lib/_stream_readable.js":15,"./lib/_stream_transform.js":16,"./lib/_stream_writable.js":17}],23:[function(t,e,r){e.exports=t("./readable").Transform},{"./readable":22}],24:[function(t,e,r){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":17}],25:[function(t,e,r){var n=t("buffer"),i=n.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,r),r.Buffer=o),s(i,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:3}],26:[function(t,e,r){(function(e){!function(r){r.parser=function(t,e){return new s(t,e)},r.SAXParser=s,r.SAXStream=a,r.createStream=function(t,e){return new a(t,e)},r.MAX_BUFFER_LENGTH=65536;var n,i=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function s(t,e){if(!(this instanceof s))return new s(t,e);!function(t){for(var e=0,r=i.length;e"===n?(C(this,"onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=A.TEXT):b(n)?(this.state=A.SGML_DECL_QUOTED,this.sgmlDecl+=n):this.sgmlDecl+=n;continue;case A.SGML_DECL_QUOTED:n===this.q&&(this.state=A.SGML_DECL,this.q=""),this.sgmlDecl+=n;continue;case A.DOCTYPE:">"===n?(this.state=A.TEXT,C(this,"ondoctype",this.doctype),this.doctype=!0):(this.doctype+=n,"["===n?this.state=A.DOCTYPE_DTD:b(n)&&(this.state=A.DOCTYPE_QUOTED,this.q=n));continue;case A.DOCTYPE_QUOTED:this.doctype+=n,n===this.q&&(this.q="",this.state=A.DOCTYPE);continue;case A.DOCTYPE_DTD:this.doctype+=n,"]"===n?this.state=A.DOCTYPE:b(n)&&(this.state=A.DOCTYPE_DTD_QUOTED,this.q=n);continue;case A.DOCTYPE_DTD_QUOTED:this.doctype+=n,n===this.q&&(this.state=A.DOCTYPE_DTD,this.q="");continue;case A.COMMENT:"-"===n?this.state=A.COMMENT_ENDING:this.comment+=n;continue;case A.COMMENT_ENDING:"-"===n?(this.state=A.COMMENT_ENDED,this.comment=F(this.opt,this.comment),this.comment&&C(this,"oncomment",this.comment),this.comment=""):(this.comment+="-"+n,this.state=A.COMMENT);continue;case A.COMMENT_ENDED:">"!==n?(L(this,"Malformed comment"),this.comment+="--"+n,this.state=A.COMMENT):this.state=A.TEXT;continue;case A.CDATA:"]"===n?this.state=A.CDATA_ENDING:this.cdata+=n;continue;case A.CDATA_ENDING:"]"===n?this.state=A.CDATA_ENDING_2:(this.cdata+="]"+n,this.state=A.CDATA);continue;case A.CDATA_ENDING_2:">"===n?(this.cdata&&C(this,"oncdata",this.cdata),C(this,"onclosecdata"),this.cdata="",this.state=A.TEXT):"]"===n?this.cdata+="]":(this.cdata+="]]"+n,this.state=A.CDATA);continue;case A.PROC_INST:"?"===n?this.state=A.PROC_INST_ENDING:y(n)?this.state=A.PROC_INST_BODY:this.procInstName+=n;continue;case A.PROC_INST_BODY:if(!this.procInstBody&&y(n))continue;"?"===n?this.state=A.PROC_INST_ENDING:this.procInstBody+=n;continue;case A.PROC_INST_ENDING:">"===n?(C(this,"onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=A.TEXT):(this.procInstBody+="?"+n,this.state=A.PROC_INST_BODY);continue;case A.OPEN_TAG:v(d,n)?this.tagName+=n:(M(this),">"===n?B(this):"/"===n?this.state=A.OPEN_TAG_SLASH:(y(n)||L(this,"Invalid character in tag name"),this.state=A.ATTRIB));continue;case A.OPEN_TAG_SLASH:">"===n?(B(this,!0),R(this)):(L(this,"Forward-slash in opening tag not followed by >"),this.state=A.ATTRIB);continue;case A.ATTRIB:if(y(n))continue;">"===n?B(this):"/"===n?this.state=A.OPEN_TAG_SLASH:v(p,n)?(this.attribName=n,this.attribValue="",this.state=A.ATTRIB_NAME):L(this,"Invalid attribute name");continue;case A.ATTRIB_NAME:"="===n?this.state=A.ATTRIB_VALUE:">"===n?(L(this,"Attribute without value"),this.attribValue=this.attribName,j(this),B(this)):y(n)?this.state=A.ATTRIB_NAME_SAW_WHITE:v(d,n)?this.attribName+=n:L(this,"Invalid attribute name");continue;case A.ATTRIB_NAME_SAW_WHITE:if("="===n)this.state=A.ATTRIB_VALUE;else{if(y(n))continue;L(this,"Attribute without value"),this.tag.attributes[this.attribName]="",this.attribValue="",C(this,"onattribute",{name:this.attribName,value:""}),this.attribName="",">"===n?B(this):v(p,n)?(this.attribName=n,this.state=A.ATTRIB_NAME):(L(this,"Invalid attribute name"),this.state=A.ATTRIB)}continue;case A.ATTRIB_VALUE:if(y(n))continue;b(n)?(this.q=n,this.state=A.ATTRIB_VALUE_QUOTED):(L(this,"Unquoted attribute value"),this.state=A.ATTRIB_VALUE_UNQUOTED,this.attribValue=n);continue;case A.ATTRIB_VALUE_QUOTED:if(n!==this.q){"&"===n?this.state=A.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=n;continue}j(this),this.q="",this.state=A.ATTRIB_VALUE_CLOSED;continue;case A.ATTRIB_VALUE_CLOSED:y(n)?this.state=A.ATTRIB:">"===n?B(this):"/"===n?this.state=A.OPEN_TAG_SLASH:v(p,n)?(L(this,"No whitespace between attributes"),this.attribName=n,this.attribValue="",this.state=A.ATTRIB_NAME):L(this,"Invalid attribute name");continue;case A.ATTRIB_VALUE_UNQUOTED:if(!w(n)){"&"===n?this.state=A.ATTRIB_VALUE_ENTITY_U:this.attribValue+=n;continue}j(this),">"===n?B(this):this.state=A.ATTRIB;continue;case A.CLOSE_TAG:if(this.tagName)">"===n?R(this):v(d,n)?this.tagName+=n:this.script?(this.script+=""===n?R(this):L(this,"Invalid characters in closing tag");continue;case A.TEXT_ENTITY:case A.ATTRIB_VALUE_ENTITY_Q:case A.ATTRIB_VALUE_ENTITY_U:var a,c;switch(this.state){case A.TEXT_ENTITY:a=A.TEXT,c="textNode";break;case A.ATTRIB_VALUE_ENTITY_Q:a=A.ATTRIB_VALUE_QUOTED,c="attribValue";break;case A.ATTRIB_VALUE_ENTITY_U:a=A.ATTRIB_VALUE_UNQUOTED,c="attribValue"}";"===n?(this[c]+=P(this),this.entity="",this.state=a):v(this.entity.length?m:g,n)?this.entity+=n:(L(this,"Invalid character in entity name"),this[c]+="&"+this.entity+n,this.entity="",this.state=a);continue;default:throw new Error(this,"Unknown state: "+this.state)}this.position>=this.bufferCheckPosition&&function(t){for(var e=Math.max(r.MAX_BUFFER_LENGTH,10),n=0,s=0,o=i.length;se)switch(i[s]){case"textNode":k(t);break;case"cdata":C(t,"oncdata",t.cdata),t.cdata="";break;case"script":C(t,"onscript",t.script),t.script="";break;default:I(t,"Max buffer length exceeded: "+i[s])}n=Math.max(n,a)}var u=r.MAX_BUFFER_LENGTH-n;t.bufferCheckPosition=u+t.position}(this);return this},resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var t;k(t=this),""!==t.cdata&&(C(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(C(t,"onscript",t.script),t.script="")}};try{n=t("stream").Stream}catch(t){n=function(){}}var o=r.EVENTS.filter(function(t){return"error"!==t&&"end"!==t});function a(t,e){if(!(this instanceof a))return new a(t,e);n.apply(this),this._parser=new s(t,e),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(t){r.emit("error",t),r._parser.error=null},this._decoder=null,o.forEach(function(t){Object.defineProperty(r,"on"+t,{get:function(){return r._parser["on"+t]},set:function(e){if(!e)return r.removeAllListeners(t),r._parser["on"+t]=e,e;r.on(t,e)},enumerable:!0,configurable:!1})})}a.prototype=Object.create(n.prototype,{constructor:{value:a}}),a.prototype.write=function(r){if("function"==typeof e&&"function"==typeof e.isBuffer&&e.isBuffer(r)){if(!this._decoder){var n=t("string_decoder").StringDecoder;this._decoder=new n("utf8")}r=this._decoder.write(r)}return this._parser.write(r.toString()),this.emit("data",r),!0},a.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},a.prototype.on=function(t,e){var r=this;return r._parser["on"+t]||-1===o.indexOf(t)||(r._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),r.emit.apply(r,e)}),n.prototype.on.call(r,t,e)};var u="[CDATA[",l="DOCTYPE",c="http://www.w3.org/XML/1998/namespace",f="http://www.w3.org/2000/xmlns/",h={xml:c,xmlns:f},p=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,d=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,g=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,m=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function y(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function b(t){return'"'===t||"'"===t}function w(t){return">"===t||y(t)}function v(t,e){return t.test(e)}function E(t,e){return!v(t,e)}var _,x,T,A=0;for(var N in r.STATE={BEGIN:A++,BEGIN_WHITESPACE:A++,TEXT:A++,TEXT_ENTITY:A++,OPEN_WAKA:A++,SGML_DECL:A++,SGML_DECL_QUOTED:A++,DOCTYPE:A++,DOCTYPE_QUOTED:A++,DOCTYPE_DTD:A++,DOCTYPE_DTD_QUOTED:A++,COMMENT_STARTING:A++,COMMENT:A++,COMMENT_ENDING:A++,COMMENT_ENDED:A++,CDATA:A++,CDATA_ENDING:A++,CDATA_ENDING_2:A++,PROC_INST:A++,PROC_INST_BODY:A++,PROC_INST_ENDING:A++,OPEN_TAG:A++,OPEN_TAG_SLASH:A++,ATTRIB:A++,ATTRIB_NAME:A++,ATTRIB_NAME_SAW_WHITE:A++,ATTRIB_VALUE:A++,ATTRIB_VALUE_QUOTED:A++,ATTRIB_VALUE_CLOSED:A++,ATTRIB_VALUE_UNQUOTED:A++,ATTRIB_VALUE_ENTITY_Q:A++,ATTRIB_VALUE_ENTITY_U:A++,CLOSE_TAG:A++,CLOSE_TAG_SAW_WHITE:A++,SCRIPT:A++,SCRIPT_ENDING:A++},r.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},r.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(r.ENTITIES).forEach(function(t){var e=r.ENTITIES[t],n="number"==typeof e?String.fromCharCode(e):e;r.ENTITIES[t]=n}),r.STATE)r.STATE[r.STATE[N]]=N;function S(t,e,r){t[e]&&t[e](r)}function C(t,e,r){t.textNode&&k(t),S(t,e,r)}function k(t){t.textNode=F(t.opt,t.textNode),t.textNode&&S(t,"ontext",t.textNode),t.textNode=""}function F(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function I(t,e){return k(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,S(t,"onerror",e),t}function O(t){return t.sawRoot&&!t.closedRoot&&L(t,"Unclosed root tag"),t.state!==A.BEGIN&&t.state!==A.BEGIN_WHITESPACE&&t.state!==A.TEXT&&I(t,"Unexpected end"),k(t),t.c="",t.closed=!0,S(t,"onend"),s.call(t,t.strict,t.opt),t}function L(t,e){if("object"!=typeof t||!(t instanceof s))throw new Error("bad call to strictFail");t.strict&&I(t,e)}function M(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,r=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(r.ns=e.ns),t.attribList.length=0,C(t,"onopentagstart",r)}function D(t,e){var r=t.indexOf(":")<0?["",t]:t.split(":"),n=r[0],i=r[1];return e&&"xmlns"===t&&(n="xmlns",i=""),{prefix:n,local:i}}function j(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var e=D(t.attribName,!0),r=e.prefix,n=e.local;if("xmlns"===r)if("xml"===n&&t.attribValue!==c)L(t,"xml: prefix must be bound to "+c+"\nActual: "+t.attribValue);else if("xmlns"===n&&t.attribValue!==f)L(t,"xmlns: prefix must be bound to "+f+"\nActual: "+t.attribValue);else{var i=t.tag,s=t.tags[t.tags.length-1]||t;i.ns===s.ns&&(i.ns=Object.create(s.ns)),i.ns[n]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,C(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function B(t,e){if(t.opt.xmlns){var r=t.tag,n=D(t.tagName);r.prefix=n.prefix,r.local=n.local,r.uri=r.ns[n.prefix]||"",r.prefix&&!r.uri&&(L(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),r.uri=n.prefix);var i=t.tags[t.tags.length-1]||t;r.ns&&i.ns!==r.ns&&Object.keys(r.ns).forEach(function(e){C(t,"onopennamespace",{prefix:e,uri:r.ns[e]})});for(var s=0,o=t.attribList.length;s",t.tagName="",void(t.state=A.SCRIPT);C(t,"onscript",t.script),t.script=""}var e=t.tags.length,r=t.tagName;t.strict||(r=r[t.looseCase]());for(var n=r;e--;){if(t.tags[e].name===n)break;L(t,"Unexpected close tag")}if(e<0)return L(t,"Unmatched closing tag: "+t.tagName),t.textNode+="",void(t.state=A.TEXT);t.tagName=r;for(var i=t.tags.length;i-- >e;){var s=t.tag=t.tags.pop();t.tagName=t.tag.name,C(t,"onclosetag",t.tagName);var o={};for(var a in s.ns)o[a]=s.ns[a];var u=t.tags[t.tags.length-1]||t;t.opt.xmlns&&s.ns!==u.ns&&Object.keys(s.ns).forEach(function(e){var r=s.ns[e];C(t,"onclosenamespace",{prefix:e,uri:r})})}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=A.TEXT}function P(t){var e,r=t.entity,n=r.toLowerCase(),i="";return t.ENTITIES[r]?t.ENTITIES[r]:t.ENTITIES[n]?t.ENTITIES[n]:("#"===(r=n).charAt(0)&&("x"===r.charAt(1)?(r=r.slice(2),i=(e=parseInt(r,16)).toString(16)):(r=r.slice(1),i=(e=parseInt(r,10)).toString(10))),r=r.replace(/^0+/,""),isNaN(e)||i.toLowerCase()!==r?(L(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(e))}function U(t,e){"<"===e?(t.state=A.OPEN_WAKA,t.startTagPosition=t.position):y(e)||(L(t,"Non-whitespace before first tag."),t.textNode=e,t.state=A.TEXT)}function K(t,e){var r="";return e1114111||x(o)!==o)throw RangeError("Invalid code point: "+o);o<=65535?r.push(o):(t=55296+((o-=65536)>>10),e=o%1024+56320,r.push(t,e)),(n+1===i||r.length>16384)&&(s+=_.apply(null,r),r.length=0)}return s},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:T,configurable:!0,writable:!0}):String.fromCodePoint=T)}(void 0===r?this.sax={}:r)}).call(this,t("buffer").Buffer)},{buffer:3,stream:27,string_decoder:28}],27:[function(t,e,r){e.exports=i;var n=t("events").EventEmitter;function i(){n.call(this)}t("inherits")(i,n),i.Readable=t("readable-stream/readable.js"),i.Writable=t("readable-stream/writable.js"),i.Duplex=t("readable-stream/duplex.js"),i.Transform=t("readable-stream/transform.js"),i.PassThrough=t("readable-stream/passthrough.js"),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",s),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",u));var o=!1;function a(){o||(o=!0,t.end())}function u(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function l(t){if(c(),0===n.listenerCount(this,"error"))throw t}function c(){r.removeListener("data",i),t.removeListener("drain",s),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",l),t.removeListener("error",l),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",l),t.on("error",l),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},{events:5,inherits:7,"readable-stream/duplex.js":12,"readable-stream/passthrough.js":21,"readable-stream/readable.js":22,"readable-stream/transform.js":23,"readable-stream/writable.js":24}],28:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.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!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=l,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=c,this.end=f,e=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}r.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":25}],29:[function(t,e,r){(function(e,n){var i=t("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,a={},u=0;function l(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new l(s.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new l(s.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},r.setImmediate="function"==typeof e?e:function(t){var e=u++,n=!(arguments.length<2)&&o.call(arguments,1);return a[e]=!0,i(function(){a[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))}),e},r.clearImmediate="function"==typeof n?n:function(t){delete a[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":11,timers:29}],30:[function(t,e,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],31:[function(t,e,r){e.exports={isArray:function(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}}},{}],32:[function(t,e,r){var n=t("./xml2js"),i=t("./xml2json"),s=t("./js2xml"),o=t("./json2xml");e.exports={xml2js:n,xml2json:i,js2xml:s,json2xml:o}},{"./js2xml":33,"./json2xml":34,"./xml2js":36,"./xml2json":37}],33:[function(t,e,r){var n,i,s=t("./options-helper"),o=t("./array-helper").isArray;function a(t,e,r){return(!r&&t.spaces?"\n":"")+Array(e+1).join(t.spaces)}function u(t,e,r){if(e.ignoreAttributes)return"";"attributesFn"in e&&(t=e.attributesFn(t,i,n));var s,o,u,l,c=[];for(s in t)t.hasOwnProperty(s)&&null!==t[s]&&void 0!==t[s]&&(l=e.noQuotesForNativeAttributes&&"string"!=typeof t[s]?"":'"',o=(o=""+t[s]).replace(/"/g,"""),u="attributeNameFn"in e?e.attributeNameFn(s,o,i,n):s,c.push(e.spaces&&e.indentAttributes?a(e,r+1,!1):" "),c.push(u+"="+l+("attributeValueFn"in e?e.attributeValueFn(o,s,i,n):o)+l));return t&&Object.keys(t).length&&e.spaces&&e.indentAttributes&&c.push(a(e,r,!1)),c.join("")}function l(t,e,r){return n=t,i="xml",e.ignoreDeclaration?"":""}function c(t,e,r){if(e.ignoreInstruction)return"";var s;for(s in t)if(t.hasOwnProperty(s))break;var o="instructionNameFn"in e?e.instructionNameFn(s,t[s],i,n):s;if("object"==typeof t[s])return n=t,i=o,"";var a=t[s]?t[s]:"";return"instructionFn"in e&&(a=e.instructionFn(a,s,i,n)),""}function f(t,e){return e.ignoreComment?"":"\x3c!--"+("commentFn"in e?e.commentFn(t,i,n):t)+"--\x3e"}function h(t,e){return e.ignoreCdata?"":"","]]]]>"))+"]]>"}function p(t,e){return e.ignoreDoctype?"":""}function d(t,e){return e.ignoreText?"":(t=(t=(t=""+t).replace(/&/g,"&")).replace(/&/g,"&").replace(//g,">"),"textFn"in e?e.textFn(t,i,n):t)}function g(t,e,r,s){return t.reduce(function(t,o){var l=a(e,r,s&&!t);switch(o.type){case"element":return t+l+function(t,e,r){n=t,i=t.name;var s=[],o="elementNameFn"in e?e.elementNameFn(t.name,t):t.name;s.push("<"+o),t[e.attributesKey]&&s.push(u(t[e.attributesKey],e,r));var a=t[e.elementsKey]&&t[e.elementsKey].length||t[e.attributesKey]&&"preserve"===t[e.attributesKey]["xml:space"];return a||(a="fullTagEmptyElementFn"in e?e.fullTagEmptyElementFn(t.name,t):e.fullTagEmptyElement),a?(s.push(">"),t[e.elementsKey]&&t[e.elementsKey].length&&(s.push(g(t[e.elementsKey],e,r+1)),n=t,i=t.name),s.push(e.spaces&&function(t,e){var r;if(t.elements&&t.elements.length)for(r=0;r")):s.push("/>"),s.join("")}(o,e,r);case"comment":return t+l+f(o[e.commentKey],e);case"doctype":return t+l+p(o[e.doctypeKey],e);case"cdata":return t+(e.indentCdata?l:"")+h(o[e.cdataKey],e);case"text":return t+(e.indentText?l:"")+d(o[e.textKey],e);case"instruction":var m={};return m[o[e.nameKey]]=o[e.attributesKey]?o:o[e.instructionKey],t+(e.indentInstruction?l:"")+c(m,e,r)}},"")}function m(t,e,r){var n;for(n in t)if(t.hasOwnProperty(n))switch(n){case e.parentKey:case e.attributesKey:break;case e.textKey:if(e.indentText||r)return!0;break;case e.cdataKey:if(e.indentCdata||r)return!0;break;case e.instructionKey:if(e.indentInstruction||r)return!0;break;case e.doctypeKey:case e.commentKey:default:return!0}return!1}function y(t,e,r,s,o){n=t,i=e;var l="elementNameFn"in r?r.elementNameFn(e,t):e;if(void 0===t||null===t||""===t)return"fullTagEmptyElementFn"in r&&r.fullTagEmptyElementFn(e,t)||r.fullTagEmptyElement?"<"+l+">":"<"+l+"/>";var c=[];if(e){if(c.push("<"+l),"object"!=typeof t)return c.push(">"+d(t,r)+""),c.join("");t[r.attributesKey]&&c.push(u(t[r.attributesKey],r,s));var f=m(t,r,!0)||t[r.attributesKey]&&"preserve"===t[r.attributesKey]["xml:space"];if(f||(f="fullTagEmptyElementFn"in r?r.fullTagEmptyElementFn(e,t):r.fullTagEmptyElement),!f)return c.push("/>"),c.join("");c.push(">")}return c.push(b(t,r,s+1,!1)),n=t,i=e,e&&c.push((o?a(r,s,!1):"")+""),c.join("")}function b(t,e,r,n){var i,s,u,g=[];for(s in t)if(t.hasOwnProperty(s))for(u=o(t[s])?t[s]:[t[s]],i=0;i/g,">")),l("text",t))}function d(t){n.ignoreComment||(n.trim&&(t=t.trim()),l("comment",t))}function g(t){var e=i[n.parentKey];n.addParent||delete i[n.parentKey],i=e}function m(t){n.ignoreCdata||(n.trim&&(t=t.trim()),l("cdata",t))}function y(t){n.ignoreDoctype||(t=t.replace(/^ /,""),n.trim&&(t=t.trim()),l("doctype",t))}function b(t){t.note=t}e.exports=function(t,e){var r=s.parser(!0,{}),a={};if(i=a,n=function(t){return n=o.copyOptions(t),o.ensureFlagExists("ignoreDeclaration",n),o.ensureFlagExists("ignoreInstruction",n),o.ensureFlagExists("ignoreAttributes",n),o.ensureFlagExists("ignoreText",n),o.ensureFlagExists("ignoreComment",n),o.ensureFlagExists("ignoreCdata",n),o.ensureFlagExists("ignoreDoctype",n),o.ensureFlagExists("compact",n),o.ensureFlagExists("alwaysChildren",n),o.ensureFlagExists("addParent",n),o.ensureFlagExists("trim",n),o.ensureFlagExists("nativeType",n),o.ensureFlagExists("nativeTypeAttributes",n),o.ensureFlagExists("sanitize",n),o.ensureFlagExists("instructionHasAttributes",n),o.ensureFlagExists("captureSpacesBetweenElements",n),o.ensureAlwaysArrayExists(n),o.ensureKeyExists("declaration",n),o.ensureKeyExists("instruction",n),o.ensureKeyExists("attributes",n),o.ensureKeyExists("text",n),o.ensureKeyExists("comment",n),o.ensureKeyExists("cdata",n),o.ensureKeyExists("doctype",n),o.ensureKeyExists("type",n),o.ensureKeyExists("name",n),o.ensureKeyExists("elements",n),o.ensureKeyExists("parent",n),o.checkFnExists("doctype",n),o.checkFnExists("instruction",n),o.checkFnExists("cdata",n),o.checkFnExists("comment",n),o.checkFnExists("text",n),o.checkFnExists("instructionName",n),o.checkFnExists("elementName",n),o.checkFnExists("attributeName",n),o.checkFnExists("attributeValue",n),o.checkFnExists("attributes",n),n}(e),r.opt={strictEntities:!0},r.onopentag=h,r.ontext=p,r.oncomment=d,r.onclosetag=g,r.onerror=b,r.oncdata=m,r.ondoctype=y,r.onprocessinginstruction=f,r.write(t).close(),a[n.elementsKey]){var u=a[n.elementsKey];delete a[n.elementsKey],a[n.elementsKey]=u,delete a.text}return a}},{"./array-helper":31,"./options-helper":35,sax:26}],37:[function(t,e,r){var n=t("./options-helper"),i=t("./xml2js");e.exports=function(t,e){var r,s,o;return r=function(t){var e=n.copyOptions(t);return n.ensureSpacesExists(e),e}(e),s=i(t,r),o="compact"in r&&r.compact?"_parent":"parent",("addParent"in r&&r.addParent?JSON.stringify(s,function(t,e){return t===o?"_":e},r.spaces):JSON.stringify(s,null,r.spaces)).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}},{"./options-helper":35,"./xml2js":36}],38:[function(t,e,r){(function(r){const n=t("./placing"),i=t("./rendering"),s={compute:t=>{const e=t.options||{};let r={};(t.nodes||[]).filter(t=>"string"==typeof t.name).forEach(t=>r[t.name]=t);let s=(t.links||[]).filter(t=>t.from&&t.to);if(s.filter(t=>!r[t.from]).forEach(t=>console.warn(`unknown source node "${t.from}"`)),s.filter(t=>!r[t.to]).forEach(t=>console.warn(`unknown destination node "${t.to}"`)),s=s.filter(t=>r[t.from]&&r[t.to]),!(r=n(e.placing).compute(r,s)))throw"Failed to place nodes";return i(e.rendering).compute(r,s)}};e.exports=s,r.faDiagrams=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./placing":39,"./rendering":40}],39:[function(t,e,r){const n=t("./utils"),i={name:"!string",x:"number",y:"number"},s={from:"!string",to:"!string",direction:"string"},o={"max-link-length":3,diagonals:!0};e.exports=(t=>{t=n.merge(o,t);const e={getBounds:t=>{const e=Object.values(t).filter(t=>void 0!==t.x);if(0===e.length)return{x:0,y:0,w:0,h:0};let r=null,n=null,i=null,s=null;return e.forEach(t=>{r=null!==r?Math.min(t.x,r):t.x,n=null!==n?Math.min(t.y,n):t.y,i=null!==i?Math.max(t.x,i):t.x,s=null!==s?Math.max(t.y,s):t.y}),{x:r,y:n,w:i-r+1,h:s-n+1}},getNewPos:t=>{const r=e.getBounds(t),i=n.newMap(r.w,r.h,!1);Object.values(t).filter(t=>void 0!==t.x).forEach(t=>{i[t.x-r.x][t.y-r.y]=!0});for(let t=0;t{let n=t[e].x,i=t[e].y,s=t[r].x,o=t[r].y;const a=s-n,u=o-i,l=(t,n)=>i=>i.x===t&&i.y===n&&i.name!==e&&i.name!==r;if(Math.abs(a)>=Math.abs(u)){if(n>s){let t=n;n=s,s=t}for(let e=n;e<=s;e++){let r=Math.round(i+u*(e-n)/a);if(Object.values(t).find(l(e,r)))return!0}}else{if(i>o){let t=i;i=o,o=t}for(let e=i;e<=o;e++){let r=Math.round(n+a*(e-i)/u);if(Object.values(t).find(l(r,e)))return!0}}return!1},getPosition:(e,r,n)=>{const i=e[r],s={maxX:null,maxY:null,minX:null,minY:null,startX:null,startY:null,free:!0},o=(t,r,n,i)=>o=>{if(void 0!==e[o].x){const a=e[o].x,u=e[o].y;s.minX=null!==s.minX?Math.max(a+t,s.minX):a+t,s.maxX=null!==s.maxX?Math.min(a+r,s.maxX):a+r,s.minY=null!==s.minY?Math.max(u+n,s.minY):u+n,s.maxY=null!==s.maxY?Math.min(u+i,s.maxY):u+i,null===s.startX&&(s.startX=Math.abs(i+n)>0?a:1===Math.abs(t)?"minX":"maxX",s.startY=Math.abs(r+t)>0?u:1===Math.abs(n)?"minY":"maxY"),s.free=!1}},a=t["max-link-length"],u=n?a:0;return i.const.beforeX.forEach(o(1,1+a,-u,u)),i.const.beforeY.forEach(o(-u,u,1,1+a)),i.const.afterX.forEach(o(-1-a,-1,-u,u)),i.const.afterY.forEach(o(-u,u,-1-a,-1)),"string"==typeof s.startX&&(s.startX=s[s.startX]),"string"==typeof s.startY&&(s.startY=s[s.startY]),s.minX>s.maxX||s.minY>s.maxY?null:{x:s.startX,y:s.startY,free:s.free}},isValid:(r,n)=>{let i,s,o;const a=Object.values(r).filter(t=>void 0!==t.x);for(let t=0;tMath.pow(t["max-link-length"],2))return!1;switch(i.direction){case"up":case"top":if(o.y-s.y>=0)return!1;break;case"down":case"bottom":if(o.y-s.y<=0)return!1;break;case"left":if(o.x-s.x>=0)return!1;break;case"right":if(o.x-s.x<=0)return!1}if(!t.diagonals&&s.x!==o.x&&s.y!==o.y)return!1}return!0},correctPlacing:t=>{const r=e.getBounds(t);Object.values(t).forEach(t=>{t.x-=r.x,t.y-=r.y})},applyLinks:(r,i,s=0)=>{if(!e.isValid(r,i))return null;const o=Object.keys(r).filter(t=>void 0===r[t].x);if(0===o.length)return r;const a=[],u=(t,o,a)=>{const u=n.ezClone(r);return u[t].x=o,u[t].y=a,e.applyLinks(u,i,s+1)};let l,c,f;for(let n=0;n(Object.keys(t).forEach(e=>{const r=n.isValid(t[e],i);if(r)throw`Node '${e}' is invalid at key '${r}'`}),r.forEach((t,e)=>{const r=n.isValid(t,s);if(r)throw`Link ${e} (${t.from}->${t.to}) is invalid at key '${r}'`}),Object.values(t).forEach(t=>{t.const={beforeX:[],afterX:[],beforeY:[],afterY:[]}}),r.forEach(e=>{if(e.direction)switch(e.direction){case"up":case"top":t[e.from].const.beforeY.push(e.to),t[e.to].const.afterY.push(e.from);break;case"down":case"bottom":t[e.from].const.afterY.push(e.to),t[e.to].const.beforeY.push(e.from);break;case"left":t[e.from].const.beforeX.push(e.to),t[e.to].const.afterX.push(e.from);break;case"right":t[e.from].const.afterX.push(e.to),t[e.to].const.beforeX.push(e.from)}}),(t=e.applyLinks(t,r))&&(e.correctPlacing(t),Object.values(t).forEach(t=>{delete t.const})),t)};return e})},{"./utils":41}],40:[function(t,e,r){const n=t("xml-js"),i=t("./utils");let s={name:"error",height:512,index:[],links:{"arrow-head":{},"arrow-head-reverse":{},"line-start":{},"line-end":{},"dashed-step":{}},icons:{}};try{s=t("../resources.json")}catch(t){console.error("fa-diagrams: SVG resources could not be loaded: "+t)}const o={_:"string",text:"string",icon:{_:"string",path:"string",width:"number",height:"number"},color:"string",font:"string","font-size":"number","font-style":"string",margin:"number","line-height":"number",scale:"number"},a={name:"!string",icon:{_:"string",path:"string",width:"number",height:"number"},x:"!number",y:"!number",color:"string",scale:"number",top:o,bottom:o,left:o,right:o},u={from:"!string",to:"!string",type:"string",color:"string",scale:"number",size:"number",top:o,bottom:o},l={beautify:!1,scale:128,"h-spacing":1.3,color:"black",icons:{scale:1,color:""},links:{scale:1,color:"",size:0},texts:{font:"Arial","font-size":15,"font-style":"normal",color:"",margin:.2,"line-height":1.2}},c={"font-awesome":{fas:"solid",far:"regular",fab:"brands"}};e.exports=(t=>{t=i.merge(l,t);const e={getIcon:t=>{if(!t)return null;if("object"==typeof t)return t.path&&t.path.trim()?(t.height=t.height||t.width||s.height,t.width=t.width||t.height,t):null;if(!t.trim())return null;let e=i.ezClone(s.index);const r=t.trim().split(" ").map(t=>0===t.indexOf("fa-")?t.substr(3):t);for(let t=0;t{const r="v46.059c0 21.382 25.851 32.09 40.971 16.971 l86.059 -86.059c9.373-9.373 9.373-24.569 0-33.941l-86.059-86.059c-15.119-15.119-40.971-4.411-40.971 16.971v46.059",n="v-46.059c0-21.382-25.851-32.09-40.971-16.971l-86.059 86.059c-9.373 9.373-9.373 24.568 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971v-46.059",i="c6.627 0 12 -5.373 12 -12v-56c0 -6.627 -5.373 -12 -12 -12",s="c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12",o=`${s}h56${i}`;switch(t){case"none":return null;default:return`M12 216${s}h${512*e-146.059}${r}z`;case"line":return`M12 216${s}h${512*e-24}${i}z`;case"double":return`M134.059 216${n}h${512*e-268.06}${r}z`;case"split-double":return`M12 126${s}h${512*e-146.059}${r}M134.059 306${n}h${512*e-146.059}${i}z`;case"dashed":const a=Math.floor((512*e-134.059)/168),u=(512*e-134.059-56*a-24)/a;return`M12 216${new Array(a).fill(`${o}m${u} 0`).join("")}v80${r}z`;case"dashed-line":const l=Math.floor(512*e/168),c=(512*e-56*l-24)/(l-1);return`M12 216${new Array(l).fill(o).join(`m${c} 0`)}z`;case"dashed-double":const f=Math.floor((512*e-268.118)/168),h=(512*e-268.118-56*f-24)/(f+1);return`M134.059 216${n}m${h}-80${new Array(f).fill(`${o}m${h} 0`).join("")}v80${r}z`;case"dashed-split-double":const p=Math.floor((512*e-134.059)/168),d=(512*e-134.059-56*p-24)/p;return`M12 126${new Array(p).fill(`${o}m${d} 0`).join("")}v80${r}M134.059 306${n}m${d} -80${new Array(p).fill(`${o}`).join(`m${d} 0`)}z`}},getBounds:t=>{const e=Object.values(t);if(0===e.length)return{w:0,h:0};let r=0,n=0;return e.forEach(t=>{r=Math.max(t.x,r),n=Math.max(t.y,n)}),{w:r+1,h:n+1}},getSvgText:(t,e,r,n)=>{if(!(t=t.trim()).includes("\n"))return{_text:t};const i=[];return t.split("\n").map(t=>t.trim()).forEach((t,s)=>{i.push({_attributes:{x:r,dy:0===s?"0":`${e}em`,"text-anchor":n},_text:t})}),{tspan:i}},renderNode:r=>{const n=e.getIcon(r.icon);if(!n)return null;const i=.4*(r.scale||t.icons.scale),s={_attributes:{transform:`translate(${(r.x+.5)*t["h-spacing"]} ${r.y+.5})`},g:[{_attributes:{transform:`scale(${i/n.height} ${i/n.height}) translate(${-n.width/2} ${-n.height/2})`,stroke:r.color||t.icons.color||void 0,fill:r.color||t.icons.color||void 0},path:{_attributes:{d:n.path}}}]};return["bottom","top","left","right"].forEach(n=>{const i=r[n];if(i&&i.text){const o=i["font-size"]||t.texts["font-size"],a=i.margin||t.texts.margin;let u,l;switch(n){case"bottom":u={x:0,y:1},l="middle";break;case"top":u={x:0,y:-1},l="middle";break;case"left":u={x:-1,y:0},l="end";break;case"right":u={x:1,y:0},l="start"}const c=i["line-height"]||t.texts["line-height"],f=e.getSvgText(i.text,c,u.x*o/2,l),h=f.tspan?f.tspan.length-1:0;f._attributes={"font-family":i.font||t.texts.font,"font-size":o,"text-anchor":l,x:u.x*o/2,y:(u.y+.25)*o-(1-u.y)*h*o*c/2},s.g.push({_attributes:{transform:`translate(${u.x*a} ${u.y*a}) scale(${1/t.scale} ${1/t.scale})`,stroke:i.color||r.color||t.texts.color||t.icons.color||void 0,fill:i.color||r.color||t.texts.color||t.icons.color||void 0},text:f})}}),s},renderLink:(r,n)=>{const i=r[n.from],s=r[n.to],o=((i.x+s.x)/2+.5)*t["h-spacing"],a=(i.y+s.y)/2+.5,u=180*Math.atan2(s.y-i.y,(s.x-i.x)*t["h-spacing"])/Math.PI,l=.4*(n.scale||t.links.scale);let c=n.size||t.links.size;if(!c){let e=Math.abs(s.x-i.x)*t["h-spacing"];e>0&&(e-=.6);let r=Math.abs(s.y-i.y);r>0&&(r-=.6),c=Math.sqrt(Math.pow(e,2)+Math.pow(r,2))/l}const f=e.getLinkPath(n.type,c);return f?{_attributes:{transform:`translate(${o} ${a}) rotate(${u})`},g:{_attributes:{transform:`scale(${l/512} ${l/512}) translate(${-256*c} -256)`,stroke:n.color||t.links.color||void 0,fill:n.color||t.links.color||void 0},path:{_attributes:{d:f}}}}:null},toXML:(e,r)=>{const i={svg:{_attributes:{xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${r.w*t["h-spacing"]} ${r.h}`,width:r.w*t["h-spacing"]*t.scale/.4,height:r.h*t.scale/.4,stroke:t.color,fill:t.color}}};return Object.keys(e).forEach(t=>{i.svg[t]=e[t]}),n.js2xml(i,{compact:!0,spaces:t.beautify?4:0}).replace(/<\/tspan>(\s*){const n={g:[]};Object.keys(t).forEach(r=>{const s=i.isValid(t[r],a);if(s)throw`Node '${r}' is invalid at key '${s}'`;["bottom","top","left","right"].forEach(e=>{"string"==typeof t[r][e]&&(t[r][e]={text:t[r][e]})});const o=e.renderNode(t[r]);o&&n.g.push(o)}),r.forEach((r,s)=>{const o=i.isValid(r,u);if(o)throw`Link ${s} (${r.from}->${r.to}) is invalid at key '${o}'`;["bottom","top"].forEach(t=>{"string"==typeof r[t]&&(r[t]={text:r[t]})});const a=e.renderLink(t,r);a&&n.g.push(a)});const s=e.getBounds(t);return e.toXML(n,s)}};return e})},{"../resources.json":void 0,"./utils":41,"xml-js":32}],41:[function(t,e,r){const n={merge:(t,e)=>{if(typeof t!=typeof e)return t;if(t.length&&!e.length)return t;if(t.length&&e.length)return e;if("object"==typeof t){const r={};return Object.keys(t).forEach(i=>r[i]=n.merge(t[i],e[i])),r}return e},isValid:(t,e)=>{const r=Object.keys(e).filter(t=>"_"!==t);let i,s;for(let o=0;o0&&(s="array"),"object"==typeof e[i]){if(s&&"object"!==s&&s!==e[i]._)return i;const r=n.isValid(s?t[i]:void 0,e[i]);if(r)return i+"."+r}else{if("!"===e[i][0]&&(e[i]=e[i].substr(1),!s))return i;if(s&&s!==e[i])return i}return null},ezClone:t=>JSON.parse(JSON.stringify(t)),newMap:(t,e,r)=>new Array(t).fill(0).map(()=>new Array(e).fill(r))};e.exports=n},{}]},{},[38]); \ No newline at end of file +!function(){return function t(e,r,n){function i(o,a){if(!r[o]){if(!e[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){return i(e[o][1][t]||t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o0?n-4:n,f=0;f>16&255,a[u++]=e>>8&255,a[u++]=255&e;2===o&&(e=i[t.charCodeAt(f)]<<2|i[t.charCodeAt(f+1)]>>4,a[u++]=255&e);1===o&&(e=i[t.charCodeAt(f)]<<10|i[t.charCodeAt(f+1)]<<4|i[t.charCodeAt(f+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e);return a},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,s=[],o=0,a=r-i;oa?a:o+16383));1===i?(e=t[r-1],s.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],s.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return s.join("")};for(var n=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,s,o=[],a=e;a>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(t,e,r){},{}],3:[function(t,e,r){(function(e){"use strict";var n=t("base64-js"),i=t("ieee754");r.Buffer=e,r.SlowBuffer=function(t){+t!=t&&(t=0);return e.alloc(+t)},r.INSPECT_MAX_BYTES=50;var s=2147483647;function o(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=e.prototype,r}function e(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return a(t,e,r)}function a(t,r,n){if("string"==typeof t)return function(t,r){"string"==typeof r&&""!==r||(r="utf8");if(!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|h(t,r),i=o(n),s=i.write(t,r);s!==n&&(i=i.slice(0,s));return i}(t,r);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(P(t,ArrayBuffer)||t&&P(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function h(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||P(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var s=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return B(t).length;default:if(s)return i?-1:j(t).length;r=(""+r).toLowerCase(),s=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,r,n,i,s){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),U(n=+n)&&(n=s?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(s)return-1;n=t.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof r&&(r=e.from(r,i)),e.isBuffer(r))return 0===r.length?-1:g(t,r,n,i,s);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):g(t,[r],n,i,s);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,i){var s,o=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,a/=2,u/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var c=-1;for(s=r;sa&&(r=a-u),s=r;s>=0;s--){for(var f=!0,h=0;hi&&(n=i):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>8,i=r%256,s.push(i),s.push(n);return s}(e,t.length-r),t,r,n)}function _(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:l>223?3:l>191?2:1;if(i+f<=r)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)>127&&(c=u);break;case 3:s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(u=(15&l)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return A(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return _(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},e.prototype.toLocaleString=e.prototype.toString,e.prototype.equals=function(t){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===e.compare(this,t)},e.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},e.prototype.compare=function(t,r,n,i,s){if(P(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===s&&(s=this.length),r<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),c=t.slice(r,n),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return y(this,t,e,r);case"ascii":return b(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function A(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function F(t,r,n,i,s,o){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>s||rt.length)throw new RangeError("Index out of range")}function I(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function O(t,e,r,n,s){return e=+e,r>>>=0,s||I(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,s){return e=+e,r>>>=0,s||I(t,0,r,8),i.write(t,e,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;t=~~t,r=void 0===r?n:~~r,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),r<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,e>>>=0,r||k(t,e,this.length);for(var n=this[t],i=1,s=0;++s>>=0,e>>>=0,r||k(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},e.prototype.readUInt8=function(t,e){return t>>>=0,e||k(t,1,this.length),this[t]},e.prototype.readUInt16LE=function(t,e){return t>>>=0,e||k(t,2,this.length),this[t]|this[t+1]<<8},e.prototype.readUInt16BE=function(t,e){return t>>>=0,e||k(t,2,this.length),this[t]<<8|this[t+1]},e.prototype.readUInt32LE=function(t,e){return t>>>=0,e||k(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},e.prototype.readUInt32BE=function(t,e){return t>>>=0,e||k(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},e.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||k(t,e,this.length);for(var n=this[t],i=1,s=0;++s=(i*=128)&&(n-=Math.pow(2,8*e)),n},e.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||k(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*e)),s},e.prototype.readInt8=function(t,e){return t>>>=0,e||k(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},e.prototype.readInt16LE=function(t,e){t>>>=0,e||k(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(t,e){t>>>=0,e||k(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(t,e){return t>>>=0,e||k(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},e.prototype.readInt32BE=function(t,e){return t>>>=0,e||k(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},e.prototype.readFloatLE=function(t,e){return t>>>=0,e||k(t,4,this.length),i.read(this,t,!0,23,4)},e.prototype.readFloatBE=function(t,e){return t>>>=0,e||k(t,4,this.length),i.read(this,t,!1,23,4)},e.prototype.readDoubleLE=function(t,e){return t>>>=0,e||k(t,8,this.length),i.read(this,t,!0,52,8)},e.prototype.readDoubleBE=function(t,e){return t>>>=0,e||k(t,8,this.length),i.read(this,t,!1,52,8)},e.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||F(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,n)||F(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},e.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,255,0),this[e]=255&t,e+1},e.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},e.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},e.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},e.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},e.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},e.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeFloatLE=function(t,e,r){return O(this,t,e,!0,r)},e.prototype.writeFloatBE=function(t,e,r){return O(this,t,e,!1,r)},e.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},e.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},e.prototype.copy=function(t,r,n,i){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,i),r);return s},e.prototype.fill=function(t,r,n,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!e.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var s=t.charCodeAt(0);("utf8"===i&&s<128||"latin1"===i)&&(t=s)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function B(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function R(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function P(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function U(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:6}],4:[function(t,e,r){(function(t){function e(t){return Object.prototype.toString.call(t)}r.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},r.isBoolean=function(t){return"boolean"==typeof t},r.isNull=function(t){return null===t},r.isNullOrUndefined=function(t){return null==t},r.isNumber=function(t){return"number"==typeof t},r.isString=function(t){return"string"==typeof t},r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=function(t){return void 0===t},r.isRegExp=function(t){return"[object RegExp]"===e(t)},r.isObject=function(t){return"object"==typeof t&&null!==t},r.isDate=function(t){return"[object Date]"===e(t)},r.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},r.isFunction=function(t){return"function"==typeof t},r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t.isBuffer}).call(this,{isBuffer:t("../../is-buffer/index.js")})},{"../../is-buffer/index.js":8}],5:[function(t,e,r){var n=Object.create||function(t){var e=function(){};return e.prototype=t,new e},i=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return r},s=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}e.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var a,u=10;try{var l={};Object.defineProperty&&Object.defineProperty(l,"x",{value:0}),a=0===l.x}catch(t){a=!1}function c(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function f(t,e,r,i){var s,o,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),a=o[e]):(o=t._events=n(null),t._eventsCount=0),a){if("function"==typeof a?a=o[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),!a.warned&&(s=c(t))&&s>0&&a.length>s){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else a=o[e]=r,++t._eventsCount;return t}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e1&&(e=arguments[1]),e instanceof Error)throw e;var u=new Error('Unhandled "error" event. ('+e+")");throw u.context=e,u}if(!(r=o[t]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var n=t.length,i=m(t,n),s=0;s=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,s=o;break}if(s<0)return this;0===s?r.shift():function(t,e){for(var r=e,n=r+1,i=t.length;n=0;s--)this.removeListener(t,e[s]);return this},o.prototype.listeners=function(t){return d(this,t,!0)},o.prototype.rawListeners=function(t){return d(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},o.prototype.listenerCount=g,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],6:[function(t,e,r){r.read=function(t,e,r,n,i){var s,o,a=8*i-n-1,u=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,p=t[e+f];for(f+=h,s=p&(1<<-c)-1,p>>=-c,c+=a;c>0;s=256*s+t[e+f],f+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===s)s=1-l;else{if(s===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),s-=l}return(p?-1:1)*o*Math.pow(2,s-n)},r.write=function(t,e,r,n,i,s){var o,a,u,l=8*s-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=c?(a=0,o=c):o+f>=1?(a=(e*u-1)*Math.pow(2,i),o+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,l-=8);t[r+p-d]|=128*g}},{}],7:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}],8:[function(t,e,r){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],9:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],10:[function(t,e,r){(function(t){"use strict";void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,r)});case 3:return t.nextTick(function(){e.call(null,r,n)});case 4:return t.nextTick(function(){e.call(null,r,n,i)});default:for(s=new Array(a-1),o=0;o1)for(var r=1;r0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===l.prototype||(e=function(t){return l.from(t)}(e)),n?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):E(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?E(t,o,e,!1):N(t,o)):E(t,o,e,!1))):n||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=_?t=_:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function T(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(p("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(A,t):A(t))}function A(t){p("emit readable"),t.emit("readable"),F(t)}function N(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(S,t,e))}function S(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;ts.length?s.length:t;if(o===s.length?i+=s:i+=s.slice(0,t),0===(t-=o)){o===s.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=l.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var s=n.data,o=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,o),0===(t-=o)){o===s.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=s.slice(o));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function O(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(L,e,t))}function L(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function M(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return p("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?O(this):T(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&O(this),null;var n,i=e.needReadable;return p("need readable",i),(0===e.length||e.length-t0?I(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&O(this)),null!==n&&this.emit("data",n),n},w.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(t,e){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,p("pipe count=%d opts=%j",s.pipesCount,e);var u=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?c:w;function l(e,r){p("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),t.removeListener("close",y),t.removeListener("finish",b),t.removeListener("drain",f),t.removeListener("error",m),t.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",g),h=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function c(){p("onend"),t.end()}s.endEmitted?i.nextTick(u):n.once("end",u),t.on("unpipe",l);var f=function(t){return function(){var e=t._readableState;p("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,F(t))}}(n);t.on("drain",f);var h=!1;var d=!1;function g(e){p("ondata"),d=!1,!1!==t.write(e)||d||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==M(s.pipes,t))&&!h&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function m(e){p("onerror",e),w(),t.removeListener("error",m),0===a(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",b),w()}function b(){p("onfinish"),t.removeListener("close",y),w()}function w(){p("unpipe"),n.unpipe(t)}return n.on("data",g),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",m),t.once("close",y),t.once("finish",b),t.emit("pipe",n),s.flowing||(p("pipe resume"),n.resume()),t},w.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s-1?i:s.nextTick;b.WritableState=y;var l=t("core-util-is");l.inherits=t("inherits");var c={deprecate:t("util-deprecate")},f=t("./internal/streams/stream"),h=t("safe-buffer").Buffer,p=n.Uint8Array||function(){};var d,g=t("./internal/streams/destroy");function m(){}function y(e,r){a=a||t("./_stream_duplex"),e=e||{};var n=r instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,l=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(s.nextTick(i,n),s.nextTick(T,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),T(t,e))}(t,r,n,e,i);else{var o=_(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||E(t,r),n?u(v,t,r,o,i):v(t,r,o,i)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function b(e){if(a=a||t("./_stream_duplex"),!(d.call(b,this)||this instanceof a))return new b(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function v(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),T(t,e)}function E(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),s=e.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,w(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,f=r.callback;if(w(t,e,!1,e.objectMode?1:l.length,l,c,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function _(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),T(t,e)})}function T(t,e){var r=_(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,s.nextTick(x,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}l.inherits(b,f),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(t){return!!d.call(this,t)||this===b&&(t&&t._writableState instanceof y)}})):d=function(t){return t instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(t,e,r){var n,i=this._writableState,o=!1,a=!i.objectMode&&(n=t,h.isBuffer(n)||n instanceof p);return a&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=m),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),s.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var i=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),s.nextTick(n,o),i=!1),i}(this,i,t,r))&&(i.pendingcb++,o=function(t,e,r,n,i,s){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,r));return e}(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,T(t,e),r&&(e.finished?s.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),b.prototype.destroy=g.destroy,b.prototype._undestroy=g.undestroy,b.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{"./_stream_duplex":13,"./internal/streams/destroy":19,"./internal/streams/stream":20,_process:11,"core-util-is":4,inherits:7,"process-nextick-args":10,"safe-buffer":25,timers:29,"util-deprecate":30}],18:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("util");e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,s=n.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=s,i=a,e.copy(r,i),a+=o.data.length,o=o.next;return s},t}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},{"safe-buffer":25,util:2}],19:[function(t,e,r){"use strict";var n=t("process-nextick-args");function i(t,e){t.emit("error",e)}e.exports={destroy:function(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(n.nextTick(i,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":10}],20:[function(t,e,r){e.exports=t("events").EventEmitter},{events:5}],21:[function(t,e,r){e.exports=t("./readable").PassThrough},{"./readable":22}],22:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":13,"./lib/_stream_passthrough.js":14,"./lib/_stream_readable.js":15,"./lib/_stream_transform.js":16,"./lib/_stream_writable.js":17}],23:[function(t,e,r){e.exports=t("./readable").Transform},{"./readable":22}],24:[function(t,e,r){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":17}],25:[function(t,e,r){var n=t("buffer"),i=n.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,r),r.Buffer=o),s(i,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:3}],26:[function(t,e,r){(function(e){!function(r){r.parser=function(t,e){return new s(t,e)},r.SAXParser=s,r.SAXStream=a,r.createStream=function(t,e){return new a(t,e)},r.MAX_BUFFER_LENGTH=65536;var n,i=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function s(t,e){if(!(this instanceof s))return new s(t,e);!function(t){for(var e=0,r=i.length;e"===n?(C(this,"onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=A.TEXT):b(n)?(this.state=A.SGML_DECL_QUOTED,this.sgmlDecl+=n):this.sgmlDecl+=n;continue;case A.SGML_DECL_QUOTED:n===this.q&&(this.state=A.SGML_DECL,this.q=""),this.sgmlDecl+=n;continue;case A.DOCTYPE:">"===n?(this.state=A.TEXT,C(this,"ondoctype",this.doctype),this.doctype=!0):(this.doctype+=n,"["===n?this.state=A.DOCTYPE_DTD:b(n)&&(this.state=A.DOCTYPE_QUOTED,this.q=n));continue;case A.DOCTYPE_QUOTED:this.doctype+=n,n===this.q&&(this.q="",this.state=A.DOCTYPE);continue;case A.DOCTYPE_DTD:this.doctype+=n,"]"===n?this.state=A.DOCTYPE:b(n)&&(this.state=A.DOCTYPE_DTD_QUOTED,this.q=n);continue;case A.DOCTYPE_DTD_QUOTED:this.doctype+=n,n===this.q&&(this.state=A.DOCTYPE_DTD,this.q="");continue;case A.COMMENT:"-"===n?this.state=A.COMMENT_ENDING:this.comment+=n;continue;case A.COMMENT_ENDING:"-"===n?(this.state=A.COMMENT_ENDED,this.comment=F(this.opt,this.comment),this.comment&&C(this,"oncomment",this.comment),this.comment=""):(this.comment+="-"+n,this.state=A.COMMENT);continue;case A.COMMENT_ENDED:">"!==n?(L(this,"Malformed comment"),this.comment+="--"+n,this.state=A.COMMENT):this.state=A.TEXT;continue;case A.CDATA:"]"===n?this.state=A.CDATA_ENDING:this.cdata+=n;continue;case A.CDATA_ENDING:"]"===n?this.state=A.CDATA_ENDING_2:(this.cdata+="]"+n,this.state=A.CDATA);continue;case A.CDATA_ENDING_2:">"===n?(this.cdata&&C(this,"oncdata",this.cdata),C(this,"onclosecdata"),this.cdata="",this.state=A.TEXT):"]"===n?this.cdata+="]":(this.cdata+="]]"+n,this.state=A.CDATA);continue;case A.PROC_INST:"?"===n?this.state=A.PROC_INST_ENDING:y(n)?this.state=A.PROC_INST_BODY:this.procInstName+=n;continue;case A.PROC_INST_BODY:if(!this.procInstBody&&y(n))continue;"?"===n?this.state=A.PROC_INST_ENDING:this.procInstBody+=n;continue;case A.PROC_INST_ENDING:">"===n?(C(this,"onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=A.TEXT):(this.procInstBody+="?"+n,this.state=A.PROC_INST_BODY);continue;case A.OPEN_TAG:v(d,n)?this.tagName+=n:(M(this),">"===n?B(this):"/"===n?this.state=A.OPEN_TAG_SLASH:(y(n)||L(this,"Invalid character in tag name"),this.state=A.ATTRIB));continue;case A.OPEN_TAG_SLASH:">"===n?(B(this,!0),R(this)):(L(this,"Forward-slash in opening tag not followed by >"),this.state=A.ATTRIB);continue;case A.ATTRIB:if(y(n))continue;">"===n?B(this):"/"===n?this.state=A.OPEN_TAG_SLASH:v(p,n)?(this.attribName=n,this.attribValue="",this.state=A.ATTRIB_NAME):L(this,"Invalid attribute name");continue;case A.ATTRIB_NAME:"="===n?this.state=A.ATTRIB_VALUE:">"===n?(L(this,"Attribute without value"),this.attribValue=this.attribName,j(this),B(this)):y(n)?this.state=A.ATTRIB_NAME_SAW_WHITE:v(d,n)?this.attribName+=n:L(this,"Invalid attribute name");continue;case A.ATTRIB_NAME_SAW_WHITE:if("="===n)this.state=A.ATTRIB_VALUE;else{if(y(n))continue;L(this,"Attribute without value"),this.tag.attributes[this.attribName]="",this.attribValue="",C(this,"onattribute",{name:this.attribName,value:""}),this.attribName="",">"===n?B(this):v(p,n)?(this.attribName=n,this.state=A.ATTRIB_NAME):(L(this,"Invalid attribute name"),this.state=A.ATTRIB)}continue;case A.ATTRIB_VALUE:if(y(n))continue;b(n)?(this.q=n,this.state=A.ATTRIB_VALUE_QUOTED):(L(this,"Unquoted attribute value"),this.state=A.ATTRIB_VALUE_UNQUOTED,this.attribValue=n);continue;case A.ATTRIB_VALUE_QUOTED:if(n!==this.q){"&"===n?this.state=A.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=n;continue}j(this),this.q="",this.state=A.ATTRIB_VALUE_CLOSED;continue;case A.ATTRIB_VALUE_CLOSED:y(n)?this.state=A.ATTRIB:">"===n?B(this):"/"===n?this.state=A.OPEN_TAG_SLASH:v(p,n)?(L(this,"No whitespace between attributes"),this.attribName=n,this.attribValue="",this.state=A.ATTRIB_NAME):L(this,"Invalid attribute name");continue;case A.ATTRIB_VALUE_UNQUOTED:if(!w(n)){"&"===n?this.state=A.ATTRIB_VALUE_ENTITY_U:this.attribValue+=n;continue}j(this),">"===n?B(this):this.state=A.ATTRIB;continue;case A.CLOSE_TAG:if(this.tagName)">"===n?R(this):v(d,n)?this.tagName+=n:this.script?(this.script+=""===n?R(this):L(this,"Invalid characters in closing tag");continue;case A.TEXT_ENTITY:case A.ATTRIB_VALUE_ENTITY_Q:case A.ATTRIB_VALUE_ENTITY_U:var a,c;switch(this.state){case A.TEXT_ENTITY:a=A.TEXT,c="textNode";break;case A.ATTRIB_VALUE_ENTITY_Q:a=A.ATTRIB_VALUE_QUOTED,c="attribValue";break;case A.ATTRIB_VALUE_ENTITY_U:a=A.ATTRIB_VALUE_UNQUOTED,c="attribValue"}";"===n?(this[c]+=P(this),this.entity="",this.state=a):v(this.entity.length?m:g,n)?this.entity+=n:(L(this,"Invalid character in entity name"),this[c]+="&"+this.entity+n,this.entity="",this.state=a);continue;default:throw new Error(this,"Unknown state: "+this.state)}this.position>=this.bufferCheckPosition&&function(t){for(var e=Math.max(r.MAX_BUFFER_LENGTH,10),n=0,s=0,o=i.length;se)switch(i[s]){case"textNode":k(t);break;case"cdata":C(t,"oncdata",t.cdata),t.cdata="";break;case"script":C(t,"onscript",t.script),t.script="";break;default:I(t,"Max buffer length exceeded: "+i[s])}n=Math.max(n,a)}var u=r.MAX_BUFFER_LENGTH-n;t.bufferCheckPosition=u+t.position}(this);return this},resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var t;k(t=this),""!==t.cdata&&(C(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(C(t,"onscript",t.script),t.script="")}};try{n=t("stream").Stream}catch(t){n=function(){}}var o=r.EVENTS.filter(function(t){return"error"!==t&&"end"!==t});function a(t,e){if(!(this instanceof a))return new a(t,e);n.apply(this),this._parser=new s(t,e),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(t){r.emit("error",t),r._parser.error=null},this._decoder=null,o.forEach(function(t){Object.defineProperty(r,"on"+t,{get:function(){return r._parser["on"+t]},set:function(e){if(!e)return r.removeAllListeners(t),r._parser["on"+t]=e,e;r.on(t,e)},enumerable:!0,configurable:!1})})}a.prototype=Object.create(n.prototype,{constructor:{value:a}}),a.prototype.write=function(r){if("function"==typeof e&&"function"==typeof e.isBuffer&&e.isBuffer(r)){if(!this._decoder){var n=t("string_decoder").StringDecoder;this._decoder=new n("utf8")}r=this._decoder.write(r)}return this._parser.write(r.toString()),this.emit("data",r),!0},a.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},a.prototype.on=function(t,e){var r=this;return r._parser["on"+t]||-1===o.indexOf(t)||(r._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),r.emit.apply(r,e)}),n.prototype.on.call(r,t,e)};var u="[CDATA[",l="DOCTYPE",c="http://www.w3.org/XML/1998/namespace",f="http://www.w3.org/2000/xmlns/",h={xml:c,xmlns:f},p=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,d=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,g=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,m=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function y(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function b(t){return'"'===t||"'"===t}function w(t){return">"===t||y(t)}function v(t,e){return t.test(e)}function E(t,e){return!v(t,e)}var _,x,T,A=0;for(var N in r.STATE={BEGIN:A++,BEGIN_WHITESPACE:A++,TEXT:A++,TEXT_ENTITY:A++,OPEN_WAKA:A++,SGML_DECL:A++,SGML_DECL_QUOTED:A++,DOCTYPE:A++,DOCTYPE_QUOTED:A++,DOCTYPE_DTD:A++,DOCTYPE_DTD_QUOTED:A++,COMMENT_STARTING:A++,COMMENT:A++,COMMENT_ENDING:A++,COMMENT_ENDED:A++,CDATA:A++,CDATA_ENDING:A++,CDATA_ENDING_2:A++,PROC_INST:A++,PROC_INST_BODY:A++,PROC_INST_ENDING:A++,OPEN_TAG:A++,OPEN_TAG_SLASH:A++,ATTRIB:A++,ATTRIB_NAME:A++,ATTRIB_NAME_SAW_WHITE:A++,ATTRIB_VALUE:A++,ATTRIB_VALUE_QUOTED:A++,ATTRIB_VALUE_CLOSED:A++,ATTRIB_VALUE_UNQUOTED:A++,ATTRIB_VALUE_ENTITY_Q:A++,ATTRIB_VALUE_ENTITY_U:A++,CLOSE_TAG:A++,CLOSE_TAG_SAW_WHITE:A++,SCRIPT:A++,SCRIPT_ENDING:A++},r.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},r.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(r.ENTITIES).forEach(function(t){var e=r.ENTITIES[t],n="number"==typeof e?String.fromCharCode(e):e;r.ENTITIES[t]=n}),r.STATE)r.STATE[r.STATE[N]]=N;function S(t,e,r){t[e]&&t[e](r)}function C(t,e,r){t.textNode&&k(t),S(t,e,r)}function k(t){t.textNode=F(t.opt,t.textNode),t.textNode&&S(t,"ontext",t.textNode),t.textNode=""}function F(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function I(t,e){return k(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,S(t,"onerror",e),t}function O(t){return t.sawRoot&&!t.closedRoot&&L(t,"Unclosed root tag"),t.state!==A.BEGIN&&t.state!==A.BEGIN_WHITESPACE&&t.state!==A.TEXT&&I(t,"Unexpected end"),k(t),t.c="",t.closed=!0,S(t,"onend"),s.call(t,t.strict,t.opt),t}function L(t,e){if("object"!=typeof t||!(t instanceof s))throw new Error("bad call to strictFail");t.strict&&I(t,e)}function M(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,r=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(r.ns=e.ns),t.attribList.length=0,C(t,"onopentagstart",r)}function D(t,e){var r=t.indexOf(":")<0?["",t]:t.split(":"),n=r[0],i=r[1];return e&&"xmlns"===t&&(n="xmlns",i=""),{prefix:n,local:i}}function j(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var e=D(t.attribName,!0),r=e.prefix,n=e.local;if("xmlns"===r)if("xml"===n&&t.attribValue!==c)L(t,"xml: prefix must be bound to "+c+"\nActual: "+t.attribValue);else if("xmlns"===n&&t.attribValue!==f)L(t,"xmlns: prefix must be bound to "+f+"\nActual: "+t.attribValue);else{var i=t.tag,s=t.tags[t.tags.length-1]||t;i.ns===s.ns&&(i.ns=Object.create(s.ns)),i.ns[n]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,C(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function B(t,e){if(t.opt.xmlns){var r=t.tag,n=D(t.tagName);r.prefix=n.prefix,r.local=n.local,r.uri=r.ns[n.prefix]||"",r.prefix&&!r.uri&&(L(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),r.uri=n.prefix);var i=t.tags[t.tags.length-1]||t;r.ns&&i.ns!==r.ns&&Object.keys(r.ns).forEach(function(e){C(t,"onopennamespace",{prefix:e,uri:r.ns[e]})});for(var s=0,o=t.attribList.length;s",t.tagName="",void(t.state=A.SCRIPT);C(t,"onscript",t.script),t.script=""}var e=t.tags.length,r=t.tagName;t.strict||(r=r[t.looseCase]());for(var n=r;e--;){if(t.tags[e].name===n)break;L(t,"Unexpected close tag")}if(e<0)return L(t,"Unmatched closing tag: "+t.tagName),t.textNode+="",void(t.state=A.TEXT);t.tagName=r;for(var i=t.tags.length;i-- >e;){var s=t.tag=t.tags.pop();t.tagName=t.tag.name,C(t,"onclosetag",t.tagName);var o={};for(var a in s.ns)o[a]=s.ns[a];var u=t.tags[t.tags.length-1]||t;t.opt.xmlns&&s.ns!==u.ns&&Object.keys(s.ns).forEach(function(e){var r=s.ns[e];C(t,"onclosenamespace",{prefix:e,uri:r})})}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=A.TEXT}function P(t){var e,r=t.entity,n=r.toLowerCase(),i="";return t.ENTITIES[r]?t.ENTITIES[r]:t.ENTITIES[n]?t.ENTITIES[n]:("#"===(r=n).charAt(0)&&("x"===r.charAt(1)?(r=r.slice(2),i=(e=parseInt(r,16)).toString(16)):(r=r.slice(1),i=(e=parseInt(r,10)).toString(10))),r=r.replace(/^0+/,""),isNaN(e)||i.toLowerCase()!==r?(L(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(e))}function U(t,e){"<"===e?(t.state=A.OPEN_WAKA,t.startTagPosition=t.position):y(e)||(L(t,"Non-whitespace before first tag."),t.textNode=e,t.state=A.TEXT)}function K(t,e){var r="";return e1114111||x(o)!==o)throw RangeError("Invalid code point: "+o);o<=65535?r.push(o):(t=55296+((o-=65536)>>10),e=o%1024+56320,r.push(t,e)),(n+1===i||r.length>16384)&&(s+=_.apply(null,r),r.length=0)}return s},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:T,configurable:!0,writable:!0}):String.fromCodePoint=T)}(void 0===r?this.sax={}:r)}).call(this,t("buffer").Buffer)},{buffer:3,stream:27,string_decoder:28}],27:[function(t,e,r){e.exports=i;var n=t("events").EventEmitter;function i(){n.call(this)}t("inherits")(i,n),i.Readable=t("readable-stream/readable.js"),i.Writable=t("readable-stream/writable.js"),i.Duplex=t("readable-stream/duplex.js"),i.Transform=t("readable-stream/transform.js"),i.PassThrough=t("readable-stream/passthrough.js"),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",s),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",u));var o=!1;function a(){o||(o=!0,t.end())}function u(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function l(t){if(c(),0===n.listenerCount(this,"error"))throw t}function c(){r.removeListener("data",i),t.removeListener("drain",s),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",l),t.removeListener("error",l),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",l),t.on("error",l),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},{events:5,inherits:7,"readable-stream/duplex.js":12,"readable-stream/passthrough.js":21,"readable-stream/readable.js":22,"readable-stream/transform.js":23,"readable-stream/writable.js":24}],28:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.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!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=l,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=c,this.end=f,e=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}r.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":25}],29:[function(t,e,r){(function(e,n){var i=t("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,a={},u=0;function l(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new l(s.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new l(s.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},r.setImmediate="function"==typeof e?e:function(t){var e=u++,n=!(arguments.length<2)&&o.call(arguments,1);return a[e]=!0,i(function(){a[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))}),e},r.clearImmediate="function"==typeof n?n:function(t){delete a[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":11,timers:29}],30:[function(t,e,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],31:[function(t,e,r){e.exports={isArray:function(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}}},{}],32:[function(t,e,r){var n=t("./xml2js"),i=t("./xml2json"),s=t("./js2xml"),o=t("./json2xml");e.exports={xml2js:n,xml2json:i,js2xml:s,json2xml:o}},{"./js2xml":33,"./json2xml":34,"./xml2js":36,"./xml2json":37}],33:[function(t,e,r){var n,i,s=t("./options-helper"),o=t("./array-helper").isArray;function a(t,e,r){return(!r&&t.spaces?"\n":"")+Array(e+1).join(t.spaces)}function u(t,e,r){if(e.ignoreAttributes)return"";"attributesFn"in e&&(t=e.attributesFn(t,i,n));var s,o,u,l,c=[];for(s in t)t.hasOwnProperty(s)&&null!==t[s]&&void 0!==t[s]&&(l=e.noQuotesForNativeAttributes&&"string"!=typeof t[s]?"":'"',o=(o=""+t[s]).replace(/"/g,"""),u="attributeNameFn"in e?e.attributeNameFn(s,o,i,n):s,c.push(e.spaces&&e.indentAttributes?a(e,r+1,!1):" "),c.push(u+"="+l+("attributeValueFn"in e?e.attributeValueFn(o,s,i,n):o)+l));return t&&Object.keys(t).length&&e.spaces&&e.indentAttributes&&c.push(a(e,r,!1)),c.join("")}function l(t,e,r){return n=t,i="xml",e.ignoreDeclaration?"":""}function c(t,e,r){if(e.ignoreInstruction)return"";var s;for(s in t)if(t.hasOwnProperty(s))break;var o="instructionNameFn"in e?e.instructionNameFn(s,t[s],i,n):s;if("object"==typeof t[s])return n=t,i=o,"";var a=t[s]?t[s]:"";return"instructionFn"in e&&(a=e.instructionFn(a,s,i,n)),""}function f(t,e){return e.ignoreComment?"":"\x3c!--"+("commentFn"in e?e.commentFn(t,i,n):t)+"--\x3e"}function h(t,e){return e.ignoreCdata?"":"","]]]]>"))+"]]>"}function p(t,e){return e.ignoreDoctype?"":""}function d(t,e){return e.ignoreText?"":(t=(t=(t=""+t).replace(/&/g,"&")).replace(/&/g,"&").replace(//g,">"),"textFn"in e?e.textFn(t,i,n):t)}function g(t,e,r,s){return t.reduce(function(t,o){var l=a(e,r,s&&!t);switch(o.type){case"element":return t+l+function(t,e,r){n=t,i=t.name;var s=[],o="elementNameFn"in e?e.elementNameFn(t.name,t):t.name;s.push("<"+o),t[e.attributesKey]&&s.push(u(t[e.attributesKey],e,r));var a=t[e.elementsKey]&&t[e.elementsKey].length||t[e.attributesKey]&&"preserve"===t[e.attributesKey]["xml:space"];return a||(a="fullTagEmptyElementFn"in e?e.fullTagEmptyElementFn(t.name,t):e.fullTagEmptyElement),a?(s.push(">"),t[e.elementsKey]&&t[e.elementsKey].length&&(s.push(g(t[e.elementsKey],e,r+1)),n=t,i=t.name),s.push(e.spaces&&function(t,e){var r;if(t.elements&&t.elements.length)for(r=0;r")):s.push("/>"),s.join("")}(o,e,r);case"comment":return t+l+f(o[e.commentKey],e);case"doctype":return t+l+p(o[e.doctypeKey],e);case"cdata":return t+(e.indentCdata?l:"")+h(o[e.cdataKey],e);case"text":return t+(e.indentText?l:"")+d(o[e.textKey],e);case"instruction":var m={};return m[o[e.nameKey]]=o[e.attributesKey]?o:o[e.instructionKey],t+(e.indentInstruction?l:"")+c(m,e,r)}},"")}function m(t,e,r){var n;for(n in t)if(t.hasOwnProperty(n))switch(n){case e.parentKey:case e.attributesKey:break;case e.textKey:if(e.indentText||r)return!0;break;case e.cdataKey:if(e.indentCdata||r)return!0;break;case e.instructionKey:if(e.indentInstruction||r)return!0;break;case e.doctypeKey:case e.commentKey:default:return!0}return!1}function y(t,e,r,s,o){n=t,i=e;var l="elementNameFn"in r?r.elementNameFn(e,t):e;if(void 0===t||null===t||""===t)return"fullTagEmptyElementFn"in r&&r.fullTagEmptyElementFn(e,t)||r.fullTagEmptyElement?"<"+l+">":"<"+l+"/>";var c=[];if(e){if(c.push("<"+l),"object"!=typeof t)return c.push(">"+d(t,r)+""),c.join("");t[r.attributesKey]&&c.push(u(t[r.attributesKey],r,s));var f=m(t,r,!0)||t[r.attributesKey]&&"preserve"===t[r.attributesKey]["xml:space"];if(f||(f="fullTagEmptyElementFn"in r?r.fullTagEmptyElementFn(e,t):r.fullTagEmptyElement),!f)return c.push("/>"),c.join("");c.push(">")}return c.push(b(t,r,s+1,!1)),n=t,i=e,e&&c.push((o?a(r,s,!1):"")+""),c.join("")}function b(t,e,r,n){var i,s,u,g=[];for(s in t)if(t.hasOwnProperty(s))for(u=o(t[s])?t[s]:[t[s]],i=0;i/g,">")),l("text",t))}function d(t){n.ignoreComment||(n.trim&&(t=t.trim()),l("comment",t))}function g(t){var e=i[n.parentKey];n.addParent||delete i[n.parentKey],i=e}function m(t){n.ignoreCdata||(n.trim&&(t=t.trim()),l("cdata",t))}function y(t){n.ignoreDoctype||(t=t.replace(/^ /,""),n.trim&&(t=t.trim()),l("doctype",t))}function b(t){t.note=t}e.exports=function(t,e){var r=s.parser(!0,{}),a={};if(i=a,n=function(t){return n=o.copyOptions(t),o.ensureFlagExists("ignoreDeclaration",n),o.ensureFlagExists("ignoreInstruction",n),o.ensureFlagExists("ignoreAttributes",n),o.ensureFlagExists("ignoreText",n),o.ensureFlagExists("ignoreComment",n),o.ensureFlagExists("ignoreCdata",n),o.ensureFlagExists("ignoreDoctype",n),o.ensureFlagExists("compact",n),o.ensureFlagExists("alwaysChildren",n),o.ensureFlagExists("addParent",n),o.ensureFlagExists("trim",n),o.ensureFlagExists("nativeType",n),o.ensureFlagExists("nativeTypeAttributes",n),o.ensureFlagExists("sanitize",n),o.ensureFlagExists("instructionHasAttributes",n),o.ensureFlagExists("captureSpacesBetweenElements",n),o.ensureAlwaysArrayExists(n),o.ensureKeyExists("declaration",n),o.ensureKeyExists("instruction",n),o.ensureKeyExists("attributes",n),o.ensureKeyExists("text",n),o.ensureKeyExists("comment",n),o.ensureKeyExists("cdata",n),o.ensureKeyExists("doctype",n),o.ensureKeyExists("type",n),o.ensureKeyExists("name",n),o.ensureKeyExists("elements",n),o.ensureKeyExists("parent",n),o.checkFnExists("doctype",n),o.checkFnExists("instruction",n),o.checkFnExists("cdata",n),o.checkFnExists("comment",n),o.checkFnExists("text",n),o.checkFnExists("instructionName",n),o.checkFnExists("elementName",n),o.checkFnExists("attributeName",n),o.checkFnExists("attributeValue",n),o.checkFnExists("attributes",n),n}(e),r.opt={strictEntities:!0},r.onopentag=h,r.ontext=p,r.oncomment=d,r.onclosetag=g,r.onerror=b,r.oncdata=m,r.ondoctype=y,r.onprocessinginstruction=f,r.write(t).close(),a[n.elementsKey]){var u=a[n.elementsKey];delete a[n.elementsKey],a[n.elementsKey]=u,delete a.text}return a}},{"./array-helper":31,"./options-helper":35,sax:26}],37:[function(t,e,r){var n=t("./options-helper"),i=t("./xml2js");e.exports=function(t,e){var r,s,o;return r=function(t){var e=n.copyOptions(t);return n.ensureSpacesExists(e),e}(e),s=i(t,r),o="compact"in r&&r.compact?"_parent":"parent",("addParent"in r&&r.addParent?JSON.stringify(s,function(t,e){return t===o?"_":e},r.spaces):JSON.stringify(s,null,r.spaces)).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}},{"./options-helper":35,"./xml2js":36}],38:[function(t,e,r){(function(r){const n=t("./placing"),i=t("./rendering"),s={compute:t=>{const e=t.options||{};let r={};(t.nodes||[]).filter(t=>"string"==typeof t.name).forEach(t=>r[t.name]=t);let s=(t.links||[]).filter(t=>t.from&&t.to);if(s.filter(t=>!r[t.from]).forEach(t=>console.warn(`unknown source node "${t.from}"`)),s.filter(t=>!r[t.to]).forEach(t=>console.warn(`unknown destination node "${t.to}"`)),s=s.filter(t=>r[t.from]&&r[t.to]),!(r=n(e.placing).compute(r,s)))throw"Failed to place nodes";return i(e.rendering).compute(r,s)}};e.exports=s,r.faDiagrams=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./placing":39,"./rendering":40}],39:[function(t,e,r){const n=t("./utils"),i={name:"!string",x:"number",y:"number"},s={from:"!string",to:"!string",direction:"string"},o={"max-link-length":3,diagonals:!0};e.exports=(t=>{t=n.merge(o,t);const e={getBounds:t=>{const e=Object.values(t).filter(t=>void 0!==t.x);if(0===e.length)return{x:0,y:0,w:0,h:0};let r=null,n=null,i=null,s=null;return e.forEach(t=>{r=null!==r?Math.min(t.x,r):t.x,n=null!==n?Math.min(t.y,n):t.y,i=null!==i?Math.max(t.x,i):t.x,s=null!==s?Math.max(t.y,s):t.y}),{x:r,y:n,w:i-r+1,h:s-n+1}},getNewPos:t=>{const r=e.getBounds(t),i=n.newMap(r.w,r.h,!1);Object.values(t).filter(t=>void 0!==t.x).forEach(t=>{i[t.x-r.x][t.y-r.y]=!0});for(let t=0;t{let n=t[e].x,i=t[e].y,s=t[r].x,o=t[r].y;const a=s-n,u=o-i,l=(t,n)=>i=>i.x===t&&i.y===n&&i.name!==e&&i.name!==r;if(Math.abs(a)>=Math.abs(u)){if(n>s){let t=n;n=s,s=t}for(let e=n;e<=s;e++){let r=Math.round(i+u*(e-n)/a);if(Object.values(t).find(l(e,r)))return!0}}else{if(i>o){let t=i;i=o,o=t}for(let e=i;e<=o;e++){let r=Math.round(n+a*(e-i)/u);if(Object.values(t).find(l(r,e)))return!0}}return!1},getPosition:(e,r,n)=>{const i=e[r],s={maxX:null,maxY:null,minX:null,minY:null,startX:null,startY:null,free:!0},o=(t,r,n,i)=>o=>{if(void 0!==e[o].x){const a=e[o].x,u=e[o].y;s.minX=null!==s.minX?Math.max(a+t,s.minX):a+t,s.maxX=null!==s.maxX?Math.min(a+r,s.maxX):a+r,s.minY=null!==s.minY?Math.max(u+n,s.minY):u+n,s.maxY=null!==s.maxY?Math.min(u+i,s.maxY):u+i,null===s.startX&&(s.startX=Math.abs(i+n)>0?a:1===Math.abs(t)?"minX":"maxX",s.startY=Math.abs(r+t)>0?u:1===Math.abs(n)?"minY":"maxY"),s.free=!1}},a=t["max-link-length"],u=n?a:0;return i.const.beforeX.forEach(o(1,1+a,-u,u)),i.const.beforeY.forEach(o(-u,u,1,1+a)),i.const.afterX.forEach(o(-1-a,-1,-u,u)),i.const.afterY.forEach(o(-u,u,-1-a,-1)),"string"==typeof s.startX&&(s.startX=s[s.startX]),"string"==typeof s.startY&&(s.startY=s[s.startY]),s.minX>s.maxX||s.minY>s.maxY?null:{x:s.startX,y:s.startY,free:s.free}},isValid:(r,n)=>{let i,s,o;const a=Object.values(r).filter(t=>void 0!==t.x);for(let t=0;tMath.pow(t["max-link-length"],2))return!1;switch(i.direction){case"up":case"top":if(o.y-s.y>=0)return!1;break;case"down":case"bottom":if(o.y-s.y<=0)return!1;break;case"left":if(o.x-s.x>=0)return!1;break;case"right":if(o.x-s.x<=0)return!1}if(!t.diagonals&&s.x!==o.x&&s.y!==o.y)return!1}return!0},correctPlacing:t=>{const r=e.getBounds(t);Object.values(t).forEach(t=>{t.x-=r.x,t.y-=r.y})},applyLinks:(r,i,s=0)=>{if(!e.isValid(r,i))return null;const o=Object.keys(r).filter(t=>void 0===r[t].x);if(0===o.length)return r;const a=[],u=(t,o,a)=>{const u=n.ezClone(r);return u[t].x=o,u[t].y=a,e.applyLinks(u,i,s+1)};let l,c,f;for(let n=0;n(Object.keys(t).forEach(e=>{const r=n.isValid(t[e],i);if(r)throw`Node '${e}' is invalid at key '${r}'`}),r.forEach((t,e)=>{const r=n.isValid(t,s);if(r)throw`Link ${e} (${t.from}->${t.to}) is invalid at key '${r}'`}),Object.values(t).forEach(t=>{t.const={beforeX:[],afterX:[],beforeY:[],afterY:[]}}),r.forEach(e=>{if(e.direction)switch(e.direction){case"up":case"top":t[e.from].const.beforeY.push(e.to),t[e.to].const.afterY.push(e.from);break;case"down":case"bottom":t[e.from].const.afterY.push(e.to),t[e.to].const.beforeY.push(e.from);break;case"left":t[e.from].const.beforeX.push(e.to),t[e.to].const.afterX.push(e.from);break;case"right":t[e.from].const.afterX.push(e.to),t[e.to].const.beforeX.push(e.from)}}),(t=e.applyLinks(t,r))&&(e.correctPlacing(t),Object.values(t).forEach(t=>{delete t.const})),t)};return e})},{"./utils":41}],40:[function(t,e,r){const n=t("xml-js"),i=t("./utils");let s={name:"error",height:512,index:[],links:{"arrow-head":{},"arrow-head-reverse":{},"line-start":{},"line-end":{},"dashed-step":{}},icons:{}};try{s=t("../resources.json")}catch(t){console.error("fa-diagrams: SVG resources could not be loaded: "+t)}const o={_:"string",text:"string",icon:{_:"string",path:"string",width:"number",height:"number"},color:"string",font:"string","font-size":"number","font-style":"string",margin:"number","line-height":"number",scale:"number"},a={name:"!string",icon:{_:"string",path:"string",width:"number",height:"number"},x:"!number",y:"!number",color:"string",scale:"number",top:o,bottom:o,left:o,right:o},u={from:"!string",to:"!string",type:"string",color:"string",scale:"number",size:"number",top:o,bottom:o},l={beautify:!1,scale:128,"h-spacing":1.3,color:"black",icons:{scale:1,color:""},links:{scale:1,color:"",size:0},texts:{font:"Arial","font-size":15,"font-style":"normal",color:"",margin:.2,"line-height":1.2}},c={"font-awesome":{fas:"solid",far:"regular",fab:"brands"}};e.exports=(t=>{t=i.merge(l,t);const e={getIcon:t=>{if(!t)return null;if("object"==typeof t)return t.path&&t.path.trim()?(t.height=t.height||t.width||s.height,t.width=t.width||t.height,t):null;if(!t.trim())return null;let e=i.ezClone(s.index);const r=t.trim().split(" ").map(t=>0===t.indexOf("fa-")?t.substr(3):t);for(let t=0;t{const r="v46.059c0 21.382 25.851 32.09 40.971 16.971 l86.059 -86.059c9.373-9.373 9.373-24.569 0-33.941l-86.059-86.059c-15.119-15.119-40.971-4.411-40.971 16.971v46.059",n="v-46.059c0-21.382-25.851-32.09-40.971-16.971l-86.059 86.059c-9.373 9.373-9.373 24.568 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971v-46.059",i="c6.627 0 12 -5.373 12 -12v-56c0 -6.627 -5.373 -12 -12 -12",s="c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12",o=`${s}h56${i}`;switch(t){case"none":return null;default:return`M12 216${s}h${512*e-146.059}${r}z`;case"line":return`M12 216${s}h${512*e-24}${i}z`;case"double":return`M134.059 216${n}h${512*e-268.06}${r}z`;case"split-double":return`M12 126${s}h${512*e-146.059}${r}M134.059 306${n}h${512*e-146.059}${i}z`;case"dashed":const a=Math.floor((512*e-134.059)/168),u=(512*e-134.059-56*a-24)/a;return`M12 216${new Array(a).fill(`${o}m${u} 0`).join("")}v80${r}z`;case"dashed-line":const l=Math.floor(512*e/168),c=(512*e-56*l-24)/(l-1);return`M12 216${new Array(l).fill(o).join(`m${c} 0`)}z`;case"dashed-double":const f=Math.floor((512*e-268.118)/168),h=(512*e-268.118-56*f-24)/(f+1);return`M134.059 216${n}m${h}-80${new Array(f).fill(`${o}m${h} 0`).join("")}v80${r}z`;case"dashed-split-double":const p=Math.floor((512*e-134.059)/168),d=(512*e-134.059-56*p-24)/p;return`M12 126${new Array(p).fill(`${o}m${d} 0`).join("")}v80${r}M134.059 306${n}m${d} -80${new Array(p).fill(`${o}`).join(`m${d} 0`)}z`}},getBounds:t=>{const e=Object.values(t);if(0===e.length)return{w:0,h:0};let r=0,n=0;return e.forEach(t=>{r=Math.max(t.x,r),n=Math.max(t.y,n)}),{w:r+1,h:n+1}},getSvgText:(t,e,r,n)=>{if(!(t=t.trim()).includes("\n"))return{_text:t};const i=[];return t.split("\n").map(t=>t.trim()).forEach((t,s)=>{i.push({_attributes:{x:r,dy:0===s?"0":`${e}em`,"text-anchor":n},_text:t})}),{tspan:i}},renderSubText:(r,n,i,s,o)=>{const a=i["font-size"]||t.texts["font-size"],u=(i.margin||t.texts.margin)/(o?4:1);let l,c;switch(n){case"bottom":l={x:0,y:1},c="middle";break;case"top":l={x:0,y:-1},c="middle";break;case"left":l={x:-1,y:0},c="end";break;case"right":l={x:1,y:0}}const f=i["line-height"]||t.texts["line-height"],h=e.getSvgText(i.text,f,l.x*a/2,c),p=h.tspan?h.tspan.length-1:0;return h._attributes={"font-family":i.font,"font-size":i["font-size"],"text-anchor":c,x:l.x*a/2,y:(l.y+.25)*a-(1-l.y)*p*a*f/2},{_attributes:{transform:`${s?"rotate(180) ":""}translate(${l.x*u} ${l.y*u}) scale(${1/t.scale} ${1/t.scale})`,fill:i.color||r.color||t.texts.color||t[o?"links":"icons"].color||void 0},text:h}},renderNode:r=>{const n=[],i=e.getIcon(r.icon);if(i){const e=.4*(r.scale||t.icons.scale);n.push({_attributes:{transform:`scale(${e/i.height} ${e/i.height}) translate(${-i.width/2} ${-i.height/2})`,fill:r.color||t.icons.color||void 0},path:{_attributes:{d:i.path}}})}return["bottom","top","left","right"].forEach(t=>{const i=r[t];i&&i.text&&n.push(e.renderSubText(r,t,i))}),n.length?{_attributes:{transform:`translate(${(r.x+.5)*t["h-spacing"]} ${r.y+.5})`},g:n}:null},renderLink:(r,n)=>{const i=r[n.from],s=r[n.to],o=((i.x+s.x)/2+.5)*t["h-spacing"],a=(i.y+s.y)/2+.5,u=180*Math.atan2(s.y-i.y,(s.x-i.x)*t["h-spacing"])/Math.PI;console.log(u);const l=[],c=.4*(n.scale||t.links.scale);let f=n.size||t.links.size;if(!f){let e=Math.abs(s.x-i.x)*t["h-spacing"];e>0&&(e-=.6);let r=Math.abs(s.y-i.y);r>0&&(r-=.6),f=Math.sqrt(Math.pow(e,2)+Math.pow(r,2))/c}const h=e.getLinkPath(n.type,f);h&&l.push({_attributes:{transform:`scale(${c/512} ${c/512}) translate(${-256*f} -256)`,fill:n.color||t.links.color||void 0},path:{_attributes:{d:h}}});const p=Math.abs(u)>90;return p?(n.top=n.top||n.right,n.bottom=n.bottom||n.left):(n.top=n.top||n.left,n.bottom=n.bottom||n.right),["bottom","top"].forEach(t=>{const r=n[t];r&&r.text&&l.push(e.renderSubText(n,t,r,p,!0))}),l.length?{_attributes:{transform:`translate(${o} ${a}) rotate(${u})`},g:l}:null},toXML:(e,r)=>{const i={svg:{_attributes:{xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${r.w*t["h-spacing"]} ${r.h}`,width:r.w*t["h-spacing"]*t.scale/.4,height:r.h*t.scale/.4,"font-family":t.texts.font,"font-size":t.texts["font-size"],fill:t.color,"stroke-width":0}}};return Object.keys(e).forEach(t=>{i.svg[t]=e[t]}),n.js2xml(i,{compact:!0,spaces:t.beautify?4:0}).replace(/<\/tspan>(\s*){const n={g:[]};r.forEach((r,s)=>{const o=i.isValid(r,u);if(o)throw`Link ${s} (${r.from}->${r.to}) is invalid at key '${o}'`;["bottom","top"].forEach(t=>{"string"==typeof r[t]&&(r[t]={text:r[t]})});const a=e.renderLink(t,r);a&&n.g.push(a)}),Object.keys(t).forEach(r=>{const s=i.isValid(t[r],a);if(s)throw`Node '${r}' is invalid at key '${s}'`;["bottom","top","left","right"].forEach(e=>{"string"==typeof t[r][e]&&(t[r][e]={text:t[r][e]})});const o=e.renderNode(t[r]);o&&n.g.push(o)});const s=e.getBounds(t);return e.toXML(n,s)}};return e})},{"../resources.json":void 0,"./utils":41,"xml-js":32}],41:[function(t,e,r){const n={merge:(t,e)=>{if(typeof t!=typeof e)return t;if(t.length&&!e.length)return t;if(t.length&&e.length)return e;if("object"==typeof t){const r={};return Object.keys(t).forEach(i=>r[i]=n.merge(t[i],e[i])),r}return e},isValid:(t,e)=>{const r=Object.keys(e).filter(t=>"_"!==t);let i,s;for(let o=0;o0&&(s="array"),"object"==typeof e[i]){if(s&&"object"!==s&&s!==e[i]._)return i;const r=n.isValid(s?t[i]:void 0,e[i]);if(r)return i+"."+r}else{if("!"===e[i][0]&&(e[i]=e[i].substr(1),!s))return i;if(s&&s!==e[i])return i}return null},ezClone:t=>JSON.parse(JSON.stringify(t)),newMap:(t,e,r)=>new Array(t).fill(0).map(()=>new Array(e).fill(r))};e.exports=n},{}]},{},[38]); \ No newline at end of file diff --git a/docs/fa-diagrams.min.js b/docs/fa-diagrams.min.js index 74b4fde..60af52f 100644 --- a/docs/fa-diagrams.min.js +++ b/docs/fa-diagrams.min.js @@ -1 +1 @@ -!function(){return function t(e,r,n){function i(o,a){if(!r[o]){if(!e[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){return i(e[o][1][t]||t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o0?n-4:n,f=0;f>16&255,a[u++]=e>>8&255,a[u++]=255&e;2===o&&(e=i[t.charCodeAt(f)]<<2|i[t.charCodeAt(f+1)]>>4,a[u++]=255&e);1===o&&(e=i[t.charCodeAt(f)]<<10|i[t.charCodeAt(f+1)]<<4|i[t.charCodeAt(f+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e);return a},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,s=[],o=0,a=r-i;oa?a:o+16383));1===i?(e=t[r-1],s.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],s.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return s.join("")};for(var n=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,s,o=[],a=e;a>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(t,e,r){},{}],3:[function(t,e,r){(function(e){"use strict";var n=t("base64-js"),i=t("ieee754");r.Buffer=e,r.SlowBuffer=function(t){+t!=t&&(t=0);return e.alloc(+t)},r.INSPECT_MAX_BYTES=50;var s=2147483647;function o(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=e.prototype,r}function e(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return a(t,e,r)}function a(t,r,n){if("string"==typeof t)return function(t,r){"string"==typeof r&&""!==r||(r="utf8");if(!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|h(t,r),i=o(n),s=i.write(t,r);s!==n&&(i=i.slice(0,s));return i}(t,r);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(P(t,ArrayBuffer)||t&&P(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function h(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||P(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var s=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return B(t).length;default:if(s)return i?-1:j(t).length;r=(""+r).toLowerCase(),s=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,r,n,i,s){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),U(n=+n)&&(n=s?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(s)return-1;n=t.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof r&&(r=e.from(r,i)),e.isBuffer(r))return 0===r.length?-1:g(t,r,n,i,s);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):g(t,[r],n,i,s);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,i){var s,o=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,a/=2,u/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var c=-1;for(s=r;sa&&(r=a-u),s=r;s>=0;s--){for(var f=!0,h=0;hi&&(n=i):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>8,i=r%256,s.push(i),s.push(n);return s}(e,t.length-r),t,r,n)}function _(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:l>223?3:l>191?2:1;if(i+f<=r)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)>127&&(c=u);break;case 3:s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(u=(15&l)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return A(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return _(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},e.prototype.toLocaleString=e.prototype.toString,e.prototype.equals=function(t){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===e.compare(this,t)},e.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},e.prototype.compare=function(t,r,n,i,s){if(P(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===s&&(s=this.length),r<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),c=t.slice(r,n),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return y(this,t,e,r);case"ascii":return b(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function A(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function F(t,r,n,i,s,o){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>s||rt.length)throw new RangeError("Index out of range")}function I(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function O(t,e,r,n,s){return e=+e,r>>>=0,s||I(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,s){return e=+e,r>>>=0,s||I(t,0,r,8),i.write(t,e,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;t=~~t,r=void 0===r?n:~~r,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),r<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,e>>>=0,r||k(t,e,this.length);for(var n=this[t],i=1,s=0;++s>>=0,e>>>=0,r||k(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},e.prototype.readUInt8=function(t,e){return t>>>=0,e||k(t,1,this.length),this[t]},e.prototype.readUInt16LE=function(t,e){return t>>>=0,e||k(t,2,this.length),this[t]|this[t+1]<<8},e.prototype.readUInt16BE=function(t,e){return t>>>=0,e||k(t,2,this.length),this[t]<<8|this[t+1]},e.prototype.readUInt32LE=function(t,e){return t>>>=0,e||k(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},e.prototype.readUInt32BE=function(t,e){return t>>>=0,e||k(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},e.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||k(t,e,this.length);for(var n=this[t],i=1,s=0;++s=(i*=128)&&(n-=Math.pow(2,8*e)),n},e.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||k(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*e)),s},e.prototype.readInt8=function(t,e){return t>>>=0,e||k(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},e.prototype.readInt16LE=function(t,e){t>>>=0,e||k(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(t,e){t>>>=0,e||k(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(t,e){return t>>>=0,e||k(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},e.prototype.readInt32BE=function(t,e){return t>>>=0,e||k(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},e.prototype.readFloatLE=function(t,e){return t>>>=0,e||k(t,4,this.length),i.read(this,t,!0,23,4)},e.prototype.readFloatBE=function(t,e){return t>>>=0,e||k(t,4,this.length),i.read(this,t,!1,23,4)},e.prototype.readDoubleLE=function(t,e){return t>>>=0,e||k(t,8,this.length),i.read(this,t,!0,52,8)},e.prototype.readDoubleBE=function(t,e){return t>>>=0,e||k(t,8,this.length),i.read(this,t,!1,52,8)},e.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||F(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,n)||F(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},e.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,255,0),this[e]=255&t,e+1},e.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},e.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},e.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},e.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},e.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},e.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeFloatLE=function(t,e,r){return O(this,t,e,!0,r)},e.prototype.writeFloatBE=function(t,e,r){return O(this,t,e,!1,r)},e.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},e.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},e.prototype.copy=function(t,r,n,i){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,i),r);return s},e.prototype.fill=function(t,r,n,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!e.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var s=t.charCodeAt(0);("utf8"===i&&s<128||"latin1"===i)&&(t=s)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function B(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function R(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function P(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function U(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:6}],4:[function(t,e,r){(function(t){function e(t){return Object.prototype.toString.call(t)}r.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},r.isBoolean=function(t){return"boolean"==typeof t},r.isNull=function(t){return null===t},r.isNullOrUndefined=function(t){return null==t},r.isNumber=function(t){return"number"==typeof t},r.isString=function(t){return"string"==typeof t},r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=function(t){return void 0===t},r.isRegExp=function(t){return"[object RegExp]"===e(t)},r.isObject=function(t){return"object"==typeof t&&null!==t},r.isDate=function(t){return"[object Date]"===e(t)},r.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},r.isFunction=function(t){return"function"==typeof t},r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t.isBuffer}).call(this,{isBuffer:t("../../is-buffer/index.js")})},{"../../is-buffer/index.js":8}],5:[function(t,e,r){var n=Object.create||function(t){var e=function(){};return e.prototype=t,new e},i=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return r},s=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}e.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var a,u=10;try{var l={};Object.defineProperty&&Object.defineProperty(l,"x",{value:0}),a=0===l.x}catch(t){a=!1}function c(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function f(t,e,r,i){var s,o,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),a=o[e]):(o=t._events=n(null),t._eventsCount=0),a){if("function"==typeof a?a=o[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),!a.warned&&(s=c(t))&&s>0&&a.length>s){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else a=o[e]=r,++t._eventsCount;return t}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e1&&(e=arguments[1]),e instanceof Error)throw e;var u=new Error('Unhandled "error" event. ('+e+")");throw u.context=e,u}if(!(r=o[t]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var n=t.length,i=m(t,n),s=0;s=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,s=o;break}if(s<0)return this;0===s?r.shift():function(t,e){for(var r=e,n=r+1,i=t.length;n=0;s--)this.removeListener(t,e[s]);return this},o.prototype.listeners=function(t){return d(this,t,!0)},o.prototype.rawListeners=function(t){return d(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},o.prototype.listenerCount=g,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],6:[function(t,e,r){r.read=function(t,e,r,n,i){var s,o,a=8*i-n-1,u=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,p=t[e+f];for(f+=h,s=p&(1<<-c)-1,p>>=-c,c+=a;c>0;s=256*s+t[e+f],f+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===s)s=1-l;else{if(s===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),s-=l}return(p?-1:1)*o*Math.pow(2,s-n)},r.write=function(t,e,r,n,i,s){var o,a,u,l=8*s-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=c?(a=0,o=c):o+f>=1?(a=(e*u-1)*Math.pow(2,i),o+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,l-=8);t[r+p-d]|=128*g}},{}],7:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}],8:[function(t,e,r){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],9:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],10:[function(t,e,r){(function(t){"use strict";void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,r)});case 3:return t.nextTick(function(){e.call(null,r,n)});case 4:return t.nextTick(function(){e.call(null,r,n,i)});default:for(s=new Array(a-1),o=0;o1)for(var r=1;r0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===l.prototype||(e=function(t){return l.from(t)}(e)),n?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):E(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?E(t,o,e,!1):N(t,o)):E(t,o,e,!1))):n||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=_?t=_:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function T(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(p("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(A,t):A(t))}function A(t){p("emit readable"),t.emit("readable"),F(t)}function N(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(S,t,e))}function S(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;ts.length?s.length:t;if(o===s.length?i+=s:i+=s.slice(0,t),0===(t-=o)){o===s.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=l.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var s=n.data,o=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,o),0===(t-=o)){o===s.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=s.slice(o));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function O(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(L,e,t))}function L(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function M(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return p("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?O(this):T(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&O(this),null;var n,i=e.needReadable;return p("need readable",i),(0===e.length||e.length-t0?I(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&O(this)),null!==n&&this.emit("data",n),n},w.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(t,e){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,p("pipe count=%d opts=%j",s.pipesCount,e);var u=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?c:w;function l(e,r){p("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),t.removeListener("close",y),t.removeListener("finish",b),t.removeListener("drain",f),t.removeListener("error",m),t.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",g),h=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function c(){p("onend"),t.end()}s.endEmitted?i.nextTick(u):n.once("end",u),t.on("unpipe",l);var f=function(t){return function(){var e=t._readableState;p("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,F(t))}}(n);t.on("drain",f);var h=!1;var d=!1;function g(e){p("ondata"),d=!1,!1!==t.write(e)||d||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==M(s.pipes,t))&&!h&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function m(e){p("onerror",e),w(),t.removeListener("error",m),0===a(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",b),w()}function b(){p("onfinish"),t.removeListener("close",y),w()}function w(){p("unpipe"),n.unpipe(t)}return n.on("data",g),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",m),t.once("close",y),t.once("finish",b),t.emit("pipe",n),s.flowing||(p("pipe resume"),n.resume()),t},w.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s-1?i:s.nextTick;b.WritableState=y;var l=t("core-util-is");l.inherits=t("inherits");var c={deprecate:t("util-deprecate")},f=t("./internal/streams/stream"),h=t("safe-buffer").Buffer,p=n.Uint8Array||function(){};var d,g=t("./internal/streams/destroy");function m(){}function y(e,r){a=a||t("./_stream_duplex"),e=e||{};var n=r instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,l=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(s.nextTick(i,n),s.nextTick(T,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),T(t,e))}(t,r,n,e,i);else{var o=_(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||E(t,r),n?u(v,t,r,o,i):v(t,r,o,i)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function b(e){if(a=a||t("./_stream_duplex"),!(d.call(b,this)||this instanceof a))return new b(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function v(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),T(t,e)}function E(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),s=e.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,w(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,f=r.callback;if(w(t,e,!1,e.objectMode?1:l.length,l,c,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function _(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),T(t,e)})}function T(t,e){var r=_(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,s.nextTick(x,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}l.inherits(b,f),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(t){return!!d.call(this,t)||this===b&&(t&&t._writableState instanceof y)}})):d=function(t){return t instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(t,e,r){var n,i=this._writableState,o=!1,a=!i.objectMode&&(n=t,h.isBuffer(n)||n instanceof p);return a&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=m),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),s.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var i=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),s.nextTick(n,o),i=!1),i}(this,i,t,r))&&(i.pendingcb++,o=function(t,e,r,n,i,s){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,r));return e}(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,T(t,e),r&&(e.finished?s.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),b.prototype.destroy=g.destroy,b.prototype._undestroy=g.undestroy,b.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{"./_stream_duplex":13,"./internal/streams/destroy":19,"./internal/streams/stream":20,_process:11,"core-util-is":4,inherits:7,"process-nextick-args":10,"safe-buffer":25,timers:29,"util-deprecate":30}],18:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("util");e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,s=n.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=s,i=a,e.copy(r,i),a+=o.data.length,o=o.next;return s},t}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},{"safe-buffer":25,util:2}],19:[function(t,e,r){"use strict";var n=t("process-nextick-args");function i(t,e){t.emit("error",e)}e.exports={destroy:function(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(n.nextTick(i,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":10}],20:[function(t,e,r){e.exports=t("events").EventEmitter},{events:5}],21:[function(t,e,r){e.exports=t("./readable").PassThrough},{"./readable":22}],22:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":13,"./lib/_stream_passthrough.js":14,"./lib/_stream_readable.js":15,"./lib/_stream_transform.js":16,"./lib/_stream_writable.js":17}],23:[function(t,e,r){e.exports=t("./readable").Transform},{"./readable":22}],24:[function(t,e,r){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":17}],25:[function(t,e,r){var n=t("buffer"),i=n.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,r),r.Buffer=o),s(i,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:3}],26:[function(t,e,r){(function(e){!function(r){r.parser=function(t,e){return new s(t,e)},r.SAXParser=s,r.SAXStream=a,r.createStream=function(t,e){return new a(t,e)},r.MAX_BUFFER_LENGTH=65536;var n,i=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function s(t,e){if(!(this instanceof s))return new s(t,e);!function(t){for(var e=0,r=i.length;e"===n?(C(this,"onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=A.TEXT):b(n)?(this.state=A.SGML_DECL_QUOTED,this.sgmlDecl+=n):this.sgmlDecl+=n;continue;case A.SGML_DECL_QUOTED:n===this.q&&(this.state=A.SGML_DECL,this.q=""),this.sgmlDecl+=n;continue;case A.DOCTYPE:">"===n?(this.state=A.TEXT,C(this,"ondoctype",this.doctype),this.doctype=!0):(this.doctype+=n,"["===n?this.state=A.DOCTYPE_DTD:b(n)&&(this.state=A.DOCTYPE_QUOTED,this.q=n));continue;case A.DOCTYPE_QUOTED:this.doctype+=n,n===this.q&&(this.q="",this.state=A.DOCTYPE);continue;case A.DOCTYPE_DTD:this.doctype+=n,"]"===n?this.state=A.DOCTYPE:b(n)&&(this.state=A.DOCTYPE_DTD_QUOTED,this.q=n);continue;case A.DOCTYPE_DTD_QUOTED:this.doctype+=n,n===this.q&&(this.state=A.DOCTYPE_DTD,this.q="");continue;case A.COMMENT:"-"===n?this.state=A.COMMENT_ENDING:this.comment+=n;continue;case A.COMMENT_ENDING:"-"===n?(this.state=A.COMMENT_ENDED,this.comment=F(this.opt,this.comment),this.comment&&C(this,"oncomment",this.comment),this.comment=""):(this.comment+="-"+n,this.state=A.COMMENT);continue;case A.COMMENT_ENDED:">"!==n?(L(this,"Malformed comment"),this.comment+="--"+n,this.state=A.COMMENT):this.state=A.TEXT;continue;case A.CDATA:"]"===n?this.state=A.CDATA_ENDING:this.cdata+=n;continue;case A.CDATA_ENDING:"]"===n?this.state=A.CDATA_ENDING_2:(this.cdata+="]"+n,this.state=A.CDATA);continue;case A.CDATA_ENDING_2:">"===n?(this.cdata&&C(this,"oncdata",this.cdata),C(this,"onclosecdata"),this.cdata="",this.state=A.TEXT):"]"===n?this.cdata+="]":(this.cdata+="]]"+n,this.state=A.CDATA);continue;case A.PROC_INST:"?"===n?this.state=A.PROC_INST_ENDING:y(n)?this.state=A.PROC_INST_BODY:this.procInstName+=n;continue;case A.PROC_INST_BODY:if(!this.procInstBody&&y(n))continue;"?"===n?this.state=A.PROC_INST_ENDING:this.procInstBody+=n;continue;case A.PROC_INST_ENDING:">"===n?(C(this,"onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=A.TEXT):(this.procInstBody+="?"+n,this.state=A.PROC_INST_BODY);continue;case A.OPEN_TAG:v(d,n)?this.tagName+=n:(M(this),">"===n?B(this):"/"===n?this.state=A.OPEN_TAG_SLASH:(y(n)||L(this,"Invalid character in tag name"),this.state=A.ATTRIB));continue;case A.OPEN_TAG_SLASH:">"===n?(B(this,!0),R(this)):(L(this,"Forward-slash in opening tag not followed by >"),this.state=A.ATTRIB);continue;case A.ATTRIB:if(y(n))continue;">"===n?B(this):"/"===n?this.state=A.OPEN_TAG_SLASH:v(p,n)?(this.attribName=n,this.attribValue="",this.state=A.ATTRIB_NAME):L(this,"Invalid attribute name");continue;case A.ATTRIB_NAME:"="===n?this.state=A.ATTRIB_VALUE:">"===n?(L(this,"Attribute without value"),this.attribValue=this.attribName,j(this),B(this)):y(n)?this.state=A.ATTRIB_NAME_SAW_WHITE:v(d,n)?this.attribName+=n:L(this,"Invalid attribute name");continue;case A.ATTRIB_NAME_SAW_WHITE:if("="===n)this.state=A.ATTRIB_VALUE;else{if(y(n))continue;L(this,"Attribute without value"),this.tag.attributes[this.attribName]="",this.attribValue="",C(this,"onattribute",{name:this.attribName,value:""}),this.attribName="",">"===n?B(this):v(p,n)?(this.attribName=n,this.state=A.ATTRIB_NAME):(L(this,"Invalid attribute name"),this.state=A.ATTRIB)}continue;case A.ATTRIB_VALUE:if(y(n))continue;b(n)?(this.q=n,this.state=A.ATTRIB_VALUE_QUOTED):(L(this,"Unquoted attribute value"),this.state=A.ATTRIB_VALUE_UNQUOTED,this.attribValue=n);continue;case A.ATTRIB_VALUE_QUOTED:if(n!==this.q){"&"===n?this.state=A.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=n;continue}j(this),this.q="",this.state=A.ATTRIB_VALUE_CLOSED;continue;case A.ATTRIB_VALUE_CLOSED:y(n)?this.state=A.ATTRIB:">"===n?B(this):"/"===n?this.state=A.OPEN_TAG_SLASH:v(p,n)?(L(this,"No whitespace between attributes"),this.attribName=n,this.attribValue="",this.state=A.ATTRIB_NAME):L(this,"Invalid attribute name");continue;case A.ATTRIB_VALUE_UNQUOTED:if(!w(n)){"&"===n?this.state=A.ATTRIB_VALUE_ENTITY_U:this.attribValue+=n;continue}j(this),">"===n?B(this):this.state=A.ATTRIB;continue;case A.CLOSE_TAG:if(this.tagName)">"===n?R(this):v(d,n)?this.tagName+=n:this.script?(this.script+=""===n?R(this):L(this,"Invalid characters in closing tag");continue;case A.TEXT_ENTITY:case A.ATTRIB_VALUE_ENTITY_Q:case A.ATTRIB_VALUE_ENTITY_U:var a,c;switch(this.state){case A.TEXT_ENTITY:a=A.TEXT,c="textNode";break;case A.ATTRIB_VALUE_ENTITY_Q:a=A.ATTRIB_VALUE_QUOTED,c="attribValue";break;case A.ATTRIB_VALUE_ENTITY_U:a=A.ATTRIB_VALUE_UNQUOTED,c="attribValue"}";"===n?(this[c]+=P(this),this.entity="",this.state=a):v(this.entity.length?m:g,n)?this.entity+=n:(L(this,"Invalid character in entity name"),this[c]+="&"+this.entity+n,this.entity="",this.state=a);continue;default:throw new Error(this,"Unknown state: "+this.state)}this.position>=this.bufferCheckPosition&&function(t){for(var e=Math.max(r.MAX_BUFFER_LENGTH,10),n=0,s=0,o=i.length;se)switch(i[s]){case"textNode":k(t);break;case"cdata":C(t,"oncdata",t.cdata),t.cdata="";break;case"script":C(t,"onscript",t.script),t.script="";break;default:I(t,"Max buffer length exceeded: "+i[s])}n=Math.max(n,a)}var u=r.MAX_BUFFER_LENGTH-n;t.bufferCheckPosition=u+t.position}(this);return this},resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var t;k(t=this),""!==t.cdata&&(C(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(C(t,"onscript",t.script),t.script="")}};try{n=t("stream").Stream}catch(t){n=function(){}}var o=r.EVENTS.filter(function(t){return"error"!==t&&"end"!==t});function a(t,e){if(!(this instanceof a))return new a(t,e);n.apply(this),this._parser=new s(t,e),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(t){r.emit("error",t),r._parser.error=null},this._decoder=null,o.forEach(function(t){Object.defineProperty(r,"on"+t,{get:function(){return r._parser["on"+t]},set:function(e){if(!e)return r.removeAllListeners(t),r._parser["on"+t]=e,e;r.on(t,e)},enumerable:!0,configurable:!1})})}a.prototype=Object.create(n.prototype,{constructor:{value:a}}),a.prototype.write=function(r){if("function"==typeof e&&"function"==typeof e.isBuffer&&e.isBuffer(r)){if(!this._decoder){var n=t("string_decoder").StringDecoder;this._decoder=new n("utf8")}r=this._decoder.write(r)}return this._parser.write(r.toString()),this.emit("data",r),!0},a.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},a.prototype.on=function(t,e){var r=this;return r._parser["on"+t]||-1===o.indexOf(t)||(r._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),r.emit.apply(r,e)}),n.prototype.on.call(r,t,e)};var u="[CDATA[",l="DOCTYPE",c="http://www.w3.org/XML/1998/namespace",f="http://www.w3.org/2000/xmlns/",h={xml:c,xmlns:f},p=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,d=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,g=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,m=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function y(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function b(t){return'"'===t||"'"===t}function w(t){return">"===t||y(t)}function v(t,e){return t.test(e)}function E(t,e){return!v(t,e)}var _,x,T,A=0;for(var N in r.STATE={BEGIN:A++,BEGIN_WHITESPACE:A++,TEXT:A++,TEXT_ENTITY:A++,OPEN_WAKA:A++,SGML_DECL:A++,SGML_DECL_QUOTED:A++,DOCTYPE:A++,DOCTYPE_QUOTED:A++,DOCTYPE_DTD:A++,DOCTYPE_DTD_QUOTED:A++,COMMENT_STARTING:A++,COMMENT:A++,COMMENT_ENDING:A++,COMMENT_ENDED:A++,CDATA:A++,CDATA_ENDING:A++,CDATA_ENDING_2:A++,PROC_INST:A++,PROC_INST_BODY:A++,PROC_INST_ENDING:A++,OPEN_TAG:A++,OPEN_TAG_SLASH:A++,ATTRIB:A++,ATTRIB_NAME:A++,ATTRIB_NAME_SAW_WHITE:A++,ATTRIB_VALUE:A++,ATTRIB_VALUE_QUOTED:A++,ATTRIB_VALUE_CLOSED:A++,ATTRIB_VALUE_UNQUOTED:A++,ATTRIB_VALUE_ENTITY_Q:A++,ATTRIB_VALUE_ENTITY_U:A++,CLOSE_TAG:A++,CLOSE_TAG_SAW_WHITE:A++,SCRIPT:A++,SCRIPT_ENDING:A++},r.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},r.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(r.ENTITIES).forEach(function(t){var e=r.ENTITIES[t],n="number"==typeof e?String.fromCharCode(e):e;r.ENTITIES[t]=n}),r.STATE)r.STATE[r.STATE[N]]=N;function S(t,e,r){t[e]&&t[e](r)}function C(t,e,r){t.textNode&&k(t),S(t,e,r)}function k(t){t.textNode=F(t.opt,t.textNode),t.textNode&&S(t,"ontext",t.textNode),t.textNode=""}function F(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function I(t,e){return k(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,S(t,"onerror",e),t}function O(t){return t.sawRoot&&!t.closedRoot&&L(t,"Unclosed root tag"),t.state!==A.BEGIN&&t.state!==A.BEGIN_WHITESPACE&&t.state!==A.TEXT&&I(t,"Unexpected end"),k(t),t.c="",t.closed=!0,S(t,"onend"),s.call(t,t.strict,t.opt),t}function L(t,e){if("object"!=typeof t||!(t instanceof s))throw new Error("bad call to strictFail");t.strict&&I(t,e)}function M(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,r=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(r.ns=e.ns),t.attribList.length=0,C(t,"onopentagstart",r)}function D(t,e){var r=t.indexOf(":")<0?["",t]:t.split(":"),n=r[0],i=r[1];return e&&"xmlns"===t&&(n="xmlns",i=""),{prefix:n,local:i}}function j(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var e=D(t.attribName,!0),r=e.prefix,n=e.local;if("xmlns"===r)if("xml"===n&&t.attribValue!==c)L(t,"xml: prefix must be bound to "+c+"\nActual: "+t.attribValue);else if("xmlns"===n&&t.attribValue!==f)L(t,"xmlns: prefix must be bound to "+f+"\nActual: "+t.attribValue);else{var i=t.tag,s=t.tags[t.tags.length-1]||t;i.ns===s.ns&&(i.ns=Object.create(s.ns)),i.ns[n]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,C(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function B(t,e){if(t.opt.xmlns){var r=t.tag,n=D(t.tagName);r.prefix=n.prefix,r.local=n.local,r.uri=r.ns[n.prefix]||"",r.prefix&&!r.uri&&(L(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),r.uri=n.prefix);var i=t.tags[t.tags.length-1]||t;r.ns&&i.ns!==r.ns&&Object.keys(r.ns).forEach(function(e){C(t,"onopennamespace",{prefix:e,uri:r.ns[e]})});for(var s=0,o=t.attribList.length;s",t.tagName="",void(t.state=A.SCRIPT);C(t,"onscript",t.script),t.script=""}var e=t.tags.length,r=t.tagName;t.strict||(r=r[t.looseCase]());for(var n=r;e--;){if(t.tags[e].name===n)break;L(t,"Unexpected close tag")}if(e<0)return L(t,"Unmatched closing tag: "+t.tagName),t.textNode+="",void(t.state=A.TEXT);t.tagName=r;for(var i=t.tags.length;i-- >e;){var s=t.tag=t.tags.pop();t.tagName=t.tag.name,C(t,"onclosetag",t.tagName);var o={};for(var a in s.ns)o[a]=s.ns[a];var u=t.tags[t.tags.length-1]||t;t.opt.xmlns&&s.ns!==u.ns&&Object.keys(s.ns).forEach(function(e){var r=s.ns[e];C(t,"onclosenamespace",{prefix:e,uri:r})})}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=A.TEXT}function P(t){var e,r=t.entity,n=r.toLowerCase(),i="";return t.ENTITIES[r]?t.ENTITIES[r]:t.ENTITIES[n]?t.ENTITIES[n]:("#"===(r=n).charAt(0)&&("x"===r.charAt(1)?(r=r.slice(2),i=(e=parseInt(r,16)).toString(16)):(r=r.slice(1),i=(e=parseInt(r,10)).toString(10))),r=r.replace(/^0+/,""),isNaN(e)||i.toLowerCase()!==r?(L(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(e))}function U(t,e){"<"===e?(t.state=A.OPEN_WAKA,t.startTagPosition=t.position):y(e)||(L(t,"Non-whitespace before first tag."),t.textNode=e,t.state=A.TEXT)}function K(t,e){var r="";return e1114111||x(o)!==o)throw RangeError("Invalid code point: "+o);o<=65535?r.push(o):(t=55296+((o-=65536)>>10),e=o%1024+56320,r.push(t,e)),(n+1===i||r.length>16384)&&(s+=_.apply(null,r),r.length=0)}return s},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:T,configurable:!0,writable:!0}):String.fromCodePoint=T)}(void 0===r?this.sax={}:r)}).call(this,t("buffer").Buffer)},{buffer:3,stream:27,string_decoder:28}],27:[function(t,e,r){e.exports=i;var n=t("events").EventEmitter;function i(){n.call(this)}t("inherits")(i,n),i.Readable=t("readable-stream/readable.js"),i.Writable=t("readable-stream/writable.js"),i.Duplex=t("readable-stream/duplex.js"),i.Transform=t("readable-stream/transform.js"),i.PassThrough=t("readable-stream/passthrough.js"),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",s),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",u));var o=!1;function a(){o||(o=!0,t.end())}function u(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function l(t){if(c(),0===n.listenerCount(this,"error"))throw t}function c(){r.removeListener("data",i),t.removeListener("drain",s),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",l),t.removeListener("error",l),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",l),t.on("error",l),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},{events:5,inherits:7,"readable-stream/duplex.js":12,"readable-stream/passthrough.js":21,"readable-stream/readable.js":22,"readable-stream/transform.js":23,"readable-stream/writable.js":24}],28:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.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!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=l,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=c,this.end=f,e=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}r.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":25}],29:[function(t,e,r){(function(e,n){var i=t("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,a={},u=0;function l(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new l(s.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new l(s.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},r.setImmediate="function"==typeof e?e:function(t){var e=u++,n=!(arguments.length<2)&&o.call(arguments,1);return a[e]=!0,i(function(){a[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))}),e},r.clearImmediate="function"==typeof n?n:function(t){delete a[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":11,timers:29}],30:[function(t,e,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],31:[function(t,e,r){e.exports={isArray:function(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}}},{}],32:[function(t,e,r){var n=t("./xml2js"),i=t("./xml2json"),s=t("./js2xml"),o=t("./json2xml");e.exports={xml2js:n,xml2json:i,js2xml:s,json2xml:o}},{"./js2xml":33,"./json2xml":34,"./xml2js":36,"./xml2json":37}],33:[function(t,e,r){var n,i,s=t("./options-helper"),o=t("./array-helper").isArray;function a(t,e,r){return(!r&&t.spaces?"\n":"")+Array(e+1).join(t.spaces)}function u(t,e,r){if(e.ignoreAttributes)return"";"attributesFn"in e&&(t=e.attributesFn(t,i,n));var s,o,u,l,c=[];for(s in t)t.hasOwnProperty(s)&&null!==t[s]&&void 0!==t[s]&&(l=e.noQuotesForNativeAttributes&&"string"!=typeof t[s]?"":'"',o=(o=""+t[s]).replace(/"/g,"""),u="attributeNameFn"in e?e.attributeNameFn(s,o,i,n):s,c.push(e.spaces&&e.indentAttributes?a(e,r+1,!1):" "),c.push(u+"="+l+("attributeValueFn"in e?e.attributeValueFn(o,s,i,n):o)+l));return t&&Object.keys(t).length&&e.spaces&&e.indentAttributes&&c.push(a(e,r,!1)),c.join("")}function l(t,e,r){return n=t,i="xml",e.ignoreDeclaration?"":""}function c(t,e,r){if(e.ignoreInstruction)return"";var s;for(s in t)if(t.hasOwnProperty(s))break;var o="instructionNameFn"in e?e.instructionNameFn(s,t[s],i,n):s;if("object"==typeof t[s])return n=t,i=o,"";var a=t[s]?t[s]:"";return"instructionFn"in e&&(a=e.instructionFn(a,s,i,n)),""}function f(t,e){return e.ignoreComment?"":"\x3c!--"+("commentFn"in e?e.commentFn(t,i,n):t)+"--\x3e"}function h(t,e){return e.ignoreCdata?"":"","]]]]>"))+"]]>"}function p(t,e){return e.ignoreDoctype?"":""}function d(t,e){return e.ignoreText?"":(t=(t=(t=""+t).replace(/&/g,"&")).replace(/&/g,"&").replace(//g,">"),"textFn"in e?e.textFn(t,i,n):t)}function g(t,e,r,s){return t.reduce(function(t,o){var l=a(e,r,s&&!t);switch(o.type){case"element":return t+l+function(t,e,r){n=t,i=t.name;var s=[],o="elementNameFn"in e?e.elementNameFn(t.name,t):t.name;s.push("<"+o),t[e.attributesKey]&&s.push(u(t[e.attributesKey],e,r));var a=t[e.elementsKey]&&t[e.elementsKey].length||t[e.attributesKey]&&"preserve"===t[e.attributesKey]["xml:space"];return a||(a="fullTagEmptyElementFn"in e?e.fullTagEmptyElementFn(t.name,t):e.fullTagEmptyElement),a?(s.push(">"),t[e.elementsKey]&&t[e.elementsKey].length&&(s.push(g(t[e.elementsKey],e,r+1)),n=t,i=t.name),s.push(e.spaces&&function(t,e){var r;if(t.elements&&t.elements.length)for(r=0;r")):s.push("/>"),s.join("")}(o,e,r);case"comment":return t+l+f(o[e.commentKey],e);case"doctype":return t+l+p(o[e.doctypeKey],e);case"cdata":return t+(e.indentCdata?l:"")+h(o[e.cdataKey],e);case"text":return t+(e.indentText?l:"")+d(o[e.textKey],e);case"instruction":var m={};return m[o[e.nameKey]]=o[e.attributesKey]?o:o[e.instructionKey],t+(e.indentInstruction?l:"")+c(m,e,r)}},"")}function m(t,e,r){var n;for(n in t)if(t.hasOwnProperty(n))switch(n){case e.parentKey:case e.attributesKey:break;case e.textKey:if(e.indentText||r)return!0;break;case e.cdataKey:if(e.indentCdata||r)return!0;break;case e.instructionKey:if(e.indentInstruction||r)return!0;break;case e.doctypeKey:case e.commentKey:default:return!0}return!1}function y(t,e,r,s,o){n=t,i=e;var l="elementNameFn"in r?r.elementNameFn(e,t):e;if(void 0===t||null===t||""===t)return"fullTagEmptyElementFn"in r&&r.fullTagEmptyElementFn(e,t)||r.fullTagEmptyElement?"<"+l+">":"<"+l+"/>";var c=[];if(e){if(c.push("<"+l),"object"!=typeof t)return c.push(">"+d(t,r)+""),c.join("");t[r.attributesKey]&&c.push(u(t[r.attributesKey],r,s));var f=m(t,r,!0)||t[r.attributesKey]&&"preserve"===t[r.attributesKey]["xml:space"];if(f||(f="fullTagEmptyElementFn"in r?r.fullTagEmptyElementFn(e,t):r.fullTagEmptyElement),!f)return c.push("/>"),c.join("");c.push(">")}return c.push(b(t,r,s+1,!1)),n=t,i=e,e&&c.push((o?a(r,s,!1):"")+""),c.join("")}function b(t,e,r,n){var i,s,u,g=[];for(s in t)if(t.hasOwnProperty(s))for(u=o(t[s])?t[s]:[t[s]],i=0;i/g,">")),l("text",t))}function d(t){n.ignoreComment||(n.trim&&(t=t.trim()),l("comment",t))}function g(t){var e=i[n.parentKey];n.addParent||delete i[n.parentKey],i=e}function m(t){n.ignoreCdata||(n.trim&&(t=t.trim()),l("cdata",t))}function y(t){n.ignoreDoctype||(t=t.replace(/^ /,""),n.trim&&(t=t.trim()),l("doctype",t))}function b(t){t.note=t}e.exports=function(t,e){var r=s.parser(!0,{}),a={};if(i=a,n=function(t){return n=o.copyOptions(t),o.ensureFlagExists("ignoreDeclaration",n),o.ensureFlagExists("ignoreInstruction",n),o.ensureFlagExists("ignoreAttributes",n),o.ensureFlagExists("ignoreText",n),o.ensureFlagExists("ignoreComment",n),o.ensureFlagExists("ignoreCdata",n),o.ensureFlagExists("ignoreDoctype",n),o.ensureFlagExists("compact",n),o.ensureFlagExists("alwaysChildren",n),o.ensureFlagExists("addParent",n),o.ensureFlagExists("trim",n),o.ensureFlagExists("nativeType",n),o.ensureFlagExists("nativeTypeAttributes",n),o.ensureFlagExists("sanitize",n),o.ensureFlagExists("instructionHasAttributes",n),o.ensureFlagExists("captureSpacesBetweenElements",n),o.ensureAlwaysArrayExists(n),o.ensureKeyExists("declaration",n),o.ensureKeyExists("instruction",n),o.ensureKeyExists("attributes",n),o.ensureKeyExists("text",n),o.ensureKeyExists("comment",n),o.ensureKeyExists("cdata",n),o.ensureKeyExists("doctype",n),o.ensureKeyExists("type",n),o.ensureKeyExists("name",n),o.ensureKeyExists("elements",n),o.ensureKeyExists("parent",n),o.checkFnExists("doctype",n),o.checkFnExists("instruction",n),o.checkFnExists("cdata",n),o.checkFnExists("comment",n),o.checkFnExists("text",n),o.checkFnExists("instructionName",n),o.checkFnExists("elementName",n),o.checkFnExists("attributeName",n),o.checkFnExists("attributeValue",n),o.checkFnExists("attributes",n),n}(e),r.opt={strictEntities:!0},r.onopentag=h,r.ontext=p,r.oncomment=d,r.onclosetag=g,r.onerror=b,r.oncdata=m,r.ondoctype=y,r.onprocessinginstruction=f,r.write(t).close(),a[n.elementsKey]){var u=a[n.elementsKey];delete a[n.elementsKey],a[n.elementsKey]=u,delete a.text}return a}},{"./array-helper":31,"./options-helper":35,sax:26}],37:[function(t,e,r){var n=t("./options-helper"),i=t("./xml2js");e.exports=function(t,e){var r,s,o;return r=function(t){var e=n.copyOptions(t);return n.ensureSpacesExists(e),e}(e),s=i(t,r),o="compact"in r&&r.compact?"_parent":"parent",("addParent"in r&&r.addParent?JSON.stringify(s,function(t,e){return t===o?"_":e},r.spaces):JSON.stringify(s,null,r.spaces)).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}},{"./options-helper":35,"./xml2js":36}],38:[function(t,e,r){(function(r){const n=t("./placing"),i=t("./rendering"),s={compute:t=>{const e=t.options||{};let r={};(t.nodes||[]).filter(t=>"string"==typeof t.name).forEach(t=>r[t.name]=t);let s=(t.links||[]).filter(t=>t.from&&t.to);if(s.filter(t=>!r[t.from]).forEach(t=>console.warn(`unknown source node "${t.from}"`)),s.filter(t=>!r[t.to]).forEach(t=>console.warn(`unknown destination node "${t.to}"`)),s=s.filter(t=>r[t.from]&&r[t.to]),!(r=n(e.placing).compute(r,s)))throw"Failed to place nodes";return i(e.rendering).compute(r,s)}};e.exports=s,r.faDiagrams=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./placing":39,"./rendering":40}],39:[function(t,e,r){const n=t("./utils"),i={name:"!string",x:"number",y:"number"},s={from:"!string",to:"!string",direction:"string"},o={"max-link-length":3,diagonals:!0};e.exports=(t=>{t=n.merge(o,t);const e={getBounds:t=>{const e=Object.values(t).filter(t=>void 0!==t.x);if(0===e.length)return{x:0,y:0,w:0,h:0};let r=null,n=null,i=null,s=null;return e.forEach(t=>{r=null!==r?Math.min(t.x,r):t.x,n=null!==n?Math.min(t.y,n):t.y,i=null!==i?Math.max(t.x,i):t.x,s=null!==s?Math.max(t.y,s):t.y}),{x:r,y:n,w:i-r+1,h:s-n+1}},getNewPos:t=>{const r=e.getBounds(t),i=n.newMap(r.w,r.h,!1);Object.values(t).filter(t=>void 0!==t.x).forEach(t=>{i[t.x-r.x][t.y-r.y]=!0});for(let t=0;t{let n=t[e].x,i=t[e].y,s=t[r].x,o=t[r].y;const a=s-n,u=o-i,l=(t,n)=>i=>i.x===t&&i.y===n&&i.name!==e&&i.name!==r;if(Math.abs(a)>=Math.abs(u)){if(n>s){let t=n;n=s,s=t}for(let e=n;e<=s;e++){let r=Math.round(i+u*(e-n)/a);if(Object.values(t).find(l(e,r)))return!0}}else{if(i>o){let t=i;i=o,o=t}for(let e=i;e<=o;e++){let r=Math.round(n+a*(e-i)/u);if(Object.values(t).find(l(r,e)))return!0}}return!1},getPosition:(e,r,n)=>{const i=e[r],s={maxX:null,maxY:null,minX:null,minY:null,startX:null,startY:null,free:!0},o=(t,r,n,i)=>o=>{if(void 0!==e[o].x){const a=e[o].x,u=e[o].y;s.minX=null!==s.minX?Math.max(a+t,s.minX):a+t,s.maxX=null!==s.maxX?Math.min(a+r,s.maxX):a+r,s.minY=null!==s.minY?Math.max(u+n,s.minY):u+n,s.maxY=null!==s.maxY?Math.min(u+i,s.maxY):u+i,null===s.startX&&(s.startX=Math.abs(i+n)>0?a:1===Math.abs(t)?"minX":"maxX",s.startY=Math.abs(r+t)>0?u:1===Math.abs(n)?"minY":"maxY"),s.free=!1}},a=t["max-link-length"],u=n?a:0;return i.const.beforeX.forEach(o(1,1+a,-u,u)),i.const.beforeY.forEach(o(-u,u,1,1+a)),i.const.afterX.forEach(o(-1-a,-1,-u,u)),i.const.afterY.forEach(o(-u,u,-1-a,-1)),"string"==typeof s.startX&&(s.startX=s[s.startX]),"string"==typeof s.startY&&(s.startY=s[s.startY]),s.minX>s.maxX||s.minY>s.maxY?null:{x:s.startX,y:s.startY,free:s.free}},isValid:(r,n)=>{let i,s,o;const a=Object.values(r).filter(t=>void 0!==t.x);for(let t=0;tMath.pow(t["max-link-length"],2))return!1;switch(i.direction){case"up":case"top":if(o.y-s.y>=0)return!1;break;case"down":case"bottom":if(o.y-s.y<=0)return!1;break;case"left":if(o.x-s.x>=0)return!1;break;case"right":if(o.x-s.x<=0)return!1}if(!t.diagonals&&s.x!==o.x&&s.y!==o.y)return!1}return!0},correctPlacing:t=>{const r=e.getBounds(t);Object.values(t).forEach(t=>{t.x-=r.x,t.y-=r.y})},applyLinks:(r,i,s=0)=>{if(!e.isValid(r,i))return null;const o=Object.keys(r).filter(t=>void 0===r[t].x);if(0===o.length)return r;const a=[],u=(t,o,a)=>{const u=n.ezClone(r);return u[t].x=o,u[t].y=a,e.applyLinks(u,i,s+1)};let l,c,f;for(let n=0;n(Object.keys(t).forEach(e=>{const r=n.isValid(t[e],i);if(r)throw`Node '${e}' is invalid at key '${r}'`}),r.forEach((t,e)=>{const r=n.isValid(t,s);if(r)throw`Link ${e} (${t.from}->${t.to}) is invalid at key '${r}'`}),Object.values(t).forEach(t=>{t.const={beforeX:[],afterX:[],beforeY:[],afterY:[]}}),r.forEach(e=>{if(e.direction)switch(e.direction){case"up":case"top":t[e.from].const.beforeY.push(e.to),t[e.to].const.afterY.push(e.from);break;case"down":case"bottom":t[e.from].const.afterY.push(e.to),t[e.to].const.beforeY.push(e.from);break;case"left":t[e.from].const.beforeX.push(e.to),t[e.to].const.afterX.push(e.from);break;case"right":t[e.from].const.afterX.push(e.to),t[e.to].const.beforeX.push(e.from)}}),(t=e.applyLinks(t,r))&&(e.correctPlacing(t),Object.values(t).forEach(t=>{delete t.const})),t)};return e})},{"./utils":41}],40:[function(t,e,r){const n=t("xml-js"),i=t("./utils");let s={name:"error",height:512,index:[],links:{"arrow-head":{},"arrow-head-reverse":{},"line-start":{},"line-end":{},"dashed-step":{}},icons:{}};try{s=t("../resources.json")}catch(t){console.error("fa-diagrams: SVG resources could not be loaded: "+t)}const o={_:"string",text:"string",icon:{_:"string",path:"string",width:"number",height:"number"},color:"string",font:"string","font-size":"number","font-style":"string",margin:"number","line-height":"number",scale:"number"},a={name:"!string",icon:{_:"string",path:"string",width:"number",height:"number"},x:"!number",y:"!number",color:"string",scale:"number",top:o,bottom:o,left:o,right:o},u={from:"!string",to:"!string",type:"string",color:"string",scale:"number",size:"number",top:o,bottom:o},l={beautify:!1,scale:128,"h-spacing":1.3,color:"black",icons:{scale:1,color:""},links:{scale:1,color:"",size:0},texts:{font:"Arial","font-size":15,"font-style":"normal",color:"",margin:.2,"line-height":1.2}},c={"font-awesome":{fas:"solid",far:"regular",fab:"brands"}};e.exports=(t=>{t=i.merge(l,t);const e={getIcon:t=>{if(!t)return null;if("object"==typeof t)return t.path&&t.path.trim()?(t.height=t.height||t.width||s.height,t.width=t.width||t.height,t):null;if(!t.trim())return null;let e=i.ezClone(s.index);const r=t.trim().split(" ").map(t=>0===t.indexOf("fa-")?t.substr(3):t);for(let t=0;t{const r="v46.059c0 21.382 25.851 32.09 40.971 16.971 l86.059 -86.059c9.373-9.373 9.373-24.569 0-33.941l-86.059-86.059c-15.119-15.119-40.971-4.411-40.971 16.971v46.059",n="v-46.059c0-21.382-25.851-32.09-40.971-16.971l-86.059 86.059c-9.373 9.373-9.373 24.568 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971v-46.059",i="c6.627 0 12 -5.373 12 -12v-56c0 -6.627 -5.373 -12 -12 -12",s="c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12",o=`${s}h56${i}`;switch(t){case"none":return null;default:return`M12 216${s}h${512*e-146.059}${r}z`;case"line":return`M12 216${s}h${512*e-24}${i}z`;case"double":return`M134.059 216${n}h${512*e-268.06}${r}z`;case"split-double":return`M12 126${s}h${512*e-146.059}${r}M134.059 306${n}h${512*e-146.059}${i}z`;case"dashed":const a=Math.floor((512*e-134.059)/168),u=(512*e-134.059-56*a-24)/a;return`M12 216${new Array(a).fill(`${o}m${u} 0`).join("")}v80${r}z`;case"dashed-line":const l=Math.floor(512*e/168),c=(512*e-56*l-24)/(l-1);return`M12 216${new Array(l).fill(o).join(`m${c} 0`)}z`;case"dashed-double":const f=Math.floor((512*e-268.118)/168),h=(512*e-268.118-56*f-24)/(f+1);return`M134.059 216${n}m${h}-80${new Array(f).fill(`${o}m${h} 0`).join("")}v80${r}z`;case"dashed-split-double":const p=Math.floor((512*e-134.059)/168),d=(512*e-134.059-56*p-24)/p;return`M12 126${new Array(p).fill(`${o}m${d} 0`).join("")}v80${r}M134.059 306${n}m${d} -80${new Array(p).fill(`${o}`).join(`m${d} 0`)}z`}},getBounds:t=>{const e=Object.values(t);if(0===e.length)return{w:0,h:0};let r=0,n=0;return e.forEach(t=>{r=Math.max(t.x,r),n=Math.max(t.y,n)}),{w:r+1,h:n+1}},getSvgText:(t,e,r,n)=>{if(!(t=t.trim()).includes("\n"))return{_text:t};const i=[];return t.split("\n").map(t=>t.trim()).forEach((t,s)=>{i.push({_attributes:{x:r,dy:0===s?"0":`${e}em`,"text-anchor":n},_text:t})}),{tspan:i}},renderNode:r=>{const n=e.getIcon(r.icon);if(!n)return null;const i=.4*(r.scale||t.icons.scale),s={_attributes:{transform:`translate(${(r.x+.5)*t["h-spacing"]} ${r.y+.5})`},g:[{_attributes:{transform:`scale(${i/n.height} ${i/n.height}) translate(${-n.width/2} ${-n.height/2})`,stroke:r.color||t.icons.color||void 0,fill:r.color||t.icons.color||void 0},path:{_attributes:{d:n.path}}}]};return["bottom","top","left","right"].forEach(n=>{const i=r[n];if(i&&i.text){const o=i["font-size"]||t.texts["font-size"],a=i.margin||t.texts.margin;let u,l;switch(n){case"bottom":u={x:0,y:1},l="middle";break;case"top":u={x:0,y:-1},l="middle";break;case"left":u={x:-1,y:0},l="end";break;case"right":u={x:1,y:0},l="start"}const c=i["line-height"]||t.texts["line-height"],f=e.getSvgText(i.text,c,u.x*o/2,l),h=f.tspan?f.tspan.length-1:0;f._attributes={"font-family":i.font||t.texts.font,"font-size":o,"text-anchor":l,x:u.x*o/2,y:(u.y+.25)*o-(1-u.y)*h*o*c/2},s.g.push({_attributes:{transform:`translate(${u.x*a} ${u.y*a}) scale(${1/t.scale} ${1/t.scale})`,stroke:i.color||r.color||t.texts.color||t.icons.color||void 0,fill:i.color||r.color||t.texts.color||t.icons.color||void 0},text:f})}}),s},renderLink:(r,n)=>{const i=r[n.from],s=r[n.to],o=((i.x+s.x)/2+.5)*t["h-spacing"],a=(i.y+s.y)/2+.5,u=180*Math.atan2(s.y-i.y,(s.x-i.x)*t["h-spacing"])/Math.PI,l=.4*(n.scale||t.links.scale);let c=n.size||t.links.size;if(!c){let e=Math.abs(s.x-i.x)*t["h-spacing"];e>0&&(e-=.6);let r=Math.abs(s.y-i.y);r>0&&(r-=.6),c=Math.sqrt(Math.pow(e,2)+Math.pow(r,2))/l}const f=e.getLinkPath(n.type,c);return f?{_attributes:{transform:`translate(${o} ${a}) rotate(${u})`},g:{_attributes:{transform:`scale(${l/512} ${l/512}) translate(${-256*c} -256)`,stroke:n.color||t.links.color||void 0,fill:n.color||t.links.color||void 0},path:{_attributes:{d:f}}}}:null},toXML:(e,r)=>{const i={svg:{_attributes:{xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${r.w*t["h-spacing"]} ${r.h}`,width:r.w*t["h-spacing"]*t.scale/.4,height:r.h*t.scale/.4,stroke:t.color,fill:t.color}}};return Object.keys(e).forEach(t=>{i.svg[t]=e[t]}),n.js2xml(i,{compact:!0,spaces:t.beautify?4:0}).replace(/<\/tspan>(\s*){const n={g:[]};Object.keys(t).forEach(r=>{const s=i.isValid(t[r],a);if(s)throw`Node '${r}' is invalid at key '${s}'`;["bottom","top","left","right"].forEach(e=>{"string"==typeof t[r][e]&&(t[r][e]={text:t[r][e]})});const o=e.renderNode(t[r]);o&&n.g.push(o)}),r.forEach((r,s)=>{const o=i.isValid(r,u);if(o)throw`Link ${s} (${r.from}->${r.to}) is invalid at key '${o}'`;["bottom","top"].forEach(t=>{"string"==typeof r[t]&&(r[t]={text:r[t]})});const a=e.renderLink(t,r);a&&n.g.push(a)});const s=e.getBounds(t);return e.toXML(n,s)}};return e})},{"../resources.json":void 0,"./utils":41,"xml-js":32}],41:[function(t,e,r){const n={merge:(t,e)=>{if(typeof t!=typeof e)return t;if(t.length&&!e.length)return t;if(t.length&&e.length)return e;if("object"==typeof t){const r={};return Object.keys(t).forEach(i=>r[i]=n.merge(t[i],e[i])),r}return e},isValid:(t,e)=>{const r=Object.keys(e).filter(t=>"_"!==t);let i,s;for(let o=0;o0&&(s="array"),"object"==typeof e[i]){if(s&&"object"!==s&&s!==e[i]._)return i;const r=n.isValid(s?t[i]:void 0,e[i]);if(r)return i+"."+r}else{if("!"===e[i][0]&&(e[i]=e[i].substr(1),!s))return i;if(s&&s!==e[i])return i}return null},ezClone:t=>JSON.parse(JSON.stringify(t)),newMap:(t,e,r)=>new Array(t).fill(0).map(()=>new Array(e).fill(r))};e.exports=n},{}]},{},[38]); \ No newline at end of file +!function(){return function t(e,r,n){function i(o,a){if(!r[o]){if(!e[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){return i(e[o][1][t]||t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o0?n-4:n,f=0;f>16&255,a[u++]=e>>8&255,a[u++]=255&e;2===o&&(e=i[t.charCodeAt(f)]<<2|i[t.charCodeAt(f+1)]>>4,a[u++]=255&e);1===o&&(e=i[t.charCodeAt(f)]<<10|i[t.charCodeAt(f+1)]<<4|i[t.charCodeAt(f+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e);return a},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,s=[],o=0,a=r-i;oa?a:o+16383));1===i?(e=t[r-1],s.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],s.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return s.join("")};for(var n=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,s,o=[],a=e;a>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(t,e,r){},{}],3:[function(t,e,r){(function(e){"use strict";var n=t("base64-js"),i=t("ieee754");r.Buffer=e,r.SlowBuffer=function(t){+t!=t&&(t=0);return e.alloc(+t)},r.INSPECT_MAX_BYTES=50;var s=2147483647;function o(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=e.prototype,r}function e(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return a(t,e,r)}function a(t,r,n){if("string"==typeof t)return function(t,r){"string"==typeof r&&""!==r||(r="utf8");if(!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|h(t,r),i=o(n),s=i.write(t,r);s!==n&&(i=i.slice(0,s));return i}(t,r);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(P(t,ArrayBuffer)||t&&P(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function h(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||P(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var s=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return B(t).length;default:if(s)return i?-1:j(t).length;r=(""+r).toLowerCase(),s=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,r,n,i,s){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),U(n=+n)&&(n=s?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(s)return-1;n=t.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof r&&(r=e.from(r,i)),e.isBuffer(r))return 0===r.length?-1:g(t,r,n,i,s);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):g(t,[r],n,i,s);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,i){var s,o=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,a/=2,u/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var c=-1;for(s=r;sa&&(r=a-u),s=r;s>=0;s--){for(var f=!0,h=0;hi&&(n=i):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>8,i=r%256,s.push(i),s.push(n);return s}(e,t.length-r),t,r,n)}function _(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:l>223?3:l>191?2:1;if(i+f<=r)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)>127&&(c=u);break;case 3:s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(u=(15&l)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return A(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return _(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},e.prototype.toLocaleString=e.prototype.toString,e.prototype.equals=function(t){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===e.compare(this,t)},e.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},e.prototype.compare=function(t,r,n,i,s){if(P(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===s&&(s=this.length),r<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),c=t.slice(r,n),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return y(this,t,e,r);case"ascii":return b(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function A(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function F(t,r,n,i,s,o){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>s||rt.length)throw new RangeError("Index out of range")}function I(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function O(t,e,r,n,s){return e=+e,r>>>=0,s||I(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,s){return e=+e,r>>>=0,s||I(t,0,r,8),i.write(t,e,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;t=~~t,r=void 0===r?n:~~r,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),r<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,e>>>=0,r||k(t,e,this.length);for(var n=this[t],i=1,s=0;++s>>=0,e>>>=0,r||k(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},e.prototype.readUInt8=function(t,e){return t>>>=0,e||k(t,1,this.length),this[t]},e.prototype.readUInt16LE=function(t,e){return t>>>=0,e||k(t,2,this.length),this[t]|this[t+1]<<8},e.prototype.readUInt16BE=function(t,e){return t>>>=0,e||k(t,2,this.length),this[t]<<8|this[t+1]},e.prototype.readUInt32LE=function(t,e){return t>>>=0,e||k(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},e.prototype.readUInt32BE=function(t,e){return t>>>=0,e||k(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},e.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||k(t,e,this.length);for(var n=this[t],i=1,s=0;++s=(i*=128)&&(n-=Math.pow(2,8*e)),n},e.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||k(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*e)),s},e.prototype.readInt8=function(t,e){return t>>>=0,e||k(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},e.prototype.readInt16LE=function(t,e){t>>>=0,e||k(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(t,e){t>>>=0,e||k(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(t,e){return t>>>=0,e||k(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},e.prototype.readInt32BE=function(t,e){return t>>>=0,e||k(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},e.prototype.readFloatLE=function(t,e){return t>>>=0,e||k(t,4,this.length),i.read(this,t,!0,23,4)},e.prototype.readFloatBE=function(t,e){return t>>>=0,e||k(t,4,this.length),i.read(this,t,!1,23,4)},e.prototype.readDoubleLE=function(t,e){return t>>>=0,e||k(t,8,this.length),i.read(this,t,!0,52,8)},e.prototype.readDoubleBE=function(t,e){return t>>>=0,e||k(t,8,this.length),i.read(this,t,!1,52,8)},e.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||F(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,n)||F(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},e.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,255,0),this[e]=255&t,e+1},e.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},e.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},e.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},e.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},e.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},e.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeFloatLE=function(t,e,r){return O(this,t,e,!0,r)},e.prototype.writeFloatBE=function(t,e,r){return O(this,t,e,!1,r)},e.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},e.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},e.prototype.copy=function(t,r,n,i){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,i),r);return s},e.prototype.fill=function(t,r,n,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!e.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var s=t.charCodeAt(0);("utf8"===i&&s<128||"latin1"===i)&&(t=s)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function B(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function R(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function P(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function U(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:6}],4:[function(t,e,r){(function(t){function e(t){return Object.prototype.toString.call(t)}r.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},r.isBoolean=function(t){return"boolean"==typeof t},r.isNull=function(t){return null===t},r.isNullOrUndefined=function(t){return null==t},r.isNumber=function(t){return"number"==typeof t},r.isString=function(t){return"string"==typeof t},r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=function(t){return void 0===t},r.isRegExp=function(t){return"[object RegExp]"===e(t)},r.isObject=function(t){return"object"==typeof t&&null!==t},r.isDate=function(t){return"[object Date]"===e(t)},r.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},r.isFunction=function(t){return"function"==typeof t},r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t.isBuffer}).call(this,{isBuffer:t("../../is-buffer/index.js")})},{"../../is-buffer/index.js":8}],5:[function(t,e,r){var n=Object.create||function(t){var e=function(){};return e.prototype=t,new e},i=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return r},s=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}e.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var a,u=10;try{var l={};Object.defineProperty&&Object.defineProperty(l,"x",{value:0}),a=0===l.x}catch(t){a=!1}function c(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function f(t,e,r,i){var s,o,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),a=o[e]):(o=t._events=n(null),t._eventsCount=0),a){if("function"==typeof a?a=o[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),!a.warned&&(s=c(t))&&s>0&&a.length>s){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else a=o[e]=r,++t._eventsCount;return t}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e1&&(e=arguments[1]),e instanceof Error)throw e;var u=new Error('Unhandled "error" event. ('+e+")");throw u.context=e,u}if(!(r=o[t]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var n=t.length,i=m(t,n),s=0;s=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,s=o;break}if(s<0)return this;0===s?r.shift():function(t,e){for(var r=e,n=r+1,i=t.length;n=0;s--)this.removeListener(t,e[s]);return this},o.prototype.listeners=function(t){return d(this,t,!0)},o.prototype.rawListeners=function(t){return d(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},o.prototype.listenerCount=g,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],6:[function(t,e,r){r.read=function(t,e,r,n,i){var s,o,a=8*i-n-1,u=(1<>1,c=-7,f=r?i-1:0,h=r?-1:1,p=t[e+f];for(f+=h,s=p&(1<<-c)-1,p>>=-c,c+=a;c>0;s=256*s+t[e+f],f+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===s)s=1-l;else{if(s===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),s-=l}return(p?-1:1)*o*Math.pow(2,s-n)},r.write=function(t,e,r,n,i,s){var o,a,u,l=8*s-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=c?(a=0,o=c):o+f>=1?(a=(e*u-1)*Math.pow(2,i),o+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,l-=8);t[r+p-d]|=128*g}},{}],7:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}],8:[function(t,e,r){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],9:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],10:[function(t,e,r){(function(t){"use strict";void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,r)});case 3:return t.nextTick(function(){e.call(null,r,n)});case 4:return t.nextTick(function(){e.call(null,r,n,i)});default:for(s=new Array(a-1),o=0;o1)for(var r=1;r0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===l.prototype||(e=function(t){return l.from(t)}(e)),n?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):E(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?E(t,o,e,!1):N(t,o)):E(t,o,e,!1))):n||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=_?t=_:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function T(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(p("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(A,t):A(t))}function A(t){p("emit readable"),t.emit("readable"),F(t)}function N(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(S,t,e))}function S(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;ts.length?s.length:t;if(o===s.length?i+=s:i+=s.slice(0,t),0===(t-=o)){o===s.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=l.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var s=n.data,o=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,o),0===(t-=o)){o===s.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=s.slice(o));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function O(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(L,e,t))}function L(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function M(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return p("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?O(this):T(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&O(this),null;var n,i=e.needReadable;return p("need readable",i),(0===e.length||e.length-t0?I(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&O(this)),null!==n&&this.emit("data",n),n},w.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(t,e){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,p("pipe count=%d opts=%j",s.pipesCount,e);var u=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?c:w;function l(e,r){p("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),t.removeListener("close",y),t.removeListener("finish",b),t.removeListener("drain",f),t.removeListener("error",m),t.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",g),h=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function c(){p("onend"),t.end()}s.endEmitted?i.nextTick(u):n.once("end",u),t.on("unpipe",l);var f=function(t){return function(){var e=t._readableState;p("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,F(t))}}(n);t.on("drain",f);var h=!1;var d=!1;function g(e){p("ondata"),d=!1,!1!==t.write(e)||d||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==M(s.pipes,t))&&!h&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function m(e){p("onerror",e),w(),t.removeListener("error",m),0===a(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",b),w()}function b(){p("onfinish"),t.removeListener("close",y),w()}function w(){p("unpipe"),n.unpipe(t)}return n.on("data",g),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",m),t.once("close",y),t.once("finish",b),t.emit("pipe",n),s.flowing||(p("pipe resume"),n.resume()),t},w.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s-1?i:s.nextTick;b.WritableState=y;var l=t("core-util-is");l.inherits=t("inherits");var c={deprecate:t("util-deprecate")},f=t("./internal/streams/stream"),h=t("safe-buffer").Buffer,p=n.Uint8Array||function(){};var d,g=t("./internal/streams/destroy");function m(){}function y(e,r){a=a||t("./_stream_duplex"),e=e||{};var n=r instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,l=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(s.nextTick(i,n),s.nextTick(T,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),T(t,e))}(t,r,n,e,i);else{var o=_(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||E(t,r),n?u(v,t,r,o,i):v(t,r,o,i)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function b(e){if(a=a||t("./_stream_duplex"),!(d.call(b,this)||this instanceof a))return new b(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function w(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function v(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),T(t,e)}function E(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),s=e.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,w(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,f=r.callback;if(w(t,e,!1,e.objectMode?1:l.length,l,c,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function _(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),T(t,e)})}function T(t,e){var r=_(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,s.nextTick(x,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}l.inherits(b,f),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(t){return!!d.call(this,t)||this===b&&(t&&t._writableState instanceof y)}})):d=function(t){return t instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(t,e,r){var n,i=this._writableState,o=!1,a=!i.objectMode&&(n=t,h.isBuffer(n)||n instanceof p);return a&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=m),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),s.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var i=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),s.nextTick(n,o),i=!1),i}(this,i,t,r))&&(i.pendingcb++,o=function(t,e,r,n,i,s){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,r));return e}(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,T(t,e),r&&(e.finished?s.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),b.prototype.destroy=g.destroy,b.prototype._undestroy=g.undestroy,b.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{"./_stream_duplex":13,"./internal/streams/destroy":19,"./internal/streams/stream":20,_process:11,"core-util-is":4,inherits:7,"process-nextick-args":10,"safe-buffer":25,timers:29,"util-deprecate":30}],18:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("util");e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,s=n.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=s,i=a,e.copy(r,i),a+=o.data.length,o=o.next;return s},t}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},{"safe-buffer":25,util:2}],19:[function(t,e,r){"use strict";var n=t("process-nextick-args");function i(t,e){t.emit("error",e)}e.exports={destroy:function(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(n.nextTick(i,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":10}],20:[function(t,e,r){e.exports=t("events").EventEmitter},{events:5}],21:[function(t,e,r){e.exports=t("./readable").PassThrough},{"./readable":22}],22:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":13,"./lib/_stream_passthrough.js":14,"./lib/_stream_readable.js":15,"./lib/_stream_transform.js":16,"./lib/_stream_writable.js":17}],23:[function(t,e,r){e.exports=t("./readable").Transform},{"./readable":22}],24:[function(t,e,r){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":17}],25:[function(t,e,r){var n=t("buffer"),i=n.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,r),r.Buffer=o),s(i,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:3}],26:[function(t,e,r){(function(e){!function(r){r.parser=function(t,e){return new s(t,e)},r.SAXParser=s,r.SAXStream=a,r.createStream=function(t,e){return new a(t,e)},r.MAX_BUFFER_LENGTH=65536;var n,i=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function s(t,e){if(!(this instanceof s))return new s(t,e);!function(t){for(var e=0,r=i.length;e"===n?(C(this,"onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=A.TEXT):b(n)?(this.state=A.SGML_DECL_QUOTED,this.sgmlDecl+=n):this.sgmlDecl+=n;continue;case A.SGML_DECL_QUOTED:n===this.q&&(this.state=A.SGML_DECL,this.q=""),this.sgmlDecl+=n;continue;case A.DOCTYPE:">"===n?(this.state=A.TEXT,C(this,"ondoctype",this.doctype),this.doctype=!0):(this.doctype+=n,"["===n?this.state=A.DOCTYPE_DTD:b(n)&&(this.state=A.DOCTYPE_QUOTED,this.q=n));continue;case A.DOCTYPE_QUOTED:this.doctype+=n,n===this.q&&(this.q="",this.state=A.DOCTYPE);continue;case A.DOCTYPE_DTD:this.doctype+=n,"]"===n?this.state=A.DOCTYPE:b(n)&&(this.state=A.DOCTYPE_DTD_QUOTED,this.q=n);continue;case A.DOCTYPE_DTD_QUOTED:this.doctype+=n,n===this.q&&(this.state=A.DOCTYPE_DTD,this.q="");continue;case A.COMMENT:"-"===n?this.state=A.COMMENT_ENDING:this.comment+=n;continue;case A.COMMENT_ENDING:"-"===n?(this.state=A.COMMENT_ENDED,this.comment=F(this.opt,this.comment),this.comment&&C(this,"oncomment",this.comment),this.comment=""):(this.comment+="-"+n,this.state=A.COMMENT);continue;case A.COMMENT_ENDED:">"!==n?(L(this,"Malformed comment"),this.comment+="--"+n,this.state=A.COMMENT):this.state=A.TEXT;continue;case A.CDATA:"]"===n?this.state=A.CDATA_ENDING:this.cdata+=n;continue;case A.CDATA_ENDING:"]"===n?this.state=A.CDATA_ENDING_2:(this.cdata+="]"+n,this.state=A.CDATA);continue;case A.CDATA_ENDING_2:">"===n?(this.cdata&&C(this,"oncdata",this.cdata),C(this,"onclosecdata"),this.cdata="",this.state=A.TEXT):"]"===n?this.cdata+="]":(this.cdata+="]]"+n,this.state=A.CDATA);continue;case A.PROC_INST:"?"===n?this.state=A.PROC_INST_ENDING:y(n)?this.state=A.PROC_INST_BODY:this.procInstName+=n;continue;case A.PROC_INST_BODY:if(!this.procInstBody&&y(n))continue;"?"===n?this.state=A.PROC_INST_ENDING:this.procInstBody+=n;continue;case A.PROC_INST_ENDING:">"===n?(C(this,"onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=A.TEXT):(this.procInstBody+="?"+n,this.state=A.PROC_INST_BODY);continue;case A.OPEN_TAG:v(d,n)?this.tagName+=n:(M(this),">"===n?B(this):"/"===n?this.state=A.OPEN_TAG_SLASH:(y(n)||L(this,"Invalid character in tag name"),this.state=A.ATTRIB));continue;case A.OPEN_TAG_SLASH:">"===n?(B(this,!0),R(this)):(L(this,"Forward-slash in opening tag not followed by >"),this.state=A.ATTRIB);continue;case A.ATTRIB:if(y(n))continue;">"===n?B(this):"/"===n?this.state=A.OPEN_TAG_SLASH:v(p,n)?(this.attribName=n,this.attribValue="",this.state=A.ATTRIB_NAME):L(this,"Invalid attribute name");continue;case A.ATTRIB_NAME:"="===n?this.state=A.ATTRIB_VALUE:">"===n?(L(this,"Attribute without value"),this.attribValue=this.attribName,j(this),B(this)):y(n)?this.state=A.ATTRIB_NAME_SAW_WHITE:v(d,n)?this.attribName+=n:L(this,"Invalid attribute name");continue;case A.ATTRIB_NAME_SAW_WHITE:if("="===n)this.state=A.ATTRIB_VALUE;else{if(y(n))continue;L(this,"Attribute without value"),this.tag.attributes[this.attribName]="",this.attribValue="",C(this,"onattribute",{name:this.attribName,value:""}),this.attribName="",">"===n?B(this):v(p,n)?(this.attribName=n,this.state=A.ATTRIB_NAME):(L(this,"Invalid attribute name"),this.state=A.ATTRIB)}continue;case A.ATTRIB_VALUE:if(y(n))continue;b(n)?(this.q=n,this.state=A.ATTRIB_VALUE_QUOTED):(L(this,"Unquoted attribute value"),this.state=A.ATTRIB_VALUE_UNQUOTED,this.attribValue=n);continue;case A.ATTRIB_VALUE_QUOTED:if(n!==this.q){"&"===n?this.state=A.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=n;continue}j(this),this.q="",this.state=A.ATTRIB_VALUE_CLOSED;continue;case A.ATTRIB_VALUE_CLOSED:y(n)?this.state=A.ATTRIB:">"===n?B(this):"/"===n?this.state=A.OPEN_TAG_SLASH:v(p,n)?(L(this,"No whitespace between attributes"),this.attribName=n,this.attribValue="",this.state=A.ATTRIB_NAME):L(this,"Invalid attribute name");continue;case A.ATTRIB_VALUE_UNQUOTED:if(!w(n)){"&"===n?this.state=A.ATTRIB_VALUE_ENTITY_U:this.attribValue+=n;continue}j(this),">"===n?B(this):this.state=A.ATTRIB;continue;case A.CLOSE_TAG:if(this.tagName)">"===n?R(this):v(d,n)?this.tagName+=n:this.script?(this.script+=""===n?R(this):L(this,"Invalid characters in closing tag");continue;case A.TEXT_ENTITY:case A.ATTRIB_VALUE_ENTITY_Q:case A.ATTRIB_VALUE_ENTITY_U:var a,c;switch(this.state){case A.TEXT_ENTITY:a=A.TEXT,c="textNode";break;case A.ATTRIB_VALUE_ENTITY_Q:a=A.ATTRIB_VALUE_QUOTED,c="attribValue";break;case A.ATTRIB_VALUE_ENTITY_U:a=A.ATTRIB_VALUE_UNQUOTED,c="attribValue"}";"===n?(this[c]+=P(this),this.entity="",this.state=a):v(this.entity.length?m:g,n)?this.entity+=n:(L(this,"Invalid character in entity name"),this[c]+="&"+this.entity+n,this.entity="",this.state=a);continue;default:throw new Error(this,"Unknown state: "+this.state)}this.position>=this.bufferCheckPosition&&function(t){for(var e=Math.max(r.MAX_BUFFER_LENGTH,10),n=0,s=0,o=i.length;se)switch(i[s]){case"textNode":k(t);break;case"cdata":C(t,"oncdata",t.cdata),t.cdata="";break;case"script":C(t,"onscript",t.script),t.script="";break;default:I(t,"Max buffer length exceeded: "+i[s])}n=Math.max(n,a)}var u=r.MAX_BUFFER_LENGTH-n;t.bufferCheckPosition=u+t.position}(this);return this},resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var t;k(t=this),""!==t.cdata&&(C(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(C(t,"onscript",t.script),t.script="")}};try{n=t("stream").Stream}catch(t){n=function(){}}var o=r.EVENTS.filter(function(t){return"error"!==t&&"end"!==t});function a(t,e){if(!(this instanceof a))return new a(t,e);n.apply(this),this._parser=new s(t,e),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(t){r.emit("error",t),r._parser.error=null},this._decoder=null,o.forEach(function(t){Object.defineProperty(r,"on"+t,{get:function(){return r._parser["on"+t]},set:function(e){if(!e)return r.removeAllListeners(t),r._parser["on"+t]=e,e;r.on(t,e)},enumerable:!0,configurable:!1})})}a.prototype=Object.create(n.prototype,{constructor:{value:a}}),a.prototype.write=function(r){if("function"==typeof e&&"function"==typeof e.isBuffer&&e.isBuffer(r)){if(!this._decoder){var n=t("string_decoder").StringDecoder;this._decoder=new n("utf8")}r=this._decoder.write(r)}return this._parser.write(r.toString()),this.emit("data",r),!0},a.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},a.prototype.on=function(t,e){var r=this;return r._parser["on"+t]||-1===o.indexOf(t)||(r._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),r.emit.apply(r,e)}),n.prototype.on.call(r,t,e)};var u="[CDATA[",l="DOCTYPE",c="http://www.w3.org/XML/1998/namespace",f="http://www.w3.org/2000/xmlns/",h={xml:c,xmlns:f},p=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,d=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,g=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,m=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function y(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function b(t){return'"'===t||"'"===t}function w(t){return">"===t||y(t)}function v(t,e){return t.test(e)}function E(t,e){return!v(t,e)}var _,x,T,A=0;for(var N in r.STATE={BEGIN:A++,BEGIN_WHITESPACE:A++,TEXT:A++,TEXT_ENTITY:A++,OPEN_WAKA:A++,SGML_DECL:A++,SGML_DECL_QUOTED:A++,DOCTYPE:A++,DOCTYPE_QUOTED:A++,DOCTYPE_DTD:A++,DOCTYPE_DTD_QUOTED:A++,COMMENT_STARTING:A++,COMMENT:A++,COMMENT_ENDING:A++,COMMENT_ENDED:A++,CDATA:A++,CDATA_ENDING:A++,CDATA_ENDING_2:A++,PROC_INST:A++,PROC_INST_BODY:A++,PROC_INST_ENDING:A++,OPEN_TAG:A++,OPEN_TAG_SLASH:A++,ATTRIB:A++,ATTRIB_NAME:A++,ATTRIB_NAME_SAW_WHITE:A++,ATTRIB_VALUE:A++,ATTRIB_VALUE_QUOTED:A++,ATTRIB_VALUE_CLOSED:A++,ATTRIB_VALUE_UNQUOTED:A++,ATTRIB_VALUE_ENTITY_Q:A++,ATTRIB_VALUE_ENTITY_U:A++,CLOSE_TAG:A++,CLOSE_TAG_SAW_WHITE:A++,SCRIPT:A++,SCRIPT_ENDING:A++},r.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},r.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(r.ENTITIES).forEach(function(t){var e=r.ENTITIES[t],n="number"==typeof e?String.fromCharCode(e):e;r.ENTITIES[t]=n}),r.STATE)r.STATE[r.STATE[N]]=N;function S(t,e,r){t[e]&&t[e](r)}function C(t,e,r){t.textNode&&k(t),S(t,e,r)}function k(t){t.textNode=F(t.opt,t.textNode),t.textNode&&S(t,"ontext",t.textNode),t.textNode=""}function F(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function I(t,e){return k(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,S(t,"onerror",e),t}function O(t){return t.sawRoot&&!t.closedRoot&&L(t,"Unclosed root tag"),t.state!==A.BEGIN&&t.state!==A.BEGIN_WHITESPACE&&t.state!==A.TEXT&&I(t,"Unexpected end"),k(t),t.c="",t.closed=!0,S(t,"onend"),s.call(t,t.strict,t.opt),t}function L(t,e){if("object"!=typeof t||!(t instanceof s))throw new Error("bad call to strictFail");t.strict&&I(t,e)}function M(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,r=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(r.ns=e.ns),t.attribList.length=0,C(t,"onopentagstart",r)}function D(t,e){var r=t.indexOf(":")<0?["",t]:t.split(":"),n=r[0],i=r[1];return e&&"xmlns"===t&&(n="xmlns",i=""),{prefix:n,local:i}}function j(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var e=D(t.attribName,!0),r=e.prefix,n=e.local;if("xmlns"===r)if("xml"===n&&t.attribValue!==c)L(t,"xml: prefix must be bound to "+c+"\nActual: "+t.attribValue);else if("xmlns"===n&&t.attribValue!==f)L(t,"xmlns: prefix must be bound to "+f+"\nActual: "+t.attribValue);else{var i=t.tag,s=t.tags[t.tags.length-1]||t;i.ns===s.ns&&(i.ns=Object.create(s.ns)),i.ns[n]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,C(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function B(t,e){if(t.opt.xmlns){var r=t.tag,n=D(t.tagName);r.prefix=n.prefix,r.local=n.local,r.uri=r.ns[n.prefix]||"",r.prefix&&!r.uri&&(L(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),r.uri=n.prefix);var i=t.tags[t.tags.length-1]||t;r.ns&&i.ns!==r.ns&&Object.keys(r.ns).forEach(function(e){C(t,"onopennamespace",{prefix:e,uri:r.ns[e]})});for(var s=0,o=t.attribList.length;s",t.tagName="",void(t.state=A.SCRIPT);C(t,"onscript",t.script),t.script=""}var e=t.tags.length,r=t.tagName;t.strict||(r=r[t.looseCase]());for(var n=r;e--;){if(t.tags[e].name===n)break;L(t,"Unexpected close tag")}if(e<0)return L(t,"Unmatched closing tag: "+t.tagName),t.textNode+="",void(t.state=A.TEXT);t.tagName=r;for(var i=t.tags.length;i-- >e;){var s=t.tag=t.tags.pop();t.tagName=t.tag.name,C(t,"onclosetag",t.tagName);var o={};for(var a in s.ns)o[a]=s.ns[a];var u=t.tags[t.tags.length-1]||t;t.opt.xmlns&&s.ns!==u.ns&&Object.keys(s.ns).forEach(function(e){var r=s.ns[e];C(t,"onclosenamespace",{prefix:e,uri:r})})}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=A.TEXT}function P(t){var e,r=t.entity,n=r.toLowerCase(),i="";return t.ENTITIES[r]?t.ENTITIES[r]:t.ENTITIES[n]?t.ENTITIES[n]:("#"===(r=n).charAt(0)&&("x"===r.charAt(1)?(r=r.slice(2),i=(e=parseInt(r,16)).toString(16)):(r=r.slice(1),i=(e=parseInt(r,10)).toString(10))),r=r.replace(/^0+/,""),isNaN(e)||i.toLowerCase()!==r?(L(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(e))}function U(t,e){"<"===e?(t.state=A.OPEN_WAKA,t.startTagPosition=t.position):y(e)||(L(t,"Non-whitespace before first tag."),t.textNode=e,t.state=A.TEXT)}function K(t,e){var r="";return e1114111||x(o)!==o)throw RangeError("Invalid code point: "+o);o<=65535?r.push(o):(t=55296+((o-=65536)>>10),e=o%1024+56320,r.push(t,e)),(n+1===i||r.length>16384)&&(s+=_.apply(null,r),r.length=0)}return s},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:T,configurable:!0,writable:!0}):String.fromCodePoint=T)}(void 0===r?this.sax={}:r)}).call(this,t("buffer").Buffer)},{buffer:3,stream:27,string_decoder:28}],27:[function(t,e,r){e.exports=i;var n=t("events").EventEmitter;function i(){n.call(this)}t("inherits")(i,n),i.Readable=t("readable-stream/readable.js"),i.Writable=t("readable-stream/writable.js"),i.Duplex=t("readable-stream/duplex.js"),i.Transform=t("readable-stream/transform.js"),i.PassThrough=t("readable-stream/passthrough.js"),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",s),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",u));var o=!1;function a(){o||(o=!0,t.end())}function u(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function l(t){if(c(),0===n.listenerCount(this,"error"))throw t}function c(){r.removeListener("data",i),t.removeListener("drain",s),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",l),t.removeListener("error",l),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",l),t.on("error",l),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},{events:5,inherits:7,"readable-stream/duplex.js":12,"readable-stream/passthrough.js":21,"readable-stream/readable.js":22,"readable-stream/transform.js":23,"readable-stream/writable.js":24}],28:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.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!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=l,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=c,this.end=f,e=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}r.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":25}],29:[function(t,e,r){(function(e,n){var i=t("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,a={},u=0;function l(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new l(s.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new l(s.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},r.setImmediate="function"==typeof e?e:function(t){var e=u++,n=!(arguments.length<2)&&o.call(arguments,1);return a[e]=!0,i(function(){a[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))}),e},r.clearImmediate="function"==typeof n?n:function(t){delete a[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":11,timers:29}],30:[function(t,e,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],31:[function(t,e,r){e.exports={isArray:function(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}}},{}],32:[function(t,e,r){var n=t("./xml2js"),i=t("./xml2json"),s=t("./js2xml"),o=t("./json2xml");e.exports={xml2js:n,xml2json:i,js2xml:s,json2xml:o}},{"./js2xml":33,"./json2xml":34,"./xml2js":36,"./xml2json":37}],33:[function(t,e,r){var n,i,s=t("./options-helper"),o=t("./array-helper").isArray;function a(t,e,r){return(!r&&t.spaces?"\n":"")+Array(e+1).join(t.spaces)}function u(t,e,r){if(e.ignoreAttributes)return"";"attributesFn"in e&&(t=e.attributesFn(t,i,n));var s,o,u,l,c=[];for(s in t)t.hasOwnProperty(s)&&null!==t[s]&&void 0!==t[s]&&(l=e.noQuotesForNativeAttributes&&"string"!=typeof t[s]?"":'"',o=(o=""+t[s]).replace(/"/g,"""),u="attributeNameFn"in e?e.attributeNameFn(s,o,i,n):s,c.push(e.spaces&&e.indentAttributes?a(e,r+1,!1):" "),c.push(u+"="+l+("attributeValueFn"in e?e.attributeValueFn(o,s,i,n):o)+l));return t&&Object.keys(t).length&&e.spaces&&e.indentAttributes&&c.push(a(e,r,!1)),c.join("")}function l(t,e,r){return n=t,i="xml",e.ignoreDeclaration?"":""}function c(t,e,r){if(e.ignoreInstruction)return"";var s;for(s in t)if(t.hasOwnProperty(s))break;var o="instructionNameFn"in e?e.instructionNameFn(s,t[s],i,n):s;if("object"==typeof t[s])return n=t,i=o,"";var a=t[s]?t[s]:"";return"instructionFn"in e&&(a=e.instructionFn(a,s,i,n)),""}function f(t,e){return e.ignoreComment?"":"\x3c!--"+("commentFn"in e?e.commentFn(t,i,n):t)+"--\x3e"}function h(t,e){return e.ignoreCdata?"":"","]]]]>"))+"]]>"}function p(t,e){return e.ignoreDoctype?"":""}function d(t,e){return e.ignoreText?"":(t=(t=(t=""+t).replace(/&/g,"&")).replace(/&/g,"&").replace(//g,">"),"textFn"in e?e.textFn(t,i,n):t)}function g(t,e,r,s){return t.reduce(function(t,o){var l=a(e,r,s&&!t);switch(o.type){case"element":return t+l+function(t,e,r){n=t,i=t.name;var s=[],o="elementNameFn"in e?e.elementNameFn(t.name,t):t.name;s.push("<"+o),t[e.attributesKey]&&s.push(u(t[e.attributesKey],e,r));var a=t[e.elementsKey]&&t[e.elementsKey].length||t[e.attributesKey]&&"preserve"===t[e.attributesKey]["xml:space"];return a||(a="fullTagEmptyElementFn"in e?e.fullTagEmptyElementFn(t.name,t):e.fullTagEmptyElement),a?(s.push(">"),t[e.elementsKey]&&t[e.elementsKey].length&&(s.push(g(t[e.elementsKey],e,r+1)),n=t,i=t.name),s.push(e.spaces&&function(t,e){var r;if(t.elements&&t.elements.length)for(r=0;r")):s.push("/>"),s.join("")}(o,e,r);case"comment":return t+l+f(o[e.commentKey],e);case"doctype":return t+l+p(o[e.doctypeKey],e);case"cdata":return t+(e.indentCdata?l:"")+h(o[e.cdataKey],e);case"text":return t+(e.indentText?l:"")+d(o[e.textKey],e);case"instruction":var m={};return m[o[e.nameKey]]=o[e.attributesKey]?o:o[e.instructionKey],t+(e.indentInstruction?l:"")+c(m,e,r)}},"")}function m(t,e,r){var n;for(n in t)if(t.hasOwnProperty(n))switch(n){case e.parentKey:case e.attributesKey:break;case e.textKey:if(e.indentText||r)return!0;break;case e.cdataKey:if(e.indentCdata||r)return!0;break;case e.instructionKey:if(e.indentInstruction||r)return!0;break;case e.doctypeKey:case e.commentKey:default:return!0}return!1}function y(t,e,r,s,o){n=t,i=e;var l="elementNameFn"in r?r.elementNameFn(e,t):e;if(void 0===t||null===t||""===t)return"fullTagEmptyElementFn"in r&&r.fullTagEmptyElementFn(e,t)||r.fullTagEmptyElement?"<"+l+">":"<"+l+"/>";var c=[];if(e){if(c.push("<"+l),"object"!=typeof t)return c.push(">"+d(t,r)+""),c.join("");t[r.attributesKey]&&c.push(u(t[r.attributesKey],r,s));var f=m(t,r,!0)||t[r.attributesKey]&&"preserve"===t[r.attributesKey]["xml:space"];if(f||(f="fullTagEmptyElementFn"in r?r.fullTagEmptyElementFn(e,t):r.fullTagEmptyElement),!f)return c.push("/>"),c.join("");c.push(">")}return c.push(b(t,r,s+1,!1)),n=t,i=e,e&&c.push((o?a(r,s,!1):"")+""),c.join("")}function b(t,e,r,n){var i,s,u,g=[];for(s in t)if(t.hasOwnProperty(s))for(u=o(t[s])?t[s]:[t[s]],i=0;i/g,">")),l("text",t))}function d(t){n.ignoreComment||(n.trim&&(t=t.trim()),l("comment",t))}function g(t){var e=i[n.parentKey];n.addParent||delete i[n.parentKey],i=e}function m(t){n.ignoreCdata||(n.trim&&(t=t.trim()),l("cdata",t))}function y(t){n.ignoreDoctype||(t=t.replace(/^ /,""),n.trim&&(t=t.trim()),l("doctype",t))}function b(t){t.note=t}e.exports=function(t,e){var r=s.parser(!0,{}),a={};if(i=a,n=function(t){return n=o.copyOptions(t),o.ensureFlagExists("ignoreDeclaration",n),o.ensureFlagExists("ignoreInstruction",n),o.ensureFlagExists("ignoreAttributes",n),o.ensureFlagExists("ignoreText",n),o.ensureFlagExists("ignoreComment",n),o.ensureFlagExists("ignoreCdata",n),o.ensureFlagExists("ignoreDoctype",n),o.ensureFlagExists("compact",n),o.ensureFlagExists("alwaysChildren",n),o.ensureFlagExists("addParent",n),o.ensureFlagExists("trim",n),o.ensureFlagExists("nativeType",n),o.ensureFlagExists("nativeTypeAttributes",n),o.ensureFlagExists("sanitize",n),o.ensureFlagExists("instructionHasAttributes",n),o.ensureFlagExists("captureSpacesBetweenElements",n),o.ensureAlwaysArrayExists(n),o.ensureKeyExists("declaration",n),o.ensureKeyExists("instruction",n),o.ensureKeyExists("attributes",n),o.ensureKeyExists("text",n),o.ensureKeyExists("comment",n),o.ensureKeyExists("cdata",n),o.ensureKeyExists("doctype",n),o.ensureKeyExists("type",n),o.ensureKeyExists("name",n),o.ensureKeyExists("elements",n),o.ensureKeyExists("parent",n),o.checkFnExists("doctype",n),o.checkFnExists("instruction",n),o.checkFnExists("cdata",n),o.checkFnExists("comment",n),o.checkFnExists("text",n),o.checkFnExists("instructionName",n),o.checkFnExists("elementName",n),o.checkFnExists("attributeName",n),o.checkFnExists("attributeValue",n),o.checkFnExists("attributes",n),n}(e),r.opt={strictEntities:!0},r.onopentag=h,r.ontext=p,r.oncomment=d,r.onclosetag=g,r.onerror=b,r.oncdata=m,r.ondoctype=y,r.onprocessinginstruction=f,r.write(t).close(),a[n.elementsKey]){var u=a[n.elementsKey];delete a[n.elementsKey],a[n.elementsKey]=u,delete a.text}return a}},{"./array-helper":31,"./options-helper":35,sax:26}],37:[function(t,e,r){var n=t("./options-helper"),i=t("./xml2js");e.exports=function(t,e){var r,s,o;return r=function(t){var e=n.copyOptions(t);return n.ensureSpacesExists(e),e}(e),s=i(t,r),o="compact"in r&&r.compact?"_parent":"parent",("addParent"in r&&r.addParent?JSON.stringify(s,function(t,e){return t===o?"_":e},r.spaces):JSON.stringify(s,null,r.spaces)).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}},{"./options-helper":35,"./xml2js":36}],38:[function(t,e,r){(function(r){const n=t("./placing"),i=t("./rendering"),s={compute:t=>{const e=t.options||{};let r={};(t.nodes||[]).filter(t=>"string"==typeof t.name).forEach(t=>r[t.name]=t);let s=(t.links||[]).filter(t=>t.from&&t.to);if(s.filter(t=>!r[t.from]).forEach(t=>console.warn(`unknown source node "${t.from}"`)),s.filter(t=>!r[t.to]).forEach(t=>console.warn(`unknown destination node "${t.to}"`)),s=s.filter(t=>r[t.from]&&r[t.to]),!(r=n(e.placing).compute(r,s)))throw"Failed to place nodes";return i(e.rendering).compute(r,s)}};e.exports=s,r.faDiagrams=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./placing":39,"./rendering":40}],39:[function(t,e,r){const n=t("./utils"),i={name:"!string",x:"number",y:"number"},s={from:"!string",to:"!string",direction:"string"},o={"max-link-length":3,diagonals:!0};e.exports=(t=>{t=n.merge(o,t);const e={getBounds:t=>{const e=Object.values(t).filter(t=>void 0!==t.x);if(0===e.length)return{x:0,y:0,w:0,h:0};let r=null,n=null,i=null,s=null;return e.forEach(t=>{r=null!==r?Math.min(t.x,r):t.x,n=null!==n?Math.min(t.y,n):t.y,i=null!==i?Math.max(t.x,i):t.x,s=null!==s?Math.max(t.y,s):t.y}),{x:r,y:n,w:i-r+1,h:s-n+1}},getNewPos:t=>{const r=e.getBounds(t),i=n.newMap(r.w,r.h,!1);Object.values(t).filter(t=>void 0!==t.x).forEach(t=>{i[t.x-r.x][t.y-r.y]=!0});for(let t=0;t{let n=t[e].x,i=t[e].y,s=t[r].x,o=t[r].y;const a=s-n,u=o-i,l=(t,n)=>i=>i.x===t&&i.y===n&&i.name!==e&&i.name!==r;if(Math.abs(a)>=Math.abs(u)){if(n>s){let t=n;n=s,s=t}for(let e=n;e<=s;e++){let r=Math.round(i+u*(e-n)/a);if(Object.values(t).find(l(e,r)))return!0}}else{if(i>o){let t=i;i=o,o=t}for(let e=i;e<=o;e++){let r=Math.round(n+a*(e-i)/u);if(Object.values(t).find(l(r,e)))return!0}}return!1},getPosition:(e,r,n)=>{const i=e[r],s={maxX:null,maxY:null,minX:null,minY:null,startX:null,startY:null,free:!0},o=(t,r,n,i)=>o=>{if(void 0!==e[o].x){const a=e[o].x,u=e[o].y;s.minX=null!==s.minX?Math.max(a+t,s.minX):a+t,s.maxX=null!==s.maxX?Math.min(a+r,s.maxX):a+r,s.minY=null!==s.minY?Math.max(u+n,s.minY):u+n,s.maxY=null!==s.maxY?Math.min(u+i,s.maxY):u+i,null===s.startX&&(s.startX=Math.abs(i+n)>0?a:1===Math.abs(t)?"minX":"maxX",s.startY=Math.abs(r+t)>0?u:1===Math.abs(n)?"minY":"maxY"),s.free=!1}},a=t["max-link-length"],u=n?a:0;return i.const.beforeX.forEach(o(1,1+a,-u,u)),i.const.beforeY.forEach(o(-u,u,1,1+a)),i.const.afterX.forEach(o(-1-a,-1,-u,u)),i.const.afterY.forEach(o(-u,u,-1-a,-1)),"string"==typeof s.startX&&(s.startX=s[s.startX]),"string"==typeof s.startY&&(s.startY=s[s.startY]),s.minX>s.maxX||s.minY>s.maxY?null:{x:s.startX,y:s.startY,free:s.free}},isValid:(r,n)=>{let i,s,o;const a=Object.values(r).filter(t=>void 0!==t.x);for(let t=0;tMath.pow(t["max-link-length"],2))return!1;switch(i.direction){case"up":case"top":if(o.y-s.y>=0)return!1;break;case"down":case"bottom":if(o.y-s.y<=0)return!1;break;case"left":if(o.x-s.x>=0)return!1;break;case"right":if(o.x-s.x<=0)return!1}if(!t.diagonals&&s.x!==o.x&&s.y!==o.y)return!1}return!0},correctPlacing:t=>{const r=e.getBounds(t);Object.values(t).forEach(t=>{t.x-=r.x,t.y-=r.y})},applyLinks:(r,i,s=0)=>{if(!e.isValid(r,i))return null;const o=Object.keys(r).filter(t=>void 0===r[t].x);if(0===o.length)return r;const a=[],u=(t,o,a)=>{const u=n.ezClone(r);return u[t].x=o,u[t].y=a,e.applyLinks(u,i,s+1)};let l,c,f;for(let n=0;n(Object.keys(t).forEach(e=>{const r=n.isValid(t[e],i);if(r)throw`Node '${e}' is invalid at key '${r}'`}),r.forEach((t,e)=>{const r=n.isValid(t,s);if(r)throw`Link ${e} (${t.from}->${t.to}) is invalid at key '${r}'`}),Object.values(t).forEach(t=>{t.const={beforeX:[],afterX:[],beforeY:[],afterY:[]}}),r.forEach(e=>{if(e.direction)switch(e.direction){case"up":case"top":t[e.from].const.beforeY.push(e.to),t[e.to].const.afterY.push(e.from);break;case"down":case"bottom":t[e.from].const.afterY.push(e.to),t[e.to].const.beforeY.push(e.from);break;case"left":t[e.from].const.beforeX.push(e.to),t[e.to].const.afterX.push(e.from);break;case"right":t[e.from].const.afterX.push(e.to),t[e.to].const.beforeX.push(e.from)}}),(t=e.applyLinks(t,r))&&(e.correctPlacing(t),Object.values(t).forEach(t=>{delete t.const})),t)};return e})},{"./utils":41}],40:[function(t,e,r){const n=t("xml-js"),i=t("./utils");let s={name:"error",height:512,index:[],links:{"arrow-head":{},"arrow-head-reverse":{},"line-start":{},"line-end":{},"dashed-step":{}},icons:{}};try{s=t("../resources.json")}catch(t){console.error("fa-diagrams: SVG resources could not be loaded: "+t)}const o={_:"string",text:"string",icon:{_:"string",path:"string",width:"number",height:"number"},color:"string",font:"string","font-size":"number","font-style":"string",margin:"number","line-height":"number",scale:"number"},a={name:"!string",icon:{_:"string",path:"string",width:"number",height:"number"},x:"!number",y:"!number",color:"string",scale:"number",top:o,bottom:o,left:o,right:o},u={from:"!string",to:"!string",type:"string",color:"string",scale:"number",size:"number",top:o,bottom:o},l={beautify:!1,scale:128,"h-spacing":1.3,color:"black",icons:{scale:1,color:""},links:{scale:1,color:"",size:0},texts:{font:"Arial","font-size":15,"font-style":"normal",color:"",margin:.2,"line-height":1.2}},c={"font-awesome":{fas:"solid",far:"regular",fab:"brands"}};e.exports=(t=>{t=i.merge(l,t);const e={getIcon:t=>{if(!t)return null;if("object"==typeof t)return t.path&&t.path.trim()?(t.height=t.height||t.width||s.height,t.width=t.width||t.height,t):null;if(!t.trim())return null;let e=i.ezClone(s.index);const r=t.trim().split(" ").map(t=>0===t.indexOf("fa-")?t.substr(3):t);for(let t=0;t{const r="v46.059c0 21.382 25.851 32.09 40.971 16.971 l86.059 -86.059c9.373-9.373 9.373-24.569 0-33.941l-86.059-86.059c-15.119-15.119-40.971-4.411-40.971 16.971v46.059",n="v-46.059c0-21.382-25.851-32.09-40.971-16.971l-86.059 86.059c-9.373 9.373-9.373 24.568 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971v-46.059",i="c6.627 0 12 -5.373 12 -12v-56c0 -6.627 -5.373 -12 -12 -12",s="c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12",o=`${s}h56${i}`;switch(t){case"none":return null;default:return`M12 216${s}h${512*e-146.059}${r}z`;case"line":return`M12 216${s}h${512*e-24}${i}z`;case"double":return`M134.059 216${n}h${512*e-268.06}${r}z`;case"split-double":return`M12 126${s}h${512*e-146.059}${r}M134.059 306${n}h${512*e-146.059}${i}z`;case"dashed":const a=Math.floor((512*e-134.059)/168),u=(512*e-134.059-56*a-24)/a;return`M12 216${new Array(a).fill(`${o}m${u} 0`).join("")}v80${r}z`;case"dashed-line":const l=Math.floor(512*e/168),c=(512*e-56*l-24)/(l-1);return`M12 216${new Array(l).fill(o).join(`m${c} 0`)}z`;case"dashed-double":const f=Math.floor((512*e-268.118)/168),h=(512*e-268.118-56*f-24)/(f+1);return`M134.059 216${n}m${h}-80${new Array(f).fill(`${o}m${h} 0`).join("")}v80${r}z`;case"dashed-split-double":const p=Math.floor((512*e-134.059)/168),d=(512*e-134.059-56*p-24)/p;return`M12 126${new Array(p).fill(`${o}m${d} 0`).join("")}v80${r}M134.059 306${n}m${d} -80${new Array(p).fill(`${o}`).join(`m${d} 0`)}z`}},getBounds:t=>{const e=Object.values(t);if(0===e.length)return{w:0,h:0};let r=0,n=0;return e.forEach(t=>{r=Math.max(t.x,r),n=Math.max(t.y,n)}),{w:r+1,h:n+1}},getSvgText:(t,e,r,n)=>{if(!(t=t.trim()).includes("\n"))return{_text:t};const i=[];return t.split("\n").map(t=>t.trim()).forEach((t,s)=>{i.push({_attributes:{x:r,dy:0===s?"0":`${e}em`,"text-anchor":n},_text:t})}),{tspan:i}},renderSubText:(r,n,i,s,o)=>{const a=i["font-size"]||t.texts["font-size"],u=(i.margin||t.texts.margin)/(o?4:1);let l,c;switch(n){case"bottom":l={x:0,y:1},c="middle";break;case"top":l={x:0,y:-1},c="middle";break;case"left":l={x:-1,y:0},c="end";break;case"right":l={x:1,y:0}}const f=i["line-height"]||t.texts["line-height"],h=e.getSvgText(i.text,f,l.x*a/2,c),p=h.tspan?h.tspan.length-1:0;return h._attributes={"font-family":i.font,"font-size":i["font-size"],"text-anchor":c,x:l.x*a/2,y:(l.y+.25)*a-(1-l.y)*p*a*f/2},{_attributes:{transform:`${s?"rotate(180) ":""}translate(${l.x*u} ${l.y*u}) scale(${1/t.scale} ${1/t.scale})`,fill:i.color||r.color||t.texts.color||t[o?"links":"icons"].color||void 0},text:h}},renderNode:r=>{const n=[],i=e.getIcon(r.icon);if(i){const e=.4*(r.scale||t.icons.scale);n.push({_attributes:{transform:`scale(${e/i.height} ${e/i.height}) translate(${-i.width/2} ${-i.height/2})`,fill:r.color||t.icons.color||void 0},path:{_attributes:{d:i.path}}})}return["bottom","top","left","right"].forEach(t=>{const i=r[t];i&&i.text&&n.push(e.renderSubText(r,t,i))}),n.length?{_attributes:{transform:`translate(${(r.x+.5)*t["h-spacing"]} ${r.y+.5})`},g:n}:null},renderLink:(r,n)=>{const i=r[n.from],s=r[n.to],o=((i.x+s.x)/2+.5)*t["h-spacing"],a=(i.y+s.y)/2+.5,u=180*Math.atan2(s.y-i.y,(s.x-i.x)*t["h-spacing"])/Math.PI;console.log(u);const l=[],c=.4*(n.scale||t.links.scale);let f=n.size||t.links.size;if(!f){let e=Math.abs(s.x-i.x)*t["h-spacing"];e>0&&(e-=.6);let r=Math.abs(s.y-i.y);r>0&&(r-=.6),f=Math.sqrt(Math.pow(e,2)+Math.pow(r,2))/c}const h=e.getLinkPath(n.type,f);h&&l.push({_attributes:{transform:`scale(${c/512} ${c/512}) translate(${-256*f} -256)`,fill:n.color||t.links.color||void 0},path:{_attributes:{d:h}}});const p=Math.abs(u)>90;return p?(n.top=n.top||n.right,n.bottom=n.bottom||n.left):(n.top=n.top||n.left,n.bottom=n.bottom||n.right),["bottom","top"].forEach(t=>{const r=n[t];r&&r.text&&l.push(e.renderSubText(n,t,r,p,!0))}),l.length?{_attributes:{transform:`translate(${o} ${a}) rotate(${u})`},g:l}:null},toXML:(e,r)=>{const i={svg:{_attributes:{xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${r.w*t["h-spacing"]} ${r.h}`,width:r.w*t["h-spacing"]*t.scale/.4,height:r.h*t.scale/.4,"font-family":t.texts.font,"font-size":t.texts["font-size"],fill:t.color,"stroke-width":0}}};return Object.keys(e).forEach(t=>{i.svg[t]=e[t]}),n.js2xml(i,{compact:!0,spaces:t.beautify?4:0}).replace(/<\/tspan>(\s*){const n={g:[]};r.forEach((r,s)=>{const o=i.isValid(r,u);if(o)throw`Link ${s} (${r.from}->${r.to}) is invalid at key '${o}'`;["bottom","top"].forEach(t=>{"string"==typeof r[t]&&(r[t]={text:r[t]})});const a=e.renderLink(t,r);a&&n.g.push(a)}),Object.keys(t).forEach(r=>{const s=i.isValid(t[r],a);if(s)throw`Node '${r}' is invalid at key '${s}'`;["bottom","top","left","right"].forEach(e=>{"string"==typeof t[r][e]&&(t[r][e]={text:t[r][e]})});const o=e.renderNode(t[r]);o&&n.g.push(o)});const s=e.getBounds(t);return e.toXML(n,s)}};return e})},{"../resources.json":void 0,"./utils":41,"xml-js":32}],41:[function(t,e,r){const n={merge:(t,e)=>{if(typeof t!=typeof e)return t;if(t.length&&!e.length)return t;if(t.length&&e.length)return e;if("object"==typeof t){const r={};return Object.keys(t).forEach(i=>r[i]=n.merge(t[i],e[i])),r}return e},isValid:(t,e)=>{const r=Object.keys(e).filter(t=>"_"!==t);let i,s;for(let o=0;o0&&(s="array"),"object"==typeof e[i]){if(s&&"object"!==s&&s!==e[i]._)return i;const r=n.isValid(s?t[i]:void 0,e[i]);if(r)return i+"."+r}else{if("!"===e[i][0]&&(e[i]=e[i].substr(1),!s))return i;if(s&&s!==e[i])return i}return null},ezClone:t=>JSON.parse(JSON.stringify(t)),newMap:(t,e,r)=>new Array(t).fill(0).map(()=>new Array(e).fill(r))};e.exports=n},{}]},{},[38]); \ No newline at end of file diff --git a/docs/sample.yml b/docs/sample.yml index 3058488..6523046 100644 --- a/docs/sample.yml +++ b/docs/sample.yml @@ -11,4 +11,4 @@ links: - from: node1 to: node2 color: "#333333" - bottom: hello + bottom: '"hello"' diff --git a/package-lock.json b/package-lock.json index 9dce908..102b6f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -151,6 +151,15 @@ "@babel/helper-plugin-utils": "^7.0.0" } }, + "@babel/runtime": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.5.4.tgz", + "integrity": "sha512-Na84uwyImZZc3FKf4aUF1tysApzwf3p2yuFBIyBfbzT5glzKTdvYI4KVW4kcgjrzoGUjC7w3YyCHcJKaRxsr2Q==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.2" + } + }, "@babel/template": { "version": "7.4.4", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz", @@ -477,11 +486,6 @@ "integrity": "sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w==", "dev": true }, - "abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" - }, "acorn": { "version": "5.7.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", @@ -542,6 +546,7 @@ "version": "6.10.1", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.1.tgz", "integrity": "sha512-w1YQaVGNC6t2UCPjEawK/vo/dG8OOrVtUmhBT1uJJYxbl5kU2Tj3v6LGqBcsysN1yhuCStJCCA3GqdvKY8sqXQ==", + "dev": true, "requires": { "fast-deep-equal": "^2.0.1", "fast-json-stable-stringify": "^2.0.0", @@ -580,20 +585,6 @@ "normalize-path": "^2.1.1" } }, - "aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" - }, - "are-we-there-yet": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -624,7 +615,8 @@ "array-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", - "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", + "dev": true }, "array-filter": { "version": "0.0.1", @@ -654,6 +646,7 @@ "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, "requires": { "safer-buffer": "~2.1.0" } @@ -699,7 +692,8 @@ "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true }, "assign-symbols": { "version": "1.0.0", @@ -722,22 +716,26 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", - "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true }, "aws4": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "dev": true }, "babel-jest": { "version": "24.8.0", @@ -787,7 +785,8 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true }, "base": { "version": "0.11.2", @@ -854,6 +853,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, "requires": { "tweetnacl": "^0.14.3" } @@ -868,6 +868,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1089,11 +1090,6 @@ "node-int64": "^0.4.0" } }, - "btoa": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz", - "integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==" - }, "buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", @@ -1157,108 +1153,6 @@ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, - "canvas": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/canvas/-/canvas-2.5.0.tgz", - "integrity": "sha512-wwRz2cLMgb9d+rnotOJCoc04Bzj3aJMpWc6JxAD6lP7bYz0ldcn0sKddoZ0vhD5T8HBxrK+XmRDJb68/2VqARw==", - "requires": { - "nan": "^2.13.2", - "node-pre-gyp": "^0.11.0", - "simple-get": "^3.0.3" - } - }, - "canvg": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/canvg/-/canvg-1.5.3.tgz", - "integrity": "sha512-7Gn2IuQzvUQWPIuZuFHrzsTM0gkPz2RRT9OcbdmA03jeKk8kltrD8gqUzNX15ghY/4PV5bbe5lmD6yDLDY6Ybg==", - "requires": { - "jsdom": "^8.1.0", - "rgbcolor": "^1.0.1", - "stackblur-canvas": "^1.4.1", - "xmldom": "^0.1.22" - }, - "dependencies": { - "abab": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", - "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=" - }, - "acorn": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz", - "integrity": "sha1-q259nYhqrKiwhbwzEreaGYQz8Oc=" - }, - "acorn-globals": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-1.0.9.tgz", - "integrity": "sha1-VbtemGkVB7dFedBRNBMhfDgMVM8=", - "requires": { - "acorn": "^2.1.0" - } - }, - "cssstyle": { - "version": "0.2.37", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz", - "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", - "requires": { - "cssom": "0.3.x" - } - }, - "jsdom": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-8.5.0.tgz", - "integrity": "sha1-1Nj12/J2hjW2KmKCO5R89wcevJg=", - "requires": { - "abab": "^1.0.0", - "acorn": "^2.4.0", - "acorn-globals": "^1.0.4", - "array-equal": "^1.0.0", - "cssom": ">= 0.3.0 < 0.4.0", - "cssstyle": ">= 0.2.34 < 0.3.0", - "escodegen": "^1.6.1", - "iconv-lite": "^0.4.13", - "nwmatcher": ">= 1.3.7 < 2.0.0", - "parse5": "^1.5.1", - "request": "^2.55.0", - "sax": "^1.1.4", - "symbol-tree": ">= 3.1.0 < 4.0.0", - "tough-cookie": "^2.2.0", - "webidl-conversions": "^3.0.1", - "whatwg-url": "^2.0.1", - "xml-name-validator": ">= 2.0.1 < 3.0.0" - } - }, - "parse5": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz", - "integrity": "sha1-m387DeMr543CQBsXVzzK8Pb1nZQ=" - }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" - }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" - }, - "whatwg-url": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-2.0.1.tgz", - "integrity": "sha1-U5ayBD8CDub3BNnEXqhRnnJN5lk=", - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "xml-name-validator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-2.0.1.tgz", - "integrity": "sha1-TYuPHszTQZqjYgYb7O9RXh5VljU=" - } - } - }, "capture-exit": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", @@ -1271,7 +1165,8 @@ "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true }, "chalk": { "version": "2.4.2", @@ -1284,11 +1179,6 @@ "supports-color": "^5.3.0" } }, - "chownr": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz", - "integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==" - }, "ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -1375,7 +1265,8 @@ "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true }, "collection-visit": { "version": "1.0.0", @@ -1432,6 +1323,7 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -1452,7 +1344,8 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true }, "concat-stream": { "version": "1.6.2", @@ -1475,11 +1368,6 @@ "date-now": "^0.1.4" } }, - "console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" - }, "constants-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", @@ -1504,7 +1392,8 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true }, "coveralls": { "version": "3.0.4", @@ -1592,7 +1481,8 @@ "cssom": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true }, "cssstyle": { "version": "1.3.0", @@ -1613,6 +1503,7 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, "requires": { "assert-plus": "^1.0.0" } @@ -1668,23 +1559,11 @@ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", "dev": true }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "requires": { - "mimic-response": "^1.0.0" - } - }, - "deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" - }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true }, "define-properties": { "version": "1.1.3", @@ -1745,12 +1624,8 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true }, "deps-sort": { "version": "2.0.0", @@ -1774,11 +1649,6 @@ "minimalistic-assert": "^1.0.0" } }, - "detect-libc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" - }, "detect-newline": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", @@ -1884,6 +1754,7 @@ "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, "requires": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" @@ -1963,6 +1834,7 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.1.tgz", "integrity": "sha512-JwiqFD9KdGVVpeuRa68yU3zZnBEOcPs0nKW7wZzXky8Z7tffdYUHbe11bPCV5jYlK6DVdKLWLm0f5I/QlL0Kmw==", + "dev": true, "requires": { "esprima": "^3.1.3", "estraverse": "^4.2.0", @@ -1974,17 +1846,20 @@ "esprima": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true }, "estraverse": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true }, "events": { "version": "2.1.0", @@ -2081,7 +1956,8 @@ "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true }, "extend-shallow": { "version": "3.0.2", @@ -2172,22 +2048,26 @@ "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true }, "fast-deep-equal": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true }, "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true }, "fb-watchman": { "version": "2.0.0", @@ -2239,12 +2119,14 @@ "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true }, "form-data": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -2271,18 +2153,11 @@ "klaw": "^1.0.0" } }, - "fs-minipass": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz", - "integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==", - "requires": { - "minipass": "^2.2.1" - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true }, "fsevents": { "version": "1.2.9", @@ -2838,54 +2713,6 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, "get-assigned-identifiers": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz", @@ -2917,6 +2744,7 @@ "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, "requires": { "assert-plus": "^1.0.0" } @@ -2925,6 +2753,7 @@ "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -2973,12 +2802,14 @@ "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true }, "har-validator": { "version": "5.1.3", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "dev": true, "requires": { "ajv": "^6.5.5", "har-schema": "^2.0.0" @@ -3005,11 +2836,6 @@ "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", "dev": true }, - "has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" - }, "has-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", @@ -3137,6 +2963,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, "requires": { "assert-plus": "^1.0.0", "jsprim": "^1.2.2", @@ -3153,6 +2980,7 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } @@ -3163,14 +2991,6 @@ "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", "dev": true }, - "ignore-walk": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", - "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", - "requires": { - "minimatch": "^3.0.4" - } - }, "import-local": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", @@ -3191,6 +3011,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -3199,12 +3020,8 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "inline-source-map": { "version": "0.6.2", @@ -3357,7 +3174,8 @@ "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true }, "is-generator-fn": { "version": "2.1.0", @@ -3421,7 +3239,8 @@ "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true }, "is-windows": { "version": "1.0.2", @@ -3438,7 +3257,8 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true }, "isexe": { "version": "2.0.0", @@ -3455,7 +3275,8 @@ "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true }, "istanbul-lib-coverage": { "version": "2.0.5", @@ -3990,7 +3811,8 @@ "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true }, "jsdom": { "version": "11.12.0", @@ -4057,12 +3879,14 @@ "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "json-stable-stringify": { "version": "0.0.1", @@ -4076,7 +3900,8 @@ "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true }, "json5": { "version": "2.1.0", @@ -4112,6 +3937,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -4181,6 +4007,7 @@ "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, "requires": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" @@ -4357,12 +4184,14 @@ "mime-db": { "version": "1.40.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" + "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==", + "dev": true }, "mime-types": { "version": "2.1.24", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "dev": true, "requires": { "mime-db": "1.40.0" } @@ -4373,11 +4202,6 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" - }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -4394,6 +4218,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4401,24 +4226,8 @@ "minimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - }, - "minipass": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", - "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", - "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", - "requires": { - "minipass": "^2.2.1" - } + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true }, "mixin-deep": { "version": "1.3.2", @@ -4445,6 +4254,7 @@ "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, "requires": { "minimist": "0.0.8" }, @@ -4452,7 +4262,8 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true } } }, @@ -4488,7 +4299,9 @@ "nan": { "version": "2.14.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", + "dev": true, + "optional": true }, "nanomatch": { "version": "1.2.13", @@ -4515,31 +4328,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "needle": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.4.0.tgz", - "integrity": "sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg==", - "requires": { - "debug": "^3.2.6", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - } - } - }, "neo-async": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", @@ -4577,23 +4365,6 @@ "which": "^1.3.0" } }, - "node-pre-gyp": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz", - "integrity": "sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q==", - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" - } - }, "node-svn-ultimate": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/node-svn-ultimate/-/node-svn-ultimate-1.2.0.tgz", @@ -4606,15 +4377,6 @@ "xml2js": "^0.4.17" } }, - "nopt": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", - "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -4636,20 +4398,6 @@ "remove-trailing-separator": "^1.0.1" } }, - "npm-bundled": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz", - "integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==" - }, - "npm-packlist": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.4.tgz", - "integrity": "sha512-zTLo8UcVYtDU3gdeaFu2Xu0n0EvelfHDGuqtNIn5RO7yQj4H1TqNdBc/yZjxnWA0PVB8D3Woyp0i5B43JwQ6Vw==", - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" - } - }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -4659,26 +4407,11 @@ "path-key": "^2.0.0" } }, - "npmlog": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" - }, - "nwmatcher": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.4.tgz", - "integrity": "sha512-3iuY4N5dhgMpCUrOVnuAdGrgxVqV2cJpM+XNccjR2DKOB1RUP0aA+wGXEiNziG/UKboFyGBIoKOaNlJxx8bciQ==" + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true }, "nwsapi": { "version": "2.1.4", @@ -4689,12 +4422,14 @@ "oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true }, "object-copy": { "version": "0.1.0", @@ -4765,6 +4500,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "requires": { "wrappy": "1" } @@ -4791,6 +4527,7 @@ "version": "0.8.2", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, "requires": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.4", @@ -4803,7 +4540,8 @@ "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true } } }, @@ -4813,11 +4551,6 @@ "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", "dev": true }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" - }, "os-locale": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", @@ -4829,20 +4562,6 @@ "mem": "^4.0.0" } }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" - }, - "osenv": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -4966,7 +4685,8 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true }, "path-key": { "version": "2.0.1", @@ -5011,7 +4731,8 @@ "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true }, "pify": { "version": "3.0.0", @@ -5052,7 +4773,8 @@ "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true }, "pretty-format": { "version": "24.8.0", @@ -5075,7 +4797,8 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true }, "prompts": { "version": "2.1.0", @@ -5090,7 +4813,8 @@ "psl": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.2.0.tgz", - "integrity": "sha512-GEn74ZffufCmkDDLNcl3uuyF/aSD6exEyh1v/ZSdAomB82t6G9hzJVRx0jBmLDW+VfZqks3aScmMw9DszwUalA==" + "integrity": "sha512-GEn74ZffufCmkDDLNcl3uuyF/aSD6exEyh1v/ZSdAomB82t6G9hzJVRx0jBmLDW+VfZqks3aScmMw9DszwUalA==", + "dev": true }, "public-encrypt": { "version": "4.0.3", @@ -5119,12 +4843,14 @@ "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true }, "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true }, "querystring": { "version": "0.2.0", @@ -5157,24 +4883,6 @@ "safe-buffer": "^5.1.0" } }, - "rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" - } - } - }, "react-is": { "version": "16.8.6", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz", @@ -5215,6 +4923,7 @@ "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -5234,6 +4943,12 @@ "util.promisify": "^1.0.0" } }, + "regenerator-runtime": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz", + "integrity": "sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==", + "dev": true + }, "regex-not": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", @@ -5266,6 +4981,7 @@ "version": "2.88.0", "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, "requires": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", @@ -5292,12 +5008,14 @@ "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true }, "tough-cookie": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, "requires": { "psl": "^1.1.24", "punycode": "^1.4.1" @@ -5373,15 +5091,11 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "dev": true }, - "rgbcolor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/rgbcolor/-/rgbcolor-1.0.1.tgz", - "integrity": "sha1-1lBezbMEplldom+ktDMHMGd1lF0=" - }, "rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, "requires": { "glob": "^7.1.3" } @@ -5405,7 +5119,8 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true }, "safe-regex": { "version": "1.1.0", @@ -5419,7 +5134,8 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true }, "sane": { "version": "4.1.0", @@ -5446,12 +5162,14 @@ "semver": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true }, "set-value": { "version": "2.0.1", @@ -5538,22 +5256,14 @@ "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true }, "simple-concat": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", - "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" - }, - "simple-get": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.0.3.tgz", - "integrity": "sha512-Wvre/Jq5vgoz31Z9stYWPLn0PqRqmBDpFSdypAnHu5AvRVCYPRYGnvryNLiXu8GOBNDH82J2FRHUGMjjHUpXFw==", - "requires": { - "decompress-response": "^3.3.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=", + "dev": true }, "sisteransi": { "version": "1.0.2", @@ -5683,7 +5393,8 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true }, "source-map-resolve": { "version": "0.5.2", @@ -5765,6 +5476,7 @@ "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "dev": true, "requires": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -5783,11 +5495,6 @@ "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==", "dev": true }, - "stackblur-canvas": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/stackblur-canvas/-/stackblur-canvas-1.4.1.tgz", - "integrity": "sha1-hJqm+UsnL/JvZHH6QTDtH35HlVs=" - }, "static-extend": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", @@ -5889,6 +5596,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" @@ -5897,12 +5605,14 @@ "ansi-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, "requires": { "ansi-regex": "^3.0.0" } @@ -5913,6 +5623,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, "requires": { "safe-buffer": "~5.1.0" } @@ -5962,21 +5673,11 @@ "has-flag": "^3.0.0" } }, - "svg2img": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/svg2img/-/svg2img-0.6.1.tgz", - "integrity": "sha512-rjrh0fX5/BjNyoZ7RARFTvXSFz49ak2sRTq7GWmEF5JnnisyRfA0275UmJRQWJrFWFv2mxhaN1gfV1oZAXGkCw==", - "requires": { - "atob": "^2.0.0", - "btoa": "^1.1.2", - "canvas": "^2.0.0-alpha.13", - "canvg": "^1.5.3" - } - }, "symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", - "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true }, "syntax-error": { "version": "1.4.0", @@ -5987,20 +5688,6 @@ "acorn-node": "^1.2.0" } }, - "tar": { - "version": "4.4.10", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz", - "integrity": "sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==", - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.3.5", - "minizlib": "^1.2.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.3" - } - }, "test-exclude": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", @@ -6108,6 +5795,7 @@ "version": "2.5.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, "requires": { "psl": "^1.1.28", "punycode": "^2.1.1" @@ -6138,6 +5826,7 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, "requires": { "safe-buffer": "^5.0.1" } @@ -6145,12 +5834,14 @@ "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, "requires": { "prelude-ls": "~1.1.2" } @@ -6265,6 +5956,7 @@ "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, "requires": { "punycode": "^2.1.0" } @@ -6319,7 +6011,8 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true }, "util.promisify": { "version": "1.0.0", @@ -6334,7 +6027,8 @@ "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true }, "validate-npm-package-license": { "version": "3.0.4", @@ -6350,6 +6044,7 @@ "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, "requires": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", @@ -6427,14 +6122,6 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "requires": { - "string-width": "^1.0.2 || 2" - } - }, "wordwrap": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", @@ -6491,7 +6178,8 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true }, "write-file-atomic": { "version": "2.4.1", @@ -6543,11 +6231,6 @@ "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", "dev": true }, - "xmldom": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz", - "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk=" - }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", @@ -6560,10 +6243,14 @@ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "dev": true }, - "yallist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", - "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==" + "yaml": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.6.0.tgz", + "integrity": "sha512-iZfse3lwrJRoSlfs/9KQ9iIXxs9++RvBFVzAqbbBiFT+giYtyanevreF9r61ZTbGMgWQBxAua3FzJiniiJXWWw==", + "dev": true, + "requires": { + "@babel/runtime": "^7.4.5" + } }, "yargs": { "version": "12.0.5", diff --git a/package.json b/package.json index 59f8c65..a5bed89 100644 --- a/package.json +++ b/package.json @@ -38,12 +38,13 @@ ] }, "devDependencies": { - "uglify-es": "^3.3.9", "browserify": "^16.3.0", "coveralls": "^3.0.4", "jest": "^24.8.0", "jshint": "^2.10.2", "node-svn-ultimate": "^1.2.0", - "rimraf": "^2.6.3" + "rimraf": "^2.6.3", + "uglify-es": "^3.3.9", + "yaml": "^1.6.0" } } diff --git a/preview/links.svg b/preview/links.svg index cb0f6ea..3ec71df 100644 --- a/preview/links.svg +++ b/preview/links.svg @@ -1,4 +1,5 @@ - + diff --git a/preview/sample.svg b/preview/sample.svg index 0effa66..d888704 100644 --- a/preview/sample.svg +++ b/preview/sample.svg @@ -1,23 +1,27 @@ - + + + + + + + "hello" + + - + - - my app + + my app - + - - world - - - - - + + world \ No newline at end of file