@loaders.gl/xml 4.3.0-alpha.5 → 4.3.0-alpha.7

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/dist/dist.dev.js CHANGED
@@ -183,6 +183,8 @@ var __exports__ = (() => {
183
183
  return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
184
184
  } else if (attrStr.trim().length > 0) {
185
185
  return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
186
+ } else if (tags.length === 0) {
187
+ return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
186
188
  } else {
187
189
  const otg = tags.pop();
188
190
  if (tagName !== otg.tagName) {
@@ -719,7 +721,6 @@ var __exports__ = (() => {
719
721
  var xmlNode = require_xmlNode();
720
722
  var readDocType = require_DocTypeReader();
721
723
  var toNumber = require_strnum();
722
- var regx = "<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g, util.nameRegexp);
723
724
  var OrderedObjParser = class {
724
725
  constructor(options) {
725
726
  this.options = options;
@@ -746,7 +747,9 @@ var __exports__ = (() => {
746
747
  "euro": { regex: /&(euro|#8364);/g, val: "\u20AC" },
747
748
  "copyright": { regex: /&(copy|#169);/g, val: "\xA9" },
748
749
  "reg": { regex: /&(reg|#174);/g, val: "\xAE" },
749
- "inr": { regex: /&(inr|#8377);/g, val: "\u20B9" }
750
+ "inr": { regex: /&(inr|#8377);/g, val: "\u20B9" },
751
+ "num_dec": { regex: /&#([0-9]{1,7});/g, val: (_, str) => String.fromCharCode(Number.parseInt(str, 10)) },
752
+ "num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (_, str) => String.fromCharCode(Number.parseInt(str, 16)) }
750
753
  };
751
754
  this.addExternalEntities = addExternalEntities;
752
755
  this.parseXml = parseXml;
@@ -928,18 +931,19 @@ var __exports__ = (() => {
928
931
  const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
929
932
  const tagExp = xmlData.substring(i + 9, closeIndex);
930
933
  textData = this.saveTextToParentTag(textData, currentNode, jPath);
934
+ let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
935
+ if (val2 == void 0)
936
+ val2 = "";
931
937
  if (this.options.cdataPropName) {
932
938
  currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
933
939
  } else {
934
- let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true);
935
- if (val2 == void 0)
936
- val2 = "";
937
940
  currentNode.add(this.options.textNodeName, val2);
938
941
  }
939
942
  i = closeIndex + 2;
940
943
  } else {
941
944
  let result = readTagExp(xmlData, i, this.options.removeNSPrefix);
942
945
  let tagName = result.tagName;
946
+ const rawTagName = result.rawTagName;
943
947
  let tagExp = result.tagExp;
944
948
  let attrExpPresent = result.attrExpPresent;
945
949
  let closeIndex = result.closeIndex;
@@ -962,13 +966,20 @@ var __exports__ = (() => {
962
966
  if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
963
967
  let tagContent = "";
964
968
  if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
969
+ if (tagName[tagName.length - 1] === "/") {
970
+ tagName = tagName.substr(0, tagName.length - 1);
971
+ jPath = jPath.substr(0, jPath.length - 1);
972
+ tagExp = tagName;
973
+ } else {
974
+ tagExp = tagExp.substr(0, tagExp.length - 1);
975
+ }
965
976
  i = result.closeIndex;
966
977
  } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
967
978
  i = result.closeIndex;
968
979
  } else {
969
- const result2 = this.readStopNodeData(xmlData, tagName, closeIndex + 1);
980
+ const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
970
981
  if (!result2)
971
- throw new Error(`Unexpected end of ${tagName}`);
982
+ throw new Error(`Unexpected end of ${rawTagName}`);
972
983
  i = result2.i;
973
984
  tagContent = result2.tagContent;
974
985
  }
@@ -986,6 +997,7 @@ var __exports__ = (() => {
986
997
  if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
987
998
  if (tagName[tagName.length - 1] === "/") {
988
999
  tagName = tagName.substr(0, tagName.length - 1);
1000
+ jPath = jPath.substr(0, jPath.length - 1);
989
1001
  tagExp = tagName;
990
1002
  } else {
991
1003
  tagExp = tagExp.substr(0, tagExp.length - 1);
@@ -1123,9 +1135,10 @@ var __exports__ = (() => {
1123
1135
  let tagName = tagExp;
1124
1136
  let attrExpPresent = true;
1125
1137
  if (separatorIndex !== -1) {
1126
- tagName = tagExp.substr(0, separatorIndex).replace(/\s\s*$/, "");
1127
- tagExp = tagExp.substr(separatorIndex + 1);
1138
+ tagName = tagExp.substring(0, separatorIndex);
1139
+ tagExp = tagExp.substring(separatorIndex + 1).trimStart();
1128
1140
  }
1141
+ const rawTagName = tagName;
1129
1142
  if (removeNSPrefix) {
1130
1143
  const colonIndex = tagName.indexOf(":");
1131
1144
  if (colonIndex !== -1) {
@@ -1137,7 +1150,8 @@ var __exports__ = (() => {
1137
1150
  tagName,
1138
1151
  tagExp,
1139
1152
  closeIndex,
1140
- attrExpPresent
1153
+ attrExpPresent,
1154
+ rawTagName
1141
1155
  };
1142
1156
  }
1143
1157
  function readStopNodeData(xmlData, tagName, i) {
@@ -1375,6 +1389,8 @@ var __exports__ = (() => {
1375
1389
  for (let i = 0; i < arr.length; i++) {
1376
1390
  const tagObj = arr[i];
1377
1391
  const tagName = propName(tagObj);
1392
+ if (tagName === void 0)
1393
+ continue;
1378
1394
  let newJPath = "";
1379
1395
  if (jPath.length === 0)
1380
1396
  newJPath = tagName;
@@ -1445,6 +1461,8 @@ var __exports__ = (() => {
1445
1461
  const keys = Object.keys(obj);
1446
1462
  for (let i = 0; i < keys.length; i++) {
1447
1463
  const key = keys[i];
1464
+ if (!obj.hasOwnProperty(key))
1465
+ continue;
1448
1466
  if (key !== ":@")
1449
1467
  return key;
1450
1468
  }
@@ -1453,6 +1471,8 @@ var __exports__ = (() => {
1453
1471
  let attrStr = "";
1454
1472
  if (attrMap && !options.ignoreAttributes) {
1455
1473
  for (let attr in attrMap) {
1474
+ if (!attrMap.hasOwnProperty(attr))
1475
+ continue;
1456
1476
  let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
1457
1477
  attrVal = replaceEntitiesValue(attrVal, options);
1458
1478
  if (attrVal === true && options.suppressBooleanAttributes) {
@@ -1564,12 +1584,20 @@ var __exports__ = (() => {
1564
1584
  let attrStr = "";
1565
1585
  let val2 = "";
1566
1586
  for (let key in jObj) {
1587
+ if (!Object.prototype.hasOwnProperty.call(jObj, key))
1588
+ continue;
1567
1589
  if (typeof jObj[key] === "undefined") {
1590
+ if (this.isAttribute(key)) {
1591
+ val2 += "";
1592
+ }
1568
1593
  } else if (jObj[key] === null) {
1569
- if (key[0] === "?")
1594
+ if (this.isAttribute(key)) {
1595
+ val2 += "";
1596
+ } else if (key[0] === "?") {
1570
1597
  val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar;
1571
- else
1598
+ } else {
1572
1599
  val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
1600
+ }
1573
1601
  } else if (jObj[key] instanceof Date) {
1574
1602
  val2 += this.buildTextValNode(jObj[key], key, "", level);
1575
1603
  } else if (typeof jObj[key] !== "object") {
@@ -1587,6 +1615,7 @@ var __exports__ = (() => {
1587
1615
  } else if (Array.isArray(jObj[key])) {
1588
1616
  const arrLen = jObj[key].length;
1589
1617
  let listTagVal = "";
1618
+ let listTagAttr = "";
1590
1619
  for (let j = 0; j < arrLen; j++) {
1591
1620
  const item = jObj[key][j];
1592
1621
  if (typeof item === "undefined") {
@@ -1597,16 +1626,26 @@ var __exports__ = (() => {
1597
1626
  val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
1598
1627
  } else if (typeof item === "object") {
1599
1628
  if (this.options.oneListGroup) {
1600
- listTagVal += this.j2x(item, level + 1).val;
1629
+ const result = this.j2x(item, level + 1);
1630
+ listTagVal += result.val;
1631
+ if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {
1632
+ listTagAttr += result.attrStr;
1633
+ }
1601
1634
  } else {
1602
1635
  listTagVal += this.processTextOrObjNode(item, key, level);
1603
1636
  }
1604
1637
  } else {
1605
- listTagVal += this.buildTextValNode(item, key, "", level);
1638
+ if (this.options.oneListGroup) {
1639
+ let textValue = this.options.tagValueProcessor(key, item);
1640
+ textValue = this.replaceEntitiesValue(textValue);
1641
+ listTagVal += textValue;
1642
+ } else {
1643
+ listTagVal += this.buildTextValNode(item, key, "", level);
1644
+ }
1606
1645
  }
1607
1646
  }
1608
1647
  if (this.options.oneListGroup) {
1609
- listTagVal = this.buildObjectNode(listTagVal, key, "", level);
1648
+ listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);
1610
1649
  }
1611
1650
  val2 += listTagVal;
1612
1651
  } else {
@@ -1653,7 +1692,7 @@ var __exports__ = (() => {
1653
1692
  piClosingChar = "?";
1654
1693
  tagEndExp = "";
1655
1694
  }
1656
- if (attrStr && val2.indexOf("<") === -1) {
1695
+ if ((attrStr || attrStr === "") && val2.indexOf("<") === -1) {
1657
1696
  return this.indentate(level) + "<" + key + attrStr + piClosingChar + ">" + val2 + tagEndExp;
1658
1697
  } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {
1659
1698
  return this.indentate(level) + `<!--${val2}-->` + this.newLine;
@@ -1704,7 +1743,7 @@ var __exports__ = (() => {
1704
1743
  return this.options.indentBy.repeat(level);
1705
1744
  }
1706
1745
  function isAttribute(name) {
1707
- if (name.startsWith(this.options.attributeNamePrefix)) {
1746
+ if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {
1708
1747
  return name.substr(this.attrPrefixLen);
1709
1748
  } else {
1710
1749
  return false;
package/dist/dist.min.js CHANGED
@@ -4,20 +4,20 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['loaders'] = factory();
6
6
  else root['loaders'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var vt=Object.create;var C=Object.defineProperty;var Ut=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var $t=Object.getPrototypeOf,qt=Object.prototype.hasOwnProperty;var Wt=(e,t,i)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kt=(e,t)=>{for(var i in t)C(e,i,{get:t[i],enumerable:!0})},M=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Gt(t))!qt.call(e,r)&&r!==i&&C(e,r,{get:()=>t[r],enumerable:!(s=Ut(t,r))||s.enumerable});return e},B=(e,t,i)=>(M(e,t,"default"),i&&M(i,t,"default")),Z=(e,t,i)=>(i=e!=null?vt($t(e)):{},M(t||!e||!e.__esModule?C(i,"default",{value:e,enumerable:!0}):i,e)),Yt=e=>M(C({},"__esModule",{value:!0}),e);var J=(e,t,i)=>(Wt(e,typeof t!="symbol"?t+"":t,i),i);var D=m((cs,j)=>{j.exports=globalThis.loaders});var R=m(E=>{"use strict";var et=":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",Zt=et+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",st="["+et+"]["+Zt+"]*",Jt=new RegExp("^"+st+"$"),jt=function(e,t){let i=[],s=t.exec(e);for(;s;){let r=[];r.startIndex=t.lastIndex-s[0].length;let n=s.length;for(let h=0;h<n;h++)r.push(s[h]);i.push(r),s=t.exec(e)}return i},Dt=function(e){let t=Jt.exec(e);return!(t===null||typeof t>"u")};E.isExist=function(e){return typeof e<"u"};E.isEmptyObject=function(e){return Object.keys(e).length===0};E.merge=function(e,t,i){if(t){let s=Object.keys(t),r=s.length;for(let n=0;n<r;n++)i==="strict"?e[s[n]]=[t[s[n]]]:e[s[n]]=t[s[n]]}};E.getValue=function(e){return E.isExist(e)?e:""};E.isName=Dt;E.getAllMatches=jt;E.nameRegexp=st});var G=m(at=>{"use strict";var U=R(),te={allowBooleanAttributes:!1,unpairedTags:[]};at.validate=function(e,t){t=Object.assign({},te,t);let i=[],s=!1,r=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let n=0;n<e.length;n++)if(e[n]==="<"&&e[n+1]==="?"){if(n+=2,n=rt(e,n),n.err)return n}else if(e[n]==="<"){let h=n;if(n++,e[n]==="!"){n=nt(e,n);continue}else{let a=!1;e[n]==="/"&&(a=!0,n++);let o="";for(;n<e.length&&e[n]!==">"&&e[n]!==" "&&e[n]!==" "&&e[n]!==`
8
- `&&e[n]!=="\r";n++)o+=e[n];if(o=o.trim(),o[o.length-1]==="/"&&(o=o.substring(0,o.length-1),n--),!he(o)){let f;return o.trim().length===0?f="Invalid space after '<'.":f="Tag '"+o+"' is an invalid name.",d("InvalidTag",f,T(e,n))}let c=ie(e,n);if(c===!1)return d("InvalidAttr","Attributes for '"+o+"' have open quote.",T(e,n));let u=c.value;if(n=c.index,u[u.length-1]==="/"){let f=n-u.length;u=u.substring(0,u.length-1);let g=ot(u,t);if(g===!0)s=!0;else return d(g.err.code,g.err.msg,T(e,f+g.err.line))}else if(a)if(c.tagClosed){if(u.trim().length>0)return d("InvalidTag","Closing tag '"+o+"' can't have attributes or invalid starting.",T(e,h));{let f=i.pop();if(o!==f.tagName){let g=T(e,f.tagStartPos);return d("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+g.line+", col "+g.col+") instead of closing tag '"+o+"'.",T(e,h))}i.length==0&&(r=!0)}}else return d("InvalidTag","Closing tag '"+o+"' doesn't have proper closing.",T(e,n));else{let f=ot(u,t);if(f!==!0)return d(f.err.code,f.err.msg,T(e,n-u.length+f.err.line));if(r===!0)return d("InvalidXml","Multiple possible root nodes found.",T(e,n));t.unpairedTags.indexOf(o)!==-1||i.push({tagName:o,tagStartPos:h}),s=!0}for(n++;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="!"){n++,n=nt(e,n);continue}else if(e[n+1]==="?"){if(n=rt(e,++n),n.err)return n}else break;else if(e[n]==="&"){let f=oe(e,n);if(f==-1)return d("InvalidChar","char '&' is not expected.",T(e,n));n=f}else if(r===!0&&!it(e[n]))return d("InvalidXml","Extra text at the end",T(e,n));e[n]==="<"&&n--}}else{if(it(e[n]))continue;return d("InvalidChar","char '"+e[n]+"' is not expected.",T(e,n))}if(s){if(i.length==1)return d("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",T(e,i[0].tagStartPos));if(i.length>0)return d("InvalidXml","Invalid '"+JSON.stringify(i.map(n=>n.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return d("InvalidXml","Start tag expected.",1);return!0};function it(e){return e===" "||e===" "||e===`
9
- `||e==="\r"}function rt(e,t){let i=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let s=e.substr(i,t-i);if(t>5&&s==="xml")return d("InvalidXml","XML declaration allowed only at the start of the document.",T(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function nt(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let i=1;for(t+=8;t<e.length;t++)if(e[t]==="<")i++;else if(e[t]===">"&&(i--,i===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}var ee='"',se="'";function ie(e,t){let i="",s="",r=!1;for(;t<e.length;t++){if(e[t]===ee||e[t]===se)s===""?s=e[t]:s!==e[t]||(s="");else if(e[t]===">"&&s===""){r=!0;break}i+=e[t]}return s!==""?!1:{value:i,index:t,tagClosed:r}}var re=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function ot(e,t){let i=U.getAllMatches(e,re),s={};for(let r=0;r<i.length;r++){if(i[r][1].length===0)return d("InvalidAttr","Attribute '"+i[r][2]+"' has no space in starting.",_(i[r]));if(i[r][3]!==void 0&&i[r][4]===void 0)return d("InvalidAttr","Attribute '"+i[r][2]+"' is without value.",_(i[r]));if(i[r][3]===void 0&&!t.allowBooleanAttributes)return d("InvalidAttr","boolean attribute '"+i[r][2]+"' is not allowed.",_(i[r]));let n=i[r][2];if(!ae(n))return d("InvalidAttr","Attribute '"+n+"' is an invalid name.",_(i[r]));if(!s.hasOwnProperty(n))s[n]=1;else return d("InvalidAttr","Attribute '"+n+"' is repeated.",_(i[r]))}return!0}function ne(e,t){let i=/\d/;for(e[t]==="x"&&(t++,i=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(i))break}return-1}function oe(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,ne(e,t);let i=0;for(;t<e.length;t++,i++)if(!(e[t].match(/\w/)&&i<20)){if(e[t]===";")break;return-1}return t}function d(e,t,i){return{err:{code:e,msg:t,line:i.line||i,col:i.col}}}function ae(e){return U.isName(e)}function he(e){return U.isName(e)}function T(e,t){let i=e.substring(0,t).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function _(e){return e.startIndex+e[1].length}});var ct=m($=>{var ht={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,i){return e}},ce=function(e){return Object.assign({},ht,e)};$.buildOptions=ce;$.defaultOptions=ht});var ut=m((Ns,lt)=>{"use strict";var q=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,i){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:i})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,[":@"]:t[":@"]}):this.child.push({[t.tagname]:t.child})}};lt.exports=q});var pt=m((Ts,ft)=>{var le=R();function ue(e,t){let i={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let s=1,r=!1,n=!1,h="";for(;t<e.length;t++)if(e[t]==="<"&&!n){if(r&&de(e,t))t+=7,[entityName,val,t]=fe(e,t+1),val.indexOf("&")===-1&&(i[me(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(r&&ge(e,t))t+=8;else if(r&&Ne(e,t))t+=8;else if(r&&Te(e,t))t+=9;else if(pe)n=!0;else throw new Error("Invalid DOCTYPE");s++,h=""}else if(e[t]===">"){if(n?e[t-1]==="-"&&e[t-2]==="-"&&(n=!1,s--):s--,s===0)break}else e[t]==="["?r=!0:h+=e[t];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:i,i:t}}function fe(e,t){let i="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)i+=e[t];if(i=i.trim(),i.indexOf(" ")!==-1)throw new Error("External entites are not supported");let s=e[t++],r="";for(;t<e.length&&e[t]!==s;t++)r+=e[t];return[i,r,t]}function pe(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function de(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="N"&&e[t+4]==="T"&&e[t+5]==="I"&&e[t+6]==="T"&&e[t+7]==="Y"}function ge(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="L"&&e[t+4]==="E"&&e[t+5]==="M"&&e[t+6]==="E"&&e[t+7]==="N"&&e[t+8]==="T"}function Ne(e,t){return e[t+1]==="!"&&e[t+2]==="A"&&e[t+3]==="T"&&e[t+4]==="T"&&e[t+5]==="L"&&e[t+6]==="I"&&e[t+7]==="S"&&e[t+8]==="T"}function Te(e,t){return e[t+1]==="!"&&e[t+2]==="N"&&e[t+3]==="O"&&e[t+4]==="T"&&e[t+5]==="A"&&e[t+6]==="T"&&e[t+7]==="I"&&e[t+8]==="O"&&e[t+9]==="N"}function me(e){if(le.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}ft.exports=ue});var gt=m((ms,dt)=>{var Ee=/^[-+]?0x[a-fA-F0-9]+$/,Se=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var be={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Ae(e,t={}){if(t=Object.assign({},be,t),!e||typeof e!="string")return e;let i=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(i))return e;if(t.hex&&Ee.test(i))return Number.parseInt(i,16);{let s=Se.exec(i);if(s){let r=s[1],n=s[2],h=Ie(s[3]),a=s[4]||s[6];if(!t.leadingZeros&&n.length>0&&r&&i[2]!==".")return e;if(!t.leadingZeros&&n.length>0&&!r&&i[1]!==".")return e;{let o=Number(i),c=""+o;return c.search(/[eE]/)!==-1||a?t.eNotation?o:e:i.indexOf(".")!==-1?c==="0"&&h===""||c===h||r&&c==="-"+h?o:e:n?h===c||r+h===c?o:e:i===c||i===r+c?o:e}}else return e}}function Ie(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substr(0,e.length-1))),e}dt.exports=Ae});var Tt=m((Ss,Nt)=>{"use strict";var X=R(),P=ut(),ye=pt(),xe=gt(),Es="<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,X.nameRegexp),W=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"}},this.addExternalEntities=Ce,this.parseXml=we,this.parseTextData=Fe,this.resolveNameSpace=Oe,this.buildAttributesMap=Pe,this.isItStopNode=Re,this.replaceEntitiesValue=Me,this.readStopNodeData=ve,this.saveTextToParentTag=Be,this.addChild=Le}};function Ce(e){let t=Object.keys(e);for(let i=0;i<t.length;i++){let s=t[i];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:e[s]}}}function Fe(e,t,i,s,r,n,h){if(e!==void 0&&(this.options.trimValues&&!s&&(e=e.trim()),e.length>0)){h||(e=this.replaceEntitiesValue(e));let a=this.options.tagValueProcessor(t,e,i,r,n);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?Y(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Y(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Oe(e){if(this.options.removeNSPrefix){let t=e.split(":"),i=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=i+t[1])}return e}var _e=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Pe(e,t,i){if(!this.options.ignoreAttributes&&typeof e=="string"){let s=X.getAllMatches(e,_e),r=s.length,n={};for(let h=0;h<r;h++){let a=this.resolveNameSpace(s[h][1]),o=s[h][4],c=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(c=this.options.transformAttributeName(c)),c==="__proto__"&&(c="#__proto__"),o!==void 0){this.options.trimValues&&(o=o.trim()),o=this.replaceEntitiesValue(o);let u=this.options.attributeValueProcessor(a,o,t);u==null?n[c]=o:typeof u!=typeof o||u!==o?n[c]=u:n[c]=Y(o,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(n[c]=!0)}if(!Object.keys(n).length)return;if(this.options.attributesGroupName){let h={};return h[this.options.attributesGroupName]=n,h}return n}}var we=function(e){e=e.replace(/\r\n?/g,`
10
- `);let t=new P("!xml"),i=t,s="",r="";for(let n=0;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){let a=A(e,">",n,"Closing Tag is not closed."),o=e.substring(n+2,a).trim();if(this.options.removeNSPrefix){let f=o.indexOf(":");f!==-1&&(o=o.substr(f+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&(s=this.saveTextToParentTag(s,i,r));let c=r.substring(r.lastIndexOf(".")+1);if(o&&this.options.unpairedTags.indexOf(o)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let u=0;c&&this.options.unpairedTags.indexOf(c)!==-1?(u=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):u=r.lastIndexOf("."),r=r.substring(0,u),i=this.tagsNodeStack.pop(),s="",n=a}else if(e[n+1]==="?"){let a=k(e,n,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,i,r),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){let o=new P(a.tagName);o.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(o[":@"]=this.buildAttributesMap(a.tagExp,r,a.tagName)),this.addChild(i,o,r)}n=a.closeIndex+1}else if(e.substr(n+1,3)==="!--"){let a=A(e,"-->",n+4,"Comment is not closed.");if(this.options.commentPropName){let o=e.substring(n+4,a-2);s=this.saveTextToParentTag(s,i,r),i.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}n=a}else if(e.substr(n+1,2)==="!D"){let a=ye(e,n);this.docTypeEntities=a.entities,n=a.i}else if(e.substr(n+1,2)==="!["){let a=A(e,"]]>",n,"CDATA is not closed.")-2,o=e.substring(n+9,a);if(s=this.saveTextToParentTag(s,i,r),this.options.cdataPropName)i.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]);else{let c=this.parseTextData(o,i.tagname,r,!0,!1,!0);c==null&&(c=""),i.add(this.options.textNodeName,c)}n=a+2}else{let a=k(e,n,this.options.removeNSPrefix),o=a.tagName,c=a.tagExp,u=a.attrExpPresent,f=a.closeIndex;this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&s&&i.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,i,r,!1));let g=i;if(g&&this.options.unpairedTags.indexOf(g.tagname)!==-1&&(i=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),o!==t.tagname&&(r+=r?"."+o:o),this.isItStopNode(this.options.stopNodes,r,o)){let p="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)n=a.closeIndex;else if(this.options.unpairedTags.indexOf(o)!==-1)n=a.closeIndex;else{let x=this.readStopNodeData(e,o,f+1);if(!x)throw new Error(`Unexpected end of ${o}`);n=x.i,p=x.tagContent}let N=new P(o);o!==c&&u&&(N[":@"]=this.buildAttributesMap(c,r,o)),p&&(p=this.parseTextData(p,o,r,!0,u,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),N.add(this.options.textNodeName,p),this.addChild(i,N,r)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){o[o.length-1]==="/"?(o=o.substr(0,o.length-1),c=o):c=c.substr(0,c.length-1),this.options.transformTagName&&(o=this.options.transformTagName(o));let p=new P(o);o!==c&&u&&(p[":@"]=this.buildAttributesMap(c,r,o)),this.addChild(i,p,r),r=r.substr(0,r.lastIndexOf("."))}else{let p=new P(o);this.tagsNodeStack.push(i),o!==c&&u&&(p[":@"]=this.buildAttributesMap(c,r,o)),this.addChild(i,p,r),i=p}s="",n=f}}else s+=e[n];return t.child};function Le(e,t,i){let s=this.options.updateTag(t.tagname,i,t[":@"]);s===!1||(typeof s=="string"&&(t.tagname=s),e.addChild(t))}var Me=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){let i=this.docTypeEntities[t];e=e.replace(i.regx,i.val)}for(let t in this.lastEntities){let i=this.lastEntities[t];e=e.replace(i.regex,i.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){let i=this.htmlEntities[t];e=e.replace(i.regex,i.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function Be(e,t,i,s){return e&&(s===void 0&&(s=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,i,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,s),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function Re(e,t,i){let s="*."+i;for(let r in e){let n=e[r];if(s===n||t===n)return!0}return!1}function Ve(e,t,i=">"){let s,r="";for(let n=t;n<e.length;n++){let h=e[n];if(s)h===s&&(s="");else if(h==='"'||h==="'")s=h;else if(h===i[0])if(i[1]){if(e[n+1]===i[1])return{data:r,index:n}}else return{data:r,index:n};else h===" "&&(h=" ");r+=h}}function A(e,t,i,s){let r=e.indexOf(t,i);if(r===-1)throw new Error(s);return r+t.length-1}function k(e,t,i,s=">"){let r=Ve(e,t+1,s);if(!r)return;let n=r.data,h=r.index,a=n.search(/\s/),o=n,c=!0;if(a!==-1&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1)),i){let u=o.indexOf(":");u!==-1&&(o=o.substr(u+1),c=o!==r.data.substr(u+1))}return{tagName:o,tagExp:n,closeIndex:h,attrExpPresent:c}}function ve(e,t,i){let s=i,r=1;for(;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){let n=A(e,">",i,`${t} is not closed`);if(e.substring(i+2,n).trim()===t&&(r--,r===0))return{tagContent:e.substring(s,i),i:n};i=n}else if(e[i+1]==="?")i=A(e,"?>",i+1,"StopNode is not closed.");else if(e.substr(i+1,3)==="!--")i=A(e,"-->",i+3,"StopNode is not closed.");else if(e.substr(i+1,2)==="![")i=A(e,"]]>",i,"StopNode is not closed.")-2;else{let n=k(e,i,">");n&&((n&&n.tagName)===t&&n.tagExp[n.tagExp.length-1]!=="/"&&r++,i=n.closeIndex)}}function Y(e,t,i){if(t&&typeof e=="string"){let s=e.trim();return s==="true"?!0:s==="false"?!1:xe(e,i)}else return X.isExist(e)?e:""}Nt.exports=W});var St=m(Et=>{"use strict";function Ue(e,t){return mt(e,t)}function mt(e,t,i){let s,r={};for(let n=0;n<e.length;n++){let h=e[n],a=Ge(h),o="";if(i===void 0?o=a:o=i+"."+a,a===t.textNodeName)s===void 0?s=h[a]:s+=""+h[a];else{if(a===void 0)continue;if(h[a]){let c=mt(h[a],t,o),u=qe(c,t);h[":@"]?$e(c,h[":@"],o,t):Object.keys(c).length===1&&c[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?c=c[t.textNodeName]:Object.keys(c).length===0&&(t.alwaysCreateTextNode?c[t.textNodeName]="":c=""),r[a]!==void 0&&r.hasOwnProperty(a)?(Array.isArray(r[a])||(r[a]=[r[a]]),r[a].push(c)):t.isArray(a,o,u)?r[a]=[c]:r[a]=c}}}return typeof s=="string"?s.length>0&&(r[t.textNodeName]=s):s!==void 0&&(r[t.textNodeName]=s),r}function Ge(e){let t=Object.keys(e);for(let i=0;i<t.length;i++){let s=t[i];if(s!==":@")return s}}function $e(e,t,i,s){if(t){let r=Object.keys(t),n=r.length;for(let h=0;h<n;h++){let a=r[h];s.isArray(a,i+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function qe(e,t){let{textNodeName:i}=t,s=Object.keys(e).length;return!!(s===0||s===1&&(e[i]||typeof e[i]=="boolean"||e[i]===0))}Et.prettify=Ue});var At=m((As,bt)=>{var{buildOptions:We}=ct(),ke=Tt(),{prettify:Ye}=St(),Xe=G(),Q=class{constructor(t){this.externalEntities={},this.options=We(t)}parse(t,i){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(i){i===!0&&(i={});let n=Xe.validate(t,i);if(n!==!0)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}let s=new ke(this.options);s.addExternalEntities(this.externalEntities);let r=s.parseXml(t);return this.options.preserveOrder||r===void 0?r:Ye(r,this.options)}addEntity(t,i){if(i.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(i==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=i}};bt.exports=Q});var Ft=m((Is,Ct)=>{var Qe=`
11
- `;function He(e,t){let i="";return t.format&&t.indentBy.length>0&&(i=Qe),yt(e,t,"",i)}function yt(e,t,i,s){let r="",n=!1;for(let h=0;h<e.length;h++){let a=e[h],o=ze(a),c="";if(i.length===0?c=o:c=`${i}.${o}`,o===t.textNodeName){let N=a[o];Ke(c,t)||(N=t.tagValueProcessor(o,N),N=xt(N,t)),n&&(r+=s),r+=N,n=!1;continue}else if(o===t.cdataPropName){n&&(r+=s),r+=`<![CDATA[${a[o][0][t.textNodeName]}]]>`,n=!1;continue}else if(o===t.commentPropName){r+=s+`<!--${a[o][0][t.textNodeName]}-->`,n=!0;continue}else if(o[0]==="?"){let N=It(a[":@"],t),x=o==="?xml"?"":s,L=a[o][0][t.textNodeName];L=L.length!==0?" "+L:"",r+=x+`<${o}${L}${N}?>`,n=!0;continue}let u=s;u!==""&&(u+=t.indentBy);let f=It(a[":@"],t),g=s+`<${o}${f}`,p=yt(a[o],t,c,u);t.unpairedTags.indexOf(o)!==-1?t.suppressUnpairedNode?r+=g+">":r+=g+"/>":(!p||p.length===0)&&t.suppressEmptyNode?r+=g+"/>":p&&p.endsWith(">")?r+=g+`>${p}${s}</${o}>`:(r+=g+">",p&&s!==""&&(p.includes("/>")||p.includes("</"))?r+=s+t.indentBy+p+s:r+=p,r+=`</${o}>`),n=!0}return r}function ze(e){let t=Object.keys(e);for(let i=0;i<t.length;i++){let s=t[i];if(s!==":@")return s}}function It(e,t){let i="";if(e&&!t.ignoreAttributes)for(let s in e){let r=t.attributeValueProcessor(s,e[s]);r=xt(r,t),r===!0&&t.suppressBooleanAttributes?i+=` ${s.substr(t.attributeNamePrefix.length)}`:i+=` ${s.substr(t.attributeNamePrefix.length)}="${r}"`}return i}function Ke(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let i=e.substr(e.lastIndexOf(".")+1);for(let s in t.stopNodes)if(t.stopNodes[s]===e||t.stopNodes[s]==="*."+i)return!0;return!1}function xt(e,t){if(e&&e.length>0&&t.processEntities)for(let i=0;i<t.entities.length;i++){let s=t.entities[i];e=e.replace(s.regex,s.val)}return e}Ct.exports=He});var _t=m((ys,Ot)=>{"use strict";var Ze=Ft(),Je={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function S(e){this.options=Object.assign({},Je,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ts),this.processTextOrObjNode=je,this.options.format?(this.indentate=De,this.tagEndChar=`>
7
+ "use strict";var __exports__=(()=>{var vt=Object.create;var F=Object.defineProperty;var Ut=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var $t=Object.getPrototypeOf,qt=Object.prototype.hasOwnProperty;var Wt=(e,t,i)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kt=(e,t)=>{for(var i in t)F(e,i,{get:t[i],enumerable:!0})},B=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Gt(t))!qt.call(e,r)&&r!==i&&F(e,r,{get:()=>t[r],enumerable:!(s=Ut(t,r))||s.enumerable});return e},M=(e,t,i)=>(B(e,t,"default"),i&&B(i,t,"default")),K=(e,t,i)=>(i=e!=null?vt($t(e)):{},B(t||!e||!e.__esModule?F(i,"default",{value:e,enumerable:!0}):i,e)),Yt=e=>B(F({},"__esModule",{value:!0}),e);var Z=(e,t,i)=>(Wt(e,typeof t!="symbol"?t+"":t,i),i);var j=m((cs,J)=>{J.exports=globalThis.loaders});var R=m(E=>{"use strict";var tt=":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",Zt=tt+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",et="["+tt+"]["+Zt+"]*",Jt=new RegExp("^"+et+"$"),jt=function(e,t){let i=[],s=t.exec(e);for(;s;){let r=[];r.startIndex=t.lastIndex-s[0].length;let n=s.length;for(let h=0;h<n;h++)r.push(s[h]);i.push(r),s=t.exec(e)}return i},Dt=function(e){let t=Jt.exec(e);return!(t===null||typeof t>"u")};E.isExist=function(e){return typeof e<"u"};E.isEmptyObject=function(e){return Object.keys(e).length===0};E.merge=function(e,t,i){if(t){let s=Object.keys(t),r=s.length;for(let n=0;n<r;n++)i==="strict"?e[s[n]]=[t[s[n]]]:e[s[n]]=t[s[n]]}};E.getValue=function(e){return E.isExist(e)?e:""};E.isName=Dt;E.getAllMatches=jt;E.nameRegexp=et});var G=m(ot=>{"use strict";var U=R(),te={allowBooleanAttributes:!1,unpairedTags:[]};ot.validate=function(e,t){t=Object.assign({},te,t);let i=[],s=!1,r=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let n=0;n<e.length;n++)if(e[n]==="<"&&e[n+1]==="?"){if(n+=2,n=it(e,n),n.err)return n}else if(e[n]==="<"){let h=n;if(n++,e[n]==="!"){n=rt(e,n);continue}else{let a=!1;e[n]==="/"&&(a=!0,n++);let o="";for(;n<e.length&&e[n]!==">"&&e[n]!==" "&&e[n]!==" "&&e[n]!==`
8
+ `&&e[n]!=="\r";n++)o+=e[n];if(o=o.trim(),o[o.length-1]==="/"&&(o=o.substring(0,o.length-1),n--),!he(o)){let u;return o.trim().length===0?u="Invalid space after '<'.":u="Tag '"+o+"' is an invalid name.",d("InvalidTag",u,T(e,n))}let c=ie(e,n);if(c===!1)return d("InvalidAttr","Attributes for '"+o+"' have open quote.",T(e,n));let l=c.value;if(n=c.index,l[l.length-1]==="/"){let u=n-l.length;l=l.substring(0,l.length-1);let g=nt(l,t);if(g===!0)s=!0;else return d(g.err.code,g.err.msg,T(e,u+g.err.line))}else if(a)if(c.tagClosed){if(l.trim().length>0)return d("InvalidTag","Closing tag '"+o+"' can't have attributes or invalid starting.",T(e,h));if(i.length===0)return d("InvalidTag","Closing tag '"+o+"' has not been opened.",T(e,h));{let u=i.pop();if(o!==u.tagName){let g=T(e,u.tagStartPos);return d("InvalidTag","Expected closing tag '"+u.tagName+"' (opened in line "+g.line+", col "+g.col+") instead of closing tag '"+o+"'.",T(e,h))}i.length==0&&(r=!0)}}else return d("InvalidTag","Closing tag '"+o+"' doesn't have proper closing.",T(e,n));else{let u=nt(l,t);if(u!==!0)return d(u.err.code,u.err.msg,T(e,n-l.length+u.err.line));if(r===!0)return d("InvalidXml","Multiple possible root nodes found.",T(e,n));t.unpairedTags.indexOf(o)!==-1||i.push({tagName:o,tagStartPos:h}),s=!0}for(n++;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="!"){n++,n=rt(e,n);continue}else if(e[n+1]==="?"){if(n=it(e,++n),n.err)return n}else break;else if(e[n]==="&"){let u=oe(e,n);if(u==-1)return d("InvalidChar","char '&' is not expected.",T(e,n));n=u}else if(r===!0&&!st(e[n]))return d("InvalidXml","Extra text at the end",T(e,n));e[n]==="<"&&n--}}else{if(st(e[n]))continue;return d("InvalidChar","char '"+e[n]+"' is not expected.",T(e,n))}if(s){if(i.length==1)return d("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",T(e,i[0].tagStartPos));if(i.length>0)return d("InvalidXml","Invalid '"+JSON.stringify(i.map(n=>n.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return d("InvalidXml","Start tag expected.",1);return!0};function st(e){return e===" "||e===" "||e===`
9
+ `||e==="\r"}function it(e,t){let i=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let s=e.substr(i,t-i);if(t>5&&s==="xml")return d("InvalidXml","XML declaration allowed only at the start of the document.",T(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function rt(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let i=1;for(t+=8;t<e.length;t++)if(e[t]==="<")i++;else if(e[t]===">"&&(i--,i===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}var ee='"',se="'";function ie(e,t){let i="",s="",r=!1;for(;t<e.length;t++){if(e[t]===ee||e[t]===se)s===""?s=e[t]:s!==e[t]||(s="");else if(e[t]===">"&&s===""){r=!0;break}i+=e[t]}return s!==""?!1:{value:i,index:t,tagClosed:r}}var re=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function nt(e,t){let i=U.getAllMatches(e,re),s={};for(let r=0;r<i.length;r++){if(i[r][1].length===0)return d("InvalidAttr","Attribute '"+i[r][2]+"' has no space in starting.",P(i[r]));if(i[r][3]!==void 0&&i[r][4]===void 0)return d("InvalidAttr","Attribute '"+i[r][2]+"' is without value.",P(i[r]));if(i[r][3]===void 0&&!t.allowBooleanAttributes)return d("InvalidAttr","boolean attribute '"+i[r][2]+"' is not allowed.",P(i[r]));let n=i[r][2];if(!ae(n))return d("InvalidAttr","Attribute '"+n+"' is an invalid name.",P(i[r]));if(!s.hasOwnProperty(n))s[n]=1;else return d("InvalidAttr","Attribute '"+n+"' is repeated.",P(i[r]))}return!0}function ne(e,t){let i=/\d/;for(e[t]==="x"&&(t++,i=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(i))break}return-1}function oe(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,ne(e,t);let i=0;for(;t<e.length;t++,i++)if(!(e[t].match(/\w/)&&i<20)){if(e[t]===";")break;return-1}return t}function d(e,t,i){return{err:{code:e,msg:t,line:i.line||i,col:i.col}}}function ae(e){return U.isName(e)}function he(e){return U.isName(e)}function T(e,t){let i=e.substring(0,t).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function P(e){return e.startIndex+e[1].length}});var ht=m($=>{var at={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,i){return e}},ce=function(e){return Object.assign({},at,e)};$.buildOptions=ce;$.defaultOptions=at});var lt=m((Ns,ct)=>{"use strict";var q=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,i){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:i})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,[":@"]:t[":@"]}):this.child.push({[t.tagname]:t.child})}};ct.exports=q});var ft=m((Ts,ut)=>{var le=R();function ue(e,t){let i={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let s=1,r=!1,n=!1,h="";for(;t<e.length;t++)if(e[t]==="<"&&!n){if(r&&de(e,t))t+=7,[entityName,val,t]=fe(e,t+1),val.indexOf("&")===-1&&(i[me(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(r&&ge(e,t))t+=8;else if(r&&Ne(e,t))t+=8;else if(r&&Te(e,t))t+=9;else if(pe)n=!0;else throw new Error("Invalid DOCTYPE");s++,h=""}else if(e[t]===">"){if(n?e[t-1]==="-"&&e[t-2]==="-"&&(n=!1,s--):s--,s===0)break}else e[t]==="["?r=!0:h+=e[t];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:i,i:t}}function fe(e,t){let i="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)i+=e[t];if(i=i.trim(),i.indexOf(" ")!==-1)throw new Error("External entites are not supported");let s=e[t++],r="";for(;t<e.length&&e[t]!==s;t++)r+=e[t];return[i,r,t]}function pe(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function de(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="N"&&e[t+4]==="T"&&e[t+5]==="I"&&e[t+6]==="T"&&e[t+7]==="Y"}function ge(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="L"&&e[t+4]==="E"&&e[t+5]==="M"&&e[t+6]==="E"&&e[t+7]==="N"&&e[t+8]==="T"}function Ne(e,t){return e[t+1]==="!"&&e[t+2]==="A"&&e[t+3]==="T"&&e[t+4]==="T"&&e[t+5]==="L"&&e[t+6]==="I"&&e[t+7]==="S"&&e[t+8]==="T"}function Te(e,t){return e[t+1]==="!"&&e[t+2]==="N"&&e[t+3]==="O"&&e[t+4]==="T"&&e[t+5]==="A"&&e[t+6]==="T"&&e[t+7]==="I"&&e[t+8]==="O"&&e[t+9]==="N"}function me(e){if(le.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}ut.exports=ue});var dt=m((ms,pt)=>{var Ee=/^[-+]?0x[a-fA-F0-9]+$/,be=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var Se={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Ae(e,t={}){if(t=Object.assign({},Se,t),!e||typeof e!="string")return e;let i=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(i))return e;if(t.hex&&Ee.test(i))return Number.parseInt(i,16);{let s=be.exec(i);if(s){let r=s[1],n=s[2],h=Ie(s[3]),a=s[4]||s[6];if(!t.leadingZeros&&n.length>0&&r&&i[2]!==".")return e;if(!t.leadingZeros&&n.length>0&&!r&&i[1]!==".")return e;{let o=Number(i),c=""+o;return c.search(/[eE]/)!==-1||a?t.eNotation?o:e:i.indexOf(".")!==-1?c==="0"&&h===""||c===h||r&&c==="-"+h?o:e:n?h===c||r+h===c?o:e:i===c||i===r+c?o:e}}else return e}}function Ie(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substr(0,e.length-1))),e}pt.exports=Ae});var Tt=m((Es,Nt)=>{"use strict";var gt=R(),w=lt(),ye=ft(),xe=dt(),W=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(i,s)=>String.fromCharCode(Number.parseInt(s,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(i,s)=>String.fromCharCode(Number.parseInt(s,16))}},this.addExternalEntities=Ce,this.parseXml=we,this.parseTextData=Fe,this.resolveNameSpace=Oe,this.buildAttributesMap=Pe,this.isItStopNode=Re,this.replaceEntitiesValue=Be,this.readStopNodeData=ve,this.saveTextToParentTag=Me,this.addChild=Le}};function Ce(e){let t=Object.keys(e);for(let i=0;i<t.length;i++){let s=t[i];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:e[s]}}}function Fe(e,t,i,s,r,n,h){if(e!==void 0&&(this.options.trimValues&&!s&&(e=e.trim()),e.length>0)){h||(e=this.replaceEntitiesValue(e));let a=this.options.tagValueProcessor(t,e,i,r,n);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?Y(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Y(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Oe(e){if(this.options.removeNSPrefix){let t=e.split(":"),i=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=i+t[1])}return e}var _e=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Pe(e,t,i){if(!this.options.ignoreAttributes&&typeof e=="string"){let s=gt.getAllMatches(e,_e),r=s.length,n={};for(let h=0;h<r;h++){let a=this.resolveNameSpace(s[h][1]),o=s[h][4],c=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(c=this.options.transformAttributeName(c)),c==="__proto__"&&(c="#__proto__"),o!==void 0){this.options.trimValues&&(o=o.trim()),o=this.replaceEntitiesValue(o);let l=this.options.attributeValueProcessor(a,o,t);l==null?n[c]=o:typeof l!=typeof o||l!==o?n[c]=l:n[c]=Y(o,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(n[c]=!0)}if(!Object.keys(n).length)return;if(this.options.attributesGroupName){let h={};return h[this.options.attributesGroupName]=n,h}return n}}var we=function(e){e=e.replace(/\r\n?/g,`
10
+ `);let t=new w("!xml"),i=t,s="",r="";for(let n=0;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){let a=I(e,">",n,"Closing Tag is not closed."),o=e.substring(n+2,a).trim();if(this.options.removeNSPrefix){let u=o.indexOf(":");u!==-1&&(o=o.substr(u+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&(s=this.saveTextToParentTag(s,i,r));let c=r.substring(r.lastIndexOf(".")+1);if(o&&this.options.unpairedTags.indexOf(o)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let l=0;c&&this.options.unpairedTags.indexOf(c)!==-1?(l=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=r.lastIndexOf("."),r=r.substring(0,l),i=this.tagsNodeStack.pop(),s="",n=a}else if(e[n+1]==="?"){let a=k(e,n,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,i,r),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){let o=new w(a.tagName);o.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(o[":@"]=this.buildAttributesMap(a.tagExp,r,a.tagName)),this.addChild(i,o,r)}n=a.closeIndex+1}else if(e.substr(n+1,3)==="!--"){let a=I(e,"-->",n+4,"Comment is not closed.");if(this.options.commentPropName){let o=e.substring(n+4,a-2);s=this.saveTextToParentTag(s,i,r),i.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}n=a}else if(e.substr(n+1,2)==="!D"){let a=ye(e,n);this.docTypeEntities=a.entities,n=a.i}else if(e.substr(n+1,2)==="!["){let a=I(e,"]]>",n,"CDATA is not closed.")-2,o=e.substring(n+9,a);s=this.saveTextToParentTag(s,i,r);let c=this.parseTextData(o,i.tagname,r,!0,!1,!0,!0);c==null&&(c=""),this.options.cdataPropName?i.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):i.add(this.options.textNodeName,c),n=a+2}else{let a=k(e,n,this.options.removeNSPrefix),o=a.tagName,c=a.rawTagName,l=a.tagExp,u=a.attrExpPresent,g=a.closeIndex;this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&s&&i.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,i,r,!1));let N=i;if(N&&this.options.unpairedTags.indexOf(N.tagname)!==-1&&(i=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),o!==t.tagname&&(r+=r?"."+o:o),this.isItStopNode(this.options.stopNodes,r,o)){let p="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)o[o.length-1]==="/"?(o=o.substr(0,o.length-1),r=r.substr(0,r.length-1),l=o):l=l.substr(0,l.length-1),n=a.closeIndex;else if(this.options.unpairedTags.indexOf(o)!==-1)n=a.closeIndex;else{let b=this.readStopNodeData(e,c,g+1);if(!b)throw new Error(`Unexpected end of ${c}`);n=b.i,p=b.tagContent}let C=new w(o);o!==l&&u&&(C[":@"]=this.buildAttributesMap(l,r,o)),p&&(p=this.parseTextData(p,o,r,!0,u,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),C.add(this.options.textNodeName,p),this.addChild(i,C,r)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){o[o.length-1]==="/"?(o=o.substr(0,o.length-1),r=r.substr(0,r.length-1),l=o):l=l.substr(0,l.length-1),this.options.transformTagName&&(o=this.options.transformTagName(o));let p=new w(o);o!==l&&u&&(p[":@"]=this.buildAttributesMap(l,r,o)),this.addChild(i,p,r),r=r.substr(0,r.lastIndexOf("."))}else{let p=new w(o);this.tagsNodeStack.push(i),o!==l&&u&&(p[":@"]=this.buildAttributesMap(l,r,o)),this.addChild(i,p,r),i=p}s="",n=g}}else s+=e[n];return t.child};function Le(e,t,i){let s=this.options.updateTag(t.tagname,i,t[":@"]);s===!1||(typeof s=="string"&&(t.tagname=s),e.addChild(t))}var Be=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){let i=this.docTypeEntities[t];e=e.replace(i.regx,i.val)}for(let t in this.lastEntities){let i=this.lastEntities[t];e=e.replace(i.regex,i.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){let i=this.htmlEntities[t];e=e.replace(i.regex,i.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function Me(e,t,i,s){return e&&(s===void 0&&(s=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,i,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,s),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function Re(e,t,i){let s="*."+i;for(let r in e){let n=e[r];if(s===n||t===n)return!0}return!1}function Ve(e,t,i=">"){let s,r="";for(let n=t;n<e.length;n++){let h=e[n];if(s)h===s&&(s="");else if(h==='"'||h==="'")s=h;else if(h===i[0])if(i[1]){if(e[n+1]===i[1])return{data:r,index:n}}else return{data:r,index:n};else h===" "&&(h=" ");r+=h}}function I(e,t,i,s){let r=e.indexOf(t,i);if(r===-1)throw new Error(s);return r+t.length-1}function k(e,t,i,s=">"){let r=Ve(e,t+1,s);if(!r)return;let n=r.data,h=r.index,a=n.search(/\s/),o=n,c=!0;a!==-1&&(o=n.substring(0,a),n=n.substring(a+1).trimStart());let l=o;if(i){let u=o.indexOf(":");u!==-1&&(o=o.substr(u+1),c=o!==r.data.substr(u+1))}return{tagName:o,tagExp:n,closeIndex:h,attrExpPresent:c,rawTagName:l}}function ve(e,t,i){let s=i,r=1;for(;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){let n=I(e,">",i,`${t} is not closed`);if(e.substring(i+2,n).trim()===t&&(r--,r===0))return{tagContent:e.substring(s,i),i:n};i=n}else if(e[i+1]==="?")i=I(e,"?>",i+1,"StopNode is not closed.");else if(e.substr(i+1,3)==="!--")i=I(e,"-->",i+3,"StopNode is not closed.");else if(e.substr(i+1,2)==="![")i=I(e,"]]>",i,"StopNode is not closed.")-2;else{let n=k(e,i,">");n&&((n&&n.tagName)===t&&n.tagExp[n.tagExp.length-1]!=="/"&&r++,i=n.closeIndex)}}function Y(e,t,i){if(t&&typeof e=="string"){let s=e.trim();return s==="true"?!0:s==="false"?!1:xe(e,i)}else return gt.isExist(e)?e:""}Nt.exports=W});var bt=m(Et=>{"use strict";function Ue(e,t){return mt(e,t)}function mt(e,t,i){let s,r={};for(let n=0;n<e.length;n++){let h=e[n],a=Ge(h),o="";if(i===void 0?o=a:o=i+"."+a,a===t.textNodeName)s===void 0?s=h[a]:s+=""+h[a];else{if(a===void 0)continue;if(h[a]){let c=mt(h[a],t,o),l=qe(c,t);h[":@"]?$e(c,h[":@"],o,t):Object.keys(c).length===1&&c[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?c=c[t.textNodeName]:Object.keys(c).length===0&&(t.alwaysCreateTextNode?c[t.textNodeName]="":c=""),r[a]!==void 0&&r.hasOwnProperty(a)?(Array.isArray(r[a])||(r[a]=[r[a]]),r[a].push(c)):t.isArray(a,o,l)?r[a]=[c]:r[a]=c}}}return typeof s=="string"?s.length>0&&(r[t.textNodeName]=s):s!==void 0&&(r[t.textNodeName]=s),r}function Ge(e){let t=Object.keys(e);for(let i=0;i<t.length;i++){let s=t[i];if(s!==":@")return s}}function $e(e,t,i,s){if(t){let r=Object.keys(t),n=r.length;for(let h=0;h<n;h++){let a=r[h];s.isArray(a,i+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function qe(e,t){let{textNodeName:i}=t,s=Object.keys(e).length;return!!(s===0||s===1&&(e[i]||typeof e[i]=="boolean"||e[i]===0))}Et.prettify=Ue});var At=m((Ss,St)=>{var{buildOptions:We}=ht(),ke=Tt(),{prettify:Ye}=bt(),Xe=G(),X=class{constructor(t){this.externalEntities={},this.options=We(t)}parse(t,i){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(i){i===!0&&(i={});let n=Xe.validate(t,i);if(n!==!0)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}let s=new ke(this.options);s.addExternalEntities(this.externalEntities);let r=s.parseXml(t);return this.options.preserveOrder||r===void 0?r:Ye(r,this.options)}addEntity(t,i){if(i.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(i==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=i}};St.exports=X});var Ft=m((As,Ct)=>{var Qe=`
11
+ `;function He(e,t){let i="";return t.format&&t.indentBy.length>0&&(i=Qe),yt(e,t,"",i)}function yt(e,t,i,s){let r="",n=!1;for(let h=0;h<e.length;h++){let a=e[h],o=ze(a);if(o===void 0)continue;let c="";if(i.length===0?c=o:c=`${i}.${o}`,o===t.textNodeName){let p=a[o];Ke(c,t)||(p=t.tagValueProcessor(o,p),p=xt(p,t)),n&&(r+=s),r+=p,n=!1;continue}else if(o===t.cdataPropName){n&&(r+=s),r+=`<![CDATA[${a[o][0][t.textNodeName]}]]>`,n=!1;continue}else if(o===t.commentPropName){r+=s+`<!--${a[o][0][t.textNodeName]}-->`,n=!0;continue}else if(o[0]==="?"){let p=It(a[":@"],t),C=o==="?xml"?"":s,b=a[o][0][t.textNodeName];b=b.length!==0?" "+b:"",r+=C+`<${o}${b}${p}?>`,n=!0;continue}let l=s;l!==""&&(l+=t.indentBy);let u=It(a[":@"],t),g=s+`<${o}${u}`,N=yt(a[o],t,c,l);t.unpairedTags.indexOf(o)!==-1?t.suppressUnpairedNode?r+=g+">":r+=g+"/>":(!N||N.length===0)&&t.suppressEmptyNode?r+=g+"/>":N&&N.endsWith(">")?r+=g+`>${N}${s}</${o}>`:(r+=g+">",N&&s!==""&&(N.includes("/>")||N.includes("</"))?r+=s+t.indentBy+N+s:r+=N,r+=`</${o}>`),n=!0}return r}function ze(e){let t=Object.keys(e);for(let i=0;i<t.length;i++){let s=t[i];if(e.hasOwnProperty(s)&&s!==":@")return s}}function It(e,t){let i="";if(e&&!t.ignoreAttributes)for(let s in e){if(!e.hasOwnProperty(s))continue;let r=t.attributeValueProcessor(s,e[s]);r=xt(r,t),r===!0&&t.suppressBooleanAttributes?i+=` ${s.substr(t.attributeNamePrefix.length)}`:i+=` ${s.substr(t.attributeNamePrefix.length)}="${r}"`}return i}function Ke(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let i=e.substr(e.lastIndexOf(".")+1);for(let s in t.stopNodes)if(t.stopNodes[s]===e||t.stopNodes[s]==="*."+i)return!0;return!1}function xt(e,t){if(e&&e.length>0&&t.processEntities)for(let i=0;i<t.entities.length;i++){let s=t.entities[i];e=e.replace(s.regex,s.val)}return e}Ct.exports=He});var _t=m((Is,Ot)=>{"use strict";var Ze=Ft(),Je={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function S(e){this.options=Object.assign({},Je,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ts),this.processTextOrObjNode=je,this.options.format?(this.indentate=De,this.tagEndChar=`>
12
12
  `,this.newLine=`
13
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}S.prototype.build=function(e){return this.options.preserveOrder?Ze(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};S.prototype.j2x=function(e,t){let i="",s="";for(let r in e)if(!(typeof e[r]>"u"))if(e[r]===null)r[0]==="?"?s+=this.indentate(t)+"<"+r+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+r+"/"+this.tagEndChar;else if(e[r]instanceof Date)s+=this.buildTextValNode(e[r],r,"",t);else if(typeof e[r]!="object"){let n=this.isAttribute(r);if(n)i+=this.buildAttrPairStr(n,""+e[r]);else if(r===this.options.textNodeName){let h=this.options.tagValueProcessor(r,""+e[r]);s+=this.replaceEntitiesValue(h)}else s+=this.buildTextValNode(e[r],r,"",t)}else if(Array.isArray(e[r])){let n=e[r].length,h="";for(let a=0;a<n;a++){let o=e[r][a];typeof o>"u"||(o===null?r[0]==="?"?s+=this.indentate(t)+"<"+r+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+r+"/"+this.tagEndChar:typeof o=="object"?this.options.oneListGroup?h+=this.j2x(o,t+1).val:h+=this.processTextOrObjNode(o,r,t):h+=this.buildTextValNode(o,r,"",t))}this.options.oneListGroup&&(h=this.buildObjectNode(h,r,"",t)),s+=h}else if(this.options.attributesGroupName&&r===this.options.attributesGroupName){let n=Object.keys(e[r]),h=n.length;for(let a=0;a<h;a++)i+=this.buildAttrPairStr(n[a],""+e[r][n[a]])}else s+=this.processTextOrObjNode(e[r],r,t);return{attrStr:i,val:s}};S.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function je(e,t,i){let s=this.j2x(e,i+1);return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,s.attrStr,i):this.buildObjectNode(s.val,t,s.attrStr,i)}S.prototype.buildObjectNode=function(e,t,i,s){if(e==="")return t[0]==="?"?this.indentate(s)+"<"+t+i+"?"+this.tagEndChar:this.indentate(s)+"<"+t+i+this.closeTag(t)+this.tagEndChar;{let r="</"+t+this.tagEndChar,n="";return t[0]==="?"&&(n="?",r=""),i&&e.indexOf("<")===-1?this.indentate(s)+"<"+t+i+n+">"+e+r:this.options.commentPropName!==!1&&t===this.options.commentPropName&&n.length===0?this.indentate(s)+`<!--${e}-->`+this.newLine:this.indentate(s)+"<"+t+i+n+this.tagEndChar+e+this.indentate(s)+r}};S.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};S.prototype.buildTextValNode=function(e,t,i,s){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(s)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(s)+"<"+t+i+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(t,e);return r=this.replaceEntitiesValue(r),r===""?this.indentate(s)+"<"+t+i+this.closeTag(t)+this.tagEndChar:this.indentate(s)+"<"+t+i+">"+r+"</"+t+this.tagEndChar}};S.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let i=this.options.entities[t];e=e.replace(i.regex,i.val)}return e};function De(e){return this.options.indentBy.repeat(e)}function ts(e){return e.startsWith(this.options.attributeNamePrefix)?e.substr(this.attrPrefixLen):!1}Ot.exports=S});var wt=m((xs,Pt)=>{"use strict";var es=G(),ss=At(),is=_t();Pt.exports={XMLParser:ss,XMLValidator:es,XMLBuilder:is}});var w={};kt(w,{HTMLLoader:()=>Rt,SAXParser:()=>b,XMLLoader:()=>I,_uncapitalize:()=>v,_uncapitalizeKeys:()=>y,convertXMLFieldToArrayInPlace:()=>Vt,convertXMLValueToArray:()=>K});B(w,Z(D(),1));var tt={ontext:()=>{},onprocessinginstruction:()=>{},onsgmldeclaration:()=>{},ondoctype:()=>{},oncomment:()=>{},onopentagstart:()=>{},onattribute:()=>{},onopentag:()=>{},onclosetag:()=>{},onopencdata:()=>{},oncdata:()=>{},onclosecdata:()=>{},onerror:()=>{},onend:()=>{},onready:()=>{},onscript:()=>{},onopennamespace:()=>{},onclosenamespace:()=>{}},Xt={...tt,strict:!1,MAX_BUFFER_LENGTH:64*1024,lowercase:!1,lowercasetags:!1,noscript:!1,strictEntities:!1,xmlns:void 0,position:void 0,trim:void 0,normalize:void 0},Qt=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Ht=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"],F=/[:_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]/,V=/[:_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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,zt=/[#:_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]/,Kt=/[#:_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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,O={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830};Object.keys(O).forEach(e=>{let t=O[e];O[e]=typeof t=="number"?String.fromCharCode(t):t});var l=class{EVENTS=Qt;ENTITIES={...O};XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"};S=0;opt;trackPosition=!1;column=0;line=0;c="";error;q="";bufferCheckPosition;closed=!1;tags=[];looseCase="";closedRoot=!1;sawRoot=!1;strict=!1;tag;strictEntities;state;noscript=!1;attribList=[];ns;position=0;STATE={BEGIN:this.S++,BEGIN_WHITESPACE:this.S++,TEXT:this.S++,TEXT_ENTITY:this.S++,OPEN_WAKA:this.S++,SGML_DECL:this.S++,SGML_DECL_QUOTED:this.S++,DOCTYPE:this.S++,DOCTYPE_QUOTED:this.S++,DOCTYPE_DTD:this.S++,DOCTYPE_DTD_QUOTED:this.S++,COMMENT_STARTING:this.S++,COMMENT:this.S++,COMMENT_ENDING:this.S++,COMMENT_ENDED:this.S++,CDATA:this.S++,CDATA_ENDING:this.S++,CDATA_ENDING_2:this.S++,PROC_INST:this.S++,PROC_INST_BODY:this.S++,PROC_INST_ENDING:this.S++,OPEN_TAG:this.S++,OPEN_TAG_SLASH:this.S++,ATTRIB:this.S++,ATTRIB_NAME:this.S++,ATTRIB_NAME_SAW_WHITE:this.S++,ATTRIB_VALUE:this.S++,ATTRIB_VALUE_QUOTED:this.S++,ATTRIB_VALUE_CLOSED:this.S++,ATTRIB_VALUE_UNQUOTED:this.S++,ATTRIB_VALUE_ENTITY_Q:this.S++,ATTRIB_VALUE_ENTITY_U:this.S++,CLOSE_TAG:this.S++,CLOSE_TAG_SAW_WHITE:this.S++,SCRIPT:this.S++,SCRIPT_ENDING:this.S++};BUFFERS=Ht;CDATA="[CDATA[";DOCTYPE="DOCTYPE";XML_NAMESPACE="http://www.w3.org/XML/1998/namespace";XMLNS_NAMESPACE="http://www.w3.org/2000/xmlns/";rootNS={xml:this.XML_NAMESPACE,xmlns:this.XMLNS_NAMESPACE};comment;sgmlDecl;textNode="";tagName;doctype;procInstName;procInstBody;entity="";attribName;attribValue;cdata="";script="";startTagPosition=0;constructor(){this.S=0;for(let t in this.STATE)this.STATE.hasOwnProperty(t)&&(this.STATE[this.STATE[t]]=t);this.S=this.STATE}static charAt(t,i){let s="";return i<t.length&&(s=t.charAt(i)),s}static isWhitespace(t){return t===" "||t===`
14
- `||t==="\r"||t===" "}static isQuote(t){return t==='"'||t==="'"}static isAttribEnd(t){return t===">"||l.isWhitespace(t)}static isMatch(t,i){return t.test(i)}static notMatch(t,i){return!l.isMatch(t,i)}static qname(t,i){let r=t.indexOf(":")<0?["",t]:t.split(":"),n=r[0],h=r[1];return i&&t==="xmlns"&&(n="xmlns",h=""),{prefix:n,local:h}}write(t){if(this.error)throw this.error;if(this.closed)return this.errorFunction("Cannot write after close. Assign an onready handler.");if(t===null)return this.end();typeof t=="object"&&(t=t.toString());let i=0,s;for(;s=l.charAt(t,i++),this.c=s,!!s;)switch(this.trackPosition&&(this.position++,s===`
15
- `?(this.line++,this.column=0):this.column++),this.state){case this.S.BEGIN:if(this.state=this.S.BEGIN_WHITESPACE,s==="\uFEFF")continue;this.beginWhiteSpace(s);continue;case this.S.BEGIN_WHITESPACE:this.beginWhiteSpace(s);continue;case this.S.TEXT:if(this.sawRoot&&!this.closedRoot){let h=i-1;for(;s&&s!=="<"&&s!=="&";)s=l.charAt(t,i++),s&&this.trackPosition&&(this.position++,s===`
16
- `?(this.line++,this.column=0):this.column++);this.textNode+=t.substring(h,i-1)}s==="<"&&!(this.sawRoot&&this.closedRoot&&!this.strict)?(this.state=this.S.OPEN_WAKA,this.startTagPosition=this.position):(!l.isWhitespace(s)&&(!this.sawRoot||this.closedRoot)&&this.strictFail("Text data outside of root node."),s==="&"?this.state=this.S.TEXT_ENTITY:this.textNode+=s);continue;case this.S.SCRIPT:s==="<"?this.state=this.S.SCRIPT_ENDING:this.script+=s;continue;case this.S.SCRIPT_ENDING:s==="/"?this.state=this.S.CLOSE_TAG:(this.script+=`<${s}`,this.state=this.S.SCRIPT);continue;case this.S.OPEN_WAKA:if(s==="!")this.state=this.S.SGML_DECL,this.sgmlDecl="";else if(!l.isWhitespace(s))if(l.isMatch(F,s))this.state=this.S.OPEN_TAG,this.tagName=s;else if(s==="/")this.state=this.S.CLOSE_TAG,this.tagName="";else if(s==="?")this.state=this.S.PROC_INST,this.procInstName=this.procInstBody="";else{if(this.strictFail("Unencoded <"),this.startTagPosition+1<this.position){let h=this.position-this.startTagPosition;s=new Array(h).join(" ")+s}this.textNode+=`<${s}`,this.state=this.S.TEXT}continue;case this.S.SGML_DECL:(this.sgmlDecl+s).toUpperCase()===this.CDATA?(this.emitNode("onopencdata"),this.state=this.S.CDATA,this.sgmlDecl="",this.cdata=""):this.sgmlDecl+s==="--"?(this.state=this.S.COMMENT,this.comment="",this.sgmlDecl=""):(this.sgmlDecl+s).toUpperCase()===this.DOCTYPE?(this.state=this.S.DOCTYPE,(this.doctype||this.sawRoot)&&this.strictFail("Inappropriately located doctype declaration"),this.doctype="",this.sgmlDecl=""):s===">"?(this.emitNode("onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=this.S.TEXT):l.isQuote(s)?(this.state=this.S.SGML_DECL_QUOTED,this.sgmlDecl+=s):this.sgmlDecl+=s;continue;case this.S.SGML_DECL_QUOTED:s===this.q&&(this.state=this.S.SGML_DECL,this.q=""),this.sgmlDecl+=s;continue;case this.S.DOCTYPE:s===">"?(this.state=this.S.TEXT,this.emitNode("ondoctype",this.doctype),this.doctype=!0):(this.doctype+=s,s==="["?this.state=this.S.DOCTYPE_DTD:l.isQuote(s)&&(this.state=this.S.DOCTYPE_QUOTED,this.q=s));continue;case this.S.DOCTYPE_QUOTED:this.doctype+=s,s===this.q&&(this.q="",this.state=this.S.DOCTYPE);continue;case this.S.DOCTYPE_DTD:this.doctype+=s,s==="]"?this.state=this.S.DOCTYPE:l.isQuote(s)&&(this.state=this.S.DOCTYPE_DTD_QUOTED,this.q=s);continue;case this.S.DOCTYPE_DTD_QUOTED:this.doctype+=s,s===this.q&&(this.state=this.S.DOCTYPE_DTD,this.q="");continue;case this.S.COMMENT:s==="-"?this.state=this.S.COMMENT_ENDING:this.comment+=s;continue;case this.S.COMMENT_ENDING:s==="-"?(this.state=this.S.COMMENT_ENDED,this.comment=this.textApplyOptions(this.comment),this.comment&&this.emitNode("oncomment",this.comment),this.comment=""):(this.comment+=`-${s}`,this.state=this.S.COMMENT);continue;case this.S.COMMENT_ENDED:s!==">"?(this.strictFail("Malformed comment"),this.comment+=`--${s}`,this.state=this.S.COMMENT):this.state=this.S.TEXT;continue;case this.S.CDATA:s==="]"?this.state=this.S.CDATA_ENDING:this.cdata+=s;continue;case this.S.CDATA_ENDING:s==="]"?this.state=this.S.CDATA_ENDING_2:(this.cdata+=`]${s}`,this.state=this.S.CDATA);continue;case this.S.CDATA_ENDING_2:s===">"?(this.cdata&&this.emitNode("oncdata",this.cdata),this.emitNode("onclosecdata"),this.cdata="",this.state=this.S.TEXT):s==="]"?this.cdata+="]":(this.cdata+=`]]${s}`,this.state=this.S.CDATA);continue;case this.S.PROC_INST:s==="?"?this.state=this.S.PROC_INST_ENDING:l.isWhitespace(s)?this.state=this.S.PROC_INST_BODY:this.procInstName+=s;continue;case this.S.PROC_INST_BODY:if(!this.procInstBody&&l.isWhitespace(s))continue;s==="?"?this.state=this.S.PROC_INST_ENDING:this.procInstBody+=s;continue;case this.S.PROC_INST_ENDING:s===">"?(this.emitNode("onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=this.S.TEXT):(this.procInstBody+=`?${s}`,this.state=this.S.PROC_INST_BODY);continue;case this.S.OPEN_TAG:l.isMatch(V,s)?this.tagName+=s:(this.newTag(),s===">"?this.openTag():s==="/"?this.state=this.S.OPEN_TAG_SLASH:(l.isWhitespace(s)||this.strictFail("Invalid character in tag name"),this.state=this.S.ATTRIB));continue;case this.S.OPEN_TAG_SLASH:s===">"?(this.openTag(!0),this.closeTag()):(this.strictFail("Forward-slash in opening tag not followed by >"),this.state=this.S.ATTRIB);continue;case this.S.ATTRIB:if(l.isWhitespace(s))continue;s===">"?this.openTag():s==="/"?this.state=this.S.OPEN_TAG_SLASH:l.isMatch(F,s)?(this.attribName=s,this.attribValue="",this.state=this.S.ATTRIB_NAME):this.strictFail("Invalid attribute name");continue;case this.S.ATTRIB_NAME:s==="="?this.state=this.S.ATTRIB_VALUE:s===">"?(this.strictFail("Attribute without value"),this.attribValue=this.attribName,this.attrib(),this.openTag()):l.isWhitespace(s)?this.state=this.S.ATTRIB_NAME_SAW_WHITE:l.isMatch(V,s)?this.attribName+=s:this.strictFail("Invalid attribute name");continue;case this.S.ATTRIB_NAME_SAW_WHITE:if(s==="=")this.state=this.S.ATTRIB_VALUE;else{if(l.isWhitespace(s))continue;this.strictFail("Attribute without value"),this.tag.attributes[this.attribName]="",this.attribValue="",this.emitNode("onattribute",{name:this.attribName,value:""}),this.attribName="",s===">"?this.openTag():l.isMatch(F,s)?(this.attribName=s,this.state=this.S.ATTRIB_NAME):(this.strictFail("Invalid attribute name"),this.state=this.S.ATTRIB)}continue;case this.S.ATTRIB_VALUE:if(l.isWhitespace(s))continue;l.isQuote(s)?(this.q=s,this.state=this.S.ATTRIB_VALUE_QUOTED):(this.strictFail("Unquoted attribute value"),this.state=this.S.ATTRIB_VALUE_UNQUOTED,this.attribValue=s);continue;case this.S.ATTRIB_VALUE_QUOTED:if(s!==this.q){s==="&"?this.state=this.S.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=s;continue}this.attrib(),this.q="",this.state=this.S.ATTRIB_VALUE_CLOSED;continue;case this.S.ATTRIB_VALUE_CLOSED:l.isWhitespace(s)?this.state=this.S.ATTRIB:s===">"?this.openTag():s==="/"?this.state=this.S.OPEN_TAG_SLASH:l.isMatch(F,s)?(this.strictFail("No whitespace between attributes"),this.attribName=s,this.attribValue="",this.state=this.S.ATTRIB_NAME):this.strictFail("Invalid attribute name");continue;case this.S.ATTRIB_VALUE_UNQUOTED:if(!l.isAttribEnd(s)){s==="&"?this.state=this.S.ATTRIB_VALUE_ENTITY_U:this.attribValue+=s;continue}this.attrib(),s===">"?this.openTag():this.state=this.S.ATTRIB;continue;case this.S.CLOSE_TAG:if(this.tagName)s===">"?this.closeTag():l.isMatch(V,s)?this.tagName+=s:this.script?(this.script+=`</${this.tagName}`,this.tagName="",this.state=this.S.SCRIPT):(l.isWhitespace(s)||this.strictFail("Invalid tagname in closing tag"),this.state=this.S.CLOSE_TAG_SAW_WHITE);else{if(l.isWhitespace(s))continue;l.notMatch(F,s)?this.script?(this.script+=`</${s}`,this.state=this.S.SCRIPT):this.strictFail("Invalid tagname in closing tag."):this.tagName=s}continue;case this.S.CLOSE_TAG_SAW_WHITE:if(l.isWhitespace(s))continue;s===">"?this.closeTag():this.strictFail("Invalid characters in closing tag");continue;case this.S.TEXT_ENTITY:case this.S.ATTRIB_VALUE_ENTITY_Q:case this.S.ATTRIB_VALUE_ENTITY_U:let r,n;switch(this.state){case this.S.TEXT_ENTITY:r=this.S.TEXT,n="textNode";break;case this.S.ATTRIB_VALUE_ENTITY_Q:r=this.S.ATTRIB_VALUE_QUOTED,n="attribValue";break;case this.S.ATTRIB_VALUE_ENTITY_U:r=this.S.ATTRIB_VALUE_UNQUOTED,n="attribValue";break;default:throw new Error(`Unknown state: ${this.state}`)}s===";"?(this[n]+=this.parseEntity(),this.entity="",this.state=r):l.isMatch(this.entity.length?Kt:zt,s)?this.entity+=s:(this.strictFail("Invalid character in entity name"),this[n]+=`&${this.entity}${s}`,this.entity="",this.state=r);continue;default:throw new Error(`Unknown state: ${this.state}`)}return this.position>=this.bufferCheckPosition&&this.checkBufferLength(),this}emit(t,i){if(this.events.hasOwnProperty(t)){let s=t.replace(/^on/,"");this.events[t](i,s,this)}}clearBuffers(){for(let t=0,i=this.BUFFERS.length;t<i;t++)this[this[t]]=""}flushBuffers(){this.closeText(),this.cdata!==""&&(this.emitNode("oncdata",this.cdata),this.cdata=""),this.script!==""&&(this.emitNode("onscript",this.script),this.script="")}end(){return this.sawRoot&&!this.closedRoot&&this.strictFail("Unclosed root tag"),this.state!==this.S.BEGIN&&this.state!==this.S.BEGIN_WHITESPACE&&this.state!==this.S.TEXT&&this.errorFunction("Unexpected end"),this.closeText(),this.c="",this.closed=!0,this.emit("onend"),new b(this.opt)}errorFunction(t){this.closeText(),this.trackPosition&&(t+=`
13
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}S.prototype.build=function(e){return this.options.preserveOrder?Ze(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};S.prototype.j2x=function(e,t){let i="",s="";for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))if(typeof e[r]>"u")this.isAttribute(r)&&(s+="");else if(e[r]===null)this.isAttribute(r)?s+="":r[0]==="?"?s+=this.indentate(t)+"<"+r+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+r+"/"+this.tagEndChar;else if(e[r]instanceof Date)s+=this.buildTextValNode(e[r],r,"",t);else if(typeof e[r]!="object"){let n=this.isAttribute(r);if(n)i+=this.buildAttrPairStr(n,""+e[r]);else if(r===this.options.textNodeName){let h=this.options.tagValueProcessor(r,""+e[r]);s+=this.replaceEntitiesValue(h)}else s+=this.buildTextValNode(e[r],r,"",t)}else if(Array.isArray(e[r])){let n=e[r].length,h="",a="";for(let o=0;o<n;o++){let c=e[r][o];if(!(typeof c>"u"))if(c===null)r[0]==="?"?s+=this.indentate(t)+"<"+r+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+r+"/"+this.tagEndChar;else if(typeof c=="object")if(this.options.oneListGroup){let l=this.j2x(c,t+1);h+=l.val,this.options.attributesGroupName&&c.hasOwnProperty(this.options.attributesGroupName)&&(a+=l.attrStr)}else h+=this.processTextOrObjNode(c,r,t);else if(this.options.oneListGroup){let l=this.options.tagValueProcessor(r,c);l=this.replaceEntitiesValue(l),h+=l}else h+=this.buildTextValNode(c,r,"",t)}this.options.oneListGroup&&(h=this.buildObjectNode(h,r,a,t)),s+=h}else if(this.options.attributesGroupName&&r===this.options.attributesGroupName){let n=Object.keys(e[r]),h=n.length;for(let a=0;a<h;a++)i+=this.buildAttrPairStr(n[a],""+e[r][n[a]])}else s+=this.processTextOrObjNode(e[r],r,t);return{attrStr:i,val:s}};S.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function je(e,t,i){let s=this.j2x(e,i+1);return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,s.attrStr,i):this.buildObjectNode(s.val,t,s.attrStr,i)}S.prototype.buildObjectNode=function(e,t,i,s){if(e==="")return t[0]==="?"?this.indentate(s)+"<"+t+i+"?"+this.tagEndChar:this.indentate(s)+"<"+t+i+this.closeTag(t)+this.tagEndChar;{let r="</"+t+this.tagEndChar,n="";return t[0]==="?"&&(n="?",r=""),(i||i==="")&&e.indexOf("<")===-1?this.indentate(s)+"<"+t+i+n+">"+e+r:this.options.commentPropName!==!1&&t===this.options.commentPropName&&n.length===0?this.indentate(s)+`<!--${e}-->`+this.newLine:this.indentate(s)+"<"+t+i+n+this.tagEndChar+e+this.indentate(s)+r}};S.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};S.prototype.buildTextValNode=function(e,t,i,s){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(s)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(s)+"<"+t+i+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(t,e);return r=this.replaceEntitiesValue(r),r===""?this.indentate(s)+"<"+t+i+this.closeTag(t)+this.tagEndChar:this.indentate(s)+"<"+t+i+">"+r+"</"+t+this.tagEndChar}};S.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let i=this.options.entities[t];e=e.replace(i.regex,i.val)}return e};function De(e){return this.options.indentBy.repeat(e)}function ts(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}Ot.exports=S});var wt=m((ys,Pt)=>{"use strict";var es=G(),ss=At(),is=_t();Pt.exports={XMLParser:ss,XMLValidator:es,XMLBuilder:is}});var L={};kt(L,{HTMLLoader:()=>Rt,SAXParser:()=>A,XMLLoader:()=>y,_uncapitalize:()=>v,_uncapitalizeKeys:()=>x,convertXMLFieldToArrayInPlace:()=>Vt,convertXMLValueToArray:()=>z});M(L,K(j(),1));var D={ontext:()=>{},onprocessinginstruction:()=>{},onsgmldeclaration:()=>{},ondoctype:()=>{},oncomment:()=>{},onopentagstart:()=>{},onattribute:()=>{},onopentag:()=>{},onclosetag:()=>{},onopencdata:()=>{},oncdata:()=>{},onclosecdata:()=>{},onerror:()=>{},onend:()=>{},onready:()=>{},onscript:()=>{},onopennamespace:()=>{},onclosenamespace:()=>{}},Xt={...D,strict:!1,MAX_BUFFER_LENGTH:64*1024,lowercase:!1,lowercasetags:!1,noscript:!1,strictEntities:!1,xmlns:void 0,position:void 0,trim:void 0,normalize:void 0},Qt=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Ht=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"],O=/[:_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]/,V=/[:_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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,zt=/[#:_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]/,Kt=/[#:_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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,_={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830};Object.keys(_).forEach(e=>{let t=_[e];_[e]=typeof t=="number"?String.fromCharCode(t):t});var f=class{EVENTS=Qt;ENTITIES={..._};XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"};S=0;opt;trackPosition=!1;column=0;line=0;c="";error;q="";bufferCheckPosition;closed=!1;tags=[];looseCase="";closedRoot=!1;sawRoot=!1;strict=!1;tag;strictEntities;state;noscript=!1;attribList=[];ns;position=0;STATE={BEGIN:this.S++,BEGIN_WHITESPACE:this.S++,TEXT:this.S++,TEXT_ENTITY:this.S++,OPEN_WAKA:this.S++,SGML_DECL:this.S++,SGML_DECL_QUOTED:this.S++,DOCTYPE:this.S++,DOCTYPE_QUOTED:this.S++,DOCTYPE_DTD:this.S++,DOCTYPE_DTD_QUOTED:this.S++,COMMENT_STARTING:this.S++,COMMENT:this.S++,COMMENT_ENDING:this.S++,COMMENT_ENDED:this.S++,CDATA:this.S++,CDATA_ENDING:this.S++,CDATA_ENDING_2:this.S++,PROC_INST:this.S++,PROC_INST_BODY:this.S++,PROC_INST_ENDING:this.S++,OPEN_TAG:this.S++,OPEN_TAG_SLASH:this.S++,ATTRIB:this.S++,ATTRIB_NAME:this.S++,ATTRIB_NAME_SAW_WHITE:this.S++,ATTRIB_VALUE:this.S++,ATTRIB_VALUE_QUOTED:this.S++,ATTRIB_VALUE_CLOSED:this.S++,ATTRIB_VALUE_UNQUOTED:this.S++,ATTRIB_VALUE_ENTITY_Q:this.S++,ATTRIB_VALUE_ENTITY_U:this.S++,CLOSE_TAG:this.S++,CLOSE_TAG_SAW_WHITE:this.S++,SCRIPT:this.S++,SCRIPT_ENDING:this.S++};BUFFERS=Ht;CDATA="[CDATA[";DOCTYPE="DOCTYPE";XML_NAMESPACE="http://www.w3.org/XML/1998/namespace";XMLNS_NAMESPACE="http://www.w3.org/2000/xmlns/";rootNS={xml:this.XML_NAMESPACE,xmlns:this.XMLNS_NAMESPACE};comment;sgmlDecl;textNode="";tagName;doctype;procInstName;procInstBody;entity="";attribName;attribValue;cdata="";script="";startTagPosition=0;constructor(){this.S=0;for(let t in this.STATE)this.STATE.hasOwnProperty(t)&&(this.STATE[this.STATE[t]]=t);this.S=this.STATE}static charAt(t,i){let s="";return i<t.length&&(s=t.charAt(i)),s}static isWhitespace(t){return t===" "||t===`
14
+ `||t==="\r"||t===" "}static isQuote(t){return t==='"'||t==="'"}static isAttribEnd(t){return t===">"||f.isWhitespace(t)}static isMatch(t,i){return t.test(i)}static notMatch(t,i){return!f.isMatch(t,i)}static qname(t,i){let r=t.indexOf(":")<0?["",t]:t.split(":"),n=r[0],h=r[1];return i&&t==="xmlns"&&(n="xmlns",h=""),{prefix:n,local:h}}write(t){if(this.error)throw this.error;if(this.closed)return this.errorFunction("Cannot write after close. Assign an onready handler.");if(t===null)return this.end();typeof t=="object"&&(t=t.toString());let i=0,s;for(;s=f.charAt(t,i++),this.c=s,!!s;)switch(this.trackPosition&&(this.position++,s===`
15
+ `?(this.line++,this.column=0):this.column++),this.state){case this.S.BEGIN:if(this.state=this.S.BEGIN_WHITESPACE,s==="\uFEFF")continue;this.beginWhiteSpace(s);continue;case this.S.BEGIN_WHITESPACE:this.beginWhiteSpace(s);continue;case this.S.TEXT:if(this.sawRoot&&!this.closedRoot){let h=i-1;for(;s&&s!=="<"&&s!=="&";)s=f.charAt(t,i++),s&&this.trackPosition&&(this.position++,s===`
16
+ `?(this.line++,this.column=0):this.column++);this.textNode+=t.substring(h,i-1)}s==="<"&&!(this.sawRoot&&this.closedRoot&&!this.strict)?(this.state=this.S.OPEN_WAKA,this.startTagPosition=this.position):(!f.isWhitespace(s)&&(!this.sawRoot||this.closedRoot)&&this.strictFail("Text data outside of root node."),s==="&"?this.state=this.S.TEXT_ENTITY:this.textNode+=s);continue;case this.S.SCRIPT:s==="<"?this.state=this.S.SCRIPT_ENDING:this.script+=s;continue;case this.S.SCRIPT_ENDING:s==="/"?this.state=this.S.CLOSE_TAG:(this.script+=`<${s}`,this.state=this.S.SCRIPT);continue;case this.S.OPEN_WAKA:if(s==="!")this.state=this.S.SGML_DECL,this.sgmlDecl="";else if(!f.isWhitespace(s))if(f.isMatch(O,s))this.state=this.S.OPEN_TAG,this.tagName=s;else if(s==="/")this.state=this.S.CLOSE_TAG,this.tagName="";else if(s==="?")this.state=this.S.PROC_INST,this.procInstName=this.procInstBody="";else{if(this.strictFail("Unencoded <"),this.startTagPosition+1<this.position){let h=this.position-this.startTagPosition;s=new Array(h).join(" ")+s}this.textNode+=`<${s}`,this.state=this.S.TEXT}continue;case this.S.SGML_DECL:(this.sgmlDecl+s).toUpperCase()===this.CDATA?(this.emitNode("onopencdata"),this.state=this.S.CDATA,this.sgmlDecl="",this.cdata=""):this.sgmlDecl+s==="--"?(this.state=this.S.COMMENT,this.comment="",this.sgmlDecl=""):(this.sgmlDecl+s).toUpperCase()===this.DOCTYPE?(this.state=this.S.DOCTYPE,(this.doctype||this.sawRoot)&&this.strictFail("Inappropriately located doctype declaration"),this.doctype="",this.sgmlDecl=""):s===">"?(this.emitNode("onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=this.S.TEXT):f.isQuote(s)?(this.state=this.S.SGML_DECL_QUOTED,this.sgmlDecl+=s):this.sgmlDecl+=s;continue;case this.S.SGML_DECL_QUOTED:s===this.q&&(this.state=this.S.SGML_DECL,this.q=""),this.sgmlDecl+=s;continue;case this.S.DOCTYPE:s===">"?(this.state=this.S.TEXT,this.emitNode("ondoctype",this.doctype),this.doctype=!0):(this.doctype+=s,s==="["?this.state=this.S.DOCTYPE_DTD:f.isQuote(s)&&(this.state=this.S.DOCTYPE_QUOTED,this.q=s));continue;case this.S.DOCTYPE_QUOTED:this.doctype+=s,s===this.q&&(this.q="",this.state=this.S.DOCTYPE);continue;case this.S.DOCTYPE_DTD:this.doctype+=s,s==="]"?this.state=this.S.DOCTYPE:f.isQuote(s)&&(this.state=this.S.DOCTYPE_DTD_QUOTED,this.q=s);continue;case this.S.DOCTYPE_DTD_QUOTED:this.doctype+=s,s===this.q&&(this.state=this.S.DOCTYPE_DTD,this.q="");continue;case this.S.COMMENT:s==="-"?this.state=this.S.COMMENT_ENDING:this.comment+=s;continue;case this.S.COMMENT_ENDING:s==="-"?(this.state=this.S.COMMENT_ENDED,this.comment=this.textApplyOptions(this.comment),this.comment&&this.emitNode("oncomment",this.comment),this.comment=""):(this.comment+=`-${s}`,this.state=this.S.COMMENT);continue;case this.S.COMMENT_ENDED:s!==">"?(this.strictFail("Malformed comment"),this.comment+=`--${s}`,this.state=this.S.COMMENT):this.state=this.S.TEXT;continue;case this.S.CDATA:s==="]"?this.state=this.S.CDATA_ENDING:this.cdata+=s;continue;case this.S.CDATA_ENDING:s==="]"?this.state=this.S.CDATA_ENDING_2:(this.cdata+=`]${s}`,this.state=this.S.CDATA);continue;case this.S.CDATA_ENDING_2:s===">"?(this.cdata&&this.emitNode("oncdata",this.cdata),this.emitNode("onclosecdata"),this.cdata="",this.state=this.S.TEXT):s==="]"?this.cdata+="]":(this.cdata+=`]]${s}`,this.state=this.S.CDATA);continue;case this.S.PROC_INST:s==="?"?this.state=this.S.PROC_INST_ENDING:f.isWhitespace(s)?this.state=this.S.PROC_INST_BODY:this.procInstName+=s;continue;case this.S.PROC_INST_BODY:if(!this.procInstBody&&f.isWhitespace(s))continue;s==="?"?this.state=this.S.PROC_INST_ENDING:this.procInstBody+=s;continue;case this.S.PROC_INST_ENDING:s===">"?(this.emitNode("onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=this.S.TEXT):(this.procInstBody+=`?${s}`,this.state=this.S.PROC_INST_BODY);continue;case this.S.OPEN_TAG:f.isMatch(V,s)?this.tagName+=s:(this.newTag(),s===">"?this.openTag():s==="/"?this.state=this.S.OPEN_TAG_SLASH:(f.isWhitespace(s)||this.strictFail("Invalid character in tag name"),this.state=this.S.ATTRIB));continue;case this.S.OPEN_TAG_SLASH:s===">"?(this.openTag(!0),this.closeTag()):(this.strictFail("Forward-slash in opening tag not followed by >"),this.state=this.S.ATTRIB);continue;case this.S.ATTRIB:if(f.isWhitespace(s))continue;s===">"?this.openTag():s==="/"?this.state=this.S.OPEN_TAG_SLASH:f.isMatch(O,s)?(this.attribName=s,this.attribValue="",this.state=this.S.ATTRIB_NAME):this.strictFail("Invalid attribute name");continue;case this.S.ATTRIB_NAME:s==="="?this.state=this.S.ATTRIB_VALUE:s===">"?(this.strictFail("Attribute without value"),this.attribValue=this.attribName,this.attrib(),this.openTag()):f.isWhitespace(s)?this.state=this.S.ATTRIB_NAME_SAW_WHITE:f.isMatch(V,s)?this.attribName+=s:this.strictFail("Invalid attribute name");continue;case this.S.ATTRIB_NAME_SAW_WHITE:if(s==="=")this.state=this.S.ATTRIB_VALUE;else{if(f.isWhitespace(s))continue;this.strictFail("Attribute without value"),this.tag.attributes[this.attribName]="",this.attribValue="",this.emitNode("onattribute",{name:this.attribName,value:""}),this.attribName="",s===">"?this.openTag():f.isMatch(O,s)?(this.attribName=s,this.state=this.S.ATTRIB_NAME):(this.strictFail("Invalid attribute name"),this.state=this.S.ATTRIB)}continue;case this.S.ATTRIB_VALUE:if(f.isWhitespace(s))continue;f.isQuote(s)?(this.q=s,this.state=this.S.ATTRIB_VALUE_QUOTED):(this.strictFail("Unquoted attribute value"),this.state=this.S.ATTRIB_VALUE_UNQUOTED,this.attribValue=s);continue;case this.S.ATTRIB_VALUE_QUOTED:if(s!==this.q){s==="&"?this.state=this.S.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=s;continue}this.attrib(),this.q="",this.state=this.S.ATTRIB_VALUE_CLOSED;continue;case this.S.ATTRIB_VALUE_CLOSED:f.isWhitespace(s)?this.state=this.S.ATTRIB:s===">"?this.openTag():s==="/"?this.state=this.S.OPEN_TAG_SLASH:f.isMatch(O,s)?(this.strictFail("No whitespace between attributes"),this.attribName=s,this.attribValue="",this.state=this.S.ATTRIB_NAME):this.strictFail("Invalid attribute name");continue;case this.S.ATTRIB_VALUE_UNQUOTED:if(!f.isAttribEnd(s)){s==="&"?this.state=this.S.ATTRIB_VALUE_ENTITY_U:this.attribValue+=s;continue}this.attrib(),s===">"?this.openTag():this.state=this.S.ATTRIB;continue;case this.S.CLOSE_TAG:if(this.tagName)s===">"?this.closeTag():f.isMatch(V,s)?this.tagName+=s:this.script?(this.script+=`</${this.tagName}`,this.tagName="",this.state=this.S.SCRIPT):(f.isWhitespace(s)||this.strictFail("Invalid tagname in closing tag"),this.state=this.S.CLOSE_TAG_SAW_WHITE);else{if(f.isWhitespace(s))continue;f.notMatch(O,s)?this.script?(this.script+=`</${s}`,this.state=this.S.SCRIPT):this.strictFail("Invalid tagname in closing tag."):this.tagName=s}continue;case this.S.CLOSE_TAG_SAW_WHITE:if(f.isWhitespace(s))continue;s===">"?this.closeTag():this.strictFail("Invalid characters in closing tag");continue;case this.S.TEXT_ENTITY:case this.S.ATTRIB_VALUE_ENTITY_Q:case this.S.ATTRIB_VALUE_ENTITY_U:let r,n;switch(this.state){case this.S.TEXT_ENTITY:r=this.S.TEXT,n="textNode";break;case this.S.ATTRIB_VALUE_ENTITY_Q:r=this.S.ATTRIB_VALUE_QUOTED,n="attribValue";break;case this.S.ATTRIB_VALUE_ENTITY_U:r=this.S.ATTRIB_VALUE_UNQUOTED,n="attribValue";break;default:throw new Error(`Unknown state: ${this.state}`)}s===";"?(this[n]+=this.parseEntity(),this.entity="",this.state=r):f.isMatch(this.entity.length?Kt:zt,s)?this.entity+=s:(this.strictFail("Invalid character in entity name"),this[n]+=`&${this.entity}${s}`,this.entity="",this.state=r);continue;default:throw new Error(`Unknown state: ${this.state}`)}return this.position>=this.bufferCheckPosition&&this.checkBufferLength(),this}emit(t,i){if(this.events.hasOwnProperty(t)){let s=t.replace(/^on/,"");this.events[t](i,s,this)}}clearBuffers(){for(let t=0,i=this.BUFFERS.length;t<i;t++)this[this[t]]=""}flushBuffers(){this.closeText(),this.cdata!==""&&(this.emitNode("oncdata",this.cdata),this.cdata=""),this.script!==""&&(this.emitNode("onscript",this.script),this.script="")}end(){return this.sawRoot&&!this.closedRoot&&this.strictFail("Unclosed root tag"),this.state!==this.S.BEGIN&&this.state!==this.S.BEGIN_WHITESPACE&&this.state!==this.S.TEXT&&this.errorFunction("Unexpected end"),this.closeText(),this.c="",this.closed=!0,this.emit("onend"),new A(this.opt)}errorFunction(t){this.closeText(),this.trackPosition&&(t+=`
17
17
  Line: ${this.line}
18
18
  Column: ${this.column}
19
- Char: ${this.c}`);let i=new Error(t);return this.error=i,this.emit("onerror",i),this}attrib(){if(this.strict||(this.attribName=this.attribName[this.looseCase]()),this.attribList.indexOf(this.attribName)!==-1||this.tag.attributes.hasOwnProperty(this.attribName)){this.attribName=this.attribValue="";return}if(this.opt.xmlns){let t=l.qname(this.attribName,!0),i=t.prefix,s=t.local;if(i==="xmlns")if(s==="xml"&&this.attribValue!==this.XML_NAMESPACE)this.strictFail(`xml: prefix must be bound to ${this.XML_NAMESPACE}
19
+ Char: ${this.c}`);let i=new Error(t);return this.error=i,this.emit("onerror",i),this}attrib(){if(this.strict||(this.attribName=this.attribName[this.looseCase]()),this.attribList.indexOf(this.attribName)!==-1||this.tag.attributes.hasOwnProperty(this.attribName)){this.attribName=this.attribValue="";return}if(this.opt.xmlns){let t=f.qname(this.attribName,!0),i=t.prefix,s=t.local;if(i==="xmlns")if(s==="xml"&&this.attribValue!==this.XML_NAMESPACE)this.strictFail(`xml: prefix must be bound to ${this.XML_NAMESPACE}
20
20
  Actual: ${this.attribValue}`);else if(s==="xmlns"&&this.attribValue!==this.XMLNS_NAMESPACE)this.strictFail(`xmlns: prefix must be bound to ${this.XMLNS_NAMESPACE}
21
- Actual: ${this.attribValue}`);else{let r=this.tag,n=this.tags[this.tags.length-1]||this;r.ns===n.ns&&(r.ns=Object.create(n.ns)),r.ns[s]=this.attribValue}this.attribList.push([this.attribName,this.attribValue])}else this.tag.attributes[this.attribName]=this.attribValue,this.emitNode("onattribute",{name:this.attribName,value:this.attribValue});this.attribName=this.attribValue=""}newTag(){this.strict||(this.tagName=this.tagName[this.looseCase]());let t=this.tags[this.tags.length-1]||this,i=this.tag={name:this.tagName,attributes:{}};this.opt.xmlns&&(i.ns=t.ns),this.attribList.length=0,this.emitNode("onopentagstart",i)}parseEntity(){let t=this.entity,i=t.toLowerCase(),s=NaN,r="";return this.ENTITIES[t]?this.ENTITIES[t]:this.ENTITIES[i]?this.ENTITIES[i]:(t=i,t.charAt(0)==="#"&&(t.charAt(1)==="x"?(t=t.slice(2),s=parseInt(t,16),r=s.toString(16)):(t=t.slice(1),s=parseInt(t,10),r=s.toString(10))),t=t.replace(/^0+/,""),isNaN(s)||r.toLowerCase()!==t?(this.strictFail("Invalid character entity"),`&${this.entity};`):String.fromCodePoint(s))}beginWhiteSpace(t){t==="<"?(this.state=this.S.OPEN_WAKA,this.startTagPosition=this.position):l.isWhitespace(t)||(this.strictFail("Non-whitespace before first tag."),this.textNode=t,this.state=this.S.TEXT)}strictFail(t){if(typeof this!="object"||!(this instanceof b))throw new Error("bad call to strictFail");this.strict&&this.errorFunction(t)}textApplyOptions(t){return this.opt.trim&&(t=t.trim()),this.opt.normalize&&(t=t.replace(/\s+/g," ")),t}emitNode(t,i){this.textNode&&this.closeText(),this.emit(t,i)}closeText(){this.textNode=this.textApplyOptions(this.textNode),this.textNode!==void 0&&this.textNode!==""&&this.textNode!=="undefined"&&this.emit("ontext",this.textNode),this.textNode=""}checkBufferLength(){let t=Math.max(this.opt.MAX_BUFFER_LENGTH,10),i=0;for(let r=0,n=this.BUFFERS.length;r<n;r++){let h=this[this.BUFFERS[r]]?.length||0;if(h>t)switch(this.BUFFERS[r]){case"textNode":this.closeText();break;case"cdata":this.emitNode("oncdata",this.cdata),this.cdata="";break;case"script":this.emitNode("onscript",this.script),this.script="";break;default:this.errorFunction(`Max buffer length exceeded: ${this.BUFFERS[r]}`)}i=Math.max(i,h)}let s=this.opt.MAX_BUFFER_LENGTH-i;this.bufferCheckPosition=s+this.position}openTag(t){if(this.opt.xmlns){let i=this.tag,s=l.qname(this.tagName);i.prefix=s.prefix,i.local=s.local,i.uri=i.ns[s.prefix]||"",i.prefix&&!i.uri&&(this.strictFail(`Unbound namespace prefix: ${JSON.stringify(this.tagName)}`),i.uri=s.prefix);let r=this.tags[this.tags.length-1]||this;if(i.ns&&r.ns!==i.ns){let n=this;Object.keys(i.ns).forEach(h=>{n.emitNode("onopennamespace",{prefix:h,uri:i.ns[h]})})}for(let n=0,h=this.attribList.length;n<h;n++){let a=this.attribList[n],o=a[0],c=a[1],u=l.qname(o,!0),f=u.prefix,g=u.local,p=f===""?"":i.ns[f]||"",N={name:o,value:c,prefix:f,local:g,uri:p};f&&f!=="xmlns"&&!p&&(this.strictFail(`Unbound namespace prefix: ${JSON.stringify(f)}`),N.uri=f),this.tag.attributes[o]=N,this.emitNode("onattribute",N)}this.attribList.length=0}this.tag.isSelfClosing=Boolean(t),this.sawRoot=!0,this.tags.push(this.tag),this.emitNode("onopentag",this.tag),t||(!this.noscript&&this.tagName.toLowerCase()==="script"?this.state=this.S.SCRIPT:this.state=this.S.TEXT,this.tag=null,this.tagName=""),this.attribName=this.attribValue="",this.attribList.length=0}closeTag(){if(!this.tagName){this.strictFail("Weird empty close tag."),this.textNode+="</>",this.state=this.S.TEXT;return}if(this.script){if(this.tagName!=="script"){this.script+=`</${this.tagName}>`,this.tagName="",this.state=this.S.SCRIPT;return}this.emitNode("onscript",this.script),this.script=""}let t=this.tags.length,i=this.tagName;for(this.strict||(i=i[this.looseCase]());t--&&this.tags[t].name!==i;)this.strictFail("Unexpected close tag");if(t<0){this.strictFail(`Unmatched closing tag: ${this.tagName}`),this.textNode+=`</${this.tagName}>`,this.state=this.S.TEXT;return}this.tagName=i;let s=this.tags.length;for(;s-- >t;){let r=this.tag=this.tags.pop();this.tagName=this.tag.name,this.emitNode("onclosetag",this.tagName);let n={};for(let a in r.ns)r.ns.hasOwnProperty(a)&&(n[a]=r.ns[a]);let h=this.tags[this.tags.length-1]||this;if(this.opt.xmlns&&r.ns!==h.ns){let a=this;Object.keys(r.ns).forEach(o=>{let c=r.ns[o];a.emitNode("onclosenamespace",{prefix:o,uri:c})})}}t===0&&(this.closedRoot=!0),this.tagName=this.attribValue=this.attribName="",this.attribList.length=0,this.state=this.S.TEXT}},b=class extends l{opt=Xt;events=tt;constructor(t){super(),this.clearBuffers(),this.opt=t={...this.opt,...t},this.events={...this.events,...t},this.q=this.c="",this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags,this.bufferCheckPosition=this.opt.MAX_BUFFER_LENGTH,this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase",this.tags=[],this.closed=this.closedRoot=this.sawRoot=!1,this.tag=this.error=null,this.strict=Boolean(this.opt.strict),this.noscript=Boolean(this.opt.strict||this.opt.noscript),this.state=this.S.BEGIN,this.strictEntities=this.opt.strictEntities,this.ENTITIES=this.strictEntities?Object.create(this.XML_ENTITIES):Object.create(this.ENTITIES),this.attribList=[],this.opt.xmlns&&(this.ns=Object.create(this.rootNS)),this.trackPosition=this.opt.position!==!1,this.trackPosition&&(this.position=this.line=this.column=0),this.emit("onready")}resume(){return this.error=null,this}close(){return this.write(null)}flush(){this.flushBuffers()}};J(b,"ENTITIES",O);function v(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function y(e){if(Array.isArray(e))return e.map(t=>y(t));if(e&&typeof e=="object"){let t={};for(let[i,s]of Object.entries(e))t[v(i)]=y(s);return t}return e}var Lt=Z(wt(),1);function H(e,t){if(t?._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let i={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(r,n,h,a)=>Boolean(t?.arrayPaths?.some(c=>n===c)),...t?._fastXML},s=rs(e,i);return t?.uncapitalizeKeys?y(s):s}function rs(e,t){return new Lt.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var ns="4.3.0-alpha.4",I={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:ns,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:os,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>H(new TextDecoder().decode(e),{...I.options.xml,...t?.xml}),parseTextSync:(e,t)=>H(e,{...I.options.xml,...t?.xml})};function os(e){return e.startsWith("<?xml")}function z(e,t){return Mt(e||{},t)}function Mt(e,t,i=0){if(i>3)return t;let s={...e};for(let[r,n]of Object.entries(t))n&&typeof n=="object"&&!Array.isArray(n)?s[r]=Mt(s[r]||{},t[r],i+1):s[r]=t[r];return s}var Rt={...I,name:"HTML",id:"html",extensions:["html","htm"],mimeTypes:["text/html"],testText:as,parse:async(e,t)=>Bt(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Bt(e,t)};function as(e){return e.startsWith("<html")}function Bt(e,t){return t=z(t,{xml:{_parser:"fast-xml-parser",_fastXML:{htmlEntities:!0}}}),I.parseTextSync?.(e,t)}function K(e){return Array.isArray(e)?e:(e&&typeof e=="object"&&e[0],e?[e]:[])}function Vt(e,t){e[t]=K(e[t])}return Yt(w);})();
21
+ Actual: ${this.attribValue}`);else{let r=this.tag,n=this.tags[this.tags.length-1]||this;r.ns===n.ns&&(r.ns=Object.create(n.ns)),r.ns[s]=this.attribValue}this.attribList.push([this.attribName,this.attribValue])}else this.tag.attributes[this.attribName]=this.attribValue,this.emitNode("onattribute",{name:this.attribName,value:this.attribValue});this.attribName=this.attribValue=""}newTag(){this.strict||(this.tagName=this.tagName[this.looseCase]());let t=this.tags[this.tags.length-1]||this,i=this.tag={name:this.tagName,attributes:{}};this.opt.xmlns&&(i.ns=t.ns),this.attribList.length=0,this.emitNode("onopentagstart",i)}parseEntity(){let t=this.entity,i=t.toLowerCase(),s=NaN,r="";return this.ENTITIES[t]?this.ENTITIES[t]:this.ENTITIES[i]?this.ENTITIES[i]:(t=i,t.charAt(0)==="#"&&(t.charAt(1)==="x"?(t=t.slice(2),s=parseInt(t,16),r=s.toString(16)):(t=t.slice(1),s=parseInt(t,10),r=s.toString(10))),t=t.replace(/^0+/,""),isNaN(s)||r.toLowerCase()!==t?(this.strictFail("Invalid character entity"),`&${this.entity};`):String.fromCodePoint(s))}beginWhiteSpace(t){t==="<"?(this.state=this.S.OPEN_WAKA,this.startTagPosition=this.position):f.isWhitespace(t)||(this.strictFail("Non-whitespace before first tag."),this.textNode=t,this.state=this.S.TEXT)}strictFail(t){if(typeof this!="object"||!(this instanceof A))throw new Error("bad call to strictFail");this.strict&&this.errorFunction(t)}textApplyOptions(t){return this.opt.trim&&(t=t.trim()),this.opt.normalize&&(t=t.replace(/\s+/g," ")),t}emitNode(t,i){this.textNode&&this.closeText(),this.emit(t,i)}closeText(){this.textNode=this.textApplyOptions(this.textNode),this.textNode!==void 0&&this.textNode!==""&&this.textNode!=="undefined"&&this.emit("ontext",this.textNode),this.textNode=""}checkBufferLength(){let t=Math.max(this.opt.MAX_BUFFER_LENGTH,10),i=0;for(let r=0,n=this.BUFFERS.length;r<n;r++){let h=this[this.BUFFERS[r]]?.length||0;if(h>t)switch(this.BUFFERS[r]){case"textNode":this.closeText();break;case"cdata":this.emitNode("oncdata",this.cdata),this.cdata="";break;case"script":this.emitNode("onscript",this.script),this.script="";break;default:this.errorFunction(`Max buffer length exceeded: ${this.BUFFERS[r]}`)}i=Math.max(i,h)}let s=this.opt.MAX_BUFFER_LENGTH-i;this.bufferCheckPosition=s+this.position}openTag(t){if(this.opt.xmlns){let i=this.tag,s=f.qname(this.tagName);i.prefix=s.prefix,i.local=s.local,i.uri=i.ns[s.prefix]||"",i.prefix&&!i.uri&&(this.strictFail(`Unbound namespace prefix: ${JSON.stringify(this.tagName)}`),i.uri=s.prefix);let r=this.tags[this.tags.length-1]||this;if(i.ns&&r.ns!==i.ns){let n=this;Object.keys(i.ns).forEach(h=>{n.emitNode("onopennamespace",{prefix:h,uri:i.ns[h]})})}for(let n=0,h=this.attribList.length;n<h;n++){let a=this.attribList[n],o=a[0],c=a[1],l=f.qname(o,!0),u=l.prefix,g=l.local,N=u===""?"":i.ns[u]||"",p={name:o,value:c,prefix:u,local:g,uri:N};u&&u!=="xmlns"&&!N&&(this.strictFail(`Unbound namespace prefix: ${JSON.stringify(u)}`),p.uri=u),this.tag.attributes[o]=p,this.emitNode("onattribute",p)}this.attribList.length=0}this.tag.isSelfClosing=Boolean(t),this.sawRoot=!0,this.tags.push(this.tag),this.emitNode("onopentag",this.tag),t||(!this.noscript&&this.tagName.toLowerCase()==="script"?this.state=this.S.SCRIPT:this.state=this.S.TEXT,this.tag=null,this.tagName=""),this.attribName=this.attribValue="",this.attribList.length=0}closeTag(){if(!this.tagName){this.strictFail("Weird empty close tag."),this.textNode+="</>",this.state=this.S.TEXT;return}if(this.script){if(this.tagName!=="script"){this.script+=`</${this.tagName}>`,this.tagName="",this.state=this.S.SCRIPT;return}this.emitNode("onscript",this.script),this.script=""}let t=this.tags.length,i=this.tagName;for(this.strict||(i=i[this.looseCase]());t--&&this.tags[t].name!==i;)this.strictFail("Unexpected close tag");if(t<0){this.strictFail(`Unmatched closing tag: ${this.tagName}`),this.textNode+=`</${this.tagName}>`,this.state=this.S.TEXT;return}this.tagName=i;let s=this.tags.length;for(;s-- >t;){let r=this.tag=this.tags.pop();this.tagName=this.tag.name,this.emitNode("onclosetag",this.tagName);let n={};for(let a in r.ns)r.ns.hasOwnProperty(a)&&(n[a]=r.ns[a]);let h=this.tags[this.tags.length-1]||this;if(this.opt.xmlns&&r.ns!==h.ns){let a=this;Object.keys(r.ns).forEach(o=>{let c=r.ns[o];a.emitNode("onclosenamespace",{prefix:o,uri:c})})}}t===0&&(this.closedRoot=!0),this.tagName=this.attribValue=this.attribName="",this.attribList.length=0,this.state=this.S.TEXT}},A=class extends f{opt=Xt;events=D;constructor(t){super(),this.clearBuffers(),this.opt=t={...this.opt,...t},this.events={...this.events,...t},this.q=this.c="",this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags,this.bufferCheckPosition=this.opt.MAX_BUFFER_LENGTH,this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase",this.tags=[],this.closed=this.closedRoot=this.sawRoot=!1,this.tag=this.error=null,this.strict=Boolean(this.opt.strict),this.noscript=Boolean(this.opt.strict||this.opt.noscript),this.state=this.S.BEGIN,this.strictEntities=this.opt.strictEntities,this.ENTITIES=this.strictEntities?Object.create(this.XML_ENTITIES):Object.create(this.ENTITIES),this.attribList=[],this.opt.xmlns&&(this.ns=Object.create(this.rootNS)),this.trackPosition=this.opt.position!==!1,this.trackPosition&&(this.position=this.line=this.column=0),this.emit("onready")}resume(){return this.error=null,this}close(){return this.write(null)}flush(){this.flushBuffers()}};Z(A,"ENTITIES",_);function v(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function x(e){if(Array.isArray(e))return e.map(t=>x(t));if(e&&typeof e=="object"){let t={};for(let[i,s]of Object.entries(e))t[v(i)]=x(s);return t}return e}var Lt=K(wt(),1);function Q(e,t){if(t?._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let i={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(r,n,h,a)=>Boolean(t?.arrayPaths?.some(c=>n===c)),...t?._fastXML},s=rs(e,i);return t?.uncapitalizeKeys?x(s):s}function rs(e,t){return new Lt.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var ns="4.3.0-alpha.6",y={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:ns,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:os,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>Q(new TextDecoder().decode(e),{...y.options.xml,...t?.xml}),parseTextSync:(e,t)=>Q(e,{...y.options.xml,...t?.xml})};function os(e){return e.startsWith("<?xml")}function H(e,t){return Bt(e||{},t)}function Bt(e,t,i=0){if(i>3)return t;let s={...e};for(let[r,n]of Object.entries(t))n&&typeof n=="object"&&!Array.isArray(n)?s[r]=Bt(s[r]||{},t[r],i+1):s[r]=t[r];return s}var Rt={...y,name:"HTML",id:"html",extensions:["html","htm"],mimeTypes:["text/html"],testText:as,parse:async(e,t)=>Mt(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Mt(e,t)};function as(e){return e.startsWith("<html")}function Mt(e,t){return t=H(t,{xml:{_parser:"fast-xml-parser",_fastXML:{htmlEntities:!0}}}),y.parseTextSync?.(e,t)}function z(e){return Array.isArray(e)?e:(e&&typeof e=="object"&&e[0],e?[e]:[])}function Vt(e,t){e[t]=z(e[t])}return Yt(L);})();
22
22
  return __exports__;
23
23
  });
package/dist/index.cjs CHANGED
@@ -1472,7 +1472,7 @@ function fastParseXML(text, options) {
1472
1472
  }
1473
1473
 
1474
1474
  // dist/xml-loader.js
1475
- var VERSION = true ? "4.3.0-alpha.4" : "latest";
1475
+ var VERSION = true ? "4.3.0-alpha.6" : "latest";
1476
1476
  var XMLLoader = {
1477
1477
  dataType: null,
1478
1478
  batchType: null,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.js", "sax-ts/sax.js", "lib/xml-utils/uncapitalize.js", "lib/parsers/parse-xml.js", "xml-loader.js", "html-loader.js", "lib/xml-utils/xml-utils.js"],
4
- "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { XMLLoader } from \"./xml-loader.js\";\nexport { HTMLLoader } from \"./html-loader.js\";\nexport { SAXParser as SAXParser } from \"./sax-ts/sax.js\";\n// Utilities\nexport { convertXMLValueToArray, convertXMLFieldToArrayInPlace } from \"./lib/xml-utils/xml-utils.js\";\n// Experimental\nexport { uncapitalize as _uncapitalize, uncapitalizeKeys as _uncapitalizeKeys } from \"./lib/xml-utils/uncapitalize.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nconst DEFAULT_SAX_EVENTS = {\n ontext: () => { },\n onprocessinginstruction: () => { },\n onsgmldeclaration: () => { },\n ondoctype: () => { },\n oncomment: () => { },\n onopentagstart: () => { },\n onattribute: () => { },\n onopentag: () => { },\n onclosetag: () => { },\n onopencdata: () => { },\n oncdata: () => { },\n onclosecdata: () => { },\n onerror: () => { },\n onend: () => { },\n onready: () => { },\n onscript: () => { },\n onopennamespace: () => { },\n onclosenamespace: () => { }\n};\nconst DEFAULT_SAX_PARSER_OPTIONS = {\n ...DEFAULT_SAX_EVENTS,\n strict: false,\n MAX_BUFFER_LENGTH: 64 * 1024,\n lowercase: false,\n lowercasetags: false,\n noscript: false,\n strictEntities: false,\n xmlns: undefined,\n position: undefined,\n trim: undefined,\n normalize: undefined\n};\nconst EVENTS = [\n 'text',\n 'processinginstruction',\n 'sgmldeclaration',\n 'doctype',\n 'comment',\n 'opentagstart',\n 'attribute',\n 'opentag',\n 'closetag',\n 'opencdata',\n 'cdata',\n 'closecdata',\n 'error',\n 'end',\n 'ready',\n 'script',\n 'opennamespace',\n 'closenamespace'\n];\nconst BUFFERS = [\n 'comment',\n 'sgmlDecl',\n 'textNode',\n 'tagName',\n 'doctype',\n 'procInstName',\n 'procInstBody',\n 'entity',\n 'attribName',\n 'attribValue',\n 'cdata',\n 'script'\n];\nconst nameStart = /[:_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]/;\nconst nameBody = /[:_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\\u00B7\\u0300-\\u036F\\u203F-\\u2040.\\d-]/;\nconst entityStart = /[#:_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]/;\nconst entityBody = /[#:_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\\u00B7\\u0300-\\u036F\\u203F-\\u2040.\\d-]/;\nexport const ENTITIES = {\n amp: '&',\n gt: '>',\n lt: '<',\n quot: '\"',\n apos: \"'\",\n AElig: 198,\n Aacute: 193,\n Acirc: 194,\n Agrave: 192,\n Aring: 197,\n Atilde: 195,\n Auml: 196,\n Ccedil: 199,\n ETH: 208,\n Eacute: 201,\n Ecirc: 202,\n Egrave: 200,\n Euml: 203,\n Iacute: 205,\n Icirc: 206,\n Igrave: 204,\n Iuml: 207,\n Ntilde: 209,\n Oacute: 211,\n Ocirc: 212,\n Ograve: 210,\n Oslash: 216,\n Otilde: 213,\n Ouml: 214,\n THORN: 222,\n Uacute: 218,\n Ucirc: 219,\n Ugrave: 217,\n Uuml: 220,\n Yacute: 221,\n aacute: 225,\n acirc: 226,\n aelig: 230,\n agrave: 224,\n aring: 229,\n atilde: 227,\n auml: 228,\n ccedil: 231,\n eacute: 233,\n ecirc: 234,\n egrave: 232,\n eth: 240,\n euml: 235,\n iacute: 237,\n icirc: 238,\n igrave: 236,\n iuml: 239,\n ntilde: 241,\n oacute: 243,\n ocirc: 244,\n ograve: 242,\n oslash: 248,\n otilde: 245,\n ouml: 246,\n szlig: 223,\n thorn: 254,\n uacute: 250,\n ucirc: 251,\n ugrave: 249,\n uuml: 252,\n yacute: 253,\n yuml: 255,\n copy: 169,\n reg: 174,\n nbsp: 160,\n iexcl: 161,\n cent: 162,\n pound: 163,\n curren: 164,\n yen: 165,\n brvbar: 166,\n sect: 167,\n uml: 168,\n ordf: 170,\n laquo: 171,\n not: 172,\n shy: 173,\n macr: 175,\n deg: 176,\n plusmn: 177,\n sup1: 185,\n sup2: 178,\n sup3: 179,\n acute: 180,\n micro: 181,\n para: 182,\n middot: 183,\n cedil: 184,\n ordm: 186,\n raquo: 187,\n frac14: 188,\n frac12: 189,\n frac34: 190,\n iquest: 191,\n times: 215,\n divide: 247,\n OElig: 338,\n oelig: 339,\n Scaron: 352,\n scaron: 353,\n Yuml: 376,\n fnof: 402,\n circ: 710,\n tilde: 732,\n Alpha: 913,\n Beta: 914,\n Gamma: 915,\n Delta: 916,\n Epsilon: 917,\n Zeta: 918,\n Eta: 919,\n Theta: 920,\n Iota: 921,\n Kappa: 922,\n Lambda: 923,\n Mu: 924,\n Nu: 925,\n Xi: 926,\n Omicron: 927,\n Pi: 928,\n Rho: 929,\n Sigma: 931,\n Tau: 932,\n Upsilon: 933,\n Phi: 934,\n Chi: 935,\n Psi: 936,\n Omega: 937,\n alpha: 945,\n beta: 946,\n gamma: 947,\n delta: 948,\n epsilon: 949,\n zeta: 950,\n eta: 951,\n theta: 952,\n iota: 953,\n kappa: 954,\n lambda: 955,\n mu: 956,\n nu: 957,\n xi: 958,\n omicron: 959,\n pi: 960,\n rho: 961,\n sigmaf: 962,\n sigma: 963,\n tau: 964,\n upsilon: 965,\n phi: 966,\n chi: 967,\n psi: 968,\n omega: 969,\n thetasym: 977,\n upsih: 978,\n piv: 982,\n ensp: 8194,\n emsp: 8195,\n thinsp: 8201,\n zwnj: 8204,\n zwj: 8205,\n lrm: 8206,\n rlm: 8207,\n ndash: 8211,\n mdash: 8212,\n lsquo: 8216,\n rsquo: 8217,\n sbquo: 8218,\n ldquo: 8220,\n rdquo: 8221,\n bdquo: 8222,\n dagger: 8224,\n Dagger: 8225,\n bull: 8226,\n hellip: 8230,\n permil: 8240,\n prime: 8242,\n Prime: 8243,\n lsaquo: 8249,\n rsaquo: 8250,\n oline: 8254,\n frasl: 8260,\n euro: 8364,\n image: 8465,\n weierp: 8472,\n real: 8476,\n trade: 8482,\n alefsym: 8501,\n larr: 8592,\n uarr: 8593,\n rarr: 8594,\n darr: 8595,\n harr: 8596,\n crarr: 8629,\n lArr: 8656,\n uArr: 8657,\n rArr: 8658,\n dArr: 8659,\n hArr: 8660,\n forall: 8704,\n part: 8706,\n exist: 8707,\n empty: 8709,\n nabla: 8711,\n isin: 8712,\n notin: 8713,\n ni: 8715,\n prod: 8719,\n sum: 8721,\n minus: 8722,\n lowast: 8727,\n radic: 8730,\n prop: 8733,\n infin: 8734,\n ang: 8736,\n and: 8743,\n or: 8744,\n cap: 8745,\n cup: 8746,\n int: 8747,\n there4: 8756,\n sim: 8764,\n cong: 8773,\n asymp: 8776,\n ne: 8800,\n equiv: 8801,\n le: 8804,\n ge: 8805,\n sub: 8834,\n sup: 8835,\n nsub: 8836,\n sube: 8838,\n supe: 8839,\n oplus: 8853,\n otimes: 8855,\n perp: 8869,\n sdot: 8901,\n lceil: 8968,\n rceil: 8969,\n lfloor: 8970,\n rfloor: 8971,\n lang: 9001,\n rang: 9002,\n loz: 9674,\n spades: 9824,\n clubs: 9827,\n hearts: 9829,\n diams: 9830\n};\nObject.keys(ENTITIES).forEach((key) => {\n const e = ENTITIES[key];\n ENTITIES[key] = typeof e === 'number' ? String.fromCharCode(e) : e;\n});\n/**\n * Internal helper class\n */\nclass SAX {\n EVENTS = EVENTS;\n ENTITIES = {\n // TODO: make it readonly, needed for entity-mega test\n // amp, gt, lt, quot and apos are resolved to strings instead of numerical\n // codes, IDK why\n ...ENTITIES\n };\n XML_ENTITIES = {\n amp: '&',\n gt: '>',\n lt: '<',\n quot: '\"',\n apos: \"'\"\n };\n S = 0;\n opt;\n trackPosition = false;\n column = 0;\n line = 0;\n c = '';\n error;\n q = '';\n bufferCheckPosition;\n closed = false;\n tags = [];\n looseCase = '';\n closedRoot = false;\n sawRoot = false;\n strict = false;\n tag;\n strictEntities;\n state;\n noscript = false;\n attribList = [];\n ns;\n position = 0;\n STATE = {\n BEGIN: this.S++, // leading byte order mark or whitespace\n BEGIN_WHITESPACE: this.S++, // leading whitespace\n TEXT: this.S++, // general stuff\n TEXT_ENTITY: this.S++, // &amp and such.\n OPEN_WAKA: this.S++, // <\n SGML_DECL: this.S++, // <!BLARG\n SGML_DECL_QUOTED: this.S++, // <!BLARG foo \"bar\n DOCTYPE: this.S++, // <!DOCTYPE\n DOCTYPE_QUOTED: this.S++, // <!DOCTYPE \"//blah\n DOCTYPE_DTD: this.S++, // <!DOCTYPE \"//blah\" [ ...\n DOCTYPE_DTD_QUOTED: this.S++, // <!DOCTYPE \"//blah\" [ \"foo\n COMMENT_STARTING: this.S++, // <!-\n COMMENT: this.S++, // <!--\n COMMENT_ENDING: this.S++, // <!-- blah -\n COMMENT_ENDED: this.S++, // <!-- blah --\n CDATA: this.S++, // <![CDATA[ something\n CDATA_ENDING: this.S++, // ]\n CDATA_ENDING_2: this.S++, // ]]\n PROC_INST: this.S++, // <?hi\n PROC_INST_BODY: this.S++, // <?hi there\n PROC_INST_ENDING: this.S++, // <?hi \"there\" ?\n OPEN_TAG: this.S++, // <strong\n OPEN_TAG_SLASH: this.S++, // <strong /\n ATTRIB: this.S++, // <a\n ATTRIB_NAME: this.S++, // <a foo\n ATTRIB_NAME_SAW_WHITE: this.S++, // <a foo _\n ATTRIB_VALUE: this.S++, // <a foo=\n ATTRIB_VALUE_QUOTED: this.S++, // <a foo=\"bar\n ATTRIB_VALUE_CLOSED: this.S++, // <a foo=\"bar\"\n ATTRIB_VALUE_UNQUOTED: this.S++, // <a foo=bar\n ATTRIB_VALUE_ENTITY_Q: this.S++, // <foo bar=\"&quot;\"\n ATTRIB_VALUE_ENTITY_U: this.S++, // <foo bar=&quot\n CLOSE_TAG: this.S++, // </a\n CLOSE_TAG_SAW_WHITE: this.S++, // </a >\n SCRIPT: this.S++, // <script> ...\n SCRIPT_ENDING: this.S++ // <script> ... <\n };\n BUFFERS = BUFFERS;\n // private parser: (strict: boolean, opt: any) => SAXParser;\n CDATA = '[CDATA[';\n DOCTYPE = 'DOCTYPE';\n XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';\n XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/';\n rootNS = {\n xml: this.XML_NAMESPACE,\n xmlns: this.XMLNS_NAMESPACE\n };\n comment;\n sgmlDecl;\n textNode = '';\n tagName;\n doctype;\n procInstName;\n procInstBody;\n entity = '';\n attribName;\n attribValue;\n cdata = '';\n script = '';\n startTagPosition = 0;\n constructor() {\n this.S = 0;\n for (const s in this.STATE) {\n if (this.STATE.hasOwnProperty(s)) {\n this.STATE[this.STATE[s]] = s;\n }\n }\n // shorthand\n this.S = this.STATE;\n }\n static charAt(chunk, i) {\n let result = '';\n if (i < chunk.length) {\n result = chunk.charAt(i);\n }\n return result;\n }\n static isWhitespace(c) {\n return c === ' ' || c === '\\n' || c === '\\r' || c === '\\t';\n }\n static isQuote(c) {\n return c === '\"' || c === \"'\";\n }\n static isAttribEnd(c) {\n return c === '>' || SAX.isWhitespace(c);\n }\n static isMatch(regex, c) {\n return regex.test(c);\n }\n static notMatch(regex, c) {\n return !SAX.isMatch(regex, c);\n }\n static qname(name, attribute) {\n const i = name.indexOf(':');\n const qualName = i < 0 ? ['', name] : name.split(':');\n let prefix = qualName[0];\n let local = qualName[1];\n // <x \"xmlns\"=\"http://foo\">\n if (attribute && name === 'xmlns') {\n prefix = 'xmlns';\n local = '';\n }\n return { prefix, local };\n }\n write(chunk) {\n if (this.error) {\n throw this.error;\n }\n if (this.closed) {\n return this.errorFunction('Cannot write after close. Assign an onready handler.');\n }\n if (chunk === null) {\n return this.end();\n }\n if (typeof chunk === 'object') {\n chunk = chunk.toString();\n }\n let i = 0;\n let c;\n while (true) {\n c = SAX.charAt(chunk, i++);\n this.c = c;\n if (!c) {\n break;\n }\n if (this.trackPosition) {\n this.position++;\n if (c === '\\n') {\n this.line++;\n this.column = 0;\n }\n else {\n this.column++;\n }\n }\n switch (this.state) {\n case this.S.BEGIN:\n this.state = this.S.BEGIN_WHITESPACE;\n if (c === '\\uFEFF') {\n continue;\n }\n this.beginWhiteSpace(c);\n continue;\n case this.S.BEGIN_WHITESPACE:\n this.beginWhiteSpace(c);\n continue;\n case this.S.TEXT:\n if (this.sawRoot && !this.closedRoot) {\n const starti = i - 1;\n while (c && c !== '<' && c !== '&') {\n c = SAX.charAt(chunk, i++);\n if (c && this.trackPosition) {\n this.position++;\n if (c === '\\n') {\n this.line++;\n this.column = 0;\n }\n else {\n this.column++;\n }\n }\n }\n this.textNode += chunk.substring(starti, i - 1);\n }\n if (c === '<' && !(this.sawRoot && this.closedRoot && !this.strict)) {\n this.state = this.S.OPEN_WAKA;\n this.startTagPosition = this.position;\n }\n else {\n if (!SAX.isWhitespace(c) && (!this.sawRoot || this.closedRoot)) {\n this.strictFail('Text data outside of root node.');\n }\n if (c === '&') {\n this.state = this.S.TEXT_ENTITY;\n }\n else {\n this.textNode += c;\n }\n }\n continue;\n case this.S.SCRIPT:\n // only non-strict\n if (c === '<') {\n this.state = this.S.SCRIPT_ENDING;\n }\n else {\n this.script += c;\n }\n continue;\n case this.S.SCRIPT_ENDING:\n if (c === '/') {\n this.state = this.S.CLOSE_TAG;\n }\n else {\n this.script += `<${c}`;\n this.state = this.S.SCRIPT;\n }\n continue;\n case this.S.OPEN_WAKA:\n // either a /, ?, !, or text is coming next.\n if (c === '!') {\n this.state = this.S.SGML_DECL;\n this.sgmlDecl = '';\n }\n else if (SAX.isWhitespace(c)) {\n // wait for it...\n }\n else if (SAX.isMatch(nameStart, c)) {\n this.state = this.S.OPEN_TAG;\n this.tagName = c;\n }\n else if (c === '/') {\n this.state = this.S.CLOSE_TAG;\n this.tagName = '';\n }\n else if (c === '?') {\n this.state = this.S.PROC_INST;\n this.procInstName = this.procInstBody = '';\n }\n else {\n this.strictFail('Unencoded <');\n // if there was some whitespace, then add that in.\n if (this.startTagPosition + 1 < this.position) {\n const pad = this.position - this.startTagPosition;\n c = new Array(pad).join(' ') + c;\n }\n this.textNode += `<${c}`;\n this.state = this.S.TEXT;\n }\n continue;\n case this.S.SGML_DECL:\n if ((this.sgmlDecl + c).toUpperCase() === this.CDATA) {\n this.emitNode('onopencdata');\n this.state = this.S.CDATA;\n this.sgmlDecl = '';\n this.cdata = '';\n }\n else if (this.sgmlDecl + c === '--') {\n this.state = this.S.COMMENT;\n this.comment = '';\n this.sgmlDecl = '';\n }\n else if ((this.sgmlDecl + c).toUpperCase() === this.DOCTYPE) {\n this.state = this.S.DOCTYPE;\n if (this.doctype || this.sawRoot) {\n this.strictFail('Inappropriately located doctype declaration');\n }\n this.doctype = '';\n this.sgmlDecl = '';\n }\n else if (c === '>') {\n this.emitNode('onsgmldeclaration', this.sgmlDecl);\n this.sgmlDecl = '';\n this.state = this.S.TEXT;\n }\n else if (SAX.isQuote(c)) {\n this.state = this.S.SGML_DECL_QUOTED;\n this.sgmlDecl += c;\n }\n else {\n this.sgmlDecl += c;\n }\n continue;\n case this.S.SGML_DECL_QUOTED:\n if (c === this.q) {\n this.state = this.S.SGML_DECL;\n this.q = '';\n }\n this.sgmlDecl += c;\n continue;\n case this.S.DOCTYPE:\n if (c === '>') {\n this.state = this.S.TEXT;\n this.emitNode('ondoctype', this.doctype);\n this.doctype = true; // just remember that we saw it.\n }\n else {\n this.doctype += c;\n if (c === '[') {\n this.state = this.S.DOCTYPE_DTD;\n }\n else if (SAX.isQuote(c)) {\n this.state = this.S.DOCTYPE_QUOTED;\n this.q = c;\n }\n }\n continue;\n case this.S.DOCTYPE_QUOTED:\n this.doctype += c;\n if (c === this.q) {\n this.q = '';\n this.state = this.S.DOCTYPE;\n }\n continue;\n case this.S.DOCTYPE_DTD:\n this.doctype += c;\n if (c === ']') {\n this.state = this.S.DOCTYPE;\n }\n else if (SAX.isQuote(c)) {\n this.state = this.S.DOCTYPE_DTD_QUOTED;\n this.q = c;\n }\n continue;\n case this.S.DOCTYPE_DTD_QUOTED:\n this.doctype += c;\n if (c === this.q) {\n this.state = this.S.DOCTYPE_DTD;\n this.q = '';\n }\n continue;\n case this.S.COMMENT:\n if (c === '-') {\n this.state = this.S.COMMENT_ENDING;\n }\n else {\n this.comment += c;\n }\n continue;\n case this.S.COMMENT_ENDING:\n if (c === '-') {\n this.state = this.S.COMMENT_ENDED;\n this.comment = this.textApplyOptions(this.comment);\n if (this.comment) {\n this.emitNode('oncomment', this.comment);\n }\n this.comment = '';\n }\n else {\n this.comment += `-${c}`;\n this.state = this.S.COMMENT;\n }\n continue;\n case this.S.COMMENT_ENDED:\n if (c !== '>') {\n this.strictFail('Malformed comment');\n // allow <!-- blah -- bloo --> in non-strict mode,\n // which is a comment of \" blah -- bloo \"\n this.comment += `--${c}`;\n this.state = this.S.COMMENT;\n }\n else {\n this.state = this.S.TEXT;\n }\n continue;\n case this.S.CDATA:\n if (c === ']') {\n this.state = this.S.CDATA_ENDING;\n }\n else {\n this.cdata += c;\n }\n continue;\n case this.S.CDATA_ENDING:\n if (c === ']') {\n this.state = this.S.CDATA_ENDING_2;\n }\n else {\n this.cdata += `]${c}`;\n this.state = this.S.CDATA;\n }\n continue;\n case this.S.CDATA_ENDING_2:\n if (c === '>') {\n if (this.cdata) {\n this.emitNode('oncdata', this.cdata);\n }\n this.emitNode('onclosecdata');\n this.cdata = '';\n this.state = this.S.TEXT;\n }\n else if (c === ']') {\n this.cdata += ']';\n }\n else {\n this.cdata += `]]${c}`;\n this.state = this.S.CDATA;\n }\n continue;\n case this.S.PROC_INST:\n if (c === '?') {\n this.state = this.S.PROC_INST_ENDING;\n }\n else if (SAX.isWhitespace(c)) {\n this.state = this.S.PROC_INST_BODY;\n }\n else {\n this.procInstName += c;\n }\n continue;\n case this.S.PROC_INST_BODY:\n if (!this.procInstBody && SAX.isWhitespace(c)) {\n continue;\n }\n else if (c === '?') {\n this.state = this.S.PROC_INST_ENDING;\n }\n else {\n this.procInstBody += c;\n }\n continue;\n case this.S.PROC_INST_ENDING:\n if (c === '>') {\n this.emitNode('onprocessinginstruction', {\n name: this.procInstName,\n body: this.procInstBody\n });\n this.procInstName = this.procInstBody = '';\n this.state = this.S.TEXT;\n }\n else {\n this.procInstBody += `?${c}`;\n this.state = this.S.PROC_INST_BODY;\n }\n continue;\n case this.S.OPEN_TAG:\n if (SAX.isMatch(nameBody, c)) {\n this.tagName += c;\n }\n else {\n this.newTag();\n if (c === '>') {\n this.openTag();\n }\n else if (c === '/') {\n this.state = this.S.OPEN_TAG_SLASH;\n }\n else {\n if (!SAX.isWhitespace(c)) {\n this.strictFail('Invalid character in tag name');\n }\n this.state = this.S.ATTRIB;\n }\n }\n continue;\n case this.S.OPEN_TAG_SLASH:\n if (c === '>') {\n this.openTag(true);\n this.closeTag();\n }\n else {\n this.strictFail('Forward-slash in opening tag not followed by >');\n this.state = this.S.ATTRIB;\n }\n continue;\n case this.S.ATTRIB:\n // haven't read the attribute name yet.\n if (SAX.isWhitespace(c)) {\n continue;\n }\n else if (c === '>') {\n this.openTag();\n }\n else if (c === '/') {\n this.state = this.S.OPEN_TAG_SLASH;\n }\n else if (SAX.isMatch(nameStart, c)) {\n this.attribName = c;\n this.attribValue = '';\n this.state = this.S.ATTRIB_NAME;\n }\n else {\n this.strictFail('Invalid attribute name');\n }\n continue;\n case this.S.ATTRIB_NAME:\n if (c === '=') {\n this.state = this.S.ATTRIB_VALUE;\n }\n else if (c === '>') {\n this.strictFail('Attribute without value');\n this.attribValue = this.attribName;\n this.attrib();\n this.openTag();\n }\n else if (SAX.isWhitespace(c)) {\n this.state = this.S.ATTRIB_NAME_SAW_WHITE;\n }\n else if (SAX.isMatch(nameBody, c)) {\n this.attribName += c;\n }\n else {\n this.strictFail('Invalid attribute name');\n }\n continue;\n case this.S.ATTRIB_NAME_SAW_WHITE:\n if (c === '=') {\n this.state = this.S.ATTRIB_VALUE;\n }\n else if (SAX.isWhitespace(c)) {\n continue;\n }\n else {\n this.strictFail('Attribute without value');\n this.tag.attributes[this.attribName] = '';\n this.attribValue = '';\n this.emitNode('onattribute', {\n name: this.attribName,\n value: ''\n });\n this.attribName = '';\n if (c === '>') {\n this.openTag();\n }\n else if (SAX.isMatch(nameStart, c)) {\n this.attribName = c;\n this.state = this.S.ATTRIB_NAME;\n }\n else {\n this.strictFail('Invalid attribute name');\n this.state = this.S.ATTRIB;\n }\n }\n continue;\n case this.S.ATTRIB_VALUE:\n if (SAX.isWhitespace(c)) {\n continue;\n }\n else if (SAX.isQuote(c)) {\n this.q = c;\n this.state = this.S.ATTRIB_VALUE_QUOTED;\n }\n else {\n this.strictFail('Unquoted attribute value');\n this.state = this.S.ATTRIB_VALUE_UNQUOTED;\n this.attribValue = c;\n }\n continue;\n case this.S.ATTRIB_VALUE_QUOTED:\n if (c !== this.q) {\n if (c === '&') {\n this.state = this.S.ATTRIB_VALUE_ENTITY_Q;\n }\n else {\n this.attribValue += c;\n }\n continue;\n }\n this.attrib();\n this.q = '';\n this.state = this.S.ATTRIB_VALUE_CLOSED;\n continue;\n case this.S.ATTRIB_VALUE_CLOSED:\n if (SAX.isWhitespace(c)) {\n this.state = this.S.ATTRIB;\n }\n else if (c === '>') {\n this.openTag();\n }\n else if (c === '/') {\n this.state = this.S.OPEN_TAG_SLASH;\n }\n else if (SAX.isMatch(nameStart, c)) {\n this.strictFail('No whitespace between attributes');\n this.attribName = c;\n this.attribValue = '';\n this.state = this.S.ATTRIB_NAME;\n }\n else {\n this.strictFail('Invalid attribute name');\n }\n continue;\n case this.S.ATTRIB_VALUE_UNQUOTED:\n if (!SAX.isAttribEnd(c)) {\n if (c === '&') {\n this.state = this.S.ATTRIB_VALUE_ENTITY_U;\n }\n else {\n this.attribValue += c;\n }\n continue;\n }\n this.attrib();\n if (c === '>') {\n this.openTag();\n }\n else {\n this.state = this.S.ATTRIB;\n }\n continue;\n case this.S.CLOSE_TAG:\n if (!this.tagName) {\n if (SAX.isWhitespace(c)) {\n continue;\n }\n else if (SAX.notMatch(nameStart, c)) {\n if (this.script) {\n this.script += `</${c}`;\n this.state = this.S.SCRIPT;\n }\n else {\n this.strictFail('Invalid tagname in closing tag.');\n }\n }\n else {\n this.tagName = c;\n }\n }\n else if (c === '>') {\n this.closeTag();\n }\n else if (SAX.isMatch(nameBody, c)) {\n this.tagName += c;\n }\n else if (this.script) {\n this.script += `</${this.tagName}`;\n this.tagName = '';\n this.state = this.S.SCRIPT;\n }\n else {\n if (!SAX.isWhitespace(c)) {\n this.strictFail('Invalid tagname in closing tag');\n }\n this.state = this.S.CLOSE_TAG_SAW_WHITE;\n }\n continue;\n case this.S.CLOSE_TAG_SAW_WHITE:\n if (SAX.isWhitespace(c)) {\n continue;\n }\n if (c === '>') {\n this.closeTag();\n }\n else {\n this.strictFail('Invalid characters in closing tag');\n }\n continue;\n case this.S.TEXT_ENTITY:\n case this.S.ATTRIB_VALUE_ENTITY_Q:\n case this.S.ATTRIB_VALUE_ENTITY_U:\n let returnState;\n let buffer;\n switch (this.state) {\n case this.S.TEXT_ENTITY:\n returnState = this.S.TEXT;\n buffer = 'textNode';\n break;\n case this.S.ATTRIB_VALUE_ENTITY_Q:\n returnState = this.S.ATTRIB_VALUE_QUOTED;\n buffer = 'attribValue';\n break;\n case this.S.ATTRIB_VALUE_ENTITY_U:\n returnState = this.S.ATTRIB_VALUE_UNQUOTED;\n buffer = 'attribValue';\n break;\n default:\n throw new Error(`Unknown state: ${this.state}`);\n }\n if (c === ';') {\n this[buffer] += this.parseEntity();\n this.entity = '';\n this.state = returnState;\n }\n else if (SAX.isMatch(this.entity.length ? entityBody : entityStart, c)) {\n this.entity += c;\n }\n else {\n this.strictFail('Invalid character in entity name');\n this[buffer] += `&${this.entity}${c}`;\n this.entity = '';\n this.state = returnState;\n }\n continue;\n default:\n throw new Error(`Unknown state: ${this.state}`);\n }\n } // while\n if (this.position >= this.bufferCheckPosition) {\n this.checkBufferLength();\n }\n return this;\n }\n emit(event, data) {\n if (this.events.hasOwnProperty(event)) {\n const eventName = event.replace(/^on/, '');\n this.events[event](data, eventName, this);\n }\n }\n clearBuffers() {\n for (let i = 0, l = this.BUFFERS.length; i < l; i++) {\n this[this[i]] = '';\n }\n }\n flushBuffers() {\n this.closeText();\n if (this.cdata !== '') {\n this.emitNode('oncdata', this.cdata);\n this.cdata = '';\n }\n if (this.script !== '') {\n this.emitNode('onscript', this.script);\n this.script = '';\n }\n }\n end() {\n if (this.sawRoot && !this.closedRoot)\n this.strictFail('Unclosed root tag');\n if (this.state !== this.S.BEGIN &&\n this.state !== this.S.BEGIN_WHITESPACE &&\n this.state !== this.S.TEXT) {\n this.errorFunction('Unexpected end');\n }\n this.closeText();\n this.c = '';\n this.closed = true;\n this.emit('onend');\n return new SAXParser(this.opt);\n }\n errorFunction(er) {\n this.closeText();\n if (this.trackPosition) {\n er += `\\nLine: ${this.line}\\nColumn: ${this.column}\\nChar: ${this.c}`;\n }\n const error = new Error(er);\n this.error = error;\n this.emit('onerror', error);\n return this;\n }\n attrib() {\n if (!this.strict) {\n this.attribName = this.attribName[this.looseCase]();\n }\n if (this.attribList.indexOf(this.attribName) !== -1 ||\n this.tag.attributes.hasOwnProperty(this.attribName)) {\n this.attribName = this.attribValue = '';\n return;\n }\n if (this.opt.xmlns) {\n const qn = SAX.qname(this.attribName, true);\n const prefix = qn.prefix;\n const local = qn.local;\n if (prefix === 'xmlns') {\n // namespace binding attribute. push the binding into scope\n if (local === 'xml' && this.attribValue !== this.XML_NAMESPACE) {\n this.strictFail(`xml: prefix must be bound to ${this.XML_NAMESPACE}\\n` + `Actual: ${this.attribValue}`);\n }\n else if (local === 'xmlns' && this.attribValue !== this.XMLNS_NAMESPACE) {\n this.strictFail(`xmlns: prefix must be bound to ${this.XMLNS_NAMESPACE}\\n` +\n `Actual: ${this.attribValue}`);\n }\n else {\n const tag = this.tag;\n const parent = this.tags[this.tags.length - 1] || this;\n if (tag.ns === parent.ns) {\n tag.ns = Object.create(parent.ns);\n }\n tag.ns[local] = this.attribValue;\n }\n }\n // defer onattribute events until all attributes have been seen\n // so any new bindings can take effect. preserve attribute order\n // so deferred events can be emitted in document order\n this.attribList.push([this.attribName, this.attribValue]);\n }\n else {\n // in non-xmlns mode, we can emit the event right away\n this.tag.attributes[this.attribName] = this.attribValue;\n this.emitNode('onattribute', {\n name: this.attribName,\n value: this.attribValue\n });\n }\n this.attribName = this.attribValue = '';\n }\n newTag() {\n if (!this.strict)\n this.tagName = this.tagName[this.looseCase]();\n const parent = this.tags[this.tags.length - 1] || this;\n const tag = (this.tag = { name: this.tagName, attributes: {} });\n // will be overridden if tag contains an xmlns=\"foo\" or xmlns:foo=\"bar\"\n if (this.opt.xmlns) {\n tag.ns = parent.ns;\n }\n this.attribList.length = 0;\n this.emitNode('onopentagstart', tag);\n }\n parseEntity() {\n let entity = this.entity;\n const entityLC = entity.toLowerCase();\n let num = NaN;\n let numStr = '';\n if (this.ENTITIES[entity]) {\n return this.ENTITIES[entity];\n }\n if (this.ENTITIES[entityLC]) {\n return this.ENTITIES[entityLC];\n }\n entity = entityLC;\n if (entity.charAt(0) === '#') {\n if (entity.charAt(1) === 'x') {\n entity = entity.slice(2);\n // TODO: remove tslint:disable\n // tslint:disable-next-line\n num = parseInt(entity, 16);\n numStr = num.toString(16);\n }\n else {\n entity = entity.slice(1);\n // TODO: remove tslint:disable\n // tslint:disable-next-line\n num = parseInt(entity, 10);\n numStr = num.toString(10);\n }\n }\n entity = entity.replace(/^0+/, '');\n if (isNaN(num) || numStr.toLowerCase() !== entity) {\n this.strictFail('Invalid character entity');\n return `&${this.entity};`;\n }\n return String.fromCodePoint(num);\n }\n beginWhiteSpace(c) {\n if (c === '<') {\n this.state = this.S.OPEN_WAKA;\n this.startTagPosition = this.position;\n }\n else if (!SAX.isWhitespace(c)) {\n // have to process this as a text node.\n // weird, but happens.\n this.strictFail('Non-whitespace before first tag.');\n this.textNode = c;\n this.state = this.S.TEXT;\n }\n else {\n }\n }\n strictFail(message) {\n if (typeof this !== 'object' || !(this instanceof SAXParser)) {\n throw new Error('bad call to strictFail');\n }\n if (this.strict) {\n this.errorFunction(message);\n }\n }\n textApplyOptions(text) {\n if (this.opt.trim)\n text = text.trim();\n if (this.opt.normalize)\n text = text.replace(/\\s+/g, ' ');\n return text;\n }\n emitNode(nodeType, data) {\n if (this.textNode)\n this.closeText();\n this.emit(nodeType, data);\n }\n closeText() {\n this.textNode = this.textApplyOptions(this.textNode);\n // TODO: figure out why this.textNode can be \"\" and \"undefined\"\n if (this.textNode !== undefined && this.textNode !== '' && this.textNode !== 'undefined') {\n this.emit('ontext', this.textNode);\n }\n this.textNode = '';\n }\n checkBufferLength() {\n const maxAllowed = Math.max(this.opt.MAX_BUFFER_LENGTH, 10);\n let maxActual = 0;\n for (let i = 0, l = this.BUFFERS.length; i < l; i++) {\n const len = this[this.BUFFERS[i]]?.length || 0;\n if (len > maxAllowed) {\n // Text/cdata nodes can get big, and since they're buffered,\n // we can get here under normal conditions.\n // Avoid issues by emitting the text node now,\n // so at least it won't get any bigger.\n switch (this.BUFFERS[i]) {\n case 'textNode':\n this.closeText();\n break;\n case 'cdata':\n this.emitNode('oncdata', this.cdata);\n this.cdata = '';\n break;\n case 'script':\n this.emitNode('onscript', this.script);\n this.script = '';\n break;\n default:\n this.errorFunction(`Max buffer length exceeded: ${this.BUFFERS[i]}`);\n }\n }\n maxActual = Math.max(maxActual, len);\n }\n // schedule the next check for the earliest possible buffer overrun.\n const m = this.opt.MAX_BUFFER_LENGTH - maxActual;\n this.bufferCheckPosition = m + this.position;\n }\n openTag(selfClosing) {\n if (this.opt.xmlns) {\n // emit namespace binding events\n const tag = this.tag;\n // add namespace info to tag\n const qn = SAX.qname(this.tagName);\n tag.prefix = qn.prefix;\n tag.local = qn.local;\n tag.uri = tag.ns[qn.prefix] || '';\n if (tag.prefix && !tag.uri) {\n this.strictFail(`Unbound namespace prefix: ${JSON.stringify(this.tagName)}`);\n tag.uri = qn.prefix;\n }\n const parent = this.tags[this.tags.length - 1] || this;\n if (tag.ns && parent.ns !== tag.ns) {\n const that = this;\n Object.keys(tag.ns).forEach((p) => {\n that.emitNode('onopennamespace', {\n prefix: p,\n uri: tag.ns[p]\n });\n });\n }\n // handle deferred onattribute events\n // Note: do not apply default ns to attributes:\n // http://www.w3.org/TR/REC-xml-names/#defaulting\n for (let i = 0, l = this.attribList.length; i < l; i++) {\n const nv = this.attribList[i];\n const name = nv[0];\n const value = nv[1];\n const qualName = SAX.qname(name, true);\n const prefix = qualName.prefix;\n const local = qualName.local;\n const uri = prefix === '' ? '' : tag.ns[prefix] || '';\n const a = {\n name,\n value,\n prefix,\n local,\n uri\n };\n // if there's any attributes with an undefined namespace,\n // then fail on them now.\n if (prefix && prefix !== 'xmlns' && !uri) {\n this.strictFail(`Unbound namespace prefix: ${JSON.stringify(prefix)}`);\n a.uri = prefix;\n }\n this.tag.attributes[name] = a;\n this.emitNode('onattribute', a);\n }\n this.attribList.length = 0;\n }\n this.tag.isSelfClosing = Boolean(selfClosing);\n // process the tag\n this.sawRoot = true;\n this.tags.push(this.tag);\n this.emitNode('onopentag', this.tag);\n if (!selfClosing) {\n // special case for <script> in non-strict mode.\n if (!this.noscript && this.tagName.toLowerCase() === 'script') {\n this.state = this.S.SCRIPT;\n }\n else {\n this.state = this.S.TEXT;\n }\n this.tag = null;\n this.tagName = '';\n }\n this.attribName = this.attribValue = '';\n this.attribList.length = 0;\n }\n closeTag() {\n if (!this.tagName) {\n this.strictFail('Weird empty close tag.');\n this.textNode += '</>';\n this.state = this.S.TEXT;\n return;\n }\n if (this.script) {\n if (this.tagName !== 'script') {\n this.script += `</${this.tagName}>`;\n this.tagName = '';\n this.state = this.S.SCRIPT;\n return;\n }\n this.emitNode('onscript', this.script);\n this.script = '';\n }\n // first make sure that the closing tag actually exists.\n // <a><b></c></b></a> will close everything, otherwise.\n let t = this.tags.length;\n let tagName = this.tagName;\n if (!this.strict) {\n tagName = tagName[this.looseCase]();\n }\n while (t--) {\n const close = this.tags[t];\n if (close.name !== tagName) {\n // fail the first time in strict mode\n this.strictFail('Unexpected close tag');\n }\n else {\n break;\n }\n }\n // didn't find it. we already failed for strict, so just abort.\n if (t < 0) {\n this.strictFail(`Unmatched closing tag: ${this.tagName}`);\n this.textNode += `</${this.tagName}>`;\n this.state = this.S.TEXT;\n return;\n }\n this.tagName = tagName;\n let s = this.tags.length;\n while (s-- > t) {\n const tag = (this.tag = this.tags.pop());\n this.tagName = this.tag.name;\n this.emitNode('onclosetag', this.tagName);\n const x = {};\n for (const i in tag.ns) {\n if (tag.ns.hasOwnProperty(i)) {\n x[i] = tag.ns[i];\n }\n }\n const parent = this.tags[this.tags.length - 1] || this;\n if (this.opt.xmlns && tag.ns !== parent.ns) {\n // remove namespace bindings introduced by tag\n const that = this;\n Object.keys(tag.ns).forEach((p) => {\n const n = tag.ns[p];\n that.emitNode('onclosenamespace', { prefix: p, uri: n });\n });\n }\n }\n if (t === 0)\n this.closedRoot = true;\n this.tagName = this.attribValue = this.attribName = '';\n this.attribList.length = 0;\n this.state = this.S.TEXT;\n }\n}\n/**\n *\n * @todo Weird inheritance, with some variables initialized in subclass\n */\nexport class SAXParser extends SAX {\n static ENTITIES = ENTITIES;\n opt = DEFAULT_SAX_PARSER_OPTIONS;\n events = DEFAULT_SAX_EVENTS;\n constructor(opt) {\n super();\n this.clearBuffers();\n this.opt = opt = { ...this.opt, ...opt };\n this.events = { ...this.events, ...opt };\n this.q = this.c = '';\n this.opt.lowercase = this.opt.lowercase || this.opt.lowercasetags;\n this.bufferCheckPosition = this.opt.MAX_BUFFER_LENGTH;\n this.looseCase = this.opt.lowercase ? 'toLowerCase' : 'toUpperCase';\n this.tags = [];\n this.closed = this.closedRoot = this.sawRoot = false;\n this.tag = this.error = null;\n this.strict = Boolean(this.opt.strict);\n this.noscript = Boolean(this.opt.strict || this.opt.noscript);\n this.state = this.S.BEGIN;\n this.strictEntities = this.opt.strictEntities;\n this.ENTITIES = this.strictEntities\n ? Object.create(this.XML_ENTITIES)\n : Object.create(this.ENTITIES);\n this.attribList = [];\n // namespaces form a prototype chain.\n // it always points at the current tag,\n // which protos to its parent tag.\n if (this.opt.xmlns) {\n this.ns = Object.create(this.rootNS);\n }\n // mostly just for error reporting\n this.trackPosition = this.opt.position !== false;\n if (this.trackPosition) {\n this.position = this.line = this.column = 0;\n }\n this.emit('onready');\n }\n resume() {\n this.error = null;\n return this;\n }\n close() {\n return this.write(null);\n }\n flush() {\n this.flushBuffers();\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Uncapitalize first letter of a string\n * @param str\n * @returns\n */\nexport function uncapitalize(str) {\n return typeof str === 'string' ? str.charAt(0).toLowerCase() + str.slice(1) : str;\n}\n/**\n * Recursively uncapitalize all keys in a nested object\n * @param object\n * @returns\n */\nexport function uncapitalizeKeys(object) {\n if (Array.isArray(object)) {\n return object.map((element) => uncapitalizeKeys(element));\n }\n if (object && typeof object === 'object') {\n const newObject = {};\n for (const [key, value] of Object.entries(object)) {\n newObject[uncapitalize(key)] = uncapitalizeKeys(value);\n }\n return newObject;\n }\n return object;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { StreamingXMLParser } from \"./streaming-xml-parser.js\";\nimport { uncapitalizeKeys } from \"../xml-utils/uncapitalize.js\";\nimport { XMLParser as FastXMLParser } from 'fast-xml-parser';\nexport function parseXMLSync(text, options) {\n if (options?._parser && options._parser !== 'fast-xml-parser') {\n throw new Error(options?._parser);\n }\n const fastXMLOptions = {\n // Default FastXML options\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#allowbooleanattributes\n allowBooleanAttributes: true,\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#ignoredeclaration\n ignoreDeclaration: true,\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#removensprefix\n removeNSPrefix: options?.removeNSPrefix,\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#textnodename\n textNodeName: options?.textNodeName,\n // Let's application specify keys that are always arrays\n isArray: (name, jpath, isLeafNode, isAttribute) => {\n const array = Boolean(options?.arrayPaths?.some((path) => jpath === path));\n return array;\n },\n // Application overrides\n ...options?._fastXML\n };\n const xml = fastParseXML(text, fastXMLOptions);\n // Note - could be done with FastXML tag processing\n return options?.uncapitalizeKeys ? uncapitalizeKeys(xml) : xml;\n}\nexport function fastParseXML(text, options) {\n const parser = new FastXMLParser({\n ignoreAttributes: false,\n attributeNamePrefix: '',\n ...options\n });\n const parsedXML = parser.parse(text);\n return parsedXML;\n}\n/**\n * @todo Build a streaming XML parser based on sax-js\n * @param text\n * @param options\n * @returns\n */\nexport function parseXMLInBatches(text, options = {}) {\n const parser = new StreamingXMLParser({\n ...options,\n strict: true\n });\n parser.write(text);\n parser.close();\n return parser.result;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { parseXMLSync } from \"./lib/parsers/parse-xml.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.0-alpha.4\" !== 'undefined' ? \"4.3.0-alpha.4\" : 'latest';\n/**\n * Loader for XML files\n */\nexport const XMLLoader = {\n dataType: null,\n batchType: null,\n name: 'XML',\n id: 'xml',\n module: 'xml',\n version: VERSION,\n worker: false,\n extensions: ['xml'],\n mimeTypes: ['application/xml', 'text/xml'],\n testText: testXMLFile,\n options: {\n xml: {\n _parser: 'fast-xml-parser',\n uncapitalizeKeys: false,\n removeNSPrefix: false,\n textNodeName: 'value',\n arrayPaths: []\n }\n },\n parse: async (arrayBuffer, options) => parseXMLSync(new TextDecoder().decode(arrayBuffer), {\n ...XMLLoader.options.xml,\n ...options?.xml\n }),\n parseTextSync: (text, options) => parseXMLSync(text, { ...XMLLoader.options.xml, ...options?.xml })\n};\nfunction testXMLFile(text) {\n // TODO - There could be space first.\n return text.startsWith('<?xml');\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { mergeLoaderOptions } from '@loaders.gl/loader-utils';\nimport { XMLLoader } from \"./xml-loader.js\";\n/**\n * Loader for HTML files\n * Essentially a copy of the XMLLoader with different mime types, file extensions and content tests.\n * This split enables applications can control whether they want HTML responses to be parsed by the XML loader or not.\n * This loader does not have any additional understanding of the structure of HTML or the document.\n */\nexport const HTMLLoader = {\n ...XMLLoader,\n name: 'HTML',\n id: 'html',\n extensions: ['html', 'htm'],\n mimeTypes: ['text/html'],\n testText: testHTMLFile,\n parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync: (text, options) => parseTextSync(text, options)\n};\nfunction testHTMLFile(text) {\n // TODO - There could be space first.\n return text.startsWith('<html');\n}\nfunction parseTextSync(text, options) {\n // fast-xml-parser can recognize HTML entities\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#htmlentities\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/5.Entities.md\n options = mergeLoaderOptions(options, {\n xml: {\n _parser: 'fast-xml-parser',\n _fastXML: {\n htmlEntities: true\n }\n }\n });\n return XMLLoader.parseTextSync?.(text, options);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// TODO - these utilities could be moved to the XML parser.\n// uncapitalizeKeys could be an XMLLoader option\n/**\n * Extracts a value or array and always return an array\n * Useful since XML parses to object instead of array when only a single value is provided\n */\nexport function convertXMLValueToArray(xmlValue) {\n if (Array.isArray(xmlValue)) {\n return xmlValue;\n }\n if (xmlValue && typeof xmlValue === 'object' && xmlValue['0']) {\n // Error this is an objectified array\n }\n if (xmlValue) {\n return [xmlValue];\n }\n return [];\n}\n/**\n * Mutates a field in place, converting it to array\n * Useful since XML parses to object instead of array when only a single value is provided\n */\nexport function convertXMLFieldToArrayInPlace(xml, key) {\n xml[key] = convertXMLValueToArray(xml[key]);\n}\n"],
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { XMLLoader } from \"./xml-loader.js\";\nexport { HTMLLoader } from \"./html-loader.js\";\nexport { SAXParser as SAXParser } from \"./sax-ts/sax.js\";\n// Utilities\nexport { convertXMLValueToArray, convertXMLFieldToArrayInPlace } from \"./lib/xml-utils/xml-utils.js\";\n// Experimental\nexport { uncapitalize as _uncapitalize, uncapitalizeKeys as _uncapitalizeKeys } from \"./lib/xml-utils/uncapitalize.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nconst DEFAULT_SAX_EVENTS = {\n ontext: () => { },\n onprocessinginstruction: () => { },\n onsgmldeclaration: () => { },\n ondoctype: () => { },\n oncomment: () => { },\n onopentagstart: () => { },\n onattribute: () => { },\n onopentag: () => { },\n onclosetag: () => { },\n onopencdata: () => { },\n oncdata: () => { },\n onclosecdata: () => { },\n onerror: () => { },\n onend: () => { },\n onready: () => { },\n onscript: () => { },\n onopennamespace: () => { },\n onclosenamespace: () => { }\n};\nconst DEFAULT_SAX_PARSER_OPTIONS = {\n ...DEFAULT_SAX_EVENTS,\n strict: false,\n MAX_BUFFER_LENGTH: 64 * 1024,\n lowercase: false,\n lowercasetags: false,\n noscript: false,\n strictEntities: false,\n xmlns: undefined,\n position: undefined,\n trim: undefined,\n normalize: undefined\n};\nconst EVENTS = [\n 'text',\n 'processinginstruction',\n 'sgmldeclaration',\n 'doctype',\n 'comment',\n 'opentagstart',\n 'attribute',\n 'opentag',\n 'closetag',\n 'opencdata',\n 'cdata',\n 'closecdata',\n 'error',\n 'end',\n 'ready',\n 'script',\n 'opennamespace',\n 'closenamespace'\n];\nconst BUFFERS = [\n 'comment',\n 'sgmlDecl',\n 'textNode',\n 'tagName',\n 'doctype',\n 'procInstName',\n 'procInstBody',\n 'entity',\n 'attribName',\n 'attribValue',\n 'cdata',\n 'script'\n];\nconst nameStart = /[:_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]/;\nconst nameBody = /[:_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\\u00B7\\u0300-\\u036F\\u203F-\\u2040.\\d-]/;\nconst entityStart = /[#:_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]/;\nconst entityBody = /[#:_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\\u00B7\\u0300-\\u036F\\u203F-\\u2040.\\d-]/;\nexport const ENTITIES = {\n amp: '&',\n gt: '>',\n lt: '<',\n quot: '\"',\n apos: \"'\",\n AElig: 198,\n Aacute: 193,\n Acirc: 194,\n Agrave: 192,\n Aring: 197,\n Atilde: 195,\n Auml: 196,\n Ccedil: 199,\n ETH: 208,\n Eacute: 201,\n Ecirc: 202,\n Egrave: 200,\n Euml: 203,\n Iacute: 205,\n Icirc: 206,\n Igrave: 204,\n Iuml: 207,\n Ntilde: 209,\n Oacute: 211,\n Ocirc: 212,\n Ograve: 210,\n Oslash: 216,\n Otilde: 213,\n Ouml: 214,\n THORN: 222,\n Uacute: 218,\n Ucirc: 219,\n Ugrave: 217,\n Uuml: 220,\n Yacute: 221,\n aacute: 225,\n acirc: 226,\n aelig: 230,\n agrave: 224,\n aring: 229,\n atilde: 227,\n auml: 228,\n ccedil: 231,\n eacute: 233,\n ecirc: 234,\n egrave: 232,\n eth: 240,\n euml: 235,\n iacute: 237,\n icirc: 238,\n igrave: 236,\n iuml: 239,\n ntilde: 241,\n oacute: 243,\n ocirc: 244,\n ograve: 242,\n oslash: 248,\n otilde: 245,\n ouml: 246,\n szlig: 223,\n thorn: 254,\n uacute: 250,\n ucirc: 251,\n ugrave: 249,\n uuml: 252,\n yacute: 253,\n yuml: 255,\n copy: 169,\n reg: 174,\n nbsp: 160,\n iexcl: 161,\n cent: 162,\n pound: 163,\n curren: 164,\n yen: 165,\n brvbar: 166,\n sect: 167,\n uml: 168,\n ordf: 170,\n laquo: 171,\n not: 172,\n shy: 173,\n macr: 175,\n deg: 176,\n plusmn: 177,\n sup1: 185,\n sup2: 178,\n sup3: 179,\n acute: 180,\n micro: 181,\n para: 182,\n middot: 183,\n cedil: 184,\n ordm: 186,\n raquo: 187,\n frac14: 188,\n frac12: 189,\n frac34: 190,\n iquest: 191,\n times: 215,\n divide: 247,\n OElig: 338,\n oelig: 339,\n Scaron: 352,\n scaron: 353,\n Yuml: 376,\n fnof: 402,\n circ: 710,\n tilde: 732,\n Alpha: 913,\n Beta: 914,\n Gamma: 915,\n Delta: 916,\n Epsilon: 917,\n Zeta: 918,\n Eta: 919,\n Theta: 920,\n Iota: 921,\n Kappa: 922,\n Lambda: 923,\n Mu: 924,\n Nu: 925,\n Xi: 926,\n Omicron: 927,\n Pi: 928,\n Rho: 929,\n Sigma: 931,\n Tau: 932,\n Upsilon: 933,\n Phi: 934,\n Chi: 935,\n Psi: 936,\n Omega: 937,\n alpha: 945,\n beta: 946,\n gamma: 947,\n delta: 948,\n epsilon: 949,\n zeta: 950,\n eta: 951,\n theta: 952,\n iota: 953,\n kappa: 954,\n lambda: 955,\n mu: 956,\n nu: 957,\n xi: 958,\n omicron: 959,\n pi: 960,\n rho: 961,\n sigmaf: 962,\n sigma: 963,\n tau: 964,\n upsilon: 965,\n phi: 966,\n chi: 967,\n psi: 968,\n omega: 969,\n thetasym: 977,\n upsih: 978,\n piv: 982,\n ensp: 8194,\n emsp: 8195,\n thinsp: 8201,\n zwnj: 8204,\n zwj: 8205,\n lrm: 8206,\n rlm: 8207,\n ndash: 8211,\n mdash: 8212,\n lsquo: 8216,\n rsquo: 8217,\n sbquo: 8218,\n ldquo: 8220,\n rdquo: 8221,\n bdquo: 8222,\n dagger: 8224,\n Dagger: 8225,\n bull: 8226,\n hellip: 8230,\n permil: 8240,\n prime: 8242,\n Prime: 8243,\n lsaquo: 8249,\n rsaquo: 8250,\n oline: 8254,\n frasl: 8260,\n euro: 8364,\n image: 8465,\n weierp: 8472,\n real: 8476,\n trade: 8482,\n alefsym: 8501,\n larr: 8592,\n uarr: 8593,\n rarr: 8594,\n darr: 8595,\n harr: 8596,\n crarr: 8629,\n lArr: 8656,\n uArr: 8657,\n rArr: 8658,\n dArr: 8659,\n hArr: 8660,\n forall: 8704,\n part: 8706,\n exist: 8707,\n empty: 8709,\n nabla: 8711,\n isin: 8712,\n notin: 8713,\n ni: 8715,\n prod: 8719,\n sum: 8721,\n minus: 8722,\n lowast: 8727,\n radic: 8730,\n prop: 8733,\n infin: 8734,\n ang: 8736,\n and: 8743,\n or: 8744,\n cap: 8745,\n cup: 8746,\n int: 8747,\n there4: 8756,\n sim: 8764,\n cong: 8773,\n asymp: 8776,\n ne: 8800,\n equiv: 8801,\n le: 8804,\n ge: 8805,\n sub: 8834,\n sup: 8835,\n nsub: 8836,\n sube: 8838,\n supe: 8839,\n oplus: 8853,\n otimes: 8855,\n perp: 8869,\n sdot: 8901,\n lceil: 8968,\n rceil: 8969,\n lfloor: 8970,\n rfloor: 8971,\n lang: 9001,\n rang: 9002,\n loz: 9674,\n spades: 9824,\n clubs: 9827,\n hearts: 9829,\n diams: 9830\n};\nObject.keys(ENTITIES).forEach((key) => {\n const e = ENTITIES[key];\n ENTITIES[key] = typeof e === 'number' ? String.fromCharCode(e) : e;\n});\n/**\n * Internal helper class\n */\nclass SAX {\n EVENTS = EVENTS;\n ENTITIES = {\n // TODO: make it readonly, needed for entity-mega test\n // amp, gt, lt, quot and apos are resolved to strings instead of numerical\n // codes, IDK why\n ...ENTITIES\n };\n XML_ENTITIES = {\n amp: '&',\n gt: '>',\n lt: '<',\n quot: '\"',\n apos: \"'\"\n };\n S = 0;\n opt;\n trackPosition = false;\n column = 0;\n line = 0;\n c = '';\n error;\n q = '';\n bufferCheckPosition;\n closed = false;\n tags = [];\n looseCase = '';\n closedRoot = false;\n sawRoot = false;\n strict = false;\n tag;\n strictEntities;\n state;\n noscript = false;\n attribList = [];\n ns;\n position = 0;\n STATE = {\n BEGIN: this.S++, // leading byte order mark or whitespace\n BEGIN_WHITESPACE: this.S++, // leading whitespace\n TEXT: this.S++, // general stuff\n TEXT_ENTITY: this.S++, // &amp and such.\n OPEN_WAKA: this.S++, // <\n SGML_DECL: this.S++, // <!BLARG\n SGML_DECL_QUOTED: this.S++, // <!BLARG foo \"bar\n DOCTYPE: this.S++, // <!DOCTYPE\n DOCTYPE_QUOTED: this.S++, // <!DOCTYPE \"//blah\n DOCTYPE_DTD: this.S++, // <!DOCTYPE \"//blah\" [ ...\n DOCTYPE_DTD_QUOTED: this.S++, // <!DOCTYPE \"//blah\" [ \"foo\n COMMENT_STARTING: this.S++, // <!-\n COMMENT: this.S++, // <!--\n COMMENT_ENDING: this.S++, // <!-- blah -\n COMMENT_ENDED: this.S++, // <!-- blah --\n CDATA: this.S++, // <![CDATA[ something\n CDATA_ENDING: this.S++, // ]\n CDATA_ENDING_2: this.S++, // ]]\n PROC_INST: this.S++, // <?hi\n PROC_INST_BODY: this.S++, // <?hi there\n PROC_INST_ENDING: this.S++, // <?hi \"there\" ?\n OPEN_TAG: this.S++, // <strong\n OPEN_TAG_SLASH: this.S++, // <strong /\n ATTRIB: this.S++, // <a\n ATTRIB_NAME: this.S++, // <a foo\n ATTRIB_NAME_SAW_WHITE: this.S++, // <a foo _\n ATTRIB_VALUE: this.S++, // <a foo=\n ATTRIB_VALUE_QUOTED: this.S++, // <a foo=\"bar\n ATTRIB_VALUE_CLOSED: this.S++, // <a foo=\"bar\"\n ATTRIB_VALUE_UNQUOTED: this.S++, // <a foo=bar\n ATTRIB_VALUE_ENTITY_Q: this.S++, // <foo bar=\"&quot;\"\n ATTRIB_VALUE_ENTITY_U: this.S++, // <foo bar=&quot\n CLOSE_TAG: this.S++, // </a\n CLOSE_TAG_SAW_WHITE: this.S++, // </a >\n SCRIPT: this.S++, // <script> ...\n SCRIPT_ENDING: this.S++ // <script> ... <\n };\n BUFFERS = BUFFERS;\n // private parser: (strict: boolean, opt: any) => SAXParser;\n CDATA = '[CDATA[';\n DOCTYPE = 'DOCTYPE';\n XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';\n XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/';\n rootNS = {\n xml: this.XML_NAMESPACE,\n xmlns: this.XMLNS_NAMESPACE\n };\n comment;\n sgmlDecl;\n textNode = '';\n tagName;\n doctype;\n procInstName;\n procInstBody;\n entity = '';\n attribName;\n attribValue;\n cdata = '';\n script = '';\n startTagPosition = 0;\n constructor() {\n this.S = 0;\n for (const s in this.STATE) {\n if (this.STATE.hasOwnProperty(s)) {\n this.STATE[this.STATE[s]] = s;\n }\n }\n // shorthand\n this.S = this.STATE;\n }\n static charAt(chunk, i) {\n let result = '';\n if (i < chunk.length) {\n result = chunk.charAt(i);\n }\n return result;\n }\n static isWhitespace(c) {\n return c === ' ' || c === '\\n' || c === '\\r' || c === '\\t';\n }\n static isQuote(c) {\n return c === '\"' || c === \"'\";\n }\n static isAttribEnd(c) {\n return c === '>' || SAX.isWhitespace(c);\n }\n static isMatch(regex, c) {\n return regex.test(c);\n }\n static notMatch(regex, c) {\n return !SAX.isMatch(regex, c);\n }\n static qname(name, attribute) {\n const i = name.indexOf(':');\n const qualName = i < 0 ? ['', name] : name.split(':');\n let prefix = qualName[0];\n let local = qualName[1];\n // <x \"xmlns\"=\"http://foo\">\n if (attribute && name === 'xmlns') {\n prefix = 'xmlns';\n local = '';\n }\n return { prefix, local };\n }\n write(chunk) {\n if (this.error) {\n throw this.error;\n }\n if (this.closed) {\n return this.errorFunction('Cannot write after close. Assign an onready handler.');\n }\n if (chunk === null) {\n return this.end();\n }\n if (typeof chunk === 'object') {\n chunk = chunk.toString();\n }\n let i = 0;\n let c;\n while (true) {\n c = SAX.charAt(chunk, i++);\n this.c = c;\n if (!c) {\n break;\n }\n if (this.trackPosition) {\n this.position++;\n if (c === '\\n') {\n this.line++;\n this.column = 0;\n }\n else {\n this.column++;\n }\n }\n switch (this.state) {\n case this.S.BEGIN:\n this.state = this.S.BEGIN_WHITESPACE;\n if (c === '\\uFEFF') {\n continue;\n }\n this.beginWhiteSpace(c);\n continue;\n case this.S.BEGIN_WHITESPACE:\n this.beginWhiteSpace(c);\n continue;\n case this.S.TEXT:\n if (this.sawRoot && !this.closedRoot) {\n const starti = i - 1;\n while (c && c !== '<' && c !== '&') {\n c = SAX.charAt(chunk, i++);\n if (c && this.trackPosition) {\n this.position++;\n if (c === '\\n') {\n this.line++;\n this.column = 0;\n }\n else {\n this.column++;\n }\n }\n }\n this.textNode += chunk.substring(starti, i - 1);\n }\n if (c === '<' && !(this.sawRoot && this.closedRoot && !this.strict)) {\n this.state = this.S.OPEN_WAKA;\n this.startTagPosition = this.position;\n }\n else {\n if (!SAX.isWhitespace(c) && (!this.sawRoot || this.closedRoot)) {\n this.strictFail('Text data outside of root node.');\n }\n if (c === '&') {\n this.state = this.S.TEXT_ENTITY;\n }\n else {\n this.textNode += c;\n }\n }\n continue;\n case this.S.SCRIPT:\n // only non-strict\n if (c === '<') {\n this.state = this.S.SCRIPT_ENDING;\n }\n else {\n this.script += c;\n }\n continue;\n case this.S.SCRIPT_ENDING:\n if (c === '/') {\n this.state = this.S.CLOSE_TAG;\n }\n else {\n this.script += `<${c}`;\n this.state = this.S.SCRIPT;\n }\n continue;\n case this.S.OPEN_WAKA:\n // either a /, ?, !, or text is coming next.\n if (c === '!') {\n this.state = this.S.SGML_DECL;\n this.sgmlDecl = '';\n }\n else if (SAX.isWhitespace(c)) {\n // wait for it...\n }\n else if (SAX.isMatch(nameStart, c)) {\n this.state = this.S.OPEN_TAG;\n this.tagName = c;\n }\n else if (c === '/') {\n this.state = this.S.CLOSE_TAG;\n this.tagName = '';\n }\n else if (c === '?') {\n this.state = this.S.PROC_INST;\n this.procInstName = this.procInstBody = '';\n }\n else {\n this.strictFail('Unencoded <');\n // if there was some whitespace, then add that in.\n if (this.startTagPosition + 1 < this.position) {\n const pad = this.position - this.startTagPosition;\n c = new Array(pad).join(' ') + c;\n }\n this.textNode += `<${c}`;\n this.state = this.S.TEXT;\n }\n continue;\n case this.S.SGML_DECL:\n if ((this.sgmlDecl + c).toUpperCase() === this.CDATA) {\n this.emitNode('onopencdata');\n this.state = this.S.CDATA;\n this.sgmlDecl = '';\n this.cdata = '';\n }\n else if (this.sgmlDecl + c === '--') {\n this.state = this.S.COMMENT;\n this.comment = '';\n this.sgmlDecl = '';\n }\n else if ((this.sgmlDecl + c).toUpperCase() === this.DOCTYPE) {\n this.state = this.S.DOCTYPE;\n if (this.doctype || this.sawRoot) {\n this.strictFail('Inappropriately located doctype declaration');\n }\n this.doctype = '';\n this.sgmlDecl = '';\n }\n else if (c === '>') {\n this.emitNode('onsgmldeclaration', this.sgmlDecl);\n this.sgmlDecl = '';\n this.state = this.S.TEXT;\n }\n else if (SAX.isQuote(c)) {\n this.state = this.S.SGML_DECL_QUOTED;\n this.sgmlDecl += c;\n }\n else {\n this.sgmlDecl += c;\n }\n continue;\n case this.S.SGML_DECL_QUOTED:\n if (c === this.q) {\n this.state = this.S.SGML_DECL;\n this.q = '';\n }\n this.sgmlDecl += c;\n continue;\n case this.S.DOCTYPE:\n if (c === '>') {\n this.state = this.S.TEXT;\n this.emitNode('ondoctype', this.doctype);\n this.doctype = true; // just remember that we saw it.\n }\n else {\n this.doctype += c;\n if (c === '[') {\n this.state = this.S.DOCTYPE_DTD;\n }\n else if (SAX.isQuote(c)) {\n this.state = this.S.DOCTYPE_QUOTED;\n this.q = c;\n }\n }\n continue;\n case this.S.DOCTYPE_QUOTED:\n this.doctype += c;\n if (c === this.q) {\n this.q = '';\n this.state = this.S.DOCTYPE;\n }\n continue;\n case this.S.DOCTYPE_DTD:\n this.doctype += c;\n if (c === ']') {\n this.state = this.S.DOCTYPE;\n }\n else if (SAX.isQuote(c)) {\n this.state = this.S.DOCTYPE_DTD_QUOTED;\n this.q = c;\n }\n continue;\n case this.S.DOCTYPE_DTD_QUOTED:\n this.doctype += c;\n if (c === this.q) {\n this.state = this.S.DOCTYPE_DTD;\n this.q = '';\n }\n continue;\n case this.S.COMMENT:\n if (c === '-') {\n this.state = this.S.COMMENT_ENDING;\n }\n else {\n this.comment += c;\n }\n continue;\n case this.S.COMMENT_ENDING:\n if (c === '-') {\n this.state = this.S.COMMENT_ENDED;\n this.comment = this.textApplyOptions(this.comment);\n if (this.comment) {\n this.emitNode('oncomment', this.comment);\n }\n this.comment = '';\n }\n else {\n this.comment += `-${c}`;\n this.state = this.S.COMMENT;\n }\n continue;\n case this.S.COMMENT_ENDED:\n if (c !== '>') {\n this.strictFail('Malformed comment');\n // allow <!-- blah -- bloo --> in non-strict mode,\n // which is a comment of \" blah -- bloo \"\n this.comment += `--${c}`;\n this.state = this.S.COMMENT;\n }\n else {\n this.state = this.S.TEXT;\n }\n continue;\n case this.S.CDATA:\n if (c === ']') {\n this.state = this.S.CDATA_ENDING;\n }\n else {\n this.cdata += c;\n }\n continue;\n case this.S.CDATA_ENDING:\n if (c === ']') {\n this.state = this.S.CDATA_ENDING_2;\n }\n else {\n this.cdata += `]${c}`;\n this.state = this.S.CDATA;\n }\n continue;\n case this.S.CDATA_ENDING_2:\n if (c === '>') {\n if (this.cdata) {\n this.emitNode('oncdata', this.cdata);\n }\n this.emitNode('onclosecdata');\n this.cdata = '';\n this.state = this.S.TEXT;\n }\n else if (c === ']') {\n this.cdata += ']';\n }\n else {\n this.cdata += `]]${c}`;\n this.state = this.S.CDATA;\n }\n continue;\n case this.S.PROC_INST:\n if (c === '?') {\n this.state = this.S.PROC_INST_ENDING;\n }\n else if (SAX.isWhitespace(c)) {\n this.state = this.S.PROC_INST_BODY;\n }\n else {\n this.procInstName += c;\n }\n continue;\n case this.S.PROC_INST_BODY:\n if (!this.procInstBody && SAX.isWhitespace(c)) {\n continue;\n }\n else if (c === '?') {\n this.state = this.S.PROC_INST_ENDING;\n }\n else {\n this.procInstBody += c;\n }\n continue;\n case this.S.PROC_INST_ENDING:\n if (c === '>') {\n this.emitNode('onprocessinginstruction', {\n name: this.procInstName,\n body: this.procInstBody\n });\n this.procInstName = this.procInstBody = '';\n this.state = this.S.TEXT;\n }\n else {\n this.procInstBody += `?${c}`;\n this.state = this.S.PROC_INST_BODY;\n }\n continue;\n case this.S.OPEN_TAG:\n if (SAX.isMatch(nameBody, c)) {\n this.tagName += c;\n }\n else {\n this.newTag();\n if (c === '>') {\n this.openTag();\n }\n else if (c === '/') {\n this.state = this.S.OPEN_TAG_SLASH;\n }\n else {\n if (!SAX.isWhitespace(c)) {\n this.strictFail('Invalid character in tag name');\n }\n this.state = this.S.ATTRIB;\n }\n }\n continue;\n case this.S.OPEN_TAG_SLASH:\n if (c === '>') {\n this.openTag(true);\n this.closeTag();\n }\n else {\n this.strictFail('Forward-slash in opening tag not followed by >');\n this.state = this.S.ATTRIB;\n }\n continue;\n case this.S.ATTRIB:\n // haven't read the attribute name yet.\n if (SAX.isWhitespace(c)) {\n continue;\n }\n else if (c === '>') {\n this.openTag();\n }\n else if (c === '/') {\n this.state = this.S.OPEN_TAG_SLASH;\n }\n else if (SAX.isMatch(nameStart, c)) {\n this.attribName = c;\n this.attribValue = '';\n this.state = this.S.ATTRIB_NAME;\n }\n else {\n this.strictFail('Invalid attribute name');\n }\n continue;\n case this.S.ATTRIB_NAME:\n if (c === '=') {\n this.state = this.S.ATTRIB_VALUE;\n }\n else if (c === '>') {\n this.strictFail('Attribute without value');\n this.attribValue = this.attribName;\n this.attrib();\n this.openTag();\n }\n else if (SAX.isWhitespace(c)) {\n this.state = this.S.ATTRIB_NAME_SAW_WHITE;\n }\n else if (SAX.isMatch(nameBody, c)) {\n this.attribName += c;\n }\n else {\n this.strictFail('Invalid attribute name');\n }\n continue;\n case this.S.ATTRIB_NAME_SAW_WHITE:\n if (c === '=') {\n this.state = this.S.ATTRIB_VALUE;\n }\n else if (SAX.isWhitespace(c)) {\n continue;\n }\n else {\n this.strictFail('Attribute without value');\n this.tag.attributes[this.attribName] = '';\n this.attribValue = '';\n this.emitNode('onattribute', {\n name: this.attribName,\n value: ''\n });\n this.attribName = '';\n if (c === '>') {\n this.openTag();\n }\n else if (SAX.isMatch(nameStart, c)) {\n this.attribName = c;\n this.state = this.S.ATTRIB_NAME;\n }\n else {\n this.strictFail('Invalid attribute name');\n this.state = this.S.ATTRIB;\n }\n }\n continue;\n case this.S.ATTRIB_VALUE:\n if (SAX.isWhitespace(c)) {\n continue;\n }\n else if (SAX.isQuote(c)) {\n this.q = c;\n this.state = this.S.ATTRIB_VALUE_QUOTED;\n }\n else {\n this.strictFail('Unquoted attribute value');\n this.state = this.S.ATTRIB_VALUE_UNQUOTED;\n this.attribValue = c;\n }\n continue;\n case this.S.ATTRIB_VALUE_QUOTED:\n if (c !== this.q) {\n if (c === '&') {\n this.state = this.S.ATTRIB_VALUE_ENTITY_Q;\n }\n else {\n this.attribValue += c;\n }\n continue;\n }\n this.attrib();\n this.q = '';\n this.state = this.S.ATTRIB_VALUE_CLOSED;\n continue;\n case this.S.ATTRIB_VALUE_CLOSED:\n if (SAX.isWhitespace(c)) {\n this.state = this.S.ATTRIB;\n }\n else if (c === '>') {\n this.openTag();\n }\n else if (c === '/') {\n this.state = this.S.OPEN_TAG_SLASH;\n }\n else if (SAX.isMatch(nameStart, c)) {\n this.strictFail('No whitespace between attributes');\n this.attribName = c;\n this.attribValue = '';\n this.state = this.S.ATTRIB_NAME;\n }\n else {\n this.strictFail('Invalid attribute name');\n }\n continue;\n case this.S.ATTRIB_VALUE_UNQUOTED:\n if (!SAX.isAttribEnd(c)) {\n if (c === '&') {\n this.state = this.S.ATTRIB_VALUE_ENTITY_U;\n }\n else {\n this.attribValue += c;\n }\n continue;\n }\n this.attrib();\n if (c === '>') {\n this.openTag();\n }\n else {\n this.state = this.S.ATTRIB;\n }\n continue;\n case this.S.CLOSE_TAG:\n if (!this.tagName) {\n if (SAX.isWhitespace(c)) {\n continue;\n }\n else if (SAX.notMatch(nameStart, c)) {\n if (this.script) {\n this.script += `</${c}`;\n this.state = this.S.SCRIPT;\n }\n else {\n this.strictFail('Invalid tagname in closing tag.');\n }\n }\n else {\n this.tagName = c;\n }\n }\n else if (c === '>') {\n this.closeTag();\n }\n else if (SAX.isMatch(nameBody, c)) {\n this.tagName += c;\n }\n else if (this.script) {\n this.script += `</${this.tagName}`;\n this.tagName = '';\n this.state = this.S.SCRIPT;\n }\n else {\n if (!SAX.isWhitespace(c)) {\n this.strictFail('Invalid tagname in closing tag');\n }\n this.state = this.S.CLOSE_TAG_SAW_WHITE;\n }\n continue;\n case this.S.CLOSE_TAG_SAW_WHITE:\n if (SAX.isWhitespace(c)) {\n continue;\n }\n if (c === '>') {\n this.closeTag();\n }\n else {\n this.strictFail('Invalid characters in closing tag');\n }\n continue;\n case this.S.TEXT_ENTITY:\n case this.S.ATTRIB_VALUE_ENTITY_Q:\n case this.S.ATTRIB_VALUE_ENTITY_U:\n let returnState;\n let buffer;\n switch (this.state) {\n case this.S.TEXT_ENTITY:\n returnState = this.S.TEXT;\n buffer = 'textNode';\n break;\n case this.S.ATTRIB_VALUE_ENTITY_Q:\n returnState = this.S.ATTRIB_VALUE_QUOTED;\n buffer = 'attribValue';\n break;\n case this.S.ATTRIB_VALUE_ENTITY_U:\n returnState = this.S.ATTRIB_VALUE_UNQUOTED;\n buffer = 'attribValue';\n break;\n default:\n throw new Error(`Unknown state: ${this.state}`);\n }\n if (c === ';') {\n this[buffer] += this.parseEntity();\n this.entity = '';\n this.state = returnState;\n }\n else if (SAX.isMatch(this.entity.length ? entityBody : entityStart, c)) {\n this.entity += c;\n }\n else {\n this.strictFail('Invalid character in entity name');\n this[buffer] += `&${this.entity}${c}`;\n this.entity = '';\n this.state = returnState;\n }\n continue;\n default:\n throw new Error(`Unknown state: ${this.state}`);\n }\n } // while\n if (this.position >= this.bufferCheckPosition) {\n this.checkBufferLength();\n }\n return this;\n }\n emit(event, data) {\n if (this.events.hasOwnProperty(event)) {\n const eventName = event.replace(/^on/, '');\n this.events[event](data, eventName, this);\n }\n }\n clearBuffers() {\n for (let i = 0, l = this.BUFFERS.length; i < l; i++) {\n this[this[i]] = '';\n }\n }\n flushBuffers() {\n this.closeText();\n if (this.cdata !== '') {\n this.emitNode('oncdata', this.cdata);\n this.cdata = '';\n }\n if (this.script !== '') {\n this.emitNode('onscript', this.script);\n this.script = '';\n }\n }\n end() {\n if (this.sawRoot && !this.closedRoot)\n this.strictFail('Unclosed root tag');\n if (this.state !== this.S.BEGIN &&\n this.state !== this.S.BEGIN_WHITESPACE &&\n this.state !== this.S.TEXT) {\n this.errorFunction('Unexpected end');\n }\n this.closeText();\n this.c = '';\n this.closed = true;\n this.emit('onend');\n return new SAXParser(this.opt);\n }\n errorFunction(er) {\n this.closeText();\n if (this.trackPosition) {\n er += `\\nLine: ${this.line}\\nColumn: ${this.column}\\nChar: ${this.c}`;\n }\n const error = new Error(er);\n this.error = error;\n this.emit('onerror', error);\n return this;\n }\n attrib() {\n if (!this.strict) {\n this.attribName = this.attribName[this.looseCase]();\n }\n if (this.attribList.indexOf(this.attribName) !== -1 ||\n this.tag.attributes.hasOwnProperty(this.attribName)) {\n this.attribName = this.attribValue = '';\n return;\n }\n if (this.opt.xmlns) {\n const qn = SAX.qname(this.attribName, true);\n const prefix = qn.prefix;\n const local = qn.local;\n if (prefix === 'xmlns') {\n // namespace binding attribute. push the binding into scope\n if (local === 'xml' && this.attribValue !== this.XML_NAMESPACE) {\n this.strictFail(`xml: prefix must be bound to ${this.XML_NAMESPACE}\\n` + `Actual: ${this.attribValue}`);\n }\n else if (local === 'xmlns' && this.attribValue !== this.XMLNS_NAMESPACE) {\n this.strictFail(`xmlns: prefix must be bound to ${this.XMLNS_NAMESPACE}\\n` +\n `Actual: ${this.attribValue}`);\n }\n else {\n const tag = this.tag;\n const parent = this.tags[this.tags.length - 1] || this;\n if (tag.ns === parent.ns) {\n tag.ns = Object.create(parent.ns);\n }\n tag.ns[local] = this.attribValue;\n }\n }\n // defer onattribute events until all attributes have been seen\n // so any new bindings can take effect. preserve attribute order\n // so deferred events can be emitted in document order\n this.attribList.push([this.attribName, this.attribValue]);\n }\n else {\n // in non-xmlns mode, we can emit the event right away\n this.tag.attributes[this.attribName] = this.attribValue;\n this.emitNode('onattribute', {\n name: this.attribName,\n value: this.attribValue\n });\n }\n this.attribName = this.attribValue = '';\n }\n newTag() {\n if (!this.strict)\n this.tagName = this.tagName[this.looseCase]();\n const parent = this.tags[this.tags.length - 1] || this;\n const tag = (this.tag = { name: this.tagName, attributes: {} });\n // will be overridden if tag contains an xmlns=\"foo\" or xmlns:foo=\"bar\"\n if (this.opt.xmlns) {\n tag.ns = parent.ns;\n }\n this.attribList.length = 0;\n this.emitNode('onopentagstart', tag);\n }\n parseEntity() {\n let entity = this.entity;\n const entityLC = entity.toLowerCase();\n let num = NaN;\n let numStr = '';\n if (this.ENTITIES[entity]) {\n return this.ENTITIES[entity];\n }\n if (this.ENTITIES[entityLC]) {\n return this.ENTITIES[entityLC];\n }\n entity = entityLC;\n if (entity.charAt(0) === '#') {\n if (entity.charAt(1) === 'x') {\n entity = entity.slice(2);\n // TODO: remove tslint:disable\n // tslint:disable-next-line\n num = parseInt(entity, 16);\n numStr = num.toString(16);\n }\n else {\n entity = entity.slice(1);\n // TODO: remove tslint:disable\n // tslint:disable-next-line\n num = parseInt(entity, 10);\n numStr = num.toString(10);\n }\n }\n entity = entity.replace(/^0+/, '');\n if (isNaN(num) || numStr.toLowerCase() !== entity) {\n this.strictFail('Invalid character entity');\n return `&${this.entity};`;\n }\n return String.fromCodePoint(num);\n }\n beginWhiteSpace(c) {\n if (c === '<') {\n this.state = this.S.OPEN_WAKA;\n this.startTagPosition = this.position;\n }\n else if (!SAX.isWhitespace(c)) {\n // have to process this as a text node.\n // weird, but happens.\n this.strictFail('Non-whitespace before first tag.');\n this.textNode = c;\n this.state = this.S.TEXT;\n }\n else {\n }\n }\n strictFail(message) {\n if (typeof this !== 'object' || !(this instanceof SAXParser)) {\n throw new Error('bad call to strictFail');\n }\n if (this.strict) {\n this.errorFunction(message);\n }\n }\n textApplyOptions(text) {\n if (this.opt.trim)\n text = text.trim();\n if (this.opt.normalize)\n text = text.replace(/\\s+/g, ' ');\n return text;\n }\n emitNode(nodeType, data) {\n if (this.textNode)\n this.closeText();\n this.emit(nodeType, data);\n }\n closeText() {\n this.textNode = this.textApplyOptions(this.textNode);\n // TODO: figure out why this.textNode can be \"\" and \"undefined\"\n if (this.textNode !== undefined && this.textNode !== '' && this.textNode !== 'undefined') {\n this.emit('ontext', this.textNode);\n }\n this.textNode = '';\n }\n checkBufferLength() {\n const maxAllowed = Math.max(this.opt.MAX_BUFFER_LENGTH, 10);\n let maxActual = 0;\n for (let i = 0, l = this.BUFFERS.length; i < l; i++) {\n const len = this[this.BUFFERS[i]]?.length || 0;\n if (len > maxAllowed) {\n // Text/cdata nodes can get big, and since they're buffered,\n // we can get here under normal conditions.\n // Avoid issues by emitting the text node now,\n // so at least it won't get any bigger.\n switch (this.BUFFERS[i]) {\n case 'textNode':\n this.closeText();\n break;\n case 'cdata':\n this.emitNode('oncdata', this.cdata);\n this.cdata = '';\n break;\n case 'script':\n this.emitNode('onscript', this.script);\n this.script = '';\n break;\n default:\n this.errorFunction(`Max buffer length exceeded: ${this.BUFFERS[i]}`);\n }\n }\n maxActual = Math.max(maxActual, len);\n }\n // schedule the next check for the earliest possible buffer overrun.\n const m = this.opt.MAX_BUFFER_LENGTH - maxActual;\n this.bufferCheckPosition = m + this.position;\n }\n openTag(selfClosing) {\n if (this.opt.xmlns) {\n // emit namespace binding events\n const tag = this.tag;\n // add namespace info to tag\n const qn = SAX.qname(this.tagName);\n tag.prefix = qn.prefix;\n tag.local = qn.local;\n tag.uri = tag.ns[qn.prefix] || '';\n if (tag.prefix && !tag.uri) {\n this.strictFail(`Unbound namespace prefix: ${JSON.stringify(this.tagName)}`);\n tag.uri = qn.prefix;\n }\n const parent = this.tags[this.tags.length - 1] || this;\n if (tag.ns && parent.ns !== tag.ns) {\n const that = this;\n Object.keys(tag.ns).forEach((p) => {\n that.emitNode('onopennamespace', {\n prefix: p,\n uri: tag.ns[p]\n });\n });\n }\n // handle deferred onattribute events\n // Note: do not apply default ns to attributes:\n // http://www.w3.org/TR/REC-xml-names/#defaulting\n for (let i = 0, l = this.attribList.length; i < l; i++) {\n const nv = this.attribList[i];\n const name = nv[0];\n const value = nv[1];\n const qualName = SAX.qname(name, true);\n const prefix = qualName.prefix;\n const local = qualName.local;\n const uri = prefix === '' ? '' : tag.ns[prefix] || '';\n const a = {\n name,\n value,\n prefix,\n local,\n uri\n };\n // if there's any attributes with an undefined namespace,\n // then fail on them now.\n if (prefix && prefix !== 'xmlns' && !uri) {\n this.strictFail(`Unbound namespace prefix: ${JSON.stringify(prefix)}`);\n a.uri = prefix;\n }\n this.tag.attributes[name] = a;\n this.emitNode('onattribute', a);\n }\n this.attribList.length = 0;\n }\n this.tag.isSelfClosing = Boolean(selfClosing);\n // process the tag\n this.sawRoot = true;\n this.tags.push(this.tag);\n this.emitNode('onopentag', this.tag);\n if (!selfClosing) {\n // special case for <script> in non-strict mode.\n if (!this.noscript && this.tagName.toLowerCase() === 'script') {\n this.state = this.S.SCRIPT;\n }\n else {\n this.state = this.S.TEXT;\n }\n this.tag = null;\n this.tagName = '';\n }\n this.attribName = this.attribValue = '';\n this.attribList.length = 0;\n }\n closeTag() {\n if (!this.tagName) {\n this.strictFail('Weird empty close tag.');\n this.textNode += '</>';\n this.state = this.S.TEXT;\n return;\n }\n if (this.script) {\n if (this.tagName !== 'script') {\n this.script += `</${this.tagName}>`;\n this.tagName = '';\n this.state = this.S.SCRIPT;\n return;\n }\n this.emitNode('onscript', this.script);\n this.script = '';\n }\n // first make sure that the closing tag actually exists.\n // <a><b></c></b></a> will close everything, otherwise.\n let t = this.tags.length;\n let tagName = this.tagName;\n if (!this.strict) {\n tagName = tagName[this.looseCase]();\n }\n while (t--) {\n const close = this.tags[t];\n if (close.name !== tagName) {\n // fail the first time in strict mode\n this.strictFail('Unexpected close tag');\n }\n else {\n break;\n }\n }\n // didn't find it. we already failed for strict, so just abort.\n if (t < 0) {\n this.strictFail(`Unmatched closing tag: ${this.tagName}`);\n this.textNode += `</${this.tagName}>`;\n this.state = this.S.TEXT;\n return;\n }\n this.tagName = tagName;\n let s = this.tags.length;\n while (s-- > t) {\n const tag = (this.tag = this.tags.pop());\n this.tagName = this.tag.name;\n this.emitNode('onclosetag', this.tagName);\n const x = {};\n for (const i in tag.ns) {\n if (tag.ns.hasOwnProperty(i)) {\n x[i] = tag.ns[i];\n }\n }\n const parent = this.tags[this.tags.length - 1] || this;\n if (this.opt.xmlns && tag.ns !== parent.ns) {\n // remove namespace bindings introduced by tag\n const that = this;\n Object.keys(tag.ns).forEach((p) => {\n const n = tag.ns[p];\n that.emitNode('onclosenamespace', { prefix: p, uri: n });\n });\n }\n }\n if (t === 0)\n this.closedRoot = true;\n this.tagName = this.attribValue = this.attribName = '';\n this.attribList.length = 0;\n this.state = this.S.TEXT;\n }\n}\n/**\n *\n * @todo Weird inheritance, with some variables initialized in subclass\n */\nexport class SAXParser extends SAX {\n static ENTITIES = ENTITIES;\n opt = DEFAULT_SAX_PARSER_OPTIONS;\n events = DEFAULT_SAX_EVENTS;\n constructor(opt) {\n super();\n this.clearBuffers();\n this.opt = opt = { ...this.opt, ...opt };\n this.events = { ...this.events, ...opt };\n this.q = this.c = '';\n this.opt.lowercase = this.opt.lowercase || this.opt.lowercasetags;\n this.bufferCheckPosition = this.opt.MAX_BUFFER_LENGTH;\n this.looseCase = this.opt.lowercase ? 'toLowerCase' : 'toUpperCase';\n this.tags = [];\n this.closed = this.closedRoot = this.sawRoot = false;\n this.tag = this.error = null;\n this.strict = Boolean(this.opt.strict);\n this.noscript = Boolean(this.opt.strict || this.opt.noscript);\n this.state = this.S.BEGIN;\n this.strictEntities = this.opt.strictEntities;\n this.ENTITIES = this.strictEntities\n ? Object.create(this.XML_ENTITIES)\n : Object.create(this.ENTITIES);\n this.attribList = [];\n // namespaces form a prototype chain.\n // it always points at the current tag,\n // which protos to its parent tag.\n if (this.opt.xmlns) {\n this.ns = Object.create(this.rootNS);\n }\n // mostly just for error reporting\n this.trackPosition = this.opt.position !== false;\n if (this.trackPosition) {\n this.position = this.line = this.column = 0;\n }\n this.emit('onready');\n }\n resume() {\n this.error = null;\n return this;\n }\n close() {\n return this.write(null);\n }\n flush() {\n this.flushBuffers();\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Uncapitalize first letter of a string\n * @param str\n * @returns\n */\nexport function uncapitalize(str) {\n return typeof str === 'string' ? str.charAt(0).toLowerCase() + str.slice(1) : str;\n}\n/**\n * Recursively uncapitalize all keys in a nested object\n * @param object\n * @returns\n */\nexport function uncapitalizeKeys(object) {\n if (Array.isArray(object)) {\n return object.map((element) => uncapitalizeKeys(element));\n }\n if (object && typeof object === 'object') {\n const newObject = {};\n for (const [key, value] of Object.entries(object)) {\n newObject[uncapitalize(key)] = uncapitalizeKeys(value);\n }\n return newObject;\n }\n return object;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { StreamingXMLParser } from \"./streaming-xml-parser.js\";\nimport { uncapitalizeKeys } from \"../xml-utils/uncapitalize.js\";\nimport { XMLParser as FastXMLParser } from 'fast-xml-parser';\nexport function parseXMLSync(text, options) {\n if (options?._parser && options._parser !== 'fast-xml-parser') {\n throw new Error(options?._parser);\n }\n const fastXMLOptions = {\n // Default FastXML options\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#allowbooleanattributes\n allowBooleanAttributes: true,\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#ignoredeclaration\n ignoreDeclaration: true,\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#removensprefix\n removeNSPrefix: options?.removeNSPrefix,\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#textnodename\n textNodeName: options?.textNodeName,\n // Let's application specify keys that are always arrays\n isArray: (name, jpath, isLeafNode, isAttribute) => {\n const array = Boolean(options?.arrayPaths?.some((path) => jpath === path));\n return array;\n },\n // Application overrides\n ...options?._fastXML\n };\n const xml = fastParseXML(text, fastXMLOptions);\n // Note - could be done with FastXML tag processing\n return options?.uncapitalizeKeys ? uncapitalizeKeys(xml) : xml;\n}\nexport function fastParseXML(text, options) {\n const parser = new FastXMLParser({\n ignoreAttributes: false,\n attributeNamePrefix: '',\n ...options\n });\n const parsedXML = parser.parse(text);\n return parsedXML;\n}\n/**\n * @todo Build a streaming XML parser based on sax-js\n * @param text\n * @param options\n * @returns\n */\nexport function parseXMLInBatches(text, options = {}) {\n const parser = new StreamingXMLParser({\n ...options,\n strict: true\n });\n parser.write(text);\n parser.close();\n return parser.result;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { parseXMLSync } from \"./lib/parsers/parse-xml.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.0-alpha.6\" !== 'undefined' ? \"4.3.0-alpha.6\" : 'latest';\n/**\n * Loader for XML files\n */\nexport const XMLLoader = {\n dataType: null,\n batchType: null,\n name: 'XML',\n id: 'xml',\n module: 'xml',\n version: VERSION,\n worker: false,\n extensions: ['xml'],\n mimeTypes: ['application/xml', 'text/xml'],\n testText: testXMLFile,\n options: {\n xml: {\n _parser: 'fast-xml-parser',\n uncapitalizeKeys: false,\n removeNSPrefix: false,\n textNodeName: 'value',\n arrayPaths: []\n }\n },\n parse: async (arrayBuffer, options) => parseXMLSync(new TextDecoder().decode(arrayBuffer), {\n ...XMLLoader.options.xml,\n ...options?.xml\n }),\n parseTextSync: (text, options) => parseXMLSync(text, { ...XMLLoader.options.xml, ...options?.xml })\n};\nfunction testXMLFile(text) {\n // TODO - There could be space first.\n return text.startsWith('<?xml');\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { mergeLoaderOptions } from '@loaders.gl/loader-utils';\nimport { XMLLoader } from \"./xml-loader.js\";\n/**\n * Loader for HTML files\n * Essentially a copy of the XMLLoader with different mime types, file extensions and content tests.\n * This split enables applications can control whether they want HTML responses to be parsed by the XML loader or not.\n * This loader does not have any additional understanding of the structure of HTML or the document.\n */\nexport const HTMLLoader = {\n ...XMLLoader,\n name: 'HTML',\n id: 'html',\n extensions: ['html', 'htm'],\n mimeTypes: ['text/html'],\n testText: testHTMLFile,\n parse: async (arrayBuffer, options) => parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync: (text, options) => parseTextSync(text, options)\n};\nfunction testHTMLFile(text) {\n // TODO - There could be space first.\n return text.startsWith('<html');\n}\nfunction parseTextSync(text, options) {\n // fast-xml-parser can recognize HTML entities\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#htmlentities\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/5.Entities.md\n options = mergeLoaderOptions(options, {\n xml: {\n _parser: 'fast-xml-parser',\n _fastXML: {\n htmlEntities: true\n }\n }\n });\n return XMLLoader.parseTextSync?.(text, options);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// TODO - these utilities could be moved to the XML parser.\n// uncapitalizeKeys could be an XMLLoader option\n/**\n * Extracts a value or array and always return an array\n * Useful since XML parses to object instead of array when only a single value is provided\n */\nexport function convertXMLValueToArray(xmlValue) {\n if (Array.isArray(xmlValue)) {\n return xmlValue;\n }\n if (xmlValue && typeof xmlValue === 'object' && xmlValue['0']) {\n // Error this is an objectified array\n }\n if (xmlValue) {\n return [xmlValue];\n }\n return [];\n}\n/**\n * Mutates a field in place, converting it to array\n * Useful since XML parses to object instead of array when only a single value is provided\n */\nexport function convertXMLFieldToArrayInPlace(xml, key) {\n xml[key] = convertXMLValueToArray(xml[key]);\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,IAAM,qBAAqB;AAAA,EACvB,QAAQ,MAAM;AAAA,EAAE;AAAA,EAChB,yBAAyB,MAAM;AAAA,EAAE;AAAA,EACjC,mBAAmB,MAAM;AAAA,EAAE;AAAA,EAC3B,WAAW,MAAM;AAAA,EAAE;AAAA,EACnB,WAAW,MAAM;AAAA,EAAE;AAAA,EACnB,gBAAgB,MAAM;AAAA,EAAE;AAAA,EACxB,aAAa,MAAM;AAAA,EAAE;AAAA,EACrB,WAAW,MAAM;AAAA,EAAE;AAAA,EACnB,YAAY,MAAM;AAAA,EAAE;AAAA,EACpB,aAAa,MAAM;AAAA,EAAE;AAAA,EACrB,SAAS,MAAM;AAAA,EAAE;AAAA,EACjB,cAAc,MAAM;AAAA,EAAE;AAAA,EACtB,SAAS,MAAM;AAAA,EAAE;AAAA,EACjB,OAAO,MAAM;AAAA,EAAE;AAAA,EACf,SAAS,MAAM;AAAA,EAAE;AAAA,EACjB,UAAU,MAAM;AAAA,EAAE;AAAA,EAClB,iBAAiB,MAAM;AAAA,EAAE;AAAA,EACzB,kBAAkB,MAAM;AAAA,EAAE;AAC9B;AACA,IAAM,6BAA6B;AAAA,EAC/B,GAAG;AAAA,EACH,QAAQ;AAAA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B,WAAO;AAAA,EACX;AACA,MAAI,YAAY,OAAO,aAAa,YAAY,SAAS,GAAG,GAAG;AAAA,EAE/D;AACA,MAAI,UAAU;AACV,WAAO,CAAC,QAAQ;AAAA,EACpB;AACA,SAAO,CAAC;AACZ;AAKO,SAAS,8BAA8B,KAAK,KAAK;AACpD,MAAI,GAAG,IAAI,uBAAuB,IAAI,GAAG,CAAC;AAC9C;",
6
6
  "names": ["FastXMLParser"]
7
7
  }
@@ -4,7 +4,7 @@
4
4
  import { parseXMLSync } from "./lib/parsers/parse-xml.js";
5
5
  // __VERSION__ is injected by babel-plugin-version-inline
6
6
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
7
- const VERSION = typeof "4.3.0-alpha.4" !== 'undefined' ? "4.3.0-alpha.4" : 'latest';
7
+ const VERSION = typeof "4.3.0-alpha.6" !== 'undefined' ? "4.3.0-alpha.6" : 'latest';
8
8
  /**
9
9
  * Loader for XML files
10
10
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/xml",
3
- "version": "4.3.0-alpha.5",
3
+ "version": "4.3.0-alpha.7",
4
4
  "description": "Framework-independent loaders for the XML (eXtensible Markup Language) format",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,12 +41,12 @@
41
41
  "build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
42
42
  },
43
43
  "dependencies": {
44
- "@loaders.gl/loader-utils": "4.3.0-alpha.5",
45
- "@loaders.gl/schema": "4.3.0-alpha.5",
44
+ "@loaders.gl/loader-utils": "4.3.0-alpha.7",
45
+ "@loaders.gl/schema": "4.3.0-alpha.7",
46
46
  "fast-xml-parser": "^4.2.5"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@loaders.gl/core": "^4.0.0"
50
50
  },
51
- "gitHead": "b57553345b3cbf621c95ad9b22aa672217451f61"
51
+ "gitHead": "73fb27872d89f3804dca37ebd568c6ba9609a98f"
52
52
  }