@cdklabs/cdk-ecs-codedeploy 0.0.433 → 0.0.434
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.
- package/.jsii +3 -3
- package/.jsii.tabl.json +1 -1
- package/lib/api-canary/index.js +1 -1
- package/lib/ecs-appspec/index.js +1 -1
- package/lib/ecs-deployment/index.js +1 -1
- package/lib/ecs-patterns/application-load-balanced-codedeployed-fargate-service.js +1 -1
- package/node_modules/@aws-sdk/client-codedeploy/package.json +15 -15
- package/node_modules/@aws-sdk/core/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +3 -3
- package/node_modules/@aws-sdk/nested-clients/package.json +14 -14
- package/node_modules/@aws-sdk/region-config-resolver/package.json +2 -2
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +21 -11
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +5 -1
- package/node_modules/@aws-sdk/xml-builder/dist-es/escape-attribute.js +8 -1
- package/node_modules/@aws-sdk/xml-builder/dist-es/escape-element.js +13 -10
- package/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js +5 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/CHANGELOG.md +40 -4
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/README.md +8 -7
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxbuilder.min.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.d.cts +82 -20
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/pem.d.cts +148 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/package.json +4 -3
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/fxp.d.ts +75 -19
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/pem.d.ts +135 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/util.js +18 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +37 -18
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +76 -5
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +298 -116
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +2 -2
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/node2json.js +65 -15
- package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/CHANGELOG.md +9 -2
- package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/package.json +1 -1
- package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/strnum.js +12 -6
- package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/tests/strnum_test.js +3 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/strnum/tests/temp.js +8 -0
- package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@smithy/config-resolver/dist-cjs/index.js +12 -0
- package/node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js +5 -0
- package/node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseFipsEndpointConfigOptions.js +5 -0
- package/node_modules/@smithy/config-resolver/dist-types/endpointsConfig/NodeUseDualstackEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/dist-types/endpointsConfig/NodeUseFipsEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/dist-types/ts3.4/endpointsConfig/NodeUseDualstackEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/dist-types/ts3.4/endpointsConfig/NodeUseFipsEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/package.json +1 -1
- package/node_modules/@smithy/middleware-endpoint/dist-types/resolveEndpointConfig.d.ts +2 -2
- package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/resolveEndpointConfig.d.ts +2 -2
- package/node_modules/@smithy/middleware-endpoint/package.json +1 -1
- package/node_modules/@smithy/middleware-retry/package.json +2 -2
- package/node_modules/@smithy/smithy-client/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-node/package.json +3 -3
- package/node_modules/path-expression-matcher/README.md +98 -13
- package/node_modules/path-expression-matcher/lib/pem.cjs +1 -1
- package/node_modules/path-expression-matcher/lib/pem.d.cts +188 -0
- package/node_modules/path-expression-matcher/lib/pem.min.js +1 -1
- package/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -1
- package/node_modules/path-expression-matcher/package.json +2 -2
- package/node_modules/path-expression-matcher/src/Matcher.js +84 -0
- package/node_modules/path-expression-matcher/src/index.d.ts +152 -0
- package/package.json +4 -4
- /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/.github/SECURITY.md +0 -0
- /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/.vscode/launch.json +0 -0
- /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/LICENSE +0 -0
- /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/README.md +0 -0
- /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/algo.stflow +0 -0
- /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/tests/infinity_test.js +0 -0
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import type pem = require('./pem');
|
|
2
|
+
type Expression = pem.Expression;
|
|
3
|
+
type ReadonlyMatcher = pem.ReadonlyMatcher;
|
|
4
|
+
|
|
5
|
+
// jPath: true → string
|
|
6
|
+
// jPath: false → ReadonlyMatcher
|
|
7
|
+
type JPathOrMatcher = string | ReadonlyMatcher;
|
|
8
|
+
type JPathOrExpression = string | Expression;
|
|
9
|
+
|
|
1
10
|
type ProcessEntitiesOptions = {
|
|
2
11
|
/**
|
|
3
12
|
* Whether to enable entity processing
|
|
@@ -34,6 +43,13 @@ type ProcessEntitiesOptions = {
|
|
|
34
43
|
*/
|
|
35
44
|
maxExpandedLength?: number;
|
|
36
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Maximum number of entities allowed in the XML
|
|
48
|
+
*
|
|
49
|
+
* Defaults to `100`
|
|
50
|
+
*/
|
|
51
|
+
maxEntityCount?: number;
|
|
52
|
+
|
|
37
53
|
/**
|
|
38
54
|
* Array of tag names where entity replacement is allowed.
|
|
39
55
|
* If null, entities are replaced in all tags.
|
|
@@ -46,12 +62,12 @@ type ProcessEntitiesOptions = {
|
|
|
46
62
|
* Custom filter function to determine if entities should be replaced in a tag
|
|
47
63
|
*
|
|
48
64
|
* @param tagName - The name of the current tag
|
|
49
|
-
* @param
|
|
65
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
50
66
|
* @returns `true` to allow entity replacement, `false` to skip
|
|
51
67
|
*
|
|
52
68
|
* Defaults to `null`
|
|
53
69
|
*/
|
|
54
|
-
tagFilter?: ((tagName: string,
|
|
70
|
+
tagFilter?: ((tagName: string, jPathOrMatcher: JPathOrMatcher) => boolean) | null;
|
|
55
71
|
};
|
|
56
72
|
|
|
57
73
|
type X2jOptions = {
|
|
@@ -96,7 +112,7 @@ type X2jOptions = {
|
|
|
96
112
|
*
|
|
97
113
|
* Defaults to `true`
|
|
98
114
|
*/
|
|
99
|
-
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string,
|
|
115
|
+
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPathOrMatcher: JPathOrMatcher) => boolean);
|
|
100
116
|
|
|
101
117
|
/**
|
|
102
118
|
* Whether to remove namespace string from tag and attribute names
|
|
@@ -150,28 +166,33 @@ type X2jOptions = {
|
|
|
150
166
|
/**
|
|
151
167
|
* Control how tag value should be parsed. Called only if tag value is not empty
|
|
152
168
|
*
|
|
169
|
+
* @param tagName - The name of the tag
|
|
170
|
+
* @param tagValue - The value of the tag
|
|
171
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
172
|
+
* @param hasAttributes - Whether the tag has attributes
|
|
173
|
+
* @param isLeafNode - Whether the tag is a leaf node
|
|
153
174
|
* @returns {undefined|null} `undefined` or `null` to set original value.
|
|
154
175
|
* @returns {unknown}
|
|
155
176
|
*
|
|
156
177
|
* 1. Different value or value with different data type to set new value.
|
|
157
178
|
* 2. Same value to set parsed value if `parseTagValue: true`.
|
|
158
179
|
*
|
|
159
|
-
* Defaults to `(tagName, val,
|
|
180
|
+
* Defaults to `(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode) => val`
|
|
160
181
|
*/
|
|
161
|
-
tagValueProcessor?: (tagName: string, tagValue: string,
|
|
182
|
+
tagValueProcessor?: (tagName: string, tagValue: string, jPathOrMatcher: JPathOrMatcher, hasAttributes: boolean, isLeafNode: boolean) => unknown;
|
|
162
183
|
|
|
163
184
|
/**
|
|
164
185
|
* Control how attribute value should be parsed
|
|
165
186
|
*
|
|
166
|
-
* @param attrName
|
|
167
|
-
* @param attrValue
|
|
168
|
-
* @param jPath
|
|
187
|
+
* @param attrName - The name of the attribute
|
|
188
|
+
* @param attrValue - The value of the attribute
|
|
189
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
169
190
|
* @returns {undefined|null} `undefined` or `null` to set original value
|
|
170
191
|
* @returns {unknown}
|
|
171
192
|
*
|
|
172
|
-
* Defaults to `(attrName, val,
|
|
193
|
+
* Defaults to `(attrName, val, jPathOrMatcher) => val`
|
|
173
194
|
*/
|
|
174
|
-
attributeValueProcessor?: (attrName: string, attrValue: string,
|
|
195
|
+
attributeValueProcessor?: (attrName: string, attrValue: string, jPathOrMatcher: JPathOrMatcher) => unknown;
|
|
175
196
|
|
|
176
197
|
/**
|
|
177
198
|
* Options to pass to `strnum` for parsing numbers
|
|
@@ -183,9 +204,13 @@ type X2jOptions = {
|
|
|
183
204
|
/**
|
|
184
205
|
* Nodes to stop parsing at
|
|
185
206
|
*
|
|
207
|
+
* Accepts string patterns or Expression objects from path-expression-matcher
|
|
208
|
+
*
|
|
209
|
+
* String patterns starting with "*." are automatically converted to ".." for backward compatibility
|
|
210
|
+
*
|
|
186
211
|
* Defaults to `[]`
|
|
187
212
|
*/
|
|
188
|
-
stopNodes?:
|
|
213
|
+
stopNodes?: JPathOrExpression[];
|
|
189
214
|
|
|
190
215
|
/**
|
|
191
216
|
* List of tags without closing tags
|
|
@@ -204,15 +229,15 @@ type X2jOptions = {
|
|
|
204
229
|
/**
|
|
205
230
|
* Determine whether a tag should be parsed as an array
|
|
206
231
|
*
|
|
207
|
-
* @param tagName
|
|
208
|
-
* @param jPath
|
|
209
|
-
* @param isLeafNode
|
|
210
|
-
* @param isAttribute
|
|
232
|
+
* @param tagName - The name of the tag
|
|
233
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
234
|
+
* @param isLeafNode - Whether the tag is a leaf node
|
|
235
|
+
* @param isAttribute - Whether this is an attribute
|
|
211
236
|
* @returns {boolean}
|
|
212
237
|
*
|
|
213
238
|
* Defaults to `() => false`
|
|
214
239
|
*/
|
|
215
|
-
isArray?: (tagName: string,
|
|
240
|
+
isArray?: (tagName: string, jPathOrMatcher: JPathOrMatcher, isLeafNode: boolean, isAttribute: boolean) => boolean;
|
|
216
241
|
|
|
217
242
|
/**
|
|
218
243
|
* Whether to process default and DOCTYPE entities
|
|
@@ -266,12 +291,15 @@ type X2jOptions = {
|
|
|
266
291
|
* Change the tag name when a different name is returned. Skip the tag from parsed result when false is returned.
|
|
267
292
|
* Modify `attrs` object to control attributes for the given tag.
|
|
268
293
|
*
|
|
294
|
+
* @param tagName - The name of the tag
|
|
295
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
296
|
+
* @param attrs - The attributes object
|
|
269
297
|
* @returns {string} new tag name.
|
|
270
298
|
* @returns false to skip the tag
|
|
271
299
|
*
|
|
272
|
-
* Defaults to `(tagName,
|
|
300
|
+
* Defaults to `(tagName, jPathOrMatcher, attrs) => tagName`
|
|
273
301
|
*/
|
|
274
|
-
updateTag?: (tagName: string,
|
|
302
|
+
updateTag?: (tagName: string, jPathOrMatcher: JPathOrMatcher, attrs: { [k: string]: string }) => string | boolean;
|
|
275
303
|
|
|
276
304
|
/**
|
|
277
305
|
* If true, adds a Symbol to all object nodes, accessible by {@link XMLParser.getMetaDataSymbol} with
|
|
@@ -292,6 +320,27 @@ type X2jOptions = {
|
|
|
292
320
|
* Defaults to `true`
|
|
293
321
|
*/
|
|
294
322
|
strictReservedNames?: boolean;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Controls whether callbacks receive jPath as string or Matcher instance
|
|
326
|
+
*
|
|
327
|
+
* When `true` - callbacks receive jPath as string (backward compatible)
|
|
328
|
+
*
|
|
329
|
+
* When `false` - callbacks receive Matcher instance for advanced pattern matching
|
|
330
|
+
*
|
|
331
|
+
* Defaults to `true`
|
|
332
|
+
*/
|
|
333
|
+
jPath?: boolean;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Function to sanitize dangerous property names
|
|
337
|
+
*
|
|
338
|
+
* @param name - The name of the property
|
|
339
|
+
* @returns {string} The sanitized name
|
|
340
|
+
*
|
|
341
|
+
* Defaults to `(name) => __name`
|
|
342
|
+
*/
|
|
343
|
+
onDangerousProperty?: (name: string) => string;
|
|
295
344
|
};
|
|
296
345
|
|
|
297
346
|
type strnumOptions = {
|
|
@@ -428,9 +477,11 @@ type XmlBuilderOptions = {
|
|
|
428
477
|
/**
|
|
429
478
|
* Nodes to stop parsing at
|
|
430
479
|
*
|
|
480
|
+
* Accepts string patterns or Expression objects from path-expression-matcher
|
|
481
|
+
*
|
|
431
482
|
* Defaults to `[]`
|
|
432
483
|
*/
|
|
433
|
-
stopNodes?:
|
|
484
|
+
stopNodes?: JPathOrExpression[];
|
|
434
485
|
|
|
435
486
|
/**
|
|
436
487
|
* Control how tag value should be parsed. Called only if tag value is not empty
|
|
@@ -467,6 +518,13 @@ type XmlBuilderOptions = {
|
|
|
467
518
|
|
|
468
519
|
|
|
469
520
|
oneListGroup?: boolean;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Maximum number of nested tags
|
|
524
|
+
*
|
|
525
|
+
* Defaults to `100`
|
|
526
|
+
*/
|
|
527
|
+
maxNestedTags?: number;
|
|
470
528
|
};
|
|
471
529
|
|
|
472
530
|
type ESchema = string | object | Array<string | object>;
|
|
@@ -535,7 +593,11 @@ declare namespace fxp {
|
|
|
535
593
|
strnumOptions,
|
|
536
594
|
validationOptions,
|
|
537
595
|
ProcessEntitiesOptions,
|
|
596
|
+
Expression,
|
|
597
|
+
ReadonlyMatcher,
|
|
598
|
+
JPathOrMatcher,
|
|
599
|
+
JPathOrExpression,
|
|
538
600
|
}
|
|
539
601
|
}
|
|
540
602
|
|
|
541
|
-
export = fxp;
|
|
603
|
+
export = fxp;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fxp=e():t.fxp=e()}(this,()=>(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{XMLBuilder:()=>mt,XMLParser:()=>nt,XMLValidator:()=>xt});var r=":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",i=new RegExp("^["+r+"]["+r+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function n(t,e){for(var r=[],i=e.exec(t);i;){var n=[];n.startIndex=e.lastIndex-i[0].length;for(var s=i.length,a=0;a<s;a++)n.push(i[a]);r.push(n),i=e.exec(t)}return r}var s=function(t){return!(null==i.exec(t))},a={allowBooleanAttributes:!1,unpairedTags:[]};function o(t,e){e=Object.assign({},a,e);var r=[],i=!1,n=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(var s=0;s<t.length;s++)if("<"===t[s]&&"?"===t[s+1]){if((s=u(t,s+=2)).err)return s}else{if("<"!==t[s]){if(l(t[s]))continue;return x("InvalidChar","char '"+t[s]+"' is not expected.",E(t,s))}var o=s;if("!"===t[++s]){s=d(t,s);continue}var h=!1;"/"===t[s]&&(h=!0,s++);for(var p="";s<t.length&&">"!==t[s]&&" "!==t[s]&&"\t"!==t[s]&&"\n"!==t[s]&&"\r"!==t[s];s++)p+=t[s];if("/"===(p=p.trim())[p.length-1]&&(p=p.substring(0,p.length-1),s--),!b(p))return x("InvalidTag",0===p.trim().length?"Invalid space after '<'.":"Tag '"+p+"' is an invalid name.",E(t,s));var g=f(t,s);if(!1===g)return x("InvalidAttr","Attributes for '"+p+"' have open quote.",E(t,s));var v=g.value;if(s=g.index,"/"===v[v.length-1]){var N=s-v.length,y=c(v=v.substring(0,v.length-1),e);if(!0!==y)return x(y.err.code,y.err.msg,E(t,N+y.err.line));i=!0}else if(h){if(!g.tagClosed)return x("InvalidTag","Closing tag '"+p+"' doesn't have proper closing.",E(t,s));if(v.trim().length>0)return x("InvalidTag","Closing tag '"+p+"' can't have attributes or invalid starting.",E(t,o));if(0===r.length)return x("InvalidTag","Closing tag '"+p+"' has not been opened.",E(t,o));var T=r.pop();if(p!==T.tagName){var w=E(t,T.tagStartPos);return x("InvalidTag","Expected closing tag '"+T.tagName+"' (opened in line "+w.line+", col "+w.col+") instead of closing tag '"+p+"'.",E(t,o))}0==r.length&&(n=!0)}else{var I=c(v,e);if(!0!==I)return x(I.err.code,I.err.msg,E(t,s-v.length+I.err.line));if(!0===n)return x("InvalidXml","Multiple possible root nodes found.",E(t,s));-1!==e.unpairedTags.indexOf(p)||r.push({tagName:p,tagStartPos:o}),i=!0}for(s++;s<t.length;s++)if("<"===t[s]){if("!"===t[s+1]){s=d(t,++s);continue}if("?"!==t[s+1])break;if((s=u(t,++s)).err)return s}else if("&"===t[s]){var O=m(t,s);if(-1==O)return x("InvalidChar","char '&' is not expected.",E(t,s));s=O}else if(!0===n&&!l(t[s]))return x("InvalidXml","Extra text at the end",E(t,s));"<"===t[s]&&s--}return i?1==r.length?x("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",E(t,r[0].tagStartPos)):!(r.length>0)||x("InvalidXml","Invalid '"+JSON.stringify(r.map(function(t){return t.tagName}),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):x("InvalidXml","Start tag expected.",1)}function l(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function u(t,e){for(var r=e;e<t.length;e++)if("?"!=t[e]&&" "!=t[e]);else{var i=t.substr(r,e-r);if(e>5&&"xml"===i)return x("InvalidXml","XML declaration allowed only at the start of the document.",E(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function d(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){var r=1;for(e+=8;e<t.length;e++)if("<"===t[e])r++;else if(">"===t[e]&&0===--r)break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}var h='"',p="'";function f(t,e){for(var r="",i="",n=!1;e<t.length;e++){if(t[e]===h||t[e]===p)""===i?i=t[e]:i!==t[e]||(i="");else if(">"===t[e]&&""===i){n=!0;break}r+=t[e]}return""===i&&{value:r,index:e,tagClosed:n}}var g=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function c(t,e){for(var r=n(t,g),i={},s=0;s<r.length;s++){if(0===r[s][1].length)return x("InvalidAttr","Attribute '"+r[s][2]+"' has no space in starting.",N(r[s]));if(void 0!==r[s][3]&&void 0===r[s][4])return x("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",N(r[s]));if(void 0===r[s][3]&&!e.allowBooleanAttributes)return x("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",N(r[s]));var a=r[s][2];if(!v(a))return x("InvalidAttr","Attribute '"+a+"' is an invalid name.",N(r[s]));if(Object.prototype.hasOwnProperty.call(i,a))return x("InvalidAttr","Attribute '"+a+"' is repeated.",N(r[s]));i[a]=1}return!0}function m(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){var r=/\d/;for("x"===t[e]&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(r))break}return-1}(t,++e);for(var r=0;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(";"===t[e])break;return-1}return e}function x(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function v(t){return s(t)}function b(t){return s(t)}function E(t,e){var r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function N(t){return t.startIndex+t[1].length}var y={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:function(){return!1},commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0};function T(t){return"boolean"==typeof t?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:"object"==typeof t&&null!==t?{enabled:!1!==t.enabled,maxEntitySize:null!=(e=t.maxEntitySize)?e:1e4,maxExpansionDepth:null!=(r=t.maxExpansionDepth)?r:10,maxTotalExpansions:null!=(i=t.maxTotalExpansions)?i:1e3,maxExpandedLength:null!=(n=t.maxExpandedLength)?n:1e5,allowedTags:null!=(s=t.allowedTags)?s:null,tagFilter:null!=(a=t.tagFilter)?a:null}:T(!0);var e,r,i,n,s,a}var w,I=function(t){var e=Object.assign({},y,t);return e.processEntities=T(e.processEntities),e};w="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");var O=function(){function t(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}var e=t.prototype;return e.add=function(t,e){var r;"__proto__"===t&&(t="#__proto__"),this.child.push(((r={})[t]=e,r))},e.addChild=function(t,e){var r,i;"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push(((r={})[t.tagname]=t.child,r[":@"]=t[":@"],r)):this.child.push(((i={})[t.tagname]=t.child,i)),void 0!==e&&(this.child[this.child.length-1][w]={startIndex:e})},t.getMetaDataSymbol=function(){return w},t}(),A=function(){function t(t){this.suppressValidationErr=!t,this.options=t}var e=t.prototype;return e.readDocType=function(t,e){var r=Object.create(null);if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");e+=9;for(var i=1,n=!1,s=!1;e<t.length;e++)if("<"!==t[e]||s)if(">"===t[e]){if(s?"-"===t[e-1]&&"-"===t[e-2]&&(s=!1,i--):i--,0===i)break}else"["===t[e]?n=!0:t[e];else{if(n&&S(t,"!ENTITY",e)){e+=7;var a=void 0,o=void 0,l=this.readEntityExp(t,e+1,this.suppressValidationErr);if(a=l[0],o=l[1],e=l[2],-1===o.indexOf("&")){var u=a.replace(/[.\-+*:]/g,"\\.");r[a]={regx:RegExp("&"+u+";","g"),val:o}}}else if(n&&S(t,"!ELEMENT",e))e+=8,e=this.readElementExp(t,e+1).index;else if(n&&S(t,"!ATTLIST",e))e+=8;else if(n&&S(t,"!NOTATION",e))e+=9,e=this.readNotationExp(t,e+1,this.suppressValidationErr).index;else{if(!S(t,"!--",e))throw new Error("Invalid DOCTYPE");s=!0}i++}if(0!==i)throw new Error("Unclosed DOCTYPE");return{entities:r,i:e}},e.readEntityExp=function(t,e){e=P(t,e);for(var r="";e<t.length&&!/\s/.test(t[e])&&'"'!==t[e]&&"'"!==t[e];)r+=t[e],e++;if(C(r),e=P(t,e),!this.suppressValidationErr){if("SYSTEM"===t.substring(e,e+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[e])throw new Error("Parameter entities are not supported")}var i,n=this.readIdentifierVal(t,e,"entity");if(e=n[0],i=n[1],!1!==this.options.enabled&&this.options.maxEntitySize&&i.length>this.options.maxEntitySize)throw new Error('Entity "'+r+'" size ('+i.length+") exceeds maximum allowed size ("+this.options.maxEntitySize+")");return[r,i,--e]},e.readNotationExp=function(t,e){e=P(t,e);for(var r="";e<t.length&&!/\s/.test(t[e]);)r+=t[e],e++;!this.suppressValidationErr&&C(r),e=P(t,e);var i=t.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==i&&"PUBLIC"!==i)throw new Error('Expected SYSTEM or PUBLIC, found "'+i+'"');e+=i.length,e=P(t,e);var n=null,s=null;if("PUBLIC"===i){var a=this.readIdentifierVal(t,e,"publicIdentifier");if(e=a[0],n=a[1],'"'===t[e=P(t,e)]||"'"===t[e]){var o=this.readIdentifierVal(t,e,"systemIdentifier");e=o[0],s=o[1]}}else if("SYSTEM"===i){var l=this.readIdentifierVal(t,e,"systemIdentifier");if(e=l[0],s=l[1],!this.suppressValidationErr&&!s)throw new Error("Missing mandatory system identifier for SYSTEM notation")}return{notationName:r,publicIdentifier:n,systemIdentifier:s,index:--e}},e.readIdentifierVal=function(t,e,r){var i="",n=t[e];if('"'!==n&&"'"!==n)throw new Error('Expected quoted string, found "'+n+'"');for(e++;e<t.length&&t[e]!==n;)i+=t[e],e++;if(t[e]!==n)throw new Error("Unterminated "+r+" value");return[++e,i]},e.readElementExp=function(t,e){e=P(t,e);for(var r="";e<t.length&&!/\s/.test(t[e]);)r+=t[e],e++;if(!this.suppressValidationErr&&!s(r))throw new Error('Invalid element name: "'+r+'"');var i="";if("E"===t[e=P(t,e)]&&S(t,"MPTY",e))e+=4;else if("A"===t[e]&&S(t,"NY",e))e+=2;else if("("===t[e]){for(e++;e<t.length&&")"!==t[e];)i+=t[e],e++;if(")"!==t[e])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error('Invalid Element Expression, found "'+t[e]+'"');return{elementName:r,contentModel:i.trim(),index:e}},e.readAttlistExp=function(t,e){e=P(t,e);for(var r="";e<t.length&&!/\s/.test(t[e]);)r+=t[e],e++;C(r),e=P(t,e);for(var i="";e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;if(!C(i))throw new Error('Invalid attribute name: "'+i+'"');e=P(t,e);var n="";if("NOTATION"===t.substring(e,e+8).toUpperCase()){if(n="NOTATION","("!==t[e=P(t,e+=8)])throw new Error("Expected '(', found \""+t[e]+'"');e++;for(var s=[];e<t.length&&")"!==t[e];){for(var a="";e<t.length&&"|"!==t[e]&&")"!==t[e];)a+=t[e],e++;if(!C(a=a.trim()))throw new Error('Invalid notation name: "'+a+'"');s.push(a),"|"===t[e]&&(e++,e=P(t,e))}if(")"!==t[e])throw new Error("Unterminated list of notations");e++,n+=" ("+s.join("|")+")"}else{for(;e<t.length&&!/\s/.test(t[e]);)n+=t[e],e++;if(!this.suppressValidationErr&&!["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"].includes(n.toUpperCase()))throw new Error('Invalid attribute type: "'+n+'"')}e=P(t,e);var o="";if("#REQUIRED"===t.substring(e,e+8).toUpperCase())o="#REQUIRED",e+=8;else if("#IMPLIED"===t.substring(e,e+7).toUpperCase())o="#IMPLIED",e+=7;else{var l=this.readIdentifierVal(t,e,"ATTLIST");e=l[0],o=l[1]}return{elementName:r,attributeName:i,attributeType:n,defaultValue:o,index:e}},t}(),P=function(t,e){for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function S(t,e,r){for(var i=0;i<e.length;i++)if(e[i]!==t[r+i+1])return!1;return!0}function C(t){if(s(t))return t;throw new Error("Invalid entity name "+t)}const V=/^[-+]?0x[a-fA-F0-9]+$/,j=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,D={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};const L=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function M(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}var F=function(t){var e;if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:function(t,e){return Q(e,10,"&#")}},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:function(t,e){return Q(e,16,"&#x")}}},this.addExternalEntities=k,this.parseXml=B,this.parseTextData=_,this.resolveNameSpace=$,this.buildAttributesMap=R,this.isItStopNode=z,this.replaceEntitiesValue=G,this.readStopNodeData=Z,this.saveTextToParentTag=X,this.addChild=Y,this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?function(t){for(var r,i=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return M(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(r=i()).done;){var n=r.value;if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:function(){return!1},this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(var r=0;r<this.options.stopNodes.length;r++){var i=this.options.stopNodes[r];"string"==typeof i&&(i.startsWith("*.")?this.stopNodesWildcard.add(i.substring(2)):this.stopNodesExact.add(i))}}};function k(t){for(var e=Object.keys(t),r=0;r<e.length;r++){var i=e[r],n=i.replace(/[.\-+*:]/g,"\\.");this.lastEntities[i]={regex:new RegExp("&"+n+";","g"),val:t[i]}}}function _(t,e,r,i,n,s,a){if(void 0!==t&&(this.options.trimValues&&!i&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t,e,r));var o=this.options.tagValueProcessor(e,t,r,n,s);return null==o?t:typeof o!=typeof t||o!==t?o:this.options.trimValues||t.trim()===t?K(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function $(t){if(this.options.removeNSPrefix){var e=t.split(":"),r="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=r+e[1])}return t}var U=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function R(t,e,r){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){for(var i=n(t,U),s=i.length,a={},o=0;o<s;o++){var l=this.resolveNameSpace(i[o][1]);if(!this.ignoreAttributesFn(l,e)){var u=i[o][4],d=this.options.attributeNamePrefix+l;if(l.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),"__proto__"===d&&(d="#__proto__"),void 0!==u){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u,r,e);var h=this.options.attributeValueProcessor(l,u,e);a[d]=null==h?u:typeof h!=typeof u||h!==u?h:K(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(a[d]=!0)}}if(!Object.keys(a).length)return;if(this.options.attributesGroupName){var p={};return p[this.options.attributesGroupName]=a,p}return a}}var B=function(t){t=t.replace(/\r\n?/g,"\n");var e=new O("!xml"),r=e,i="",n="";this.entityExpansionCount=0,this.currentExpandedLength=0;for(var s=new A(this.options.processEntities),a=0;a<t.length;a++)if("<"===t[a])if("/"===t[a+1]){var o=W(t,">",a,"Closing Tag is not closed."),l=t.substring(a+2,o).trim();if(this.options.removeNSPrefix){var u=l.indexOf(":");-1!==u&&(l=l.substr(u+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),r&&(i=this.saveTextToParentTag(i,r,n));var d=n.substring(n.lastIndexOf(".")+1);if(l&&-1!==this.options.unpairedTags.indexOf(l))throw new Error("Unpaired tag can not be used as closing tag: </"+l+">");var h=0;d&&-1!==this.options.unpairedTags.indexOf(d)?(h=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):h=n.lastIndexOf("."),n=n.substring(0,h),r=this.tagsNodeStack.pop(),i="",a=o}else if("?"===t[a+1]){var p=q(t,a,!1,"?>");if(!p)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,r,n),this.options.ignoreDeclaration&&"?xml"===p.tagName||this.options.ignorePiTags);else{var f=new O(p.tagName);f.add(this.options.textNodeName,""),p.tagName!==p.tagExp&&p.attrExpPresent&&(f[":@"]=this.buildAttributesMap(p.tagExp,n,p.tagName)),this.addChild(r,f,n,a)}a=p.closeIndex+1}else if("!--"===t.substr(a+1,3)){var g=W(t,"--\x3e",a+4,"Comment is not closed.");if(this.options.commentPropName){var c,m=t.substring(a+4,g-2);i=this.saveTextToParentTag(i,r,n),r.add(this.options.commentPropName,[(c={},c[this.options.textNodeName]=m,c)])}a=g}else if("!D"===t.substr(a+1,2)){var x=s.readDocType(t,a);this.docTypeEntities=x.entities,a=x.i}else if("!["===t.substr(a+1,2)){var v=W(t,"]]>",a,"CDATA is not closed.")-2,b=t.substring(a+9,v);i=this.saveTextToParentTag(i,r,n);var E,N=this.parseTextData(b,r.tagname,n,!0,!1,!0,!0);null==N&&(N=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[(E={},E[this.options.textNodeName]=b,E)]):r.add(this.options.textNodeName,N),a=v+2}else{var y=q(t,a,this.options.removeNSPrefix),T=y.tagName,w=y.rawTagName,I=y.tagExp,P=y.attrExpPresent,S=y.closeIndex;if(this.options.transformTagName){var C=this.options.transformTagName(T);I===T&&(I=C),T=C}if(this.options.strictReservedNames&&(T===this.options.commentPropName||T===this.options.cdataPropName))throw new Error("Invalid tag name: "+T);r&&i&&"!xml"!==r.tagname&&(i=this.saveTextToParentTag(i,r,n,!1));var V=r;V&&-1!==this.options.unpairedTags.indexOf(V.tagname)&&(r=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),T!==e.tagname&&(n+=n?"."+T:T);var j=a;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,n,T)){var D="";if(I.length>0&&I.lastIndexOf("/")===I.length-1)"/"===T[T.length-1]?(T=T.substr(0,T.length-1),n=n.substr(0,n.length-1),I=T):I=I.substr(0,I.length-1),a=y.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(T))a=y.closeIndex;else{var L=this.readStopNodeData(t,w,S+1);if(!L)throw new Error("Unexpected end of "+w);a=L.i,D=L.tagContent}var M=new O(T);T!==I&&P&&(M[":@"]=this.buildAttributesMap(I,n,T)),D&&(D=this.parseTextData(D,T,n,!0,P,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),M.add(this.options.textNodeName,D),this.addChild(r,M,n,j)}else{if(I.length>0&&I.lastIndexOf("/")===I.length-1){if("/"===T[T.length-1]?(T=T.substr(0,T.length-1),n=n.substr(0,n.length-1),I=T):I=I.substr(0,I.length-1),this.options.transformTagName){var F=this.options.transformTagName(T);I===T&&(I=F),T=F}var k=new O(T);T!==I&&P&&(k[":@"]=this.buildAttributesMap(I,n,T)),this.addChild(r,k,n,j),n=n.substr(0,n.lastIndexOf("."))}else{if(-1!==this.options.unpairedTags.indexOf(T)){var _=new O(T);T!==I&&P&&(_[":@"]=this.buildAttributesMap(I,n)),this.addChild(r,_,n,j),n=n.substr(0,n.lastIndexOf(".")),a=y.closeIndex;continue}var $=new O(T);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),T!==I&&P&&($[":@"]=this.buildAttributesMap(I,n,T)),this.addChild(r,$,n,j),r=$}i="",a=S}}else i+=t[a];return e.child};function Y(t,e,r,i){this.options.captureMetaData||(i=void 0);var n=this.options.updateTag(e.tagname,r,e[":@"]);!1===n||("string"==typeof n?(e.tagname=n,t.addChild(e,i)):t.addChild(e,i))}var G=function(t,e,r){if(-1===t.indexOf("&"))return t;var i=this.options.processEntities;if(!i.enabled)return t;if(i.allowedTags&&!i.allowedTags.includes(e))return t;if(i.tagFilter&&!i.tagFilter(e,r))return t;for(var n in this.docTypeEntities){var s=this.docTypeEntities[n],a=t.match(s.regx);if(a){if(this.entityExpansionCount+=a.length,i.maxTotalExpansions&&this.entityExpansionCount>i.maxTotalExpansions)throw new Error("Entity expansion limit exceeded: "+this.entityExpansionCount+" > "+i.maxTotalExpansions);var o=t.length;if(t=t.replace(s.regx,s.val),i.maxExpandedLength&&(this.currentExpandedLength+=t.length-o,this.currentExpandedLength>i.maxExpandedLength))throw new Error("Total expanded content size exceeded: "+this.currentExpandedLength+" > "+i.maxExpandedLength)}}if(-1===t.indexOf("&"))return t;for(var l in this.lastEntities){var u=this.lastEntities[l];t=t.replace(u.regex,u.val)}if(-1===t.indexOf("&"))return t;if(this.options.htmlEntities)for(var d in this.htmlEntities){var h=this.htmlEntities[d];t=t.replace(h.regex,h.val)}return t.replace(this.ampEntity.regex,this.ampEntity.val)};function X(t,e,r,i){return t&&(void 0===i&&(i=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,r,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,i))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function z(t,e,r,i){return!(!e||!e.has(i))||!(!t||!t.has(r))}function W(t,e,r,i){var n=t.indexOf(e,r);if(-1===n)throw new Error(i);return n+e.length-1}function q(t,e,r,i){void 0===i&&(i=">");var n=function(t,e,r){var i;void 0===r&&(r=">");for(var n="",s=e;s<t.length;s++){var a=t[s];if(i)a===i&&(i="");else if('"'===a||"'"===a)i=a;else if(a===r[0]){if(!r[1])return{data:n,index:s};if(t[s+1]===r[1])return{data:n,index:s}}else"\t"===a&&(a=" ");n+=a}}(t,e+1,i);if(n){var s=n.data,a=n.index,o=s.search(/\s/),l=s,u=!0;-1!==o&&(l=s.substring(0,o),s=s.substring(o+1).trimStart());var d=l;if(r){var h=l.indexOf(":");-1!==h&&(u=(l=l.substr(h+1))!==n.data.substr(h+1))}return{tagName:l,tagExp:s,closeIndex:a,attrExpPresent:u,rawTagName:d}}}function Z(t,e,r){for(var i=r,n=1;r<t.length;r++)if("<"===t[r])if("/"===t[r+1]){var s=W(t,">",r,e+" is not closed");if(t.substring(r+2,s).trim()===e&&0===--n)return{tagContent:t.substring(i,r),i:s};r=s}else if("?"===t[r+1])r=W(t,"?>",r+1,"StopNode is not closed.");else if("!--"===t.substr(r+1,3))r=W(t,"--\x3e",r+3,"StopNode is not closed.");else if("!["===t.substr(r+1,2))r=W(t,"]]>",r,"StopNode is not closed.")-2;else{var a=q(t,r,">");a&&((a&&a.tagName)===e&&"/"!==a.tagExp[a.tagExp.length-1]&&n++,r=a.closeIndex)}}function K(t,e,r){if(e&&"string"==typeof t){var i=t.trim();return"true"===i||"false"!==i&&function(t,e={}){if(e=Object.assign({},D,e),!t||"string"!=typeof t)return t;let r=t.trim();if(void 0!==e.skipLike&&e.skipLike.test(r))return t;if("0"===t)return 0;if(e.hex&&V.test(r))return function(t){if(parseInt)return parseInt(t,16);if(Number.parseInt)return Number.parseInt(t,16);if(window&&window.parseInt)return window.parseInt(t,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(r);if(r.includes("e")||r.includes("E"))return function(t,e,r){if(!r.eNotation)return t;const i=e.match(L);if(i){let n=i[1]||"";const s=-1===i[3].indexOf("e")?"E":"e",a=i[2],o=n?t[a.length+1]===s:t[a.length]===s;return a.length>1&&o?t:1!==a.length||!i[3].startsWith(`.${s}`)&&i[3][0]!==s?r.leadingZeros&&!o?(e=(i[1]||"")+i[3],Number(e)):t:Number(e)}return t}(t,r,e);{const n=j.exec(r);if(n){const s=n[1]||"",a=n[2];let o=(i=n[3])&&-1!==i.indexOf(".")?("."===(i=i.replace(/0+$/,""))?i="0":"."===i[0]?i="0"+i:"."===i[i.length-1]&&(i=i.substring(0,i.length-1)),i):i;const l=s?"."===t[a.length+1]:"."===t[a.length];if(!e.leadingZeros&&(a.length>1||1===a.length&&!l))return t;{const i=Number(r),n=String(i);if(0===i)return i;if(-1!==n.search(/[eE]/))return e.eNotation?i:t;if(-1!==r.indexOf("."))return"0"===n||n===o||n===`${s}${o}`?i:t;let l=a?o:r;return a?l===n||s+l===n?i:t:l===n||l===s+n?i:t}}return t}var i}(t,r)}return void 0!==t?t:""}function Q(t,e,r){var i=Number.parseInt(t,e);return i>=0&&i<=1114111?String.fromCodePoint(i):r+t+";"}var J=O.getMetaDataSymbol();function H(t,e){return tt(t,e)}function tt(t,e,r){for(var i,n={},s=0;s<t.length;s++){var a,o=t[s],l=et(o);if(a=void 0===r?l:r+"."+l,l===e.textNodeName)void 0===i?i=o[l]:i+=""+o[l];else{if(void 0===l)continue;if(o[l]){var u=tt(o[l],e,a),d=it(u,e);o[":@"]?rt(u,o[":@"],a,e):1!==Object.keys(u).length||void 0===u[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(u).length&&(e.alwaysCreateTextNode?u[e.textNodeName]="":u=""):u=u[e.textNodeName],void 0!==o[J]&&"object"==typeof u&&null!==u&&(u[J]=o[J]),void 0!==n[l]&&Object.prototype.hasOwnProperty.call(n,l)?(Array.isArray(n[l])||(n[l]=[n[l]]),n[l].push(u)):e.isArray(l,a,d)?n[l]=[u]:n[l]=u}}}return"string"==typeof i?i.length>0&&(n[e.textNodeName]=i):void 0!==i&&(n[e.textNodeName]=i),n}function et(t){for(var e=Object.keys(t),r=0;r<e.length;r++){var i=e[r];if(":@"!==i)return i}}function rt(t,e,r,i){if(e)for(var n=Object.keys(e),s=n.length,a=0;a<s;a++){var o=n[a];i.isArray(o,r+"."+o,!0,!0)?t[o]=[e[o]]:t[o]=e[o]}}function it(t,e){var r=e.textNodeName,i=Object.keys(t).length;return 0===i||!(1!==i||!t[r]&&"boolean"!=typeof t[r]&&0!==t[r])}var nt=function(){function t(t){this.externalEntities={},this.options=I(t)}var e=t.prototype;return e.parse=function(t,e){if("string"!=typeof t&&t.toString)t=t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(e){!0===e&&(e={});var r=o(t,e);if(!0!==r)throw Error(r.err.msg+":"+r.err.line+":"+r.err.col)}var i=new F(this.options);i.addExternalEntities(this.externalEntities);var n=i.parseXml(t);return this.options.preserveOrder||void 0===n?n:H(n,this.options)},e.addEntity=function(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e},t.getMetaDataSymbol=function(){return O.getMetaDataSymbol()},t}();function st(t,e){let r="";return e.format&&e.indentBy.length>0&&(r="\n"),at(t,e,"",r)}function at(t,e,r,i){let n="",s=!1;if(!Array.isArray(t)){if(null!=t){let r=t.toString();return r=dt(r,e),r}return""}for(let a=0;a<t.length;a++){const o=t[a],l=ot(o);if(void 0===l)continue;let u="";if(u=0===r.length?l:`${r}.${l}`,l===e.textNodeName){let t=o[l];ut(u,e)||(t=e.tagValueProcessor(l,t),t=dt(t,e)),s&&(n+=i),n+=t,s=!1;continue}if(l===e.cdataPropName){s&&(n+=i),n+=`<![CDATA[${o[l][0][e.textNodeName]}]]>`,s=!1;continue}if(l===e.commentPropName){n+=i+`\x3c!--${o[l][0][e.textNodeName]}--\x3e`,s=!0;continue}if("?"===l[0]){const t=lt(o[":@"],e),r="?xml"===l?"":i;let a=o[l][0][e.textNodeName];a=0!==a.length?" "+a:"",n+=r+`<${l}${a}${t}?>`,s=!0;continue}let d=i;""!==d&&(d+=e.indentBy);const h=i+`<${l}${lt(o[":@"],e)}`,p=at(o[l],e,u,d);-1!==e.unpairedTags.indexOf(l)?e.suppressUnpairedNode?n+=h+">":n+=h+"/>":p&&0!==p.length||!e.suppressEmptyNode?p&&p.endsWith(">")?n+=h+`>${p}${i}</${l}>`:(n+=h+">",p&&""!==i&&(p.includes("/>")||p.includes("</"))?n+=i+e.indentBy+p+i:n+=p,n+=`</${l}>`):n+=h+"/>",s=!0}return n}function ot(t){const e=Object.keys(t);for(let r=0;r<e.length;r++){const i=e[r];if(Object.prototype.hasOwnProperty.call(t,i)&&":@"!==i)return i}}function lt(t,e){let r="";if(t&&!e.ignoreAttributes)for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let n=e.attributeValueProcessor(i,t[i]);n=dt(n,e),!0===n&&e.suppressBooleanAttributes?r+=` ${i.substr(e.attributeNamePrefix.length)}`:r+=` ${i.substr(e.attributeNamePrefix.length)}="${n}"`}return r}function ut(t,e){let r=(t=t.substr(0,t.length-e.textNodeName.length-1)).substr(t.lastIndexOf(".")+1);for(let i in e.stopNodes)if(e.stopNodes[i]===t||e.stopNodes[i]==="*."+r)return!0;return!1}function dt(t,e){if(t&&t.length>0&&e.processEntities)for(let r=0;r<e.entities.length;r++){const i=e.entities[r];t=t.replace(i.regex,i.val)}return t}const ht={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function pt(t){var e;this.options=Object.assign({},ht,t),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const r of e){if("string"==typeof r&&t===r)return!0;if(r instanceof RegExp&&r.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ct),this.processTextOrObjNode=ft,this.options.format?(this.indentate=gt,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function ft(t,e,r,i){const n=this.j2x(t,r+1,i.concat(e));return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,r):this.buildObjectNode(n.val,e,n.attrStr,r)}function gt(t){return this.options.indentBy.repeat(t)}function ct(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}pt.prototype.build=function(t){return this.options.preserveOrder?st(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)},pt.prototype.j2x=function(t,e,r){let i="",n="";const s=r.join(".");for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(void 0===t[a])this.isAttribute(a)&&(n+="");else if(null===t[a])this.isAttribute(a)||a===this.options.cdataPropName?n+="":"?"===a[0]?n+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)n+=this.buildTextValNode(t[a],a,"",e);else if("object"!=typeof t[a]){const r=this.isAttribute(a);if(r&&!this.ignoreAttributesFn(r,s))i+=this.buildAttrPairStr(r,""+t[a]);else if(!r)if(a===this.options.textNodeName){let e=this.options.tagValueProcessor(a,""+t[a]);n+=this.replaceEntitiesValue(e)}else n+=this.buildTextValNode(t[a],a,"",e)}else if(Array.isArray(t[a])){const i=t[a].length;let s="",o="";for(let l=0;l<i;l++){const i=t[a][l];if(void 0===i);else if(null===i)"?"===a[0]?n+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if("object"==typeof i)if(this.options.oneListGroup){const t=this.j2x(i,e+1,r.concat(a));s+=t.val,this.options.attributesGroupName&&i.hasOwnProperty(this.options.attributesGroupName)&&(o+=t.attrStr)}else s+=this.processTextOrObjNode(i,a,e,r);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(a,i);t=this.replaceEntitiesValue(t),s+=t}else s+=this.buildTextValNode(i,a,"",e)}this.options.oneListGroup&&(s=this.buildObjectNode(s,a,o,e)),n+=s}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const e=Object.keys(t[a]),r=e.length;for(let n=0;n<r;n++)i+=this.buildAttrPairStr(e[n],""+t[a][e[n]])}else n+=this.processTextOrObjNode(t[a],a,e,r);return{attrStr:i,val:n}},pt.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},pt.prototype.buildObjectNode=function(t,e,r,i){if(""===t)return"?"===e[0]?this.indentate(i)+"<"+e+r+"?"+this.tagEndChar:this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar;{let n="</"+e+this.tagEndChar,s="";return"?"===e[0]&&(s="?",n=""),!r&&""!==r||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===s.length?this.indentate(i)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(i)+"<"+e+r+s+this.tagEndChar+t+this.indentate(i)+n:this.indentate(i)+"<"+e+r+s+">"+t+n}},pt.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},pt.prototype.buildTextValNode=function(t,e,r,i){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(i)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(i)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(i)+"<"+e+r+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),""===n?this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+r+">"+n+"</"+e+this.tagEndChar}},pt.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};const mt=pt;var xt={validate:o};return e})());
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fxp=e():t.fxp=e()}(this,()=>(()=>{"use strict";var t={d:(e,i)=>{for(var r in i)t.o(i,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:i[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{XMLBuilder:()=>jt,XMLParser:()=>mt,XMLValidator:()=>Mt});var i=":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",r=new RegExp("^["+i+"]["+i+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function n(t,e){for(var i=[],r=e.exec(t);r;){var n=[];n.startIndex=e.lastIndex-r[0].length;for(var s=r.length,o=0;o<s;o++)n.push(r[o]);i.push(n),r=e.exec(t)}return i}var s=function(t){return!(null==r.exec(t))},o=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],a=["__proto__","constructor","prototype"],h={allowBooleanAttributes:!1,unpairedTags:[]};function l(t,e){e=Object.assign({},h,e);var i=[],r=!1,n=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(var s=0;s<t.length;s++)if("<"===t[s]&&"?"===t[s+1]){if((s=p(t,s+=2)).err)return s}else{if("<"!==t[s]){if(u(t[s]))continue;return b("InvalidChar","char '"+t[s]+"' is not expected.",E(t,s))}var o=s;if("!"===t[++s]){s=d(t,s);continue}var a=!1;"/"===t[s]&&(a=!0,s++);for(var l="";s<t.length&&">"!==t[s]&&" "!==t[s]&&"\t"!==t[s]&&"\n"!==t[s]&&"\r"!==t[s];s++)l+=t[s];if("/"===(l=l.trim())[l.length-1]&&(l=l.substring(0,l.length-1),s--),!y(l))return b("InvalidTag",0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",E(t,s));var f=g(t,s);if(!1===f)return b("InvalidAttr","Attributes for '"+l+"' have open quote.",E(t,s));var c=f.value;if(s=f.index,"/"===c[c.length-1]){var m=s-c.length,N=x(c=c.substring(0,c.length-1),e);if(!0!==N)return b(N.err.code,N.err.msg,E(t,m+N.err.line));r=!0}else if(a){if(!f.tagClosed)return b("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",E(t,s));if(c.trim().length>0)return b("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",E(t,o));if(0===i.length)return b("InvalidTag","Closing tag '"+l+"' has not been opened.",E(t,o));var w=i.pop();if(l!==w.tagName){var T=E(t,w.tagStartPos);return b("InvalidTag","Expected closing tag '"+w.tagName+"' (opened in line "+T.line+", col "+T.col+") instead of closing tag '"+l+"'.",E(t,o))}0==i.length&&(n=!0)}else{var S=x(c,e);if(!0!==S)return b(S.err.code,S.err.msg,E(t,s-c.length+S.err.line));if(!0===n)return b("InvalidXml","Multiple possible root nodes found.",E(t,s));-1!==e.unpairedTags.indexOf(l)||i.push({tagName:l,tagStartPos:o}),r=!0}for(s++;s<t.length;s++)if("<"===t[s]){if("!"===t[s+1]){s=d(t,++s);continue}if("?"!==t[s+1])break;if((s=p(t,++s)).err)return s}else if("&"===t[s]){var P=v(t,s);if(-1==P)return b("InvalidChar","char '&' is not expected.",E(t,s));s=P}else if(!0===n&&!u(t[s]))return b("InvalidXml","Extra text at the end",E(t,s));"<"===t[s]&&s--}return r?1==i.length?b("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",E(t,i[0].tagStartPos)):!(i.length>0)||b("InvalidXml","Invalid '"+JSON.stringify(i.map(function(t){return t.tagName}),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):b("InvalidXml","Start tag expected.",1)}function u(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function p(t,e){for(var i=e;e<t.length;e++)if("?"!=t[e]&&" "!=t[e]);else{var r=t.substr(i,e-i);if(e>5&&"xml"===r)return b("InvalidXml","XML declaration allowed only at the start of the document.",E(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function d(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){var i=1;for(e+=8;e<t.length;e++)if("<"===t[e])i++;else if(">"===t[e]&&0===--i)break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}var f='"',c="'";function g(t,e){for(var i="",r="",n=!1;e<t.length;e++){if(t[e]===f||t[e]===c)""===r?r=t[e]:r!==t[e]||(r="");else if(">"===t[e]&&""===r){n=!0;break}i+=t[e]}return""===r&&{value:i,index:e,tagClosed:n}}var m=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function x(t,e){for(var i=n(t,m),r={},s=0;s<i.length;s++){if(0===i[s][1].length)return b("InvalidAttr","Attribute '"+i[s][2]+"' has no space in starting.",w(i[s]));if(void 0!==i[s][3]&&void 0===i[s][4])return b("InvalidAttr","Attribute '"+i[s][2]+"' is without value.",w(i[s]));if(void 0===i[s][3]&&!e.allowBooleanAttributes)return b("InvalidAttr","boolean attribute '"+i[s][2]+"' is not allowed.",w(i[s]));var o=i[s][2];if(!N(o))return b("InvalidAttr","Attribute '"+o+"' is an invalid name.",w(i[s]));if(Object.prototype.hasOwnProperty.call(r,o))return b("InvalidAttr","Attribute '"+o+"' is repeated.",w(i[s]));r[o]=1}return!0}function v(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){var i=/\d/;for("x"===t[e]&&(e++,i=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(i))break}return-1}(t,++e);for(var i=0;e<t.length;e++,i++)if(!(t[e].match(/\w/)&&i<20)){if(";"===t[e])break;return-1}return e}function b(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function N(t){return s(t)}function y(t){return s(t)}function E(t,e){var i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function w(t){return t.startIndex+t[1].length}var T=function(t){return o.includes(t)?"__"+t:t},S={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:function(){return!1},commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:T};function P(t,e){if("string"==typeof t){var i=t.toLowerCase();if(o.some(function(t){return i===t.toLowerCase()}))throw new Error("[SECURITY] Invalid "+e+': "'+t+'" is a reserved JavaScript keyword that could cause prototype pollution');if(a.some(function(t){return i===t.toLowerCase()}))throw new Error("[SECURITY] Invalid "+e+': "'+t+'" is a reserved JavaScript keyword that could cause prototype pollution')}}function A(t){return"boolean"==typeof t?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,allowedTags:null,tagFilter:null}:"object"==typeof t&&null!==t?{enabled:!1!==t.enabled,maxEntitySize:Math.max(1,null!=(e=t.maxEntitySize)?e:1e4),maxExpansionDepth:Math.max(1,null!=(i=t.maxExpansionDepth)?i:10),maxTotalExpansions:Math.max(1,null!=(r=t.maxTotalExpansions)?r:1e3),maxExpandedLength:Math.max(1,null!=(n=t.maxExpandedLength)?n:1e5),maxEntityCount:Math.max(1,null!=(s=t.maxEntityCount)?s:100),allowedTags:null!=(o=t.allowedTags)?o:null,tagFilter:null!=(a=t.tagFilter)?a:null}:A(!0);var e,i,r,n,s,o,a}var O,C=function(t){for(var e=Object.assign({},S,t),i=0,r=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];i<r.length;i++){var n=r[i],s=n.value,o=n.name;s&&P(s,o)}return null===e.onDangerousProperty&&(e.onDangerousProperty=T),e.processEntities=A(e.processEntities),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(function(t){return"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t})),e};O="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");var I=function(){function t(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}var e=t.prototype;return e.add=function(t,e){var i;"__proto__"===t&&(t="#__proto__"),this.child.push(((i={})[t]=e,i))},e.addChild=function(t,e){var i,r;"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push(((i={})[t.tagname]=t.child,i[":@"]=t[":@"],i)):this.child.push(((r={})[t.tagname]=t.child,r)),void 0!==e&&(this.child[this.child.length-1][O]={startIndex:e})},t.getMetaDataSymbol=function(){return O},t}(),j=function(){function t(t){this.suppressValidationErr=!t,this.options=t}var e=t.prototype;return e.readDocType=function(t,e){var i=Object.create(null),r=0;if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");e+=9;for(var n=1,s=!1,o=!1;e<t.length;e++)if("<"!==t[e]||o)if(">"===t[e]){if(o?"-"===t[e-1]&&"-"===t[e-2]&&(o=!1,n--):n--,0===n)break}else"["===t[e]?s=!0:t[e];else{if(s&&$(t,"!ENTITY",e)){e+=7;var a=void 0,h=void 0,l=this.readEntityExp(t,e+1,this.suppressValidationErr);if(a=l[0],h=l[1],e=l[2],-1===h.indexOf("&")){if(!1!==this.options.enabled&&null!=this.options.maxEntityCount&&r>=this.options.maxEntityCount)throw new Error("Entity count ("+(r+1)+") exceeds maximum allowed ("+this.options.maxEntityCount+")");var u=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");i[a]={regx:RegExp("&"+u+";","g"),val:h},r++}}else if(s&&$(t,"!ELEMENT",e))e+=8,e=this.readElementExp(t,e+1).index;else if(s&&$(t,"!ATTLIST",e))e+=8;else if(s&&$(t,"!NOTATION",e))e+=9,e=this.readNotationExp(t,e+1,this.suppressValidationErr).index;else{if(!$(t,"!--",e))throw new Error("Invalid DOCTYPE");o=!0}n++}if(0!==n)throw new Error("Unclosed DOCTYPE");return{entities:i,i:e}},e.readEntityExp=function(t,e){for(var i=e=M(t,e);e<t.length&&!/\s/.test(t[e])&&'"'!==t[e]&&"'"!==t[e];)e++;var r=t.substring(i,e);if(_(r),e=M(t,e),!this.suppressValidationErr){if("SYSTEM"===t.substring(e,e+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[e])throw new Error("Parameter entities are not supported")}var n,s=this.readIdentifierVal(t,e,"entity");if(e=s[0],n=s[1],!1!==this.options.enabled&&null!=this.options.maxEntitySize&&n.length>this.options.maxEntitySize)throw new Error('Entity "'+r+'" size ('+n.length+") exceeds maximum allowed size ("+this.options.maxEntitySize+")");return[r,n,--e]},e.readNotationExp=function(t,e){for(var i=e=M(t,e);e<t.length&&!/\s/.test(t[e]);)e++;var r=t.substring(i,e);!this.suppressValidationErr&&_(r),e=M(t,e);var n=t.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==n&&"PUBLIC"!==n)throw new Error('Expected SYSTEM or PUBLIC, found "'+n+'"');e+=n.length,e=M(t,e);var s=null,o=null;if("PUBLIC"===n){var a=this.readIdentifierVal(t,e,"publicIdentifier");if(e=a[0],s=a[1],'"'===t[e=M(t,e)]||"'"===t[e]){var h=this.readIdentifierVal(t,e,"systemIdentifier");e=h[0],o=h[1]}}else if("SYSTEM"===n){var l=this.readIdentifierVal(t,e,"systemIdentifier");if(e=l[0],o=l[1],!this.suppressValidationErr&&!o)throw new Error("Missing mandatory system identifier for SYSTEM notation")}return{notationName:r,publicIdentifier:s,systemIdentifier:o,index:--e}},e.readIdentifierVal=function(t,e,i){var r,n=t[e];if('"'!==n&&"'"!==n)throw new Error('Expected quoted string, found "'+n+'"');for(var s=++e;e<t.length&&t[e]!==n;)e++;if(r=t.substring(s,e),t[e]!==n)throw new Error("Unterminated "+i+" value");return[++e,r]},e.readElementExp=function(t,e){for(var i=e=M(t,e);e<t.length&&!/\s/.test(t[e]);)e++;var r=t.substring(i,e);if(!this.suppressValidationErr&&!s(r))throw new Error('Invalid element name: "'+r+'"');var n="";if("E"===t[e=M(t,e)]&&$(t,"MPTY",e))e+=4;else if("A"===t[e]&&$(t,"NY",e))e+=2;else if("("===t[e]){for(var o=++e;e<t.length&&")"!==t[e];)e++;if(n=t.substring(o,e),")"!==t[e])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error('Invalid Element Expression, found "'+t[e]+'"');return{elementName:r,contentModel:n.trim(),index:e}},e.readAttlistExp=function(t,e){for(var i=e=M(t,e);e<t.length&&!/\s/.test(t[e]);)e++;var r=t.substring(i,e);for(_(r),i=e=M(t,e);e<t.length&&!/\s/.test(t[e]);)e++;var n=t.substring(i,e);if(!_(n))throw new Error('Invalid attribute name: "'+n+'"');e=M(t,e);var s="";if("NOTATION"===t.substring(e,e+8).toUpperCase()){if(s="NOTATION","("!==t[e=M(t,e+=8)])throw new Error("Expected '(', found \""+t[e]+'"');e++;for(var o=[];e<t.length&&")"!==t[e];){for(var a=e;e<t.length&&"|"!==t[e]&&")"!==t[e];)e++;var h=t.substring(a,e);if(!_(h=h.trim()))throw new Error('Invalid notation name: "'+h+'"');o.push(h),"|"===t[e]&&(e++,e=M(t,e))}if(")"!==t[e])throw new Error("Unterminated list of notations");e++,s+=" ("+o.join("|")+")"}else{for(var l=e;e<t.length&&!/\s/.test(t[e]);)e++;if(s+=t.substring(l,e),!this.suppressValidationErr&&!["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"].includes(s.toUpperCase()))throw new Error('Invalid attribute type: "'+s+'"')}e=M(t,e);var u="";if("#REQUIRED"===t.substring(e,e+8).toUpperCase())u="#REQUIRED",e+=8;else if("#IMPLIED"===t.substring(e,e+7).toUpperCase())u="#IMPLIED",e+=7;else{var p=this.readIdentifierVal(t,e,"ATTLIST");e=p[0],u=p[1]}return{elementName:r,attributeName:n,attributeType:s,defaultValue:u,index:e}},t}(),M=function(t,e){for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function $(t,e,i){for(var r=0;r<e.length;r++)if(e[r]!==t[i+r+1])return!1;return!0}function _(t){if(s(t))return t;throw new Error("Invalid entity name "+t)}const D=/^[-+]?0x[a-fA-F0-9]+$/,V=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,k={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};const F=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}const G=new Set(["push","pop","reset","updateCurrent","restore"]);class R{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[]}push(t,e=null,i=null){this.path.length>0&&(this.path[this.path.length-1].values=void 0);const r=this.path.length;this.siblingStacks[r]||(this.siblingStacks[r]=new Map);const n=this.siblingStacks[r],s=i?`${i}:${t}`:t,o=n.get(s)||0;let a=0;for(const t of n.values())a+=t;n.set(s,o+1);const h={tag:t,position:a,counter:o};null!=i&&(h.namespace=i),null!=e&&(h.values=e),this.path.push(h)}pop(){if(0===this.path.length)return;const t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0===this.path.length)return;const e=this.path[this.path.length-1];return e.values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const i=t||this.separator;return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(i)}toArray(){return this.path.map(t=>t.tag)}reset(){this.path=[],this.siblingStacks=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++){const i=t[e],r=this.path[e],n=e===this.path.length-1;if(!this._matchSegment(i,r,n))return!1}return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,i=t.length-1;for(;i>=0&&e>=0;){const r=t[i];if("deep-wildcard"===r.type){if(i--,i<0)return!0;const r=t[i];let n=!1;for(let t=e;t>=0;t--){const s=t===this.path.length-1;if(this._matchSegment(r,this.path[t],s)){e=t-1,i--,n=!0;break}}if(!n)return!1}else{const t=e===this.path.length-1;if(!this._matchSegment(r,this.path[e],t))return!1;e--,i--}}return i<0}_matchSegment(t,e,i){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!i)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue){const i=e.values[t.attrName];if(String(i)!==String(t.attrValue))return!1}}if(void 0!==t.position){if(!i)return!1;const r=e.counter??0;if("first"===t.position&&0!==r)return!1;if("odd"===t.position&&r%2!=1)return!1;if("even"===t.position&&r%2!=0)return!1;if("nth"===t.position&&r!==t.positionValue)return!1}return!0}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>new Map(t))}}restore(t){this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>new Map(t))}readOnly(){return new Proxy(this,{get(t,e,i){if(G.has(e))return()=>{throw new TypeError(`Cannot call '${e}' on a read-only Matcher. Obtain a writable instance to mutate state.`)};const r=Reflect.get(t,e,i);return"path"===e||"siblingStacks"===e?Object.freeze(Array.isArray(r)?r.map(t=>t instanceof Map?Object.freeze(new Map(t)):Object.freeze({...t})):r):"function"==typeof r?r.bind(t):r},set(t,e){throw new TypeError(`Cannot set property '${String(e)}' on a read-only Matcher.`)},deleteProperty(t,e){throw new TypeError(`Cannot delete property '${String(e)}' from a read-only Matcher.`)}})}}class U{constructor(t,e={}){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let i=0,r="";for(;i<t.length;)t[i]===this.separator?i+1<t.length&&t[i+1]===this.separator?(r.trim()&&(e.push(this._parseSegment(r.trim())),r=""),e.push({type:"deep-wildcard"}),i+=2):(r.trim()&&e.push(this._parseSegment(r.trim())),r="",i++):(r+=t[i],i++);return r.trim()&&e.push(this._parseSegment(r.trim())),e}_parseSegment(t){const e={type:"tag"};let i=null,r=t;const n=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(n&&(r=n[1]+n[3],n[2])){const t=n[2].slice(1,-1);t&&(i=t)}let s,o,a=r;if(r.includes("::")){const e=r.indexOf("::");if(s=r.substring(0,e).trim(),a=r.substring(e+2).trim(),!s)throw new Error(`Invalid namespace in pattern: ${t}`)}let h=null;if(a.includes(":")){const t=a.lastIndexOf(":"),e=a.substring(0,t).trim(),i=a.substring(t+1).trim();["first","last","odd","even"].includes(i)||/^nth\(\d+\)$/.test(i)?(o=e,h=i):o=a}else o=a;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=o,s&&(e.namespace=s),i)if(i.includes("=")){const t=i.indexOf("=");e.attrName=i.substring(0,t).trim(),e.attrValue=i.substring(t+1).trim()}else e.attrName=i.trim();if(h){const t=h.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=h}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}function B(t,e){if(!t)return{};var i=e.attributesGroupName?t[e.attributesGroupName]:t;if(!i)return{};var r={};for(var n in i)n.startsWith(e.attributeNamePrefix)?r[n.substring(e.attributeNamePrefix.length)]=i[n]:r[n]=i[n];return r}function W(t){if(t&&"string"==typeof t){var e=t.indexOf(":");if(-1!==e&&e>0){var i=t.substring(0,e);if("xmlns"!==i)return i}}}var Y=function(t){var e;if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:function(t,e){return ot(e,10,"&#")}},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:function(t,e){return ot(e,16,"&#x")}}},this.addExternalEntities=z,this.parseXml=K,this.parseTextData=X,this.resolveNameSpace=q,this.buildAttributesMap=J,this.isItStopNode=et,this.replaceEntitiesValue=H,this.readStopNodeData=nt,this.saveTextToParentTag=tt,this.addChild=Q,this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?function(t){for(var i,r=function(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return L(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?L(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(i=r()).done;){var n=i.value;if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:function(){return!1},this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new R,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodeExpressions=[];for(var i=0;i<this.options.stopNodes.length;i++){var r=this.options.stopNodes[i];"string"==typeof r?this.stopNodeExpressions.push(new U(r)):r instanceof U&&this.stopNodeExpressions.push(r)}}};function z(t){for(var e=Object.keys(t),i=0;i<e.length;i++){var r=e[i],n=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+n+";","g"),val:t[r]}}}function X(t,e,i,r,n,s,o){if(void 0!==t&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t,e,i));var a=this.options.jPath?i.toString():i,h=this.options.tagValueProcessor(e,t,a,n,s);return null==h?t:typeof h!=typeof t||h!==t?h:this.options.trimValues||t.trim()===t?st(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function q(t){if(this.options.removeNSPrefix){var e=t.split(":"),i="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=i+e[1])}return t}var Z=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function J(t,e,i){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){for(var r=n(t,Z),s=r.length,o={},a={},h=0;h<s;h++){var l=this.resolveNameSpace(r[h][1]),u=r[h][4];if(l.length&&void 0!==u){var p=u;this.options.trimValues&&(p=p.trim()),p=this.replaceEntitiesValue(p,i,this.readonlyMatcher),a[l]=p}}Object.keys(a).length>0&&"object"==typeof e&&e.updateCurrent&&e.updateCurrent(a);for(var d=0;d<s;d++){var f=this.resolveNameSpace(r[d][1]),c=this.options.jPath?e.toString():this.readonlyMatcher;if(!this.ignoreAttributesFn(f,c)){var g=r[d][4],m=this.options.attributeNamePrefix+f;if(f.length)if(this.options.transformAttributeName&&(m=this.options.transformAttributeName(m)),m=ht(m,this.options),void 0!==g){this.options.trimValues&&(g=g.trim()),g=this.replaceEntitiesValue(g,i,this.readonlyMatcher);var x=this.options.jPath?e.toString():this.readonlyMatcher,v=this.options.attributeValueProcessor(f,g,x);o[m]=null==v?g:typeof v!=typeof g||v!==g?v:st(g,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[m]=!0)}}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){var b={};return b[this.options.attributesGroupName]=o,b}return o}}var K=function(t){t=t.replace(/\r\n?/g,"\n");var e=new I("!xml"),i=e,r="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;for(var n=new j(this.options.processEntities),s=0;s<t.length;s++)if("<"===t[s])if("/"===t[s+1]){var o=it(t,">",s,"Closing Tag is not closed."),a=t.substring(s+2,o).trim();if(this.options.removeNSPrefix){var h=a.indexOf(":");-1!==h&&(a=a.substr(h+1))}a=at(this.options.transformTagName,a,"",this.options).tagName,i&&(r=this.saveTextToParentTag(r,i,this.readonlyMatcher));var l=this.matcher.getCurrentTag();if(a&&-1!==this.options.unpairedTags.indexOf(a))throw new Error("Unpaired tag can not be used as closing tag: </"+a+">");l&&-1!==this.options.unpairedTags.indexOf(l)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,i=this.tagsNodeStack.pop(),r="",s=o}else if("?"===t[s+1]){var u=rt(t,s,!1,"?>");if(!u)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,i,this.readonlyMatcher),this.options.ignoreDeclaration&&"?xml"===u.tagName||this.options.ignorePiTags);else{var p=new I(u.tagName);p.add(this.options.textNodeName,""),u.tagName!==u.tagExp&&u.attrExpPresent&&(p[":@"]=this.buildAttributesMap(u.tagExp,this.matcher,u.tagName)),this.addChild(i,p,this.readonlyMatcher,s)}s=u.closeIndex+1}else if("!--"===t.substr(s+1,3)){var d=it(t,"--\x3e",s+4,"Comment is not closed.");if(this.options.commentPropName){var f,c=t.substring(s+4,d-2);r=this.saveTextToParentTag(r,i,this.readonlyMatcher),i.add(this.options.commentPropName,[(f={},f[this.options.textNodeName]=c,f)])}s=d}else if("!D"===t.substr(s+1,2)){var g=n.readDocType(t,s);this.docTypeEntities=g.entities,s=g.i}else if("!["===t.substr(s+1,2)){var m=it(t,"]]>",s,"CDATA is not closed.")-2,x=t.substring(s+9,m);r=this.saveTextToParentTag(r,i,this.readonlyMatcher);var v,b=this.parseTextData(x,i.tagname,this.readonlyMatcher,!0,!1,!0,!0);null==b&&(b=""),this.options.cdataPropName?i.add(this.options.cdataPropName,[(v={},v[this.options.textNodeName]=x,v)]):i.add(this.options.textNodeName,b),s=m+2}else{var N=rt(t,s,this.options.removeNSPrefix);if(!N){var y=t.substring(Math.max(0,s-50),Math.min(t.length,s+50));throw new Error("readTagExp returned undefined at position "+s+'. Context: "'+y+'"')}var E=N.tagName,w=N.rawTagName,T=N.tagExp,S=N.attrExpPresent,P=N.closeIndex,A=at(this.options.transformTagName,E,T,this.options);if(E=A.tagName,T=A.tagExp,this.options.strictReservedNames&&(E===this.options.commentPropName||E===this.options.cdataPropName||E===this.options.textNodeName||E===this.options.attributesGroupName))throw new Error("Invalid tag name: "+E);i&&r&&"!xml"!==i.tagname&&(r=this.saveTextToParentTag(r,i,this.readonlyMatcher,!1));var O=i;O&&-1!==this.options.unpairedTags.indexOf(O.tagname)&&(i=this.tagsNodeStack.pop(),this.matcher.pop());var C=!1;T.length>0&&T.lastIndexOf("/")===T.length-1&&(C=!0,T="/"===E[E.length-1]?E=E.substr(0,E.length-1):T.substr(0,T.length-1),S=E!==T);var M,$=null;M=W(w),E!==e.tagname&&this.matcher.push(E,{},M),E!==T&&S&&($=this.buildAttributesMap(T,this.matcher,E))&&B($,this.options),E!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));var _=s;if(this.isCurrentNodeStopNode){var D="";if(C)s=N.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(E))s=N.closeIndex;else{var V=this.readStopNodeData(t,w,P+1);if(!V)throw new Error("Unexpected end of "+w);s=V.i,D=V.tagContent}var k=new I(E);$&&(k[":@"]=$),k.add(this.options.textNodeName,D),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(i,k,this.readonlyMatcher,_)}else{if(C){var F=at(this.options.transformTagName,E,T,this.options);E=F.tagName,T=F.tagExp;var L=new I(E);$&&(L[":@"]=$),this.addChild(i,L,this.readonlyMatcher,_),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(-1!==this.options.unpairedTags.indexOf(E)){var G=new I(E);$&&(G[":@"]=$),this.addChild(i,G,this.readonlyMatcher,_),this.matcher.pop(),this.isCurrentNodeStopNode=!1,s=N.closeIndex;continue}var R=new I(E);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(i),$&&(R[":@"]=$),this.addChild(i,R,this.readonlyMatcher,_),i=R}r="",s=P}}else r+=t[s];return e.child};function Q(t,e,i,r){this.options.captureMetaData||(r=void 0);var n=this.options.jPath?i.toString():i,s=this.options.updateTag(e.tagname,n,e[":@"]);!1===s||("string"==typeof s?(e.tagname=s,t.addChild(e,r)):t.addChild(e,r))}function H(t,e,i){var r=this.options.processEntities;if(!r||!r.enabled)return t;if(r.allowedTags){var n=this.options.jPath?i.toString():i;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(e):r.allowedTags(e,n)))return t}if(r.tagFilter){var s=this.options.jPath?i.toString():i;if(!r.tagFilter(e,s))return t}for(var o=0,a=Object.keys(this.docTypeEntities);o<a.length;o++){var h=a[o],l=this.docTypeEntities[h],u=t.match(l.regx);if(u){if(this.entityExpansionCount+=u.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw new Error("Entity expansion limit exceeded: "+this.entityExpansionCount+" > "+r.maxTotalExpansions);var p=t.length;if(t=t.replace(l.regx,l.val),r.maxExpandedLength&&(this.currentExpandedLength+=t.length-p,this.currentExpandedLength>r.maxExpandedLength))throw new Error("Total expanded content size exceeded: "+this.currentExpandedLength+" > "+r.maxExpandedLength)}}for(var d=0,f=Object.keys(this.lastEntities);d<f.length;d++){var c=f[d],g=this.lastEntities[c],m=t.match(g.regex);if(m&&(this.entityExpansionCount+=m.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error("Entity expansion limit exceeded: "+this.entityExpansionCount+" > "+r.maxTotalExpansions);t=t.replace(g.regex,g.val)}if(-1===t.indexOf("&"))return t;if(this.options.htmlEntities)for(var x=0,v=Object.keys(this.htmlEntities);x<v.length;x++){var b=v[x],N=this.htmlEntities[b],y=t.match(N.regex);if(y&&(this.entityExpansionCount+=y.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error("Entity expansion limit exceeded: "+this.entityExpansionCount+" > "+r.maxTotalExpansions);t=t.replace(N.regex,N.val)}return t.replace(this.ampEntity.regex,this.ampEntity.val)}function tt(t,e,i,r){return t&&(void 0===r&&(r=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,i,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,r))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function et(t,e){if(!t||0===t.length)return!1;for(var i=0;i<t.length;i++)if(e.matches(t[i]))return!0;return!1}function it(t,e,i,r){var n=t.indexOf(e,i);if(-1===n)throw new Error(r);return n+e.length-1}function rt(t,e,i,r){void 0===r&&(r=">");var n=function(t,e,i){var r;void 0===i&&(i=">");for(var n="",s=e;s<t.length;s++){var o=t[s];if(r)o===r&&(r="");else if('"'===o||"'"===o)r=o;else if(o===i[0]){if(!i[1])return{data:n,index:s};if(t[s+1]===i[1])return{data:n,index:s}}else"\t"===o&&(o=" ");n+=o}}(t,e+1,r);if(n){var s=n.data,o=n.index,a=s.search(/\s/),h=s,l=!0;-1!==a&&(h=s.substring(0,a),s=s.substring(a+1).trimStart());var u=h;if(i){var p=h.indexOf(":");-1!==p&&(l=(h=h.substr(p+1))!==n.data.substr(p+1))}return{tagName:h,tagExp:s,closeIndex:o,attrExpPresent:l,rawTagName:u}}}function nt(t,e,i){for(var r=i,n=1;i<t.length;i++)if("<"===t[i])if("/"===t[i+1]){var s=it(t,">",i,e+" is not closed");if(t.substring(i+2,s).trim()===e&&0===--n)return{tagContent:t.substring(r,i),i:s};i=s}else if("?"===t[i+1])i=it(t,"?>",i+1,"StopNode is not closed.");else if("!--"===t.substr(i+1,3))i=it(t,"--\x3e",i+3,"StopNode is not closed.");else if("!["===t.substr(i+1,2))i=it(t,"]]>",i,"StopNode is not closed.")-2;else{var o=rt(t,i,">");o&&((o&&o.tagName)===e&&"/"!==o.tagExp[o.tagExp.length-1]&&n++,i=o.closeIndex)}}function st(t,e,i){if(e&&"string"==typeof t){var r=t.trim();return"true"===r||"false"!==r&&function(t,e={}){if(e=Object.assign({},k,e),!t||"string"!=typeof t)return t;let i=t.trim();if(void 0!==e.skipLike&&e.skipLike.test(i))return t;if("0"===t)return 0;if(e.hex&&D.test(i))return function(t){if(parseInt)return parseInt(t,16);if(Number.parseInt)return Number.parseInt(t,16);if(window&&window.parseInt)return window.parseInt(t,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(i);if(isFinite(i)){if(i.includes("e")||i.includes("E"))return function(t,e,i){if(!i.eNotation)return t;const r=e.match(F);if(r){let n=r[1]||"";const s=-1===r[3].indexOf("e")?"E":"e",o=r[2],a=n?t[o.length+1]===s:t[o.length]===s;return o.length>1&&a?t:(1!==o.length||!r[3].startsWith(`.${s}`)&&r[3][0]!==s)&&o.length>0?i.leadingZeros&&!a?(e=(r[1]||"")+r[3],Number(e)):t:Number(e)}return t}(t,i,e);{const n=V.exec(i);if(n){const s=n[1]||"",o=n[2];let a=(r=n[3])&&-1!==r.indexOf(".")?("."===(r=r.replace(/0+$/,""))?r="0":"."===r[0]?r="0"+r:"."===r[r.length-1]&&(r=r.substring(0,r.length-1)),r):r;const h=s?"."===t[o.length+1]:"."===t[o.length];if(!e.leadingZeros&&(o.length>1||1===o.length&&!h))return t;{const r=Number(i),n=String(r);if(0===r)return r;if(-1!==n.search(/[eE]/))return e.eNotation?r:t;if(-1!==i.indexOf("."))return"0"===n||n===a||n===`${s}${a}`?r:t;let h=o?a:i;return o?h===n||s+h===n?r:t:h===n||h===s+n?r:t}}return t}}var r;return function(t,e,i){const r=e===1/0;switch(i.infinity.toLowerCase()){case"null":return null;case"infinity":return e;case"string":return r?"Infinity":"-Infinity";default:return t}}(t,Number(i),e)}(t,i)}return void 0!==t?t:""}function ot(t,e,i){var r=Number.parseInt(t,e);return r>=0&&r<=1114111?String.fromCodePoint(r):i+t+";"}function at(t,e,i,r){if(t){var n=t(e);i===e&&(i=n),e=n}return{tagName:e=ht(e,r),tagExp:i}}function ht(t,e){if(a.includes(t))throw new Error('[SECURITY] Invalid name: "'+t+'" is a reserved JavaScript keyword that could cause prototype pollution');return o.includes(t)?e.onDangerousProperty(t):t}var lt=I.getMetaDataSymbol();function ut(t,e){if(!t||"object"!=typeof t)return{};if(!e)return t;var i={};for(var r in t)r.startsWith(e)?i[r.substring(e.length)]=t[r]:i[r]=t[r];return i}function pt(t,e,i,r){return dt(t,e,i,r)}function dt(t,e,i,r){for(var n,s={},o=0;o<t.length;o++){var a=t[o],h=ft(a);if(void 0!==h&&h!==e.textNodeName){var l=ut(a[":@"]||{},e.attributeNamePrefix);i.push(h,l)}if(h===e.textNodeName)void 0===n?n=a[h]:n+=""+a[h];else{if(void 0===h)continue;if(a[h]){var u=dt(a[h],e,i,r),p=gt(u,e);if(a[":@"]?ct(u,a[":@"],r,e):1!==Object.keys(u).length||void 0===u[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(u).length&&(e.alwaysCreateTextNode?u[e.textNodeName]="":u=""):u=u[e.textNodeName],void 0!==a[lt]&&"object"==typeof u&&null!==u&&(u[lt]=a[lt]),void 0!==s[h]&&Object.prototype.hasOwnProperty.call(s,h))Array.isArray(s[h])||(s[h]=[s[h]]),s[h].push(u);else{var d=e.jPath?r.toString():r;e.isArray(h,d,p)?s[h]=[u]:s[h]=u}void 0!==h&&h!==e.textNodeName&&i.pop()}}}return"string"==typeof n?n.length>0&&(s[e.textNodeName]=n):void 0!==n&&(s[e.textNodeName]=n),s}function ft(t){for(var e=Object.keys(t),i=0;i<e.length;i++){var r=e[i];if(":@"!==r)return r}}function ct(t,e,i,r){if(e)for(var n=Object.keys(e),s=n.length,o=0;o<s;o++){var a=n[o],h=a.startsWith(r.attributeNamePrefix)?a.substring(r.attributeNamePrefix.length):a,l=r.jPath?i.toString()+"."+h:i;r.isArray(a,l,!0,!0)?t[a]=[e[a]]:t[a]=e[a]}}function gt(t,e){var i=e.textNodeName,r=Object.keys(t).length;return 0===r||!(1!==r||!t[i]&&"boolean"!=typeof t[i]&&0!==t[i])}var mt=function(){function t(t){this.externalEntities={},this.options=C(t)}var e=t.prototype;return e.parse=function(t,e){if("string"!=typeof t&&t.toString)t=t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(e){!0===e&&(e={});var i=l(t,e);if(!0!==i)throw Error(i.err.msg+":"+i.err.line+":"+i.err.col)}var r=new Y(this.options);r.addExternalEntities(this.externalEntities);var n=r.parseXml(t);return this.options.preserveOrder||void 0===n?n:pt(n,this.options,r.matcher,r.readonlyMatcher)},e.addEntity=function(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e},t.getMetaDataSymbol=function(){return I.getMetaDataSymbol()},t}();function xt(t,e){let i="";e.format&&e.indentBy.length>0&&(i="\n");const r=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let t=0;t<e.stopNodes.length;t++){const i=e.stopNodes[t];"string"==typeof i?r.push(new U(i)):i instanceof U&&r.push(i)}return vt(t,e,i,new R,r)}function vt(t,e,i,r,n){let s="",o=!1;if(e.maxNestedTags&&r.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(null!=t){let i=t.toString();return i=St(i,e),i}return""}for(let a=0;a<t.length;a++){const h=t[a],l=Et(h);if(void 0===l)continue;const u=bt(h[":@"],e);r.push(l,u);const p=Tt(r,n);if(l===e.textNodeName){let t=h[l];p||(t=e.tagValueProcessor(l,t),t=St(t,e)),o&&(s+=i),s+=t,o=!1,r.pop();continue}if(l===e.cdataPropName){o&&(s+=i),s+=`<![CDATA[${h[l][0][e.textNodeName]}]]>`,o=!1,r.pop();continue}if(l===e.commentPropName){s+=i+`\x3c!--${h[l][0][e.textNodeName]}--\x3e`,o=!0,r.pop();continue}if("?"===l[0]){const t=wt(h[":@"],e,p),n="?xml"===l?"":i;let a=h[l][0][e.textNodeName];a=0!==a.length?" "+a:"",s+=n+`<${l}${a}${t}?>`,o=!0,r.pop();continue}let d=i;""!==d&&(d+=e.indentBy);const f=i+`<${l}${wt(h[":@"],e,p)}`;let c;c=p?Nt(h[l],e):vt(h[l],e,d,r,n),-1!==e.unpairedTags.indexOf(l)?e.suppressUnpairedNode?s+=f+">":s+=f+"/>":c&&0!==c.length||!e.suppressEmptyNode?c&&c.endsWith(">")?s+=f+`>${c}${i}</${l}>`:(s+=f+">",c&&""!==i&&(c.includes("/>")||c.includes("</"))?s+=i+e.indentBy+c+i:s+=c,s+=`</${l}>`):s+=f+"/>",o=!0,r.pop()}return s}function bt(t,e){if(!t||e.ignoreAttributes)return null;const i={};let r=!1;for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n.startsWith(e.attributeNamePrefix)?n.substr(e.attributeNamePrefix.length):n]=t[n],r=!0);return r?i:null}function Nt(t,e){if(!Array.isArray(t))return null!=t?t.toString():"";let i="";for(let r=0;r<t.length;r++){const n=t[r],s=Et(n);if(s===e.textNodeName)i+=n[s];else if(s===e.cdataPropName)i+=n[s][0][e.textNodeName];else if(s===e.commentPropName)i+=n[s][0][e.textNodeName];else{if(s&&"?"===s[0])continue;if(s){const t=yt(n[":@"],e),r=Nt(n[s],e);r&&0!==r.length?i+=`<${s}${t}>${r}</${s}>`:i+=`<${s}${t}/>`}}}return i}function yt(t,e){let i="";if(t&&!e.ignoreAttributes)for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;let n=t[r];!0===n&&e.suppressBooleanAttributes?i+=` ${r.substr(e.attributeNamePrefix.length)}`:i+=` ${r.substr(e.attributeNamePrefix.length)}="${n}"`}return i}function Et(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const r=e[i];if(Object.prototype.hasOwnProperty.call(t,r)&&":@"!==r)return r}}function wt(t,e,i){let r="";if(t&&!e.ignoreAttributes)for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s;i?s=t[n]:(s=e.attributeValueProcessor(n,t[n]),s=St(s,e)),!0===s&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${s}"`}return r}function Tt(t,e){if(!e||0===e.length)return!1;for(let i=0;i<e.length;i++)if(t.matches(e[i]))return!0;return!1}function St(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const r=e.entities[i];t=t.replace(r.regex,r.val)}return t}const Pt={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0};function At(t){if(this.options=Object.assign({},Pt,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new U(e)):e instanceof U&&this.stopNodeExpressions.push(e)}var e;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=It),this.processTextOrObjNode=Ot,this.options.format?(this.indentate=Ct,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function Ot(t,e,i,r){const n=this.extractAttributes(t);if(r.push(e,n),this.checkStopNode(r)){const n=this.buildRawContent(t),s=this.buildAttributesForStopNode(t);return r.pop(),this.buildObjectNode(n,e,s,i)}const s=this.j2x(t,i+1,r);return r.pop(),void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,s.attrStr,i,r):this.buildObjectNode(s.val,e,s.attrStr,i)}function Ct(t){return this.options.indentBy.repeat(t)}function It(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}At.prototype.build=function(t){if(this.options.preserveOrder)return xt(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new R;return this.j2x(t,0,e).val}},At.prototype.j2x=function(t,e,i){let r="",n="";if(this.options.maxNestedTags&&i.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const s=this.options.jPath?i.toString():i,o=this.checkStopNode(i);for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(void 0===t[a])this.isAttribute(a)&&(n+="");else if(null===t[a])this.isAttribute(a)||a===this.options.cdataPropName?n+="":"?"===a[0]?n+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)n+=this.buildTextValNode(t[a],a,"",e,i);else if("object"!=typeof t[a]){const h=this.isAttribute(a);if(h&&!this.ignoreAttributesFn(h,s))r+=this.buildAttrPairStr(h,""+t[a],o);else if(!h)if(a===this.options.textNodeName){let e=this.options.tagValueProcessor(a,""+t[a]);n+=this.replaceEntitiesValue(e)}else{i.push(a);const r=this.checkStopNode(i);if(i.pop(),r){const i=""+t[a];n+=""===i?this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:this.indentate(e)+"<"+a+">"+i+"</"+a+this.tagEndChar}else n+=this.buildTextValNode(t[a],a,"",e,i)}}else if(Array.isArray(t[a])){const r=t[a].length;let s="",o="";for(let h=0;h<r;h++){const r=t[a][h];if(void 0===r);else if(null===r)"?"===a[0]?n+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if("object"==typeof r)if(this.options.oneListGroup){i.push(a);const t=this.j2x(r,e+1,i);i.pop(),s+=t.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(o+=t.attrStr)}else s+=this.processTextOrObjNode(r,a,e,i);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(a,r);t=this.replaceEntitiesValue(t),s+=t}else{i.push(a);const t=this.checkStopNode(i);if(i.pop(),t){const t=""+r;s+=""===t?this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:this.indentate(e)+"<"+a+">"+t+"</"+a+this.tagEndChar}else s+=this.buildTextValNode(r,a,"",e,i)}}this.options.oneListGroup&&(s=this.buildObjectNode(s,a,o,e)),n+=s}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const e=Object.keys(t[a]),i=e.length;for(let n=0;n<i;n++)r+=this.buildAttrPairStr(e[n],""+t[a][e[n]],o)}else n+=this.processTextOrObjNode(t[a],a,e,i);return{attrStr:r,val:n}},At.prototype.buildAttrPairStr=function(t,e,i){return i||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},At.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const e={};let i=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const r=t[this.options.attributesGroupName];for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=r[t],i=!0)}else for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const n=this.isAttribute(r);n&&(e[n]=t[r],i=!0)}return i?e:null},At.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let e="";for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(this.isAttribute(i))continue;if(this.options.attributesGroupName&&i===this.options.attributesGroupName)continue;const r=t[i];if(i===this.options.textNodeName)e+=r;else if(Array.isArray(r)){for(let t of r)if("string"==typeof t||"number"==typeof t)e+=`<${i}>${t}</${i}>`;else if("object"==typeof t&&null!==t){const r=this.buildRawContent(t),n=this.buildAttributesForStopNode(t);e+=""===r?`<${i}${n}/>`:`<${i}${n}>${r}</${i}>`}}else if("object"==typeof r&&null!==r){const t=this.buildRawContent(r),n=this.buildAttributesForStopNode(r);e+=""===t?`<${i}${n}/>`:`<${i}${n}>${t}</${i}>`}else e+=`<${i}>${r}</${i}>`}return e},At.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const i=t[this.options.attributesGroupName];for(let t in i){if(!Object.prototype.hasOwnProperty.call(i,t))continue;const r=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,n=i[t];!0===n&&this.options.suppressBooleanAttributes?e+=" "+r:e+=" "+r+'="'+n+'"'}}else for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const r=this.isAttribute(i);if(r){const n=t[i];!0===n&&this.options.suppressBooleanAttributes?e+=" "+r:e+=" "+r+'="'+n+'"'}}return e},At.prototype.buildObjectNode=function(t,e,i,r){if(""===t)return"?"===e[0]?this.indentate(r)+"<"+e+i+"?"+this.tagEndChar:this.indentate(r)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let n="</"+e+this.tagEndChar,s="";return"?"===e[0]&&(s="?",n=""),!i&&""!==i||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===s.length?this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(r)+"<"+e+i+s+this.tagEndChar+t+this.indentate(r)+n:this.indentate(r)+"<"+e+i+s+">"+t+n}},At.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},At.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},At.prototype.buildTextValNode=function(t,e,i,r,n){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(r)+"<"+e+i+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),""===n?this.indentate(r)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+i+">"+n+"</"+e+this.tagEndChar}},At.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t};const jt=At;var Mt={validate:l};return e})());
|
|
2
2
|
//# sourceMappingURL=fxp.min.js.map
|