xslt-processor 1.1.3 → 1.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xslt-processor",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "A JavaScript XSLT Processor",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -1,4 +1,4 @@
1
- import { XNode } from "../dom";
1
+ import { XNode } from '../dom';
2
2
  export declare class ExprContext {
3
3
  position: number;
4
4
  nodelist: XNode[];
@@ -12,7 +12,7 @@ export declare class ExprContext {
12
12
  constructor(nodelist: any[], opt_position?: number, opt_parent?: any, opt_caseInsensitive?: any, opt_ignoreAttributesWithoutValue?: any, opt_returnOnFirstMatch?: any, opt_ignoreNonElementNodesForNTA?: any);
13
13
  clone(opt_nodelist?: any[], opt_position?: any): ExprContext;
14
14
  setVariable(name?: any, value?: any): void;
15
- getVariable(name: any): any;
15
+ getVariable(name: string): any;
16
16
  setNode(position: number): void;
17
17
  contextSize(): number;
18
18
  isCaseInsensitive(): any;
@@ -1,2 +1,3 @@
1
1
  export * from './xslt-options';
2
+ export * from './xslt-parameter';
2
3
  export * from './xslt';
@@ -1,3 +1,5 @@
1
+ import { XsltParameter } from "./xslt-parameter";
1
2
  export type XsltOptions = {
2
3
  escape: boolean;
4
+ parameters?: XsltParameter[];
3
5
  };
@@ -0,0 +1,5 @@
1
+ export type XsltParameter = {
2
+ name: string;
3
+ namespaceUri?: string;
4
+ value: any;
5
+ };
@@ -1,6 +1,7 @@
1
1
  import { XDocument, XNode } from '../dom';
2
2
  import { ExprContext, XPath } from '../xpath';
3
3
  import { XsltOptions } from './xslt-options';
4
+ import { XsltParameter } from './xslt-parameter';
4
5
  /**
5
6
  * The main class for XSL-T processing. The implementation is NOT
6
7
  * complete; some xsl element are left out.
@@ -38,7 +39,7 @@ export declare class Xslt {
38
39
  * @param parameters Additional parameters to be set as variables.
39
40
  * @returns the processed document, as XML text in a string.
40
41
  */
41
- xsltProcess(xmlDoc: XDocument, stylesheet: XDocument, parameters?: any): string;
42
+ xsltProcess(xmlDoc: XDocument, stylesheet: XDocument, parameters?: XsltParameter[]): string;
42
43
  /**
43
44
  * The main entry point of the XSL-T processor, as explained on the top of the file.
44
45
  * @param context The input document root, as XPath ExprContext.
@@ -46,9 +47,7 @@ export declare class Xslt {
46
47
  * @param output the root of the generated output, as DOM node.
47
48
  * @param _parameters Extra parameters.
48
49
  */
49
- protected xsltProcessContext(context: ExprContext, template: XNode, output: XNode, _parameters?: {
50
- [key: string]: any;
51
- }): void;
50
+ protected xsltProcessContext(context: ExprContext, template: XNode, output: XNode, _parameters: XsltParameter[]): void;
52
51
  /**
53
52
  * Implements `xsl:copy` for all node types.
54
53
  * @param {XNode} destination the node being copied to, part of output document
@@ -76,17 +75,24 @@ export declare class Xslt {
76
75
  * @param override flag that defines if the value computed here
77
76
  * overrides the one already in the input context if that is the
78
77
  * case. I.e. decides if this is a default value or a local
79
- * value. xsl:variable and xsl:with-param override; xsl:param doesn't.
78
+ * value. `xsl:variable` and `xsl:with-param` override; `xsl:param` doesn't.
80
79
  */
81
- protected xsltVariable(input: ExprContext, template: any, override: boolean): void;
82
- protected xsltChoose(input: any, template: any, output: any): void;
80
+ protected xsltVariable(input: ExprContext, template: any, override: boolean, _parameters: XsltParameter[]): void;
81
+ /**
82
+ * Implements xsl:choose and its child nodes xsl:when and
83
+ * xsl:otherwise.
84
+ * @param input The Expression Context.
85
+ * @param template The template.
86
+ * @param output The output.
87
+ */
88
+ protected xsltChoose(input: ExprContext, template: any, output: any, _parameters: XsltParameter[]): void;
83
89
  /**
84
90
  * Implements `xsl:for-each`.
85
- * @param context TODO
86
- * @param template TODO
87
- * @param output TODO
91
+ * @param input The Expression Context.
92
+ * @param template The template.
93
+ * @param output The output.
88
94
  */
89
- protected xsltForEach(context: ExprContext, template: XNode, output: XNode): void;
95
+ protected xsltForEach(context: ExprContext, template: XNode, output: XNode, _parameters: XsltParameter[]): void;
90
96
  protected groupBy(xs: any, key: any): any;
91
97
  /**
92
98
  * Traverses the template node tree. Calls the main processing
@@ -96,7 +102,7 @@ export declare class Xslt {
96
102
  * @param template The XSL-T definition.
97
103
  * @param output The XML output.
98
104
  */
99
- protected xsltChildNodes(context: ExprContext, template: any, output: XNode): void;
105
+ protected xsltChildNodes(context: ExprContext, template: any, output: XNode, _parameters: XsltParameter[]): void;
100
106
  /**
101
107
  * Passes template text to the output. The current template node does
102
108
  * not specify an XSL-T operation and therefore is appended to the
@@ -107,7 +113,7 @@ export declare class Xslt {
107
113
  * @param output The output.
108
114
  * @param outputDocument The output document, if the case.
109
115
  */
110
- protected xsltPassThrough(context: ExprContext, template: any, output: XNode, outputDocument: XDocument): void;
116
+ protected xsltPassThrough(context: ExprContext, template: any, output: XNode, outputDocument: XDocument, _parameters?: XsltParameter[]): void;
111
117
  /**
112
118
  * Determines if a text node in the XSLT template document is to be
113
119
  * stripped according to XSLT whitespace stripping rules.
@@ -155,7 +161,7 @@ export declare class Xslt {
155
161
  * @param input TODO
156
162
  * @param template TODO
157
163
  */
158
- protected xsltWithParam(input: any, template: any): void;
164
+ protected xsltWithParam(input: ExprContext, template: any, _parameters: XsltParameter[]): void;
159
165
  private absoluteXsltMatch;
160
166
  private relativeXsltMatch;
161
167
  protected isXsltElement(element: any, opt_wantedName?: string): boolean;
@@ -12,5 +12,5 @@
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */function h(e,r){function t(){this.constructor=e}p(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}var d=function(){function e(e){this.value=e,this.type="number"}return e.prototype.stringValue=function(){return"".concat(this.value)},e.prototype.booleanValue=function(){return!!this.value},e.prototype.numberValue=function(){return this.value-0},e.prototype.nodeSetValue=function(){throw this},e}(),f=function(){},g=function(e){function r(r,t,a){var n=e.call(this)||this;return n.expr1=r,n.expr2=a,n.op=t,n}return h(r,e),r.prototype.evaluate=function(e){var r;switch(this.op.value){case"or":r=new l(this.expr1.evaluate(e).booleanValue()||this.expr2.evaluate(e).booleanValue());break;case"and":r=new l(this.expr1.evaluate(e).booleanValue()&&this.expr2.evaluate(e).booleanValue());break;case"+":r=new d(this.expr1.evaluate(e).numberValue()+this.expr2.evaluate(e).numberValue());break;case"-":r=new d(this.expr1.evaluate(e).numberValue()-this.expr2.evaluate(e).numberValue());break;case"*":r=new d(this.expr1.evaluate(e).numberValue()*this.expr2.evaluate(e).numberValue());break;case"mod":r=new d(this.expr1.evaluate(e).numberValue()%this.expr2.evaluate(e).numberValue());break;case"div":r=new d(this.expr1.evaluate(e).numberValue()/this.expr2.evaluate(e).numberValue());break;case"=":r=this.compare(e,(function(e,r){return e==r}));break;case"!=":r=this.compare(e,(function(e,r){return e!=r}));break;case"<":r=this.compare(e,(function(e,r){return e<r}));break;case"<=":r=this.compare(e,(function(e,r){return e<=r}));break;case">":r=this.compare(e,(function(e,r){return e>r}));break;case">=":r=this.compare(e,(function(e,r){return e>=r}));break;default:throw"BinaryExpr.evaluate: ".concat(this.op.value)}return r},r.prototype.compare=function(e,r){var t,a=this.expr1.evaluate(e),n=this.expr2.evaluate(e);if("node-set"==a.type&&"node-set"==n.type){var o=a.nodeSetValue(),i=n.nodeSetValue();t=!1;for(var s=0;s<o.length;++s)for(var u=0;u<i.length;++u)r(hr(o[s]),hr(i[u]))&&(t=!0,u=i.length,s=o.length)}else if("node-set"==a.type||"node-set"==n.type)if("number"==a.type){var c=a.numberValue(),p=n.nodeSetValue();t=!1;for(var h=0;h<p.length;++h){if(r(c,hr(p[h])-0)){t=!0;break}}}else if("number"==n.type){p=a.nodeSetValue(),c=n.numberValue();t=!1;for(h=0;h<p.length;++h){if(r(hr(p[h])-0,c)){t=!0;break}}}else if("string"==a.type){c=a.stringValue(),p=n.nodeSetValue();t=!1;for(h=0;h<p.length;++h){if(r(c,hr(p[h]))){t=!0;break}}}else if("string"==n.type){p=a.nodeSetValue(),c=n.stringValue();t=!1;for(h=0;h<p.length;++h){if(r(hr(p[h]),c)){t=!0;break}}}else t=r(a.booleanValue(),n.booleanValue());else t="boolean"==a.type||"boolean"==n.type?r(a.booleanValue(),n.booleanValue()):"number"==a.type||"number"==n.type?r(a.numberValue(),n.numberValue()):r(a.stringValue(),n.stringValue());return new l(t)},r}(f),m=function(e){function r(r,t){var a=e.call(this)||this;return a.expr=r,a.predicate=t,a}return h(r,e),r.prototype.evaluate=function(e){var r=e.returnOnFirstMatch;e.setReturnOnFirstMatch(!1);var t=this.expr.evaluate(e).nodeSetValue();e.setReturnOnFirstMatch(r);for(var a=0;a<this.predicate.length;++a){var n=t;t=[];for(var o=0;o<n.length;++o){var i=n[o];this.predicate[a].evaluate(e.clone(n,o)).booleanValue()&&t.push(i)}}return new yr(t)},r}(f),b=function(){function e(e){this.value=e,this.type="string"}return e.prototype.stringValue=function(){return this.value},e.prototype.booleanValue=function(){return this.value.length>0},e.prototype.numberValue=function(){return this.value-0},e.prototype.nodeSetValue=function(){throw this},e}(),v=function(e){function r(r){var t=e.call(this)||this;return t.xpathfunctions={last:function(e){return He(0==this.args.length),new d(e.contextSize())},position:function(e){return He(0==this.args.length),new d(e.position+1)},count:function(e){He(1==this.args.length);var r=this.args[0].evaluate(e);return new d(r.nodeSetValue().length)},"generate-id":function(e){return new b("A"+this.cyrb53(JSON.stringify(e.nodelist[e.position].id)))},id:function(e){He(1==this.args.length);var r,t=this.args[0].evaluate(e),a=[];if("node-set"==t.type){r=[];for(var n=t.nodeSetValue(),o=0;o<n.length;++o)for(var i=hr(n[o]).split(/\s+/),s=0;s<i.length;++s)r.push(i[s])}else r=t.stringValue().split(/\s+/);var l=e.root;for(o=0;o<r.length;++o){var u=l.getElementById(r[o]);u&&a.push(u)}return new yr(a)},"xml-to-json":function(e){return He(this.args.length<2),new b(JSON.stringify(this.args.length?hr(e.nodelist[e.position]):"null"))},"local-name":function(e){var r;return He(1==this.args.length||0==this.args.length),0==(r=0==this.args.length?[e.nodelist[e.position]]:this.args[0].evaluate(e).nodeSetValue()).length?new b(""):new b(r[0].localName)},"namespace-uri":function(e){var r;return He(1==this.args.length||0==this.args.length),0==(r=0==this.args.length?[e.nodelist[e.position]]:this.args[0].evaluate(e).nodeSetValue()).length?new b(""):new b(r[0].namespaceURI||"")},name:function(e){var r;return He(1==this.args.length||0==this.args.length),0==(r=0==this.args.length?[e.nodelist[e.position]]:this.args[0].evaluate(e).nodeSetValue()).length?new b(""):new b(r[0].nodeName)},string:function(e){return He(1==this.args.length||0==this.args.length),0==this.args.length?new b(new yr([e.nodelist[e.position]]).stringValue()):new b(this.args[0].evaluate(e).stringValue())},concat:function(e){for(var r="",t=0;t<this.args.length;++t)r+=this.args[t].evaluate(e).stringValue();return new b(r)},"starts-with":function(e){He(2==this.args.length);var r=this.args[0].evaluate(e).stringValue(),t=this.args[1].evaluate(e).stringValue();return new l(0==r.indexOf(t))},"ends-with":function(e){He(2==this.args.length);var r=this.args[0].evaluate(e).stringValue(),t=this.args[1].evaluate(e).stringValue(),a=new RegExp("".concat(t.replace(_e,"\\$1"),"$"));return new l(a.test(r))},contains:function(e){He(2==this.args.length);var r=this.args[0].evaluate(e).stringValue(),t=this.args[1].evaluate(e).stringValue();return new l(r.includes(t))},"substring-before":function(e){He(2==this.args.length);var r,t=this.args[0].evaluate(e).stringValue(),a=this.args[1].evaluate(e).stringValue(),n=t.indexOf(a);return r=-1==n?"":t.substr(0,n),new b(r)},"substring-after":function(e){He(2==this.args.length);var r,t=this.args[0].evaluate(e).stringValue(),a=this.args[1].evaluate(e).stringValue(),n=t.indexOf(a);return r=-1==n?"":t.substr(n+a.length),new b(r)},substring:function(e){He(2==this.args.length||3==this.args.length);var r,t=this.args[0].evaluate(e).stringValue(),a=this.args[1].evaluate(e).numberValue();if(2==this.args.length){var n=Math.max(0,Math.round(a)-1);r=t.substr(n)}else{var o=this.args[2].evaluate(e).numberValue(),i=Math.round(a)-1,s=(n=Math.max(0,i),Math.round(o)-Math.max(0,-i));r=t.substr(n,s)}return new b(r)},"string-length":function(e){var r;return r=this.args.length>0?this.args[0].evaluate(e).stringValue():new yr([e.nodelist[e.position]]).stringValue(),new d(r.length)},"normalize-space":function(e){var r;return r=(r=this.args.length>0?this.args[0].evaluate(e).stringValue():new yr([e.nodelist[e.position]]).stringValue()).replace(/^\s*/,"").replace(/\s*$/,"").replace(/\s+/g," "),new b(r)},translate:function(e){He(3==this.args.length);for(var r=this.args[0].evaluate(e).stringValue(),t=this.args[1].evaluate(e).stringValue(),a=this.args[2].evaluate(e).stringValue(),n=0;n<t.length;++n)r=r.replace(new RegExp(t.charAt(n),"g"),a.charAt(n));return new b(r)},matches:function(e){He(this.args.length>=2);var r,t,a=this.args[0].evaluate(e).stringValue(),n=this.args[1].evaluate(e).stringValue();if(this.args.length>2&&(r=this.args[2].evaluate(e).stringValue(),/[^mi]/.test(r)))throw"Invalid regular expression syntax: ".concat(r);try{t=new RegExp(n,r)}catch(e){throw"Invalid matches argument: ".concat(n)}return new l(t.test(a))},boolean:function(e){return He(1==this.args.length),new l(this.args[0].evaluate(e).booleanValue())},not:function(e){He(1==this.args.length);var r=!this.args[0].evaluate(e).booleanValue();return new l(r)},true:function(){return He(0==this.args.length),new l(!0)},false:function(){return He(0==this.args.length),new l(!1)},lang:function(e){He(1==this.args.length);for(var r,t=this.args[0].evaluate(e).stringValue(),a=e.nodelist[e.position];a&&a!=a.parentNode&&!(r=a.getAttributeValue("xml:lang"));)a=a.parentNode;if(!r)return new l(!1);var n=new RegExp("^".concat(t,"$"),"i");return new l(r.match(n)||r.replace(/_.*$/,"").match(n))},number:function(e){return He(1==this.args.length||0==this.args.length),1==this.args.length?new d(this.args[0].evaluate(e).numberValue()):new d(new yr([e.nodelist[e.position]]).numberValue())},sum:function(e){He(1==this.args.length);for(var r=this.args[0].evaluate(e).nodeSetValue(),t=0,a=0;a<r.length;++a)t+=hr(r[a])-0;return new d(t)},floor:function(e){He(1==this.args.length);var r=this.args[0].evaluate(e).numberValue();return new d(Math.floor(r))},ceiling:function(e){He(1==this.args.length);var r=this.args[0].evaluate(e).numberValue();return new d(Math.ceil(r))},round:function(e){He(1==this.args.length);var r=this.args[0].evaluate(e).numberValue();return new d(Math.round(r))},"ext-join":function(e){He(2==this.args.length);for(var r=this.args[0].evaluate(e).nodeSetValue(),t=this.args[1].evaluate(e).stringValue(),a="",n=0;n<r.length;++n)a&&(a+=t),a+=hr(r[n]);return new b(a)},"ext-if":function(e){return He(3==this.args.length),this.args[0].evaluate(e).booleanValue()?this.args[1].evaluate(e):this.args[2].evaluate(e)},"ext-cardinal":function(e){He(this.args.length>=1);for(var r=this.args[0].evaluate(e).numberValue(),t=[],a=0;a<r;++a)t.push(e.nodelist[e.position]);return new yr(t)}},t.name=r,t.args=[],t}return h(r,e),r.prototype.cyrb53=function(e,r){void 0===r&&(r=0);for(var t=3735928559^r,a=1103547991^r,n=0,o=void 0;n<e.length;n++)o=e.charCodeAt(n),t=Math.imul(t^o,2654435761),a=Math.imul(a^o,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(a^a>>>13,3266489909),a=Math.imul(a^a>>>16,2246822507),4294967296*(2097151&(a^=Math.imul(t^t>>>13,3266489909)))+(t>>>0)},r.prototype.appendArg=function(e){this.args.push(e)},r.prototype.evaluate=function(e){var r="".concat(this.name.value),t=this.xpathfunctions[r];return t?t.call(this,e):new l(!1)},r}(f),y=function(e){function r(r){var t=e.call(this)||this;return t.value=r,t}return h(r,e),r.prototype.evaluate=function(){return new b(this.value)},r}(f),x=function(){function e(){this.value=new l(!0)}return e.prototype.evaluate=function(){return this.value},e}(),w="[ \t\r\n]+",E="(".concat(w,")?=(").concat(w,")?"),q="&#[0-9]+;|&#x[0-9a-fA-F]+;",D="".concat(w,"version").concat(E,"(\"1\\.0\"|'1\\.0')"),A="̀-͠ͅ-҃͡-֑҆-֣֡-ֹֻ-ֽֿׁ-ׂًׄ-ْٰۖ-ۜ۝-۟۠-ۤۧ-۪ۨ-ۭँ-ः़ा-ौ्॑-॔ॢ-ॣঁ-ঃ়ািী-ৄে-ৈো-্ৗৢ-ৣਂ਼ਾਿੀ-ੂੇ-ੈੋ-੍ੰ-ੱઁ-ઃ઼ા-ૅે-ૉો-્ଁ-ଃ଼ା-ୃେ-ୈୋ-୍ୖ-ୗஂ-ஃா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕ-ౖಂ-ಃಾ-ೄೆ-ೈೊ-್ೕ-ೖം-ഃാ-ൃെ-ൈൊ-്ൗัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-༹༙༵༷༾༿ཱ-྄྆-ྋྐ-ྕྗྙ-ྭྱ-ྷྐྵ⃐-〪⃜⃡-゙゚〯",k="0-9٠-٩۰-۹०-९০-৯੦-੯૦-૯୦-୯௧-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩",N="·ːˑ·ـๆໆ々〱-〵ゝ-ゞー-ヾ",S="A-Za-zÀ-ÖØ-öø-ÿĀ-ıĴ-ľŁ-ňŊ-žƀ-ǃǍ-ǰǴ-ǵǺ-ȗɐ-ʨʻ-ˁΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϖϚϜϞϠϢ-ϳЁ-ЌЎ-яё-ќў-ҁҐ-ӄӇ-ӈӋ-ӌӐ-ӫӮ-ӵӸ-ӹԱ-Ֆՙա-ֆא-תװ-ײء-غف-يٱ-ڷں-ھۀ-ێې-ۓەۥ-ۦअ-हऽक़-ॡঅ-ঌএ-ঐও-নপ-রলশ-হড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઋઍએ-ઑઓ-નપ-રલ-ળવ-હઽૠଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଶ-ହଽଡ଼-ଢ଼ୟ-ୡஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-வஷ-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡก-ฮะา-ำเ-ๅກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ຮະາ-ຳຽເ-ໄཀ-ཇཉ-ཀྵႠ-Ⴥა-ჶᄀᄂ-ᄃᄅ-ᄇᄉᄋ-ᄌᄎ-ᄒᄼᄾᅀᅌᅎᅐᅔ-ᅕᅙᅟ-ᅡᅣᅥᅧᅩᅭ-ᅮᅲ-ᅳᅵᆞᆨᆫᆮ-ᆯᆷ-ᆸᆺᆼ-ᇂᇫᇰᇹḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼΩK-Å℮ↀ-ↂぁ-ゔァ-ヺㄅ-ㄬ가-힣一-龥〇〡-〩",C="".concat(S+k,"\\._:").concat(A).concat(N,"-"),V="[".concat(S,"_:][").concat(C,"]*"),T="&".concat(V,";"),L="".concat(T,"|").concat(q),R='"(([^<&"]|'.concat(L,")*)\"|'(([^<&']|").concat(L,")*)'"),P="(".concat(V,")").concat(E,"(").concat(R,")"),B="".concat(w,"version").concat(E,"(\"1\\.1\"|'1\\.1')"),F=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",U=F+"\\.0-9·̀-ͯ‿-⁀-",I="[".concat(F,"][").concat(U,"]*"),O="&".concat(I,";"),G="".concat(O,"|").concat(q),H='"(([^<&"]|'.concat(G,")*)\"|'(([^<&']|").concat(G,")*)'"),M="(".concat(I,")").concat(E,"(").concat(H,")"),z="".concat(S+k,"\\._").concat(A).concat(N,"-"),j="[".concat(S,"_][").concat(z,"]*"),_={ANCESTOR_OR_SELF:"ancestor-or-self",ANCESTOR:"ancestor",ATTRIBUTE:"attribute",CHILD:"child",DESCENDANT_OR_SELF:"descendant-or-self",DESCENDANT:"descendant",FOLLOWING_SIBLING:"following-sibling",FOLLOWING:"following",NAMESPACE:"namespace",PARENT:"parent",PRECEDING_SIBLING:"preceding-sibling",PRECEDING:"preceding",SELF:"self"},X=[_.ANCESTOR_OR_SELF,_.ANCESTOR,_.ATTRIBUTE,_.CHILD,_.DESCENDANT_OR_SELF,_.DESCENDANT,_.FOLLOWING_SIBLING,_.FOLLOWING,_.NAMESPACE,_.PARENT,_.PRECEDING_SIBLING,_.PRECEDING,_.SELF].join("(?=::)|")+"(?=::)",J={label:"|",prec:17,re:new RegExp("^\\|"),key:void 0},Y={label:"//",prec:19,re:new RegExp("^//"),key:void 0},Z={label:"/",prec:30,re:new RegExp("^/"),key:void 0},W={label:"::",prec:20,re:new RegExp("^::"),key:void 0},K={label:":",prec:1e3,re:new RegExp("^:"),key:void 0},Q={label:"[axis]",re:new RegExp("^(".concat(X,")")),key:void 0},$={label:"(",prec:34,re:new RegExp("^\\("),key:void 0},ee={label:")",re:new RegExp("^\\)"),key:void 0},re={label:"..",prec:34,re:new RegExp("^\\.\\."),key:void 0},te={label:".",prec:34,re:new RegExp("^\\."),key:void 0},ae={label:"@",prec:34,re:new RegExp("^@"),key:void 0},ne={label:",",re:new RegExp("^,"),key:void 0},oe={label:"or",prec:10,re:new RegExp("^or\\b"),key:void 0},ie={label:"and",prec:11,re:new RegExp("^and\\b"),key:void 0},se={label:"=",prec:12,re:new RegExp("^="),key:void 0},le={label:"!=",prec:12,re:new RegExp("^!="),key:void 0},ue={label:">=",prec:13,re:new RegExp("^>="),key:void 0},ce={label:">",prec:13,re:new RegExp("^>"),key:void 0},pe={label:"<=",prec:13,re:new RegExp("^<="),key:void 0},he={label:"<",prec:13,re:new RegExp("^<"),key:void 0},de={label:"+",prec:14,re:new RegExp("^\\+"),left:!0,key:void 0},fe={label:"-",prec:14,re:new RegExp("^\\-"),left:!0,key:void 0},ge={label:"div",prec:15,re:new RegExp("^div\\b"),left:!0,key:void 0},me={label:"mod",prec:15,re:new RegExp("^mod\\b"),left:!0,key:void 0},be={label:"[",prec:32,re:new RegExp("^\\["),key:void 0},ve={label:"]",re:new RegExp("^\\]"),key:void 0},ye={label:"$",re:new RegExp("^\\$"),key:void 0},xe={label:"[ncname]",re:new RegExp("^".concat(j)),key:void 0},we={label:"*",prec:15,re:new RegExp("^\\*"),left:!0,key:void 0},Ee={label:"[litq]",prec:20,re:new RegExp("^'[^\\']*'"),key:void 0},qe={label:"[litqq]",prec:20,re:new RegExp('^"[^\\"]*"'),key:void 0},De={label:"[number]",prec:35,re:new RegExp("^\\d+(\\.\\d*)?"),key:void 0},Ae={label:"[qname]",re:new RegExp("^(".concat(j,":)?").concat(j)),key:void 0},ke={label:"[nodetest-start]",re:new RegExp("^(processing-instruction|comment|text|node)\\("),key:void 0},Ne=[Y,Z,re,te,W,K,Q,ke,$,ee,be,ve,ae,ne,oe,ie,le,se,ue,ce,pe,he,de,fe,we,J,me,ge,Ee,qe,De,Ae,xe,ye],Se={label:"?"},Ce={label:"*"},Ve={label:"+"},Te=!0,Le=function(e){function r(r){var t=e.call(this)||this;return t.absolute=!1,t.steps=[],t.xPath=r,t}return h(r,e),r.prototype.appendStep=function(e){var r=this._combineSteps(this.steps[this.steps.length-1],e);r?this.steps[this.steps.length-1]=r:this.steps.push(e)},r.prototype.prependStep=function(e){var r=this._combineSteps(e,this.steps[0]);r?this.steps[0]=r:this.steps.unshift(e)},r.prototype._combineSteps=function(e,r){if(!e)return null;if(!r)return null;var t=e.predicates&&e.predicates.length>0;if(e.nodetest instanceof x&&!t)if(e.axis==_.DESCENDANT_OR_SELF){if(r.axis==_.CHILD);else if(r.axis==_.SELF)return r.axis=_.DESCENDANT_OR_SELF,r}else if(e.axis==_.DESCENDANT&&r.axis==_.SELF)return r.axis=_.DESCENDANT,r;return null},r.prototype.evaluate=function(e){var r;r=this.absolute?e.root:e.nodelist[e.position];var t=[];return this.xPath.xPathStep(t,this.steps,0,r,e),new yr(t)},r}(f),Re=function(e){function r(r){var t=e.call(this)||this;return t.value=r,t}return h(r,e),r.prototype.evaluate=function(){return new d(this.value)},r}(f),Pe=function(e){function r(r,t){var a=e.call(this)||this;return a.filter=r,a.rel=t,a}return h(r,e),r.prototype.evaluate=function(e){var r=this.filter.evaluate(e).nodeSetValue(),t=[];if(e.returnOnFirstMatch){for(var a=0;a<r.length&&!((t=this.rel.evaluate(e.clone(r,a)).nodeSetValue()).length>0);++a);return new yr(t)}for(a=0;a<r.length;++a)for(var n=this.rel.evaluate(e.clone(r,a)).nodeSetValue(),o=0;o<n.length;++o)t.push(n[o]);return new yr(t)},r}(f),Be=function(e){function r(r){var t=e.call(this)||this;return t.expr=r,t}return h(r,e),r.prototype.evaluate=function(e){var r=this.expr.evaluate(e);return"number"==r.type?new l(e.position==r.numberValue()-1):new l(r.booleanValue())},r}(f),Fe=function(e){function r(r,t,a,n){var o=e.call(this)||this;o.axis=r,o.nodetest=t,o.predicate=n||[],o.hasPositionalPredicate=!1,o.xPath=a;for(var i=0;i<o.predicate.length;++i)if(Xe(o.predicate[i].expr)){o.hasPositionalPredicate=!0;break}return o}return h(r,e),r.prototype.appendPredicate=function(e){this.predicate.push(e),this.hasPositionalPredicate||(this.hasPositionalPredicate=Xe(e.expr))},r.prototype.evaluate=function(e){var r=e.nodelist[e.position],a=[],n=!1;if(this.nodetest instanceof x&&(n=!0),this.axis==_.ANCESTOR_OR_SELF){a.push(r);for(var o=r.parentNode;o;o=o.parentNode)a.push(o)}else if(this.axis==_.ANCESTOR)for(o=r.parentNode;o;o=o.parentNode)a.push(o);else if(this.axis==_.ATTRIBUTE)if(null!=this.nodetest.name){if(r.attributes)if(r.attributes instanceof Array)je(a,r.attributes);else if("style"==this.nodetest.name){var i=r.getAttributeValue("style");i&&"string"!=typeof i?a.push(Ye.create(t,"style",i.cssText,document)):a.push(r.attributes[this.nodetest.name])}else a.push(r.attributes[this.nodetest.name])}else e.ignoreAttributesWithoutValue?function(e,r){if(!r)return;for(var t=r.length-1;t>=0;--t)r[t].nodeValue&&e.push(r[t])}(a,r.attributes):je(a,r.attributes);else if(this.axis==_.CHILD)je(a,r.childNodes);else if(this.axis==_.DESCENDANT_OR_SELF){this.nodetest.evaluate(e).booleanValue()&&a.push(r);var s=this.xPath.xPathExtractTagNameFromNodeTest(this.nodetest,e.ignoreNonElementNodesForNTA);this.xPath.xPathCollectDescendants(a,r,s),s&&(n=!0)}else if(this.axis==_.DESCENDANT){s=this.xPath.xPathExtractTagNameFromNodeTest(this.nodetest,e.ignoreNonElementNodesForNTA);this.xPath.xPathCollectDescendants(a,r,s),s&&(n=!0)}else if(this.axis==_.FOLLOWING)for(o=r;o;o=o.parentNode)for(var l=o.nextSibling;l;l=l.nextSibling)a.push(l),this.xPath.xPathCollectDescendants(a,l);else if(this.axis==_.FOLLOWING_SIBLING)for(o=r.nextSibling;o;o=o.nextSibling)a.push(o);else{if(this.axis==_.NAMESPACE)throw new Error("not implemented: axis namespace");if(this.axis==_.PARENT)r.parentNode&&a.push(r.parentNode);else if(this.axis==_.PRECEDING)for(o=r;o;o=o.parentNode)for(l=o.previousSibling;l;l=l.previousSibling)a.push(l),this.xPath.xPathCollectDescendantsReverse(a,l);else if(this.axis==_.PRECEDING_SIBLING)for(o=r.previousSibling;o;o=o.previousSibling)a.push(o);else{if(this.axis!=_.SELF)throw"ERROR -- NO SUCH AXIS: ".concat(this.axis);a.push(r)}}if(!n){var u=a;a=[];for(var c=0;c<u.length;++c)this.nodetest.evaluate(e.clone(u,c)).booleanValue()&&a.push(u[c])}if(!e.returnOnFirstMatch)for(c=0;c<this.predicate.length;++c){u=a;a=[];for(var p=0;p<u.length;++p){o=u[p];this.predicate[c].evaluate(e.clone(u,p)).booleanValue()&&a.push(o)}}return new yr(a)},r}(f),Ue=function(e){function r(r){var t=e.call(this)||this;return t.value=r,t}return h(r,e),r.prototype.evaluate=function(){return new b(this.value)},r}(f),Ie=function(e){function r(r){var t=e.call(this)||this;return t.expr=r,t}return h(r,e),r.prototype.evaluate=function(e){return new d(-this.expr.evaluate(e).numberValue())},r}(f),Oe=function(e){function r(r,t){var a=e.call(this)||this;return a.expr1=r,a.expr2=t,a}return h(r,e),r.prototype.evaluate=function(e){for(var r=this.expr1.evaluate(e).nodeSetValue(),t=this.expr2.evaluate(e).nodeSetValue(),a=r.length,n=0,o=t;n<o.length;n++){for(var i=o[n],s=!1,l=0;l<a;++l)r[l]==i&&(s=!0,l=a);s||r.push(i)}return new yr(r)},r}(f),Ge=function(e){function r(r){var t=e.call(this)||this;return t.name=r,t}return h(r,e),r.prototype.evaluate=function(e){return e.getVariable(this.name)},r}(f);function He(e){if(!e)throw new Error("Assertion failed")}function Me(e,r){for(var t=[],a=0;a<e.length;++a)t.push(r(e[a]));return t}function ze(e){for(var r=0;r<e.length/2;++r){var t=e[r],a=e.length-r-1;e[r]=e[a],e[a]=t}}function je(e,r){if(r)for(var t=e.length,a=r.length-1;a>=0;--a)e[a+t]=r[a]}var _e=new RegExp("(\\".concat(["/",".","*","+","?","|","^","$","(",")","[","]","{","}","\\"].join("|\\"),")"),"g");function Xe(e,r){if(!e)return!1;if(!r&&function(e){if(e instanceof v){return{last:!0,position:!0,count:!0,"string-length":!0,number:!0,sum:!0,floor:!0,ceiling:!0,round:!0}[e.name.value]}if(e instanceof Ie)return!0;if(e instanceof g){return{"+":!0,"-":!0,"*":!0,mod:!0,div:!0}[e.op.value]}if(e instanceof Re)return!0;return!1}(e))return!0;if(e instanceof v){var t=e.name.value;return"last"==t||"position"==t}return e instanceof g&&(Xe(e.expr1,!0)||Xe(e.expr2,!0))}function Je(e){for(var r={xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace"},t=e;null!==t;){for(var a=0;a<t.attributes.length;a++)if(t.attributes[a].nodeName.startsWith("xmlns:")){var n=t.attributes[a].nodeName.split(":")[1];n in r||(r[n]=t.attributes[a].nodeValue)}else"xmlns"==t.attributes[a].nodeName&&(""in r||(r[""]=t.attributes[a].nodeValue||null));t=t.parentNode}return r}var Ye=function(){function e(e,r,t,a,n){this.id=Math.random()*(Number.MAX_SAFE_INTEGER-1)+1,this.attributes=[],this.childNodes=[],this.transformedAttributes=[],this.transformedChildNodes=[],this.printed=!1,this.escape=!0,this.init(e,r,t,a,n)}return e.prototype.init=function(e,r,t,a,n){var o;this.nodeType=e-0,this.nodeName="".concat(r),this.nodeValue="".concat(t),this.ownerDocument=a,this.namespaceURI=n||null,o=this.qualifiedNameToParts("".concat(r)),this.prefix=o[0],this.localName=o[1],this.firstChild=null,this.lastChild=null,this.nextSibling=null,this.previousSibling=null,this.parentNode=null},e.prototype.qualifiedNameToParts=function(e){return e.includes(":")?e.split(":"):[null,e]},e.recycle=function(e){if(e)if(e.constructor!=Ze){if(e.constructor==this){this._unusedXNodes.push(e);for(var r=0;r<e.attributes.length;++r)this.recycle(e.attributes[r]);for(var t=0;t<e.childNodes.length;++t)this.recycle(e.childNodes[t]);e.attributes.length=0,e.childNodes.length=0,e.init.call(0,"","",null)}}else this.recycle(e.documentElement)},e.create=function(r,t,a,n,o){if(this._unusedXNodes.length>0){var i=this._unusedXNodes.pop();return i.init(r,t,a,n,o),i}return new e(r,t,a,n,o)},e.clone=function(r,t){for(var a=new e(r.nodeType,r.nodeName,r.nodeValue,t,r.namespaceURI),n=0,o=r.childNodes;n<o.length;n++){var i=o[n];a.appendChild(e.clone(i,a))}for(var s=0,l=r.attributes;s<l.length;s++){var u=l[s];a.setAttribute(u.nodeName,u.nodeValue)}return a},e.prototype.appendChild=function(e){0==this.childNodes.length&&(this.firstChild=e),e.previousSibling=this.lastChild,e.nextSibling=null,this.lastChild&&(this.lastChild.nextSibling=e),e.parentNode=this,this.lastChild=e,this.childNodes.push(e)},e.prototype.appendTransformedChild=function(e){0==this.transformedChildNodes.length&&(this.transformedFirstChild=e),e.transformedPreviousSibling=this.lastChild,e.transformedNextSibling=null,this.transformedLastChild&&(this.transformedLastChild.transformedNextSibling=e),e.transformedParentNode=this,this.transformedLastChild=e,this.transformedChildNodes.push(e)},e.prototype.replaceChild=function(e,r){if(r!=e)for(var t=0;t<this.childNodes.length;++t)if(this.childNodes[t]==r){this.childNodes[t]=e;var a=r.parentNode;r.parentNode=null,e.parentNode=a,a=r.previousSibling,r.previousSibling=null,e.previousSibling=a,e.previousSibling&&(e.previousSibling.nextSibling=e),a=r.nextSibling,r.nextSibling=null,e.nextSibling=a,e.nextSibling&&(e.nextSibling.previousSibling=e),this.firstChild==r&&(this.firstChild=e),this.lastChild==r&&(this.lastChild=e);break}},e.prototype.insertBefore=function(e,r){if(r!=e&&r.parentNode==this){e.parentNode&&e.parentNode.removeChild(e);for(var t=[],a=0,n=this.childNodes;a<n.length;a++){var o=n[a];o==r&&(t.push(e),e.parentNode=this,e.previousSibling=r.previousSibling,r.previousSibling=e,e.previousSibling&&(e.previousSibling.nextSibling=e),e.nextSibling=r,this.firstChild==r&&(this.firstChild=e)),t.push(o)}this.childNodes=t}},e.prototype.removeChild=function(e){for(var r=[],t=0,a=this.childNodes;t<a.length;t++){var n=a[t];n!=e?r.push(n):(n.previousSibling&&(n.previousSibling.nextSibling=n.nextSibling),n.nextSibling&&(n.nextSibling.previousSibling=n.previousSibling),this.firstChild==n&&(this.firstChild=n.nextSibling),this.lastChild==n&&(this.lastChild=n.previousSibling))}this.childNodes=r},e.prototype.hasAttributes=function(){return this.attributes.length>0},e.prototype.setAttribute=function(r,a){for(var n=0;n<this.attributes.length;++n)if(this.attributes[n].nodeName==r)return void(this.attributes[n].nodeValue="".concat(a));this.attributes.push(e.create(t,r,a,this))},e.prototype.setTransformedAttribute=function(r,a){for(var n=0;n<this.transformedAttributes.length;++n)if(this.transformedAttributes[n].nodeName==r)return void(this.transformedAttributes[n].nodeValue="".concat(a));this.transformedAttributes.push(e.create(t,r,a,this))},e.prototype.setAttributeNS=function(r,a,n){for(var o=0;o<this.attributes.length;++o)if(this.attributes[o].namespaceURI==r&&this.attributes[o].localName==this.qualifiedNameToParts("".concat(a))[1])return this.attributes[o].nodeValue="".concat(n),this.attributes[o].nodeName="".concat(a),void(this.attributes[o].prefix=this.qualifiedNameToParts("".concat(a))[0]);this.attributes.push(e.create(t,a,n,this,r))},e.prototype.getAttributeValue=function(e){for(var r=0;r<this.attributes.length;++r)if(this.attributes[r].nodeName==e)return this.attributes[r].nodeValue;return null},e.prototype.getAttributeNS=function(e,r){for(var t=0;t<this.attributes.length;++t)if(this.attributes[t].namespaceURI==e&&this.attributes[t].localName==r)return this.attributes[t].nodeValue;return null},e.prototype.hasAttribute=function(e){for(var r=0;r<this.attributes.length;++r)if(this.attributes[r].nodeName==e)return!0;return!1},e.prototype.hasAttributeNS=function(e,r){for(var t=0;t<this.attributes.length;++t)if(this.attributes[t].namespaceURI==e&&this.attributes[t].localName==r)return!0;return!1},e.prototype.removeAttribute=function(e){for(var r=[],t=0;t<this.attributes.length;++t)this.attributes[t].nodeName!=e&&r.push(this.attributes[t]);this.attributes=r},e.prototype.removeAttributeNS=function(e,r){for(var t=[],a=0;a<this.attributes.length;++a)this.attributes[a].localName==r&&this.attributes[a].namespaceURI==e||t.push(this.attributes[a]);this.attributes=t},e.prototype.getElementsByTagName=function(e){var r=[],t=this;return pr(this,"*"==e?function(e){t!=e&&r.push(e)}:function(a){t!=a&&a.nodeName==e&&r.push(a)},null),r},e.prototype.getElementsByTagNameNS=function(e,r){var t=[],a=this;return pr(this,"*"==e&&"*"==r?function(e){a!=e&&t.push(e)}:"*"==e?function(e){a!=e&&e.localName==r&&t.push(e)}:"*"==r?function(r){a!=r&&r.namespaceURI==e&&t.push(r)}:function(n){a!=n&&n.localName==r&&n.namespaceURI==e&&t.push(n)},null),t},e.prototype.getElementById=function(e){var r=null;return pr(this,(function(t){if(t.getAttributeValue("id")==e)return r=t,!1}),null),r},e._unusedXNodes=[],e}(),Ze=function(e){function l(){var r=e.call(this,i,"#document",null,null)||this;return r.documentElement=null,r}return h(l,e),l.prototype.clear=function(){Ye.recycle(this.documentElement),this.documentElement=null},l.prototype.appendChild=function(r){e.prototype.appendChild.call(this,r),this.documentElement=this.childNodes[0]},l.prototype.createElement=function(e){return Ye.create(r,e,null,this)},l.prototype.createElementNS=function(e,t){return Ye.create(r,t,null,this,e)},l.prototype.createDocumentFragment=function(){return Ye.create(s,"#document-fragment",null,this)},l.prototype.createTextNode=function(e){return Ye.create(a,"#text",e,this)},l.prototype.createTransformedTextNode=function(e){var r=Ye.create(a,"#text",e,this);return r.transformedNodeValue=e,r},l.prototype.createAttribute=function(e){return Ye.create(t,e,null,this)},l.prototype.createAttributeNS=function(e,r){return Ye.create(t,r,null,this,e)},l.prototype.createComment=function(e){return Ye.create(o,"#comment",e,this)},l.prototype.createCDATASection=function(e){return Ye.create(n,"#cdata-section",e,this)},l.prototype.createDTDSection=function(e){return Ye.create(10,"#dtd-section",e,this)},l}(Ye),We=new RegExp("^(".concat(V,")")),Ke=new RegExp(P,"g"),Qe=new RegExp("^(".concat(I,")")),$e=new RegExp(M,"g");function er(e,r){return e.getAttributeValue(r)}function rr(e,r,t){return e.setAttribute(r,t)}function tr(e,r,t){return e.setTransformedAttribute(r,t)}function ar(e,r){return e.appendChild(r)}function nr(e,r){return e.appendTransformedChild(r)}function or(e,r){return e.createTextNode(r)}function ir(e,r){return e.createTransformedTextNode(r)}function sr(e,r){return e.createElement(r)}function lr(e,r){return e.createCDATASection(r)}function ur(e,r){return e.createComment(r)}function cr(e){return e.createDocumentFragment()}function pr(e,t,a){var n;if(t&&"boolean"==typeof(n=t.call(null,e))&&!n)return!1;for(var o=e.firstChild;o;o=o.nextSibling)if(o.nodeType==r&&"boolean"==typeof(n=pr.call(this,o,t,a))&&!n)return!1;return!(a&&"boolean"==typeof(n=a.call(null,e))&&!n)&&void 0}function hr(e,o){if(void 0===o&&(o=!1),!e)return"";var l="";if(e.nodeType==a||e.nodeType==n)l+=e.nodeValue;else if(e.nodeType==t)l+=e.nodeValue;else if(e.nodeType==r||e.nodeType==i||e.nodeType==s){if(!o){var u=e.innerText;if(null!=u)return u;var c=e.textContent;if(null!=c)return c}if(e.transformedChildNodes.length>0)for(var p=0;p<e.transformedChildNodes.length;++p)l+=hr(e.transformedChildNodes[p]);else for(p=0;p<e.childNodes.length;++p)l+=hr(e.childNodes[p])}return l}function dr(e,t,l){if(!e.printed){var u=e.transformedNodeType||e.nodeType,c=e.transformedNodeValue||e.nodeValue;if(u==a){if(e.transformedNodeValue&&""!==e.transformedNodeValue.trim()){var p=e.escape&&l.escape?gr(e.transformedNodeValue):e.transformedNodeValue;t.push(p)}}else if(u==n)l.cData?t.push(c):t.push("<![CDATA[".concat(c,"]]>"));else if(u==o)t.push("\x3c!--".concat(c,"--\x3e"));else if(u==r)null!==e.transformedNodeName&&void 0!==e.transformedNodeName?function(e,r,t){r.push("<".concat(fr(e)));for(var a=e.transformedAttributes||e.attributes,n=0;n<a.length;++n){var o=a[n];if(o){var i=o.transformedNodeName||o.nodeName,s=o.transformedNodeValue||o.nodeValue;i&&s&&r.push(" ".concat(fr(o),'="').concat(mr(s),'"'))}}var l=e.transformedChildNodes.length>0?e.transformedChildNodes:e.childNodes;if(0==l.length)r.push("/>");else{r.push(">");for(n=0;n<l.length;++n)dr(l[n],r,t);r.push("</".concat(fr(e),">"))}}(e,t,l):function(e,r,t){for(var a=e.transformedChildNodes.length>0?e.transformedChildNodes:e.childNodes,n=0;n<a.length;++n)dr(a[n],r,t)}(e,t,l);else if(u==i||u==s)for(var h=e.transformedChildNodes.concat(e.childNodes),d=0;d<h.length;++d)dr(h[d],t,l);e.printed=!0}}function fr(e){var r=e.transformedNodeName||e.nodeName;return e.transformedPrefix&&0!=r.indexOf("".concat(e.transformedPrefix,":"))?"".concat(e.transformedPrefix,":").concat(r):r}function gr(e){return"".concat(e).replace(/&/g,"&amp;").replace(/&amp;amp;/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mr(e){return gr(e).replace(/"/g,"&quot;")}function br(e,r){var t=er(e,r);return t?c.decode(t):t}function vr(e){if(null==e)throw new Error("Node has no valid owner document.");return e.nodeType===i?e:vr(e.ownerDocument)}var yr=function(){function e(e){this.value=e,this.type="node-set"}return e.prototype.stringValue=function(){return 0===this.value.length?"":hr(this.value[0])},e.prototype.booleanValue=function(){return this.value.length>0},e.prototype.numberValue=function(){return this.stringValue()-0},e.prototype.nodeSetValue=function(){return this.value},e}(),xr=function(){function e(e,r,t,a,n,o,s){this.nodelist=e,this.position=r||0,this.variables={},this.parent=t||null,this.caseInsensitive=a||!1,this.ignoreAttributesWithoutValue=n||!1,this.returnOnFirstMatch=o||!1,this.ignoreNonElementNodesForNTA=s||!1,t?this.root=t.root:this.nodelist[this.position].nodeType==i?this.root=this.nodelist[this.position]:this.root=this.nodelist[this.position].ownerDocument}return e.prototype.clone=function(r,t){return new e(r||this.nodelist,void 0!==t?t:this.position,this,this.caseInsensitive,this.ignoreAttributesWithoutValue,this.returnOnFirstMatch,this.ignoreNonElementNodesForNTA)},e.prototype.setVariable=function(e,r){r instanceof b||r instanceof l||r instanceof d||r instanceof yr?this.variables[e]=r:"true"===r?this.variables[e]=new l(!0):"false"===r?this.variables[e]=new l(!1):De.re.test(r)?this.variables[e]=new d(r):this.variables[e]=new b(r)},e.prototype.getVariable=function(e){return void 0!==this.variables[e]?this.variables[e]:this.parent?this.parent.getVariable(e):null},e.prototype.setNode=function(e){this.position=e},e.prototype.contextSize=function(){return this.nodelist.length},e.prototype.isCaseInsensitive=function(){return this.caseInsensitive},e.prototype.setCaseInsensitive=function(e){return this.caseInsensitive=e},e.prototype.isIgnoreAttributesWithoutValue=function(){return this.ignoreAttributesWithoutValue},e.prototype.setIgnoreAttributesWithoutValue=function(e){return this.ignoreAttributesWithoutValue=e},e.prototype.isReturnOnFirstMatch=function(){return this.returnOnFirstMatch},e.prototype.setReturnOnFirstMatch=function(e){return this.returnOnFirstMatch=e},e.prototype.isIgnoreNonElementNodesForNTA=function(){return this.ignoreNonElementNodesForNTA},e.prototype.setIgnoreNonElementNodesForNTA=function(e){return this.ignoreNonElementNodesForNTA=e},e}(),wr=function(){function e(){}return e.prototype.evaluate=function(e){return new l(e.node.nodeType==o)},e}(),Er=function(){function e(){}return e.prototype.evaluate=function(e){var a=e.nodelist[e.position];return new l(a.nodeType==r||a.nodeType==t)},e}(),qr=function(){function e(e){this.name=e,this.re=new RegExp("^".concat(e,"$"),"i")}return e.prototype.evaluate=function(e){var r=e.nodelist[e.position];return e.caseInsensitive?r.nodeName.length!=this.name.length?new l(!1):new l(this.re.test(r.nodeName)):new l(r.nodeName==this.name)},e}(),Dr=function(){function e(e){this.regex=new RegExp("^".concat(e,":")),this.nsprefix=e}return e.prototype.evaluate=function(e){var r=e.node;return new l(r.nodeName.match(this.regex))},e}(),Ar=function(){function e(e){this.target=e}return e.prototype.evaluate=function(e){return new l(7==e.node.nodeType&&(!this.target||e.node.nodeName==this.target))},e}(),kr=function(){function e(){}return e.prototype.evaluate=function(e){return new l(e.node.nodeType==a)},e}(),Nr={label:"LocationPath",key:void 0},Sr={label:"RelativeLocationPath",key:void 0},Cr={label:"AbsoluteLocationPath",key:void 0},Vr={label:"Step",key:void 0},Tr={label:"NodeTest",key:void 0},Lr={label:"Predicate",key:void 0},Rr={label:"Literal",key:void 0},Pr={label:"Expr",key:void 0},Br={label:"PrimaryExpr",key:void 0},Fr={label:"Variablereference",key:void 0},Ur={label:"Number",key:void 0},Ir={label:"FunctionCall",key:void 0},Or={label:"ArgumentRemainder",key:void 0},Gr={label:"PathExpr",key:void 0},Hr={label:"UnionExpr",key:void 0},Mr={label:"FilterExpr",key:void 0},zr={label:"Digits",key:void 0},jr=function(){function e(){this.xPathGrammarRules=[[Nr,[Sr],18,this.passExpr],[Nr,[Cr],18,this.passExpr],[Cr,[Z,Sr],18,this.makeLocationExpr1],[Cr,[Y,Sr],18,this.makeLocationExpr2],[Cr,[Z],0,this.makeLocationExpr3],[Cr,[Y],0,this.makeLocationExpr4],[Sr,[Vr],31,this.makeLocationExpr5],[Sr,[Sr,Z,Vr],31,this.makeLocationExpr6],[Sr,[Sr,Y,Vr],31,this.makeLocationExpr7],[Vr,[te],33,this.makeStepExpr1],[Vr,[re],33,this.makeStepExpr2],[Vr,[Q,W,Tr],33,this.makeStepExpr3],[Vr,[ae,Tr],33,this.makeStepExpr4],[Vr,[Tr],33,this.makeStepExpr5],[Vr,[Vr,Lr],33,this.makeStepExpr6],[Tr,[we],33,this.makeNodeTestExpr1],[Tr,[xe,K,we],33,this.makeNodeTestExpr2],[Tr,[Ae],33,this.makeNodeTestExpr3],[Tr,[ke,ee],33,this.makeNodeTestExpr4],[Tr,[ke,Rr,ee],33,this.makeNodeTestExpr5],[Lr,[be,Pr,ve],33,this.makePredicateExpr],[Br,[Fr],33,this.passExpr],[Br,[$,Pr,ee],33,this.makePrimaryExpr],[Br,[Rr],30,this.passExpr],[Br,[Ur],30,this.passExpr],[Br,[Ir],31,this.passExpr],[Ir,[Ae,$,ee],-1,this.makeFunctionCallExpr1],[Ir,[Ae,$,Pr,Or,Ce,ee],-1,this.makeFunctionCallExpr2],[Or,[ne,Pr],-1,this.makeArgumentExpr],[Hr,[Gr],20,this.passExpr],[Hr,[Hr,J,Gr],20,this.makeUnionExpr],[Gr,[Nr],20,this.passExpr],[Gr,[Mr],19,this.passExpr],[Gr,[Mr,Z,Sr],19,this.makePathExpr1],[Gr,[Mr,Y,Sr],19,this.makePathExpr2],[Mr,[Br,Lr,Ce],31,this.makeFilterExpr],[Pr,[Br],16,this.passExpr],[Pr,[Hr],16,this.passExpr],[Pr,[fe,Pr],-1,this.makeUnaryMinusExpr],[Pr,[Pr,oe,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,ie,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,se,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,le,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,he,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,pe,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,ce,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,ue,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,de,Pr],-1,this.makeBinaryExpr,Te],[Pr,[Pr,fe,Pr],-1,this.makeBinaryExpr,Te],[Pr,[Pr,we,Pr],-1,this.makeBinaryExpr,Te],[Pr,[Pr,ge,Pr],-1,this.makeBinaryExpr,Te],[Pr,[Pr,me,Pr],-1,this.makeBinaryExpr,Te],[Rr,[Ee],-1,this.makeLiteralExpr],[Rr,[qe],-1,this.makeLiteralExpr],[Ur,[De],-1,this.makeNumberExpr],[Fr,[ye,Ae],200,this.makeVariableReference]],this.xPathParseCache={},this.xPathRules=[]}return e.prototype.makeTokenExpr=function(e){return new Ue(e)},e.prototype.passExpr=function(e){return e},e.prototype.makeLocationExpr1=function(e,r){return r.absolute=!0,r},e.prototype.makeLocationExpr2=function(e,r){return r.absolute=!0,r.prependStep(this.makeAbbrevStep(e.value)),r},e.prototype.makeLocationExpr3=function(){var e=new Le(this);return e.appendStep(this.makeAbbrevStep(".")),e.absolute=!0,e},e.prototype.makeLocationExpr4=function(e){var r=new Le(this);return r.absolute=!0,r.appendStep(this.makeAbbrevStep(e.value)),r},e.prototype.makeLocationExpr5=function(e){var r=new Le(this);return r.appendStep(e),r},e.prototype.makeLocationExpr6=function(e,r,t){return e.appendStep(t),e},e.prototype.makeLocationExpr7=function(e,r,t){return e.appendStep(this.makeAbbrevStep(r.value)),e.appendStep(t),e},e.prototype.makeStepExpr1=function(e){return this.makeAbbrevStep(e.value)},e.prototype.makeStepExpr2=function(e){return this.makeAbbrevStep(e.value)},e.prototype.makeStepExpr3=function(e,r,t){return new Fe(e.value,t,this)},e.prototype.makeStepExpr4=function(e,r){return new Fe("attribute",r,this)},e.prototype.makeStepExpr5=function(e){return new Fe("child",e,this)},e.prototype.makeStepExpr6=function(e,r){return e.appendPredicate(r),e},e.prototype.makeAbbrevStep=function(e){switch(e){case"//":return new Fe("descendant-or-self",new x,this);case".":return new Fe("self",new x,this);case"..":return new Fe("parent",new x,this)}},e.prototype.makeNodeTestExpr1=function(){return new Er},e.prototype.makeNodeTestExpr2=function(e){return new Dr(e.value)},e.prototype.makeNodeTestExpr3=function(e){return new qr(e.value)},e.prototype.makeNodeTestExpr4=function(e){switch(e.value.replace(/\s*\($/,"")){case"node":return new x;case"text":return new kr;case"comment":return new wr;case"processing-instruction":return new Ar("")}},e.prototype.makeNodeTestExpr5=function(e,r){var t=e.replace(/\s*\($/,"");if("processing-instruction"!=t)throw t;return new Ar(r.value)},e.prototype.makePredicateExpr=function(e,r){return new Be(r)},e.prototype.makePrimaryExpr=function(e,r){return r},e.prototype.makeFunctionCallExpr1=function(e){return new v(e)},e.prototype.makeFunctionCallExpr2=function(e,r,t,a){var n=new v(e);n.appendArg(t);for(var o=0;o<a.length;++o)n.appendArg(a[o]);return n},e.prototype.makeArgumentExpr=function(e,r){return r},e.prototype.makeUnionExpr=function(e,r,t){return new Oe(e,t)},e.prototype.makePathExpr1=function(e,r,t){return new Pe(e,t)},e.prototype.makePathExpr2=function(e,r,t){return t.prependStep(this.makeAbbrevStep(r.value)),new Pe(e,t)},e.prototype.makeFilterExpr=function(e,r){return r.length>0?new m(e,r):e},e.prototype.makeUnaryMinusExpr=function(e,r){return new Ie(r)},e.prototype.makeBinaryExpr=function(e,r,t){return new g(e,r,t)},e.prototype.makeLiteralExpr=function(e){var r=e.value.substring(1,e.value.length-1);return new y(r)},e.prototype.makeNumberExpr=function(e){return new Re(e.value)},e.prototype.makeVariableReference=function(e,r){return new Ge(r.value)},e.prototype.makeSimpleExpr=function(e){if("$"==e.charAt(0))return new Ge(e.substr(1));if("@"==e.charAt(0)){var r=new qr(e.substr(1)),t=new Fe("attribute",r,this),a=new Le(this);return a.appendStep(t),a}if(e.match(/^[0-9]+$/))return new Re(e);var n=new qr(e),o=new Fe("child",n,this),i=new Le(this);return i.appendStep(o),i},e.prototype.makeSimpleExpr2=function(e){for(var r=e.split("/"),t=new Le(this),a=0;a<r.length;++a){var n=new qr(r[a]),o=new Fe("child",n,this);t.appendStep(o)}return t},e.prototype.stackToString=function(e){for(var r="",t=0;t<e.length;++t)r&&(r+="\n"),r+=e[t].tag.label;return r},e.prototype.xPathCacheLookup=function(e){return this.xPathParseCache[e]},e.prototype.xPathCollectDescendants=function(e,r,t){if(t&&r.getElementsByTagName)je(e,r.getElementsByTagName(t));else for(var a=r.firstChild;a;a=a.nextSibling)e.push(a),this.xPathCollectDescendants(e,a)},e.prototype.xPathCollectDescendantsReverse=function(e,r){for(var t=r.lastChild;t;t=t.previousSibling)e.push(t),this.xPathCollectDescendantsReverse(e,t)},e.prototype.xPathEval=function(e,r){return this.xPathParse(e).evaluate(r)},e.prototype.xPathExtractTagNameFromNodeTest=function(e,r){return e instanceof qr?e.name:r&&e instanceof x||e instanceof Er?"*":void 0},e.prototype.xPathMatchStack=function(e,r){var t,a,n=e.length,o=r.length,i=[];i.matchlength=0;var s=0;for(t=o-1,a=n-1;t>=0&&a>=0;--t,a-=s){s=0;var l=[];if(r[t]==Ce)for(t-=1,i.push(l);a-s>=0&&e[a-s].tag==r[t];)l.push(e[a-s]),s+=1,i.matchlength+=1;else if(r[t]==Se)for(t-=1,i.push(l);a-s>=0&&s<2&&e[a-s].tag==r[t];)l.push(e[a-s]),s+=1,i.matchlength+=1;else if(r[t]==Ve){if(t-=1,i.push(l),e[a].tag!=r[t])return[];for(;a-s>=0&&e[a-s].tag==r[t];)l.push(e[a-s]),s+=1,i.matchlength+=1}else{if(e[a].tag!=r[t])return[];i.push(e[a]),s+=1,i.matchlength+=1}ze(l),l.expr=Me(l,(function(e){return e.expr}))}return ze(i),-1==t?i:[]},e.prototype.xPathParse=function(e,r){void 0===r&&(r=function(e){}),r("parse ".concat(e)),this.xPathParseInit(r);var t=this.xPathCacheLookup(e);if(t)return r(" ... cached"),t;if(e.match(/^(\$|@)?\w+$/i)){var a=this.makeSimpleExpr(e);return this.xPathParseCache[e]=a,r(" ... simple"),a}if(e.match(/^\w+(\/\w+)*$/i)){a=this.makeSimpleExpr2(e);return this.xPathParseCache[e]=a,r(" ... simple 2"),a}for(var n=e,o=[],i=null,s=null,l=!1,u=0,c=0,p=0;!l;){u++,e=e.replace(/^\s*/,""),s=i,i=null;for(var h=null,d="",f=0;f<Ne.length;++f){var g=Ne[f].re.exec(e);if(c++,g&&g.length>0&&g[0].length>d.length){h=Ne[f],d=g[0];break}}for(!h||h!=ge&&h!=me&&h!=ie&&h!=oe||s&&s.tag!=ae&&s.tag!=Y&&s.tag!=Z&&s.tag!=W&&s.tag!=ye||(h=Ae),h?(e=e.substr(d.length),r("token: ".concat(d," -- ").concat(h.label)),i={tag:h,match:d,prec:h.prec?h.prec:0,expr:this.makeTokenExpr(d)}):(r("DONE"),l=!0);this.xPathReduce(o,i,r);)p++,r("stack: ".concat(this.stackToString(o)))}if(r("stack: ".concat(this.stackToString(o))),1!=o.length)throw"XPath parse error ".concat(n,":\n").concat(this.stackToString(o));var m=o[0].expr;return this.xPathParseCache[n]=m,r("XPath parse: ".concat(u," / ").concat(c," / ").concat(p)),m},e.prototype.xPathParseInit=function(e){if(!this.xPathRules.length){var r=[Nr,Sr,Cr,Vr,Tr,Lr,Rr,Pr,Br,Fr,Ur,Ir,Or,Gr,Hr,Mr,zr];this.xPathGrammarRules.sort((function(e,r){var t=e[1].length,a=r[1].length;return t<a?1:t>a?-1:0}));for(var t=1,a=0;a<r.length;++a)r[a].key=t++;for(a=0;a<Ne.length;++a)Ne[a].key=t++;e("XPath parse INIT: ".concat(t," rules"));for(a=0;a<this.xPathGrammarRules.length;++a)for(var n=this.xPathGrammarRules[a],o=n[1],i=o.length-1;i>=0;--i){if(o[i]==Ve){l(this.xPathRules,o[i-1].key,n);break}if(o[i]!=Ce&&o[i]!=Se){l(this.xPathRules,o[i].key,n);break}l(this.xPathRules,o[i-1].key,n),--i}e("XPath parse INIT: ".concat(this.xPathRules.length," rule bins"));var s=0;!function(e,r){for(var t=0;t<e.length;++t)r.call(this,e[t],t)}(this.xPathRules,(function(e){e&&(s+=e.length)})),e("XPath parse INIT: ".concat(s/this.xPathRules.length," average bin size"))}function l(e,r,t){e[r]||(e[r]=[]),e[r].push(t)}},e.prototype.xPathReduce=function(e,r,t){void 0===t&&(t=function(e){});var a,n=null;if(e.length>0){var o=e[e.length-1],i=this.xPathRules[o.tag.key];if(i)for(var s=0;s<i.length;++s){var l=i[s],u=this.xPathMatchStack(e,l[1]);if(u.length){(n={tag:l[0],rule:l,match:u}).prec=this.xPathGrammarPrecedence(n);break}}}if(n&&(!r||n.prec>r.prec||r.tag.left&&n.prec>=r.prec)){for(s=0;s<n.match.matchlength;++s)e.pop();t("reduce ".concat(n.tag.label," ").concat(n.prec," ahead ").concat(r?r.tag.label+" "+r.prec+(r.tag.left?" left":""):" none "));var c=Me(n.match,(function(e){return e.expr}));t("going to apply ".concat(n.rule[3])),n.expr=n.rule[3].apply(this,c),e.push(n),a=!0}else r&&(t("shift ".concat(r.tag.label," ").concat(r.prec).concat(r.tag.left?" left":""," over ").concat(n?n.tag.label+" "+n.prec:" none")),e.push(r)),a=!1;return a},e.prototype.xPathSort=function(e,r){if(0!=r.length){for(var t=[],a=0;a<e.contextSize();++a){for(var n=e.nodelist[a],o={node:n,key:[]},i=e.clone([n],0),s=0,l=r;s<l.length;s++){var u=l[s],c=u.expr.evaluate(i),p=void 0;"text"==u.type?p=c.stringValue():"number"==u.type&&(p=c.numberValue()),o.key.push({value:p,order:u.order})}o.key.push({value:a,order:"ascending"}),t.push(o)}t.sort(this.xPathSortByKey);var h=[];for(a=0;a<t.length;++a)h.push(t[a].node);e.nodelist=h,e.setNode(0)}},e.prototype.xPathSortByKey=function(e,r){for(var t=0;t<e.key.length;++t){var a="descending"==e.key[t].order?-1:1;if(e.key[t].value>r.key[t].value)return 1*a;if(e.key[t].value<r.key[t].value)return-1*a}return 0},e.prototype.xPathStep=function(e,r,t,a,n){var o=r[t],i=n.clone([a],0);if(n.returnOnFirstMatch&&!o.hasPositionalPredicate){var s=(p=o.evaluate(i).nodeSetValue()).length,l=o.predicate.length;e:for(var u=0;u<s;++u){for(var c=0;c<l;++c)if(!o.predicate[c].evaluate(n.clone(p,u)).booleanValue())continue e;if(t==r.length-1?e.push(p[u]):this.xPathStep(e,r,t+1,p[u],n),e.length>0)break}}else{i.returnOnFirstMatch=!1;var p=o.evaluate(i).nodeSetValue();for(u=0;u<p.length;++u)t==r.length-1?e.push(p[u]):this.xPathStep(e,r,t+1,p[u],n)}},e.prototype.xPathGrammarPrecedence=function(e){var r=0;if(e.rule)if(e.rule.length>=3&&e.rule[2]>=0)r=e.rule[2];else for(var t=0;t<e.rule[1].length;++t){var a=this.xPathTokenPrecedence(e.rule[1][t]);r=Math.max(r,a)}else if(e.tag)r=this.xPathTokenPrecedence(e.tag);else if(e.length)for(var n=0;n<e.length;++n){a=this.xPathGrammarPrecedence(e[n]);r=Math.max(r,a)}return r},e.prototype.xPathTokenPrecedence=function(e){return e.prec||2},e}(),_r=function(){function e(e){void 0===e&&(e={escape:!0}),this.xPath=new jr,this.options=e,this.outputMethod="xml",this.outputOmitXmlDeclaration="no"}return e.prototype.xsltProcess=function(e,r,t){var a=new Ze;a.appendChild(Ye.clone(e.childNodes[0],a));var n=new xr([a]);if(t&&"object"==typeof t)for(var o=0,i=Object.entries(t);o<i.length;o++){var s=i[o],l=s[0],u=s[1];n.setVariable(l,new b(u))}return this.xsltProcessContext(n,r,a,t),function(e,r){void 0===r&&(r={cData:!1,escape:!0});var t=[];return dr(e,t,r),t.join("")}(a,{cData:!1,escape:this.options.escape})},e.prototype.xsltProcessContext=function(e,o,l,u){var c=vr(l);if(this.isXsltElement(o)){var p,h,d,f=void 0,g=void 0,m=void 0,b=void 0,v=void 0,y=void 0,x=void 0,w=void 0,E=void 0,q=void 0,D=void 0;switch(o.localName){case"apply-imports":case"attribute-set":case"decimal-format":case"fallback":case"import":case"include":case"key":case"message":case"namespace-alias":case"number":case"preserve-space":case"processing-instruction":case"strip-space":throw"not implemented: ".concat(o.localName);case"apply-templates":v=(m=br(o,"select"))?this.xPath.xPathEval(m,e).nodeSetValue():e.nodelist[e.position].childNodes,y=e.clone(v,0),this.xsltWithParam(y,o),this.xsltSort(y,o),x=br(o,"mode"),h=o.ownerDocument.documentElement,w=[];for(var A=0;A<h.childNodes.length;++A){var k=(S=h.childNodes[A]).getAttributeValue("match");k&&k.startsWith("/")||(S.nodeType!=r||!this.isXsltElement(S,"template")||x&&S.getAttributeValue("mode")!=x||w.push(S))}for(var N=0;N<y.contextSize();++N)for(A=0;A<w.length;++A)this.xsltProcessContext(y.clone(y.nodelist,N),w[A],l);break;case"attribute":f=br(o,"name"),p=this.xsltAttributeValue(f,e),g=cr(c),this.xsltChildNodes(e,o,g),b=function(e,o){if(void 0===o&&(o=!1),!e)return"";var l="";if(e.nodeType==a||e.nodeType==n)l+=e.nodeValue;else if(e.nodeType==t)l+=e.nodeValue;else if(e.nodeType==r||e.nodeType==i||e.nodeType==s){if(!o){var u=e.innerText;if(null!=u)return u;var c=e.textContent;if(null!=c)return c}for(var p=e.transformedChildNodes.length,h=0;h<p;++h)l+=hr(e.transformedChildNodes[h])}return l}(g),tr(l,p,b);break;case"call-template":p=br(o,"name"),h=o.ownerDocument.documentElement,E=e.clone(),this.xsltWithParam(E,o);for(A=0;A<h.childNodes.length;++A){var S;if((S=h.childNodes[A]).nodeType==r&&this.isXsltElement(S,"template")&&er(S,"name")==p){this.xsltChildNodes(E,S,l);break}}break;case"choose":this.xsltChoose(e,o,l);break;case"comment":g=cr(c),this.xsltChildNodes(e,o,g),q=ur(c,hr(g)),l.appendChild(q);break;case"copy":(g=this.xsltCopy(l,e.nodelist[e.position],c))&&this.xsltChildNodes(e,o,g);break;case"copy-of":if(m=br(o,"select"),"node-set"==(b=this.xPath.xPathEval(m,e)).type){v=b.nodeSetValue();for(A=0;A<v.length;++A)this.xsltCopyOf(l,v[A],c)}else{ar(l,or(c,b.stringValue()))}break;case"element":f=br(o,"name"),g=sr(c,p=this.xsltAttributeValue(f,e));var C=e.nodelist[e.position];g.childNodes=C.childNodes,g.transformedNodeName=p,nr(l,g),this.xsltChildNodes(e,o,g);break;case"for-each":this.xsltForEach(e,o,l);break;case"if":d=br(o,"test"),this.xPath.xPathEval(d,e).booleanValue()&&this.xsltChildNodes(e,o,l);break;case"otherwise":case"when":case"with-param":default:throw"error if here: ".concat(o.localName);case"output":this.outputMethod=br(o,"method"),this.outputOmitXmlDeclaration=br(o,"omit-xml-declaration");break;case"sort":break;case"stylesheet":case"transform":this.xsltChildNodes(e,o,l);break;case"template":(D=br(o,"match"))&&this.xsltMatch(D,e)&&this.xsltChildNodes(e,o,l);break;case"text":g=ir(c,hr(o));var V=o.attributes.filter((function(e){return"disable-output-escaping"===e.nodeName}));V.length>0&&"yes"===V[0].nodeValue&&(g.escape=!1),l.appendTransformedChild(g);break;case"value-of":m=br(o,"select"),g=ir(c,b=this.xPath.xPathEval(m,e).stringValue()),e.nodelist[e.position].appendTransformedChild(g);break;case"param":this.xsltVariable(e,o,!1);break;case"variable":this.xsltVariable(e,o,!0)}}else this.xsltPassThrough(e,o,l,c)},e.prototype.xsltCopy=function(e,i,s){if(i.nodeType==r)return(l=sr(s,i.nodeName)).transformedNodeName=i.nodeName,nr(e,l),l;if(i.nodeType==a)nr(e,l=ir(s,i.nodeValue));else if(i.nodeType==n){nr(e,l=lr(s,i.nodeValue))}else if(i.nodeType==o){var l;nr(e,l=ur(s,i.nodeValue))}else i.nodeType==t&&tr(e,i.nodeName,i.nodeValue);return null},e.prototype.xsltSort=function(e,t){for(var a=[],n=0,o=t.childNodes;n<o.length;n++){var i=o[n];if(i.nodeType==r&&this.isXsltElement(i,"sort")){var s=br(i,"select"),l=this.xPath.xPathParse(s),u=br(i,"data-type")||"text",c=br(i,"order")||"ascending";a.push({expr:l,type:u,order:c})}}this.xPath.xPathSort(e,a)},e.prototype.xsltVariable=function(e,r,t){var a,n=br(r,"name"),o=br(r,"select");if(r.childNodes.length>0){var i=cr(r.ownerDocument);this.xsltChildNodes(e,r,i),a=new yr([i])}else a=o?this.xPath.xPathEval(o,e):new b("");!t&&e.getVariable(n)||e.setVariable(n,a)},e.prototype.xsltChoose=function(e,t,a){for(var n=0,o=t.childNodes;n<o.length;n++){var i=o[n];if(i.nodeType===r)if(this.isXsltElement(i,"when")){var s=br(i,"test");if(this.xPath.xPathEval(s,e).booleanValue()){this.xsltChildNodes(e,i,a);break}}else if(this.isXsltElement(i,"otherwise")){this.xsltChildNodes(e,i,a);break}}},e.prototype.xsltForEach=function(e,r,t){var a=br(r,"select"),n=this.xPath.xPathEval(a,e).nodeSetValue(),o=e.clone(n,0);this.xsltSort(o,r);var i=o.nodelist.filter((function(e){return null!==e.parentNode&&void 0!==e.parentNode}));if(i.length<=0)throw new Error("Nodes with no parents defined.");i[0].parentNode.childNodes=o.nodelist;for(var s=0;s<o.contextSize();++s)this.xsltChildNodes(o.clone(o.nodelist,s),r,t)},e.prototype.groupBy=function(e,r){return e.reduce((function(e,t){return(e[t[r]]=e[t[r]]||[]).push(t),e}),{})},e.prototype.xsltChildNodes=function(e,r,t){for(var a=e.clone(),n=0;n<r.childNodes.length;++n)this.xsltProcessContext(a,r.childNodes[n],t)},e.prototype.xsltPassThrough=function(e,t,n,o){if(t.nodeType==a){if(this.xsltPassText(t)){var i=e.nodelist[e.position].transformedChildNodes.filter((function(e){return e.nodeType===a}));if(i.length>0){(s=i[0]).transformedNodeValue=t.nodeValue}else{var s=or(o,t.nodeValue);nr(e.nodelist[e.position],s)}}}else if(t.nodeType==r){s=void 0;(s="#document"===e.nodelist[e.position].nodeName?e.nodelist[e.position].firstChild:e.nodelist[e.position]).transformedNodeName=t.nodeName,s.transformedLocalName=t.localName;for(var l=0,u=t.attributes.filter((function(e){return e}));l<u.length;l++){var c=u[l];tr(s,c.nodeName,this.xsltAttributeValue(c.nodeValue,e))}this.xsltChildNodes(e,t,s)}else this.xsltChildNodes(e,t,n)},e.prototype.xsltPassText=function(e){if(!e.nodeValue.match(/^\s*$/))return!0;var t=e.parentNode;if(this.isXsltElement(t,"text"))return!0;for(;t&&t.nodeType==r;){var a=er(t,"xml:space");if(a){if("default"==a)return!1;if("preserve"==a)return!0}t=t.parentNode}return!1},e.prototype.xsltAttributeValue=function(e,r){var t=e.split("{");if(1==t.length)return e;for(var a="",n=0;n<t.length;++n){var o=t[n].split("}");if(2==o.length)a+=this.xPath.xPathEval(o[0],r).stringValue()+o[1];else a+=t[n]}return a},e.prototype.xsltCopyOf=function(e,r,t){if(r.nodeType==s||r.nodeType==i)for(var a=0;a<r.childNodes.length;++a)this.xsltCopyOf(e,r.childNodes[a],t);else{var n=this.xsltCopy(e,r,t);if(n){for(a=0;a<r.attributes.length;++a)this.xsltCopyOf(n,r.attributes[a],t);for(a=0;a<r.childNodes.length;++a)this.xsltCopyOf(n,r.childNodes[a],t)}}},e.prototype.xsltMatch=function(e,r){var t=this.xPath.xPathParse(e);return!(t instanceof Le)||this.xsltLocationExpressionMatch(e,t,r)},e.prototype.xsltLocationExpressionMatch=function(e,r,t){if(void 0===r||void 0===r.steps||r.steps.length<=0)throw new Error("Error resolving XSLT match: Location Expression should have steps.");var a=r.steps[0];if(r.steps&&!r.absolute&&1==r.steps.length&&"child"==a.axis&&0===a.predicate.length)return a.nodetest.evaluate(t).booleanValue();if(r.absolute&&"self"!==a.axis){var n=e.split("/");if(n.length>1)return this.absoluteXsltMatch(n,r,t)}return this.relativeXsltMatch(r,t)},e.prototype.xsltWithParam=function(e,t){for(var a=0,n=t.childNodes;a<n.length;a++){var o=n[a];o.nodeType===r&&this.isXsltElement(o,"with-param")&&this.xsltVariable(e,o,!0)}},e.prototype.absoluteXsltMatch=function(e,r,t){var a=r.evaluate(t.clone([t.nodelist[t.position]],0)).nodeSetValue();return a.length>0&&(t.nodelist=a,!0)},e.prototype.relativeXsltMatch=function(e,r){for(var t=r.nodelist[r.position];t;){for(var a=e.evaluate(r.clone([t],0)).nodeSetValue(),n=0;n<a.length;++n)if(a[n]==r.nodelist[r.position])return!0;t=t.parentNode}return!1},e.prototype.isXsltElement=function(e,r){return(!r||e.localName==r)&&(e.namespaceURI?"http://www.w3.org/1999/XSL/Transform"===e.namespaceURI:"xsl"===e.prefix)},e}();e.ExprContext=xr,e.XPath=jr,e.Xslt=_r,e.xmlEscapeText=gr,e.xmlParse=function(e){var r,t,a=/\/$/;if(e.match(/^<\?xml/))if(5==e.search(new RegExp(D)))r=We,t=Ke;else{if(5!=e.search(new RegExp(B)))throw new Error("VersionInfo is missing, or unknown version number.");r=Qe,t=$e}else r=We,t=Ke;var n=new Ze,o=n,i=[],s=o;i.push(s);for(var l,u=!1,p=!1,h=!1,d=0,f=0;f<e.length;++f){var g=e.charAt(f);if(u&&!h&&"'"===g)p=!p;else if(u&&!p&&'"'===g)h=!h;else if(!u||">"!==g||p||h){if(!u&&"<"===g){if((v=e.slice(d,f))&&s!=o&&ar(s,or(n,v)),"!--"===e.slice(f+1,f+4)){if(m=e.slice(f+4).indexOf("--\x3e"))ar(s,x=ur(n,e.slice(f+4,f+m+4))),f+=m+6}else if("![CDATA["===e.slice(f+1,f+9)){if(m=e.slice(f+9).indexOf("]]>"))ar(s,x=lr(n,e.slice(f+9,f+m+9))),f+=m+11}else if("!DOCTYPE"===e.slice(f+1,f+9)){var m;if(m=e.slice(f+9).indexOf(">")){var b=e.slice(f+9,f+m+9).trimStart();x=void 0;"xsl:text"===s.nodeName?x=or(n,"<!DOCTYPE ".concat(b,">")):(l=b,x=n.createDTDSection(l)),ar(s,x),f+=m+b.length+5}}else u=!0;d=f+1}}else{var v;if("/"==(v=e.slice(d,f)).charAt(0))i.pop(),s=i[i.length-1];else if("?"===v.charAt(0));else if("!"===v.charAt(0));else{for(var y=v.match(a),x=sr(n,r.exec(v)[1]),w=void 0;w=t.exec(v);){var E=c.decode(w[5]||w[7]||"");rr(x,w[1],E)}ar(s,x),y||(s=x,i.push(x));var q=Je(x);null!==x.prefix?x.prefix in q&&(x.namespaceURI=q[x.prefix]):""in q&&(x.namespaceURI=q[""]);for(var A=0;A<x.attributes.length;++A)null!==x.attributes[A].prefix&&x.attributes[A].prefix in q&&(x.attributes[A].namespaceURI=q[x.attributes[A].prefix])}d=f+1,u=!1,p=!1,h=!1}}return o},Object.defineProperty(e,"__esModule",{value:!0})}));
15
+ ***************************************************************************** */function h(e,r){function t(){this.constructor=e}p(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}var d=function(){function e(e){this.value=e,this.type="number"}return e.prototype.stringValue=function(){return"".concat(this.value)},e.prototype.booleanValue=function(){return!!this.value},e.prototype.numberValue=function(){return this.value-0},e.prototype.nodeSetValue=function(){throw this},e}(),f=function(){},g=function(e){function r(r,t,a){var n=e.call(this)||this;return n.expr1=r,n.expr2=a,n.op=t,n}return h(r,e),r.prototype.evaluate=function(e){var r;switch(this.op.value){case"or":r=new l(this.expr1.evaluate(e).booleanValue()||this.expr2.evaluate(e).booleanValue());break;case"and":r=new l(this.expr1.evaluate(e).booleanValue()&&this.expr2.evaluate(e).booleanValue());break;case"+":r=new d(this.expr1.evaluate(e).numberValue()+this.expr2.evaluate(e).numberValue());break;case"-":r=new d(this.expr1.evaluate(e).numberValue()-this.expr2.evaluate(e).numberValue());break;case"*":r=new d(this.expr1.evaluate(e).numberValue()*this.expr2.evaluate(e).numberValue());break;case"mod":r=new d(this.expr1.evaluate(e).numberValue()%this.expr2.evaluate(e).numberValue());break;case"div":r=new d(this.expr1.evaluate(e).numberValue()/this.expr2.evaluate(e).numberValue());break;case"=":r=this.compare(e,(function(e,r){return e==r}));break;case"!=":r=this.compare(e,(function(e,r){return e!=r}));break;case"<":r=this.compare(e,(function(e,r){return e<r}));break;case"<=":r=this.compare(e,(function(e,r){return e<=r}));break;case">":r=this.compare(e,(function(e,r){return e>r}));break;case">=":r=this.compare(e,(function(e,r){return e>=r}));break;default:throw"BinaryExpr.evaluate: ".concat(this.op.value)}return r},r.prototype.compare=function(e,r){var t,a=this.expr1.evaluate(e),n=this.expr2.evaluate(e);if("node-set"==a.type&&"node-set"==n.type){var o=a.nodeSetValue(),i=n.nodeSetValue();t=!1;for(var s=0;s<o.length;++s)for(var u=0;u<i.length;++u)r(hr(o[s]),hr(i[u]))&&(t=!0,u=i.length,s=o.length)}else if("node-set"==a.type||"node-set"==n.type)if("number"==a.type){var c=a.numberValue(),p=n.nodeSetValue();t=!1;for(var h=0;h<p.length;++h){if(r(c,hr(p[h])-0)){t=!0;break}}}else if("number"==n.type){p=a.nodeSetValue(),c=n.numberValue();t=!1;for(h=0;h<p.length;++h){if(r(hr(p[h])-0,c)){t=!0;break}}}else if("string"==a.type){c=a.stringValue(),p=n.nodeSetValue();t=!1;for(h=0;h<p.length;++h){if(r(c,hr(p[h]))){t=!0;break}}}else if("string"==n.type){p=a.nodeSetValue(),c=n.stringValue();t=!1;for(h=0;h<p.length;++h){if(r(hr(p[h]),c)){t=!0;break}}}else t=r(a.booleanValue(),n.booleanValue());else t="boolean"==a.type||"boolean"==n.type?r(a.booleanValue(),n.booleanValue()):"number"==a.type||"number"==n.type?r(a.numberValue(),n.numberValue()):r(a.stringValue(),n.stringValue());return new l(t)},r}(f),m=function(e){function r(r,t){var a=e.call(this)||this;return a.expr=r,a.predicate=t,a}return h(r,e),r.prototype.evaluate=function(e){var r=e.returnOnFirstMatch;e.setReturnOnFirstMatch(!1);var t=this.expr.evaluate(e).nodeSetValue();e.setReturnOnFirstMatch(r);for(var a=0;a<this.predicate.length;++a){var n=t;t=[];for(var o=0;o<n.length;++o){var i=n[o];this.predicate[a].evaluate(e.clone(n,o)).booleanValue()&&t.push(i)}}return new yr(t)},r}(f),b=function(){function e(e){this.value=e,this.type="string"}return e.prototype.stringValue=function(){return this.value},e.prototype.booleanValue=function(){return this.value.length>0},e.prototype.numberValue=function(){return this.value-0},e.prototype.nodeSetValue=function(){throw this},e}(),v=function(e){function r(r){var t=e.call(this)||this;return t.xpathfunctions={last:function(e){return He(0==this.args.length),new d(e.contextSize())},position:function(e){return He(0==this.args.length),new d(e.position+1)},count:function(e){He(1==this.args.length);var r=this.args[0].evaluate(e);return new d(r.nodeSetValue().length)},"generate-id":function(e){return new b("A"+this.cyrb53(JSON.stringify(e.nodelist[e.position].id)))},id:function(e){He(1==this.args.length);var r,t=this.args[0].evaluate(e),a=[];if("node-set"==t.type){r=[];for(var n=t.nodeSetValue(),o=0;o<n.length;++o)for(var i=hr(n[o]).split(/\s+/),s=0;s<i.length;++s)r.push(i[s])}else r=t.stringValue().split(/\s+/);var l=e.root;for(o=0;o<r.length;++o){var u=l.getElementById(r[o]);u&&a.push(u)}return new yr(a)},"xml-to-json":function(e){return He(this.args.length<2),new b(JSON.stringify(this.args.length?hr(e.nodelist[e.position]):"null"))},"local-name":function(e){var r;return He(1==this.args.length||0==this.args.length),0==(r=0==this.args.length?[e.nodelist[e.position]]:this.args[0].evaluate(e).nodeSetValue()).length?new b(""):new b(r[0].localName)},"namespace-uri":function(e){var r;return He(1==this.args.length||0==this.args.length),0==(r=0==this.args.length?[e.nodelist[e.position]]:this.args[0].evaluate(e).nodeSetValue()).length?new b(""):new b(r[0].namespaceURI||"")},name:function(e){var r;return He(1==this.args.length||0==this.args.length),0==(r=0==this.args.length?[e.nodelist[e.position]]:this.args[0].evaluate(e).nodeSetValue()).length?new b(""):new b(r[0].nodeName)},string:function(e){return He(1==this.args.length||0==this.args.length),0==this.args.length?new b(new yr([e.nodelist[e.position]]).stringValue()):new b(this.args[0].evaluate(e).stringValue())},concat:function(e){for(var r="",t=0;t<this.args.length;++t)r+=this.args[t].evaluate(e).stringValue();return new b(r)},"starts-with":function(e){He(2==this.args.length);var r=this.args[0].evaluate(e).stringValue(),t=this.args[1].evaluate(e).stringValue();return new l(0==r.indexOf(t))},"ends-with":function(e){He(2==this.args.length);var r=this.args[0].evaluate(e).stringValue(),t=this.args[1].evaluate(e).stringValue(),a=new RegExp("".concat(t.replace(_e,"\\$1"),"$"));return new l(a.test(r))},contains:function(e){He(2==this.args.length);var r=this.args[0].evaluate(e).stringValue(),t=this.args[1].evaluate(e).stringValue();return new l(r.includes(t))},"substring-before":function(e){He(2==this.args.length);var r,t=this.args[0].evaluate(e).stringValue(),a=this.args[1].evaluate(e).stringValue(),n=t.indexOf(a);return r=-1==n?"":t.substr(0,n),new b(r)},"substring-after":function(e){He(2==this.args.length);var r,t=this.args[0].evaluate(e).stringValue(),a=this.args[1].evaluate(e).stringValue(),n=t.indexOf(a);return r=-1==n?"":t.substr(n+a.length),new b(r)},substring:function(e){He(2==this.args.length||3==this.args.length);var r,t=this.args[0].evaluate(e).stringValue(),a=this.args[1].evaluate(e).numberValue();if(2==this.args.length){var n=Math.max(0,Math.round(a)-1);r=t.substr(n)}else{var o=this.args[2].evaluate(e).numberValue(),i=Math.round(a)-1,s=(n=Math.max(0,i),Math.round(o)-Math.max(0,-i));r=t.substr(n,s)}return new b(r)},"string-length":function(e){var r;return r=this.args.length>0?this.args[0].evaluate(e).stringValue():new yr([e.nodelist[e.position]]).stringValue(),new d(r.length)},"normalize-space":function(e){var r;return r=(r=this.args.length>0?this.args[0].evaluate(e).stringValue():new yr([e.nodelist[e.position]]).stringValue()).replace(/^\s*/,"").replace(/\s*$/,"").replace(/\s+/g," "),new b(r)},translate:function(e){He(3==this.args.length);for(var r=this.args[0].evaluate(e).stringValue(),t=this.args[1].evaluate(e).stringValue(),a=this.args[2].evaluate(e).stringValue(),n=0;n<t.length;++n)r=r.replace(new RegExp(t.charAt(n),"g"),a.charAt(n));return new b(r)},matches:function(e){He(this.args.length>=2);var r,t,a=this.args[0].evaluate(e).stringValue(),n=this.args[1].evaluate(e).stringValue();if(this.args.length>2&&(r=this.args[2].evaluate(e).stringValue(),/[^mi]/.test(r)))throw"Invalid regular expression syntax: ".concat(r);try{t=new RegExp(n,r)}catch(e){throw"Invalid matches argument: ".concat(n)}return new l(t.test(a))},boolean:function(e){return He(1==this.args.length),new l(this.args[0].evaluate(e).booleanValue())},not:function(e){He(1==this.args.length);var r=!this.args[0].evaluate(e).booleanValue();return new l(r)},true:function(){return He(0==this.args.length),new l(!0)},false:function(){return He(0==this.args.length),new l(!1)},lang:function(e){He(1==this.args.length);for(var r,t=this.args[0].evaluate(e).stringValue(),a=e.nodelist[e.position];a&&a!=a.parentNode&&!(r=a.getAttributeValue("xml:lang"));)a=a.parentNode;if(!r)return new l(!1);var n=new RegExp("^".concat(t,"$"),"i");return new l(r.match(n)||r.replace(/_.*$/,"").match(n))},number:function(e){return He(1==this.args.length||0==this.args.length),1==this.args.length?new d(this.args[0].evaluate(e).numberValue()):new d(new yr([e.nodelist[e.position]]).numberValue())},sum:function(e){He(1==this.args.length);for(var r=this.args[0].evaluate(e).nodeSetValue(),t=0,a=0;a<r.length;++a)t+=hr(r[a])-0;return new d(t)},floor:function(e){He(1==this.args.length);var r=this.args[0].evaluate(e).numberValue();return new d(Math.floor(r))},ceiling:function(e){He(1==this.args.length);var r=this.args[0].evaluate(e).numberValue();return new d(Math.ceil(r))},round:function(e){He(1==this.args.length);var r=this.args[0].evaluate(e).numberValue();return new d(Math.round(r))},"ext-join":function(e){He(2==this.args.length);for(var r=this.args[0].evaluate(e).nodeSetValue(),t=this.args[1].evaluate(e).stringValue(),a="",n=0;n<r.length;++n)a&&(a+=t),a+=hr(r[n]);return new b(a)},"ext-if":function(e){return He(3==this.args.length),this.args[0].evaluate(e).booleanValue()?this.args[1].evaluate(e):this.args[2].evaluate(e)},"ext-cardinal":function(e){He(this.args.length>=1);for(var r=this.args[0].evaluate(e).numberValue(),t=[],a=0;a<r;++a)t.push(e.nodelist[e.position]);return new yr(t)}},t.name=r,t.args=[],t}return h(r,e),r.prototype.cyrb53=function(e,r){void 0===r&&(r=0);for(var t=3735928559^r,a=1103547991^r,n=0,o=void 0;n<e.length;n++)o=e.charCodeAt(n),t=Math.imul(t^o,2654435761),a=Math.imul(a^o,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(a^a>>>13,3266489909),a=Math.imul(a^a>>>16,2246822507),4294967296*(2097151&(a^=Math.imul(t^t>>>13,3266489909)))+(t>>>0)},r.prototype.appendArg=function(e){this.args.push(e)},r.prototype.evaluate=function(e){var r="".concat(this.name.value),t=this.xpathfunctions[r];return t?t.call(this,e):new l(!1)},r}(f),y=function(e){function r(r){var t=e.call(this)||this;return t.value=r,t}return h(r,e),r.prototype.evaluate=function(){return new b(this.value)},r}(f),x=function(){function e(){this.value=new l(!0)}return e.prototype.evaluate=function(){return this.value},e}(),w="[ \t\r\n]+",E="(".concat(w,")?=(").concat(w,")?"),q="&#[0-9]+;|&#x[0-9a-fA-F]+;",D="".concat(w,"version").concat(E,"(\"1\\.0\"|'1\\.0')"),A="̀-͠ͅ-҃͡-֑҆-֣֡-ֹֻ-ֽֿׁ-ׂًׄ-ْٰۖ-ۜ۝-۟۠-ۤۧ-۪ۨ-ۭँ-ः़ा-ौ्॑-॔ॢ-ॣঁ-ঃ়ািী-ৄে-ৈো-্ৗৢ-ৣਂ਼ਾਿੀ-ੂੇ-ੈੋ-੍ੰ-ੱઁ-ઃ઼ા-ૅે-ૉો-્ଁ-ଃ଼ା-ୃେ-ୈୋ-୍ୖ-ୗஂ-ஃா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕ-ౖಂ-ಃಾ-ೄೆ-ೈೊ-್ೕ-ೖം-ഃാ-ൃെ-ൈൊ-്ൗัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-༹༙༵༷༾༿ཱ-྄྆-ྋྐ-ྕྗྙ-ྭྱ-ྷྐྵ⃐-〪⃜⃡-゙゚〯",k="0-9٠-٩۰-۹०-९০-৯੦-੯૦-૯୦-୯௧-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩",N="·ːˑ·ـๆໆ々〱-〵ゝ-ゞー-ヾ",S="A-Za-zÀ-ÖØ-öø-ÿĀ-ıĴ-ľŁ-ňŊ-žƀ-ǃǍ-ǰǴ-ǵǺ-ȗɐ-ʨʻ-ˁΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϖϚϜϞϠϢ-ϳЁ-ЌЎ-яё-ќў-ҁҐ-ӄӇ-ӈӋ-ӌӐ-ӫӮ-ӵӸ-ӹԱ-Ֆՙա-ֆא-תװ-ײء-غف-يٱ-ڷں-ھۀ-ێې-ۓەۥ-ۦअ-हऽक़-ॡঅ-ঌএ-ঐও-নপ-রলশ-হড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઋઍએ-ઑઓ-નપ-રલ-ળવ-હઽૠଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଶ-ହଽଡ଼-ଢ଼ୟ-ୡஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-வஷ-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡก-ฮะา-ำเ-ๅກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ຮະາ-ຳຽເ-ໄཀ-ཇཉ-ཀྵႠ-Ⴥა-ჶᄀᄂ-ᄃᄅ-ᄇᄉᄋ-ᄌᄎ-ᄒᄼᄾᅀᅌᅎᅐᅔ-ᅕᅙᅟ-ᅡᅣᅥᅧᅩᅭ-ᅮᅲ-ᅳᅵᆞᆨᆫᆮ-ᆯᆷ-ᆸᆺᆼ-ᇂᇫᇰᇹḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼΩK-Å℮ↀ-ↂぁ-ゔァ-ヺㄅ-ㄬ가-힣一-龥〇〡-〩",C="".concat(S+k,"\\._:").concat(A).concat(N,"-"),V="[".concat(S,"_:][").concat(C,"]*"),T="&".concat(V,";"),L="".concat(T,"|").concat(q),R='"(([^<&"]|'.concat(L,")*)\"|'(([^<&']|").concat(L,")*)'"),P="(".concat(V,")").concat(E,"(").concat(R,")"),B="".concat(w,"version").concat(E,"(\"1\\.1\"|'1\\.1')"),F=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",U=F+"\\.0-9·̀-ͯ‿-⁀-",I="[".concat(F,"][").concat(U,"]*"),O="&".concat(I,";"),G="".concat(O,"|").concat(q),H='"(([^<&"]|'.concat(G,")*)\"|'(([^<&']|").concat(G,")*)'"),M="(".concat(I,")").concat(E,"(").concat(H,")"),z="".concat(S+k,"\\._").concat(A).concat(N,"-"),j="[".concat(S,"_][").concat(z,"]*"),_={ANCESTOR_OR_SELF:"ancestor-or-self",ANCESTOR:"ancestor",ATTRIBUTE:"attribute",CHILD:"child",DESCENDANT_OR_SELF:"descendant-or-self",DESCENDANT:"descendant",FOLLOWING_SIBLING:"following-sibling",FOLLOWING:"following",NAMESPACE:"namespace",PARENT:"parent",PRECEDING_SIBLING:"preceding-sibling",PRECEDING:"preceding",SELF:"self"},X=[_.ANCESTOR_OR_SELF,_.ANCESTOR,_.ATTRIBUTE,_.CHILD,_.DESCENDANT_OR_SELF,_.DESCENDANT,_.FOLLOWING_SIBLING,_.FOLLOWING,_.NAMESPACE,_.PARENT,_.PRECEDING_SIBLING,_.PRECEDING,_.SELF].join("(?=::)|")+"(?=::)",J={label:"|",prec:17,re:new RegExp("^\\|"),key:void 0},Y={label:"//",prec:19,re:new RegExp("^//"),key:void 0},Z={label:"/",prec:30,re:new RegExp("^/"),key:void 0},W={label:"::",prec:20,re:new RegExp("^::"),key:void 0},K={label:":",prec:1e3,re:new RegExp("^:"),key:void 0},Q={label:"[axis]",re:new RegExp("^(".concat(X,")")),key:void 0},$={label:"(",prec:34,re:new RegExp("^\\("),key:void 0},ee={label:")",re:new RegExp("^\\)"),key:void 0},re={label:"..",prec:34,re:new RegExp("^\\.\\."),key:void 0},te={label:".",prec:34,re:new RegExp("^\\."),key:void 0},ae={label:"@",prec:34,re:new RegExp("^@"),key:void 0},ne={label:",",re:new RegExp("^,"),key:void 0},oe={label:"or",prec:10,re:new RegExp("^or\\b"),key:void 0},ie={label:"and",prec:11,re:new RegExp("^and\\b"),key:void 0},se={label:"=",prec:12,re:new RegExp("^="),key:void 0},le={label:"!=",prec:12,re:new RegExp("^!="),key:void 0},ue={label:">=",prec:13,re:new RegExp("^>="),key:void 0},ce={label:">",prec:13,re:new RegExp("^>"),key:void 0},pe={label:"<=",prec:13,re:new RegExp("^<="),key:void 0},he={label:"<",prec:13,re:new RegExp("^<"),key:void 0},de={label:"+",prec:14,re:new RegExp("^\\+"),left:!0,key:void 0},fe={label:"-",prec:14,re:new RegExp("^\\-"),left:!0,key:void 0},ge={label:"div",prec:15,re:new RegExp("^div\\b"),left:!0,key:void 0},me={label:"mod",prec:15,re:new RegExp("^mod\\b"),left:!0,key:void 0},be={label:"[",prec:32,re:new RegExp("^\\["),key:void 0},ve={label:"]",re:new RegExp("^\\]"),key:void 0},ye={label:"$",re:new RegExp("^\\$"),key:void 0},xe={label:"[ncname]",re:new RegExp("^".concat(j)),key:void 0},we={label:"*",prec:15,re:new RegExp("^\\*"),left:!0,key:void 0},Ee={label:"[litq]",prec:20,re:new RegExp("^'[^\\']*'"),key:void 0},qe={label:"[litqq]",prec:20,re:new RegExp('^"[^\\"]*"'),key:void 0},De={label:"[number]",prec:35,re:new RegExp("^\\d+(\\.\\d*)?"),key:void 0},Ae={label:"[qname]",re:new RegExp("^(".concat(j,":)?").concat(j)),key:void 0},ke={label:"[nodetest-start]",re:new RegExp("^(processing-instruction|comment|text|node)\\("),key:void 0},Ne=[Y,Z,re,te,W,K,Q,ke,$,ee,be,ve,ae,ne,oe,ie,le,se,ue,ce,pe,he,de,fe,we,J,me,ge,Ee,qe,De,Ae,xe,ye],Se={label:"?"},Ce={label:"*"},Ve={label:"+"},Te=!0,Le=function(e){function r(r){var t=e.call(this)||this;return t.absolute=!1,t.steps=[],t.xPath=r,t}return h(r,e),r.prototype.appendStep=function(e){var r=this._combineSteps(this.steps[this.steps.length-1],e);r?this.steps[this.steps.length-1]=r:this.steps.push(e)},r.prototype.prependStep=function(e){var r=this._combineSteps(e,this.steps[0]);r?this.steps[0]=r:this.steps.unshift(e)},r.prototype._combineSteps=function(e,r){if(!e)return null;if(!r)return null;var t=e.predicates&&e.predicates.length>0;if(e.nodetest instanceof x&&!t)if(e.axis==_.DESCENDANT_OR_SELF){if(r.axis==_.CHILD);else if(r.axis==_.SELF)return r.axis=_.DESCENDANT_OR_SELF,r}else if(e.axis==_.DESCENDANT&&r.axis==_.SELF)return r.axis=_.DESCENDANT,r;return null},r.prototype.evaluate=function(e){var r;r=this.absolute?e.root:e.nodelist[e.position];var t=[];return this.xPath.xPathStep(t,this.steps,0,r,e),new yr(t)},r}(f),Re=function(e){function r(r){var t=e.call(this)||this;return t.value=r,t}return h(r,e),r.prototype.evaluate=function(){return new d(this.value)},r}(f),Pe=function(e){function r(r,t){var a=e.call(this)||this;return a.filter=r,a.rel=t,a}return h(r,e),r.prototype.evaluate=function(e){var r=this.filter.evaluate(e).nodeSetValue(),t=[];if(e.returnOnFirstMatch){for(var a=0;a<r.length&&!((t=this.rel.evaluate(e.clone(r,a)).nodeSetValue()).length>0);++a);return new yr(t)}for(a=0;a<r.length;++a)for(var n=this.rel.evaluate(e.clone(r,a)).nodeSetValue(),o=0;o<n.length;++o)t.push(n[o]);return new yr(t)},r}(f),Be=function(e){function r(r){var t=e.call(this)||this;return t.expr=r,t}return h(r,e),r.prototype.evaluate=function(e){var r=this.expr.evaluate(e);return"number"==r.type?new l(e.position==r.numberValue()-1):new l(r.booleanValue())},r}(f),Fe=function(e){function r(r,t,a,n){var o=e.call(this)||this;o.axis=r,o.nodetest=t,o.predicate=n||[],o.hasPositionalPredicate=!1,o.xPath=a;for(var i=0;i<o.predicate.length;++i)if(Xe(o.predicate[i].expr)){o.hasPositionalPredicate=!0;break}return o}return h(r,e),r.prototype.appendPredicate=function(e){this.predicate.push(e),this.hasPositionalPredicate||(this.hasPositionalPredicate=Xe(e.expr))},r.prototype.evaluate=function(e){var r=e.nodelist[e.position],a=[],n=!1;if(this.nodetest instanceof x&&(n=!0),this.axis==_.ANCESTOR_OR_SELF){a.push(r);for(var o=r.parentNode;o;o=o.parentNode)a.push(o)}else if(this.axis==_.ANCESTOR)for(o=r.parentNode;o;o=o.parentNode)a.push(o);else if(this.axis==_.ATTRIBUTE)if(null!=this.nodetest.name){if(r.attributes)if(r.attributes instanceof Array)je(a,r.attributes);else if("style"==this.nodetest.name){var i=r.getAttributeValue("style");i&&"string"!=typeof i?a.push(Ye.create(t,"style",i.cssText,document)):a.push(r.attributes[this.nodetest.name])}else a.push(r.attributes[this.nodetest.name])}else e.ignoreAttributesWithoutValue?function(e,r){if(!r)return;for(var t=r.length-1;t>=0;--t)r[t].nodeValue&&e.push(r[t])}(a,r.attributes):je(a,r.attributes);else if(this.axis==_.CHILD)je(a,r.childNodes);else if(this.axis==_.DESCENDANT_OR_SELF){this.nodetest.evaluate(e).booleanValue()&&a.push(r);var s=this.xPath.xPathExtractTagNameFromNodeTest(this.nodetest,e.ignoreNonElementNodesForNTA);this.xPath.xPathCollectDescendants(a,r,s),s&&(n=!0)}else if(this.axis==_.DESCENDANT){s=this.xPath.xPathExtractTagNameFromNodeTest(this.nodetest,e.ignoreNonElementNodesForNTA);this.xPath.xPathCollectDescendants(a,r,s),s&&(n=!0)}else if(this.axis==_.FOLLOWING)for(o=r;o;o=o.parentNode)for(var l=o.nextSibling;l;l=l.nextSibling)a.push(l),this.xPath.xPathCollectDescendants(a,l);else if(this.axis==_.FOLLOWING_SIBLING)for(o=r.nextSibling;o;o=o.nextSibling)a.push(o);else{if(this.axis==_.NAMESPACE)throw new Error("not implemented: axis namespace");if(this.axis==_.PARENT)r.parentNode&&a.push(r.parentNode);else if(this.axis==_.PRECEDING)for(o=r;o;o=o.parentNode)for(l=o.previousSibling;l;l=l.previousSibling)a.push(l),this.xPath.xPathCollectDescendantsReverse(a,l);else if(this.axis==_.PRECEDING_SIBLING)for(o=r.previousSibling;o;o=o.previousSibling)a.push(o);else{if(this.axis!=_.SELF)throw"ERROR -- NO SUCH AXIS: ".concat(this.axis);a.push(r)}}if(!n){var u=a;a=[];for(var c=0;c<u.length;++c)this.nodetest.evaluate(e.clone(u,c)).booleanValue()&&a.push(u[c])}if(!e.returnOnFirstMatch)for(c=0;c<this.predicate.length;++c){u=a;a=[];for(var p=0;p<u.length;++p){o=u[p];this.predicate[c].evaluate(e.clone(u,p)).booleanValue()&&a.push(o)}}return new yr(a)},r}(f),Ue=function(e){function r(r){var t=e.call(this)||this;return t.value=r,t}return h(r,e),r.prototype.evaluate=function(){return new b(this.value)},r}(f),Ie=function(e){function r(r){var t=e.call(this)||this;return t.expr=r,t}return h(r,e),r.prototype.evaluate=function(e){return new d(-this.expr.evaluate(e).numberValue())},r}(f),Oe=function(e){function r(r,t){var a=e.call(this)||this;return a.expr1=r,a.expr2=t,a}return h(r,e),r.prototype.evaluate=function(e){for(var r=this.expr1.evaluate(e).nodeSetValue(),t=this.expr2.evaluate(e).nodeSetValue(),a=r.length,n=0,o=t;n<o.length;n++){for(var i=o[n],s=!1,l=0;l<a;++l)r[l]==i&&(s=!0,l=a);s||r.push(i)}return new yr(r)},r}(f),Ge=function(e){function r(r){var t=e.call(this)||this;return t.name=r,t}return h(r,e),r.prototype.evaluate=function(e){return e.getVariable(this.name)},r}(f);function He(e){if(!e)throw new Error("Assertion failed")}function Me(e,r){for(var t=[],a=0;a<e.length;++a)t.push(r(e[a]));return t}function ze(e){for(var r=0;r<e.length/2;++r){var t=e[r],a=e.length-r-1;e[r]=e[a],e[a]=t}}function je(e,r){if(r)for(var t=e.length,a=r.length-1;a>=0;--a)e[a+t]=r[a]}var _e=new RegExp("(\\".concat(["/",".","*","+","?","|","^","$","(",")","[","]","{","}","\\"].join("|\\"),")"),"g");function Xe(e,r){if(!e)return!1;if(!r&&function(e){if(e instanceof v){return{last:!0,position:!0,count:!0,"string-length":!0,number:!0,sum:!0,floor:!0,ceiling:!0,round:!0}[e.name.value]}if(e instanceof Ie)return!0;if(e instanceof g){return{"+":!0,"-":!0,"*":!0,mod:!0,div:!0}[e.op.value]}if(e instanceof Re)return!0;return!1}(e))return!0;if(e instanceof v){var t=e.name.value;return"last"==t||"position"==t}return e instanceof g&&(Xe(e.expr1,!0)||Xe(e.expr2,!0))}function Je(e){for(var r={xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace"},t=e;null!==t;){for(var a=0;a<t.attributes.length;a++)if(t.attributes[a].nodeName.startsWith("xmlns:")){var n=t.attributes[a].nodeName.split(":")[1];n in r||(r[n]=t.attributes[a].nodeValue)}else"xmlns"==t.attributes[a].nodeName&&(""in r||(r[""]=t.attributes[a].nodeValue||null));t=t.parentNode}return r}var Ye=function(){function e(e,r,t,a,n){this.id=Math.random()*(Number.MAX_SAFE_INTEGER-1)+1,this.attributes=[],this.childNodes=[],this.transformedAttributes=[],this.transformedChildNodes=[],this.printed=!1,this.escape=!0,this.init(e,r,t,a,n)}return e.prototype.init=function(e,r,t,a,n){var o;this.nodeType=e-0,this.nodeName="".concat(r),this.nodeValue="".concat(t),this.ownerDocument=a,this.namespaceURI=n||null,o=this.qualifiedNameToParts("".concat(r)),this.prefix=o[0],this.localName=o[1],this.firstChild=null,this.lastChild=null,this.nextSibling=null,this.previousSibling=null,this.parentNode=null},e.prototype.qualifiedNameToParts=function(e){return e.includes(":")?e.split(":"):[null,e]},e.recycle=function(e){if(e)if(e.constructor!=Ze){if(e.constructor==this){this._unusedXNodes.push(e);for(var r=0;r<e.attributes.length;++r)this.recycle(e.attributes[r]);for(var t=0;t<e.childNodes.length;++t)this.recycle(e.childNodes[t]);e.attributes.length=0,e.childNodes.length=0,e.init.call(0,"","",null)}}else this.recycle(e.documentElement)},e.create=function(r,t,a,n,o){if(this._unusedXNodes.length>0){var i=this._unusedXNodes.pop();return i.init(r,t,a,n,o),i}return new e(r,t,a,n,o)},e.clone=function(r,t){for(var a=new e(r.nodeType,r.nodeName,r.nodeValue,t,r.namespaceURI),n=0,o=r.childNodes;n<o.length;n++){var i=o[n];a.appendChild(e.clone(i,a))}for(var s=0,l=r.attributes;s<l.length;s++){var u=l[s];a.setAttribute(u.nodeName,u.nodeValue)}return a},e.prototype.appendChild=function(e){0==this.childNodes.length&&(this.firstChild=e),e.previousSibling=this.lastChild,e.nextSibling=null,this.lastChild&&(this.lastChild.nextSibling=e),e.parentNode=this,this.lastChild=e,this.childNodes.push(e)},e.prototype.appendTransformedChild=function(e){0==this.transformedChildNodes.length&&(this.transformedFirstChild=e),e.transformedPreviousSibling=this.lastChild,e.transformedNextSibling=null,this.transformedLastChild&&(this.transformedLastChild.transformedNextSibling=e),e.transformedParentNode=this,this.transformedLastChild=e,this.transformedChildNodes.push(e)},e.prototype.replaceChild=function(e,r){if(r!=e)for(var t=0;t<this.childNodes.length;++t)if(this.childNodes[t]==r){this.childNodes[t]=e;var a=r.parentNode;r.parentNode=null,e.parentNode=a,a=r.previousSibling,r.previousSibling=null,e.previousSibling=a,e.previousSibling&&(e.previousSibling.nextSibling=e),a=r.nextSibling,r.nextSibling=null,e.nextSibling=a,e.nextSibling&&(e.nextSibling.previousSibling=e),this.firstChild==r&&(this.firstChild=e),this.lastChild==r&&(this.lastChild=e);break}},e.prototype.insertBefore=function(e,r){if(r!=e&&r.parentNode==this){e.parentNode&&e.parentNode.removeChild(e);for(var t=[],a=0,n=this.childNodes;a<n.length;a++){var o=n[a];o==r&&(t.push(e),e.parentNode=this,e.previousSibling=r.previousSibling,r.previousSibling=e,e.previousSibling&&(e.previousSibling.nextSibling=e),e.nextSibling=r,this.firstChild==r&&(this.firstChild=e)),t.push(o)}this.childNodes=t}},e.prototype.removeChild=function(e){for(var r=[],t=0,a=this.childNodes;t<a.length;t++){var n=a[t];n!=e?r.push(n):(n.previousSibling&&(n.previousSibling.nextSibling=n.nextSibling),n.nextSibling&&(n.nextSibling.previousSibling=n.previousSibling),this.firstChild==n&&(this.firstChild=n.nextSibling),this.lastChild==n&&(this.lastChild=n.previousSibling))}this.childNodes=r},e.prototype.hasAttributes=function(){return this.attributes.length>0},e.prototype.setAttribute=function(r,a){for(var n=0;n<this.attributes.length;++n)if(this.attributes[n].nodeName==r)return void(this.attributes[n].nodeValue="".concat(a));this.attributes.push(e.create(t,r,a,this))},e.prototype.setTransformedAttribute=function(r,a){for(var n=0;n<this.transformedAttributes.length;++n)if(this.transformedAttributes[n].nodeName==r)return void(this.transformedAttributes[n].nodeValue="".concat(a));this.transformedAttributes.push(e.create(t,r,a,this))},e.prototype.setAttributeNS=function(r,a,n){for(var o=0;o<this.attributes.length;++o)if(this.attributes[o].namespaceURI==r&&this.attributes[o].localName==this.qualifiedNameToParts("".concat(a))[1])return this.attributes[o].nodeValue="".concat(n),this.attributes[o].nodeName="".concat(a),void(this.attributes[o].prefix=this.qualifiedNameToParts("".concat(a))[0]);this.attributes.push(e.create(t,a,n,this,r))},e.prototype.getAttributeValue=function(e){for(var r=0;r<this.attributes.length;++r)if(this.attributes[r].nodeName==e)return this.attributes[r].nodeValue;return null},e.prototype.getAttributeNS=function(e,r){for(var t=0;t<this.attributes.length;++t)if(this.attributes[t].namespaceURI==e&&this.attributes[t].localName==r)return this.attributes[t].nodeValue;return null},e.prototype.hasAttribute=function(e){for(var r=0;r<this.attributes.length;++r)if(this.attributes[r].nodeName==e)return!0;return!1},e.prototype.hasAttributeNS=function(e,r){for(var t=0;t<this.attributes.length;++t)if(this.attributes[t].namespaceURI==e&&this.attributes[t].localName==r)return!0;return!1},e.prototype.removeAttribute=function(e){for(var r=[],t=0;t<this.attributes.length;++t)this.attributes[t].nodeName!=e&&r.push(this.attributes[t]);this.attributes=r},e.prototype.removeAttributeNS=function(e,r){for(var t=[],a=0;a<this.attributes.length;++a)this.attributes[a].localName==r&&this.attributes[a].namespaceURI==e||t.push(this.attributes[a]);this.attributes=t},e.prototype.getElementsByTagName=function(e){var r=[],t=this;return pr(this,"*"==e?function(e){t!=e&&r.push(e)}:function(a){t!=a&&a.nodeName==e&&r.push(a)},null),r},e.prototype.getElementsByTagNameNS=function(e,r){var t=[],a=this;return pr(this,"*"==e&&"*"==r?function(e){a!=e&&t.push(e)}:"*"==e?function(e){a!=e&&e.localName==r&&t.push(e)}:"*"==r?function(r){a!=r&&r.namespaceURI==e&&t.push(r)}:function(n){a!=n&&n.localName==r&&n.namespaceURI==e&&t.push(n)},null),t},e.prototype.getElementById=function(e){var r=null;return pr(this,(function(t){if(t.getAttributeValue("id")==e)return r=t,!1}),null),r},e._unusedXNodes=[],e}(),Ze=function(e){function l(){var r=e.call(this,i,"#document",null,null)||this;return r.documentElement=null,r}return h(l,e),l.prototype.clear=function(){Ye.recycle(this.documentElement),this.documentElement=null},l.prototype.appendChild=function(r){e.prototype.appendChild.call(this,r),this.documentElement=this.childNodes[0]},l.prototype.createElement=function(e){return Ye.create(r,e,null,this)},l.prototype.createElementNS=function(e,t){return Ye.create(r,t,null,this,e)},l.prototype.createDocumentFragment=function(){return Ye.create(s,"#document-fragment",null,this)},l.prototype.createTextNode=function(e){return Ye.create(a,"#text",e,this)},l.prototype.createTransformedTextNode=function(e){var r=Ye.create(a,"#text",e,this);return r.transformedNodeValue=e,r},l.prototype.createAttribute=function(e){return Ye.create(t,e,null,this)},l.prototype.createAttributeNS=function(e,r){return Ye.create(t,r,null,this,e)},l.prototype.createComment=function(e){return Ye.create(o,"#comment",e,this)},l.prototype.createCDATASection=function(e){return Ye.create(n,"#cdata-section",e,this)},l.prototype.createDTDSection=function(e){return Ye.create(10,"#dtd-section",e,this)},l}(Ye),We=new RegExp("^(".concat(V,")")),Ke=new RegExp(P,"g"),Qe=new RegExp("^(".concat(I,")")),$e=new RegExp(M,"g");function er(e,r){return e.getAttributeValue(r)}function rr(e,r,t){return e.setAttribute(r,t)}function tr(e,r,t){return e.setTransformedAttribute(r,t)}function ar(e,r){return e.appendChild(r)}function nr(e,r){return e.appendTransformedChild(r)}function or(e,r){return e.createTextNode(r)}function ir(e,r){return e.createTransformedTextNode(r)}function sr(e,r){return e.createElement(r)}function lr(e,r){return e.createCDATASection(r)}function ur(e,r){return e.createComment(r)}function cr(e){return e.createDocumentFragment()}function pr(e,t,a){var n;if(t&&"boolean"==typeof(n=t.call(null,e))&&!n)return!1;for(var o=e.firstChild;o;o=o.nextSibling)if(o.nodeType==r&&"boolean"==typeof(n=pr.call(this,o,t,a))&&!n)return!1;return!(a&&"boolean"==typeof(n=a.call(null,e))&&!n)&&void 0}function hr(e,o){if(void 0===o&&(o=!1),!e)return"";var l="";if(e.nodeType==a||e.nodeType==n)l+=e.nodeValue;else if(e.nodeType==t)l+=e.nodeValue;else if(e.nodeType==r||e.nodeType==i||e.nodeType==s){if(!o){var u=e.innerText;if(null!=u)return u;var c=e.textContent;if(null!=c)return c}if(e.transformedChildNodes.length>0)for(var p=0;p<e.transformedChildNodes.length;++p)l+=hr(e.transformedChildNodes[p]);else for(p=0;p<e.childNodes.length;++p)l+=hr(e.childNodes[p])}return l}function dr(e,t,l){if(!e.printed){var u=e.transformedNodeType||e.nodeType,c=e.transformedNodeValue||e.nodeValue;if(u==a){if(e.transformedNodeValue&&""!==e.transformedNodeValue.trim()){var p=e.escape&&l.escape?gr(e.transformedNodeValue):e.transformedNodeValue;t.push(p)}}else if(u==n)l.cData?t.push(c):t.push("<![CDATA[".concat(c,"]]>"));else if(u==o)t.push("\x3c!--".concat(c,"--\x3e"));else if(u==r)null!==e.transformedNodeName&&void 0!==e.transformedNodeName?function(e,r,t){r.push("<".concat(fr(e)));for(var a=e.transformedAttributes||e.attributes,n=0;n<a.length;++n){var o=a[n];if(o){var i=o.transformedNodeName||o.nodeName,s=o.transformedNodeValue||o.nodeValue;i&&s&&r.push(" ".concat(fr(o),'="').concat(mr(s),'"'))}}var l=e.transformedChildNodes.length>0?e.transformedChildNodes:e.childNodes;if(0==l.length)r.push("/>");else{r.push(">");for(n=0;n<l.length;++n)dr(l[n],r,t);r.push("</".concat(fr(e),">"))}}(e,t,l):function(e,r,t){for(var a=e.transformedChildNodes.length>0?e.transformedChildNodes:e.childNodes,n=0;n<a.length;++n)dr(a[n],r,t)}(e,t,l);else if(u==i||u==s)for(var h=e.transformedChildNodes.concat(e.childNodes),d=0;d<h.length;++d)dr(h[d],t,l);e.printed=!0}}function fr(e){var r=e.transformedNodeName||e.nodeName;return e.transformedPrefix&&0!=r.indexOf("".concat(e.transformedPrefix,":"))?"".concat(e.transformedPrefix,":").concat(r):r}function gr(e){return"".concat(e).replace(/&/g,"&amp;").replace(/&amp;amp;/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mr(e){return gr(e).replace(/"/g,"&quot;")}function br(e,r){var t=er(e,r);return t?c.decode(t):t}function vr(e){if(null==e)throw new Error("Node has no valid owner document.");return e.nodeType===i?e:vr(e.ownerDocument)}var yr=function(){function e(e){this.value=e,this.type="node-set"}return e.prototype.stringValue=function(){return 0===this.value.length?"":hr(this.value[0])},e.prototype.booleanValue=function(){return this.value.length>0},e.prototype.numberValue=function(){return this.stringValue()-0},e.prototype.nodeSetValue=function(){return this.value},e}(),xr=function(){function e(e,r,t,a,n,o,s){this.nodelist=e,this.position=r||0,this.variables={},this.parent=t||null,this.caseInsensitive=a||!1,this.ignoreAttributesWithoutValue=n||!1,this.returnOnFirstMatch=o||!1,this.ignoreNonElementNodesForNTA=s||!1,t?this.root=t.root:this.nodelist[this.position].nodeType==i?this.root=this.nodelist[this.position]:this.root=this.nodelist[this.position].ownerDocument}return e.prototype.clone=function(r,t){return new e(r||this.nodelist,void 0!==t?t:this.position,this,this.caseInsensitive,this.ignoreAttributesWithoutValue,this.returnOnFirstMatch,this.ignoreNonElementNodesForNTA)},e.prototype.setVariable=function(e,r){r instanceof b||r instanceof l||r instanceof d||r instanceof yr?this.variables[e]=r:"true"===r?this.variables[e]=new l(!0):"false"===r?this.variables[e]=new l(!1):De.re.test(r)?this.variables[e]=new d(r):this.variables[e]=new b(r)},e.prototype.getVariable=function(e){return void 0!==this.variables[e]?this.variables[e]:this.parent?this.parent.getVariable(e):null},e.prototype.setNode=function(e){this.position=e},e.prototype.contextSize=function(){return this.nodelist.length},e.prototype.isCaseInsensitive=function(){return this.caseInsensitive},e.prototype.setCaseInsensitive=function(e){return this.caseInsensitive=e},e.prototype.isIgnoreAttributesWithoutValue=function(){return this.ignoreAttributesWithoutValue},e.prototype.setIgnoreAttributesWithoutValue=function(e){return this.ignoreAttributesWithoutValue=e},e.prototype.isReturnOnFirstMatch=function(){return this.returnOnFirstMatch},e.prototype.setReturnOnFirstMatch=function(e){return this.returnOnFirstMatch=e},e.prototype.isIgnoreNonElementNodesForNTA=function(){return this.ignoreNonElementNodesForNTA},e.prototype.setIgnoreNonElementNodesForNTA=function(e){return this.ignoreNonElementNodesForNTA=e},e}(),wr=function(){function e(){}return e.prototype.evaluate=function(e){return new l(e.node.nodeType==o)},e}(),Er=function(){function e(){}return e.prototype.evaluate=function(e){var a=e.nodelist[e.position];return new l(a.nodeType==r||a.nodeType==t)},e}(),qr=function(){function e(e){this.name=e,this.re=new RegExp("^".concat(e,"$"),"i")}return e.prototype.evaluate=function(e){var r=e.nodelist[e.position];return e.caseInsensitive?r.nodeName.length!=this.name.length?new l(!1):new l(this.re.test(r.nodeName)):new l(r.nodeName==this.name)},e}(),Dr=function(){function e(e){this.regex=new RegExp("^".concat(e,":")),this.nsprefix=e}return e.prototype.evaluate=function(e){var r=e.node;return new l(r.nodeName.match(this.regex))},e}(),Ar=function(){function e(e){this.target=e}return e.prototype.evaluate=function(e){return new l(7==e.node.nodeType&&(!this.target||e.node.nodeName==this.target))},e}(),kr=function(){function e(){}return e.prototype.evaluate=function(e){return new l(e.node.nodeType==a)},e}(),Nr={label:"LocationPath",key:void 0},Sr={label:"RelativeLocationPath",key:void 0},Cr={label:"AbsoluteLocationPath",key:void 0},Vr={label:"Step",key:void 0},Tr={label:"NodeTest",key:void 0},Lr={label:"Predicate",key:void 0},Rr={label:"Literal",key:void 0},Pr={label:"Expr",key:void 0},Br={label:"PrimaryExpr",key:void 0},Fr={label:"Variablereference",key:void 0},Ur={label:"Number",key:void 0},Ir={label:"FunctionCall",key:void 0},Or={label:"ArgumentRemainder",key:void 0},Gr={label:"PathExpr",key:void 0},Hr={label:"UnionExpr",key:void 0},Mr={label:"FilterExpr",key:void 0},zr={label:"Digits",key:void 0},jr=function(){function e(){this.xPathGrammarRules=[[Nr,[Sr],18,this.passExpr],[Nr,[Cr],18,this.passExpr],[Cr,[Z,Sr],18,this.makeLocationExpr1],[Cr,[Y,Sr],18,this.makeLocationExpr2],[Cr,[Z],0,this.makeLocationExpr3],[Cr,[Y],0,this.makeLocationExpr4],[Sr,[Vr],31,this.makeLocationExpr5],[Sr,[Sr,Z,Vr],31,this.makeLocationExpr6],[Sr,[Sr,Y,Vr],31,this.makeLocationExpr7],[Vr,[te],33,this.makeStepExpr1],[Vr,[re],33,this.makeStepExpr2],[Vr,[Q,W,Tr],33,this.makeStepExpr3],[Vr,[ae,Tr],33,this.makeStepExpr4],[Vr,[Tr],33,this.makeStepExpr5],[Vr,[Vr,Lr],33,this.makeStepExpr6],[Tr,[we],33,this.makeNodeTestExpr1],[Tr,[xe,K,we],33,this.makeNodeTestExpr2],[Tr,[Ae],33,this.makeNodeTestExpr3],[Tr,[ke,ee],33,this.makeNodeTestExpr4],[Tr,[ke,Rr,ee],33,this.makeNodeTestExpr5],[Lr,[be,Pr,ve],33,this.makePredicateExpr],[Br,[Fr],33,this.passExpr],[Br,[$,Pr,ee],33,this.makePrimaryExpr],[Br,[Rr],30,this.passExpr],[Br,[Ur],30,this.passExpr],[Br,[Ir],31,this.passExpr],[Ir,[Ae,$,ee],-1,this.makeFunctionCallExpr1],[Ir,[Ae,$,Pr,Or,Ce,ee],-1,this.makeFunctionCallExpr2],[Or,[ne,Pr],-1,this.makeArgumentExpr],[Hr,[Gr],20,this.passExpr],[Hr,[Hr,J,Gr],20,this.makeUnionExpr],[Gr,[Nr],20,this.passExpr],[Gr,[Mr],19,this.passExpr],[Gr,[Mr,Z,Sr],19,this.makePathExpr1],[Gr,[Mr,Y,Sr],19,this.makePathExpr2],[Mr,[Br,Lr,Ce],31,this.makeFilterExpr],[Pr,[Br],16,this.passExpr],[Pr,[Hr],16,this.passExpr],[Pr,[fe,Pr],-1,this.makeUnaryMinusExpr],[Pr,[Pr,oe,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,ie,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,se,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,le,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,he,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,pe,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,ce,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,ue,Pr],-1,this.makeBinaryExpr],[Pr,[Pr,de,Pr],-1,this.makeBinaryExpr,Te],[Pr,[Pr,fe,Pr],-1,this.makeBinaryExpr,Te],[Pr,[Pr,we,Pr],-1,this.makeBinaryExpr,Te],[Pr,[Pr,ge,Pr],-1,this.makeBinaryExpr,Te],[Pr,[Pr,me,Pr],-1,this.makeBinaryExpr,Te],[Rr,[Ee],-1,this.makeLiteralExpr],[Rr,[qe],-1,this.makeLiteralExpr],[Ur,[De],-1,this.makeNumberExpr],[Fr,[ye,Ae],200,this.makeVariableReference]],this.xPathParseCache={},this.xPathRules=[]}return e.prototype.makeTokenExpr=function(e){return new Ue(e)},e.prototype.passExpr=function(e){return e},e.prototype.makeLocationExpr1=function(e,r){return r.absolute=!0,r},e.prototype.makeLocationExpr2=function(e,r){return r.absolute=!0,r.prependStep(this.makeAbbrevStep(e.value)),r},e.prototype.makeLocationExpr3=function(){var e=new Le(this);return e.appendStep(this.makeAbbrevStep(".")),e.absolute=!0,e},e.prototype.makeLocationExpr4=function(e){var r=new Le(this);return r.absolute=!0,r.appendStep(this.makeAbbrevStep(e.value)),r},e.prototype.makeLocationExpr5=function(e){var r=new Le(this);return r.appendStep(e),r},e.prototype.makeLocationExpr6=function(e,r,t){return e.appendStep(t),e},e.prototype.makeLocationExpr7=function(e,r,t){return e.appendStep(this.makeAbbrevStep(r.value)),e.appendStep(t),e},e.prototype.makeStepExpr1=function(e){return this.makeAbbrevStep(e.value)},e.prototype.makeStepExpr2=function(e){return this.makeAbbrevStep(e.value)},e.prototype.makeStepExpr3=function(e,r,t){return new Fe(e.value,t,this)},e.prototype.makeStepExpr4=function(e,r){return new Fe("attribute",r,this)},e.prototype.makeStepExpr5=function(e){return new Fe("child",e,this)},e.prototype.makeStepExpr6=function(e,r){return e.appendPredicate(r),e},e.prototype.makeAbbrevStep=function(e){switch(e){case"//":return new Fe("descendant-or-self",new x,this);case".":return new Fe("self",new x,this);case"..":return new Fe("parent",new x,this)}},e.prototype.makeNodeTestExpr1=function(){return new Er},e.prototype.makeNodeTestExpr2=function(e){return new Dr(e.value)},e.prototype.makeNodeTestExpr3=function(e){return new qr(e.value)},e.prototype.makeNodeTestExpr4=function(e){switch(e.value.replace(/\s*\($/,"")){case"node":return new x;case"text":return new kr;case"comment":return new wr;case"processing-instruction":return new Ar("")}},e.prototype.makeNodeTestExpr5=function(e,r){var t=e.replace(/\s*\($/,"");if("processing-instruction"!=t)throw t;return new Ar(r.value)},e.prototype.makePredicateExpr=function(e,r){return new Be(r)},e.prototype.makePrimaryExpr=function(e,r){return r},e.prototype.makeFunctionCallExpr1=function(e){return new v(e)},e.prototype.makeFunctionCallExpr2=function(e,r,t,a){var n=new v(e);n.appendArg(t);for(var o=0;o<a.length;++o)n.appendArg(a[o]);return n},e.prototype.makeArgumentExpr=function(e,r){return r},e.prototype.makeUnionExpr=function(e,r,t){return new Oe(e,t)},e.prototype.makePathExpr1=function(e,r,t){return new Pe(e,t)},e.prototype.makePathExpr2=function(e,r,t){return t.prependStep(this.makeAbbrevStep(r.value)),new Pe(e,t)},e.prototype.makeFilterExpr=function(e,r){return r.length>0?new m(e,r):e},e.prototype.makeUnaryMinusExpr=function(e,r){return new Ie(r)},e.prototype.makeBinaryExpr=function(e,r,t){return new g(e,r,t)},e.prototype.makeLiteralExpr=function(e){var r=e.value.substring(1,e.value.length-1);return new y(r)},e.prototype.makeNumberExpr=function(e){return new Re(e.value)},e.prototype.makeVariableReference=function(e,r){return new Ge(r.value)},e.prototype.makeSimpleExpr=function(e){if("$"==e.charAt(0))return new Ge(e.substr(1));if("@"==e.charAt(0)){var r=new qr(e.substr(1)),t=new Fe("attribute",r,this),a=new Le(this);return a.appendStep(t),a}if(e.match(/^[0-9]+$/))return new Re(e);var n=new qr(e),o=new Fe("child",n,this),i=new Le(this);return i.appendStep(o),i},e.prototype.makeSimpleExpr2=function(e){for(var r=e.split("/"),t=new Le(this),a=0;a<r.length;++a){var n=new qr(r[a]),o=new Fe("child",n,this);t.appendStep(o)}return t},e.prototype.stackToString=function(e){for(var r="",t=0;t<e.length;++t)r&&(r+="\n"),r+=e[t].tag.label;return r},e.prototype.xPathCacheLookup=function(e){return this.xPathParseCache[e]},e.prototype.xPathCollectDescendants=function(e,r,t){if(t&&r.getElementsByTagName)je(e,r.getElementsByTagName(t));else for(var a=r.firstChild;a;a=a.nextSibling)e.push(a),this.xPathCollectDescendants(e,a)},e.prototype.xPathCollectDescendantsReverse=function(e,r){for(var t=r.lastChild;t;t=t.previousSibling)e.push(t),this.xPathCollectDescendantsReverse(e,t)},e.prototype.xPathEval=function(e,r){return this.xPathParse(e).evaluate(r)},e.prototype.xPathExtractTagNameFromNodeTest=function(e,r){return e instanceof qr?e.name:r&&e instanceof x||e instanceof Er?"*":void 0},e.prototype.xPathMatchStack=function(e,r){var t,a,n=e.length,o=r.length,i=[];i.matchlength=0;var s=0;for(t=o-1,a=n-1;t>=0&&a>=0;--t,a-=s){s=0;var l=[];if(r[t]==Ce)for(t-=1,i.push(l);a-s>=0&&e[a-s].tag==r[t];)l.push(e[a-s]),s+=1,i.matchlength+=1;else if(r[t]==Se)for(t-=1,i.push(l);a-s>=0&&s<2&&e[a-s].tag==r[t];)l.push(e[a-s]),s+=1,i.matchlength+=1;else if(r[t]==Ve){if(t-=1,i.push(l),e[a].tag!=r[t])return[];for(;a-s>=0&&e[a-s].tag==r[t];)l.push(e[a-s]),s+=1,i.matchlength+=1}else{if(e[a].tag!=r[t])return[];i.push(e[a]),s+=1,i.matchlength+=1}ze(l),l.expr=Me(l,(function(e){return e.expr}))}return ze(i),-1==t?i:[]},e.prototype.xPathParse=function(e,r){void 0===r&&(r=function(e){}),r("parse ".concat(e)),this.xPathParseInit(r);var t=this.xPathCacheLookup(e);if(t)return r(" ... cached"),t;if(e.match(/^(\$|@)?\w+$/i)){var a=this.makeSimpleExpr(e);return this.xPathParseCache[e]=a,r(" ... simple"),a}if(e.match(/^\w+(\/\w+)*$/i)){a=this.makeSimpleExpr2(e);return this.xPathParseCache[e]=a,r(" ... simple 2"),a}for(var n=e,o=[],i=null,s=null,l=!1,u=0,c=0,p=0;!l;){u++,e=e.replace(/^\s*/,""),s=i,i=null;for(var h=null,d="",f=0;f<Ne.length;++f){var g=Ne[f].re.exec(e);if(c++,g&&g.length>0&&g[0].length>d.length){h=Ne[f],d=g[0];break}}for(!h||h!=ge&&h!=me&&h!=ie&&h!=oe||s&&s.tag!=ae&&s.tag!=Y&&s.tag!=Z&&s.tag!=W&&s.tag!=ye||(h=Ae),h?(e=e.substr(d.length),r("token: ".concat(d," -- ").concat(h.label)),i={tag:h,match:d,prec:h.prec?h.prec:0,expr:this.makeTokenExpr(d)}):(r("DONE"),l=!0);this.xPathReduce(o,i,r);)p++,r("stack: ".concat(this.stackToString(o)))}if(r("stack: ".concat(this.stackToString(o))),1!=o.length)throw"XPath parse error ".concat(n,":\n").concat(this.stackToString(o));var m=o[0].expr;return this.xPathParseCache[n]=m,r("XPath parse: ".concat(u," / ").concat(c," / ").concat(p)),m},e.prototype.xPathParseInit=function(e){if(!this.xPathRules.length){var r=[Nr,Sr,Cr,Vr,Tr,Lr,Rr,Pr,Br,Fr,Ur,Ir,Or,Gr,Hr,Mr,zr];this.xPathGrammarRules.sort((function(e,r){var t=e[1].length,a=r[1].length;return t<a?1:t>a?-1:0}));for(var t=1,a=0;a<r.length;++a)r[a].key=t++;for(a=0;a<Ne.length;++a)Ne[a].key=t++;e("XPath parse INIT: ".concat(t," rules"));for(a=0;a<this.xPathGrammarRules.length;++a)for(var n=this.xPathGrammarRules[a],o=n[1],i=o.length-1;i>=0;--i){if(o[i]==Ve){l(this.xPathRules,o[i-1].key,n);break}if(o[i]!=Ce&&o[i]!=Se){l(this.xPathRules,o[i].key,n);break}l(this.xPathRules,o[i-1].key,n),--i}e("XPath parse INIT: ".concat(this.xPathRules.length," rule bins"));var s=0;!function(e,r){for(var t=0;t<e.length;++t)r.call(this,e[t],t)}(this.xPathRules,(function(e){e&&(s+=e.length)})),e("XPath parse INIT: ".concat(s/this.xPathRules.length," average bin size"))}function l(e,r,t){e[r]||(e[r]=[]),e[r].push(t)}},e.prototype.xPathReduce=function(e,r,t){void 0===t&&(t=function(e){});var a,n=null;if(e.length>0){var o=e[e.length-1],i=this.xPathRules[o.tag.key];if(i)for(var s=0;s<i.length;++s){var l=i[s],u=this.xPathMatchStack(e,l[1]);if(u.length){(n={tag:l[0],rule:l,match:u}).prec=this.xPathGrammarPrecedence(n);break}}}if(n&&(!r||n.prec>r.prec||r.tag.left&&n.prec>=r.prec)){for(s=0;s<n.match.matchlength;++s)e.pop();t("reduce ".concat(n.tag.label," ").concat(n.prec," ahead ").concat(r?r.tag.label+" "+r.prec+(r.tag.left?" left":""):" none "));var c=Me(n.match,(function(e){return e.expr}));t("going to apply ".concat(n.rule[3])),n.expr=n.rule[3].apply(this,c),e.push(n),a=!0}else r&&(t("shift ".concat(r.tag.label," ").concat(r.prec).concat(r.tag.left?" left":""," over ").concat(n?n.tag.label+" "+n.prec:" none")),e.push(r)),a=!1;return a},e.prototype.xPathSort=function(e,r){if(0!=r.length){for(var t=[],a=0;a<e.contextSize();++a){for(var n=e.nodelist[a],o={node:n,key:[]},i=e.clone([n],0),s=0,l=r;s<l.length;s++){var u=l[s],c=u.expr.evaluate(i),p=void 0;"text"==u.type?p=c.stringValue():"number"==u.type&&(p=c.numberValue()),o.key.push({value:p,order:u.order})}o.key.push({value:a,order:"ascending"}),t.push(o)}t.sort(this.xPathSortByKey);var h=[];for(a=0;a<t.length;++a)h.push(t[a].node);e.nodelist=h,e.setNode(0)}},e.prototype.xPathSortByKey=function(e,r){for(var t=0;t<e.key.length;++t){var a="descending"==e.key[t].order?-1:1;if(e.key[t].value>r.key[t].value)return 1*a;if(e.key[t].value<r.key[t].value)return-1*a}return 0},e.prototype.xPathStep=function(e,r,t,a,n){var o=r[t],i=n.clone([a],0);if(n.returnOnFirstMatch&&!o.hasPositionalPredicate){var s=(p=o.evaluate(i).nodeSetValue()).length,l=o.predicate.length;e:for(var u=0;u<s;++u){for(var c=0;c<l;++c)if(!o.predicate[c].evaluate(n.clone(p,u)).booleanValue())continue e;if(t==r.length-1?e.push(p[u]):this.xPathStep(e,r,t+1,p[u],n),e.length>0)break}}else{i.returnOnFirstMatch=!1;var p=o.evaluate(i).nodeSetValue();for(u=0;u<p.length;++u)t==r.length-1?e.push(p[u]):this.xPathStep(e,r,t+1,p[u],n)}},e.prototype.xPathGrammarPrecedence=function(e){var r=0;if(e.rule)if(e.rule.length>=3&&e.rule[2]>=0)r=e.rule[2];else for(var t=0;t<e.rule[1].length;++t){var a=this.xPathTokenPrecedence(e.rule[1][t]);r=Math.max(r,a)}else if(e.tag)r=this.xPathTokenPrecedence(e.tag);else if(e.length)for(var n=0;n<e.length;++n){a=this.xPathGrammarPrecedence(e[n]);r=Math.max(r,a)}return r},e.prototype.xPathTokenPrecedence=function(e){return e.prec||2},e}(),_r=function(){function e(e){void 0===e&&(e={escape:!0}),this.xPath=new jr,this.options=e,this.outputMethod="xml",this.outputOmitXmlDeclaration="no"}return e.prototype.xsltProcess=function(e,r,t){var a=new Ze;a.appendChild(Ye.clone(e.childNodes[0],a));var n=new xr([a]);if(t&&t.length>0)for(var o=0,i=t;o<i.length;o++){var s=i[o];n.setVariable(s.name,new b(s.value))}return this.xsltProcessContext(n,r,a,t||[]),function(e,r){void 0===r&&(r={cData:!1,escape:!0});var t=[];return dr(e,t,r),t.join("")}(a,{cData:!1,escape:this.options.escape})},e.prototype.xsltProcessContext=function(e,o,l,u){var c=vr(l);if(this.isXsltElement(o)){var p,h,d,f=void 0,g=void 0,m=void 0,b=void 0,v=void 0,y=void 0,x=void 0,w=void 0,E=void 0,q=void 0,D=void 0;switch(o.localName){case"apply-imports":case"attribute-set":case"decimal-format":case"fallback":case"import":case"include":case"key":case"message":case"namespace-alias":case"number":case"preserve-space":case"processing-instruction":case"strip-space":throw"not implemented: ".concat(o.localName);case"apply-templates":v=(m=br(o,"select"))?this.xPath.xPathEval(m,e).nodeSetValue():e.nodelist[e.position].childNodes,y=e.clone(v,0),this.xsltWithParam(y,o,u),this.xsltSort(y,o),x=br(o,"mode"),h=o.ownerDocument.documentElement,w=[];for(var A=0;A<h.childNodes.length;++A){var k=(S=h.childNodes[A]).getAttributeValue("match");k&&k.startsWith("/")||(S.nodeType!=r||!this.isXsltElement(S,"template")||x&&S.getAttributeValue("mode")!=x||w.push(S))}for(var N=0;N<y.contextSize();++N)for(A=0;A<w.length;++A)this.xsltProcessContext(y.clone(y.nodelist,N),w[A],l,u);break;case"attribute":f=br(o,"name"),p=this.xsltAttributeValue(f,e),g=cr(c),this.xsltChildNodes(e,o,g,u),b=function(e,o){if(void 0===o&&(o=!1),!e)return"";var l="";if(e.nodeType==a||e.nodeType==n)l+=e.nodeValue;else if(e.nodeType==t)l+=e.nodeValue;else if(e.nodeType==r||e.nodeType==i||e.nodeType==s){if(!o){var u=e.innerText;if(null!=u)return u;var c=e.textContent;if(null!=c)return c}for(var p=e.transformedChildNodes.length,h=0;h<p;++h)l+=hr(e.transformedChildNodes[h])}return l}(g),tr(l,p,b);break;case"call-template":p=br(o,"name"),h=o.ownerDocument.documentElement,E=e.clone(),this.xsltWithParam(E,o,u);for(A=0;A<h.childNodes.length;++A){var S;if((S=h.childNodes[A]).nodeType==r&&this.isXsltElement(S,"template")&&er(S,"name")==p){this.xsltChildNodes(E,S,l,u);break}}break;case"choose":this.xsltChoose(e,o,l,u);break;case"comment":g=cr(c),this.xsltChildNodes(e,o,g,u),q=ur(c,hr(g)),l.appendChild(q);break;case"copy":(g=this.xsltCopy(l,e.nodelist[e.position],c))&&this.xsltChildNodes(e,o,g,u);break;case"copy-of":if(m=br(o,"select"),"node-set"==(b=this.xPath.xPathEval(m,e)).type){v=b.nodeSetValue();for(A=0;A<v.length;++A)this.xsltCopyOf(l,v[A],c)}else{ar(l,or(c,b.stringValue()))}break;case"element":f=br(o,"name"),g=sr(c,p=this.xsltAttributeValue(f,e));var C=e.nodelist[e.position];g.childNodes=C.childNodes,g.transformedNodeName=p,nr(l,g),this.xsltChildNodes(e,o,g,u);break;case"for-each":this.xsltForEach(e,o,l,u);break;case"if":d=br(o,"test"),this.xPath.xPathEval(d,e).booleanValue()&&this.xsltChildNodes(e,o,l,u);break;case"otherwise":case"when":case"with-param":default:throw"error if here: ".concat(o.localName);case"output":this.outputMethod=br(o,"method"),this.outputOmitXmlDeclaration=br(o,"omit-xml-declaration");break;case"sort":break;case"stylesheet":case"transform":this.xsltChildNodes(e,o,l,u);break;case"template":(D=br(o,"match"))&&this.xsltMatch(D,e)&&this.xsltChildNodes(e,o,l,u);break;case"text":g=ir(c,hr(o));var V=o.attributes.filter((function(e){return"disable-output-escaping"===e.nodeName}));V.length>0&&"yes"===V[0].nodeValue&&(g.escape=!1),l.appendTransformedChild(g);break;case"value-of":m=br(o,"select"),g=ir(c,b=this.xPath.xPathEval(m,e).stringValue()),e.nodelist[e.position].appendTransformedChild(g);break;case"param":this.xsltVariable(e,o,!1,u);break;case"variable":this.xsltVariable(e,o,!0,u)}}else this.xsltPassThrough(e,o,l,c)},e.prototype.xsltCopy=function(e,i,s){if(i.nodeType==r)return(l=sr(s,i.nodeName)).transformedNodeName=i.nodeName,nr(e,l),l;if(i.nodeType==a)nr(e,l=ir(s,i.nodeValue));else if(i.nodeType==n){nr(e,l=lr(s,i.nodeValue))}else if(i.nodeType==o){var l;nr(e,l=ur(s,i.nodeValue))}else i.nodeType==t&&tr(e,i.nodeName,i.nodeValue);return null},e.prototype.xsltSort=function(e,t){for(var a=[],n=0,o=t.childNodes;n<o.length;n++){var i=o[n];if(i.nodeType==r&&this.isXsltElement(i,"sort")){var s=br(i,"select"),l=this.xPath.xPathParse(s),u=br(i,"data-type")||"text",c=br(i,"order")||"ascending";a.push({expr:l,type:u,order:c})}}this.xPath.xPathSort(e,a)},e.prototype.xsltVariable=function(e,r,t,a){var n,o=br(r,"name"),i=br(r,"select");if(r.childNodes.length>0){var s=cr(r.ownerDocument);this.xsltChildNodes(e,r,s,a),n=new yr([s])}else if(i)n=this.xPath.xPathEval(i,e);else{var l="",u=a.filter((function(e){return e.name===o}));u.length>0&&(l=u[0].value),n=new b(l)}!t&&e.getVariable(o)||e.setVariable(o,n)},e.prototype.xsltChoose=function(e,t,a,n){for(var o=0,i=t.childNodes;o<i.length;o++){var s=i[o];if(s.nodeType===r)if(this.isXsltElement(s,"when")){var l=br(s,"test");if(this.xPath.xPathEval(l,e).booleanValue()){this.xsltChildNodes(e,s,a,n);break}}else if(this.isXsltElement(s,"otherwise")){this.xsltChildNodes(e,s,a,n);break}}},e.prototype.xsltForEach=function(e,r,t,a){var n=br(r,"select"),o=this.xPath.xPathEval(n,e).nodeSetValue(),i=e.clone(o,0);this.xsltSort(i,r);var s=i.nodelist.filter((function(e){return null!==e.parentNode&&void 0!==e.parentNode}));if(s.length<=0)throw new Error("Nodes with no parents defined.");s[0].parentNode.childNodes=i.nodelist;for(var l=0;l<i.contextSize();++l)this.xsltChildNodes(i.clone(i.nodelist,l),r,t,a)},e.prototype.groupBy=function(e,r){return e.reduce((function(e,t){return(e[t[r]]=e[t[r]]||[]).push(t),e}),{})},e.prototype.xsltChildNodes=function(e,r,t,a){for(var n=e.clone(),o=0;o<r.childNodes.length;++o)this.xsltProcessContext(n,r.childNodes[o],t,a)},e.prototype.xsltPassThrough=function(e,t,n,o,i){if(t.nodeType==a){if(this.xsltPassText(t)){var s=e.nodelist[e.position].transformedChildNodes.filter((function(e){return e.nodeType===a}));if(s.length>0){(l=s[0]).transformedNodeValue=t.nodeValue}else{var l=or(o,t.nodeValue);nr(e.nodelist[e.position],l)}}}else if(t.nodeType==r){l=void 0;(l="#document"===e.nodelist[e.position].nodeName?e.nodelist[e.position].firstChild:e.nodelist[e.position]).transformedNodeName=t.nodeName,l.transformedLocalName=t.localName;for(var u=0,c=t.attributes.filter((function(e){return e}));u<c.length;u++){var p=c[u];tr(l,p.nodeName,this.xsltAttributeValue(p.nodeValue,e))}this.xsltChildNodes(e,t,l,i)}else this.xsltChildNodes(e,t,n,i)},e.prototype.xsltPassText=function(e){if(!e.nodeValue.match(/^\s*$/))return!0;var t=e.parentNode;if(this.isXsltElement(t,"text"))return!0;for(;t&&t.nodeType==r;){var a=er(t,"xml:space");if(a){if("default"==a)return!1;if("preserve"==a)return!0}t=t.parentNode}return!1},e.prototype.xsltAttributeValue=function(e,r){var t=e.split("{");if(1==t.length)return e;for(var a="",n=0;n<t.length;++n){var o=t[n].split("}");if(2==o.length)a+=this.xPath.xPathEval(o[0],r).stringValue()+o[1];else a+=t[n]}return a},e.prototype.xsltCopyOf=function(e,r,t){if(r.nodeType==s||r.nodeType==i)for(var a=0;a<r.childNodes.length;++a)this.xsltCopyOf(e,r.childNodes[a],t);else{var n=this.xsltCopy(e,r,t);if(n){for(a=0;a<r.attributes.length;++a)this.xsltCopyOf(n,r.attributes[a],t);for(a=0;a<r.childNodes.length;++a)this.xsltCopyOf(n,r.childNodes[a],t)}}},e.prototype.xsltMatch=function(e,r){var t=this.xPath.xPathParse(e);return!(t instanceof Le)||this.xsltLocationExpressionMatch(e,t,r)},e.prototype.xsltLocationExpressionMatch=function(e,r,t){if(void 0===r||void 0===r.steps||r.steps.length<=0)throw new Error("Error resolving XSLT match: Location Expression should have steps.");var a=r.steps[0];if(r.steps&&!r.absolute&&1==r.steps.length&&"child"==a.axis&&0===a.predicate.length)return a.nodetest.evaluate(t).booleanValue();if(r.absolute&&"self"!==a.axis){var n=e.split("/");if(n.length>1)return this.absoluteXsltMatch(n,r,t)}return this.relativeXsltMatch(r,t)},e.prototype.xsltWithParam=function(e,t,a){for(var n=0,o=t.childNodes;n<o.length;n++){var i=o[n];i.nodeType===r&&this.isXsltElement(i,"with-param")&&this.xsltVariable(e,i,!0,a)}},e.prototype.absoluteXsltMatch=function(e,r,t){var a=r.evaluate(t.clone([t.nodelist[t.position]],0)).nodeSetValue();return a.length>0&&(t.nodelist=a,!0)},e.prototype.relativeXsltMatch=function(e,r){for(var t=r.nodelist[r.position];t;){for(var a=e.evaluate(r.clone([t],0)).nodeSetValue(),n=0;n<a.length;++n)if(a[n]==r.nodelist[r.position])return!0;t=t.parentNode}return!1},e.prototype.isXsltElement=function(e,r){return(!r||e.localName==r)&&(e.namespaceURI?"http://www.w3.org/1999/XSL/Transform"===e.namespaceURI:"xsl"===e.prefix)},e}();e.ExprContext=xr,e.XPath=jr,e.Xslt=_r,e.xmlEscapeText=gr,e.xmlParse=function(e){var r,t,a=/\/$/;if(e.match(/^<\?xml/))if(5==e.search(new RegExp(D)))r=We,t=Ke;else{if(5!=e.search(new RegExp(B)))throw new Error("VersionInfo is missing, or unknown version number.");r=Qe,t=$e}else r=We,t=Ke;var n=new Ze,o=n,i=[],s=o;i.push(s);for(var l,u=!1,p=!1,h=!1,d=0,f=0;f<e.length;++f){var g=e.charAt(f);if(u&&!h&&"'"===g)p=!p;else if(u&&!p&&'"'===g)h=!h;else if(!u||">"!==g||p||h){if(!u&&"<"===g){if((v=e.slice(d,f))&&s!=o&&ar(s,or(n,v)),"!--"===e.slice(f+1,f+4)){if(m=e.slice(f+4).indexOf("--\x3e"))ar(s,x=ur(n,e.slice(f+4,f+m+4))),f+=m+6}else if("![CDATA["===e.slice(f+1,f+9)){if(m=e.slice(f+9).indexOf("]]>"))ar(s,x=lr(n,e.slice(f+9,f+m+9))),f+=m+11}else if("!DOCTYPE"===e.slice(f+1,f+9)){var m;if(m=e.slice(f+9).indexOf(">")){var b=e.slice(f+9,f+m+9).trimStart();x=void 0;"xsl:text"===s.nodeName?x=or(n,"<!DOCTYPE ".concat(b,">")):(l=b,x=n.createDTDSection(l)),ar(s,x),f+=m+b.length+5}}else u=!0;d=f+1}}else{var v;if("/"==(v=e.slice(d,f)).charAt(0))i.pop(),s=i[i.length-1];else if("?"===v.charAt(0));else if("!"===v.charAt(0));else{for(var y=v.match(a),x=sr(n,r.exec(v)[1]),w=void 0;w=t.exec(v);){var E=c.decode(w[5]||w[7]||"");rr(x,w[1],E)}ar(s,x),y||(s=x,i.push(x));var q=Je(x);null!==x.prefix?x.prefix in q&&(x.namespaceURI=q[x.prefix]):""in q&&(x.namespaceURI=q[""]);for(var A=0;A<x.attributes.length;++A)null!==x.attributes[A].prefix&&x.attributes[A].prefix in q&&(x.attributes[A].namespaceURI=q[x.attributes[A].prefix])}d=f+1,u=!1,p=!1,h=!1}}return o},Object.defineProperty(e,"__esModule",{value:!0})}));
16
16
  //# sourceMappingURL=xslt-processor.js.map