@abaplint/transpiler-cli 2.10.25 → 2.10.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/bundle.js +174 -2150
  2. package/package.json +5 -5
package/build/bundle.js CHANGED
@@ -24009,7 +24009,7 @@ const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/c
24009
24009
  const let_1 = __webpack_require__(/*! ./let */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/let.js");
24010
24010
  const cond_1 = __webpack_require__(/*! ./cond */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/cond.js");
24011
24011
  class CondBody {
24012
- runSyntax(node, input) {
24012
+ runSyntax(node, input, targetType) {
24013
24013
  if (node === undefined) {
24014
24014
  return undefined;
24015
24015
  }
@@ -24024,10 +24024,10 @@ class CondBody {
24024
24024
  let type = undefined;
24025
24025
  for (const s of node.findDirectExpressions(Expressions.Source)) {
24026
24026
  if (type === undefined) {
24027
- type = new source_1.Source().runSyntax(s, input);
24027
+ type = new source_1.Source().runSyntax(s, input, targetType);
24028
24028
  }
24029
24029
  else {
24030
- new source_1.Source().runSyntax(s, input);
24030
+ new source_1.Source().runSyntax(s, input, targetType);
24031
24031
  }
24032
24032
  }
24033
24033
  if (scoped === true) {
@@ -26717,7 +26717,7 @@ class Source {
26717
26717
  case "COND":
26718
26718
  {
26719
26719
  const foundType = this.determineType(node, input, targetType);
26720
- const bodyType = new cond_body_1.CondBody().runSyntax(node.findDirectExpression(Expressions.CondBody), input);
26720
+ const bodyType = new cond_body_1.CondBody().runSyntax(node.findDirectExpression(Expressions.CondBody), input, foundType);
26721
26721
  if (foundType === undefined || foundType.isGeneric()) {
26722
26722
  this.addIfInferred(node, input, bodyType);
26723
26723
  }
@@ -44713,7 +44713,7 @@ exports.ABAPObject = ABAPObject;
44713
44713
 
44714
44714
  Object.defineProperty(exports, "__esModule", ({ value: true }));
44715
44715
  exports.AbstractObject = void 0;
44716
- const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "./node_modules/fast-xml-parser/src/fxp.js");
44716
+ const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "./node_modules/fast-xml-parser/lib/fxp.cjs");
44717
44717
  const _identifier_1 = __webpack_require__(/*! ../abap/4_file_information/_identifier */ "./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js");
44718
44718
  const identifier_1 = __webpack_require__(/*! ../abap/1_lexer/tokens/identifier */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/identifier.js");
44719
44719
  const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
@@ -44853,6 +44853,7 @@ function parseDynpros(parsed) {
44853
44853
  number: d.HEADER.SCREEN,
44854
44854
  description: d.HEADER.DESCRIPT,
44855
44855
  nextScreen: d.HEADER.NEXTSCREEN,
44856
+ type: d.HEADER.TYPE,
44856
44857
  fields: fields,
44857
44858
  });
44858
44859
  }
@@ -47353,7 +47354,7 @@ exports.FunctionGroup = void 0;
47353
47354
  const _abap_object_1 = __webpack_require__(/*! ./_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
47354
47355
  const types_1 = __webpack_require__(/*! ../abap/types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
47355
47356
  const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
47356
- const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "./node_modules/fast-xml-parser/src/fxp.js");
47357
+ const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "./node_modules/fast-xml-parser/lib/fxp.cjs");
47357
47358
  const _dynpros_1 = __webpack_require__(/*! ./_dynpros */ "./node_modules/@abaplint/core/build/src/objects/_dynpros.js");
47358
47359
  class FunctionGroup extends _abap_object_1.ABAPObject {
47359
47360
  constructor() {
@@ -51860,8 +51861,9 @@ class TypePool extends _abap_object_1.ABAPObject {
51860
51861
  };
51861
51862
  }
51862
51863
  getDescription() {
51863
- // todo
51864
- return undefined;
51864
+ var _a, _b, _c;
51865
+ const parsed = super.parseRaw2();
51866
+ return ((_c = (_b = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]) === null || _b === void 0 ? void 0 : _b["asx:values"]) === null || _c === void 0 ? void 0 : _c.DDTEXT) || "";
51865
51867
  }
51866
51868
  }
51867
51869
  exports.TypePool = TypePool;
@@ -52766,7 +52768,7 @@ class Registry {
52766
52768
  }
52767
52769
  static abaplintVersion() {
52768
52770
  // magic, see build script "version.sh"
52769
- return "2.113.104";
52771
+ return "2.113.107";
52770
52772
  }
52771
52773
  getDDICReferences() {
52772
52774
  return this.ddicReferences;
@@ -70498,7 +70500,7 @@ exports.ReleaseIdoc = ReleaseIdoc;
70498
70500
  Object.defineProperty(exports, "__esModule", ({ value: true }));
70499
70501
  exports.RemoveDescriptions = exports.RemoveDescriptionsConf = void 0;
70500
70502
  const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
70501
- const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "./node_modules/fast-xml-parser/src/fxp.js");
70503
+ const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "./node_modules/fast-xml-parser/lib/fxp.cjs");
70502
70504
  const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
70503
70505
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
70504
70506
  const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
@@ -75408,7 +75410,7 @@ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/co
75408
75410
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
75409
75411
  const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
75410
75412
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
75411
- const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "./node_modules/fast-xml-parser/src/fxp.js");
75413
+ const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "./node_modules/fast-xml-parser/lib/fxp.cjs");
75412
75414
  class XMLConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {
75413
75415
  }
75414
75416
  exports.XMLConsistencyConf = XMLConsistencyConf;
@@ -83691,7 +83693,7 @@ class IncludeTranspiler {
83691
83693
  }
83692
83694
  }
83693
83695
  // todo, this will not work
83694
- return new chunk_1.Chunk("");
83696
+ return new chunk_1.Chunk("// transpiler TODO: INCLUDE " + includeName + "\n");
83695
83697
  }
83696
83698
  }
83697
83699
  exports.IncludeTranspiler = IncludeTranspiler;
@@ -89621,2077 +89623,219 @@ var isArray = Array.isArray || function (xs) {
89621
89623
 
89622
89624
  /***/ }),
89623
89625
 
89624
- /***/ "./node_modules/fast-xml-parser/src/fxp.js":
89625
- /*!*************************************************!*\
89626
- !*** ./node_modules/fast-xml-parser/src/fxp.js ***!
89627
- \*************************************************/
89628
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
89629
-
89630
- "use strict";
89631
-
89632
-
89633
- const validator = __webpack_require__(/*! ./validator */ "./node_modules/fast-xml-parser/src/validator.js");
89634
- const XMLParser = __webpack_require__(/*! ./xmlparser/XMLParser */ "./node_modules/fast-xml-parser/src/xmlparser/XMLParser.js");
89635
- const XMLBuilder = __webpack_require__(/*! ./xmlbuilder/json2xml */ "./node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js");
89636
-
89637
- module.exports = {
89638
- XMLParser: XMLParser,
89639
- XMLValidator: validator,
89640
- XMLBuilder: XMLBuilder
89641
- }
89642
-
89643
- /***/ }),
89644
-
89645
- /***/ "./node_modules/fast-xml-parser/src/ignoreAttributes.js":
89646
- /*!**************************************************************!*\
89647
- !*** ./node_modules/fast-xml-parser/src/ignoreAttributes.js ***!
89648
- \**************************************************************/
89649
- /***/ ((module) => {
89650
-
89651
- function getIgnoreAttributesFn(ignoreAttributes) {
89652
- if (typeof ignoreAttributes === 'function') {
89653
- return ignoreAttributes
89654
- }
89655
- if (Array.isArray(ignoreAttributes)) {
89656
- return (attrName) => {
89657
- for (const pattern of ignoreAttributes) {
89658
- if (typeof pattern === 'string' && attrName === pattern) {
89659
- return true
89660
- }
89661
- if (pattern instanceof RegExp && pattern.test(attrName)) {
89662
- return true
89663
- }
89664
- }
89665
- }
89666
- }
89667
- return () => false
89668
- }
89669
-
89670
- module.exports = getIgnoreAttributesFn
89671
-
89672
- /***/ }),
89673
-
89674
- /***/ "./node_modules/fast-xml-parser/src/util.js":
89626
+ /***/ "./node_modules/fast-xml-parser/lib/fxp.cjs":
89675
89627
  /*!**************************************************!*\
89676
- !*** ./node_modules/fast-xml-parser/src/util.js ***!
89628
+ !*** ./node_modules/fast-xml-parser/lib/fxp.cjs ***!
89677
89629
  \**************************************************/
89678
- /***/ ((__unused_webpack_module, exports) => {
89679
-
89680
- "use strict";
89681
-
89682
-
89683
- const nameStartChar = ':A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
89684
- const nameChar = nameStartChar + '\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
89685
- const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*'
89686
- const regexName = new RegExp('^' + nameRegexp + '$');
89687
-
89688
- const getAllMatches = function(string, regex) {
89689
- const matches = [];
89690
- let match = regex.exec(string);
89691
- while (match) {
89692
- const allmatches = [];
89693
- allmatches.startIndex = regex.lastIndex - match[0].length;
89694
- const len = match.length;
89695
- for (let index = 0; index < len; index++) {
89696
- allmatches.push(match[index]);
89697
- }
89698
- matches.push(allmatches);
89699
- match = regex.exec(string);
89700
- }
89701
- return matches;
89702
- };
89703
-
89704
- const isName = function(string) {
89705
- const match = regexName.exec(string);
89706
- return !(match === null || typeof match === 'undefined');
89707
- };
89708
-
89709
- exports.isExist = function(v) {
89710
- return typeof v !== 'undefined';
89711
- };
89712
-
89713
- exports.isEmptyObject = function(obj) {
89714
- return Object.keys(obj).length === 0;
89715
- };
89630
+ /***/ ((module) => {
89716
89631
 
89717
- /**
89718
- * Copy all the properties of a into b.
89719
- * @param {*} target
89720
- * @param {*} a
89632
+ /*
89633
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
89634
+ * This devtool is neither made for production nor for readable output files.
89635
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
89636
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
89637
+ * or disable the default devtool with "devtool: false".
89638
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
89721
89639
  */
89722
- exports.merge = function(target, a, arrayMode) {
89723
- if (a) {
89724
- const keys = Object.keys(a); // will return an array of own properties
89725
- const len = keys.length; //don't make it inline
89726
- for (let i = 0; i < len; i++) {
89727
- if (arrayMode === 'strict') {
89728
- target[keys[i]] = [ a[keys[i]] ];
89729
- } else {
89730
- target[keys[i]] = a[keys[i]];
89731
- }
89732
- }
89733
- }
89734
- };
89735
- /* exports.merge =function (b,a){
89736
- return Object.assign(b,a);
89737
- } */
89738
-
89739
- exports.getValue = function(v) {
89740
- if (exports.isExist(v)) {
89741
- return v;
89742
- } else {
89743
- return '';
89744
- }
89745
- };
89746
-
89747
- // const fakeCall = function(a) {return a;};
89748
- // const fakeCallNoReturn = function() {};
89640
+ /******/ (() => { // webpackBootstrap
89641
+ /******/ "use strict";
89642
+ /******/ var __webpack_modules__ = ({
89749
89643
 
89750
- exports.isName = isName;
89751
- exports.getAllMatches = getAllMatches;
89752
- exports.nameRegexp = nameRegexp;
89644
+ /***/ "./node_modules/strnum/strnum.js":
89645
+ /*!***************************************!*\
89646
+ !*** ./node_modules/strnum/strnum.js ***!
89647
+ \***************************************/
89648
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
89753
89649
 
89650
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ toNumber)\n/* harmony export */ });\nconst hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;\nconst numRegex = /^([\\-\\+])?(0*)([0-9]*(\\.[0-9]*)?)$/;\n// const octRegex = /^0x[a-z0-9]+/;\n// const binRegex = /0x[a-z0-9]+/;\n\n \nconst consider = {\n hex : true,\n // oct: false,\n leadingZeros: true,\n decimalPoint: \"\\.\",\n eNotation: true,\n //skipLike: /regex/\n};\n\nfunction toNumber(str, options = {}){\n options = Object.assign({}, consider, options );\n if(!str || typeof str !== \"string\" ) return str;\n \n let trimmedStr = str.trim();\n \n if(options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str;\n else if(str===\"0\") return 0;\n else if (options.hex && hexRegex.test(trimmedStr)) {\n return parse_int(trimmedStr, 16);\n // }else if (options.oct && octRegex.test(str)) {\n // return Number.parseInt(val, 8);\n }else if (trimmedStr.search(/[eE]/)!== -1) { //eNotation\n const notation = trimmedStr.match(/^([-\\+])?(0*)([0-9]*(\\.[0-9]*)?[eE][-\\+]?[0-9]+)$/); \n // +00.123 => [ , '+', '00', '.123', ..\n if(notation){\n // console.log(notation)\n if(options.leadingZeros){ //accept with leading zeros\n trimmedStr = (notation[1] || \"\") + notation[3];\n }else{\n if(notation[2] === \"0\" && notation[3][0]=== \".\"){ //valid number\n }else{\n return str;\n }\n }\n return options.eNotation ? Number(trimmedStr) : str;\n }else{\n return str;\n }\n // }else if (options.parseBin && binRegex.test(str)) {\n // return Number.parseInt(val, 2);\n }else{\n //separate negative sign, leading zeros, and rest number\n const match = numRegex.exec(trimmedStr);\n // +00.123 => [ , '+', '00', '.123', ..\n if(match){\n const sign = match[1];\n const leadingZeros = match[2];\n let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros\n //trim ending zeros for floating number\n \n if(!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== \".\") return str; //-0123\n else if(!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== \".\") return str; //0123\n else if(options.leadingZeros && leadingZeros===str) return 0; //00\n \n else{//no leading zeros or leading zeros are allowed\n const num = Number(trimmedStr);\n const numStr = \"\" + num;\n\n if(numStr.search(/[eE]/) !== -1){ //given number is long and parsed to eNotation\n if(options.eNotation) return num;\n else return str;\n }else if(trimmedStr.indexOf(\".\") !== -1){ //floating number\n if(numStr === \"0\" && (numTrimmedByZeros === \"\") ) return num; //0.0\n else if(numStr === numTrimmedByZeros) return num; //0.456. 0.79000\n else if( sign && numStr === \"-\"+numTrimmedByZeros) return num;\n else return str;\n }\n \n if(leadingZeros){\n return (numTrimmedByZeros === numStr) || (sign+numTrimmedByZeros === numStr) ? num : str\n }else {\n return (trimmedStr === numStr) || (trimmedStr === sign+numStr) ? num : str\n }\n }\n }else{ //non-numeric string\n return str;\n }\n }\n}\n\n/**\n * \n * @param {string} numStr without leading zeros\n * @returns \n */\nfunction trimZeros(numStr){\n if(numStr && numStr.indexOf(\".\") !== -1){//float\n numStr = numStr.replace(/0+$/, \"\"); //remove ending zeros\n if(numStr === \".\") numStr = \"0\";\n else if(numStr[0] === \".\") numStr = \"0\"+numStr;\n else if(numStr[numStr.length-1] === \".\") numStr = numStr.substr(0,numStr.length-1);\n return numStr;\n }\n return numStr;\n}\n\nfunction parse_int(numStr, base){\n //polyfill\n if(parseInt) return parseInt(numStr, base);\n else if(Number.parseInt) return Number.parseInt(numStr, base);\n else if(window && window.parseInt) return window.parseInt(numStr, base);\n else throw new Error(\"parseInt, Number.parseInt, window.parseInt are not supported\")\n}\n\n//# sourceURL=webpack://fast-xml-parser/./node_modules/strnum/strnum.js?");
89754
89651
 
89755
89652
  /***/ }),
89756
89653
 
89757
- /***/ "./node_modules/fast-xml-parser/src/validator.js":
89758
- /*!*******************************************************!*\
89759
- !*** ./node_modules/fast-xml-parser/src/validator.js ***!
89760
- \*******************************************************/
89761
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
89762
-
89763
- "use strict";
89764
-
89765
-
89766
- const util = __webpack_require__(/*! ./util */ "./node_modules/fast-xml-parser/src/util.js");
89767
-
89768
- const defaultOptions = {
89769
- allowBooleanAttributes: false, //A tag can have attributes without any value
89770
- unpairedTags: []
89771
- };
89772
-
89773
- //const tagsPattern = new RegExp("<\\/?([\\w:\\-_\.]+)\\s*\/?>","g");
89774
- exports.validate = function (xmlData, options) {
89775
- options = Object.assign({}, defaultOptions, options);
89776
-
89777
- //xmlData = xmlData.replace(/(\r\n|\n|\r)/gm,"");//make it single line
89778
- //xmlData = xmlData.replace(/(^\s*<\?xml.*?\?>)/g,"");//Remove XML starting tag
89779
- //xmlData = xmlData.replace(/(<!DOCTYPE[\s\w\"\.\/\-\:]+(\[.*\])*\s*>)/g,"");//Remove DOCTYPE
89780
- const tags = [];
89781
- let tagFound = false;
89782
-
89783
- //indicates that the root tag has been closed (aka. depth 0 has been reached)
89784
- let reachedRoot = false;
89785
-
89786
- if (xmlData[0] === '\ufeff') {
89787
- // check for byte order mark (BOM)
89788
- xmlData = xmlData.substr(1);
89789
- }
89790
-
89791
- for (let i = 0; i < xmlData.length; i++) {
89792
-
89793
- if (xmlData[i] === '<' && xmlData[i+1] === '?') {
89794
- i+=2;
89795
- i = readPI(xmlData,i);
89796
- if (i.err) return i;
89797
- }else if (xmlData[i] === '<') {
89798
- //starting of tag
89799
- //read until you reach to '>' avoiding any '>' in attribute value
89800
- let tagStartPos = i;
89801
- i++;
89802
-
89803
- if (xmlData[i] === '!') {
89804
- i = readCommentAndCDATA(xmlData, i);
89805
- continue;
89806
- } else {
89807
- let closingTag = false;
89808
- if (xmlData[i] === '/') {
89809
- //closing tag
89810
- closingTag = true;
89811
- i++;
89812
- }
89813
- //read tagname
89814
- let tagName = '';
89815
- for (; i < xmlData.length &&
89816
- xmlData[i] !== '>' &&
89817
- xmlData[i] !== ' ' &&
89818
- xmlData[i] !== '\t' &&
89819
- xmlData[i] !== '\n' &&
89820
- xmlData[i] !== '\r'; i++
89821
- ) {
89822
- tagName += xmlData[i];
89823
- }
89824
- tagName = tagName.trim();
89825
- //console.log(tagName);
89826
-
89827
- if (tagName[tagName.length - 1] === '/') {
89828
- //self closing tag without attributes
89829
- tagName = tagName.substring(0, tagName.length - 1);
89830
- //continue;
89831
- i--;
89832
- }
89833
- if (!validateTagName(tagName)) {
89834
- let msg;
89835
- if (tagName.trim().length === 0) {
89836
- msg = "Invalid space after '<'.";
89837
- } else {
89838
- msg = "Tag '"+tagName+"' is an invalid name.";
89839
- }
89840
- return getErrorObject('InvalidTag', msg, getLineNumberForPosition(xmlData, i));
89841
- }
89842
-
89843
- const result = readAttributeStr(xmlData, i);
89844
- if (result === false) {
89845
- return getErrorObject('InvalidAttr', "Attributes for '"+tagName+"' have open quote.", getLineNumberForPosition(xmlData, i));
89846
- }
89847
- let attrStr = result.value;
89848
- i = result.index;
89849
-
89850
- if (attrStr[attrStr.length - 1] === '/') {
89851
- //self closing tag
89852
- const attrStrStart = i - attrStr.length;
89853
- attrStr = attrStr.substring(0, attrStr.length - 1);
89854
- const isValid = validateAttributeString(attrStr, options);
89855
- if (isValid === true) {
89856
- tagFound = true;
89857
- //continue; //text may presents after self closing tag
89858
- } else {
89859
- //the result from the nested function returns the position of the error within the attribute
89860
- //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
89861
- //this gives us the absolute index in the entire xml, which we can use to find the line at last
89862
- return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));
89863
- }
89864
- } else if (closingTag) {
89865
- if (!result.tagClosed) {
89866
- return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
89867
- } else if (attrStr.trim().length > 0) {
89868
- return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
89869
- } else if (tags.length === 0) {
89870
- return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
89871
- } else {
89872
- const otg = tags.pop();
89873
- if (tagName !== otg.tagName) {
89874
- let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);
89875
- return getErrorObject('InvalidTag',
89876
- "Expected closing tag '"+otg.tagName+"' (opened in line "+openPos.line+", col "+openPos.col+") instead of closing tag '"+tagName+"'.",
89877
- getLineNumberForPosition(xmlData, tagStartPos));
89878
- }
89879
-
89880
- //when there are no more tags, we reached the root level.
89881
- if (tags.length == 0) {
89882
- reachedRoot = true;
89883
- }
89884
- }
89885
- } else {
89886
- const isValid = validateAttributeString(attrStr, options);
89887
- if (isValid !== true) {
89888
- //the result from the nested function returns the position of the error within the attribute
89889
- //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
89890
- //this gives us the absolute index in the entire xml, which we can use to find the line at last
89891
- return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));
89892
- }
89893
-
89894
- //if the root level has been reached before ...
89895
- if (reachedRoot === true) {
89896
- return getErrorObject('InvalidXml', 'Multiple possible root nodes found.', getLineNumberForPosition(xmlData, i));
89897
- } else if(options.unpairedTags.indexOf(tagName) !== -1){
89898
- //don't push into stack
89899
- } else {
89900
- tags.push({tagName, tagStartPos});
89901
- }
89902
- tagFound = true;
89903
- }
89904
-
89905
- //skip tag text value
89906
- //It may include comments and CDATA value
89907
- for (i++; i < xmlData.length; i++) {
89908
- if (xmlData[i] === '<') {
89909
- if (xmlData[i + 1] === '!') {
89910
- //comment or CADATA
89911
- i++;
89912
- i = readCommentAndCDATA(xmlData, i);
89913
- continue;
89914
- } else if (xmlData[i+1] === '?') {
89915
- i = readPI(xmlData, ++i);
89916
- if (i.err) return i;
89917
- } else{
89918
- break;
89919
- }
89920
- } else if (xmlData[i] === '&') {
89921
- const afterAmp = validateAmpersand(xmlData, i);
89922
- if (afterAmp == -1)
89923
- return getErrorObject('InvalidChar', "char '&' is not expected.", getLineNumberForPosition(xmlData, i));
89924
- i = afterAmp;
89925
- }else{
89926
- if (reachedRoot === true && !isWhiteSpace(xmlData[i])) {
89927
- return getErrorObject('InvalidXml', "Extra text at the end", getLineNumberForPosition(xmlData, i));
89928
- }
89929
- }
89930
- } //end of reading tag text value
89931
- if (xmlData[i] === '<') {
89932
- i--;
89933
- }
89934
- }
89935
- } else {
89936
- if ( isWhiteSpace(xmlData[i])) {
89937
- continue;
89938
- }
89939
- return getErrorObject('InvalidChar', "char '"+xmlData[i]+"' is not expected.", getLineNumberForPosition(xmlData, i));
89940
- }
89941
- }
89942
-
89943
- if (!tagFound) {
89944
- return getErrorObject('InvalidXml', 'Start tag expected.', 1);
89945
- }else if (tags.length == 1) {
89946
- return getErrorObject('InvalidTag', "Unclosed tag '"+tags[0].tagName+"'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
89947
- }else if (tags.length > 0) {
89948
- return getErrorObject('InvalidXml', "Invalid '"+
89949
- JSON.stringify(tags.map(t => t.tagName), null, 4).replace(/\r?\n/g, '')+
89950
- "' found.", {line: 1, col: 1});
89951
- }
89952
-
89953
- return true;
89954
- };
89955
-
89956
- function isWhiteSpace(char){
89957
- return char === ' ' || char === '\t' || char === '\n' || char === '\r';
89958
- }
89959
- /**
89960
- * Read Processing insstructions and skip
89961
- * @param {*} xmlData
89962
- * @param {*} i
89963
- */
89964
- function readPI(xmlData, i) {
89965
- const start = i;
89966
- for (; i < xmlData.length; i++) {
89967
- if (xmlData[i] == '?' || xmlData[i] == ' ') {
89968
- //tagname
89969
- const tagname = xmlData.substr(start, i - start);
89970
- if (i > 5 && tagname === 'xml') {
89971
- return getErrorObject('InvalidXml', 'XML declaration allowed only at the start of the document.', getLineNumberForPosition(xmlData, i));
89972
- } else if (xmlData[i] == '?' && xmlData[i + 1] == '>') {
89973
- //check if valid attribut string
89974
- i++;
89975
- break;
89976
- } else {
89977
- continue;
89978
- }
89979
- }
89980
- }
89981
- return i;
89982
- }
89983
-
89984
- function readCommentAndCDATA(xmlData, i) {
89985
- if (xmlData.length > i + 5 && xmlData[i + 1] === '-' && xmlData[i + 2] === '-') {
89986
- //comment
89987
- for (i += 3; i < xmlData.length; i++) {
89988
- if (xmlData[i] === '-' && xmlData[i + 1] === '-' && xmlData[i + 2] === '>') {
89989
- i += 2;
89990
- break;
89991
- }
89992
- }
89993
- } else if (
89994
- xmlData.length > i + 8 &&
89995
- xmlData[i + 1] === 'D' &&
89996
- xmlData[i + 2] === 'O' &&
89997
- xmlData[i + 3] === 'C' &&
89998
- xmlData[i + 4] === 'T' &&
89999
- xmlData[i + 5] === 'Y' &&
90000
- xmlData[i + 6] === 'P' &&
90001
- xmlData[i + 7] === 'E'
90002
- ) {
90003
- let angleBracketsCount = 1;
90004
- for (i += 8; i < xmlData.length; i++) {
90005
- if (xmlData[i] === '<') {
90006
- angleBracketsCount++;
90007
- } else if (xmlData[i] === '>') {
90008
- angleBracketsCount--;
90009
- if (angleBracketsCount === 0) {
90010
- break;
90011
- }
90012
- }
90013
- }
90014
- } else if (
90015
- xmlData.length > i + 9 &&
90016
- xmlData[i + 1] === '[' &&
90017
- xmlData[i + 2] === 'C' &&
90018
- xmlData[i + 3] === 'D' &&
90019
- xmlData[i + 4] === 'A' &&
90020
- xmlData[i + 5] === 'T' &&
90021
- xmlData[i + 6] === 'A' &&
90022
- xmlData[i + 7] === '['
90023
- ) {
90024
- for (i += 8; i < xmlData.length; i++) {
90025
- if (xmlData[i] === ']' && xmlData[i + 1] === ']' && xmlData[i + 2] === '>') {
90026
- i += 2;
90027
- break;
90028
- }
90029
- }
90030
- }
90031
-
90032
- return i;
90033
- }
90034
-
90035
- const doubleQuote = '"';
90036
- const singleQuote = "'";
90037
-
90038
- /**
90039
- * Keep reading xmlData until '<' is found outside the attribute value.
90040
- * @param {string} xmlData
90041
- * @param {number} i
90042
- */
90043
- function readAttributeStr(xmlData, i) {
90044
- let attrStr = '';
90045
- let startChar = '';
90046
- let tagClosed = false;
90047
- for (; i < xmlData.length; i++) {
90048
- if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
90049
- if (startChar === '') {
90050
- startChar = xmlData[i];
90051
- } else if (startChar !== xmlData[i]) {
90052
- //if vaue is enclosed with double quote then single quotes are allowed inside the value and vice versa
90053
- } else {
90054
- startChar = '';
90055
- }
90056
- } else if (xmlData[i] === '>') {
90057
- if (startChar === '') {
90058
- tagClosed = true;
90059
- break;
90060
- }
90061
- }
90062
- attrStr += xmlData[i];
90063
- }
90064
- if (startChar !== '') {
90065
- return false;
90066
- }
90067
-
90068
- return {
90069
- value: attrStr,
90070
- index: i,
90071
- tagClosed: tagClosed
90072
- };
90073
- }
90074
-
90075
- /**
90076
- * Select all the attributes whether valid or invalid.
90077
- */
90078
- const validAttrStrRegxp = new RegExp('(\\s*)([^\\s=]+)(\\s*=)?(\\s*([\'"])(([\\s\\S])*?)\\5)?', 'g');
90079
-
90080
- //attr, ="sd", a="amit's", a="sd"b="saf", ab cd=""
90081
-
90082
- function validateAttributeString(attrStr, options) {
90083
- //console.log("start:"+attrStr+":end");
90084
-
90085
- //if(attrStr.trim().length === 0) return true; //empty string
90086
-
90087
- const matches = util.getAllMatches(attrStr, validAttrStrRegxp);
90088
- const attrNames = {};
90089
-
90090
- for (let i = 0; i < matches.length; i++) {
90091
- if (matches[i][1].length === 0) {
90092
- //nospace before attribute name: a="sd"b="saf"
90093
- return getErrorObject('InvalidAttr', "Attribute '"+matches[i][2]+"' has no space in starting.", getPositionFromMatch(matches[i]))
90094
- } else if (matches[i][3] !== undefined && matches[i][4] === undefined) {
90095
- return getErrorObject('InvalidAttr', "Attribute '"+matches[i][2]+"' is without value.", getPositionFromMatch(matches[i]));
90096
- } else if (matches[i][3] === undefined && !options.allowBooleanAttributes) {
90097
- //independent attribute: ab
90098
- return getErrorObject('InvalidAttr', "boolean attribute '"+matches[i][2]+"' is not allowed.", getPositionFromMatch(matches[i]));
90099
- }
90100
- /* else if(matches[i][6] === undefined){//attribute without value: ab=
90101
- return { err: { code:"InvalidAttr",msg:"attribute " + matches[i][2] + " has no value assigned."}};
90102
- } */
90103
- const attrName = matches[i][2];
90104
- if (!validateAttrName(attrName)) {
90105
- return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is an invalid name.", getPositionFromMatch(matches[i]));
90106
- }
90107
- if (!attrNames.hasOwnProperty(attrName)) {
90108
- //check for duplicate attribute.
90109
- attrNames[attrName] = 1;
90110
- } else {
90111
- return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is repeated.", getPositionFromMatch(matches[i]));
90112
- }
90113
- }
90114
-
90115
- return true;
90116
- }
90117
-
90118
- function validateNumberAmpersand(xmlData, i) {
90119
- let re = /\d/;
90120
- if (xmlData[i] === 'x') {
90121
- i++;
90122
- re = /[\da-fA-F]/;
90123
- }
90124
- for (; i < xmlData.length; i++) {
90125
- if (xmlData[i] === ';')
90126
- return i;
90127
- if (!xmlData[i].match(re))
90128
- break;
90129
- }
90130
- return -1;
90131
- }
90132
-
90133
- function validateAmpersand(xmlData, i) {
90134
- // https://www.w3.org/TR/xml/#dt-charref
90135
- i++;
90136
- if (xmlData[i] === ';')
90137
- return -1;
90138
- if (xmlData[i] === '#') {
90139
- i++;
90140
- return validateNumberAmpersand(xmlData, i);
90141
- }
90142
- let count = 0;
90143
- for (; i < xmlData.length; i++, count++) {
90144
- if (xmlData[i].match(/\w/) && count < 20)
90145
- continue;
90146
- if (xmlData[i] === ';')
90147
- break;
90148
- return -1;
90149
- }
90150
- return i;
90151
- }
90152
-
90153
- function getErrorObject(code, message, lineNumber) {
90154
- return {
90155
- err: {
90156
- code: code,
90157
- msg: message,
90158
- line: lineNumber.line || lineNumber,
90159
- col: lineNumber.col,
90160
- },
90161
- };
90162
- }
90163
-
90164
- function validateAttrName(attrName) {
90165
- return util.isName(attrName);
90166
- }
90167
-
90168
- // const startsWithXML = /^xml/i;
90169
-
90170
- function validateTagName(tagname) {
90171
- return util.isName(tagname) /* && !tagname.match(startsWithXML) */;
90172
- }
90173
-
90174
- //this function returns the line number for the character at the given index
90175
- function getLineNumberForPosition(xmlData, index) {
90176
- const lines = xmlData.substring(0, index).split(/\r?\n/);
90177
- return {
90178
- line: lines.length,
90179
-
90180
- // column number is last line's length + 1, because column numbering starts at 1:
90181
- col: lines[lines.length - 1].length + 1
90182
- };
90183
- }
90184
-
90185
- //this function returns the position of the first character of match within attrStr
90186
- function getPositionFromMatch(match) {
90187
- return match.startIndex + match[1].length;
90188
- }
89654
+ /***/ "./src/fxp.js":
89655
+ /*!********************!*\
89656
+ !*** ./src/fxp.js ***!
89657
+ \********************/
89658
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
90189
89659
 
