@wavemaker/angular-codegen 12.0.0-next.140527 → 12.0.0-next.140530

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.
@@ -40017,6 +40017,773 @@ var FilterSubscriber = /*@__PURE__*/ (function (_super) {
40017
40017
  return FilterSubscriber;
40018
40018
  }(Subscriber));
40019
40019
 
40020
+ /*
40021
+ Copyright 2015 Axinom
40022
+ Copyright 2011-2013 Abdulla Abdurakhmanov
40023
+ Original sources are available at https://code.google.com/p/x2js/
40024
+
40025
+ Licensed under the Apache License, Version 2.0 (the "License");
40026
+ you may not use this file except in compliance with the License.
40027
+ You may obtain a copy of the License at
40028
+
40029
+ http://www.apache.org/licenses/LICENSE-2.0
40030
+
40031
+ Unless required by applicable law or agreed to in writing, software
40032
+ distributed under the License is distributed on an "AS IS" BASIS,
40033
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40034
+ See the License for the specific language governing permissions and
40035
+ limitations under the License.
40036
+ */
40037
+
40038
+ /*
40039
+ Supported export methods:
40040
+ * AMD
40041
+ * <script> (window.X2JS)
40042
+ * Node.js
40043
+
40044
+ Limitations:
40045
+ * Attribute namespace prefixes are not parsed as such.
40046
+ * Overall the serialization/deserializaton code is "best effort" and not foolproof.
40047
+ */
40048
+
40049
+ // Module definition pattern used is returnExports from https://github.com/umdjs/umd
40050
+ (function (root, factory) {
40051
+
40052
+ /* global define */
40053
+ if (typeof define === 'function' && define.amd) {
40054
+ // AMD. Register as an anonymous module.
40055
+ define([], factory);
40056
+ } else if (typeof module === 'object' && module.exports) {
40057
+ // Node. Does not work with strict CommonJS, but only CommonJS-like
40058
+ // environments that support module.exports, like Node.
40059
+ module.exports = factory(require("@xmldom/xmldom").DOMParser);
40060
+ } else {
40061
+ // Browser globals (root is window)
40062
+ root.X2JS = factory();
40063
+ }
40064
+ })(undefined, function (CustomDOMParser) {
40065
+
40066
+ // We return a constructor that can be used to make X2JS instances.
40067
+ return function X2JS(config) {
40068
+ var VERSION = "3.4.4";
40069
+
40070
+ config = config || {};
40071
+
40072
+ function initConfigDefaults() {
40073
+ // If set to "property" then <element>_asArray will be created
40074
+ // to allow you to access any element as an array (even if there is only one of it).
40075
+ config.arrayAccessForm = config.arrayAccessForm || "none";
40076
+
40077
+ // If "text" then <empty></empty> will be transformed to "".
40078
+ // If "object" then <empty></empty> will be transformed to {}.
40079
+ config.emptyNodeForm = config.emptyNodeForm || "text";
40080
+
40081
+ // Function that will be called for each elements, if the function returns true, the element will be skipped
40082
+ // function(name, value) { return true; };
40083
+ config.jsAttributeFilter = config.jsAttributeFilter;
40084
+
40085
+ // Function that will be called for each elements, the element value will be replaced by the returned value
40086
+ // function(name, value) { return parseFloat(value); };
40087
+ config.jsAttributeConverter = config.jsAttributeConverter;
40088
+
40089
+ // Allows attribute values to be converted on the fly during parsing to objects.
40090
+ // "test": function(name, value) { return true; }
40091
+ // "convert": function(name, value) { return parseFloat(value); };
40092
+ // convert() will be called for every attribute where test() returns true
40093
+ // and the return value from convert() will replace the original value of the attribute.
40094
+ config.attributeConverters = config.attributeConverters || [];
40095
+
40096
+ // Any elements that match the paths here will have their text parsed
40097
+ // as an XML datetime value (2011-11-12T13:00:00-07:00 style).
40098
+ // The path can be a plain string (parent.child1.child2),
40099
+ // a regex (/.*\.child2/) or function(elementPath).
40100
+ config.datetimeAccessFormPaths = config.datetimeAccessFormPaths || [];
40101
+
40102
+ // Any elements that match the paths listed here will be stored in JavaScript objects
40103
+ // as arrays even if there is only one of them. The path can be a plain string
40104
+ // (parent.child1.child2), a regex (/.*\.child2/) or function(elementName, elementPath).
40105
+ config.arrayAccessFormPaths = config.arrayAccessFormPaths || [];
40106
+
40107
+ // xmldom constructor arguments
40108
+ // @see https://github.com/jindw/xmldom#api-reference
40109
+ config.xmldomOptions = config.xmldomOptions || {};
40110
+
40111
+ // If true, a toString function is generated to print nodes containing text or cdata.
40112
+ // Useful if you want to accept both plain text and CData as equivalent inputs.
40113
+ if (config.enableToStringFunc === undefined) {
40114
+ config.enableToStringFunc = true;
40115
+ }
40116
+
40117
+ // If true, empty text tags are ignored for elements with child nodes.
40118
+ if (config.skipEmptyTextNodesForObj === undefined) {
40119
+ config.skipEmptyTextNodesForObj = true;
40120
+ }
40121
+
40122
+ // If true, whitespace is trimmed from text nodes.
40123
+ if (config.stripWhitespaces === undefined) {
40124
+ config.stripWhitespaces = true;
40125
+ }
40126
+
40127
+ // If true, double quotes are used in generated XML.
40128
+ if (config.useDoubleQuotes === undefined) {
40129
+ config.useDoubleQuotes = true;
40130
+ }
40131
+
40132
+ // If true, the root element of the XML document is ignored when converting to objects.
40133
+ // The result will directly have the root element's children as its own properties.
40134
+ if (config.ignoreRoot === undefined) {
40135
+ config.ignoreRoot = false;
40136
+ }
40137
+
40138
+ // Whether XML characters in text are escaped when reading/writing XML.
40139
+ if (config.escapeMode === undefined) {
40140
+ config.escapeMode = true;
40141
+ }
40142
+
40143
+ // Prefix to use for properties that are created to represent XML attributes.
40144
+ if (config.attributePrefix === undefined) {
40145
+ config.attributePrefix = "_";
40146
+ }
40147
+
40148
+ // If true, empty elements will created as self closing elements (<element />)
40149
+ // If false, empty elements will be created with start and end tags (<element></element>)
40150
+ if (config.selfClosingElements === undefined) {
40151
+ config.selfClosingElements = true;
40152
+ }
40153
+
40154
+ // If this property defined as false and an XML element has CData node ONLY, it will be converted to text without additional property "__cdata"
40155
+ if (config.keepCData === undefined) {
40156
+ config.keepCData = false;
40157
+ }
40158
+
40159
+ // If this property defined as true, use { __text: 'abc' } over 'abc'
40160
+ if (config.keepText === undefined) {
40161
+ config.keepText = false;
40162
+ }
40163
+
40164
+ // If true, will output dates in UTC
40165
+ if (config.jsDateUTC === undefined) {
40166
+ config.jsDateUTC = false;
40167
+ }
40168
+ }
40169
+
40170
+ function initRequiredPolyfills() {
40171
+ function pad(number) {
40172
+ var r = String(number);
40173
+ if (r.length === 1) {
40174
+ r = '0' + r;
40175
+ }
40176
+ return r;
40177
+ }
40178
+ // Hello IE8-
40179
+ if (typeof String.prototype.trim !== 'function') {
40180
+ String.prototype.trim = function trim() {
40181
+ return this.replace(/^\s+|^\n+|(\s|\n)+$/g, '');
40182
+ };
40183
+ }
40184
+ if (typeof Date.prototype.toISOString !== 'function') {
40185
+ // Implementation from http://stackoverflow.com/questions/2573521/how-do-i-output-an-iso-8601-formatted-string-in-javascript
40186
+ Date.prototype.toISOString = function toISOString() {
40187
+ var MS_IN_S = 1000;
40188
+
40189
+ return this.getUTCFullYear()
40190
+ + '-' + pad(this.getUTCMonth() + 1)
40191
+ + '-' + pad(this.getUTCDate())
40192
+ + 'T' + pad(this.getUTCHours())
40193
+ + ':' + pad(this.getUTCMinutes())
40194
+ + ':' + pad(this.getUTCSeconds())
40195
+ + '.' + String((this.getUTCMilliseconds() / MS_IN_S).toFixed(3)).slice(2, 5)
40196
+ + 'Z';
40197
+ };
40198
+ }
40199
+ }
40200
+
40201
+ initConfigDefaults();
40202
+ initRequiredPolyfills();
40203
+
40204
+ var DOMNodeTypes = {
40205
+ "ELEMENT_NODE": 1,
40206
+ "TEXT_NODE": 3,
40207
+ "CDATA_SECTION_NODE": 4,
40208
+ "COMMENT_NODE": 8,
40209
+ "DOCUMENT_NODE": 9
40210
+ };
40211
+
40212
+ function getDomNodeLocalName(domNode) {
40213
+ var localName = domNode.localName;
40214
+ if (localName == null) {
40215
+ // Yeah, this is IE!!
40216
+ localName = domNode.baseName;
40217
+ }
40218
+ if (localName == null || localName === "") {
40219
+ // ==="" is IE too
40220
+ localName = domNode.nodeName;
40221
+ }
40222
+ return localName;
40223
+ }
40224
+
40225
+ function getDomNodeNamespacePrefix(node) {
40226
+ return node.prefix;
40227
+ }
40228
+
40229
+ function escapeXmlChars(str) {
40230
+ if (typeof str === "string")
40231
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;');
40232
+ else
40233
+ return str;
40234
+ }
40235
+
40236
+ function unescapeXmlChars(str) {
40237
+ return str.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#x27;/g, "'").replace(/&amp;/g, '&');
40238
+ }
40239
+
40240
+ function ensureProperArrayAccessForm(element, childName, elementPath) {
40241
+ switch (config.arrayAccessForm) {
40242
+ case "property":
40243
+ if (!(element[childName] instanceof Array))
40244
+ element[childName + "_asArray"] = [element[childName]];
40245
+ else
40246
+ element[childName + "_asArray"] = element[childName];
40247
+ break;
40248
+ }
40249
+
40250
+ if (!(element[childName] instanceof Array) && config.arrayAccessFormPaths.length > 0) {
40251
+ var match = false;
40252
+
40253
+ for (var i = 0; i < config.arrayAccessFormPaths.length; i++) {
40254
+ var arrayPath = config.arrayAccessFormPaths[i];
40255
+ if (typeof arrayPath === "string") {
40256
+ if (arrayPath === elementPath) {
40257
+ match = true;
40258
+ break;
40259
+ }
40260
+ } else if (arrayPath instanceof RegExp) {
40261
+ if (arrayPath.test(elementPath)) {
40262
+ match = true;
40263
+ break;
40264
+ }
40265
+ } else if (typeof arrayPath === "function") {
40266
+ if (arrayPath(childName, elementPath)) {
40267
+ match = true;
40268
+ break;
40269
+ }
40270
+ }
40271
+ }
40272
+
40273
+ if (match)
40274
+ element[childName] = [element[childName]];
40275
+ }
40276
+ }
40277
+
40278
+ function xmlDateTimeToDate(prop) {
40279
+ // Implementation based up on http://stackoverflow.com/questions/8178598/xml-datetime-to-javascript-date-object
40280
+ // Improved to support full spec and optional parts
40281
+ var MINUTES_PER_HOUR = 60;
40282
+
40283
+ var bits = prop.split(/[-T:+Z]/g);
40284
+
40285
+ var d = new Date(bits[0], bits[1] - 1, bits[2]);
40286
+ var secondBits = bits[5].split("\.");
40287
+ d.setHours(bits[3], bits[4], secondBits[0]);
40288
+ if (secondBits.length > 1)
40289
+ d.setMilliseconds(secondBits[1]);
40290
+
40291
+ // Get supplied time zone offset in minutes
40292
+ if (bits[6] && bits[7]) {
40293
+ var offsetMinutes = bits[6] * MINUTES_PER_HOUR + Number(bits[7]);
40294
+ var sign = /\d\d-\d\d:\d\d$/.test(prop) ? '-' : '+';
40295
+
40296
+ // Apply the sign
40297
+ offsetMinutes = 0 + (sign === '-' ? -1 * offsetMinutes : offsetMinutes);
40298
+
40299
+ // Apply offset and local timezone
40300
+ d.setMinutes(d.getMinutes() - offsetMinutes - d.getTimezoneOffset());
40301
+ } else if (prop.indexOf("Z", prop.length - 1) !== -1) {
40302
+ d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds()));
40303
+ }
40304
+
40305
+ // d is now a local time equivalent to the supplied time
40306
+ return d;
40307
+ }
40308
+
40309
+ function convertToDateIfRequired(value, childName, fullPath) {
40310
+ if (config.datetimeAccessFormPaths.length > 0) {
40311
+ var pathWithoutTextNode = fullPath.split("\.#")[0];
40312
+
40313
+ for (var i = 0; i < config.datetimeAccessFormPaths.length; i++) {
40314
+ var candidatePath = config.datetimeAccessFormPaths[i];
40315
+ if (typeof candidatePath === "string") {
40316
+ if (candidatePath === pathWithoutTextNode)
40317
+ return xmlDateTimeToDate(value);
40318
+ } else if (candidatePath instanceof RegExp) {
40319
+ if (candidatePath.test(pathWithoutTextNode))
40320
+ return xmlDateTimeToDate(value);
40321
+ } else if (typeof candidatePath === "function") {
40322
+ if (candidatePath(pathWithoutTextNode))
40323
+ return xmlDateTimeToDate(value);
40324
+ }
40325
+ }
40326
+ }
40327
+
40328
+ return value;
40329
+ }
40330
+
40331
+ function deserializeRootElementChildren(rootElement) {
40332
+ var result = {};
40333
+ var children = rootElement.childNodes;
40334
+
40335
+ // Alternative for firstElementChild which is not supported in some environments
40336
+ for (var i = 0; i < children.length; i++) {
40337
+ var child = children.item(i);
40338
+ if (child.nodeType === DOMNodeTypes.ELEMENT_NODE) {
40339
+ var childName = getDomNodeLocalName(child);
40340
+
40341
+ if (config.ignoreRoot)
40342
+ result = deserializeDomChildren(child, childName);
40343
+ else
40344
+ result[childName] = deserializeDomChildren(child, childName);
40345
+ }
40346
+ }
40347
+
40348
+ return result;
40349
+ }
40350
+
40351
+ function deserializeElementChildren(element, elementPath) {
40352
+ var result = {};
40353
+ result.__cnt = 0;
40354
+
40355
+ var nodeChildren = element.childNodes;
40356
+
40357
+ // Child nodes.
40358
+ for (var iChild = 0; iChild < nodeChildren.length; iChild++) {
40359
+ var child = nodeChildren.item(iChild);
40360
+ var childName = getDomNodeLocalName(child);
40361
+
40362
+ if (child.nodeType === DOMNodeTypes.COMMENT_NODE)
40363
+ continue;
40364
+
40365
+ result.__cnt++;
40366
+
40367
+ // We deliberately do not accept everything falsey here because
40368
+ // elements that resolve to empty string should still be preserved.
40369
+ if (result[childName] == null) {
40370
+ result[childName] = deserializeDomChildren(child, elementPath + "." + childName);
40371
+ ensureProperArrayAccessForm(result, childName, elementPath + "." + childName);
40372
+ } else {
40373
+ if (!(result[childName] instanceof Array)) {
40374
+ result[childName] = [result[childName]];
40375
+ ensureProperArrayAccessForm(result, childName, elementPath + "." + childName);
40376
+ }
40377
+
40378
+ result[childName][result[childName].length] = deserializeDomChildren(child, elementPath + "." + childName);
40379
+ }
40380
+ }
40381
+
40382
+ // Attributes
40383
+ for (var iAttribute = 0; iAttribute < element.attributes.length; iAttribute++) {
40384
+ var attribute = element.attributes.item(iAttribute);
40385
+ result.__cnt++;
40386
+
40387
+ var adjustedValue = attribute.value;
40388
+ for (var iConverter = 0; iConverter < config.attributeConverters.length; iConverter++) {
40389
+ var converter = config.attributeConverters[iConverter];
40390
+ if (converter.test.call(null, attribute.name, attribute.value))
40391
+ adjustedValue = converter.convert.call(null, attribute.name, attribute.value);
40392
+ }
40393
+
40394
+ result[config.attributePrefix + attribute.name] = adjustedValue;
40395
+ }
40396
+
40397
+ // Node namespace prefix
40398
+ var namespacePrefix = getDomNodeNamespacePrefix(element);
40399
+ if (namespacePrefix) {
40400
+ result.__cnt++;
40401
+ result.__prefix = namespacePrefix;
40402
+ }
40403
+
40404
+ if (result["#text"]) {
40405
+ result.__text = result["#text"];
40406
+
40407
+ if (result.__text instanceof Array) {
40408
+ result.__text = result.__text.join("\n");
40409
+ }
40410
+
40411
+ if (config.escapeMode)
40412
+ result.__text = unescapeXmlChars(result.__text);
40413
+
40414
+ if (config.stripWhitespaces)
40415
+ result.__text = result.__text.trim();
40416
+
40417
+ delete result["#text"];
40418
+
40419
+ if (config.arrayAccessForm === "property")
40420
+ delete result["#text_asArray"];
40421
+
40422
+ result.__text = convertToDateIfRequired(result.__text, "#text", elementPath + ".#text");
40423
+ }
40424
+
40425
+ if (result.hasOwnProperty('#cdata-section')) {
40426
+ result.__cdata = result["#cdata-section"];
40427
+ delete result["#cdata-section"];
40428
+
40429
+ if (config.arrayAccessForm === "property")
40430
+ delete result["#cdata-section_asArray"];
40431
+ }
40432
+
40433
+ if (result.__cnt === 1 && result.__text && !config.keepText) {
40434
+ result = result.__text;
40435
+ } else if (result.__cnt === 0 && config.emptyNodeForm === "text") {
40436
+ result = '';
40437
+ } else if (result.__cnt > 1 && result.__text !== undefined && config.skipEmptyTextNodesForObj) {
40438
+ if (config.stripWhitespaces && result.__text === "" || result.__text.trim() === "") {
40439
+ delete result.__text;
40440
+ }
40441
+ }
40442
+ delete result.__cnt;
40443
+
40444
+ /**
40445
+ * We are checking if we are creating a __cdata property or if we just add the content of cdata inside result.
40446
+ * But, if we have a property inside xml tag (<tag PROPERTY="1"></tag>), and a cdata inside, we can't ignore it.
40447
+ * In this case we are keeping __cdata property.
40448
+ */
40449
+ if (!config.keepCData && (!result.hasOwnProperty('__text') && result.hasOwnProperty('__cdata') && Object.keys(result).length === 1)) {
40450
+ return (result.__cdata ? result.__cdata : '');
40451
+ }
40452
+
40453
+ if (config.enableToStringFunc && (result.__text || result.__cdata)) {
40454
+ result.toString = function toString() {
40455
+ return (this.__text ? this.__text : '') + (this.__cdata ? this.__cdata : '');
40456
+ };
40457
+ }
40458
+
40459
+ return result;
40460
+ }
40461
+
40462
+ function deserializeDomChildren(node, parentPath) {
40463
+ if (node.nodeType === DOMNodeTypes.DOCUMENT_NODE) {
40464
+ return deserializeRootElementChildren(node);
40465
+ } else if (node.nodeType === DOMNodeTypes.ELEMENT_NODE) {
40466
+ return deserializeElementChildren(node, parentPath);
40467
+ } else if (node.nodeType === DOMNodeTypes.TEXT_NODE || node.nodeType === DOMNodeTypes.CDATA_SECTION_NODE) {
40468
+ return node.nodeValue;
40469
+ } else {
40470
+ return null;
40471
+ }
40472
+ }
40473
+
40474
+ function serializeStartTag(jsObject, elementName, attributeNames, selfClosing) {
40475
+ var resultStr = "<" + ((jsObject && jsObject.__prefix) ? (jsObject.__prefix + ":") : "") + elementName;
40476
+
40477
+ if (attributeNames) {
40478
+ for (var i = 0; i < attributeNames.length; i++) {
40479
+ var attributeName = attributeNames[i];
40480
+ var attributeValue = jsObject[attributeName];
40481
+
40482
+ if (config.escapeMode)
40483
+ attributeValue = escapeXmlChars(attributeValue);
40484
+
40485
+ resultStr += " " + attributeName.substr(config.attributePrefix.length) + "=";
40486
+
40487
+ if (config.useDoubleQuotes)
40488
+ resultStr += '"' + attributeValue + '"';
40489
+ else
40490
+ resultStr += "'" + attributeValue + "'";
40491
+ }
40492
+ }
40493
+
40494
+ if (!selfClosing)
40495
+ resultStr += ">";
40496
+ else
40497
+ resultStr += " />";
40498
+
40499
+ return resultStr;
40500
+ }
40501
+
40502
+ function serializeEndTag(jsObject, elementName) {
40503
+ return "</" + ((jsObject && jsObject.__prefix) ? (jsObject.__prefix + ":") : "") + elementName + ">";
40504
+ }
40505
+
40506
+ function endsWith(str, suffix) {
40507
+ return str.indexOf(suffix, str.length - suffix.length) !== -1;
40508
+ }
40509
+
40510
+ function isSpecialProperty(jsonObj, propertyName) {
40511
+ if ((config.arrayAccessForm === "property" && endsWith(propertyName.toString(), ("_asArray")))
40512
+ || propertyName.toString().indexOf(config.attributePrefix) === 0
40513
+ || propertyName.toString().indexOf("__") === 0
40514
+ || (jsonObj[propertyName] instanceof Function))
40515
+ return true;
40516
+ else
40517
+ return false;
40518
+ }
40519
+
40520
+ function getDataElementCount(jsObject) {
40521
+ var count = 0;
40522
+
40523
+ if (jsObject instanceof Object) {
40524
+ for (var propertyName in jsObject) {
40525
+ if (isSpecialProperty(jsObject, propertyName))
40526
+ continue;
40527
+
40528
+ count++;
40529
+ }
40530
+ }
40531
+
40532
+ return count;
40533
+ }
40534
+
40535
+ function getDataAttributeNames(jsObject) {
40536
+ var names = [];
40537
+
40538
+ if (jsObject instanceof Object) {
40539
+ for (var attributeName in jsObject) {
40540
+ if (attributeName.toString().indexOf("__") === -1
40541
+ && attributeName.toString().indexOf(config.attributePrefix) === 0) {
40542
+ names.push(attributeName);
40543
+ }
40544
+ }
40545
+ }
40546
+
40547
+ return names;
40548
+ }
40549
+
40550
+ function serializeComplexTextNodeContents(textNode) {
40551
+ var result = "";
40552
+
40553
+ if (textNode.__cdata) {
40554
+ result += "<![CDATA[" + textNode.__cdata + "]]>";
40555
+ }
40556
+
40557
+ if (textNode.__text || typeof (textNode.__text) === 'number' || typeof (textNode.__text) === 'boolean') {
40558
+ if (config.escapeMode)
40559
+ result += escapeXmlChars(textNode.__text);
40560
+ else
40561
+ result += textNode.__text;
40562
+ }
40563
+
40564
+ return result;
40565
+ }
40566
+
40567
+ function serializeTextNodeContents(textNode) {
40568
+ var result = "";
40569
+
40570
+ if (textNode instanceof Object) {
40571
+ result += serializeComplexTextNodeContents(textNode);
40572
+ } else if (textNode !== null) {
40573
+ if (config.escapeMode)
40574
+ result += escapeXmlChars(textNode);
40575
+ else
40576
+ result += textNode;
40577
+ }
40578
+
40579
+ return result;
40580
+ }
40581
+
40582
+ function serializeArray(elementArray, elementName, attributes) {
40583
+ var result = "";
40584
+
40585
+ if (elementArray.length === 0) {
40586
+ result += serializeStartTag(elementArray, elementName, attributes, true);
40587
+ } else {
40588
+ for (var i = 0; i < elementArray.length; i++) {
40589
+ result += serializeJavaScriptObject(elementArray[i], elementName, getDataAttributeNames(elementArray[i]));
40590
+ }
40591
+ }
40592
+
40593
+ return result;
40594
+ }
40595
+
40596
+ function serializeJavaScriptObject(element, elementName, attributes) {
40597
+ var result = "";
40598
+
40599
+ // Filter out elements
40600
+ if (config.jsAttributeFilter && config.jsAttributeFilter.call(null, elementName, element)) {
40601
+ return result;
40602
+ }
40603
+ // Convert element
40604
+ if (config.jsAttributeConverter) {
40605
+ element = config.jsAttributeConverter.call(null, elementName, element);
40606
+ }
40607
+ if ((element === undefined || element === null || element === '') && config.selfClosingElements) {
40608
+ result += serializeStartTag(element, elementName, attributes, true);
40609
+ } else if (typeof element === 'object') {
40610
+ if (Object.prototype.toString.call(element) === '[object Array]') {
40611
+ result += serializeArray(element, elementName, attributes);
40612
+ } else if (element instanceof Date) {
40613
+ result += serializeStartTag(element, elementName, attributes, false);
40614
+ // Serialize date
40615
+ result += config.jsDateUTC ? element.toUTCString() : element.toISOString();
40616
+ result += serializeEndTag(element, elementName);
40617
+ } else {
40618
+ var childElementCount = getDataElementCount(element);
40619
+ if (childElementCount > 0 || typeof (element.__text) === 'number' || typeof (element.__text) === 'boolean' || element.__text || element.__cdata) {
40620
+ result += serializeStartTag(element, elementName, attributes, false);
40621
+ result += serializeJavaScriptObjectChildren(element);
40622
+ result += serializeEndTag(element, elementName);
40623
+ } else if (config.selfClosingElements) {
40624
+ result += serializeStartTag(element, elementName, attributes, true);
40625
+ } else {
40626
+ result += serializeStartTag(element, elementName, attributes, false);
40627
+ result += serializeEndTag(element, elementName);
40628
+ }
40629
+ }
40630
+ } else {
40631
+ result += serializeStartTag(element, elementName, attributes, false);
40632
+ result += serializeTextNodeContents(element);
40633
+ result += serializeEndTag(element, elementName);
40634
+ }
40635
+
40636
+ return result;
40637
+ }
40638
+
40639
+ function serializeJavaScriptObjectChildren(jsObject) {
40640
+ var result = "";
40641
+
40642
+ var elementCount = getDataElementCount(jsObject);
40643
+
40644
+ if (elementCount > 0) {
40645
+ for (var elementName in jsObject) {
40646
+ if (isSpecialProperty(jsObject, elementName))
40647
+ continue;
40648
+
40649
+ var element = jsObject[elementName];
40650
+ var attributes = getDataAttributeNames(element);
40651
+
40652
+ result += serializeJavaScriptObject(element, elementName, attributes);
40653
+ }
40654
+ }
40655
+
40656
+ result += serializeTextNodeContents(jsObject);
40657
+
40658
+ return result;
40659
+ }
40660
+
40661
+ function parseXml(xml) {
40662
+ if (xml === undefined) {
40663
+ return null;
40664
+ }
40665
+
40666
+ if (typeof xml !== "string") {
40667
+ return null;
40668
+ }
40669
+
40670
+ var parser = null;
40671
+ var domNode = null;
40672
+
40673
+ if (CustomDOMParser) {
40674
+ // This branch is used for node.js, with the xmldom parser.
40675
+ parser = new CustomDOMParser(config.xmldomOptions);
40676
+
40677
+ domNode = parser.parseFromString(xml, "text/xml");
40678
+ } else if (window && window.DOMParser) {
40679
+ parser = new window.DOMParser();
40680
+ var parsererrorNS = null;
40681
+
40682
+ var isIEParser = window.ActiveXObject || "ActiveXObject" in window;
40683
+
40684
+ // IE9+ now is here
40685
+ if (!isIEParser && document.all && !document.addEventListener) {
40686
+ try {
40687
+ parsererrorNS = parser.parseFromString("INVALID", "text/xml").childNodes[0].namespaceURI;
40688
+ } catch (err) {
40689
+ parsererrorNS = null;
40690
+ }
40691
+ }
40692
+
40693
+ try {
40694
+ domNode = parser.parseFromString(xml, "text/xml");
40695
+ if (parsererrorNS !== null && domNode.getElementsByTagNameNS(parsererrorNS, "parsererror").length > 0) {
40696
+ domNode = null;
40697
+ }
40698
+ } catch (err) {
40699
+ domNode = null;
40700
+ }
40701
+ } else {
40702
+ // IE :(
40703
+ if (xml.indexOf("<?") === 0) {
40704
+ xml = xml.substr(xml.indexOf("?>") + 2);
40705
+ }
40706
+
40707
+ /* global ActiveXObject */
40708
+ domNode = new ActiveXObject("Microsoft.XMLDOM");
40709
+ domNode.async = "false";
40710
+ domNode.loadXML(xml);
40711
+ }
40712
+
40713
+ return domNode;
40714
+ }
40715
+
40716
+ this.asArray = function asArray(prop) {
40717
+ if (prop === undefined || prop === null) {
40718
+ return [];
40719
+ } else if (prop instanceof Array) {
40720
+ return prop;
40721
+ } else {
40722
+ return [prop];
40723
+ }
40724
+ };
40725
+
40726
+ this.toXmlDateTime = function toXmlDateTime(dt) {
40727
+ if (dt instanceof Date) {
40728
+ return dt.toISOString();
40729
+ } else if (typeof (dt) === 'number') {
40730
+ return new Date(dt).toISOString();
40731
+ } else {
40732
+ return null;
40733
+ }
40734
+ };
40735
+
40736
+ this.asDateTime = function asDateTime(prop) {
40737
+ if (typeof (prop) === "string") {
40738
+ return xmlDateTimeToDate(prop);
40739
+ } else {
40740
+ return prop;
40741
+ }
40742
+ };
40743
+
40744
+ /*
40745
+ Internally the logic works in a cycle:
40746
+ DOM->JS - implemented by custom logic (deserialization).
40747
+ JS->XML - implemented by custom logic (serialization).
40748
+ XML->DOM - implemented by browser.
40749
+ */
40750
+
40751
+ // Transformns an XML string into DOM-tree
40752
+ this.xml2dom = function xml2dom(xml) {
40753
+ return parseXml(xml);
40754
+ };
40755
+
40756
+ // Transforms a DOM tree to JavaScript objects.
40757
+ this.dom2js = function dom2js(domNode) {
40758
+ return deserializeDomChildren(domNode, null);
40759
+ };
40760
+
40761
+ // Transforms JavaScript objects to a DOM tree.
40762
+ this.js2dom = function js2dom(jsObject) {
40763
+ var xml = this.js2xml(jsObject);
40764
+ return parseXml(xml);
40765
+ };
40766
+
40767
+ // Transformns an XML string into JavaScript objects.
40768
+ this.xml2js = function xml2js(xml) {
40769
+ var domNode = parseXml(xml);
40770
+ if (domNode != null)
40771
+ return this.dom2js(domNode);
40772
+ else
40773
+ return null;
40774
+ };
40775
+
40776
+ // Transforms JavaScript objects into an XML string.
40777
+ this.js2xml = function js2xml(jsObject) {
40778
+ return serializeJavaScriptObjectChildren(jsObject);
40779
+ };
40780
+
40781
+ this.getVersion = function getVersion() {
40782
+ return VERSION;
40783
+ };
40784
+ };
40785
+ });
40786
+
40020
40787
  /**
40021
40788
  * @license Angular v17.3.11
40022
40789
  * (c) 2010-2024 Google LLC. https://angular.io/
@@ -87405,7 +88172,7 @@ const getValidJSON = (content) => {
87405
88172
  }
87406
88173
  };
87407
88174
  const xmlToJson = (xmlString) => {
87408
- const x2jsObj = new X2JS({ 'emptyNodeForm': 'content', 'attributePrefix': '', 'enableToStringFunc': false });
88175
+ const x2jsObj = new X2JS({ 'emptyNodeForm': 'object', 'attributePrefix': '', 'enableToStringFunc': false });
87409
88176
  let json = x2jsObj.xml2js(xmlString);
87410
88177
  if (json) {
87411
88178
  json = get(json, Object.keys(json)[0]);