@nextcloud/files 3.10.1 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{dav-CtqjqS4O.cjs → dav-5fPdvOgP.cjs} +19 -3
- package/dist/chunks/dav-5fPdvOgP.cjs.map +1 -0
- package/dist/chunks/{dav-Co9y-hkg.mjs → dav-DY_3WIBa.mjs} +19 -3
- package/dist/chunks/dav-DY_3WIBa.mjs.map +1 -0
- package/dist/dav/dav.d.ts +0 -1
- package/dist/dav.cjs +2 -1
- package/dist/dav.mjs +2 -1
- package/dist/fileAction.d.ts +0 -1
- package/dist/fileListAction.d.ts +7 -10
- package/dist/fileListFilters.d.ts +0 -1
- package/dist/fileListHeaders.d.ts +0 -1
- package/dist/files/file.d.ts +0 -1
- package/dist/files/folder.d.ts +0 -1
- package/dist/files/node.d.ts +6 -3
- package/dist/files/nodeData.d.ts +0 -1
- package/dist/index.cjs +1931 -1921
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +1930 -1922
- package/dist/index.mjs.map +1 -1
- package/dist/navigation/column.d.ts +0 -1
- package/dist/navigation/navigation.d.ts +0 -1
- package/dist/navigation/view.d.ts +5 -1
- package/dist/newFileMenu.d.ts +0 -1
- package/dist/utils/fileSorting.d.ts +0 -1
- package/dist/vendor.LICENSE.txt +11 -11
- package/package.json +57 -52
- package/dist/chunks/dav-Co9y-hkg.mjs.map +0 -1
- package/dist/chunks/dav-CtqjqS4O.cjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { o as logger } from "./chunks/dav-
|
|
2
|
-
import { q, F, s, N, t, P, c, l, m, n, a, g, p, b, r, d, h, f, k, j, e, i } from "./chunks/dav-
|
|
1
|
+
import { o as logger } from "./chunks/dav-DY_3WIBa.mjs";
|
|
2
|
+
import { q, F, s, N, t, P, c, l, m, n, a, g, p, b, r, d, h, f, k, j, e, i } from "./chunks/dav-DY_3WIBa.mjs";
|
|
3
3
|
import { getCapabilities } from "@nextcloud/capabilities";
|
|
4
4
|
import { extname, basename } from "path";
|
|
5
5
|
import { getCanonicalLocale, getLanguage } from "@nextcloud/l10n";
|
|
6
6
|
import { TypedEventTarget } from "typescript-event-target";
|
|
7
|
+
import require$$1 from "string_decoder";
|
|
7
8
|
var NewMenuEntryCategory = /* @__PURE__ */ ((NewMenuEntryCategory2) => {
|
|
8
9
|
NewMenuEntryCategory2[NewMenuEntryCategory2["UploadFromDevice"] = 0] = "UploadFromDevice";
|
|
9
10
|
NewMenuEntryCategory2[NewMenuEntryCategory2["CreateNew"] = 1] = "CreateNew";
|
|
@@ -484,7 +485,7 @@ function sortNodes(nodes, options = {}) {
|
|
|
484
485
|
// 3: Use sorting mode if NOT basename (to be able to use display name too)
|
|
485
486
|
...sortingOptions.sortingMode !== "basename" ? [(v) => v[sortingOptions.sortingMode]] : [],
|
|
486
487
|
// 4: Use display name if available, fallback to name
|
|
487
|
-
(v) => basename2(v.displayname || v.attributes?.displayname || v.basename),
|
|
488
|
+
(v) => basename2(v.displayname || v.attributes?.displayname || v.basename || ""),
|
|
488
489
|
// 5: Finally, use basename if all previous sorting methods failed
|
|
489
490
|
(v) => v.basename
|
|
490
491
|
];
|
|
@@ -603,1604 +604,1549 @@ const isValidColumn = function(column) {
|
|
|
603
604
|
function getDefaultExportFromCjs(x) {
|
|
604
605
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
605
606
|
}
|
|
606
|
-
var
|
|
607
|
-
var
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
607
|
+
var sax$1 = {};
|
|
608
|
+
var hasRequiredSax;
|
|
609
|
+
function requireSax() {
|
|
610
|
+
if (hasRequiredSax) return sax$1;
|
|
611
|
+
hasRequiredSax = 1;
|
|
612
|
+
(function(exports) {
|
|
613
|
+
(function(sax2) {
|
|
614
|
+
sax2.parser = function(strict, opt) {
|
|
615
|
+
return new SAXParser(strict, opt);
|
|
616
|
+
};
|
|
617
|
+
sax2.SAXParser = SAXParser;
|
|
618
|
+
sax2.SAXStream = SAXStream;
|
|
619
|
+
sax2.createStream = createStream;
|
|
620
|
+
sax2.MAX_BUFFER_LENGTH = 64 * 1024;
|
|
621
|
+
var buffers = [
|
|
622
|
+
"comment",
|
|
623
|
+
"sgmlDecl",
|
|
624
|
+
"textNode",
|
|
625
|
+
"tagName",
|
|
626
|
+
"doctype",
|
|
627
|
+
"procInstName",
|
|
628
|
+
"procInstBody",
|
|
629
|
+
"entity",
|
|
630
|
+
"attribName",
|
|
631
|
+
"attribValue",
|
|
632
|
+
"cdata",
|
|
633
|
+
"script"
|
|
634
|
+
];
|
|
635
|
+
sax2.EVENTS = [
|
|
636
|
+
"text",
|
|
637
|
+
"processinginstruction",
|
|
638
|
+
"sgmldeclaration",
|
|
639
|
+
"doctype",
|
|
640
|
+
"comment",
|
|
641
|
+
"opentagstart",
|
|
642
|
+
"attribute",
|
|
643
|
+
"opentag",
|
|
644
|
+
"closetag",
|
|
645
|
+
"opencdata",
|
|
646
|
+
"cdata",
|
|
647
|
+
"closecdata",
|
|
648
|
+
"error",
|
|
649
|
+
"end",
|
|
650
|
+
"ready",
|
|
651
|
+
"script",
|
|
652
|
+
"opennamespace",
|
|
653
|
+
"closenamespace"
|
|
654
|
+
];
|
|
655
|
+
function SAXParser(strict, opt) {
|
|
656
|
+
if (!(this instanceof SAXParser)) {
|
|
657
|
+
return new SAXParser(strict, opt);
|
|
658
|
+
}
|
|
659
|
+
var parser = this;
|
|
660
|
+
clearBuffers(parser);
|
|
661
|
+
parser.q = parser.c = "";
|
|
662
|
+
parser.bufferCheckPosition = sax2.MAX_BUFFER_LENGTH;
|
|
663
|
+
parser.opt = opt || {};
|
|
664
|
+
parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags;
|
|
665
|
+
parser.looseCase = parser.opt.lowercase ? "toLowerCase" : "toUpperCase";
|
|
666
|
+
parser.tags = [];
|
|
667
|
+
parser.closed = parser.closedRoot = parser.sawRoot = false;
|
|
668
|
+
parser.tag = parser.error = null;
|
|
669
|
+
parser.strict = !!strict;
|
|
670
|
+
parser.noscript = !!(strict || parser.opt.noscript);
|
|
671
|
+
parser.state = S.BEGIN;
|
|
672
|
+
parser.strictEntities = parser.opt.strictEntities;
|
|
673
|
+
parser.ENTITIES = parser.strictEntities ? Object.create(sax2.XML_ENTITIES) : Object.create(sax2.ENTITIES);
|
|
674
|
+
parser.attribList = [];
|
|
675
|
+
if (parser.opt.xmlns) {
|
|
676
|
+
parser.ns = Object.create(rootNS);
|
|
677
|
+
}
|
|
678
|
+
if (parser.opt.unquotedAttributeValues === void 0) {
|
|
679
|
+
parser.opt.unquotedAttributeValues = !strict;
|
|
680
|
+
}
|
|
681
|
+
parser.trackPosition = parser.opt.position !== false;
|
|
682
|
+
if (parser.trackPosition) {
|
|
683
|
+
parser.position = parser.line = parser.column = 0;
|
|
684
|
+
}
|
|
685
|
+
emit2(parser, "onready");
|
|
622
686
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
687
|
+
if (!Object.create) {
|
|
688
|
+
Object.create = function(o) {
|
|
689
|
+
function F2() {
|
|
690
|
+
}
|
|
691
|
+
F2.prototype = o;
|
|
692
|
+
var newf = new F2();
|
|
693
|
+
return newf;
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
if (!Object.keys) {
|
|
697
|
+
Object.keys = function(o) {
|
|
698
|
+
var a2 = [];
|
|
699
|
+
for (var i2 in o) if (o.hasOwnProperty(i2)) a2.push(i2);
|
|
700
|
+
return a2;
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
function checkBufferLength(parser) {
|
|
704
|
+
var maxAllowed = Math.max(sax2.MAX_BUFFER_LENGTH, 10);
|
|
705
|
+
var maxActual = 0;
|
|
706
|
+
for (var i2 = 0, l2 = buffers.length; i2 < l2; i2++) {
|
|
707
|
+
var len = parser[buffers[i2]].length;
|
|
708
|
+
if (len > maxAllowed) {
|
|
709
|
+
switch (buffers[i2]) {
|
|
710
|
+
case "textNode":
|
|
711
|
+
closeText(parser);
|
|
712
|
+
break;
|
|
713
|
+
case "cdata":
|
|
714
|
+
emitNode(parser, "oncdata", parser.cdata);
|
|
715
|
+
parser.cdata = "";
|
|
716
|
+
break;
|
|
717
|
+
case "script":
|
|
718
|
+
emitNode(parser, "onscript", parser.script);
|
|
719
|
+
parser.script = "";
|
|
720
|
+
break;
|
|
721
|
+
default:
|
|
722
|
+
error(parser, "Max buffer length exceeded: " + buffers[i2]);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
maxActual = Math.max(maxActual, len);
|
|
647
726
|
}
|
|
727
|
+
var m2 = sax2.MAX_BUFFER_LENGTH - maxActual;
|
|
728
|
+
parser.bufferCheckPosition = m2 + parser.position;
|
|
648
729
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
if (exports.isExist(v)) {
|
|
653
|
-
return v;
|
|
654
|
-
} else {
|
|
655
|
-
return "";
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
exports.isName = isName;
|
|
659
|
-
exports.getAllMatches = getAllMatches;
|
|
660
|
-
exports.nameRegexp = nameRegexp;
|
|
661
|
-
})(util$3);
|
|
662
|
-
const util$2 = util$3;
|
|
663
|
-
const defaultOptions$2 = {
|
|
664
|
-
allowBooleanAttributes: false,
|
|
665
|
-
//A tag can have attributes without any value
|
|
666
|
-
unpairedTags: []
|
|
667
|
-
};
|
|
668
|
-
validator$2.validate = function(xmlData, options) {
|
|
669
|
-
options = Object.assign({}, defaultOptions$2, options);
|
|
670
|
-
const tags = [];
|
|
671
|
-
let tagFound = false;
|
|
672
|
-
let reachedRoot = false;
|
|
673
|
-
if (xmlData[0] === "\uFEFF") {
|
|
674
|
-
xmlData = xmlData.substr(1);
|
|
675
|
-
}
|
|
676
|
-
for (let i2 = 0; i2 < xmlData.length; i2++) {
|
|
677
|
-
if (xmlData[i2] === "<" && xmlData[i2 + 1] === "?") {
|
|
678
|
-
i2 += 2;
|
|
679
|
-
i2 = readPI(xmlData, i2);
|
|
680
|
-
if (i2.err) return i2;
|
|
681
|
-
} else if (xmlData[i2] === "<") {
|
|
682
|
-
let tagStartPos = i2;
|
|
683
|
-
i2++;
|
|
684
|
-
if (xmlData[i2] === "!") {
|
|
685
|
-
i2 = readCommentAndCDATA(xmlData, i2);
|
|
686
|
-
continue;
|
|
687
|
-
} else {
|
|
688
|
-
let closingTag = false;
|
|
689
|
-
if (xmlData[i2] === "/") {
|
|
690
|
-
closingTag = true;
|
|
691
|
-
i2++;
|
|
730
|
+
function clearBuffers(parser) {
|
|
731
|
+
for (var i2 = 0, l2 = buffers.length; i2 < l2; i2++) {
|
|
732
|
+
parser[buffers[i2]] = "";
|
|
692
733
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
734
|
+
}
|
|
735
|
+
function flushBuffers(parser) {
|
|
736
|
+
closeText(parser);
|
|
737
|
+
if (parser.cdata !== "") {
|
|
738
|
+
emitNode(parser, "oncdata", parser.cdata);
|
|
739
|
+
parser.cdata = "";
|
|
696
740
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
i2--;
|
|
741
|
+
if (parser.script !== "") {
|
|
742
|
+
emitNode(parser, "onscript", parser.script);
|
|
743
|
+
parser.script = "";
|
|
701
744
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
745
|
+
}
|
|
746
|
+
SAXParser.prototype = {
|
|
747
|
+
end: function() {
|
|
748
|
+
end(this);
|
|
749
|
+
},
|
|
750
|
+
write,
|
|
751
|
+
resume: function() {
|
|
752
|
+
this.error = null;
|
|
753
|
+
return this;
|
|
754
|
+
},
|
|
755
|
+
close: function() {
|
|
756
|
+
return this.write(null);
|
|
757
|
+
},
|
|
758
|
+
flush: function() {
|
|
759
|
+
flushBuffers(this);
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
var Stream;
|
|
763
|
+
try {
|
|
764
|
+
Stream = require("stream").Stream;
|
|
765
|
+
} catch (ex) {
|
|
766
|
+
Stream = function() {
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
if (!Stream) Stream = function() {
|
|
770
|
+
};
|
|
771
|
+
var streamWraps = sax2.EVENTS.filter(function(ev) {
|
|
772
|
+
return ev !== "error" && ev !== "end";
|
|
773
|
+
});
|
|
774
|
+
function createStream(strict, opt) {
|
|
775
|
+
return new SAXStream(strict, opt);
|
|
776
|
+
}
|
|
777
|
+
function SAXStream(strict, opt) {
|
|
778
|
+
if (!(this instanceof SAXStream)) {
|
|
779
|
+
return new SAXStream(strict, opt);
|
|
710
780
|
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
781
|
+
Stream.apply(this);
|
|
782
|
+
this._parser = new SAXParser(strict, opt);
|
|
783
|
+
this.writable = true;
|
|
784
|
+
this.readable = true;
|
|
785
|
+
var me = this;
|
|
786
|
+
this._parser.onend = function() {
|
|
787
|
+
me.emit("end");
|
|
788
|
+
};
|
|
789
|
+
this._parser.onerror = function(er) {
|
|
790
|
+
me.emit("error", er);
|
|
791
|
+
me._parser.error = null;
|
|
792
|
+
};
|
|
793
|
+
this._decoder = null;
|
|
794
|
+
streamWraps.forEach(function(ev) {
|
|
795
|
+
Object.defineProperty(me, "on" + ev, {
|
|
796
|
+
get: function() {
|
|
797
|
+
return me._parser["on" + ev];
|
|
798
|
+
},
|
|
799
|
+
set: function(h2) {
|
|
800
|
+
if (!h2) {
|
|
801
|
+
me.removeAllListeners(ev);
|
|
802
|
+
me._parser["on" + ev] = h2;
|
|
803
|
+
return h2;
|
|
804
|
+
}
|
|
805
|
+
me.on(ev, h2);
|
|
806
|
+
},
|
|
807
|
+
enumerable: true,
|
|
808
|
+
configurable: false
|
|
809
|
+
});
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
SAXStream.prototype = Object.create(Stream.prototype, {
|
|
813
|
+
constructor: {
|
|
814
|
+
value: SAXStream
|
|
714
815
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
if (
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
if (isValid === true) {
|
|
722
|
-
tagFound = true;
|
|
723
|
-
} else {
|
|
724
|
-
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));
|
|
725
|
-
}
|
|
726
|
-
} else if (closingTag) {
|
|
727
|
-
if (!result.tagClosed) {
|
|
728
|
-
return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' doesn't have proper closing.", getLineNumberForPosition(xmlData, i2));
|
|
729
|
-
} else if (attrStr.trim().length > 0) {
|
|
730
|
-
return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
|
|
731
|
-
} else if (tags.length === 0) {
|
|
732
|
-
return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
|
|
733
|
-
} else {
|
|
734
|
-
const otg = tags.pop();
|
|
735
|
-
if (tagName !== otg.tagName) {
|
|
736
|
-
let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);
|
|
737
|
-
return getErrorObject(
|
|
738
|
-
"InvalidTag",
|
|
739
|
-
"Expected closing tag '" + otg.tagName + "' (opened in line " + openPos.line + ", col " + openPos.col + ") instead of closing tag '" + tagName + "'.",
|
|
740
|
-
getLineNumberForPosition(xmlData, tagStartPos)
|
|
741
|
-
);
|
|
742
|
-
}
|
|
743
|
-
if (tags.length == 0) {
|
|
744
|
-
reachedRoot = true;
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
} else {
|
|
748
|
-
const isValid = validateAttributeString(attrStr, options);
|
|
749
|
-
if (isValid !== true) {
|
|
750
|
-
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i2 - attrStr.length + isValid.err.line));
|
|
751
|
-
}
|
|
752
|
-
if (reachedRoot === true) {
|
|
753
|
-
return getErrorObject("InvalidXml", "Multiple possible root nodes found.", getLineNumberForPosition(xmlData, i2));
|
|
754
|
-
} else if (options.unpairedTags.indexOf(tagName) !== -1) ;
|
|
755
|
-
else {
|
|
756
|
-
tags.push({ tagName, tagStartPos });
|
|
816
|
+
});
|
|
817
|
+
SAXStream.prototype.write = function(data) {
|
|
818
|
+
if (typeof Buffer === "function" && typeof Buffer.isBuffer === "function" && Buffer.isBuffer(data)) {
|
|
819
|
+
if (!this._decoder) {
|
|
820
|
+
var SD = require$$1.StringDecoder;
|
|
821
|
+
this._decoder = new SD("utf8");
|
|
757
822
|
}
|
|
758
|
-
|
|
823
|
+
data = this._decoder.write(data);
|
|
759
824
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
i2 = readPI(xmlData, ++i2);
|
|
768
|
-
if (i2.err) return i2;
|
|
769
|
-
} else {
|
|
770
|
-
break;
|
|
771
|
-
}
|
|
772
|
-
} else if (xmlData[i2] === "&") {
|
|
773
|
-
const afterAmp = validateAmpersand(xmlData, i2);
|
|
774
|
-
if (afterAmp == -1)
|
|
775
|
-
return getErrorObject("InvalidChar", "char '&' is not expected.", getLineNumberForPosition(xmlData, i2));
|
|
776
|
-
i2 = afterAmp;
|
|
777
|
-
} else {
|
|
778
|
-
if (reachedRoot === true && !isWhiteSpace(xmlData[i2])) {
|
|
779
|
-
return getErrorObject("InvalidXml", "Extra text at the end", getLineNumberForPosition(xmlData, i2));
|
|
780
|
-
}
|
|
781
|
-
}
|
|
825
|
+
this._parser.write(data.toString());
|
|
826
|
+
this.emit("data", data);
|
|
827
|
+
return true;
|
|
828
|
+
};
|
|
829
|
+
SAXStream.prototype.end = function(chunk) {
|
|
830
|
+
if (chunk && chunk.length) {
|
|
831
|
+
this.write(chunk);
|
|
782
832
|
}
|
|
783
|
-
|
|
784
|
-
|
|
833
|
+
this._parser.end();
|
|
834
|
+
return true;
|
|
835
|
+
};
|
|
836
|
+
SAXStream.prototype.on = function(ev, handler) {
|
|
837
|
+
var me = this;
|
|
838
|
+
if (!me._parser["on" + ev] && streamWraps.indexOf(ev) !== -1) {
|
|
839
|
+
me._parser["on" + ev] = function() {
|
|
840
|
+
var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
|
|
841
|
+
args.splice(0, 0, ev);
|
|
842
|
+
me.emit.apply(me, args);
|
|
843
|
+
};
|
|
785
844
|
}
|
|
845
|
+
return Stream.prototype.on.call(me, ev, handler);
|
|
846
|
+
};
|
|
847
|
+
var CDATA = "[CDATA[";
|
|
848
|
+
var DOCTYPE = "DOCTYPE";
|
|
849
|
+
var XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
|
|
850
|
+
var XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
|
|
851
|
+
var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE };
|
|
852
|
+
var 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]/;
|
|
853
|
+
var 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-]/;
|
|
854
|
+
var 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]/;
|
|
855
|
+
var 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-]/;
|
|
856
|
+
function isWhitespace(c2) {
|
|
857
|
+
return c2 === " " || c2 === "\n" || c2 === "\r" || c2 === " ";
|
|
786
858
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
continue;
|
|
859
|
+
function isQuote(c2) {
|
|
860
|
+
return c2 === '"' || c2 === "'";
|
|
790
861
|
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
}
|
|
794
|
-
if (!tagFound) {
|
|
795
|
-
return getErrorObject("InvalidXml", "Start tag expected.", 1);
|
|
796
|
-
} else if (tags.length == 1) {
|
|
797
|
-
return getErrorObject("InvalidTag", "Unclosed tag '" + tags[0].tagName + "'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
|
|
798
|
-
} else if (tags.length > 0) {
|
|
799
|
-
return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(tags.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
|
|
800
|
-
}
|
|
801
|
-
return true;
|
|
802
|
-
};
|
|
803
|
-
function isWhiteSpace(char) {
|
|
804
|
-
return char === " " || char === " " || char === "\n" || char === "\r";
|
|
805
|
-
}
|
|
806
|
-
function readPI(xmlData, i2) {
|
|
807
|
-
const start = i2;
|
|
808
|
-
for (; i2 < xmlData.length; i2++) {
|
|
809
|
-
if (xmlData[i2] == "?" || xmlData[i2] == " ") {
|
|
810
|
-
const tagname = xmlData.substr(start, i2 - start);
|
|
811
|
-
if (i2 > 5 && tagname === "xml") {
|
|
812
|
-
return getErrorObject("InvalidXml", "XML declaration allowed only at the start of the document.", getLineNumberForPosition(xmlData, i2));
|
|
813
|
-
} else if (xmlData[i2] == "?" && xmlData[i2 + 1] == ">") {
|
|
814
|
-
i2++;
|
|
815
|
-
break;
|
|
816
|
-
} else {
|
|
817
|
-
continue;
|
|
862
|
+
function isAttribEnd(c2) {
|
|
863
|
+
return c2 === ">" || isWhitespace(c2);
|
|
818
864
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
return i2;
|
|
822
|
-
}
|
|
823
|
-
function readCommentAndCDATA(xmlData, i2) {
|
|
824
|
-
if (xmlData.length > i2 + 5 && xmlData[i2 + 1] === "-" && xmlData[i2 + 2] === "-") {
|
|
825
|
-
for (i2 += 3; i2 < xmlData.length; i2++) {
|
|
826
|
-
if (xmlData[i2] === "-" && xmlData[i2 + 1] === "-" && xmlData[i2 + 2] === ">") {
|
|
827
|
-
i2 += 2;
|
|
828
|
-
break;
|
|
865
|
+
function isMatch(regex, c2) {
|
|
866
|
+
return regex.test(c2);
|
|
829
867
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
let angleBracketsCount = 1;
|
|
833
|
-
for (i2 += 8; i2 < xmlData.length; i2++) {
|
|
834
|
-
if (xmlData[i2] === "<") {
|
|
835
|
-
angleBracketsCount++;
|
|
836
|
-
} else if (xmlData[i2] === ">") {
|
|
837
|
-
angleBracketsCount--;
|
|
838
|
-
if (angleBracketsCount === 0) {
|
|
839
|
-
break;
|
|
840
|
-
}
|
|
868
|
+
function notMatch(regex, c2) {
|
|
869
|
+
return !isMatch(regex, c2);
|
|
841
870
|
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
871
|
+
var S = 0;
|
|
872
|
+
sax2.STATE = {
|
|
873
|
+
BEGIN: S++,
|
|
874
|
+
// leading byte order mark or whitespace
|
|
875
|
+
BEGIN_WHITESPACE: S++,
|
|
876
|
+
// leading whitespace
|
|
877
|
+
TEXT: S++,
|
|
878
|
+
// general stuff
|
|
879
|
+
TEXT_ENTITY: S++,
|
|
880
|
+
// & and such.
|
|
881
|
+
OPEN_WAKA: S++,
|
|
882
|
+
// <
|
|
883
|
+
SGML_DECL: S++,
|
|
884
|
+
// <!BLARG
|
|
885
|
+
SGML_DECL_QUOTED: S++,
|
|
886
|
+
// <!BLARG foo "bar
|
|
887
|
+
DOCTYPE: S++,
|
|
888
|
+
// <!DOCTYPE
|
|
889
|
+
DOCTYPE_QUOTED: S++,
|
|
890
|
+
// <!DOCTYPE "//blah
|
|
891
|
+
DOCTYPE_DTD: S++,
|
|
892
|
+
// <!DOCTYPE "//blah" [ ...
|
|
893
|
+
DOCTYPE_DTD_QUOTED: S++,
|
|
894
|
+
// <!DOCTYPE "//blah" [ "foo
|
|
895
|
+
COMMENT_STARTING: S++,
|
|
896
|
+
// <!-
|
|
897
|
+
COMMENT: S++,
|
|
898
|
+
// <!--
|
|
899
|
+
COMMENT_ENDING: S++,
|
|
900
|
+
// <!-- blah -
|
|
901
|
+
COMMENT_ENDED: S++,
|
|
902
|
+
// <!-- blah --
|
|
903
|
+
CDATA: S++,
|
|
904
|
+
// <![CDATA[ something
|
|
905
|
+
CDATA_ENDING: S++,
|
|
906
|
+
// ]
|
|
907
|
+
CDATA_ENDING_2: S++,
|
|
908
|
+
// ]]
|
|
909
|
+
PROC_INST: S++,
|
|
910
|
+
// <?hi
|
|
911
|
+
PROC_INST_BODY: S++,
|
|
912
|
+
// <?hi there
|
|
913
|
+
PROC_INST_ENDING: S++,
|
|
914
|
+
// <?hi "there" ?
|
|
915
|
+
OPEN_TAG: S++,
|
|
916
|
+
// <strong
|
|
917
|
+
OPEN_TAG_SLASH: S++,
|
|
918
|
+
// <strong /
|
|
919
|
+
ATTRIB: S++,
|
|
920
|
+
// <a
|
|
921
|
+
ATTRIB_NAME: S++,
|
|
922
|
+
// <a foo
|
|
923
|
+
ATTRIB_NAME_SAW_WHITE: S++,
|
|
924
|
+
// <a foo _
|
|
925
|
+
ATTRIB_VALUE: S++,
|
|
926
|
+
// <a foo=
|
|
927
|
+
ATTRIB_VALUE_QUOTED: S++,
|
|
928
|
+
// <a foo="bar
|
|
929
|
+
ATTRIB_VALUE_CLOSED: S++,
|
|
930
|
+
// <a foo="bar"
|
|
931
|
+
ATTRIB_VALUE_UNQUOTED: S++,
|
|
932
|
+
// <a foo=bar
|
|
933
|
+
ATTRIB_VALUE_ENTITY_Q: S++,
|
|
934
|
+
// <foo bar="""
|
|
935
|
+
ATTRIB_VALUE_ENTITY_U: S++,
|
|
936
|
+
// <foo bar="
|
|
937
|
+
CLOSE_TAG: S++,
|
|
938
|
+
// </a
|
|
939
|
+
CLOSE_TAG_SAW_WHITE: S++,
|
|
940
|
+
// </a >
|
|
941
|
+
SCRIPT: S++,
|
|
942
|
+
// <script> ...
|
|
943
|
+
SCRIPT_ENDING: S++
|
|
944
|
+
// <script> ... <
|
|
945
|
+
};
|
|
946
|
+
sax2.XML_ENTITIES = {
|
|
947
|
+
"amp": "&",
|
|
948
|
+
"gt": ">",
|
|
949
|
+
"lt": "<",
|
|
950
|
+
"quot": '"',
|
|
951
|
+
"apos": "'"
|
|
952
|
+
};
|
|
953
|
+
sax2.ENTITIES = {
|
|
954
|
+
"amp": "&",
|
|
955
|
+
"gt": ">",
|
|
956
|
+
"lt": "<",
|
|
957
|
+
"quot": '"',
|
|
958
|
+
"apos": "'",
|
|
959
|
+
"AElig": 198,
|
|
960
|
+
"Aacute": 193,
|
|
961
|
+
"Acirc": 194,
|
|
962
|
+
"Agrave": 192,
|
|
963
|
+
"Aring": 197,
|
|
964
|
+
"Atilde": 195,
|
|
965
|
+
"Auml": 196,
|
|
966
|
+
"Ccedil": 199,
|
|
967
|
+
"ETH": 208,
|
|
968
|
+
"Eacute": 201,
|
|
969
|
+
"Ecirc": 202,
|
|
970
|
+
"Egrave": 200,
|
|
971
|
+
"Euml": 203,
|
|
972
|
+
"Iacute": 205,
|
|
973
|
+
"Icirc": 206,
|
|
974
|
+
"Igrave": 204,
|
|
975
|
+
"Iuml": 207,
|
|
976
|
+
"Ntilde": 209,
|
|
977
|
+
"Oacute": 211,
|
|
978
|
+
"Ocirc": 212,
|
|
979
|
+
"Ograve": 210,
|
|
980
|
+
"Oslash": 216,
|
|
981
|
+
"Otilde": 213,
|
|
982
|
+
"Ouml": 214,
|
|
983
|
+
"THORN": 222,
|
|
984
|
+
"Uacute": 218,
|
|
985
|
+
"Ucirc": 219,
|
|
986
|
+
"Ugrave": 217,
|
|
987
|
+
"Uuml": 220,
|
|
988
|
+
"Yacute": 221,
|
|
989
|
+
"aacute": 225,
|
|
990
|
+
"acirc": 226,
|
|
991
|
+
"aelig": 230,
|
|
992
|
+
"agrave": 224,
|
|
993
|
+
"aring": 229,
|
|
994
|
+
"atilde": 227,
|
|
995
|
+
"auml": 228,
|
|
996
|
+
"ccedil": 231,
|
|
997
|
+
"eacute": 233,
|
|
998
|
+
"ecirc": 234,
|
|
999
|
+
"egrave": 232,
|
|
1000
|
+
"eth": 240,
|
|
1001
|
+
"euml": 235,
|
|
1002
|
+
"iacute": 237,
|
|
1003
|
+
"icirc": 238,
|
|
1004
|
+
"igrave": 236,
|
|
1005
|
+
"iuml": 239,
|
|
1006
|
+
"ntilde": 241,
|
|
1007
|
+
"oacute": 243,
|
|
1008
|
+
"ocirc": 244,
|
|
1009
|
+
"ograve": 242,
|
|
1010
|
+
"oslash": 248,
|
|
1011
|
+
"otilde": 245,
|
|
1012
|
+
"ouml": 246,
|
|
1013
|
+
"szlig": 223,
|
|
1014
|
+
"thorn": 254,
|
|
1015
|
+
"uacute": 250,
|
|
1016
|
+
"ucirc": 251,
|
|
1017
|
+
"ugrave": 249,
|
|
1018
|
+
"uuml": 252,
|
|
1019
|
+
"yacute": 253,
|
|
1020
|
+
"yuml": 255,
|
|
1021
|
+
"copy": 169,
|
|
1022
|
+
"reg": 174,
|
|
1023
|
+
"nbsp": 160,
|
|
1024
|
+
"iexcl": 161,
|
|
1025
|
+
"cent": 162,
|
|
1026
|
+
"pound": 163,
|
|
1027
|
+
"curren": 164,
|
|
1028
|
+
"yen": 165,
|
|
1029
|
+
"brvbar": 166,
|
|
1030
|
+
"sect": 167,
|
|
1031
|
+
"uml": 168,
|
|
1032
|
+
"ordf": 170,
|
|
1033
|
+
"laquo": 171,
|
|
1034
|
+
"not": 172,
|
|
1035
|
+
"shy": 173,
|
|
1036
|
+
"macr": 175,
|
|
1037
|
+
"deg": 176,
|
|
1038
|
+
"plusmn": 177,
|
|
1039
|
+
"sup1": 185,
|
|
1040
|
+
"sup2": 178,
|
|
1041
|
+
"sup3": 179,
|
|
1042
|
+
"acute": 180,
|
|
1043
|
+
"micro": 181,
|
|
1044
|
+
"para": 182,
|
|
1045
|
+
"middot": 183,
|
|
1046
|
+
"cedil": 184,
|
|
1047
|
+
"ordm": 186,
|
|
1048
|
+
"raquo": 187,
|
|
1049
|
+
"frac14": 188,
|
|
1050
|
+
"frac12": 189,
|
|
1051
|
+
"frac34": 190,
|
|
1052
|
+
"iquest": 191,
|
|
1053
|
+
"times": 215,
|
|
1054
|
+
"divide": 247,
|
|
1055
|
+
"OElig": 338,
|
|
1056
|
+
"oelig": 339,
|
|
1057
|
+
"Scaron": 352,
|
|
1058
|
+
"scaron": 353,
|
|
1059
|
+
"Yuml": 376,
|
|
1060
|
+
"fnof": 402,
|
|
1061
|
+
"circ": 710,
|
|
1062
|
+
"tilde": 732,
|
|
1063
|
+
"Alpha": 913,
|
|
1064
|
+
"Beta": 914,
|
|
1065
|
+
"Gamma": 915,
|
|
1066
|
+
"Delta": 916,
|
|
1067
|
+
"Epsilon": 917,
|
|
1068
|
+
"Zeta": 918,
|
|
1069
|
+
"Eta": 919,
|
|
1070
|
+
"Theta": 920,
|
|
1071
|
+
"Iota": 921,
|
|
1072
|
+
"Kappa": 922,
|
|
1073
|
+
"Lambda": 923,
|
|
1074
|
+
"Mu": 924,
|
|
1075
|
+
"Nu": 925,
|
|
1076
|
+
"Xi": 926,
|
|
1077
|
+
"Omicron": 927,
|
|
1078
|
+
"Pi": 928,
|
|
1079
|
+
"Rho": 929,
|
|
1080
|
+
"Sigma": 931,
|
|
1081
|
+
"Tau": 932,
|
|
1082
|
+
"Upsilon": 933,
|
|
1083
|
+
"Phi": 934,
|
|
1084
|
+
"Chi": 935,
|
|
1085
|
+
"Psi": 936,
|
|
1086
|
+
"Omega": 937,
|
|
1087
|
+
"alpha": 945,
|
|
1088
|
+
"beta": 946,
|
|
1089
|
+
"gamma": 947,
|
|
1090
|
+
"delta": 948,
|
|
1091
|
+
"epsilon": 949,
|
|
1092
|
+
"zeta": 950,
|
|
1093
|
+
"eta": 951,
|
|
1094
|
+
"theta": 952,
|
|
1095
|
+
"iota": 953,
|
|
1096
|
+
"kappa": 954,
|
|
1097
|
+
"lambda": 955,
|
|
1098
|
+
"mu": 956,
|
|
1099
|
+
"nu": 957,
|
|
1100
|
+
"xi": 958,
|
|
1101
|
+
"omicron": 959,
|
|
1102
|
+
"pi": 960,
|
|
1103
|
+
"rho": 961,
|
|
1104
|
+
"sigmaf": 962,
|
|
1105
|
+
"sigma": 963,
|
|
1106
|
+
"tau": 964,
|
|
1107
|
+
"upsilon": 965,
|
|
1108
|
+
"phi": 966,
|
|
1109
|
+
"chi": 967,
|
|
1110
|
+
"psi": 968,
|
|
1111
|
+
"omega": 969,
|
|
1112
|
+
"thetasym": 977,
|
|
1113
|
+
"upsih": 978,
|
|
1114
|
+
"piv": 982,
|
|
1115
|
+
"ensp": 8194,
|
|
1116
|
+
"emsp": 8195,
|
|
1117
|
+
"thinsp": 8201,
|
|
1118
|
+
"zwnj": 8204,
|
|
1119
|
+
"zwj": 8205,
|
|
1120
|
+
"lrm": 8206,
|
|
1121
|
+
"rlm": 8207,
|
|
1122
|
+
"ndash": 8211,
|
|
1123
|
+
"mdash": 8212,
|
|
1124
|
+
"lsquo": 8216,
|
|
1125
|
+
"rsquo": 8217,
|
|
1126
|
+
"sbquo": 8218,
|
|
1127
|
+
"ldquo": 8220,
|
|
1128
|
+
"rdquo": 8221,
|
|
1129
|
+
"bdquo": 8222,
|
|
1130
|
+
"dagger": 8224,
|
|
1131
|
+
"Dagger": 8225,
|
|
1132
|
+
"bull": 8226,
|
|
1133
|
+
"hellip": 8230,
|
|
1134
|
+
"permil": 8240,
|
|
1135
|
+
"prime": 8242,
|
|
1136
|
+
"Prime": 8243,
|
|
1137
|
+
"lsaquo": 8249,
|
|
1138
|
+
"rsaquo": 8250,
|
|
1139
|
+
"oline": 8254,
|
|
1140
|
+
"frasl": 8260,
|
|
1141
|
+
"euro": 8364,
|
|
1142
|
+
"image": 8465,
|
|
1143
|
+
"weierp": 8472,
|
|
1144
|
+
"real": 8476,
|
|
1145
|
+
"trade": 8482,
|
|
1146
|
+
"alefsym": 8501,
|
|
1147
|
+
"larr": 8592,
|
|
1148
|
+
"uarr": 8593,
|
|
1149
|
+
"rarr": 8594,
|
|
1150
|
+
"darr": 8595,
|
|
1151
|
+
"harr": 8596,
|
|
1152
|
+
"crarr": 8629,
|
|
1153
|
+
"lArr": 8656,
|
|
1154
|
+
"uArr": 8657,
|
|
1155
|
+
"rArr": 8658,
|
|
1156
|
+
"dArr": 8659,
|
|
1157
|
+
"hArr": 8660,
|
|
1158
|
+
"forall": 8704,
|
|
1159
|
+
"part": 8706,
|
|
1160
|
+
"exist": 8707,
|
|
1161
|
+
"empty": 8709,
|
|
1162
|
+
"nabla": 8711,
|
|
1163
|
+
"isin": 8712,
|
|
1164
|
+
"notin": 8713,
|
|
1165
|
+
"ni": 8715,
|
|
1166
|
+
"prod": 8719,
|
|
1167
|
+
"sum": 8721,
|
|
1168
|
+
"minus": 8722,
|
|
1169
|
+
"lowast": 8727,
|
|
1170
|
+
"radic": 8730,
|
|
1171
|
+
"prop": 8733,
|
|
1172
|
+
"infin": 8734,
|
|
1173
|
+
"ang": 8736,
|
|
1174
|
+
"and": 8743,
|
|
1175
|
+
"or": 8744,
|
|
1176
|
+
"cap": 8745,
|
|
1177
|
+
"cup": 8746,
|
|
1178
|
+
"int": 8747,
|
|
1179
|
+
"there4": 8756,
|
|
1180
|
+
"sim": 8764,
|
|
1181
|
+
"cong": 8773,
|
|
1182
|
+
"asymp": 8776,
|
|
1183
|
+
"ne": 8800,
|
|
1184
|
+
"equiv": 8801,
|
|
1185
|
+
"le": 8804,
|
|
1186
|
+
"ge": 8805,
|
|
1187
|
+
"sub": 8834,
|
|
1188
|
+
"sup": 8835,
|
|
1189
|
+
"nsub": 8836,
|
|
1190
|
+
"sube": 8838,
|
|
1191
|
+
"supe": 8839,
|
|
1192
|
+
"oplus": 8853,
|
|
1193
|
+
"otimes": 8855,
|
|
1194
|
+
"perp": 8869,
|
|
1195
|
+
"sdot": 8901,
|
|
1196
|
+
"lceil": 8968,
|
|
1197
|
+
"rceil": 8969,
|
|
1198
|
+
"lfloor": 8970,
|
|
1199
|
+
"rfloor": 8971,
|
|
1200
|
+
"lang": 9001,
|
|
1201
|
+
"rang": 9002,
|
|
1202
|
+
"loz": 9674,
|
|
1203
|
+
"spades": 9824,
|
|
1204
|
+
"clubs": 9827,
|
|
1205
|
+
"hearts": 9829,
|
|
1206
|
+
"diams": 9830
|
|
1207
|
+
};
|
|
1208
|
+
Object.keys(sax2.ENTITIES).forEach(function(key) {
|
|
1209
|
+
var e2 = sax2.ENTITIES[key];
|
|
1210
|
+
var s3 = typeof e2 === "number" ? String.fromCharCode(e2) : e2;
|
|
1211
|
+
sax2.ENTITIES[key] = s3;
|
|
1212
|
+
});
|
|
1213
|
+
for (var s2 in sax2.STATE) {
|
|
1214
|
+
sax2.STATE[sax2.STATE[s2]] = s2;
|
|
848
1215
|
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
}
|
|
853
|
-
const doubleQuote = '"';
|
|
854
|
-
const singleQuote = "'";
|
|
855
|
-
function readAttributeStr(xmlData, i2) {
|
|
856
|
-
let attrStr = "";
|
|
857
|
-
let startChar = "";
|
|
858
|
-
let tagClosed = false;
|
|
859
|
-
for (; i2 < xmlData.length; i2++) {
|
|
860
|
-
if (xmlData[i2] === doubleQuote || xmlData[i2] === singleQuote) {
|
|
861
|
-
if (startChar === "") {
|
|
862
|
-
startChar = xmlData[i2];
|
|
863
|
-
} else if (startChar !== xmlData[i2]) ;
|
|
864
|
-
else {
|
|
865
|
-
startChar = "";
|
|
1216
|
+
S = sax2.STATE;
|
|
1217
|
+
function emit2(parser, event, data) {
|
|
1218
|
+
parser[event] && parser[event](data);
|
|
866
1219
|
}
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
break;
|
|
1220
|
+
function emitNode(parser, nodeType, data) {
|
|
1221
|
+
if (parser.textNode) closeText(parser);
|
|
1222
|
+
emit2(parser, nodeType, data);
|
|
871
1223
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
const matches = util$2.getAllMatches(attrStr, validAttrStrRegxp);
|
|
887
|
-
const attrNames = {};
|
|
888
|
-
for (let i2 = 0; i2 < matches.length; i2++) {
|
|
889
|
-
if (matches[i2][1].length === 0) {
|
|
890
|
-
return getErrorObject("InvalidAttr", "Attribute '" + matches[i2][2] + "' has no space in starting.", getPositionFromMatch(matches[i2]));
|
|
891
|
-
} else if (matches[i2][3] !== void 0 && matches[i2][4] === void 0) {
|
|
892
|
-
return getErrorObject("InvalidAttr", "Attribute '" + matches[i2][2] + "' is without value.", getPositionFromMatch(matches[i2]));
|
|
893
|
-
} else if (matches[i2][3] === void 0 && !options.allowBooleanAttributes) {
|
|
894
|
-
return getErrorObject("InvalidAttr", "boolean attribute '" + matches[i2][2] + "' is not allowed.", getPositionFromMatch(matches[i2]));
|
|
895
|
-
}
|
|
896
|
-
const attrName = matches[i2][2];
|
|
897
|
-
if (!validateAttrName(attrName)) {
|
|
898
|
-
return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is an invalid name.", getPositionFromMatch(matches[i2]));
|
|
899
|
-
}
|
|
900
|
-
if (!attrNames.hasOwnProperty(attrName)) {
|
|
901
|
-
attrNames[attrName] = 1;
|
|
902
|
-
} else {
|
|
903
|
-
return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is repeated.", getPositionFromMatch(matches[i2]));
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
return true;
|
|
907
|
-
}
|
|
908
|
-
function validateNumberAmpersand(xmlData, i2) {
|
|
909
|
-
let re2 = /\d/;
|
|
910
|
-
if (xmlData[i2] === "x") {
|
|
911
|
-
i2++;
|
|
912
|
-
re2 = /[\da-fA-F]/;
|
|
913
|
-
}
|
|
914
|
-
for (; i2 < xmlData.length; i2++) {
|
|
915
|
-
if (xmlData[i2] === ";")
|
|
916
|
-
return i2;
|
|
917
|
-
if (!xmlData[i2].match(re2))
|
|
918
|
-
break;
|
|
919
|
-
}
|
|
920
|
-
return -1;
|
|
921
|
-
}
|
|
922
|
-
function validateAmpersand(xmlData, i2) {
|
|
923
|
-
i2++;
|
|
924
|
-
if (xmlData[i2] === ";")
|
|
925
|
-
return -1;
|
|
926
|
-
if (xmlData[i2] === "#") {
|
|
927
|
-
i2++;
|
|
928
|
-
return validateNumberAmpersand(xmlData, i2);
|
|
929
|
-
}
|
|
930
|
-
let count = 0;
|
|
931
|
-
for (; i2 < xmlData.length; i2++, count++) {
|
|
932
|
-
if (xmlData[i2].match(/\w/) && count < 20)
|
|
933
|
-
continue;
|
|
934
|
-
if (xmlData[i2] === ";")
|
|
935
|
-
break;
|
|
936
|
-
return -1;
|
|
937
|
-
}
|
|
938
|
-
return i2;
|
|
939
|
-
}
|
|
940
|
-
function getErrorObject(code, message, lineNumber) {
|
|
941
|
-
return {
|
|
942
|
-
err: {
|
|
943
|
-
code,
|
|
944
|
-
msg: message,
|
|
945
|
-
line: lineNumber.line || lineNumber,
|
|
946
|
-
col: lineNumber.col
|
|
947
|
-
}
|
|
948
|
-
};
|
|
949
|
-
}
|
|
950
|
-
function validateAttrName(attrName) {
|
|
951
|
-
return util$2.isName(attrName);
|
|
952
|
-
}
|
|
953
|
-
function validateTagName(tagname) {
|
|
954
|
-
return util$2.isName(tagname);
|
|
955
|
-
}
|
|
956
|
-
function getLineNumberForPosition(xmlData, index) {
|
|
957
|
-
const lines = xmlData.substring(0, index).split(/\r?\n/);
|
|
958
|
-
return {
|
|
959
|
-
line: lines.length,
|
|
960
|
-
// column number is last line's length + 1, because column numbering starts at 1:
|
|
961
|
-
col: lines[lines.length - 1].length + 1
|
|
962
|
-
};
|
|
963
|
-
}
|
|
964
|
-
function getPositionFromMatch(match) {
|
|
965
|
-
return match.startIndex + match[1].length;
|
|
966
|
-
}
|
|
967
|
-
var OptionsBuilder = {};
|
|
968
|
-
const defaultOptions$1 = {
|
|
969
|
-
preserveOrder: false,
|
|
970
|
-
attributeNamePrefix: "@_",
|
|
971
|
-
attributesGroupName: false,
|
|
972
|
-
textNodeName: "#text",
|
|
973
|
-
ignoreAttributes: true,
|
|
974
|
-
removeNSPrefix: false,
|
|
975
|
-
// remove NS from tag name or attribute name if true
|
|
976
|
-
allowBooleanAttributes: false,
|
|
977
|
-
//a tag can have attributes without any value
|
|
978
|
-
//ignoreRootElement : false,
|
|
979
|
-
parseTagValue: true,
|
|
980
|
-
parseAttributeValue: false,
|
|
981
|
-
trimValues: true,
|
|
982
|
-
//Trim string values of tag and attributes
|
|
983
|
-
cdataPropName: false,
|
|
984
|
-
numberParseOptions: {
|
|
985
|
-
hex: true,
|
|
986
|
-
leadingZeros: true,
|
|
987
|
-
eNotation: true
|
|
988
|
-
},
|
|
989
|
-
tagValueProcessor: function(tagName, val2) {
|
|
990
|
-
return val2;
|
|
991
|
-
},
|
|
992
|
-
attributeValueProcessor: function(attrName, val2) {
|
|
993
|
-
return val2;
|
|
994
|
-
},
|
|
995
|
-
stopNodes: [],
|
|
996
|
-
//nested tags will not be parsed even for errors
|
|
997
|
-
alwaysCreateTextNode: false,
|
|
998
|
-
isArray: () => false,
|
|
999
|
-
commentPropName: false,
|
|
1000
|
-
unpairedTags: [],
|
|
1001
|
-
processEntities: true,
|
|
1002
|
-
htmlEntities: false,
|
|
1003
|
-
ignoreDeclaration: false,
|
|
1004
|
-
ignorePiTags: false,
|
|
1005
|
-
transformTagName: false,
|
|
1006
|
-
transformAttributeName: false,
|
|
1007
|
-
updateTag: function(tagName, jPath, attrs) {
|
|
1008
|
-
return tagName;
|
|
1009
|
-
}
|
|
1010
|
-
// skipEmptyListItem: false
|
|
1011
|
-
};
|
|
1012
|
-
const buildOptions$1 = function(options) {
|
|
1013
|
-
return Object.assign({}, defaultOptions$1, options);
|
|
1014
|
-
};
|
|
1015
|
-
OptionsBuilder.buildOptions = buildOptions$1;
|
|
1016
|
-
OptionsBuilder.defaultOptions = defaultOptions$1;
|
|
1017
|
-
class XmlNode {
|
|
1018
|
-
constructor(tagname) {
|
|
1019
|
-
this.tagname = tagname;
|
|
1020
|
-
this.child = [];
|
|
1021
|
-
this[":@"] = {};
|
|
1022
|
-
}
|
|
1023
|
-
add(key, val2) {
|
|
1024
|
-
if (key === "__proto__") key = "#__proto__";
|
|
1025
|
-
this.child.push({ [key]: val2 });
|
|
1026
|
-
}
|
|
1027
|
-
addChild(node) {
|
|
1028
|
-
if (node.tagname === "__proto__") node.tagname = "#__proto__";
|
|
1029
|
-
if (node[":@"] && Object.keys(node[":@"]).length > 0) {
|
|
1030
|
-
this.child.push({ [node.tagname]: node.child, [":@"]: node[":@"] });
|
|
1031
|
-
} else {
|
|
1032
|
-
this.child.push({ [node.tagname]: node.child });
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
var xmlNode$1 = XmlNode;
|
|
1037
|
-
const util$1 = util$3;
|
|
1038
|
-
function readDocType$1(xmlData, i2) {
|
|
1039
|
-
const entities = {};
|
|
1040
|
-
if (xmlData[i2 + 3] === "O" && xmlData[i2 + 4] === "C" && xmlData[i2 + 5] === "T" && xmlData[i2 + 6] === "Y" && xmlData[i2 + 7] === "P" && xmlData[i2 + 8] === "E") {
|
|
1041
|
-
i2 = i2 + 9;
|
|
1042
|
-
let angleBracketsCount = 1;
|
|
1043
|
-
let hasBody = false, comment = false;
|
|
1044
|
-
let exp = "";
|
|
1045
|
-
for (; i2 < xmlData.length; i2++) {
|
|
1046
|
-
if (xmlData[i2] === "<" && !comment) {
|
|
1047
|
-
if (hasBody && isEntity(xmlData, i2)) {
|
|
1048
|
-
i2 += 7;
|
|
1049
|
-
[entityName, val, i2] = readEntityExp(xmlData, i2 + 1);
|
|
1050
|
-
if (val.indexOf("&") === -1)
|
|
1051
|
-
entities[validateEntityName(entityName)] = {
|
|
1052
|
-
regx: RegExp(`&${entityName};`, "g"),
|
|
1053
|
-
val
|
|
1054
|
-
};
|
|
1055
|
-
} else if (hasBody && isElement(xmlData, i2)) i2 += 8;
|
|
1056
|
-
else if (hasBody && isAttlist(xmlData, i2)) i2 += 8;
|
|
1057
|
-
else if (hasBody && isNotation(xmlData, i2)) i2 += 9;
|
|
1058
|
-
else if (isComment) comment = true;
|
|
1059
|
-
else throw new Error("Invalid DOCTYPE");
|
|
1060
|
-
angleBracketsCount++;
|
|
1061
|
-
exp = "";
|
|
1062
|
-
} else if (xmlData[i2] === ">") {
|
|
1063
|
-
if (comment) {
|
|
1064
|
-
if (xmlData[i2 - 1] === "-" && xmlData[i2 - 2] === "-") {
|
|
1065
|
-
comment = false;
|
|
1066
|
-
angleBracketsCount--;
|
|
1067
|
-
}
|
|
1068
|
-
} else {
|
|
1069
|
-
angleBracketsCount--;
|
|
1224
|
+
function closeText(parser) {
|
|
1225
|
+
parser.textNode = textopts(parser.opt, parser.textNode);
|
|
1226
|
+
if (parser.textNode) emit2(parser, "ontext", parser.textNode);
|
|
1227
|
+
parser.textNode = "";
|
|
1228
|
+
}
|
|
1229
|
+
function textopts(opt, text) {
|
|
1230
|
+
if (opt.trim) text = text.trim();
|
|
1231
|
+
if (opt.normalize) text = text.replace(/\s+/g, " ");
|
|
1232
|
+
return text;
|
|
1233
|
+
}
|
|
1234
|
+
function error(parser, er) {
|
|
1235
|
+
closeText(parser);
|
|
1236
|
+
if (parser.trackPosition) {
|
|
1237
|
+
er += "\nLine: " + parser.line + "\nColumn: " + parser.column + "\nChar: " + parser.c;
|
|
1070
1238
|
}
|
|
1071
|
-
|
|
1072
|
-
|
|
1239
|
+
er = new Error(er);
|
|
1240
|
+
parser.error = er;
|
|
1241
|
+
emit2(parser, "onerror", er);
|
|
1242
|
+
return parser;
|
|
1243
|
+
}
|
|
1244
|
+
function end(parser) {
|
|
1245
|
+
if (parser.sawRoot && !parser.closedRoot) strictFail(parser, "Unclosed root tag");
|
|
1246
|
+
if (parser.state !== S.BEGIN && parser.state !== S.BEGIN_WHITESPACE && parser.state !== S.TEXT) {
|
|
1247
|
+
error(parser, "Unexpected end");
|
|
1073
1248
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1249
|
+
closeText(parser);
|
|
1250
|
+
parser.c = "";
|
|
1251
|
+
parser.closed = true;
|
|
1252
|
+
emit2(parser, "onend");
|
|
1253
|
+
SAXParser.call(parser, parser.strict, parser.opt);
|
|
1254
|
+
return parser;
|
|
1078
1255
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
}
|
|
1083
|
-
} else {
|
|
1084
|
-
throw new Error(`Invalid Tag instead of DOCTYPE`);
|
|
1085
|
-
}
|
|
1086
|
-
return { entities, i: i2 };
|
|
1087
|
-
}
|
|
1088
|
-
function readEntityExp(xmlData, i2) {
|
|
1089
|
-
let entityName2 = "";
|
|
1090
|
-
for (; i2 < xmlData.length && (xmlData[i2] !== "'" && xmlData[i2] !== '"'); i2++) {
|
|
1091
|
-
entityName2 += xmlData[i2];
|
|
1092
|
-
}
|
|
1093
|
-
entityName2 = entityName2.trim();
|
|
1094
|
-
if (entityName2.indexOf(" ") !== -1) throw new Error("External entites are not supported");
|
|
1095
|
-
const startChar = xmlData[i2++];
|
|
1096
|
-
let val2 = "";
|
|
1097
|
-
for (; i2 < xmlData.length && xmlData[i2] !== startChar; i2++) {
|
|
1098
|
-
val2 += xmlData[i2];
|
|
1099
|
-
}
|
|
1100
|
-
return [entityName2, val2, i2];
|
|
1101
|
-
}
|
|
1102
|
-
function isComment(xmlData, i2) {
|
|
1103
|
-
if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "-" && xmlData[i2 + 3] === "-") return true;
|
|
1104
|
-
return false;
|
|
1105
|
-
}
|
|
1106
|
-
function isEntity(xmlData, i2) {
|
|
1107
|
-
if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "E" && xmlData[i2 + 3] === "N" && xmlData[i2 + 4] === "T" && xmlData[i2 + 5] === "I" && xmlData[i2 + 6] === "T" && xmlData[i2 + 7] === "Y") return true;
|
|
1108
|
-
return false;
|
|
1109
|
-
}
|
|
1110
|
-
function isElement(xmlData, i2) {
|
|
1111
|
-
if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "E" && xmlData[i2 + 3] === "L" && xmlData[i2 + 4] === "E" && xmlData[i2 + 5] === "M" && xmlData[i2 + 6] === "E" && xmlData[i2 + 7] === "N" && xmlData[i2 + 8] === "T") return true;
|
|
1112
|
-
return false;
|
|
1113
|
-
}
|
|
1114
|
-
function isAttlist(xmlData, i2) {
|
|
1115
|
-
if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "A" && xmlData[i2 + 3] === "T" && xmlData[i2 + 4] === "T" && xmlData[i2 + 5] === "L" && xmlData[i2 + 6] === "I" && xmlData[i2 + 7] === "S" && xmlData[i2 + 8] === "T") return true;
|
|
1116
|
-
return false;
|
|
1117
|
-
}
|
|
1118
|
-
function isNotation(xmlData, i2) {
|
|
1119
|
-
if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "N" && xmlData[i2 + 3] === "O" && xmlData[i2 + 4] === "T" && xmlData[i2 + 5] === "A" && xmlData[i2 + 6] === "T" && xmlData[i2 + 7] === "I" && xmlData[i2 + 8] === "O" && xmlData[i2 + 9] === "N") return true;
|
|
1120
|
-
return false;
|
|
1121
|
-
}
|
|
1122
|
-
function validateEntityName(name) {
|
|
1123
|
-
if (util$1.isName(name))
|
|
1124
|
-
return name;
|
|
1125
|
-
else
|
|
1126
|
-
throw new Error(`Invalid entity name ${name}`);
|
|
1127
|
-
}
|
|
1128
|
-
var DocTypeReader = readDocType$1;
|
|
1129
|
-
const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
|
|
1130
|
-
const numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
|
|
1131
|
-
if (!Number.parseInt && window.parseInt) {
|
|
1132
|
-
Number.parseInt = window.parseInt;
|
|
1133
|
-
}
|
|
1134
|
-
if (!Number.parseFloat && window.parseFloat) {
|
|
1135
|
-
Number.parseFloat = window.parseFloat;
|
|
1136
|
-
}
|
|
1137
|
-
const consider = {
|
|
1138
|
-
hex: true,
|
|
1139
|
-
leadingZeros: true,
|
|
1140
|
-
decimalPoint: ".",
|
|
1141
|
-
eNotation: true
|
|
1142
|
-
//skipLike: /regex/
|
|
1143
|
-
};
|
|
1144
|
-
function toNumber$1(str, options = {}) {
|
|
1145
|
-
options = Object.assign({}, consider, options);
|
|
1146
|
-
if (!str || typeof str !== "string") return str;
|
|
1147
|
-
let trimmedStr = str.trim();
|
|
1148
|
-
if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str;
|
|
1149
|
-
else if (options.hex && hexRegex.test(trimmedStr)) {
|
|
1150
|
-
return Number.parseInt(trimmedStr, 16);
|
|
1151
|
-
} else {
|
|
1152
|
-
const match = numRegex.exec(trimmedStr);
|
|
1153
|
-
if (match) {
|
|
1154
|
-
const sign = match[1];
|
|
1155
|
-
const leadingZeros = match[2];
|
|
1156
|
-
let numTrimmedByZeros = trimZeros(match[3]);
|
|
1157
|
-
const eNotation = match[4] || match[6];
|
|
1158
|
-
if (!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str;
|
|
1159
|
-
else if (!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str;
|
|
1160
|
-
else {
|
|
1161
|
-
const num = Number(trimmedStr);
|
|
1162
|
-
const numStr = "" + num;
|
|
1163
|
-
if (numStr.search(/[eE]/) !== -1) {
|
|
1164
|
-
if (options.eNotation) return num;
|
|
1165
|
-
else return str;
|
|
1166
|
-
} else if (eNotation) {
|
|
1167
|
-
if (options.eNotation) return num;
|
|
1168
|
-
else return str;
|
|
1169
|
-
} else if (trimmedStr.indexOf(".") !== -1) {
|
|
1170
|
-
if (numStr === "0" && numTrimmedByZeros === "") return num;
|
|
1171
|
-
else if (numStr === numTrimmedByZeros) return num;
|
|
1172
|
-
else if (sign && numStr === "-" + numTrimmedByZeros) return num;
|
|
1173
|
-
else return str;
|
|
1256
|
+
function strictFail(parser, message) {
|
|
1257
|
+
if (typeof parser !== "object" || !(parser instanceof SAXParser)) {
|
|
1258
|
+
throw new Error("bad call to strictFail");
|
|
1174
1259
|
}
|
|
1175
|
-
if (
|
|
1176
|
-
|
|
1177
|
-
else if (sign + numTrimmedByZeros === numStr) return num;
|
|
1178
|
-
else return str;
|
|
1260
|
+
if (parser.strict) {
|
|
1261
|
+
error(parser, message);
|
|
1179
1262
|
}
|
|
1180
|
-
if (trimmedStr === numStr) return num;
|
|
1181
|
-
else if (trimmedStr === sign + numStr) return num;
|
|
1182
|
-
return str;
|
|
1183
1263
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
if (numStr && numStr.indexOf(".") !== -1) {
|
|
1191
|
-
numStr = numStr.replace(/0+$/, "");
|
|
1192
|
-
if (numStr === ".") numStr = "0";
|
|
1193
|
-
else if (numStr[0] === ".") numStr = "0" + numStr;
|
|
1194
|
-
else if (numStr[numStr.length - 1] === ".") numStr = numStr.substr(0, numStr.length - 1);
|
|
1195
|
-
return numStr;
|
|
1196
|
-
}
|
|
1197
|
-
return numStr;
|
|
1198
|
-
}
|
|
1199
|
-
var strnum = toNumber$1;
|
|
1200
|
-
function getIgnoreAttributesFn$2(ignoreAttributes2) {
|
|
1201
|
-
if (typeof ignoreAttributes2 === "function") {
|
|
1202
|
-
return ignoreAttributes2;
|
|
1203
|
-
}
|
|
1204
|
-
if (Array.isArray(ignoreAttributes2)) {
|
|
1205
|
-
return (attrName) => {
|
|
1206
|
-
for (const pattern of ignoreAttributes2) {
|
|
1207
|
-
if (typeof pattern === "string" && attrName === pattern) {
|
|
1208
|
-
return true;
|
|
1264
|
+
function newTag(parser) {
|
|
1265
|
+
if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]();
|
|
1266
|
+
var parent = parser.tags[parser.tags.length - 1] || parser;
|
|
1267
|
+
var tag = parser.tag = { name: parser.tagName, attributes: {} };
|
|
1268
|
+
if (parser.opt.xmlns) {
|
|
1269
|
+
tag.ns = parent.ns;
|
|
1209
1270
|
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1271
|
+
parser.attribList.length = 0;
|
|
1272
|
+
emitNode(parser, "onopentagstart", tag);
|
|
1273
|
+
}
|
|
1274
|
+
function qname(name, attribute) {
|
|
1275
|
+
var i2 = name.indexOf(":");
|
|
1276
|
+
var qualName = i2 < 0 ? ["", name] : name.split(":");
|
|
1277
|
+
var prefix = qualName[0];
|
|
1278
|
+
var local = qualName[1];
|
|
1279
|
+
if (attribute && name === "xmlns") {
|
|
1280
|
+
prefix = "xmlns";
|
|
1281
|
+
local = "";
|
|
1212
1282
|
}
|
|
1283
|
+
return { prefix, local };
|
|
1213
1284
|
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
"euro": { regex: /&(euro|#8364);/g, val: "€" },
|
|
1248
|
-
"copyright": { regex: /&(copy|#169);/g, val: "©" },
|
|
1249
|
-
"reg": { regex: /&(reg|#174);/g, val: "®" },
|
|
1250
|
-
"inr": { regex: /&(inr|#8377);/g, val: "₹" },
|
|
1251
|
-
"num_dec": { regex: /&#([0-9]{1,7});/g, val: (_, str) => String.fromCharCode(Number.parseInt(str, 10)) },
|
|
1252
|
-
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (_, str) => String.fromCharCode(Number.parseInt(str, 16)) }
|
|
1253
|
-
};
|
|
1254
|
-
this.addExternalEntities = addExternalEntities;
|
|
1255
|
-
this.parseXml = parseXml;
|
|
1256
|
-
this.parseTextData = parseTextData;
|
|
1257
|
-
this.resolveNameSpace = resolveNameSpace;
|
|
1258
|
-
this.buildAttributesMap = buildAttributesMap;
|
|
1259
|
-
this.isItStopNode = isItStopNode;
|
|
1260
|
-
this.replaceEntitiesValue = replaceEntitiesValue$1;
|
|
1261
|
-
this.readStopNodeData = readStopNodeData;
|
|
1262
|
-
this.saveTextToParentTag = saveTextToParentTag;
|
|
1263
|
-
this.addChild = addChild;
|
|
1264
|
-
this.ignoreAttributesFn = getIgnoreAttributesFn$1(this.options.ignoreAttributes);
|
|
1265
|
-
}
|
|
1266
|
-
};
|
|
1267
|
-
function addExternalEntities(externalEntities) {
|
|
1268
|
-
const entKeys = Object.keys(externalEntities);
|
|
1269
|
-
for (let i2 = 0; i2 < entKeys.length; i2++) {
|
|
1270
|
-
const ent = entKeys[i2];
|
|
1271
|
-
this.lastEntities[ent] = {
|
|
1272
|
-
regex: new RegExp("&" + ent + ";", "g"),
|
|
1273
|
-
val: externalEntities[ent]
|
|
1274
|
-
};
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
function parseTextData(val2, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
|
|
1278
|
-
if (val2 !== void 0) {
|
|
1279
|
-
if (this.options.trimValues && !dontTrim) {
|
|
1280
|
-
val2 = val2.trim();
|
|
1281
|
-
}
|
|
1282
|
-
if (val2.length > 0) {
|
|
1283
|
-
if (!escapeEntities) val2 = this.replaceEntitiesValue(val2);
|
|
1284
|
-
const newval = this.options.tagValueProcessor(tagName, val2, jPath, hasAttributes, isLeafNode);
|
|
1285
|
-
if (newval === null || newval === void 0) {
|
|
1286
|
-
return val2;
|
|
1287
|
-
} else if (typeof newval !== typeof val2 || newval !== val2) {
|
|
1288
|
-
return newval;
|
|
1289
|
-
} else if (this.options.trimValues) {
|
|
1290
|
-
return parseValue(val2, this.options.parseTagValue, this.options.numberParseOptions);
|
|
1291
|
-
} else {
|
|
1292
|
-
const trimmedVal = val2.trim();
|
|
1293
|
-
if (trimmedVal === val2) {
|
|
1294
|
-
return parseValue(val2, this.options.parseTagValue, this.options.numberParseOptions);
|
|
1285
|
+
function attrib(parser) {
|
|
1286
|
+
if (!parser.strict) {
|
|
1287
|
+
parser.attribName = parser.attribName[parser.looseCase]();
|
|
1288
|
+
}
|
|
1289
|
+
if (parser.attribList.indexOf(parser.attribName) !== -1 || parser.tag.attributes.hasOwnProperty(parser.attribName)) {
|
|
1290
|
+
parser.attribName = parser.attribValue = "";
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
if (parser.opt.xmlns) {
|
|
1294
|
+
var qn = qname(parser.attribName, true);
|
|
1295
|
+
var prefix = qn.prefix;
|
|
1296
|
+
var local = qn.local;
|
|
1297
|
+
if (prefix === "xmlns") {
|
|
1298
|
+
if (local === "xml" && parser.attribValue !== XML_NAMESPACE) {
|
|
1299
|
+
strictFail(
|
|
1300
|
+
parser,
|
|
1301
|
+
"xml: prefix must be bound to " + XML_NAMESPACE + "\nActual: " + parser.attribValue
|
|
1302
|
+
);
|
|
1303
|
+
} else if (local === "xmlns" && parser.attribValue !== XMLNS_NAMESPACE) {
|
|
1304
|
+
strictFail(
|
|
1305
|
+
parser,
|
|
1306
|
+
"xmlns: prefix must be bound to " + XMLNS_NAMESPACE + "\nActual: " + parser.attribValue
|
|
1307
|
+
);
|
|
1308
|
+
} else {
|
|
1309
|
+
var tag = parser.tag;
|
|
1310
|
+
var parent = parser.tags[parser.tags.length - 1] || parser;
|
|
1311
|
+
if (tag.ns === parent.ns) {
|
|
1312
|
+
tag.ns = Object.create(parent.ns);
|
|
1313
|
+
}
|
|
1314
|
+
tag.ns[local] = parser.attribValue;
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
parser.attribList.push([parser.attribName, parser.attribValue]);
|
|
1295
1318
|
} else {
|
|
1296
|
-
|
|
1319
|
+
parser.tag.attributes[parser.attribName] = parser.attribValue;
|
|
1320
|
+
emitNode(parser, "onattribute", {
|
|
1321
|
+
name: parser.attribName,
|
|
1322
|
+
value: parser.attribValue
|
|
1323
|
+
});
|
|
1297
1324
|
}
|
|
1325
|
+
parser.attribName = parser.attribValue = "";
|
|
1298
1326
|
}
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
if (tags.length === 2) {
|
|
1310
|
-
tagname = prefix + tags[1];
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
return tagname;
|
|
1314
|
-
}
|
|
1315
|
-
const attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
1316
|
-
function buildAttributesMap(attrStr, jPath, tagName) {
|
|
1317
|
-
if (this.options.ignoreAttributes !== true && typeof attrStr === "string") {
|
|
1318
|
-
const matches = util.getAllMatches(attrStr, attrsRegx);
|
|
1319
|
-
const len = matches.length;
|
|
1320
|
-
const attrs = {};
|
|
1321
|
-
for (let i2 = 0; i2 < len; i2++) {
|
|
1322
|
-
const attrName = this.resolveNameSpace(matches[i2][1]);
|
|
1323
|
-
if (this.ignoreAttributesFn(attrName, jPath)) {
|
|
1324
|
-
continue;
|
|
1325
|
-
}
|
|
1326
|
-
let oldVal = matches[i2][4];
|
|
1327
|
-
let aName = this.options.attributeNamePrefix + attrName;
|
|
1328
|
-
if (attrName.length) {
|
|
1329
|
-
if (this.options.transformAttributeName) {
|
|
1330
|
-
aName = this.options.transformAttributeName(aName);
|
|
1331
|
-
}
|
|
1332
|
-
if (aName === "__proto__") aName = "#__proto__";
|
|
1333
|
-
if (oldVal !== void 0) {
|
|
1334
|
-
if (this.options.trimValues) {
|
|
1335
|
-
oldVal = oldVal.trim();
|
|
1327
|
+
function openTag(parser, selfClosing) {
|
|
1328
|
+
if (parser.opt.xmlns) {
|
|
1329
|
+
var tag = parser.tag;
|
|
1330
|
+
var qn = qname(parser.tagName);
|
|
1331
|
+
tag.prefix = qn.prefix;
|
|
1332
|
+
tag.local = qn.local;
|
|
1333
|
+
tag.uri = tag.ns[qn.prefix] || "";
|
|
1334
|
+
if (tag.prefix && !tag.uri) {
|
|
1335
|
+
strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(parser.tagName));
|
|
1336
|
+
tag.uri = qn.prefix;
|
|
1336
1337
|
}
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1338
|
+
var parent = parser.tags[parser.tags.length - 1] || parser;
|
|
1339
|
+
if (tag.ns && parent.ns !== tag.ns) {
|
|
1340
|
+
Object.keys(tag.ns).forEach(function(p2) {
|
|
1341
|
+
emitNode(parser, "onopennamespace", {
|
|
1342
|
+
prefix: p2,
|
|
1343
|
+
uri: tag.ns[p2]
|
|
1344
|
+
});
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
for (var i2 = 0, l2 = parser.attribList.length; i2 < l2; i2++) {
|
|
1348
|
+
var nv = parser.attribList[i2];
|
|
1349
|
+
var name = nv[0];
|
|
1350
|
+
var value = nv[1];
|
|
1351
|
+
var qualName = qname(name, true);
|
|
1352
|
+
var prefix = qualName.prefix;
|
|
1353
|
+
var local = qualName.local;
|
|
1354
|
+
var uri = prefix === "" ? "" : tag.ns[prefix] || "";
|
|
1355
|
+
var a2 = {
|
|
1356
|
+
name,
|
|
1357
|
+
value,
|
|
1358
|
+
prefix,
|
|
1359
|
+
local,
|
|
1360
|
+
uri
|
|
1361
|
+
};
|
|
1362
|
+
if (prefix && prefix !== "xmlns" && !uri) {
|
|
1363
|
+
strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(prefix));
|
|
1364
|
+
a2.uri = prefix;
|
|
1365
|
+
}
|
|
1366
|
+
parser.tag.attributes[name] = a2;
|
|
1367
|
+
emitNode(parser, "onattribute", a2);
|
|
1368
|
+
}
|
|
1369
|
+
parser.attribList.length = 0;
|
|
1370
|
+
}
|
|
1371
|
+
parser.tag.isSelfClosing = !!selfClosing;
|
|
1372
|
+
parser.sawRoot = true;
|
|
1373
|
+
parser.tags.push(parser.tag);
|
|
1374
|
+
emitNode(parser, "onopentag", parser.tag);
|
|
1375
|
+
if (!selfClosing) {
|
|
1376
|
+
if (!parser.noscript && parser.tagName.toLowerCase() === "script") {
|
|
1377
|
+
parser.state = S.SCRIPT;
|
|
1343
1378
|
} else {
|
|
1344
|
-
|
|
1345
|
-
oldVal,
|
|
1346
|
-
this.options.parseAttributeValue,
|
|
1347
|
-
this.options.numberParseOptions
|
|
1348
|
-
);
|
|
1379
|
+
parser.state = S.TEXT;
|
|
1349
1380
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1381
|
+
parser.tag = null;
|
|
1382
|
+
parser.tagName = "";
|
|
1352
1383
|
}
|
|
1384
|
+
parser.attribName = parser.attribValue = "";
|
|
1385
|
+
parser.attribList.length = 0;
|
|
1353
1386
|
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
xmlData = xmlData.replace(/\r\n?/g, "\n");
|
|
1368
|
-
const xmlObj = new xmlNode("!xml");
|
|
1369
|
-
let currentNode = xmlObj;
|
|
1370
|
-
let textData = "";
|
|
1371
|
-
let jPath = "";
|
|
1372
|
-
for (let i2 = 0; i2 < xmlData.length; i2++) {
|
|
1373
|
-
const ch = xmlData[i2];
|
|
1374
|
-
if (ch === "<") {
|
|
1375
|
-
if (xmlData[i2 + 1] === "/") {
|
|
1376
|
-
const closeIndex = findClosingIndex(xmlData, ">", i2, "Closing Tag is not closed.");
|
|
1377
|
-
let tagName = xmlData.substring(i2 + 2, closeIndex).trim();
|
|
1378
|
-
if (this.options.removeNSPrefix) {
|
|
1379
|
-
const colonIndex = tagName.indexOf(":");
|
|
1380
|
-
if (colonIndex !== -1) {
|
|
1381
|
-
tagName = tagName.substr(colonIndex + 1);
|
|
1387
|
+
function closeTag(parser) {
|
|
1388
|
+
if (!parser.tagName) {
|
|
1389
|
+
strictFail(parser, "Weird empty close tag.");
|
|
1390
|
+
parser.textNode += "</>";
|
|
1391
|
+
parser.state = S.TEXT;
|
|
1392
|
+
return;
|
|
1393
|
+
}
|
|
1394
|
+
if (parser.script) {
|
|
1395
|
+
if (parser.tagName !== "script") {
|
|
1396
|
+
parser.script += "</" + parser.tagName + ">";
|
|
1397
|
+
parser.tagName = "";
|
|
1398
|
+
parser.state = S.SCRIPT;
|
|
1399
|
+
return;
|
|
1382
1400
|
}
|
|
1401
|
+
emitNode(parser, "onscript", parser.script);
|
|
1402
|
+
parser.script = "";
|
|
1383
1403
|
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1404
|
+
var t2 = parser.tags.length;
|
|
1405
|
+
var tagName = parser.tagName;
|
|
1406
|
+
if (!parser.strict) {
|
|
1407
|
+
tagName = tagName[parser.looseCase]();
|
|
1386
1408
|
}
|
|
1387
|
-
|
|
1388
|
-
|
|
1409
|
+
var closeTo = tagName;
|
|
1410
|
+
while (t2--) {
|
|
1411
|
+
var close = parser.tags[t2];
|
|
1412
|
+
if (close.name !== closeTo) {
|
|
1413
|
+
strictFail(parser, "Unexpected close tag");
|
|
1414
|
+
} else {
|
|
1415
|
+
break;
|
|
1416
|
+
}
|
|
1389
1417
|
}
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1418
|
+
if (t2 < 0) {
|
|
1419
|
+
strictFail(parser, "Unmatched closing tag: " + parser.tagName);
|
|
1420
|
+
parser.textNode += "</" + parser.tagName + ">";
|
|
1421
|
+
parser.state = S.TEXT;
|
|
1422
|
+
return;
|
|
1393
1423
|
}
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1424
|
+
parser.tagName = tagName;
|
|
1425
|
+
var s3 = parser.tags.length;
|
|
1426
|
+
while (s3-- > t2) {
|
|
1427
|
+
var tag = parser.tag = parser.tags.pop();
|
|
1428
|
+
parser.tagName = parser.tag.name;
|
|
1429
|
+
emitNode(parser, "onclosetag", parser.tagName);
|
|
1430
|
+
var x = {};
|
|
1431
|
+
for (var i2 in tag.ns) {
|
|
1432
|
+
x[i2] = tag.ns[i2];
|
|
1433
|
+
}
|
|
1434
|
+
var parent = parser.tags[parser.tags.length - 1] || parser;
|
|
1435
|
+
if (parser.opt.xmlns && tag.ns !== parent.ns) {
|
|
1436
|
+
Object.keys(tag.ns).forEach(function(p2) {
|
|
1437
|
+
var n2 = tag.ns[p2];
|
|
1438
|
+
emitNode(parser, "onclosenamespace", { prefix: p2, uri: n2 });
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
if (t2 === 0) parser.closedRoot = true;
|
|
1443
|
+
parser.tagName = parser.attribValue = parser.attribName = "";
|
|
1444
|
+
parser.attribList.length = 0;
|
|
1445
|
+
parser.state = S.TEXT;
|
|
1446
|
+
}
|
|
1447
|
+
function parseEntity(parser) {
|
|
1448
|
+
var entity = parser.entity;
|
|
1449
|
+
var entityLC = entity.toLowerCase();
|
|
1450
|
+
var num;
|
|
1451
|
+
var numStr = "";
|
|
1452
|
+
if (parser.ENTITIES[entity]) {
|
|
1453
|
+
return parser.ENTITIES[entity];
|
|
1454
|
+
}
|
|
1455
|
+
if (parser.ENTITIES[entityLC]) {
|
|
1456
|
+
return parser.ENTITIES[entityLC];
|
|
1400
1457
|
}
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
const childNode = new xmlNode(tagData.tagName);
|
|
1412
|
-
childNode.add(this.options.textNodeName, "");
|
|
1413
|
-
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
|
|
1414
|
-
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
|
|
1458
|
+
entity = entityLC;
|
|
1459
|
+
if (entity.charAt(0) === "#") {
|
|
1460
|
+
if (entity.charAt(1) === "x") {
|
|
1461
|
+
entity = entity.slice(2);
|
|
1462
|
+
num = parseInt(entity, 16);
|
|
1463
|
+
numStr = num.toString(16);
|
|
1464
|
+
} else {
|
|
1465
|
+
entity = entity.slice(1);
|
|
1466
|
+
num = parseInt(entity, 10);
|
|
1467
|
+
numStr = num.toString(10);
|
|
1415
1468
|
}
|
|
1416
|
-
this.addChild(currentNode, childNode, jPath);
|
|
1417
1469
|
}
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
const comment = xmlData.substring(i2 + 4, endIndex - 2);
|
|
1423
|
-
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
1424
|
-
currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]);
|
|
1470
|
+
entity = entity.replace(/^0+/, "");
|
|
1471
|
+
if (isNaN(num) || numStr.toLowerCase() !== entity) {
|
|
1472
|
+
strictFail(parser, "Invalid character entity");
|
|
1473
|
+
return "&" + parser.entity + ";";
|
|
1425
1474
|
}
|
|
1426
|
-
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
if (val2 == void 0) val2 = "";
|
|
1437
|
-
if (this.options.cdataPropName) {
|
|
1438
|
-
currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
|
|
1439
|
-
} else {
|
|
1440
|
-
currentNode.add(this.options.textNodeName, val2);
|
|
1475
|
+
return String.fromCodePoint(num);
|
|
1476
|
+
}
|
|
1477
|
+
function beginWhiteSpace(parser, c2) {
|
|
1478
|
+
if (c2 === "<") {
|
|
1479
|
+
parser.state = S.OPEN_WAKA;
|
|
1480
|
+
parser.startTagPosition = parser.position;
|
|
1481
|
+
} else if (!isWhitespace(c2)) {
|
|
1482
|
+
strictFail(parser, "Non-whitespace before first tag.");
|
|
1483
|
+
parser.textNode = c2;
|
|
1484
|
+
parser.state = S.TEXT;
|
|
1441
1485
|
}
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
let tagExp = result.tagExp;
|
|
1448
|
-
let attrExpPresent = result.attrExpPresent;
|
|
1449
|
-
let closeIndex = result.closeIndex;
|
|
1450
|
-
if (this.options.transformTagName) {
|
|
1451
|
-
tagName = this.options.transformTagName(tagName);
|
|
1486
|
+
}
|
|
1487
|
+
function charAt(chunk, i2) {
|
|
1488
|
+
var result = "";
|
|
1489
|
+
if (i2 < chunk.length) {
|
|
1490
|
+
result = chunk.charAt(i2);
|
|
1452
1491
|
}
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1492
|
+
return result;
|
|
1493
|
+
}
|
|
1494
|
+
function write(chunk) {
|
|
1495
|
+
var parser = this;
|
|
1496
|
+
if (this.error) {
|
|
1497
|
+
throw this.error;
|
|
1457
1498
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1499
|
+
if (parser.closed) {
|
|
1500
|
+
return error(
|
|
1501
|
+
parser,
|
|
1502
|
+
"Cannot write after close. Assign an onready handler."
|
|
1503
|
+
);
|
|
1462
1504
|
}
|
|
1463
|
-
if (
|
|
1464
|
-
|
|
1505
|
+
if (chunk === null) {
|
|
1506
|
+
return end(parser);
|
|
1465
1507
|
}
|
|
1466
|
-
if (
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
i2 = result.closeIndex;
|
|
1477
|
-
} else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
|
|
1478
|
-
i2 = result.closeIndex;
|
|
1479
|
-
} else {
|
|
1480
|
-
const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
|
|
1481
|
-
if (!result2) throw new Error(`Unexpected end of ${rawTagName}`);
|
|
1482
|
-
i2 = result2.i;
|
|
1483
|
-
tagContent = result2.tagContent;
|
|
1484
|
-
}
|
|
1485
|
-
const childNode = new xmlNode(tagName);
|
|
1486
|
-
if (tagName !== tagExp && attrExpPresent) {
|
|
1487
|
-
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
1488
|
-
}
|
|
1489
|
-
if (tagContent) {
|
|
1490
|
-
tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
|
|
1508
|
+
if (typeof chunk === "object") {
|
|
1509
|
+
chunk = chunk.toString();
|
|
1510
|
+
}
|
|
1511
|
+
var i2 = 0;
|
|
1512
|
+
var c2 = "";
|
|
1513
|
+
while (true) {
|
|
1514
|
+
c2 = charAt(chunk, i2++);
|
|
1515
|
+
parser.c = c2;
|
|
1516
|
+
if (!c2) {
|
|
1517
|
+
break;
|
|
1491
1518
|
}
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
if (tagName[tagName.length - 1] === "/") {
|
|
1498
|
-
tagName = tagName.substr(0, tagName.length - 1);
|
|
1499
|
-
jPath = jPath.substr(0, jPath.length - 1);
|
|
1500
|
-
tagExp = tagName;
|
|
1519
|
+
if (parser.trackPosition) {
|
|
1520
|
+
parser.position++;
|
|
1521
|
+
if (c2 === "\n") {
|
|
1522
|
+
parser.line++;
|
|
1523
|
+
parser.column = 0;
|
|
1501
1524
|
} else {
|
|
1502
|
-
|
|
1503
|
-
}
|
|
1504
|
-
if (this.options.transformTagName) {
|
|
1505
|
-
tagName = this.options.transformTagName(tagName);
|
|
1506
|
-
}
|
|
1507
|
-
const childNode = new xmlNode(tagName);
|
|
1508
|
-
if (tagName !== tagExp && attrExpPresent) {
|
|
1509
|
-
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
1525
|
+
parser.column++;
|
|
1510
1526
|
}
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1527
|
+
}
|
|
1528
|
+
switch (parser.state) {
|
|
1529
|
+
case S.BEGIN:
|
|
1530
|
+
parser.state = S.BEGIN_WHITESPACE;
|
|
1531
|
+
if (c2 === "\uFEFF") {
|
|
1532
|
+
continue;
|
|
1533
|
+
}
|
|
1534
|
+
beginWhiteSpace(parser, c2);
|
|
1535
|
+
continue;
|
|
1536
|
+
case S.BEGIN_WHITESPACE:
|
|
1537
|
+
beginWhiteSpace(parser, c2);
|
|
1538
|
+
continue;
|
|
1539
|
+
case S.TEXT:
|
|
1540
|
+
if (parser.sawRoot && !parser.closedRoot) {
|
|
1541
|
+
var starti = i2 - 1;
|
|
1542
|
+
while (c2 && c2 !== "<" && c2 !== "&") {
|
|
1543
|
+
c2 = charAt(chunk, i2++);
|
|
1544
|
+
if (c2 && parser.trackPosition) {
|
|
1545
|
+
parser.position++;
|
|
1546
|
+
if (c2 === "\n") {
|
|
1547
|
+
parser.line++;
|
|
1548
|
+
parser.column = 0;
|
|
1549
|
+
} else {
|
|
1550
|
+
parser.column++;
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
parser.textNode += chunk.substring(starti, i2 - 1);
|
|
1555
|
+
}
|
|
1556
|
+
if (c2 === "<" && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {
|
|
1557
|
+
parser.state = S.OPEN_WAKA;
|
|
1558
|
+
parser.startTagPosition = parser.position;
|
|
1559
|
+
} else {
|
|
1560
|
+
if (!isWhitespace(c2) && (!parser.sawRoot || parser.closedRoot)) {
|
|
1561
|
+
strictFail(parser, "Text data outside of root node.");
|
|
1562
|
+
}
|
|
1563
|
+
if (c2 === "&") {
|
|
1564
|
+
parser.state = S.TEXT_ENTITY;
|
|
1565
|
+
} else {
|
|
1566
|
+
parser.textNode += c2;
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
continue;
|
|
1570
|
+
case S.SCRIPT:
|
|
1571
|
+
if (c2 === "<") {
|
|
1572
|
+
parser.state = S.SCRIPT_ENDING;
|
|
1573
|
+
} else {
|
|
1574
|
+
parser.script += c2;
|
|
1575
|
+
}
|
|
1576
|
+
continue;
|
|
1577
|
+
case S.SCRIPT_ENDING:
|
|
1578
|
+
if (c2 === "/") {
|
|
1579
|
+
parser.state = S.CLOSE_TAG;
|
|
1580
|
+
} else {
|
|
1581
|
+
parser.script += "<" + c2;
|
|
1582
|
+
parser.state = S.SCRIPT;
|
|
1583
|
+
}
|
|
1584
|
+
continue;
|
|
1585
|
+
case S.OPEN_WAKA:
|
|
1586
|
+
if (c2 === "!") {
|
|
1587
|
+
parser.state = S.SGML_DECL;
|
|
1588
|
+
parser.sgmlDecl = "";
|
|
1589
|
+
} else if (isWhitespace(c2)) ;
|
|
1590
|
+
else if (isMatch(nameStart, c2)) {
|
|
1591
|
+
parser.state = S.OPEN_TAG;
|
|
1592
|
+
parser.tagName = c2;
|
|
1593
|
+
} else if (c2 === "/") {
|
|
1594
|
+
parser.state = S.CLOSE_TAG;
|
|
1595
|
+
parser.tagName = "";
|
|
1596
|
+
} else if (c2 === "?") {
|
|
1597
|
+
parser.state = S.PROC_INST;
|
|
1598
|
+
parser.procInstName = parser.procInstBody = "";
|
|
1599
|
+
} else {
|
|
1600
|
+
strictFail(parser, "Unencoded <");
|
|
1601
|
+
if (parser.startTagPosition + 1 < parser.position) {
|
|
1602
|
+
var pad = parser.position - parser.startTagPosition;
|
|
1603
|
+
c2 = new Array(pad).join(" ") + c2;
|
|
1604
|
+
}
|
|
1605
|
+
parser.textNode += "<" + c2;
|
|
1606
|
+
parser.state = S.TEXT;
|
|
1607
|
+
}
|
|
1608
|
+
continue;
|
|
1609
|
+
case S.SGML_DECL:
|
|
1610
|
+
if (parser.sgmlDecl + c2 === "--") {
|
|
1611
|
+
parser.state = S.COMMENT;
|
|
1612
|
+
parser.comment = "";
|
|
1613
|
+
parser.sgmlDecl = "";
|
|
1614
|
+
continue;
|
|
1615
|
+
}
|
|
1616
|
+
if (parser.doctype && parser.doctype !== true && parser.sgmlDecl) {
|
|
1617
|
+
parser.state = S.DOCTYPE_DTD;
|
|
1618
|
+
parser.doctype += "<!" + parser.sgmlDecl + c2;
|
|
1619
|
+
parser.sgmlDecl = "";
|
|
1620
|
+
} else if ((parser.sgmlDecl + c2).toUpperCase() === CDATA) {
|
|
1621
|
+
emitNode(parser, "onopencdata");
|
|
1622
|
+
parser.state = S.CDATA;
|
|
1623
|
+
parser.sgmlDecl = "";
|
|
1624
|
+
parser.cdata = "";
|
|
1625
|
+
} else if ((parser.sgmlDecl + c2).toUpperCase() === DOCTYPE) {
|
|
1626
|
+
parser.state = S.DOCTYPE;
|
|
1627
|
+
if (parser.doctype || parser.sawRoot) {
|
|
1628
|
+
strictFail(
|
|
1629
|
+
parser,
|
|
1630
|
+
"Inappropriately located doctype declaration"
|
|
1631
|
+
);
|
|
1632
|
+
}
|
|
1633
|
+
parser.doctype = "";
|
|
1634
|
+
parser.sgmlDecl = "";
|
|
1635
|
+
} else if (c2 === ">") {
|
|
1636
|
+
emitNode(parser, "onsgmldeclaration", parser.sgmlDecl);
|
|
1637
|
+
parser.sgmlDecl = "";
|
|
1638
|
+
parser.state = S.TEXT;
|
|
1639
|
+
} else if (isQuote(c2)) {
|
|
1640
|
+
parser.state = S.SGML_DECL_QUOTED;
|
|
1641
|
+
parser.sgmlDecl += c2;
|
|
1642
|
+
} else {
|
|
1643
|
+
parser.sgmlDecl += c2;
|
|
1644
|
+
}
|
|
1645
|
+
continue;
|
|
1646
|
+
case S.SGML_DECL_QUOTED:
|
|
1647
|
+
if (c2 === parser.q) {
|
|
1648
|
+
parser.state = S.SGML_DECL;
|
|
1649
|
+
parser.q = "";
|
|
1650
|
+
}
|
|
1651
|
+
parser.sgmlDecl += c2;
|
|
1652
|
+
continue;
|
|
1653
|
+
case S.DOCTYPE:
|
|
1654
|
+
if (c2 === ">") {
|
|
1655
|
+
parser.state = S.TEXT;
|
|
1656
|
+
emitNode(parser, "ondoctype", parser.doctype);
|
|
1657
|
+
parser.doctype = true;
|
|
1658
|
+
} else {
|
|
1659
|
+
parser.doctype += c2;
|
|
1660
|
+
if (c2 === "[") {
|
|
1661
|
+
parser.state = S.DOCTYPE_DTD;
|
|
1662
|
+
} else if (isQuote(c2)) {
|
|
1663
|
+
parser.state = S.DOCTYPE_QUOTED;
|
|
1664
|
+
parser.q = c2;
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
continue;
|
|
1668
|
+
case S.DOCTYPE_QUOTED:
|
|
1669
|
+
parser.doctype += c2;
|
|
1670
|
+
if (c2 === parser.q) {
|
|
1671
|
+
parser.q = "";
|
|
1672
|
+
parser.state = S.DOCTYPE;
|
|
1673
|
+
}
|
|
1674
|
+
continue;
|
|
1675
|
+
case S.DOCTYPE_DTD:
|
|
1676
|
+
if (c2 === "]") {
|
|
1677
|
+
parser.doctype += c2;
|
|
1678
|
+
parser.state = S.DOCTYPE;
|
|
1679
|
+
} else if (c2 === "<") {
|
|
1680
|
+
parser.state = S.OPEN_WAKA;
|
|
1681
|
+
parser.startTagPosition = parser.position;
|
|
1682
|
+
} else if (isQuote(c2)) {
|
|
1683
|
+
parser.doctype += c2;
|
|
1684
|
+
parser.state = S.DOCTYPE_DTD_QUOTED;
|
|
1685
|
+
parser.q = c2;
|
|
1686
|
+
} else {
|
|
1687
|
+
parser.doctype += c2;
|
|
1688
|
+
}
|
|
1689
|
+
continue;
|
|
1690
|
+
case S.DOCTYPE_DTD_QUOTED:
|
|
1691
|
+
parser.doctype += c2;
|
|
1692
|
+
if (c2 === parser.q) {
|
|
1693
|
+
parser.state = S.DOCTYPE_DTD;
|
|
1694
|
+
parser.q = "";
|
|
1695
|
+
}
|
|
1696
|
+
continue;
|
|
1697
|
+
case S.COMMENT:
|
|
1698
|
+
if (c2 === "-") {
|
|
1699
|
+
parser.state = S.COMMENT_ENDING;
|
|
1700
|
+
} else {
|
|
1701
|
+
parser.comment += c2;
|
|
1702
|
+
}
|
|
1703
|
+
continue;
|
|
1704
|
+
case S.COMMENT_ENDING:
|
|
1705
|
+
if (c2 === "-") {
|
|
1706
|
+
parser.state = S.COMMENT_ENDED;
|
|
1707
|
+
parser.comment = textopts(parser.opt, parser.comment);
|
|
1708
|
+
if (parser.comment) {
|
|
1709
|
+
emitNode(parser, "oncomment", parser.comment);
|
|
1710
|
+
}
|
|
1711
|
+
parser.comment = "";
|
|
1712
|
+
} else {
|
|
1713
|
+
parser.comment += "-" + c2;
|
|
1714
|
+
parser.state = S.COMMENT;
|
|
1715
|
+
}
|
|
1716
|
+
continue;
|
|
1717
|
+
case S.COMMENT_ENDED:
|
|
1718
|
+
if (c2 !== ">") {
|
|
1719
|
+
strictFail(parser, "Malformed comment");
|
|
1720
|
+
parser.comment += "--" + c2;
|
|
1721
|
+
parser.state = S.COMMENT;
|
|
1722
|
+
} else if (parser.doctype && parser.doctype !== true) {
|
|
1723
|
+
parser.state = S.DOCTYPE_DTD;
|
|
1724
|
+
} else {
|
|
1725
|
+
parser.state = S.TEXT;
|
|
1726
|
+
}
|
|
1727
|
+
continue;
|
|
1728
|
+
case S.CDATA:
|
|
1729
|
+
if (c2 === "]") {
|
|
1730
|
+
parser.state = S.CDATA_ENDING;
|
|
1731
|
+
} else {
|
|
1732
|
+
parser.cdata += c2;
|
|
1733
|
+
}
|
|
1734
|
+
continue;
|
|
1735
|
+
case S.CDATA_ENDING:
|
|
1736
|
+
if (c2 === "]") {
|
|
1737
|
+
parser.state = S.CDATA_ENDING_2;
|
|
1738
|
+
} else {
|
|
1739
|
+
parser.cdata += "]" + c2;
|
|
1740
|
+
parser.state = S.CDATA;
|
|
1741
|
+
}
|
|
1742
|
+
continue;
|
|
1743
|
+
case S.CDATA_ENDING_2:
|
|
1744
|
+
if (c2 === ">") {
|
|
1745
|
+
if (parser.cdata) {
|
|
1746
|
+
emitNode(parser, "oncdata", parser.cdata);
|
|
1747
|
+
}
|
|
1748
|
+
emitNode(parser, "onclosecdata");
|
|
1749
|
+
parser.cdata = "";
|
|
1750
|
+
parser.state = S.TEXT;
|
|
1751
|
+
} else if (c2 === "]") {
|
|
1752
|
+
parser.cdata += "]";
|
|
1753
|
+
} else {
|
|
1754
|
+
parser.cdata += "]]" + c2;
|
|
1755
|
+
parser.state = S.CDATA;
|
|
1756
|
+
}
|
|
1757
|
+
continue;
|
|
1758
|
+
case S.PROC_INST:
|
|
1759
|
+
if (c2 === "?") {
|
|
1760
|
+
parser.state = S.PROC_INST_ENDING;
|
|
1761
|
+
} else if (isWhitespace(c2)) {
|
|
1762
|
+
parser.state = S.PROC_INST_BODY;
|
|
1763
|
+
} else {
|
|
1764
|
+
parser.procInstName += c2;
|
|
1765
|
+
}
|
|
1766
|
+
continue;
|
|
1767
|
+
case S.PROC_INST_BODY:
|
|
1768
|
+
if (!parser.procInstBody && isWhitespace(c2)) {
|
|
1769
|
+
continue;
|
|
1770
|
+
} else if (c2 === "?") {
|
|
1771
|
+
parser.state = S.PROC_INST_ENDING;
|
|
1772
|
+
} else {
|
|
1773
|
+
parser.procInstBody += c2;
|
|
1774
|
+
}
|
|
1775
|
+
continue;
|
|
1776
|
+
case S.PROC_INST_ENDING:
|
|
1777
|
+
if (c2 === ">") {
|
|
1778
|
+
emitNode(parser, "onprocessinginstruction", {
|
|
1779
|
+
name: parser.procInstName,
|
|
1780
|
+
body: parser.procInstBody
|
|
1781
|
+
});
|
|
1782
|
+
parser.procInstName = parser.procInstBody = "";
|
|
1783
|
+
parser.state = S.TEXT;
|
|
1784
|
+
} else {
|
|
1785
|
+
parser.procInstBody += "?" + c2;
|
|
1786
|
+
parser.state = S.PROC_INST_BODY;
|
|
1787
|
+
}
|
|
1788
|
+
continue;
|
|
1789
|
+
case S.OPEN_TAG:
|
|
1790
|
+
if (isMatch(nameBody, c2)) {
|
|
1791
|
+
parser.tagName += c2;
|
|
1792
|
+
} else {
|
|
1793
|
+
newTag(parser);
|
|
1794
|
+
if (c2 === ">") {
|
|
1795
|
+
openTag(parser);
|
|
1796
|
+
} else if (c2 === "/") {
|
|
1797
|
+
parser.state = S.OPEN_TAG_SLASH;
|
|
1798
|
+
} else {
|
|
1799
|
+
if (!isWhitespace(c2)) {
|
|
1800
|
+
strictFail(parser, "Invalid character in tag name");
|
|
1801
|
+
}
|
|
1802
|
+
parser.state = S.ATTRIB;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
continue;
|
|
1806
|
+
case S.OPEN_TAG_SLASH:
|
|
1807
|
+
if (c2 === ">") {
|
|
1808
|
+
openTag(parser, true);
|
|
1809
|
+
closeTag(parser);
|
|
1810
|
+
} else {
|
|
1811
|
+
strictFail(parser, "Forward-slash in opening tag not followed by >");
|
|
1812
|
+
parser.state = S.ATTRIB;
|
|
1813
|
+
}
|
|
1814
|
+
continue;
|
|
1815
|
+
case S.ATTRIB:
|
|
1816
|
+
if (isWhitespace(c2)) {
|
|
1817
|
+
continue;
|
|
1818
|
+
} else if (c2 === ">") {
|
|
1819
|
+
openTag(parser);
|
|
1820
|
+
} else if (c2 === "/") {
|
|
1821
|
+
parser.state = S.OPEN_TAG_SLASH;
|
|
1822
|
+
} else if (isMatch(nameStart, c2)) {
|
|
1823
|
+
parser.attribName = c2;
|
|
1824
|
+
parser.attribValue = "";
|
|
1825
|
+
parser.state = S.ATTRIB_NAME;
|
|
1826
|
+
} else {
|
|
1827
|
+
strictFail(parser, "Invalid attribute name");
|
|
1828
|
+
}
|
|
1829
|
+
continue;
|
|
1830
|
+
case S.ATTRIB_NAME:
|
|
1831
|
+
if (c2 === "=") {
|
|
1832
|
+
parser.state = S.ATTRIB_VALUE;
|
|
1833
|
+
} else if (c2 === ">") {
|
|
1834
|
+
strictFail(parser, "Attribute without value");
|
|
1835
|
+
parser.attribValue = parser.attribName;
|
|
1836
|
+
attrib(parser);
|
|
1837
|
+
openTag(parser);
|
|
1838
|
+
} else if (isWhitespace(c2)) {
|
|
1839
|
+
parser.state = S.ATTRIB_NAME_SAW_WHITE;
|
|
1840
|
+
} else if (isMatch(nameBody, c2)) {
|
|
1841
|
+
parser.attribName += c2;
|
|
1842
|
+
} else {
|
|
1843
|
+
strictFail(parser, "Invalid attribute name");
|
|
1844
|
+
}
|
|
1845
|
+
continue;
|
|
1846
|
+
case S.ATTRIB_NAME_SAW_WHITE:
|
|
1847
|
+
if (c2 === "=") {
|
|
1848
|
+
parser.state = S.ATTRIB_VALUE;
|
|
1849
|
+
} else if (isWhitespace(c2)) {
|
|
1850
|
+
continue;
|
|
1851
|
+
} else {
|
|
1852
|
+
strictFail(parser, "Attribute without value");
|
|
1853
|
+
parser.tag.attributes[parser.attribName] = "";
|
|
1854
|
+
parser.attribValue = "";
|
|
1855
|
+
emitNode(parser, "onattribute", {
|
|
1856
|
+
name: parser.attribName,
|
|
1857
|
+
value: ""
|
|
1858
|
+
});
|
|
1859
|
+
parser.attribName = "";
|
|
1860
|
+
if (c2 === ">") {
|
|
1861
|
+
openTag(parser);
|
|
1862
|
+
} else if (isMatch(nameStart, c2)) {
|
|
1863
|
+
parser.attribName = c2;
|
|
1864
|
+
parser.state = S.ATTRIB_NAME;
|
|
1865
|
+
} else {
|
|
1866
|
+
strictFail(parser, "Invalid attribute name");
|
|
1867
|
+
parser.state = S.ATTRIB;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
continue;
|
|
1871
|
+
case S.ATTRIB_VALUE:
|
|
1872
|
+
if (isWhitespace(c2)) {
|
|
1873
|
+
continue;
|
|
1874
|
+
} else if (isQuote(c2)) {
|
|
1875
|
+
parser.q = c2;
|
|
1876
|
+
parser.state = S.ATTRIB_VALUE_QUOTED;
|
|
1877
|
+
} else {
|
|
1878
|
+
if (!parser.opt.unquotedAttributeValues) {
|
|
1879
|
+
error(parser, "Unquoted attribute value");
|
|
1880
|
+
}
|
|
1881
|
+
parser.state = S.ATTRIB_VALUE_UNQUOTED;
|
|
1882
|
+
parser.attribValue = c2;
|
|
1883
|
+
}
|
|
1884
|
+
continue;
|
|
1885
|
+
case S.ATTRIB_VALUE_QUOTED:
|
|
1886
|
+
if (c2 !== parser.q) {
|
|
1887
|
+
if (c2 === "&") {
|
|
1888
|
+
parser.state = S.ATTRIB_VALUE_ENTITY_Q;
|
|
1889
|
+
} else {
|
|
1890
|
+
parser.attribValue += c2;
|
|
1891
|
+
}
|
|
1892
|
+
continue;
|
|
1893
|
+
}
|
|
1894
|
+
attrib(parser);
|
|
1895
|
+
parser.q = "";
|
|
1896
|
+
parser.state = S.ATTRIB_VALUE_CLOSED;
|
|
1897
|
+
continue;
|
|
1898
|
+
case S.ATTRIB_VALUE_CLOSED:
|
|
1899
|
+
if (isWhitespace(c2)) {
|
|
1900
|
+
parser.state = S.ATTRIB;
|
|
1901
|
+
} else if (c2 === ">") {
|
|
1902
|
+
openTag(parser);
|
|
1903
|
+
} else if (c2 === "/") {
|
|
1904
|
+
parser.state = S.OPEN_TAG_SLASH;
|
|
1905
|
+
} else if (isMatch(nameStart, c2)) {
|
|
1906
|
+
strictFail(parser, "No whitespace between attributes");
|
|
1907
|
+
parser.attribName = c2;
|
|
1908
|
+
parser.attribValue = "";
|
|
1909
|
+
parser.state = S.ATTRIB_NAME;
|
|
1910
|
+
} else {
|
|
1911
|
+
strictFail(parser, "Invalid attribute name");
|
|
1912
|
+
}
|
|
1913
|
+
continue;
|
|
1914
|
+
case S.ATTRIB_VALUE_UNQUOTED:
|
|
1915
|
+
if (!isAttribEnd(c2)) {
|
|
1916
|
+
if (c2 === "&") {
|
|
1917
|
+
parser.state = S.ATTRIB_VALUE_ENTITY_U;
|
|
1918
|
+
} else {
|
|
1919
|
+
parser.attribValue += c2;
|
|
1920
|
+
}
|
|
1921
|
+
continue;
|
|
1922
|
+
}
|
|
1923
|
+
attrib(parser);
|
|
1924
|
+
if (c2 === ">") {
|
|
1925
|
+
openTag(parser);
|
|
1926
|
+
} else {
|
|
1927
|
+
parser.state = S.ATTRIB;
|
|
1928
|
+
}
|
|
1929
|
+
continue;
|
|
1930
|
+
case S.CLOSE_TAG:
|
|
1931
|
+
if (!parser.tagName) {
|
|
1932
|
+
if (isWhitespace(c2)) {
|
|
1933
|
+
continue;
|
|
1934
|
+
} else if (notMatch(nameStart, c2)) {
|
|
1935
|
+
if (parser.script) {
|
|
1936
|
+
parser.script += "</" + c2;
|
|
1937
|
+
parser.state = S.SCRIPT;
|
|
1938
|
+
} else {
|
|
1939
|
+
strictFail(parser, "Invalid tagname in closing tag.");
|
|
1940
|
+
}
|
|
1941
|
+
} else {
|
|
1942
|
+
parser.tagName = c2;
|
|
1943
|
+
}
|
|
1944
|
+
} else if (c2 === ">") {
|
|
1945
|
+
closeTag(parser);
|
|
1946
|
+
} else if (isMatch(nameBody, c2)) {
|
|
1947
|
+
parser.tagName += c2;
|
|
1948
|
+
} else if (parser.script) {
|
|
1949
|
+
parser.script += "</" + parser.tagName;
|
|
1950
|
+
parser.tagName = "";
|
|
1951
|
+
parser.state = S.SCRIPT;
|
|
1952
|
+
} else {
|
|
1953
|
+
if (!isWhitespace(c2)) {
|
|
1954
|
+
strictFail(parser, "Invalid tagname in closing tag");
|
|
1955
|
+
}
|
|
1956
|
+
parser.state = S.CLOSE_TAG_SAW_WHITE;
|
|
1957
|
+
}
|
|
1958
|
+
continue;
|
|
1959
|
+
case S.CLOSE_TAG_SAW_WHITE:
|
|
1960
|
+
if (isWhitespace(c2)) {
|
|
1961
|
+
continue;
|
|
1962
|
+
}
|
|
1963
|
+
if (c2 === ">") {
|
|
1964
|
+
closeTag(parser);
|
|
1965
|
+
} else {
|
|
1966
|
+
strictFail(parser, "Invalid characters in closing tag");
|
|
1967
|
+
}
|
|
1968
|
+
continue;
|
|
1969
|
+
case S.TEXT_ENTITY:
|
|
1970
|
+
case S.ATTRIB_VALUE_ENTITY_Q:
|
|
1971
|
+
case S.ATTRIB_VALUE_ENTITY_U:
|
|
1972
|
+
var returnState;
|
|
1973
|
+
var buffer;
|
|
1974
|
+
switch (parser.state) {
|
|
1975
|
+
case S.TEXT_ENTITY:
|
|
1976
|
+
returnState = S.TEXT;
|
|
1977
|
+
buffer = "textNode";
|
|
1978
|
+
break;
|
|
1979
|
+
case S.ATTRIB_VALUE_ENTITY_Q:
|
|
1980
|
+
returnState = S.ATTRIB_VALUE_QUOTED;
|
|
1981
|
+
buffer = "attribValue";
|
|
1982
|
+
break;
|
|
1983
|
+
case S.ATTRIB_VALUE_ENTITY_U:
|
|
1984
|
+
returnState = S.ATTRIB_VALUE_UNQUOTED;
|
|
1985
|
+
buffer = "attribValue";
|
|
1986
|
+
break;
|
|
1987
|
+
}
|
|
1988
|
+
if (c2 === ";") {
|
|
1989
|
+
var parsedEntity = parseEntity(parser);
|
|
1990
|
+
if (parser.opt.unparsedEntities && !Object.values(sax2.XML_ENTITIES).includes(parsedEntity)) {
|
|
1991
|
+
parser.entity = "";
|
|
1992
|
+
parser.state = returnState;
|
|
1993
|
+
parser.write(parsedEntity);
|
|
1994
|
+
} else {
|
|
1995
|
+
parser[buffer] += parsedEntity;
|
|
1996
|
+
parser.entity = "";
|
|
1997
|
+
parser.state = returnState;
|
|
1998
|
+
}
|
|
1999
|
+
} else if (isMatch(parser.entity.length ? entityBody : entityStart, c2)) {
|
|
2000
|
+
parser.entity += c2;
|
|
2001
|
+
} else {
|
|
2002
|
+
strictFail(parser, "Invalid character in entity name");
|
|
2003
|
+
parser[buffer] += "&" + parser.entity + c2;
|
|
2004
|
+
parser.entity = "";
|
|
2005
|
+
parser.state = returnState;
|
|
2006
|
+
}
|
|
2007
|
+
continue;
|
|
2008
|
+
default: {
|
|
2009
|
+
throw new Error(parser, "Unknown state: " + parser.state);
|
|
1518
2010
|
}
|
|
1519
|
-
this.addChild(currentNode, childNode, jPath);
|
|
1520
|
-
currentNode = childNode;
|
|
1521
2011
|
}
|
|
1522
|
-
textData = "";
|
|
1523
|
-
i2 = closeIndex;
|
|
1524
2012
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
textData += xmlData[i2];
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
return xmlObj.child;
|
|
1531
|
-
};
|
|
1532
|
-
function addChild(currentNode, childNode, jPath) {
|
|
1533
|
-
const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
|
|
1534
|
-
if (result === false) ;
|
|
1535
|
-
else if (typeof result === "string") {
|
|
1536
|
-
childNode.tagname = result;
|
|
1537
|
-
currentNode.addChild(childNode);
|
|
1538
|
-
} else {
|
|
1539
|
-
currentNode.addChild(childNode);
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1542
|
-
const replaceEntitiesValue$1 = function(val2) {
|
|
1543
|
-
if (this.options.processEntities) {
|
|
1544
|
-
for (let entityName2 in this.docTypeEntities) {
|
|
1545
|
-
const entity = this.docTypeEntities[entityName2];
|
|
1546
|
-
val2 = val2.replace(entity.regx, entity.val);
|
|
1547
|
-
}
|
|
1548
|
-
for (let entityName2 in this.lastEntities) {
|
|
1549
|
-
const entity = this.lastEntities[entityName2];
|
|
1550
|
-
val2 = val2.replace(entity.regex, entity.val);
|
|
1551
|
-
}
|
|
1552
|
-
if (this.options.htmlEntities) {
|
|
1553
|
-
for (let entityName2 in this.htmlEntities) {
|
|
1554
|
-
const entity = this.htmlEntities[entityName2];
|
|
1555
|
-
val2 = val2.replace(entity.regex, entity.val);
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
val2 = val2.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
1559
|
-
}
|
|
1560
|
-
return val2;
|
|
1561
|
-
};
|
|
1562
|
-
function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
|
|
1563
|
-
if (textData) {
|
|
1564
|
-
if (isLeafNode === void 0) isLeafNode = Object.keys(currentNode.child).length === 0;
|
|
1565
|
-
textData = this.parseTextData(
|
|
1566
|
-
textData,
|
|
1567
|
-
currentNode.tagname,
|
|
1568
|
-
jPath,
|
|
1569
|
-
false,
|
|
1570
|
-
currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false,
|
|
1571
|
-
isLeafNode
|
|
1572
|
-
);
|
|
1573
|
-
if (textData !== void 0 && textData !== "")
|
|
1574
|
-
currentNode.add(this.options.textNodeName, textData);
|
|
1575
|
-
textData = "";
|
|
1576
|
-
}
|
|
1577
|
-
return textData;
|
|
1578
|
-
}
|
|
1579
|
-
function isItStopNode(stopNodes, jPath, currentTagName) {
|
|
1580
|
-
const allNodesExp = "*." + currentTagName;
|
|
1581
|
-
for (const stopNodePath in stopNodes) {
|
|
1582
|
-
const stopNodeExp = stopNodes[stopNodePath];
|
|
1583
|
-
if (allNodesExp === stopNodeExp || jPath === stopNodeExp) return true;
|
|
1584
|
-
}
|
|
1585
|
-
return false;
|
|
1586
|
-
}
|
|
1587
|
-
function tagExpWithClosingIndex(xmlData, i2, closingChar = ">") {
|
|
1588
|
-
let attrBoundary;
|
|
1589
|
-
let tagExp = "";
|
|
1590
|
-
for (let index = i2; index < xmlData.length; index++) {
|
|
1591
|
-
let ch = xmlData[index];
|
|
1592
|
-
if (attrBoundary) {
|
|
1593
|
-
if (ch === attrBoundary) attrBoundary = "";
|
|
1594
|
-
} else if (ch === '"' || ch === "'") {
|
|
1595
|
-
attrBoundary = ch;
|
|
1596
|
-
} else if (ch === closingChar[0]) {
|
|
1597
|
-
if (closingChar[1]) {
|
|
1598
|
-
if (xmlData[index + 1] === closingChar[1]) {
|
|
1599
|
-
return {
|
|
1600
|
-
data: tagExp,
|
|
1601
|
-
index
|
|
1602
|
-
};
|
|
2013
|
+
if (parser.position >= parser.bufferCheckPosition) {
|
|
2014
|
+
checkBufferLength(parser);
|
|
1603
2015
|
}
|
|
1604
|
-
|
|
1605
|
-
return {
|
|
1606
|
-
data: tagExp,
|
|
1607
|
-
index
|
|
1608
|
-
};
|
|
2016
|
+
return parser;
|
|
1609
2017
|
}
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
if (xmlData[i2 + 1] === "/") {
|
|
1658
|
-
const closeIndex = findClosingIndex(xmlData, ">", i2, `${tagName} is not closed`);
|
|
1659
|
-
let closeTagName = xmlData.substring(i2 + 2, closeIndex).trim();
|
|
1660
|
-
if (closeTagName === tagName) {
|
|
1661
|
-
openTagCount--;
|
|
1662
|
-
if (openTagCount === 0) {
|
|
1663
|
-
return {
|
|
1664
|
-
tagContent: xmlData.substring(startIndex, i2),
|
|
1665
|
-
i: closeIndex
|
|
1666
|
-
};
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
i2 = closeIndex;
|
|
1670
|
-
} else if (xmlData[i2 + 1] === "?") {
|
|
1671
|
-
const closeIndex = findClosingIndex(xmlData, "?>", i2 + 1, "StopNode is not closed.");
|
|
1672
|
-
i2 = closeIndex;
|
|
1673
|
-
} else if (xmlData.substr(i2 + 1, 3) === "!--") {
|
|
1674
|
-
const closeIndex = findClosingIndex(xmlData, "-->", i2 + 3, "StopNode is not closed.");
|
|
1675
|
-
i2 = closeIndex;
|
|
1676
|
-
} else if (xmlData.substr(i2 + 1, 2) === "![") {
|
|
1677
|
-
const closeIndex = findClosingIndex(xmlData, "]]>", i2, "StopNode is not closed.") - 2;
|
|
1678
|
-
i2 = closeIndex;
|
|
1679
|
-
} else {
|
|
1680
|
-
const tagData = readTagExp(xmlData, i2, ">");
|
|
1681
|
-
if (tagData) {
|
|
1682
|
-
const openTagName = tagData && tagData.tagName;
|
|
1683
|
-
if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") {
|
|
1684
|
-
openTagCount++;
|
|
2018
|
+
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
|
|
2019
|
+
if (!String.fromCodePoint) {
|
|
2020
|
+
(function() {
|
|
2021
|
+
var stringFromCharCode = String.fromCharCode;
|
|
2022
|
+
var floor = Math.floor;
|
|
2023
|
+
var fromCodePoint = function() {
|
|
2024
|
+
var MAX_SIZE = 16384;
|
|
2025
|
+
var codeUnits = [];
|
|
2026
|
+
var highSurrogate;
|
|
2027
|
+
var lowSurrogate;
|
|
2028
|
+
var index = -1;
|
|
2029
|
+
var length = arguments.length;
|
|
2030
|
+
if (!length) {
|
|
2031
|
+
return "";
|
|
2032
|
+
}
|
|
2033
|
+
var result = "";
|
|
2034
|
+
while (++index < length) {
|
|
2035
|
+
var codePoint = Number(arguments[index]);
|
|
2036
|
+
if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
|
|
2037
|
+
codePoint < 0 || // not a valid Unicode code point
|
|
2038
|
+
codePoint > 1114111 || // not a valid Unicode code point
|
|
2039
|
+
floor(codePoint) !== codePoint) {
|
|
2040
|
+
throw RangeError("Invalid code point: " + codePoint);
|
|
2041
|
+
}
|
|
2042
|
+
if (codePoint <= 65535) {
|
|
2043
|
+
codeUnits.push(codePoint);
|
|
2044
|
+
} else {
|
|
2045
|
+
codePoint -= 65536;
|
|
2046
|
+
highSurrogate = (codePoint >> 10) + 55296;
|
|
2047
|
+
lowSurrogate = codePoint % 1024 + 56320;
|
|
2048
|
+
codeUnits.push(highSurrogate, lowSurrogate);
|
|
2049
|
+
}
|
|
2050
|
+
if (index + 1 === length || codeUnits.length > MAX_SIZE) {
|
|
2051
|
+
result += stringFromCharCode.apply(null, codeUnits);
|
|
2052
|
+
codeUnits.length = 0;
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
return result;
|
|
2056
|
+
};
|
|
2057
|
+
if (Object.defineProperty) {
|
|
2058
|
+
Object.defineProperty(String, "fromCodePoint", {
|
|
2059
|
+
value: fromCodePoint,
|
|
2060
|
+
configurable: true,
|
|
2061
|
+
writable: true
|
|
2062
|
+
});
|
|
2063
|
+
} else {
|
|
2064
|
+
String.fromCodePoint = fromCodePoint;
|
|
1685
2065
|
}
|
|
1686
|
-
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
function parseValue(val2, shouldParse, options) {
|
|
1693
|
-
if (shouldParse && typeof val2 === "string") {
|
|
1694
|
-
const newval = val2.trim();
|
|
1695
|
-
if (newval === "true") return true;
|
|
1696
|
-
else if (newval === "false") return false;
|
|
1697
|
-
else return toNumber(val2, options);
|
|
1698
|
-
} else {
|
|
1699
|
-
if (util.isExist(val2)) {
|
|
1700
|
-
return val2;
|
|
1701
|
-
} else {
|
|
1702
|
-
return "";
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
var OrderedObjParser_1 = OrderedObjParser$1;
|
|
1707
|
-
var node2json = {};
|
|
1708
|
-
function prettify$1(node, options) {
|
|
1709
|
-
return compress(node, options);
|
|
1710
|
-
}
|
|
1711
|
-
function compress(arr, options, jPath) {
|
|
1712
|
-
let text;
|
|
1713
|
-
const compressedObj = {};
|
|
1714
|
-
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
1715
|
-
const tagObj = arr[i2];
|
|
1716
|
-
const property = propName$1(tagObj);
|
|
1717
|
-
let newJpath = "";
|
|
1718
|
-
if (jPath === void 0) newJpath = property;
|
|
1719
|
-
else newJpath = jPath + "." + property;
|
|
1720
|
-
if (property === options.textNodeName) {
|
|
1721
|
-
if (text === void 0) text = tagObj[property];
|
|
1722
|
-
else text += "" + tagObj[property];
|
|
1723
|
-
} else if (property === void 0) {
|
|
1724
|
-
continue;
|
|
1725
|
-
} else if (tagObj[property]) {
|
|
1726
|
-
let val2 = compress(tagObj[property], options, newJpath);
|
|
1727
|
-
const isLeaf = isLeafTag(val2, options);
|
|
1728
|
-
if (tagObj[":@"]) {
|
|
1729
|
-
assignAttributes(val2, tagObj[":@"], newJpath, options);
|
|
1730
|
-
} else if (Object.keys(val2).length === 1 && val2[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
|
|
1731
|
-
val2 = val2[options.textNodeName];
|
|
1732
|
-
} else if (Object.keys(val2).length === 0) {
|
|
1733
|
-
if (options.alwaysCreateTextNode) val2[options.textNodeName] = "";
|
|
1734
|
-
else val2 = "";
|
|
2066
|
+
})();
|
|
1735
2067
|
}
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
const key = keys[i2];
|
|
1759
|
-
if (key !== ":@") return key;
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
function assignAttributes(obj, attrMap, jpath, options) {
|
|
1763
|
-
if (attrMap) {
|
|
1764
|
-
const keys = Object.keys(attrMap);
|
|
1765
|
-
const len = keys.length;
|
|
1766
|
-
for (let i2 = 0; i2 < len; i2++) {
|
|
1767
|
-
const atrrName = keys[i2];
|
|
1768
|
-
if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
|
|
1769
|
-
obj[atrrName] = [attrMap[atrrName]];
|
|
1770
|
-
} else {
|
|
1771
|
-
obj[atrrName] = attrMap[atrrName];
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
}
|
|
1775
|
-
}
|
|
1776
|
-
function isLeafTag(obj, options) {
|
|
1777
|
-
const { textNodeName } = options;
|
|
1778
|
-
const propCount = Object.keys(obj).length;
|
|
1779
|
-
if (propCount === 0) {
|
|
1780
|
-
return true;
|
|
1781
|
-
}
|
|
1782
|
-
if (propCount === 1 && (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)) {
|
|
1783
|
-
return true;
|
|
1784
|
-
}
|
|
1785
|
-
return false;
|
|
1786
|
-
}
|
|
1787
|
-
node2json.prettify = prettify$1;
|
|
1788
|
-
const { buildOptions } = OptionsBuilder;
|
|
1789
|
-
const OrderedObjParser2 = OrderedObjParser_1;
|
|
1790
|
-
const { prettify } = node2json;
|
|
1791
|
-
const validator$1 = validator$2;
|
|
1792
|
-
let XMLParser$1 = class XMLParser {
|
|
1793
|
-
constructor(options) {
|
|
1794
|
-
this.externalEntities = {};
|
|
1795
|
-
this.options = buildOptions(options);
|
|
1796
|
-
}
|
|
1797
|
-
/**
|
|
1798
|
-
* Parse XML dats to JS object
|
|
1799
|
-
* @param {string|Buffer} xmlData
|
|
1800
|
-
* @param {boolean|Object} validationOption
|
|
1801
|
-
*/
|
|
1802
|
-
parse(xmlData, validationOption) {
|
|
1803
|
-
if (typeof xmlData === "string") ;
|
|
1804
|
-
else if (xmlData.toString) {
|
|
1805
|
-
xmlData = xmlData.toString();
|
|
1806
|
-
} else {
|
|
1807
|
-
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
1808
|
-
}
|
|
1809
|
-
if (validationOption) {
|
|
1810
|
-
if (validationOption === true) validationOption = {};
|
|
1811
|
-
const result = validator$1.validate(xmlData, validationOption);
|
|
1812
|
-
if (result !== true) {
|
|
1813
|
-
throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`);
|
|
1814
|
-
}
|
|
1815
|
-
}
|
|
1816
|
-
const orderedObjParser = new OrderedObjParser2(this.options);
|
|
1817
|
-
orderedObjParser.addExternalEntities(this.externalEntities);
|
|
1818
|
-
const orderedResult = orderedObjParser.parseXml(xmlData);
|
|
1819
|
-
if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
|
|
1820
|
-
else return prettify(orderedResult, this.options);
|
|
1821
|
-
}
|
|
1822
|
-
/**
|
|
1823
|
-
* Add Entity which is not by default supported by this library
|
|
1824
|
-
* @param {string} key
|
|
1825
|
-
* @param {string} value
|
|
1826
|
-
*/
|
|
1827
|
-
addEntity(key, value) {
|
|
1828
|
-
if (value.indexOf("&") !== -1) {
|
|
1829
|
-
throw new Error("Entity value can't have '&'");
|
|
1830
|
-
} else if (key.indexOf("&") !== -1 || key.indexOf(";") !== -1) {
|
|
1831
|
-
throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");
|
|
1832
|
-
} else if (value === "&") {
|
|
1833
|
-
throw new Error("An entity with value '&' is not permitted");
|
|
1834
|
-
} else {
|
|
1835
|
-
this.externalEntities[key] = value;
|
|
1836
|
-
}
|
|
2068
|
+
})(exports);
|
|
2069
|
+
})(sax$1);
|
|
2070
|
+
return sax$1;
|
|
2071
|
+
}
|
|
2072
|
+
var saxExports = requireSax();
|
|
2073
|
+
const sax = /* @__PURE__ */ getDefaultExportFromCjs(saxExports);
|
|
2074
|
+
const namespaceMapping = {
|
|
2075
|
+
"http://www.w3.org/2000/svg": {
|
|
2076
|
+
ext: "svg",
|
|
2077
|
+
mime: "image/svg+xml"
|
|
2078
|
+
},
|
|
2079
|
+
"http://www.w3.org/1999/xhtml": {
|
|
2080
|
+
ext: "xhtml",
|
|
2081
|
+
mime: "application/xhtml+xml"
|
|
2082
|
+
},
|
|
2083
|
+
"http://www.opengis.net/kml/2.2": {
|
|
2084
|
+
ext: "kml",
|
|
2085
|
+
mime: "application/vnd.google-earth.kml+xml"
|
|
2086
|
+
},
|
|
2087
|
+
"http://www.opengis.net/gml": {
|
|
2088
|
+
ext: "gml",
|
|
2089
|
+
mime: "application/gml+xml"
|
|
1837
2090
|
}
|
|
1838
2091
|
};
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
if (options.format && options.indentBy.length > 0) {
|
|
1844
|
-
indentation = EOL;
|
|
1845
|
-
}
|
|
1846
|
-
return arrToStr(jArray, options, "", indentation);
|
|
1847
|
-
}
|
|
1848
|
-
function arrToStr(arr, options, jPath, indentation) {
|
|
1849
|
-
let xmlStr = "";
|
|
1850
|
-
let isPreviousElementTag = false;
|
|
1851
|
-
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
1852
|
-
const tagObj = arr[i2];
|
|
1853
|
-
const tagName = propName(tagObj);
|
|
1854
|
-
if (tagName === void 0) continue;
|
|
1855
|
-
let newJPath = "";
|
|
1856
|
-
if (jPath.length === 0) newJPath = tagName;
|
|
1857
|
-
else newJPath = `${jPath}.${tagName}`;
|
|
1858
|
-
if (tagName === options.textNodeName) {
|
|
1859
|
-
let tagText = tagObj[tagName];
|
|
1860
|
-
if (!isStopNode(newJPath, options)) {
|
|
1861
|
-
tagText = options.tagValueProcessor(tagName, tagText);
|
|
1862
|
-
tagText = replaceEntitiesValue(tagText, options);
|
|
1863
|
-
}
|
|
1864
|
-
if (isPreviousElementTag) {
|
|
1865
|
-
xmlStr += indentation;
|
|
1866
|
-
}
|
|
1867
|
-
xmlStr += tagText;
|
|
1868
|
-
isPreviousElementTag = false;
|
|
1869
|
-
continue;
|
|
1870
|
-
} else if (tagName === options.cdataPropName) {
|
|
1871
|
-
if (isPreviousElementTag) {
|
|
1872
|
-
xmlStr += indentation;
|
|
1873
|
-
}
|
|
1874
|
-
xmlStr += `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`;
|
|
1875
|
-
isPreviousElementTag = false;
|
|
1876
|
-
continue;
|
|
1877
|
-
} else if (tagName === options.commentPropName) {
|
|
1878
|
-
xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`;
|
|
1879
|
-
isPreviousElementTag = true;
|
|
1880
|
-
continue;
|
|
1881
|
-
} else if (tagName[0] === "?") {
|
|
1882
|
-
const attStr2 = attr_to_str(tagObj[":@"], options);
|
|
1883
|
-
const tempInd = tagName === "?xml" ? "" : indentation;
|
|
1884
|
-
let piTextNodeName = tagObj[tagName][0][options.textNodeName];
|
|
1885
|
-
piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : "";
|
|
1886
|
-
xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr2}?>`;
|
|
1887
|
-
isPreviousElementTag = true;
|
|
1888
|
-
continue;
|
|
1889
|
-
}
|
|
1890
|
-
let newIdentation = indentation;
|
|
1891
|
-
if (newIdentation !== "") {
|
|
1892
|
-
newIdentation += options.indentBy;
|
|
1893
|
-
}
|
|
1894
|
-
const attStr = attr_to_str(tagObj[":@"], options);
|
|
1895
|
-
const tagStart = indentation + `<${tagName}${attStr}`;
|
|
1896
|
-
const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);
|
|
1897
|
-
if (options.unpairedTags.indexOf(tagName) !== -1) {
|
|
1898
|
-
if (options.suppressUnpairedNode) xmlStr += tagStart + ">";
|
|
1899
|
-
else xmlStr += tagStart + "/>";
|
|
1900
|
-
} else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {
|
|
1901
|
-
xmlStr += tagStart + "/>";
|
|
1902
|
-
} else if (tagValue && tagValue.endsWith(">")) {
|
|
1903
|
-
xmlStr += tagStart + `>${tagValue}${indentation}</${tagName}>`;
|
|
1904
|
-
} else {
|
|
1905
|
-
xmlStr += tagStart + ">";
|
|
1906
|
-
if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes("</"))) {
|
|
1907
|
-
xmlStr += indentation + options.indentBy + tagValue + indentation;
|
|
1908
|
-
} else {
|
|
1909
|
-
xmlStr += tagValue;
|
|
1910
|
-
}
|
|
1911
|
-
xmlStr += `</${tagName}>`;
|
|
1912
|
-
}
|
|
1913
|
-
isPreviousElementTag = true;
|
|
1914
|
-
}
|
|
1915
|
-
return xmlStr;
|
|
1916
|
-
}
|
|
1917
|
-
function propName(obj) {
|
|
1918
|
-
const keys = Object.keys(obj);
|
|
1919
|
-
for (let i2 = 0; i2 < keys.length; i2++) {
|
|
1920
|
-
const key = keys[i2];
|
|
1921
|
-
if (!obj.hasOwnProperty(key)) continue;
|
|
1922
|
-
if (key !== ":@") return key;
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
function attr_to_str(attrMap, options) {
|
|
1926
|
-
let attrStr = "";
|
|
1927
|
-
if (attrMap && !options.ignoreAttributes) {
|
|
1928
|
-
for (let attr in attrMap) {
|
|
1929
|
-
if (!attrMap.hasOwnProperty(attr)) continue;
|
|
1930
|
-
let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
|
|
1931
|
-
attrVal = replaceEntitiesValue(attrVal, options);
|
|
1932
|
-
if (attrVal === true && options.suppressBooleanAttributes) {
|
|
1933
|
-
attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;
|
|
1934
|
-
} else {
|
|
1935
|
-
attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`;
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
return attrStr;
|
|
1940
|
-
}
|
|
1941
|
-
function isStopNode(jPath, options) {
|
|
1942
|
-
jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);
|
|
1943
|
-
let tagName = jPath.substr(jPath.lastIndexOf(".") + 1);
|
|
1944
|
-
for (let index in options.stopNodes) {
|
|
1945
|
-
if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true;
|
|
1946
|
-
}
|
|
1947
|
-
return false;
|
|
1948
|
-
}
|
|
1949
|
-
function replaceEntitiesValue(textValue, options) {
|
|
1950
|
-
if (textValue && textValue.length > 0 && options.processEntities) {
|
|
1951
|
-
for (let i2 = 0; i2 < options.entities.length; i2++) {
|
|
1952
|
-
const entity = options.entities[i2];
|
|
1953
|
-
textValue = textValue.replace(entity.regex, entity.val);
|
|
1954
|
-
}
|
|
1955
|
-
}
|
|
1956
|
-
return textValue;
|
|
1957
|
-
}
|
|
1958
|
-
var orderedJs2Xml = toXml;
|
|
1959
|
-
const buildFromOrderedJs = orderedJs2Xml;
|
|
1960
|
-
const getIgnoreAttributesFn = ignoreAttributes;
|
|
1961
|
-
const defaultOptions = {
|
|
1962
|
-
attributeNamePrefix: "@_",
|
|
1963
|
-
attributesGroupName: false,
|
|
1964
|
-
textNodeName: "#text",
|
|
1965
|
-
ignoreAttributes: true,
|
|
1966
|
-
cdataPropName: false,
|
|
1967
|
-
format: false,
|
|
1968
|
-
indentBy: " ",
|
|
1969
|
-
suppressEmptyNode: false,
|
|
1970
|
-
suppressUnpairedNode: true,
|
|
1971
|
-
suppressBooleanAttributes: true,
|
|
1972
|
-
tagValueProcessor: function(key, a2) {
|
|
1973
|
-
return a2;
|
|
2092
|
+
const rootNameMapping = {
|
|
2093
|
+
rss: {
|
|
2094
|
+
ext: "rss",
|
|
2095
|
+
mime: "application/rss+xml"
|
|
1974
2096
|
},
|
|
1975
|
-
|
|
1976
|
-
|
|
2097
|
+
"score-partwise": {
|
|
2098
|
+
ext: "musicxml",
|
|
2099
|
+
mime: "application/vnd.recordare.musicxml+xml"
|
|
1977
2100
|
},
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
entities: [
|
|
1982
|
-
{ regex: new RegExp("&", "g"), val: "&" },
|
|
1983
|
-
//it must be on top
|
|
1984
|
-
{ regex: new RegExp(">", "g"), val: ">" },
|
|
1985
|
-
{ regex: new RegExp("<", "g"), val: "<" },
|
|
1986
|
-
{ regex: new RegExp("'", "g"), val: "'" },
|
|
1987
|
-
{ regex: new RegExp('"', "g"), val: """ }
|
|
1988
|
-
],
|
|
1989
|
-
processEntities: true,
|
|
1990
|
-
stopNodes: [],
|
|
1991
|
-
// transformTagName: false,
|
|
1992
|
-
// transformAttributeName: false,
|
|
1993
|
-
oneListGroup: false
|
|
1994
|
-
};
|
|
1995
|
-
function Builder(options) {
|
|
1996
|
-
this.options = Object.assign({}, defaultOptions, options);
|
|
1997
|
-
if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
|
|
1998
|
-
this.isAttribute = function() {
|
|
1999
|
-
return false;
|
|
2000
|
-
};
|
|
2001
|
-
} else {
|
|
2002
|
-
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
|
|
2003
|
-
this.attrPrefixLen = this.options.attributeNamePrefix.length;
|
|
2004
|
-
this.isAttribute = isAttribute;
|
|
2005
|
-
}
|
|
2006
|
-
this.processTextOrObjNode = processTextOrObjNode;
|
|
2007
|
-
if (this.options.format) {
|
|
2008
|
-
this.indentate = indentate;
|
|
2009
|
-
this.tagEndChar = ">\n";
|
|
2010
|
-
this.newLine = "\n";
|
|
2011
|
-
} else {
|
|
2012
|
-
this.indentate = function() {
|
|
2013
|
-
return "";
|
|
2014
|
-
};
|
|
2015
|
-
this.tagEndChar = ">";
|
|
2016
|
-
this.newLine = "";
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
Builder.prototype.build = function(jObj) {
|
|
2020
|
-
if (this.options.preserveOrder) {
|
|
2021
|
-
return buildFromOrderedJs(jObj, this.options);
|
|
2022
|
-
} else {
|
|
2023
|
-
if (Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) {
|
|
2024
|
-
jObj = {
|
|
2025
|
-
[this.options.arrayNodeName]: jObj
|
|
2026
|
-
};
|
|
2027
|
-
}
|
|
2028
|
-
return this.j2x(jObj, 0, []).val;
|
|
2101
|
+
svg: {
|
|
2102
|
+
ext: "svg",
|
|
2103
|
+
mime: "image/svg+xml"
|
|
2029
2104
|
}
|
|
2030
2105
|
};
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
} else if (jObj[key] === null) {
|
|
2042
|
-
if (this.isAttribute(key)) {
|
|
2043
|
-
val2 += "";
|
|
2044
|
-
} else if (key[0] === "?") {
|
|
2045
|
-
val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar;
|
|
2046
|
-
} else {
|
|
2047
|
-
val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
|
|
2048
|
-
}
|
|
2049
|
-
} else if (jObj[key] instanceof Date) {
|
|
2050
|
-
val2 += this.buildTextValNode(jObj[key], key, "", level);
|
|
2051
|
-
} else if (typeof jObj[key] !== "object") {
|
|
2052
|
-
const attr = this.isAttribute(key);
|
|
2053
|
-
if (attr && !this.ignoreAttributesFn(attr, jPath)) {
|
|
2054
|
-
attrStr += this.buildAttrPairStr(attr, "" + jObj[key]);
|
|
2055
|
-
} else if (!attr) {
|
|
2056
|
-
if (key === this.options.textNodeName) {
|
|
2057
|
-
let newval = this.options.tagValueProcessor(key, "" + jObj[key]);
|
|
2058
|
-
val2 += this.replaceEntitiesValue(newval);
|
|
2059
|
-
} else {
|
|
2060
|
-
val2 += this.buildTextValNode(jObj[key], key, "", level);
|
|
2061
|
-
}
|
|
2106
|
+
class XmlTextDetector {
|
|
2107
|
+
constructor(options) {
|
|
2108
|
+
this.options = options ?? {};
|
|
2109
|
+
this.firstTag = true;
|
|
2110
|
+
this.onEnd = false;
|
|
2111
|
+
this.parser = sax.parser(true, { xmlns: true });
|
|
2112
|
+
this.nesting = 0;
|
|
2113
|
+
this.parser.onerror = (e2) => {
|
|
2114
|
+
if (e2.message.startsWith("Invalid character entity")) {
|
|
2115
|
+
return;
|
|
2062
2116
|
}
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
else if (item === null) {
|
|
2071
|
-
if (key[0] === "?") val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar;
|
|
2072
|
-
else val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
|
|
2073
|
-
} else if (typeof item === "object") {
|
|
2074
|
-
if (this.options.oneListGroup) {
|
|
2075
|
-
const result = this.j2x(item, level + 1, ajPath.concat(key));
|
|
2076
|
-
listTagVal += result.val;
|
|
2077
|
-
if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {
|
|
2078
|
-
listTagAttr += result.attrStr;
|
|
2079
|
-
}
|
|
2080
|
-
} else {
|
|
2081
|
-
listTagVal += this.processTextOrObjNode(item, key, level, ajPath);
|
|
2082
|
-
}
|
|
2083
|
-
} else {
|
|
2084
|
-
if (this.options.oneListGroup) {
|
|
2085
|
-
let textValue = this.options.tagValueProcessor(key, item);
|
|
2086
|
-
textValue = this.replaceEntitiesValue(textValue);
|
|
2087
|
-
listTagVal += textValue;
|
|
2088
|
-
} else {
|
|
2089
|
-
listTagVal += this.buildTextValNode(item, key, "", level);
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2117
|
+
this.fileType = void 0;
|
|
2118
|
+
this.onEnd = true;
|
|
2119
|
+
};
|
|
2120
|
+
this.parser.onopentag = (node) => {
|
|
2121
|
+
++this.nesting;
|
|
2122
|
+
if (!this.firstTag || this.onEnd) {
|
|
2123
|
+
return;
|
|
2092
2124
|
}
|
|
2093
|
-
|
|
2094
|
-
|
|
2125
|
+
this.firstTag = false;
|
|
2126
|
+
if (node.uri) {
|
|
2127
|
+
this.fileType = namespaceMapping[node.uri];
|
|
2128
|
+
} else if (node.name) {
|
|
2129
|
+
this.fileType = rootNameMapping[node.name.toLowerCase()];
|
|
2095
2130
|
}
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
if (this.options.attributesGroupName && key === this.options.attributesGroupName) {
|
|
2099
|
-
const Ks = Object.keys(jObj[key]);
|
|
2100
|
-
const L = Ks.length;
|
|
2101
|
-
for (let j2 = 0; j2 < L; j2++) {
|
|
2102
|
-
attrStr += this.buildAttrPairStr(Ks[j2], "" + jObj[key][Ks[j2]]);
|
|
2103
|
-
}
|
|
2104
|
-
} else {
|
|
2105
|
-
val2 += this.processTextOrObjNode(jObj[key], key, level, ajPath);
|
|
2131
|
+
if (this.fileType && !this.options.fullScan) {
|
|
2132
|
+
this.onEnd = true;
|
|
2106
2133
|
}
|
|
2107
|
-
}
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
};
|
|
2111
|
-
Builder.prototype.buildAttrPairStr = function(attrName, val2) {
|
|
2112
|
-
val2 = this.options.attributeValueProcessor(attrName, "" + val2);
|
|
2113
|
-
val2 = this.replaceEntitiesValue(val2);
|
|
2114
|
-
if (this.options.suppressBooleanAttributes && val2 === "true") {
|
|
2115
|
-
return " " + attrName;
|
|
2116
|
-
} else return " " + attrName + '="' + val2 + '"';
|
|
2117
|
-
};
|
|
2118
|
-
function processTextOrObjNode(object, key, level, ajPath) {
|
|
2119
|
-
const result = this.j2x(object, level + 1, ajPath.concat(key));
|
|
2120
|
-
if (object[this.options.textNodeName] !== void 0 && Object.keys(object).length === 1) {
|
|
2121
|
-
return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);
|
|
2122
|
-
} else {
|
|
2123
|
-
return this.buildObjectNode(result.val, key, result.attrStr, level);
|
|
2124
|
-
}
|
|
2125
|
-
}
|
|
2126
|
-
Builder.prototype.buildObjectNode = function(val2, key, attrStr, level) {
|
|
2127
|
-
if (val2 === "") {
|
|
2128
|
-
if (key[0] === "?") return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar;
|
|
2129
|
-
else {
|
|
2130
|
-
return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
|
2131
|
-
}
|
|
2132
|
-
} else {
|
|
2133
|
-
let tagEndExp = "</" + key + this.tagEndChar;
|
|
2134
|
-
let piClosingChar = "";
|
|
2135
|
-
if (key[0] === "?") {
|
|
2136
|
-
piClosingChar = "?";
|
|
2137
|
-
tagEndExp = "";
|
|
2138
|
-
}
|
|
2139
|
-
if ((attrStr || attrStr === "") && val2.indexOf("<") === -1) {
|
|
2140
|
-
return this.indentate(level) + "<" + key + attrStr + piClosingChar + ">" + val2 + tagEndExp;
|
|
2141
|
-
} else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {
|
|
2142
|
-
return this.indentate(level) + `<!--${val2}-->` + this.newLine;
|
|
2143
|
-
} else {
|
|
2144
|
-
return this.indentate(level) + "<" + key + attrStr + piClosingChar + this.tagEndChar + val2 + this.indentate(level) + tagEndExp;
|
|
2145
|
-
}
|
|
2146
|
-
}
|
|
2147
|
-
};
|
|
2148
|
-
Builder.prototype.closeTag = function(key) {
|
|
2149
|
-
let closeTag = "";
|
|
2150
|
-
if (this.options.unpairedTags.indexOf(key) !== -1) {
|
|
2151
|
-
if (!this.options.suppressUnpairedNode) closeTag = "/";
|
|
2152
|
-
} else if (this.options.suppressEmptyNode) {
|
|
2153
|
-
closeTag = "/";
|
|
2154
|
-
} else {
|
|
2155
|
-
closeTag = `></${key}`;
|
|
2134
|
+
};
|
|
2135
|
+
this.parser.onclosetag = () => {
|
|
2136
|
+
--this.nesting;
|
|
2137
|
+
};
|
|
2156
2138
|
}
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
Builder.prototype.buildTextValNode = function(val2, key, attrStr, level) {
|
|
2160
|
-
if (this.options.cdataPropName !== false && key === this.options.cdataPropName) {
|
|
2161
|
-
return this.indentate(level) + `<![CDATA[${val2}]]>` + this.newLine;
|
|
2162
|
-
} else if (this.options.commentPropName !== false && key === this.options.commentPropName) {
|
|
2163
|
-
return this.indentate(level) + `<!--${val2}-->` + this.newLine;
|
|
2164
|
-
} else if (key[0] === "?") {
|
|
2165
|
-
return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar;
|
|
2166
|
-
} else {
|
|
2167
|
-
let textValue = this.options.tagValueProcessor(key, val2);
|
|
2168
|
-
textValue = this.replaceEntitiesValue(textValue);
|
|
2169
|
-
if (textValue === "") {
|
|
2170
|
-
return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
|
2171
|
-
} else {
|
|
2172
|
-
return this.indentate(level) + "<" + key + attrStr + ">" + textValue + "</" + key + this.tagEndChar;
|
|
2173
|
-
}
|
|
2139
|
+
write(text) {
|
|
2140
|
+
this.parser.write(text);
|
|
2174
2141
|
}
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
for (let i2 = 0; i2 < this.options.entities.length; i2++) {
|
|
2179
|
-
const entity = this.options.entities[i2];
|
|
2180
|
-
textValue = textValue.replace(entity.regex, entity.val);
|
|
2181
|
-
}
|
|
2142
|
+
close() {
|
|
2143
|
+
this.parser.close();
|
|
2144
|
+
this.onEnd = true;
|
|
2182
2145
|
}
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
function indentate(level) {
|
|
2186
|
-
return this.options.indentBy.repeat(level);
|
|
2187
|
-
}
|
|
2188
|
-
function isAttribute(name) {
|
|
2189
|
-
if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {
|
|
2190
|
-
return name.substr(this.attrPrefixLen);
|
|
2191
|
-
} else {
|
|
2192
|
-
return false;
|
|
2146
|
+
isValid() {
|
|
2147
|
+
return this.nesting === 0;
|
|
2193
2148
|
}
|
|
2194
2149
|
}
|
|
2195
|
-
var json2xml = Builder;
|
|
2196
|
-
const validator = validator$2;
|
|
2197
|
-
const XMLParser2 = XMLParser_1;
|
|
2198
|
-
const XMLBuilder = json2xml;
|
|
2199
|
-
var fxp = {
|
|
2200
|
-
XMLParser: XMLParser2,
|
|
2201
|
-
XMLValidator: validator,
|
|
2202
|
-
XMLBuilder
|
|
2203
|
-
};
|
|
2204
2150
|
function isSvg(string) {
|
|
2205
2151
|
if (typeof string !== "string") {
|
|
2206
2152
|
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
@@ -2209,23 +2155,9 @@ function isSvg(string) {
|
|
|
2209
2155
|
if (string.length === 0) {
|
|
2210
2156
|
return false;
|
|
2211
2157
|
}
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
let jsonObject;
|
|
2216
|
-
const parser = new fxp.XMLParser();
|
|
2217
|
-
try {
|
|
2218
|
-
jsonObject = parser.parse(string);
|
|
2219
|
-
} catch {
|
|
2220
|
-
return false;
|
|
2221
|
-
}
|
|
2222
|
-
if (!jsonObject) {
|
|
2223
|
-
return false;
|
|
2224
|
-
}
|
|
2225
|
-
if (!Object.keys(jsonObject).some((x) => x.toLowerCase() === "svg")) {
|
|
2226
|
-
return false;
|
|
2227
|
-
}
|
|
2228
|
-
return true;
|
|
2158
|
+
const xmlTextDetector = new XmlTextDetector();
|
|
2159
|
+
xmlTextDetector.write(string);
|
|
2160
|
+
return xmlTextDetector.isValid() && xmlTextDetector.fileType?.ext === "svg";
|
|
2229
2161
|
}
|
|
2230
2162
|
class View {
|
|
2231
2163
|
_view;
|
|
@@ -2251,6 +2183,9 @@ class View {
|
|
|
2251
2183
|
get getContents() {
|
|
2252
2184
|
return this._view.getContents;
|
|
2253
2185
|
}
|
|
2186
|
+
get hidden() {
|
|
2187
|
+
return this._view.hidden;
|
|
2188
|
+
}
|
|
2254
2189
|
get icon() {
|
|
2255
2190
|
return this._view.icon;
|
|
2256
2191
|
}
|
|
@@ -2307,6 +2242,9 @@ const isValidView = function(view) {
|
|
|
2307
2242
|
if (!view.getContents || typeof view.getContents !== "function") {
|
|
2308
2243
|
throw new Error("View getContents is required and must be a function");
|
|
2309
2244
|
}
|
|
2245
|
+
if ("hidden" in view && typeof view.hidden !== "boolean") {
|
|
2246
|
+
throw new Error("View hidden must be a boolean");
|
|
2247
|
+
}
|
|
2310
2248
|
if (!view.icon || typeof view.icon !== "string" || !isSvg(view.icon)) {
|
|
2311
2249
|
throw new Error("View icon is required and must be a valid svg string");
|
|
2312
2250
|
}
|
|
@@ -2340,412 +2278,479 @@ const isValidView = function(view) {
|
|
|
2340
2278
|
}
|
|
2341
2279
|
return true;
|
|
2342
2280
|
};
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
const
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
"
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
(function(module, exports) {
|
|
2373
|
-
const {
|
|
2374
|
-
MAX_SAFE_COMPONENT_LENGTH: MAX_SAFE_COMPONENT_LENGTH2,
|
|
2375
|
-
MAX_SAFE_BUILD_LENGTH: MAX_SAFE_BUILD_LENGTH2,
|
|
2376
|
-
MAX_LENGTH: MAX_LENGTH2
|
|
2377
|
-
} = constants;
|
|
2378
|
-
const debug2 = debug_1;
|
|
2379
|
-
exports = module.exports = {};
|
|
2380
|
-
const re2 = exports.re = [];
|
|
2381
|
-
const safeRe = exports.safeRe = [];
|
|
2382
|
-
const src = exports.src = [];
|
|
2383
|
-
const t3 = exports.t = {};
|
|
2384
|
-
let R = 0;
|
|
2385
|
-
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
2386
|
-
const safeRegexReplacements = [
|
|
2387
|
-
["\\s", 1],
|
|
2388
|
-
["\\d", MAX_LENGTH2],
|
|
2389
|
-
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH2]
|
|
2281
|
+
var debug_1;
|
|
2282
|
+
var hasRequiredDebug;
|
|
2283
|
+
function requireDebug() {
|
|
2284
|
+
if (hasRequiredDebug) return debug_1;
|
|
2285
|
+
hasRequiredDebug = 1;
|
|
2286
|
+
const debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
2287
|
+
};
|
|
2288
|
+
debug_1 = debug;
|
|
2289
|
+
return debug_1;
|
|
2290
|
+
}
|
|
2291
|
+
var constants;
|
|
2292
|
+
var hasRequiredConstants;
|
|
2293
|
+
function requireConstants() {
|
|
2294
|
+
if (hasRequiredConstants) return constants;
|
|
2295
|
+
hasRequiredConstants = 1;
|
|
2296
|
+
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
2297
|
+
const MAX_LENGTH = 256;
|
|
2298
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
2299
|
+
9007199254740991;
|
|
2300
|
+
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
2301
|
+
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
2302
|
+
const RELEASE_TYPES = [
|
|
2303
|
+
"major",
|
|
2304
|
+
"premajor",
|
|
2305
|
+
"minor",
|
|
2306
|
+
"preminor",
|
|
2307
|
+
"patch",
|
|
2308
|
+
"prepatch",
|
|
2309
|
+
"prerelease"
|
|
2390
2310
|
];
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2311
|
+
constants = {
|
|
2312
|
+
MAX_LENGTH,
|
|
2313
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
2314
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
2315
|
+
MAX_SAFE_INTEGER,
|
|
2316
|
+
RELEASE_TYPES,
|
|
2317
|
+
SEMVER_SPEC_VERSION,
|
|
2318
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
2319
|
+
FLAG_LOOSE: 2
|
|
2320
|
+
};
|
|
2321
|
+
return constants;
|
|
2322
|
+
}
|
|
2323
|
+
var re = { exports: {} };
|
|
2324
|
+
var hasRequiredRe;
|
|
2325
|
+
function requireRe() {
|
|
2326
|
+
if (hasRequiredRe) return re.exports;
|
|
2327
|
+
hasRequiredRe = 1;
|
|
2328
|
+
(function(module, exports) {
|
|
2329
|
+
const {
|
|
2330
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
2331
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
2332
|
+
MAX_LENGTH
|
|
2333
|
+
} = requireConstants();
|
|
2334
|
+
const debug = requireDebug();
|
|
2335
|
+
exports = module.exports = {};
|
|
2336
|
+
const re2 = exports.re = [];
|
|
2337
|
+
const safeRe = exports.safeRe = [];
|
|
2338
|
+
const src = exports.src = [];
|
|
2339
|
+
const t2 = exports.t = {};
|
|
2340
|
+
let R = 0;
|
|
2341
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
2342
|
+
const safeRegexReplacements = [
|
|
2343
|
+
["\\s", 1],
|
|
2344
|
+
["\\d", MAX_LENGTH],
|
|
2345
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
2346
|
+
];
|
|
2347
|
+
const makeSafeRegex = (value) => {
|
|
2348
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
2349
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
2350
|
+
}
|
|
2351
|
+
return value;
|
|
2352
|
+
};
|
|
2353
|
+
const createToken = (name, value, isGlobal) => {
|
|
2354
|
+
const safe = makeSafeRegex(value);
|
|
2355
|
+
const index = R++;
|
|
2356
|
+
debug(name, index, value);
|
|
2357
|
+
t2[name] = index;
|
|
2358
|
+
src[index] = value;
|
|
2359
|
+
re2[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
2360
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
2361
|
+
};
|
|
2362
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
2363
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
2364
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
2365
|
+
createToken("MAINVERSION", `(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})`);
|
|
2366
|
+
createToken("MAINVERSIONLOOSE", `(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})`);
|
|
2367
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t2.NUMERICIDENTIFIER]}|${src[t2.NONNUMERICIDENTIFIER]})`);
|
|
2368
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t2.NUMERICIDENTIFIERLOOSE]}|${src[t2.NONNUMERICIDENTIFIER]})`);
|
|
2369
|
+
createToken("PRERELEASE", `(?:-(${src[t2.PRERELEASEIDENTIFIER]}(?:\\.${src[t2.PRERELEASEIDENTIFIER]})*))`);
|
|
2370
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t2.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t2.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
2371
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
2372
|
+
createToken("BUILD", `(?:\\+(${src[t2.BUILDIDENTIFIER]}(?:\\.${src[t2.BUILDIDENTIFIER]})*))`);
|
|
2373
|
+
createToken("FULLPLAIN", `v?${src[t2.MAINVERSION]}${src[t2.PRERELEASE]}?${src[t2.BUILD]}?`);
|
|
2374
|
+
createToken("FULL", `^${src[t2.FULLPLAIN]}$`);
|
|
2375
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t2.MAINVERSIONLOOSE]}${src[t2.PRERELEASELOOSE]}?${src[t2.BUILD]}?`);
|
|
2376
|
+
createToken("LOOSE", `^${src[t2.LOOSEPLAIN]}$`);
|
|
2377
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
2378
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t2.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
2379
|
+
createToken("XRANGEIDENTIFIER", `${src[t2.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
2380
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t2.XRANGEIDENTIFIER]})(?:\\.(${src[t2.XRANGEIDENTIFIER]})(?:\\.(${src[t2.XRANGEIDENTIFIER]})(?:${src[t2.PRERELEASE]})?${src[t2.BUILD]}?)?)?`);
|
|
2381
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:${src[t2.PRERELEASELOOSE]})?${src[t2.BUILD]}?)?)?`);
|
|
2382
|
+
createToken("XRANGE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAIN]}$`);
|
|
2383
|
+
createToken("XRANGELOOSE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAINLOOSE]}$`);
|
|
2384
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
2385
|
+
createToken("COERCE", `${src[t2.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
2386
|
+
createToken("COERCEFULL", src[t2.COERCEPLAIN] + `(?:${src[t2.PRERELEASE]})?(?:${src[t2.BUILD]})?(?:$|[^\\d])`);
|
|
2387
|
+
createToken("COERCERTL", src[t2.COERCE], true);
|
|
2388
|
+
createToken("COERCERTLFULL", src[t2.COERCEFULL], true);
|
|
2389
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
2390
|
+
createToken("TILDETRIM", `(\\s*)${src[t2.LONETILDE]}\\s+`, true);
|
|
2391
|
+
exports.tildeTrimReplace = "$1~";
|
|
2392
|
+
createToken("TILDE", `^${src[t2.LONETILDE]}${src[t2.XRANGEPLAIN]}$`);
|
|
2393
|
+
createToken("TILDELOOSE", `^${src[t2.LONETILDE]}${src[t2.XRANGEPLAINLOOSE]}$`);
|
|
2394
|
+
createToken("LONECARET", "(?:\\^)");
|
|
2395
|
+
createToken("CARETTRIM", `(\\s*)${src[t2.LONECARET]}\\s+`, true);
|
|
2396
|
+
exports.caretTrimReplace = "$1^";
|
|
2397
|
+
createToken("CARET", `^${src[t2.LONECARET]}${src[t2.XRANGEPLAIN]}$`);
|
|
2398
|
+
createToken("CARETLOOSE", `^${src[t2.LONECARET]}${src[t2.XRANGEPLAINLOOSE]}$`);
|
|
2399
|
+
createToken("COMPARATORLOOSE", `^${src[t2.GTLT]}\\s*(${src[t2.LOOSEPLAIN]})$|^$`);
|
|
2400
|
+
createToken("COMPARATOR", `^${src[t2.GTLT]}\\s*(${src[t2.FULLPLAIN]})$|^$`);
|
|
2401
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t2.GTLT]}\\s*(${src[t2.LOOSEPLAIN]}|${src[t2.XRANGEPLAIN]})`, true);
|
|
2402
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
2403
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t2.XRANGEPLAIN]})\\s+-\\s+(${src[t2.XRANGEPLAIN]})\\s*$`);
|
|
2404
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t2.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t2.XRANGEPLAINLOOSE]})\\s*$`);
|
|
2405
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
2406
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
2407
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
2408
|
+
})(re, re.exports);
|
|
2409
|
+
return re.exports;
|
|
2410
|
+
}
|
|
2411
|
+
var parseOptions_1;
|
|
2412
|
+
var hasRequiredParseOptions;
|
|
2413
|
+
function requireParseOptions() {
|
|
2414
|
+
if (hasRequiredParseOptions) return parseOptions_1;
|
|
2415
|
+
hasRequiredParseOptions = 1;
|
|
2416
|
+
const looseOption = Object.freeze({ loose: true });
|
|
2417
|
+
const emptyOpts = Object.freeze({});
|
|
2418
|
+
const parseOptions = (options) => {
|
|
2419
|
+
if (!options) {
|
|
2420
|
+
return emptyOpts;
|
|
2421
|
+
}
|
|
2422
|
+
if (typeof options !== "object") {
|
|
2423
|
+
return looseOption;
|
|
2424
|
+
}
|
|
2425
|
+
return options;
|
|
2396
2426
|
};
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2427
|
+
parseOptions_1 = parseOptions;
|
|
2428
|
+
return parseOptions_1;
|
|
2429
|
+
}
|
|
2430
|
+
var identifiers;
|
|
2431
|
+
var hasRequiredIdentifiers;
|
|
2432
|
+
function requireIdentifiers() {
|
|
2433
|
+
if (hasRequiredIdentifiers) return identifiers;
|
|
2434
|
+
hasRequiredIdentifiers = 1;
|
|
2435
|
+
const numeric = /^[0-9]+$/;
|
|
2436
|
+
const compareIdentifiers = (a2, b2) => {
|
|
2437
|
+
const anum = numeric.test(a2);
|
|
2438
|
+
const bnum = numeric.test(b2);
|
|
2439
|
+
if (anum && bnum) {
|
|
2440
|
+
a2 = +a2;
|
|
2441
|
+
b2 = +b2;
|
|
2442
|
+
}
|
|
2443
|
+
return a2 === b2 ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a2 < b2 ? -1 : 1;
|
|
2405
2444
|
};
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
return options;
|
|
2464
|
-
};
|
|
2465
|
-
var parseOptions_1 = parseOptions$1;
|
|
2466
|
-
const numeric = /^[0-9]+$/;
|
|
2467
|
-
const compareIdentifiers$1 = (a2, b2) => {
|
|
2468
|
-
const anum = numeric.test(a2);
|
|
2469
|
-
const bnum = numeric.test(b2);
|
|
2470
|
-
if (anum && bnum) {
|
|
2471
|
-
a2 = +a2;
|
|
2472
|
-
b2 = +b2;
|
|
2473
|
-
}
|
|
2474
|
-
return a2 === b2 ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a2 < b2 ? -1 : 1;
|
|
2475
|
-
};
|
|
2476
|
-
const rcompareIdentifiers = (a2, b2) => compareIdentifiers$1(b2, a2);
|
|
2477
|
-
var identifiers = {
|
|
2478
|
-
compareIdentifiers: compareIdentifiers$1,
|
|
2479
|
-
rcompareIdentifiers
|
|
2480
|
-
};
|
|
2481
|
-
const debug = debug_1;
|
|
2482
|
-
const { MAX_LENGTH, MAX_SAFE_INTEGER } = constants;
|
|
2483
|
-
const { safeRe: re, t: t2 } = reExports;
|
|
2484
|
-
const parseOptions = parseOptions_1;
|
|
2485
|
-
const { compareIdentifiers } = identifiers;
|
|
2486
|
-
let SemVer$2 = class SemVer {
|
|
2487
|
-
constructor(version, options) {
|
|
2488
|
-
options = parseOptions(options);
|
|
2489
|
-
if (version instanceof SemVer) {
|
|
2490
|
-
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
2491
|
-
return version;
|
|
2445
|
+
const rcompareIdentifiers = (a2, b2) => compareIdentifiers(b2, a2);
|
|
2446
|
+
identifiers = {
|
|
2447
|
+
compareIdentifiers,
|
|
2448
|
+
rcompareIdentifiers
|
|
2449
|
+
};
|
|
2450
|
+
return identifiers;
|
|
2451
|
+
}
|
|
2452
|
+
var semver;
|
|
2453
|
+
var hasRequiredSemver;
|
|
2454
|
+
function requireSemver() {
|
|
2455
|
+
if (hasRequiredSemver) return semver;
|
|
2456
|
+
hasRequiredSemver = 1;
|
|
2457
|
+
const debug = requireDebug();
|
|
2458
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = requireConstants();
|
|
2459
|
+
const { safeRe: re2, t: t2 } = requireRe();
|
|
2460
|
+
const parseOptions = requireParseOptions();
|
|
2461
|
+
const { compareIdentifiers } = requireIdentifiers();
|
|
2462
|
+
class SemVer {
|
|
2463
|
+
constructor(version, options) {
|
|
2464
|
+
options = parseOptions(options);
|
|
2465
|
+
if (version instanceof SemVer) {
|
|
2466
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
2467
|
+
return version;
|
|
2468
|
+
} else {
|
|
2469
|
+
version = version.version;
|
|
2470
|
+
}
|
|
2471
|
+
} else if (typeof version !== "string") {
|
|
2472
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
2473
|
+
}
|
|
2474
|
+
if (version.length > MAX_LENGTH) {
|
|
2475
|
+
throw new TypeError(
|
|
2476
|
+
`version is longer than ${MAX_LENGTH} characters`
|
|
2477
|
+
);
|
|
2478
|
+
}
|
|
2479
|
+
debug("SemVer", version, options);
|
|
2480
|
+
this.options = options;
|
|
2481
|
+
this.loose = !!options.loose;
|
|
2482
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
2483
|
+
const m2 = version.trim().match(options.loose ? re2[t2.LOOSE] : re2[t2.FULL]);
|
|
2484
|
+
if (!m2) {
|
|
2485
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
2486
|
+
}
|
|
2487
|
+
this.raw = version;
|
|
2488
|
+
this.major = +m2[1];
|
|
2489
|
+
this.minor = +m2[2];
|
|
2490
|
+
this.patch = +m2[3];
|
|
2491
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
2492
|
+
throw new TypeError("Invalid major version");
|
|
2493
|
+
}
|
|
2494
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
2495
|
+
throw new TypeError("Invalid minor version");
|
|
2496
|
+
}
|
|
2497
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
2498
|
+
throw new TypeError("Invalid patch version");
|
|
2499
|
+
}
|
|
2500
|
+
if (!m2[4]) {
|
|
2501
|
+
this.prerelease = [];
|
|
2492
2502
|
} else {
|
|
2493
|
-
|
|
2503
|
+
this.prerelease = m2[4].split(".").map((id) => {
|
|
2504
|
+
if (/^[0-9]+$/.test(id)) {
|
|
2505
|
+
const num = +id;
|
|
2506
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
2507
|
+
return num;
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
return id;
|
|
2511
|
+
});
|
|
2494
2512
|
}
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
}
|
|
2498
|
-
if (version.length > MAX_LENGTH) {
|
|
2499
|
-
throw new TypeError(
|
|
2500
|
-
`version is longer than ${MAX_LENGTH} characters`
|
|
2501
|
-
);
|
|
2502
|
-
}
|
|
2503
|
-
debug("SemVer", version, options);
|
|
2504
|
-
this.options = options;
|
|
2505
|
-
this.loose = !!options.loose;
|
|
2506
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
2507
|
-
const m2 = version.trim().match(options.loose ? re[t2.LOOSE] : re[t2.FULL]);
|
|
2508
|
-
if (!m2) {
|
|
2509
|
-
throw new TypeError(`Invalid Version: ${version}`);
|
|
2513
|
+
this.build = m2[5] ? m2[5].split(".") : [];
|
|
2514
|
+
this.format();
|
|
2510
2515
|
}
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
}
|
|
2518
|
-
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
2519
|
-
throw new TypeError("Invalid minor version");
|
|
2516
|
+
format() {
|
|
2517
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
2518
|
+
if (this.prerelease.length) {
|
|
2519
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
2520
|
+
}
|
|
2521
|
+
return this.version;
|
|
2520
2522
|
}
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
+
toString() {
|
|
2524
|
+
return this.version;
|
|
2523
2525
|
}
|
|
2524
|
-
|
|
2525
|
-
this.
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
const num = +id;
|
|
2530
|
-
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
2531
|
-
return num;
|
|
2532
|
-
}
|
|
2526
|
+
compare(other) {
|
|
2527
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
2528
|
+
if (!(other instanceof SemVer)) {
|
|
2529
|
+
if (typeof other === "string" && other === this.version) {
|
|
2530
|
+
return 0;
|
|
2533
2531
|
}
|
|
2534
|
-
|
|
2535
|
-
}
|
|
2536
|
-
|
|
2537
|
-
this.build = m2[5] ? m2[5].split(".") : [];
|
|
2538
|
-
this.format();
|
|
2539
|
-
}
|
|
2540
|
-
format() {
|
|
2541
|
-
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
2542
|
-
if (this.prerelease.length) {
|
|
2543
|
-
this.version += `-${this.prerelease.join(".")}`;
|
|
2544
|
-
}
|
|
2545
|
-
return this.version;
|
|
2546
|
-
}
|
|
2547
|
-
toString() {
|
|
2548
|
-
return this.version;
|
|
2549
|
-
}
|
|
2550
|
-
compare(other) {
|
|
2551
|
-
debug("SemVer.compare", this.version, this.options, other);
|
|
2552
|
-
if (!(other instanceof SemVer)) {
|
|
2553
|
-
if (typeof other === "string" && other === this.version) {
|
|
2532
|
+
other = new SemVer(other, this.options);
|
|
2533
|
+
}
|
|
2534
|
+
if (other.version === this.version) {
|
|
2554
2535
|
return 0;
|
|
2555
2536
|
}
|
|
2556
|
-
|
|
2537
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
2557
2538
|
}
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
compareMain(other) {
|
|
2564
|
-
if (!(other instanceof SemVer)) {
|
|
2565
|
-
other = new SemVer(other, this.options);
|
|
2566
|
-
}
|
|
2567
|
-
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
2568
|
-
}
|
|
2569
|
-
comparePre(other) {
|
|
2570
|
-
if (!(other instanceof SemVer)) {
|
|
2571
|
-
other = new SemVer(other, this.options);
|
|
2572
|
-
}
|
|
2573
|
-
if (this.prerelease.length && !other.prerelease.length) {
|
|
2574
|
-
return -1;
|
|
2575
|
-
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
2576
|
-
return 1;
|
|
2577
|
-
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
2578
|
-
return 0;
|
|
2539
|
+
compareMain(other) {
|
|
2540
|
+
if (!(other instanceof SemVer)) {
|
|
2541
|
+
other = new SemVer(other, this.options);
|
|
2542
|
+
}
|
|
2543
|
+
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
2579
2544
|
}
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
if (a2 === void 0 && b2 === void 0) {
|
|
2586
|
-
return 0;
|
|
2587
|
-
} else if (b2 === void 0) {
|
|
2588
|
-
return 1;
|
|
2589
|
-
} else if (a2 === void 0) {
|
|
2545
|
+
comparePre(other) {
|
|
2546
|
+
if (!(other instanceof SemVer)) {
|
|
2547
|
+
other = new SemVer(other, this.options);
|
|
2548
|
+
}
|
|
2549
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
2590
2550
|
return -1;
|
|
2591
|
-
} else if (
|
|
2592
|
-
|
|
2593
|
-
} else {
|
|
2594
|
-
return
|
|
2551
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
2552
|
+
return 1;
|
|
2553
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
2554
|
+
return 0;
|
|
2595
2555
|
}
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2556
|
+
let i2 = 0;
|
|
2557
|
+
do {
|
|
2558
|
+
const a2 = this.prerelease[i2];
|
|
2559
|
+
const b2 = other.prerelease[i2];
|
|
2560
|
+
debug("prerelease compare", i2, a2, b2);
|
|
2561
|
+
if (a2 === void 0 && b2 === void 0) {
|
|
2562
|
+
return 0;
|
|
2563
|
+
} else if (b2 === void 0) {
|
|
2564
|
+
return 1;
|
|
2565
|
+
} else if (a2 === void 0) {
|
|
2566
|
+
return -1;
|
|
2567
|
+
} else if (a2 === b2) {
|
|
2568
|
+
continue;
|
|
2569
|
+
} else {
|
|
2570
|
+
return compareIdentifiers(a2, b2);
|
|
2571
|
+
}
|
|
2572
|
+
} while (++i2);
|
|
2601
2573
|
}
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
const b2 = other.build[i2];
|
|
2606
|
-
debug("build compare", i2, a2, b2);
|
|
2607
|
-
if (a2 === void 0 && b2 === void 0) {
|
|
2608
|
-
return 0;
|
|
2609
|
-
} else if (b2 === void 0) {
|
|
2610
|
-
return 1;
|
|
2611
|
-
} else if (a2 === void 0) {
|
|
2612
|
-
return -1;
|
|
2613
|
-
} else if (a2 === b2) {
|
|
2614
|
-
continue;
|
|
2615
|
-
} else {
|
|
2616
|
-
return compareIdentifiers(a2, b2);
|
|
2574
|
+
compareBuild(other) {
|
|
2575
|
+
if (!(other instanceof SemVer)) {
|
|
2576
|
+
other = new SemVer(other, this.options);
|
|
2617
2577
|
}
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
this.patch = 0;
|
|
2634
|
-
this.minor++;
|
|
2635
|
-
this.inc("pre", identifier, identifierBase);
|
|
2636
|
-
break;
|
|
2637
|
-
case "prepatch":
|
|
2638
|
-
this.prerelease.length = 0;
|
|
2639
|
-
this.inc("patch", identifier, identifierBase);
|
|
2640
|
-
this.inc("pre", identifier, identifierBase);
|
|
2641
|
-
break;
|
|
2642
|
-
case "prerelease":
|
|
2643
|
-
if (this.prerelease.length === 0) {
|
|
2644
|
-
this.inc("patch", identifier, identifierBase);
|
|
2578
|
+
let i2 = 0;
|
|
2579
|
+
do {
|
|
2580
|
+
const a2 = this.build[i2];
|
|
2581
|
+
const b2 = other.build[i2];
|
|
2582
|
+
debug("build compare", i2, a2, b2);
|
|
2583
|
+
if (a2 === void 0 && b2 === void 0) {
|
|
2584
|
+
return 0;
|
|
2585
|
+
} else if (b2 === void 0) {
|
|
2586
|
+
return 1;
|
|
2587
|
+
} else if (a2 === void 0) {
|
|
2588
|
+
return -1;
|
|
2589
|
+
} else if (a2 === b2) {
|
|
2590
|
+
continue;
|
|
2591
|
+
} else {
|
|
2592
|
+
return compareIdentifiers(a2, b2);
|
|
2645
2593
|
}
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2594
|
+
} while (++i2);
|
|
2595
|
+
}
|
|
2596
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
2597
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
2598
|
+
inc(release, identifier, identifierBase) {
|
|
2599
|
+
switch (release) {
|
|
2600
|
+
case "premajor":
|
|
2601
|
+
this.prerelease.length = 0;
|
|
2602
|
+
this.patch = 0;
|
|
2603
|
+
this.minor = 0;
|
|
2650
2604
|
this.major++;
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
case "minor":
|
|
2657
|
-
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
2605
|
+
this.inc("pre", identifier, identifierBase);
|
|
2606
|
+
break;
|
|
2607
|
+
case "preminor":
|
|
2608
|
+
this.prerelease.length = 0;
|
|
2609
|
+
this.patch = 0;
|
|
2658
2610
|
this.minor++;
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
if (!identifier && identifierBase === false) {
|
|
2672
|
-
throw new Error("invalid increment argument: identifier is empty");
|
|
2673
|
-
}
|
|
2674
|
-
if (this.prerelease.length === 0) {
|
|
2675
|
-
this.prerelease = [base];
|
|
2676
|
-
} else {
|
|
2677
|
-
let i2 = this.prerelease.length;
|
|
2678
|
-
while (--i2 >= 0) {
|
|
2679
|
-
if (typeof this.prerelease[i2] === "number") {
|
|
2680
|
-
this.prerelease[i2]++;
|
|
2681
|
-
i2 = -2;
|
|
2682
|
-
}
|
|
2611
|
+
this.inc("pre", identifier, identifierBase);
|
|
2612
|
+
break;
|
|
2613
|
+
case "prepatch":
|
|
2614
|
+
this.prerelease.length = 0;
|
|
2615
|
+
this.inc("patch", identifier, identifierBase);
|
|
2616
|
+
this.inc("pre", identifier, identifierBase);
|
|
2617
|
+
break;
|
|
2618
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
2619
|
+
// prepatch.
|
|
2620
|
+
case "prerelease":
|
|
2621
|
+
if (this.prerelease.length === 0) {
|
|
2622
|
+
this.inc("patch", identifier, identifierBase);
|
|
2683
2623
|
}
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
this.
|
|
2624
|
+
this.inc("pre", identifier, identifierBase);
|
|
2625
|
+
break;
|
|
2626
|
+
case "major":
|
|
2627
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
2628
|
+
this.major++;
|
|
2689
2629
|
}
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2630
|
+
this.minor = 0;
|
|
2631
|
+
this.patch = 0;
|
|
2632
|
+
this.prerelease = [];
|
|
2633
|
+
break;
|
|
2634
|
+
case "minor":
|
|
2635
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
2636
|
+
this.minor++;
|
|
2637
|
+
}
|
|
2638
|
+
this.patch = 0;
|
|
2639
|
+
this.prerelease = [];
|
|
2640
|
+
break;
|
|
2641
|
+
case "patch":
|
|
2642
|
+
if (this.prerelease.length === 0) {
|
|
2643
|
+
this.patch++;
|
|
2695
2644
|
}
|
|
2696
|
-
|
|
2697
|
-
|
|
2645
|
+
this.prerelease = [];
|
|
2646
|
+
break;
|
|
2647
|
+
// This probably shouldn't be used publicly.
|
|
2648
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
2649
|
+
case "pre": {
|
|
2650
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
2651
|
+
if (!identifier && identifierBase === false) {
|
|
2652
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
2653
|
+
}
|
|
2654
|
+
if (this.prerelease.length === 0) {
|
|
2655
|
+
this.prerelease = [base];
|
|
2656
|
+
} else {
|
|
2657
|
+
let i2 = this.prerelease.length;
|
|
2658
|
+
while (--i2 >= 0) {
|
|
2659
|
+
if (typeof this.prerelease[i2] === "number") {
|
|
2660
|
+
this.prerelease[i2]++;
|
|
2661
|
+
i2 = -2;
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
if (i2 === -1) {
|
|
2665
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
2666
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
2667
|
+
}
|
|
2668
|
+
this.prerelease.push(base);
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
if (identifier) {
|
|
2672
|
+
let prerelease = [identifier, base];
|
|
2673
|
+
if (identifierBase === false) {
|
|
2674
|
+
prerelease = [identifier];
|
|
2675
|
+
}
|
|
2676
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
2677
|
+
if (isNaN(this.prerelease[1])) {
|
|
2678
|
+
this.prerelease = prerelease;
|
|
2679
|
+
}
|
|
2680
|
+
} else {
|
|
2698
2681
|
this.prerelease = prerelease;
|
|
2699
2682
|
}
|
|
2700
|
-
} else {
|
|
2701
|
-
this.prerelease = prerelease;
|
|
2702
2683
|
}
|
|
2684
|
+
break;
|
|
2703
2685
|
}
|
|
2704
|
-
|
|
2686
|
+
default:
|
|
2687
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
2705
2688
|
}
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
this.raw += `+${this.build.join(".")}`;
|
|
2689
|
+
this.raw = this.format();
|
|
2690
|
+
if (this.build.length) {
|
|
2691
|
+
this.raw += `+${this.build.join(".")}`;
|
|
2692
|
+
}
|
|
2693
|
+
return this;
|
|
2712
2694
|
}
|
|
2713
|
-
return this;
|
|
2714
2695
|
}
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
if (
|
|
2726
|
-
return
|
|
2696
|
+
semver = SemVer;
|
|
2697
|
+
return semver;
|
|
2698
|
+
}
|
|
2699
|
+
var parse_1;
|
|
2700
|
+
var hasRequiredParse;
|
|
2701
|
+
function requireParse() {
|
|
2702
|
+
if (hasRequiredParse) return parse_1;
|
|
2703
|
+
hasRequiredParse = 1;
|
|
2704
|
+
const SemVer = requireSemver();
|
|
2705
|
+
const parse = (version, options, throwErrors = false) => {
|
|
2706
|
+
if (version instanceof SemVer) {
|
|
2707
|
+
return version;
|
|
2727
2708
|
}
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
}
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
};
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
var
|
|
2742
|
-
|
|
2709
|
+
try {
|
|
2710
|
+
return new SemVer(version, options);
|
|
2711
|
+
} catch (er) {
|
|
2712
|
+
if (!throwErrors) {
|
|
2713
|
+
return null;
|
|
2714
|
+
}
|
|
2715
|
+
throw er;
|
|
2716
|
+
}
|
|
2717
|
+
};
|
|
2718
|
+
parse_1 = parse;
|
|
2719
|
+
return parse_1;
|
|
2720
|
+
}
|
|
2721
|
+
var valid_1;
|
|
2722
|
+
var hasRequiredValid;
|
|
2723
|
+
function requireValid() {
|
|
2724
|
+
if (hasRequiredValid) return valid_1;
|
|
2725
|
+
hasRequiredValid = 1;
|
|
2726
|
+
const parse = requireParse();
|
|
2727
|
+
const valid2 = (version, options) => {
|
|
2728
|
+
const v = parse(version, options);
|
|
2729
|
+
return v ? v.version : null;
|
|
2730
|
+
};
|
|
2731
|
+
valid_1 = valid2;
|
|
2732
|
+
return valid_1;
|
|
2733
|
+
}
|
|
2734
|
+
var validExports = requireValid();
|
|
2735
|
+
const valid = /* @__PURE__ */ getDefaultExportFromCjs(validExports);
|
|
2736
|
+
var major_1;
|
|
2737
|
+
var hasRequiredMajor;
|
|
2738
|
+
function requireMajor() {
|
|
2739
|
+
if (hasRequiredMajor) return major_1;
|
|
2740
|
+
hasRequiredMajor = 1;
|
|
2741
|
+
const SemVer = requireSemver();
|
|
2742
|
+
const major2 = (a2, loose) => new SemVer(a2, loose).major;
|
|
2743
|
+
major_1 = major2;
|
|
2744
|
+
return major_1;
|
|
2745
|
+
}
|
|
2746
|
+
var majorExports = requireMajor();
|
|
2747
|
+
const major = /* @__PURE__ */ getDefaultExportFromCjs(majorExports);
|
|
2743
2748
|
class ProxyBus {
|
|
2744
2749
|
bus;
|
|
2745
2750
|
constructor(bus2) {
|
|
2746
|
-
if (typeof bus2.getVersion !== "function" || !valid
|
|
2751
|
+
if (typeof bus2.getVersion !== "function" || !valid(bus2.getVersion())) {
|
|
2747
2752
|
console.warn("Proxying an event bus with an unknown or invalid version");
|
|
2748
|
-
} else if (major
|
|
2753
|
+
} else if (major(bus2.getVersion()) !== major(this.getVersion())) {
|
|
2749
2754
|
console.warn(
|
|
2750
2755
|
"Proxying an event bus of version " + bus2.getVersion() + " with " + this.getVersion()
|
|
2751
2756
|
);
|
|
@@ -2753,7 +2758,7 @@ class ProxyBus {
|
|
|
2753
2758
|
this.bus = bus2;
|
|
2754
2759
|
}
|
|
2755
2760
|
getVersion() {
|
|
2756
|
-
return "3.3.
|
|
2761
|
+
return "3.3.2";
|
|
2757
2762
|
}
|
|
2758
2763
|
subscribe(name, handler) {
|
|
2759
2764
|
this.bus.subscribe(name, handler);
|
|
@@ -2761,14 +2766,14 @@ class ProxyBus {
|
|
|
2761
2766
|
unsubscribe(name, handler) {
|
|
2762
2767
|
this.bus.unsubscribe(name, handler);
|
|
2763
2768
|
}
|
|
2764
|
-
emit(name, event) {
|
|
2765
|
-
this.bus.emit(name, event);
|
|
2769
|
+
emit(name, ...event) {
|
|
2770
|
+
this.bus.emit(name, ...event);
|
|
2766
2771
|
}
|
|
2767
2772
|
}
|
|
2768
2773
|
class SimpleBus {
|
|
2769
2774
|
handlers = /* @__PURE__ */ new Map();
|
|
2770
2775
|
getVersion() {
|
|
2771
|
-
return "3.3.
|
|
2776
|
+
return "3.3.2";
|
|
2772
2777
|
}
|
|
2773
2778
|
subscribe(name, handler) {
|
|
2774
2779
|
this.handlers.set(
|
|
@@ -2784,10 +2789,12 @@ class SimpleBus {
|
|
|
2784
2789
|
(this.handlers.get(name) || []).filter((h2) => h2 !== handler)
|
|
2785
2790
|
);
|
|
2786
2791
|
}
|
|
2787
|
-
emit(name, event) {
|
|
2788
|
-
|
|
2792
|
+
emit(name, ...event) {
|
|
2793
|
+
const handlers = this.handlers.get(name) || [];
|
|
2794
|
+
handlers.forEach((h2) => {
|
|
2789
2795
|
try {
|
|
2790
|
-
|
|
2796
|
+
;
|
|
2797
|
+
h2(event[0]);
|
|
2791
2798
|
} catch (e2) {
|
|
2792
2799
|
console.error("could not invoke event listener", e2);
|
|
2793
2800
|
}
|
|
@@ -2821,8 +2828,8 @@ function getBus() {
|
|
|
2821
2828
|
}
|
|
2822
2829
|
return bus;
|
|
2823
2830
|
}
|
|
2824
|
-
function emit(name, event) {
|
|
2825
|
-
getBus().emit(name, event);
|
|
2831
|
+
function emit(name, ...event) {
|
|
2832
|
+
getBus().emit(name, ...event);
|
|
2826
2833
|
}
|
|
2827
2834
|
/*!
|
|
2828
2835
|
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
|
|
@@ -2941,3 +2948,4 @@ export {
|
|
|
2941
2948
|
unregisterFileListFilter,
|
|
2942
2949
|
validateFilename
|
|
2943
2950
|
};
|
|
2951
|
+
//# sourceMappingURL=index.mjs.map
|