89660
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ XMLBuilder: () => (/* reexport safe */ _xmlbuilder_json2xml_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]),\n/* harmony export */ XMLParser: () => (/* reexport safe */ _xmlparser_XMLParser_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]),\n/* harmony export */ XMLValidator: () => (/* binding */ XMLValidator)\n/* harmony export */ });\n/* harmony import */ var _validator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validator.js */ \"./src/validator.js\");\n/* harmony import */ var _xmlparser_XMLParser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./xmlparser/XMLParser.js */ \"./src/xmlparser/XMLParser.js\");\n/* harmony import */ var _xmlbuilder_json2xml_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./xmlbuilder/json2xml.js */ \"./src/xmlbuilder/json2xml.js\");\n\n\n\n\n\n\nconst XMLValidator = {\n validate: _validator_js__WEBPACK_IMPORTED_MODULE_0__.validate\n}\n\n\n//# sourceURL=webpack://fast-xml-parser/./src/fxp.js?");
90190
89661
 
90191
89662
  /***/ }),
90192
89663
 
90193
- /***/ "./node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js":
90194
- /*!*****************************************************************!*\
90195
- !*** ./node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js ***!
90196
- \*****************************************************************/
90197
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
90198
-
90199
- "use strict";
90200
-
90201
- //parse Empty Node as self closing node
90202
- const buildFromOrderedJs = __webpack_require__(/*! ./orderedJs2Xml */ "./node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js");
90203
- const getIgnoreAttributesFn = __webpack_require__(/*! ../ignoreAttributes */ "./node_modules/fast-xml-parser/src/ignoreAttributes.js")
90204
-
90205
- const defaultOptions = {
90206
- attributeNamePrefix: '@_',
90207
- attributesGroupName: false,
90208
- textNodeName: '#text',
90209
- ignoreAttributes: true,
90210
- cdataPropName: false,
90211
- format: false,
90212
- indentBy: ' ',
90213
- suppressEmptyNode: false,
90214
- suppressUnpairedNode: true,
90215
- suppressBooleanAttributes: true,
90216
- tagValueProcessor: function(key, a) {
90217
- return a;
90218
- },
90219
- attributeValueProcessor: function(attrName, a) {
90220
- return a;
90221
- },
90222
- preserveOrder: false,
90223
- commentPropName: false,
90224
- unpairedTags: [],
90225
- entities: [
90226
- { regex: new RegExp("&", "g"), val: "&amp;" },//it must be on top
90227
- { regex: new RegExp(">", "g"), val: "&gt;" },
90228
- { regex: new RegExp("<", "g"), val: "&lt;" },
90229
- { regex: new RegExp("\'", "g"), val: "&apos;" },
90230
- { regex: new RegExp("\"", "g"), val: "&quot;" }
90231
- ],
90232
- processEntities: true,
90233
- stopNodes: [],
90234
- // transformTagName: false,
90235
- // transformAttributeName: false,
90236
- oneListGroup: false
90237
- };
90238
-
90239
- function Builder(options) {
90240
- this.options = Object.assign({}, defaultOptions, options);
90241
- if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
90242
- this.isAttribute = function(/*a*/) {
90243
- return false;
90244
- };
90245
- } else {
90246
- this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes)
90247
- this.attrPrefixLen = this.options.attributeNamePrefix.length;
90248
- this.isAttribute = isAttribute;
90249
- }
90250
-
90251
- this.processTextOrObjNode = processTextOrObjNode
90252
-
90253
- if (this.options.format) {
90254
- this.indentate = indentate;
90255
- this.tagEndChar = '>\n';
90256
- this.newLine = '\n';
90257
- } else {
90258
- this.indentate = function() {
90259
- return '';
90260
- };
90261
- this.tagEndChar = '>';
90262
- this.newLine = '';
90263
- }
90264
- }
90265
-
90266
- Builder.prototype.build = function(jObj) {
90267
- if(this.options.preserveOrder){
90268
- return buildFromOrderedJs(jObj, this.options);
90269
- }else {
90270
- if(Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1){
90271
- jObj = {
90272
- [this.options.arrayNodeName] : jObj
90273
- }
90274
- }
90275
- return this.j2x(jObj, 0, []).val;
90276
- }
90277
- };
90278
-
90279
- Builder.prototype.j2x = function(jObj, level, ajPath) {
90280
- let attrStr = '';
90281
- let val = '';
90282
- const jPath = ajPath.join('.')
90283
- for (let key in jObj) {
90284
- if(!Object.prototype.hasOwnProperty.call(jObj, key)) continue;
90285
- if (typeof jObj[key] === 'undefined') {
90286
- // supress undefined node only if it is not an attribute
90287
- if (this.isAttribute(key)) {
90288
- val += '';
90289
- }
90290
- } else if (jObj[key] === null) {
90291
- // null attribute should be ignored by the attribute list, but should not cause the tag closing
90292
- if (this.isAttribute(key)) {
90293
- val += '';
90294
- } else if (key === this.options.cdataPropName) {
90295
- val += '';
90296
- } else if (key[0] === '?') {
90297
- val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
90298
- } else {
90299
- val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
90300
- }
90301
- // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
90302
- } else if (jObj[key] instanceof Date) {
90303
- val += this.buildTextValNode(jObj[key], key, '', level);
90304
- } else if (typeof jObj[key] !== 'object') {
90305
- //premitive type
90306
- const attr = this.isAttribute(key);
90307
- if (attr && !this.ignoreAttributesFn(attr, jPath)) {
90308
- attrStr += this.buildAttrPairStr(attr, '' + jObj[key]);
90309
- } else if (!attr) {
90310
- //tag value
90311
- if (key === this.options.textNodeName) {
90312
- let newval = this.options.tagValueProcessor(key, '' + jObj[key]);
90313
- val += this.replaceEntitiesValue(newval);
90314
- } else {
90315
- val += this.buildTextValNode(jObj[key], key, '', level);
90316
- }
90317
- }
90318
- } else if (Array.isArray(jObj[key])) {
90319
- //repeated nodes
90320
- const arrLen = jObj[key].length;
90321
- let listTagVal = "";
90322
- let listTagAttr = "";
90323
- for (let j = 0; j < arrLen; j++) {
90324
- const item = jObj[key][j];
90325
- if (typeof item === 'undefined') {
90326
- // supress undefined node
90327
- } else if (item === null) {
90328
- if(key[0] === "?") val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
90329
- else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
90330
- // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
90331
- } else if (typeof item === 'object') {
90332
- if(this.options.oneListGroup){
90333
- const result = this.j2x(item, level + 1, ajPath.concat(key));
90334
- listTagVal += result.val;
90335
- if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {
90336
- listTagAttr += result.attrStr
90337
- }
90338
- }else{
90339
- listTagVal += this.processTextOrObjNode(item, key, level, ajPath)
90340
- }
90341
- } else {
90342
- if (this.options.oneListGroup) {
90343
- let textValue = this.options.tagValueProcessor(key, item);
90344
- textValue = this.replaceEntitiesValue(textValue);
90345
- listTagVal += textValue;
90346
- } else {
90347
- listTagVal += this.buildTextValNode(item, key, '', level);
90348
- }
90349
- }
90350
- }
90351
- if(this.options.oneListGroup){
90352
- listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);
90353
- }
90354
- val += listTagVal;
90355
- } else {
90356
- //nested node
90357
- if (this.options.attributesGroupName && key === this.options.attributesGroupName) {
90358
- const Ks = Object.keys(jObj[key]);
90359
- const L = Ks.length;
90360
- for (let j = 0; j < L; j++) {
90361
- attrStr += this.buildAttrPairStr(Ks[j], '' + jObj[key][Ks[j]]);
90362
- }
90363
- } else {
90364
- val += this.processTextOrObjNode(jObj[key], key, level, ajPath)
90365
- }
90366
- }
90367
- }
90368
- return {attrStr: attrStr, val: val};
90369
- };
90370
-
90371
- Builder.prototype.buildAttrPairStr = function(attrName, val){
90372
- val = this.options.attributeValueProcessor(attrName, '' + val);
90373
- val = this.replaceEntitiesValue(val);
90374
- if (this.options.suppressBooleanAttributes && val === "true") {
90375
- return ' ' + attrName;
90376
- } else return ' ' + attrName + '="' + val + '"';
90377
- }
90378
-
90379
- function processTextOrObjNode (object, key, level, ajPath) {
90380
- const result = this.j2x(object, level + 1, ajPath.concat(key));
90381
- if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) {
90382
- return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);
90383
- } else {
90384
- return this.buildObjectNode(result.val, key, result.attrStr, level);
90385
- }
90386
- }
90387
-
90388
- Builder.prototype.buildObjectNode = function(val, key, attrStr, level) {
90389
- if(val === ""){
90390
- if(key[0] === "?") return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
90391
- else {
90392
- return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
90393
- }
90394
- }else{
90395
-
90396
- let tagEndExp = '</' + key + this.tagEndChar;
90397
- let piClosingChar = "";
90398
-
90399
- if(key[0] === "?") {
90400
- piClosingChar = "?";
90401
- tagEndExp = "";
90402
- }
90403
-
90404
- // attrStr is an empty string in case the attribute came as undefined or null
90405
- if ((attrStr || attrStr === '') && val.indexOf('<') === -1) {
90406
- return ( this.indentate(level) + '<' + key + attrStr + piClosingChar + '>' + val + tagEndExp );
90407
- } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {
90408
- return this.indentate(level) + `<!--${val}-->` + this.newLine;
90409
- }else {
90410
- return (
90411
- this.indentate(level) + '<' + key + attrStr + piClosingChar + this.tagEndChar +
90412
- val +
90413
- this.indentate(level) + tagEndExp );
90414
- }
90415
- }
90416
- }
90417
-
90418
- Builder.prototype.closeTag = function(key){
90419
- let closeTag = "";
90420
- if(this.options.unpairedTags.indexOf(key) !== -1){ //unpaired
90421
- if(!this.options.suppressUnpairedNode) closeTag = "/"
90422
- }else if(this.options.suppressEmptyNode){ //empty
90423
- closeTag = "/";
90424
- }else{
90425
- closeTag = `></${key}`
90426
- }
90427
- return closeTag;
90428
- }
90429
-
90430
- function buildEmptyObjNode(val, key, attrStr, level) {
90431
- if (val !== '') {
90432
- return this.buildObjectNode(val, key, attrStr, level);
90433
- } else {
90434
- if(key[0] === "?") return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
90435
- else {
90436
- return this.indentate(level) + '<' + key + attrStr + '/' + this.tagEndChar;
90437
- // return this.buildTagStr(level,key, attrStr);
90438
- }
90439
- }
90440
- }
90441
-
90442
- Builder.prototype.buildTextValNode = function(val, key, attrStr, level) {
90443
- if (this.options.cdataPropName !== false && key === this.options.cdataPropName) {
90444
- return this.indentate(level) + `<![CDATA[${val}]]>` + this.newLine;
90445
- }else if (this.options.commentPropName !== false && key === this.options.commentPropName) {
90446
- return this.indentate(level) + `<!--${val}-->` + this.newLine;
90447
- }else if(key[0] === "?") {//PI tag
90448
- return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
90449
- }else{
90450
- let textValue = this.options.tagValueProcessor(key, val);
90451
- textValue = this.replaceEntitiesValue(textValue);
90452
-
90453
- if( textValue === ''){
90454
- return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
90455
- }else{
90456
- return this.indentate(level) + '<' + key + attrStr + '>' +
90457
- textValue +
90458
- '</' + key + this.tagEndChar;
90459
- }
90460
- }
90461
- }
90462
-
90463
- Builder.prototype.replaceEntitiesValue = function(textValue){
90464
- if(textValue && textValue.length > 0 && this.options.processEntities){
90465
- for (let i=0; i<this.options.entities.length; i++) {
90466
- const entity = this.options.entities[i];
90467
- textValue = textValue.replace(entity.regex, entity.val);
90468
- }
90469
- }
90470
- return textValue;
90471
- }
90472
-
90473
- function indentate(level) {
90474
- return this.options.indentBy.repeat(level);
90475
- }
90476
-
90477
- function isAttribute(name /*, options*/) {
90478
- if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {
90479
- return name.substr(this.attrPrefixLen);
90480
- } else {
90481
- return false;
90482
- }
90483
- }
90484
-
90485
- module.exports = Builder;
89664
+ /***/ "./src/ignoreAttributes.js":
89665
+ /*!*********************************!*\
89666
+ !*** ./src/ignoreAttributes.js ***!
89667
+ \*********************************/
89668
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
90486
89669
 
