xslt-processor 4.5.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xslt-processor",
3
- "version": "4.5.0",
3
+ "version": "4.6.0",
4
4
  "description": "A JavaScript XSLT Processor",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,4 +1,5 @@
1
1
  /** @type {any} */
2
- var XsltProcessor=(()=>{var Ie=Object.defineProperty,zt=Object.defineProperties,Wt=Object.getOwnPropertyDescriptor,Ht=Object.getOwnPropertyDescriptors,Jt=Object.getOwnPropertyNames,gt=Object.getOwnPropertySymbols;var yt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable;var xt=(o,e,t)=>e in o?Ie(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,ue=(o,e)=>{for(var t in e||(e={}))yt.call(e,t)&&xt(o,t,e[t]);if(gt)for(var t of gt(e))qt.call(e,t)&&xt(o,t,e[t]);return o},Ee=(o,e)=>zt(o,Ht(e));var F=(o,e)=>()=>(o&&(e=o(o=0)),e);var nt=(o,e)=>{for(var t in e)Ie(o,t,{get:e[t],enumerable:!0})},Yt=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Jt(e))!yt.call(o,n)&&n!==t&&Ie(o,n,{get:()=>e[n],enumerable:!(r=Wt(e,n))||r.enumerable});return o};var st=o=>Yt(Ie({},"__esModule",{value:!0}),o);var P=(o,e,t)=>new Promise((r,n)=>{var s=l=>{try{a(t.next(l))}catch(u){n(u)}},i=l=>{try{a(t.throw(l))}catch(u){n(u)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,i);a((t=t.apply(o,e)).next())});function te(o,e){return o.getAttributeValue(e)}function B(o,e,t){return o.setAttribute(e,t)}function v(o,e){return o.appendChild(e)}function U(o,e){return o.createTextNode(e)}function W(o,e){return o.createElement(e)}function Te(o,e){return o.createCDATASection(e)}function re(o,e){return o.createComment(e)}function H(o){return o.createDocumentFragment()}function ke(o,e){return o.createDTDSection(e)}function it(o,e,t){return o.createProcessingInstruction(e,t)}var Fe=F(()=>{});var Et={};nt(Et,{DOM_ATTRIBUTE_NODE:()=>x,DOM_CDATA_SECTION_NODE:()=>R,DOM_COMMENT_NODE:()=>$,DOM_DOCUMENT_FRAGMENT_NODE:()=>L,DOM_DOCUMENT_NODE:()=>D,DOM_DOCUMENT_TYPE_NODE:()=>be,DOM_ELEMENT_NODE:()=>g,DOM_ENTITY_NODE:()=>Qt,DOM_ENTITY_REFERENCE_NODE:()=>Kt,DOM_NOTATION_NODE:()=>Zt,DOM_PROCESSING_INSTRUCTION_NODE:()=>ne,DOM_TEXT_NODE:()=>S});var g,x,S,R,Kt,Qt,ne,$,D,be,L,Zt,V=F(()=>{g=1,x=2,S=3,R=4,Kt=5,Qt=6,ne=7,$=8,D=9,be=10,L=11,Zt=12});var J,A,Ue=F(()=>{V();J=class J{constructor(e,t,r,n,s){this.id=Math.random()*(Number.MAX_SAFE_INTEGER-1)+1,this.childNodes=[],this.visited=!1,this.escape=!0,this.fromXslText=!1,this.siblingPosition=-1,this.init(e,t,r,n,s)}init(e,t,r,n,s){this.nodeType=e-0,this.nodeName=`${t}`,this.nodeValue=`${r}`,this.ownerDocument=n,this.namespaceUri=s||null,[this.prefix,this.localName]=this.qualifiedNameToParts(`${t}`),this.firstChild=null,this.lastChild=null,this.nextSibling=null,this.previousSibling=null,this.parentNode=null}qualifiedNameToParts(e){return e.includes(":")?e.split(":"):[null,e]}domTraverseElements(e,t,r){let n;if(t&&(n=t.call(null,e),typeof n=="boolean"&&!n))return!1;for(let s=e.firstChild;s;s=s.nextSibling)if(s.nodeType==1&&(n=this.domTraverseElements.call(this,s,t,r),typeof n=="boolean"&&!n))return!1;if(r&&(n=r.call(null,e),typeof n=="boolean"&&!n))return!1}static recycle(e){if(e){if(e.constructor.name==="XDocument"){this.recycle(e.documentElement);return}if(e.constructor==this){this._unusedXNodes.push(e);for(let t=0;t<e.childNodes.length;++t)this.recycle(e.childNodes[t]);e.childNodes.length=0,e.init.call(0,"","",null)}}}static create(e,t,r,n,s){if(this._unusedXNodes.length>0){let i=this._unusedXNodes.pop();return i.init(e,t,r,n,s),i}return new J(e,t,r,n,s)}static clone(e,t){let r=new J(e.nodeType,e.nodeName,e.nodeValue,t,e.namespaceUri);r.id=e.id;for(let n of e.childNodes)r.appendChild(J.clone(n,r));return r}appendChild(e){this.childNodes.length===0&&(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)}replaceChild(e,t){if(t!=e){for(let r=0;r<this.childNodes.length;++r)if(this.childNodes[r]==t){this.childNodes[r]=e;let n=t.parentNode;t.parentNode=null,e.parentNode=n,n=t.previousSibling,t.previousSibling=null,e.previousSibling=n,e.previousSibling&&(e.previousSibling.nextSibling=e),n=t.nextSibling,t.nextSibling=null,e.nextSibling=n,e.nextSibling&&(e.nextSibling.previousSibling=e),this.firstChild==t&&(this.firstChild=e),this.lastChild==t&&(this.lastChild=e);break}}}insertBefore(e,t){if(t==e||t.parentNode!=this)return;e.parentNode&&e.parentNode.removeChild(e);let r=[];for(let n of this.childNodes)n==t&&(r.push(e),e.parentNode=this,e.previousSibling=t.previousSibling,t.previousSibling=e,e.previousSibling&&(e.previousSibling.nextSibling=e),e.nextSibling=t,this.firstChild==t&&(this.firstChild=e)),r.push(n);this.childNodes=r}removeChild(e){let t=[];for(let r of this.childNodes)r!=e?t.push(r):(r.previousSibling&&(r.previousSibling.nextSibling=r.nextSibling),r.nextSibling&&(r.nextSibling.previousSibling=r.previousSibling),this.firstChild==r&&(this.firstChild=r.nextSibling),this.lastChild==r&&(this.lastChild=r.previousSibling));this.childNodes=t}hasAttributes(){return this.childNodes.filter(t=>t.nodeType===2).length>0}setAttribute(e,t){let r=this.childNodes.filter(s=>s.nodeType===2);for(let s=0;s<r.length;++s)if(r[s].nodeName==e){r[s].nodeValue=`${t}`;return}let n=J.create(2,e,t,this);n.parentNode=this,this.appendChild(n)}setAttributeNS(e,t,r){let n=this.childNodes.filter(i=>i.nodeType===2);for(let i=0;i<n.length;++i){let a=n[i];if(a.namespaceUri==e&&a.localName==this.qualifiedNameToParts(`${t}`)[1]){a.nodeValue=`${r}`,a.nodeName=`${t}`,a.prefix=this.qualifiedNameToParts(`${t}`)[0];return}}let s=J.create(2,t,r,this,e);s.parentNode=this,this.appendChild(s)}getAttributeValue(e){let t=this.childNodes.filter(r=>r.nodeType===2);for(let r=0;r<t.length;++r)if(t[r].nodeName===e)return t[r].nodeValue;return null}getAttributeNS(e,t){let r=this.childNodes.filter(n=>n.nodeType===2);for(let n=0;n<r.length;++n){let s=r[n];if(s.namespaceUri===e&&s.localName===t)return s.nodeValue}return null}hasAttribute(e){let t=this.childNodes.filter(r=>r.nodeType===2);for(let r=0;r<t.length;++r)if(t[r].nodeName===e)return!0;return!1}hasAttributeNS(e,t){let r=this.childNodes.filter(n=>n.nodeType===2);for(let n=0;n<r.length;++n){let s=r[n];if(s.namespaceUri===e&&s.localName===t)return!0}return!1}removeAttribute(e){let t=[];for(let r=0;r<this.childNodes.length;++r){let n=this.childNodes[r];if(n.nodeType!==2){t.push(n);continue}n.nodeName!==e&&t.push(n)}this.childNodes=t}removeAttributeNS(e,t){let r=[];for(let n=0;n<this.childNodes.length;++n){let s=this.childNodes[n];if(s.nodeType!==2){r.push(s);continue}(s.localName!==t||s.namespaceUri!==e)&&r.push(s)}this.childNodes=r}getElementsByTagName(e){let t=[],r=this;return e=="*"?this.domTraverseElements(this,n=>{r!=n&&t.push(n)},null):this.domTraverseElements(this,n=>{r!=n&&n.nodeName==e&&t.push(n)},null),t}getElementsByTagNameNS(e,t){let r=[],n=this;return e=="*"&&t=="*"?this.domTraverseElements(this,s=>{n!=s&&r.push(s)},null):e=="*"?this.domTraverseElements(this,s=>{n!=s&&s.localName==t&&r.push(s)},null):t=="*"?this.domTraverseElements(this,s=>{n!=s&&s.namespaceUri==e&&r.push(s)},null):this.domTraverseElements(this,s=>{n!=s&&s.localName==t&&s.namespaceUri==e&&r.push(s)},null),r}getElementById(e){let t=null;return this.domTraverseElements(this,r=>{if(r.getAttributeValue("id")==e)return t=r,!1},null),t}getAncestorByLocalName(e){if(!(this.parentNode===null||this.parentNode===void 0))return this.parentNode.localName===e?this.parentNode:this.parentNode.getAncestorByLocalName(e)}getAncestorById(e){if(!(this.parentNode===null||this.parentNode===void 0))return this.parentNode.id===e?this.parentNode:this.parentNode.getAncestorById(e)}toString(){return`${this.nodeType}, ${this.nodeName}, ${this.nodeValue}`}};J._unusedXNodes=[];A=J});var q,ot=F(()=>{V();Ue();q=class extends A{constructor(){super(9,"#document",null,null),this.documentElement=null}appendChild(e){super.appendChild(e),this.documentElement=this.childNodes[0]}createElement(e){return A.create(1,e,null,this)}createElementNS(e,t){return A.create(1,t,null,this,e)}createDocumentFragment(){return A.create(11,"#document-fragment",null,this)}createTextNode(e){return A.create(3,"#text",e,this)}createAttribute(e){return A.create(2,e,null,this)}createAttributeNS(e,t){return A.create(2,t,null,this,e)}createComment(e){return A.create(8,"#comment",e,this)}createCDATASection(e){return A.create(4,"#cdata-section",e,this)}createDTDSection(e){return A.create(10,"#dtd-section",e,this)}createProcessingInstruction(e,t){return A.create(7,e,t,this)}}});function ce(o){if(!o)return o;let e=o.replace(/&([a-zA-Z]+);/g,(t,r)=>{let n=r.toLowerCase();return er[n]||t});return e=e.replace(/&#(\d+);/g,(t,r)=>{try{let n=parseInt(r,10);return String.fromCharCode(n)}catch(n){return t}}),e=e.replace(/&#[xX]([0-9a-fA-F]+);/g,(t,r)=>{try{let n=parseInt(r,16);return String.fromCharCode(n)}catch(n){return t}}),e}var er,at=F(()=>{er={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",copy:"\xA9",reg:"\xAE",times:"\xD7",divide:"\xF7",euro:"\u20AC",pound:"\xA3",yen:"\xA5",cent:"\xA2",sect:"\xA7",para:"\xB6",hellip:"\u2026",middot:"\xB7",deg:"\xB0"}});function G(o,e=!1){if(!o)return"";let t="";switch(o.nodeType){case 10:return`<!DOCTYPE ${o.nodeValue}>`;case 3:case 4:case 2:return o.nodeValue;case 1:case 9:case 11:if(!e){let n=o,s=n.innerText;if(s!==void 0)return s;let i=n.textContent;if(i!==void 0)return i}let r=o.childNodes.filter(n=>n.nodeType!==2);for(let n=0;n<r.length;++n)t+=G(r[n]);return t}}function $e(o,e=!1){if(!o)return"";let t="";switch(o.nodeType){case 2:case 3:t+=o.nodeValue;break;case 4:t+=o.nodeValue;break;case 9:case 11:case 1:if(!e){let n=o,s=n.innerText;if(s!==void 0)return s;let i=n.textContent;if(i!==void 0)return i}let r=o.childNodes.length;for(let n=0;n<r;++n)t+=G(o.childNodes[n]);break}return t}function tr(o,e={cData:!0,escape:!0,selfClosingTags:!0,outputMethod:"xml"}){let t=[];return lt(o,t,e),t.join("")}function lt(o,e,t){if(o.nodeType==3)e.push(se(o.nodeValue));else if(o.nodeType==4)t.cData?e.push(o.nodeValue):e.push(`<![CDATA[${o.nodeValue}]]>`);else if(o.nodeType==8)e.push(`<!--${o.nodeValue}-->`);else if(o.nodeType==1){e.push(`<${Y(o)}`);for(let r=0;r<o.childNodes.length;++r){let n=o.childNodes[r];!n||n.nodeType!==2||n.nodeName&&n.nodeValue&&e.push(` ${Y(n)}="${bt(n.nodeValue)}"`)}if(o.childNodes.length===0)t.selfClosingTags||t.outputMethod==="html"&&["hr","link"].includes(o.nodeName)?e.push("/>"):e.push(`></${Y(o)}>`);else{e.push(">");for(let r=0;r<o.childNodes.length;++r)lt(o.childNodes[r],e,t);e.push(`</${Y(o)}>`)}}else if(o.nodeType==9||o.nodeType==11)for(let r=0;r<o.childNodes.length;++r)lt(o.childNodes[r],e,t)}function ct(o,e={cData:!0,escape:!0,selfClosingTags:!0,outputMethod:"xml"}){let t=[];return Xe(o,t,e),t.join("")}function Xe(o,e,t){if(o.visited)return;let r=o.nodeType,n=o.nodeValue;if(r===3){let s=o.fromXslText===!0;if(o.nodeValue&&(s||o.nodeValue.trim()!=="")){let i=o.escape&&t.escape?se(o.nodeValue):Tt(o.nodeValue);e.push(i)}}else if(r===4)t.outputMethod==="text"?e.push(n):t.cData?e.push(se(n)):e.push(`<![CDATA[${n}]]>`);else if(r==8)t.outputMethod!=="text"&&e.push(`<!-- ${n} -->`);else if(r===7)t.outputMethod!=="text"&&(n&&n.trim()?e.push(`<?${o.nodeName} ${n}?>`):e.push(`<?${o.nodeName}?>`));else if(r==1)t.outputMethod==="text"?sr(o,e,t):o.nodeName!==null&&o.nodeName!==void 0?rr(o,e,t):nr(o,e,t);else if(r===9||r===11){let s=o.firstChild?[]:o.childNodes;if(o.firstChild){let i=o.firstChild;for(;i;)s.push(i),i=i.nextSibling}s.sort((i,a)=>i.siblingPosition-a.siblingPosition);for(let i=0;i<s.length;++i)Xe(s[i],e,t)}o.visited=!0}function rr(o,e,t){e.push(`<${Y(o)}`);let r=[];if(o.firstChild){let s=o.firstChild;for(;s;)s.nodeType===2&&r.push(s),s=s.nextSibling}r.length===0&&(r=o.childNodes.filter(s=>s.nodeType===2));for(let s=0;s<r.length;++s){let i=r[s];i&&i.nodeName&&i.nodeValue!==null&&i.nodeValue!==void 0&&e.push(` ${Y(i)}="${bt(i.nodeValue)}"`)}let n=[];if(o.firstChild){let s=o.firstChild;for(;s;)s.nodeType!==2&&n.push(s),s=s.nextSibling}if(n.length===0&&(n=o.childNodes.filter(s=>s.nodeType!==2)),n=n.sort((s,i)=>s.siblingPosition-i.siblingPosition),n.length===0)t.outputMethod==="html"&&["hr","link","meta"].includes(o.nodeName)?e.push(">"):t.selfClosingTags?e.push("/>"):e.push(`></${Y(o)}>`);else{e.push(">");for(let s=0;s<n.length;++s)Xe(n[s],e,t);e.push(`</${Y(o)}>`)}}function nr(o,e,t){let r=[];if(o.firstChild){let n=o.firstChild;for(;n;)r.push(n),n=n.nextSibling}else r=o.childNodes;r=r.sort((n,s)=>n.siblingPosition-s.siblingPosition);for(let n=0;n<r.length;++n)Xe(r[n],e,t)}function sr(o,e,t){let r=[];if(o.firstChild){let n=o.firstChild;for(;n;)r.push(n),n=n.nextSibling}else r=o.childNodes;r=r.sort((n,s)=>n.siblingPosition-s.siblingPosition);for(let n=0;n<r.length;++n)Xe(r[n],e,t)}function Y(o){let e=o.nodeName;return o.prefix&&e.indexOf(`${o.prefix}:`)!=0?`${o.prefix}:${e}`:e}function Tt(o){return`${o}`.replace(/&lt;/g,"<").replace(/&gt;/g,">")}function se(o){return`${o}`.replace(/&/g,"&amp;").replace(/&amp;amp;/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bt(o){return se(o).replace(/"/g,"&quot;")}function p(o,e){let t=te(o,e);return t&&ce(t)}function Xt(o){if(o==null)throw new Error("Node has no valid owner document.");return o.nodeType===9?o:Xt(o.ownerDocument)}function ut(o){if(!o)return null;let e=o.nodeType;if(e===3||e===4){let t=o.nodeValue?o.nodeValue.trim():"";return t.length>0?t:null}if(e===8)return null;if(e===9||e===11){let t=o.childNodes||[],r=[];for(let n=0;n<t.length;n++){let s=t[n],i=ut(s);i!==null&&r.push(i)}return r.length===0?null:r.length===1?r[0]:r}if(e===1){let t={},r=o,n=r.attributes&&r.attributes.length>0;if(n)for(let u=0;u<r.attributes.length;u++){let c=r.attributes[u];t["@"+c.nodeName]=c.nodeValue}let s=r.childNodes||[],i="",a=!1,l={};for(let u=0;u<s.length;u++){let c=s[u],d=c.nodeType;if(d===3||d===4){let h=c.nodeValue?c.nodeValue.trim():"";h.length>0&&(i+=h)}else if(d===1){a=!0;let h=c,m=h.localName||h.nodeName,N=ut(c);N!==null&&(l[m]?(Array.isArray(l[m])||(l[m]=[l[m]]),l[m].push(N)):l[m]=N)}}if(Object.assign(t,l),!a&&i.length>0){if(!n&&Object.keys(l).length===0)return i;t["#text"]=i}return Object.keys(t).length===0?null:t}return null}function ht(o){if(!o)return"xml";let e=o.nodeType;if(e===9||e===11){let t=o.childNodes||[],r=0,n=0,s=!1;for(let i=0;i<t.length;i++){let a=t[i];a.nodeType===1?r++:a.nodeType===3&&(a.nodeValue?a.nodeValue.trim():"").length>0&&(n++,s=!0)}return r===0&&s?"text":"xml"}return(e===3||e===4)&&(o.nodeValue?o.nodeValue.trim():"").length>0?"text":"xml"}function dt(o){if(!o)return"{}";let e=o;if(o.nodeType===9||o.nodeType===11){let i=o.childNodes||[];for(let a=0;a<i.length;a++)if(i[a].nodeType===1){e=i[a];break}}let t=e,r=t.localName||t.nodeName,n={},s=ut(e);s===null?n[r]={}:(typeof s=="object"&&Array.isArray(s),n[r]=s);try{let i=JSON.parse(JSON.stringify(n));return JSON.stringify(i)}catch(i){return JSON.stringify(n)}}var Pt=F(()=>{at();V();Fe()});var Ct=F(()=>{});var Be,Ge,Ot,At,ir,or,wt,Dt,_t,je,ar,ze,lr,vt,ur,Mt,Rt,Lt,cr,We,hr,St,dr,Vt,pr,Ir,It=F(()=>{Be=`[ \r
3
- ]+`,Ge=`(${Be})?=(${Be})?`,Ot="&#[0-9]+;|&#x[0-9a-fA-F]+;",At=`${Be}version${Ge}("1\\.0"|'1\\.0')`,ir="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\xFF\u0100-\u0131\u0134-\u013E\u0141-\u0148\u014A-\u017E\u0180-\u01C3\u01CD-\u01F0\u01F4-\u01F5\u01FA-\u0217\u0250-\u02A8\u02BB-\u02C1\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03CE\u03D0-\u03D6\u03DA\u03DC\u03DE\u03E0\u03E2-\u03F3\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E-\u0481\u0490-\u04C4\u04C7-\u04C8\u04CB-\u04CC\u04D0-\u04EB\u04EE-\u04F5\u04F8-\u04F9\u0531-\u0556\u0559\u0561-\u0586\u05D0-\u05EA\u05F0-\u05F2\u0621-\u063A\u0641-\u064A\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D3\u06D5\u06E5-\u06E6\u0905-\u0939\u093D\u0958-\u0961\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8B\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AE0\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B36-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CDE\u0CE0-\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D60-\u0D61\u0E01-\u0E2E\u0E30\u0E32-\u0E33\u0E40-\u0E45\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EAE\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0F40-\u0F47\u0F49-\u0F69\u10A0-\u10C5\u10D0-\u10F6\u1100\u1102-\u1103\u1105-\u1107\u1109\u110B-\u110C\u110E-\u1112\u113C\u113E\u1140\u114C\u114E\u1150\u1154-\u1155\u1159\u115F-\u1161\u1163\u1165\u1167\u1169\u116D-\u116E\u1172-\u1173\u1175\u119E\u11A8\u11AB\u11AE-\u11AF\u11B7-\u11B8\u11BA\u11BC-\u11C2\u11EB\u11F0\u11F9\u1E00-\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u212E\u2180-\u2182\u3041-\u3094\u30A1-\u30FA\u3105-\u312C\uAC00-\uD7A3",or="\u4E00-\u9FA5\u3007\u3021-\u3029",wt="\u0300-\u0345\u0360-\u0361\u0483-\u0486\u0591-\u05A1\u05A3-\u05B9\u05BB-\u05BD\u05BF\u05C1-\u05C2\u05C4\u064B-\u0652\u0670\u06D6-\u06DC\u06DD-\u06DF\u06E0-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0901-\u0903\u093C\u093E-\u094C\u094D\u0951-\u0954\u0962-\u0963\u0981-\u0983\u09BC\u09BE\u09BF\u09C0-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u0A02\u0A3C\u0A3E\u0A3F\u0A40-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A70-\u0A71\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0B01-\u0B03\u0B3C\u0B3E-\u0B43\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B82-\u0B83\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C01-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C82-\u0C83\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0D02-\u0D03\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0F18-\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86-\u0F8B\u0F90-\u0F95\u0F97\u0F99-\u0FAD\u0FB1-\u0FB7\u0FB9\u20D0-\u20DC\u20E1\u302A-\u302F\u3099\u309A",Dt="0-9\u0660-\u0669\u06F0-\u06F9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE7-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29",_t="\xB7\u02D0\u02D1\u0387\u0640\u0E46\u0EC6\u3005\u3031-\u3035\u309D-\u309E\u30FC-\u30FE",je=ir+or,ar=`${je+Dt}\\._:${wt}${_t}-`,ze=`[${je}_:][${ar}]*`,lr=`&${ze};`,vt=`${lr}|${Ot}`,ur=`"(([^<&"]|${vt})*)"|'(([^<&']|${vt})*)'`,Mt=`(${ze})${Ge}(${ur})`,Rt=`${Be}version${Ge}("1\\.1"|'1\\.1')`,Lt=":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",cr=Lt+"\\.0-9\xB7\u0300-\u036F\u203F-\u2040-",We=`[${Lt}][${cr}]*`,hr=`&${We};`,St=`${hr}|${Ot}`,dr=`"(([^<&"]|${St})*)"|'(([^<&']|${St})*)'`,Vt=`(${We})${Ge}(${dr})`,pr=`${je+Dt}\\._${wt}${_t}-`,Ir=`[${je}_][${pr}]*`});var ie,kt=F(()=>{at();Fe();ot();It();V();ie=class{constructor(){this.regexEmpty=/\/$/;this.XML10_TAGNAME_REGEXP=new RegExp(`^(${ze})`);this.XML10_ATTRIBUTE_REGEXP=new RegExp(Mt,"g");this.XML11_TAGNAME_REGEXP=new RegExp(`^(${We})`);this.XML11_ATTRIBUTE_REGEXP=new RegExp(Vt,"g");this.lenientHtmlTags=["hr","link","meta"]}xmlParse(e){return e.toUpperCase().startsWith("<!DOCTYPE HTML")?this.htmlParse(e):this.xmlStrictParse(e)}namespaceMapAt(e){let t={xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace"},r=e;for(;r!==null;){for(let n=0;n<r.childNodes.length;n++){let s=r.childNodes[n];if(s.nodeType===2)if(s.nodeName.startsWith("xmlns:")){let i=s.nodeName.split(":")[1];i in t||(t[i]=s.nodeValue)}else s.nodeName=="xmlns"&&(""in t||(t[""]=s.nodeValue||null))}r=r.parentNode}return t}htmlParse(e){let t=new q,r=t,n=[],s=r;n.push(s);let i=!1,a=!1,l=!1,u=0;for(let c=0;c<e.length;++c){let d=e.charAt(c);if(i){if(!l&&d==="'")a=!a;else if(!a&&d==='"')l=!l;else if(!a&&!l&&d===">"){let h=e.slice(u,c);if(h.charAt(0)==="/")n.pop(),s=n[n.length-1];else if(h.charAt(0)!=="!"){let m=h.match(this.regexEmpty),N=this.XML10_TAGNAME_REGEXP.exec(h)[1],f=W(t,N),y;for(;y=this.XML10_ATTRIBUTE_REGEXP.exec(h);){let T=ce(y[5]||y[7]||"");B(f,y[1],T)}f.siblingPosition=s.childNodes.length,v(s,f),!m&&!this.lenientHtmlTags.includes(N)&&(s=f,n.push(f))}u=c+1,i=!1,a=!1,l=!1}}else if(d==="<"){let h=e.slice(u,c);if(h&&s!==r&&v(s,U(t,h)),e.slice(c+1,c+4)==="!--"){let m=e.slice(c+4).indexOf("-->");if(m){let N=re(t,e.slice(c+4,c+m+4));v(s,N),c+=m+6}}else if(e.slice(c+1,c+9)==="!DOCTYPE"){let m=e.slice(c+9).indexOf(">");if(m){let N=e.slice(c+9,c+m+9).trimStart(),f=ke(t,N);v(s,f),c+=m+N.length+5}}else i=!0;u=c+1}}return t}xmlStrictParse(e){let t,r;if(e.match(/^<\?xml/))if(e.search(new RegExp(At))===5)t=this.XML10_TAGNAME_REGEXP,r=this.XML10_ATTRIBUTE_REGEXP;else if(e.search(new RegExp(Rt))===5)t=this.XML11_TAGNAME_REGEXP,r=this.XML11_ATTRIBUTE_REGEXP;else throw new Error("XML VersionInfo has an unknown version number.");else t=this.XML10_TAGNAME_REGEXP,r=this.XML10_ATTRIBUTE_REGEXP;let n=new q,s=n,i=[],a=s;i.push(a);let l=!1,u=!1,c=!1,d=0;for(let h=0;h<e.length;++h){let m=e.charAt(h);if(l&&!c&&m==="'")u=!u;else if(l&&!u&&m==='"')c=!c;else if(l&&m===">"&&!u&&!c){let N=e.slice(d,h);if(N.charAt(0)==="/")i.pop(),a=i[i.length-1];else if(N.charAt(0)!=="?"){if(N.charAt(0)!=="!"){let f=N.match(this.regexEmpty),y=t.exec(N)[1],T=W(n,y),O;for(;O=r.exec(N);){let _=ce(O[5]||O[7]||"");B(T,O[1],_)}T.siblingPosition=a.childNodes.length,v(a,T),f||(a=T,i.push(T));let M=this.namespaceMapAt(T);T.prefix!==null?T.prefix in M&&(T.namespaceUri=M[T.prefix]):""in M&&(T.namespaceUri=M[""]);for(let _=0;_<T.childNodes.length;++_){let C=T.childNodes[_];C.nodeType===2&&C.prefix!==null&&C.prefix in M&&(C.namespaceUri=M[C.prefix])}}}d=h+1,l=!1,u=!1,c=!1}else if(!l&&m==="<"){let N=e.slice(d,h);if(N&&a!==s&&v(a,U(n,ce(N))),e.slice(h+1,h+4)==="!--"){let f=e.slice(h+4).indexOf("-->");if(f){let y=re(n,e.slice(h+4,h+f+4));v(a,y),h+=f+6}}else if(e.slice(h+1,h+9)==="![CDATA["){let f=e.slice(h+9).indexOf("]]>");if(f){let y=Te(n,e.slice(h+9,h+f+9));v(a,y),h+=f+11}}else if(e.slice(h+1,h+9)==="!DOCTYPE"){let f=e.slice(h+9).indexOf(">");if(f){let y=e.slice(h+9,h+f+9).trimStart(),T=ke(n,y);v(a,T),h+=f+y.length+5}}else l=!0;d=h+1}}return s}}});var pt,Ft=F(()=>{Ue();pt=class extends A{}});var Ut={};nt(Ut,{XBrowserNode:()=>pt,XDocument:()=>q,XNode:()=>A,XmlParser:()=>ie,detectAdaptiveOutputFormat:()=>ht,domAppendChild:()=>v,domCreateCDATASection:()=>Te,domCreateComment:()=>re,domCreateDTDSection:()=>ke,domCreateDocumentFragment:()=>H,domCreateElement:()=>W,domCreateProcessingInstruction:()=>it,domCreateTextNode:()=>U,domGetAttributeValue:()=>te,domSetAttribute:()=>B,xmlEscapeText:()=>se,xmlGetAttribute:()=>p,xmlOwnerDocument:()=>Xt,xmlText:()=>tr,xmlToJson:()=>dt,xmlTransformedText:()=>ct,xmlUnescapeText:()=>Tt,xmlValue:()=>G,xmlValueLegacyBehavior:()=>$e});var he=F(()=>{Fe();ot();Pt();Ct();kt();Ft();Ue()});var Pr={};nt(Pr,{ExprContext:()=>ae,XPath:()=>oe,XmlParser:()=>ie,Xslt:()=>tt,xmlEscapeText:()=>se});he();var E=class{constructor(e,t){this.type=e,this.lexeme=t}};var fr={ancestor:{type:"LOCATION",value:"ancestor"},"ancestor-or-self":{type:"LOCATION",value:"ancestor-or-self"},attribute:{type:"LOCATION",value:"attribute"},child:{type:"LOCATION",value:"child"},descendant:{type:"LOCATION",value:"descendant"},"descendant-or-self":{type:"LOCATION",value:"descendant-or-self"},following:{type:"LOCATION",value:"following"},"following-sibling":{type:"LOCATION",value:"following-sibling"},namespace:{type:"LOCATION",value:"namespace"},parent:{type:"LOCATION",value:"parent"},preceding:{type:"LOCATION",value:"preceding"},"preceding-sibling":{type:"LOCATION",value:"preceding-sibling"},self:{type:"LOCATION",value:"self"},node:{type:"NODE_TYPE",value:"node"},text:{type:"NODE_TYPE",value:"text"},comment:{type:"NODE_TYPE",value:"comment"},"processing-instruction":{type:"NODE_TYPE",value:"processing-instruction"},and:{type:"OPERATOR",value:"and"},or:{type:"OPERATOR",value:"or"},div:{type:"OPERATOR",value:"div"},mod:{type:"OPERATOR",value:"mod"},last:{type:"FUNCTION",value:"last"},position:{type:"FUNCTION",value:"position"},count:{type:"FUNCTION",value:"count"},id:{type:"FUNCTION",value:"id"},"local-name":{type:"FUNCTION",value:"local-name"},"namespace-uri":{type:"FUNCTION",value:"namespace-uri"},name:{type:"FUNCTION",value:"name"},string:{type:"FUNCTION",value:"string"},concat:{type:"FUNCTION",value:"concat"},"starts-with":{type:"FUNCTION",value:"starts-with"},contains:{type:"FUNCTION",value:"contains"},"substring-before":{type:"FUNCTION",value:"substring-before"},"substring-after":{type:"FUNCTION",value:"substring-after"},substring:{type:"FUNCTION",value:"substring"},"string-length":{type:"FUNCTION",value:"string-length"},"normalize-space":{type:"FUNCTION",value:"normalize-space"},translate:{type:"FUNCTION",value:"translate"},boolean:{type:"FUNCTION",value:"boolean"},not:{type:"FUNCTION",value:"not"},true:{type:"FUNCTION",value:"true"},false:{type:"FUNCTION",value:"false"},lang:{type:"FUNCTION",value:"lang"},number:{type:"FUNCTION",value:"number"},sum:{type:"FUNCTION",value:"sum"},floor:{type:"FUNCTION",value:"floor"},ceiling:{type:"FUNCTION",value:"ceiling"},round:{type:"FUNCTION",value:"round"},document:{type:"FUNCTION",value:"document"},key:{type:"FUNCTION",value:"key"},"format-number":{type:"FUNCTION",value:"format-number"},current:{type:"FUNCTION",value:"current"},"unparsed-entity-uri":{type:"FUNCTION",value:"unparsed-entity-uri"},"generate-id":{type:"FUNCTION",value:"generate-id"},"system-property":{type:"FUNCTION",value:"system-property"},"element-available":{type:"FUNCTION",value:"element-available"},"function-available":{type:"FUNCTION",value:"function-available"}},de=class{isAlpha(e){return/^[a-zA-Z_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]$/.test(e)}isAlphaNumeric(e){return/^[a-zA-Z0-9_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0300-\u036F\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]$/.test(e)}isNumber(e){return/^[0-9]$/.test(e)}isWhitespace(e){return/^[\s\t\n\r]$/.test(e)}peek(){return this.expression[this.current]}peekNext(){return this.expression[this.current+1]}next(){return this.expression[this.current++]}match(e){return this.current>=this.expression.length||this.expression[this.current]!==e?!1:(this.current++,!0)}parseIdentifier(e){let t=e;for(;this.current<this.expression.length;){let n=this.expression[this.current];if(this.isAlphaNumeric(n))t+=this.next();else if(n==="-"){let s=this.expression[this.current+1];if(s&&this.isAlphaNumeric(s))for(this.current++,t+="-";this.current<this.expression.length&&this.isAlphaNumeric(this.expression[this.current]);)t+=this.next();else break}else break}let r=fr[t.toLowerCase()];if(r)return new E(r.type,t);if(t.length>0)return new E("IDENTIFIER",t);throw new Error(`Invalid identifier: ${t}`)}parseString(e){let t="";for(;this.current<this.expression.length&&this.expression[this.current]!==e;)t+=this.next();if(this.current>=this.expression.length)throw new Error("Unterminated string literal");return this.next(),new E("STRING",t)}parseNumber(e){let t=e;for(;this.current<this.expression.length&&this.isNumber(this.expression[this.current])&&this.expression[this.current]!==".";)t+=this.next();if(this.current<this.expression.length&&this.expression[this.current]===".")for(t+=this.next();this.current<this.expression.length&&this.isNumber(this.expression[this.current]);)t+=this.next();if(t.length>0)return new E("NUMBER",t);throw new Error(`Invalid number: ${t}`)}scanToken(){let e=this.next();if(this.isWhitespace(e))return null;switch(e){case"@":return new E("AT",e);case"$":return new E("DOLLAR",e);case"|":return new E("PIPE",e);case"{":return new E("OPEN_CURLY_BRACKET",e);case"}":return new E("CLOSE_CURLY_BRACKET",e);case"[":return new E("OPEN_SQUARE_BRACKET",e);case"]":return new E("CLOSE_SQUARE_BRACKET",e);case"(":return new E("OPEN_PAREN",e);case")":return new E("CLOSE_PAREN",e);case"+":return new E("PLUS",e);case"-":return new E("MINUS",e);case"*":return new E("ASTERISK",e);case",":return new E("COMMA",e);case".":return this.match(".")?new E("DOT_DOT",".."):this.peek()&&this.isNumber(this.peek())?this.parseNumber(e):new E("DOT",e);case"/":return this.match("/")?new E("DOUBLE_SLASH","//"):new E("SLASH",e);case":":return this.match(":")?new E("COLON_COLON","::"):new E("COLON",e);case"=":return new E("EQUALS",e);case"!":if(this.match("="))return new E("NOT_EQUALS","!=");throw new Error(`Unexpected character: ${e}`);case"<":return this.match("=")?new E("LESS_THAN_OR_EQUAL","<="):new E("LESS_THAN",e);case">":return this.match("=")?new E("GREATER_THAN_OR_EQUAL",">="):new E("GREATER_THAN",e);case"'":return this.parseString("'");case'"':return this.parseString('"');default:if(this.isNumber(e))return this.parseNumber(e);if(this.isAlpha(e))return this.parseIdentifier(e);throw new Error(`Unexpected character: ${e}`)}}scan(e){for(this.expression=e,this.tokens=[],this.current=0;this.current<this.expression.length;){let t=this.scanToken();t!==null&&this.tokens.push(t)}return this.tokens}};var X=class{};var He=class extends X{constructor(e){super(),this.value=e}evaluate(e){return this.value}},Je=class extends X{constructor(e){super(),this.value=e}evaluate(e){return this.value}};var qe=class extends X{constructor(e){super(),this.name=e}evaluate(e){if(!e.variables)throw new Error(`Variable $${this.name} is not defined`);if(!(this.name in e.variables))throw new Error(`Variable $${this.name} is not defined`);return e.variables[this.name]}};var Ye=class extends X{constructor(e,t){super(),this.operator=e,this.operand=t}evaluate(e){let t=this.operand.evaluate(e);if(this.operator==="-")return-Number(t);throw new Error(`Unknown unary operator: ${this.operator}`)}};var Pe=class extends X{constructor(e,t,r){super(),this.left=e,this.right=t,this.operator=r}evaluate(e){let t=this.left.evaluate(e),r=this.right.evaluate(e);return this.compare(t,r,this.operator)}compare(e,t,r){let n=Array.isArray(e),s=Array.isArray(t);return n&&s?this.compareNodeSets(e,t,r):n?this.compareNodeSetToValue(e,t,r):s?this.compareValueToNodeSet(e,t,r):this.comparePrimitives(e,t,r)}compareNodeSets(e,t,r){for(let n of e){let s=this.getStringValue(n);for(let i of t){let a=this.getStringValue(i);if(this.comparePrimitives(s,a,r))return!0}}return!1}compareNodeSetToValue(e,t,r){for(let n of e){let s=typeof t=="number"?Number(this.getStringValue(n)):this.getStringValue(n);if(this.comparePrimitives(s,t,r))return!0}return!1}compareValueToNodeSet(e,t,r){for(let n of t){let s=typeof e=="number"?Number(this.getStringValue(n)):this.getStringValue(n);if(this.comparePrimitives(e,s,r))return!0}return!1}comparePrimitives(e,t,r){switch(r){case"=":return e==t;case"!=":return e!=t;case"<":return Number(e)<Number(t);case">":return Number(e)>Number(t);case"<=":return Number(e)<=Number(t);case">=":return Number(e)>=Number(t);default:throw new Error(`Unknown operator: ${r}`)}}getStringValue(e){if(!e)return"";if(e.nodeType===3||e.nodeType===2)return e.nodeValue||e.textContent||"";if(e.textContent!==void 0)return e.textContent;if(e.childNodes){let t="";for(let r of Array.from(e.childNodes))r.nodeType===3?t+=r.nodeValue||"":r.nodeType===1&&(t+=this.getStringValue(r));return t}return String(e)}};var pe=class extends X{constructor(e,t,r){super(),this.left=e,this.right=t,this.operator=r}evaluate(e){let t=Number(this.left.evaluate(e)),r=Number(this.right.evaluate(e));switch(this.operator){case"+":return t+r;case"-":return t-r;case"*":return t*r;case"div":return t/r;case"mod":return t%r;default:throw new Error(`Unknown arithmetic operator: ${this.operator}`)}}};var Ce=class extends X{constructor(e,t,r){super(),this.left=e,this.right=t,this.operator=r}toBoolean(e){return typeof e=="boolean"?e:typeof e=="number"?e!==0&&!isNaN(e):typeof e=="string"||Array.isArray(e)?e.length>0:!!e}evaluate(e){let t=this.toBoolean(this.left.evaluate(e));if(this.operator==="and")return t?this.toBoolean(this.right.evaluate(e)):!1;if(this.operator==="or")return t?!0:this.toBoolean(this.right.evaluate(e));throw new Error(`Unknown logical operator: ${this.operator}`)}};var j=class extends X{constructor(e,t,r=[]){super(),this.axis=e,this.nodeTest=t,this.predicates=r}evaluate(e){let t=e==null?void 0:e.node;if(!t)return[];let r=this.getNodesByAxis(t,e);return r=r.filter(n=>this.matchesNodeTest(n,e)),r=this.applyPredicates(r,e),r}getNodesByAxis(e,t){switch(this.axis){case"child":return this.getChildNodes(e);case"parent":return e.parentNode?[e.parentNode]:[];case"self":return[e];case"attribute":return e.attributes?Array.from(e.attributes):Array.from(e.childNodes||[]).filter(r=>r.nodeType===2);case"descendant":return this.getDescendants(e,!1);case"descendant-or-self":return this.getDescendants(e,!0);case"ancestor":return this.getAncestors(e,!1);case"ancestor-or-self":return this.getAncestors(e,!0);case"following-sibling":return this.getFollowingSiblings(e);case"preceding-sibling":return this.getPrecedingSiblings(e);case"following":return this.getFollowing(e);case"preceding":return this.getPreceding(e);case"namespace":return[];case"self-and-siblings":return t!=null&&t.nodeList?t.nodeList.filter(r=>r.nodeType!==2):[e];default:return[]}}getChildNodes(e){return Array.from(e.childNodes||[]).filter(r=>r.nodeType!==2)}getDescendants(e,t){let r=[];t&&r.push(e);let n=s=>{for(let i of this.getChildNodes(s))r.push(i),n(i)};return n(e),r}getAncestors(e,t){let r=[];t&&r.push(e);let n=e.parentNode;for(;n;)r.push(n),n=n.parentNode;return r}getFollowingSiblings(e){let t=[],r=e.nextSibling;for(;r;)t.push(r),r=r.nextSibling;return t}getPrecedingSiblings(e){let t=[],r=e.previousSibling;for(;r;)t.unshift(r),r=r.previousSibling;return t}getFollowing(e){let t=[],r=e.nextSibling;for(;r;)t.push(r),t.push(...this.getDescendants(r,!1)),r=r.nextSibling;let n=e.parentNode;for(;n;){for(r=n.nextSibling;r;)t.push(r),t.push(...this.getDescendants(r,!1)),r=r.nextSibling;n=n.parentNode}return t}getPreceding(e){let t=[],r=e.previousSibling;for(;r;){t.unshift(r);let s=this.getDescendants(r,!1);t.unshift(...s),r=r.previousSibling}let n=e.parentNode;for(;n;){for(r=n.previousSibling;r;){t.unshift(r);let s=this.getDescendants(r,!1);t.unshift(...s),r=r.previousSibling}n=n.parentNode}return t}matchesNodeTest(e,t){var n,s;let r=e.nodeType;switch(this.nodeTest.type){case"wildcard":if(this.nodeTest.name&&this.nodeTest.name.endsWith(":*")){let u=this.nodeTest.name.slice(0,-2),c=(n=t==null?void 0:t.namespaces)==null?void 0:n[u];if(!c)return!1;let d=e.namespaceURI||e.namespaceUri||"";return(r===1||r===2)&&d===c}return r===1||r===2;case"name":if(r!==1&&r!==2)return!1;let i=this.nodeTest.name,a=i.indexOf(":");if(a>0){let u=i.substring(0,a),c=i.substring(a+1),d=(s=t==null?void 0:t.namespaces)==null?void 0:s[u];if(!d)return!1;let h=e.localName||e.nodeName&&this.extractLocalName(e.nodeName),m=e.namespaceURI||e.namespaceUri||"";return h===c&&m===d}return(e.localName||this.extractLocalName(e.nodeName))===i;case"node-type":switch(this.nodeTest.nodeType){case"node":return!0;case"text":return r===3;case"comment":return r===8;case"processing-instruction":return r===7;default:return!1}case"processing-instruction":return r!==7?!1:this.nodeTest.name?e.target===this.nodeTest.name:!0;default:return!1}}applyPredicates(e,t){let r=e;for(let n of this.predicates){let s=[],i=r.length;for(let a=0;a<r.length;a++){let l=Ee(ue({},t),{node:r[a],position:a+1,size:i}),u=n.evaluate(l);typeof u=="number"?u===a+1&&s.push(r[a]):this.toBoolean(u)&&s.push(r[a])}r=s}return r}toBoolean(e){return typeof e=="boolean"?e:typeof e=="number"?e!==0&&!isNaN(e):typeof e=="string"||Array.isArray(e)?e.length>0:!!e}extractLocalName(e){if(!e)return"";let t=e.indexOf(":");return t>0?e.substring(t+1):e}};var Ke=class extends X{constructor(e){super(),this.expression=e}evaluate(e){return this.expression.evaluate(e)}test(e){let t=this.evaluate(e);return typeof t=="number"?t===(e==null?void 0:e.position):this.toBoolean(t)}toBoolean(e){return typeof e=="boolean"?e:typeof e=="number"?e!==0&&!isNaN(e):typeof e=="string"||Array.isArray(e)?e.length>0:!!e}};var K=class extends X{constructor(e,t=!1){super(),this.steps=e,this.absolute=t}evaluate(e){let t;if(this.absolute){let r=this.getDocumentRoot(e==null?void 0:e.node);t=r?[r]:[]}else t=e!=null&&e.node?[e.node]:[];for(let r of this.steps){let n=[];for(let s of t){let i=Ee(ue({},e),{node:s}),a=r.evaluate(i);n.push(...a)}t=this.uniqueNodes(n)}return t}getDocumentRoot(e){if(!e)return null;let t=e;for(;t.parentNode;)t=t.parentNode;return t}uniqueNodes(e){let t=new Set,r=[];for(let n of e)t.has(n)||(t.add(n),r.push(n));return r}};var ve=class extends X{constructor(e,t){super(),this.expression=e,this.predicate=t}evaluate(e){return[]}};var fe=class extends X{constructor(e,t){super(),this.left=e,this.right=t}evaluate(e){let t=this.left.evaluate(e),r=this.right.evaluate(e),n=Array.isArray(t)?t:[],s=Array.isArray(r)?r:[];return this.unionNodes(n,s)}unionNodes(e,t){let r=new Set,n=[];for(let s of e)r.has(s)||(r.add(s),n.push(s));for(let s of t)r.has(s)||(r.add(s),n.push(s));return this.sortByDocumentOrder(n)}sortByDocumentOrder(e){return e.sort((t,r)=>{if(t===r)return 0;if(typeof t.compareDocumentPosition=="function"){let n=t.compareDocumentPosition(r);if(n&4)return-1;if(n&2)return 1}return 0})}};var me={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_FRAGMENT_NODE:11};function Qe(o,e){return ue({node:o,position:1,size:1},e)}var Ne=class{constructor(){this.elementId=0}convert(e,t){if(e==null)return null;typeof e!="string"&&(e=String(e));let r=e.trim();if(r==="")return null;try{let n=JSON.parse(r);return this.createDocumentNode(n,t)}catch(n){if(t!=null&&t.fallback&&typeof t.fallback=="function")try{let s=t.fallback(r);return this.createDocumentNode(s,t)}catch(s){return null}return t!=null&&t.liberal?this.liberalParse(r,t):null}}createDocumentNode(e,t){this.elementId=0;let r=this.valueToElement(e,"root",t),n={nodeType:me.DOCUMENT_NODE,nodeName:"#document",localName:"#document",childNodes:[r],documentElement:r};return r.ownerDocument=n,n}valueToElement(e,t,r,n){let s={nodeType:me.ELEMENT_NODE,nodeName:t,localName:t,childNodes:[],attributes:[]};if(e==null)return s;if(typeof e=="object"&&!Array.isArray(e)){let i=[],a=new Set;for(let l in e)if(Object.prototype.hasOwnProperty.call(e,l)){if(a.has(l)){if((r==null?void 0:r.duplicates)==="reject")throw new Error(`Duplicate key: ${l}`);if((r==null?void 0:r.duplicates)==="use-first")continue}a.add(l);let u=this.sanitizeElementName(l),c=this.valueToElement(e[l],u,r,s);i.push(c)}s.childNodes=i}else if(Array.isArray(e)){let i=e.map((a,l)=>this.valueToElement(a,"item",r,s));s.childNodes=i}else if(typeof e=="string"){let i={nodeType:me.TEXT_NODE,nodeName:"#text",localName:"#text",textContent:e};s.childNodes=[i],s.textContent=e}else if(typeof e=="number"){let i=String(e),a={nodeType:me.TEXT_NODE,nodeName:"#text",localName:"#text",textContent:i};s.childNodes=[a],s.textContent=i}else if(typeof e=="boolean"){let i=e?"true":"false",a={nodeType:me.TEXT_NODE,nodeName:"#text",localName:"#text",textContent:i};s.childNodes=[a],s.textContent=i}return s}sanitizeElementName(e){if(/^[a-zA-Z_][\w.-]*$/.test(e))return e;let t=e.replace(/[^a-zA-Z0-9_.-]/g,"_");return/^[a-zA-Z_]/.test(t)||(t="_"+t),(!t||t==="_")&&(t="item"),t}liberalParse(e,t){try{let r=e.replace(/,(\s*[}\]])/g,"$1");r=r.replace(/'/g,'"');let n=JSON.parse(r);return this.createDocumentNode(n,t)}catch(r){return null}}};var Ze=class extends X{constructor(t,r){super();this.jsonConverter=new Ne;this.name=t,this.args=r}evaluate(t){var n,s;let r=this.args.map(i=>i.evaluate(t));switch(this.name){case"last":return(n=t.size)!=null?n:0;case"position":return(s=t.position)!=null?s:0;case"count":return Array.isArray(r[0])?r[0].length:0;case"local-name":return this.localName(r,t);case"namespace-uri":return this.namespaceUri(r,t);case"name":return this.nodeName(r,t);case"string":return this.stringValue(r,t);case"concat":return r.map(String).join("");case"starts-with":return String(r[0]).startsWith(String(r[1]));case"contains":return String(r[0]).includes(String(r[1]));case"substring-before":return this.substringBefore(r);case"substring-after":return this.substringAfter(r);case"substring":return this.substring(r);case"string-length":return this.stringLength(r,t);case"normalize-space":return this.normalizeSpace(r,t);case"translate":return this.translate(r);case"boolean":return this.toBoolean(r[0]);case"not":return!this.toBoolean(r[0]);case"true":return!0;case"false":return!1;case"lang":return this.lang(r,t);case"number":return this.toNumber(r,t);case"sum":return this.sum(r);case"floor":return Math.floor(Number(r[0]));case"ceiling":return Math.ceil(Number(r[0]));case"round":return Math.round(Number(r[0]));case"json-to-xml":return this.jsonToXml(r,t);default:if(t.functions&&typeof t.functions[this.name]=="function")return t.functions[this.name](...r);throw new Error(`Unknown function: ${this.name}`)}}toBoolean(t){return typeof t=="boolean"?t:typeof t=="number"?t!==0&&!isNaN(t):typeof t=="string"||Array.isArray(t)?t.length>0:!!t}toNumber(t,r){return t.length===0?Number(this.stringValue([],r)):Number(t[0])}stringValue(t,r){var s,i,a,l;if(t.length===0)return(i=(s=r.node)==null?void 0:s.textContent)!=null?i:"";let n=t[0];return Array.isArray(n)&&n.length>0?(l=(a=n[0])==null?void 0:a.textContent)!=null?l:String(n[0]):String(n)}stringLength(t,r){return t.length===0?this.stringValue([],r).length:String(t[0]).length}normalizeSpace(t,r){return(t.length===0?this.stringValue([],r):String(t[0])).trim().replace(/\s+/g," ")}substringBefore(t){let r=String(t[0]),n=String(t[1]),s=r.indexOf(n);return s===-1?"":r.substring(0,s)}substringAfter(t){let r=String(t[0]),n=String(t[1]),s=r.indexOf(n);return s===-1?"":r.substring(s+n.length)}substring(t){let r=String(t[0]),n=Math.round(Number(t[1]))-1;if(t.length===2)return r.substring(Math.max(0,n));let s=Math.round(Number(t[2])),i=Math.max(0,n),a=Math.min(s-(i-n),r.length-i);return r.substring(i,i+a)}translate(t){let r=String(t[0]),n=String(t[1]),s=String(t[2]),i="";for(let a of r){let l=n.indexOf(a);l===-1?i+=a:l<s.length&&(i+=s[l])}return i}localName(t,r){var s;let n=this.getNodeArg(t,r);return(s=n==null?void 0:n.localName)!=null?s:""}namespaceUri(t,r){var s;let n=this.getNodeArg(t,r);return(s=n==null?void 0:n.namespaceUri)!=null?s:""}nodeName(t,r){var s;let n=this.getNodeArg(t,r);return(s=n==null?void 0:n.nodeName)!=null?s:""}getNodeArg(t,r){return t.length>0&&Array.isArray(t[0])&&t[0].length>0?t[0][0]:r.node}sum(t){let r=t[0];return Array.isArray(r)?r.reduce((n,s)=>{var a;let i=Number((a=s==null?void 0:s.textContent)!=null?a:s);return n+(isNaN(i)?0:i)},0):0}lang(t,r){var i,a;let n=String(t[0]).toLowerCase(),s=r.node;for(;s;){let l=((i=s.getAttribute)==null?void 0:i.call(s,"xml:lang"))||((a=s.getAttribute)==null?void 0:a.call(s,"lang"));if(l){let u=l.toLowerCase();return u===n||u.startsWith(n+"-")}s=s.parentNode}return!1}jsonToXml(t,r){if(r.xsltVersion&&r.xsltVersion!=="3.0")throw new Error('json-to-xml() is only supported in XSLT 3.0. Use version="3.0" in your stylesheet.');let n=t.length>0?String(t[0]):null,s;t.length>1&&typeof t[1]=="object"&&t[1]!==null&&(s=this.mapToOptions(t[1]));let i=this.jsonConverter.convert(n,s);return i?[i]:[]}mapToOptions(t){let r={};if(t.liberal!==void 0&&(r.liberal=!!t.liberal),t.duplicates!==void 0){let n=String(t.duplicates).toLowerCase();(n==="reject"||n==="use-first"||n==="retain")&&(r.duplicates=n)}return t.validate!==void 0&&(r.validate=!!t.validate),t.escape!==void 0&&(r.escape=!!t.escape),t.fallback!==void 0&&typeof t.fallback=="function"&&(r.fallback=t.fallback),r}};var ge=class{constructor(){this.tokens=[];this.current=0}parse(e){if(this.tokens=e,this.current=0,e.length===0)throw new Error("Empty expression");let t=this.parseExpr();if(!this.isAtEnd())throw new Error(`Unexpected token: ${this.peek().lexeme}`);return t}peek(){return this.tokens[this.current]}peekNext(){return this.tokens[this.current+1]}previous(){return this.tokens[this.current-1]}isAtEnd(){return this.current>=this.tokens.length}advance(){return this.isAtEnd()||this.current++,this.previous()}check(e){return this.isAtEnd()?!1:this.peek().type===e}checkLexeme(e){return this.isAtEnd()?!1:this.peek().lexeme===e}match(...e){for(let t of e)if(this.check(t))return this.advance(),!0;return!1}consume(e,t){var r,n;if(this.check(e))return this.advance();throw new Error(`${t}. Got: ${(n=(r=this.peek())==null?void 0:r.lexeme)!=null?n:"EOF"}`)}parseExpr(){return this.parseOrExpr()}parseOrExpr(){let e=this.parseAndExpr();for(;this.check("OPERATOR")&&this.peek().lexeme==="or";){this.advance();let t=this.parseAndExpr();e=new Ce(e,t,"or")}return e}parseAndExpr(){let e=this.parseEqualityExpr();for(;this.check("OPERATOR")&&this.peek().lexeme==="and";){this.advance();let t=this.parseEqualityExpr();e=new Ce(e,t,"and")}return e}parseEqualityExpr(){let e=this.parseRelationalExpr();for(;this.match("EQUALS","NOT_EQUALS");){let t=this.previous().lexeme,r=this.parseRelationalExpr();e=new Pe(e,r,t)}return e}parseRelationalExpr(){let e=this.parseAdditiveExpr();for(;this.match("LESS_THAN","GREATER_THAN","LESS_THAN_OR_EQUAL","GREATER_THAN_OR_EQUAL");){let t=this.previous().lexeme,r=this.parseAdditiveExpr();e=new Pe(e,r,t)}return e}parseAdditiveExpr(){let e=this.parseMultiplicativeExpr();for(;this.match("PLUS","MINUS");){let t=this.previous().lexeme,r=this.parseMultiplicativeExpr();e=new pe(e,r,t)}return e}parseMultiplicativeExpr(){let e=this.parseUnaryExpr();for(;;)if(this.match("ASTERISK")){let t=this.parseUnaryExpr();e=new pe(e,t,"*")}else if(this.check("OPERATOR")&&(this.peek().lexeme==="div"||this.peek().lexeme==="mod")){let t=this.advance().lexeme,r=this.parseUnaryExpr();e=new pe(e,r,t)}else break;return e}parseUnaryExpr(){if(this.match("MINUS")){let e=this.parseUnaryExpr();return new Ye("-",e)}return this.parseUnionExpr()}parseUnionExpr(){let e=this.parsePathExpr();for(;this.match("PIPE");){let t=this.parsePathExpr();e=new fe(e,t)}return e}parsePathExpr(){if(this.check("SLASH")||this.check("DOUBLE_SLASH"))return this.parseLocationPath();if(this.isStepStart())return this.parseLocationPath();let e=this.parseFilterExpr();if(this.match("SLASH","DOUBLE_SLASH")){let t=this.previous().type==="DOUBLE_SLASH",r=this.parseRelativeLocationPath();return t&&r.unshift(new j("descendant-or-self",{type:"node-type",nodeType:"node"})),new ve(e,new K(r,!1))}return e}isStepStart(){if(this.isAtEnd())return!1;let e=this.peek();if(e.type==="DOT"||e.type==="DOT_DOT"||e.type==="AT"||e.type==="LOCATION"||e.type==="NODE_TYPE"||e.type==="ASTERISK")return!0;if(e.type==="IDENTIFIER"||e.type==="OPERATOR"||e.type==="FUNCTION"){let t=this.peekNext();return!t||t.type!=="OPEN_PAREN"}return!1}parseLocationPath(){let e=!1,t=[];return this.match("SLASH")?(e=!0,!this.isAtEnd()&&this.isStepStart()&&t.push(...this.parseRelativeLocationPath())):this.match("DOUBLE_SLASH")?(e=!0,t.push(new j("descendant-or-self",{type:"node-type",nodeType:"node"})),t.push(...this.parseRelativeLocationPath())):t.push(...this.parseRelativeLocationPath()),new K(t,e)}parseRelativeLocationPath(){let e=[];for(e.push(this.parseStep());this.match("SLASH","DOUBLE_SLASH");)this.previous().type==="DOUBLE_SLASH"&&e.push(new j("descendant-or-self",{type:"node-type",nodeType:"node"})),e.push(this.parseStep());return e}parseStep(){if(this.match("DOT"))return new j("self",{type:"node-type",nodeType:"node"});if(this.match("DOT_DOT"))return new j("parent",{type:"node-type",nodeType:"node"});let e="child";if(this.match("AT"))e="attribute";else if(this.check("LOCATION")){let n=this.peekNext();n&&n.type==="COLON_COLON"&&(e=this.advance().lexeme,this.advance())}let t=this.parseNodeTest(),r=this.parsePredicates();return new j(e,t,r)}parseNodeTest(){var e,t;if(this.match("ASTERISK"))return{type:"wildcard"};if(this.check("NODE_TYPE")){let r=this.peekNext();if(r&&r.type==="OPEN_PAREN"){let n=this.advance().lexeme;if(this.advance(),n==="processing-instruction"&&this.check("STRING")){let s=this.advance().lexeme;return this.consume("CLOSE_PAREN","Expected ')' after processing-instruction name"),{type:"processing-instruction",name:s}}return this.consume("CLOSE_PAREN","Expected ')' after node type"),{type:"node-type",nodeType:n}}}if(this.check("IDENTIFIER")||this.check("LOCATION")||this.check("FUNCTION")||this.check("NODE_TYPE")||this.check("OPERATOR")){let r=this.advance().lexeme;if(this.match("COLON")){if(this.match("ASTERISK"))return{type:"wildcard",name:`${r}:*`};if(this.check("IDENTIFIER")||this.check("LOCATION")||this.check("FUNCTION")||this.check("NODE_TYPE")||this.check("OPERATOR")){let n=this.advance().lexeme;return{type:"name",name:`${r}:${n}`}}throw new Error("Expected local name after namespace prefix")}return{type:"name",name:r}}throw new Error(`Expected node test, got: ${(t=(e=this.peek())==null?void 0:e.lexeme)!=null?t:"EOF"}`)}parsePredicates(){let e=[];for(;this.match("OPEN_SQUARE_BRACKET");){let t=this.parseExpr();this.consume("CLOSE_SQUARE_BRACKET","Expected ']' after predicate"),e.push(new Ke(t))}return e}parseFilterExpr(){let e=this.parsePrimaryExpr();for(;this.check("OPEN_SQUARE_BRACKET");){let t=this.parsePredicates();for(let r of t)e=new ve(e,r)}return e}parsePrimaryExpr(){var e,t;if(this.match("DOLLAR")){let r=this.consume("IDENTIFIER","Expected variable name after $").lexeme;return new qe(r)}if(this.match("OPEN_PAREN")){let r=this.parseExpr();return this.consume("CLOSE_PAREN","Expected ')' after expression"),r}if(this.check("STRING")){let r=this.advance().lexeme;return new He(r)}if(this.check("NUMBER")){let r=parseFloat(this.advance().lexeme);return new Je(r)}if(this.check("FUNCTION")||this.check("IDENTIFIER")){let r=this.peekNext();if(r&&r.type==="OPEN_PAREN")return this.parseFunctionCall()}throw new Error(`Unexpected token in primary expression: ${(t=(e=this.peek())==null?void 0:e.lexeme)!=null?t:"EOF"}`)}parseFunctionCall(){let e=this.advance().lexeme;this.consume("OPEN_PAREN","Expected '(' after function name");let t=[];if(!this.check("CLOSE_PAREN"))do t.push(this.parseExpr());while(this.match("COMMA"));return this.consume("CLOSE_PAREN","Expected ')' after function arguments"),new Ze(e,t)}};var k=class{constructor(e){this.value=e,this.type="string"}stringValue(){return String(this.value)}booleanValue(){return this.value.length>0}numberValue(){return this.value-0}nodeSetValue(){throw this}};var z=class{constructor(e){this.value=e,this.type="number"}stringValue(){return`${this.value}`}booleanValue(){return!!this.value}numberValue(){return this.value-0}nodeSetValue(){throw this}};var b=class{constructor(e){this.value=e,this.type="boolean"}stringValue(){return`${this.value}`}booleanValue(){return this.value}numberValue(){return this.value?1:0}nodeSetValue(){throw this}};he();var I=class{constructor(e){this.value=e,this.type="node-set"}stringValue(){return this.value.length===0?"":G(this.value[0])}booleanValue(){return this.value.length>0}numberValue(){return parseInt(this.stringValue())-0}nodeSetValue(){return this.value}};var xe=class{constructor(e,t){this.xpathExpression=e,this.nodeConverter=t,e instanceof K&&(this.absolute=e.absolute,this.steps=e.steps.map((r,n)=>({axis:r.axis,nodeTest:r.nodeTest,predicates:r.predicates,hasPositionalPredicate:!1,predicate:r.predicates||[],evaluate:s=>{let i=this.nodeConverter.exprContextToXPathContext(s),a=r.evaluate(i);return this.nodeConverter.wrapResult(a,s)}})))}evaluate(e){let t=this.nodeConverter.exprContextToXPathContext(e),r=this.xpathExpression.evaluate(t);return this.nodeConverter.wrapResult(r,e)}},Q=class extends xe{constructor(e,t){super(e,t),this.absolute=e.absolute,this.steps=e.steps.map(r=>({axis:r.axis,nodeTest:r.nodeTest,predicates:r.predicates||[],predicate:r.predicates||[],hasPositionalPredicate:this.hasPositionalPredicate(r.predicates||[])}))}hasPositionalPredicate(e){return!1}appendStep(e){this.steps.push(e)}prependStep(e){this.steps.unshift(e)}},Z=class extends xe{constructor(e,t,r,n){super(e,t),this.expr1=r,this.expr2=n}},ft=class{exprContextToXPathContext(e){let t=e.nodeList[e.position],r=this.adaptXNode(t),n=e.nodeList.map(s=>this.adaptXNode(s));return Qe(r,{position:e.position+1,size:e.nodeList.length,nodeList:n,variables:this.convertVariables(e),functions:this.createCustomFunctions(e),namespaces:e.knownNamespaces,xsltVersion:e.xsltVersion})}adaptXNode(e){if(!e)return null;let t=e;return"textContent"in t||Object.defineProperty(t,"textContent",{get(){return this._getTextContent()},enumerable:!0,configurable:!0}),"_getTextContent"in t||(t._getTextContent=function(){if(this.nodeType===3||this.nodeType===2)return this.nodeValue||"";if(!this.childNodes)return"";let r="";for(let n of this.childNodes)n.nodeType===3?r+=n.nodeValue||"":n.nodeType===1&&(r+=this._getTextContent.call(n));return r}),"attributes"in t||Object.defineProperty(t,"attributes",{get(){return this.childNodes?this.childNodes.filter(r=>r.nodeType===2):[]},enumerable:!0,configurable:!0}),"getAttribute"in t||(t.getAttribute=function(r){return this.getAttributeValue?this.getAttributeValue(r):null}),t}xPathNodeToXNode(e){return e?e instanceof A?e:this.convertXPathNodeToXNode(e):null}getTextContent(e){if(e.nodeType===3||e.nodeType===2)return e.nodeValue||"";if(!e.childNodes)return"";let t="";for(let r of e.childNodes)r.nodeType===3?t+=r.nodeValue||"":r.nodeType===1&&(t+=this.getTextContent(r));return t}convertVariables(e){let t={};for(let[r,n]of Object.entries(e.variables||{}))if(n&&typeof n=="object"&&"stringValue"in n){let s=n;s.type==="node-set"?t[r]=n.nodeSetValue().map(i=>this.adaptXNode(i)):s.type==="string"?t[r]=n.stringValue():s.type==="number"?t[r]=n.numberValue():s.type==="boolean"?t[r]=n.booleanValue():t[r]=n.stringValue()}else t[r]=n;return t}createCustomFunctions(e){let t={};return t.key=(r,n)=>{var i;let s=(i=e.keys)==null?void 0:i[r];return s&&s[n]?s[n].nodeSetValue().map(l=>this.adaptXNode(l)):[]},t.current=()=>{let r=e.nodeList[e.position];return[this.adaptXNode(r)]},t["format-number"]=(r,n,s)=>{let i=e.decimalFormatSettings;return r.toLocaleString()},t["xml-to-json"]=r=>{if(e.xsltVersion!=="3.0")throw new Error('xml-to-json() is only supported in XSLT 3.0. Use version="3.0" in your stylesheet.');let n=Array.isArray(r)?r[0]:r;return n?this.xmlToJson(n):'""'},t["json-to-xml"]=r=>{if(e.xsltVersion!=="3.0")throw new Error('json-to-xml() is only supported in XSLT 3.0. Use version="3.0" in your stylesheet.');let n=Array.isArray(r)?r[0]:r;if(!n)return[];let i=new Ne().convert(String(n));if(!i)return null;let a=e.nodeList&&e.nodeList.length>0?e.nodeList[0].ownerDocument:null,l=this.convertXPathNodeToXNode(i,a);return l?[l]:[]},t}convertXPathNodeToXNode(e,t){if(!e)return null;let{XNode:r}=(he(),st(Ut)),{DOM_DOCUMENT_NODE:n,DOM_TEXT_NODE:s,DOM_ELEMENT_NODE:i}=(V(),st(Et)),a;if(e.nodeType===n){if(e.childNodes&&e.childNodes.length>0){let l=e.childNodes[0];return a=this.convertXPathNodeToXNode(l,t),a}return null}else if(e.nodeType===s){let l=e.textContent||"";a=new r(s,"#text",l,t)}else if(a=new r(i,e.nodeName||"element","",t),e.namespaceUri&&(a.namespaceUri=e.namespaceUri),e.childNodes&&e.childNodes.length>0){for(let l=0;l<e.childNodes.length;l++){let u=e.childNodes[l],c=this.convertXPathNodeToXNode(u,t);c&&(c.parentNode=a,a.childNodes.push(c))}a.childNodes.length>0&&(a.firstChild=a.childNodes[0],a.lastChild=a.childNodes[a.childNodes.length-1])}return a}xmlToJson(e){if(!e)return'""';if(e.nodeType===3){let t=e.nodeValue||"";return JSON.stringify(t)}if(e.nodeType===1){let t=this.getTextContent(e);return JSON.stringify(t)}return e.nodeType===2?JSON.stringify(e.nodeValue||""):'""'}wrapResult(e,t){if(Array.isArray(e)){let r=e.map(n=>this.xPathNodeToXNode(n)).filter(n=>n!==null);return new I(r)}return typeof e=="string"?new k(e):typeof e=="number"?new z(e):typeof e=="boolean"?new b(e):new I([])}clearCache(){}},oe=class{constructor(){this.parseCache=new Map;this.lexer=new de,this.parser=new ge,this.nodeConverter=new ft}xPathParse(e,t){let r=`${e}:${t||""}`;if(this.parseCache.has(r))return this.parseCache.get(r);let n=this.lexer.scan(e),s=this.parser.parse(n),i=this.wrapExpression(s,t);return this.parseCache.set(r,i),i}xPathEval(e,t){return this.xPathParse(e).evaluate(t)}xPathSort(e,t){if(t.length===0)return;let r=[];for(let s=0;s<e.contextSize();++s){let i=e.nodeList[s],a={node:i,key:[]},l=e.clone([i],0);for(let u of t){let c=u.expr.evaluate(l),d;u.type==="text"?d=c.stringValue():u.type==="number"&&(d=c.numberValue()),a.key.push({value:d,order:u.order})}a.key.push({value:s,order:"ascending"}),r.push(a)}r.sort(this.xPathSortByKey);let n=[];for(let s=0;s<r.length;++s){let i=r[s].node;i.siblingPosition=s,n.push(i)}e.nodeList=n,e.setNode(0)}xPathSortByKey(e,t){for(let r=0;r<e.key.length;++r){let n=e.key[r].order==="descending"?-1:1;if(e.key[r].value>t.key[r].value)return 1*n;if(e.key[r].value<t.key[r].value)return-1*n}return 0}wrapExpression(e,t){if(e instanceof K)return t&&e.steps.length>0&&!e.absolute&&(e.steps[0].axis=t),new Q(e,this.nodeConverter);if(e instanceof fe){let r=this.wrapExpression(e.left,t),n=this.wrapExpression(e.right,t);return new Z(e,this.nodeConverter,r,n)}return new xe(e,this.nodeConverter)}clearCache(){this.parseCache.clear(),this.nodeConverter.clearCache()}};V();var $t={label:"[number]",prec:35,re:new RegExp("^\\d+(\\.\\d*)?"),key:void 0};var ae=class o{constructor(e,t="1.0",r,n,s,i,a,l,u,c,d){this.nodeList=e,this.xsltVersion=t,this.position=r||0,this.variables=s||{},this.keys=(a==null?void 0:a.keys)||{},this.knownNamespaces=i||{},this.parent=a||null,this.caseInsensitive=l||!1,this.ignoreAttributesWithoutValue=u||!1,this.returnOnFirstMatch=c||!1,this.ignoreNonElementNodesForNTA=d||!1,this.inApplyTemplates=!1,this.baseTemplateMatched=!1,this.decimalFormatSettings=n||{decimalSeparator:".",groupingSeparator:",",infinity:"Infinity",minusSign:"-",naN:"NaN",percent:"%",perMille:"\u2030",zeroDigit:"0",digit:"#",patternSeparator:";"},a?this.root=a.root:this.nodeList[this.position].nodeType==9?this.root=this.nodeList[this.position]:this.root=this.nodeList[this.position].ownerDocument}clone(e,t){return new o(e||this.nodeList,this.xsltVersion,typeof t!="undefined"?t:this.position,this.decimalFormatSettings,this.variables,this.knownNamespaces,this,this.caseInsensitive,this.ignoreAttributesWithoutValue,this.returnOnFirstMatch,this.ignoreNonElementNodesForNTA)}setVariable(e,t){if(t instanceof k||t instanceof b||t instanceof z||t instanceof I){this.variables[e]=t;return}t==="true"?this.variables[e]=new b(!0):t==="false"?this.variables[e]=new b(!1):$t.re.test(String(t))?this.variables[e]=new z(t):this.variables[e]=new k(t)}getVariable(e){return typeof this.variables[e]!="undefined"?this.variables[e]:this.parent?this.parent.getVariable(e):null}setNode(e){this.position=e}contextSize(){return this.nodeList.length}isCaseInsensitive(){return this.caseInsensitive}setCaseInsensitive(e){return this.caseInsensitive=e}isIgnoreAttributesWithoutValue(){return this.ignoreAttributesWithoutValue}setIgnoreAttributesWithoutValue(e){return this.ignoreAttributesWithoutValue=e}isReturnOnFirstMatch(){return this.returnOnFirstMatch}setReturnOnFirstMatch(e){return this.returnOnFirstMatch=e}isIgnoreNonElementNodesForNTA(){return this.ignoreNonElementNodesForNTA}setIgnoreNonElementNodesForNTA(e){return this.ignoreNonElementNodesForNTA=e}};var Se=class{expressionMatch(e,t){if(e instanceof Q)return this.locationExpressionMatch(e,t);if(e instanceof Z)return this.unionExpressionMatch(e,t);try{return e.evaluate(t).nodeSetValue()}catch(r){return[]}}locationExpressionMatch(e,t){if(!e.steps||e.steps.length<=0){if(e.absolute){let r=t.nodeList[t.position];return r.nodeName==="#document"?[r]:[]}return[t.nodeList[t.position]]}return e.absolute?e.steps[0].axis==="self"?this.absoluteXsltMatchByDocumentNode(e,t):this.absoluteXsltMatch(e,t):this.relativeXsltMatch(e,t)}unionExpressionMatch(e,t){return this.expressionMatch(e.expr1,t).concat(this.expressionMatch(e.expr2,t))}absoluteXsltMatchByDocumentNode(e,t){let r=t.clone([t.root],0),n=e.evaluate(r).nodeSetValue(),s=[];for(let i of n)i.id===t.nodeList[t.position].id&&s.push(i);return s}absoluteXsltMatch(e,t){var l;let r=t.root.childNodes.find(u=>u.nodeName!=="#dtd-section");if(!r)return[];let n=t.clone([r],0),s=e.evaluate(n).nodeSetValue(),i=[],a;t.nodeList.length===1&&t.nodeList[0].nodeName==="#document"?a=[t.nodeList[0].childNodes.find(u=>u.nodeName!=="#dtd-section")]:a=t.nodeList;for(let u of s)u.id===((l=a[t.position])==null?void 0:l.id)&&i.push(u);return i}relativeXsltMatch(e,t){let r=t.clone(),n=e.evaluate(r).nodeSetValue();return n.length===1&&n[0].nodeName==="#document"?[n[0].childNodes[0]]:n}};var Oe=class{constructor(){this.value=new b(!0)}evaluate(){return this.value}};V();var Ae=class{evaluate(e){return new b(e.nodeList[e.position].nodeType==8)}};V();var we=class{evaluate(e){let t=e.nodeList[e.position];return new b(t.nodeType==1||t.nodeType==2)}};var De=class{constructor(e){if(this.name=e,e.indexOf(":")>0){let t=e.split(":");this.namespacePrefix=t[0],this.name=t[1]}this.re=new RegExp(`^${e}$`,"i")}evaluate(e){let t=e.nodeList[e.position];return this.namespacePrefix!==void 0?e.knownNamespaces[this.namespacePrefix]!==t.namespaceUri?new b(!1):e.caseInsensitive?t.localName.length!==this.name.length?new b(!1):new b(this.re.test(t.localName)):new b(t.localName===this.name):e.caseInsensitive?t.nodeName.length!==this.name.length?new b(!1):new b(this.re.test(t.nodeName)):new b(t.nodeName===this.name)}};var _e=class{constructor(e){this.regex=new RegExp(`^${e}:`),this.nsprefix=e}evaluate(e){let t=e.nodeList[e.position];return new b(t.nodeName.match(this.regex))}};V();var Me=class{constructor(e){this.target=e}evaluate(e){let t=e.nodeList[e.position];return new b(t.nodeType==7&&(!this.target||t.nodeName==this.target))}};V();var Re=class{evaluate(e){return new b(e.nodeList[e.position].nodeType==3)}};he();V();V();function mr(o){let e=o.nodeTest;if(o.predicate&&o.predicate.length>0||o.predicates&&o.predicates.length>0)return .5;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case"wildcard":return e.name&&e.name.endsWith(":*")?-.25:-.5;case"node-type":return e.nodeType==="processing-instruction"&&e.name?0:-.5;case"processing-instruction":return e.name?0:-.5;case"name":return 0;default:return 0}return e instanceof Oe||e instanceof we||e instanceof Re||e instanceof Ae?-.5:e instanceof Me?e.target?0:-.5:e instanceof _e?-.25:(e instanceof De,0)}function Nr(o){return!o.steps||o.steps.length===0?o.absolute?-.5:0:o.steps.length>1?.5:mr(o.steps[0])}function gr(o,e){let t=mt(o.expr1,e),r=mt(o.expr2,e);return Math.min(t,r)}function mt(o,e){return o instanceof Q?Nr(o):o instanceof Z?gr(o,e):.5}function xr(o,e){try{let t=e.xPathParse(o,"self-and-siblings");return mt(t,e)}catch(t){return console.warn(`Failed to parse pattern "${o}" for priority calculation:`,t),0}}function yr(o,e){let t=o.getAttributeValue("mode");return e?e==="#all"||t==="#all"?!0:t===e:!t||t==="#default"}function Er(o){return o.nodeType!==1?!1:(o.namespaceUri==="http://www.w3.org/1999/XSL/Transform"||o.prefix==="xsl")&&o.localName==="template"}function et(o,e,t,r){var i;let n=[],s=0;for(let a of o.childNodes){if(!Er(a)||!yr(a,e))continue;let l=a.getAttributeValue("match");if(!l)continue;let u=a.getAttributeValue("priority"),c=u?parseFloat(u):null,d=xr(l,t),h=c!==null&&!isNaN(c)?c:d,m=r==null?void 0:r.get(a),N=0;if(m){let f=Number.MAX_SAFE_INTEGER/2,y=-m.importDepth*f,T=(i=m.order)!=null?i:0;N=y+T}n.push({template:a,explicitPriority:c!==null&&!isNaN(c)?c:null,defaultPriority:d,effectivePriority:h,importPrecedence:N,documentOrder:s++,matchPattern:l})}return n}function Tr(o){let e=[],t="",r=0,n=!1,s=!1;for(let i=0;i<o.length;i++){let a=o[i];a==="'"&&!s?(n=!n,t+=a):a==='"'&&!n?(s=!s,t+=a):!n&&!s?a==="["||a==="("?(r++,t+=a):a==="]"||a===")"?(r--,t+=a):a==="|"&&r===0?(e.push(t.trim()),t=""):t+=a:t+=a}return t.trim()&&e.push(t.trim()),e}function br(o,e,t,r,n){if(e==="/")return o.nodeName==="#document";if(e.startsWith("@")){if(o.nodeType!==2)return!1;let s=e.substring(1);if(s==="*")return!0;let i=o.localName||o.nodeName,a=s.includes(":")?s.substring(s.indexOf(":")+1):s;return i===a||o.nodeName===s}if(e==="*"&&o.nodeType===1||!e.includes("/")&&!e.includes("[")&&!e.startsWith("@")&&(e===o.nodeName||e===o.localName))return!0;if(e.includes("/")||e.includes("["))try{let s=e.startsWith("/")?e:"//"+e,i=t.clone([t.root],0);if(n.xPathEval(s,i).nodeSetValue().some(u=>u.id===o.id))return!0}catch(s){}if(!e.includes("/")&&!e.includes("[")&&!e.startsWith("@"))try{let s=t.clone([o],0),i=n.xPathParse(e,"self-and-siblings");if(r.expressionMatch(i,s).some(l=>l.id===o.id))return!0}catch(s){}return!1}function Xr(o,e,t,r,n){let s=Tr(e);for(let i of s)if(br(o,i,t,r,n))return!0;return!1}function Le(o,e,t,r){let n=[],s=e.nodeList[e.position];for(let l of o)try{Xr(s,l.matchPattern,e,t,r)&&n.push(l)}catch(u){console.warn(`Failed to match pattern "${l.matchPattern}":`,u)}if(n.length===0)return{selectedTemplate:null,hasConflict:!1,conflictingTemplates:[]};n.sort((l,u)=>l.importPrecedence!==u.importPrecedence?u.importPrecedence-l.importPrecedence:l.effectivePriority!==u.effectivePriority?u.effectivePriority-l.effectivePriority:u.documentOrder-l.documentOrder);let i=n[0],a=n.filter(l=>l.importPrecedence===i.importPrecedence&&l.effectivePriority===i.effectivePriority);return{selectedTemplate:i.template,hasConflict:a.length>1,conflictingTemplates:a.length>1?a:[]}}function Bt(o,e){if(!o.hasConflict||o.conflictingTemplates.length<2)return;let t=o.conflictingTemplates.map(r=>`"${r.matchPattern}" (priority: ${r.effectivePriority})`).join(", ");console.warn(`XSLT Warning: Ambiguous template match for node <${e.nodeName}>. Multiple templates match with equal priority: ${t}. Using the last one in document order.`)}var tt=class{constructor(e={cData:!0,escape:!0,selfClosingTags:!0,parameters:[]}){this.styleSheetStack=[];this.importedStylesheets=new Map;this.templateSourceMap=new Map;this.currentTemplateStack=[];this.xPath=new oe,this.xmlParser=new ie,this.matchResolver=new Se,this.options={cData:e.cData===!0,escape:e.escape===!0,selfClosingTags:e.selfClosingTags===!0,outputMethod:e.outputMethod,parameters:e.parameters||[]},this.outputMethod=e.outputMethod||"xml",this.outputOmitXmlDeclaration="no",this.stripSpacePatterns=[],this.preserveSpacePatterns=[],this.namespaceAliases=new Map,this.supportedExtensions=new Set(["http://www.w3.org/1999/XSL/Transform"]),this.attributeSets=new Map,this.decimalFormatSettings={decimalSeparator:".",groupingSeparator:",",infinity:"Infinity",minusSign:"-",naN:"NaN",percent:"%",perMille:"\u2030",zeroDigit:"0",digit:"#",patternSeparator:";"},this.firstTemplateRan=!1}xsltProcess(e,t){return P(this,null,function*(){let r=new q;this.outputDocument=r;let n=new ae([e]);if(this.options.parameters.length>0)for(let a of this.options.parameters)n.setVariable(a.name,new k(a.value));if(yield this.xsltProcessContext(n,t,this.outputDocument),this.outputMethod==="json")return dt(r);let s=this.outputMethod;return this.outputMethod==="adaptive"&&(s=ht(r)),ct(r,{cData:this.options.cData,escape:this.options.escape,selfClosingTags:this.options.selfClosingTags,outputMethod:s})})}xsltProcessContext(e,t,r){return P(this,null,function*(){if(!this.isXsltElement(t))t.nodeType===1&&!this.isExtensionElementSupported(t)?yield this.xsltExtensionElement(e,t,r):yield this.xsltPassThrough(e,t,r);else{let n,s,i,a;switch(t.localName){case"apply-imports":yield this.xsltApplyImports(e,t,r);break;case"apply-templates":yield this.xsltApplyTemplates(e,t,r);break;case"attribute":yield this.xsltAttribute(e,t,r);break;case"attribute-set":break;case"call-template":yield this.xsltCallTemplate(e,t,r);break;case"choose":yield this.xsltChoose(e,t,r);break;case"comment":yield this.xsltComment(e,t,r);break;case"copy":n=this.xsltCopy(r||this.outputDocument,e.nodeList[e.position]),n&&(yield this.xsltChildNodes(e,t,n));break;case"copy-of":s=p(t,"select"),i=this.xPath.xPathEval(s,e);let l=r||this.outputDocument;if(i.type==="node-set"){a=i.nodeSetValue();for(let d=0;d<a.length;++d)this.xsltCopyOf(l,a[d])}else{let d=U(this.outputDocument,i.stringValue());d.siblingPosition=l.childNodes.length,v(l,d)}break;case"decimal-format":this.xsltDecimalFormat(e,t);break;case"element":yield this.xsltElement(e,t,r);break;case"fallback":let u=t.parentNode;if(!(u&&u.nodeType===1&&!this.isExtensionElementSupported(u)))throw new Error("<xsl:fallback> must be a direct child of an extension element");yield this.xsltChildNodes(e,t,r);break;case"for-each":yield this.xsltForEach(e,t,r);break;case"if":yield this.xsltIf(e,t,r);break;case"import":yield this.xsltImport(e,t,r);break;case"include":yield this.xsltInclude(e,t,r);break;case"key":this.xsltKey(e,t);break;case"message":yield this.xsltMessage(e,t);break;case"namespace-alias":this.xsltNamespaceAlias(t);break;case"number":this.xsltNumber(e,t,r);break;case"otherwise":throw new Error("<xsl:otherwise> must be a child of <xsl:choose>.");case"output":this.outputMethod=p(t,"method"),this.outputOmitXmlDeclaration=p(t,"omit-xml-declaration");break;case"param":yield this.xsltVariable(e,t,!1);break;case"preserve-space":this.xsltPreserveSpace(t);break;case"processing-instruction":yield this.xsltProcessingInstruction(e,t,r);break;case"sort":this.xsltSort(e,t);break;case"strip-space":this.xsltStripSpace(t);break;case"stylesheet":case"transform":yield this.xsltTransformOrStylesheet(e,t,r);break;case"template":yield this.xsltTemplate(e,t,r);break;case"text":this.xsltText(e,t,r);break;case"value-of":this.xsltValueOf(e,t,r);break;case"variable":yield this.xsltVariable(e,t,!0);break;case"when":throw new Error("<xsl:when> must be a child of <xsl:choose>.");case"with-param":throw new Error("<xsl:with-param> must be a child of <xsl:call-template> or <xsl:apply-templates>.");default:throw new Error(`error if here: ${t.localName}`)}}})}xsltApplyTemplates(e,t,r){return P(this,null,function*(){var d;let n=p(t,"select"),s=[];n?s=this.xPath.xPathEval(n,e).nodeSetValue():s=e.nodeList[e.position].childNodes;let i=p(t,"mode"),a=t.ownerDocument.documentElement,l=et(a,i,this.xPath,this.templateSourceMap),u=e.clone();yield this.xsltWithParam(u,t);let c=u.clone(s);for(let h=0;h<c.contextSize();++h){let m=c.nodeList[h];if(m.nodeType===3){if(!this.xsltPassText(m))continue;let N=e.clone([m],0);this.commonLogicTextNode(N,m,r)}else{let N=c.clone([m],0);N.inApplyTemplates=!0;let f=Le(l,N,this.matchResolver,this.xPath);if(f.hasConflict&&Bt(f,m),f.selectedTemplate){let y=this.templateSourceMap.get(f.selectedTemplate),T=p(f.selectedTemplate,"match"),O=p(f.selectedTemplate,"mode");this.currentTemplateStack.push({template:f.selectedTemplate,stylesheetDepth:(d=y==null?void 0:y.importDepth)!=null?d:0,mode:O||i,match:T});try{yield this.xsltChildNodes(N,f.selectedTemplate,r)}finally{this.currentTemplateStack.pop()}}}}})}xsltApplyImports(e,t,r){return P(this,null,function*(){if(this.currentTemplateStack.length===0)throw new Error("<xsl:apply-imports> can only be used within a template");let n=this.currentTemplateStack[this.currentTemplateStack.length-1],{stylesheetDepth:s,mode:i}=n,a=e.nodeList[e.position],l=t.ownerDocument.documentElement,c=et(l,i,this.xPath,this.templateSourceMap).filter(f=>{let y=this.templateSourceMap.get(f.template);return y&&y.importDepth>s});if(c.length===0)return;let d=e.clone([a],0),h=Le(c,d,this.matchResolver,this.xPath);if(!h.selectedTemplate)return;let m=e.clone();yield this.xsltWithParam(m,t);let N=this.templateSourceMap.get(h.selectedTemplate);if(N){let f=p(h.selectedTemplate,"match");this.currentTemplateStack.push({template:h.selectedTemplate,stylesheetDepth:N.importDepth,mode:i,match:f}),yield this.xsltChildNodes(m,h.selectedTemplate,r),this.currentTemplateStack.pop()}})}xsltAttribute(e,t,r){return P(this,null,function*(){let n=p(t,"name"),s=this.xsltAttributeValue(n,e),i=H(this.outputDocument);yield this.xsltChildNodes(e,t,i);let a=$e(i);r&&B(r,s,a)})}xsltCallTemplate(e,t,r){return P(this,null,function*(){let n=p(t,"name"),s=t.ownerDocument.documentElement,i=e.clone();yield this.xsltWithParam(i,t);for(let a=0;a<s.childNodes.length;++a){let l=s.childNodes[a];if(l.nodeType===1&&this.isXsltElement(l,"template")&&te(l,"name")===n){yield this.xsltChildNodes(i,l,r);break}}})}xsltChoose(e,t,r){return P(this,null,function*(){for(let n of t.childNodes)if(n.nodeType===1){if(this.isXsltElement(n,"when")){let s=p(n,"test");if(this.xPath.xPathEval(s,e).booleanValue()){yield this.xsltChildNodes(e,n,r);break}}else if(this.isXsltElement(n,"otherwise")){yield this.xsltChildNodes(e,n,r);break}}})}xsltCopy(e,t){if(t.nodeType==1){let r=W(this.outputDocument,t.nodeName);return t.namespaceUri!==null&&t.namespaceUri!==void 0&&B(r,"xmlns",t.namespaceUri),r.siblingPosition=e.childNodes.length,v(e,r),r}if(t.nodeType==3){if(this.shouldStripWhitespaceNode(t))return null;let r=U(this.outputDocument,t.nodeValue);r.siblingPosition=e.childNodes.length,v(e,r)}else if(t.nodeType==4){let r=Te(this.outputDocument,t.nodeValue);r.siblingPosition=e.childNodes.length,v(e,r)}else if(t.nodeType==8){let r=re(this.outputDocument,t.nodeValue);r.siblingPosition=e.childNodes.length,v(e,r)}else t.nodeType==2&&B(e,t.nodeName,t.nodeValue);return null}xsltComment(e,t,r){return P(this,null,function*(){let n=H(this.outputDocument);yield this.xsltChildNodes(e,t,n);let s=G(n),i=re(this.outputDocument,s);(r||this.outputDocument).appendChild(i)})}xsltProcessingInstruction(e,t,r){return P(this,null,function*(){let n=p(t,"name");if(!n)throw new Error('<xsl:processing-instruction> requires a "name" attribute');let s=this.xsltAttributeValue(n,e);if(!s)throw new Error("<xsl:processing-instruction> target name cannot be empty");if(s.toLowerCase()==="xml")throw new Error('Processing instruction target cannot be "xml"');if(!/^[a-zA-Z_][a-zA-Z0-9_:.-]*$/.test(s))throw new Error(`Invalid processing instruction target: "${s}"`);let i=H(this.outputDocument);yield this.xsltChildNodes(e,t,i);let a=G(i),l=it(this.outputDocument,s,a),u=r||this.outputDocument;v(u,l)})}xsltCopyOf(e,t){if(t.nodeType==11||t.nodeType==9)for(let r=0;r<t.childNodes.length;++r)this.xsltCopyOf(e,t.childNodes[r]);else{let r=this.xsltCopy(e,t);if(r)for(let n=0;n<t.childNodes.length;++n)this.xsltCopyOf(r,t.childNodes[n])}}xsltDecimalFormat(e,t){let r=p(t,"name"),n=p(t,"decimal-separator"),s=p(t,"grouping-separator"),i=p(t,"infinity"),a=p(t,"minus-sign"),l=p(t,"NaN"),u=p(t,"percent"),c=p(t,"per-mille"),d=p(t,"zero-digit"),h=p(t,"digit"),m=p(t,"pattern-separator");this.decimalFormatSettings={name:r||this.decimalFormatSettings.name,decimalSeparator:n||this.decimalFormatSettings.decimalSeparator,groupingSeparator:s||this.decimalFormatSettings.groupingSeparator,infinity:i||this.decimalFormatSettings.infinity,minusSign:a||this.decimalFormatSettings.minusSign,naN:l||this.decimalFormatSettings.naN,percent:u||this.decimalFormatSettings.percent,perMille:c||this.decimalFormatSettings.perMille,zeroDigit:d||this.decimalFormatSettings.zeroDigit,digit:h||this.decimalFormatSettings.digit,patternSeparator:m||this.decimalFormatSettings.patternSeparator},e.decimalFormatSettings=this.decimalFormatSettings}xsltElement(e,t,r){return P(this,null,function*(){let n=p(t,"name"),s=this.xsltAttributeValue(n,e),i=W(this.outputDocument,s),a=p(t,"use-attribute-sets");a&&(yield this.applyAttributeSets(e,i,a)),v(r||this.outputDocument,i);let l=e.clone(void 0,0);yield this.xsltChildNodes(l,t,i)})}xsltForEach(e,t,r){return P(this,null,function*(){let n=p(t,"select"),s=this.xPath.xPathEval(n,e).nodeSetValue();if(s.length===0)return;let i=e.clone(s);if(this.xsltSort(i,t),i.nodeList.filter(l=>l.parentNode!==null&&l.parentNode!==void 0).length<=0)throw new Error("Nodes with no parents defined.");for(let l=0;l<i.contextSize();++l)yield this.xsltChildNodes(i.clone(i.nodeList,l),t,r)})}xsltIf(e,t,r){return P(this,null,function*(){let n=p(t,"test");this.xPath.xPathEval(n,e).booleanValue()&&(yield this.xsltChildNodes(e,t,r))})}xsltImportOrInclude(e,t,r,n){return P(this,null,function*(){let s=n?"xsl:import":"xsl:include",[i,a]=process.versions.node.split(".").map(Number);if(i<=17&&a<5)throw new Error(`Your Node.js version does not support \`<${s}>\`. If possible, please update your Node.js version to at least version 17.5.0.`);global.globalThis.fetch||(global.globalThis.fetch=fetch,global.globalThis.Headers=Headers,global.globalThis.Request=Request,global.globalThis.Response=Response);let l=t.childNodes.filter(T=>T.nodeName==="href");if(l.length<=0)throw new Error(`<${s}> with no href attribute defined.`);let c=l[0].nodeValue;if(this.importedStylesheets.has(c))return;let h=yield(yield global.globalThis.fetch(c)).text(),m=this.xmlParser.xmlParse(h),N=this.styleSheetStack.length>0?this.styleSheetStack[this.styleSheetStack.length-1].importDepth:0,f={importDepth:n?N+1:N,href:c,order:this.importedStylesheets.size};this.styleSheetStack.push(f),this.importedStylesheets.set(c,m);let y=m.childNodes[0];y&&this.mapTemplatesFromStylesheet(y,f),yield this.xsltChildNodes(e,y,r),this.styleSheetStack.pop()})}xsltImport(e,t,r){return P(this,null,function*(){yield this.xsltImportOrInclude(e,t,r,!0)})}xsltInclude(e,t,r){return P(this,null,function*(){yield this.xsltImportOrInclude(e,t,r,!1)})}xsltKey(e,t){let r=p(t,"name"),n=p(t,"match"),s=p(t,"use");if(!r||!n||!s){let l="<xsl:key> missing required parameters: ";throw r||(l+="name, "),n||(l+="match, "),s||(l+="use, "),l=l.slice(0,-2),new Error(l)}let i;e.nodeList[e.position].nodeName==="#document"?i=e.clone(e.nodeList[e.position].childNodes):i=e;let a=this.xsltMatch(n,i);r in e.keys||(e.keys[r]={});for(let l of a){let u=e.clone([l]),d=this.xPath.xPathEval(s,u).stringValue();e.keys[r][d]=new I([l])}}xsltMessage(e,t){return P(this,null,function*(){let r=H(this.outputDocument);yield this.xsltChildNodes(e,t,r);let n=G(r),s=p(t,"terminate")||"no";if(console.log(`[xsl:message] ${n}`),s==="yes")throw new Error(`xsl:message terminated: ${n}`)})}xsltNamespaceAlias(e){let t=p(e,"stylesheet-prefix"),r=p(e,"result-prefix");if(!t||!r)throw new Error("<xsl:namespace-alias> requires both stylesheet-prefix and result-prefix attributes.");this.namespaceAliases.set(t,r)}xsltNumber(e,t,r){let n=p(t,"value"),s=p(t,"level")||"single",i=p(t,"count"),a=p(t,"from"),l=p(t,"format")||"1",u=p(t,"lang"),c=p(t,"letter-value"),d=p(t,"grouping-separator"),h=p(t,"grouping-size"),m;if(n){let T=this.xPath.xPathEval(n,e);m=Math.round(T.numberValue())}else m=this.xsltNumberCount(e,s,i,a);let N=this.xsltFormatNumber(m,l,d,h),f=U(this.outputDocument,N),y=r||this.outputDocument;f.siblingPosition=y.childNodes.length,v(y,f)}xsltNumberCount(e,t,r,n){let s=e.nodeList[e.position],i=r||s.nodeName;switch(t){case"single":{let a=1,l=s.previousSibling;for(;l;)l.nodeType===s.nodeType&&this.nodeMatchesPattern(l,i)&&a++,l=l.previousSibling;return a}case"multiple":{let a=1,l=s.previousSibling;for(;l;)l.nodeType===s.nodeType&&this.nodeMatchesPattern(l,i)&&a++,l=l.previousSibling;return a}case"any":{let a=1,l=this.getAllPrecedingNodes(s);for(let u of l)this.nodeMatchesPattern(u,i)&&a++;return a}default:return 1}}nodeMatchesPattern(e,t){return t==="*"?e.nodeType===1:e.nodeName===t||e.localName===t}getAllPrecedingNodes(e){let t=[],r=e.previousSibling;for(;r;)t.push(r),this.collectDescendants(r,t),r=r.previousSibling;let n=e.parentNode;for(;n;){let s=n.previousSibling;for(;s;)t.push(s),this.collectDescendants(s,t),s=s.previousSibling;n=n.parentNode}return t}collectDescendants(e,t){for(let r of e.childNodes)r.nodeType===1&&(t.push(r),this.collectDescendants(r,t))}xsltFormatNumber(e,t,r,n){let s=t.charAt(0),i;switch(s){case"1":if(i=e.toString(),t.length>1&&t.match(/^0+1$/)){let a=t.length;i=e.toString().padStart(a,"0")}break;case"a":i=this.numberToAlpha(e,!1);break;case"A":i=this.numberToAlpha(e,!0);break;case"i":i=this.numberToRoman(e).toLowerCase();break;case"I":i=this.numberToRoman(e);break;default:i=e.toString()}if(r&&n){let a=parseInt(n,10);a>0&&!isNaN(a)&&(i=this.applyGrouping(i,r,a))}return i}numberToAlpha(e,t){if(e<=0)return"";let r="";for(;e>0;)e--,r=String.fromCharCode(e%26+(t?65:97))+r,e=Math.floor(e/26);return r}numberToRoman(e){if(e<=0||e>3999)return e.toString();let t=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r="";for(let[n,s]of t)for(;e>=n;)r+=s,e-=n;return r}applyGrouping(e,t,r){let n=e.split("."),s=n[0],i=n[1],a="",l=0;for(let u=s.length-1;u>=0;u--)l>0&&l%r===0&&(a=t+a),a=s[u]+a,l++;return i?a+"."+i:a}xsltSort(e,t){let r=[];for(let n of t.childNodes)if(n.nodeType==1&&this.isXsltElement(n,"sort")){let s=p(n,"select"),i=this.xPath.xPathParse(s),a=p(n,"data-type")||"text",l=p(n,"order")||"ascending";r.push({expr:i,type:a,order:l})}this.xPath.xPathSort(e,r)}xsltStripSpace(e){let t=p(e,"elements");if(t){let r=t.trim().split(/\s+/);this.stripSpacePatterns.push(...r)}}xsltPreserveSpace(e){let t=p(e,"elements");if(t){let r=t.trim().split(/\s+/);this.preserveSpacePatterns.push(...r)}}shouldStripWhitespaceNode(e){if(!e.nodeValue||!e.nodeValue.match(/^\s*$/)||this.stripSpacePatterns.length===0)return!1;let t=e.parentNode;if(!t||t.nodeType!==1)return!1;let r=t;for(;r&&r.nodeType===1;){let s=te(r,"xml:space");if(s==="preserve")return!1;if(s==="default")break;r=r.parentNode}let n=t.localName||t.nodeName;for(let s of this.preserveSpacePatterns)if(this.matchesNamePattern(n,s,t))return!1;for(let s of this.stripSpacePatterns)if(this.matchesNamePattern(n,s,t))return!0;return!1}matchesNamePattern(e,t,r){if(t==="*")return!0;if(t.includes(":")){let[n,s]=t.split(":"),i=r.prefix||"";return s==="*"?i===n:i===n&&e===s}return e===t}xsltTemplate(e,t,r){return P(this,null,function*(){if(!e.inApplyTemplates&&e.baseTemplateMatched)return;let n=p(t,"match");if(!n)return;let s=this.xsltMatch(n,e,"self-and-siblings");if(s.length>0){this.firstTemplateRan=!0,e.inApplyTemplates||(e.baseTemplateMatched=!0);let i=e.clone(s,0);yield this.xsltChildNodes(i,t,r)}})}xsltText(e,t,r){let n=G(t),s=U(this.outputDocument,n);s.fromXslText=!0;let i=t.childNodes.filter(l=>l.nodeType===2&&l.nodeName==="disable-output-escaping");i.length>0&&i[0].nodeValue==="yes"&&(s.escape=!1);let a=r||this.outputDocument;s.siblingPosition=a.childNodes.length,a.appendChild(s)}validateStylesheetAttributes(e,t){let r=e.childNodes.filter(a=>a.nodeType===2),n=["version","id","extension-element-prefixes","exclude-result-prefixes","default-collation"],s=["xmlns"],i=!1;for(let a of r){let l=a.nodeName,u=a.nodeValue;if(a.prefix==="xmlns"){t.knownNamespaces[a.localName]=u;continue}if(l==="xmlns"){t.knownNamespaces[""]=u;continue}if(l==="version"){if(i=!0,!["1.0","2.0","3.0"].includes(u))throw new Error(`XSLT version not defined or invalid. Actual resolved version: ${u||"(none)"}.`);this.version=u,t.xsltVersion=u;continue}if(l==="extension-element-prefixes"){let c=u.split(/\s+/);for(let d of c)if(d&&!/^[a-zA-Z_:][\w:.-]*$/.test(d))throw new Error(`Invalid prefix in extension-element-prefixes: "${d}". Prefixes must be valid QNames.`);continue}if(l==="exclude-result-prefixes"){if(u!=="#all"){let c=u.split(/\s+/);for(let d of c)if(d&&!/^[a-zA-Z_:][\w:.-]*$/.test(d))throw new Error(`Invalid prefix in exclude-result-prefixes: "${d}". Prefixes must be valid QNames or "#all".`)}continue}if(l==="default-collation"){if(!u||u.trim().length===0)throw new Error("The default-collation attribute must contain a URI.");continue}if(l==="id"){if(!/^[a-zA-Z_:][\w:.-]*$/.test(u))throw new Error(`Invalid id attribute value: "${u}". IDs must be valid NCNames.`);continue}}}xsltTransformOrStylesheet(e,t,r){return P(this,null,function*(){var u,c,d;let n={importDepth:0,href:"(main stylesheet)",order:0};this.mapTemplatesFromStylesheet(t,n),this.collectAttributeSets(t),this.validateStylesheetAttributes(t,e);let s=!1;for(let h of t.childNodes)if(h.nodeType===1)if(this.isXsltElement(h,"import")){if(s)throw new Error("<xsl:import> should be the first child node of <xsl:stylesheet> or <xsl:transform>.")}else s=!0;let i=[],a=[];for(let h of t.childNodes)h.nodeType===1&&this.isXsltElement(h,"template")?a.push(h):i.push(h);let l=e.clone();for(let h of i)yield this.xsltProcessContext(l,h,r);if(a.length>0){let h=et(t,null,this.xPath,this.templateSourceMap),m=[];for(let N of h)try{let f=this.xsltMatch(N.matchPattern,l);f.length>0&&m.push({priority:N,matchedNodes:f})}catch(f){console.warn(`Failed to match pattern "${N.matchPattern}":`,f)}if(m.length>0){let N=m.find(C=>C.priority.matchPattern==="/"),f;N?f=N:(m.sort((C,w)=>C.priority.importPrecedence!==w.priority.importPrecedence?w.priority.importPrecedence-C.priority.importPrecedence:C.priority.effectivePriority!==w.priority.effectivePriority?w.priority.effectivePriority-C.priority.effectivePriority:w.priority.documentOrder-C.priority.documentOrder),f=m[0]);let y=m.filter(C=>C.priority.importPrecedence===f.priority.importPrecedence&&C.priority.effectivePriority===f.priority.effectivePriority);if(y.length>1){let C=y.map(w=>`"${w.priority.matchPattern}" (priority: ${w.priority.effectivePriority})`).join(", ");console.warn(`XSLT Warning: Ambiguous template match. Multiple templates match with equal priority: ${C}. Using the last one in document order.`)}this.firstTemplateRan=!0,l.baseTemplateMatched=!0;let T=l.clone(f.matchedNodes,0),O=this.templateSourceMap.get(f.priority.template),M=p(f.priority.template,"match"),_=p(f.priority.template,"mode");this.currentTemplateStack.push({template:f.priority.template,stylesheetDepth:(u=O==null?void 0:O.importDepth)!=null?u:0,mode:_||null,match:M}),yield this.xsltChildNodes(T,f.priority.template,r),this.currentTemplateStack.pop()}else{let N=e.nodeList[e.position];if(N&&N.childNodes&&N.childNodes.length>0){let f=N.childNodes.filter(y=>y.nodeName!=="#dtd-section");if(f.length>0){let y=e.clone(f);for(let T=0;T<y.contextSize();++T){let O=y.nodeList[T];if(O.nodeType===3){let M=e.clone([O],0);this.commonLogicTextNode(M,O,r)}else{let M=y.clone([O],0),_=Le(h,M,this.matchResolver,this.xPath);if(_.selectedTemplate){let C=M.clone([O],0);C.inApplyTemplates=!0;let w=this.templateSourceMap.get(_.selectedTemplate),ye=p(_.selectedTemplate,"match"),ee=p(_.selectedTemplate,"mode");this.currentTemplateStack.push({template:_.selectedTemplate,stylesheetDepth:(c=w==null?void 0:w.importDepth)!=null?c:0,mode:ee||null,match:ye}),yield this.xsltChildNodes(C,_.selectedTemplate,r),this.currentTemplateStack.pop()}else if(O.childNodes&&O.childNodes.length>0){let C=O.childNodes.filter(w=>w.nodeName!=="#dtd-section");if(C.length>0){let w=e.clone(C);for(let ye=0;ye<w.contextSize();++ye){let ee=w.nodeList[ye];if(ee.nodeType===3){let Ve=e.clone([ee],0);this.commonLogicTextNode(Ve,ee,r)}else{let Ve=w.clone([ee],0),le=Le(h,Ve,this.matchResolver,this.xPath);if(le.selectedTemplate){let Nt=Ve.clone([ee],0);Nt.inApplyTemplates=!0;let rt=this.templateSourceMap.get(le.selectedTemplate),Gt=p(le.selectedTemplate,"match"),jt=p(le.selectedTemplate,"mode");this.currentTemplateStack.push({template:le.selectedTemplate,stylesheetDepth:(d=rt==null?void 0:rt.importDepth)!=null?d:0,mode:jt||null,match:Gt}),yield this.xsltChildNodes(Nt,le.selectedTemplate,r),this.currentTemplateStack.pop()}}}}}}}}}}}})}xsltValueOf(e,t,r){let n=p(t,"select"),s=e.nodeList[e.position],i=this.xPath.xPathEval(n,e);if(s&&s.nodeName==="#document"&&(i.stringValue()===""||i instanceof I&&i.nodeSetValue().length===0)){let c=s.childNodes.find(d=>d.nodeName!=="#dtd-section");if(c){let d=e.clone([c],0);i=this.xPath.xPathEval(n,d)}}let a=i.stringValue(),l=U(this.outputDocument,a),u=r||this.outputDocument;l.siblingPosition=u.childNodes.length,u.appendChild(l)}xsltVariable(e,t,r){return P(this,null,function*(){let n=p(t,"name"),s=p(t,"select"),i;if(t.childNodes.filter(l=>l.nodeType!==2).length>0){let l=H(t.ownerDocument);yield this.xsltChildNodes(e,t,l),i=new I([l])}else if(s)i=this.xPath.xPathEval(s,e);else{let l="",u=this.options.parameters.filter(c=>c.name===n);u.length>0&&(l=u[0].value),i=new k(l)}(r||!e.getVariable(n))&&e.setVariable(n,i)})}xsltChildNodes(e,t,r){return P(this,null,function*(){let n=e.clone();for(let s=0;s<t.childNodes.length;++s){let i=t.childNodes[s];i.nodeType!==2&&(yield this.xsltProcessContext(n,i,r))}})}commonLogicTextNode(e,t,r){if(r){if(this.shouldStripWhitespaceNode(t))return;let n=U(this.outputDocument,t.nodeValue);n.siblingPosition=r.childNodes.length,v(r,n)}}xsltPassThrough(e,t,r){return P(this,null,function*(){switch(t.nodeType){case 3:this.xsltPassText(t)&&this.commonLogicTextNode(e,t,r);break;case 1:let n,s=e;n=e.nodeList[e.position];let i;i=W(this.outputDocument,t.nodeName),i.siblingPosition=n.siblingPosition,v(r||this.outputDocument,i);let a=t.childNodes.find(u=>(u==null?void 0:u.nodeType)===2&&u.nodeName==="use-attribute-sets");a&&(yield this.applyAttributeSets(s,i,a.nodeValue)),yield this.xsltChildNodes(s,t,i);let l=t.childNodes.filter(u=>(u==null?void 0:u.nodeType)===2&&u.nodeName!=="use-attribute-sets");for(let u of l){let c=u.nodeName,d=this.xsltAttributeValue(u.nodeValue,s);B(i,c,d)}break;default:yield this.xsltChildNodes(e,t,r)}})}xsltPassText(e){if(!e.nodeValue.match(/^\s*$/))return!0;let t=e.parentNode;if(this.isXsltElement(t,"text"))return!0;for(;t&&t.nodeType==1;){let r=te(t,"xml:space");if(r){if(r=="default")return!1;if(r=="preserve")return!0}t=t.parentNode}return!1}findAttributeInContext(e,t){return t.nodeList[t.position].childNodes.find(r=>r.nodeType===2&&r.nodeName===e)}xsltAttributeValue(e,t){let r=e.split("{");if(r.length===1)return e;let n="";for(let s=0;s<r.length;++s){let i=r[s].split("}");if(i.length!=2){n+=r[s];continue}let a=this.xPath.xPathEval(i[0],t).stringValue();n+=a+i[1]}return n}xsltMatch(e,t,r){let n=this.xPath.xPathParse(e,r);return this.matchResolver.expressionMatch(n,t)}xsltWithParam(e,t){return P(this,null,function*(){for(let r of t.childNodes)r.nodeType===1&&this.isXsltElement(r,"with-param")&&(yield this.xsltVariable(e,r,!0))})}mapTemplatesFromStylesheet(e,t){for(let r of e.childNodes)r.nodeType===1&&(this.isXsltElement(r,"template")?this.templateSourceMap.set(r,t):(this.isXsltElement(r,"stylesheet")||this.isXsltElement(r,"transform"))&&this.mapTemplatesFromStylesheet(r,t))}collectAttributeSets(e){for(let t of e.childNodes)if(t.nodeType===1&&this.isXsltElement(t,"attribute-set")){let r=p(t,"name"),n=t.childNodes.filter(s=>s.nodeType===1&&this.isXsltElement(s,"attribute"));if(r){let s=this.attributeSets.get(r);s&&s.length?this.attributeSets.set(r,[...s,...n]):this.attributeSets.set(r,n)}}}applyAttributeSets(e,t,r){return P(this,null,function*(){if(!r||!r.trim())return;let n=r.trim().split(/\s+/),s=new Set;for(let i of n)yield this.applyAttributeSet(e,t,i,s)})}applyAttributeSet(e,t,r,n){return P(this,null,function*(){if(n.has(r))return;n.add(r);let s=this.attributeSets.get(r);if(s)for(let i of s){let a=null,l=i.parentNode;if(l&&(a=p(l,"use-attribute-sets")),a)for(let m of a.trim().split(/\s+/))m&&(yield this.applyAttributeSet(e,t,m,n));let u=p(i,"name"),c=this.xsltAttributeValue(u,e),d=H(this.outputDocument);yield this.xsltChildNodes(e,i,d);let h=$e(d);B(t,c,h)}})}isExtensionElementSupported(e){if(e.nodeType!==1)return!0;let t=e.namespaceUri;return!t||this.isXsltElement(e)?!0:!!this.supportedExtensions.has(t)}getFallbackElement(e){for(let t of e.childNodes)if(t.nodeType===1&&this.isXsltElement(t,"fallback"))return t;return null}xsltExtensionElement(e,t,r){return P(this,null,function*(){let n=this.getFallbackElement(t);n?yield this.xsltChildNodes(e,n,r):yield this.xsltPassThrough(e,t,r)})}isXsltElement(e,t){return t&&e.localName!=t?!1:e.namespaceUri?e.namespaceUri==="http://www.w3.org/1999/XSL/Transform":e.prefix==="xsl"}};he();return st(Pr);})();
2
+ var XsltProcessor=(()=>{var ft=Object.defineProperty,pr=Object.defineProperties,hr=Object.getOwnPropertyDescriptor,dr=Object.getOwnPropertyDescriptors,mr=Object.getOwnPropertyNames,yn=Object.getOwnPropertySymbols;var xn=Object.prototype.hasOwnProperty,fr=Object.prototype.propertyIsEnumerable;var gn=(s,e,t)=>e in s?ft(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,D=(s,e)=>{for(var t in e||(e={}))xn.call(e,t)&&gn(s,t,e[t]);if(yn)for(var t of yn(e))fr.call(e,t)&&gn(s,t,e[t]);return s},B=(s,e)=>pr(s,dr(e));var j=(s,e)=>()=>(s&&(e=s(s=0)),e);var Ht=(s,e)=>{for(var t in e)ft(s,t,{get:e[t],enumerable:!0})},yr=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of mr(e))!xn.call(s,r)&&r!==t&&ft(s,r,{get:()=>e[r],enumerable:!(n=hr(e,r))||n.enumerable});return s};var Qt=s=>yr(ft({},"__esModule",{value:!0}),s);var S=(s,e,t)=>new Promise((n,r)=>{var i=c=>{try{a(t.next(c))}catch(u){r(u)}},o=c=>{try{a(t.throw(c))}catch(u){r(u)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(i,o);a((t=t.apply(s,e)).next())});function ue(s,e){return s.getAttributeValue(e)}function H(s,e,t){return s.setAttribute(e,t)}function A(s,e){return s.appendChild(e)}function G(s,e){return s.createTextNode(e)}function ee(s,e){return s.createElement(e)}function Oe(s,e){return s.createCDATASection(e)}function le(s,e){return s.createComment(e)}function te(s){return s.createDocumentFragment()}function yt(s,e){return s.createDTDSection(e)}function Kt(s,e,t){return s.createProcessingInstruction(e,t)}var gt=j(()=>{});var Nn={};Ht(Nn,{DOM_ATTRIBUTE_NODE:()=>N,DOM_CDATA_SECTION_NODE:()=>F,DOM_COMMENT_NODE:()=>Y,DOM_DOCUMENT_FRAGMENT_NODE:()=>U,DOM_DOCUMENT_NODE:()=>M,DOM_DOCUMENT_TYPE_NODE:()=>ve,DOM_ELEMENT_NODE:()=>x,DOM_ENTITY_NODE:()=>xr,DOM_ENTITY_REFERENCE_NODE:()=>gr,DOM_NOTATION_NODE:()=>Nr,DOM_PROCESSING_INSTRUCTION_NODE:()=>pe,DOM_TEXT_NODE:()=>v});var x,N,v,F,gr,xr,pe,Y,M,ve,U,Nr,W=j(()=>{x=1,N=2,v=3,F=4,gr=5,xr=6,pe=7,Y=8,M=9,ve=10,U=11,Nr=12});var ne,R,xt=j(()=>{W();ne=class ne{constructor(e,t,n,r,i){this.id=Math.random()*(Number.MAX_SAFE_INTEGER-1)+1,this.childNodes=[],this.visited=!1,this.escape=!0,this.fromXslText=!1,this.siblingPosition=-1,this.init(e,t,n,r,i)}init(e,t,n,r,i){this.nodeType=e-0,this.nodeName=`${t}`,this.nodeValue=`${n}`,this.ownerDocument=r,this.namespaceUri=i||null,[this.prefix,this.localName]=this.qualifiedNameToParts(`${t}`),this.firstChild=null,this.lastChild=null,this.nextSibling=null,this.previousSibling=null,this.parentNode=null}qualifiedNameToParts(e){return e.includes(":")?e.split(":"):[null,e]}domTraverseElements(e,t,n){let r;if(t&&(r=t.call(null,e),typeof r=="boolean"&&!r))return!1;for(let i=e.firstChild;i;i=i.nextSibling)if(i.nodeType==1&&(r=this.domTraverseElements.call(this,i,t,n),typeof r=="boolean"&&!r))return!1;if(n&&(r=n.call(null,e),typeof r=="boolean"&&!r))return!1}static recycle(e){if(e){if(e.constructor.name==="XDocument"){this.recycle(e.documentElement);return}if(e.constructor==this){this._unusedXNodes.push(e);for(let t=0;t<e.childNodes.length;++t)this.recycle(e.childNodes[t]);e.childNodes.length=0,e.init.call(0,"","",null)}}}static create(e,t,n,r,i){if(this._unusedXNodes.length>0){let o=this._unusedXNodes.pop();return o.init(e,t,n,r,i),o}return new ne(e,t,n,r,i)}static clone(e,t){let n=new ne(e.nodeType,e.nodeName,e.nodeValue,t,e.namespaceUri);n.id=e.id;for(let r of e.childNodes)n.appendChild(ne.clone(r,n));return n}appendChild(e){this.childNodes.length===0&&(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)}replaceChild(e,t){if(t!=e){for(let n=0;n<this.childNodes.length;++n)if(this.childNodes[n]==t){this.childNodes[n]=e;let r=t.parentNode;t.parentNode=null,e.parentNode=r,r=t.previousSibling,t.previousSibling=null,e.previousSibling=r,e.previousSibling&&(e.previousSibling.nextSibling=e),r=t.nextSibling,t.nextSibling=null,e.nextSibling=r,e.nextSibling&&(e.nextSibling.previousSibling=e),this.firstChild==t&&(this.firstChild=e),this.lastChild==t&&(this.lastChild=e);break}}}insertBefore(e,t){if(t==e||t.parentNode!=this)return;e.parentNode&&e.parentNode.removeChild(e);let n=[];for(let r of this.childNodes)r==t&&(n.push(e),e.parentNode=this,e.previousSibling=t.previousSibling,t.previousSibling=e,e.previousSibling&&(e.previousSibling.nextSibling=e),e.nextSibling=t,this.firstChild==t&&(this.firstChild=e)),n.push(r);this.childNodes=n}removeChild(e){let t=[];for(let n of this.childNodes)n!=e?t.push(n):(n.previousSibling&&(n.previousSibling.nextSibling=n.nextSibling),n.nextSibling&&(n.nextSibling.previousSibling=n.previousSibling),this.firstChild==n&&(this.firstChild=n.nextSibling),this.lastChild==n&&(this.lastChild=n.previousSibling));this.childNodes=t}hasAttributes(){return this.childNodes.filter(t=>t.nodeType===2).length>0}setAttribute(e,t){let n=this.childNodes.filter(i=>i.nodeType===2);for(let i=0;i<n.length;++i)if(n[i].nodeName==e){n[i].nodeValue=`${t}`;return}let r=ne.create(2,e,t,this);r.parentNode=this,this.appendChild(r)}setAttributeNS(e,t,n){let r=this.childNodes.filter(o=>o.nodeType===2);for(let o=0;o<r.length;++o){let a=r[o];if(a.namespaceUri==e&&a.localName==this.qualifiedNameToParts(`${t}`)[1]){a.nodeValue=`${n}`,a.nodeName=`${t}`,a.prefix=this.qualifiedNameToParts(`${t}`)[0];return}}let i=ne.create(2,t,n,this,e);i.parentNode=this,this.appendChild(i)}getAttributeValue(e){let t=this.childNodes.filter(n=>n.nodeType===2);for(let n=0;n<t.length;++n)if(t[n].nodeName===e)return t[n].nodeValue;return null}getAttributeNS(e,t){let n=this.childNodes.filter(r=>r.nodeType===2);for(let r=0;r<n.length;++r){let i=n[r];if(i.namespaceUri===e&&i.localName===t)return i.nodeValue}return null}hasAttribute(e){let t=this.childNodes.filter(n=>n.nodeType===2);for(let n=0;n<t.length;++n)if(t[n].nodeName===e)return!0;return!1}hasAttributeNS(e,t){let n=this.childNodes.filter(r=>r.nodeType===2);for(let r=0;r<n.length;++r){let i=n[r];if(i.namespaceUri===e&&i.localName===t)return!0}return!1}removeAttribute(e){let t=[];for(let n=0;n<this.childNodes.length;++n){let r=this.childNodes[n];if(r.nodeType!==2){t.push(r);continue}r.nodeName!==e&&t.push(r)}this.childNodes=t}removeAttributeNS(e,t){let n=[];for(let r=0;r<this.childNodes.length;++r){let i=this.childNodes[r];if(i.nodeType!==2){n.push(i);continue}(i.localName!==t||i.namespaceUri!==e)&&n.push(i)}this.childNodes=n}getElementsByTagName(e){let t=[],n=this;return e=="*"?this.domTraverseElements(this,r=>{n!=r&&t.push(r)},null):this.domTraverseElements(this,r=>{n!=r&&r.nodeName==e&&t.push(r)},null),t}getElementsByTagNameNS(e,t){let n=[],r=this;return e=="*"&&t=="*"?this.domTraverseElements(this,i=>{r!=i&&n.push(i)},null):e=="*"?this.domTraverseElements(this,i=>{r!=i&&i.localName==t&&n.push(i)},null):t=="*"?this.domTraverseElements(this,i=>{r!=i&&i.namespaceUri==e&&n.push(i)},null):this.domTraverseElements(this,i=>{r!=i&&i.localName==t&&i.namespaceUri==e&&n.push(i)},null),n}getElementById(e){let t=null;return this.domTraverseElements(this,n=>{if(n.getAttributeValue("id")==e)return t=n,!1},null),t}getAncestorByLocalName(e){if(!(this.parentNode===null||this.parentNode===void 0))return this.parentNode.localName===e?this.parentNode:this.parentNode.getAncestorByLocalName(e)}getAncestorById(e){if(!(this.parentNode===null||this.parentNode===void 0))return this.parentNode.id===e?this.parentNode:this.parentNode.getAncestorById(e)}toString(){return`${this.nodeType}, ${this.nodeName}, ${this.nodeValue}`}};ne._unusedXNodes=[];R=ne});var re,Zt=j(()=>{W();xt();re=class extends R{constructor(){super(9,"#document",null,null),this.documentElement=null}appendChild(e){super.appendChild(e),this.documentElement=this.childNodes[0]}createElement(e){return R.create(1,e,null,this)}createElementNS(e,t){return R.create(1,t,null,this,e)}createDocumentFragment(){return R.create(11,"#document-fragment",null,this)}createTextNode(e){return R.create(3,"#text",e,this)}createAttribute(e){return R.create(2,e,null,this)}createAttributeNS(e,t){return R.create(2,t,null,this,e)}createComment(e){return R.create(8,"#comment",e,this)}createCDATASection(e){return R.create(4,"#cdata-section",e,this)}createDTDSection(e){return R.create(10,"#dtd-section",e,this)}createProcessingInstruction(e,t){return R.create(7,e,t,this)}}});function Ne(s){if(!s)return s;let e=s.replace(/&([a-zA-Z]+);/g,(t,n)=>{let r=n.toLowerCase();return Er[r]||t});return e=e.replace(/&#(\d+);/g,(t,n)=>{try{let r=parseInt(n,10);return String.fromCharCode(r)}catch(r){return t}}),e=e.replace(/&#[xX]([0-9a-fA-F]+);/g,(t,n)=>{try{let r=parseInt(n,16);return String.fromCharCode(r)}catch(r){return t}}),e}var Er,Jt=j(()=>{Er={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",copy:"\xA9",reg:"\xAE",times:"\xD7",divide:"\xF7",euro:"\u20AC",pound:"\xA3",yen:"\xA5",cent:"\xA2",sect:"\xA7",para:"\xB6",hellip:"\u2026",middot:"\xB7",deg:"\xB0"}});function Q(s,e=!1){if(!s)return"";let t="";switch(s.nodeType){case 10:return`<!DOCTYPE ${s.nodeValue}>`;case 3:case 4:case 2:return s.nodeValue;case 1:case 9:case 11:if(!e){let r=s,i=r.innerText;if(i!==void 0)return i;let o=r.textContent;if(o!==void 0)return o}let n=s.childNodes.filter(r=>r.nodeType!==2);for(let r=0;r<n.length;++r)t+=Q(n[r]);return t}}function Nt(s,e=!1){if(!s)return"";let t="";switch(s.nodeType){case 2:case 3:t+=s.nodeValue;break;case 4:t+=s.nodeValue;break;case 9:case 11:case 1:if(!e){let r=s,i=r.innerText;if(i!==void 0)return i;let o=r.textContent;if(o!==void 0)return o}let n=s.childNodes.length;for(let r=0;r<n;++r)t+=Q(s.childNodes[r]);break}return t}function Tr(s,e={cData:!0,escape:!0,selfClosingTags:!0,outputMethod:"xml"}){let t=[];return en(s,t,e),t.join("")}function en(s,e,t){if(s.nodeType==3)e.push(he(s.nodeValue));else if(s.nodeType==4)t.cData?e.push(s.nodeValue):e.push(`<![CDATA[${s.nodeValue}]]>`);else if(s.nodeType==8)e.push(`<!--${s.nodeValue}-->`);else if(s.nodeType==1){e.push(`<${ie(s)}`);for(let n=0;n<s.childNodes.length;++n){let r=s.childNodes[n];!r||r.nodeType!==2||r.nodeName&&r.nodeValue&&e.push(` ${ie(r)}="${Tn(r.nodeValue)}"`)}if(s.childNodes.length===0)t.selfClosingTags||t.outputMethod==="html"&&["hr","link"].includes(s.nodeName)?e.push("/>"):e.push(`></${ie(s)}>`);else{e.push(">");for(let n=0;n<s.childNodes.length;++n)en(s.childNodes[n],e,t);e.push(`</${ie(s)}>`)}}else if(s.nodeType==9||s.nodeType==11)for(let n=0;n<s.childNodes.length;++n)en(s.childNodes[n],e,t)}function nn(s,e={cData:!0,escape:!0,selfClosingTags:!0,outputMethod:"xml"}){let t=[];return Re(s,t,e),t.join("")}function Re(s,e,t){if(s.visited)return;let n=s.nodeType,r=s.nodeValue;if(n===3){let i=s.fromXslText===!0;if(s.nodeValue&&(i||s.nodeValue.trim()!=="")){let o=s.escape&&t.escape?he(s.nodeValue):En(s.nodeValue);e.push(o)}}else if(n===4)t.outputMethod==="text"?e.push(r):t.cData?e.push(he(r)):e.push(`<![CDATA[${r}]]>`);else if(n==8)t.outputMethod!=="text"&&e.push(`<!-- ${r} -->`);else if(n===7)t.outputMethod!=="text"&&(r&&r.trim()?e.push(`<?${s.nodeName} ${r}?>`):e.push(`<?${s.nodeName}?>`));else if(n==1)t.outputMethod==="text"?Xr(s,e,t):s.nodeName!==null&&s.nodeName!==void 0?br(s,e,t):Pr(s,e,t);else if(n===9||n===11){let i=s.firstChild?[]:s.childNodes;if(s.firstChild){let o=s.firstChild;for(;o;)i.push(o),o=o.nextSibling}i.sort((o,a)=>o.siblingPosition-a.siblingPosition);for(let o=0;o<i.length;++o)Re(i[o],e,t)}s.visited=!0}function br(s,e,t){e.push(`<${ie(s)}`);let n=[];if(s.firstChild){let i=s.firstChild;for(;i;)i.nodeType===2&&n.push(i),i=i.nextSibling}n.length===0&&(n=s.childNodes.filter(i=>i.nodeType===2));for(let i=0;i<n.length;++i){let o=n[i];o&&o.nodeName&&o.nodeValue!==null&&o.nodeValue!==void 0&&e.push(` ${ie(o)}="${Tn(o.nodeValue)}"`)}let r=[];if(s.firstChild){let i=s.firstChild;for(;i;)i.nodeType!==2&&r.push(i),i=i.nextSibling}if(r.length===0&&(r=s.childNodes.filter(i=>i.nodeType!==2)),r=r.sort((i,o)=>i.siblingPosition-o.siblingPosition),r.length===0)t.outputMethod==="html"&&["hr","link","meta"].includes(s.nodeName)?e.push(">"):t.selfClosingTags?e.push("/>"):e.push(`></${ie(s)}>`);else{e.push(">");for(let i=0;i<r.length;++i)Re(r[i],e,t);e.push(`</${ie(s)}>`)}}function Pr(s,e,t){let n=[];if(s.firstChild){let r=s.firstChild;for(;r;)n.push(r),r=r.nextSibling}else n=s.childNodes;n=n.sort((r,i)=>r.siblingPosition-i.siblingPosition);for(let r=0;r<n.length;++r)Re(n[r],e,t)}function Xr(s,e,t){let n=[];if(s.firstChild){let r=s.firstChild;for(;r;)n.push(r),r=r.nextSibling}else n=s.childNodes;n=n.sort((r,i)=>r.siblingPosition-i.siblingPosition);for(let r=0;r<n.length;++r)Re(n[r],e,t)}function ie(s){let e=s.nodeName;return s.prefix&&e.indexOf(`${s.prefix}:`)!=0?`${s.prefix}:${e}`:e}function En(s){return`${s}`.replace(/&lt;/g,"<").replace(/&gt;/g,">")}function he(s){return`${s}`.replace(/&/g,"&amp;").replace(/&amp;amp;/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Tn(s){return he(s).replace(/"/g,"&quot;")}function m(s,e){let t=ue(s,e);return t&&Ne(t)}function bn(s){if(s==null)throw new Error("Node has no valid owner document.");return s.nodeType===9?s:bn(s.ownerDocument)}function tn(s){if(!s)return null;let e=s.nodeType;if(e===3||e===4){let t=s.nodeValue?s.nodeValue.trim():"";return t.length>0?t:null}if(e===8)return null;if(e===9||e===11){let t=s.childNodes||[],n=[];for(let r=0;r<t.length;r++){let i=t[r],o=tn(i);o!==null&&n.push(o)}return n.length===0?null:n.length===1?n[0]:n}if(e===1){let t={},n=s,r=n.attributes&&n.attributes.length>0;if(r)for(let u=0;u<n.attributes.length;u++){let l=n.attributes[u];t["@"+l.nodeName]=l.nodeValue}let i=n.childNodes||[],o="",a=!1,c={};for(let u=0;u<i.length;u++){let l=i[u],h=l.nodeType;if(h===3||h===4){let p=l.nodeValue?l.nodeValue.trim():"";p.length>0&&(o+=p)}else if(h===1){a=!0;let p=l,f=p.localName||p.nodeName,y=tn(l);y!==null&&(c[f]?(Array.isArray(c[f])||(c[f]=[c[f]]),c[f].push(y)):c[f]=y)}}if(Object.assign(t,c),!a&&o.length>0){if(!r&&Object.keys(c).length===0)return o;t["#text"]=o}return Object.keys(t).length===0?null:t}return null}function rn(s){if(!s)return"xml";let e=s.nodeType;if(e===9||e===11){let t=s.childNodes||[],n=0,r=0,i=!1;for(let o=0;o<t.length;o++){let a=t[o];a.nodeType===1?n++:a.nodeType===3&&(a.nodeValue?a.nodeValue.trim():"").length>0&&(r++,i=!0)}return n===0&&i?"text":"xml"}return(e===3||e===4)&&(s.nodeValue?s.nodeValue.trim():"").length>0?"text":"xml"}function sn(s){if(!s)return"{}";let e=s;if(s.nodeType===9||s.nodeType===11){let o=s.childNodes||[];for(let a=0;a<o.length;a++)if(o[a].nodeType===1){e=o[a];break}}let t=e,n=t.localName||t.nodeName,r={},i=tn(e);i===null?r[n]={}:(typeof i=="object"&&Array.isArray(i),r[n]=i);try{let o=JSON.parse(JSON.stringify(r));return JSON.stringify(o)}catch(o){return JSON.stringify(r)}}var Pn=j(()=>{Jt();W();gt()});var Xn=j(()=>{});var Et,Tt,wn,An,Cr,Sr,On,vn,Rn,bt,wr,Pt,Ar,Cn,Or,In,Dn,_n,vr,Xt,Rr,Sn,Ir,Mn,Dr,Mi,Vn=j(()=>{Et=`[ \r
3
+ ]+`,Tt=`(${Et})?=(${Et})?`,wn="&#[0-9]+;|&#x[0-9a-fA-F]+;",An=`${Et}version${Tt}("1\\.0"|'1\\.0')`,Cr="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\xFF\u0100-\u0131\u0134-\u013E\u0141-\u0148\u014A-\u017E\u0180-\u01C3\u01CD-\u01F0\u01F4-\u01F5\u01FA-\u0217\u0250-\u02A8\u02BB-\u02C1\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03CE\u03D0-\u03D6\u03DA\u03DC\u03DE\u03E0\u03E2-\u03F3\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E-\u0481\u0490-\u04C4\u04C7-\u04C8\u04CB-\u04CC\u04D0-\u04EB\u04EE-\u04F5\u04F8-\u04F9\u0531-\u0556\u0559\u0561-\u0586\u05D0-\u05EA\u05F0-\u05F2\u0621-\u063A\u0641-\u064A\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D3\u06D5\u06E5-\u06E6\u0905-\u0939\u093D\u0958-\u0961\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8B\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AE0\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B36-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CDE\u0CE0-\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D60-\u0D61\u0E01-\u0E2E\u0E30\u0E32-\u0E33\u0E40-\u0E45\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EAE\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0F40-\u0F47\u0F49-\u0F69\u10A0-\u10C5\u10D0-\u10F6\u1100\u1102-\u1103\u1105-\u1107\u1109\u110B-\u110C\u110E-\u1112\u113C\u113E\u1140\u114C\u114E\u1150\u1154-\u1155\u1159\u115F-\u1161\u1163\u1165\u1167\u1169\u116D-\u116E\u1172-\u1173\u1175\u119E\u11A8\u11AB\u11AE-\u11AF\u11B7-\u11B8\u11BA\u11BC-\u11C2\u11EB\u11F0\u11F9\u1E00-\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u212E\u2180-\u2182\u3041-\u3094\u30A1-\u30FA\u3105-\u312C\uAC00-\uD7A3",Sr="\u4E00-\u9FA5\u3007\u3021-\u3029",On="\u0300-\u0345\u0360-\u0361\u0483-\u0486\u0591-\u05A1\u05A3-\u05B9\u05BB-\u05BD\u05BF\u05C1-\u05C2\u05C4\u064B-\u0652\u0670\u06D6-\u06DC\u06DD-\u06DF\u06E0-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0901-\u0903\u093C\u093E-\u094C\u094D\u0951-\u0954\u0962-\u0963\u0981-\u0983\u09BC\u09BE\u09BF\u09C0-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u0A02\u0A3C\u0A3E\u0A3F\u0A40-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A70-\u0A71\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0B01-\u0B03\u0B3C\u0B3E-\u0B43\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B82-\u0B83\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C01-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C82-\u0C83\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0D02-\u0D03\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0F18-\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86-\u0F8B\u0F90-\u0F95\u0F97\u0F99-\u0FAD\u0FB1-\u0FB7\u0FB9\u20D0-\u20DC\u20E1\u302A-\u302F\u3099\u309A",vn="0-9\u0660-\u0669\u06F0-\u06F9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE7-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29",Rn="\xB7\u02D0\u02D1\u0387\u0640\u0E46\u0EC6\u3005\u3031-\u3035\u309D-\u309E\u30FC-\u30FE",bt=Cr+Sr,wr=`${bt+vn}\\._:${On}${Rn}-`,Pt=`[${bt}_:][${wr}]*`,Ar=`&${Pt};`,Cn=`${Ar}|${wn}`,Or=`"(([^<&"]|${Cn})*)"|'(([^<&']|${Cn})*)'`,In=`(${Pt})${Tt}(${Or})`,Dn=`${Et}version${Tt}("1\\.1"|'1\\.1')`,_n=":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",vr=_n+"\\.0-9\xB7\u0300-\u036F\u203F-\u2040-",Xt=`[${_n}][${vr}]*`,Rr=`&${Xt};`,Sn=`${Rr}|${wn}`,Ir=`"(([^<&"]|${Sn})*)"|'(([^<&']|${Sn})*)'`,Mn=`(${Xt})${Tt}(${Ir})`,Dr=`${bt+vn}\\._${On}${Rn}-`,Mi=`[${bt}_][${Dr}]*`});var de,Ln=j(()=>{Jt();gt();Zt();Vn();W();de=class{constructor(){this.regexEmpty=/\/$/;this.XML10_TAGNAME_REGEXP=new RegExp(`^(${Pt})`);this.XML10_ATTRIBUTE_REGEXP=new RegExp(In,"g");this.XML11_TAGNAME_REGEXP=new RegExp(`^(${Xt})`);this.XML11_ATTRIBUTE_REGEXP=new RegExp(Mn,"g");this.lenientHtmlTags=["hr","link","meta"]}xmlParse(e){return e.toUpperCase().startsWith("<!DOCTYPE HTML")?this.htmlParse(e):this.xmlStrictParse(e)}namespaceMapAt(e){let t={xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace"},n=e;for(;n!==null;){for(let r=0;r<n.childNodes.length;r++){let i=n.childNodes[r];if(i.nodeType===2)if(i.nodeName.startsWith("xmlns:")){let o=i.nodeName.split(":")[1];o in t||(t[o]=i.nodeValue)}else i.nodeName=="xmlns"&&(""in t||(t[""]=i.nodeValue||null))}n=n.parentNode}return t}htmlParse(e){let t=new re,n=t,r=[],i=n;r.push(i);let o=!1,a=!1,c=!1,u=0;for(let l=0;l<e.length;++l){let h=e.charAt(l);if(o){if(!c&&h==="'")a=!a;else if(!a&&h==='"')c=!c;else if(!a&&!c&&h===">"){let p=e.slice(u,l);if(p.charAt(0)==="/")r.pop(),i=r[r.length-1];else if(p.charAt(0)!=="!"){let f=p.match(this.regexEmpty),y=this.XML10_TAGNAME_REGEXP.exec(p)[1],d=ee(t,y),g;for(;g=this.XML10_ATTRIBUTE_REGEXP.exec(p);){let P=Ne(g[5]||g[7]||"");H(d,g[1],P)}d.siblingPosition=i.childNodes.length,A(i,d),!f&&!this.lenientHtmlTags.includes(y)&&(i=d,r.push(d))}u=l+1,o=!1,a=!1,c=!1}}else if(h==="<"){let p=e.slice(u,l);if(p&&i!==n&&A(i,G(t,p)),e.slice(l+1,l+4)==="!--"){let f=e.slice(l+4).indexOf("-->");if(f){let y=le(t,e.slice(l+4,l+f+4));A(i,y),l+=f+6}}else if(e.slice(l+1,l+9)==="!DOCTYPE"){let f=e.slice(l+9).indexOf(">");if(f){let y=e.slice(l+9,l+f+9).trimStart(),d=yt(t,y);A(i,d),l+=f+y.length+5}}else o=!0;u=l+1}}return t}xmlStrictParse(e){let t,n;if(e.match(/^<\?xml/))if(e.search(new RegExp(An))===5)t=this.XML10_TAGNAME_REGEXP,n=this.XML10_ATTRIBUTE_REGEXP;else if(e.search(new RegExp(Dn))===5)t=this.XML11_TAGNAME_REGEXP,n=this.XML11_ATTRIBUTE_REGEXP;else throw new Error("XML VersionInfo has an unknown version number.");else t=this.XML10_TAGNAME_REGEXP,n=this.XML10_ATTRIBUTE_REGEXP;let r=new re,i=r,o=[],a=i;o.push(a);let c=!1,u=!1,l=!1,h=0;for(let p=0;p<e.length;++p){let f=e.charAt(p);if(c&&!l&&f==="'")u=!u;else if(c&&!u&&f==='"')l=!l;else if(c&&f===">"&&!u&&!l){let y=e.slice(h,p);if(y.charAt(0)==="/")o.pop(),a=o[o.length-1];else if(y.charAt(0)!=="?"){if(y.charAt(0)!=="!"){let d=y.match(this.regexEmpty),g=t.exec(y)[1],P=ee(r,g),O;for(;O=n.exec(y);){let $=Ne(O[5]||O[7]||"");H(P,O[1],$)}P.siblingPosition=a.childNodes.length,A(a,P),d||(a=P,o.push(P));let k=this.namespaceMapAt(P);P.prefix!==null?P.prefix in k&&(P.namespaceUri=k[P.prefix]):""in k&&(P.namespaceUri=k[""]);for(let $=0;$<P.childNodes.length;++$){let w=P.childNodes[$];w.nodeType===2&&w.prefix!==null&&w.prefix in k&&(w.namespaceUri=k[w.prefix])}}}h=p+1,c=!1,u=!1,l=!1}else if(!c&&f==="<"){let y=e.slice(h,p);if(y&&a!==i&&A(a,G(r,Ne(y))),e.slice(p+1,p+4)==="!--"){let d=e.slice(p+4).indexOf("-->");if(d){let g=le(r,e.slice(p+4,p+d+4));A(a,g),p+=d+6}}else if(e.slice(p+1,p+9)==="![CDATA["){let d=e.slice(p+9).indexOf("]]>");if(d){let g=Oe(r,e.slice(p+9,p+d+9));A(a,g),p+=d+11}}else if(e.slice(p+1,p+9)==="!DOCTYPE"){let d=e.slice(p+9).indexOf(">");if(d){let g=e.slice(p+9,p+d+9).trimStart(),P=yt(r,g);A(a,P),p+=d+g.length+5}}else c=!0;h=p+1}}return i}}});var on,$n=j(()=>{xt();on=class extends R{}});var kn={};Ht(kn,{XBrowserNode:()=>on,XDocument:()=>re,XNode:()=>R,XmlParser:()=>de,detectAdaptiveOutputFormat:()=>rn,domAppendChild:()=>A,domCreateCDATASection:()=>Oe,domCreateComment:()=>le,domCreateDTDSection:()=>yt,domCreateDocumentFragment:()=>te,domCreateElement:()=>ee,domCreateProcessingInstruction:()=>Kt,domCreateTextNode:()=>G,domGetAttributeValue:()=>ue,domSetAttribute:()=>H,xmlEscapeText:()=>he,xmlGetAttribute:()=>m,xmlOwnerDocument:()=>bn,xmlText:()=>Tr,xmlToJson:()=>sn,xmlTransformedText:()=>nn,xmlUnescapeText:()=>En,xmlValue:()=>Q,xmlValueLegacyBehavior:()=>Nt});var Ee=j(()=>{gt();Zt();Pn();Xn();Ln();$n();xt()});var bi={};Ht(bi,{ExprContext:()=>ge,XPath:()=>ye,XmlParser:()=>de,Xslt:()=>Gt,xmlEscapeText:()=>he});Ee();var T=class{constructor(e,t){this.type=e,this.lexeme=t}};var Fn="1.0",_r={ancestor:{type:"LOCATION",value:"ancestor"},"ancestor-or-self":{type:"LOCATION",value:"ancestor-or-self"},attribute:{type:"LOCATION",value:"attribute"},child:{type:"LOCATION",value:"child"},descendant:{type:"LOCATION",value:"descendant"},"descendant-or-self":{type:"LOCATION",value:"descendant-or-self"},following:{type:"LOCATION",value:"following"},"following-sibling":{type:"LOCATION",value:"following-sibling"},namespace:{type:"LOCATION",value:"namespace"},parent:{type:"LOCATION",value:"parent"},preceding:{type:"LOCATION",value:"preceding"},"preceding-sibling":{type:"LOCATION",value:"preceding-sibling"},self:{type:"LOCATION",value:"self"},node:{type:"NODE_TYPE",value:"node"},text:{type:"NODE_TYPE",value:"text"},comment:{type:"NODE_TYPE",value:"comment"},"processing-instruction":{type:"NODE_TYPE",value:"processing-instruction"},and:{type:"OPERATOR",value:"and"},or:{type:"OPERATOR",value:"or"},div:{type:"OPERATOR",value:"div"},mod:{type:"OPERATOR",value:"mod"},last:{type:"FUNCTION",value:"last"},position:{type:"FUNCTION",value:"position"},count:{type:"FUNCTION",value:"count"},id:{type:"FUNCTION",value:"id"},"local-name":{type:"FUNCTION",value:"local-name"},"namespace-uri":{type:"FUNCTION",value:"namespace-uri"},name:{type:"FUNCTION",value:"name"},string:{type:"FUNCTION",value:"string"},concat:{type:"FUNCTION",value:"concat"},"starts-with":{type:"FUNCTION",value:"starts-with"},contains:{type:"FUNCTION",value:"contains"},"substring-before":{type:"FUNCTION",value:"substring-before"},"substring-after":{type:"FUNCTION",value:"substring-after"},substring:{type:"FUNCTION",value:"substring"},"string-length":{type:"FUNCTION",value:"string-length"},"normalize-space":{type:"FUNCTION",value:"normalize-space"},translate:{type:"FUNCTION",value:"translate"},boolean:{type:"FUNCTION",value:"boolean"},not:{type:"FUNCTION",value:"not"},true:{type:"FUNCTION",value:"true"},false:{type:"FUNCTION",value:"false"},lang:{type:"FUNCTION",value:"lang"},number:{type:"FUNCTION",value:"number"},sum:{type:"FUNCTION",value:"sum"},floor:{type:"FUNCTION",value:"floor"},ceiling:{type:"FUNCTION",value:"ceiling"},round:{type:"FUNCTION",value:"round"}},Mr={if:{type:"RESERVED_WORD",value:"if"},then:{type:"RESERVED_WORD",value:"then"},else:{type:"RESERVED_WORD",value:"else"},for:{type:"RESERVED_WORD",value:"for"},in:{type:"RESERVED_WORD",value:"in"},return:{type:"RESERVED_WORD",value:"return"},some:{type:"RESERVED_WORD",value:"some"},every:{type:"RESERVED_WORD",value:"every"},satisfies:{type:"RESERVED_WORD",value:"satisfies"},instance:{type:"RESERVED_WORD",value:"instance"},of:{type:"RESERVED_WORD",value:"of"},cast:{type:"RESERVED_WORD",value:"cast"},as:{type:"RESERVED_WORD",value:"as"},castable:{type:"RESERVED_WORD",value:"castable"},treat:{type:"RESERVED_WORD",value:"treat"}};function Vr(s){let e=D({},_r);return s!=="1.0"&&Object.assign(e,Mr),e}var Te=class{constructor(e){var t;typeof e=="object"?this.version=(t=e.version)!=null?t:Fn:this.version=e!=null?e:Fn,this.reservedWords=Vr(this.version)}getVersion(){return this.version}registerFunctions(e){this.additionalFunctions||(this.additionalFunctions=new Set);for(let t of e)this.additionalFunctions.add(t)}isAlpha(e){return/^[a-zA-Z_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]$/.test(e)}isAlphaNumeric(e){return/^[a-zA-Z0-9_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0300-\u036F\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]$/.test(e)}isNumber(e){return/^[0-9]$/.test(e)}isWhitespace(e){return/^[\s\t\n\r]$/.test(e)}peek(){return this.expression[this.current]}peekNext(){return this.expression[this.current+1]}next(){return this.expression[this.current++]}match(e){return this.current>=this.expression.length||this.expression[this.current]!==e?!1:(this.current++,!0)}parseIdentifier(e){let t=e;for(;this.current<this.expression.length;){let r=this.expression[this.current];if(this.isAlphaNumeric(r))t+=this.next();else if(r==="-"){let i=this.expression[this.current+1];if(i&&this.isAlphaNumeric(i))for(this.current++,t+="-";this.current<this.expression.length&&this.isAlphaNumeric(this.expression[this.current]);)t+=this.next();else break}else break}let n=this.reservedWords[t.toLowerCase()];if(n)return new T(n.type,t);if(this.additionalFunctions&&this.additionalFunctions.has(t))return new T("FUNCTION",t);if(t.length>0)return new T("IDENTIFIER",t);throw new Error(`Invalid identifier: ${t}`)}parseString(e){let t="";for(;this.current<this.expression.length&&this.expression[this.current]!==e;)t+=this.next();if(this.current>=this.expression.length)throw new Error("Unterminated string literal");return this.next(),new T("STRING",t)}parseNumber(e){let t=e;for(;this.current<this.expression.length&&this.isNumber(this.expression[this.current])&&this.expression[this.current]!==".";)t+=this.next();if(this.current<this.expression.length&&this.expression[this.current]===".")for(t+=this.next();this.current<this.expression.length&&this.isNumber(this.expression[this.current]);)t+=this.next();if(t.length>0)return new T("NUMBER",t);throw new Error(`Invalid number: ${t}`)}scanToken(){let e=this.next();if(this.isWhitespace(e))return null;switch(e){case"@":return new T("AT",e);case"$":return new T("DOLLAR",e);case"|":return new T("PIPE",e);case"{":return new T("OPEN_CURLY_BRACKET",e);case"}":return new T("CLOSE_CURLY_BRACKET",e);case"[":return new T("OPEN_SQUARE_BRACKET",e);case"]":return new T("CLOSE_SQUARE_BRACKET",e);case"(":return new T("OPEN_PAREN",e);case")":return new T("CLOSE_PAREN",e);case"+":return new T("PLUS",e);case"-":return new T("MINUS",e);case"*":return new T("ASTERISK",e);case",":return new T("COMMA",e);case"?":return new T("QUESTION",e);case".":return this.match(".")?new T("DOT_DOT",".."):this.peek()&&this.isNumber(this.peek())?this.parseNumber(e):new T("DOT",e);case"/":return this.match("/")?new T("DOUBLE_SLASH","//"):new T("SLASH",e);case":":return this.match(":")?new T("COLON_COLON","::"):new T("COLON",e);case"=":return new T("EQUALS",e);case"!":if(this.match("="))return new T("NOT_EQUALS","!=");throw new Error(`Unexpected character: ${e}`);case"<":return this.match("=")?new T("LESS_THAN_OR_EQUAL","<="):new T("LESS_THAN",e);case">":return this.match("=")?new T("GREATER_THAN_OR_EQUAL",">="):new T("GREATER_THAN",e);case"'":return this.parseString("'");case'"':return this.parseString('"');default:if(this.isNumber(e))return this.parseNumber(e);if(this.isAlpha(e))return this.parseIdentifier(e);throw new Error(`Unexpected character: ${e}`)}}scan(e){for(this.expression=e,this.tokens=[],this.current=0;this.current<this.expression.length;){let t=this.scanToken();t!==null&&this.tokens.push(t)}return this.tokens}};var E=class{};var Ct=class extends E{constructor(e){super(),this.value=e}evaluate(e){return this.value}},St=class extends E{constructor(e){super(),this.value=e}evaluate(e){return this.value}};var be={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_FRAGMENT_NODE:11,NAMESPACE_NODE:13},b="http://www.w3.org/2001/XMLSchema",Un="http://www.w3.org/2005/xqt-errors",Wn="http://www.w3.org/2005/xpath-functions",an="http://www.w3.org/2005/xpath-functions/collation/codepoint",qn=["last","position","count","id","local-name","namespace-uri","name","string","concat","starts-with","contains","substring-before","substring-after","substring","string-length","normalize-space","translate","boolean","not","true","false","lang","number","sum","floor","ceiling","round"];var wt=class s extends Error{constructor(e,t,n=!1,r=!1){super(`${e}: ${t}`),Object.setPrototypeOf(this,s.prototype),this.code=e,this.isStatic=n,this.isDynamic=r,this.name="XPathError",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}getQName(){return`err:${this.code}`}getErrorURI(){return`${Un}#${this.code}`}},Pe=class s extends wt{constructor(e,t){super(e,t,!0,!1),Object.setPrototypeOf(this,s.prototype),this.name="XPathStaticError"}},At=class s extends wt{constructor(e,t){super(e,t,!1,!0),Object.setPrototypeOf(this,s.prototype),this.name="XPathDynamicError"}},cn=class s extends At{constructor(e,t){super(e,t),Object.setPrototypeOf(this,s.prototype),this.name="XPathTypeError"}};function me(s){return new Pe("XPST0003",`Grammar violation: ${s}`)}function Ie(s,e="name"){return new Pe("XPST0008",`Unresolved ${e} reference: ${s}`)}function Bn(s){return new Pe("XPST0010",`Unsupported axis: ${s}`)}function zn(s,e,t){return new Pe("XPST0017",`Function ${s} expects ${e}, got ${t} arguments`)}function Ot(s,e,t){let n=t?`Type mismatch in ${t}: expected ${s}, got ${e}`:`Type mismatch: expected ${s}, got ${e}`;return new cn("XPTY0004",n)}function jn(s,e){return new At("FORG0001",`Cannot cast ${JSON.stringify(s)} to ${e}`)}var vt=class extends E{constructor(e){super(),this.name=e}evaluate(e){if(!e.variables)throw Ie(`$${this.name}`,"variable");if(!(this.name in e.variables))throw Ie(`$${this.name}`,"variable");return e.variables[this.name]}};var K=class extends E{constructor(e,t,n=[]){super(),this.axis=e,this.nodeTest=t,this.predicates=n}evaluate(e){let t=e==null?void 0:e.node;if(!t)return[];let n=this.getNodesByAxis(t,e);return n=n.filter(r=>this.matchesNodeTest(r,e)),n=this.applyPredicates(n,e),n}getNodesByAxis(e,t){switch(this.axis){case"child":return this.getChildNodes(e);case"parent":return e.parentNode?[e.parentNode]:[];case"self":return[e];case"attribute":return e.attributes?Array.from(e.attributes):Array.from(e.childNodes||[]).filter(n=>n.nodeType===2);case"descendant":return this.getDescendants(e,!1);case"descendant-or-self":return this.getDescendants(e,!0);case"ancestor":return this.getAncestors(e,!1);case"ancestor-or-self":return this.getAncestors(e,!0);case"following-sibling":return this.getFollowingSiblings(e);case"preceding-sibling":return this.getPrecedingSiblings(e);case"following":return this.getFollowing(e);case"preceding":return this.getPreceding(e);case"namespace":return this.getNamespaceNodes(e);case"self-and-siblings":return t!=null&&t.nodeList?t.nodeList.filter(n=>n.nodeType!==2):[e];default:return[]}}getChildNodes(e){return Array.from(e.childNodes||[]).filter(n=>n.nodeType!==2)}getDescendants(e,t){let n=[];t&&n.push(e);let r=i=>{for(let o of this.getChildNodes(i))n.push(o),r(o)};return r(e),n}getAncestors(e,t){let n=[];t&&n.push(e);let r=e.parentNode;for(;r;)n.push(r),r=r.parentNode;return n}getFollowingSiblings(e){let t=[],n=e.nextSibling;for(;n;)t.push(n),n=n.nextSibling;return t}getPrecedingSiblings(e){let t=[],n=e.previousSibling;for(;n;)t.unshift(n),n=n.previousSibling;return t}getFollowing(e){let t=[],n=e.nextSibling;for(;n;)t.push(n),t.push(...this.getDescendants(n,!1)),n=n.nextSibling;let r=e.parentNode;for(;r;){for(n=r.nextSibling;n;)t.push(n),t.push(...this.getDescendants(n,!1)),n=n.nextSibling;r=r.parentNode}return t}getPreceding(e){let t=[],n=e.previousSibling;for(;n;){t.unshift(n);let i=this.getDescendants(n,!1);t.unshift(...i),n=n.previousSibling}let r=e.parentNode;for(;r;){for(n=r.previousSibling;n;){t.unshift(n);let i=this.getDescendants(n,!1);t.unshift(...i),n=n.previousSibling}r=r.parentNode}return t}getNamespaceNodes(e){var r,i;if(!e||e.nodeType!==1)return[];let t={},n=e;for(;n;){let o=Array.from(n.attributes||[]);for(let a of o){let c=a.nodeName||a.localName||"",u=(i=(r=a.nodeValue)!=null?r:a.textContent)!=null?i:"";if(c==="xmlns")""in t||(t[""]=u);else if(c.startsWith("xmlns:")){let l=c.substring(6);l in t||(t[l]=u)}}n=n.parentNode}return"xml"in t||(t.xml="http://www.w3.org/XML/1998/namespace"),Object.entries(t).map(([o,a])=>({nodeType:13,nodeName:o,localName:o,prefix:o,namespaceURI:a,namespaceUri:a,nodeValue:a,textContent:a,parentNode:e,ownerDocument:e.ownerDocument}))}matchesNodeTest(e,t,n=this.nodeTest){var o,a;let r=e.nodeType,i=(c,u)=>{var p,f;if(!u.includes(r))return!1;if(c.endsWith(":*")){let y=c.slice(0,-2),d=(p=t==null?void 0:t.namespaces)==null?void 0:p[y];return d?(e.namespaceURI||e.namespaceUri||"")===d:!1}let l=c.indexOf(":");if(l>0){let y=c.substring(0,l),d=c.substring(l+1),g=(f=t==null?void 0:t.namespaces)==null?void 0:f[y];if(!g)return!1;let P=e.localName||e.nodeName&&this.extractLocalName(e.nodeName),O=e.namespaceURI||e.namespaceUri||"";return P===d&&O===g}return(e.localName||this.extractLocalName(e.nodeName))===c};switch(n.type){case"wildcard":if(n.name&&n.name.endsWith(":*")){let u=n.name.slice(0,-2),l=(o=t==null?void 0:t.namespaces)==null?void 0:o[u];if(!l)return!1;let h=e.namespaceURI||e.namespaceUri||"";return(r===1||r===2||r===13)&&h===l}return r===1||r===2||r===13;case"name":return i(n.name,[1,2,13]);case"element":return r!==1?!1:!n.name||n.isWildcardName?!0:i(n.name,[1]);case"attribute":return r!==2?!1:!n.name||n.isWildcardName?!0:i(n.name,[2]);case"schema-element":return i(n.name,[1]);case"schema-attribute":return i(n.name,[2]);case"document-node":if(r!==9)return!1;if(!n.elementTest)return!0;let c=e.documentElement||Array.from(e.childNodes||[]).find(u=>u.nodeType===1);return c?this.matchesNodeTest(c,t,n.elementTest):!1;case"node-type":switch(n.nodeType){case"node":return!0;case"text":return r===3;case"comment":return r===8;case"processing-instruction":return r===7;default:return!1}case"processing-instruction":return r!==7?!1:n.target?((a=e.target)!=null?a:e.nodeName)===n.target:!0;default:return!1}}applyPredicates(e,t){let n=e;for(let r of this.predicates){let i=[],o=n.length;for(let a=0;a<n.length;a++){let c=B(D({},t),{node:n[a],position:a+1,size:o}),u=r.evaluate(c);typeof u=="number"?u===a+1&&i.push(n[a]):this.toBoolean(u)&&i.push(n[a])}n=i}return n}toBoolean(e){return typeof e=="boolean"?e:typeof e=="number"?e!==0&&!isNaN(e):typeof e=="string"||Array.isArray(e)?e.length>0:!!e}extractLocalName(e){if(!e)return"";let t=e.indexOf(":");return t>0?e.substring(t+1):e}};var se=class extends E{constructor(e,t=!1){super(),this.steps=e,this.absolute=t}evaluate(e){let t;if(this.absolute){let n=this.getDocumentRoot(e==null?void 0:e.node);t=n?[n]:[]}else t=e!=null&&e.node?[e.node]:[];for(let n of this.steps){let r=[];for(let i of t){let o=B(D({},e),{node:i}),a=n.evaluate(o);r.push(...a)}t=this.uniqueNodes(r)}return t}getDocumentRoot(e){if(!e)return null;let t=e;for(;t.parentNode;)t=t.parentNode;return t}uniqueNodes(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}};var Rt=class extends E{constructor(e,t){super(),this.expression=e,this.predicates=t||[]}evaluate(e){let t=this.expression.evaluate(e);Array.isArray(t)||(t=t==null?[]:[t]);for(let n of this.predicates)t=this.applyPredicate(t,n,e);return t}applyPredicate(e,t,n){let r=[];for(let i=0;i<e.length;i++){let o=e[i],a=B(D({},n),{node:(o==null?void 0:o.nodeType)!==void 0?o:n.node,position:i+1,size:e.length});this.testPredicate(t,a)&&r.push(o)}return r}testPredicate(e,t){let n=e.evaluate(t);return typeof n=="number"?n===t.position:this.toBoolean(n)}toBoolean(e){return typeof e=="boolean"?e:typeof e=="number"?e!==0&&!isNaN(e):typeof e=="string"||Array.isArray(e)?e.length>0:e!=null}},It=class extends E{constructor(e,t){super(),this.filterExpr=e,this.pathExpr=t}evaluate(e){let t=this.filterExpr.evaluate(e);if(!Array.isArray(t))return[];let n=[];for(let r of t){let i=B(D({},e),{node:(r==null?void 0:r.nodeType)!==void 0?r:e.node}),o=this.pathExpr.evaluate(i);Array.isArray(o)?n.push(...o):o!=null&&n.push(o)}return n}};var Dt=class extends E{constructor(e,t){super(),this.operator=e,this.operand=t}evaluate(e){let t=this.operand.evaluate(e),n=this.atomize(t);if(n===null)return null;let r=this.toNumber(n);return this.operator==="+"?r:-r}atomize(e){return e==null?null:Array.isArray(e)?e.length===0?null:e[0]:e}toNumber(e){if(typeof e=="number")return e;if(typeof e=="boolean")return e?1:0;if(typeof e=="string"){let t=e.trim();return t===""?NaN:Number(t)}return Number(e)}toString(){return`${this.operator}${this.operand.toString()}`}};var De=class extends E{constructor(e,t,n){super(),this.left=e,this.right=t,this.operator=n}evaluate(e){let t=this.left.evaluate(e),n=this.right.evaluate(e);return this.compare(t,n,this.operator)}compare(e,t,n){let r=Array.isArray(e),i=Array.isArray(t);return r&&i?this.compareNodeSets(e,t,n):r?this.compareNodeSetToValue(e,t,n):i?this.compareValueToNodeSet(e,t,n):this.comparePrimitives(e,t,n)}compareNodeSets(e,t,n){for(let r of e){let i=this.getStringValue(r);for(let o of t){let a=this.getStringValue(o);if(this.comparePrimitives(i,a,n))return!0}}return!1}compareNodeSetToValue(e,t,n){for(let r of e){let i=typeof t=="number"?Number(this.getStringValue(r)):this.getStringValue(r);if(this.comparePrimitives(i,t,n))return!0}return!1}compareValueToNodeSet(e,t,n){for(let r of t){let i=typeof e=="number"?Number(this.getStringValue(r)):this.getStringValue(r);if(this.comparePrimitives(e,i,n))return!0}return!1}comparePrimitives(e,t,n){switch(n){case"=":return e==t;case"!=":return e!=t;case"<":return Number(e)<Number(t);case">":return Number(e)>Number(t);case"<=":return Number(e)<=Number(t);case">=":return Number(e)>=Number(t);default:throw new Error(`Unknown operator: ${n}`)}}getStringValue(e){if(!e)return"";if(e.nodeType===3||e.nodeType===2)return e.nodeValue||e.textContent||"";if(e.textContent!==void 0)return e.textContent;if(e.childNodes){let t="";for(let n of Array.from(e.childNodes))n.nodeType===3?t+=n.nodeValue||"":n.nodeType===1&&(t+=this.getStringValue(n));return t}return String(e)}};var Xe=class extends E{constructor(e,t,n){super(),this.left=e,this.right=t,this.operator=n}evaluate(e){let t=this.left.evaluate(e),n=this.right.evaluate(e),r=this.atomize(t),i=this.atomize(n);if(r===null||i===null)return null;let o=this.toNumber(r),a=this.toNumber(i);switch(this.operator){case"+":return o+a;case"-":return o-a;case"*":return o*a;case"div":return o/a;case"idiv":if(a===0)throw new Error("XPDY0002: Integer division by zero");return Math.trunc(o/a);case"mod":if(a===0)throw new Error("XPDY0002: Modulo by zero");return o-Math.trunc(o/a)*a;default:throw new Error(`Unknown arithmetic operator: ${this.operator}`)}}atomize(e){return e==null?null:Array.isArray(e)?e.length===0?null:e[0]:e}toNumber(e){if(typeof e=="number")return e;if(typeof e=="boolean")return e?1:0;if(typeof e=="string"){let t=e.trim();return t===""?NaN:Number(t)}return Number(e)}toString(){return`${this.left.toString()} ${this.operator} ${this.right.toString()}`}};var _e=class extends E{constructor(e,t,n){super(),this.left=e,this.right=t,this.operator=n}toBoolean(e){return e==null?!1:typeof e=="boolean"?e:Array.isArray(e)?e.length===0?!1:e.length===1?this.toBoolean(e[0]):!0:typeof e=="number"?e!==0&&!isNaN(e):typeof e=="string"?e.length>0:!!e}evaluate(e){let t=this.toBoolean(this.left.evaluate(e));if(this.operator==="and")return t?this.toBoolean(this.right.evaluate(e)):!1;if(this.operator==="or")return t?!0:this.toBoolean(this.right.evaluate(e));throw new Error(`Unknown logical operator: ${this.operator}`)}};var X=class{constructor(e,t=b,n,r){this.name=e;this.namespace=t;this.baseType=n;this.primitive=r}get qualifiedName(){return`{${this.namespace}}${this.name}`}};var Z=class{constructor(e,t,n,r,i){this.name=e,this.nodeKind=t,this.nodeName=n,this.nodeType=r,this.isWildcardName=i}matches(e){return!(!e||typeof e!="object"||e.nodeType!==this.nodeKind||this.nodeName&&!this.isWildcardName&&e.localName!==this.nodeName&&e.nodeName!==this.nodeName||this.nodeType&&e.type!==this.nodeType)}},_t=class extends Z{constructor(){super("node()","node")}matches(){return!0}},Mt=class extends Z{constructor(e,t){let n=e?t?`element(${e}, ${t})`:`element(${e})`:"element()";super(n,"element",e,t,!e)}},Vt=class extends Z{constructor(e,t){let n=e?t?`attribute(${e}, ${t})`:`attribute(${e})`:"attribute()";super(n,"attribute",e,t,!e)}},Lt=class extends Z{constructor(e){let t=e?`document-node(${e.name})`:"document-node()";super(t,"document",void 0,void 0,!0),this.elementTest=e}matches(e){return super.matches(e)?this.elementTest&&e.documentElement?this.elementTest.matches(e.documentElement):!0:!1}},$t=class extends Z{constructor(){super("text()","text")}},kt=class extends Z{constructor(){super("comment()","comment")}},Ft=class extends Z{constructor(e){let t=e?`processing-instruction(${e})`:"processing-instruction()";super(t,"processing-instruction",e,void 0,!e)}};var Lr={node:new _t,element:new Mt,attribute:new Vt,documentNode:new Lt,text:new $t,comment:new kt,processingInstruction:new Ft};var Ve=class extends X{constructor(){super("anyAtomicType",b)}validate(e){return e!=null&&typeof e!="object"}cast(e){return e}},Le=class extends X{constructor(e){super("untypedAtomic",b,e,e)}validate(e){return typeof e=="string"}cast(e){return String(e)}},$e=class extends X{constructor(e){super("string",b,e,void 0)}validate(e){return typeof e=="string"}cast(e){if(e==null)throw new Error("Cannot cast null or undefined to xs:string");return String(e)}},ke=class extends X{constructor(e){super("boolean",b,e,void 0)}validate(e){return typeof e=="boolean"}cast(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1;throw new Error(`Cannot cast "${e}" to xs:boolean`)}if(typeof e=="number"){if(e===0)return!1;if(e===1)return!0;throw new Error(`Cannot cast ${e} to xs:boolean`)}throw new Error(`Cannot cast ${typeof e} to xs:boolean`)}};var Fe=class extends X{constructor(e){super("decimal",b,e,void 0)}validate(e){return typeof e=="number"?isFinite(e):!1}cast(e){if(typeof e=="number"&&isFinite(e))return e;if(typeof e=="string"){let t=parseFloat(e);if(!isFinite(t))throw new Error(`Cannot cast "${e}" to xs:decimal`);return t}if(typeof e=="boolean")return e?1:0;throw new Error(`Cannot cast ${typeof e} to xs:decimal`)}},Ue=class extends X{constructor(e){super("float",b,e,void 0)}validate(e){return typeof e=="number"}cast(e){if(typeof e=="number")return e;if(typeof e=="string"){if(e==="INF")return 1/0;if(e==="-INF")return-1/0;if(e==="NaN")return NaN;let t=parseFloat(e);if(isNaN(t))throw new Error(`Cannot cast "${e}" to xs:float`);return t}if(typeof e=="boolean")return e?1:0;throw new Error(`Cannot cast ${typeof e} to xs:float`)}},We=class extends X{constructor(e){super("double",b,e,void 0)}validate(e){return typeof e=="number"}cast(e){if(typeof e=="number")return e;if(typeof e=="string"){if(e==="INF")return 1/0;if(e==="-INF")return-1/0;if(e==="NaN")return NaN;let t=parseFloat(e);if(isNaN(t))throw new Error(`Cannot cast "${e}" to xs:double`);return t}if(typeof e=="boolean")return e?1:0;throw new Error(`Cannot cast ${typeof e} to xs:double`)}},qe=class extends X{constructor(e,t){super("integer",b,e,t)}validate(e){return typeof e=="number"&&Number.isInteger(e)&&isFinite(e)}cast(e){let t=this.baseType.cast(e),n=Math.trunc(t);if(!isFinite(n))throw new Error(`Cannot cast ${e} to xs:integer`);return n}};function Gn(s){let e=s.match(/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/);if(!e)throw new Error(`Invalid duration format: "${s}"`);if(!e.slice(2).some(i=>i!==void 0))throw new Error(`Invalid duration format: "${s}"`);let n=!!e[1],r=n?-1:1;return{negative:n,years:r*(parseInt(e[2])||0),months:r*(parseInt(e[3])||0),days:r*(parseInt(e[4])||0),hours:r*(parseInt(e[5])||0),minutes:r*(parseInt(e[6])||0),seconds:r*(parseFloat(e[7])||0)}}function Yn(s){let e=s.match(/^(\d{2}):(\d{2}):(\d{2}(?:\.\d+)?)(?:Z|([+-])(\d{2}):(\d{2}))?$/);if(!e)throw new Error(`Invalid time format: "${s}"`);let t=parseInt(e[1],10),n=parseInt(e[2],10),r=parseFloat(e[3]);if(t<0||t>23)throw new Error(`Invalid hours value: ${t}`);if(n<0||n>59)throw new Error(`Invalid minutes value: ${n}`);if(r<0||r>=60)throw new Error(`Invalid seconds value: ${r}`);let i;return e[4]&&(i={sign:e[4],hours:parseInt(e[5],10),minutes:parseInt(e[6],10)}),{hours:t,minutes:n,seconds:r,timezone:i}}var Be=class extends X{constructor(e){super("duration",b,e,void 0)}validate(e){return typeof e=="object"&&e!==null&&"years"in e}cast(e){if(this.validate(e))return e;if(typeof e=="string")return Gn(e);throw new Error(`Cannot cast ${typeof e} to xs:duration`)}},ze=class extends X{constructor(e){super("dateTime",b,e,void 0)}validate(e){return e instanceof Date}cast(e){if(e instanceof Date)return e;if(typeof e=="string"){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid dateTime value: "${e}"`);return t}throw new Error(`Cannot cast ${typeof e} to xs:dateTime`)}},je=class extends X{constructor(e,t){super("date",b,e,t)}validate(e){return e instanceof Date}cast(e){let t=this.baseType.cast(e),n=new Date(t);return n.setHours(0,0,0,0),n}},Ge=class extends X{constructor(e,t){super("time",b,e,t)}validate(e){return typeof e=="object"&&e!==null&&"hours"in e}cast(e){if(this.validate(e))return e;if(typeof e=="string")return Yn(e);throw new Error(`Cannot cast ${typeof e} to xs:time`)}};var Ye=class extends X{constructor(e){super("gYearMonth",b,e,void 0)}validate(e){return typeof e=="object"&&e!==null&&"year"in e&&"month"in e}cast(e){if(this.validate(e))return e;if(typeof e=="string"){let t=e.match(/^(-?\d{4})-(\d{2})$/);if(!t)throw new Error(`Invalid gYearMonth format: "${e}"`);let n=parseInt(t[1],10),r=parseInt(t[2],10);if(r<1||r>12)throw new Error(`Invalid month value: ${r}`);return{year:n,month:r}}throw new Error(`Cannot cast ${typeof e} to xs:gYearMonth`)}},He=class extends X{constructor(e){super("gYear",b,e,void 0)}validate(e){return typeof e=="object"&&e!==null&&"year"in e}cast(e){if(this.validate(e))return e;if(typeof e=="string"){let t=e.match(/^(-?\d{4})$/);if(!t)throw new Error(`Invalid gYear format: "${e}"`);return{year:parseInt(t[1],10)}}throw new Error(`Cannot cast ${typeof e} to xs:gYear`)}},Qe=class extends X{constructor(e){super("gMonthDay",b,e,void 0)}validate(e){return typeof e=="object"&&e!==null&&"month"in e&&"day"in e}cast(e){if(this.validate(e))return e;if(typeof e=="string"){let t=e.match(/^--(\d{2})-(\d{2})$/);if(!t)throw new Error(`Invalid gMonthDay format: "${e}"`);let n=parseInt(t[1],10),r=parseInt(t[2],10);if(n<1||n>12)throw new Error(`Invalid month value: ${n}`);if(r<1||r>31)throw new Error(`Invalid day value: ${r}`);return{month:n,day:r}}throw new Error(`Cannot cast ${typeof e} to xs:gMonthDay`)}},Ke=class extends X{constructor(e){super("gDay",b,e,void 0)}validate(e){return typeof e=="object"&&e!==null&&"day"in e}cast(e){if(this.validate(e))return e;if(typeof e=="string"){let t=e.match(/^---(\d{2})$/);if(!t)throw new Error(`Invalid gDay format: "${e}"`);let n=parseInt(t[1],10);if(n<1||n>31)throw new Error(`Invalid day value: ${n}`);return{day:n}}throw new Error(`Cannot cast ${typeof e} to xs:gDay`)}},Ze=class extends X{constructor(e){super("gMonth",b,e,void 0)}validate(e){return typeof e=="object"&&e!==null&&"month"in e}cast(e){if(this.validate(e))return e;if(typeof e=="string"){let t=e.match(/^--(\d{2})$/);if(!t)throw new Error(`Invalid gMonth format: "${e}"`);let n=parseInt(t[1],10);if(n<1||n>12)throw new Error(`Invalid month value: ${n}`);return{month:n}}throw new Error(`Cannot cast ${typeof e} to xs:gMonth`)}};var Je=class extends X{constructor(e){super("hexBinary",b,e,void 0)}validate(e){return typeof e=="string"?/^[0-9A-Fa-f]*$/.test(e)&&e.length%2===0:e instanceof Uint8Array}cast(e){if(typeof e=="string"){if(!this.validate(e))throw new Error(`Invalid hexBinary format: "${e}"`);return e.toUpperCase()}if(e instanceof Uint8Array)return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("").toUpperCase();throw new Error(`Cannot cast ${typeof e} to xs:hexBinary`)}},et=class extends X{constructor(e){super("base64Binary",b,e,void 0)}validate(e){return typeof e=="string"?/^[A-Za-z0-9+/]*={0,2}$/.test(e)&&e.length%4===0:e instanceof Uint8Array}cast(e){if(typeof e=="string"){if(!this.validate(e))throw new Error(`Invalid base64Binary format: "${e}"`);return e}if(e instanceof Uint8Array){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="",r=0,i=e.length;for(;r<i;){let o=e[r++],a=r<i,c=a?e[r++]:0,u=r<i,l=u?e[r++]:0,h=o<<16|c<<8|l;n+=t[h>>18&63],n+=t[h>>12&63],n+=a?t[h>>6&63]:"=",n+=u?t[h&63]:"="}return n}throw new Error(`Cannot cast ${typeof e} to xs:base64Binary`)}};var tt=class extends X{constructor(e){super("anyURI",b,e,void 0)}validate(e){return typeof e=="string"}cast(e){if(typeof e=="string")return e;throw new Error(`Cannot cast ${typeof e} to xs:anyURI`)}},nt=class extends X{constructor(e){super("QName",b,e,void 0)}validate(e){return typeof e=="object"&&e!==null&&"localName"in e&&"namespaceURI"in e}cast(e){if(this.validate(e))return e;if(typeof e=="string"){let t=e.split(":");if(t.length===1)return{localName:t[0],namespaceURI:"",prefix:void 0};if(t.length===2)return{localName:t[1],namespaceURI:"",prefix:t[0]}}throw new Error(`Cannot cast ${typeof e} to xs:QName`)}};var V=class extends X{constructor(t,n,r,i,o){super(t,b,n,r);this.min=i;this.max=o}validate(t){return!(typeof t!="number"||!Number.isInteger(t)||!isFinite(t)||!Number.isSafeInteger(t)||this.min!==void 0&&t<this.min||this.max!==void 0&&t>this.max)}cast(t){let n=this.baseType.cast(t);if(!Number.isSafeInteger(n))throw new Error(`Value ${n} is not a safe integer for ${this.name}`);if(this.min!==void 0&&n<this.min)throw new Error(`Value ${n} is below minimum ${this.min} for ${this.name}`);if(this.max!==void 0&&n>this.max)throw new Error(`Value ${n} is above maximum ${this.max} for ${this.name}`);return n}};var _=new Ve,Wr=new Le(_),qr=new $e(_),Br=new ke(_),L=new Fe(_),zr=new Ue(_),jr=new We(_),Gr=new Be(_),rt=new ze(_),Yr=new je(rt,rt),Hr=new Ge(rt,rt),Qr=new tt(_),Kr=new nt(_),Zr=new Ye(_),Jr=new He(_),ei=new Qe(_),ti=new Ke(_),ni=new Ze(_),ri=new Je(_),ii=new et(_),Ut=new qe(L,L),Qn=new V("long",Ut,L,-9223372036854776e3,9223372036854776e3),Kn=new V("int",Qn,L,-2147483648,2147483647),Zn=new V("short",Kn,L,-32768,32767),si=new V("byte",Zn,L,-128,127),Jn=new V("nonPositiveInteger",Ut,L,void 0,0),oi=new V("negativeInteger",Jn,L,void 0,-1),ln=new V("nonNegativeInteger",Ut,L,0,void 0),ai=new V("positiveInteger",ln,L,1,void 0),er=new V("unsignedLong",ln,L,0,18446744073709552e3),tr=new V("unsignedInt",er,L,0,4294967295),nr=new V("unsignedShort",tr,L,0,65535),ci=new V("unsignedByte",nr,L,0,255),ui={anyAtomicType:_,untypedAtomic:Wr,string:qr,boolean:Br,decimal:L,float:zr,double:jr,integer:Ut,duration:Gr,dateTime:rt,date:Yr,time:Hr,anyURI:Qr,QName:Kr,gYearMonth:Zr,gYear:Jr,gMonthDay:ei,gDay:ti,gMonth:ni,hexBinary:ri,base64Binary:ii,long:Qn,int:Kn,short:Zn,byte:si,nonPositiveInteger:Jn,negativeInteger:oi,nonNegativeInteger:ln,positiveInteger:ai,unsignedLong:er,unsignedInt:tr,unsignedShort:nr,unsignedByte:ci};function Me(s){return ui[s]}var fe=class extends E{constructor(e,t){super(),this.left=e,this.right=t}evaluate(e){let t=this.left.evaluate(e),n=this.right.evaluate(e),r=Array.isArray(t)?t:[],i=Array.isArray(n)?n:[];return this.unionNodes(r,i)}unionNodes(e,t){let n=new Set,r=[];for(let i of e)n.has(i)||(n.add(i),r.push(i));for(let i of t)n.has(i)||(n.add(i),r.push(i));return this.sortByDocumentOrder(r)}sortByDocumentOrder(e){return e.sort((t,n)=>{if(t===n)return 0;if(typeof t.compareDocumentPosition=="function"){let r=t.compareDocumentPosition(n);if(r&4)return-1;if(r&2)return 1}return 0})}};var Wt=class extends E{evaluate(e){return[]}toString(){return"empty-sequence()"}};var qt=class extends E{constructor(e){super(),this.expression=e}evaluate(e){return this.expression.evaluate(e)}test(e){let t=this.evaluate(e);return typeof t=="number"?t===(e==null?void 0:e.position):this.toBoolean(t)}toBoolean(e){return typeof e=="boolean"?e:typeof e=="number"?e!==0&&!isNaN(e):typeof e=="string"||Array.isArray(e)?e.length>0:!!e}};var Ce=class{constructor(){this.elementId=0}convert(e,t){if(e==null)return null;typeof e!="string"&&(e=String(e));let n=e.trim();if(n==="")return null;try{let r=JSON.parse(n);return this.createDocumentNode(r,t)}catch(r){if(t!=null&&t.fallback&&typeof t.fallback=="function")try{let i=t.fallback(n);return this.createDocumentNode(i,t)}catch(i){return null}return t!=null&&t.liberal?this.liberalParse(n,t):null}}createDocumentNode(e,t){this.elementId=0;let n=this.valueToElement(e,"root",t),r={nodeType:be.DOCUMENT_NODE,nodeName:"#document",localName:"#document",childNodes:[n],documentElement:n};return n.ownerDocument=r,r}valueToElement(e,t,n,r){let i={nodeType:be.ELEMENT_NODE,nodeName:t,localName:t,childNodes:[],attributes:[]};if(e==null)return i;if(typeof e=="object"&&!Array.isArray(e)){let o=[],a=new Set;for(let c in e)if(Object.prototype.hasOwnProperty.call(e,c)){if(a.has(c)){if((n==null?void 0:n.duplicates)==="reject")throw new Error(`Duplicate key: ${c}`);if((n==null?void 0:n.duplicates)==="use-first")continue}a.add(c);let u=this.sanitizeElementName(c),l=this.valueToElement(e[c],u,n,i);o.push(l)}i.childNodes=o}else if(Array.isArray(e)){let o=e.map((a,c)=>this.valueToElement(a,"item",n,i));i.childNodes=o}else if(typeof e=="string"){let o={nodeType:be.TEXT_NODE,nodeName:"#text",localName:"#text",textContent:e};i.childNodes=[o],i.textContent=e}else if(typeof e=="number"){let o=String(e),a={nodeType:be.TEXT_NODE,nodeName:"#text",localName:"#text",textContent:o};i.childNodes=[a],i.textContent=o}else if(typeof e=="boolean"){let o=e?"true":"false",a={nodeType:be.TEXT_NODE,nodeName:"#text",localName:"#text",textContent:o};i.childNodes=[a],i.textContent=o}return i}sanitizeElementName(e){if(/^[a-zA-Z_][\w.-]*$/.test(e))return e;let t=e.replace(/[^a-zA-Z0-9_.-]/g,"_");return/^[a-zA-Z_]/.test(t)||(t="_"+t),(!t||t==="_")&&(t="item"),t}liberalParse(e,t){try{let n=e.replace(/,(\s*[}\]])/g,"$1");n=n.replace(/'/g,'"');let r=JSON.parse(n);return this.createDocumentNode(r,t)}catch(n){return null}}};var Bt=class extends E{constructor(t,n){super();this.jsonConverter=new Ce;this.name=t,this.args=n}evaluate(t){var i,o;let n=this.args.map(a=>a.evaluate(t)),r=this.getConstructorType();if(r){if(n.length!==1)throw zn(this.name,"1",n.length);let a=n[0];if(Array.isArray(a)){if(a.length===0)throw Ot("single item","empty sequence",`constructor function ${this.name}`);if(a.length!==1)throw Ot("single item",`sequence of ${a.length} items`,`constructor function ${this.name}`);return this.castConstructorValue(r,a[0])}if(a==null)throw Ot("single item","empty sequence",`constructor function ${this.name}`);return this.castConstructorValue(r,a)}switch(this.name){case"last":return(i=t.size)!=null?i:0;case"position":return(o=t.position)!=null?o:0;case"count":return Array.isArray(n[0])?n[0].length:0;case"local-name":return this.localName(n,t);case"namespace-uri":return this.namespaceUri(n,t);case"name":return this.nodeName(n,t);case"string":return this.stringValue(n,t);case"concat":return n.map(a=>this.convertToString(a)).join("");case"starts-with":return String(n[0]).startsWith(String(n[1]));case"contains":return String(n[0]).includes(String(n[1]));case"substring-before":return this.substringBefore(n);case"substring-after":return this.substringAfter(n);case"substring":return this.substring(n);case"string-length":return this.stringLength(n,t);case"normalize-space":return this.normalizeSpace(n,t);case"translate":return this.translate(n);case"boolean":return this.toBoolean(n[0]);case"not":return!this.toBoolean(n[0]);case"true":return!0;case"false":return!1;case"lang":return this.lang(n,t);case"number":return this.toNumber(n,t);case"sum":return this.sum(n);case"floor":return Math.floor(Number(n[0]));case"ceiling":return Math.ceil(Number(n[0]));case"round":return Math.round(Number(n[0]));case"json-to-xml":return this.jsonToXml(n,t);default:if(t.functions&&typeof t.functions[this.name]=="function")return t.functions[this.name](t,...n);throw Ie(this.name,"function")}}getConstructorType(){if(!this.name.includes(":"))return;let[,t]=this.name.split(":");if(t)return Me(t)}castConstructorValue(t,n){try{return t.cast(n)}catch(r){throw jn(n,this.name)}}toBoolean(t){return typeof t=="boolean"?t:typeof t=="number"?t!==0&&!isNaN(t):typeof t=="string"||Array.isArray(t)?t.length>0:!!t}toNumber(t,n){return t.length===0?Number(this.stringValue([],n)):Number(t[0])}stringValue(t,n){var i,o,a,c;if(t.length===0)return(o=(i=n.node)==null?void 0:i.textContent)!=null?o:"";let r=t[0];return Array.isArray(r)&&r.length>0?(c=(a=r[0])==null?void 0:a.textContent)!=null?c:String(r[0]):String(r)}convertToString(t){var n;if(Array.isArray(t)){if(t.length===0)return"";let r=t[0];return(n=r==null?void 0:r.textContent)!=null?n:String(r)}return String(t)}stringLength(t,n){return t.length===0?this.stringValue([],n).length:String(t[0]).length}normalizeSpace(t,n){return(t.length===0?this.stringValue([],n):String(t[0])).trim().replace(/\s+/g," ")}substringBefore(t){let n=String(t[0]),r=String(t[1]),i=n.indexOf(r);return i===-1?"":n.substring(0,i)}substringAfter(t){let n=String(t[0]),r=String(t[1]),i=n.indexOf(r);return i===-1?"":n.substring(i+r.length)}substring(t){let n=String(t[0]),r=Math.round(Number(t[1]))-1;if(t.length===2)return n.substring(Math.max(0,r));let i=Math.round(Number(t[2])),o=Math.max(0,r),a=Math.min(i-(o-r),n.length-o);return n.substring(o,o+a)}translate(t){let n=String(t[0]),r=String(t[1]),i=String(t[2]),o="";for(let a of n){let c=r.indexOf(a);c===-1?o+=a:c<i.length&&(o+=i[c])}return o}localName(t,n){var i;let r=this.getNodeArg(t,n);return(i=r==null?void 0:r.localName)!=null?i:""}namespaceUri(t,n){var i;let r=this.getNodeArg(t,n);return(i=r==null?void 0:r.namespaceUri)!=null?i:""}nodeName(t,n){var i;let r=this.getNodeArg(t,n);return(i=r==null?void 0:r.nodeName)!=null?i:""}getNodeArg(t,n){return t.length>0&&Array.isArray(t[0])&&t[0].length>0?t[0][0]:n.node}sum(t){let n=t[0];return Array.isArray(n)?n.reduce((r,i)=>{var a;let o=Number((a=i==null?void 0:i.textContent)!=null?a:i);return r+(isNaN(o)?0:o)},0):0}lang(t,n){var o,a;let r=String(t[0]).toLowerCase(),i=n.node;for(;i;){let c=((o=i.getAttribute)==null?void 0:o.call(i,"xml:lang"))||((a=i.getAttribute)==null?void 0:a.call(i,"lang"));if(c){let u=c.toLowerCase();return u===r||u.startsWith(r+"-")}i=i.parentNode}return!1}jsonToXml(t,n){if(n.xsltVersion&&n.xsltVersion!=="3.0")throw new Error('json-to-xml() is only supported in XSLT 3.0. Use version="3.0" in your stylesheet.');let r=t.length>0?String(t[0]):null,i;t.length>1&&typeof t[1]=="object"&&t[1]!==null&&(i=this.mapToOptions(t[1]));let o=this.jsonConverter.convert(r,i);return o?[o]:[]}mapToOptions(t){let n={};if(t.liberal!==void 0&&(n.liberal=!!t.liberal),t.duplicates!==void 0){let r=String(t.duplicates).toLowerCase();(r==="reject"||r==="use-first"||r==="retain")&&(n.duplicates=r)}return t.validate!==void 0&&(n.validate=!!t.validate),t.escape!==void 0&&(n.escape=!!t.escape),t.fallback!==void 0&&typeof t.fallback=="function"&&(n.fallback=t.fallback),n}};var li=(s,e)=>(new Set(s).has(e)||s.push(e),Array.from(new Set(s)));function rr(s){var r,i,o,a,c,u,l,h,p,f;let e=s!=null&&s.reservedFunctionNames?new Set(s.reservedFunctionNames):new Set(qn),t=(r=s==null?void 0:s.defaultCollation)!=null?r:an,n=li((i=s==null?void 0:s.collations)!=null?i:[an],t);return{schemaTypes:(o=s==null?void 0:s.schemaTypes)!=null?o:{},elementDeclarations:(a=s==null?void 0:s.elementDeclarations)!=null?a:{},attributeDeclarations:(c=s==null?void 0:s.attributeDeclarations)!=null?c:{},defaultElementNamespace:(u=s==null?void 0:s.defaultElementNamespace)!=null?u:"",defaultTypeNamespace:(l=s==null?void 0:s.defaultTypeNamespace)!=null?l:b,functionSignatures:(h=s==null?void 0:s.functionSignatures)!=null?h:{},defaultFunctionNamespace:(p=s==null?void 0:s.defaultFunctionNamespace)!=null?p:Wn,reservedFunctionNames:e,collations:n,defaultCollation:t,variableTypes:(f=s==null?void 0:s.variableTypes)!=null?f:{},contextItemType:s==null?void 0:s.contextItemType}}function ir(s){let e=[],t=new Set;for(let n of s.functions)t.has(n.name)&&e.push(`Duplicate function name: ${n.name}`),t.add(n.name),n.minArgs<0&&e.push(`Function ${n.name}: minArgs cannot be negative`),n.maxArgs!==void 0&&n.maxArgs<n.minArgs&&e.push(`Function ${n.name}: maxArgs cannot be less than minArgs`),typeof n.implementation!="function"&&e.push(`Function ${n.name}: implementation must be a function`);return e}var sr={XPWD0001:{code:"XPWD0001",severity:"deprecation",category:"deprecation",title:"Namespace axis deprecated",description:"The namespace axis (namespace::) is deprecated in XPath 2.0 and may not be supported in all implementations. Consider using fn:namespace-uri-for-prefix() or fn:in-scope-prefixes() instead.",migration:"Replace namespace::* with fn:in-scope-prefixes(.) to get namespace prefixes, or use fn:namespace-uri-for-prefix($prefix, .) to get namespace URIs.",specReference:"XPath 2.0 Section 3.2.1.1"},XPWD0002:{code:"XPWD0002",severity:"deprecation",category:"deprecation",title:"Implicit string conversion",description:"Implicit conversion of node-sets to strings using the first node is deprecated. In XPath 2.0, this requires explicit conversion using fn:string() or data().",migration:"Use fn:string($nodeset) or fn:data($nodeset) for explicit conversion.",specReference:"XPath 2.0 Appendix I.2"},XPWC0001:{code:"XPWC0001",severity:"warning",category:"compatibility",title:"XPath 1.0 compatibility mode active",description:"XPath 1.0 compatibility mode is enabled. Some XPath 2.0 type safety features are relaxed to maintain backward compatibility.",migration:"Consider migrating to XPath 2.0 semantics for improved type safety.",specReference:"XPath 2.0 Section 3.6"},XPWC0002:{code:"XPWC0002",severity:"warning",category:"compatibility",title:"String comparison in XPath 2.0",description:"String comparisons in XPath 2.0 are performed using Unicode codepoint collation by default, which may produce different results than XPath 1.0.",migration:"Use explicit collation specification if locale-specific comparison is needed.",specReference:"XPath 2.0 Appendix I.4"},XPWC0003:{code:"XPWC0003",severity:"warning",category:"compatibility",title:"Empty sequence handling differs",description:"In XPath 2.0, operations on empty sequences may return empty sequences instead of NaN or false as in XPath 1.0.",migration:"Use explicit empty sequence handling with fn:empty() or default values.",specReference:"XPath 2.0 Appendix I.3"},XPWT0001:{code:"XPWT0001",severity:"warning",category:"type-coercion",title:"Implicit numeric conversion",description:"Value is being implicitly converted to a number. In XPath 2.0, this requires explicit conversion in strict mode.",migration:"Use xs:decimal(), xs:double(), or number() for explicit conversion.",specReference:"XPath 2.0 Appendix I.2"},XPWT0002:{code:"XPWT0002",severity:"warning",category:"type-coercion",title:"Implicit boolean conversion",description:"Value is being implicitly converted to boolean using XPath 1.0 rules. In XPath 2.0, this is called Effective Boolean Value (EBV).",migration:"Use fn:boolean() for explicit conversion.",specReference:"XPath 2.0 Section 2.4.3"},XPWT0003:{code:"XPWT0003",severity:"info",category:"type-coercion",title:"Numeric type promotion",description:"Numeric value is being promoted in the type hierarchy (integer \u2192 decimal \u2192 float \u2192 double). This may result in precision loss.",migration:"Consider using explicit casting if precision is important.",specReference:"XPath 2.0 Appendix B.1"},XPWB0001:{code:"XPWB0001",severity:"warning",category:"behavior-change",title:"Arithmetic with empty sequence",description:"In XPath 2.0, arithmetic operations with empty sequences return empty sequences, not NaN as in XPath 1.0.",migration:"Handle empty sequences explicitly before arithmetic operations.",specReference:"XPath 2.0 Appendix I.3"},XPWB0002:{code:"XPWB0002",severity:"warning",category:"behavior-change",title:"Comparison with empty sequence",description:"In XPath 2.0, value comparisons (eq, ne, etc.) with empty sequences return empty sequences, not false.",migration:"Use fn:empty() or fn:exists() to check for empty sequences before comparison.",specReference:"XPath 2.0 Appendix I.3"},XPWB0003:{code:"XPWB0003",severity:"warning",category:"behavior-change",title:"Multiple values in singleton context",description:"A sequence with multiple items is being used where a single item is expected. In XPath 2.0, this may raise a type error.",migration:"Use predicates or fn:head() to select a single item.",specReference:"XPath 2.0 Section 2.4.4"},XPWB0004:{code:"XPWB0004",severity:"warning",category:"behavior-change",title:"String value of nodes",description:"The string value of typed nodes in XPath 2.0 may differ from XPath 1.0 when schema type information is present.",migration:"Use fn:string() for consistent string conversion.",specReference:"XPath 2.0 Appendix I.1"},XPWP0001:{code:"XPWP0001",severity:"info",category:"performance",title:"Descendant axis on large document",description:"Using descendant or descendant-or-self axis on large documents may impact performance. Consider using more specific path expressions.",migration:"Use more specific paths or indexes if available."},XPWP0002:{code:"XPWP0002",severity:"info",category:"performance",title:"General comparison on sequences",description:"General comparisons (=, !=, etc.) on sequences perform existential quantification, which may be slower than value comparisons on single items.",migration:"Use value comparisons (eq, ne, etc.) when comparing single values.",specReference:"XPath 2.0 Section 3.5.2"}},pi={enabled:!0,minSeverity:"info",suppressCategories:[],suppressCodes:[],handler:()=>{},logToConsole:!1,maxWarnings:100,emitOnce:!0},or={info:0,warning:1,deprecation:2},pn=class{constructor(e){this.warnings=[];this.emittedCodes=new Set;this.config=D(D({},pi),e)}emit(e,t,n){if(!this.config.enabled)return;let r=sr[e];if(!r){this.addWarning({code:e,message:`Unknown warning: ${e}`,severity:"warning",category:"compatibility",context:t,expression:n});return}if(this.config.suppressCodes.includes(e)||this.config.suppressCategories.includes(r.category)||or[r.severity]<or[this.config.minSeverity]||this.config.emitOnce&&this.emittedCodes.has(e)||this.warnings.length>=this.config.maxWarnings)return;let i={code:r.code,message:r.description,severity:r.severity,category:r.category,context:t,expression:n};this.addWarning(i),this.emittedCodes.add(e)}emitCustom(e){this.config.enabled&&(this.warnings.length>=this.config.maxWarnings||this.config.emitOnce&&this.emittedCodes.has(e.code)||(this.addWarning(e),this.emittedCodes.add(e.code)))}addWarning(e){if(this.warnings.push(e),this.config.handler&&this.config.handler(e),this.config.logToConsole){let t=e.severity==="deprecation"?"[DEPRECATED]":e.severity==="warning"?"[WARNING]":"[INFO]";console.warn(`${t} ${e.code}: ${e.message}`)}}getWarnings(){return this.warnings}getWarningsBySeverity(e){return this.warnings.filter(t=>t.severity===e)}getWarningsByCategory(e){return this.warnings.filter(t=>t.category===e)}hasWarnings(){return this.warnings.length>0}count(){return this.warnings.length}clear(){this.warnings=[],this.emittedCodes.clear()}formatReport(){if(this.warnings.length===0)return"No warnings.";let e=[];e.push(`XPath Warnings Report (${this.warnings.length} warning${this.warnings.length===1?"":"s"}):`),e.push("");let t={};for(let n of this.warnings){let r=n.category;t[r]||(t[r]=[]),t[r].push(n)}for(let n of Object.keys(t)){let r=t[n];e.push(`## ${hi(n)}`);for(let i of r){let o=sr[i.code];e.push(` ${i.code}: ${(o==null?void 0:o.title)||i.message}`),i.context&&e.push(` Context: ${i.context}`),o!=null&&o.migration&&e.push(` Migration: ${o.migration}`)}e.push("")}return e.join(`
4
+ `)}};function hi(s){switch(s){case"deprecation":return"Deprecated Features";case"compatibility":return"Compatibility Issues";case"performance":return"Performance Considerations";case"type-coercion":return"Type Coercion";case"behavior-change":return"Behavior Changes";default:return s}}function hn(s){return new pn(s)}var it=class{constructor(e){this.tokens=[];this.current=0;var t,n,r,i;if(this.options={strict:(t=e==null?void 0:e.strict)!=null?t:!0,version:e==null?void 0:e.version,cache:e==null?void 0:e.cache,extensions:e==null?void 0:e.extensions,enableNamespaceAxis:(n=e==null?void 0:e.enableNamespaceAxis)!=null?n:!1,staticContext:(r=e==null?void 0:e.staticContext)!=null?r:rr(),xpath10CompatibilityMode:(i=e==null?void 0:e.xpath10CompatibilityMode)!=null?i:!1,warningConfig:e==null?void 0:e.warningConfig,warningCollector:e==null?void 0:e.warningCollector},this.staticContext=this.options.staticContext,this.options.warningCollector?this.warningCollector=this.options.warningCollector:this.options.warningConfig?this.warningCollector=hn(this.options.warningConfig):this.warningCollector=hn({logToConsole:!1}),this.options.extensions){let o=ir(this.options.extensions);if(o.length>0)throw new Error(`Invalid XSLT extensions: ${o.join(", ")}`);this.extensions=this.options.extensions}}getWarningCollector(){return this.warningCollector}ensureVersionSupport(e,t){var r;let n=(r=this.options.version)!=null?r:t;if(this.options.version=n,this.options.strict!==!1&&!e.includes(n))throw new Error(`XPath version ${n} is not supported by ${this.constructor.name}. Supported versions: ${e.join(", ")}`)}getOptions(){return this.options}parse(e){if(this.tokens=e,this.current=0,this.options.xpath10CompatibilityMode&&this.options.version&&this.options.version!=="1.0"&&this.warningCollector.emit("XPWC0001",`XPath ${this.options.version} with compatibility mode`,e.map(n=>n.lexeme).join("")),e.length===0)throw me("Empty expression");let t=this.parseExpr();if(!this.isAtEnd())throw me(`Unexpected token: ${this.peek().lexeme}`);return t}peek(){return this.tokens[this.current]}peekNext(){return this.tokens[this.current+1]}previous(){return this.tokens[this.current-1]}isAtEnd(){return this.current>=this.tokens.length}advance(){return this.isAtEnd()||this.current++,this.previous()}check(e){return this.isAtEnd()?!1:this.peek().type===e}checkLexeme(e){return this.isAtEnd()?!1:this.peek().lexeme===e}match(...e){for(let t of e)if(this.check(t))return this.advance(),!0;return!1}consume(e,t){var n,r;if(this.check(e))return this.advance();throw me(`${t}. Got: ${(r=(n=this.peek())==null?void 0:n.lexeme)!=null?r:"EOF"}`)}parseExpr(){return this.parseOrExpr()}parseOrExpr(){let e=this.parseAndExpr();for(;this.check("OPERATOR")&&this.peek().lexeme==="or";){this.advance();let t=this.parseAndExpr();e=new _e(e,t,"or")}return e}parseAndExpr(){let e=this.parseEqualityExpr();for(;this.check("OPERATOR")&&this.peek().lexeme==="and";){this.advance();let t=this.parseEqualityExpr();e=new _e(e,t,"and")}return e}parseEqualityExpr(){let e=this.parseRelationalExpr();for(;this.match("EQUALS","NOT_EQUALS");){let t=this.previous().lexeme,n=this.parseRelationalExpr();e=new De(e,n,t)}return e}parseRelationalExpr(){let e=this.parseAdditiveExpr();for(;this.match("LESS_THAN","GREATER_THAN","LESS_THAN_OR_EQUAL","GREATER_THAN_OR_EQUAL");){let t=this.previous().lexeme,n=this.parseAdditiveExpr();e=new De(e,n,t)}return e}parseAdditiveExpr(){let e=this.parseMultiplicativeExpr();for(;this.match("PLUS","MINUS");){let t=this.previous().lexeme,n=this.parseMultiplicativeExpr();e=new Xe(e,n,t)}return e}parseMultiplicativeExpr(){let e=this.parseUnaryExpr();for(;;)if(this.match("ASTERISK")){let t=this.parseUnaryExpr();e=new Xe(e,t,"*")}else if(this.check("OPERATOR")&&(this.peek().lexeme==="div"||this.peek().lexeme==="mod")){let t=this.advance().lexeme,n=this.parseUnaryExpr();e=new Xe(e,n,t)}else break;return e}parseUnaryExpr(){if(this.match("MINUS")){let e=this.parseUnaryExpr();return new Dt("-",e)}return this.parseUnionExpr()}parseUnionExpr(){let e=this.parsePathExpr();for(;this.match("PIPE");){let t=this.parsePathExpr();e=new fe(e,t)}return e}parsePathExpr(){if(this.check("SLASH")||this.check("DOUBLE_SLASH"))return this.parseLocationPath();if(this.isStepStart())return this.parseLocationPath();let e=this.parseFilterExpr();if(this.match("SLASH","DOUBLE_SLASH")){let t=this.previous().type==="DOUBLE_SLASH",n=this.parseRelativeLocationPath();t&&n.unshift(new K("descendant-or-self",{type:"node-type",nodeType:"node"}));let r=new se(n,!1);return new It(e,r)}return e}isStepStart(){if(this.isAtEnd())return!1;let e=this.peek(),t=this.peekNext(),n=["element","attribute","schema-element","schema-attribute","document-node","node","text","comment","processing-instruction"];if((e.type==="IDENTIFIER"||e.type==="NODE_TYPE")&&(t==null?void 0:t.type)==="OPEN_PAREN"&&n.includes(e.lexeme.toLowerCase()))return!0;if(this.isFunctionCallStart())return!1;if(e.type==="DOT"||e.type==="DOT_DOT"||e.type==="AT"||e.type==="LOCATION"||e.type==="NODE_TYPE"||e.type==="ASTERISK")return!0;if(e.type==="IDENTIFIER"||e.type==="OPERATOR"||e.type==="FUNCTION"){let r=this.peekNext();return!r||r.type!=="OPEN_PAREN"}return!1}parseLocationPath(){let e=!1,t=[];return this.match("SLASH")?(e=!0,!this.isAtEnd()&&this.isStepStart()&&t.push(...this.parseRelativeLocationPath())):this.match("DOUBLE_SLASH")?(e=!0,t.push(new K("descendant-or-self",{type:"node-type",nodeType:"node"})),t.push(...this.parseRelativeLocationPath())):t.push(...this.parseRelativeLocationPath()),new se(t,e)}parseRelativeLocationPath(){let e=[];for(e.push(this.parseStep());this.match("SLASH","DOUBLE_SLASH");)this.previous().type==="DOUBLE_SLASH"&&e.push(new K("descendant-or-self",{type:"node-type",nodeType:"node"})),e.push(this.parseStep());return e}parseStep(){if(this.match("DOT"))return new K("self",{type:"node-type",nodeType:"node"});if(this.match("DOT_DOT"))return new K("parent",{type:"node-type",nodeType:"node"});let e="child";if(this.match("AT"))e="attribute";else if(this.check("LOCATION")){let r=this.peekNext();r&&r.type==="COLON_COLON"&&(e=this.advance().lexeme,this.advance())}if(e==="namespace"){if(!this.options.enableNamespaceAxis)throw Bn("namespace");this.warnNamespaceAxis()}let t=this.parseNodeTest(),n=this.parsePredicates();return new K(e,t,n)}parseNodeTest(){var e,t;if(this.match("ASTERISK"))return{type:"wildcard"};if(this.check("NODE_TYPE")||this.check("IDENTIFIER")||this.check("LOCATION")||this.check("FUNCTION")||this.check("OPERATOR")){let n=this.peekNext();if(n&&n.type==="OPEN_PAREN"){let r=this.advance().lexeme.toLowerCase();if(this.advance(),r==="element")return this.parseElementTest();if(r==="attribute")return this.parseAttributeTest();if(r==="document-node")return this.parseDocumentNodeTest();if(r==="schema-element"){let i=this.parseNameOrWildcard();return this.consume("CLOSE_PAREN","Expected ')' after schema-element name"),{type:"schema-element",name:i}}if(r==="schema-attribute"){let i=this.parseNameOrWildcard();return this.consume("CLOSE_PAREN","Expected ')' after schema-attribute name"),{type:"schema-attribute",name:i}}if(r==="node"||r==="text"||r==="comment"||r==="processing-instruction"){if(r==="processing-instruction"&&this.check("STRING")){let i=this.advance().lexeme;return this.consume("CLOSE_PAREN","Expected ')' after processing-instruction target"),{type:"processing-instruction",target:i}}return this.consume("CLOSE_PAREN","Expected ')' after node type"),{type:"node-type",nodeType:r}}}}if(this.check("IDENTIFIER")||this.check("LOCATION")||this.check("FUNCTION")||this.check("NODE_TYPE")||this.check("OPERATOR")){let n=this.advance().lexeme;if(this.match("COLON")){if(this.match("ASTERISK"))return{type:"wildcard",name:`${n}:*`};if(this.check("IDENTIFIER")||this.check("LOCATION")||this.check("FUNCTION")||this.check("NODE_TYPE")||this.check("OPERATOR")){let r=this.advance().lexeme;return{type:"name",name:`${n}:${r}`}}throw new Error("Expected local name after namespace prefix")}return{type:"name",name:n}}throw me(`Expected node test, got: ${(t=(e=this.peek())==null?void 0:e.lexeme)!=null?t:"EOF"}`)}parsePredicates(){let e=[];for(;this.match("OPEN_SQUARE_BRACKET");){let t=this.parseExpr();this.consume("CLOSE_SQUARE_BRACKET","Expected ']' after predicate"),e.push(new qt(t))}return e}parseFilterExpr(){let e=this.parsePrimaryExpr(),t=[];for(;this.check("OPEN_SQUARE_BRACKET");)t.push(...this.parsePredicates());return t.length>0?new Rt(e,t):e}parsePrimaryExpr(){var e,t;if(this.match("DOLLAR")){let n=this.consume("IDENTIFIER","Expected variable name after $").lexeme;return new vt(n)}if(this.match("OPEN_PAREN")){if(this.check("CLOSE_PAREN"))return this.advance(),new Wt;let n=this.parseExpr();return this.consume("CLOSE_PAREN","Expected ')' after expression"),n}if(this.check("STRING")){let n=this.advance().lexeme;return new Ct(n)}if(this.check("NUMBER")){let n=parseFloat(this.advance().lexeme);return new St(n)}if(this.isFunctionCallStart())return this.parseFunctionCall();throw me(`Unexpected token in primary expression: ${(t=(e=this.peek())==null?void 0:e.lexeme)!=null?t:"EOF"}`)}parseFunctionCall(){let e=this.advance().lexeme;if(this.match("COLON")){let n=this.advance();if(!this.isNcNameToken(n.type))throw me("Expected local name after namespace prefix");e=`${e}:${n.lexeme}`}this.consume("OPEN_PAREN","Expected '(' after function name");let t=[];if(!this.check("CLOSE_PAREN"))do t.push(this.parseExpr());while(this.match("COMMA"));return this.consume("CLOSE_PAREN","Expected ')' after function arguments"),new Bt(e,t)}isFunctionCallStart(){var i,o,a;if(this.isAtEnd())return!1;let e=this.peek(),t=this.peekNext(),r=["element","attribute","schema-element","schema-attribute","document-node","node","text","comment","processing-instruction"].includes((a=(o=(i=e.lexeme)==null?void 0:i.toLowerCase)==null?void 0:o.call(i))!=null?a:"");if(this.isFunctionNameToken(e.type)&&(t==null?void 0:t.type)==="OPEN_PAREN")return!r;if(this.isFunctionNameToken(e.type)&&(t==null?void 0:t.type)==="COLON"){let c=this.tokens[this.current+2],u=this.tokens[this.current+3];if(c&&this.isFunctionNameToken(c.type)&&(u==null?void 0:u.type)==="OPEN_PAREN")return!0}return!1}warnNamespaceAxis(){this.warningCollector.emit("XPWD0001","namespace:: axis",this.tokens.map(e=>e.lexeme).join(""))}isFunctionNameToken(e){return e==="IDENTIFIER"||e==="FUNCTION"||e==="OPERATOR"||e==="LOCATION"}isNcNameToken(e){return e==="IDENTIFIER"||e==="FUNCTION"||e==="OPERATOR"||e==="LOCATION"||e==="NODE_TYPE"}parseNameOrWildcard(){let e="";if(this.match("ASTERISK"))return"*";if((this.check("IDENTIFIER")||this.check("NODE_TYPE")||this.check("FUNCTION")||this.check("LOCATION")||this.check("OPERATOR"))&&(e=this.advance().lexeme,this.match("COLON"))){if(this.match("ASTERISK"))return`${e}:*`;(this.check("IDENTIFIER")||this.check("NODE_TYPE")||this.check("FUNCTION")||this.check("LOCATION")||this.check("OPERATOR"))&&(e+=":"+this.advance().lexeme)}return e}parseElementTest(){if(this.check("CLOSE_PAREN"))return this.advance(),{type:"element"};let e=this.parseNameOrWildcard(),t;return this.match("COMMA")&&(this.check("IDENTIFIER")||this.check("NODE_TYPE")||this.check("FUNCTION")||this.check("LOCATION"))&&(t=this.parseNameOrWildcard()),this.consume("CLOSE_PAREN","Expected ')' after element test"),{type:"element",name:e==="*"?void 0:e,elementType:t,isWildcardName:e==="*"}}parseAttributeTest(){if(this.check("CLOSE_PAREN"))return this.advance(),{type:"attribute"};let e=this.parseNameOrWildcard(),t;return this.match("COMMA")&&(this.check("IDENTIFIER")||this.check("NODE_TYPE")||this.check("FUNCTION")||this.check("LOCATION"))&&(t=this.parseNameOrWildcard()),this.consume("CLOSE_PAREN","Expected ')' after attribute test"),{type:"attribute",name:e==="*"?void 0:e,elementType:t,isWildcardName:e==="*"}}parseDocumentNodeTest(){if(this.check("CLOSE_PAREN"))return this.advance(),{type:"document-node"};let e=this.parseNodeTest();return this.consume("CLOSE_PAREN","Expected ')' after document-node test"),{type:"document-node",elementTest:e}}};var Se=class extends it{constructor(e){super(e),this.ensureVersionSupport(["1.0"],"1.0")}};function zt(s,e){return D({node:s,position:1,size:1},e)}var z=class{constructor(e){this.value=e,this.type="string"}stringValue(){return String(this.value)}booleanValue(){return this.value.length>0}numberValue(){return this.value-0}nodeSetValue(){throw this}};var J=class{constructor(e){this.value=e,this.type="number"}stringValue(){return`${this.value}`}booleanValue(){return!!this.value}numberValue(){return this.value-0}nodeSetValue(){throw this}};var C=class{constructor(e){this.value=e,this.type="boolean"}stringValue(){return`${this.value}`}booleanValue(){return this.value}numberValue(){return this.value?1:0}nodeSetValue(){throw this}};Ee();var q=class{constructor(e){this.value=e,this.type="node-set"}stringValue(){return this.value.length===0?"":Q(this.value[0])}booleanValue(){return this.value.length>0}numberValue(){return parseInt(this.stringValue())-0}nodeSetValue(){return this.value}};var we=class{constructor(e,t){this.xpathExpression=e,this.nodeConverter=t,e instanceof se&&(this.absolute=e.absolute,this.steps=e.steps.map((n,r)=>({axis:n.axis,nodeTest:n.nodeTest,predicates:n.predicates,hasPositionalPredicate:!1,predicate:n.predicates||[],evaluate:i=>{let o=this.nodeConverter.exprContextToXPathContext(i),a=n.evaluate(o);return this.nodeConverter.wrapResult(a,i)}})))}evaluate(e){let t=this.nodeConverter.exprContextToXPathContext(e),n=this.xpathExpression.evaluate(t);return this.nodeConverter.wrapResult(n,e)}},oe=class extends we{constructor(e,t){super(e,t),this.absolute=e.absolute,this.steps=e.steps.map(n=>({axis:n.axis,nodeTest:n.nodeTest,predicates:n.predicates||[],predicate:n.predicates||[],hasPositionalPredicate:this.hasPositionalPredicate(n.predicates||[])}))}hasPositionalPredicate(e){return!1}appendStep(e){this.steps.push(e)}prependStep(e){this.steps.unshift(e)}},ae=class extends we{constructor(e,t,n,r){super(e,t),this.expr1=n,this.expr2=r}},dn=class{exprContextToXPathContext(e){let t=e.nodeList[e.position],n=this.adaptXNode(t),r=e.nodeList.map(i=>this.adaptXNode(i));return zt(n,{position:e.position+1,size:e.nodeList.length,nodeList:r,variables:this.convertVariables(e),functions:this.createCustomFunctions(e),namespaces:e.knownNamespaces,xsltVersion:e.xsltVersion})}adaptXNode(e){if(!e)return null;let t=e;return"textContent"in t||Object.defineProperty(t,"textContent",{get(){return this._getTextContent()},enumerable:!0,configurable:!0}),"_getTextContent"in t||(t._getTextContent=function(){if(this.nodeType===3||this.nodeType===2)return this.nodeValue||"";if(!this.childNodes)return"";let n="";for(let r of this.childNodes)r.nodeType===3?n+=r.nodeValue||"":r.nodeType===1&&(n+=this._getTextContent.call(r));return n}),"attributes"in t||Object.defineProperty(t,"attributes",{get(){return this.childNodes?this.childNodes.filter(n=>n.nodeType===2):[]},enumerable:!0,configurable:!0}),"getAttribute"in t||(t.getAttribute=function(n){return this.getAttributeValue?this.getAttributeValue(n):null}),t}xPathNodeToXNode(e){return e?e instanceof R?e:this.convertXPathNodeToXNode(e):null}getTextContent(e){if(e.nodeType===3||e.nodeType===2)return e.nodeValue||"";if(!e.childNodes)return"";let t="";for(let n of e.childNodes)n.nodeType===3?t+=n.nodeValue||"":n.nodeType===1&&(t+=this.getTextContent(n));return t}convertVariables(e){let t={};for(let[n,r]of Object.entries(e.variables||{}))if(r&&typeof r=="object"&&"stringValue"in r){let i=r;i.type==="node-set"?t[n]=r.nodeSetValue().map(o=>this.adaptXNode(o)):i.type==="string"?t[n]=r.stringValue():i.type==="number"?t[n]=r.numberValue():i.type==="boolean"?t[n]=r.booleanValue():t[n]=r.stringValue()}else t[n]=r;return t}createCustomFunctions(e){let t={};return t.key=(n,r,i)=>{var a;let o=(a=e.keys)==null?void 0:a[r];return o&&o[i]?o[i].nodeSetValue().map(u=>this.adaptXNode(u)):[]},t.current=n=>{let r=e.nodeList[e.position];return[this.adaptXNode(r)]},t["format-number"]=(n,r,i,o)=>{let a=e.decimalFormatSettings;return r.toLocaleString()},t["xml-to-json"]=(n,r)=>{if(e.xsltVersion!=="3.0")throw new Error('xml-to-json() is only supported in XSLT 3.0. Use version="3.0" in your stylesheet.');let i=Array.isArray(r)?r[0]:r;return i?this.xmlToJson(i):'""'},t["json-to-xml"]=(n,r)=>{if(e.xsltVersion!=="3.0")throw new Error('json-to-xml() is only supported in XSLT 3.0. Use version="3.0" in your stylesheet.');let i=Array.isArray(r)?r[0]:r;if(!i)return[];let a=new Ce().convert(String(i));if(!a)return null;let c=e.nodeList&&e.nodeList.length>0?e.nodeList[0].ownerDocument:null,u=this.convertXPathNodeToXNode(a,c);return u?[u]:[]},t["system-property"]=(n,r)=>{let i=String(r),o={"xsl:version":e.xsltVersion||"1.0","xsl:vendor":"Design Liquido","xsl:vendor-url":"https://github.com/DesignLiquido/xslt-processor"};return e.systemProperties&&e.systemProperties[i]?e.systemProperties[i]:o[i]||""},t["element-available"]=(n,r)=>{let i=String(r),o=["xsl:apply-imports","xsl:apply-templates","xsl:attribute","xsl:attribute-set","xsl:call-template","xsl:choose","xsl:comment","xsl:copy","xsl:copy-of","xsl:decimal-format","xsl:element","xsl:fallback","xsl:for-each","xsl:if","xsl:import","xsl:include","xsl:key","xsl:message","xsl:namespace-alias","xsl:number","xsl:otherwise","xsl:output","xsl:param","xsl:preserve-space","xsl:processing-instruction","xsl:sort","xsl:strip-space","xsl:stylesheet","xsl:template","xsl:text","xsl:transform","xsl:value-of","xsl:variable","xsl:when","xsl:with-param"],a=i.startsWith("xsl:")?i:`xsl:${i}`;return o.includes(a)||o.includes(i)},t["function-available"]=(n,r)=>{let i=String(r),o=["boolean","ceiling","concat","contains","count","false","floor","id","lang","last","local-name","name","namespace-uri","normalize-space","not","number","position","round","starts-with","string","string-length","substring","substring-after","substring-before","sum","translate","true"],a=["current","document","element-available","format-number","function-available","generate-id","key","system-property","unparsed-entity-uri"],c=["matches","ends-with","xml-to-json","json-to-xml"];return[...o,...a,...c].includes(i)},t.document=(n,r,i)=>{var o;if(e.documentLoader){let a=Array.isArray(r)?((o=r[0])==null?void 0:o.textContent)||String(r[0]||""):String(r||"");if(!a)return e.root?[this.adaptXNode(e.root)]:[];try{let c=e.documentLoader(a);if(c)return[this.adaptXNode(c)]}catch(c){console.warn(`document() failed to load: ${a}`,c)}}return[]},t["unparsed-entity-uri"]=(n,r)=>{let i=String(r);return e.unparsedEntities&&e.unparsedEntities[i]?e.unparsedEntities[i]:""},t}convertXPathNodeToXNode(e,t){if(!e)return null;let{XNode:n}=(Ee(),Qt(kn)),{DOM_DOCUMENT_NODE:r,DOM_TEXT_NODE:i,DOM_ELEMENT_NODE:o}=(W(),Qt(Nn)),a;if(e.nodeType===r){if(e.childNodes&&e.childNodes.length>0){let c=e.childNodes[0];return a=this.convertXPathNodeToXNode(c,t),a}return null}else if(e.nodeType===i){let c=e.textContent||"";a=new n(i,"#text",c,t)}else if(a=new n(o,e.nodeName||"element","",t),e.namespaceUri&&(a.namespaceUri=e.namespaceUri),e.childNodes&&e.childNodes.length>0){for(let c=0;c<e.childNodes.length;c++){let u=e.childNodes[c],l=this.convertXPathNodeToXNode(u,t);l&&(l.parentNode=a,a.childNodes.push(l))}a.childNodes.length>0&&(a.firstChild=a.childNodes[0],a.lastChild=a.childNodes[a.childNodes.length-1])}return a}xmlToJson(e){if(!e)return'""';if(e.nodeType===3){let t=e.nodeValue||"";return JSON.stringify(t)}if(e.nodeType===1){let t=this.getTextContent(e);return JSON.stringify(t)}return e.nodeType===2?JSON.stringify(e.nodeValue||""):'""'}wrapResult(e,t){if(Array.isArray(e)){let n=e.map(r=>this.xPathNodeToXNode(r)).filter(r=>r!==null);return new q(n)}return typeof e=="string"?new z(e):typeof e=="number"?new J(e):typeof e=="boolean"?new C(e):new q([])}clearCache(){}},ye=class{constructor(){this.parseCache=new Map;this.lexer=new Te("1.0"),this.parser=new Se,this.nodeConverter=new dn}xPathParse(e,t){let n=`${e}:${t||""}`;if(this.parseCache.has(n))return this.parseCache.get(n);let r=this.lexer.scan(e),i=this.parser.parse(r),o=this.wrapExpression(i,t);return this.parseCache.set(n,o),o}xPathEval(e,t){return this.xPathParse(e).evaluate(t)}xPathSort(e,t){if(t.length===0)return;let n=[];for(let i=0;i<e.contextSize();++i){let o=e.nodeList[i],a={node:o,key:[]},c=e.clone([o],0);for(let u of t){let l=u.expr.evaluate(c),h;u.type==="text"?h=l.stringValue():u.type==="number"&&(h=l.numberValue()),a.key.push({value:h,order:u.order})}a.key.push({value:i,order:"ascending"}),n.push(a)}n.sort(this.xPathSortByKey);let r=[];for(let i=0;i<n.length;++i){let o=n[i].node;o.siblingPosition=i,r.push(o)}e.nodeList=r,e.setNode(0)}xPathSortByKey(e,t){for(let n=0;n<e.key.length;++n){let r=e.key[n].order==="descending"?-1:1;if(e.key[n].value>t.key[n].value)return 1*r;if(e.key[n].value<t.key[n].value)return-1*r}return 0}wrapExpression(e,t){if(e instanceof se)return t&&e.steps.length>0&&!e.absolute&&(e.steps[0].axis=t),new oe(e,this.nodeConverter);if(e instanceof fe){let n=this.wrapExpression(e.left,t),r=this.wrapExpression(e.right,t);return new ae(e,this.nodeConverter,n,r)}return new we(e,this.nodeConverter)}clearCache(){this.parseCache.clear(),this.nodeConverter.clearCache()}};W();var ar={label:"[number]",prec:35,re:new RegExp("^\\d+(\\.\\d*)?"),key:void 0};var ge=class s{constructor(e,t="1.0",n,r,i,o,a,c,u,l,h){this.nodeList=e,this.xsltVersion=t,this.position=n||0,this.variables=i||{},this.keys=(a==null?void 0:a.keys)||{},this.knownNamespaces=o||{},this.parent=a||null,this.caseInsensitive=c||!1,this.ignoreAttributesWithoutValue=u||!1,this.returnOnFirstMatch=l||!1,this.ignoreNonElementNodesForNTA=h||!1,this.inApplyTemplates=!1,this.baseTemplateMatched=!1,this.decimalFormatSettings=r||{decimalSeparator:".",groupingSeparator:",",infinity:"Infinity",minusSign:"-",naN:"NaN",percent:"%",perMille:"\u2030",zeroDigit:"0",digit:"#",patternSeparator:";"},a?this.root=a.root:this.nodeList[this.position].nodeType==9?this.root=this.nodeList[this.position]:this.root=this.nodeList[this.position].ownerDocument}clone(e,t){return new s(e||this.nodeList,this.xsltVersion,typeof t!="undefined"?t:this.position,this.decimalFormatSettings,this.variables,this.knownNamespaces,this,this.caseInsensitive,this.ignoreAttributesWithoutValue,this.returnOnFirstMatch,this.ignoreNonElementNodesForNTA)}setVariable(e,t){if(t instanceof z||t instanceof C||t instanceof J||t instanceof q){this.variables[e]=t;return}t==="true"?this.variables[e]=new C(!0):t==="false"?this.variables[e]=new C(!1):ar.re.test(String(t))?this.variables[e]=new J(t):this.variables[e]=new z(t)}getVariable(e){return typeof this.variables[e]!="undefined"?this.variables[e]:this.parent?this.parent.getVariable(e):null}setNode(e){this.position=e}contextSize(){return this.nodeList.length}isCaseInsensitive(){return this.caseInsensitive}setCaseInsensitive(e){return this.caseInsensitive=e}isIgnoreAttributesWithoutValue(){return this.ignoreAttributesWithoutValue}setIgnoreAttributesWithoutValue(e){return this.ignoreAttributesWithoutValue=e}isReturnOnFirstMatch(){return this.returnOnFirstMatch}setReturnOnFirstMatch(e){return this.returnOnFirstMatch=e}isIgnoreNonElementNodesForNTA(){return this.ignoreNonElementNodesForNTA}setIgnoreNonElementNodesForNTA(e){return this.ignoreNonElementNodesForNTA=e}};var st=class{expressionMatch(e,t){if(e instanceof oe)return this.locationExpressionMatch(e,t);if(e instanceof ae)return this.unionExpressionMatch(e,t);try{return e.evaluate(t).nodeSetValue()}catch(n){return[]}}locationExpressionMatch(e,t){if(!e.steps||e.steps.length<=0){if(e.absolute){let n=t.nodeList[t.position];return n.nodeName==="#document"?[n]:[]}return[t.nodeList[t.position]]}return e.absolute?e.steps[0].axis==="self"?this.absoluteXsltMatchByDocumentNode(e,t):this.absoluteXsltMatch(e,t):this.relativeXsltMatch(e,t)}unionExpressionMatch(e,t){return this.expressionMatch(e.expr1,t).concat(this.expressionMatch(e.expr2,t))}absoluteXsltMatchByDocumentNode(e,t){let n=t.clone([t.root],0),r=e.evaluate(n).nodeSetValue(),i=[];for(let o of r)o.id===t.nodeList[t.position].id&&i.push(o);return i}absoluteXsltMatch(e,t){var c;let n=t.root.childNodes.find(u=>u.nodeName!=="#dtd-section");if(!n)return[];let r=t.clone([n],0),i=e.evaluate(r).nodeSetValue(),o=[],a;t.nodeList.length===1&&t.nodeList[0].nodeName==="#document"?a=[t.nodeList[0].childNodes.find(u=>u.nodeName!=="#dtd-section")]:a=t.nodeList;for(let u of i)u.id===((c=a[t.position])==null?void 0:c.id)&&o.push(u);return o}relativeXsltMatch(e,t){let n=t.clone(),r=e.evaluate(n).nodeSetValue();return r.length===1&&r[0].nodeName==="#document"?[r[0].childNodes[0]]:r}};var ot=class{constructor(){this.value=new C(!0)}evaluate(){return this.value}};W();var at=class{evaluate(e){return new C(e.nodeList[e.position].nodeType==8)}};W();var ct=class{evaluate(e){let t=e.nodeList[e.position];return new C(t.nodeType==1||t.nodeType==2)}};var ut=class{constructor(e){if(this.name=e,e.indexOf(":")>0){let t=e.split(":");this.namespacePrefix=t[0],this.name=t[1]}this.re=new RegExp(`^${e}$`,"i")}evaluate(e){let t=e.nodeList[e.position];return this.namespacePrefix!==void 0?e.knownNamespaces[this.namespacePrefix]!==t.namespaceUri?new C(!1):e.caseInsensitive?t.localName.length!==this.name.length?new C(!1):new C(this.re.test(t.localName)):new C(t.localName===this.name):e.caseInsensitive?t.nodeName.length!==this.name.length?new C(!1):new C(this.re.test(t.nodeName)):new C(t.nodeName===this.name)}};var lt=class{constructor(e){this.regex=new RegExp(`^${e}:`),this.nsprefix=e}evaluate(e){let t=e.nodeList[e.position];return new C(t.nodeName.match(this.regex))}};W();var pt=class{constructor(e){this.target=e}evaluate(e){let t=e.nodeList[e.position];return new C(t.nodeType==7&&(!this.target||t.nodeName==this.target))}};W();var ht=class{evaluate(e){return new C(e.nodeList[e.position].nodeType==3)}};Ee();W();W();function di(s){let e=s.nodeTest;if(s.predicate&&s.predicate.length>0||s.predicates&&s.predicates.length>0)return .5;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case"wildcard":return e.name&&e.name.endsWith(":*")?-.25:-.5;case"node-type":return e.nodeType==="processing-instruction"&&e.name?0:-.5;case"processing-instruction":return e.name?0:-.5;case"name":return 0;default:return 0}return e instanceof ot||e instanceof ct||e instanceof ht||e instanceof at?-.5:e instanceof pt?e.target?0:-.5:e instanceof lt?-.25:(e instanceof ut,0)}function mi(s){return!s.steps||s.steps.length===0?s.absolute?-.5:0:s.steps.length>1?.5:di(s.steps[0])}function fi(s,e){let t=mn(s.expr1,e),n=mn(s.expr2,e);return Math.min(t,n)}function mn(s,e){return s instanceof oe?mi(s):s instanceof ae?fi(s,e):.5}function yi(s,e){try{let t=e.xPathParse(s,"self-and-siblings");return mn(t,e)}catch(t){return console.warn(`Failed to parse pattern "${s}" for priority calculation:`,t),0}}function gi(s,e){let t=s.getAttributeValue("mode");return e?e==="#all"||t==="#all"?!0:t===e:!t||t==="#default"}function xi(s){return s.nodeType!==1?!1:(s.namespaceUri==="http://www.w3.org/1999/XSL/Transform"||s.prefix==="xsl")&&s.localName==="template"}function jt(s,e,t,n){var o;let r=[],i=0;for(let a of s.childNodes){if(!xi(a)||!gi(a,e))continue;let c=a.getAttributeValue("match");if(!c)continue;let u=a.getAttributeValue("priority"),l=u?parseFloat(u):null,h=yi(c,t),p=l!==null&&!isNaN(l)?l:h,f=n==null?void 0:n.get(a),y=0;if(f){let d=Number.MAX_SAFE_INTEGER/2,g=-f.importDepth*d,P=(o=f.order)!=null?o:0;y=g+P}r.push({template:a,explicitPriority:l!==null&&!isNaN(l)?l:null,defaultPriority:h,effectivePriority:p,importPrecedence:y,documentOrder:i++,matchPattern:c})}return r}function Ni(s){let e=[],t="",n=0,r=!1,i=!1;for(let o=0;o<s.length;o++){let a=s[o];a==="'"&&!i?(r=!r,t+=a):a==='"'&&!r?(i=!i,t+=a):!r&&!i?a==="["||a==="("?(n++,t+=a):a==="]"||a===")"?(n--,t+=a):a==="|"&&n===0?(e.push(t.trim()),t=""):t+=a:t+=a}return t.trim()&&e.push(t.trim()),e}function Ei(s,e,t,n,r){if(e==="/")return s.nodeName==="#document";if(e.startsWith("@")){if(s.nodeType!==2)return!1;let i=e.substring(1);if(i==="*")return!0;let o=s.localName||s.nodeName,a=i.includes(":")?i.substring(i.indexOf(":")+1):i;return o===a||s.nodeName===i}if(e==="*"&&s.nodeType===1||!e.includes("/")&&!e.includes("[")&&!e.startsWith("@")&&(e===s.nodeName||e===s.localName))return!0;if(e.includes("/")||e.includes("["))try{let i=e.startsWith("/")?e:"//"+e,o=t.clone([t.root],0);if(r.xPathEval(i,o).nodeSetValue().some(u=>u.id===s.id))return!0}catch(i){}if(!e.includes("/")&&!e.includes("[")&&!e.startsWith("@"))try{let i=t.clone([s],0),o=r.xPathParse(e,"self-and-siblings");if(n.expressionMatch(o,i).some(c=>c.id===s.id))return!0}catch(i){}return!1}function Ti(s,e,t,n,r){let i=Ni(e);for(let o of i)if(Ei(s,o,t,n,r))return!0;return!1}function dt(s,e,t,n){let r=[],i=e.nodeList[e.position];for(let c of s)try{Ti(i,c.matchPattern,e,t,n)&&r.push(c)}catch(u){console.warn(`Failed to match pattern "${c.matchPattern}":`,u)}if(r.length===0)return{selectedTemplate:null,hasConflict:!1,conflictingTemplates:[]};r.sort((c,u)=>c.importPrecedence!==u.importPrecedence?u.importPrecedence-c.importPrecedence:c.effectivePriority!==u.effectivePriority?u.effectivePriority-c.effectivePriority:u.documentOrder-c.documentOrder);let o=r[0],a=r.filter(c=>c.importPrecedence===o.importPrecedence&&c.effectivePriority===o.effectivePriority);return{selectedTemplate:o.template,hasConflict:a.length>1,conflictingTemplates:a.length>1?a:[]}}function cr(s,e){if(!s.hasConflict||s.conflictingTemplates.length<2)return;let t=s.conflictingTemplates.map(n=>`"${n.matchPattern}" (priority: ${n.effectivePriority})`).join(", ");console.warn(`XSLT Warning: Ambiguous template match for node <${e.nodeName}>. Multiple templates match with equal priority: ${t}. Using the last one in document order.`)}var Gt=class{constructor(e={cData:!0,escape:!0,selfClosingTags:!0,parameters:[]}){this.styleSheetStack=[];this.importedStylesheets=new Map;this.templateSourceMap=new Map;this.currentTemplateStack=[];this.xPath=new ye,this.xmlParser=new de,this.matchResolver=new st,this.options={cData:e.cData===!0,escape:e.escape===!0,selfClosingTags:e.selfClosingTags===!0,outputMethod:e.outputMethod,parameters:e.parameters||[]},this.outputMethod=e.outputMethod||"xml",this.outputOmitXmlDeclaration="no",this.stripSpacePatterns=[],this.preserveSpacePatterns=[],this.namespaceAliases=new Map,this.supportedExtensions=new Set(["http://www.w3.org/1999/XSL/Transform"]),this.attributeSets=new Map,this.decimalFormatSettings={decimalSeparator:".",groupingSeparator:",",infinity:"Infinity",minusSign:"-",naN:"NaN",percent:"%",perMille:"\u2030",zeroDigit:"0",digit:"#",patternSeparator:";"},this.firstTemplateRan=!1}xsltProcess(e,t){return S(this,null,function*(){let n=new re;this.outputDocument=n;let r=new ge([e]);if(this.options.parameters.length>0)for(let a of this.options.parameters)r.setVariable(a.name,new z(a.value));if(yield this.xsltProcessContext(r,t,this.outputDocument),this.outputMethod==="json")return sn(n);let i=this.outputMethod;return this.outputMethod==="adaptive"&&(i=rn(n)),nn(n,{cData:this.options.cData,escape:this.options.escape,selfClosingTags:this.options.selfClosingTags,outputMethod:i})})}xsltProcessContext(e,t,n){return S(this,null,function*(){if(!this.isXsltElement(t))t.nodeType===1&&!this.isExtensionElementSupported(t)?yield this.xsltExtensionElement(e,t,n):yield this.xsltPassThrough(e,t,n);else{let r,i,o,a;switch(t.localName){case"apply-imports":yield this.xsltApplyImports(e,t,n);break;case"apply-templates":yield this.xsltApplyTemplates(e,t,n);break;case"attribute":yield this.xsltAttribute(e,t,n);break;case"attribute-set":break;case"call-template":yield this.xsltCallTemplate(e,t,n);break;case"choose":yield this.xsltChoose(e,t,n);break;case"comment":yield this.xsltComment(e,t,n);break;case"copy":r=this.xsltCopy(n||this.outputDocument,e.nodeList[e.position]),r&&(yield this.xsltChildNodes(e,t,r));break;case"copy-of":i=m(t,"select"),o=this.xPath.xPathEval(i,e);let c=n||this.outputDocument;if(o.type==="node-set"){a=o.nodeSetValue();for(let h=0;h<a.length;++h)this.xsltCopyOf(c,a[h])}else{let h=G(this.outputDocument,o.stringValue());h.siblingPosition=c.childNodes.length,A(c,h)}break;case"decimal-format":this.xsltDecimalFormat(e,t);break;case"element":yield this.xsltElement(e,t,n);break;case"fallback":let u=t.parentNode;if(!(u&&u.nodeType===1&&!this.isExtensionElementSupported(u)))throw new Error("<xsl:fallback> must be a direct child of an extension element");yield this.xsltChildNodes(e,t,n);break;case"for-each":yield this.xsltForEach(e,t,n);break;case"if":yield this.xsltIf(e,t,n);break;case"import":yield this.xsltImport(e,t,n);break;case"include":yield this.xsltInclude(e,t,n);break;case"key":this.xsltKey(e,t);break;case"message":yield this.xsltMessage(e,t);break;case"namespace-alias":this.xsltNamespaceAlias(t);break;case"number":this.xsltNumber(e,t,n);break;case"otherwise":throw new Error("<xsl:otherwise> must be a child of <xsl:choose>.");case"output":this.outputMethod=m(t,"method"),this.outputOmitXmlDeclaration=m(t,"omit-xml-declaration");break;case"param":yield this.xsltVariable(e,t,!1);break;case"preserve-space":this.xsltPreserveSpace(t);break;case"processing-instruction":yield this.xsltProcessingInstruction(e,t,n);break;case"sort":this.xsltSort(e,t);break;case"strip-space":this.xsltStripSpace(t);break;case"stylesheet":case"transform":yield this.xsltTransformOrStylesheet(e,t,n);break;case"template":yield this.xsltTemplate(e,t,n);break;case"text":this.xsltText(e,t,n);break;case"value-of":this.xsltValueOf(e,t,n);break;case"variable":yield this.xsltVariable(e,t,!0);break;case"when":throw new Error("<xsl:when> must be a child of <xsl:choose>.");case"with-param":throw new Error("<xsl:with-param> must be a child of <xsl:call-template> or <xsl:apply-templates>.");default:throw new Error(`error if here: ${t.localName}`)}}})}xsltApplyTemplates(e,t,n){return S(this,null,function*(){var h;let r=m(t,"select"),i=[];r?i=this.xPath.xPathEval(r,e).nodeSetValue():i=e.nodeList[e.position].childNodes;let o=m(t,"mode"),a=t.ownerDocument.documentElement,c=jt(a,o,this.xPath,this.templateSourceMap),u=e.clone();yield this.xsltWithParam(u,t);let l=u.clone(i);for(let p=0;p<l.contextSize();++p){let f=l.nodeList[p];if(f.nodeType===3){if(!this.xsltPassText(f))continue;let y=e.clone([f],0);this.commonLogicTextNode(y,f,n)}else{let y=l.clone([f],0);y.inApplyTemplates=!0;let d=dt(c,y,this.matchResolver,this.xPath);if(d.hasConflict&&cr(d,f),d.selectedTemplate){let g=this.templateSourceMap.get(d.selectedTemplate),P=m(d.selectedTemplate,"match"),O=m(d.selectedTemplate,"mode");this.currentTemplateStack.push({template:d.selectedTemplate,stylesheetDepth:(h=g==null?void 0:g.importDepth)!=null?h:0,mode:O||o,match:P});try{yield this.xsltChildNodes(y,d.selectedTemplate,n)}finally{this.currentTemplateStack.pop()}}}}})}xsltApplyImports(e,t,n){return S(this,null,function*(){if(this.currentTemplateStack.length===0)throw new Error("<xsl:apply-imports> can only be used within a template");let r=this.currentTemplateStack[this.currentTemplateStack.length-1],{stylesheetDepth:i,mode:o}=r,a=e.nodeList[e.position],c=t.ownerDocument.documentElement,l=jt(c,o,this.xPath,this.templateSourceMap).filter(d=>{let g=this.templateSourceMap.get(d.template);return g&&g.importDepth>i});if(l.length===0)return;let h=e.clone([a],0),p=dt(l,h,this.matchResolver,this.xPath);if(!p.selectedTemplate)return;let f=e.clone();yield this.xsltWithParam(f,t);let y=this.templateSourceMap.get(p.selectedTemplate);if(y){let d=m(p.selectedTemplate,"match");this.currentTemplateStack.push({template:p.selectedTemplate,stylesheetDepth:y.importDepth,mode:o,match:d}),yield this.xsltChildNodes(f,p.selectedTemplate,n),this.currentTemplateStack.pop()}})}xsltAttribute(e,t,n){return S(this,null,function*(){let r=m(t,"name"),i=this.xsltAttributeValue(r,e),o=te(this.outputDocument);yield this.xsltChildNodes(e,t,o);let a=Nt(o);n&&H(n,i,a)})}xsltCallTemplate(e,t,n){return S(this,null,function*(){let r=m(t,"name"),i=t.ownerDocument.documentElement,o=e.clone();yield this.xsltWithParam(o,t);for(let a=0;a<i.childNodes.length;++a){let c=i.childNodes[a];if(c.nodeType===1&&this.isXsltElement(c,"template")&&ue(c,"name")===r){yield this.xsltChildNodes(o,c,n);break}}})}xsltChoose(e,t,n){return S(this,null,function*(){for(let r of t.childNodes)if(r.nodeType===1){if(this.isXsltElement(r,"when")){let i=m(r,"test");if(this.xPath.xPathEval(i,e).booleanValue()){yield this.xsltChildNodes(e,r,n);break}}else if(this.isXsltElement(r,"otherwise")){yield this.xsltChildNodes(e,r,n);break}}})}xsltCopy(e,t){if(t.nodeType==1){let n=ee(this.outputDocument,t.nodeName);return t.namespaceUri!==null&&t.namespaceUri!==void 0&&H(n,"xmlns",t.namespaceUri),n.siblingPosition=e.childNodes.length,A(e,n),n}if(t.nodeType==3){if(this.shouldStripWhitespaceNode(t))return null;let n=G(this.outputDocument,t.nodeValue);n.siblingPosition=e.childNodes.length,A(e,n)}else if(t.nodeType==4){let n=Oe(this.outputDocument,t.nodeValue);n.siblingPosition=e.childNodes.length,A(e,n)}else if(t.nodeType==8){let n=le(this.outputDocument,t.nodeValue);n.siblingPosition=e.childNodes.length,A(e,n)}else t.nodeType==2&&H(e,t.nodeName,t.nodeValue);return null}xsltComment(e,t,n){return S(this,null,function*(){let r=te(this.outputDocument);yield this.xsltChildNodes(e,t,r);let i=Q(r),o=le(this.outputDocument,i);(n||this.outputDocument).appendChild(o)})}xsltProcessingInstruction(e,t,n){return S(this,null,function*(){let r=m(t,"name");if(!r)throw new Error('<xsl:processing-instruction> requires a "name" attribute');let i=this.xsltAttributeValue(r,e);if(!i)throw new Error("<xsl:processing-instruction> target name cannot be empty");if(i.toLowerCase()==="xml")throw new Error('Processing instruction target cannot be "xml"');if(!/^[a-zA-Z_][a-zA-Z0-9_:.-]*$/.test(i))throw new Error(`Invalid processing instruction target: "${i}"`);let o=te(this.outputDocument);yield this.xsltChildNodes(e,t,o);let a=Q(o),c=Kt(this.outputDocument,i,a),u=n||this.outputDocument;A(u,c)})}xsltCopyOf(e,t){if(t.nodeType==11||t.nodeType==9)for(let n=0;n<t.childNodes.length;++n)this.xsltCopyOf(e,t.childNodes[n]);else{let n=this.xsltCopy(e,t);if(n)for(let r=0;r<t.childNodes.length;++r)this.xsltCopyOf(n,t.childNodes[r])}}xsltDecimalFormat(e,t){let n=m(t,"name"),r=m(t,"decimal-separator"),i=m(t,"grouping-separator"),o=m(t,"infinity"),a=m(t,"minus-sign"),c=m(t,"NaN"),u=m(t,"percent"),l=m(t,"per-mille"),h=m(t,"zero-digit"),p=m(t,"digit"),f=m(t,"pattern-separator");this.decimalFormatSettings={name:n||this.decimalFormatSettings.name,decimalSeparator:r||this.decimalFormatSettings.decimalSeparator,groupingSeparator:i||this.decimalFormatSettings.groupingSeparator,infinity:o||this.decimalFormatSettings.infinity,minusSign:a||this.decimalFormatSettings.minusSign,naN:c||this.decimalFormatSettings.naN,percent:u||this.decimalFormatSettings.percent,perMille:l||this.decimalFormatSettings.perMille,zeroDigit:h||this.decimalFormatSettings.zeroDigit,digit:p||this.decimalFormatSettings.digit,patternSeparator:f||this.decimalFormatSettings.patternSeparator},e.decimalFormatSettings=this.decimalFormatSettings}xsltElement(e,t,n){return S(this,null,function*(){let r=m(t,"name"),i=this.xsltAttributeValue(r,e),o=ee(this.outputDocument,i),a=m(t,"use-attribute-sets");a&&(yield this.applyAttributeSets(e,o,a)),A(n||this.outputDocument,o);let c=e.clone(void 0,0);yield this.xsltChildNodes(c,t,o)})}xsltForEach(e,t,n){return S(this,null,function*(){let r=m(t,"select"),i=this.xPath.xPathEval(r,e).nodeSetValue();if(i.length===0)return;let o=e.clone(i);if(this.xsltSort(o,t),o.nodeList.filter(c=>c.parentNode!==null&&c.parentNode!==void 0).length<=0)throw new Error("Nodes with no parents defined.");for(let c=0;c<o.contextSize();++c)yield this.xsltChildNodes(o.clone(o.nodeList,c),t,n)})}xsltIf(e,t,n){return S(this,null,function*(){let r=m(t,"test");this.xPath.xPathEval(r,e).booleanValue()&&(yield this.xsltChildNodes(e,t,n))})}xsltImportOrInclude(e,t,n,r){return S(this,null,function*(){let i=r?"xsl:import":"xsl:include",[o,a]=process.versions.node.split(".").map(Number);if(o<=17&&a<5)throw new Error(`Your Node.js version does not support \`<${i}>\`. If possible, please update your Node.js version to at least version 17.5.0.`);global.globalThis.fetch||(global.globalThis.fetch=fetch,global.globalThis.Headers=Headers,global.globalThis.Request=Request,global.globalThis.Response=Response);let c=t.childNodes.filter(P=>P.nodeName==="href");if(c.length<=0)throw new Error(`<${i}> with no href attribute defined.`);let l=c[0].nodeValue;if(this.importedStylesheets.has(l))return;let p=yield(yield global.globalThis.fetch(l)).text(),f=this.xmlParser.xmlParse(p),y=this.styleSheetStack.length>0?this.styleSheetStack[this.styleSheetStack.length-1].importDepth:0,d={importDepth:r?y+1:y,href:l,order:this.importedStylesheets.size};this.styleSheetStack.push(d),this.importedStylesheets.set(l,f);let g=f.childNodes[0];g&&this.mapTemplatesFromStylesheet(g,d),yield this.xsltChildNodes(e,g,n),this.styleSheetStack.pop()})}xsltImport(e,t,n){return S(this,null,function*(){yield this.xsltImportOrInclude(e,t,n,!0)})}xsltInclude(e,t,n){return S(this,null,function*(){yield this.xsltImportOrInclude(e,t,n,!1)})}xsltKey(e,t){let n=m(t,"name"),r=m(t,"match"),i=m(t,"use");if(!n||!r||!i){let c="<xsl:key> missing required parameters: ";throw n||(c+="name, "),r||(c+="match, "),i||(c+="use, "),c=c.slice(0,-2),new Error(c)}let o;e.nodeList[e.position].nodeName==="#document"?o=e.clone(e.nodeList[e.position].childNodes):o=e;let a=this.xsltMatch(r,o);n in e.keys||(e.keys[n]={});for(let c of a){let u=e.clone([c]),h=this.xPath.xPathEval(i,u).stringValue();e.keys[n][h]=new q([c])}}xsltMessage(e,t){return S(this,null,function*(){let n=te(this.outputDocument);yield this.xsltChildNodes(e,t,n);let r=Q(n),i=m(t,"terminate")||"no";if(console.log(`[xsl:message] ${r}`),i==="yes")throw new Error(`xsl:message terminated: ${r}`)})}xsltNamespaceAlias(e){let t=m(e,"stylesheet-prefix"),n=m(e,"result-prefix");if(!t||!n)throw new Error("<xsl:namespace-alias> requires both stylesheet-prefix and result-prefix attributes.");this.namespaceAliases.set(t,n)}xsltNumber(e,t,n){let r=m(t,"value"),i=m(t,"level")||"single",o=m(t,"count"),a=m(t,"from"),c=m(t,"format")||"1",u=m(t,"lang"),l=m(t,"letter-value"),h=m(t,"grouping-separator"),p=m(t,"grouping-size"),f;if(r){let P=this.xPath.xPathEval(r,e);f=Math.round(P.numberValue())}else f=this.xsltNumberCount(e,i,o,a);let y=this.xsltFormatNumber(f,c,h,p),d=G(this.outputDocument,y),g=n||this.outputDocument;d.siblingPosition=g.childNodes.length,A(g,d)}xsltNumberCount(e,t,n,r){let i=e.nodeList[e.position],o=n||i.nodeName;switch(t){case"single":{let a=1,c=i.previousSibling;for(;c;)c.nodeType===i.nodeType&&this.nodeMatchesPattern(c,o)&&a++,c=c.previousSibling;return a}case"multiple":{let a=1,c=i.previousSibling;for(;c;)c.nodeType===i.nodeType&&this.nodeMatchesPattern(c,o)&&a++,c=c.previousSibling;return a}case"any":{let a=1,c=this.getAllPrecedingNodes(i);for(let u of c)this.nodeMatchesPattern(u,o)&&a++;return a}default:return 1}}nodeMatchesPattern(e,t){return t==="*"?e.nodeType===1:e.nodeName===t||e.localName===t}getAllPrecedingNodes(e){let t=[],n=e.previousSibling;for(;n;)t.push(n),this.collectDescendants(n,t),n=n.previousSibling;let r=e.parentNode;for(;r;){let i=r.previousSibling;for(;i;)t.push(i),this.collectDescendants(i,t),i=i.previousSibling;r=r.parentNode}return t}collectDescendants(e,t){for(let n of e.childNodes)n.nodeType===1&&(t.push(n),this.collectDescendants(n,t))}xsltFormatNumber(e,t,n,r){let i=t.charAt(0),o;switch(i){case"1":if(o=e.toString(),t.length>1&&t.match(/^0+1$/)){let a=t.length;o=e.toString().padStart(a,"0")}break;case"a":o=this.numberToAlpha(e,!1);break;case"A":o=this.numberToAlpha(e,!0);break;case"i":o=this.numberToRoman(e).toLowerCase();break;case"I":o=this.numberToRoman(e);break;default:o=e.toString()}if(n&&r){let a=parseInt(r,10);a>0&&!isNaN(a)&&(o=this.applyGrouping(o,n,a))}return o}numberToAlpha(e,t){if(e<=0)return"";let n="";for(;e>0;)e--,n=String.fromCharCode(e%26+(t?65:97))+n,e=Math.floor(e/26);return n}numberToRoman(e){if(e<=0||e>3999)return e.toString();let t=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],n="";for(let[r,i]of t)for(;e>=r;)n+=i,e-=r;return n}applyGrouping(e,t,n){let r=e.split("."),i=r[0],o=r[1],a="",c=0;for(let u=i.length-1;u>=0;u--)c>0&&c%n===0&&(a=t+a),a=i[u]+a,c++;return o?a+"."+o:a}xsltSort(e,t){let n=[];for(let r of t.childNodes)if(r.nodeType==1&&this.isXsltElement(r,"sort")){let i=m(r,"select"),o=this.xPath.xPathParse(i),a=m(r,"data-type")||"text",c=m(r,"order")||"ascending";n.push({expr:o,type:a,order:c})}this.xPath.xPathSort(e,n)}xsltStripSpace(e){let t=m(e,"elements");if(t){let n=t.trim().split(/\s+/);this.stripSpacePatterns.push(...n)}}xsltPreserveSpace(e){let t=m(e,"elements");if(t){let n=t.trim().split(/\s+/);this.preserveSpacePatterns.push(...n)}}shouldStripWhitespaceNode(e){if(!e.nodeValue||!e.nodeValue.match(/^\s*$/)||this.stripSpacePatterns.length===0)return!1;let t=e.parentNode;if(!t||t.nodeType!==1)return!1;let n=t;for(;n&&n.nodeType===1;){let i=ue(n,"xml:space");if(i==="preserve")return!1;if(i==="default")break;n=n.parentNode}let r=t.localName||t.nodeName;for(let i of this.preserveSpacePatterns)if(this.matchesNamePattern(r,i,t))return!1;for(let i of this.stripSpacePatterns)if(this.matchesNamePattern(r,i,t))return!0;return!1}matchesNamePattern(e,t,n){if(t==="*")return!0;if(t.includes(":")){let[r,i]=t.split(":"),o=n.prefix||"";return i==="*"?o===r:o===r&&e===i}return e===t}xsltTemplate(e,t,n){return S(this,null,function*(){if(!e.inApplyTemplates&&e.baseTemplateMatched)return;let r=m(t,"match");if(!r)return;let i=this.xsltMatch(r,e,"self-and-siblings");if(i.length>0){this.firstTemplateRan=!0,e.inApplyTemplates||(e.baseTemplateMatched=!0);let o=e.clone(i,0);yield this.xsltChildNodes(o,t,n)}})}xsltText(e,t,n){let r=Q(t),i=G(this.outputDocument,r);i.fromXslText=!0;let o=t.childNodes.filter(c=>c.nodeType===2&&c.nodeName==="disable-output-escaping");o.length>0&&o[0].nodeValue==="yes"&&(i.escape=!1);let a=n||this.outputDocument;i.siblingPosition=a.childNodes.length,a.appendChild(i)}validateStylesheetAttributes(e,t){let n=e.childNodes.filter(a=>a.nodeType===2),r=["version","id","extension-element-prefixes","exclude-result-prefixes","default-collation"],i=["xmlns"],o=!1;for(let a of n){let c=a.nodeName,u=a.nodeValue;if(a.prefix==="xmlns"){t.knownNamespaces[a.localName]=u;continue}if(c==="xmlns"){t.knownNamespaces[""]=u;continue}if(c==="version"){if(o=!0,!["1.0","2.0","3.0"].includes(u))throw new Error(`XSLT version not defined or invalid. Actual resolved version: ${u||"(none)"}.`);this.version=u,t.xsltVersion=u;continue}if(c==="extension-element-prefixes"){let l=u.split(/\s+/);for(let h of l)if(h&&!/^[a-zA-Z_:][\w:.-]*$/.test(h))throw new Error(`Invalid prefix in extension-element-prefixes: "${h}". Prefixes must be valid QNames.`);continue}if(c==="exclude-result-prefixes"){if(u!=="#all"){let l=u.split(/\s+/);for(let h of l)if(h&&!/^[a-zA-Z_:][\w:.-]*$/.test(h))throw new Error(`Invalid prefix in exclude-result-prefixes: "${h}". Prefixes must be valid QNames or "#all".`)}continue}if(c==="default-collation"){if(!u||u.trim().length===0)throw new Error("The default-collation attribute must contain a URI.");continue}if(c==="id"){if(!/^[a-zA-Z_:][\w:.-]*$/.test(u))throw new Error(`Invalid id attribute value: "${u}". IDs must be valid NCNames.`);continue}}}xsltTransformOrStylesheet(e,t,n){return S(this,null,function*(){var u,l,h;let r={importDepth:0,href:"(main stylesheet)",order:0};this.mapTemplatesFromStylesheet(t,r),this.collectAttributeSets(t),this.validateStylesheetAttributes(t,e);let i=!1;for(let p of t.childNodes)if(p.nodeType===1)if(this.isXsltElement(p,"import")){if(i)throw new Error("<xsl:import> should be the first child node of <xsl:stylesheet> or <xsl:transform>.")}else i=!0;let o=[],a=[];for(let p of t.childNodes)p.nodeType===1&&this.isXsltElement(p,"template")?a.push(p):o.push(p);let c=e.clone();for(let p of o)yield this.xsltProcessContext(c,p,n);if(a.length>0){let p=jt(t,null,this.xPath,this.templateSourceMap),f=[];for(let y of p)try{let d=this.xsltMatch(y.matchPattern,c);d.length>0&&f.push({priority:y,matchedNodes:d})}catch(d){console.warn(`Failed to match pattern "${y.matchPattern}":`,d)}if(f.length>0){let y=f.find(w=>w.priority.matchPattern==="/"),d;y?d=y:(f.sort((w,I)=>w.priority.importPrecedence!==I.priority.importPrecedence?I.priority.importPrecedence-w.priority.importPrecedence:w.priority.effectivePriority!==I.priority.effectivePriority?I.priority.effectivePriority-w.priority.effectivePriority:I.priority.documentOrder-w.priority.documentOrder),d=f[0]);let g=f.filter(w=>w.priority.importPrecedence===d.priority.importPrecedence&&w.priority.effectivePriority===d.priority.effectivePriority);if(g.length>1){let w=g.map(I=>`"${I.priority.matchPattern}" (priority: ${I.priority.effectivePriority})`).join(", ");console.warn(`XSLT Warning: Ambiguous template match. Multiple templates match with equal priority: ${w}. Using the last one in document order.`)}this.firstTemplateRan=!0,c.baseTemplateMatched=!0;let P=c.clone(d.matchedNodes,0),O=this.templateSourceMap.get(d.priority.template),k=m(d.priority.template,"match"),$=m(d.priority.template,"mode");this.currentTemplateStack.push({template:d.priority.template,stylesheetDepth:(u=O==null?void 0:O.importDepth)!=null?u:0,mode:$||null,match:k}),yield this.xsltChildNodes(P,d.priority.template,n),this.currentTemplateStack.pop()}else{let y=e.nodeList[e.position];if(y&&y.childNodes&&y.childNodes.length>0){let d=y.childNodes.filter(g=>g.nodeName!=="#dtd-section");if(d.length>0){let g=e.clone(d);for(let P=0;P<g.contextSize();++P){let O=g.nodeList[P];if(O.nodeType===3){let k=e.clone([O],0);this.commonLogicTextNode(k,O,n)}else{let k=g.clone([O],0),$=dt(p,k,this.matchResolver,this.xPath);if($.selectedTemplate){let w=k.clone([O],0);w.inApplyTemplates=!0;let I=this.templateSourceMap.get($.selectedTemplate),Ae=m($.selectedTemplate,"match"),ce=m($.selectedTemplate,"mode");this.currentTemplateStack.push({template:$.selectedTemplate,stylesheetDepth:(l=I==null?void 0:I.importDepth)!=null?l:0,mode:ce||null,match:Ae}),yield this.xsltChildNodes(w,$.selectedTemplate,n),this.currentTemplateStack.pop()}else if(O.childNodes&&O.childNodes.length>0){let w=O.childNodes.filter(I=>I.nodeName!=="#dtd-section");if(w.length>0){let I=e.clone(w);for(let Ae=0;Ae<I.contextSize();++Ae){let ce=I.nodeList[Ae];if(ce.nodeType===3){let mt=e.clone([ce],0);this.commonLogicTextNode(mt,ce,n)}else{let mt=I.clone([ce],0),xe=dt(p,mt,this.matchResolver,this.xPath);if(xe.selectedTemplate){let fn=mt.clone([ce],0);fn.inApplyTemplates=!0;let Yt=this.templateSourceMap.get(xe.selectedTemplate),ur=m(xe.selectedTemplate,"match"),lr=m(xe.selectedTemplate,"mode");this.currentTemplateStack.push({template:xe.selectedTemplate,stylesheetDepth:(h=Yt==null?void 0:Yt.importDepth)!=null?h:0,mode:lr||null,match:ur}),yield this.xsltChildNodes(fn,xe.selectedTemplate,n),this.currentTemplateStack.pop()}}}}}}}}}}}})}xsltValueOf(e,t,n){let r=m(t,"select"),i=e.nodeList[e.position],o=this.xPath.xPathEval(r,e);if(i&&i.nodeName==="#document"&&(o.stringValue()===""||o instanceof q&&o.nodeSetValue().length===0)){let l=i.childNodes.find(h=>h.nodeName!=="#dtd-section");if(l){let h=e.clone([l],0);o=this.xPath.xPathEval(r,h)}}let a=o.stringValue(),c=G(this.outputDocument,a),u=n||this.outputDocument;c.siblingPosition=u.childNodes.length,u.appendChild(c)}xsltVariable(e,t,n){return S(this,null,function*(){let r=m(t,"name"),i=m(t,"select"),o;if(t.childNodes.filter(c=>c.nodeType!==2).length>0){let c=te(t.ownerDocument);yield this.xsltChildNodes(e,t,c),o=new q([c])}else if(i)o=this.xPath.xPathEval(i,e);else{let c="",u=this.options.parameters.filter(l=>l.name===r);u.length>0&&(c=u[0].value),o=new z(c)}(n||!e.getVariable(r))&&e.setVariable(r,o)})}xsltChildNodes(e,t,n){return S(this,null,function*(){let r=e.clone();for(let i=0;i<t.childNodes.length;++i){let o=t.childNodes[i];o.nodeType!==2&&(yield this.xsltProcessContext(r,o,n))}})}commonLogicTextNode(e,t,n){if(n){if(this.shouldStripWhitespaceNode(t))return;let r=G(this.outputDocument,t.nodeValue);r.siblingPosition=n.childNodes.length,A(n,r)}}xsltPassThrough(e,t,n){return S(this,null,function*(){switch(t.nodeType){case 3:this.xsltPassText(t)&&this.commonLogicTextNode(e,t,n);break;case 1:let r,i=e;r=e.nodeList[e.position];let o;o=ee(this.outputDocument,t.nodeName),o.siblingPosition=r.siblingPosition,A(n||this.outputDocument,o);let a=t.childNodes.find(u=>(u==null?void 0:u.nodeType)===2&&u.nodeName==="use-attribute-sets");a&&(yield this.applyAttributeSets(i,o,a.nodeValue)),yield this.xsltChildNodes(i,t,o);let c=t.childNodes.filter(u=>(u==null?void 0:u.nodeType)===2&&u.nodeName!=="use-attribute-sets");for(let u of c){let l=u.nodeName,h=this.xsltAttributeValue(u.nodeValue,i);H(o,l,h)}break;default:yield this.xsltChildNodes(e,t,n)}})}xsltPassText(e){if(!e.nodeValue.match(/^\s*$/))return!0;let t=e.parentNode;if(this.isXsltElement(t,"text"))return!0;for(;t&&t.nodeType==1;){let n=ue(t,"xml:space");if(n){if(n=="default")return!1;if(n=="preserve")return!0}t=t.parentNode}return!1}findAttributeInContext(e,t){return t.nodeList[t.position].childNodes.find(n=>n.nodeType===2&&n.nodeName===e)}xsltAttributeValue(e,t){let n=e.split("{");if(n.length===1)return e;let r="";for(let i=0;i<n.length;++i){let o=n[i].split("}");if(o.length!=2){r+=n[i];continue}let a=this.xPath.xPathEval(o[0],t).stringValue();r+=a+o[1]}return r}xsltMatch(e,t,n){let r=this.xPath.xPathParse(e,n);return this.matchResolver.expressionMatch(r,t)}xsltWithParam(e,t){return S(this,null,function*(){for(let n of t.childNodes)n.nodeType===1&&this.isXsltElement(n,"with-param")&&(yield this.xsltVariable(e,n,!0))})}mapTemplatesFromStylesheet(e,t){for(let n of e.childNodes)n.nodeType===1&&(this.isXsltElement(n,"template")?this.templateSourceMap.set(n,t):(this.isXsltElement(n,"stylesheet")||this.isXsltElement(n,"transform"))&&this.mapTemplatesFromStylesheet(n,t))}collectAttributeSets(e){for(let t of e.childNodes)if(t.nodeType===1&&this.isXsltElement(t,"attribute-set")){let n=m(t,"name"),r=t.childNodes.filter(i=>i.nodeType===1&&this.isXsltElement(i,"attribute"));if(n){let i=this.attributeSets.get(n);i&&i.length?this.attributeSets.set(n,[...i,...r]):this.attributeSets.set(n,r)}}}applyAttributeSets(e,t,n){return S(this,null,function*(){if(!n||!n.trim())return;let r=n.trim().split(/\s+/),i=new Set;for(let o of r)yield this.applyAttributeSet(e,t,o,i)})}applyAttributeSet(e,t,n,r){return S(this,null,function*(){if(r.has(n))return;r.add(n);let i=this.attributeSets.get(n);if(i)for(let o of i){let a=null,c=o.parentNode;if(c&&(a=m(c,"use-attribute-sets")),a)for(let f of a.trim().split(/\s+/))f&&(yield this.applyAttributeSet(e,t,f,r));let u=m(o,"name"),l=this.xsltAttributeValue(u,e),h=te(this.outputDocument);yield this.xsltChildNodes(e,o,h);let p=Nt(h);H(t,l,p)}})}isExtensionElementSupported(e){if(e.nodeType!==1)return!0;let t=e.namespaceUri;return!t||this.isXsltElement(e)?!0:!!this.supportedExtensions.has(t)}getFallbackElement(e){for(let t of e.childNodes)if(t.nodeType===1&&this.isXsltElement(t,"fallback"))return t;return null}xsltExtensionElement(e,t,n){return S(this,null,function*(){let r=this.getFallbackElement(t);r?yield this.xsltChildNodes(e,r,n):yield this.xsltPassThrough(e,t,n)})}isXsltElement(e,t){return t&&e.localName!=t?!1:e.namespaceUri?e.namespaceUri==="http://www.w3.org/1999/XSL/Transform":e.prefix==="xsl"}};Ee();return Qt(bi);})();
4
5
  //# sourceMappingURL=xslt-processor.global.js.map