(()=>{"use strict";var t={d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>C});class s{constructor(t,e={},s){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this.data=s,this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let s=0,i="";for(;s0?t[t.length-1].tag:void 0}getCurrentNamespace(){const t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){const e=this._matcher.path;if(0!==e.length)return e[e.length-1].values?.[t]}hasAttr(t){const e=this._matcher.path;if(0===e.length)return!1;const s=e[e.length-1];return void 0!==s.values&&t in s.values}getAnyParentAttr(t){return this._matcher.getAnyParentAttr(t)}hasAnyParentAttr(t){return this._matcher.hasAnyParentAttr(t)}getPosition(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].position??0}getCounter(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,e=!0){return this._matcher.toString(t,e)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}}class n{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new i(this),this._keptAttrs=[]}push(t,e=null,s=null,i=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const n=this.path.length;let r=this.siblingStacks[n];r||(r={counts:new Map,total:0},this.siblingStacks[n]=r);const o=s?`${s}:${t}`:t,a=r.counts.get(o)||0,h=r.total;r.counts.set(o,a+1),r.total++;const p={tag:t,position:h,counter:a};null!=s&&(p.namespace=s),null!=e&&(p.values=e),this.path.push(p);const u=this.path.length,l=null!==i?i.keep:null;if(null!=l&&l.length>0&&e)for(let t=0;tthis.path.length+1&&(this.siblingStacks.length=this.path.length+1);const e=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=e;)this._keptAttrs.pop();return t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0!==this.path.length)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getAnyParentAttr(t){const e=this._keptAttrs;for(let s=e.length-1;s>=0;s--)if(e[s].name===t)return e[s].value}hasAnyParentAttr(t){const e=this._keptAttrs;for(let s=e.length-1;s>=0;s--)if(e[s].name===t)return!0;return!1}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const s=t||this.separator;if(s===this.separator&&!0===e){if(null!==this._pathStringCache)return this._pathStringCache;const t=this.path.map(t=>t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(s);return this._pathStringCache=t,t}return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(s)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e=0&&e>=0;){const i=t[s];if("deep-wildcard"===i.type){if(s--,s<0)return!0;const i=t[s];let n=!1;for(let t=e;t>=0;t--)if(this._matchSegment(i,this.path[t],t===this.path.length-1)){e=t-1,s--,n=!0;break}if(!n)return!1}else{if(!this._matchSegment(i,this.path[e],e===this.path.length-1))return!1;e--,s--}}return s<0}_matchSegment(t,e,s){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!s)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue&&String(e.values[t.attrName])!==String(t.attrValue))return!1}if(void 0!==t.position){if(!s)return!1;const i=e.counter??0;if("first"===t.position&&0!==i)return!1;if("odd"===t.position&&i%2!=1)return!1;if("even"===t.position&&i%2!=0)return!1;if("nth"===t.position&&i!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),keptAttrs:this._keptAttrs.map(t=>({...t}))}}restore(t){this._pathStringCache=null,this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),this._keptAttrs=(t.keptAttrs||[]).map(t=>({...t}))}readOnly(){return this._view}}function r(t){return"number"==typeof t&&Object.is(t,-0)?"-0":String(t)}function o(t){return r(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function a(t){return r(t).replace(/\]\]>/g,"]]]]>")}function h(t){return r(t).replace(/"/g,""").replace(/'/g,"'")}const p=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�",u=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",l=u+"\\-\\.\\d·̀-ͯ҇‿-⁀",c=(t,e,s="")=>{const i=`[${t.replace(":","")}][${e.replace(":","")}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,s),ncName:new RegExp(`^${i}$`,s),qName:new RegExp(`^${i}(?::${i})?$`,s),nmToken:new RegExp(`^[${e}]+$`,s),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,s)}},g=c(p,p+"\\-\\.\\d·̀-ͯ‿-⁀"),d=c(u,l,"u"),f=":A-Za-z_",m=c(f,f+"\\-\\.\\d"),N=["name","ncName","qName","nmToken","nmTokens"],b=(t,{xmlVersion:e="1.0",asciiOnly:s=!1,maxCacheSize:i=2048}={})=>{if(!N.includes(t))throw new TypeError(`Unknown production "${t}". Must be one of: ${N.join(", ")}`);const n=((t="1.0",e=!1)=>e?m:"1.1"===t?d:g)(e,s)[t];let r=new Map;const o=t=>{const e=r.get(t);if(void 0!==e)return e;const s=n.test(t);return r.size{r=new Map},o};function y(t,e,s,i,n){return s.sanitizeName?n(t)?t:s.sanitizeName(t,{isAttribute:e,matcher:i.readOnly()}):t}function x(t,e){let i="";e.format&&(i="\n");const r=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let t=0;te.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(null!=t){let s=r(t);return s=O(s,e),s}return""}for(let l=0;l`,u=!1,i.pop();continue}if(d===e.commentPropName){p+=s+`\x3c!--${o(c[g][0][e.textNodeName])}--\x3e`,u=!0,i.pop();continue}if("?"===d[0]){p+=("?xml"===d?"":s)+`<${d}${v(c[":@"],e,m,i,h)}?>`,u=!0,i.pop();continue}let N=s;""!==N&&(N+=e.indentBy);const b=s+`<${d}${v(c[":@"],e,m,i,h)}`;let x;x=m?$(c[g],e):A(c[g],e,N,i,n,h),-1!==e.unpairedTags.indexOf(d)?e.suppressUnpairedNode?p+=b+">":p+=b+"/>":x&&0!==x.length||!e.suppressEmptyNode?x&&x.endsWith(">")?p+=b+`>${x}${s}`:(p+=b+">",x&&""!==s&&(x.includes("/>")||x.includes("`):p+=b+"/>",u=!0,i.pop()}return p}function P(t,e){if(!t||e.ignoreAttributes)return null;const s={};let i=!1;for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n.startsWith(e.attributeNamePrefix)?n.substr(e.attributeNamePrefix.length):n]=h(t[n]),i=!0);return i?s:null}function $(t,e){if(!Array.isArray(t))return null!=t?r(t):"";let s="";for(let i=0;i${i}`:s+=`<${o}${t}/>`}}}return s}function S(t,e){let s="";if(t&&!e.ignoreAttributes)for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let n=t[i];!0===n&&e.suppressBooleanAttributes?s+=` ${i.substr(e.attributeNamePrefix.length)}`:s+=` ${i.substr(e.attributeNamePrefix.length)}="${h(n)}"`}return s}function _(t){const e=Object.keys(t);for(let s=0;s0&&e.processEntities)for(let s=0;s","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function C(t){if(this.options=Object.assign({},E,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t{for(const s of e){if("string"==typeof s&&t===s)return!0;if(s instanceof RegExp&&s.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=V),this.processTextOrObjNode=k,this.options.format?(this.indentate=T,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function j(t,e,s,i,n){return s.sanitizeName?n(t)?t:s.sanitizeName(t,{isAttribute:e,matcher:i.readOnly()}):t}function k(t,e,s,i,n){const r=this.extractAttributes(t);if(i.push(e,r),this.checkStopNode(i)){const n=this.buildRawContent(t),r=this.buildAttributesForStopNode(t);return i.pop(),this.buildObjectNode(n,e,r,s)}const o=this.j2x(t,s+1,i,n);return i.pop(),"?"===e[0]?this.buildTextValNode("",e,o.attrStr,s,i):void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,o.attrStr,s,i):this.buildObjectNode(o.val,e,o.attrStr,s)}function T(t){return this.options.indentBy.repeat(t)}function V(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}C.prototype.build=function(t){if(this.options.preserveOrder)return x(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new n,s=function(t,e){const s=t["?xml"];if(s&&"object"==typeof s){if(e.attributesGroupName&&s[e.attributesGroupName]){const t=s[e.attributesGroupName][e.attributeNamePrefix+"version"];if(t)return t}const t=s[e.attributeNamePrefix+"version"];if(t)return t}return"1.0"}(t,this.options),i=b("qName",{xmlVersion:s});return this.j2x(t,0,e,i).val}},C.prototype.j2x=function(t,e,s,i){let n="",o="";if(this.options.maxNestedTags&&s.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const a=this.options.jPath?s.toString():s,h=this.checkStopNode(s);for(let p in t){if(!Object.prototype.hasOwnProperty.call(t,p))continue;const u=p===this.options.textNodeName||p===this.options.cdataPropName||p===this.options.commentPropName||this.options.attributesGroupName&&p===this.options.attributesGroupName||this.isAttribute(p)||"?"===p[0]?p:j(p,!1,this.options,s,i);if(void 0===t[p])this.isAttribute(p)&&(o+="");else if(null===t[p])this.isAttribute(p)||u===this.options.cdataPropName||u===this.options.commentPropName?o+="":"?"===u[0]?o+=this.indentate(e)+"<"+u+"?"+this.tagEndChar:o+=this.indentate(e)+"<"+u+"/"+this.tagEndChar;else if(t[p]instanceof Date)o+=this.buildTextValNode(t[p],u,"",e,s);else if("object"!=typeof t[p]){const l=this.isAttribute(p);if(l&&!this.ignoreAttributesFn(l,a)){const e=j(l,!0,this.options,s,i);n+=this.buildAttrPairStr(e,r(t[p]),h)}else if(!l)if(p===this.options.textNodeName){let e=this.options.tagValueProcessor(p,r(t[p]));o+=this.replaceEntitiesValue(e)}else{s.push(u);const i=this.checkStopNode(s);if(s.pop(),i){const s=r(t[p]);o+=""===s?this.indentate(e)+"<"+u+this.closeTag(u)+this.tagEndChar:this.indentate(e)+"<"+u+">"+s+""+t+"${t}`;else if("object"==typeof t&&null!==t){const i=this.buildRawContent(t),n=this.buildAttributesForStopNode(t);e+=""===i?`<${s}${n}/>`:`<${s}${n}>${i}`}}else if("object"==typeof i&&null!==i){const t=this.buildRawContent(i),n=this.buildAttributesForStopNode(i);e+=""===t?`<${s}${n}/>`:`<${s}${n}>${t}`}else e+=`<${s}>${i}`}return e},C.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const s=t[this.options.attributesGroupName];for(let t in s){if(!Object.prototype.hasOwnProperty.call(s,t))continue;const i=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,n=s[t];!0===n&&this.options.suppressBooleanAttributes?e+=" "+i:e+=" "+i+'="'+h(n)+'"'}}else for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;const i=this.isAttribute(s);if(i){const n=t[s];!0===n&&this.options.suppressBooleanAttributes?e+=" "+i:e+=" "+i+'="'+h(n)+'"'}}return e},C.prototype.buildObjectNode=function(t,e,s,i){if(""===t)return"?"===e[0]?this.indentate(i)+"<"+e+s+"?"+this.tagEndChar:this.indentate(i)+"<"+e+s+this.closeTag(e)+this.tagEndChar;if("?"===e[0])return this.indentate(i)+"<"+e+s+"?"+this.tagEndChar;{let n=""+t+n}},C.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`>`+this.newLine}if(!1!==this.options.commentPropName&&e===this.options.commentPropName){const e=o(t);return this.indentate(i)+`\x3c!--${e}--\x3e`+this.newLine}if("?"===e[0])return this.indentate(i)+"<"+e+s+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),n=r(n),""===n?this.indentate(i)+"<"+e+s+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+s+">"+n+"0&&this.options.processEntities)for(let e=0;e