89670
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ getIgnoreAttributesFn)\n/* harmony export */ });\nfunction getIgnoreAttributesFn(ignoreAttributes) {\n if (typeof ignoreAttributes === 'function') {\n return ignoreAttributes\n }\n if (Array.isArray(ignoreAttributes)) {\n return (attrName) => {\n for (const pattern of ignoreAttributes) {\n if (typeof pattern === 'string' && attrName === pattern) {\n return true\n }\n if (pattern instanceof RegExp && pattern.test(attrName)) {\n return true\n }\n }\n }\n }\n return () => false\n}\n\n//# sourceURL=webpack://fast-xml-parser/./src/ignoreAttributes.js?");
90487
89671
 
90488
89672
  /***/ }),
90489
89673
 
90490
- /***/ "./node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js":
90491
- /*!**********************************************************************!*\
90492
- !*** ./node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js ***!
90493
- \**********************************************************************/
90494
- /***/ ((module) => {
90495
-
90496
- const EOL = "\n";
90497
-
90498
- /**
90499
- *
90500
- * @param {array} jArray
90501
- * @param {any} options
90502
- * @returns
90503
- */
90504
- function toXml(jArray, options) {
90505
- let indentation = "";
90506
- if (options.format && options.indentBy.length > 0) {
90507
- indentation = EOL;
90508
- }
90509
- return arrToStr(jArray, options, "", indentation);
90510
- }
90511
-
90512
- function arrToStr(arr, options, jPath, indentation) {
90513
- let xmlStr = "";
90514
- let isPreviousElementTag = false;
90515
-
90516
- for (let i = 0; i < arr.length; i++) {
90517
- const tagObj = arr[i];
90518
- const tagName = propName(tagObj);
90519
- if(tagName === undefined) continue;
90520
-
90521
- let newJPath = "";
90522
- if (jPath.length === 0) newJPath = tagName
90523
- else newJPath = `${jPath}.${tagName}`;
90524
-
90525
- if (tagName === options.textNodeName) {
90526
- let tagText = tagObj[tagName];
90527
- if (!isStopNode(newJPath, options)) {
90528
- tagText = options.tagValueProcessor(tagName, tagText);
90529
- tagText = replaceEntitiesValue(tagText, options);
90530
- }
90531
- if (isPreviousElementTag) {
90532
- xmlStr += indentation;
90533
- }
90534
- xmlStr += tagText;
90535
- isPreviousElementTag = false;
90536
- continue;
90537
- } else if (tagName === options.cdataPropName) {
90538
- if (isPreviousElementTag) {
90539
- xmlStr += indentation;
90540
- }
90541
- xmlStr += `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`;
90542
- isPreviousElementTag = false;
90543
- continue;
90544
- } else if (tagName === options.commentPropName) {
90545
- xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`;
90546
- isPreviousElementTag = true;
90547
- continue;
90548
- } else if (tagName[0] === "?") {
90549
- const attStr = attr_to_str(tagObj[":@"], options);
90550
- const tempInd = tagName === "?xml" ? "" : indentation;
90551
- let piTextNodeName = tagObj[tagName][0][options.textNodeName];
90552
- piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; //remove extra spacing
90553
- xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr}?>`;
90554
- isPreviousElementTag = true;
90555
- continue;
90556
- }
90557
- let newIdentation = indentation;
90558
- if (newIdentation !== "") {
90559
- newIdentation += options.indentBy;
90560
- }
90561
- const attStr = attr_to_str(tagObj[":@"], options);
90562
- const tagStart = indentation + `<${tagName}${attStr}`;
90563
- const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);
90564
- if (options.unpairedTags.indexOf(tagName) !== -1) {
90565
- if (options.suppressUnpairedNode) xmlStr += tagStart + ">";
90566
- else xmlStr += tagStart + "/>";
90567
- } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {
90568
- xmlStr += tagStart + "/>";
90569
- } else if (tagValue && tagValue.endsWith(">")) {
90570
- xmlStr += tagStart + `>${tagValue}${indentation}</${tagName}>`;
90571
- } else {
90572
- xmlStr += tagStart + ">";
90573
- if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes("</"))) {
90574
- xmlStr += indentation + options.indentBy + tagValue + indentation;
90575
- } else {
90576
- xmlStr += tagValue;
90577
- }
90578
- xmlStr += `</${tagName}>`;
90579
- }
90580
- isPreviousElementTag = true;
90581
- }
90582
-
90583
- return xmlStr;
90584
- }
90585
-
90586
- function propName(obj) {
90587
- const keys = Object.keys(obj);
90588
- for (let i = 0; i < keys.length; i++) {
90589
- const key = keys[i];
90590
- if(!obj.hasOwnProperty(key)) continue;
90591
- if (key !== ":@") return key;
90592
- }
90593
- }
90594
-
90595
- function attr_to_str(attrMap, options) {
90596
- let attrStr = "";
90597
- if (attrMap && !options.ignoreAttributes) {
90598
- for (let attr in attrMap) {
90599
- if(!attrMap.hasOwnProperty(attr)) continue;
90600
- let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
90601
- attrVal = replaceEntitiesValue(attrVal, options);
90602
- if (attrVal === true && options.suppressBooleanAttributes) {
90603
- attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;
90604
- } else {
90605
- attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`;
90606
- }
90607
- }
90608
- }
90609
- return attrStr;
90610
- }
90611
-
90612
- function isStopNode(jPath, options) {
90613
- jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);
90614
- let tagName = jPath.substr(jPath.lastIndexOf(".") + 1);
90615
- for (let index in options.stopNodes) {
90616
- if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true;
90617
- }
90618
- return false;
90619
- }
90620
-
90621
- function replaceEntitiesValue(textValue, options) {
90622
- if (textValue && textValue.length > 0 && options.processEntities) {
90623
- for (let i = 0; i < options.entities.length; i++) {
90624
- const entity = options.entities[i];
90625
- textValue = textValue.replace(entity.regex, entity.val);
90626
- }
90627
- }
90628
- return textValue;
90629
- }
90630
- module.exports = toXml;
89674
+ /***/ "./src/util.js":
89675
+ /*!*********************!*\
89676
+ !*** ./src/util.js ***!
89677
+ \*********************/
89678
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
90631
89679
 
89680
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getAllMatches: () => (/* binding */ getAllMatches),\n/* harmony export */ getValue: () => (/* binding */ getValue),\n/* harmony export */ isEmptyObject: () => (/* binding */ isEmptyObject),\n/* harmony export */ isExist: () => (/* binding */ isExist),\n/* harmony export */ isName: () => (/* binding */ isName),\n/* harmony export */ merge: () => (/* binding */ merge),\n/* harmony export */ nameRegexp: () => (/* binding */ nameRegexp)\n/* harmony export */ });\n\n\nconst nameStartChar = ':A-Za-z_\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD';\nconst nameChar = nameStartChar + '\\\\-.\\\\d\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040';\nconst nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*';\nconst regexName = new RegExp('^' + nameRegexp + '$');\n\nfunction getAllMatches(string, regex) {\n const matches = [];\n let match = regex.exec(string);\n while (match) {\n const allmatches = [];\n allmatches.startIndex = regex.lastIndex - match[0].length;\n const len = match.length;\n for (let index = 0; index < len; index++) {\n allmatches.push(match[index]);\n }\n matches.push(allmatches);\n match = regex.exec(string);\n }\n return matches;\n}\n\nconst isName = function(string) {\n const match = regexName.exec(string);\n return !(match === null || typeof match === 'undefined');\n}\n\nfunction isExist(v) {\n return typeof v !== 'undefined';\n}\n\nfunction isEmptyObject(obj) {\n return Object.keys(obj).length === 0;\n}\n\n/**\n * Copy all the properties of a into b.\n * @param {*} target\n * @param {*} a\n */\nfunction merge(target, a, arrayMode) {\n if (a) {\n const keys = Object.keys(a); // will return an array of own properties\n const len = keys.length; //don't make it inline\n for (let i = 0; i < len; i++) {\n if (arrayMode === 'strict') {\n target[keys[i]] = [ a[keys[i]] ];\n } else {\n target[keys[i]] = a[keys[i]];\n }\n }\n }\n}\n/* exports.merge =function (b,a){\n return Object.assign(b,a);\n} */\n\nfunction getValue(v) {\n if (exports.isExist(v)) {\n return v;\n } else {\n return '';\n }\n}\n\n// const fakeCall = function(a) {return a;};\n// const fakeCallNoReturn = function() {};\n\n//# sourceURL=webpack://fast-xml-parser/./src/util.js?");
90632
89681
 
90633
89682
  /***/ }),
90634
89683
 
90635
- /***/ "./node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js":
90636
- /*!*********************************************************************!*\
90637
- !*** ./node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js ***!
90638
- \*********************************************************************/
90639
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
90640
-
90641
- const util = __webpack_require__(/*! ../util */ "./node_modules/fast-xml-parser/src/util.js");
90642
-
90643
- //TODO: handle comments
90644
- function readDocType(xmlData, i){
90645
-
90646
- const entities = {};
90647
- if( xmlData[i + 3] === 'O' &&
90648
- xmlData[i + 4] === 'C' &&
90649
- xmlData[i + 5] === 'T' &&
90650
- xmlData[i + 6] === 'Y' &&
90651
- xmlData[i + 7] === 'P' &&
90652
- xmlData[i + 8] === 'E')
90653
- {
90654
- i = i+9;
90655
- let angleBracketsCount = 1;
90656
- let hasBody = false, comment = false;
90657
- let exp = "";
90658
- for(;i<xmlData.length;i++){
90659
- if (xmlData[i] === '<' && !comment) { //Determine the tag type
90660
- if( hasBody && isEntity(xmlData, i)){
90661
- i += 7;
90662
- let entityName, val;
90663
- [entityName, val,i] = readEntityExp(xmlData,i+1);
90664
- if(val.indexOf("&") === -1) //Parameter entities are not supported
90665
- entities[ validateEntityName(entityName) ] = {
90666
- regx : RegExp( `&${entityName};`,"g"),
90667
- val: val
90668
- };
90669
- }
90670
- else if( hasBody && isElement(xmlData, i)) i += 8;//Not supported
90671
- else if( hasBody && isAttlist(xmlData, i)) i += 8;//Not supported
90672
- else if( hasBody && isNotation(xmlData, i)) i += 9;//Not supported
90673
- else if( isComment) comment = true;
90674
- else throw new Error("Invalid DOCTYPE");
90675
-
90676
- angleBracketsCount++;
90677
- exp = "";
90678
- } else if (xmlData[i] === '>') { //Read tag content
90679
- if(comment){
90680
- if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){
90681
- comment = false;
90682
- angleBracketsCount--;
90683
- }
90684
- }else{
90685
- angleBracketsCount--;
90686
- }
90687
- if (angleBracketsCount === 0) {
90688
- break;
90689
- }
90690
- }else if( xmlData[i] === '['){
90691
- hasBody = true;
90692
- }else{
90693
- exp += xmlData[i];
90694
- }
90695
- }
90696
- if(angleBracketsCount !== 0){
90697
- throw new Error(`Unclosed DOCTYPE`);
90698
- }
90699
- }else{
90700
- throw new Error(`Invalid Tag instead of DOCTYPE`);
90701
- }
90702
- return {entities, i};
90703
- }
90704
-
90705
- function readEntityExp(xmlData,i){
90706
- //External entities are not supported
90707
- // <!ENTITY ext SYSTEM "http://normal-website.com" >
90708
-
90709
- //Parameter entities are not supported
90710
- // <!ENTITY entityname "&anotherElement;">
90711
-
90712
- //Internal entities are supported
90713
- // <!ENTITY entityname "replacement text">
90714
-
90715
- //read EntityName
90716
- let entityName = "";
90717
- for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"' ); i++) {
90718
- // if(xmlData[i] === " ") continue;
90719
- // else
90720
- entityName += xmlData[i];
90721
- }
90722
- entityName = entityName.trim();
90723
- if(entityName.indexOf(" ") !== -1) throw new Error("External entites are not supported");
90724
-
90725
- //read Entity Value
90726
- const startChar = xmlData[i++];
90727
- let val = ""
90728
- for (; i < xmlData.length && xmlData[i] !== startChar ; i++) {
90729
- val += xmlData[i];
90730
- }
90731
- return [entityName, val, i];
90732
- }
90733
-
90734
- function isComment(xmlData, i){
90735
- if(xmlData[i+1] === '!' &&
90736
- xmlData[i+2] === '-' &&
90737
- xmlData[i+3] === '-') return true
90738
- return false
90739
- }
90740
- function isEntity(xmlData, i){
90741
- if(xmlData[i+1] === '!' &&
90742
- xmlData[i+2] === 'E' &&
90743
- xmlData[i+3] === 'N' &&
90744
- xmlData[i+4] === 'T' &&
90745
- xmlData[i+5] === 'I' &&
90746
- xmlData[i+6] === 'T' &&
90747
- xmlData[i+7] === 'Y') return true
90748
- return false
90749
- }
90750
- function isElement(xmlData, i){
90751
- if(xmlData[i+1] === '!' &&
90752
- xmlData[i+2] === 'E' &&
90753
- xmlData[i+3] === 'L' &&
90754
- xmlData[i+4] === 'E' &&
90755
- xmlData[i+5] === 'M' &&
90756
- xmlData[i+6] === 'E' &&
90757
- xmlData[i+7] === 'N' &&
90758
- xmlData[i+8] === 'T') return true
90759
- return false
90760
- }
90761
-
90762
- function isAttlist(xmlData, i){
90763
- if(xmlData[i+1] === '!' &&
90764
- xmlData[i+2] === 'A' &&
90765
- xmlData[i+3] === 'T' &&
90766
- xmlData[i+4] === 'T' &&
90767
- xmlData[i+5] === 'L' &&
90768
- xmlData[i+6] === 'I' &&
90769
- xmlData[i+7] === 'S' &&
90770
- xmlData[i+8] === 'T') return true
90771
- return false
90772
- }
90773
- function isNotation(xmlData, i){
90774
- if(xmlData[i+1] === '!' &&
90775
- xmlData[i+2] === 'N' &&
90776
- xmlData[i+3] === 'O' &&
90777
- xmlData[i+4] === 'T' &&
90778
- xmlData[i+5] === 'A' &&
90779
- xmlData[i+6] === 'T' &&
90780
- xmlData[i+7] === 'I' &&
90781
- xmlData[i+8] === 'O' &&
90782
- xmlData[i+9] === 'N') return true
90783
- return false
90784
- }
90785
-
90786
- function validateEntityName(name){
90787
- if (util.isName(name))
90788
- return name;
90789
- else
90790
- throw new Error(`Invalid entity name ${name}`);
90791
- }
90792
-
90793
- module.exports = readDocType;
89684
+ /***/ "./src/validator.js":
89685
+ /*!**************************!*\
89686
+ !*** ./src/validator.js ***!
89687
+ \**************************/
89688
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
90794
89689
 
89690
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ validate: () => (/* binding */ validate)\n/* harmony export */ });\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util.js */ \"./src/util.js\");\n\n\n\n\nconst defaultOptions = {\n allowBooleanAttributes: false, //A tag can have attributes without any value\n unpairedTags: []\n};\n\n//const tagsPattern = new RegExp(\"<\\\\/?([\\\\w:\\\\-_\\.]+)\\\\s*\\/?>\",\"g\");\nfunction validate(xmlData, options) {\n options = Object.assign({}, defaultOptions, options);\n\n //xmlData = xmlData.replace(/(\\r\\n|\\n|\\r)/gm,\"\");//make it single line\n //xmlData = xmlData.replace(/(^\\s*<\\?xml.*?\\?>)/g,\"\");//Remove XML starting tag\n //xmlData = xmlData.replace(/(<!DOCTYPE[\\s\\w\\\"\\.\\/\\-\\:]+(\\[.*\\])*\\s*>)/g,\"\");//Remove DOCTYPE\n const tags = [];\n let tagFound = false;\n\n //indicates that the root tag has been closed (aka. depth 0 has been reached)\n let reachedRoot = false;\n\n if (xmlData[0] === '\\ufeff') {\n // check for byte order mark (BOM)\n xmlData = xmlData.substr(1);\n }\n \n for (let i = 0; i < xmlData.length; i++) {\n\n if (xmlData[i] === '<' && xmlData[i+1] === '?') {\n i+=2;\n i = readPI(xmlData,i);\n if (i.err) return i;\n }else if (xmlData[i] === '<') {\n //starting of tag\n //read until you reach to '>' avoiding any '>' in attribute value\n let tagStartPos = i;\n i++;\n \n if (xmlData[i] === '!') {\n i = readCommentAndCDATA(xmlData, i);\n continue;\n } else {\n let closingTag = false;\n if (xmlData[i] === '/') {\n //closing tag\n closingTag = true;\n i++;\n }\n //read tagname\n let tagName = '';\n for (; i < xmlData.length &&\n xmlData[i] !== '>' &&\n xmlData[i] !== ' ' &&\n xmlData[i] !== '\\t' &&\n xmlData[i] !== '\\n' &&\n xmlData[i] !== '\\r'; i++\n ) {\n tagName += xmlData[i];\n }\n tagName = tagName.trim();\n //console.log(tagName);\n\n if (tagName[tagName.length - 1] === '/') {\n //self closing tag without attributes\n tagName = tagName.substring(0, tagName.length - 1);\n //continue;\n i--;\n }\n if (!validateTagName(tagName)) {\n let msg;\n if (tagName.trim().length === 0) {\n msg = \"Invalid space after '<'.\";\n } else {\n msg = \"Tag '\"+tagName+\"' is an invalid name.\";\n }\n return getErrorObject('InvalidTag', msg, getLineNumberForPosition(xmlData, i));\n }\n\n const result = readAttributeStr(xmlData, i);\n if (result === false) {\n return getErrorObject('InvalidAttr', \"Attributes for '\"+tagName+\"' have open quote.\", getLineNumberForPosition(xmlData, i));\n }\n let attrStr = result.value;\n i = result.index;\n\n if (attrStr[attrStr.length - 1] === '/') {\n //self closing tag\n const attrStrStart = i - attrStr.length;\n attrStr = attrStr.substring(0, attrStr.length - 1);\n const isValid = validateAttributeString(attrStr, options);\n if (isValid === true) {\n tagFound = true;\n //continue; //text may presents after self closing tag\n } else {\n //the result from the nested function returns the position of the error within the attribute\n //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute\n //this gives us the absolute index in the entire xml, which we can use to find the line at last\n return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));\n }\n } else if (closingTag) {\n if (!result.tagClosed) {\n return getErrorObject('InvalidTag', \"Closing tag '\"+tagName+\"' doesn't have proper closing.\", getLineNumberForPosition(xmlData, i));\n } else if (attrStr.trim().length > 0) {\n return getErrorObject('InvalidTag', \"Closing tag '\"+tagName+\"' can't have attributes or invalid starting.\", getLineNumberForPosition(xmlData, tagStartPos));\n } else if (tags.length === 0) {\n return getErrorObject('InvalidTag', \"Closing tag '\"+tagName+\"' has not been opened.\", getLineNumberForPosition(xmlData, tagStartPos));\n } else {\n const otg = tags.pop();\n if (tagName !== otg.tagName) {\n let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);\n return getErrorObject('InvalidTag',\n \"Expected closing tag '\"+otg.tagName+\"' (opened in line \"+openPos.line+\", col \"+openPos.col+\") instead of closing tag '\"+tagName+\"'.\",\n getLineNumberForPosition(xmlData, tagStartPos));\n }\n\n //when there are no more tags, we reached the root level.\n if (tags.length == 0) {\n reachedRoot = true;\n }\n }\n } else {\n const isValid = validateAttributeString(attrStr, options);\n if (isValid !== true) {\n //the result from the nested function returns the position of the error within the attribute\n //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute\n //this gives us the absolute index in the entire xml, which we can use to find the line at last\n return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));\n }\n\n //if the root level has been reached before ...\n if (reachedRoot === true) {\n return getErrorObject('InvalidXml', 'Multiple possible root nodes found.', getLineNumberForPosition(xmlData, i));\n } else if(options.unpairedTags.indexOf(tagName) !== -1){\n //don't push into stack\n } else {\n tags.push({tagName, tagStartPos});\n }\n tagFound = true;\n }\n\n //skip tag text value\n //It may include comments and CDATA value\n for (i++; i < xmlData.length; i++) {\n if (xmlData[i] === '<') {\n if (xmlData[i + 1] === '!') {\n //comment or CADATA\n i++;\n i = readCommentAndCDATA(xmlData, i);\n continue;\n } else if (xmlData[i+1] === '?') {\n i = readPI(xmlData, ++i);\n if (i.err) return i;\n } else{\n break;\n }\n } else if (xmlData[i] === '&') {\n const afterAmp = validateAmpersand(xmlData, i);\n if (afterAmp == -1)\n return getErrorObject('InvalidChar', \"char '&' is not expected.\", getLineNumberForPosition(xmlData, i));\n i = afterAmp;\n }else{\n if (reachedRoot === true && !isWhiteSpace(xmlData[i])) {\n return getErrorObject('InvalidXml', \"Extra text at the end\", getLineNumberForPosition(xmlData, i));\n }\n }\n } //end of reading tag text value\n if (xmlData[i] === '<') {\n i--;\n }\n }\n } else {\n if ( isWhiteSpace(xmlData[i])) {\n continue;\n }\n return getErrorObject('InvalidChar', \"char '\"+xmlData[i]+\"' is not expected.\", getLineNumberForPosition(xmlData, i));\n }\n }\n\n if (!tagFound) {\n return getErrorObject('InvalidXml', 'Start tag expected.', 1);\n }else if (tags.length == 1) {\n return getErrorObject('InvalidTag', \"Unclosed tag '\"+tags[0].tagName+\"'.\", getLineNumberForPosition(xmlData, tags[0].tagStartPos));\n }else if (tags.length > 0) {\n return getErrorObject('InvalidXml', \"Invalid '\"+\n JSON.stringify(tags.map(t => t.tagName), null, 4).replace(/\\r?\\n/g, '')+\n \"' found.\", {line: 1, col: 1});\n }\n\n return true;\n};\n\nfunction isWhiteSpace(char){\n return char === ' ' || char === '\\t' || char === '\\n' || char === '\\r';\n}\n/**\n * Read Processing insstructions and skip\n * @param {*} xmlData\n * @param {*} i\n */\nfunction readPI(xmlData, i) {\n const start = i;\n for (; i < xmlData.length; i++) {\n if (xmlData[i] == '?' || xmlData[i] == ' ') {\n //tagname\n const tagname = xmlData.substr(start, i - start);\n if (i > 5 && tagname === 'xml') {\n return getErrorObject('InvalidXml', 'XML declaration allowed only at the start of the document.', getLineNumberForPosition(xmlData, i));\n } else if (xmlData[i] == '?' && xmlData[i + 1] == '>') {\n //check if valid attribut string\n i++;\n break;\n } else {\n continue;\n }\n }\n }\n return i;\n}\n\nfunction readCommentAndCDATA(xmlData, i) {\n if (xmlData.length > i + 5 && xmlData[i + 1] === '-' && xmlData[i + 2] === '-') {\n //comment\n for (i += 3; i < xmlData.length; i++) {\n if (xmlData[i] === '-' && xmlData[i + 1] === '-' && xmlData[i + 2] === '>') {\n i += 2;\n break;\n }\n }\n } else if (\n xmlData.length > i + 8 &&\n xmlData[i + 1] === 'D' &&\n xmlData[i + 2] === 'O' &&\n xmlData[i + 3] === 'C' &&\n xmlData[i + 4] === 'T' &&\n xmlData[i + 5] === 'Y' &&\n xmlData[i + 6] === 'P' &&\n xmlData[i + 7] === 'E'\n ) {\n let angleBracketsCount = 1;\n for (i += 8; i < xmlData.length; i++) {\n if (xmlData[i] === '<') {\n angleBracketsCount++;\n } else if (xmlData[i] === '>') {\n angleBracketsCount--;\n if (angleBracketsCount === 0) {\n break;\n }\n }\n }\n } else if (\n xmlData.length > i + 9 &&\n xmlData[i + 1] === '[' &&\n xmlData[i + 2] === 'C' &&\n xmlData[i + 3] === 'D' &&\n xmlData[i + 4] === 'A' &&\n xmlData[i + 5] === 'T' &&\n xmlData[i + 6] === 'A' &&\n xmlData[i + 7] === '['\n ) {\n for (i += 8; i < xmlData.length; i++) {\n if (xmlData[i] === ']' && xmlData[i + 1] === ']' && xmlData[i + 2] === '>') {\n i += 2;\n break;\n }\n }\n }\n\n return i;\n}\n\nconst doubleQuote = '\"';\nconst singleQuote = \"'\";\n\n/**\n * Keep reading xmlData until '<' is found outside the attribute value.\n * @param {string} xmlData\n * @param {number} i\n */\nfunction readAttributeStr(xmlData, i) {\n let attrStr = '';\n let startChar = '';\n let tagClosed = false;\n for (; i < xmlData.length; i++) {\n if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {\n if (startChar === '') {\n startChar = xmlData[i];\n } else if (startChar !== xmlData[i]) {\n //if vaue is enclosed with double quote then single quotes are allowed inside the value and vice versa\n } else {\n startChar = '';\n }\n } else if (xmlData[i] === '>') {\n if (startChar === '') {\n tagClosed = true;\n break;\n }\n }\n attrStr += xmlData[i];\n }\n if (startChar !== '') {\n return false;\n }\n\n return {\n value: attrStr,\n index: i,\n tagClosed: tagClosed\n };\n}\n\n/**\n * Select all the attributes whether valid or invalid.\n */\nconst validAttrStrRegxp = new RegExp('(\\\\s*)([^\\\\s=]+)(\\\\s*=)?(\\\\s*([\\'\"])(([\\\\s\\\\S])*?)\\\\5)?', 'g');\n\n//attr, =\"sd\", a=\"amit's\", a=\"sd\"b=\"saf\", ab cd=\"\"\n\nfunction validateAttributeString(attrStr, options) {\n //console.log(\"start:\"+attrStr+\":end\");\n\n //if(attrStr.trim().length === 0) return true; //empty string\n\n const matches = (0,_util_js__WEBPACK_IMPORTED_MODULE_0__.getAllMatches)(attrStr, validAttrStrRegxp);\n const attrNames = {};\n\n for (let i = 0; i < matches.length; i++) {\n if (matches[i][1].length === 0) {\n //nospace before attribute name: a=\"sd\"b=\"saf\"\n return getErrorObject('InvalidAttr', \"Attribute '\"+matches[i][2]+\"' has no space in starting.\", getPositionFromMatch(matches[i]))\n } else if (matches[i][3] !== undefined && matches[i][4] === undefined) {\n return getErrorObject('InvalidAttr', \"Attribute '\"+matches[i][2]+\"' is without value.\", getPositionFromMatch(matches[i]));\n } else if (matches[i][3] === undefined && !options.allowBooleanAttributes) {\n //independent attribute: ab\n return getErrorObject('InvalidAttr', \"boolean attribute '\"+matches[i][2]+\"' is not allowed.\", getPositionFromMatch(matches[i]));\n }\n /* else if(matches[i][6] === undefined){//attribute without value: ab=\n return { err: { code:\"InvalidAttr\",msg:\"attribute \" + matches[i][2] + \" has no value assigned.\"}};\n } */\n const attrName = matches[i][2];\n if (!validateAttrName(attrName)) {\n return getErrorObject('InvalidAttr', \"Attribute '\"+attrName+\"' is an invalid name.\", getPositionFromMatch(matches[i]));\n }\n if (!attrNames.hasOwnProperty(attrName)) {\n //check for duplicate attribute.\n attrNames[attrName] = 1;\n } else {\n return getErrorObject('InvalidAttr', \"Attribute '\"+attrName+\"' is repeated.\", getPositionFromMatch(matches[i]));\n }\n }\n\n return true;\n}\n\nfunction validateNumberAmpersand(xmlData, i) {\n let re = /\\d/;\n if (xmlData[i] === 'x') {\n i++;\n re = /[\\da-fA-F]/;\n }\n for (; i < xmlData.length; i++) {\n if (xmlData[i] === ';')\n return i;\n if (!xmlData[i].match(re))\n break;\n }\n return -1;\n}\n\nfunction validateAmpersand(xmlData, i) {\n // https://www.w3.org/TR/xml/#dt-charref\n i++;\n if (xmlData[i] === ';')\n return -1;\n if (xmlData[i] === '#') {\n i++;\n return validateNumberAmpersand(xmlData, i);\n }\n let count = 0;\n for (; i < xmlData.length; i++, count++) {\n if (xmlData[i].match(/\\w/) && count < 20)\n continue;\n if (xmlData[i] === ';')\n break;\n return -1;\n }\n return i;\n}\n\nfunction getErrorObject(code, message, lineNumber) {\n return {\n err: {\n code: code,\n msg: message,\n line: lineNumber.line || lineNumber,\n col: lineNumber.col,\n },\n };\n}\n\nfunction validateAttrName(attrName) {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_0__.isName)(attrName);\n}\n\n// const startsWithXML = /^xml/i;\n\nfunction validateTagName(tagname) {\n return (0,_util_js__WEBPACK_IMPORTED_MODULE_0__.isName)(tagname) /* && !tagname.match(startsWithXML) */;\n}\n\n//this function returns the line number for the character at the given index\nfunction getLineNumberForPosition(xmlData, index) {\n const lines = xmlData.substring(0, index).split(/\\r?\\n/);\n return {\n line: lines.length,\n\n // column number is last line's length + 1, because column numbering starts at 1:\n col: lines[lines.length - 1].length + 1\n };\n}\n\n//this function returns the position of the first character of match within attrStr\nfunction getPositionFromMatch(match) {\n return match.startIndex + match[1].length;\n}\n\n\n//# sourceURL=webpack://fast-xml-parser/./src/validator.js?");
90795
89691
 
90796
89692
  /***/ }),
90797
89693
 
90798
- /***/ "./node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js":
90799
- /*!**********************************************************************!*\
90800
- !*** ./node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js ***!
90801
- \**********************************************************************/
90802
- /***/ ((__unused_webpack_module, exports) => {
90803
-
90804
-
90805
- const defaultOptions = {
90806
- preserveOrder: false,
90807
- attributeNamePrefix: '@_',
90808
- attributesGroupName: false,
90809
- textNodeName: '#text',
90810
- ignoreAttributes: true,
90811
- removeNSPrefix: false, // remove NS from tag name or attribute name if true
90812
- allowBooleanAttributes: false, //a tag can have attributes without any value
90813
- //ignoreRootElement : false,
90814
- parseTagValue: true,
90815
- parseAttributeValue: false,
90816
- trimValues: true, //Trim string values of tag and attributes
90817
- cdataPropName: false,
90818
- numberParseOptions: {
90819
- hex: true,
90820
- leadingZeros: true,
90821
- eNotation: true
90822
- },
90823
- tagValueProcessor: function(tagName, val) {
90824
- return val;
90825
- },
90826
- attributeValueProcessor: function(attrName, val) {
90827
- return val;
90828
- },
90829
- stopNodes: [], //nested tags will not be parsed even for errors
90830
- alwaysCreateTextNode: false,
90831
- isArray: () => false,
90832
- commentPropName: false,
90833
- unpairedTags: [],
90834
- processEntities: true,
90835
- htmlEntities: false,
90836
- ignoreDeclaration: false,
90837
- ignorePiTags: false,
90838
- transformTagName: false,
90839
- transformAttributeName: false,
90840
- updateTag: function(tagName, jPath, attrs){
90841
- return tagName
90842
- },
90843
- // skipEmptyListItem: false
90844
- };
90845
-
90846
- const buildOptions = function(options) {
90847
- return Object.assign({}, defaultOptions, options);
90848
- };
89694
+ /***/ "./src/xmlbuilder/json2xml.js":
89695
+ /*!************************************!*\
89696
+ !*** ./src/xmlbuilder/json2xml.js ***!
89697
+ \************************************/
89698
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
90849
89699
 
90850
- exports.buildOptions = buildOptions;
90851
- exports.defaultOptions = defaultOptions;
89700
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Builder)\n/* harmony export */ });\n/* harmony import */ var _orderedJs2Xml_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./orderedJs2Xml.js */ \"./src/xmlbuilder/orderedJs2Xml.js\");\n/* harmony import */ var _ignoreAttributes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ignoreAttributes.js */ \"./src/ignoreAttributes.js\");\n\n//parse Empty Node as self closing node\n\n\n\nconst defaultOptions = {\n attributeNamePrefix: '@_',\n attributesGroupName: false,\n textNodeName: '#text',\n ignoreAttributes: true,\n cdataPropName: false,\n format: false,\n indentBy: ' ',\n suppressEmptyNode: false,\n suppressUnpairedNode: true,\n suppressBooleanAttributes: true,\n tagValueProcessor: function(key, a) {\n return a;\n },\n attributeValueProcessor: function(attrName, a) {\n return a;\n },\n preserveOrder: false,\n commentPropName: false,\n unpairedTags: [],\n entities: [\n { regex: new RegExp(\"&\", \"g\"), val: \"&amp;\" },//it must be on top\n { regex: new RegExp(\">\", \"g\"), val: \"&gt;\" },\n { regex: new RegExp(\"<\", \"g\"), val: \"&lt;\" },\n { regex: new RegExp(\"\\'\", \"g\"), val: \"&apos;\" },\n { regex: new RegExp(\"\\\"\", \"g\"), val: \"&quot;\" }\n ],\n processEntities: true,\n stopNodes: [],\n // transformTagName: false,\n // transformAttributeName: false,\n oneListGroup: false\n};\n\nfunction Builder(options) {\n this.options = Object.assign({}, defaultOptions, options);\n if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {\n this.isAttribute = function(/*a*/) {\n return false;\n };\n } else {\n this.ignoreAttributesFn = (0,_ignoreAttributes_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(this.options.ignoreAttributes)\n this.attrPrefixLen = this.options.attributeNamePrefix.length;\n this.isAttribute = isAttribute;\n }\n\n this.processTextOrObjNode = processTextOrObjNode\n\n if (this.options.format) {\n this.indentate = indentate;\n this.tagEndChar = '>\\n';\n this.newLine = '\\n';\n } else {\n this.indentate = function() {\n return '';\n };\n this.tagEndChar = '>';\n this.newLine = '';\n }\n}\n\nBuilder.prototype.build = function(jObj) {\n if(this.options.preserveOrder){\n return (0,_orderedJs2Xml_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(jObj, this.options);\n }else {\n if(Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1){\n jObj = {\n [this.options.arrayNodeName] : jObj\n }\n }\n return this.j2x(jObj, 0, []).val;\n }\n};\n\nBuilder.prototype.j2x = function(jObj, level, ajPath) {\n let attrStr = '';\n let val = '';\n const jPath = ajPath.join('.')\n for (let key in jObj) {\n if(!Object.prototype.hasOwnProperty.call(jObj, key)) continue;\n if (typeof jObj[key] === 'undefined') {\n // supress undefined node only if it is not an attribute\n if (this.isAttribute(key)) {\n val += '';\n }\n } else if (jObj[key] === null) {\n // null attribute should be ignored by the attribute list, but should not cause the tag closing\n if (this.isAttribute(key)) {\n val += '';\n } else if (key === this.options.cdataPropName) {\n val += '';\n } else if (key[0] === '?') {\n val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;\n } else {\n val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n }\n // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n } else if (jObj[key] instanceof Date) {\n val += this.buildTextValNode(jObj[key], key, '', level);\n } else if (typeof jObj[key] !== 'object') {\n //premitive type\n const attr = this.isAttribute(key);\n if (attr && !this.ignoreAttributesFn(attr, jPath)) {\n attrStr += this.buildAttrPairStr(attr, '' + jObj[key]);\n } else if (!attr) {\n //tag value\n if (key === this.options.textNodeName) {\n let newval = this.options.tagValueProcessor(key, '' + jObj[key]);\n val += this.replaceEntitiesValue(newval);\n } else {\n val += this.buildTextValNode(jObj[key], key, '', level);\n }\n }\n } else if (Array.isArray(jObj[key])) {\n //repeated nodes\n const arrLen = jObj[key].length;\n let listTagVal = \"\";\n let listTagAttr = \"\";\n for (let j = 0; j < arrLen; j++) {\n const item = jObj[key][j];\n if (typeof item === 'undefined') {\n // supress undefined node\n } else if (item === null) {\n if(key[0] === \"?\") val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;\n else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n } else if (typeof item === 'object') {\n if(this.options.oneListGroup){\n const result = this.j2x(item, level + 1, ajPath.concat(key));\n listTagVal += result.val;\n if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {\n listTagAttr += result.attrStr\n }\n }else{\n listTagVal += this.processTextOrObjNode(item, key, level, ajPath)\n }\n } else {\n if (this.options.oneListGroup) {\n let textValue = this.options.tagValueProcessor(key, item);\n textValue = this.replaceEntitiesValue(textValue);\n listTagVal += textValue;\n } else {\n listTagVal += this.buildTextValNode(item, key, '', level);\n }\n }\n }\n if(this.options.oneListGroup){\n listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);\n }\n val += listTagVal;\n } else {\n //nested node\n if (this.options.attributesGroupName && key === this.options.attributesGroupName) {\n const Ks = Object.keys(jObj[key]);\n const L = Ks.length;\n for (let j = 0; j < L; j++) {\n attrStr += this.buildAttrPairStr(Ks[j], '' + jObj[key][Ks[j]]);\n }\n } else {\n val += this.processTextOrObjNode(jObj[key], key, level, ajPath)\n }\n }\n }\n return {attrStr: attrStr, val: val};\n};\n\nBuilder.prototype.buildAttrPairStr = function(attrName, val){\n val = this.options.attributeValueProcessor(attrName, '' + val);\n val = this.replaceEntitiesValue(val);\n if (this.options.suppressBooleanAttributes && val === \"true\") {\n return ' ' + attrName;\n } else return ' ' + attrName + '=\"' + val + '\"';\n}\n\nfunction processTextOrObjNode (object, key, level, ajPath) {\n const result = this.j2x(object, level + 1, ajPath.concat(key));\n if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) {\n return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);\n } else {\n return this.buildObjectNode(result.val, key, result.attrStr, level);\n }\n}\n\nBuilder.prototype.buildObjectNode = function(val, key, attrStr, level) {\n if(val === \"\"){\n if(key[0] === \"?\") return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;\n else {\n return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;\n }\n }else{\n\n let tagEndExp = '</' + key + this.tagEndChar;\n let piClosingChar = \"\";\n \n if(key[0] === \"?\") {\n piClosingChar = \"?\";\n tagEndExp = \"\";\n }\n \n // attrStr is an empty string in case the attribute came as undefined or null\n if ((attrStr || attrStr === '') && val.indexOf('<') === -1) {\n return ( this.indentate(level) + '<' + key + attrStr + piClosingChar + '>' + val + tagEndExp );\n } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {\n return this.indentate(level) + `<!--${val}-->` + this.newLine;\n }else {\n return (\n this.indentate(level) + '<' + key + attrStr + piClosingChar + this.tagEndChar +\n val +\n this.indentate(level) + tagEndExp );\n }\n }\n}\n\nBuilder.prototype.closeTag = function(key){\n let closeTag = \"\";\n if(this.options.unpairedTags.indexOf(key) !== -1){ //unpaired\n if(!this.options.suppressUnpairedNode) closeTag = \"/\"\n }else if(this.options.suppressEmptyNode){ //empty\n closeTag = \"/\";\n }else{\n closeTag = `></${key}`\n }\n return closeTag;\n}\n\nfunction buildEmptyObjNode(val, key, attrStr, level) {\n if (val !== '') {\n return this.buildObjectNode(val, key, attrStr, level);\n } else {\n if(key[0] === \"?\") return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;\n else {\n return this.indentate(level) + '<' + key + attrStr + '/' + this.tagEndChar;\n // return this.buildTagStr(level,key, attrStr);\n }\n }\n}\n\nBuilder.prototype.buildTextValNode = function(val, key, attrStr, level) {\n if (this.options.cdataPropName !== false && key === this.options.cdataPropName) {\n return this.indentate(level) + `<![CDATA[${val}]]>` + this.newLine;\n }else if (this.options.commentPropName !== false && key === this.options.commentPropName) {\n return this.indentate(level) + `<!--${val}-->` + this.newLine;\n }else if(key[0] === \"?\") {//PI tag\n return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar; \n }else{\n let textValue = this.options.tagValueProcessor(key, val);\n textValue = this.replaceEntitiesValue(textValue);\n \n if( textValue === ''){\n return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;\n }else{\n return this.indentate(level) + '<' + key + attrStr + '>' +\n textValue +\n '</' + key + this.tagEndChar;\n }\n }\n}\n\nBuilder.prototype.replaceEntitiesValue = function(textValue){\n if(textValue && textValue.length > 0 && this.options.processEntities){\n for (let i=0; i<this.options.entities.length; i++) {\n const entity = this.options.entities[i];\n textValue = textValue.replace(entity.regex, entity.val);\n }\n }\n return textValue;\n}\n\nfunction indentate(level) {\n return this.options.indentBy.repeat(level);\n}\n\nfunction isAttribute(name /*, options*/) {\n if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {\n return name.substr(this.attrPrefixLen);\n } else {\n return false;\n }\n}\n\n\n\n//# sourceURL=webpack://fast-xml-parser/./src/xmlbuilder/json2xml.js?");
90852
89701
 
90853
89702
  /***/ }),
90854
89703
 
90855
- /***/ "./node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js":
90856
- /*!************************************************************************!*\
90857
- !*** ./node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js ***!
90858
- \************************************************************************/
90859
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
90860
-
90861
- "use strict";
90862
-
90863
- ///@ts-check
90864
-
90865
- const util = __webpack_require__(/*! ../util */ "./node_modules/fast-xml-parser/src/util.js");
90866
- const xmlNode = __webpack_require__(/*! ./xmlNode */ "./node_modules/fast-xml-parser/src/xmlparser/xmlNode.js");
90867
- const readDocType = __webpack_require__(/*! ./DocTypeReader */ "./node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js");
90868
- const toNumber = __webpack_require__(/*! strnum */ "./node_modules/strnum/strnum.js");
90869
- const getIgnoreAttributesFn = __webpack_require__(/*! ../ignoreAttributes */ "./node_modules/fast-xml-parser/src/ignoreAttributes.js")
90870
-
90871
- // const regx =
90872
- // '<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)'
90873
- // .replace(/NAME/g, util.nameRegexp);
90874
-
90875
- //const tagsRegx = new RegExp("<(\\/?[\\w:\\-\._]+)([^>]*)>(\\s*"+cdataRegx+")*([^<]+)?","g");
90876
- //const tagsRegx = new RegExp("<(\\/?)((\\w*:)?([\\w:\\-\._]+))([^>]*)>([^<]*)("+cdataRegx+"([^<]*))*([^<]+)?","g");
90877
-
90878
- class OrderedObjParser{
90879
- constructor(options){
90880
- this.options = options;
90881
- this.currentNode = null;
90882
- this.tagsNodeStack = [];
90883
- this.docTypeEntities = {};
90884
- this.lastEntities = {
90885
- "apos" : { regex: /&(apos|#39|#x27);/g, val : "'"},
90886
- "gt" : { regex: /&(gt|#62|#x3E);/g, val : ">"},
90887
- "lt" : { regex: /&(lt|#60|#x3C);/g, val : "<"},
90888
- "quot" : { regex: /&(quot|#34|#x22);/g, val : "\""},
90889
- };
90890
- this.ampEntity = { regex: /&(amp|#38|#x26);/g, val : "&"};
90891
- this.htmlEntities = {
90892
- "space": { regex: /&(nbsp|#160);/g, val: " " },
90893
- // "lt" : { regex: /&(lt|#60);/g, val: "<" },
90894
- // "gt" : { regex: /&(gt|#62);/g, val: ">" },
90895
- // "amp" : { regex: /&(amp|#38);/g, val: "&" },
90896
- // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
90897
- // "apos" : { regex: /&(apos|#39);/g, val: "'" },
90898
- "cent" : { regex: /&(cent|#162);/g, val: "¢" },
90899
- "pound" : { regex: /&(pound|#163);/g, val: "£" },
90900
- "yen" : { regex: /&(yen|#165);/g, val: "¥" },
90901
- "euro" : { regex: /&(euro|#8364);/g, val: "€" },
90902
- "copyright" : { regex: /&(copy|#169);/g, val: "©" },
90903
- "reg" : { regex: /&(reg|#174);/g, val: "®" },
90904
- "inr" : { regex: /&(inr|#8377);/g, val: "₹" },
90905
- "num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 10)) },
90906
- "num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 16)) },
90907
- };
90908
- this.addExternalEntities = addExternalEntities;
90909
- this.parseXml = parseXml;
90910
- this.parseTextData = parseTextData;
90911
- this.resolveNameSpace = resolveNameSpace;
90912
- this.buildAttributesMap = buildAttributesMap;
90913
- this.isItStopNode = isItStopNode;
90914
- this.replaceEntitiesValue = replaceEntitiesValue;
90915
- this.readStopNodeData = readStopNodeData;
90916
- this.saveTextToParentTag = saveTextToParentTag;
90917
- this.addChild = addChild;
90918
- this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes)
90919
- }
90920
-
90921
- }
90922
-
90923
- function addExternalEntities(externalEntities){
90924
- const entKeys = Object.keys(externalEntities);
90925
- for (let i = 0; i < entKeys.length; i++) {
90926
- const ent = entKeys[i];
90927
- this.lastEntities[ent] = {
90928
- regex: new RegExp("&"+ent+";","g"),
90929
- val : externalEntities[ent]
90930
- }
90931
- }
90932
- }
90933
-
90934
- /**
90935
- * @param {string} val
90936
- * @param {string} tagName
90937
- * @param {string} jPath
90938
- * @param {boolean} dontTrim
90939
- * @param {boolean} hasAttributes
90940
- * @param {boolean} isLeafNode
90941
- * @param {boolean} escapeEntities
90942
- */
90943
- function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
90944
- if (val !== undefined) {
90945
- if (this.options.trimValues && !dontTrim) {
90946
- val = val.trim();
90947
- }
90948
- if(val.length > 0){
90949
- if(!escapeEntities) val = this.replaceEntitiesValue(val);
90950
-
90951
- const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
90952
- if(newval === null || newval === undefined){
90953
- //don't parse
90954
- return val;
90955
- }else if(typeof newval !== typeof val || newval !== val){
90956
- //overwrite
90957
- return newval;
90958
- }else if(this.options.trimValues){
90959
- return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
90960
- }else{
90961
- const trimmedVal = val.trim();
90962
- if(trimmedVal === val){
90963
- return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
90964
- }else{
90965
- return val;
90966
- }
90967
- }
90968
- }
90969
- }
90970
- }
90971
-
90972
- function resolveNameSpace(tagname) {
90973
- if (this.options.removeNSPrefix) {
90974
- const tags = tagname.split(':');
90975
- const prefix = tagname.charAt(0) === '/' ? '/' : '';
90976
- if (tags[0] === 'xmlns') {
90977
- return '';
90978
- }
90979
- if (tags.length === 2) {
90980
- tagname = prefix + tags[1];
90981
- }
90982
- }
90983
- return tagname;
90984
- }
90985
-
90986
- //TODO: change regex to capture NS
90987
- //const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm");
90988
- const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm');
90989
-
90990
- function buildAttributesMap(attrStr, jPath, tagName) {
90991
- if (this.options.ignoreAttributes !== true && typeof attrStr === 'string') {
90992
- // attrStr = attrStr.replace(/\r?\n/g, ' ');
90993
- //attrStr = attrStr || attrStr.trim();
90994
-
90995
- const matches = util.getAllMatches(attrStr, attrsRegx);
90996
- const len = matches.length; //don't make it inline
90997
- const attrs = {};
90998
- for (let i = 0; i < len; i++) {
90999
- const attrName = this.resolveNameSpace(matches[i][1]);
91000
- if (this.ignoreAttributesFn(attrName, jPath)) {
91001
- continue
91002
- }
91003
- let oldVal = matches[i][4];
91004
- let aName = this.options.attributeNamePrefix + attrName;
91005
- if (attrName.length) {
91006
- if (this.options.transformAttributeName) {
91007
- aName = this.options.transformAttributeName(aName);
91008
- }
91009
- if(aName === "__proto__") aName = "#__proto__";
91010
- if (oldVal !== undefined) {
91011
- if (this.options.trimValues) {
91012
- oldVal = oldVal.trim();
91013
- }
91014
- oldVal = this.replaceEntitiesValue(oldVal);
91015
- const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
91016
- if(newVal === null || newVal === undefined){
91017
- //don't parse
91018
- attrs[aName] = oldVal;
91019
- }else if(typeof newVal !== typeof oldVal || newVal !== oldVal){
91020
- //overwrite
91021
- attrs[aName] = newVal;
91022
- }else{
91023
- //parse
91024
- attrs[aName] = parseValue(
91025
- oldVal,
91026
- this.options.parseAttributeValue,
91027
- this.options.numberParseOptions
91028
- );
91029
- }
91030
- } else if (this.options.allowBooleanAttributes) {
91031
- attrs[aName] = true;
91032
- }
91033
- }
91034
- }
91035
- if (!Object.keys(attrs).length) {
91036
- return;
91037
- }
91038
- if (this.options.attributesGroupName) {
91039
- const attrCollection = {};
91040
- attrCollection[this.options.attributesGroupName] = attrs;
91041
- return attrCollection;
91042
- }
91043
- return attrs
91044
- }
91045
- }
91046
-
91047
- const parseXml = function(xmlData) {
91048
- xmlData = xmlData.replace(/\r\n?/g, "\n"); //TODO: remove this line
91049
- const xmlObj = new xmlNode('!xml');
91050
- let currentNode = xmlObj;
91051
- let textData = "";
91052
- let jPath = "";
91053
- for(let i=0; i< xmlData.length; i++){//for each char in XML data
91054
- const ch = xmlData[i];
91055
- if(ch === '<'){
91056
- // const nextIndex = i+1;
91057
- // const _2ndChar = xmlData[nextIndex];
91058
- if( xmlData[i+1] === '/') {//Closing Tag
91059
- const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.")
91060
- let tagName = xmlData.substring(i+2,closeIndex).trim();
91061
-
91062
- if(this.options.removeNSPrefix){
91063
- const colonIndex = tagName.indexOf(":");
91064
- if(colonIndex !== -1){
91065
- tagName = tagName.substr(colonIndex+1);
91066
- }
91067
- }
91068
-
91069
- if(this.options.transformTagName) {
91070
- tagName = this.options.transformTagName(tagName);
91071
- }
91072
-
91073
- if(currentNode){
91074
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
91075
- }
91076
-
91077
- //check if last tag of nested tag was unpaired tag
91078
- const lastTagName = jPath.substring(jPath.lastIndexOf(".")+1);
91079
- if(tagName && this.options.unpairedTags.indexOf(tagName) !== -1 ){
91080
- throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
91081
- }
91082
- let propIndex = 0
91083
- if(lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1 ){
91084
- propIndex = jPath.lastIndexOf('.', jPath.lastIndexOf('.')-1)
91085
- this.tagsNodeStack.pop();
91086
- }else{
91087
- propIndex = jPath.lastIndexOf(".");
91088
- }
91089
- jPath = jPath.substring(0, propIndex);
91090
-
91091
- currentNode = this.tagsNodeStack.pop();//avoid recursion, set the parent tag scope
91092
- textData = "";
91093
- i = closeIndex;
91094
- } else if( xmlData[i+1] === '?') {
91095
-
91096
- let tagData = readTagExp(xmlData,i, false, "?>");
91097
- if(!tagData) throw new Error("Pi Tag is not closed.");
91098
-
91099
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
91100
- if( (this.options.ignoreDeclaration && tagData.tagName === "?xml") || this.options.ignorePiTags){
91101
-
91102
- }else{
91103
-
91104
- const childNode = new xmlNode(tagData.tagName);
91105
- childNode.add(this.options.textNodeName, "");
91106
-
91107
- if(tagData.tagName !== tagData.tagExp && tagData.attrExpPresent){
91108
- childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
91109
- }
91110
- this.addChild(currentNode, childNode, jPath)
91111
-
91112
- }
91113
-
91114
-
91115
- i = tagData.closeIndex + 1;
91116
- } else if(xmlData.substr(i + 1, 3) === '!--') {
91117
- const endIndex = findClosingIndex(xmlData, "-->", i+4, "Comment is not closed.")
91118
- if(this.options.commentPropName){
91119
- const comment = xmlData.substring(i + 4, endIndex - 2);
91120
-
91121
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
91122
-
91123
- currentNode.add(this.options.commentPropName, [ { [this.options.textNodeName] : comment } ]);
91124
- }
91125
- i = endIndex;
91126
- } else if( xmlData.substr(i + 1, 2) === '!D') {
91127
- const result = readDocType(xmlData, i);
91128
- this.docTypeEntities = result.entities;
91129
- i = result.i;
91130
- }else if(xmlData.substr(i + 1, 2) === '![') {
91131
- const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
91132
- const tagExp = xmlData.substring(i + 9,closeIndex);
91133
-
91134
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
91135
-
91136
- let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
91137
- if(val == undefined) val = "";
91138
-
91139
- //cdata should be set even if it is 0 length string
91140
- if(this.options.cdataPropName){
91141
- currentNode.add(this.options.cdataPropName, [ { [this.options.textNodeName] : tagExp } ]);
91142
- }else{
91143
- currentNode.add(this.options.textNodeName, val);
91144
- }
91145
-
91146
- i = closeIndex + 2;
91147
- }else {//Opening tag
91148
- let result = readTagExp(xmlData,i, this.options.removeNSPrefix);
91149
- let tagName= result.tagName;
91150
- const rawTagName = result.rawTagName;
91151
- let tagExp = result.tagExp;
91152
- let attrExpPresent = result.attrExpPresent;
91153
- let closeIndex = result.closeIndex;
91154
-
91155
- if (this.options.transformTagName) {
91156
- tagName = this.options.transformTagName(tagName);
91157
- }
91158
-
91159
- //save text as child node
91160
- if (currentNode && textData) {
91161
- if(currentNode.tagname !== '!xml'){
91162
- //when nested tag is found
91163
- textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
91164
- }
91165
- }
91166
-
91167
- //check if last tag was unpaired tag
91168
- const lastTag = currentNode;
91169
- if(lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1 ){
91170
- currentNode = this.tagsNodeStack.pop();
91171
- jPath = jPath.substring(0, jPath.lastIndexOf("."));
91172
- }
91173
- if(tagName !== xmlObj.tagname){
91174
- jPath += jPath ? "." + tagName : tagName;
91175
- }
91176
- if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
91177
- let tagContent = "";
91178
- //self-closing tag
91179
- if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
91180
- if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
91181
- tagName = tagName.substr(0, tagName.length - 1);
91182
- jPath = jPath.substr(0, jPath.length - 1);
91183
- tagExp = tagName;
91184
- }else{
91185
- tagExp = tagExp.substr(0, tagExp.length - 1);
91186
- }
91187
- i = result.closeIndex;
91188
- }
91189
- //unpaired tag
91190
- else if(this.options.unpairedTags.indexOf(tagName) !== -1){
91191
-
91192
- i = result.closeIndex;
91193
- }
91194
- //normal tag
91195
- else{
91196
- //read until closing tag is found
91197
- const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
91198
- if(!result) throw new Error(`Unexpected end of ${rawTagName}`);
91199
- i = result.i;
91200
- tagContent = result.tagContent;
91201
- }
91202
-
91203
- const childNode = new xmlNode(tagName);
91204
- if(tagName !== tagExp && attrExpPresent){
91205
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
91206
- }
91207
- if(tagContent) {
91208
- tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
91209
- }
91210
-
91211
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
91212
- childNode.add(this.options.textNodeName, tagContent);
91213
-
91214
- this.addChild(currentNode, childNode, jPath)
91215
- }else{
91216
- //selfClosing tag
91217
- if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
91218
- if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
91219
- tagName = tagName.substr(0, tagName.length - 1);
91220
- jPath = jPath.substr(0, jPath.length - 1);
91221
- tagExp = tagName;
91222
- }else{
91223
- tagExp = tagExp.substr(0, tagExp.length - 1);
91224
- }
91225
-
91226
- if(this.options.transformTagName) {
91227
- tagName = this.options.transformTagName(tagName);
91228
- }
91229
-
91230
- const childNode = new xmlNode(tagName);
91231
- if(tagName !== tagExp && attrExpPresent){
91232
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
91233
- }
91234
- this.addChild(currentNode, childNode, jPath)
91235
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
91236
- }
91237
- //opening tag
91238
- else{
91239
- const childNode = new xmlNode( tagName);
91240
- this.tagsNodeStack.push(currentNode);
91241
-
91242
- if(tagName !== tagExp && attrExpPresent){
91243
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
91244
- }
91245
- this.addChild(currentNode, childNode, jPath)
91246
- currentNode = childNode;
91247
- }
91248
- textData = "";
91249
- i = closeIndex;
91250
- }
91251
- }
91252
- }else{
91253
- textData += xmlData[i];
91254
- }
91255
- }
91256
- return xmlObj.child;
91257
- }
91258
-
91259
- function addChild(currentNode, childNode, jPath){
91260
- const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"])
91261
- if(result === false){
91262
- }else if(typeof result === "string"){
91263
- childNode.tagname = result
91264
- currentNode.addChild(childNode);
91265
- }else{
91266
- currentNode.addChild(childNode);
91267
- }
91268
- }
91269
-
91270
- const replaceEntitiesValue = function(val){
91271
-
91272
- if(this.options.processEntities){
91273
- for(let entityName in this.docTypeEntities){
91274
- const entity = this.docTypeEntities[entityName];
91275
- val = val.replace( entity.regx, entity.val);
91276
- }
91277
- for(let entityName in this.lastEntities){
91278
- const entity = this.lastEntities[entityName];
91279
- val = val.replace( entity.regex, entity.val);
91280
- }
91281
- if(this.options.htmlEntities){
91282
- for(let entityName in this.htmlEntities){
91283
- const entity = this.htmlEntities[entityName];
91284
- val = val.replace( entity.regex, entity.val);
91285
- }
91286
- }
91287
- val = val.replace( this.ampEntity.regex, this.ampEntity.val);
91288
- }
91289
- return val;
91290
- }
91291
- function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
91292
- if (textData) { //store previously collected data as textNode
91293
- if(isLeafNode === undefined) isLeafNode = currentNode.child.length === 0
91294
-
91295
- textData = this.parseTextData(textData,
91296
- currentNode.tagname,
91297
- jPath,
91298
- false,
91299
- currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false,
91300
- isLeafNode);
91301
-
91302
- if (textData !== undefined && textData !== "")
91303
- currentNode.add(this.options.textNodeName, textData);
91304
- textData = "";
91305
- }
91306
- return textData;
91307
- }
91308
-
91309
- //TODO: use jPath to simplify the logic
91310
- /**
91311
- *
91312
- * @param {string[]} stopNodes
91313
- * @param {string} jPath
91314
- * @param {string} currentTagName
91315
- */
91316
- function isItStopNode(stopNodes, jPath, currentTagName){
91317
- const allNodesExp = "*." + currentTagName;
91318
- for (const stopNodePath in stopNodes) {
91319
- const stopNodeExp = stopNodes[stopNodePath];
91320
- if( allNodesExp === stopNodeExp || jPath === stopNodeExp ) return true;
91321
- }
91322
- return false;
91323
- }
91324
-
91325
- /**
91326
- * Returns the tag Expression and where it is ending handling single-double quotes situation
91327
- * @param {string} xmlData
91328
- * @param {number} i starting index
91329
- * @returns
91330
- */
91331
- function tagExpWithClosingIndex(xmlData, i, closingChar = ">"){
91332
- let attrBoundary;
91333
- let tagExp = "";
91334
- for (let index = i; index < xmlData.length; index++) {
91335
- let ch = xmlData[index];
91336
- if (attrBoundary) {
91337
- if (ch === attrBoundary) attrBoundary = "";//reset
91338
- } else if (ch === '"' || ch === "'") {
91339
- attrBoundary = ch;
91340
- } else if (ch === closingChar[0]) {
91341
- if(closingChar[1]){
91342
- if(xmlData[index + 1] === closingChar[1]){
91343
- return {
91344
- data: tagExp,
91345
- index: index
91346
- }
91347
- }
91348
- }else{
91349
- return {
91350
- data: tagExp,
91351
- index: index
91352
- }
91353
- }
91354
- } else if (ch === '\t') {
91355
- ch = " "
91356
- }
91357
- tagExp += ch;
91358
- }
91359
- }
91360
-
91361
- function findClosingIndex(xmlData, str, i, errMsg){
91362
- const closingIndex = xmlData.indexOf(str, i);
91363
- if(closingIndex === -1){
91364
- throw new Error(errMsg)
91365
- }else{
91366
- return closingIndex + str.length - 1;
91367
- }
91368
- }
91369
-
91370
- function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
91371
- const result = tagExpWithClosingIndex(xmlData, i+1, closingChar);
91372
- if(!result) return;
91373
- let tagExp = result.data;
91374
- const closeIndex = result.index;
91375
- const separatorIndex = tagExp.search(/\s/);
91376
- let tagName = tagExp;
91377
- let attrExpPresent = true;
91378
- if(separatorIndex !== -1){//separate tag name and attributes expression
91379
- tagName = tagExp.substring(0, separatorIndex);
91380
- tagExp = tagExp.substring(separatorIndex + 1).trimStart();
91381
- }
91382
-
91383
- const rawTagName = tagName;
91384
- if(removeNSPrefix){
91385
- const colonIndex = tagName.indexOf(":");
91386
- if(colonIndex !== -1){
91387
- tagName = tagName.substr(colonIndex+1);
91388
- attrExpPresent = tagName !== result.data.substr(colonIndex + 1);
91389
- }
91390
- }
91391
-
91392
- return {
91393
- tagName: tagName,
91394
- tagExp: tagExp,
91395
- closeIndex: closeIndex,
91396
- attrExpPresent: attrExpPresent,
91397
- rawTagName: rawTagName,
91398
- }
91399
- }
91400
- /**
91401
- * find paired tag for a stop node
91402
- * @param {string} xmlData
91403
- * @param {string} tagName
91404
- * @param {number} i
91405
- */
91406
- function readStopNodeData(xmlData, tagName, i){
91407
- const startIndex = i;
91408
- // Starting at 1 since we already have an open tag
91409
- let openTagCount = 1;
91410
-
91411
- for (; i < xmlData.length; i++) {
91412
- if( xmlData[i] === "<"){
91413
- if (xmlData[i+1] === "/") {//close tag
91414
- const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`);
91415
- let closeTagName = xmlData.substring(i+2,closeIndex).trim();
91416
- if(closeTagName === tagName){
91417
- openTagCount--;
91418
- if (openTagCount === 0) {
91419
- return {
91420
- tagContent: xmlData.substring(startIndex, i),
91421
- i : closeIndex
91422
- }
91423
- }
91424
- }
91425
- i=closeIndex;
91426
- } else if(xmlData[i+1] === '?') {
91427
- const closeIndex = findClosingIndex(xmlData, "?>", i+1, "StopNode is not closed.")
91428
- i=closeIndex;
91429
- } else if(xmlData.substr(i + 1, 3) === '!--') {
91430
- const closeIndex = findClosingIndex(xmlData, "-->", i+3, "StopNode is not closed.")
91431
- i=closeIndex;
91432
- } else if(xmlData.substr(i + 1, 2) === '![') {
91433
- const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
91434
- i=closeIndex;
91435
- } else {
91436
- const tagData = readTagExp(xmlData, i, '>')
91437
-
91438
- if (tagData) {
91439
- const openTagName = tagData && tagData.tagName;
91440
- if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length-1] !== "/") {
91441
- openTagCount++;
91442
- }
91443
- i=tagData.closeIndex;
91444
- }
91445
- }
91446
- }
91447
- }//end for loop
91448
- }
91449
-
91450
- function parseValue(val, shouldParse, options) {
91451
- if (shouldParse && typeof val === 'string') {
91452
- //console.log(options)
91453
- const newval = val.trim();
91454
- if(newval === 'true' ) return true;
91455
- else if(newval === 'false' ) return false;
91456
- else return toNumber(val, options);
91457
- } else {
91458
- if (util.isExist(val)) {
91459
- return val;
91460
- } else {
91461
- return '';
91462
- }
91463
- }
91464
- }
91465
-
91466
-
91467
- module.exports = OrderedObjParser;
89704
+ /***/ "./src/xmlbuilder/orderedJs2Xml.js":
89705
+ /*!*****************************************!*\
89706
+ !*** ./src/xmlbuilder/orderedJs2Xml.js ***!
89707
+ \*****************************************/
89708
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
91468
89709
 
