@etainabl/nodejs-sdk 1.3.192 → 1.3.196

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 (63) hide show
  1. package/dist/esm/index.js +1546 -9430
  2. package/dist/esm/index.js.map +1 -1
  3. package/dist/index.d.cts +11 -1
  4. package/dist/index.d.ts +11 -1
  5. package/dist/index.js +7745 -31978
  6. package/dist/index.js.map +1 -1
  7. package/package.json +2 -1
  8. package/dist/esm/chunk-3G3VXGQN.js +0 -164
  9. package/dist/esm/chunk-3G3VXGQN.js.map +0 -1
  10. package/dist/esm/chunk-4JDZJVKZ.js +0 -29
  11. package/dist/esm/chunk-4JDZJVKZ.js.map +0 -1
  12. package/dist/esm/chunk-4QSQRVYQ.js +0 -4408
  13. package/dist/esm/chunk-4QSQRVYQ.js.map +0 -1
  14. package/dist/esm/chunk-7QBJXGSP.js +0 -143
  15. package/dist/esm/chunk-7QBJXGSP.js.map +0 -1
  16. package/dist/esm/chunk-CRX53WMM.js +0 -222
  17. package/dist/esm/chunk-CRX53WMM.js.map +0 -1
  18. package/dist/esm/chunk-D74LA2XQ.js +0 -773
  19. package/dist/esm/chunk-D74LA2XQ.js.map +0 -1
  20. package/dist/esm/chunk-G3PMV62Z.js +0 -36
  21. package/dist/esm/chunk-G3PMV62Z.js.map +0 -1
  22. package/dist/esm/chunk-IX2LY325.js +0 -38
  23. package/dist/esm/chunk-IX2LY325.js.map +0 -1
  24. package/dist/esm/chunk-KWPO3OOT.js +0 -180
  25. package/dist/esm/chunk-KWPO3OOT.js.map +0 -1
  26. package/dist/esm/chunk-MCSCBMNG.js +0 -1424
  27. package/dist/esm/chunk-MCSCBMNG.js.map +0 -1
  28. package/dist/esm/chunk-RREOR7G6.js +0 -9
  29. package/dist/esm/chunk-RREOR7G6.js.map +0 -1
  30. package/dist/esm/chunk-UQAJZJ7E.js +0 -11
  31. package/dist/esm/chunk-UQAJZJ7E.js.map +0 -1
  32. package/dist/esm/chunk-UZGMBQZB.js +0 -13
  33. package/dist/esm/chunk-UZGMBQZB.js.map +0 -1
  34. package/dist/esm/chunk-XARQOPCZ.js +0 -47
  35. package/dist/esm/chunk-XARQOPCZ.js.map +0 -1
  36. package/dist/esm/chunk-YCRW5ZB7.js +0 -257
  37. package/dist/esm/chunk-YCRW5ZB7.js.map +0 -1
  38. package/dist/esm/chunk-YLT3BSXS.js +0 -180
  39. package/dist/esm/chunk-YLT3BSXS.js.map +0 -1
  40. package/dist/esm/chunk-Z63CAAFL.js +0 -43
  41. package/dist/esm/chunk-Z63CAAFL.js.map +0 -1
  42. package/dist/esm/dist-es-4VSEUPMG.js +0 -168
  43. package/dist/esm/dist-es-4VSEUPMG.js.map +0 -1
  44. package/dist/esm/dist-es-5G2D4IRG.js +0 -88
  45. package/dist/esm/dist-es-5G2D4IRG.js.map +0 -1
  46. package/dist/esm/dist-es-6PYQFA7S.js +0 -68
  47. package/dist/esm/dist-es-6PYQFA7S.js.map +0 -1
  48. package/dist/esm/dist-es-O7YXE2TO.js +0 -381
  49. package/dist/esm/dist-es-O7YXE2TO.js.map +0 -1
  50. package/dist/esm/dist-es-RVUNLU7U.js +0 -314
  51. package/dist/esm/dist-es-RVUNLU7U.js.map +0 -1
  52. package/dist/esm/dist-es-UEBBJXWA.js +0 -22
  53. package/dist/esm/dist-es-UEBBJXWA.js.map +0 -1
  54. package/dist/esm/dist-es-XS4DOSVC.js +0 -202
  55. package/dist/esm/dist-es-XS4DOSVC.js.map +0 -1
  56. package/dist/esm/event-streams-OE4R7Y65.js +0 -238
  57. package/dist/esm/event-streams-OE4R7Y65.js.map +0 -1
  58. package/dist/esm/loadSso-3FHKR3DN.js +0 -662
  59. package/dist/esm/loadSso-3FHKR3DN.js.map +0 -1
  60. package/dist/esm/sso-oidc-EORQ3JVU.js +0 -832
  61. package/dist/esm/sso-oidc-EORQ3JVU.js.map +0 -1
  62. package/dist/esm/sts-VPLY2J63.js +0 -1169
  63. package/dist/esm/sts-VPLY2J63.js.map +0 -1
