xslt-processor 1.2.0 → 1.2.1
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/README.md +2 -2
- package/package.json +1 -1
- package/umd/xpath/expressions/binary-expr.d.ts +2 -1
- package/umd/xpath/expressions/filter-expr.d.ts +1 -1
- package/umd/xpath/expressions/predicate-expr.d.ts +3 -3
- package/umd/xpath/functions/standard.d.ts +1 -0
- package/umd/xpath/node-test-comment.d.ts +2 -1
- package/umd/xpath/node-test-nc.d.ts +3 -2
- package/umd/xpath/node-test-pi.d.ts +2 -1
- package/umd/xpath/node-test-text.d.ts +2 -1
- package/umd/xpath/values/node-set-value.d.ts +3 -2
- package/umd/xslt-processor.js +1 -1
- package/umd/xslt-processor.js.map +1 -1
- package/xpath/expressions/binary-expr.d.ts +2 -1
- package/xpath/expressions/binary-expr.js.map +1 -1
- package/xpath/expressions/filter-expr.d.ts +1 -1
- package/xpath/expressions/filter-expr.js +6 -6
- package/xpath/expressions/filter-expr.js.map +1 -1
- package/xpath/expressions/function-call-expr.js +21 -20
- package/xpath/expressions/function-call-expr.js.map +1 -1
- package/xpath/expressions/location-expr.js +5 -0
- package/xpath/expressions/location-expr.js.map +1 -1
- package/xpath/expressions/predicate-expr.d.ts +3 -3
- package/xpath/expressions/predicate-expr.js +4 -6
- package/xpath/expressions/predicate-expr.js.map +1 -1
- package/xpath/functions/standard.d.ts +1 -0
- package/xpath/functions/standard.js +13 -6
- package/xpath/functions/standard.js.map +1 -1
- package/xpath/node-test-comment.d.ts +2 -1
- package/xpath/node-test-comment.js +1 -1
- package/xpath/node-test-comment.js.map +1 -1
- package/xpath/node-test-nc.d.ts +3 -2
- package/xpath/node-test-nc.js +1 -1
- package/xpath/node-test-nc.js.map +1 -1
- package/xpath/node-test-pi.d.ts +2 -1
- package/xpath/node-test-pi.js +2 -1
- package/xpath/node-test-pi.js.map +1 -1
- package/xpath/node-test-text.d.ts +2 -1
- package/xpath/node-test-text.js +1 -1
- package/xpath/node-test-text.js.map +1 -1
- package/xpath/values/node-set-value.d.ts +3 -2
- package/xpath/values/node-set-value.js.map +1 -1
- package/xpath/xpath-grammar-rules.js.map +1 -1
- package/xpath/xpath.js +6 -2
- package/xpath/xpath.js.map +1 -1
- package/xslt/xslt.js +0 -2
- package/xslt/xslt.js.map +1 -1
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ You can pass an `options` object to `Xslt` class:
|
|
|
67
67
|
const options = {
|
|
68
68
|
escape: false,
|
|
69
69
|
selfClosingTags: true,
|
|
70
|
-
|
|
70
|
+
parameters: [{ name: 'myparam', value: '123' }]
|
|
71
71
|
};
|
|
72
72
|
const xslt = new Xslt(options);
|
|
73
73
|
```
|
|
@@ -84,7 +84,7 @@ const xslt = new Xslt(options);
|
|
|
84
84
|
You can simply add a tag like this:
|
|
85
85
|
|
|
86
86
|
```html
|
|
87
|
-
<script type="application/javascript" src="https://www.unpkg.com/xslt-processor@1.
|
|
87
|
+
<script type="application/javascript" src="https://www.unpkg.com/xslt-processor@1.2.0/umd/xslt-processor.js"></script>
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
All the exports will live under `globalThis.XsltProcessor`. [See a usage example here](https://github.com/DesignLiquido/xslt-processor/blob/main/interactive-tests/xslt.html).
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ExprContext } from "../expr-context";
|
|
1
2
|
import { BooleanValue } from "../values/boolean-value";
|
|
2
3
|
import { Expression } from "./expression";
|
|
3
4
|
export declare class BinaryExpr extends Expression {
|
|
@@ -6,5 +7,5 @@ export declare class BinaryExpr extends Expression {
|
|
|
6
7
|
op: any;
|
|
7
8
|
constructor(expr1: any, op: any, expr2: any);
|
|
8
9
|
evaluate(ctx: any): any;
|
|
9
|
-
compare(ctx:
|
|
10
|
+
compare(ctx: ExprContext, cmp: any): BooleanValue;
|
|
10
11
|
}
|
|
@@ -2,7 +2,7 @@ import { ExprContext } from "..";
|
|
|
2
2
|
import { BooleanValue } from "../values/boolean-value";
|
|
3
3
|
import { Expression } from "./expression";
|
|
4
4
|
export declare class PredicateExpr extends Expression {
|
|
5
|
-
expr:
|
|
6
|
-
constructor(expr:
|
|
7
|
-
evaluate(
|
|
5
|
+
expr: Expression;
|
|
6
|
+
constructor(expr: Expression);
|
|
7
|
+
evaluate(context: ExprContext): BooleanValue;
|
|
8
8
|
}
|
|
@@ -5,6 +5,7 @@ export declare function ceiling(context: ExprContext): NumberValue;
|
|
|
5
5
|
export declare function concat(context: ExprContext): StringValue;
|
|
6
6
|
export declare function contains(context: ExprContext): BooleanValue;
|
|
7
7
|
export declare function count(context: ExprContext): NumberValue;
|
|
8
|
+
export declare function current(context: ExprContext): NodeSetValue;
|
|
8
9
|
export declare function endsWith(context: ExprContext): BooleanValue;
|
|
9
10
|
export declare function _false(): BooleanValue;
|
|
10
11
|
export declare function floor(context: ExprContext): NumberValue;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ExprContext } from "./expr-context";
|
|
1
2
|
import { BooleanValue } from "./values/boolean-value";
|
|
2
3
|
export declare class NodeTestNC {
|
|
3
4
|
regex: RegExp;
|
|
4
5
|
nsprefix: any;
|
|
5
|
-
constructor(nsprefix:
|
|
6
|
-
evaluate(ctx:
|
|
6
|
+
constructor(nsprefix: string);
|
|
7
|
+
evaluate(ctx: ExprContext): BooleanValue;
|
|
7
8
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { XNode } from "../../dom";
|
|
1
2
|
export declare class NodeSetValue {
|
|
2
|
-
value:
|
|
3
|
+
value: XNode[];
|
|
3
4
|
type: string;
|
|
4
5
|
constructor(value: any);
|
|
5
6
|
stringValue(): any;
|
|
6
7
|
booleanValue(): boolean;
|
|
7
8
|
numberValue(): number;
|
|
8
|
-
nodeSetValue():
|
|
9
|
+
nodeSetValue(): XNode[];
|
|
9
10
|
}
|
package/umd/xslt-processor.js
CHANGED
|
@@ -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
|
-
***************************************************************************** */var f=function(e,r){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])},f(e,r)};function g(e,r){function t(){this.constructor=e}f(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}var m=function(){function e(e,r,t,a,o){this.id=Math.random()*(Number.MAX_SAFE_INTEGER-1)+1,this.attributes=[],this.childNodes=[],this.transformedAttributes=[],this.transformedChildNodes=[],this.visited=!1,this.escape=!0,this.siblingPosition=-1,this.init(e,r,t,a,o)}return e.prototype.init=function(e,r,t,a,o){var n;this.nodeType=e-0,this.nodeName="".concat(r),this.nodeValue="".concat(t),this.ownerDocument=a,this.namespaceUri=o||null,n=this.qualifiedNameToParts("".concat(r)),this.prefix=n[0],this.localName=n[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("XDocument"!==e.constructor.name){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,o,n){if(this._unusedXNodes.length>0){var i=this._unusedXNodes.pop();return i.init(r,t,a,o,n),i}return new e(r,t,a,o,n)},e.clone=function(r,t){var a=new e(r.nodeType,r.nodeName,r.nodeValue,t,r.namespaceUri);a.id=r.id;for(var o=0,n=r.childNodes;o<n.length;o++){var i=n[o];a.appendChild(e.clone(i,a))}for(var s=0,u=r.attributes;s<u.length;s++){var l=u[s];a.setAttribute(l.nodeName,l.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,o=this.childNodes;a<o.length;a++){var n=o[a];n==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(n)}this.childNodes=t}},e.prototype.removeChild=function(e){for(var r=[],t=0,a=this.childNodes;t<a.length;t++){var o=a[t];o!=e?r.push(o):(o.previousSibling&&(o.previousSibling.nextSibling=o.nextSibling),o.nextSibling&&(o.nextSibling.previousSibling=o.previousSibling),this.firstChild==o&&(this.firstChild=o.nextSibling),this.lastChild==o&&(this.lastChild=o.previousSibling))}this.childNodes=r},e.prototype.hasAttributes=function(){return this.attributes.length>0},e.prototype.setAttribute=function(r,a){for(var o=0;o<this.attributes.length;++o)if(this.attributes[o].nodeName==r)return void(this.attributes[o].nodeValue="".concat(a));this.attributes.push(e.create(t,r,a,this))},e.prototype.setTransformedAttribute=function(r,a){for(var o=0;o<this.transformedAttributes.length;++o)if(this.transformedAttributes[o].nodeName===r)return this.transformedAttributes[o].transformedNodeName=r,void(this.transformedAttributes[o].transformedNodeValue="".concat(a));var n=e.create(t,r,a,this);n.transformedNodeName=r,n.transformedNodeValue=a,this.transformedAttributes.push(n)},e.prototype.setAttributeNS=function(r,a,o){for(var n=0;n<this.attributes.length;++n)if(this.attributes[n].namespaceUri==r&&this.attributes[n].localName==this.qualifiedNameToParts("".concat(a))[1])return this.attributes[n].nodeValue="".concat(o),this.attributes[n].nodeName="".concat(a),void(this.attributes[n].prefix=this.qualifiedNameToParts("".concat(a))[0]);this.attributes.push(e.create(t,a,o,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 ae(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 ae(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(o){a!=o&&o.localName==r&&o.namespaceUri==e&&t.push(o)},null),t},e.prototype.getElementById=function(e){var r=null;return ae(this,(function(t){if(t.getAttributeValue("id")==e)return r=t,!1}),null),r},e.prototype.getAncestorByLocalName=function(e){if(null!==this.parentNode&&void 0!==this.parentNode)return this.parentNode.localName===e?this.parentNode:this.parentNode.getAncestorByLocalName(e)},e.prototype.getAncestorById=function(e){if(null!==this.parentNode&&void 0!==this.parentNode)return this.parentNode.id===e?this.parentNode:this.parentNode.getAncestorById(e)},e._unusedXNodes=[],e}(),b=function(e){function u(){var r=e.call(this,i,"#document",null,null)||this;return r.documentElement=null,r}return g(u,e),u.prototype.clear=function(){m.recycle(this.documentElement),this.documentElement=null},u.prototype.appendChild=function(r){e.prototype.appendChild.call(this,r),this.documentElement=this.childNodes[0]},u.prototype.createElement=function(e){return m.create(r,e,null,this)},u.prototype.createElementNS=function(e,t){return m.create(r,t,null,this,e)},u.prototype.createDocumentFragment=function(){return m.create(s,"#document-fragment",null,this)},u.prototype.createTextNode=function(e){return m.create(a,"#text",e,this)},u.prototype.createTransformedTextNode=function(e){var r=m.create(a,"#text",e,this);return r.transformedNodeValue=e,r},u.prototype.createAttribute=function(e){return m.create(t,e,null,this)},u.prototype.createAttributeNS=function(e,r){return m.create(t,r,null,this,e)},u.prototype.createComment=function(e){return m.create(n,"#comment",e,this)},u.prototype.createCDATASection=function(e){return m.create(o,"#cdata-section",e,this)},u.prototype.createDTDSection=function(e){return m.create(10,"#dtd-section",e,this)},u}(m),v="[ \t\r\n]+",y="(".concat(v,")?=(").concat(v,")?"),x="&#[0-9]+;|&#x[0-9a-fA-F]+;",w="".concat(v,"version").concat(y,"(\"1\\.0\"|'1\\.0')"),E="̀-͠ͅ-҃͡-֑҆-֣֡-ֹֻ-ֽֿׁ-ׂًׄ-ْٰۖ-ۜ-۟۠-ۤۧ-۪ۨ-ۭँ-ः़ा-ौ्॑-॔ॢ-ॣঁ-ঃ়ািী-ৄে-ৈো-্ৗৢ-ৣਂ਼ਾਿੀ-ੂੇ-ੈੋ-੍ੰ-ੱઁ-ઃ઼ા-ૅે-ૉો-્ଁ-ଃ଼ା-ୃେ-ୈୋ-୍ୖ-ୗஂ-ஃா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕ-ౖಂ-ಃಾ-ೄೆ-ೈೊ-್ೕ-ೖം-ഃാ-ൃെ-ൈൊ-്ൗัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-༹༙༵༷༾༿ཱ-྄྆-ྋྐ-ྕྗྙ-ྭྱ-ྷྐྵ⃐-〪⃜⃡-゙゚〯",D="0-9٠-٩۰-۹०-९০-৯੦-੯૦-૯୦-୯௧-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩",N="·ːˑ·ـๆໆ々〱-〵ゝ-ゞー-ヾ",q="A-Za-zÀ-ÖØ-öø-ÿĀ-ıĴ-ľŁ-ňŊ-žƀ-ǃǍ-ǰǴ-ǵǺ-ȗɐ-ʨʻ-ˁΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϖϚϜϞϠϢ-ϳЁ-ЌЎ-яё-ќў-ҁҐ-ӄӇ-ӈӋ-ӌӐ-ӫӮ-ӵӸ-ӹԱ-Ֆՙա-ֆא-תװ-ײء-غف-يٱ-ڷں-ھۀ-ێې-ۓەۥ-ۦअ-हऽक़-ॡঅ-ঌএ-ঐও-নপ-রলশ-হড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઋઍએ-ઑઓ-નપ-રલ-ળવ-હઽૠଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଶ-ହଽଡ଼-ଢ଼ୟ-ୡஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-வஷ-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡก-ฮะา-ำเ-ๅກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ຮະາ-ຳຽເ-ໄཀ-ཇཉ-ཀྵႠ-Ⴥა-ჶᄀᄂ-ᄃᄅ-ᄇᄉᄋ-ᄌᄎ-ᄒᄼᄾᅀᅌᅎᅐᅔ-ᅕᅙᅟ-ᅡᅣᅥᅧᅩᅭ-ᅮᅲ-ᅳᅵᆞᆨᆫᆮ-ᆯᆷ-ᆸᆺᆼ-ᇂᇫᇰᇹḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼΩK-Å℮ↀ-ↂぁ-ゔァ-ヺㄅ-ㄬ가-힣一-龥〇〡-〩",A="".concat(q+D,"\\._:").concat(E).concat(N,"-"),k="[".concat(q,"_:][").concat(A,"]*"),S="&".concat(k,";"),L="".concat(S,"|").concat(x),T='"(([^<&"]|'.concat(L,")*)\"|'(([^<&']|").concat(L,")*)'"),C="(".concat(k,")").concat(y,"(").concat(T,")"),V="".concat(v,"version").concat(y,"(\"1\\.1\"|'1\\.1')"),R=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�",P=R+"\\.0-9·̀-ͯ‿-⁀-",B="[".concat(R,"][").concat(P,"]*"),F="&".concat(B,";"),U="".concat(F,"|").concat(x),O='"(([^<&"]|'.concat(U,")*)\"|'(([^<&']|").concat(U,")*)'"),I="(".concat(B,")").concat(y,"(").concat(O,")"),G="".concat(q+D,"\\._").concat(E).concat(N,"-"),H="[".concat(q,"_][").concat(G,"]*"),M=new RegExp("^(".concat(k,")")),z=new RegExp(C,"g"),j=new RegExp("^(".concat(B,")")),_=new RegExp(I,"g");function X(e,r){return e.getAttributeValue(r)}function J(e,r,t){return e.setAttribute(r,t)}function Y(e,r,t){return e.setTransformedAttribute(r,t)}function Z(e,r){return e.appendChild(r)}function W(e,r){return e.appendTransformedChild(r)}function K(e,r){return e.createTextNode(r)}function Q(e,r){return e.createTransformedTextNode(r)}function $(e,r){return e.createElement(r)}function ee(e,r){return e.createCDATASection(r)}function re(e,r){return e.createComment(r)}function te(e){return e.createDocumentFragment()}function ae(e,t,a){var o;if(t&&"boolean"==typeof(o=t.call(null,e))&&!o)return!1;for(var n=e.firstChild;n;n=n.nextSibling)if(n.nodeType==r&&"boolean"==typeof(o=ae.call(this,n,t,a))&&!o)return!1;return!(a&&"boolean"==typeof(o=a.call(null,e))&&!o)&&void 0}function oe(e,n){if(void 0===n&&(n=!1),!e)return"";var u="";if(e.nodeType==a||e.nodeType==o)u+=e.nodeValue;else if(e.nodeType==t)u+=e.nodeValue;else if(e.nodeType==r||e.nodeType==i||e.nodeType==s){if(!n){var l=e.innerText;if(null!=l)return l;var c=e.textContent;if(null!=c)return c}if(e.transformedChildNodes.length>0)for(var p=0;p<e.transformedChildNodes.length;++p)u+=oe(e.transformedChildNodes[p]);else for(p=0;p<e.childNodes.length;++p)u+=oe(e.childNodes[p])}return u}function ne(e,t,u){if(!e.visited){var l=e.transformedNodeType||e.nodeType,c=e.transformedNodeValue||e.nodeValue;if(l==a){if(e.transformedNodeValue&&""!==e.transformedNodeValue.trim()){var p=e.escape&&u.escape?se(e.transformedNodeValue):e.transformedNodeValue;t.push(p)}}else if(l==o)u.cData?t.push(c):t.push("<![CDATA[".concat(c,"]]>"));else if(l==n)t.push("\x3c!-- ".concat(c," --\x3e"));else if(l==r)null!==e.transformedNodeName&&void 0!==e.transformedNodeName?function(e,r,t){r.push("<".concat(ie(e)));for(var a=e.transformedAttributes||e.attributes,o=0;o<a.length;++o){var n=a[o];n&&(n.transformedNodeName&&n.transformedNodeValue&&r.push(" ".concat(ie(n),'="').concat(ue(n.transformedNodeValue),'"')))}var i=e.transformedChildNodes.length>0?e.transformedChildNodes:e.childNodes;if(0===i.length)t.selfClosingTags?r.push("/>"):r.push("></".concat(ie(e),">"));else{r.push(">");for(o=0;o<i.length;++o)ne(i[o],r,t);r.push("</".concat(ie(e),">"))}}(e,t,u):function(e,r,t){for(var a=e.transformedChildNodes.length>0?e.transformedChildNodes:e.childNodes,o=0;o<a.length;++o)ne(a[o],r,t)}(e,t,u);else if(l==i||l==s){var h=e.transformedChildNodes.concat(e.childNodes);h.sort((function(e,r){return e.siblingPosition-r.siblingPosition}));for(var d=0;d<h.length;++d)ne(h[d],t,u)}e.visited=!0}}function ie(e){var r=e.transformedNodeName||e.nodeName;return e.transformedPrefix&&0!=r.indexOf("".concat(e.transformedPrefix,":"))?"".concat(e.transformedPrefix,":").concat(r):r}function se(e){return"".concat(e).replace(/&/g,"&").replace(/&amp;/g,"&").replace(/</g,"<").replace(/>/g,">")}function ue(e){return se(e).replace(/"/g,""")}function le(e,r){var t=X(e,r);return t?c.decode(t):t}var ce=function(){function e(e){this.value=e,this.type="node-set"}return e.prototype.stringValue=function(){return 0===this.value.length?"":oe(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}(),pe=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}(),he=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}(),de={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",SELF_AND_SIBLINGS:"self-and-siblings"},fe=[de.ANCESTOR_OR_SELF,de.ANCESTOR,de.ATTRIBUTE,de.CHILD,de.DESCENDANT_OR_SELF,de.DESCENDANT,de.FOLLOWING_SIBLING,de.FOLLOWING,de.NAMESPACE,de.PARENT,de.PRECEDING_SIBLING,de.PRECEDING,de.SELF].join("(?=::)|")+"(?=::)",ge={label:"|",prec:17,re:new RegExp("^\\|"),key:void 0},me={label:"//",prec:19,re:new RegExp("^//"),key:void 0},be={label:"/",prec:30,re:new RegExp("^/"),key:void 0},ve={label:"::",prec:20,re:new RegExp("^::"),key:void 0},ye={label:":",prec:1e3,re:new RegExp("^:"),key:void 0},xe={label:"[axis]",re:new RegExp("^(".concat(fe,")")),key:void 0},we={label:"(",prec:34,re:new RegExp("^\\("),key:void 0},Ee={label:")",re:new RegExp("^\\)"),key:void 0},De={label:"..",prec:34,re:new RegExp("^\\.\\."),key:void 0},Ne={label:".",prec:34,re:new RegExp("^\\."),key:void 0},qe={label:"@",prec:34,re:new RegExp("^@"),key:void 0},Ae={label:",",re:new RegExp("^,"),key:void 0},ke={label:"or",prec:10,re:new RegExp("^or\\b"),key:void 0},Se={label:"and",prec:11,re:new RegExp("^and\\b"),key:void 0},Le={label:"=",prec:12,re:new RegExp("^="),key:void 0},Te={label:"!=",prec:12,re:new RegExp("^!="),key:void 0},Ce={label:">=",prec:13,re:new RegExp("^>="),key:void 0},Ve={label:">",prec:13,re:new RegExp("^>"),key:void 0},Re={label:"<=",prec:13,re:new RegExp("^<="),key:void 0},Pe={label:"<",prec:13,re:new RegExp("^<"),key:void 0},Be={label:"+",prec:14,re:new RegExp("^\\+"),left:!0,key:void 0},Fe={label:"-",prec:14,re:new RegExp("^\\-"),left:!0,key:void 0},Ue={label:"div",prec:15,re:new RegExp("^div\\b"),left:!0,key:void 0},Oe={label:"mod",prec:15,re:new RegExp("^mod\\b"),left:!0,key:void 0},Ie={label:"[",prec:32,re:new RegExp("^\\["),key:void 0},Ge={label:"]",re:new RegExp("^\\]"),key:void 0},He={label:"$",re:new RegExp("^\\$"),key:void 0},Me={label:"[ncname]",re:new RegExp("^".concat(H)),key:void 0},ze={label:"*",prec:15,re:new RegExp("^\\*"),left:!0,key:void 0},je={label:"[litq]",prec:20,re:new RegExp("^'[^\\']*'"),key:void 0},_e={label:"[litqq]",prec:20,re:new RegExp('^"[^\\"]*"'),key:void 0},Xe={label:"[number]",prec:35,re:new RegExp("^\\d+(\\.\\d*)?"),key:void 0},Je={label:"[qname]",re:new RegExp("^(".concat(H,":)?").concat(H)),key:void 0},Ye={label:"[nodeTest-start]",re:new RegExp("^(processing-instruction|comment|text|node)\\("),key:void 0},Ze=[me,be,De,Ne,ve,ye,xe,Ye,we,Ee,Ie,Ge,qe,Ae,ke,Se,Te,Le,Ce,Ve,Re,Pe,Be,Fe,ze,ge,Oe,Ue,je,_e,Xe,Je,Me,He],We={label:"?"},Ke={label:"*"},Qe={label:"+"},$e=!0,er=function(){function e(e,r,t,a,o,n,s,u,l,c){this.nodeList=e,this.outputNodeList=r,this.position=t||0,this.outputPosition=a||0,this.variables={},this.parent=n||null,this.caseInsensitive=s||!1,this.ignoreAttributesWithoutValue=u||!1,this.returnOnFirstMatch=l||!1,this.ignoreNonElementNodesForNTA=c||!1,this.inApplyTemplates=!1,this.baseTemplateMatched=!1,this.outputDepth=o||0,n?this.root=n.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,a,o){return new e(r||this.nodeList,t||this.outputNodeList,void 0!==a?a:this.position,void 0!==o?o:this.outputPosition,this.outputDepth,this,this.caseInsensitive,this.ignoreAttributesWithoutValue,this.returnOnFirstMatch,this.ignoreNonElementNodesForNTA)},e.prototype.cloneByOutput=function(r,t,a){return new e(this.nodeList,r||this.outputNodeList,this.position,void 0!==t?t:this.outputPosition,void 0!==a?a:this.outputDepth,this,this.caseInsensitive,this.ignoreAttributesWithoutValue,this.returnOnFirstMatch,this.ignoreNonElementNodesForNTA)},e.prototype.setVariable=function(e,r){r instanceof he||r instanceof u||r instanceof pe||r instanceof ce?this.variables[e]=r:"true"===r?this.variables[e]=new u(!0):"false"===r?this.variables[e]=new u(!1):Xe.re.test(r)?this.variables[e]=new pe(r):this.variables[e]=new he(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}(),rr=function(){function e(){this.value=new u(!0)}return e.prototype.evaluate=function(){return this.value},e}(),tr=function(){function e(){}return e.prototype.evaluate=function(e){return new u(e.node.nodeType==n)},e}(),ar=function(){function e(){}return e.prototype.evaluate=function(e){var a=e.nodeList[e.position];return new u(a.nodeType==r||a.nodeType==t)},e}(),or=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 u(!1):new u(this.re.test(r.nodeName)):new u(r.nodeName==this.name)},e}(),nr=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 u(r.nodeName.match(this.regex))},e}(),ir=function(){function e(e){this.target=e}return e.prototype.evaluate=function(e){return new u(7==e.node.nodeType&&(!this.target||e.node.nodeName==this.target))},e}(),sr=function(){function e(){}return e.prototype.evaluate=function(e){return new u(e.node.nodeType==a)},e}();function ur(e,r){if(r)for(var t=e.length,a=r.length-1;a>=0;--a)e[a+t]=r[a]}var lr=function(){},cr=function(e){function r(r,t,a){var o=e.call(this)||this;return o.expr1=r,o.expr2=a,o.op=t,o}return g(r,e),r.prototype.evaluate=function(e){var r;switch(this.op.value){case"or":r=new u(this.expr1.evaluate(e).booleanValue()||this.expr2.evaluate(e).booleanValue());break;case"and":r=new u(this.expr1.evaluate(e).booleanValue()&&this.expr2.evaluate(e).booleanValue());break;case"+":r=new pe(this.expr1.evaluate(e).numberValue()+this.expr2.evaluate(e).numberValue());break;case"-":r=new pe(this.expr1.evaluate(e).numberValue()-this.expr2.evaluate(e).numberValue());break;case"*":r=new pe(this.expr1.evaluate(e).numberValue()*this.expr2.evaluate(e).numberValue());break;case"mod":r=new pe(this.expr1.evaluate(e).numberValue()%this.expr2.evaluate(e).numberValue());break;case"div":r=new pe(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),o=this.expr2.evaluate(e);if("node-set"==a.type&&"node-set"==o.type){var n=a.nodeSetValue(),i=o.nodeSetValue();t=!1;for(var s=0;s<n.length;++s)for(var l=0;l<i.length;++l)r(oe(n[s]),oe(i[l]))&&(t=!0,l=i.length,s=n.length)}else if("node-set"==a.type||"node-set"==o.type)if("number"==a.type){var c=a.numberValue(),p=o.nodeSetValue();t=!1;for(var h=0;h<p.length;++h){if(r(c,oe(p[h])-0)){t=!0;break}}}else if("number"==o.type){p=a.nodeSetValue(),c=o.numberValue();t=!1;for(h=0;h<p.length;++h){if(r(oe(p[h])-0,c)){t=!0;break}}}else if("string"==a.type){c=a.stringValue(),p=o.nodeSetValue();t=!1;for(h=0;h<p.length;++h){if(r(c,oe(p[h]))){t=!0;break}}}else if("string"==o.type){p=a.nodeSetValue(),c=o.stringValue();t=!1;for(h=0;h<p.length;++h){if(r(oe(p[h]),c)){t=!0;break}}}else t=r(a.booleanValue(),o.booleanValue());else t="boolean"==a.type||"boolean"==o.type?r(a.booleanValue(),o.booleanValue()):"number"==a.type||"number"==o.type?r(a.numberValue(),o.numberValue()):r(a.stringValue(),o.stringValue());return new u(t)},r}(lr),pr=function(e){function r(r,t){var a=e.call(this)||this;return a.expr=r,a.predicate=t,a}return g(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 o=t;t=[];for(var n=0;n<o.length;++n){var i=o[n];this.predicate[a].evaluate(e.clone(o,void 0,n)).booleanValue()&&t.push(i)}}return new ce(t)},r}(lr);function hr(e){if(!e)throw new Error("Assertion failed")}var dr=new RegExp("(\\".concat(["/",".","*","+","?","|","^","$","(",")","[","]","{","}","\\"].join("|\\"),")"),"g");function fr(e){hr(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 ce(t)}function gr(e){return hr(3===this.args.length),this.args[0].evaluate(e).booleanValue()?this.args[1].evaluate(e):this.args[2].evaluate(e)}function mr(e){hr(2===this.args.length);for(var r=this.args[0].evaluate(e).nodeSetValue(),t=this.args[1].evaluate(e).stringValue(),a="",o=0;o<r.length;++o)a&&(a+=t),a+=oe(r[o]);return new he(a)}function br(e){return hr(1===this.args.length),new u(this.args[0].evaluate(e).booleanValue())}function vr(e){hr(1===this.args.length);var r=this.args[0].evaluate(e).numberValue();return new pe(Math.ceil(r))}function yr(e){for(var r="",t=0;t<this.args.length;++t)r+=this.args[t].evaluate(e).stringValue();return new he(r)}function xr(e){hr(2===this.args.length);var r=this.args[0].evaluate(e).stringValue(),t=this.args[1].evaluate(e).stringValue();return new u(r.includes(t))}function wr(e){hr(1===this.args.length);var r=this.args[0].evaluate(e);return new pe(r.nodeSetValue().length)}function Er(e){hr(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(dr,"\\$1"),"$"));return new u(a.test(r))}function Dr(){return hr(0===this.args.length),new u(!1)}function Nr(e){hr(1===this.args.length);var r=this.args[0].evaluate(e).numberValue();return new pe(Math.floor(r))}function qr(e){return new he("A"+function(e,r){void 0===r&&(r=0);for(var t=3735928559^r,a=1103547991^r,o=0,n=void 0;o<e.length;o++)n=e.charCodeAt(o),t=Math.imul(t^n,2654435761),a=Math.imul(a^n,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)}(JSON.stringify(e.nodeList[e.position].id)))}function Ar(e){hr(1===this.args.length);var r,t=this.args[0].evaluate(e),a=[];if("node-set"==t.type){r=[];for(var o=t.nodeSetValue(),n=0;n<o.length;++n)for(var i=oe(o[n]).split(/\s+/),s=0;s<i.length;++s)r.push(i[s])}else r=t.stringValue().split(/\s+/);var u=e.root;for(n=0;n<r.length;++n){var l=u.getElementById(r[n]);l&&a.push(l)}return new ce(a)}function kr(e){hr(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 u(!1);var o=new RegExp("^".concat(t,"$"),"i");return new u(r.match(o)||r.replace(/_.*$/,"").match(o))}function Sr(e){return hr(0===this.args.length),new pe(e.contextSize())}function Lr(e){var r;return hr(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 he(""):new he(r[0].localName)}function Tr(e){hr(this.args.length>=2);var r,t,a=this.args[0].evaluate(e).stringValue(),o=this.args[1].evaluate(e).stringValue();if(this.args.length>2&&(r=this.args[2].evaluate(e).stringValue(),/[^mi]/.test(r)))throw new Error("Invalid regular expression syntax: ".concat(r));try{t=new RegExp(o,r)}catch(e){throw new Error("Invalid matches argument: ".concat(o))}return new u(t.test(a))}function Cr(e){var r;return hr(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 he(""):new he(r[0].nodeName)}function Vr(e){var r;return hr(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 he(""):new he(r[0].namespaceUri||"")}function Rr(e){var r;return r=(r=this.args.length>0?this.args[0].evaluate(e).stringValue():new ce([e.nodeList[e.position]]).stringValue()).replace(/^\s*/,"").replace(/\s*$/,"").replace(/\s+/g," "),new he(r)}function Pr(e){hr(1===this.args.length);var r=!this.args[0].evaluate(e).booleanValue();return new u(r)}function Br(e){return hr(1===this.args.length||0===this.args.length),1===this.args.length?new pe(this.args[0].evaluate(e).numberValue()):new pe(new ce([e.nodeList[e.position]]).numberValue())}function Fr(e){return hr(0===this.args.length),new pe(e.position+1)}function Ur(e){hr(1===this.args.length);var r=this.args[0].evaluate(e).numberValue();return new pe(Math.round(r))}function Or(e){hr(2==this.args.length);var r=this.args[0].evaluate(e).stringValue(),t=this.args[1].evaluate(e).stringValue();return new u(0===r.indexOf(t))}function Ir(e){return hr(1===this.args.length||0===this.args.length),0===this.args.length?new he(new ce([e.nodeList[e.position]]).stringValue()):new he(this.args[0].evaluate(e).stringValue())}function Gr(e){var r;return r=this.args.length>0?this.args[0].evaluate(e).stringValue():new ce([e.nodeList[e.position]]).stringValue(),new pe(r.length)}function Hr(e){hr(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 o=Math.max(0,Math.round(a)-1);r=t.substr(o)}else{var n=this.args[2].evaluate(e).numberValue(),i=Math.round(a)-1,s=(o=Math.max(0,i),Math.round(n)-Math.max(0,-i));r=t.substr(o,s)}return new he(r)}function Mr(e){hr(2===this.args.length);var r,t=this.args[0].evaluate(e).stringValue(),a=this.args[1].evaluate(e).stringValue(),o=t.indexOf(a);return r=-1===o?"":t.substr(o+a.length),new he(r)}function zr(e){hr(2===this.args.length);var r,t=this.args[0].evaluate(e).stringValue(),a=this.args[1].evaluate(e).stringValue(),o=t.indexOf(a);return r=-1===o?"":t.substr(0,o),new he(r)}function jr(e){hr(1===this.args.length);for(var r=this.args[0].evaluate(e).nodeSetValue(),t=0,a=0;a<r.length;++a)t+=oe(r[a])-0;return new pe(t)}function _r(e){hr(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(),o=0;o<t.length;++o)r=r.replace(new RegExp(t.charAt(o),"g"),a.charAt(o));return new he(r)}function Xr(){return hr(0===this.args.length),new u(!0)}function Jr(e){return hr(this.args.length<2),new he(JSON.stringify(this.args.length?oe(e.nodeList[e.position]):"null"))}var Yr=function(e){function r(r){var t=e.call(this)||this;return t.xPathFunctions={last:Sr,position:Fr,count:wr,"generate-id":qr,id:Ar,"xml-to-json":Jr,"local-name":Lr,"namespace-uri":Vr,name:Cr,string:Ir,concat:yr,"starts-with":Or,"ends-with":Er,contains:xr,"substring-before":zr,"substring-after":Mr,substring:Hr,"string-length":Gr,"normalize-space":Rr,translate:_r,matches:Tr,boolean:br,not:Pr,true:Xr,false:Dr,lang:kr,number:Br,sum:jr,floor:Nr,ceiling:vr,round:Ur,"ext-join":mr,"ext-if":gr,"ext-cardinal":fr},t.name=r,t.args=[],t}return g(r,e),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 u(!1)},r}(lr),Zr=function(e){function r(r){var t=e.call(this)||this;return t.value=r,t}return g(r,e),r.prototype.evaluate=function(){return new he(this.value)},r}(lr),Wr=function(e){function r(r){var t=e.call(this)||this;return t.absolute=!1,t.steps=[],t.xPath=r,t}return g(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 rr&&!t)if(e.axis==de.DESCENDANT_OR_SELF){if(r.axis==de.CHILD);else if(r.axis==de.SELF)return r.axis=de.DESCENDANT_OR_SELF,r}else if(e.axis==de.DESCENDANT&&r.axis==de.SELF)return r.axis=de.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 ce(t)},r}(lr),Kr=function(e){function r(r){var t=e.call(this)||this;return t.value=r,t}return g(r,e),r.prototype.evaluate=function(){return new pe(this.value)},r}(lr),Qr=function(e){function r(r,t){var a=e.call(this)||this;return a.filter=r,a.rel=t,a}return g(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,void 0,a)).nodeSetValue()).length>0);++a);return new ce(t)}for(a=0;a<r.length;++a)for(var o=this.rel.evaluate(e.clone(r,void 0,a)).nodeSetValue(),n=0;n<o.length;++n)t.push(o[n]);return new ce(t)},r}(lr),$r=function(e){function r(r){var t=e.call(this)||this;return t.expr=r,t}return g(r,e),r.prototype.evaluate=function(e){var r=this.expr.evaluate(e);return"number"==r.type?new u(e.position==r.numberValue()-1):new u(r.booleanValue())},r}(lr),et=function(e){function r(r){var t=e.call(this)||this;return t.expr=r,t}return g(r,e),r.prototype.evaluate=function(e){return new pe(-this.expr.evaluate(e).numberValue())},r}(lr),rt=function(e){function r(r,t,a,o){var n=e.call(this)||this;n.axis=r,n.nodeTest=t,n.predicate=o||[],n.hasPositionalPredicate=!1,n.xPath=a;for(var i=0;i<n.predicate.length;++i)if(n.predicateExprHasPositionalSelector(n.predicate[i].expr)){n.hasPositionalPredicate=!0;break}return n}return g(r,e),r.prototype.predicateExprHasPositionalSelector=function(e,r){if(!e)return!1;if(!r&&this.exprReturnsNumberValue(e))return!0;if(e instanceof Yr){var t=e.name.value;return"last"==t||"position"==t}return e instanceof cr&&(this.predicateExprHasPositionalSelector(e.expr1,!0)||this.predicateExprHasPositionalSelector(e.expr2,!0))},r.prototype.exprReturnsNumberValue=function(e){return e instanceof Yr?{last:!0,position:!0,count:!0,"string-length":!0,number:!0,sum:!0,floor:!0,ceiling:!0,round:!0}[e.name.value]:e instanceof et||(e instanceof cr?{"+":!0,"-":!0,"*":!0,mod:!0,div:!0}[e.op.value]:e instanceof Kr)},r.prototype.appendPredicate=function(e){this.predicate.push(e),this.hasPositionalPredicate||(this.hasPositionalPredicate=this.predicateExprHasPositionalSelector(e.expr))},r.prototype.evaluate=function(e){var r=e.nodeList[e.position],a=[],o=!1;switch(this.nodeTest instanceof rr&&(o=!0),this.axis){case de.ANCESTOR_OR_SELF:a.push(r);for(var n=r.parentNode;n;n=n.parentNode)a.push(n);break;case de.ANCESTOR:for(n=r.parentNode;n;n=n.parentNode)a.push(n);break;case de.ATTRIBUTE:if(null!=this.nodeTest.name){if(r.attributes)if(r.attributes instanceof Array)ur(a,r.attributes);else if("style"==this.nodeTest.name){var i=r.getAttributeValue("style");i&&"string"!=typeof i?a.push(m.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)for(var t=r.length-1;t>=0;--t)r[t].nodeValue&&e.push(r[t])}(a,r.attributes):ur(a,r.attributes);break;case de.CHILD:ur(a,r.childNodes);break;case de.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&&(o=!0);break;case de.DESCENDANT:s=this.xPath.xPathExtractTagNameFromNodeTest(this.nodeTest,e.ignoreNonElementNodesForNTA);this.xPath.xPathCollectDescendants(a,r,s),s&&(o=!0);break;case de.FOLLOWING:for(n=r;n;n=n.parentNode)for(var u=n.nextSibling;u;u=u.nextSibling)a.push(u),this.xPath.xPathCollectDescendants(a,u);break;case de.FOLLOWING_SIBLING:for(n=r.nextSibling;n;n=n.nextSibling)a.push(n);break;case de.NAMESPACE:throw new Error("not implemented: axis namespace");case de.PARENT:r.parentNode&&a.push(r.parentNode);break;case de.PRECEDING:for(n=r;n;n=n.parentNode)for(u=n.previousSibling;u;u=u.previousSibling)a.push(u),this.xPath.xPathCollectDescendantsReverse(a,u);break;case de.PRECEDING_SIBLING:for(n=r.previousSibling;n;n=n.previousSibling)a.push(n);break;case de.SELF:a.push(r);break;case de.SELF_AND_SIBLINGS:for(var l=0,c=e.nodeList;l<c.length;l++){var p=c[l];a.push(p)}break;default:throw new Error("ERROR -- NO SUCH AXIS: ".concat(this.axis))}if(!o){var h=a;a=[];for(var d=0;d<h.length;++d)this.nodeTest.evaluate(e.clone(h,void 0,d)).booleanValue()&&a.push(h[d])}if(!e.returnOnFirstMatch)for(d=0;d<this.predicate.length;++d){h=a;a=[];for(var f=0;f<h.length;++f){n=h[f];this.predicate[d].evaluate(e.clone(h,void 0,f)).booleanValue()&&a.push(n)}}return new ce(a)},r}(lr),tt=function(e){function r(r){var t=e.call(this)||this;return t.value=r,t}return g(r,e),r.prototype.evaluate=function(){return new he(this.value)},r}(lr),at=function(e){function r(r,t){var a=e.call(this)||this;return a.expr1=r,a.expr2=t,a}return g(r,e),r.prototype.evaluate=function(e){for(var r=this.expr1.evaluate(e).nodeSetValue(),t=this.expr2.evaluate(e).nodeSetValue(),a=r.length,o=0,n=t;o<n.length;o++){for(var i=n[o],s=!1,u=0;u<a;++u)r[u]==i&&(s=!0,u=a);s||r.push(i)}return new ce(r)},r}(lr),ot=function(e){function r(r){var t=e.call(this)||this;return t.name=r,t}return g(r,e),r.prototype.evaluate=function(e){return e.getVariable(this.name)},r}(lr),nt={label:"LocationPath",key:void 0},it={label:"RelativeLocationPath",key:void 0},st={label:"AbsoluteLocationPath",key:void 0},ut={label:"Step",key:void 0},lt={label:"NodeTest",key:void 0},ct={label:"Predicate",key:void 0},pt={label:"Literal",key:void 0},ht={label:"Expr",key:void 0},dt={label:"PrimaryExpr",key:void 0},ft={label:"Variablereference",key:void 0},gt={label:"Number",key:void 0},mt={label:"FunctionCall",key:void 0},bt={label:"ArgumentRemainder",key:void 0},vt={label:"PathExpr",key:void 0},yt={label:"UnionExpr",key:void 0},xt={label:"FilterExpr",key:void 0},wt={label:"Digits",key:void 0},Et=function(){function e(){this.xPathGrammarRules=[[nt,[it],18,this.passExpr],[nt,[st],18,this.passExpr],[st,[be,it],18,this.makeLocationExpr1],[st,[me,it],18,this.makeLocationExpr2],[st,[be],0,this.makeLocationExpr3],[st,[me],0,this.makeLocationExpr4],[it,[ut],31,this.makeLocationExpr5],[it,[it,be,ut],31,this.makeLocationExpr6],[it,[it,me,ut],31,this.makeLocationExpr7],[ut,[Ne],33,this.makeStepExpr1],[ut,[De],33,this.makeStepExpr2],[ut,[xe,ve,lt],33,this.makeStepExpr3],[ut,[qe,lt],33,this.makeStepExpr4],[ut,[lt],33,this.makeStepExpr5],[ut,[ut,ct],33,this.makeStepExpr6],[lt,[ze],33,this.makeNodeTestExpr1],[lt,[Me,ye,ze],33,this.makeNodeTestExpr2],[lt,[Je],33,this.makeNodeTestExpr3],[lt,[Ye,Ee],33,this.makeNodeTestExpr4],[lt,[Ye,pt,Ee],33,this.makeNodeTestExpr5],[ct,[Ie,ht,Ge],33,this.makePredicateExpr],[dt,[ft],33,this.passExpr],[dt,[we,ht,Ee],33,this.makePrimaryExpr],[dt,[pt],30,this.passExpr],[dt,[gt],30,this.passExpr],[dt,[mt],31,this.passExpr],[mt,[Je,we,Ee],-1,this.makeFunctionCallExpr1],[mt,[Je,we,ht,bt,Ke,Ee],-1,this.makeFunctionCallExpr2],[bt,[Ae,ht],-1,this.makeArgumentExpr],[yt,[vt],20,this.passExpr],[yt,[yt,ge,vt],20,this.makeUnionExpr],[vt,[nt],20,this.passExpr],[vt,[xt],19,this.passExpr],[vt,[xt,be,it],19,this.makePathExpr1],[vt,[xt,me,it],19,this.makePathExpr2],[xt,[dt,ct,Ke],31,this.makeFilterExpr],[ht,[dt],16,this.passExpr],[ht,[yt],16,this.passExpr],[ht,[Fe,ht],-1,this.makeUnaryMinusExpr],[ht,[ht,ke,ht],-1,this.makeBinaryExpr],[ht,[ht,Se,ht],-1,this.makeBinaryExpr],[ht,[ht,Le,ht],-1,this.makeBinaryExpr],[ht,[ht,Te,ht],-1,this.makeBinaryExpr],[ht,[ht,Pe,ht],-1,this.makeBinaryExpr],[ht,[ht,Re,ht],-1,this.makeBinaryExpr],[ht,[ht,Ve,ht],-1,this.makeBinaryExpr],[ht,[ht,Ce,ht],-1,this.makeBinaryExpr],[ht,[ht,Be,ht],-1,this.makeBinaryExpr,$e],[ht,[ht,Fe,ht],-1,this.makeBinaryExpr,$e],[ht,[ht,ze,ht],-1,this.makeBinaryExpr,$e],[ht,[ht,Ue,ht],-1,this.makeBinaryExpr,$e],[ht,[ht,Oe,ht],-1,this.makeBinaryExpr,$e],[pt,[je],-1,this.makeLiteralExpr],[pt,[_e],-1,this.makeLiteralExpr],[gt,[Xe],-1,this.makeNumberExpr],[ft,[He,Je],200,this.makeVariableReference]],this.xPathParseCache={},this.xPathRules=[]}return e.prototype.makeTokenExpr=function(e){return new tt(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 Wr(this);return e.appendStep(this.makeAbbrevStep(".")),e.absolute=!0,e},e.prototype.makeLocationExpr4=function(e){var r=new Wr(this);return r.absolute=!0,r.appendStep(this.makeAbbrevStep(e.value)),r},e.prototype.makeLocationExpr5=function(e){var r=new Wr(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 rt(e.value,t,this)},e.prototype.makeStepExpr4=function(e,r){return new rt("attribute",r,this)},e.prototype.makeStepExpr5=function(e,r){return new rt(r||"child",e,this)},e.prototype.makeStepExpr6=function(e,r){return e.appendPredicate(r),e},e.prototype.makeAbbrevStep=function(e){switch(e){case"//":return new rt("descendant-or-self",new rr,this);case".":return new rt("self",new rr,this);case"..":return new rt("parent",new rr,this)}},e.prototype.makeNodeTestExpr1=function(){return new ar},e.prototype.makeNodeTestExpr2=function(e){return new nr(e.value)},e.prototype.makeNodeTestExpr3=function(e){return new or(e.value)},e.prototype.makeNodeTestExpr4=function(e){switch(e.value.replace(/\s*\($/,"")){case"node":return new rr;case"text":return new sr;case"comment":return new tr;case"processing-instruction":return new ir("")}},e.prototype.makeNodeTestExpr5=function(e,r){var t=e.replace(/\s*\($/,"");if("processing-instruction"!=t)throw t;return new ir(r.value)},e.prototype.makePredicateExpr=function(e,r){return new $r(r)},e.prototype.makePrimaryExpr=function(e,r){return r},e.prototype.makeFunctionCallExpr1=function(e){return new Yr(e)},e.prototype.makeFunctionCallExpr2=function(e,r,t,a){var o=new Yr(e);o.appendArg(t);for(var n=0;n<a.length;++n)o.appendArg(a[n]);return o},e.prototype.makeArgumentExpr=function(e,r){return r},e.prototype.makeUnionExpr=function(e,r,t){return new at(e,t)},e.prototype.makePathExpr1=function(e,r,t){return new Qr(e,t)},e.prototype.makePathExpr2=function(e,r,t){return t.prependStep(this.makeAbbrevStep(r.value)),new Qr(e,t)},e.prototype.makeFilterExpr=function(e,r){return r.length>0?new pr(e,r):e},e.prototype.makeUnaryMinusExpr=function(e,r){return new et(r)},e.prototype.makeBinaryExpr=function(e,r,t){return new cr(e,r,t)},e.prototype.makeLiteralExpr=function(e){var r=e.value.substring(1,e.value.length-1);return new Zr(r)},e.prototype.makeNumberExpr=function(e){return new Kr(e.value)},e.prototype.makeVariableReference=function(e,r){return new ot(r.value)},e.prototype.makeSimpleExpr=function(e,r){if("$"==e.charAt(0))return new ot(e.substr(1));if("@"==e.charAt(0)){var t=new or(e.substr(1)),a=new rt("attribute",t,this),o=new Wr(this);return o.appendStep(a),o}if(e.match(/^[0-9]+$/))return new Kr(e);var n=new or(e),i=new rt(r||de.CHILD,n,this),s=new Wr(this);return s.appendStep(i),s},e.prototype.makeSimpleExpr2=function(e){for(var r=e.split("/"),t=new Wr(this),a=0;a<r.length;++a){var o=new or(r[a]),n=new rt(de.CHILD,o,this);t.appendStep(n)}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)ur(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 or?e.name:r&&e instanceof rr||e instanceof ar?"*":void 0},e.prototype.xPathMatchStack=function(e,r){var t,a,o=e.length,n=r.length,i=[];i.matchlength=0;var s=0;for(t=n-1,a=o-1;t>=0&&a>=0;--t,a-=s){s=0;var u=[];if(r[t]==Ke)for(t-=1,i.push(u);a-s>=0&&e[a-s].tag==r[t];)u.push(e[a-s]),s+=1,i.matchlength+=1;else if(r[t]==We)for(t-=1,i.push(u);a-s>=0&&s<2&&e[a-s].tag==r[t];)u.push(e[a-s]),s+=1,i.matchlength+=1;else if(r[t]==Qe){if(t-=1,i.push(u),e[a].tag!=r[t])return[];for(;a-s>=0&&e[a-s].tag==r[t];)u.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}h(u),u.expr=p(u,(function(e){return e.expr}))}return h(i),-1==t?i:[]},e.prototype.xPathParse=function(e,r,t){void 0===t&&(t=function(e){});var a="".concat(e);if(t("parse ".concat(e)),this.xPathParseInit(t),e.match(/^(\$|@)?\w+$/i)){var o=this.makeSimpleExpr(e,r);return this.xPathParseCache[e]=o,t(" ... simple"),o}if(e.match(/^\w+(\/\w+)*$/i)){o=this.makeSimpleExpr2(e);return this.xPathParseCache[e]=o,t(" ... simple 2"),o}for(var n=e,i=[],s=null,u=null,l=!1,c=0,p=0,h=0;!l;){c++,e=e.replace(/^\s*/,""),u=s,s=null;for(var d=null,f="",g=0;g<Ze.length;++g){var m=Ze[g].re.exec(e);if(p++,m&&m.length>0&&m[0].length>f.length){d=Ze[g],f=m[0];break}}for(!d||d!=Ue&&d!=Oe&&d!=Se&&d!=ke||u&&u.tag!=qe&&u.tag!=me&&u.tag!=be&&u.tag!=ve&&u.tag!=He||(d=Je),d?(e=e.substr(f.length),t("token: ".concat(f," -- ").concat(d.label)),s={tag:d,match:f,prec:d.prec?d.prec:0,expr:this.makeTokenExpr(f)}):(t("DONE"),l=!0);this.xPathReduce(i,s,r,t);)h++,t("stack: ".concat(this.stackToString(i)))}if(t("stack: ".concat(this.stackToString(i))),1!=i.length)throw"XPath parse error ".concat(n,":\n").concat(this.stackToString(i));var b=i[0].expr;return void 0!==r&&!b.absolute&&!a.startsWith("*")&&b.steps&&Array.isArray(b.steps)&&(b.steps[0].axis=r),this.xPathParseCache[n]=b,t("XPath parse: ".concat(c," / ").concat(p," / ").concat(h)),b},e.prototype.xPathParseInit=function(e){if(!this.xPathRules.length){var r=[nt,it,st,ut,lt,ct,pt,ht,dt,ft,gt,mt,bt,vt,yt,xt,wt];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<Ze.length;++a)Ze[a].key=t++;e("XPath parse INIT: ".concat(t," rules"));for(a=0;a<this.xPathGrammarRules.length;++a)for(var o=this.xPathGrammarRules[a],n=o[1],i=n.length-1;i>=0;--i){if(n[i]==Qe){u(this.xPathRules,n[i-1].key,o);break}if(n[i]!=Ke&&n[i]!=We){u(this.xPathRules,n[i].key,o);break}u(this.xPathRules,n[i-1].key,o),--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 u(e,r,t){e[r]||(e[r]=[]),e[r].push(t)}},e.prototype.xPathReduce=function(e,r,t,a){void 0===a&&(a=function(e){});var o,n=null;if(e.length>0){var i=e[e.length-1],s=this.xPathRules[i.tag.key];if(s)for(var u=0;u<s.length;++u){var l=s[u],c=this.xPathMatchStack(e,l[1]);if(c.length){(n={tag:l[0],rule:l,match:c}).prec=this.xPathGrammarPrecedence(n);break}}}if(n&&(!r||n.prec>r.prec||r.tag.left&&n.prec>=r.prec)){for(u=0;u<n.match.matchlength;++u)e.pop();a("reduce ".concat(n.tag.label," ").concat(n.prec," ahead ").concat(r?r.tag.label+" "+r.prec+(r.tag.left?" left":""):" none "));var h=p(n.match,(function(e){return e.expr}));a("going to apply ".concat(n.rule[3])),n.expr=n.rule[3].apply(this,h),e.push(n),o=!0}else r&&(a("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)),o=!1;return o},e.prototype.xPathSort=function(e,r){if(0!==r.length){for(var t=[],a=0;a<e.contextSize();++a){for(var o={node:h=e.nodeList[a],key:[]},n=e.clone([h],void 0,0,void 0),i=0,s=r;i<s.length;i++){var u=s[i],l=u.expr.evaluate(n),c=void 0;"text"===u.type?c=l.stringValue():"number"===u.type&&(c=l.numberValue()),o.key.push({value:c,order:u.order})}o.key.push({value:a,order:"ascending"}),t.push(o)}t.sort(this.xPathSortByKey);var p=[];for(a=0;a<t.length;++a){var h;(h=t[a].node).siblingPosition=a,p.push(h)}e.nodeList=p,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,o){var n=r[t],i=o.clone([a],void 0,0,void 0);if(o.returnOnFirstMatch&&!n.hasPositionalPredicate){var s=(p=n.evaluate(i).nodeSetValue()).length,u=n.predicate.length;e:for(var l=0;l<s;++l){for(var c=0;c<u;++c)if(!n.predicate[c].evaluate(o.clone(p,void 0,l,void 0)).booleanValue())continue e;if(t==r.length-1?e.push(p[l]):this.xPathStep(e,r,t+1,p[l],o),e.length>0)break}}else{i.returnOnFirstMatch=!1;var p=n.evaluate(i).nodeSetValue();for(l=0;l<p.length;++l)t==r.length-1?e.push(p[l]):this.xPathStep(e,r,t+1,p[l],o)}},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 o=0;o<e.length;++o){a=this.xPathGrammarPrecedence(e[o]);r=Math.max(r,a)}return r},e.prototype.xPathTokenPrecedence=function(e){return e.prec||2},e}(),Dt=function(){function e(e){void 0===e&&(e={escape:!0,selfClosingTags:!0,parameters:[]}),this.xPath=new Et,this.options={escape:e.escape||!0,selfClosingTags:e.selfClosingTags||!0,parameters:e.parameters||[]},this.outputMethod="xml",this.outputOmitXmlDeclaration="no"}return e.prototype.xsltProcess=function(e,r){var t=new b;this.outputDocument=t;var a=new er([e],[t]);if(this.options.parameters.length>0)for(var o=0,n=this.options.parameters;o<n.length;o++){var i=n[o];a.setVariable(i.name,new he(i.value))}return this.xsltProcessContext(a,r,t),function(e,r){void 0===r&&(r={cData:!1,escape:!0,selfClosingTags:!0});var t=[];return ne(e,t,r),t.join("")}(t,{cData:!1,escape:this.options.escape,selfClosingTags:this.options.selfClosingTags})},e.prototype.xsltProcessContext=function(e,n,u){var l=this;if(this.isXsltElement(n)){var c,p,h,d=void 0,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,D=void 0,N=void 0;switch(n.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 new Error("not implemented: ".concat(n.localName));case"apply-templates":b=(g=le(n,"select"))?this.xPath.xPathEval(g,e).nodeSetValue():e.nodeList[e.position].childNodes,v=le(n,"mode"),y=[];for(var q=0,A=(p=n.ownerDocument.documentElement).childNodes.filter((function(e){return e.nodeType==r&&l.isXsltElement(e,"template")}));q<A.length;q++){var k=A[q],S=n.getAncestorByLocalName("template");void 0!==S&&(S.id!==k.id&&(v&&k.getAttributeValue("mode")!==v||y.push(k)))}for(var L=e.clone(b),T=0;T<y.length;++T)for(var C=0;C<L.contextSize();++C){var V=L.clone([L.nodeList[C]],void 0,0,void 0);V.inApplyTemplates=!0,V.outputDepth=0,this.xsltProcessContext(V,y[T],u)}break;case"attribute":d=le(n,"name"),c=this.xsltAttributeValue(d,e),f=te(this.outputDocument),this.xsltChildNodes(e,n,f),m=function(e,n){if(void 0===n&&(n=!1),!e)return"";var u="";if(e.nodeType==a||e.nodeType==o)u+=e.nodeValue;else if(e.nodeType==t)u+=e.nodeValue;else if(e.nodeType==r||e.nodeType==i||e.nodeType==s){if(!n){var l=e.innerText;if(null!=l)return l;var c=e.textContent;if(null!=c)return c}for(var p=e.transformedChildNodes.length,h=0;h<p;++h)u+=oe(e.transformedChildNodes[h])}return u}(f),Y(u,c,m);break;case"call-template":c=le(n,"name"),p=n.ownerDocument.documentElement,x=e.clone(),this.xsltWithParam(x,n);for(T=0;T<p.childNodes.length;++T){var R=p.childNodes[T];if(R.nodeType==r&&this.isXsltElement(R,"template")&&X(R,"name")==c){this.xsltChildNodes(x,R,u);break}}break;case"choose":this.xsltChoose(e,n,u);break;case"comment":f=te(this.outputDocument),this.xsltChildNodes(e,n,f),w=oe(f),E=re(this.outputDocument,w),u.appendChild(E);break;case"copy":(f=this.xsltCopy(u,e.nodeList[e.position],this.outputDocument))&&this.xsltChildNodes(e,n,f);break;case"copy-of":if(g=le(n,"select"),"node-set"==(m=this.xPath.xPathEval(g,e)).type){b=m.nodeSetValue();for(T=0;T<b.length;++T)this.xsltCopyOf(u,b[T],this.outputDocument)}else{Z(u,K(this.outputDocument,m.stringValue()))}break;case"element":d=le(n,"name"),c=this.xsltAttributeValue(d,e),(f=$(this.outputDocument,c)).transformedNodeName=c,W(e.outputNodeList[e.outputPosition],f);var P=e.clone(void 0,[f],void 0,0);this.xsltChildNodes(P,n,f);break;case"for-each":this.xsltForEach(e,n,u);break;case"if":h=le(n,"test"),this.xPath.xPathEval(h,e).booleanValue()&&this.xsltChildNodes(e,n,u);break;case"otherwise":throw"error if here: ".concat(n.localName);case"output":this.outputMethod=le(n,"method"),this.outputOmitXmlDeclaration=le(n,"omit-xml-declaration");break;case"param":this.xsltVariable(e,n,!1);break;case"sort":this.xsltSort(e,n);break;case"stylesheet":case"transform":this.xsltChildNodes(e,n,u);break;case"template":if(!e.inApplyTemplates&&e.baseTemplateMatched)break;if(!(D=le(n,"match")))break;(b=this.xsltMatch(D,e,"self-and-siblings")).length>0&&(e.inApplyTemplates||(e.baseTemplateMatched=!0),this.xsltChildNodes(e,n,u));break;case"text":N=oe(n),f=Q(this.outputDocument,N);var B=n.attributes.filter((function(e){return"disable-output-escaping"===e.nodeName}));B.length>0&&"yes"===B[0].nodeValue&&(f.escape=!1),u.appendTransformedChild(f);break;case"value-of":g=le(n,"select"),m=this.xPath.xPathEval(g,e).stringValue(),(f=Q(this.outputDocument,m)).siblingPosition=e.nodeList[e.position].siblingPosition,e.outputNodeList[e.outputPosition].appendTransformedChild(f);break;case"variable":this.xsltVariable(e,n,!0);break;default:throw new Error("error if here: ".concat(n.localName))}}else this.xsltPassThrough(e,n,u)},e.prototype.xsltCopy=function(e,i,s){if(i.nodeType==r)return(u=$(s,i.nodeName)).transformedNodeName=i.nodeName,W(e,u),u;if(i.nodeType==a)W(e,u=Q(s,i.nodeValue));else if(i.nodeType==o){W(e,u=ee(s,i.nodeValue))}else if(i.nodeType==n){var u;W(e,u=re(s,i.nodeValue))}else i.nodeType==t&&Y(e,i.nodeName,i.nodeValue);return null},e.prototype.xsltSort=function(e,t){for(var a=[],o=0,n=t.childNodes;o<n.length;o++){var i=n[o];if(i.nodeType==r&&this.isXsltElement(i,"sort")){var s=le(i,"select"),u=this.xPath.xPathParse(s),l=le(i,"data-type")||"text",c=le(i,"order")||"ascending";a.push({expr:u,type:l,order:c})}}this.xPath.xPathSort(e,a)},e.prototype.xsltVariable=function(e,r,t){var a,o=le(r,"name"),n=le(r,"select");if(r.childNodes.length>0){var i=te(r.ownerDocument);this.xsltChildNodes(e,r,i),a=new ce([i])}else if(n)a=this.xPath.xPathEval(n,e);else{var s="",u=this.options.parameters.filter((function(e){return e.name===o}));u.length>0&&(s=u[0].value),a=new he(s)}!t&&e.getVariable(o)||e.setVariable(o,a)},e.prototype.xsltChoose=function(e,t,a){for(var o=0,n=t.childNodes;o<n.length;o++){var i=n[o];if(i.nodeType===r)if(this.isXsltElement(i,"when")){var s=le(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=le(r,"select"),o=this.xPath.xPathEval(a,e).nodeSetValue(),n=e.clone(o);this.xsltSort(n,r);var i=n.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=n.nodeList;for(var s=0;s<n.contextSize();++s)this.xsltChildNodes(n.clone(n.nodeList,void 0,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(),o=0;o<r.childNodes.length;++o)this.xsltProcessContext(a,r.childNodes[o],t)},e.prototype.xsltPassThrough=function(e,t,o){if(t.nodeType==a){if(this.xsltPassText(t)){var n=e.outputNodeList[e.outputPosition].transformedChildNodes.filter((function(e){return e.nodeType===a}));if(n.length>0)(i=n[0]).transformedNodeValue=t.nodeValue;else(i=Q(this.outputDocument,t.nodeValue)).transformedParentNode=e.outputNodeList[e.outputPosition],W(e.outputNodeList[e.outputPosition],i)}}else if(t.nodeType==r){var i=void 0,s=e;"#document"===e.nodeList[e.position].nodeName?(i=e.nodeList[e.position].firstChild,s=e.clone([i])):i=e.nodeList[e.position];var u=void 0;void 0===i.outputNode||null===i.outputNode||e.outputDepth>0?((u=$(this.outputDocument,t.nodeName)).siblingPosition=i.siblingPosition,i.outputNode=u):u=i.outputNode,u.transformedNodeName=t.nodeName,u.transformedLocalName=t.localName;var l=t.attributes.filter((function(e){return e}));if(0===l.length)u.transformedAttributes=[];else for(var c=0,p=l;c<p.length;c++){var h=p[c];Y(u,h.nodeName,this.xsltAttributeValue(h.nodeValue,s))}var d=e.outputNodeList[e.outputPosition];W(d,u);var f=s.cloneByOutput(d.transformedChildNodes,d.transformedChildNodes.length-1,++s.outputDepth);this.xsltChildNodes(f,t,i)}else this.xsltChildNodes(e,t,o)},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=X(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="",o=0;o<t.length;++o){var n=t[o].split("}");if(2==n.length)a+=this.xPath.xPathEval(n[0],r).stringValue()+n[1];else a+=t[o]}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 o=this.xsltCopy(e,r,t);if(o){for(a=0;a<r.attributes.length;++a)this.xsltCopyOf(o,r.attributes[a],t);for(a=0;a<r.childNodes.length;++a)this.xsltCopyOf(o,r.childNodes[a],t)}}},e.prototype.xsltMatch=function(e,r,t){var a=this.xPath.xPathParse(e,t);return a instanceof Wr?this.xsltLocationExpressionMatch(a,r):a instanceof at?this.xsltLocationExpressionMatch(a.expr1,r)||this.xsltLocationExpressionMatch(a.expr2,r):[]},e.prototype.xsltLocationExpressionMatch=function(e,r){if(void 0===e||void 0===e.steps||e.steps.length<=0)throw new Error("Error resolving XSLT match: Location Expression should have steps.");return e.absolute?this.absoluteXsltMatch(e,r):this.relativeXsltMatch(e,r)},e.prototype.absoluteXsltMatch=function(e,r){for(var t=r.clone([r.root],void 0,0,void 0),a=[],o=0,n=e.evaluate(t).nodeSetValue();o<n.length;o++){var i=n[o];i.id!==r.nodeList[r.position].id?void 0!==i.getAncestorById(r.nodeList[r.position].id)&&a.push(i):a.push(i)}return a},e.prototype.relativeXsltMatch=function(e,r){var t=r.clone(),a=e.evaluate(t).nodeSetValue();return 1===a.length&&"#document"===a[0].nodeName?[a[0].childNodes[0]]:a},e.prototype.xsltWithParam=function(e,t){for(var a=0,o=t.childNodes;a<o.length;a++){var n=o[a];n.nodeType===r&&this.isXsltElement(n,"with-param")&&this.xsltVariable(e,n,!0)}},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=er,e.XPath=Et,e.Xslt=Dt,e.xmlEscapeText=se,e.xmlParse=function(e){var r,t,a=/\/$/;if(e.match(/^<\?xml/))if(5==e.search(new RegExp(w)))r=M,t=z;else{if(5!=e.search(new RegExp(V)))throw new Error("VersionInfo is missing, or unknown version number.");r=j,t=_}else r=M,t=z;var o=new b,n=o,i=[],s=n;i.push(s);for(var u,l=!1,p=!1,h=!1,f=0,g=0;g<e.length;++g){var m=e.charAt(g);if(l&&!h&&"'"===m)p=!p;else if(l&&!p&&'"'===m)h=!h;else if(!l||">"!==m||p||h){if(!l&&"<"===m){if((x=e.slice(f,g))&&s!==n&&Z(s,K(o,x)),"!--"===e.slice(g+1,g+4)){if(v=e.slice(g+4).indexOf("--\x3e"))Z(s,D=re(o,e.slice(g+4,g+v+4))),g+=v+6}else if("![CDATA["===e.slice(g+1,g+9)){if(v=e.slice(g+9).indexOf("]]>"))Z(s,D=ee(o,e.slice(g+9,g+v+9))),g+=v+11}else if("!DOCTYPE"===e.slice(g+1,g+9)){var v;if(v=e.slice(g+9).indexOf(">")){var y=e.slice(g+9,g+v+9).trimStart();D=void 0;"xsl:text"===s.nodeName?D=K(o,"<!DOCTYPE ".concat(y,">")):(u=y,D=o.createDTDSection(u)),Z(s,D),g+=v+y.length+5}}else l=!0;f=g+1}}else{var x;if("/"==(x=e.slice(f,g)).charAt(0))i.pop(),s=i[i.length-1];else if("?"===x.charAt(0));else if("!"===x.charAt(0));else{for(var E=x.match(a),D=$(o,r.exec(x)[1]),N=void 0;N=t.exec(x);){var q=c.decode(N[5]||N[7]||"");J(D,N[1],q)}D.siblingPosition=s.childNodes.length,Z(s,D),E||(s=D,i.push(D));var A=d(D);null!==D.prefix?D.prefix in A&&(D.namespaceUri=A[D.prefix]):""in A&&(D.namespaceUri=A[""]);for(var k=0;k<D.attributes.length;++k)null!==D.attributes[k].prefix&&D.attributes[k].prefix in A&&(D.attributes[k].namespaceUri=A[D.attributes[k].prefix])}f=g+1,l=!1,p=!1,h=!1}}return n},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
15
|
+
***************************************************************************** */var f=function(e,r){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])},f(e,r)};function g(e,r){function t(){this.constructor=e}f(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}var m=function(){function e(e,r,t,a,o){this.id=Math.random()*(Number.MAX_SAFE_INTEGER-1)+1,this.attributes=[],this.childNodes=[],this.transformedAttributes=[],this.transformedChildNodes=[],this.visited=!1,this.escape=!0,this.siblingPosition=-1,this.init(e,r,t,a,o)}return e.prototype.init=function(e,r,t,a,o){var n;this.nodeType=e-0,this.nodeName="".concat(r),this.nodeValue="".concat(t),this.ownerDocument=a,this.namespaceUri=o||null,n=this.qualifiedNameToParts("".concat(r)),this.prefix=n[0],this.localName=n[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("XDocument"!==e.constructor.name){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,o,n){if(this._unusedXNodes.length>0){var i=this._unusedXNodes.pop();return i.init(r,t,a,o,n),i}return new e(r,t,a,o,n)},e.clone=function(r,t){var a=new e(r.nodeType,r.nodeName,r.nodeValue,t,r.namespaceUri);a.id=r.id;for(var o=0,n=r.childNodes;o<n.length;o++){var i=n[o];a.appendChild(e.clone(i,a))}for(var s=0,u=r.attributes;s<u.length;s++){var l=u[s];a.setAttribute(l.nodeName,l.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,o=this.childNodes;a<o.length;a++){var n=o[a];n==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(n)}this.childNodes=t}},e.prototype.removeChild=function(e){for(var r=[],t=0,a=this.childNodes;t<a.length;t++){var o=a[t];o!=e?r.push(o):(o.previousSibling&&(o.previousSibling.nextSibling=o.nextSibling),o.nextSibling&&(o.nextSibling.previousSibling=o.previousSibling),this.firstChild==o&&(this.firstChild=o.nextSibling),this.lastChild==o&&(this.lastChild=o.previousSibling))}this.childNodes=r},e.prototype.hasAttributes=function(){return this.attributes.length>0},e.prototype.setAttribute=function(r,a){for(var o=0;o<this.attributes.length;++o)if(this.attributes[o].nodeName==r)return void(this.attributes[o].nodeValue="".concat(a));this.attributes.push(e.create(t,r,a,this))},e.prototype.setTransformedAttribute=function(r,a){for(var o=0;o<this.transformedAttributes.length;++o)if(this.transformedAttributes[o].nodeName===r)return this.transformedAttributes[o].transformedNodeName=r,void(this.transformedAttributes[o].transformedNodeValue="".concat(a));var n=e.create(t,r,a,this);n.transformedNodeName=r,n.transformedNodeValue=a,this.transformedAttributes.push(n)},e.prototype.setAttributeNS=function(r,a,o){for(var n=0;n<this.attributes.length;++n)if(this.attributes[n].namespaceUri==r&&this.attributes[n].localName==this.qualifiedNameToParts("".concat(a))[1])return this.attributes[n].nodeValue="".concat(o),this.attributes[n].nodeName="".concat(a),void(this.attributes[n].prefix=this.qualifiedNameToParts("".concat(a))[0]);this.attributes.push(e.create(t,a,o,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 ae(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 ae(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(o){a!=o&&o.localName==r&&o.namespaceUri==e&&t.push(o)},null),t},e.prototype.getElementById=function(e){var r=null;return ae(this,(function(t){if(t.getAttributeValue("id")==e)return r=t,!1}),null),r},e.prototype.getAncestorByLocalName=function(e){if(null!==this.parentNode&&void 0!==this.parentNode)return this.parentNode.localName===e?this.parentNode:this.parentNode.getAncestorByLocalName(e)},e.prototype.getAncestorById=function(e){if(null!==this.parentNode&&void 0!==this.parentNode)return this.parentNode.id===e?this.parentNode:this.parentNode.getAncestorById(e)},e._unusedXNodes=[],e}(),b=function(e){function u(){var r=e.call(this,i,"#document",null,null)||this;return r.documentElement=null,r}return g(u,e),u.prototype.clear=function(){m.recycle(this.documentElement),this.documentElement=null},u.prototype.appendChild=function(r){e.prototype.appendChild.call(this,r),this.documentElement=this.childNodes[0]},u.prototype.createElement=function(e){return m.create(r,e,null,this)},u.prototype.createElementNS=function(e,t){return m.create(r,t,null,this,e)},u.prototype.createDocumentFragment=function(){return m.create(s,"#document-fragment",null,this)},u.prototype.createTextNode=function(e){return m.create(a,"#text",e,this)},u.prototype.createTransformedTextNode=function(e){var r=m.create(a,"#text",e,this);return r.transformedNodeValue=e,r},u.prototype.createAttribute=function(e){return m.create(t,e,null,this)},u.prototype.createAttributeNS=function(e,r){return m.create(t,r,null,this,e)},u.prototype.createComment=function(e){return m.create(n,"#comment",e,this)},u.prototype.createCDATASection=function(e){return m.create(o,"#cdata-section",e,this)},u.prototype.createDTDSection=function(e){return m.create(10,"#dtd-section",e,this)},u}(m),v="[ \t\r\n]+",y="(".concat(v,")?=(").concat(v,")?"),x="&#[0-9]+;|&#x[0-9a-fA-F]+;",w="".concat(v,"version").concat(y,"(\"1\\.0\"|'1\\.0')"),E="̀-͠ͅ-҃͡-֑҆-֣֡-ֹֻ-ֽֿׁ-ׂًׄ-ْٰۖ-ۜ-۟۠-ۤۧ-۪ۨ-ۭँ-ः़ा-ौ्॑-॔ॢ-ॣঁ-ঃ়ািী-ৄে-ৈো-্ৗৢ-ৣਂ਼ਾਿੀ-ੂੇ-ੈੋ-੍ੰ-ੱઁ-ઃ઼ા-ૅે-ૉો-્ଁ-ଃ଼ା-ୃେ-ୈୋ-୍ୖ-ୗஂ-ஃா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕ-ౖಂ-ಃಾ-ೄೆ-ೈೊ-್ೕ-ೖം-ഃാ-ൃെ-ൈൊ-്ൗัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-༹༙༵༷༾༿ཱ-྄྆-ྋྐ-ྕྗྙ-ྭྱ-ྷྐྵ⃐-〪⃜⃡-゙゚〯",D="0-9٠-٩۰-۹०-९০-৯੦-੯૦-૯୦-୯௧-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩",N="·ːˑ·ـๆໆ々〱-〵ゝ-ゞー-ヾ",q="A-Za-zÀ-ÖØ-öø-ÿĀ-ıĴ-ľŁ-ňŊ-žƀ-ǃǍ-ǰǴ-ǵǺ-ȗɐ-ʨʻ-ˁΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϖϚϜϞϠϢ-ϳЁ-ЌЎ-яё-ќў-ҁҐ-ӄӇ-ӈӋ-ӌӐ-ӫӮ-ӵӸ-ӹԱ-Ֆՙա-ֆא-תװ-ײء-غف-يٱ-ڷں-ھۀ-ێې-ۓەۥ-ۦअ-हऽक़-ॡঅ-ঌএ-ঐও-নপ-রলশ-হড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઋઍએ-ઑઓ-નપ-રલ-ળવ-હઽૠଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଶ-ହଽଡ଼-ଢ଼ୟ-ୡஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-வஷ-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡก-ฮะา-ำเ-ๅກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ຮະາ-ຳຽເ-ໄཀ-ཇཉ-ཀྵႠ-Ⴥა-ჶᄀᄂ-ᄃᄅ-ᄇᄉᄋ-ᄌᄎ-ᄒᄼᄾᅀᅌᅎᅐᅔ-ᅕᅙᅟ-ᅡᅣᅥᅧᅩᅭ-ᅮᅲ-ᅳᅵᆞᆨᆫᆮ-ᆯᆷ-ᆸᆺᆼ-ᇂᇫᇰᇹḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼΩK-Å℮ↀ-ↂぁ-ゔァ-ヺㄅ-ㄬ가-힣一-龥〇〡-〩",A="".concat(q+D,"\\._:").concat(E).concat(N,"-"),k="[".concat(q,"_:][").concat(A,"]*"),S="&".concat(k,";"),L="".concat(S,"|").concat(x),T='"(([^<&"]|'.concat(L,")*)\"|'(([^<&']|").concat(L,")*)'"),C="(".concat(k,")").concat(y,"(").concat(T,")"),V="".concat(v,"version").concat(y,"(\"1\\.1\"|'1\\.1')"),R=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�",P=R+"\\.0-9·̀-ͯ‿-⁀-",B="[".concat(R,"][").concat(P,"]*"),F="&".concat(B,";"),U="".concat(F,"|").concat(x),O='"(([^<&"]|'.concat(U,")*)\"|'(([^<&']|").concat(U,")*)'"),I="(".concat(B,")").concat(y,"(").concat(O,")"),G="".concat(q+D,"\\._").concat(E).concat(N,"-"),H="[".concat(q,"_][").concat(G,"]*"),M=new RegExp("^(".concat(k,")")),z=new RegExp(C,"g"),j=new RegExp("^(".concat(B,")")),_=new RegExp(I,"g");function X(e,r){return e.getAttributeValue(r)}function J(e,r,t){return e.setAttribute(r,t)}function Y(e,r,t){return e.setTransformedAttribute(r,t)}function Z(e,r){return e.appendChild(r)}function W(e,r){return e.appendTransformedChild(r)}function K(e,r){return e.createTextNode(r)}function Q(e,r){return e.createTransformedTextNode(r)}function $(e,r){return e.createElement(r)}function ee(e,r){return e.createCDATASection(r)}function re(e,r){return e.createComment(r)}function te(e){return e.createDocumentFragment()}function ae(e,t,a){var o;if(t&&"boolean"==typeof(o=t.call(null,e))&&!o)return!1;for(var n=e.firstChild;n;n=n.nextSibling)if(n.nodeType==r&&"boolean"==typeof(o=ae.call(this,n,t,a))&&!o)return!1;return!(a&&"boolean"==typeof(o=a.call(null,e))&&!o)&&void 0}function oe(e,n){if(void 0===n&&(n=!1),!e)return"";var u="";if(e.nodeType==a||e.nodeType==o)u+=e.nodeValue;else if(e.nodeType==t)u+=e.nodeValue;else if(e.nodeType==r||e.nodeType==i||e.nodeType==s){if(!n){var l=e.innerText;if(null!=l)return l;var c=e.textContent;if(null!=c)return c}if(e.transformedChildNodes.length>0)for(var p=0;p<e.transformedChildNodes.length;++p)u+=oe(e.transformedChildNodes[p]);else for(p=0;p<e.childNodes.length;++p)u+=oe(e.childNodes[p])}return u}function ne(e,t,u){if(!e.visited){var l=e.transformedNodeType||e.nodeType,c=e.transformedNodeValue||e.nodeValue;if(l==a){if(e.transformedNodeValue&&""!==e.transformedNodeValue.trim()){var p=e.escape&&u.escape?se(e.transformedNodeValue):e.transformedNodeValue;t.push(p)}}else if(l==o)u.cData?t.push(c):t.push("<![CDATA[".concat(c,"]]>"));else if(l==n)t.push("\x3c!-- ".concat(c," --\x3e"));else if(l==r)null!==e.transformedNodeName&&void 0!==e.transformedNodeName?function(e,r,t){r.push("<".concat(ie(e)));for(var a=e.transformedAttributes||e.attributes,o=0;o<a.length;++o){var n=a[o];n&&(n.transformedNodeName&&n.transformedNodeValue&&r.push(" ".concat(ie(n),'="').concat(ue(n.transformedNodeValue),'"')))}var i=e.transformedChildNodes.length>0?e.transformedChildNodes:e.childNodes;if(0===i.length)t.selfClosingTags?r.push("/>"):r.push("></".concat(ie(e),">"));else{r.push(">");for(o=0;o<i.length;++o)ne(i[o],r,t);r.push("</".concat(ie(e),">"))}}(e,t,u):function(e,r,t){for(var a=e.transformedChildNodes.length>0?e.transformedChildNodes:e.childNodes,o=0;o<a.length;++o)ne(a[o],r,t)}(e,t,u);else if(l==i||l==s){var h=e.transformedChildNodes.concat(e.childNodes);h.sort((function(e,r){return e.siblingPosition-r.siblingPosition}));for(var d=0;d<h.length;++d)ne(h[d],t,u)}e.visited=!0}}function ie(e){var r=e.transformedNodeName||e.nodeName;return e.transformedPrefix&&0!=r.indexOf("".concat(e.transformedPrefix,":"))?"".concat(e.transformedPrefix,":").concat(r):r}function se(e){return"".concat(e).replace(/&/g,"&").replace(/&amp;/g,"&").replace(/</g,"<").replace(/>/g,">")}function ue(e){return se(e).replace(/"/g,""")}function le(e,r){var t=X(e,r);return t?c.decode(t):t}var ce=function(){function e(e){this.value=e,this.type="node-set"}return e.prototype.stringValue=function(){return 0===this.value.length?"":oe(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}(),pe=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}(),he=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}(),de={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",SELF_AND_SIBLINGS:"self-and-siblings"},fe=[de.ANCESTOR_OR_SELF,de.ANCESTOR,de.ATTRIBUTE,de.CHILD,de.DESCENDANT_OR_SELF,de.DESCENDANT,de.FOLLOWING_SIBLING,de.FOLLOWING,de.NAMESPACE,de.PARENT,de.PRECEDING_SIBLING,de.PRECEDING,de.SELF].join("(?=::)|")+"(?=::)",ge={label:"|",prec:17,re:new RegExp("^\\|"),key:void 0},me={label:"//",prec:19,re:new RegExp("^//"),key:void 0},be={label:"/",prec:30,re:new RegExp("^/"),key:void 0},ve={label:"::",prec:20,re:new RegExp("^::"),key:void 0},ye={label:":",prec:1e3,re:new RegExp("^:"),key:void 0},xe={label:"[axis]",re:new RegExp("^(".concat(fe,")")),key:void 0},we={label:"(",prec:34,re:new RegExp("^\\("),key:void 0},Ee={label:")",re:new RegExp("^\\)"),key:void 0},De={label:"..",prec:34,re:new RegExp("^\\.\\."),key:void 0},Ne={label:".",prec:34,re:new RegExp("^\\."),key:void 0},qe={label:"@",prec:34,re:new RegExp("^@"),key:void 0},Ae={label:",",re:new RegExp("^,"),key:void 0},ke={label:"or",prec:10,re:new RegExp("^or\\b"),key:void 0},Se={label:"and",prec:11,re:new RegExp("^and\\b"),key:void 0},Le={label:"=",prec:12,re:new RegExp("^="),key:void 0},Te={label:"!=",prec:12,re:new RegExp("^!="),key:void 0},Ce={label:">=",prec:13,re:new RegExp("^>="),key:void 0},Ve={label:">",prec:13,re:new RegExp("^>"),key:void 0},Re={label:"<=",prec:13,re:new RegExp("^<="),key:void 0},Pe={label:"<",prec:13,re:new RegExp("^<"),key:void 0},Be={label:"+",prec:14,re:new RegExp("^\\+"),left:!0,key:void 0},Fe={label:"-",prec:14,re:new RegExp("^\\-"),left:!0,key:void 0},Ue={label:"div",prec:15,re:new RegExp("^div\\b"),left:!0,key:void 0},Oe={label:"mod",prec:15,re:new RegExp("^mod\\b"),left:!0,key:void 0},Ie={label:"[",prec:32,re:new RegExp("^\\["),key:void 0},Ge={label:"]",re:new RegExp("^\\]"),key:void 0},He={label:"$",re:new RegExp("^\\$"),key:void 0},Me={label:"[ncname]",re:new RegExp("^".concat(H)),key:void 0},ze={label:"*",prec:15,re:new RegExp("^\\*"),left:!0,key:void 0},je={label:"[litq]",prec:20,re:new RegExp("^'[^\\']*'"),key:void 0},_e={label:"[litqq]",prec:20,re:new RegExp('^"[^\\"]*"'),key:void 0},Xe={label:"[number]",prec:35,re:new RegExp("^\\d+(\\.\\d*)?"),key:void 0},Je={label:"[qname]",re:new RegExp("^(".concat(H,":)?").concat(H)),key:void 0},Ye={label:"[nodeTest-start]",re:new RegExp("^(processing-instruction|comment|text|node)\\("),key:void 0},Ze=[me,be,De,Ne,ve,ye,xe,Ye,we,Ee,Ie,Ge,qe,Ae,ke,Se,Te,Le,Ce,Ve,Re,Pe,Be,Fe,ze,ge,Oe,Ue,je,_e,Xe,Je,Me,He],We={label:"?"},Ke={label:"*"},Qe={label:"+"},$e=!0,er=function(){function e(e,r,t,a,o,n,s,u,l,c){this.nodeList=e,this.outputNodeList=r,this.position=t||0,this.outputPosition=a||0,this.variables={},this.parent=n||null,this.caseInsensitive=s||!1,this.ignoreAttributesWithoutValue=u||!1,this.returnOnFirstMatch=l||!1,this.ignoreNonElementNodesForNTA=c||!1,this.inApplyTemplates=!1,this.baseTemplateMatched=!1,this.outputDepth=o||0,n?this.root=n.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,a,o){return new e(r||this.nodeList,t||this.outputNodeList,void 0!==a?a:this.position,void 0!==o?o:this.outputPosition,this.outputDepth,this,this.caseInsensitive,this.ignoreAttributesWithoutValue,this.returnOnFirstMatch,this.ignoreNonElementNodesForNTA)},e.prototype.cloneByOutput=function(r,t,a){return new e(this.nodeList,r||this.outputNodeList,this.position,void 0!==t?t:this.outputPosition,void 0!==a?a:this.outputDepth,this,this.caseInsensitive,this.ignoreAttributesWithoutValue,this.returnOnFirstMatch,this.ignoreNonElementNodesForNTA)},e.prototype.setVariable=function(e,r){r instanceof he||r instanceof u||r instanceof pe||r instanceof ce?this.variables[e]=r:"true"===r?this.variables[e]=new u(!0):"false"===r?this.variables[e]=new u(!1):Xe.re.test(r)?this.variables[e]=new pe(r):this.variables[e]=new he(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}(),rr=function(){function e(){this.value=new u(!0)}return e.prototype.evaluate=function(){return this.value},e}(),tr=function(){function e(){}return e.prototype.evaluate=function(e){return new u(e.nodeList[e.position].nodeType==n)},e}(),ar=function(){function e(){}return e.prototype.evaluate=function(e){var a=e.nodeList[e.position];return new u(a.nodeType==r||a.nodeType==t)},e}(),or=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 u(!1):new u(this.re.test(r.nodeName)):new u(r.nodeName==this.name)},e}(),nr=function(){function e(e){this.regex=new RegExp("^".concat(e,":")),this.nsprefix=e}return e.prototype.evaluate=function(e){var r=e.nodeList[e.position];return new u(r.nodeName.match(this.regex))},e}(),ir=function(){function e(e){this.target=e}return e.prototype.evaluate=function(e){var r=e.nodeList[e.position];return new u(7==r.nodeType&&(!this.target||r.nodeName==this.target))},e}(),sr=function(){function e(){}return e.prototype.evaluate=function(e){return new u(e.nodeList[e.position].nodeType==a)},e}();function ur(e,r){if(r)for(var t=e.length,a=r.length-1;a>=0;--a)e[a+t]=r[a]}var lr=function(){},cr=function(e){function r(r,t,a){var o=e.call(this)||this;return o.expr1=r,o.expr2=a,o.op=t,o}return g(r,e),r.prototype.evaluate=function(e){var r;switch(this.op.value){case"or":r=new u(this.expr1.evaluate(e).booleanValue()||this.expr2.evaluate(e).booleanValue());break;case"and":r=new u(this.expr1.evaluate(e).booleanValue()&&this.expr2.evaluate(e).booleanValue());break;case"+":r=new pe(this.expr1.evaluate(e).numberValue()+this.expr2.evaluate(e).numberValue());break;case"-":r=new pe(this.expr1.evaluate(e).numberValue()-this.expr2.evaluate(e).numberValue());break;case"*":r=new pe(this.expr1.evaluate(e).numberValue()*this.expr2.evaluate(e).numberValue());break;case"mod":r=new pe(this.expr1.evaluate(e).numberValue()%this.expr2.evaluate(e).numberValue());break;case"div":r=new pe(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),o=this.expr2.evaluate(e);if("node-set"==a.type&&"node-set"==o.type){var n=a.nodeSetValue(),i=o.nodeSetValue();t=!1;for(var s=0;s<n.length;++s)for(var l=0;l<i.length;++l)r(oe(n[s]),oe(i[l]))&&(t=!0,l=i.length,s=n.length)}else if("node-set"==a.type||"node-set"==o.type)if("number"==a.type){var c=a.numberValue(),p=o.nodeSetValue();t=!1;for(var h=0;h<p.length;++h){if(r(c,oe(p[h])-0)){t=!0;break}}}else if("number"==o.type){p=a.nodeSetValue(),c=o.numberValue();t=!1;for(h=0;h<p.length;++h){if(r(oe(p[h])-0,c)){t=!0;break}}}else if("string"==a.type){c=a.stringValue(),p=o.nodeSetValue();t=!1;for(h=0;h<p.length;++h){if(r(c,oe(p[h]))){t=!0;break}}}else if("string"==o.type){p=a.nodeSetValue(),c=o.stringValue();t=!1;for(h=0;h<p.length;++h){if(r(oe(p[h]),c)){t=!0;break}}}else t=r(a.booleanValue(),o.booleanValue());else t="boolean"==a.type||"boolean"==o.type?r(a.booleanValue(),o.booleanValue()):"number"==a.type||"number"==o.type?r(a.numberValue(),o.numberValue()):r(a.stringValue(),o.stringValue());return new u(t)},r}(lr),pr=function(e){function r(r,t){var a=e.call(this)||this;return a.expr=r,a.predicate=t,a}return g(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 o=t;t=[];for(var n=0;n<o.length;++n){var i=o[n];this.predicate[a].evaluate(e.clone(o,void 0,n)).booleanValue()&&t.push(i)}}return new ce(t)},r}(lr);function hr(e){if(!e)throw new Error("Assertion failed")}var dr=new RegExp("(\\".concat(["/",".","*","+","?","|","^","$","(",")","[","]","{","}","\\"].join("|\\"),")"),"g");function fr(e){hr(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 ce(t)}function gr(e){return hr(3===this.args.length),this.args[0].evaluate(e).booleanValue()?this.args[1].evaluate(e):this.args[2].evaluate(e)}function mr(e){hr(2===this.args.length);for(var r=this.args[0].evaluate(e).nodeSetValue(),t=this.args[1].evaluate(e).stringValue(),a="",o=0;o<r.length;++o)a&&(a+=t),a+=oe(r[o]);return new he(a)}function br(e){return hr(1===this.args.length),new u(this.args[0].evaluate(e).booleanValue())}function vr(e){hr(1===this.args.length);var r=this.args[0].evaluate(e).numberValue();return new pe(Math.ceil(r))}function yr(e){for(var r="",t=0;t<this.args.length;++t)r+=this.args[t].evaluate(e).stringValue();return new he(r)}function xr(e){hr(2===this.args.length);var r=this.args[0].evaluate(e).stringValue(),t=this.args[1].evaluate(e).stringValue();return new u(r.includes(t))}function wr(e){hr(1===this.args.length);var r=this.args[0].evaluate(e);return new pe(r.nodeSetValue().length)}function Er(e){return hr(0===this.args.length),new ce([e.nodeList[e.position]])}function Dr(e){hr(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(dr,"\\$1"),"$"));return new u(a.test(r))}function Nr(){return hr(0===this.args.length),new u(!1)}function qr(e){hr(1===this.args.length);var r=this.args[0].evaluate(e).numberValue();return new pe(Math.floor(r))}function Ar(e){return new he("A"+function(e,r){void 0===r&&(r=0);for(var t=3735928559^r,a=1103547991^r,o=0,n=void 0;o<e.length;o++)n=e.charCodeAt(o),t=Math.imul(t^n,2654435761),a=Math.imul(a^n,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)}(JSON.stringify(e.nodeList[e.position].id)))}function kr(e){hr(1===this.args.length);var r,t=this.args[0].evaluate(e),a=[];if("node-set"==t.type){r=[];for(var o=t.nodeSetValue(),n=0;n<o.length;++n)for(var i=oe(o[n]).split(/\s+/),s=0;s<i.length;++s)r.push(i[s])}else r=t.stringValue().split(/\s+/);var u=e.root;for(n=0;n<r.length;++n){var l=u.getElementById(r[n]);l&&a.push(l)}return new ce(a)}function Sr(e){hr(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 u(!1);var o=new RegExp("^".concat(t,"$"),"i");return new u(r.match(o)||r.replace(/_.*$/,"").match(o))}function Lr(e){return hr(0===this.args.length),new pe(e.contextSize())}function Tr(e){var r;return hr(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 he(""):new he(r[0].localName)}function Cr(e){hr(this.args.length>=2);var r,t,a=this.args[0].evaluate(e).stringValue(),o=this.args[1].evaluate(e).stringValue();if(this.args.length>2&&(r=this.args[2].evaluate(e).stringValue(),/[^mi]/.test(r)))throw new Error("Invalid regular expression syntax: ".concat(r));try{t=new RegExp(o,r)}catch(e){throw new Error("Invalid matches argument: ".concat(o))}return new u(t.test(a))}function Vr(e){var r;return hr(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 he(""):new he(r[0].nodeName)}function Rr(e){var r;return hr(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 he(""):new he(r[0].namespaceUri||"")}function Pr(e){var r;return r=(r=this.args.length>0?this.args[0].evaluate(e).stringValue():new ce([e.nodeList[e.position]]).stringValue()).replace(/^\s*/,"").replace(/\s*$/,"").replace(/\s+/g," "),new he(r)}function Br(e){hr(1===this.args.length);var r=!this.args[0].evaluate(e).booleanValue();return new u(r)}function Fr(e){return hr(1===this.args.length||0===this.args.length),1===this.args.length?new pe(this.args[0].evaluate(e).numberValue()):new pe(new ce([e.nodeList[e.position]]).numberValue())}function Ur(e){return hr(0===this.args.length),new pe(e.position+1)}function Or(e){hr(1===this.args.length);var r=this.args[0].evaluate(e).numberValue();return new pe(Math.round(r))}function Ir(e){hr(2==this.args.length);var r=this.args[0].evaluate(e).stringValue(),t=this.args[1].evaluate(e).stringValue();return new u(0===r.indexOf(t))}function Gr(e){return hr(1===this.args.length||0===this.args.length),0===this.args.length?new he(new ce([e.nodeList[e.position]]).stringValue()):new he(this.args[0].evaluate(e).stringValue())}function Hr(e){var r;return r=this.args.length>0?this.args[0].evaluate(e).stringValue():new ce([e.nodeList[e.position]]).stringValue(),new pe(r.length)}function Mr(e){hr(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 o=Math.max(0,Math.round(a)-1);r=t.substr(o)}else{var n=this.args[2].evaluate(e).numberValue(),i=Math.round(a)-1,s=(o=Math.max(0,i),Math.round(n)-Math.max(0,-i));r=t.substr(o,s)}return new he(r)}function zr(e){hr(2===this.args.length);var r,t=this.args[0].evaluate(e).stringValue(),a=this.args[1].evaluate(e).stringValue(),o=t.indexOf(a);return r=-1===o?"":t.substr(o+a.length),new he(r)}function jr(e){hr(2===this.args.length);var r,t=this.args[0].evaluate(e).stringValue(),a=this.args[1].evaluate(e).stringValue(),o=t.indexOf(a);return r=-1===o?"":t.substr(0,o),new he(r)}function _r(e){hr(1===this.args.length);for(var r=this.args[0].evaluate(e).nodeSetValue(),t=0,a=0;a<r.length;++a)t+=oe(r[a])-0;return new pe(t)}function Xr(e){hr(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(),o=0;o<t.length;++o)r=r.replace(new RegExp(t.charAt(o),"g"),a.charAt(o));return new he(r)}function Jr(){return hr(0===this.args.length),new u(!0)}function Yr(e){return hr(this.args.length<2),new he(JSON.stringify(this.args.length?oe(e.nodeList[e.position]):"null"))}var Zr=function(e){function r(r){var t=e.call(this)||this;return t.xPathFunctions={boolean:br,ceiling:vr,concat:yr,contains:xr,count:wr,current:Er,"ends-with":Dr,false:Nr,floor:qr,"generate-id":Ar,id:kr,lang:Sr,last:Lr,"local-name":Tr,matches:Cr,name:Vr,"namespace-uri":Rr,"normalize-space":Pr,not:Br,number:Fr,position:Ur,round:Or,"starts-with":Ir,string:Gr,"xml-to-json":Yr,substring:Mr,"substring-before":jr,"substring-after":zr,sum:_r,"string-length":Hr,translate:Xr,true:Jr,"ext-join":mr,"ext-if":gr,"ext-cardinal":fr},t.name=r,t.args=[],t}return g(r,e),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 u(!1)},r}(lr),Wr=function(e){function r(r){var t=e.call(this)||this;return t.value=r,t}return g(r,e),r.prototype.evaluate=function(){return new he(this.value)},r}(lr),Kr=function(e){function r(r){var t=e.call(this)||this;return t.absolute=!1,t.steps=[],t.xPath=r,t}return g(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 rr&&!t)if(e.axis==de.DESCENDANT_OR_SELF){if(r.axis==de.CHILD);else if(r.axis==de.SELF)return r.axis=de.DESCENDANT_OR_SELF,r}else if(e.axis==de.DESCENDANT&&r.axis==de.SELF)return r.axis=de.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 ce(t)},r}(lr),Qr=function(e){function r(r){var t=e.call(this)||this;return t.value=r,t}return g(r,e),r.prototype.evaluate=function(){return new pe(this.value)},r}(lr),$r=function(e){function r(r,t){var a=e.call(this)||this;return a.filter=r,a.rel=t,a}return g(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,void 0,a)).nodeSetValue()).length>0);++a);return new ce(t)}for(a=0;a<r.length;++a)for(var o=this.rel.evaluate(e.clone(r,void 0,a)).nodeSetValue(),n=0;n<o.length;++n)t.push(o[n]);return new ce(t)},r}(lr),et=function(e){function r(r){var t=e.call(this)||this;return t.expr=r,t}return g(r,e),r.prototype.evaluate=function(e){var r=this.expr.evaluate(e);return"number"==r.type?new u(e.position==r.numberValue()-1):new u(r.booleanValue())},r}(lr),rt=function(e){function r(r){var t=e.call(this)||this;return t.expr=r,t}return g(r,e),r.prototype.evaluate=function(e){return new pe(-this.expr.evaluate(e).numberValue())},r}(lr),tt=function(e){function r(r,t,a,o){var n=e.call(this)||this;n.axis=r,n.nodeTest=t,n.predicate=o||[],n.hasPositionalPredicate=!1,n.xPath=a;for(var i=0;i<n.predicate.length;++i)if(n.predicateExprHasPositionalSelector(n.predicate[i].expr)){n.hasPositionalPredicate=!0;break}return n}return g(r,e),r.prototype.predicateExprHasPositionalSelector=function(e,r){if(!e)return!1;if(!r&&this.exprReturnsNumberValue(e))return!0;if(e instanceof Zr){var t=e.name.value;return"last"==t||"position"==t}return e instanceof cr&&(this.predicateExprHasPositionalSelector(e.expr1,!0)||this.predicateExprHasPositionalSelector(e.expr2,!0))},r.prototype.exprReturnsNumberValue=function(e){return e instanceof Zr?{last:!0,position:!0,count:!0,"string-length":!0,number:!0,sum:!0,floor:!0,ceiling:!0,round:!0}[e.name.value]:e instanceof rt||(e instanceof cr?{"+":!0,"-":!0,"*":!0,mod:!0,div:!0}[e.op.value]:e instanceof Qr)},r.prototype.appendPredicate=function(e){this.predicate.push(e),this.hasPositionalPredicate||(this.hasPositionalPredicate=this.predicateExprHasPositionalSelector(e.expr))},r.prototype.evaluate=function(e){var r=e.nodeList[e.position],a=[],o=!1;switch(this.nodeTest instanceof rr&&(o=!0),this.axis){case de.ANCESTOR_OR_SELF:a.push(r);for(var n=r.parentNode;n;n=n.parentNode)a.push(n);break;case de.ANCESTOR:for(n=r.parentNode;n;n=n.parentNode)a.push(n);break;case de.ATTRIBUTE:if(null!=this.nodeTest.name){if(r.attributes)if(r.attributes instanceof Array)ur(a,r.attributes);else if("style"==this.nodeTest.name){var i=r.getAttributeValue("style");i&&"string"!=typeof i?a.push(m.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)for(var t=r.length-1;t>=0;--t)r[t].nodeValue&&e.push(r[t])}(a,r.attributes):ur(a,r.attributes);break;case de.CHILD:ur(a,r.childNodes);break;case de.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&&(o=!0);break;case de.DESCENDANT:s=this.xPath.xPathExtractTagNameFromNodeTest(this.nodeTest,e.ignoreNonElementNodesForNTA);this.xPath.xPathCollectDescendants(a,r,s),s&&(o=!0);break;case de.FOLLOWING:for(n=r;n;n=n.parentNode)for(var u=n.nextSibling;u;u=u.nextSibling)a.push(u),this.xPath.xPathCollectDescendants(a,u);break;case de.FOLLOWING_SIBLING:for(n=r.nextSibling;n;n=n.nextSibling)a.push(n);break;case de.NAMESPACE:throw new Error("not implemented: axis namespace");case de.PARENT:r.parentNode&&a.push(r.parentNode);break;case de.PRECEDING:for(n=r;n;n=n.parentNode)for(u=n.previousSibling;u;u=u.previousSibling)a.push(u),this.xPath.xPathCollectDescendantsReverse(a,u);break;case de.PRECEDING_SIBLING:for(n=r.previousSibling;n;n=n.previousSibling)a.push(n);break;case de.SELF:a.push(r);break;case de.SELF_AND_SIBLINGS:for(var l=0,c=e.nodeList;l<c.length;l++){var p=c[l];a.push(p)}break;default:throw new Error("ERROR -- NO SUCH AXIS: ".concat(this.axis))}if(!o){var h=a;a=[];for(var d=0;d<h.length;++d)this.nodeTest.evaluate(e.clone(h,void 0,d)).booleanValue()&&a.push(h[d])}if(!e.returnOnFirstMatch)for(d=0;d<this.predicate.length;++d){h=a;a=[];for(var f=0;f<h.length;++f){n=h[f];this.predicate[d].evaluate(e.clone(h,void 0,f)).booleanValue()&&a.push(n)}}return new ce(a)},r}(lr),at=function(e){function r(r){var t=e.call(this)||this;return t.value=r,t}return g(r,e),r.prototype.evaluate=function(){return new he(this.value)},r}(lr),ot=function(e){function r(r,t){var a=e.call(this)||this;return a.expr1=r,a.expr2=t,a}return g(r,e),r.prototype.evaluate=function(e){for(var r=this.expr1.evaluate(e).nodeSetValue(),t=this.expr2.evaluate(e).nodeSetValue(),a=r.length,o=0,n=t;o<n.length;o++){for(var i=n[o],s=!1,u=0;u<a;++u)r[u]==i&&(s=!0,u=a);s||r.push(i)}return new ce(r)},r}(lr),nt=function(e){function r(r){var t=e.call(this)||this;return t.name=r,t}return g(r,e),r.prototype.evaluate=function(e){return e.getVariable(this.name)},r}(lr),it={label:"LocationPath",key:void 0},st={label:"RelativeLocationPath",key:void 0},ut={label:"AbsoluteLocationPath",key:void 0},lt={label:"Step",key:void 0},ct={label:"NodeTest",key:void 0},pt={label:"Predicate",key:void 0},ht={label:"Literal",key:void 0},dt={label:"Expr",key:void 0},ft={label:"PrimaryExpr",key:void 0},gt={label:"Variablereference",key:void 0},mt={label:"Number",key:void 0},bt={label:"FunctionCall",key:void 0},vt={label:"ArgumentRemainder",key:void 0},yt={label:"PathExpr",key:void 0},xt={label:"UnionExpr",key:void 0},wt={label:"FilterExpr",key:void 0},Et={label:"Digits",key:void 0},Dt=function(){function e(){this.xPathGrammarRules=[[it,[st],18,this.passExpr],[it,[ut],18,this.passExpr],[ut,[be,st],18,this.makeLocationExpr1],[ut,[me,st],18,this.makeLocationExpr2],[ut,[be],0,this.makeLocationExpr3],[ut,[me],0,this.makeLocationExpr4],[st,[lt],31,this.makeLocationExpr5],[st,[st,be,lt],31,this.makeLocationExpr6],[st,[st,me,lt],31,this.makeLocationExpr7],[lt,[Ne],33,this.makeStepExpr1],[lt,[De],33,this.makeStepExpr2],[lt,[xe,ve,ct],33,this.makeStepExpr3],[lt,[qe,ct],33,this.makeStepExpr4],[lt,[ct],33,this.makeStepExpr5],[lt,[lt,pt],33,this.makeStepExpr6],[ct,[ze],33,this.makeNodeTestExpr1],[ct,[Me,ye,ze],33,this.makeNodeTestExpr2],[ct,[Je],33,this.makeNodeTestExpr3],[ct,[Ye,Ee],33,this.makeNodeTestExpr4],[ct,[Ye,ht,Ee],33,this.makeNodeTestExpr5],[pt,[Ie,dt,Ge],33,this.makePredicateExpr],[ft,[gt],33,this.passExpr],[ft,[we,dt,Ee],33,this.makePrimaryExpr],[ft,[ht],30,this.passExpr],[ft,[mt],30,this.passExpr],[ft,[bt],31,this.passExpr],[bt,[Je,we,Ee],-1,this.makeFunctionCallExpr1],[bt,[Je,we,dt,vt,Ke,Ee],-1,this.makeFunctionCallExpr2],[vt,[Ae,dt],-1,this.makeArgumentExpr],[xt,[yt],20,this.passExpr],[xt,[xt,ge,yt],20,this.makeUnionExpr],[yt,[it],20,this.passExpr],[yt,[wt],19,this.passExpr],[yt,[wt,be,st],19,this.makePathExpr1],[yt,[wt,me,st],19,this.makePathExpr2],[wt,[ft,pt,Ke],31,this.makeFilterExpr],[dt,[ft],16,this.passExpr],[dt,[xt],16,this.passExpr],[dt,[Fe,dt],-1,this.makeUnaryMinusExpr],[dt,[dt,ke,dt],-1,this.makeBinaryExpr],[dt,[dt,Se,dt],-1,this.makeBinaryExpr],[dt,[dt,Le,dt],-1,this.makeBinaryExpr],[dt,[dt,Te,dt],-1,this.makeBinaryExpr],[dt,[dt,Pe,dt],-1,this.makeBinaryExpr],[dt,[dt,Re,dt],-1,this.makeBinaryExpr],[dt,[dt,Ve,dt],-1,this.makeBinaryExpr],[dt,[dt,Ce,dt],-1,this.makeBinaryExpr],[dt,[dt,Be,dt],-1,this.makeBinaryExpr,$e],[dt,[dt,Fe,dt],-1,this.makeBinaryExpr,$e],[dt,[dt,ze,dt],-1,this.makeBinaryExpr,$e],[dt,[dt,Ue,dt],-1,this.makeBinaryExpr,$e],[dt,[dt,Oe,dt],-1,this.makeBinaryExpr,$e],[ht,[je],-1,this.makeLiteralExpr],[ht,[_e],-1,this.makeLiteralExpr],[mt,[Xe],-1,this.makeNumberExpr],[gt,[He,Je],200,this.makeVariableReference]],this.xPathParseCache={},this.xPathRules=[]}return e.prototype.makeTokenExpr=function(e){return new at(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 Kr(this);return e.appendStep(this.makeAbbrevStep(".")),e.absolute=!0,e},e.prototype.makeLocationExpr4=function(e){var r=new Kr(this);return r.absolute=!0,r.appendStep(this.makeAbbrevStep(e.value)),r},e.prototype.makeLocationExpr5=function(e){var r=new Kr(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 tt(e.value,t,this)},e.prototype.makeStepExpr4=function(e,r){return new tt("attribute",r,this)},e.prototype.makeStepExpr5=function(e,r){return new tt(r||"child",e,this)},e.prototype.makeStepExpr6=function(e,r){return e.appendPredicate(r),e},e.prototype.makeAbbrevStep=function(e){switch(e){case"//":return new tt("descendant-or-self",new rr,this);case".":return new tt("self",new rr,this);case"..":return new tt("parent",new rr,this)}},e.prototype.makeNodeTestExpr1=function(){return new ar},e.prototype.makeNodeTestExpr2=function(e){return new nr(e.value)},e.prototype.makeNodeTestExpr3=function(e){return new or(e.value)},e.prototype.makeNodeTestExpr4=function(e){switch(e.value.replace(/\s*\($/,"")){case"node":return new rr;case"text":return new sr;case"comment":return new tr;case"processing-instruction":return new ir("")}},e.prototype.makeNodeTestExpr5=function(e,r){var t=e.replace(/\s*\($/,"");if("processing-instruction"!=t)throw t;return new ir(r.value)},e.prototype.makePredicateExpr=function(e,r){return new et(r)},e.prototype.makePrimaryExpr=function(e,r){return r},e.prototype.makeFunctionCallExpr1=function(e){return new Zr(e)},e.prototype.makeFunctionCallExpr2=function(e,r,t,a){var o=new Zr(e);o.appendArg(t);for(var n=0;n<a.length;++n)o.appendArg(a[n]);return o},e.prototype.makeArgumentExpr=function(e,r){return r},e.prototype.makeUnionExpr=function(e,r,t){return new ot(e,t)},e.prototype.makePathExpr1=function(e,r,t){return new $r(e,t)},e.prototype.makePathExpr2=function(e,r,t){return t.prependStep(this.makeAbbrevStep(r.value)),new $r(e,t)},e.prototype.makeFilterExpr=function(e,r){return r.length>0?new pr(e,r):e},e.prototype.makeUnaryMinusExpr=function(e,r){return new rt(r)},e.prototype.makeBinaryExpr=function(e,r,t){return new cr(e,r,t)},e.prototype.makeLiteralExpr=function(e){var r=e.value.substring(1,e.value.length-1);return new Wr(r)},e.prototype.makeNumberExpr=function(e){return new Qr(e.value)},e.prototype.makeVariableReference=function(e,r){return new nt(r.value)},e.prototype.makeSimpleExpr=function(e,r){if("$"==e.charAt(0))return new nt(e.substr(1));if("@"==e.charAt(0)){var t=new or(e.substr(1)),a=new tt("attribute",t,this),o=new Kr(this);return o.appendStep(a),o}if(e.match(/^[0-9]+$/))return new Qr(e);var n=new or(e),i=new tt(r||de.CHILD,n,this),s=new Kr(this);return s.appendStep(i),s},e.prototype.makeSimpleExpr2=function(e){for(var r=e.split("/"),t=new Kr(this),a=0;a<r.length;++a){var o=new or(r[a]),n=new tt(de.CHILD,o,this);t.appendStep(n)}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)ur(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 or?e.name:r&&e instanceof rr||e instanceof ar?"*":void 0},e.prototype.xPathMatchStack=function(e,r){var t,a,o=e.length,n=r.length,i=[];i.matchlength=0;var s=0;for(t=n-1,a=o-1;t>=0&&a>=0;--t,a-=s){s=0;var u=[];if(r[t]==Ke)for(t-=1,i.push(u);a-s>=0&&e[a-s].tag==r[t];)u.push(e[a-s]),s+=1,i.matchlength+=1;else if(r[t]==We)for(t-=1,i.push(u);a-s>=0&&s<2&&e[a-s].tag==r[t];)u.push(e[a-s]),s+=1,i.matchlength+=1;else if(r[t]==Qe){if(t-=1,i.push(u),e[a].tag!=r[t])return[];for(;a-s>=0&&e[a-s].tag==r[t];)u.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}h(u),u.expr=p(u,(function(e){return e.expr}))}return h(i),-1==t?i:[]},e.prototype.xPathParse=function(e,r,t){void 0===t&&(t=function(e){});var a="".concat(e);if(t("parse ".concat(e)),this.xPathParseInit(t),e.match(/^(\$|@)?\w+$/i)){var o=this.makeSimpleExpr(e,r);return this.xPathParseCache[e]=o,t(" ... simple"),o}if(e.match(/^\w+(\/\w+)*$/i)){o=this.makeSimpleExpr2(e);return this.xPathParseCache[e]=o,t(" ... simple 2"),o}for(var n=e,i=[],s=null,u=null,l=!1,c=0,p=0,h=0;!l;){c++,e=e.replace(/^\s*/,""),u=s,s=null;for(var d=null,f="",g=0;g<Ze.length;++g){var m=Ze[g].re.exec(e);if(p++,m&&m.length>0&&m[0].length>f.length){d=Ze[g],f=m[0];break}}for(!d||d!=Ue&&d!=Oe&&d!=Se&&d!=ke||u&&u.tag!=qe&&u.tag!=me&&u.tag!=be&&u.tag!=ve&&u.tag!=He||(d=Je),d?(e=e.substr(f.length),t("token: ".concat(f," -- ").concat(d.label)),s={tag:d,match:f,prec:d.prec?d.prec:0,expr:this.makeTokenExpr(f)}):(t("DONE"),l=!0);this.xPathReduce(i,s,r,t);)h++,t("stack: ".concat(this.stackToString(i)))}if(t("stack: ".concat(this.stackToString(i))),1!=i.length)throw"XPath parse error ".concat(n,":\n").concat(this.stackToString(i));var b=i[0].expr;return void 0!==r&&!b.absolute&&!a.startsWith("*")&&b.steps&&Array.isArray(b.steps)&&(b.steps[0].axis=r),this.xPathParseCache[n]=b,t("XPath parse: ".concat(c," / ").concat(p," / ").concat(h)),b},e.prototype.xPathParseInit=function(e){if(!this.xPathRules.length){var r=[it,st,ut,lt,ct,pt,ht,dt,ft,gt,mt,bt,vt,yt,xt,wt,Et];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<Ze.length;++a)Ze[a].key=t++;e("XPath parse INIT: ".concat(t," rules"));for(a=0;a<this.xPathGrammarRules.length;++a)for(var o=this.xPathGrammarRules[a],n=o[1],i=n.length-1;i>=0;--i){if(n[i]==Qe){u(this.xPathRules,n[i-1].key,o);break}if(n[i]!=Ke&&n[i]!=We){u(this.xPathRules,n[i].key,o);break}u(this.xPathRules,n[i-1].key,o),--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 u(e,r,t){e[r]||(e[r]=[]),e[r].push(t)}},e.prototype.xPathReduce=function(e,r,t,a){void 0===a&&(a=function(e){});var o,n=null;if(e.length>0){var i=e[e.length-1],s=this.xPathRules[i.tag.key];if(s)for(var u=0;u<s.length;++u){var l=s[u],c=this.xPathMatchStack(e,l[1]);if(c.length){(n={tag:l[0],rule:l,match:c}).prec=this.xPathGrammarPrecedence(n);break}}}if(n&&(!r||n.prec>r.prec||r.tag.left&&n.prec>=r.prec)){for(u=0;u<n.match.matchlength;++u)e.pop();a("reduce ".concat(n.tag.label," ").concat(n.prec," ahead ").concat(r?r.tag.label+" "+r.prec+(r.tag.left?" left":""):" none "));var h=p(n.match,(function(e){return e.expr}));a("going to apply ".concat(n.rule[3])),n.expr=n.rule[3].apply(this,h),e.push(n),o=!0}else r&&(a("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)),o=!1;return o},e.prototype.xPathSort=function(e,r){if(0!==r.length){for(var t=[],a=0;a<e.contextSize();++a){for(var o={node:h=e.nodeList[a],key:[]},n=e.clone([h],void 0,0,void 0),i=0,s=r;i<s.length;i++){var u=s[i],l=u.expr.evaluate(n),c=void 0;"text"===u.type?c=l.stringValue():"number"===u.type&&(c=l.numberValue()),o.key.push({value:c,order:u.order})}o.key.push({value:a,order:"ascending"}),t.push(o)}t.sort(this.xPathSortByKey);var p=[];for(a=0;a<t.length;++a){var h;(h=t[a].node).siblingPosition=a,p.push(h)}e.nodeList=p,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,o){var n=r[t],i=o.clone([a],void 0,0,void 0);if(o.returnOnFirstMatch&&!n.hasPositionalPredicate){var s=(p=n.evaluate(i).nodeSetValue()).length,u=n.predicate.length;e:for(var l=0;l<s;++l){for(var c=0;c<u;++c)if(!n.predicate[c].evaluate(o.clone(p,void 0,l,void 0)).booleanValue())continue e;if(t==r.length-1?e.push(p[l]):this.xPathStep(e,r,t+1,p[l],o),e.length>0)break}}else{i.returnOnFirstMatch=!1;var p=n.evaluate(i).nodeSetValue();for(l=0;l<p.length;++l)t==r.length-1?e.push(p[l]):this.xPathStep(e,r,t+1,p[l],o)}},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 o=0;o<e.length;++o){a=this.xPathGrammarPrecedence(e[o]);r=Math.max(r,a)}return r},e.prototype.xPathTokenPrecedence=function(e){return e.prec||2},e}(),Nt=function(){function e(e){void 0===e&&(e={escape:!0,selfClosingTags:!0,parameters:[]}),this.xPath=new Dt,this.options={escape:e.escape||!0,selfClosingTags:e.selfClosingTags||!0,parameters:e.parameters||[]},this.outputMethod="xml",this.outputOmitXmlDeclaration="no"}return e.prototype.xsltProcess=function(e,r){var t=new b;this.outputDocument=t;var a=new er([e],[t]);if(this.options.parameters.length>0)for(var o=0,n=this.options.parameters;o<n.length;o++){var i=n[o];a.setVariable(i.name,new he(i.value))}return this.xsltProcessContext(a,r,t),function(e,r){void 0===r&&(r={cData:!1,escape:!0,selfClosingTags:!0});var t=[];return ne(e,t,r),t.join("")}(t,{cData:!1,escape:this.options.escape,selfClosingTags:this.options.selfClosingTags})},e.prototype.xsltProcessContext=function(e,n,u){var l=this;if(this.isXsltElement(n)){var c,p,h,d=void 0,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,D=void 0,N=void 0;switch(n.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 new Error("not implemented: ".concat(n.localName));case"apply-templates":b=(g=le(n,"select"))?this.xPath.xPathEval(g,e).nodeSetValue():e.nodeList[e.position].childNodes,v=le(n,"mode"),y=[];for(var q=0,A=(p=n.ownerDocument.documentElement).childNodes.filter((function(e){return e.nodeType==r&&l.isXsltElement(e,"template")}));q<A.length;q++){var k=A[q],S=n.getAncestorByLocalName("template");void 0!==S&&(S.id!==k.id&&(v&&k.getAttributeValue("mode")!==v||y.push(k)))}for(var L=e.clone(b),T=0;T<y.length;++T)for(var C=0;C<L.contextSize();++C){var V=L.clone([L.nodeList[C]],void 0,0,void 0);V.inApplyTemplates=!0,V.outputDepth=0,this.xsltProcessContext(V,y[T],u)}break;case"attribute":d=le(n,"name"),c=this.xsltAttributeValue(d,e),f=te(this.outputDocument),this.xsltChildNodes(e,n,f),m=function(e,n){if(void 0===n&&(n=!1),!e)return"";var u="";if(e.nodeType==a||e.nodeType==o)u+=e.nodeValue;else if(e.nodeType==t)u+=e.nodeValue;else if(e.nodeType==r||e.nodeType==i||e.nodeType==s){if(!n){var l=e.innerText;if(null!=l)return l;var c=e.textContent;if(null!=c)return c}for(var p=e.transformedChildNodes.length,h=0;h<p;++h)u+=oe(e.transformedChildNodes[h])}return u}(f),Y(u,c,m);break;case"call-template":c=le(n,"name"),p=n.ownerDocument.documentElement,x=e.clone(),this.xsltWithParam(x,n);for(T=0;T<p.childNodes.length;++T){var R=p.childNodes[T];if(R.nodeType==r&&this.isXsltElement(R,"template")&&X(R,"name")==c){this.xsltChildNodes(x,R,u);break}}break;case"choose":this.xsltChoose(e,n,u);break;case"comment":f=te(this.outputDocument),this.xsltChildNodes(e,n,f),w=oe(f),E=re(this.outputDocument,w),u.appendChild(E);break;case"copy":(f=this.xsltCopy(u,e.nodeList[e.position],this.outputDocument))&&this.xsltChildNodes(e,n,f);break;case"copy-of":if(g=le(n,"select"),"node-set"==(m=this.xPath.xPathEval(g,e)).type){b=m.nodeSetValue();for(T=0;T<b.length;++T)this.xsltCopyOf(u,b[T],this.outputDocument)}else{Z(u,K(this.outputDocument,m.stringValue()))}break;case"element":d=le(n,"name"),c=this.xsltAttributeValue(d,e),(f=$(this.outputDocument,c)).transformedNodeName=c,W(e.outputNodeList[e.outputPosition],f);var P=e.clone(void 0,[f],void 0,0);this.xsltChildNodes(P,n,f);break;case"for-each":this.xsltForEach(e,n,u);break;case"if":h=le(n,"test"),this.xPath.xPathEval(h,e).booleanValue()&&this.xsltChildNodes(e,n,u);break;case"otherwise":throw"error if here: ".concat(n.localName);case"output":this.outputMethod=le(n,"method"),this.outputOmitXmlDeclaration=le(n,"omit-xml-declaration");break;case"param":this.xsltVariable(e,n,!1);break;case"sort":this.xsltSort(e,n);break;case"stylesheet":case"transform":this.xsltChildNodes(e,n,u);break;case"template":if(!e.inApplyTemplates&&e.baseTemplateMatched)break;if(!(D=le(n,"match")))break;(b=this.xsltMatch(D,e,"self-and-siblings")).length>0&&(e.inApplyTemplates||(e.baseTemplateMatched=!0),this.xsltChildNodes(e,n,u));break;case"text":N=oe(n),f=Q(this.outputDocument,N);var B=n.attributes.filter((function(e){return"disable-output-escaping"===e.nodeName}));B.length>0&&"yes"===B[0].nodeValue&&(f.escape=!1),u.appendTransformedChild(f);break;case"value-of":g=le(n,"select"),m=this.xPath.xPathEval(g,e).stringValue(),(f=Q(this.outputDocument,m)).siblingPosition=e.nodeList[e.position].siblingPosition,e.outputNodeList[e.outputPosition].appendTransformedChild(f);break;case"variable":this.xsltVariable(e,n,!0);break;default:throw new Error("error if here: ".concat(n.localName))}}else this.xsltPassThrough(e,n,u)},e.prototype.xsltCopy=function(e,i,s){if(i.nodeType==r)return(u=$(s,i.nodeName)).transformedNodeName=i.nodeName,W(e,u),u;if(i.nodeType==a)W(e,u=Q(s,i.nodeValue));else if(i.nodeType==o){W(e,u=ee(s,i.nodeValue))}else if(i.nodeType==n){var u;W(e,u=re(s,i.nodeValue))}else i.nodeType==t&&Y(e,i.nodeName,i.nodeValue);return null},e.prototype.xsltSort=function(e,t){for(var a=[],o=0,n=t.childNodes;o<n.length;o++){var i=n[o];if(i.nodeType==r&&this.isXsltElement(i,"sort")){var s=le(i,"select"),u=this.xPath.xPathParse(s),l=le(i,"data-type")||"text",c=le(i,"order")||"ascending";a.push({expr:u,type:l,order:c})}}this.xPath.xPathSort(e,a)},e.prototype.xsltVariable=function(e,r,t){var a,o=le(r,"name"),n=le(r,"select");if(r.childNodes.length>0){var i=te(r.ownerDocument);this.xsltChildNodes(e,r,i),a=new ce([i])}else if(n)a=this.xPath.xPathEval(n,e);else{var s="",u=this.options.parameters.filter((function(e){return e.name===o}));u.length>0&&(s=u[0].value),a=new he(s)}!t&&e.getVariable(o)||e.setVariable(o,a)},e.prototype.xsltChoose=function(e,t,a){for(var o=0,n=t.childNodes;o<n.length;o++){var i=n[o];if(i.nodeType===r)if(this.isXsltElement(i,"when")){var s=le(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=le(r,"select"),o=this.xPath.xPathEval(a,e).nodeSetValue(),n=e.clone(o);this.xsltSort(n,r);var i=n.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=n.nodeList;for(var s=0;s<n.contextSize();++s)this.xsltChildNodes(n.clone(n.nodeList,void 0,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(),o=0;o<r.childNodes.length;++o)this.xsltProcessContext(a,r.childNodes[o],t)},e.prototype.xsltPassThrough=function(e,t,o){if(t.nodeType==a){if(this.xsltPassText(t)){var n=e.outputNodeList[e.outputPosition].transformedChildNodes.filter((function(e){return e.nodeType===a}));if(n.length>0)(i=n[0]).transformedNodeValue=t.nodeValue;else(i=Q(this.outputDocument,t.nodeValue)).transformedParentNode=e.outputNodeList[e.outputPosition],W(e.outputNodeList[e.outputPosition],i)}}else if(t.nodeType==r){var i=void 0,s=e;"#document"===e.nodeList[e.position].nodeName?(i=e.nodeList[e.position].firstChild,s=e.clone([i])):i=e.nodeList[e.position];var u=void 0;void 0===i.outputNode||null===i.outputNode||e.outputDepth>0?((u=$(this.outputDocument,t.nodeName)).siblingPosition=i.siblingPosition,i.outputNode=u):u=i.outputNode,u.transformedNodeName=t.nodeName,u.transformedLocalName=t.localName;var l=t.attributes.filter((function(e){return e}));if(0===l.length)u.transformedAttributes=[];else for(var c=0,p=l;c<p.length;c++){var h=p[c];Y(u,h.nodeName,this.xsltAttributeValue(h.nodeValue,s))}var d=e.outputNodeList[e.outputPosition];W(d,u);var f=s.cloneByOutput(d.transformedChildNodes,d.transformedChildNodes.length-1,++s.outputDepth);this.xsltChildNodes(f,t,i)}else this.xsltChildNodes(e,t,o)},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=X(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="",o=0;o<t.length;++o){var n=t[o].split("}");if(2==n.length)a+=this.xPath.xPathEval(n[0],r).stringValue()+n[1];else a+=t[o]}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 o=this.xsltCopy(e,r,t);if(o){for(a=0;a<r.attributes.length;++a)this.xsltCopyOf(o,r.attributes[a],t);for(a=0;a<r.childNodes.length;++a)this.xsltCopyOf(o,r.childNodes[a],t)}}},e.prototype.xsltMatch=function(e,r,t){var a=this.xPath.xPathParse(e,t);return a instanceof Kr?this.xsltLocationExpressionMatch(a,r):a instanceof ot?this.xsltLocationExpressionMatch(a.expr1,r)||this.xsltLocationExpressionMatch(a.expr2,r):[]},e.prototype.xsltLocationExpressionMatch=function(e,r){if(void 0===e||void 0===e.steps||e.steps.length<=0)throw new Error("Error resolving XSLT match: Location Expression should have steps.");return e.absolute?this.absoluteXsltMatch(e,r):this.relativeXsltMatch(e,r)},e.prototype.absoluteXsltMatch=function(e,r){for(var t=r.clone([r.root],void 0,0,void 0),a=[],o=0,n=e.evaluate(t).nodeSetValue();o<n.length;o++){var i=n[o];i.id!==r.nodeList[r.position].id?void 0!==i.getAncestorById(r.nodeList[r.position].id)&&a.push(i):a.push(i)}return a},e.prototype.relativeXsltMatch=function(e,r){var t=r.clone(),a=e.evaluate(t).nodeSetValue();return 1===a.length&&"#document"===a[0].nodeName?[a[0].childNodes[0]]:a},e.prototype.xsltWithParam=function(e,t){for(var a=0,o=t.childNodes;a<o.length;a++){var n=o[a];n.nodeType===r&&this.isXsltElement(n,"with-param")&&this.xsltVariable(e,n,!0)}},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=er,e.XPath=Dt,e.Xslt=Nt,e.xmlEscapeText=se,e.xmlParse=function(e){var r,t,a=/\/$/;if(e.match(/^<\?xml/))if(5==e.search(new RegExp(w)))r=M,t=z;else{if(5!=e.search(new RegExp(V)))throw new Error("VersionInfo is missing, or unknown version number.");r=j,t=_}else r=M,t=z;var o=new b,n=o,i=[],s=n;i.push(s);for(var u,l=!1,p=!1,h=!1,f=0,g=0;g<e.length;++g){var m=e.charAt(g);if(l&&!h&&"'"===m)p=!p;else if(l&&!p&&'"'===m)h=!h;else if(!l||">"!==m||p||h){if(!l&&"<"===m){if((x=e.slice(f,g))&&s!==n&&Z(s,K(o,x)),"!--"===e.slice(g+1,g+4)){if(v=e.slice(g+4).indexOf("--\x3e"))Z(s,D=re(o,e.slice(g+4,g+v+4))),g+=v+6}else if("![CDATA["===e.slice(g+1,g+9)){if(v=e.slice(g+9).indexOf("]]>"))Z(s,D=ee(o,e.slice(g+9,g+v+9))),g+=v+11}else if("!DOCTYPE"===e.slice(g+1,g+9)){var v;if(v=e.slice(g+9).indexOf(">")){var y=e.slice(g+9,g+v+9).trimStart();D=void 0;"xsl:text"===s.nodeName?D=K(o,"<!DOCTYPE ".concat(y,">")):(u=y,D=o.createDTDSection(u)),Z(s,D),g+=v+y.length+5}}else l=!0;f=g+1}}else{var x;if("/"==(x=e.slice(f,g)).charAt(0))i.pop(),s=i[i.length-1];else if("?"===x.charAt(0));else if("!"===x.charAt(0));else{for(var E=x.match(a),D=$(o,r.exec(x)[1]),N=void 0;N=t.exec(x);){var q=c.decode(N[5]||N[7]||"");J(D,N[1],q)}D.siblingPosition=s.childNodes.length,Z(s,D),E||(s=D,i.push(D));var A=d(D);null!==D.prefix?D.prefix in A&&(D.namespaceUri=A[D.prefix]):""in A&&(D.namespaceUri=A[""]);for(var k=0;k<D.attributes.length;++k)null!==D.attributes[k].prefix&&D.attributes[k].prefix in A&&(D.attributes[k].namespaceUri=A[D.attributes[k].prefix])}f=g+1,l=!1,p=!1,h=!1}}return n},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
16
16
|
//# sourceMappingURL=xslt-processor.js.map
|