89710
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ toXml)\n/* harmony export */ });\nconst EOL = \"\\n\";\n\n/**\n * \n * @param {array} jArray \n * @param {any} options \n * @returns \n */\nfunction toXml(jArray, options) {\n let indentation = \"\";\n if (options.format && options.indentBy.length > 0) {\n indentation = EOL;\n }\n return arrToStr(jArray, options, \"\", indentation);\n}\n\nfunction arrToStr(arr, options, jPath, indentation) {\n let xmlStr = \"\";\n let isPreviousElementTag = false;\n\n for (let i = 0; i < arr.length; i++) {\n const tagObj = arr[i];\n const tagName = propName(tagObj);\n if(tagName === undefined) continue;\n\n let newJPath = \"\";\n if (jPath.length === 0) newJPath = tagName\n else newJPath = `${jPath}.${tagName}`;\n\n if (tagName === options.textNodeName) {\n let tagText = tagObj[tagName];\n if (!isStopNode(newJPath, options)) {\n tagText = options.tagValueProcessor(tagName, tagText);\n tagText = replaceEntitiesValue(tagText, options);\n }\n if (isPreviousElementTag) {\n xmlStr += indentation;\n }\n xmlStr += tagText;\n isPreviousElementTag = false;\n continue;\n } else if (tagName === options.cdataPropName) {\n if (isPreviousElementTag) {\n xmlStr += indentation;\n }\n xmlStr += `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`;\n isPreviousElementTag = false;\n continue;\n } else if (tagName === options.commentPropName) {\n xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`;\n isPreviousElementTag = true;\n continue;\n } else if (tagName[0] === \"?\") {\n const attStr = attr_to_str(tagObj[\":@\"], options);\n const tempInd = tagName === \"?xml\" ? \"\" : indentation;\n let piTextNodeName = tagObj[tagName][0][options.textNodeName];\n piTextNodeName = piTextNodeName.length !== 0 ? \" \" + piTextNodeName : \"\"; //remove extra spacing\n xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr}?>`;\n isPreviousElementTag = true;\n continue;\n }\n let newIdentation = indentation;\n if (newIdentation !== \"\") {\n newIdentation += options.indentBy;\n }\n const attStr = attr_to_str(tagObj[\":@\"], options);\n const tagStart = indentation + `<${tagName}${attStr}`;\n const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);\n if (options.unpairedTags.indexOf(tagName) !== -1) {\n if (options.suppressUnpairedNode) xmlStr += tagStart + \">\";\n else xmlStr += tagStart + \"/>\";\n } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {\n xmlStr += tagStart + \"/>\";\n } else if (tagValue && tagValue.endsWith(\">\")) {\n xmlStr += tagStart + `>${tagValue}${indentation}</${tagName}>`;\n } else {\n xmlStr += tagStart + \">\";\n if (tagValue && indentation !== \"\" && (tagValue.includes(\"/>\") || tagValue.includes(\"</\"))) {\n xmlStr += indentation + options.indentBy + tagValue + indentation;\n } else {\n xmlStr += tagValue;\n }\n xmlStr += `</${tagName}>`;\n }\n isPreviousElementTag = true;\n }\n\n return xmlStr;\n}\n\nfunction propName(obj) {\n const keys = Object.keys(obj);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if(!obj.hasOwnProperty(key)) continue;\n if (key !== \":@\") return key;\n }\n}\n\nfunction attr_to_str(attrMap, options) {\n let attrStr = \"\";\n if (attrMap && !options.ignoreAttributes) {\n for (let attr in attrMap) {\n if(!attrMap.hasOwnProperty(attr)) continue;\n let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);\n attrVal = replaceEntitiesValue(attrVal, options);\n if (attrVal === true && options.suppressBooleanAttributes) {\n attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;\n } else {\n attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}=\"${attrVal}\"`;\n }\n }\n }\n return attrStr;\n}\n\nfunction isStopNode(jPath, options) {\n jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);\n let tagName = jPath.substr(jPath.lastIndexOf(\".\") + 1);\n for (let index in options.stopNodes) {\n if (options.stopNodes[index] === jPath || options.stopNodes[index] === \"*.\" + tagName) return true;\n }\n return false;\n}\n\nfunction replaceEntitiesValue(textValue, options) {\n if (textValue && textValue.length > 0 && options.processEntities) {\n for (let i = 0; i < options.entities.length; i++) {\n const entity = options.entities[i];\n textValue = textValue.replace(entity.regex, entity.val);\n }\n }\n return textValue;\n}\n\n\n//# sourceURL=webpack://fast-xml-parser/./src/xmlbuilder/orderedJs2Xml.js?");
91469
89711
 