@@ -1,1424 +0,0 @@
1
- import {
2
- collectBodyString
3
- } from "./chunk-4QSQRVYQ.js";
4
-
5
- // node_modules/@smithy/smithy-client/dist-es/get-value-from-text-node.js
6
- var getValueFromTextNode = (obj) => {
7
- const textNodeName = "#text";
8
- for (const key in obj) {
9
- if (obj.hasOwnProperty(key) && obj[key][textNodeName] !== void 0) {
10
- obj[key] = obj[key][textNodeName];
11
- } else if (typeof obj[key] === "object" && obj[key] !== null) {
12
- obj[key] = getValueFromTextNode(obj[key]);
13
- }
14
- }
15
- return obj;
16
- };
17
-
18
- // node_modules/fast-xml-parser/src/util.js
19
- var 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";
20
- var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
21
- var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*";
22
- var regexName = new RegExp("^" + nameRegexp + "$");
23
- function getAllMatches(string, regex) {
24
- const matches = [];
25
- let match = regex.exec(string);
26
- while (match) {
27
- const allmatches = [];
28
- allmatches.startIndex = regex.lastIndex - match[0].length;
29
- const len = match.length;
30
- for (let index = 0; index < len; index++) {
31
- allmatches.push(match[index]);
32
- }
33
- matches.push(allmatches);
34
- match = regex.exec(string);
35
- }
36
- return matches;
37
- }
38
- var isName = function(string) {
39
- const match = regexName.exec(string);
40
- return !(match === null || typeof match === "undefined");
41
- };
42
- function isExist(v) {
43
- return typeof v !== "undefined";
44
- }
45
-
46
- // node_modules/fast-xml-parser/src/validator.js
47
- var defaultOptions = {
48
- allowBooleanAttributes: false,
49
- //A tag can have attributes without any value
50
- unpairedTags: []
51
- };
52
- function validate(xmlData, options) {
53
- options = Object.assign({}, defaultOptions, options);
54
- const tags = [];
55
- let tagFound = false;
56
- let reachedRoot = false;
57
- if (xmlData[0] === "\uFEFF") {
58
- xmlData = xmlData.substr(1);
59
- }
60
- for (let i = 0; i < xmlData.length; i++) {
61
- if (xmlData[i] === "<" && xmlData[i + 1] === "?") {
62
- i += 2;
63
- i = readPI(xmlData, i);
64
- if (i.err) return i;
65
- } else if (xmlData[i] === "<") {
66
- let tagStartPos = i;
67
- i++;
68
- if (xmlData[i] === "!") {
69
- i = readCommentAndCDATA(xmlData, i);
70
- continue;
71
- } else {
72
- let closingTag = false;
73
- if (xmlData[i] === "/") {
74
- closingTag = true;
75
- i++;
76
- }
77
- let tagName = "";
78
- for (; i < xmlData.length && xmlData[i] !== ">" && xmlData[i] !== " " && xmlData[i] !== " " && xmlData[i] !== "\n" && xmlData[i] !== "\r"; i++) {
79
- tagName += xmlData[i];
80
- }
81
- tagName = tagName.trim();
82
- if (tagName[tagName.length - 1] === "/") {
83
- tagName = tagName.substring(0, tagName.length - 1);
84
- i--;
85
- }
86
- if (!validateTagName(tagName)) {
87
- let msg;
88
- if (tagName.trim().length === 0) {
89
- msg = "Invalid space after '<'.";
90
- } else {
91
- msg = "Tag '" + tagName + "' is an invalid name.";
92
- }
93
- return getErrorObject("InvalidTag", msg, getLineNumberForPosition(xmlData, i));
94
- }
95
- const result = readAttributeStr(xmlData, i);
96
- if (result === false) {
97
- return getErrorObject("InvalidAttr", "Attributes for '" + tagName + "' have open quote.", getLineNumberForPosition(xmlData, i));
98
- }
99
- let attrStr = result.value;
100
- i = result.index;
101
- if (attrStr[attrStr.length - 1] === "/") {
102
- const attrStrStart = i - attrStr.length;
103
- attrStr = attrStr.substring(0, attrStr.length - 1);
104
- const isValid = validateAttributeString(attrStr, options);
105
- if (isValid === true) {
106
- tagFound = true;
107
- } else {
108
- return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));
109
- }
110
- } else if (closingTag) {
111
- if (!result.tagClosed) {
112
- return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
113
- } else if (attrStr.trim().length > 0) {
114
- return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
115
- } else if (tags.length === 0) {
116
- return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
117
- } else {
118
- const otg = tags.pop();
119
- if (tagName !== otg.tagName) {
120
- let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);
121
- return getErrorObject(
122
- "InvalidTag",
123
- "Expected closing tag '" + otg.tagName + "' (opened in line " + openPos.line + ", col " + openPos.col + ") instead of closing tag '" + tagName + "'.",
124
- getLineNumberForPosition(xmlData, tagStartPos)
125
- );
126
- }
127
- if (tags.length == 0) {
128
- reachedRoot = true;
129
- }
130
- }
131
- } else {
132
- const isValid = validateAttributeString(attrStr, options);
133
- if (isValid !== true) {
134
- return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));
135
- }
136
- if (reachedRoot === true) {
137
- return getErrorObject("InvalidXml", "Multiple possible root nodes found.", getLineNumberForPosition(xmlData, i));
138
- } else if (options.unpairedTags.indexOf(tagName) !== -1) {
139
- } else {
140
- tags.push({ tagName, tagStartPos });
141
- }
142
- tagFound = true;
143
- }
144
- for (i++; i < xmlData.length; i++) {
145
- if (xmlData[i] === "<") {
146
- if (xmlData[i + 1] === "!") {
147
- i++;
148
- i = readCommentAndCDATA(xmlData, i);
149
- continue;
150
- } else if (xmlData[i + 1] === "?") {
151
- i = readPI(xmlData, ++i);
152
- if (i.err) return i;
153
- } else {
154
- break;
155
- }
156
- } else if (xmlData[i] === "&") {
157
- const afterAmp = validateAmpersand(xmlData, i);
158
- if (afterAmp == -1)
159
- return getErrorObject("InvalidChar", "char '&' is not expected.", getLineNumberForPosition(xmlData, i));
160
- i = afterAmp;
161
- } else {
162
- if (reachedRoot === true && !isWhiteSpace(xmlData[i])) {
163
- return getErrorObject("InvalidXml", "Extra text at the end", getLineNumberForPosition(xmlData, i));
164
- }
165
- }
166
- }
167
- if (xmlData[i] === "<") {
168
- i--;
169
- }
170
- }
171
- } else {
172
- if (isWhiteSpace(xmlData[i])) {
173
- continue;
174
- }
175
- return getErrorObject("InvalidChar", "char '" + xmlData[i] + "' is not expected.", getLineNumberForPosition(xmlData, i));
176
- }
177
- }
178
- if (!tagFound) {
179
- return getErrorObject("InvalidXml", "Start tag expected.", 1);
180
- } else if (tags.length == 1) {
181
- return getErrorObject("InvalidTag", "Unclosed tag '" + tags[0].tagName + "'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
182
- } else if (tags.length > 0) {
183
- return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(tags.map((t) => t.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
184
- }
185
- return true;
186
- }
187
- function isWhiteSpace(char) {
188
- return char === " " || char === " " || char === "\n" || char === "\r";
189
- }
190
- function readPI(xmlData, i) {
191
- const start = i;
192
- for (; i < xmlData.length; i++) {
193
- if (xmlData[i] == "?" || xmlData[i] == " ") {
194
- const tagname = xmlData.substr(start, i - start);
195
- if (i > 5 && tagname === "xml") {
196
- return getErrorObject("InvalidXml", "XML declaration allowed only at the start of the document.", getLineNumberForPosition(xmlData, i));
197
- } else if (xmlData[i] == "?" && xmlData[i + 1] == ">") {
198
- i++;
199
- break;
200
- } else {
201
- continue;
202
- }
203
- }
204
- }
205
- return i;
206
- }
207
- function readCommentAndCDATA(xmlData, i) {
208
- if (xmlData.length > i + 5 && xmlData[i + 1] === "-" && xmlData[i + 2] === "-") {
209
- for (i += 3; i < xmlData.length; i++) {
210
- if (xmlData[i] === "-" && xmlData[i + 1] === "-" && xmlData[i + 2] === ">") {
211
- i += 2;
212
- break;
213
- }
214
- }
215
- } else if (xmlData.length > i + 8 && xmlData[i + 1] === "D" && xmlData[i + 2] === "O" && xmlData[i + 3] === "C" && xmlData[i + 4] === "T" && xmlData[i + 5] === "Y" && xmlData[i + 6] === "P" && xmlData[i + 7] === "E") {
216
- let angleBracketsCount = 1;
217
- for (i += 8; i < xmlData.length; i++) {
218
- if (xmlData[i] === "<") {
219
- angleBracketsCount++;
220
- } else if (xmlData[i] === ">") {
221
- angleBracketsCount--;
222
- if (angleBracketsCount === 0) {
223
- break;
224
- }
225
- }
226
- }
227
- } else if (xmlData.length > i + 9 && xmlData[i + 1] === "[" && xmlData[i + 2] === "C" && xmlData[i + 3] === "D" && xmlData[i + 4] === "A" && xmlData[i + 5] === "T" && xmlData[i + 6] === "A" && xmlData[i + 7] === "[") {
228
- for (i += 8; i < xmlData.length; i++) {
229
- if (xmlData[i] === "]" && xmlData[i + 1] === "]" && xmlData[i + 2] === ">") {
230
- i += 2;
231
- break;
232
- }
233
- }
234
- }
235
- return i;
236
- }
237
- var doubleQuote = '"';
238
- var singleQuote = "'";
239
- function readAttributeStr(xmlData, i) {
240
- let attrStr = "";
241
- let startChar = "";
242
- let tagClosed = false;
243
- for (; i < xmlData.length; i++) {
244
- if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
245
- if (startChar === "") {
246
- startChar = xmlData[i];
247
- } else if (startChar !== xmlData[i]) {
248
- } else {
249
- startChar = "";
250
- }
251
- } else if (xmlData[i] === ">") {
252
- if (startChar === "") {
253
- tagClosed = true;
254
- break;
255
- }
256
- }
257
- attrStr += xmlData[i];
258
- }
259
- if (startChar !== "") {
260
- return false;
261
- }
262
- return {
263
- value: attrStr,
264
- index: i,
265
- tagClosed
266
- };
267
- }
268
- var validAttrStrRegxp = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
269
- function validateAttributeString(attrStr, options) {
270
- const matches = getAllMatches(attrStr, validAttrStrRegxp);
271
- const attrNames = {};
272
- for (let i = 0; i < matches.length; i++) {
273
- if (matches[i][1].length === 0) {
274
- return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' has no space in starting.", getPositionFromMatch(matches[i]));
275
- } else if (matches[i][3] !== void 0 && matches[i][4] === void 0) {
276
- return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' is without value.", getPositionFromMatch(matches[i]));
277
- } else if (matches[i][3] === void 0 && !options.allowBooleanAttributes) {
278
- return getErrorObject("InvalidAttr", "boolean attribute '" + matches[i][2] + "' is not allowed.", getPositionFromMatch(matches[i]));
279
- }
280
- const attrName = matches[i][2];
281
- if (!validateAttrName(attrName)) {
282
- return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is an invalid name.", getPositionFromMatch(matches[i]));
283
- }
284
- if (!attrNames.hasOwnProperty(attrName)) {
285
- attrNames[attrName] = 1;
286
- } else {
287
- return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is repeated.", getPositionFromMatch(matches[i]));
288
- }
289
- }
290
- return true;
291
- }
292
- function validateNumberAmpersand(xmlData, i) {
293
- let re = /\d/;
294
- if (xmlData[i] === "x") {
295
- i++;
296
- re = /[\da-fA-F]/;
297
- }
298
- for (; i < xmlData.length; i++) {
299
- if (xmlData[i] === ";")
300
- return i;
301
- if (!xmlData[i].match(re))
302
- break;
303
- }
304
- return -1;
305
- }
306
- function validateAmpersand(xmlData, i) {
307
- i++;
308
- if (xmlData[i] === ";")
309
- return -1;
310
- if (xmlData[i] === "#") {
311
- i++;
312
- return validateNumberAmpersand(xmlData, i);
313
- }
314
- let count = 0;
315
- for (; i < xmlData.length; i++, count++) {
316
- if (xmlData[i].match(/\w/) && count < 20)
317
- continue;
318
- if (xmlData[i] === ";")
319
- break;
320
- return -1;
321
- }
322
- return i;
323
- }
324
- function getErrorObject(code, message, lineNumber) {
325
- return {
326
- err: {
327
- code,
328
- msg: message,
329
- line: lineNumber.line || lineNumber,
330
- col: lineNumber.col
331
- }
332
- };
333
- }
334
- function validateAttrName(attrName) {
335
- return isName(attrName);
336
- }
337
- function validateTagName(tagname) {
338
- return isName(tagname);
339
- }
340
- function getLineNumberForPosition(xmlData, index) {
341
- const lines = xmlData.substring(0, index).split(/\r?\n/);
342
- return {
343
- line: lines.length,
344
- // column number is last line's length + 1, because column numbering starts at 1:
345
- col: lines[lines.length - 1].length + 1
346
- };
347
- }
348
- function getPositionFromMatch(match) {
349
- return match.startIndex + match[1].length;
350
- }
351
-
352
- // node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
353
- var defaultOptions2 = {
354
- preserveOrder: false,
355
- attributeNamePrefix: "@_",
356
- attributesGroupName: false,
357
- textNodeName: "#text",
358
- ignoreAttributes: true,
359
- removeNSPrefix: false,
360
- // remove NS from tag name or attribute name if true
361
- allowBooleanAttributes: false,
362
- //a tag can have attributes without any value
363
- //ignoreRootElement : false,
364
- parseTagValue: true,
365
- parseAttributeValue: false,
366
- trimValues: true,
367
- //Trim string values of tag and attributes
368
- cdataPropName: false,
369
- numberParseOptions: {
370
- hex: true,
371
- leadingZeros: true,
372
- eNotation: true
373
- },
374
- tagValueProcessor: function(tagName, val) {
375
- return val;
376
- },
377
- attributeValueProcessor: function(attrName, val) {
378
- return val;
379
- },
380
- stopNodes: [],
381
- //nested tags will not be parsed even for errors
382
- alwaysCreateTextNode: false,
383
- isArray: () => false,
384
- commentPropName: false,
385
- unpairedTags: [],
386
- processEntities: true,
387
- htmlEntities: false,
388
- ignoreDeclaration: false,
389
- ignorePiTags: false,
390
- transformTagName: false,
391
- transformAttributeName: false,
392
- updateTag: function(tagName, jPath, attrs) {
393
- return tagName;
394
- },
395
- // skipEmptyListItem: false
396
- captureMetaData: false
397
- };
398
- var buildOptions = function(options) {
399
- return Object.assign({}, defaultOptions2, options);
400
- };
401
-
402
- // node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
403
- var METADATA_SYMBOL;
404
- if (typeof Symbol !== "function") {
405
- METADATA_SYMBOL = "@@xmlMetadata";
406
- } else {
407
- METADATA_SYMBOL = Symbol("XML Node Metadata");
408
- }
409
- var XmlNode = class {
410
- constructor(tagname) {
411
- this.tagname = tagname;
412
- this.child = [];
413
- this[":@"] = {};
414
- }
415
- add(key, val) {
416
- if (key === "__proto__") key = "#__proto__";
417
- this.child.push({ [key]: val });
418
- }
419
- addChild(node, startIndex) {
420
- if (node.tagname === "__proto__") node.tagname = "#__proto__";
421
- if (node[":@"] && Object.keys(node[":@"]).length > 0) {
422
- this.child.push({ [node.tagname]: node.child, [":@"]: node[":@"] });
423
- } else {
424
- this.child.push({ [node.tagname]: node.child });
425
- }
426
- if (startIndex !== void 0) {
427
- this.child[this.child.length - 1][METADATA_SYMBOL] = { startIndex };
428
- }
429
- }
430
- /** symbol used for metadata */
431
- static getMetaDataSymbol() {
432
- return METADATA_SYMBOL;
433
- }
434
- };
435
-
436
- // node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
437
- function readDocType(xmlData, i) {
438
- const entities = {};
439
- if (xmlData[i + 3] === "O" && xmlData[i + 4] === "C" && xmlData[i + 5] === "T" && xmlData[i + 6] === "Y" && xmlData[i + 7] === "P" && xmlData[i + 8] === "E") {
440
- i = i + 9;
441
- let angleBracketsCount = 1;
442
- let hasBody = false, comment = false;
443
- let exp = "";
444
- for (; i < xmlData.length; i++) {
445
- if (xmlData[i] === "<" && !comment) {
446
- if (hasBody && hasSeq(xmlData, "!ENTITY", i)) {
447
- i += 7;
448
- let entityName, val;
449
- [entityName, val, i] = readEntityExp(xmlData, i + 1);
450
- if (val.indexOf("&") === -1)
451
- entities[entityName] = {
452
- regx: RegExp(`&${entityName};`, "g"),
453
- val
454
- };
455
- } else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
456
- i += 8;
457
- const { index } = readElementExp(xmlData, i + 1);
458
- i = index;
459
- } else if (hasBody && hasSeq(xmlData, "!ATTLIST", i)) {
460
- i += 8;
461
- } else if (hasBody && hasSeq(xmlData, "!NOTATION", i)) {
462
- i += 9;
463
- const { index } = readNotationExp(xmlData, i + 1);
464
- i = index;
465
- } else if (hasSeq(xmlData, "!--", i)) comment = true;
466
- else throw new Error(`Invalid DOCTYPE`);
467
- angleBracketsCount++;
468
- exp = "";
469
- } else if (xmlData[i] === ">") {
470
- if (comment) {
471
- if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") {
472
- comment = false;
473
- angleBracketsCount--;
474
- }
475
- } else {
476
- angleBracketsCount--;
477
- }
478
- if (angleBracketsCount === 0) {
479
- break;
480
- }
481
- } else if (xmlData[i] === "[") {
482
- hasBody = true;
483
- } else {
484
- exp += xmlData[i];
485
- }
486
- }
487
- if (angleBracketsCount !== 0) {
488
- throw new Error(`Unclosed DOCTYPE`);
489
- }
490
- } else {
491
- throw new Error(`Invalid Tag instead of DOCTYPE`);
492
- }
493
- return { entities, i };
494
- }
495
- var skipWhitespace = (data, index) => {
496
- while (index < data.length && /\s/.test(data[index])) {
497
- index++;
498
- }
499
- return index;
500
- };
501
- function readEntityExp(xmlData, i) {
502
- i = skipWhitespace(xmlData, i);
503
- let entityName = "";
504
- while (i < xmlData.length && !/\s/.test(xmlData[i]) && xmlData[i] !== '"' && xmlData[i] !== "'") {
505
- entityName += xmlData[i];
506
- i++;
507
- }
508
- validateEntityName(entityName);
509
- i = skipWhitespace(xmlData, i);
510
- if (xmlData.substring(i, i + 6).toUpperCase() === "SYSTEM") {
511
- throw new Error("External entities are not supported");
512
- } else if (xmlData[i] === "%") {
513
- throw new Error("Parameter entities are not supported");
514
- }
515
- let entityValue = "";
516
- [i, entityValue] = readIdentifierVal(xmlData, i, "entity");
517
- i--;
518
- return [entityName, entityValue, i];
519
- }
520
- function readNotationExp(xmlData, i) {
521
- i = skipWhitespace(xmlData, i);
522
- let notationName = "";
523
- while (i < xmlData.length && !/\s/.test(xmlData[i])) {
524
- notationName += xmlData[i];
525
- i++;
526
- }
527
- validateEntityName(notationName);
528
- i = skipWhitespace(xmlData, i);
529
- const identifierType = xmlData.substring(i, i + 6).toUpperCase();
530
- if (identifierType !== "SYSTEM" && identifierType !== "PUBLIC") {
531
- throw new Error(`Expected SYSTEM or PUBLIC, found "${identifierType}"`);
532
- }
533
- i += identifierType.length;
534
- i = skipWhitespace(xmlData, i);
535
- let publicIdentifier = null;
536
- let systemIdentifier = null;
537
- if (identifierType === "PUBLIC") {
538
- [i, publicIdentifier] = readIdentifierVal(xmlData, i, "publicIdentifier");
539
- i = skipWhitespace(xmlData, i);
540
- if (xmlData[i] === '"' || xmlData[i] === "'") {
541
- [i, systemIdentifier] = readIdentifierVal(xmlData, i, "systemIdentifier");
542
- }
543
- } else if (identifierType === "SYSTEM") {
544
- [i, systemIdentifier] = readIdentifierVal(xmlData, i, "systemIdentifier");
545
- if (!systemIdentifier) {
546
- throw new Error("Missing mandatory system identifier for SYSTEM notation");
547
- }
548
- }
549
- return { notationName, publicIdentifier, systemIdentifier, index: --i };
550
- }
551
- function readIdentifierVal(xmlData, i, type) {
552
- let identifierVal = "";
553
- const startChar = xmlData[i];
554
- if (startChar !== '"' && startChar !== "'") {
555
- throw new Error(`Expected quoted string, found "${startChar}"`);
556
- }
557
- i++;
558
- while (i < xmlData.length && xmlData[i] !== startChar) {
559
- identifierVal += xmlData[i];
560
- i++;
561
- }
562
- if (xmlData[i] !== startChar) {
563
- throw new Error(`Unterminated ${type} value`);
564
- }
565
- i++;
566
- return [i, identifierVal];
567
- }
568
- function readElementExp(xmlData, i) {
569
- i = skipWhitespace(xmlData, i);
570
- let elementName = "";
571
- while (i < xmlData.length && !/\s/.test(xmlData[i])) {
572
- elementName += xmlData[i];
573
- i++;
574
- }
575
- if (!validateEntityName(elementName)) {
576
- throw new Error(`Invalid element name: "${elementName}"`);
577
- }
578
- i = skipWhitespace(xmlData, i);
579
- let contentModel = "";
580
- if (xmlData[i] === "E" && hasSeq(xmlData, "MPTY", i)) i += 4;
581
- else if (xmlData[i] === "A" && hasSeq(xmlData, "NY", i)) i += 2;
582
- else if (xmlData[i] === "(") {
583
- i++;
584
- while (i < xmlData.length && xmlData[i] !== ")") {
585
- contentModel += xmlData[i];
586
- i++;
587
- }
588
- if (xmlData[i] !== ")") {
589
- throw new Error("Unterminated content model");
590
- }
591
- } else {
592
- throw new Error(`Invalid Element Expression, found "${xmlData[i]}"`);
593
- }
594
- return {
595
- elementName,
596
- contentModel: contentModel.trim(),
597
- index: i
598
- };
599
- }
600
- function hasSeq(data, seq, i) {
601
- for (let j = 0; j < seq.length; j++) {
602
- if (seq[j] !== data[i + j + 1]) return false;
603
- }
604
- return true;
605
- }
606
- function validateEntityName(name) {
607
- if (isName(name))
608
- return name;
609
- else
610
- throw new Error(`Invalid entity name ${name}`);
611
- }
612
-
613
- // node_modules/strnum/strnum.js
614
- var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
615
- var numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
616
- var consider = {
617
- hex: true,
618
- // oct: false,
619
- leadingZeros: true,
620
- decimalPoint: ".",
621
- eNotation: true
622
- //skipLike: /regex/
623
- };
624
- function toNumber(str, options = {}) {
625
- options = Object.assign({}, consider, options);
626
- if (!str || typeof str !== "string") return str;
627
- let trimmedStr = str.trim();
628
- if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str;
629
- else if (str === "0") return 0;
630
- else if (options.hex && hexRegex.test(trimmedStr)) {
631
- return parse_int(trimmedStr, 16);
632
- } else if (trimmedStr.search(/.+[eE].+/) !== -1) {
633
- return resolveEnotation(str, trimmedStr, options);
634
- } else {
635
- const match = numRegex.exec(trimmedStr);
636
- if (match) {
637
- const sign = match[1] || "";
638
- const leadingZeros = match[2];
639
- let numTrimmedByZeros = trimZeros(match[3]);
640
- const decimalAdjacentToLeadingZeros = sign ? (
641
- // 0., -00., 000.
642
- str[leadingZeros.length + 1] === "."
643
- ) : str[leadingZeros.length] === ".";
644
- if (!options.leadingZeros && (leadingZeros.length > 1 || leadingZeros.length === 1 && !decimalAdjacentToLeadingZeros)) {
645
- return str;
646
- } else {
647
- const num = Number(trimmedStr);
648
- const parsedStr = String(num);
649
- if (num === 0) return num;
650
- if (parsedStr.search(/[eE]/) !== -1) {
651
- if (options.eNotation) return num;
652
- else return str;
653
- } else if (trimmedStr.indexOf(".") !== -1) {
654
- if (parsedStr === "0") return num;
655
- else if (parsedStr === numTrimmedByZeros) return num;
656
- else if (parsedStr === `${sign}${numTrimmedByZeros}`) return num;
657
- else return str;
658
- }
659
- let n = leadingZeros ? numTrimmedByZeros : trimmedStr;
660
- if (leadingZeros) {
661
- return n === parsedStr || sign + n === parsedStr ? num : str;
662
- } else {
663
- return n === parsedStr || n === sign + parsedStr ? num : str;
664
- }
665
- }
666
- } else {
667
- return str;
668
- }
669
- }
670
- }
671
- var eNotationRegx = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
672
- function resolveEnotation(str, trimmedStr, options) {
673
- if (!options.eNotation) return str;
674
- const notation = trimmedStr.match(eNotationRegx);
675
- if (notation) {
676
- let sign = notation[1] || "";
677
- const eChar = notation[3].indexOf("e") === -1 ? "E" : "e";
678
- const leadingZeros = notation[2];
679
- const eAdjacentToLeadingZeros = sign ? (
680
- // 0E.
681
- str[leadingZeros.length + 1] === eChar
682
- ) : str[leadingZeros.length] === eChar;
683
- if (leadingZeros.length > 1 && eAdjacentToLeadingZeros) return str;
684
- else if (leadingZeros.length === 1 && (notation[3].startsWith(`.${eChar}`) || notation[3][0] === eChar)) {
685
- return Number(trimmedStr);
686
- } else if (options.leadingZeros && !eAdjacentToLeadingZeros) {
687
- trimmedStr = (notation[1] || "") + notation[3];
688
- return Number(trimmedStr);
689
- } else return str;
690
- } else {
691
- return str;
692
- }
693
- }
694
- function trimZeros(numStr) {
695
- if (numStr && numStr.indexOf(".") !== -1) {
696
- numStr = numStr.replace(/0+$/, "");
697
- if (numStr === ".") numStr = "0";
698
- else if (numStr[0] === ".") numStr = "0" + numStr;
699
- else if (numStr[numStr.length - 1] === ".") numStr = numStr.substring(0, numStr.length - 1);
700
- return numStr;
701
- }
702
- return numStr;
703
- }
704
- function parse_int(numStr, base) {
705
- if (parseInt) return parseInt(numStr, base);
706
- else if (Number.parseInt) return Number.parseInt(numStr, base);
707
- else if (window && window.parseInt) return window.parseInt(numStr, base);
708
- else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
709
- }
710
-
711
- // node_modules/fast-xml-parser/src/ignoreAttributes.js
712
- function getIgnoreAttributesFn(ignoreAttributes) {
713
- if (typeof ignoreAttributes === "function") {
714
- return ignoreAttributes;
715
- }
716
- if (Array.isArray(ignoreAttributes)) {
717
- return (attrName) => {
718
- for (const pattern of ignoreAttributes) {
719
- if (typeof pattern === "string" && attrName === pattern) {
720
- return true;
721
- }
722
- if (pattern instanceof RegExp && pattern.test(attrName)) {
723
- return true;
724
- }
725
- }
726
- };
727
- }
728
- return () => false;
729
- }
730
-
731
- // node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
732
- var OrderedObjParser = class {
733
- constructor(options) {
734
- this.options = options;
735
- this.currentNode = null;
736
- this.tagsNodeStack = [];
737
- this.docTypeEntities = {};
738
- this.lastEntities = {
739
- "apos": { regex: /&(apos|#39|#x27);/g, val: "'" },
740
- "gt": { regex: /&(gt|#62|#x3E);/g, val: ">" },
741
- "lt": { regex: /&(lt|#60|#x3C);/g, val: "<" },
742
- "quot": { regex: /&(quot|#34|#x22);/g, val: '"' }
743
- };
744
- this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" };
745
- this.htmlEntities = {
746
- "space": { regex: /&(nbsp|#160);/g, val: " " },
747
- // "lt" : { regex: /&(lt|#60);/g, val: "<" },
748
- // "gt" : { regex: /&(gt|#62);/g, val: ">" },
749
- // "amp" : { regex: /&(amp|#38);/g, val: "&" },
750
- // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
751
- // "apos" : { regex: /&(apos|#39);/g, val: "'" },
752
- "cent": { regex: /&(cent|#162);/g, val: "\xA2" },
753
- "pound": { regex: /&(pound|#163);/g, val: "\xA3" },
754
- "yen": { regex: /&(yen|#165);/g, val: "\xA5" },
755
- "euro": { regex: /&(euro|#8364);/g, val: "\u20AC" },
756
- "copyright": { regex: /&(copy|#169);/g, val: "\xA9" },
757
- "reg": { regex: /&(reg|#174);/g, val: "\xAE" },
758
- "inr": { regex: /&(inr|#8377);/g, val: "\u20B9" },
759
- "num_dec": { regex: /&#([0-9]{1,7});/g, val: (_, str) => String.fromCodePoint(Number.parseInt(str, 10)) },
760
- "num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (_, str) => String.fromCodePoint(Number.parseInt(str, 16)) }
761
- };
762
- this.addExternalEntities = addExternalEntities;
763
- this.parseXml = parseXml;
764
- this.parseTextData = parseTextData;
765
- this.resolveNameSpace = resolveNameSpace;
766
- this.buildAttributesMap = buildAttributesMap;
767
- this.isItStopNode = isItStopNode;
768
- this.replaceEntitiesValue = replaceEntitiesValue;
769
- this.readStopNodeData = readStopNodeData;
770
- this.saveTextToParentTag = saveTextToParentTag;
771
- this.addChild = addChild;
772
- this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
773
- }
774
- };
775
- function addExternalEntities(externalEntities) {
776
- const entKeys = Object.keys(externalEntities);
777
- for (let i = 0; i < entKeys.length; i++) {
778
- const ent = entKeys[i];
779
- this.lastEntities[ent] = {
780
- regex: new RegExp("&" + ent + ";", "g"),
781
- val: externalEntities[ent]
782
- };
783
- }
784
- }
785
- function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
786
- if (val !== void 0) {
787
- if (this.options.trimValues && !dontTrim) {
788
- val = val.trim();
789
- }
790
- if (val.length > 0) {
791
- if (!escapeEntities) val = this.replaceEntitiesValue(val);
792
- const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
793
- if (newval === null || newval === void 0) {
794
- return val;
795
- } else if (typeof newval !== typeof val || newval !== val) {
796
- return newval;
797
- } else if (this.options.trimValues) {
798
- return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
799
- } else {
800
- const trimmedVal = val.trim();
801
- if (trimmedVal === val) {
802
- return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
803
- } else {
804
- return val;
805
- }
806
- }
807
- }
808
- }
809
- }
810
- function resolveNameSpace(tagname) {
811
- if (this.options.removeNSPrefix) {
812
- const tags = tagname.split(":");
813
- const prefix = tagname.charAt(0) === "/" ? "/" : "";
814
- if (tags[0] === "xmlns") {
815
- return "";
816
- }
817
- if (tags.length === 2) {
818
- tagname = prefix + tags[1];
819
- }
820
- }
821
- return tagname;
822
- }
823
- var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
824
- function buildAttributesMap(attrStr, jPath, tagName) {
825
- if (this.options.ignoreAttributes !== true && typeof attrStr === "string") {
826
- const matches = getAllMatches(attrStr, attrsRegx);
827
- const len = matches.length;
828
- const attrs = {};
829
- for (let i = 0; i < len; i++) {
830
- const attrName = this.resolveNameSpace(matches[i][1]);
831
- if (this.ignoreAttributesFn(attrName, jPath)) {
832
- continue;
833
- }
834
- let oldVal = matches[i][4];
835
- let aName = this.options.attributeNamePrefix + attrName;
836
- if (attrName.length) {
837
- if (this.options.transformAttributeName) {
838
- aName = this.options.transformAttributeName(aName);
839
- }
840
- if (aName === "__proto__") aName = "#__proto__";
841
- if (oldVal !== void 0) {
842
- if (this.options.trimValues) {
843
- oldVal = oldVal.trim();
844
- }
845
- oldVal = this.replaceEntitiesValue(oldVal);
846
- const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
847
- if (newVal === null || newVal === void 0) {
848
- attrs[aName] = oldVal;
849
- } else if (typeof newVal !== typeof oldVal || newVal !== oldVal) {
850
- attrs[aName] = newVal;
851
- } else {
852
- attrs[aName] = parseValue(
853
- oldVal,
854
- this.options.parseAttributeValue,
855
- this.options.numberParseOptions
856
- );
857
- }
858
- } else if (this.options.allowBooleanAttributes) {
859
- attrs[aName] = true;
860
- }
861
- }
862
- }
863
- if (!Object.keys(attrs).length) {
864
- return;
865
- }
866
- if (this.options.attributesGroupName) {
867
- const attrCollection = {};
868
- attrCollection[this.options.attributesGroupName] = attrs;
869
- return attrCollection;
870
- }
871
- return attrs;
872
- }
873
- }
874
- var parseXml = function(xmlData) {
875
- xmlData = xmlData.replace(/\r\n?/g, "\n");
876
- const xmlObj = new XmlNode("!xml");
877
- let currentNode = xmlObj;
878
- let textData = "";
879
- let jPath = "";
880
- for (let i = 0; i < xmlData.length; i++) {
881
- const ch = xmlData[i];
882
- if (ch === "<") {
883
- if (xmlData[i + 1] === "/") {
884
- const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.");
885
- let tagName = xmlData.substring(i + 2, closeIndex).trim();
886
- if (this.options.removeNSPrefix) {
887
- const colonIndex = tagName.indexOf(":");
888
- if (colonIndex !== -1) {
889
- tagName = tagName.substr(colonIndex + 1);
890
- }
891
- }
892
- if (this.options.transformTagName) {
893
- tagName = this.options.transformTagName(tagName);
894
- }
895
- if (currentNode) {
896
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
897
- }
898
- const lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1);
899
- if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) {
900
- throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
901
- }
902
- let propIndex = 0;
903
- if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) {
904
- propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1);
905
- this.tagsNodeStack.pop();
906
- } else {
907
- propIndex = jPath.lastIndexOf(".");
908
- }
909
- jPath = jPath.substring(0, propIndex);
910
- currentNode = this.tagsNodeStack.pop();
911
- textData = "";
912
- i = closeIndex;
913
- } else if (xmlData[i + 1] === "?") {
914
- let tagData = readTagExp(xmlData, i, false, "?>");
915
- if (!tagData) throw new Error("Pi Tag is not closed.");
916
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
917
- if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) {
918
- } else {
919
- const childNode = new XmlNode(tagData.tagName);
920
- childNode.add(this.options.textNodeName, "");
921
- if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
922
- childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
923
- }
924
- this.addChild(currentNode, childNode, jPath, i);
925
- }
926
- i = tagData.closeIndex + 1;
927
- } else if (xmlData.substr(i + 1, 3) === "!--") {
928
- const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed.");
929
- if (this.options.commentPropName) {
930
- const comment = xmlData.substring(i + 4, endIndex - 2);
931
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
932
- currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]);
933
- }
934
- i = endIndex;
935
- } else if (xmlData.substr(i + 1, 2) === "!D") {
936
- const result = readDocType(xmlData, i);
937
- this.docTypeEntities = result.entities;
938
- i = result.i;
939
- } else if (xmlData.substr(i + 1, 2) === "![") {
940
- const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
941
- const tagExp = xmlData.substring(i + 9, closeIndex);
942
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
943
- let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
944
- if (val == void 0) val = "";
945
- if (this.options.cdataPropName) {
946
- currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
947
- } else {
948
- currentNode.add(this.options.textNodeName, val);
949
- }
950
- i = closeIndex + 2;
951
- } else {
952
- let result = readTagExp(xmlData, i, this.options.removeNSPrefix);
953
- let tagName = result.tagName;
954
- const rawTagName = result.rawTagName;
955
- let tagExp = result.tagExp;
956
- let attrExpPresent = result.attrExpPresent;
957
- let closeIndex = result.closeIndex;
958
- if (this.options.transformTagName) {
959
- tagName = this.options.transformTagName(tagName);
960
- }
961
- if (currentNode && textData) {
962
- if (currentNode.tagname !== "!xml") {
963
- textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
964
- }
965
- }
966
- const lastTag = currentNode;
967
- if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) {
968
- currentNode = this.tagsNodeStack.pop();
969
- jPath = jPath.substring(0, jPath.lastIndexOf("."));
970
- }
971
- if (tagName !== xmlObj.tagname) {
972
- jPath += jPath ? "." + tagName : tagName;
973
- }
974
- const startIndex = i;
975
- if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
976
- let tagContent = "";
977
- if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
978
- if (tagName[tagName.length - 1] === "/") {
979
- tagName = tagName.substr(0, tagName.length - 1);
980
- jPath = jPath.substr(0, jPath.length - 1);
981
- tagExp = tagName;
982
- } else {
983
- tagExp = tagExp.substr(0, tagExp.length - 1);
984
- }
985
- i = result.closeIndex;
986
- } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
987
- i = result.closeIndex;
988
- } else {
989
- const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
990
- if (!result2) throw new Error(`Unexpected end of ${rawTagName}`);
991
- i = result2.i;
992
- tagContent = result2.tagContent;
993
- }
994
- const childNode = new XmlNode(tagName);
995
- if (tagName !== tagExp && attrExpPresent) {
996
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
997
- }
998
- if (tagContent) {
999
- tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
1000
- }
1001
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
1002
- childNode.add(this.options.textNodeName, tagContent);
1003
- this.addChild(currentNode, childNode, jPath, startIndex);
1004
- } else {
1005
- if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
1006
- if (tagName[tagName.length - 1] === "/") {
1007
- tagName = tagName.substr(0, tagName.length - 1);
1008
- jPath = jPath.substr(0, jPath.length - 1);
1009
- tagExp = tagName;
1010
- } else {
1011
- tagExp = tagExp.substr(0, tagExp.length - 1);
1012
- }
1013
- if (this.options.transformTagName) {
1014
- tagName = this.options.transformTagName(tagName);
1015
- }
1016
- const childNode = new XmlNode(tagName);
1017
- if (tagName !== tagExp && attrExpPresent) {
1018
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
1019
- }
1020
- this.addChild(currentNode, childNode, jPath, startIndex);
1021
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
1022
- } else {
1023
- const childNode = new XmlNode(tagName);
1024
- this.tagsNodeStack.push(currentNode);
1025
- if (tagName !== tagExp && attrExpPresent) {
1026
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
1027
- }
1028
- this.addChild(currentNode, childNode, jPath, startIndex);
1029
- currentNode = childNode;
1030
- }
1031
- textData = "";
1032
- i = closeIndex;
1033
- }
1034
- }
1035
- } else {
1036
- textData += xmlData[i];
1037
- }
1038
- }
1039
- return xmlObj.child;
1040
- };
1041
- function addChild(currentNode, childNode, jPath, startIndex) {
1042
- if (!this.options.captureMetaData) startIndex = void 0;
1043
- const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
1044
- if (result === false) {
1045
- } else if (typeof result === "string") {
1046
- childNode.tagname = result;
1047
- currentNode.addChild(childNode, startIndex);
1048
- } else {
1049
- currentNode.addChild(childNode, startIndex);
1050
- }
1051
- }
1052
- var replaceEntitiesValue = function(val) {
1053
- if (this.options.processEntities) {
1054
- for (let entityName in this.docTypeEntities) {
1055
- const entity = this.docTypeEntities[entityName];
1056
- val = val.replace(entity.regx, entity.val);
1057
- }
1058
- for (let entityName in this.lastEntities) {
1059
- const entity = this.lastEntities[entityName];
1060
- val = val.replace(entity.regex, entity.val);
1061
- }
1062
- if (this.options.htmlEntities) {
1063
- for (let entityName in this.htmlEntities) {
1064
- const entity = this.htmlEntities[entityName];
1065
- val = val.replace(entity.regex, entity.val);
1066
- }
1067
- }
1068
- val = val.replace(this.ampEntity.regex, this.ampEntity.val);
1069
- }
1070
- return val;
1071
- };
1072
- function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
1073
- if (textData) {
1074
- if (isLeafNode === void 0) isLeafNode = currentNode.child.length === 0;
1075
- textData = this.parseTextData(
1076
- textData,
1077
- currentNode.tagname,
1078
- jPath,
1079
- false,
1080
- currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false,
1081
- isLeafNode
1082
- );
1083
- if (textData !== void 0 && textData !== "")
1084
- currentNode.add(this.options.textNodeName, textData);
1085
- textData = "";
1086
- }
1087
- return textData;
1088
- }
1089
- function isItStopNode(stopNodes, jPath, currentTagName) {
1090
- const allNodesExp = "*." + currentTagName;
1091
- for (const stopNodePath in stopNodes) {
1092
- const stopNodeExp = stopNodes[stopNodePath];
1093
- if (allNodesExp === stopNodeExp || jPath === stopNodeExp) return true;
1094
- }
1095
- return false;
1096
- }
1097
- function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
1098
- let attrBoundary;
1099
- let tagExp = "";
1100
- for (let index = i; index < xmlData.length; index++) {
1101
- let ch = xmlData[index];
1102
- if (attrBoundary) {
1103
- if (ch === attrBoundary) attrBoundary = "";
1104
- } else if (ch === '"' || ch === "'") {
1105
- attrBoundary = ch;
1106
- } else if (ch === closingChar[0]) {
1107
- if (closingChar[1]) {
1108
- if (xmlData[index + 1] === closingChar[1]) {
1109
- return {
1110
- data: tagExp,
1111
- index
1112
- };
1113
- }
1114
- } else {
1115
- return {
1116
- data: tagExp,
1117
- index
1118
- };
1119
- }
1120
- } else if (ch === " ") {
1121
- ch = " ";
1122
- }
1123
- tagExp += ch;
1124
- }
1125
- }
1126
- function findClosingIndex(xmlData, str, i, errMsg) {
1127
- const closingIndex = xmlData.indexOf(str, i);
1128
- if (closingIndex === -1) {
1129
- throw new Error(errMsg);
1130
- } else {
1131
- return closingIndex + str.length - 1;
1132
- }
1133
- }
1134
- function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
1135
- const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
1136
- if (!result) return;
1137
- let tagExp = result.data;
1138
- const closeIndex = result.index;
1139
- const separatorIndex = tagExp.search(/\s/);
1140
- let tagName = tagExp;
1141
- let attrExpPresent = true;
1142
- if (separatorIndex !== -1) {
1143
- tagName = tagExp.substring(0, separatorIndex);
1144
- tagExp = tagExp.substring(separatorIndex + 1).trimStart();
1145
- }
1146
- const rawTagName = tagName;
1147
- if (removeNSPrefix) {
1148
- const colonIndex = tagName.indexOf(":");
1149
- if (colonIndex !== -1) {
1150
- tagName = tagName.substr(colonIndex + 1);
1151
- attrExpPresent = tagName !== result.data.substr(colonIndex + 1);
1152
- }
1153
- }
1154
- return {
1155
- tagName,
1156
- tagExp,
1157
- closeIndex,
1158
- attrExpPresent,
1159
- rawTagName
1160
- };
1161
- }
1162
- function readStopNodeData(xmlData, tagName, i) {
1163
- const startIndex = i;
1164
- let openTagCount = 1;
1165
- for (; i < xmlData.length; i++) {
1166
- if (xmlData[i] === "<") {
1167
- if (xmlData[i + 1] === "/") {
1168
- const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`);
1169
- let closeTagName = xmlData.substring(i + 2, closeIndex).trim();
1170
- if (closeTagName === tagName) {
1171
- openTagCount--;
1172
- if (openTagCount === 0) {
1173
- return {
1174
- tagContent: xmlData.substring(startIndex, i),
1175
- i: closeIndex
1176
- };
1177
- }
1178
- }
1179
- i = closeIndex;
1180
- } else if (xmlData[i + 1] === "?") {
1181
- const closeIndex = findClosingIndex(xmlData, "?>", i + 1, "StopNode is not closed.");
1182
- i = closeIndex;
1183
- } else if (xmlData.substr(i + 1, 3) === "!--") {
1184
- const closeIndex = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed.");
1185
- i = closeIndex;
1186
- } else if (xmlData.substr(i + 1, 2) === "![") {
1187
- const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
1188
- i = closeIndex;
1189
- } else {
1190
- const tagData = readTagExp(xmlData, i, ">");
1191
- if (tagData) {
1192
- const openTagName = tagData && tagData.tagName;
1193
- if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") {
1194
- openTagCount++;
1195
- }
1196
- i = tagData.closeIndex;
1197
- }
1198
- }
1199
- }
1200
- }
1201
- }
1202
- function parseValue(val, shouldParse, options) {
1203
- if (shouldParse && typeof val === "string") {
1204
- const newval = val.trim();
1205
- if (newval === "true") return true;
1206
- else if (newval === "false") return false;
1207
- else return toNumber(val, options);
1208
- } else {
1209
- if (isExist(val)) {
1210
- return val;
1211
- } else {
1212
- return "";
1213
- }
1214
- }
1215
- }
1216
-
1217
- // node_modules/fast-xml-parser/src/xmlparser/node2json.js
1218
- var METADATA_SYMBOL2 = XmlNode.getMetaDataSymbol();
1219
- function prettify(node, options) {
1220
- return compress(node, options);
1221
- }
1222
- function compress(arr, options, jPath) {
1223
- let text;
1224
- const compressedObj = {};
1225
- for (let i = 0; i < arr.length; i++) {
1226
- const tagObj = arr[i];
1227
- const property = propName(tagObj);
1228
- let newJpath = "";
1229
- if (jPath === void 0) newJpath = property;
1230
- else newJpath = jPath + "." + property;
1231
- if (property === options.textNodeName) {
1232
- if (text === void 0) text = tagObj[property];
1233
- else text += "" + tagObj[property];
1234
- } else if (property === void 0) {
1235
- continue;
1236
- } else if (tagObj[property]) {
1237
- let val = compress(tagObj[property], options, newJpath);
1238
- const isLeaf = isLeafTag(val, options);
1239
- if (tagObj[METADATA_SYMBOL2] !== void 0) {
1240
- val[METADATA_SYMBOL2] = tagObj[METADATA_SYMBOL2];
1241
- }
1242
- if (tagObj[":@"]) {
1243
- assignAttributes(val, tagObj[":@"], newJpath, options);
1244
- } else if (Object.keys(val).length === 1 && val[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
1245
- val = val[options.textNodeName];
1246
- } else if (Object.keys(val).length === 0) {
1247
- if (options.alwaysCreateTextNode) val[options.textNodeName] = "";
1248
- else val = "";
1249
- }
1250
- if (compressedObj[property] !== void 0 && compressedObj.hasOwnProperty(property)) {
1251
- if (!Array.isArray(compressedObj[property])) {
1252
- compressedObj[property] = [compressedObj[property]];
1253
- }
1254
- compressedObj[property].push(val);
1255
- } else {
1256
- if (options.isArray(property, newJpath, isLeaf)) {
1257
- compressedObj[property] = [val];
1258
- } else {
1259
- compressedObj[property] = val;
1260
- }
1261
- }
1262
- }
1263
- }
1264
- if (typeof text === "string") {
1265
- if (text.length > 0) compressedObj[options.textNodeName] = text;
1266
- } else if (text !== void 0) compressedObj[options.textNodeName] = text;
1267
- return compressedObj;
1268
- }
1269
- function propName(obj) {
1270
- const keys = Object.keys(obj);
1271
- for (let i = 0; i < keys.length; i++) {
1272
- const key = keys[i];
1273
- if (key !== ":@") return key;
1274
- }
1275
- }
1276
- function assignAttributes(obj, attrMap, jpath, options) {
1277
- if (attrMap) {
1278
- const keys = Object.keys(attrMap);
1279
- const len = keys.length;
1280
- for (let i = 0; i < len; i++) {
1281
- const atrrName = keys[i];
1282
- if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
1283
- obj[atrrName] = [attrMap[atrrName]];
1284
- } else {
1285
- obj[atrrName] = attrMap[atrrName];
1286
- }
1287
- }
1288
- }
1289
- }
1290
- function isLeafTag(obj, options) {
1291
- const { textNodeName } = options;
1292
- const propCount = Object.keys(obj).length;
1293
- if (propCount === 0) {
1294
- return true;
1295
- }
1296
- if (propCount === 1 && (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)) {
1297
- return true;
1298
- }
1299
- return false;
1300
- }
1301
-
1302
- // node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
1303
- var XMLParser = class {
1304
- constructor(options) {
1305
- this.externalEntities = {};
1306
- this.options = buildOptions(options);
1307
- }
1308
- /**
1309
- * Parse XML dats to JS object
1310
- * @param {string|Buffer} xmlData
1311
- * @param {boolean|Object} validationOption
1312
- */
1313
- parse(xmlData, validationOption) {
1314
- if (typeof xmlData === "string") {
1315
- } else if (xmlData.toString) {
1316
- xmlData = xmlData.toString();
1317
- } else {
1318
- throw new Error("XML data is accepted in String or Bytes[] form.");
1319
- }
1320
- if (validationOption) {
1321
- if (validationOption === true) validationOption = {};
1322
- const result = validate(xmlData, validationOption);
1323
- if (result !== true) {
1324
- throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`);
1325
- }
1326
- }
1327
- const orderedObjParser = new OrderedObjParser(this.options);
1328
- orderedObjParser.addExternalEntities(this.externalEntities);
1329
- const orderedResult = orderedObjParser.parseXml(xmlData);
1330
- if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
1331
- else return prettify(orderedResult, this.options);
1332
- }
1333
- /**
1334
- * Add Entity which is not by default supported by this library
1335
- * @param {string} key
1336
- * @param {string} value
1337
- */
1338
- addEntity(key, value) {
1339
- if (value.indexOf("&") !== -1) {
1340
- throw new Error("Entity value can't have '&'");
1341
- } else if (key.indexOf("&") !== -1 || key.indexOf(";") !== -1) {
1342
- throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
1343
- } else if (value === "&") {
1344
- throw new Error("An entity with value '&' is not permitted");
1345
- } else {
1346
- this.externalEntities[key] = value;
1347
- }
1348
- }
1349
- /**
1350
- * Returns a Symbol that can be used to access the metadata
1351
- * property on a node.
1352
- *
1353
- * If Symbol is not available in the environment, an ordinary property is used
1354
- * and the name of the property is here returned.
1355
- *
1356
- * The XMLMetaData property is only present when `captureMetaData`
1357
- * is true in the options.
1358
- */
1359
- static getMetaDataSymbol() {
1360
- return XmlNode.getMetaDataSymbol();
1361
- }
1362
- };
1363
-
1364
- // node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/parseXmlBody.js
1365
- var parseXmlBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1366
- if (encoded.length) {
1367
- const parser = new XMLParser({
1368
- attributeNamePrefix: "",
1369
- htmlEntities: true,
1370
- ignoreAttributes: false,
1371
- ignoreDeclaration: true,
1372
- parseTagValue: false,
1373
- trimValues: false,
1374
- tagValueProcessor: (_, val) => val.trim() === "" && val.includes("\n") ? "" : void 0
1375
- });
1376
- parser.addEntity("#xD", "\r");
1377
- parser.addEntity("#10", "\n");
1378
- let parsedObj;
1379
- try {
1380
- parsedObj = parser.parse(encoded, true);
1381
- } catch (e) {
1382
- if (e && typeof e === "object") {
1383
- Object.defineProperty(e, "$responseBodyText", {
1384
- value: encoded
1385
- });
1386
- }
1387
- throw e;
1388
- }
1389
- const textNodeName = "#text";
1390
- const key = Object.keys(parsedObj)[0];
1391
- const parsedObjToReturn = parsedObj[key];
1392
- if (parsedObjToReturn[textNodeName]) {
1393
- parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
1394
- delete parsedObjToReturn[textNodeName];
1395
- }
1396
- return getValueFromTextNode(parsedObjToReturn);
1397
- }
1398
- return {};
1399
- });
1400
- var parseXmlErrorBody = async (errorBody, context) => {
1401
- const value = await parseXmlBody(errorBody, context);
1402
- if (value.Error) {
1403
- value.Error.message = value.Error.message ?? value.Error.Message;
1404
- }
1405
- return value;
1406
- };
1407
- var loadRestXmlErrorCode = (output, data) => {
1408
- if (data?.Error?.Code !== void 0) {
1409
- return data.Error.Code;
1410
- }
1411
- if (data?.Code !== void 0) {
1412
- return data.Code;
1413
- }
1414
- if (output.statusCode == 404) {
1415
- return "NotFound";
1416
- }
1417
- };
1418
-
1419
- export {
1420
- parseXmlBody,
1421
- parseXmlErrorBody,
1422
- loadRestXmlErrorCode
1423
- };
1424
- //# sourceMappingURL=chunk-MCSCBMNG.js.map