From 9a697e2b393340c3cacd97468baa318e4c883d98 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Thu, 20 Oct 2022 00:10:28 +0200 Subject: [PATCH] Bump plist dependency (#57) --- dist/index.js | 6404 +++++++++++++++++++++++++++++++-------------- package-lock.json | 63 +- package.json | 4 +- 3 files changed, 4500 insertions(+), 1971 deletions(-) diff --git a/dist/index.js b/dist/index.js index 61b722e..3a35059 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2654,6 +2654,9 @@ function walk_obj(next, next_child) { // a typed array next_child.ele('data').raw(base64.fromByteArray(new Uint8Array(next.buffer), next_child)); + } else if ('Null' === name) { + next_child.ele('null').txt(''); + } } @@ -2794,8 +2797,9 @@ function parsePlistXML (node) { counter += 1; } if (counter % 2 === 1) { - throw new Error('Missing value for "' + key + '" while parsing '); + new_obj[key] = ''; } + return new_obj; } else if (node.nodeName === 'array') { @@ -2818,6 +2822,12 @@ function parsePlistXML (node) { if (isEmptyNode(node)) { return ''; } + + invariant( + node.childNodes[0].nodeValue !== '__proto__', + '__proto__ keys can lead to prototype pollution. More details on CVE-2022-22912' + ); + return node.childNodes[0].nodeValue; } else if (node.nodeName === 'string') { res = ''; @@ -2871,11 +2881,16 @@ function parsePlistXML (node) { ) return new Date(node.childNodes[0].nodeValue); + } else if (node.nodeName === 'null') { + return null; + } else if (node.nodeName === 'true') { return true; } else if (node.nodeName === 'false') { return false; + } else { + throw new Error('Invalid PLIST tag ' + node.nodeName); } } @@ -8612,20 +8627,70 @@ function version(uuid) { var _default = version; exports["default"] = _default; +/***/ }), + +/***/ 2839: +/***/ (function(module) { + +// Generated by CoffeeScript 2.4.1 +(function() { + module.exports = { + Disconnected: 1, + Preceding: 2, + Following: 4, + Contains: 8, + ContainedBy: 16, + ImplementationSpecific: 32 + }; + +}).call(this); + + +/***/ }), + +/***/ 9267: +/***/ (function(module) { + +// Generated by CoffeeScript 2.4.1 +(function() { + module.exports = { + Element: 1, + Attribute: 2, + Text: 3, + CData: 4, + EntityReference: 5, + EntityDeclaration: 6, + ProcessingInstruction: 7, + Comment: 8, + Document: 9, + DocType: 10, + DocumentFragment: 11, + NotationDeclaration: 12, + // Numeric codes up to 200 are reserved to W3C for possible future use. + // Following are types internal to this library: + Declaration: 201, + Raw: 202, + AttributeDeclaration: 203, + ElementDeclaration: 204, + Dummy: 205 + }; + +}).call(this); + + /***/ }), /***/ 8229: /***/ (function(module) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var assign, isArray, isEmpty, isFunction, isObject, isPlainObject, - slice = [].slice, + // Copies all enumerable own properties from `sources` to `target` + var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject, hasProp = {}.hasOwnProperty; - assign = function() { - var i, key, len, source, sources, target; - target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : []; + assign = function(target, ...sources) { + var i, key, len, source; if (isFunction(Object.assign)) { Object.assign.apply(null, arguments); } else { @@ -8642,15 +8707,18 @@ exports["default"] = _default; return target; }; + // Determines if `val` is a Function object isFunction = function(val) { return !!val && Object.prototype.toString.call(val) === '[object Function]'; }; + // Determines if `val` is an Object isObject = function(val) { var ref; return !!val && ((ref = typeof val) === 'function' || ref === 'object'); }; + // Determines if `val` is an Array isArray = function(val) { if (isFunction(Array.isArray)) { return Array.isArray(val); @@ -8659,6 +8727,7 @@ exports["default"] = _default; } }; + // Determines if `val` is an empty Array or an Object with no own properties isEmpty = function(val) { var key; if (isArray(val)) { @@ -8672,11 +8741,21 @@ exports["default"] = _default; } }; + // Determines if `val` is a plain Object isPlainObject = function(val) { var ctor, proto; return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object)); }; + // Gets the primitive value of an object + getValue = function(obj) { + if (isFunction(obj.valueOf)) { + return obj.valueOf(); + } else { + return obj; + } + }; + module.exports.assign = assign; module.exports.isFunction = isFunction; @@ -8689,574 +8768,972 @@ exports["default"] = _default; module.exports.isPlainObject = isPlainObject; + module.exports.getValue = getValue; + }).call(this); /***/ }), -/***/ 8376: +/***/ 9766: /***/ (function(module) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLAttribute; - - module.exports = XMLAttribute = (function() { - function XMLAttribute(parent, name, value) { - this.options = parent.options; - this.stringify = parent.stringify; - if (name == null) { - throw new Error("Missing attribute name of element " + parent.name); - } - if (value == null) { - throw new Error("Missing attribute value for attribute " + name + " of element " + parent.name); - } - this.name = this.stringify.attName(name); - this.value = this.stringify.attValue(value); - } - - XMLAttribute.prototype.clone = function() { - return Object.create(this); - }; - - XMLAttribute.prototype.toString = function(options) { - return this.options.writer.set(options).attribute(this); - }; - - return XMLAttribute; - - })(); + module.exports = { + None: 0, + OpenTag: 1, + InsideTag: 2, + CloseTag: 3 + }; }).call(this); /***/ }), -/***/ 333: +/***/ 8376: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLCData, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + var NodeType, XMLAttribute, XMLNode; + + NodeType = __nccwpck_require__(9267); XMLNode = __nccwpck_require__(7608); - module.exports = XMLCData = (function(superClass) { - extend(XMLCData, superClass); + // Represents an attribute + module.exports = XMLAttribute = (function() { + class XMLAttribute { + // Initializes a new instance of `XMLAttribute` + + // `parent` the parent node + // `name` attribute target + // `value` attribute value + constructor(parent, name, value) { + this.parent = parent; + if (this.parent) { + this.options = this.parent.options; + this.stringify = this.parent.stringify; + } + if (name == null) { + throw new Error("Missing attribute name. " + this.debugInfo(name)); + } + this.name = this.stringify.name(name); + this.value = this.stringify.attValue(value); + this.type = NodeType.Attribute; + // DOM level 3 + this.isId = false; + this.schemaTypeInfo = null; + } + + // Creates and returns a deep clone of `this` + clone() { + return Object.create(this); + } - function XMLCData(parent, text) { - XMLCData.__super__.constructor.call(this, parent); - if (text == null) { - throw new Error("Missing CDATA text"); + // Converts the XML fragment to string + + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.attribute(this, this.options.writer.filterOptions(options)); } - this.text = this.stringify.cdata(text); - } - XMLCData.prototype.clone = function() { - return Object.create(this); - }; + + // Returns debug string for this node + debugInfo(name) { + name = name || this.name; + if (name == null) { + return "parent: <" + this.parent.name + ">"; + } else { + return "attribute: {" + name + "}, parent: <" + this.parent.name + ">"; + } + } + + isEqualNode(node) { + if (node.namespaceURI !== this.namespaceURI) { + return false; + } + if (node.prefix !== this.prefix) { + return false; + } + if (node.localName !== this.localName) { + return false; + } + if (node.value !== this.value) { + return false; + } + return true; + } - XMLCData.prototype.toString = function(options) { - return this.options.writer.set(options).cdata(this); }; - return XMLCData; + // DOM level 1 + Object.defineProperty(XMLAttribute.prototype, 'nodeType', { + get: function() { + return this.type; + } + }); + + Object.defineProperty(XMLAttribute.prototype, 'ownerElement', { + get: function() { + return this.parent; + } + }); + + // DOM level 3 + Object.defineProperty(XMLAttribute.prototype, 'textContent', { + get: function() { + return this.value; + }, + set: function(value) { + return this.value = value || ''; + } + }); + + // DOM level 4 + Object.defineProperty(XMLAttribute.prototype, 'namespaceURI', { + get: function() { + return ''; + } + }); + + Object.defineProperty(XMLAttribute.prototype, 'prefix', { + get: function() { + return ''; + } + }); + + Object.defineProperty(XMLAttribute.prototype, 'localName', { + get: function() { + return this.name; + } + }); + + Object.defineProperty(XMLAttribute.prototype, 'specified', { + get: function() { + return true; + } + }); + + return XMLAttribute; - })(XMLNode); + }).call(this); }).call(this); /***/ }), -/***/ 4407: +/***/ 333: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLComment, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + var NodeType, XMLCData, XMLCharacterData; - XMLNode = __nccwpck_require__(7608); + NodeType = __nccwpck_require__(9267); + + XMLCharacterData = __nccwpck_require__(7709); - module.exports = XMLComment = (function(superClass) { - extend(XMLComment, superClass); + // Represents a CDATA node + module.exports = XMLCData = class XMLCData extends XMLCharacterData { + // Initializes a new instance of `XMLCData` - function XMLComment(parent, text) { - XMLComment.__super__.constructor.call(this, parent); + // `text` CDATA text + constructor(parent, text) { + super(parent); if (text == null) { - throw new Error("Missing comment text"); + throw new Error("Missing CDATA text. " + this.debugInfo()); } - this.text = this.stringify.comment(text); + this.name = "#cdata-section"; + this.type = NodeType.CData; + this.value = this.stringify.cdata(text); } - XMLComment.prototype.clone = function() { + // Creates and returns a deep clone of `this` + clone() { return Object.create(this); - }; + } - XMLComment.prototype.toString = function(options) { - return this.options.writer.set(options).comment(this); - }; + // Converts the XML fragment to string - return XMLComment; + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.cdata(this, this.options.writer.filterOptions(options)); + } - })(XMLNode); + }; }).call(this); /***/ }), -/***/ 1015: +/***/ 7709: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLDTDAttList, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + var XMLCharacterData, XMLNode; XMLNode = __nccwpck_require__(7608); - module.exports = XMLDTDAttList = (function(superClass) { - extend(XMLDTDAttList, superClass); + // Represents a character data node + module.exports = XMLCharacterData = (function() { + class XMLCharacterData extends XMLNode { + // Initializes a new instance of `XMLCharacterData` - function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) { - XMLDTDAttList.__super__.constructor.call(this, parent); - if (elementName == null) { - throw new Error("Missing DTD element name"); + constructor(parent) { + super(parent); + this.value = ''; } - if (attributeName == null) { - throw new Error("Missing DTD attribute name"); + + + // Creates and returns a deep clone of `this` + clone() { + return Object.create(this); } - if (!attributeType) { - throw new Error("Missing DTD attribute type"); + + // DOM level 1 functions to be implemented later + substringData(offset, count) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); } - if (!defaultValueType) { - throw new Error("Missing DTD attribute default"); + + appendData(arg) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); } - if (defaultValueType.indexOf('#') !== 0) { - defaultValueType = '#' + defaultValueType; + + insertData(offset, arg) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); } - if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) { - throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT"); + + deleteData(offset, count) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); } - if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) { - throw new Error("Default value only applies to #FIXED or #DEFAULT"); + + replaceData(offset, count, arg) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + isEqualNode(node) { + if (!super.isEqualNode(node)) { + return false; + } + if (node.data !== this.data) { + return false; + } + return true; } - this.elementName = this.stringify.eleName(elementName); - this.attributeName = this.stringify.attName(attributeName); - this.attributeType = this.stringify.dtdAttType(attributeType); - this.defaultValue = this.stringify.dtdAttDefault(defaultValue); - this.defaultValueType = defaultValueType; - } - XMLDTDAttList.prototype.toString = function(options) { - return this.options.writer.set(options).dtdAttList(this); }; - return XMLDTDAttList; + // DOM level 1 + Object.defineProperty(XMLCharacterData.prototype, 'data', { + get: function() { + return this.value; + }, + set: function(value) { + return this.value = value || ''; + } + }); + + Object.defineProperty(XMLCharacterData.prototype, 'length', { + get: function() { + return this.value.length; + } + }); + + // DOM level 3 + Object.defineProperty(XMLCharacterData.prototype, 'textContent', { + get: function() { + return this.value; + }, + set: function(value) { + return this.value = value || ''; + } + }); + + return XMLCharacterData; - })(XMLNode); + }).call(this); }).call(this); /***/ }), -/***/ 2421: +/***/ 4407: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLDTDElement, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + var NodeType, XMLCharacterData, XMLComment; - XMLNode = __nccwpck_require__(7608); + NodeType = __nccwpck_require__(9267); - module.exports = XMLDTDElement = (function(superClass) { - extend(XMLDTDElement, superClass); + XMLCharacterData = __nccwpck_require__(7709); - function XMLDTDElement(parent, name, value) { - XMLDTDElement.__super__.constructor.call(this, parent); - if (name == null) { - throw new Error("Missing DTD element name"); - } - if (!value) { - value = '(#PCDATA)'; - } - if (Array.isArray(value)) { - value = '(' + value.join(',') + ')'; + // Represents a comment node + module.exports = XMLComment = class XMLComment extends XMLCharacterData { + // Initializes a new instance of `XMLComment` + + // `text` comment text + constructor(parent, text) { + super(parent); + if (text == null) { + throw new Error("Missing comment text. " + this.debugInfo()); } - this.name = this.stringify.eleName(name); - this.value = this.stringify.dtdElementValue(value); + this.name = "#comment"; + this.type = NodeType.Comment; + this.value = this.stringify.comment(text); } - XMLDTDElement.prototype.toString = function(options) { - return this.options.writer.set(options).dtdElement(this); - }; + // Creates and returns a deep clone of `this` + clone() { + return Object.create(this); + } + + // Converts the XML fragment to string - return XMLDTDElement; + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.comment(this, this.options.writer.filterOptions(options)); + } - })(XMLNode); + }; }).call(this); /***/ }), -/***/ 53: +/***/ 7465: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLDTDEntity, XMLNode, isObject, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList; + + XMLDOMErrorHandler = __nccwpck_require__(6744); + + XMLDOMStringList = __nccwpck_require__(7028); + + // Implements the DOMConfiguration interface + module.exports = XMLDOMConfiguration = (function() { + class XMLDOMConfiguration { + constructor() { + var clonedSelf; + this.defaultParams = { + "canonical-form": false, + "cdata-sections": false, + "comments": false, + "datatype-normalization": false, + "element-content-whitespace": true, + "entities": true, + "error-handler": new XMLDOMErrorHandler(), + "infoset": true, + "validate-if-schema": false, + "namespaces": true, + "namespace-declarations": true, + "normalize-characters": false, + "schema-location": '', + "schema-type": '', + "split-cdata-sections": true, + "validate": false, + "well-formed": true + }; + this.params = clonedSelf = Object.create(this.defaultParams); + } - isObject = (__nccwpck_require__(8229).isObject); + // Gets the value of a parameter. - XMLNode = __nccwpck_require__(7608); + // `name` name of the parameter + getParameter(name) { + if (this.params.hasOwnProperty(name)) { + return this.params[name]; + } else { + return null; + } + } - module.exports = XMLDTDEntity = (function(superClass) { - extend(XMLDTDEntity, superClass); + // Checks if setting a parameter to a specific value is supported. - function XMLDTDEntity(parent, pe, name, value) { - XMLDTDEntity.__super__.constructor.call(this, parent); - if (name == null) { - throw new Error("Missing entity name"); - } - if (value == null) { - throw new Error("Missing entity value"); + // `name` name of the parameter + // `value` parameter value + canSetParameter(name, value) { + return true; } - this.pe = !!pe; - this.name = this.stringify.eleName(name); - if (!isObject(value)) { - this.value = this.stringify.dtdEntityValue(value); - } else { - if (!value.pubID && !value.sysID) { - throw new Error("Public and/or system identifiers are required for an external entity"); - } - if (value.pubID && !value.sysID) { - throw new Error("System identifier is required for a public external entity"); - } - if (value.pubID != null) { - this.pubID = this.stringify.dtdPubID(value.pubID); - } - if (value.sysID != null) { - this.sysID = this.stringify.dtdSysID(value.sysID); - } - if (value.nData != null) { - this.nData = this.stringify.dtdNData(value.nData); - } - if (this.pe && this.nData) { - throw new Error("Notation declaration is not allowed in a parameter entity"); + + // Sets the value of a parameter. + + // `name` name of the parameter + // `value` new value or null if the user wishes to unset the parameter + setParameter(name, value) { + if (value != null) { + return this.params[name] = value; + } else { + return delete this.params[name]; } } - } - XMLDTDEntity.prototype.toString = function(options) { - return this.options.writer.set(options).dtdEntity(this); }; - return XMLDTDEntity; + // Returns the list of parameter names + Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', { + get: function() { + return new XMLDOMStringList(Object.keys(this.defaultParams)); + } + }); + + return XMLDOMConfiguration; - })(XMLNode); + }).call(this); }).call(this); /***/ }), -/***/ 2837: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 6744: +/***/ (function(module) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLDTDNotation, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + // Represents the error handler for DOM operations + var XMLDOMErrorHandler; - XMLNode = __nccwpck_require__(7608); - - module.exports = XMLDTDNotation = (function(superClass) { - extend(XMLDTDNotation, superClass); + module.exports = XMLDOMErrorHandler = class XMLDOMErrorHandler { + // Initializes a new instance of `XMLDOMErrorHandler` - function XMLDTDNotation(parent, name, value) { - XMLDTDNotation.__super__.constructor.call(this, parent); - if (name == null) { - throw new Error("Missing notation name"); - } - if (!value.pubID && !value.sysID) { - throw new Error("Public or system identifiers are required for an external entity"); - } - this.name = this.stringify.eleName(name); - if (value.pubID != null) { - this.pubID = this.stringify.dtdPubID(value.pubID); - } - if (value.sysID != null) { - this.sysID = this.stringify.dtdSysID(value.sysID); - } - } + constructor() {} - XMLDTDNotation.prototype.toString = function(options) { - return this.options.writer.set(options).dtdNotation(this); - }; + // Called on the error handler when an error occurs. - return XMLDTDNotation; + // `error` the error message as a string + handleError(error) { + throw new Error(error); + } - })(XMLNode); + }; }).call(this); /***/ }), -/***/ 6364: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 8310: +/***/ (function(module) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLDeclaration, XMLNode, isObject, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + // Implements the DOMImplementation interface + var XMLDOMImplementation; + + module.exports = XMLDOMImplementation = class XMLDOMImplementation { + // Tests if the DOM implementation implements a specific feature. + + // `feature` package name of the feature to test. In Level 1, the + // legal values are "HTML" and "XML" (case-insensitive). + // `version` version number of the package name to test. + // In Level 1, this is the string "1.0". If the version is + // not specified, supporting any version of the feature will + // cause the method to return true. + hasFeature(feature, version) { + return true; + } - isObject = (__nccwpck_require__(8229).isObject); + // Creates a new document type declaration. - XMLNode = __nccwpck_require__(7608); + // `qualifiedName` qualified name of the document type to be created + // `publicId` public identifier of the external subset + // `systemId` system identifier of the external subset + createDocumentType(qualifiedName, publicId, systemId) { + throw new Error("This DOM method is not implemented."); + } - module.exports = XMLDeclaration = (function(superClass) { - extend(XMLDeclaration, superClass); + // Creates a new document. - function XMLDeclaration(parent, version, encoding, standalone) { - var ref; - XMLDeclaration.__super__.constructor.call(this, parent); - if (isObject(version)) { - ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone; - } - if (!version) { - version = '1.0'; - } - this.version = this.stringify.xmlVersion(version); - if (encoding != null) { - this.encoding = this.stringify.xmlEncoding(encoding); - } - if (standalone != null) { - this.standalone = this.stringify.xmlStandalone(standalone); - } + // `namespaceURI` namespace URI of the document element to create + // `qualifiedName` the qualified name of the document to be created + // `doctype` the type of document to be created or null + createDocument(namespaceURI, qualifiedName, doctype) { + throw new Error("This DOM method is not implemented."); } - XMLDeclaration.prototype.toString = function(options) { - return this.options.writer.set(options).declaration(this); - }; + // Creates a new HTML document. + + // `title` document title + createHTMLDocument(title) { + throw new Error("This DOM method is not implemented."); + } + + // Returns a specialized object which implements the specialized APIs + // of the specified feature and version. - return XMLDeclaration; + // `feature` name of the feature requested. + // `version` version number of the feature to test + getFeature(feature, version) { + throw new Error("This DOM method is not implemented."); + } - })(XMLNode); + }; }).call(this); /***/ }), -/***/ 1801: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 7028: +/***/ (function(module) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNode, isObject, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + // Represents a list of string entries + var XMLDOMStringList; - isObject = (__nccwpck_require__(8229).isObject); + module.exports = XMLDOMStringList = (function() { + class XMLDOMStringList { + // Initializes a new instance of `XMLDOMStringList` + // This is just a wrapper around an ordinary + // JS array. - XMLNode = __nccwpck_require__(7608); + // `arr` the array of string values + constructor(arr) { + this.arr = arr || []; + } - XMLDTDAttList = __nccwpck_require__(1015); + // Returns the indexth item in the collection. - XMLDTDEntity = __nccwpck_require__(53); + // `index` index into the collection + item(index) { + return this.arr[index] || null; + } - XMLDTDElement = __nccwpck_require__(2421); + // Test if a string is part of this DOMStringList. - XMLDTDNotation = __nccwpck_require__(2837); + // `str` the string to look for + contains(str) { + return this.arr.indexOf(str) !== -1; + } - module.exports = XMLDocType = (function(superClass) { - extend(XMLDocType, superClass); + }; - function XMLDocType(parent, pubID, sysID) { - var ref, ref1; - XMLDocType.__super__.constructor.call(this, parent); - this.documentObject = parent; - if (isObject(pubID)) { - ref = pubID, pubID = ref.pubID, sysID = ref.sysID; - } - if (sysID == null) { - ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1]; + // Returns the number of strings in the list. + Object.defineProperty(XMLDOMStringList.prototype, 'length', { + get: function() { + return this.arr.length; } - if (pubID != null) { - this.pubID = this.stringify.dtdPubID(pubID); - } - if (sysID != null) { - this.sysID = this.stringify.dtdSysID(sysID); - } - } + }); - XMLDocType.prototype.element = function(name, value) { - var child; - child = new XMLDTDElement(this, name, value); - this.children.push(child); - return this; - }; + return XMLDOMStringList; - XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { - var child; - child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); - this.children.push(child); - return this; - }; + }).call(this); - XMLDocType.prototype.entity = function(name, value) { - var child; - child = new XMLDTDEntity(this, false, name, value); - this.children.push(child); - return this; - }; +}).call(this); - XMLDocType.prototype.pEntity = function(name, value) { - var child; - child = new XMLDTDEntity(this, true, name, value); - this.children.push(child); - return this; - }; - XMLDocType.prototype.notation = function(name, value) { - var child; - child = new XMLDTDNotation(this, name, value); - this.children.push(child); - return this; - }; +/***/ }), - XMLDocType.prototype.toString = function(options) { - return this.options.writer.set(options).docType(this); - }; +/***/ 1015: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - XMLDocType.prototype.ele = function(name, value) { - return this.element(name, value); - }; +// Generated by CoffeeScript 2.4.1 +(function() { + var NodeType, XMLDTDAttList, XMLNode; - XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { - return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue); - }; + XMLNode = __nccwpck_require__(7608); - XMLDocType.prototype.ent = function(name, value) { - return this.entity(name, value); - }; + NodeType = __nccwpck_require__(9267); + + // Represents an attribute list + module.exports = XMLDTDAttList = class XMLDTDAttList extends XMLNode { + // Initializes a new instance of `XMLDTDAttList` + + // `parent` the parent `XMLDocType` element + // `elementName` the name of the element containing this attribute + // `attributeName` attribute name + // `attributeType` type of the attribute + // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, + // #FIXED or #DEFAULT) + // `defaultValue` default value of the attribute + // (only used for #FIXED or #DEFAULT) + constructor(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) { + super(parent); + if (elementName == null) { + throw new Error("Missing DTD element name. " + this.debugInfo()); + } + if (attributeName == null) { + throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName)); + } + if (!attributeType) { + throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName)); + } + if (!defaultValueType) { + throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName)); + } + if (defaultValueType.indexOf('#') !== 0) { + defaultValueType = '#' + defaultValueType; + } + if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) { + throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName)); + } + if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) { + throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName)); + } + this.elementName = this.stringify.name(elementName); + this.type = NodeType.AttributeDeclaration; + this.attributeName = this.stringify.name(attributeName); + this.attributeType = this.stringify.dtdAttType(attributeType); + if (defaultValue) { + this.defaultValue = this.stringify.dtdAttDefault(defaultValue); + } + this.defaultValueType = defaultValueType; + } - XMLDocType.prototype.pent = function(name, value) { - return this.pEntity(name, value); - }; + // Converts the XML fragment to string - XMLDocType.prototype.not = function(name, value) { - return this.notation(name, value); - }; + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options)); + } - XMLDocType.prototype.up = function() { - return this.root() || this.documentObject; - }; + }; - return XMLDocType; +}).call(this); + + +/***/ }), + +/***/ 2421: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 2.4.1 +(function() { + var NodeType, XMLDTDElement, XMLNode; + + XMLNode = __nccwpck_require__(7608); + + NodeType = __nccwpck_require__(9267); + + // Represents an attribute + module.exports = XMLDTDElement = class XMLDTDElement extends XMLNode { + // Initializes a new instance of `XMLDTDElement` + + // `parent` the parent `XMLDocType` element + // `name` element name + // `value` element content (defaults to #PCDATA) + constructor(parent, name, value) { + super(parent); + if (name == null) { + throw new Error("Missing DTD element name. " + this.debugInfo()); + } + if (!value) { + value = '(#PCDATA)'; + } + if (Array.isArray(value)) { + value = '(' + value.join(',') + ')'; + } + this.name = this.stringify.name(name); + this.type = NodeType.ElementDeclaration; + this.value = this.stringify.dtdElementValue(value); + } - })(XMLNode); + // Converts the XML fragment to string + + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options)); + } + + }; }).call(this); /***/ }), -/***/ 3730: +/***/ 53: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + var NodeType, XMLDTDEntity, XMLNode, isObject; - isPlainObject = (__nccwpck_require__(8229).isPlainObject); + ({isObject} = __nccwpck_require__(8229)); XMLNode = __nccwpck_require__(7608); - XMLStringifier = __nccwpck_require__(8594); + NodeType = __nccwpck_require__(9267); + + // Represents an entity declaration in the DTD + module.exports = XMLDTDEntity = (function() { + class XMLDTDEntity extends XMLNode { + // Initializes a new instance of `XMLDTDEntity` + + // `parent` the parent `XMLDocType` element + // `pe` whether this is a parameter entity or a general entity + // defaults to `false` (general entity) + // `name` the name of the entity + // `value` internal entity value or an object with external entity details + // `value.pubID` public identifier + // `value.sysID` system identifier + // `value.nData` notation declaration + constructor(parent, pe, name, value) { + super(parent); + if (name == null) { + throw new Error("Missing DTD entity name. " + this.debugInfo(name)); + } + if (value == null) { + throw new Error("Missing DTD entity value. " + this.debugInfo(name)); + } + this.pe = !!pe; + this.name = this.stringify.name(name); + this.type = NodeType.EntityDeclaration; + if (!isObject(value)) { + this.value = this.stringify.dtdEntityValue(value); + this.internal = true; + } else { + if (!value.pubID && !value.sysID) { + throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name)); + } + if (value.pubID && !value.sysID) { + throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name)); + } + this.internal = false; + if (value.pubID != null) { + this.pubID = this.stringify.dtdPubID(value.pubID); + } + if (value.sysID != null) { + this.sysID = this.stringify.dtdSysID(value.sysID); + } + if (value.nData != null) { + this.nData = this.stringify.dtdNData(value.nData); + } + if (this.pe && this.nData) { + throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name)); + } + } + } - XMLStringWriter = __nccwpck_require__(5913); + // Converts the XML fragment to string - module.exports = XMLDocument = (function(superClass) { - extend(XMLDocument, superClass); + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options)); + } - function XMLDocument(options) { - XMLDocument.__super__.constructor.call(this, null); - options || (options = {}); - if (!options.writer) { - options.writer = new XMLStringWriter(); + }; + + // DOM level 1 + Object.defineProperty(XMLDTDEntity.prototype, 'publicId', { + get: function() { + return this.pubID; } - this.options = options; - this.stringify = new XMLStringifier(options); - this.isDocument = true; - } + }); - XMLDocument.prototype.end = function(writer) { - var writerOptions; - if (!writer) { - writer = this.options.writer; - } else if (isPlainObject(writer)) { - writerOptions = writer; - writer = this.options.writer.set(writerOptions); + Object.defineProperty(XMLDTDEntity.prototype, 'systemId', { + get: function() { + return this.sysID; + } + }); + + Object.defineProperty(XMLDTDEntity.prototype, 'notationName', { + get: function() { + return this.nData || null; + } + }); + + // DOM level 3 + Object.defineProperty(XMLDTDEntity.prototype, 'inputEncoding', { + get: function() { + return null; + } + }); + + Object.defineProperty(XMLDTDEntity.prototype, 'xmlEncoding', { + get: function() { + return null; + } + }); + + Object.defineProperty(XMLDTDEntity.prototype, 'xmlVersion', { + get: function() { + return null; + } + }); + + return XMLDTDEntity; + + }).call(this); + +}).call(this); + + +/***/ }), + +/***/ 2837: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 2.4.1 +(function() { + var NodeType, XMLDTDNotation, XMLNode; + + XMLNode = __nccwpck_require__(7608); + + NodeType = __nccwpck_require__(9267); + + // Represents a NOTATION entry in the DTD + module.exports = XMLDTDNotation = (function() { + class XMLDTDNotation extends XMLNode { + // Initializes a new instance of `XMLDTDNotation` + + // `parent` the parent `XMLDocType` element + // `name` the name of the notation + // `value` an object with external entity details + // `value.pubID` public identifier + // `value.sysID` system identifier + constructor(parent, name, value) { + super(parent); + if (name == null) { + throw new Error("Missing DTD notation name. " + this.debugInfo(name)); + } + if (!value.pubID && !value.sysID) { + throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name)); + } + this.name = this.stringify.name(name); + this.type = NodeType.NotationDeclaration; + if (value.pubID != null) { + this.pubID = this.stringify.dtdPubID(value.pubID); + } + if (value.sysID != null) { + this.sysID = this.stringify.dtdSysID(value.sysID); + } + } + + // Converts the XML fragment to string + + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options)); } - return writer.document(this); - }; - XMLDocument.prototype.toString = function(options) { - return this.options.writer.set(options).document(this); }; - return XMLDocument; + // DOM level 1 + Object.defineProperty(XMLDTDNotation.prototype, 'publicId', { + get: function() { + return this.pubID; + } + }); + + Object.defineProperty(XMLDTDNotation.prototype, 'systemId', { + get: function() { + return this.sysID; + } + }); + + return XMLDTDNotation; - })(XMLNode); + }).call(this); }).call(this); /***/ }), -/***/ 7356: +/***/ 6364: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, isFunction, isObject, isPlainObject, ref, - hasProp = {}.hasOwnProperty; + var NodeType, XMLDeclaration, XMLNode, isObject; - ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject; + ({isObject} = __nccwpck_require__(8229)); - XMLElement = __nccwpck_require__(9437); + XMLNode = __nccwpck_require__(7608); - XMLCData = __nccwpck_require__(333); + NodeType = __nccwpck_require__(9267); - XMLComment = __nccwpck_require__(4407); + // Represents the XML declaration + module.exports = XMLDeclaration = class XMLDeclaration extends XMLNode { + // Initializes a new instance of `XMLDeclaration` - XMLRaw = __nccwpck_require__(6329); + // `parent` the document object - XMLText = __nccwpck_require__(1318); + // `version` A version number string, e.g. 1.0 + // `encoding` Encoding declaration, e.g. UTF-8 + // `standalone` standalone document declaration: true or false + constructor(parent, version, encoding, standalone) { + super(parent); + // arguments may also be passed as an object + if (isObject(version)) { + ({version, encoding, standalone} = version); + } + if (!version) { + version = '1.0'; + } + this.type = NodeType.Declaration; + this.version = this.stringify.xmlVersion(version); + if (encoding != null) { + this.encoding = this.stringify.xmlEncoding(encoding); + } + if (standalone != null) { + this.standalone = this.stringify.xmlStandalone(standalone); + } + } - XMLProcessingInstruction = __nccwpck_require__(6939); + // Converts to string - XMLDeclaration = __nccwpck_require__(6364); + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.declaration(this, this.options.writer.filterOptions(options)); + } - XMLDocType = __nccwpck_require__(1801); + }; + +}).call(this); + + +/***/ }), + +/***/ 1801: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 2.4.1 +(function() { + var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, XMLNode, isObject; + + ({isObject} = __nccwpck_require__(8229)); + + XMLNode = __nccwpck_require__(7608); + + NodeType = __nccwpck_require__(9267); XMLDTDAttList = __nccwpck_require__(1015); @@ -9266,1314 +9743,3474 @@ exports["default"] = _default; XMLDTDNotation = __nccwpck_require__(2837); - XMLAttribute = __nccwpck_require__(8376); + XMLNamedNodeMap = __nccwpck_require__(4361); + + // Represents doctype declaration + module.exports = XMLDocType = (function() { + class XMLDocType extends XMLNode { + // Initializes a new instance of `XMLDocType` + + // `parent` the document object + + // `pubID` public identifier of the external subset + // `sysID` system identifier of the external subset + constructor(parent, pubID, sysID) { + var child, i, len, ref; + super(parent); + this.type = NodeType.DocType; + // set DTD name to the name of the root node + if (parent.children) { + ref = parent.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + if (child.type === NodeType.Element) { + this.name = child.name; + break; + } + } + } + this.documentObject = parent; + // arguments may also be passed as an object + if (isObject(pubID)) { + ({pubID, sysID} = pubID); + } + if (sysID == null) { + [sysID, pubID] = [pubID, sysID]; + } + if (pubID != null) { + this.pubID = this.stringify.dtdPubID(pubID); + } + if (sysID != null) { + this.sysID = this.stringify.dtdSysID(sysID); + } + } - XMLStringifier = __nccwpck_require__(8594); + // Creates an element type declaration - XMLStringWriter = __nccwpck_require__(5913); + // `name` element name + // `value` element content (defaults to #PCDATA) + element(name, value) { + var child; + child = new XMLDTDElement(this, name, value); + this.children.push(child); + return this; + } - module.exports = XMLDocumentCB = (function() { - function XMLDocumentCB(options, onData, onEnd) { - var writerOptions; - options || (options = {}); - if (!options.writer) { - options.writer = new XMLStringWriter(options); - } else if (isPlainObject(options.writer)) { - writerOptions = options.writer; - options.writer = new XMLStringWriter(writerOptions); + // Creates an attribute declaration + + // `elementName` the name of the element containing this attribute + // `attributeName` attribute name + // `attributeType` type of the attribute (defaults to CDATA) + // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or + // #DEFAULT) (defaults to #IMPLIED) + // `defaultValue` default value of the attribute + // (only used for #FIXED or #DEFAULT) + attList(elementName, attributeName, attributeType, defaultValueType, defaultValue) { + var child; + child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); + this.children.push(child); + return this; } - this.options = options; - this.writer = options.writer; - this.stringify = new XMLStringifier(options); - this.onDataCallback = onData || function() {}; - this.onEndCallback = onEnd || function() {}; - this.currentNode = null; - this.currentLevel = -1; - this.openTags = {}; - this.documentStarted = false; - this.documentCompleted = false; - this.root = null; - } - XMLDocumentCB.prototype.node = function(name, attributes, text) { - var ref1; - if (name == null) { - throw new Error("Missing node name"); + // Creates a general entity declaration + + // `name` the name of the entity + // `value` internal entity value or an object with external entity details + // `value.pubID` public identifier + // `value.sysID` system identifier + // `value.nData` notation declaration + entity(name, value) { + var child; + child = new XMLDTDEntity(this, false, name, value); + this.children.push(child); + return this; } - if (this.root && this.currentLevel === -1) { - throw new Error("Document can only have one root node"); + + // Creates a parameter entity declaration + + // `name` the name of the entity + // `value` internal entity value or an object with external entity details + // `value.pubID` public identifier + // `value.sysID` system identifier + pEntity(name, value) { + var child; + child = new XMLDTDEntity(this, true, name, value); + this.children.push(child); + return this; } - this.openCurrent(); - name = name.valueOf(); - if (attributes == null) { - attributes = {}; + + // Creates a NOTATION declaration + + // `name` the name of the notation + // `value` an object with external entity details + // `value.pubID` public identifier + // `value.sysID` system identifier + notation(name, value) { + var child; + child = new XMLDTDNotation(this, name, value); + this.children.push(child); + return this; } - attributes = attributes.valueOf(); - if (!isObject(attributes)) { - ref1 = [attributes, text], text = ref1[0], attributes = ref1[1]; + + // Converts to string + + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.docType(this, this.options.writer.filterOptions(options)); } - this.currentNode = new XMLElement(this, name, attributes); - this.currentNode.children = false; - this.currentLevel++; - this.openTags[this.currentLevel] = this.currentNode; - if (text != null) { - this.text(text); + + // Aliases + ele(name, value) { + return this.element(name, value); } - return this; - }; - XMLDocumentCB.prototype.element = function(name, attributes, text) { - if (this.currentNode && this.currentNode instanceof XMLDocType) { - return this.dtdElement.apply(this, arguments); - } else { - return this.node(name, attributes, text); + att(elementName, attributeName, attributeType, defaultValueType, defaultValue) { + return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue); } - }; - XMLDocumentCB.prototype.attribute = function(name, value) { + ent(name, value) { + return this.entity(name, value); + } + + pent(name, value) { + return this.pEntity(name, value); + } + + not(name, value) { + return this.notation(name, value); + } + + up() { + return this.root() || this.documentObject; + } + + isEqualNode(node) { + if (!super.isEqualNode(node)) { + return false; + } + if (node.name !== this.name) { + return false; + } + if (node.publicId !== this.publicId) { + return false; + } + if (node.systemId !== this.systemId) { + return false; + } + return true; + } + + }; + + // DOM level 1 + Object.defineProperty(XMLDocType.prototype, 'entities', { + get: function() { + var child, i, len, nodes, ref; + nodes = {}; + ref = this.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + if ((child.type === NodeType.EntityDeclaration) && !child.pe) { + nodes[child.name] = child; + } + } + return new XMLNamedNodeMap(nodes); + } + }); + + Object.defineProperty(XMLDocType.prototype, 'notations', { + get: function() { + var child, i, len, nodes, ref; + nodes = {}; + ref = this.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + if (child.type === NodeType.NotationDeclaration) { + nodes[child.name] = child; + } + } + return new XMLNamedNodeMap(nodes); + } + }); + + // DOM level 2 + Object.defineProperty(XMLDocType.prototype, 'publicId', { + get: function() { + return this.pubID; + } + }); + + Object.defineProperty(XMLDocType.prototype, 'systemId', { + get: function() { + return this.sysID; + } + }); + + Object.defineProperty(XMLDocType.prototype, 'internalSubset', { + get: function() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + }); + + return XMLDocType; + + }).call(this); + +}).call(this); + + +/***/ }), + +/***/ 3730: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 2.4.1 +(function() { + var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject; + + ({isPlainObject} = __nccwpck_require__(8229)); + + XMLDOMImplementation = __nccwpck_require__(8310); + + XMLDOMConfiguration = __nccwpck_require__(7465); + + XMLNode = __nccwpck_require__(7608); + + NodeType = __nccwpck_require__(9267); + + XMLStringifier = __nccwpck_require__(8594); + + XMLStringWriter = __nccwpck_require__(5913); + + // Represents an XML builder + module.exports = XMLDocument = (function() { + class XMLDocument extends XMLNode { + // Initializes a new instance of `XMLDocument` + + // `options.keepNullNodes` whether nodes with null values will be kept + // or ignored: true or false + // `options.keepNullAttributes` whether attributes with null values will be + // kept or ignored: true or false + // `options.ignoreDecorators` whether decorator strings will be ignored when + // converting JS objects: true or false + // `options.separateArrayItems` whether array items are created as separate + // nodes when passed as an object value: true or false + // `options.noDoubleEncoding` whether existing html entities are encoded: + // true or false + // `options.stringify` a set of functions to use for converting values to + // strings + // `options.writer` the default XML writer to use for converting nodes to + // string. If the default writer is not set, the built-in XMLStringWriter + // will be used instead. + constructor(options) { + super(null); + this.name = "#document"; + this.type = NodeType.Document; + this.documentURI = null; + this.domConfig = new XMLDOMConfiguration(); + options || (options = {}); + if (!options.writer) { + options.writer = new XMLStringWriter(); + } + this.options = options; + this.stringify = new XMLStringifier(options); + } + + // Ends the document and passes it to the given XML writer + + // `writer` is either an XML writer or a plain object to pass to the + // constructor of the default XML writer. The default writer is assigned when + // creating the XML document. Following flags are recognized by the + // built-in XMLStringWriter: + // `writer.pretty` pretty prints the result + // `writer.indent` indentation for pretty print + // `writer.offset` how many indentations to add to every line for pretty print + // `writer.newline` newline sequence for pretty print + end(writer) { + var writerOptions; + writerOptions = {}; + if (!writer) { + writer = this.options.writer; + } else if (isPlainObject(writer)) { + writerOptions = writer; + writer = this.options.writer; + } + return writer.document(this, writer.filterOptions(writerOptions)); + } + + // Converts the XML document to string + + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.document(this, this.options.writer.filterOptions(options)); + } + + // DOM level 1 functions to be implemented later + createElement(tagName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createDocumentFragment() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createTextNode(data) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createComment(data) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createCDATASection(data) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createProcessingInstruction(target, data) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createAttribute(name) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createEntityReference(name) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + getElementsByTagName(tagname) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + // DOM level 2 functions to be implemented later + importNode(importedNode, deep) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createElementNS(namespaceURI, qualifiedName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createAttributeNS(namespaceURI, qualifiedName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + getElementsByTagNameNS(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + getElementById(elementId) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + // DOM level 3 functions to be implemented later + adoptNode(source) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + normalizeDocument() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + renameNode(node, namespaceURI, qualifiedName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + // DOM level 4 functions to be implemented later + getElementsByClassName(classNames) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createEvent(eventInterface) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createRange() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createNodeIterator(root, whatToShow, filter) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + createTreeWalker(root, whatToShow, filter) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + }; + + // DOM level 1 + Object.defineProperty(XMLDocument.prototype, 'implementation', { + value: new XMLDOMImplementation() + }); + + Object.defineProperty(XMLDocument.prototype, 'doctype', { + get: function() { + var child, i, len, ref; + ref = this.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + if (child.type === NodeType.DocType) { + return child; + } + } + return null; + } + }); + + Object.defineProperty(XMLDocument.prototype, 'documentElement', { + get: function() { + return this.rootObject || null; + } + }); + + // DOM level 3 + Object.defineProperty(XMLDocument.prototype, 'inputEncoding', { + get: function() { + return null; + } + }); + + Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', { + get: function() { + return false; + } + }); + + Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', { + get: function() { + if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { + return this.children[0].encoding; + } else { + return null; + } + } + }); + + Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', { + get: function() { + if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { + return this.children[0].standalone === 'yes'; + } else { + return false; + } + } + }); + + Object.defineProperty(XMLDocument.prototype, 'xmlVersion', { + get: function() { + if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { + return this.children[0].version; + } else { + return "1.0"; + } + } + }); + + // DOM level 4 + Object.defineProperty(XMLDocument.prototype, 'URL', { + get: function() { + return this.documentURI; + } + }); + + Object.defineProperty(XMLDocument.prototype, 'origin', { + get: function() { + return null; + } + }); + + Object.defineProperty(XMLDocument.prototype, 'compatMode', { + get: function() { + return null; + } + }); + + Object.defineProperty(XMLDocument.prototype, 'characterSet', { + get: function() { + return null; + } + }); + + Object.defineProperty(XMLDocument.prototype, 'contentType', { + get: function() { + return null; + } + }); + + return XMLDocument; + + }).call(this); + +}).call(this); + + +/***/ }), + +/***/ 7356: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 2.4.1 +(function() { + var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, + hasProp = {}.hasOwnProperty; + + ({isObject, isFunction, isPlainObject, getValue} = __nccwpck_require__(8229)); + + NodeType = __nccwpck_require__(9267); + + XMLDocument = __nccwpck_require__(3730); + + XMLElement = __nccwpck_require__(9437); + + XMLCData = __nccwpck_require__(333); + + XMLComment = __nccwpck_require__(4407); + + XMLRaw = __nccwpck_require__(6329); + + XMLText = __nccwpck_require__(1318); + + XMLProcessingInstruction = __nccwpck_require__(6939); + + XMLDeclaration = __nccwpck_require__(6364); + + XMLDocType = __nccwpck_require__(1801); + + XMLDTDAttList = __nccwpck_require__(1015); + + XMLDTDEntity = __nccwpck_require__(53); + + XMLDTDElement = __nccwpck_require__(2421); + + XMLDTDNotation = __nccwpck_require__(2837); + + XMLAttribute = __nccwpck_require__(8376); + + XMLStringifier = __nccwpck_require__(8594); + + XMLStringWriter = __nccwpck_require__(5913); + + WriterState = __nccwpck_require__(9766); + + // Represents an XML builder + module.exports = XMLDocumentCB = class XMLDocumentCB { + // Initializes a new instance of `XMLDocumentCB` + + // `options.keepNullNodes` whether nodes with null values will be kept + // or ignored: true or false + // `options.keepNullAttributes` whether attributes with null values will be + // kept or ignored: true or false + // `options.ignoreDecorators` whether decorator strings will be ignored when + // converting JS objects: true or false + // `options.separateArrayItems` whether array items are created as separate + // nodes when passed as an object value: true or false + // `options.noDoubleEncoding` whether existing html entities are encoded: + // true or false + // `options.stringify` a set of functions to use for converting values to + // strings + // `options.writer` the default XML writer to use for converting nodes to + // string. If the default writer is not set, the built-in XMLStringWriter + // will be used instead. + + // `onData` the function to be called when a new chunk of XML is output. The + // string containing the XML chunk is passed to `onData` as its first + // argument, and the current indentation level as its second argument. + // `onEnd` the function to be called when the XML document is completed with + // `end`. `onEnd` does not receive any arguments. + constructor(options, onData, onEnd) { + var writerOptions; + this.name = "?xml"; + this.type = NodeType.Document; + options || (options = {}); + writerOptions = {}; + if (!options.writer) { + options.writer = new XMLStringWriter(); + } else if (isPlainObject(options.writer)) { + writerOptions = options.writer; + options.writer = new XMLStringWriter(); + } + this.options = options; + this.writer = options.writer; + this.writerOptions = this.writer.filterOptions(writerOptions); + this.stringify = new XMLStringifier(options); + this.onDataCallback = onData || function() {}; + this.onEndCallback = onEnd || function() {}; + this.currentNode = null; + this.currentLevel = -1; + this.openTags = {}; + this.documentStarted = false; + this.documentCompleted = false; + this.root = null; + } + + // Creates a child element node from the given XMLNode + + // `node` the child node + createChildNode(node) { + var att, attName, attributes, child, i, len, ref, ref1; + switch (node.type) { + case NodeType.CData: + this.cdata(node.value); + break; + case NodeType.Comment: + this.comment(node.value); + break; + case NodeType.Element: + attributes = {}; + ref = node.attribs; + for (attName in ref) { + if (!hasProp.call(ref, attName)) continue; + att = ref[attName]; + attributes[attName] = att.value; + } + this.node(node.name, attributes); + break; + case NodeType.Dummy: + this.dummy(); + break; + case NodeType.Raw: + this.raw(node.value); + break; + case NodeType.Text: + this.text(node.value); + break; + case NodeType.ProcessingInstruction: + this.instruction(node.target, node.value); + break; + default: + throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name); + } + ref1 = node.children; + // write child nodes recursively + for (i = 0, len = ref1.length; i < len; i++) { + child = ref1[i]; + this.createChildNode(child); + if (child.type === NodeType.Element) { + this.up(); + } + } + return this; + } + + // Creates a dummy node + + dummy() { + // no-op, just return this + return this; + } + + // Creates a node + + // `name` name of the node + // `attributes` an object containing name/value pairs of attributes + // `text` element text + node(name, attributes, text) { + if (name == null) { + throw new Error("Missing node name."); + } + if (this.root && this.currentLevel === -1) { + throw new Error("Document can only have one root node. " + this.debugInfo(name)); + } + this.openCurrent(); + name = getValue(name); + if (attributes == null) { + attributes = {}; + } + attributes = getValue(attributes); + // swap argument order: text <-> attributes + if (!isObject(attributes)) { + [text, attributes] = [attributes, text]; + } + this.currentNode = new XMLElement(this, name, attributes); + this.currentNode.children = false; + this.currentLevel++; + this.openTags[this.currentLevel] = this.currentNode; + if (text != null) { + this.text(text); + } + return this; + } + + // Creates a child element node or an element type declaration when called + // inside the DTD + + // `name` name of the node + // `attributes` an object containing name/value pairs of attributes + // `text` element text + element(name, attributes, text) { + var child, i, len, oldValidationFlag, ref, root; + if (this.currentNode && this.currentNode.type === NodeType.DocType) { + this.dtdElement(...arguments); + } else { + if (Array.isArray(name) || isObject(name) || isFunction(name)) { + oldValidationFlag = this.options.noValidation; + this.options.noValidation = true; + root = new XMLDocument(this.options).element('TEMP_ROOT'); + root.element(name); + this.options.noValidation = oldValidationFlag; + ref = root.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + this.createChildNode(child); + if (child.type === NodeType.Element) { + this.up(); + } + } + } else { + this.node(name, attributes, text); + } + } + return this; + } + + // Adds or modifies an attribute + + // `name` attribute name + // `value` attribute value + attribute(name, value) { var attName, attValue; if (!this.currentNode || this.currentNode.children) { - throw new Error("att() can only be used immediately after an ele() call in callback mode"); + throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name)); + } + if (name != null) { + name = getValue(name); + } + if (isObject(name)) { // expand if object + for (attName in name) { + if (!hasProp.call(name, attName)) continue; + attValue = name[attName]; + this.attribute(attName, attValue); + } + } else { + if (isFunction(value)) { + value = value.apply(); + } + if (this.options.keepNullAttributes && (value == null)) { + this.currentNode.attribs[name] = new XMLAttribute(this, name, ""); + } else if (value != null) { + this.currentNode.attribs[name] = new XMLAttribute(this, name, value); + } + } + return this; + } + + // Creates a text node + + // `value` element text + text(value) { + var node; + this.openCurrent(); + node = new XMLText(this, value); + this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + } + + // Creates a CDATA node + + // `value` element text without CDATA delimiters + cdata(value) { + var node; + this.openCurrent(); + node = new XMLCData(this, value); + this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + } + + // Creates a comment node + + // `value` comment text + comment(value) { + var node; + this.openCurrent(); + node = new XMLComment(this, value); + this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + } + + // Adds unescaped raw text + + // `value` text + raw(value) { + var node; + this.openCurrent(); + node = new XMLRaw(this, value); + this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + } + + // Adds a processing instruction + + // `target` instruction target + // `value` instruction value + instruction(target, value) { + var i, insTarget, insValue, len, node; + this.openCurrent(); + if (target != null) { + target = getValue(target); + } + if (value != null) { + value = getValue(value); + } + if (Array.isArray(target)) { // expand if array + for (i = 0, len = target.length; i < len; i++) { + insTarget = target[i]; + this.instruction(insTarget); + } + } else if (isObject(target)) { // expand if object + for (insTarget in target) { + if (!hasProp.call(target, insTarget)) continue; + insValue = target[insTarget]; + this.instruction(insTarget, insValue); + } + } else { + if (isFunction(value)) { + value = value.apply(); + } + node = new XMLProcessingInstruction(this, target, value); + this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + } + return this; + } + + // Creates the xml declaration + + // `version` A version number string, e.g. 1.0 + // `encoding` Encoding declaration, e.g. UTF-8 + // `standalone` standalone document declaration: true or false + declaration(version, encoding, standalone) { + var node; + this.openCurrent(); + if (this.documentStarted) { + throw new Error("declaration() must be the first node."); + } + node = new XMLDeclaration(this, version, encoding, standalone); + this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + } + + // Creates the document type declaration + + // `root` the name of the root node + // `pubID` the public identifier of the external subset + // `sysID` the system identifier of the external subset + doctype(root, pubID, sysID) { + this.openCurrent(); + if (root == null) { + throw new Error("Missing root node name."); + } + if (this.root) { + throw new Error("dtd() must come before the root node."); + } + this.currentNode = new XMLDocType(this, pubID, sysID); + this.currentNode.rootNodeName = root; + this.currentNode.children = false; + this.currentLevel++; + this.openTags[this.currentLevel] = this.currentNode; + return this; + } + + // Creates an element type declaration + + // `name` element name + // `value` element content (defaults to #PCDATA) + dtdElement(name, value) { + var node; + this.openCurrent(); + node = new XMLDTDElement(this, name, value); + this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + } + + // Creates an attribute declaration + + // `elementName` the name of the element containing this attribute + // `attributeName` attribute name + // `attributeType` type of the attribute (defaults to CDATA) + // `defaultValueType` default value type (either #REQUIRED, #IMPLIED, #FIXED or + // #DEFAULT) (defaults to #IMPLIED) + // `defaultValue` default value of the attribute + // (only used for #FIXED or #DEFAULT) + attList(elementName, attributeName, attributeType, defaultValueType, defaultValue) { + var node; + this.openCurrent(); + node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); + this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + } + + // Creates a general entity declaration + + // `name` the name of the entity + // `value` internal entity value or an object with external entity details + // `value.pubID` public identifier + // `value.sysID` system identifier + // `value.nData` notation declaration + entity(name, value) { + var node; + this.openCurrent(); + node = new XMLDTDEntity(this, false, name, value); + this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + } + + // Creates a parameter entity declaration + + // `name` the name of the entity + // `value` internal entity value or an object with external entity details + // `value.pubID` public identifier + // `value.sysID` system identifier + pEntity(name, value) { + var node; + this.openCurrent(); + node = new XMLDTDEntity(this, true, name, value); + this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + } + + // Creates a NOTATION declaration + + // `name` the name of the notation + // `value` an object with external entity details + // `value.pubID` public identifier + // `value.sysID` system identifier + notation(name, value) { + var node; + this.openCurrent(); + node = new XMLDTDNotation(this, name, value); + this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + } + + // Gets the parent node + up() { + if (this.currentLevel < 0) { + throw new Error("The document node has no parent."); + } + if (this.currentNode) { + if (this.currentNode.children) { + this.closeNode(this.currentNode); + } else { + this.openNode(this.currentNode); + } + this.currentNode = null; + } else { + this.closeNode(this.openTags[this.currentLevel]); + } + delete this.openTags[this.currentLevel]; + this.currentLevel--; + return this; + } + + // Ends the document + end() { + while (this.currentLevel >= 0) { + this.up(); + } + return this.onEnd(); + } + + // Opens the current parent node + openCurrent() { + if (this.currentNode) { + this.currentNode.children = true; + return this.openNode(this.currentNode); + } + } + + // Writes the opening tag of the current node or the entire node if it has + // no child nodes + openNode(node) { + var att, chunk, name, ref; + if (!node.isOpen) { + if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) { + this.root = node; + } + chunk = ''; + if (node.type === NodeType.Element) { + this.writerOptions.state = WriterState.OpenTag; + chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<' + node.name; + ref = node.attribs; + for (name in ref) { + if (!hasProp.call(ref, name)) continue; + att = ref[name]; + chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel); + } + chunk += (node.children ? '>' : '/>') + this.writer.endline(node, this.writerOptions, this.currentLevel); + this.writerOptions.state = WriterState.InsideTag; // if node.type is NodeType.DocType + } else { + this.writerOptions.state = WriterState.OpenTag; + chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ''; + } + chunk += this.writer.endline(node, this.writerOptions, this.currentLevel); + } + this.onData(chunk, this.currentLevel); + return node.isOpen = true; + } + } + + // Writes the closing tag of the current node + closeNode(node) { + var chunk; + if (!node.isClosed) { + chunk = ''; + this.writerOptions.state = WriterState.CloseTag; + if (node.type === NodeType.Element) { + chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '' + this.writer.endline(node, this.writerOptions, this.currentLevel); // if node.type is NodeType.DocType + } else { + chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ']>' + this.writer.endline(node, this.writerOptions, this.currentLevel); + } + this.writerOptions.state = WriterState.None; + this.onData(chunk, this.currentLevel); + return node.isClosed = true; + } + } + + // Called when a new chunk of XML is output + + // `chunk` a string containing the XML chunk + // `level` current indentation level + onData(chunk, level) { + this.documentStarted = true; + return this.onDataCallback(chunk, level + 1); + } + + // Called when the XML document is completed + onEnd() { + this.documentCompleted = true; + return this.onEndCallback(); + } + + // Returns debug string + debugInfo(name) { + if (name == null) { + return ""; + } else { + return "node: <" + name + ">"; + } + } + + // Node aliases + ele() { + return this.element(...arguments); + } + + nod(name, attributes, text) { + return this.node(name, attributes, text); + } + + txt(value) { + return this.text(value); + } + + dat(value) { + return this.cdata(value); + } + + com(value) { + return this.comment(value); + } + + ins(target, value) { + return this.instruction(target, value); + } + + dec(version, encoding, standalone) { + return this.declaration(version, encoding, standalone); + } + + dtd(root, pubID, sysID) { + return this.doctype(root, pubID, sysID); + } + + e(name, attributes, text) { + return this.element(name, attributes, text); + } + + n(name, attributes, text) { + return this.node(name, attributes, text); + } + + t(value) { + return this.text(value); + } + + d(value) { + return this.cdata(value); + } + + c(value) { + return this.comment(value); + } + + r(value) { + return this.raw(value); + } + + i(target, value) { + return this.instruction(target, value); + } + + // Attribute aliases + att() { + if (this.currentNode && this.currentNode.type === NodeType.DocType) { + return this.attList(...arguments); + } else { + return this.attribute(...arguments); + } + } + + a() { + if (this.currentNode && this.currentNode.type === NodeType.DocType) { + return this.attList(...arguments); + } else { + return this.attribute(...arguments); + } + } + + // DTD aliases + // att() and ele() are defined above + ent(name, value) { + return this.entity(name, value); + } + + pent(name, value) { + return this.pEntity(name, value); + } + + not(name, value) { + return this.notation(name, value); + } + + }; + +}).call(this); + + +/***/ }), + +/***/ 3590: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 2.4.1 +(function() { + var NodeType, XMLDummy, XMLNode; + + XMLNode = __nccwpck_require__(7608); + + NodeType = __nccwpck_require__(9267); + + // Represents a raw node + module.exports = XMLDummy = class XMLDummy extends XMLNode { + // Initializes a new instance of `XMLDummy` + + // `XMLDummy` is a special node representing a node with + // a null value. Dummy nodes are created while recursively + // building the XML tree. Simply skipping null values doesn't + // work because that would break the recursive chain. + constructor(parent) { + super(parent); + this.type = NodeType.Dummy; + } + + // Creates and returns a deep clone of `this` + clone() { + return Object.create(this); + } + + // Converts the XML fragment to string + + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return ''; + } + + }; + +}).call(this); + + +/***/ }), + +/***/ 9437: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 2.4.1 +(function() { + var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, XMLNode, getValue, isFunction, isObject, + hasProp = {}.hasOwnProperty; + + ({isObject, isFunction, getValue} = __nccwpck_require__(8229)); + + XMLNode = __nccwpck_require__(7608); + + NodeType = __nccwpck_require__(9267); + + XMLAttribute = __nccwpck_require__(8376); + + XMLNamedNodeMap = __nccwpck_require__(4361); + + // Represents an element of the XML document + module.exports = XMLElement = (function() { + class XMLElement extends XMLNode { + // Initializes a new instance of `XMLElement` + + // `parent` the parent node + // `name` element name + // `attributes` an object containing name/value pairs of attributes + constructor(parent, name, attributes) { + var child, j, len, ref; + super(parent); + if (name == null) { + throw new Error("Missing element name. " + this.debugInfo()); + } + this.name = this.stringify.name(name); + this.type = NodeType.Element; + this.attribs = {}; + this.schemaTypeInfo = null; + if (attributes != null) { + this.attribute(attributes); + } + // set properties if this is the root node + if (parent.type === NodeType.Document) { + this.isRoot = true; + this.documentObject = parent; + parent.rootObject = this; + // set dtd name + if (parent.children) { + ref = parent.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + if (child.type === NodeType.DocType) { + child.name = this.name; + break; + } + } + } + } + } + + // Creates and returns a deep clone of `this` + + clone() { + var att, attName, clonedSelf, ref; + clonedSelf = Object.create(this); + // remove document element + if (clonedSelf.isRoot) { + clonedSelf.documentObject = null; + } + // clone attributes + clonedSelf.attribs = {}; + ref = this.attribs; + for (attName in ref) { + if (!hasProp.call(ref, attName)) continue; + att = ref[attName]; + clonedSelf.attribs[attName] = att.clone(); + } + // clone child nodes + clonedSelf.children = []; + this.children.forEach(function(child) { + var clonedChild; + clonedChild = child.clone(); + clonedChild.parent = clonedSelf; + return clonedSelf.children.push(clonedChild); + }); + return clonedSelf; + } + + // Adds or modifies an attribute + + // `name` attribute name + // `value` attribute value + attribute(name, value) { + var attName, attValue; + if (name != null) { + name = getValue(name); + } + if (isObject(name)) { // expand if object + for (attName in name) { + if (!hasProp.call(name, attName)) continue; + attValue = name[attName]; + this.attribute(attName, attValue); + } + } else { + if (isFunction(value)) { + value = value.apply(); + } + if (this.options.keepNullAttributes && (value == null)) { + this.attribs[name] = new XMLAttribute(this, name, ""); + } else if (value != null) { + this.attribs[name] = new XMLAttribute(this, name, value); + } + } + return this; + } + + // Removes an attribute + + // `name` attribute name + removeAttribute(name) { + var attName, j, len; + // Also defined in DOM level 1 + // removeAttribute(name) removes an attribute by name. + if (name == null) { + throw new Error("Missing attribute name. " + this.debugInfo()); + } + name = getValue(name); + if (Array.isArray(name)) { // expand if array + for (j = 0, len = name.length; j < len; j++) { + attName = name[j]; + delete this.attribs[attName]; + } + } else { + delete this.attribs[name]; + } + return this; + } + + // Converts the XML fragment to string + + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + // `options.allowEmpty` do not self close empty element tags + toString(options) { + return this.options.writer.element(this, this.options.writer.filterOptions(options)); + } + + // Aliases + att(name, value) { + return this.attribute(name, value); + } + + a(name, value) { + return this.attribute(name, value); + } + + // DOM Level 1 + getAttribute(name) { + if (this.attribs.hasOwnProperty(name)) { + return this.attribs[name].value; + } else { + return null; + } + } + + setAttribute(name, value) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + getAttributeNode(name) { + if (this.attribs.hasOwnProperty(name)) { + return this.attribs[name]; + } else { + return null; + } + } + + setAttributeNode(newAttr) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + removeAttributeNode(oldAttr) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + getElementsByTagName(name) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + // DOM Level 2 + getAttributeNS(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + setAttributeNS(namespaceURI, qualifiedName, value) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + removeAttributeNS(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + getAttributeNodeNS(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + setAttributeNodeNS(newAttr) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + getElementsByTagNameNS(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + hasAttribute(name) { + return this.attribs.hasOwnProperty(name); + } + + hasAttributeNS(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + // DOM Level 3 + setIdAttribute(name, isId) { + if (this.attribs.hasOwnProperty(name)) { + return this.attribs[name].isId; + } else { + return isId; + } } - if (name != null) { - name = name.valueOf(); + + setIdAttributeNS(namespaceURI, localName, isId) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); } - if (isObject(name)) { - for (attName in name) { - if (!hasProp.call(name, attName)) continue; - attValue = name[attName]; - this.attribute(attName, attValue); + + setIdAttributeNode(idAttr, isId) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + // DOM Level 4 + getElementsByTagName(tagname) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + getElementsByTagNameNS(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + getElementsByClassName(classNames) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + + isEqualNode(node) { + var i, j, ref; + if (!super.isEqualNode(node)) { + return false; } - } else { - if (isFunction(value)) { - value = value.apply(); + if (node.namespaceURI !== this.namespaceURI) { + return false; } - if (!this.options.skipNullAttributes || (value != null)) { - this.currentNode.attributes[name] = new XMLAttribute(this, name, value); + if (node.prefix !== this.prefix) { + return false; + } + if (node.localName !== this.localName) { + return false; + } + if (node.attribs.length !== this.attribs.length) { + return false; + } + for (i = j = 0, ref = this.attribs.length - 1; (0 <= ref ? j <= ref : j >= ref); i = 0 <= ref ? ++j : --j) { + if (!this.attribs[i].isEqualNode(node.attribs[i])) { + return false; + } } + return true; } - return this; - }; - XMLDocumentCB.prototype.text = function(value) { - var node; - this.openCurrent(); - node = new XMLText(this, value); - this.onData(this.writer.text(node, this.currentLevel + 1)); - return this; }; - XMLDocumentCB.prototype.cdata = function(value) { - var node; - this.openCurrent(); - node = new XMLCData(this, value); - this.onData(this.writer.cdata(node, this.currentLevel + 1)); - return this; - }; + // DOM level 1 + Object.defineProperty(XMLElement.prototype, 'tagName', { + get: function() { + return this.name; + } + }); - XMLDocumentCB.prototype.comment = function(value) { - var node; - this.openCurrent(); - node = new XMLComment(this, value); - this.onData(this.writer.comment(node, this.currentLevel + 1)); - return this; - }; + // DOM level 4 + Object.defineProperty(XMLElement.prototype, 'namespaceURI', { + get: function() { + return ''; + } + }); + + Object.defineProperty(XMLElement.prototype, 'prefix', { + get: function() { + return ''; + } + }); + + Object.defineProperty(XMLElement.prototype, 'localName', { + get: function() { + return this.name; + } + }); + + Object.defineProperty(XMLElement.prototype, 'id', { + get: function() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + }); + + Object.defineProperty(XMLElement.prototype, 'className', { + get: function() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + }); + + Object.defineProperty(XMLElement.prototype, 'classList', { + get: function() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + }); + + Object.defineProperty(XMLElement.prototype, 'attributes', { + get: function() { + if (!this.attributeMap || !this.attributeMap.nodes) { + this.attributeMap = new XMLNamedNodeMap(this.attribs); + } + return this.attributeMap; + } + }); + + return XMLElement; + + }).call(this); + +}).call(this); + + +/***/ }), + +/***/ 4361: +/***/ (function(module) { + +// Generated by CoffeeScript 2.4.1 +(function() { + // Represents a map of nodes accessed by a string key + var XMLNamedNodeMap; + + module.exports = XMLNamedNodeMap = (function() { + class XMLNamedNodeMap { + // Initializes a new instance of `XMLNamedNodeMap` + // This is just a wrapper around an ordinary + // JS object. + + // `nodes` the object containing nodes. + constructor(nodes) { + this.nodes = nodes; + } + + // Creates and returns a deep clone of `this` + + clone() { + // this class should not be cloned since it wraps + // around a given object. The calling function should check + // whether the wrapped object is null and supply a new object + // (from the clone). + return this.nodes = null; + } + + // DOM Level 1 + getNamedItem(name) { + return this.nodes[name]; + } + + setNamedItem(node) { + var oldNode; + oldNode = this.nodes[node.nodeName]; + this.nodes[node.nodeName] = node; + return oldNode || null; + } + + removeNamedItem(name) { + var oldNode; + oldNode = this.nodes[name]; + delete this.nodes[name]; + return oldNode || null; + } + + item(index) { + return this.nodes[Object.keys(this.nodes)[index]] || null; + } + + // DOM level 2 functions to be implemented later + getNamedItemNS(namespaceURI, localName) { + throw new Error("This DOM method is not implemented."); + } + + setNamedItemNS(node) { + throw new Error("This DOM method is not implemented."); + } + + removeNamedItemNS(namespaceURI, localName) { + throw new Error("This DOM method is not implemented."); + } - XMLDocumentCB.prototype.raw = function(value) { - var node; - this.openCurrent(); - node = new XMLRaw(this, value); - this.onData(this.writer.raw(node, this.currentLevel + 1)); - return this; }; - XMLDocumentCB.prototype.instruction = function(target, value) { - var i, insTarget, insValue, len, node; - this.openCurrent(); - if (target != null) { - target = target.valueOf(); + + // DOM level 1 + Object.defineProperty(XMLNamedNodeMap.prototype, 'length', { + get: function() { + return Object.keys(this.nodes).length || 0; } - if (value != null) { - value = value.valueOf(); + }); + + return XMLNamedNodeMap; + + }).call(this); + +}).call(this); + + +/***/ }), + +/***/ 7608: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 2.4.1 +(function() { + var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, + hasProp = {}.hasOwnProperty, + splice = [].splice; + + ({isObject, isFunction, isEmpty, getValue} = __nccwpck_require__(8229)); + + XMLElement = null; + + XMLCData = null; + + XMLComment = null; + + XMLDeclaration = null; + + XMLDocType = null; + + XMLRaw = null; + + XMLText = null; + + XMLProcessingInstruction = null; + + XMLDummy = null; + + NodeType = null; + + XMLNodeList = null; + + XMLNamedNodeMap = null; + + DocumentPosition = null; + + // Represents a generic XMl element + module.exports = XMLNode = (function() { + class XMLNode { + // Initializes a new instance of `XMLNode` + + // `parent` the parent node + constructor(parent1) { + this.parent = parent1; + if (this.parent) { + this.options = this.parent.options; + this.stringify = this.parent.stringify; + } + this.value = null; + this.children = []; + this.baseURI = null; + // first execution, load dependencies that are otherwise + // circular (so we can't load them at the top) + if (!XMLElement) { + XMLElement = __nccwpck_require__(9437); + XMLCData = __nccwpck_require__(333); + XMLComment = __nccwpck_require__(4407); + XMLDeclaration = __nccwpck_require__(6364); + XMLDocType = __nccwpck_require__(1801); + XMLRaw = __nccwpck_require__(6329); + XMLText = __nccwpck_require__(1318); + XMLProcessingInstruction = __nccwpck_require__(6939); + XMLDummy = __nccwpck_require__(3590); + NodeType = __nccwpck_require__(9267); + XMLNodeList = __nccwpck_require__(6768); + XMLNamedNodeMap = __nccwpck_require__(4361); + DocumentPosition = __nccwpck_require__(2839); + } + } + + + // Sets the parent node of this node and its children recursively + + // `parent` the parent node + setParent(parent) { + var child, j, len, ref1, results; + this.parent = parent; + if (parent) { + this.options = parent.options; + this.stringify = parent.stringify; + } + ref1 = this.children; + results = []; + for (j = 0, len = ref1.length; j < len; j++) { + child = ref1[j]; + results.push(child.setParent(this)); + } + return results; + } + + // Creates a child element node + + // `name` node name or an object describing the XML tree + // `attributes` an object containing name/value pairs of attributes + // `text` element text + element(name, attributes, text) { + var childNode, item, j, k, key, lastChild, len, len1, val; + lastChild = null; + if (attributes === null && (text == null)) { + [attributes, text] = [{}, null]; + } + if (attributes == null) { + attributes = {}; + } + attributes = getValue(attributes); + // swap argument order: text <-> attributes + if (!isObject(attributes)) { + [text, attributes] = [attributes, text]; + } + if (name != null) { + name = getValue(name); + } + // expand if array + if (Array.isArray(name)) { + for (j = 0, len = name.length; j < len; j++) { + item = name[j]; + lastChild = this.element(item); + } + // evaluate if function + } else if (isFunction(name)) { + lastChild = this.element(name.apply()); + // expand if object + } else if (isObject(name)) { + for (key in name) { + if (!hasProp.call(name, key)) continue; + val = name[key]; + if (isFunction(val)) { + // evaluate if function + val = val.apply(); + } + // assign attributes + if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) { + lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val); + // skip empty arrays + } else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) { + lastChild = this.dummy(); + // empty objects produce one node + } else if (isObject(val) && isEmpty(val)) { + lastChild = this.element(key); + // skip null and undefined nodes + } else if (!this.options.keepNullNodes && (val == null)) { + lastChild = this.dummy(); + + // expand list by creating child nodes + } else if (!this.options.separateArrayItems && Array.isArray(val)) { + for (k = 0, len1 = val.length; k < len1; k++) { + item = val[k]; + childNode = {}; + childNode[key] = item; + lastChild = this.element(childNode); + } + + // expand child nodes under parent + } else if (isObject(val)) { + // if the key is #text expand child nodes under this node to support mixed content + if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) { + lastChild = this.element(val); + } else { + lastChild = this.element(key); + lastChild.element(val); + } + } else { + + // text node + lastChild = this.element(key, val); + } + } + // skip null nodes + } else if (!this.options.keepNullNodes && text === null) { + lastChild = this.dummy(); + } else { + // text node + if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) { + lastChild = this.text(text); + // cdata node + } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) { + lastChild = this.cdata(text); + // comment node + } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) { + lastChild = this.comment(text); + // raw text node + } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) { + lastChild = this.raw(text); + // processing instruction + } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) { + lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text); + } else { + // element node + lastChild = this.node(name, attributes, text); + } + } + if (lastChild == null) { + throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo()); + } + return lastChild; + } + + // Creates a child element node before the current node + + // `name` node name or an object describing the XML tree + // `attributes` an object containing name/value pairs of attributes + // `text` element text + insertBefore(name, attributes, text) { + var child, i, newChild, refChild, removed; + // DOM level 1 + // insertBefore(newChild, refChild) inserts the child node newChild before refChild + if (name != null ? name.type : void 0) { + newChild = name; + refChild = attributes; + newChild.setParent(this); + if (refChild) { + // temporarily remove children starting *with* refChild + i = children.indexOf(refChild); + removed = children.splice(i); + + // add the new child + children.push(newChild); + + // add back removed children after new child + Array.prototype.push.apply(children, removed); + } else { + children.push(newChild); + } + return newChild; + } else { + if (this.isRoot) { + throw new Error("Cannot insert elements at root level. " + this.debugInfo(name)); + } + + // temporarily remove children starting *with* this + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i); + + // add the new child + child = this.parent.element(name, attributes, text); + + // add back removed children after new child + Array.prototype.push.apply(this.parent.children, removed); + return child; + } + } + + // Creates a child element node after the current node + + // `name` node name or an object describing the XML tree + // `attributes` an object containing name/value pairs of attributes + // `text` element text + insertAfter(name, attributes, text) { + var child, i, removed; + if (this.isRoot) { + throw new Error("Cannot insert elements at root level. " + this.debugInfo(name)); + } + + // temporarily remove children starting *after* this + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i + 1); + + // add the new child + child = this.parent.element(name, attributes, text); + + // add back removed children after new child + Array.prototype.push.apply(this.parent.children, removed); + return child; + } + + // Deletes a child element node + + remove() { + var i, ref1; + if (this.isRoot) { + throw new Error("Cannot remove the root element. " + this.debugInfo()); + } + i = this.parent.children.indexOf(this); + splice.apply(this.parent.children, [i, i - i + 1].concat(ref1 = [])), ref1; + return this.parent; + } + + // Creates a node + + // `name` name of the node + // `attributes` an object containing name/value pairs of attributes + // `text` element text + node(name, attributes, text) { + var child; + if (name != null) { + name = getValue(name); + } + attributes || (attributes = {}); + attributes = getValue(attributes); + // swap argument order: text <-> attributes + if (!isObject(attributes)) { + [text, attributes] = [attributes, text]; + } + child = new XMLElement(this, name, attributes); + if (text != null) { + child.text(text); + } + this.children.push(child); + return child; + } + + // Creates a text node + + // `value` element text + text(value) { + var child; + if (isObject(value)) { + this.element(value); + } + child = new XMLText(this, value); + this.children.push(child); + return this; + } + + // Creates a CDATA node + + // `value` element text without CDATA delimiters + cdata(value) { + var child; + child = new XMLCData(this, value); + this.children.push(child); + return this; + } + + // Creates a comment node + + // `value` comment text + comment(value) { + var child; + child = new XMLComment(this, value); + this.children.push(child); + return this; + } + + // Creates a comment node before the current node + + // `value` comment text + commentBefore(value) { + var child, i, removed; + // temporarily remove children starting *with* this + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i); + // add the new child + child = this.parent.comment(value); + // add back removed children after new child + Array.prototype.push.apply(this.parent.children, removed); + return this; + } + + // Creates a comment node after the current node + + // `value` comment text + commentAfter(value) { + var child, i, removed; + // temporarily remove children starting *after* this + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i + 1); + // add the new child + child = this.parent.comment(value); + // add back removed children after new child + Array.prototype.push.apply(this.parent.children, removed); + return this; + } + + // Adds unescaped raw text + + // `value` text + raw(value) { + var child; + child = new XMLRaw(this, value); + this.children.push(child); + return this; + } + + // Adds a dummy node + dummy() { + var child; + child = new XMLDummy(this); + // Normally when a new node is created it is added to the child node collection. + // However, dummy nodes are never added to the XML tree. They are created while + // converting JS objects to XML nodes in order not to break the recursive function + // chain. They can be thought of as invisible nodes. They can be traversed through + // by using prev(), next(), up(), etc. functions but they do not exists in the tree. + + // @children.push child + return child; + } + + // Adds a processing instruction + + // `target` instruction target + // `value` instruction value + instruction(target, value) { + var insTarget, insValue, instruction, j, len; + if (target != null) { + target = getValue(target); + } + if (value != null) { + value = getValue(value); + } + if (Array.isArray(target)) { // expand if array + for (j = 0, len = target.length; j < len; j++) { + insTarget = target[j]; + this.instruction(insTarget); + } + } else if (isObject(target)) { // expand if object + for (insTarget in target) { + if (!hasProp.call(target, insTarget)) continue; + insValue = target[insTarget]; + this.instruction(insTarget, insValue); + } + } else { + if (isFunction(value)) { + value = value.apply(); + } + instruction = new XMLProcessingInstruction(this, target, value); + this.children.push(instruction); + } + return this; + } + + // Creates a processing instruction node before the current node + + // `target` instruction target + // `value` instruction value + instructionBefore(target, value) { + var child, i, removed; + // temporarily remove children starting *with* this + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i); + // add the new child + child = this.parent.instruction(target, value); + // add back removed children after new child + Array.prototype.push.apply(this.parent.children, removed); + return this; + } + + // Creates a processing instruction node after the current node + + // `target` instruction target + // `value` instruction value + instructionAfter(target, value) { + var child, i, removed; + // temporarily remove children starting *after* this + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i + 1); + // add the new child + child = this.parent.instruction(target, value); + // add back removed children after new child + Array.prototype.push.apply(this.parent.children, removed); + return this; + } + + // Creates the xml declaration + + // `version` A version number string, e.g. 1.0 + // `encoding` Encoding declaration, e.g. UTF-8 + // `standalone` standalone document declaration: true or false + declaration(version, encoding, standalone) { + var doc, xmldec; + doc = this.document(); + xmldec = new XMLDeclaration(doc, version, encoding, standalone); + // Replace XML declaration if exists, otherwise insert at top + if (doc.children.length === 0) { + doc.children.unshift(xmldec); + } else if (doc.children[0].type === NodeType.Declaration) { + doc.children[0] = xmldec; + } else { + doc.children.unshift(xmldec); + } + return doc.root() || doc; + } + + // Creates the document type declaration + + // `pubID` the public identifier of the external subset + // `sysID` the system identifier of the external subset + dtd(pubID, sysID) { + var child, doc, doctype, i, j, k, len, len1, ref1, ref2; + doc = this.document(); + doctype = new XMLDocType(doc, pubID, sysID); + ref1 = doc.children; + // Replace DTD if exists + for (i = j = 0, len = ref1.length; j < len; i = ++j) { + child = ref1[i]; + if (child.type === NodeType.DocType) { + doc.children[i] = doctype; + return doctype; + } + } + ref2 = doc.children; + // insert before root node if the root node exists + for (i = k = 0, len1 = ref2.length; k < len1; i = ++k) { + child = ref2[i]; + if (child.isRoot) { + doc.children.splice(i, 0, doctype); + return doctype; + } + } + // otherwise append to end + doc.children.push(doctype); + return doctype; + } + + // Gets the parent node + up() { + if (this.isRoot) { + throw new Error("The root node has no parent. Use doc() if you need to get the document object."); + } + return this.parent; + } + + // Gets the root node + root() { + var node; + node = this; + while (node) { + if (node.type === NodeType.Document) { + return node.rootObject; + } else if (node.isRoot) { + return node; + } else { + node = node.parent; + } + } + } + + // Gets the node representing the XML document + document() { + var node; + node = this; + while (node) { + if (node.type === NodeType.Document) { + return node; + } else { + node = node.parent; + } + } + } + + // Ends the document and converts string + end(options) { + return this.document().end(options); + } + + // Gets the previous node + prev() { + var i; + i = this.parent.children.indexOf(this); + if (i < 1) { + throw new Error("Already at the first node. " + this.debugInfo()); + } + return this.parent.children[i - 1]; } - if (Array.isArray(target)) { - for (i = 0, len = target.length; i < len; i++) { - insTarget = target[i]; - this.instruction(insTarget); + + // Gets the next node + next() { + var i; + i = this.parent.children.indexOf(this); + if (i === -1 || i === this.parent.children.length - 1) { + throw new Error("Already at the last node. " + this.debugInfo()); } - } else if (isObject(target)) { - for (insTarget in target) { - if (!hasProp.call(target, insTarget)) continue; - insValue = target[insTarget]; - this.instruction(insTarget, insValue); + return this.parent.children[i + 1]; + } + + // Imports cloned root from another XML document + + // `doc` the XML document to insert nodes from + importDocument(doc) { + var child, clonedRoot, j, len, ref1; + clonedRoot = doc.root().clone(); + clonedRoot.parent = this; + clonedRoot.isRoot = false; + this.children.push(clonedRoot); + // set properties if imported element becomes the root node + if (this.type === NodeType.Document) { + clonedRoot.isRoot = true; + clonedRoot.documentObject = this; + this.rootObject = clonedRoot; + // set dtd name + if (this.children) { + ref1 = this.children; + for (j = 0, len = ref1.length; j < len; j++) { + child = ref1[j]; + if (child.type === NodeType.DocType) { + child.name = clonedRoot.name; + break; + } + } + } } - } else { - if (isFunction(value)) { - value = value.apply(); + return this; + } + + + // Returns debug string for this node + debugInfo(name) { + var ref1, ref2; + name = name || this.name; + if ((name == null) && !((ref1 = this.parent) != null ? ref1.name : void 0)) { + return ""; + } else if (name == null) { + return "parent: <" + this.parent.name + ">"; + } else if (!((ref2 = this.parent) != null ? ref2.name : void 0)) { + return "node: <" + name + ">"; + } else { + return "node: <" + name + ">, parent: <" + this.parent.name + ">"; } - node = new XMLProcessingInstruction(this, target, value); - this.onData(this.writer.processingInstruction(node, this.currentLevel + 1)); } - return this; - }; - XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) { - var node; - this.openCurrent(); - if (this.documentStarted) { - throw new Error("declaration() must be the first node"); + // Aliases + ele(name, attributes, text) { + return this.element(name, attributes, text); } - node = new XMLDeclaration(this, version, encoding, standalone); - this.onData(this.writer.declaration(node, this.currentLevel + 1)); - return this; - }; - XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) { - this.openCurrent(); - if (root == null) { - throw new Error("Missing root node name"); + nod(name, attributes, text) { + return this.node(name, attributes, text); } - if (this.root) { - throw new Error("dtd() must come before the root node"); + + txt(value) { + return this.text(value); } - this.currentNode = new XMLDocType(this, pubID, sysID); - this.currentNode.rootNodeName = root; - this.currentNode.children = false; - this.currentLevel++; - this.openTags[this.currentLevel] = this.currentNode; - return this; - }; - XMLDocumentCB.prototype.dtdElement = function(name, value) { - var node; - this.openCurrent(); - node = new XMLDTDElement(this, name, value); - this.onData(this.writer.dtdElement(node, this.currentLevel + 1)); - return this; - }; + dat(value) { + return this.cdata(value); + } - XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { - var node; - this.openCurrent(); - node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); - this.onData(this.writer.dtdAttList(node, this.currentLevel + 1)); - return this; - }; + com(value) { + return this.comment(value); + } - XMLDocumentCB.prototype.entity = function(name, value) { - var node; - this.openCurrent(); - node = new XMLDTDEntity(this, false, name, value); - this.onData(this.writer.dtdEntity(node, this.currentLevel + 1)); - return this; - }; + ins(target, value) { + return this.instruction(target, value); + } - XMLDocumentCB.prototype.pEntity = function(name, value) { - var node; - this.openCurrent(); - node = new XMLDTDEntity(this, true, name, value); - this.onData(this.writer.dtdEntity(node, this.currentLevel + 1)); - return this; - }; + doc() { + return this.document(); + } - XMLDocumentCB.prototype.notation = function(name, value) { - var node; - this.openCurrent(); - node = new XMLDTDNotation(this, name, value); - this.onData(this.writer.dtdNotation(node, this.currentLevel + 1)); - return this; - }; + dec(version, encoding, standalone) { + return this.declaration(version, encoding, standalone); + } - XMLDocumentCB.prototype.up = function() { - if (this.currentLevel < 0) { - throw new Error("The document node has no parent"); + e(name, attributes, text) { + return this.element(name, attributes, text); } - if (this.currentNode) { - if (this.currentNode.children) { - this.closeNode(this.currentNode); - } else { - this.openNode(this.currentNode); - } - this.currentNode = null; - } else { - this.closeNode(this.openTags[this.currentLevel]); + + n(name, attributes, text) { + return this.node(name, attributes, text); } - delete this.openTags[this.currentLevel]; - this.currentLevel--; - return this; - }; - XMLDocumentCB.prototype.end = function() { - while (this.currentLevel >= 0) { - this.up(); + t(value) { + return this.text(value); } - return this.onEnd(); - }; - XMLDocumentCB.prototype.openCurrent = function() { - if (this.currentNode) { - this.currentNode.children = true; - return this.openNode(this.currentNode); + d(value) { + return this.cdata(value); } - }; - XMLDocumentCB.prototype.openNode = function(node) { - if (!node.isOpen) { - if (!this.root && this.currentLevel === 0 && node instanceof XMLElement) { - this.root = node; - } - this.onData(this.writer.openNode(node, this.currentLevel)); - return node.isOpen = true; + c(value) { + return this.comment(value); } - }; - XMLDocumentCB.prototype.closeNode = function(node) { - if (!node.isClosed) { - this.onData(this.writer.closeNode(node, this.currentLevel)); - return node.isClosed = true; + r(value) { + return this.raw(value); } - }; - XMLDocumentCB.prototype.onData = function(chunk) { - this.documentStarted = true; - return this.onDataCallback(chunk); - }; + i(target, value) { + return this.instruction(target, value); + } - XMLDocumentCB.prototype.onEnd = function() { - this.documentCompleted = true; - return this.onEndCallback(); - }; + u() { + return this.up(); + } - XMLDocumentCB.prototype.ele = function() { - return this.element.apply(this, arguments); - }; + // can be deprecated in a future release + importXMLBuilder(doc) { + return this.importDocument(doc); + } - XMLDocumentCB.prototype.nod = function(name, attributes, text) { - return this.node(name, attributes, text); - }; + // Adds or modifies an attribute. - XMLDocumentCB.prototype.txt = function(value) { - return this.text(value); - }; + // `name` attribute name + // `value` attribute value + attribute(name, value) { + throw new Error("attribute() applies to element nodes only."); + } - XMLDocumentCB.prototype.dat = function(value) { - return this.cdata(value); - }; + att(name, value) { + return this.attribute(name, value); + } - XMLDocumentCB.prototype.com = function(value) { - return this.comment(value); - }; + a(name, value) { + return this.attribute(name, value); + } - XMLDocumentCB.prototype.ins = function(target, value) { - return this.instruction(target, value); - }; + // Removes an attribute - XMLDocumentCB.prototype.dec = function(version, encoding, standalone) { - return this.declaration(version, encoding, standalone); - }; + // `name` attribute name + removeAttribute(name) { + throw new Error("attribute() applies to element nodes only."); + } - XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) { - return this.doctype(root, pubID, sysID); - }; + // DOM level 1 functions to be implemented later + replaceChild(newChild, oldChild) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } - XMLDocumentCB.prototype.e = function(name, attributes, text) { - return this.element(name, attributes, text); - }; + removeChild(oldChild) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } - XMLDocumentCB.prototype.n = function(name, attributes, text) { - return this.node(name, attributes, text); - }; + appendChild(newChild) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } - XMLDocumentCB.prototype.t = function(value) { - return this.text(value); - }; + hasChildNodes() { + return this.children.length !== 0; + } - XMLDocumentCB.prototype.d = function(value) { - return this.cdata(value); - }; + cloneNode(deep) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } - XMLDocumentCB.prototype.c = function(value) { - return this.comment(value); - }; + normalize() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } - XMLDocumentCB.prototype.r = function(value) { - return this.raw(value); - }; + // DOM level 2 + isSupported(feature, version) { + return true; + } - XMLDocumentCB.prototype.i = function(target, value) { - return this.instruction(target, value); - }; + hasAttributes() { + return this.attribs.length !== 0; + } - XMLDocumentCB.prototype.att = function() { - if (this.currentNode && this.currentNode instanceof XMLDocType) { - return this.attList.apply(this, arguments); - } else { - return this.attribute.apply(this, arguments); + // DOM level 3 functions to be implemented later + compareDocumentPosition(other) { + var ref, res; + ref = this; + if (ref === other) { + return 0; + } else if (this.document() !== other.document()) { + res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific; + if (Math.random() < 0.5) { + res |= DocumentPosition.Preceding; + } else { + res |= DocumentPosition.Following; + } + return res; + } else if (ref.isAncestor(other)) { + return DocumentPosition.Contains | DocumentPosition.Preceding; + } else if (ref.isDescendant(other)) { + return DocumentPosition.Contains | DocumentPosition.Following; + } else if (ref.isPreceding(other)) { + return DocumentPosition.Preceding; + } else { + return DocumentPosition.Following; + } } - }; - XMLDocumentCB.prototype.a = function() { - if (this.currentNode && this.currentNode instanceof XMLDocType) { - return this.attList.apply(this, arguments); - } else { - return this.attribute.apply(this, arguments); + isSameNode(other) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); } - }; - XMLDocumentCB.prototype.ent = function(name, value) { - return this.entity(name, value); - }; + lookupPrefix(namespaceURI) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } - XMLDocumentCB.prototype.pent = function(name, value) { - return this.pEntity(name, value); - }; + isDefaultNamespace(namespaceURI) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } - XMLDocumentCB.prototype.not = function(name, value) { - return this.notation(name, value); - }; + lookupNamespaceURI(prefix) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } - return XMLDocumentCB; + isEqualNode(node) { + var i, j, ref1; + if (node.nodeType !== this.nodeType) { + return false; + } + if (node.children.length !== this.children.length) { + return false; + } + for (i = j = 0, ref1 = this.children.length - 1; (0 <= ref1 ? j <= ref1 : j >= ref1); i = 0 <= ref1 ? ++j : --j) { + if (!this.children[i].isEqualNode(node.children[i])) { + return false; + } + } + return true; + } - })(); + getFeature(feature, version) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } -}).call(this); + setUserData(key, data, handler) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + getUserData(key) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } -/***/ }), + // Returns true if other is an inclusive descendant of node, + // and false otherwise. + contains(other) { + if (!other) { + return false; + } + return other === this || this.isDescendant(other); + } -/***/ 9437: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + // An object A is called a descendant of an object B, if either A is + // a child of B or A is a child of an object C that is a descendant of B. + isDescendant(node) { + var child, isDescendantChild, j, len, ref1; + ref1 = this.children; + for (j = 0, len = ref1.length; j < len; j++) { + child = ref1[j]; + if (node === child) { + return true; + } + isDescendantChild = child.isDescendant(node); + if (isDescendantChild) { + return true; + } + } + return false; + } -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLAttribute, XMLElement, XMLNode, isFunction, isObject, ref, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + // An object A is called an ancestor of an object B if and only if + // B is a descendant of A. + isAncestor(node) { + return node.isDescendant(this); + } - ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction; + // An object A is preceding an object B if A and B are in the + // same tree and A comes before B in tree order. + isPreceding(node) { + var nodePos, thisPos; + nodePos = this.treePosition(node); + thisPos = this.treePosition(this); + if (nodePos === -1 || thisPos === -1) { + return false; + } else { + return nodePos < thisPos; + } + } - XMLNode = __nccwpck_require__(7608); + // An object A is folllowing an object B if A and B are in the + // same tree and A comes after B in tree order. + isFollowing(node) { + var nodePos, thisPos; + nodePos = this.treePosition(node); + thisPos = this.treePosition(this); + if (nodePos === -1 || thisPos === -1) { + return false; + } else { + return nodePos > thisPos; + } + } - XMLAttribute = __nccwpck_require__(8376); + // Returns the preorder position of the given node in the tree, or -1 + // if the node is not in the tree. + treePosition(node) { + var found, pos; + pos = 0; + found = false; + this.foreachTreeNode(this.document(), function(childNode) { + pos++; + if (!found && childNode === node) { + return found = true; + } + }); + if (found) { + return pos; + } else { + return -1; + } + } + + + // Depth-first preorder traversal through the XML tree + foreachTreeNode(node, func) { + var child, j, len, ref1, res; + node || (node = this.document()); + ref1 = node.children; + for (j = 0, len = ref1.length; j < len; j++) { + child = ref1[j]; + if (res = func(child)) { + return res; + } else { + res = this.foreachTreeNode(child, func); + if (res) { + return res; + } + } + } + } - module.exports = XMLElement = (function(superClass) { - extend(XMLElement, superClass); + }; - function XMLElement(parent, name, attributes) { - XMLElement.__super__.constructor.call(this, parent); - if (name == null) { - throw new Error("Missing element name"); + // DOM level 1 + Object.defineProperty(XMLNode.prototype, 'nodeName', { + get: function() { + return this.name; } - this.name = this.stringify.eleName(name); - this.attributes = {}; - if (attributes != null) { - this.attribute(attributes); + }); + + Object.defineProperty(XMLNode.prototype, 'nodeType', { + get: function() { + return this.type; } - if (parent.isDocument) { - this.isRoot = true; - this.documentObject = parent; - parent.rootObject = this; - } - } - - XMLElement.prototype.clone = function() { - var att, attName, clonedSelf, ref1; - clonedSelf = Object.create(this); - if (clonedSelf.isRoot) { - clonedSelf.documentObject = null; - } - clonedSelf.attributes = {}; - ref1 = this.attributes; - for (attName in ref1) { - if (!hasProp.call(ref1, attName)) continue; - att = ref1[attName]; - clonedSelf.attributes[attName] = att.clone(); - } - clonedSelf.children = []; - this.children.forEach(function(child) { - var clonedChild; - clonedChild = child.clone(); - clonedChild.parent = clonedSelf; - return clonedSelf.children.push(clonedChild); - }); - return clonedSelf; - }; + }); - XMLElement.prototype.attribute = function(name, value) { - var attName, attValue; - if (name != null) { - name = name.valueOf(); + Object.defineProperty(XMLNode.prototype, 'nodeValue', { + get: function() { + return this.value; } - if (isObject(name)) { - for (attName in name) { - if (!hasProp.call(name, attName)) continue; - attValue = name[attName]; - this.attribute(attName, attValue); - } - } else { - if (isFunction(value)) { - value = value.apply(); + }); + + Object.defineProperty(XMLNode.prototype, 'parentNode', { + get: function() { + return this.parent; + } + }); + + Object.defineProperty(XMLNode.prototype, 'childNodes', { + get: function() { + if (!this.childNodeList || !this.childNodeList.nodes) { + this.childNodeList = new XMLNodeList(this.children); } - if (!this.options.skipNullAttributes || (value != null)) { - this.attributes[name] = new XMLAttribute(this, name, value); + return this.childNodeList; + } + }); + + Object.defineProperty(XMLNode.prototype, 'firstChild', { + get: function() { + return this.children[0] || null; + } + }); + + Object.defineProperty(XMLNode.prototype, 'lastChild', { + get: function() { + return this.children[this.children.length - 1] || null; + } + }); + + Object.defineProperty(XMLNode.prototype, 'previousSibling', { + get: function() { + var i; + i = this.parent.children.indexOf(this); + return this.parent.children[i - 1] || null; + } + }); + + Object.defineProperty(XMLNode.prototype, 'nextSibling', { + get: function() { + var i; + i = this.parent.children.indexOf(this); + return this.parent.children[i + 1] || null; + } + }); + + Object.defineProperty(XMLNode.prototype, 'ownerDocument', { + get: function() { + return this.document() || null; + } + }); + + // DOM level 3 + Object.defineProperty(XMLNode.prototype, 'textContent', { + get: function() { + var child, j, len, ref1, str; + if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) { + str = ''; + ref1 = this.children; + for (j = 0, len = ref1.length; j < len; j++) { + child = ref1[j]; + if (child.textContent) { + str += child.textContent; + } + } + return str; + } else { + return null; } + }, + set: function(value) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); } - return this; - }; + }); - XMLElement.prototype.removeAttribute = function(name) { - var attName, i, len; - if (name == null) { - throw new Error("Missing attribute name"); + return XMLNode; + + }).call(this); + +}).call(this); + + +/***/ }), + +/***/ 6768: +/***/ (function(module) { + +// Generated by CoffeeScript 2.4.1 +(function() { + // Represents a list of nodes + var XMLNodeList; + + module.exports = XMLNodeList = (function() { + class XMLNodeList { + // Initializes a new instance of `XMLNodeList` + // This is just a wrapper around an ordinary + // JS array. + + // `nodes` the array containing nodes. + constructor(nodes) { + this.nodes = nodes; } - name = name.valueOf(); - if (Array.isArray(name)) { - for (i = 0, len = name.length; i < len; i++) { - attName = name[i]; - delete this.attributes[attName]; - } - } else { - delete this.attributes[name]; + + // Creates and returns a deep clone of `this` + + clone() { + // this class should not be cloned since it wraps + // around a given array. The calling function should check + // whether the wrapped array is null and supply a new array + // (from the clone). + return this.nodes = null; } - return this; - }; - XMLElement.prototype.toString = function(options) { - return this.options.writer.set(options).element(this); - }; + // DOM Level 1 + item(index) { + return this.nodes[index] || null; + } - XMLElement.prototype.att = function(name, value) { - return this.attribute(name, value); }; - XMLElement.prototype.a = function(name, value) { - return this.attribute(name, value); - }; + // DOM level 1 + Object.defineProperty(XMLNodeList.prototype, 'length', { + get: function() { + return this.nodes.length || 0; + } + }); - return XMLElement; + return XMLNodeList; - })(XMLNode); + }).call(this); }).call(this); /***/ }), -/***/ 7608: +/***/ 6939: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLProcessingInstruction, XMLRaw, XMLText, isEmpty, isFunction, isObject, ref, - hasProp = {}.hasOwnProperty; + var NodeType, XMLCharacterData, XMLProcessingInstruction; - ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction, isEmpty = ref.isEmpty; + NodeType = __nccwpck_require__(9267); - XMLElement = null; - - XMLCData = null; - - XMLComment = null; - - XMLDeclaration = null; - - XMLDocType = null; - - XMLRaw = null; - - XMLText = null; + XMLCharacterData = __nccwpck_require__(7709); - XMLProcessingInstruction = null; + // Represents a processing instruction + module.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLCharacterData { + // Initializes a new instance of `XMLProcessingInstruction` - module.exports = XMLNode = (function() { - function XMLNode(parent) { - this.parent = parent; - if (this.parent) { - this.options = this.parent.options; - this.stringify = this.parent.stringify; - } - this.children = []; - if (!XMLElement) { - XMLElement = __nccwpck_require__(9437); - XMLCData = __nccwpck_require__(333); - XMLComment = __nccwpck_require__(4407); - XMLDeclaration = __nccwpck_require__(6364); - XMLDocType = __nccwpck_require__(1801); - XMLRaw = __nccwpck_require__(6329); - XMLText = __nccwpck_require__(1318); - XMLProcessingInstruction = __nccwpck_require__(6939); - } - } - - XMLNode.prototype.element = function(name, attributes, text) { - var childNode, item, j, k, key, lastChild, len, len1, ref1, val; - lastChild = null; - if (attributes == null) { - attributes = {}; - } - attributes = attributes.valueOf(); - if (!isObject(attributes)) { - ref1 = [attributes, text], text = ref1[0], attributes = ref1[1]; - } - if (name != null) { - name = name.valueOf(); - } - if (Array.isArray(name)) { - for (j = 0, len = name.length; j < len; j++) { - item = name[j]; - lastChild = this.element(item); - } - } else if (isFunction(name)) { - lastChild = this.element(name.apply()); - } else if (isObject(name)) { - for (key in name) { - if (!hasProp.call(name, key)) continue; - val = name[key]; - if (isFunction(val)) { - val = val.apply(); - } - if ((isObject(val)) && (isEmpty(val))) { - val = null; - } - if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) { - lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val); - } else if (!this.options.separateArrayItems && Array.isArray(val)) { - for (k = 0, len1 = val.length; k < len1; k++) { - item = val[k]; - childNode = {}; - childNode[key] = item; - lastChild = this.element(childNode); - } - } else if (isObject(val)) { - lastChild = this.element(key); - lastChild.element(val); - } else { - lastChild = this.element(key, val); - } - } - } else { - if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) { - lastChild = this.text(text); - } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) { - lastChild = this.cdata(text); - } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) { - lastChild = this.comment(text); - } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) { - lastChild = this.raw(text); - } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) { - lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text); - } else { - lastChild = this.node(name, attributes, text); - } + // `parent` the parent node + // `target` instruction target + // `value` instruction value + constructor(parent, target, value) { + super(parent); + if (target == null) { + throw new Error("Missing instruction target. " + this.debugInfo()); } - if (lastChild == null) { - throw new Error("Could not create any elements with: " + name); + this.type = NodeType.ProcessingInstruction; + this.target = this.stringify.insTarget(target); + this.name = this.target; + if (value) { + this.value = this.stringify.insValue(value); } - return lastChild; - }; + } - XMLNode.prototype.insertBefore = function(name, attributes, text) { - var child, i, removed; - if (this.isRoot) { - throw new Error("Cannot insert elements at root level"); - } - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i); - child = this.parent.element(name, attributes, text); - Array.prototype.push.apply(this.parent.children, removed); - return child; - }; + // Creates and returns a deep clone of `this` + clone() { + return Object.create(this); + } - XMLNode.prototype.insertAfter = function(name, attributes, text) { - var child, i, removed; - if (this.isRoot) { - throw new Error("Cannot insert elements at root level"); - } - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i + 1); - child = this.parent.element(name, attributes, text); - Array.prototype.push.apply(this.parent.children, removed); - return child; - }; + // Converts the XML fragment to string - XMLNode.prototype.remove = function() { - var i, ref1; - if (this.isRoot) { - throw new Error("Cannot remove the root element"); - } - i = this.parent.children.indexOf(this); - [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref1 = [])), ref1; - return this.parent; - }; + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options)); + } - XMLNode.prototype.node = function(name, attributes, text) { - var child, ref1; - if (name != null) { - name = name.valueOf(); - } - attributes || (attributes = {}); - attributes = attributes.valueOf(); - if (!isObject(attributes)) { - ref1 = [attributes, text], text = ref1[0], attributes = ref1[1]; + isEqualNode(node) { + if (!super.isEqualNode(node)) { + return false; } - child = new XMLElement(this, name, attributes); - if (text != null) { - child.text(text); + if (node.target !== this.target) { + return false; } - this.children.push(child); - return child; - }; - - XMLNode.prototype.text = function(value) { - var child; - child = new XMLText(this, value); - this.children.push(child); - return this; - }; + return true; + } - XMLNode.prototype.cdata = function(value) { - var child; - child = new XMLCData(this, value); - this.children.push(child); - return this; - }; + }; - XMLNode.prototype.comment = function(value) { - var child; - child = new XMLComment(this, value); - this.children.push(child); - return this; - }; +}).call(this); - XMLNode.prototype.commentBefore = function(value) { - var child, i, removed; - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i); - child = this.parent.comment(value); - Array.prototype.push.apply(this.parent.children, removed); - return this; - }; - XMLNode.prototype.commentAfter = function(value) { - var child, i, removed; - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i + 1); - child = this.parent.comment(value); - Array.prototype.push.apply(this.parent.children, removed); - return this; - }; +/***/ }), - XMLNode.prototype.raw = function(value) { - var child; - child = new XMLRaw(this, value); - this.children.push(child); - return this; - }; +/***/ 6329: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - XMLNode.prototype.instruction = function(target, value) { - var insTarget, insValue, instruction, j, len; - if (target != null) { - target = target.valueOf(); - } - if (value != null) { - value = value.valueOf(); - } - if (Array.isArray(target)) { - for (j = 0, len = target.length; j < len; j++) { - insTarget = target[j]; - this.instruction(insTarget); - } - } else if (isObject(target)) { - for (insTarget in target) { - if (!hasProp.call(target, insTarget)) continue; - insValue = target[insTarget]; - this.instruction(insTarget, insValue); - } - } else { - if (isFunction(value)) { - value = value.apply(); - } - instruction = new XMLProcessingInstruction(this, target, value); - this.children.push(instruction); - } - return this; - }; +// Generated by CoffeeScript 2.4.1 +(function() { + var NodeType, XMLNode, XMLRaw; - XMLNode.prototype.instructionBefore = function(target, value) { - var child, i, removed; - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i); - child = this.parent.instruction(target, value); - Array.prototype.push.apply(this.parent.children, removed); - return this; - }; + NodeType = __nccwpck_require__(9267); - XMLNode.prototype.instructionAfter = function(target, value) { - var child, i, removed; - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i + 1); - child = this.parent.instruction(target, value); - Array.prototype.push.apply(this.parent.children, removed); - return this; - }; + XMLNode = __nccwpck_require__(7608); - XMLNode.prototype.declaration = function(version, encoding, standalone) { - var doc, xmldec; - doc = this.document(); - xmldec = new XMLDeclaration(doc, version, encoding, standalone); - if (doc.children[0] instanceof XMLDeclaration) { - doc.children[0] = xmldec; - } else { - doc.children.unshift(xmldec); - } - return doc.root() || doc; - }; + // Represents a raw node + module.exports = XMLRaw = class XMLRaw extends XMLNode { + // Initializes a new instance of `XMLRaw` - XMLNode.prototype.doctype = function(pubID, sysID) { - var child, doc, doctype, i, j, k, len, len1, ref1, ref2; - doc = this.document(); - doctype = new XMLDocType(doc, pubID, sysID); - ref1 = doc.children; - for (i = j = 0, len = ref1.length; j < len; i = ++j) { - child = ref1[i]; - if (child instanceof XMLDocType) { - doc.children[i] = doctype; - return doctype; - } - } - ref2 = doc.children; - for (i = k = 0, len1 = ref2.length; k < len1; i = ++k) { - child = ref2[i]; - if (child.isRoot) { - doc.children.splice(i, 0, doctype); - return doctype; - } + // `text` raw text + constructor(parent, text) { + super(parent); + if (text == null) { + throw new Error("Missing raw text. " + this.debugInfo()); } - doc.children.push(doctype); - return doctype; - }; + this.type = NodeType.Raw; + this.value = this.stringify.raw(text); + } - XMLNode.prototype.up = function() { - if (this.isRoot) { - throw new Error("The root node has no parent. Use doc() if you need to get the document object."); - } - return this.parent; - }; + // Creates and returns a deep clone of `this` + clone() { + return Object.create(this); + } - XMLNode.prototype.root = function() { - var node; - node = this; - while (node) { - if (node.isDocument) { - return node.rootObject; - } else if (node.isRoot) { - return node; - } else { - node = node.parent; - } - } - }; + // Converts the XML fragment to string - XMLNode.prototype.document = function() { - var node; - node = this; - while (node) { - if (node.isDocument) { - return node; - } else { - node = node.parent; - } - } - }; + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.raw(this, this.options.writer.filterOptions(options)); + } - XMLNode.prototype.end = function(options) { - return this.document().end(options); - }; + }; - XMLNode.prototype.prev = function() { - var i; - i = this.parent.children.indexOf(this); - if (i < 1) { - throw new Error("Already at the first node"); - } - return this.parent.children[i - 1]; - }; +}).call(this); - XMLNode.prototype.next = function() { - var i; - i = this.parent.children.indexOf(this); - if (i === -1 || i === this.parent.children.length - 1) { - throw new Error("Already at the last node"); - } - return this.parent.children[i + 1]; - }; - XMLNode.prototype.importDocument = function(doc) { - var clonedRoot; - clonedRoot = doc.root().clone(); - clonedRoot.parent = this; - clonedRoot.isRoot = false; - this.children.push(clonedRoot); - return this; - }; +/***/ }), - XMLNode.prototype.ele = function(name, attributes, text) { - return this.element(name, attributes, text); - }; +/***/ 8601: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - XMLNode.prototype.nod = function(name, attributes, text) { - return this.node(name, attributes, text); - }; +// Generated by CoffeeScript 2.4.1 +(function() { + var NodeType, WriterState, XMLStreamWriter, XMLWriterBase, + hasProp = {}.hasOwnProperty; - XMLNode.prototype.txt = function(value) { - return this.text(value); - }; + NodeType = __nccwpck_require__(9267); - XMLNode.prototype.dat = function(value) { - return this.cdata(value); - }; + XMLWriterBase = __nccwpck_require__(6752); - XMLNode.prototype.com = function(value) { - return this.comment(value); - }; + WriterState = __nccwpck_require__(9766); + + // Prints XML nodes to a stream + module.exports = XMLStreamWriter = class XMLStreamWriter extends XMLWriterBase { + // Initializes a new instance of `XMLStreamWriter` + + // `stream` output stream + // `options.pretty` pretty prints the result + // `options.indent` indentation string + // `options.newline` newline sequence + // `options.offset` a fixed number of indentations to add to every line + // `options.allowEmpty` do not self close empty element tags + // 'options.dontPrettyTextNodes' if any text is present in node, don't indent or LF + // `options.spaceBeforeSlash` add a space before the closing slash of empty elements + constructor(stream, options) { + super(options); + this.stream = stream; + } - XMLNode.prototype.ins = function(target, value) { - return this.instruction(target, value); - }; + endline(node, options, level) { + if (node.isLastRootNode && options.state === WriterState.CloseTag) { + return ''; + } else { + return super.endline(node, options, level); + } + } - XMLNode.prototype.doc = function() { - return this.document(); - }; + document(doc, options) { + var child, i, j, k, len1, len2, ref, ref1, results; + ref = doc.children; + // set a flag so that we don't insert a newline after the last root level node + for (i = j = 0, len1 = ref.length; j < len1; i = ++j) { + child = ref[i]; + child.isLastRootNode = i === doc.children.length - 1; + } + options = this.filterOptions(options); + ref1 = doc.children; + results = []; + for (k = 0, len2 = ref1.length; k < len2; k++) { + child = ref1[k]; + results.push(this.writeChildNode(child, options, 0)); + } + return results; + } - XMLNode.prototype.dec = function(version, encoding, standalone) { - return this.declaration(version, encoding, standalone); - }; + cdata(node, options, level) { + return this.stream.write(super.cdata(node, options, level)); + } - XMLNode.prototype.dtd = function(pubID, sysID) { - return this.doctype(pubID, sysID); - }; + comment(node, options, level) { + return this.stream.write(super.comment(node, options, level)); + } - XMLNode.prototype.e = function(name, attributes, text) { - return this.element(name, attributes, text); - }; + declaration(node, options, level) { + return this.stream.write(super.declaration(node, options, level)); + } - XMLNode.prototype.n = function(name, attributes, text) { - return this.node(name, attributes, text); - }; + docType(node, options, level) { + var child, j, len1, ref; + level || (level = 0); + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + this.stream.write(this.indent(node, options, level)); + this.stream.write(' 0) { + this.stream.write(' ['); + this.stream.write(this.endline(node, options, level)); + options.state = WriterState.InsideTag; + ref = node.children; + for (j = 0, len1 = ref.length; j < len1; j++) { + child = ref[j]; + this.writeChildNode(child, options, level + 1); + } + options.state = WriterState.CloseTag; + this.stream.write(']'); + } + // close tag + options.state = WriterState.CloseTag; + this.stream.write(options.spaceBeforeSlash + '>'); + this.stream.write(this.endline(node, options, level)); + options.state = WriterState.None; + return this.closeNode(node, options, level); + } - XMLNode.prototype.t = function(value) { - return this.text(value); - }; + element(node, options, level) { + var att, attLen, child, childNodeCount, firstChildNode, j, len, len1, name, prettySuppressed, r, ratt, ref, ref1, ref2, rline; + level || (level = 0); + // open tag + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '<' + node.name; + // attributes + if (options.pretty && options.width > 0) { + len = r.length; + ref = node.attribs; + for (name in ref) { + if (!hasProp.call(ref, name)) continue; + att = ref[name]; + ratt = this.attribute(att, options, level); + attLen = ratt.length; + if (len + attLen > options.width) { + rline = this.indent(node, options, level + 1) + ratt; + r += this.endline(node, options, level) + rline; + len = rline.length; + } else { + rline = ' ' + ratt; + r += rline; + len += rline.length; + } + } + } else { + ref1 = node.attribs; + for (name in ref1) { + if (!hasProp.call(ref1, name)) continue; + att = ref1[name]; + r += this.attribute(att, options, level); + } + } + this.stream.write(r); + childNodeCount = node.children.length; + firstChildNode = childNodeCount === 0 ? null : node.children[0]; + if (childNodeCount === 0 || node.children.every(function(e) { + return (e.type === NodeType.Text || e.type === NodeType.Raw || e.type === NodeType.CData) && e.value === ''; + })) { + // empty element + if (options.allowEmpty) { + this.stream.write('>'); + options.state = WriterState.CloseTag; + this.stream.write(''); + } else { + options.state = WriterState.CloseTag; + this.stream.write(options.spaceBeforeSlash + '/>'); + } + } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw || firstChildNode.type === NodeType.CData) && (firstChildNode.value != null)) { + // do not indent text-only nodes + this.stream.write('>'); + options.state = WriterState.InsideTag; + options.suppressPrettyCount++; + prettySuppressed = true; + this.writeChildNode(firstChildNode, options, level + 1); + options.suppressPrettyCount--; + prettySuppressed = false; + options.state = WriterState.CloseTag; + this.stream.write(''); + } else { + this.stream.write('>' + this.endline(node, options, level)); + options.state = WriterState.InsideTag; + ref2 = node.children; + // inner tags + for (j = 0, len1 = ref2.length; j < len1; j++) { + child = ref2[j]; + this.writeChildNode(child, options, level + 1); + } + // close tag + options.state = WriterState.CloseTag; + this.stream.write(this.indent(node, options, level) + ''); + } + this.stream.write(this.endline(node, options, level)); + options.state = WriterState.None; + return this.closeNode(node, options, level); + } - XMLNode.prototype.d = function(value) { - return this.cdata(value); - }; + processingInstruction(node, options, level) { + return this.stream.write(super.processingInstruction(node, options, level)); + } - XMLNode.prototype.c = function(value) { - return this.comment(value); - }; + raw(node, options, level) { + return this.stream.write(super.raw(node, options, level)); + } - XMLNode.prototype.r = function(value) { - return this.raw(value); - }; + text(node, options, level) { + return this.stream.write(super.text(node, options, level)); + } - XMLNode.prototype.i = function(target, value) { - return this.instruction(target, value); - }; + dtdAttList(node, options, level) { + return this.stream.write(super.dtdAttList(node, options, level)); + } - XMLNode.prototype.u = function() { - return this.up(); - }; + dtdElement(node, options, level) { + return this.stream.write(super.dtdElement(node, options, level)); + } - XMLNode.prototype.importXMLBuilder = function(doc) { - return this.importDocument(doc); - }; + dtdEntity(node, options, level) { + return this.stream.write(super.dtdEntity(node, options, level)); + } - return XMLNode; + dtdNotation(node, options, level) { + return this.stream.write(super.dtdNotation(node, options, level)); + } - })(); + }; }).call(this); /***/ }), -/***/ 6939: +/***/ 5913: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLNode, XMLProcessingInstruction, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + var XMLStringWriter, XMLWriterBase; - XMLNode = __nccwpck_require__(7608); + XMLWriterBase = __nccwpck_require__(6752); - module.exports = XMLProcessingInstruction = (function(superClass) { - extend(XMLProcessingInstruction, superClass); + // Prints XML nodes as plain text + module.exports = XMLStringWriter = class XMLStringWriter extends XMLWriterBase { + // Initializes a new instance of `XMLStringWriter` - function XMLProcessingInstruction(parent, target, value) { - XMLProcessingInstruction.__super__.constructor.call(this, parent); - if (target == null) { - throw new Error("Missing instruction target"); + // `options.pretty` pretty prints the result + // `options.indent` indentation string + // `options.newline` newline sequence + // `options.offset` a fixed number of indentations to add to every line + // `options.allowEmpty` do not self close empty element tags + // 'options.dontPrettyTextNodes' if any text is present in node, don't indent or LF + // `options.spaceBeforeSlash` add a space before the closing slash of empty elements + constructor(options) { + super(options); + } + + document(doc, options) { + var child, i, len, r, ref; + options = this.filterOptions(options); + r = ''; + ref = doc.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + r += this.writeChildNode(child, options, 0); } - this.target = this.stringify.insTarget(target); - if (value) { - this.value = this.stringify.insValue(value); + // remove trailing newline + if (options.pretty && r.slice(-options.newline.length) === options.newline) { + r = r.slice(0, -options.newline.length); } + return r; } - XMLProcessingInstruction.prototype.clone = function() { - return Object.create(this); - }; - - XMLProcessingInstruction.prototype.toString = function(options) { - return this.options.writer.set(options).processingInstruction(this); - }; - - return XMLProcessingInstruction; - - })(XMLNode); + }; }).call(this); /***/ }), -/***/ 6329: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 8594: +/***/ (function(module) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLNode, XMLRaw, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + // Converts values to strings + var XMLStringifier, hasProp = {}.hasOwnProperty; - XMLNode = __nccwpck_require__(7608); - - module.exports = XMLRaw = (function(superClass) { - extend(XMLRaw, superClass); + module.exports = XMLStringifier = (function() { + class XMLStringifier { + // Initializes a new instance of `XMLStringifier` + + // `options.version` The version number string of the XML spec to validate against, e.g. 1.0 + // `options.noDoubleEncoding` whether existing html entities are encoded: true or false + // `options.stringify` a set of functions to use for converting values to strings + // `options.noValidation` whether values will be validated and escaped or returned as is + // `options.invalidCharReplacement` a character to replace invalid characters and disable character validation + constructor(options) { + var key, ref, value; + // Checks whether the given string contains legal characters + // Fails with an exception on error + + // `str` the string to check + this.assertLegalChar = this.assertLegalChar.bind(this); + // Checks whether the given string contains legal characters for a name + // Fails with an exception on error + + // `str` the string to check + this.assertLegalName = this.assertLegalName.bind(this); + options || (options = {}); + this.options = options; + if (!this.options.version) { + this.options.version = '1.0'; + } + ref = options.stringify || {}; + for (key in ref) { + if (!hasProp.call(ref, key)) continue; + value = ref[key]; + this[key] = value; + } + } - function XMLRaw(parent, text) { - XMLRaw.__super__.constructor.call(this, parent); - if (text == null) { - throw new Error("Missing raw text"); + // Defaults + name(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalName('' + val || ''); } - this.value = this.stringify.raw(text); - } - XMLRaw.prototype.clone = function() { - return Object.create(this); - }; + text(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar(this.textEscape('' + val || '')); + } - XMLRaw.prototype.toString = function(options) { - return this.options.writer.set(options).raw(this); - }; + cdata(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + val = val.replace(']]>', ']]]]>'); + return this.assertLegalChar(val); + } - return XMLRaw; + comment(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + if (val.match(/--/)) { + throw new Error("Comment text cannot contain double-hypen: " + val); + } + return this.assertLegalChar(val); + } - })(XMLNode); + raw(val) { + if (this.options.noValidation) { + return val; + } + return '' + val || ''; + } -}).call(this); + attValue(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar(this.attEscape(val = '' + val || '')); + } + insTarget(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); + } -/***/ }), + insValue(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + if (val.match(/\?>/)) { + throw new Error("Invalid processing instruction value: " + val); + } + return this.assertLegalChar(val); + } -/***/ 8601: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + xmlVersion(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + if (!val.match(/1\.[0-9]+/)) { + throw new Error("Invalid version number: " + val); + } + return val; + } -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStreamWriter, XMLText, XMLWriterBase, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + xmlEncoding(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) { + throw new Error("Invalid encoding: " + val); + } + return this.assertLegalChar(val); + } - XMLDeclaration = __nccwpck_require__(6364); + xmlStandalone(val) { + if (this.options.noValidation) { + return val; + } + if (val) { + return "yes"; + } else { + return "no"; + } + } - XMLDocType = __nccwpck_require__(1801); + dtdPubID(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); + } - XMLCData = __nccwpck_require__(333); + dtdSysID(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); + } - XMLComment = __nccwpck_require__(4407); + dtdElementValue(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); + } - XMLElement = __nccwpck_require__(9437); + dtdAttType(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); + } - XMLRaw = __nccwpck_require__(6329); + dtdAttDefault(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); + } - XMLText = __nccwpck_require__(1318); + dtdEntityValue(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); + } - XMLProcessingInstruction = __nccwpck_require__(6939); + dtdNData(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); + } - XMLDTDAttList = __nccwpck_require__(1015); + assertLegalChar(str) { + var regex, res; + if (this.options.noValidation) { + return str; + } + if (this.options.version === '1.0') { + // Valid characters from https://www.w3.org/TR/xml/#charsets + // any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. + // #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] + // This ES5 compatible Regexp has been generated using the "regenerate" NPM module: + // let xml_10_InvalidChars = regenerate() + // .addRange(0x0000, 0x0008) + // .add(0x000B, 0x000C) + // .addRange(0x000E, 0x001F) + // .addRange(0xD800, 0xDFFF) + // .addRange(0xFFFE, 0xFFFF) + regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g; + if (this.options.invalidCharReplacement !== void 0) { + str = str.replace(regex, this.options.invalidCharReplacement); + } else if (res = str.match(regex)) { + throw new Error(`Invalid character in string: ${str} at index ${res.index}`); + } + } else if (this.options.version === '1.1') { + // Valid characters from https://www.w3.org/TR/xml11/#charsets + // any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. + // [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] + // This ES5 compatible Regexp has been generated using the "regenerate" NPM module: + // let xml_11_InvalidChars = regenerate() + // .add(0x0000) + // .addRange(0xD800, 0xDFFF) + // .addRange(0xFFFE, 0xFFFF) + regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g; + if (this.options.invalidCharReplacement !== void 0) { + str = str.replace(regex, this.options.invalidCharReplacement); + } else if (res = str.match(regex)) { + throw new Error(`Invalid character in string: ${str} at index ${res.index}`); + } + } + return str; + } - XMLDTDElement = __nccwpck_require__(2421); + assertLegalName(str) { + var regex; + if (this.options.noValidation) { + return str; + } + str = this.assertLegalChar(str); + regex = /^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/; + if (!str.match(regex)) { + throw new Error(`Invalid character in name: ${str}`); + } + return str; + } - XMLDTDEntity = __nccwpck_require__(53); + // Escapes special characters in text - XMLDTDNotation = __nccwpck_require__(2837); + // See http://www.w3.org/TR/2000/WD-xml-c14n-20000119.html#charescaping - XMLWriterBase = __nccwpck_require__(6752); + // `str` the string to escape + textEscape(str) { + var ampregex; + if (this.options.noValidation) { + return str; + } + ampregex = this.options.noDoubleEncoding ? /(?!&(lt|gt|amp|apos|quot);)&/g : /&/g; + return str.replace(ampregex, '&').replace(//g, '>').replace(/\r/g, ' '); + } - module.exports = XMLStreamWriter = (function(superClass) { - extend(XMLStreamWriter, superClass); + // Escapes special characters in attribute values - function XMLStreamWriter(stream, options) { - XMLStreamWriter.__super__.constructor.call(this, options); - this.stream = stream; - } + // See http://www.w3.org/TR/2000/WD-xml-c14n-20000119.html#charescaping - XMLStreamWriter.prototype.document = function(doc) { - var child, i, j, len, len1, ref, ref1, results; - ref = doc.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - child.isLastRootNode = false; - } - doc.children[doc.children.length - 1].isLastRootNode = true; - ref1 = doc.children; - results = []; - for (j = 0, len1 = ref1.length; j < len1; j++) { - child = ref1[j]; - switch (false) { - case !(child instanceof XMLDeclaration): - results.push(this.declaration(child)); - break; - case !(child instanceof XMLDocType): - results.push(this.docType(child)); - break; - case !(child instanceof XMLComment): - results.push(this.comment(child)); - break; - case !(child instanceof XMLProcessingInstruction): - results.push(this.processingInstruction(child)); - break; - default: - results.push(this.element(child)); + // `str` the string to escape + attEscape(str) { + var ampregex; + if (this.options.noValidation) { + return str; } + ampregex = this.options.noDoubleEncoding ? /(?!&(lt|gt|amp|apos|quot);)&/g : /&/g; + return str.replace(ampregex, '&').replace(/' + this.endline(node)); - }; + // strings to match while converting from JS objects + XMLStringifier.prototype.convertAttKey = '@'; - XMLStreamWriter.prototype.comment = function(node, level) { - return this.stream.write(this.space(level) + '' + this.endline(node)); - }; + XMLStringifier.prototype.convertPIKey = '?'; - XMLStreamWriter.prototype.declaration = function(node, level) { - this.stream.write(this.space(level)); - this.stream.write(''); - return this.stream.write(this.endline(node)); - }; + XMLStringifier.prototype.convertTextKey = '#text'; - XMLStreamWriter.prototype.docType = function(node, level) { - var child, i, len, ref; - level || (level = 0); - this.stream.write(this.space(level)); - this.stream.write(' 0) { - this.stream.write(' ['); - this.stream.write(this.endline(node)); - ref = node.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - switch (false) { - case !(child instanceof XMLDTDAttList): - this.dtdAttList(child, level + 1); - break; - case !(child instanceof XMLDTDElement): - this.dtdElement(child, level + 1); - break; - case !(child instanceof XMLDTDEntity): - this.dtdEntity(child, level + 1); - break; - case !(child instanceof XMLDTDNotation): - this.dtdNotation(child, level + 1); - break; - case !(child instanceof XMLCData): - this.cdata(child, level + 1); - break; - case !(child instanceof XMLComment): - this.comment(child, level + 1); - break; - case !(child instanceof XMLProcessingInstruction): - this.processingInstruction(child, level + 1); - break; - default: - throw new Error("Unknown DTD node type: " + child.constructor.name); - } - } - this.stream.write(']'); - } - this.stream.write(this.spacebeforeslash + '>'); - return this.stream.write(this.endline(node)); - }; + XMLStringifier.prototype.convertCDataKey = '#cdata'; - XMLStreamWriter.prototype.element = function(node, level) { - var att, child, i, len, name, ref, ref1, space; - level || (level = 0); - space = this.space(level); - this.stream.write(space + '<' + node.name); - ref = node.attributes; - for (name in ref) { - if (!hasProp.call(ref, name)) continue; - att = ref[name]; - this.attribute(att); - } - if (node.children.length === 0 || node.children.every(function(e) { - return e.value === ''; - })) { - if (this.allowEmpty) { - this.stream.write('>'); - } else { - this.stream.write(this.spacebeforeslash + '/>'); - } - } else if (this.pretty && node.children.length === 1 && (node.children[0].value != null)) { - this.stream.write('>'); - this.stream.write(node.children[0].value); - this.stream.write(''); - } else { - this.stream.write('>' + this.newline); - ref1 = node.children; - for (i = 0, len = ref1.length; i < len; i++) { - child = ref1[i]; - switch (false) { - case !(child instanceof XMLCData): - this.cdata(child, level + 1); - break; - case !(child instanceof XMLComment): - this.comment(child, level + 1); - break; - case !(child instanceof XMLElement): - this.element(child, level + 1); - break; - case !(child instanceof XMLRaw): - this.raw(child, level + 1); - break; - case !(child instanceof XMLText): - this.text(child, level + 1); - break; - case !(child instanceof XMLProcessingInstruction): - this.processingInstruction(child, level + 1); - break; - default: - throw new Error("Unknown XML node type: " + child.constructor.name); - } + XMLStringifier.prototype.convertCommentKey = '#comment'; + + XMLStringifier.prototype.convertRawKey = '#raw'; + + return XMLStringifier; + + }).call(this); + +}).call(this); + + +/***/ }), + +/***/ 1318: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 2.4.1 +(function() { + var NodeType, XMLCharacterData, XMLText; + + NodeType = __nccwpck_require__(9267); + + XMLCharacterData = __nccwpck_require__(7709); + + // Represents a text node + module.exports = XMLText = (function() { + class XMLText extends XMLCharacterData { + // Initializes a new instance of `XMLText` + + // `text` element text + constructor(parent, text) { + super(parent); + if (text == null) { + throw new Error("Missing element text. " + this.debugInfo()); } - this.stream.write(space + ''); + this.name = "#text"; + this.type = NodeType.Text; + this.value = this.stringify.text(text); } - return this.stream.write(this.endline(node)); - }; - XMLStreamWriter.prototype.processingInstruction = function(node, level) { - this.stream.write(this.space(level) + '' + this.endline(node)); - }; - XMLStreamWriter.prototype.raw = function(node, level) { - return this.stream.write(this.space(level) + node.value + this.endline(node)); - }; + // Converts the XML fragment to string - XMLStreamWriter.prototype.text = function(node, level) { - return this.stream.write(this.space(level) + node.value + this.endline(node)); - }; + // `options.pretty` pretty prints the result + // `options.indent` indentation for pretty print + // `options.offset` how many indentations to add to every line for pretty print + // `options.newline` newline sequence for pretty print + toString(options) { + return this.options.writer.text(this, this.options.writer.filterOptions(options)); + } - XMLStreamWriter.prototype.dtdAttList = function(node, level) { - this.stream.write(this.space(level) + '' + this.endline(node)); - }; - XMLStreamWriter.prototype.dtdElement = function(node, level) { - this.stream.write(this.space(level) + '' + this.endline(node)); }; - XMLStreamWriter.prototype.dtdEntity = function(node, level) { - this.stream.write(this.space(level) + '' + this.endline(node)); - }; - - XMLStreamWriter.prototype.dtdNotation = function(node, level) { - this.stream.write(this.space(level) + '' + this.endline(node)); - }; - - XMLStreamWriter.prototype.endline = function(node) { - if (!node.isLastRootNode) { - return this.newline; - } else { - return ''; - } - }; + }); - return XMLStreamWriter; + return XMLText; - })(XMLWriterBase); + }).call(this); }).call(this); /***/ }), -/***/ 5913: +/***/ 6752: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLText, XMLWriterBase, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + var NodeType, WriterState, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLText, XMLWriterBase, assign, hasProp = {}.hasOwnProperty; + ({assign} = __nccwpck_require__(8229)); + + NodeType = __nccwpck_require__(9267); + XMLDeclaration = __nccwpck_require__(6364); XMLDocType = __nccwpck_require__(1801); @@ -10590,6 +13227,8 @@ exports["default"] = _default; XMLProcessingInstruction = __nccwpck_require__(6939); + XMLDummy = __nccwpck_require__(3590); + XMLDTDAttList = __nccwpck_require__(1015); XMLDTDElement = __nccwpck_require__(2421); @@ -10598,236 +13237,401 @@ exports["default"] = _default; XMLDTDNotation = __nccwpck_require__(2837); - XMLWriterBase = __nccwpck_require__(6752); + WriterState = __nccwpck_require__(9766); + + // Base class for XML writers + module.exports = XMLWriterBase = class XMLWriterBase { + // Initializes a new instance of `XMLWriterBase` + + // `options.pretty` pretty prints the result + // `options.indent` indentation string + // `options.newline` newline sequence + // `options.offset` a fixed number of indentations to add to every line + // `options.width` maximum column width + // `options.allowEmpty` do not self close empty element tags + // 'options.dontPrettyTextNodes' if any text is present in node, don't indent or LF + // `options.spaceBeforeSlash` add a space before the closing slash of empty elements + constructor(options) { + var key, ref, value; + options || (options = {}); + this.options = options; + ref = options.writer || {}; + for (key in ref) { + if (!hasProp.call(ref, key)) continue; + value = ref[key]; + this["_" + key] = this[key]; + this[key] = value; + } + } + + // Filters writer options and provides defaults + + // `options` writer options + filterOptions(options) { + var filteredOptions, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7; + options || (options = {}); + options = assign({}, this.options, options); + filteredOptions = { + writer: this + }; + filteredOptions.pretty = options.pretty || false; + filteredOptions.allowEmpty = options.allowEmpty || false; + filteredOptions.indent = (ref = options.indent) != null ? ref : ' '; + filteredOptions.newline = (ref1 = options.newline) != null ? ref1 : '\n'; + filteredOptions.offset = (ref2 = options.offset) != null ? ref2 : 0; + filteredOptions.width = (ref3 = options.width) != null ? ref3 : 0; + filteredOptions.dontPrettyTextNodes = (ref4 = (ref5 = options.dontPrettyTextNodes) != null ? ref5 : options.dontprettytextnodes) != null ? ref4 : 0; + filteredOptions.spaceBeforeSlash = (ref6 = (ref7 = options.spaceBeforeSlash) != null ? ref7 : options.spacebeforeslash) != null ? ref6 : ''; + if (filteredOptions.spaceBeforeSlash === true) { + filteredOptions.spaceBeforeSlash = ' '; + } + filteredOptions.suppressPrettyCount = 0; + filteredOptions.user = {}; + filteredOptions.state = WriterState.None; + return filteredOptions; + } + + // Returns the indentation string for the current level + + // `node` current node + // `options` writer options + // `level` current indentation level + indent(node, options, level) { + var indentLevel; + if (!options.pretty || options.suppressPrettyCount) { + return ''; + } else if (options.pretty) { + indentLevel = (level || 0) + options.offset + 1; + if (indentLevel > 0) { + return new Array(indentLevel).join(options.indent); + } + } + return ''; + } - module.exports = XMLStringWriter = (function(superClass) { - extend(XMLStringWriter, superClass); + // Returns the newline string - function XMLStringWriter(options) { - XMLStringWriter.__super__.constructor.call(this, options); + // `node` current node + // `options` writer options + // `level` current indentation level + endline(node, options, level) { + if (!options.pretty || options.suppressPrettyCount) { + return ''; + } else { + return options.newline; + } } - XMLStringWriter.prototype.document = function(doc) { - var child, i, len, r, ref; - this.textispresent = false; - r = ''; - ref = doc.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - r += (function() { - switch (false) { - case !(child instanceof XMLDeclaration): - return this.declaration(child); - case !(child instanceof XMLDocType): - return this.docType(child); - case !(child instanceof XMLComment): - return this.comment(child); - case !(child instanceof XMLProcessingInstruction): - return this.processingInstruction(child); - default: - return this.element(child, 0); - } - }).call(this); - } - if (this.pretty && r.slice(-this.newline.length) === this.newline) { - r = r.slice(0, -this.newline.length); + attribute(att, options, level) { + var r; + this.openAttribute(att, options, level); + if (options.pretty && options.width > 0) { + r = att.name + '="' + att.value + '"'; + } else { + r = ' ' + att.name + '="' + att.value + '"'; } + this.closeAttribute(att, options, level); return r; - }; - - XMLStringWriter.prototype.attribute = function(att) { - return ' ' + att.name + '="' + att.value + '"'; - }; + } - XMLStringWriter.prototype.cdata = function(node, level) { - return this.space(level) + '' + this.newline; - }; + cdata(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; + } - XMLStringWriter.prototype.comment = function(node, level) { - return this.space(level) + '' + this.newline; - }; + comment(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; + } - XMLStringWriter.prototype.declaration = function(node, level) { + declaration(node, options, level) { var r; - r = this.space(level); - r += ''; - r += this.newline; + options.state = WriterState.CloseTag; + r += options.spaceBeforeSlash + '?>'; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); return r; - }; + } - XMLStringWriter.prototype.docType = function(node, level) { - var child, i, len, r, ref; + docType(node, options, level) { + var child, i, len1, r, ref; level || (level = 0); - r = this.space(level); + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level); r += ' 0) { r += ' ['; - r += this.newline; + r += this.endline(node, options, level); + options.state = WriterState.InsideTag; ref = node.children; - for (i = 0, len = ref.length; i < len; i++) { + for (i = 0, len1 = ref.length; i < len1; i++) { child = ref[i]; - r += (function() { - switch (false) { - case !(child instanceof XMLDTDAttList): - return this.dtdAttList(child, level + 1); - case !(child instanceof XMLDTDElement): - return this.dtdElement(child, level + 1); - case !(child instanceof XMLDTDEntity): - return this.dtdEntity(child, level + 1); - case !(child instanceof XMLDTDNotation): - return this.dtdNotation(child, level + 1); - case !(child instanceof XMLCData): - return this.cdata(child, level + 1); - case !(child instanceof XMLComment): - return this.comment(child, level + 1); - case !(child instanceof XMLProcessingInstruction): - return this.processingInstruction(child, level + 1); - default: - throw new Error("Unknown DTD node type: " + child.constructor.name); - } - }).call(this); + r += this.writeChildNode(child, options, level + 1); } + options.state = WriterState.CloseTag; r += ']'; } - r += this.spacebeforeslash + '>'; - r += this.newline; + // close tag + options.state = WriterState.CloseTag; + r += options.spaceBeforeSlash + '>'; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); return r; - }; + } - XMLStringWriter.prototype.element = function(node, level) { - var att, child, i, j, len, len1, name, r, ref, ref1, ref2, space, textispresentwasset; + element(node, options, level) { + var att, attLen, child, childNodeCount, firstChildNode, i, j, len, len1, len2, name, prettySuppressed, r, ratt, ref, ref1, ref2, ref3, rline; level || (level = 0); - textispresentwasset = false; - if (this.textispresent) { - this.newline = ''; - this.pretty = false; + prettySuppressed = false; + // open tag + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '<' + node.name; + // attributes + if (options.pretty && options.width > 0) { + len = r.length; + ref = node.attribs; + for (name in ref) { + if (!hasProp.call(ref, name)) continue; + att = ref[name]; + ratt = this.attribute(att, options, level); + attLen = ratt.length; + if (len + attLen > options.width) { + rline = this.indent(node, options, level + 1) + ratt; + r += this.endline(node, options, level) + rline; + len = rline.length; + } else { + rline = ' ' + ratt; + r += rline; + len += rline.length; + } + } } else { - this.newline = this.newlinedefault; - this.pretty = this.prettydefault; + ref1 = node.attribs; + for (name in ref1) { + if (!hasProp.call(ref1, name)) continue; + att = ref1[name]; + r += this.attribute(att, options, level); + } } - space = this.space(level); - r = ''; - r += space + '<' + node.name; - ref = node.attributes; - for (name in ref) { - if (!hasProp.call(ref, name)) continue; - att = ref[name]; - r += this.attribute(att); - } - if (node.children.length === 0 || node.children.every(function(e) { - return e.value === ''; + childNodeCount = node.children.length; + firstChildNode = childNodeCount === 0 ? null : node.children[0]; + if (childNodeCount === 0 || node.children.every(function(e) { + return (e.type === NodeType.Text || e.type === NodeType.Raw || e.type === NodeType.CData) && e.value === ''; })) { - if (this.allowEmpty) { - r += '>' + this.newline; + // empty element + if (options.allowEmpty) { + r += '>'; + options.state = WriterState.CloseTag; + r += '' + this.endline(node, options, level); } else { - r += this.spacebeforeslash + '/>' + this.newline; + options.state = WriterState.CloseTag; + r += options.spaceBeforeSlash + '/>' + this.endline(node, options, level); } - } else if (this.pretty && node.children.length === 1 && (node.children[0].value != null)) { + } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw || firstChildNode.type === NodeType.CData) && (firstChildNode.value != null)) { + // do not indent text-only nodes r += '>'; - r += node.children[0].value; - r += '' + this.newline; + options.state = WriterState.InsideTag; + options.suppressPrettyCount++; + prettySuppressed = true; + r += this.writeChildNode(firstChildNode, options, level + 1); + options.suppressPrettyCount--; + prettySuppressed = false; + options.state = WriterState.CloseTag; + r += '' + this.endline(node, options, level); } else { - if (this.dontprettytextnodes) { - ref1 = node.children; - for (i = 0, len = ref1.length; i < len; i++) { - child = ref1[i]; - if (child.value != null) { - this.textispresent++; - textispresentwasset = true; + // if ANY are a text node, then suppress pretty now + if (options.dontPrettyTextNodes) { + ref2 = node.children; + for (i = 0, len1 = ref2.length; i < len1; i++) { + child = ref2[i]; + if ((child.type === NodeType.Text || child.type === NodeType.Raw || child.type === NodeType.CData) && (child.value != null)) { + options.suppressPrettyCount++; + prettySuppressed = true; break; } } } - if (this.textispresent) { - this.newline = ''; - this.pretty = false; - space = this.space(level); - } - r += '>' + this.newline; - ref2 = node.children; - for (j = 0, len1 = ref2.length; j < len1; j++) { - child = ref2[j]; - r += (function() { - switch (false) { - case !(child instanceof XMLCData): - return this.cdata(child, level + 1); - case !(child instanceof XMLComment): - return this.comment(child, level + 1); - case !(child instanceof XMLElement): - return this.element(child, level + 1); - case !(child instanceof XMLRaw): - return this.raw(child, level + 1); - case !(child instanceof XMLText): - return this.text(child, level + 1); - case !(child instanceof XMLProcessingInstruction): - return this.processingInstruction(child, level + 1); - default: - throw new Error("Unknown XML node type: " + child.constructor.name); - } - }).call(this); - } - if (textispresentwasset) { - this.textispresent--; + // close the opening tag, after dealing with newline + r += '>' + this.endline(node, options, level); + options.state = WriterState.InsideTag; + ref3 = node.children; + // inner tags + for (j = 0, len2 = ref3.length; j < len2; j++) { + child = ref3[j]; + r += this.writeChildNode(child, options, level + 1); } - if (!this.textispresent) { - this.newline = this.newlinedefault; - this.pretty = this.prettydefault; + // close tag + options.state = WriterState.CloseTag; + r += this.indent(node, options, level) + ''; + if (prettySuppressed) { + options.suppressPrettyCount--; } - r += space + '' + this.newline; + r += this.endline(node, options, level); + options.state = WriterState.None; } + this.closeNode(node, options, level); return r; - }; + } + + writeChildNode(node, options, level) { + switch (node.type) { + case NodeType.CData: + return this.cdata(node, options, level); + case NodeType.Comment: + return this.comment(node, options, level); + case NodeType.Element: + return this.element(node, options, level); + case NodeType.Raw: + return this.raw(node, options, level); + case NodeType.Text: + return this.text(node, options, level); + case NodeType.ProcessingInstruction: + return this.processingInstruction(node, options, level); + case NodeType.Dummy: + return ''; + case NodeType.Declaration: + return this.declaration(node, options, level); + case NodeType.DocType: + return this.docType(node, options, level); + case NodeType.AttributeDeclaration: + return this.dtdAttList(node, options, level); + case NodeType.ElementDeclaration: + return this.dtdElement(node, options, level); + case NodeType.EntityDeclaration: + return this.dtdEntity(node, options, level); + case NodeType.NotationDeclaration: + return this.dtdNotation(node, options, level); + default: + throw new Error("Unknown XML node type: " + node.constructor.name); + } + } - XMLStringWriter.prototype.processingInstruction = function(node, level) { + processingInstruction(node, options, level) { var r; - r = this.space(level) + '' + this.newline; + options.state = WriterState.CloseTag; + r += options.spaceBeforeSlash + '?>'; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); return r; - }; + } - XMLStringWriter.prototype.raw = function(node, level) { - return this.space(level) + node.value + this.newline; - }; + raw(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level); + options.state = WriterState.InsideTag; + r += node.value; + options.state = WriterState.CloseTag; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; + } - XMLStringWriter.prototype.text = function(node, level) { - return this.space(level) + node.value + this.newline; - }; + text(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level); + options.state = WriterState.InsideTag; + r += node.value; + options.state = WriterState.CloseTag; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; + } - XMLStringWriter.prototype.dtdAttList = function(node, level) { + dtdAttList(node, options, level) { var r; - r = this.space(level) + '' + this.newline; + options.state = WriterState.CloseTag; + r += options.spaceBeforeSlash + '>' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); return r; - }; + } - XMLStringWriter.prototype.dtdElement = function(node, level) { - return this.space(level) + '' + this.newline; - }; + dtdElement(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; + } - XMLStringWriter.prototype.dtdEntity = function(node, level) { + dtdEntity(node, options, level) { var r; - r = this.space(level) + '' + this.newline; + options.state = WriterState.CloseTag; + r += options.spaceBeforeSlash + '>' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); return r; - }; + } - XMLStringWriter.prototype.dtdNotation = function(node, level) { + dtdNotation(node, options, level) { var r; - r = this.space(level) + '' + this.newline; + options.state = WriterState.CloseTag; + r += options.spaceBeforeSlash + '>' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); return r; - }; - - XMLStringWriter.prototype.openNode = function(node, level) { - var att, name, r, ref; - level || (level = 0); - if (node instanceof XMLElement) { - r = this.space(level) + '<' + node.name; - ref = node.attributes; - for (name in ref) { - if (!hasProp.call(ref, name)) continue; - att = ref[name]; - r += this.attribute(att); - } - r += (node.children ? '>' : '/>') + this.newline; - return r; - } else { - r = this.space(level) + '') + this.newline; - return r; - } - }; - - XMLStringWriter.prototype.closeNode = function(node, level) { - level || (level = 0); - switch (false) { - case !(node instanceof XMLElement): - return this.space(level) + '' + this.newline; - case !(node instanceof XMLDocType): - return this.space(level) + ']>' + this.newline; - } - }; - - return XMLStringWriter; - - })(XMLWriterBase); - -}).call(this); - - -/***/ }), - -/***/ 8594: -/***/ (function(module) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLStringifier, - bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - hasProp = {}.hasOwnProperty; - - module.exports = XMLStringifier = (function() { - function XMLStringifier(options) { - this.assertLegalChar = bind(this.assertLegalChar, this); - var key, ref, value; - options || (options = {}); - this.noDoubleEncoding = options.noDoubleEncoding; - ref = options.stringify || {}; - for (key in ref) { - if (!hasProp.call(ref, key)) continue; - value = ref[key]; - this[key] = value; - } - } - - XMLStringifier.prototype.eleName = function(val) { - val = '' + val || ''; - return this.assertLegalChar(val); - }; - - XMLStringifier.prototype.eleText = function(val) { - val = '' + val || ''; - return this.assertLegalChar(this.elEscape(val)); - }; - - XMLStringifier.prototype.cdata = function(val) { - val = '' + val || ''; - val = val.replace(']]>', ']]]]>'); - return this.assertLegalChar(val); - }; - - XMLStringifier.prototype.comment = function(val) { - val = '' + val || ''; - if (val.match(/--/)) { - throw new Error("Comment text cannot contain double-hypen: " + val); - } - return this.assertLegalChar(val); - }; - - XMLStringifier.prototype.raw = function(val) { - return '' + val || ''; - }; - - XMLStringifier.prototype.attName = function(val) { - return val = '' + val || ''; - }; - - XMLStringifier.prototype.attValue = function(val) { - val = '' + val || ''; - return this.attEscape(val); - }; - - XMLStringifier.prototype.insTarget = function(val) { - return '' + val || ''; - }; - - XMLStringifier.prototype.insValue = function(val) { - val = '' + val || ''; - if (val.match(/\?>/)) { - throw new Error("Invalid processing instruction value: " + val); - } - return val; - }; - - XMLStringifier.prototype.xmlVersion = function(val) { - val = '' + val || ''; - if (!val.match(/1\.[0-9]+/)) { - throw new Error("Invalid version number: " + val); - } - return val; - }; - - XMLStringifier.prototype.xmlEncoding = function(val) { - val = '' + val || ''; - if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) { - throw new Error("Invalid encoding: " + val); - } - return val; - }; - - XMLStringifier.prototype.xmlStandalone = function(val) { - if (val) { - return "yes"; - } else { - return "no"; - } - }; - - XMLStringifier.prototype.dtdPubID = function(val) { - return '' + val || ''; - }; - - XMLStringifier.prototype.dtdSysID = function(val) { - return '' + val || ''; - }; - - XMLStringifier.prototype.dtdElementValue = function(val) { - return '' + val || ''; - }; - - XMLStringifier.prototype.dtdAttType = function(val) { - return '' + val || ''; - }; - - XMLStringifier.prototype.dtdAttDefault = function(val) { - if (val != null) { - return '' + val || ''; - } else { - return val; - } - }; - - XMLStringifier.prototype.dtdEntityValue = function(val) { - return '' + val || ''; - }; - - XMLStringifier.prototype.dtdNData = function(val) { - return '' + val || ''; - }; - - XMLStringifier.prototype.convertAttKey = '@'; - - XMLStringifier.prototype.convertPIKey = '?'; - - XMLStringifier.prototype.convertTextKey = '#text'; - - XMLStringifier.prototype.convertCDataKey = '#cdata'; - - XMLStringifier.prototype.convertCommentKey = '#comment'; - - XMLStringifier.prototype.convertRawKey = '#raw'; - - XMLStringifier.prototype.assertLegalChar = function(str) { - var res; - res = str.match(/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/); - if (res) { - throw new Error("Invalid character in string: " + str + " at index " + res.index); - } - return str; - }; - - XMLStringifier.prototype.elEscape = function(str) { - var ampregex; - ampregex = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; - return str.replace(ampregex, '&').replace(//g, '>').replace(/\r/g, ' '); - }; - - XMLStringifier.prototype.attEscape = function(str) { - var ampregex; - ampregex = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; - return str.replace(ampregex, '&').replace(/ 0) { - return new Array(indent).join(this.indent); - } else { - return ''; - } - } else { - return ''; - } - }; + openAttribute(att, options, level) {} - return XMLWriterBase; + closeAttribute(att, options, level) {} - })(); + }; }).call(this); @@ -11215,11 +13694,13 @@ exports["default"] = _default; /***/ 2958: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { -// Generated by CoffeeScript 1.12.7 +// Generated by CoffeeScript 2.4.1 (function() { - var XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref; + var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction; - ref = __nccwpck_require__(8229), assign = ref.assign, isFunction = ref.isFunction; + ({assign, isFunction} = __nccwpck_require__(8229)); + + XMLDOMImplementation = __nccwpck_require__(8310); XMLDocument = __nccwpck_require__(3730); @@ -11229,27 +13710,86 @@ exports["default"] = _default; XMLStreamWriter = __nccwpck_require__(8601); + NodeType = __nccwpck_require__(9267); + + WriterState = __nccwpck_require__(9766); + + // Creates a new document and returns the root node for + // chain-building the document tree + + // `name` name of the root element + + // `xmldec.version` A version number string, e.g. 1.0 + // `xmldec.encoding` Encoding declaration, e.g. UTF-8 + // `xmldec.standalone` standalone document declaration: true or false + + // `doctype.pubID` public identifier of the external subset + // `doctype.sysID` system identifier of the external subset + + // `options.headless` whether XML declaration and doctype will be included: + // true or false + // `options.keepNullNodes` whether nodes with null values will be kept + // or ignored: true or false + // `options.keepNullAttributes` whether attributes with null values will be + // kept or ignored: true or false + // `options.ignoreDecorators` whether decorator strings will be ignored when + // converting JS objects: true or false + // `options.separateArrayItems` whether array items are created as separate + // nodes when passed as an object value: true or false + // `options.noDoubleEncoding` whether existing html entities are encoded: + // true or false + // `options.stringify` a set of functions to use for converting values to + // strings + // `options.writer` the default XML writer to use for converting nodes to + // string. If the default writer is not set, the built-in XMLStringWriter + // will be used instead. module.exports.create = function(name, xmldec, doctype, options) { var doc, root; if (name == null) { - throw new Error("Root element needs a name"); + throw new Error("Root element needs a name."); } options = assign({}, xmldec, doctype, options); + // create the document node doc = new XMLDocument(options); + // add the root node root = doc.element(name); + // prolog if (!options.headless) { doc.declaration(options); if ((options.pubID != null) || (options.sysID != null)) { - doc.doctype(options); + doc.dtd(options); } } return root; }; + // Creates a new document and returns the document node for + // chain-building the document tree + + // `options.keepNullNodes` whether nodes with null values will be kept + // or ignored: true or false + // `options.keepNullAttributes` whether attributes with null values will be + // kept or ignored: true or false + // `options.ignoreDecorators` whether decorator strings will be ignored when + // converting JS objects: true or false + // `options.separateArrayItems` whether array items are created as separate + // nodes when passed as an object value: true or false + // `options.noDoubleEncoding` whether existing html entities are encoded: + // true or false + // `options.stringify` a set of functions to use for converting values to + // strings + // `options.writer` the default XML writer to use for converting nodes to + // string. If the default writer is not set, the built-in XMLStringWriter + // will be used instead. + + // `onData` the function to be called when a new chunk of XML is output. The + // string containing the XML chunk is passed to `onData` as its single + // argument. + // `onEnd` the function to be called when the XML document is completed with + // `end`. `onEnd` does not receive any arguments. module.exports.begin = function(options, onData, onEnd) { - var ref1; if (isFunction(options)) { - ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1]; + [onData, onEnd] = [options, onData]; options = {}; } if (onData) { @@ -11267,6 +13807,12 @@ exports["default"] = _default; return new XMLStreamWriter(stream, options); }; + module.exports.implementation = new XMLDOMImplementation(); + + module.exports.nodeType = NodeType; + + module.exports.writerState = WriterState; + }).call(this); diff --git a/package-lock.json b/package-lock.json index 956c6b3..0776aba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,12 +10,12 @@ "license": "MIT", "dependencies": { "@actions/core": "^1.10.0", - "plist": "^3.0.4", + "plist": "^3.0.6", "semver": "^7.3.8" }, "devDependencies": { "@types/jest": "^27.4.0", - "@types/node": "^12.20.40", + "@types/node": "^16.11.68", "@types/plist": "^3.0.2", "@types/semver": "^7.3.12", "@typescript-eslint/eslint-plugin": "^5.40.1", @@ -1252,9 +1252,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "12.20.40", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.40.tgz", - "integrity": "sha512-RX6hFa0hxkFuktu5629zJEkWK5e0HreW4vpNSLn4nWkOui7CTGCjtKiKpvtZ4QwCZ2Am5uhrb5ULHKNyunYYqg==", + "version": "16.11.68", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.68.tgz", + "integrity": "sha512-JkRpuVz3xCNCWaeQ5EHLR/6woMbHZz/jZ7Kmc63AkU+1HxnoUugzSWMck7dsR4DvNYX8jp9wTi9K7WvnxOIQZQ==", "dev": true }, "node_modules/@types/plist": { @@ -1267,15 +1267,6 @@ "xmlbuilder": ">=11.0.1" } }, - "node_modules/@types/plist/node_modules/xmlbuilder": { - "version": "15.1.1", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", - "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", - "dev": true, - "engines": { - "node": ">=8.0" - } - }, "node_modules/@types/prettier": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.4.2.tgz", @@ -4470,12 +4461,12 @@ } }, "node_modules/plist": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz", - "integrity": "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.6.tgz", + "integrity": "sha512-WiIVYyrp8TD4w8yCvyeIr+lkmrGRd5u0VbRnU+tP/aRLxP/YadJUYOMZJ/6hIa3oUyVCsycXvtNRgd5XBJIbiA==", "dependencies": { "base64-js": "^1.5.1", - "xmlbuilder": "^9.0.7" + "xmlbuilder": "^15.1.1" }, "engines": { "node": ">=6" @@ -5190,11 +5181,11 @@ } }, "node_modules/xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", + "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", "engines": { - "node": ">=4.0" + "node": ">=8.0" } }, "node_modules/y18n": { @@ -6197,9 +6188,9 @@ "dev": true }, "@types/node": { - "version": "12.20.40", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.40.tgz", - "integrity": "sha512-RX6hFa0hxkFuktu5629zJEkWK5e0HreW4vpNSLn4nWkOui7CTGCjtKiKpvtZ4QwCZ2Am5uhrb5ULHKNyunYYqg==", + "version": "16.11.68", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.68.tgz", + "integrity": "sha512-JkRpuVz3xCNCWaeQ5EHLR/6woMbHZz/jZ7Kmc63AkU+1HxnoUugzSWMck7dsR4DvNYX8jp9wTi9K7WvnxOIQZQ==", "dev": true }, "@types/plist": { @@ -6210,14 +6201,6 @@ "requires": { "@types/node": "*", "xmlbuilder": ">=11.0.1" - }, - "dependencies": { - "xmlbuilder": { - "version": "15.1.1", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", - "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", - "dev": true - } } }, "@types/prettier": { @@ -8569,12 +8552,12 @@ } }, "plist": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz", - "integrity": "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.6.tgz", + "integrity": "sha512-WiIVYyrp8TD4w8yCvyeIr+lkmrGRd5u0VbRnU+tP/aRLxP/YadJUYOMZJ/6hIa3oUyVCsycXvtNRgd5XBJIbiA==", "requires": { "base64-js": "^1.5.1", - "xmlbuilder": "^9.0.7" + "xmlbuilder": "^15.1.1" } }, "prelude-ls": { @@ -9063,9 +9046,9 @@ } }, "xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", + "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==" }, "y18n": { "version": "5.0.8", diff --git a/package.json b/package.json index e668cb8..e56174e 100644 --- a/package.json +++ b/package.json @@ -24,12 +24,12 @@ "license": "MIT", "dependencies": { "@actions/core": "^1.10.0", - "plist": "^3.0.4", + "plist": "^3.0.6", "semver": "^7.3.8" }, "devDependencies": { "@types/jest": "^27.4.0", - "@types/node": "^12.20.40", + "@types/node": "^16.11.68", "@types/plist": "^3.0.2", "@types/semver": "^7.3.12", "@typescript-eslint/eslint-plugin": "^5.40.1",