91470
89712
  /***/ }),
91471
89713
 
91472
- /***/ "./node_modules/fast-xml-parser/src/xmlparser/XMLParser.js":
91473
- /*!*****************************************************************!*\
91474
- !*** ./node_modules/fast-xml-parser/src/xmlparser/XMLParser.js ***!
91475
- \*****************************************************************/
91476
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
91477
-
91478
- const { buildOptions} = __webpack_require__(/*! ./OptionsBuilder */ "./node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js");
91479
- const OrderedObjParser = __webpack_require__(/*! ./OrderedObjParser */ "./node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js");
91480
- const { prettify} = __webpack_require__(/*! ./node2json */ "./node_modules/fast-xml-parser/src/xmlparser/node2json.js");
91481
- const validator = __webpack_require__(/*! ../validator */ "./node_modules/fast-xml-parser/src/validator.js");
91482
-
91483
- class XMLParser{
91484
-
91485
- constructor(options){
91486
- this.externalEntities = {};
91487
- this.options = buildOptions(options);
91488
-
91489
- }
91490
- /**
91491
- * Parse XML dats to JS object
91492
- * @param {string|Buffer} xmlData
91493
- * @param {boolean|Object} validationOption
91494
- */
91495
- parse(xmlData,validationOption){
91496
- if(typeof xmlData === "string"){
91497
- }else if( xmlData.toString){
91498
- xmlData = xmlData.toString();
91499
- }else{
91500
- throw new Error("XML data is accepted in String or Bytes[] form.")
91501
- }
91502
- if( validationOption){
91503
- if(validationOption === true) validationOption = {}; //validate with default options
91504
-
91505
- const result = validator.validate(xmlData, validationOption);
91506
- if (result !== true) {
91507
- throw Error( `${result.err.msg}:${result.err.line}:${result.err.col}` )
91508
- }
91509
- }
91510
- const orderedObjParser = new OrderedObjParser(this.options);
91511
- orderedObjParser.addExternalEntities(this.externalEntities);
91512
- const orderedResult = orderedObjParser.parseXml(xmlData);
91513
- if(this.options.preserveOrder || orderedResult === undefined) return orderedResult;
91514
- else return prettify(orderedResult, this.options);
91515
- }
91516
-
91517
- /**
91518
- * Add Entity which is not by default supported by this library
91519
- * @param {string} key
91520
- * @param {string} value
91521
- */
91522
- addEntity(key, value){
91523
- if(value.indexOf("&") !== -1){
91524
- throw new Error("Entity value can't have '&'")
91525
- }else if(key.indexOf("&") !== -1 || key.indexOf(";") !== -1){
91526
- throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'")
91527
- }else if(value === "&"){
91528
- throw new Error("An entity with value '&' is not permitted");
91529
- }else{
91530
- this.externalEntities[key] = value;
91531
- }
91532
- }
91533
- }
89714
+ /***/ "./src/xmlparser/DocTypeReader.js":
89715
+ /*!****************************************!*\
89716
+ !*** ./src/xmlparser/DocTypeReader.js ***!
89717
+ \****************************************/
89718
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
91534
89719
 
