nfewizard-io
Version:
NFeWizard-io é uma biblioteca Node.js projetada para simplificar a interação com os webservices da SEFAZ, proporcionando uma solução robusta para automação de processos relacionados à Nota Fiscal Eletrônica (NF-e).
1 lines • 1.69 MB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var require$$1=require("string_decoder"),require$$0$2=require("events"),require$$4=require("timers"),require$$0$3=require("crypto"),fs=require("fs"),xsdValidator=require("xsd-schema-validator"),path=require("path"),require$$0$4=require("url"),libxmljs=require("libxmljs"),require$$0$6=require("util"),require$$0$5=require("stream"),require$$3=require("http"),https=require("https"),require$$4$1=require("assert"),require$$1$1=require("tty"),require$$0$7=require("os"),zlib=require("zlib"),pem$1=require("pem"),require$$7=require("net"),require$$4$2=require("dns"),require$$1$2=require("tls"),require$$0$8=require("child_process"),bwipjs=require("bwip-js"),PDFDocument=require("pdfkit"),require$$3$1=require("buffer");function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var require$$1__default=_interopDefault(require$$1),require$$0__default=_interopDefault(require$$0$2),require$$4__default=_interopDefault(require$$4),require$$0__default$1=_interopDefault(require$$0$3),fs__default=_interopDefault(fs),xsdValidator__default=_interopDefault(xsdValidator),path__default=_interopDefault(path),require$$0__default$4=_interopDefault(require$$0$4),libxmljs__default=_interopDefault(libxmljs),require$$0__default$3=_interopDefault(require$$0$6),require$$0__default$2=_interopDefault(require$$0$5),require$$3__default=_interopDefault(require$$3),https__default=_interopDefault(https),require$$4__default$1=_interopDefault(require$$4$1),require$$1__default$1=_interopDefault(require$$1$1),require$$0__default$5=_interopDefault(require$$0$7),zlib__default=_interopDefault(zlib),pem__default=_interopDefault(pem$1),require$$7__default=_interopDefault(require$$7),require$$4__default$2=_interopDefault(require$$4$2),require$$1__default$2=_interopDefault(require$$1$2),require$$0__default$6=_interopDefault(require$$0$8),bwipjs__default=_interopDefault(bwipjs),PDFDocument__default=_interopDefault(PDFDocument),require$$3__default$1=_interopDefault(require$$3$1),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}var hasRequiredDefaults,xml2js$2={},defaults$2={};function requireDefaults(){return hasRequiredDefaults||(hasRequiredDefaults=1,function(){defaults$2.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(defaults$2)),defaults$2}var hasRequiredUtility,builder={},lib$5={},Utility$1={};function requireUtility(){return hasRequiredUtility||(hasRequiredUtility=1,function(){var assign,getValue,isArray,isEmpty,isFunction,isObject,isPlainObject,slice=[].slice,hasProp={}.hasOwnProperty;assign=function(){var i,key,len,source,sources,target;if(target=arguments[0],sources=2<=arguments.length?slice.call(arguments,1):[],isFunction(Object.assign))Object.assign.apply(null,arguments);else for(i=0,len=sources.length;i<len;i++)if(null!=(source=sources[i]))for(key in source)hasProp.call(source,key)&&(target[key]=source[key]);return target},isFunction=function(val){return!!val&&"[object Function]"===Object.prototype.toString.call(val)},isObject=function(val){var ref;return!!val&&("function"==(ref=typeof val)||"object"===ref)},isArray=function(val){return isFunction(Array.isArray)?Array.isArray(val):"[object Array]"===Object.prototype.toString.call(val)},isEmpty=function(val){var key;if(isArray(val))return!val.length;for(key in val)if(hasProp.call(val,key))return!1;return!0},isPlainObject=function(val){var ctor,proto;return isObject(val)&&(proto=Object.getPrototypeOf(val))&&(ctor=proto.constructor)&&"function"==typeof ctor&&ctor instanceof ctor&&Function.prototype.toString.call(ctor)===Function.prototype.toString.call(Object)},getValue=function(obj){return isFunction(obj.valueOf)?obj.valueOf():obj},Utility$1.assign=assign,Utility$1.isFunction=isFunction,Utility$1.isObject=isObject,Utility$1.isArray=isArray,Utility$1.isEmpty=isEmpty,Utility$1.isPlainObject=isPlainObject,Utility$1.getValue=getValue}.call(Utility$1)),Utility$1}var hasRequiredXMLDOMImplementation,XMLDOMImplementation$1={exports:{}},XMLDOMImplementation=XMLDOMImplementation$1.exports;function requireXMLDOMImplementation(){return hasRequiredXMLDOMImplementation||(hasRequiredXMLDOMImplementation=1,function(){XMLDOMImplementation$1.exports=function(){function XMLDOMImplementation(){}return XMLDOMImplementation.prototype.hasFeature=function(feature,version){return!0},XMLDOMImplementation.prototype.createDocumentType=function(qualifiedName,publicId,systemId){throw new Error("This DOM method is not implemented.")},XMLDOMImplementation.prototype.createDocument=function(namespaceURI,qualifiedName,doctype){throw new Error("This DOM method is not implemented.")},XMLDOMImplementation.prototype.createHTMLDocument=function(title){throw new Error("This DOM method is not implemented.")},XMLDOMImplementation.prototype.getFeature=function(feature,version){throw new Error("This DOM method is not implemented.")},XMLDOMImplementation}()}.call(XMLDOMImplementation)),XMLDOMImplementation$1.exports}var hasRequiredXMLDOMErrorHandler,XMLDocument$1={exports:{}},XMLDOMConfiguration$1={exports:{}},XMLDOMErrorHandler$1={exports:{}},XMLDOMErrorHandler=XMLDOMErrorHandler$1.exports;function requireXMLDOMErrorHandler(){return hasRequiredXMLDOMErrorHandler||(hasRequiredXMLDOMErrorHandler=1,function(){XMLDOMErrorHandler$1.exports=function(){function XMLDOMErrorHandler(){}return XMLDOMErrorHandler.prototype.handleError=function(error){throw new Error(error)},XMLDOMErrorHandler}()}.call(XMLDOMErrorHandler)),XMLDOMErrorHandler$1.exports}var hasRequiredXMLDOMStringList,XMLDOMStringList$1={exports:{}},XMLDOMStringList=XMLDOMStringList$1.exports;function requireXMLDOMStringList(){return hasRequiredXMLDOMStringList||(hasRequiredXMLDOMStringList=1,function(){XMLDOMStringList$1.exports=function(){function XMLDOMStringList(arr){this.arr=arr||[]}return Object.defineProperty(XMLDOMStringList.prototype,"length",{get:function(){return this.arr.length}}),XMLDOMStringList.prototype.item=function(index){return this.arr[index]||null},XMLDOMStringList.prototype.contains=function(str){return-1!==this.arr.indexOf(str)},XMLDOMStringList}()}.call(XMLDOMStringList)),XMLDOMStringList$1.exports}var hasRequiredXMLDOMConfiguration,XMLDOMConfiguration=XMLDOMConfiguration$1.exports;function requireXMLDOMConfiguration(){return hasRequiredXMLDOMConfiguration||(hasRequiredXMLDOMConfiguration=1,function(){var XMLDOMErrorHandler,XMLDOMStringList;XMLDOMErrorHandler=requireXMLDOMErrorHandler(),XMLDOMStringList=requireXMLDOMStringList(),XMLDOMConfiguration$1.exports=function(){function XMLDOMConfiguration(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new XMLDOMErrorHandler,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(XMLDOMConfiguration.prototype,"parameterNames",{get:function(){return new XMLDOMStringList(Object.keys(this.defaultParams))}}),XMLDOMConfiguration.prototype.getParameter=function(name){return this.params.hasOwnProperty(name)?this.params[name]:null},XMLDOMConfiguration.prototype.canSetParameter=function(name,value){return!0},XMLDOMConfiguration.prototype.setParameter=function(name,value){return null!=value?this.params[name]=value:delete this.params[name]},XMLDOMConfiguration}()}.call(XMLDOMConfiguration)),XMLDOMConfiguration$1.exports}var hasRequiredNodeType,XMLNode$1={exports:{}},XMLElement$1={exports:{}},NodeType$1={exports:{}},NodeType=NodeType$1.exports;function requireNodeType(){return hasRequiredNodeType||(hasRequiredNodeType=1,function(){NodeType$1.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,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}.call(NodeType)),NodeType$1.exports}var hasRequiredXMLAttribute,XMLAttribute$1={exports:{}},XMLAttribute=XMLAttribute$1.exports;function requireXMLAttribute(){return hasRequiredXMLAttribute||(hasRequiredXMLAttribute=1,function(){var NodeType;NodeType=requireNodeType(),requireXMLNode(),XMLAttribute$1.exports=function(){function XMLAttribute(parent,name,value){if(this.parent=parent,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),null==name)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,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(XMLAttribute.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(XMLAttribute.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(XMLAttribute.prototype,"textContent",{get:function(){return this.value},set:function(value){return this.value=value||""}}),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!0}}),XMLAttribute.prototype.clone=function(){return Object.create(this)},XMLAttribute.prototype.toString=function(options){return this.options.writer.attribute(this,this.options.writer.filterOptions(options))},XMLAttribute.prototype.debugInfo=function(name){return null==(name=name||this.name)?"parent: <"+this.parent.name+">":"attribute: {"+name+"}, parent: <"+this.parent.name+">"},XMLAttribute.prototype.isEqualNode=function(node){return node.namespaceURI===this.namespaceURI&&(node.prefix===this.prefix&&(node.localName===this.localName&&node.value===this.value))},XMLAttribute}()}.call(XMLAttribute)),XMLAttribute$1.exports}var hasRequiredXMLNamedNodeMap,XMLNamedNodeMap$1={exports:{}},XMLNamedNodeMap=XMLNamedNodeMap$1.exports;function requireXMLNamedNodeMap(){return hasRequiredXMLNamedNodeMap||(hasRequiredXMLNamedNodeMap=1,function(){XMLNamedNodeMap$1.exports=function(){function XMLNamedNodeMap(nodes){this.nodes=nodes}return Object.defineProperty(XMLNamedNodeMap.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),XMLNamedNodeMap.prototype.clone=function(){return this.nodes=null},XMLNamedNodeMap.prototype.getNamedItem=function(name){return this.nodes[name]},XMLNamedNodeMap.prototype.setNamedItem=function(node){var oldNode;return oldNode=this.nodes[node.nodeName],this.nodes[node.nodeName]=node,oldNode||null},XMLNamedNodeMap.prototype.removeNamedItem=function(name){var oldNode;return oldNode=this.nodes[name],delete this.nodes[name],oldNode||null},XMLNamedNodeMap.prototype.item=function(index){return this.nodes[Object.keys(this.nodes)[index]]||null},XMLNamedNodeMap.prototype.getNamedItemNS=function(namespaceURI,localName){throw new Error("This DOM method is not implemented.")},XMLNamedNodeMap.prototype.setNamedItemNS=function(node){throw new Error("This DOM method is not implemented.")},XMLNamedNodeMap.prototype.removeNamedItemNS=function(namespaceURI,localName){throw new Error("This DOM method is not implemented.")},XMLNamedNodeMap}()}.call(XMLNamedNodeMap)),XMLNamedNodeMap$1.exports}var hasRequiredXMLElement,XMLElement=XMLElement$1.exports;function requireXMLElement(){return hasRequiredXMLElement||(hasRequiredXMLElement=1,function(){var NodeType,XMLAttribute,XMLNamedNodeMap,XMLNode,getValue,isFunction,isObject,ref,hasProp={}.hasOwnProperty;ref=requireUtility(),isObject=ref.isObject,isFunction=ref.isFunction,getValue=ref.getValue,XMLNode=requireXMLNode(),NodeType=requireNodeType(),XMLAttribute=requireXMLAttribute(),XMLNamedNodeMap=requireXMLNamedNodeMap(),XMLElement$1.exports=function(superClass){function XMLElement(parent,name,attributes){var child,j,len,ref1;if(XMLElement.__super__.constructor.call(this,parent),null==name)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(name),this.type=NodeType.Element,this.attribs={},this.schemaTypeInfo=null,null!=attributes&&this.attribute(attributes),parent.type===NodeType.Document&&(this.isRoot=!0,this.documentObject=parent,parent.rootObject=this,parent.children))for(j=0,len=(ref1=parent.children).length;j<len;j++)if((child=ref1[j]).type===NodeType.DocType){child.name=this.name;break}}return function(child,parent){for(var key in parent)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}(XMLElement,superClass),Object.defineProperty(XMLElement.prototype,"tagName",{get:function(){return this.name}}),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(){return this.attributeMap&&this.attributeMap.nodes||(this.attributeMap=new XMLNamedNodeMap(this.attribs)),this.attributeMap}}),XMLElement.prototype.clone=function(){var att,attName,clonedSelf,ref1;for(attName in(clonedSelf=Object.create(this)).isRoot&&(clonedSelf.documentObject=null),clonedSelf.attribs={},ref1=this.attribs)hasProp.call(ref1,attName)&&(att=ref1[attName],clonedSelf.attribs[attName]=att.clone());return clonedSelf.children=[],this.children.forEach((function(child){var clonedChild;return(clonedChild=child.clone()).parent=clonedSelf,clonedSelf.children.push(clonedChild)})),clonedSelf},XMLElement.prototype.attribute=function(name,value){var attName,attValue;if(null!=name&&(name=getValue(name)),isObject(name))for(attName in name)hasProp.call(name,attName)&&(attValue=name[attName],this.attribute(attName,attValue));else isFunction(value)&&(value=value.apply()),this.options.keepNullAttributes&&null==value?this.attribs[name]=new XMLAttribute(this,name,""):null!=value&&(this.attribs[name]=new XMLAttribute(this,name,value));return this},XMLElement.prototype.removeAttribute=function(name){var attName,j,len;if(null==name)throw new Error("Missing attribute name. "+this.debugInfo());if(name=getValue(name),Array.isArray(name))for(j=0,len=name.length;j<len;j++)attName=name[j],delete this.attribs[attName];else delete this.attribs[name];return this},XMLElement.prototype.toString=function(options){return this.options.writer.element(this,this.options.writer.filterOptions(options))},XMLElement.prototype.att=function(name,value){return this.attribute(name,value)},XMLElement.prototype.a=function(name,value){return this.attribute(name,value)},XMLElement.prototype.getAttribute=function(name){return this.attribs.hasOwnProperty(name)?this.attribs[name].value:null},XMLElement.prototype.setAttribute=function(name,value){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.getAttributeNode=function(name){return this.attribs.hasOwnProperty(name)?this.attribs[name]:null},XMLElement.prototype.setAttributeNode=function(newAttr){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.removeAttributeNode=function(oldAttr){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.getElementsByTagName=function(name){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.getAttributeNS=function(namespaceURI,localName){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.setAttributeNS=function(namespaceURI,qualifiedName,value){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.removeAttributeNS=function(namespaceURI,localName){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.getAttributeNodeNS=function(namespaceURI,localName){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.setAttributeNodeNS=function(newAttr){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.getElementsByTagNameNS=function(namespaceURI,localName){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.hasAttribute=function(name){return this.attribs.hasOwnProperty(name)},XMLElement.prototype.hasAttributeNS=function(namespaceURI,localName){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.setIdAttribute=function(name,isId){return this.attribs.hasOwnProperty(name)?this.attribs[name].isId:isId},XMLElement.prototype.setIdAttributeNS=function(namespaceURI,localName,isId){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.setIdAttributeNode=function(idAttr,isId){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.getElementsByTagName=function(tagname){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.getElementsByTagNameNS=function(namespaceURI,localName){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.getElementsByClassName=function(classNames){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLElement.prototype.isEqualNode=function(node){var i,j,ref1;if(!XMLElement.__super__.isEqualNode.apply(this,arguments).isEqualNode(node))return!1;if(node.namespaceURI!==this.namespaceURI)return!1;if(node.prefix!==this.prefix)return!1;if(node.localName!==this.localName)return!1;if(node.attribs.length!==this.attribs.length)return!1;for(i=j=0,ref1=this.attribs.length-1;0<=ref1?j<=ref1:j>=ref1;i=0<=ref1?++j:--j)if(!this.attribs[i].isEqualNode(node.attribs[i]))return!1;return!0},XMLElement}(XMLNode)}.call(XMLElement)),XMLElement$1.exports}var hasRequiredXMLCharacterData,XMLCData$1={exports:{}},XMLCharacterData$1={exports:{}},XMLCharacterData=XMLCharacterData$1.exports;function requireXMLCharacterData(){return hasRequiredXMLCharacterData||(hasRequiredXMLCharacterData=1,function(){var XMLNode,hasProp={}.hasOwnProperty;XMLNode=requireXMLNode(),XMLCharacterData$1.exports=function(superClass){function XMLCharacterData(parent){XMLCharacterData.__super__.constructor.call(this,parent),this.value=""}return function(child,parent){for(var key in parent)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}(XMLCharacterData,superClass),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}}),Object.defineProperty(XMLCharacterData.prototype,"textContent",{get:function(){return this.value},set:function(value){return this.value=value||""}}),XMLCharacterData.prototype.clone=function(){return Object.create(this)},XMLCharacterData.prototype.substringData=function(offset,count){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLCharacterData.prototype.appendData=function(arg){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLCharacterData.prototype.insertData=function(offset,arg){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLCharacterData.prototype.deleteData=function(offset,count){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLCharacterData.prototype.replaceData=function(offset,count,arg){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLCharacterData.prototype.isEqualNode=function(node){return!!XMLCharacterData.__super__.isEqualNode.apply(this,arguments).isEqualNode(node)&&node.data===this.data},XMLCharacterData}(XMLNode)}.call(XMLCharacterData)),XMLCharacterData$1.exports}var hasRequiredXMLCData,XMLCData=XMLCData$1.exports;function requireXMLCData(){return hasRequiredXMLCData||(hasRequiredXMLCData=1,function(){var NodeType,XMLCharacterData,hasProp={}.hasOwnProperty;NodeType=requireNodeType(),XMLCharacterData=requireXMLCharacterData(),XMLCData$1.exports=function(superClass){function XMLCData(parent,text){if(XMLCData.__super__.constructor.call(this,parent),null==text)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=NodeType.CData,this.value=this.stringify.cdata(text)}return function(child,parent){for(var key in parent)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}(XMLCData,superClass),XMLCData.prototype.clone=function(){return Object.create(this)},XMLCData.prototype.toString=function(options){return this.options.writer.cdata(this,this.options.writer.filterOptions(options))},XMLCData}(XMLCharacterData)}.call(XMLCData)),XMLCData$1.exports}var hasRequiredXMLComment,XMLComment$1={exports:{}},XMLComment=XMLComment$1.exports;function requireXMLComment(){return hasRequiredXMLComment||(hasRequiredXMLComment=1,function(){var NodeType,XMLCharacterData,hasProp={}.hasOwnProperty;NodeType=requireNodeType(),XMLCharacterData=requireXMLCharacterData(),XMLComment$1.exports=function(superClass){function XMLComment(parent,text){if(XMLComment.__super__.constructor.call(this,parent),null==text)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=NodeType.Comment,this.value=this.stringify.comment(text)}return function(child,parent){for(var key in parent)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}(XMLComment,superClass),XMLComment.prototype.clone=function(){return Object.create(this)},XMLComment.prototype.toString=function(options){return this.options.writer.comment(this,this.options.writer.filterOptions(options))},XMLComment}(XMLCharacterData)}.call(XMLComment)),XMLComment$1.exports}var hasRequiredXMLDeclaration,XMLDeclaration$1={exports:{}},XMLDeclaration=XMLDeclaration$1.exports;function requireXMLDeclaration(){return hasRequiredXMLDeclaration||(hasRequiredXMLDeclaration=1,function(){var NodeType,XMLNode,isObject,hasProp={}.hasOwnProperty;isObject=requireUtility().isObject,XMLNode=requireXMLNode(),NodeType=requireNodeType(),XMLDeclaration$1.exports=function(superClass){function XMLDeclaration(parent,version,encoding,standalone){var ref;XMLDeclaration.__super__.constructor.call(this,parent),isObject(version)&&(version=(ref=version).version,encoding=ref.encoding,standalone=ref.standalone),version||(version="1.0"),this.type=NodeType.Declaration,this.version=this.stringify.xmlVersion(version),null!=encoding&&(this.encoding=this.stringify.xmlEncoding(encoding)),null!=standalone&&(this.standalone=this.stringify.xmlStandalone(standalone))}return function(child,parent){for(var key in parent)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}(XMLDeclaration,superClass),XMLDeclaration.prototype.toString=function(options){return this.options.writer.declaration(this,this.options.writer.filterOptions(options))},XMLDeclaration}(XMLNode)}.call(XMLDeclaration)),XMLDeclaration$1.exports}var hasRequiredXMLDTDAttList,XMLDocType$1={exports:{}},XMLDTDAttList$1={exports:{}},XMLDTDAttList=XMLDTDAttList$1.exports;function requireXMLDTDAttList(){return hasRequiredXMLDTDAttList||(hasRequiredXMLDTDAttList=1,function(){var NodeType,XMLNode,hasProp={}.hasOwnProperty;XMLNode=requireXMLNode(),NodeType=requireNodeType(),XMLDTDAttList$1.exports=function(superClass){function XMLDTDAttList(parent,elementName,attributeName,attributeType,defaultValueType,defaultValue){if(XMLDTDAttList.__super__.constructor.call(this,parent),null==elementName)throw new Error("Missing DTD element name. "+this.debugInfo());if(null==attributeName)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(0!==defaultValueType.indexOf("#")&&(defaultValueType="#"+defaultValueType),!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),defaultValue&&(this.defaultValue=this.stringify.dtdAttDefault(defaultValue)),this.defaultValueType=defaultValueType}return function(child,parent){for(var key in parent)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}(XMLDTDAttList,superClass),XMLDTDAttList.prototype.toString=function(options){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(options))},XMLDTDAttList}(XMLNode)}.call(XMLDTDAttList)),XMLDTDAttList$1.exports}var hasRequiredXMLDTDEntity,XMLDTDEntity$1={exports:{}},XMLDTDEntity=XMLDTDEntity$1.exports;function requireXMLDTDEntity(){return hasRequiredXMLDTDEntity||(hasRequiredXMLDTDEntity=1,function(){var NodeType,XMLNode,isObject,hasProp={}.hasOwnProperty;isObject=requireUtility().isObject,XMLNode=requireXMLNode(),NodeType=requireNodeType(),XMLDTDEntity$1.exports=function(superClass){function XMLDTDEntity(parent,pe,name,value){if(XMLDTDEntity.__super__.constructor.call(this,parent),null==name)throw new Error("Missing DTD entity name. "+this.debugInfo(name));if(null==value)throw new Error("Missing DTD entity value. "+this.debugInfo(name));if(this.pe=!!pe,this.name=this.stringify.name(name),this.type=NodeType.EntityDeclaration,isObject(value)){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));if(this.internal=!1,null!=value.pubID&&(this.pubID=this.stringify.dtdPubID(value.pubID)),null!=value.sysID&&(this.sysID=this.stringify.dtdSysID(value.sysID)),null!=value.nData&&(this.nData=this.stringify.dtdNData(value.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(name))}else this.value=this.stringify.dtdEntityValue(value),this.internal=!0}return function(child,parent){for(var key in parent)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}(XMLDTDEntity,superClass),Object.defineProperty(XMLDTDEntity.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(XMLDTDEntity.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(XMLDTDEntity.prototype,"notationName",{get:function(){return this.nData||null}}),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}}),XMLDTDEntity.prototype.toString=function(options){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(options))},XMLDTDEntity}(XMLNode)}.call(XMLDTDEntity)),XMLDTDEntity$1.exports}var hasRequiredXMLDTDElement,XMLDTDElement$1={exports:{}},XMLDTDElement=XMLDTDElement$1.exports;function requireXMLDTDElement(){return hasRequiredXMLDTDElement||(hasRequiredXMLDTDElement=1,function(){var NodeType,XMLNode,hasProp={}.hasOwnProperty;XMLNode=requireXMLNode(),NodeType=requireNodeType(),XMLDTDElement$1.exports=function(superClass){function XMLDTDElement(parent,name,value){if(XMLDTDElement.__super__.constructor.call(this,parent),null==name)throw new Error("Missing DTD element name. "+this.debugInfo());value||(value="(#PCDATA)"),Array.isArray(value)&&(value="("+value.join(",")+")"),this.name=this.stringify.name(name),this.type=NodeType.ElementDeclaration,this.value=this.stringify.dtdElementValue(value)}return function(child,parent){for(var key in parent)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}(XMLDTDElement,superClass),XMLDTDElement.prototype.toString=function(options){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(options))},XMLDTDElement}(XMLNode)}.call(XMLDTDElement)),XMLDTDElement$1.exports}var hasRequiredXMLDTDNotation,XMLDTDNotation$1={exports:{}},XMLDTDNotation=XMLDTDNotation$1.exports;function requireXMLDTDNotation(){return hasRequiredXMLDTDNotation||(hasRequiredXMLDTDNotation=1,function(){var NodeType,XMLNode,hasProp={}.hasOwnProperty;XMLNode=requireXMLNode(),NodeType=requireNodeType(),XMLDTDNotation$1.exports=function(superClass){function XMLDTDNotation(parent,name,value){if(XMLDTDNotation.__super__.constructor.call(this,parent),null==name)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,null!=value.pubID&&(this.pubID=this.stringify.dtdPubID(value.pubID)),null!=value.sysID&&(this.sysID=this.stringify.dtdSysID(value.sysID))}return function(child,parent){for(var key in parent)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}(XMLDTDNotation,superClass),Object.defineProperty(XMLDTDNotation.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(XMLDTDNotation.prototype,"systemId",{get:function(){return this.sysID}}),XMLDTDNotation.prototype.toString=function(options){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(options))},XMLDTDNotation}(XMLNode)}.call(XMLDTDNotation)),XMLDTDNotation$1.exports}var hasRequiredXMLDocType,XMLDocType=XMLDocType$1.exports;function requireXMLDocType(){return hasRequiredXMLDocType||(hasRequiredXMLDocType=1,function(){var NodeType,XMLDTDAttList,XMLDTDElement,XMLDTDEntity,XMLDTDNotation,XMLNamedNodeMap,XMLNode,isObject,hasProp={}.hasOwnProperty;isObject=requireUtility().isObject,XMLNode=requireXMLNode(),NodeType=requireNodeType(),XMLDTDAttList=requireXMLDTDAttList(),XMLDTDEntity=requireXMLDTDEntity(),XMLDTDElement=requireXMLDTDElement(),XMLDTDNotation=requireXMLDTDNotation(),XMLNamedNodeMap=requireXMLNamedNodeMap(),XMLDocType$1.exports=function(superClass){function XMLDocType(parent,pubID,sysID){var child,i,len,ref,ref1,ref2;if(XMLDocType.__super__.constructor.call(this,parent),this.type=NodeType.DocType,parent.children)for(i=0,len=(ref=parent.children).length;i<len;i++)if((child=ref[i]).type===NodeType.Element){this.name=child.name;break}this.documentObject=parent,isObject(pubID)&&(pubID=(ref1=pubID).pubID,sysID=ref1.sysID),null==sysID&&(sysID=(ref2=[pubID,sysID])[0],pubID=ref2[1]),null!=pubID&&(this.pubID=this.stringify.dtdPubID(pubID)),null!=sysID&&(this.sysID=this.stringify.dtdSysID(sysID))}return function(child,parent){for(var key in parent)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}(XMLDocType,superClass),Object.defineProperty(XMLDocType.prototype,"entities",{get:function(){var child,i,len,nodes,ref;for(nodes={},i=0,len=(ref=this.children).length;i<len;i++)(child=ref[i]).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;for(nodes={},i=0,len=(ref=this.children).length;i<len;i++)(child=ref[i]).type===NodeType.NotationDeclaration&&(nodes[child.name]=child);return new XMLNamedNodeMap(nodes)}}),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())}}),XMLDocType.prototype.element=function(name,value){var child;return child=new XMLDTDElement(this,name,value),this.children.push(child),this},XMLDocType.prototype.attList=function(elementName,attributeName,attributeType,defaultValueType,defaultValue){var child;return child=new XMLDTDAttList(this,elementName,attributeName,attributeType,defaultValueType,defaultValue),this.children.push(child),this},XMLDocType.prototype.entity=function(name,value){var child;return child=new XMLDTDEntity(this,!1,name,value),this.children.push(child),this},XMLDocType.prototype.pEntity=function(name,value){var child;return child=new XMLDTDEntity(this,!0,name,value),this.children.push(child),this},XMLDocType.prototype.notation=function(name,value){var child;return child=new XMLDTDNotation(this,name,value),this.children.push(child),this},XMLDocType.prototype.toString=function(options){return this.options.writer.docType(this,this.options.writer.filterOptions(options))},XMLDocType.prototype.ele=function(name,value){return this.element(name,value)},XMLDocType.prototype.att=function(elementName,attributeName,attributeType,defaultValueType,defaultValue){return this.attList(elementName,attributeName,attributeType,defaultValueType,defaultValue)},XMLDocType.prototype.ent=function(name,value){return this.entity(name,value)},XMLDocType.prototype.pent=function(name,value){return this.pEntity(name,value)},XMLDocType.prototype.not=function(name,value){return this.notation(name,value)},XMLDocType.prototype.up=function(){return this.root()||this.documentObject},XMLDocType.prototype.isEqualNode=function(node){return!!XMLDocType.__super__.isEqualNode.apply(this,arguments).isEqualNode(node)&&(node.name===this.name&&(node.publicId===this.publicId&&node.systemId===this.systemId))},XMLDocType}(XMLNode)}.call(XMLDocType)),XMLDocType$1.exports}var hasRequiredXMLRaw,XMLRaw$1={exports:{}},XMLRaw=XMLRaw$1.exports;function requireXMLRaw(){return hasRequiredXMLRaw||(hasRequiredXMLRaw=1,function(){var NodeType,XMLNode,hasProp={}.hasOwnProperty;NodeType=requireNodeType(),XMLNode=requireXMLNode(),XMLRaw$1.exports=function(superClass){function XMLRaw(parent,text){if(XMLRaw.__super__.constructor.call(this,parent),null==text)throw new Error("Missing raw text. "+this.debugInfo());this.type=NodeType.Raw,this.value=this.stringify.raw(text)}return function(child,parent){for(var key in parent)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}(XMLRaw,superClass),XMLRaw.prototype.clone=function(){return Object.create(this)},XMLRaw.prototype.toString=function(options){return this.options.writer.raw(this,this.options.writer.filterOptions(options))},XMLRaw}(XMLNode)}.call(XMLRaw)),XMLRaw$1.exports}var hasRequiredXMLText,XMLText$1={exports:{}},XMLText=XMLText$1.exports;function requireXMLText(){return hasRequiredXMLText||(hasRequiredXMLText=1,function(){var NodeType,XMLCharacterData,hasProp={}.hasOwnProperty;NodeType=requireNodeType(),XMLCharacterData=requireXMLCharacterData(),XMLText$1.exports=function(superClass){function XMLText(parent,text){if(XMLText.__super__.constructor.call(this,parent),null==text)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=NodeType.Text,this.value=this.stringify.text(text)}return function(child,parent){for(var key in parent)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}(XMLText,superClass),Object.defineProperty(XMLText.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(XMLText.prototype,"wholeText",{get:function(){var next,prev,str;for(str="",prev=this.previousSibling;prev;)str=prev.data+str,prev=prev.previousSibling;for(str+=this.data,next=this.nextSibling;next;)str+=next.data,next=next.nextSibling;return str}}),XMLText.prototype.clone=function(){return Object.create(this)},XMLText.prototype.toString=function(options){return this.options.writer.text(this,this.options.writer.filterOptions(options))},XMLText.prototype.splitText=function(offset){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLText.prototype.replaceWholeText=function(content){throw new Error("This DOM method is not implemented."+this.debugInfo())},XMLText}(XMLCharacterData)}.call(XMLText)),XMLText$1.exports}var hasRequiredXMLProcessingInstruction,XMLProcessingInstruction$1={exports:{}},XMLProcessingInstruction=XMLProcessingInstruction$1.exports;function requireXMLProcessingInstruction(){return hasRequiredXMLProcessingInstruction||(hasRequiredXMLProcessingInstruction=1,function(){var NodeType,XMLCharacterData,hasProp={}.hasOwnProperty;NodeType=requireNodeType(),XMLCharacterData=requireXMLCharacterData(),XMLProcessingInstruction$1.exports=function(superClass){function XMLProcessingInstruction(parent,target,value){if(XMLProcessingInstruction.__super__.constructor.call(this,parent),null==target)throw new Error("Missing instruction target. "+this.debugInfo());this.type=NodeType.ProcessingInstruction,this.target=this.stringify.insTarget(target),this.name=this.target,value&&(this.value=this.stringify.insValue(value))}return function(child,parent){for(var key in parent)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}(XMLProcessingInstruction,superClass),XMLProcessingInstruction.prototype.clone=function(){return Object.create(this)},XMLProcessingInstruction.prototype.toString=function(options){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(options))},XMLProcessingInstruction.prototype.isEqualNode=function(node){return!!XMLProcessingInstruction.__super__.isEqualNode.apply(this,arguments).isEqualNode(node)&&node.target===this.target},XMLProcessingInstruction}(XMLCharacterData)}.call(XMLProcessingInstruction)),XMLProcessingInstruction$1.exports}var hasRequiredXMLDummy,XMLDummy$1={exports:{}},XMLDummy=XMLDummy$1.exports;function requireXMLDummy(){return hasRequiredXMLDummy||(hasRequiredXMLDummy=1,function(){var NodeType,XMLNode,hasProp={}.hasOwnProperty;XMLNode=requireXMLNode(),NodeType=requireNodeType(),XMLDummy$1.exports=function(superClass){function XMLDummy(parent){XMLDummy.__super__.constructor.call(this,parent),this.type=NodeType.Dummy}return function(child,parent){for(var key in parent)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}(XMLDummy,superClass),XMLDummy.prototype.clone=function(){return Object.create(this)},XMLDummy.prototype.toString=function(options){return""},XMLDummy}(XMLNode)}.call(XMLDummy)),XMLDummy$1.exports}var hasRequiredXMLNodeList,XMLNodeList$1={exports:{}},XMLNodeList=XMLNodeList$1.exports;function requireXMLNodeList(){return hasRequiredXMLNodeList||(hasRequiredXMLNodeList=1,function(){XMLNodeList$1.exports=function(){function XMLNodeList(nodes){this.nodes=nodes}return Object.defineProperty(XMLNodeList.prototype,"length",{get:function(){return this.nodes.length||0}}),XMLNodeList.prototype.clone=function(){return this.nodes=null},XMLNodeList.prototype.item=function(index){return this.nodes[index]||null},XMLNodeList}()}.call(XMLNodeList)),XMLNodeList$1.exports}var hasRequiredDocumentPosition,DocumentPosition$1={exports:{}},DocumentPosition=DocumentPosition$1.exports;function requireDocumentPosition(){return hasRequiredDocumentPosition||(hasRequiredDocumentPosition=1,function(){DocumentPosition$1.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(DocumentPosition)),DocumentPosition$1.exports}var hasRequiredXMLNode,XMLNode=XMLNode$1.exports;function requireXMLNode(){return hasRequiredXMLNode||(hasRequiredXMLNode=1,function(){var DocumentPosition,NodeType,XMLCData,XMLComment,XMLDeclaration,XMLDocType,XMLDummy,XMLElement,XMLNodeList,XMLProcessingInstruction,XMLRaw,XMLText,getValue,isEmpty,isFunction,isObject,ref1,hasProp={}.hasOwnProperty;ref1=requireUtility(),isObject=ref1.isObject,isFunction=ref1.isFunction,isEmpty=ref1.isEmpty,getValue=ref1.getValue,XMLElement=null,XMLCData=null,XMLComment=null,XMLDeclaration=null,XMLDocType=null,XMLRaw=null,XMLText=null,XMLProcessingInstruction=null,XMLDummy=null,NodeType=null,XMLNodeList=null,DocumentPosition=null,XMLNode$1.exports=function(){function XMLNode(parent1){this.parent=parent1,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,XMLElement||(XMLElement=requireXMLElement(),XMLCData=requireXMLCData(),XMLComment=requireXMLComment(),XMLDeclaration=requireXMLDeclaration(),XMLDocType=requireXMLDocType(),XMLRaw=requireXMLRaw(),XMLText=requireXMLText(),XMLProcessingInstruction=requireXMLProcessingInstruction(),XMLDummy=requireXMLDummy(),NodeType=requireNodeType(),XMLNodeList=requireXMLNodeList(),requireXMLNamedNodeMap(),DocumentPosition=requireDocumentPosition())}return Object.defineProperty(XMLNode.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(XMLNode.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(XMLNode.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(XMLNode.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(XMLNode.prototype,"childNodes",{get:function(){return this.childNodeList&&this.childNodeList.nodes||(this.childNodeList=new XMLNodeList(this.children)),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;return i=this.parent.children.indexOf(this),this.parent.children[i-1]||null}}),Object.defineProperty(XMLNode.prototype,"nextSibling",{get:function(){var i;return i=this.parent.children.indexOf(this),this.parent.children[i+1]||null}}),Object.defineProperty(XMLNode.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(XMLNode.prototype,"textContent",{get:function(){var child,j,len,ref2,str;if(this.nodeType===NodeType.Element||this.nodeType===NodeType.DocumentFragment){for(str="",j=0,len=(ref2=this.children).length;j<len;j++)(child=ref2[j]).textContent&&(str+=child.textContent);return str}return null},set:function(value){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),XMLNode.prototype.setParent=function(parent){var child,j,len,ref2,results;for(this.parent=parent,parent&&(this.options=parent.options,this.stringify=parent.stringify),results=[],j=0,len=(ref2=this.children).length;j<len;j++)child=ref2[j],results.push(child.setParent(this));return results},XMLNode.prototype.element=function(name,attributes,text){var childNode,item,j,k,key,lastChild,len,len1,ref2,ref3,val;if(lastChild=null,null===attributes&&null==text&&(attributes=(ref2=[{},null])[0],text=ref2[1]),null==attributes&&(attributes={}),attributes=getValue(attributes),isObject(attributes)||(text=(ref3=[attributes,text])[0],attributes=ref3[1]),null!=name&&(name=getValue(name)),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))if(val=name[key],isFunction(val)&&(val=val.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&0===key.indexOf(this.stringify.convertAttKey))lastChild=this.attribute(key.substr(this.stringify.convertAttKey.length),val);else if(!this.options.separateArrayItems&&Array.isArray(val)&&isEmpty(val))lastChild=this.dummy();else if(isObject(val)&&isEmpty(val))lastChild=this.element(key);else if(this.options.keepNullNodes||null!=val)if(!this.options.separateArrayItems&&Array.isArray(val))for(k=0,len1=val.length;k<len1;k++)item=val[k],(childNode={})[key]=item,lastChild=this.element(childNode);else isObject(val)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&0===key.indexOf(this.stringify.convertTextKey)?lastChild=this.element(val):(lastChild=this.element(key)).element(val):lastChild=this.element(key,val);else lastChild=this.dummy()}else lastChild=this.options.keepNullNodes||null!==text?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&0===name.indexOf(this.stringify.convertTextKey)?this.text(text):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&0===name.indexOf(this.stringify.convertCDataKey)?this.cdata(text):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&0===name.indexOf(this.stringify.convertCommentKey)?this.comment(text):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&0===name.indexOf(this.stringify.convertRawKey)?this.raw(text):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&0===name.indexOf(this.stringify.convertPIKey)?this.instruction(name.substr(this.stringify.convertPIKey.length),text):this.node(name,attributes,text):this.dummy();if(null==lastChild)throw new Error("Could not create any elements with: "+name+". "+this.debugInfo());return lastChild},XMLNode.prototype.insertBefore=function(name,attributes,text){var child,i,newChild,refChild,removed;if(null!=name?name.type:void 0)return refChild=attributes,(newChild=name).setParent(this),refChild?(i=children.indexOf(refChild),removed=children.splice(i),children.push(newChild),Array.prototype.push.apply(children,removed)):children.push(newChild),newChild;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(name));return 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),child},XMLNode.prototype.insertAfter=function(name,attributes,text){var child,i,removed;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(name));return 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),child},XMLNode.prototype.remove=function(){var i;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return i=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[i,i-i+1].concat([])),this.parent},XMLNode.prototype.node=function(name,attributes,text){var child,ref2;return null!=name&&(name=getValue(name)),attributes||(attributes={}),attributes=getValue(attributes),isObject(attributes)||(text=(ref2=[attributes,text])[0],attributes=ref2[1]),child=new XMLElement(this,name,attributes),null!=tex