91535
- module.exports = XMLParser;
89720
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ readDocType)\n/* harmony export */ });\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ \"./src/util.js\");\n\n\n//TODO: handle comments\nfunction readDocType(xmlData, i){\n \n const entities = {};\n if( xmlData[i + 3] === 'O' &&\n xmlData[i + 4] === 'C' &&\n xmlData[i + 5] === 'T' &&\n xmlData[i + 6] === 'Y' &&\n xmlData[i + 7] === 'P' &&\n xmlData[i + 8] === 'E')\n { \n i = i+9;\n let angleBracketsCount = 1;\n let hasBody = false, comment = false;\n let exp = \"\";\n for(;i<xmlData.length;i++){\n if (xmlData[i] === '<' && !comment) { //Determine the tag type\n if( hasBody && isEntity(xmlData, i)){\n i += 7; \n let entityName, val;\n [entityName, val,i] = readEntityExp(xmlData,i+1);\n if(val.indexOf(\"&\") === -1) //Parameter entities are not supported\n entities[ validateEntityName(entityName) ] = {\n regx : RegExp( `&${entityName};`,\"g\"),\n val: val\n };\n }\n else if( hasBody && isElement(xmlData, i)) i += 8;//Not supported\n else if( hasBody && isAttlist(xmlData, i)) i += 8;//Not supported\n else if( hasBody && isNotation(xmlData, i)) i += 9;//Not supported\n else if( isComment) comment = true;\n else throw new Error(\"Invalid DOCTYPE\");\n\n angleBracketsCount++;\n exp = \"\";\n } else if (xmlData[i] === '>') { //Read tag content\n if(comment){\n if( xmlData[i - 1] === \"-\" && xmlData[i - 2] === \"-\"){\n comment = false;\n angleBracketsCount--;\n }\n }else{\n angleBracketsCount--;\n }\n if (angleBracketsCount === 0) {\n break;\n }\n }else if( xmlData[i] === '['){\n hasBody = true;\n }else{\n exp += xmlData[i];\n }\n }\n if(angleBracketsCount !== 0){\n throw new Error(`Unclosed DOCTYPE`);\n }\n }else{\n throw new Error(`Invalid Tag instead of DOCTYPE`);\n }\n return {entities, i};\n}\n\nfunction readEntityExp(xmlData,i){\n //External entities are not supported\n // <!ENTITY ext SYSTEM \"http://normal-website.com\" >\n\n //Parameter entities are not supported\n // <!ENTITY entityname \"&anotherElement;\">\n\n //Internal entities are supported\n // <!ENTITY entityname \"replacement text\">\n \n //read EntityName\n let entityName = \"\";\n for (; i < xmlData.length && (xmlData[i] !== \"'\" && xmlData[i] !== '\"' ); i++) {\n // if(xmlData[i] === \" \") continue;\n // else \n entityName += xmlData[i];\n }\n entityName = entityName.trim();\n if(entityName.indexOf(\" \") !== -1) throw new Error(\"External entites are not supported\");\n\n //read Entity Value\n const startChar = xmlData[i++];\n let val = \"\"\n for (; i < xmlData.length && xmlData[i] !== startChar ; i++) {\n val += xmlData[i];\n }\n return [entityName, val, i];\n}\n\nfunction isComment(xmlData, i){\n if(xmlData[i+1] === '!' &&\n xmlData[i+2] === '-' &&\n xmlData[i+3] === '-') return true\n return false\n}\nfunction isEntity(xmlData, i){\n if(xmlData[i+1] === '!' &&\n xmlData[i+2] === 'E' &&\n xmlData[i+3] === 'N' &&\n xmlData[i+4] === 'T' &&\n xmlData[i+5] === 'I' &&\n xmlData[i+6] === 'T' &&\n xmlData[i+7] === 'Y') return true\n return false\n}\nfunction isElement(xmlData, i){\n if(xmlData[i+1] === '!' &&\n xmlData[i+2] === 'E' &&\n xmlData[i+3] === 'L' &&\n xmlData[i+4] === 'E' &&\n xmlData[i+5] === 'M' &&\n xmlData[i+6] === 'E' &&\n xmlData[i+7] === 'N' &&\n xmlData[i+8] === 'T') return true\n return false\n}\n\nfunction isAttlist(xmlData, i){\n if(xmlData[i+1] === '!' &&\n xmlData[i+2] === 'A' &&\n xmlData[i+3] === 'T' &&\n xmlData[i+4] === 'T' &&\n xmlData[i+5] === 'L' &&\n xmlData[i+6] === 'I' &&\n xmlData[i+7] === 'S' &&\n xmlData[i+8] === 'T') return true\n return false\n}\nfunction isNotation(xmlData, i){\n if(xmlData[i+1] === '!' &&\n xmlData[i+2] === 'N' &&\n xmlData[i+3] === 'O' &&\n xmlData[i+4] === 'T' &&\n xmlData[i+5] === 'A' &&\n xmlData[i+6] === 'T' &&\n xmlData[i+7] === 'I' &&\n xmlData[i+8] === 'O' &&\n xmlData[i+9] === 'N') return true\n return false\n}\n\nfunction validateEntityName(name){\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_0__.isName)(name))\n\treturn name;\n else\n throw new Error(`Invalid entity name ${name}`);\n}\n\n\n//# sourceURL=webpack://fast-xml-parser/./src/xmlparser/DocTypeReader.js?");
91536
89721
 
91537
89722
  /***/ }),
91538
89723
 
91539
- /***/ "./node_modules/fast-xml-parser/src/xmlparser/node2json.js":
91540
- /*!*****************************************************************!*\
91541
- !*** ./node_modules/fast-xml-parser/src/xmlparser/node2json.js ***!
91542
- \*****************************************************************/
91543
- /***/ ((__unused_webpack_module, exports) => {
89724
+ /***/ "./src/xmlparser/OptionsBuilder.js":
89725
+ /*!*****************************************!*\
89726
+ !*** ./src/xmlparser/OptionsBuilder.js ***!
89727
+ \*****************************************/
89728
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
91544
89729
 
91545
- "use strict";
89730
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ buildOptions: () => (/* binding */ buildOptions),\n/* harmony export */ defaultOptions: () => (/* binding */ defaultOptions)\n/* harmony export */ });\n\nconst defaultOptions = {\n preserveOrder: false,\n attributeNamePrefix: '@_',\n attributesGroupName: false,\n textNodeName: '#text',\n ignoreAttributes: true,\n removeNSPrefix: false, // remove NS from tag name or attribute name if true\n allowBooleanAttributes: false, //a tag can have attributes without any value\n //ignoreRootElement : false,\n parseTagValue: true,\n parseAttributeValue: false,\n trimValues: true, //Trim string values of tag and attributes\n cdataPropName: false,\n numberParseOptions: {\n hex: true,\n leadingZeros: true,\n eNotation: true\n },\n tagValueProcessor: function(tagName, val) {\n return val;\n },\n attributeValueProcessor: function(attrName, val) {\n return val;\n },\n stopNodes: [], //nested tags will not be parsed even for errors\n alwaysCreateTextNode: false,\n isArray: () => false,\n commentPropName: false,\n unpairedTags: [],\n processEntities: true,\n htmlEntities: false,\n ignoreDeclaration: false,\n ignorePiTags: false,\n transformTagName: false,\n transformAttributeName: false,\n updateTag: function(tagName, jPath, attrs){\n return tagName\n },\n // skipEmptyListItem: false\n};\n \nconst buildOptions = function(options) {\n return Object.assign({}, defaultOptions, options);\n};\n\n\n//# sourceURL=webpack://fast-xml-parser/./src/xmlparser/OptionsBuilder.js?");
91546
89731
 
89732
+ /***/ }),
91547
89733
 
91548
- /**
91549
- *
91550
- * @param {array} node
91551
- * @param {any} options
91552
- * @returns
91553
- */
91554
- function prettify(node, options){
91555
- return compress( node, options);
91556
- }
89734
+ /***/ "./src/xmlparser/OrderedObjParser.js":
89735
+ /*!*******************************************!*\
89736
+ !*** ./src/xmlparser/OrderedObjParser.js ***!
89737
+ \*******************************************/
89738
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
91557
89739
 
91558
- /**
91559
- *
91560
- * @param {array} arr
91561
- * @param {object} options
91562
- * @param {string} jPath
91563
- * @returns object
91564
- */
91565
- function compress(arr, options, jPath){
91566
- let text;
91567
- const compressedObj = {};
91568
- for (let i = 0; i < arr.length; i++) {
91569
- const tagObj = arr[i];
91570
- const property = propName(tagObj);
91571
- let newJpath = "";
91572
- if(jPath === undefined) newJpath = property;
91573
- else newJpath = jPath + "." + property;
91574
-
91575
- if(property === options.textNodeName){
91576
- if(text === undefined) text = tagObj[property];
91577
- else text += "" + tagObj[property];
91578
- }else if(property === undefined){
91579
- continue;
91580
- }else if(tagObj[property]){
91581
-
91582
- let val = compress(tagObj[property], options, newJpath);
91583
- const isLeaf = isLeafTag(val, options);
91584
-
91585
- if(tagObj[":@"]){
91586
- assignAttributes( val, tagObj[":@"], newJpath, options);
91587
- }else if(Object.keys(val).length === 1 && val[options.textNodeName] !== undefined && !options.alwaysCreateTextNode){
91588
- val = val[options.textNodeName];
91589
- }else if(Object.keys(val).length === 0){
91590
- if(options.alwaysCreateTextNode) val[options.textNodeName] = "";
91591
- else val = "";
91592
- }
89740
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ OrderedObjParser)\n/* harmony export */ });\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ \"./src/util.js\");\n/* harmony import */ var _xmlNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./xmlNode.js */ \"./src/xmlparser/xmlNode.js\");\n/* harmony import */ var _DocTypeReader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./DocTypeReader.js */ \"./src/xmlparser/DocTypeReader.js\");\n/* harmony import */ var strnum__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! strnum */ \"./node_modules/strnum/strnum.js\");\n/* harmony import */ var _ignoreAttributes_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../ignoreAttributes.js */ \"./src/ignoreAttributes.js\");\n\n///@ts-check\n\n\n\n\n\n\n\n// const regx =\n// '<((!\\\\[CDATA\\\\[([\\\\s\\\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\\\/)(NAME)\\\\s*>))([^<]*)'\n// .replace(/NAME/g, util.nameRegexp);\n\n//const tagsRegx = new RegExp(\"<(\\\\/?[\\\\w:\\\\-\\._]+)([^>]*)>(\\\\s*\"+cdataRegx+\")*([^<]+)?\",\"g\");\n//const tagsRegx = new RegExp(\"<(\\\\/?)((\\\\w*:)?([\\\\w:\\\\-\\._]+))([^>]*)>([^<]*)(\"+cdataRegx+\"([^<]*))*([^<]+)?\",\"g\");\n\nclass OrderedObjParser{\n constructor(options){\n this.options = options;\n this.currentNode = null;\n this.tagsNodeStack = [];\n this.docTypeEntities = {};\n this.lastEntities = {\n \"apos\" : { regex: /&(apos|#39|#x27);/g, val : \"'\"},\n \"gt\" : { regex: /&(gt|#62|#x3E);/g, val : \">\"},\n \"lt\" : { regex: /&(lt|#60|#x3C);/g, val : \"<\"},\n \"quot\" : { regex: /&(quot|#34|#x22);/g, val : \"\\\"\"},\n };\n this.ampEntity = { regex: /&(amp|#38|#x26);/g, val : \"&\"};\n this.htmlEntities = {\n \"space\": { regex: /&(nbsp|#160);/g, val: \" \" },\n // \"lt\" : { regex: /&(lt|#60);/g, val: \"<\" },\n // \"gt\" : { regex: /&(gt|#62);/g, val: \">\" },\n // \"amp\" : { regex: /&(amp|#38);/g, val: \"&\" },\n // \"quot\" : { regex: /&(quot|#34);/g, val: \"\\\"\" },\n // \"apos\" : { regex: /&(apos|#39);/g, val: \"'\" },\n \"cent\" : { regex: /&(cent|#162);/g, val: \"¢\" },\n \"pound\" : { regex: /&(pound|#163);/g, val: \"£\" },\n \"yen\" : { regex: /&(yen|#165);/g, val: \"¥\" },\n \"euro\" : { regex: /&(euro|#8364);/g, val: \"€\" },\n \"copyright\" : { regex: /&(copy|#169);/g, val: \"©\" },\n \"reg\" : { regex: /&(reg|#174);/g, val: \"®\" },\n \"inr\" : { regex: /&(inr|#8377);/g, val: \"₹\" },\n \"num_dec\": { regex: /&#([0-9]{1,7});/g, val : (_, str) => String.fromCodePoint(Number.parseInt(str, 10)) },\n \"num_hex\": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => String.fromCodePoint(Number.parseInt(str, 16)) },\n };\n this.addExternalEntities = addExternalEntities;\n this.parseXml = parseXml;\n this.parseTextData = parseTextData;\n this.resolveNameSpace = resolveNameSpace;\n this.buildAttributesMap = buildAttributesMap;\n this.isItStopNode = isItStopNode;\n this.replaceEntitiesValue = replaceEntitiesValue;\n this.readStopNodeData = readStopNodeData;\n this.saveTextToParentTag = saveTextToParentTag;\n this.addChild = addChild;\n this.ignoreAttributesFn = (0,_ignoreAttributes_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(this.options.ignoreAttributes)\n }\n\n}\n\nfunction addExternalEntities(externalEntities){\n const entKeys = Object.keys(externalEntities);\n for (let i = 0; i < entKeys.length; i++) {\n const ent = entKeys[i];\n this.lastEntities[ent] = {\n regex: new RegExp(\"&\"+ent+\";\",\"g\"),\n val : externalEntities[ent]\n }\n }\n}\n\n/**\n * @param {string} val\n * @param {string} tagName\n * @param {string} jPath\n * @param {boolean} dontTrim\n * @param {boolean} hasAttributes\n * @param {boolean} isLeafNode\n * @param {boolean} escapeEntities\n */\nfunction parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {\n if (val !== undefined) {\n if (this.options.trimValues && !dontTrim) {\n val = val.trim();\n }\n if(val.length > 0){\n if(!escapeEntities) val = this.replaceEntitiesValue(val);\n \n const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);\n if(newval === null || newval === undefined){\n //don't parse\n return val;\n }else if(typeof newval !== typeof val || newval !== val){\n //overwrite\n return newval;\n }else if(this.options.trimValues){\n return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);\n }else{\n const trimmedVal = val.trim();\n if(trimmedVal === val){\n return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);\n }else{\n return val;\n }\n }\n }\n }\n}\n\nfunction resolveNameSpace(tagname) {\n if (this.options.removeNSPrefix) {\n const tags = tagname.split(':');\n const prefix = tagname.charAt(0) === '/' ? '/' : '';\n if (tags[0] === 'xmlns') {\n return '';\n }\n if (tags.length === 2) {\n tagname = prefix + tags[1];\n }\n }\n return tagname;\n}\n\n//TODO: change regex to capture NS\n//const attrsRegx = new RegExp(\"([\\\\w\\\\-\\\\.\\\\:]+)\\\\s*=\\\\s*(['\\\"])((.|\\n)*?)\\\\2\",\"gm\");\nconst attrsRegx = new RegExp('([^\\\\s=]+)\\\\s*(=\\\\s*([\\'\"])([\\\\s\\\\S]*?)\\\\3)?', 'gm');\n\nfunction buildAttributesMap(attrStr, jPath, tagName) {\n if (this.options.ignoreAttributes !== true && typeof attrStr === 'string') {\n // attrStr = attrStr.replace(/\\r?\\n/g, ' ');\n //attrStr = attrStr || attrStr.trim();\n\n const matches = (0,_util_js__WEBPACK_IMPORTED_MODULE_0__.getAllMatches)(attrStr, attrsRegx);\n const len = matches.length; //don't make it inline\n const attrs = {};\n for (let i = 0; i < len; i++) {\n const attrName = this.resolveNameSpace(matches[i][1]);\n if (this.ignoreAttributesFn(attrName, jPath)) {\n continue\n }\n let oldVal = matches[i][4];\n let aName = this.options.attributeNamePrefix + attrName;\n if (attrName.length) {\n if (this.options.transformAttributeName) {\n aName = this.options.transformAttributeName(aName);\n }\n if(aName === \"__proto__\") aName = \"#__proto__\";\n if (oldVal !== undefined) {\n if (this.options.trimValues) {\n oldVal = oldVal.trim();\n }\n oldVal = this.replaceEntitiesValue(oldVal);\n const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);\n if(newVal === null || newVal === undefined){\n //don't parse\n attrs[aName] = oldVal;\n }else if(typeof newVal !== typeof oldVal || newVal !== oldVal){\n //overwrite\n attrs[aName] = newVal;\n }else{\n //parse\n attrs[aName] = parseValue(\n oldVal,\n this.options.parseAttributeValue,\n this.options.numberParseOptions\n );\n }\n } else if (this.options.allowBooleanAttributes) {\n attrs[aName] = true;\n }\n }\n }\n if (!Object.keys(attrs).length) {\n return;\n }\n if (this.options.attributesGroupName) {\n const attrCollection = {};\n attrCollection[this.options.attributesGroupName] = attrs;\n return attrCollection;\n }\n return attrs\n }\n}\n\nconst parseXml = function(xmlData) {\n xmlData = xmlData.replace(/\\r\\n?/g, \"\\n\"); //TODO: remove this line\n const xmlObj = new _xmlNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]('!xml');\n let currentNode = xmlObj;\n let textData = \"\";\n let jPath = \"\";\n for(let i=0; i< xmlData.length; i++){//for each char in XML data\n const ch = xmlData[i];\n if(ch === '<'){\n // const nextIndex = i+1;\n // const _2ndChar = xmlData[nextIndex];\n if( xmlData[i+1] === '/') {//Closing Tag\n const closeIndex = findClosingIndex(xmlData, \">\", i, \"Closing Tag is not closed.\")\n let tagName = xmlData.substring(i+2,closeIndex).trim();\n\n if(this.options.removeNSPrefix){\n const colonIndex = tagName.indexOf(\":\");\n if(colonIndex !== -1){\n tagName = tagName.substr(colonIndex+1);\n }\n }\n\n if(this.options.transformTagName) {\n tagName = this.options.transformTagName(tagName);\n }\n\n if(currentNode){\n textData = this.saveTextToParentTag(textData, currentNode, jPath);\n }\n\n //check if last tag of nested tag was unpaired tag\n const lastTagName = jPath.substring(jPath.lastIndexOf(\".\")+1);\n if(tagName && this.options.unpairedTags.indexOf(tagName) !== -1 ){\n throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);\n }\n let propIndex = 0\n if(lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1 ){\n propIndex = jPath.lastIndexOf('.', jPath.lastIndexOf('.')-1)\n this.tagsNodeStack.pop();\n }else{\n propIndex = jPath.lastIndexOf(\".\");\n }\n jPath = jPath.substring(0, propIndex);\n\n currentNode = this.tagsNodeStack.pop();//avoid recursion, set the parent tag scope\n textData = \"\";\n i = closeIndex;\n } else if( xmlData[i+1] === '?') {\n\n let tagData = readTagExp(xmlData,i, false, \"?>\");\n if(!tagData) throw new Error(\"Pi Tag is not closed.\");\n\n textData = this.saveTextToParentTag(textData, currentNode, jPath);\n if( (this.options.ignoreDeclaration && tagData.tagName === \"?xml\") || this.options.ignorePiTags){\n\n }else{\n \n const childNode = new _xmlNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](tagData.tagName);\n childNode.add(this.options.textNodeName, \"\");\n \n if(tagData.tagName !== tagData.tagExp && tagData.attrExpPresent){\n childNode[\":@\"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);\n }\n this.addChild(currentNode, childNode, jPath)\n\n }\n\n\n i = tagData.closeIndex + 1;\n } else if(xmlData.substr(i + 1, 3) === '!--') {\n const endIndex = findClosingIndex(xmlData, \"-->\", i+4, \"Comment is not closed.\")\n if(this.options.commentPropName){\n const comment = xmlData.substring(i + 4, endIndex - 2);\n\n textData = this.saveTextToParentTag(textData, currentNode, jPath);\n\n currentNode.add(this.options.commentPropName, [ { [this.options.textNodeName] : comment } ]);\n }\n i = endIndex;\n } else if( xmlData.substr(i + 1, 2) === '!D') {\n const result = (0,_DocTypeReader_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(xmlData, i);\n this.docTypeEntities = result.entities;\n i = result.i;\n }else if(xmlData.substr(i + 1, 2) === '![') {\n const closeIndex = findClosingIndex(xmlData, \"]]>\", i, \"CDATA is not closed.\") - 2;\n const tagExp = xmlData.substring(i + 9,closeIndex);\n\n textData = this.saveTextToParentTag(textData, currentNode, jPath);\n\n let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);\n if(val == undefined) val = \"\";\n\n //cdata should be set even if it is 0 length string\n if(this.options.cdataPropName){\n currentNode.add(this.options.cdataPropName, [ { [this.options.textNodeName] : tagExp } ]);\n }else{\n currentNode.add(this.options.textNodeName, val);\n }\n \n i = closeIndex + 2;\n }else {//Opening tag\n let result = readTagExp(xmlData,i, this.options.removeNSPrefix);\n let tagName= result.tagName;\n const rawTagName = result.rawTagName;\n let tagExp = result.tagExp;\n let attrExpPresent = result.attrExpPresent;\n let closeIndex = result.closeIndex;\n\n if (this.options.transformTagName) {\n tagName = this.options.transformTagName(tagName);\n }\n \n //save text as child node\n if (currentNode && textData) {\n if(currentNode.tagname !== '!xml'){\n //when nested tag is found\n textData = this.saveTextToParentTag(textData, currentNode, jPath, false);\n }\n }\n\n //check if last tag was unpaired tag\n const lastTag = currentNode;\n if(lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1 ){\n currentNode = this.tagsNodeStack.pop();\n jPath = jPath.substring(0, jPath.lastIndexOf(\".\"));\n }\n if(tagName !== xmlObj.tagname){\n jPath += jPath ? \".\" + tagName : tagName;\n }\n if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {\n let tagContent = \"\";\n //self-closing tag\n if(tagExp.length > 0 && tagExp.lastIndexOf(\"/\") === tagExp.length - 1){\n if(tagName[tagName.length - 1] === \"/\"){ //remove trailing '/'\n tagName = tagName.substr(0, tagName.length - 1);\n jPath = jPath.substr(0, jPath.length - 1);\n tagExp = tagName;\n }else{\n tagExp = tagExp.substr(0, tagExp.length - 1);\n }\n i = result.closeIndex;\n }\n //unpaired tag\n else if(this.options.unpairedTags.indexOf(tagName) !== -1){\n \n i = result.closeIndex;\n }\n //normal tag\n else{\n //read until closing tag is found\n const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);\n if(!result) throw new Error(`Unexpected end of ${rawTagName}`);\n i = result.i;\n tagContent = result.tagContent;\n }\n\n const childNode = new _xmlNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](tagName);\n if(tagName !== tagExp && attrExpPresent){\n childNode[\":@\"] = this.buildAttributesMap(tagExp, jPath, tagName);\n }\n if(tagContent) {\n tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);\n }\n \n jPath = jPath.substr(0, jPath.lastIndexOf(\".\"));\n childNode.add(this.options.textNodeName, tagContent);\n \n this.addChild(currentNode, childNode, jPath)\n }else{\n //selfClosing tag\n if(tagExp.length > 0 && tagExp.lastIndexOf(\"/\") === tagExp.length - 1){\n if(tagName[tagName.length - 1] === \"/\"){ //remove trailing '/'\n tagName = tagName.substr(0, tagName.length - 1);\n jPath = jPath.substr(0, jPath.length - 1);\n tagExp = tagName;\n }else{\n tagExp = tagExp.substr(0, tagExp.length - 1);\n }\n \n if(this.options.transformTagName) {\n tagName = this.options.transformTagName(tagName);\n }\n\n const childNode = new _xmlNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](tagName);\n if(tagName !== tagExp && attrExpPresent){\n childNode[\":@\"] = this.buildAttributesMap(tagExp, jPath, tagName);\n }\n this.addChild(currentNode, childNode, jPath)\n jPath = jPath.substr(0, jPath.lastIndexOf(\".\"));\n }\n //opening tag\n else{\n const childNode = new _xmlNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]( tagName);\n this.tagsNodeStack.push(currentNode);\n \n if(tagName !== tagExp && attrExpPresent){\n childNode[\":@\"] = this.buildAttributesMap(tagExp, jPath, tagName);\n }\n this.addChild(currentNode, childNode, jPath)\n currentNode = childNode;\n }\n textData = \"\";\n i = closeIndex;\n }\n }\n }else{\n textData += xmlData[i];\n }\n }\n return xmlObj.child;\n}\n\nfunction addChild(currentNode, childNode, jPath){\n const result = this.options.updateTag(childNode.tagname, jPath, childNode[\":@\"])\n if(result === false){\n }else if(typeof result === \"string\"){\n childNode.tagname = result\n currentNode.addChild(childNode);\n }else{\n currentNode.addChild(childNode);\n }\n}\n\nconst replaceEntitiesValue = function(val){\n\n if(this.options.processEntities){\n for(let entityName in this.docTypeEntities){\n const entity = this.docTypeEntities[entityName];\n val = val.replace( entity.regx, entity.val);\n }\n for(let entityName in this.lastEntities){\n const entity = this.lastEntities[entityName];\n val = val.replace( entity.regex, entity.val);\n }\n if(this.options.htmlEntities){\n for(let entityName in this.htmlEntities){\n const entity = this.htmlEntities[entityName];\n val = val.replace( entity.regex, entity.val);\n }\n }\n val = val.replace( this.ampEntity.regex, this.ampEntity.val);\n }\n return val;\n}\nfunction saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {\n if (textData) { //store previously collected data as textNode\n if(isLeafNode === undefined) isLeafNode = currentNode.child.length === 0\n \n textData = this.parseTextData(textData,\n currentNode.tagname,\n jPath,\n false,\n currentNode[\":@\"] ? Object.keys(currentNode[\":@\"]).length !== 0 : false,\n isLeafNode);\n\n if (textData !== undefined && textData !== \"\")\n currentNode.add(this.options.textNodeName, textData);\n textData = \"\";\n }\n return textData;\n}\n\n//TODO: use jPath to simplify the logic\n/**\n * \n * @param {string[]} stopNodes \n * @param {string} jPath\n * @param {string} currentTagName \n */\nfunction isItStopNode(stopNodes, jPath, currentTagName){\n const allNodesExp = \"*.\" + currentTagName;\n for (const stopNodePath in stopNodes) {\n const stopNodeExp = stopNodes[stopNodePath];\n if( allNodesExp === stopNodeExp || jPath === stopNodeExp ) return true;\n }\n return false;\n}\n\n/**\n * Returns the tag Expression and where it is ending handling single-double quotes situation\n * @param {string} xmlData \n * @param {number} i starting index\n * @returns \n */\nfunction tagExpWithClosingIndex(xmlData, i, closingChar = \">\"){\n let attrBoundary;\n let tagExp = \"\";\n for (let index = i; index < xmlData.length; index++) {\n let ch = xmlData[index];\n if (attrBoundary) {\n if (ch === attrBoundary) attrBoundary = \"\";//reset\n } else if (ch === '\"' || ch === \"'\") {\n attrBoundary = ch;\n } else if (ch === closingChar[0]) {\n if(closingChar[1]){\n if(xmlData[index + 1] === closingChar[1]){\n return {\n data: tagExp,\n index: index\n }\n }\n }else{\n return {\n data: tagExp,\n index: index\n }\n }\n } else if (ch === '\\t') {\n ch = \" \"\n }\n tagExp += ch;\n }\n}\n\nfunction findClosingIndex(xmlData, str, i, errMsg){\n const closingIndex = xmlData.indexOf(str, i);\n if(closingIndex === -1){\n throw new Error(errMsg)\n }else{\n return closingIndex + str.length - 1;\n }\n}\n\nfunction readTagExp(xmlData,i, removeNSPrefix, closingChar = \">\"){\n const result = tagExpWithClosingIndex(xmlData, i+1, closingChar);\n if(!result) return;\n let tagExp = result.data;\n const closeIndex = result.index;\n const separatorIndex = tagExp.search(/\\s/);\n let tagName = tagExp;\n let attrExpPresent = true;\n if(separatorIndex !== -1){//separate tag name and attributes expression\n tagName = tagExp.substring(0, separatorIndex);\n tagExp = tagExp.substring(separatorIndex + 1).trimStart();\n }\n\n const rawTagName = tagName;\n if(removeNSPrefix){\n const colonIndex = tagName.indexOf(\":\");\n if(colonIndex !== -1){\n tagName = tagName.substr(colonIndex+1);\n attrExpPresent = tagName !== result.data.substr(colonIndex + 1);\n }\n }\n\n return {\n tagName: tagName,\n tagExp: tagExp,\n closeIndex: closeIndex,\n attrExpPresent: attrExpPresent,\n rawTagName: rawTagName,\n }\n}\n/**\n * find paired tag for a stop node\n * @param {string} xmlData \n * @param {string} tagName \n * @param {number} i \n */\nfunction readStopNodeData(xmlData, tagName, i){\n const startIndex = i;\n // Starting at 1 since we already have an open tag\n let openTagCount = 1;\n\n for (; i < xmlData.length; i++) {\n if( xmlData[i] === \"<\"){ \n if (xmlData[i+1] === \"/\") {//close tag\n const closeIndex = findClosingIndex(xmlData, \">\", i, `${tagName} is not closed`);\n let closeTagName = xmlData.substring(i+2,closeIndex).trim();\n if(closeTagName === tagName){\n openTagCount--;\n if (openTagCount === 0) {\n return {\n tagContent: xmlData.substring(startIndex, i),\n i : closeIndex\n }\n }\n }\n i=closeIndex;\n } else if(xmlData[i+1] === '?') { \n const closeIndex = findClosingIndex(xmlData, \"?>\", i+1, \"StopNode is not closed.\")\n i=closeIndex;\n } else if(xmlData.substr(i + 1, 3) === '!--') { \n const closeIndex = findClosingIndex(xmlData, \"-->\", i+3, \"StopNode is not closed.\")\n i=closeIndex;\n } else if(xmlData.substr(i + 1, 2) === '![') { \n const closeIndex = findClosingIndex(xmlData, \"]]>\", i, \"StopNode is not closed.\") - 2;\n i=closeIndex;\n } else {\n const tagData = readTagExp(xmlData, i, '>')\n\n if (tagData) {\n const openTagName = tagData && tagData.tagName;\n if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length-1] !== \"/\") {\n openTagCount++;\n }\n i=tagData.closeIndex;\n }\n }\n }\n }//end for loop\n}\n\nfunction parseValue(val, shouldParse, options) {\n if (shouldParse && typeof val === 'string') {\n //console.log(options)\n const newval = val.trim();\n if(newval === 'true' ) return true;\n else if(newval === 'false' ) return false;\n else return (0,strnum__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(val, options);\n } else {\n if ((0,_util_js__WEBPACK_IMPORTED_MODULE_0__.isExist)(val)) {\n return val;\n } else {\n return '';\n }\n }\n}\n\n\n//# sourceURL=webpack://fast-xml-parser/./src/xmlparser/OrderedObjParser.js?");
91593
89741
 
91594
- if(compressedObj[property] !== undefined && compressedObj.hasOwnProperty(property)) {
91595
- if(!Array.isArray(compressedObj[property])) {
91596
- compressedObj[property] = [ compressedObj[property] ];
91597
- }
91598
- compressedObj[property].push(val);
91599
- }else{
91600
- //TODO: if a node is not an array, then check if it should be an array
91601
- //also determine if it is a leaf node
91602
- if (options.isArray(property, newJpath, isLeaf )) {
91603
- compressedObj[property] = [val];
91604
- }else{
91605
- compressedObj[property] = val;
91606
- }
91607
- }
91608
- }
91609
-
91610
- }
91611
- // if(text && text.length > 0) compressedObj[options.textNodeName] = text;
91612
- if(typeof text === "string"){
91613
- if(text.length > 0) compressedObj[options.textNodeName] = text;
91614
- }else if(text !== undefined) compressedObj[options.textNodeName] = text;
91615
- return compressedObj;
91616
- }
91617
-
91618
- function propName(obj){
91619
- const keys = Object.keys(obj);
91620
- for (let i = 0; i < keys.length; i++) {
91621
- const key = keys[i];
91622
- if(key !== ":@") return key;
91623
- }
91624
- }
89742
+ /***/ }),
91625
89743
 
91626
- function assignAttributes(obj, attrMap, jpath, options){
91627
- if (attrMap) {
91628
- const keys = Object.keys(attrMap);
91629
- const len = keys.length; //don't make it inline
91630
- for (let i = 0; i < len; i++) {
91631
- const atrrName = keys[i];
91632
- if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
91633
- obj[atrrName] = [ attrMap[atrrName] ];
91634
- } else {
91635
- obj[atrrName] = attrMap[atrrName];
91636
- }
91637
- }
91638
- }
91639
- }
89744
+ /***/ "./src/xmlparser/XMLParser.js":
89745
+ /*!************************************!*\
89746
+ !*** ./src/xmlparser/XMLParser.js ***!
89747
+ \************************************/
89748
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
91640
89749
 
91641
- function isLeafTag(obj, options){
91642
- const { textNodeName } = options;
91643
- const propCount = Object.keys(obj).length;
91644
-
91645
- if (propCount === 0) {
91646
- return true;
91647
- }
89750
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ XMLParser)\n/* harmony export */ });\n/* harmony import */ var _OptionsBuilder_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./OptionsBuilder.js */ \"./src/xmlparser/OptionsBuilder.js\");\n/* harmony import */ var _OrderedObjParser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./OrderedObjParser.js */ \"./src/xmlparser/OrderedObjParser.js\");\n/* harmony import */ var _node2json_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node2json.js */ \"./src/xmlparser/node2json.js\");\n/* harmony import */ var _validator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../validator.js */ \"./src/validator.js\");\n\n\n\n\n\nclass XMLParser{\n \n constructor(options){\n this.externalEntities = {};\n this.options = (0,_OptionsBuilder_js__WEBPACK_IMPORTED_MODULE_0__.buildOptions)(options);\n \n }\n /**\n * Parse XML dats to JS object \n * @param {string|Buffer} xmlData \n * @param {boolean|Object} validationOption \n */\n parse(xmlData,validationOption){\n if(typeof xmlData === \"string\"){\n }else if( xmlData.toString){\n xmlData = xmlData.toString();\n }else{\n throw new Error(\"XML data is accepted in String or Bytes[] form.\")\n }\n if( validationOption){\n if(validationOption === true) validationOption = {}; //validate with default options\n \n const result = (0,_validator_js__WEBPACK_IMPORTED_MODULE_3__.validate)(xmlData, validationOption);\n if (result !== true) {\n throw Error( `${result.err.msg}:${result.err.line}:${result.err.col}` )\n }\n }\n const orderedObjParser = new _OrderedObjParser_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](this.options);\n orderedObjParser.addExternalEntities(this.externalEntities);\n const orderedResult = orderedObjParser.parseXml(xmlData);\n if(this.options.preserveOrder || orderedResult === undefined) return orderedResult;\n else return (0,_node2json_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(orderedResult, this.options);\n }\n\n /**\n * Add Entity which is not by default supported by this library\n * @param {string} key \n * @param {string} value \n */\n addEntity(key, value){\n if(value.indexOf(\"&\") !== -1){\n throw new Error(\"Entity value can't have '&'\")\n }else if(key.indexOf(\"&\") !== -1 || key.indexOf(\";\") !== -1){\n throw new Error(\"An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'\")\n }else if(value === \"&\"){\n throw new Error(\"An entity with value '&' is not permitted\");\n }else{\n this.externalEntities[key] = value;\n }\n }\n}\n\n//# sourceURL=webpack://fast-xml-parser/./src/xmlparser/XMLParser.js?");
91648
89751
 
91649
- if (
91650
- propCount === 1 &&
91651
- (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)
91652
- ) {
91653
- return true;
91654
- }
89752
+ /***/ }),
91655
89753
 
91656
- return false;
91657
- }
91658
- exports.prettify = prettify;
89754
+ /***/ "./src/xmlparser/node2json.js":
89755
+ /*!************************************!*\
89756
+ !*** ./src/xmlparser/node2json.js ***!
89757
+ \************************************/
89758
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
91659
89759
 
89760
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ prettify)\n/* harmony export */ });\n\n\n/**\n * \n * @param {array} node \n * @param {any} options \n * @returns \n */\nfunction prettify(node, options){\n return compress( node, options);\n}\n\n/**\n * \n * @param {array} arr \n * @param {object} options \n * @param {string} jPath \n * @returns object\n */\nfunction compress(arr, options, jPath){\n let text;\n const compressedObj = {};\n for (let i = 0; i < arr.length; i++) {\n const tagObj = arr[i];\n const property = propName(tagObj);\n let newJpath = \"\";\n if(jPath === undefined) newJpath = property;\n else newJpath = jPath + \".\" + property;\n\n if(property === options.textNodeName){\n if(text === undefined) text = tagObj[property];\n else text += \"\" + tagObj[property];\n }else if(property === undefined){\n continue;\n }else if(tagObj[property]){\n \n let val = compress(tagObj[property], options, newJpath);\n const isLeaf = isLeafTag(val, options);\n\n if(tagObj[\":@\"]){\n assignAttributes( val, tagObj[\":@\"], newJpath, options);\n }else if(Object.keys(val).length === 1 && val[options.textNodeName] !== undefined && !options.alwaysCreateTextNode){\n val = val[options.textNodeName];\n }else if(Object.keys(val).length === 0){\n if(options.alwaysCreateTextNode) val[options.textNodeName] = \"\";\n else val = \"\";\n }\n\n if(compressedObj[property] !== undefined && compressedObj.hasOwnProperty(property)) {\n if(!Array.isArray(compressedObj[property])) {\n compressedObj[property] = [ compressedObj[property] ];\n }\n compressedObj[property].push(val);\n }else{\n //TODO: if a node is not an array, then check if it should be an array\n //also determine if it is a leaf node\n if (options.isArray(property, newJpath, isLeaf )) {\n compressedObj[property] = [val];\n }else{\n compressedObj[property] = val;\n }\n }\n }\n \n }\n // if(text && text.length > 0) compressedObj[options.textNodeName] = text;\n if(typeof text === \"string\"){\n if(text.length > 0) compressedObj[options.textNodeName] = text;\n }else if(text !== undefined) compressedObj[options.textNodeName] = text;\n return compressedObj;\n}\n\nfunction propName(obj){\n const keys = Object.keys(obj);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if(key !== \":@\") return key;\n }\n}\n\nfunction assignAttributes(obj, attrMap, jpath, options){\n if (attrMap) {\n const keys = Object.keys(attrMap);\n const len = keys.length; //don't make it inline\n for (let i = 0; i < len; i++) {\n const atrrName = keys[i];\n if (options.isArray(atrrName, jpath + \".\" + atrrName, true, true)) {\n obj[atrrName] = [ attrMap[atrrName] ];\n } else {\n obj[atrrName] = attrMap[atrrName];\n }\n }\n }\n}\n\nfunction isLeafTag(obj, options){\n const { textNodeName } = options;\n const propCount = Object.keys(obj).length;\n \n if (propCount === 0) {\n return true;\n }\n\n if (\n propCount === 1 &&\n (obj[textNodeName] || typeof obj[textNodeName] === \"boolean\" || obj[textNodeName] === 0)\n ) {\n return true;\n }\n\n return false;\n}\n\n\n//# sourceURL=webpack://fast-xml-parser/./src/xmlparser/node2json.js?");
91660
89761
 
91661
89762
  /***/ }),
91662
89763
 
91663
- /***/ "./node_modules/fast-xml-parser/src/xmlparser/xmlNode.js":
91664
- /*!***************************************************************!*\
91665
- !*** ./node_modules/fast-xml-parser/src/xmlparser/xmlNode.js ***!
91666
- \***************************************************************/
91667
- /***/ ((module) => {
91668
-
91669
- "use strict";
91670
-
89764
+ /***/ "./src/xmlparser/xmlNode.js":
89765
+ /*!**********************************!*\
89766
+ !*** ./src/xmlparser/xmlNode.js ***!
89767
+ \**********************************/
89768
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
91671
89769
 
91672
- class XmlNode{
91673
- constructor(tagname) {
91674
- this.tagname = tagname;
91675
- this.child = []; //nested tags, text, cdata, comments in order
91676
- this[":@"] = {}; //attributes map
91677
- }
91678
- add(key,val){
91679
- // this.child.push( {name : key, val: val, isCdata: isCdata });
91680
- if(key === "__proto__") key = "#__proto__";
91681
- this.child.push( {[key]: val });
91682
- }
91683
- addChild(node) {
91684
- if(node.tagname === "__proto__") node.tagname = "#__proto__";
91685
- if(node[":@"] && Object.keys(node[":@"]).length > 0){
91686
- this.child.push( { [node.tagname]: node.child, [":@"]: node[":@"] });
91687
- }else{
91688
- this.child.push( { [node.tagname]: node.child });
91689
- }
91690
- };
91691
- };
89770
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ XmlNode)\n/* harmony export */ });\n\n\nclass XmlNode{\n constructor(tagname) {\n this.tagname = tagname;\n this.child = []; //nested tags, text, cdata, comments in order\n this[\":@\"] = {}; //attributes map\n }\n add(key,val){\n // this.child.push( {name : key, val: val, isCdata: isCdata });\n if(key === \"__proto__\") key = \"#__proto__\";\n this.child.push( {[key]: val });\n }\n addChild(node) {\n if(node.tagname === \"__proto__\") node.tagname = \"#__proto__\";\n if(node[\":@\"] && Object.keys(node[\":@\"]).length > 0){\n this.child.push( { [node.tagname]: node.child, [\":@\"]: node[\":@\"] });\n }else{\n this.child.push( { [node.tagname]: node.child });\n }\n }\n}\n\n\n//# sourceURL=webpack://fast-xml-parser/./src/xmlparser/xmlNode.js?");
91692
89771
 
89772
+ /***/ })
91693
89773
 
91694
- module.exports = XmlNode;
89774
+ /******/ });
89775
+ /************************************************************************/
89776
+ /******/ // The module cache
89777
+ /******/ var __webpack_module_cache__ = {};
89778
+ /******/
89779
+ /******/ // The require function
89780
+ /******/ function __nested_webpack_require_83014__(moduleId) {
89781
+ /******/ // Check if module is in cache
89782
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
89783
+ /******/ if (cachedModule !== undefined) {
89784
+ /******/ return cachedModule.exports;
89785
+ /******/ }
89786
+ /******/ // Create a new module (and put it into the cache)
89787
+ /******/ var module = __webpack_module_cache__[moduleId] = {
89788
+ /******/ // no module.id needed
89789
+ /******/ // no module.loaded needed
89790
+ /******/ exports: {}
89791
+ /******/ };
89792
+ /******/
89793
+ /******/ // Execute the module function
89794
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_83014__);
89795
+ /******/
89796
+ /******/ // Return the exports of the module
89797
+ /******/ return module.exports;
89798
+ /******/ }
89799
+ /******/
89800
+ /************************************************************************/
89801
+ /******/ /* webpack/runtime/define property getters */
89802
+ /******/ (() => {
89803
+ /******/ // define getter functions for harmony exports
89804
+ /******/ __nested_webpack_require_83014__.d = (exports, definition) => {
89805
+ /******/ for(var key in definition) {
89806
+ /******/ if(__nested_webpack_require_83014__.o(definition, key) && !__nested_webpack_require_83014__.o(exports, key)) {
89807
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
89808
+ /******/ }
89809
+ /******/ }
89810
+ /******/ };
89811
+ /******/ })();
89812
+ /******/
89813
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
89814
+ /******/ (() => {
89815
+ /******/ __nested_webpack_require_83014__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
89816
+ /******/ })();
89817
+ /******/
89818
+ /******/ /* webpack/runtime/make namespace object */
89819
+ /******/ (() => {
89820
+ /******/ // define __esModule on exports
89821
+ /******/ __nested_webpack_require_83014__.r = (exports) => {
89822
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
89823
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
89824
+ /******/ }
89825
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
89826
+ /******/ };
89827
+ /******/ })();
89828
+ /******/
89829
+ /************************************************************************/
89830
+ /******/
89831
+ /******/ // startup
89832
+ /******/ // Load entry module and return exports
89833
+ /******/ // This entry module can't be inlined because the eval devtool is used.
89834
+ /******/ var __nested_webpack_exports__ = __nested_webpack_require_83014__("./src/fxp.js");
89835
+ /******/ module.exports = __nested_webpack_exports__;
89836
+ /******/
89837
+ /******/ })()
89838
+ ;
91695
89839
 
91696
89840
  /***/ }),
91697
89841
 
@@ -99776,126 +97920,6 @@ exports.SourceMapConsumer = __webpack_require__(/*! ./lib/source-map-consumer */
99776
97920
  exports.SourceNode = __webpack_require__(/*! ./lib/source-node */ "./node_modules/source-map/lib/source-node.js").SourceNode;
99777
97921
 
99778
97922
 
99779
- /***/ }),
99780
-
99781
- /***/ "./node_modules/strnum/strnum.js":
99782
- /*!***************************************!*\
99783
- !*** ./node_modules/strnum/strnum.js ***!
99784
- \***************************************/
99785
- /***/ ((module) => {
99786
-
99787
- const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
99788
- const numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
99789
- // const octRegex = /^0x[a-z0-9]+/;
99790
- // const binRegex = /0x[a-z0-9]+/;
99791
-
99792
-
99793
- const consider = {
99794
- hex : true,
99795
- // oct: false,
99796
- leadingZeros: true,
99797
- decimalPoint: "\.",
99798
- eNotation: true,
99799
- //skipLike: /regex/
99800
- };
99801
-
99802
- function toNumber(str, options = {}){
99803
- options = Object.assign({}, consider, options );
99804
- if(!str || typeof str !== "string" ) return str;
99805
- else if(str==="0") return 0;
99806
-
99807
- let trimmedStr = str.trim();
99808
-
99809
- if(options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str;
99810
- else if (options.hex && hexRegex.test(trimmedStr)) {
99811
- return parse_int(trimmedStr, 16);
99812
- // }else if (options.oct && octRegex.test(str)) {
99813
- // return Number.parseInt(val, 8);
99814
- }else if (trimmedStr.search(/[eE]/)!== -1) { //eNotation
99815
- const notation = trimmedStr.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);
99816
- // +00.123 => [ , '+', '00', '.123', ..
99817
- if(notation){
99818
- // console.log(notation)
99819
- if(options.leadingZeros){ //accept with leading zeros
99820
- trimmedStr = (notation[1] || "") + notation[3];
99821
- }else{
99822
- if(notation[2] === "0" && notation[3][0]=== "."){ //valid number
99823
- }else{
99824
- return str;
99825
- }
99826
- }
99827
- return options.eNotation ? Number(trimmedStr) : str;
99828
- }else{
99829
- return str;
99830
- }
99831
- // }else if (options.parseBin && binRegex.test(str)) {
99832
- // return Number.parseInt(val, 2);
99833
- }else{
99834
- //separate negative sign, leading zeros, and rest number
99835
- const match = numRegex.exec(trimmedStr);
99836
- // +00.123 => [ , '+', '00', '.123', ..
99837
- if(match){
99838
- const sign = match[1];
99839
- const leadingZeros = match[2];
99840
- let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros
99841
- //trim ending zeros for floating number
99842
-
99843
- if(!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; //-0123
99844
- else if(!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; //0123
99845
- else if(options.leadingZeros && leadingZeros===str) return 0; //00
99846
-
99847
- else{//no leading zeros or leading zeros are allowed
99848
- const num = Number(trimmedStr);
99849
- const numStr = "" + num;
99850
-
99851
- if(numStr.search(/[eE]/) !== -1){ //given number is long and parsed to eNotation
99852
- if(options.eNotation) return num;
99853
- else return str;
99854
- }else if(trimmedStr.indexOf(".") !== -1){ //floating number
99855
- if(numStr === "0" && (numTrimmedByZeros === "") ) return num; //0.0
99856
- else if(numStr === numTrimmedByZeros) return num; //0.456. 0.79000
99857
- else if( sign && numStr === "-"+numTrimmedByZeros) return num;
99858
- else return str;
99859
- }
99860
-
99861
- if(leadingZeros){
99862
- return (numTrimmedByZeros === numStr) || (sign+numTrimmedByZeros === numStr) ? num : str
99863
- }else {
99864
- return (trimmedStr === numStr) || (trimmedStr === sign+numStr) ? num : str
99865
- }
99866
- }
99867
- }else{ //non-numeric string
99868
- return str;
99869
- }
99870
- }
99871
- }
99872
-
99873
- /**
99874
- *
99875
- * @param {string} numStr without leading zeros
99876
- * @returns
99877
- */
99878
- function trimZeros(numStr){
99879
- if(numStr && numStr.indexOf(".") !== -1){//float
99880
- numStr = numStr.replace(/0+$/, ""); //remove ending zeros
99881
- if(numStr === ".") numStr = "0";
99882
- else if(numStr[0] === ".") numStr = "0"+numStr;
99883
- else if(numStr[numStr.length-1] === ".") numStr = numStr.substr(0,numStr.length-1);
99884
- return numStr;
99885
- }
99886
- return numStr;
99887
- }
99888
-
99889
- function parse_int(numStr, base){
99890
- //polyfill
99891
- if(parseInt) return parseInt(numStr, base);
99892
- else if(Number.parseInt) return Number.parseInt(numStr, base);
99893
- else if(window && window.parseInt) return window.parseInt(numStr, base);
99894
- else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")
99895
- }
99896
-
99897
- module.exports = toNumber;
99898
-
99899
97923
  /***/ }),
99900
97924
 
99901
97925
  /***/ "./node_modules/vscode-languageserver-types/lib/umd sync recursive":